From: support Date: Mon, 2 May 2022 09:28:23 +0000 (+0000) Subject: Built motion from commit ddad7253.|2.6.9 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22javascript:;//%22%7B%7Blicense.chat?a=commitdiff_plain;h=a158bba4beca277a437aa976926bd9f86b8696ec;p=motion2.git Built motion from commit ddad7253.|2.6.9 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 1481de0..66675e6 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-05-02T08:25:41.072Z", + "time": "2022-05-02T09:20:28.352Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 25be963..217c7ea 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-05-02T08:25:41.072Z", + "time": "2022-05-02T09:20:28.352Z", "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 d656fd0..1f7bf97 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 _0xbda9=['getDataValue','action','STRING','contactManager','integration','jscripty','urlForward','browser','script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL'];(function(_0x5c364d,_0x34f589){var _0xe70993=function(_0xa0c937){while(--_0xa0c937){_0x5c364d['push'](_0x5c364d['shift']());}};_0xe70993(++_0x34f589);}(_0xbda9,0x101));var _0x9bda=function(_0x13c70c,_0x546b34){_0x13c70c=_0x13c70c-0x0;var _0x50f0f2=_0xbda9[_0x13c70c];return _0x50f0f2;};'use strict';var Sequelize=require(_0x9bda('0x0'));module[_0x9bda('0x1')]={'name':{'type':Sequelize[_0x9bda('0x2')],'get':function(_0x203d94){return this[_0x9bda('0x3')](_0x9bda('0x4'));}},'action':{'type':Sequelize[_0x9bda('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x9bda('0x6'),_0x9bda('0x7'),'motionbar',_0x9bda('0x8'),_0x9bda('0x9'),_0x9bda('0xa'),'bot',_0x9bda('0xb')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x9bda('0x5')](0x1000),'comment':_0x9bda('0xc')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x9bda('0xd')},'data3':{'type':Sequelize[_0x9bda('0x5')](0x1000),'comment':_0x9bda('0xe')},'data4':{'type':Sequelize[_0x9bda('0x5')](0x1000),'comments':_0x9bda('0xf')},'data5':{'type':Sequelize[_0x9bda('0x5')](0x1000),'comments':_0x9bda('0x10')},'data6':{'type':Sequelize['STRING'],'comments':_0x9bda('0x11')},'data7':{'type':Sequelize[_0x9bda('0x12')],'comments':_0x9bda('0x13')}}; \ No newline at end of file +var _0x9096=['motionbar','jscripty','urlForward','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','action','contactManager'];(function(_0x505e56,_0x310801){var _0x2e2a22=function(_0x23f438){while(--_0x23f438){_0x505e56['push'](_0x505e56['shift']());}};_0x2e2a22(++_0x310801);}(_0x9096,0x174));var _0x6909=function(_0x478f05,_0x2439b3){_0x478f05=_0x478f05-0x0;var _0x299201=_0x9096[_0x478f05];return _0x299201;};'use strict';var Sequelize=require(_0x6909('0x0'));module[_0x6909('0x1')]={'name':{'type':Sequelize[_0x6909('0x2')],'get':function(_0x44ff5b){return this[_0x6909('0x3')](_0x6909('0x4'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x6909('0x5'),'integration',_0x6909('0x6'),_0x6909('0x7'),_0x6909('0x8'),'browser','bot',_0x6909('0x9')]],'msg':_0x6909('0xa')}},'comment':_0x6909('0xa')},'data1':{'type':Sequelize[_0x6909('0xb')](0x1000),'comment':_0x6909('0xc')},'data2':{'type':Sequelize[_0x6909('0xb')](0x1000),'comment':_0x6909('0xd')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x6909('0xe')},'data4':{'type':Sequelize[_0x6909('0xb')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0x6909('0xb')](0x1000),'comments':_0x6909('0xf')},'data6':{'type':Sequelize[_0x6909('0xb')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0x6909('0x10')],'comments':_0x6909('0x11')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 703095e..3894f29 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 _0x0341=['sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','end','error','stack','name','send','body','Action','find','params','catch','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0341,0x17f));var _0x1034=function(_0x371adf,_0x4f537d){_0x371adf=_0x371adf-0x0;var _0x552c62=_0x0341[_0x371adf];return _0x552c62;};'use strict';var emlformat=require(_0x1034('0x0'));var rimraf=require(_0x1034('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1034('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1034('0x3'));var Mustache=require(_0x1034('0x4'));var util=require(_0x1034('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x1034('0x6'));var ejs=require(_0x1034('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1034('0x8'));var squel=require(_0x1034('0x9'));var crypto=require(_0x1034('0xa'));var jsforce=require(_0x1034('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1034('0x6'));var querystring=require(_0x1034('0xc'));var Papa=require(_0x1034('0xd'));var Redis=require(_0x1034('0xe'));var authService=require(_0x1034('0xf'));var qs=require(_0x1034('0x10'));var as=require(_0x1034('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1034('0x12'))(_0x1034('0x13'));var utils=require(_0x1034('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1034('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d7528,_0x23ccdb){_0x23ccdb=_0x23ccdb||0xcc;return function(_0x44fe2d){if(_0x44fe2d){return _0x4d7528[_0x1034('0x16')](_0x23ccdb);}return _0x4d7528[_0x1034('0x17')](_0x23ccdb)['end']();};}function respondWithResult(_0x39b8de,_0x5551e3){_0x5551e3=_0x5551e3||0xc8;return function(_0x157066){if(_0x157066){return _0x39b8de[_0x1034('0x17')](_0x5551e3)['json'](_0x157066);}};}function respondWithFilteredResult(_0x30c91,_0x3c08e5){return function(_0x109b2b){if(_0x109b2b){var _0x41bd6c=typeof _0x3c08e5[_0x1034('0x18')]===_0x1034('0x19')&&typeof _0x3c08e5[_0x1034('0x1a')]==='undefined';var _0x1b33cb=_0x109b2b[_0x1034('0x1b')];var _0x1fab03=_0x41bd6c?0x0:_0x3c08e5[_0x1034('0x18')];var _0x50eee7=_0x41bd6c?_0x109b2b[_0x1034('0x1b')]:_0x3c08e5[_0x1034('0x18')]+_0x3c08e5[_0x1034('0x1a')];var _0x490878;if(_0x50eee7>=_0x1b33cb){_0x50eee7=_0x1b33cb;_0x490878=0xc8;}else{_0x490878=0xce;}_0x30c91[_0x1034('0x17')](_0x490878);return _0x30c91[_0x1034('0x1c')](_0x1034('0x1d'),_0x1fab03+'-'+_0x50eee7+'/'+_0x1b33cb)['json'](_0x109b2b);}return null;};}function patchUpdates(_0x567937){return function(_0x1cd552){try{jsonpatch[_0x1034('0x1e')](_0x1cd552,_0x567937,!![]);}catch(_0x5da967){return BPromise[_0x1034('0x1f')](_0x5da967);}return _0x1cd552['save']();};}function saveUpdates(_0x314465,_0x2068d8){return function(_0x33a6e9){if(_0x33a6e9){return _0x33a6e9[_0x1034('0x20')](_0x314465)['then'](function(_0x3f4571){return _0x3f4571;});}return null;};}function removeEntity(_0x24815f,_0x5ae46b){return function(_0x53d2e3){if(_0x53d2e3){return _0x53d2e3[_0x1034('0x21')]()[_0x1034('0x22')](function(){_0x24815f[_0x1034('0x17')](0xcc)[_0x1034('0x23')]();});}};}function handleEntityNotFound(_0x57bbff,_0x3aec98){return function(_0x41fd6d){if(!_0x41fd6d){_0x57bbff[_0x1034('0x16')](0x194);}return _0x41fd6d;};}function handleError(_0x5543ee,_0x558b72){_0x558b72=_0x558b72||0x1f4;return function(_0x5e384b){logger[_0x1034('0x24')](_0x5e384b[_0x1034('0x25')]);if(_0x5e384b[_0x1034('0x26')]){delete _0x5e384b[_0x1034('0x26')];}_0x5543ee['status'](_0x558b72)[_0x1034('0x27')](_0x5e384b);};}exports[_0x1034('0x20')]=function(_0x94094e,_0x11a195){if(_0x94094e[_0x1034('0x28')]['id']){delete _0x94094e['body']['id'];}return db[_0x1034('0x29')][_0x1034('0x2a')]({'where':{'id':_0x94094e[_0x1034('0x2b')]['id']}})[_0x1034('0x22')](handleEntityNotFound(_0x11a195,null))[_0x1034('0x22')](saveUpdates(_0x94094e[_0x1034('0x28')],null))[_0x1034('0x22')](respondWithResult(_0x11a195,null))[_0x1034('0x2c')](handleError(_0x11a195,null));};exports[_0x1034('0x21')]=function(_0x1419c4,_0xd4ea60){return db[_0x1034('0x29')][_0x1034('0x2a')]({'where':{'id':_0x1419c4[_0x1034('0x2b')]['id']}})['then'](handleEntityNotFound(_0xd4ea60,null))[_0x1034('0x22')](removeEntity(_0xd4ea60,null))[_0x1034('0x2c')](handleError(_0xd4ea60,null));}; \ No newline at end of file +var _0x6856=['status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','end','error','stack','send','body','Action','params','then','catch','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6856,0x14f));var _0x6685=function(_0xdca98f,_0x32451a){_0xdca98f=_0xdca98f-0x0;var _0xebea52=_0x6856[_0xdca98f];return _0xebea52;};'use strict';var emlformat=require(_0x6685('0x0'));var rimraf=require(_0x6685('0x1'));var zipdir=require(_0x6685('0x2'));var jsonpatch=require(_0x6685('0x3'));var rp=require(_0x6685('0x4'));var moment=require(_0x6685('0x5'));var BPromise=require(_0x6685('0x6'));var Mustache=require(_0x6685('0x7'));var util=require(_0x6685('0x8'));var path=require(_0x6685('0x9'));var sox=require(_0x6685('0xa'));var csv=require('to-csv');var ejs=require(_0x6685('0xb'));var fs=require('fs');var fs_extra=require(_0x6685('0xc'));var _=require(_0x6685('0xd'));var squel=require(_0x6685('0xe'));var crypto=require(_0x6685('0xf'));var jsforce=require(_0x6685('0x10'));var deskjs=require(_0x6685('0x11'));var toCsv=require(_0x6685('0x12'));var querystring=require(_0x6685('0x13'));var Papa=require('papaparse');var Redis=require(_0x6685('0x14'));var authService=require(_0x6685('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x6685('0x16'));var hardwareService=require(_0x6685('0x17'));var logger=require(_0x6685('0x18'))(_0x6685('0x19'));var utils=require(_0x6685('0x1a'));var config=require(_0x6685('0x1b'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb91dbf,_0x1fbde6){_0x1fbde6=_0x1fbde6||0xcc;return function(_0x138c50){if(_0x138c50){return _0xb91dbf[_0x6685('0x1c')](_0x1fbde6);}return _0xb91dbf[_0x6685('0x1d')](_0x1fbde6)['end']();};}function respondWithResult(_0x133fa8,_0x37fa13){_0x37fa13=_0x37fa13||0xc8;return function(_0x30a8e3){if(_0x30a8e3){return _0x133fa8['status'](_0x37fa13)[_0x6685('0x1e')](_0x30a8e3);}};}function respondWithFilteredResult(_0x84fbf5,_0x2bd51e){return function(_0x380070){if(_0x380070){var _0x494d67=typeof _0x2bd51e[_0x6685('0x1f')]===_0x6685('0x20')&&typeof _0x2bd51e['limit']===_0x6685('0x20');var _0xc11c9d=_0x380070[_0x6685('0x21')];var _0x110cbb=_0x494d67?0x0:_0x2bd51e['offset'];var _0x1ec653=_0x494d67?_0x380070[_0x6685('0x21')]:_0x2bd51e[_0x6685('0x1f')]+_0x2bd51e[_0x6685('0x22')];var _0xec4d9c;if(_0x1ec653>=_0xc11c9d){_0x1ec653=_0xc11c9d;_0xec4d9c=0xc8;}else{_0xec4d9c=0xce;}_0x84fbf5['status'](_0xec4d9c);return _0x84fbf5[_0x6685('0x23')](_0x6685('0x24'),_0x110cbb+'-'+_0x1ec653+'/'+_0xc11c9d)[_0x6685('0x1e')](_0x380070);}return null;};}function patchUpdates(_0x15b1bd){return function(_0x4bf6ef){try{jsonpatch[_0x6685('0x25')](_0x4bf6ef,_0x15b1bd,!![]);}catch(_0x1e6523){return BPromise[_0x6685('0x26')](_0x1e6523);}return _0x4bf6ef[_0x6685('0x27')]();};}function saveUpdates(_0x28b8fe,_0x395668){return function(_0x318e6b){if(_0x318e6b){return _0x318e6b[_0x6685('0x28')](_0x28b8fe)['then'](function(_0x342bb8){return _0x342bb8;});}return null;};}function removeEntity(_0x2eeb03,_0x1060ad){return function(_0x1c9363){if(_0x1c9363){return _0x1c9363[_0x6685('0x29')]()['then'](function(){_0x2eeb03['status'](0xcc)[_0x6685('0x2a')]();});}};}function handleEntityNotFound(_0x1e4bed,_0xa03b5){return function(_0x5b5410){if(!_0x5b5410){_0x1e4bed['sendStatus'](0x194);}return _0x5b5410;};}function handleError(_0xd8c80a,_0x5932c9){_0x5932c9=_0x5932c9||0x1f4;return function(_0x3477e2){logger[_0x6685('0x2b')](_0x3477e2[_0x6685('0x2c')]);if(_0x3477e2['name']){delete _0x3477e2['name'];}_0xd8c80a[_0x6685('0x1d')](_0x5932c9)[_0x6685('0x2d')](_0x3477e2);};}exports[_0x6685('0x28')]=function(_0x539d1c,_0x250e8b){if(_0x539d1c[_0x6685('0x2e')]['id']){delete _0x539d1c[_0x6685('0x2e')]['id'];}return db[_0x6685('0x2f')]['find']({'where':{'id':_0x539d1c[_0x6685('0x30')]['id']}})[_0x6685('0x31')](handleEntityNotFound(_0x250e8b,null))['then'](saveUpdates(_0x539d1c[_0x6685('0x2e')],null))['then'](respondWithResult(_0x250e8b,null))[_0x6685('0x32')](handleError(_0x250e8b,null));};exports[_0x6685('0x29')]=function(_0x5a2c9b,_0x58c130){return db[_0x6685('0x2f')][_0x6685('0x33')]({'where':{'id':_0x5a2c9b['params']['id']}})[_0x6685('0x31')](handleEntityNotFound(_0x58c130,null))[_0x6685('0x31')](removeEntity(_0x58c130,null))['catch'](handleError(_0x58c130,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 0d5a57a..815c5d8 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 _0x9037=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','exports','define','tools_actions','util'];(function(_0x215e7f,_0x11276f){var _0x2374c1=function(_0x4e4a59){while(--_0x4e4a59){_0x215e7f['push'](_0x215e7f['shift']());}};_0x2374c1(++_0x11276f);}(_0x9037,0xbf));var _0x7903=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9037[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x7903('0x0'));var logger=require('../../config/logger')(_0x7903('0x1'));var moment=require(_0x7903('0x2'));var BPromise=require(_0x7903('0x3'));var rp=require(_0x7903('0x4'));var fs=require('fs');var path=require(_0x7903('0x5'));var rimraf=require(_0x7903('0x6'));var config=require(_0x7903('0x7'));var attributes=require(_0x7903('0x8'));module[_0x7903('0x9')]=function(_0x3ac717,_0x3f13aa){return _0x3ac717[_0x7903('0xa')]('Action',attributes,{'tableName':_0x7903('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6881=['define','Action','tools_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./action.attributes','exports'];(function(_0xc587ed,_0x11cbc2){var _0x41d137=function(_0x2d288f){while(--_0x2d288f){_0xc587ed['push'](_0xc587ed['shift']());}};_0x41d137(++_0x11cbc2);}(_0x6881,0x1bd));var _0x1688=function(_0x200932,_0x250301){_0x200932=_0x200932-0x0;var _0x239ae8=_0x6881[_0x200932];return _0x239ae8;};'use strict';var _=require(_0x1688('0x0'));var util=require(_0x1688('0x1'));var logger=require(_0x1688('0x2'))(_0x1688('0x3'));var moment=require(_0x1688('0x4'));var BPromise=require(_0x1688('0x5'));var rp=require(_0x1688('0x6'));var fs=require('fs');var path=require(_0x1688('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1688('0x8'));module[_0x1688('0x9')]=function(_0x4c51ca,_0x5d70bb){return _0x4c51ca[_0x1688('0xa')](_0x1688('0xb'),attributes,{'tableName':_0x1688('0xc'),'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 05e8115..664cc0c 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['info','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x209118,_0x1e6e18){var _0x5e4e47=function(_0x253f37){while(--_0x253f37){_0x209118['push'](_0x209118['shift']());}};_0x5e4e47(++_0x1e6e18);}(_0x326f,0xd1));var _0xf326=function(_0x468446,_0x545129){_0x468446=_0x468446-0x0;var _0x16f880=_0x326f[_0x468446];return _0x16f880;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('Action,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('Action,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});} \ No newline at end of file +var _0x5fc3=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x32e40d,_0x44c6aa){var _0x38a639=function(_0x56c203){while(--_0x56c203){_0x32e40d['push'](_0x32e40d['shift']());}};_0x38a639(++_0x44c6aa);}(_0x5fc3,0xa8));var _0x35fc=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0x5fc3[_0x13ce0c];return _0x4388fb;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('Action,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Action,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('Action,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index b30a32d..4e785f7 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 _0x5ee5=['put','/:id','isAuthenticated','update','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x5ee5,0x1aa));var _0x55ee=function(_0x223bdb,_0x5882e6){_0x223bdb=_0x223bdb-0x0;var _0xef8e68=_0x5ee5[_0x223bdb];return _0xef8e68;};'use strict';var multer=require(_0x55ee('0x0'));var util=require(_0x55ee('0x1'));var path=require('path');var timeout=require(_0x55ee('0x2'));var express=require(_0x55ee('0x3'));var router=express['Router']();var fs_extra=require(_0x55ee('0x4'));var auth=require(_0x55ee('0x5'));var interaction=require(_0x55ee('0x6'));var config=require(_0x55ee('0x7'));var controller=require(_0x55ee('0x8'));router[_0x55ee('0x9')](_0x55ee('0xa'),auth[_0x55ee('0xb')](),controller[_0x55ee('0xc')]);router[_0x55ee('0xd')](_0x55ee('0xa'),auth['isAuthenticated'](),controller[_0x55ee('0xe')]);module['exports']=router; \ No newline at end of file +var _0x7952=['./action.controller','put','update','delete','/:id','isAuthenticated','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment'];(function(_0x33ff87,_0x3455ee){var _0x5c9017=function(_0x4a8d60){while(--_0x4a8d60){_0x33ff87['push'](_0x33ff87['shift']());}};_0x5c9017(++_0x3455ee);}(_0x7952,0x1ca));var _0x2795=function(_0x33bcdb,_0x11846b){_0x33bcdb=_0x33bcdb-0x0;var _0x18a9bf=_0x7952[_0x33bcdb];return _0x18a9bf;};'use strict';var multer=require(_0x2795('0x0'));var util=require('util');var path=require(_0x2795('0x1'));var timeout=require(_0x2795('0x2'));var express=require(_0x2795('0x3'));var router=express[_0x2795('0x4')]();var fs_extra=require(_0x2795('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2795('0x6'));var controller=require(_0x2795('0x7'));router[_0x2795('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x2795('0x9')]);router[_0x2795('0xa')](_0x2795('0xb'),auth[_0x2795('0xc')](),controller[_0x2795('0xd')]);module[_0x2795('0xe')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 417d28a..948d7e8 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 _0xbd51=['sequelize','STRING'];(function(_0x5b95f2,_0x2adb49){var _0x376b33=function(_0x57c21b){while(--_0x57c21b){_0x5b95f2['push'](_0x5b95f2['shift']());}};_0x376b33(++_0x2adb49);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x224572,_0x40bf1a){_0x224572=_0x224572-0x0;var _0x498369=_0xbd51[_0x224572];return _0x498369;};'use strict';var Sequelize=require(_0x1bd5('0x0'));module['exports']={'name':{'type':Sequelize[_0x1bd5('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x1bd5('0x1')]},'parent':{'type':Sequelize[_0x1bd5('0x1')]},'table':{'type':Sequelize[_0x1bd5('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xdc97=['exports','STRING','TEXT','sequelize'];(function(_0x29c261,_0x3af39a){var _0x1a9335=function(_0x40d1e8){while(--_0x40d1e8){_0x29c261['push'](_0x29c261['shift']());}};_0x1a9335(++_0x3af39a);}(_0xdc97,0x13b));var _0x7dc9=function(_0x489b4a,_0x204f4a){_0x489b4a=_0x489b4a-0x0;var _0x596632=_0xdc97[_0x489b4a];return _0x596632;};'use strict';var Sequelize=require(_0x7dc9('0x0'));module[_0x7dc9('0x1')]={'name':{'type':Sequelize[_0x7dc9('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x7dc9('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x7dc9('0x3')]},'joins':{'type':Sequelize[_0x7dc9('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 3c2a060..509acf8 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 _0xd5fc=['output','csv','custom','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','../../components/export/','../../files/reports','savename','countTable','runReport','COUNT(%s)','AVG(%s)','eml-format','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','reject','update','then','destroy','get','CustomReports','UserProfileResource','end','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Reports','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','join','left_join','right_join','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','table','MetricId','metric','format','replace','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','includes','IS\x20EMPTY','Sequelize','ValidationErrorItem','from','function','web','fullPath','%s-%s.%s'];(function(_0xe8dbd2,_0x11e2a8){var _0x46836c=function(_0x1b833c){while(--_0x1b833c){_0xe8dbd2['push'](_0xe8dbd2['shift']());}};_0x46836c(++_0x11e2a8);}(_0xd5fc,0xae));var _0xcd5f=function(_0x5b159e,_0x1a7b63){_0x5b159e=_0x5b159e-0x0;var _0x574d5b=_0xd5fc[_0x5b159e];return _0x574d5b;};'use strict';var emlformat=require(_0xcd5f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcd5f('0x1'));var moment=require(_0xcd5f('0x2'));var BPromise=require(_0xcd5f('0x3'));var Mustache=require(_0xcd5f('0x4'));var util=require(_0xcd5f('0x5'));var path=require(_0xcd5f('0x6'));var sox=require('sox');var csv=require(_0xcd5f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcd5f('0x8'));var _=require(_0xcd5f('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcd5f('0xa'));var toCsv=require('to-csv');var querystring=require(_0xcd5f('0xb'));var Papa=require(_0xcd5f('0xc'));var Redis=require('ioredis');var authService=require(_0xcd5f('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xcd5f('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcd5f('0xf'))(_0xcd5f('0x10'));var utils=require(_0xcd5f('0x11'));var config=require(_0xcd5f('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xcd5f('0x13'))['db'];var dbH=require(_0xcd5f('0x13'))['dbH'];function respondWithStatusCode(_0x14125f,_0x2c23a7){_0x2c23a7=_0x2c23a7||0xcc;return function(_0x2bebdd){if(_0x2bebdd){return _0x14125f[_0xcd5f('0x14')](_0x2c23a7);}return _0x14125f[_0xcd5f('0x15')](_0x2c23a7)['end']();};}function respondWithResult(_0x2ff7e1,_0x42b369){_0x42b369=_0x42b369||0xc8;return function(_0xc088a3){if(_0xc088a3){return _0x2ff7e1[_0xcd5f('0x15')](_0x42b369)[_0xcd5f('0x16')](_0xc088a3);}};}function respondWithFilteredResult(_0xb4503d,_0x29a1c8){return function(_0x503ab6){if(_0x503ab6){var _0x398e16=typeof _0x29a1c8[_0xcd5f('0x17')]===_0xcd5f('0x18')&&typeof _0x29a1c8[_0xcd5f('0x19')]==='undefined';var _0x1a4cb6=_0x503ab6['count'];var _0xb23761=_0x398e16?0x0:_0x29a1c8[_0xcd5f('0x17')];var _0x48d5bb=_0x398e16?_0x503ab6[_0xcd5f('0x1a')]:_0x29a1c8[_0xcd5f('0x17')]+_0x29a1c8['limit'];var _0x3a952b;if(_0x48d5bb>=_0x1a4cb6){_0x48d5bb=_0x1a4cb6;_0x3a952b=0xc8;}else{_0x3a952b=0xce;}_0xb4503d['status'](_0x3a952b);return _0xb4503d[_0xcd5f('0x1b')]('Content-Range',_0xb23761+'-'+_0x48d5bb+'/'+_0x1a4cb6)['json'](_0x503ab6);}return null;};}function patchUpdates(_0x152424){return function(_0x5e7a24){try{jsonpatch['apply'](_0x5e7a24,_0x152424,!![]);}catch(_0x5a26f2){return BPromise[_0xcd5f('0x1c')](_0x5a26f2);}return _0x5e7a24['save']();};}function saveUpdates(_0x154449,_0x3728e5){return function(_0x2c6a1b){if(_0x2c6a1b){return _0x2c6a1b[_0xcd5f('0x1d')](_0x154449)[_0xcd5f('0x1e')](function(_0x50d4c3){return _0x50d4c3;});}return null;};}function removeEntity(_0x388290,_0x41015c){return function(_0x4dc7ab){if(_0x4dc7ab){return _0x4dc7ab[_0xcd5f('0x1f')]()[_0xcd5f('0x1e')](function(){var _0x221adc=_0x4dc7ab[_0xcd5f('0x20')]({'plain':!![]});var _0x97fff9=_0xcd5f('0x21');return db[_0xcd5f('0x22')][_0xcd5f('0x1f')]({'where':{'type':_0x97fff9,'resourceId':_0x221adc['id']}})[_0xcd5f('0x1e')](function(){return _0x4dc7ab;});})[_0xcd5f('0x1e')](function(){_0x388290[_0xcd5f('0x15')](0xcc)[_0xcd5f('0x23')]();});}};}function handleEntityNotFound(_0x1051c3,_0x29857a){return function(_0x56a74a){if(!_0x56a74a){_0x1051c3[_0xcd5f('0x14')](0x194);}return _0x56a74a;};}function handleError(_0x3ae2f1,_0x561414){_0x561414=_0x561414||0x1f4;return function(_0xd7f50f){logger['error'](_0xd7f50f[_0xcd5f('0x24')]);if(_0xd7f50f[_0xcd5f('0x25')]){delete _0xd7f50f[_0xcd5f('0x25')];}_0x3ae2f1[_0xcd5f('0x15')](_0x561414)[_0xcd5f('0x26')](_0xd7f50f);};}exports[_0xcd5f('0x27')]=function(_0x57e5cf,_0x5955bb){var _0x116223={},_0x168d97={},_0x327260={'count':0x0,'rows':[]};var _0x10507f=_[_0xcd5f('0x28')](db[_0xcd5f('0x29')][_0xcd5f('0x2a')],function(_0x4b0eb8){return{'name':_0x4b0eb8[_0xcd5f('0x2b')],'type':_0x4b0eb8[_0xcd5f('0x2c')][_0xcd5f('0x2d')]};});_0x168d97[_0xcd5f('0x2e')]=_['map'](_0x10507f,_0xcd5f('0x25'));_0x168d97[_0xcd5f('0x2f')]=_[_0xcd5f('0x30')](_0x57e5cf['query']);_0x168d97[_0xcd5f('0x31')]=_[_0xcd5f('0x32')](_0x168d97[_0xcd5f('0x2e')],_0x168d97[_0xcd5f('0x2f')]);_0x116223[_0xcd5f('0x33')]=_[_0xcd5f('0x32')](_0x168d97[_0xcd5f('0x2e')],qs[_0xcd5f('0x34')](_0x57e5cf['query']['fields']));_0x116223[_0xcd5f('0x33')]=_0x116223['attributes'][_0xcd5f('0x35')]?_0x116223[_0xcd5f('0x33')]:_0x168d97[_0xcd5f('0x2e')];if(!_0x57e5cf['query'][_0xcd5f('0x36')](_0xcd5f('0x37'))){_0x116223[_0xcd5f('0x19')]=qs[_0xcd5f('0x19')](_0x57e5cf['query'][_0xcd5f('0x19')]);_0x116223['offset']=qs[_0xcd5f('0x17')](_0x57e5cf[_0xcd5f('0x2f')][_0xcd5f('0x17')]);}_0x116223[_0xcd5f('0x38')]=qs[_0xcd5f('0x39')](_0x57e5cf[_0xcd5f('0x2f')]['sort']);_0x116223[_0xcd5f('0x3a')]=qs['filters'](_[_0xcd5f('0x3b')](_0x57e5cf[_0xcd5f('0x2f')],_0x168d97[_0xcd5f('0x31')]),_0x10507f);if(_0x57e5cf['query'][_0xcd5f('0x3c')]){_0x116223[_0xcd5f('0x3a')]=_[_0xcd5f('0x3d')](_0x116223[_0xcd5f('0x3a')],{'$or':_[_0xcd5f('0x28')](_0x10507f,function(_0xcb04bf){if(_0xcb04bf[_0xcd5f('0x2c')]!=='VIRTUAL'){var _0x429db3={};_0x429db3[_0xcb04bf[_0xcd5f('0x25')]]={'$like':'%'+_0x57e5cf[_0xcd5f('0x2f')]['filter']+'%'};return _0x429db3;}})});}_0x116223=_['merge']({},_0x116223,_0x57e5cf[_0xcd5f('0x3e')]);var _0x555a85={'where':_0x116223[_0xcd5f('0x3a')]};return db[_0xcd5f('0x29')][_0xcd5f('0x1a')](_0x555a85)[_0xcd5f('0x1e')](function(_0x53d800){_0x327260[_0xcd5f('0x1a')]=_0x53d800;if(_0x57e5cf['query'][_0xcd5f('0x3f')]){_0x116223[_0xcd5f('0x40')]=[{'all':!![]}];}return db[_0xcd5f('0x29')]['findAll'](_0x116223);})[_0xcd5f('0x1e')](function(_0x1920da){_0x327260[_0xcd5f('0x41')]=_0x1920da;return _0x327260;})[_0xcd5f('0x1e')](respondWithFilteredResult(_0x5955bb,_0x116223))[_0xcd5f('0x42')](handleError(_0x5955bb,null));};exports[_0xcd5f('0x43')]=function(_0x223de4,_0x302ed7){var _0x295dd6={'raw':![],'where':{'id':_0x223de4['params']['id']}},_0x19fb5d={};_0x19fb5d['model']=_[_0xcd5f('0x30')](db[_0xcd5f('0x29')][_0xcd5f('0x2a')]);_0x19fb5d[_0xcd5f('0x2f')]=_['keys'](_0x223de4[_0xcd5f('0x2f')]);_0x19fb5d['filters']=_[_0xcd5f('0x32')](_0x19fb5d[_0xcd5f('0x2e')],_0x19fb5d[_0xcd5f('0x2f')]);_0x295dd6['attributes']=_['intersection'](_0x19fb5d[_0xcd5f('0x2e')],qs[_0xcd5f('0x34')](_0x223de4[_0xcd5f('0x2f')][_0xcd5f('0x34')]));_0x295dd6[_0xcd5f('0x33')]=_0x295dd6[_0xcd5f('0x33')][_0xcd5f('0x35')]?_0x295dd6[_0xcd5f('0x33')]:_0x19fb5d[_0xcd5f('0x2e')];if(_0x223de4['query']['includeAll']){_0x295dd6[_0xcd5f('0x40')]=[{'all':!![]}];}_0x295dd6=_[_0xcd5f('0x3d')]({},_0x295dd6,_0x223de4[_0xcd5f('0x3e')]);return db['AnalyticCustomReport'][_0xcd5f('0x44')](_0x295dd6)[_0xcd5f('0x1e')](handleEntityNotFound(_0x302ed7,null))[_0xcd5f('0x1e')](respondWithResult(_0x302ed7,null))[_0xcd5f('0x42')](handleError(_0x302ed7,null));};exports[_0xcd5f('0x45')]=function(_0x59fa3a,_0x183ac3){return db[_0xcd5f('0x29')][_0xcd5f('0x45')](_0x59fa3a[_0xcd5f('0x46')],{})[_0xcd5f('0x1e')](function(_0xf30d3d){var _0x3e4c92=_0x59fa3a['user']['get']({'plain':!![]});if(!_0x3e4c92)throw new Error(_0xcd5f('0x47'));if(_0x3e4c92['role']===_0xcd5f('0x48')){var _0x4c5a98=_0xf30d3d[_0xcd5f('0x20')]({'plain':!![]});var _0x3d05a9=_0xcd5f('0x49');return db[_0xcd5f('0x4a')][_0xcd5f('0x44')]({'where':{'name':_0x3d05a9,'userProfileId':_0x3e4c92['userProfileId']},'raw':!![]})[_0xcd5f('0x1e')](function(_0x3d856e){if(_0x3d856e&&_0x3d856e[_0xcd5f('0x4b')]===0x0){return db[_0xcd5f('0x22')][_0xcd5f('0x45')]({'name':_0x4c5a98['name'],'resourceId':_0x4c5a98['id'],'type':_0xcd5f('0x21'),'sectionId':_0x3d856e['id']},{})[_0xcd5f('0x1e')](function(){return _0xf30d3d;});}else{return _0xf30d3d;}})[_0xcd5f('0x42')](function(_0x4aa2c0){logger[_0xcd5f('0x4c')](_0xcd5f('0x4d'),_0x4aa2c0);throw _0x4aa2c0;});}return _0xf30d3d;})['then'](respondWithResult(_0x183ac3,0xc9))[_0xcd5f('0x42')](handleError(_0x183ac3,null));};exports[_0xcd5f('0x1d')]=function(_0xc8d6a,_0x8bc8d1){if(_0xc8d6a[_0xcd5f('0x46')]['id']){delete _0xc8d6a[_0xcd5f('0x46')]['id'];}return db[_0xcd5f('0x29')][_0xcd5f('0x44')]({'where':{'id':_0xc8d6a[_0xcd5f('0x4e')]['id']}})[_0xcd5f('0x1e')](handleEntityNotFound(_0x8bc8d1,null))[_0xcd5f('0x1e')](saveUpdates(_0xc8d6a[_0xcd5f('0x46')],null))[_0xcd5f('0x1e')](respondWithResult(_0x8bc8d1,null))['catch'](handleError(_0x8bc8d1,null));};exports['destroy']=function(_0x157c69,_0x4e269f){return db['AnalyticCustomReport'][_0xcd5f('0x44')]({'where':{'id':_0x157c69['params']['id']}})[_0xcd5f('0x1e')](handleEntityNotFound(_0x4e269f,null))[_0xcd5f('0x1e')](removeEntity(_0x4e269f,null))[_0xcd5f('0x42')](handleError(_0x4e269f,null));};exports['preview']=function(_0x356b97,_0x4da639){var _0x4a3c69=0xa;var _0x59943f=[_0xcd5f('0x4f'),_0xcd5f('0x50'),_0xcd5f('0x51'),'cross_join'];var _0x43b8a9={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xcd5f('0x52'),'MIN':_0xcd5f('0x53'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xcd5f('0x54'),'GROUP_CONCAT ASC':_0xcd5f('0x55'),'GROUP_CONCAT DESC':_0xcd5f('0x56')};var _0x28078f={'SEC_TO_TIME':_0xcd5f('0x57'),'DATE':_0xcd5f('0x58'),'HOUR':_0xcd5f('0x59'),'ROUND':_0xcd5f('0x5a'),'UNIX_TIMESTAMP':_0xcd5f('0x5b')};var _0x3c9ae4=function(_0x4263ec){return!_['includes']([_0xcd5f('0x5c'),_0xcd5f('0x5d'),'IS\x20EMPTY',_0xcd5f('0x5e')],_0x4263ec);};var _0x1bb74b=function(_0x2c9eae){if(!_0x2c9eae||!_0x2c9eae[_0xcd5f('0x5f')][_0xcd5f('0x35')]){return'';}for(var _0x232b7f='(',_0x132636=0x0;_0x132636<_0x2c9eae[_0xcd5f('0x5f')][_0xcd5f('0x35')];_0x132636+=0x1){_0x132636>0x0&&(_0x232b7f+='\x20'+_0x2c9eae[_0xcd5f('0x60')]+'\x20');_0x232b7f+=_0x2c9eae['rules'][_0x132636]['group']?_0x1bb74b(_0x2c9eae[_0xcd5f('0x5f')][_0x132636][_0xcd5f('0x61')]):_0x2c9eae[_0xcd5f('0x5f')][_0x132636][_0xcd5f('0x62')]+'\x20'+_0x2c9eae[_0xcd5f('0x5f')][_0x132636][_0xcd5f('0x63')]+(_0x3c9ae4(_0x2c9eae[_0xcd5f('0x5f')][_0x132636][_0xcd5f('0x63')])?'\x20'+_0x2c9eae[_0xcd5f('0x5f')][_0x132636][_0xcd5f('0x64')]:'');}return _0x232b7f+')';};var _0x22dd4a={'where':{'id':_0x356b97[_0xcd5f('0x4e')]['id']}},_0x4b3f83,_0xe12197,_0x26339e,_0x241243,_0x441bfb;_0x22dd4a=_[_0xcd5f('0x3d')]({},_0x22dd4a,_0x356b97[_0xcd5f('0x3e')]);return db['AnalyticCustomReport'][_0xcd5f('0x44')](_0x22dd4a)[_0xcd5f('0x1e')](function(_0x16b4dc){if(_0x16b4dc){_0x4b3f83=_0x16b4dc;return _0x16b4dc[_0xcd5f('0x65')]();}return null;})[_0xcd5f('0x1e')](function(_0x31c395){if(_0x31c395){if(!_0x31c395[_0xcd5f('0x35')]){throw new db['Sequelize']['ValidationErrorItem'](_0xcd5f('0x66'),0x193);}_0xe12197=_0x31c395;return db[_0xcd5f('0x67')][_0xcd5f('0x68')]({'raw':!![]});}return null;})[_0xcd5f('0x1e')](function(_0x507c27){if(_0x507c27){_0x26339e=_[_0xcd5f('0x69')](_0x507c27,'id');var _0x523760;var _0x100531=squel[_0xcd5f('0x6a')]();_0x100531['from'](_0x4b3f83[_0xcd5f('0x6b')]);for(var _0x46dd28=0x0;_0x46dd28<_0xe12197[_0xcd5f('0x35')];_0x46dd28+=0x1){_0x523760=_0xe12197[_0x46dd28][_0xcd5f('0x6c')]?_0x26339e[_0xe12197[_0x46dd28][_0xcd5f('0x6c')]][_0xcd5f('0x6d')]:_0xe12197[_0x46dd28][_0xcd5f('0x62')];_0x523760=_0xe12197[_0x46dd28]['function']?_['replace'](_0x43b8a9[_0xe12197[_0x46dd28]['function']],'%s',_0x523760):_0x523760;_0x523760=_0xe12197[_0x46dd28][_0xcd5f('0x6e')]?_[_0xcd5f('0x6f')](_0x28078f[_0xe12197[_0x46dd28][_0xcd5f('0x6e')]],'%s',_0x523760):_0x523760;if(_0xe12197[_0x46dd28][_0xcd5f('0x70')]){_0x100531[_0xcd5f('0x61')](_0x523760);}_0xe12197[_0x46dd28][_0xcd5f('0x71')]&&_0x100531[_0xcd5f('0x38')](_0x523760,_0xe12197[_0x46dd28][_0xcd5f('0x71')]===_0xcd5f('0x72')?![]:!![]);_0x100531[_0xcd5f('0x62')](_0x523760,_0xe12197[_0x46dd28][_0xcd5f('0x73')]||_0x523760);}if(_0x4b3f83['joins']){_0x4b3f83[_0xcd5f('0x74')]=JSON[_0xcd5f('0x75')](_0x4b3f83[_0xcd5f('0x74')]);for(var _0x6365f3=0x0;_0x6365f3<_0x4b3f83[_0xcd5f('0x74')]['length'];_0x6365f3+=0x1){if(_0x4b3f83[_0xcd5f('0x74')][_0x6365f3][_0xcd5f('0x2c')]&&_['includes'](_0x59943f,_0x4b3f83[_0xcd5f('0x74')][_0x6365f3][_0xcd5f('0x2c')])&&_0x4b3f83[_0xcd5f('0x74')][_0x6365f3][_0xcd5f('0x76')]&&_0x4b3f83['joins'][_0x6365f3]['foreignTable']&&_0x4b3f83[_0xcd5f('0x74')][_0x6365f3][_0xcd5f('0x77')]){_0x100531[_0x4b3f83[_0xcd5f('0x74')][_0x6365f3][_0xcd5f('0x2c')]](_0x4b3f83[_0xcd5f('0x74')][_0x6365f3][_0xcd5f('0x78')],null,util[_0xcd5f('0x6e')](_0xcd5f('0x79'),_0x4b3f83[_0xcd5f('0x6b')],_0x4b3f83[_0xcd5f('0x74')][_0x6365f3]['parentKey'],_0x4b3f83[_0xcd5f('0x74')][_0x6365f3]['foreignTable'],_0x4b3f83[_0xcd5f('0x74')][_0x6365f3][_0xcd5f('0x77')]));}}}if(_0x4b3f83[_0xcd5f('0x7a')]){_0x4b3f83[_0xcd5f('0x7a')]=JSON[_0xcd5f('0x75')](_0x4b3f83['conditions']);_0x100531[_0xcd5f('0x3a')](_0x1bb74b(_0x4b3f83[_0xcd5f('0x7a')][_0xcd5f('0x61')]));}_0x441bfb=_0x100531[_0xcd5f('0x7b')]();_0x100531[_0xcd5f('0x19')](_0x4a3c69);_0x100531[_0xcd5f('0x17')](0x0);logger[_0xcd5f('0x7c')](_0xcd5f('0x7d'),_0x100531[_0xcd5f('0x7e')]());return dbH[_0xcd5f('0x7f')][_0xcd5f('0x2f')](_0x100531[_0xcd5f('0x7e')](),{'type':dbH[_0xcd5f('0x7f')][_0xcd5f('0x80')][_0xcd5f('0x81')]});}})[_0xcd5f('0x1e')](respondWithResult(_0x4da639,null))[_0xcd5f('0x42')](handleError(_0x4da639,null));};function runReport(_0x567382,_0x14817d,_0x45ea22){var _0x520147=_0x14817d[_0xcd5f('0x25')];var _0x4724cb=0xa;var _0x562e1e=['join',_0xcd5f('0x50'),'right_join',_0xcd5f('0x82')];var _0x4bbde9={'SUM':_0xcd5f('0x83'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xcd5f('0x84'),'MAX':_0xcd5f('0x52'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xcd5f('0x54'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xcd5f('0x56')};var _0x255955={'SEC_TO_TIME':_0xcd5f('0x57'),'DATE':'DATE(%s)','HOUR':_0xcd5f('0x59'),'ROUND':_0xcd5f('0x5a'),'UNIX_TIMESTAMP':_0xcd5f('0x5b')};var _0x526bcc=function(_0x5a5c91){return!_[_0xcd5f('0x85')]([_0xcd5f('0x5c'),'IS\x20NOT\x20NULL',_0xcd5f('0x86'),_0xcd5f('0x5e')],_0x5a5c91);};var _0x2fcafb=function(_0x3b9917){if(!_0x3b9917||!_0x3b9917[_0xcd5f('0x5f')][_0xcd5f('0x35')]){return'';}for(var _0x230a68='(',_0x3b89fc=0x0;_0x3b89fc<_0x3b9917[_0xcd5f('0x5f')][_0xcd5f('0x35')];_0x3b89fc+=0x1){_0x3b89fc>0x0&&(_0x230a68+='\x20'+_0x3b9917[_0xcd5f('0x60')]+'\x20');_0x230a68+=_0x3b9917['rules'][_0x3b89fc][_0xcd5f('0x61')]?_0x2fcafb(_0x3b9917[_0xcd5f('0x5f')][_0x3b89fc][_0xcd5f('0x61')]):_0x3b9917['rules'][_0x3b89fc]['field']+'\x20'+_0x3b9917[_0xcd5f('0x5f')][_0x3b89fc][_0xcd5f('0x63')]+(_0x526bcc(_0x3b9917[_0xcd5f('0x5f')][_0x3b89fc][_0xcd5f('0x63')])?'\x20'+_0x3b9917['rules'][_0x3b89fc][_0xcd5f('0x64')]:'');}return _0x230a68+')';};var _0x464914={'where':{'id':_0x567382['id']}},_0x1a86e9,_0x1bff64,_0x65dc56,_0x2b3cd5,_0x5e0fb3;_0x464914=_[_0xcd5f('0x3d')]({},_0x464914,_0x45ea22);return db['AnalyticCustomReport'][_0xcd5f('0x44')](_0x464914)[_0xcd5f('0x1e')](function(_0x37f298){if(_0x37f298){_0x1a86e9=_0x37f298;return _0x37f298['getFields']();}return null;})[_0xcd5f('0x1e')](function(_0x487587){if(_0x487587){if(!_0x487587[_0xcd5f('0x35')]){throw new db[(_0xcd5f('0x87'))][(_0xcd5f('0x88'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1bff64=_0x487587;return db['AnalyticMetric'][_0xcd5f('0x68')]({'raw':!![]});}return null;})['then'](function(_0x371f25){if(_0x371f25){_0x65dc56=_['keyBy'](_0x371f25,'id');var _0x1a57db;var _0x4da8bc=squel[_0xcd5f('0x6a')]();_0x4da8bc[_0xcd5f('0x89')](_0x1a86e9[_0xcd5f('0x6b')]);for(var _0xbbb053=0x0;_0xbbb053<_0x1bff64[_0xcd5f('0x35')];_0xbbb053+=0x1){_0x1a57db=_0x1bff64[_0xbbb053][_0xcd5f('0x6c')]?_0x65dc56[_0x1bff64[_0xbbb053][_0xcd5f('0x6c')]][_0xcd5f('0x6d')]:_0x1bff64[_0xbbb053][_0xcd5f('0x62')];_0x1a57db=_0x1bff64[_0xbbb053][_0xcd5f('0x8a')]?_[_0xcd5f('0x6f')](_0x4bbde9[_0x1bff64[_0xbbb053]['function']],'%s',_0x1a57db):_0x1a57db;_0x1a57db=_0x1bff64[_0xbbb053]['format']?_[_0xcd5f('0x6f')](_0x255955[_0x1bff64[_0xbbb053][_0xcd5f('0x6e')]],'%s',_0x1a57db):_0x1a57db;if(_0x1bff64[_0xbbb053][_0xcd5f('0x70')]){_0x4da8bc[_0xcd5f('0x61')](_0x1a57db);}_0x1bff64[_0xbbb053][_0xcd5f('0x71')]&&_0x4da8bc[_0xcd5f('0x38')](_0x1a57db,_0x1bff64[_0xbbb053][_0xcd5f('0x71')]===_0xcd5f('0x72')?![]:!![]);_0x4da8bc[_0xcd5f('0x62')](_0x1a57db,_0x1bff64[_0xbbb053]['alias']||_0x1a57db);}if(_0x1a86e9[_0xcd5f('0x74')]){_0x1a86e9[_0xcd5f('0x74')]=JSON[_0xcd5f('0x75')](_0x1a86e9['joins']);for(var _0x24bc3e=0x0;_0x24bc3e<_0x1a86e9[_0xcd5f('0x74')][_0xcd5f('0x35')];_0x24bc3e+=0x1){if(_0x1a86e9[_0xcd5f('0x74')][_0x24bc3e]['type']&&_[_0xcd5f('0x85')](_0x562e1e,_0x1a86e9[_0xcd5f('0x74')][_0x24bc3e][_0xcd5f('0x2c')])&&_0x1a86e9[_0xcd5f('0x74')][_0x24bc3e][_0xcd5f('0x76')]&&_0x1a86e9[_0xcd5f('0x74')][_0x24bc3e]['foreignTable']&&_0x1a86e9[_0xcd5f('0x74')][_0x24bc3e][_0xcd5f('0x77')]){_0x4da8bc[_0x1a86e9[_0xcd5f('0x74')][_0x24bc3e]['type']](_0x1a86e9['joins'][_0x24bc3e]['foreignTable'],null,util[_0xcd5f('0x6e')](_0xcd5f('0x79'),_0x1a86e9[_0xcd5f('0x6b')],_0x1a86e9[_0xcd5f('0x74')][_0x24bc3e][_0xcd5f('0x76')],_0x1a86e9[_0xcd5f('0x74')][_0x24bc3e]['foreignTable'],_0x1a86e9[_0xcd5f('0x74')][_0x24bc3e]['foreignKey']));}}}if(_0x1a86e9[_0xcd5f('0x7a')]){_0x1a86e9[_0xcd5f('0x7a')]=JSON[_0xcd5f('0x75')](_0x1a86e9[_0xcd5f('0x7a')]);_0x4da8bc['where'](_0x2fcafb(_0x1a86e9['conditions'][_0xcd5f('0x61')]));}_0x5e0fb3=_0x4da8bc[_0xcd5f('0x7b')]();_0x4da8bc[_0xcd5f('0x19')](_0x4724cb);_0x4da8bc[_0xcd5f('0x17')](0x0);return;}})[_0xcd5f('0x1e')](function(){if(_0x14817d['output']===_0xcd5f('0x8b')){return null;}var _0x82bbd3=_[_0xcd5f('0x3d')](_0x14817d,{'name':_0x14817d[_0xcd5f('0x8c')]||_0x14817d[_0xcd5f('0x25')]||_0x1a86e9[_0xcd5f('0x25')],'basename':_0x520147,'savename':util[_0xcd5f('0x6e')](_0xcd5f('0x8d'),_0x14817d[_0xcd5f('0x25')]||_0x1a86e9[_0xcd5f('0x25')],require('randomstring')['generate'](0x4),_0x14817d[_0xcd5f('0x8e')]||_0xcd5f('0x8f')),'reportId':_0x1a86e9['id'],'reportType':_0xcd5f('0x90')});return db['AnalyticExtractedReport'][_0xcd5f('0x45')](_0x82bbd3,{'raw':!![]});})[_0xcd5f('0x1e')](function(_0x18435d){if(_0x1a86e9[_0xcd5f('0x6b')]===_0xcd5f('0x91')){_0x5e0fb3[_0xcd5f('0x3a')](_0x1a86e9[_0xcd5f('0x6b')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x14817d[_0xcd5f('0x92')],_0x14817d[_0xcd5f('0x93')]);}else{_0x5e0fb3[_0xcd5f('0x3a')](_0x1a86e9[_0xcd5f('0x6b')]+_0xcd5f('0x94'),_0x14817d[_0xcd5f('0x92')],_0x14817d[_0xcd5f('0x93')]);}if(_0x18435d){logger[_0xcd5f('0x95')](_0xcd5f('0x96'),_0x5e0fb3[_0xcd5f('0x7e')]());require('child_process')['fork'](path['join'](__dirname,_0xcd5f('0x97'),_0x18435d[_0xcd5f('0x8e')]),[_0x18435d['id'],_0x5e0fb3[_0xcd5f('0x7e')](),path[_0xcd5f('0x4f')](__dirname,_0xcd5f('0x98'),_0x18435d[_0xcd5f('0x99')]),_0x520147]);return _0x18435d;}else{var _0x31e684=squel[_0xcd5f('0x6a')]();_0x31e684[_0xcd5f('0x89')]('('+_0x5e0fb3[_0xcd5f('0x7e')]()+')',_0xcd5f('0x9a'));_0x31e684[_0xcd5f('0x62')]('COUNT(*)','count');_0x5e0fb3[_0xcd5f('0x19')](_0x14817d[_0xcd5f('0x19')]||_0x4724cb);_0x5e0fb3[_0xcd5f('0x17')](_0x14817d['offset']||0x0);return dbH[_0xcd5f('0x7f')][_0xcd5f('0x2f')](_0x31e684[_0xcd5f('0x7e')](),{'type':dbH['sequelize'][_0xcd5f('0x80')]['SELECT']})[_0xcd5f('0x1e')](function(_0x561c06){if(!_0x561c06['length']){_0x2b3cd5=0x0;}else{_0x2b3cd5=_0x561c06[0x0][_0xcd5f('0x1a')]||0x0;}return dbH[_0xcd5f('0x7f')][_0xcd5f('0x2f')](_0x5e0fb3[_0xcd5f('0x7e')](),{'type':dbH[_0xcd5f('0x7f')][_0xcd5f('0x80')][_0xcd5f('0x81')]});})[_0xcd5f('0x1e')](function(_0x4306e0){return{'rows':_0x4306e0||[],'count':_0x2b3cd5};});}});}exports['run']=function(_0x4a4ca6,_0x1bdfe3){return runReport(_0x4a4ca6[_0xcd5f('0x4e')],_0x4a4ca6['query'],_0x4a4ca6['options'])[_0xcd5f('0x1e')](respondWithResult(_0x1bdfe3,null))[_0xcd5f('0x42')](handleError(_0x1bdfe3,null));};exports[_0xcd5f('0x9b')]=runReport;exports[_0xcd5f('0x2f')]=function(_0x21744d,_0x395241){var _0x15c2cc=0xa;var _0x4b8e2a=[_0xcd5f('0x4f'),_0xcd5f('0x50'),'right_join','cross_join'];var _0x133461={'SUM':_0xcd5f('0x83'),'COUNT':_0xcd5f('0x9c'),'COUNT DISTINCT':_0xcd5f('0x84'),'MAX':_0xcd5f('0x52'),'MIN':_0xcd5f('0x53'),'AVG':_0xcd5f('0x9d'),'GROUP_CONCAT':_0xcd5f('0x54'),'GROUP_CONCAT ASC':_0xcd5f('0x55'),'GROUP_CONCAT DESC':_0xcd5f('0x56')};var _0x49cdf6={'SEC_TO_TIME':_0xcd5f('0x57'),'DATE':_0xcd5f('0x58'),'HOUR':_0xcd5f('0x59'),'ROUND':_0xcd5f('0x5a'),'UNIX_TIMESTAMP':_0xcd5f('0x5b')};var _0xda3b13=function(_0xaf6b9e){return!_[_0xcd5f('0x85')](['IS\x20NULL',_0xcd5f('0x5d'),_0xcd5f('0x86'),_0xcd5f('0x5e')],_0xaf6b9e);};var _0x227dd8=function(_0x482171){if(!_0x482171||!_0x482171['rules']['length']){return'';}for(var _0x3cec60='(',_0x4faa89=0x0;_0x4faa89<_0x482171[_0xcd5f('0x5f')]['length'];_0x4faa89+=0x1){_0x4faa89>0x0&&(_0x3cec60+='\x20'+_0x482171[_0xcd5f('0x60')]+'\x20');_0x3cec60+=_0x482171[_0xcd5f('0x5f')][_0x4faa89][_0xcd5f('0x61')]?_0x227dd8(_0x482171['rules'][_0x4faa89][_0xcd5f('0x61')]):_0x482171[_0xcd5f('0x5f')][_0x4faa89]['field']+'\x20'+_0x482171['rules'][_0x4faa89]['condition']+(_0xda3b13(_0x482171[_0xcd5f('0x5f')][_0x4faa89][_0xcd5f('0x63')])?'\x20'+_0x482171[_0xcd5f('0x5f')][_0x4faa89][_0xcd5f('0x64')]:'');}return _0x3cec60+')';};var _0x1a8864={'where':{'id':_0x21744d[_0xcd5f('0x4e')]['id']}},_0x36ca3e,_0x36115b,_0x3f9031,_0x315102,_0x177a91;_0x1a8864=_[_0xcd5f('0x3d')]({},_0x1a8864,_0x21744d[_0xcd5f('0x3e')]);return db[_0xcd5f('0x29')][_0xcd5f('0x44')](_0x1a8864)[_0xcd5f('0x1e')](function(_0x5e1d4a){if(_0x5e1d4a){_0x36ca3e=_0x5e1d4a;return _0x5e1d4a[_0xcd5f('0x65')]();}return null;})[_0xcd5f('0x1e')](function(_0x1c101a){if(_0x1c101a){if(!_0x1c101a[_0xcd5f('0x35')]){throw new db[(_0xcd5f('0x87'))][(_0xcd5f('0x88'))](_0xcd5f('0x66'),0x193);}_0x36115b=_0x1c101a;return db['AnalyticMetric'][_0xcd5f('0x68')]({'raw':!![]});}return null;})[_0xcd5f('0x1e')](function(_0x5e68ee){if(_0x5e68ee){_0x3f9031=_[_0xcd5f('0x69')](_0x5e68ee,'id');var _0x234374;var _0x4820d7=squel[_0xcd5f('0x6a')]();_0x4820d7[_0xcd5f('0x89')](_0x36ca3e[_0xcd5f('0x6b')]);for(var _0x1b1dd5=0x0;_0x1b1dd5<_0x36115b[_0xcd5f('0x35')];_0x1b1dd5+=0x1){_0x234374=_0x36115b[_0x1b1dd5][_0xcd5f('0x6c')]?_0x3f9031[_0x36115b[_0x1b1dd5][_0xcd5f('0x6c')]][_0xcd5f('0x6d')]:_0x36115b[_0x1b1dd5][_0xcd5f('0x62')];_0x234374=_0x36115b[_0x1b1dd5][_0xcd5f('0x8a')]?_[_0xcd5f('0x6f')](_0x133461[_0x36115b[_0x1b1dd5][_0xcd5f('0x8a')]],'%s',_0x234374):_0x234374;_0x234374=_0x36115b[_0x1b1dd5][_0xcd5f('0x6e')]?_['replace'](_0x49cdf6[_0x36115b[_0x1b1dd5][_0xcd5f('0x6e')]],'%s',_0x234374):_0x234374;if(_0x36115b[_0x1b1dd5][_0xcd5f('0x70')]){_0x4820d7[_0xcd5f('0x61')](_0x234374);}_0x36115b[_0x1b1dd5][_0xcd5f('0x71')]&&_0x4820d7[_0xcd5f('0x38')](_0x234374,_0x36115b[_0x1b1dd5][_0xcd5f('0x71')]===_0xcd5f('0x72')?![]:!![]);_0x4820d7['field'](_0x234374,_0x36115b[_0x1b1dd5]['alias']||_0x234374);}if(_0x36ca3e[_0xcd5f('0x74')]){_0x36ca3e[_0xcd5f('0x74')]=JSON['parse'](_0x36ca3e[_0xcd5f('0x74')]);for(var _0x41145d=0x0;_0x41145d<_0x36ca3e[_0xcd5f('0x74')][_0xcd5f('0x35')];_0x41145d+=0x1){if(_0x36ca3e[_0xcd5f('0x74')][_0x41145d][_0xcd5f('0x2c')]&&_[_0xcd5f('0x85')](_0x4b8e2a,_0x36ca3e['joins'][_0x41145d][_0xcd5f('0x2c')])&&_0x36ca3e['joins'][_0x41145d][_0xcd5f('0x76')]&&_0x36ca3e[_0xcd5f('0x74')][_0x41145d][_0xcd5f('0x78')]&&_0x36ca3e[_0xcd5f('0x74')][_0x41145d][_0xcd5f('0x77')]){_0x4820d7[_0x36ca3e[_0xcd5f('0x74')][_0x41145d][_0xcd5f('0x2c')]](_0x36ca3e[_0xcd5f('0x74')][_0x41145d]['foreignTable'],null,util[_0xcd5f('0x6e')](_0xcd5f('0x79'),_0x36ca3e[_0xcd5f('0x6b')],_0x36ca3e[_0xcd5f('0x74')][_0x41145d]['parentKey'],_0x36ca3e[_0xcd5f('0x74')][_0x41145d]['foreignTable'],_0x36ca3e[_0xcd5f('0x74')][_0x41145d][_0xcd5f('0x77')]));}}}if(_0x36ca3e[_0xcd5f('0x7a')]){_0x36ca3e[_0xcd5f('0x7a')]=JSON[_0xcd5f('0x75')](_0x36ca3e[_0xcd5f('0x7a')]);_0x4820d7[_0xcd5f('0x3a')](_0x227dd8(_0x36ca3e['conditions'][_0xcd5f('0x61')]));}_0x177a91=_0x4820d7[_0xcd5f('0x7b')]();_0x4820d7[_0xcd5f('0x19')](_0x15c2cc);_0x4820d7[_0xcd5f('0x17')](0x0);logger[_0xcd5f('0x7c')](_0xcd5f('0x7d'),_0x4820d7[_0xcd5f('0x7e')]());return dbH['sequelize'][_0xcd5f('0x2f')](_0x4820d7[_0xcd5f('0x7e')](),{'type':dbH['sequelize'][_0xcd5f('0x80')][_0xcd5f('0x81')]});}})[_0xcd5f('0x1e')](function(){return{'sql':_0x177a91[_0xcd5f('0x7e')]()};})['then'](respondWithResult(_0x395241,null))[_0xcd5f('0x42')](handleError(_0x395241,null));}; \ No newline at end of file +var _0x8b00=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','value','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','order','DESC','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','getFields','AnalyticMetric','groupBy','alias','web','%s-%s.%s','randomstring','generate','output','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','savename','countTable','COUNT(*)','run','runReport','right_join','ValidationErrorItem','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','get','CustomReports','UserProfileResource','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','AnalyticCustomReport','findAll','show','params','include','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','UserProfileSection','userProfileId'];(function(_0x413042,_0x2b6f11){var _0x595e71=function(_0x1812c4){while(--_0x1812c4){_0x413042['push'](_0x413042['shift']());}};_0x595e71(++_0x2b6f11);}(_0x8b00,0x100));var _0x08b0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8b00[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x08b0('0x0'));var zipdir=require(_0x08b0('0x1'));var jsonpatch=require(_0x08b0('0x2'));var rp=require('request-promise');var moment=require(_0x08b0('0x3'));var BPromise=require(_0x08b0('0x4'));var Mustache=require(_0x08b0('0x5'));var util=require('util');var path=require(_0x08b0('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x08b0('0x7'));var fs=require('fs');var fs_extra=require(_0x08b0('0x8'));var _=require(_0x08b0('0x9'));var squel=require(_0x08b0('0xa'));var crypto=require(_0x08b0('0xb'));var jsforce=require(_0x08b0('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x08b0('0xd'));var querystring=require(_0x08b0('0xe'));var Papa=require(_0x08b0('0xf'));var Redis=require(_0x08b0('0x10'));var authService=require(_0x08b0('0x11'));var qs=require(_0x08b0('0x12'));var as=require(_0x08b0('0x13'));var hardwareService=require(_0x08b0('0x14'));var logger=require(_0x08b0('0x15'))(_0x08b0('0x16'));var utils=require('../../config/utils');var config=require(_0x08b0('0x17'));var licenseUtil=require(_0x08b0('0x18'));var db=require(_0x08b0('0x19'))['db'];var dbH=require(_0x08b0('0x19'))['dbH'];function respondWithStatusCode(_0x34e5c6,_0x388908){_0x388908=_0x388908||0xcc;return function(_0x3b5826){if(_0x3b5826){return _0x34e5c6[_0x08b0('0x1a')](_0x388908);}return _0x34e5c6[_0x08b0('0x1b')](_0x388908)[_0x08b0('0x1c')]();};}function respondWithResult(_0x557eeb,_0x5e4b8e){_0x5e4b8e=_0x5e4b8e||0xc8;return function(_0x286d21){if(_0x286d21){return _0x557eeb['status'](_0x5e4b8e)[_0x08b0('0x1d')](_0x286d21);}};}function respondWithFilteredResult(_0x1f0b00,_0x53c9e9){return function(_0x1fc578){if(_0x1fc578){var _0x2d605e=typeof _0x53c9e9[_0x08b0('0x1e')]===_0x08b0('0x1f')&&typeof _0x53c9e9[_0x08b0('0x20')]===_0x08b0('0x1f');var _0x3b00cd=_0x1fc578[_0x08b0('0x21')];var _0x4a4b93=_0x2d605e?0x0:_0x53c9e9[_0x08b0('0x1e')];var _0x334240=_0x2d605e?_0x1fc578[_0x08b0('0x21')]:_0x53c9e9[_0x08b0('0x1e')]+_0x53c9e9[_0x08b0('0x20')];var _0xe68c88;if(_0x334240>=_0x3b00cd){_0x334240=_0x3b00cd;_0xe68c88=0xc8;}else{_0xe68c88=0xce;}_0x1f0b00[_0x08b0('0x1b')](_0xe68c88);return _0x1f0b00[_0x08b0('0x22')](_0x08b0('0x23'),_0x4a4b93+'-'+_0x334240+'/'+_0x3b00cd)[_0x08b0('0x1d')](_0x1fc578);}return null;};}function patchUpdates(_0x394c4d){return function(_0x433b81){try{jsonpatch['apply'](_0x433b81,_0x394c4d,!![]);}catch(_0x19569d){return BPromise[_0x08b0('0x24')](_0x19569d);}return _0x433b81['save']();};}function saveUpdates(_0x4b668f,_0x13c9bc){return function(_0x244e9e){if(_0x244e9e){return _0x244e9e[_0x08b0('0x25')](_0x4b668f)['then'](function(_0x3af93c){return _0x3af93c;});}return null;};}function removeEntity(_0x1e33f5,_0x44dfc6){return function(_0x3c8122){if(_0x3c8122){return _0x3c8122['destroy']()[_0x08b0('0x26')](function(){var _0xbe5385=_0x3c8122[_0x08b0('0x27')]({'plain':!![]});var _0x263ef6=_0x08b0('0x28');return db[_0x08b0('0x29')][_0x08b0('0x2a')]({'where':{'type':_0x263ef6,'resourceId':_0xbe5385['id']}})[_0x08b0('0x26')](function(){return _0x3c8122;});})[_0x08b0('0x26')](function(){_0x1e33f5[_0x08b0('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x573985,_0xf3508b){return function(_0x55bd7b){if(!_0x55bd7b){_0x573985[_0x08b0('0x1a')](0x194);}return _0x55bd7b;};}function handleError(_0x5ea49f,_0x4fcfb0){_0x4fcfb0=_0x4fcfb0||0x1f4;return function(_0x399813){logger[_0x08b0('0x2b')](_0x399813[_0x08b0('0x2c')]);if(_0x399813[_0x08b0('0x2d')]){delete _0x399813[_0x08b0('0x2d')];}_0x5ea49f['status'](_0x4fcfb0)[_0x08b0('0x2e')](_0x399813);};}exports[_0x08b0('0x2f')]=function(_0x297068,_0x288e72){var _0x20e122={},_0x4cf622={},_0x2fd7a1={'count':0x0,'rows':[]};var _0x20892d=_[_0x08b0('0x30')](db['AnalyticCustomReport'][_0x08b0('0x31')],function(_0x35a951){return{'name':_0x35a951['fieldName'],'type':_0x35a951[_0x08b0('0x32')][_0x08b0('0x33')]};});_0x4cf622[_0x08b0('0x34')]=_[_0x08b0('0x30')](_0x20892d,'name');_0x4cf622['query']=_[_0x08b0('0x35')](_0x297068[_0x08b0('0x36')]);_0x4cf622[_0x08b0('0x37')]=_[_0x08b0('0x38')](_0x4cf622['model'],_0x4cf622[_0x08b0('0x36')]);_0x20e122[_0x08b0('0x39')]=_['intersection'](_0x4cf622[_0x08b0('0x34')],qs[_0x08b0('0x3a')](_0x297068[_0x08b0('0x36')][_0x08b0('0x3a')]));_0x20e122['attributes']=_0x20e122[_0x08b0('0x39')][_0x08b0('0x3b')]?_0x20e122[_0x08b0('0x39')]:_0x4cf622[_0x08b0('0x34')];if(!_0x297068[_0x08b0('0x36')][_0x08b0('0x3c')](_0x08b0('0x3d'))){_0x20e122[_0x08b0('0x20')]=qs[_0x08b0('0x20')](_0x297068['query']['limit']);_0x20e122['offset']=qs[_0x08b0('0x1e')](_0x297068[_0x08b0('0x36')][_0x08b0('0x1e')]);}_0x20e122['order']=qs[_0x08b0('0x3e')](_0x297068[_0x08b0('0x36')][_0x08b0('0x3e')]);_0x20e122[_0x08b0('0x3f')]=qs[_0x08b0('0x37')](_[_0x08b0('0x40')](_0x297068[_0x08b0('0x36')],_0x4cf622[_0x08b0('0x37')]),_0x20892d);if(_0x297068[_0x08b0('0x36')]['filter']){_0x20e122[_0x08b0('0x3f')]=_[_0x08b0('0x41')](_0x20e122['where'],{'$or':_[_0x08b0('0x30')](_0x20892d,function(_0x128e67){if(_0x128e67[_0x08b0('0x32')]!==_0x08b0('0x42')){var _0x2e1258={};_0x2e1258[_0x128e67['name']]={'$like':'%'+_0x297068[_0x08b0('0x36')]['filter']+'%'};return _0x2e1258;}})});}_0x20e122=_['merge']({},_0x20e122,_0x297068[_0x08b0('0x43')]);var _0x56dee8={'where':_0x20e122[_0x08b0('0x3f')]};return db['AnalyticCustomReport'][_0x08b0('0x21')](_0x56dee8)['then'](function(_0x2333fe){_0x2fd7a1['count']=_0x2333fe;if(_0x297068[_0x08b0('0x36')][_0x08b0('0x44')]){_0x20e122['include']=[{'all':!![]}];}return db[_0x08b0('0x45')][_0x08b0('0x46')](_0x20e122);})[_0x08b0('0x26')](function(_0x22ea69){_0x2fd7a1['rows']=_0x22ea69;return _0x2fd7a1;})[_0x08b0('0x26')](respondWithFilteredResult(_0x288e72,_0x20e122))['catch'](handleError(_0x288e72,null));};exports[_0x08b0('0x47')]=function(_0x1c684e,_0x22e9d3){var _0x36cc4e={'raw':![],'where':{'id':_0x1c684e[_0x08b0('0x48')]['id']}},_0x5e4721={};_0x5e4721['model']=_[_0x08b0('0x35')](db['AnalyticCustomReport']['rawAttributes']);_0x5e4721['query']=_[_0x08b0('0x35')](_0x1c684e[_0x08b0('0x36')]);_0x5e4721[_0x08b0('0x37')]=_[_0x08b0('0x38')](_0x5e4721[_0x08b0('0x34')],_0x5e4721[_0x08b0('0x36')]);_0x36cc4e[_0x08b0('0x39')]=_[_0x08b0('0x38')](_0x5e4721['model'],qs['fields'](_0x1c684e['query'][_0x08b0('0x3a')]));_0x36cc4e[_0x08b0('0x39')]=_0x36cc4e['attributes'][_0x08b0('0x3b')]?_0x36cc4e[_0x08b0('0x39')]:_0x5e4721[_0x08b0('0x34')];if(_0x1c684e['query'][_0x08b0('0x44')]){_0x36cc4e[_0x08b0('0x49')]=[{'all':!![]}];}_0x36cc4e=_['merge']({},_0x36cc4e,_0x1c684e[_0x08b0('0x43')]);return db['AnalyticCustomReport'][_0x08b0('0x4a')](_0x36cc4e)['then'](handleEntityNotFound(_0x22e9d3,null))['then'](respondWithResult(_0x22e9d3,null))[_0x08b0('0x4b')](handleError(_0x22e9d3,null));};exports[_0x08b0('0x4c')]=function(_0x22e7bb,_0xdf9309){return db[_0x08b0('0x45')][_0x08b0('0x4c')](_0x22e7bb[_0x08b0('0x4d')],{})[_0x08b0('0x26')](function(_0x4b756f){var _0x263aeb=_0x22e7bb['user']['get']({'plain':!![]});if(!_0x263aeb)throw new Error(_0x08b0('0x4e'));if(_0x263aeb[_0x08b0('0x4f')]===_0x08b0('0x50')){var _0xd76553=_0x4b756f[_0x08b0('0x27')]({'plain':!![]});var _0xe393cd=_0x08b0('0x51');return db[_0x08b0('0x52')][_0x08b0('0x4a')]({'where':{'name':_0xe393cd,'userProfileId':_0x263aeb[_0x08b0('0x53')]},'raw':!![]})[_0x08b0('0x26')](function(_0x1a0873){if(_0x1a0873&&_0x1a0873[_0x08b0('0x54')]===0x0){return db[_0x08b0('0x29')][_0x08b0('0x4c')]({'name':_0xd76553[_0x08b0('0x2d')],'resourceId':_0xd76553['id'],'type':_0x08b0('0x28'),'sectionId':_0x1a0873['id']},{})[_0x08b0('0x26')](function(){return _0x4b756f;});}else{return _0x4b756f;}})[_0x08b0('0x4b')](function(_0x239cdd){logger[_0x08b0('0x2b')](_0x08b0('0x55'),_0x239cdd);throw _0x239cdd;});}return _0x4b756f;})[_0x08b0('0x26')](respondWithResult(_0xdf9309,0xc9))[_0x08b0('0x4b')](handleError(_0xdf9309,null));};exports['update']=function(_0x1c6e95,_0x351a52){if(_0x1c6e95[_0x08b0('0x4d')]['id']){delete _0x1c6e95['body']['id'];}return db[_0x08b0('0x45')][_0x08b0('0x4a')]({'where':{'id':_0x1c6e95[_0x08b0('0x48')]['id']}})[_0x08b0('0x26')](handleEntityNotFound(_0x351a52,null))[_0x08b0('0x26')](saveUpdates(_0x1c6e95['body'],null))[_0x08b0('0x26')](respondWithResult(_0x351a52,null))[_0x08b0('0x4b')](handleError(_0x351a52,null));};exports[_0x08b0('0x2a')]=function(_0x3ab8d4,_0x531ae3){return db[_0x08b0('0x45')][_0x08b0('0x4a')]({'where':{'id':_0x3ab8d4[_0x08b0('0x48')]['id']}})['then'](handleEntityNotFound(_0x531ae3,null))[_0x08b0('0x26')](removeEntity(_0x531ae3,null))[_0x08b0('0x4b')](handleError(_0x531ae3,null));};exports['preview']=function(_0x35a06c,_0xe7be22){var _0x5ccdaf=0xa;var _0x61f14a=[_0x08b0('0x56'),_0x08b0('0x57'),'right_join',_0x08b0('0x58')];var _0x2e37f7={'SUM':_0x08b0('0x59'),'COUNT':_0x08b0('0x5a'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x08b0('0x5b'),'MIN':_0x08b0('0x5c'),'AVG':_0x08b0('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x08b0('0x5e')};var _0x2759b1={'SEC_TO_TIME':_0x08b0('0x5f'),'DATE':'DATE(%s)','HOUR':_0x08b0('0x60'),'ROUND':_0x08b0('0x61'),'UNIX_TIMESTAMP':_0x08b0('0x62')};var _0x474a3e=function(_0x51bc83){return!_[_0x08b0('0x63')]([_0x08b0('0x64'),'IS\x20NOT\x20NULL',_0x08b0('0x65'),'IS\x20NOT\x20EMPTY'],_0x51bc83);};var _0x47db85=function(_0xa362f){if(!_0xa362f||!_0xa362f[_0x08b0('0x66')]['length']){return'';}for(var _0x18198e='(',_0x19047d=0x0;_0x19047d<_0xa362f['rules']['length'];_0x19047d+=0x1){_0x19047d>0x0&&(_0x18198e+='\x20'+_0xa362f[_0x08b0('0x67')]+'\x20');_0x18198e+=_0xa362f[_0x08b0('0x66')][_0x19047d][_0x08b0('0x68')]?_0x47db85(_0xa362f[_0x08b0('0x66')][_0x19047d][_0x08b0('0x68')]):_0xa362f[_0x08b0('0x66')][_0x19047d][_0x08b0('0x69')]+'\x20'+_0xa362f[_0x08b0('0x66')][_0x19047d][_0x08b0('0x6a')]+(_0x474a3e(_0xa362f[_0x08b0('0x66')][_0x19047d][_0x08b0('0x6a')])?'\x20'+_0xa362f['rules'][_0x19047d][_0x08b0('0x6b')]:'');}return _0x18198e+')';};var _0x547f6f={'where':{'id':_0x35a06c[_0x08b0('0x48')]['id']}},_0x274ae0,_0x2e45b8,_0x467214,_0x35a02d,_0x479ebb;_0x547f6f=_[_0x08b0('0x41')]({},_0x547f6f,_0x35a06c[_0x08b0('0x43')]);return db[_0x08b0('0x45')]['find'](_0x547f6f)[_0x08b0('0x26')](function(_0x3dd0da){if(_0x3dd0da){_0x274ae0=_0x3dd0da;return _0x3dd0da['getFields']();}return null;})['then'](function(_0x21a617){if(_0x21a617){if(!_0x21a617[_0x08b0('0x3b')]){throw new db[(_0x08b0('0x6c'))]['ValidationErrorItem'](_0x08b0('0x6d'),0x193);}_0x2e45b8=_0x21a617;return db['AnalyticMetric'][_0x08b0('0x46')]({'raw':!![]});}return null;})[_0x08b0('0x26')](function(_0x3b6182){if(_0x3b6182){_0x467214=_[_0x08b0('0x6e')](_0x3b6182,'id');var _0x322474;var _0x10e5d1=squel[_0x08b0('0x6f')]();_0x10e5d1[_0x08b0('0x70')](_0x274ae0[_0x08b0('0x71')]);for(var _0x18d978=0x0;_0x18d978<_0x2e45b8['length'];_0x18d978+=0x1){_0x322474=_0x2e45b8[_0x18d978][_0x08b0('0x72')]?_0x467214[_0x2e45b8[_0x18d978]['MetricId']][_0x08b0('0x73')]:_0x2e45b8[_0x18d978]['field'];_0x322474=_0x2e45b8[_0x18d978][_0x08b0('0x74')]?_[_0x08b0('0x75')](_0x2e37f7[_0x2e45b8[_0x18d978][_0x08b0('0x74')]],'%s',_0x322474):_0x322474;_0x322474=_0x2e45b8[_0x18d978][_0x08b0('0x76')]?_[_0x08b0('0x75')](_0x2759b1[_0x2e45b8[_0x18d978][_0x08b0('0x76')]],'%s',_0x322474):_0x322474;if(_0x2e45b8[_0x18d978]['groupBy']){_0x10e5d1[_0x08b0('0x68')](_0x322474);}_0x2e45b8[_0x18d978][_0x08b0('0x77')]&&_0x10e5d1[_0x08b0('0x78')](_0x322474,_0x2e45b8[_0x18d978]['orderBy']===_0x08b0('0x79')?![]:!![]);_0x10e5d1[_0x08b0('0x69')](_0x322474,_0x2e45b8[_0x18d978]['alias']||_0x322474);}if(_0x274ae0[_0x08b0('0x7a')]){_0x274ae0['joins']=JSON[_0x08b0('0x7b')](_0x274ae0[_0x08b0('0x7a')]);for(var _0x152a1d=0x0;_0x152a1d<_0x274ae0['joins'][_0x08b0('0x3b')];_0x152a1d+=0x1){if(_0x274ae0[_0x08b0('0x7a')][_0x152a1d][_0x08b0('0x32')]&&_[_0x08b0('0x63')](_0x61f14a,_0x274ae0[_0x08b0('0x7a')][_0x152a1d][_0x08b0('0x32')])&&_0x274ae0[_0x08b0('0x7a')][_0x152a1d][_0x08b0('0x7c')]&&_0x274ae0[_0x08b0('0x7a')][_0x152a1d]['foreignTable']&&_0x274ae0['joins'][_0x152a1d][_0x08b0('0x7d')]){_0x10e5d1[_0x274ae0['joins'][_0x152a1d][_0x08b0('0x32')]](_0x274ae0[_0x08b0('0x7a')][_0x152a1d][_0x08b0('0x7e')],null,util['format'](_0x08b0('0x7f'),_0x274ae0[_0x08b0('0x71')],_0x274ae0[_0x08b0('0x7a')][_0x152a1d][_0x08b0('0x7c')],_0x274ae0[_0x08b0('0x7a')][_0x152a1d]['foreignTable'],_0x274ae0[_0x08b0('0x7a')][_0x152a1d][_0x08b0('0x7d')]));}}}if(_0x274ae0['conditions']){_0x274ae0[_0x08b0('0x80')]=JSON[_0x08b0('0x7b')](_0x274ae0[_0x08b0('0x80')]);_0x10e5d1[_0x08b0('0x3f')](_0x47db85(_0x274ae0[_0x08b0('0x80')][_0x08b0('0x68')]));}_0x479ebb=_0x10e5d1[_0x08b0('0x81')]();_0x10e5d1[_0x08b0('0x20')](_0x5ccdaf);_0x10e5d1['offset'](0x0);logger[_0x08b0('0x82')](_0x08b0('0x83'),_0x10e5d1[_0x08b0('0x84')]());return dbH[_0x08b0('0x85')]['query'](_0x10e5d1[_0x08b0('0x84')](),{'type':dbH[_0x08b0('0x85')][_0x08b0('0x86')][_0x08b0('0x87')]});}})[_0x08b0('0x26')](respondWithResult(_0xe7be22,null))[_0x08b0('0x4b')](handleError(_0xe7be22,null));};function runReport(_0x270186,_0x3046f9,_0x4246b7){var _0x510b8e=_0x3046f9[_0x08b0('0x2d')];var _0x3826f4=0xa;var _0x4feb35=[_0x08b0('0x56'),'left_join','right_join',_0x08b0('0x58')];var _0x3cbedb={'SUM':_0x08b0('0x59'),'COUNT':_0x08b0('0x5a'),'COUNT DISTINCT':_0x08b0('0x88'),'MAX':_0x08b0('0x5b'),'MIN':_0x08b0('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x08b0('0x89'),'GROUP_CONCAT ASC':_0x08b0('0x8a'),'GROUP_CONCAT DESC':_0x08b0('0x5e')};var _0x1f43f0={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x08b0('0x8b'),'HOUR':_0x08b0('0x60'),'ROUND':_0x08b0('0x61'),'UNIX_TIMESTAMP':_0x08b0('0x62')};var _0x4e05ff=function(_0x555dd0){return!_[_0x08b0('0x63')]([_0x08b0('0x64'),_0x08b0('0x8c'),_0x08b0('0x65'),_0x08b0('0x8d')],_0x555dd0);};var _0x3bef09=function(_0x189057){if(!_0x189057||!_0x189057[_0x08b0('0x66')][_0x08b0('0x3b')]){return'';}for(var _0x4b876f='(',_0x2bcff4=0x0;_0x2bcff4<_0x189057[_0x08b0('0x66')]['length'];_0x2bcff4+=0x1){_0x2bcff4>0x0&&(_0x4b876f+='\x20'+_0x189057[_0x08b0('0x67')]+'\x20');_0x4b876f+=_0x189057[_0x08b0('0x66')][_0x2bcff4]['group']?_0x3bef09(_0x189057[_0x08b0('0x66')][_0x2bcff4][_0x08b0('0x68')]):_0x189057[_0x08b0('0x66')][_0x2bcff4][_0x08b0('0x69')]+'\x20'+_0x189057[_0x08b0('0x66')][_0x2bcff4][_0x08b0('0x6a')]+(_0x4e05ff(_0x189057['rules'][_0x2bcff4]['condition'])?'\x20'+_0x189057[_0x08b0('0x66')][_0x2bcff4][_0x08b0('0x6b')]:'');}return _0x4b876f+')';};var _0x3a9478={'where':{'id':_0x270186['id']}},_0x1aa8a0,_0x41fc9e,_0x26d7f2,_0x5d66b1,_0x2e440a;_0x3a9478=_[_0x08b0('0x41')]({},_0x3a9478,_0x4246b7);return db['AnalyticCustomReport'][_0x08b0('0x4a')](_0x3a9478)['then'](function(_0xd0cea8){if(_0xd0cea8){_0x1aa8a0=_0xd0cea8;return _0xd0cea8[_0x08b0('0x8e')]();}return null;})['then'](function(_0x3d1bd9){if(_0x3d1bd9){if(!_0x3d1bd9[_0x08b0('0x3b')]){throw new db[(_0x08b0('0x6c'))]['ValidationErrorItem'](_0x08b0('0x6d'),0x193);}_0x41fc9e=_0x3d1bd9;return db[_0x08b0('0x8f')][_0x08b0('0x46')]({'raw':!![]});}return null;})[_0x08b0('0x26')](function(_0x4b01d9){if(_0x4b01d9){_0x26d7f2=_['keyBy'](_0x4b01d9,'id');var _0x43a37d;var _0x3c89d9=squel[_0x08b0('0x6f')]();_0x3c89d9[_0x08b0('0x70')](_0x1aa8a0[_0x08b0('0x71')]);for(var _0x3d53f7=0x0;_0x3d53f7<_0x41fc9e[_0x08b0('0x3b')];_0x3d53f7+=0x1){_0x43a37d=_0x41fc9e[_0x3d53f7]['MetricId']?_0x26d7f2[_0x41fc9e[_0x3d53f7][_0x08b0('0x72')]][_0x08b0('0x73')]:_0x41fc9e[_0x3d53f7]['field'];_0x43a37d=_0x41fc9e[_0x3d53f7]['function']?_[_0x08b0('0x75')](_0x3cbedb[_0x41fc9e[_0x3d53f7]['function']],'%s',_0x43a37d):_0x43a37d;_0x43a37d=_0x41fc9e[_0x3d53f7]['format']?_['replace'](_0x1f43f0[_0x41fc9e[_0x3d53f7][_0x08b0('0x76')]],'%s',_0x43a37d):_0x43a37d;if(_0x41fc9e[_0x3d53f7][_0x08b0('0x90')]){_0x3c89d9[_0x08b0('0x68')](_0x43a37d);}_0x41fc9e[_0x3d53f7][_0x08b0('0x77')]&&_0x3c89d9[_0x08b0('0x78')](_0x43a37d,_0x41fc9e[_0x3d53f7]['orderBy']===_0x08b0('0x79')?![]:!![]);_0x3c89d9[_0x08b0('0x69')](_0x43a37d,_0x41fc9e[_0x3d53f7][_0x08b0('0x91')]||_0x43a37d);}if(_0x1aa8a0['joins']){_0x1aa8a0[_0x08b0('0x7a')]=JSON[_0x08b0('0x7b')](_0x1aa8a0[_0x08b0('0x7a')]);for(var _0x1ad82e=0x0;_0x1ad82e<_0x1aa8a0[_0x08b0('0x7a')][_0x08b0('0x3b')];_0x1ad82e+=0x1){if(_0x1aa8a0['joins'][_0x1ad82e][_0x08b0('0x32')]&&_[_0x08b0('0x63')](_0x4feb35,_0x1aa8a0['joins'][_0x1ad82e][_0x08b0('0x32')])&&_0x1aa8a0['joins'][_0x1ad82e]['parentKey']&&_0x1aa8a0[_0x08b0('0x7a')][_0x1ad82e][_0x08b0('0x7e')]&&_0x1aa8a0[_0x08b0('0x7a')][_0x1ad82e]['foreignKey']){_0x3c89d9[_0x1aa8a0[_0x08b0('0x7a')][_0x1ad82e][_0x08b0('0x32')]](_0x1aa8a0[_0x08b0('0x7a')][_0x1ad82e][_0x08b0('0x7e')],null,util[_0x08b0('0x76')]('%s.%s\x20=\x20%s.%s',_0x1aa8a0[_0x08b0('0x71')],_0x1aa8a0[_0x08b0('0x7a')][_0x1ad82e][_0x08b0('0x7c')],_0x1aa8a0[_0x08b0('0x7a')][_0x1ad82e][_0x08b0('0x7e')],_0x1aa8a0[_0x08b0('0x7a')][_0x1ad82e]['foreignKey']));}}}if(_0x1aa8a0['conditions']){_0x1aa8a0[_0x08b0('0x80')]=JSON['parse'](_0x1aa8a0['conditions']);_0x3c89d9[_0x08b0('0x3f')](_0x3bef09(_0x1aa8a0[_0x08b0('0x80')][_0x08b0('0x68')]));}_0x2e440a=_0x3c89d9['clone']();_0x3c89d9[_0x08b0('0x20')](_0x3826f4);_0x3c89d9[_0x08b0('0x1e')](0x0);return;}})['then'](function(){if(_0x3046f9['output']===_0x08b0('0x92')){return null;}var _0x801dea=_['merge'](_0x3046f9,{'name':_0x3046f9['fullPath']||_0x3046f9[_0x08b0('0x2d')]||_0x1aa8a0[_0x08b0('0x2d')],'basename':_0x510b8e,'savename':util['format'](_0x08b0('0x93'),_0x3046f9[_0x08b0('0x2d')]||_0x1aa8a0[_0x08b0('0x2d')],require(_0x08b0('0x94'))[_0x08b0('0x95')](0x4),_0x3046f9[_0x08b0('0x96')]||_0x08b0('0x97')),'reportId':_0x1aa8a0['id'],'reportType':_0x08b0('0x98')});return db[_0x08b0('0x99')]['create'](_0x801dea,{'raw':!![]});})['then'](function(_0x39eb0f){if(_0x1aa8a0[_0x08b0('0x71')]===_0x08b0('0x9a')){_0x2e440a['where'](_0x1aa8a0['table']+_0x08b0('0x9b'),_0x3046f9[_0x08b0('0x9c')],_0x3046f9[_0x08b0('0x9d')]);}else{_0x2e440a[_0x08b0('0x3f')](_0x1aa8a0['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3046f9[_0x08b0('0x9c')],_0x3046f9[_0x08b0('0x9d')]);}if(_0x39eb0f){logger[_0x08b0('0x9e')](_0x08b0('0x9f'),_0x2e440a[_0x08b0('0x84')]());require(_0x08b0('0xa0'))[_0x08b0('0xa1')](path[_0x08b0('0x56')](__dirname,_0x08b0('0xa2'),_0x39eb0f[_0x08b0('0x96')]),[_0x39eb0f['id'],_0x2e440a[_0x08b0('0x84')](),path[_0x08b0('0x56')](__dirname,'../../files/reports',_0x39eb0f[_0x08b0('0xa3')]),_0x510b8e]);return _0x39eb0f;}else{var _0x28def0=squel['select']();_0x28def0[_0x08b0('0x70')]('('+_0x2e440a[_0x08b0('0x84')]()+')',_0x08b0('0xa4'));_0x28def0[_0x08b0('0x69')](_0x08b0('0xa5'),'count');_0x2e440a[_0x08b0('0x20')](_0x3046f9[_0x08b0('0x20')]||_0x3826f4);_0x2e440a['offset'](_0x3046f9[_0x08b0('0x1e')]||0x0);return dbH['sequelize'][_0x08b0('0x36')](_0x28def0[_0x08b0('0x84')](),{'type':dbH[_0x08b0('0x85')][_0x08b0('0x86')][_0x08b0('0x87')]})['then'](function(_0x25a336){if(!_0x25a336[_0x08b0('0x3b')]){_0x5d66b1=0x0;}else{_0x5d66b1=_0x25a336[0x0][_0x08b0('0x21')]||0x0;}return dbH[_0x08b0('0x85')][_0x08b0('0x36')](_0x2e440a[_0x08b0('0x84')](),{'type':dbH[_0x08b0('0x85')][_0x08b0('0x86')]['SELECT']});})['then'](function(_0x1947c7){return{'rows':_0x1947c7||[],'count':_0x5d66b1};});}});}exports[_0x08b0('0xa6')]=function(_0x575fc8,_0x11d594){return runReport(_0x575fc8[_0x08b0('0x48')],_0x575fc8[_0x08b0('0x36')],_0x575fc8[_0x08b0('0x43')])[_0x08b0('0x26')](respondWithResult(_0x11d594,null))['catch'](handleError(_0x11d594,null));};exports[_0x08b0('0xa7')]=runReport;exports[_0x08b0('0x36')]=function(_0x20f68c,_0x4ed9b8){var _0x47f830=0xa;var _0x3931d0=['join',_0x08b0('0x57'),_0x08b0('0xa8'),_0x08b0('0x58')];var _0x1e6120={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x08b0('0x88'),'MAX':'MAX(%s)','MIN':_0x08b0('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x08b0('0x89'),'GROUP_CONCAT ASC':_0x08b0('0x8a'),'GROUP_CONCAT DESC':_0x08b0('0x5e')};var _0x5f3fbc={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x08b0('0x8b'),'HOUR':_0x08b0('0x60'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x08b0('0x62')};var _0x3437c1=function(_0x7a7026){return!_['includes']([_0x08b0('0x64'),_0x08b0('0x8c'),_0x08b0('0x65'),_0x08b0('0x8d')],_0x7a7026);};var _0x44265a=function(_0x362895){if(!_0x362895||!_0x362895[_0x08b0('0x66')][_0x08b0('0x3b')]){return'';}for(var _0x573430='(',_0x293197=0x0;_0x293197<_0x362895[_0x08b0('0x66')][_0x08b0('0x3b')];_0x293197+=0x1){_0x293197>0x0&&(_0x573430+='\x20'+_0x362895[_0x08b0('0x67')]+'\x20');_0x573430+=_0x362895[_0x08b0('0x66')][_0x293197][_0x08b0('0x68')]?_0x44265a(_0x362895['rules'][_0x293197][_0x08b0('0x68')]):_0x362895[_0x08b0('0x66')][_0x293197]['field']+'\x20'+_0x362895[_0x08b0('0x66')][_0x293197]['condition']+(_0x3437c1(_0x362895[_0x08b0('0x66')][_0x293197][_0x08b0('0x6a')])?'\x20'+_0x362895[_0x08b0('0x66')][_0x293197]['value']:'');}return _0x573430+')';};var _0xcb8f9a={'where':{'id':_0x20f68c[_0x08b0('0x48')]['id']}},_0x5a3504,_0x53307a,_0x9496b9,_0x1e3942,_0x15f77f;_0xcb8f9a=_[_0x08b0('0x41')]({},_0xcb8f9a,_0x20f68c['options']);return db[_0x08b0('0x45')][_0x08b0('0x4a')](_0xcb8f9a)[_0x08b0('0x26')](function(_0x5640e6){if(_0x5640e6){_0x5a3504=_0x5640e6;return _0x5640e6[_0x08b0('0x8e')]();}return null;})[_0x08b0('0x26')](function(_0x13a58f){if(_0x13a58f){if(!_0x13a58f['length']){throw new db[(_0x08b0('0x6c'))][(_0x08b0('0xa9'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x53307a=_0x13a58f;return db[_0x08b0('0x8f')]['findAll']({'raw':!![]});}return null;})[_0x08b0('0x26')](function(_0x21e854){if(_0x21e854){_0x9496b9=_[_0x08b0('0x6e')](_0x21e854,'id');var _0x179caa;var _0x1affec=squel[_0x08b0('0x6f')]();_0x1affec['from'](_0x5a3504[_0x08b0('0x71')]);for(var _0x1bdfd7=0x0;_0x1bdfd7<_0x53307a[_0x08b0('0x3b')];_0x1bdfd7+=0x1){_0x179caa=_0x53307a[_0x1bdfd7][_0x08b0('0x72')]?_0x9496b9[_0x53307a[_0x1bdfd7][_0x08b0('0x72')]][_0x08b0('0x73')]:_0x53307a[_0x1bdfd7][_0x08b0('0x69')];_0x179caa=_0x53307a[_0x1bdfd7][_0x08b0('0x74')]?_[_0x08b0('0x75')](_0x1e6120[_0x53307a[_0x1bdfd7][_0x08b0('0x74')]],'%s',_0x179caa):_0x179caa;_0x179caa=_0x53307a[_0x1bdfd7][_0x08b0('0x76')]?_[_0x08b0('0x75')](_0x5f3fbc[_0x53307a[_0x1bdfd7]['format']],'%s',_0x179caa):_0x179caa;if(_0x53307a[_0x1bdfd7][_0x08b0('0x90')]){_0x1affec[_0x08b0('0x68')](_0x179caa);}_0x53307a[_0x1bdfd7][_0x08b0('0x77')]&&_0x1affec[_0x08b0('0x78')](_0x179caa,_0x53307a[_0x1bdfd7][_0x08b0('0x77')]===_0x08b0('0x79')?![]:!![]);_0x1affec[_0x08b0('0x69')](_0x179caa,_0x53307a[_0x1bdfd7][_0x08b0('0x91')]||_0x179caa);}if(_0x5a3504['joins']){_0x5a3504[_0x08b0('0x7a')]=JSON[_0x08b0('0x7b')](_0x5a3504[_0x08b0('0x7a')]);for(var _0x1db67d=0x0;_0x1db67d<_0x5a3504[_0x08b0('0x7a')][_0x08b0('0x3b')];_0x1db67d+=0x1){if(_0x5a3504[_0x08b0('0x7a')][_0x1db67d]['type']&&_[_0x08b0('0x63')](_0x3931d0,_0x5a3504[_0x08b0('0x7a')][_0x1db67d][_0x08b0('0x32')])&&_0x5a3504[_0x08b0('0x7a')][_0x1db67d][_0x08b0('0x7c')]&&_0x5a3504['joins'][_0x1db67d][_0x08b0('0x7e')]&&_0x5a3504['joins'][_0x1db67d][_0x08b0('0x7d')]){_0x1affec[_0x5a3504[_0x08b0('0x7a')][_0x1db67d]['type']](_0x5a3504[_0x08b0('0x7a')][_0x1db67d][_0x08b0('0x7e')],null,util[_0x08b0('0x76')](_0x08b0('0x7f'),_0x5a3504[_0x08b0('0x71')],_0x5a3504[_0x08b0('0x7a')][_0x1db67d][_0x08b0('0x7c')],_0x5a3504[_0x08b0('0x7a')][_0x1db67d][_0x08b0('0x7e')],_0x5a3504[_0x08b0('0x7a')][_0x1db67d]['foreignKey']));}}}if(_0x5a3504[_0x08b0('0x80')]){_0x5a3504[_0x08b0('0x80')]=JSON['parse'](_0x5a3504['conditions']);_0x1affec[_0x08b0('0x3f')](_0x44265a(_0x5a3504[_0x08b0('0x80')][_0x08b0('0x68')]));}_0x15f77f=_0x1affec[_0x08b0('0x81')]();_0x1affec['limit'](_0x47f830);_0x1affec[_0x08b0('0x1e')](0x0);logger['debug'](_0x08b0('0x83'),_0x1affec[_0x08b0('0x84')]());return dbH['sequelize'][_0x08b0('0x36')](_0x1affec[_0x08b0('0x84')](),{'type':dbH['sequelize']['QueryTypes'][_0x08b0('0x87')]});}})['then'](function(){return{'sql':_0x15f77f['toString']()};})['then'](respondWithResult(_0x4ed9b8,null))[_0x08b0('0x4b')](handleError(_0x4ed9b8,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index ecfe73e..2a59083 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 _0x6b08=['request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','define','analytics_custom_reports','util','../../config/logger','api','bluebird'];(function(_0x7ad6cb,_0xffee6c){var _0x22a0ba=function(_0x47f291){while(--_0x47f291){_0x7ad6cb['push'](_0x7ad6cb['shift']());}};_0x22a0ba(++_0xffee6c);}(_0x6b08,0x1ca));var _0x86b0=function(_0x3335e7,_0x28bd34){_0x3335e7=_0x3335e7-0x0;var _0x41c51f=_0x6b08[_0x3335e7];return _0x41c51f;};'use strict';var _=require('lodash');var util=require(_0x86b0('0x0'));var logger=require(_0x86b0('0x1'))(_0x86b0('0x2'));var moment=require('moment');var BPromise=require(_0x86b0('0x3'));var rp=require(_0x86b0('0x4'));var fs=require('fs');var path=require(_0x86b0('0x5'));var rimraf=require(_0x86b0('0x6'));var config=require(_0x86b0('0x7'));var attributes=require(_0x86b0('0x8'));module['exports']=function(_0x4840b9,_0x8cdd5d){return _0x4840b9[_0x86b0('0x9')]('AnalyticCustomReport',attributes,{'tableName':_0x86b0('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1aac=['path','rimraf','./analyticCustomReport.attributes','exports','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3650ea,_0x4cf9ba){var _0x444030=function(_0x5051e8){while(--_0x5051e8){_0x3650ea['push'](_0x3650ea['shift']());}};_0x444030(++_0x4cf9ba);}(_0x1aac,0x159));var _0xc1aa=function(_0x294ae3,_0x418087){_0x294ae3=_0x294ae3-0x0;var _0x312b44=_0x1aac[_0x294ae3];return _0x312b44;};'use strict';var _=require(_0xc1aa('0x0'));var util=require(_0xc1aa('0x1'));var logger=require(_0xc1aa('0x2'))(_0xc1aa('0x3'));var moment=require(_0xc1aa('0x4'));var BPromise=require(_0xc1aa('0x5'));var rp=require(_0xc1aa('0x6'));var fs=require('fs');var path=require(_0xc1aa('0x7'));var rimraf=require(_0xc1aa('0x8'));var config=require('../../config/environment');var attributes=require(_0xc1aa('0x9'));module[_0xc1aa('0xa')]=function(_0x128b47,_0x2102c3){return _0x128b47['define']('AnalyticCustomReport',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 c90226b..96bfbfa 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 _0xce4e=['info','AnalyticCustomReport,\x20%s,\x20%s','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then'];(function(_0x138208,_0x140722){var _0x4f93b5=function(_0x1df020){while(--_0x1df020){_0x138208['push'](_0x138208['shift']());}};_0x4f93b5(++_0x140722);}(_0xce4e,0x1eb));var _0xece4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xce4e[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xece4('0x0'));var util=require(_0xece4('0x1'));var moment=require(_0xece4('0x2'));var BPromise=require(_0xece4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xece4('0x4'));var db=require(_0xece4('0x5'))['db'];var utils=require(_0xece4('0x6'));var logger=require(_0xece4('0x7'))(_0xece4('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xece4('0x9')][_0xece4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a8616,_0x31107d,_0x410d3b){return new BPromise(function(_0x5eaaf7,_0x22cff2){return client[_0xece4('0xb')](_0x4a8616,_0x410d3b)[_0xece4('0xc')](function(_0x1257b9){logger[_0xece4('0xd')](_0xece4('0xe'),_0x31107d,'request\x20sent');logger[_0xece4('0xf')](_0xece4('0x10'),_0x31107d,_0xece4('0x11'),JSON[_0xece4('0x12')](_0x1257b9));if(_0x1257b9[_0xece4('0x13')]){if(_0x1257b9[_0xece4('0x13')][_0xece4('0x14')]===0x1f4){logger[_0xece4('0x13')]('AnalyticCustomReport,\x20%s,\x20%s',_0x31107d,_0x1257b9[_0xece4('0x13')][_0xece4('0x15')]);return _0x22cff2(_0x1257b9[_0xece4('0x13')]['message']);}logger[_0xece4('0x13')](_0xece4('0xe'),_0x31107d,_0x1257b9['error'][_0xece4('0x15')]);return _0x5eaaf7(_0x1257b9[_0xece4('0x13')]['message']);}else{logger[_0xece4('0xd')](_0xece4('0xe'),_0x31107d,_0xece4('0x11'));_0x5eaaf7(_0x1257b9[_0xece4('0x16')]['message']);}})[_0xece4('0x17')](function(_0x598222){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x31107d,_0x598222);_0x22cff2(_0x598222);});});} \ No newline at end of file +var _0xc626=['bluebird','../../config/utils','../../config/environment','jayson/promise','http','info','AnalyticCustomReport,\x20%s,\x20%s','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util'];(function(_0x4557dc,_0x3687b2){var _0x1377aa=function(_0x41c62a){while(--_0x41c62a){_0x4557dc['push'](_0x4557dc['shift']());}};_0x1377aa(++_0x3687b2);}(_0xc626,0x18e));var _0x6c62=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc626[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6c62('0x0'));var util=require(_0x6c62('0x1'));var moment=require('moment');var BPromise=require(_0x6c62('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6c62('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x6c62('0x4'));var jayson=require(_0x6c62('0x5'));var client=jayson['client'][_0x6c62('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x59697a,_0x30f9e0,_0x117cc8){return new BPromise(function(_0x109f52,_0x3e7352){return client['request'](_0x59697a,_0x117cc8)['then'](function(_0x246d63){logger[_0x6c62('0x7')](_0x6c62('0x8'),_0x30f9e0,'request\x20sent');logger[_0x6c62('0x9')](_0x6c62('0xa'),_0x30f9e0,_0x6c62('0xb'),JSON[_0x6c62('0xc')](_0x246d63));if(_0x246d63[_0x6c62('0xd')]){if(_0x246d63[_0x6c62('0xd')]['code']===0x1f4){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x30f9e0,_0x246d63[_0x6c62('0xd')]['message']);return _0x3e7352(_0x246d63[_0x6c62('0xd')][_0x6c62('0xe')]);}logger[_0x6c62('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x30f9e0,_0x246d63[_0x6c62('0xd')][_0x6c62('0xe')]);return _0x109f52(_0x246d63[_0x6c62('0xd')]['message']);}else{logger[_0x6c62('0x7')](_0x6c62('0x8'),_0x30f9e0,'request\x20sent');_0x109f52(_0x246d63['result'][_0x6c62('0xe')]);}})[_0x6c62('0xf')](function(_0x1a586c){logger['error'](_0x6c62('0x8'),_0x30f9e0,_0x1a586c);_0x3e7352(_0x1a586c);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index ff227cd..5929bff 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 _0xc7a3=['run','/:id/query','query','post','put','update','delete','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','show','preview'];(function(_0x23f558,_0x34d026){var _0x55e9ec=function(_0x7f94e){while(--_0x7f94e){_0x23f558['push'](_0x23f558['shift']());}};_0x55e9ec(++_0x34d026);}(_0xc7a3,0x11a));var _0x3c7a=function(_0x3c293a,_0x170e9a){_0x3c293a=_0x3c293a-0x0;var _0x1a9e99=_0xc7a3[_0x3c293a];return _0x1a9e99;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x3c7a('0x0'));var express=require(_0x3c7a('0x1'));var router=express[_0x3c7a('0x2')]();var fs_extra=require(_0x3c7a('0x3'));var auth=require(_0x3c7a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3c7a('0x5'));var controller=require(_0x3c7a('0x6'));router[_0x3c7a('0x7')]('/',auth[_0x3c7a('0x8')](),controller[_0x3c7a('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x3c7a('0xa')]);router[_0x3c7a('0x7')]('/:id/preview',auth[_0x3c7a('0x8')](),controller[_0x3c7a('0xb')]);router['get']('/:id/run',auth[_0x3c7a('0x8')](),controller[_0x3c7a('0xc')]);router[_0x3c7a('0x7')](_0x3c7a('0xd'),auth[_0x3c7a('0x8')](),controller[_0x3c7a('0xe')]);router[_0x3c7a('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3c7a('0x10')]('/:id',auth[_0x3c7a('0x8')](),controller[_0x3c7a('0x11')]);router[_0x3c7a('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x3c7a('0x13')]);module[_0x3c7a('0x14')]=router; \ No newline at end of file +var _0xa7c6=['../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','preview','run','/:id/query','query','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x3dbf18,_0x3117a1){var _0x2f7531=function(_0x28e27d){while(--_0x28e27d){_0x3dbf18['push'](_0x3dbf18['shift']());}};_0x2f7531(++_0x3117a1);}(_0xa7c6,0x182));var _0x6a7c=function(_0x5ead07,_0x48677f){_0x5ead07=_0x5ead07-0x0;var _0x5c6896=_0xa7c6[_0x5ead07];return _0x5c6896;};'use strict';var multer=require(_0x6a7c('0x0'));var util=require(_0x6a7c('0x1'));var path=require('path');var timeout=require(_0x6a7c('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6a7c('0x3'));var auth=require(_0x6a7c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6a7c('0x5'));var controller=require(_0x6a7c('0x6'));router[_0x6a7c('0x7')]('/',auth[_0x6a7c('0x8')](),controller[_0x6a7c('0x9')]);router[_0x6a7c('0x7')](_0x6a7c('0xa'),auth[_0x6a7c('0x8')](),controller[_0x6a7c('0xb')]);router['get']('/:id/preview',auth[_0x6a7c('0x8')](),controller[_0x6a7c('0xc')]);router['get']('/:id/run',auth[_0x6a7c('0x8')](),controller[_0x6a7c('0xd')]);router[_0x6a7c('0x7')](_0x6a7c('0xe'),auth['isAuthenticated'](),controller[_0x6a7c('0xf')]);router[_0x6a7c('0x10')]('/',auth[_0x6a7c('0x8')](),controller[_0x6a7c('0x11')]);router[_0x6a7c('0x12')](_0x6a7c('0xa'),auth['isAuthenticated'](),controller[_0x6a7c('0x13')]);router[_0x6a7c('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x6a7c('0x15')]);module[_0x6a7c('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index db6ccc4..14a9d0e 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 _0xbd51=['sequelize','STRING'];(function(_0x470d17,_0x32e508){var _0xd6558d=function(_0x23f372){while(--_0x23f372){_0x470d17['push'](_0x470d17['shift']());}};_0xd6558d(++_0x32e508);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x54d9b0,_0x29b545){_0x54d9b0=_0x54d9b0-0x0;var _0x1f9ad0=_0xbd51[_0x54d9b0];return _0x1f9ad0;};'use strict';var Sequelize=require(_0x1bd5('0x0'));module['exports']={'name':{'type':Sequelize[_0x1bd5('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x1bd5('0x1')]},'parent':{'type':Sequelize[_0x1bd5('0x1')]},'table':{'type':Sequelize[_0x1bd5('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x7217=['sequelize','STRING','TEXT'];(function(_0x189371,_0x41008e){var _0xd76c39=function(_0x1cbb20){while(--_0x1cbb20){_0x189371['push'](_0x189371['shift']());}};_0xd76c39(++_0x41008e);}(_0x7217,0x19e));var _0x7721=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0x7217[_0x2160a9];return _0xa88cf7;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'name':{'type':Sequelize[_0x7721('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7721('0x1')]},'parent':{'type':Sequelize[_0x7721('0x1')]},'table':{'type':Sequelize[_0x7721('0x1')]},'conditions':{'type':Sequelize[_0x7721('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 9801e08..edadda2 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 _0xc4aa=['Content-Range','apply','reject','save','update','then','destroy','get','DefaultReports','UserProfileResource','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','AnalyticDefaultReport','findAll','rows','catch','show','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','COUNT(%s)','MAX(%s)','AVG(%s)','SEC_TO_TIME(%s)','IS\x20NOT\x20EMPTY','value','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','groupBy','alias','includes','foreignKey','output','web','fullPath','%s-%s.%s','randomstring','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','info','Run\x20Query:','child_process','fork','countTable','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NOT\x20NULL','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x23a299,_0x30e49c){var _0x560bb3=function(_0x1c8073){while(--_0x1c8073){_0x23a299['push'](_0x23a299['shift']());}};_0x560bb3(++_0x30e49c);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xc4aa[_0x342baa];return _0x1208f3;};'use strict';var emlformat=require(_0xac4a('0x0'));var rimraf=require(_0xac4a('0x1'));var zipdir=require(_0xac4a('0x2'));var jsonpatch=require(_0xac4a('0x3'));var rp=require(_0xac4a('0x4'));var moment=require(_0xac4a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xac4a('0x6'));var sox=require(_0xac4a('0x7'));var csv=require(_0xac4a('0x8'));var ejs=require(_0xac4a('0x9'));var fs=require('fs');var fs_extra=require(_0xac4a('0xa'));var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x8'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];var dbH=require(_0xac4a('0x16'))['dbH'];function respondWithStatusCode(_0x21a79,_0x68424a){_0x68424a=_0x68424a||0xcc;return function(_0x247b78){if(_0x247b78){return _0x21a79[_0xac4a('0x17')](_0x68424a);}return _0x21a79[_0xac4a('0x18')](_0x68424a)[_0xac4a('0x19')]();};}function respondWithResult(_0x34bc01,_0x33c287){_0x33c287=_0x33c287||0xc8;return function(_0x190418){if(_0x190418){return _0x34bc01[_0xac4a('0x18')](_0x33c287)[_0xac4a('0x1a')](_0x190418);}};}function respondWithFilteredResult(_0x26dbb8,_0x4a2119){return function(_0x402fff){if(_0x402fff){var _0x34d797=typeof _0x4a2119[_0xac4a('0x1b')]===_0xac4a('0x1c')&&typeof _0x4a2119[_0xac4a('0x1d')]===_0xac4a('0x1c');var _0x28e304=_0x402fff[_0xac4a('0x1e')];var _0x546c5d=_0x34d797?0x0:_0x4a2119['offset'];var _0x21a729=_0x34d797?_0x402fff[_0xac4a('0x1e')]:_0x4a2119[_0xac4a('0x1b')]+_0x4a2119['limit'];var _0x39e83e;if(_0x21a729>=_0x28e304){_0x21a729=_0x28e304;_0x39e83e=0xc8;}else{_0x39e83e=0xce;}_0x26dbb8[_0xac4a('0x18')](_0x39e83e);return _0x26dbb8[_0xac4a('0x1f')](_0xac4a('0x20'),_0x546c5d+'-'+_0x21a729+'/'+_0x28e304)[_0xac4a('0x1a')](_0x402fff);}return null;};}function patchUpdates(_0x3e829c){return function(_0xe38996){try{jsonpatch[_0xac4a('0x21')](_0xe38996,_0x3e829c,!![]);}catch(_0x534092){return BPromise[_0xac4a('0x22')](_0x534092);}return _0xe38996[_0xac4a('0x23')]();};}function saveUpdates(_0x599787,_0x3d7ce0){return function(_0x4169c0){if(_0x4169c0){return _0x4169c0[_0xac4a('0x24')](_0x599787)[_0xac4a('0x25')](function(_0x4d2d6c){return _0x4d2d6c;});}return null;};}function removeEntity(_0x1b7998,_0x2503d8){return function(_0x15435c){if(_0x15435c){return _0x15435c[_0xac4a('0x26')]()[_0xac4a('0x25')](function(){var _0x2b0dc2=_0x15435c[_0xac4a('0x27')]({'plain':!![]});var _0x36054a=_0xac4a('0x28');return db[_0xac4a('0x29')][_0xac4a('0x26')]({'where':{'type':_0x36054a,'resourceId':_0x2b0dc2['id']}})[_0xac4a('0x25')](function(){return _0x15435c;});})[_0xac4a('0x25')](function(){_0x1b7998[_0xac4a('0x18')](0xcc)[_0xac4a('0x19')]();});}};}function handleEntityNotFound(_0x20202c,_0x4e17ce){return function(_0x23b061){if(!_0x23b061){_0x20202c[_0xac4a('0x17')](0x194);}return _0x23b061;};}function handleError(_0x42a33c,_0x2772fe){_0x2772fe=_0x2772fe||0x1f4;return function(_0x116700){logger['error'](_0x116700['stack']);if(_0x116700[_0xac4a('0x2a')]){delete _0x116700[_0xac4a('0x2a')];}_0x42a33c[_0xac4a('0x18')](_0x2772fe)['send'](_0x116700);};}exports['index']=function(_0x355755,_0x2896bc){var _0x228629={},_0x432066={},_0x17118e={'count':0x0,'rows':[]};var _0x53d3a5=_[_0xac4a('0x2b')](db['AnalyticDefaultReport'][_0xac4a('0x2c')],function(_0x57adcf){return{'name':_0x57adcf[_0xac4a('0x2d')],'type':_0x57adcf[_0xac4a('0x2e')][_0xac4a('0x2f')]};});_0x432066[_0xac4a('0x30')]=_[_0xac4a('0x2b')](_0x53d3a5,_0xac4a('0x2a'));_0x432066[_0xac4a('0x31')]=_[_0xac4a('0x32')](_0x355755[_0xac4a('0x31')]);_0x432066[_0xac4a('0x33')]=_[_0xac4a('0x34')](_0x432066[_0xac4a('0x30')],_0x432066[_0xac4a('0x31')]);_0x228629[_0xac4a('0x35')]=_['intersection'](_0x432066[_0xac4a('0x30')],qs[_0xac4a('0x36')](_0x355755['query'][_0xac4a('0x36')]));_0x228629[_0xac4a('0x35')]=_0x228629['attributes']['length']?_0x228629[_0xac4a('0x35')]:_0x432066[_0xac4a('0x30')];if(!_0x355755[_0xac4a('0x31')][_0xac4a('0x37')]('nolimit')){_0x228629[_0xac4a('0x1d')]=qs[_0xac4a('0x1d')](_0x355755['query'][_0xac4a('0x1d')]);_0x228629[_0xac4a('0x1b')]=qs[_0xac4a('0x1b')](_0x355755['query'][_0xac4a('0x1b')]);}_0x228629[_0xac4a('0x38')]=qs[_0xac4a('0x39')](_0x355755['query'][_0xac4a('0x39')]);_0x228629[_0xac4a('0x3a')]=qs['filters'](_['pick'](_0x355755[_0xac4a('0x31')],_0x432066['filters']),_0x53d3a5);if(_0x355755['query']['filter']){_0x228629['where']=_[_0xac4a('0x3b')](_0x228629[_0xac4a('0x3a')],{'$or':_[_0xac4a('0x2b')](_0x53d3a5,function(_0x472484){if(_0x472484[_0xac4a('0x2e')]!==_0xac4a('0x3c')){var _0x4220e2={};_0x4220e2[_0x472484[_0xac4a('0x2a')]]={'$like':'%'+_0x355755[_0xac4a('0x31')][_0xac4a('0x3d')]+'%'};return _0x4220e2;}})});}_0x228629=_[_0xac4a('0x3b')]({},_0x228629,_0x355755[_0xac4a('0x3e')]);var _0x4e4994={'where':_0x228629['where']};return db['AnalyticDefaultReport'][_0xac4a('0x1e')](_0x4e4994)[_0xac4a('0x25')](function(_0x14e80b){_0x17118e[_0xac4a('0x1e')]=_0x14e80b;if(_0x355755[_0xac4a('0x31')][_0xac4a('0x3f')]){_0x228629[_0xac4a('0x40')]=[{'all':!![]}];}return db[_0xac4a('0x41')][_0xac4a('0x42')](_0x228629);})[_0xac4a('0x25')](function(_0x561cb7){_0x17118e[_0xac4a('0x43')]=_0x561cb7;return _0x17118e;})[_0xac4a('0x25')](respondWithFilteredResult(_0x2896bc,_0x228629))[_0xac4a('0x44')](handleError(_0x2896bc,null));};exports[_0xac4a('0x45')]=function(_0x1a96cf,_0x57b879){var _0x8700b4={'raw':!![],'where':{'id':_0x1a96cf['params']['id']}},_0x1b77bb={};_0x1b77bb[_0xac4a('0x30')]=_['keys'](db[_0xac4a('0x41')][_0xac4a('0x2c')]);_0x1b77bb[_0xac4a('0x31')]=_[_0xac4a('0x32')](_0x1a96cf[_0xac4a('0x31')]);_0x1b77bb[_0xac4a('0x33')]=_[_0xac4a('0x34')](_0x1b77bb[_0xac4a('0x30')],_0x1b77bb[_0xac4a('0x31')]);_0x8700b4[_0xac4a('0x35')]=_[_0xac4a('0x34')](_0x1b77bb[_0xac4a('0x30')],qs['fields'](_0x1a96cf[_0xac4a('0x31')][_0xac4a('0x36')]));_0x8700b4[_0xac4a('0x35')]=_0x8700b4['attributes'][_0xac4a('0x46')]?_0x8700b4[_0xac4a('0x35')]:_0x1b77bb['model'];if(_0x1a96cf[_0xac4a('0x31')]['includeAll']){_0x8700b4[_0xac4a('0x40')]=[{'all':!![]}];}_0x8700b4=_[_0xac4a('0x3b')]({},_0x8700b4,_0x1a96cf[_0xac4a('0x3e')]);return db['AnalyticDefaultReport']['find'](_0x8700b4)[_0xac4a('0x25')](handleEntityNotFound(_0x57b879,null))['then'](respondWithResult(_0x57b879,null))[_0xac4a('0x44')](handleError(_0x57b879,null));};exports['create']=function(_0x3d2aaf,_0x530bbb){return db[_0xac4a('0x41')][_0xac4a('0x47')](_0x3d2aaf[_0xac4a('0x48')],{})[_0xac4a('0x25')](function(_0x54782f){var _0x31c794=_0x3d2aaf[_0xac4a('0x49')][_0xac4a('0x27')]({'plain':!![]});if(!_0x31c794)throw new Error(_0xac4a('0x4a'));if(_0x31c794[_0xac4a('0x4b')]===_0xac4a('0x49')){var _0x187306=_0x54782f['get']({'plain':!![]});var _0x35dee5=_0xac4a('0x4c');return db['UserProfileSection'][_0xac4a('0x4d')]({'where':{'name':_0x35dee5,'userProfileId':_0x31c794[_0xac4a('0x4e')]},'raw':!![]})[_0xac4a('0x25')](function(_0x3ac36e){if(_0x3ac36e&&_0x3ac36e['autoAssociation']===0x0){return db[_0xac4a('0x29')][_0xac4a('0x47')]({'name':_0x187306[_0xac4a('0x2a')],'resourceId':_0x187306['id'],'type':_0xac4a('0x28'),'sectionId':_0x3ac36e['id']},{})[_0xac4a('0x25')](function(){return _0x54782f;});}else{return _0x54782f;}})['catch'](function(_0x179373){logger['error'](_0xac4a('0x4f'),_0x179373);throw _0x179373;});}return _0x54782f;})[_0xac4a('0x25')](respondWithResult(_0x530bbb,0xc9))['catch'](handleError(_0x530bbb,null));};exports['update']=function(_0x437466,_0x70fdc3){if(_0x437466['body']['id']){delete _0x437466[_0xac4a('0x48')]['id'];}return db[_0xac4a('0x41')][_0xac4a('0x4d')]({'where':{'id':_0x437466[_0xac4a('0x50')]['id']}})['then'](handleEntityNotFound(_0x70fdc3,null))[_0xac4a('0x25')](saveUpdates(_0x437466[_0xac4a('0x48')],null))[_0xac4a('0x25')](respondWithResult(_0x70fdc3,null))[_0xac4a('0x44')](handleError(_0x70fdc3,null));};exports[_0xac4a('0x26')]=function(_0x411547,_0x36179a){return db['AnalyticDefaultReport'][_0xac4a('0x4d')]({'where':{'id':_0x411547[_0xac4a('0x50')]['id']}})[_0xac4a('0x25')](handleEntityNotFound(_0x36179a,null))[_0xac4a('0x25')](removeEntity(_0x36179a,null))[_0xac4a('0x44')](handleError(_0x36179a,null));};exports[_0xac4a('0x51')]=function(_0x213df2,_0x236f57){var _0x159e43=0xa;var _0x786d9=[_0xac4a('0x52'),_0xac4a('0x53'),_0xac4a('0x54'),_0xac4a('0x55')];var _0x5222f3={'SUM':_0xac4a('0x56'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xac4a('0x57'),'MAX':'MAX(%s)','MIN':_0xac4a('0x58'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xac4a('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xac4a('0x5a')};var _0x5cac9b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xac4a('0x5b'),'HOUR':_0xac4a('0x5c'),'ROUND':_0xac4a('0x5d'),'UNIX_TIMESTAMP':_0xac4a('0x5e')};var _0x2f9940=function(_0xb7b884){return!_['includes']([_0xac4a('0x5f'),'IS\x20NOT\x20NULL',_0xac4a('0x60'),'IS\x20NOT\x20EMPTY'],_0xb7b884);};var _0x347880=function(_0x19ce2c){if(!_0x19ce2c||!_0x19ce2c[_0xac4a('0x61')][_0xac4a('0x46')]){return'';}for(var _0x429273='(',_0x2bc39a=0x0;_0x2bc39a<_0x19ce2c[_0xac4a('0x61')][_0xac4a('0x46')];_0x2bc39a+=0x1){_0x2bc39a>0x0&&(_0x429273+='\x20'+_0x19ce2c[_0xac4a('0x62')]+'\x20');_0x429273+=_0x19ce2c[_0xac4a('0x61')][_0x2bc39a][_0xac4a('0x63')]?_0x347880(_0x19ce2c[_0xac4a('0x61')][_0x2bc39a][_0xac4a('0x63')]):_0x19ce2c[_0xac4a('0x61')][_0x2bc39a][_0xac4a('0x64')]+'\x20'+_0x19ce2c[_0xac4a('0x61')][_0x2bc39a][_0xac4a('0x65')]+(_0x2f9940(_0x19ce2c['rules'][_0x2bc39a][_0xac4a('0x65')])?'\x20'+_0x19ce2c[_0xac4a('0x61')][_0x2bc39a]['value']:'');}return _0x429273+')';};var _0x3c3576={'where':{'id':_0x213df2['params']['id']}},_0x34bd1c,_0x2d24c7,_0x2b8562,_0x357cac,_0x4d1440;_0x3c3576=_[_0xac4a('0x3b')]({},_0x3c3576,_0x213df2[_0xac4a('0x3e')]);return db[_0xac4a('0x41')][_0xac4a('0x4d')](_0x3c3576)[_0xac4a('0x25')](function(_0x21ef8b){if(_0x21ef8b){_0x34bd1c=_0x21ef8b;return _0x21ef8b[_0xac4a('0x66')]();}return null;})[_0xac4a('0x25')](function(_0x44c60b){if(_0x44c60b){if(!_0x44c60b[_0xac4a('0x46')]){throw new db[(_0xac4a('0x67'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2d24c7=_0x44c60b;return db[_0xac4a('0x68')][_0xac4a('0x42')]({'raw':!![]});}return null;})[_0xac4a('0x25')](function(_0x423f70){if(_0x423f70){_0x2b8562=_[_0xac4a('0x69')](_0x423f70,'id');var _0x283107;var _0x1d24bb=squel[_0xac4a('0x6a')]();_0x1d24bb[_0xac4a('0x6b')](_0x34bd1c[_0xac4a('0x6c')]);for(var _0xb09b89=0x0;_0xb09b89<_0x2d24c7[_0xac4a('0x46')];_0xb09b89+=0x1){_0x283107=_0x2d24c7[_0xb09b89]['MetricId']?_0x2b8562[_0x2d24c7[_0xb09b89][_0xac4a('0x6d')]][_0xac4a('0x6e')]:_0x2d24c7[_0xb09b89][_0xac4a('0x64')];_0x283107=_0x2d24c7[_0xb09b89][_0xac4a('0x6f')]?_['replace'](_0x5222f3[_0x2d24c7[_0xb09b89][_0xac4a('0x6f')]],'%s',_0x283107):_0x283107;_0x283107=_0x2d24c7[_0xb09b89]['format']?_[_0xac4a('0x70')](_0x5cac9b[_0x2d24c7[_0xb09b89][_0xac4a('0x71')]],'%s',_0x283107):_0x283107;if(_0x2d24c7[_0xb09b89]['groupBy']){_0x1d24bb['group'](_0x283107);}_0x2d24c7[_0xb09b89][_0xac4a('0x72')]&&_0x1d24bb[_0xac4a('0x38')](_0x283107,_0x2d24c7[_0xb09b89][_0xac4a('0x72')]==='DESC'?![]:!![]);_0x1d24bb[_0xac4a('0x64')](_0x283107,_0x2d24c7[_0xb09b89]['alias']||_0x283107);}if(_0x34bd1c[_0xac4a('0x73')]){_0x34bd1c['joins']=JSON['parse'](_0x34bd1c[_0xac4a('0x73')]);for(var _0x56ef2a=0x0;_0x56ef2a<_0x34bd1c[_0xac4a('0x73')]['length'];_0x56ef2a+=0x1){if(_0x34bd1c[_0xac4a('0x73')][_0x56ef2a][_0xac4a('0x2e')]&&_['includes'](_0x786d9,_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['type'])&&_0x34bd1c[_0xac4a('0x73')][_0x56ef2a][_0xac4a('0x74')]&&_0x34bd1c['joins'][_0x56ef2a][_0xac4a('0x75')]&&_0x34bd1c['joins'][_0x56ef2a]['foreignKey']){_0x1d24bb[_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['type']](_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['foreignTable'],null,util['format'](_0xac4a('0x76'),_0x34bd1c[_0xac4a('0x6c')],_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['parentKey'],_0x34bd1c['joins'][_0x56ef2a][_0xac4a('0x75')],_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['foreignKey']));}}}if(_0x34bd1c['conditions']){_0x34bd1c[_0xac4a('0x77')]=JSON[_0xac4a('0x78')](_0x34bd1c[_0xac4a('0x77')]);_0x1d24bb[_0xac4a('0x3a')](_0x347880(_0x34bd1c[_0xac4a('0x77')][_0xac4a('0x63')]));}_0x4d1440=_0x1d24bb[_0xac4a('0x79')]();_0x1d24bb[_0xac4a('0x1d')](_0x159e43);_0x1d24bb[_0xac4a('0x1b')](0x0);logger['debug'](_0xac4a('0x7a'),_0x1d24bb[_0xac4a('0x7b')]());return dbH[_0xac4a('0x7c')]['query'](_0x1d24bb[_0xac4a('0x7b')](),{'type':dbH[_0xac4a('0x7c')][_0xac4a('0x7d')][_0xac4a('0x7e')]});}})[_0xac4a('0x25')](respondWithResult(_0x236f57,null))['catch'](handleError(_0x236f57,null));};function runReport(_0x290a73,_0x19ce24,_0xc9d040){var _0x37e519=_0x19ce24[_0xac4a('0x2a')];var _0x451248=0xa;var _0xd7bdd6=['join',_0xac4a('0x53'),_0xac4a('0x54'),_0xac4a('0x55')];var _0x35a97c={'SUM':_0xac4a('0x56'),'COUNT':_0xac4a('0x7f'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xac4a('0x80'),'MIN':_0xac4a('0x58'),'AVG':_0xac4a('0x81'),'GROUP_CONCAT':_0xac4a('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xac4a('0x5a')};var _0x56a934={'SEC_TO_TIME':_0xac4a('0x82'),'DATE':_0xac4a('0x5b'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xac4a('0x5e')};var _0x212a22=function(_0x1fe86a){return!_['includes']([_0xac4a('0x5f'),'IS\x20NOT\x20NULL',_0xac4a('0x60'),_0xac4a('0x83')],_0x1fe86a);};var _0x406b64=function(_0x35328e){if(!_0x35328e||!_0x35328e[_0xac4a('0x61')]['length']){return'';}for(var _0x50f471='(',_0x31cda0=0x0;_0x31cda0<_0x35328e[_0xac4a('0x61')][_0xac4a('0x46')];_0x31cda0+=0x1){_0x31cda0>0x0&&(_0x50f471+='\x20'+_0x35328e[_0xac4a('0x62')]+'\x20');_0x50f471+=_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x63')]?_0x406b64(_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x63')]):_0x35328e['rules'][_0x31cda0]['field']+'\x20'+_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x65')]+(_0x212a22(_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x65')])?'\x20'+_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x84')]:'');}return _0x50f471+')';};var _0xdaa2ef={'where':{'id':_0x290a73['id']}},_0x2e704b,_0x540d8e,_0x5e0be4,_0x32fd0c,_0x168f30;_0xdaa2ef=_[_0xac4a('0x3b')]({},_0xdaa2ef,_0xc9d040);return db[_0xac4a('0x41')][_0xac4a('0x4d')](_0xdaa2ef)[_0xac4a('0x25')](function(_0x338af3){if(_0x338af3){_0x2e704b=_0x338af3;return _0x338af3['getFields']();}return null;})[_0xac4a('0x25')](function(_0x1bacf2){if(_0x1bacf2){if(!_0x1bacf2[_0xac4a('0x46')]){throw new db['Sequelize'][(_0xac4a('0x85'))](_0xac4a('0x86'),0x193);}_0x540d8e=_0x1bacf2;return db[_0xac4a('0x68')][_0xac4a('0x42')]({'raw':!![]});}return null;})[_0xac4a('0x25')](function(_0x27d023){if(_0x27d023){_0x5e0be4=_[_0xac4a('0x69')](_0x27d023,'id');var _0x2ef42a;var _0x322465=squel['select']();_0x322465[_0xac4a('0x6b')](_0x2e704b['table']);for(var _0x203321=0x0;_0x203321<_0x540d8e[_0xac4a('0x46')];_0x203321+=0x1){_0x2ef42a=_0x540d8e[_0x203321][_0xac4a('0x6d')]?_0x5e0be4[_0x540d8e[_0x203321][_0xac4a('0x6d')]][_0xac4a('0x6e')]:_0x540d8e[_0x203321][_0xac4a('0x64')];_0x2ef42a=_0x540d8e[_0x203321][_0xac4a('0x6f')]?_['replace'](_0x35a97c[_0x540d8e[_0x203321][_0xac4a('0x6f')]],'%s',_0x2ef42a):_0x2ef42a;_0x2ef42a=_0x540d8e[_0x203321][_0xac4a('0x71')]?_[_0xac4a('0x70')](_0x56a934[_0x540d8e[_0x203321][_0xac4a('0x71')]],'%s',_0x2ef42a):_0x2ef42a;if(_0x540d8e[_0x203321][_0xac4a('0x87')]){_0x322465['group'](_0x2ef42a);}_0x540d8e[_0x203321][_0xac4a('0x72')]&&_0x322465[_0xac4a('0x38')](_0x2ef42a,_0x540d8e[_0x203321]['orderBy']==='DESC'?![]:!![]);_0x322465[_0xac4a('0x64')](_0x2ef42a,_0x540d8e[_0x203321][_0xac4a('0x88')]||_0x2ef42a);}if(_0x2e704b['joins']){_0x2e704b[_0xac4a('0x73')]=JSON[_0xac4a('0x78')](_0x2e704b[_0xac4a('0x73')]);for(var _0x37657e=0x0;_0x37657e<_0x2e704b[_0xac4a('0x73')][_0xac4a('0x46')];_0x37657e+=0x1){if(_0x2e704b['joins'][_0x37657e][_0xac4a('0x2e')]&&_[_0xac4a('0x89')](_0xd7bdd6,_0x2e704b[_0xac4a('0x73')][_0x37657e]['type'])&&_0x2e704b[_0xac4a('0x73')][_0x37657e][_0xac4a('0x74')]&&_0x2e704b[_0xac4a('0x73')][_0x37657e][_0xac4a('0x75')]&&_0x2e704b[_0xac4a('0x73')][_0x37657e][_0xac4a('0x8a')]){_0x322465[_0x2e704b['joins'][_0x37657e][_0xac4a('0x2e')]](_0x2e704b[_0xac4a('0x73')][_0x37657e]['foreignTable'],null,util[_0xac4a('0x71')]('%s.%s\x20=\x20%s.%s',_0x2e704b[_0xac4a('0x6c')],_0x2e704b[_0xac4a('0x73')][_0x37657e]['parentKey'],_0x2e704b[_0xac4a('0x73')][_0x37657e]['foreignTable'],_0x2e704b[_0xac4a('0x73')][_0x37657e]['foreignKey']));}}}if(_0x2e704b[_0xac4a('0x77')]){_0x2e704b[_0xac4a('0x77')]=JSON[_0xac4a('0x78')](_0x2e704b[_0xac4a('0x77')]);_0x322465[_0xac4a('0x3a')](_0x406b64(_0x2e704b[_0xac4a('0x77')][_0xac4a('0x63')]));}_0x168f30=_0x322465[_0xac4a('0x79')]();_0x322465[_0xac4a('0x1d')](_0x451248);_0x322465[_0xac4a('0x1b')](0x0);return;}})[_0xac4a('0x25')](function(){if(_0x19ce24[_0xac4a('0x8b')]===_0xac4a('0x8c')){return null;}var _0x4217df=_['merge'](_0x19ce24,{'name':_0x19ce24[_0xac4a('0x8d')]||_0x19ce24[_0xac4a('0x2a')]||_0x2e704b['name'],'basename':_0x37e519,'savename':util[_0xac4a('0x71')](_0xac4a('0x8e'),_0x19ce24[_0xac4a('0x2a')]||_0x2e704b[_0xac4a('0x2a')],require(_0xac4a('0x8f'))['generate'](0x4),_0x19ce24[_0xac4a('0x8b')]||'csv'),'reportId':_0x2e704b['id'],'reportType':_0xac4a('0x90')});return db[_0xac4a('0x91')][_0xac4a('0x47')](_0x4217df,{'raw':!![]});})[_0xac4a('0x25')](function(_0x53f23d){if(_0x2e704b[_0xac4a('0x6c')]==='cdr'){_0x168f30[_0xac4a('0x3a')](_0x2e704b[_0xac4a('0x6c')]+_0xac4a('0x92'),_0x19ce24['startDate'],_0x19ce24[_0xac4a('0x93')]);}else{_0x168f30[_0xac4a('0x3a')](_0x2e704b[_0xac4a('0x6c')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x19ce24[_0xac4a('0x94')],_0x19ce24[_0xac4a('0x93')]);}if(_0x53f23d){logger[_0xac4a('0x95')](_0xac4a('0x96'),_0x168f30[_0xac4a('0x7b')]());require(_0xac4a('0x97'))[_0xac4a('0x98')](path[_0xac4a('0x52')](__dirname,'../../components/export/',_0x53f23d[_0xac4a('0x8b')]),[_0x53f23d['id'],_0x168f30['toString'](),path['join'](__dirname,'../../files/reports',_0x53f23d['savename']),_0x37e519]);return _0x53f23d;}else{var _0x502275=squel[_0xac4a('0x6a')]();_0x502275[_0xac4a('0x6b')]('('+_0x168f30[_0xac4a('0x7b')]()+')',_0xac4a('0x99'));_0x502275[_0xac4a('0x64')]('COUNT(*)',_0xac4a('0x1e'));_0x168f30[_0xac4a('0x1d')](_0x19ce24[_0xac4a('0x1d')]||_0x451248);_0x168f30[_0xac4a('0x1b')](_0x19ce24[_0xac4a('0x1b')]||0x0);return dbH[_0xac4a('0x7c')][_0xac4a('0x31')](_0x502275[_0xac4a('0x7b')](),{'type':dbH['sequelize'][_0xac4a('0x7d')][_0xac4a('0x7e')]})[_0xac4a('0x25')](function(_0x25331f){if(!_0x25331f[_0xac4a('0x46')]){_0x32fd0c=0x0;}else{_0x32fd0c=_0x25331f[0x0][_0xac4a('0x1e')]||0x0;}return dbH[_0xac4a('0x7c')]['query'](_0x168f30['toString'](),{'type':dbH[_0xac4a('0x7c')][_0xac4a('0x7d')]['SELECT']});})[_0xac4a('0x25')](function(_0x366f5a){return{'rows':_0x366f5a||[],'count':_0x32fd0c};});}});}exports['run']=function(_0x5bd013,_0x2fe103){return runReport(_0x5bd013[_0xac4a('0x50')],_0x5bd013[_0xac4a('0x31')],_0x5bd013[_0xac4a('0x3e')])[_0xac4a('0x25')](respondWithResult(_0x2fe103,null))['catch'](handleError(_0x2fe103,null));};exports[_0xac4a('0x9a')]=runReport;exports['query']=function(_0x4f2d85,_0x538cfd){var _0x63c30=0xa;var _0x4301c3=[_0xac4a('0x52'),_0xac4a('0x53'),_0xac4a('0x54'),_0xac4a('0x55')];var _0xcad25d={'SUM':_0xac4a('0x56'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xac4a('0x58'),'AVG':_0xac4a('0x81'),'GROUP_CONCAT':_0xac4a('0x59'),'GROUP_CONCAT ASC':_0xac4a('0x9b'),'GROUP_CONCAT DESC':_0xac4a('0x5a')};var _0xcd140e={'SEC_TO_TIME':_0xac4a('0x82'),'DATE':_0xac4a('0x5b'),'HOUR':_0xac4a('0x5c'),'ROUND':_0xac4a('0x5d'),'UNIX_TIMESTAMP':_0xac4a('0x5e')};var _0x37cb49=function(_0xe0fd57){return!_[_0xac4a('0x89')]([_0xac4a('0x5f'),_0xac4a('0x9c'),_0xac4a('0x60'),_0xac4a('0x83')],_0xe0fd57);};var _0x41cdb5=function(_0x172d03){if(!_0x172d03||!_0x172d03[_0xac4a('0x61')][_0xac4a('0x46')]){return'';}for(var _0x3e2575='(',_0x4cc581=0x0;_0x4cc581<_0x172d03[_0xac4a('0x61')][_0xac4a('0x46')];_0x4cc581+=0x1){_0x4cc581>0x0&&(_0x3e2575+='\x20'+_0x172d03[_0xac4a('0x62')]+'\x20');_0x3e2575+=_0x172d03[_0xac4a('0x61')][_0x4cc581][_0xac4a('0x63')]?_0x41cdb5(_0x172d03[_0xac4a('0x61')][_0x4cc581][_0xac4a('0x63')]):_0x172d03[_0xac4a('0x61')][_0x4cc581]['field']+'\x20'+_0x172d03['rules'][_0x4cc581][_0xac4a('0x65')]+(_0x37cb49(_0x172d03[_0xac4a('0x61')][_0x4cc581][_0xac4a('0x65')])?'\x20'+_0x172d03['rules'][_0x4cc581]['value']:'');}return _0x3e2575+')';};var _0x5de198={'where':{'id':_0x4f2d85[_0xac4a('0x50')]['id']}},_0x2b6773,_0x52df82,_0x59e82c,_0x216055,_0x52963c;_0x5de198=_['merge']({},_0x5de198,_0x4f2d85[_0xac4a('0x3e')]);return db[_0xac4a('0x41')][_0xac4a('0x4d')](_0x5de198)[_0xac4a('0x25')](function(_0x403a16){if(_0x403a16){_0x2b6773=_0x403a16;return _0x403a16[_0xac4a('0x66')]();}return null;})['then'](function(_0x25bf23){if(_0x25bf23){if(!_0x25bf23[_0xac4a('0x46')]){throw new db[(_0xac4a('0x67'))]['ValidationErrorItem'](_0xac4a('0x86'),0x193);}_0x52df82=_0x25bf23;return db[_0xac4a('0x68')][_0xac4a('0x42')]({'raw':!![]});}return null;})[_0xac4a('0x25')](function(_0x5bb911){if(_0x5bb911){_0x59e82c=_[_0xac4a('0x69')](_0x5bb911,'id');var _0x403f5a;var _0x3eae2f=squel[_0xac4a('0x6a')]();_0x3eae2f[_0xac4a('0x6b')](_0x2b6773[_0xac4a('0x6c')]);for(var _0x4a0cd9=0x0;_0x4a0cd9<_0x52df82['length'];_0x4a0cd9+=0x1){_0x403f5a=_0x52df82[_0x4a0cd9][_0xac4a('0x6d')]?_0x59e82c[_0x52df82[_0x4a0cd9][_0xac4a('0x6d')]][_0xac4a('0x6e')]:_0x52df82[_0x4a0cd9][_0xac4a('0x64')];_0x403f5a=_0x52df82[_0x4a0cd9][_0xac4a('0x6f')]?_[_0xac4a('0x70')](_0xcad25d[_0x52df82[_0x4a0cd9]['function']],'%s',_0x403f5a):_0x403f5a;_0x403f5a=_0x52df82[_0x4a0cd9][_0xac4a('0x71')]?_['replace'](_0xcd140e[_0x52df82[_0x4a0cd9][_0xac4a('0x71')]],'%s',_0x403f5a):_0x403f5a;if(_0x52df82[_0x4a0cd9]['groupBy']){_0x3eae2f[_0xac4a('0x63')](_0x403f5a);}_0x52df82[_0x4a0cd9][_0xac4a('0x72')]&&_0x3eae2f[_0xac4a('0x38')](_0x403f5a,_0x52df82[_0x4a0cd9][_0xac4a('0x72')]==='DESC'?![]:!![]);_0x3eae2f[_0xac4a('0x64')](_0x403f5a,_0x52df82[_0x4a0cd9][_0xac4a('0x88')]||_0x403f5a);}if(_0x2b6773[_0xac4a('0x73')]){_0x2b6773[_0xac4a('0x73')]=JSON[_0xac4a('0x78')](_0x2b6773['joins']);for(var _0x3dd60a=0x0;_0x3dd60a<_0x2b6773[_0xac4a('0x73')][_0xac4a('0x46')];_0x3dd60a+=0x1){if(_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x2e')]&&_['includes'](_0x4301c3,_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x2e')])&&_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x74')]&&_0x2b6773[_0xac4a('0x73')][_0x3dd60a]['foreignTable']&&_0x2b6773['joins'][_0x3dd60a]['foreignKey']){_0x3eae2f[_0x2b6773['joins'][_0x3dd60a][_0xac4a('0x2e')]](_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x75')],null,util[_0xac4a('0x71')](_0xac4a('0x76'),_0x2b6773['table'],_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x74')],_0x2b6773['joins'][_0x3dd60a][_0xac4a('0x75')],_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x8a')]));}}}if(_0x2b6773['conditions']){_0x2b6773[_0xac4a('0x77')]=JSON[_0xac4a('0x78')](_0x2b6773[_0xac4a('0x77')]);_0x3eae2f[_0xac4a('0x3a')](_0x41cdb5(_0x2b6773[_0xac4a('0x77')][_0xac4a('0x63')]));}_0x52963c=_0x3eae2f[_0xac4a('0x79')]();_0x3eae2f[_0xac4a('0x1d')](_0x63c30);_0x3eae2f[_0xac4a('0x1b')](0x0);logger['debug'](_0xac4a('0x7a'),_0x3eae2f[_0xac4a('0x7b')]());return dbH['sequelize'][_0xac4a('0x31')](_0x3eae2f['toString'](),{'type':dbH[_0xac4a('0x7c')][_0xac4a('0x7d')]['SELECT']});}})[_0xac4a('0x25')](function(){return{'sql':_0x52963c[_0xac4a('0x7b')]()};})[_0xac4a('0x25')](respondWithResult(_0x538cfd,null))[_0xac4a('0x44')](handleError(_0x538cfd,null));}; \ No newline at end of file +var _0x6d38=['Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','select','countTable','COUNT(*)','sequelize','run','SEC_TO_TIME(%s)','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','limit','count','Content-Range','save','update','then','get','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','AnalyticDefaultReport','findAll','rows','show','keys','fields','find','catch','create','body','user','role','Reports','autoAssociation','UserProfileResource','DefaultReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20EMPTY','rules','operator','group','field','condition','value','getFields','ValidationErrorItem','AnalyticMetric','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','debug','toString','QueryTypes','SELECT','left_join','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','DESC','%s.%s\x20=\x20%s.%s','output','web','fullPath','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','startDate','endDate','info'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x6d38,0x1ef));var _0x86d3=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x6d38[_0x173441];return _0x2423a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x86d3('0x0'));var zipdir=require(_0x86d3('0x1'));var jsonpatch=require(_0x86d3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x86d3('0x3'));var Mustache=require('mustache');var util=require(_0x86d3('0x4'));var path=require(_0x86d3('0x5'));var sox=require(_0x86d3('0x6'));var csv=require('to-csv');var ejs=require(_0x86d3('0x7'));var fs=require('fs');var fs_extra=require(_0x86d3('0x8'));var _=require(_0x86d3('0x9'));var squel=require(_0x86d3('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x86d3('0xb'));var toCsv=require(_0x86d3('0xc'));var querystring=require(_0x86d3('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x86d3('0xe'));var qs=require(_0x86d3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x86d3('0x10'))(_0x86d3('0x11'));var utils=require('../../config/utils');var config=require(_0x86d3('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x86d3('0x13'))['db'];var dbH=require(_0x86d3('0x13'))[_0x86d3('0x14')];function respondWithStatusCode(_0x26d64c,_0xe1b3d7){_0xe1b3d7=_0xe1b3d7||0xcc;return function(_0x1b8d0a){if(_0x1b8d0a){return _0x26d64c[_0x86d3('0x15')](_0xe1b3d7);}return _0x26d64c[_0x86d3('0x16')](_0xe1b3d7)['end']();};}function respondWithResult(_0x1c1ba8,_0x1f35cf){_0x1f35cf=_0x1f35cf||0xc8;return function(_0x356e7d){if(_0x356e7d){return _0x1c1ba8[_0x86d3('0x16')](_0x1f35cf)[_0x86d3('0x17')](_0x356e7d);}};}function respondWithFilteredResult(_0x34fb3b,_0x1ff008){return function(_0x44436d){if(_0x44436d){var _0x53b437=typeof _0x1ff008[_0x86d3('0x18')]===_0x86d3('0x19')&&typeof _0x1ff008[_0x86d3('0x1a')]===_0x86d3('0x19');var _0x46feec=_0x44436d[_0x86d3('0x1b')];var _0x33e459=_0x53b437?0x0:_0x1ff008[_0x86d3('0x18')];var _0x9b76f2=_0x53b437?_0x44436d['count']:_0x1ff008[_0x86d3('0x18')]+_0x1ff008['limit'];var _0x6ced9e;if(_0x9b76f2>=_0x46feec){_0x9b76f2=_0x46feec;_0x6ced9e=0xc8;}else{_0x6ced9e=0xce;}_0x34fb3b['status'](_0x6ced9e);return _0x34fb3b['set'](_0x86d3('0x1c'),_0x33e459+'-'+_0x9b76f2+'/'+_0x46feec)[_0x86d3('0x17')](_0x44436d);}return null;};}function patchUpdates(_0x988066){return function(_0x1720ae){try{jsonpatch['apply'](_0x1720ae,_0x988066,!![]);}catch(_0x2901de){return BPromise['reject'](_0x2901de);}return _0x1720ae[_0x86d3('0x1d')]();};}function saveUpdates(_0x3fdf67,_0x1ce849){return function(_0x5b990d){if(_0x5b990d){return _0x5b990d[_0x86d3('0x1e')](_0x3fdf67)[_0x86d3('0x1f')](function(_0x1fa4ac){return _0x1fa4ac;});}return null;};}function removeEntity(_0x4bf5b8,_0x58ba51){return function(_0x26262a){if(_0x26262a){return _0x26262a['destroy']()[_0x86d3('0x1f')](function(){var _0x1bea5e=_0x26262a[_0x86d3('0x20')]({'plain':!![]});var _0x3c5fe4='DefaultReports';return db['UserProfileResource'][_0x86d3('0x21')]({'where':{'type':_0x3c5fe4,'resourceId':_0x1bea5e['id']}})[_0x86d3('0x1f')](function(){return _0x26262a;});})['then'](function(){_0x4bf5b8[_0x86d3('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42413c,_0x41e2f0){return function(_0x287b96){if(!_0x287b96){_0x42413c[_0x86d3('0x15')](0x194);}return _0x287b96;};}function handleError(_0x11a6fd,_0x14c9ff){_0x14c9ff=_0x14c9ff||0x1f4;return function(_0x1f203e){logger[_0x86d3('0x22')](_0x1f203e[_0x86d3('0x23')]);if(_0x1f203e[_0x86d3('0x24')]){delete _0x1f203e[_0x86d3('0x24')];}_0x11a6fd[_0x86d3('0x16')](_0x14c9ff)[_0x86d3('0x25')](_0x1f203e);};}exports[_0x86d3('0x26')]=function(_0x5b09f6,_0x120a0c){var _0x403be3={},_0x2bda35={},_0x31cefe={'count':0x0,'rows':[]};var _0x7709f0=_[_0x86d3('0x27')](db['AnalyticDefaultReport'][_0x86d3('0x28')],function(_0x5c71df){return{'name':_0x5c71df['fieldName'],'type':_0x5c71df[_0x86d3('0x29')][_0x86d3('0x2a')]};});_0x2bda35[_0x86d3('0x2b')]=_['map'](_0x7709f0,_0x86d3('0x24'));_0x2bda35[_0x86d3('0x2c')]=_['keys'](_0x5b09f6[_0x86d3('0x2c')]);_0x2bda35[_0x86d3('0x2d')]=_[_0x86d3('0x2e')](_0x2bda35[_0x86d3('0x2b')],_0x2bda35[_0x86d3('0x2c')]);_0x403be3[_0x86d3('0x2f')]=_[_0x86d3('0x2e')](_0x2bda35[_0x86d3('0x2b')],qs['fields'](_0x5b09f6['query']['fields']));_0x403be3[_0x86d3('0x2f')]=_0x403be3['attributes'][_0x86d3('0x30')]?_0x403be3['attributes']:_0x2bda35[_0x86d3('0x2b')];if(!_0x5b09f6[_0x86d3('0x2c')][_0x86d3('0x31')](_0x86d3('0x32'))){_0x403be3[_0x86d3('0x1a')]=qs[_0x86d3('0x1a')](_0x5b09f6[_0x86d3('0x2c')]['limit']);_0x403be3[_0x86d3('0x18')]=qs[_0x86d3('0x18')](_0x5b09f6['query'][_0x86d3('0x18')]);}_0x403be3[_0x86d3('0x33')]=qs[_0x86d3('0x34')](_0x5b09f6[_0x86d3('0x2c')]['sort']);_0x403be3[_0x86d3('0x35')]=qs[_0x86d3('0x2d')](_[_0x86d3('0x36')](_0x5b09f6['query'],_0x2bda35[_0x86d3('0x2d')]),_0x7709f0);if(_0x5b09f6[_0x86d3('0x2c')][_0x86d3('0x37')]){_0x403be3[_0x86d3('0x35')]=_[_0x86d3('0x38')](_0x403be3[_0x86d3('0x35')],{'$or':_[_0x86d3('0x27')](_0x7709f0,function(_0x436065){if(_0x436065['type']!==_0x86d3('0x39')){var _0x470978={};_0x470978[_0x436065[_0x86d3('0x24')]]={'$like':'%'+_0x5b09f6[_0x86d3('0x2c')]['filter']+'%'};return _0x470978;}})});}_0x403be3=_[_0x86d3('0x38')]({},_0x403be3,_0x5b09f6[_0x86d3('0x3a')]);var _0x6f72be={'where':_0x403be3[_0x86d3('0x35')]};return db['AnalyticDefaultReport']['count'](_0x6f72be)[_0x86d3('0x1f')](function(_0x4f422b){_0x31cefe['count']=_0x4f422b;if(_0x5b09f6[_0x86d3('0x2c')][_0x86d3('0x3b')]){_0x403be3[_0x86d3('0x3c')]=[{'all':!![]}];}return db[_0x86d3('0x3d')][_0x86d3('0x3e')](_0x403be3);})['then'](function(_0x2a5f6c){_0x31cefe[_0x86d3('0x3f')]=_0x2a5f6c;return _0x31cefe;})[_0x86d3('0x1f')](respondWithFilteredResult(_0x120a0c,_0x403be3))['catch'](handleError(_0x120a0c,null));};exports[_0x86d3('0x40')]=function(_0x810d10,_0x5dfae8){var _0x369f68={'raw':!![],'where':{'id':_0x810d10['params']['id']}},_0xcf6c9e={};_0xcf6c9e['model']=_['keys'](db[_0x86d3('0x3d')][_0x86d3('0x28')]);_0xcf6c9e[_0x86d3('0x2c')]=_[_0x86d3('0x41')](_0x810d10[_0x86d3('0x2c')]);_0xcf6c9e[_0x86d3('0x2d')]=_['intersection'](_0xcf6c9e[_0x86d3('0x2b')],_0xcf6c9e[_0x86d3('0x2c')]);_0x369f68['attributes']=_[_0x86d3('0x2e')](_0xcf6c9e[_0x86d3('0x2b')],qs[_0x86d3('0x42')](_0x810d10[_0x86d3('0x2c')][_0x86d3('0x42')]));_0x369f68[_0x86d3('0x2f')]=_0x369f68['attributes'][_0x86d3('0x30')]?_0x369f68[_0x86d3('0x2f')]:_0xcf6c9e['model'];if(_0x810d10[_0x86d3('0x2c')][_0x86d3('0x3b')]){_0x369f68[_0x86d3('0x3c')]=[{'all':!![]}];}_0x369f68=_[_0x86d3('0x38')]({},_0x369f68,_0x810d10[_0x86d3('0x3a')]);return db['AnalyticDefaultReport'][_0x86d3('0x43')](_0x369f68)[_0x86d3('0x1f')](handleEntityNotFound(_0x5dfae8,null))[_0x86d3('0x1f')](respondWithResult(_0x5dfae8,null))[_0x86d3('0x44')](handleError(_0x5dfae8,null));};exports[_0x86d3('0x45')]=function(_0x7af7b3,_0x1a4345){return db[_0x86d3('0x3d')][_0x86d3('0x45')](_0x7af7b3[_0x86d3('0x46')],{})[_0x86d3('0x1f')](function(_0x1236ea){var _0x4ea940=_0x7af7b3[_0x86d3('0x47')][_0x86d3('0x20')]({'plain':!![]});if(!_0x4ea940)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ea940[_0x86d3('0x48')]===_0x86d3('0x47')){var _0x197047=_0x1236ea[_0x86d3('0x20')]({'plain':!![]});var _0x1dcff0=_0x86d3('0x49');return db['UserProfileSection']['find']({'where':{'name':_0x1dcff0,'userProfileId':_0x4ea940['userProfileId']},'raw':!![]})['then'](function(_0x159253){if(_0x159253&&_0x159253[_0x86d3('0x4a')]===0x0){return db[_0x86d3('0x4b')][_0x86d3('0x45')]({'name':_0x197047[_0x86d3('0x24')],'resourceId':_0x197047['id'],'type':_0x86d3('0x4c'),'sectionId':_0x159253['id']},{})[_0x86d3('0x1f')](function(){return _0x1236ea;});}else{return _0x1236ea;}})['catch'](function(_0x2afb07){logger[_0x86d3('0x22')](_0x86d3('0x4d'),_0x2afb07);throw _0x2afb07;});}return _0x1236ea;})[_0x86d3('0x1f')](respondWithResult(_0x1a4345,0xc9))[_0x86d3('0x44')](handleError(_0x1a4345,null));};exports[_0x86d3('0x1e')]=function(_0x34935f,_0x4c8828){if(_0x34935f[_0x86d3('0x46')]['id']){delete _0x34935f['body']['id'];}return db[_0x86d3('0x3d')][_0x86d3('0x43')]({'where':{'id':_0x34935f[_0x86d3('0x4e')]['id']}})[_0x86d3('0x1f')](handleEntityNotFound(_0x4c8828,null))[_0x86d3('0x1f')](saveUpdates(_0x34935f['body'],null))[_0x86d3('0x1f')](respondWithResult(_0x4c8828,null))[_0x86d3('0x44')](handleError(_0x4c8828,null));};exports[_0x86d3('0x21')]=function(_0x4e10d9,_0x4ad164){return db['AnalyticDefaultReport'][_0x86d3('0x43')]({'where':{'id':_0x4e10d9['params']['id']}})[_0x86d3('0x1f')](handleEntityNotFound(_0x4ad164,null))[_0x86d3('0x1f')](removeEntity(_0x4ad164,null))[_0x86d3('0x44')](handleError(_0x4ad164,null));};exports[_0x86d3('0x4f')]=function(_0x5963bb,_0x4cd835){var _0x551806=0xa;var _0x28655a=[_0x86d3('0x50'),'left_join',_0x86d3('0x51'),_0x86d3('0x52')];var _0xa085b2={'SUM':_0x86d3('0x53'),'COUNT':_0x86d3('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x86d3('0x55'),'MIN':_0x86d3('0x56'),'AVG':_0x86d3('0x57'),'GROUP_CONCAT':_0x86d3('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x86d3('0x59')};var _0x41fad7={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x86d3('0x5a'),'HOUR':_0x86d3('0x5b'),'ROUND':_0x86d3('0x5c'),'UNIX_TIMESTAMP':_0x86d3('0x5d')};var _0x4598d4=function(_0x4029a4){return!_[_0x86d3('0x5e')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x86d3('0x5f'),'IS\x20NOT\x20EMPTY'],_0x4029a4);};var _0x528ca8=function(_0x58e4b6){if(!_0x58e4b6||!_0x58e4b6[_0x86d3('0x60')]['length']){return'';}for(var _0x254ac3='(',_0x5f2ed6=0x0;_0x5f2ed6<_0x58e4b6[_0x86d3('0x60')][_0x86d3('0x30')];_0x5f2ed6+=0x1){_0x5f2ed6>0x0&&(_0x254ac3+='\x20'+_0x58e4b6[_0x86d3('0x61')]+'\x20');_0x254ac3+=_0x58e4b6['rules'][_0x5f2ed6]['group']?_0x528ca8(_0x58e4b6[_0x86d3('0x60')][_0x5f2ed6][_0x86d3('0x62')]):_0x58e4b6[_0x86d3('0x60')][_0x5f2ed6][_0x86d3('0x63')]+'\x20'+_0x58e4b6[_0x86d3('0x60')][_0x5f2ed6][_0x86d3('0x64')]+(_0x4598d4(_0x58e4b6[_0x86d3('0x60')][_0x5f2ed6][_0x86d3('0x64')])?'\x20'+_0x58e4b6[_0x86d3('0x60')][_0x5f2ed6][_0x86d3('0x65')]:'');}return _0x254ac3+')';};var _0x1e3479={'where':{'id':_0x5963bb[_0x86d3('0x4e')]['id']}},_0x265beb,_0xfaf168,_0xf0dbbb,_0x3f978c,_0x5e1835;_0x1e3479=_[_0x86d3('0x38')]({},_0x1e3479,_0x5963bb['options']);return db[_0x86d3('0x3d')][_0x86d3('0x43')](_0x1e3479)[_0x86d3('0x1f')](function(_0x52dc99){if(_0x52dc99){_0x265beb=_0x52dc99;return _0x52dc99[_0x86d3('0x66')]();}return null;})[_0x86d3('0x1f')](function(_0x45e8d9){if(_0x45e8d9){if(!_0x45e8d9[_0x86d3('0x30')]){throw new db['Sequelize'][(_0x86d3('0x67'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xfaf168=_0x45e8d9;return db[_0x86d3('0x68')][_0x86d3('0x3e')]({'raw':!![]});}return null;})[_0x86d3('0x1f')](function(_0x2d4bc1){if(_0x2d4bc1){_0xf0dbbb=_[_0x86d3('0x69')](_0x2d4bc1,'id');var _0x56fd96;var _0x3cc1d8=squel['select']();_0x3cc1d8[_0x86d3('0x6a')](_0x265beb[_0x86d3('0x6b')]);for(var _0x5866fe=0x0;_0x5866fe<_0xfaf168[_0x86d3('0x30')];_0x5866fe+=0x1){_0x56fd96=_0xfaf168[_0x5866fe][_0x86d3('0x6c')]?_0xf0dbbb[_0xfaf168[_0x5866fe][_0x86d3('0x6c')]][_0x86d3('0x6d')]:_0xfaf168[_0x5866fe][_0x86d3('0x63')];_0x56fd96=_0xfaf168[_0x5866fe][_0x86d3('0x6e')]?_[_0x86d3('0x6f')](_0xa085b2[_0xfaf168[_0x5866fe]['function']],'%s',_0x56fd96):_0x56fd96;_0x56fd96=_0xfaf168[_0x5866fe][_0x86d3('0x70')]?_[_0x86d3('0x6f')](_0x41fad7[_0xfaf168[_0x5866fe][_0x86d3('0x70')]],'%s',_0x56fd96):_0x56fd96;if(_0xfaf168[_0x5866fe][_0x86d3('0x71')]){_0x3cc1d8[_0x86d3('0x62')](_0x56fd96);}_0xfaf168[_0x5866fe]['orderBy']&&_0x3cc1d8[_0x86d3('0x33')](_0x56fd96,_0xfaf168[_0x5866fe][_0x86d3('0x72')]==='DESC'?![]:!![]);_0x3cc1d8[_0x86d3('0x63')](_0x56fd96,_0xfaf168[_0x5866fe][_0x86d3('0x73')]||_0x56fd96);}if(_0x265beb[_0x86d3('0x74')]){_0x265beb[_0x86d3('0x74')]=JSON[_0x86d3('0x75')](_0x265beb[_0x86d3('0x74')]);for(var _0x1bf5ba=0x0;_0x1bf5ba<_0x265beb[_0x86d3('0x74')][_0x86d3('0x30')];_0x1bf5ba+=0x1){if(_0x265beb[_0x86d3('0x74')][_0x1bf5ba][_0x86d3('0x29')]&&_[_0x86d3('0x5e')](_0x28655a,_0x265beb[_0x86d3('0x74')][_0x1bf5ba][_0x86d3('0x29')])&&_0x265beb['joins'][_0x1bf5ba][_0x86d3('0x76')]&&_0x265beb[_0x86d3('0x74')][_0x1bf5ba][_0x86d3('0x77')]&&_0x265beb[_0x86d3('0x74')][_0x1bf5ba]['foreignKey']){_0x3cc1d8[_0x265beb[_0x86d3('0x74')][_0x1bf5ba][_0x86d3('0x29')]](_0x265beb[_0x86d3('0x74')][_0x1bf5ba][_0x86d3('0x77')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x265beb[_0x86d3('0x6b')],_0x265beb['joins'][_0x1bf5ba][_0x86d3('0x76')],_0x265beb['joins'][_0x1bf5ba]['foreignTable'],_0x265beb[_0x86d3('0x74')][_0x1bf5ba][_0x86d3('0x78')]));}}}if(_0x265beb[_0x86d3('0x79')]){_0x265beb[_0x86d3('0x79')]=JSON[_0x86d3('0x75')](_0x265beb['conditions']);_0x3cc1d8[_0x86d3('0x35')](_0x528ca8(_0x265beb[_0x86d3('0x79')]['group']));}_0x5e1835=_0x3cc1d8[_0x86d3('0x7a')]();_0x3cc1d8[_0x86d3('0x1a')](_0x551806);_0x3cc1d8['offset'](0x0);logger[_0x86d3('0x7b')]('Limited\x20Query:',_0x3cc1d8[_0x86d3('0x7c')]());return dbH['sequelize']['query'](_0x3cc1d8[_0x86d3('0x7c')](),{'type':dbH['sequelize'][_0x86d3('0x7d')][_0x86d3('0x7e')]});}})[_0x86d3('0x1f')](respondWithResult(_0x4cd835,null))[_0x86d3('0x44')](handleError(_0x4cd835,null));};function runReport(_0x3193d5,_0x3a1acc,_0x268c93){var _0x3b989c=_0x3a1acc['name'];var _0x245b39=0xa;var _0x158f56=[_0x86d3('0x50'),_0x86d3('0x7f'),_0x86d3('0x51'),'cross_join'];var _0x3d8b35={'SUM':_0x86d3('0x53'),'COUNT':_0x86d3('0x54'),'COUNT DISTINCT':_0x86d3('0x80'),'MAX':_0x86d3('0x55'),'MIN':_0x86d3('0x56'),'AVG':_0x86d3('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x86d3('0x81'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xca2e0={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x86d3('0x5b'),'ROUND':_0x86d3('0x5c'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1b503a=function(_0x24410c){return!_[_0x86d3('0x5e')]([_0x86d3('0x82'),_0x86d3('0x83'),_0x86d3('0x5f'),_0x86d3('0x84')],_0x24410c);};var _0x5f4a38=function(_0x593b85){if(!_0x593b85||!_0x593b85[_0x86d3('0x60')][_0x86d3('0x30')]){return'';}for(var _0x3fac94='(',_0x28d98e=0x0;_0x28d98e<_0x593b85[_0x86d3('0x60')][_0x86d3('0x30')];_0x28d98e+=0x1){_0x28d98e>0x0&&(_0x3fac94+='\x20'+_0x593b85['operator']+'\x20');_0x3fac94+=_0x593b85[_0x86d3('0x60')][_0x28d98e][_0x86d3('0x62')]?_0x5f4a38(_0x593b85[_0x86d3('0x60')][_0x28d98e][_0x86d3('0x62')]):_0x593b85[_0x86d3('0x60')][_0x28d98e][_0x86d3('0x63')]+'\x20'+_0x593b85[_0x86d3('0x60')][_0x28d98e][_0x86d3('0x64')]+(_0x1b503a(_0x593b85[_0x86d3('0x60')][_0x28d98e]['condition'])?'\x20'+_0x593b85[_0x86d3('0x60')][_0x28d98e][_0x86d3('0x65')]:'');}return _0x3fac94+')';};var _0x4b871b={'where':{'id':_0x3193d5['id']}},_0x584a57,_0x36ee46,_0x1cbc3a,_0x682a6d,_0x5004cd;_0x4b871b=_[_0x86d3('0x38')]({},_0x4b871b,_0x268c93);return db[_0x86d3('0x3d')][_0x86d3('0x43')](_0x4b871b)[_0x86d3('0x1f')](function(_0x3d3e7f){if(_0x3d3e7f){_0x584a57=_0x3d3e7f;return _0x3d3e7f['getFields']();}return null;})[_0x86d3('0x1f')](function(_0x1aaf08){if(_0x1aaf08){if(!_0x1aaf08['length']){throw new db[(_0x86d3('0x85'))][(_0x86d3('0x67'))](_0x86d3('0x86'),0x193);}_0x36ee46=_0x1aaf08;return db[_0x86d3('0x68')]['findAll']({'raw':!![]});}return null;})[_0x86d3('0x1f')](function(_0x2896e1){if(_0x2896e1){_0x1cbc3a=_[_0x86d3('0x69')](_0x2896e1,'id');var _0x18295c;var _0x44af1c=squel['select']();_0x44af1c[_0x86d3('0x6a')](_0x584a57[_0x86d3('0x6b')]);for(var _0x3582a2=0x0;_0x3582a2<_0x36ee46[_0x86d3('0x30')];_0x3582a2+=0x1){_0x18295c=_0x36ee46[_0x3582a2][_0x86d3('0x6c')]?_0x1cbc3a[_0x36ee46[_0x3582a2][_0x86d3('0x6c')]][_0x86d3('0x6d')]:_0x36ee46[_0x3582a2][_0x86d3('0x63')];_0x18295c=_0x36ee46[_0x3582a2][_0x86d3('0x6e')]?_[_0x86d3('0x6f')](_0x3d8b35[_0x36ee46[_0x3582a2]['function']],'%s',_0x18295c):_0x18295c;_0x18295c=_0x36ee46[_0x3582a2]['format']?_[_0x86d3('0x6f')](_0xca2e0[_0x36ee46[_0x3582a2][_0x86d3('0x70')]],'%s',_0x18295c):_0x18295c;if(_0x36ee46[_0x3582a2]['groupBy']){_0x44af1c[_0x86d3('0x62')](_0x18295c);}_0x36ee46[_0x3582a2][_0x86d3('0x72')]&&_0x44af1c[_0x86d3('0x33')](_0x18295c,_0x36ee46[_0x3582a2][_0x86d3('0x72')]===_0x86d3('0x87')?![]:!![]);_0x44af1c[_0x86d3('0x63')](_0x18295c,_0x36ee46[_0x3582a2][_0x86d3('0x73')]||_0x18295c);}if(_0x584a57[_0x86d3('0x74')]){_0x584a57[_0x86d3('0x74')]=JSON['parse'](_0x584a57['joins']);for(var _0x48a6d7=0x0;_0x48a6d7<_0x584a57['joins'][_0x86d3('0x30')];_0x48a6d7+=0x1){if(_0x584a57[_0x86d3('0x74')][_0x48a6d7][_0x86d3('0x29')]&&_[_0x86d3('0x5e')](_0x158f56,_0x584a57[_0x86d3('0x74')][_0x48a6d7][_0x86d3('0x29')])&&_0x584a57[_0x86d3('0x74')][_0x48a6d7]['parentKey']&&_0x584a57[_0x86d3('0x74')][_0x48a6d7][_0x86d3('0x77')]&&_0x584a57[_0x86d3('0x74')][_0x48a6d7][_0x86d3('0x78')]){_0x44af1c[_0x584a57['joins'][_0x48a6d7][_0x86d3('0x29')]](_0x584a57['joins'][_0x48a6d7][_0x86d3('0x77')],null,util[_0x86d3('0x70')](_0x86d3('0x88'),_0x584a57[_0x86d3('0x6b')],_0x584a57[_0x86d3('0x74')][_0x48a6d7]['parentKey'],_0x584a57['joins'][_0x48a6d7][_0x86d3('0x77')],_0x584a57['joins'][_0x48a6d7][_0x86d3('0x78')]));}}}if(_0x584a57['conditions']){_0x584a57[_0x86d3('0x79')]=JSON['parse'](_0x584a57['conditions']);_0x44af1c[_0x86d3('0x35')](_0x5f4a38(_0x584a57[_0x86d3('0x79')][_0x86d3('0x62')]));}_0x5004cd=_0x44af1c[_0x86d3('0x7a')]();_0x44af1c[_0x86d3('0x1a')](_0x245b39);_0x44af1c[_0x86d3('0x18')](0x0);return;}})[_0x86d3('0x1f')](function(){if(_0x3a1acc[_0x86d3('0x89')]===_0x86d3('0x8a')){return null;}var _0x120a85=_[_0x86d3('0x38')](_0x3a1acc,{'name':_0x3a1acc[_0x86d3('0x8b')]||_0x3a1acc[_0x86d3('0x24')]||_0x584a57[_0x86d3('0x24')],'basename':_0x3b989c,'savename':util[_0x86d3('0x70')]('%s-%s.%s',_0x3a1acc['name']||_0x584a57['name'],require(_0x86d3('0x8c'))[_0x86d3('0x8d')](0x4),_0x3a1acc[_0x86d3('0x89')]||_0x86d3('0x8e')),'reportId':_0x584a57['id'],'reportType':_0x86d3('0x8f')});return db[_0x86d3('0x90')][_0x86d3('0x45')](_0x120a85,{'raw':!![]});})[_0x86d3('0x1f')](function(_0x10e23d){if(_0x584a57[_0x86d3('0x6b')]===_0x86d3('0x91')){_0x5004cd['where'](_0x584a57[_0x86d3('0x6b')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x3a1acc[_0x86d3('0x92')],_0x3a1acc[_0x86d3('0x93')]);}else{_0x5004cd[_0x86d3('0x35')](_0x584a57[_0x86d3('0x6b')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3a1acc[_0x86d3('0x92')],_0x3a1acc[_0x86d3('0x93')]);}if(_0x10e23d){logger[_0x86d3('0x94')](_0x86d3('0x95'),_0x5004cd[_0x86d3('0x7c')]());require(_0x86d3('0x96'))[_0x86d3('0x97')](path[_0x86d3('0x50')](__dirname,_0x86d3('0x98'),_0x10e23d[_0x86d3('0x89')]),[_0x10e23d['id'],_0x5004cd[_0x86d3('0x7c')](),path[_0x86d3('0x50')](__dirname,_0x86d3('0x99'),_0x10e23d[_0x86d3('0x9a')]),_0x3b989c]);return _0x10e23d;}else{var _0x428b11=squel[_0x86d3('0x9b')]();_0x428b11[_0x86d3('0x6a')]('('+_0x5004cd['toString']()+')',_0x86d3('0x9c'));_0x428b11[_0x86d3('0x63')](_0x86d3('0x9d'),_0x86d3('0x1b'));_0x5004cd['limit'](_0x3a1acc[_0x86d3('0x1a')]||_0x245b39);_0x5004cd['offset'](_0x3a1acc['offset']||0x0);return dbH[_0x86d3('0x9e')][_0x86d3('0x2c')](_0x428b11[_0x86d3('0x7c')](),{'type':dbH[_0x86d3('0x9e')][_0x86d3('0x7d')][_0x86d3('0x7e')]})[_0x86d3('0x1f')](function(_0x4777f1){if(!_0x4777f1['length']){_0x682a6d=0x0;}else{_0x682a6d=_0x4777f1[0x0]['count']||0x0;}return dbH['sequelize'][_0x86d3('0x2c')](_0x5004cd[_0x86d3('0x7c')](),{'type':dbH[_0x86d3('0x9e')]['QueryTypes'][_0x86d3('0x7e')]});})['then'](function(_0x435b8e){return{'rows':_0x435b8e||[],'count':_0x682a6d};});}});}exports[_0x86d3('0x9f')]=function(_0x73b8e6,_0x2c98e1){return runReport(_0x73b8e6['params'],_0x73b8e6[_0x86d3('0x2c')],_0x73b8e6[_0x86d3('0x3a')])[_0x86d3('0x1f')](respondWithResult(_0x2c98e1,null))['catch'](handleError(_0x2c98e1,null));};exports['runReport']=runReport;exports['query']=function(_0x458997,_0x1e3559){var _0x49a101=0xa;var _0x38d724=['join',_0x86d3('0x7f'),_0x86d3('0x51'),_0x86d3('0x52')];var _0x56ff91={'SUM':_0x86d3('0x53'),'COUNT':_0x86d3('0x54'),'COUNT DISTINCT':_0x86d3('0x80'),'MAX':_0x86d3('0x55'),'MIN':_0x86d3('0x56'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x86d3('0x58'),'GROUP_CONCAT ASC':_0x86d3('0x81'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1f347e={'SEC_TO_TIME':_0x86d3('0xa0'),'DATE':'DATE(%s)','HOUR':_0x86d3('0x5b'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x45b210=function(_0x144e43){return!_[_0x86d3('0x5e')]([_0x86d3('0x82'),_0x86d3('0x83'),_0x86d3('0x5f'),_0x86d3('0x84')],_0x144e43);};var _0xdc7c21=function(_0x2e0397){if(!_0x2e0397||!_0x2e0397[_0x86d3('0x60')][_0x86d3('0x30')]){return'';}for(var _0x2cc617='(',_0x25339c=0x0;_0x25339c<_0x2e0397['rules'][_0x86d3('0x30')];_0x25339c+=0x1){_0x25339c>0x0&&(_0x2cc617+='\x20'+_0x2e0397[_0x86d3('0x61')]+'\x20');_0x2cc617+=_0x2e0397[_0x86d3('0x60')][_0x25339c][_0x86d3('0x62')]?_0xdc7c21(_0x2e0397[_0x86d3('0x60')][_0x25339c][_0x86d3('0x62')]):_0x2e0397['rules'][_0x25339c][_0x86d3('0x63')]+'\x20'+_0x2e0397['rules'][_0x25339c][_0x86d3('0x64')]+(_0x45b210(_0x2e0397[_0x86d3('0x60')][_0x25339c]['condition'])?'\x20'+_0x2e0397['rules'][_0x25339c][_0x86d3('0x65')]:'');}return _0x2cc617+')';};var _0x2c0070={'where':{'id':_0x458997[_0x86d3('0x4e')]['id']}},_0x31d436,_0x56e713,_0x525559,_0x3b9e1e,_0x1d8d7c;_0x2c0070=_['merge']({},_0x2c0070,_0x458997[_0x86d3('0x3a')]);return db[_0x86d3('0x3d')][_0x86d3('0x43')](_0x2c0070)[_0x86d3('0x1f')](function(_0x1f80be){if(_0x1f80be){_0x31d436=_0x1f80be;return _0x1f80be[_0x86d3('0x66')]();}return null;})[_0x86d3('0x1f')](function(_0x3dddbe){if(_0x3dddbe){if(!_0x3dddbe[_0x86d3('0x30')]){throw new db[(_0x86d3('0x85'))][(_0x86d3('0x67'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x56e713=_0x3dddbe;return db[_0x86d3('0x68')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x1d7e83){if(_0x1d7e83){_0x525559=_[_0x86d3('0x69')](_0x1d7e83,'id');var _0x5d9385;var _0x49a499=squel[_0x86d3('0x9b')]();_0x49a499[_0x86d3('0x6a')](_0x31d436[_0x86d3('0x6b')]);for(var _0x33e0a5=0x0;_0x33e0a5<_0x56e713['length'];_0x33e0a5+=0x1){_0x5d9385=_0x56e713[_0x33e0a5][_0x86d3('0x6c')]?_0x525559[_0x56e713[_0x33e0a5][_0x86d3('0x6c')]][_0x86d3('0x6d')]:_0x56e713[_0x33e0a5][_0x86d3('0x63')];_0x5d9385=_0x56e713[_0x33e0a5][_0x86d3('0x6e')]?_['replace'](_0x56ff91[_0x56e713[_0x33e0a5][_0x86d3('0x6e')]],'%s',_0x5d9385):_0x5d9385;_0x5d9385=_0x56e713[_0x33e0a5][_0x86d3('0x70')]?_[_0x86d3('0x6f')](_0x1f347e[_0x56e713[_0x33e0a5]['format']],'%s',_0x5d9385):_0x5d9385;if(_0x56e713[_0x33e0a5][_0x86d3('0x71')]){_0x49a499['group'](_0x5d9385);}_0x56e713[_0x33e0a5][_0x86d3('0x72')]&&_0x49a499[_0x86d3('0x33')](_0x5d9385,_0x56e713[_0x33e0a5]['orderBy']===_0x86d3('0x87')?![]:!![]);_0x49a499[_0x86d3('0x63')](_0x5d9385,_0x56e713[_0x33e0a5][_0x86d3('0x73')]||_0x5d9385);}if(_0x31d436[_0x86d3('0x74')]){_0x31d436[_0x86d3('0x74')]=JSON[_0x86d3('0x75')](_0x31d436['joins']);for(var _0x10af91=0x0;_0x10af91<_0x31d436['joins'][_0x86d3('0x30')];_0x10af91+=0x1){if(_0x31d436[_0x86d3('0x74')][_0x10af91][_0x86d3('0x29')]&&_[_0x86d3('0x5e')](_0x38d724,_0x31d436['joins'][_0x10af91][_0x86d3('0x29')])&&_0x31d436[_0x86d3('0x74')][_0x10af91][_0x86d3('0x76')]&&_0x31d436[_0x86d3('0x74')][_0x10af91][_0x86d3('0x77')]&&_0x31d436[_0x86d3('0x74')][_0x10af91]['foreignKey']){_0x49a499[_0x31d436[_0x86d3('0x74')][_0x10af91][_0x86d3('0x29')]](_0x31d436['joins'][_0x10af91]['foreignTable'],null,util[_0x86d3('0x70')]('%s.%s\x20=\x20%s.%s',_0x31d436['table'],_0x31d436[_0x86d3('0x74')][_0x10af91][_0x86d3('0x76')],_0x31d436[_0x86d3('0x74')][_0x10af91]['foreignTable'],_0x31d436[_0x86d3('0x74')][_0x10af91][_0x86d3('0x78')]));}}}if(_0x31d436[_0x86d3('0x79')]){_0x31d436[_0x86d3('0x79')]=JSON[_0x86d3('0x75')](_0x31d436['conditions']);_0x49a499[_0x86d3('0x35')](_0xdc7c21(_0x31d436[_0x86d3('0x79')]['group']));}_0x1d8d7c=_0x49a499['clone']();_0x49a499['limit'](_0x49a101);_0x49a499[_0x86d3('0x18')](0x0);logger['debug']('Limited\x20Query:',_0x49a499[_0x86d3('0x7c')]());return dbH[_0x86d3('0x9e')]['query'](_0x49a499['toString'](),{'type':dbH[_0x86d3('0x9e')][_0x86d3('0x7d')][_0x86d3('0x7e')]});}})['then'](function(){return{'sql':_0x1d8d7c[_0x86d3('0x7c')]()};})[_0x86d3('0x1f')](respondWithResult(_0x1e3559,null))[_0x86d3('0x44')](handleError(_0x1e3559,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 8f70262..3a9d11e 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 _0xa822=['../../config/environment','./analyticDefaultReport.attributes','define','lodash','util','api','moment','bluebird','path','rimraf'];(function(_0x59a9d3,_0x5df6ed){var _0x13bca4=function(_0x2a1879){while(--_0x2a1879){_0x59a9d3['push'](_0x59a9d3['shift']());}};_0x13bca4(++_0x5df6ed);}(_0xa822,0x1ed));var _0x2a82=function(_0x50f112,_0xd38e53){_0x50f112=_0x50f112-0x0;var _0x4ecf28=_0xa822[_0x50f112];return _0x4ecf28;};'use strict';var _=require(_0x2a82('0x0'));var util=require(_0x2a82('0x1'));var logger=require('../../config/logger')(_0x2a82('0x2'));var moment=require(_0x2a82('0x3'));var BPromise=require(_0x2a82('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2a82('0x5'));var rimraf=require(_0x2a82('0x6'));var config=require(_0x2a82('0x7'));var attributes=require(_0x2a82('0x8'));module['exports']=function(_0x37968c,_0x5ee7a0){return _0x37968c[_0x2a82('0x9')]('AnalyticDefaultReport',attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe9d=['api','moment','bluebird','request-promise','path','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger'];(function(_0x2f68c6,_0x277ab5){var _0x2a52e0=function(_0x2b9682){while(--_0x2b9682){_0x2f68c6['push'](_0x2f68c6['shift']());}};_0x2a52e0(++_0x277ab5);}(_0xfe9d,0xf9));var _0xdfe9=function(_0x14e6d7,_0x5410db){_0x14e6d7=_0x14e6d7-0x0;var _0x40acdb=_0xfe9d[_0x14e6d7];return _0x40acdb;};'use strict';var _=require(_0xdfe9('0x0'));var util=require(_0xdfe9('0x1'));var logger=require(_0xdfe9('0x2'))(_0xdfe9('0x3'));var moment=require(_0xdfe9('0x4'));var BPromise=require(_0xdfe9('0x5'));var rp=require(_0xdfe9('0x6'));var fs=require('fs');var path=require(_0xdfe9('0x7'));var rimraf=require('rimraf');var config=require(_0xdfe9('0x8'));var attributes=require(_0xdfe9('0x9'));module[_0xdfe9('0xa')]=function(_0x254954,_0x1e5f71){return _0x254954[_0xdfe9('0xb')](_0xdfe9('0xc'),attributes,{'tableName':_0xdfe9('0xd'),'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 16a8f42..75b8271 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 _0x530f=['info','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','request\x20sent','result','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x3001cf,_0x43854a){var _0x31d20c=function(_0x2e4f95){while(--_0x2e4f95){_0x3001cf['push'](_0x3001cf['shift']());}};_0x31d20c(++_0x43854a);}(_0x530f,0x16f));var _0xf530=function(_0xc7d92f,_0x2f2193){_0xc7d92f=_0xc7d92f-0x0;var _0x3a17ea=_0x530f[_0xc7d92f];return _0x3a17ea;};'use strict';var _=require('lodash');var util=require(_0xf530('0x0'));var moment=require(_0xf530('0x1'));var BPromise=require('bluebird');var rs=require(_0xf530('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf530('0x3'))['db'];var utils=require(_0xf530('0x4'));var logger=require('../../config/logger')(_0xf530('0x5'));var config=require(_0xf530('0x6'));var jayson=require(_0xf530('0x7'));var client=jayson[_0xf530('0x8')][_0xf530('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xebe87c,_0x343692,_0x3c9cc4){return new BPromise(function(_0x92d72,_0x575225){return client['request'](_0xebe87c,_0x3c9cc4)[_0xf530('0xa')](function(_0x49b9a2){logger[_0xf530('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x343692,'request\x20sent');logger[_0xf530('0xc')](_0xf530('0xd'),_0x343692,'request\x20sent',JSON[_0xf530('0xe')](_0x49b9a2));if(_0x49b9a2[_0xf530('0xf')]){if(_0x49b9a2[_0xf530('0xf')][_0xf530('0x10')]===0x1f4){logger[_0xf530('0xf')](_0xf530('0x11'),_0x343692,_0x49b9a2[_0xf530('0xf')]['message']);return _0x575225(_0x49b9a2['error']['message']);}logger[_0xf530('0xf')](_0xf530('0x11'),_0x343692,_0x49b9a2[_0xf530('0xf')][_0xf530('0x12')]);return _0x92d72(_0x49b9a2[_0xf530('0xf')][_0xf530('0x12')]);}else{logger[_0xf530('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x343692,_0xf530('0x13'));_0x92d72(_0x49b9a2[_0xf530('0x14')][_0xf530('0x12')]);}})['catch'](function(_0xaac6c5){logger[_0xf530('0xf')](_0xf530('0x11'),_0x343692,_0xaac6c5);_0x575225(_0xaac6c5);});});} \ No newline at end of file +var _0x1ff0=['AnalyticDefaultReport,\x20%s,\x20%s','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x23dc17,_0x4d700d){var _0x2d094c=function(_0x4a0810){while(--_0x4a0810){_0x23dc17['push'](_0x23dc17['shift']());}};_0x2d094c(++_0x4d700d);}(_0x1ff0,0x125));var _0x01ff=function(_0x3b5b66,_0x191961){_0x3b5b66=_0x3b5b66-0x0;var _0x5120f4=_0x1ff0[_0x3b5b66];return _0x5120f4;};'use strict';var _=require(_0x01ff('0x0'));var util=require(_0x01ff('0x1'));var moment=require(_0x01ff('0x2'));var BPromise=require(_0x01ff('0x3'));var rs=require(_0x01ff('0x4'));var fs=require('fs');var Redis=require(_0x01ff('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x01ff('0x6'));var logger=require(_0x01ff('0x7'))('rpc');var config=require(_0x01ff('0x8'));var jayson=require(_0x01ff('0x9'));var client=jayson[_0x01ff('0xa')][_0x01ff('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d871c,_0x8d5f57,_0xf9833b){return new BPromise(function(_0x2023d3,_0x372dfa){return client[_0x01ff('0xc')](_0x2d871c,_0xf9833b)[_0x01ff('0xd')](function(_0x33862b){logger[_0x01ff('0xe')](_0x01ff('0xf'),_0x8d5f57,'request\x20sent');logger[_0x01ff('0x10')](_0x01ff('0x11'),_0x8d5f57,_0x01ff('0x12'),JSON['stringify'](_0x33862b));if(_0x33862b[_0x01ff('0x13')]){if(_0x33862b['error']['code']===0x1f4){logger[_0x01ff('0x13')](_0x01ff('0xf'),_0x8d5f57,_0x33862b[_0x01ff('0x13')][_0x01ff('0x14')]);return _0x372dfa(_0x33862b[_0x01ff('0x13')][_0x01ff('0x14')]);}logger['error'](_0x01ff('0xf'),_0x8d5f57,_0x33862b['error'][_0x01ff('0x14')]);return _0x2023d3(_0x33862b[_0x01ff('0x13')][_0x01ff('0x14')]);}else{logger[_0x01ff('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x8d5f57,_0x01ff('0x12'));_0x2023d3(_0x33862b[_0x01ff('0x15')]['message']);}})['catch'](function(_0x5c811f){logger[_0x01ff('0x13')](_0x01ff('0xf'),_0x8d5f57,_0x5c811f);_0x372dfa(_0x5c811f);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 8996b3f..8acf9bf 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 _0x981d=['path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','index','get','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','delete','exports'];(function(_0x49191a,_0x5de212){var _0x142cf0=function(_0x26208c){while(--_0x26208c){_0x49191a['push'](_0x49191a['shift']());}};_0x142cf0(++_0x5de212);}(_0x981d,0x18c));var _0xd981=function(_0x3d4c69,_0x54010d){_0x3d4c69=_0x3d4c69-0x0;var _0x2e402b=_0x981d[_0x3d4c69];return _0x2e402b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd981('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xd981('0x1'));var auth=require(_0xd981('0x2'));var interaction=require(_0xd981('0x3'));var config=require(_0xd981('0x4'));var controller=require(_0xd981('0x5'));router['get']('/',auth[_0xd981('0x6')](),controller[_0xd981('0x7')]);router[_0xd981('0x8')](_0xd981('0x9'),auth[_0xd981('0x6')](),controller[_0xd981('0xa')]);router[_0xd981('0x8')](_0xd981('0xb'),auth['isAuthenticated'](),controller[_0xd981('0xc')]);router[_0xd981('0x8')](_0xd981('0xd'),auth[_0xd981('0x6')](),controller[_0xd981('0xe')]);router['get'](_0xd981('0xf'),auth[_0xd981('0x6')](),controller[_0xd981('0x10')]);router[_0xd981('0x11')]('/',auth['isAuthenticated'](),controller[_0xd981('0x12')]);router[_0xd981('0x13')](_0xd981('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xd981('0x14')](_0xd981('0x9'),auth[_0xd981('0x6')](),controller['destroy']);module[_0xd981('0x15')]=router; \ No newline at end of file +var _0x15bf=['post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','/:id/preview','preview','/:id/run','run','/:id/query'];(function(_0x139a8d,_0x2057b9){var _0x2dc764=function(_0x27c279){while(--_0x27c279){_0x139a8d['push'](_0x139a8d['shift']());}};_0x2dc764(++_0x2057b9);}(_0x15bf,0x9e));var _0xf15b=function(_0x46a671,_0x758e9a){_0x46a671=_0x46a671-0x0;var _0x526d75=_0x15bf[_0x46a671];return _0x526d75;};'use strict';var multer=require(_0xf15b('0x0'));var util=require(_0xf15b('0x1'));var path=require(_0xf15b('0x2'));var timeout=require('connect-timeout');var express=require(_0xf15b('0x3'));var router=express[_0xf15b('0x4')]();var fs_extra=require(_0xf15b('0x5'));var auth=require(_0xf15b('0x6'));var interaction=require(_0xf15b('0x7'));var config=require(_0xf15b('0x8'));var controller=require(_0xf15b('0x9'));router[_0xf15b('0xa')]('/',auth[_0xf15b('0xb')](),controller['index']);router[_0xf15b('0xa')]('/:id',auth[_0xf15b('0xb')](),controller['show']);router[_0xf15b('0xa')](_0xf15b('0xc'),auth[_0xf15b('0xb')](),controller[_0xf15b('0xd')]);router[_0xf15b('0xa')](_0xf15b('0xe'),auth['isAuthenticated'](),controller[_0xf15b('0xf')]);router[_0xf15b('0xa')](_0xf15b('0x10'),auth[_0xf15b('0xb')](),controller['query']);router[_0xf15b('0x11')]('/',auth['isAuthenticated'](),controller[_0xf15b('0x12')]);router[_0xf15b('0x13')](_0xf15b('0x14'),auth[_0xf15b('0xb')](),controller[_0xf15b('0x15')]);router[_0xf15b('0x16')](_0xf15b('0x14'),auth[_0xf15b('0xb')](),controller[_0xf15b('0x17')]);module[_0xf15b('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 47dc0d6..cfdc5e0 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 _0x9dee=['xlsx','csv','ENUM','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','pdf'];(function(_0x519be2,_0x4a57aa){var _0xbebc66=function(_0x489500){while(--_0x489500){_0x519be2['push'](_0x519be2['shift']());}};_0xbebc66(++_0x4a57aa);}(_0x9dee,0xf7));var _0xe9de=function(_0x4d2993,_0x1c9473){_0x4d2993=_0x4d2993-0x0;var _0x427374=_0x9dee[_0x4d2993];return _0x427374;};'use strict';var Sequelize=require(_0xe9de('0x0'));var moment=require(_0xe9de('0x1'));module[_0xe9de('0x2')]={'name':{'type':Sequelize[_0xe9de('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0xe9de('0x3')],'allowNull':![]},'output':{'type':Sequelize['ENUM']('csv',_0xe9de('0x4'),_0xe9de('0x5')),'allowNull':![],'defaultValue':_0xe9de('0x6')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize['STRING'],'defaultValue':'Loading'},'type':{'type':Sequelize[_0xe9de('0x7')](_0xe9de('0x8'),_0xe9de('0x9')),'allowNull':![],'defaultValue':_0xe9de('0x8')},'reportId':{'type':Sequelize[_0xe9de('0xa')](0xb)[_0xe9de('0xb')]},'reportType':{'type':Sequelize[_0xe9de('0x3')]}}; \ No newline at end of file +var _0x437b=['scheduled','INTEGER','UNSIGNED','moment','exports','ENUM','csv','STRING','manual'];(function(_0xe10b6a,_0x271eef){var _0xc7c0e1=function(_0x31a009){while(--_0x31a009){_0xe10b6a['push'](_0xe10b6a['shift']());}};_0xc7c0e1(++_0x271eef);}(_0x437b,0x16b));var _0xb437=function(_0x5b26cb,_0x527ab0){_0x5b26cb=_0x5b26cb-0x0;var _0x563d12=_0x437b[_0x5b26cb];return _0x563d12;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb437('0x0'));module[_0xb437('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0xb437('0x2')](_0xb437('0x3'),'pdf','xlsx'),'allowNull':![],'defaultValue':_0xb437('0x3')},'savename':{'type':Sequelize[_0xb437('0x4')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0xb437('0x4')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0xb437('0x2')](_0xb437('0x5'),_0xb437('0x6')),'allowNull':![],'defaultValue':_0xb437('0x5')},'reportId':{'type':Sequelize[_0xb437('0x7')](0xb)[_0xb437('0x8')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 553ab74..816930e 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 _0x120d=['get','find','userProfileId','autoAssociation','UserProfileResource','catch','download','savename','existsSync','join','exists','root','server/files/reports','format','%s.%s','basename','output','toLowerCase','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','update','then','destroy','ExtractedReports','error','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','include','findAll','rows','show','params','length','includeAll','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user'];(function(_0xf95100,_0xc52bd){var _0x52f169=function(_0x257021){while(--_0x257021){_0xf95100['push'](_0xf95100['shift']());}};_0x52f169(++_0xc52bd);}(_0x120d,0x6d));var _0xd120=function(_0x4d35f3,_0x19ba66){_0x4d35f3=_0x4d35f3-0x0;var _0x382fea=_0x120d[_0x4d35f3];return _0x382fea;};'use strict';var emlformat=require(_0xd120('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd120('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd120('0x2'));var moment=require(_0xd120('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd120('0x4'));var util=require(_0xd120('0x5'));var path=require(_0xd120('0x6'));var sox=require(_0xd120('0x7'));var csv=require(_0xd120('0x8'));var ejs=require(_0xd120('0x9'));var fs=require('fs');var fs_extra=require(_0xd120('0xa'));var _=require('lodash');var squel=require(_0xd120('0xb'));var crypto=require('crypto');var jsforce=require(_0xd120('0xc'));var deskjs=require(_0xd120('0xd'));var toCsv=require(_0xd120('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd120('0xe'));var qs=require(_0xd120('0xf'));var as=require(_0xd120('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd120('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xd120('0x12'));var licenseUtil=require(_0xd120('0x13'));var db=require(_0xd120('0x14'))['db'];function respondWithStatusCode(_0x5af93f,_0x525620){_0x525620=_0x525620||0xcc;return function(_0x44ad56){if(_0x44ad56){return _0x5af93f[_0xd120('0x15')](_0x525620);}return _0x5af93f['status'](_0x525620)[_0xd120('0x16')]();};}function respondWithResult(_0x4e8a16,_0x38960f){_0x38960f=_0x38960f||0xc8;return function(_0x47e559){if(_0x47e559){return _0x4e8a16['status'](_0x38960f)[_0xd120('0x17')](_0x47e559);}};}function respondWithFilteredResult(_0x1e6f29,_0x3343ed){return function(_0x51ce5d){if(_0x51ce5d){var _0xf6647b=typeof _0x3343ed[_0xd120('0x18')]===_0xd120('0x19')&&typeof _0x3343ed[_0xd120('0x1a')]===_0xd120('0x19');var _0x1e2ca8=_0x51ce5d[_0xd120('0x1b')];var _0x3b5c17=_0xf6647b?0x0:_0x3343ed[_0xd120('0x18')];var _0x1528d6=_0xf6647b?_0x51ce5d[_0xd120('0x1b')]:_0x3343ed[_0xd120('0x18')]+_0x3343ed['limit'];var _0x5b2869;if(_0x1528d6>=_0x1e2ca8){_0x1528d6=_0x1e2ca8;_0x5b2869=0xc8;}else{_0x5b2869=0xce;}_0x1e6f29[_0xd120('0x1c')](_0x5b2869);return _0x1e6f29[_0xd120('0x1d')](_0xd120('0x1e'),_0x3b5c17+'-'+_0x1528d6+'/'+_0x1e2ca8)[_0xd120('0x17')](_0x51ce5d);}return null;};}function patchUpdates(_0x17e7c0){return function(_0x5b1eaa){try{jsonpatch['apply'](_0x5b1eaa,_0x17e7c0,!![]);}catch(_0x3ecf2a){return BPromise[_0xd120('0x1f')](_0x3ecf2a);}return _0x5b1eaa['save']();};}function saveUpdates(_0x4d2fe1,_0x443c3e){return function(_0x2c2b9b){if(_0x2c2b9b){return _0x2c2b9b[_0xd120('0x20')](_0x4d2fe1)[_0xd120('0x21')](function(_0x585ab6){return _0x585ab6;});}return null;};}function removeEntity(_0x133bd7,_0xf08a1e){return function(_0x486255){if(_0x486255){return _0x486255[_0xd120('0x22')]()['then'](function(){var _0x5aba05=_0x486255['get']({'plain':!![]});var _0x337071=_0xd120('0x23');return db['UserProfileResource'][_0xd120('0x22')]({'where':{'type':_0x337071,'resourceId':_0x5aba05['id']}})[_0xd120('0x21')](function(){return _0x486255;});})[_0xd120('0x21')](function(){_0x133bd7[_0xd120('0x1c')](0xcc)[_0xd120('0x16')]();});}};}function handleEntityNotFound(_0x35c6cf,_0x412650){return function(_0x185479){if(!_0x185479){_0x35c6cf[_0xd120('0x15')](0x194);}return _0x185479;};}function handleError(_0x13bdea,_0x3f780c){_0x3f780c=_0x3f780c||0x1f4;return function(_0x398e2f){logger[_0xd120('0x24')](_0x398e2f['stack']);if(_0x398e2f[_0xd120('0x25')]){delete _0x398e2f['name'];}_0x13bdea['status'](_0x3f780c)[_0xd120('0x26')](_0x398e2f);};}exports[_0xd120('0x27')]=function(_0x49c69e,_0x47039d){var _0x331334={},_0x431913={},_0x2c0252={'count':0x0,'rows':[]};var _0x4d8cdd=_[_0xd120('0x28')](db[_0xd120('0x29')][_0xd120('0x2a')],function(_0x35523d){return{'name':_0x35523d[_0xd120('0x2b')],'type':_0x35523d['type'][_0xd120('0x2c')]};});_0x431913['model']=_[_0xd120('0x28')](_0x4d8cdd,'name');_0x431913[_0xd120('0x2d')]=_[_0xd120('0x2e')](_0x49c69e[_0xd120('0x2d')]);_0x431913[_0xd120('0x2f')]=_['intersection'](_0x431913[_0xd120('0x30')],_0x431913[_0xd120('0x2d')]);_0x331334[_0xd120('0x31')]=_[_0xd120('0x32')](_0x431913[_0xd120('0x30')],qs['fields'](_0x49c69e['query'][_0xd120('0x33')]));_0x331334[_0xd120('0x31')]=_0x331334[_0xd120('0x31')]['length']?_0x331334[_0xd120('0x31')]:_0x431913['model'];if(!_0x49c69e[_0xd120('0x2d')][_0xd120('0x34')](_0xd120('0x35'))){_0x331334[_0xd120('0x1a')]=qs['limit'](_0x49c69e['query'][_0xd120('0x1a')]);_0x331334[_0xd120('0x18')]=qs[_0xd120('0x18')](_0x49c69e[_0xd120('0x2d')][_0xd120('0x18')]);}_0x331334[_0xd120('0x36')]=qs[_0xd120('0x37')](_0x49c69e[_0xd120('0x2d')]['sort']);_0x331334[_0xd120('0x38')]=qs[_0xd120('0x2f')](_[_0xd120('0x39')](_0x49c69e[_0xd120('0x2d')],_0x431913[_0xd120('0x2f')]),_0x4d8cdd);if(_0x49c69e[_0xd120('0x2d')]['filter']){_0x331334[_0xd120('0x38')]=_[_0xd120('0x3a')](_0x331334[_0xd120('0x38')],{'$or':_['map'](_0x4d8cdd,function(_0xe0176b){if(_0xe0176b[_0xd120('0x3b')]!=='VIRTUAL'){var _0x2d9f3e={};_0x2d9f3e[_0xe0176b[_0xd120('0x25')]]={'$like':'%'+_0x49c69e[_0xd120('0x2d')][_0xd120('0x3c')]+'%'};return _0x2d9f3e;}})});}_0x331334=_[_0xd120('0x3a')]({},_0x331334,_0x49c69e['options']);var _0xddb2cf={'where':_0x331334['where']};return db[_0xd120('0x29')][_0xd120('0x1b')](_0xddb2cf)[_0xd120('0x21')](function(_0x1c4021){_0x2c0252[_0xd120('0x1b')]=_0x1c4021;if(_0x49c69e[_0xd120('0x2d')]['includeAll']){_0x331334[_0xd120('0x3d')]=[{'all':!![]}];}return db[_0xd120('0x29')][_0xd120('0x3e')](_0x331334);})['then'](function(_0x313e36){_0x2c0252[_0xd120('0x3f')]=_0x313e36;return _0x2c0252;})[_0xd120('0x21')](respondWithFilteredResult(_0x47039d,_0x331334))['catch'](handleError(_0x47039d,null));};exports[_0xd120('0x40')]=function(_0x49f366,_0x5ab119){var _0x16f780={'raw':!![],'where':{'id':_0x49f366[_0xd120('0x41')]['id']}},_0x47738b={};_0x47738b[_0xd120('0x30')]=_[_0xd120('0x2e')](db[_0xd120('0x29')]['rawAttributes']);_0x47738b[_0xd120('0x2d')]=_[_0xd120('0x2e')](_0x49f366[_0xd120('0x2d')]);_0x47738b[_0xd120('0x2f')]=_['intersection'](_0x47738b[_0xd120('0x30')],_0x47738b[_0xd120('0x2d')]);_0x16f780['attributes']=_[_0xd120('0x32')](_0x47738b['model'],qs['fields'](_0x49f366['query']['fields']));_0x16f780['attributes']=_0x16f780[_0xd120('0x31')][_0xd120('0x42')]?_0x16f780['attributes']:_0x47738b[_0xd120('0x30')];if(_0x49f366[_0xd120('0x2d')][_0xd120('0x43')]){_0x16f780['include']=[{'all':!![]}];}_0x16f780=_[_0xd120('0x3a')]({},_0x16f780,_0x49f366[_0xd120('0x44')]);return db[_0xd120('0x29')]['find'](_0x16f780)[_0xd120('0x21')](handleEntityNotFound(_0x5ab119,null))['then'](respondWithResult(_0x5ab119,null))['catch'](handleError(_0x5ab119,null));};exports[_0xd120('0x45')]=function(_0x1abff9,_0x16665a){return db[_0xd120('0x29')][_0xd120('0x45')](_0x1abff9[_0xd120('0x46')],{})[_0xd120('0x21')](function(_0x69ac0c){var _0x1fc2cb=_0x1abff9['user']['get']({'plain':!![]});if(!_0x1fc2cb)throw new Error(_0xd120('0x47'));if(_0x1fc2cb['role']===_0xd120('0x48')){var _0x122e5f=_0x69ac0c[_0xd120('0x49')]({'plain':!![]});var _0x284b77='ExtractedReports';return db['UserProfileSection'][_0xd120('0x4a')]({'where':{'name':_0x284b77,'userProfileId':_0x1fc2cb[_0xd120('0x4b')]},'raw':!![]})[_0xd120('0x21')](function(_0x6e6935){if(_0x6e6935&&_0x6e6935[_0xd120('0x4c')]===0x0){return db[_0xd120('0x4d')][_0xd120('0x45')]({'name':_0x122e5f[_0xd120('0x25')],'resourceId':_0x122e5f['id'],'type':_0x6e6935[_0xd120('0x25')],'sectionId':_0x6e6935['id']},{})[_0xd120('0x21')](function(){return _0x69ac0c;});}else{return _0x69ac0c;}})[_0xd120('0x4e')](function(_0x2d9d71){logger[_0xd120('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2d9d71);throw _0x2d9d71;});}return _0x69ac0c;})[_0xd120('0x21')](respondWithResult(_0x16665a,0xc9))['catch'](handleError(_0x16665a,null));};exports[_0xd120('0x20')]=function(_0x37b4f5,_0x40f865){if(_0x37b4f5[_0xd120('0x46')]['id']){delete _0x37b4f5[_0xd120('0x46')]['id'];}return db[_0xd120('0x29')][_0xd120('0x4a')]({'where':{'id':_0x37b4f5[_0xd120('0x41')]['id']}})[_0xd120('0x21')](handleEntityNotFound(_0x40f865,null))[_0xd120('0x21')](saveUpdates(_0x37b4f5[_0xd120('0x46')],null))[_0xd120('0x21')](respondWithResult(_0x40f865,null))[_0xd120('0x4e')](handleError(_0x40f865,null));};exports[_0xd120('0x22')]=function(_0x7f36de,_0x238278){return db[_0xd120('0x29')][_0xd120('0x4a')]({'where':{'id':_0x7f36de[_0xd120('0x41')]['id']}})[_0xd120('0x21')](handleEntityNotFound(_0x238278,null))[_0xd120('0x21')](removeEntity(_0x238278,null))['catch'](handleError(_0x238278,null));};exports[_0xd120('0x4f')]=function(_0x215985,_0x32e46b,_0x5356c7){return db['AnalyticExtractedReport'][_0xd120('0x4a')]({'where':{'id':_0x215985[_0xd120('0x41')]['id']},'attributes':[_0xd120('0x25'),'basename',_0xd120('0x50'),'output'],'raw':!![]})[_0xd120('0x21')](handleEntityNotFound(_0x32e46b,null))['then'](function(_0x310739){if(_0x310739){if(!fs[_0xd120('0x51')](path[_0xd120('0x52')](config['root'],'server/files/reports',_0x310739['savename']))){throw new db['Sequelize']['ValidationError']('Report\x20not\x20found\x20or\x20empty');}if(_0x215985['query'][_0xd120('0x53')]){return _0x32e46b[_0xd120('0x15')](0xc8);}return _0x32e46b[_0xd120('0x4f')](path[_0xd120('0x52')](config[_0xd120('0x54')],_0xd120('0x55'),_0x310739[_0xd120('0x50')]),util[_0xd120('0x56')](_0xd120('0x57'),_0x310739[_0xd120('0x58')]||_0x310739['name'],_0x310739[_0xd120('0x59')][_0xd120('0x5a')]()));}})[_0xd120('0x4e')](handleError(_0x32e46b,null));}; \ No newline at end of file +var _0x931d=['VIRTUAL','options','includeAll','include','AnalyticExtractedReport','findAll','rows','catch','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','download','basename','savename','output','join','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','sendStatus','root','format','toLowerCase','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','offset','limit','undefined','count','json','apply','reject','save','then','destroy','get','end','error','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge'];(function(_0x5e2152,_0x172f3d){var _0x5ddcf6=function(_0x30a5cc){while(--_0x30a5cc){_0x5e2152['push'](_0x5e2152['shift']());}};_0x5ddcf6(++_0x172f3d);}(_0x931d,0x1eb));var _0xd931=function(_0x469262,_0x11b807){_0x469262=_0x469262-0x0;var _0x15d569=_0x931d[_0x469262];return _0x15d569;};'use strict';var emlformat=require(_0xd931('0x0'));var rimraf=require(_0xd931('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd931('0x2'));var rp=require(_0xd931('0x3'));var moment=require(_0xd931('0x4'));var BPromise=require(_0xd931('0x5'));var Mustache=require('mustache');var util=require(_0xd931('0x6'));var path=require(_0xd931('0x7'));var sox=require(_0xd931('0x8'));var csv=require(_0xd931('0x9'));var ejs=require(_0xd931('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd931('0xb'));var squel=require(_0xd931('0xc'));var crypto=require('crypto');var jsforce=require(_0xd931('0xd'));var deskjs=require(_0xd931('0xe'));var toCsv=require(_0xd931('0x9'));var querystring=require(_0xd931('0xf'));var Papa=require(_0xd931('0x10'));var Redis=require(_0xd931('0x11'));var authService=require(_0xd931('0x12'));var qs=require(_0xd931('0x13'));var as=require(_0xd931('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd931('0x15'))(_0xd931('0x16'));var utils=require('../../config/utils');var config=require(_0xd931('0x17'));var licenseUtil=require(_0xd931('0x18'));var db=require(_0xd931('0x19'))['db'];function respondWithStatusCode(_0x1aade2,_0x5262cc){_0x5262cc=_0x5262cc||0xcc;return function(_0x345de8){if(_0x345de8){return _0x1aade2['sendStatus'](_0x5262cc);}return _0x1aade2[_0xd931('0x1a')](_0x5262cc)['end']();};}function respondWithResult(_0x3a5554,_0x4e2247){_0x4e2247=_0x4e2247||0xc8;return function(_0x2ac2ad){if(_0x2ac2ad){return _0x3a5554[_0xd931('0x1a')](_0x4e2247)['json'](_0x2ac2ad);}};}function respondWithFilteredResult(_0x4c3e9b,_0x55e2c8){return function(_0x190cc2){if(_0x190cc2){var _0x3e98fe=typeof _0x55e2c8[_0xd931('0x1b')]==='undefined'&&typeof _0x55e2c8[_0xd931('0x1c')]===_0xd931('0x1d');var _0x4964de=_0x190cc2[_0xd931('0x1e')];var _0x37a758=_0x3e98fe?0x0:_0x55e2c8[_0xd931('0x1b')];var _0x9d97cb=_0x3e98fe?_0x190cc2[_0xd931('0x1e')]:_0x55e2c8[_0xd931('0x1b')]+_0x55e2c8[_0xd931('0x1c')];var _0x5422c4;if(_0x9d97cb>=_0x4964de){_0x9d97cb=_0x4964de;_0x5422c4=0xc8;}else{_0x5422c4=0xce;}_0x4c3e9b[_0xd931('0x1a')](_0x5422c4);return _0x4c3e9b['set']('Content-Range',_0x37a758+'-'+_0x9d97cb+'/'+_0x4964de)[_0xd931('0x1f')](_0x190cc2);}return null;};}function patchUpdates(_0x3c7bcf){return function(_0x2e339b){try{jsonpatch[_0xd931('0x20')](_0x2e339b,_0x3c7bcf,!![]);}catch(_0x49a742){return BPromise[_0xd931('0x21')](_0x49a742);}return _0x2e339b[_0xd931('0x22')]();};}function saveUpdates(_0xc891ec,_0x16b5a4){return function(_0x366502){if(_0x366502){return _0x366502['update'](_0xc891ec)[_0xd931('0x23')](function(_0xe23b4c){return _0xe23b4c;});}return null;};}function removeEntity(_0xe8abba,_0x950600){return function(_0x169d82){if(_0x169d82){return _0x169d82[_0xd931('0x24')]()['then'](function(){var _0x5d0716=_0x169d82[_0xd931('0x25')]({'plain':!![]});var _0x43b507='ExtractedReports';return db['UserProfileResource'][_0xd931('0x24')]({'where':{'type':_0x43b507,'resourceId':_0x5d0716['id']}})[_0xd931('0x23')](function(){return _0x169d82;});})['then'](function(){_0xe8abba[_0xd931('0x1a')](0xcc)[_0xd931('0x26')]();});}};}function handleEntityNotFound(_0x38ab09,_0x180103){return function(_0x2f5a3d){if(!_0x2f5a3d){_0x38ab09['sendStatus'](0x194);}return _0x2f5a3d;};}function handleError(_0x1a298c,_0x46f663){_0x46f663=_0x46f663||0x1f4;return function(_0x418571){logger[_0xd931('0x27')](_0x418571['stack']);if(_0x418571[_0xd931('0x28')]){delete _0x418571[_0xd931('0x28')];}_0x1a298c[_0xd931('0x1a')](_0x46f663)[_0xd931('0x29')](_0x418571);};}exports[_0xd931('0x2a')]=function(_0x45b0be,_0x542173){var _0x181e7e={},_0x5f488f={},_0x3379a3={'count':0x0,'rows':[]};var _0x1917d5=_[_0xd931('0x2b')](db['AnalyticExtractedReport'][_0xd931('0x2c')],function(_0x377632){return{'name':_0x377632['fieldName'],'type':_0x377632[_0xd931('0x2d')][_0xd931('0x2e')]};});_0x5f488f[_0xd931('0x2f')]=_[_0xd931('0x2b')](_0x1917d5,_0xd931('0x28'));_0x5f488f[_0xd931('0x30')]=_[_0xd931('0x31')](_0x45b0be[_0xd931('0x30')]);_0x5f488f['filters']=_[_0xd931('0x32')](_0x5f488f[_0xd931('0x2f')],_0x5f488f[_0xd931('0x30')]);_0x181e7e[_0xd931('0x33')]=_[_0xd931('0x32')](_0x5f488f[_0xd931('0x2f')],qs[_0xd931('0x34')](_0x45b0be['query'][_0xd931('0x34')]));_0x181e7e['attributes']=_0x181e7e[_0xd931('0x33')][_0xd931('0x35')]?_0x181e7e['attributes']:_0x5f488f[_0xd931('0x2f')];if(!_0x45b0be[_0xd931('0x30')]['hasOwnProperty'](_0xd931('0x36'))){_0x181e7e[_0xd931('0x1c')]=qs[_0xd931('0x1c')](_0x45b0be[_0xd931('0x30')][_0xd931('0x1c')]);_0x181e7e[_0xd931('0x1b')]=qs['offset'](_0x45b0be[_0xd931('0x30')][_0xd931('0x1b')]);}_0x181e7e['order']=qs[_0xd931('0x37')](_0x45b0be[_0xd931('0x30')][_0xd931('0x37')]);_0x181e7e[_0xd931('0x38')]=qs[_0xd931('0x39')](_[_0xd931('0x3a')](_0x45b0be['query'],_0x5f488f[_0xd931('0x39')]),_0x1917d5);if(_0x45b0be[_0xd931('0x30')][_0xd931('0x3b')]){_0x181e7e[_0xd931('0x38')]=_[_0xd931('0x3c')](_0x181e7e[_0xd931('0x38')],{'$or':_[_0xd931('0x2b')](_0x1917d5,function(_0x5e7c70){if(_0x5e7c70['type']!==_0xd931('0x3d')){var _0x385d69={};_0x385d69[_0x5e7c70[_0xd931('0x28')]]={'$like':'%'+_0x45b0be[_0xd931('0x30')]['filter']+'%'};return _0x385d69;}})});}_0x181e7e=_['merge']({},_0x181e7e,_0x45b0be[_0xd931('0x3e')]);var _0x2c9564={'where':_0x181e7e['where']};return db['AnalyticExtractedReport'][_0xd931('0x1e')](_0x2c9564)[_0xd931('0x23')](function(_0x43b847){_0x3379a3[_0xd931('0x1e')]=_0x43b847;if(_0x45b0be[_0xd931('0x30')][_0xd931('0x3f')]){_0x181e7e[_0xd931('0x40')]=[{'all':!![]}];}return db[_0xd931('0x41')][_0xd931('0x42')](_0x181e7e);})['then'](function(_0x1694f1){_0x3379a3[_0xd931('0x43')]=_0x1694f1;return _0x3379a3;})[_0xd931('0x23')](respondWithFilteredResult(_0x542173,_0x181e7e))[_0xd931('0x44')](handleError(_0x542173,null));};exports['show']=function(_0x56fa1f,_0x109123){var _0x3513dc={'raw':!![],'where':{'id':_0x56fa1f['params']['id']}},_0x2d1890={};_0x2d1890[_0xd931('0x2f')]=_['keys'](db['AnalyticExtractedReport'][_0xd931('0x2c')]);_0x2d1890['query']=_[_0xd931('0x31')](_0x56fa1f[_0xd931('0x30')]);_0x2d1890['filters']=_['intersection'](_0x2d1890[_0xd931('0x2f')],_0x2d1890[_0xd931('0x30')]);_0x3513dc[_0xd931('0x33')]=_[_0xd931('0x32')](_0x2d1890['model'],qs[_0xd931('0x34')](_0x56fa1f['query'][_0xd931('0x34')]));_0x3513dc[_0xd931('0x33')]=_0x3513dc['attributes']['length']?_0x3513dc[_0xd931('0x33')]:_0x2d1890[_0xd931('0x2f')];if(_0x56fa1f[_0xd931('0x30')][_0xd931('0x3f')]){_0x3513dc['include']=[{'all':!![]}];}_0x3513dc=_[_0xd931('0x3c')]({},_0x3513dc,_0x56fa1f[_0xd931('0x3e')]);return db[_0xd931('0x41')]['find'](_0x3513dc)[_0xd931('0x23')](handleEntityNotFound(_0x109123,null))[_0xd931('0x23')](respondWithResult(_0x109123,null))['catch'](handleError(_0x109123,null));};exports['create']=function(_0x4430b4,_0x2c2f86){return db[_0xd931('0x41')]['create'](_0x4430b4[_0xd931('0x45')],{})[_0xd931('0x23')](function(_0x120507){var _0x41a49b=_0x4430b4['user']['get']({'plain':!![]});if(!_0x41a49b)throw new Error(_0xd931('0x46'));if(_0x41a49b[_0xd931('0x47')]===_0xd931('0x48')){var _0x56e5f9=_0x120507['get']({'plain':!![]});var _0x3d42f9='ExtractedReports';return db['UserProfileSection'][_0xd931('0x49')]({'where':{'name':_0x3d42f9,'userProfileId':_0x41a49b[_0xd931('0x4a')]},'raw':!![]})[_0xd931('0x23')](function(_0x27eb9c){if(_0x27eb9c&&_0x27eb9c[_0xd931('0x4b')]===0x0){return db[_0xd931('0x4c')]['create']({'name':_0x56e5f9[_0xd931('0x28')],'resourceId':_0x56e5f9['id'],'type':_0x27eb9c[_0xd931('0x28')],'sectionId':_0x27eb9c['id']},{})[_0xd931('0x23')](function(){return _0x120507;});}else{return _0x120507;}})[_0xd931('0x44')](function(_0x11f8fa){logger[_0xd931('0x27')](_0xd931('0x4d'),_0x11f8fa);throw _0x11f8fa;});}return _0x120507;})[_0xd931('0x23')](respondWithResult(_0x2c2f86,0xc9))[_0xd931('0x44')](handleError(_0x2c2f86,null));};exports['update']=function(_0x477cd1,_0x458d8f){if(_0x477cd1['body']['id']){delete _0x477cd1[_0xd931('0x45')]['id'];}return db['AnalyticExtractedReport'][_0xd931('0x49')]({'where':{'id':_0x477cd1[_0xd931('0x4e')]['id']}})['then'](handleEntityNotFound(_0x458d8f,null))[_0xd931('0x23')](saveUpdates(_0x477cd1[_0xd931('0x45')],null))[_0xd931('0x23')](respondWithResult(_0x458d8f,null))[_0xd931('0x44')](handleError(_0x458d8f,null));};exports[_0xd931('0x24')]=function(_0x4d87ec,_0x3f6973){return db['AnalyticExtractedReport'][_0xd931('0x49')]({'where':{'id':_0x4d87ec[_0xd931('0x4e')]['id']}})[_0xd931('0x23')](handleEntityNotFound(_0x3f6973,null))['then'](removeEntity(_0x3f6973,null))[_0xd931('0x44')](handleError(_0x3f6973,null));};exports[_0xd931('0x4f')]=function(_0x245d2a,_0x116a5e,_0x275580){return db[_0xd931('0x41')][_0xd931('0x49')]({'where':{'id':_0x245d2a['params']['id']},'attributes':['name',_0xd931('0x50'),_0xd931('0x51'),_0xd931('0x52')],'raw':!![]})[_0xd931('0x23')](handleEntityNotFound(_0x116a5e,null))[_0xd931('0x23')](function(_0x4a9473){if(_0x4a9473){if(!fs['existsSync'](path[_0xd931('0x53')](config['root'],_0xd931('0x54'),_0x4a9473[_0xd931('0x51')]))){throw new db['Sequelize'][(_0xd931('0x55'))](_0xd931('0x56'));}if(_0x245d2a['query'][_0xd931('0x57')]){return _0x116a5e[_0xd931('0x58')](0xc8);}return _0x116a5e['download'](path[_0xd931('0x53')](config[_0xd931('0x59')],_0xd931('0x54'),_0x4a9473[_0xd931('0x51')]),util[_0xd931('0x5a')]('%s.%s',_0x4a9473[_0xd931('0x50')]||_0x4a9473['name'],_0x4a9473[_0xd931('0x52')][_0xd931('0x5b')]()));}})[_0xd931('0x44')](handleError(_0x116a5e,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 0883f54..ef4b0b8 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 _0x49aa=['analytics_extracted_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','AnalyticExtractedReport'];(function(_0x1ce793,_0x3b957c){var _0x962895=function(_0x5403f4){while(--_0x5403f4){_0x1ce793['push'](_0x1ce793['shift']());}};_0x962895(++_0x3b957c);}(_0x49aa,0x194));var _0xa49a=function(_0x2abdcd,_0x2af6c7){_0x2abdcd=_0x2abdcd-0x0;var _0x48f3c3=_0x49aa[_0x2abdcd];return _0x48f3c3;};'use strict';var _=require(_0xa49a('0x0'));var util=require(_0xa49a('0x1'));var logger=require(_0xa49a('0x2'))(_0xa49a('0x3'));var moment=require(_0xa49a('0x4'));var BPromise=require(_0xa49a('0x5'));var rp=require(_0xa49a('0x6'));var fs=require('fs');var path=require(_0xa49a('0x7'));var rimraf=require(_0xa49a('0x8'));var config=require(_0xa49a('0x9'));var attributes=require(_0xa49a('0xa'));module['exports']=function(_0xe488b2,_0x461162){return _0xe488b2['define'](_0xa49a('0xb'),attributes,{'tableName':_0xa49a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f4a=['exports','define','AnalyticExtractedReport','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes'];(function(_0xb6e2ea,_0x3b26e9){var _0x2a57bb=function(_0x2a1ac9){while(--_0x2a1ac9){_0xb6e2ea['push'](_0xb6e2ea['shift']());}};_0x2a57bb(++_0x3b26e9);}(_0x6f4a,0x18f));var _0xa6f4=function(_0x22056d,_0x33be11){_0x22056d=_0x22056d-0x0;var _0x5b06aa=_0x6f4a[_0x22056d];return _0x5b06aa;};'use strict';var _=require(_0xa6f4('0x0'));var util=require('util');var logger=require(_0xa6f4('0x1'))('api');var moment=require(_0xa6f4('0x2'));var BPromise=require(_0xa6f4('0x3'));var rp=require(_0xa6f4('0x4'));var fs=require('fs');var path=require(_0xa6f4('0x5'));var rimraf=require(_0xa6f4('0x6'));var config=require(_0xa6f4('0x7'));var attributes=require(_0xa6f4('0x8'));module[_0xa6f4('0x9')]=function(_0x10f72d,_0x5d6930){return _0x10f72d[_0xa6f4('0xa')](_0xa6f4('0xb'),attributes,{'tableName':'analytics_extracted_reports','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 a42b7fd..73995b6 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 _0xfc23=['error','code','message','AnalyticExtractedReport,\x20%s,\x20%s','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','info','request\x20sent','debug'];(function(_0x202466,_0x140172){var _0x34ca86=function(_0x46f570){while(--_0x46f570){_0x202466['push'](_0x202466['shift']());}};_0x34ca86(++_0x140172);}(_0xfc23,0x10f));var _0x3fc2=function(_0xc9fb7e,_0x485054){_0xc9fb7e=_0xc9fb7e-0x0;var _0x3563ed=_0xfc23[_0xc9fb7e];return _0x3563ed;};'use strict';var _=require(_0x3fc2('0x0'));var util=require('util');var moment=require(_0x3fc2('0x1'));var BPromise=require(_0x3fc2('0x2'));var rs=require(_0x3fc2('0x3'));var fs=require('fs');var Redis=require(_0x3fc2('0x4'));var db=require(_0x3fc2('0x5'))['db'];var utils=require(_0x3fc2('0x6'));var logger=require('../../config/logger')(_0x3fc2('0x7'));var config=require(_0x3fc2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3fc2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c270c,_0x13dbcd,_0x1c9d6a){return new BPromise(function(_0x293bb3,_0x3c9f74){return client[_0x3fc2('0xa')](_0x5c270c,_0x1c9d6a)['then'](function(_0x1dd0d3){logger[_0x3fc2('0xb')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x13dbcd,_0x3fc2('0xc'));logger[_0x3fc2('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x13dbcd,'request\x20sent',JSON['stringify'](_0x1dd0d3));if(_0x1dd0d3[_0x3fc2('0xe')]){if(_0x1dd0d3[_0x3fc2('0xe')][_0x3fc2('0xf')]===0x1f4){logger[_0x3fc2('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x13dbcd,_0x1dd0d3['error'][_0x3fc2('0x10')]);return _0x3c9f74(_0x1dd0d3[_0x3fc2('0xe')][_0x3fc2('0x10')]);}logger[_0x3fc2('0xe')](_0x3fc2('0x11'),_0x13dbcd,_0x1dd0d3[_0x3fc2('0xe')][_0x3fc2('0x10')]);return _0x293bb3(_0x1dd0d3[_0x3fc2('0xe')][_0x3fc2('0x10')]);}else{logger[_0x3fc2('0xb')](_0x3fc2('0x11'),_0x13dbcd,'request\x20sent');_0x293bb3(_0x1dd0d3[_0x3fc2('0x12')][_0x3fc2('0x10')]);}})['catch'](function(_0x125eee){logger['error'](_0x3fc2('0x11'),_0x13dbcd,_0x125eee);_0x3c9f74(_0x125eee);});});} \ No newline at end of file +var _0x7599=['../../config/environment','jayson/promise','client','http','request','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x39cc8f,_0xb60cd8){var _0x15e616=function(_0x513d9e){while(--_0x513d9e){_0x39cc8f['push'](_0x39cc8f['shift']());}};_0x15e616(++_0xb60cd8);}(_0x7599,0x14f));var _0x9759=function(_0x1129da,_0x47a93c){_0x1129da=_0x1129da-0x0;var _0x31fb25=_0x7599[_0x1129da];return _0x31fb25;};'use strict';var _=require(_0x9759('0x0'));var util=require(_0x9759('0x1'));var moment=require(_0x9759('0x2'));var BPromise=require(_0x9759('0x3'));var rs=require(_0x9759('0x4'));var fs=require('fs');var Redis=require(_0x9759('0x5'));var db=require(_0x9759('0x6'))['db'];var utils=require(_0x9759('0x7'));var logger=require(_0x9759('0x8'))(_0x9759('0x9'));var config=require(_0x9759('0xa'));var jayson=require(_0x9759('0xb'));var client=jayson[_0x9759('0xc')][_0x9759('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2966a9,_0x3a4579,_0x55f814){return new BPromise(function(_0x1a7e47,_0x32c920){return client[_0x9759('0xe')](_0x2966a9,_0x55f814)['then'](function(_0x9eedb){logger[_0x9759('0xf')](_0x9759('0x10'),_0x3a4579,_0x9759('0x11'));logger[_0x9759('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x3a4579,'request\x20sent',JSON['stringify'](_0x9eedb));if(_0x9eedb[_0x9759('0x13')]){if(_0x9eedb[_0x9759('0x13')][_0x9759('0x14')]===0x1f4){logger[_0x9759('0x13')](_0x9759('0x10'),_0x3a4579,_0x9eedb[_0x9759('0x13')]['message']);return _0x32c920(_0x9eedb[_0x9759('0x13')][_0x9759('0x15')]);}logger[_0x9759('0x13')](_0x9759('0x10'),_0x3a4579,_0x9eedb[_0x9759('0x13')][_0x9759('0x15')]);return _0x1a7e47(_0x9eedb['error'][_0x9759('0x15')]);}else{logger[_0x9759('0xf')](_0x9759('0x10'),_0x3a4579,_0x9759('0x11'));_0x1a7e47(_0x9eedb[_0x9759('0x16')][_0x9759('0x15')]);}})['catch'](function(_0x11c209){logger[_0x9759('0x13')](_0x9759('0x10'),_0x3a4579,_0x11c209);_0x32c920(_0x11c209);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index a622c3f..5a64704 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 _0x9762=['fs-extra','../../components/auth/service','./analyticExtractedReport.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','create','put','update','destroy','exports','multer','util','express','Router'];(function(_0x483089,_0xf9b5c7){var _0x2861c5=function(_0x3110ff){while(--_0x3110ff){_0x483089['push'](_0x483089['shift']());}};_0x2861c5(++_0xf9b5c7);}(_0x9762,0x165));var _0x2976=function(_0x2eaa2b,_0x21830f){_0x2eaa2b=_0x2eaa2b-0x0;var _0x3b9b47=_0x9762[_0x2eaa2b];return _0x3b9b47;};'use strict';var multer=require(_0x2976('0x0'));var util=require(_0x2976('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2976('0x2'));var router=express[_0x2976('0x3')]();var fs_extra=require(_0x2976('0x4'));var auth=require(_0x2976('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2976('0x6'));router[_0x2976('0x7')]('/',auth[_0x2976('0x8')](),controller['index']);router['get'](_0x2976('0x9'),auth['isAuthenticated'](),controller[_0x2976('0xa')]);router[_0x2976('0x7')](_0x2976('0xb'),auth[_0x2976('0x8')](),controller[_0x2976('0xc')]);router[_0x2976('0xd')]('/',auth[_0x2976('0x8')](),controller[_0x2976('0xe')]);router[_0x2976('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x2976('0x10')]);router['delete'](_0x2976('0x9'),auth[_0x2976('0x8')](),controller[_0x2976('0x11')]);module[_0x2976('0x12')]=router; \ No newline at end of file +var _0x15aa=['get','show','/:id/download','download','create','delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x515a41,_0x4c631c){var _0x5a435b=function(_0x5dc9b4){while(--_0x5dc9b4){_0x515a41['push'](_0x515a41['shift']());}};_0x5a435b(++_0x4c631c);}(_0x15aa,0x99));var _0xa15a=function(_0x2318b8,_0x3ff9f9){_0x2318b8=_0x2318b8-0x0;var _0x313dde=_0x15aa[_0x2318b8];return _0x313dde;};'use strict';var multer=require(_0xa15a('0x0'));var util=require(_0xa15a('0x1'));var path=require('path');var timeout=require(_0xa15a('0x2'));var express=require(_0xa15a('0x3'));var router=express[_0xa15a('0x4')]();var fs_extra=require(_0xa15a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa15a('0x6'));var config=require(_0xa15a('0x7'));var controller=require('./analyticExtractedReport.controller');router['get']('/',auth[_0xa15a('0x8')](),controller['index']);router[_0xa15a('0x9')]('/:id',auth[_0xa15a('0x8')](),controller[_0xa15a('0xa')]);router[_0xa15a('0x9')](_0xa15a('0xb'),auth['isAuthenticated'](),controller[_0xa15a('0xc')]);router['post']('/',auth[_0xa15a('0x8')](),controller[_0xa15a('0xd')]);router['put']('/:id',auth[_0xa15a('0x8')](),controller['update']);router[_0xa15a('0xe')](_0xa15a('0xf'),auth[_0xa15a('0x8')](),controller[_0xa15a('0x10')]);module[_0xa15a('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 1a82efd..f508988 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 _0x3c80=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x4bfe08,_0x48ae7b){var _0x1f9125=function(_0x11450e){while(--_0x11450e){_0x4bfe08['push'](_0x4bfe08['shift']());}};_0x1f9125(++_0x48ae7b);}(_0x3c80,0x72));var _0x03c8=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x3c80[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x03c8('0x0'));module[_0x03c8('0x1')]={'field':{'type':Sequelize[_0x03c8('0x2')]},'alias':{'type':Sequelize[_0x03c8('0x3')]},'function':{'type':Sequelize[_0x03c8('0x3')]},'format':{'type':Sequelize[_0x03c8('0x3')]},'groupBy':{'type':Sequelize[_0x03c8('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x03c8('0x3')]},'custom':{'type':Sequelize[_0x03c8('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xc026=['exports','TEXT','STRING','BOOLEAN'];(function(_0x4ef7b9,_0x489c99){var _0x19e127=function(_0x55ba05){while(--_0x55ba05){_0x4ef7b9['push'](_0x4ef7b9['shift']());}};_0x19e127(++_0x489c99);}(_0xc026,0xf0));var _0x6c02=function(_0x35f901,_0x4dd58a){_0x35f901=_0x35f901-0x0;var _0x497a0a=_0xc026[_0x35f901];return _0x497a0a;};'use strict';var Sequelize=require('sequelize');module[_0x6c02('0x0')]={'field':{'type':Sequelize[_0x6c02('0x1')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x6c02('0x2')]},'groupBy':{'type':Sequelize[_0x6c02('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x6c02('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index a26a65a..4b7cb86 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 _0xb983=['path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','stack','send','index','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','name','options','AnalyticFieldReport','includeAll','rows','catch','show','params','filters','find','create','body','bulkCreate','update','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','map','CustomReportId','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util'];(function(_0x45a9a7,_0x190213){var _0xcd7892=function(_0x415487){while(--_0x415487){_0x45a9a7['push'](_0x45a9a7['shift']());}};_0xcd7892(++_0x190213);}(_0xb983,0x149));var _0x3b98=function(_0x4854d6,_0x2f1264){_0x4854d6=_0x4854d6-0x0;var _0x3885c0=_0xb983[_0x4854d6];return _0x3885c0;};'use strict';var emlformat=require(_0x3b98('0x0'));var rimraf=require(_0x3b98('0x1'));var zipdir=require(_0x3b98('0x2'));var jsonpatch=require(_0x3b98('0x3'));var rp=require(_0x3b98('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3b98('0x5'));var util=require(_0x3b98('0x6'));var path=require(_0x3b98('0x7'));var sox=require(_0x3b98('0x8'));var csv=require(_0x3b98('0x9'));var ejs=require(_0x3b98('0xa'));var fs=require('fs');var fs_extra=require(_0x3b98('0xb'));var _=require(_0x3b98('0xc'));var squel=require(_0x3b98('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3b98('0xe'));var toCsv=require(_0x3b98('0x9'));var querystring=require(_0x3b98('0xf'));var Papa=require(_0x3b98('0x10'));var Redis=require(_0x3b98('0x11'));var authService=require(_0x3b98('0x12'));var qs=require(_0x3b98('0x13'));var as=require(_0x3b98('0x14'));var hardwareService=require(_0x3b98('0x15'));var logger=require(_0x3b98('0x16'))(_0x3b98('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3b98('0x18'));var db=require(_0x3b98('0x19'))['db'];function respondWithStatusCode(_0x8d39ca,_0x2ce0a3){_0x2ce0a3=_0x2ce0a3||0xcc;return function(_0x3da023){if(_0x3da023){return _0x8d39ca[_0x3b98('0x1a')](_0x2ce0a3);}return _0x8d39ca[_0x3b98('0x1b')](_0x2ce0a3)[_0x3b98('0x1c')]();};}function respondWithResult(_0x1d966b,_0x2a8a2c){_0x2a8a2c=_0x2a8a2c||0xc8;return function(_0x206ab5){if(_0x206ab5){return _0x1d966b[_0x3b98('0x1b')](_0x2a8a2c)[_0x3b98('0x1d')](_0x206ab5);}};}function respondWithFilteredResult(_0x2ef2ba,_0x31fe2b){return function(_0x6b9cec){if(_0x6b9cec){var _0x31030d=typeof _0x31fe2b[_0x3b98('0x1e')]===_0x3b98('0x1f')&&typeof _0x31fe2b[_0x3b98('0x20')]==='undefined';var _0x87e54=_0x6b9cec[_0x3b98('0x21')];var _0x2fcda4=_0x31030d?0x0:_0x31fe2b[_0x3b98('0x1e')];var _0x4aefa7=_0x31030d?_0x6b9cec[_0x3b98('0x21')]:_0x31fe2b['offset']+_0x31fe2b[_0x3b98('0x20')];var _0x53ac66;if(_0x4aefa7>=_0x87e54){_0x4aefa7=_0x87e54;_0x53ac66=0xc8;}else{_0x53ac66=0xce;}_0x2ef2ba[_0x3b98('0x1b')](_0x53ac66);return _0x2ef2ba[_0x3b98('0x22')](_0x3b98('0x23'),_0x2fcda4+'-'+_0x4aefa7+'/'+_0x87e54)['json'](_0x6b9cec);}return null;};}function patchUpdates(_0x584b97){return function(_0x3f1e3a){try{jsonpatch['apply'](_0x3f1e3a,_0x584b97,!![]);}catch(_0x5db960){return BPromise[_0x3b98('0x24')](_0x5db960);}return _0x3f1e3a[_0x3b98('0x25')]();};}function saveUpdates(_0x315af4,_0x44ef91){return function(_0x2590c6){if(_0x2590c6){return _0x2590c6['update'](_0x315af4)[_0x3b98('0x26')](function(_0x41e229){return _0x41e229;});}return null;};}function removeEntity(_0x2d2926,_0x2919e7){return function(_0x17476f){if(_0x17476f){return _0x17476f[_0x3b98('0x27')]()['then'](function(){_0x2d2926[_0x3b98('0x1b')](0xcc)[_0x3b98('0x1c')]();});}};}function handleEntityNotFound(_0x183bbc,_0x4afd4d){return function(_0x37df98){if(!_0x37df98){_0x183bbc[_0x3b98('0x1a')](0x194);}return _0x37df98;};}function handleError(_0x3f46cc,_0x1c0f7e){_0x1c0f7e=_0x1c0f7e||0x1f4;return function(_0x2c0534){logger['error'](_0x2c0534[_0x3b98('0x28')]);if(_0x2c0534['name']){delete _0x2c0534['name'];}_0x3f46cc[_0x3b98('0x1b')](_0x1c0f7e)[_0x3b98('0x29')](_0x2c0534);};}exports[_0x3b98('0x2a')]=function(_0x36915e,_0x1872de){var _0x3943b2={},_0x4b8446={},_0x207681={'count':0x0,'rows':[]};var _0x58aca6=_['map'](db['AnalyticFieldReport'][_0x3b98('0x2b')],function(_0x4b4992){return{'name':_0x4b4992[_0x3b98('0x2c')],'type':_0x4b4992[_0x3b98('0x2d')][_0x3b98('0x2e')]};});_0x4b8446[_0x3b98('0x2f')]=_['map'](_0x58aca6,'name');_0x4b8446[_0x3b98('0x30')]=_[_0x3b98('0x31')](_0x36915e[_0x3b98('0x30')]);_0x4b8446['filters']=_[_0x3b98('0x32')](_0x4b8446[_0x3b98('0x2f')],_0x4b8446[_0x3b98('0x30')]);_0x3943b2[_0x3b98('0x33')]=_[_0x3b98('0x32')](_0x4b8446[_0x3b98('0x2f')],qs[_0x3b98('0x34')](_0x36915e[_0x3b98('0x30')][_0x3b98('0x34')]));_0x3943b2[_0x3b98('0x33')]=_0x3943b2['attributes'][_0x3b98('0x35')]?_0x3943b2['attributes']:_0x4b8446[_0x3b98('0x2f')];if(!_0x36915e[_0x3b98('0x30')]['hasOwnProperty'](_0x3b98('0x36'))){_0x3943b2['limit']=qs[_0x3b98('0x20')](_0x36915e[_0x3b98('0x30')][_0x3b98('0x20')]);_0x3943b2[_0x3b98('0x1e')]=qs[_0x3b98('0x1e')](_0x36915e['query'][_0x3b98('0x1e')]);}_0x3943b2[_0x3b98('0x37')]=qs[_0x3b98('0x38')](_0x36915e['query'][_0x3b98('0x38')]);_0x3943b2[_0x3b98('0x39')]=qs['filters'](_['pick'](_0x36915e['query'],_0x4b8446['filters']),_0x58aca6);if(_0x36915e[_0x3b98('0x30')][_0x3b98('0x3a')]){_0x3943b2[_0x3b98('0x39')]=_[_0x3b98('0x3b')](_0x3943b2[_0x3b98('0x39')],{'$or':_['map'](_0x58aca6,function(_0x38fa81){if(_0x38fa81[_0x3b98('0x2d')]!==_0x3b98('0x3c')){var _0x276957={};_0x276957[_0x38fa81[_0x3b98('0x3d')]]={'$like':'%'+_0x36915e['query'][_0x3b98('0x3a')]+'%'};return _0x276957;}})});}_0x3943b2=_['merge']({},_0x3943b2,_0x36915e[_0x3b98('0x3e')]);var _0x5df555={'where':_0x3943b2[_0x3b98('0x39')]};return db[_0x3b98('0x3f')][_0x3b98('0x21')](_0x5df555)[_0x3b98('0x26')](function(_0x2b2975){_0x207681['count']=_0x2b2975;if(_0x36915e[_0x3b98('0x30')][_0x3b98('0x40')]){_0x3943b2['include']=[{'all':!![]}];}return db['AnalyticFieldReport']['findAll'](_0x3943b2);})[_0x3b98('0x26')](function(_0x4e77a2){_0x207681[_0x3b98('0x41')]=_0x4e77a2;return _0x207681;})[_0x3b98('0x26')](respondWithFilteredResult(_0x1872de,_0x3943b2))[_0x3b98('0x42')](handleError(_0x1872de,null));};exports[_0x3b98('0x43')]=function(_0x388ee9,_0xe97f78){var _0x5734cc={'raw':![],'where':{'id':_0x388ee9[_0x3b98('0x44')]['id']}},_0x4ea1dc={};_0x4ea1dc[_0x3b98('0x2f')]=_[_0x3b98('0x31')](db[_0x3b98('0x3f')][_0x3b98('0x2b')]);_0x4ea1dc[_0x3b98('0x30')]=_[_0x3b98('0x31')](_0x388ee9[_0x3b98('0x30')]);_0x4ea1dc[_0x3b98('0x45')]=_[_0x3b98('0x32')](_0x4ea1dc['model'],_0x4ea1dc[_0x3b98('0x30')]);_0x5734cc[_0x3b98('0x33')]=_['intersection'](_0x4ea1dc[_0x3b98('0x2f')],qs[_0x3b98('0x34')](_0x388ee9[_0x3b98('0x30')][_0x3b98('0x34')]));_0x5734cc[_0x3b98('0x33')]=_0x5734cc['attributes']['length']?_0x5734cc['attributes']:_0x4ea1dc[_0x3b98('0x2f')];if(_0x388ee9[_0x3b98('0x30')][_0x3b98('0x40')]){_0x5734cc['include']=[{'all':!![]}];}_0x5734cc=_[_0x3b98('0x3b')]({},_0x5734cc,_0x388ee9[_0x3b98('0x3e')]);return db['AnalyticFieldReport'][_0x3b98('0x46')](_0x5734cc)[_0x3b98('0x26')](handleEntityNotFound(_0xe97f78,null))[_0x3b98('0x26')](respondWithResult(_0xe97f78,null))['catch'](handleError(_0xe97f78,null));};exports[_0x3b98('0x47')]=function(_0x30ae0b,_0x218813){return db[_0x3b98('0x3f')][_0x3b98('0x47')](_0x30ae0b[_0x3b98('0x48')],{})['then'](respondWithResult(_0x218813,0xc9))[_0x3b98('0x42')](handleError(_0x218813,null));};exports[_0x3b98('0x49')]=function(_0xefe293,_0x264a16){return db[_0x3b98('0x3f')][_0x3b98('0x49')](_0xefe293[_0x3b98('0x48')],{'raw':![],'individualHooks':!![]})[_0x3b98('0x26')](respondWithResult(_0x264a16,0xc9))[_0x3b98('0x42')](handleError(_0x264a16,null));};exports[_0x3b98('0x4a')]=function(_0x5958a6,_0x50844e){if(_0x5958a6['body']['id']){delete _0x5958a6[_0x3b98('0x48')]['id'];}return db[_0x3b98('0x3f')][_0x3b98('0x46')]({'where':{'id':_0x5958a6['params']['id']}})[_0x3b98('0x26')](handleEntityNotFound(_0x50844e,null))[_0x3b98('0x26')](saveUpdates(_0x5958a6[_0x3b98('0x48')],null))['then'](respondWithResult(_0x50844e,null))['catch'](handleError(_0x50844e,null));};exports[_0x3b98('0x27')]=function(_0x22ad3d,_0x4ce708){return db[_0x3b98('0x3f')][_0x3b98('0x46')]({'where':{'id':_0x22ad3d['params']['id']}})[_0x3b98('0x26')](handleEntityNotFound(_0x4ce708,null))['then'](removeEntity(_0x4ce708,null))['catch'](handleError(_0x4ce708,null));};exports['bulkDestroy']=function(_0x51153e,_0x5d3e2b){return db['AnalyticFieldReport'][_0x3b98('0x27')]({'where':{'id':_0x51153e[_0x3b98('0x30')][_0x3b98('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0x3b98('0x26')](respondWithResult(_0x5d3e2b,0xcc))[_0x3b98('0x42')](handleError(_0x5d3e2b,null));};exports[_0x3b98('0x4c')]=function(_0x4be68d,_0x415cb5,_0x41eb15){return db[_0x3b98('0x4d')][_0x3b98('0x4e')]({'where':{'id':_0x4be68d[_0x3b98('0x44')]['id']}})[_0x3b98('0x26')](handleEntityNotFound(_0x415cb5,null))['then'](function(_0x75f2f8){if(_0x75f2f8){return db[_0x3b98('0x4f')][_0x3b98('0x50')](function(_0x10f4ac){return db['AnalyticFieldReport']['destroy']({'where':{'CustomReportId':_0x4be68d[_0x3b98('0x44')]['id']},'transaction':_0x10f4ac})['then'](function(_0x417c6d){var _0xf615b3=_[_0x3b98('0x51')](_0x4be68d[_0x3b98('0x48')],function(_0x9a0bb6){delete _0x9a0bb6['id'];_0x9a0bb6[_0x3b98('0x52')]=_0x4be68d[_0x3b98('0x44')]['id'];return _0x9a0bb6;});return db['AnalyticFieldReport'][_0x3b98('0x49')](_0xf615b3,{'transaction':_0x10f4ac});});})[_0x3b98('0x26')](function(){return db['AnalyticFieldReport'][_0x3b98('0x53')]({'where':{'CustomReportId':_0x4be68d[_0x3b98('0x44')]['id']}});});}})['then'](respondWithResult(_0x415cb5,null))[_0x3b98('0x42')](handleError(_0x415cb5,null));}; \ No newline at end of file +var _0xab0a=['zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','undefined','offset','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','end','error','name','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','length','include','find','create','bulkCreate','body','update','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','CustomReportId','eml-format','rimraf'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xab0a,0x1f0));var _0xaab0=function(_0x1846f2,_0x353922){_0x1846f2=_0x1846f2-0x0;var _0x3f2021=_0xab0a[_0x1846f2];return _0x3f2021;};'use strict';var emlformat=require(_0xaab0('0x0'));var rimraf=require(_0xaab0('0x1'));var zipdir=require(_0xaab0('0x2'));var jsonpatch=require(_0xaab0('0x3'));var rp=require(_0xaab0('0x4'));var moment=require(_0xaab0('0x5'));var BPromise=require(_0xaab0('0x6'));var Mustache=require('mustache');var util=require(_0xaab0('0x7'));var path=require(_0xaab0('0x8'));var sox=require(_0xaab0('0x9'));var csv=require(_0xaab0('0xa'));var ejs=require(_0xaab0('0xb'));var fs=require('fs');var fs_extra=require(_0xaab0('0xc'));var _=require(_0xaab0('0xd'));var squel=require(_0xaab0('0xe'));var crypto=require(_0xaab0('0xf'));var jsforce=require(_0xaab0('0x10'));var deskjs=require(_0xaab0('0x11'));var toCsv=require(_0xaab0('0xa'));var querystring=require(_0xaab0('0x12'));var Papa=require('papaparse');var Redis=require(_0xaab0('0x13'));var authService=require(_0xaab0('0x14'));var qs=require(_0xaab0('0x15'));var as=require(_0xaab0('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaab0('0x17'))('api');var utils=require(_0xaab0('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaab0('0x19'))['db'];function respondWithStatusCode(_0x572f54,_0x1fc101){_0x1fc101=_0x1fc101||0xcc;return function(_0xc18cdc){if(_0xc18cdc){return _0x572f54[_0xaab0('0x1a')](_0x1fc101);}return _0x572f54['status'](_0x1fc101)['end']();};}function respondWithResult(_0x176ead,_0x14a681){_0x14a681=_0x14a681||0xc8;return function(_0x303fe2){if(_0x303fe2){return _0x176ead[_0xaab0('0x1b')](_0x14a681)['json'](_0x303fe2);}};}function respondWithFilteredResult(_0x40e793,_0x5780f4){return function(_0x14557e){if(_0x14557e){var _0x20b344=typeof _0x5780f4['offset']===_0xaab0('0x1c')&&typeof _0x5780f4['limit']==='undefined';var _0x47799f=_0x14557e['count'];var _0x4ce35c=_0x20b344?0x0:_0x5780f4[_0xaab0('0x1d')];var _0x22e1eb=_0x20b344?_0x14557e[_0xaab0('0x1e')]:_0x5780f4[_0xaab0('0x1d')]+_0x5780f4[_0xaab0('0x1f')];var _0x41d12a;if(_0x22e1eb>=_0x47799f){_0x22e1eb=_0x47799f;_0x41d12a=0xc8;}else{_0x41d12a=0xce;}_0x40e793[_0xaab0('0x1b')](_0x41d12a);return _0x40e793[_0xaab0('0x20')](_0xaab0('0x21'),_0x4ce35c+'-'+_0x22e1eb+'/'+_0x47799f)[_0xaab0('0x22')](_0x14557e);}return null;};}function patchUpdates(_0x3e2352){return function(_0x4b70e6){try{jsonpatch[_0xaab0('0x23')](_0x4b70e6,_0x3e2352,!![]);}catch(_0x73f678){return BPromise[_0xaab0('0x24')](_0x73f678);}return _0x4b70e6[_0xaab0('0x25')]();};}function saveUpdates(_0x4e88fc,_0x42e436){return function(_0x40aa85){if(_0x40aa85){return _0x40aa85['update'](_0x4e88fc)[_0xaab0('0x26')](function(_0x5d893e){return _0x5d893e;});}return null;};}function removeEntity(_0xc43e43,_0x352c0e){return function(_0x57265a){if(_0x57265a){return _0x57265a[_0xaab0('0x27')]()[_0xaab0('0x26')](function(){_0xc43e43[_0xaab0('0x1b')](0xcc)[_0xaab0('0x28')]();});}};}function handleEntityNotFound(_0x1e985e,_0x32675c){return function(_0x39c5a9){if(!_0x39c5a9){_0x1e985e[_0xaab0('0x1a')](0x194);}return _0x39c5a9;};}function handleError(_0x3e98c6,_0x182d8a){_0x182d8a=_0x182d8a||0x1f4;return function(_0x217cf5){logger[_0xaab0('0x29')](_0x217cf5['stack']);if(_0x217cf5[_0xaab0('0x2a')]){delete _0x217cf5[_0xaab0('0x2a')];}_0x3e98c6['status'](_0x182d8a)['send'](_0x217cf5);};}exports[_0xaab0('0x2b')]=function(_0x5bada7,_0x49823c){var _0x19c2b2={},_0x177d83={},_0x3dd07b={'count':0x0,'rows':[]};var _0x53d4b4=_[_0xaab0('0x2c')](db[_0xaab0('0x2d')][_0xaab0('0x2e')],function(_0x30b2e5){return{'name':_0x30b2e5[_0xaab0('0x2f')],'type':_0x30b2e5[_0xaab0('0x30')]['key']};});_0x177d83[_0xaab0('0x31')]=_[_0xaab0('0x2c')](_0x53d4b4,_0xaab0('0x2a'));_0x177d83[_0xaab0('0x32')]=_['keys'](_0x5bada7[_0xaab0('0x32')]);_0x177d83[_0xaab0('0x33')]=_[_0xaab0('0x34')](_0x177d83[_0xaab0('0x31')],_0x177d83['query']);_0x19c2b2[_0xaab0('0x35')]=_['intersection'](_0x177d83[_0xaab0('0x31')],qs['fields'](_0x5bada7[_0xaab0('0x32')][_0xaab0('0x36')]));_0x19c2b2[_0xaab0('0x35')]=_0x19c2b2[_0xaab0('0x35')]['length']?_0x19c2b2[_0xaab0('0x35')]:_0x177d83['model'];if(!_0x5bada7['query']['hasOwnProperty']('nolimit')){_0x19c2b2['limit']=qs['limit'](_0x5bada7[_0xaab0('0x32')][_0xaab0('0x1f')]);_0x19c2b2['offset']=qs[_0xaab0('0x1d')](_0x5bada7[_0xaab0('0x32')][_0xaab0('0x1d')]);}_0x19c2b2[_0xaab0('0x37')]=qs[_0xaab0('0x38')](_0x5bada7[_0xaab0('0x32')]['sort']);_0x19c2b2[_0xaab0('0x39')]=qs['filters'](_[_0xaab0('0x3a')](_0x5bada7[_0xaab0('0x32')],_0x177d83[_0xaab0('0x33')]),_0x53d4b4);if(_0x5bada7[_0xaab0('0x32')][_0xaab0('0x3b')]){_0x19c2b2[_0xaab0('0x39')]=_[_0xaab0('0x3c')](_0x19c2b2[_0xaab0('0x39')],{'$or':_[_0xaab0('0x2c')](_0x53d4b4,function(_0x589856){if(_0x589856['type']!==_0xaab0('0x3d')){var _0x3b681c={};_0x3b681c[_0x589856[_0xaab0('0x2a')]]={'$like':'%'+_0x5bada7['query'][_0xaab0('0x3b')]+'%'};return _0x3b681c;}})});}_0x19c2b2=_[_0xaab0('0x3c')]({},_0x19c2b2,_0x5bada7[_0xaab0('0x3e')]);var _0x5ade55={'where':_0x19c2b2[_0xaab0('0x39')]};return db[_0xaab0('0x2d')]['count'](_0x5ade55)[_0xaab0('0x26')](function(_0x2e58ce){_0x3dd07b[_0xaab0('0x1e')]=_0x2e58ce;if(_0x5bada7[_0xaab0('0x32')][_0xaab0('0x3f')]){_0x19c2b2['include']=[{'all':!![]}];}return db[_0xaab0('0x2d')][_0xaab0('0x40')](_0x19c2b2);})[_0xaab0('0x26')](function(_0xb12582){_0x3dd07b[_0xaab0('0x41')]=_0xb12582;return _0x3dd07b;})[_0xaab0('0x26')](respondWithFilteredResult(_0x49823c,_0x19c2b2))[_0xaab0('0x42')](handleError(_0x49823c,null));};exports['show']=function(_0x54a259,_0x45b027){var _0x398bec={'raw':![],'where':{'id':_0x54a259[_0xaab0('0x43')]['id']}},_0x4ceb00={};_0x4ceb00['model']=_[_0xaab0('0x44')](db[_0xaab0('0x2d')]['rawAttributes']);_0x4ceb00['query']=_[_0xaab0('0x44')](_0x54a259[_0xaab0('0x32')]);_0x4ceb00[_0xaab0('0x33')]=_[_0xaab0('0x34')](_0x4ceb00[_0xaab0('0x31')],_0x4ceb00[_0xaab0('0x32')]);_0x398bec[_0xaab0('0x35')]=_[_0xaab0('0x34')](_0x4ceb00['model'],qs[_0xaab0('0x36')](_0x54a259[_0xaab0('0x32')][_0xaab0('0x36')]));_0x398bec[_0xaab0('0x35')]=_0x398bec[_0xaab0('0x35')][_0xaab0('0x45')]?_0x398bec[_0xaab0('0x35')]:_0x4ceb00['model'];if(_0x54a259[_0xaab0('0x32')][_0xaab0('0x3f')]){_0x398bec[_0xaab0('0x46')]=[{'all':!![]}];}_0x398bec=_[_0xaab0('0x3c')]({},_0x398bec,_0x54a259[_0xaab0('0x3e')]);return db[_0xaab0('0x2d')][_0xaab0('0x47')](_0x398bec)['then'](handleEntityNotFound(_0x45b027,null))[_0xaab0('0x26')](respondWithResult(_0x45b027,null))[_0xaab0('0x42')](handleError(_0x45b027,null));};exports[_0xaab0('0x48')]=function(_0x167d78,_0x8ffc71){return db[_0xaab0('0x2d')]['create'](_0x167d78['body'],{})[_0xaab0('0x26')](respondWithResult(_0x8ffc71,0xc9))['catch'](handleError(_0x8ffc71,null));};exports[_0xaab0('0x49')]=function(_0x2e3c8a,_0x36dcb2){return db[_0xaab0('0x2d')][_0xaab0('0x49')](_0x2e3c8a[_0xaab0('0x4a')],{'raw':![],'individualHooks':!![]})[_0xaab0('0x26')](respondWithResult(_0x36dcb2,0xc9))['catch'](handleError(_0x36dcb2,null));};exports[_0xaab0('0x4b')]=function(_0x538948,_0x2cdc99){if(_0x538948[_0xaab0('0x4a')]['id']){delete _0x538948[_0xaab0('0x4a')]['id'];}return db['AnalyticFieldReport'][_0xaab0('0x47')]({'where':{'id':_0x538948[_0xaab0('0x43')]['id']}})['then'](handleEntityNotFound(_0x2cdc99,null))[_0xaab0('0x26')](saveUpdates(_0x538948[_0xaab0('0x4a')],null))[_0xaab0('0x26')](respondWithResult(_0x2cdc99,null))['catch'](handleError(_0x2cdc99,null));};exports['destroy']=function(_0x1f46b6,_0x49a3f9){return db[_0xaab0('0x2d')][_0xaab0('0x47')]({'where':{'id':_0x1f46b6[_0xaab0('0x43')]['id']}})['then'](handleEntityNotFound(_0x49a3f9,null))[_0xaab0('0x26')](removeEntity(_0x49a3f9,null))['catch'](handleError(_0x49a3f9,null));};exports[_0xaab0('0x4c')]=function(_0x1871a2,_0x4a2ce5){return db['AnalyticFieldReport'][_0xaab0('0x27')]({'where':{'id':_0x1871a2[_0xaab0('0x32')][_0xaab0('0x4d')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x4a2ce5,0xcc))[_0xaab0('0x42')](handleError(_0x4a2ce5,null));};exports[_0xaab0('0x4e')]=function(_0x78696f,_0x46cb2f,_0x406217){return db[_0xaab0('0x4f')][_0xaab0('0x50')]({'where':{'id':_0x78696f['params']['id']}})['then'](handleEntityNotFound(_0x46cb2f,null))['then'](function(_0x80af22){if(_0x80af22){return db[_0xaab0('0x51')]['transaction'](function(_0x569d93){return db['AnalyticFieldReport'][_0xaab0('0x27')]({'where':{'CustomReportId':_0x78696f[_0xaab0('0x43')]['id']},'transaction':_0x569d93})['then'](function(_0x3683cc){var _0x4b7e3d=_[_0xaab0('0x2c')](_0x78696f[_0xaab0('0x4a')],function(_0x26889e){delete _0x26889e['id'];_0x26889e[_0xaab0('0x52')]=_0x78696f[_0xaab0('0x43')]['id'];return _0x26889e;});return db[_0xaab0('0x2d')][_0xaab0('0x49')](_0x4b7e3d,{'transaction':_0x569d93});});})['then'](function(){return db[_0xaab0('0x2d')][_0xaab0('0x40')]({'where':{'CustomReportId':_0x78696f[_0xaab0('0x43')]['id']}});});}})['then'](respondWithResult(_0x46cb2f,null))['catch'](handleError(_0x46cb2f,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index e14ccef..c78c1d5 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 _0x69e8=['analytics_report_fields','lodash','../../config/logger','moment','bluebird','path','rimraf','./analyticFieldReport.attributes'];(function(_0x1d0c54,_0x5ae9a4){var _0x4baf3d=function(_0x36383c){while(--_0x36383c){_0x1d0c54['push'](_0x1d0c54['shift']());}};_0x4baf3d(++_0x5ae9a4);}(_0x69e8,0x1a9));var _0x869e=function(_0x433110,_0x19bb15){_0x433110=_0x433110-0x0;var _0x44cbc5=_0x69e8[_0x433110];return _0x44cbc5;};'use strict';var _=require(_0x869e('0x0'));var util=require('util');var logger=require(_0x869e('0x1'))('api');var moment=require(_0x869e('0x2'));var BPromise=require(_0x869e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x869e('0x4'));var rimraf=require(_0x869e('0x5'));var config=require('../../config/environment');var attributes=require(_0x869e('0x6'));module['exports']=function(_0x488faa,_0x5cf90f){return _0x488faa['define']('AnalyticFieldReport',attributes,{'tableName':_0x869e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x15d8=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields'];(function(_0x16cec8,_0x4d8d60){var _0x21906b=function(_0x523698){while(--_0x523698){_0x16cec8['push'](_0x16cec8['shift']());}};_0x21906b(++_0x4d8d60);}(_0x15d8,0xc3));var _0x815d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x15d8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x815d('0x0'))(_0x815d('0x1'));var moment=require(_0x815d('0x2'));var BPromise=require(_0x815d('0x3'));var rp=require(_0x815d('0x4'));var fs=require('fs');var path=require(_0x815d('0x5'));var rimraf=require(_0x815d('0x6'));var config=require(_0x815d('0x7'));var attributes=require(_0x815d('0x8'));module[_0x815d('0x9')]=function(_0x310e32,_0xe7adbf){return _0x310e32[_0x815d('0xa')](_0x815d('0xb'),attributes,{'tableName':_0x815d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index b14435c..0ac0adc 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 _0x3571=['then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0xc04c1e,_0x41a274){var _0x5c6225=function(_0x25ee19){while(--_0x25ee19){_0xc04c1e['push'](_0xc04c1e['shift']());}};_0x5c6225(++_0x41a274);}(_0x3571,0x67));var _0x1357=function(_0x516ffb,_0x5b5b42){_0x516ffb=_0x516ffb-0x0;var _0x319667=_0x3571[_0x516ffb];return _0x319667;};'use strict';var _=require(_0x1357('0x0'));var util=require(_0x1357('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1357('0x2'));var fs=require('fs');var Redis=require(_0x1357('0x3'));var db=require(_0x1357('0x4'))['db'];var utils=require(_0x1357('0x5'));var logger=require(_0x1357('0x6'))(_0x1357('0x7'));var config=require(_0x1357('0x8'));var jayson=require(_0x1357('0x9'));var client=jayson[_0x1357('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x58f16b,_0xa6a248,_0x4220f2){return new BPromise(function(_0x273bb9,_0x210428){return client[_0x1357('0xb')](_0x58f16b,_0x4220f2)[_0x1357('0xc')](function(_0x212b88){logger[_0x1357('0xd')](_0x1357('0xe'),_0xa6a248,_0x1357('0xf'));logger[_0x1357('0x10')](_0x1357('0x11'),_0xa6a248,_0x1357('0xf'),JSON[_0x1357('0x12')](_0x212b88));if(_0x212b88[_0x1357('0x13')]){if(_0x212b88[_0x1357('0x13')]['code']===0x1f4){logger[_0x1357('0x13')](_0x1357('0xe'),_0xa6a248,_0x212b88[_0x1357('0x13')]['message']);return _0x210428(_0x212b88[_0x1357('0x13')][_0x1357('0x14')]);}logger[_0x1357('0x13')](_0x1357('0xe'),_0xa6a248,_0x212b88[_0x1357('0x13')][_0x1357('0x14')]);return _0x273bb9(_0x212b88[_0x1357('0x13')][_0x1357('0x14')]);}else{logger[_0x1357('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0xa6a248,_0x1357('0xf'));_0x273bb9(_0x212b88[_0x1357('0x15')][_0x1357('0x14')]);}})[_0x1357('0x16')](function(_0x1a96c3){logger[_0x1357('0x13')](_0x1357('0xe'),_0xa6a248,_0x1a96c3);_0x210428(_0x1a96c3);});});} \ No newline at end of file +var _0x0ca2=['info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0xd3ea95,_0x2cb732){var _0x1f2306=function(_0x26b115){while(--_0x26b115){_0xd3ea95['push'](_0xd3ea95['shift']());}};_0x1f2306(++_0x2cb732);}(_0x0ca2,0x1c0));var _0x20ca=function(_0x125233,_0x522bf1){_0x125233=_0x125233-0x0;var _0x42d385=_0x0ca2[_0x125233];return _0x42d385;};'use strict';var _=require(_0x20ca('0x0'));var util=require(_0x20ca('0x1'));var moment=require(_0x20ca('0x2'));var BPromise=require(_0x20ca('0x3'));var rs=require(_0x20ca('0x4'));var fs=require('fs');var Redis=require(_0x20ca('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x20ca('0x6'))(_0x20ca('0x7'));var config=require(_0x20ca('0x8'));var jayson=require(_0x20ca('0x9'));var client=jayson['client'][_0x20ca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58cff7,_0x3914ec,_0x264852){return new BPromise(function(_0x2a6b7d,_0x13d5bd){return client[_0x20ca('0xb')](_0x58cff7,_0x264852)['then'](function(_0x448146){logger[_0x20ca('0xc')](_0x20ca('0xd'),_0x3914ec,_0x20ca('0xe'));logger[_0x20ca('0xf')](_0x20ca('0x10'),_0x3914ec,_0x20ca('0xe'),JSON[_0x20ca('0x11')](_0x448146));if(_0x448146[_0x20ca('0x12')]){if(_0x448146['error'][_0x20ca('0x13')]===0x1f4){logger[_0x20ca('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3914ec,_0x448146['error'][_0x20ca('0x14')]);return _0x13d5bd(_0x448146[_0x20ca('0x12')]['message']);}logger['error'](_0x20ca('0xd'),_0x3914ec,_0x448146[_0x20ca('0x12')][_0x20ca('0x14')]);return _0x2a6b7d(_0x448146[_0x20ca('0x12')][_0x20ca('0x14')]);}else{logger[_0x20ca('0xc')](_0x20ca('0xd'),_0x3914ec,_0x20ca('0xe'));_0x2a6b7d(_0x448146[_0x20ca('0x15')][_0x20ca('0x14')]);}})[_0x20ca('0x16')](function(_0x59d97b){logger[_0x20ca('0x12')](_0x20ca('0xd'),_0x3914ec,_0x59d97b);_0x13d5bd(_0x59d97b);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index a9bf4a4..7d1fed0 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(_0x29fd64,_0x2446ad){var _0x2b00b7=function(_0x50d454){while(--_0x50d454){_0x29fd64['push'](_0x29fd64['shift']());}};_0x2b00b7(++_0x2446ad);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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(_0x34c719,_0x2a5384){var _0x21d890=function(_0x364a6b){while(--_0x364a6b){_0x34c719['push'](_0x34c719['shift']());}};_0x21d890(++_0x2a5384);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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 05167fb..c53285f 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 _0x6075=['name','STRING','sequelize','exports'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x6075,0x142));var _0x5607=function(_0x4ba5f5,_0xb00659){_0x4ba5f5=_0x4ba5f5-0x0;var _0x3af93f=_0x6075[_0x4ba5f5];return _0x3af93f;};'use strict';var Sequelize=require(_0x5607('0x0'));module[_0x5607('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5607('0x2')},'table':{'type':Sequelize[_0x5607('0x3')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x74f4=['name','STRING','sequelize','exports'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x74f4,0xaa));var _0x474f=function(_0x52cc14,_0x1fc7f4){_0x52cc14=_0x52cc14-0x0;var _0x12ed0c=_0x74f4[_0x52cc14];return _0x12ed0c;};'use strict';var Sequelize=require(_0x474f('0x0'));module[_0x474f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x474f('0x2')},'table':{'type':Sequelize[_0x474f('0x3')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x474f('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 1b7cb6c..a324320 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 _0x1cb9=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','reject','save','update','then','destroy','get','Metrics','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','show','params','keys','length','find','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cb9,0x14e));var _0x91cb=function(_0x2e4837,_0x58859a){_0x2e4837=_0x2e4837-0x0;var _0x124dad=_0x1cb9[_0x2e4837];return _0x124dad;};'use strict';var emlformat=require(_0x91cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91cb('0x1'));var jsonpatch=require(_0x91cb('0x2'));var rp=require(_0x91cb('0x3'));var moment=require(_0x91cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91cb('0x5'));var util=require(_0x91cb('0x6'));var path=require('path');var sox=require(_0x91cb('0x7'));var csv=require(_0x91cb('0x8'));var ejs=require(_0x91cb('0x9'));var fs=require('fs');var fs_extra=require(_0x91cb('0xa'));var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x8'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];function respondWithStatusCode(_0x366f09,_0x4ba2f2){_0x4ba2f2=_0x4ba2f2||0xcc;return function(_0x20e6e0){if(_0x20e6e0){return _0x366f09[_0x91cb('0x19')](_0x4ba2f2);}return _0x366f09[_0x91cb('0x1a')](_0x4ba2f2)[_0x91cb('0x1b')]();};}function respondWithResult(_0x4a7d45,_0x4cc6ef){_0x4cc6ef=_0x4cc6ef||0xc8;return function(_0x4aae25){if(_0x4aae25){return _0x4a7d45[_0x91cb('0x1a')](_0x4cc6ef)['json'](_0x4aae25);}};}function respondWithFilteredResult(_0x528f73,_0x576369){return function(_0xc3629e){if(_0xc3629e){var _0x347980=typeof _0x576369['offset']===_0x91cb('0x1c')&&typeof _0x576369[_0x91cb('0x1d')]==='undefined';var _0xc594e3=_0xc3629e[_0x91cb('0x1e')];var _0x1cd34b=_0x347980?0x0:_0x576369[_0x91cb('0x1f')];var _0x5cc1c3=_0x347980?_0xc3629e[_0x91cb('0x1e')]:_0x576369[_0x91cb('0x1f')]+_0x576369['limit'];var _0x123847;if(_0x5cc1c3>=_0xc594e3){_0x5cc1c3=_0xc594e3;_0x123847=0xc8;}else{_0x123847=0xce;}_0x528f73['status'](_0x123847);return _0x528f73['set'](_0x91cb('0x20'),_0x1cd34b+'-'+_0x5cc1c3+'/'+_0xc594e3)[_0x91cb('0x21')](_0xc3629e);}return null;};}function patchUpdates(_0x56e409){return function(_0x51a1d5){try{jsonpatch['apply'](_0x51a1d5,_0x56e409,!![]);}catch(_0x438162){return BPromise[_0x91cb('0x22')](_0x438162);}return _0x51a1d5[_0x91cb('0x23')]();};}function saveUpdates(_0x1dbee2,_0x5c6a15){return function(_0x45c4b3){if(_0x45c4b3){return _0x45c4b3[_0x91cb('0x24')](_0x1dbee2)[_0x91cb('0x25')](function(_0x55fa78){return _0x55fa78;});}return null;};}function removeEntity(_0x26f18f,_0x1a7a54){return function(_0x2447e7){if(_0x2447e7){return _0x2447e7[_0x91cb('0x26')]()[_0x91cb('0x25')](function(){var _0x7ad361=_0x2447e7[_0x91cb('0x27')]({'plain':!![]});var _0x423c4f=_0x91cb('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x423c4f,'resourceId':_0x7ad361['id']}})[_0x91cb('0x25')](function(){return _0x2447e7;});})['then'](function(){_0x26f18f[_0x91cb('0x1a')](0xcc)[_0x91cb('0x1b')]();});}};}function handleEntityNotFound(_0x318031,_0x5595c5){return function(_0x9b26a6){if(!_0x9b26a6){_0x318031['sendStatus'](0x194);}return _0x9b26a6;};}function handleError(_0x4572f6,_0x308e8c){_0x308e8c=_0x308e8c||0x1f4;return function(_0x3b3ee6){logger[_0x91cb('0x29')](_0x3b3ee6[_0x91cb('0x2a')]);if(_0x3b3ee6['name']){delete _0x3b3ee6[_0x91cb('0x2b')];}_0x4572f6['status'](_0x308e8c)[_0x91cb('0x2c')](_0x3b3ee6);};}exports[_0x91cb('0x2d')]=function(_0x445fe1,_0x4944bd){var _0x775c25={},_0x146e1f={},_0x25bbf9={'count':0x0,'rows':[]};var _0x361e4c=_[_0x91cb('0x2e')](db[_0x91cb('0x2f')][_0x91cb('0x30')],function(_0x3bbde3){return{'name':_0x3bbde3[_0x91cb('0x31')],'type':_0x3bbde3['type'][_0x91cb('0x32')]};});_0x146e1f[_0x91cb('0x33')]=_[_0x91cb('0x2e')](_0x361e4c,_0x91cb('0x2b'));_0x146e1f[_0x91cb('0x34')]=_['keys'](_0x445fe1[_0x91cb('0x34')]);_0x146e1f[_0x91cb('0x35')]=_[_0x91cb('0x36')](_0x146e1f[_0x91cb('0x33')],_0x146e1f[_0x91cb('0x34')]);_0x775c25['attributes']=_[_0x91cb('0x36')](_0x146e1f['model'],qs['fields'](_0x445fe1['query'][_0x91cb('0x37')]));_0x775c25['attributes']=_0x775c25[_0x91cb('0x38')]['length']?_0x775c25['attributes']:_0x146e1f[_0x91cb('0x33')];if(!_0x445fe1[_0x91cb('0x34')][_0x91cb('0x39')](_0x91cb('0x3a'))){_0x775c25[_0x91cb('0x1d')]=qs['limit'](_0x445fe1[_0x91cb('0x34')][_0x91cb('0x1d')]);_0x775c25[_0x91cb('0x1f')]=qs[_0x91cb('0x1f')](_0x445fe1['query']['offset']);}_0x775c25[_0x91cb('0x3b')]=qs[_0x91cb('0x3c')](_0x445fe1['query'][_0x91cb('0x3c')]);_0x775c25[_0x91cb('0x3d')]=qs['filters'](_[_0x91cb('0x3e')](_0x445fe1[_0x91cb('0x34')],_0x146e1f['filters']),_0x361e4c);if(_0x445fe1[_0x91cb('0x34')]['filter']){_0x775c25[_0x91cb('0x3d')]=_[_0x91cb('0x3f')](_0x775c25[_0x91cb('0x3d')],{'$or':_[_0x91cb('0x2e')](_0x361e4c,function(_0x51d0ea){if(_0x51d0ea[_0x91cb('0x40')]!=='VIRTUAL'){var _0xa90111={};_0xa90111[_0x51d0ea[_0x91cb('0x2b')]]={'$like':'%'+_0x445fe1['query'][_0x91cb('0x41')]+'%'};return _0xa90111;}})});}_0x775c25=_['merge']({},_0x775c25,_0x445fe1[_0x91cb('0x42')]);var _0x2eac87={'where':_0x775c25[_0x91cb('0x3d')]};return db[_0x91cb('0x2f')]['count'](_0x2eac87)[_0x91cb('0x25')](function(_0x5af0e6){_0x25bbf9[_0x91cb('0x1e')]=_0x5af0e6;if(_0x445fe1[_0x91cb('0x34')][_0x91cb('0x43')]){_0x775c25[_0x91cb('0x44')]=[{'all':!![]}];}return db[_0x91cb('0x2f')][_0x91cb('0x45')](_0x775c25);})[_0x91cb('0x25')](function(_0x3cc4c1){_0x25bbf9['rows']=_0x3cc4c1;return _0x25bbf9;})[_0x91cb('0x25')](respondWithFilteredResult(_0x4944bd,_0x775c25))['catch'](handleError(_0x4944bd,null));};exports[_0x91cb('0x46')]=function(_0x5537a0,_0x335879){var _0x52e82c={'raw':!![],'where':{'id':_0x5537a0[_0x91cb('0x47')]['id']}},_0x138f48={};_0x138f48[_0x91cb('0x33')]=_[_0x91cb('0x48')](db['AnalyticMetric'][_0x91cb('0x30')]);_0x138f48[_0x91cb('0x34')]=_['keys'](_0x5537a0[_0x91cb('0x34')]);_0x138f48[_0x91cb('0x35')]=_[_0x91cb('0x36')](_0x138f48[_0x91cb('0x33')],_0x138f48[_0x91cb('0x34')]);_0x52e82c[_0x91cb('0x38')]=_[_0x91cb('0x36')](_0x138f48[_0x91cb('0x33')],qs[_0x91cb('0x37')](_0x5537a0['query'][_0x91cb('0x37')]));_0x52e82c[_0x91cb('0x38')]=_0x52e82c[_0x91cb('0x38')][_0x91cb('0x49')]?_0x52e82c[_0x91cb('0x38')]:_0x138f48[_0x91cb('0x33')];if(_0x5537a0[_0x91cb('0x34')][_0x91cb('0x43')]){_0x52e82c['include']=[{'all':!![]}];}_0x52e82c=_[_0x91cb('0x3f')]({},_0x52e82c,_0x5537a0[_0x91cb('0x42')]);return db[_0x91cb('0x2f')][_0x91cb('0x4a')](_0x52e82c)['then'](handleEntityNotFound(_0x335879,null))[_0x91cb('0x25')](respondWithResult(_0x335879,null))[_0x91cb('0x4b')](handleError(_0x335879,null));};exports['create']=function(_0x212473,_0x47cdb7){return db[_0x91cb('0x2f')]['create'](_0x212473['body'],{})['then'](function(_0x98245b){var _0xff3d11=_0x212473[_0x91cb('0x4c')][_0x91cb('0x27')]({'plain':!![]});if(!_0xff3d11)throw new Error(_0x91cb('0x4d'));if(_0xff3d11['role']==='user'){var _0x1d26b8=_0x98245b[_0x91cb('0x27')]({'plain':!![]});var _0x140994=_0x91cb('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x140994,'userProfileId':_0xff3d11['userProfileId']},'raw':!![]})[_0x91cb('0x25')](function(_0x490417){if(_0x490417&&_0x490417[_0x91cb('0x4e')]===0x0){return db['UserProfileResource'][_0x91cb('0x4f')]({'name':_0x1d26b8[_0x91cb('0x2b')],'resourceId':_0x1d26b8['id'],'type':_0x490417[_0x91cb('0x2b')],'sectionId':_0x490417['id']},{})[_0x91cb('0x25')](function(){return _0x98245b;});}else{return _0x98245b;}})[_0x91cb('0x4b')](function(_0x362532){logger[_0x91cb('0x29')](_0x91cb('0x50'),_0x362532);throw _0x362532;});}return _0x98245b;})[_0x91cb('0x25')](respondWithResult(_0x47cdb7,0xc9))[_0x91cb('0x4b')](handleError(_0x47cdb7,null));};exports[_0x91cb('0x24')]=function(_0x5752ed,_0x1e445a){if(_0x5752ed[_0x91cb('0x51')]['id']){delete _0x5752ed['body']['id'];}return db[_0x91cb('0x2f')][_0x91cb('0x4a')]({'where':{'id':_0x5752ed['params']['id']}})[_0x91cb('0x25')](handleEntityNotFound(_0x1e445a,null))[_0x91cb('0x25')](saveUpdates(_0x5752ed[_0x91cb('0x51')],null))[_0x91cb('0x25')](respondWithResult(_0x1e445a,null))[_0x91cb('0x4b')](handleError(_0x1e445a,null));};exports[_0x91cb('0x26')]=function(_0x1d4b96,_0x274fff){return db[_0x91cb('0x2f')][_0x91cb('0x4a')]({'where':{'id':_0x1d4b96[_0x91cb('0x47')]['id']}})['then'](handleEntityNotFound(_0x274fff,null))[_0x91cb('0x25')](removeEntity(_0x274fff,null))['catch'](handleError(_0x274fff,null));}; \ No newline at end of file +var _0x7fbe=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','get','UserProfileResource','destroy','end','error','stack','name','send','index','AnalyticMetric','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','rows','show','params','create','body','role','user','Metrics','find','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x1a53ea,_0x13cb83){var _0x227ec0=function(_0x43df7b){while(--_0x43df7b){_0x1a53ea['push'](_0x1a53ea['shift']());}};_0x227ec0(++_0x13cb83);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x301ca3,_0x4233c5){_0x301ca3=_0x301ca3-0x0;var _0x131292=_0x7fbe[_0x301ca3];return _0x131292;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe7fb('0x0'));var jsonpatch=require(_0xe7fb('0x1'));var rp=require(_0xe7fb('0x2'));var moment=require(_0xe7fb('0x3'));var BPromise=require(_0xe7fb('0x4'));var Mustache=require(_0xe7fb('0x5'));var util=require(_0xe7fb('0x6'));var path=require(_0xe7fb('0x7'));var sox=require(_0xe7fb('0x8'));var csv=require(_0xe7fb('0x9'));var ejs=require(_0xe7fb('0xa'));var fs=require('fs');var fs_extra=require(_0xe7fb('0xb'));var _=require(_0xe7fb('0xc'));var squel=require(_0xe7fb('0xd'));var crypto=require('crypto');var jsforce=require(_0xe7fb('0xe'));var deskjs=require(_0xe7fb('0xf'));var toCsv=require(_0xe7fb('0x9'));var querystring=require(_0xe7fb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7fb('0x11'));var qs=require(_0xe7fb('0x12'));var as=require(_0xe7fb('0x13'));var hardwareService=require(_0xe7fb('0x14'));var logger=require(_0xe7fb('0x15'))(_0xe7fb('0x16'));var utils=require(_0xe7fb('0x17'));var config=require(_0xe7fb('0x18'));var licenseUtil=require(_0xe7fb('0x19'));var db=require(_0xe7fb('0x1a'))['db'];function respondWithStatusCode(_0x2437d4,_0x188e1d){_0x188e1d=_0x188e1d||0xcc;return function(_0xdf9760){if(_0xdf9760){return _0x2437d4[_0xe7fb('0x1b')](_0x188e1d);}return _0x2437d4[_0xe7fb('0x1c')](_0x188e1d)['end']();};}function respondWithResult(_0x278b75,_0x2225e5){_0x2225e5=_0x2225e5||0xc8;return function(_0x5573ab){if(_0x5573ab){return _0x278b75[_0xe7fb('0x1c')](_0x2225e5)[_0xe7fb('0x1d')](_0x5573ab);}};}function respondWithFilteredResult(_0x482f7d,_0xa76acf){return function(_0x559129){if(_0x559129){var _0x12fff6=typeof _0xa76acf[_0xe7fb('0x1e')]===_0xe7fb('0x1f')&&typeof _0xa76acf[_0xe7fb('0x20')]==='undefined';var _0x892b0f=_0x559129['count'];var _0x293a47=_0x12fff6?0x0:_0xa76acf['offset'];var _0x1e77fd=_0x12fff6?_0x559129[_0xe7fb('0x21')]:_0xa76acf[_0xe7fb('0x1e')]+_0xa76acf[_0xe7fb('0x20')];var _0x5df1a1;if(_0x1e77fd>=_0x892b0f){_0x1e77fd=_0x892b0f;_0x5df1a1=0xc8;}else{_0x5df1a1=0xce;}_0x482f7d[_0xe7fb('0x1c')](_0x5df1a1);return _0x482f7d['set'](_0xe7fb('0x22'),_0x293a47+'-'+_0x1e77fd+'/'+_0x892b0f)['json'](_0x559129);}return null;};}function patchUpdates(_0x15f7a4){return function(_0x4ea664){try{jsonpatch[_0xe7fb('0x23')](_0x4ea664,_0x15f7a4,!![]);}catch(_0x135624){return BPromise['reject'](_0x135624);}return _0x4ea664[_0xe7fb('0x24')]();};}function saveUpdates(_0x4742bd,_0x3ae8f1){return function(_0x4dcb4b){if(_0x4dcb4b){return _0x4dcb4b[_0xe7fb('0x25')](_0x4742bd)[_0xe7fb('0x26')](function(_0x5da3d9){return _0x5da3d9;});}return null;};}function removeEntity(_0x5bea27,_0x52f08b){return function(_0x35e4db){if(_0x35e4db){return _0x35e4db['destroy']()['then'](function(){var _0x4026b1=_0x35e4db[_0xe7fb('0x27')]({'plain':!![]});var _0x2996ae='Metrics';return db[_0xe7fb('0x28')][_0xe7fb('0x29')]({'where':{'type':_0x2996ae,'resourceId':_0x4026b1['id']}})[_0xe7fb('0x26')](function(){return _0x35e4db;});})[_0xe7fb('0x26')](function(){_0x5bea27[_0xe7fb('0x1c')](0xcc)[_0xe7fb('0x2a')]();});}};}function handleEntityNotFound(_0x380130,_0x59e015){return function(_0x5df9f2){if(!_0x5df9f2){_0x380130[_0xe7fb('0x1b')](0x194);}return _0x5df9f2;};}function handleError(_0x3bdee9,_0xead63){_0xead63=_0xead63||0x1f4;return function(_0x4fd290){logger[_0xe7fb('0x2b')](_0x4fd290[_0xe7fb('0x2c')]);if(_0x4fd290[_0xe7fb('0x2d')]){delete _0x4fd290[_0xe7fb('0x2d')];}_0x3bdee9[_0xe7fb('0x1c')](_0xead63)[_0xe7fb('0x2e')](_0x4fd290);};}exports[_0xe7fb('0x2f')]=function(_0x3dd0be,_0x4ce993){var _0x3d1fb5={},_0x1742f3={},_0x29d1ca={'count':0x0,'rows':[]};var _0x547a04=_['map'](db[_0xe7fb('0x30')]['rawAttributes'],function(_0xac56b4){return{'name':_0xac56b4[_0xe7fb('0x31')],'type':_0xac56b4[_0xe7fb('0x32')][_0xe7fb('0x33')]};});_0x1742f3['model']=_[_0xe7fb('0x34')](_0x547a04,_0xe7fb('0x2d'));_0x1742f3[_0xe7fb('0x35')]=_[_0xe7fb('0x36')](_0x3dd0be[_0xe7fb('0x35')]);_0x1742f3['filters']=_[_0xe7fb('0x37')](_0x1742f3[_0xe7fb('0x38')],_0x1742f3[_0xe7fb('0x35')]);_0x3d1fb5[_0xe7fb('0x39')]=_[_0xe7fb('0x37')](_0x1742f3[_0xe7fb('0x38')],qs[_0xe7fb('0x3a')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3a')]));_0x3d1fb5['attributes']=_0x3d1fb5[_0xe7fb('0x39')][_0xe7fb('0x3b')]?_0x3d1fb5[_0xe7fb('0x39')]:_0x1742f3['model'];if(!_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3c')](_0xe7fb('0x3d'))){_0x3d1fb5[_0xe7fb('0x20')]=qs[_0xe7fb('0x20')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x20')]);_0x3d1fb5[_0xe7fb('0x1e')]=qs[_0xe7fb('0x1e')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x1e')]);}_0x3d1fb5[_0xe7fb('0x3e')]=qs[_0xe7fb('0x3f')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3f')]);_0x3d1fb5[_0xe7fb('0x40')]=qs[_0xe7fb('0x41')](_[_0xe7fb('0x42')](_0x3dd0be[_0xe7fb('0x35')],_0x1742f3['filters']),_0x547a04);if(_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x43')]){_0x3d1fb5[_0xe7fb('0x40')]=_[_0xe7fb('0x44')](_0x3d1fb5['where'],{'$or':_[_0xe7fb('0x34')](_0x547a04,function(_0x186418){if(_0x186418[_0xe7fb('0x32')]!==_0xe7fb('0x45')){var _0x49fe9d={};_0x49fe9d[_0x186418[_0xe7fb('0x2d')]]={'$like':'%'+_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x43')]+'%'};return _0x49fe9d;}})});}_0x3d1fb5=_[_0xe7fb('0x44')]({},_0x3d1fb5,_0x3dd0be[_0xe7fb('0x46')]);var _0xb729fc={'where':_0x3d1fb5['where']};return db[_0xe7fb('0x30')][_0xe7fb('0x21')](_0xb729fc)[_0xe7fb('0x26')](function(_0x4b263d){_0x29d1ca[_0xe7fb('0x21')]=_0x4b263d;if(_0x3dd0be[_0xe7fb('0x35')]['includeAll']){_0x3d1fb5['include']=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x3d1fb5);})['then'](function(_0x900d67){_0x29d1ca[_0xe7fb('0x47')]=_0x900d67;return _0x29d1ca;})[_0xe7fb('0x26')](respondWithFilteredResult(_0x4ce993,_0x3d1fb5))['catch'](handleError(_0x4ce993,null));};exports[_0xe7fb('0x48')]=function(_0x58d743,_0x19277f){var _0x32cfa4={'raw':!![],'where':{'id':_0x58d743[_0xe7fb('0x49')]['id']}},_0x4d29d3={};_0x4d29d3[_0xe7fb('0x38')]=_[_0xe7fb('0x36')](db[_0xe7fb('0x30')]['rawAttributes']);_0x4d29d3[_0xe7fb('0x35')]=_[_0xe7fb('0x36')](_0x58d743[_0xe7fb('0x35')]);_0x4d29d3['filters']=_[_0xe7fb('0x37')](_0x4d29d3[_0xe7fb('0x38')],_0x4d29d3[_0xe7fb('0x35')]);_0x32cfa4[_0xe7fb('0x39')]=_[_0xe7fb('0x37')](_0x4d29d3['model'],qs[_0xe7fb('0x3a')](_0x58d743['query'][_0xe7fb('0x3a')]));_0x32cfa4[_0xe7fb('0x39')]=_0x32cfa4[_0xe7fb('0x39')][_0xe7fb('0x3b')]?_0x32cfa4[_0xe7fb('0x39')]:_0x4d29d3['model'];if(_0x58d743[_0xe7fb('0x35')]['includeAll']){_0x32cfa4['include']=[{'all':!![]}];}_0x32cfa4=_[_0xe7fb('0x44')]({},_0x32cfa4,_0x58d743[_0xe7fb('0x46')]);return db[_0xe7fb('0x30')]['find'](_0x32cfa4)[_0xe7fb('0x26')](handleEntityNotFound(_0x19277f,null))[_0xe7fb('0x26')](respondWithResult(_0x19277f,null))['catch'](handleError(_0x19277f,null));};exports['create']=function(_0x284bcb,_0x42270b){return db[_0xe7fb('0x30')][_0xe7fb('0x4a')](_0x284bcb[_0xe7fb('0x4b')],{})[_0xe7fb('0x26')](function(_0x18a590){var _0x347177=_0x284bcb['user'][_0xe7fb('0x27')]({'plain':!![]});if(!_0x347177)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x347177[_0xe7fb('0x4c')]===_0xe7fb('0x4d')){var _0x5cedfb=_0x18a590[_0xe7fb('0x27')]({'plain':!![]});var _0x5efd24=_0xe7fb('0x4e');return db['UserProfileSection'][_0xe7fb('0x4f')]({'where':{'name':_0x5efd24,'userProfileId':_0x347177['userProfileId']},'raw':!![]})[_0xe7fb('0x26')](function(_0x59158c){if(_0x59158c&&_0x59158c[_0xe7fb('0x50')]===0x0){return db[_0xe7fb('0x28')][_0xe7fb('0x4a')]({'name':_0x5cedfb[_0xe7fb('0x2d')],'resourceId':_0x5cedfb['id'],'type':_0x59158c[_0xe7fb('0x2d')],'sectionId':_0x59158c['id']},{})[_0xe7fb('0x26')](function(){return _0x18a590;});}else{return _0x18a590;}})[_0xe7fb('0x51')](function(_0x582a4a){logger['error'](_0xe7fb('0x52'),_0x582a4a);throw _0x582a4a;});}return _0x18a590;})['then'](respondWithResult(_0x42270b,0xc9))['catch'](handleError(_0x42270b,null));};exports['update']=function(_0x50b8df,_0x539252){if(_0x50b8df[_0xe7fb('0x4b')]['id']){delete _0x50b8df[_0xe7fb('0x4b')]['id'];}return db[_0xe7fb('0x30')][_0xe7fb('0x4f')]({'where':{'id':_0x50b8df['params']['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x539252,null))[_0xe7fb('0x26')](saveUpdates(_0x50b8df[_0xe7fb('0x4b')],null))['then'](respondWithResult(_0x539252,null))['catch'](handleError(_0x539252,null));};exports[_0xe7fb('0x29')]=function(_0x377e5f,_0x300b8e){return db['AnalyticMetric'][_0xe7fb('0x4f')]({'where':{'id':_0x377e5f[_0xe7fb('0x49')]['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x300b8e,null))[_0xe7fb('0x26')](removeEntity(_0x300b8e,null))['catch'](handleError(_0x300b8e,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 49771e0..8206502 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 _0x872a=['exports','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','path','rimraf','../../config/environment','./analyticMetric.attributes'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x872a,0x100));var _0xa872=function(_0x5f0085,_0xde7f4){_0x5f0085=_0x5f0085-0x0;var _0x57e491=_0x872a[_0x5f0085];return _0x57e491;};'use strict';var _=require(_0xa872('0x0'));var util=require(_0xa872('0x1'));var logger=require(_0xa872('0x2'))(_0xa872('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa872('0x4'));var rimraf=require(_0xa872('0x5'));var config=require(_0xa872('0x6'));var attributes=require(_0xa872('0x7'));module[_0xa872('0x8')]=function(_0x1c8d2f,_0x3e3cd4){return _0x1c8d2f['define'](_0xa872('0x9'),attributes,{'tableName':_0xa872('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc86=['../../config/environment','exports','define','AnalyticMetric','analytics_metrics','util','api','bluebird','request-promise','path','rimraf'];(function(_0x32bf3b,_0xfb8518){var _0x5c74a4=function(_0x317a74){while(--_0x317a74){_0x32bf3b['push'](_0x32bf3b['shift']());}};_0x5c74a4(++_0xfb8518);}(_0xdc86,0x118));var _0x6dc8=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xdc86[_0x599f41];return _0x2e4d58;};'use strict';var _=require('lodash');var util=require(_0x6dc8('0x0'));var logger=require('../../config/logger')(_0x6dc8('0x1'));var moment=require('moment');var BPromise=require(_0x6dc8('0x2'));var rp=require(_0x6dc8('0x3'));var fs=require('fs');var path=require(_0x6dc8('0x4'));var rimraf=require(_0x6dc8('0x5'));var config=require(_0x6dc8('0x6'));var attributes=require('./analyticMetric.attributes');module[_0x6dc8('0x7')]=function(_0x3109bf,_0xbc9bc4){return _0x3109bf[_0x6dc8('0x8')](_0x6dc8('0x9'),attributes,{'tableName':_0x6dc8('0xa'),'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 0ef2cd5..1daa424 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 _0xd29d=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','code','message','error','result','lodash','moment','randomstring'];(function(_0x14f21c,_0x315b28){var _0x2b509b=function(_0x19ea1f){while(--_0x19ea1f){_0x14f21c['push'](_0x14f21c['shift']());}};_0x2b509b(++_0x315b28);}(_0xd29d,0xe4));var _0xdd29=function(_0x4224f9,_0x4e33fe){_0x4224f9=_0x4224f9-0x0;var _0xb36a10=_0xd29d[_0x4224f9];return _0xb36a10;};'use strict';var _=require(_0xdd29('0x0'));var util=require('util');var moment=require(_0xdd29('0x1'));var BPromise=require('bluebird');var rs=require(_0xdd29('0x2'));var fs=require('fs');var Redis=require(_0xdd29('0x3'));var db=require(_0xdd29('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdd29('0x5'));var config=require(_0xdd29('0x6'));var jayson=require(_0xdd29('0x7'));var client=jayson[_0xdd29('0x8')][_0xdd29('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x71fb13,_0x29b1d8,_0x465858){return new BPromise(function(_0xe00969,_0xfbe12d){return client[_0xdd29('0xa')](_0x71fb13,_0x465858)[_0xdd29('0xb')](function(_0x4e450f){logger[_0xdd29('0xc')](_0xdd29('0xd'),_0x29b1d8,_0xdd29('0xe'));logger[_0xdd29('0xf')](_0xdd29('0x10'),_0x29b1d8,_0xdd29('0xe'),JSON['stringify'](_0x4e450f));if(_0x4e450f['error']){if(_0x4e450f['error'][_0xdd29('0x11')]===0x1f4){logger['error'](_0xdd29('0xd'),_0x29b1d8,_0x4e450f['error'][_0xdd29('0x12')]);return _0xfbe12d(_0x4e450f[_0xdd29('0x13')][_0xdd29('0x12')]);}logger[_0xdd29('0x13')](_0xdd29('0xd'),_0x29b1d8,_0x4e450f['error'][_0xdd29('0x12')]);return _0xe00969(_0x4e450f['error'][_0xdd29('0x12')]);}else{logger[_0xdd29('0xc')]('AnalyticMetric,\x20%s,\x20%s',_0x29b1d8,'request\x20sent');_0xe00969(_0x4e450f[_0xdd29('0x14')][_0xdd29('0x12')]);}})['catch'](function(_0x3aca7d){logger[_0xdd29('0x13')](_0xdd29('0xd'),_0x29b1d8,_0x3aca7d);_0xfbe12d(_0x3aca7d);});});} \ No newline at end of file +var _0x8384=['result','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0x8384,0xa2));var _0x4838=function(_0x131eb1,_0x55b270){_0x131eb1=_0x131eb1-0x0;var _0x3a3b7a=_0x8384[_0x131eb1];return _0x3a3b7a;};'use strict';var _=require(_0x4838('0x0'));var util=require('util');var moment=require(_0x4838('0x1'));var BPromise=require(_0x4838('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4838('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4838('0x4'));var logger=require(_0x4838('0x5'))(_0x4838('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4838('0x7')][_0x4838('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x598bb3,_0x37e7ab,_0x859be0){return new BPromise(function(_0x1cb9e8,_0x43d5c5){return client[_0x4838('0x9')](_0x598bb3,_0x859be0)[_0x4838('0xa')](function(_0x784cb1){logger['info'](_0x4838('0xb'),_0x37e7ab,_0x4838('0xc'));logger['debug']('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x37e7ab,_0x4838('0xc'),JSON[_0x4838('0xd')](_0x784cb1));if(_0x784cb1['error']){if(_0x784cb1[_0x4838('0xe')][_0x4838('0xf')]===0x1f4){logger[_0x4838('0xe')](_0x4838('0xb'),_0x37e7ab,_0x784cb1['error']['message']);return _0x43d5c5(_0x784cb1[_0x4838('0xe')][_0x4838('0x10')]);}logger['error'](_0x4838('0xb'),_0x37e7ab,_0x784cb1[_0x4838('0xe')]['message']);return _0x1cb9e8(_0x784cb1[_0x4838('0xe')][_0x4838('0x10')]);}else{logger[_0x4838('0x11')](_0x4838('0xb'),_0x37e7ab,'request\x20sent');_0x1cb9e8(_0x784cb1[_0x4838('0x12')]['message']);}})[_0x4838('0x13')](function(_0x1ba060){logger[_0x4838('0xe')](_0x4838('0xb'),_0x37e7ab,_0x1ba060);_0x43d5c5(_0x1ba060);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index ab343e4..2761bae 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 _0x29d4=['put','update','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','create'];(function(_0x2a6109,_0x47853d){var _0x36c3d9=function(_0x4194c7){while(--_0x4194c7){_0x2a6109['push'](_0x2a6109['shift']());}};_0x36c3d9(++_0x47853d);}(_0x29d4,0x1a1));var _0x429d=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0x29d4[_0x21aec3];return _0x288bbc;};'use strict';var multer=require(_0x429d('0x0'));var util=require('util');var path=require(_0x429d('0x1'));var timeout=require(_0x429d('0x2'));var express=require(_0x429d('0x3'));var router=express[_0x429d('0x4')]();var fs_extra=require(_0x429d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x429d('0x6'));var config=require(_0x429d('0x7'));var controller=require(_0x429d('0x8'));router[_0x429d('0x9')]('/',auth[_0x429d('0xa')](),controller[_0x429d('0xb')]);router[_0x429d('0x9')](_0x429d('0xc'),auth['isAuthenticated'](),controller[_0x429d('0xd')]);router['post']('/',auth[_0x429d('0xa')](),controller[_0x429d('0xe')]);router[_0x429d('0xf')]('/:id',auth[_0x429d('0xa')](),controller[_0x429d('0x10')]);router['delete'](_0x429d('0xc'),auth[_0x429d('0xa')](),controller[_0x429d('0x11')]);module['exports']=router; \ No newline at end of file +var _0x85d8=['isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x48f9d2,_0x33ba0d){var _0x5228da=function(_0x20e0cc){while(--_0x20e0cc){_0x48f9d2['push'](_0x48f9d2['shift']());}};_0x5228da(++_0x33ba0d);}(_0x85d8,0x1b0));var _0x885d=function(_0x279004,_0x358748){_0x279004=_0x279004-0x0;var _0x272f09=_0x85d8[_0x279004];return _0x272f09;};'use strict';var multer=require(_0x885d('0x0'));var util=require(_0x885d('0x1'));var path=require(_0x885d('0x2'));var timeout=require(_0x885d('0x3'));var express=require(_0x885d('0x4'));var router=express['Router']();var fs_extra=require(_0x885d('0x5'));var auth=require(_0x885d('0x6'));var interaction=require(_0x885d('0x7'));var config=require(_0x885d('0x8'));var controller=require('./analyticMetric.controller');router['get']('/',auth[_0x885d('0x9')](),controller[_0x885d('0xa')]);router[_0x885d('0xb')](_0x885d('0xc'),auth[_0x885d('0x9')](),controller[_0x885d('0xd')]);router[_0x885d('0xe')]('/',auth[_0x885d('0x9')](),controller[_0x885d('0xf')]);router[_0x885d('0x10')](_0x885d('0xc'),auth[_0x885d('0x9')](),controller[_0x885d('0x11')]);router[_0x885d('0x12')](_0x885d('0xc'),auth[_0x885d('0x9')](),controller[_0x885d('0x13')]);module[_0x885d('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 56b13e1..23ad790 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 _0x855f=['TEXT'];(function(_0x245d28,_0x5089d4){var _0x486301=function(_0x438087){while(--_0x438087){_0x245d28['push'](_0x245d28['shift']());}};_0x486301(++_0x5089d4);}(_0x855f,0x7a));var _0xf855=function(_0x554201,_0x27d493){_0x554201=_0x554201-0x0;var _0x2d066d=_0x855f[_0x554201];return _0x2d066d;};'use strict';var Sequelize=require('sequelize');module['exports']={'tree':{'type':Sequelize[_0xf855('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0x0361=['exports','TEXT','sequelize'];(function(_0x226221,_0x4bda72){var _0x2bdda4=function(_0x579c53){while(--_0x579c53){_0x226221['push'](_0x226221['shift']());}};_0x2bdda4(++_0x4bda72);}(_0x0361,0x1f1));var _0x1036=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x0361[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x1036('0x0'));module[_0x1036('0x1')]={'tree':{'type':Sequelize[_0x1036('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 deac945..7030176 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 _0xdd22=['create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','then','destroy','error','name','index','map','AnalyticTreeReport','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','catch','show','params','rawAttributes','find'];(function(_0x164760,_0x5874b0){var _0x8b91b2=function(_0x40d20a){while(--_0x40d20a){_0x164760['push'](_0x164760['shift']());}};_0x8b91b2(++_0x5874b0);}(_0xdd22,0x9d));var _0x2dd2=function(_0x54dad6,_0xceaf01){_0x54dad6=_0x54dad6-0x0;var _0x316654=_0xdd22[_0x54dad6];return _0x316654;};'use strict';var emlformat=require(_0x2dd2('0x0'));var rimraf=require(_0x2dd2('0x1'));var zipdir=require(_0x2dd2('0x2'));var jsonpatch=require(_0x2dd2('0x3'));var rp=require('request-promise');var moment=require(_0x2dd2('0x4'));var BPromise=require(_0x2dd2('0x5'));var Mustache=require('mustache');var util=require(_0x2dd2('0x6'));var path=require(_0x2dd2('0x7'));var sox=require(_0x2dd2('0x8'));var csv=require(_0x2dd2('0x9'));var ejs=require(_0x2dd2('0xa'));var fs=require('fs');var fs_extra=require(_0x2dd2('0xb'));var _=require(_0x2dd2('0xc'));var squel=require(_0x2dd2('0xd'));var crypto=require(_0x2dd2('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2dd2('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2dd2('0x10'));var Papa=require(_0x2dd2('0x11'));var Redis=require(_0x2dd2('0x12'));var authService=require(_0x2dd2('0x13'));var qs=require(_0x2dd2('0x14'));var as=require(_0x2dd2('0x15'));var hardwareService=require(_0x2dd2('0x16'));var logger=require(_0x2dd2('0x17'))(_0x2dd2('0x18'));var utils=require(_0x2dd2('0x19'));var config=require(_0x2dd2('0x1a'));var licenseUtil=require(_0x2dd2('0x1b'));var db=require(_0x2dd2('0x1c'))['db'];function respondWithStatusCode(_0x1264a5,_0x3d46d5){_0x3d46d5=_0x3d46d5||0xcc;return function(_0x5323f3){if(_0x5323f3){return _0x1264a5[_0x2dd2('0x1d')](_0x3d46d5);}return _0x1264a5[_0x2dd2('0x1e')](_0x3d46d5)[_0x2dd2('0x1f')]();};}function respondWithResult(_0x41c3e7,_0x504955){_0x504955=_0x504955||0xc8;return function(_0x215839){if(_0x215839){return _0x41c3e7[_0x2dd2('0x1e')](_0x504955)[_0x2dd2('0x20')](_0x215839);}};}function respondWithFilteredResult(_0x3be983,_0x447db3){return function(_0x220144){if(_0x220144){var _0x4dd45e=typeof _0x447db3['offset']===_0x2dd2('0x21')&&typeof _0x447db3[_0x2dd2('0x22')]==='undefined';var _0x2167a8=_0x220144[_0x2dd2('0x23')];var _0xcffc02=_0x4dd45e?0x0:_0x447db3[_0x2dd2('0x24')];var _0x16f7a4=_0x4dd45e?_0x220144['count']:_0x447db3['offset']+_0x447db3[_0x2dd2('0x22')];var _0x592cec;if(_0x16f7a4>=_0x2167a8){_0x16f7a4=_0x2167a8;_0x592cec=0xc8;}else{_0x592cec=0xce;}_0x3be983[_0x2dd2('0x1e')](_0x592cec);return _0x3be983[_0x2dd2('0x25')](_0x2dd2('0x26'),_0xcffc02+'-'+_0x16f7a4+'/'+_0x2167a8)[_0x2dd2('0x20')](_0x220144);}return null;};}function patchUpdates(_0x3bd49c){return function(_0x445f05){try{jsonpatch[_0x2dd2('0x27')](_0x445f05,_0x3bd49c,!![]);}catch(_0x4adc69){return BPromise[_0x2dd2('0x28')](_0x4adc69);}return _0x445f05['save']();};}function saveUpdates(_0x1f8f5b,_0x16f6bc){return function(_0x5b28ac){if(_0x5b28ac){return _0x5b28ac['update'](_0x1f8f5b)[_0x2dd2('0x29')](function(_0x1bfae4){return _0x1bfae4;});}return null;};}function removeEntity(_0x5c2775,_0x334e76){return function(_0x2e98f9){if(_0x2e98f9){return _0x2e98f9[_0x2dd2('0x2a')]()[_0x2dd2('0x29')](function(){_0x5c2775[_0x2dd2('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c86b8,_0x3c501d){return function(_0x5d33ce){if(!_0x5d33ce){_0x5c86b8[_0x2dd2('0x1d')](0x194);}return _0x5d33ce;};}function handleError(_0x31a81c,_0x340902){_0x340902=_0x340902||0x1f4;return function(_0x2cf92d){logger[_0x2dd2('0x2b')](_0x2cf92d['stack']);if(_0x2cf92d[_0x2dd2('0x2c')]){delete _0x2cf92d[_0x2dd2('0x2c')];}_0x31a81c[_0x2dd2('0x1e')](_0x340902)['send'](_0x2cf92d);};}exports[_0x2dd2('0x2d')]=function(_0x4165fb,_0x1fd89c){var _0x37cd1a={},_0x197bbd={},_0x33da62={'count':0x0,'rows':[]};var _0x27089e=_[_0x2dd2('0x2e')](db[_0x2dd2('0x2f')]['rawAttributes'],function(_0x32c0f9){return{'name':_0x32c0f9['fieldName'],'type':_0x32c0f9[_0x2dd2('0x30')][_0x2dd2('0x31')]};});_0x197bbd[_0x2dd2('0x32')]=_['map'](_0x27089e,_0x2dd2('0x2c'));_0x197bbd[_0x2dd2('0x33')]=_[_0x2dd2('0x34')](_0x4165fb['query']);_0x197bbd[_0x2dd2('0x35')]=_[_0x2dd2('0x36')](_0x197bbd['model'],_0x197bbd[_0x2dd2('0x33')]);_0x37cd1a['attributes']=_['intersection'](_0x197bbd['model'],qs['fields'](_0x4165fb[_0x2dd2('0x33')][_0x2dd2('0x37')]));_0x37cd1a[_0x2dd2('0x38')]=_0x37cd1a[_0x2dd2('0x38')][_0x2dd2('0x39')]?_0x37cd1a[_0x2dd2('0x38')]:_0x197bbd['model'];if(!_0x4165fb[_0x2dd2('0x33')][_0x2dd2('0x3a')](_0x2dd2('0x3b'))){_0x37cd1a[_0x2dd2('0x22')]=qs[_0x2dd2('0x22')](_0x4165fb[_0x2dd2('0x33')][_0x2dd2('0x22')]);_0x37cd1a[_0x2dd2('0x24')]=qs[_0x2dd2('0x24')](_0x4165fb[_0x2dd2('0x33')][_0x2dd2('0x24')]);}_0x37cd1a[_0x2dd2('0x3c')]=qs['sort'](_0x4165fb['query'][_0x2dd2('0x3d')]);_0x37cd1a[_0x2dd2('0x3e')]=qs[_0x2dd2('0x35')](_[_0x2dd2('0x3f')](_0x4165fb[_0x2dd2('0x33')],_0x197bbd[_0x2dd2('0x35')]),_0x27089e);if(_0x4165fb[_0x2dd2('0x33')]['filter']){_0x37cd1a['where']=_[_0x2dd2('0x40')](_0x37cd1a[_0x2dd2('0x3e')],{'$or':_[_0x2dd2('0x2e')](_0x27089e,function(_0x47d143){if(_0x47d143[_0x2dd2('0x30')]!==_0x2dd2('0x41')){var _0x5efcda={};_0x5efcda[_0x47d143[_0x2dd2('0x2c')]]={'$like':'%'+_0x4165fb['query'][_0x2dd2('0x42')]+'%'};return _0x5efcda;}})});}_0x37cd1a=_[_0x2dd2('0x40')]({},_0x37cd1a,_0x4165fb['options']);var _0x2ff6d3={'where':_0x37cd1a[_0x2dd2('0x3e')]};return db[_0x2dd2('0x2f')]['count'](_0x2ff6d3)['then'](function(_0x258334){_0x33da62[_0x2dd2('0x23')]=_0x258334;if(_0x4165fb['query'][_0x2dd2('0x43')]){_0x37cd1a[_0x2dd2('0x44')]=[{'all':!![]}];}return db[_0x2dd2('0x2f')]['findAll'](_0x37cd1a);})[_0x2dd2('0x29')](function(_0x44a6a3){_0x33da62['rows']=_0x44a6a3;return _0x33da62;})[_0x2dd2('0x29')](respondWithFilteredResult(_0x1fd89c,_0x37cd1a))[_0x2dd2('0x45')](handleError(_0x1fd89c,null));};exports[_0x2dd2('0x46')]=function(_0x3b8607,_0x41ca3c){var _0x4f5c41={'raw':!![],'where':{'id':_0x3b8607[_0x2dd2('0x47')]['id']}},_0x3b0cd3={};_0x3b0cd3[_0x2dd2('0x32')]=_[_0x2dd2('0x34')](db[_0x2dd2('0x2f')][_0x2dd2('0x48')]);_0x3b0cd3['query']=_[_0x2dd2('0x34')](_0x3b8607[_0x2dd2('0x33')]);_0x3b0cd3[_0x2dd2('0x35')]=_[_0x2dd2('0x36')](_0x3b0cd3[_0x2dd2('0x32')],_0x3b0cd3[_0x2dd2('0x33')]);_0x4f5c41[_0x2dd2('0x38')]=_[_0x2dd2('0x36')](_0x3b0cd3['model'],qs['fields'](_0x3b8607[_0x2dd2('0x33')]['fields']));_0x4f5c41[_0x2dd2('0x38')]=_0x4f5c41[_0x2dd2('0x38')][_0x2dd2('0x39')]?_0x4f5c41[_0x2dd2('0x38')]:_0x3b0cd3['model'];if(_0x3b8607[_0x2dd2('0x33')][_0x2dd2('0x43')]){_0x4f5c41['include']=[{'all':!![]}];}_0x4f5c41=_[_0x2dd2('0x40')]({},_0x4f5c41,_0x3b8607['options']);return db[_0x2dd2('0x2f')][_0x2dd2('0x49')](_0x4f5c41)['then'](handleEntityNotFound(_0x41ca3c,null))['then'](respondWithResult(_0x41ca3c,null))[_0x2dd2('0x45')](handleError(_0x41ca3c,null));};exports[_0x2dd2('0x4a')]=function(_0x105c67,_0x4ab647){return db[_0x2dd2('0x2f')][_0x2dd2('0x4a')](_0x105c67['body'],{})[_0x2dd2('0x29')](respondWithResult(_0x4ab647,0xc9))[_0x2dd2('0x45')](handleError(_0x4ab647,null));};exports[_0x2dd2('0x4b')]=function(_0x353e96,_0x510396){if(_0x353e96['body']['id']){delete _0x353e96[_0x2dd2('0x4c')]['id'];}return db['AnalyticTreeReport'][_0x2dd2('0x49')]({'where':{'id':_0x353e96['params']['id']}})[_0x2dd2('0x29')](handleEntityNotFound(_0x510396,null))['then'](saveUpdates(_0x353e96[_0x2dd2('0x4c')],null))[_0x2dd2('0x29')](respondWithResult(_0x510396,null))[_0x2dd2('0x45')](handleError(_0x510396,null));};exports['destroy']=function(_0x3c9413,_0x3768f6){return db['AnalyticTreeReport'][_0x2dd2('0x49')]({'where':{'id':_0x3c9413[_0x2dd2('0x47')]['id']}})['then'](handleEntityNotFound(_0x3768f6,null))[_0x2dd2('0x29')](removeEntity(_0x3768f6,null))[_0x2dd2('0x45')](handleError(_0x3768f6,null));}; \ No newline at end of file +var _0x363f=['model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','options','include','findAll','rows','catch','params','keys','rawAttributes','includeAll','merge','create','body','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','end','stack','name','send','map','AnalyticTreeReport','fieldName','type','key'];(function(_0x29b155,_0x3b2fb0){var _0x105c42=function(_0x15aaaa){while(--_0x15aaaa){_0x29b155['push'](_0x29b155['shift']());}};_0x105c42(++_0x3b2fb0);}(_0x363f,0x157));var _0xf363=function(_0x22d944,_0x313411){_0x22d944=_0x22d944-0x0;var _0x2221c7=_0x363f[_0x22d944];return _0x2221c7;};'use strict';var emlformat=require(_0xf363('0x0'));var rimraf=require(_0xf363('0x1'));var zipdir=require(_0xf363('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf363('0x3'));var moment=require(_0xf363('0x4'));var BPromise=require(_0xf363('0x5'));var Mustache=require(_0xf363('0x6'));var util=require(_0xf363('0x7'));var path=require(_0xf363('0x8'));var sox=require(_0xf363('0x9'));var csv=require(_0xf363('0xa'));var ejs=require(_0xf363('0xb'));var fs=require('fs');var fs_extra=require(_0xf363('0xc'));var _=require(_0xf363('0xd'));var squel=require(_0xf363('0xe'));var crypto=require(_0xf363('0xf'));var jsforce=require(_0xf363('0x10'));var deskjs=require(_0xf363('0x11'));var toCsv=require(_0xf363('0xa'));var querystring=require(_0xf363('0x12'));var Papa=require('papaparse');var Redis=require(_0xf363('0x13'));var authService=require(_0xf363('0x14'));var qs=require(_0xf363('0x15'));var as=require(_0xf363('0x16'));var hardwareService=require(_0xf363('0x17'));var logger=require(_0xf363('0x18'))('api');var utils=require(_0xf363('0x19'));var config=require(_0xf363('0x1a'));var licenseUtil=require(_0xf363('0x1b'));var db=require(_0xf363('0x1c'))['db'];function respondWithStatusCode(_0x174481,_0x3b72c7){_0x3b72c7=_0x3b72c7||0xcc;return function(_0x2016b8){if(_0x2016b8){return _0x174481[_0xf363('0x1d')](_0x3b72c7);}return _0x174481[_0xf363('0x1e')](_0x3b72c7)['end']();};}function respondWithResult(_0x420486,_0x4a172d){_0x4a172d=_0x4a172d||0xc8;return function(_0xc9947a){if(_0xc9947a){return _0x420486[_0xf363('0x1e')](_0x4a172d)[_0xf363('0x1f')](_0xc9947a);}};}function respondWithFilteredResult(_0x409a29,_0x502a86){return function(_0x4b96fe){if(_0x4b96fe){var _0x183293=typeof _0x502a86[_0xf363('0x20')]===_0xf363('0x21')&&typeof _0x502a86[_0xf363('0x22')]===_0xf363('0x21');var _0xd19339=_0x4b96fe[_0xf363('0x23')];var _0x343317=_0x183293?0x0:_0x502a86[_0xf363('0x20')];var _0x405dab=_0x183293?_0x4b96fe[_0xf363('0x23')]:_0x502a86[_0xf363('0x20')]+_0x502a86['limit'];var _0x2210b9;if(_0x405dab>=_0xd19339){_0x405dab=_0xd19339;_0x2210b9=0xc8;}else{_0x2210b9=0xce;}_0x409a29[_0xf363('0x1e')](_0x2210b9);return _0x409a29['set'](_0xf363('0x24'),_0x343317+'-'+_0x405dab+'/'+_0xd19339)['json'](_0x4b96fe);}return null;};}function patchUpdates(_0x16399e){return function(_0x35c465){try{jsonpatch[_0xf363('0x25')](_0x35c465,_0x16399e,!![]);}catch(_0x19b105){return BPromise[_0xf363('0x26')](_0x19b105);}return _0x35c465[_0xf363('0x27')]();};}function saveUpdates(_0x3b5090,_0x13b642){return function(_0x1c1ed0){if(_0x1c1ed0){return _0x1c1ed0[_0xf363('0x28')](_0x3b5090)['then'](function(_0x30cf8b){return _0x30cf8b;});}return null;};}function removeEntity(_0x41e70e,_0x41d997){return function(_0x452e16){if(_0x452e16){return _0x452e16[_0xf363('0x29')]()[_0xf363('0x2a')](function(){_0x41e70e['status'](0xcc)[_0xf363('0x2b')]();});}};}function handleEntityNotFound(_0x5ee41a,_0x3090eb){return function(_0x3c0960){if(!_0x3c0960){_0x5ee41a['sendStatus'](0x194);}return _0x3c0960;};}function handleError(_0xffa13a,_0x2e2ac6){_0x2e2ac6=_0x2e2ac6||0x1f4;return function(_0x2d41b4){logger['error'](_0x2d41b4[_0xf363('0x2c')]);if(_0x2d41b4[_0xf363('0x2d')]){delete _0x2d41b4[_0xf363('0x2d')];}_0xffa13a['status'](_0x2e2ac6)[_0xf363('0x2e')](_0x2d41b4);};}exports['index']=function(_0x510121,_0x321b65){var _0xb56c97={},_0x34e398={},_0x5bc66c={'count':0x0,'rows':[]};var _0x32af83=_[_0xf363('0x2f')](db[_0xf363('0x30')]['rawAttributes'],function(_0x9f6055){return{'name':_0x9f6055[_0xf363('0x31')],'type':_0x9f6055[_0xf363('0x32')][_0xf363('0x33')]};});_0x34e398[_0xf363('0x34')]=_[_0xf363('0x2f')](_0x32af83,'name');_0x34e398[_0xf363('0x35')]=_['keys'](_0x510121[_0xf363('0x35')]);_0x34e398['filters']=_[_0xf363('0x36')](_0x34e398[_0xf363('0x34')],_0x34e398[_0xf363('0x35')]);_0xb56c97[_0xf363('0x37')]=_[_0xf363('0x36')](_0x34e398[_0xf363('0x34')],qs[_0xf363('0x38')](_0x510121['query']['fields']));_0xb56c97[_0xf363('0x37')]=_0xb56c97[_0xf363('0x37')][_0xf363('0x39')]?_0xb56c97[_0xf363('0x37')]:_0x34e398['model'];if(!_0x510121[_0xf363('0x35')][_0xf363('0x3a')](_0xf363('0x3b'))){_0xb56c97['limit']=qs[_0xf363('0x22')](_0x510121[_0xf363('0x35')][_0xf363('0x22')]);_0xb56c97['offset']=qs[_0xf363('0x20')](_0x510121[_0xf363('0x35')][_0xf363('0x20')]);}_0xb56c97[_0xf363('0x3c')]=qs[_0xf363('0x3d')](_0x510121[_0xf363('0x35')]['sort']);_0xb56c97[_0xf363('0x3e')]=qs[_0xf363('0x3f')](_[_0xf363('0x40')](_0x510121[_0xf363('0x35')],_0x34e398['filters']),_0x32af83);if(_0x510121[_0xf363('0x35')][_0xf363('0x41')]){_0xb56c97['where']=_['merge'](_0xb56c97['where'],{'$or':_['map'](_0x32af83,function(_0x46e42d){if(_0x46e42d[_0xf363('0x32')]!=='VIRTUAL'){var _0x457edb={};_0x457edb[_0x46e42d[_0xf363('0x2d')]]={'$like':'%'+_0x510121[_0xf363('0x35')][_0xf363('0x41')]+'%'};return _0x457edb;}})});}_0xb56c97=_['merge']({},_0xb56c97,_0x510121[_0xf363('0x42')]);var _0x4ea522={'where':_0xb56c97[_0xf363('0x3e')]};return db['AnalyticTreeReport'][_0xf363('0x23')](_0x4ea522)['then'](function(_0x50ff1f){_0x5bc66c[_0xf363('0x23')]=_0x50ff1f;if(_0x510121[_0xf363('0x35')]['includeAll']){_0xb56c97[_0xf363('0x43')]=[{'all':!![]}];}return db[_0xf363('0x30')][_0xf363('0x44')](_0xb56c97);})[_0xf363('0x2a')](function(_0xf49348){_0x5bc66c[_0xf363('0x45')]=_0xf49348;return _0x5bc66c;})[_0xf363('0x2a')](respondWithFilteredResult(_0x321b65,_0xb56c97))[_0xf363('0x46')](handleError(_0x321b65,null));};exports['show']=function(_0x1f390e,_0x6ccd1a){var _0xd60d1b={'raw':!![],'where':{'id':_0x1f390e[_0xf363('0x47')]['id']}},_0x543fb0={};_0x543fb0[_0xf363('0x34')]=_[_0xf363('0x48')](db[_0xf363('0x30')][_0xf363('0x49')]);_0x543fb0['query']=_[_0xf363('0x48')](_0x1f390e[_0xf363('0x35')]);_0x543fb0[_0xf363('0x3f')]=_[_0xf363('0x36')](_0x543fb0[_0xf363('0x34')],_0x543fb0[_0xf363('0x35')]);_0xd60d1b['attributes']=_['intersection'](_0x543fb0[_0xf363('0x34')],qs[_0xf363('0x38')](_0x1f390e[_0xf363('0x35')][_0xf363('0x38')]));_0xd60d1b[_0xf363('0x37')]=_0xd60d1b['attributes'][_0xf363('0x39')]?_0xd60d1b['attributes']:_0x543fb0[_0xf363('0x34')];if(_0x1f390e[_0xf363('0x35')][_0xf363('0x4a')]){_0xd60d1b[_0xf363('0x43')]=[{'all':!![]}];}_0xd60d1b=_[_0xf363('0x4b')]({},_0xd60d1b,_0x1f390e[_0xf363('0x42')]);return db[_0xf363('0x30')]['find'](_0xd60d1b)[_0xf363('0x2a')](handleEntityNotFound(_0x6ccd1a,null))['then'](respondWithResult(_0x6ccd1a,null))[_0xf363('0x46')](handleError(_0x6ccd1a,null));};exports[_0xf363('0x4c')]=function(_0x2decbf,_0x26d36b){return db[_0xf363('0x30')][_0xf363('0x4c')](_0x2decbf['body'],{})[_0xf363('0x2a')](respondWithResult(_0x26d36b,0xc9))['catch'](handleError(_0x26d36b,null));};exports[_0xf363('0x28')]=function(_0x15114e,_0xac6c97){if(_0x15114e[_0xf363('0x4d')]['id']){delete _0x15114e[_0xf363('0x4d')]['id'];}return db[_0xf363('0x30')][_0xf363('0x4e')]({'where':{'id':_0x15114e[_0xf363('0x47')]['id']}})[_0xf363('0x2a')](handleEntityNotFound(_0xac6c97,null))[_0xf363('0x2a')](saveUpdates(_0x15114e[_0xf363('0x4d')],null))['then'](respondWithResult(_0xac6c97,null))[_0xf363('0x46')](handleError(_0xac6c97,null));};exports['destroy']=function(_0x3d9d7f,_0xcce62){return db[_0xf363('0x30')][_0xf363('0x4e')]({'where':{'id':_0x3d9d7f['params']['id']}})[_0xf363('0x2a')](handleEntityNotFound(_0xcce62,null))[_0xf363('0x2a')](removeEntity(_0xcce62,null))[_0xf363('0x46')](handleError(_0xcce62,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 1935a7e..d94175f 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 _0xde25=['AnalyticTreeReport','analytics_report_trees','lodash','util','moment','bluebird','path','rimraf','../../config/environment','./analyticTreeReport.attributes'];(function(_0x523e9e,_0x17440){var _0x569909=function(_0x366a3c){while(--_0x366a3c){_0x523e9e['push'](_0x523e9e['shift']());}};_0x569909(++_0x17440);}(_0xde25,0x17e));var _0x5de2=function(_0x24ec64,_0x105e31){_0x24ec64=_0x24ec64-0x0;var _0x5f28ab=_0xde25[_0x24ec64];return _0x5f28ab;};'use strict';var _=require(_0x5de2('0x0'));var util=require(_0x5de2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5de2('0x2'));var BPromise=require(_0x5de2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5de2('0x4'));var rimraf=require(_0x5de2('0x5'));var config=require(_0x5de2('0x6'));var attributes=require(_0x5de2('0x7'));module['exports']=function(_0x199d61,_0x2a366b){return _0x199d61['define'](_0x5de2('0x8'),attributes,{'tableName':_0x5de2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x668a=['AnalyticTreeReport','analytics_report_trees','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./analyticTreeReport.attributes','define'];(function(_0x154192,_0x2d360f){var _0x3c2792=function(_0x2e257b){while(--_0x2e257b){_0x154192['push'](_0x154192['shift']());}};_0x3c2792(++_0x2d360f);}(_0x668a,0xce));var _0xa668=function(_0xa3e712,_0x221d44){_0xa3e712=_0xa3e712-0x0;var _0x3be788=_0x668a[_0xa3e712];return _0x3be788;};'use strict';var _=require(_0xa668('0x0'));var util=require(_0xa668('0x1'));var logger=require('../../config/logger')(_0xa668('0x2'));var moment=require(_0xa668('0x3'));var BPromise=require(_0xa668('0x4'));var rp=require(_0xa668('0x5'));var fs=require('fs');var path=require(_0xa668('0x6'));var rimraf=require('rimraf');var config=require(_0xa668('0x7'));var attributes=require(_0xa668('0x8'));module['exports']=function(_0x5d6e9d,_0x4481d1){return _0x5d6e9d[_0xa668('0x9')](_0xa668('0xa'),attributes,{'tableName':_0xa668('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 ed2de7c..43d6145 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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4c9393,_0x20e6de){var _0x580eda=function(_0x5dfce1){while(--_0x5dfce1){_0x4c9393['push'](_0x4c9393['shift']());}};_0x580eda(++_0x20e6de);}(_0xadb5,0xad));var _0x5adb=function(_0x3cc89a,_0x507773){_0x3cc89a=_0x3cc89a-0x0;var _0x3b1f2d=_0xadb5[_0x3cc89a];return _0x3b1f2d;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x58f363,_0x135c64){var _0xcb2c83=function(_0x55d7fd){while(--_0x55d7fd){_0x58f363['push'](_0x58f363['shift']());}};_0xcb2c83(++_0x135c64);}(_0x2ef3,0xba));var _0x32ef=function(_0x2dee88,_0xb8a4ee){_0x2dee88=_0x2dee88-0x0;var _0x514d9d=_0x2ef3[_0x2dee88];return _0x514d9d;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 3f9b9d8..36ac953 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 _0x0f0a=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','show','create','/:id','update','delete','destroy','multer','util'];(function(_0x280b5b,_0x4e4a42){var _0x3eb96b=function(_0x348bd9){while(--_0x348bd9){_0x280b5b['push'](_0x280b5b['shift']());}};_0x3eb96b(++_0x4e4a42);}(_0x0f0a,0x70));var _0xa0f0=function(_0x9708aa,_0x174b2d){_0x9708aa=_0x9708aa-0x0;var _0x24afd1=_0x0f0a[_0x9708aa];return _0x24afd1;};'use strict';var multer=require(_0xa0f0('0x0'));var util=require(_0xa0f0('0x1'));var path=require(_0xa0f0('0x2'));var timeout=require(_0xa0f0('0x3'));var express=require(_0xa0f0('0x4'));var router=express[_0xa0f0('0x5')]();var fs_extra=require(_0xa0f0('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xa0f0('0x7'));var config=require(_0xa0f0('0x8'));var controller=require(_0xa0f0('0x9'));router[_0xa0f0('0xa')]('/',auth[_0xa0f0('0xb')](),controller[_0xa0f0('0xc')]);router[_0xa0f0('0xa')]('/:id',auth[_0xa0f0('0xb')](),controller[_0xa0f0('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa0f0('0xe')]);router['put'](_0xa0f0('0xf'),auth[_0xa0f0('0xb')](),controller[_0xa0f0('0x10')]);router[_0xa0f0('0x11')](_0xa0f0('0xf'),auth['isAuthenticated'](),controller[_0xa0f0('0x12')]);module['exports']=router; \ No newline at end of file +var _0x36ae=['delete','destroy','exports','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','update'];(function(_0x44d385,_0x1a313a){var _0x5c2cc5=function(_0x5d1d76){while(--_0x5d1d76){_0x44d385['push'](_0x44d385['shift']());}};_0x5c2cc5(++_0x1a313a);}(_0x36ae,0x198));var _0xe36a=function(_0xc55d64,_0x133f2d){_0xc55d64=_0xc55d64-0x0;var _0x4194f6=_0x36ae[_0xc55d64];return _0x4194f6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe36a('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe36a('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0xe36a('0x2'));var interaction=require(_0xe36a('0x3'));var config=require(_0xe36a('0x4'));var controller=require('./analyticTreeReport.controller');router[_0xe36a('0x5')]('/',auth[_0xe36a('0x6')](),controller[_0xe36a('0x7')]);router[_0xe36a('0x5')](_0xe36a('0x8'),auth[_0xe36a('0x6')](),controller['show']);router[_0xe36a('0x9')]('/',auth[_0xe36a('0x6')](),controller[_0xe36a('0xa')]);router['put'](_0xe36a('0x8'),auth[_0xe36a('0x6')](),controller[_0xe36a('0xb')]);router[_0xe36a('0xc')]('/:id',auth[_0xe36a('0x6')](),controller[_0xe36a('0xd')]);module[_0xe36a('0xe')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index eb329e2..5ddc2a0 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 _0xe0c3=['sequelize','STRING'];(function(_0x49f1be,_0x3cf7a4){var _0xe6b3bd=function(_0x38d1e5){while(--_0x38d1e5){_0x49f1be['push'](_0x49f1be['shift']());}};_0xe6b3bd(++_0x3cf7a4);}(_0xe0c3,0xea));var _0x3e0c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe0c3[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x3e0c('0x0'));module['exports']={'name':{'type':Sequelize[_0x3e0c('0x1')]},'basename':{'type':Sequelize[_0x3e0c('0x1')]},'type':{'type':Sequelize[_0x3e0c('0x1')]}}; \ No newline at end of file +var _0x6ddd=['STRING'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x6ddd,0xae));var _0xd6dd=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x6ddd[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xd6dd('0x0')]},'basename':{'type':Sequelize[_0xd6dd('0x0')]},'type':{'type':Sequelize[_0xd6dd('0x0')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 0a47142..dce2f32 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 _0x9751=['updatedAt','body','create','file','originalname','basename','mimetype','download','findOne','join','root','server/files/attachments/','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','Attachment','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','clone','params','find','get','createdAt'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9751,0x164));var _0x1975=function(_0x5ae9c3,_0x3fc8b1){_0x5ae9c3=_0x5ae9c3-0x0;var _0x58913d=_0x9751[_0x5ae9c3];return _0x58913d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1975('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1975('0x1'));var moment=require(_0x1975('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1975('0x3'));var util=require(_0x1975('0x4'));var path=require(_0x1975('0x5'));var sox=require(_0x1975('0x6'));var csv=require(_0x1975('0x7'));var ejs=require(_0x1975('0x8'));var fs=require('fs');var fs_extra=require(_0x1975('0x9'));var _=require(_0x1975('0xa'));var squel=require(_0x1975('0xb'));var crypto=require(_0x1975('0xc'));var jsforce=require(_0x1975('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1975('0xe'));var Papa=require(_0x1975('0xf'));var Redis=require('ioredis');var authService=require(_0x1975('0x10'));var qs=require(_0x1975('0x11'));var as=require(_0x1975('0x12'));var hardwareService=require(_0x1975('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x1975('0x14'));var config=require(_0x1975('0x15'));var licenseUtil=require(_0x1975('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59e9cd,_0x36b6bd){_0x36b6bd=_0x36b6bd||0xcc;return function(_0x59801e){if(_0x59801e){return _0x59e9cd[_0x1975('0x17')](_0x36b6bd);}return _0x59e9cd[_0x1975('0x18')](_0x36b6bd)['end']();};}function respondWithResult(_0x6de7db,_0x4f8a30){_0x4f8a30=_0x4f8a30||0xc8;return function(_0x475008){if(_0x475008){return _0x6de7db[_0x1975('0x18')](_0x4f8a30)['json'](_0x475008);}};}function respondWithFilteredResult(_0x4f902a,_0x412713){return function(_0x4ab15b){if(_0x4ab15b){var _0x37f66b=typeof _0x412713[_0x1975('0x19')]==='undefined'&&typeof _0x412713['limit']===_0x1975('0x1a');var _0x4efa35=_0x4ab15b[_0x1975('0x1b')];var _0x3e7cca=_0x37f66b?0x0:_0x412713[_0x1975('0x19')];var _0xab1125=_0x37f66b?_0x4ab15b[_0x1975('0x1b')]:_0x412713['offset']+_0x412713['limit'];var _0x2f3dfd;if(_0xab1125>=_0x4efa35){_0xab1125=_0x4efa35;_0x2f3dfd=0xc8;}else{_0x2f3dfd=0xce;}_0x4f902a[_0x1975('0x18')](_0x2f3dfd);return _0x4f902a[_0x1975('0x1c')](_0x1975('0x1d'),_0x3e7cca+'-'+_0xab1125+'/'+_0x4efa35)['json'](_0x4ab15b);}return null;};}function patchUpdates(_0x1d55d9){return function(_0x37ea85){try{jsonpatch[_0x1975('0x1e')](_0x37ea85,_0x1d55d9,!![]);}catch(_0x43c71d){return BPromise[_0x1975('0x1f')](_0x43c71d);}return _0x37ea85['save']();};}function saveUpdates(_0x529524,_0xe77836){return function(_0x4fda9e){if(_0x4fda9e){return _0x4fda9e[_0x1975('0x20')](_0x529524)[_0x1975('0x21')](function(_0x4ec8d4){return _0x4ec8d4;});}return null;};}function removeEntity(_0x38d429,_0x27378c){return function(_0x132141){if(_0x132141){return _0x132141[_0x1975('0x22')]()[_0x1975('0x21')](function(){_0x38d429[_0x1975('0x18')](0xcc)[_0x1975('0x23')]();});}};}function handleEntityNotFound(_0x44211d,_0x2f35bd){return function(_0x86fd79){if(!_0x86fd79){_0x44211d[_0x1975('0x17')](0x194);}return _0x86fd79;};}function handleError(_0x5d069b,_0x3d73bd){_0x3d73bd=_0x3d73bd||0x1f4;return function(_0x3f5a1f){logger[_0x1975('0x24')](_0x3f5a1f[_0x1975('0x25')]);if(_0x3f5a1f['name']){delete _0x3f5a1f[_0x1975('0x26')];}_0x5d069b[_0x1975('0x18')](_0x3d73bd)[_0x1975('0x27')](_0x3f5a1f);};}exports[_0x1975('0x28')]=function(_0x57a998,_0x3190e7){var _0x12e6f2={},_0x4d33ed={},_0x5265a4={'count':0x0,'rows':[]};var _0x536a08=_[_0x1975('0x29')](db[_0x1975('0x2a')][_0x1975('0x2b')],function(_0x203b48){return{'name':_0x203b48['fieldName'],'type':_0x203b48['type'][_0x1975('0x2c')]};});_0x4d33ed[_0x1975('0x2d')]=_['map'](_0x536a08,_0x1975('0x26'));_0x4d33ed[_0x1975('0x2e')]=_[_0x1975('0x2f')](_0x57a998[_0x1975('0x2e')]);_0x4d33ed[_0x1975('0x30')]=_[_0x1975('0x31')](_0x4d33ed[_0x1975('0x2d')],_0x4d33ed['query']);_0x12e6f2[_0x1975('0x32')]=_[_0x1975('0x31')](_0x4d33ed[_0x1975('0x2d')],qs[_0x1975('0x33')](_0x57a998['query']['fields']));_0x12e6f2[_0x1975('0x32')]=_0x12e6f2['attributes'][_0x1975('0x34')]?_0x12e6f2[_0x1975('0x32')]:_0x4d33ed[_0x1975('0x2d')];if(!_0x57a998[_0x1975('0x2e')]['hasOwnProperty'](_0x1975('0x35'))){_0x12e6f2[_0x1975('0x36')]=qs[_0x1975('0x36')](_0x57a998['query'][_0x1975('0x36')]);_0x12e6f2[_0x1975('0x19')]=qs[_0x1975('0x19')](_0x57a998[_0x1975('0x2e')]['offset']);}_0x12e6f2[_0x1975('0x37')]=qs[_0x1975('0x38')](_0x57a998[_0x1975('0x2e')]['sort']);_0x12e6f2[_0x1975('0x39')]=qs[_0x1975('0x30')](_[_0x1975('0x3a')](_0x57a998[_0x1975('0x2e')],_0x4d33ed[_0x1975('0x30')]),_0x536a08);if(_0x57a998['query'][_0x1975('0x3b')]){_0x12e6f2[_0x1975('0x39')]=_[_0x1975('0x3c')](_0x12e6f2[_0x1975('0x39')],{'$or':_[_0x1975('0x29')](_0x536a08,function(_0x3d4074){if(_0x3d4074[_0x1975('0x3d')]!=='VIRTUAL'){var _0x462127={};_0x462127[_0x3d4074[_0x1975('0x26')]]={'$like':'%'+_0x57a998[_0x1975('0x2e')][_0x1975('0x3b')]+'%'};return _0x462127;}})});}_0x12e6f2=_[_0x1975('0x3c')]({},_0x12e6f2,_0x57a998[_0x1975('0x3e')]);var _0x23d88f={'where':_0x12e6f2[_0x1975('0x39')]};return db[_0x1975('0x2a')][_0x1975('0x1b')](_0x23d88f)[_0x1975('0x21')](function(_0x488999){_0x5265a4[_0x1975('0x1b')]=_0x488999;if(_0x57a998[_0x1975('0x2e')][_0x1975('0x3f')]){_0x12e6f2[_0x1975('0x40')]=[{'all':!![]}];}return db[_0x1975('0x2a')][_0x1975('0x41')](_0x12e6f2);})[_0x1975('0x21')](function(_0x43ee8d){_0x5265a4[_0x1975('0x42')]=_0x43ee8d;return _0x5265a4;})[_0x1975('0x21')](respondWithFilteredResult(_0x3190e7,_0x12e6f2))[_0x1975('0x43')](handleError(_0x3190e7,null));};exports[_0x1975('0x44')]=function(_0x5803ad,_0x5062b4){var _0xc218c9={'raw':!![],'where':{'id':_0x5803ad['params']['id']}},_0x4b8240={};_0x4b8240[_0x1975('0x2d')]=_[_0x1975('0x2f')](db['Attachment'][_0x1975('0x2b')]);_0x4b8240['query']=_[_0x1975('0x2f')](_0x5803ad['query']);_0x4b8240[_0x1975('0x30')]=_[_0x1975('0x31')](_0x4b8240[_0x1975('0x2d')],_0x4b8240[_0x1975('0x2e')]);_0xc218c9['attributes']=_[_0x1975('0x31')](_0x4b8240['model'],qs[_0x1975('0x33')](_0x5803ad[_0x1975('0x2e')]['fields']));_0xc218c9[_0x1975('0x32')]=_0xc218c9[_0x1975('0x32')][_0x1975('0x34')]?_0xc218c9[_0x1975('0x32')]:_0x4b8240[_0x1975('0x2d')];if(_0x5803ad['query']['includeAll']){_0xc218c9[_0x1975('0x40')]=[{'all':!![]}];}_0xc218c9=_[_0x1975('0x3c')]({},_0xc218c9,_0x5803ad[_0x1975('0x3e')]);return db[_0x1975('0x2a')]['find'](_0xc218c9)['then'](handleEntityNotFound(_0x5062b4,null))[_0x1975('0x21')](respondWithResult(_0x5062b4,null))[_0x1975('0x43')](handleError(_0x5062b4,null));};exports[_0x1975('0x45')]=function(_0x14c38e,_0x2d067e){var _0x9d11ca={'where':{'id':_0x14c38e[_0x1975('0x46')]['id']}},_0x332e76={};_0x332e76[_0x1975('0x2d')]=_['keys'](db['Attachment'][_0x1975('0x2b')]);_0x9d11ca[_0x1975('0x32')]=_[_0x1975('0x31')](_0x332e76['model'],qs['fields'](_0x14c38e[_0x1975('0x2e')][_0x1975('0x33')]));_0x9d11ca[_0x1975('0x32')]=_0x9d11ca[_0x1975('0x32')][_0x1975('0x34')]?_0x9d11ca[_0x1975('0x32')]:_0x332e76[_0x1975('0x2d')];if(_0x14c38e[_0x1975('0x2e')][_0x1975('0x3f')]){_0x9d11ca['include']=[{'all':!![]}];}_0x9d11ca=_[_0x1975('0x3c')]({},_0x9d11ca,_0x14c38e['options']);return db[_0x1975('0x2a')][_0x1975('0x47')](_0x9d11ca)['then'](handleEntityNotFound(_0x2d067e,null))[_0x1975('0x21')](function(_0x173ccd){if(_0x173ccd){var _0x11e282=_0x173ccd[_0x1975('0x48')]({'plain':!![]});_0x11e282=qs['omit'](_0x11e282,['id',_0x1975('0x49'),_0x1975('0x4a')]);_0x14c38e[_0x1975('0x4b')]=_['omit'](_0x14c38e[_0x1975('0x4b')],['id',_0x1975('0x49'),_0x1975('0x4a')]);return db['Attachment'][_0x1975('0x4c')](_[_0x1975('0x3c')](_0x11e282,_0x14c38e[_0x1975('0x4b')]),{'include':_0x14c38e['query'][_0x1975('0x3f')]?[{'all':!![]}]:undefined});}})[_0x1975('0x21')](respondWithResult(_0x2d067e,0xc9))['catch'](handleError(_0x2d067e,null));};exports[_0x1975('0x20')]=function(_0xb3204c,_0xac863){if(_0xb3204c[_0x1975('0x4b')]['id']){delete _0xb3204c[_0x1975('0x4b')]['id'];}return db[_0x1975('0x2a')][_0x1975('0x47')]({'where':{'id':_0xb3204c[_0x1975('0x46')]['id']}})[_0x1975('0x21')](handleEntityNotFound(_0xac863,null))[_0x1975('0x21')](saveUpdates(_0xb3204c[_0x1975('0x4b')],null))[_0x1975('0x21')](respondWithResult(_0xac863,null))[_0x1975('0x43')](handleError(_0xac863,null));};exports[_0x1975('0x22')]=function(_0x575217,_0x18c9bf){return db[_0x1975('0x2a')][_0x1975('0x47')]({'where':{'id':_0x575217['params']['id']}})[_0x1975('0x21')](handleEntityNotFound(_0x18c9bf,null))[_0x1975('0x21')](removeEntity(_0x18c9bf,null))['catch'](handleError(_0x18c9bf,null));};exports[_0x1975('0x4c')]=function(_0x2e6d9f,_0x2920a3,_0x59f47b){_0x2e6d9f[_0x1975('0x4b')][_0x1975('0x26')]=_0x2e6d9f[_0x1975('0x4d')][_0x1975('0x4e')];_0x2e6d9f[_0x1975('0x4b')][_0x1975('0x4f')]=_0x2e6d9f[_0x1975('0x4d')]['filename'];_0x2e6d9f[_0x1975('0x4b')]['type']=_0x2e6d9f[_0x1975('0x4d')][_0x1975('0x50')];return db[_0x1975('0x2a')][_0x1975('0x4c')](_0x2e6d9f['body'])['then'](respondWithResult(_0x2920a3,0xc9))[_0x1975('0x43')](handleError(_0x2920a3,null));};exports[_0x1975('0x51')]=function(_0x14ce29,_0xaea527,_0x4394bf){return db[_0x1975('0x2a')][_0x1975('0x52')]({'where':{'id':_0x14ce29[_0x1975('0x46')]['id']},'raw':!![]})[_0x1975('0x21')](handleEntityNotFound(_0xaea527,null))[_0x1975('0x21')](function(_0x7597f8){if(_0x7597f8){var _0x3494aa=_0x7597f8['ChatOfflineMessageId']!==null;var _0x11d68c=path[_0x1975('0x53')](config[_0x1975('0x54')],_0x1975('0x55'));if(_0x3494aa){_0x11d68c=path[_0x1975('0x53')](_0x11d68c,'offline-chat/');}var _0x86df30=path[_0x1975('0x53')](_0x11d68c,_0x7597f8['basename']);return _0xaea527[_0x1975('0x51')](_0x86df30);}})['catch'](handleError(_0xaea527,null));}; \ No newline at end of file +var _0xf4ac=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','limit','undefined','count','offset','Content-Range','save','update','then','sendStatus','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','find','clone','params','keys','get','omit','createdAt','updatedAt','body','create','destroy','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0xd20213,_0xca7303){var _0x363b4a=function(_0x24bae5){while(--_0x24bae5){_0xd20213['push'](_0xd20213['shift']());}};_0x363b4a(++_0xca7303);}(_0xf4ac,0xfe));var _0xcf4a=function(_0x4dbfb9,_0x510387){_0x4dbfb9=_0x4dbfb9-0x0;var _0x1104d3=_0xf4ac[_0x4dbfb9];return _0x1104d3;};'use strict';var emlformat=require(_0xcf4a('0x0'));var rimraf=require(_0xcf4a('0x1'));var zipdir=require(_0xcf4a('0x2'));var jsonpatch=require(_0xcf4a('0x3'));var rp=require(_0xcf4a('0x4'));var moment=require(_0xcf4a('0x5'));var BPromise=require(_0xcf4a('0x6'));var Mustache=require(_0xcf4a('0x7'));var util=require(_0xcf4a('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xcf4a('0x9'));var ejs=require(_0xcf4a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcf4a('0xb'));var squel=require(_0xcf4a('0xc'));var crypto=require(_0xcf4a('0xd'));var jsforce=require(_0xcf4a('0xe'));var deskjs=require(_0xcf4a('0xf'));var toCsv=require('to-csv');var querystring=require(_0xcf4a('0x10'));var Papa=require(_0xcf4a('0x11'));var Redis=require('ioredis');var authService=require(_0xcf4a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xcf4a('0x13'));var hardwareService=require(_0xcf4a('0x14'));var logger=require(_0xcf4a('0x15'))(_0xcf4a('0x16'));var utils=require('../../config/utils');var config=require(_0xcf4a('0x17'));var licenseUtil=require(_0xcf4a('0x18'));var db=require(_0xcf4a('0x19'))['db'];function respondWithStatusCode(_0x3ad791,_0xf1be85){_0xf1be85=_0xf1be85||0xcc;return function(_0x1a6f33){if(_0x1a6f33){return _0x3ad791['sendStatus'](_0xf1be85);}return _0x3ad791[_0xcf4a('0x1a')](_0xf1be85)['end']();};}function respondWithResult(_0x5ef889,_0xd7d34d){_0xd7d34d=_0xd7d34d||0xc8;return function(_0x3a4d0a){if(_0x3a4d0a){return _0x5ef889[_0xcf4a('0x1a')](_0xd7d34d)[_0xcf4a('0x1b')](_0x3a4d0a);}};}function respondWithFilteredResult(_0x495415,_0x506840){return function(_0x4002ce){if(_0x4002ce){var _0x54548e=typeof _0x506840['offset']==='undefined'&&typeof _0x506840[_0xcf4a('0x1c')]===_0xcf4a('0x1d');var _0x7a6bfb=_0x4002ce[_0xcf4a('0x1e')];var _0x517ed0=_0x54548e?0x0:_0x506840[_0xcf4a('0x1f')];var _0x4b871b=_0x54548e?_0x4002ce[_0xcf4a('0x1e')]:_0x506840[_0xcf4a('0x1f')]+_0x506840[_0xcf4a('0x1c')];var _0x65a266;if(_0x4b871b>=_0x7a6bfb){_0x4b871b=_0x7a6bfb;_0x65a266=0xc8;}else{_0x65a266=0xce;}_0x495415[_0xcf4a('0x1a')](_0x65a266);return _0x495415['set'](_0xcf4a('0x20'),_0x517ed0+'-'+_0x4b871b+'/'+_0x7a6bfb)[_0xcf4a('0x1b')](_0x4002ce);}return null;};}function patchUpdates(_0x5eaa06){return function(_0x3c3efb){try{jsonpatch['apply'](_0x3c3efb,_0x5eaa06,!![]);}catch(_0x157389){return BPromise['reject'](_0x157389);}return _0x3c3efb[_0xcf4a('0x21')]();};}function saveUpdates(_0x4a2f02,_0x572993){return function(_0x2a8db9){if(_0x2a8db9){return _0x2a8db9[_0xcf4a('0x22')](_0x4a2f02)[_0xcf4a('0x23')](function(_0x46bf85){return _0x46bf85;});}return null;};}function removeEntity(_0x5b3931,_0x119c42){return function(_0x57ac61){if(_0x57ac61){return _0x57ac61['destroy']()[_0xcf4a('0x23')](function(){_0x5b3931[_0xcf4a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2daa14,_0x28f9fb){return function(_0x243273){if(!_0x243273){_0x2daa14[_0xcf4a('0x24')](0x194);}return _0x243273;};}function handleError(_0x4be8aa,_0x56ce7a){_0x56ce7a=_0x56ce7a||0x1f4;return function(_0x588bdc){logger[_0xcf4a('0x25')](_0x588bdc[_0xcf4a('0x26')]);if(_0x588bdc[_0xcf4a('0x27')]){delete _0x588bdc[_0xcf4a('0x27')];}_0x4be8aa['status'](_0x56ce7a)[_0xcf4a('0x28')](_0x588bdc);};}exports[_0xcf4a('0x29')]=function(_0xd8773b,_0x6b80f7){var _0x51ca5d={},_0x54fda5={},_0x37ed41={'count':0x0,'rows':[]};var _0x1a0d35=_[_0xcf4a('0x2a')](db[_0xcf4a('0x2b')][_0xcf4a('0x2c')],function(_0x2da102){return{'name':_0x2da102[_0xcf4a('0x2d')],'type':_0x2da102[_0xcf4a('0x2e')][_0xcf4a('0x2f')]};});_0x54fda5[_0xcf4a('0x30')]=_[_0xcf4a('0x2a')](_0x1a0d35,'name');_0x54fda5['query']=_['keys'](_0xd8773b[_0xcf4a('0x31')]);_0x54fda5[_0xcf4a('0x32')]=_[_0xcf4a('0x33')](_0x54fda5[_0xcf4a('0x30')],_0x54fda5['query']);_0x51ca5d[_0xcf4a('0x34')]=_[_0xcf4a('0x33')](_0x54fda5[_0xcf4a('0x30')],qs[_0xcf4a('0x35')](_0xd8773b['query'][_0xcf4a('0x35')]));_0x51ca5d[_0xcf4a('0x34')]=_0x51ca5d[_0xcf4a('0x34')][_0xcf4a('0x36')]?_0x51ca5d[_0xcf4a('0x34')]:_0x54fda5[_0xcf4a('0x30')];if(!_0xd8773b['query'][_0xcf4a('0x37')]('nolimit')){_0x51ca5d[_0xcf4a('0x1c')]=qs[_0xcf4a('0x1c')](_0xd8773b[_0xcf4a('0x31')]['limit']);_0x51ca5d[_0xcf4a('0x1f')]=qs[_0xcf4a('0x1f')](_0xd8773b[_0xcf4a('0x31')]['offset']);}_0x51ca5d[_0xcf4a('0x38')]=qs['sort'](_0xd8773b[_0xcf4a('0x31')][_0xcf4a('0x39')]);_0x51ca5d[_0xcf4a('0x3a')]=qs[_0xcf4a('0x32')](_[_0xcf4a('0x3b')](_0xd8773b[_0xcf4a('0x31')],_0x54fda5['filters']),_0x1a0d35);if(_0xd8773b[_0xcf4a('0x31')][_0xcf4a('0x3c')]){_0x51ca5d[_0xcf4a('0x3a')]=_['merge'](_0x51ca5d['where'],{'$or':_['map'](_0x1a0d35,function(_0x13ea2c){if(_0x13ea2c['type']!==_0xcf4a('0x3d')){var _0x16d207={};_0x16d207[_0x13ea2c[_0xcf4a('0x27')]]={'$like':'%'+_0xd8773b[_0xcf4a('0x31')][_0xcf4a('0x3c')]+'%'};return _0x16d207;}})});}_0x51ca5d=_[_0xcf4a('0x3e')]({},_0x51ca5d,_0xd8773b[_0xcf4a('0x3f')]);var _0xd3c8c5={'where':_0x51ca5d['where']};return db[_0xcf4a('0x2b')]['count'](_0xd3c8c5)['then'](function(_0x5812b1){_0x37ed41['count']=_0x5812b1;if(_0xd8773b[_0xcf4a('0x31')][_0xcf4a('0x40')]){_0x51ca5d[_0xcf4a('0x41')]=[{'all':!![]}];}return db['Attachment']['findAll'](_0x51ca5d);})[_0xcf4a('0x23')](function(_0x46d00d){_0x37ed41[_0xcf4a('0x42')]=_0x46d00d;return _0x37ed41;})['then'](respondWithFilteredResult(_0x6b80f7,_0x51ca5d))[_0xcf4a('0x43')](handleError(_0x6b80f7,null));};exports['show']=function(_0x465ed9,_0x2c4af7){var _0x5aae4a={'raw':!![],'where':{'id':_0x465ed9['params']['id']}},_0x362533={};_0x362533['model']=_['keys'](db[_0xcf4a('0x2b')][_0xcf4a('0x2c')]);_0x362533[_0xcf4a('0x31')]=_['keys'](_0x465ed9[_0xcf4a('0x31')]);_0x362533[_0xcf4a('0x32')]=_[_0xcf4a('0x33')](_0x362533['model'],_0x362533[_0xcf4a('0x31')]);_0x5aae4a[_0xcf4a('0x34')]=_[_0xcf4a('0x33')](_0x362533['model'],qs[_0xcf4a('0x35')](_0x465ed9[_0xcf4a('0x31')][_0xcf4a('0x35')]));_0x5aae4a[_0xcf4a('0x34')]=_0x5aae4a['attributes'][_0xcf4a('0x36')]?_0x5aae4a[_0xcf4a('0x34')]:_0x362533[_0xcf4a('0x30')];if(_0x465ed9[_0xcf4a('0x31')][_0xcf4a('0x40')]){_0x5aae4a[_0xcf4a('0x41')]=[{'all':!![]}];}_0x5aae4a=_[_0xcf4a('0x3e')]({},_0x5aae4a,_0x465ed9['options']);return db[_0xcf4a('0x2b')][_0xcf4a('0x44')](_0x5aae4a)['then'](handleEntityNotFound(_0x2c4af7,null))[_0xcf4a('0x23')](respondWithResult(_0x2c4af7,null))[_0xcf4a('0x43')](handleError(_0x2c4af7,null));};exports[_0xcf4a('0x45')]=function(_0x2f1242,_0x3696b5){var _0x11ad96={'where':{'id':_0x2f1242[_0xcf4a('0x46')]['id']}},_0x4df0af={};_0x4df0af[_0xcf4a('0x30')]=_[_0xcf4a('0x47')](db['Attachment'][_0xcf4a('0x2c')]);_0x11ad96['attributes']=_[_0xcf4a('0x33')](_0x4df0af[_0xcf4a('0x30')],qs[_0xcf4a('0x35')](_0x2f1242[_0xcf4a('0x31')][_0xcf4a('0x35')]));_0x11ad96[_0xcf4a('0x34')]=_0x11ad96[_0xcf4a('0x34')][_0xcf4a('0x36')]?_0x11ad96[_0xcf4a('0x34')]:_0x4df0af[_0xcf4a('0x30')];if(_0x2f1242[_0xcf4a('0x31')][_0xcf4a('0x40')]){_0x11ad96[_0xcf4a('0x41')]=[{'all':!![]}];}_0x11ad96=_['merge']({},_0x11ad96,_0x2f1242[_0xcf4a('0x3f')]);return db[_0xcf4a('0x2b')][_0xcf4a('0x44')](_0x11ad96)['then'](handleEntityNotFound(_0x3696b5,null))[_0xcf4a('0x23')](function(_0x2ccf8b){if(_0x2ccf8b){var _0x441214=_0x2ccf8b[_0xcf4a('0x48')]({'plain':!![]});_0x441214=qs[_0xcf4a('0x49')](_0x441214,['id',_0xcf4a('0x4a'),_0xcf4a('0x4b')]);_0x2f1242[_0xcf4a('0x4c')]=_[_0xcf4a('0x49')](_0x2f1242[_0xcf4a('0x4c')],['id','createdAt',_0xcf4a('0x4b')]);return db['Attachment'][_0xcf4a('0x4d')](_[_0xcf4a('0x3e')](_0x441214,_0x2f1242['body']),{'include':_0x2f1242['query'][_0xcf4a('0x40')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x3696b5,0xc9))[_0xcf4a('0x43')](handleError(_0x3696b5,null));};exports[_0xcf4a('0x22')]=function(_0x3be976,_0x36f62e){if(_0x3be976[_0xcf4a('0x4c')]['id']){delete _0x3be976[_0xcf4a('0x4c')]['id'];}return db[_0xcf4a('0x2b')][_0xcf4a('0x44')]({'where':{'id':_0x3be976[_0xcf4a('0x46')]['id']}})[_0xcf4a('0x23')](handleEntityNotFound(_0x36f62e,null))[_0xcf4a('0x23')](saveUpdates(_0x3be976[_0xcf4a('0x4c')],null))['then'](respondWithResult(_0x36f62e,null))[_0xcf4a('0x43')](handleError(_0x36f62e,null));};exports[_0xcf4a('0x4e')]=function(_0x403bf0,_0x173efc){return db[_0xcf4a('0x2b')][_0xcf4a('0x44')]({'where':{'id':_0x403bf0[_0xcf4a('0x46')]['id']}})[_0xcf4a('0x23')](handleEntityNotFound(_0x173efc,null))[_0xcf4a('0x23')](removeEntity(_0x173efc,null))['catch'](handleError(_0x173efc,null));};exports['create']=function(_0x44ea7f,_0x2e08c0,_0x1dc1d4){_0x44ea7f[_0xcf4a('0x4c')][_0xcf4a('0x27')]=_0x44ea7f[_0xcf4a('0x4f')][_0xcf4a('0x50')];_0x44ea7f[_0xcf4a('0x4c')][_0xcf4a('0x51')]=_0x44ea7f[_0xcf4a('0x4f')][_0xcf4a('0x52')];_0x44ea7f[_0xcf4a('0x4c')]['type']=_0x44ea7f[_0xcf4a('0x4f')][_0xcf4a('0x53')];return db[_0xcf4a('0x2b')][_0xcf4a('0x4d')](_0x44ea7f[_0xcf4a('0x4c')])[_0xcf4a('0x23')](respondWithResult(_0x2e08c0,0xc9))['catch'](handleError(_0x2e08c0,null));};exports[_0xcf4a('0x54')]=function(_0x33c9d4,_0x3c46d0,_0x2293dc){return db[_0xcf4a('0x2b')][_0xcf4a('0x55')]({'where':{'id':_0x33c9d4[_0xcf4a('0x46')]['id']},'raw':!![]})[_0xcf4a('0x23')](handleEntityNotFound(_0x3c46d0,null))[_0xcf4a('0x23')](function(_0x389085){if(_0x389085){var _0x1c6348=_0x389085[_0xcf4a('0x56')]!==null;var _0x2c08b6=path[_0xcf4a('0x57')](config[_0xcf4a('0x58')],_0xcf4a('0x59'));if(_0x1c6348){_0x2c08b6=path[_0xcf4a('0x57')](_0x2c08b6,_0xcf4a('0x5a'));}var _0x4e2c76=path['join'](_0x2c08b6,_0x389085[_0xcf4a('0x51')]);return _0x3c46d0['download'](_0x4e2c76);}})[_0xcf4a('0x43')](handleError(_0x3c46d0,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index a9417ea..de90a42 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 _0x2832=['./attachment.attributes','exports','define','Attachment','attachments','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x2832,0x13d));var _0x2283=function(_0x238150,_0x1a510f){_0x238150=_0x238150-0x0;var _0x5b89f4=_0x2832[_0x238150];return _0x5b89f4;};'use strict';var _=require(_0x2283('0x0'));var util=require(_0x2283('0x1'));var logger=require('../../config/logger')(_0x2283('0x2'));var moment=require('moment');var BPromise=require(_0x2283('0x3'));var rp=require(_0x2283('0x4'));var fs=require('fs');var path=require(_0x2283('0x5'));var rimraf=require(_0x2283('0x6'));var config=require(_0x2283('0x7'));var attributes=require(_0x2283('0x8'));module[_0x2283('0x9')]=function(_0x172ae7,_0x162193){return _0x172ae7[_0x2283('0xa')](_0x2283('0xb'),attributes,{'tableName':_0x2283('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc54=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./attachment.attributes','exports','Attachment','attachments','util'];(function(_0x697113,_0x44159a){var _0x35f036=function(_0x1fd84b){while(--_0x1fd84b){_0x697113['push'](_0x697113['shift']());}};_0x35f036(++_0x44159a);}(_0xdc54,0x1c2));var _0x4dc5=function(_0x270247,_0x2a8229){_0x270247=_0x270247-0x0;var _0x3838be=_0xdc54[_0x270247];return _0x3838be;};'use strict';var _=require('lodash');var util=require(_0x4dc5('0x0'));var logger=require(_0x4dc5('0x1'))('api');var moment=require(_0x4dc5('0x2'));var BPromise=require(_0x4dc5('0x3'));var rp=require(_0x4dc5('0x4'));var fs=require('fs');var path=require(_0x4dc5('0x5'));var rimraf=require('rimraf');var config=require(_0x4dc5('0x6'));var attributes=require(_0x4dc5('0x7'));module[_0x4dc5('0x8')]=function(_0x11f784,_0x54540e){return _0x11f784['define'](_0x4dc5('0x9'),attributes,{'tableName':_0x4dc5('0xa'),'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 2140cac..64d8efb 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 _0x8e44=['debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','CreateAttachment','create','options','raw','stringify','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Attachment,\x20%s,\x20%s'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x8e44,0x1ac));var _0x48e4=function(_0x50971f,_0x16256c){_0x50971f=_0x50971f-0x0;var _0x466891=_0x8e44[_0x50971f];return _0x466891;};'use strict';var _=require(_0x48e4('0x0'));var util=require(_0x48e4('0x1'));var moment=require(_0x48e4('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x48e4('0x3'));var db=require(_0x48e4('0x4'))['db'];var utils=require(_0x48e4('0x5'));var logger=require(_0x48e4('0x6'))('rpc');var config=require(_0x48e4('0x7'));var jayson=require(_0x48e4('0x8'));var client=jayson[_0x48e4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e2c12,_0x26c5de,_0xfd30df){return new BPromise(function(_0x552cb1,_0x1ae7a7){return client[_0x48e4('0xa')](_0x4e2c12,_0xfd30df)[_0x48e4('0xb')](function(_0x2ba319){logger[_0x48e4('0xc')](_0x48e4('0xd'),_0x26c5de,'request\x20sent');logger[_0x48e4('0xe')](_0x48e4('0xf'),_0x26c5de,_0x48e4('0x10'),JSON['stringify'](_0x2ba319));if(_0x2ba319['error']){if(_0x2ba319[_0x48e4('0x11')][_0x48e4('0x12')]===0x1f4){logger[_0x48e4('0x11')](_0x48e4('0xd'),_0x26c5de,_0x2ba319['error'][_0x48e4('0x13')]);return _0x1ae7a7(_0x2ba319['error'][_0x48e4('0x13')]);}logger[_0x48e4('0x11')](_0x48e4('0xd'),_0x26c5de,_0x2ba319[_0x48e4('0x11')][_0x48e4('0x13')]);return _0x552cb1(_0x2ba319[_0x48e4('0x11')][_0x48e4('0x13')]);}else{logger['info'](_0x48e4('0xd'),_0x26c5de,_0x48e4('0x10'));_0x552cb1(_0x2ba319['result'][_0x48e4('0x13')]);}})[_0x48e4('0x14')](function(_0x4dc92e){logger[_0x48e4('0x11')](_0x48e4('0xd'),_0x26c5de,_0x4dc92e);_0x1ae7a7(_0x4dc92e);});});}exports[_0x48e4('0x15')]=function(_0x4ffc0d){var _0x231dcd=this;return new Promise(function(_0x16e405,_0x4e3943){return db['Attachment'][_0x48e4('0x16')](_0x4ffc0d['body'],{'raw':_0x4ffc0d['options']?_0x4ffc0d[_0x48e4('0x17')][_0x48e4('0x18')]===undefined?!![]:![]:!![]})[_0x48e4('0xb')](function(_0xad2f7d){logger[_0x48e4('0xc')]('CreateAttachment',_0x4ffc0d);logger['debug'](_0x48e4('0x15'),_0x4ffc0d,JSON[_0x48e4('0x19')](_0xad2f7d));_0x16e405(_0xad2f7d);})[_0x48e4('0x14')](function(_0x131817){logger[_0x48e4('0x11')](_0x48e4('0x15'),_0x131817[_0x48e4('0x13')],_0x4ffc0d);_0x4e3943(_0x231dcd[_0x48e4('0x11')](0x1f4,_0x131817[_0x48e4('0x13')]));});});}; \ No newline at end of file +var _0x00b3=['Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','CreateAttachment','create','body','options','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x00b3,0x17a));var _0x300b=function(_0x2f07ac,_0x2c0208){_0x2f07ac=_0x2f07ac-0x0;var _0x540458=_0x00b3[_0x2f07ac];return _0x540458;};'use strict';var _=require('lodash');var util=require(_0x300b('0x0'));var moment=require(_0x300b('0x1'));var BPromise=require(_0x300b('0x2'));var rs=require(_0x300b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x300b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x300b('0x5'))('rpc');var config=require(_0x300b('0x6'));var jayson=require(_0x300b('0x7'));var client=jayson[_0x300b('0x8')][_0x300b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5af470,_0x5dabb9,_0x30b3fe){return new BPromise(function(_0x590c4d,_0x5e283c){return client[_0x300b('0xa')](_0x5af470,_0x30b3fe)[_0x300b('0xb')](function(_0x457aa3){logger['info'](_0x300b('0xc'),_0x5dabb9,_0x300b('0xd'));logger[_0x300b('0xe')](_0x300b('0xf'),_0x5dabb9,'request\x20sent',JSON[_0x300b('0x10')](_0x457aa3));if(_0x457aa3[_0x300b('0x11')]){if(_0x457aa3[_0x300b('0x11')]['code']===0x1f4){logger[_0x300b('0x11')](_0x300b('0xc'),_0x5dabb9,_0x457aa3[_0x300b('0x11')][_0x300b('0x12')]);return _0x5e283c(_0x457aa3[_0x300b('0x11')][_0x300b('0x12')]);}logger[_0x300b('0x11')](_0x300b('0xc'),_0x5dabb9,_0x457aa3['error']['message']);return _0x590c4d(_0x457aa3['error']['message']);}else{logger[_0x300b('0x13')](_0x300b('0xc'),_0x5dabb9,_0x300b('0xd'));_0x590c4d(_0x457aa3[_0x300b('0x14')]['message']);}})['catch'](function(_0x35b1d7){logger[_0x300b('0x11')](_0x300b('0xc'),_0x5dabb9,_0x35b1d7);_0x5e283c(_0x35b1d7);});});}exports[_0x300b('0x15')]=function(_0x4d2024){var _0x1fbf16=this;return new Promise(function(_0x2a7d96,_0xb4b3fa){return db['Attachment'][_0x300b('0x16')](_0x4d2024[_0x300b('0x17')],{'raw':_0x4d2024[_0x300b('0x18')]?_0x4d2024[_0x300b('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x300b('0xb')](function(_0x16bfc6){logger[_0x300b('0x13')]('CreateAttachment',_0x4d2024);logger[_0x300b('0xe')](_0x300b('0x15'),_0x4d2024,JSON[_0x300b('0x10')](_0x16bfc6));_0x2a7d96(_0x16bfc6);})[_0x300b('0x19')](function(_0x26913f){logger['error']('CreateAttachment',_0x26913f[_0x300b('0x12')],_0x4d2024);_0xb4b3fa(_0x1fbf16[_0x300b('0x11')](0x1f4,_0x26913f[_0x300b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 3845e98..bc4d495 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 _0x757a=['put','/:id','update','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','post','/:id/clone','clone','diskStorage','%s-%s','replace','single','file','create'];(function(_0x504aac,_0x46f0ab){var _0x5c2ab5=function(_0x37b56b){while(--_0x37b56b){_0x504aac['push'](_0x504aac['shift']());}};_0x5c2ab5(++_0x46f0ab);}(_0x757a,0xde));var _0xa757=function(_0x48c80a,_0x2759f9){_0x48c80a=_0x48c80a-0x0;var _0x3aeca6=_0x757a[_0x48c80a];return _0x3aeca6;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['download']);router[_0xa757('0xc')](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0xe')]);var upload=multer({'storage':multer[_0xa757('0xf')]({'destination':function(_0x188ad5,_0x17408b,_0x483d77){_0x483d77(null,path['join'](config['root'],'server/files/attachments/'));},'filename':function(_0x4db68e,_0x421040,_0x544b45){_0x544b45(null,util['format'](_0xa757('0x10'),Date['now'](),_0x421040['originalname'][_0xa757('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xa757('0xc')]('/',upload[_0xa757('0x12')](_0xa757('0x13')),controller[_0xa757('0x14')]);router[_0xa757('0x15')](_0xa757('0x16'),auth[_0xa757('0x9')](),controller[_0xa757('0x17')]);router[_0xa757('0x18')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0x19')]);module[_0xa757('0x1a')]=router; \ No newline at end of file +var _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x40ea13,_0x2a639a){var _0x3dd17c=function(_0x273c7f){while(--_0x273c7f){_0x40ea13['push'](_0x40ea13['shift']());}};_0x3dd17c(++_0x2a639a);}(_0xadb5,0xad));var _0x5adb=function(_0x7ab40f,_0x476aea){_0x7ab40f=_0x7ab40f-0x0;var _0x47ccaf=_0xadb5[_0x7ab40f];return _0x47ccaf;};'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('./attachment.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')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 8b2fe6d..f69fbf5 100644 --- a/server/api/authActiveDirectory/authActiveDirectory.controller.js +++ b/server/api/authActiveDirectory/authActiveDirectory.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9108=['api','activedirectory','baseDN','domain','authenticate','Error\x20authenticate\x20%s:\x20%s','inspect','error','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','then','adSsoEnabled','name','password','salt','role','disabled','blocked','blockedAt','online','user','blockDuration','add','minutes','clearBlockUser','getLicense','catch','status','send','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../components/auth/service','../../config/utils','../../config/environment'];(function(_0xf1121d,_0x5d917b){var _0x4b0f5b=function(_0x2c2e09){while(--_0x2c2e09){_0xf1121d['push'](_0xf1121d['shift']());}};_0x4b0f5b(++_0x5d917b);}(_0x9108,0x1d6));var _0x8910=function(_0x49c69c,_0x2e6150){_0x49c69c=_0x49c69c-0x0;var _0x55cdd2=_0x9108[_0x49c69c];return _0x55cdd2;};'use strict';var passport=require(_0x8910('0x0'));var LocalStrategy=require(_0x8910('0x1'))[_0x8910('0x2')];var moment=require(_0x8910('0x3'));var ActiveDirectory=require(_0x8910('0x4'));var BPromise=require(_0x8910('0x5'));var util=require(_0x8910('0x6'));var db=require('../../mysqldb')['db'];var authService=require(_0x8910('0x7'));var utils=require(_0x8910('0x8'));var config=require(_0x8910('0x9'));var logger=require('../../config/logger')(_0x8910('0xa'));function isActiveDirectoryConfigured(_0x454c57){var _0x1a39d2=![];if(typeof _0x454c57[_0x8910('0xb')]!=='undefined'){_0x1a39d2=_0x454c57[_0x8910('0xb')][_0x8910('0xc')]&&_0x454c57[_0x8910('0xb')]['url']&&_0x454c57[_0x8910('0xb')][_0x8910('0xd')];}return _0x1a39d2;}function adAuthenticate(_0x29e986,_0x4b4825,_0x1d1b73){return new BPromise(function(_0x35e3a3,_0x1fc80f){try{var _0x483bb2=new ActiveDirectory(_0x29e986);_0x483bb2[_0x8910('0xe')](_0x4b4825,_0x1d1b73,function(_0x44a48c,_0x330324){if(_0x44a48c){logger['error'](_0x8910('0xf'),_0x4b4825,util[_0x8910('0x10')](_0x44a48c,{'showHidden':![],'depth':null}));_0x1fc80f('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x330324){logger[_0x8910('0x11')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x4b4825);_0x1fc80f(_0x8910('0x12'));}else{_0x35e3a3(_0x330324);}});}catch(_0x342e79){_0x1fc80f(_0x342e79);}});}function ActiveDirectoryAuthenticate(_0x41548d,_0x3416ef,_0x2cd9ed,_0x239d33){var _0x2aad27,_0x25ad53;if(!isActiveDirectoryConfigured(config)){logger[_0x8910('0x11')](_0x8910('0x13'),_0x3416ef);return _0x239d33(null,![],{'message':_0x8910('0x12')});}return db[_0x8910('0x14')][_0x8910('0x15')]({'where':{'id':0x1},'attributes':['adSsoEnabled','blockDuration'],'raw':!![]})[_0x8910('0x16')](function(_0x5f2fce){_0x2aad27=_0x5f2fce;if(!_0x2aad27[_0x8910('0x17')]){logger[_0x8910('0x11')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x3416ef);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x41548d[_0x8910('0x15')]({'attributes':['id',_0x8910('0x18'),_0x8910('0x19'),_0x8910('0x1a'),_0x8910('0x1b'),_0x8910('0x1c'),_0x8910('0x1d'),_0x8910('0x1e'),_0x8910('0x1f')],'where':{'name':_0x3416ef,'role':{'$or':['admin',_0x8910('0x20'),'agent']},'adSsoEnabled':!![]}});})['then'](function(_0xeb1cbf){if(!_0xeb1cbf||_0xeb1cbf&&_0xeb1cbf[_0x8910('0x18')]!==_0x3416ef){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x25ad53=_0xeb1cbf;var _0xd1e0ad=_0x25ad53['name']+'@'+config[_0x8910('0xb')][_0x8910('0xd')];return adAuthenticate(config[_0x8910('0xb')],_0xd1e0ad,_0x2cd9ed);})[_0x8910('0x16')](function(_0x31c35d){if(_0x25ad53['disabled']){throw new Error(_0x8910('0x12'));}if(_0x2aad27[_0x8910('0x21')]>0x0){if(_0x25ad53[_0x8910('0x1d')]){if(moment(_0x25ad53[_0x8910('0x1e')])[_0x8910('0x22')](_0x2aad27[_0x8910('0x21')],_0x8910('0x23'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0x8910('0x24')](_0x25ad53,0x0,![],null)[_0x8910('0x16')](function(){return utils[_0x8910('0x25')](_0x25ad53);})[_0x8910('0x16')](function(){return _0x239d33(null,_0x25ad53);});}else{return utils[_0x8910('0x25')](_0x25ad53)['then'](function(){return _0x239d33(null,_0x25ad53);});}}else{return utils[_0x8910('0x25')](_0x25ad53)['then'](function(){return _0x239d33(null,_0x25ad53);});}})[_0x8910('0x26')](function(_0xaad70b){return _0x239d33(null,![],_0xaad70b);});}function handleError(_0x18d45d,_0x395330,_0xc2de4f){return _0x18d45d[_0x8910('0x27')](_0x395330||0x1f4)[_0x8910('0x28')]({'message':_0xc2de4f?_0xc2de4f['message']||_0xc2de4f:''});}exports[_0x8910('0x29')]=function(_0x4a13a5,_0x38982f,_0xfbaf9f){passport['authenticate'](_0x8910('0x2a'),function(_0x5e0595,_0x2b18f2,_0x5c0fa8){var _0x1b83a5=_0x5e0595||_0x5c0fa8;if(_0x1b83a5){return handleError(_0x38982f,0x191,_0x1b83a5);}if(!_0x2b18f2){return handleError(_0x38982f,0x194,{'message':_0x8910('0x2b')});}else{var _0x1c671f={'payload':{'id':_0x2b18f2['id'],'role':_0x2b18f2[_0x8910('0x1b')]},'options':{'expiresIn':0x15180}};return authService[_0x8910('0x2c')](_0x1c671f)[_0x8910('0x16')](function(_0xeb075e){_0x38982f[_0x8910('0x2d')]({'id':_0x2b18f2['id'],'token':_0xeb075e,'statusCall':'','isAlreadyLogged':_0x2b18f2[_0x8910('0x1f')]});});}})(_0x4a13a5,_0x38982f,_0xfbaf9f);};passport[_0x8910('0x2e')](_0x8910('0x2a'),new LocalStrategy({'usernameField':_0x8910('0x18'),'passwordField':_0x8910('0x19')},function(_0x4451e7,_0x25cb6c,_0x1f28d9){return ActiveDirectoryAuthenticate(db[_0x8910('0x2f')],_0x4451e7,_0x25cb6c,_0x1f28d9);})); \ No newline at end of file +var _0xaafc=['Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','disabled','blocked','blockedAt','online','user','agent','then','domain','add','minutes','getLicense','catch','status','message','json','use','ad-login','User','passport-local','Strategy','moment','activedirectory2','util','../../mysqldb','../../config/environment','api','activedirectory','undefined','authenticate','error','Error\x20authenticate\x20%s:\x20%s'];(function(_0x11da55,_0x1456f0){var _0x127e89=function(_0x342b99){while(--_0x342b99){_0x11da55['push'](_0x11da55['shift']());}};_0x127e89(++_0x1456f0);}(_0xaafc,0x176));var _0xcaaf=function(_0x3caffc,_0x393921){_0x3caffc=_0x3caffc-0x0;var _0x533d1b=_0xaafc[_0x3caffc];return _0x533d1b;};'use strict';var passport=require('passport');var LocalStrategy=require(_0xcaaf('0x0'))[_0xcaaf('0x1')];var moment=require(_0xcaaf('0x2'));var ActiveDirectory=require(_0xcaaf('0x3'));var BPromise=require('bluebird');var util=require(_0xcaaf('0x4'));var db=require(_0xcaaf('0x5'))['db'];var authService=require('../../components/auth/service');var utils=require('../../config/utils');var config=require(_0xcaaf('0x6'));var logger=require('../../config/logger')(_0xcaaf('0x7'));function isActiveDirectoryConfigured(_0x54757a){var _0x31e6bb=![];if(typeof _0x54757a[_0xcaaf('0x8')]!==_0xcaaf('0x9')){_0x31e6bb=_0x54757a[_0xcaaf('0x8')]['baseDN']&&_0x54757a[_0xcaaf('0x8')]['url']&&_0x54757a[_0xcaaf('0x8')]['domain'];}return _0x31e6bb;}function adAuthenticate(_0x94f4d6,_0x5f11b0,_0x163ced){return new BPromise(function(_0x12f13d,_0x2563a0){try{var _0x9dc02=new ActiveDirectory(_0x94f4d6);_0x9dc02[_0xcaaf('0xa')](_0x5f11b0,_0x163ced,function(_0x42078d,_0x46f2e1){if(_0x42078d){logger[_0xcaaf('0xb')](_0xcaaf('0xc'),_0x5f11b0,util['inspect'](_0x42078d,{'showHidden':![],'depth':null}));_0x2563a0(_0xcaaf('0xd'));}else if(!_0x46f2e1){logger[_0xcaaf('0xb')](_0xcaaf('0xe'),_0x5f11b0);_0x2563a0(_0xcaaf('0xd'));}else{_0x12f13d(_0x46f2e1);}});}catch(_0x215949){_0x2563a0(_0x215949);}});}function ActiveDirectoryAuthenticate(_0x35d596,_0x6afc3,_0x439c40,_0x42861d){var _0x168550,_0x953779;if(!isActiveDirectoryConfigured(config)){logger['error'](_0xcaaf('0xf'),_0x6afc3);return _0x42861d(null,![],{'message':_0xcaaf('0xd')});}return db[_0xcaaf('0x10')][_0xcaaf('0x11')]({'where':{'id':0x1},'attributes':[_0xcaaf('0x12'),_0xcaaf('0x13')],'raw':!![]})['then'](function(_0xf8e303){_0x168550=_0xf8e303;if(!_0x168550[_0xcaaf('0x12')]){logger['error'](_0xcaaf('0x14'),_0x6afc3);throw new Error(_0xcaaf('0xd'));}return _0x35d596[_0xcaaf('0x11')]({'attributes':['id',_0xcaaf('0x15'),_0xcaaf('0x16'),_0xcaaf('0x17'),_0xcaaf('0x18'),_0xcaaf('0x19'),_0xcaaf('0x1a'),_0xcaaf('0x1b'),_0xcaaf('0x1c')],'where':{'name':_0x6afc3,'role':{'$or':['admin',_0xcaaf('0x1d'),_0xcaaf('0x1e')]},'adSsoEnabled':!![]}});})[_0xcaaf('0x1f')](function(_0x110974){if(!_0x110974||_0x110974&&_0x110974[_0xcaaf('0x15')]!==_0x6afc3){throw new Error(_0xcaaf('0xd'));}_0x953779=_0x110974;var _0x189f56=_0x953779['name']+'@'+config[_0xcaaf('0x8')][_0xcaaf('0x20')];return adAuthenticate(config[_0xcaaf('0x8')],_0x189f56,_0x439c40);})['then'](function(_0x34f878){if(_0x953779[_0xcaaf('0x19')]){throw new Error(_0xcaaf('0xd'));}if(_0x168550[_0xcaaf('0x13')]>0x0){if(_0x953779[_0xcaaf('0x1a')]){if(moment(_0x953779[_0xcaaf('0x1b')])[_0xcaaf('0x21')](_0x168550['blockDuration'],_0xcaaf('0x22'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils['clearBlockUser'](_0x953779,0x0,![],null)['then'](function(){return utils[_0xcaaf('0x23')](_0x953779);})[_0xcaaf('0x1f')](function(){return _0x42861d(null,_0x953779);});}else{return utils[_0xcaaf('0x23')](_0x953779)[_0xcaaf('0x1f')](function(){return _0x42861d(null,_0x953779);});}}else{return utils[_0xcaaf('0x23')](_0x953779)[_0xcaaf('0x1f')](function(){return _0x42861d(null,_0x953779);});}})[_0xcaaf('0x24')](function(_0x34019c){return _0x42861d(null,![],_0x34019c);});}function handleError(_0x1523bc,_0x4c75a9,_0x4cacf9){return _0x1523bc[_0xcaaf('0x25')](_0x4c75a9||0x1f4)['send']({'message':_0x4cacf9?_0x4cacf9[_0xcaaf('0x26')]||_0x4cacf9:''});}exports['login']=function(_0x343cd5,_0x10fec3,_0x2e8530){passport[_0xcaaf('0xa')]('ad-login',function(_0x20ee40,_0x2d0881,_0x35bec2){var _0x571948=_0x20ee40||_0x35bec2;if(_0x571948){return handleError(_0x10fec3,0x191,_0x571948);}if(!_0x2d0881){return handleError(_0x10fec3,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x120e52={'payload':{'id':_0x2d0881['id'],'role':_0x2d0881[_0xcaaf('0x18')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x120e52)[_0xcaaf('0x1f')](function(_0x315565){_0x10fec3[_0xcaaf('0x27')]({'id':_0x2d0881['id'],'token':_0x315565,'statusCall':'','isAlreadyLogged':_0x2d0881[_0xcaaf('0x1c')]});});}})(_0x343cd5,_0x10fec3,_0x2e8530);};passport[_0xcaaf('0x28')](_0xcaaf('0x29'),new LocalStrategy({'usernameField':_0xcaaf('0x15'),'passwordField':_0xcaaf('0x16')},function(_0x2bc7f6,_0x4f1eb1,_0x48b018){return ActiveDirectoryAuthenticate(db[_0xcaaf('0x2a')],_0x2bc7f6,_0x4f1eb1,_0x48b018);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 9ee3f94..773593c 100644 --- a/server/api/authActiveDirectory/index.js +++ b/server/api/authActiveDirectory/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6cc5=['./authActiveDirectory.controller','post','login','exports','express'];(function(_0x32cbe0,_0x594209){var _0x49b861=function(_0x55812b){while(--_0x55812b){_0x32cbe0['push'](_0x32cbe0['shift']());}};_0x49b861(++_0x594209);}(_0x6cc5,0xb3));var _0x56cc=function(_0x5bf65d,_0x3cc52e){_0x5bf65d=_0x5bf65d-0x0;var _0x4ebeb7=_0x6cc5[_0x5bf65d];return _0x4ebeb7;};'use strict';var express=require(_0x56cc('0x0'));var router=express['Router']();var controller=require(_0x56cc('0x1'));router[_0x56cc('0x2')]('/',controller[_0x56cc('0x3')]);module[_0x56cc('0x4')]=router; \ No newline at end of file +var _0x97ea=['express','Router','./authActiveDirectory.controller','post','exports'];(function(_0xa546b9,_0x265b5f){var _0x1a5815=function(_0x55a467){while(--_0x55a467){_0xa546b9['push'](_0xa546b9['shift']());}};_0x1a5815(++_0x265b5f);}(_0x97ea,0x15e));var _0xa97e=function(_0x364997,_0x3ce8bd){_0x364997=_0x364997-0x0;var _0x27e571=_0x97ea[_0x364997];return _0x27e571;};'use strict';var express=require(_0xa97e('0x0'));var router=express[_0xa97e('0x1')]();var controller=require(_0xa97e('0x2'));router[_0xa97e('0x3')]('/',controller['login']);module[_0xa97e('0x4')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 8d5204a..452a676 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0x7a54,0x106));var _0x47a5=function(_0x463577,_0x5832ef){_0x463577=_0x463577-0x0;var _0x22c594=_0x7a54[_0x463577];return _0x22c594;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x8ee685,_0x2c7a1e){var _0x33187a=function(_0x97494c){while(--_0x97494c){_0x8ee685['push'](_0x8ee685['shift']());}};_0x33187a(++_0x2c7a1e);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index df9db01..7894340 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 _0x1d05=['get','/callback','callback','exports','passport','Router','./authGoogle.controller','../../components/auth/service'];(function(_0x27c112,_0x503e0c){var _0x4c82c7=function(_0x16597e){while(--_0x16597e){_0x27c112['push'](_0x27c112['shift']());}};_0x4c82c7(++_0x503e0c);}(_0x1d05,0xc4));var _0x51d0=function(_0x15d15b,_0x3eb0b0){_0x15d15b=_0x15d15b-0x0;var _0x45be4b=_0x1d05[_0x15d15b];return _0x45be4b;};'use strict';var express=require('express');var passport=require(_0x51d0('0x0'));var router=express[_0x51d0('0x1')]();var controller=require(_0x51d0('0x2'));var userController=require('../user/user.controller.js');var authService=require(_0x51d0('0x3'));router[_0x51d0('0x4')]('/',controller['login']);router['get'](_0x51d0('0x5'),controller[_0x51d0('0x6')],authService['isMiddleware'],userController['login'],authService['setTokenCookie']);module[_0x51d0('0x7')]=router; \ No newline at end of file +var _0x2462=['isMiddleware','exports','passport','./authGoogle.controller','../../components/auth/service','get','login','/callback','callback'];(function(_0x56f879,_0x2dad26){var _0x35d0c3=function(_0x25a1dd){while(--_0x25a1dd){_0x56f879['push'](_0x56f879['shift']());}};_0x35d0c3(++_0x2dad26);}(_0x2462,0x77));var _0x2246=function(_0xd0fbce,_0x1c418c){_0xd0fbce=_0xd0fbce-0x0;var _0x2fedd4=_0x2462[_0xd0fbce];return _0x2fedd4;};'use strict';var express=require('express');var passport=require(_0x2246('0x0'));var router=express['Router']();var controller=require(_0x2246('0x1'));var userController=require('../user/user.controller.js');var authService=require(_0x2246('0x2'));router[_0x2246('0x3')]('/',controller[_0x2246('0x4')]);router['get'](_0x2246('0x5'),controller[_0x2246('0x6')],authService[_0x2246('0x7')],userController[_0x2246('0x4')],authService['setTokenCookie']);module[_0x2246('0x8')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index e4f4053..68a6b17 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 _0xffb5=['../../mysqldb','../../components/auth/service','../../config/utils','client','http','findOne','allowedLoginAttempts','blockDuration','name','password','salt','role','disabled','blocked','admin','user','then','authenticate','loginAttempts','blockedAt','add','clearBlockUser','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','minutes','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','getSmtpOptions','merge','\x22%s\x22\x20<%s>','request','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','Setting','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','validatePasswordHistory','Password\x20reset!','use','util','passport-local','jayson/promise','lodash'];(function(_0x13ac0c,_0x23a735){var _0x909f31=function(_0x3ffad0){while(--_0x3ffad0){_0x13ac0c['push'](_0x13ac0c['shift']());}};_0x909f31(++_0x23a735);}(_0xffb5,0x1ee));var _0x5ffb=function(_0x18b90e,_0x452a6){_0x18b90e=_0x18b90e-0x0;var _0x2913a5=_0xffb5[_0x18b90e];return _0x2913a5;};'use strict';var util=require(_0x5ffb('0x0'));var passport=require('passport');var LocalStrategy=require(_0x5ffb('0x1'))['Strategy'];var jayson=require(_0x5ffb('0x2'));var _=require(_0x5ffb('0x3'));var rs=require('randomstring');var moment=require('moment');var db=require(_0x5ffb('0x4'))['db'];var authService=require(_0x5ffb('0x5'));var utils=require(_0x5ffb('0x6'));var client=jayson[_0x5ffb('0x7')][_0x5ffb('0x8')]({'port':0x232b});function localAuthenticate(_0x15dee0,_0x45c74c,_0x49c24b,_0x4c6896){var _0x12265c,_0x5f323c;return db['Setting'][_0x5ffb('0x9')]({'where':{'id':0x1},'attributes':[_0x5ffb('0xa'),_0x5ffb('0xb')],'raw':!![]})['then'](function(_0x3e454c){_0x12265c=_0x3e454c;return _0x15dee0[_0x5ffb('0x9')]({'attributes':['id',_0x5ffb('0xc'),_0x5ffb('0xd'),_0x5ffb('0xe'),_0x5ffb('0xf'),_0x5ffb('0x10'),_0x5ffb('0x11'),'blockedAt','loginAttempts'],'where':{'name':_0x45c74c,'role':{'$or':[_0x5ffb('0x12'),_0x5ffb('0x13'),'agent']}}});})[_0x5ffb('0x14')](function(_0x27198e){if(!_0x27198e||_0x27198e&&_0x27198e[_0x5ffb('0xc')]!==_0x45c74c){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x5f323c=_0x27198e;return _0x5f323c;}})[_0x5ffb('0x14')](function(){_0x5f323c[_0x5ffb('0x15')](_0x49c24b,function(_0x153384,_0x241f8c){var _0x31c2b1=_0x5f323c[_0x5ffb('0x16')]+0x1;if(_0x153384){return _0x4c6896(_0x153384);}else if(!_0x241f8c){if(_0x5f323c[_0x5ffb('0x10')]){return _0x4c6896(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x12265c[_0x5ffb('0xa')]>0x0){if(_0x5f323c['blocked']){if(_0x12265c[_0x5ffb('0xb')]>0x0){if(moment(_0x5f323c[_0x5ffb('0x17')])[_0x5ffb('0x18')](_0x12265c[_0x5ffb('0xb')],'minutes')>moment()){return _0x4c6896(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x5ffb('0x19')](_0x5f323c,_0x31c2b1,![],null)[_0x5ffb('0x14')](function(){return _0x4c6896(null,![],{'message':_0x5ffb('0x1a')});});}}else{return _0x4c6896(null,![],{'message':_0x5ffb('0x1a')});}}else{if(_0x31c2b1>=_0x12265c[_0x5ffb('0xa')]){return utils[_0x5ffb('0x19')](_0x5f323c,0x0,!![],moment())[_0x5ffb('0x14')](function(){return _0x4c6896(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils['clearBlockUser'](_0x5f323c,_0x31c2b1,![],null)[_0x5ffb('0x14')](function(){return _0x4c6896(null,![],{'message':_0x5ffb('0x1a')});});}}}else{return _0x4c6896(null,![],{'message':_0x5ffb('0x1a')});}}else{if(_0x5f323c['disabled']){return _0x4c6896(null,![],{'message':_0x5ffb('0x1a')});}else if(_0x12265c[_0x5ffb('0xa')]>0x0){if(_0x5f323c[_0x5ffb('0x11')]){if(_0x12265c[_0x5ffb('0xb')]>0x0){if(moment(_0x5f323c[_0x5ffb('0x17')])[_0x5ffb('0x18')](_0x12265c[_0x5ffb('0xb')],_0x5ffb('0x1b'))>moment()){return _0x4c6896(null,![],{'message':_0x5ffb('0x1a')});}else{return utils[_0x5ffb('0x19')](_0x5f323c,0x0,![],null)[_0x5ffb('0x14')](function(){return utils[_0x5ffb('0x1c')](_0x5f323c);})[_0x5ffb('0x14')](function(){return _0x4c6896(null,_0x5f323c);});}}else{return _0x4c6896(null,![],{'message':_0x5ffb('0x1a')});}}else{return utils['clearBlockUser'](_0x5f323c,0x0,![],null)['then'](function(){return utils[_0x5ffb('0x1c')](_0x5f323c);})['then'](function(){return _0x4c6896(null,_0x5f323c);})[_0x5ffb('0x1d')](function(_0xa98da3){return _0x4c6896(null,![],_0xa98da3);});}}else{if(_0x5f323c[_0x5ffb('0x11')]){return _0x4c6896(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x5ffb('0x1c')](_0x5f323c)[_0x5ffb('0x14')](function(){return _0x4c6896(null,_0x5f323c);});}}}});})[_0x5ffb('0x1d')](function(_0x3b0188){return _0x4c6896(null,![],_0x3b0188);});}function sendServiceMail(_0x8f060c){return db[_0x5ffb('0x1e')][_0x5ffb('0x1f')]({'where':{'service':!![]},'attributes':['id',_0x5ffb('0xc'),_0x5ffb('0x20')],'include':[{'model':db[_0x5ffb('0x21')],'as':_0x5ffb('0x22'),'include':[{'model':db['CloudProvider'],'as':_0x5ffb('0x23')}]}]})[_0x5ffb('0x14')](function(_0x5b295a){if(!_0x5b295a){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x511cb8=_0x5b295a[_0x5ffb('0x24')]();var _0x3bb6fe={'account':_0x511cb8,'message':_[_0x5ffb('0x25')]({'from':util['format'](_0x5ffb('0x26'),_0x5b295a[_0x5ffb('0xc')],_0x5b295a[_0x5ffb('0x20')]||_0x5b295a[_0x5ffb('0x22')]['user'])},_0x8f060c)};return client[_0x5ffb('0x27')]('SendMail',_0x3bb6fe);})['then'](function(_0x3cdd9a){if(_0x3cdd9a[_0x5ffb('0x28')]){throw new Error(util['format'](_0x5ffb('0x29'),_0x3cdd9a['error'][_0x5ffb('0x2a')]||JSON['stringify'](_0x3cdd9a[_0x5ffb('0x28')])));}return!![];});}function handleError(_0x599318,_0x1858ab,_0x30edac){return _0x599318[_0x5ffb('0x2b')](_0x1858ab||0x1f4)['send']({'message':_0x30edac?_0x30edac['message']||_0x30edac:''});}exports['login']=function(_0x5dc8d2,_0x3a38e2,_0x1f05d8){passport[_0x5ffb('0x15')](_0x5ffb('0x2c'),function(_0x3c82a1,_0x4d8402,_0x373b61){var _0x100963=_0x3c82a1||_0x373b61;if(_0x100963){return handleError(_0x3a38e2,0x191,_0x100963);}if(!_0x4d8402){return handleError(_0x3a38e2,0x194,{'message':_0x5ffb('0x2d')});}else{var _0x17d324={'payload':{'id':_0x4d8402['id'],'role':_0x4d8402[_0x5ffb('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0x5ffb('0x2e')](_0x17d324)[_0x5ffb('0x14')](function(_0xe055f){_0x3a38e2[_0x5ffb('0x2f')]({'id':_0x4d8402['id'],'token':_0xe055f,'statusCall':'','isAlreadyLogged':_0x4d8402[_0x5ffb('0x30')]});});}})(_0x5dc8d2,_0x3a38e2,_0x1f05d8);};exports[_0x5ffb('0x31')]=function(_0x3559b8,_0x1c6a95){if(!_0x3559b8[_0x5ffb('0x32')][_0x5ffb('0x20')]){return handleError(_0x1c6a95,0x1f4,{'message':_0x5ffb('0x33')});}var _0x34377a=rs[_0x5ffb('0x34')]();_0x3559b8[_0x5ffb('0x32')]['email']=_0x3559b8[_0x5ffb('0x32')][_0x5ffb('0x20')]['trim']()[_0x5ffb('0x35')]();var _0x5e1588;return db['Setting'][_0x5ffb('0x9')]({'where':{'id':0x1},'attributes':[_0x5ffb('0xa'),'blockDuration'],'raw':!![]})[_0x5ffb('0x14')](function(_0x5e50b6){_0x5e1588=_0x5e50b6;return db[_0x5ffb('0x36')]['find']({'where':{'email':_0x3559b8[_0x5ffb('0x32')][_0x5ffb('0x20')]}});})[_0x5ffb('0x14')](function(_0x16ab11){if(!_0x16ab11){throw new Error(_0x5ffb('0x37'));}if(_0x16ab11['disabled']){throw new Error(_0x5ffb('0x38'));}if(_0x16ab11[_0x5ffb('0x11')]){if(moment(_0x16ab11[_0x5ffb('0x17')])['add'](_0x5e1588[_0x5ffb('0xb')],_0x5ffb('0x1b'))>moment()){throw new Error(_0x5ffb('0x39'));}else{_0x16ab11[_0x5ffb('0x11')]=![];_0x16ab11[_0x5ffb('0x17')]=null;}}_0x16ab11[_0x5ffb('0x3a')]=_0x34377a;_0x16ab11[_0x5ffb('0x3b')]=Date[_0x5ffb('0x3c')]()+0x36ee80;return _0x16ab11[_0x5ffb('0x3d')]();})[_0x5ffb('0x14')](function(){return sendServiceMail({'to':_0x3559b8[_0x5ffb('0x32')]['email'],'subject':_0x5ffb('0x3e'),'text':_0x5ffb('0x3f')+_0x5ffb('0x40')+_0x5ffb('0x41')+_0x3559b8[_0x5ffb('0x42')][_0x5ffb('0x43')]+'/reset/'+_0x34377a+'\x0a\x0a'+_0x5ffb('0x44')});})[_0x5ffb('0x14')](function(){_0x1c6a95['status'](0xc8)[_0x5ffb('0x45')]({'message':_0x5ffb('0x46')});})[_0x5ffb('0x1d')](function(_0x48b6f4){return handleError(_0x1c6a95,0x1f4,_0x48b6f4);});};exports[_0x5ffb('0x47')]=function(_0x4a9383,_0x2a1f48){return db[_0x5ffb('0x36')][_0x5ffb('0x1f')]({'where':{'resetPasswordToken':_0x4a9383[_0x5ffb('0x48')][_0x5ffb('0x49')],'resetPasswordExpires':{'$gt':Date[_0x5ffb('0x3c')]()}}})[_0x5ffb('0x14')](function(_0x2c8a70){if(!_0x2c8a70){throw new Error(_0x5ffb('0x4a'));}return db[_0x5ffb('0x4b')][_0x5ffb('0x9')]({'attributes':['id',_0x5ffb('0x4c'),_0x5ffb('0x4d'),_0x5ffb('0x4e')]})['then'](function(_0xf5d989){if(_0xf5d989[_0x5ffb('0x4c')])authService[_0x5ffb('0x4f')](_0x4a9383[_0x5ffb('0x32')][_0x5ffb('0xd')]);if(!_0xf5d989['enforcePasswordHistory']||!_0x2c8a70['previousPasswords'])return _0x2c8a70;authService[_0x5ffb('0x50')](_0x4a9383[_0x5ffb('0x32')]['password'],_0x2c8a70['previousPasswords'],_0xf5d989[_0x5ffb('0x4e')]);return _0x2c8a70;})[_0x5ffb('0x14')](function(){_0x2c8a70[_0x5ffb('0xd')]=_0x4a9383[_0x5ffb('0x32')][_0x5ffb('0xd')];_0x2c8a70[_0x5ffb('0x3a')]=null;_0x2c8a70[_0x5ffb('0x3b')]=null;return _0x2c8a70[_0x5ffb('0x3d')]();});})[_0x5ffb('0x14')](function(){_0x2a1f48['status'](0xc8)[_0x5ffb('0x45')]({'message':_0x5ffb('0x51')});})[_0x5ffb('0x1d')](function(_0x34b087){return handleError(_0x2a1f48,0x1f4,_0x34b087);});};passport[_0x5ffb('0x52')](_0x5ffb('0x2c'),new LocalStrategy({'usernameField':'name','passwordField':_0x5ffb('0xd')},function(_0x535d48,_0x225dbe,_0x4991f8){return localAuthenticate(db[_0x5ffb('0x36')],_0x535d48,_0x225dbe,_0x4991f8);})); \ No newline at end of file +var _0x47f3=['validatePasswordPattern','enforcePasswordHistory','previousPasswords','validatePasswordHistory','resetPasswordToken','resetPasswordExpires','use','util','Strategy','moment','../../components/auth/service','../../config/utils','http','Setting','findOne','allowedLoginAttempts','then','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blockDuration','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','format','\x22%s\x22\x20<%s>','request','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','trim','toLowerCase','User','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','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','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','host','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','token','securePassword','passwordHistoryLimit'];(function(_0x597f5d,_0x38b919){var _0x4f94f6=function(_0x43ef1c){while(--_0x43ef1c){_0x597f5d['push'](_0x597f5d['shift']());}};_0x4f94f6(++_0x38b919);}(_0x47f3,0xf4));var _0x347f=function(_0x413004,_0x1fd8a7){_0x413004=_0x413004-0x0;var _0x36328a=_0x47f3[_0x413004];return _0x36328a;};'use strict';var util=require(_0x347f('0x0'));var passport=require('passport');var LocalStrategy=require('passport-local')[_0x347f('0x1')];var jayson=require('jayson/promise');var _=require('lodash');var rs=require('randomstring');var moment=require(_0x347f('0x2'));var db=require('../../mysqldb')['db'];var authService=require(_0x347f('0x3'));var utils=require(_0x347f('0x4'));var client=jayson['client'][_0x347f('0x5')]({'port':0x232b});function localAuthenticate(_0x3b402c,_0xcc6d0a,_0x49dd8a,_0x3a5e9f){var _0x2d9433,_0x5543e8;return db[_0x347f('0x6')][_0x347f('0x7')]({'where':{'id':0x1},'attributes':[_0x347f('0x8'),'blockDuration'],'raw':!![]})[_0x347f('0x9')](function(_0x41b234){_0x2d9433=_0x41b234;return _0x3b402c[_0x347f('0x7')]({'attributes':['id',_0x347f('0xa'),_0x347f('0xb'),_0x347f('0xc'),_0x347f('0xd'),_0x347f('0xe'),_0x347f('0xf'),_0x347f('0x10'),_0x347f('0x11')],'where':{'name':_0xcc6d0a,'role':{'$or':[_0x347f('0x12'),_0x347f('0x13'),_0x347f('0x14')]}}});})['then'](function(_0x107185){if(!_0x107185||_0x107185&&_0x107185[_0x347f('0xa')]!==_0xcc6d0a){throw new Error(_0x347f('0x15'));}else{_0x5543e8=_0x107185;return _0x5543e8;}})[_0x347f('0x9')](function(){_0x5543e8[_0x347f('0x16')](_0x49dd8a,function(_0x2ca519,_0x10dc05){var _0x53f01a=_0x5543e8[_0x347f('0x11')]+0x1;if(_0x2ca519){return _0x3a5e9f(_0x2ca519);}else if(!_0x10dc05){if(_0x5543e8[_0x347f('0xe')]){return _0x3a5e9f(null,![],{'message':_0x347f('0x15')});}else if(_0x2d9433[_0x347f('0x8')]>0x0){if(_0x5543e8[_0x347f('0xf')]){if(_0x2d9433[_0x347f('0x17')]>0x0){if(moment(_0x5543e8[_0x347f('0x10')])[_0x347f('0x18')](_0x2d9433['blockDuration'],_0x347f('0x19'))>moment()){return _0x3a5e9f(null,![],{'message':_0x347f('0x15')});}else{return utils['clearBlockUser'](_0x5543e8,_0x53f01a,![],null)[_0x347f('0x9')](function(){return _0x3a5e9f(null,![],{'message':_0x347f('0x15')});});}}else{return _0x3a5e9f(null,![],{'message':_0x347f('0x15')});}}else{if(_0x53f01a>=_0x2d9433[_0x347f('0x8')]){return utils['clearBlockUser'](_0x5543e8,0x0,!![],moment())[_0x347f('0x9')](function(){return _0x3a5e9f(null,![],{'message':_0x347f('0x15')});});}else{return utils[_0x347f('0x1a')](_0x5543e8,_0x53f01a,![],null)['then'](function(){return _0x3a5e9f(null,![],{'message':_0x347f('0x15')});});}}}else{return _0x3a5e9f(null,![],{'message':_0x347f('0x15')});}}else{if(_0x5543e8['disabled']){return _0x3a5e9f(null,![],{'message':_0x347f('0x15')});}else if(_0x2d9433[_0x347f('0x8')]>0x0){if(_0x5543e8[_0x347f('0xf')]){if(_0x2d9433[_0x347f('0x17')]>0x0){if(moment(_0x5543e8[_0x347f('0x10')])[_0x347f('0x18')](_0x2d9433[_0x347f('0x17')],_0x347f('0x19'))>moment()){return _0x3a5e9f(null,![],{'message':_0x347f('0x15')});}else{return utils['clearBlockUser'](_0x5543e8,0x0,![],null)[_0x347f('0x9')](function(){return utils['getLicense'](_0x5543e8);})[_0x347f('0x9')](function(){return _0x3a5e9f(null,_0x5543e8);});}}else{return _0x3a5e9f(null,![],{'message':_0x347f('0x15')});}}else{return utils[_0x347f('0x1a')](_0x5543e8,0x0,![],null)[_0x347f('0x9')](function(){return utils[_0x347f('0x1b')](_0x5543e8);})['then'](function(){return _0x3a5e9f(null,_0x5543e8);})[_0x347f('0x1c')](function(_0x1e9d13){return _0x3a5e9f(null,![],_0x1e9d13);});}}else{if(_0x5543e8[_0x347f('0xf')]){return _0x3a5e9f(null,![],{'message':_0x347f('0x15')});}else{return utils['getLicense'](_0x5543e8)['then'](function(){return _0x3a5e9f(null,_0x5543e8);});}}}});})[_0x347f('0x1c')](function(_0x5ee1d4){return _0x3a5e9f(null,![],_0x5ee1d4);});}function sendServiceMail(_0x1ceb27){return db[_0x347f('0x1d')][_0x347f('0x1e')]({'where':{'service':!![]},'attributes':['id','name',_0x347f('0x1f')],'include':[{'model':db[_0x347f('0x20')],'as':_0x347f('0x21'),'include':[{'model':db['CloudProvider'],'as':_0x347f('0x22')}]}]})[_0x347f('0x9')](function(_0x58a0b0){if(!_0x58a0b0){throw new Error(_0x347f('0x23'));}var _0x497af8=_0x58a0b0[_0x347f('0x24')]();var _0x4dd1e4={'account':_0x497af8,'message':_['merge']({'from':util[_0x347f('0x25')](_0x347f('0x26'),_0x58a0b0[_0x347f('0xa')],_0x58a0b0[_0x347f('0x1f')]||_0x58a0b0['Smtp'][_0x347f('0x13')])},_0x1ceb27)};return client[_0x347f('0x27')](_0x347f('0x28'),_0x4dd1e4);})['then'](function(_0x50bc33){if(_0x50bc33['error']){throw new Error(util[_0x347f('0x25')](_0x347f('0x29'),_0x50bc33['error'][_0x347f('0x2a')]||JSON[_0x347f('0x2b')](_0x50bc33['error'])));}return!![];});}function handleError(_0x3525f5,_0x45c929,_0x4d81ee){return _0x3525f5[_0x347f('0x2c')](_0x45c929||0x1f4)[_0x347f('0x2d')]({'message':_0x4d81ee?_0x4d81ee[_0x347f('0x2a')]||_0x4d81ee:''});}exports[_0x347f('0x2e')]=function(_0x3a0954,_0x17a338,_0x103860){passport['authenticate'](_0x347f('0x2f'),function(_0x258af7,_0x4b71ab,_0x2b0ed2){var _0xa1cdcf=_0x258af7||_0x2b0ed2;if(_0xa1cdcf){return handleError(_0x17a338,0x191,_0xa1cdcf);}if(!_0x4b71ab){return handleError(_0x17a338,0x194,{'message':_0x347f('0x30')});}else{var _0x3daca0={'payload':{'id':_0x4b71ab['id'],'role':_0x4b71ab[_0x347f('0xd')]},'options':{'expiresIn':0x15180}};return authService[_0x347f('0x31')](_0x3daca0)[_0x347f('0x9')](function(_0xdd04af){_0x17a338[_0x347f('0x32')]({'id':_0x4b71ab['id'],'token':_0xdd04af,'statusCall':'','isAlreadyLogged':_0x4b71ab[_0x347f('0x33')]});});}})(_0x3a0954,_0x17a338,_0x103860);};exports[_0x347f('0x34')]=function(_0x7e9cfe,_0x393e1a){if(!_0x7e9cfe['body'][_0x347f('0x1f')]){return handleError(_0x393e1a,0x1f4,{'message':_0x347f('0x35')});}var _0x2d2f99=rs[_0x347f('0x36')]();_0x7e9cfe[_0x347f('0x37')][_0x347f('0x1f')]=_0x7e9cfe[_0x347f('0x37')][_0x347f('0x1f')][_0x347f('0x38')]()[_0x347f('0x39')]();var _0x46914b;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x347f('0x8'),_0x347f('0x17')],'raw':!![]})[_0x347f('0x9')](function(_0x1ddb25){_0x46914b=_0x1ddb25;return db[_0x347f('0x3a')]['find']({'where':{'email':_0x7e9cfe[_0x347f('0x37')][_0x347f('0x1f')]}});})[_0x347f('0x9')](function(_0x23ef4e){if(!_0x23ef4e){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x23ef4e['disabled']){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x23ef4e[_0x347f('0xf')]){if(moment(_0x23ef4e[_0x347f('0x10')])[_0x347f('0x18')](_0x46914b[_0x347f('0x17')],_0x347f('0x19'))>moment()){throw new Error(_0x347f('0x3b'));}else{_0x23ef4e[_0x347f('0xf')]=![];_0x23ef4e['blockedAt']=null;}}_0x23ef4e['resetPasswordToken']=_0x2d2f99;_0x23ef4e['resetPasswordExpires']=Date[_0x347f('0x3c')]()+0x36ee80;return _0x23ef4e[_0x347f('0x3d')]();})[_0x347f('0x9')](function(){return sendServiceMail({'to':_0x7e9cfe[_0x347f('0x37')][_0x347f('0x1f')],'subject':_0x347f('0x3e'),'text':_0x347f('0x3f')+_0x347f('0x40')+_0x347f('0x41')+_0x7e9cfe['headers'][_0x347f('0x42')]+'/reset/'+_0x2d2f99+'\x0a\x0a'+_0x347f('0x43')});})[_0x347f('0x9')](function(){_0x393e1a[_0x347f('0x2c')](0xc8)[_0x347f('0x2d')]({'message':_0x347f('0x44')});})[_0x347f('0x1c')](function(_0x3c5109){return handleError(_0x393e1a,0x1f4,_0x3c5109);});};exports['reset']=function(_0x96410f,_0x5dd4f5){return db[_0x347f('0x3a')]['find']({'where':{'resetPasswordToken':_0x96410f['params'][_0x347f('0x45')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x347f('0x9')](function(_0x5b55e2){if(!_0x5b55e2){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x347f('0x6')][_0x347f('0x7')]({'attributes':['id',_0x347f('0x46'),'enforcePasswordHistory',_0x347f('0x47')]})['then'](function(_0x18fe9a){if(_0x18fe9a[_0x347f('0x46')])authService[_0x347f('0x48')](_0x96410f[_0x347f('0x37')][_0x347f('0xb')]);if(!_0x18fe9a[_0x347f('0x49')]||!_0x5b55e2[_0x347f('0x4a')])return _0x5b55e2;authService[_0x347f('0x4b')](_0x96410f[_0x347f('0x37')][_0x347f('0xb')],_0x5b55e2['previousPasswords'],_0x18fe9a[_0x347f('0x47')]);return _0x5b55e2;})[_0x347f('0x9')](function(){_0x5b55e2['password']=_0x96410f['body'][_0x347f('0xb')];_0x5b55e2[_0x347f('0x4c')]=null;_0x5b55e2[_0x347f('0x4d')]=null;return _0x5b55e2[_0x347f('0x3d')]();});})['then'](function(){_0x5dd4f5[_0x347f('0x2c')](0xc8)[_0x347f('0x2d')]({'message':'Password\x20reset!'});})[_0x347f('0x1c')](function(_0x56d0d3){return handleError(_0x5dd4f5,0x1f4,_0x56d0d3);});};passport[_0x347f('0x4e')](_0x347f('0x2f'),new LocalStrategy({'usernameField':_0x347f('0xa'),'passwordField':'password'},function(_0x1021c0,_0x3b3794,_0x40765f){return localAuthenticate(db[_0x347f('0x3a')],_0x1021c0,_0x3b3794,_0x40765f);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 2ff13b6..2e466cb 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 _0x6ebf=['./authLocal.controller','post','login','/forgot','/reset/:token','reset','exports','Router'];(function(_0x259e1b,_0x75e844){var _0x2bb2e3=function(_0x369ce7){while(--_0x369ce7){_0x259e1b['push'](_0x259e1b['shift']());}};_0x2bb2e3(++_0x75e844);}(_0x6ebf,0x10f));var _0xf6eb=function(_0x5b6cf1,_0x32fdcd){_0x5b6cf1=_0x5b6cf1-0x0;var _0x46278c=_0x6ebf[_0x5b6cf1];return _0x46278c;};'use strict';var express=require('express');var router=express[_0xf6eb('0x0')]();var controller=require(_0xf6eb('0x1'));router[_0xf6eb('0x2')]('/',controller[_0xf6eb('0x3')]);router['post'](_0xf6eb('0x4'),controller['forgot']);router['post'](_0xf6eb('0x5'),controller[_0xf6eb('0x6')]);module[_0xf6eb('0x7')]=router; \ No newline at end of file +var _0x7999=['login','/forgot','forgot','/reset/:token','reset','exports','express','Router','./authLocal.controller','post'];(function(_0x47c9fc,_0x476d34){var _0x5909dc=function(_0x207b6b){while(--_0x207b6b){_0x47c9fc['push'](_0x47c9fc['shift']());}};_0x5909dc(++_0x476d34);}(_0x7999,0x1e6));var _0x9799=function(_0x35036f,_0x5dc350){_0x35036f=_0x35036f-0x0;var _0x1d4fb1=_0x7999[_0x35036f];return _0x1d4fb1;};'use strict';var express=require(_0x9799('0x0'));var router=express[_0x9799('0x1')]();var controller=require(_0x9799('0x2'));router[_0x9799('0x3')]('/',controller[_0x9799('0x4')]);router[_0x9799('0x3')](_0x9799('0x5'),controller[_0x9799('0x6')]);router['post'](_0x9799('0x7'),controller[_0x9799('0x8')]);module[_0x9799('0x9')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 2dda5b5..950d90c 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 _0x7b40=['exports','STRING','BOOLEAN','INTEGER'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7b40,0x118));var _0x07b4=function(_0x58f606,_0x442520){_0x58f606=_0x58f606-0x0;var _0x3b2bc7=_0x7b40[_0x58f606];return _0x3b2bc7;};'use strict';var Sequelize=require('sequelize');module[_0x07b4('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x07b4('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x07b4('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x07b4('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x22be=['INTEGER','sequelize','exports','STRING','BOOLEAN'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x22be,0x1b4));var _0xe22b=function(_0x301c34,_0x15701e){_0x301c34=_0x301c34-0x0;var _0x1a8c5a=_0x22be[_0x301c34];return _0x1a8c5a;};'use strict';var Sequelize=require(_0xe22b('0x0'));module[_0xe22b('0x1')]={'name':{'type':Sequelize[_0xe22b('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xe22b('0x2')]},'description':{'type':Sequelize[_0xe22b('0x2')]},'status':{'type':Sequelize[_0xe22b('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xe22b('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index c8c1642..41f3d64 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 _0xedce=['undefined','limit','count','apply','reject','save','update','destroy','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','Automation','includeAll','include','findAll','rows','catch','show','params','find','create','body','addConditions','ids','omit','getConditions','findOne','Condition','addActions','Action','getActions','pick','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xedce,0x8a));var _0xeedc=function(_0x124096,_0xbb4341){_0x124096=_0x124096-0x0;var _0x123aed=_0xedce[_0x124096];return _0x123aed;};'use strict';var emlformat=require(_0xeedc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xeedc('0x1'));var jsonpatch=require(_0xeedc('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xeedc('0x3'));var Mustache=require(_0xeedc('0x4'));var util=require(_0xeedc('0x5'));var path=require('path');var sox=require(_0xeedc('0x6'));var csv=require(_0xeedc('0x7'));var ejs=require(_0xeedc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeedc('0x9'));var squel=require('squel');var crypto=require(_0xeedc('0xa'));var jsforce=require(_0xeedc('0xb'));var deskjs=require(_0xeedc('0xc'));var toCsv=require(_0xeedc('0x7'));var querystring=require(_0xeedc('0xd'));var Papa=require(_0xeedc('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xeedc('0xf'));var as=require(_0xeedc('0x10'));var hardwareService=require(_0xeedc('0x11'));var logger=require(_0xeedc('0x12'))(_0xeedc('0x13'));var utils=require(_0xeedc('0x14'));var config=require(_0xeedc('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xeedc('0x16'))['db'];function respondWithStatusCode(_0x3c73bb,_0x499290){_0x499290=_0x499290||0xcc;return function(_0x5acaea){if(_0x5acaea){return _0x3c73bb[_0xeedc('0x17')](_0x499290);}return _0x3c73bb[_0xeedc('0x18')](_0x499290)[_0xeedc('0x19')]();};}function respondWithResult(_0x143ca2,_0x2c4f10){_0x2c4f10=_0x2c4f10||0xc8;return function(_0x595984){if(_0x595984){return _0x143ca2[_0xeedc('0x18')](_0x2c4f10)[_0xeedc('0x1a')](_0x595984);}};}function respondWithFilteredResult(_0x37c3da,_0x4e9fcc){return function(_0x2396d5){if(_0x2396d5){var _0x56bda3=typeof _0x4e9fcc[_0xeedc('0x1b')]===_0xeedc('0x1c')&&typeof _0x4e9fcc[_0xeedc('0x1d')]===_0xeedc('0x1c');var _0x4fa0b8=_0x2396d5['count'];var _0x24dab9=_0x56bda3?0x0:_0x4e9fcc[_0xeedc('0x1b')];var _0x471733=_0x56bda3?_0x2396d5[_0xeedc('0x1e')]:_0x4e9fcc['offset']+_0x4e9fcc[_0xeedc('0x1d')];var _0x975cd;if(_0x471733>=_0x4fa0b8){_0x471733=_0x4fa0b8;_0x975cd=0xc8;}else{_0x975cd=0xce;}_0x37c3da[_0xeedc('0x18')](_0x975cd);return _0x37c3da['set']('Content-Range',_0x24dab9+'-'+_0x471733+'/'+_0x4fa0b8)[_0xeedc('0x1a')](_0x2396d5);}return null;};}function patchUpdates(_0x455343){return function(_0x4af127){try{jsonpatch[_0xeedc('0x1f')](_0x4af127,_0x455343,!![]);}catch(_0x5ccbd9){return BPromise[_0xeedc('0x20')](_0x5ccbd9);}return _0x4af127[_0xeedc('0x21')]();};}function saveUpdates(_0x418f4b,_0xd2571d){return function(_0x304ac8){if(_0x304ac8){return _0x304ac8[_0xeedc('0x22')](_0x418f4b)['then'](function(_0x58af43){return _0x58af43;});}return null;};}function removeEntity(_0x4e442d,_0x8d767b){return function(_0x3025f5){if(_0x3025f5){return _0x3025f5[_0xeedc('0x23')]()[_0xeedc('0x24')](function(){_0x4e442d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xebb551,_0x17094a){return function(_0x2c90c7){if(!_0x2c90c7){_0xebb551['sendStatus'](0x194);}return _0x2c90c7;};}function handleError(_0x4e495c,_0x1affed){_0x1affed=_0x1affed||0x1f4;return function(_0x4a58dc){logger[_0xeedc('0x25')](_0x4a58dc['stack']);if(_0x4a58dc[_0xeedc('0x26')]){delete _0x4a58dc[_0xeedc('0x26')];}_0x4e495c[_0xeedc('0x18')](_0x1affed)[_0xeedc('0x27')](_0x4a58dc);};}exports[_0xeedc('0x28')]=function(_0x24f955,_0x48289e){var _0x2d551e={},_0x53d4a6={},_0xf27dbc={'count':0x0,'rows':[]};var _0x4ea8d4=_[_0xeedc('0x29')](db['Automation'][_0xeedc('0x2a')],function(_0x95250d){return{'name':_0x95250d[_0xeedc('0x2b')],'type':_0x95250d[_0xeedc('0x2c')][_0xeedc('0x2d')]};});_0x53d4a6[_0xeedc('0x2e')]=_['map'](_0x4ea8d4,_0xeedc('0x26'));_0x53d4a6[_0xeedc('0x2f')]=_[_0xeedc('0x30')](_0x24f955[_0xeedc('0x2f')]);_0x53d4a6[_0xeedc('0x31')]=_[_0xeedc('0x32')](_0x53d4a6['model'],_0x53d4a6[_0xeedc('0x2f')]);_0x2d551e[_0xeedc('0x33')]=_[_0xeedc('0x32')](_0x53d4a6[_0xeedc('0x2e')],qs['fields'](_0x24f955[_0xeedc('0x2f')][_0xeedc('0x34')]));_0x2d551e[_0xeedc('0x33')]=_0x2d551e[_0xeedc('0x33')][_0xeedc('0x35')]?_0x2d551e[_0xeedc('0x33')]:_0x53d4a6['model'];if(!_0x24f955[_0xeedc('0x2f')][_0xeedc('0x36')](_0xeedc('0x37'))){_0x2d551e['limit']=qs[_0xeedc('0x1d')](_0x24f955[_0xeedc('0x2f')][_0xeedc('0x1d')]);_0x2d551e['offset']=qs[_0xeedc('0x1b')](_0x24f955[_0xeedc('0x2f')]['offset']);}_0x2d551e[_0xeedc('0x38')]=qs['sort'](_0x24f955['query'][_0xeedc('0x39')]);_0x2d551e[_0xeedc('0x3a')]=qs[_0xeedc('0x31')](_['pick'](_0x24f955[_0xeedc('0x2f')],_0x53d4a6[_0xeedc('0x31')]),_0x4ea8d4);if(_0x24f955[_0xeedc('0x2f')]['filter']){_0x2d551e[_0xeedc('0x3a')]=_['merge'](_0x2d551e[_0xeedc('0x3a')],{'$or':_['map'](_0x4ea8d4,function(_0x235d1d){if(_0x235d1d[_0xeedc('0x2c')]!=='VIRTUAL'){var _0x4a7201={};_0x4a7201[_0x235d1d['name']]={'$like':'%'+_0x24f955[_0xeedc('0x2f')][_0xeedc('0x3b')]+'%'};return _0x4a7201;}})});}_0x2d551e=_[_0xeedc('0x3c')]({},_0x2d551e,_0x24f955[_0xeedc('0x3d')]);var _0x5f5c65={'where':_0x2d551e[_0xeedc('0x3a')]};return db[_0xeedc('0x3e')][_0xeedc('0x1e')](_0x5f5c65)[_0xeedc('0x24')](function(_0x55c52d){_0xf27dbc['count']=_0x55c52d;if(_0x24f955[_0xeedc('0x2f')][_0xeedc('0x3f')]){_0x2d551e[_0xeedc('0x40')]=[{'all':!![]}];}return db['Automation'][_0xeedc('0x41')](_0x2d551e);})[_0xeedc('0x24')](function(_0xa85cad){_0xf27dbc[_0xeedc('0x42')]=_0xa85cad;return _0xf27dbc;})[_0xeedc('0x24')](respondWithFilteredResult(_0x48289e,_0x2d551e))[_0xeedc('0x43')](handleError(_0x48289e,null));};exports[_0xeedc('0x44')]=function(_0x58ee4d,_0x2127cd){var _0x3567ed={'raw':![],'where':{'id':_0x58ee4d[_0xeedc('0x45')]['id']}},_0x29ff51={};_0x29ff51[_0xeedc('0x2e')]=_[_0xeedc('0x30')](db[_0xeedc('0x3e')][_0xeedc('0x2a')]);_0x29ff51[_0xeedc('0x2f')]=_[_0xeedc('0x30')](_0x58ee4d['query']);_0x29ff51[_0xeedc('0x31')]=_[_0xeedc('0x32')](_0x29ff51[_0xeedc('0x2e')],_0x29ff51[_0xeedc('0x2f')]);_0x3567ed[_0xeedc('0x33')]=_[_0xeedc('0x32')](_0x29ff51[_0xeedc('0x2e')],qs[_0xeedc('0x34')](_0x58ee4d[_0xeedc('0x2f')][_0xeedc('0x34')]));_0x3567ed[_0xeedc('0x33')]=_0x3567ed['attributes'][_0xeedc('0x35')]?_0x3567ed[_0xeedc('0x33')]:_0x29ff51[_0xeedc('0x2e')];if(_0x58ee4d['query'][_0xeedc('0x3f')]){_0x3567ed[_0xeedc('0x40')]=[{'all':!![]}];}_0x3567ed=_[_0xeedc('0x3c')]({},_0x3567ed,_0x58ee4d[_0xeedc('0x3d')]);return db[_0xeedc('0x3e')][_0xeedc('0x46')](_0x3567ed)[_0xeedc('0x24')](handleEntityNotFound(_0x2127cd,null))[_0xeedc('0x24')](respondWithResult(_0x2127cd,null))[_0xeedc('0x43')](handleError(_0x2127cd,null));};exports[_0xeedc('0x47')]=function(_0x4dfdb1,_0x29fde2){return db[_0xeedc('0x3e')][_0xeedc('0x47')](_0x4dfdb1[_0xeedc('0x48')],{})['then'](respondWithResult(_0x29fde2,0xc9))['catch'](handleError(_0x29fde2,null));};exports[_0xeedc('0x22')]=function(_0x3fbe36,_0x1fd90f){if(_0x3fbe36['body']['id']){delete _0x3fbe36[_0xeedc('0x48')]['id'];}return db['Automation'][_0xeedc('0x46')]({'where':{'id':_0x3fbe36[_0xeedc('0x45')]['id']}})['then'](handleEntityNotFound(_0x1fd90f,null))[_0xeedc('0x24')](saveUpdates(_0x3fbe36[_0xeedc('0x48')],null))[_0xeedc('0x24')](respondWithResult(_0x1fd90f,null))[_0xeedc('0x43')](handleError(_0x1fd90f,null));};exports[_0xeedc('0x23')]=function(_0x18a341,_0x369ffc){return db[_0xeedc('0x3e')][_0xeedc('0x46')]({'where':{'id':_0x18a341[_0xeedc('0x45')]['id']}})[_0xeedc('0x24')](handleEntityNotFound(_0x369ffc,null))[_0xeedc('0x24')](removeEntity(_0x369ffc,null))[_0xeedc('0x43')](handleError(_0x369ffc,null));};exports[_0xeedc('0x49')]=function(_0xa6c205,_0xf80708,_0x5d224f){return db['Condition'][_0xeedc('0x46')]({'where':{'id':_0xa6c205[_0xeedc('0x45')]['id']}})[_0xeedc('0x24')](handleEntityNotFound(_0xf80708,null))[_0xeedc('0x24')](function(_0x233a99){if(_0x233a99){return _0x233a99[_0xeedc('0x49')](_0xa6c205[_0xeedc('0x48')][_0xeedc('0x4a')],_[_0xeedc('0x4b')](_0xa6c205[_0xeedc('0x48')],[_0xeedc('0x4a'),'id'])||{});}})['then'](respondWithResult(_0xf80708,null))[_0xeedc('0x43')](handleError(_0xf80708,null));};exports[_0xeedc('0x4c')]=function(_0x4ae1ad,_0x2cd8ad,_0x4cd3a0){var _0x1d435d={};var _0x14eeff={};var _0x553e76;var _0x1e2434;return db['Automation'][_0xeedc('0x4d')]({'where':{'id':_0x4ae1ad[_0xeedc('0x45')]['id']}})[_0xeedc('0x24')](handleEntityNotFound(_0x2cd8ad,null))[_0xeedc('0x24')](function(_0x4fe31f){if(_0x4fe31f){_0x553e76=_0x4fe31f;_0x14eeff['model']=_[_0xeedc('0x30')](db[_0xeedc('0x4e')][_0xeedc('0x2a')]);_0x14eeff[_0xeedc('0x2f')]=_[_0xeedc('0x30')](_0x4ae1ad['query']);_0x14eeff[_0xeedc('0x31')]=_[_0xeedc('0x32')](_0x14eeff[_0xeedc('0x2e')],_0x14eeff[_0xeedc('0x2f')]);_0x1d435d[_0xeedc('0x33')]=_[_0xeedc('0x32')](_0x14eeff[_0xeedc('0x2e')],qs[_0xeedc('0x34')](_0x4ae1ad[_0xeedc('0x2f')]['fields']));_0x1d435d[_0xeedc('0x33')]=_0x1d435d[_0xeedc('0x33')][_0xeedc('0x35')]?_0x1d435d[_0xeedc('0x33')]:_0x14eeff[_0xeedc('0x2e')];_0x1d435d[_0xeedc('0x38')]=qs['sort'](_0x4ae1ad['query'][_0xeedc('0x39')]);_0x1d435d['where']=qs[_0xeedc('0x31')](_['pick'](_0x4ae1ad[_0xeedc('0x2f')],_0x14eeff[_0xeedc('0x31')]));if(_0x4ae1ad['query'][_0xeedc('0x3b')]){_0x1d435d['where']=_[_0xeedc('0x3c')](_0x1d435d['where'],{'$or':_[_0xeedc('0x29')](_0x1d435d[_0xeedc('0x33')],function(_0x381622){var _0x13bbb4={};_0x13bbb4[_0x381622]={'$like':'%'+_0x4ae1ad[_0xeedc('0x2f')][_0xeedc('0x3b')]+'%'};return _0x13bbb4;})});}_0x1d435d=_['merge']({},_0x1d435d,_0x4ae1ad['options']);return _0x553e76['getConditions'](_0x1d435d);}})[_0xeedc('0x24')](function(_0x1136b2){if(_0x1136b2){_0x1e2434=_0x1136b2['length'];if(!_0x4ae1ad[_0xeedc('0x2f')][_0xeedc('0x36')]('nolimit')){_0x1d435d['limit']=qs[_0xeedc('0x1d')](_0x4ae1ad[_0xeedc('0x2f')]['limit']);_0x1d435d[_0xeedc('0x1b')]=qs[_0xeedc('0x1b')](_0x4ae1ad['query']['offset']);}return _0x553e76[_0xeedc('0x4c')](_0x1d435d);}})['then'](function(_0x214d43){if(_0x214d43){return _0x214d43?{'count':_0x1e2434,'rows':_0x214d43}:null;}})['then'](respondWithResult(_0x2cd8ad,null))[_0xeedc('0x43')](handleError(_0x2cd8ad,null));};exports[_0xeedc('0x4f')]=function(_0x559dba,_0xd6f4a7,_0x8d0029){return db[_0xeedc('0x50')][_0xeedc('0x46')]({'where':{'id':_0x559dba[_0xeedc('0x45')]['id']}})[_0xeedc('0x24')](handleEntityNotFound(_0xd6f4a7,null))['then'](function(_0x3efaa8){if(_0x3efaa8){return _0x3efaa8['addActions'](_0x559dba[_0xeedc('0x48')][_0xeedc('0x4a')],_[_0xeedc('0x4b')](_0x559dba['body'],[_0xeedc('0x4a'),'id'])||{});}})['then'](respondWithResult(_0xd6f4a7,null))[_0xeedc('0x43')](handleError(_0xd6f4a7,null));};exports[_0xeedc('0x51')]=function(_0x303877,_0x34289d,_0x5b6a8a){var _0x2e597f={};var _0x42e157={};var _0x1493ae;var _0x16826d;return db['Automation'][_0xeedc('0x4d')]({'where':{'id':_0x303877[_0xeedc('0x45')]['id']}})[_0xeedc('0x24')](handleEntityNotFound(_0x34289d,null))[_0xeedc('0x24')](function(_0x1eff55){if(_0x1eff55){_0x1493ae=_0x1eff55;_0x42e157[_0xeedc('0x2e')]=_[_0xeedc('0x30')](db['Action'][_0xeedc('0x2a')]);_0x42e157[_0xeedc('0x2f')]=_[_0xeedc('0x30')](_0x303877[_0xeedc('0x2f')]);_0x42e157[_0xeedc('0x31')]=_[_0xeedc('0x32')](_0x42e157['model'],_0x42e157['query']);_0x2e597f[_0xeedc('0x33')]=_[_0xeedc('0x32')](_0x42e157[_0xeedc('0x2e')],qs[_0xeedc('0x34')](_0x303877['query'][_0xeedc('0x34')]));_0x2e597f[_0xeedc('0x33')]=_0x2e597f[_0xeedc('0x33')][_0xeedc('0x35')]?_0x2e597f[_0xeedc('0x33')]:_0x42e157['model'];_0x2e597f['order']=qs[_0xeedc('0x39')](_0x303877[_0xeedc('0x2f')][_0xeedc('0x39')]);_0x2e597f['where']=qs['filters'](_[_0xeedc('0x52')](_0x303877['query'],_0x42e157['filters']));if(_0x303877[_0xeedc('0x2f')][_0xeedc('0x3b')]){_0x2e597f[_0xeedc('0x3a')]=_[_0xeedc('0x3c')](_0x2e597f[_0xeedc('0x3a')],{'$or':_[_0xeedc('0x29')](_0x2e597f[_0xeedc('0x33')],function(_0x49a339){var _0xf473a5={};_0xf473a5[_0x49a339]={'$like':'%'+_0x303877['query'][_0xeedc('0x3b')]+'%'};return _0xf473a5;})});}_0x2e597f=_[_0xeedc('0x3c')]({},_0x2e597f,_0x303877[_0xeedc('0x3d')]);return _0x1493ae[_0xeedc('0x51')](_0x2e597f);}})[_0xeedc('0x24')](function(_0x2d2faa){if(_0x2d2faa){_0x16826d=_0x2d2faa['length'];if(!_0x303877[_0xeedc('0x2f')][_0xeedc('0x36')](_0xeedc('0x37'))){_0x2e597f['limit']=qs[_0xeedc('0x1d')](_0x303877[_0xeedc('0x2f')][_0xeedc('0x1d')]);_0x2e597f[_0xeedc('0x1b')]=qs[_0xeedc('0x1b')](_0x303877[_0xeedc('0x2f')][_0xeedc('0x1b')]);}return _0x1493ae[_0xeedc('0x51')](_0x2e597f);}})[_0xeedc('0x24')](function(_0x1afbf8){if(_0x1afbf8){return _0x1afbf8?{'count':_0x16826d,'rows':_0x1afbf8}:null;}})[_0xeedc('0x24')](respondWithResult(_0x34289d,null))[_0xeedc('0x43')](handleError(_0x34289d,null));}; \ No newline at end of file +var _0x87d1=['mustache','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','sendStatus','stack','name','index','map','Automation','rawAttributes','fieldName','type','key','model','filters','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','include','findAll','rows','catch','show','params','keys','find','body','addConditions','Condition','ids','nolimit','addActions','omit','findOne','Action','getActions','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x3d5037,_0x50df6a){var _0x1ff849=function(_0x398fea){while(--_0x398fea){_0x3d5037['push'](_0x3d5037['shift']());}};_0x1ff849(++_0x50df6a);}(_0x87d1,0x95));var _0x187d=function(_0x14f773,_0x4c09c7){_0x14f773=_0x14f773-0x0;var _0x2a8be9=_0x87d1[_0x14f773];return _0x2a8be9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x187d('0x0'));var jsonpatch=require(_0x187d('0x1'));var rp=require(_0x187d('0x2'));var moment=require(_0x187d('0x3'));var BPromise=require(_0x187d('0x4'));var Mustache=require(_0x187d('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(_0x187d('0x6'));var _=require(_0x187d('0x7'));var squel=require(_0x187d('0x8'));var crypto=require('crypto');var jsforce=require(_0x187d('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x187d('0xa'));var Redis=require(_0x187d('0xb'));var authService=require(_0x187d('0xc'));var qs=require(_0x187d('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x187d('0xe'));var logger=require(_0x187d('0xf'))(_0x187d('0x10'));var utils=require(_0x187d('0x11'));var config=require(_0x187d('0x12'));var licenseUtil=require(_0x187d('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a28e6,_0x5265d9){_0x5265d9=_0x5265d9||0xcc;return function(_0x451825){if(_0x451825){return _0x2a28e6['sendStatus'](_0x5265d9);}return _0x2a28e6[_0x187d('0x14')](_0x5265d9)[_0x187d('0x15')]();};}function respondWithResult(_0x115039,_0xa1cfd8){_0xa1cfd8=_0xa1cfd8||0xc8;return function(_0x15d667){if(_0x15d667){return _0x115039[_0x187d('0x14')](_0xa1cfd8)['json'](_0x15d667);}};}function respondWithFilteredResult(_0x430124,_0x42e709){return function(_0x1c93d2){if(_0x1c93d2){var _0x55bbb9=typeof _0x42e709[_0x187d('0x16')]===_0x187d('0x17')&&typeof _0x42e709[_0x187d('0x18')]===_0x187d('0x17');var _0x4c8ba5=_0x1c93d2['count'];var _0x51f0f9=_0x55bbb9?0x0:_0x42e709['offset'];var _0x1325f7=_0x55bbb9?_0x1c93d2[_0x187d('0x19')]:_0x42e709[_0x187d('0x16')]+_0x42e709[_0x187d('0x18')];var _0x352ebd;if(_0x1325f7>=_0x4c8ba5){_0x1325f7=_0x4c8ba5;_0x352ebd=0xc8;}else{_0x352ebd=0xce;}_0x430124[_0x187d('0x14')](_0x352ebd);return _0x430124[_0x187d('0x1a')](_0x187d('0x1b'),_0x51f0f9+'-'+_0x1325f7+'/'+_0x4c8ba5)[_0x187d('0x1c')](_0x1c93d2);}return null;};}function patchUpdates(_0x1fd077){return function(_0x105fec){try{jsonpatch[_0x187d('0x1d')](_0x105fec,_0x1fd077,!![]);}catch(_0x1b1856){return BPromise['reject'](_0x1b1856);}return _0x105fec[_0x187d('0x1e')]();};}function saveUpdates(_0x1a7529,_0x22b6d0){return function(_0x5073dc){if(_0x5073dc){return _0x5073dc[_0x187d('0x1f')](_0x1a7529)[_0x187d('0x20')](function(_0x2d8d1b){return _0x2d8d1b;});}return null;};}function removeEntity(_0x456856,_0x4f3978){return function(_0x5b0a1b){if(_0x5b0a1b){return _0x5b0a1b[_0x187d('0x21')]()['then'](function(){_0x456856[_0x187d('0x14')](0xcc)[_0x187d('0x15')]();});}};}function handleEntityNotFound(_0x6ef3b5,_0x57474e){return function(_0x5ab687){if(!_0x5ab687){_0x6ef3b5[_0x187d('0x22')](0x194);}return _0x5ab687;};}function handleError(_0x1bf39c,_0x921862){_0x921862=_0x921862||0x1f4;return function(_0x1e0efb){logger['error'](_0x1e0efb[_0x187d('0x23')]);if(_0x1e0efb[_0x187d('0x24')]){delete _0x1e0efb[_0x187d('0x24')];}_0x1bf39c[_0x187d('0x14')](_0x921862)['send'](_0x1e0efb);};}exports[_0x187d('0x25')]=function(_0x35fdaa,_0x4771fc){var _0x1de97b={},_0x454fe7={},_0x8cb797={'count':0x0,'rows':[]};var _0x53784d=_[_0x187d('0x26')](db[_0x187d('0x27')][_0x187d('0x28')],function(_0x51575e){return{'name':_0x51575e[_0x187d('0x29')],'type':_0x51575e[_0x187d('0x2a')][_0x187d('0x2b')]};});_0x454fe7[_0x187d('0x2c')]=_[_0x187d('0x26')](_0x53784d,'name');_0x454fe7['query']=_['keys'](_0x35fdaa['query']);_0x454fe7[_0x187d('0x2d')]=_['intersection'](_0x454fe7[_0x187d('0x2c')],_0x454fe7[_0x187d('0x2e')]);_0x1de97b[_0x187d('0x2f')]=_[_0x187d('0x30')](_0x454fe7[_0x187d('0x2c')],qs[_0x187d('0x31')](_0x35fdaa['query'][_0x187d('0x31')]));_0x1de97b[_0x187d('0x2f')]=_0x1de97b[_0x187d('0x2f')][_0x187d('0x32')]?_0x1de97b[_0x187d('0x2f')]:_0x454fe7[_0x187d('0x2c')];if(!_0x35fdaa[_0x187d('0x2e')][_0x187d('0x33')]('nolimit')){_0x1de97b[_0x187d('0x18')]=qs[_0x187d('0x18')](_0x35fdaa[_0x187d('0x2e')][_0x187d('0x18')]);_0x1de97b[_0x187d('0x16')]=qs[_0x187d('0x16')](_0x35fdaa[_0x187d('0x2e')][_0x187d('0x16')]);}_0x1de97b[_0x187d('0x34')]=qs['sort'](_0x35fdaa[_0x187d('0x2e')][_0x187d('0x35')]);_0x1de97b[_0x187d('0x36')]=qs[_0x187d('0x2d')](_[_0x187d('0x37')](_0x35fdaa[_0x187d('0x2e')],_0x454fe7['filters']),_0x53784d);if(_0x35fdaa[_0x187d('0x2e')]['filter']){_0x1de97b[_0x187d('0x36')]=_[_0x187d('0x38')](_0x1de97b[_0x187d('0x36')],{'$or':_[_0x187d('0x26')](_0x53784d,function(_0x5cefde){if(_0x5cefde[_0x187d('0x2a')]!=='VIRTUAL'){var _0x4deccf={};_0x4deccf[_0x5cefde[_0x187d('0x24')]]={'$like':'%'+_0x35fdaa[_0x187d('0x2e')][_0x187d('0x39')]+'%'};return _0x4deccf;}})});}_0x1de97b=_['merge']({},_0x1de97b,_0x35fdaa[_0x187d('0x3a')]);var _0x58f2eb={'where':_0x1de97b[_0x187d('0x36')]};return db[_0x187d('0x27')][_0x187d('0x19')](_0x58f2eb)['then'](function(_0x5c4453){_0x8cb797[_0x187d('0x19')]=_0x5c4453;if(_0x35fdaa['query']['includeAll']){_0x1de97b[_0x187d('0x3b')]=[{'all':!![]}];}return db[_0x187d('0x27')][_0x187d('0x3c')](_0x1de97b);})[_0x187d('0x20')](function(_0x4c0712){_0x8cb797[_0x187d('0x3d')]=_0x4c0712;return _0x8cb797;})[_0x187d('0x20')](respondWithFilteredResult(_0x4771fc,_0x1de97b))[_0x187d('0x3e')](handleError(_0x4771fc,null));};exports[_0x187d('0x3f')]=function(_0x274e33,_0x39faae){var _0x4df1c2={'raw':![],'where':{'id':_0x274e33[_0x187d('0x40')]['id']}},_0x47dad9={};_0x47dad9[_0x187d('0x2c')]=_[_0x187d('0x41')](db[_0x187d('0x27')][_0x187d('0x28')]);_0x47dad9[_0x187d('0x2e')]=_[_0x187d('0x41')](_0x274e33[_0x187d('0x2e')]);_0x47dad9[_0x187d('0x2d')]=_['intersection'](_0x47dad9[_0x187d('0x2c')],_0x47dad9[_0x187d('0x2e')]);_0x4df1c2[_0x187d('0x2f')]=_[_0x187d('0x30')](_0x47dad9[_0x187d('0x2c')],qs[_0x187d('0x31')](_0x274e33['query']['fields']));_0x4df1c2[_0x187d('0x2f')]=_0x4df1c2['attributes'][_0x187d('0x32')]?_0x4df1c2[_0x187d('0x2f')]:_0x47dad9[_0x187d('0x2c')];if(_0x274e33[_0x187d('0x2e')]['includeAll']){_0x4df1c2[_0x187d('0x3b')]=[{'all':!![]}];}_0x4df1c2=_[_0x187d('0x38')]({},_0x4df1c2,_0x274e33['options']);return db[_0x187d('0x27')][_0x187d('0x42')](_0x4df1c2)['then'](handleEntityNotFound(_0x39faae,null))[_0x187d('0x20')](respondWithResult(_0x39faae,null))['catch'](handleError(_0x39faae,null));};exports['create']=function(_0x4934d3,_0x2f897b){return db[_0x187d('0x27')]['create'](_0x4934d3['body'],{})[_0x187d('0x20')](respondWithResult(_0x2f897b,0xc9))[_0x187d('0x3e')](handleError(_0x2f897b,null));};exports['update']=function(_0x541317,_0x46225a){if(_0x541317['body']['id']){delete _0x541317[_0x187d('0x43')]['id'];}return db[_0x187d('0x27')][_0x187d('0x42')]({'where':{'id':_0x541317[_0x187d('0x40')]['id']}})[_0x187d('0x20')](handleEntityNotFound(_0x46225a,null))[_0x187d('0x20')](saveUpdates(_0x541317[_0x187d('0x43')],null))[_0x187d('0x20')](respondWithResult(_0x46225a,null))[_0x187d('0x3e')](handleError(_0x46225a,null));};exports[_0x187d('0x21')]=function(_0x3a64d8,_0x7f3680){return db[_0x187d('0x27')]['find']({'where':{'id':_0x3a64d8[_0x187d('0x40')]['id']}})['then'](handleEntityNotFound(_0x7f3680,null))['then'](removeEntity(_0x7f3680,null))[_0x187d('0x3e')](handleError(_0x7f3680,null));};exports[_0x187d('0x44')]=function(_0x50f517,_0x587f2d,_0x14aec4){return db[_0x187d('0x45')][_0x187d('0x42')]({'where':{'id':_0x50f517[_0x187d('0x40')]['id']}})['then'](handleEntityNotFound(_0x587f2d,null))['then'](function(_0xbb491a){if(_0xbb491a){return _0xbb491a[_0x187d('0x44')](_0x50f517[_0x187d('0x43')][_0x187d('0x46')],_['omit'](_0x50f517['body'],[_0x187d('0x46'),'id'])||{});}})[_0x187d('0x20')](respondWithResult(_0x587f2d,null))[_0x187d('0x3e')](handleError(_0x587f2d,null));};exports['getConditions']=function(_0x5f18bf,_0x45a4e1,_0x424f71){var _0x59e12a={};var _0x71330d={};var _0x214857;var _0x32ea5d;return db['Automation']['findOne']({'where':{'id':_0x5f18bf[_0x187d('0x40')]['id']}})['then'](handleEntityNotFound(_0x45a4e1,null))['then'](function(_0x3e9262){if(_0x3e9262){_0x214857=_0x3e9262;_0x71330d[_0x187d('0x2c')]=_[_0x187d('0x41')](db[_0x187d('0x45')]['rawAttributes']);_0x71330d['query']=_[_0x187d('0x41')](_0x5f18bf[_0x187d('0x2e')]);_0x71330d[_0x187d('0x2d')]=_[_0x187d('0x30')](_0x71330d[_0x187d('0x2c')],_0x71330d['query']);_0x59e12a[_0x187d('0x2f')]=_[_0x187d('0x30')](_0x71330d['model'],qs[_0x187d('0x31')](_0x5f18bf['query'][_0x187d('0x31')]));_0x59e12a['attributes']=_0x59e12a['attributes'][_0x187d('0x32')]?_0x59e12a[_0x187d('0x2f')]:_0x71330d[_0x187d('0x2c')];_0x59e12a['order']=qs['sort'](_0x5f18bf['query']['sort']);_0x59e12a[_0x187d('0x36')]=qs[_0x187d('0x2d')](_[_0x187d('0x37')](_0x5f18bf['query'],_0x71330d['filters']));if(_0x5f18bf[_0x187d('0x2e')]['filter']){_0x59e12a['where']=_[_0x187d('0x38')](_0x59e12a[_0x187d('0x36')],{'$or':_['map'](_0x59e12a[_0x187d('0x2f')],function(_0x20179b){var _0x434955={};_0x434955[_0x20179b]={'$like':'%'+_0x5f18bf[_0x187d('0x2e')]['filter']+'%'};return _0x434955;})});}_0x59e12a=_[_0x187d('0x38')]({},_0x59e12a,_0x5f18bf[_0x187d('0x3a')]);return _0x214857['getConditions'](_0x59e12a);}})[_0x187d('0x20')](function(_0x1be63d){if(_0x1be63d){_0x32ea5d=_0x1be63d[_0x187d('0x32')];if(!_0x5f18bf['query'][_0x187d('0x33')](_0x187d('0x47'))){_0x59e12a['limit']=qs[_0x187d('0x18')](_0x5f18bf['query'][_0x187d('0x18')]);_0x59e12a[_0x187d('0x16')]=qs[_0x187d('0x16')](_0x5f18bf[_0x187d('0x2e')][_0x187d('0x16')]);}return _0x214857['getConditions'](_0x59e12a);}})[_0x187d('0x20')](function(_0xd05c3d){if(_0xd05c3d){return _0xd05c3d?{'count':_0x32ea5d,'rows':_0xd05c3d}:null;}})[_0x187d('0x20')](respondWithResult(_0x45a4e1,null))[_0x187d('0x3e')](handleError(_0x45a4e1,null));};exports[_0x187d('0x48')]=function(_0x3bf74c,_0x289ca7,_0x106ab3){return db['Action'][_0x187d('0x42')]({'where':{'id':_0x3bf74c[_0x187d('0x40')]['id']}})['then'](handleEntityNotFound(_0x289ca7,null))[_0x187d('0x20')](function(_0x4c7948){if(_0x4c7948){return _0x4c7948[_0x187d('0x48')](_0x3bf74c['body']['ids'],_[_0x187d('0x49')](_0x3bf74c['body'],[_0x187d('0x46'),'id'])||{});}})[_0x187d('0x20')](respondWithResult(_0x289ca7,null))[_0x187d('0x3e')](handleError(_0x289ca7,null));};exports['getActions']=function(_0x33713b,_0x52eb9d,_0x59c8db){var _0x285ec4={};var _0x4c003e={};var _0x2fb0b0;var _0x5e4655;return db[_0x187d('0x27')][_0x187d('0x4a')]({'where':{'id':_0x33713b[_0x187d('0x40')]['id']}})[_0x187d('0x20')](handleEntityNotFound(_0x52eb9d,null))[_0x187d('0x20')](function(_0x457d19){if(_0x457d19){_0x2fb0b0=_0x457d19;_0x4c003e[_0x187d('0x2c')]=_[_0x187d('0x41')](db[_0x187d('0x4b')][_0x187d('0x28')]);_0x4c003e[_0x187d('0x2e')]=_[_0x187d('0x41')](_0x33713b['query']);_0x4c003e[_0x187d('0x2d')]=_['intersection'](_0x4c003e['model'],_0x4c003e['query']);_0x285ec4[_0x187d('0x2f')]=_[_0x187d('0x30')](_0x4c003e['model'],qs[_0x187d('0x31')](_0x33713b['query'][_0x187d('0x31')]));_0x285ec4[_0x187d('0x2f')]=_0x285ec4[_0x187d('0x2f')]['length']?_0x285ec4[_0x187d('0x2f')]:_0x4c003e[_0x187d('0x2c')];_0x285ec4[_0x187d('0x34')]=qs[_0x187d('0x35')](_0x33713b[_0x187d('0x2e')][_0x187d('0x35')]);_0x285ec4['where']=qs[_0x187d('0x2d')](_[_0x187d('0x37')](_0x33713b[_0x187d('0x2e')],_0x4c003e['filters']));if(_0x33713b[_0x187d('0x2e')][_0x187d('0x39')]){_0x285ec4[_0x187d('0x36')]=_[_0x187d('0x38')](_0x285ec4[_0x187d('0x36')],{'$or':_[_0x187d('0x26')](_0x285ec4[_0x187d('0x2f')],function(_0x5b84c1){var _0x583575={};_0x583575[_0x5b84c1]={'$like':'%'+_0x33713b[_0x187d('0x2e')][_0x187d('0x39')]+'%'};return _0x583575;})});}_0x285ec4=_[_0x187d('0x38')]({},_0x285ec4,_0x33713b[_0x187d('0x3a')]);return _0x2fb0b0[_0x187d('0x4c')](_0x285ec4);}})[_0x187d('0x20')](function(_0x2544bd){if(_0x2544bd){_0x5e4655=_0x2544bd[_0x187d('0x32')];if(!_0x33713b['query'][_0x187d('0x33')](_0x187d('0x47'))){_0x285ec4['limit']=qs[_0x187d('0x18')](_0x33713b[_0x187d('0x2e')][_0x187d('0x18')]);_0x285ec4[_0x187d('0x16')]=qs[_0x187d('0x16')](_0x33713b[_0x187d('0x2e')][_0x187d('0x16')]);}return _0x2fb0b0[_0x187d('0x4c')](_0x285ec4);}})[_0x187d('0x20')](function(_0x886fe){if(_0x886fe){return _0x886fe?{'count':_0x5e4655,'rows':_0x886fe}:null;}})['then'](respondWithResult(_0x52eb9d,null))[_0x187d('0x3e')](handleError(_0x52eb9d,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 6d139c5..66794dc 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 _0xaf86=['lodash','util','api','moment','request-promise','rimraf','../../config/environment','exports','Automation','tools_automations'];(function(_0x221c7e,_0x108b1d){var _0x5b68e6=function(_0x2ae798){while(--_0x2ae798){_0x221c7e['push'](_0x221c7e['shift']());}};_0x5b68e6(++_0x108b1d);}(_0xaf86,0x1a4));var _0x6af8=function(_0x5de1bc,_0x434be1){_0x5de1bc=_0x5de1bc-0x0;var _0x19f4b8=_0xaf86[_0x5de1bc];return _0x19f4b8;};'use strict';var _=require(_0x6af8('0x0'));var util=require(_0x6af8('0x1'));var logger=require('../../config/logger')(_0x6af8('0x2'));var moment=require(_0x6af8('0x3'));var BPromise=require('bluebird');var rp=require(_0x6af8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6af8('0x5'));var config=require(_0x6af8('0x6'));var attributes=require('./automation.attributes');module[_0x6af8('0x7')]=function(_0x2df360,_0x3efa14){return _0x2df360['define'](_0x6af8('0x8'),attributes,{'tableName':_0x6af8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfbdf=['Automation','tools_automations','../../config/logger','api','moment','path','rimraf','../../config/environment','./automation.attributes','define'];(function(_0x444eb4,_0x560b86){var _0x2ba90c=function(_0xe79e48){while(--_0xe79e48){_0x444eb4['push'](_0x444eb4['shift']());}};_0x2ba90c(++_0x560b86);}(_0xfbdf,0x106));var _0xffbd=function(_0x3e4a61,_0x59a7c0){_0x3e4a61=_0x3e4a61-0x0;var _0x2361b5=_0xfbdf[_0x3e4a61];return _0x2361b5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xffbd('0x0'))(_0xffbd('0x1'));var moment=require(_0xffbd('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xffbd('0x3'));var rimraf=require(_0xffbd('0x4'));var config=require(_0xffbd('0x5'));var attributes=require(_0xffbd('0x6'));module['exports']=function(_0x44007e,_0x56bd9c){return _0x44007e[_0xffbd('0x7')](_0xffbd('0x8'),attributes,{'tableName':_0xffbd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index f6f21bc..3c44de8 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 _0xd0e4=['util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','Automation,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','lodash'];(function(_0x415c79,_0xbdaeaf){var _0x302b34=function(_0x4b5e68){while(--_0x4b5e68){_0x415c79['push'](_0x415c79['shift']());}};_0x302b34(++_0xbdaeaf);}(_0xd0e4,0x1d3));var _0x4d0e=function(_0x5396d4,_0x86297a){_0x5396d4=_0x5396d4-0x0;var _0x9fa122=_0xd0e4[_0x5396d4];return _0x9fa122;};'use strict';var _=require(_0x4d0e('0x0'));var util=require(_0x4d0e('0x1'));var moment=require(_0x4d0e('0x2'));var BPromise=require(_0x4d0e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4d0e('0x4'))['db'];var utils=require(_0x4d0e('0x5'));var logger=require(_0x4d0e('0x6'))(_0x4d0e('0x7'));var config=require(_0x4d0e('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x103596,_0x39e5c6,_0x50cd74){return new BPromise(function(_0x2f900a,_0x1731e4){return client['request'](_0x103596,_0x50cd74)['then'](function(_0x9358f5){logger['info'](_0x4d0e('0x9'),_0x39e5c6,_0x4d0e('0xa'));logger[_0x4d0e('0xb')]('Automation,\x20%s,\x20%s,\x20%s',_0x39e5c6,_0x4d0e('0xa'),JSON[_0x4d0e('0xc')](_0x9358f5));if(_0x9358f5['error']){if(_0x9358f5['error'][_0x4d0e('0xd')]===0x1f4){logger[_0x4d0e('0xe')](_0x4d0e('0x9'),_0x39e5c6,_0x9358f5[_0x4d0e('0xe')][_0x4d0e('0xf')]);return _0x1731e4(_0x9358f5[_0x4d0e('0xe')][_0x4d0e('0xf')]);}logger[_0x4d0e('0xe')](_0x4d0e('0x9'),_0x39e5c6,_0x9358f5['error'][_0x4d0e('0xf')]);return _0x2f900a(_0x9358f5[_0x4d0e('0xe')][_0x4d0e('0xf')]);}else{logger['info'](_0x4d0e('0x9'),_0x39e5c6,'request\x20sent');_0x2f900a(_0x9358f5[_0x4d0e('0x10')][_0x4d0e('0xf')]);}})[_0x4d0e('0x11')](function(_0x956477){logger[_0x4d0e('0xe')](_0x4d0e('0x9'),_0x39e5c6,_0x956477);_0x1731e4(_0x956477);});});} \ No newline at end of file +var _0x45c2=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash'];(function(_0x2a151f,_0x4bf6ce){var _0x5dbe32=function(_0x5eb831){while(--_0x5eb831){_0x2a151f['push'](_0x2a151f['shift']());}};_0x5dbe32(++_0x4bf6ce);}(_0x45c2,0x68));var _0x245c=function(_0x68361,_0x231f90){_0x68361=_0x68361-0x0;var _0xbb709a=_0x45c2[_0x68361];return _0xbb709a;};'use strict';var _=require(_0x245c('0x0'));var util=require(_0x245c('0x1'));var moment=require(_0x245c('0x2'));var BPromise=require(_0x245c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x245c('0x4'));var db=require(_0x245c('0x5'))['db'];var utils=require(_0x245c('0x6'));var logger=require('../../config/logger')(_0x245c('0x7'));var config=require(_0x245c('0x8'));var jayson=require(_0x245c('0x9'));var client=jayson[_0x245c('0xa')][_0x245c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e1860,_0x20a6d7,_0x10da3e){return new BPromise(function(_0x20c72d,_0x40eab8){return client[_0x245c('0xc')](_0x2e1860,_0x10da3e)[_0x245c('0xd')](function(_0x558ef3){logger[_0x245c('0xe')](_0x245c('0xf'),_0x20a6d7,_0x245c('0x10'));logger['debug']('Automation,\x20%s,\x20%s,\x20%s',_0x20a6d7,_0x245c('0x10'),JSON[_0x245c('0x11')](_0x558ef3));if(_0x558ef3['error']){if(_0x558ef3[_0x245c('0x12')]['code']===0x1f4){logger[_0x245c('0x12')](_0x245c('0xf'),_0x20a6d7,_0x558ef3[_0x245c('0x12')][_0x245c('0x13')]);return _0x40eab8(_0x558ef3[_0x245c('0x12')]['message']);}logger[_0x245c('0x12')](_0x245c('0xf'),_0x20a6d7,_0x558ef3[_0x245c('0x12')][_0x245c('0x13')]);return _0x20c72d(_0x558ef3['error'][_0x245c('0x13')]);}else{logger['info'](_0x245c('0xf'),_0x20a6d7,_0x245c('0x10'));_0x20c72d(_0x558ef3[_0x245c('0x14')][_0x245c('0x13')]);}})['catch'](function(_0x124e02){logger[_0x245c('0x12')](_0x245c('0xf'),_0x20a6d7,_0x124e02);_0x40eab8(_0x124e02);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index cf3e6ac..6b01a91 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 _0xdeee=['get','isAuthenticated','index','/:id','show','/:id/conditions','/:id/actions','post','addActions','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller'];(function(_0x59ab24,_0x172f42){var _0x1bbef4=function(_0x18cabb){while(--_0x18cabb){_0x59ab24['push'](_0x59ab24['shift']());}};_0x1bbef4(++_0x172f42);}(_0xdeee,0x10a));var _0xedee=function(_0x2ba164,_0x149761){_0x2ba164=_0x2ba164-0x0;var _0x2d0945=_0xdeee[_0x2ba164];return _0x2d0945;};'use strict';var multer=require('multer');var util=require(_0xedee('0x0'));var path=require(_0xedee('0x1'));var timeout=require(_0xedee('0x2'));var express=require(_0xedee('0x3'));var router=express[_0xedee('0x4')]();var fs_extra=require(_0xedee('0x5'));var auth=require(_0xedee('0x6'));var interaction=require(_0xedee('0x7'));var config=require(_0xedee('0x8'));var controller=require(_0xedee('0x9'));router[_0xedee('0xa')]('/',auth[_0xedee('0xb')](),controller[_0xedee('0xc')]);router[_0xedee('0xa')](_0xedee('0xd'),auth[_0xedee('0xb')](),controller[_0xedee('0xe')]);router['get'](_0xedee('0xf'),auth[_0xedee('0xb')](),controller['getConditions']);router[_0xedee('0xa')](_0xedee('0x10'),auth['isAuthenticated'](),controller['getActions']);router['post']('/',auth[_0xedee('0xb')](),controller['create']);router[_0xedee('0x11')](_0xedee('0xf'),auth[_0xedee('0xb')](),controller['addConditions']);router[_0xedee('0x11')](_0xedee('0x10'),auth[_0xedee('0xb')](),controller[_0xedee('0x12')]);router[_0xedee('0x13')]('/:id',auth[_0xedee('0xb')](),controller[_0xedee('0x14')]);router[_0xedee('0x15')]('/:id',auth[_0xedee('0xb')](),controller['destroy']);module[_0xedee('0x16')]=router; \ No newline at end of file +var _0x0a25=['addActions','put','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions'];(function(_0x2117c4,_0x4acb1c){var _0x49159d=function(_0x38a20b){while(--_0x38a20b){_0x2117c4['push'](_0x2117c4['shift']());}};_0x49159d(++_0x4acb1c);}(_0x0a25,0x68));var _0x50a2=function(_0xacd1fd,_0x24f8ea){_0xacd1fd=_0xacd1fd-0x0;var _0x3d370b=_0x0a25[_0xacd1fd];return _0x3d370b;};'use strict';var multer=require(_0x50a2('0x0'));var util=require(_0x50a2('0x1'));var path=require('path');var timeout=require(_0x50a2('0x2'));var express=require(_0x50a2('0x3'));var router=express['Router']();var fs_extra=require(_0x50a2('0x4'));var auth=require(_0x50a2('0x5'));var interaction=require(_0x50a2('0x6'));var config=require(_0x50a2('0x7'));var controller=require(_0x50a2('0x8'));router[_0x50a2('0x9')]('/',auth[_0x50a2('0xa')](),controller[_0x50a2('0xb')]);router[_0x50a2('0x9')](_0x50a2('0xc'),auth[_0x50a2('0xa')](),controller[_0x50a2('0xd')]);router[_0x50a2('0x9')](_0x50a2('0xe'),auth[_0x50a2('0xa')](),controller[_0x50a2('0xf')]);router[_0x50a2('0x9')](_0x50a2('0x10'),auth['isAuthenticated'](),controller[_0x50a2('0x11')]);router[_0x50a2('0x12')]('/',auth[_0x50a2('0xa')](),controller[_0x50a2('0x13')]);router[_0x50a2('0x12')](_0x50a2('0xe'),auth['isAuthenticated'](),controller[_0x50a2('0x14')]);router[_0x50a2('0x12')](_0x50a2('0x10'),auth[_0x50a2('0xa')](),controller[_0x50a2('0x15')]);router[_0x50a2('0x16')](_0x50a2('0xc'),auth[_0x50a2('0xa')](),controller['update']);router['delete']('/:id',auth[_0x50a2('0xa')](),controller[_0x50a2('0x17')]);module[_0x50a2('0x18')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index d12d58d..35a10ef 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 _0x0c6b=['sequelize','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x495c1b,_0x269f02){var _0x41c4be=function(_0x51463a){while(--_0x51463a){_0x495c1b['push'](_0x495c1b['shift']());}};_0x41c4be(++_0x269f02);}(_0x0c6b,0x1bc));var _0xb0c6=function(_0x16c1f6,_0x354ed1){_0x16c1f6=_0x16c1f6-0x0;var _0x475d24=_0x0c6b[_0x16c1f6];return _0x475d24;};'use strict';var Sequelize=require(_0xb0c6('0x0'));module['exports']={'name':{'type':Sequelize[_0xb0c6('0x1')],'unique':_0xb0c6('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xb0c6('0x3')](_0xb0c6('0x4')),'allowNull':![],'defaultValue':_0xb0c6('0x4')},'description':{'type':Sequelize[_0xb0c6('0x1')]},'active':{'type':Sequelize[_0xb0c6('0x5')],'defaultValue':0x0,'comment':_0xb0c6('0x6')},'limitCalls':{'type':Sequelize[_0xb0c6('0x7')](0x4)[_0xb0c6('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xb0c6('0x9')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb0c6('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0xb0c6('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xb0c6('0x7')](0x5)[_0xb0c6('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb0c6('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0xb0c6('0x7')](0x3)[_0xb0c6('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb0c6('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0xb0c6('0x7')](0x5)[_0xb0c6('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xb0c6('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xb0c6('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xb0c6('0x7')](0x5)[_0xb0c6('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xb0c6('0x7')](0x3)[_0xb0c6('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xb0c6('0xe')},'dialTimezone':{'type':Sequelize[_0xb0c6('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xb0c6('0x1')],'defaultValue':_0xb0c6('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0xb0c6('0x3')](_0xb0c6('0x10'),'never',_0xb0c6('0x11')),'defaultValue':_0xb0c6('0x10')},'dialAMDActive':{'type':Sequelize[_0xb0c6('0x5')],'defaultValue':0x0,'comment':_0xb0c6('0x12')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xb0c6('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xb0c6('0x13')},'dialAMDGreeting':{'type':Sequelize[_0xb0c6('0x7')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xb0c6('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xb0c6('0x7')](0x9)[_0xb0c6('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xb0c6('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xb0c6('0x7')](0x9)[_0xb0c6('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xb0c6('0x16')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xb0c6('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xb0c6('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xb0c6('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xb0c6('0x7')](0x9)[_0xb0c6('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xb0c6('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xb0c6('0x7')](0x9)[_0xb0c6('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xb0c6('0x19')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xb0c6('0x1a'),_0xb0c6('0x1b')),'defaultValue':_0xb0c6('0x1a')},'dialPrefix':{'type':Sequelize[_0xb0c6('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xb0c6('0x7')](0x3)[_0xb0c6('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xb0c6('0x1c')},'dialCutDigit':{'type':Sequelize[_0xb0c6('0x7')](0x3)[_0xb0c6('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xb0c6('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xb0c6('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb0c6('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xb0c6('0x7')](0x5)[_0xb0c6('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xb0c6('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xb0c6('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb0c6('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xb0c6('0x7')](0x3)[_0xb0c6('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb0c6('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xb0c6('0x7')](0x5)[_0xb0c6('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb0c6('0x21')},'dialMachineMaxRetry':{'type':Sequelize[_0xb0c6('0x7')](0x3)[_0xb0c6('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xb0c6('0x7')](0x5)[_0xb0c6('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb0c6('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xb0c6('0x7')](0x3)[_0xb0c6('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb0c6('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xb0c6('0x7')](0x5)[_0xb0c6('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb0c6('0x24')}}; \ No newline at end of file +var _0x83e4=['#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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','name','ENUM','ivr','STRING','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','UNSIGNED','#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','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x83e4,0x137));var _0x483e=function(_0x2eea5f,_0x34cfa2){_0x2eea5f=_0x2eea5f-0x0;var _0x381ef7=_0x83e4[_0x2eea5f];return _0x381ef7;};'use strict';var Sequelize=require(_0x483e('0x0'));module[_0x483e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x483e('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x483e('0x3')](_0x483e('0x4')),'allowNull':![],'defaultValue':_0x483e('0x4')},'description':{'type':Sequelize[_0x483e('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x483e('0x6')},'limitCalls':{'type':Sequelize[_0x483e('0x7')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x483e('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0x483e('0x5')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x483e('0x5')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x483e('0x7')](0x5)[_0x483e('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x483e('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x483e('0xa')},'dialBusyRetryFrequency':{'type':Sequelize[_0x483e('0x7')](0x5)[_0x483e('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x483e('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x483e('0x7')](0x3)[_0x483e('0x9')],'defaultValue':0x3,'comment':_0x483e('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x483e('0x7')](0x5)[_0x483e('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x483e('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0x483e('0x7')](0x3)[_0x483e('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x483e('0xe')},'dialTimezone':{'type':Sequelize[_0x483e('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x483e('0x5')],'defaultValue':_0x483e('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0x483e('0x3')](_0x483e('0x10'),'never','onlyIfOpen'),'defaultValue':_0x483e('0x10')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x483e('0x11')},'dialAMDInitialSilence':{'type':Sequelize[_0x483e('0x7')](0x9)[_0x483e('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x483e('0x12')},'dialAMDGreeting':{'type':Sequelize[_0x483e('0x7')](0x9)[_0x483e('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x483e('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x483e('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x483e('0x14')},'dialAMDMinWordLength':{'type':Sequelize[_0x483e('0x7')](0x9)[_0x483e('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x483e('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x483e('0x7')](0x9)[_0x483e('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x483e('0x7')](0x9)[_0x483e('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x483e('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x483e('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x483e('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x483e('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x483e('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0x483e('0x3')](_0x483e('0x19'),'ASC'),'defaultValue':_0x483e('0x19')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x483e('0x7')](0x3)[_0x483e('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x483e('0x1a')},'dialCutDigit':{'type':Sequelize[_0x483e('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x483e('0x7')](0x5)[_0x483e('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x483e('0x1b')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x483e('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x483e('0x1c')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x483e('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x483e('0x7')](0x3)[_0x483e('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x483e('0x1d')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x483e('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x483e('0x1e')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x483e('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x483e('0x1f')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x483e('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x483e('0x20')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x483e('0x7')](0x3)[_0x483e('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x483e('0x7')](0x5)[_0x483e('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x483e('0x21')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 202c342..316e0f6 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 _0x4631=['CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt','select','field','from','deletedAt\x20IS\x20NULL','CmListId','toString','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','into','NOW()','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','cm_hopper_additional_phones','cmHopperId','OrderBy','cm_contact_has_items','join','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','removeBlackLists','eml-format','rimraf','fast-json-patch','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','UserProfileResource','stack','name','index','map','Campaign','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','user','role','get','IvrCampaigns','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','getHoppers','findOne','hasOwnProperty','CampaignId','CmHopper','rows','getHopperHistories','CmHopperHistory','getHopperFinals','nolimit','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists'];(function(_0x4f0a77,_0x221a0f){var _0x5e91b8=function(_0xc584d9){while(--_0xc584d9){_0x4f0a77['push'](_0x4f0a77['shift']());}};_0x5e91b8(++_0x221a0f);}(_0x4631,0xb9));var _0x1463=function(_0x3fcc20,_0x57c31b){_0x3fcc20=_0x3fcc20-0x0;var _0x15d3ce=_0x4631[_0x3fcc20];return _0x15d3ce;};'use strict';var emlformat=require(_0x1463('0x0'));var rimraf=require(_0x1463('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1463('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1463('0x3'));var path=require(_0x1463('0x4'));var sox=require(_0x1463('0x5'));var csv=require(_0x1463('0x6'));var ejs=require(_0x1463('0x7'));var fs=require('fs');var fs_extra=require(_0x1463('0x8'));var _=require(_0x1463('0x9'));var squel=require('squel');var crypto=require(_0x1463('0xa'));var jsforce=require(_0x1463('0xb'));var deskjs=require(_0x1463('0xc'));var toCsv=require(_0x1463('0x6'));var querystring=require('querystring');var Papa=require(_0x1463('0xd'));var Redis=require(_0x1463('0xe'));var authService=require(_0x1463('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x1463('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1463('0x11'))('api');var utils=require(_0x1463('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44be30,_0x1694b5){_0x1694b5=_0x1694b5||0xcc;return function(_0x51432c){if(_0x51432c){return _0x44be30[_0x1463('0x13')](_0x1694b5);}return _0x44be30[_0x1463('0x14')](_0x1694b5)[_0x1463('0x15')]();};}function respondWithResult(_0x462b48,_0x2649f1){_0x2649f1=_0x2649f1||0xc8;return function(_0x3b9a22){if(_0x3b9a22){return _0x462b48[_0x1463('0x14')](_0x2649f1)[_0x1463('0x16')](_0x3b9a22);}};}function respondWithFilteredResult(_0x2f4e02,_0x1404da){return function(_0x220b5a){if(_0x220b5a){var _0x5e606d=typeof _0x1404da[_0x1463('0x17')]===_0x1463('0x18')&&typeof _0x1404da[_0x1463('0x19')]===_0x1463('0x18');var _0x5e8c64=_0x220b5a[_0x1463('0x1a')];var _0x12892b=_0x5e606d?0x0:_0x1404da[_0x1463('0x17')];var _0x134de5=_0x5e606d?_0x220b5a[_0x1463('0x1a')]:_0x1404da[_0x1463('0x17')]+_0x1404da[_0x1463('0x19')];var _0x1a0173;if(_0x134de5>=_0x5e8c64){_0x134de5=_0x5e8c64;_0x1a0173=0xc8;}else{_0x1a0173=0xce;}_0x2f4e02[_0x1463('0x14')](_0x1a0173);return _0x2f4e02[_0x1463('0x1b')](_0x1463('0x1c'),_0x12892b+'-'+_0x134de5+'/'+_0x5e8c64)['json'](_0x220b5a);}return null;};}function patchUpdates(_0x5671b8){return function(_0x1e9188){try{jsonpatch[_0x1463('0x1d')](_0x1e9188,_0x5671b8,!![]);}catch(_0x22a836){return BPromise[_0x1463('0x1e')](_0x22a836);}return _0x1e9188[_0x1463('0x1f')]();};}function saveUpdates(_0x6de5b1,_0x1ffd2e){return function(_0xd8834a){if(_0xd8834a){return _0xd8834a[_0x1463('0x20')](_0x6de5b1)['then'](function(_0x3181b3){return _0x3181b3;});}return null;};}function removeEntity(_0x540160,_0x3e5938){return function(_0x1ab5b5){if(_0x1ab5b5){return _0x1ab5b5[_0x1463('0x21')]()[_0x1463('0x22')](function(){var _0x1f7609=_0x1ab5b5['get']({'plain':!![]});var _0x1cb809='IvrCampaigns';return db[_0x1463('0x23')][_0x1463('0x21')]({'where':{'type':_0x1cb809,'resourceId':_0x1f7609['id']}})['then'](function(){return _0x1ab5b5;});})[_0x1463('0x22')](function(){_0x540160[_0x1463('0x14')](0xcc)[_0x1463('0x15')]();});}};}function handleEntityNotFound(_0x515e3f,_0x45d64a){return function(_0x783bfa){if(!_0x783bfa){_0x515e3f['sendStatus'](0x194);}return _0x783bfa;};}function handleError(_0x38a7d6,_0x6dc66b){_0x6dc66b=_0x6dc66b||0x1f4;return function(_0x42c280){logger['error'](_0x42c280[_0x1463('0x24')]);if(_0x42c280[_0x1463('0x25')]){delete _0x42c280[_0x1463('0x25')];}_0x38a7d6['status'](_0x6dc66b)['send'](_0x42c280);};}exports[_0x1463('0x26')]=function(_0x4555f2,_0x282d3d){var _0x93bad6={},_0x27778d={},_0x3d63c6={'count':0x0,'rows':[]};var _0x10bd8b=_[_0x1463('0x27')](db[_0x1463('0x28')][_0x1463('0x29')],function(_0x355539){return{'name':_0x355539['fieldName'],'type':_0x355539[_0x1463('0x2a')]['key']};});_0x27778d[_0x1463('0x2b')]=_[_0x1463('0x27')](_0x10bd8b,_0x1463('0x25'));_0x27778d[_0x1463('0x2c')]=_[_0x1463('0x2d')](_0x4555f2[_0x1463('0x2c')]);_0x27778d['filters']=_[_0x1463('0x2e')](_0x27778d[_0x1463('0x2b')],_0x27778d[_0x1463('0x2c')]);_0x93bad6[_0x1463('0x2f')]=_[_0x1463('0x2e')](_0x27778d['model'],qs[_0x1463('0x30')](_0x4555f2[_0x1463('0x2c')]['fields']));_0x93bad6['attributes']=_0x93bad6[_0x1463('0x2f')][_0x1463('0x31')]?_0x93bad6[_0x1463('0x2f')]:_0x27778d[_0x1463('0x2b')];if(!_0x4555f2[_0x1463('0x2c')]['hasOwnProperty']('nolimit')){_0x93bad6[_0x1463('0x19')]=qs[_0x1463('0x19')](_0x4555f2[_0x1463('0x2c')][_0x1463('0x19')]);_0x93bad6['offset']=qs[_0x1463('0x17')](_0x4555f2['query']['offset']);}_0x93bad6[_0x1463('0x32')]=qs[_0x1463('0x33')](_0x4555f2['query']['sort']);_0x93bad6[_0x1463('0x34')]=qs[_0x1463('0x35')](_[_0x1463('0x36')](_0x4555f2[_0x1463('0x2c')],_0x27778d[_0x1463('0x35')]),_0x10bd8b);if(_0x4555f2[_0x1463('0x2c')][_0x1463('0x37')]){_0x93bad6['where']=_[_0x1463('0x38')](_0x93bad6[_0x1463('0x34')],{'$or':_[_0x1463('0x27')](_0x10bd8b,function(_0x1fef32){if(_0x1fef32[_0x1463('0x2a')]!==_0x1463('0x39')){var _0x208931={};_0x208931[_0x1fef32['name']]={'$like':'%'+_0x4555f2[_0x1463('0x2c')]['filter']+'%'};return _0x208931;}})});}_0x93bad6=_[_0x1463('0x38')]({},_0x93bad6,_0x4555f2[_0x1463('0x3a')]);var _0xfa9b63={'where':_0x93bad6[_0x1463('0x34')]};return db[_0x1463('0x28')][_0x1463('0x1a')](_0xfa9b63)['then'](function(_0x13a54a){_0x3d63c6[_0x1463('0x1a')]=_0x13a54a;if(_0x4555f2[_0x1463('0x2c')][_0x1463('0x3b')]){_0x93bad6[_0x1463('0x3c')]=[{'all':!![]}];}return db[_0x1463('0x28')][_0x1463('0x3d')](_0x93bad6);})[_0x1463('0x22')](function(_0x394b6e){_0x3d63c6['rows']=_0x394b6e;return _0x3d63c6;})[_0x1463('0x22')](respondWithFilteredResult(_0x282d3d,_0x93bad6))[_0x1463('0x3e')](handleError(_0x282d3d,null));};exports['show']=function(_0x4845e2,_0x241050){var _0x43ab2b={'raw':![],'where':{'id':_0x4845e2[_0x1463('0x3f')]['id']}},_0x3393cb={};_0x3393cb[_0x1463('0x2b')]=_[_0x1463('0x2d')](db[_0x1463('0x28')]['rawAttributes']);_0x3393cb['query']=_['keys'](_0x4845e2[_0x1463('0x2c')]);_0x3393cb[_0x1463('0x35')]=_['intersection'](_0x3393cb[_0x1463('0x2b')],_0x3393cb[_0x1463('0x2c')]);_0x43ab2b[_0x1463('0x2f')]=_[_0x1463('0x2e')](_0x3393cb[_0x1463('0x2b')],qs[_0x1463('0x30')](_0x4845e2[_0x1463('0x2c')]['fields']));_0x43ab2b['attributes']=_0x43ab2b[_0x1463('0x2f')][_0x1463('0x31')]?_0x43ab2b[_0x1463('0x2f')]:_0x3393cb[_0x1463('0x2b')];if(_0x4845e2[_0x1463('0x2c')]['includeAll']){_0x43ab2b['include']=[{'all':!![]}];}_0x43ab2b=_[_0x1463('0x38')]({},_0x43ab2b,_0x4845e2[_0x1463('0x3a')]);return db[_0x1463('0x28')][_0x1463('0x40')](_0x43ab2b)['then'](handleEntityNotFound(_0x241050,null))[_0x1463('0x22')](respondWithResult(_0x241050,null))[_0x1463('0x3e')](handleError(_0x241050,null));};exports[_0x1463('0x41')]=function(_0x13cd4a,_0xd43749){return db['Campaign']['create'](_0x13cd4a[_0x1463('0x42')],{})[_0x1463('0x22')](function(_0x26d895){var _0x55ce29=_0x13cd4a[_0x1463('0x43')]['get']({'plain':!![]});if(!_0x55ce29)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x55ce29[_0x1463('0x44')]==='user'){var _0x5742ae=_0x26d895[_0x1463('0x45')]({'plain':!![]});var _0x1a7dc1=_0x1463('0x46');return db[_0x1463('0x47')][_0x1463('0x40')]({'where':{'name':_0x1a7dc1,'userProfileId':_0x55ce29['userProfileId']},'raw':!![]})[_0x1463('0x22')](function(_0x169f6b){if(_0x169f6b&&_0x169f6b['autoAssociation']===0x0){return db['UserProfileResource'][_0x1463('0x41')]({'name':_0x5742ae['name'],'resourceId':_0x5742ae['id'],'type':_0x169f6b[_0x1463('0x25')],'sectionId':_0x169f6b['id']},{})[_0x1463('0x22')](function(){return _0x26d895;});}else{return _0x26d895;}})['catch'](function(_0x8673ad){logger[_0x1463('0x48')](_0x1463('0x49'),_0x8673ad);throw _0x8673ad;});}return _0x26d895;})['then'](respondWithResult(_0xd43749,0xc9))[_0x1463('0x3e')](handleError(_0xd43749,null));};exports[_0x1463('0x4a')]=function(_0x4262,_0x1722ca){var _0x20513a={'where':{'id':_0x4262['params']['id']}},_0x33bb02={};_0x33bb02[_0x1463('0x2b')]=_[_0x1463('0x2d')](db['Campaign'][_0x1463('0x29')]);_0x20513a[_0x1463('0x2f')]=_[_0x1463('0x2e')](_0x33bb02[_0x1463('0x2b')],qs[_0x1463('0x30')](_0x4262[_0x1463('0x2c')][_0x1463('0x30')]));_0x20513a['attributes']=_0x20513a['attributes'][_0x1463('0x31')]?_0x20513a[_0x1463('0x2f')]:_0x33bb02[_0x1463('0x2b')];if(_0x4262['query'][_0x1463('0x3b')]){_0x20513a['include']=[{'all':!![]}];}_0x20513a=_['merge']({},_0x20513a,_0x4262[_0x1463('0x3a')]);return db[_0x1463('0x28')]['find'](_0x20513a)['then'](handleEntityNotFound(_0x1722ca,null))['then'](function(_0x4c6b64){if(_0x4c6b64){var _0x53e9d7=_0x4c6b64[_0x1463('0x45')]({'plain':!![]});_0x53e9d7=qs[_0x1463('0x4b')](_0x53e9d7,['id','createdAt',_0x1463('0x4c')]);_0x4262[_0x1463('0x42')]=_['omit'](_0x4262[_0x1463('0x42')],['id','createdAt',_0x1463('0x4c')]);return db[_0x1463('0x28')][_0x1463('0x41')](_[_0x1463('0x38')](_0x53e9d7,_0x4262['body']),{'include':_0x4262['query'][_0x1463('0x3b')]?[{'all':!![]}]:undefined})[_0x1463('0x22')](function(_0x4ad490){var _0x263c97=_0x4262[_0x1463('0x43')][_0x1463('0x45')]({'plain':!![]});if(!_0x263c97)throw new Error(_0x1463('0x4d'));if(_0x263c97['role']===_0x1463('0x43')){var _0x149c21=_0x4ad490['get']({'plain':!![]});var _0x543dd8=_0x1463('0x46');return db[_0x1463('0x47')][_0x1463('0x40')]({'where':{'name':_0x543dd8,'userProfileId':_0x263c97['userProfileId']},'raw':!![]})[_0x1463('0x22')](function(_0x51319e){if(_0x51319e&&_0x51319e[_0x1463('0x4e')]===0x0){return db[_0x1463('0x23')]['create']({'name':_0x149c21[_0x1463('0x25')],'resourceId':_0x149c21['id'],'type':_0x51319e[_0x1463('0x25')],'sectionId':_0x51319e['id']},{})['then'](function(){return _0x4ad490;});}else{return _0x4ad490;}})[_0x1463('0x3e')](function(_0x3a69c9){logger['error'](_0x1463('0x49'),_0x3a69c9);throw _0x3a69c9;});}return _0x4ad490;});}})[_0x1463('0x22')](respondWithResult(_0x1722ca,0xc9))[_0x1463('0x3e')](handleError(_0x1722ca,null));};exports['update']=function(_0x1b02bb,_0x174f5b){if(_0x1b02bb[_0x1463('0x42')]['id']){delete _0x1b02bb[_0x1463('0x42')]['id'];}return db[_0x1463('0x28')]['find']({'where':{'id':_0x1b02bb[_0x1463('0x3f')]['id']}})[_0x1463('0x22')](handleEntityNotFound(_0x174f5b,null))['then'](saveUpdates(_0x1b02bb[_0x1463('0x42')],null))[_0x1463('0x22')](respondWithResult(_0x174f5b,null))['catch'](handleError(_0x174f5b,null));};exports[_0x1463('0x21')]=function(_0x59a07b,_0xe76713){return db['Campaign'][_0x1463('0x40')]({'where':{'id':_0x59a07b[_0x1463('0x3f')]['id']}})[_0x1463('0x22')](handleEntityNotFound(_0xe76713,null))[_0x1463('0x22')](removeEntity(_0xe76713,null))[_0x1463('0x3e')](handleError(_0xe76713,null));};exports[_0x1463('0x4f')]=function(_0x1c58fc,_0x49cacc,_0x5c24bb){var _0x29dca9={'raw':!![],'where':{}};var _0x2e6dc5={};var _0x4ac1fa={'count':0x0,'rows':[]};return db[_0x1463('0x28')][_0x1463('0x50')]({'where':{'id':_0x1c58fc[_0x1463('0x3f')]['id']}})['then'](handleEntityNotFound(_0x49cacc,null))[_0x1463('0x22')](function(_0x1ccdd4){if(_0x1ccdd4){_0x2e6dc5[_0x1463('0x2b')]=_[_0x1463('0x2d')](db['CmHopper'][_0x1463('0x29')]);_0x2e6dc5['query']=_[_0x1463('0x2d')](_0x1c58fc[_0x1463('0x2c')]);_0x2e6dc5['filters']=_[_0x1463('0x2e')](_0x2e6dc5['model'],_0x2e6dc5[_0x1463('0x2c')]);_0x29dca9[_0x1463('0x2f')]=_['intersection'](_0x2e6dc5[_0x1463('0x2b')],qs[_0x1463('0x30')](_0x1c58fc[_0x1463('0x2c')][_0x1463('0x30')]));_0x29dca9[_0x1463('0x2f')]=_0x29dca9[_0x1463('0x2f')][_0x1463('0x31')]?_0x29dca9[_0x1463('0x2f')]:_0x2e6dc5[_0x1463('0x2b')];if(!_0x1c58fc[_0x1463('0x2c')][_0x1463('0x51')]('nolimit')){_0x29dca9[_0x1463('0x19')]=qs[_0x1463('0x19')](_0x1c58fc[_0x1463('0x2c')][_0x1463('0x19')]);_0x29dca9[_0x1463('0x17')]=qs[_0x1463('0x17')](_0x1c58fc[_0x1463('0x2c')][_0x1463('0x17')]);}_0x29dca9[_0x1463('0x32')]=qs[_0x1463('0x33')](_0x1c58fc['query'][_0x1463('0x33')]);_0x29dca9[_0x1463('0x34')]=qs[_0x1463('0x35')](_[_0x1463('0x36')](_0x1c58fc[_0x1463('0x2c')],_0x2e6dc5['filters']));_0x29dca9['where'][_0x1463('0x52')]=_0x1ccdd4['id'];if(_0x1c58fc[_0x1463('0x2c')]['filter']){_0x29dca9[_0x1463('0x34')]=_['merge'](_0x29dca9[_0x1463('0x34')],{'$or':_[_0x1463('0x27')](_0x29dca9[_0x1463('0x2f')],function(_0x30081a){var _0x2a5a36={};_0x2a5a36[_0x30081a]={'$like':'%'+_0x1c58fc[_0x1463('0x2c')]['filter']+'%'};return _0x2a5a36;})});}_0x29dca9=_['merge']({},_0x29dca9,_0x1c58fc['options']);return db['CmHopper'][_0x1463('0x1a')]({'where':_0x29dca9[_0x1463('0x34')]})['then'](function(_0xa7e8a4){_0x4ac1fa[_0x1463('0x1a')]=_0xa7e8a4;if(_0x1c58fc[_0x1463('0x2c')][_0x1463('0x3b')]){_0x29dca9[_0x1463('0x3c')]=[{'all':!![]}];}return db[_0x1463('0x53')][_0x1463('0x3d')](_0x29dca9);})[_0x1463('0x22')](function(_0x26cdb7){_0x4ac1fa[_0x1463('0x54')]=_0x26cdb7;return _0x4ac1fa;});}})['then'](respondWithFilteredResult(_0x49cacc,_0x29dca9))[_0x1463('0x3e')](handleError(_0x49cacc,null));};exports[_0x1463('0x55')]=function(_0x12dae1,_0x2ca229,_0x2cfc93){var _0x1cb64e={'raw':!![],'where':{}};var _0x14f295={};var _0x5d90b3={'count':0x0,'rows':[]};return db[_0x1463('0x28')]['findOne']({'where':{'id':_0x12dae1[_0x1463('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2ca229,null))[_0x1463('0x22')](function(_0x154c07){if(_0x154c07){_0x14f295[_0x1463('0x2b')]=_['keys'](db[_0x1463('0x56')]['rawAttributes']);_0x14f295[_0x1463('0x2c')]=_[_0x1463('0x2d')](_0x12dae1[_0x1463('0x2c')]);_0x14f295['filters']=_[_0x1463('0x2e')](_0x14f295['model'],_0x14f295[_0x1463('0x2c')]);_0x1cb64e[_0x1463('0x2f')]=_['intersection'](_0x14f295[_0x1463('0x2b')],qs[_0x1463('0x30')](_0x12dae1[_0x1463('0x2c')][_0x1463('0x30')]));_0x1cb64e[_0x1463('0x2f')]=_0x1cb64e[_0x1463('0x2f')][_0x1463('0x31')]?_0x1cb64e['attributes']:_0x14f295[_0x1463('0x2b')];if(!_0x12dae1['query']['hasOwnProperty']('nolimit')){_0x1cb64e[_0x1463('0x19')]=qs[_0x1463('0x19')](_0x12dae1[_0x1463('0x2c')][_0x1463('0x19')]);_0x1cb64e[_0x1463('0x17')]=qs[_0x1463('0x17')](_0x12dae1[_0x1463('0x2c')][_0x1463('0x17')]);}_0x1cb64e[_0x1463('0x32')]=qs[_0x1463('0x33')](_0x12dae1['query'][_0x1463('0x33')]);_0x1cb64e[_0x1463('0x34')]=qs['filters'](_[_0x1463('0x36')](_0x12dae1[_0x1463('0x2c')],_0x14f295[_0x1463('0x35')]));_0x1cb64e[_0x1463('0x34')][_0x1463('0x52')]=_0x154c07['id'];if(_0x12dae1[_0x1463('0x2c')][_0x1463('0x37')]){_0x1cb64e[_0x1463('0x34')]=_[_0x1463('0x38')](_0x1cb64e['where'],{'$or':_[_0x1463('0x27')](_0x1cb64e[_0x1463('0x2f')],function(_0x3d7879){var _0x31445e={};_0x31445e[_0x3d7879]={'$like':'%'+_0x12dae1['query'][_0x1463('0x37')]+'%'};return _0x31445e;})});}_0x1cb64e=_[_0x1463('0x38')]({},_0x1cb64e,_0x12dae1[_0x1463('0x3a')]);return db[_0x1463('0x56')][_0x1463('0x1a')]({'where':_0x1cb64e[_0x1463('0x34')]})[_0x1463('0x22')](function(_0x3e599e){_0x5d90b3[_0x1463('0x1a')]=_0x3e599e;if(_0x12dae1['query'][_0x1463('0x3b')]){_0x1cb64e['include']=[{'all':!![]}];}return db[_0x1463('0x56')][_0x1463('0x3d')](_0x1cb64e);})[_0x1463('0x22')](function(_0x22e0a4){_0x5d90b3[_0x1463('0x54')]=_0x22e0a4;return _0x5d90b3;});}})[_0x1463('0x22')](respondWithFilteredResult(_0x2ca229,_0x1cb64e))[_0x1463('0x3e')](handleError(_0x2ca229,null));};exports[_0x1463('0x57')]=function(_0x314a79,_0x5dbd80,_0x3725a4){var _0x3a9359={'raw':!![],'where':{}};var _0x15bb0f={};var _0x2e549e={'count':0x0,'rows':[]};return db[_0x1463('0x28')]['findOne']({'where':{'id':_0x314a79[_0x1463('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5dbd80,null))[_0x1463('0x22')](function(_0x449598){if(_0x449598){_0x15bb0f[_0x1463('0x2b')]=_[_0x1463('0x2d')](db['CmHopperFinal']['rawAttributes']);_0x15bb0f[_0x1463('0x2c')]=_[_0x1463('0x2d')](_0x314a79[_0x1463('0x2c')]);_0x15bb0f[_0x1463('0x35')]=_[_0x1463('0x2e')](_0x15bb0f[_0x1463('0x2b')],_0x15bb0f['query']);_0x3a9359[_0x1463('0x2f')]=_[_0x1463('0x2e')](_0x15bb0f[_0x1463('0x2b')],qs[_0x1463('0x30')](_0x314a79['query'][_0x1463('0x30')]));_0x3a9359[_0x1463('0x2f')]=_0x3a9359['attributes'][_0x1463('0x31')]?_0x3a9359[_0x1463('0x2f')]:_0x15bb0f[_0x1463('0x2b')];if(!_0x314a79[_0x1463('0x2c')][_0x1463('0x51')](_0x1463('0x58'))){_0x3a9359[_0x1463('0x19')]=qs['limit'](_0x314a79[_0x1463('0x2c')][_0x1463('0x19')]);_0x3a9359['offset']=qs['offset'](_0x314a79[_0x1463('0x2c')][_0x1463('0x17')]);}_0x3a9359[_0x1463('0x32')]=qs['sort'](_0x314a79[_0x1463('0x2c')][_0x1463('0x33')]);_0x3a9359['where']=qs['filters'](_[_0x1463('0x36')](_0x314a79[_0x1463('0x2c')],_0x15bb0f[_0x1463('0x35')]));_0x3a9359['where']['CampaignId']=_0x449598['id'];if(_0x314a79[_0x1463('0x2c')]['filter']){_0x3a9359['where']=_['merge'](_0x3a9359['where'],{'$or':_[_0x1463('0x27')](_0x3a9359[_0x1463('0x2f')],function(_0x4dfd54){var _0x41e2af={};_0x41e2af[_0x4dfd54]={'$like':'%'+_0x314a79[_0x1463('0x2c')][_0x1463('0x37')]+'%'};return _0x41e2af;})});}_0x3a9359=_[_0x1463('0x38')]({},_0x3a9359,_0x314a79[_0x1463('0x3a')]);return db[_0x1463('0x59')][_0x1463('0x1a')]({'where':_0x3a9359[_0x1463('0x34')]})['then'](function(_0x5958f6){_0x2e549e['count']=_0x5958f6;if(_0x314a79['query']['includeAll']){_0x3a9359['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0x1463('0x3d')](_0x3a9359);})['then'](function(_0x533447){_0x2e549e[_0x1463('0x54')]=_0x533447;return _0x2e549e;});}})[_0x1463('0x22')](respondWithFilteredResult(_0x5dbd80,_0x3a9359))[_0x1463('0x3e')](handleError(_0x5dbd80,null));};exports[_0x1463('0x5a')]=function(_0x5c907c,_0x5e48dd,_0x24134e){var _0x2027a2={'raw':!![],'where':{}};var _0x231649={};var _0x29ae92={'count':0x0,'rows':[]};return db['Campaign'][_0x1463('0x50')]({'where':{'id':_0x5c907c[_0x1463('0x3f')]['id']}})[_0x1463('0x22')](handleEntityNotFound(_0x5e48dd,null))[_0x1463('0x22')](function(_0x20cfe9){if(_0x20cfe9){_0x231649[_0x1463('0x2b')]=_[_0x1463('0x2d')](db['CmHopperBlack']['rawAttributes']);_0x231649[_0x1463('0x2c')]=_[_0x1463('0x2d')](_0x5c907c['query']);_0x231649['filters']=_[_0x1463('0x2e')](_0x231649[_0x1463('0x2b')],_0x231649[_0x1463('0x2c')]);_0x2027a2['attributes']=_[_0x1463('0x2e')](_0x231649[_0x1463('0x2b')],qs[_0x1463('0x30')](_0x5c907c[_0x1463('0x2c')][_0x1463('0x30')]));_0x2027a2['attributes']=_0x2027a2['attributes'][_0x1463('0x31')]?_0x2027a2[_0x1463('0x2f')]:_0x231649[_0x1463('0x2b')];if(!_0x5c907c[_0x1463('0x2c')][_0x1463('0x51')](_0x1463('0x58'))){_0x2027a2[_0x1463('0x19')]=qs[_0x1463('0x19')](_0x5c907c[_0x1463('0x2c')][_0x1463('0x19')]);_0x2027a2['offset']=qs['offset'](_0x5c907c[_0x1463('0x2c')][_0x1463('0x17')]);}_0x2027a2[_0x1463('0x32')]=qs[_0x1463('0x33')](_0x5c907c[_0x1463('0x2c')][_0x1463('0x33')]);_0x2027a2['where']=qs[_0x1463('0x35')](_[_0x1463('0x36')](_0x5c907c['query'],_0x231649['filters']));_0x2027a2['where'][_0x1463('0x52')]=_0x20cfe9['id'];if(_0x5c907c[_0x1463('0x2c')][_0x1463('0x37')]){_0x2027a2[_0x1463('0x34')]=_[_0x1463('0x38')](_0x2027a2[_0x1463('0x34')],{'$or':_[_0x1463('0x27')](_0x2027a2[_0x1463('0x2f')],function(_0x129ee7){var _0x589f70={};_0x589f70[_0x129ee7]={'$like':'%'+_0x5c907c[_0x1463('0x2c')][_0x1463('0x37')]+'%'};return _0x589f70;})});}_0x2027a2=_['merge']({},_0x2027a2,_0x5c907c['options']);return db[_0x1463('0x5b')][_0x1463('0x1a')]({'where':_0x2027a2['where']})[_0x1463('0x22')](function(_0xf99e9d){_0x29ae92[_0x1463('0x1a')]=_0xf99e9d;if(_0x5c907c[_0x1463('0x2c')][_0x1463('0x3b')]){_0x2027a2[_0x1463('0x3c')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x2027a2);})[_0x1463('0x22')](function(_0x5ea8b7){_0x29ae92['rows']=_0x5ea8b7;return _0x29ae92;});}})[_0x1463('0x22')](respondWithFilteredResult(_0x5e48dd,_0x2027a2))[_0x1463('0x3e')](handleError(_0x5e48dd,null));};exports[_0x1463('0x5c')]=function(_0x574ef9,_0x344257,_0x550426){var _0x1667f6={};var _0x2c7a69={};var _0x56cf47;var _0x3d8435;return db[_0x1463('0x28')]['findOne']({'where':{'id':_0x574ef9[_0x1463('0x3f')]['id']}})['then'](handleEntityNotFound(_0x344257,null))['then'](function(_0xa93d7f){if(_0xa93d7f){_0x56cf47=_0xa93d7f;_0x2c7a69[_0x1463('0x2b')]=_[_0x1463('0x2d')](db[_0x1463('0x5d')][_0x1463('0x29')]);_0x2c7a69['query']=_[_0x1463('0x2d')](_0x574ef9[_0x1463('0x2c')]);_0x2c7a69['filters']=_[_0x1463('0x2e')](_0x2c7a69['model'],_0x2c7a69['query']);_0x1667f6['attributes']=_['intersection'](_0x2c7a69[_0x1463('0x2b')],qs[_0x1463('0x30')](_0x574ef9['query'][_0x1463('0x30')]));_0x1667f6[_0x1463('0x2f')]=_0x1667f6['attributes']['length']?_0x1667f6[_0x1463('0x2f')]:_0x2c7a69['model'];_0x1667f6['order']=qs[_0x1463('0x33')](_0x574ef9[_0x1463('0x2c')][_0x1463('0x33')]);_0x1667f6[_0x1463('0x34')]=qs[_0x1463('0x35')](_[_0x1463('0x36')](_0x574ef9['query'],_0x2c7a69[_0x1463('0x35')]));if(_0x574ef9['query'][_0x1463('0x37')]){_0x1667f6['where']=_[_0x1463('0x38')](_0x1667f6[_0x1463('0x34')],{'$or':_[_0x1463('0x27')](_0x1667f6['attributes'],function(_0x18ec73){var _0x1210a8={};_0x1210a8[_0x18ec73]={'$like':'%'+_0x574ef9['query'][_0x1463('0x37')]+'%'};return _0x1210a8;})});}_0x1667f6=_[_0x1463('0x38')]({},_0x1667f6,_0x574ef9[_0x1463('0x3a')]);return _0x56cf47[_0x1463('0x5c')](_0x1667f6);}})[_0x1463('0x22')](function(_0x59ea49){if(_0x59ea49){_0x3d8435=_0x59ea49[_0x1463('0x31')];if(!_0x574ef9[_0x1463('0x2c')][_0x1463('0x51')]('nolimit')){_0x1667f6['limit']=qs['limit'](_0x574ef9[_0x1463('0x2c')]['limit']);_0x1667f6['offset']=qs[_0x1463('0x17')](_0x574ef9[_0x1463('0x2c')][_0x1463('0x17')]);}return _0x56cf47[_0x1463('0x5c')](_0x1667f6);}})[_0x1463('0x22')](function(_0x3b9047){if(_0x3b9047){return _0x3b9047?{'count':_0x3d8435,'rows':_0x3b9047}:null;}})[_0x1463('0x22')](respondWithResult(_0x344257,null))[_0x1463('0x3e')](handleError(_0x344257,null));};exports[_0x1463('0x5e')]=function(_0x1b5d43,_0x47accd,_0x1af33c){var _0x2fd505,_0x1dd3e2;var _0x5c60df=[];var _0x555104=moment()[_0x1463('0x5f')](_0x1463('0x60'));return db[_0x1463('0x28')]['find']({'where':{'id':_0x1b5d43[_0x1463('0x3f')]['id']}})[_0x1463('0x22')](handleEntityNotFound(_0x47accd,null))[_0x1463('0x22')](function(_0x6a1c0c){if(_0x6a1c0c){_0x1dd3e2=_0x6a1c0c;return _0x6a1c0c[_0x1463('0x5e')](_0x1b5d43['body']['ids'],_['omit'](_0x1b5d43['body'],[_0x1463('0x61'),'id'])||{});}return null;})[_0x1463('0x62')](function(_0x5f3e63){var _0x151a0f;var _0x558875;_0x2fd505=_0x5f3e63||[];var _0x706271=[];if(_0x5f3e63){for(var _0x56e94e=0x0;_0x56e94e<_0x5f3e63[_0x1463('0x31')];_0x56e94e+=0x1){var _0x52d6ba=_0x5f3e63[_0x56e94e][_0x1463('0x45')]({'plain':!![]});_0x1dd3e2[_0x1463('0x63')]=_0x1b5d43['body'][_0x1463('0x63')]?_0x1b5d43[_0x1463('0x42')][_0x1463('0x63')]:_0x1dd3e2['dialCheckDuplicateType'];switch(_0x1dd3e2['dialCheckDuplicateType']){case'always':_0x151a0f=squel[_0x1463('0x64')]()['into'](_0x1463('0x65'))[_0x1463('0x66')]([_0x1463('0x67'),_0x1463('0x68'),_0x1463('0x69'),_0x1463('0x6a'),_0x1463('0x52'),_0x1463('0x6b'),'updatedAt'],squel[_0x1463('0x6c')]()['field'](_0x1463('0x67'),_0x1463('0x67'))[_0x1463('0x6d')]('NOW()','scheduledAt')[_0x1463('0x6d')]('id','ContactId')['field'](_0x52d6ba['CmListId']['toString'](),_0x1463('0x6a'))[_0x1463('0x6d')](_0x1b5d43[_0x1463('0x3f')]['id']['toString'](),_0x1463('0x52'))[_0x1463('0x6d')]('\x27'+_0x555104+'\x27','createdAt')[_0x1463('0x6d')]('\x27'+_0x555104+'\x27',_0x1463('0x4c'))[_0x1463('0x6e')]('cm_contacts')[_0x1463('0x34')](_0x1463('0x6f'))[_0x1463('0x34')]('ListId\x20=\x20?',_0x52d6ba[_0x1463('0x70')][_0x1463('0x71')]())[_0x1463('0x34')]('phone\x20IS\x20NOT\x20NULL')[_0x1463('0x34')](_0x1463('0x72'),squel[_0x1463('0x6c')]()['field']('COALESCE(calleridnum,\x27\x27)')[_0x1463('0x6e')](_0x1463('0x73'))[_0x1463('0x34')](_0x1463('0x74'),_0x1b5d43[_0x1463('0x3f')]['id'][_0x1463('0x71')]()))['where'](_0x1463('0x72'),squel[_0x1463('0x6c')]()[_0x1463('0x6d')](_0x1463('0x75'))[_0x1463('0x6e')]('cm_hopper')[_0x1463('0x34')](_0x1463('0x74'),_0x1b5d43[_0x1463('0x3f')]['id']['toString']())))[_0x1463('0x71')]();break;case _0x1463('0x76'):_0x151a0f=squel[_0x1463('0x64')]()[_0x1463('0x77')]('cm_hopper')['fromQuery']([_0x1463('0x67'),_0x1463('0x68'),_0x1463('0x69'),_0x1463('0x6a'),_0x1463('0x52'),'createdAt',_0x1463('0x4c')],squel[_0x1463('0x6c')]()[_0x1463('0x6d')](_0x1463('0x67'),_0x1463('0x67'))['field'](_0x1463('0x78'),_0x1463('0x68'))['field']('id',_0x1463('0x69'))[_0x1463('0x6d')](_0x52d6ba[_0x1463('0x70')]['toString'](),'ListId')[_0x1463('0x6d')](_0x1b5d43[_0x1463('0x3f')]['id']['toString'](),_0x1463('0x52'))['field']('\x27'+_0x555104+'\x27',_0x1463('0x6b'))[_0x1463('0x6d')]('\x27'+_0x555104+'\x27',_0x1463('0x4c'))[_0x1463('0x6e')](_0x1463('0x79'))['where'](_0x1463('0x6f'))[_0x1463('0x34')](_0x1463('0x7a'),_0x52d6ba['CmListId']['toString']())[_0x1463('0x34')](_0x1463('0x7b'))[_0x1463('0x34')](_0x1463('0x72'),squel[_0x1463('0x6c')]()[_0x1463('0x6d')](_0x1463('0x75'))[_0x1463('0x6e')](_0x1463('0x65'))[_0x1463('0x34')](_0x1463('0x74'),_0x1b5d43[_0x1463('0x3f')]['id'][_0x1463('0x71')]())))['toString']();break;default:_0x151a0f=squel[_0x1463('0x64')]()['into'](_0x1463('0x65'))[_0x1463('0x66')]([_0x1463('0x67'),'scheduledAt',_0x1463('0x69'),'ListId','CampaignId',_0x1463('0x6b'),'updatedAt'],squel[_0x1463('0x6c')]()[_0x1463('0x6d')](_0x1463('0x67'),_0x1463('0x67'))['field'](_0x1463('0x78'),_0x1463('0x68'))[_0x1463('0x6d')]('id',_0x1463('0x69'))[_0x1463('0x6d')](_0x52d6ba[_0x1463('0x70')][_0x1463('0x71')](),'ListId')[_0x1463('0x6d')](_0x1b5d43[_0x1463('0x3f')]['id'][_0x1463('0x71')](),_0x1463('0x52'))[_0x1463('0x6d')]('\x27'+_0x555104+'\x27',_0x1463('0x6b'))['field']('\x27'+_0x555104+'\x27',_0x1463('0x4c'))[_0x1463('0x6e')](_0x1463('0x79'))['where'](_0x1463('0x6f'))[_0x1463('0x34')](_0x1463('0x7a'),_0x52d6ba[_0x1463('0x70')][_0x1463('0x71')]())[_0x1463('0x34')](_0x1463('0x7b')))[_0x1463('0x71')]();}_0x558875=squel['insert']()[_0x1463('0x77')](_0x1463('0x7c'))['fromQuery']([_0x1463('0x7d'),'scheduledAt',_0x1463('0x67'),_0x1463('0x7e'),'createdAt',_0x1463('0x4c')],squel[_0x1463('0x6c')]()[_0x1463('0x6d')]('h.id','id')[_0x1463('0x6d')](_0x1463('0x78'),_0x1463('0x68'))[_0x1463('0x6d')]('ci.item',_0x1463('0x67'))[_0x1463('0x6d')]('ci.OrderBY','OrderBy')[_0x1463('0x6d')]('\x27'+_0x555104+'\x27','createdAt')[_0x1463('0x6d')]('\x27'+_0x555104+'\x27','updatedAt')[_0x1463('0x6e')](_0x1463('0x7f'),'ci')[_0x1463('0x80')]('cm_hopper','h','h.ContactId\x20=\x20ci.CmContactId')['where'](_0x1463('0x81'),_0x52d6ba[_0x1463('0x70')][_0x1463('0x71')]())['where'](_0x1463('0x82'),_0x1b5d43['params']['id'][_0x1463('0x71')]())[_0x1463('0x34')](_0x1463('0x83'),_0x555104))[_0x1463('0x71')]();_0x706271[_0x1463('0x84')](db[_0x1463('0x85')]['query'](_0x151a0f));_0x5c60df[_0x1463('0x84')](db[_0x1463('0x85')][_0x1463('0x2c')](_0x558875));}return BPromise[_0x1463('0x86')](_0x706271);}})[_0x1463('0x22')](function(){return BPromise[_0x1463('0x86')](_0x5c60df);})['then'](function(){return _0x2fd505;})[_0x1463('0x22')](respondWithResult(_0x47accd,null))['catch'](handleError(_0x47accd,null));};exports[_0x1463('0x87')]=function(_0x1090b0,_0x5b9281,_0x56a75f){return db['Campaign'][_0x1463('0x40')]({'where':{'id':_0x1090b0[_0x1463('0x3f')]['id']}})[_0x1463('0x22')](handleEntityNotFound(_0x5b9281,null))[_0x1463('0x22')](function(_0x3455a2){if(_0x3455a2){return _0x3455a2['removeLists'](_0x1090b0[_0x1463('0x2c')][_0x1463('0x61')]);}})[_0x1463('0x22')](function(_0x24746d){if(_0x24746d){return db[_0x1463('0x53')][_0x1463('0x21')]({'where':{'ListId':_0x1090b0[_0x1463('0x2c')][_0x1463('0x61')],'CampaignId':_0x1090b0[_0x1463('0x3f')]['id']}})[_0x1463('0x22')](function(){return _0x24746d;});}})[_0x1463('0x22')](respondWithStatusCode(_0x5b9281,null))['catch'](handleError(_0x5b9281,null));};exports['getBlackLists']=function(_0x14f1a8,_0x15acad,_0x46777a){var _0x4369d6={};var _0x5e8cec={};var _0x29f238;var _0xb424f1;return db[_0x1463('0x28')][_0x1463('0x50')]({'where':{'id':_0x14f1a8[_0x1463('0x3f')]['id']}})[_0x1463('0x22')](handleEntityNotFound(_0x15acad,null))[_0x1463('0x22')](function(_0x570661){if(_0x570661){_0x29f238=_0x570661;_0x5e8cec[_0x1463('0x2b')]=_[_0x1463('0x2d')](db[_0x1463('0x5d')][_0x1463('0x29')]);_0x5e8cec[_0x1463('0x2c')]=_[_0x1463('0x2d')](_0x14f1a8[_0x1463('0x2c')]);_0x5e8cec['filters']=_[_0x1463('0x2e')](_0x5e8cec['model'],_0x5e8cec[_0x1463('0x2c')]);_0x4369d6[_0x1463('0x2f')]=_[_0x1463('0x2e')](_0x5e8cec[_0x1463('0x2b')],qs[_0x1463('0x30')](_0x14f1a8[_0x1463('0x2c')][_0x1463('0x30')]));_0x4369d6[_0x1463('0x2f')]=_0x4369d6[_0x1463('0x2f')][_0x1463('0x31')]?_0x4369d6['attributes']:_0x5e8cec['model'];_0x4369d6[_0x1463('0x32')]=qs['sort'](_0x14f1a8[_0x1463('0x2c')][_0x1463('0x33')]);_0x4369d6[_0x1463('0x34')]=qs['filters'](_['pick'](_0x14f1a8[_0x1463('0x2c')],_0x5e8cec[_0x1463('0x35')]));if(_0x14f1a8[_0x1463('0x2c')][_0x1463('0x37')]){_0x4369d6[_0x1463('0x34')]=_[_0x1463('0x38')](_0x4369d6[_0x1463('0x34')],{'$or':_[_0x1463('0x27')](_0x4369d6['attributes'],function(_0x9eb97e){var _0x21e5f9={};_0x21e5f9[_0x9eb97e]={'$like':'%'+_0x14f1a8['query'][_0x1463('0x37')]+'%'};return _0x21e5f9;})});}_0x4369d6=_[_0x1463('0x38')]({},_0x4369d6,_0x14f1a8[_0x1463('0x3a')]);return _0x29f238[_0x1463('0x88')](_0x4369d6);}})['then'](function(_0x31adcd){if(_0x31adcd){_0xb424f1=_0x31adcd[_0x1463('0x31')];if(!_0x14f1a8[_0x1463('0x2c')][_0x1463('0x51')](_0x1463('0x58'))){_0x4369d6['limit']=qs['limit'](_0x14f1a8['query'][_0x1463('0x19')]);_0x4369d6[_0x1463('0x17')]=qs[_0x1463('0x17')](_0x14f1a8[_0x1463('0x2c')]['offset']);}return _0x29f238['getBlackLists'](_0x4369d6);}})['then'](function(_0x49233f){if(_0x49233f){return _0x49233f?{'count':_0xb424f1,'rows':_0x49233f}:null;}})[_0x1463('0x22')](respondWithResult(_0x15acad,null))[_0x1463('0x3e')](handleError(_0x15acad,null));};exports['addBlackLists']=function(_0x49000e,_0x3628c3,_0xe20133){var _0x349544,_0x2ee4df;var _0x4e8f5e=[];var _0x44888a=moment()[_0x1463('0x5f')](_0x1463('0x60'));return db[_0x1463('0x28')]['find']({'where':{'id':_0x49000e[_0x1463('0x3f')]['id']}})[_0x1463('0x22')](handleEntityNotFound(_0x3628c3,null))[_0x1463('0x22')](function(_0x4c9c1e){if(_0x4c9c1e){_0x2ee4df=_0x4c9c1e;return _0x4c9c1e[_0x1463('0x89')](_0x49000e[_0x1463('0x42')][_0x1463('0x61')],_[_0x1463('0x4b')](_0x49000e[_0x1463('0x42')],[_0x1463('0x61'),'id'])||{});}return null;})[_0x1463('0x62')](function(_0x585fc7){var _0x15223f;var _0x1353f5;_0x349544=_0x585fc7||[];var _0x34066a=[];if(_0x585fc7){for(var _0x583272=0x0;_0x583272<_0x585fc7[_0x1463('0x31')];_0x583272+=0x1){var _0x579130=_0x585fc7[_0x583272][_0x1463('0x45')]({'plain':!![]});_0x15223f=squel['insert']()[_0x1463('0x77')]('cm_hopper_black')[_0x1463('0x66')]([_0x1463('0x67'),_0x1463('0x69'),_0x1463('0x6a'),_0x1463('0x52'),_0x1463('0x6b'),_0x1463('0x4c')],squel[_0x1463('0x6c')]()['field'](_0x1463('0x67'),_0x1463('0x67'))[_0x1463('0x6d')]('id',_0x1463('0x69'))['field'](_0x579130['CmListId'][_0x1463('0x71')](),_0x1463('0x6a'))[_0x1463('0x6d')](_0x49000e[_0x1463('0x3f')]['id'][_0x1463('0x71')](),_0x1463('0x52'))[_0x1463('0x6d')](_0x1463('0x78'),'createdAt')[_0x1463('0x6d')](_0x1463('0x78'),_0x1463('0x4c'))['from'](_0x1463('0x79'))[_0x1463('0x34')](_0x1463('0x6f'))['where']('ListId\x20=\x20?',_0x579130[_0x1463('0x70')][_0x1463('0x71')]())[_0x1463('0x34')](_0x1463('0x7b')))[_0x1463('0x71')]();_0x34066a[_0x1463('0x84')](db[_0x1463('0x85')][_0x1463('0x2c')](_0x15223f));}return BPromise[_0x1463('0x86')](_0x34066a);}})[_0x1463('0x22')](function(){return _0x349544;})[_0x1463('0x22')](respondWithResult(_0x3628c3,null))['catch'](handleError(_0x3628c3,null));};exports[_0x1463('0x8a')]=function(_0x4d0ca4,_0x598e80,_0x3d07a9){return db['Campaign'][_0x1463('0x40')]({'where':{'id':_0x4d0ca4[_0x1463('0x3f')]['id']}})[_0x1463('0x22')](handleEntityNotFound(_0x598e80,null))['then'](function(_0x151a9f){if(_0x151a9f){return _0x151a9f['removeBlackLists'](_0x4d0ca4['query'][_0x1463('0x61')]);}})[_0x1463('0x22')](function(_0x113c67){if(_0x113c67){return db[_0x1463('0x5b')][_0x1463('0x21')]({'where':{'ListId':_0x4d0ca4[_0x1463('0x2c')][_0x1463('0x61')],'CampaignId':_0x4d0ca4[_0x1463('0x3f')]['id']}})[_0x1463('0x22')](function(){return _0x113c67;});}})[_0x1463('0x22')](respondWithStatusCode(_0x598e80,null))[_0x1463('0x3e')](handleError(_0x598e80,null));}; \ No newline at end of file +var _0x6b72=['jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','destroy','get','IvrCampaigns','UserProfileResource','error','name','send','index','Campaign','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','where','pick','filter','merge','options','include','findAll','rows','catch','params','keys','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','createdAt','updatedAt','body','getHoppers','findOne','CmHopper','nolimit','order','CampaignId','CmHopperHistory','sort','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','ids','omit','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','field','NOW()','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x373531,_0x4646bf){var _0x3d07ff=function(_0x1e68f5){while(--_0x1e68f5){_0x373531['push'](_0x373531['shift']());}};_0x3d07ff(++_0x4646bf);}(_0x6b72,0x19d));var _0x26b7=function(_0x22f2bf,_0xd36df4){_0x22f2bf=_0x22f2bf-0x0;var _0x45fcd8=_0x6b72[_0x22f2bf];return _0x45fcd8;};'use strict';var emlformat=require(_0x26b7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x26b7('0x1'));var jsonpatch=require(_0x26b7('0x2'));var rp=require('request-promise');var moment=require(_0x26b7('0x3'));var BPromise=require(_0x26b7('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x26b7('0x5'));var sox=require(_0x26b7('0x6'));var csv=require(_0x26b7('0x7'));var ejs=require(_0x26b7('0x8'));var fs=require('fs');var fs_extra=require(_0x26b7('0x9'));var _=require(_0x26b7('0xa'));var squel=require(_0x26b7('0xb'));var crypto=require(_0x26b7('0xc'));var jsforce=require(_0x26b7('0xd'));var deskjs=require(_0x26b7('0xe'));var toCsv=require(_0x26b7('0x7'));var querystring=require('querystring');var Papa=require(_0x26b7('0xf'));var Redis=require(_0x26b7('0x10'));var authService=require(_0x26b7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x26b7('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x26b7('0x13'))('api');var utils=require(_0x26b7('0x14'));var config=require(_0x26b7('0x15'));var licenseUtil=require(_0x26b7('0x16'));var db=require(_0x26b7('0x17'))['db'];function respondWithStatusCode(_0x5dc52a,_0x2d1fd1){_0x2d1fd1=_0x2d1fd1||0xcc;return function(_0x3def02){if(_0x3def02){return _0x5dc52a[_0x26b7('0x18')](_0x2d1fd1);}return _0x5dc52a[_0x26b7('0x19')](_0x2d1fd1)[_0x26b7('0x1a')]();};}function respondWithResult(_0x1caaa0,_0x33b34d){_0x33b34d=_0x33b34d||0xc8;return function(_0xf54dee){if(_0xf54dee){return _0x1caaa0[_0x26b7('0x19')](_0x33b34d)[_0x26b7('0x1b')](_0xf54dee);}};}function respondWithFilteredResult(_0x57cae7,_0x3304b1){return function(_0x42f377){if(_0x42f377){var _0x1ed5c0=typeof _0x3304b1[_0x26b7('0x1c')]==='undefined'&&typeof _0x3304b1[_0x26b7('0x1d')]===_0x26b7('0x1e');var _0xb34693=_0x42f377[_0x26b7('0x1f')];var _0x3529b5=_0x1ed5c0?0x0:_0x3304b1['offset'];var _0x2876d9=_0x1ed5c0?_0x42f377[_0x26b7('0x1f')]:_0x3304b1[_0x26b7('0x1c')]+_0x3304b1['limit'];var _0x51edda;if(_0x2876d9>=_0xb34693){_0x2876d9=_0xb34693;_0x51edda=0xc8;}else{_0x51edda=0xce;}_0x57cae7[_0x26b7('0x19')](_0x51edda);return _0x57cae7[_0x26b7('0x20')](_0x26b7('0x21'),_0x3529b5+'-'+_0x2876d9+'/'+_0xb34693)[_0x26b7('0x1b')](_0x42f377);}return null;};}function patchUpdates(_0x58f987){return function(_0x97e10d){try{jsonpatch[_0x26b7('0x22')](_0x97e10d,_0x58f987,!![]);}catch(_0x539a73){return BPromise['reject'](_0x539a73);}return _0x97e10d['save']();};}function saveUpdates(_0x515609,_0x30c116){return function(_0x9327dd){if(_0x9327dd){return _0x9327dd[_0x26b7('0x23')](_0x515609)[_0x26b7('0x24')](function(_0x4b8b23){return _0x4b8b23;});}return null;};}function removeEntity(_0x545109,_0x499eb9){return function(_0x105036){if(_0x105036){return _0x105036[_0x26b7('0x25')]()[_0x26b7('0x24')](function(){var _0x2f751b=_0x105036[_0x26b7('0x26')]({'plain':!![]});var _0x3bc867=_0x26b7('0x27');return db[_0x26b7('0x28')][_0x26b7('0x25')]({'where':{'type':_0x3bc867,'resourceId':_0x2f751b['id']}})['then'](function(){return _0x105036;});})['then'](function(){_0x545109[_0x26b7('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e5b0f,_0x203e0f){return function(_0x172760){if(!_0x172760){_0x1e5b0f[_0x26b7('0x18')](0x194);}return _0x172760;};}function handleError(_0x2c2618,_0x39b567){_0x39b567=_0x39b567||0x1f4;return function(_0x1fbfe1){logger[_0x26b7('0x29')](_0x1fbfe1['stack']);if(_0x1fbfe1['name']){delete _0x1fbfe1[_0x26b7('0x2a')];}_0x2c2618[_0x26b7('0x19')](_0x39b567)[_0x26b7('0x2b')](_0x1fbfe1);};}exports[_0x26b7('0x2c')]=function(_0x4305ff,_0x2ce45c){var _0x2edc29={},_0x100954={},_0x3ded9b={'count':0x0,'rows':[]};var _0x555669=_['map'](db[_0x26b7('0x2d')][_0x26b7('0x2e')],function(_0x5f0335){return{'name':_0x5f0335[_0x26b7('0x2f')],'type':_0x5f0335[_0x26b7('0x30')][_0x26b7('0x31')]};});_0x100954[_0x26b7('0x32')]=_[_0x26b7('0x33')](_0x555669,_0x26b7('0x2a'));_0x100954['query']=_['keys'](_0x4305ff[_0x26b7('0x34')]);_0x100954[_0x26b7('0x35')]=_[_0x26b7('0x36')](_0x100954['model'],_0x100954[_0x26b7('0x34')]);_0x2edc29[_0x26b7('0x37')]=_[_0x26b7('0x36')](_0x100954[_0x26b7('0x32')],qs[_0x26b7('0x38')](_0x4305ff[_0x26b7('0x34')][_0x26b7('0x38')]));_0x2edc29[_0x26b7('0x37')]=_0x2edc29[_0x26b7('0x37')][_0x26b7('0x39')]?_0x2edc29[_0x26b7('0x37')]:_0x100954['model'];if(!_0x4305ff['query'][_0x26b7('0x3a')]('nolimit')){_0x2edc29['limit']=qs[_0x26b7('0x1d')](_0x4305ff[_0x26b7('0x34')][_0x26b7('0x1d')]);_0x2edc29['offset']=qs[_0x26b7('0x1c')](_0x4305ff[_0x26b7('0x34')]['offset']);}_0x2edc29['order']=qs['sort'](_0x4305ff[_0x26b7('0x34')]['sort']);_0x2edc29[_0x26b7('0x3b')]=qs[_0x26b7('0x35')](_[_0x26b7('0x3c')](_0x4305ff[_0x26b7('0x34')],_0x100954[_0x26b7('0x35')]),_0x555669);if(_0x4305ff['query'][_0x26b7('0x3d')]){_0x2edc29[_0x26b7('0x3b')]=_[_0x26b7('0x3e')](_0x2edc29['where'],{'$or':_['map'](_0x555669,function(_0x23ed73){if(_0x23ed73[_0x26b7('0x30')]!=='VIRTUAL'){var _0x14f3a6={};_0x14f3a6[_0x23ed73[_0x26b7('0x2a')]]={'$like':'%'+_0x4305ff[_0x26b7('0x34')][_0x26b7('0x3d')]+'%'};return _0x14f3a6;}})});}_0x2edc29=_[_0x26b7('0x3e')]({},_0x2edc29,_0x4305ff[_0x26b7('0x3f')]);var _0x2c5689={'where':_0x2edc29[_0x26b7('0x3b')]};return db[_0x26b7('0x2d')][_0x26b7('0x1f')](_0x2c5689)[_0x26b7('0x24')](function(_0x32433b){_0x3ded9b[_0x26b7('0x1f')]=_0x32433b;if(_0x4305ff[_0x26b7('0x34')]['includeAll']){_0x2edc29[_0x26b7('0x40')]=[{'all':!![]}];}return db[_0x26b7('0x2d')][_0x26b7('0x41')](_0x2edc29);})[_0x26b7('0x24')](function(_0xa5ee4b){_0x3ded9b[_0x26b7('0x42')]=_0xa5ee4b;return _0x3ded9b;})[_0x26b7('0x24')](respondWithFilteredResult(_0x2ce45c,_0x2edc29))[_0x26b7('0x43')](handleError(_0x2ce45c,null));};exports['show']=function(_0x361c0d,_0x59fd4d){var _0x5f3891={'raw':![],'where':{'id':_0x361c0d[_0x26b7('0x44')]['id']}},_0xa98580={};_0xa98580[_0x26b7('0x32')]=_[_0x26b7('0x45')](db['Campaign'][_0x26b7('0x2e')]);_0xa98580['query']=_['keys'](_0x361c0d['query']);_0xa98580[_0x26b7('0x35')]=_[_0x26b7('0x36')](_0xa98580[_0x26b7('0x32')],_0xa98580[_0x26b7('0x34')]);_0x5f3891[_0x26b7('0x37')]=_[_0x26b7('0x36')](_0xa98580[_0x26b7('0x32')],qs[_0x26b7('0x38')](_0x361c0d[_0x26b7('0x34')]['fields']));_0x5f3891['attributes']=_0x5f3891['attributes'][_0x26b7('0x39')]?_0x5f3891['attributes']:_0xa98580[_0x26b7('0x32')];if(_0x361c0d['query']['includeAll']){_0x5f3891[_0x26b7('0x40')]=[{'all':!![]}];}_0x5f3891=_[_0x26b7('0x3e')]({},_0x5f3891,_0x361c0d[_0x26b7('0x3f')]);return db[_0x26b7('0x2d')][_0x26b7('0x46')](_0x5f3891)[_0x26b7('0x24')](handleEntityNotFound(_0x59fd4d,null))[_0x26b7('0x24')](respondWithResult(_0x59fd4d,null))['catch'](handleError(_0x59fd4d,null));};exports[_0x26b7('0x47')]=function(_0x17747b,_0x255d4c){return db[_0x26b7('0x2d')][_0x26b7('0x47')](_0x17747b['body'],{})[_0x26b7('0x24')](function(_0x46bc98){var _0x5989d2=_0x17747b['user'][_0x26b7('0x26')]({'plain':!![]});if(!_0x5989d2)throw new Error(_0x26b7('0x48'));if(_0x5989d2[_0x26b7('0x49')]===_0x26b7('0x4a')){var _0x1ae010=_0x46bc98[_0x26b7('0x26')]({'plain':!![]});var _0x493a6a='IvrCampaigns';return db[_0x26b7('0x4b')][_0x26b7('0x46')]({'where':{'name':_0x493a6a,'userProfileId':_0x5989d2[_0x26b7('0x4c')]},'raw':!![]})[_0x26b7('0x24')](function(_0x2962ec){if(_0x2962ec&&_0x2962ec[_0x26b7('0x4d')]===0x0){return db[_0x26b7('0x28')]['create']({'name':_0x1ae010[_0x26b7('0x2a')],'resourceId':_0x1ae010['id'],'type':_0x2962ec[_0x26b7('0x2a')],'sectionId':_0x2962ec['id']},{})[_0x26b7('0x24')](function(){return _0x46bc98;});}else{return _0x46bc98;}})[_0x26b7('0x43')](function(_0x5ba4fa){logger[_0x26b7('0x29')](_0x26b7('0x4e'),_0x5ba4fa);throw _0x5ba4fa;});}return _0x46bc98;})[_0x26b7('0x24')](respondWithResult(_0x255d4c,0xc9))[_0x26b7('0x43')](handleError(_0x255d4c,null));};exports[_0x26b7('0x4f')]=function(_0x4e74d9,_0x1c3ff9){var _0x15628b={'where':{'id':_0x4e74d9[_0x26b7('0x44')]['id']}},_0x2b7b0e={};_0x2b7b0e[_0x26b7('0x32')]=_[_0x26b7('0x45')](db[_0x26b7('0x2d')][_0x26b7('0x2e')]);_0x15628b[_0x26b7('0x37')]=_[_0x26b7('0x36')](_0x2b7b0e[_0x26b7('0x32')],qs[_0x26b7('0x38')](_0x4e74d9[_0x26b7('0x34')][_0x26b7('0x38')]));_0x15628b['attributes']=_0x15628b[_0x26b7('0x37')][_0x26b7('0x39')]?_0x15628b[_0x26b7('0x37')]:_0x2b7b0e[_0x26b7('0x32')];if(_0x4e74d9['query'][_0x26b7('0x50')]){_0x15628b[_0x26b7('0x40')]=[{'all':!![]}];}_0x15628b=_['merge']({},_0x15628b,_0x4e74d9[_0x26b7('0x3f')]);return db[_0x26b7('0x2d')][_0x26b7('0x46')](_0x15628b)[_0x26b7('0x24')](handleEntityNotFound(_0x1c3ff9,null))[_0x26b7('0x24')](function(_0x222469){if(_0x222469){var _0x955d79=_0x222469[_0x26b7('0x26')]({'plain':!![]});_0x955d79=qs['omit'](_0x955d79,['id',_0x26b7('0x51'),_0x26b7('0x52')]);_0x4e74d9[_0x26b7('0x53')]=_['omit'](_0x4e74d9[_0x26b7('0x53')],['id',_0x26b7('0x51'),_0x26b7('0x52')]);return db['Campaign'][_0x26b7('0x47')](_[_0x26b7('0x3e')](_0x955d79,_0x4e74d9[_0x26b7('0x53')]),{'include':_0x4e74d9[_0x26b7('0x34')][_0x26b7('0x50')]?[{'all':!![]}]:undefined})[_0x26b7('0x24')](function(_0x1f89d2){var _0x32457e=_0x4e74d9['user']['get']({'plain':!![]});if(!_0x32457e)throw new Error(_0x26b7('0x48'));if(_0x32457e[_0x26b7('0x49')]==='user'){var _0x351d0b=_0x1f89d2[_0x26b7('0x26')]({'plain':!![]});var _0xfa7259=_0x26b7('0x27');return db[_0x26b7('0x4b')][_0x26b7('0x46')]({'where':{'name':_0xfa7259,'userProfileId':_0x32457e[_0x26b7('0x4c')]},'raw':!![]})['then'](function(_0x1deda6){if(_0x1deda6&&_0x1deda6[_0x26b7('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x351d0b[_0x26b7('0x2a')],'resourceId':_0x351d0b['id'],'type':_0x1deda6[_0x26b7('0x2a')],'sectionId':_0x1deda6['id']},{})[_0x26b7('0x24')](function(){return _0x1f89d2;});}else{return _0x1f89d2;}})[_0x26b7('0x43')](function(_0x35c9bf){logger[_0x26b7('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x35c9bf);throw _0x35c9bf;});}return _0x1f89d2;});}})[_0x26b7('0x24')](respondWithResult(_0x1c3ff9,0xc9))[_0x26b7('0x43')](handleError(_0x1c3ff9,null));};exports['update']=function(_0x4f5b9f,_0x366320){if(_0x4f5b9f[_0x26b7('0x53')]['id']){delete _0x4f5b9f[_0x26b7('0x53')]['id'];}return db[_0x26b7('0x2d')][_0x26b7('0x46')]({'where':{'id':_0x4f5b9f[_0x26b7('0x44')]['id']}})['then'](handleEntityNotFound(_0x366320,null))['then'](saveUpdates(_0x4f5b9f['body'],null))[_0x26b7('0x24')](respondWithResult(_0x366320,null))[_0x26b7('0x43')](handleError(_0x366320,null));};exports[_0x26b7('0x25')]=function(_0x958c74,_0x2fd84f){return db[_0x26b7('0x2d')][_0x26b7('0x46')]({'where':{'id':_0x958c74[_0x26b7('0x44')]['id']}})[_0x26b7('0x24')](handleEntityNotFound(_0x2fd84f,null))['then'](removeEntity(_0x2fd84f,null))[_0x26b7('0x43')](handleError(_0x2fd84f,null));};exports[_0x26b7('0x54')]=function(_0x9a7cab,_0x57b493,_0x37017c){var _0x49ef55={'raw':!![],'where':{}};var _0x237895={};var _0x1b219c={'count':0x0,'rows':[]};return db[_0x26b7('0x2d')][_0x26b7('0x55')]({'where':{'id':_0x9a7cab['params']['id']}})[_0x26b7('0x24')](handleEntityNotFound(_0x57b493,null))[_0x26b7('0x24')](function(_0x47d12a){if(_0x47d12a){_0x237895[_0x26b7('0x32')]=_[_0x26b7('0x45')](db[_0x26b7('0x56')]['rawAttributes']);_0x237895[_0x26b7('0x34')]=_[_0x26b7('0x45')](_0x9a7cab[_0x26b7('0x34')]);_0x237895[_0x26b7('0x35')]=_[_0x26b7('0x36')](_0x237895[_0x26b7('0x32')],_0x237895[_0x26b7('0x34')]);_0x49ef55[_0x26b7('0x37')]=_[_0x26b7('0x36')](_0x237895['model'],qs[_0x26b7('0x38')](_0x9a7cab[_0x26b7('0x34')]['fields']));_0x49ef55[_0x26b7('0x37')]=_0x49ef55[_0x26b7('0x37')][_0x26b7('0x39')]?_0x49ef55[_0x26b7('0x37')]:_0x237895[_0x26b7('0x32')];if(!_0x9a7cab[_0x26b7('0x34')][_0x26b7('0x3a')](_0x26b7('0x57'))){_0x49ef55[_0x26b7('0x1d')]=qs[_0x26b7('0x1d')](_0x9a7cab['query'][_0x26b7('0x1d')]);_0x49ef55['offset']=qs[_0x26b7('0x1c')](_0x9a7cab[_0x26b7('0x34')][_0x26b7('0x1c')]);}_0x49ef55[_0x26b7('0x58')]=qs['sort'](_0x9a7cab[_0x26b7('0x34')]['sort']);_0x49ef55[_0x26b7('0x3b')]=qs[_0x26b7('0x35')](_[_0x26b7('0x3c')](_0x9a7cab[_0x26b7('0x34')],_0x237895['filters']));_0x49ef55[_0x26b7('0x3b')][_0x26b7('0x59')]=_0x47d12a['id'];if(_0x9a7cab[_0x26b7('0x34')]['filter']){_0x49ef55[_0x26b7('0x3b')]=_[_0x26b7('0x3e')](_0x49ef55[_0x26b7('0x3b')],{'$or':_[_0x26b7('0x33')](_0x49ef55[_0x26b7('0x37')],function(_0x2fc262){var _0x5b360f={};_0x5b360f[_0x2fc262]={'$like':'%'+_0x9a7cab[_0x26b7('0x34')]['filter']+'%'};return _0x5b360f;})});}_0x49ef55=_['merge']({},_0x49ef55,_0x9a7cab[_0x26b7('0x3f')]);return db[_0x26b7('0x56')][_0x26b7('0x1f')]({'where':_0x49ef55['where']})[_0x26b7('0x24')](function(_0x389b56){_0x1b219c['count']=_0x389b56;if(_0x9a7cab[_0x26b7('0x34')]['includeAll']){_0x49ef55[_0x26b7('0x40')]=[{'all':!![]}];}return db['CmHopper'][_0x26b7('0x41')](_0x49ef55);})[_0x26b7('0x24')](function(_0x5a6578){_0x1b219c[_0x26b7('0x42')]=_0x5a6578;return _0x1b219c;});}})[_0x26b7('0x24')](respondWithFilteredResult(_0x57b493,_0x49ef55))[_0x26b7('0x43')](handleError(_0x57b493,null));};exports['getHopperHistories']=function(_0xc4bbce,_0x23a231,_0x2361fa){var _0x5325a0={'raw':!![],'where':{}};var _0x4c8117={};var _0x51b384={'count':0x0,'rows':[]};return db[_0x26b7('0x2d')][_0x26b7('0x55')]({'where':{'id':_0xc4bbce[_0x26b7('0x44')]['id']}})[_0x26b7('0x24')](handleEntityNotFound(_0x23a231,null))[_0x26b7('0x24')](function(_0x23643b){if(_0x23643b){_0x4c8117[_0x26b7('0x32')]=_[_0x26b7('0x45')](db[_0x26b7('0x5a')][_0x26b7('0x2e')]);_0x4c8117[_0x26b7('0x34')]=_[_0x26b7('0x45')](_0xc4bbce[_0x26b7('0x34')]);_0x4c8117[_0x26b7('0x35')]=_[_0x26b7('0x36')](_0x4c8117[_0x26b7('0x32')],_0x4c8117[_0x26b7('0x34')]);_0x5325a0[_0x26b7('0x37')]=_[_0x26b7('0x36')](_0x4c8117[_0x26b7('0x32')],qs[_0x26b7('0x38')](_0xc4bbce['query'][_0x26b7('0x38')]));_0x5325a0[_0x26b7('0x37')]=_0x5325a0[_0x26b7('0x37')]['length']?_0x5325a0[_0x26b7('0x37')]:_0x4c8117[_0x26b7('0x32')];if(!_0xc4bbce[_0x26b7('0x34')][_0x26b7('0x3a')](_0x26b7('0x57'))){_0x5325a0[_0x26b7('0x1d')]=qs[_0x26b7('0x1d')](_0xc4bbce[_0x26b7('0x34')][_0x26b7('0x1d')]);_0x5325a0['offset']=qs[_0x26b7('0x1c')](_0xc4bbce[_0x26b7('0x34')][_0x26b7('0x1c')]);}_0x5325a0[_0x26b7('0x58')]=qs[_0x26b7('0x5b')](_0xc4bbce[_0x26b7('0x34')][_0x26b7('0x5b')]);_0x5325a0[_0x26b7('0x3b')]=qs[_0x26b7('0x35')](_['pick'](_0xc4bbce[_0x26b7('0x34')],_0x4c8117[_0x26b7('0x35')]));_0x5325a0[_0x26b7('0x3b')][_0x26b7('0x59')]=_0x23643b['id'];if(_0xc4bbce[_0x26b7('0x34')][_0x26b7('0x3d')]){_0x5325a0['where']=_[_0x26b7('0x3e')](_0x5325a0[_0x26b7('0x3b')],{'$or':_[_0x26b7('0x33')](_0x5325a0['attributes'],function(_0x480ef7){var _0x264d4b={};_0x264d4b[_0x480ef7]={'$like':'%'+_0xc4bbce[_0x26b7('0x34')][_0x26b7('0x3d')]+'%'};return _0x264d4b;})});}_0x5325a0=_[_0x26b7('0x3e')]({},_0x5325a0,_0xc4bbce['options']);return db[_0x26b7('0x5a')][_0x26b7('0x1f')]({'where':_0x5325a0[_0x26b7('0x3b')]})[_0x26b7('0x24')](function(_0x2dffed){_0x51b384[_0x26b7('0x1f')]=_0x2dffed;if(_0xc4bbce[_0x26b7('0x34')]['includeAll']){_0x5325a0[_0x26b7('0x40')]=[{'all':!![]}];}return db[_0x26b7('0x5a')][_0x26b7('0x41')](_0x5325a0);})[_0x26b7('0x24')](function(_0x35870e){_0x51b384[_0x26b7('0x42')]=_0x35870e;return _0x51b384;});}})['then'](respondWithFilteredResult(_0x23a231,_0x5325a0))[_0x26b7('0x43')](handleError(_0x23a231,null));};exports['getHopperFinals']=function(_0x15c97a,_0x141975,_0x386810){var _0x2c5806={'raw':!![],'where':{}};var _0x13a9d4={};var _0x5962c9={'count':0x0,'rows':[]};return db[_0x26b7('0x2d')]['findOne']({'where':{'id':_0x15c97a[_0x26b7('0x44')]['id']}})[_0x26b7('0x24')](handleEntityNotFound(_0x141975,null))[_0x26b7('0x24')](function(_0x39fb2f){if(_0x39fb2f){_0x13a9d4[_0x26b7('0x32')]=_[_0x26b7('0x45')](db[_0x26b7('0x5c')][_0x26b7('0x2e')]);_0x13a9d4['query']=_[_0x26b7('0x45')](_0x15c97a[_0x26b7('0x34')]);_0x13a9d4['filters']=_['intersection'](_0x13a9d4[_0x26b7('0x32')],_0x13a9d4[_0x26b7('0x34')]);_0x2c5806['attributes']=_[_0x26b7('0x36')](_0x13a9d4[_0x26b7('0x32')],qs[_0x26b7('0x38')](_0x15c97a[_0x26b7('0x34')][_0x26b7('0x38')]));_0x2c5806['attributes']=_0x2c5806[_0x26b7('0x37')][_0x26b7('0x39')]?_0x2c5806[_0x26b7('0x37')]:_0x13a9d4[_0x26b7('0x32')];if(!_0x15c97a[_0x26b7('0x34')]['hasOwnProperty'](_0x26b7('0x57'))){_0x2c5806[_0x26b7('0x1d')]=qs['limit'](_0x15c97a['query'][_0x26b7('0x1d')]);_0x2c5806[_0x26b7('0x1c')]=qs[_0x26b7('0x1c')](_0x15c97a[_0x26b7('0x34')]['offset']);}_0x2c5806[_0x26b7('0x58')]=qs[_0x26b7('0x5b')](_0x15c97a['query'][_0x26b7('0x5b')]);_0x2c5806[_0x26b7('0x3b')]=qs[_0x26b7('0x35')](_[_0x26b7('0x3c')](_0x15c97a['query'],_0x13a9d4[_0x26b7('0x35')]));_0x2c5806[_0x26b7('0x3b')][_0x26b7('0x59')]=_0x39fb2f['id'];if(_0x15c97a['query']['filter']){_0x2c5806[_0x26b7('0x3b')]=_[_0x26b7('0x3e')](_0x2c5806[_0x26b7('0x3b')],{'$or':_[_0x26b7('0x33')](_0x2c5806[_0x26b7('0x37')],function(_0x398c28){var _0x344644={};_0x344644[_0x398c28]={'$like':'%'+_0x15c97a[_0x26b7('0x34')][_0x26b7('0x3d')]+'%'};return _0x344644;})});}_0x2c5806=_[_0x26b7('0x3e')]({},_0x2c5806,_0x15c97a['options']);return db[_0x26b7('0x5c')][_0x26b7('0x1f')]({'where':_0x2c5806['where']})['then'](function(_0x2cd4fe){_0x5962c9['count']=_0x2cd4fe;if(_0x15c97a[_0x26b7('0x34')][_0x26b7('0x50')]){_0x2c5806['include']=[{'all':!![]}];}return db[_0x26b7('0x5c')][_0x26b7('0x41')](_0x2c5806);})['then'](function(_0x33a5fb){_0x5962c9[_0x26b7('0x42')]=_0x33a5fb;return _0x5962c9;});}})['then'](respondWithFilteredResult(_0x141975,_0x2c5806))['catch'](handleError(_0x141975,null));};exports['getHopperBlacks']=function(_0x2ce881,_0x3484e6,_0x275c59){var _0x1c2233={'raw':!![],'where':{}};var _0x462b80={};var _0x3358bc={'count':0x0,'rows':[]};return db[_0x26b7('0x2d')][_0x26b7('0x55')]({'where':{'id':_0x2ce881[_0x26b7('0x44')]['id']}})['then'](handleEntityNotFound(_0x3484e6,null))['then'](function(_0x50abcc){if(_0x50abcc){_0x462b80['model']=_[_0x26b7('0x45')](db[_0x26b7('0x5d')][_0x26b7('0x2e')]);_0x462b80[_0x26b7('0x34')]=_[_0x26b7('0x45')](_0x2ce881[_0x26b7('0x34')]);_0x462b80[_0x26b7('0x35')]=_[_0x26b7('0x36')](_0x462b80[_0x26b7('0x32')],_0x462b80[_0x26b7('0x34')]);_0x1c2233[_0x26b7('0x37')]=_['intersection'](_0x462b80[_0x26b7('0x32')],qs[_0x26b7('0x38')](_0x2ce881[_0x26b7('0x34')][_0x26b7('0x38')]));_0x1c2233['attributes']=_0x1c2233[_0x26b7('0x37')][_0x26b7('0x39')]?_0x1c2233['attributes']:_0x462b80['model'];if(!_0x2ce881[_0x26b7('0x34')]['hasOwnProperty']('nolimit')){_0x1c2233['limit']=qs[_0x26b7('0x1d')](_0x2ce881[_0x26b7('0x34')][_0x26b7('0x1d')]);_0x1c2233['offset']=qs[_0x26b7('0x1c')](_0x2ce881[_0x26b7('0x34')][_0x26b7('0x1c')]);}_0x1c2233['order']=qs['sort'](_0x2ce881[_0x26b7('0x34')][_0x26b7('0x5b')]);_0x1c2233['where']=qs[_0x26b7('0x35')](_[_0x26b7('0x3c')](_0x2ce881[_0x26b7('0x34')],_0x462b80['filters']));_0x1c2233[_0x26b7('0x3b')][_0x26b7('0x59')]=_0x50abcc['id'];if(_0x2ce881[_0x26b7('0x34')][_0x26b7('0x3d')]){_0x1c2233[_0x26b7('0x3b')]=_[_0x26b7('0x3e')](_0x1c2233[_0x26b7('0x3b')],{'$or':_[_0x26b7('0x33')](_0x1c2233['attributes'],function(_0x32ef69){var _0xcda633={};_0xcda633[_0x32ef69]={'$like':'%'+_0x2ce881['query'][_0x26b7('0x3d')]+'%'};return _0xcda633;})});}_0x1c2233=_[_0x26b7('0x3e')]({},_0x1c2233,_0x2ce881[_0x26b7('0x3f')]);return db[_0x26b7('0x5d')][_0x26b7('0x1f')]({'where':_0x1c2233[_0x26b7('0x3b')]})[_0x26b7('0x24')](function(_0x2a1e96){_0x3358bc[_0x26b7('0x1f')]=_0x2a1e96;if(_0x2ce881[_0x26b7('0x34')]['includeAll']){_0x1c2233[_0x26b7('0x40')]=[{'all':!![]}];}return db[_0x26b7('0x5d')][_0x26b7('0x41')](_0x1c2233);})['then'](function(_0x26daf7){_0x3358bc[_0x26b7('0x42')]=_0x26daf7;return _0x3358bc;});}})['then'](respondWithFilteredResult(_0x3484e6,_0x1c2233))[_0x26b7('0x43')](handleError(_0x3484e6,null));};exports[_0x26b7('0x5e')]=function(_0x1ebaab,_0x41bf89,_0x24d589){var _0x24152e={};var _0x4a6e57={};var _0x5d47a3;var _0x193a6b;return db[_0x26b7('0x2d')][_0x26b7('0x55')]({'where':{'id':_0x1ebaab[_0x26b7('0x44')]['id']}})['then'](handleEntityNotFound(_0x41bf89,null))[_0x26b7('0x24')](function(_0x1515cb){if(_0x1515cb){_0x5d47a3=_0x1515cb;_0x4a6e57[_0x26b7('0x32')]=_[_0x26b7('0x45')](db[_0x26b7('0x5f')][_0x26b7('0x2e')]);_0x4a6e57['query']=_['keys'](_0x1ebaab[_0x26b7('0x34')]);_0x4a6e57[_0x26b7('0x35')]=_[_0x26b7('0x36')](_0x4a6e57['model'],_0x4a6e57[_0x26b7('0x34')]);_0x24152e['attributes']=_['intersection'](_0x4a6e57[_0x26b7('0x32')],qs[_0x26b7('0x38')](_0x1ebaab[_0x26b7('0x34')][_0x26b7('0x38')]));_0x24152e[_0x26b7('0x37')]=_0x24152e[_0x26b7('0x37')][_0x26b7('0x39')]?_0x24152e[_0x26b7('0x37')]:_0x4a6e57[_0x26b7('0x32')];_0x24152e[_0x26b7('0x58')]=qs[_0x26b7('0x5b')](_0x1ebaab[_0x26b7('0x34')]['sort']);_0x24152e[_0x26b7('0x3b')]=qs[_0x26b7('0x35')](_[_0x26b7('0x3c')](_0x1ebaab[_0x26b7('0x34')],_0x4a6e57[_0x26b7('0x35')]));if(_0x1ebaab['query']['filter']){_0x24152e[_0x26b7('0x3b')]=_[_0x26b7('0x3e')](_0x24152e[_0x26b7('0x3b')],{'$or':_[_0x26b7('0x33')](_0x24152e[_0x26b7('0x37')],function(_0x5cacbf){var _0x483253={};_0x483253[_0x5cacbf]={'$like':'%'+_0x1ebaab['query'][_0x26b7('0x3d')]+'%'};return _0x483253;})});}_0x24152e=_['merge']({},_0x24152e,_0x1ebaab[_0x26b7('0x3f')]);return _0x5d47a3[_0x26b7('0x5e')](_0x24152e);}})[_0x26b7('0x24')](function(_0xf6e528){if(_0xf6e528){_0x193a6b=_0xf6e528[_0x26b7('0x39')];if(!_0x1ebaab['query'][_0x26b7('0x3a')](_0x26b7('0x57'))){_0x24152e['limit']=qs[_0x26b7('0x1d')](_0x1ebaab[_0x26b7('0x34')][_0x26b7('0x1d')]);_0x24152e['offset']=qs[_0x26b7('0x1c')](_0x1ebaab[_0x26b7('0x34')][_0x26b7('0x1c')]);}return _0x5d47a3[_0x26b7('0x5e')](_0x24152e);}})[_0x26b7('0x24')](function(_0x39efde){if(_0x39efde){return _0x39efde?{'count':_0x193a6b,'rows':_0x39efde}:null;}})[_0x26b7('0x24')](respondWithResult(_0x41bf89,null))[_0x26b7('0x43')](handleError(_0x41bf89,null));};exports[_0x26b7('0x60')]=function(_0x40f458,_0x59490a,_0x4ee8e3){var _0x679e55,_0x2a6507;var _0x1ea053=[];var _0x47e0ff=moment()['format'](_0x26b7('0x61'));return db[_0x26b7('0x2d')][_0x26b7('0x46')]({'where':{'id':_0x40f458[_0x26b7('0x44')]['id']}})[_0x26b7('0x24')](handleEntityNotFound(_0x59490a,null))[_0x26b7('0x24')](function(_0x33b8d5){if(_0x33b8d5){_0x2a6507=_0x33b8d5;return _0x33b8d5[_0x26b7('0x60')](_0x40f458[_0x26b7('0x53')][_0x26b7('0x62')],_[_0x26b7('0x63')](_0x40f458[_0x26b7('0x53')],['ids','id'])||{});}return null;})[_0x26b7('0x64')](function(_0x4a3933){var _0x387ee1;var _0xf4e734;_0x679e55=_0x4a3933||[];var _0x1c3996=[];if(_0x4a3933){for(var _0x370afe=0x0;_0x370afe<_0x4a3933[_0x26b7('0x39')];_0x370afe+=0x1){var _0x4aed50=_0x4a3933[_0x370afe][_0x26b7('0x26')]({'plain':!![]});_0x2a6507[_0x26b7('0x65')]=_0x40f458[_0x26b7('0x53')]['dialCheckDuplicateType']?_0x40f458[_0x26b7('0x53')][_0x26b7('0x65')]:_0x2a6507[_0x26b7('0x65')];switch(_0x2a6507[_0x26b7('0x65')]){case'always':_0x387ee1=squel[_0x26b7('0x66')]()[_0x26b7('0x67')](_0x26b7('0x68'))[_0x26b7('0x69')]([_0x26b7('0x6a'),_0x26b7('0x6b'),_0x26b7('0x6c'),_0x26b7('0x6d'),_0x26b7('0x59'),'createdAt','updatedAt'],squel['select']()['field'](_0x26b7('0x6a'),'phone')[_0x26b7('0x6e')](_0x26b7('0x6f'),_0x26b7('0x6b'))[_0x26b7('0x6e')]('id',_0x26b7('0x6c'))[_0x26b7('0x6e')](_0x4aed50['CmListId'][_0x26b7('0x70')](),_0x26b7('0x6d'))['field'](_0x40f458[_0x26b7('0x44')]['id']['toString'](),_0x26b7('0x59'))[_0x26b7('0x6e')]('\x27'+_0x47e0ff+'\x27',_0x26b7('0x51'))[_0x26b7('0x6e')]('\x27'+_0x47e0ff+'\x27',_0x26b7('0x52'))[_0x26b7('0x71')](_0x26b7('0x72'))[_0x26b7('0x3b')](_0x26b7('0x73'))['where'](_0x26b7('0x74'),_0x4aed50[_0x26b7('0x75')][_0x26b7('0x70')]())[_0x26b7('0x3b')](_0x26b7('0x76'))['where'](_0x26b7('0x77'),squel[_0x26b7('0x78')]()['field']('COALESCE(calleridnum,\x27\x27)')[_0x26b7('0x71')](_0x26b7('0x79'))[_0x26b7('0x3b')](_0x26b7('0x7a'),_0x40f458[_0x26b7('0x44')]['id']['toString']()))[_0x26b7('0x3b')](_0x26b7('0x77'),squel[_0x26b7('0x78')]()['field'](_0x26b7('0x7b'))[_0x26b7('0x71')]('cm_hopper')[_0x26b7('0x3b')]('CampaignId\x20=\x20?',_0x40f458[_0x26b7('0x44')]['id'][_0x26b7('0x70')]())))[_0x26b7('0x70')]();break;case _0x26b7('0x7c'):_0x387ee1=squel[_0x26b7('0x66')]()[_0x26b7('0x67')](_0x26b7('0x68'))['fromQuery']([_0x26b7('0x6a'),_0x26b7('0x6b'),_0x26b7('0x6c'),_0x26b7('0x6d'),'CampaignId',_0x26b7('0x51'),'updatedAt'],squel[_0x26b7('0x78')]()[_0x26b7('0x6e')]('phone',_0x26b7('0x6a'))[_0x26b7('0x6e')](_0x26b7('0x6f'),'scheduledAt')['field']('id','ContactId')['field'](_0x4aed50[_0x26b7('0x75')]['toString'](),_0x26b7('0x6d'))[_0x26b7('0x6e')](_0x40f458[_0x26b7('0x44')]['id'][_0x26b7('0x70')](),_0x26b7('0x59'))[_0x26b7('0x6e')]('\x27'+_0x47e0ff+'\x27',_0x26b7('0x51'))['field']('\x27'+_0x47e0ff+'\x27',_0x26b7('0x52'))['from']('cm_contacts')['where'](_0x26b7('0x73'))['where'](_0x26b7('0x74'),_0x4aed50[_0x26b7('0x75')][_0x26b7('0x70')]())['where'](_0x26b7('0x76'))['where'](_0x26b7('0x77'),squel['select']()['field']('COALESCE(phone,\x27\x27)')[_0x26b7('0x71')](_0x26b7('0x68'))[_0x26b7('0x3b')](_0x26b7('0x7a'),_0x40f458[_0x26b7('0x44')]['id'][_0x26b7('0x70')]())))['toString']();break;default:_0x387ee1=squel['insert']()[_0x26b7('0x67')](_0x26b7('0x68'))['fromQuery']([_0x26b7('0x6a'),_0x26b7('0x6b'),_0x26b7('0x6c'),_0x26b7('0x6d'),_0x26b7('0x59'),_0x26b7('0x51'),_0x26b7('0x52')],squel['select']()[_0x26b7('0x6e')](_0x26b7('0x6a'),_0x26b7('0x6a'))[_0x26b7('0x6e')](_0x26b7('0x6f'),_0x26b7('0x6b'))['field']('id',_0x26b7('0x6c'))[_0x26b7('0x6e')](_0x4aed50[_0x26b7('0x75')][_0x26b7('0x70')](),_0x26b7('0x6d'))[_0x26b7('0x6e')](_0x40f458[_0x26b7('0x44')]['id'][_0x26b7('0x70')](),'CampaignId')[_0x26b7('0x6e')]('\x27'+_0x47e0ff+'\x27',_0x26b7('0x51'))[_0x26b7('0x6e')]('\x27'+_0x47e0ff+'\x27',_0x26b7('0x52'))[_0x26b7('0x71')](_0x26b7('0x72'))[_0x26b7('0x3b')](_0x26b7('0x73'))[_0x26b7('0x3b')](_0x26b7('0x74'),_0x4aed50[_0x26b7('0x75')][_0x26b7('0x70')]())[_0x26b7('0x3b')](_0x26b7('0x76')))['toString']();}_0xf4e734=squel[_0x26b7('0x66')]()[_0x26b7('0x67')](_0x26b7('0x7d'))[_0x26b7('0x69')]([_0x26b7('0x7e'),'scheduledAt',_0x26b7('0x6a'),_0x26b7('0x7f'),_0x26b7('0x51'),_0x26b7('0x52')],squel['select']()[_0x26b7('0x6e')](_0x26b7('0x80'),'id')[_0x26b7('0x6e')]('NOW()',_0x26b7('0x6b'))[_0x26b7('0x6e')](_0x26b7('0x81'),'phone')[_0x26b7('0x6e')](_0x26b7('0x82'),_0x26b7('0x7f'))[_0x26b7('0x6e')]('\x27'+_0x47e0ff+'\x27',_0x26b7('0x51'))[_0x26b7('0x6e')]('\x27'+_0x47e0ff+'\x27',_0x26b7('0x52'))[_0x26b7('0x71')](_0x26b7('0x83'),'ci')['join'](_0x26b7('0x68'),'h',_0x26b7('0x84'))[_0x26b7('0x3b')](_0x26b7('0x85'),_0x4aed50[_0x26b7('0x75')][_0x26b7('0x70')]())[_0x26b7('0x3b')]('h.CampaignId=?',_0x40f458['params']['id'][_0x26b7('0x70')]())[_0x26b7('0x3b')]('h.createdAt\x20=\x20?',_0x47e0ff))['toString']();_0x1c3996[_0x26b7('0x86')](db['sequelize'][_0x26b7('0x34')](_0x387ee1));_0x1ea053[_0x26b7('0x86')](db[_0x26b7('0x87')][_0x26b7('0x34')](_0xf4e734));}return BPromise[_0x26b7('0x88')](_0x1c3996);}})['then'](function(){return BPromise[_0x26b7('0x88')](_0x1ea053);})[_0x26b7('0x24')](function(){return _0x679e55;})[_0x26b7('0x24')](respondWithResult(_0x59490a,null))[_0x26b7('0x43')](handleError(_0x59490a,null));};exports[_0x26b7('0x89')]=function(_0x5af56e,_0x5d552a,_0x2808f9){return db[_0x26b7('0x2d')][_0x26b7('0x46')]({'where':{'id':_0x5af56e[_0x26b7('0x44')]['id']}})['then'](handleEntityNotFound(_0x5d552a,null))['then'](function(_0x53b2cb){if(_0x53b2cb){return _0x53b2cb[_0x26b7('0x89')](_0x5af56e[_0x26b7('0x34')][_0x26b7('0x62')]);}})[_0x26b7('0x24')](function(_0x36d8c2){if(_0x36d8c2){return db[_0x26b7('0x56')][_0x26b7('0x25')]({'where':{'ListId':_0x5af56e[_0x26b7('0x34')][_0x26b7('0x62')],'CampaignId':_0x5af56e[_0x26b7('0x44')]['id']}})[_0x26b7('0x24')](function(){return _0x36d8c2;});}})[_0x26b7('0x24')](respondWithStatusCode(_0x5d552a,null))[_0x26b7('0x43')](handleError(_0x5d552a,null));};exports[_0x26b7('0x8a')]=function(_0x57f6ba,_0x52c677,_0x2be56c){var _0x1cc563={};var _0x2914e5={};var _0x3df24a;var _0x47f95d;return db[_0x26b7('0x2d')][_0x26b7('0x55')]({'where':{'id':_0x57f6ba['params']['id']}})['then'](handleEntityNotFound(_0x52c677,null))['then'](function(_0x174c82){if(_0x174c82){_0x3df24a=_0x174c82;_0x2914e5['model']=_[_0x26b7('0x45')](db[_0x26b7('0x5f')][_0x26b7('0x2e')]);_0x2914e5[_0x26b7('0x34')]=_['keys'](_0x57f6ba[_0x26b7('0x34')]);_0x2914e5['filters']=_[_0x26b7('0x36')](_0x2914e5['model'],_0x2914e5[_0x26b7('0x34')]);_0x1cc563[_0x26b7('0x37')]=_[_0x26b7('0x36')](_0x2914e5[_0x26b7('0x32')],qs[_0x26b7('0x38')](_0x57f6ba['query'][_0x26b7('0x38')]));_0x1cc563[_0x26b7('0x37')]=_0x1cc563[_0x26b7('0x37')][_0x26b7('0x39')]?_0x1cc563[_0x26b7('0x37')]:_0x2914e5['model'];_0x1cc563['order']=qs['sort'](_0x57f6ba[_0x26b7('0x34')]['sort']);_0x1cc563[_0x26b7('0x3b')]=qs[_0x26b7('0x35')](_['pick'](_0x57f6ba[_0x26b7('0x34')],_0x2914e5[_0x26b7('0x35')]));if(_0x57f6ba[_0x26b7('0x34')][_0x26b7('0x3d')]){_0x1cc563['where']=_[_0x26b7('0x3e')](_0x1cc563[_0x26b7('0x3b')],{'$or':_['map'](_0x1cc563[_0x26b7('0x37')],function(_0x2540c0){var _0x320a7a={};_0x320a7a[_0x2540c0]={'$like':'%'+_0x57f6ba[_0x26b7('0x34')][_0x26b7('0x3d')]+'%'};return _0x320a7a;})});}_0x1cc563=_[_0x26b7('0x3e')]({},_0x1cc563,_0x57f6ba['options']);return _0x3df24a['getBlackLists'](_0x1cc563);}})[_0x26b7('0x24')](function(_0x5a779a){if(_0x5a779a){_0x47f95d=_0x5a779a[_0x26b7('0x39')];if(!_0x57f6ba['query']['hasOwnProperty'](_0x26b7('0x57'))){_0x1cc563[_0x26b7('0x1d')]=qs['limit'](_0x57f6ba[_0x26b7('0x34')]['limit']);_0x1cc563['offset']=qs['offset'](_0x57f6ba[_0x26b7('0x34')]['offset']);}return _0x3df24a[_0x26b7('0x8a')](_0x1cc563);}})[_0x26b7('0x24')](function(_0x438e5e){if(_0x438e5e){return _0x438e5e?{'count':_0x47f95d,'rows':_0x438e5e}:null;}})[_0x26b7('0x24')](respondWithResult(_0x52c677,null))[_0x26b7('0x43')](handleError(_0x52c677,null));};exports[_0x26b7('0x8b')]=function(_0xed2705,_0x2ac9cc,_0x584244){var _0x461124,_0x13f4ed;var _0x43b4b2=[];var _0x3bf522=moment()['format'](_0x26b7('0x61'));return db[_0x26b7('0x2d')][_0x26b7('0x46')]({'where':{'id':_0xed2705[_0x26b7('0x44')]['id']}})[_0x26b7('0x24')](handleEntityNotFound(_0x2ac9cc,null))[_0x26b7('0x24')](function(_0x2aa5d7){if(_0x2aa5d7){_0x13f4ed=_0x2aa5d7;return _0x2aa5d7[_0x26b7('0x8b')](_0xed2705[_0x26b7('0x53')][_0x26b7('0x62')],_['omit'](_0xed2705[_0x26b7('0x53')],['ids','id'])||{});}return null;})[_0x26b7('0x64')](function(_0x3cdc7f){var _0x3322cf;var _0x4dd5d0;_0x461124=_0x3cdc7f||[];var _0x109a8d=[];if(_0x3cdc7f){for(var _0x1b2ecc=0x0;_0x1b2ecc<_0x3cdc7f[_0x26b7('0x39')];_0x1b2ecc+=0x1){var _0x5256dd=_0x3cdc7f[_0x1b2ecc][_0x26b7('0x26')]({'plain':!![]});_0x3322cf=squel['insert']()[_0x26b7('0x67')](_0x26b7('0x8c'))[_0x26b7('0x69')]([_0x26b7('0x6a'),_0x26b7('0x6c'),_0x26b7('0x6d'),'CampaignId',_0x26b7('0x51'),_0x26b7('0x52')],squel['select']()[_0x26b7('0x6e')](_0x26b7('0x6a'),_0x26b7('0x6a'))[_0x26b7('0x6e')]('id',_0x26b7('0x6c'))[_0x26b7('0x6e')](_0x5256dd[_0x26b7('0x75')][_0x26b7('0x70')](),'ListId')[_0x26b7('0x6e')](_0xed2705['params']['id'][_0x26b7('0x70')](),_0x26b7('0x59'))['field'](_0x26b7('0x6f'),'createdAt')[_0x26b7('0x6e')](_0x26b7('0x6f'),_0x26b7('0x52'))['from']('cm_contacts')[_0x26b7('0x3b')](_0x26b7('0x73'))[_0x26b7('0x3b')](_0x26b7('0x74'),_0x5256dd[_0x26b7('0x75')]['toString']())[_0x26b7('0x3b')](_0x26b7('0x76')))[_0x26b7('0x70')]();_0x109a8d[_0x26b7('0x86')](db[_0x26b7('0x87')]['query'](_0x3322cf));}return BPromise[_0x26b7('0x88')](_0x109a8d);}})['then'](function(){return _0x461124;})['then'](respondWithResult(_0x2ac9cc,null))[_0x26b7('0x43')](handleError(_0x2ac9cc,null));};exports[_0x26b7('0x8d')]=function(_0x5d8050,_0x4eee67,_0x52f152){return db[_0x26b7('0x2d')][_0x26b7('0x46')]({'where':{'id':_0x5d8050['params']['id']}})['then'](handleEntityNotFound(_0x4eee67,null))[_0x26b7('0x24')](function(_0x551d28){if(_0x551d28){return _0x551d28['removeBlackLists'](_0x5d8050[_0x26b7('0x34')][_0x26b7('0x62')]);}})['then'](function(_0x3edb93){if(_0x3edb93){return db[_0x26b7('0x5d')][_0x26b7('0x25')]({'where':{'ListId':_0x5d8050[_0x26b7('0x34')][_0x26b7('0x62')],'CampaignId':_0x5d8050['params']['id']}})[_0x26b7('0x24')](function(){return _0x3edb93;});}})[_0x26b7('0x24')](respondWithStatusCode(_0x4eee67,null))['catch'](handleError(_0x4eee67,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index ee1642e..59732f4 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(_0x496624,_0x16d7ab){var _0x3c4852=function(_0x457d13){while(--_0x457d13){_0x496624['push'](_0x496624['shift']());}};_0x3c4852(++_0x16d7ab);}(_0x7a54,0x106));var _0x47a5=function(_0x486a06,_0x2aa5bf){_0x486a06=_0x486a06-0x0;var _0x22a6c0=_0x7a54[_0x486a06];return _0x22a6c0;};'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(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'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 4b36525..ee291f5 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 _0xe189=['Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','findAll','options','raw','where','attributes','limit','map','include','model','info','GetCampaign','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xe189,0x194));var _0x9e18=function(_0x4c5c60,_0x3bdf2a){_0x4c5c60=_0x4c5c60-0x0;var _0x1ac59b=_0xe189[_0x4c5c60];return _0x1ac59b;};'use strict';var _=require(_0x9e18('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9e18('0x1'));var rs=require(_0x9e18('0x2'));var fs=require('fs');var Redis=require(_0x9e18('0x3'));var db=require(_0x9e18('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9e18('0x5'));var config=require(_0x9e18('0x6'));var jayson=require(_0x9e18('0x7'));var client=jayson[_0x9e18('0x8')][_0x9e18('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e6097,_0x3153cf,_0x2e4691){return new BPromise(function(_0x4656a4,_0x50a0ce){return client[_0x9e18('0xa')](_0x5e6097,_0x2e4691)[_0x9e18('0xb')](function(_0x33e9cd){logger['info'](_0x9e18('0xc'),_0x3153cf,_0x9e18('0xd'));logger[_0x9e18('0xe')](_0x9e18('0xf'),_0x3153cf,_0x9e18('0xd'),JSON[_0x9e18('0x10')](_0x33e9cd));if(_0x33e9cd[_0x9e18('0x11')]){if(_0x33e9cd[_0x9e18('0x11')][_0x9e18('0x12')]===0x1f4){logger['error'](_0x9e18('0xc'),_0x3153cf,_0x33e9cd['error'][_0x9e18('0x13')]);return _0x50a0ce(_0x33e9cd[_0x9e18('0x11')]['message']);}logger[_0x9e18('0x11')](_0x9e18('0xc'),_0x3153cf,_0x33e9cd[_0x9e18('0x11')][_0x9e18('0x13')]);return _0x4656a4(_0x33e9cd['error'][_0x9e18('0x13')]);}else{logger['info']('Campaign,\x20%s,\x20%s',_0x3153cf,_0x9e18('0xd'));_0x4656a4(_0x33e9cd['result'][_0x9e18('0x13')]);}})[_0x9e18('0x14')](function(_0x1f71fc){logger[_0x9e18('0x11')]('Campaign,\x20%s,\x20%s',_0x3153cf,_0x1f71fc);_0x50a0ce(_0x1f71fc);});});}exports['GetCampaign']=function(_0x15cf20){var _0x446098=this;return new Promise(function(_0x57cd1f,_0x1aa23f){return db['Campaign'][_0x9e18('0x15')]({'raw':_0x15cf20['options']?_0x15cf20[_0x9e18('0x16')][_0x9e18('0x17')]===undefined?!![]:![]:!![],'where':_0x15cf20[_0x9e18('0x16')]?_0x15cf20[_0x9e18('0x16')][_0x9e18('0x18')]||null:null,'attributes':_0x15cf20[_0x9e18('0x16')]?_0x15cf20[_0x9e18('0x16')][_0x9e18('0x19')]||null:null,'limit':_0x15cf20[_0x9e18('0x16')]?_0x15cf20['options'][_0x9e18('0x1a')]||null:null,'include':_0x15cf20[_0x9e18('0x16')]?_0x15cf20[_0x9e18('0x16')]['include']?_[_0x9e18('0x1b')](_0x15cf20['options'][_0x9e18('0x1c')],function(_0x50131d){return{'model':db[_0x50131d[_0x9e18('0x1d')]],'as':_0x50131d['as'],'attributes':_0x50131d['attributes'],'include':_0x50131d[_0x9e18('0x1c')]?_[_0x9e18('0x1b')](_0x50131d['include'],function(_0x12f90d){return{'model':db[_0x12f90d['model']],'as':_0x12f90d['as'],'attributes':_0x12f90d['attributes'],'include':_0x12f90d[_0x9e18('0x1c')]?_['map'](_0x12f90d[_0x9e18('0x1c')],function(_0x49a3d6){return{'model':db[_0x49a3d6[_0x9e18('0x1d')]],'as':_0x49a3d6['as'],'attributes':_0x49a3d6[_0x9e18('0x19')]};}):[]};}):[]};}):[]:[]})[_0x9e18('0xb')](function(_0xd115f3){logger[_0x9e18('0x1e')](_0x9e18('0x1f'),_0x15cf20);logger[_0x9e18('0xe')](_0x9e18('0x1f'),_0x15cf20,JSON[_0x9e18('0x10')](_0xd115f3));_0x57cd1f(_0xd115f3);})['catch'](function(_0x2ee4da){logger[_0x9e18('0x11')](_0x9e18('0x1f'),_0x2ee4da[_0x9e18('0x13')],_0x15cf20);_0x1aa23f(_0x446098['error'](0x1f4,_0x2ee4da['message']));});});}; \ No newline at end of file +var _0xc524=['message','info','result','catch','GetCampaign','Campaign','options','raw','where','attributes','limit','include','model','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc524,0x1bf));var _0x4c52=function(_0x56d2e9,_0x22fe0a){_0x56d2e9=_0x56d2e9-0x0;var _0x32d662=_0xc524[_0x56d2e9];return _0x32d662;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4c52('0x0'));var BPromise=require(_0x4c52('0x1'));var rs=require(_0x4c52('0x2'));var fs=require('fs');var Redis=require(_0x4c52('0x3'));var db=require(_0x4c52('0x4'))['db'];var utils=require(_0x4c52('0x5'));var logger=require(_0x4c52('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4c52('0x7'));var client=jayson[_0x4c52('0x8')][_0x4c52('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4756e3,_0x5378d3,_0x4ea85e){return new BPromise(function(_0x39591b,_0x212216){return client['request'](_0x4756e3,_0x4ea85e)[_0x4c52('0xa')](function(_0x231cda){logger['info'](_0x4c52('0xb'),_0x5378d3,_0x4c52('0xc'));logger[_0x4c52('0xd')](_0x4c52('0xe'),_0x5378d3,_0x4c52('0xc'),JSON[_0x4c52('0xf')](_0x231cda));if(_0x231cda[_0x4c52('0x10')]){if(_0x231cda[_0x4c52('0x10')][_0x4c52('0x11')]===0x1f4){logger['error'](_0x4c52('0xb'),_0x5378d3,_0x231cda[_0x4c52('0x10')][_0x4c52('0x12')]);return _0x212216(_0x231cda['error']['message']);}logger[_0x4c52('0x10')]('Campaign,\x20%s,\x20%s',_0x5378d3,_0x231cda[_0x4c52('0x10')][_0x4c52('0x12')]);return _0x39591b(_0x231cda['error'][_0x4c52('0x12')]);}else{logger[_0x4c52('0x13')](_0x4c52('0xb'),_0x5378d3,_0x4c52('0xc'));_0x39591b(_0x231cda[_0x4c52('0x14')][_0x4c52('0x12')]);}})[_0x4c52('0x15')](function(_0x1dabe0){logger[_0x4c52('0x10')](_0x4c52('0xb'),_0x5378d3,_0x1dabe0);_0x212216(_0x1dabe0);});});}exports[_0x4c52('0x16')]=function(_0x1f036c){var _0x35cffb=this;return new Promise(function(_0x2a498c,_0x146c35){return db[_0x4c52('0x17')]['findAll']({'raw':_0x1f036c[_0x4c52('0x18')]?_0x1f036c[_0x4c52('0x18')][_0x4c52('0x19')]===undefined?!![]:![]:!![],'where':_0x1f036c[_0x4c52('0x18')]?_0x1f036c[_0x4c52('0x18')][_0x4c52('0x1a')]||null:null,'attributes':_0x1f036c[_0x4c52('0x18')]?_0x1f036c[_0x4c52('0x18')][_0x4c52('0x1b')]||null:null,'limit':_0x1f036c[_0x4c52('0x18')]?_0x1f036c[_0x4c52('0x18')][_0x4c52('0x1c')]||null:null,'include':_0x1f036c[_0x4c52('0x18')]?_0x1f036c[_0x4c52('0x18')]['include']?_['map'](_0x1f036c[_0x4c52('0x18')][_0x4c52('0x1d')],function(_0x13cf34){return{'model':db[_0x13cf34[_0x4c52('0x1e')]],'as':_0x13cf34['as'],'attributes':_0x13cf34[_0x4c52('0x1b')],'include':_0x13cf34[_0x4c52('0x1d')]?_['map'](_0x13cf34[_0x4c52('0x1d')],function(_0x19e4b9){return{'model':db[_0x19e4b9['model']],'as':_0x19e4b9['as'],'attributes':_0x19e4b9[_0x4c52('0x1b')],'include':_0x19e4b9[_0x4c52('0x1d')]?_['map'](_0x19e4b9[_0x4c52('0x1d')],function(_0x2385a9){return{'model':db[_0x2385a9[_0x4c52('0x1e')]],'as':_0x2385a9['as'],'attributes':_0x2385a9['attributes']};}):[]};}):[]};}):[]:[]})[_0x4c52('0xa')](function(_0x3500aa){logger[_0x4c52('0x13')](_0x4c52('0x16'),_0x1f036c);logger[_0x4c52('0xd')](_0x4c52('0x16'),_0x1f036c,JSON[_0x4c52('0xf')](_0x3500aa));_0x2a498c(_0x3500aa);})[_0x4c52('0x15')](function(_0x74eae1){logger[_0x4c52('0x10')]('GetCampaign',_0x74eae1[_0x4c52('0x12')],_0x1f036c);_0x146c35(_0x35cffb[_0x4c52('0x10')](0x1f4,_0x74eae1[_0x4c52('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 609a268..bc73e7c 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 _0x0830=['index','show','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','getLists','getBlackLists','post','/:id/clone','/:id/lists','addBlackLists','put','/:id','destroy','delete','removeLists','removeBlackLists','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x228184,_0x2a1c7a){var _0x4f2235=function(_0xff995){while(--_0xff995){_0x228184['push'](_0x228184['shift']());}};_0x4f2235(++_0x2a1c7a);}(_0x0830,0xd0));var _0x0083=function(_0x51ece4,_0x39165c){_0x51ece4=_0x51ece4-0x0;var _0x2b7e27=_0x0830[_0x51ece4];return _0x2b7e27;};'use strict';var multer=require(_0x0083('0x0'));var util=require(_0x0083('0x1'));var path=require('path');var timeout=require(_0x0083('0x2'));var express=require('express');var router=express[_0x0083('0x3')]();var fs_extra=require(_0x0083('0x4'));var auth=require(_0x0083('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0083('0x6'));var controller=require('./campaign.controller');router[_0x0083('0x7')]('/',auth[_0x0083('0x8')](),controller[_0x0083('0x9')]);router[_0x0083('0x7')]('/:id',auth[_0x0083('0x8')](),controller[_0x0083('0xa')]);router[_0x0083('0x7')]('/:id/hoppers',auth[_0x0083('0x8')](),controller[_0x0083('0xb')]);router[_0x0083('0x7')](_0x0083('0xc'),auth[_0x0083('0x8')](),controller[_0x0083('0xd')]);router['get'](_0x0083('0xe'),auth[_0x0083('0x8')](),controller[_0x0083('0xf')]);router[_0x0083('0x7')](_0x0083('0x10'),auth[_0x0083('0x8')](),controller[_0x0083('0x11')]);router['get']('/:id/lists',auth[_0x0083('0x8')](),controller[_0x0083('0x12')]);router[_0x0083('0x7')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x0083('0x13')]);router['post']('/',auth[_0x0083('0x8')](),controller['create']);router[_0x0083('0x14')](_0x0083('0x15'),auth['isAuthenticated'](),controller['clone']);router['post'](_0x0083('0x16'),auth[_0x0083('0x8')](),controller['addLists']);router['post']('/:id/blacklists',auth[_0x0083('0x8')](),controller[_0x0083('0x17')]);router[_0x0083('0x18')](_0x0083('0x19'),auth[_0x0083('0x8')](),controller['update']);router['delete'](_0x0083('0x19'),auth[_0x0083('0x8')](),controller[_0x0083('0x1a')]);router[_0x0083('0x1b')]('/:id/lists',auth[_0x0083('0x8')](),controller[_0x0083('0x1c')]);router[_0x0083('0x1b')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x0083('0x1d')]);module[_0x0083('0x1e')]=router; \ No newline at end of file +var _0xb2e1=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','getBlackLists','post','create','/:id/clone','clone','addLists','/:id/blacklists','put','/:id','update','destroy','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout'];(function(_0x273600,_0x19a8d1){var _0x431a0c=function(_0x382628){while(--_0x382628){_0x273600['push'](_0x273600['shift']());}};_0x431a0c(++_0x19a8d1);}(_0xb2e1,0xd4));var _0x1b2e=function(_0x42c56b,_0x58ae76){_0x42c56b=_0x42c56b-0x0;var _0x13f59d=_0xb2e1[_0x42c56b];return _0x13f59d;};'use strict';var multer=require(_0x1b2e('0x0'));var util=require(_0x1b2e('0x1'));var path=require(_0x1b2e('0x2'));var timeout=require(_0x1b2e('0x3'));var express=require(_0x1b2e('0x4'));var router=express[_0x1b2e('0x5')]();var fs_extra=require(_0x1b2e('0x6'));var auth=require(_0x1b2e('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x1b2e('0x8'));var controller=require('./campaign.controller');router[_0x1b2e('0x9')]('/',auth[_0x1b2e('0xa')](),controller[_0x1b2e('0xb')]);router[_0x1b2e('0x9')]('/:id',auth[_0x1b2e('0xa')](),controller[_0x1b2e('0xc')]);router[_0x1b2e('0x9')](_0x1b2e('0xd'),auth['isAuthenticated'](),controller[_0x1b2e('0xe')]);router[_0x1b2e('0x9')](_0x1b2e('0xf'),auth[_0x1b2e('0xa')](),controller[_0x1b2e('0x10')]);router[_0x1b2e('0x9')](_0x1b2e('0x11'),auth[_0x1b2e('0xa')](),controller['getHopperFinals']);router[_0x1b2e('0x9')](_0x1b2e('0x12'),auth['isAuthenticated'](),controller[_0x1b2e('0x13')]);router[_0x1b2e('0x9')](_0x1b2e('0x14'),auth[_0x1b2e('0xa')](),controller[_0x1b2e('0x15')]);router[_0x1b2e('0x9')]('/:id/blacklists',auth[_0x1b2e('0xa')](),controller[_0x1b2e('0x16')]);router[_0x1b2e('0x17')]('/',auth[_0x1b2e('0xa')](),controller[_0x1b2e('0x18')]);router[_0x1b2e('0x17')](_0x1b2e('0x19'),auth['isAuthenticated'](),controller[_0x1b2e('0x1a')]);router[_0x1b2e('0x17')]('/:id/lists',auth[_0x1b2e('0xa')](),controller[_0x1b2e('0x1b')]);router[_0x1b2e('0x17')](_0x1b2e('0x1c'),auth[_0x1b2e('0xa')](),controller['addBlackLists']);router[_0x1b2e('0x1d')](_0x1b2e('0x1e'),auth[_0x1b2e('0xa')](),controller[_0x1b2e('0x1f')]);router['delete'](_0x1b2e('0x1e'),auth[_0x1b2e('0xa')](),controller[_0x1b2e('0x20')]);router['delete'](_0x1b2e('0x14'),auth[_0x1b2e('0xa')](),controller[_0x1b2e('0x21')]);router['delete']('/:id/blacklists',auth['isAuthenticated'](),controller[_0x1b2e('0x22')]);module[_0x1b2e('0x23')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index b936874..40652a5 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 _0xa5ac=['exports','STRING','TEXT','VIRTUAL','key','sequelize'];(function(_0x38eb22,_0x458a8c){var _0x49553e=function(_0x2879fd){while(--_0x2879fd){_0x38eb22['push'](_0x38eb22['shift']());}};_0x49553e(++_0x458a8c);}(_0xa5ac,0x83));var _0xca5a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5ac[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xca5a('0x0'));module[_0xca5a('0x1')]={'key':{'type':Sequelize[_0xca5a('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xca5a('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0xca5a('0x2')]},'name':{'type':Sequelize[_0xca5a('0x4')],'get':function(){return this['getDataValue'](_0xca5a('0x5'));}}}; \ No newline at end of file +var _0x0231=['STRING','TEXT','VIRTUAL','key','sequelize','exports'];(function(_0x533132,_0xf5b6fa){var _0x1a7447=function(_0x44d580){while(--_0x44d580){_0x533132['push'](_0x533132['shift']());}};_0x1a7447(++_0xf5b6fa);}(_0x0231,0xf4));var _0x1023=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x0231[_0x110c3d];return _0x226d67;};'use strict';var Sequelize=require(_0x1023('0x0'));module[_0x1023('0x1')]={'key':{'type':Sequelize[_0x1023('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x1023('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x1023('0x2')]},'name':{'type':Sequelize[_0x1023('0x4')],'get':function(){return this['getDataValue'](_0x1023('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index ffa1af8..70889e1 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 _0xedd3=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','get','UserProfileResource','then','end','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','CannedAnswer','includeAll','include','rows','catch','show','params','find','body','destroy','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0x54f952,_0x376d41){var _0x2c8d08=function(_0x1e9a2c){while(--_0x1e9a2c){_0x54f952['push'](_0x54f952['shift']());}};_0x2c8d08(++_0x376d41);}(_0xedd3,0x1b4));var _0x3edd=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0xedd3[_0x2dea24];return _0x309d58;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3edd('0x0'));var zipdir=require(_0x3edd('0x1'));var jsonpatch=require(_0x3edd('0x2'));var rp=require(_0x3edd('0x3'));var moment=require('moment');var BPromise=require(_0x3edd('0x4'));var Mustache=require(_0x3edd('0x5'));var util=require(_0x3edd('0x6'));var path=require(_0x3edd('0x7'));var sox=require(_0x3edd('0x8'));var csv=require(_0x3edd('0x9'));var ejs=require(_0x3edd('0xa'));var fs=require('fs');var fs_extra=require(_0x3edd('0xb'));var _=require(_0x3edd('0xc'));var squel=require(_0x3edd('0xd'));var crypto=require(_0x3edd('0xe'));var jsforce=require(_0x3edd('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3edd('0x9'));var querystring=require(_0x3edd('0x10'));var Papa=require(_0x3edd('0x11'));var Redis=require(_0x3edd('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3edd('0x13'));var hardwareService=require(_0x3edd('0x14'));var logger=require('../../config/logger')(_0x3edd('0x15'));var utils=require(_0x3edd('0x16'));var config=require(_0x3edd('0x17'));var licenseUtil=require(_0x3edd('0x18'));var db=require(_0x3edd('0x19'))['db'];function respondWithStatusCode(_0x4ce713,_0x26cb2a){_0x26cb2a=_0x26cb2a||0xcc;return function(_0x327169){if(_0x327169){return _0x4ce713[_0x3edd('0x1a')](_0x26cb2a);}return _0x4ce713[_0x3edd('0x1b')](_0x26cb2a)['end']();};}function respondWithResult(_0x1ef2a9,_0xfa7e5d){_0xfa7e5d=_0xfa7e5d||0xc8;return function(_0x6520df){if(_0x6520df){return _0x1ef2a9[_0x3edd('0x1b')](_0xfa7e5d)[_0x3edd('0x1c')](_0x6520df);}};}function respondWithFilteredResult(_0xc04ef5,_0x2a7027){return function(_0x3c6d77){if(_0x3c6d77){var _0x2142d8=typeof _0x2a7027[_0x3edd('0x1d')]===_0x3edd('0x1e')&&typeof _0x2a7027[_0x3edd('0x1f')]===_0x3edd('0x1e');var _0x39a023=_0x3c6d77[_0x3edd('0x20')];var _0x4ac360=_0x2142d8?0x0:_0x2a7027[_0x3edd('0x1d')];var _0x3e54d5=_0x2142d8?_0x3c6d77[_0x3edd('0x20')]:_0x2a7027['offset']+_0x2a7027[_0x3edd('0x1f')];var _0x315c67;if(_0x3e54d5>=_0x39a023){_0x3e54d5=_0x39a023;_0x315c67=0xc8;}else{_0x315c67=0xce;}_0xc04ef5['status'](_0x315c67);return _0xc04ef5[_0x3edd('0x21')](_0x3edd('0x22'),_0x4ac360+'-'+_0x3e54d5+'/'+_0x39a023)[_0x3edd('0x1c')](_0x3c6d77);}return null;};}function patchUpdates(_0x4c1541){return function(_0x2b3968){try{jsonpatch[_0x3edd('0x23')](_0x2b3968,_0x4c1541,!![]);}catch(_0x3df59b){return BPromise[_0x3edd('0x24')](_0x3df59b);}return _0x2b3968[_0x3edd('0x25')]();};}function saveUpdates(_0xde169,_0x50ce8c){return function(_0x5e96a6){if(_0x5e96a6){return _0x5e96a6[_0x3edd('0x26')](_0xde169)['then'](function(_0x1dda77){return _0x1dda77;});}return null;};}function removeEntity(_0x5a60cc,_0x40bd9f){return function(_0x3bdad5){if(_0x3bdad5){return _0x3bdad5['destroy']()['then'](function(){var _0x1dffe7=_0x3bdad5[_0x3edd('0x27')]({'plain':!![]});var _0x100f1c='CannedAnswers';return db[_0x3edd('0x28')]['destroy']({'where':{'type':_0x100f1c,'resourceId':_0x1dffe7['id']}})['then'](function(){return _0x3bdad5;});})[_0x3edd('0x29')](function(){_0x5a60cc[_0x3edd('0x1b')](0xcc)[_0x3edd('0x2a')]();});}};}function handleEntityNotFound(_0x5b85ee,_0x2cc914){return function(_0x271414){if(!_0x271414){_0x5b85ee[_0x3edd('0x1a')](0x194);}return _0x271414;};}function handleError(_0x224ab3,_0xe06bce){_0xe06bce=_0xe06bce||0x1f4;return function(_0x14259b){logger[_0x3edd('0x2b')](_0x14259b[_0x3edd('0x2c')]);if(_0x14259b['name']){delete _0x14259b[_0x3edd('0x2d')];}_0x224ab3[_0x3edd('0x1b')](_0xe06bce)['send'](_0x14259b);};}exports[_0x3edd('0x2e')]=function(_0x2d9fd8,_0x186b5a){var _0x44c10d={},_0x28ecf7={},_0x452ce1={'count':0x0,'rows':[]};var _0x56f389=_['map'](db['CannedAnswer'][_0x3edd('0x2f')],function(_0x3cddaa){return{'name':_0x3cddaa[_0x3edd('0x30')],'type':_0x3cddaa[_0x3edd('0x31')][_0x3edd('0x32')]};});_0x28ecf7[_0x3edd('0x33')]=_[_0x3edd('0x34')](_0x56f389,_0x3edd('0x2d'));_0x28ecf7[_0x3edd('0x35')]=_[_0x3edd('0x36')](_0x2d9fd8[_0x3edd('0x35')]);_0x28ecf7[_0x3edd('0x37')]=_[_0x3edd('0x38')](_0x28ecf7[_0x3edd('0x33')],_0x28ecf7['query']);_0x44c10d[_0x3edd('0x39')]=_[_0x3edd('0x38')](_0x28ecf7[_0x3edd('0x33')],qs[_0x3edd('0x3a')](_0x2d9fd8[_0x3edd('0x35')][_0x3edd('0x3a')]));_0x44c10d[_0x3edd('0x39')]=_0x44c10d['attributes'][_0x3edd('0x3b')]?_0x44c10d[_0x3edd('0x39')]:_0x28ecf7[_0x3edd('0x33')];if(!_0x2d9fd8[_0x3edd('0x35')][_0x3edd('0x3c')](_0x3edd('0x3d'))){_0x44c10d[_0x3edd('0x1f')]=qs[_0x3edd('0x1f')](_0x2d9fd8[_0x3edd('0x35')][_0x3edd('0x1f')]);_0x44c10d[_0x3edd('0x1d')]=qs['offset'](_0x2d9fd8[_0x3edd('0x35')]['offset']);}_0x44c10d[_0x3edd('0x3e')]=qs[_0x3edd('0x3f')](_0x2d9fd8[_0x3edd('0x35')][_0x3edd('0x3f')]);_0x44c10d[_0x3edd('0x40')]=qs[_0x3edd('0x37')](_['pick'](_0x2d9fd8[_0x3edd('0x35')],_0x28ecf7[_0x3edd('0x37')]),_0x56f389);if(_0x2d9fd8[_0x3edd('0x35')][_0x3edd('0x41')]){_0x44c10d[_0x3edd('0x40')]=_[_0x3edd('0x42')](_0x44c10d[_0x3edd('0x40')],{'$or':[{'key':{'$like':'%'+_0x2d9fd8[_0x3edd('0x35')][_0x3edd('0x41')]+'%'}},{'value':{'$like':'%'+_0x2d9fd8[_0x3edd('0x35')][_0x3edd('0x41')]+'%'}}]});}_0x44c10d=_['merge']({},_0x44c10d,_0x2d9fd8[_0x3edd('0x43')]);var _0xa6a773={'where':_0x44c10d[_0x3edd('0x40')]};return db[_0x3edd('0x44')][_0x3edd('0x20')](_0xa6a773)['then'](function(_0x8cc41c){_0x452ce1[_0x3edd('0x20')]=_0x8cc41c;if(_0x2d9fd8[_0x3edd('0x35')][_0x3edd('0x45')]){_0x44c10d[_0x3edd('0x46')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x44c10d);})[_0x3edd('0x29')](function(_0x1e6489){_0x452ce1[_0x3edd('0x47')]=_0x1e6489;return _0x452ce1;})[_0x3edd('0x29')](respondWithFilteredResult(_0x186b5a,_0x44c10d))[_0x3edd('0x48')](handleError(_0x186b5a,null));};exports[_0x3edd('0x49')]=function(_0x36add4,_0x208e39){var _0x353239={'raw':!![],'where':{'id':_0x36add4[_0x3edd('0x4a')]['id']}},_0x2bf9dd={};_0x2bf9dd['model']=_[_0x3edd('0x36')](db[_0x3edd('0x44')][_0x3edd('0x2f')]);_0x2bf9dd[_0x3edd('0x35')]=_[_0x3edd('0x36')](_0x36add4[_0x3edd('0x35')]);_0x2bf9dd[_0x3edd('0x37')]=_[_0x3edd('0x38')](_0x2bf9dd['model'],_0x2bf9dd[_0x3edd('0x35')]);_0x353239['attributes']=_['intersection'](_0x2bf9dd['model'],qs[_0x3edd('0x3a')](_0x36add4[_0x3edd('0x35')][_0x3edd('0x3a')]));_0x353239[_0x3edd('0x39')]=_0x353239[_0x3edd('0x39')][_0x3edd('0x3b')]?_0x353239[_0x3edd('0x39')]:_0x2bf9dd[_0x3edd('0x33')];if(_0x36add4['query']['includeAll']){_0x353239[_0x3edd('0x46')]=[{'all':!![]}];}_0x353239=_['merge']({},_0x353239,_0x36add4[_0x3edd('0x43')]);return db[_0x3edd('0x44')][_0x3edd('0x4b')](_0x353239)[_0x3edd('0x29')](handleEntityNotFound(_0x208e39,null))[_0x3edd('0x29')](respondWithResult(_0x208e39,null))[_0x3edd('0x48')](handleError(_0x208e39,null));};exports[_0x3edd('0x26')]=function(_0x29b157,_0x2fec95){if(_0x29b157[_0x3edd('0x4c')]['id']){delete _0x29b157[_0x3edd('0x4c')]['id'];}return db[_0x3edd('0x44')][_0x3edd('0x4b')]({'where':{'id':_0x29b157[_0x3edd('0x4a')]['id']}})[_0x3edd('0x29')](handleEntityNotFound(_0x2fec95,null))[_0x3edd('0x29')](saveUpdates(_0x29b157[_0x3edd('0x4c')],null))[_0x3edd('0x29')](respondWithResult(_0x2fec95,null))[_0x3edd('0x48')](handleError(_0x2fec95,null));};exports[_0x3edd('0x4d')]=function(_0x3225ca,_0x487560){return db['CannedAnswer'][_0x3edd('0x4b')]({'where':{'id':_0x3225ca[_0x3edd('0x4a')]['id']}})[_0x3edd('0x29')](handleEntityNotFound(_0x487560,null))[_0x3edd('0x29')](removeEntity(_0x487560,null))[_0x3edd('0x48')](handleError(_0x487560,null));};exports['create']=function(_0x4cc774,_0x556a90){var _0x436611={'key':_0x4cc774[_0x3edd('0x4c')][_0x3edd('0x32')]};if(_0x4cc774[_0x3edd('0x4c')]['MailAccountId']){_0x436611[_0x3edd('0x4e')]=_0x4cc774[_0x3edd('0x4c')][_0x3edd('0x4e')];}else if(_0x4cc774['body'][_0x3edd('0x4f')]){_0x436611[_0x3edd('0x4f')]=_0x4cc774['body'][_0x3edd('0x4f')];}else if(_0x4cc774[_0x3edd('0x4c')][_0x3edd('0x50')]){_0x436611['OpenchannelAccountId']=_0x4cc774['body']['OpenchannelAccountId'];}else if(_0x4cc774[_0x3edd('0x4c')][_0x3edd('0x51')]){_0x436611[_0x3edd('0x51')]=_0x4cc774[_0x3edd('0x4c')][_0x3edd('0x51')];}return db[_0x3edd('0x44')][_0x3edd('0x4b')]({'where':_0x436611})[_0x3edd('0x29')](function(_0x5161fd){if(_0x5161fd){throw new db[(_0x3edd('0x52'))][(_0x3edd('0x53'))](_0x3edd('0x54'));}return db[_0x3edd('0x44')][_0x3edd('0x55')](_0x4cc774['body']);})[_0x3edd('0x29')](function(_0x290e79){var _0x5a738d=_0x4cc774['user'][_0x3edd('0x27')]({'plain':!![]});if(!_0x5a738d)throw new Error(_0x3edd('0x56'));if(_0x5a738d[_0x3edd('0x57')]===_0x3edd('0x58')){var _0x2d4ec5=_0x290e79[_0x3edd('0x27')]({'plain':!![]});return db[_0x3edd('0x59')][_0x3edd('0x4b')]({'where':{'name':'CannedAnswers','userProfileId':_0x5a738d[_0x3edd('0x5a')]},'raw':!![]})[_0x3edd('0x29')](function(_0x233dfa){if(_0x233dfa&&_0x233dfa[_0x3edd('0x5b')]===0x0){return db[_0x3edd('0x28')][_0x3edd('0x55')]({'name':_0x2d4ec5[_0x3edd('0x2d')],'resourceId':_0x2d4ec5['id'],'type':_0x233dfa['name'],'sectionId':_0x233dfa['id']},{})[_0x3edd('0x29')](function(){return _0x290e79;});}else{return _0x290e79;}})[_0x3edd('0x48')](function(_0x5f1c8f){logger[_0x3edd('0x2b')](_0x3edd('0x5c'),_0x5f1c8f);throw _0x5f1c8f;});}return _0x290e79;})[_0x3edd('0x29')](respondWithResult(_0x556a90,0xc9))[_0x3edd('0x48')](handleError(_0x556a90,null));}; \ No newline at end of file +var _0xbb38=['pick','merge','filter','includeAll','include','rows','catch','show','params','length','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','apply','save','update','then','destroy','get','CannedAnswers','UserProfileResource','error','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x1c6f3b,_0x928ae3){var _0x50102b=function(_0x2e9047){while(--_0x2e9047){_0x1c6f3b['push'](_0x1c6f3b['shift']());}};_0x50102b(++_0x928ae3);}(_0xbb38,0x71));var _0x8bb3=function(_0x70a8a5,_0x35a384){_0x70a8a5=_0x70a8a5-0x0;var _0x2b563b=_0xbb38[_0x70a8a5];return _0x2b563b;};'use strict';var emlformat=require(_0x8bb3('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8bb3('0x1'));var rp=require(_0x8bb3('0x2'));var moment=require(_0x8bb3('0x3'));var BPromise=require(_0x8bb3('0x4'));var Mustache=require('mustache');var util=require(_0x8bb3('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x8bb3('0x6'));var ejs=require(_0x8bb3('0x7'));var fs=require('fs');var fs_extra=require(_0x8bb3('0x8'));var _=require(_0x8bb3('0x9'));var squel=require('squel');var crypto=require(_0x8bb3('0xa'));var jsforce=require(_0x8bb3('0xb'));var deskjs=require(_0x8bb3('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8bb3('0xd'));var Papa=require(_0x8bb3('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8bb3('0xf'));var as=require(_0x8bb3('0x10'));var hardwareService=require(_0x8bb3('0x11'));var logger=require(_0x8bb3('0x12'))(_0x8bb3('0x13'));var utils=require(_0x8bb3('0x14'));var config=require(_0x8bb3('0x15'));var licenseUtil=require(_0x8bb3('0x16'));var db=require(_0x8bb3('0x17'))['db'];function respondWithStatusCode(_0xb80880,_0x11a1a8){_0x11a1a8=_0x11a1a8||0xcc;return function(_0x1b47ab){if(_0x1b47ab){return _0xb80880[_0x8bb3('0x18')](_0x11a1a8);}return _0xb80880[_0x8bb3('0x19')](_0x11a1a8)[_0x8bb3('0x1a')]();};}function respondWithResult(_0x22063e,_0x16a9b0){_0x16a9b0=_0x16a9b0||0xc8;return function(_0x28a56e){if(_0x28a56e){return _0x22063e[_0x8bb3('0x19')](_0x16a9b0)[_0x8bb3('0x1b')](_0x28a56e);}};}function respondWithFilteredResult(_0x3e4e4c,_0x4cd408){return function(_0xfdf07f){if(_0xfdf07f){var _0x43808d=typeof _0x4cd408[_0x8bb3('0x1c')]==='undefined'&&typeof _0x4cd408[_0x8bb3('0x1d')]==='undefined';var _0x587c55=_0xfdf07f[_0x8bb3('0x1e')];var _0x36e65d=_0x43808d?0x0:_0x4cd408[_0x8bb3('0x1c')];var _0xd10240=_0x43808d?_0xfdf07f['count']:_0x4cd408[_0x8bb3('0x1c')]+_0x4cd408[_0x8bb3('0x1d')];var _0x54c71b;if(_0xd10240>=_0x587c55){_0xd10240=_0x587c55;_0x54c71b=0xc8;}else{_0x54c71b=0xce;}_0x3e4e4c[_0x8bb3('0x19')](_0x54c71b);return _0x3e4e4c[_0x8bb3('0x1f')]('Content-Range',_0x36e65d+'-'+_0xd10240+'/'+_0x587c55)[_0x8bb3('0x1b')](_0xfdf07f);}return null;};}function patchUpdates(_0x481799){return function(_0x5e17e0){try{jsonpatch[_0x8bb3('0x20')](_0x5e17e0,_0x481799,!![]);}catch(_0x705afa){return BPromise['reject'](_0x705afa);}return _0x5e17e0[_0x8bb3('0x21')]();};}function saveUpdates(_0x21620a,_0xd4be5d){return function(_0x30875b){if(_0x30875b){return _0x30875b[_0x8bb3('0x22')](_0x21620a)[_0x8bb3('0x23')](function(_0x25c88f){return _0x25c88f;});}return null;};}function removeEntity(_0xb2aef8,_0x2c9b4a){return function(_0x1e8498){if(_0x1e8498){return _0x1e8498[_0x8bb3('0x24')]()[_0x8bb3('0x23')](function(){var _0x3a3116=_0x1e8498[_0x8bb3('0x25')]({'plain':!![]});var _0x2a0933=_0x8bb3('0x26');return db[_0x8bb3('0x27')][_0x8bb3('0x24')]({'where':{'type':_0x2a0933,'resourceId':_0x3a3116['id']}})[_0x8bb3('0x23')](function(){return _0x1e8498;});})['then'](function(){_0xb2aef8['status'](0xcc)[_0x8bb3('0x1a')]();});}};}function handleEntityNotFound(_0x26c040,_0x133847){return function(_0x312bcb){if(!_0x312bcb){_0x26c040[_0x8bb3('0x18')](0x194);}return _0x312bcb;};}function handleError(_0x1a3b16,_0x107716){_0x107716=_0x107716||0x1f4;return function(_0x464a0e){logger[_0x8bb3('0x28')](_0x464a0e[_0x8bb3('0x29')]);if(_0x464a0e[_0x8bb3('0x2a')]){delete _0x464a0e[_0x8bb3('0x2a')];}_0x1a3b16[_0x8bb3('0x19')](_0x107716)[_0x8bb3('0x2b')](_0x464a0e);};}exports[_0x8bb3('0x2c')]=function(_0x599a30,_0x9245a2){var _0x2d60cf={},_0x135507={},_0x5c32e8={'count':0x0,'rows':[]};var _0x214223=_[_0x8bb3('0x2d')](db[_0x8bb3('0x2e')][_0x8bb3('0x2f')],function(_0x672aa2){return{'name':_0x672aa2[_0x8bb3('0x30')],'type':_0x672aa2[_0x8bb3('0x31')][_0x8bb3('0x32')]};});_0x135507['model']=_[_0x8bb3('0x2d')](_0x214223,_0x8bb3('0x2a'));_0x135507[_0x8bb3('0x33')]=_[_0x8bb3('0x34')](_0x599a30[_0x8bb3('0x33')]);_0x135507[_0x8bb3('0x35')]=_[_0x8bb3('0x36')](_0x135507[_0x8bb3('0x37')],_0x135507[_0x8bb3('0x33')]);_0x2d60cf[_0x8bb3('0x38')]=_[_0x8bb3('0x36')](_0x135507[_0x8bb3('0x37')],qs[_0x8bb3('0x39')](_0x599a30[_0x8bb3('0x33')]['fields']));_0x2d60cf['attributes']=_0x2d60cf[_0x8bb3('0x38')]['length']?_0x2d60cf[_0x8bb3('0x38')]:_0x135507[_0x8bb3('0x37')];if(!_0x599a30[_0x8bb3('0x33')][_0x8bb3('0x3a')](_0x8bb3('0x3b'))){_0x2d60cf['limit']=qs[_0x8bb3('0x1d')](_0x599a30[_0x8bb3('0x33')][_0x8bb3('0x1d')]);_0x2d60cf[_0x8bb3('0x1c')]=qs[_0x8bb3('0x1c')](_0x599a30['query'][_0x8bb3('0x1c')]);}_0x2d60cf[_0x8bb3('0x3c')]=qs[_0x8bb3('0x3d')](_0x599a30['query']['sort']);_0x2d60cf[_0x8bb3('0x3e')]=qs[_0x8bb3('0x35')](_[_0x8bb3('0x3f')](_0x599a30['query'],_0x135507[_0x8bb3('0x35')]),_0x214223);if(_0x599a30[_0x8bb3('0x33')]['filter']){_0x2d60cf[_0x8bb3('0x3e')]=_[_0x8bb3('0x40')](_0x2d60cf[_0x8bb3('0x3e')],{'$or':[{'key':{'$like':'%'+_0x599a30[_0x8bb3('0x33')][_0x8bb3('0x41')]+'%'}},{'value':{'$like':'%'+_0x599a30[_0x8bb3('0x33')]['filter']+'%'}}]});}_0x2d60cf=_[_0x8bb3('0x40')]({},_0x2d60cf,_0x599a30['options']);var _0xb4b8d3={'where':_0x2d60cf['where']};return db[_0x8bb3('0x2e')][_0x8bb3('0x1e')](_0xb4b8d3)[_0x8bb3('0x23')](function(_0x2bd7b0){_0x5c32e8['count']=_0x2bd7b0;if(_0x599a30[_0x8bb3('0x33')][_0x8bb3('0x42')]){_0x2d60cf[_0x8bb3('0x43')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x2d60cf);})[_0x8bb3('0x23')](function(_0x22d742){_0x5c32e8[_0x8bb3('0x44')]=_0x22d742;return _0x5c32e8;})['then'](respondWithFilteredResult(_0x9245a2,_0x2d60cf))[_0x8bb3('0x45')](handleError(_0x9245a2,null));};exports[_0x8bb3('0x46')]=function(_0x5b6356,_0x52f880){var _0x5f5481={'raw':!![],'where':{'id':_0x5b6356[_0x8bb3('0x47')]['id']}},_0x3a12f1={};_0x3a12f1['model']=_[_0x8bb3('0x34')](db[_0x8bb3('0x2e')][_0x8bb3('0x2f')]);_0x3a12f1['query']=_[_0x8bb3('0x34')](_0x5b6356['query']);_0x3a12f1[_0x8bb3('0x35')]=_['intersection'](_0x3a12f1['model'],_0x3a12f1[_0x8bb3('0x33')]);_0x5f5481[_0x8bb3('0x38')]=_[_0x8bb3('0x36')](_0x3a12f1['model'],qs[_0x8bb3('0x39')](_0x5b6356[_0x8bb3('0x33')][_0x8bb3('0x39')]));_0x5f5481['attributes']=_0x5f5481[_0x8bb3('0x38')][_0x8bb3('0x48')]?_0x5f5481[_0x8bb3('0x38')]:_0x3a12f1[_0x8bb3('0x37')];if(_0x5b6356[_0x8bb3('0x33')][_0x8bb3('0x42')]){_0x5f5481['include']=[{'all':!![]}];}_0x5f5481=_[_0x8bb3('0x40')]({},_0x5f5481,_0x5b6356['options']);return db[_0x8bb3('0x2e')][_0x8bb3('0x49')](_0x5f5481)[_0x8bb3('0x23')](handleEntityNotFound(_0x52f880,null))[_0x8bb3('0x23')](respondWithResult(_0x52f880,null))[_0x8bb3('0x45')](handleError(_0x52f880,null));};exports[_0x8bb3('0x22')]=function(_0x48c7a5,_0x4166fd){if(_0x48c7a5[_0x8bb3('0x4a')]['id']){delete _0x48c7a5[_0x8bb3('0x4a')]['id'];}return db[_0x8bb3('0x2e')][_0x8bb3('0x49')]({'where':{'id':_0x48c7a5[_0x8bb3('0x47')]['id']}})[_0x8bb3('0x23')](handleEntityNotFound(_0x4166fd,null))['then'](saveUpdates(_0x48c7a5[_0x8bb3('0x4a')],null))[_0x8bb3('0x23')](respondWithResult(_0x4166fd,null))['catch'](handleError(_0x4166fd,null));};exports[_0x8bb3('0x24')]=function(_0x5eb362,_0x1a6c7c){return db[_0x8bb3('0x2e')][_0x8bb3('0x49')]({'where':{'id':_0x5eb362[_0x8bb3('0x47')]['id']}})[_0x8bb3('0x23')](handleEntityNotFound(_0x1a6c7c,null))[_0x8bb3('0x23')](removeEntity(_0x1a6c7c,null))[_0x8bb3('0x45')](handleError(_0x1a6c7c,null));};exports[_0x8bb3('0x4b')]=function(_0x57e774,_0x3d5894){var _0x138aa8={'key':_0x57e774['body'][_0x8bb3('0x32')]};if(_0x57e774[_0x8bb3('0x4a')][_0x8bb3('0x4c')]){_0x138aa8[_0x8bb3('0x4c')]=_0x57e774['body'][_0x8bb3('0x4c')];}else if(_0x57e774[_0x8bb3('0x4a')]['SmsAccountId']){_0x138aa8[_0x8bb3('0x4d')]=_0x57e774[_0x8bb3('0x4a')][_0x8bb3('0x4d')];}else if(_0x57e774[_0x8bb3('0x4a')][_0x8bb3('0x4e')]){_0x138aa8[_0x8bb3('0x4e')]=_0x57e774[_0x8bb3('0x4a')]['OpenchannelAccountId'];}else if(_0x57e774['body'][_0x8bb3('0x4f')]){_0x138aa8[_0x8bb3('0x4f')]=_0x57e774[_0x8bb3('0x4a')][_0x8bb3('0x4f')];}return db[_0x8bb3('0x2e')]['find']({'where':_0x138aa8})[_0x8bb3('0x23')](function(_0xfd1f1f){if(_0xfd1f1f){throw new db[(_0x8bb3('0x50'))][(_0x8bb3('0x51'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x8bb3('0x2e')][_0x8bb3('0x4b')](_0x57e774['body']);})[_0x8bb3('0x23')](function(_0x508e31){var _0x1fb3f9=_0x57e774[_0x8bb3('0x52')]['get']({'plain':!![]});if(!_0x1fb3f9)throw new Error(_0x8bb3('0x53'));if(_0x1fb3f9[_0x8bb3('0x54')]==='user'){var _0x1bc6d1=_0x508e31[_0x8bb3('0x25')]({'plain':!![]});return db[_0x8bb3('0x55')][_0x8bb3('0x49')]({'where':{'name':_0x8bb3('0x26'),'userProfileId':_0x1fb3f9[_0x8bb3('0x56')]},'raw':!![]})[_0x8bb3('0x23')](function(_0x47d973){if(_0x47d973&&_0x47d973['autoAssociation']===0x0){return db[_0x8bb3('0x27')][_0x8bb3('0x4b')]({'name':_0x1bc6d1['name'],'resourceId':_0x1bc6d1['id'],'type':_0x47d973[_0x8bb3('0x2a')],'sectionId':_0x47d973['id']},{})[_0x8bb3('0x23')](function(){return _0x508e31;});}else{return _0x508e31;}})[_0x8bb3('0x45')](function(_0x41ccb1){logger[_0x8bb3('0x28')](_0x8bb3('0x57'),_0x41ccb1);throw _0x41ccb1;});}return _0x508e31;})[_0x8bb3('0x23')](respondWithResult(_0x3d5894,0xc9))[_0x8bb3('0x45')](handleError(_0x3d5894,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index ead5b21..c467354 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 _0xe889=['lodash','util','bluebird','request-promise','rimraf','../../config/environment','CannedAnswer','tools_canned_answers'];(function(_0x1e30b9,_0x1cfd31){var _0x56177a=function(_0x2408cb){while(--_0x2408cb){_0x1e30b9['push'](_0x1e30b9['shift']());}};_0x56177a(++_0x1cfd31);}(_0xe889,0x88));var _0x9e88=function(_0x18b926,_0x448a61){_0x18b926=_0x18b926-0x0;var _0xa877ec=_0xe889[_0x18b926];return _0xa877ec;};'use strict';var _=require(_0x9e88('0x0'));var util=require(_0x9e88('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x9e88('0x2'));var rp=require(_0x9e88('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9e88('0x4'));var config=require(_0x9e88('0x5'));var attributes=require('./cannedAnswer.attributes');module['exports']=function(_0x527a2a,_0x28bdcf){return _0x527a2a['define'](_0x9e88('0x6'),attributes,{'tableName':_0x9e88('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x5447=['./cannedAnswer.attributes','CannedAnswer','utf8mb4_unicode_ci','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment'];(function(_0x446208,_0xb483fb){var _0xe49563=function(_0x1d3a21){while(--_0x1d3a21){_0x446208['push'](_0x446208['shift']());}};_0xe49563(++_0xb483fb);}(_0x5447,0x1a7));var _0x7544=function(_0x59a190,_0x1ce42e){_0x59a190=_0x59a190-0x0;var _0x39e7e4=_0x5447[_0x59a190];return _0x39e7e4;};'use strict';var _=require(_0x7544('0x0'));var util=require(_0x7544('0x1'));var logger=require(_0x7544('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7544('0x3'));var fs=require('fs');var path=require(_0x7544('0x4'));var rimraf=require(_0x7544('0x5'));var config=require(_0x7544('0x6'));var attributes=require(_0x7544('0x7'));module['exports']=function(_0x1efed6,_0x5dbdeb){return _0x1efed6['define'](_0x7544('0x8'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x7544('0x9')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index c3ab756..f02a716 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(_0x30c882,_0x5f4ed7){var _0xe20540=function(_0x3a3958){while(--_0x3a3958){_0x30c882['push'](_0x30c882['shift']());}};_0xe20540(++_0x5f4ed7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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(_0x51de72,_0x247b45){var _0x4efb2f=function(_0x2eec0e){while(--_0x2eec0e){_0x51de72['push'](_0x51de72['shift']());}};_0x4efb2f(++_0x247b45);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 981cdce..4611953 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 _0xbfd2=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','show','create','put','/:id','delete','exports','path'];(function(_0x39f34f,_0x298f45){var _0x59fee1=function(_0x6ebbb7){while(--_0x6ebbb7){_0x39f34f['push'](_0x39f34f['shift']());}};_0x59fee1(++_0x298f45);}(_0xbfd2,0x14f));var _0x2bfd=function(_0x1d6f17,_0x2a853b){_0x1d6f17=_0x1d6f17-0x0;var _0xbbd2b3=_0xbfd2[_0x1d6f17];return _0xbbd2b3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2bfd('0x0'));var timeout=require(_0x2bfd('0x1'));var express=require('express');var router=express[_0x2bfd('0x2')]();var fs_extra=require(_0x2bfd('0x3'));var auth=require(_0x2bfd('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2bfd('0x5'));var controller=require(_0x2bfd('0x6'));router[_0x2bfd('0x7')]('/',auth[_0x2bfd('0x8')](),controller[_0x2bfd('0x9')]);router['get']('/:id',auth[_0x2bfd('0x8')](),controller[_0x2bfd('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2bfd('0xb')]);router[_0x2bfd('0xc')](_0x2bfd('0xd'),auth[_0x2bfd('0x8')](),controller['update']);router[_0x2bfd('0xe')](_0x2bfd('0xd'),auth[_0x2bfd('0x8')](),controller['destroy']);module[_0x2bfd('0xf')]=router; \ No newline at end of file +var _0x7ca5=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x20056f,_0x72c6a8){var _0x2dc96e=function(_0x570b5c){while(--_0x570b5c){_0x20056f['push'](_0x20056f['shift']());}};_0x2dc96e(++_0x72c6a8);}(_0x7ca5,0x12b));var _0x57ca=function(_0x36614f,_0x5d8ded){_0x36614f=_0x36614f-0x0;var _0x233f0b=_0x7ca5[_0x36614f];return _0x233f0b;};'use strict';var multer=require(_0x57ca('0x0'));var util=require(_0x57ca('0x1'));var path=require(_0x57ca('0x2'));var timeout=require(_0x57ca('0x3'));var express=require(_0x57ca('0x4'));var router=express['Router']();var fs_extra=require(_0x57ca('0x5'));var auth=require(_0x57ca('0x6'));var interaction=require(_0x57ca('0x7'));var config=require(_0x57ca('0x8'));var controller=require('./cannedAnswer.controller');router['get']('/',auth[_0x57ca('0x9')](),controller[_0x57ca('0xa')]);router[_0x57ca('0xb')](_0x57ca('0xc'),auth[_0x57ca('0x9')](),controller['show']);router[_0x57ca('0xd')]('/',auth[_0x57ca('0x9')](),controller[_0x57ca('0xe')]);router[_0x57ca('0xf')](_0x57ca('0xc'),auth[_0x57ca('0x9')](),controller[_0x57ca('0x10')]);router[_0x57ca('0x11')](_0x57ca('0xc'),auth[_0x57ca('0x9')](),controller[_0x57ca('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 12729b7..3ee34b9 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 _0xcb18=['DATE','STRING','INTEGER'];(function(_0x21a691,_0x1abe9c){var _0x130987=function(_0x123fe1){while(--_0x123fe1){_0x21a691['push'](_0x21a691['shift']());}};_0x130987(++_0x1abe9c);}(_0xcb18,0x159));var _0x8cb1=function(_0x4c8eb3,_0x3c4a9d){_0x4c8eb3=_0x4c8eb3-0x0;var _0x6a8354=_0xcb18[_0x4c8eb3];return _0x6a8354;};'use strict';var Sequelize=require('sequelize');module['exports']={'calldate':{'type':Sequelize[_0x8cb1('0x0')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x8cb1('0x1')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x8cb1('0x1')]},'dcontext':{'type':Sequelize[_0x8cb1('0x1')]},'channel':{'type':Sequelize[_0x8cb1('0x1')]},'dstchannel':{'type':Sequelize[_0x8cb1('0x1')]},'lastapp':{'type':Sequelize[_0x8cb1('0x1')]},'lastdata':{'type':Sequelize[_0x8cb1('0x1')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x8cb1('0x2')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x8cb1('0x1')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x8cb1('0x1')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x8cb1('0x1')]},'linkedid':{'type':Sequelize[_0x8cb1('0x1')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x8cb1('0x1')]},'type':{'type':Sequelize[_0x8cb1('0x1')]},'tag':{'type':Sequelize[_0x8cb1('0x1')]}}; \ No newline at end of file +var _0x622f=['sequelize','exports','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x4f5327,_0x585b12){var _0x12b184=function(_0x5aa68e){while(--_0x5aa68e){_0x4f5327['push'](_0x4f5327['shift']());}};_0x12b184(++_0x585b12);}(_0x622f,0x172));var _0xf622=function(_0x575765,_0x26b960){_0x575765=_0x575765-0x0;var _0x50cced=_0x622f[_0x575765];return _0x50cced;};'use strict';var Sequelize=require(_0xf622('0x0'));module[_0xf622('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xf622('0x2')},'clid':{'type':Sequelize[_0xf622('0x3')]},'src':{'type':Sequelize[_0xf622('0x3')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0xf622('0x3')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0xf622('0x3')]},'lastapp':{'type':Sequelize[_0xf622('0x3')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xf622('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xf622('0x3')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xf622('0x3')]},'userfield':{'type':Sequelize[_0xf622('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xf622('0x3')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf622('0x3')]},'tag':{'type':Sequelize[_0xf622('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index e726b7e..5c12d48 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 _0x2b83=['stack','name','send','index','Cdr','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','includeAll','include','findAll','keys','options','create','catch','body','find','params','describe','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','undefined','count','offset','limit','set','json','apply','reject','save','update','destroy','then','error'];(function(_0x57f597,_0x4bcfb3){var _0x5d6218=function(_0x58fe8c){while(--_0x58fe8c){_0x57f597['push'](_0x57f597['shift']());}};_0x5d6218(++_0x4bcfb3);}(_0x2b83,0x1d3));var _0x32b8=function(_0x5ea249,_0x4348be){_0x5ea249=_0x5ea249-0x0;var _0x2edc33=_0x2b83[_0x5ea249];return _0x2edc33;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x32b8('0x0'));var zipdir=require(_0x32b8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x32b8('0x2'));var moment=require(_0x32b8('0x3'));var BPromise=require(_0x32b8('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x32b8('0x5'));var sox=require(_0x32b8('0x6'));var csv=require('to-csv');var ejs=require(_0x32b8('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32b8('0x8'));var squel=require(_0x32b8('0x9'));var crypto=require(_0x32b8('0xa'));var jsforce=require(_0x32b8('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x32b8('0xc'));var querystring=require(_0x32b8('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x32b8('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x32b8('0xf'));var hardwareService=require(_0x32b8('0x10'));var logger=require(_0x32b8('0x11'))(_0x32b8('0x12'));var utils=require('../../config/utils');var config=require(_0x32b8('0x13'));var licenseUtil=require(_0x32b8('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49c337,_0x30d00a){_0x30d00a=_0x30d00a||0xcc;return function(_0x5a0ef2){if(_0x5a0ef2){return _0x49c337[_0x32b8('0x15')](_0x30d00a);}return _0x49c337['status'](_0x30d00a)[_0x32b8('0x16')]();};}function respondWithResult(_0x6b533e,_0x3b0fac){_0x3b0fac=_0x3b0fac||0xc8;return function(_0xdf56fb){if(_0xdf56fb){return _0x6b533e[_0x32b8('0x17')](_0x3b0fac)['json'](_0xdf56fb);}};}function respondWithFilteredResult(_0x4c8fc9,_0x5e7b4f){return function(_0x5e49d1){if(_0x5e49d1){var _0x4e0d7a=typeof _0x5e7b4f['offset']===_0x32b8('0x18')&&typeof _0x5e7b4f['limit']==='undefined';var _0x2828fc=_0x5e49d1[_0x32b8('0x19')];var _0x2ba4eb=_0x4e0d7a?0x0:_0x5e7b4f[_0x32b8('0x1a')];var _0x599bc3=_0x4e0d7a?_0x5e49d1['count']:_0x5e7b4f['offset']+_0x5e7b4f[_0x32b8('0x1b')];var _0x2ffea2;if(_0x599bc3>=_0x2828fc){_0x599bc3=_0x2828fc;_0x2ffea2=0xc8;}else{_0x2ffea2=0xce;}_0x4c8fc9[_0x32b8('0x17')](_0x2ffea2);return _0x4c8fc9[_0x32b8('0x1c')]('Content-Range',_0x2ba4eb+'-'+_0x599bc3+'/'+_0x2828fc)[_0x32b8('0x1d')](_0x5e49d1);}return null;};}function patchUpdates(_0x3ddc5f){return function(_0xb51551){try{jsonpatch[_0x32b8('0x1e')](_0xb51551,_0x3ddc5f,!![]);}catch(_0xb9dd1d){return BPromise[_0x32b8('0x1f')](_0xb9dd1d);}return _0xb51551[_0x32b8('0x20')]();};}function saveUpdates(_0xcd4b26,_0x52347c){return function(_0x567055){if(_0x567055){return _0x567055[_0x32b8('0x21')](_0xcd4b26)['then'](function(_0x1ec58d){return _0x1ec58d;});}return null;};}function removeEntity(_0x4bc4a8,_0x1a4c2b){return function(_0x21ee32){if(_0x21ee32){return _0x21ee32[_0x32b8('0x22')]()[_0x32b8('0x23')](function(){_0x4bc4a8[_0x32b8('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e1360,_0x25a917){return function(_0x3eea54){if(!_0x3eea54){_0x4e1360[_0x32b8('0x15')](0x194);}return _0x3eea54;};}function handleError(_0x23e195,_0x29988d){_0x29988d=_0x29988d||0x1f4;return function(_0x57a6a3){logger[_0x32b8('0x24')](_0x57a6a3[_0x32b8('0x25')]);if(_0x57a6a3[_0x32b8('0x26')]){delete _0x57a6a3[_0x32b8('0x26')];}_0x23e195[_0x32b8('0x17')](_0x29988d)[_0x32b8('0x27')](_0x57a6a3);};}exports[_0x32b8('0x28')]=function(_0x39ce15,_0x3fa029){var _0xa225ec={},_0x3e0548={},_0x2bc3ce={'count':0x0,'rows':[]};var _0x1fcba2=_['map'](db[_0x32b8('0x29')][_0x32b8('0x2a')],function(_0x383b0e){return{'name':_0x383b0e[_0x32b8('0x2b')],'type':_0x383b0e[_0x32b8('0x2c')][_0x32b8('0x2d')]};});_0x3e0548[_0x32b8('0x2e')]=_[_0x32b8('0x2f')](_0x1fcba2,_0x32b8('0x26'));_0x3e0548[_0x32b8('0x30')]=_['keys'](_0x39ce15[_0x32b8('0x30')]);_0x3e0548[_0x32b8('0x31')]=_[_0x32b8('0x32')](_0x3e0548[_0x32b8('0x2e')],_0x3e0548['query']);_0xa225ec['attributes']=_[_0x32b8('0x32')](_0x3e0548[_0x32b8('0x2e')],qs[_0x32b8('0x33')](_0x39ce15[_0x32b8('0x30')]['fields']));_0xa225ec[_0x32b8('0x34')]=_0xa225ec[_0x32b8('0x34')][_0x32b8('0x35')]?_0xa225ec[_0x32b8('0x34')]:_0x3e0548[_0x32b8('0x2e')];if(!_0x39ce15[_0x32b8('0x30')][_0x32b8('0x36')](_0x32b8('0x37'))){_0xa225ec['limit']=qs[_0x32b8('0x1b')](_0x39ce15['query'][_0x32b8('0x1b')]);_0xa225ec[_0x32b8('0x1a')]=qs[_0x32b8('0x1a')](_0x39ce15[_0x32b8('0x30')][_0x32b8('0x1a')]);}_0xa225ec[_0x32b8('0x38')]=qs['sort'](_0x39ce15[_0x32b8('0x30')][_0x32b8('0x39')]);_0xa225ec[_0x32b8('0x3a')]=qs['filters'](_[_0x32b8('0x3b')](_0x39ce15['query'],_0x3e0548[_0x32b8('0x31')]),_0x1fcba2);if(_0x39ce15[_0x32b8('0x30')][_0x32b8('0x3c')]){_0xa225ec[_0x32b8('0x3a')]=_['merge'](_0xa225ec[_0x32b8('0x3a')],{'$or':_[_0x32b8('0x2f')](_0x1fcba2,function(_0x2d586f){if(_0x2d586f['type']!=='VIRTUAL'){var _0xa8115e={};_0xa8115e[_0x2d586f[_0x32b8('0x26')]]={'$like':'%'+_0x39ce15[_0x32b8('0x30')]['filter']+'%'};return _0xa8115e;}})});}_0xa225ec=_['merge']({},_0xa225ec,_0x39ce15['options']);var _0x1aa6ef={'where':_0xa225ec[_0x32b8('0x3a')]};return db[_0x32b8('0x29')]['count'](_0x1aa6ef)[_0x32b8('0x23')](function(_0x14c109){_0x2bc3ce[_0x32b8('0x19')]=_0x14c109;if(_0x39ce15[_0x32b8('0x30')][_0x32b8('0x3d')]){_0xa225ec[_0x32b8('0x3e')]=[{'all':!![]}];}return db[_0x32b8('0x29')][_0x32b8('0x3f')](_0xa225ec);})['then'](function(_0x39ec33){_0x2bc3ce['rows']=_0x39ec33;return _0x2bc3ce;})['then'](respondWithFilteredResult(_0x3fa029,_0xa225ec))['catch'](handleError(_0x3fa029,null));};exports['show']=function(_0x2d9003,_0x50e6e3){var _0x2a3968={'raw':!![],'where':{'id':_0x2d9003['params']['id']}},_0x52709b={};_0x52709b[_0x32b8('0x2e')]=_[_0x32b8('0x40')](db[_0x32b8('0x29')]['rawAttributes']);_0x52709b[_0x32b8('0x30')]=_[_0x32b8('0x40')](_0x2d9003[_0x32b8('0x30')]);_0x52709b['filters']=_['intersection'](_0x52709b[_0x32b8('0x2e')],_0x52709b['query']);_0x2a3968[_0x32b8('0x34')]=_['intersection'](_0x52709b[_0x32b8('0x2e')],qs['fields'](_0x2d9003[_0x32b8('0x30')][_0x32b8('0x33')]));_0x2a3968[_0x32b8('0x34')]=_0x2a3968[_0x32b8('0x34')]['length']?_0x2a3968['attributes']:_0x52709b[_0x32b8('0x2e')];if(_0x2d9003[_0x32b8('0x30')][_0x32b8('0x3d')]){_0x2a3968['include']=[{'all':!![]}];}_0x2a3968=_['merge']({},_0x2a3968,_0x2d9003[_0x32b8('0x41')]);return db[_0x32b8('0x29')]['find'](_0x2a3968)[_0x32b8('0x23')](handleEntityNotFound(_0x50e6e3,null))['then'](respondWithResult(_0x50e6e3,null))['catch'](handleError(_0x50e6e3,null));};exports['create']=function(_0x250ebf,_0x2d2624){return db[_0x32b8('0x29')][_0x32b8('0x42')](_0x250ebf['body'],{})[_0x32b8('0x23')](respondWithResult(_0x2d2624,0xc9))[_0x32b8('0x43')](handleError(_0x2d2624,null));};exports[_0x32b8('0x21')]=function(_0x29a413,_0x1a5bd4){if(_0x29a413[_0x32b8('0x44')]['id']){delete _0x29a413[_0x32b8('0x44')]['id'];}return db['Cdr'][_0x32b8('0x45')]({'where':{'id':_0x29a413[_0x32b8('0x46')]['id']}})[_0x32b8('0x23')](handleEntityNotFound(_0x1a5bd4,null))[_0x32b8('0x23')](saveUpdates(_0x29a413[_0x32b8('0x44')],null))[_0x32b8('0x23')](respondWithResult(_0x1a5bd4,null))[_0x32b8('0x43')](handleError(_0x1a5bd4,null));};exports[_0x32b8('0x22')]=function(_0x68210a,_0x5b8ca9){return db['Cdr'][_0x32b8('0x45')]({'where':{'id':_0x68210a[_0x32b8('0x46')]['id']}})[_0x32b8('0x23')](handleEntityNotFound(_0x5b8ca9,null))[_0x32b8('0x23')](removeEntity(_0x5b8ca9,null))[_0x32b8('0x43')](handleError(_0x5b8ca9,null));};exports[_0x32b8('0x47')]=function(_0x4f7c6f,_0xde4f61){return db[_0x32b8('0x29')][_0x32b8('0x47')]()[_0x32b8('0x23')](respondWithResult(_0xde4f61,null))['catch'](handleError(_0xde4f61,null));}; \ No newline at end of file +var _0x2b83=['stack','name','send','index','Cdr','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','includeAll','include','findAll','keys','options','create','catch','body','find','params','describe','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','undefined','count','offset','limit','set','json','apply','reject','save','update','destroy','then','error'];(function(_0x1eacf9,_0x3f4cfa){var _0x2725ff=function(_0x3f2237){while(--_0x3f2237){_0x1eacf9['push'](_0x1eacf9['shift']());}};_0x2725ff(++_0x3f4cfa);}(_0x2b83,0x1d3));var _0x32b8=function(_0x1ecd65,_0x4b7608){_0x1ecd65=_0x1ecd65-0x0;var _0x59b038=_0x2b83[_0x1ecd65];return _0x59b038;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x32b8('0x0'));var zipdir=require(_0x32b8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x32b8('0x2'));var moment=require(_0x32b8('0x3'));var BPromise=require(_0x32b8('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x32b8('0x5'));var sox=require(_0x32b8('0x6'));var csv=require('to-csv');var ejs=require(_0x32b8('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32b8('0x8'));var squel=require(_0x32b8('0x9'));var crypto=require(_0x32b8('0xa'));var jsforce=require(_0x32b8('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x32b8('0xc'));var querystring=require(_0x32b8('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x32b8('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x32b8('0xf'));var hardwareService=require(_0x32b8('0x10'));var logger=require(_0x32b8('0x11'))(_0x32b8('0x12'));var utils=require('../../config/utils');var config=require(_0x32b8('0x13'));var licenseUtil=require(_0x32b8('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49c337,_0x30d00a){_0x30d00a=_0x30d00a||0xcc;return function(_0x5a0ef2){if(_0x5a0ef2){return _0x49c337[_0x32b8('0x15')](_0x30d00a);}return _0x49c337['status'](_0x30d00a)[_0x32b8('0x16')]();};}function respondWithResult(_0x6b533e,_0x3b0fac){_0x3b0fac=_0x3b0fac||0xc8;return function(_0xdf56fb){if(_0xdf56fb){return _0x6b533e[_0x32b8('0x17')](_0x3b0fac)['json'](_0xdf56fb);}};}function respondWithFilteredResult(_0x4c8fc9,_0x5e7b4f){return function(_0x5e49d1){if(_0x5e49d1){var _0x4e0d7a=typeof _0x5e7b4f['offset']===_0x32b8('0x18')&&typeof _0x5e7b4f['limit']==='undefined';var _0x2828fc=_0x5e49d1[_0x32b8('0x19')];var _0x2ba4eb=_0x4e0d7a?0x0:_0x5e7b4f[_0x32b8('0x1a')];var _0x599bc3=_0x4e0d7a?_0x5e49d1['count']:_0x5e7b4f['offset']+_0x5e7b4f[_0x32b8('0x1b')];var _0x2ffea2;if(_0x599bc3>=_0x2828fc){_0x599bc3=_0x2828fc;_0x2ffea2=0xc8;}else{_0x2ffea2=0xce;}_0x4c8fc9[_0x32b8('0x17')](_0x2ffea2);return _0x4c8fc9[_0x32b8('0x1c')]('Content-Range',_0x2ba4eb+'-'+_0x599bc3+'/'+_0x2828fc)[_0x32b8('0x1d')](_0x5e49d1);}return null;};}function patchUpdates(_0x3ddc5f){return function(_0xb51551){try{jsonpatch[_0x32b8('0x1e')](_0xb51551,_0x3ddc5f,!![]);}catch(_0xb9dd1d){return BPromise[_0x32b8('0x1f')](_0xb9dd1d);}return _0xb51551[_0x32b8('0x20')]();};}function saveUpdates(_0xcd4b26,_0x52347c){return function(_0x567055){if(_0x567055){return _0x567055[_0x32b8('0x21')](_0xcd4b26)['then'](function(_0x1ec58d){return _0x1ec58d;});}return null;};}function removeEntity(_0x4bc4a8,_0x1a4c2b){return function(_0x21ee32){if(_0x21ee32){return _0x21ee32[_0x32b8('0x22')]()[_0x32b8('0x23')](function(){_0x4bc4a8[_0x32b8('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e1360,_0x25a917){return function(_0x3eea54){if(!_0x3eea54){_0x4e1360[_0x32b8('0x15')](0x194);}return _0x3eea54;};}function handleError(_0x23e195,_0x29988d){_0x29988d=_0x29988d||0x1f4;return function(_0x57a6a3){logger[_0x32b8('0x24')](_0x57a6a3[_0x32b8('0x25')]);if(_0x57a6a3[_0x32b8('0x26')]){delete _0x57a6a3[_0x32b8('0x26')];}_0x23e195[_0x32b8('0x17')](_0x29988d)[_0x32b8('0x27')](_0x57a6a3);};}exports[_0x32b8('0x28')]=function(_0x39ce15,_0x3fa029){var _0xa225ec={},_0x3e0548={},_0x2bc3ce={'count':0x0,'rows':[]};var _0x1fcba2=_['map'](db[_0x32b8('0x29')][_0x32b8('0x2a')],function(_0x383b0e){return{'name':_0x383b0e[_0x32b8('0x2b')],'type':_0x383b0e[_0x32b8('0x2c')][_0x32b8('0x2d')]};});_0x3e0548[_0x32b8('0x2e')]=_[_0x32b8('0x2f')](_0x1fcba2,_0x32b8('0x26'));_0x3e0548[_0x32b8('0x30')]=_['keys'](_0x39ce15[_0x32b8('0x30')]);_0x3e0548[_0x32b8('0x31')]=_[_0x32b8('0x32')](_0x3e0548[_0x32b8('0x2e')],_0x3e0548['query']);_0xa225ec['attributes']=_[_0x32b8('0x32')](_0x3e0548[_0x32b8('0x2e')],qs[_0x32b8('0x33')](_0x39ce15[_0x32b8('0x30')]['fields']));_0xa225ec[_0x32b8('0x34')]=_0xa225ec[_0x32b8('0x34')][_0x32b8('0x35')]?_0xa225ec[_0x32b8('0x34')]:_0x3e0548[_0x32b8('0x2e')];if(!_0x39ce15[_0x32b8('0x30')][_0x32b8('0x36')](_0x32b8('0x37'))){_0xa225ec['limit']=qs[_0x32b8('0x1b')](_0x39ce15['query'][_0x32b8('0x1b')]);_0xa225ec[_0x32b8('0x1a')]=qs[_0x32b8('0x1a')](_0x39ce15[_0x32b8('0x30')][_0x32b8('0x1a')]);}_0xa225ec[_0x32b8('0x38')]=qs['sort'](_0x39ce15[_0x32b8('0x30')][_0x32b8('0x39')]);_0xa225ec[_0x32b8('0x3a')]=qs['filters'](_[_0x32b8('0x3b')](_0x39ce15['query'],_0x3e0548[_0x32b8('0x31')]),_0x1fcba2);if(_0x39ce15[_0x32b8('0x30')][_0x32b8('0x3c')]){_0xa225ec[_0x32b8('0x3a')]=_['merge'](_0xa225ec[_0x32b8('0x3a')],{'$or':_[_0x32b8('0x2f')](_0x1fcba2,function(_0x2d586f){if(_0x2d586f['type']!=='VIRTUAL'){var _0xa8115e={};_0xa8115e[_0x2d586f[_0x32b8('0x26')]]={'$like':'%'+_0x39ce15[_0x32b8('0x30')]['filter']+'%'};return _0xa8115e;}})});}_0xa225ec=_['merge']({},_0xa225ec,_0x39ce15['options']);var _0x1aa6ef={'where':_0xa225ec[_0x32b8('0x3a')]};return db[_0x32b8('0x29')]['count'](_0x1aa6ef)[_0x32b8('0x23')](function(_0x14c109){_0x2bc3ce[_0x32b8('0x19')]=_0x14c109;if(_0x39ce15[_0x32b8('0x30')][_0x32b8('0x3d')]){_0xa225ec[_0x32b8('0x3e')]=[{'all':!![]}];}return db[_0x32b8('0x29')][_0x32b8('0x3f')](_0xa225ec);})['then'](function(_0x39ec33){_0x2bc3ce['rows']=_0x39ec33;return _0x2bc3ce;})['then'](respondWithFilteredResult(_0x3fa029,_0xa225ec))['catch'](handleError(_0x3fa029,null));};exports['show']=function(_0x2d9003,_0x50e6e3){var _0x2a3968={'raw':!![],'where':{'id':_0x2d9003['params']['id']}},_0x52709b={};_0x52709b[_0x32b8('0x2e')]=_[_0x32b8('0x40')](db[_0x32b8('0x29')]['rawAttributes']);_0x52709b[_0x32b8('0x30')]=_[_0x32b8('0x40')](_0x2d9003[_0x32b8('0x30')]);_0x52709b['filters']=_['intersection'](_0x52709b[_0x32b8('0x2e')],_0x52709b['query']);_0x2a3968[_0x32b8('0x34')]=_['intersection'](_0x52709b[_0x32b8('0x2e')],qs['fields'](_0x2d9003[_0x32b8('0x30')][_0x32b8('0x33')]));_0x2a3968[_0x32b8('0x34')]=_0x2a3968[_0x32b8('0x34')]['length']?_0x2a3968['attributes']:_0x52709b[_0x32b8('0x2e')];if(_0x2d9003[_0x32b8('0x30')][_0x32b8('0x3d')]){_0x2a3968['include']=[{'all':!![]}];}_0x2a3968=_['merge']({},_0x2a3968,_0x2d9003[_0x32b8('0x41')]);return db[_0x32b8('0x29')]['find'](_0x2a3968)[_0x32b8('0x23')](handleEntityNotFound(_0x50e6e3,null))['then'](respondWithResult(_0x50e6e3,null))['catch'](handleError(_0x50e6e3,null));};exports['create']=function(_0x250ebf,_0x2d2624){return db[_0x32b8('0x29')][_0x32b8('0x42')](_0x250ebf['body'],{})[_0x32b8('0x23')](respondWithResult(_0x2d2624,0xc9))[_0x32b8('0x43')](handleError(_0x2d2624,null));};exports[_0x32b8('0x21')]=function(_0x29a413,_0x1a5bd4){if(_0x29a413[_0x32b8('0x44')]['id']){delete _0x29a413[_0x32b8('0x44')]['id'];}return db['Cdr'][_0x32b8('0x45')]({'where':{'id':_0x29a413[_0x32b8('0x46')]['id']}})[_0x32b8('0x23')](handleEntityNotFound(_0x1a5bd4,null))[_0x32b8('0x23')](saveUpdates(_0x29a413[_0x32b8('0x44')],null))[_0x32b8('0x23')](respondWithResult(_0x1a5bd4,null))[_0x32b8('0x43')](handleError(_0x1a5bd4,null));};exports[_0x32b8('0x22')]=function(_0x68210a,_0x5b8ca9){return db['Cdr'][_0x32b8('0x45')]({'where':{'id':_0x68210a[_0x32b8('0x46')]['id']}})[_0x32b8('0x23')](handleEntityNotFound(_0x5b8ca9,null))[_0x32b8('0x23')](removeEntity(_0x5b8ca9,null))[_0x32b8('0x43')](handleError(_0x5b8ca9,null));};exports[_0x32b8('0x47')]=function(_0x4f7c6f,_0xde4f61){return db[_0x32b8('0x29')][_0x32b8('0x47')]()[_0x32b8('0x23')](respondWithResult(_0xde4f61,null))['catch'](handleError(_0xde4f61,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 1119d42..7e27485 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 _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x5cb8cd,_0x5821d4){var _0x1bccd6=function(_0x42f1f8){while(--_0x42f1f8){_0x5cb8cd['push'](_0x5cb8cd['shift']());}};_0x1bccd6(++_0x5821d4);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x12cdab,_0x4b1d57){var _0x4c2d31=function(_0x1d2026){while(--_0x1d2026){_0x12cdab['push'](_0x12cdab['shift']());}};_0x4c2d31(++_0x4b1d57);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 41bf9cd..0c3d09c 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 _0x5043=['request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x5043,0x173));var _0x3504=function(_0xc4aebc,_0x34460d){_0xc4aebc=_0xc4aebc-0x0;var _0x150244=_0x5043[_0xc4aebc];return _0x150244;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3504('0x0'));var BPromise=require('bluebird');var rs=require(_0x3504('0x1'));var fs=require('fs');var Redis=require(_0x3504('0x2'));var db=require(_0x3504('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3504('0x4'))(_0x3504('0x5'));var config=require(_0x3504('0x6'));var jayson=require(_0x3504('0x7'));var client=jayson[_0x3504('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x308ee1,_0x121978,_0x1c6f73){return new BPromise(function(_0x288ed7,_0x5eafb8){return client[_0x3504('0x9')](_0x308ee1,_0x1c6f73)[_0x3504('0xa')](function(_0x2ed068){logger[_0x3504('0xb')](_0x3504('0xc'),_0x121978,_0x3504('0xd'));logger[_0x3504('0xe')]('Cdr,\x20%s,\x20%s,\x20%s',_0x121978,_0x3504('0xd'),JSON[_0x3504('0xf')](_0x2ed068));if(_0x2ed068[_0x3504('0x10')]){if(_0x2ed068['error'][_0x3504('0x11')]===0x1f4){logger['error'](_0x3504('0xc'),_0x121978,_0x2ed068[_0x3504('0x10')][_0x3504('0x12')]);return _0x5eafb8(_0x2ed068[_0x3504('0x10')][_0x3504('0x12')]);}logger[_0x3504('0x10')](_0x3504('0xc'),_0x121978,_0x2ed068[_0x3504('0x10')]['message']);return _0x288ed7(_0x2ed068['error'][_0x3504('0x12')]);}else{logger[_0x3504('0xb')](_0x3504('0xc'),_0x121978,_0x3504('0xd'));_0x288ed7(_0x2ed068[_0x3504('0x13')][_0x3504('0x12')]);}})['catch'](function(_0x51db56){logger[_0x3504('0x10')]('Cdr,\x20%s,\x20%s',_0x121978,_0x51db56);_0x5eafb8(_0x51db56);});});} \ No newline at end of file +var _0xdc77=['Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x2a1a6f,_0x4e01ac){var _0x38cb09=function(_0x186fc7){while(--_0x186fc7){_0x2a1a6f['push'](_0x2a1a6f['shift']());}};_0x38cb09(++_0x4e01ac);}(_0xdc77,0x12e));var _0x7dc7=function(_0x94157,_0xe20257){_0x94157=_0x94157-0x0;var _0x496b2f=_0xdc77[_0x94157];return _0x496b2f;};'use strict';var _=require('lodash');var util=require(_0x7dc7('0x0'));var moment=require('moment');var BPromise=require(_0x7dc7('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7dc7('0x2'));var db=require(_0x7dc7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7dc7('0x4'))(_0x7dc7('0x5'));var config=require(_0x7dc7('0x6'));var jayson=require(_0x7dc7('0x7'));var client=jayson[_0x7dc7('0x8')][_0x7dc7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x108d94,_0x5610cb,_0x176a7f){return new BPromise(function(_0x53ccfc,_0x288d2b){return client[_0x7dc7('0xa')](_0x108d94,_0x176a7f)[_0x7dc7('0xb')](function(_0x370c43){logger[_0x7dc7('0xc')](_0x7dc7('0xd'),_0x5610cb,_0x7dc7('0xe'));logger[_0x7dc7('0xf')]('Cdr,\x20%s,\x20%s,\x20%s',_0x5610cb,_0x7dc7('0xe'),JSON[_0x7dc7('0x10')](_0x370c43));if(_0x370c43[_0x7dc7('0x11')]){if(_0x370c43[_0x7dc7('0x11')]['code']===0x1f4){logger[_0x7dc7('0x11')](_0x7dc7('0xd'),_0x5610cb,_0x370c43[_0x7dc7('0x11')]['message']);return _0x288d2b(_0x370c43[_0x7dc7('0x11')][_0x7dc7('0x12')]);}logger[_0x7dc7('0x11')](_0x7dc7('0xd'),_0x5610cb,_0x370c43[_0x7dc7('0x11')][_0x7dc7('0x12')]);return _0x53ccfc(_0x370c43['error'][_0x7dc7('0x12')]);}else{logger[_0x7dc7('0xc')](_0x7dc7('0xd'),_0x5610cb,_0x7dc7('0xe'));_0x53ccfc(_0x370c43[_0x7dc7('0x13')][_0x7dc7('0x12')]);}})[_0x7dc7('0x14')](function(_0x16508a){logger[_0x7dc7('0x11')](_0x7dc7('0xd'),_0x5610cb,_0x16508a);_0x288d2b(_0x16508a);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index fb55524..af9b84c 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(_0x437d7f,_0x1feb46){var _0x31058c=function(_0x49dd1a){while(--_0x49dd1a){_0x437d7f['push'](_0x437d7f['shift']());}};_0x31058c(++_0x1feb46);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x531d15,_0x599af5){var _0x271a18=function(_0x31284d){while(--_0x31284d){_0x531d15['push'](_0x531d15['shift']());}};_0x271a18(++_0x599af5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index f279074..db37aeb 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 _0xf7a5=['noop','TEXT','*,*,*,*','exports','INTEGER','STRING'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf7a5,0xc3));var _0x5f7a=function(_0x5da54c,_0x520452){_0x5da54c=_0x5da54c-0x0;var _0x1246b0=_0xf7a5[_0x5da54c];return _0x1246b0;};'use strict';var Sequelize=require('sequelize');module[_0x5f7a('0x0')]={'priority':{'type':Sequelize[_0x5f7a('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x5f7a('0x2')],'allowNull':![],'defaultValue':_0x5f7a('0x3')},'appdata':{'type':Sequelize[_0x5f7a('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x5f7a('0x2')],'defaultValue':_0x5f7a('0x5')}}; \ No newline at end of file +var _0x3f3b=['*,*,*,*','sequelize','exports','STRING','noop','TEXT'];(function(_0x39e7cf,_0x20bd10){var _0x3061a9=function(_0x49685b){while(--_0x49685b){_0x39e7cf['push'](_0x39e7cf['shift']());}};_0x3061a9(++_0x20bd10);}(_0x3f3b,0xd3));var _0xb3f3=function(_0x5a9ff5,_0x41e797){_0x5a9ff5=_0x5a9ff5-0x0;var _0x514aa7=_0x3f3b[_0x5a9ff5];return _0x514aa7;};'use strict';var Sequelize=require(_0xb3f3('0x0'));module[_0xb3f3('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xb3f3('0x2')],'allowNull':![],'defaultValue':_0xb3f3('0x3')},'appdata':{'type':Sequelize[_0xb3f3('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xb3f3('0x2')],'defaultValue':_0xb3f3('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index a3ae40a..75dd139 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 _0x2333=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','error','stack','name','show','params','model','keys','ChatApplication','query','filters','intersection','attributes','fields','includeAll','merge','options','find','then','body','catch','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x2333,0x11a));var _0x3233=function(_0x2d20d0,_0x39c308){_0x2d20d0=_0x2d20d0-0x0;var _0x464564=_0x2333[_0x2d20d0];return _0x464564;};'use strict';var emlformat=require(_0x3233('0x0'));var rimraf=require(_0x3233('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3233('0x2'));var moment=require(_0x3233('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3233('0x4'));var util=require(_0x3233('0x5'));var path=require(_0x3233('0x6'));var sox=require(_0x3233('0x7'));var csv=require(_0x3233('0x8'));var ejs=require(_0x3233('0x9'));var fs=require('fs');var fs_extra=require(_0x3233('0xa'));var _=require(_0x3233('0xb'));var squel=require(_0x3233('0xc'));var crypto=require(_0x3233('0xd'));var jsforce=require(_0x3233('0xe'));var deskjs=require(_0x3233('0xf'));var toCsv=require(_0x3233('0x8'));var querystring=require(_0x3233('0x10'));var Papa=require(_0x3233('0x11'));var Redis=require(_0x3233('0x12'));var authService=require(_0x3233('0x13'));var qs=require(_0x3233('0x14'));var as=require(_0x3233('0x15'));var hardwareService=require(_0x3233('0x16'));var logger=require(_0x3233('0x17'))('api');var utils=require(_0x3233('0x18'));var config=require(_0x3233('0x19'));var licenseUtil=require(_0x3233('0x1a'));var db=require(_0x3233('0x1b'))['db'];function respondWithStatusCode(_0xd59689,_0x18166d){_0x18166d=_0x18166d||0xcc;return function(_0x44ef5f){if(_0x44ef5f){return _0xd59689[_0x3233('0x1c')](_0x18166d);}return _0xd59689[_0x3233('0x1d')](_0x18166d)[_0x3233('0x1e')]();};}function respondWithResult(_0x428b44,_0x27e9fd){_0x27e9fd=_0x27e9fd||0xc8;return function(_0x7f5e07){if(_0x7f5e07){return _0x428b44['status'](_0x27e9fd)['json'](_0x7f5e07);}};}function respondWithFilteredResult(_0xc71f65,_0x26a41e){return function(_0x45fc24){if(_0x45fc24){var _0x5885a5=typeof _0x26a41e[_0x3233('0x1f')]===_0x3233('0x20')&&typeof _0x26a41e[_0x3233('0x21')]==='undefined';var _0x33f2e5=_0x45fc24[_0x3233('0x22')];var _0x55fa30=_0x5885a5?0x0:_0x26a41e[_0x3233('0x1f')];var _0x58420c=_0x5885a5?_0x45fc24[_0x3233('0x22')]:_0x26a41e['offset']+_0x26a41e['limit'];var _0x5a6f13;if(_0x58420c>=_0x33f2e5){_0x58420c=_0x33f2e5;_0x5a6f13=0xc8;}else{_0x5a6f13=0xce;}_0xc71f65[_0x3233('0x1d')](_0x5a6f13);return _0xc71f65['set'](_0x3233('0x23'),_0x55fa30+'-'+_0x58420c+'/'+_0x33f2e5)['json'](_0x45fc24);}return null;};}function patchUpdates(_0x305227){return function(_0x161855){try{jsonpatch[_0x3233('0x24')](_0x161855,_0x305227,!![]);}catch(_0x42d311){return BPromise['reject'](_0x42d311);}return _0x161855[_0x3233('0x25')]();};}function saveUpdates(_0x2a9dd9,_0x56fa5a){return function(_0x531cd8){if(_0x531cd8){return _0x531cd8[_0x3233('0x26')](_0x2a9dd9)['then'](function(_0x199c37){return _0x199c37;});}return null;};}function removeEntity(_0xa73f3e,_0x43227e){return function(_0x4c3875){if(_0x4c3875){return _0x4c3875[_0x3233('0x27')]()['then'](function(){_0xa73f3e[_0x3233('0x1d')](0xcc)[_0x3233('0x1e')]();});}};}function handleEntityNotFound(_0x56f216,_0x3351d3){return function(_0x49a421){if(!_0x49a421){_0x56f216['sendStatus'](0x194);}return _0x49a421;};}function handleError(_0x430e8e,_0x39a345){_0x39a345=_0x39a345||0x1f4;return function(_0x5d8e63){logger[_0x3233('0x28')](_0x5d8e63[_0x3233('0x29')]);if(_0x5d8e63[_0x3233('0x2a')]){delete _0x5d8e63[_0x3233('0x2a')];}_0x430e8e[_0x3233('0x1d')](_0x39a345)['send'](_0x5d8e63);};}exports[_0x3233('0x2b')]=function(_0xd4171b,_0xabcf54){var _0xc87d63={'raw':!![],'where':{'id':_0xd4171b[_0x3233('0x2c')]['id']}},_0x233f6b={};_0x233f6b[_0x3233('0x2d')]=_[_0x3233('0x2e')](db[_0x3233('0x2f')]['rawAttributes']);_0x233f6b[_0x3233('0x30')]=_[_0x3233('0x2e')](_0xd4171b['query']);_0x233f6b[_0x3233('0x31')]=_[_0x3233('0x32')](_0x233f6b['model'],_0x233f6b[_0x3233('0x30')]);_0xc87d63[_0x3233('0x33')]=_['intersection'](_0x233f6b[_0x3233('0x2d')],qs[_0x3233('0x34')](_0xd4171b['query'][_0x3233('0x34')]));_0xc87d63[_0x3233('0x33')]=_0xc87d63['attributes']['length']?_0xc87d63[_0x3233('0x33')]:_0x233f6b['model'];if(_0xd4171b[_0x3233('0x30')][_0x3233('0x35')]){_0xc87d63['include']=[{'all':!![]}];}_0xc87d63=_[_0x3233('0x36')]({},_0xc87d63,_0xd4171b[_0x3233('0x37')]);return db[_0x3233('0x2f')][_0x3233('0x38')](_0xc87d63)[_0x3233('0x39')](handleEntityNotFound(_0xabcf54,null))[_0x3233('0x39')](respondWithResult(_0xabcf54,null))['catch'](handleError(_0xabcf54,null));};exports['update']=function(_0x33669b,_0x3c2ab8){if(_0x33669b['body']['id']){delete _0x33669b[_0x3233('0x3a')]['id'];}return db['ChatApplication'][_0x3233('0x38')]({'where':{'id':_0x33669b[_0x3233('0x2c')]['id']}})[_0x3233('0x39')](handleEntityNotFound(_0x3c2ab8,null))['then'](saveUpdates(_0x33669b[_0x3233('0x3a')],null))[_0x3233('0x39')](respondWithResult(_0x3c2ab8,null))[_0x3233('0x3b')](handleError(_0x3c2ab8,null));};exports['destroy']=function(_0x3edb85,_0x461eb7){return db[_0x3233('0x2f')][_0x3233('0x38')]({'where':{'id':_0x3edb85[_0x3233('0x2c')]['id']}})[_0x3233('0x39')](handleEntityNotFound(_0x461eb7,null))[_0x3233('0x39')](removeEntity(_0x461eb7,null))[_0x3233('0x3b')](handleError(_0x461eb7,null));}; \ No newline at end of file +var _0x1339=['rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','show','model','keys','ChatApplication','rawAttributes','query','intersection','attributes','fields','length','include','merge','find','body','catch','params','eml-format'];(function(_0x11fe8d,_0x19aba4){var _0x356099=function(_0x50c919){while(--_0x50c919){_0x11fe8d['push'](_0x11fe8d['shift']());}};_0x356099(++_0x19aba4);}(_0x1339,0x1bf));var _0x9133=function(_0x2807a6,_0x582501){_0x2807a6=_0x2807a6-0x0;var _0x53ed61=_0x1339[_0x2807a6];return _0x53ed61;};'use strict';var emlformat=require(_0x9133('0x0'));var rimraf=require(_0x9133('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9133('0x2'));var rp=require(_0x9133('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9133('0x4'));var util=require(_0x9133('0x5'));var path=require('path');var sox=require(_0x9133('0x6'));var csv=require(_0x9133('0x7'));var ejs=require(_0x9133('0x8'));var fs=require('fs');var fs_extra=require(_0x9133('0x9'));var _=require(_0x9133('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9133('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9133('0x7'));var querystring=require('querystring');var Papa=require(_0x9133('0xc'));var Redis=require('ioredis');var authService=require(_0x9133('0xd'));var qs=require(_0x9133('0xe'));var as=require(_0x9133('0xf'));var hardwareService=require(_0x9133('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x9133('0x11'));var licenseUtil=require(_0x9133('0x12'));var db=require(_0x9133('0x13'))['db'];function respondWithStatusCode(_0x54bfc7,_0x3048a5){_0x3048a5=_0x3048a5||0xcc;return function(_0x177239){if(_0x177239){return _0x54bfc7[_0x9133('0x14')](_0x3048a5);}return _0x54bfc7[_0x9133('0x15')](_0x3048a5)[_0x9133('0x16')]();};}function respondWithResult(_0x35edae,_0x8e9362){_0x8e9362=_0x8e9362||0xc8;return function(_0xb05b1c){if(_0xb05b1c){return _0x35edae[_0x9133('0x15')](_0x8e9362)['json'](_0xb05b1c);}};}function respondWithFilteredResult(_0x18c203,_0x57f4d9){return function(_0x555651){if(_0x555651){var _0x8e3461=typeof _0x57f4d9[_0x9133('0x17')]===_0x9133('0x18')&&typeof _0x57f4d9[_0x9133('0x19')]===_0x9133('0x18');var _0x26b12a=_0x555651[_0x9133('0x1a')];var _0x4aa4be=_0x8e3461?0x0:_0x57f4d9['offset'];var _0x3d5506=_0x8e3461?_0x555651[_0x9133('0x1a')]:_0x57f4d9[_0x9133('0x17')]+_0x57f4d9['limit'];var _0x5f4d4d;if(_0x3d5506>=_0x26b12a){_0x3d5506=_0x26b12a;_0x5f4d4d=0xc8;}else{_0x5f4d4d=0xce;}_0x18c203[_0x9133('0x15')](_0x5f4d4d);return _0x18c203[_0x9133('0x1b')](_0x9133('0x1c'),_0x4aa4be+'-'+_0x3d5506+'/'+_0x26b12a)[_0x9133('0x1d')](_0x555651);}return null;};}function patchUpdates(_0x307671){return function(_0x21720){try{jsonpatch[_0x9133('0x1e')](_0x21720,_0x307671,!![]);}catch(_0x24cce0){return BPromise[_0x9133('0x1f')](_0x24cce0);}return _0x21720[_0x9133('0x20')]();};}function saveUpdates(_0x2f5e77,_0x2219d7){return function(_0xeb79c1){if(_0xeb79c1){return _0xeb79c1[_0x9133('0x21')](_0x2f5e77)['then'](function(_0xdb994d){return _0xdb994d;});}return null;};}function removeEntity(_0xdc20d9,_0x4bf1ed){return function(_0x4f6c6a){if(_0x4f6c6a){return _0x4f6c6a[_0x9133('0x22')]()[_0x9133('0x23')](function(){_0xdc20d9[_0x9133('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbc4f92,_0x3a7c70){return function(_0x50d1da){if(!_0x50d1da){_0xbc4f92[_0x9133('0x14')](0x194);}return _0x50d1da;};}function handleError(_0x58907c,_0x552011){_0x552011=_0x552011||0x1f4;return function(_0x5a83e0){logger[_0x9133('0x24')](_0x5a83e0[_0x9133('0x25')]);if(_0x5a83e0['name']){delete _0x5a83e0[_0x9133('0x26')];}_0x58907c[_0x9133('0x15')](_0x552011)[_0x9133('0x27')](_0x5a83e0);};}exports[_0x9133('0x28')]=function(_0x52d0af,_0x276583){var _0x3f8b9b={'raw':!![],'where':{'id':_0x52d0af['params']['id']}},_0x3c8081={};_0x3c8081[_0x9133('0x29')]=_[_0x9133('0x2a')](db[_0x9133('0x2b')][_0x9133('0x2c')]);_0x3c8081[_0x9133('0x2d')]=_['keys'](_0x52d0af[_0x9133('0x2d')]);_0x3c8081['filters']=_[_0x9133('0x2e')](_0x3c8081[_0x9133('0x29')],_0x3c8081[_0x9133('0x2d')]);_0x3f8b9b[_0x9133('0x2f')]=_['intersection'](_0x3c8081[_0x9133('0x29')],qs[_0x9133('0x30')](_0x52d0af[_0x9133('0x2d')][_0x9133('0x30')]));_0x3f8b9b['attributes']=_0x3f8b9b[_0x9133('0x2f')][_0x9133('0x31')]?_0x3f8b9b[_0x9133('0x2f')]:_0x3c8081[_0x9133('0x29')];if(_0x52d0af[_0x9133('0x2d')]['includeAll']){_0x3f8b9b[_0x9133('0x32')]=[{'all':!![]}];}_0x3f8b9b=_[_0x9133('0x33')]({},_0x3f8b9b,_0x52d0af['options']);return db[_0x9133('0x2b')][_0x9133('0x34')](_0x3f8b9b)[_0x9133('0x23')](handleEntityNotFound(_0x276583,null))[_0x9133('0x23')](respondWithResult(_0x276583,null))['catch'](handleError(_0x276583,null));};exports[_0x9133('0x21')]=function(_0x55a860,_0x70d666){if(_0x55a860[_0x9133('0x35')]['id']){delete _0x55a860['body']['id'];}return db[_0x9133('0x2b')][_0x9133('0x34')]({'where':{'id':_0x55a860['params']['id']}})[_0x9133('0x23')](handleEntityNotFound(_0x70d666,null))[_0x9133('0x23')](saveUpdates(_0x55a860['body'],null))['then'](respondWithResult(_0x70d666,null))[_0x9133('0x36')](handleError(_0x70d666,null));};exports['destroy']=function(_0x31331b,_0x3f52ea){return db['ChatApplication'][_0x9133('0x34')]({'where':{'id':_0x31331b[_0x9133('0x37')]['id']}})['then'](handleEntityNotFound(_0x3f52ea,null))[_0x9133('0x23')](removeEntity(_0x3f52ea,null))[_0x9133('0x36')](handleError(_0x3f52ea,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 257e639..acb0c4a 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 _0x5c71=['moment','bluebird','path','exports','define','ChatApplication','chat_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x4c53b7,_0x5af6a4){var _0x10653c=function(_0x359903){while(--_0x359903){_0x4c53b7['push'](_0x4c53b7['shift']());}};_0x10653c(++_0x5af6a4);}(_0x5c71,0x188));var _0x15c7=function(_0x41348e,_0x2d14a2){_0x41348e=_0x41348e-0x0;var _0x27891e=_0x5c71[_0x41348e];return _0x27891e;};'use strict';var _=require(_0x15c7('0x0'));var util=require(_0x15c7('0x1'));var logger=require(_0x15c7('0x2'))(_0x15c7('0x3'));var moment=require(_0x15c7('0x4'));var BPromise=require(_0x15c7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x15c7('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatApplication.attributes');module[_0x15c7('0x7')]=function(_0x48fba1,_0xd64778){return _0x48fba1[_0x15c7('0x8')](_0x15c7('0x9'),attributes,{'tableName':_0x15c7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x15c7('0xb')});}; \ No newline at end of file +var _0x265f=['define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','./chatApplication.attributes','exports'];(function(_0x55d4fc,_0x56e45e){var _0x241b2=function(_0x362796){while(--_0x362796){_0x55d4fc['push'](_0x55d4fc['shift']());}};_0x241b2(++_0x56e45e);}(_0x265f,0x1e1));var _0xf265=function(_0x1aa13e,_0x12a40b){_0x1aa13e=_0x1aa13e-0x0;var _0x1144bd=_0x265f[_0x1aa13e];return _0x1144bd;};'use strict';var _=require(_0xf265('0x0'));var util=require(_0xf265('0x1'));var logger=require(_0xf265('0x2'))('api');var moment=require(_0xf265('0x3'));var BPromise=require(_0xf265('0x4'));var rp=require(_0xf265('0x5'));var fs=require('fs');var path=require(_0xf265('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf265('0x7'));module[_0xf265('0x8')]=function(_0x517063,_0x3842fd){return _0x517063[_0xf265('0x9')](_0xf265('0xa'),attributes,{'tableName':_0xf265('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf265('0xc'),'collate':_0xf265('0xd')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 91ca95c..57d739e 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 _0x7d70=['../../config/logger','../../config/environment','jayson/promise','info','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x7d70,0x129));var _0x07d7=function(_0x291c9b,_0x239710){_0x291c9b=_0x291c9b-0x0;var _0x204bb2=_0x7d70[_0x291c9b];return _0x204bb2;};'use strict';var _=require(_0x07d7('0x0'));var util=require(_0x07d7('0x1'));var moment=require(_0x07d7('0x2'));var BPromise=require('bluebird');var rs=require(_0x07d7('0x3'));var fs=require('fs');var Redis=require(_0x07d7('0x4'));var db=require(_0x07d7('0x5'))['db'];var utils=require(_0x07d7('0x6'));var logger=require(_0x07d7('0x7'))('rpc');var config=require(_0x07d7('0x8'));var jayson=require(_0x07d7('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x43df4f,_0x17b7b7,_0x181a64){return new BPromise(function(_0x44b935,_0x55b96b){return client['request'](_0x43df4f,_0x181a64)['then'](function(_0x4c8710){logger[_0x07d7('0xa')](_0x07d7('0xb'),_0x17b7b7,_0x07d7('0xc'));logger['debug'](_0x07d7('0xd'),_0x17b7b7,_0x07d7('0xc'),JSON[_0x07d7('0xe')](_0x4c8710));if(_0x4c8710[_0x07d7('0xf')]){if(_0x4c8710[_0x07d7('0xf')][_0x07d7('0x10')]===0x1f4){logger[_0x07d7('0xf')](_0x07d7('0xb'),_0x17b7b7,_0x4c8710[_0x07d7('0xf')][_0x07d7('0x11')]);return _0x55b96b(_0x4c8710[_0x07d7('0xf')][_0x07d7('0x11')]);}logger[_0x07d7('0xf')]('ChatApplication,\x20%s,\x20%s',_0x17b7b7,_0x4c8710[_0x07d7('0xf')][_0x07d7('0x11')]);return _0x44b935(_0x4c8710['error'][_0x07d7('0x11')]);}else{logger[_0x07d7('0xa')]('ChatApplication,\x20%s,\x20%s',_0x17b7b7,_0x07d7('0xc'));_0x44b935(_0x4c8710[_0x07d7('0x12')][_0x07d7('0x11')]);}})['catch'](function(_0x4c083c){logger[_0x07d7('0xf')](_0x07d7('0xb'),_0x17b7b7,_0x4c083c);_0x55b96b(_0x4c083c);});});} \ No newline at end of file +var _0x06c1=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','../../config/utils'];(function(_0x3e0d81,_0x258d37){var _0x1fa8ca=function(_0x1997a2){while(--_0x1997a2){_0x3e0d81['push'](_0x3e0d81['shift']());}};_0x1fa8ca(++_0x258d37);}(_0x06c1,0x137));var _0x106c=function(_0xaf5a6c,_0x1b9406){_0xaf5a6c=_0xaf5a6c-0x0;var _0x56e446=_0x06c1[_0xaf5a6c];return _0x56e446;};'use strict';var _=require(_0x106c('0x0'));var util=require(_0x106c('0x1'));var moment=require(_0x106c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x106c('0x3'));var logger=require(_0x106c('0x4'))(_0x106c('0x5'));var config=require(_0x106c('0x6'));var jayson=require(_0x106c('0x7'));var client=jayson[_0x106c('0x8')][_0x106c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ec91b,_0xae9137,_0xe86152){return new BPromise(function(_0x15873e,_0x44a42d){return client[_0x106c('0xa')](_0x1ec91b,_0xe86152)[_0x106c('0xb')](function(_0x5cbfc1){logger[_0x106c('0xc')](_0x106c('0xd'),_0xae9137,_0x106c('0xe'));logger['debug'](_0x106c('0xf'),_0xae9137,_0x106c('0xe'),JSON[_0x106c('0x10')](_0x5cbfc1));if(_0x5cbfc1['error']){if(_0x5cbfc1[_0x106c('0x11')][_0x106c('0x12')]===0x1f4){logger[_0x106c('0x11')](_0x106c('0xd'),_0xae9137,_0x5cbfc1[_0x106c('0x11')][_0x106c('0x13')]);return _0x44a42d(_0x5cbfc1['error']['message']);}logger[_0x106c('0x11')](_0x106c('0xd'),_0xae9137,_0x5cbfc1[_0x106c('0x11')][_0x106c('0x13')]);return _0x15873e(_0x5cbfc1[_0x106c('0x11')][_0x106c('0x13')]);}else{logger[_0x106c('0xc')]('ChatApplication,\x20%s,\x20%s',_0xae9137,'request\x20sent');_0x15873e(_0x5cbfc1['result'][_0x106c('0x13')]);}})[_0x106c('0x14')](function(_0x1c1995){logger[_0x106c('0x11')](_0x106c('0xd'),_0xae9137,_0x1c1995);_0x44a42d(_0x1c1995);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index d4c1060..8bb5c59 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 _0xb19a=['multer','path','connect-timeout','express','Router','../../components/interaction/service','./chatApplication.controller','get','/:id','isAuthenticated','put','update','delete','destroy','exports'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xb19a,0x177));var _0xab19=function(_0xf9e153,_0x12d3ae){_0xf9e153=_0xf9e153-0x0;var _0x5e1a44=_0xb19a[_0xf9e153];return _0x5e1a44;};'use strict';var multer=require(_0xab19('0x0'));var util=require('util');var path=require(_0xab19('0x1'));var timeout=require(_0xab19('0x2'));var express=require(_0xab19('0x3'));var router=express[_0xab19('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xab19('0x5'));var config=require('../../config/environment');var controller=require(_0xab19('0x6'));router[_0xab19('0x7')](_0xab19('0x8'),auth[_0xab19('0x9')](),controller['show']);router[_0xab19('0xa')](_0xab19('0x8'),auth[_0xab19('0x9')](),controller[_0xab19('0xb')]);router[_0xab19('0xc')](_0xab19('0x8'),auth['isAuthenticated'](),controller[_0xab19('0xd')]);module[_0xab19('0xe')]=router; \ No newline at end of file +var _0xf0d7=['exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','put','isAuthenticated','update','delete','destroy'];(function(_0xfb8e9c,_0x4bfaec){var _0x432968=function(_0x574cce){while(--_0x574cce){_0xfb8e9c['push'](_0xfb8e9c['shift']());}};_0x432968(++_0x4bfaec);}(_0xf0d7,0xb1));var _0x7f0d=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xf0d7[_0x618414];return _0x21c19a;};'use strict';var multer=require('multer');var util=require(_0x7f0d('0x0'));var path=require('path');var timeout=require(_0x7f0d('0x1'));var express=require(_0x7f0d('0x2'));var router=express[_0x7f0d('0x3')]();var fs_extra=require(_0x7f0d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7f0d('0x5'));var config=require(_0x7f0d('0x6'));var controller=require(_0x7f0d('0x7'));router[_0x7f0d('0x8')](_0x7f0d('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x7f0d('0xa')](_0x7f0d('0x9'),auth[_0x7f0d('0xb')](),controller[_0x7f0d('0xc')]);router[_0x7f0d('0xd')](_0x7f0d('0x9'),auth[_0x7f0d('0xb')](),controller[_0x7f0d('0xe')]);module[_0x7f0d('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 7acb367..36791d1 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 _0xde74=['sequelize','exports','STRING'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0xde74,0x1c8));var _0x4de7=function(_0x20f204,_0x4d9187){_0x20f204=_0x20f204-0x0;var _0x4a48f4=_0xde74[_0x20f204];return _0x4a48f4;};'use strict';var Sequelize=require(_0x4de7('0x0'));module[_0x4de7('0x1')]={'name':{'type':Sequelize[_0x4de7('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xa53e=['sequelize','STRING'];(function(_0x253a03,_0xac1b){var _0x355862=function(_0x12c250){while(--_0x12c250){_0x253a03['push'](_0x253a03['shift']());}};_0x355862(++_0xac1b);}(_0xa53e,0xe6));var _0xea53=function(_0x3c5daf,_0xce52bf){_0x3c5daf=_0x3c5daf-0x0;var _0x5d48d7=_0xa53e[_0x3c5daf];return _0x5d48d7;};'use strict';var Sequelize=require(_0xea53('0x0'));module['exports']={'name':{'type':Sequelize[_0xea53('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xea53('0x1')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 0ff5244..f0e9808 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 _0x5650=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','offset','limit','undefined','count','set','json','save','update','then','destroy','end','error','stack','name','send','map','ChatGroup','fieldName','keys','query','filters','intersection','model','attributes','fields','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','length','hasOwnProperty','nolimit','removeMembers','addMessage','ChatGroupId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x14d896,_0x53578b){var _0x28679a=function(_0x14921f){while(--_0x14921f){_0x14d896['push'](_0x14d896['shift']());}};_0x28679a(++_0x53578b);}(_0x5650,0xba));var _0x0565=function(_0x2fa393,_0x57e26d){_0x2fa393=_0x2fa393-0x0;var _0x15a4fb=_0x5650[_0x2fa393];return _0x15a4fb;};'use strict';var emlformat=require(_0x0565('0x0'));var rimraf=require(_0x0565('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0565('0x2'));var rp=require(_0x0565('0x3'));var moment=require(_0x0565('0x4'));var BPromise=require(_0x0565('0x5'));var Mustache=require('mustache');var util=require(_0x0565('0x6'));var path=require(_0x0565('0x7'));var sox=require(_0x0565('0x8'));var csv=require('to-csv');var ejs=require(_0x0565('0x9'));var fs=require('fs');var fs_extra=require(_0x0565('0xa'));var _=require('lodash');var squel=require(_0x0565('0xb'));var crypto=require(_0x0565('0xc'));var jsforce=require(_0x0565('0xd'));var deskjs=require(_0x0565('0xe'));var toCsv=require(_0x0565('0xf'));var querystring=require(_0x0565('0x10'));var Papa=require(_0x0565('0x11'));var Redis=require(_0x0565('0x12'));var authService=require(_0x0565('0x13'));var qs=require(_0x0565('0x14'));var as=require(_0x0565('0x15'));var hardwareService=require(_0x0565('0x16'));var logger=require('../../config/logger')(_0x0565('0x17'));var utils=require(_0x0565('0x18'));var config=require(_0x0565('0x19'));var licenseUtil=require(_0x0565('0x1a'));var db=require(_0x0565('0x1b'))['db'];config[_0x0565('0x1c')]=_[_0x0565('0x1d')](config['redis'],{'host':_0x0565('0x1e'),'port':0x18eb});var socket=require(_0x0565('0x1f'))(new Redis(config[_0x0565('0x1c')]));require(_0x0565('0x20'))[_0x0565('0x21')](socket);function respondWithStatusCode(_0x58cc35,_0x37ba38){_0x37ba38=_0x37ba38||0xcc;return function(_0x4d51a0){if(_0x4d51a0){return _0x58cc35[_0x0565('0x22')](_0x37ba38);}return _0x58cc35[_0x0565('0x23')](_0x37ba38)['end']();};}function respondWithResult(_0x134d3c,_0x2c7fa6){_0x2c7fa6=_0x2c7fa6||0xc8;return function(_0x478db6){if(_0x478db6){return _0x134d3c[_0x0565('0x23')](_0x2c7fa6)['json'](_0x478db6);}};}function respondWithFilteredResult(_0x59f196,_0xf21ac6){return function(_0x73cdd4){if(_0x73cdd4){var _0x484e29=typeof _0xf21ac6[_0x0565('0x24')]==='undefined'&&typeof _0xf21ac6[_0x0565('0x25')]===_0x0565('0x26');var _0x131c5f=_0x73cdd4[_0x0565('0x27')];var _0x47bb38=_0x484e29?0x0:_0xf21ac6[_0x0565('0x24')];var _0x1b4074=_0x484e29?_0x73cdd4['count']:_0xf21ac6[_0x0565('0x24')]+_0xf21ac6[_0x0565('0x25')];var _0x39bdba;if(_0x1b4074>=_0x131c5f){_0x1b4074=_0x131c5f;_0x39bdba=0xc8;}else{_0x39bdba=0xce;}_0x59f196[_0x0565('0x23')](_0x39bdba);return _0x59f196[_0x0565('0x28')]('Content-Range',_0x47bb38+'-'+_0x1b4074+'/'+_0x131c5f)[_0x0565('0x29')](_0x73cdd4);}return null;};}function patchUpdates(_0x2185e6){return function(_0x511745){try{jsonpatch['apply'](_0x511745,_0x2185e6,!![]);}catch(_0x5771bc){return BPromise['reject'](_0x5771bc);}return _0x511745[_0x0565('0x2a')]();};}function saveUpdates(_0x3fa9d7,_0x2f724b){return function(_0x4b48b6){if(_0x4b48b6){return _0x4b48b6[_0x0565('0x2b')](_0x3fa9d7)[_0x0565('0x2c')](function(_0x17d71b){return _0x17d71b;});}return null;};}function removeEntity(_0x3c8f6f,_0x3c5a3e){return function(_0x41c4d2){if(_0x41c4d2){return _0x41c4d2[_0x0565('0x2d')]()['then'](function(){_0x3c8f6f[_0x0565('0x23')](0xcc)[_0x0565('0x2e')]();});}};}function handleEntityNotFound(_0x42bfeb,_0x3d800){return function(_0x14c950){if(!_0x14c950){_0x42bfeb[_0x0565('0x22')](0x194);}return _0x14c950;};}function handleError(_0x5f24d8,_0x412a90){_0x412a90=_0x412a90||0x1f4;return function(_0x4c905e){logger[_0x0565('0x2f')](_0x4c905e[_0x0565('0x30')]);if(_0x4c905e[_0x0565('0x31')]){delete _0x4c905e[_0x0565('0x31')];}_0x5f24d8[_0x0565('0x23')](_0x412a90)[_0x0565('0x32')](_0x4c905e);};}exports['index']=function(_0x2ffd7c,_0xc8feec){var _0x340ca0={},_0x2359a3={},_0x2446fd={'count':0x0,'rows':[]};var _0x156d50=_[_0x0565('0x33')](db[_0x0565('0x34')]['rawAttributes'],function(_0x4dded8){return{'name':_0x4dded8[_0x0565('0x35')],'type':_0x4dded8['type']['key']};});_0x2359a3['model']=_['map'](_0x156d50,_0x0565('0x31'));_0x2359a3['query']=_[_0x0565('0x36')](_0x2ffd7c[_0x0565('0x37')]);_0x2359a3[_0x0565('0x38')]=_[_0x0565('0x39')](_0x2359a3[_0x0565('0x3a')],_0x2359a3[_0x0565('0x37')]);_0x340ca0[_0x0565('0x3b')]=_[_0x0565('0x39')](_0x2359a3['model'],qs[_0x0565('0x3c')](_0x2ffd7c[_0x0565('0x37')][_0x0565('0x3c')]));_0x340ca0[_0x0565('0x3b')]=_0x340ca0[_0x0565('0x3b')]['length']?_0x340ca0[_0x0565('0x3b')]:_0x2359a3[_0x0565('0x3a')];if(!_0x2ffd7c[_0x0565('0x37')]['hasOwnProperty']('nolimit')){_0x340ca0[_0x0565('0x25')]=qs[_0x0565('0x25')](_0x2ffd7c[_0x0565('0x37')]['limit']);_0x340ca0[_0x0565('0x24')]=qs['offset'](_0x2ffd7c[_0x0565('0x37')]['offset']);}_0x340ca0[_0x0565('0x3d')]=qs[_0x0565('0x3e')](_0x2ffd7c[_0x0565('0x37')][_0x0565('0x3e')]);_0x340ca0[_0x0565('0x3f')]=qs['filters'](_[_0x0565('0x40')](_0x2ffd7c[_0x0565('0x37')],_0x2359a3[_0x0565('0x38')]),_0x156d50);if(_0x2ffd7c['query']['filter']){_0x340ca0[_0x0565('0x3f')]=_[_0x0565('0x41')](_0x340ca0[_0x0565('0x3f')],{'$or':_[_0x0565('0x33')](_0x156d50,function(_0x17096b){if(_0x17096b[_0x0565('0x42')]!==_0x0565('0x43')){var _0xbd32c5={};_0xbd32c5[_0x17096b[_0x0565('0x31')]]={'$like':'%'+_0x2ffd7c[_0x0565('0x37')][_0x0565('0x44')]+'%'};return _0xbd32c5;}})});}_0x340ca0=_[_0x0565('0x41')]({},_0x340ca0,_0x2ffd7c[_0x0565('0x45')]);var _0x415825={'where':_0x340ca0[_0x0565('0x3f')]};return db['ChatGroup'][_0x0565('0x27')](_0x415825)[_0x0565('0x2c')](function(_0x34a770){_0x2446fd[_0x0565('0x27')]=_0x34a770;if(_0x2ffd7c[_0x0565('0x37')][_0x0565('0x46')]){_0x340ca0[_0x0565('0x47')]=[{'all':!![]}];}return db[_0x0565('0x34')][_0x0565('0x48')](_0x340ca0);})[_0x0565('0x2c')](function(_0x1c006a){_0x2446fd[_0x0565('0x49')]=_0x1c006a;return _0x2446fd;})['then'](respondWithFilteredResult(_0xc8feec,_0x340ca0))['catch'](handleError(_0xc8feec,null));};exports[_0x0565('0x4a')]=function(_0x258759,_0x36856c){var _0x50e47d={'raw':!![],'where':{'id':_0x258759[_0x0565('0x4b')]['id']}},_0x4b0797={};_0x4b0797[_0x0565('0x3a')]=_[_0x0565('0x36')](db[_0x0565('0x34')][_0x0565('0x4c')]);_0x4b0797[_0x0565('0x37')]=_[_0x0565('0x36')](_0x258759[_0x0565('0x37')]);_0x4b0797[_0x0565('0x38')]=_[_0x0565('0x39')](_0x4b0797[_0x0565('0x3a')],_0x4b0797[_0x0565('0x37')]);_0x50e47d['attributes']=_['intersection'](_0x4b0797['model'],qs[_0x0565('0x3c')](_0x258759[_0x0565('0x37')][_0x0565('0x3c')]));_0x50e47d[_0x0565('0x3b')]=_0x50e47d['attributes']['length']?_0x50e47d[_0x0565('0x3b')]:_0x4b0797['model'];if(_0x258759['query'][_0x0565('0x46')]){_0x50e47d[_0x0565('0x47')]=[{'all':!![]}];}_0x50e47d=_[_0x0565('0x41')]({},_0x50e47d,_0x258759[_0x0565('0x45')]);return db[_0x0565('0x34')][_0x0565('0x4d')](_0x50e47d)[_0x0565('0x2c')](handleEntityNotFound(_0x36856c,null))['then'](respondWithResult(_0x36856c,null))[_0x0565('0x4e')](handleError(_0x36856c,null));};exports['create']=function(_0x5d3751,_0x3f9139){return db['ChatGroup'][_0x0565('0x4f')](_0x5d3751['body'],{})[_0x0565('0x2c')](respondWithResult(_0x3f9139,0xc9))[_0x0565('0x4e')](handleError(_0x3f9139,null));};exports[_0x0565('0x2b')]=function(_0x1406b4,_0x5a245e){if(_0x1406b4[_0x0565('0x50')]['id']){delete _0x1406b4[_0x0565('0x50')]['id'];}return db[_0x0565('0x34')][_0x0565('0x4d')]({'where':{'id':_0x1406b4[_0x0565('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5a245e,null))['then'](saveUpdates(_0x1406b4[_0x0565('0x50')],null))['then'](respondWithResult(_0x5a245e,null))[_0x0565('0x4e')](handleError(_0x5a245e,null));};exports[_0x0565('0x2d')]=function(_0x4f1133,_0x3791eb){return db[_0x0565('0x34')][_0x0565('0x4d')]({'where':{'id':_0x4f1133['params']['id']}})['then'](handleEntityNotFound(_0x3791eb,null))[_0x0565('0x2c')](removeEntity(_0x3791eb,null))[_0x0565('0x4e')](handleError(_0x3791eb,null));};exports[_0x0565('0x51')]=function(_0x2643a8,_0x53b455){return db['ChatGroup'][_0x0565('0x51')]()[_0x0565('0x2c')](respondWithResult(_0x53b455,null))[_0x0565('0x4e')](handleError(_0x53b455,null));};exports[_0x0565('0x52')]=function(_0x1907bc,_0x393f15,_0x36be8e){return db[_0x0565('0x53')][_0x0565('0x27')]({'where':{'ChatGroupId':_0x1907bc[_0x0565('0x4b')]['id'],'ToId':_0x1907bc[_0x0565('0x54')]['id'],'read':![]}})[_0x0565('0x2c')](function(_0x2a01d4){return{'id':_[_0x0565('0x55')](_0x1907bc[_0x0565('0x4b')]['id']),'count':_0x2a01d4};})[_0x0565('0x2c')](respondWithResult(_0x393f15,null))[_0x0565('0x4e')](handleError(_0x393f15,null));};exports[_0x0565('0x56')]=function(_0xfa4fb3,_0x5c4f75,_0x1719be){return db[_0x0565('0x34')][_0x0565('0x4d')]({'where':{'id':_0xfa4fb3[_0x0565('0x4b')]['id']}})[_0x0565('0x2c')](handleEntityNotFound(_0x5c4f75,null))[_0x0565('0x2c')](function(_0x59440f){if(_0x59440f){return _0x59440f[_0x0565('0x56')](_0xfa4fb3[_0x0565('0x50')][_0x0565('0x57')],_[_0x0565('0x58')](_0xfa4fb3[_0x0565('0x50')],[_0x0565('0x57'),'id'])||{});}})[_0x0565('0x2c')](respondWithResult(_0x5c4f75,null))['catch'](handleError(_0x5c4f75,null));};exports[_0x0565('0x59')]=function(_0x366222,_0x29d123,_0x25f7d5){var _0x53d394={};var _0x37dcdd={};var _0x311996;var _0x18b6e6;return db[_0x0565('0x34')][_0x0565('0x5a')]({'where':{'id':_0x366222['params']['id']}})[_0x0565('0x2c')](handleEntityNotFound(_0x29d123,null))[_0x0565('0x2c')](function(_0x4c683b){if(_0x4c683b){_0x311996=_0x4c683b;_0x37dcdd[_0x0565('0x3a')]=_[_0x0565('0x36')](db[_0x0565('0x5b')][_0x0565('0x4c')]);_0x37dcdd[_0x0565('0x37')]=_[_0x0565('0x36')](_0x366222['query']);_0x37dcdd[_0x0565('0x38')]=_[_0x0565('0x39')](_0x37dcdd['model'],_0x37dcdd[_0x0565('0x37')]);_0x53d394[_0x0565('0x3b')]=_['intersection'](_0x37dcdd['model'],qs[_0x0565('0x3c')](_0x366222[_0x0565('0x37')]['fields']));_0x53d394['attributes']=_0x53d394[_0x0565('0x3b')]['length']?_0x53d394['attributes']:_0x37dcdd[_0x0565('0x3a')];_0x53d394[_0x0565('0x3d')]=qs['sort'](_0x366222['query']['sort']);_0x53d394['where']=qs[_0x0565('0x38')](_[_0x0565('0x40')](_0x366222['query'],_0x37dcdd[_0x0565('0x38')]));if(_0x366222[_0x0565('0x37')][_0x0565('0x44')]){_0x53d394[_0x0565('0x3f')]=_[_0x0565('0x41')](_0x53d394['where'],{'$or':_[_0x0565('0x33')](_0x53d394[_0x0565('0x3b')],function(_0x120a66){var _0x4f99fe={};_0x4f99fe[_0x120a66]={'$like':'%'+_0x366222[_0x0565('0x37')][_0x0565('0x44')]+'%'};return _0x4f99fe;})});}_0x53d394=_[_0x0565('0x41')]({},_0x53d394,_0x366222[_0x0565('0x45')]);return _0x311996[_0x0565('0x59')](_0x53d394);}})[_0x0565('0x2c')](function(_0x58fd33){if(_0x58fd33){_0x18b6e6=_0x58fd33[_0x0565('0x5c')];if(!_0x366222['query'][_0x0565('0x5d')](_0x0565('0x5e'))){_0x53d394[_0x0565('0x25')]=qs[_0x0565('0x25')](_0x366222[_0x0565('0x37')][_0x0565('0x25')]);_0x53d394[_0x0565('0x24')]=qs[_0x0565('0x24')](_0x366222[_0x0565('0x37')]['offset']);}return _0x311996[_0x0565('0x59')](_0x53d394);}})['then'](function(_0x44efe8){if(_0x44efe8){return _0x44efe8?{'count':_0x18b6e6,'rows':_0x44efe8}:null;}})['then'](respondWithResult(_0x29d123,null))['catch'](handleError(_0x29d123,null));};exports[_0x0565('0x5f')]=function(_0x27e4bb,_0x3926a7,_0x410f42){return db[_0x0565('0x34')][_0x0565('0x4d')]({'where':{'id':_0x27e4bb['params']['id']}})[_0x0565('0x2c')](handleEntityNotFound(_0x3926a7,null))['then'](function(_0x538b93){if(_0x538b93){return _0x538b93[_0x0565('0x5f')](_0x27e4bb[_0x0565('0x37')][_0x0565('0x57')]);}})[_0x0565('0x2c')](respondWithStatusCode(_0x3926a7,null))[_0x0565('0x4e')](handleError(_0x3926a7,null));};exports[_0x0565('0x60')]=function(_0x1d42d4,_0x693fed,_0x522da4){if(_0x1d42d4['body']['id']){delete _0x1d42d4[_0x0565('0x50')]['id'];}return db[_0x0565('0x34')][_0x0565('0x4d')]({'where':{'id':_0x1d42d4[_0x0565('0x4b')]['id']}})[_0x0565('0x2c')](handleEntityNotFound(_0x693fed,null))['then'](function(_0x2dbabe){if(_0x2dbabe){_0x1d42d4[_0x0565('0x50')][_0x0565('0x61')]=_0x2dbabe['id'];return db[_0x0565('0x53')][_0x0565('0x4f')](_0x1d42d4[_0x0565('0x50')]);}})[_0x0565('0x2c')](respondWithResult(_0x693fed,null))[_0x0565('0x4e')](handleError(_0x693fed,null));};exports['getMessages']=function(_0x4e84f9,_0x126e0e,_0x30551f){var _0x2afae0={};var _0x24ec09={};var _0x49f37e;var _0x5cdbf4;return db[_0x0565('0x34')][_0x0565('0x5a')]({'where':{'id':_0x4e84f9[_0x0565('0x4b')]['id']}})[_0x0565('0x2c')](handleEntityNotFound(_0x126e0e,null))[_0x0565('0x2c')](function(_0x2aa8f1){if(_0x2aa8f1){_0x49f37e=_0x2aa8f1;_0x24ec09[_0x0565('0x3a')]=_[_0x0565('0x36')](db['ChatInternalMessage'][_0x0565('0x4c')]);_0x24ec09[_0x0565('0x37')]=_[_0x0565('0x36')](_0x4e84f9['query']);_0x24ec09[_0x0565('0x38')]=_['intersection'](_0x24ec09['model'],_0x24ec09[_0x0565('0x37')]);_0x2afae0[_0x0565('0x3b')]=_['intersection'](_0x24ec09[_0x0565('0x3a')],qs[_0x0565('0x3c')](_0x4e84f9[_0x0565('0x37')]['fields']));_0x2afae0[_0x0565('0x3b')]=_0x2afae0[_0x0565('0x3b')][_0x0565('0x5c')]?_0x2afae0['attributes']:_0x24ec09[_0x0565('0x3a')];_0x2afae0[_0x0565('0x3d')]=qs[_0x0565('0x3e')](_0x4e84f9['query'][_0x0565('0x3e')]);_0x2afae0['where']=qs[_0x0565('0x38')](_[_0x0565('0x40')](_0x4e84f9[_0x0565('0x37')],_0x24ec09[_0x0565('0x38')]));if(_0x4e84f9[_0x0565('0x37')][_0x0565('0x44')]){_0x2afae0[_0x0565('0x3f')]=_[_0x0565('0x41')](_0x2afae0[_0x0565('0x3f')],{'$or':_[_0x0565('0x33')](_0x2afae0[_0x0565('0x3b')],function(_0x1226a8){var _0xe21df3={};_0xe21df3[_0x1226a8]={'$like':'%'+_0x4e84f9[_0x0565('0x37')][_0x0565('0x44')]+'%'};return _0xe21df3;})});}if(_0x4e84f9[_0x0565('0x37')][_0x0565('0x62')]){var _0x6ac547=_0x4e84f9[_0x0565('0x37')]['$gte'][_0x0565('0x63')](',');var _0x161b9c={};_0x161b9c[_0x6ac547[0x0]]={'$gte':moment(_0x6ac547[0x1])[_0x0565('0x64')](_0x0565('0x65'))};_0x2afae0[_0x0565('0x3f')]=_['merge'](_0x2afae0[_0x0565('0x3f')],_0x161b9c);}_0x2afae0=_[_0x0565('0x41')]({},_0x2afae0,_0x4e84f9['options']);return _0x49f37e['getMessages'](_0x2afae0);}})[_0x0565('0x2c')](function(_0xfb0b4c){if(_0xfb0b4c){_0x5cdbf4=_0xfb0b4c[_0x0565('0x5c')];if(!_0x4e84f9['query']['hasOwnProperty'](_0x0565('0x5e'))){_0x2afae0['limit']=qs['limit'](_0x4e84f9[_0x0565('0x37')][_0x0565('0x25')]);_0x2afae0['offset']=qs[_0x0565('0x24')](_0x4e84f9[_0x0565('0x37')][_0x0565('0x24')]);}return _0x49f37e[_0x0565('0x66')](_0x2afae0);}})[_0x0565('0x2c')](function(_0x3424c6){if(_0x3424c6){return _0x3424c6?{'count':_0x5cdbf4,'rows':_0x3424c6}:null;}})[_0x0565('0x2c')](respondWithResult(_0x126e0e,null))['catch'](handleError(_0x126e0e,null));}; \ No newline at end of file +var _0x440b=['attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','map','VIRTUAL','options','include','ChatGroup','rows','catch','show','params','keys','length','includeAll','find','create','body','destroy','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','omit','findOne','User','order','filter','getMembers','removeMembers','ids','addMessage','ChatGroupId','getMessages','$gte','split','format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','undefined','count','offset','limit','set','update','then','error','name','send','index','rawAttributes','type','key','model','query','filters','intersection'];(function(_0x5bb7c8,_0x43c255){var _0x4ba624=function(_0x301223){while(--_0x301223){_0x5bb7c8['push'](_0x5bb7c8['shift']());}};_0x4ba624(++_0x43c255);}(_0x440b,0x8a));var _0xb440=function(_0x4030d4,_0x336ab2){_0x4030d4=_0x4030d4-0x0;var _0x342e02=_0x440b[_0x4030d4];return _0x342e02;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb440('0x0'));var zipdir=require(_0xb440('0x1'));var jsonpatch=require(_0xb440('0x2'));var rp=require(_0xb440('0x3'));var moment=require('moment');var BPromise=require(_0xb440('0x4'));var Mustache=require('mustache');var util=require(_0xb440('0x5'));var path=require(_0xb440('0x6'));var sox=require(_0xb440('0x7'));var csv=require('to-csv');var ejs=require(_0xb440('0x8'));var fs=require('fs');var fs_extra=require(_0xb440('0x9'));var _=require(_0xb440('0xa'));var squel=require(_0xb440('0xb'));var crypto=require('crypto');var jsforce=require(_0xb440('0xc'));var deskjs=require(_0xb440('0xd'));var toCsv=require(_0xb440('0xe'));var querystring=require(_0xb440('0xf'));var Papa=require(_0xb440('0x10'));var Redis=require(_0xb440('0x11'));var authService=require(_0xb440('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb440('0x13'));var logger=require(_0xb440('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xb440('0x15'));var licenseUtil=require(_0xb440('0x16'));var db=require(_0xb440('0x17'))['db'];config['redis']=_[_0xb440('0x18')](config[_0xb440('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xb440('0x1a'))(new Redis(config[_0xb440('0x19')]));require(_0xb440('0x1b'))[_0xb440('0x1c')](socket);function respondWithStatusCode(_0x4acf64,_0x57b8f2){_0x57b8f2=_0x57b8f2||0xcc;return function(_0x462f00){if(_0x462f00){return _0x4acf64[_0xb440('0x1d')](_0x57b8f2);}return _0x4acf64[_0xb440('0x1e')](_0x57b8f2)[_0xb440('0x1f')]();};}function respondWithResult(_0x5e2522,_0x1d0585){_0x1d0585=_0x1d0585||0xc8;return function(_0x46c7d4){if(_0x46c7d4){return _0x5e2522[_0xb440('0x1e')](_0x1d0585)['json'](_0x46c7d4);}};}function respondWithFilteredResult(_0x32fbe3,_0x49673d){return function(_0x1b6341){if(_0x1b6341){var _0x555aa6=typeof _0x49673d['offset']===_0xb440('0x20')&&typeof _0x49673d['limit']===_0xb440('0x20');var _0x1fb9f8=_0x1b6341[_0xb440('0x21')];var _0x12d575=_0x555aa6?0x0:_0x49673d['offset'];var _0x5701a1=_0x555aa6?_0x1b6341[_0xb440('0x21')]:_0x49673d[_0xb440('0x22')]+_0x49673d[_0xb440('0x23')];var _0x352fdb;if(_0x5701a1>=_0x1fb9f8){_0x5701a1=_0x1fb9f8;_0x352fdb=0xc8;}else{_0x352fdb=0xce;}_0x32fbe3[_0xb440('0x1e')](_0x352fdb);return _0x32fbe3[_0xb440('0x24')]('Content-Range',_0x12d575+'-'+_0x5701a1+'/'+_0x1fb9f8)['json'](_0x1b6341);}return null;};}function patchUpdates(_0xe9a5cf){return function(_0x1d54c6){try{jsonpatch['apply'](_0x1d54c6,_0xe9a5cf,!![]);}catch(_0x287ddd){return BPromise['reject'](_0x287ddd);}return _0x1d54c6['save']();};}function saveUpdates(_0x43ce77,_0x4c97da){return function(_0x3056fe){if(_0x3056fe){return _0x3056fe[_0xb440('0x25')](_0x43ce77)[_0xb440('0x26')](function(_0x32cae3){return _0x32cae3;});}return null;};}function removeEntity(_0x5e162d,_0x451673){return function(_0xc71025){if(_0xc71025){return _0xc71025['destroy']()['then'](function(){_0x5e162d[_0xb440('0x1e')](0xcc)[_0xb440('0x1f')]();});}};}function handleEntityNotFound(_0x4cd27d,_0x25aaa1){return function(_0xf7582e){if(!_0xf7582e){_0x4cd27d[_0xb440('0x1d')](0x194);}return _0xf7582e;};}function handleError(_0x257a31,_0x2cfeaa){_0x2cfeaa=_0x2cfeaa||0x1f4;return function(_0x39018a){logger[_0xb440('0x27')](_0x39018a['stack']);if(_0x39018a[_0xb440('0x28')]){delete _0x39018a[_0xb440('0x28')];}_0x257a31['status'](_0x2cfeaa)[_0xb440('0x29')](_0x39018a);};}exports[_0xb440('0x2a')]=function(_0xd85279,_0x1b6efc){var _0x278121={},_0x379072={},_0x2f90c7={'count':0x0,'rows':[]};var _0x2440a1=_['map'](db['ChatGroup'][_0xb440('0x2b')],function(_0x3223b9){return{'name':_0x3223b9['fieldName'],'type':_0x3223b9[_0xb440('0x2c')][_0xb440('0x2d')]};});_0x379072[_0xb440('0x2e')]=_['map'](_0x2440a1,_0xb440('0x28'));_0x379072['query']=_['keys'](_0xd85279[_0xb440('0x2f')]);_0x379072[_0xb440('0x30')]=_[_0xb440('0x31')](_0x379072['model'],_0x379072['query']);_0x278121[_0xb440('0x32')]=_[_0xb440('0x31')](_0x379072['model'],qs[_0xb440('0x33')](_0xd85279[_0xb440('0x2f')][_0xb440('0x33')]));_0x278121[_0xb440('0x32')]=_0x278121[_0xb440('0x32')]['length']?_0x278121['attributes']:_0x379072[_0xb440('0x2e')];if(!_0xd85279[_0xb440('0x2f')][_0xb440('0x34')](_0xb440('0x35'))){_0x278121[_0xb440('0x23')]=qs[_0xb440('0x23')](_0xd85279[_0xb440('0x2f')]['limit']);_0x278121[_0xb440('0x22')]=qs[_0xb440('0x22')](_0xd85279[_0xb440('0x2f')]['offset']);}_0x278121['order']=qs[_0xb440('0x36')](_0xd85279[_0xb440('0x2f')][_0xb440('0x36')]);_0x278121[_0xb440('0x37')]=qs[_0xb440('0x30')](_[_0xb440('0x38')](_0xd85279[_0xb440('0x2f')],_0x379072[_0xb440('0x30')]),_0x2440a1);if(_0xd85279[_0xb440('0x2f')]['filter']){_0x278121[_0xb440('0x37')]=_[_0xb440('0x39')](_0x278121[_0xb440('0x37')],{'$or':_[_0xb440('0x3a')](_0x2440a1,function(_0xb8839c){if(_0xb8839c['type']!==_0xb440('0x3b')){var _0x49fe4e={};_0x49fe4e[_0xb8839c[_0xb440('0x28')]]={'$like':'%'+_0xd85279[_0xb440('0x2f')]['filter']+'%'};return _0x49fe4e;}})});}_0x278121=_[_0xb440('0x39')]({},_0x278121,_0xd85279[_0xb440('0x3c')]);var _0x9758d2={'where':_0x278121[_0xb440('0x37')]};return db['ChatGroup']['count'](_0x9758d2)[_0xb440('0x26')](function(_0x535124){_0x2f90c7[_0xb440('0x21')]=_0x535124;if(_0xd85279[_0xb440('0x2f')]['includeAll']){_0x278121[_0xb440('0x3d')]=[{'all':!![]}];}return db[_0xb440('0x3e')]['findAll'](_0x278121);})[_0xb440('0x26')](function(_0x2ff54e){_0x2f90c7[_0xb440('0x3f')]=_0x2ff54e;return _0x2f90c7;})[_0xb440('0x26')](respondWithFilteredResult(_0x1b6efc,_0x278121))[_0xb440('0x40')](handleError(_0x1b6efc,null));};exports[_0xb440('0x41')]=function(_0x545d1a,_0x162fe9){var _0x1c81a6={'raw':!![],'where':{'id':_0x545d1a[_0xb440('0x42')]['id']}},_0x5c98c6={};_0x5c98c6['model']=_[_0xb440('0x43')](db[_0xb440('0x3e')][_0xb440('0x2b')]);_0x5c98c6[_0xb440('0x2f')]=_[_0xb440('0x43')](_0x545d1a['query']);_0x5c98c6[_0xb440('0x30')]=_[_0xb440('0x31')](_0x5c98c6[_0xb440('0x2e')],_0x5c98c6[_0xb440('0x2f')]);_0x1c81a6[_0xb440('0x32')]=_[_0xb440('0x31')](_0x5c98c6[_0xb440('0x2e')],qs['fields'](_0x545d1a[_0xb440('0x2f')][_0xb440('0x33')]));_0x1c81a6[_0xb440('0x32')]=_0x1c81a6[_0xb440('0x32')][_0xb440('0x44')]?_0x1c81a6[_0xb440('0x32')]:_0x5c98c6['model'];if(_0x545d1a[_0xb440('0x2f')][_0xb440('0x45')]){_0x1c81a6[_0xb440('0x3d')]=[{'all':!![]}];}_0x1c81a6=_[_0xb440('0x39')]({},_0x1c81a6,_0x545d1a[_0xb440('0x3c')]);return db['ChatGroup'][_0xb440('0x46')](_0x1c81a6)[_0xb440('0x26')](handleEntityNotFound(_0x162fe9,null))[_0xb440('0x26')](respondWithResult(_0x162fe9,null))[_0xb440('0x40')](handleError(_0x162fe9,null));};exports['create']=function(_0x55ca97,_0xf4f5fa){return db[_0xb440('0x3e')][_0xb440('0x47')](_0x55ca97[_0xb440('0x48')],{})['then'](respondWithResult(_0xf4f5fa,0xc9))[_0xb440('0x40')](handleError(_0xf4f5fa,null));};exports[_0xb440('0x25')]=function(_0x3615ec,_0x5f13b4){if(_0x3615ec['body']['id']){delete _0x3615ec[_0xb440('0x48')]['id'];}return db[_0xb440('0x3e')][_0xb440('0x46')]({'where':{'id':_0x3615ec['params']['id']}})[_0xb440('0x26')](handleEntityNotFound(_0x5f13b4,null))[_0xb440('0x26')](saveUpdates(_0x3615ec['body'],null))[_0xb440('0x26')](respondWithResult(_0x5f13b4,null))[_0xb440('0x40')](handleError(_0x5f13b4,null));};exports[_0xb440('0x49')]=function(_0x481c09,_0x5f3a6a){return db[_0xb440('0x3e')]['find']({'where':{'id':_0x481c09[_0xb440('0x42')]['id']}})[_0xb440('0x26')](handleEntityNotFound(_0x5f3a6a,null))['then'](removeEntity(_0x5f3a6a,null))[_0xb440('0x40')](handleError(_0x5f3a6a,null));};exports[_0xb440('0x4a')]=function(_0x35a89e,_0x4455b5){return db[_0xb440('0x3e')][_0xb440('0x4a')]()[_0xb440('0x26')](respondWithResult(_0x4455b5,null))['catch'](handleError(_0x4455b5,null));};exports[_0xb440('0x4b')]=function(_0x2c06cb,_0x180518,_0x415873){return db[_0xb440('0x4c')][_0xb440('0x21')]({'where':{'ChatGroupId':_0x2c06cb['params']['id'],'ToId':_0x2c06cb[_0xb440('0x4d')]['id'],'read':![]}})[_0xb440('0x26')](function(_0x2570af){return{'id':_[_0xb440('0x4e')](_0x2c06cb[_0xb440('0x42')]['id']),'count':_0x2570af};})[_0xb440('0x26')](respondWithResult(_0x180518,null))[_0xb440('0x40')](handleError(_0x180518,null));};exports[_0xb440('0x4f')]=function(_0x17b71f,_0x4deba7,_0x1700ec){return db[_0xb440('0x3e')]['find']({'where':{'id':_0x17b71f[_0xb440('0x42')]['id']}})[_0xb440('0x26')](handleEntityNotFound(_0x4deba7,null))[_0xb440('0x26')](function(_0x2c2644){if(_0x2c2644){return _0x2c2644[_0xb440('0x4f')](_0x17b71f[_0xb440('0x48')]['ids'],_[_0xb440('0x50')](_0x17b71f['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x4deba7,null))[_0xb440('0x40')](handleError(_0x4deba7,null));};exports['getMembers']=function(_0x3d8923,_0x4d3cc3,_0x5cb79e){var _0x46c05b={};var _0xd19005={};var _0x16ed7d;var _0x43f918;return db[_0xb440('0x3e')][_0xb440('0x51')]({'where':{'id':_0x3d8923[_0xb440('0x42')]['id']}})['then'](handleEntityNotFound(_0x4d3cc3,null))['then'](function(_0x2d8b21){if(_0x2d8b21){_0x16ed7d=_0x2d8b21;_0xd19005['model']=_[_0xb440('0x43')](db[_0xb440('0x52')][_0xb440('0x2b')]);_0xd19005['query']=_['keys'](_0x3d8923[_0xb440('0x2f')]);_0xd19005[_0xb440('0x30')]=_[_0xb440('0x31')](_0xd19005[_0xb440('0x2e')],_0xd19005[_0xb440('0x2f')]);_0x46c05b[_0xb440('0x32')]=_['intersection'](_0xd19005['model'],qs['fields'](_0x3d8923[_0xb440('0x2f')][_0xb440('0x33')]));_0x46c05b[_0xb440('0x32')]=_0x46c05b['attributes'][_0xb440('0x44')]?_0x46c05b[_0xb440('0x32')]:_0xd19005[_0xb440('0x2e')];_0x46c05b[_0xb440('0x53')]=qs[_0xb440('0x36')](_0x3d8923['query'][_0xb440('0x36')]);_0x46c05b['where']=qs[_0xb440('0x30')](_['pick'](_0x3d8923['query'],_0xd19005[_0xb440('0x30')]));if(_0x3d8923[_0xb440('0x2f')]['filter']){_0x46c05b['where']=_[_0xb440('0x39')](_0x46c05b[_0xb440('0x37')],{'$or':_[_0xb440('0x3a')](_0x46c05b['attributes'],function(_0x1a8548){var _0x431963={};_0x431963[_0x1a8548]={'$like':'%'+_0x3d8923[_0xb440('0x2f')][_0xb440('0x54')]+'%'};return _0x431963;})});}_0x46c05b=_[_0xb440('0x39')]({},_0x46c05b,_0x3d8923[_0xb440('0x3c')]);return _0x16ed7d[_0xb440('0x55')](_0x46c05b);}})[_0xb440('0x26')](function(_0x21fe28){if(_0x21fe28){_0x43f918=_0x21fe28['length'];if(!_0x3d8923['query'][_0xb440('0x34')]('nolimit')){_0x46c05b[_0xb440('0x23')]=qs[_0xb440('0x23')](_0x3d8923[_0xb440('0x2f')][_0xb440('0x23')]);_0x46c05b[_0xb440('0x22')]=qs[_0xb440('0x22')](_0x3d8923[_0xb440('0x2f')][_0xb440('0x22')]);}return _0x16ed7d['getMembers'](_0x46c05b);}})[_0xb440('0x26')](function(_0x553d6a){if(_0x553d6a){return _0x553d6a?{'count':_0x43f918,'rows':_0x553d6a}:null;}})[_0xb440('0x26')](respondWithResult(_0x4d3cc3,null))[_0xb440('0x40')](handleError(_0x4d3cc3,null));};exports[_0xb440('0x56')]=function(_0x1702e5,_0xbc9f0,_0x175c3a){return db['ChatGroup'][_0xb440('0x46')]({'where':{'id':_0x1702e5['params']['id']}})[_0xb440('0x26')](handleEntityNotFound(_0xbc9f0,null))[_0xb440('0x26')](function(_0x373ffc){if(_0x373ffc){return _0x373ffc[_0xb440('0x56')](_0x1702e5['query'][_0xb440('0x57')]);}})['then'](respondWithStatusCode(_0xbc9f0,null))[_0xb440('0x40')](handleError(_0xbc9f0,null));};exports[_0xb440('0x58')]=function(_0xadd259,_0x5e3f4a,_0x576194){if(_0xadd259[_0xb440('0x48')]['id']){delete _0xadd259[_0xb440('0x48')]['id'];}return db[_0xb440('0x3e')][_0xb440('0x46')]({'where':{'id':_0xadd259['params']['id']}})[_0xb440('0x26')](handleEntityNotFound(_0x5e3f4a,null))[_0xb440('0x26')](function(_0x2f31ca){if(_0x2f31ca){_0xadd259['body'][_0xb440('0x59')]=_0x2f31ca['id'];return db[_0xb440('0x4c')]['create'](_0xadd259[_0xb440('0x48')]);}})[_0xb440('0x26')](respondWithResult(_0x5e3f4a,null))[_0xb440('0x40')](handleError(_0x5e3f4a,null));};exports[_0xb440('0x5a')]=function(_0x476cd7,_0x28c5fc,_0x100c5c){var _0x47508d={};var _0x3e9b26={};var _0x3e748a;var _0x5317ab;return db[_0xb440('0x3e')][_0xb440('0x51')]({'where':{'id':_0x476cd7['params']['id']}})[_0xb440('0x26')](handleEntityNotFound(_0x28c5fc,null))[_0xb440('0x26')](function(_0x10af53){if(_0x10af53){_0x3e748a=_0x10af53;_0x3e9b26[_0xb440('0x2e')]=_[_0xb440('0x43')](db['ChatInternalMessage'][_0xb440('0x2b')]);_0x3e9b26[_0xb440('0x2f')]=_['keys'](_0x476cd7[_0xb440('0x2f')]);_0x3e9b26[_0xb440('0x30')]=_[_0xb440('0x31')](_0x3e9b26[_0xb440('0x2e')],_0x3e9b26[_0xb440('0x2f')]);_0x47508d[_0xb440('0x32')]=_[_0xb440('0x31')](_0x3e9b26[_0xb440('0x2e')],qs['fields'](_0x476cd7['query'][_0xb440('0x33')]));_0x47508d['attributes']=_0x47508d[_0xb440('0x32')][_0xb440('0x44')]?_0x47508d[_0xb440('0x32')]:_0x3e9b26[_0xb440('0x2e')];_0x47508d['order']=qs['sort'](_0x476cd7[_0xb440('0x2f')][_0xb440('0x36')]);_0x47508d[_0xb440('0x37')]=qs[_0xb440('0x30')](_['pick'](_0x476cd7[_0xb440('0x2f')],_0x3e9b26[_0xb440('0x30')]));if(_0x476cd7[_0xb440('0x2f')]['filter']){_0x47508d[_0xb440('0x37')]=_[_0xb440('0x39')](_0x47508d[_0xb440('0x37')],{'$or':_[_0xb440('0x3a')](_0x47508d[_0xb440('0x32')],function(_0x24354e){var _0x4221d9={};_0x4221d9[_0x24354e]={'$like':'%'+_0x476cd7['query'][_0xb440('0x54')]+'%'};return _0x4221d9;})});}if(_0x476cd7[_0xb440('0x2f')][_0xb440('0x5b')]){var _0x4969b3=_0x476cd7[_0xb440('0x2f')]['$gte'][_0xb440('0x5c')](',');var _0xe80748={};_0xe80748[_0x4969b3[0x0]]={'$gte':moment(_0x4969b3[0x1])[_0xb440('0x5d')]('YYYY-MM-DD\x20HH:mm:ss')};_0x47508d['where']=_['merge'](_0x47508d['where'],_0xe80748);}_0x47508d=_['merge']({},_0x47508d,_0x476cd7[_0xb440('0x3c')]);return _0x3e748a['getMessages'](_0x47508d);}})[_0xb440('0x26')](function(_0x5c6aa8){if(_0x5c6aa8){_0x5317ab=_0x5c6aa8[_0xb440('0x44')];if(!_0x476cd7[_0xb440('0x2f')][_0xb440('0x34')](_0xb440('0x35'))){_0x47508d[_0xb440('0x23')]=qs[_0xb440('0x23')](_0x476cd7[_0xb440('0x2f')][_0xb440('0x23')]);_0x47508d[_0xb440('0x22')]=qs[_0xb440('0x22')](_0x476cd7[_0xb440('0x2f')][_0xb440('0x22')]);}return _0x3e748a[_0xb440('0x5a')](_0x47508d);}})[_0xb440('0x26')](function(_0x271cdc){if(_0x271cdc){return _0x271cdc?{'count':_0x5317ab,'rows':_0x271cdc}:null;}})[_0xb440('0x26')](respondWithResult(_0x28c5fc,null))[_0xb440('0x40')](handleError(_0x28c5fc,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index dfe090e..eb691bd 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 _0x5557=['hook','exports','events','ChatGroup','save','update','emit','hasOwnProperty'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x5557,0x1ba));var _0x7555=function(_0x401c95,_0x15ef4b){_0x401c95=_0x401c95-0x0;var _0x5313f2=_0x5557[_0x401c95];return _0x5313f2;};'use strict';var EventEmitter=require(_0x7555('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0x7555('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7555('0x2'),'afterUpdate':_0x7555('0x3'),'afterDestroy':'remove'};function emitEvent(_0x150e74){return function(_0x5dd156,_0x2d0ded,_0x4679ca){ChatGroupEvents[_0x7555('0x4')](_0x150e74+':'+_0x5dd156['id'],_0x5dd156);ChatGroupEvents[_0x7555('0x4')](_0x150e74,_0x5dd156);_0x4679ca(null);};}for(var e in events){if(events[_0x7555('0x5')](e)){var event=events[e];ChatGroup[_0x7555('0x6')](e,emitEvent(event));}}module[_0x7555('0x7')]=ChatGroupEvents; \ No newline at end of file +var _0x4a9a=['update','emit','hasOwnProperty','../../mysqldb','ChatGroup','save'];(function(_0xb9398f,_0x364d49){var _0xc6808a=function(_0x5d6aad){while(--_0x5d6aad){_0xb9398f['push'](_0xb9398f['shift']());}};_0xc6808a(++_0x364d49);}(_0x4a9a,0x123));var _0xa4a9=function(_0x338bc1,_0x31820a){_0x338bc1=_0x338bc1-0x0;var _0x189a20=_0x4a9a[_0x338bc1];return _0x189a20;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0xa4a9('0x0'))['db'][_0xa4a9('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa4a9('0x2'),'afterUpdate':_0xa4a9('0x3'),'afterDestroy':'remove'};function emitEvent(_0x316159){return function(_0x2225d5,_0x5869ca,_0x5da1fa){ChatGroupEvents[_0xa4a9('0x4')](_0x316159+':'+_0x2225d5['id'],_0x2225d5);ChatGroupEvents[_0xa4a9('0x4')](_0x316159,_0x2225d5);_0x5da1fa(null);};}for(var e in events){if(events[_0xa4a9('0x5')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 7f8235f..198e82c 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 _0xd07b=['request-promise','path','rimraf','../../config/environment','exports','define','util','../../config/logger','api','moment','bluebird'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd07b,0x1d4));var _0xbd07=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xd07b[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0xbd07('0x0'));var logger=require(_0xbd07('0x1'))(_0xbd07('0x2'));var moment=require(_0xbd07('0x3'));var BPromise=require(_0xbd07('0x4'));var rp=require(_0xbd07('0x5'));var fs=require('fs');var path=require(_0xbd07('0x6'));var rimraf=require(_0xbd07('0x7'));var config=require(_0xbd07('0x8'));var attributes=require('./chatGroup.attributes');module[_0xbd07('0x9')]=function(_0x24b0f3,_0xa2c235){return _0x24b0f3[_0xbd07('0xa')]('ChatGroup',attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x488f=['lodash','util','moment','bluebird','path','rimraf','../../config/environment','./chatGroup.attributes','define','chat_groups'];(function(_0x739af,_0x4ed25b){var _0x20d65d=function(_0x2298a2){while(--_0x2298a2){_0x739af['push'](_0x739af['shift']());}};_0x20d65d(++_0x4ed25b);}(_0x488f,0x1cc));var _0xf488=function(_0x52ec86,_0x32fe83){_0x52ec86=_0x52ec86-0x0;var _0x45238f=_0x488f[_0x52ec86];return _0x45238f;};'use strict';var _=require(_0xf488('0x0'));var util=require(_0xf488('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf488('0x2'));var BPromise=require(_0xf488('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf488('0x4'));var rimraf=require(_0xf488('0x5'));var config=require(_0xf488('0x6'));var attributes=require(_0xf488('0x7'));module['exports']=function(_0x22d077,_0x55036a){return _0x22d077[_0xf488('0x8')]('ChatGroup',attributes,{'tableName':_0xf488('0x9'),'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 3773e79..dfc27f5 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 _0x3fec=['lodash','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x886061,_0x66e6cc){var _0x5d6aa4=function(_0x2fb90f){while(--_0x2fb90f){_0x886061['push'](_0x886061['shift']());}};_0x5d6aa4(++_0x66e6cc);}(_0x3fec,0x1ba));var _0xc3fe=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3fec[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc3fe('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc3fe('0x1'));var rs=require(_0xc3fe('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc3fe('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc3fe('0x4'));var config=require('../../config/environment');var jayson=require(_0xc3fe('0x5'));var client=jayson[_0xc3fe('0x6')][_0xc3fe('0x7')]({'port':0x232a});config[_0xc3fe('0x8')]=_[_0xc3fe('0x9')](config[_0xc3fe('0x8')],{'host':_0xc3fe('0xa'),'port':0x18eb});var socket=require(_0xc3fe('0xb'))(new Redis(config[_0xc3fe('0x8')]));require(_0xc3fe('0xc'))[_0xc3fe('0xd')](socket);function respondWithRpcPromise(_0x3238af,_0x2852c9,_0x3ffe1a){return new BPromise(function(_0x22f543,_0x255c18){return client['request'](_0x3238af,_0x3ffe1a)[_0xc3fe('0xe')](function(_0x144702){logger['info'](_0xc3fe('0xf'),_0x2852c9,_0xc3fe('0x10'));logger[_0xc3fe('0x11')](_0xc3fe('0x12'),_0x2852c9,_0xc3fe('0x10'),JSON[_0xc3fe('0x13')](_0x144702));if(_0x144702[_0xc3fe('0x14')]){if(_0x144702[_0xc3fe('0x14')][_0xc3fe('0x15')]===0x1f4){logger[_0xc3fe('0x14')]('ChatGroup,\x20%s,\x20%s',_0x2852c9,_0x144702[_0xc3fe('0x14')]['message']);return _0x255c18(_0x144702[_0xc3fe('0x14')][_0xc3fe('0x16')]);}logger[_0xc3fe('0x14')](_0xc3fe('0xf'),_0x2852c9,_0x144702[_0xc3fe('0x14')][_0xc3fe('0x16')]);return _0x22f543(_0x144702[_0xc3fe('0x14')][_0xc3fe('0x16')]);}else{logger[_0xc3fe('0x17')](_0xc3fe('0xf'),_0x2852c9,_0xc3fe('0x10'));_0x22f543(_0x144702[_0xc3fe('0x18')][_0xc3fe('0x16')]);}})[_0xc3fe('0x19')](function(_0x3a86f2){logger['error'](_0xc3fe('0xf'),_0x2852c9,_0x3a86f2);_0x255c18(_0x3a86f2);});});} \ No newline at end of file +var _0x5d55=['../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x580cf8,_0x26751e){var _0xcc9a9e=function(_0x5a67ad){while(--_0x5a67ad){_0x580cf8['push'](_0x580cf8['shift']());}};_0xcc9a9e(++_0x26751e);}(_0x5d55,0x1a4));var _0x55d5=function(_0x47508b,_0x357f79){_0x47508b=_0x47508b-0x0;var _0x9ff13b=_0x5d55[_0x47508b];return _0x9ff13b;};'use strict';var _=require('lodash');var util=require(_0x55d5('0x0'));var moment=require('moment');var BPromise=require(_0x55d5('0x1'));var rs=require(_0x55d5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x55d5('0x3'))['db'];var utils=require(_0x55d5('0x4'));var logger=require(_0x55d5('0x5'))('rpc');var config=require(_0x55d5('0x6'));var jayson=require(_0x55d5('0x7'));var client=jayson[_0x55d5('0x8')][_0x55d5('0x9')]({'port':0x232a});config[_0x55d5('0xa')]=_[_0x55d5('0xb')](config[_0x55d5('0xa')],{'host':_0x55d5('0xc'),'port':0x18eb});var socket=require(_0x55d5('0xd'))(new Redis(config['redis']));require(_0x55d5('0xe'))[_0x55d5('0xf')](socket);function respondWithRpcPromise(_0x448938,_0x64f70a,_0xdac85){return new BPromise(function(_0x4db860,_0x45569e){return client['request'](_0x448938,_0xdac85)[_0x55d5('0x10')](function(_0x21d7c0){logger[_0x55d5('0x11')](_0x55d5('0x12'),_0x64f70a,_0x55d5('0x13'));logger['debug'](_0x55d5('0x14'),_0x64f70a,_0x55d5('0x13'),JSON[_0x55d5('0x15')](_0x21d7c0));if(_0x21d7c0['error']){if(_0x21d7c0[_0x55d5('0x16')]['code']===0x1f4){logger[_0x55d5('0x16')](_0x55d5('0x12'),_0x64f70a,_0x21d7c0[_0x55d5('0x16')][_0x55d5('0x17')]);return _0x45569e(_0x21d7c0['error'][_0x55d5('0x17')]);}logger[_0x55d5('0x16')](_0x55d5('0x12'),_0x64f70a,_0x21d7c0['error'][_0x55d5('0x17')]);return _0x4db860(_0x21d7c0['error'][_0x55d5('0x17')]);}else{logger['info'](_0x55d5('0x12'),_0x64f70a,_0x55d5('0x13'));_0x4db860(_0x21d7c0['result'][_0x55d5('0x17')]);}})[_0x55d5('0x18')](function(_0x2c0324){logger[_0x55d5('0x16')]('ChatGroup,\x20%s,\x20%s',_0x64f70a,_0x2c0324);_0x45569e(_0x2c0324);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 546b6b1..f309972 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 _0x25ab=['length','chatGroup:','save','remove','update'];(function(_0x1cc258,_0x15d913){var _0x7e4c60=function(_0x40cf88){while(--_0x40cf88){_0x1cc258['push'](_0x1cc258['shift']());}};_0x7e4c60(++_0x15d913);}(_0x25ab,0x98));var _0xb25a=function(_0x4fc984,_0x5773fa){_0x4fc984=_0x4fc984-0x0;var _0x3201eb=_0x25ab[_0x4fc984];return _0x3201eb;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0xb25a('0x0'),_0xb25a('0x1'),_0xb25a('0x2')];function createListener(_0xed4b75,_0x14fd71){return function(_0x3b8f15){_0x14fd71['emit'](_0xed4b75,_0x3b8f15);};}function removeListener(_0x2f264b,_0x3f3ba5){return function(){ChatGroupEvents['removeListener'](_0x2f264b,_0x3f3ba5);};}exports['register']=function(_0x32c416){for(var _0x390152=0x0,_0xa14ef6=events[_0xb25a('0x3')];_0x390152<_0xa14ef6;_0x390152++){var _0x128caf=events[_0x390152];var _0x50c392=createListener(_0xb25a('0x4')+_0x128caf,_0x32c416);ChatGroupEvents['on'](_0x128caf,_0x50c392);}}; \ No newline at end of file +var _0xb803=['register','length','chatGroup:','./chatGroup.events','save','remove','update'];(function(_0x2b8029,_0xd9e9f4){var _0x1f26db=function(_0x88adf1){while(--_0x88adf1){_0x2b8029['push'](_0x2b8029['shift']());}};_0x1f26db(++_0xd9e9f4);}(_0xb803,0x153));var _0x3b80=function(_0x648c71,_0x361903){_0x648c71=_0x648c71-0x0;var _0x241b97=_0xb803[_0x648c71];return _0x241b97;};'use strict';var ChatGroupEvents=require(_0x3b80('0x0'));var events=[_0x3b80('0x1'),_0x3b80('0x2'),_0x3b80('0x3')];function createListener(_0x15148c,_0x2424fd){return function(_0x352f21){_0x2424fd['emit'](_0x15148c,_0x352f21);};}function removeListener(_0x3eabb8,_0x2fe899){return function(){ChatGroupEvents['removeListener'](_0x3eabb8,_0x2fe899);};}exports[_0x3b80('0x4')]=function(_0x2d2d83){for(var _0x10f5a9=0x0,_0xc3ee5e=events[_0x3b80('0x5')];_0x10f5a9<_0xc3ee5e;_0x10f5a9++){var _0x8546c0=events[_0x10f5a9];var _0xf48e66=createListener(_0x3b80('0x6')+_0x8546c0,_0x2d2d83);ChatGroupEvents['on'](_0x8546c0,_0xf48e66);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index ae65bd4..7d8db26 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 _0xd5c6=['describe','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','addMembers','addMessage','update','delete','destroy','removeMembers','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index'];(function(_0x563500,_0x171097){var _0x5df0ca=function(_0x374a79){while(--_0x374a79){_0x563500['push'](_0x563500['shift']());}};_0x5df0ca(++_0x171097);}(_0xd5c6,0x64));var _0x6d5c=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xd5c6[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require(_0x6d5c('0x0'));var path=require(_0x6d5c('0x1'));var timeout=require('connect-timeout');var express=require(_0x6d5c('0x2'));var router=express[_0x6d5c('0x3')]();var fs_extra=require(_0x6d5c('0x4'));var auth=require(_0x6d5c('0x5'));var interaction=require(_0x6d5c('0x6'));var config=require(_0x6d5c('0x7'));var controller=require(_0x6d5c('0x8'));router[_0x6d5c('0x9')]('/',auth[_0x6d5c('0xa')](),controller[_0x6d5c('0xb')]);router[_0x6d5c('0x9')]('/describe',auth[_0x6d5c('0xa')](),controller[_0x6d5c('0xc')]);router[_0x6d5c('0x9')]('/:id',auth[_0x6d5c('0xa')](),controller[_0x6d5c('0xd')]);router['get'](_0x6d5c('0xe'),auth['isAuthenticated'](),controller[_0x6d5c('0xf')]);router[_0x6d5c('0x9')](_0x6d5c('0x10'),auth[_0x6d5c('0xa')](),controller[_0x6d5c('0x11')]);router[_0x6d5c('0x9')](_0x6d5c('0x12'),auth['isAuthenticated'](),controller[_0x6d5c('0x13')]);router[_0x6d5c('0x14')]('/',auth[_0x6d5c('0xa')](),controller['create']);router[_0x6d5c('0x14')](_0x6d5c('0x10'),auth['isAuthenticated'](),controller[_0x6d5c('0x15')]);router['post'](_0x6d5c('0x12'),auth['isAuthenticated'](),controller[_0x6d5c('0x16')]);router['put']('/:id',auth[_0x6d5c('0xa')](),controller[_0x6d5c('0x17')]);router[_0x6d5c('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x6d5c('0x19')]);router[_0x6d5c('0x18')](_0x6d5c('0x10'),auth['isAuthenticated'](),controller[_0x6d5c('0x1a')]);module[_0x6d5c('0x1b')]=router; \ No newline at end of file +var _0x6e94=['../../components/interaction/service','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','post','addMessage','put','/:id','update','delete','destroy','removeMembers','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x55631c,_0x4e787d){var _0x35e56b=function(_0x26e9ac){while(--_0x26e9ac){_0x55631c['push'](_0x55631c['shift']());}};_0x35e56b(++_0x4e787d);}(_0x6e94,0xf6));var _0x46e9=function(_0x4c3f39,_0x394c52){_0x4c3f39=_0x4c3f39-0x0;var _0x46672e=_0x6e94[_0x4c3f39];return _0x46672e;};'use strict';var multer=require(_0x46e9('0x0'));var util=require(_0x46e9('0x1'));var path=require(_0x46e9('0x2'));var timeout=require(_0x46e9('0x3'));var express=require('express');var router=express[_0x46e9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x46e9('0x5'));var interaction=require(_0x46e9('0x6'));var config=require('../../config/environment');var controller=require(_0x46e9('0x7'));router[_0x46e9('0x8')]('/',auth[_0x46e9('0x9')](),controller[_0x46e9('0xa')]);router[_0x46e9('0x8')](_0x46e9('0xb'),auth[_0x46e9('0x9')](),controller[_0x46e9('0xc')]);router[_0x46e9('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x46e9('0xd')]);router[_0x46e9('0x8')](_0x46e9('0xe'),auth[_0x46e9('0x9')](),controller[_0x46e9('0xf')]);router[_0x46e9('0x8')](_0x46e9('0x10'),auth['isAuthenticated'](),controller[_0x46e9('0x11')]);router[_0x46e9('0x8')](_0x46e9('0x12'),auth[_0x46e9('0x9')](),controller['getMessages']);router[_0x46e9('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x46e9('0x13')]('/:id/members',auth['isAuthenticated'](),controller['addMembers']);router[_0x46e9('0x13')](_0x46e9('0x12'),auth[_0x46e9('0x9')](),controller[_0x46e9('0x14')]);router[_0x46e9('0x15')](_0x46e9('0x16'),auth[_0x46e9('0x9')](),controller[_0x46e9('0x17')]);router[_0x46e9('0x18')]('/:id',auth[_0x46e9('0x9')](),controller[_0x46e9('0x19')]);router[_0x46e9('0x18')](_0x46e9('0x10'),auth[_0x46e9('0x9')](),controller[_0x46e9('0x1a')]);module[_0x46e9('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 3ffc3a6..51fd71b 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 _0x174b=['STRING','out','BOOLEAN','sequelize','INTEGER','ENUM','star','thumb','TEXT','DATE'];(function(_0x51870d,_0x3ae9de){var _0x1e502f=function(_0x4f7d24){while(--_0x4f7d24){_0x51870d['push'](_0x51870d['shift']());}};_0x1e502f(++_0x3ae9de);}(_0x174b,0x19d));var _0xb174=function(_0x3e4d64,_0x2e7e63){_0x3e4d64=_0x3e4d64-0x0;var _0x14389c=_0x174b[_0x3e4d64];return _0x14389c;};'use strict';var Sequelize=require(_0xb174('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xb174('0x1')]},'ratingType':{'type':Sequelize[_0xb174('0x2')](_0xb174('0x3'),_0xb174('0x4')),'defaultValue':_0xb174('0x3')},'ratingMessage':{'type':Sequelize[_0xb174('0x5')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xb174('0x6')]},'disposition':{'type':Sequelize[_0xb174('0x7')]},'secondDisposition':{'type':Sequelize[_0xb174('0x7')]},'thirdDisposition':{'type':Sequelize[_0xb174('0x7')]},'note':{'type':Sequelize[_0xb174('0x7')]},'browserName':{'type':Sequelize[_0xb174('0x7')]},'browserVersion':{'type':Sequelize[_0xb174('0x7')]},'osName':{'type':Sequelize[_0xb174('0x7')]},'osVersion':{'type':Sequelize[_0xb174('0x7')]},'deviceModel':{'type':Sequelize[_0xb174('0x7')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0xb174('0x7')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xb174('0x7')]},'formData':{'type':Sequelize[_0xb174('0x5')]('long')},'read1stAt':{'type':Sequelize[_0xb174('0x6')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xb174('0x2')]('in',_0xb174('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0xb174('0x7')]},'vidaooSessionId':{'type':Sequelize[_0xb174('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0xb174('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0xb921=['DATE','long','sequelize','exports','BOOLEAN','INTEGER','ENUM','star','TEXT','STRING'];(function(_0x32e672,_0x13f15f){var _0x457648=function(_0x3b5166){while(--_0x3b5166){_0x32e672['push'](_0x32e672['shift']());}};_0x457648(++_0x13f15f);}(_0xb921,0x16a));var _0x1b92=function(_0x4528a2,_0x145bc9){_0x4528a2=_0x4528a2-0x0;var _0x260acf=_0xb921[_0x4528a2];return _0x260acf;};'use strict';var Sequelize=require(_0x1b92('0x0'));module[_0x1b92('0x1')]={'closed':{'type':Sequelize[_0x1b92('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x1b92('0x3')]},'ratingType':{'type':Sequelize[_0x1b92('0x4')]('star','thumb'),'defaultValue':_0x1b92('0x5')},'ratingMessage':{'type':Sequelize[_0x1b92('0x6')]},'pathTranscript':{'type':Sequelize[_0x1b92('0x6')]},'mailTranscript':{'type':Sequelize[_0x1b92('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x1b92('0x8')]},'disposition':{'type':Sequelize[_0x1b92('0x7')]},'secondDisposition':{'type':Sequelize[_0x1b92('0x7')]},'thirdDisposition':{'type':Sequelize[_0x1b92('0x7')]},'note':{'type':Sequelize[_0x1b92('0x7')]},'browserName':{'type':Sequelize[_0x1b92('0x7')]},'browserVersion':{'type':Sequelize[_0x1b92('0x7')]},'osName':{'type':Sequelize[_0x1b92('0x7')]},'osVersion':{'type':Sequelize[_0x1b92('0x7')]},'deviceModel':{'type':Sequelize[_0x1b92('0x7')]},'deviceVendor':{'type':Sequelize[_0x1b92('0x7')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x1b92('0x6')]},'customerIp':{'type':Sequelize[_0x1b92('0x7')]},'formData':{'type':Sequelize[_0x1b92('0x6')](_0x1b92('0x9'))},'read1stAt':{'type':Sequelize[_0x1b92('0x8')]},'lastMsgAt':{'type':Sequelize[_0x1b92('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x1b92('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x1b92('0x7')]},'customerPort':{'type':Sequelize[_0x1b92('0x7')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0x1b92('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 68624d7..49e4fa4 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 _0x7c40=['lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','limit','undefined','count','set','json','update','destroy','stack','name','send','render','merge','contact','agent','interaction','account','map','ChatInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','chat','query','user','params','keys','filters','intersection','model','attributes','length','includeAll','include','find','body','describe','createVidaooSession','findOne','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','metadata','Sequelize','Error\x20in\x20conversion\x20vidaooMetadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','create','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','Interaction\x20already\x20assigned','closed','disposition','attachmentUpload','file','originalname','basename','filename','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','pathTranscript','Messages','ChatWebsite','UserId','%s%d','System','customer','Visitor','ContactId','agentIdentifier','agentAlias','agent_alias','User','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailAccount','MailServerOut','CloudProvider','Smtp','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','addMessage','ids','fields','hasOwnProperty','nolimit','order','sort','pick','ChatInteractionId','filter','where','split','YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','options','push','addTags','setTags','omit','color','emit','chatInteractionTags:save','removeTags','unix','toString','server','files','tmp','firstName','lastName','attachments','createdAt','read','Owner','mkdirSync','Chat','Account','N.A.','closedAt','browserName','osName','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','err','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs'];(function(_0xcc9b8b,_0x34e2a6){var _0x560f54=function(_0x2b43e3){while(--_0x2b43e3){_0xcc9b8b['push'](_0xcc9b8b['shift']());}};_0x560f54(++_0x34e2a6);}(_0x7c40,0xcd));var _0x07c4=function(_0x342de6,_0x343927){_0x342de6=_0x342de6-0x0;var _0x6b7e5a=_0x7c40[_0x342de6];return _0x6b7e5a;};'use strict';var rimraf=require(_0x07c4('0x0'));var zipdir=require(_0x07c4('0x1'));var rp=require(_0x07c4('0x2'));var moment=require(_0x07c4('0x3'));var BPromise=require(_0x07c4('0x4'));var Mustache=require(_0x07c4('0x5'));var util=require(_0x07c4('0x6'));var path=require(_0x07c4('0x7'));var ejs=require(_0x07c4('0x8'));var fs=require('fs');var _=require(_0x07c4('0x9'));var Redis=require(_0x07c4('0xa'));var interaction=require('../../components/interaction/service');var qs=require(_0x07c4('0xb'));var pdf=require('../../components/export/pdf');var logger=require(_0x07c4('0xc'))(_0x07c4('0xd'));var config=require(_0x07c4('0xe'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x07c4('0xf')](config[_0x07c4('0x10')],{'host':_0x07c4('0x11'),'port':0x18eb});var socket=require(_0x07c4('0x12'))(new Redis(config[_0x07c4('0x10')]));require('./chatInteraction.socket')[_0x07c4('0x13')](socket);var jayson=require(_0x07c4('0x14'));var client=jayson[_0x07c4('0x15')]['http']({'port':0x232b});var client9004=jayson[_0x07c4('0x15')][_0x07c4('0x16')]({'port':0x232c});function respondWithRpcPromise(_0x1d199f,_0x440cb2,_0x4caa35,_0x519fe8){return new BPromise(function(_0x4f6250,_0x28427e){var _0x3525eb=_0x519fe8||client;return _0x3525eb[_0x07c4('0x17')](_0x1d199f,_0x4caa35)[_0x07c4('0x18')](function(_0x5d5289){logger[_0x07c4('0x19')]('ChatInteraction,\x20%s,\x20%s',_0x440cb2,_0x07c4('0x1a'));logger[_0x07c4('0x1b')](_0x07c4('0x1c'),_0x440cb2,'request\x20sent',JSON[_0x07c4('0x1d')](_0x5d5289));if(_0x5d5289['error']){if(_0x5d5289[_0x07c4('0x1e')][_0x07c4('0x1f')]===0x1f4){logger['error'](_0x07c4('0x20'),_0x440cb2,_0x5d5289[_0x07c4('0x1e')][_0x07c4('0x21')]);return _0x28427e(_0x5d5289[_0x07c4('0x1e')][_0x07c4('0x21')]);}logger['error'](_0x07c4('0x20'),_0x440cb2,_0x5d5289[_0x07c4('0x1e')][_0x07c4('0x21')]);return _0x4f6250(_0x5d5289[_0x07c4('0x1e')]['message']);}else{logger[_0x07c4('0x19')](_0x07c4('0x20'),_0x440cb2,_0x07c4('0x1a'));_0x4f6250(_0x5d5289[_0x07c4('0x22')][_0x07c4('0x21')]);}})[_0x07c4('0x23')](function(_0x1425b6){logger[_0x07c4('0x1e')](_0x07c4('0x20'),_0x440cb2,_0x1425b6);_0x28427e(_0x1425b6);});});}function respondWithStatusCode(_0x3670f3,_0x174f57){_0x174f57=_0x174f57||0xcc;return function(_0xf64c15){if(_0xf64c15){return _0x3670f3[_0x07c4('0x24')](_0x174f57);}return _0x3670f3[_0x07c4('0x25')](_0x174f57)[_0x07c4('0x26')]();};}function respondWithResult(_0x55b4fe,_0x5d31f5){_0x5d31f5=_0x5d31f5||0xc8;return function(_0x222fc7){if(_0x222fc7){return _0x55b4fe[_0x07c4('0x25')](_0x5d31f5)['json'](_0x222fc7);}};}function respondWithFilteredResult(_0x404a2e,_0x3ca9b7){return function(_0x1cce45){if(_0x1cce45){var _0x129823=typeof _0x3ca9b7[_0x07c4('0x27')]==='undefined'&&typeof _0x3ca9b7[_0x07c4('0x28')]===_0x07c4('0x29');var _0xc28533=_0x1cce45[_0x07c4('0x2a')];var _0x7e43e9=_0x129823?0x0:_0x3ca9b7[_0x07c4('0x27')];var _0x2a653c=_0x129823?_0x1cce45[_0x07c4('0x2a')]:_0x3ca9b7[_0x07c4('0x27')]+_0x3ca9b7[_0x07c4('0x28')];var _0x38c235;if(_0x2a653c>=_0xc28533){_0x2a653c=_0xc28533;_0x38c235=0xc8;}else{_0x38c235=0xce;}_0x404a2e[_0x07c4('0x25')](_0x38c235);return _0x404a2e[_0x07c4('0x2b')]('Content-Range',_0x7e43e9+'-'+_0x2a653c+'/'+_0xc28533)[_0x07c4('0x2c')](_0x1cce45);}return null;};}function saveUpdates(_0x52eeeb){return function(_0x4eae30){if(_0x4eae30){return _0x4eae30[_0x07c4('0x2d')](_0x52eeeb)[_0x07c4('0x18')](function(_0x211083){return _0x211083;});}return null;};}function removeEntity(_0x2b5b7b){return function(_0x11e7b6){if(_0x11e7b6){return _0x11e7b6[_0x07c4('0x2e')]()[_0x07c4('0x18')](function(){_0x2b5b7b[_0x07c4('0x25')](0xcc)[_0x07c4('0x26')]();});}};}function handleEntityNotFound(_0x2ae371){return function(_0x1bfea5){if(!_0x1bfea5){_0x2ae371[_0x07c4('0x24')](0x194);}return _0x1bfea5;};}function handleError(_0x3d9ac,_0x2477f9){_0x2477f9=_0x2477f9||0x1f4;return function(_0x148011){logger[_0x07c4('0x1e')](_0x148011[_0x07c4('0x2f')]);if(_0x148011[_0x07c4('0x30')]){delete _0x148011['name'];}_0x3d9ac[_0x07c4('0x25')](_0x2477f9)[_0x07c4('0x31')](_0x148011);};}function getMustacheRender(_0x268f2f,_0x1667ad){return Mustache[_0x07c4('0x32')](_0x268f2f,_[_0x07c4('0x33')](_0x1667ad['body'],{'contact':_0x1667ad[_0x07c4('0x34')],'message':_0x1667ad[_0x07c4('0x21')],'agent':_0x1667ad[_0x07c4('0x35')],'interaction':_0x1667ad[_0x07c4('0x36')],'account':_0x1667ad[_0x07c4('0x37')]}))||'';}exports['index']=function(_0x3d1563,_0x4bbe74){var _0x411739={};var _0x420806=_[_0x07c4('0x38')](db[_0x07c4('0x39')][_0x07c4('0x3a')],function(_0x5d60e8){return{'name':_0x5d60e8[_0x07c4('0x3b')],'type':_0x5d60e8[_0x07c4('0x3c')][_0x07c4('0x3d')]};});_0x411739=qs[_0x07c4('0x3e')](_0x420806,_0x3d1563);return interaction[_0x07c4('0x3f')](_0x07c4('0x40'),_0x3d1563[_0x07c4('0x41')],_0x3d1563[_0x07c4('0x42')],_0x411739,_0x420806)[_0x07c4('0x18')](respondWithFilteredResult(_0x4bbe74,_0x411739))[_0x07c4('0x23')](handleError(_0x4bbe74,null));};exports['show']=function(_0x1a90fc,_0x2835d5){var _0x414cda={'raw':![],'where':{'id':_0x1a90fc[_0x07c4('0x43')]['id']}},_0x3823d6={};_0x3823d6['model']=_['keys'](db[_0x07c4('0x39')][_0x07c4('0x3a')]);_0x3823d6[_0x07c4('0x41')]=_[_0x07c4('0x44')](_0x1a90fc['query']);_0x3823d6[_0x07c4('0x45')]=_[_0x07c4('0x46')](_0x3823d6[_0x07c4('0x47')],_0x3823d6[_0x07c4('0x41')]);_0x414cda[_0x07c4('0x48')]=_[_0x07c4('0x46')](_0x3823d6['model'],qs['fields'](_0x1a90fc[_0x07c4('0x41')]['fields']));_0x414cda[_0x07c4('0x48')]=_0x414cda['attributes'][_0x07c4('0x49')]?_0x414cda['attributes']:_0x3823d6[_0x07c4('0x47')];if(_0x1a90fc[_0x07c4('0x41')][_0x07c4('0x4a')]){_0x414cda[_0x07c4('0x4b')]=[{'all':!![]}];}_0x414cda=_[_0x07c4('0x33')]({},_0x414cda,_0x1a90fc['options']);return db[_0x07c4('0x39')][_0x07c4('0x4c')](_0x414cda)[_0x07c4('0x18')](handleEntityNotFound(_0x2835d5,null))['then'](respondWithResult(_0x2835d5,null))[_0x07c4('0x23')](handleError(_0x2835d5,null));};exports['create']=function(_0x3c58f1,_0xacbc1){return db['ChatInteraction']['create'](_0x3c58f1[_0x07c4('0x4d')],{})[_0x07c4('0x18')](respondWithResult(_0xacbc1,0xc9))[_0x07c4('0x23')](handleError(_0xacbc1,null));};exports['update']=function(_0x5a3af5,_0x19c240){if(_0x5a3af5[_0x07c4('0x4d')]['id']){delete _0x5a3af5[_0x07c4('0x4d')]['id'];}return db['ChatInteraction'][_0x07c4('0x4c')]({'where':{'id':_0x5a3af5['params']['id']}})['then'](handleEntityNotFound(_0x19c240,null))[_0x07c4('0x18')](saveUpdates(_0x5a3af5['body'],null))[_0x07c4('0x18')](respondWithResult(_0x19c240,null))[_0x07c4('0x23')](handleError(_0x19c240,null));};exports[_0x07c4('0x2e')]=function(_0x55b7e8,_0x2caacb){return db[_0x07c4('0x39')][_0x07c4('0x4c')]({'where':{'id':_0x55b7e8['params']['id']}})[_0x07c4('0x18')](handleEntityNotFound(_0x2caacb,null))[_0x07c4('0x18')](removeEntity(_0x2caacb,null))[_0x07c4('0x23')](handleError(_0x2caacb,null));};exports[_0x07c4('0x4e')]=function(_0x92051c,_0x4ef21f){return db[_0x07c4('0x39')][_0x07c4('0x4e')]()['then'](respondWithResult(_0x4ef21f,null))[_0x07c4('0x23')](handleError(_0x4ef21f,null));};exports[_0x07c4('0x4f')]=function(_0x3c0f46,_0x1a1533){var _0x1ed602=_0x3c0f46['params']['id'];var _0x3d75ac;var _0x3c3212;var _0x56698c;return db[_0x07c4('0x39')][_0x07c4('0x50')]({'where':{'id':_0x1ed602}})['then'](function(_0x319865){_0x3d75ac=_0x319865;return db['ChatWebsite'][_0x07c4('0x50')]({'where':{'id':_0x319865[_0x07c4('0x51')]},'attributes':['id',_0x07c4('0x52'),_0x07c4('0x53'),_0x07c4('0x54'),_0x07c4('0x55'),_0x07c4('0x56')],'raw':!![]});})[_0x07c4('0x18')](function(_0x4507b5){if(_0x4507b5&&_0x4507b5[_0x07c4('0x52')]&&_0x4507b5['vidaooEscalation']){_0x3c3212=_0x4507b5;var _0x17911f={'interaction':{'id':_0x1ed602},'agent':{'id':_0x3c0f46[_0x07c4('0x42')]['id'],'name':_0x3c0f46[_0x07c4('0x42')]['name'],'fullname':_0x3c0f46[_0x07c4('0x42')][_0x07c4('0x57')],'email':_0x3c0f46[_0x07c4('0x42')][_0x07c4('0x58')]},'contact':_0x3c0f46['body']['contact'],'account':_0x3c0f46[_0x07c4('0x4d')][_0x07c4('0x37')]};var _0x1ca68d={'rejectUnauthorized':![],'method':_0x07c4('0x59'),'url':_0x07c4('0x5a'),'headers':{'X-APIKEY':_0x4507b5['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x3c0f46[_0x07c4('0x42')][_0x07c4('0x58')]],'buttons':null,'topic':_0x3c3212['vidaooTopic'],'note':_['isNull'](_0x3c3212[_0x07c4('0x55')])?null:getMustacheRender(_0x3c3212[_0x07c4('0x55')],_0x17911f),'metadata':null},'redirect':'follow','json':!![]};try{if(!_['isNull'](_0x3c3212[_0x07c4('0x56')])){var _0x6d02fa=getMustacheRender(_0x3c3212[_0x07c4('0x56')],_0x17911f);var _0x4a79e8=JSON['parse'](_0x6d02fa);_0x1ca68d[_0x07c4('0x4d')][_0x07c4('0x5b')]=_0x4a79e8;}}catch(_0x523922){throw new db[(_0x07c4('0x5c'))]['ValidationError'](_0x07c4('0x5d'));}return rp(_0x1ca68d);}else{throw new db['Sequelize'][(_0x07c4('0x5e'))](_0x07c4('0x5f'));}})['then'](function(_0x4b1f2e){_0x56698c=_0x4b1f2e;if(_0x56698c['id']){var _0x1b365a={'body':_0x56698c[_0x07c4('0x60')],'ChatWebsiteId':_0x3c3212['id'],'ChatInteractionId':_0x3d75ac['id'],'direction':_0x07c4('0x61'),'UserId':_0x3c0f46[_0x07c4('0x42')]['id']};return db[_0x07c4('0x62')][_0x07c4('0x63')](_0x1b365a,{});}else{throw new db[(_0x07c4('0x5c'))]['ValidationError'](_0x07c4('0x64'));}})[_0x07c4('0x18')](function(){return _0x3d75ac[_0x07c4('0x65')]({'vidaooSessionId':_0x56698c['id']});})[_0x07c4('0x18')](respondWithResult(_0x1a1533,null))[_0x07c4('0x23')](handleError(_0x1a1533,null));};exports[_0x07c4('0x66')]=function(_0x36ec8f,_0x58a8d8){if(_0x36ec8f[_0x07c4('0x4d')]['id']){delete _0x36ec8f[_0x07c4('0x4d')]['id'];}return db[_0x07c4('0x39')][_0x07c4('0x4c')]({'where':{'id':_0x36ec8f['params']['id']},'include':[{'model':db[_0x07c4('0x67')],'as':_0x07c4('0x68')}]})[_0x07c4('0x18')](handleEntityNotFound(_0x58a8d8,null))[_0x07c4('0x18')](saveUpdates(_0x36ec8f[_0x07c4('0x4d')],null))[_0x07c4('0x18')](respondWithResult(_0x58a8d8,null))[_0x07c4('0x23')](handleError(_0x58a8d8,null));};exports[_0x07c4('0x69')]=function(_0x9f8626,_0x1bba1e){if(_0x9f8626[_0x07c4('0x4d')]['id']){delete _0x9f8626[_0x07c4('0x4d')]['id'];}return db[_0x07c4('0x39')][_0x07c4('0x4c')]({'where':{'id':_0x9f8626[_0x07c4('0x43')]['id']}})[_0x07c4('0x18')](function(_0x4d4097){if(!_0x4d4097){logger[_0x07c4('0x1e')](_0x07c4('0x6a'),'abandon',0x194,'entity\x20not\x20found');_0x1bba1e[_0x07c4('0x24')](0x194);}else{if(_0x4d4097['UserId']){throw new db[(_0x07c4('0x5c'))][(_0x07c4('0x5e'))](_0x07c4('0x6b'));}}return _0x4d4097;})[_0x07c4('0x18')](function(_0x48d605){if(_0x48d605){return _0x48d605['update']({'closed':_0x9f8626['body'][_0x07c4('0x6c')],'disposition':_0x9f8626[_0x07c4('0x4d')][_0x07c4('0x6d')]})['then'](function(_0x179694){return _0x179694;});}})[_0x07c4('0x18')](function(){return respondWithRpcPromise('AbandonInteraction','abandon',_0x9f8626[_0x07c4('0x4d')],client9004);})[_0x07c4('0x18')](respondWithResult(_0x1bba1e,null))[_0x07c4('0x23')](handleError(_0x1bba1e,null));};exports[_0x07c4('0x6e')]=function(_0x265a84,_0x5e2c89){_0x265a84[_0x07c4('0x4d')][_0x07c4('0x30')]=_0x265a84[_0x07c4('0x6f')][_0x07c4('0x70')];_0x265a84['body'][_0x07c4('0x71')]=_0x265a84[_0x07c4('0x6f')][_0x07c4('0x72')];_0x265a84[_0x07c4('0x4d')][_0x07c4('0x3c')]=_0x265a84[_0x07c4('0x6f')]['mimetype'];return db[_0x07c4('0x73')][_0x07c4('0x63')](_0x265a84[_0x07c4('0x4d')])[_0x07c4('0x18')](respondWithResult(_0x5e2c89,0xc9))[_0x07c4('0x23')](handleError(_0x5e2c89,null));};exports[_0x07c4('0x74')]=function(_0x3d2cfd,_0x43320f){return db['ChatInteraction']['findOne']({'where':{'id':_0x3d2cfd[_0x07c4('0x43')]['id']},'raw':!![]})[_0x07c4('0x18')](handleEntityNotFound(_0x43320f,null))[_0x07c4('0x18')](function(_0x385ec7){if(_0x385ec7){if(_0x385ec7['closed']){return _0x43320f['status'](0x193)['json']({'status':0x193,'message':_0x07c4('0x75')});}return db[_0x07c4('0x73')][_0x07c4('0x50')]({'where':{'id':_0x3d2cfd[_0x07c4('0x41')][_0x07c4('0x76')]},'raw':!![]})['then'](handleEntityNotFound(_0x43320f,null));}})[_0x07c4('0x18')](function(_0xa36e4f){if(_0xa36e4f){var _0x272856=_0xa36e4f[_0x07c4('0x77')]!==null;var _0xf3159f=path[_0x07c4('0x78')](config[_0x07c4('0x79')],_0x07c4('0x7a'));if(_0x272856){_0xf3159f=path[_0x07c4('0x78')](_0xf3159f,'offline-chat/');}var _0x3fc5b3=path[_0x07c4('0x78')](_0xf3159f,_0xa36e4f['basename']);return _0x43320f['download'](_0x3fc5b3);}})[_0x07c4('0x23')](handleError(_0x43320f,null));};exports[_0x07c4('0x7b')]=function(_0xcbdfc5,_0x417a04){var _0x33cae2=null;var _0x4f7fe6=null;var _0x3e263f=null;if(_0xcbdfc5[_0x07c4('0x4d')]['id']){delete _0xcbdfc5[_0x07c4('0x4d')]['id'];}if(_0xcbdfc5[_0x07c4('0x4d')][_0x07c4('0x7c')]){_0x3e263f=path[_0x07c4('0x78')](config[_0x07c4('0x79')],_0x07c4('0x7d'),util[_0x07c4('0x7e')](_0x07c4('0x7f'),Date['now']()));_0xcbdfc5['body'][_0x07c4('0x80')]=_0x3e263f;}return db[_0x07c4('0x39')][_0x07c4('0x4c')]({'where':{'id':_0xcbdfc5[_0x07c4('0x43')]['id']},'include':[{'model':db[_0x07c4('0x62')],'as':_0x07c4('0x81'),'include':[{'model':db['User'],'as':'User'}]}]})['then'](handleEntityNotFound(_0x417a04,null))[_0x07c4('0x18')](saveUpdates(_0xcbdfc5[_0x07c4('0x4d')],null))[_0x07c4('0x18')](function(_0x556971){if(_0x556971){_0x33cae2=_0x556971;return db[_0x07c4('0x82')][_0x07c4('0x4c')]({'where':{'id':_0x33cae2[_0x07c4('0x51')]}});}})['then'](function(_0x4a2102){if(_0x4a2102){_0x4f7fe6=_0x4a2102;return db[_0x07c4('0x67')][_0x07c4('0x4c')]({'where':{'id':_0x33cae2['ContactId']}});}})[_0x07c4('0x18')](function(_0x3a616a){if(_0x3a616a){if(_0x3e263f){var _0x12564c=null;for(var _0x56fc44=0x1;_0x56fc44<_0x33cae2['Messages'][_0x07c4('0x49')];++_0x56fc44){_0x12564c=_0x33cae2[_0x07c4('0x81')][_0x56fc44];var _0x43ffb4=_0x12564c[_0x07c4('0x83')]?util[_0x07c4('0x7e')](_0x07c4('0x84'),_0x4f7fe6['agentAlias'],_0x12564c[_0x07c4('0x83')]):_0x07c4('0x85');var _0x7b9766=_0xcbdfc5[_0x07c4('0x4d')][_0x07c4('0x86')]||util[_0x07c4('0x7e')](_0x07c4('0x84'),_0x07c4('0x87'),_0x12564c[_0x07c4('0x88')]);switch(_0x4f7fe6[_0x07c4('0x89')]){case'website_alias':_0x43ffb4=_0x12564c[_0x07c4('0x83')]?util[_0x07c4('0x7e')](_0x07c4('0x84'),_0x4f7fe6[_0x07c4('0x8a')],_0x12564c[_0x07c4('0x83')]):_0x07c4('0x85');break;case _0x07c4('0x8b'):_0x43ffb4=_0x12564c['UserId']?_0x12564c[_0x07c4('0x8c')][_0x07c4('0x8d')]||_0x12564c[_0x07c4('0x8c')][_0x07c4('0x57')]:'System';break;case _0x07c4('0x8e'):_0x43ffb4=_0x12564c['UserId']?_0x12564c['User'][_0x07c4('0x57')]:_0x07c4('0x85');break;default:_0x43ffb4=_0x12564c['UserId']?util[_0x07c4('0x7e')](_0x07c4('0x84'),_0x4f7fe6['agentAlias'],_0x12564c[_0x07c4('0x83')]):'System';}var _0x572494=util[_0x07c4('0x7e')](_0x07c4('0x8f'),moment(_0x12564c['createdAt'])[_0x07c4('0x7e')](_0x07c4('0x90')),_0x12564c[_0x07c4('0x91')]==='in'?_0x7b9766:_0x43ffb4,_0x12564c[_0x07c4('0x4d')]);if(!_0x12564c[_0x07c4('0x92')]){fs['appendFileSync'](_0x3e263f,_0x572494);}}return db[_0x07c4('0x93')][_0x07c4('0x50')]({'where':{'service':!![]},'include':[{'model':db[_0x07c4('0x94')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x07c4('0x95')],'as':_0x07c4('0x95'),'raw':!![]}]}]});}}})['then'](function(_0x1eb92c){if(!_0x1eb92c||!_0x1eb92c[_0x07c4('0x96')]||!_0xcbdfc5['body'])return _0x33cae2;var _0x574056=_0x1eb92c[_0x07c4('0x97')]();return respondWithRpcPromise(_0x07c4('0x98'),_0x07c4('0x99'),{'account':_0x574056,'message':{'from':util[_0x07c4('0x7e')](_0x07c4('0x9a'),_0x1eb92c[_0x07c4('0x30')],_0x1eb92c[_0x07c4('0x58')]||_0x1eb92c[_0x07c4('0x96')]['user']),'to':_0xcbdfc5[_0x07c4('0x4d')]['mailTranscript'],'subject':'Mail\x20Transcript','text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0xcbdfc5[_0x07c4('0x4d')]['mailTranscript']),'attachments':[{'path':_0x3e263f}]}})['then'](function(){return _0x33cae2;})[_0x07c4('0x23')](function(_0x3486d2){logger['error'](_0x3486d2);});})[_0x07c4('0x18')](respondWithStatusCode(_0x417a04,0xc8))[_0x07c4('0x23')](handleError(_0x417a04,null));};exports[_0x07c4('0x9b')]=function(_0x49c87e,_0x2ef9ea){return db['ChatMessage'][_0x07c4('0x4c')]({'where':{'id':_0x49c87e[_0x07c4('0x43')]['id']}})[_0x07c4('0x18')](handleEntityNotFound(_0x2ef9ea,null))[_0x07c4('0x18')](function(_0x109d57){if(_0x109d57){return _0x109d57[_0x07c4('0x9b')](_0x49c87e['body'][_0x07c4('0x9c')],_['omit'](_0x49c87e[_0x07c4('0x4d')],[_0x07c4('0x9c'),'id'])||{});}})['then'](respondWithResult(_0x2ef9ea,null))[_0x07c4('0x23')](handleError(_0x2ef9ea,null));};exports['getMessages']=function(_0x4b09d0,_0x5e22d8){var _0xf50cef={'raw':![],'where':{}};var _0x5ebe41={};var _0x41df45={'count':0x0,'rows':[]};return db[_0x07c4('0x39')][_0x07c4('0x50')]({'where':{'id':_0x4b09d0['params']['id']}})[_0x07c4('0x18')](handleEntityNotFound(_0x5e22d8,null))[_0x07c4('0x18')](function(_0x25ab71){if(_0x25ab71){_0x5ebe41[_0x07c4('0x47')]=_[_0x07c4('0x44')](db['ChatMessage']['rawAttributes']);_0x5ebe41[_0x07c4('0x41')]=_[_0x07c4('0x44')](_0x4b09d0[_0x07c4('0x41')]);_0x5ebe41['filters']=_['intersection'](_0x5ebe41[_0x07c4('0x47')],_0x5ebe41['query']);_0xf50cef[_0x07c4('0x48')]=_[_0x07c4('0x46')](_0x5ebe41[_0x07c4('0x47')],qs[_0x07c4('0x9d')](_0x4b09d0[_0x07c4('0x41')][_0x07c4('0x9d')]));_0xf50cef[_0x07c4('0x48')]=_0xf50cef[_0x07c4('0x48')]['length']?_0xf50cef[_0x07c4('0x48')]:_0x5ebe41[_0x07c4('0x47')];if(!_0x4b09d0[_0x07c4('0x41')][_0x07c4('0x9e')](_0x07c4('0x9f'))){_0xf50cef['limit']=qs['limit'](_0x4b09d0[_0x07c4('0x41')][_0x07c4('0x28')]);_0xf50cef[_0x07c4('0x27')]=qs[_0x07c4('0x27')](_0x4b09d0[_0x07c4('0x41')][_0x07c4('0x27')]);}_0xf50cef[_0x07c4('0xa0')]=qs['sort'](_0x4b09d0[_0x07c4('0x41')][_0x07c4('0xa1')]);_0xf50cef['where']=qs[_0x07c4('0x45')](_[_0x07c4('0xa2')](_0x4b09d0[_0x07c4('0x41')],_0x5ebe41[_0x07c4('0x45')]));_0xf50cef['where'][_0x07c4('0xa3')]=_0x25ab71['id'];if(_0x4b09d0[_0x07c4('0x41')][_0x07c4('0xa4')]){_0xf50cef[_0x07c4('0xa5')]=_['merge'](_0xf50cef[_0x07c4('0xa5')],{'$or':_[_0x07c4('0x38')](_0xf50cef['attributes'],function(_0x1a7ad0){var _0x20e39f={};_0x20e39f[_0x1a7ad0]={'$like':'%'+_0x4b09d0[_0x07c4('0x41')][_0x07c4('0xa4')]+'%'};return _0x20e39f;})});}if(_0x4b09d0[_0x07c4('0x41')]['$gte']){var _0x598fce=_0x4b09d0[_0x07c4('0x41')]['$gte'][_0x07c4('0xa6')](',');var _0x2d3aac={};_0x2d3aac[_0x598fce[0x0]]={'$gte':moment(_0x598fce[0x1])['format'](_0x07c4('0xa7'))};_0xf50cef[_0x07c4('0xa5')]=_[_0x07c4('0x33')](_0xf50cef[_0x07c4('0xa5')],_0x2d3aac);}_0xf50cef=_[_0x07c4('0x33')]({},_0xf50cef,_0x4b09d0['options']);return db[_0x07c4('0x62')][_0x07c4('0x2a')]({'where':_0xf50cef[_0x07c4('0xa5')]})[_0x07c4('0x18')](function(_0x42e0b3){_0x41df45[_0x07c4('0x2a')]=_0x42e0b3;if(_0x4b09d0[_0x07c4('0x41')][_0x07c4('0x4a')]){_0xf50cef['include']=[{'all':!![]}];}return db[_0x07c4('0x62')][_0x07c4('0x3f')](_0xf50cef);})[_0x07c4('0x18')](function(_0x28f5d1){_0x41df45[_0x07c4('0xa8')]=_0x28f5d1;return _0x41df45;});}})[_0x07c4('0x18')](respondWithFilteredResult(_0x5e22d8,_0xf50cef))['catch'](handleError(_0x5e22d8,null));};exports[_0x07c4('0xa9')]=function(_0x37f292,_0x26f46d){var _0x59dd54={'where':{}},_0x2ec676={},_0x465996={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x07c4('0x50')]({'where':{'id':_0x37f292[_0x07c4('0x43')]['id']}})['then'](handleEntityNotFound(_0x26f46d,null))[_0x07c4('0x18')](function(_0x2176ee){if(_0x2176ee){_0x2ec676[_0x07c4('0x47')]=_[_0x07c4('0x44')](db[_0x07c4('0x62')][_0x07c4('0x3a')]);_0x2ec676[_0x07c4('0x41')]=_['keys'](_0x37f292[_0x07c4('0x41')]);_0x2ec676[_0x07c4('0x45')]=_[_0x07c4('0x46')](_0x2ec676[_0x07c4('0x47')],_0x2ec676[_0x07c4('0x41')]);_0x59dd54[_0x07c4('0x48')]=_[_0x07c4('0x46')](_0x2ec676[_0x07c4('0x47')],qs[_0x07c4('0x9d')](_0x37f292[_0x07c4('0x41')][_0x07c4('0x9d')]));_0x59dd54['attributes']=_0x59dd54[_0x07c4('0x48')][_0x07c4('0x49')]?_0x59dd54['attributes']:_0x2ec676[_0x07c4('0x47')];if(!_0x37f292['query'][_0x07c4('0x9e')](_0x07c4('0x9f'))){_0x59dd54[_0x07c4('0x28')]=qs[_0x07c4('0x28')](_0x37f292[_0x07c4('0x41')]['limit']);_0x59dd54[_0x07c4('0x27')]=qs[_0x07c4('0x27')](_0x37f292[_0x07c4('0x41')][_0x07c4('0x27')]);}_0x59dd54[_0x07c4('0xa0')]=qs['sort'](_0x37f292[_0x07c4('0x41')][_0x07c4('0xa1')]);_0x59dd54[_0x07c4('0xa5')]=qs[_0x07c4('0x45')](_[_0x07c4('0xa2')](_0x37f292[_0x07c4('0x41')],_0x2ec676[_0x07c4('0x45')]));_0x59dd54[_0x07c4('0xa5')][_0x07c4('0xa3')]=_0x2176ee['id'];if(_0x37f292[_0x07c4('0x41')]['filter']){_0x59dd54[_0x07c4('0xa5')]=_[_0x07c4('0x33')](_0x59dd54[_0x07c4('0xa5')],{'$or':_[_0x07c4('0x38')](_0x59dd54[_0x07c4('0x48')],function(_0x357e74){var _0x731b0c={};_0x731b0c[_0x357e74]={'$like':'%'+_0x37f292[_0x07c4('0x41')][_0x07c4('0xa4')]+'%'};return _0x731b0c;})});}_0x59dd54['where'][_0x07c4('0x92')]=![];if(_0x37f292[_0x07c4('0x41')]['id']){_0x59dd54['where']['id']={'$gt':_0x37f292[_0x07c4('0x41')]['id']};}_0x59dd54=_[_0x07c4('0x33')]({},_0x59dd54,_0x37f292[_0x07c4('0xaa')]);return db['ChatMessage'][_0x07c4('0x2a')]({'where':_0x59dd54[_0x07c4('0xa5')]})[_0x07c4('0x18')](function(_0x432c3e){_0x465996[_0x07c4('0x2a')]=_0x432c3e;_0x59dd54[_0x07c4('0x4b')]=[];if(_0x37f292['query']['includeAgent']){_0x59dd54[_0x07c4('0x4b')][_0x07c4('0xab')]({'model':db[_0x07c4('0x8c')],'as':_0x07c4('0x8c'),'attributes':['id',_0x07c4('0x57'),'alias']});}if(_0x37f292['query'][_0x07c4('0x4a')]){_0x59dd54[_0x07c4('0x4b')]=[{'all':!![]}];}return db[_0x07c4('0x62')]['findAll'](_0x59dd54);})[_0x07c4('0x18')](function(_0x58e577){_0x465996['rows']=_0x58e577;return _0x465996;});}})[_0x07c4('0x18')](respondWithFilteredResult(_0x26f46d,_0x59dd54))[_0x07c4('0x23')](handleError(_0x26f46d,null));};exports[_0x07c4('0xac')]=function(_0x3edebb,_0x12440c){return db[_0x07c4('0x39')][_0x07c4('0x4c')]({'where':{'id':_0x3edebb[_0x07c4('0x43')]['id']}})['then'](handleEntityNotFound(_0x12440c,null))[_0x07c4('0x18')](function(_0x51bd3b){if(_0x51bd3b){return _0x51bd3b[_0x07c4('0xad')](_0x3edebb[_0x07c4('0x4d')][_0x07c4('0x9c')],_[_0x07c4('0xae')](_0x3edebb[_0x07c4('0x4d')],['ids','id'])||{})['spread'](function(){return db['Tag'][_0x07c4('0x3f')]({'attributes':['id',_0x07c4('0x30'),_0x07c4('0xaf')],'where':{'id':_0x3edebb[_0x07c4('0x4d')][_0x07c4('0x9c')]}});})['then'](function(_0xb83228){socket[_0x07c4('0xb0')](_0x07c4('0xb1'),{'id':Number(_0x3edebb[_0x07c4('0x43')]['id']),'tags':_0xb83228||[]});return{'id':Number(_0x3edebb[_0x07c4('0x43')]['id']),'tags':_0xb83228||[]};});}})[_0x07c4('0x18')](respondWithResult(_0x12440c,null))[_0x07c4('0x23')](handleError(_0x12440c,null));};exports[_0x07c4('0xb2')]=function(_0x1b9638,_0x5b37e0){return db[_0x07c4('0x39')][_0x07c4('0x4c')]({'where':{'id':_0x1b9638[_0x07c4('0x43')]['id']}})[_0x07c4('0x18')](handleEntityNotFound(_0x5b37e0,null))[_0x07c4('0x18')](function(_0xd52aad){if(_0xd52aad){return _0xd52aad[_0x07c4('0xb2')](_0x1b9638['query'][_0x07c4('0x9c')]);}})[_0x07c4('0x18')](respondWithStatusCode(_0x5b37e0,null))['catch'](handleError(_0x5b37e0,null));};exports['download']=function(_0xeae675,_0x226eac){var _0x285977=moment()[_0x07c4('0xb3')]()[_0x07c4('0xb4')]();var _0x559c5b=path[_0x07c4('0x78')](config[_0x07c4('0x79')],_0x07c4('0xb5'),_0x07c4('0xb6'),_0x07c4('0xb7'));var _0x55c6af=path[_0x07c4('0x78')](config[_0x07c4('0x79')],'server',_0x07c4('0xb6'),'attachments');var _0x2bc7b7=path[_0x07c4('0x78')](_0x559c5b,_0x285977);var _0x3b63df=util['format']('transcript-%d-%s.zip',_0xeae675['params']['id'],_0x285977);var _0x442405=path[_0x07c4('0x78')](_0x559c5b,_0x3b63df);var _0x2e0d93=[];_0x2e0d93['push']({'model':db[_0x07c4('0x8c')],'as':_0x07c4('0x8c'),'attributes':['id',_0x07c4('0x57')],'raw':!![]});_0x2e0d93[_0x07c4('0xab')]({'model':db[_0x07c4('0x67')],'as':'Contact','attributes':['id',_0x07c4('0xb8'),_0x07c4('0xb9')],'raw':!![]});if(_0xeae675[_0x07c4('0x41')][_0x07c4('0xba')]){_0x2e0d93[_0x07c4('0xab')]({'model':db['Attachment'],'as':_0x07c4('0x73'),'raw':!![]});}var _0x10188e=[{'model':db['ChatMessage'],'as':_0x07c4('0x81'),'attributes':['id',_0x07c4('0x4d'),_0x07c4('0xbb'),_0x07c4('0x91'),_0x07c4('0x92'),_0x07c4('0xbc')],'include':_0x2e0d93}];_0x10188e[_0x07c4('0xab')]({'model':db[_0x07c4('0x82')],'as':'Account','attributes':['id',_0x07c4('0x30')]});_0x10188e[_0x07c4('0xab')]({'model':db[_0x07c4('0x8c')],'as':_0x07c4('0xbd'),'attributes':['id',_0x07c4('0x57')]});return db[_0x07c4('0x39')][_0x07c4('0x4c')]({'where':{'id':_0xeae675['params']['id']},'include':_0x10188e})[_0x07c4('0x18')](handleEntityNotFound(_0x226eac,null))[_0x07c4('0x18')](function(_0xa78072){if(_0xa78072){var _0x4d2b66=_0xa78072['get']({'plain':!![]});fs[_0x07c4('0xbe')](_0x2bc7b7);var _0x4fd9c4={'channel':_0x07c4('0xbf'),'account':_0x4d2b66[_0x07c4('0xc0')][_0x07c4('0x30')],'agent':_0x4d2b66[_0x07c4('0xbd')]?_0x4d2b66[_0x07c4('0xbd')]['fullname']:_0x07c4('0xc1'),'createdAt':moment(_0x4d2b66[_0x07c4('0xbb')])[_0x07c4('0x7e')](_0x07c4('0xa7'))[_0x07c4('0xb4')](),'closedAt':_0x4d2b66['closed']?moment(_0x4d2b66[_0x07c4('0xc2')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x07c4('0xb4')]():'','disposition':_0x4d2b66[_0x07c4('0x6d')],'chatInfo':{'browser':_0x4d2b66[_0x07c4('0xc3')],'os':_0x4d2b66[_0x07c4('0xc4')],'referer':_0x4d2b66['referer'],'customerIp':_0x4d2b66[_0x07c4('0xc5')],'customerPort':_0x4d2b66[_0x07c4('0xc6')]?_0x4d2b66[_0x07c4('0xc6')]:_0x07c4('0xc1')},'messages':_(_0x4d2b66[_0x07c4('0x81')])[_0x07c4('0xc7')]()[_0x07c4('0xa4')]({'secret':![]})['map'](function(_0x24714b){if(_0x24714b[_0x07c4('0x73')]){var _0x19e3be=path[_0x07c4('0x78')](_0x55c6af,_0x24714b[_0x07c4('0x73')][_0x07c4('0x71')]);if(fs[_0x07c4('0xc8')](_0x19e3be)){fs[_0x07c4('0xc9')](_0x19e3be)[_0x07c4('0xca')](fs[_0x07c4('0xcb')](path['join'](_0x2bc7b7,_0x24714b[_0x07c4('0x73')][_0x07c4('0x71')])));}}return{'date':moment(_0x24714b[_0x07c4('0xbb')])[_0x07c4('0x7e')](_0x07c4('0xa7'))[_0x07c4('0xb4')](),'sender':_0x24714b[_0x07c4('0x91')]==='out'?_0x24714b['User']?_0x24714b[_0x07c4('0x8c')][_0x07c4('0x57')]:_0x07c4('0x85'):_0x24714b[_0x07c4('0x68')][_0x07c4('0xb8')]+(_0x24714b[_0x07c4('0x68')][_0x07c4('0xb9')]?'\x20'+_0x24714b['Contact'][_0x07c4('0xb9')]:''),'body':_0x24714b[_0x07c4('0x73')]?_0x24714b[_0x07c4('0x73')][_0x07c4('0x71')]:_0x24714b[_0x07c4('0x4d')],'direction':_0x24714b['direction']===_0x07c4('0x61')?'A':'C','secret':_0x24714b[_0x07c4('0x92')],'read':_0x24714b[_0x07c4('0xbc')],'attachment':_0x24714b[_0x07c4('0x73')]};})[_0x07c4('0xcc')]()};return ejs[_0x07c4('0xcd')](path[_0x07c4('0x78')](config['root'],'server',_0x07c4('0xce'),_0x07c4('0xcf')),{'interaction':_0x4fd9c4})[_0x07c4('0x18')](function(_0x26ffb2){var _0x3acf50=path['join'](_0x2bc7b7,_0x07c4('0xd0')+_0x4d2b66['id']+'-'+_0x285977+_0x07c4('0xd1'));var _0x231cc0={'path':_0x3acf50,'channel':'Chat','interactionId':_0x4d2b66['id']};return pdf[_0x07c4('0xd2')](_0x26ffb2,_0x231cc0);})[_0x07c4('0x18')](function(){return new Promise(function(_0x3199c5,_0x3b8e1b){zipdir(_0x2bc7b7,{'saveTo':_0x442405},function(_0x2b2169,_0x3a3572){if(_0x2b2169)return _0x3b8e1b(_0x2b2169);return _0x3199c5(_0x3a3572);});})[_0x07c4('0x18')](function(){return new BPromise(function(_0x3dcc65,_0x4b14a3){rimraf(_0x2bc7b7,function(_0x1da8ba){if(_0x1da8ba)_0x4b14a3(_0x1da8ba);return _0x3dcc65();});});})[_0x07c4('0x18')](function(){return _0x226eac[_0x07c4('0xd3')](_0x442405,_0x3b63df,function(_0x37c993){if(_0x37c993){logger[_0x07c4('0x1e')](_0x07c4('0xd4'),_0x37c993);}else{fs[_0x07c4('0xd5')](_0x442405);}});});});}else{return _0x226eac[_0x07c4('0x24')](0xc8);}})[_0x07c4('0x23')](handleError(_0x226eac,null));}; \ No newline at end of file +var _0x67b8=['err','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','http','client','info','ChatInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','offset','limit','undefined','count','update','then','destroy','stack','name','render','merge','contact','interaction','index','map','ChatInteraction','fieldName','type','key','chat','query','user','show','params','model','keys','filters','attributes','intersection','fields','includeAll','include','options','find','create','body','describe','createVidaooSession','findOne','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','email','account','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','parse','metadata','Sequelize','ValidationError','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','closed','disposition','AbandonInteraction','file','originalname','basename','mimetype','Attachment','attachmentDownload','json','Unauthorized','attachId','ChatOfflineMessageId','join','root','offline-chat/','close','server/files/chat/upload/','format','pathTranscript','Messages','User','ChatWebsite','ContactId','UserId','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','agent_alias','alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','direction','appendFileSync','MailAccount','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','mailTranscript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','ChatMessage','addMessage','omit','ids','getMessages','length','nolimit','sort','where','pick','filter','$gte','split','findAll','rows','getMyMessages','rawAttributes','hasOwnProperty','order','ChatInteractionId','secret','includeAgent','push','addTags','setTags','Tag','color','emit','chatInteractionTags:save','removeTags','download','toString','server','files','tmp','attachments','transcript-%d-%s.zip','Contact','firstName','lastName','read','Owner','get','mkdirSync','Chat','N.A.','closedAt','browserName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','YYYY-MM-DD\x20HH:mm:ss','out','value','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML'];(function(_0x47ca84,_0x53253a){var _0x2403b9=function(_0x5dc560){while(--_0x5dc560){_0x47ca84['push'](_0x47ca84['shift']());}};_0x2403b9(++_0x53253a);}(_0x67b8,0x1a2));var _0x867b=function(_0xd6f99a,_0x58b858){_0xd6f99a=_0xd6f99a-0x0;var _0x536558=_0x67b8[_0xd6f99a];return _0x536558;};'use strict';var rimraf=require(_0x867b('0x0'));var zipdir=require(_0x867b('0x1'));var rp=require(_0x867b('0x2'));var moment=require(_0x867b('0x3'));var BPromise=require(_0x867b('0x4'));var Mustache=require('mustache');var util=require(_0x867b('0x5'));var path=require(_0x867b('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x867b('0x7'));var Redis=require(_0x867b('0x8'));var interaction=require(_0x867b('0x9'));var qs=require(_0x867b('0xa'));var pdf=require('../../components/export/pdf');var logger=require(_0x867b('0xb'))(_0x867b('0xc'));var config=require(_0x867b('0xd'));var db=require(_0x867b('0xe'))['db'];config[_0x867b('0xf')]=_[_0x867b('0x10')](config[_0x867b('0xf')],{'host':_0x867b('0x11'),'port':0x18eb});var socket=require(_0x867b('0x12'))(new Redis(config[_0x867b('0xf')]));require(_0x867b('0x13'))[_0x867b('0x14')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x867b('0x15')]({'port':0x232b});var client9004=jayson[_0x867b('0x16')][_0x867b('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x233244,_0x5159a7,_0xb3decd,_0x9636c0){return new BPromise(function(_0x3ef479,_0x19758e){var _0x20525f=_0x9636c0||client;return _0x20525f['request'](_0x233244,_0xb3decd)['then'](function(_0x369c12){logger[_0x867b('0x17')](_0x867b('0x18'),_0x5159a7,'request\x20sent');logger[_0x867b('0x19')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x5159a7,_0x867b('0x1a'),JSON[_0x867b('0x1b')](_0x369c12));if(_0x369c12[_0x867b('0x1c')]){if(_0x369c12[_0x867b('0x1c')][_0x867b('0x1d')]===0x1f4){logger[_0x867b('0x1c')]('ChatInteraction,\x20%s,\x20%s',_0x5159a7,_0x369c12['error'][_0x867b('0x1e')]);return _0x19758e(_0x369c12[_0x867b('0x1c')][_0x867b('0x1e')]);}logger[_0x867b('0x1c')](_0x867b('0x18'),_0x5159a7,_0x369c12['error'][_0x867b('0x1e')]);return _0x3ef479(_0x369c12[_0x867b('0x1c')][_0x867b('0x1e')]);}else{logger[_0x867b('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x5159a7,'request\x20sent');_0x3ef479(_0x369c12[_0x867b('0x1f')][_0x867b('0x1e')]);}})[_0x867b('0x20')](function(_0xfa0d96){logger[_0x867b('0x1c')](_0x867b('0x18'),_0x5159a7,_0xfa0d96);_0x19758e(_0xfa0d96);});});}function respondWithStatusCode(_0x5be086,_0x21e54e){_0x21e54e=_0x21e54e||0xcc;return function(_0x365b26){if(_0x365b26){return _0x5be086[_0x867b('0x21')](_0x21e54e);}return _0x5be086[_0x867b('0x22')](_0x21e54e)[_0x867b('0x23')]();};}function respondWithResult(_0x330979,_0x242a5c){_0x242a5c=_0x242a5c||0xc8;return function(_0x15dd68){if(_0x15dd68){return _0x330979['status'](_0x242a5c)['json'](_0x15dd68);}};}function respondWithFilteredResult(_0x3a92d6,_0x33c339){return function(_0x4b952){if(_0x4b952){var _0x154637=typeof _0x33c339[_0x867b('0x24')]==='undefined'&&typeof _0x33c339[_0x867b('0x25')]===_0x867b('0x26');var _0x168541=_0x4b952[_0x867b('0x27')];var _0x3bcba8=_0x154637?0x0:_0x33c339['offset'];var _0x511ace=_0x154637?_0x4b952['count']:_0x33c339['offset']+_0x33c339[_0x867b('0x25')];var _0x170c43;if(_0x511ace>=_0x168541){_0x511ace=_0x168541;_0x170c43=0xc8;}else{_0x170c43=0xce;}_0x3a92d6[_0x867b('0x22')](_0x170c43);return _0x3a92d6['set']('Content-Range',_0x3bcba8+'-'+_0x511ace+'/'+_0x168541)['json'](_0x4b952);}return null;};}function saveUpdates(_0x11f73a){return function(_0x3a38fc){if(_0x3a38fc){return _0x3a38fc[_0x867b('0x28')](_0x11f73a)[_0x867b('0x29')](function(_0x72f82a){return _0x72f82a;});}return null;};}function removeEntity(_0x112344){return function(_0xad5ffb){if(_0xad5ffb){return _0xad5ffb[_0x867b('0x2a')]()[_0x867b('0x29')](function(){_0x112344[_0x867b('0x22')](0xcc)[_0x867b('0x23')]();});}};}function handleEntityNotFound(_0x5d8444){return function(_0x59ec88){if(!_0x59ec88){_0x5d8444['sendStatus'](0x194);}return _0x59ec88;};}function handleError(_0x55a797,_0x12262c){_0x12262c=_0x12262c||0x1f4;return function(_0x391a77){logger[_0x867b('0x1c')](_0x391a77[_0x867b('0x2b')]);if(_0x391a77[_0x867b('0x2c')]){delete _0x391a77['name'];}_0x55a797['status'](_0x12262c)['send'](_0x391a77);};}function getMustacheRender(_0x2c99ef,_0x336000){return Mustache[_0x867b('0x2d')](_0x2c99ef,_[_0x867b('0x2e')](_0x336000['body'],{'contact':_0x336000[_0x867b('0x2f')],'message':_0x336000[_0x867b('0x1e')],'agent':_0x336000['agent'],'interaction':_0x336000[_0x867b('0x30')],'account':_0x336000['account']}))||'';}exports[_0x867b('0x31')]=function(_0x36845d,_0x1148a7){var _0x2d6d2c={};var _0x253683=_[_0x867b('0x32')](db[_0x867b('0x33')]['rawAttributes'],function(_0x439fb3){return{'name':_0x439fb3[_0x867b('0x34')],'type':_0x439fb3[_0x867b('0x35')][_0x867b('0x36')]};});_0x2d6d2c=qs['getOptions'](_0x253683,_0x36845d);return interaction['findAll'](_0x867b('0x37'),_0x36845d[_0x867b('0x38')],_0x36845d[_0x867b('0x39')],_0x2d6d2c,_0x253683)[_0x867b('0x29')](respondWithFilteredResult(_0x1148a7,_0x2d6d2c))[_0x867b('0x20')](handleError(_0x1148a7,null));};exports[_0x867b('0x3a')]=function(_0x14b2ff,_0x5efe7c){var _0x541424={'raw':![],'where':{'id':_0x14b2ff[_0x867b('0x3b')]['id']}},_0x31bc26={};_0x31bc26[_0x867b('0x3c')]=_[_0x867b('0x3d')](db[_0x867b('0x33')]['rawAttributes']);_0x31bc26['query']=_[_0x867b('0x3d')](_0x14b2ff[_0x867b('0x38')]);_0x31bc26[_0x867b('0x3e')]=_['intersection'](_0x31bc26[_0x867b('0x3c')],_0x31bc26['query']);_0x541424[_0x867b('0x3f')]=_[_0x867b('0x40')](_0x31bc26[_0x867b('0x3c')],qs[_0x867b('0x41')](_0x14b2ff['query'][_0x867b('0x41')]));_0x541424[_0x867b('0x3f')]=_0x541424['attributes']['length']?_0x541424[_0x867b('0x3f')]:_0x31bc26[_0x867b('0x3c')];if(_0x14b2ff[_0x867b('0x38')][_0x867b('0x42')]){_0x541424[_0x867b('0x43')]=[{'all':!![]}];}_0x541424=_[_0x867b('0x2e')]({},_0x541424,_0x14b2ff[_0x867b('0x44')]);return db[_0x867b('0x33')][_0x867b('0x45')](_0x541424)[_0x867b('0x29')](handleEntityNotFound(_0x5efe7c,null))[_0x867b('0x29')](respondWithResult(_0x5efe7c,null))[_0x867b('0x20')](handleError(_0x5efe7c,null));};exports['create']=function(_0x1530d9,_0x99c0f0){return db['ChatInteraction'][_0x867b('0x46')](_0x1530d9['body'],{})[_0x867b('0x29')](respondWithResult(_0x99c0f0,0xc9))['catch'](handleError(_0x99c0f0,null));};exports[_0x867b('0x28')]=function(_0x5c0f0b,_0x4046aa){if(_0x5c0f0b[_0x867b('0x47')]['id']){delete _0x5c0f0b['body']['id'];}return db[_0x867b('0x33')][_0x867b('0x45')]({'where':{'id':_0x5c0f0b[_0x867b('0x3b')]['id']}})[_0x867b('0x29')](handleEntityNotFound(_0x4046aa,null))[_0x867b('0x29')](saveUpdates(_0x5c0f0b[_0x867b('0x47')],null))[_0x867b('0x29')](respondWithResult(_0x4046aa,null))[_0x867b('0x20')](handleError(_0x4046aa,null));};exports['destroy']=function(_0x415bb9,_0x4dc699){return db[_0x867b('0x33')][_0x867b('0x45')]({'where':{'id':_0x415bb9[_0x867b('0x3b')]['id']}})[_0x867b('0x29')](handleEntityNotFound(_0x4dc699,null))[_0x867b('0x29')](removeEntity(_0x4dc699,null))[_0x867b('0x20')](handleError(_0x4dc699,null));};exports[_0x867b('0x48')]=function(_0x4dc6e3,_0x170c86){return db[_0x867b('0x33')][_0x867b('0x48')]()[_0x867b('0x29')](respondWithResult(_0x170c86,null))[_0x867b('0x20')](handleError(_0x170c86,null));};exports[_0x867b('0x49')]=function(_0x4de4c1,_0x48b70b){var _0x413108=_0x4de4c1['params']['id'];var _0x5b794c;var _0x3c59e1;var _0x4967b4;return db[_0x867b('0x33')]['findOne']({'where':{'id':_0x413108}})[_0x867b('0x29')](function(_0x2dae4f){_0x5b794c=_0x2dae4f;return db['ChatWebsite'][_0x867b('0x4a')]({'where':{'id':_0x2dae4f[_0x867b('0x4b')]},'attributes':['id',_0x867b('0x4c'),_0x867b('0x4d'),_0x867b('0x4e'),_0x867b('0x4f'),_0x867b('0x50')],'raw':!![]});})[_0x867b('0x29')](function(_0x3d45d2){if(_0x3d45d2&&_0x3d45d2[_0x867b('0x4c')]&&_0x3d45d2['vidaooEscalation']){_0x3c59e1=_0x3d45d2;var _0x8b4909={'interaction':{'id':_0x413108},'agent':{'id':_0x4de4c1[_0x867b('0x39')]['id'],'name':_0x4de4c1[_0x867b('0x39')][_0x867b('0x2c')],'fullname':_0x4de4c1[_0x867b('0x39')]['fullname'],'email':_0x4de4c1[_0x867b('0x39')][_0x867b('0x51')]},'contact':_0x4de4c1[_0x867b('0x47')][_0x867b('0x2f')],'account':_0x4de4c1['body'][_0x867b('0x52')]};var _0xd05b75={'rejectUnauthorized':![],'method':_0x867b('0x53'),'url':_0x867b('0x54'),'headers':{'X-APIKEY':_0x3d45d2['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x4de4c1[_0x867b('0x39')][_0x867b('0x51')]],'buttons':null,'topic':_0x3c59e1[_0x867b('0x4e')],'note':_[_0x867b('0x55')](_0x3c59e1[_0x867b('0x4f')])?null:getMustacheRender(_0x3c59e1[_0x867b('0x4f')],_0x8b4909),'metadata':null},'redirect':_0x867b('0x56'),'json':!![]};try{if(!_[_0x867b('0x55')](_0x3c59e1[_0x867b('0x50')])){var _0x5df88f=getMustacheRender(_0x3c59e1[_0x867b('0x50')],_0x8b4909);var _0x4ebdd7=JSON[_0x867b('0x57')](_0x5df88f);_0xd05b75[_0x867b('0x47')][_0x867b('0x58')]=_0x4ebdd7;}}catch(_0x343c2f){throw new db[(_0x867b('0x59'))][(_0x867b('0x5a'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0xd05b75);}else{throw new db['Sequelize']['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})['then'](function(_0xdcda02){_0x4967b4=_0xdcda02;if(_0x4967b4['id']){var _0x2f31ff={'body':_0x4967b4['join_url'],'ChatWebsiteId':_0x3c59e1['id'],'ChatInteractionId':_0x5b794c['id'],'direction':'out','UserId':_0x4de4c1['user']['id']};return db['ChatMessage']['create'](_0x2f31ff,{});}else{throw new db[(_0x867b('0x59'))][(_0x867b('0x5a'))](_0x867b('0x5b'));}})[_0x867b('0x29')](function(){return _0x5b794c[_0x867b('0x5c')]({'vidaooSessionId':_0x4967b4['id']});})[_0x867b('0x29')](respondWithResult(_0x48b70b,null))[_0x867b('0x20')](handleError(_0x48b70b,null));};exports[_0x867b('0x5d')]=function(_0x41710c,_0x340350){if(_0x41710c[_0x867b('0x47')]['id']){delete _0x41710c['body']['id'];}return db[_0x867b('0x33')]['find']({'where':{'id':_0x41710c[_0x867b('0x3b')]['id']},'include':[{'model':db[_0x867b('0x5e')],'as':'Contact'}]})[_0x867b('0x29')](handleEntityNotFound(_0x340350,null))['then'](saveUpdates(_0x41710c[_0x867b('0x47')],null))[_0x867b('0x29')](respondWithResult(_0x340350,null))['catch'](handleError(_0x340350,null));};exports[_0x867b('0x5f')]=function(_0xe174a1,_0x253e27){if(_0xe174a1[_0x867b('0x47')]['id']){delete _0xe174a1[_0x867b('0x47')]['id'];}return db['ChatInteraction'][_0x867b('0x45')]({'where':{'id':_0xe174a1[_0x867b('0x3b')]['id']}})[_0x867b('0x29')](function(_0x43bcb5){if(!_0x43bcb5){logger[_0x867b('0x1c')](_0x867b('0x60'),_0x867b('0x5f'),0x194,'entity\x20not\x20found');_0x253e27['sendStatus'](0x194);}else{if(_0x43bcb5['UserId']){throw new db[(_0x867b('0x59'))][(_0x867b('0x5a'))]('Interaction\x20already\x20assigned');}}return _0x43bcb5;})[_0x867b('0x29')](function(_0x1f5a90){if(_0x1f5a90){return _0x1f5a90[_0x867b('0x28')]({'closed':_0xe174a1[_0x867b('0x47')][_0x867b('0x61')],'disposition':_0xe174a1[_0x867b('0x47')][_0x867b('0x62')]})[_0x867b('0x29')](function(_0x1e64d0){return _0x1e64d0;});}})[_0x867b('0x29')](function(){return respondWithRpcPromise(_0x867b('0x63'),_0x867b('0x5f'),_0xe174a1['body'],client9004);})[_0x867b('0x29')](respondWithResult(_0x253e27,null))[_0x867b('0x20')](handleError(_0x253e27,null));};exports['attachmentUpload']=function(_0x4640a3,_0x3807ca){_0x4640a3[_0x867b('0x47')][_0x867b('0x2c')]=_0x4640a3[_0x867b('0x64')][_0x867b('0x65')];_0x4640a3['body'][_0x867b('0x66')]=_0x4640a3[_0x867b('0x64')]['filename'];_0x4640a3[_0x867b('0x47')][_0x867b('0x35')]=_0x4640a3[_0x867b('0x64')][_0x867b('0x67')];return db[_0x867b('0x68')][_0x867b('0x46')](_0x4640a3[_0x867b('0x47')])['then'](respondWithResult(_0x3807ca,0xc9))[_0x867b('0x20')](handleError(_0x3807ca,null));};exports[_0x867b('0x69')]=function(_0x1efc5f,_0x77e33c){return db[_0x867b('0x33')][_0x867b('0x4a')]({'where':{'id':_0x1efc5f[_0x867b('0x3b')]['id']},'raw':!![]})[_0x867b('0x29')](handleEntityNotFound(_0x77e33c,null))[_0x867b('0x29')](function(_0x22b597){if(_0x22b597){if(_0x22b597['closed']){return _0x77e33c[_0x867b('0x22')](0x193)[_0x867b('0x6a')]({'status':0x193,'message':_0x867b('0x6b')});}return db[_0x867b('0x68')][_0x867b('0x4a')]({'where':{'id':_0x1efc5f[_0x867b('0x38')][_0x867b('0x6c')]},'raw':!![]})[_0x867b('0x29')](handleEntityNotFound(_0x77e33c,null));}})[_0x867b('0x29')](function(_0x32bbc9){if(_0x32bbc9){var _0x5b714c=_0x32bbc9[_0x867b('0x6d')]!==null;var _0x465e39=path[_0x867b('0x6e')](config[_0x867b('0x6f')],'server/files/attachments/');if(_0x5b714c){_0x465e39=path[_0x867b('0x6e')](_0x465e39,_0x867b('0x70'));}var _0x46453d=path[_0x867b('0x6e')](_0x465e39,_0x32bbc9[_0x867b('0x66')]);return _0x77e33c['download'](_0x46453d);}})[_0x867b('0x20')](handleError(_0x77e33c,null));};exports[_0x867b('0x71')]=function(_0x404c5e,_0x36bfb3){var _0x2474d9=null;var _0x5e8edb=null;var _0x3b8a83=null;if(_0x404c5e[_0x867b('0x47')]['id']){delete _0x404c5e[_0x867b('0x47')]['id'];}if(_0x404c5e[_0x867b('0x47')]['mailTranscript']){_0x3b8a83=path[_0x867b('0x6e')](config[_0x867b('0x6f')],_0x867b('0x72'),util[_0x867b('0x73')]('transcript-%s.txt',Date['now']()));_0x404c5e[_0x867b('0x47')][_0x867b('0x74')]=_0x3b8a83;}return db['ChatInteraction'][_0x867b('0x45')]({'where':{'id':_0x404c5e[_0x867b('0x3b')]['id']},'include':[{'model':db['ChatMessage'],'as':_0x867b('0x75'),'include':[{'model':db['User'],'as':_0x867b('0x76')}]}]})[_0x867b('0x29')](handleEntityNotFound(_0x36bfb3,null))[_0x867b('0x29')](saveUpdates(_0x404c5e[_0x867b('0x47')],null))[_0x867b('0x29')](function(_0x5399c8){if(_0x5399c8){_0x2474d9=_0x5399c8;return db[_0x867b('0x77')][_0x867b('0x45')]({'where':{'id':_0x2474d9[_0x867b('0x4b')]}});}})[_0x867b('0x29')](function(_0x27faa2){if(_0x27faa2){_0x5e8edb=_0x27faa2;return db[_0x867b('0x5e')]['find']({'where':{'id':_0x2474d9[_0x867b('0x78')]}});}})['then'](function(_0x3e6798){if(_0x3e6798){if(_0x3b8a83){var _0xd672b5=null;for(var _0x52b9fe=0x1;_0x52b9fe<_0x2474d9[_0x867b('0x75')]['length'];++_0x52b9fe){_0xd672b5=_0x2474d9[_0x867b('0x75')][_0x52b9fe];var _0x23a026=_0xd672b5[_0x867b('0x79')]?util[_0x867b('0x73')](_0x867b('0x7a'),_0x5e8edb[_0x867b('0x7b')],_0xd672b5[_0x867b('0x79')]):_0x867b('0x7c');var _0x310f46=_0x404c5e['body'][_0x867b('0x7d')]||util[_0x867b('0x73')](_0x867b('0x7a'),_0x867b('0x7e'),_0xd672b5['ContactId']);switch(_0x5e8edb[_0x867b('0x7f')]){case'website_alias':_0x23a026=_0xd672b5['UserId']?util[_0x867b('0x73')](_0x867b('0x7a'),_0x5e8edb[_0x867b('0x7b')],_0xd672b5[_0x867b('0x79')]):_0x867b('0x7c');break;case _0x867b('0x80'):_0x23a026=_0xd672b5['UserId']?_0xd672b5[_0x867b('0x76')][_0x867b('0x81')]||_0xd672b5[_0x867b('0x76')][_0x867b('0x82')]:_0x867b('0x7c');break;case _0x867b('0x83'):_0x23a026=_0xd672b5[_0x867b('0x79')]?_0xd672b5['User'][_0x867b('0x82')]:_0x867b('0x7c');break;default:_0x23a026=_0xd672b5[_0x867b('0x79')]?util[_0x867b('0x73')](_0x867b('0x7a'),_0x5e8edb[_0x867b('0x7b')],_0xd672b5[_0x867b('0x79')]):'System';}var _0x19c5dc=util[_0x867b('0x73')](_0x867b('0x84'),moment(_0xd672b5[_0x867b('0x85')])['format']('MM/DD/YYYY\x20HH:mm:ss'),_0xd672b5[_0x867b('0x86')]==='in'?_0x310f46:_0x23a026,_0xd672b5[_0x867b('0x47')]);if(!_0xd672b5['secret']){fs[_0x867b('0x87')](_0x3b8a83,_0x19c5dc);}}return db[_0x867b('0x88')][_0x867b('0x4a')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x867b('0x89')],'as':_0x867b('0x89'),'raw':!![]}]}]});}}})['then'](function(_0x3faf53){if(!_0x3faf53||!_0x3faf53['Smtp']||!_0x404c5e['body'])return _0x2474d9;var _0x5e9a45=_0x3faf53[_0x867b('0x8a')]();return respondWithRpcPromise(_0x867b('0x8b'),_0x867b('0x8c'),{'account':_0x5e9a45,'message':{'from':util[_0x867b('0x73')](_0x867b('0x8d'),_0x3faf53[_0x867b('0x2c')],_0x3faf53['email']||_0x3faf53['Smtp'][_0x867b('0x39')]),'to':_0x404c5e[_0x867b('0x47')][_0x867b('0x8e')],'subject':'Mail\x20Transcript','text':util[_0x867b('0x73')](_0x867b('0x8f'),_0x404c5e[_0x867b('0x47')][_0x867b('0x8e')]),'attachments':[{'path':_0x3b8a83}]}})[_0x867b('0x29')](function(){return _0x2474d9;})[_0x867b('0x20')](function(_0x2207d1){logger[_0x867b('0x1c')](_0x2207d1);});})[_0x867b('0x29')](respondWithStatusCode(_0x36bfb3,0xc8))['catch'](handleError(_0x36bfb3,null));};exports['addMessage']=function(_0x479d70,_0x5d2586){return db[_0x867b('0x90')]['find']({'where':{'id':_0x479d70[_0x867b('0x3b')]['id']}})['then'](handleEntityNotFound(_0x5d2586,null))[_0x867b('0x29')](function(_0x416cfc){if(_0x416cfc){return _0x416cfc[_0x867b('0x91')](_0x479d70['body']['ids'],_[_0x867b('0x92')](_0x479d70['body'],[_0x867b('0x93'),'id'])||{});}})[_0x867b('0x29')](respondWithResult(_0x5d2586,null))[_0x867b('0x20')](handleError(_0x5d2586,null));};exports[_0x867b('0x94')]=function(_0x495843,_0xccac22){var _0x5b45f2={'raw':![],'where':{}};var _0x53127e={};var _0x259f16={'count':0x0,'rows':[]};return db[_0x867b('0x33')][_0x867b('0x4a')]({'where':{'id':_0x495843['params']['id']}})[_0x867b('0x29')](handleEntityNotFound(_0xccac22,null))[_0x867b('0x29')](function(_0x17300d){if(_0x17300d){_0x53127e['model']=_[_0x867b('0x3d')](db[_0x867b('0x90')]['rawAttributes']);_0x53127e['query']=_[_0x867b('0x3d')](_0x495843[_0x867b('0x38')]);_0x53127e[_0x867b('0x3e')]=_['intersection'](_0x53127e['model'],_0x53127e[_0x867b('0x38')]);_0x5b45f2['attributes']=_[_0x867b('0x40')](_0x53127e['model'],qs[_0x867b('0x41')](_0x495843[_0x867b('0x38')][_0x867b('0x41')]));_0x5b45f2['attributes']=_0x5b45f2['attributes'][_0x867b('0x95')]?_0x5b45f2[_0x867b('0x3f')]:_0x53127e[_0x867b('0x3c')];if(!_0x495843[_0x867b('0x38')]['hasOwnProperty'](_0x867b('0x96'))){_0x5b45f2[_0x867b('0x25')]=qs['limit'](_0x495843['query'][_0x867b('0x25')]);_0x5b45f2['offset']=qs[_0x867b('0x24')](_0x495843[_0x867b('0x38')][_0x867b('0x24')]);}_0x5b45f2['order']=qs[_0x867b('0x97')](_0x495843[_0x867b('0x38')]['sort']);_0x5b45f2[_0x867b('0x98')]=qs[_0x867b('0x3e')](_[_0x867b('0x99')](_0x495843[_0x867b('0x38')],_0x53127e[_0x867b('0x3e')]));_0x5b45f2[_0x867b('0x98')]['ChatInteractionId']=_0x17300d['id'];if(_0x495843[_0x867b('0x38')]['filter']){_0x5b45f2[_0x867b('0x98')]=_[_0x867b('0x2e')](_0x5b45f2['where'],{'$or':_[_0x867b('0x32')](_0x5b45f2[_0x867b('0x3f')],function(_0x42e083){var _0x306918={};_0x306918[_0x42e083]={'$like':'%'+_0x495843['query'][_0x867b('0x9a')]+'%'};return _0x306918;})});}if(_0x495843[_0x867b('0x38')][_0x867b('0x9b')]){var _0x3e6005=_0x495843[_0x867b('0x38')]['$gte'][_0x867b('0x9c')](',');var _0x527c93={};_0x527c93[_0x3e6005[0x0]]={'$gte':moment(_0x3e6005[0x1])[_0x867b('0x73')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5b45f2[_0x867b('0x98')]=_[_0x867b('0x2e')](_0x5b45f2['where'],_0x527c93);}_0x5b45f2=_['merge']({},_0x5b45f2,_0x495843['options']);return db[_0x867b('0x90')][_0x867b('0x27')]({'where':_0x5b45f2[_0x867b('0x98')]})[_0x867b('0x29')](function(_0xac34db){_0x259f16['count']=_0xac34db;if(_0x495843['query']['includeAll']){_0x5b45f2[_0x867b('0x43')]=[{'all':!![]}];}return db[_0x867b('0x90')][_0x867b('0x9d')](_0x5b45f2);})[_0x867b('0x29')](function(_0x5d4b99){_0x259f16[_0x867b('0x9e')]=_0x5d4b99;return _0x259f16;});}})[_0x867b('0x29')](respondWithFilteredResult(_0xccac22,_0x5b45f2))[_0x867b('0x20')](handleError(_0xccac22,null));};exports[_0x867b('0x9f')]=function(_0x4b68c3,_0x9e383b){var _0x468cfc={'where':{}},_0x597665={},_0x54ab0f={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x867b('0x4a')]({'where':{'id':_0x4b68c3[_0x867b('0x3b')]['id']}})[_0x867b('0x29')](handleEntityNotFound(_0x9e383b,null))[_0x867b('0x29')](function(_0x47db8c){if(_0x47db8c){_0x597665['model']=_[_0x867b('0x3d')](db[_0x867b('0x90')][_0x867b('0xa0')]);_0x597665[_0x867b('0x38')]=_[_0x867b('0x3d')](_0x4b68c3[_0x867b('0x38')]);_0x597665[_0x867b('0x3e')]=_['intersection'](_0x597665[_0x867b('0x3c')],_0x597665['query']);_0x468cfc[_0x867b('0x3f')]=_[_0x867b('0x40')](_0x597665[_0x867b('0x3c')],qs[_0x867b('0x41')](_0x4b68c3[_0x867b('0x38')]['fields']));_0x468cfc['attributes']=_0x468cfc[_0x867b('0x3f')][_0x867b('0x95')]?_0x468cfc[_0x867b('0x3f')]:_0x597665[_0x867b('0x3c')];if(!_0x4b68c3[_0x867b('0x38')][_0x867b('0xa1')](_0x867b('0x96'))){_0x468cfc[_0x867b('0x25')]=qs[_0x867b('0x25')](_0x4b68c3[_0x867b('0x38')][_0x867b('0x25')]);_0x468cfc[_0x867b('0x24')]=qs['offset'](_0x4b68c3['query']['offset']);}_0x468cfc[_0x867b('0xa2')]=qs[_0x867b('0x97')](_0x4b68c3[_0x867b('0x38')][_0x867b('0x97')]);_0x468cfc[_0x867b('0x98')]=qs['filters'](_[_0x867b('0x99')](_0x4b68c3[_0x867b('0x38')],_0x597665['filters']));_0x468cfc[_0x867b('0x98')][_0x867b('0xa3')]=_0x47db8c['id'];if(_0x4b68c3[_0x867b('0x38')][_0x867b('0x9a')]){_0x468cfc[_0x867b('0x98')]=_[_0x867b('0x2e')](_0x468cfc['where'],{'$or':_[_0x867b('0x32')](_0x468cfc[_0x867b('0x3f')],function(_0x4718ff){var _0x18612b={};_0x18612b[_0x4718ff]={'$like':'%'+_0x4b68c3[_0x867b('0x38')][_0x867b('0x9a')]+'%'};return _0x18612b;})});}_0x468cfc['where'][_0x867b('0xa4')]=![];if(_0x4b68c3[_0x867b('0x38')]['id']){_0x468cfc[_0x867b('0x98')]['id']={'$gt':_0x4b68c3['query']['id']};}_0x468cfc=_[_0x867b('0x2e')]({},_0x468cfc,_0x4b68c3['options']);return db[_0x867b('0x90')]['count']({'where':_0x468cfc[_0x867b('0x98')]})[_0x867b('0x29')](function(_0x15ec9b){_0x54ab0f[_0x867b('0x27')]=_0x15ec9b;_0x468cfc[_0x867b('0x43')]=[];if(_0x4b68c3[_0x867b('0x38')][_0x867b('0xa5')]){_0x468cfc[_0x867b('0x43')][_0x867b('0xa6')]({'model':db['User'],'as':_0x867b('0x76'),'attributes':['id',_0x867b('0x82'),_0x867b('0x81')]});}if(_0x4b68c3[_0x867b('0x38')][_0x867b('0x42')]){_0x468cfc['include']=[{'all':!![]}];}return db[_0x867b('0x90')]['findAll'](_0x468cfc);})[_0x867b('0x29')](function(_0x531c10){_0x54ab0f[_0x867b('0x9e')]=_0x531c10;return _0x54ab0f;});}})['then'](respondWithFilteredResult(_0x9e383b,_0x468cfc))[_0x867b('0x20')](handleError(_0x9e383b,null));};exports[_0x867b('0xa7')]=function(_0x126aad,_0x4e26bb){return db[_0x867b('0x33')][_0x867b('0x45')]({'where':{'id':_0x126aad[_0x867b('0x3b')]['id']}})['then'](handleEntityNotFound(_0x4e26bb,null))[_0x867b('0x29')](function(_0x5f53f0){if(_0x5f53f0){return _0x5f53f0[_0x867b('0xa8')](_0x126aad[_0x867b('0x47')][_0x867b('0x93')],_[_0x867b('0x92')](_0x126aad[_0x867b('0x47')],[_0x867b('0x93'),'id'])||{})['spread'](function(){return db[_0x867b('0xa9')][_0x867b('0x9d')]({'attributes':['id',_0x867b('0x2c'),_0x867b('0xaa')],'where':{'id':_0x126aad['body']['ids']}});})[_0x867b('0x29')](function(_0x2345ff){socket[_0x867b('0xab')](_0x867b('0xac'),{'id':Number(_0x126aad[_0x867b('0x3b')]['id']),'tags':_0x2345ff||[]});return{'id':Number(_0x126aad[_0x867b('0x3b')]['id']),'tags':_0x2345ff||[]};});}})[_0x867b('0x29')](respondWithResult(_0x4e26bb,null))[_0x867b('0x20')](handleError(_0x4e26bb,null));};exports[_0x867b('0xad')]=function(_0xc58ca5,_0x397e06){return db[_0x867b('0x33')][_0x867b('0x45')]({'where':{'id':_0xc58ca5[_0x867b('0x3b')]['id']}})[_0x867b('0x29')](handleEntityNotFound(_0x397e06,null))[_0x867b('0x29')](function(_0x180c8a){if(_0x180c8a){return _0x180c8a[_0x867b('0xad')](_0xc58ca5[_0x867b('0x38')][_0x867b('0x93')]);}})[_0x867b('0x29')](respondWithStatusCode(_0x397e06,null))['catch'](handleError(_0x397e06,null));};exports[_0x867b('0xae')]=function(_0x106d0b,_0xfc685f){var _0x54311c=moment()['unix']()[_0x867b('0xaf')]();var _0x23fca8=path[_0x867b('0x6e')](config[_0x867b('0x6f')],_0x867b('0xb0'),_0x867b('0xb1'),_0x867b('0xb2'));var _0x1b3cfa=path['join'](config[_0x867b('0x6f')],_0x867b('0xb0'),_0x867b('0xb1'),_0x867b('0xb3'));var _0x5b67af=path[_0x867b('0x6e')](_0x23fca8,_0x54311c);var _0x31c7a5=util[_0x867b('0x73')](_0x867b('0xb4'),_0x106d0b[_0x867b('0x3b')]['id'],_0x54311c);var _0x2d1ba3=path[_0x867b('0x6e')](_0x23fca8,_0x31c7a5);var _0x48d90c=[];_0x48d90c[_0x867b('0xa6')]({'model':db[_0x867b('0x76')],'as':_0x867b('0x76'),'attributes':['id','fullname'],'raw':!![]});_0x48d90c[_0x867b('0xa6')]({'model':db[_0x867b('0x5e')],'as':_0x867b('0xb5'),'attributes':['id',_0x867b('0xb6'),_0x867b('0xb7')],'raw':!![]});if(_0x106d0b[_0x867b('0x38')][_0x867b('0xb3')]){_0x48d90c[_0x867b('0xa6')]({'model':db['Attachment'],'as':_0x867b('0x68'),'raw':!![]});}var _0x4fd7ca=[{'model':db[_0x867b('0x90')],'as':_0x867b('0x75'),'attributes':['id',_0x867b('0x47'),_0x867b('0x85'),_0x867b('0x86'),_0x867b('0xa4'),_0x867b('0xb8')],'include':_0x48d90c}];_0x4fd7ca[_0x867b('0xa6')]({'model':db['ChatWebsite'],'as':'Account','attributes':['id','name']});_0x4fd7ca['push']({'model':db[_0x867b('0x76')],'as':_0x867b('0xb9'),'attributes':['id','fullname']});return db[_0x867b('0x33')]['find']({'where':{'id':_0x106d0b[_0x867b('0x3b')]['id']},'include':_0x4fd7ca})['then'](handleEntityNotFound(_0xfc685f,null))[_0x867b('0x29')](function(_0x29f1ef){if(_0x29f1ef){var _0x26e429=_0x29f1ef[_0x867b('0xba')]({'plain':!![]});fs[_0x867b('0xbb')](_0x5b67af);var _0x151d6a={'channel':_0x867b('0xbc'),'account':_0x26e429['Account']['name'],'agent':_0x26e429[_0x867b('0xb9')]?_0x26e429[_0x867b('0xb9')][_0x867b('0x82')]:_0x867b('0xbd'),'createdAt':moment(_0x26e429[_0x867b('0x85')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x26e429[_0x867b('0x61')]?moment(_0x26e429[_0x867b('0xbe')])[_0x867b('0x73')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x26e429['disposition'],'chatInfo':{'browser':_0x26e429[_0x867b('0xbf')],'os':_0x26e429['osName'],'referer':_0x26e429[_0x867b('0xc0')],'customerIp':_0x26e429[_0x867b('0xc1')],'customerPort':_0x26e429['customerPort']?_0x26e429[_0x867b('0xc2')]:_0x867b('0xbd')},'messages':_(_0x26e429['Messages'])[_0x867b('0xc3')]()[_0x867b('0x9a')]({'secret':![]})['map'](function(_0x285f2a){if(_0x285f2a[_0x867b('0x68')]){var _0x3150bd=path[_0x867b('0x6e')](_0x1b3cfa,_0x285f2a[_0x867b('0x68')]['basename']);if(fs[_0x867b('0xc4')](_0x3150bd)){fs[_0x867b('0xc5')](_0x3150bd)[_0x867b('0xc6')](fs['createWriteStream'](path['join'](_0x5b67af,_0x285f2a[_0x867b('0x68')]['basename'])));}}return{'date':moment(_0x285f2a[_0x867b('0x85')])[_0x867b('0x73')](_0x867b('0xc7'))[_0x867b('0xaf')](),'sender':_0x285f2a[_0x867b('0x86')]===_0x867b('0xc8')?_0x285f2a[_0x867b('0x76')]?_0x285f2a['User'][_0x867b('0x82')]:_0x867b('0x7c'):_0x285f2a[_0x867b('0xb5')][_0x867b('0xb6')]+(_0x285f2a[_0x867b('0xb5')][_0x867b('0xb7')]?'\x20'+_0x285f2a[_0x867b('0xb5')][_0x867b('0xb7')]:''),'body':_0x285f2a[_0x867b('0x68')]?_0x285f2a[_0x867b('0x68')]['basename']:_0x285f2a[_0x867b('0x47')],'direction':_0x285f2a[_0x867b('0x86')]===_0x867b('0xc8')?'A':'C','secret':_0x285f2a[_0x867b('0xa4')],'read':_0x285f2a[_0x867b('0xb8')],'attachment':_0x285f2a[_0x867b('0x68')]};})[_0x867b('0xc9')]()};return ejs['renderFile'](path[_0x867b('0x6e')](config[_0x867b('0x6f')],_0x867b('0xb0'),'views',_0x867b('0xca')),{'interaction':_0x151d6a})[_0x867b('0x29')](function(_0x13e5f1){var _0x5ee344=path[_0x867b('0x6e')](_0x5b67af,_0x867b('0xcb')+_0x26e429['id']+'-'+_0x54311c+_0x867b('0xcc'));var _0x1400ae={'path':_0x5ee344,'channel':'Chat','interactionId':_0x26e429['id']};return pdf[_0x867b('0xcd')](_0x13e5f1,_0x1400ae);})[_0x867b('0x29')](function(){return new Promise(function(_0x2ef25d,_0x1b7c82){zipdir(_0x5b67af,{'saveTo':_0x2d1ba3},function(_0x1c33ca,_0x3b10c5){if(_0x1c33ca)return _0x1b7c82(_0x1c33ca);return _0x2ef25d(_0x3b10c5);});})['then'](function(){return new BPromise(function(_0x2c9f5d,_0x11dff2){rimraf(_0x5b67af,function(_0x32625d){if(_0x32625d)_0x11dff2(_0x32625d);return _0x2c9f5d();});});})['then'](function(){return _0xfc685f[_0x867b('0xae')](_0x2d1ba3,_0x31c7a5,function(_0x4a3f7d){if(_0x4a3f7d){logger[_0x867b('0x1c')](_0x867b('0xce'),_0x4a3f7d);}else{fs[_0x867b('0xcf')](_0x2d1ba3);}});});});}else{return _0xfc685f['sendStatus'](0xc8);}})[_0x867b('0x20')](handleError(_0xfc685f,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 97cc3ea..ffdacf3 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 _0x4ee9=['events','ChatInteraction','../../mysqldb','ChatMessage','setMaxListeners','update','getUsers','then','findAll','setDataValue','unreadMessages','emit','catch','hasOwnProperty','hook'];(function(_0x4b7410,_0x47dfc9){var _0x30a546=function(_0x57b75d){while(--_0x57b75d){_0x4b7410['push'](_0x4b7410['shift']());}};_0x30a546(++_0x47dfc9);}(_0x4ee9,0x11d));var _0x94ee=function(_0x13c1d8,_0x5e4259){_0x13c1d8=_0x13c1d8-0x0;var _0x36607b=_0x4ee9[_0x13c1d8];return _0x36607b;};'use strict';var EventEmitter=require(_0x94ee('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x94ee('0x1')];var ChatMessage=require(_0x94ee('0x2'))['db'][_0x94ee('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x94ee('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x94ee('0x5'),'afterDestroy':'remove'};function emitEvent(_0x558393){return function(_0x41600b,_0x55ff13,_0x274320){_0x41600b[_0x94ee('0x6')]({'attributes':['id'],'raw':!![]})[_0x94ee('0x7')](function(_0x41a0b1){_0x41600b['setDataValue']('Users',_0x41a0b1['map'](function(_0x38f8f4){return{'id':_0x38f8f4['id']};}));return ChatMessage[_0x94ee('0x8')]({'where':{'ChatInteractionId':_0x41600b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x94ee('0x7')](function(_0x327cab){_0x41600b[_0x94ee('0x9')](_0x94ee('0xa'),_0x327cab['length']);ChatInteractionEvents[_0x94ee('0xb')](_0x558393+':'+_0x41600b['id'],_0x41600b);ChatInteractionEvents[_0x94ee('0xb')](_0x558393,_0x41600b);_0x274320(null);})[_0x94ee('0xc')](_0x274320(null));};}for(var e in events){if(events[_0x94ee('0xd')](e)){var event=events[e];ChatInteraction[_0x94ee('0xe')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x7a9e=['unreadMessages','emit','catch','hasOwnProperty','exports','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','remove','then','setDataValue','Users','map','findAll'];(function(_0x44d41a,_0x55b3b7){var _0x10e373=function(_0x2d71b7){while(--_0x2d71b7){_0x44d41a['push'](_0x44d41a['shift']());}};_0x10e373(++_0x55b3b7);}(_0x7a9e,0x1e5));var _0xe7a9=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x7a9e[_0x57b54c];return _0x59cc19;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0xe7a9('0x0'))['db'][_0xe7a9('0x1')];var ChatMessage=require('../../mysqldb')['db'][_0xe7a9('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xe7a9('0x3')](0x0);var events={'afterCreate':_0xe7a9('0x4'),'afterUpdate':'update','afterDestroy':_0xe7a9('0x5')};function emitEvent(_0x3911ef){return function(_0x3662bd,_0x43a68c,_0xbbf1a0){_0x3662bd['getUsers']({'attributes':['id'],'raw':!![]})[_0xe7a9('0x6')](function(_0x1eb21b){_0x3662bd[_0xe7a9('0x7')](_0xe7a9('0x8'),_0x1eb21b[_0xe7a9('0x9')](function(_0x471cf3){return{'id':_0x471cf3['id']};}));return ChatMessage[_0xe7a9('0xa')]({'where':{'ChatInteractionId':_0x3662bd['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x28fce4){_0x3662bd[_0xe7a9('0x7')](_0xe7a9('0xb'),_0x28fce4['length']);ChatInteractionEvents[_0xe7a9('0xc')](_0x3911ef+':'+_0x3662bd['id'],_0x3662bd);ChatInteractionEvents[_0xe7a9('0xc')](_0x3911ef,_0x3662bd);_0xbbf1a0(null);})[_0xe7a9('0xd')](_0xbbf1a0(null));};}for(var e in events){if(events[_0xe7a9('0xe')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0xe7a9('0xf')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 33ea617..6321c86 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 _0x8a23=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./chatInteraction.attributes','define','ChatInteraction','changed','closed'];(function(_0x4a3150,_0x36cbc5){var _0x25aaa1=function(_0x189c08){while(--_0x189c08){_0x4a3150['push'](_0x4a3150['shift']());}};_0x25aaa1(++_0x36cbc5);}(_0x8a23,0xbf));var _0x38a2=function(_0x4370c7,_0x5dbfb0){_0x4370c7=_0x4370c7-0x0;var _0xce78a9=_0x8a23[_0x4370c7];return _0xce78a9;};'use strict';var _=require(_0x38a2('0x0'));var util=require(_0x38a2('0x1'));var logger=require(_0x38a2('0x2'))('api');var moment=require(_0x38a2('0x3'));var BPromise=require(_0x38a2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x38a2('0x5'));var rimraf=require(_0x38a2('0x6'));var config=require(_0x38a2('0x7'));var attributes=require(_0x38a2('0x8'));module['exports']=function(_0x4545b2,_0x4e6194){return _0x4545b2[_0x38a2('0x9')](_0x38a2('0xa'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4fd3f6,_0x3d94ae,_0x240b04){if(_0x4fd3f6[_0x38a2('0xb')](_0x38a2('0xc'))){_0x4fd3f6[_0x38a2('0xd')]=moment()[_0x38a2('0xe')](_0x38a2('0xf'));}_0x240b04(null,_0x4fd3f6);}},'charset':'utf8mb4','collate':_0x38a2('0x10')});}; \ No newline at end of file +var _0xbdf6=['moment','bluebird','request-promise','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x31a730,_0x1982ef){var _0x193381=function(_0x20be67){while(--_0x20be67){_0x31a730['push'](_0x31a730['shift']());}};_0x193381(++_0x1982ef);}(_0xbdf6,0x1d9));var _0x6bdf=function(_0x56a09d,_0x438162){_0x56a09d=_0x56a09d-0x0;var _0x5bca7e=_0xbdf6[_0x56a09d];return _0x5bca7e;};'use strict';var _=require(_0x6bdf('0x0'));var util=require(_0x6bdf('0x1'));var logger=require(_0x6bdf('0x2'))('api');var moment=require(_0x6bdf('0x3'));var BPromise=require(_0x6bdf('0x4'));var rp=require(_0x6bdf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6bdf('0x6'));module[_0x6bdf('0x7')]=function(_0xb0f85a,_0xc2d041){return _0xb0f85a[_0x6bdf('0x8')](_0x6bdf('0x9'),attributes,{'tableName':_0x6bdf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x58b514,_0x259429,_0x4209bc){if(_0x58b514[_0x6bdf('0xb')](_0x6bdf('0xc'))){_0x58b514[_0x6bdf('0xd')]=moment()['format'](_0x6bdf('0xe'));}_0x4209bc(null,_0x58b514);}},'charset':_0x6bdf('0xf'),'collate':_0x6bdf('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index e59545d..2b9dbce 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 _0x171b=['register','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','options','raw','where','limit','debug','AddTagsToChatInteraction','find','addTags','body','ids','AddTags','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter'];(function(_0x11286e,_0x3c7daf){var _0x58dbf2=function(_0x487f62){while(--_0x487f62){_0x11286e['push'](_0x11286e['shift']());}};_0x58dbf2(++_0x3c7daf);}(_0x171b,0xe2));var _0xb171=function(_0x14499b,_0x4a57c4){_0x14499b=_0x14499b-0x0;var _0x4c52e6=_0x171b[_0x14499b];return _0x4c52e6;};'use strict';var _=require(_0xb171('0x0'));var util=require(_0xb171('0x1'));var moment=require(_0xb171('0x2'));var BPromise=require(_0xb171('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb171('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb171('0x5'));var logger=require(_0xb171('0x6'))('rpc');var config=require(_0xb171('0x7'));var jayson=require(_0xb171('0x8'));var client=jayson[_0xb171('0x9')]['http']({'port':0x232a});config['redis']=_[_0xb171('0xa')](config[_0xb171('0xb')],{'host':_0xb171('0xc'),'port':0x18eb});var socket=require(_0xb171('0xd'))(new Redis(config[_0xb171('0xb')]));require('./chatInteraction.socket')[_0xb171('0xe')](socket);function respondWithRpcPromise(_0xe5e359,_0x4006fb,_0x47c38e){return new BPromise(function(_0x3c6517,_0x25711d){return client['request'](_0xe5e359,_0x47c38e)[_0xb171('0xf')](function(_0x599ff0){logger[_0xb171('0x10')](_0xb171('0x11'),_0x4006fb,_0xb171('0x12'));logger['debug'](_0xb171('0x13'),_0x4006fb,_0xb171('0x12'),JSON[_0xb171('0x14')](_0x599ff0));if(_0x599ff0[_0xb171('0x15')]){if(_0x599ff0[_0xb171('0x15')][_0xb171('0x16')]===0x1f4){logger[_0xb171('0x15')](_0xb171('0x11'),_0x4006fb,_0x599ff0[_0xb171('0x15')][_0xb171('0x17')]);return _0x25711d(_0x599ff0[_0xb171('0x15')]['message']);}logger[_0xb171('0x15')](_0xb171('0x11'),_0x4006fb,_0x599ff0[_0xb171('0x15')][_0xb171('0x17')]);return _0x3c6517(_0x599ff0[_0xb171('0x15')]['message']);}else{logger[_0xb171('0x10')](_0xb171('0x11'),_0x4006fb,'request\x20sent');_0x3c6517(_0x599ff0[_0xb171('0x18')][_0xb171('0x17')]);}})[_0xb171('0x19')](function(_0x293a6e){logger[_0xb171('0x15')](_0xb171('0x11'),_0x4006fb,_0x293a6e);_0x25711d(_0x293a6e);});});}exports[_0xb171('0x1a')]=function(_0x40c0a2){var _0x268574=this;return new Promise(function(_0x720b9b,_0x10082b){return db[_0xb171('0x1b')][_0xb171('0x1c')](_0x40c0a2['body'],{'raw':_0x40c0a2['options']?_0x40c0a2[_0xb171('0x1d')][_0xb171('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40c0a2[_0xb171('0x1d')]?_0x40c0a2[_0xb171('0x1d')][_0xb171('0x1f')]||null:null,'attributes':_0x40c0a2[_0xb171('0x1d')]?_0x40c0a2['options']['attributes']||null:null,'limit':_0x40c0a2[_0xb171('0x1d')]?_0x40c0a2[_0xb171('0x1d')][_0xb171('0x20')]||null:null})[_0xb171('0xf')](function(_0x5ea5cf){logger[_0xb171('0x10')](_0xb171('0x1a'),_0x40c0a2);logger[_0xb171('0x21')](_0xb171('0x1a'),_0x40c0a2,JSON[_0xb171('0x14')](_0x5ea5cf));_0x720b9b(_0x5ea5cf);})['catch'](function(_0x5df91d){logger[_0xb171('0x15')](_0xb171('0x1a'),_0x5df91d[_0xb171('0x17')],_0x40c0a2);_0x10082b(_0x268574[_0xb171('0x15')](0x1f4,_0x5df91d[_0xb171('0x17')]));});});};exports[_0xb171('0x22')]=function(_0x4d8823){return new Promise(function(_0x3d1d58,_0x5cf23a){return db[_0xb171('0x1b')][_0xb171('0x23')]({'where':_0x4d8823[_0xb171('0x1d')]?_0x4d8823[_0xb171('0x1d')][_0xb171('0x1f')]||null:null})[_0xb171('0xf')](function(_0x5114cb){if(_0x5114cb){return _0x5114cb[_0xb171('0x24')](_0x4d8823[_0xb171('0x25')][_0xb171('0x26')],_['omit'](_0x4d8823[_0xb171('0x25')],[_0xb171('0x26'),'id'])||{});}})['spread'](function(_0x4f053a){logger[_0xb171('0x10')](_0xb171('0x27'),_0x4d8823);logger['debug'](_0xb171('0x27'),_0x4d8823,JSON[_0xb171('0x14')](_0x4f053a));_0x3d1d58(_0x4f053a);})[_0xb171('0x19')](function(_0x12c107){logger[_0xb171('0x15')](_0xb171('0x27'),_0x12c107[_0xb171('0x17')],_0x4d8823);_0x5cf23a(_this[_0xb171('0x15')](0x1f4,_0x12c107[_0xb171('0x17')]));});});}; \ No newline at end of file +var _0x166b=['ChatInteraction','addTags','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','localhost','redis','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','UpdateChatInteraction','update','body','options','raw','attributes','limit','debug'];(function(_0x551404,_0x1f05e9){var _0x4743d1=function(_0x4611ce){while(--_0x4611ce){_0x551404['push'](_0x551404['shift']());}};_0x4743d1(++_0x1f05e9);}(_0x166b,0x143));var _0xb166=function(_0x2fd21f,_0x3d6f70){_0x2fd21f=_0x2fd21f-0x0;var _0xdb2087=_0x166b[_0x2fd21f];return _0xdb2087;};'use strict';var _=require(_0xb166('0x0'));var util=require(_0xb166('0x1'));var moment=require(_0xb166('0x2'));var BPromise=require(_0xb166('0x3'));var rs=require(_0xb166('0x4'));var fs=require('fs');var Redis=require(_0xb166('0x5'));var db=require(_0xb166('0x6'))['db'];var utils=require(_0xb166('0x7'));var logger=require(_0xb166('0x8'))(_0xb166('0x9'));var config=require(_0xb166('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xb166('0xb')][_0xb166('0xc')]({'port':0x232a});config['redis']=_[_0xb166('0xd')](config['redis'],{'host':_0xb166('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb166('0xf')]));require(_0xb166('0x10'))[_0xb166('0x11')](socket);function respondWithRpcPromise(_0x52da08,_0x3f6efd,_0x375013){return new BPromise(function(_0x1bc1d0,_0x25f649){return client[_0xb166('0x12')](_0x52da08,_0x375013)[_0xb166('0x13')](function(_0x5235f9){logger[_0xb166('0x14')](_0xb166('0x15'),_0x3f6efd,'request\x20sent');logger['debug'](_0xb166('0x16'),_0x3f6efd,_0xb166('0x17'),JSON[_0xb166('0x18')](_0x5235f9));if(_0x5235f9['error']){if(_0x5235f9['error'][_0xb166('0x19')]===0x1f4){logger['error'](_0xb166('0x15'),_0x3f6efd,_0x5235f9[_0xb166('0x1a')][_0xb166('0x1b')]);return _0x25f649(_0x5235f9[_0xb166('0x1a')][_0xb166('0x1b')]);}logger[_0xb166('0x1a')]('ChatInteraction,\x20%s,\x20%s',_0x3f6efd,_0x5235f9[_0xb166('0x1a')]['message']);return _0x1bc1d0(_0x5235f9['error']['message']);}else{logger[_0xb166('0x14')](_0xb166('0x15'),_0x3f6efd,_0xb166('0x17'));_0x1bc1d0(_0x5235f9['result'][_0xb166('0x1b')]);}})[_0xb166('0x1c')](function(_0x34b66a){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x3f6efd,_0x34b66a);_0x25f649(_0x34b66a);});});}exports[_0xb166('0x1d')]=function(_0x1259b8){var _0x144c05=this;return new Promise(function(_0x8f8170,_0x2ce2bb){return db['ChatInteraction'][_0xb166('0x1e')](_0x1259b8[_0xb166('0x1f')],{'raw':_0x1259b8[_0xb166('0x20')]?_0x1259b8[_0xb166('0x20')][_0xb166('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1259b8[_0xb166('0x20')]?_0x1259b8['options']['where']||null:null,'attributes':_0x1259b8['options']?_0x1259b8[_0xb166('0x20')][_0xb166('0x22')]||null:null,'limit':_0x1259b8[_0xb166('0x20')]?_0x1259b8[_0xb166('0x20')][_0xb166('0x23')]||null:null})[_0xb166('0x13')](function(_0x4291db){logger[_0xb166('0x14')](_0xb166('0x1d'),_0x1259b8);logger[_0xb166('0x24')](_0xb166('0x1d'),_0x1259b8,JSON[_0xb166('0x18')](_0x4291db));_0x8f8170(_0x4291db);})['catch'](function(_0x5916ba){logger['error']('UpdateChatInteraction',_0x5916ba[_0xb166('0x1b')],_0x1259b8);_0x2ce2bb(_0x144c05[_0xb166('0x1a')](0x1f4,_0x5916ba[_0xb166('0x1b')]));});});};exports['AddTagsToChatInteraction']=function(_0x293800){return new Promise(function(_0xd6a3fc,_0x1c909e){return db[_0xb166('0x25')]['find']({'where':_0x293800['options']?_0x293800['options']['where']||null:null})[_0xb166('0x13')](function(_0x31ce80){if(_0x31ce80){return _0x31ce80[_0xb166('0x26')](_0x293800[_0xb166('0x1f')]['ids'],_['omit'](_0x293800[_0xb166('0x1f')],['ids','id'])||{});}})['spread'](function(_0x264914){logger[_0xb166('0x14')](_0xb166('0x27'),_0x293800);logger['debug'](_0xb166('0x27'),_0x293800,JSON[_0xb166('0x18')](_0x264914));_0xd6a3fc(_0x264914);})[_0xb166('0x1c')](function(_0x560af1){logger[_0xb166('0x1a')](_0xb166('0x27'),_0x560af1[_0xb166('0x1b')],_0x293800);_0x1c909e(_this[_0xb166('0x1a')](0x1f4,_0x560af1[_0xb166('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 269be7c..4bf0b5a 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 _0xcba7=['length','./chatInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x5d8de3,_0x3c9a2d){var _0x5148c8=function(_0x37e414){while(--_0x37e414){_0x5d8de3['push'](_0x5d8de3['shift']());}};_0x5148c8(++_0x3c9a2d);}(_0xcba7,0x199));var _0x7cba=function(_0x504187,_0x407042){_0x504187=_0x504187-0x0;var _0x84c53d=_0xcba7[_0x504187];return _0x84c53d;};'use strict';var ChatInteractionEvents=require(_0x7cba('0x0'));var events=[_0x7cba('0x1'),_0x7cba('0x2'),_0x7cba('0x3')];function createListener(_0x5e59d1,_0x119b7f){return function(_0x461067){_0x119b7f[_0x7cba('0x4')](_0x5e59d1,_0x461067);};}function removeListener(_0x4fa145,_0x251250){return function(){ChatInteractionEvents[_0x7cba('0x5')](_0x4fa145,_0x251250);};}exports[_0x7cba('0x6')]=function(_0x2b0112){for(var _0x285928=0x0,_0x12bc28=events[_0x7cba('0x7')];_0x285928<_0x12bc28;_0x285928++){var _0x435722=events[_0x285928];var _0x1a1cef=createListener('chatInteraction:'+_0x435722,_0x2b0112);ChatInteractionEvents['on'](_0x435722,_0x1a1cef);}}; \ No newline at end of file +var _0xbe61=['save','remove','update','emit','register','length','chatInteraction:'];(function(_0x3032b9,_0x1cecd4){var _0x15b829=function(_0x151804){while(--_0x151804){_0x3032b9['push'](_0x3032b9['shift']());}};_0x15b829(++_0x1cecd4);}(_0xbe61,0x1dc));var _0x1be6=function(_0x4a349e,_0x47e1a){_0x4a349e=_0x4a349e-0x0;var _0x3fffa3=_0xbe61[_0x4a349e];return _0x3fffa3;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x1be6('0x0'),_0x1be6('0x1'),_0x1be6('0x2')];function createListener(_0x326181,_0x5f308a){return function(_0x5b376c){_0x5f308a[_0x1be6('0x3')](_0x326181,_0x5b376c);};}function removeListener(_0x577534,_0x388aa3){return function(){ChatInteractionEvents['removeListener'](_0x577534,_0x388aa3);};}exports[_0x1be6('0x4')]=function(_0x31cf1f){for(var _0x131f9a=0x0,_0x1fcfe5=events[_0x1be6('0x5')];_0x131f9a<_0x1fcfe5;_0x131f9a++){var _0x59fd80=events[_0x131f9a];var _0x714382=createListener(_0x1be6('0x6')+_0x59fd80,_0x31cf1f);ChatInteractionEvents['on'](_0x59fd80,_0x714382);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 452b647..46b2646 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 _0x083e=['/:id/tags','tracked','chat','addTags','put','/:id','chatinteraction:update','update','/:id/close','close','delete','chatinteraction:destroy','removeTags','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','index','isAuthenticated','describe','isChatInteractionAuthorized','/:id/attachment_download','/:id/messages','/:id/my_messages','getMyMessages','/:id/download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','/:id/attachment_upload','file','attachmentUpload','addMessage'];(function(_0x470d13,_0x3f22fa){var _0x18cc32=function(_0x58b827){while(--_0x58b827){_0x470d13['push'](_0x470d13['shift']());}};_0x18cc32(++_0x3f22fa);}(_0x083e,0x1c6));var _0xe083=function(_0x35b87c,_0x166a8c){_0x35b87c=_0x35b87c-0x0;var _0x24795b=_0x083e[_0x35b87c];return _0x24795b;};'use strict';var multer=require(_0xe083('0x0'));var util=require('util');var path=require(_0xe083('0x1'));var timeout=require(_0xe083('0x2'));var express=require(_0xe083('0x3'));var router=express[_0xe083('0x4')]();var fs_extra=require(_0xe083('0x5'));var auth=require(_0xe083('0x6'));var interaction=require(_0xe083('0x7'));var config=require(_0xe083('0x8'));var controller=require(_0xe083('0x9'));router[_0xe083('0xa')]('/',auth['isAuthenticated'](),controller[_0xe083('0xb')]);router[_0xe083('0xa')]('/describe',auth[_0xe083('0xc')](),controller[_0xe083('0xd')]);router[_0xe083('0xa')]('/:id',auth[_0xe083('0xe')](),controller['show']);router[_0xe083('0xa')](_0xe083('0xf'),auth['isChatInteractionAuthorized'](),controller['attachmentDownload']);router[_0xe083('0xa')](_0xe083('0x10'),auth[_0xe083('0xc')](),controller['getMessages']);router[_0xe083('0xa')](_0xe083('0x11'),auth[_0xe083('0xe')](),controller[_0xe083('0x12')]);router[_0xe083('0xa')](_0xe083('0x13'),auth[_0xe083('0xc')](),controller['download']);router[_0xe083('0x14')]('/',auth[_0xe083('0xc')](),controller[_0xe083('0x15')]);router[_0xe083('0x14')](_0xe083('0x16'),auth['isAuthenticated'](),controller[_0xe083('0x17')]);var upload=multer({'storage':multer[_0xe083('0x18')]({'destination':function(_0x346328,_0x4e99db,_0x88cae3){_0x88cae3(null,path[_0xe083('0x19')](config[_0xe083('0x1a')],_0xe083('0x1b')));},'filename':function(_0x384f57,_0x367459,_0x38b46b){_0x38b46b(null,util[_0xe083('0x1c')](_0xe083('0x1d'),Date[_0xe083('0x1e')](),_0x367459[_0xe083('0x1f')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe083('0x14')](_0xe083('0x20'),upload['single'](_0xe083('0x21')),controller[_0xe083('0x22')]);router[_0xe083('0x14')]('/:id/messages',auth[_0xe083('0xe')](),controller[_0xe083('0x23')]);router[_0xe083('0x14')](_0xe083('0x24'),auth[_0xe083('0xc')](),interaction[_0xe083('0x25')](_0xe083('0x26'),'chatinteraction:addtags'),controller[_0xe083('0x27')]);router[_0xe083('0x28')](_0xe083('0x29'),auth[_0xe083('0xc')](),interaction[_0xe083('0x25')](_0xe083('0x26'),_0xe083('0x2a')),controller[_0xe083('0x2b')]);router[_0xe083('0x28')]('/:id/custom_update',controller['customUpdate']);router[_0xe083('0x28')]('/:id/abandon',auth[_0xe083('0xe')](),controller['abandon']);router[_0xe083('0x28')](_0xe083('0x2c'),controller[_0xe083('0x2d')]);router[_0xe083('0x2e')]('/:id',auth['isAuthenticated'](),interaction[_0xe083('0x25')](_0xe083('0x26'),_0xe083('0x2f')),controller['destroy']);router[_0xe083('0x2e')](_0xe083('0x24'),auth[_0xe083('0xc')](),controller[_0xe083('0x30')]);module['exports']=router; \ No newline at end of file +var _0x08a1=['/:id/vidaoo','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','replace','single','/:id/messages','tracked','addTags','put','chat','update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','removeTags','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','getMessages','/:id/my_messages','getMyMessages','/:id/download','create','post'];(function(_0x43d199,_0x3c6f96){var _0x2f121c=function(_0x100e60){while(--_0x100e60){_0x43d199['push'](_0x43d199['shift']());}};_0x2f121c(++_0x3c6f96);}(_0x08a1,0xd0));var _0x108a=function(_0x4a5642,_0x18c3f9){_0x4a5642=_0x4a5642-0x0;var _0x4ecc72=_0x08a1[_0x4a5642];return _0x4ecc72;};'use strict';var multer=require(_0x108a('0x0'));var util=require(_0x108a('0x1'));var path=require(_0x108a('0x2'));var timeout=require(_0x108a('0x3'));var express=require(_0x108a('0x4'));var router=express['Router']();var fs_extra=require(_0x108a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x108a('0x6'));var config=require(_0x108a('0x7'));var controller=require(_0x108a('0x8'));router[_0x108a('0x9')]('/',auth[_0x108a('0xa')](),controller[_0x108a('0xb')]);router[_0x108a('0x9')]('/describe',auth[_0x108a('0xa')](),controller['describe']);router['get'](_0x108a('0xc'),auth[_0x108a('0xd')](),controller[_0x108a('0xe')]);router['get'](_0x108a('0xf'),auth['isChatInteractionAuthorized'](),controller['attachmentDownload']);router['get']('/:id/messages',auth[_0x108a('0xa')](),controller[_0x108a('0x10')]);router[_0x108a('0x9')](_0x108a('0x11'),auth['isChatInteractionAuthorized'](),controller[_0x108a('0x12')]);router[_0x108a('0x9')](_0x108a('0x13'),auth[_0x108a('0xa')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x108a('0x14')]);router[_0x108a('0x15')](_0x108a('0x16'),auth[_0x108a('0xa')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x108a('0x17')]({'destination':function(_0x2ecb2a,_0x9b11aa,_0xb480de){_0xb480de(null,path[_0x108a('0x18')](config[_0x108a('0x19')],_0x108a('0x1a')));},'filename':function(_0x2dc370,_0x141f07,_0x65541a){_0x65541a(null,util[_0x108a('0x1b')](_0x108a('0x1c'),Date[_0x108a('0x1d')](),_0x141f07['originalname'][_0x108a('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x108a('0x15')]('/:id/attachment_upload',upload[_0x108a('0x1f')]('file'),controller['attachmentUpload']);router[_0x108a('0x15')](_0x108a('0x20'),auth['isChatInteractionAuthorized'](),controller['addMessage']);router[_0x108a('0x15')]('/:id/tags',auth[_0x108a('0xa')](),interaction[_0x108a('0x21')]('chat','chatinteraction:addtags'),controller[_0x108a('0x22')]);router[_0x108a('0x23')](_0x108a('0xc'),auth['isAuthenticated'](),interaction[_0x108a('0x21')](_0x108a('0x24'),'chatinteraction:update'),controller[_0x108a('0x25')]);router[_0x108a('0x23')]('/:id/custom_update',controller[_0x108a('0x26')]);router['put'](_0x108a('0x27'),auth['isChatInteractionAuthorized'](),controller[_0x108a('0x28')]);router[_0x108a('0x23')](_0x108a('0x29'),controller[_0x108a('0x2a')]);router[_0x108a('0x2b')](_0x108a('0xc'),auth['isAuthenticated'](),interaction['tracked']('chat',_0x108a('0x2c')),controller['destroy']);router[_0x108a('0x2b')]('/:id/tags',auth[_0x108a('0xa')](),controller[_0x108a('0x2d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 849fb99..cbc0a6a 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 _0x5ebf=['INTEGER','sequelize','BOOLEAN'];(function(_0x475839,_0x20240e){var _0x8b2115=function(_0x53f8a6){while(--_0x53f8a6){_0x475839['push'](_0x475839['shift']());}};_0x8b2115(++_0x20240e);}(_0x5ebf,0xfd));var _0xf5eb=function(_0x265877,_0x57dcb8){_0x265877=_0x265877-0x0;var _0x3e8869=_0x5ebf[_0x265877];return _0x3e8869;};'use strict';var Sequelize=require(_0xf5eb('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xf5eb('0x1')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xf5eb('0x2')]}}; \ No newline at end of file +var _0x72a5=['TEXT','INTEGER','sequelize'];(function(_0x3ca831,_0x768b79){var _0x40aa0b=function(_0x18d821){while(--_0x18d821){_0x3ca831['push'](_0x3ca831['shift']());}};_0x40aa0b(++_0x768b79);}(_0x72a5,0x11c));var _0x572a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x72a5[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x572a('0x0'));module['exports']={'body':{'type':Sequelize[_0x572a('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x572a('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index fa02db3..127b5fb 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 _0x220c=['online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','role','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','length','push','createdAt','FromId','ToId','read','-createdAt','all','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','destroy','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','ChatInternalMessage','includeAll','include','findAll','rows','catch','show','fields','find','create','body','params','describe','get','messages','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','User','agent','admin','user','fullname','userpic','internal'];(function(_0x7ec0ec,_0x529dd4){var _0x4c0883=function(_0x121114){while(--_0x121114){_0x7ec0ec['push'](_0x7ec0ec['shift']());}};_0x4c0883(++_0x529dd4);}(_0x220c,0x85));var _0xc220=function(_0x453a5e,_0x5625a4){_0x453a5e=_0x453a5e-0x0;var _0x438f6d=_0x220c[_0x453a5e];return _0x438f6d;};'use strict';var emlformat=require(_0xc220('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc220('0x1'));var jsonpatch=require(_0xc220('0x2'));var rp=require(_0xc220('0x3'));var moment=require('moment');var BPromise=require(_0xc220('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc220('0x5'));var sox=require(_0xc220('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc220('0x7'));var _=require(_0xc220('0x8'));var squel=require(_0xc220('0x9'));var crypto=require(_0xc220('0xa'));var jsforce=require(_0xc220('0xb'));var deskjs=require(_0xc220('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc220('0xd'));var Papa=require(_0xc220('0xe'));var Redis=require('ioredis');var authService=require(_0xc220('0xf'));var qs=require(_0xc220('0x10'));var as=require(_0xc220('0x11'));var hardwareService=require(_0xc220('0x12'));var logger=require(_0xc220('0x13'))(_0xc220('0x14'));var utils=require(_0xc220('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc220('0x16'));var db=require(_0xc220('0x17'))['db'];config[_0xc220('0x18')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc220('0x19'))(new Redis(config[_0xc220('0x18')]));require(_0xc220('0x1a'))[_0xc220('0x1b')](socket);function respondWithStatusCode(_0x4e79e4,_0x36f0be){_0x36f0be=_0x36f0be||0xcc;return function(_0x335aab){if(_0x335aab){return _0x4e79e4[_0xc220('0x1c')](_0x36f0be);}return _0x4e79e4['status'](_0x36f0be)['end']();};}function respondWithResult(_0x230a03,_0x15f019){_0x15f019=_0x15f019||0xc8;return function(_0x2b4513){if(_0x2b4513){return _0x230a03[_0xc220('0x1d')](_0x15f019)[_0xc220('0x1e')](_0x2b4513);}};}function respondWithFilteredResult(_0x3c56e7,_0x48ac93){return function(_0x1d8b58){if(_0x1d8b58){var _0x458b8f=typeof _0x48ac93[_0xc220('0x1f')]===_0xc220('0x20')&&typeof _0x48ac93['limit']===_0xc220('0x20');var _0x21e306=_0x1d8b58[_0xc220('0x21')];var _0x473375=_0x458b8f?0x0:_0x48ac93[_0xc220('0x1f')];var _0x339ef0=_0x458b8f?_0x1d8b58['count']:_0x48ac93['offset']+_0x48ac93[_0xc220('0x22')];var _0x129099;if(_0x339ef0>=_0x21e306){_0x339ef0=_0x21e306;_0x129099=0xc8;}else{_0x129099=0xce;}_0x3c56e7[_0xc220('0x1d')](_0x129099);return _0x3c56e7['set'](_0xc220('0x23'),_0x473375+'-'+_0x339ef0+'/'+_0x21e306)[_0xc220('0x1e')](_0x1d8b58);}return null;};}function patchUpdates(_0xf762b8){return function(_0x1fd4c0){try{jsonpatch[_0xc220('0x24')](_0x1fd4c0,_0xf762b8,!![]);}catch(_0x3cbd58){return BPromise['reject'](_0x3cbd58);}return _0x1fd4c0[_0xc220('0x25')]();};}function saveUpdates(_0x3915c2,_0x1a14a7){return function(_0x2ee05c){if(_0x2ee05c){return _0x2ee05c[_0xc220('0x26')](_0x3915c2)[_0xc220('0x27')](function(_0x396c52){return _0x396c52;});}return null;};}function removeEntity(_0x4afc7e,_0x128d2a){return function(_0x1df4cb){if(_0x1df4cb){return _0x1df4cb[_0xc220('0x28')]()[_0xc220('0x27')](function(){_0x4afc7e[_0xc220('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6539e7,_0x317804){return function(_0x155df5){if(!_0x155df5){_0x6539e7['sendStatus'](0x194);}return _0x155df5;};}function handleError(_0x56b5fb,_0x5bdca0){_0x5bdca0=_0x5bdca0||0x1f4;return function(_0x12d752){logger['error'](_0x12d752[_0xc220('0x29')]);if(_0x12d752['name']){delete _0x12d752[_0xc220('0x2a')];}_0x56b5fb[_0xc220('0x1d')](_0x5bdca0)['send'](_0x12d752);};}exports[_0xc220('0x2b')]=function(_0xa30aaf,_0x4b3f14){var _0x5b20cd={},_0xc12cce={},_0x3bfed3={'count':0x0,'rows':[]};var _0x48abf4=_[_0xc220('0x2c')](db['ChatInternalMessage'][_0xc220('0x2d')],function(_0x3fbaa5){return{'name':_0x3fbaa5[_0xc220('0x2e')],'type':_0x3fbaa5['type'][_0xc220('0x2f')]};});_0xc12cce[_0xc220('0x30')]=_[_0xc220('0x2c')](_0x48abf4,'name');_0xc12cce[_0xc220('0x31')]=_[_0xc220('0x32')](_0xa30aaf[_0xc220('0x31')]);_0xc12cce[_0xc220('0x33')]=_[_0xc220('0x34')](_0xc12cce[_0xc220('0x30')],_0xc12cce['query']);_0x5b20cd['attributes']=_[_0xc220('0x34')](_0xc12cce[_0xc220('0x30')],qs['fields'](_0xa30aaf[_0xc220('0x31')]['fields']));_0x5b20cd[_0xc220('0x35')]=_0x5b20cd[_0xc220('0x35')]['length']?_0x5b20cd[_0xc220('0x35')]:_0xc12cce[_0xc220('0x30')];if(!_0xa30aaf[_0xc220('0x31')][_0xc220('0x36')](_0xc220('0x37'))){_0x5b20cd[_0xc220('0x22')]=qs[_0xc220('0x22')](_0xa30aaf[_0xc220('0x31')][_0xc220('0x22')]);_0x5b20cd['offset']=qs[_0xc220('0x1f')](_0xa30aaf['query']['offset']);}_0x5b20cd[_0xc220('0x38')]=qs[_0xc220('0x39')](_0xa30aaf[_0xc220('0x31')][_0xc220('0x39')]);_0x5b20cd[_0xc220('0x3a')]=qs['filters'](_[_0xc220('0x3b')](_0xa30aaf[_0xc220('0x31')],_0xc12cce[_0xc220('0x33')]),_0x48abf4);if(_0xa30aaf[_0xc220('0x31')][_0xc220('0x3c')]){_0x5b20cd[_0xc220('0x3a')]=_[_0xc220('0x3d')](_0x5b20cd[_0xc220('0x3a')],{'$or':_[_0xc220('0x2c')](_0x48abf4,function(_0x448b88){if(_0x448b88[_0xc220('0x3e')]!==_0xc220('0x3f')){var _0x2a8ccf={};_0x2a8ccf[_0x448b88[_0xc220('0x2a')]]={'$like':'%'+_0xa30aaf[_0xc220('0x31')]['filter']+'%'};return _0x2a8ccf;}})});}_0x5b20cd=_['merge']({},_0x5b20cd,_0xa30aaf[_0xc220('0x40')]);var _0x15d7b9={'where':_0x5b20cd[_0xc220('0x3a')]};return db[_0xc220('0x41')][_0xc220('0x21')](_0x15d7b9)['then'](function(_0x353ffd){_0x3bfed3[_0xc220('0x21')]=_0x353ffd;if(_0xa30aaf[_0xc220('0x31')][_0xc220('0x42')]){_0x5b20cd[_0xc220('0x43')]=[{'all':!![]}];}return db[_0xc220('0x41')][_0xc220('0x44')](_0x5b20cd);})[_0xc220('0x27')](function(_0x40f6b9){_0x3bfed3[_0xc220('0x45')]=_0x40f6b9;return _0x3bfed3;})['then'](respondWithFilteredResult(_0x4b3f14,_0x5b20cd))[_0xc220('0x46')](handleError(_0x4b3f14,null));};exports[_0xc220('0x47')]=function(_0x2c3284,_0x46c3d3){var _0x4c2fdd={'raw':!![],'where':{'id':_0x2c3284['params']['id']}},_0xab7b59={};_0xab7b59[_0xc220('0x30')]=_[_0xc220('0x32')](db['ChatInternalMessage'][_0xc220('0x2d')]);_0xab7b59[_0xc220('0x31')]=_['keys'](_0x2c3284[_0xc220('0x31')]);_0xab7b59['filters']=_['intersection'](_0xab7b59[_0xc220('0x30')],_0xab7b59['query']);_0x4c2fdd['attributes']=_['intersection'](_0xab7b59['model'],qs[_0xc220('0x48')](_0x2c3284['query'][_0xc220('0x48')]));_0x4c2fdd[_0xc220('0x35')]=_0x4c2fdd[_0xc220('0x35')]['length']?_0x4c2fdd[_0xc220('0x35')]:_0xab7b59[_0xc220('0x30')];if(_0x2c3284['query'][_0xc220('0x42')]){_0x4c2fdd[_0xc220('0x43')]=[{'all':!![]}];}_0x4c2fdd=_['merge']({},_0x4c2fdd,_0x2c3284[_0xc220('0x40')]);return db[_0xc220('0x41')][_0xc220('0x49')](_0x4c2fdd)[_0xc220('0x27')](handleEntityNotFound(_0x46c3d3,null))[_0xc220('0x27')](respondWithResult(_0x46c3d3,null))['catch'](handleError(_0x46c3d3,null));};exports['create']=function(_0x32b7e6,_0x27c0ff){return db[_0xc220('0x41')][_0xc220('0x4a')](_0x32b7e6[_0xc220('0x4b')],{})[_0xc220('0x27')](respondWithResult(_0x27c0ff,0xc9))['catch'](handleError(_0x27c0ff,null));};exports[_0xc220('0x26')]=function(_0x29e61c,_0x241f6d){if(_0x29e61c['body']['id']){delete _0x29e61c[_0xc220('0x4b')]['id'];}return db[_0xc220('0x41')][_0xc220('0x49')]({'where':{'id':_0x29e61c['params']['id']}})[_0xc220('0x27')](handleEntityNotFound(_0x241f6d,null))['then'](saveUpdates(_0x29e61c[_0xc220('0x4b')],null))[_0xc220('0x27')](respondWithResult(_0x241f6d,null))['catch'](handleError(_0x241f6d,null));};exports[_0xc220('0x28')]=function(_0x182884,_0xff81d8){return db[_0xc220('0x41')]['find']({'where':{'id':_0x182884[_0xc220('0x4c')]['id']}})[_0xc220('0x27')](handleEntityNotFound(_0xff81d8,null))['then'](removeEntity(_0xff81d8,null))[_0xc220('0x46')](handleError(_0xff81d8,null));};exports[_0xc220('0x4d')]=function(_0x819684,_0x3efa41){return db[_0xc220('0x41')][_0xc220('0x4d')]()[_0xc220('0x27')](respondWithResult(_0x3efa41,null))['catch'](handleError(_0x3efa41,null));};function wrapUser(_0x4e1053){return function(_0x5de02c){var _0x46c31f=_0x4e1053[_0xc220('0x4e')]({'plain':!![]});_0x46c31f[_0xc220('0x4f')]=[];if(_0x5de02c){_0x46c31f[_0xc220('0x50')]=_0x5de02c['createdAt'];_0x46c31f[_0xc220('0x51')]=_0x5de02c;}else{_0x46c31f[_0xc220('0x50')]=moment(0x0)[_0xc220('0x52')](_0xc220('0x53'));_0x46c31f['lastMessage']={};}return _0x46c31f;};}exports['getUsers']=function(_0x3d6742,_0x4f28af,_0x17720b){var _0xd17a79=[];return db[_0xc220('0x54')][_0xc220('0x44')]({'where':{'role':[_0xc220('0x55'),_0xc220('0x56'),_0xc220('0x57')]},'attributes':['id',_0xc220('0x58'),_0xc220('0x2a'),'role',_0xc220('0x59'),_0xc220('0x5a'),_0xc220('0x5b'),_0xc220('0x5c'),_0xc220('0x5d'),_0xc220('0x5e')],'order':qs[_0xc220('0x39')](_0xc220('0x5f')),'include':[{'model':db[_0xc220('0x60')],'as':_0xc220('0x61'),'attributes':['id',_0xc220('0x2a'),_0xc220('0x3e')],'through':{'attributes':[]}}]})['then'](function(_0x4ee270){if(_0x4ee270){var _0x4883b6=_0x3d6742['user'][_0xc220('0x4e')]({'plain':!![]});if(!_0x4883b6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4883b6[_0xc220('0x62')]===_0xc220('0x57')){return db['UserProfileSection'][_0xc220('0x49')]({'where':{'name':_0xc220('0x63'),'userProfileId':_0x4883b6[_0xc220('0x64')]},'raw':!![]})[_0xc220('0x27')](function(_0x9f74fc){if(_0x9f74fc){if(_0x9f74fc[_0xc220('0x65')]===0x0){return db[_0xc220('0x66')][_0xc220('0x44')]({'where':{'sectionId':_0x9f74fc['id']},'raw':!![]})[_0xc220('0x27')](function(_0x20d859){var _0x43b37a=[];if(_[_0xc220('0x67')](_0x20d859)){_0x43b37a=_[_0xc220('0x3c')](_0x4ee270,function(_0x4fa0ba){if(_0x4fa0ba[_0xc220('0x62')]!==_0xc220('0x55')){return _0x4fa0ba;}});return _0x43b37a;}else{for(var _0x10d48e=0x0;_0x10d48e<_0x4ee270[_0xc220('0x68')];_0x10d48e++){var _0x5e4b0a=_0x4ee270[_0x10d48e];if(_0x5e4b0a[_0xc220('0x62')]===_0xc220('0x55')){var _0x17c18b=_[_0xc220('0x49')](_0x20d859,function(_0x385e84){return _0x385e84['resourceId']===_0x5e4b0a['id'];});if(_0x17c18b)_0x43b37a['push'](_0x5e4b0a);}else{_0x43b37a[_0xc220('0x69')](_0x5e4b0a);}}return _0x43b37a;}});}else{return _0x4ee270;}}else{var _0xb4196f=_['filter'](_0x4ee270,function(_0x205ad8){if(_0x205ad8[_0xc220('0x62')]!==_0xc220('0x55')){return _0x205ad8;}});return _0xb4196f;}});}else{return _0x4ee270;}}})['then'](function(_0x4b50d8){var _0xfa5275=[];if(_0x4b50d8){_0xd17a79=_0x4b50d8;for(var _0x45a987=0x0;_0x45a987<_0x4b50d8[_0xc220('0x68')];_0x45a987+=0x1){_0xd17a79[_0x45a987]['messages']=[];_0xfa5275['push'](db[_0xc220('0x41')][_0xc220('0x49')]({'where':{'FromId':[_0x3d6742[_0xc220('0x57')]['id'],_0x4b50d8[_0x45a987]['id']],'ToId':[_0x3d6742['user']['id'],_0x4b50d8[_0x45a987]['id']],'ChatGroupId':null},'attributes':['id',_0xc220('0x6a'),_0xc220('0x6b'),_0xc220('0x6c'),_0xc220('0x6d'),'body'],'order':qs[_0xc220('0x39')](_0xc220('0x6e')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xc220('0x27')](wrapUser(_0x4b50d8[_0x45a987])));}return BPromise[_0xc220('0x6f')](_0xfa5275);}return[];})[_0xc220('0x27')](function(_0xbf6c63){return{'rows':_0xbf6c63,'count':_0xbf6c63[_0xc220('0x68')]};})[_0xc220('0x27')](respondWithResult(_0x4f28af,null))['catch'](handleError(_0x4f28af,null));}; \ No newline at end of file +var _0xcf42=['destroy','end','error','stack','name','send','index','ChatInternalMessage','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','then','includeAll','include','findAll','catch','show','params','keys','merge','create','body','find','describe','get','lastMessageAt','createdAt','format','User','agent','admin','user','role','userpic','internal','online','lastLoginAt','allowmessenger','VoiceQueues','UserProfileSection','Agents','userProfileId','autoAssociation','isEmpty','resourceId','push','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','json','offset','limit','undefined','count','Content-Range','reject','save','update'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xcf42,0x118));var _0x2cf4=function(_0x20b38b,_0x3fd615){_0x20b38b=_0x20b38b-0x0;var _0x1a28e6=_0xcf42[_0x20b38b];return _0x1a28e6;};'use strict';var emlformat=require(_0x2cf4('0x0'));var rimraf=require(_0x2cf4('0x1'));var zipdir=require(_0x2cf4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2cf4('0x3'));var moment=require(_0x2cf4('0x4'));var BPromise=require(_0x2cf4('0x5'));var Mustache=require(_0x2cf4('0x6'));var util=require(_0x2cf4('0x7'));var path=require(_0x2cf4('0x8'));var sox=require(_0x2cf4('0x9'));var csv=require(_0x2cf4('0xa'));var ejs=require(_0x2cf4('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2cf4('0xc'));var squel=require(_0x2cf4('0xd'));var crypto=require('crypto');var jsforce=require(_0x2cf4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2cf4('0xa'));var querystring=require(_0x2cf4('0xf'));var Papa=require(_0x2cf4('0x10'));var Redis=require(_0x2cf4('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2cf4('0x12'));var hardwareService=require(_0x2cf4('0x13'));var logger=require(_0x2cf4('0x14'))(_0x2cf4('0x15'));var utils=require('../../config/utils');var config=require(_0x2cf4('0x16'));var licenseUtil=require(_0x2cf4('0x17'));var db=require(_0x2cf4('0x18'))['db'];config[_0x2cf4('0x19')]=_['defaults'](config[_0x2cf4('0x19')],{'host':_0x2cf4('0x1a'),'port':0x18eb});var socket=require(_0x2cf4('0x1b'))(new Redis(config['redis']));require(_0x2cf4('0x1c'))[_0x2cf4('0x1d')](socket);function respondWithStatusCode(_0x1c1ea4,_0x432f18){_0x432f18=_0x432f18||0xcc;return function(_0x36f339){if(_0x36f339){return _0x1c1ea4[_0x2cf4('0x1e')](_0x432f18);}return _0x1c1ea4['status'](_0x432f18)['end']();};}function respondWithResult(_0x4212ee,_0x5537f1){_0x5537f1=_0x5537f1||0xc8;return function(_0x5f04a7){if(_0x5f04a7){return _0x4212ee[_0x2cf4('0x1f')](_0x5537f1)[_0x2cf4('0x20')](_0x5f04a7);}};}function respondWithFilteredResult(_0x1c89e2,_0x19c1ef){return function(_0x1d023d){if(_0x1d023d){var _0x2e5448=typeof _0x19c1ef[_0x2cf4('0x21')]==='undefined'&&typeof _0x19c1ef[_0x2cf4('0x22')]===_0x2cf4('0x23');var _0x119222=_0x1d023d[_0x2cf4('0x24')];var _0x1aa167=_0x2e5448?0x0:_0x19c1ef[_0x2cf4('0x21')];var _0x246a8d=_0x2e5448?_0x1d023d['count']:_0x19c1ef[_0x2cf4('0x21')]+_0x19c1ef[_0x2cf4('0x22')];var _0x9b7a2d;if(_0x246a8d>=_0x119222){_0x246a8d=_0x119222;_0x9b7a2d=0xc8;}else{_0x9b7a2d=0xce;}_0x1c89e2['status'](_0x9b7a2d);return _0x1c89e2['set'](_0x2cf4('0x25'),_0x1aa167+'-'+_0x246a8d+'/'+_0x119222)[_0x2cf4('0x20')](_0x1d023d);}return null;};}function patchUpdates(_0x48b4d8){return function(_0x94e171){try{jsonpatch['apply'](_0x94e171,_0x48b4d8,!![]);}catch(_0x22e8d2){return BPromise[_0x2cf4('0x26')](_0x22e8d2);}return _0x94e171[_0x2cf4('0x27')]();};}function saveUpdates(_0x398f7e,_0x188651){return function(_0x430b89){if(_0x430b89){return _0x430b89[_0x2cf4('0x28')](_0x398f7e)['then'](function(_0x49cd7f){return _0x49cd7f;});}return null;};}function removeEntity(_0xd8c403,_0x4ab461){return function(_0xba27e){if(_0xba27e){return _0xba27e[_0x2cf4('0x29')]()['then'](function(){_0xd8c403[_0x2cf4('0x1f')](0xcc)[_0x2cf4('0x2a')]();});}};}function handleEntityNotFound(_0x51034d,_0x256708){return function(_0x2d7116){if(!_0x2d7116){_0x51034d[_0x2cf4('0x1e')](0x194);}return _0x2d7116;};}function handleError(_0x507ebf,_0x328f47){_0x328f47=_0x328f47||0x1f4;return function(_0x2ac6e6){logger[_0x2cf4('0x2b')](_0x2ac6e6[_0x2cf4('0x2c')]);if(_0x2ac6e6[_0x2cf4('0x2d')]){delete _0x2ac6e6[_0x2cf4('0x2d')];}_0x507ebf[_0x2cf4('0x1f')](_0x328f47)[_0x2cf4('0x2e')](_0x2ac6e6);};}exports[_0x2cf4('0x2f')]=function(_0x1de4ba,_0x466ac5){var _0x282d13={},_0x5dff40={},_0xf4c04f={'count':0x0,'rows':[]};var _0x5f5764=_['map'](db[_0x2cf4('0x30')][_0x2cf4('0x31')],function(_0x442b4e){return{'name':_0x442b4e[_0x2cf4('0x32')],'type':_0x442b4e[_0x2cf4('0x33')]['key']};});_0x5dff40[_0x2cf4('0x34')]=_[_0x2cf4('0x35')](_0x5f5764,_0x2cf4('0x2d'));_0x5dff40[_0x2cf4('0x36')]=_['keys'](_0x1de4ba[_0x2cf4('0x36')]);_0x5dff40[_0x2cf4('0x37')]=_[_0x2cf4('0x38')](_0x5dff40['model'],_0x5dff40[_0x2cf4('0x36')]);_0x282d13[_0x2cf4('0x39')]=_['intersection'](_0x5dff40['model'],qs[_0x2cf4('0x3a')](_0x1de4ba[_0x2cf4('0x36')][_0x2cf4('0x3a')]));_0x282d13[_0x2cf4('0x39')]=_0x282d13[_0x2cf4('0x39')][_0x2cf4('0x3b')]?_0x282d13[_0x2cf4('0x39')]:_0x5dff40['model'];if(!_0x1de4ba['query'][_0x2cf4('0x3c')](_0x2cf4('0x3d'))){_0x282d13[_0x2cf4('0x22')]=qs[_0x2cf4('0x22')](_0x1de4ba[_0x2cf4('0x36')][_0x2cf4('0x22')]);_0x282d13[_0x2cf4('0x21')]=qs[_0x2cf4('0x21')](_0x1de4ba[_0x2cf4('0x36')][_0x2cf4('0x21')]);}_0x282d13['order']=qs[_0x2cf4('0x3e')](_0x1de4ba[_0x2cf4('0x36')][_0x2cf4('0x3e')]);_0x282d13[_0x2cf4('0x3f')]=qs[_0x2cf4('0x37')](_[_0x2cf4('0x40')](_0x1de4ba[_0x2cf4('0x36')],_0x5dff40[_0x2cf4('0x37')]),_0x5f5764);if(_0x1de4ba[_0x2cf4('0x36')][_0x2cf4('0x41')]){_0x282d13['where']=_['merge'](_0x282d13[_0x2cf4('0x3f')],{'$or':_[_0x2cf4('0x35')](_0x5f5764,function(_0x907e99){if(_0x907e99['type']!==_0x2cf4('0x42')){var _0x2c0858={};_0x2c0858[_0x907e99[_0x2cf4('0x2d')]]={'$like':'%'+_0x1de4ba[_0x2cf4('0x36')][_0x2cf4('0x41')]+'%'};return _0x2c0858;}})});}_0x282d13=_['merge']({},_0x282d13,_0x1de4ba[_0x2cf4('0x43')]);var _0xfb61c2={'where':_0x282d13[_0x2cf4('0x3f')]};return db[_0x2cf4('0x30')][_0x2cf4('0x24')](_0xfb61c2)[_0x2cf4('0x44')](function(_0x4db7f2){_0xf4c04f[_0x2cf4('0x24')]=_0x4db7f2;if(_0x1de4ba[_0x2cf4('0x36')][_0x2cf4('0x45')]){_0x282d13[_0x2cf4('0x46')]=[{'all':!![]}];}return db[_0x2cf4('0x30')][_0x2cf4('0x47')](_0x282d13);})[_0x2cf4('0x44')](function(_0x52750a){_0xf4c04f['rows']=_0x52750a;return _0xf4c04f;})[_0x2cf4('0x44')](respondWithFilteredResult(_0x466ac5,_0x282d13))[_0x2cf4('0x48')](handleError(_0x466ac5,null));};exports[_0x2cf4('0x49')]=function(_0x1e5b23,_0x265438){var _0x5c2f0b={'raw':!![],'where':{'id':_0x1e5b23[_0x2cf4('0x4a')]['id']}},_0x3fff45={};_0x3fff45[_0x2cf4('0x34')]=_[_0x2cf4('0x4b')](db['ChatInternalMessage'][_0x2cf4('0x31')]);_0x3fff45['query']=_[_0x2cf4('0x4b')](_0x1e5b23[_0x2cf4('0x36')]);_0x3fff45[_0x2cf4('0x37')]=_['intersection'](_0x3fff45[_0x2cf4('0x34')],_0x3fff45['query']);_0x5c2f0b[_0x2cf4('0x39')]=_['intersection'](_0x3fff45[_0x2cf4('0x34')],qs[_0x2cf4('0x3a')](_0x1e5b23[_0x2cf4('0x36')]['fields']));_0x5c2f0b[_0x2cf4('0x39')]=_0x5c2f0b[_0x2cf4('0x39')][_0x2cf4('0x3b')]?_0x5c2f0b[_0x2cf4('0x39')]:_0x3fff45[_0x2cf4('0x34')];if(_0x1e5b23[_0x2cf4('0x36')]['includeAll']){_0x5c2f0b['include']=[{'all':!![]}];}_0x5c2f0b=_[_0x2cf4('0x4c')]({},_0x5c2f0b,_0x1e5b23[_0x2cf4('0x43')]);return db['ChatInternalMessage']['find'](_0x5c2f0b)[_0x2cf4('0x44')](handleEntityNotFound(_0x265438,null))['then'](respondWithResult(_0x265438,null))[_0x2cf4('0x48')](handleError(_0x265438,null));};exports[_0x2cf4('0x4d')]=function(_0x53c446,_0x16c769){return db[_0x2cf4('0x30')][_0x2cf4('0x4d')](_0x53c446[_0x2cf4('0x4e')],{})[_0x2cf4('0x44')](respondWithResult(_0x16c769,0xc9))[_0x2cf4('0x48')](handleError(_0x16c769,null));};exports[_0x2cf4('0x28')]=function(_0x29d016,_0x38febf){if(_0x29d016[_0x2cf4('0x4e')]['id']){delete _0x29d016[_0x2cf4('0x4e')]['id'];}return db[_0x2cf4('0x30')][_0x2cf4('0x4f')]({'where':{'id':_0x29d016[_0x2cf4('0x4a')]['id']}})[_0x2cf4('0x44')](handleEntityNotFound(_0x38febf,null))['then'](saveUpdates(_0x29d016[_0x2cf4('0x4e')],null))[_0x2cf4('0x44')](respondWithResult(_0x38febf,null))['catch'](handleError(_0x38febf,null));};exports[_0x2cf4('0x29')]=function(_0x459ff0,_0x585d7f){return db['ChatInternalMessage']['find']({'where':{'id':_0x459ff0[_0x2cf4('0x4a')]['id']}})[_0x2cf4('0x44')](handleEntityNotFound(_0x585d7f,null))[_0x2cf4('0x44')](removeEntity(_0x585d7f,null))[_0x2cf4('0x48')](handleError(_0x585d7f,null));};exports[_0x2cf4('0x50')]=function(_0x1f3e36,_0x30ec75){return db[_0x2cf4('0x30')][_0x2cf4('0x50')]()['then'](respondWithResult(_0x30ec75,null))[_0x2cf4('0x48')](handleError(_0x30ec75,null));};function wrapUser(_0x36c4b1){return function(_0x3ef993){var _0x2b2e4f=_0x36c4b1[_0x2cf4('0x51')]({'plain':!![]});_0x2b2e4f['messages']=[];if(_0x3ef993){_0x2b2e4f[_0x2cf4('0x52')]=_0x3ef993[_0x2cf4('0x53')];_0x2b2e4f['lastMessage']=_0x3ef993;}else{_0x2b2e4f[_0x2cf4('0x52')]=moment(0x0)[_0x2cf4('0x54')]('YYYY-MM-DD\x20HH:mm:ss');_0x2b2e4f['lastMessage']={};}return _0x2b2e4f;};}exports['getUsers']=function(_0x1d9fcc,_0x58ab1d,_0x78868b){var _0x931c0a=[];return db[_0x2cf4('0x55')][_0x2cf4('0x47')]({'where':{'role':[_0x2cf4('0x56'),_0x2cf4('0x57'),_0x2cf4('0x58')]},'attributes':['id','fullname',_0x2cf4('0x2d'),_0x2cf4('0x59'),_0x2cf4('0x5a'),_0x2cf4('0x5b'),_0x2cf4('0x5c'),_0x2cf4('0x5d'),_0x2cf4('0x5e'),'showWebBar'],'order':qs['sort']('-online'),'include':[{'model':db['VoiceQueue'],'as':_0x2cf4('0x5f'),'attributes':['id',_0x2cf4('0x2d'),'type'],'through':{'attributes':[]}}]})[_0x2cf4('0x44')](function(_0x2c738a){if(_0x2c738a){var _0xe4e71d=_0x1d9fcc[_0x2cf4('0x58')][_0x2cf4('0x51')]({'plain':!![]});if(!_0xe4e71d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe4e71d[_0x2cf4('0x59')]==='user'){return db[_0x2cf4('0x60')][_0x2cf4('0x4f')]({'where':{'name':_0x2cf4('0x61'),'userProfileId':_0xe4e71d[_0x2cf4('0x62')]},'raw':!![]})[_0x2cf4('0x44')](function(_0x54a95c){if(_0x54a95c){if(_0x54a95c[_0x2cf4('0x63')]===0x0){return db['UserProfileResource'][_0x2cf4('0x47')]({'where':{'sectionId':_0x54a95c['id']},'raw':!![]})['then'](function(_0xceaf7d){var _0x3d5d36=[];if(_[_0x2cf4('0x64')](_0xceaf7d)){_0x3d5d36=_[_0x2cf4('0x41')](_0x2c738a,function(_0x46844e){if(_0x46844e[_0x2cf4('0x59')]!==_0x2cf4('0x56')){return _0x46844e;}});return _0x3d5d36;}else{for(var _0x127874=0x0;_0x127874<_0x2c738a[_0x2cf4('0x3b')];_0x127874++){var _0x168197=_0x2c738a[_0x127874];if(_0x168197['role']===_0x2cf4('0x56')){var _0x5d010d=_[_0x2cf4('0x4f')](_0xceaf7d,function(_0x33a59d){return _0x33a59d[_0x2cf4('0x65')]===_0x168197['id'];});if(_0x5d010d)_0x3d5d36[_0x2cf4('0x66')](_0x168197);}else{_0x3d5d36['push'](_0x168197);}}return _0x3d5d36;}});}else{return _0x2c738a;}}else{var _0x3599cd=_[_0x2cf4('0x41')](_0x2c738a,function(_0x72eb19){if(_0x72eb19[_0x2cf4('0x59')]!=='agent'){return _0x72eb19;}});return _0x3599cd;}});}else{return _0x2c738a;}}})[_0x2cf4('0x44')](function(_0x2c58cf){var _0x26d343=[];if(_0x2c58cf){_0x931c0a=_0x2c58cf;for(var _0x203e95=0x0;_0x203e95<_0x2c58cf[_0x2cf4('0x3b')];_0x203e95+=0x1){_0x931c0a[_0x203e95]['messages']=[];_0x26d343['push'](db['ChatInternalMessage'][_0x2cf4('0x4f')]({'where':{'FromId':[_0x1d9fcc[_0x2cf4('0x58')]['id'],_0x2c58cf[_0x203e95]['id']],'ToId':[_0x1d9fcc[_0x2cf4('0x58')]['id'],_0x2c58cf[_0x203e95]['id']],'ChatGroupId':null},'attributes':['id',_0x2cf4('0x53'),'FromId',_0x2cf4('0x67'),_0x2cf4('0x68'),_0x2cf4('0x4e')],'order':qs['sort'](_0x2cf4('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x2cf4('0x44')](wrapUser(_0x2c58cf[_0x203e95])));}return BPromise[_0x2cf4('0x6a')](_0x26d343);}return[];})[_0x2cf4('0x44')](function(_0x1222de){return{'rows':_0x1222de,'count':_0x1222de[_0x2cf4('0x3b')]};})[_0x2cf4('0x44')](respondWithResult(_0x58ab1d,null))[_0x2cf4('0x48')](handleError(_0x58ab1d,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 245bf0a..39dc9b5 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 _0x6033=['update','remove','hasOwnProperty','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save'];(function(_0x402495,_0x4325d3){var _0x4dde60=function(_0x5a4de1){while(--_0x5a4de1){_0x402495['push'](_0x402495['shift']());}};_0x4dde60(++_0x4325d3);}(_0x6033,0xdc));var _0x3603=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x6033[_0x502c7d];return _0x30b7ed;};'use strict';var EventEmitter=require(_0x3603('0x0'));var ChatInternalMessage=require(_0x3603('0x1'))['db'][_0x3603('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x3603('0x3')](0x0);var events={'afterCreate':_0x3603('0x4'),'afterUpdate':_0x3603('0x5'),'afterDestroy':_0x3603('0x6')};function emitEvent(_0x5cbf3a){return function(_0x5bf14c,_0xa7d477,_0x3316ed){ChatInternalMessageEvents['emit'](_0x5cbf3a+':'+_0x5bf14c['id'],_0x5bf14c);ChatInternalMessageEvents['emit'](_0x5cbf3a,_0x5bf14c);_0x3316ed(null);};}for(var e in events){if(events[_0x3603('0x7')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x3603('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x58e4=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x2cb63e,_0x1ee2ba){var _0x535895=function(_0x50588b){while(--_0x50588b){_0x2cb63e['push'](_0x2cb63e['shift']());}};_0x535895(++_0x1ee2ba);}(_0x58e4,0x157));var _0x458e=function(_0x5afd58,_0x52c443){_0x5afd58=_0x5afd58-0x0;var _0x2d6d02=_0x58e4[_0x5afd58];return _0x2d6d02;};'use strict';var EventEmitter=require(_0x458e('0x0'));var ChatInternalMessage=require('../../mysqldb')['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x458e('0x1')](0x0);var events={'afterCreate':_0x458e('0x2'),'afterUpdate':'update','afterDestroy':_0x458e('0x3')};function emitEvent(_0x9c2e2a){return function(_0x35c6f2,_0x21f717,_0x20942c){ChatInternalMessageEvents[_0x458e('0x4')](_0x9c2e2a+':'+_0x35c6f2['id'],_0x35c6f2);ChatInternalMessageEvents[_0x458e('0x4')](_0x9c2e2a,_0x35c6f2);_0x20942c(null);};}for(var e in events){if(events[_0x458e('0x5')](e)){var event=events[e];ChatInternalMessage[_0x458e('0x6')](e,emitEvent(event));}}module[_0x458e('0x7')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 559ac70..cc839e0 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 _0x574e=['./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x2a9490,_0x43cb5f){var _0x5bf90e=function(_0x207583){while(--_0x207583){_0x2a9490['push'](_0x2a9490['shift']());}};_0x5bf90e(++_0x43cb5f);}(_0x574e,0xd9));var _0xe574=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x574e[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require(_0xe574('0x0'));var logger=require(_0xe574('0x1'))(_0xe574('0x2'));var moment=require(_0xe574('0x3'));var BPromise=require(_0xe574('0x4'));var rp=require(_0xe574('0x5'));var fs=require('fs');var path=require(_0xe574('0x6'));var rimraf=require('rimraf');var config=require(_0xe574('0x7'));var attributes=require(_0xe574('0x8'));module[_0xe574('0x9')]=function(_0x34b6cf,_0x315a3c){return _0x34b6cf[_0xe574('0xa')](_0xe574('0xb'),attributes,{'tableName':_0xe574('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe574('0xd'),'collate':_0xe574('0xe')});}; \ No newline at end of file +var _0x921d=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','../../config/logger'];(function(_0x230c6c,_0x2a0ee9){var _0x4b2e2c=function(_0x15740a){while(--_0x15740a){_0x230c6c['push'](_0x230c6c['shift']());}};_0x4b2e2c(++_0x2a0ee9);}(_0x921d,0x19f));var _0xd921=function(_0x1d201a,_0x5df173){_0x1d201a=_0x1d201a-0x0;var _0x2ab8b1=_0x921d[_0x1d201a];return _0x2ab8b1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd921('0x0'))(_0xd921('0x1'));var moment=require(_0xd921('0x2'));var BPromise=require(_0xd921('0x3'));var rp=require(_0xd921('0x4'));var fs=require('fs');var path=require(_0xd921('0x5'));var rimraf=require(_0xd921('0x6'));var config=require(_0xd921('0x7'));var attributes=require('./chatInternalMessage.attributes');module[_0xd921('0x8')]=function(_0x3fb89c,_0x472779){return _0x3fb89c['define'](_0xd921('0x9'),attributes,{'tableName':_0xd921('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd921('0xb'),'collate':_0xd921('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 4ced37f..4f94b14 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 _0x0f82=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x8b7ce6,_0x50949a){var _0x30358c=function(_0x35742c){while(--_0x35742c){_0x8b7ce6['push'](_0x8b7ce6['shift']());}};_0x30358c(++_0x50949a);}(_0x0f82,0x1c6));var _0x20f8=function(_0x3c957d,_0x40d8f3){_0x3c957d=_0x3c957d-0x0;var _0x46ab64=_0x0f82[_0x3c957d];return _0x46ab64;};'use strict';var _=require(_0x20f8('0x0'));var util=require(_0x20f8('0x1'));var moment=require(_0x20f8('0x2'));var BPromise=require(_0x20f8('0x3'));var rs=require(_0x20f8('0x4'));var fs=require('fs');var Redis=require(_0x20f8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x20f8('0x6'));var logger=require(_0x20f8('0x7'))(_0x20f8('0x8'));var config=require(_0x20f8('0x9'));var jayson=require(_0x20f8('0xa'));var client=jayson[_0x20f8('0xb')][_0x20f8('0xc')]({'port':0x232a});config[_0x20f8('0xd')]=_[_0x20f8('0xe')](config[_0x20f8('0xd')],{'host':_0x20f8('0xf'),'port':0x18eb});var socket=require(_0x20f8('0x10'))(new Redis(config[_0x20f8('0xd')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithRpcPromise(_0xc43dd9,_0x23e627,_0x7e5f1f){return new BPromise(function(_0x980edc,_0x5316ee){return client[_0x20f8('0x11')](_0xc43dd9,_0x7e5f1f)[_0x20f8('0x12')](function(_0x2976bf){logger[_0x20f8('0x13')](_0x20f8('0x14'),_0x23e627,_0x20f8('0x15'));logger[_0x20f8('0x16')](_0x20f8('0x17'),_0x23e627,_0x20f8('0x15'),JSON[_0x20f8('0x18')](_0x2976bf));if(_0x2976bf[_0x20f8('0x19')]){if(_0x2976bf['error'][_0x20f8('0x1a')]===0x1f4){logger[_0x20f8('0x19')]('ChatInternalMessage,\x20%s,\x20%s',_0x23e627,_0x2976bf[_0x20f8('0x19')][_0x20f8('0x1b')]);return _0x5316ee(_0x2976bf[_0x20f8('0x19')][_0x20f8('0x1b')]);}logger[_0x20f8('0x19')](_0x20f8('0x14'),_0x23e627,_0x2976bf[_0x20f8('0x19')][_0x20f8('0x1b')]);return _0x980edc(_0x2976bf['error'][_0x20f8('0x1b')]);}else{logger[_0x20f8('0x13')](_0x20f8('0x14'),_0x23e627,_0x20f8('0x15'));_0x980edc(_0x2976bf[_0x20f8('0x1c')][_0x20f8('0x1b')]);}})['catch'](function(_0x5b02ea){logger['error'](_0x20f8('0x14'),_0x23e627,_0x5b02ea);_0x5316ee(_0x5b02ea);});});} \ No newline at end of file +var _0xac47=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','then','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x4d7d63,_0x58ac67){var _0x62eaf=function(_0x383f9e){while(--_0x383f9e){_0x4d7d63['push'](_0x4d7d63['shift']());}};_0x62eaf(++_0x58ac67);}(_0xac47,0x1af));var _0x7ac4=function(_0x49f509,_0x5c7395){_0x49f509=_0x49f509-0x0;var _0x1250d2=_0xac47[_0x49f509];return _0x1250d2;};'use strict';var _=require(_0x7ac4('0x0'));var util=require(_0x7ac4('0x1'));var moment=require(_0x7ac4('0x2'));var BPromise=require(_0x7ac4('0x3'));var rs=require(_0x7ac4('0x4'));var fs=require('fs');var Redis=require(_0x7ac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7ac4('0x6'));var logger=require(_0x7ac4('0x7'))('rpc');var config=require(_0x7ac4('0x8'));var jayson=require(_0x7ac4('0x9'));var client=jayson[_0x7ac4('0xa')][_0x7ac4('0xb')]({'port':0x232a});config[_0x7ac4('0xc')]=_['defaults'](config[_0x7ac4('0xc')],{'host':_0x7ac4('0xd'),'port':0x18eb});var socket=require(_0x7ac4('0xe'))(new Redis(config[_0x7ac4('0xc')]));require(_0x7ac4('0xf'))[_0x7ac4('0x10')](socket);function respondWithRpcPromise(_0xf46947,_0x285bf7,_0x2e4634){return new BPromise(function(_0x14125c,_0x215d70){return client['request'](_0xf46947,_0x2e4634)[_0x7ac4('0x11')](function(_0x3835b0){logger[_0x7ac4('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x285bf7,_0x7ac4('0x13'));logger[_0x7ac4('0x14')](_0x7ac4('0x15'),_0x285bf7,'request\x20sent',JSON['stringify'](_0x3835b0));if(_0x3835b0[_0x7ac4('0x16')]){if(_0x3835b0[_0x7ac4('0x16')]['code']===0x1f4){logger[_0x7ac4('0x16')](_0x7ac4('0x17'),_0x285bf7,_0x3835b0[_0x7ac4('0x16')][_0x7ac4('0x18')]);return _0x215d70(_0x3835b0['error'][_0x7ac4('0x18')]);}logger[_0x7ac4('0x16')](_0x7ac4('0x17'),_0x285bf7,_0x3835b0[_0x7ac4('0x16')][_0x7ac4('0x18')]);return _0x14125c(_0x3835b0[_0x7ac4('0x16')][_0x7ac4('0x18')]);}else{logger[_0x7ac4('0x12')](_0x7ac4('0x17'),_0x285bf7,'request\x20sent');_0x14125c(_0x3835b0[_0x7ac4('0x19')]['message']);}})[_0x7ac4('0x1a')](function(_0x304637){logger[_0x7ac4('0x16')](_0x7ac4('0x17'),_0x285bf7,_0x304637);_0x215d70(_0x304637);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index e16b4d2..306d9c2 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 _0x6287=['length','save','remove','update','removeListener'];(function(_0x5166c3,_0x534558){var _0x31da60=function(_0x4db4a2){while(--_0x4db4a2){_0x5166c3['push'](_0x5166c3['shift']());}};_0x31da60(++_0x534558);}(_0x6287,0x1b9));var _0x7628=function(_0x40b7ea,_0x550490){_0x40b7ea=_0x40b7ea-0x0;var _0x2627ec=_0x6287[_0x40b7ea];return _0x2627ec;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x7628('0x0'),_0x7628('0x1'),_0x7628('0x2')];function createListener(_0x322d9e,_0x2bd56a){return function(_0x1c01db){_0x2bd56a['emit'](_0x322d9e,_0x1c01db);};}function removeListener(_0x37fc62,_0xe0dca4){return function(){ChatInternalMessageEvents[_0x7628('0x3')](_0x37fc62,_0xe0dca4);};}exports['register']=function(_0x507802){for(var _0x1e0cc1=0x0,_0x283499=events[_0x7628('0x4')];_0x1e0cc1<_0x283499;_0x1e0cc1++){var _0x3878bd=events[_0x1e0cc1];var _0x52e376=createListener('chatInternalMessage:'+_0x3878bd,_0x507802);ChatInternalMessageEvents['on'](_0x3878bd,_0x52e376);}}; \ No newline at end of file +var _0x4f50=['removeListener','register','length','chatInternalMessage:','remove','update','emit'];(function(_0x1bf24a,_0x9d7622){var _0x514c10=function(_0x2361c5){while(--_0x2361c5){_0x1bf24a['push'](_0x1bf24a['shift']());}};_0x514c10(++_0x9d7622);}(_0x4f50,0x1e0));var _0x04f5=function(_0xe446b9,_0x4b27df){_0xe446b9=_0xe446b9-0x0;var _0xb77c67=_0x4f50[_0xe446b9];return _0xb77c67;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=['save',_0x04f5('0x0'),_0x04f5('0x1')];function createListener(_0x3ffe3f,_0x53c264){return function(_0x44bc37){_0x53c264[_0x04f5('0x2')](_0x3ffe3f,_0x44bc37);};}function removeListener(_0x29874d,_0x354cff){return function(){ChatInternalMessageEvents[_0x04f5('0x3')](_0x29874d,_0x354cff);};}exports[_0x04f5('0x4')]=function(_0x466e44){for(var _0x2b67c1=0x0,_0x58eb14=events[_0x04f5('0x5')];_0x2b67c1<_0x58eb14;_0x2b67c1++){var _0xcf88a5=events[_0x2b67c1];var _0x39e9bc=createListener(_0x04f5('0x6')+_0xcf88a5,_0x466e44);ChatInternalMessageEvents['on'](_0xcf88a5,_0x39e9bc);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 8431a8b..dc5b6d6 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 _0xd606=['post','put','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','show'];(function(_0x55d763,_0x559f3e){var _0x1f51ea=function(_0x7668fe){while(--_0x7668fe){_0x55d763['push'](_0x55d763['shift']());}};_0x1f51ea(++_0x559f3e);}(_0xd606,0x1bb));var _0x6d60=function(_0x45f2e5,_0x13ea9f){_0x45f2e5=_0x45f2e5-0x0;var _0x4cc589=_0xd606[_0x45f2e5];return _0x4cc589;};'use strict';var multer=require(_0x6d60('0x0'));var util=require('util');var path=require(_0x6d60('0x1'));var timeout=require('connect-timeout');var express=require(_0x6d60('0x2'));var router=express[_0x6d60('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6d60('0x4'));var interaction=require(_0x6d60('0x5'));var config=require(_0x6d60('0x6'));var controller=require(_0x6d60('0x7'));router[_0x6d60('0x8')]('/',auth[_0x6d60('0x9')](),controller[_0x6d60('0xa')]);router[_0x6d60('0x8')](_0x6d60('0xb'),auth[_0x6d60('0x9')](),controller[_0x6d60('0xc')]);router[_0x6d60('0x8')](_0x6d60('0xd'),auth[_0x6d60('0x9')](),controller[_0x6d60('0xe')]);router[_0x6d60('0x8')](_0x6d60('0xf'),auth[_0x6d60('0x9')](),controller[_0x6d60('0x10')]);router[_0x6d60('0x11')]('/',auth[_0x6d60('0x9')](),controller['create']);router[_0x6d60('0x12')](_0x6d60('0xf'),controller[_0x6d60('0x13')]);router[_0x6d60('0x14')](_0x6d60('0xf'),auth['isAuthenticated'](),controller[_0x6d60('0x15')]);module[_0x6d60('0x16')]=router; \ No newline at end of file +var _0x2400=['isAuthenticated','index','/describe','describe','/users','getUsers','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x45cda6,_0x41f09f){var _0xb6f62f=function(_0x3993f2){while(--_0x3993f2){_0x45cda6['push'](_0x45cda6['shift']());}};_0xb6f62f(++_0x41f09f);}(_0x2400,0xb0));var _0x0240=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0x2400[_0x172747];return _0x509692;};'use strict';var multer=require(_0x0240('0x0'));var util=require(_0x0240('0x1'));var path=require(_0x0240('0x2'));var timeout=require(_0x0240('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0240('0x4'));var auth=require(_0x0240('0x5'));var interaction=require(_0x0240('0x6'));var config=require('../../config/environment');var controller=require('./chatInternalMessage.controller');router[_0x0240('0x7')]('/',auth[_0x0240('0x8')](),controller[_0x0240('0x9')]);router['get'](_0x0240('0xa'),auth[_0x0240('0x8')](),controller[_0x0240('0xb')]);router[_0x0240('0x7')](_0x0240('0xc'),auth[_0x0240('0x8')](),controller[_0x0240('0xd')]);router[_0x0240('0x7')](_0x0240('0xe'),auth['isAuthenticated'](),controller[_0x0240('0xf')]);router[_0x0240('0x10')]('/',auth[_0x0240('0x8')](),controller[_0x0240('0x11')]);router[_0x0240('0x12')](_0x0240('0xe'),controller[_0x0240('0x13')]);router[_0x0240('0x14')](_0x0240('0xe'),auth[_0x0240('0x8')](),controller[_0x0240('0x15')]);module[_0x0240('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 421963f..6b831bc 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 _0x531a=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','DATE'];(function(_0xb6454d,_0x28fec5){var _0x2cbc14=function(_0x3d93ea){while(--_0x3d93ea){_0xb6454d['push'](_0xb6454d['shift']());}};_0x2cbc14(++_0x28fec5);}(_0x531a,0x100));var _0xa531=function(_0x580971,_0x10984d){_0x580971=_0x580971-0x0;var _0x16d873=_0x531a[_0x580971];return _0x16d873;};'use strict';var Sequelize=require(_0xa531('0x0'));module[_0xa531('0x1')]={'body':{'type':Sequelize[_0xa531('0x2')](_0xa531('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xa531('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xa531('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa531('0x5')]('in',_0xa531('0x6')),'defaultValue':_0xa531('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xa531('0x7')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xa531('0x2')]}}; \ No newline at end of file +var _0xe1e3=['DATE','STRING','TEXT','sequelize','exports','medium','ENUM','out'];(function(_0x2f3c12,_0x4b2a09){var _0x106a20=function(_0x355b06){while(--_0x355b06){_0x2f3c12['push'](_0x2f3c12['shift']());}};_0x106a20(++_0x4b2a09);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x25dfc8,_0x50ed96){_0x25dfc8=_0x25dfc8-0x0;var _0x1828ca=_0xe1e3[_0x25dfc8];return _0x1828ca;};'use strict';var Sequelize=require(_0x3e1e('0x0'));module[_0x3e1e('0x1')]={'body':{'type':Sequelize['TEXT'](_0x3e1e('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x3e1e('0x3')]('in','out'),'defaultValue':_0x3e1e('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x3e1e('0x5')]},'providerName':{'type':Sequelize[_0x3e1e('0x6')]},'providerResponse':{'type':Sequelize[_0x3e1e('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 6f56cbc..096b619 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 _0x222a=['includeAll','include','findAll','rows','params','find','body','describe','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','AcceptMessage','acceptMessage','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','formData','chat-interactions','chat','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','ContactId','email','rejectmessage','parse','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','then','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','catch','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','destroy','name','send','map','ChatMessage','rawAttributes','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options'];(function(_0x4f65f8,_0x43f65e){var _0x5639ec=function(_0x2d4157){while(--_0x2d4157){_0x4f65f8['push'](_0x4f65f8['shift']());}};_0x5639ec(++_0x43f65e);}(_0x222a,0xb3));var _0xa222=function(_0x570ce9,_0x58b86e){_0x570ce9=_0x570ce9-0x0;var _0x465573=_0x222a[_0x570ce9];return _0x465573;};'use strict';var emlformat=require(_0xa222('0x0'));var rimraf=require(_0xa222('0x1'));var zipdir=require(_0xa222('0x2'));var jsonpatch=require(_0xa222('0x3'));var rp=require(_0xa222('0x4'));var moment=require('moment');var BPromise=require(_0xa222('0x5'));var Mustache=require(_0xa222('0x6'));var util=require(_0xa222('0x7'));var path=require('path');var sox=require(_0xa222('0x8'));var csv=require(_0xa222('0x9'));var ejs=require(_0xa222('0xa'));var fs=require('fs');var fs_extra=require(_0xa222('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa222('0xc'));var jsforce=require(_0xa222('0xd'));var deskjs=require(_0xa222('0xe'));var toCsv=require(_0xa222('0x9'));var querystring=require(_0xa222('0xf'));var Papa=require('papaparse');var Redis=require(_0xa222('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa222('0x11'));var as=require(_0xa222('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa222('0x13'));var utils=require(_0xa222('0x14'));var config=require(_0xa222('0x15'));var licenseUtil=require(_0xa222('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xa222('0x17')](config[_0xa222('0x18')],{'host':_0xa222('0x19'),'port':0x18eb});var socket=require(_0xa222('0x1a'))(new Redis(config['redis']));require(_0xa222('0x1b'))[_0xa222('0x1c')](socket);var jayson=require(_0xa222('0x1d'));var client=jayson[_0xa222('0x1e')][_0xa222('0x1f')]({'port':0x232c});var client9002=jayson[_0xa222('0x1e')][_0xa222('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x57fe93,_0x14d52c,_0x11e748,_0x2cd368){return new BPromise(function(_0x1df564,_0x4d1067){var _0xc07e75=_0x2cd368||client;return _0xc07e75['request'](_0x57fe93,_0x11e748)[_0xa222('0x20')](function(_0x43f94a){logger['info'](_0xa222('0x21'),_0x14d52c,'request\x20sent');logger[_0xa222('0x22')](_0xa222('0x23'),_0x14d52c,'request\x20sent',JSON['stringify'](_0x43f94a));if(_0x43f94a[_0xa222('0x24')]){if(_0x43f94a[_0xa222('0x24')][_0xa222('0x25')]===0x1f4){logger['error'](_0xa222('0x21'),_0x14d52c,_0x43f94a['error'][_0xa222('0x26')]);return _0x4d1067(_0x43f94a[_0xa222('0x24')]['message']);}logger[_0xa222('0x24')]('ChatMessage,\x20%s,\x20%s',_0x14d52c,_0x43f94a['error']['message']);return _0x1df564(_0x43f94a['error'][_0xa222('0x26')]);}else{logger[_0xa222('0x27')](_0xa222('0x21'),_0x14d52c,_0xa222('0x28'));_0x1df564(_0x43f94a['result'][_0xa222('0x26')]);}})[_0xa222('0x29')](function(_0x44e57d){logger['error'](_0xa222('0x21'),_0x14d52c,_0x44e57d);_0x4d1067(_0x44e57d);});});}function respondWithStatusCode(_0x1c5a07,_0x4fc859){_0x4fc859=_0x4fc859||0xcc;return function(_0x4985aa){if(_0x4985aa){return _0x1c5a07[_0xa222('0x2a')](_0x4fc859);}return _0x1c5a07[_0xa222('0x2b')](_0x4fc859)[_0xa222('0x2c')]();};}function respondWithResult(_0xbdd9a0,_0x3c29d3){_0x3c29d3=_0x3c29d3||0xc8;return function(_0xf46e94){if(_0xf46e94){return _0xbdd9a0[_0xa222('0x2b')](_0x3c29d3)[_0xa222('0x2d')](_0xf46e94);}};}function respondWithFilteredResult(_0x454593,_0x22d923){return function(_0x4f7327){if(_0x4f7327){var _0xca2741=typeof _0x22d923['offset']==='undefined'&&typeof _0x22d923['limit']==='undefined';var _0x441a27=_0x4f7327[_0xa222('0x2e')];var _0x35bb6c=_0xca2741?0x0:_0x22d923[_0xa222('0x2f')];var _0x2e3724=_0xca2741?_0x4f7327['count']:_0x22d923['offset']+_0x22d923[_0xa222('0x30')];var _0x4d46cd;if(_0x2e3724>=_0x441a27){_0x2e3724=_0x441a27;_0x4d46cd=0xc8;}else{_0x4d46cd=0xce;}_0x454593['status'](_0x4d46cd);return _0x454593['set']('Content-Range',_0x35bb6c+'-'+_0x2e3724+'/'+_0x441a27)['json'](_0x4f7327);}return null;};}function patchUpdates(_0x15522f){return function(_0x12519d){try{jsonpatch[_0xa222('0x31')](_0x12519d,_0x15522f,!![]);}catch(_0x25f5c2){return BPromise[_0xa222('0x32')](_0x25f5c2);}return _0x12519d[_0xa222('0x33')]();};}function saveUpdates(_0x449148,_0x5c8b12){return function(_0x4aa33e){if(_0x4aa33e){return _0x4aa33e[_0xa222('0x34')](_0x449148)['then'](function(_0x14f1f9){return _0x14f1f9;});}return null;};}function removeEntity(_0x42dc6f,_0x5e9322){return function(_0x3242d2){if(_0x3242d2){return _0x3242d2[_0xa222('0x35')]()[_0xa222('0x20')](function(){_0x42dc6f[_0xa222('0x2b')](0xcc)[_0xa222('0x2c')]();});}};}function handleEntityNotFound(_0x504da6,_0x21b63f){return function(_0x4c1025){if(!_0x4c1025){_0x504da6[_0xa222('0x2a')](0x194);}return _0x4c1025;};}function handleError(_0x2e411f,_0x146c79){_0x146c79=_0x146c79||0x1f4;return function(_0x2371b6){logger[_0xa222('0x24')](_0x2371b6['stack']);if(_0x2371b6[_0xa222('0x36')]){delete _0x2371b6['name'];}_0x2e411f[_0xa222('0x2b')](_0x146c79)[_0xa222('0x37')](_0x2371b6);};}exports['index']=function(_0x5d834c,_0x4cf6c0){var _0x102b40={},_0x24796a={},_0xe2a4ca={'count':0x0,'rows':[]};var _0x54351c=_[_0xa222('0x38')](db[_0xa222('0x39')][_0xa222('0x3a')],function(_0x60bc35){return{'name':_0x60bc35['fieldName'],'type':_0x60bc35[_0xa222('0x3b')]['key']};});_0x24796a[_0xa222('0x3c')]=_[_0xa222('0x38')](_0x54351c,_0xa222('0x36'));_0x24796a[_0xa222('0x3d')]=_['keys'](_0x5d834c[_0xa222('0x3d')]);_0x24796a['filters']=_[_0xa222('0x3e')](_0x24796a[_0xa222('0x3c')],_0x24796a[_0xa222('0x3d')]);_0x102b40[_0xa222('0x3f')]=_[_0xa222('0x3e')](_0x24796a[_0xa222('0x3c')],qs['fields'](_0x5d834c['query'][_0xa222('0x40')]));_0x102b40['attributes']=_0x102b40[_0xa222('0x3f')][_0xa222('0x41')]?_0x102b40[_0xa222('0x3f')]:_0x24796a[_0xa222('0x3c')];if(!_0x5d834c[_0xa222('0x3d')][_0xa222('0x42')](_0xa222('0x43'))){_0x102b40[_0xa222('0x30')]=qs['limit'](_0x5d834c[_0xa222('0x3d')]['limit']);_0x102b40[_0xa222('0x2f')]=qs[_0xa222('0x2f')](_0x5d834c[_0xa222('0x3d')][_0xa222('0x2f')]);}_0x102b40['order']=qs['sort'](_0x5d834c['query'][_0xa222('0x44')]);_0x102b40[_0xa222('0x45')]=qs[_0xa222('0x46')](_['pick'](_0x5d834c['query'],_0x24796a[_0xa222('0x46')]),_0x54351c);if(_0x5d834c['query'][_0xa222('0x47')]){_0x102b40[_0xa222('0x45')]=_[_0xa222('0x48')](_0x102b40[_0xa222('0x45')],{'$or':_[_0xa222('0x38')](_0x54351c,function(_0x5eda4d){if(_0x5eda4d[_0xa222('0x3b')]!==_0xa222('0x49')){var _0x45942f={};_0x45942f[_0x5eda4d[_0xa222('0x36')]]={'$like':'%'+_0x5d834c[_0xa222('0x3d')][_0xa222('0x47')]+'%'};return _0x45942f;}})});}_0x102b40=_['merge']({},_0x102b40,_0x5d834c[_0xa222('0x4a')]);var _0x31168a={'where':_0x102b40[_0xa222('0x45')]};return db[_0xa222('0x39')][_0xa222('0x2e')](_0x31168a)[_0xa222('0x20')](function(_0x41d601){_0xe2a4ca[_0xa222('0x2e')]=_0x41d601;if(_0x5d834c[_0xa222('0x3d')][_0xa222('0x4b')]){_0x102b40[_0xa222('0x4c')]=[{'all':!![]}];}return db['ChatMessage'][_0xa222('0x4d')](_0x102b40);})[_0xa222('0x20')](function(_0xac03e4){_0xe2a4ca[_0xa222('0x4e')]=_0xac03e4;return _0xe2a4ca;})[_0xa222('0x20')](respondWithFilteredResult(_0x4cf6c0,_0x102b40))['catch'](handleError(_0x4cf6c0,null));};exports['show']=function(_0x2e6f6a,_0x1fc2a4){var _0x4812d1={'raw':!![],'where':{'id':_0x2e6f6a[_0xa222('0x4f')]['id']}},_0x208708={};_0x208708[_0xa222('0x3c')]=_['keys'](db[_0xa222('0x39')][_0xa222('0x3a')]);_0x208708[_0xa222('0x3d')]=_['keys'](_0x2e6f6a[_0xa222('0x3d')]);_0x208708[_0xa222('0x46')]=_['intersection'](_0x208708[_0xa222('0x3c')],_0x208708['query']);_0x4812d1[_0xa222('0x3f')]=_[_0xa222('0x3e')](_0x208708[_0xa222('0x3c')],qs['fields'](_0x2e6f6a[_0xa222('0x3d')]['fields']));_0x4812d1['attributes']=_0x4812d1[_0xa222('0x3f')]['length']?_0x4812d1[_0xa222('0x3f')]:_0x208708['model'];if(_0x2e6f6a[_0xa222('0x3d')][_0xa222('0x4b')]){_0x4812d1[_0xa222('0x4c')]=[{'all':!![]}];}_0x4812d1=_[_0xa222('0x48')]({},_0x4812d1,_0x2e6f6a[_0xa222('0x4a')]);return db['ChatMessage'][_0xa222('0x50')](_0x4812d1)['then'](handleEntityNotFound(_0x1fc2a4,null))['then'](respondWithResult(_0x1fc2a4,null))[_0xa222('0x29')](handleError(_0x1fc2a4,null));};exports['create']=function(_0x48c77c,_0x42c5fb){return db[_0xa222('0x39')]['create'](_0x48c77c['body'],{})['then'](respondWithResult(_0x42c5fb,0xc9))['catch'](handleError(_0x42c5fb,null));};exports[_0xa222('0x34')]=function(_0x15040e,_0x543c25){if(_0x15040e[_0xa222('0x51')]['id']){delete _0x15040e[_0xa222('0x51')]['id'];}return db['ChatMessage'][_0xa222('0x50')]({'where':{'id':_0x15040e[_0xa222('0x4f')]['id']}})['then'](handleEntityNotFound(_0x543c25,null))['then'](saveUpdates(_0x15040e['body'],null))[_0xa222('0x20')](respondWithResult(_0x543c25,null))['catch'](handleError(_0x543c25,null));};exports['destroy']=function(_0x3464ac,_0x403c0f){return db[_0xa222('0x39')][_0xa222('0x50')]({'where':{'id':_0x3464ac[_0xa222('0x4f')]['id']}})[_0xa222('0x20')](handleEntityNotFound(_0x403c0f,null))[_0xa222('0x20')](removeEntity(_0x403c0f,null))[_0xa222('0x29')](handleError(_0x403c0f,null));};exports[_0xa222('0x52')]=function(_0x2a8d5b,_0x4f054f){return db[_0xa222('0x39')][_0xa222('0x52')]()[_0xa222('0x20')](respondWithResult(_0x4f054f,null))[_0xa222('0x29')](handleError(_0x4f054f,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0xa222('0x53')]=function(_0x505cd3,_0x3766cd,_0x81d05c){var _0x4533dc={'agent':{},'channel':'chat'};if(_0x505cd3['body']['id']){delete _0x505cd3[_0xa222('0x51')]['id'];}_0x505cd3[_0xa222('0x51')]['read']=!![];_0x505cd3[_0xa222('0x51')][_0xa222('0x54')]=moment()[_0xa222('0x55')](_0xa222('0x56'));_0x505cd3[_0xa222('0x51')][_0xa222('0x57')]=_0x505cd3[_0xa222('0x51')][_0xa222('0x57')]||_0x505cd3[_0xa222('0x58')]['id'];_0x4533dc[_0xa222('0x59')]['id']=_0x505cd3[_0xa222('0x51')]['UserId'];return db[_0xa222('0x39')][_0xa222('0x50')]({'where':{'id':_0x505cd3['params']['id'],'UserId':null}})[_0xa222('0x20')](handleEntityNotFound(_0x3766cd,null))['then'](saveUpdates(_0x505cd3[_0xa222('0x51')],null))[_0xa222('0x20')](function(_0x54b30d){if(_0x54b30d){_0x4533dc[_0xa222('0x26')]=_0x54b30d[_0xa222('0x5a')]({'plain':!![]});return db[_0xa222('0x5b')][_0xa222('0x50')]({'where':{'id':_0x54b30d[_0xa222('0x5c')]}});}return null;})['then'](handleEntityNotFound(_0x3766cd,null))['then'](function(_0x21191d){if(_0x21191d){return _0x21191d['update']({'UserId':_0x505cd3[_0xa222('0x51')][_0xa222('0x57')],'read1stAt':_[_0xa222('0x5d')](_0x21191d[_0xa222('0x5e')])?moment()[_0xa222('0x55')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xa222('0x20')](function(_0x53dd77){if(_0x53dd77){_0x4533dc['interaction']=_0x53dd77[_0xa222('0x5a')]({'plain':!![]});interaction_log[_0xa222('0x27')](_0xa222('0x5f'),_0x505cd3[_0xa222('0x58')]['id'],_0x505cd3['user'][_0xa222('0x36')],_0x505cd3[_0xa222('0x58')][_0xa222('0x60')],_0x4533dc[_0xa222('0x61')]['id'],_0x505cd3[_0xa222('0x51')]?JSON['stringify'](_0x505cd3['body']):'null');return respondWithRpcPromise(_0xa222('0x62'),_0xa222('0x63'),_0x4533dc);}return null;})[_0xa222('0x20')](function(_0x176f26){var _0x3b4047='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x176f26['message']['ContactId'];return db[_0xa222('0x64')][_0xa222('0x3d')](_0x3b4047,{'type':db[_0xa222('0x65')][_0xa222('0x66')][_0xa222('0x67')],'raw':!![]})['then'](function(_0x35e9c1){return _0x35e9c1;});})['then'](function(_0xc64cfc){if(_0xc64cfc){_0x4533dc[_0xa222('0x26')][_0xa222('0x68')]=_0xc64cfc[0x0];if(!_0x505cd3[_0xa222('0x51')]['UserId'])return;return db[_0xa222('0x69')][_0xa222('0x50')]({'where':{'id':_0x505cd3[_0xa222('0x51')][_0xa222('0x57')],'role':'agent'},'attributes':['id',_0xa222('0x36'),_0xa222('0x6a'),'email',_0xa222('0x6b')],'raw':!![]});}return null;})['then'](function(_0x8b4dee){if(!_0x8b4dee)return null;_0x4533dc[_0xa222('0x26')][_0xa222('0x59')]=_0x8b4dee;return _0x4533dc;})[_0xa222('0x20')](function(_0x1d56df){if(_0x1d56df){if(_0x505cd3[_0xa222('0x51')][_0xa222('0x6c')]){_0x4533dc['message'][_0xa222('0x6d')]=util['format'](_0xa222('0x6e'),_0x505cd3[_0xa222('0x58')]['name']);_0x4533dc['message'][_0xa222('0x6f')]=_0x4533dc[_0xa222('0x6f')];_0x4533dc[_0xa222('0x26')][_0xa222('0x70')]=_0x4533dc['channel'];_0x4533dc['message'][_0xa222('0x71')]='accept';return respondWithRpcPromise(_0xa222('0x72'),_0xa222('0x72'),{'event':_0xa222('0x73'),'message':_[_0xa222('0x48')](_0x4533dc['message'],JSON['parse'](_0x4533dc[_0xa222('0x61')][_0xa222('0x74')]))},client9002)[_0xa222('0x20')](function(){return _0x4533dc;});}return _0x4533dc;}return null;})[_0xa222('0x20')](respondWithResult(_0x3766cd,null))[_0xa222('0x29')](handleError(_0x3766cd,null));};var interaction_log=require('../../config/logger')(_0xa222('0x75'));exports[_0xa222('0x32')]=function(_0x127c89,_0x383dca,_0x3ebba9){var _0x26a8f1={'agent':{},'channel':_0xa222('0x76')};if(_0x127c89[_0xa222('0x51')]['id']){delete _0x127c89['body']['id'];}_0x127c89[_0xa222('0x51')][_0xa222('0x57')]=_0x127c89[_0xa222('0x51')][_0xa222('0x57')]||_0x127c89['user']['id'];_0x26a8f1[_0xa222('0x59')]['id']=_0x127c89[_0xa222('0x51')]['UserId'];return db[_0xa222('0x39')][_0xa222('0x50')]({'where':{'id':_0x127c89[_0xa222('0x4f')]['id'],'UserId':null}})[_0xa222('0x20')](handleEntityNotFound(_0x383dca,null))[_0xa222('0x20')](function(_0x2bc459){if(_0x2bc459){_0x26a8f1[_0xa222('0x26')]=_0x2bc459[_0xa222('0x5a')]({'plain':!![]});return db[_0xa222('0x5b')][_0xa222('0x50')]({'where':{'id':_0x2bc459['ChatInteractionId']}});}return null;})[_0xa222('0x20')](handleEntityNotFound(_0x383dca,null))['then'](function(_0x1b9d7d){if(_0x1b9d7d){_0x26a8f1[_0xa222('0x61')]=_0x1b9d7d[_0xa222('0x5a')]({'plain':!![]});interaction_log[_0xa222('0x27')](_0xa222('0x77'),_0x127c89['user']['id'],_0x127c89[_0xa222('0x58')][_0xa222('0x36')],_0x127c89[_0xa222('0x58')][_0xa222('0x60')],_0x26a8f1[_0xa222('0x61')]['id'],_0x127c89['body']?JSON['stringify'](_0x127c89['body']):_0xa222('0x78'));return respondWithRpcPromise(_0xa222('0x79'),_0xa222('0x7a'),_0x26a8f1);}return null;})[_0xa222('0x20')](function(_0x274dd4){var _0x215749='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x274dd4['message'][_0xa222('0x7b')];return db[_0xa222('0x64')][_0xa222('0x3d')](_0x215749,{'type':db[_0xa222('0x65')][_0xa222('0x66')][_0xa222('0x67')],'raw':!![]})[_0xa222('0x20')](function(_0x527a2f){return _0x527a2f;});})[_0xa222('0x20')](function(_0x317842){if(_0x317842){_0x26a8f1['message'][_0xa222('0x68')]=_0x317842[0x0];if(!_0x127c89[_0xa222('0x51')][_0xa222('0x57')])return;return db['User'][_0xa222('0x50')]({'where':{'id':_0x127c89['body'][_0xa222('0x57')],'role':_0xa222('0x59')},'attributes':['id','name',_0xa222('0x6a'),_0xa222('0x7c'),_0xa222('0x6b')],'raw':!![]});}return null;})[_0xa222('0x20')](function(_0x3d1de5){if(!_0x3d1de5)return null;_0x26a8f1[_0xa222('0x26')][_0xa222('0x59')]=_0x3d1de5;return _0x26a8f1;})['then'](function(_0x265974){if(_0x265974){_0x265974[_0xa222('0x26')]['interface']=util['format'](_0xa222('0x6e'),_0x127c89[_0xa222('0x58')][_0xa222('0x36')]);_0x265974[_0xa222('0x26')][_0xa222('0x6f')]=_0x26a8f1[_0xa222('0x6f')];_0x265974['message'][_0xa222('0x70')]=_0x26a8f1['channel'];_0x265974[_0xa222('0x26')][_0xa222('0x71')]=_0xa222('0x32');respondWithRpcPromise(_0xa222('0x72'),'EventManager',{'event':_0xa222('0x7d'),'message':_[_0xa222('0x48')](_0x26a8f1[_0xa222('0x26')],JSON[_0xa222('0x7e')](_0x26a8f1[_0xa222('0x61')][_0xa222('0x74')]))},client9002);return _0x26a8f1;}return null;})[_0xa222('0x20')](respondWithResult(_0x383dca,null))['catch'](handleError(_0x383dca,null));}; \ No newline at end of file +var _0x515b=['reject','save','update','destroy','stack','send','index','map','ChatMessage','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','create','body','find','describe','chat-interactions','accept','chat','read','readAt','format','UserId','user','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','contact','User','agent','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','formData','role','RejectMessage','sequelize','QueryTypes','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply'];(function(_0x62f344,_0x204659){var _0x34f3ef=function(_0x196c82){while(--_0x196c82){_0x62f344['push'](_0x62f344['shift']());}};_0x34f3ef(++_0x204659);}(_0x515b,0x15f));var _0xb515=function(_0x119f29,_0x5a6e3d){_0x119f29=_0x119f29-0x0;var _0x379dff=_0x515b[_0x119f29];return _0x379dff;};'use strict';var emlformat=require(_0xb515('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb515('0x1'));var rp=require('request-promise');var moment=require(_0xb515('0x2'));var BPromise=require(_0xb515('0x3'));var Mustache=require(_0xb515('0x4'));var util=require(_0xb515('0x5'));var path=require(_0xb515('0x6'));var sox=require(_0xb515('0x7'));var csv=require(_0xb515('0x8'));var ejs=require(_0xb515('0x9'));var fs=require('fs');var fs_extra=require(_0xb515('0xa'));var _=require(_0xb515('0xb'));var squel=require(_0xb515('0xc'));var crypto=require(_0xb515('0xd'));var jsforce=require(_0xb515('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb515('0x8'));var querystring=require(_0xb515('0xf'));var Papa=require(_0xb515('0x10'));var Redis=require(_0xb515('0x11'));var authService=require(_0xb515('0x12'));var qs=require(_0xb515('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb515('0x14'));var logger=require(_0xb515('0x15'))(_0xb515('0x16'));var utils=require(_0xb515('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xb515('0x18'));var db=require(_0xb515('0x19'))['db'];config[_0xb515('0x1a')]=_[_0xb515('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb515('0x1c'))(new Redis(config[_0xb515('0x1a')]));require(_0xb515('0x1d'))[_0xb515('0x1e')](socket);var jayson=require(_0xb515('0x1f'));var client=jayson[_0xb515('0x20')][_0xb515('0x21')]({'port':0x232c});var client9002=jayson['client'][_0xb515('0x21')]({'port':0x232a});function respondWithRpcPromise(_0xfb5f9c,_0x5f04c2,_0xbbf598,_0x86dbc1){return new BPromise(function(_0x8f3eaa,_0x381b43){var _0x26e774=_0x86dbc1||client;return _0x26e774[_0xb515('0x22')](_0xfb5f9c,_0xbbf598)[_0xb515('0x23')](function(_0x3c565b){logger[_0xb515('0x24')](_0xb515('0x25'),_0x5f04c2,_0xb515('0x26'));logger[_0xb515('0x27')](_0xb515('0x28'),_0x5f04c2,_0xb515('0x26'),JSON[_0xb515('0x29')](_0x3c565b));if(_0x3c565b[_0xb515('0x2a')]){if(_0x3c565b[_0xb515('0x2a')][_0xb515('0x2b')]===0x1f4){logger[_0xb515('0x2a')](_0xb515('0x25'),_0x5f04c2,_0x3c565b[_0xb515('0x2a')][_0xb515('0x2c')]);return _0x381b43(_0x3c565b['error'][_0xb515('0x2c')]);}logger[_0xb515('0x2a')]('ChatMessage,\x20%s,\x20%s',_0x5f04c2,_0x3c565b[_0xb515('0x2a')][_0xb515('0x2c')]);return _0x8f3eaa(_0x3c565b[_0xb515('0x2a')][_0xb515('0x2c')]);}else{logger[_0xb515('0x24')](_0xb515('0x25'),_0x5f04c2,_0xb515('0x26'));_0x8f3eaa(_0x3c565b[_0xb515('0x2d')][_0xb515('0x2c')]);}})[_0xb515('0x2e')](function(_0x3614c0){logger[_0xb515('0x2a')](_0xb515('0x25'),_0x5f04c2,_0x3614c0);_0x381b43(_0x3614c0);});});}function respondWithStatusCode(_0x135f61,_0x225fb7){_0x225fb7=_0x225fb7||0xcc;return function(_0x1021f1){if(_0x1021f1){return _0x135f61[_0xb515('0x2f')](_0x225fb7);}return _0x135f61[_0xb515('0x30')](_0x225fb7)[_0xb515('0x31')]();};}function respondWithResult(_0x1df818,_0xb3ae71){_0xb3ae71=_0xb3ae71||0xc8;return function(_0xcbe5d3){if(_0xcbe5d3){return _0x1df818['status'](_0xb3ae71)['json'](_0xcbe5d3);}};}function respondWithFilteredResult(_0x2fdcb2,_0x52c372){return function(_0x4dc9d1){if(_0x4dc9d1){var _0x3db492=typeof _0x52c372['offset']===_0xb515('0x32')&&typeof _0x52c372[_0xb515('0x33')]===_0xb515('0x32');var _0x195229=_0x4dc9d1[_0xb515('0x34')];var _0x16dfad=_0x3db492?0x0:_0x52c372[_0xb515('0x35')];var _0x37d4a6=_0x3db492?_0x4dc9d1[_0xb515('0x34')]:_0x52c372[_0xb515('0x35')]+_0x52c372[_0xb515('0x33')];var _0x12bc91;if(_0x37d4a6>=_0x195229){_0x37d4a6=_0x195229;_0x12bc91=0xc8;}else{_0x12bc91=0xce;}_0x2fdcb2[_0xb515('0x30')](_0x12bc91);return _0x2fdcb2['set'](_0xb515('0x36'),_0x16dfad+'-'+_0x37d4a6+'/'+_0x195229)[_0xb515('0x37')](_0x4dc9d1);}return null;};}function patchUpdates(_0x563d71){return function(_0x520201){try{jsonpatch[_0xb515('0x38')](_0x520201,_0x563d71,!![]);}catch(_0x24a120){return BPromise[_0xb515('0x39')](_0x24a120);}return _0x520201[_0xb515('0x3a')]();};}function saveUpdates(_0x1c874f,_0xf4239e){return function(_0x128058){if(_0x128058){return _0x128058[_0xb515('0x3b')](_0x1c874f)[_0xb515('0x23')](function(_0x116448){return _0x116448;});}return null;};}function removeEntity(_0x199f7d,_0x4bf5c7){return function(_0x45b2d8){if(_0x45b2d8){return _0x45b2d8[_0xb515('0x3c')]()[_0xb515('0x23')](function(){_0x199f7d[_0xb515('0x30')](0xcc)[_0xb515('0x31')]();});}};}function handleEntityNotFound(_0x3ec414,_0x1f3efe){return function(_0x3a8c75){if(!_0x3a8c75){_0x3ec414[_0xb515('0x2f')](0x194);}return _0x3a8c75;};}function handleError(_0x5eec6f,_0x536b1d){_0x536b1d=_0x536b1d||0x1f4;return function(_0x7be13d){logger[_0xb515('0x2a')](_0x7be13d[_0xb515('0x3d')]);if(_0x7be13d['name']){delete _0x7be13d['name'];}_0x5eec6f[_0xb515('0x30')](_0x536b1d)[_0xb515('0x3e')](_0x7be13d);};}exports[_0xb515('0x3f')]=function(_0x8cc710,_0x58310c){var _0x5b4be4={},_0xc660b0={},_0x31d8bf={'count':0x0,'rows':[]};var _0x73080c=_[_0xb515('0x40')](db[_0xb515('0x41')][_0xb515('0x42')],function(_0x51d397){return{'name':_0x51d397[_0xb515('0x43')],'type':_0x51d397['type'][_0xb515('0x44')]};});_0xc660b0[_0xb515('0x45')]=_[_0xb515('0x40')](_0x73080c,_0xb515('0x46'));_0xc660b0[_0xb515('0x47')]=_[_0xb515('0x48')](_0x8cc710[_0xb515('0x47')]);_0xc660b0[_0xb515('0x49')]=_[_0xb515('0x4a')](_0xc660b0[_0xb515('0x45')],_0xc660b0['query']);_0x5b4be4[_0xb515('0x4b')]=_[_0xb515('0x4a')](_0xc660b0[_0xb515('0x45')],qs[_0xb515('0x4c')](_0x8cc710['query'][_0xb515('0x4c')]));_0x5b4be4[_0xb515('0x4b')]=_0x5b4be4[_0xb515('0x4b')][_0xb515('0x4d')]?_0x5b4be4['attributes']:_0xc660b0[_0xb515('0x45')];if(!_0x8cc710['query'][_0xb515('0x4e')](_0xb515('0x4f'))){_0x5b4be4[_0xb515('0x33')]=qs[_0xb515('0x33')](_0x8cc710[_0xb515('0x47')][_0xb515('0x33')]);_0x5b4be4[_0xb515('0x35')]=qs[_0xb515('0x35')](_0x8cc710[_0xb515('0x47')][_0xb515('0x35')]);}_0x5b4be4['order']=qs[_0xb515('0x50')](_0x8cc710[_0xb515('0x47')][_0xb515('0x50')]);_0x5b4be4[_0xb515('0x51')]=qs[_0xb515('0x49')](_['pick'](_0x8cc710[_0xb515('0x47')],_0xc660b0[_0xb515('0x49')]),_0x73080c);if(_0x8cc710[_0xb515('0x47')][_0xb515('0x52')]){_0x5b4be4['where']=_[_0xb515('0x53')](_0x5b4be4[_0xb515('0x51')],{'$or':_[_0xb515('0x40')](_0x73080c,function(_0x8bb283){if(_0x8bb283['type']!==_0xb515('0x54')){var _0xed3bce={};_0xed3bce[_0x8bb283[_0xb515('0x46')]]={'$like':'%'+_0x8cc710[_0xb515('0x47')][_0xb515('0x52')]+'%'};return _0xed3bce;}})});}_0x5b4be4=_['merge']({},_0x5b4be4,_0x8cc710[_0xb515('0x55')]);var _0x2fa17c={'where':_0x5b4be4['where']};return db['ChatMessage'][_0xb515('0x34')](_0x2fa17c)['then'](function(_0xbdc9e7){_0x31d8bf[_0xb515('0x34')]=_0xbdc9e7;if(_0x8cc710[_0xb515('0x47')][_0xb515('0x56')]){_0x5b4be4[_0xb515('0x57')]=[{'all':!![]}];}return db[_0xb515('0x41')][_0xb515('0x58')](_0x5b4be4);})[_0xb515('0x23')](function(_0x147943){_0x31d8bf[_0xb515('0x59')]=_0x147943;return _0x31d8bf;})[_0xb515('0x23')](respondWithFilteredResult(_0x58310c,_0x5b4be4))[_0xb515('0x2e')](handleError(_0x58310c,null));};exports[_0xb515('0x5a')]=function(_0x31f0ee,_0x543cac){var _0x1e6180={'raw':!![],'where':{'id':_0x31f0ee[_0xb515('0x5b')]['id']}},_0x37a2d1={};_0x37a2d1['model']=_[_0xb515('0x48')](db[_0xb515('0x41')][_0xb515('0x42')]);_0x37a2d1[_0xb515('0x47')]=_[_0xb515('0x48')](_0x31f0ee[_0xb515('0x47')]);_0x37a2d1[_0xb515('0x49')]=_[_0xb515('0x4a')](_0x37a2d1[_0xb515('0x45')],_0x37a2d1['query']);_0x1e6180[_0xb515('0x4b')]=_[_0xb515('0x4a')](_0x37a2d1['model'],qs[_0xb515('0x4c')](_0x31f0ee[_0xb515('0x47')][_0xb515('0x4c')]));_0x1e6180['attributes']=_0x1e6180[_0xb515('0x4b')][_0xb515('0x4d')]?_0x1e6180[_0xb515('0x4b')]:_0x37a2d1[_0xb515('0x45')];if(_0x31f0ee[_0xb515('0x47')][_0xb515('0x56')]){_0x1e6180[_0xb515('0x57')]=[{'all':!![]}];}_0x1e6180=_[_0xb515('0x53')]({},_0x1e6180,_0x31f0ee[_0xb515('0x55')]);return db[_0xb515('0x41')]['find'](_0x1e6180)['then'](handleEntityNotFound(_0x543cac,null))['then'](respondWithResult(_0x543cac,null))[_0xb515('0x2e')](handleError(_0x543cac,null));};exports[_0xb515('0x5c')]=function(_0x2b3fb4,_0x25ea43){return db[_0xb515('0x41')][_0xb515('0x5c')](_0x2b3fb4[_0xb515('0x5d')],{})['then'](respondWithResult(_0x25ea43,0xc9))['catch'](handleError(_0x25ea43,null));};exports['update']=function(_0x4d2372,_0x5789be){if(_0x4d2372[_0xb515('0x5d')]['id']){delete _0x4d2372[_0xb515('0x5d')]['id'];}return db[_0xb515('0x41')][_0xb515('0x5e')]({'where':{'id':_0x4d2372['params']['id']}})[_0xb515('0x23')](handleEntityNotFound(_0x5789be,null))['then'](saveUpdates(_0x4d2372[_0xb515('0x5d')],null))[_0xb515('0x23')](respondWithResult(_0x5789be,null))[_0xb515('0x2e')](handleError(_0x5789be,null));};exports[_0xb515('0x3c')]=function(_0x5e5fbb,_0x3aae48){return db[_0xb515('0x41')][_0xb515('0x5e')]({'where':{'id':_0x5e5fbb[_0xb515('0x5b')]['id']}})[_0xb515('0x23')](handleEntityNotFound(_0x3aae48,null))['then'](removeEntity(_0x3aae48,null))[_0xb515('0x2e')](handleError(_0x3aae48,null));};exports[_0xb515('0x5f')]=function(_0x570101,_0x2e3323){return db[_0xb515('0x41')][_0xb515('0x5f')]()[_0xb515('0x23')](respondWithResult(_0x2e3323,null))[_0xb515('0x2e')](handleError(_0x2e3323,null));};var interaction_log=require(_0xb515('0x15'))(_0xb515('0x60'));exports[_0xb515('0x61')]=function(_0x5ec8e0,_0x3523dd,_0x458d1d){var _0xb5ce14={'agent':{},'channel':_0xb515('0x62')};if(_0x5ec8e0[_0xb515('0x5d')]['id']){delete _0x5ec8e0[_0xb515('0x5d')]['id'];}_0x5ec8e0['body'][_0xb515('0x63')]=!![];_0x5ec8e0[_0xb515('0x5d')][_0xb515('0x64')]=moment()[_0xb515('0x65')]('YYYY-MM-DD\x20HH:mm:ss');_0x5ec8e0[_0xb515('0x5d')][_0xb515('0x66')]=_0x5ec8e0['body'][_0xb515('0x66')]||_0x5ec8e0[_0xb515('0x67')]['id'];_0xb5ce14['agent']['id']=_0x5ec8e0[_0xb515('0x5d')][_0xb515('0x66')];return db[_0xb515('0x41')][_0xb515('0x5e')]({'where':{'id':_0x5ec8e0['params']['id'],'UserId':null}})[_0xb515('0x23')](handleEntityNotFound(_0x3523dd,null))['then'](saveUpdates(_0x5ec8e0[_0xb515('0x5d')],null))[_0xb515('0x23')](function(_0x49aafa){if(_0x49aafa){_0xb5ce14[_0xb515('0x2c')]=_0x49aafa[_0xb515('0x68')]({'plain':!![]});return db[_0xb515('0x69')][_0xb515('0x5e')]({'where':{'id':_0x49aafa[_0xb515('0x6a')]}});}return null;})[_0xb515('0x23')](handleEntityNotFound(_0x3523dd,null))[_0xb515('0x23')](function(_0x19a2ef){if(_0x19a2ef){return _0x19a2ef[_0xb515('0x3b')]({'UserId':_0x5ec8e0[_0xb515('0x5d')][_0xb515('0x66')],'read1stAt':_[_0xb515('0x6b')](_0x19a2ef[_0xb515('0x6c')])?moment()[_0xb515('0x65')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xb515('0x23')](function(_0x5afd08){if(_0x5afd08){_0xb5ce14[_0xb515('0x6d')]=_0x5afd08[_0xb515('0x68')]({'plain':!![]});interaction_log[_0xb515('0x24')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5ec8e0[_0xb515('0x67')]['id'],_0x5ec8e0[_0xb515('0x67')][_0xb515('0x46')],_0x5ec8e0[_0xb515('0x67')]['role'],_0xb5ce14[_0xb515('0x6d')]['id'],_0x5ec8e0[_0xb515('0x5d')]?JSON['stringify'](_0x5ec8e0[_0xb515('0x5d')]):_0xb515('0x6e'));return respondWithRpcPromise(_0xb515('0x6f'),_0xb515('0x70'),_0xb5ce14);}return null;})['then'](function(_0x2a36e3){var _0x127cb9=_0xb515('0x71')+_0x2a36e3[_0xb515('0x2c')][_0xb515('0x72')];return db['sequelize'][_0xb515('0x47')](_0x127cb9,{'type':db[_0xb515('0x73')]['QueryTypes'][_0xb515('0x74')],'raw':!![]})[_0xb515('0x23')](function(_0xe802b1){return _0xe802b1;});})[_0xb515('0x23')](function(_0x1bbaa7){if(_0x1bbaa7){_0xb5ce14[_0xb515('0x2c')][_0xb515('0x75')]=_0x1bbaa7[0x0];if(!_0x5ec8e0[_0xb515('0x5d')][_0xb515('0x66')])return;return db[_0xb515('0x76')][_0xb515('0x5e')]({'where':{'id':_0x5ec8e0[_0xb515('0x5d')][_0xb515('0x66')],'role':_0xb515('0x77')},'attributes':['id',_0xb515('0x46'),_0xb515('0x78'),_0xb515('0x79'),_0xb515('0x7a')],'raw':!![]});}return null;})[_0xb515('0x23')](function(_0x210faf){if(!_0x210faf)return null;_0xb5ce14[_0xb515('0x2c')][_0xb515('0x77')]=_0x210faf;return _0xb5ce14;})['then'](function(_0x2262a5){if(_0x2262a5){if(_0x5ec8e0[_0xb515('0x5d')]['manual']){_0xb5ce14[_0xb515('0x2c')][_0xb515('0x7b')]=util[_0xb515('0x65')](_0xb515('0x7c'),_0x5ec8e0[_0xb515('0x67')][_0xb515('0x46')]);_0xb5ce14[_0xb515('0x2c')][_0xb515('0x7d')]=_0xb5ce14[_0xb515('0x7d')];_0xb5ce14[_0xb515('0x2c')][_0xb515('0x7e')]=_0xb5ce14['channel'];_0xb5ce14['message'][_0xb515('0x7f')]=_0xb515('0x61');return respondWithRpcPromise(_0xb515('0x80'),'EventManager',{'event':_0xb515('0x81'),'message':_['merge'](_0xb5ce14[_0xb515('0x2c')],JSON[_0xb515('0x82')](_0xb5ce14[_0xb515('0x6d')][_0xb515('0x83')]))},client9002)[_0xb515('0x23')](function(){return _0xb5ce14;});}return _0xb5ce14;}return null;})[_0xb515('0x23')](respondWithResult(_0x3523dd,null))[_0xb515('0x2e')](handleError(_0x3523dd,null));};var interaction_log=require(_0xb515('0x15'))(_0xb515('0x60'));exports[_0xb515('0x39')]=function(_0x431e3f,_0x15cfa0,_0x5423c7){var _0x1e4609={'agent':{},'channel':_0xb515('0x62')};if(_0x431e3f[_0xb515('0x5d')]['id']){delete _0x431e3f[_0xb515('0x5d')]['id'];}_0x431e3f[_0xb515('0x5d')][_0xb515('0x66')]=_0x431e3f[_0xb515('0x5d')][_0xb515('0x66')]||_0x431e3f[_0xb515('0x67')]['id'];_0x1e4609[_0xb515('0x77')]['id']=_0x431e3f[_0xb515('0x5d')][_0xb515('0x66')];return db[_0xb515('0x41')][_0xb515('0x5e')]({'where':{'id':_0x431e3f[_0xb515('0x5b')]['id'],'UserId':null}})[_0xb515('0x23')](handleEntityNotFound(_0x15cfa0,null))[_0xb515('0x23')](function(_0x5ed91b){if(_0x5ed91b){_0x1e4609['message']=_0x5ed91b['get']({'plain':!![]});return db['ChatInteraction'][_0xb515('0x5e')]({'where':{'id':_0x5ed91b[_0xb515('0x6a')]}});}return null;})[_0xb515('0x23')](handleEntityNotFound(_0x15cfa0,null))['then'](function(_0x59802a){if(_0x59802a){_0x1e4609[_0xb515('0x6d')]=_0x59802a[_0xb515('0x68')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x431e3f[_0xb515('0x67')]['id'],_0x431e3f['user'][_0xb515('0x46')],_0x431e3f[_0xb515('0x67')][_0xb515('0x84')],_0x1e4609[_0xb515('0x6d')]['id'],_0x431e3f[_0xb515('0x5d')]?JSON[_0xb515('0x29')](_0x431e3f[_0xb515('0x5d')]):_0xb515('0x6e'));return respondWithRpcPromise(_0xb515('0x85'),'rejectMessage',_0x1e4609);}return null;})[_0xb515('0x23')](function(_0x2cbb47){var _0x1c337c='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2cbb47[_0xb515('0x2c')][_0xb515('0x72')];return db[_0xb515('0x86')]['query'](_0x1c337c,{'type':db[_0xb515('0x73')][_0xb515('0x87')]['SELECT'],'raw':!![]})[_0xb515('0x23')](function(_0x4e59fc){return _0x4e59fc;});})[_0xb515('0x23')](function(_0x2edb51){if(_0x2edb51){_0x1e4609[_0xb515('0x2c')]['contact']=_0x2edb51[0x0];if(!_0x431e3f[_0xb515('0x5d')][_0xb515('0x66')])return;return db[_0xb515('0x76')][_0xb515('0x5e')]({'where':{'id':_0x431e3f[_0xb515('0x5d')][_0xb515('0x66')],'role':_0xb515('0x77')},'attributes':['id','name',_0xb515('0x78'),'email',_0xb515('0x7a')],'raw':!![]});}return null;})[_0xb515('0x23')](function(_0x357d78){if(!_0x357d78)return null;_0x1e4609[_0xb515('0x2c')]['agent']=_0x357d78;return _0x1e4609;})[_0xb515('0x23')](function(_0x44c178){if(_0x44c178){_0x44c178[_0xb515('0x2c')][_0xb515('0x7b')]=util[_0xb515('0x65')](_0xb515('0x7c'),_0x431e3f[_0xb515('0x67')][_0xb515('0x46')]);_0x44c178['message'][_0xb515('0x7d')]=_0x1e4609['channel'];_0x44c178[_0xb515('0x2c')][_0xb515('0x7e')]=_0x1e4609[_0xb515('0x7d')];_0x44c178[_0xb515('0x2c')]['event']=_0xb515('0x39');respondWithRpcPromise(_0xb515('0x80'),_0xb515('0x80'),{'event':'rejectmessage','message':_[_0xb515('0x53')](_0x1e4609[_0xb515('0x2c')],JSON[_0xb515('0x82')](_0x1e4609[_0xb515('0x6d')][_0xb515('0x83')]))},client9002);return _0x1e4609;}return null;})[_0xb515('0x23')](respondWithResult(_0x15cfa0,null))['catch'](handleError(_0x15cfa0,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 47f3ae3..ca2a8f9 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 _0xa8fa=['events','ChatMessage','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x55841f,_0x487812){var _0x4c5ccf=function(_0x2ce694){while(--_0x2ce694){_0x55841f['push'](_0x55841f['shift']());}};_0x4c5ccf(++_0x487812);}(_0xa8fa,0xe0));var _0xaa8f=function(_0x34886e,_0x399679){_0x34886e=_0x34886e-0x0;var _0x5bc3fb=_0xa8fa[_0x34886e];return _0x5bc3fb;};'use strict';var EventEmitter=require(_0xaa8f('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0xaa8f('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xaa8f('0x2')](0x0);var events={'afterCreate':_0xaa8f('0x3'),'afterUpdate':'update','afterDestroy':_0xaa8f('0x4')};function emitEvent(_0xb272a4){return function(_0x4b0245,_0x536403,_0x4a35c8){ChatMessageEvents[_0xaa8f('0x5')](_0xb272a4+':'+_0x4b0245['id'],_0x4b0245);ChatMessageEvents[_0xaa8f('0x5')](_0xb272a4,_0x4b0245);_0x4a35c8(null);};}for(var e in events){if(events[_0xaa8f('0x6')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0xd3fc=['../../mysqldb','ChatMessage','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x456751,_0x5452fb){var _0x1e1046=function(_0x573591){while(--_0x573591){_0x456751['push'](_0x456751['shift']());}};_0x1e1046(++_0x5452fb);}(_0xd3fc,0x1a3));var _0xcd3f=function(_0x4e496e,_0x5dce30){_0x4e496e=_0x4e496e-0x0;var _0x11a798=_0xd3fc[_0x4e496e];return _0x11a798;};'use strict';var EventEmitter=require(_0xcd3f('0x0'));var ChatMessage=require(_0xcd3f('0x1'))['db'][_0xcd3f('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcd3f('0x3'),'afterUpdate':_0xcd3f('0x4'),'afterDestroy':_0xcd3f('0x5')};function emitEvent(_0xd3a7dc){return function(_0x223659,_0x419532,_0x4a72dd){ChatMessageEvents[_0xcd3f('0x6')](_0xd3a7dc+':'+_0x223659['id'],_0x223659);ChatMessageEvents[_0xcd3f('0x6')](_0xd3a7dc,_0x223659);_0x4a72dd(null);};}for(var e in events){if(events[_0xcd3f('0x7')](e)){var event=events[e];ChatMessage[_0xcd3f('0x8')](e,emitEvent(event));}}module[_0xcd3f('0x9')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 403319c..dd7301c 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 _0x650f=['error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','define','chat_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','ChatInteraction','ChatInteractionId','then','update','catch'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x650f,0x1d3));var _0xf650=function(_0x493552,_0x2cd527){_0x493552=_0x493552-0x0;var _0x243ea8=_0x650f[_0x493552];return _0x243ea8;};'use strict';var _=require(_0xf650('0x0'));var util=require('util');var logger=require(_0xf650('0x1'))(_0xf650('0x2'));var moment=require('moment');var BPromise=require(_0xf650('0x3'));var rp=require(_0xf650('0x4'));var fs=require('fs');var path=require(_0xf650('0x5'));var rimraf=require(_0xf650('0x6'));var config=require(_0xf650('0x7'));var attributes=require(_0xf650('0x8'));module['exports']=function(_0x37933c,_0x61f4c5){return _0x37933c[_0xf650('0x9')]('ChatMessage',attributes,{'tableName':_0xf650('0xa'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0xf650('0xb')],'type':_0xf650('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x57d6ac,_0x2b5c99,_0x513ae2){var _0x4abda4=_0x37933c[_0xf650('0xd')];var _0x128715=_0x57d6ac[_0xf650('0xe')]({'plain':!![]});if(_0x128715['direction'][_0xf650('0xf')]()==='in'||_0x128715[_0xf650('0x10')][_0xf650('0xf')]()===_0xf650('0x11')&&!_0x128715[_0xf650('0x12')]&&!_[_0xf650('0x13')](_0x128715[_0xf650('0x14')])){_0x4abda4[_0xf650('0x15')]['findOne']({'where':{'id':_0x128715[_0xf650('0x16')]}})[_0xf650('0x17')](function(_0x3e56d4){if(_0x3e56d4){_0x3e56d4[_0xf650('0x18')]({'lastMsgAt':_0x128715['createdAt'],'lastMsgDirection':_0x128715[_0xf650('0x10')][_0xf650('0xf')]()});}})[_0xf650('0x19')](function(_0x412963){console[_0xf650('0x1a')](_0x412963);});}_0x513ae2();}},'charset':_0xf650('0x1b'),'collate':_0xf650('0x1c')});}; \ No newline at end of file +var _0xdccb=['catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','findOne','ChatInteractionId','then','update','createdAt'];(function(_0x4efece,_0xfb649){var _0x584d70=function(_0x35263e){while(--_0x35263e){_0x4efece['push'](_0x4efece['shift']());}};_0x584d70(++_0xfb649);}(_0xdccb,0x16c));var _0xbdcc=function(_0x5c0a75,_0x146776){_0x5c0a75=_0x5c0a75-0x0;var _0x710f79=_0xdccb[_0x5c0a75];return _0x710f79;};'use strict';var _=require(_0xbdcc('0x0'));var util=require(_0xbdcc('0x1'));var logger=require(_0xbdcc('0x2'))(_0xbdcc('0x3'));var moment=require(_0xbdcc('0x4'));var BPromise=require('bluebird');var rp=require(_0xbdcc('0x5'));var fs=require('fs');var path=require(_0xbdcc('0x6'));var rimraf=require('rimraf');var config=require(_0xbdcc('0x7'));var attributes=require(_0xbdcc('0x8'));module[_0xbdcc('0x9')]=function(_0x39205b,_0x411551){return _0x39205b[_0xbdcc('0xa')](_0xbdcc('0xb'),attributes,{'tableName':_0xbdcc('0xc'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':['body'],'type':_0xbdcc('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5e9010,_0x502065,_0x55913a){var _0x52a985=_0x39205b[_0xbdcc('0xe')];var _0x9b31ea=_0x5e9010[_0xbdcc('0xf')]({'plain':!![]});if(_0x9b31ea[_0xbdcc('0x10')]['toLowerCase']()==='in'||_0x9b31ea[_0xbdcc('0x10')][_0xbdcc('0x11')]()===_0xbdcc('0x12')&&!_0x9b31ea[_0xbdcc('0x13')]&&!_['isNil'](_0x9b31ea[_0xbdcc('0x14')])){_0x52a985['ChatInteraction'][_0xbdcc('0x15')]({'where':{'id':_0x9b31ea[_0xbdcc('0x16')]}})[_0xbdcc('0x17')](function(_0x23f036){if(_0x23f036){_0x23f036[_0xbdcc('0x18')]({'lastMsgAt':_0x9b31ea[_0xbdcc('0x19')],'lastMsgDirection':_0x9b31ea[_0xbdcc('0x10')][_0xbdcc('0x11')]()});}})[_0xbdcc('0x1a')](function(_0x2d22dd){console[_0xbdcc('0x1b')](_0x2d22dd);});}_0x55913a();}},'charset':_0xbdcc('0x1c'),'collate':_0xbdcc('0x1d')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 6eae3fd..46ed535 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 _0x1c22=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./chatMessage.socket','register','request','then','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','info','result','catch','CreateChatMessage','create','body','options','util','moment'];(function(_0x1b96ae,_0x11cd19){var _0x394985=function(_0x581c14){while(--_0x581c14){_0x1b96ae['push'](_0x1b96ae['shift']());}};_0x394985(++_0x11cd19);}(_0x1c22,0x1ed));var _0x21c2=function(_0x20eb13,_0x356f48){_0x20eb13=_0x20eb13-0x0;var _0x571fdb=_0x1c22[_0x20eb13];return _0x571fdb;};'use strict';var _=require('lodash');var util=require(_0x21c2('0x0'));var moment=require(_0x21c2('0x1'));var BPromise=require(_0x21c2('0x2'));var rs=require(_0x21c2('0x3'));var fs=require('fs');var Redis=require(_0x21c2('0x4'));var db=require(_0x21c2('0x5'))['db'];var utils=require(_0x21c2('0x6'));var logger=require(_0x21c2('0x7'))(_0x21c2('0x8'));var config=require(_0x21c2('0x9'));var jayson=require(_0x21c2('0xa'));var client=jayson[_0x21c2('0xb')][_0x21c2('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0x21c2('0xd')],{'host':_0x21c2('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x21c2('0xd')]));require(_0x21c2('0xf'))[_0x21c2('0x10')](socket);function respondWithRpcPromise(_0x5c68a7,_0x27493c,_0x3c1262){return new BPromise(function(_0x6b955f,_0x388a47){return client[_0x21c2('0x11')](_0x5c68a7,_0x3c1262)[_0x21c2('0x12')](function(_0xbca2ac){logger['info']('ChatMessage,\x20%s,\x20%s',_0x27493c,'request\x20sent');logger['debug'](_0x21c2('0x13'),_0x27493c,_0x21c2('0x14'),JSON[_0x21c2('0x15')](_0xbca2ac));if(_0xbca2ac[_0x21c2('0x16')]){if(_0xbca2ac['error'][_0x21c2('0x17')]===0x1f4){logger[_0x21c2('0x16')](_0x21c2('0x18'),_0x27493c,_0xbca2ac[_0x21c2('0x16')][_0x21c2('0x19')]);return _0x388a47(_0xbca2ac[_0x21c2('0x16')][_0x21c2('0x19')]);}logger[_0x21c2('0x16')](_0x21c2('0x18'),_0x27493c,_0xbca2ac[_0x21c2('0x16')][_0x21c2('0x19')]);return _0x6b955f(_0xbca2ac[_0x21c2('0x16')][_0x21c2('0x19')]);}else{logger[_0x21c2('0x1a')]('ChatMessage,\x20%s,\x20%s',_0x27493c,_0x21c2('0x14'));_0x6b955f(_0xbca2ac[_0x21c2('0x1b')][_0x21c2('0x19')]);}})[_0x21c2('0x1c')](function(_0x400383){logger[_0x21c2('0x16')](_0x21c2('0x18'),_0x27493c,_0x400383);_0x388a47(_0x400383);});});}exports[_0x21c2('0x1d')]=function(_0x406559){var _0x894e78=this;return new Promise(function(_0x66df72,_0x2c58fa){return db['ChatMessage'][_0x21c2('0x1e')](_0x406559[_0x21c2('0x1f')],{'raw':_0x406559[_0x21c2('0x20')]?_0x406559[_0x21c2('0x20')]['raw']===undefined?!![]:![]:!![]})[_0x21c2('0x12')](function(_0xb59c0c){logger[_0x21c2('0x1a')](_0x21c2('0x1d'),_0x406559);logger['debug'](_0x21c2('0x1d'),_0x406559,JSON[_0x21c2('0x15')](_0xb59c0c));_0x66df72(_0xb59c0c);})[_0x21c2('0x1c')](function(_0x554c44){logger[_0x21c2('0x16')]('CreateChatMessage',_0x554c44[_0x21c2('0x19')],_0x406559);_0x2c58fa(_0x894e78[_0x21c2('0x16')](0x1f4,_0x554c44['message']));});});}; \ No newline at end of file +var _0x0104=['jayson/promise','client','redis','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateChatMessage','ChatMessage','body','options','raw','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x333458,_0x36619b){var _0x17922b=function(_0x2ed7eb){while(--_0x2ed7eb){_0x333458['push'](_0x333458['shift']());}};_0x17922b(++_0x36619b);}(_0x0104,0x1a4));var _0x4010=function(_0x54a5c2,_0x55e90a){_0x54a5c2=_0x54a5c2-0x0;var _0x59fc97=_0x0104[_0x54a5c2];return _0x59fc97;};'use strict';var _=require(_0x4010('0x0'));var util=require(_0x4010('0x1'));var moment=require(_0x4010('0x2'));var BPromise=require(_0x4010('0x3'));var rs=require(_0x4010('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4010('0x5'))['db'];var utils=require(_0x4010('0x6'));var logger=require(_0x4010('0x7'))(_0x4010('0x8'));var config=require('../../config/environment');var jayson=require(_0x4010('0x9'));var client=jayson[_0x4010('0xa')]['http']({'port':0x232a});config[_0x4010('0xb')]=_['defaults'](config[_0x4010('0xb')],{'host':_0x4010('0xc'),'port':0x18eb});var socket=require(_0x4010('0xd'))(new Redis(config[_0x4010('0xb')]));require(_0x4010('0xe'))[_0x4010('0xf')](socket);function respondWithRpcPromise(_0x3b4db5,_0xf9531d,_0x59de4d){return new BPromise(function(_0x3fa10d,_0xdb3f55){return client[_0x4010('0x10')](_0x3b4db5,_0x59de4d)[_0x4010('0x11')](function(_0x573084){logger[_0x4010('0x12')](_0x4010('0x13'),_0xf9531d,_0x4010('0x14'));logger['debug'](_0x4010('0x15'),_0xf9531d,_0x4010('0x14'),JSON[_0x4010('0x16')](_0x573084));if(_0x573084[_0x4010('0x17')]){if(_0x573084['error'][_0x4010('0x18')]===0x1f4){logger['error'](_0x4010('0x13'),_0xf9531d,_0x573084['error'][_0x4010('0x19')]);return _0xdb3f55(_0x573084[_0x4010('0x17')][_0x4010('0x19')]);}logger[_0x4010('0x17')](_0x4010('0x13'),_0xf9531d,_0x573084[_0x4010('0x17')]['message']);return _0x3fa10d(_0x573084['error'][_0x4010('0x19')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0xf9531d,_0x4010('0x14'));_0x3fa10d(_0x573084['result'][_0x4010('0x19')]);}})[_0x4010('0x1a')](function(_0x181401){logger[_0x4010('0x17')]('ChatMessage,\x20%s,\x20%s',_0xf9531d,_0x181401);_0xdb3f55(_0x181401);});});}exports[_0x4010('0x1b')]=function(_0x4b9176){var _0x3611c2=this;return new Promise(function(_0x5b6c5e,_0x335acd){return db[_0x4010('0x1c')]['create'](_0x4b9176[_0x4010('0x1d')],{'raw':_0x4b9176[_0x4010('0x1e')]?_0x4b9176[_0x4010('0x1e')][_0x4010('0x1f')]===undefined?!![]:![]:!![]})[_0x4010('0x11')](function(_0x15718b){logger['info'](_0x4010('0x1b'),_0x4b9176);logger[_0x4010('0x20')](_0x4010('0x1b'),_0x4b9176,JSON[_0x4010('0x16')](_0x15718b));_0x5b6c5e(_0x15718b);})[_0x4010('0x1a')](function(_0xa658ff){logger[_0x4010('0x17')](_0x4010('0x1b'),_0xa658ff[_0x4010('0x19')],_0x4b9176);_0x335acd(_0x3611c2[_0x4010('0x17')](0x1f4,_0xa658ff[_0x4010('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index d3bc677..2381820 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 _0x3248=['remove','update','removeListener','length','chatMessage:','./chatMessage.events','save'];(function(_0x83531b,_0x5daca6){var _0x3696f2=function(_0x368b38){while(--_0x368b38){_0x83531b['push'](_0x83531b['shift']());}};_0x3696f2(++_0x5daca6);}(_0x3248,0x1b0));var _0x8324=function(_0x5144c1,_0x994c78){_0x5144c1=_0x5144c1-0x0;var _0xc532fa=_0x3248[_0x5144c1];return _0xc532fa;};'use strict';var ChatMessageEvents=require(_0x8324('0x0'));var events=[_0x8324('0x1'),_0x8324('0x2'),_0x8324('0x3')];function createListener(_0x9b580,_0x23b671){return function(_0x3ab598){_0x23b671['emit'](_0x9b580,_0x3ab598);};}function removeListener(_0x4c565b,_0x2e46f3){return function(){ChatMessageEvents[_0x8324('0x4')](_0x4c565b,_0x2e46f3);};}exports['register']=function(_0x18edd2){for(var _0x283f5f=0x0,_0x446423=events[_0x8324('0x5')];_0x283f5f<_0x446423;_0x283f5f++){var _0x215c15=events[_0x283f5f];var _0x5d5f01=createListener(_0x8324('0x6')+_0x215c15,_0x18edd2);ChatMessageEvents['on'](_0x215c15,_0x5d5f01);}}; \ No newline at end of file +var _0x1dcc=['./chatMessage.events','save','remove','update','emit'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0x5ac435,_0x5578ca){_0x5ac435=_0x5ac435-0x0;var _0x4a8225=_0x1dcc[_0x5ac435];return _0x4a8225;};'use strict';var ChatMessageEvents=require(_0xc1dc('0x0'));var events=[_0xc1dc('0x1'),_0xc1dc('0x2'),_0xc1dc('0x3')];function createListener(_0x5c9880,_0x934769){return function(_0x4dece3){_0x934769[_0xc1dc('0x4')](_0x5c9880,_0x4dece3);};}function removeListener(_0x3eb139,_0x2a8ff9){return function(){ChatMessageEvents['removeListener'](_0x3eb139,_0x2a8ff9);};}exports['register']=function(_0x1e57ba){for(var _0x381ab6=0x0,_0x41b667=events['length'];_0x381ab6<_0x41b667;_0x381ab6++){var _0x3ef050=events[_0x381ab6];var _0x3deb94=createListener('chatMessage:'+_0x3ef050,_0x1e57ba);ChatMessageEvents['on'](_0x3ef050,_0x3deb94);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index aedef41..8ab7c99 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 _0xdaee=['../../config/environment','./chatMessage.controller','get','/describe','isAuthenticated','describe','show','tracked','chat','chatmessage:create','create','put','/:id','/:id/accept','accept','reject','delete','destroy','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0xdaee,0xba));var _0xedae=function(_0x45d68a,_0x3994a2){_0x45d68a=_0x45d68a-0x0;var _0x3c415f=_0xdaee[_0x45d68a];return _0x3c415f;};'use strict';var multer=require('multer');var util=require(_0xedae('0x0'));var path=require(_0xedae('0x1'));var timeout=require(_0xedae('0x2'));var express=require(_0xedae('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xedae('0x4'));var interaction=require(_0xedae('0x5'));var config=require(_0xedae('0x6'));var controller=require(_0xedae('0x7'));router[_0xedae('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xedae('0x8')](_0xedae('0x9'),auth[_0xedae('0xa')](),controller[_0xedae('0xb')]);router[_0xedae('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xedae('0xc')]);router['post']('/',auth[_0xedae('0xa')](),interaction[_0xedae('0xd')](_0xedae('0xe'),_0xedae('0xf')),controller[_0xedae('0x10')]);router[_0xedae('0x11')](_0xedae('0x12'),controller['update']);router[_0xedae('0x11')](_0xedae('0x13'),auth[_0xedae('0xa')](),controller[_0xedae('0x14')]);router['put']('/:id/reject',auth[_0xedae('0xa')](),controller[_0xedae('0x15')]);router[_0xedae('0x16')](_0xedae('0x12'),auth[_0xedae('0xa')](),controller[_0xedae('0x17')]);module['exports']=router; \ No newline at end of file +var _0xbf02=['describe','chat','create','put','/:id','/:id/accept','accept','reject','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0xbf02,0x1ee));var _0x2bf0=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xbf02[_0x4a53d];return _0x27410e;};'use strict';var multer=require('multer');var util=require(_0x2bf0('0x0'));var path=require('path');var timeout=require(_0x2bf0('0x1'));var express=require('express');var router=express[_0x2bf0('0x2')]();var fs_extra=require(_0x2bf0('0x3'));var auth=require(_0x2bf0('0x4'));var interaction=require(_0x2bf0('0x5'));var config=require('../../config/environment');var controller=require('./chatMessage.controller');router[_0x2bf0('0x6')]('/',auth[_0x2bf0('0x7')](),controller[_0x2bf0('0x8')]);router[_0x2bf0('0x6')](_0x2bf0('0x9'),auth[_0x2bf0('0x7')](),controller[_0x2bf0('0xa')]);router['get']('/:id',auth[_0x2bf0('0x7')](),controller['show']);router['post']('/',auth[_0x2bf0('0x7')](),interaction['tracked'](_0x2bf0('0xb'),'chatmessage:create'),controller[_0x2bf0('0xc')]);router[_0x2bf0('0xd')](_0x2bf0('0xe'),controller['update']);router['put'](_0x2bf0('0xf'),auth[_0x2bf0('0x7')](),controller[_0x2bf0('0x10')]);router['put']('/:id/reject',auth[_0x2bf0('0x7')](),controller[_0x2bf0('0x11')]);router[_0x2bf0('0x12')]('/:id',auth[_0x2bf0('0x7')](),controller[_0x2bf0('0x13')]);module[_0x2bf0('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index e13e487..8df58af 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['medium','exports','TEXT'];(function(_0x160f61,_0x2689be){var _0x5c19a8=function(_0x28fb1a){while(--_0x28fb1a){_0x160f61['push'](_0x160f61['shift']());}};_0x5c19a8(++_0x2689be);}(_0x2032,0xd9));var _0x2203=function(_0x5c22df,_0x3d7b2c){_0x5c22df=_0x5c22df-0x0;var _0x185966=_0x2032[_0x5c22df];return _0x185966;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'body':{'type':Sequelize[_0x2203('0x1')](_0x2203('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x2203('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0xdb28=['TEXT','medium','sequelize','exports'];(function(_0x38ba1c,_0x38d4c1){var _0xc0080e=function(_0x2fd346){while(--_0x2fd346){_0x38ba1c['push'](_0x38ba1c['shift']());}};_0xc0080e(++_0x38d4c1);}(_0xdb28,0x106));var _0x8db2=function(_0x1f5bc5,_0x520be1){_0x1f5bc5=_0x1f5bc5-0x0;var _0x48e9d6=_0xdb28[_0x1f5bc5];return _0x48e9d6;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x8db2('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 4ab24f3..a712167 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x4e177e,_0x49067f){var _0xaf8126=function(_0x3ce0df){while(--_0x3ce0df){_0x4e177e['push'](_0x4e177e['shift']());}};_0xaf8126(++_0x49067f);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _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(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0x7a54,0x106));var _0x47a5=function(_0x5238dc,_0x1175f){_0x5238dc=_0x5238dc-0x0;var _0x5c462b=_0x7a54[_0x5238dc];return _0x5c462b;};'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.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index d3d38a1..7ad8d03 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.events.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4128=['ChatOfflineMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0xd3fb91,_0xfc54c0){var _0x33438c=function(_0x924998){while(--_0x924998){_0xd3fb91['push'](_0xd3fb91['shift']());}};_0x33438c(++_0xfc54c0);}(_0x4128,0x1a5));var _0x8412=function(_0x3e5db1,_0x8c4d48){_0x3e5db1=_0x3e5db1-0x0;var _0x49cf49=_0x4128[_0x3e5db1];return _0x49cf49;};'use strict';var EventEmitter=require(_0x8412('0x0'));var ChatOfflineMessage=require(_0x8412('0x1'))['db'][_0x8412('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x8412('0x3')](0x0);var events={'afterCreate':_0x8412('0x4'),'afterUpdate':_0x8412('0x5'),'afterDestroy':_0x8412('0x6')};function emitEvent(_0x4b8c33){return function(_0x289ead,_0x4c80ce,_0x35996a){ChatOfflineMessageEvents[_0x8412('0x7')](_0x4b8c33+':'+_0x289ead['id'],_0x289ead);ChatOfflineMessageEvents['emit'](_0x4b8c33,_0x289ead);_0x35996a(null);};}for(var e in events){if(events[_0x8412('0x8')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file +var _0x8fbe=['update','remove','hasOwnProperty','hook','exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save'];(function(_0x35d8af,_0x14fd75){var _0x1d08b0=function(_0x36b437){while(--_0x36b437){_0x35d8af['push'](_0x35d8af['shift']());}};_0x1d08b0(++_0x14fd75);}(_0x8fbe,0xd7));var _0xe8fb=function(_0xd14487,_0x13841c){_0xd14487=_0xd14487-0x0;var _0x12d073=_0x8fbe[_0xd14487];return _0x12d073;};'use strict';var EventEmitter=require(_0xe8fb('0x0'));var ChatOfflineMessage=require(_0xe8fb('0x1'))['db'][_0xe8fb('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xe8fb('0x3')](0x0);var events={'afterCreate':_0xe8fb('0x4'),'afterUpdate':_0xe8fb('0x5'),'afterDestroy':_0xe8fb('0x6')};function emitEvent(_0x4107f6){return function(_0x49e8bf,_0x421c3e,_0x4c840c){ChatOfflineMessageEvents['emit'](_0x4107f6+':'+_0x49e8bf['id'],_0x49e8bf);ChatOfflineMessageEvents['emit'](_0x4107f6,_0x49e8bf);_0x4c840c(null);};}for(var e in events){if(events[_0xe8fb('0x7')](e)){var event=events[e];ChatOfflineMessage[_0xe8fb('0x8')](e,emitEvent(event));}}module[_0xe8fb('0x9')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 68d9c7e..521a36d 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 _0x023b=['utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage'];(function(_0xb2b5f8,_0x48aa42){var _0x123591=function(_0x45d91f){while(--_0x45d91f){_0xb2b5f8['push'](_0xb2b5f8['shift']());}};_0x123591(++_0x48aa42);}(_0x023b,0x1dc));var _0xb023=function(_0x5ccf62,_0x4ccc62){_0x5ccf62=_0x5ccf62-0x0;var _0x5d2fb3=_0x023b[_0x5ccf62];return _0x5d2fb3;};'use strict';var attributes=require(_0xb023('0x0'));module[_0xb023('0x1')]=function(_0x227c4c){return _0x227c4c[_0xb023('0x2')](_0xb023('0x3'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb023('0x4'),'collate':_0xb023('0x5')});}; \ No newline at end of file +var _0x8a96=['exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x8a96,0xae));var _0x68a9=function(_0x44ce7f,_0x3d7c00){_0x44ce7f=_0x44ce7f-0x0;var _0x32cf1a=_0x8a96[_0x44ce7f];return _0x32cf1a;};'use strict';var attributes=require(_0x68a9('0x0'));module[_0x68a9('0x1')]=function(_0xf3b61c){return _0xf3b61c[_0x68a9('0x2')](_0x68a9('0x3'),attributes,{'tableName':_0x68a9('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x68a9('0x5'),'collate':_0x68a9('0x6')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 7c9e899..3be52d5 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 _0x44ae=['debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatOfflineMessage,\x20%s,\x20%s','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent'];(function(_0x5296d6,_0x1e2d5c){var _0x54b636=function(_0x1a28fc){while(--_0x1a28fc){_0x5296d6['push'](_0x5296d6['shift']());}};_0x54b636(++_0x1e2d5c);}(_0x44ae,0x17d));var _0xe44a=function(_0x6ea81a,_0x5c03ed){_0x6ea81a=_0x6ea81a-0x0;var _0x371747=_0x44ae[_0x6ea81a];return _0x371747;};'use strict';var _=require(_0xe44a('0x0'));var util=require(_0xe44a('0x1'));var moment=require(_0xe44a('0x2'));var BPromise=require(_0xe44a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe44a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe44a('0x5'));var logger=require(_0xe44a('0x6'))(_0xe44a('0x7'));var config=require(_0xe44a('0x8'));var jayson=require(_0xe44a('0x9'));var client=jayson[_0xe44a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a06b,_0x37bbef,_0x21f98c){return new BPromise(function(_0x202eaf,_0x4cb089){return client[_0xe44a('0xb')](_0x41a06b,_0x21f98c)[_0xe44a('0xc')](function(_0x3cc39c){logger[_0xe44a('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x37bbef,_0xe44a('0xe'));logger[_0xe44a('0xf')](_0xe44a('0x10'),_0x37bbef,_0xe44a('0xe'),JSON[_0xe44a('0x11')](_0x3cc39c));if(_0x3cc39c[_0xe44a('0x12')]){if(_0x3cc39c[_0xe44a('0x12')]['code']===0x1f4){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x37bbef,_0x3cc39c[_0xe44a('0x12')][_0xe44a('0x13')]);return _0x4cb089(_0x3cc39c[_0xe44a('0x12')]['message']);}logger[_0xe44a('0x12')](_0xe44a('0x14'),_0x37bbef,_0x3cc39c[_0xe44a('0x12')][_0xe44a('0x13')]);return _0x202eaf(_0x3cc39c[_0xe44a('0x12')][_0xe44a('0x13')]);}else{logger[_0xe44a('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x37bbef,_0xe44a('0xe'));_0x202eaf(_0x3cc39c[_0xe44a('0x15')]['message']);}})['catch'](function(_0x4a6860){logger['error'](_0xe44a('0x14'),_0x37bbef,_0x4a6860);_0x4cb089(_0x4a6860);});});} \ No newline at end of file +var _0xa895=['request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','code','message','error','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0xa895,0x145));var _0x5a89=function(_0x44cca4,_0x1c0550){_0x44cca4=_0x44cca4-0x0;var _0x46c0d6=_0xa895[_0x44cca4];return _0x46c0d6;};'use strict';var _=require(_0x5a89('0x0'));var util=require(_0x5a89('0x1'));var moment=require(_0x5a89('0x2'));var BPromise=require(_0x5a89('0x3'));var rs=require(_0x5a89('0x4'));var fs=require('fs');var Redis=require(_0x5a89('0x5'));var db=require(_0x5a89('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5a89('0x7'));var config=require('../../config/environment');var jayson=require(_0x5a89('0x8'));var client=jayson[_0x5a89('0x9')][_0x5a89('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xfab113,_0x1b756b,_0x564e5){return new BPromise(function(_0x39398c,_0x3f54d8){return client[_0x5a89('0xb')](_0xfab113,_0x564e5)[_0x5a89('0xc')](function(_0x4a1f0c){logger[_0x5a89('0xd')](_0x5a89('0xe'),_0x1b756b,_0x5a89('0xf'));logger[_0x5a89('0x10')](_0x5a89('0x11'),_0x1b756b,_0x5a89('0xf'),JSON[_0x5a89('0x12')](_0x4a1f0c));if(_0x4a1f0c['error']){if(_0x4a1f0c['error'][_0x5a89('0x13')]===0x1f4){logger['error'](_0x5a89('0xe'),_0x1b756b,_0x4a1f0c['error'][_0x5a89('0x14')]);return _0x3f54d8(_0x4a1f0c[_0x5a89('0x15')][_0x5a89('0x14')]);}logger['error'](_0x5a89('0xe'),_0x1b756b,_0x4a1f0c[_0x5a89('0x15')]['message']);return _0x39398c(_0x4a1f0c[_0x5a89('0x15')][_0x5a89('0x14')]);}else{logger[_0x5a89('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1b756b,_0x5a89('0xf'));_0x39398c(_0x4a1f0c[_0x5a89('0x16')][_0x5a89('0x14')]);}})[_0x5a89('0x17')](function(_0x5ae5da){logger['error'](_0x5a89('0xe'),_0x1b756b,_0x5ae5da);_0x3f54d8(_0x5ae5da);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 1a66a49..eb363bf 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 _0xd488=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','show','create','put'];(function(_0x239418,_0x4b846c){var _0x4ccda2=function(_0x3a4597){while(--_0x3a4597){_0x239418['push'](_0x239418['shift']());}};_0x4ccda2(++_0x4b846c);}(_0xd488,0x7d));var _0x8d48=function(_0x7f5123,_0x3062c5){_0x7f5123=_0x7f5123-0x0;var _0x10a02a=_0xd488[_0x7f5123];return _0x10a02a;};'use strict';var multer=require(_0x8d48('0x0'));var util=require(_0x8d48('0x1'));var path=require(_0x8d48('0x2'));var timeout=require(_0x8d48('0x3'));var express=require(_0x8d48('0x4'));var router=express[_0x8d48('0x5')]();var fs_extra=require(_0x8d48('0x6'));var auth=require(_0x8d48('0x7'));var interaction=require(_0x8d48('0x8'));var config=require(_0x8d48('0x9'));var controller=require(_0x8d48('0xa'));router[_0x8d48('0xb')]('/',auth[_0x8d48('0xc')](),controller[_0x8d48('0xd')]);router['get'](_0x8d48('0xe'),auth[_0x8d48('0xc')](),controller[_0x8d48('0xf')]);router['get']('/:id',auth[_0x8d48('0xc')](),controller[_0x8d48('0x10')]);router['post']('/',auth[_0x8d48('0xc')](),controller[_0x8d48('0x11')]);router[_0x8d48('0x12')](_0x8d48('0x13'),auth[_0x8d48('0xc')](),controller[_0x8d48('0x14')]);router[_0x8d48('0x15')](_0x8d48('0x13'),auth[_0x8d48('0xc')](),controller[_0x8d48('0x16')]);module[_0x8d48('0x17')]=router; \ No newline at end of file +var _0x05b4=['show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x2a38e6,_0x5bcacf){var _0x560e26=function(_0x2c64d1){while(--_0x2c64d1){_0x2a38e6['push'](_0x2a38e6['shift']());}};_0x560e26(++_0x5bcacf);}(_0x05b4,0x104));var _0x405b=function(_0x62d1cc,_0x174c05){_0x62d1cc=_0x62d1cc-0x0;var _0x2ed94a=_0x05b4[_0x62d1cc];return _0x2ed94a;};'use strict';var multer=require(_0x405b('0x0'));var util=require('util');var path=require(_0x405b('0x1'));var timeout=require(_0x405b('0x2'));var express=require(_0x405b('0x3'));var router=express[_0x405b('0x4')]();var fs_extra=require(_0x405b('0x5'));var auth=require(_0x405b('0x6'));var interaction=require(_0x405b('0x7'));var config=require(_0x405b('0x8'));var controller=require(_0x405b('0x9'));router[_0x405b('0xa')]('/',auth[_0x405b('0xb')](),controller[_0x405b('0xc')]);router[_0x405b('0xa')](_0x405b('0xd'),auth[_0x405b('0xb')](),controller[_0x405b('0xe')]);router[_0x405b('0xa')](_0x405b('0xf'),auth[_0x405b('0xb')](),controller[_0x405b('0x10')]);router[_0x405b('0x11')]('/',auth['isAuthenticated'](),controller[_0x405b('0x12')]);router[_0x405b('0x13')](_0x405b('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x405b('0x14')](_0x405b('0xf'),auth[_0x405b('0xb')](),controller[_0x405b('0x15')]);module[_0x405b('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index d585420..230b55d 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 _0xce5a=['ENUM','mouseOver','timeout','INTEGER','sequelize','STRING'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0xce5a,0xc4));var _0xace5=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0xce5a[_0x15c421];return _0x5e5ed5;};'use strict';var Sequelize=require(_0xace5('0x0'));module['exports']={'name':{'type':Sequelize[_0xace5('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xace5('0x2')](_0xace5('0x3'),_0xace5('0x4')),'defaultValue':_0xace5('0x3')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xace5('0x5')]}}; \ No newline at end of file +var _0x62a2=['INTEGER','sequelize','exports','STRING'];(function(_0x3342d6,_0x186957){var _0x5ac09c=function(_0x399feb){while(--_0x399feb){_0x3342d6['push'](_0x3342d6['shift']());}};_0x5ac09c(++_0x186957);}(_0x62a2,0x115));var _0x262a=function(_0x40942e,_0x54c755){_0x40942e=_0x40942e-0x0;var _0x5a4935=_0x62a2[_0x40942e];return _0x5a4935;};'use strict';var Sequelize=require(_0x262a('0x0'));module[_0x262a('0x1')]={'name':{'type':Sequelize[_0x262a('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('mouseOver','timeout'),'defaultValue':'mouseOver'},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x262a('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index f6f5c28..7a0cb3e 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 _0x9a6b=['find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','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/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','apply','reject','update','destroy','error','stack','name','send','params','model','ChatProactiveAction','rawAttributes','query','keys','filters','intersection','attributes','fields','length','includeAll','include','then','create','body','catch'];(function(_0x57feea,_0x4e756d){var _0x5d61d5=function(_0x5a70c8){while(--_0x5a70c8){_0x57feea['push'](_0x57feea['shift']());}};_0x5d61d5(++_0x4e756d);}(_0x9a6b,0x77));var _0xb9a6=function(_0x19ed2e,_0x4c5da0){_0x19ed2e=_0x19ed2e-0x0;var _0xccadac=_0x9a6b[_0x19ed2e];return _0xccadac;};'use strict';var emlformat=require(_0xb9a6('0x0'));var rimraf=require(_0xb9a6('0x1'));var zipdir=require(_0xb9a6('0x2'));var jsonpatch=require(_0xb9a6('0x3'));var rp=require(_0xb9a6('0x4'));var moment=require(_0xb9a6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb9a6('0x6'));var util=require('util');var path=require(_0xb9a6('0x7'));var sox=require(_0xb9a6('0x8'));var csv=require(_0xb9a6('0x9'));var ejs=require(_0xb9a6('0xa'));var fs=require('fs');var fs_extra=require(_0xb9a6('0xb'));var _=require(_0xb9a6('0xc'));var squel=require(_0xb9a6('0xd'));var crypto=require(_0xb9a6('0xe'));var jsforce=require(_0xb9a6('0xf'));var deskjs=require(_0xb9a6('0x10'));var toCsv=require('to-csv');var querystring=require(_0xb9a6('0x11'));var Papa=require(_0xb9a6('0x12'));var Redis=require('ioredis');var authService=require(_0xb9a6('0x13'));var qs=require(_0xb9a6('0x14'));var as=require(_0xb9a6('0x15'));var hardwareService=require(_0xb9a6('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xb9a6('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb9a6('0x18'))['db'];function respondWithStatusCode(_0x57b620,_0x3f4ce1){_0x3f4ce1=_0x3f4ce1||0xcc;return function(_0x21a637){if(_0x21a637){return _0x57b620[_0xb9a6('0x19')](_0x3f4ce1);}return _0x57b620[_0xb9a6('0x1a')](_0x3f4ce1)[_0xb9a6('0x1b')]();};}function respondWithResult(_0x6cbcc4,_0x3e140e){_0x3e140e=_0x3e140e||0xc8;return function(_0x158d6c){if(_0x158d6c){return _0x6cbcc4[_0xb9a6('0x1a')](_0x3e140e)['json'](_0x158d6c);}};}function respondWithFilteredResult(_0x463f33,_0x136d5d){return function(_0x414f37){if(_0x414f37){var _0x3342d2=typeof _0x136d5d['offset']===_0xb9a6('0x1c')&&typeof _0x136d5d[_0xb9a6('0x1d')]===_0xb9a6('0x1c');var _0x5b3395=_0x414f37[_0xb9a6('0x1e')];var _0x3b9a3b=_0x3342d2?0x0:_0x136d5d[_0xb9a6('0x1f')];var _0x1843e2=_0x3342d2?_0x414f37[_0xb9a6('0x1e')]:_0x136d5d['offset']+_0x136d5d[_0xb9a6('0x1d')];var _0x28e01a;if(_0x1843e2>=_0x5b3395){_0x1843e2=_0x5b3395;_0x28e01a=0xc8;}else{_0x28e01a=0xce;}_0x463f33[_0xb9a6('0x1a')](_0x28e01a);return _0x463f33[_0xb9a6('0x20')]('Content-Range',_0x3b9a3b+'-'+_0x1843e2+'/'+_0x5b3395)['json'](_0x414f37);}return null;};}function patchUpdates(_0x1cb89e){return function(_0x449b39){try{jsonpatch[_0xb9a6('0x21')](_0x449b39,_0x1cb89e,!![]);}catch(_0x49c74b){return BPromise[_0xb9a6('0x22')](_0x49c74b);}return _0x449b39['save']();};}function saveUpdates(_0xc15e48,_0x36c6c1){return function(_0x50d3d4){if(_0x50d3d4){return _0x50d3d4[_0xb9a6('0x23')](_0xc15e48)['then'](function(_0x526721){return _0x526721;});}return null;};}function removeEntity(_0x3bc642,_0x1b838a){return function(_0x73dee3){if(_0x73dee3){return _0x73dee3[_0xb9a6('0x24')]()['then'](function(){_0x3bc642[_0xb9a6('0x1a')](0xcc)[_0xb9a6('0x1b')]();});}};}function handleEntityNotFound(_0x373f62,_0x1d36e3){return function(_0x4b0be8){if(!_0x4b0be8){_0x373f62[_0xb9a6('0x19')](0x194);}return _0x4b0be8;};}function handleError(_0x3896c1,_0x3ebdcd){_0x3ebdcd=_0x3ebdcd||0x1f4;return function(_0x427890){logger[_0xb9a6('0x25')](_0x427890[_0xb9a6('0x26')]);if(_0x427890[_0xb9a6('0x27')]){delete _0x427890['name'];}_0x3896c1[_0xb9a6('0x1a')](_0x3ebdcd)[_0xb9a6('0x28')](_0x427890);};}exports['show']=function(_0x429830,_0x4c2abb){var _0x1fdb38={'raw':!![],'where':{'id':_0x429830[_0xb9a6('0x29')]['id']}},_0x5d75ce={};_0x5d75ce[_0xb9a6('0x2a')]=_['keys'](db[_0xb9a6('0x2b')][_0xb9a6('0x2c')]);_0x5d75ce[_0xb9a6('0x2d')]=_[_0xb9a6('0x2e')](_0x429830[_0xb9a6('0x2d')]);_0x5d75ce[_0xb9a6('0x2f')]=_[_0xb9a6('0x30')](_0x5d75ce['model'],_0x5d75ce[_0xb9a6('0x2d')]);_0x1fdb38[_0xb9a6('0x31')]=_[_0xb9a6('0x30')](_0x5d75ce[_0xb9a6('0x2a')],qs['fields'](_0x429830[_0xb9a6('0x2d')][_0xb9a6('0x32')]));_0x1fdb38['attributes']=_0x1fdb38[_0xb9a6('0x31')][_0xb9a6('0x33')]?_0x1fdb38[_0xb9a6('0x31')]:_0x5d75ce[_0xb9a6('0x2a')];if(_0x429830[_0xb9a6('0x2d')][_0xb9a6('0x34')]){_0x1fdb38[_0xb9a6('0x35')]=[{'all':!![]}];}_0x1fdb38=_['merge']({},_0x1fdb38,_0x429830['options']);return db['ChatProactiveAction']['find'](_0x1fdb38)['then'](handleEntityNotFound(_0x4c2abb,null))[_0xb9a6('0x36')](respondWithResult(_0x4c2abb,null))['catch'](handleError(_0x4c2abb,null));};exports[_0xb9a6('0x37')]=function(_0x56945d,_0x287329){return db[_0xb9a6('0x2b')][_0xb9a6('0x37')](_0x56945d[_0xb9a6('0x38')],{})[_0xb9a6('0x36')](respondWithResult(_0x287329,0xc9))[_0xb9a6('0x39')](handleError(_0x287329,null));};exports[_0xb9a6('0x23')]=function(_0xc96b8,_0x1e2835){if(_0xc96b8[_0xb9a6('0x38')]['id']){delete _0xc96b8[_0xb9a6('0x38')]['id'];}return db[_0xb9a6('0x2b')][_0xb9a6('0x3a')]({'where':{'id':_0xc96b8[_0xb9a6('0x29')]['id']}})[_0xb9a6('0x36')](handleEntityNotFound(_0x1e2835,null))[_0xb9a6('0x36')](saveUpdates(_0xc96b8[_0xb9a6('0x38')],null))['then'](respondWithResult(_0x1e2835,null))[_0xb9a6('0x39')](handleError(_0x1e2835,null));};exports[_0xb9a6('0x24')]=function(_0xdc704f,_0x5a8bf2){return db[_0xb9a6('0x2b')][_0xb9a6('0x3a')]({'where':{'id':_0xdc704f[_0xb9a6('0x29')]['id']}})[_0xb9a6('0x36')](handleEntityNotFound(_0x5a8bf2,null))[_0xb9a6('0x36')](removeEntity(_0x5a8bf2,null))[_0xb9a6('0x39')](handleError(_0x5a8bf2,null));}; \ No newline at end of file +var _0xb39f=['then','error','stack','name','send','show','params','model','keys','query','filters','intersection','attributes','fields','includeAll','merge','find','catch','create','ChatProactiveAction','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','mustache','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','../../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','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update'];(function(_0x45505a,_0x59368a){var _0x36a1f6=function(_0x2f4542){while(--_0x2f4542){_0x45505a['push'](_0x45505a['shift']());}};_0x36a1f6(++_0x59368a);}(_0xb39f,0x1e6));var _0xfb39=function(_0x6213c6,_0x3738b3){_0x6213c6=_0x6213c6-0x0;var _0x456a81=_0xb39f[_0x6213c6];return _0x456a81;};'use strict';var emlformat=require(_0xfb39('0x0'));var rimraf=require(_0xfb39('0x1'));var zipdir=require(_0xfb39('0x2'));var jsonpatch=require(_0xfb39('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfb39('0x4'));var util=require('util');var path=require(_0xfb39('0x5'));var sox=require(_0xfb39('0x6'));var csv=require('to-csv');var ejs=require(_0xfb39('0x7'));var fs=require('fs');var fs_extra=require(_0xfb39('0x8'));var _=require(_0xfb39('0x9'));var squel=require(_0xfb39('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfb39('0xb'));var toCsv=require(_0xfb39('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfb39('0xd'));var qs=require(_0xfb39('0xe'));var as=require(_0xfb39('0xf'));var hardwareService=require(_0xfb39('0x10'));var logger=require(_0xfb39('0x11'))('api');var utils=require(_0xfb39('0x12'));var config=require(_0xfb39('0x13'));var licenseUtil=require(_0xfb39('0x14'));var db=require(_0xfb39('0x15'))['db'];function respondWithStatusCode(_0x35aeb4,_0x5e1cfa){_0x5e1cfa=_0x5e1cfa||0xcc;return function(_0x58249d){if(_0x58249d){return _0x35aeb4[_0xfb39('0x16')](_0x5e1cfa);}return _0x35aeb4[_0xfb39('0x17')](_0x5e1cfa)[_0xfb39('0x18')]();};}function respondWithResult(_0x480a86,_0x3ef405){_0x3ef405=_0x3ef405||0xc8;return function(_0x2a3724){if(_0x2a3724){return _0x480a86['status'](_0x3ef405)['json'](_0x2a3724);}};}function respondWithFilteredResult(_0x177a14,_0x4a0662){return function(_0x31b1dc){if(_0x31b1dc){var _0x4897be=typeof _0x4a0662['offset']===_0xfb39('0x19')&&typeof _0x4a0662[_0xfb39('0x1a')]===_0xfb39('0x19');var _0x1d1ad3=_0x31b1dc[_0xfb39('0x1b')];var _0x5cb552=_0x4897be?0x0:_0x4a0662[_0xfb39('0x1c')];var _0xd2ad6d=_0x4897be?_0x31b1dc[_0xfb39('0x1b')]:_0x4a0662[_0xfb39('0x1c')]+_0x4a0662['limit'];var _0x50765f;if(_0xd2ad6d>=_0x1d1ad3){_0xd2ad6d=_0x1d1ad3;_0x50765f=0xc8;}else{_0x50765f=0xce;}_0x177a14[_0xfb39('0x17')](_0x50765f);return _0x177a14[_0xfb39('0x1d')](_0xfb39('0x1e'),_0x5cb552+'-'+_0xd2ad6d+'/'+_0x1d1ad3)[_0xfb39('0x1f')](_0x31b1dc);}return null;};}function patchUpdates(_0x116b22){return function(_0x57bebf){try{jsonpatch[_0xfb39('0x20')](_0x57bebf,_0x116b22,!![]);}catch(_0x3d5697){return BPromise[_0xfb39('0x21')](_0x3d5697);}return _0x57bebf[_0xfb39('0x22')]();};}function saveUpdates(_0x3b4393,_0x5f2f60){return function(_0x50b2e2){if(_0x50b2e2){return _0x50b2e2[_0xfb39('0x23')](_0x3b4393)[_0xfb39('0x24')](function(_0x561b60){return _0x561b60;});}return null;};}function removeEntity(_0x1b1e65,_0x33d029){return function(_0x23bd78){if(_0x23bd78){return _0x23bd78['destroy']()['then'](function(){_0x1b1e65[_0xfb39('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x228288,_0x14651a){return function(_0x30dbc5){if(!_0x30dbc5){_0x228288[_0xfb39('0x16')](0x194);}return _0x30dbc5;};}function handleError(_0x118aa7,_0x2a7add){_0x2a7add=_0x2a7add||0x1f4;return function(_0x38e145){logger[_0xfb39('0x25')](_0x38e145[_0xfb39('0x26')]);if(_0x38e145[_0xfb39('0x27')]){delete _0x38e145[_0xfb39('0x27')];}_0x118aa7[_0xfb39('0x17')](_0x2a7add)[_0xfb39('0x28')](_0x38e145);};}exports[_0xfb39('0x29')]=function(_0x5d05e2,_0x4a98e9){var _0x34977d={'raw':!![],'where':{'id':_0x5d05e2[_0xfb39('0x2a')]['id']}},_0x233d80={};_0x233d80[_0xfb39('0x2b')]=_[_0xfb39('0x2c')](db['ChatProactiveAction']['rawAttributes']);_0x233d80[_0xfb39('0x2d')]=_['keys'](_0x5d05e2['query']);_0x233d80[_0xfb39('0x2e')]=_[_0xfb39('0x2f')](_0x233d80['model'],_0x233d80['query']);_0x34977d[_0xfb39('0x30')]=_[_0xfb39('0x2f')](_0x233d80[_0xfb39('0x2b')],qs[_0xfb39('0x31')](_0x5d05e2[_0xfb39('0x2d')]['fields']));_0x34977d[_0xfb39('0x30')]=_0x34977d[_0xfb39('0x30')]['length']?_0x34977d[_0xfb39('0x30')]:_0x233d80['model'];if(_0x5d05e2[_0xfb39('0x2d')][_0xfb39('0x32')]){_0x34977d['include']=[{'all':!![]}];}_0x34977d=_[_0xfb39('0x33')]({},_0x34977d,_0x5d05e2['options']);return db['ChatProactiveAction'][_0xfb39('0x34')](_0x34977d)[_0xfb39('0x24')](handleEntityNotFound(_0x4a98e9,null))[_0xfb39('0x24')](respondWithResult(_0x4a98e9,null))[_0xfb39('0x35')](handleError(_0x4a98e9,null));};exports[_0xfb39('0x36')]=function(_0x219936,_0x77e2b5){return db[_0xfb39('0x37')][_0xfb39('0x36')](_0x219936['body'],{})[_0xfb39('0x24')](respondWithResult(_0x77e2b5,0xc9))[_0xfb39('0x35')](handleError(_0x77e2b5,null));};exports[_0xfb39('0x23')]=function(_0x25af42,_0x39354c){if(_0x25af42[_0xfb39('0x38')]['id']){delete _0x25af42[_0xfb39('0x38')]['id'];}return db[_0xfb39('0x37')]['find']({'where':{'id':_0x25af42[_0xfb39('0x2a')]['id']}})[_0xfb39('0x24')](handleEntityNotFound(_0x39354c,null))['then'](saveUpdates(_0x25af42[_0xfb39('0x38')],null))[_0xfb39('0x24')](respondWithResult(_0x39354c,null))[_0xfb39('0x35')](handleError(_0x39354c,null));};exports[_0xfb39('0x39')]=function(_0x2297df,_0x1347c0){return db[_0xfb39('0x37')][_0xfb39('0x34')]({'where':{'id':_0x2297df[_0xfb39('0x2a')]['id']}})[_0xfb39('0x24')](handleEntityNotFound(_0x1347c0,null))[_0xfb39('0x24')](removeEntity(_0x1347c0,null))['catch'](handleError(_0x1347c0,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index de1fed9..48e5e3d 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 _0x7c32=['../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x466409,_0x44b1a2){var _0x4e1aac=function(_0x19a6cb){while(--_0x19a6cb){_0x466409['push'](_0x466409['shift']());}};_0x4e1aac(++_0x44b1a2);}(_0x7c32,0x1f0));var _0x27c3=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x7c32[_0x160c73];return _0xd9302;};'use strict';var _=require(_0x27c3('0x0'));var util=require(_0x27c3('0x1'));var logger=require(_0x27c3('0x2'))(_0x27c3('0x3'));var moment=require('moment');var BPromise=require(_0x27c3('0x4'));var rp=require(_0x27c3('0x5'));var fs=require('fs');var path=require(_0x27c3('0x6'));var rimraf=require(_0x27c3('0x7'));var config=require(_0x27c3('0x8'));var attributes=require(_0x27c3('0x9'));module[_0x27c3('0xa')]=function(_0x3e1433,_0x46e66d){return _0x3e1433[_0x27c3('0xb')](_0x27c3('0xc'),attributes,{'tableName':_0x27c3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4d10=['path','rimraf','../../config/environment','chat_proactive_actions','../../config/logger','moment','bluebird','request-promise'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x4d10,0x114));var _0x04d1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4d10[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x04d1('0x0'))('api');var moment=require(_0x04d1('0x1'));var BPromise=require(_0x04d1('0x2'));var rp=require(_0x04d1('0x3'));var fs=require('fs');var path=require(_0x04d1('0x4'));var rimraf=require(_0x04d1('0x5'));var config=require(_0x04d1('0x6'));var attributes=require('./chatProactiveAction.attributes');module['exports']=function(_0x3c584f,_0x441cc6){return _0x3c584f['define']('ChatProactiveAction',attributes,{'tableName':_0x04d1('0x7'),'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 634931b..eebc567 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 _0xc3a6=['client','request','then','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xc3a6,0x116));var _0x6c3a=function(_0x46833f,_0x285654){_0x46833f=_0x46833f-0x0;var _0xb80091=_0xc3a6[_0x46833f];return _0xb80091;};'use strict';var _=require(_0x6c3a('0x0'));var util=require('util');var moment=require(_0x6c3a('0x1'));var BPromise=require(_0x6c3a('0x2'));var rs=require(_0x6c3a('0x3'));var fs=require('fs');var Redis=require(_0x6c3a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6c3a('0x5'));var logger=require(_0x6c3a('0x6'))(_0x6c3a('0x7'));var config=require(_0x6c3a('0x8'));var jayson=require(_0x6c3a('0x9'));var client=jayson[_0x6c3a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3501e9,_0x2bbeb5,_0x26bc39){return new BPromise(function(_0x25ea96,_0x33c926){return client[_0x6c3a('0xb')](_0x3501e9,_0x26bc39)[_0x6c3a('0xc')](function(_0x4af117){logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x2bbeb5,_0x6c3a('0xd'));logger[_0x6c3a('0xe')](_0x6c3a('0xf'),_0x2bbeb5,'request\x20sent',JSON[_0x6c3a('0x10')](_0x4af117));if(_0x4af117[_0x6c3a('0x11')]){if(_0x4af117[_0x6c3a('0x11')][_0x6c3a('0x12')]===0x1f4){logger['error'](_0x6c3a('0x13'),_0x2bbeb5,_0x4af117[_0x6c3a('0x11')][_0x6c3a('0x14')]);return _0x33c926(_0x4af117['error']['message']);}logger[_0x6c3a('0x11')](_0x6c3a('0x13'),_0x2bbeb5,_0x4af117['error']['message']);return _0x25ea96(_0x4af117[_0x6c3a('0x11')]['message']);}else{logger[_0x6c3a('0x15')](_0x6c3a('0x13'),_0x2bbeb5,_0x6c3a('0xd'));_0x25ea96(_0x4af117[_0x6c3a('0x16')][_0x6c3a('0x14')]);}})[_0x6c3a('0x17')](function(_0x33c96a){logger[_0x6c3a('0x11')](_0x6c3a('0x13'),_0x2bbeb5,_0x33c96a);_0x33c926(_0x33c96a);});});} \ No newline at end of file +var _0xa53c=['stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatProactiveAction,\x20%s,\x20%s','debug','request\x20sent'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xa53c,0x1af));var _0xca53=function(_0x4d65ee,_0x2e3095){_0x4d65ee=_0x4d65ee-0x0;var _0x2878cc=_0xa53c[_0x4d65ee];return _0x2878cc;};'use strict';var _=require(_0xca53('0x0'));var util=require(_0xca53('0x1'));var moment=require(_0xca53('0x2'));var BPromise=require(_0xca53('0x3'));var rs=require(_0xca53('0x4'));var fs=require('fs');var Redis=require(_0xca53('0x5'));var db=require(_0xca53('0x6'))['db'];var utils=require(_0xca53('0x7'));var logger=require(_0xca53('0x8'))(_0xca53('0x9'));var config=require(_0xca53('0xa'));var jayson=require(_0xca53('0xb'));var client=jayson[_0xca53('0xc')][_0xca53('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x566c47,_0x151a52,_0x167925){return new BPromise(function(_0x39dc50,_0x5bcc20){return client[_0xca53('0xe')](_0x566c47,_0x167925)[_0xca53('0xf')](function(_0x1f462c){logger['info'](_0xca53('0x10'),_0x151a52,'request\x20sent');logger[_0xca53('0x11')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x151a52,_0xca53('0x12'),JSON[_0xca53('0x13')](_0x1f462c));if(_0x1f462c[_0xca53('0x14')]){if(_0x1f462c['error'][_0xca53('0x15')]===0x1f4){logger['error'](_0xca53('0x10'),_0x151a52,_0x1f462c[_0xca53('0x14')][_0xca53('0x16')]);return _0x5bcc20(_0x1f462c['error'][_0xca53('0x16')]);}logger[_0xca53('0x14')](_0xca53('0x10'),_0x151a52,_0x1f462c[_0xca53('0x14')]['message']);return _0x39dc50(_0x1f462c[_0xca53('0x14')][_0xca53('0x16')]);}else{logger[_0xca53('0x17')](_0xca53('0x10'),_0x151a52,_0xca53('0x12'));_0x39dc50(_0x1f462c['result']['message']);}})[_0xca53('0x18')](function(_0x481e92){logger['error'](_0xca53('0x10'),_0x151a52,_0x481e92);_0x5bcc20(_0x481e92);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 22ff070..c66e5e9 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 _0x8958=['show','post','put','update','delete','destroy','exports','util','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id','isAuthenticated'];(function(_0x3ffbf1,_0x293b60){var _0x42499a=function(_0x21e20e){while(--_0x21e20e){_0x3ffbf1['push'](_0x3ffbf1['shift']());}};_0x42499a(++_0x293b60);}(_0x8958,0x93));var _0x8895=function(_0x264b38,_0x5a64dd){_0x264b38=_0x264b38-0x0;var _0x5813e=_0x8958[_0x264b38];return _0x5813e;};'use strict';var multer=require('multer');var util=require(_0x8895('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x8895('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x8895('0x2'));var config=require(_0x8895('0x3'));var controller=require(_0x8895('0x4'));router['get'](_0x8895('0x5'),auth[_0x8895('0x6')](),controller[_0x8895('0x7')]);router[_0x8895('0x8')]('/',auth[_0x8895('0x6')](),controller['create']);router[_0x8895('0x9')](_0x8895('0x5'),auth[_0x8895('0x6')](),controller[_0x8895('0xa')]);router[_0x8895('0xb')](_0x8895('0x5'),auth[_0x8895('0x6')](),controller[_0x8895('0xc')]);module[_0x8895('0xd')]=router; \ No newline at end of file +var _0x4819=['post','isAuthenticated','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x4819,0xcd));var _0x9481=function(_0x4c207b,_0x59f530){_0x4c207b=_0x4c207b-0x0;var _0x560c4f=_0x4819[_0x4c207b];return _0x560c4f;};'use strict';var multer=require('multer');var util=require(_0x9481('0x0'));var path=require(_0x9481('0x1'));var timeout=require(_0x9481('0x2'));var express=require(_0x9481('0x3'));var router=express[_0x9481('0x4')]();var fs_extra=require(_0x9481('0x5'));var auth=require(_0x9481('0x6'));var interaction=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var controller=require(_0x9481('0x9'));router['get'](_0x9481('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x9481('0xb')]('/',auth[_0x9481('0xc')](),controller[_0x9481('0xd')]);router[_0x9481('0xe')](_0x9481('0xa'),auth['isAuthenticated'](),controller[_0x9481('0xf')]);router['delete'](_0x9481('0xa'),auth['isAuthenticated'](),controller[_0x9481('0x10')]);module[_0x9481('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index d9e9279..06589d2 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 _0xebc4=['beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xebc4,0x6e));var _0x4ebc=function(_0x347dc0,_0x3aed2b){_0x347dc0=_0x347dc0-0x0;var _0x5416e3=_0xebc4[_0x347dc0];return _0x5416e3;};'use strict';var Sequelize=require(_0x4ebc('0x0'));module[_0x4ebc('0x1')]={'name':{'type':Sequelize[_0x4ebc('0x2')],'unique':_0x4ebc('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4ebc('0x2')]},'timeout':{'type':Sequelize[_0x4ebc('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4ebc('0x5')](_0x4ebc('0x6'),_0x4ebc('0x7'),_0x4ebc('0x8'))}}; \ No newline at end of file +var _0x97fe=['exports','STRING','name','INTEGER','rrmemory','beepall','roundrobin','sequelize'];(function(_0x1f8d0c,_0x2ecdf6){var _0x4af449=function(_0x56db5e){while(--_0x56db5e){_0x1f8d0c['push'](_0x1f8d0c['shift']());}};_0x4af449(++_0x2ecdf6);}(_0x97fe,0x117));var _0xe97f=function(_0x1f4a0c,_0x901279){_0x1f4a0c=_0x1f4a0c-0x0;var _0x3ba284=_0x97fe[_0x1f4a0c];return _0x3ba284;};'use strict';var Sequelize=require(_0xe97f('0x0'));module[_0xe97f('0x1')]={'name':{'type':Sequelize[_0xe97f('0x2')],'unique':_0xe97f('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe97f('0x2')]},'timeout':{'type':Sequelize[_0xe97f('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xe97f('0x5'),_0xe97f('0x6'),_0xe97f('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index eac8500..0f45206 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 _0xb02f=['addTeams','ids','Agents','online','interface','sequelize','transaction','each','forEach','userChatQueue:save','select','field','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','toString','every','TeamId','includes','compact','value','removeTeams','isEmpty','removeAgents','emit','userChatQueue:remove','addAgents','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','./chatQueue.socket','register','jayson/promise','client','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','reject','save','update','destroy','then','get','ChatQueues','UserProfileResource','name','index','ChatQueue','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','merge','type','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','fields','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','params','describe','getMembers','UserChatQueue','nolimit','pick','ChatQueueId','options','User','agent','updatedAt','format','SIP','chatPause','createdAt','getTeams','findOne','Team'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0xb02f,0x1d0));var _0xfb02=function(_0x56dc9a,_0xde3f79){_0x56dc9a=_0x56dc9a-0x0;var _0x173231=_0xb02f[_0x56dc9a];return _0x173231;};'use strict';var emlformat=require(_0xfb02('0x0'));var rimraf=require(_0xfb02('0x1'));var zipdir=require(_0xfb02('0x2'));var jsonpatch=require(_0xfb02('0x3'));var rp=require(_0xfb02('0x4'));var moment=require(_0xfb02('0x5'));var BPromise=require(_0xfb02('0x6'));var Mustache=require(_0xfb02('0x7'));var util=require(_0xfb02('0x8'));var path=require('path');var sox=require(_0xfb02('0x9'));var csv=require('to-csv');var ejs=require(_0xfb02('0xa'));var fs=require('fs');var fs_extra=require(_0xfb02('0xb'));var _=require('lodash');var squel=require(_0xfb02('0xc'));var crypto=require(_0xfb02('0xd'));var jsforce=require(_0xfb02('0xe'));var deskjs=require(_0xfb02('0xf'));var toCsv=require(_0xfb02('0x10'));var querystring=require(_0xfb02('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfb02('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfb02('0x13'))(_0xfb02('0x14'));var utils=require(_0xfb02('0x15'));var config=require(_0xfb02('0x16'));var licenseUtil=require(_0xfb02('0x17'));var db=require(_0xfb02('0x18'))['db'];config[_0xfb02('0x19')]=_['defaults'](config[_0xfb02('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfb02('0x19')]));require(_0xfb02('0x1a'))[_0xfb02('0x1b')](socket);var jayson=require(_0xfb02('0x1c'));var client=jayson[_0xfb02('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2aae81,_0x1ed274,_0xb02380,_0x297254){return new BPromise(function(_0x132b66,_0x5a51bf){var _0x3e342b=_0x297254||client;return _0x3e342b['request'](_0x2aae81,_0xb02380)['then'](function(_0x3a503f){logger[_0xfb02('0x1e')](_0xfb02('0x1f'),_0x1ed274,_0xfb02('0x20'));logger[_0xfb02('0x21')](_0xfb02('0x22'),_0x1ed274,_0xfb02('0x20'),JSON[_0xfb02('0x23')](_0x3a503f));if(_0x3a503f[_0xfb02('0x24')]){if(_0x3a503f[_0xfb02('0x24')][_0xfb02('0x25')]===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x1ed274,_0x3a503f[_0xfb02('0x24')][_0xfb02('0x26')]);return _0x5a51bf(_0x3a503f[_0xfb02('0x24')][_0xfb02('0x26')]);}logger[_0xfb02('0x24')](_0xfb02('0x1f'),_0x1ed274,_0x3a503f[_0xfb02('0x24')][_0xfb02('0x26')]);return _0x132b66(_0x3a503f['error'][_0xfb02('0x26')]);}else{logger[_0xfb02('0x1e')](_0xfb02('0x1f'),_0x1ed274,_0xfb02('0x20'));_0x132b66(_0x3a503f['result'][_0xfb02('0x26')]);}})['catch'](function(_0x4951a7){logger[_0xfb02('0x24')]('ChatQueue,\x20%s,\x20%s',_0x1ed274,_0x4951a7);_0x5a51bf(_0x4951a7);});});}function respondWithStatusCode(_0x208762,_0x3987d6){_0x3987d6=_0x3987d6||0xcc;return function(_0x384f8d){if(_0x384f8d){return _0x208762[_0xfb02('0x27')](_0x3987d6);}return _0x208762[_0xfb02('0x28')](_0x3987d6)[_0xfb02('0x29')]();};}function respondWithResult(_0x3b008f,_0x44bc74){_0x44bc74=_0x44bc74||0xc8;return function(_0x2c7499){if(_0x2c7499){return _0x3b008f['status'](_0x44bc74)[_0xfb02('0x2a')](_0x2c7499);}};}function respondWithFilteredResult(_0x12de87,_0x59003f){return function(_0x550d25){if(_0x550d25){var _0x41520c=typeof _0x59003f[_0xfb02('0x2b')]==='undefined'&&typeof _0x59003f[_0xfb02('0x2c')]==='undefined';var _0x3a6f12=_0x550d25[_0xfb02('0x2d')];var _0xdca304=_0x41520c?0x0:_0x59003f['offset'];var _0x3e535a=_0x41520c?_0x550d25[_0xfb02('0x2d')]:_0x59003f['offset']+_0x59003f[_0xfb02('0x2c')];var _0x55185a;if(_0x3e535a>=_0x3a6f12){_0x3e535a=_0x3a6f12;_0x55185a=0xc8;}else{_0x55185a=0xce;}_0x12de87['status'](_0x55185a);return _0x12de87['set'](_0xfb02('0x2e'),_0xdca304+'-'+_0x3e535a+'/'+_0x3a6f12)['json'](_0x550d25);}return null;};}function patchUpdates(_0x574b5c){return function(_0x7b03){try{jsonpatch[_0xfb02('0x2f')](_0x7b03,_0x574b5c,!![]);}catch(_0x713d4b){return BPromise[_0xfb02('0x30')](_0x713d4b);}return _0x7b03[_0xfb02('0x31')]();};}function saveUpdates(_0x8f6308,_0x1275aa){return function(_0x2f0c44){if(_0x2f0c44){return _0x2f0c44[_0xfb02('0x32')](_0x8f6308)['then'](function(_0xf3d0e2){return _0xf3d0e2;});}return null;};}function removeEntity(_0x45b8fd,_0x187e28){return function(_0x44d1ee){if(_0x44d1ee){return _0x44d1ee[_0xfb02('0x33')]()[_0xfb02('0x34')](function(){var _0x3775d4=_0x44d1ee[_0xfb02('0x35')]({'plain':!![]});var _0x18a1bd=_0xfb02('0x36');return db[_0xfb02('0x37')][_0xfb02('0x33')]({'where':{'type':_0x18a1bd,'resourceId':_0x3775d4['id']}})[_0xfb02('0x34')](function(){return _0x44d1ee;});})[_0xfb02('0x34')](function(){_0x45b8fd['status'](0xcc)[_0xfb02('0x29')]();});}};}function handleEntityNotFound(_0x561e22,_0x454a0f){return function(_0x282ae0){if(!_0x282ae0){_0x561e22['sendStatus'](0x194);}return _0x282ae0;};}function handleError(_0x13d1df,_0x518a21){_0x518a21=_0x518a21||0x1f4;return function(_0x52abc7){logger[_0xfb02('0x24')](_0x52abc7['stack']);if(_0x52abc7[_0xfb02('0x38')]){delete _0x52abc7[_0xfb02('0x38')];}_0x13d1df[_0xfb02('0x28')](_0x518a21)['send'](_0x52abc7);};}exports[_0xfb02('0x39')]=function(_0x2b87a0,_0xd0cee2){var _0x5c706f={},_0x139f44={},_0xe5569d={'count':0x0,'rows':[]};var _0x2c8694=_['map'](db[_0xfb02('0x3a')][_0xfb02('0x3b')],function(_0x27d001){return{'name':_0x27d001[_0xfb02('0x3c')],'type':_0x27d001['type']['key']};});_0x139f44[_0xfb02('0x3d')]=_[_0xfb02('0x3e')](_0x2c8694,'name');_0x139f44[_0xfb02('0x3f')]=_[_0xfb02('0x40')](_0x2b87a0[_0xfb02('0x3f')]);_0x139f44[_0xfb02('0x41')]=_[_0xfb02('0x42')](_0x139f44[_0xfb02('0x3d')],_0x139f44[_0xfb02('0x3f')]);_0x5c706f['attributes']=_[_0xfb02('0x42')](_0x139f44['model'],qs['fields'](_0x2b87a0[_0xfb02('0x3f')]['fields']));_0x5c706f[_0xfb02('0x43')]=_0x5c706f['attributes'][_0xfb02('0x44')]?_0x5c706f[_0xfb02('0x43')]:_0x139f44[_0xfb02('0x3d')];if(!_0x2b87a0[_0xfb02('0x3f')][_0xfb02('0x45')]('nolimit')){_0x5c706f[_0xfb02('0x2c')]=qs[_0xfb02('0x2c')](_0x2b87a0[_0xfb02('0x3f')][_0xfb02('0x2c')]);_0x5c706f[_0xfb02('0x2b')]=qs['offset'](_0x2b87a0['query'][_0xfb02('0x2b')]);}_0x5c706f[_0xfb02('0x46')]=qs['sort'](_0x2b87a0['query'][_0xfb02('0x47')]);_0x5c706f[_0xfb02('0x48')]=qs[_0xfb02('0x41')](_['pick'](_0x2b87a0[_0xfb02('0x3f')],_0x139f44[_0xfb02('0x41')]),_0x2c8694);if(_0x2b87a0['query']['filter']){_0x5c706f['where']=_[_0xfb02('0x49')](_0x5c706f[_0xfb02('0x48')],{'$or':_[_0xfb02('0x3e')](_0x2c8694,function(_0x51fd82){if(_0x51fd82[_0xfb02('0x4a')]!==_0xfb02('0x4b')){var _0x2547ca={};_0x2547ca[_0x51fd82[_0xfb02('0x38')]]={'$like':'%'+_0x2b87a0[_0xfb02('0x3f')][_0xfb02('0x4c')]+'%'};return _0x2547ca;}})});}_0x5c706f=_[_0xfb02('0x49')]({},_0x5c706f,_0x2b87a0['options']);var _0x4dad12={'where':_0x5c706f[_0xfb02('0x48')]};return db[_0xfb02('0x3a')]['count'](_0x4dad12)[_0xfb02('0x34')](function(_0xc0a5a8){_0xe5569d['count']=_0xc0a5a8;if(_0x2b87a0[_0xfb02('0x3f')][_0xfb02('0x4d')]){_0x5c706f[_0xfb02('0x4e')]=[{'all':!![]}];}return db[_0xfb02('0x3a')][_0xfb02('0x4f')](_0x5c706f);})[_0xfb02('0x34')](function(_0x33e759){_0xe5569d[_0xfb02('0x50')]=_0x33e759;return _0xe5569d;})[_0xfb02('0x34')](respondWithFilteredResult(_0xd0cee2,_0x5c706f))[_0xfb02('0x51')](handleError(_0xd0cee2,null));};exports[_0xfb02('0x52')]=function(_0x26644b,_0x4b1e93){var _0x48dab2={'raw':!![],'where':{'id':_0x26644b['params']['id']}},_0x2e845e={};_0x2e845e[_0xfb02('0x3d')]=_[_0xfb02('0x40')](db[_0xfb02('0x3a')]['rawAttributes']);_0x2e845e[_0xfb02('0x3f')]=_[_0xfb02('0x40')](_0x26644b[_0xfb02('0x3f')]);_0x2e845e['filters']=_[_0xfb02('0x42')](_0x2e845e['model'],_0x2e845e[_0xfb02('0x3f')]);_0x48dab2[_0xfb02('0x43')]=_[_0xfb02('0x42')](_0x2e845e[_0xfb02('0x3d')],qs[_0xfb02('0x53')](_0x26644b[_0xfb02('0x3f')][_0xfb02('0x53')]));_0x48dab2[_0xfb02('0x43')]=_0x48dab2[_0xfb02('0x43')][_0xfb02('0x44')]?_0x48dab2['attributes']:_0x2e845e[_0xfb02('0x3d')];if(_0x26644b[_0xfb02('0x3f')][_0xfb02('0x4d')]){_0x48dab2[_0xfb02('0x4e')]=[{'all':!![]}];}_0x48dab2=_['merge']({},_0x48dab2,_0x26644b['options']);return db[_0xfb02('0x3a')][_0xfb02('0x54')](_0x48dab2)[_0xfb02('0x34')](handleEntityNotFound(_0x4b1e93,null))[_0xfb02('0x34')](respondWithResult(_0x4b1e93,null))[_0xfb02('0x51')](handleError(_0x4b1e93,null));};exports[_0xfb02('0x55')]=function(_0x6f0b91,_0x261a50){return db[_0xfb02('0x3a')][_0xfb02('0x55')](_0x6f0b91[_0xfb02('0x56')],{})[_0xfb02('0x34')](function(_0x2db0de){var _0x2b2ce2=_0x6f0b91['user'][_0xfb02('0x35')]({'plain':!![]});if(!_0x2b2ce2)throw new Error(_0xfb02('0x57'));if(_0x2b2ce2[_0xfb02('0x58')]===_0xfb02('0x59')){var _0x1295fa=_0x2db0de[_0xfb02('0x35')]({'plain':!![]});var _0x42e87f=_0xfb02('0x36');return db[_0xfb02('0x5a')][_0xfb02('0x54')]({'where':{'name':_0x42e87f,'userProfileId':_0x2b2ce2[_0xfb02('0x5b')]},'raw':!![]})[_0xfb02('0x34')](function(_0x4e5ea7){if(_0x4e5ea7&&_0x4e5ea7[_0xfb02('0x5c')]===0x0){return db['UserProfileResource']['create']({'name':_0x1295fa[_0xfb02('0x38')],'resourceId':_0x1295fa['id'],'type':_0x4e5ea7['name'],'sectionId':_0x4e5ea7['id']},{})[_0xfb02('0x34')](function(){return _0x2db0de;});}else{return _0x2db0de;}})[_0xfb02('0x51')](function(_0x55b948){logger[_0xfb02('0x24')](_0xfb02('0x5d'),_0x55b948);throw _0x55b948;});}return _0x2db0de;})[_0xfb02('0x34')](respondWithResult(_0x261a50,0xc9))[_0xfb02('0x51')](handleError(_0x261a50,null));};exports['update']=function(_0xbbc64f,_0x19b54d){if(_0xbbc64f['body']['id']){delete _0xbbc64f[_0xfb02('0x56')]['id'];}return db[_0xfb02('0x3a')][_0xfb02('0x54')]({'where':{'id':_0xbbc64f[_0xfb02('0x5e')]['id']}})['then'](handleEntityNotFound(_0x19b54d,null))[_0xfb02('0x34')](saveUpdates(_0xbbc64f[_0xfb02('0x56')],null))[_0xfb02('0x34')](respondWithResult(_0x19b54d,null))[_0xfb02('0x51')](handleError(_0x19b54d,null));};exports[_0xfb02('0x33')]=function(_0x5d1cea,_0x55df2c){return db[_0xfb02('0x3a')]['find']({'where':{'id':_0x5d1cea['params']['id']}})[_0xfb02('0x34')](handleEntityNotFound(_0x55df2c,null))[_0xfb02('0x34')](removeEntity(_0x55df2c,null))[_0xfb02('0x51')](handleError(_0x55df2c,null));};exports['describe']=function(_0x3db0e0,_0x5698a5){return db[_0xfb02('0x3a')][_0xfb02('0x5f')]()[_0xfb02('0x34')](respondWithResult(_0x5698a5,null))['catch'](handleError(_0x5698a5,null));};exports[_0xfb02('0x60')]=function(_0x4ffb18,_0x1f66f4,_0x2be89e){var _0x55db67={'raw':!![],'where':{}},_0x3e84cd={},_0x36125b;return db['ChatQueue']['findOne']({'where':{'id':_0x4ffb18[_0xfb02('0x5e')]['id']}})[_0xfb02('0x34')](handleEntityNotFound(_0x1f66f4,null))[_0xfb02('0x34')](function(_0x23335a){if(_0x23335a){_0x36125b=_0x23335a[_0xfb02('0x35')]({'plain':!![]});_0x3e84cd[_0xfb02('0x3d')]=_[_0xfb02('0x40')](db[_0xfb02('0x61')][_0xfb02('0x3b')]);_0x3e84cd[_0xfb02('0x3f')]=_[_0xfb02('0x40')](_0x4ffb18[_0xfb02('0x3f')]);_0x3e84cd[_0xfb02('0x41')]=_[_0xfb02('0x42')](_0x3e84cd[_0xfb02('0x3d')],_0x3e84cd[_0xfb02('0x3f')]);_0x55db67[_0xfb02('0x43')]=_[_0xfb02('0x42')](_0x3e84cd[_0xfb02('0x3d')],qs[_0xfb02('0x53')](_0x4ffb18[_0xfb02('0x3f')][_0xfb02('0x53')]));_0x55db67[_0xfb02('0x43')]=_0x55db67['attributes']['length']?_0x55db67[_0xfb02('0x43')]:_0x3e84cd[_0xfb02('0x3d')];if(!_0x4ffb18[_0xfb02('0x3f')][_0xfb02('0x45')](_0xfb02('0x62'))){_0x55db67['limit']=qs[_0xfb02('0x2c')](_0x4ffb18['query']['limit']);_0x55db67[_0xfb02('0x2b')]=qs[_0xfb02('0x2b')](_0x4ffb18[_0xfb02('0x3f')]['offset']);}_0x55db67[_0xfb02('0x46')]=qs[_0xfb02('0x47')](_0x4ffb18[_0xfb02('0x3f')][_0xfb02('0x47')]);_0x55db67[_0xfb02('0x48')]=qs['filters'](_[_0xfb02('0x63')](_0x4ffb18[_0xfb02('0x3f')],_0x3e84cd[_0xfb02('0x41')]));_0x55db67[_0xfb02('0x48')][_0xfb02('0x64')]=_0x23335a['id'];if(_0x4ffb18['query'][_0xfb02('0x4c')]){_0x55db67[_0xfb02('0x48')]=_[_0xfb02('0x49')](_0x55db67['where'],{'$or':_[_0xfb02('0x3e')](_0x55db67['attributes'],function(_0xa2edb9){var _0x3739b4={};_0x3739b4[_0xa2edb9]={'$like':'%'+_0x4ffb18['query'][_0xfb02('0x4c')]+'%'};return _0x3739b4;})});}_0x55db67=_[_0xfb02('0x49')]({},_0x55db67,_0x4ffb18[_0xfb02('0x65')]);return db[_0xfb02('0x61')][_0xfb02('0x4f')](_0x55db67);}})[_0xfb02('0x34')](function(_0x860436){if(_0x860436){return db[_0xfb02('0x66')]['findAndCountAll']({'where':{'id':_[_0xfb02('0x3e')](_0x860436,'UserId'),'role':_0xfb02('0x67')},'attributes':['id',_0xfb02('0x38'),'chatPause',_0xfb02('0x68'),'createdAt']});}})[_0xfb02('0x34')](function(_0x3b4a44){if(_0x3b4a44){return{'count':_0x3b4a44[_0xfb02('0x2d')],'rows':_[_0xfb02('0x3e')](_0x3b4a44[_0xfb02('0x50')],function(_0x4dfe32){return{'membername':_0x4dfe32[_0xfb02('0x38')],'UserId':_0x4dfe32['id'],'queue_name':_0x36125b[_0xfb02('0x38')],'ChatQueueId':_0x36125b['id'],'interface':util[_0xfb02('0x69')]('%s/%s',_0xfb02('0x6a'),_0x4dfe32['name']),'penalty':0x0,'paused':_0x4dfe32[_0xfb02('0x6b')],'createdAt':_0x4dfe32[_0xfb02('0x6c')],'updatedAt':_0x4dfe32[_0xfb02('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xfb02('0x34')](respondWithFilteredResult(_0x1f66f4,_0x55db67))[_0xfb02('0x51')](handleError(_0x1f66f4,null));};exports[_0xfb02('0x6d')]=function(_0xb9faf,_0x16816b,_0x4ea74d){var _0x5dda1a={};var _0x258c26={};var _0x11392a;var _0x5d1266;return db[_0xfb02('0x3a')][_0xfb02('0x6e')]({'where':{'id':_0xb9faf[_0xfb02('0x5e')]['id']}})[_0xfb02('0x34')](handleEntityNotFound(_0x16816b,null))[_0xfb02('0x34')](function(_0x59bf05){if(_0x59bf05){_0x11392a=_0x59bf05;_0x258c26[_0xfb02('0x3d')]=_[_0xfb02('0x40')](db[_0xfb02('0x6f')]['rawAttributes']);_0x258c26[_0xfb02('0x3f')]=_[_0xfb02('0x40')](_0xb9faf[_0xfb02('0x3f')]);_0x258c26[_0xfb02('0x41')]=_['intersection'](_0x258c26[_0xfb02('0x3d')],_0x258c26['query']);_0x5dda1a['attributes']=_[_0xfb02('0x42')](_0x258c26[_0xfb02('0x3d')],qs[_0xfb02('0x53')](_0xb9faf[_0xfb02('0x3f')][_0xfb02('0x53')]));_0x5dda1a['attributes']=_0x5dda1a[_0xfb02('0x43')][_0xfb02('0x44')]?_0x5dda1a[_0xfb02('0x43')]:_0x258c26[_0xfb02('0x3d')];_0x5dda1a[_0xfb02('0x46')]=qs[_0xfb02('0x47')](_0xb9faf[_0xfb02('0x3f')]['sort']);_0x5dda1a['where']=qs[_0xfb02('0x41')](_['pick'](_0xb9faf[_0xfb02('0x3f')],_0x258c26[_0xfb02('0x41')]));if(_0xb9faf[_0xfb02('0x3f')][_0xfb02('0x4c')]){_0x5dda1a[_0xfb02('0x48')]=_['merge'](_0x5dda1a['where'],{'$or':_['map'](_0x5dda1a[_0xfb02('0x43')],function(_0x8384e7){var _0x22dd9f={};_0x22dd9f[_0x8384e7]={'$like':'%'+_0xb9faf[_0xfb02('0x3f')][_0xfb02('0x4c')]+'%'};return _0x22dd9f;})});}_0x5dda1a=_['merge']({},_0x5dda1a,_0xb9faf['options']);return _0x11392a['getTeams'](_0x5dda1a);}})[_0xfb02('0x34')](function(_0x2b7779){if(_0x2b7779){_0x5d1266=_0x2b7779[_0xfb02('0x44')];if(!_0xb9faf[_0xfb02('0x3f')][_0xfb02('0x45')](_0xfb02('0x62'))){_0x5dda1a[_0xfb02('0x2c')]=qs[_0xfb02('0x2c')](_0xb9faf[_0xfb02('0x3f')][_0xfb02('0x2c')]);_0x5dda1a[_0xfb02('0x2b')]=qs[_0xfb02('0x2b')](_0xb9faf[_0xfb02('0x3f')][_0xfb02('0x2b')]);}return _0x11392a[_0xfb02('0x6d')](_0x5dda1a);}})['then'](function(_0x18a3e2){if(_0x18a3e2){return _0x18a3e2?{'count':_0x5d1266,'rows':_0x18a3e2}:null;}})['then'](respondWithResult(_0x16816b,null))['catch'](handleError(_0x16816b,null));};exports[_0xfb02('0x70')]=function(_0x597477,_0x5c4cf6,_0x4acd1a){var _0x577042=_0x597477[_0xfb02('0x56')][_0xfb02('0x71')];return db[_0xfb02('0x6f')][_0xfb02('0x4f')]({'where':{'id':_0x577042},'attributes':['id'],'include':[{'model':db['User'],'as':_0xfb02('0x72'),'attributes':['id','name',_0xfb02('0x73'),'voicePause',_0xfb02('0x74')],'raw':!![]}]})[_0xfb02('0x34')](function(_0xa8a626){if(_0xa8a626){var _0x5dede8=_['flatMap'](_0xa8a626,function(_0x19efc1){var _0x219cf2=_0x19efc1[_0xfb02('0x35')]({'plain':!![]});return _0x219cf2[_0xfb02('0x72')];});return db[_0xfb02('0x3a')][_0xfb02('0x54')]({'where':{'id':_0x597477[_0xfb02('0x5e')]['id']}})[_0xfb02('0x34')](function(_0x44910d){return db[_0xfb02('0x75')][_0xfb02('0x76')](function(_0x44aeac){return _0x44910d[_0xfb02('0x70')](_0x577042,{'transaction':_0x44aeac})[_0xfb02('0x34')](function(){return BPromise[_0xfb02('0x77')](_0x5dede8,function(_0x53dcc2){return db[_0xfb02('0x61')]['findOrCreate']({'where':{'UserId':_0x53dcc2['id'],'ChatQueueId':_0x597477[_0xfb02('0x5e')]['id']},'transaction':_0x44aeac});});})[_0xfb02('0x34')](function(){_0x5dede8[_0xfb02('0x78')](function(_0x40f794){socket['emit'](_0xfb02('0x79'),{'UserId':_0x40f794['id'],'ChatQueueId':_0x44910d['id']});});});});});}})['then'](respondWithStatusCode(_0x5c4cf6,null))[_0xfb02('0x51')](handleError(_0x5c4cf6,null));};exports['removeTeams']=function(_0x187954,_0x57eb62,_0x389924){return db['Team'][_0xfb02('0x4f')]({'where':{'id':_0x187954[_0xfb02('0x3f')][_0xfb02('0x71')]},'attributes':['id'],'include':[{'model':db[_0xfb02('0x66')],'as':_0xfb02('0x72'),'attributes':['id'],'raw':!![]}]})[_0xfb02('0x34')](handleEntityNotFound(_0x57eb62,null))[_0xfb02('0x34')](function(_0x3b673c){var _0x53dec5=_[_0xfb02('0x3e')](_0x3b673c,'id');var _0x1874e4=[];var _0x539c34=[];var _0x5b7ccd=squel[_0xfb02('0x7a')]();_0x5b7ccd[_0xfb02('0x7b')]('tq.TeamId')[_0xfb02('0x7c')](_0xfb02('0x7d'),'tq')[_0xfb02('0x7e')](_0xfb02('0x7f'),'ut',_0xfb02('0x80'))['where'](_0xfb02('0x81'),_0x187954['params']['id']);for(var _0x3c98c7=0x0;_0x3c98c7<_0x3b673c['length'];_0x3c98c7+=0x1){let _0x3b9ae8=_0x3b673c[_0x3c98c7];for(var _0x479d4f=0x0;_0x479d4f<_0x3b9ae8[_0xfb02('0x72')][_0xfb02('0x44')];_0x479d4f+=0x1){let _0x4ccfc6=_0x3b9ae8['Agents'][_0x479d4f];var _0x5d3407=_0x5b7ccd[_0xfb02('0x82')]();_0x5d3407[_0xfb02('0x48')]('ut.UserId\x20=\x20?',_0x4ccfc6['id']);_0x539c34['push'](db[_0xfb02('0x75')][_0xfb02('0x3f')](_0x5d3407[_0xfb02('0x83')](),{'type':db[_0xfb02('0x75')]['QueryTypes']['SELECT']})['then'](function(_0x2c7044){if(_0x2c7044[_0xfb02('0x44')]===0x1){return _0x4ccfc6['id'];}else{var _0x4eb65b=_[_0xfb02('0x84')](_['map'](_0x2c7044,_0xfb02('0x85')),function(_0x3919ee){return _[_0xfb02('0x86')](_0x53dec5,_0x3919ee);});if(_0x4eb65b){return _0x4ccfc6['id'];}}}));}}return BPromise['all'](_0x539c34)[_0xfb02('0x34')](function(_0x16d91e){_0x1874e4=_(_0x1874e4)['union'](_0x16d91e)[_0xfb02('0x87')]()[_0xfb02('0x88')]();return db[_0xfb02('0x3a')][_0xfb02('0x54')]({'where':{'id':_0x187954[_0xfb02('0x5e')]['id']}})[_0xfb02('0x34')](function(_0x12e4d5){return db[_0xfb02('0x75')]['transaction'](function(_0x35da9a){return _0x12e4d5[_0xfb02('0x89')](_0x187954[_0xfb02('0x3f')][_0xfb02('0x71')],{'transaction':_0x35da9a})[_0xfb02('0x34')](function(){if(!_[_0xfb02('0x8a')](_0x1874e4)){return _0x12e4d5[_0xfb02('0x8b')](_0x1874e4,{'transaction':_0x35da9a});}})['then'](function(){_0x1874e4[_0xfb02('0x78')](function(_0x332400){socket[_0xfb02('0x8c')](_0xfb02('0x8d'),{'UserId':_0x332400,'ChatQueueId':_0x12e4d5['id']});});});});});});})[_0xfb02('0x34')](respondWithStatusCode(_0x57eb62,null))[_0xfb02('0x51')](handleError(_0x57eb62,null));};exports[_0xfb02('0x8e')]=function(_0x67145b,_0xe6af0d,_0x1ff7c2){return db['ChatQueue'][_0xfb02('0x54')]({'where':{'id':_0x67145b['params']['id']}})[_0xfb02('0x34')](handleEntityNotFound(_0xe6af0d,null))[_0xfb02('0x34')](function(_0xa946f6){if(_0xa946f6){return _0xa946f6[_0xfb02('0x8e')](_0x67145b[_0xfb02('0x56')][_0xfb02('0x71')],_['omit'](_0x67145b[_0xfb02('0x56')],[_0xfb02('0x71'),'id'])||{})['spread'](function(_0x111724){for(var _0x3f638f=0x0;_0x3f638f<_0x67145b['body']['ids'][_0xfb02('0x44')];_0x3f638f+=0x1){socket[_0xfb02('0x8c')](_0xfb02('0x79'),{'UserId':Number(_0x67145b['body'][_0xfb02('0x71')][_0x3f638f]),'ChatQueueId':Number(_0x67145b['params']['id'])});}return _0x111724;});}})[_0xfb02('0x34')](respondWithResult(_0xe6af0d,null))[_0xfb02('0x51')](handleError(_0xe6af0d,null));};exports[_0xfb02('0x8b')]=function(_0x5c86d7,_0x2f9e54,_0x1097f1){return db['ChatQueue']['find']({'where':{'id':_0x5c86d7['params']['id']}})[_0xfb02('0x34')](handleEntityNotFound(_0x2f9e54,null))['then'](function(_0x3f8d12){if(_0x3f8d12){return _0x3f8d12[_0xfb02('0x8b')](_0x5c86d7[_0xfb02('0x3f')]['ids'])[_0xfb02('0x34')](function(){if(_['isArray'](_0x5c86d7[_0xfb02('0x3f')][_0xfb02('0x71')])){for(var _0x5df92c=0x0;_0x5df92c<_0x5c86d7[_0xfb02('0x3f')][_0xfb02('0x71')][_0xfb02('0x44')];_0x5df92c+=0x1){socket[_0xfb02('0x8c')](_0xfb02('0x8d'),{'UserId':Number(_0x5c86d7[_0xfb02('0x3f')][_0xfb02('0x71')][_0x5df92c]),'ChatQueueId':Number(_0x5c86d7[_0xfb02('0x5e')]['id'])});}}else{socket[_0xfb02('0x8c')](_0xfb02('0x8d'),{'UserId':Number(_0x5c86d7[_0xfb02('0x3f')][_0xfb02('0x71')]),'ChatQueueId':Number(_0x5c86d7[_0xfb02('0x5e')]['id'])});}});}})['then'](respondWithStatusCode(_0x2f9e54,null))[_0xfb02('0x51')](handleError(_0x2f9e54,null));};exports['getAgents']=function(_0x13c0d2,_0x41a5ca,_0xab98da){var _0x387d8d={};var _0x3a83ab={};var _0x542c2c;var _0x15e083;return db[_0xfb02('0x3a')][_0xfb02('0x6e')]({'where':{'id':_0x13c0d2[_0xfb02('0x5e')]['id']}})[_0xfb02('0x34')](handleEntityNotFound(_0x41a5ca,null))['then'](function(_0x54ae0c){if(_0x54ae0c){_0x542c2c=_0x54ae0c;_0x3a83ab[_0xfb02('0x3d')]=_[_0xfb02('0x40')](db['User']['rawAttributes']);_0x3a83ab[_0xfb02('0x3f')]=_[_0xfb02('0x40')](_0x13c0d2[_0xfb02('0x3f')]);_0x3a83ab[_0xfb02('0x41')]=_[_0xfb02('0x42')](_0x3a83ab[_0xfb02('0x3d')],_0x3a83ab[_0xfb02('0x3f')]);_0x387d8d[_0xfb02('0x43')]=_[_0xfb02('0x42')](_0x3a83ab[_0xfb02('0x3d')],qs['fields'](_0x13c0d2[_0xfb02('0x3f')][_0xfb02('0x53')]));_0x387d8d['attributes']=_0x387d8d[_0xfb02('0x43')][_0xfb02('0x44')]?_0x387d8d[_0xfb02('0x43')]:_0x3a83ab[_0xfb02('0x3d')];_0x387d8d[_0xfb02('0x46')]=qs[_0xfb02('0x47')](_0x13c0d2[_0xfb02('0x3f')][_0xfb02('0x47')]);_0x387d8d[_0xfb02('0x48')]=qs[_0xfb02('0x41')](_[_0xfb02('0x63')](_0x13c0d2['query'],_0x3a83ab['filters']));if(_0x13c0d2['query']['filter']){_0x387d8d[_0xfb02('0x48')]=_[_0xfb02('0x49')](_0x387d8d[_0xfb02('0x48')],{'$or':_[_0xfb02('0x3e')](_0x387d8d[_0xfb02('0x43')],function(_0x2835cf){var _0x4d6896={};_0x4d6896[_0x2835cf]={'$like':'%'+_0x13c0d2[_0xfb02('0x3f')][_0xfb02('0x4c')]+'%'};return _0x4d6896;})});}_0x387d8d=_[_0xfb02('0x49')]({},_0x387d8d,_0x13c0d2['options']);return _0x542c2c[_0xfb02('0x8f')](_0x387d8d);}})[_0xfb02('0x34')](function(_0x49ac04){if(_0x49ac04){_0x15e083=_0x49ac04[_0xfb02('0x44')];if(!_0x13c0d2['query'][_0xfb02('0x45')](_0xfb02('0x62'))){_0x387d8d['limit']=qs[_0xfb02('0x2c')](_0x13c0d2['query'][_0xfb02('0x2c')]);_0x387d8d[_0xfb02('0x2b')]=qs['offset'](_0x13c0d2['query']['offset']);}return _0x542c2c[_0xfb02('0x8f')](_0x387d8d);}})[_0xfb02('0x34')](function(_0x25a9a1){if(_0x25a9a1){return _0x25a9a1?{'count':_0x15e083,'rows':_0x25a9a1}:null;}})['then'](respondWithResult(_0x41a5ca,null))[_0xfb02('0x51')](handleError(_0x41a5ca,null));}; \ No newline at end of file +var _0x0235=['register','jayson/promise','client','http','request','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','reject','then','destroy','UserProfileResource','stack','name','index','ChatQueue','fieldName','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','VIRTUAL','filter','merge','options','includeAll','include','rows','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','ChatQueues','UserProfileSection','userProfileId','autoAssociation','update','describe','findOne','UserChatQueue','hasOwnProperty','pick','ChatQueueId','findAll','User','findAndCountAll','UserId','chatPause','createdAt','format','%s/%s','SIP','updatedAt','Team','getTeams','addTeams','ids','Agents','online','sequelize','findOrCreate','userChatQueue:save','removeTeams','field','tq.TeamId','join','ut.TeamId\x20=\x20tq.TeamId','push','toString','SELECT','every','includes','all','union','compact','value','transaction','isEmpty','removeAgents','emit','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./chatQueue.socket'];(function(_0x535643,_0x81225){var _0x44c6e5=function(_0x58603a){while(--_0x58603a){_0x535643['push'](_0x535643['shift']());}};_0x44c6e5(++_0x81225);}(_0x0235,0x77));var _0x5023=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x0235[_0x16d10f];return _0x50c823;};'use strict';var emlformat=require(_0x5023('0x0'));var rimraf=require(_0x5023('0x1'));var zipdir=require(_0x5023('0x2'));var jsonpatch=require(_0x5023('0x3'));var rp=require(_0x5023('0x4'));var moment=require(_0x5023('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5023('0x6'));var util=require(_0x5023('0x7'));var path=require('path');var sox=require(_0x5023('0x8'));var csv=require(_0x5023('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5023('0xa'));var _=require(_0x5023('0xb'));var squel=require('squel');var crypto=require(_0x5023('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5023('0xd'));var Redis=require(_0x5023('0xe'));var authService=require(_0x5023('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5023('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5023('0x11'))(_0x5023('0x12'));var utils=require(_0x5023('0x13'));var config=require(_0x5023('0x14'));var licenseUtil=require(_0x5023('0x15'));var db=require(_0x5023('0x16'))['db'];config['redis']=_[_0x5023('0x17')](config[_0x5023('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x5023('0x19'))(new Redis(config[_0x5023('0x18')]));require(_0x5023('0x1a'))[_0x5023('0x1b')](socket);var jayson=require(_0x5023('0x1c'));var client=jayson[_0x5023('0x1d')][_0x5023('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x445a34,_0x56e28d,_0x1de539,_0x3d75c4){return new BPromise(function(_0x2cae99,_0x14c1cc){var _0x1c7574=_0x3d75c4||client;return _0x1c7574[_0x5023('0x1f')](_0x445a34,_0x1de539)['then'](function(_0x1b5daa){logger['info'](_0x5023('0x20'),_0x56e28d,_0x5023('0x21'));logger[_0x5023('0x22')](_0x5023('0x23'),_0x56e28d,_0x5023('0x21'),JSON[_0x5023('0x24')](_0x1b5daa));if(_0x1b5daa[_0x5023('0x25')]){if(_0x1b5daa['error'][_0x5023('0x26')]===0x1f4){logger['error'](_0x5023('0x20'),_0x56e28d,_0x1b5daa[_0x5023('0x25')]['message']);return _0x14c1cc(_0x1b5daa[_0x5023('0x25')]['message']);}logger['error'](_0x5023('0x20'),_0x56e28d,_0x1b5daa[_0x5023('0x25')]['message']);return _0x2cae99(_0x1b5daa['error'][_0x5023('0x27')]);}else{logger['info'](_0x5023('0x20'),_0x56e28d,'request\x20sent');_0x2cae99(_0x1b5daa[_0x5023('0x28')][_0x5023('0x27')]);}})[_0x5023('0x29')](function(_0x51c00e){logger[_0x5023('0x25')]('ChatQueue,\x20%s,\x20%s',_0x56e28d,_0x51c00e);_0x14c1cc(_0x51c00e);});});}function respondWithStatusCode(_0x1282a3,_0x3d2481){_0x3d2481=_0x3d2481||0xcc;return function(_0x1ed535){if(_0x1ed535){return _0x1282a3[_0x5023('0x2a')](_0x3d2481);}return _0x1282a3['status'](_0x3d2481)[_0x5023('0x2b')]();};}function respondWithResult(_0x15fcaa,_0x1a6b19){_0x1a6b19=_0x1a6b19||0xc8;return function(_0x53f729){if(_0x53f729){return _0x15fcaa[_0x5023('0x2c')](_0x1a6b19)[_0x5023('0x2d')](_0x53f729);}};}function respondWithFilteredResult(_0x307d09,_0x5ab86a){return function(_0x45b85c){if(_0x45b85c){var _0x3bc02d=typeof _0x5ab86a[_0x5023('0x2e')]==='undefined'&&typeof _0x5ab86a['limit']===_0x5023('0x2f');var _0x574e09=_0x45b85c[_0x5023('0x30')];var _0x4e2535=_0x3bc02d?0x0:_0x5ab86a[_0x5023('0x2e')];var _0x3ffa31=_0x3bc02d?_0x45b85c[_0x5023('0x30')]:_0x5ab86a['offset']+_0x5ab86a[_0x5023('0x31')];var _0x494ad0;if(_0x3ffa31>=_0x574e09){_0x3ffa31=_0x574e09;_0x494ad0=0xc8;}else{_0x494ad0=0xce;}_0x307d09['status'](_0x494ad0);return _0x307d09['set'](_0x5023('0x32'),_0x4e2535+'-'+_0x3ffa31+'/'+_0x574e09)[_0x5023('0x2d')](_0x45b85c);}return null;};}function patchUpdates(_0x44f59c){return function(_0xf25b71){try{jsonpatch['apply'](_0xf25b71,_0x44f59c,!![]);}catch(_0x4aef06){return BPromise[_0x5023('0x33')](_0x4aef06);}return _0xf25b71['save']();};}function saveUpdates(_0xa359b4,_0x25fd31){return function(_0x1bcb8b){if(_0x1bcb8b){return _0x1bcb8b['update'](_0xa359b4)[_0x5023('0x34')](function(_0x29413c){return _0x29413c;});}return null;};}function removeEntity(_0x49dab6,_0x3bed60){return function(_0x104ce9){if(_0x104ce9){return _0x104ce9[_0x5023('0x35')]()[_0x5023('0x34')](function(){var _0x5d5d59=_0x104ce9['get']({'plain':!![]});var _0x49c112='ChatQueues';return db[_0x5023('0x36')]['destroy']({'where':{'type':_0x49c112,'resourceId':_0x5d5d59['id']}})[_0x5023('0x34')](function(){return _0x104ce9;});})[_0x5023('0x34')](function(){_0x49dab6['status'](0xcc)[_0x5023('0x2b')]();});}};}function handleEntityNotFound(_0x2b9cb5,_0x47d116){return function(_0x41cf8a){if(!_0x41cf8a){_0x2b9cb5[_0x5023('0x2a')](0x194);}return _0x41cf8a;};}function handleError(_0x5a43ed,_0x563916){_0x563916=_0x563916||0x1f4;return function(_0x41424d){logger[_0x5023('0x25')](_0x41424d[_0x5023('0x37')]);if(_0x41424d[_0x5023('0x38')]){delete _0x41424d[_0x5023('0x38')];}_0x5a43ed[_0x5023('0x2c')](_0x563916)['send'](_0x41424d);};}exports[_0x5023('0x39')]=function(_0x487dee,_0x35f0b0){var _0x49b81b={},_0x322979={},_0x85e909={'count':0x0,'rows':[]};var _0x27a221=_['map'](db[_0x5023('0x3a')]['rawAttributes'],function(_0x888414){return{'name':_0x888414[_0x5023('0x3b')],'type':_0x888414[_0x5023('0x3c')][_0x5023('0x3d')]};});_0x322979['model']=_[_0x5023('0x3e')](_0x27a221,_0x5023('0x38'));_0x322979['query']=_[_0x5023('0x3f')](_0x487dee[_0x5023('0x40')]);_0x322979[_0x5023('0x41')]=_[_0x5023('0x42')](_0x322979[_0x5023('0x43')],_0x322979[_0x5023('0x40')]);_0x49b81b[_0x5023('0x44')]=_[_0x5023('0x42')](_0x322979[_0x5023('0x43')],qs['fields'](_0x487dee[_0x5023('0x40')][_0x5023('0x45')]));_0x49b81b[_0x5023('0x44')]=_0x49b81b[_0x5023('0x44')][_0x5023('0x46')]?_0x49b81b[_0x5023('0x44')]:_0x322979[_0x5023('0x43')];if(!_0x487dee['query']['hasOwnProperty'](_0x5023('0x47'))){_0x49b81b[_0x5023('0x31')]=qs[_0x5023('0x31')](_0x487dee[_0x5023('0x40')]['limit']);_0x49b81b[_0x5023('0x2e')]=qs[_0x5023('0x2e')](_0x487dee['query']['offset']);}_0x49b81b[_0x5023('0x48')]=qs['sort'](_0x487dee[_0x5023('0x40')][_0x5023('0x49')]);_0x49b81b['where']=qs[_0x5023('0x41')](_['pick'](_0x487dee['query'],_0x322979[_0x5023('0x41')]),_0x27a221);if(_0x487dee[_0x5023('0x40')]['filter']){_0x49b81b[_0x5023('0x4a')]=_['merge'](_0x49b81b[_0x5023('0x4a')],{'$or':_[_0x5023('0x3e')](_0x27a221,function(_0xe247c1){if(_0xe247c1[_0x5023('0x3c')]!==_0x5023('0x4b')){var _0x78ff43={};_0x78ff43[_0xe247c1[_0x5023('0x38')]]={'$like':'%'+_0x487dee[_0x5023('0x40')][_0x5023('0x4c')]+'%'};return _0x78ff43;}})});}_0x49b81b=_[_0x5023('0x4d')]({},_0x49b81b,_0x487dee[_0x5023('0x4e')]);var _0x27e8bc={'where':_0x49b81b[_0x5023('0x4a')]};return db[_0x5023('0x3a')]['count'](_0x27e8bc)[_0x5023('0x34')](function(_0x179bc1){_0x85e909['count']=_0x179bc1;if(_0x487dee[_0x5023('0x40')][_0x5023('0x4f')]){_0x49b81b[_0x5023('0x50')]=[{'all':!![]}];}return db[_0x5023('0x3a')]['findAll'](_0x49b81b);})[_0x5023('0x34')](function(_0x52e5fc){_0x85e909[_0x5023('0x51')]=_0x52e5fc;return _0x85e909;})[_0x5023('0x34')](respondWithFilteredResult(_0x35f0b0,_0x49b81b))[_0x5023('0x29')](handleError(_0x35f0b0,null));};exports[_0x5023('0x52')]=function(_0x5260d7,_0x97bd07){var _0x178b87={'raw':!![],'where':{'id':_0x5260d7[_0x5023('0x53')]['id']}},_0x353822={};_0x353822[_0x5023('0x43')]=_['keys'](db[_0x5023('0x3a')][_0x5023('0x54')]);_0x353822[_0x5023('0x40')]=_[_0x5023('0x3f')](_0x5260d7[_0x5023('0x40')]);_0x353822['filters']=_[_0x5023('0x42')](_0x353822[_0x5023('0x43')],_0x353822[_0x5023('0x40')]);_0x178b87[_0x5023('0x44')]=_['intersection'](_0x353822['model'],qs[_0x5023('0x45')](_0x5260d7[_0x5023('0x40')]['fields']));_0x178b87[_0x5023('0x44')]=_0x178b87[_0x5023('0x44')]['length']?_0x178b87[_0x5023('0x44')]:_0x353822['model'];if(_0x5260d7[_0x5023('0x40')][_0x5023('0x4f')]){_0x178b87[_0x5023('0x50')]=[{'all':!![]}];}_0x178b87=_[_0x5023('0x4d')]({},_0x178b87,_0x5260d7['options']);return db[_0x5023('0x3a')][_0x5023('0x55')](_0x178b87)[_0x5023('0x34')](handleEntityNotFound(_0x97bd07,null))[_0x5023('0x34')](respondWithResult(_0x97bd07,null))[_0x5023('0x29')](handleError(_0x97bd07,null));};exports[_0x5023('0x56')]=function(_0x58830a,_0x2f8384){return db[_0x5023('0x3a')][_0x5023('0x56')](_0x58830a[_0x5023('0x57')],{})[_0x5023('0x34')](function(_0x22529a){var _0x1288d4=_0x58830a[_0x5023('0x58')]['get']({'plain':!![]});if(!_0x1288d4)throw new Error(_0x5023('0x59'));if(_0x1288d4[_0x5023('0x5a')]==='user'){var _0x2c8f54=_0x22529a[_0x5023('0x5b')]({'plain':!![]});var _0xf055fd=_0x5023('0x5c');return db[_0x5023('0x5d')][_0x5023('0x55')]({'where':{'name':_0xf055fd,'userProfileId':_0x1288d4[_0x5023('0x5e')]},'raw':!![]})[_0x5023('0x34')](function(_0x26af6d){if(_0x26af6d&&_0x26af6d[_0x5023('0x5f')]===0x0){return db[_0x5023('0x36')][_0x5023('0x56')]({'name':_0x2c8f54[_0x5023('0x38')],'resourceId':_0x2c8f54['id'],'type':_0x26af6d[_0x5023('0x38')],'sectionId':_0x26af6d['id']},{})[_0x5023('0x34')](function(){return _0x22529a;});}else{return _0x22529a;}})[_0x5023('0x29')](function(_0x568178){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x568178);throw _0x568178;});}return _0x22529a;})['then'](respondWithResult(_0x2f8384,0xc9))['catch'](handleError(_0x2f8384,null));};exports[_0x5023('0x60')]=function(_0x5d7c3a,_0x161fad){if(_0x5d7c3a[_0x5023('0x57')]['id']){delete _0x5d7c3a[_0x5023('0x57')]['id'];}return db[_0x5023('0x3a')][_0x5023('0x55')]({'where':{'id':_0x5d7c3a[_0x5023('0x53')]['id']}})[_0x5023('0x34')](handleEntityNotFound(_0x161fad,null))['then'](saveUpdates(_0x5d7c3a['body'],null))[_0x5023('0x34')](respondWithResult(_0x161fad,null))['catch'](handleError(_0x161fad,null));};exports[_0x5023('0x35')]=function(_0x15b218,_0x4473af){return db['ChatQueue'][_0x5023('0x55')]({'where':{'id':_0x15b218['params']['id']}})[_0x5023('0x34')](handleEntityNotFound(_0x4473af,null))[_0x5023('0x34')](removeEntity(_0x4473af,null))[_0x5023('0x29')](handleError(_0x4473af,null));};exports[_0x5023('0x61')]=function(_0x45ad88,_0x111508){return db[_0x5023('0x3a')][_0x5023('0x61')]()['then'](respondWithResult(_0x111508,null))[_0x5023('0x29')](handleError(_0x111508,null));};exports['getMembers']=function(_0x21bda,_0x4a5898,_0x11c06e){var _0x3d0454={'raw':!![],'where':{}},_0x35567d={},_0x65dc8;return db[_0x5023('0x3a')][_0x5023('0x62')]({'where':{'id':_0x21bda[_0x5023('0x53')]['id']}})[_0x5023('0x34')](handleEntityNotFound(_0x4a5898,null))[_0x5023('0x34')](function(_0x205dd8){if(_0x205dd8){_0x65dc8=_0x205dd8[_0x5023('0x5b')]({'plain':!![]});_0x35567d[_0x5023('0x43')]=_[_0x5023('0x3f')](db[_0x5023('0x63')][_0x5023('0x54')]);_0x35567d[_0x5023('0x40')]=_[_0x5023('0x3f')](_0x21bda[_0x5023('0x40')]);_0x35567d['filters']=_[_0x5023('0x42')](_0x35567d[_0x5023('0x43')],_0x35567d[_0x5023('0x40')]);_0x3d0454[_0x5023('0x44')]=_['intersection'](_0x35567d[_0x5023('0x43')],qs[_0x5023('0x45')](_0x21bda[_0x5023('0x40')][_0x5023('0x45')]));_0x3d0454[_0x5023('0x44')]=_0x3d0454[_0x5023('0x44')][_0x5023('0x46')]?_0x3d0454[_0x5023('0x44')]:_0x35567d[_0x5023('0x43')];if(!_0x21bda[_0x5023('0x40')][_0x5023('0x64')](_0x5023('0x47'))){_0x3d0454['limit']=qs[_0x5023('0x31')](_0x21bda[_0x5023('0x40')][_0x5023('0x31')]);_0x3d0454[_0x5023('0x2e')]=qs[_0x5023('0x2e')](_0x21bda[_0x5023('0x40')][_0x5023('0x2e')]);}_0x3d0454['order']=qs[_0x5023('0x49')](_0x21bda[_0x5023('0x40')][_0x5023('0x49')]);_0x3d0454[_0x5023('0x4a')]=qs['filters'](_[_0x5023('0x65')](_0x21bda[_0x5023('0x40')],_0x35567d[_0x5023('0x41')]));_0x3d0454[_0x5023('0x4a')][_0x5023('0x66')]=_0x205dd8['id'];if(_0x21bda[_0x5023('0x40')][_0x5023('0x4c')]){_0x3d0454['where']=_['merge'](_0x3d0454[_0x5023('0x4a')],{'$or':_[_0x5023('0x3e')](_0x3d0454[_0x5023('0x44')],function(_0x54a717){var _0x4b64f0={};_0x4b64f0[_0x54a717]={'$like':'%'+_0x21bda[_0x5023('0x40')][_0x5023('0x4c')]+'%'};return _0x4b64f0;})});}_0x3d0454=_[_0x5023('0x4d')]({},_0x3d0454,_0x21bda[_0x5023('0x4e')]);return db[_0x5023('0x63')][_0x5023('0x67')](_0x3d0454);}})[_0x5023('0x34')](function(_0x11b547){if(_0x11b547){return db[_0x5023('0x68')][_0x5023('0x69')]({'where':{'id':_['map'](_0x11b547,_0x5023('0x6a')),'role':'agent'},'attributes':['id','name',_0x5023('0x6b'),'updatedAt',_0x5023('0x6c')]});}})['then'](function(_0x184030){if(_0x184030){return{'count':_0x184030[_0x5023('0x30')],'rows':_[_0x5023('0x3e')](_0x184030['rows'],function(_0x20186d){return{'membername':_0x20186d[_0x5023('0x38')],'UserId':_0x20186d['id'],'queue_name':_0x65dc8[_0x5023('0x38')],'ChatQueueId':_0x65dc8['id'],'interface':util[_0x5023('0x6d')](_0x5023('0x6e'),_0x5023('0x6f'),_0x20186d[_0x5023('0x38')]),'penalty':0x0,'paused':_0x20186d[_0x5023('0x6b')],'createdAt':_0x20186d['createdAt'],'updatedAt':_0x20186d[_0x5023('0x70')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4a5898,_0x3d0454))[_0x5023('0x29')](handleError(_0x4a5898,null));};exports['getTeams']=function(_0x20b7aa,_0xe70a39,_0x269eed){var _0x55535c={};var _0x2a00ce={};var _0x2d2135;var _0x43c9ee;return db['ChatQueue']['findOne']({'where':{'id':_0x20b7aa[_0x5023('0x53')]['id']}})[_0x5023('0x34')](handleEntityNotFound(_0xe70a39,null))[_0x5023('0x34')](function(_0x463a6c){if(_0x463a6c){_0x2d2135=_0x463a6c;_0x2a00ce[_0x5023('0x43')]=_[_0x5023('0x3f')](db[_0x5023('0x71')][_0x5023('0x54')]);_0x2a00ce[_0x5023('0x40')]=_['keys'](_0x20b7aa[_0x5023('0x40')]);_0x2a00ce['filters']=_[_0x5023('0x42')](_0x2a00ce['model'],_0x2a00ce[_0x5023('0x40')]);_0x55535c[_0x5023('0x44')]=_['intersection'](_0x2a00ce[_0x5023('0x43')],qs[_0x5023('0x45')](_0x20b7aa[_0x5023('0x40')]['fields']));_0x55535c[_0x5023('0x44')]=_0x55535c[_0x5023('0x44')][_0x5023('0x46')]?_0x55535c[_0x5023('0x44')]:_0x2a00ce[_0x5023('0x43')];_0x55535c[_0x5023('0x48')]=qs[_0x5023('0x49')](_0x20b7aa[_0x5023('0x40')]['sort']);_0x55535c[_0x5023('0x4a')]=qs['filters'](_[_0x5023('0x65')](_0x20b7aa[_0x5023('0x40')],_0x2a00ce[_0x5023('0x41')]));if(_0x20b7aa['query']['filter']){_0x55535c[_0x5023('0x4a')]=_[_0x5023('0x4d')](_0x55535c[_0x5023('0x4a')],{'$or':_[_0x5023('0x3e')](_0x55535c[_0x5023('0x44')],function(_0x57e7a4){var _0x9e1910={};_0x9e1910[_0x57e7a4]={'$like':'%'+_0x20b7aa[_0x5023('0x40')][_0x5023('0x4c')]+'%'};return _0x9e1910;})});}_0x55535c=_['merge']({},_0x55535c,_0x20b7aa['options']);return _0x2d2135[_0x5023('0x72')](_0x55535c);}})['then'](function(_0x4e312c){if(_0x4e312c){_0x43c9ee=_0x4e312c[_0x5023('0x46')];if(!_0x20b7aa[_0x5023('0x40')][_0x5023('0x64')](_0x5023('0x47'))){_0x55535c[_0x5023('0x31')]=qs[_0x5023('0x31')](_0x20b7aa['query'][_0x5023('0x31')]);_0x55535c[_0x5023('0x2e')]=qs['offset'](_0x20b7aa[_0x5023('0x40')][_0x5023('0x2e')]);}return _0x2d2135[_0x5023('0x72')](_0x55535c);}})[_0x5023('0x34')](function(_0x32a59c){if(_0x32a59c){return _0x32a59c?{'count':_0x43c9ee,'rows':_0x32a59c}:null;}})[_0x5023('0x34')](respondWithResult(_0xe70a39,null))[_0x5023('0x29')](handleError(_0xe70a39,null));};exports[_0x5023('0x73')]=function(_0x45f291,_0x1ef1f4,_0x42ae4f){var _0x35769f=_0x45f291[_0x5023('0x57')][_0x5023('0x74')];return db['Team'][_0x5023('0x67')]({'where':{'id':_0x35769f},'attributes':['id'],'include':[{'model':db[_0x5023('0x68')],'as':_0x5023('0x75'),'attributes':['id','name',_0x5023('0x76'),'voicePause','interface'],'raw':!![]}]})[_0x5023('0x34')](function(_0x5ea891){if(_0x5ea891){var _0x370446=_['flatMap'](_0x5ea891,function(_0x354d7f){var _0xe97fba=_0x354d7f[_0x5023('0x5b')]({'plain':!![]});return _0xe97fba[_0x5023('0x75')];});return db[_0x5023('0x3a')][_0x5023('0x55')]({'where':{'id':_0x45f291[_0x5023('0x53')]['id']}})[_0x5023('0x34')](function(_0x1c001e){return db[_0x5023('0x77')]['transaction'](function(_0x5e4ae3){return _0x1c001e[_0x5023('0x73')](_0x35769f,{'transaction':_0x5e4ae3})[_0x5023('0x34')](function(){return BPromise['each'](_0x370446,function(_0x4ced8f){return db[_0x5023('0x63')][_0x5023('0x78')]({'where':{'UserId':_0x4ced8f['id'],'ChatQueueId':_0x45f291[_0x5023('0x53')]['id']},'transaction':_0x5e4ae3});});})[_0x5023('0x34')](function(){_0x370446['forEach'](function(_0x529924){socket['emit'](_0x5023('0x79'),{'UserId':_0x529924['id'],'ChatQueueId':_0x1c001e['id']});});});});});}})[_0x5023('0x34')](respondWithStatusCode(_0x1ef1f4,null))[_0x5023('0x29')](handleError(_0x1ef1f4,null));};exports[_0x5023('0x7a')]=function(_0xb11635,_0x42d904,_0x487007){return db[_0x5023('0x71')][_0x5023('0x67')]({'where':{'id':_0xb11635[_0x5023('0x40')]['ids']},'attributes':['id'],'include':[{'model':db[_0x5023('0x68')],'as':_0x5023('0x75'),'attributes':['id'],'raw':!![]}]})[_0x5023('0x34')](handleEntityNotFound(_0x42d904,null))[_0x5023('0x34')](function(_0x596183){var _0x48b180=_['map'](_0x596183,'id');var _0x553dfe=[];var _0x4d7f24=[];var _0x33c21c=squel['select']();_0x33c21c[_0x5023('0x7b')](_0x5023('0x7c'))['from']('team_has_chat_queues','tq')[_0x5023('0x7d')]('user_has_teams','ut',_0x5023('0x7e'))[_0x5023('0x4a')]('ChatQueueId\x20=\x20?',_0xb11635[_0x5023('0x53')]['id']);for(var _0x5c0c38=0x0;_0x5c0c38<_0x596183[_0x5023('0x46')];_0x5c0c38+=0x1){let _0x505140=_0x596183[_0x5c0c38];for(var _0x2f9dab=0x0;_0x2f9dab<_0x505140['Agents']['length'];_0x2f9dab+=0x1){let _0x19c0d0=_0x505140[_0x5023('0x75')][_0x2f9dab];var _0x280e02=_0x33c21c['clone']();_0x280e02[_0x5023('0x4a')]('ut.UserId\x20=\x20?',_0x19c0d0['id']);_0x4d7f24[_0x5023('0x7f')](db['sequelize'][_0x5023('0x40')](_0x280e02[_0x5023('0x80')](),{'type':db['sequelize']['QueryTypes'][_0x5023('0x81')]})[_0x5023('0x34')](function(_0x55062f){if(_0x55062f[_0x5023('0x46')]===0x1){return _0x19c0d0['id'];}else{var _0x80f652=_[_0x5023('0x82')](_[_0x5023('0x3e')](_0x55062f,'TeamId'),function(_0x32838f){return _[_0x5023('0x83')](_0x48b180,_0x32838f);});if(_0x80f652){return _0x19c0d0['id'];}}}));}}return BPromise[_0x5023('0x84')](_0x4d7f24)[_0x5023('0x34')](function(_0x51e03e){_0x553dfe=_(_0x553dfe)[_0x5023('0x85')](_0x51e03e)[_0x5023('0x86')]()[_0x5023('0x87')]();return db[_0x5023('0x3a')][_0x5023('0x55')]({'where':{'id':_0xb11635[_0x5023('0x53')]['id']}})[_0x5023('0x34')](function(_0x491161){return db[_0x5023('0x77')][_0x5023('0x88')](function(_0x42eb9c){return _0x491161[_0x5023('0x7a')](_0xb11635[_0x5023('0x40')][_0x5023('0x74')],{'transaction':_0x42eb9c})['then'](function(){if(!_[_0x5023('0x89')](_0x553dfe)){return _0x491161[_0x5023('0x8a')](_0x553dfe,{'transaction':_0x42eb9c});}})['then'](function(){_0x553dfe['forEach'](function(_0x1f055d){socket[_0x5023('0x8b')](_0x5023('0x8c'),{'UserId':_0x1f055d,'ChatQueueId':_0x491161['id']});});});});});});})[_0x5023('0x34')](respondWithStatusCode(_0x42d904,null))[_0x5023('0x29')](handleError(_0x42d904,null));};exports[_0x5023('0x8d')]=function(_0x2632f6,_0x134340,_0x21a7ee){return db[_0x5023('0x3a')]['find']({'where':{'id':_0x2632f6['params']['id']}})[_0x5023('0x34')](handleEntityNotFound(_0x134340,null))[_0x5023('0x34')](function(_0x31900a){if(_0x31900a){return _0x31900a['addAgents'](_0x2632f6[_0x5023('0x57')][_0x5023('0x74')],_[_0x5023('0x8e')](_0x2632f6['body'],['ids','id'])||{})[_0x5023('0x8f')](function(_0x4198a0){for(var _0x5329f6=0x0;_0x5329f6<_0x2632f6[_0x5023('0x57')][_0x5023('0x74')][_0x5023('0x46')];_0x5329f6+=0x1){socket['emit'](_0x5023('0x79'),{'UserId':Number(_0x2632f6[_0x5023('0x57')][_0x5023('0x74')][_0x5329f6]),'ChatQueueId':Number(_0x2632f6['params']['id'])});}return _0x4198a0;});}})[_0x5023('0x34')](respondWithResult(_0x134340,null))[_0x5023('0x29')](handleError(_0x134340,null));};exports[_0x5023('0x8a')]=function(_0x4eace6,_0x185f71,_0x54f3d5){return db[_0x5023('0x3a')][_0x5023('0x55')]({'where':{'id':_0x4eace6[_0x5023('0x53')]['id']}})[_0x5023('0x34')](handleEntityNotFound(_0x185f71,null))[_0x5023('0x34')](function(_0x21112e){if(_0x21112e){return _0x21112e[_0x5023('0x8a')](_0x4eace6['query'][_0x5023('0x74')])[_0x5023('0x34')](function(){if(_[_0x5023('0x90')](_0x4eace6['query'][_0x5023('0x74')])){for(var _0x1a2556=0x0;_0x1a2556<_0x4eace6[_0x5023('0x40')][_0x5023('0x74')]['length'];_0x1a2556+=0x1){socket['emit'](_0x5023('0x8c'),{'UserId':Number(_0x4eace6['query'][_0x5023('0x74')][_0x1a2556]),'ChatQueueId':Number(_0x4eace6[_0x5023('0x53')]['id'])});}}else{socket[_0x5023('0x8b')](_0x5023('0x8c'),{'UserId':Number(_0x4eace6['query'][_0x5023('0x74')]),'ChatQueueId':Number(_0x4eace6[_0x5023('0x53')]['id'])});}});}})['then'](respondWithStatusCode(_0x185f71,null))[_0x5023('0x29')](handleError(_0x185f71,null));};exports['getAgents']=function(_0x5c4a10,_0x4b896c,_0x15a27b){var _0x3ed55b={};var _0x3411a9={};var _0x161d5a;var _0x194ed3;return db[_0x5023('0x3a')][_0x5023('0x62')]({'where':{'id':_0x5c4a10[_0x5023('0x53')]['id']}})['then'](handleEntityNotFound(_0x4b896c,null))['then'](function(_0x2947b9){if(_0x2947b9){_0x161d5a=_0x2947b9;_0x3411a9[_0x5023('0x43')]=_[_0x5023('0x3f')](db[_0x5023('0x68')]['rawAttributes']);_0x3411a9[_0x5023('0x40')]=_[_0x5023('0x3f')](_0x5c4a10[_0x5023('0x40')]);_0x3411a9['filters']=_['intersection'](_0x3411a9[_0x5023('0x43')],_0x3411a9['query']);_0x3ed55b[_0x5023('0x44')]=_[_0x5023('0x42')](_0x3411a9['model'],qs[_0x5023('0x45')](_0x5c4a10[_0x5023('0x40')][_0x5023('0x45')]));_0x3ed55b[_0x5023('0x44')]=_0x3ed55b[_0x5023('0x44')][_0x5023('0x46')]?_0x3ed55b['attributes']:_0x3411a9[_0x5023('0x43')];_0x3ed55b[_0x5023('0x48')]=qs[_0x5023('0x49')](_0x5c4a10[_0x5023('0x40')][_0x5023('0x49')]);_0x3ed55b[_0x5023('0x4a')]=qs[_0x5023('0x41')](_[_0x5023('0x65')](_0x5c4a10[_0x5023('0x40')],_0x3411a9[_0x5023('0x41')]));if(_0x5c4a10['query'][_0x5023('0x4c')]){_0x3ed55b['where']=_[_0x5023('0x4d')](_0x3ed55b['where'],{'$or':_['map'](_0x3ed55b[_0x5023('0x44')],function(_0x19eafa){var _0x22957e={};_0x22957e[_0x19eafa]={'$like':'%'+_0x5c4a10[_0x5023('0x40')]['filter']+'%'};return _0x22957e;})});}_0x3ed55b=_[_0x5023('0x4d')]({},_0x3ed55b,_0x5c4a10['options']);return _0x161d5a[_0x5023('0x91')](_0x3ed55b);}})[_0x5023('0x34')](function(_0x329c08){if(_0x329c08){_0x194ed3=_0x329c08[_0x5023('0x46')];if(!_0x5c4a10[_0x5023('0x40')][_0x5023('0x64')](_0x5023('0x47'))){_0x3ed55b[_0x5023('0x31')]=qs[_0x5023('0x31')](_0x5c4a10['query']['limit']);_0x3ed55b[_0x5023('0x2e')]=qs[_0x5023('0x2e')](_0x5c4a10[_0x5023('0x40')][_0x5023('0x2e')]);}return _0x161d5a[_0x5023('0x91')](_0x3ed55b);}})[_0x5023('0x34')](function(_0x3cec82){if(_0x3cec82){return _0x3cec82?{'count':_0x194ed3,'rows':_0x3cec82}:null;}})[_0x5023('0x34')](respondWithResult(_0x4b896c,null))[_0x5023('0x29')](handleError(_0x4b896c,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 02f57ef..29b0ba8 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 _0x13a0=['hasOwnProperty','exports','events','ChatQueue','update','remove','emit'];(function(_0x387334,_0x2c6b6e){var _0x38b481=function(_0x255842){while(--_0x255842){_0x387334['push'](_0x387334['shift']());}};_0x38b481(++_0x2c6b6e);}(_0x13a0,0x128));var _0x013a=function(_0x23da4d,_0x63498c){_0x23da4d=_0x23da4d-0x0;var _0x4ae55=_0x13a0[_0x23da4d];return _0x4ae55;};'use strict';var EventEmitter=require(_0x013a('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x013a('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x013a('0x2'),'afterDestroy':_0x013a('0x3')};function emitEvent(_0x3ce224){return function(_0x683ce0,_0xc7604,_0x181551){ChatQueueEvents[_0x013a('0x4')](_0x3ce224+':'+_0x683ce0['id'],_0x683ce0);ChatQueueEvents[_0x013a('0x4')](_0x3ce224,_0x683ce0);_0x181551(null);};}for(var e in events){if(events[_0x013a('0x5')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x013a('0x6')]=ChatQueueEvents; \ No newline at end of file +var _0x7ec2=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue'];(function(_0x296923,_0x4adaed){var _0x29af70=function(_0x4eeedb){while(--_0x4eeedb){_0x296923['push'](_0x296923['shift']());}};_0x29af70(++_0x4adaed);}(_0x7ec2,0x15c));var _0x27ec=function(_0x5c4311,_0x5da2d5){_0x5c4311=_0x5c4311-0x0;var _0x46bc6b=_0x7ec2[_0x5c4311];return _0x46bc6b;};'use strict';var EventEmitter=require(_0x27ec('0x0'));var ChatQueue=require(_0x27ec('0x1'))['db'][_0x27ec('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x27ec('0x3'),'afterUpdate':_0x27ec('0x4'),'afterDestroy':'remove'};function emitEvent(_0x45b293){return function(_0x340231,_0x3e1120,_0x39badf){ChatQueueEvents[_0x27ec('0x5')](_0x45b293+':'+_0x340231['id'],_0x340231);ChatQueueEvents[_0x27ec('0x5')](_0x45b293,_0x340231);_0x39badf(null);};}for(var e in events){if(events[_0x27ec('0x6')](e)){var event=events[e];ChatQueue[_0x27ec('0x7')](e,emitEvent(event));}}module[_0x27ec('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 0d329ea..2b055f9 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 _0xbe71=['request-promise','path','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util','api','moment','bluebird'];(function(_0x1d7efb,_0x11d3fd){var _0x435535=function(_0x176f54){while(--_0x176f54){_0x1d7efb['push'](_0x1d7efb['shift']());}};_0x435535(++_0x11d3fd);}(_0xbe71,0x1e7));var _0x1be7=function(_0x4830ea,_0x147ef1){_0x4830ea=_0x4830ea-0x0;var _0x5d986b=_0xbe71[_0x4830ea];return _0x5d986b;};'use strict';var _=require(_0x1be7('0x0'));var util=require(_0x1be7('0x1'));var logger=require('../../config/logger')(_0x1be7('0x2'));var moment=require(_0x1be7('0x3'));var BPromise=require(_0x1be7('0x4'));var rp=require(_0x1be7('0x5'));var fs=require('fs');var path=require(_0x1be7('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1be7('0x7'));module[_0x1be7('0x8')]=function(_0x2a9635,_0x55bb7b){return _0x2a9635[_0x1be7('0x9')](_0x1be7('0xa'),attributes,{'tableName':_0x1be7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a49=['request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','define','lodash','api','moment','bluebird'];(function(_0x261b8a,_0x553ec4){var _0x3455e8=function(_0xdf10d4){while(--_0xdf10d4){_0x261b8a['push'](_0x261b8a['shift']());}};_0x3455e8(++_0x553ec4);}(_0x2a49,0x1c8));var _0x92a4=function(_0x56ed85,_0x3c9de6){_0x56ed85=_0x56ed85-0x0;var _0x5a375=_0x2a49[_0x56ed85];return _0x5a375;};'use strict';var _=require(_0x92a4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x92a4('0x1'));var moment=require(_0x92a4('0x2'));var BPromise=require(_0x92a4('0x3'));var rp=require(_0x92a4('0x4'));var fs=require('fs');var path=require(_0x92a4('0x5'));var rimraf=require(_0x92a4('0x6'));var config=require(_0x92a4('0x7'));var attributes=require(_0x92a4('0x8'));module['exports']=function(_0x2e5ff5,_0x3501c8){return _0x2e5ff5[_0x92a4('0x9')]('ChatQueue',attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index e89cc0f..758f30e 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 _0xaa56=['../../config/utils','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','GetChatQueue','options','attributes','limit','include','map','model','ShowChatQueue','ChatQueue','where','util','moment','randomstring','ioredis'];(function(_0x1195ed,_0xc5857e){var _0x26e1a6=function(_0x36232c){while(--_0x36232c){_0x1195ed['push'](_0x1195ed['shift']());}};_0x26e1a6(++_0xc5857e);}(_0xaa56,0x1ac));var _0x6aa5=function(_0x3e20bf,_0x137dc7){_0x3e20bf=_0x3e20bf-0x0;var _0x59a75b=_0xaa56[_0x3e20bf];return _0x59a75b;};'use strict';var _=require('lodash');var util=require(_0x6aa5('0x0'));var moment=require(_0x6aa5('0x1'));var BPromise=require('bluebird');var rs=require(_0x6aa5('0x2'));var fs=require('fs');var Redis=require(_0x6aa5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6aa5('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x6aa5('0x5'));var jayson=require(_0x6aa5('0x6'));var client=jayson[_0x6aa5('0x7')][_0x6aa5('0x8')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x6aa5('0x9'),'port':0x18eb});var socket=require(_0x6aa5('0xa'))(new Redis(config['redis']));require(_0x6aa5('0xb'))[_0x6aa5('0xc')](socket);function respondWithRpcPromise(_0x268e07,_0xe703f1,_0x24e44c){return new BPromise(function(_0x2c689f,_0x17c0df){return client[_0x6aa5('0xd')](_0x268e07,_0x24e44c)[_0x6aa5('0xe')](function(_0x643691){logger[_0x6aa5('0xf')]('ChatQueue,\x20%s,\x20%s',_0xe703f1,_0x6aa5('0x10'));logger[_0x6aa5('0x11')](_0x6aa5('0x12'),_0xe703f1,'request\x20sent',JSON[_0x6aa5('0x13')](_0x643691));if(_0x643691[_0x6aa5('0x14')]){if(_0x643691[_0x6aa5('0x14')][_0x6aa5('0x15')]===0x1f4){logger[_0x6aa5('0x14')](_0x6aa5('0x16'),_0xe703f1,_0x643691[_0x6aa5('0x14')][_0x6aa5('0x17')]);return _0x17c0df(_0x643691[_0x6aa5('0x14')]['message']);}logger[_0x6aa5('0x14')]('ChatQueue,\x20%s,\x20%s',_0xe703f1,_0x643691[_0x6aa5('0x14')][_0x6aa5('0x17')]);return _0x2c689f(_0x643691['error'][_0x6aa5('0x17')]);}else{logger[_0x6aa5('0xf')]('ChatQueue,\x20%s,\x20%s',_0xe703f1,_0x6aa5('0x10'));_0x2c689f(_0x643691[_0x6aa5('0x18')][_0x6aa5('0x17')]);}})[_0x6aa5('0x19')](function(_0x2fded3){logger['error'](_0x6aa5('0x16'),_0xe703f1,_0x2fded3);_0x17c0df(_0x2fded3);});});}exports[_0x6aa5('0x1a')]=function(_0x1f6458){var _0x1e0b1a=this;return new Promise(function(_0xd80c38,_0x1c1a91){return db['ChatQueue']['findAll']({'raw':_0x1f6458['options']?_0x1f6458[_0x6aa5('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1f6458[_0x6aa5('0x1b')]?_0x1f6458[_0x6aa5('0x1b')]['where']||null:null,'attributes':_0x1f6458[_0x6aa5('0x1b')]?_0x1f6458[_0x6aa5('0x1b')][_0x6aa5('0x1c')]||null:null,'limit':_0x1f6458[_0x6aa5('0x1b')]?_0x1f6458['options'][_0x6aa5('0x1d')]||null:null,'include':_0x1f6458[_0x6aa5('0x1b')]?_0x1f6458[_0x6aa5('0x1b')][_0x6aa5('0x1e')]?_[_0x6aa5('0x1f')](_0x1f6458[_0x6aa5('0x1b')][_0x6aa5('0x1e')],function(_0x132f13){return{'model':db[_0x132f13['model']],'as':_0x132f13['as'],'attributes':_0x132f13['attributes'],'include':_0x132f13[_0x6aa5('0x1e')]?_[_0x6aa5('0x1f')](_0x132f13['include'],function(_0x563805){return{'model':db[_0x563805[_0x6aa5('0x20')]],'as':_0x563805['as'],'attributes':_0x563805['attributes'],'include':_0x563805[_0x6aa5('0x1e')]?_[_0x6aa5('0x1f')](_0x563805[_0x6aa5('0x1e')],function(_0x482e8f){return{'model':db[_0x482e8f[_0x6aa5('0x20')]],'as':_0x482e8f['as'],'attributes':_0x482e8f[_0x6aa5('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ca2a3){logger[_0x6aa5('0xf')](_0x6aa5('0x1a'),_0x1f6458);logger[_0x6aa5('0x11')](_0x6aa5('0x1a'),_0x1f6458,JSON[_0x6aa5('0x13')](_0x2ca2a3));_0xd80c38(_0x2ca2a3);})[_0x6aa5('0x19')](function(_0x2f4952){logger[_0x6aa5('0x14')](_0x6aa5('0x1a'),_0x2f4952[_0x6aa5('0x17')],_0x1f6458);_0x1c1a91(_0x1e0b1a[_0x6aa5('0x14')](0x1f4,_0x2f4952[_0x6aa5('0x17')]));});});};exports[_0x6aa5('0x21')]=function(_0x44bf86){var _0x263e1e=this;return new Promise(function(_0x40e3c7,_0x5d2669){return db[_0x6aa5('0x22')]['find']({'raw':_0x44bf86[_0x6aa5('0x1b')]?_0x44bf86[_0x6aa5('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x44bf86[_0x6aa5('0x1b')]?_0x44bf86[_0x6aa5('0x1b')][_0x6aa5('0x23')]||null:null,'attributes':_0x44bf86[_0x6aa5('0x1b')]?_0x44bf86[_0x6aa5('0x1b')][_0x6aa5('0x1c')]||null:null,'include':_0x44bf86['options']?_0x44bf86['options'][_0x6aa5('0x1e')]?_[_0x6aa5('0x1f')](_0x44bf86['options'][_0x6aa5('0x1e')],function(_0x9e3915){return{'model':db[_0x9e3915[_0x6aa5('0x20')]],'as':_0x9e3915['as'],'attributes':_0x9e3915[_0x6aa5('0x1c')],'include':_0x9e3915[_0x6aa5('0x1e')]?_[_0x6aa5('0x1f')](_0x9e3915['include'],function(_0x52a091){return{'model':db[_0x52a091[_0x6aa5('0x20')]],'as':_0x52a091['as'],'attributes':_0x52a091[_0x6aa5('0x1c')],'include':_0x52a091['include']?_['map'](_0x52a091['include'],function(_0x4d8494){return{'model':db[_0x4d8494[_0x6aa5('0x20')]],'as':_0x4d8494['as'],'attributes':_0x4d8494[_0x6aa5('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6aa5('0xe')](function(_0x15aa86){logger[_0x6aa5('0xf')](_0x6aa5('0x21'),_0x44bf86);logger[_0x6aa5('0x11')](_0x6aa5('0x21'),_0x44bf86,JSON[_0x6aa5('0x13')](_0x15aa86));_0x40e3c7(_0x15aa86);})[_0x6aa5('0x19')](function(_0x262558){logger[_0x6aa5('0x14')](_0x6aa5('0x21'),_0x262558['message'],_0x44bf86);_0x5d2669(_0x263e1e[_0x6aa5('0x14')](0x1f4,_0x262558['message']));});});}; \ No newline at end of file +var _0x1410=['findAll','options','raw','where','attributes','limit','include','map','model','GetChatQueue','stringify','find','then','ShowChatQueue','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatQueue.socket','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','ChatQueue'];(function(_0x1ff60d,_0x2d5f5a){var _0x3102c0=function(_0x323aa9){while(--_0x323aa9){_0x1ff60d['push'](_0x1ff60d['shift']());}};_0x3102c0(++_0x2d5f5a);}(_0x1410,0x19e));var _0x0141=function(_0x3b70ae,_0x34fef0){_0x3b70ae=_0x3b70ae-0x0;var _0x56a0a7=_0x1410[_0x3b70ae];return _0x56a0a7;};'use strict';var _=require(_0x0141('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0141('0x1'));var rs=require(_0x0141('0x2'));var fs=require('fs');var Redis=require(_0x0141('0x3'));var db=require(_0x0141('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0141('0x5'))(_0x0141('0x6'));var config=require(_0x0141('0x7'));var jayson=require(_0x0141('0x8'));var client=jayson[_0x0141('0x9')][_0x0141('0xa')]({'port':0x232a});config[_0x0141('0xb')]=_[_0x0141('0xc')](config[_0x0141('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x0141('0xd'))(new Redis(config[_0x0141('0xb')]));require(_0x0141('0xe'))['register'](socket);function respondWithRpcPromise(_0x318fb4,_0x1571a2,_0x9127d8){return new BPromise(function(_0x5f3884,_0x263d78){return client[_0x0141('0xf')](_0x318fb4,_0x9127d8)['then'](function(_0x24424a){logger[_0x0141('0x10')](_0x0141('0x11'),_0x1571a2,_0x0141('0x12'));logger[_0x0141('0x13')](_0x0141('0x14'),_0x1571a2,_0x0141('0x12'),JSON['stringify'](_0x24424a));if(_0x24424a['error']){if(_0x24424a['error']['code']===0x1f4){logger[_0x0141('0x15')](_0x0141('0x11'),_0x1571a2,_0x24424a[_0x0141('0x15')][_0x0141('0x16')]);return _0x263d78(_0x24424a[_0x0141('0x15')][_0x0141('0x16')]);}logger[_0x0141('0x15')](_0x0141('0x11'),_0x1571a2,_0x24424a['error']['message']);return _0x5f3884(_0x24424a[_0x0141('0x15')]['message']);}else{logger[_0x0141('0x10')](_0x0141('0x11'),_0x1571a2,_0x0141('0x12'));_0x5f3884(_0x24424a[_0x0141('0x17')]['message']);}})[_0x0141('0x18')](function(_0x31946f){logger['error'](_0x0141('0x11'),_0x1571a2,_0x31946f);_0x263d78(_0x31946f);});});}exports['GetChatQueue']=function(_0x5b372e){var _0x2398d5=this;return new Promise(function(_0xda0da,_0x25a49c){return db[_0x0141('0x19')][_0x0141('0x1a')]({'raw':_0x5b372e[_0x0141('0x1b')]?_0x5b372e[_0x0141('0x1b')][_0x0141('0x1c')]===undefined?!![]:![]:!![],'where':_0x5b372e[_0x0141('0x1b')]?_0x5b372e[_0x0141('0x1b')][_0x0141('0x1d')]||null:null,'attributes':_0x5b372e[_0x0141('0x1b')]?_0x5b372e[_0x0141('0x1b')][_0x0141('0x1e')]||null:null,'limit':_0x5b372e['options']?_0x5b372e[_0x0141('0x1b')][_0x0141('0x1f')]||null:null,'include':_0x5b372e[_0x0141('0x1b')]?_0x5b372e[_0x0141('0x1b')][_0x0141('0x20')]?_[_0x0141('0x21')](_0x5b372e[_0x0141('0x1b')]['include'],function(_0x3bc4fc){return{'model':db[_0x3bc4fc[_0x0141('0x22')]],'as':_0x3bc4fc['as'],'attributes':_0x3bc4fc[_0x0141('0x1e')],'include':_0x3bc4fc['include']?_[_0x0141('0x21')](_0x3bc4fc[_0x0141('0x20')],function(_0x599c62){return{'model':db[_0x599c62[_0x0141('0x22')]],'as':_0x599c62['as'],'attributes':_0x599c62[_0x0141('0x1e')],'include':_0x599c62['include']?_[_0x0141('0x21')](_0x599c62['include'],function(_0x11479b){return{'model':db[_0x11479b[_0x0141('0x22')]],'as':_0x11479b['as'],'attributes':_0x11479b[_0x0141('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x332eaa){logger[_0x0141('0x10')](_0x0141('0x23'),_0x5b372e);logger['debug']('GetChatQueue',_0x5b372e,JSON[_0x0141('0x24')](_0x332eaa));_0xda0da(_0x332eaa);})[_0x0141('0x18')](function(_0x142e21){logger[_0x0141('0x15')](_0x0141('0x23'),_0x142e21[_0x0141('0x16')],_0x5b372e);_0x25a49c(_0x2398d5[_0x0141('0x15')](0x1f4,_0x142e21[_0x0141('0x16')]));});});};exports['ShowChatQueue']=function(_0x39b66c){var _0xac1ad2=this;return new Promise(function(_0x3ebf24,_0x3816c2){return db[_0x0141('0x19')][_0x0141('0x25')]({'raw':_0x39b66c[_0x0141('0x1b')]?_0x39b66c[_0x0141('0x1b')][_0x0141('0x1c')]===undefined?!![]:![]:!![],'where':_0x39b66c[_0x0141('0x1b')]?_0x39b66c[_0x0141('0x1b')][_0x0141('0x1d')]||null:null,'attributes':_0x39b66c[_0x0141('0x1b')]?_0x39b66c[_0x0141('0x1b')][_0x0141('0x1e')]||null:null,'include':_0x39b66c[_0x0141('0x1b')]?_0x39b66c[_0x0141('0x1b')][_0x0141('0x20')]?_[_0x0141('0x21')](_0x39b66c[_0x0141('0x1b')][_0x0141('0x20')],function(_0x59f942){return{'model':db[_0x59f942[_0x0141('0x22')]],'as':_0x59f942['as'],'attributes':_0x59f942[_0x0141('0x1e')],'include':_0x59f942[_0x0141('0x20')]?_[_0x0141('0x21')](_0x59f942[_0x0141('0x20')],function(_0x2b06bf){return{'model':db[_0x2b06bf[_0x0141('0x22')]],'as':_0x2b06bf['as'],'attributes':_0x2b06bf['attributes'],'include':_0x2b06bf[_0x0141('0x20')]?_[_0x0141('0x21')](_0x2b06bf[_0x0141('0x20')],function(_0x1e025b){return{'model':db[_0x1e025b[_0x0141('0x22')]],'as':_0x1e025b['as'],'attributes':_0x1e025b[_0x0141('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0141('0x26')](function(_0x46eec2){logger[_0x0141('0x10')](_0x0141('0x27'),_0x39b66c);logger[_0x0141('0x13')](_0x0141('0x27'),_0x39b66c,JSON[_0x0141('0x24')](_0x46eec2));_0x3ebf24(_0x46eec2);})[_0x0141('0x18')](function(_0x4e7b31){logger[_0x0141('0x15')](_0x0141('0x27'),_0x4e7b31[_0x0141('0x16')],_0x39b66c);_0x3816c2(_0xac1ad2['error'](0x1f4,_0x4e7b31['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 9b5afd6..dc8b543 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 _0xc874=['emit','removeListener','register','length','./chatQueue.events','remove','update'];(function(_0x1fee02,_0x4859e0){var _0x5ef284=function(_0x5a8804){while(--_0x5a8804){_0x1fee02['push'](_0x1fee02['shift']());}};_0x5ef284(++_0x4859e0);}(_0xc874,0x154));var _0x4c87=function(_0x4b2cc6,_0x29ef43){_0x4b2cc6=_0x4b2cc6-0x0;var _0x3e0b08=_0xc874[_0x4b2cc6];return _0x3e0b08;};'use strict';var ChatQueueEvents=require(_0x4c87('0x0'));var events=['save',_0x4c87('0x1'),_0x4c87('0x2')];function createListener(_0x505440,_0x5e6d61){return function(_0xfc1b9f){_0x5e6d61[_0x4c87('0x3')](_0x505440,_0xfc1b9f);};}function removeListener(_0x1c3dbc,_0x575a7c){return function(){ChatQueueEvents[_0x4c87('0x4')](_0x1c3dbc,_0x575a7c);};}exports[_0x4c87('0x5')]=function(_0x5d63ae){for(var _0x46e0f5=0x0,_0x3dafe0=events[_0x4c87('0x6')];_0x46e0f5<_0x3dafe0;_0x46e0f5++){var _0xdc4a29=events[_0x46e0f5];var _0x116649=createListener('chatQueue:'+_0xdc4a29,_0x5d63ae);ChatQueueEvents['on'](_0xdc4a29,_0x116649);}}; \ No newline at end of file +var _0xe107=['remove','update','removeListener','register','length','./chatQueue.events'];(function(_0x5620dc,_0xa78c54){var _0x237f8a=function(_0x479f61){while(--_0x479f61){_0x5620dc['push'](_0x5620dc['shift']());}};_0x237f8a(++_0xa78c54);}(_0xe107,0xb3));var _0x7e10=function(_0x1f0f40,_0x2bacad){_0x1f0f40=_0x1f0f40-0x0;var _0xc8aa86=_0xe107[_0x1f0f40];return _0xc8aa86;};'use strict';var ChatQueueEvents=require(_0x7e10('0x0'));var events=['save',_0x7e10('0x1'),_0x7e10('0x2')];function createListener(_0x2871b0,_0x570b2a){return function(_0x31212d){_0x570b2a['emit'](_0x2871b0,_0x31212d);};}function removeListener(_0x4db676,_0x2bdf3c){return function(){ChatQueueEvents[_0x7e10('0x3')](_0x4db676,_0x2bdf3c);};}exports[_0x7e10('0x4')]=function(_0x5be19f){for(var _0x5f1edf=0x0,_0x1dd3de=events[_0x7e10('0x5')];_0x5f1edf<_0x1dd3de;_0x5f1edf++){var _0x156c56=events[_0x5f1edf];var _0x3413f7=createListener('chatQueue:'+_0x156c56,_0x5be19f);ChatQueueEvents['on'](_0x156c56,_0x3413f7);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 9b108d4..77b8eb0 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x27eac1,_0x30116e){var _0x1165ba=function(_0x5ab072){while(--_0x5ab072){_0x27eac1['push'](_0x27eac1['shift']());}};_0x1165ba(++_0x30116e);}(_0x008c,0x188));var _0xc008=function(_0x32dce6,_0x23f570){_0x32dce6=_0x32dce6-0x0;var _0x1191ba=_0x008c[_0x32dce6];return _0x1191ba;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x12')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router[_0xc008('0x16')](_0xc008('0x17'),auth[_0xc008('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xc008('0x18')]);router[_0xc008('0x16')]('/:id/users',auth[_0xc008('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _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(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x3e74,0x175));var _0x43e7=function(_0x302c8e,_0x22fd0c){_0x302c8e=_0x302c8e-0x0;var _0x284f24=_0x3e74[_0x302c8e];return _0x284f24;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 476af9f..988de01 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 _0x7ec6=['exports','STRING','DATE','sequelize'];(function(_0x58f363,_0x135c64){var _0xcb2c83=function(_0x55d7fd){while(--_0x55d7fd){_0x58f363['push'](_0x58f363['shift']());}};_0xcb2c83(++_0x135c64);}(_0x7ec6,0x197));var _0x67ec=function(_0x1126aa,_0x3ac6db){_0x1126aa=_0x1126aa-0x0;var _0x5e2bd9=_0x7ec6[_0x1126aa];return _0x5e2bd9;};'use strict';var moment=require('moment');var Sequelize=require(_0x67ec('0x0'));module[_0x67ec('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x67ec('0x2')]},'joinAt':{'type':Sequelize[_0x67ec('0x3')]},'leaveAt':{'type':Sequelize[_0x67ec('0x3')]},'acceptAt':{'type':Sequelize[_0x67ec('0x3')]},'exitAt':{'type':Sequelize[_0x67ec('0x3')]},'reason':{'type':Sequelize[_0x67ec('0x2')]}}; \ No newline at end of file +var _0x1b3d=['DATE','moment','exports','STRING'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1b3d,0xc5));var _0xd1b3=function(_0x288e18,_0x23bd84){_0x288e18=_0x288e18-0x0;var _0x415c2a=_0x1b3d[_0x288e18];return _0x415c2a;};'use strict';var moment=require(_0xd1b3('0x0'));var Sequelize=require('sequelize');module[_0xd1b3('0x1')]={'uniqueid':{'type':Sequelize[_0xd1b3('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xd1b3('0x2')]},'joinAt':{'type':Sequelize[_0xd1b3('0x3')]},'leaveAt':{'type':Sequelize[_0xd1b3('0x3')]},'acceptAt':{'type':Sequelize[_0xd1b3('0x3')]},'exitAt':{'type':Sequelize[_0xd1b3('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 d6ea483..b8b6a84 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 _0x576b=['apply','save','update','then','destroy','error','name','send','index','map','ChatQueueReport','fieldName','type','key','query','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','rawAttributes','options','create','body','find','catch','describe','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set'];(function(_0x541cd7,_0x5f4baf){var _0x5a426a=function(_0x477307){while(--_0x477307){_0x541cd7['push'](_0x541cd7['shift']());}};_0x5a426a(++_0x5f4baf);}(_0x576b,0x1d9));var _0xb576=function(_0x4d1d5c,_0x549405){_0x4d1d5c=_0x4d1d5c-0x0;var _0x5358d8=_0x576b[_0x4d1d5c];return _0x5358d8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb576('0x0'));var rp=require(_0xb576('0x1'));var moment=require('moment');var BPromise=require(_0xb576('0x2'));var Mustache=require(_0xb576('0x3'));var util=require('util');var path=require(_0xb576('0x4'));var sox=require(_0xb576('0x5'));var csv=require(_0xb576('0x6'));var ejs=require(_0xb576('0x7'));var fs=require('fs');var fs_extra=require(_0xb576('0x8'));var _=require(_0xb576('0x9'));var squel=require(_0xb576('0xa'));var crypto=require(_0xb576('0xb'));var jsforce=require(_0xb576('0xc'));var deskjs=require(_0xb576('0xd'));var toCsv=require(_0xb576('0x6'));var querystring=require(_0xb576('0xe'));var Papa=require(_0xb576('0xf'));var Redis=require(_0xb576('0x10'));var authService=require(_0xb576('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb576('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb576('0x13'))(_0xb576('0x14'));var utils=require(_0xb576('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb576('0x16'))['db'];function respondWithStatusCode(_0x420041,_0x8d09e0){_0x8d09e0=_0x8d09e0||0xcc;return function(_0x1c5cf2){if(_0x1c5cf2){return _0x420041[_0xb576('0x17')](_0x8d09e0);}return _0x420041[_0xb576('0x18')](_0x8d09e0)[_0xb576('0x19')]();};}function respondWithResult(_0x1f3a23,_0xb80ee8){_0xb80ee8=_0xb80ee8||0xc8;return function(_0x1791f0){if(_0x1791f0){return _0x1f3a23['status'](_0xb80ee8)['json'](_0x1791f0);}};}function respondWithFilteredResult(_0x5cf596,_0x4173de){return function(_0x44f1b3){if(_0x44f1b3){var _0x18cd64=typeof _0x4173de[_0xb576('0x1a')]===_0xb576('0x1b')&&typeof _0x4173de[_0xb576('0x1c')]==='undefined';var _0x91d029=_0x44f1b3[_0xb576('0x1d')];var _0x5406c9=_0x18cd64?0x0:_0x4173de['offset'];var _0x394d7e=_0x18cd64?_0x44f1b3[_0xb576('0x1d')]:_0x4173de[_0xb576('0x1a')]+_0x4173de['limit'];var _0x4e8677;if(_0x394d7e>=_0x91d029){_0x394d7e=_0x91d029;_0x4e8677=0xc8;}else{_0x4e8677=0xce;}_0x5cf596['status'](_0x4e8677);return _0x5cf596[_0xb576('0x1e')]('Content-Range',_0x5406c9+'-'+_0x394d7e+'/'+_0x91d029)['json'](_0x44f1b3);}return null;};}function patchUpdates(_0x2243b1){return function(_0x2bedf0){try{jsonpatch[_0xb576('0x1f')](_0x2bedf0,_0x2243b1,!![]);}catch(_0x2a95a3){return BPromise['reject'](_0x2a95a3);}return _0x2bedf0[_0xb576('0x20')]();};}function saveUpdates(_0x38cf07,_0xde0fb1){return function(_0x2295ed){if(_0x2295ed){return _0x2295ed[_0xb576('0x21')](_0x38cf07)[_0xb576('0x22')](function(_0x2b6074){return _0x2b6074;});}return null;};}function removeEntity(_0x2a930d,_0x23d3e7){return function(_0x189c32){if(_0x189c32){return _0x189c32[_0xb576('0x23')]()[_0xb576('0x22')](function(){_0x2a930d[_0xb576('0x18')](0xcc)[_0xb576('0x19')]();});}};}function handleEntityNotFound(_0x5c343f,_0x456648){return function(_0xa0be5e){if(!_0xa0be5e){_0x5c343f[_0xb576('0x17')](0x194);}return _0xa0be5e;};}function handleError(_0x3b8a50,_0x12098f){_0x12098f=_0x12098f||0x1f4;return function(_0x46863c){logger[_0xb576('0x24')](_0x46863c['stack']);if(_0x46863c[_0xb576('0x25')]){delete _0x46863c[_0xb576('0x25')];}_0x3b8a50[_0xb576('0x18')](_0x12098f)[_0xb576('0x26')](_0x46863c);};}exports[_0xb576('0x27')]=function(_0x592dfc,_0x13d833){var _0x5a7b3d={},_0xc6cbc={},_0x19f443={'count':0x0,'rows':[]};var _0x239638=_[_0xb576('0x28')](db[_0xb576('0x29')]['rawAttributes'],function(_0x1be38b){return{'name':_0x1be38b[_0xb576('0x2a')],'type':_0x1be38b[_0xb576('0x2b')][_0xb576('0x2c')]};});_0xc6cbc['model']=_[_0xb576('0x28')](_0x239638,_0xb576('0x25'));_0xc6cbc[_0xb576('0x2d')]=_['keys'](_0x592dfc['query']);_0xc6cbc['filters']=_[_0xb576('0x2e')](_0xc6cbc[_0xb576('0x2f')],_0xc6cbc[_0xb576('0x2d')]);_0x5a7b3d[_0xb576('0x30')]=_[_0xb576('0x2e')](_0xc6cbc[_0xb576('0x2f')],qs[_0xb576('0x31')](_0x592dfc[_0xb576('0x2d')][_0xb576('0x31')]));_0x5a7b3d['attributes']=_0x5a7b3d[_0xb576('0x30')]['length']?_0x5a7b3d['attributes']:_0xc6cbc[_0xb576('0x2f')];if(!_0x592dfc[_0xb576('0x2d')][_0xb576('0x32')]('nolimit')){_0x5a7b3d[_0xb576('0x1c')]=qs[_0xb576('0x1c')](_0x592dfc['query'][_0xb576('0x1c')]);_0x5a7b3d[_0xb576('0x1a')]=qs[_0xb576('0x1a')](_0x592dfc[_0xb576('0x2d')][_0xb576('0x1a')]);}_0x5a7b3d[_0xb576('0x33')]=qs[_0xb576('0x34')](_0x592dfc[_0xb576('0x2d')][_0xb576('0x34')]);_0x5a7b3d[_0xb576('0x35')]=qs[_0xb576('0x36')](_['pick'](_0x592dfc['query'],_0xc6cbc[_0xb576('0x36')]),_0x239638);if(_0x592dfc['query'][_0xb576('0x37')]){_0x5a7b3d[_0xb576('0x35')]=_[_0xb576('0x38')](_0x5a7b3d[_0xb576('0x35')],{'$or':_['map'](_0x239638,function(_0x17f0dc){if(_0x17f0dc['type']!==_0xb576('0x39')){var _0x3e076a={};_0x3e076a[_0x17f0dc[_0xb576('0x25')]]={'$like':'%'+_0x592dfc['query'][_0xb576('0x37')]+'%'};return _0x3e076a;}})});}_0x5a7b3d=_['merge']({},_0x5a7b3d,_0x592dfc['options']);var _0x47012a={'where':_0x5a7b3d[_0xb576('0x35')]};return db[_0xb576('0x29')][_0xb576('0x1d')](_0x47012a)[_0xb576('0x22')](function(_0x3a61c9){_0x19f443['count']=_0x3a61c9;if(_0x592dfc[_0xb576('0x2d')][_0xb576('0x3a')]){_0x5a7b3d[_0xb576('0x3b')]=[{'all':!![]}];}return db[_0xb576('0x29')][_0xb576('0x3c')](_0x5a7b3d);})[_0xb576('0x22')](function(_0x1207f4){_0x19f443[_0xb576('0x3d')]=_0x1207f4;return _0x19f443;})[_0xb576('0x22')](respondWithFilteredResult(_0x13d833,_0x5a7b3d))['catch'](handleError(_0x13d833,null));};exports[_0xb576('0x3e')]=function(_0x30a358,_0xbf5ca7){var _0x1c6a4c={'raw':!![],'where':{'id':_0x30a358[_0xb576('0x3f')]['id']}},_0x28a0cb={};_0x28a0cb[_0xb576('0x2f')]=_[_0xb576('0x40')](db[_0xb576('0x29')][_0xb576('0x41')]);_0x28a0cb[_0xb576('0x2d')]=_['keys'](_0x30a358['query']);_0x28a0cb[_0xb576('0x36')]=_[_0xb576('0x2e')](_0x28a0cb[_0xb576('0x2f')],_0x28a0cb[_0xb576('0x2d')]);_0x1c6a4c[_0xb576('0x30')]=_[_0xb576('0x2e')](_0x28a0cb[_0xb576('0x2f')],qs[_0xb576('0x31')](_0x30a358[_0xb576('0x2d')]['fields']));_0x1c6a4c['attributes']=_0x1c6a4c[_0xb576('0x30')]['length']?_0x1c6a4c['attributes']:_0x28a0cb[_0xb576('0x2f')];if(_0x30a358[_0xb576('0x2d')][_0xb576('0x3a')]){_0x1c6a4c['include']=[{'all':!![]}];}_0x1c6a4c=_[_0xb576('0x38')]({},_0x1c6a4c,_0x30a358[_0xb576('0x42')]);return db[_0xb576('0x29')]['find'](_0x1c6a4c)['then'](handleEntityNotFound(_0xbf5ca7,null))[_0xb576('0x22')](respondWithResult(_0xbf5ca7,null))['catch'](handleError(_0xbf5ca7,null));};exports[_0xb576('0x43')]=function(_0xe74e70,_0x58f269){return db['ChatQueueReport'][_0xb576('0x43')](_0xe74e70[_0xb576('0x44')],{})[_0xb576('0x22')](respondWithResult(_0x58f269,0xc9))['catch'](handleError(_0x58f269,null));};exports[_0xb576('0x21')]=function(_0x27e80d,_0x35a707){if(_0x27e80d[_0xb576('0x44')]['id']){delete _0x27e80d[_0xb576('0x44')]['id'];}return db[_0xb576('0x29')][_0xb576('0x45')]({'where':{'id':_0x27e80d[_0xb576('0x3f')]['id']}})[_0xb576('0x22')](handleEntityNotFound(_0x35a707,null))[_0xb576('0x22')](saveUpdates(_0x27e80d[_0xb576('0x44')],null))[_0xb576('0x22')](respondWithResult(_0x35a707,null))[_0xb576('0x46')](handleError(_0x35a707,null));};exports[_0xb576('0x23')]=function(_0x32b58c,_0x33e0df){return db[_0xb576('0x29')][_0xb576('0x45')]({'where':{'id':_0x32b58c['params']['id']}})[_0xb576('0x22')](handleEntityNotFound(_0x33e0df,null))[_0xb576('0x22')](removeEntity(_0x33e0df,null))[_0xb576('0x46')](handleError(_0x33e0df,null));};exports[_0xb576('0x47')]=function(_0x40f867,_0x3fd02e){return db[_0xb576('0x29')]['describe']()['then'](respondWithResult(_0x3fd02e,null))['catch'](handleError(_0x3fd02e,null));}; \ No newline at end of file +var _0xb7f0=['fields','length','hasOwnProperty','limit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes'];(function(_0x4cb8e7,_0x2e1d22){var _0x3d0188=function(_0x6c6a39){while(--_0x6c6a39){_0x4cb8e7['push'](_0x4cb8e7['shift']());}};_0x3d0188(++_0x2e1d22);}(_0xb7f0,0x1eb));var _0x0b7f=function(_0x459573,_0x35679e){_0x459573=_0x459573-0x0;var _0x51ffcd=_0xb7f0[_0x459573];return _0x51ffcd;};'use strict';var emlformat=require(_0x0b7f('0x0'));var rimraf=require(_0x0b7f('0x1'));var zipdir=require(_0x0b7f('0x2'));var jsonpatch=require(_0x0b7f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0b7f('0x4'));var Mustache=require(_0x0b7f('0x5'));var util=require(_0x0b7f('0x6'));var path=require(_0x0b7f('0x7'));var sox=require(_0x0b7f('0x8'));var csv=require(_0x0b7f('0x9'));var ejs=require(_0x0b7f('0xa'));var fs=require('fs');var fs_extra=require(_0x0b7f('0xb'));var _=require(_0x0b7f('0xc'));var squel=require(_0x0b7f('0xd'));var crypto=require('crypto');var jsforce=require(_0x0b7f('0xe'));var deskjs=require(_0x0b7f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0b7f('0x10'));var Papa=require(_0x0b7f('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0b7f('0x12'));var hardwareService=require(_0x0b7f('0x13'));var logger=require(_0x0b7f('0x14'))(_0x0b7f('0x15'));var utils=require(_0x0b7f('0x16'));var config=require(_0x0b7f('0x17'));var licenseUtil=require(_0x0b7f('0x18'));var db=require(_0x0b7f('0x19'))['db'];function respondWithStatusCode(_0x1af907,_0x34121a){_0x34121a=_0x34121a||0xcc;return function(_0x930432){if(_0x930432){return _0x1af907['sendStatus'](_0x34121a);}return _0x1af907[_0x0b7f('0x1a')](_0x34121a)[_0x0b7f('0x1b')]();};}function respondWithResult(_0x1e3f86,_0x19ddf2){_0x19ddf2=_0x19ddf2||0xc8;return function(_0x294db5){if(_0x294db5){return _0x1e3f86[_0x0b7f('0x1a')](_0x19ddf2)[_0x0b7f('0x1c')](_0x294db5);}};}function respondWithFilteredResult(_0x18069a,_0x5a2b0b){return function(_0x20e15d){if(_0x20e15d){var _0x1d223f=typeof _0x5a2b0b[_0x0b7f('0x1d')]===_0x0b7f('0x1e')&&typeof _0x5a2b0b['limit']===_0x0b7f('0x1e');var _0x3f6463=_0x20e15d[_0x0b7f('0x1f')];var _0x168e7e=_0x1d223f?0x0:_0x5a2b0b[_0x0b7f('0x1d')];var _0x50cee2=_0x1d223f?_0x20e15d[_0x0b7f('0x1f')]:_0x5a2b0b['offset']+_0x5a2b0b['limit'];var _0x36a619;if(_0x50cee2>=_0x3f6463){_0x50cee2=_0x3f6463;_0x36a619=0xc8;}else{_0x36a619=0xce;}_0x18069a[_0x0b7f('0x1a')](_0x36a619);return _0x18069a[_0x0b7f('0x20')](_0x0b7f('0x21'),_0x168e7e+'-'+_0x50cee2+'/'+_0x3f6463)[_0x0b7f('0x1c')](_0x20e15d);}return null;};}function patchUpdates(_0x52abc6){return function(_0x55362c){try{jsonpatch[_0x0b7f('0x22')](_0x55362c,_0x52abc6,!![]);}catch(_0x3ca024){return BPromise[_0x0b7f('0x23')](_0x3ca024);}return _0x55362c['save']();};}function saveUpdates(_0xb130f0,_0x1ec1d3){return function(_0x26f974){if(_0x26f974){return _0x26f974[_0x0b7f('0x24')](_0xb130f0)[_0x0b7f('0x25')](function(_0x44a0ae){return _0x44a0ae;});}return null;};}function removeEntity(_0x459389,_0x45ab0e){return function(_0xc74a5d){if(_0xc74a5d){return _0xc74a5d['destroy']()[_0x0b7f('0x25')](function(){_0x459389[_0x0b7f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50776a,_0x4a2841){return function(_0x37a5e5){if(!_0x37a5e5){_0x50776a[_0x0b7f('0x26')](0x194);}return _0x37a5e5;};}function handleError(_0x4e61be,_0xd3cb99){_0xd3cb99=_0xd3cb99||0x1f4;return function(_0x3cda59){logger[_0x0b7f('0x27')](_0x3cda59[_0x0b7f('0x28')]);if(_0x3cda59[_0x0b7f('0x29')]){delete _0x3cda59[_0x0b7f('0x29')];}_0x4e61be[_0x0b7f('0x1a')](_0xd3cb99)[_0x0b7f('0x2a')](_0x3cda59);};}exports[_0x0b7f('0x2b')]=function(_0x4ae467,_0x599bae){var _0x4ada58={},_0x3ea675={},_0x4f7e74={'count':0x0,'rows':[]};var _0x34b54c=_[_0x0b7f('0x2c')](db[_0x0b7f('0x2d')][_0x0b7f('0x2e')],function(_0x2d4727){return{'name':_0x2d4727[_0x0b7f('0x2f')],'type':_0x2d4727[_0x0b7f('0x30')]['key']};});_0x3ea675['model']=_[_0x0b7f('0x2c')](_0x34b54c,'name');_0x3ea675[_0x0b7f('0x31')]=_[_0x0b7f('0x32')](_0x4ae467[_0x0b7f('0x31')]);_0x3ea675[_0x0b7f('0x33')]=_[_0x0b7f('0x34')](_0x3ea675[_0x0b7f('0x35')],_0x3ea675[_0x0b7f('0x31')]);_0x4ada58[_0x0b7f('0x36')]=_[_0x0b7f('0x34')](_0x3ea675['model'],qs['fields'](_0x4ae467[_0x0b7f('0x31')][_0x0b7f('0x37')]));_0x4ada58[_0x0b7f('0x36')]=_0x4ada58[_0x0b7f('0x36')][_0x0b7f('0x38')]?_0x4ada58[_0x0b7f('0x36')]:_0x3ea675[_0x0b7f('0x35')];if(!_0x4ae467[_0x0b7f('0x31')][_0x0b7f('0x39')]('nolimit')){_0x4ada58['limit']=qs[_0x0b7f('0x3a')](_0x4ae467['query'][_0x0b7f('0x3a')]);_0x4ada58['offset']=qs[_0x0b7f('0x1d')](_0x4ae467[_0x0b7f('0x31')][_0x0b7f('0x1d')]);}_0x4ada58[_0x0b7f('0x3b')]=qs[_0x0b7f('0x3c')](_0x4ae467[_0x0b7f('0x31')][_0x0b7f('0x3c')]);_0x4ada58[_0x0b7f('0x3d')]=qs[_0x0b7f('0x33')](_['pick'](_0x4ae467['query'],_0x3ea675['filters']),_0x34b54c);if(_0x4ae467[_0x0b7f('0x31')]['filter']){_0x4ada58[_0x0b7f('0x3d')]=_[_0x0b7f('0x3e')](_0x4ada58[_0x0b7f('0x3d')],{'$or':_[_0x0b7f('0x2c')](_0x34b54c,function(_0x1e2f6c){if(_0x1e2f6c['type']!==_0x0b7f('0x3f')){var _0x2eafb6={};_0x2eafb6[_0x1e2f6c[_0x0b7f('0x29')]]={'$like':'%'+_0x4ae467[_0x0b7f('0x31')][_0x0b7f('0x40')]+'%'};return _0x2eafb6;}})});}_0x4ada58=_['merge']({},_0x4ada58,_0x4ae467[_0x0b7f('0x41')]);var _0x2f5351={'where':_0x4ada58[_0x0b7f('0x3d')]};return db[_0x0b7f('0x2d')][_0x0b7f('0x1f')](_0x2f5351)[_0x0b7f('0x25')](function(_0x40b1c5){_0x4f7e74[_0x0b7f('0x1f')]=_0x40b1c5;if(_0x4ae467[_0x0b7f('0x31')][_0x0b7f('0x42')]){_0x4ada58[_0x0b7f('0x43')]=[{'all':!![]}];}return db[_0x0b7f('0x2d')][_0x0b7f('0x44')](_0x4ada58);})['then'](function(_0x4aaf15){_0x4f7e74[_0x0b7f('0x45')]=_0x4aaf15;return _0x4f7e74;})[_0x0b7f('0x25')](respondWithFilteredResult(_0x599bae,_0x4ada58))[_0x0b7f('0x46')](handleError(_0x599bae,null));};exports[_0x0b7f('0x47')]=function(_0x2c25fc,_0x230c6b){var _0x57c147={'raw':!![],'where':{'id':_0x2c25fc[_0x0b7f('0x48')]['id']}},_0x2176c6={};_0x2176c6[_0x0b7f('0x35')]=_[_0x0b7f('0x32')](db['ChatQueueReport'][_0x0b7f('0x2e')]);_0x2176c6['query']=_[_0x0b7f('0x32')](_0x2c25fc[_0x0b7f('0x31')]);_0x2176c6[_0x0b7f('0x33')]=_[_0x0b7f('0x34')](_0x2176c6[_0x0b7f('0x35')],_0x2176c6['query']);_0x57c147[_0x0b7f('0x36')]=_[_0x0b7f('0x34')](_0x2176c6[_0x0b7f('0x35')],qs[_0x0b7f('0x37')](_0x2c25fc[_0x0b7f('0x31')][_0x0b7f('0x37')]));_0x57c147[_0x0b7f('0x36')]=_0x57c147[_0x0b7f('0x36')][_0x0b7f('0x38')]?_0x57c147[_0x0b7f('0x36')]:_0x2176c6[_0x0b7f('0x35')];if(_0x2c25fc[_0x0b7f('0x31')][_0x0b7f('0x42')]){_0x57c147['include']=[{'all':!![]}];}_0x57c147=_[_0x0b7f('0x3e')]({},_0x57c147,_0x2c25fc[_0x0b7f('0x41')]);return db[_0x0b7f('0x2d')][_0x0b7f('0x49')](_0x57c147)[_0x0b7f('0x25')](handleEntityNotFound(_0x230c6b,null))[_0x0b7f('0x25')](respondWithResult(_0x230c6b,null))[_0x0b7f('0x46')](handleError(_0x230c6b,null));};exports['create']=function(_0x4d432b,_0x562843){return db[_0x0b7f('0x2d')][_0x0b7f('0x4a')](_0x4d432b['body'],{})[_0x0b7f('0x25')](respondWithResult(_0x562843,0xc9))[_0x0b7f('0x46')](handleError(_0x562843,null));};exports['update']=function(_0x2469e2,_0x4a825c){if(_0x2469e2[_0x0b7f('0x4b')]['id']){delete _0x2469e2['body']['id'];}return db[_0x0b7f('0x2d')][_0x0b7f('0x49')]({'where':{'id':_0x2469e2[_0x0b7f('0x48')]['id']}})[_0x0b7f('0x25')](handleEntityNotFound(_0x4a825c,null))[_0x0b7f('0x25')](saveUpdates(_0x2469e2[_0x0b7f('0x4b')],null))[_0x0b7f('0x25')](respondWithResult(_0x4a825c,null))[_0x0b7f('0x46')](handleError(_0x4a825c,null));};exports[_0x0b7f('0x4c')]=function(_0x3cfa81,_0x23e3ef){return db[_0x0b7f('0x2d')][_0x0b7f('0x49')]({'where':{'id':_0x3cfa81[_0x0b7f('0x48')]['id']}})['then'](handleEntityNotFound(_0x23e3ef,null))[_0x0b7f('0x25')](removeEntity(_0x23e3ef,null))[_0x0b7f('0x46')](handleError(_0x23e3ef,null));};exports[_0x0b7f('0x4d')]=function(_0xe820e0,_0xbad1cd){return db[_0x0b7f('0x2d')]['describe']()[_0x0b7f('0x25')](respondWithResult(_0xbad1cd,null))['catch'](handleError(_0xbad1cd,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 2c8bd13..928472d 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 _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x99fd59,_0x5d01b2){var _0x49d02d=function(_0x43bd0f){while(--_0x43bd0f){_0x99fd59['push'](_0x99fd59['shift']());}};_0x49d02d(++_0x5d01b2);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x21da2f,_0x3c62d0){var _0x59ca2e=function(_0x2122eb){while(--_0x2122eb){_0x21da2f['push'](_0x21da2f['shift']());}};_0x59ca2e(++_0x3c62d0);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 64672d9..d05377a 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 _0x605f=['request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','stringify','UpdateChatQueueReport','update','where','limit','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','ChatQueueReport,\x20%s,\x20%s'];(function(_0x410fc4,_0x51c7a3){var _0x19880c=function(_0x7d124){while(--_0x7d124){_0x410fc4['push'](_0x410fc4['shift']());}};_0x19880c(++_0x51c7a3);}(_0x605f,0x1a6));var _0xf605=function(_0x5d3c2f,_0x116cd3){_0x5d3c2f=_0x5d3c2f-0x0;var _0x262ad1=_0x605f[_0x5d3c2f];return _0x262ad1;};'use strict';var _=require('lodash');var util=require(_0xf605('0x0'));var moment=require(_0xf605('0x1'));var BPromise=require('bluebird');var rs=require(_0xf605('0x2'));var fs=require('fs');var Redis=require(_0xf605('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf605('0x4'));var logger=require(_0xf605('0x5'))('rpc');var config=require(_0xf605('0x6'));var jayson=require(_0xf605('0x7'));var client=jayson[_0xf605('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1bdca3,_0xb8a4ed,_0x3b5bbe){return new BPromise(function(_0x2fe81e,_0x2c0a46){return client['request'](_0x1bdca3,_0x3b5bbe)[_0xf605('0x9')](function(_0x94ed81){logger[_0xf605('0xa')](_0xf605('0xb'),_0xb8a4ed,_0xf605('0xc'));logger[_0xf605('0xd')](_0xf605('0xe'),_0xb8a4ed,_0xf605('0xc'),JSON['stringify'](_0x94ed81));if(_0x94ed81[_0xf605('0xf')]){if(_0x94ed81[_0xf605('0xf')][_0xf605('0x10')]===0x1f4){logger[_0xf605('0xf')](_0xf605('0xb'),_0xb8a4ed,_0x94ed81[_0xf605('0xf')]['message']);return _0x2c0a46(_0x94ed81['error'][_0xf605('0x11')]);}logger[_0xf605('0xf')](_0xf605('0xb'),_0xb8a4ed,_0x94ed81['error'][_0xf605('0x11')]);return _0x2fe81e(_0x94ed81['error'][_0xf605('0x11')]);}else{logger[_0xf605('0xa')](_0xf605('0xb'),_0xb8a4ed,_0xf605('0xc'));_0x2fe81e(_0x94ed81[_0xf605('0x12')][_0xf605('0x11')]);}})[_0xf605('0x13')](function(_0x2dea28){logger[_0xf605('0xf')](_0xf605('0xb'),_0xb8a4ed,_0x2dea28);_0x2c0a46(_0x2dea28);});});}exports[_0xf605('0x14')]=function(_0x2739ad){var _0x5f09c3=this;return new Promise(function(_0x51fa70,_0x510ea1){return db[_0xf605('0x15')][_0xf605('0x16')](_0x2739ad[_0xf605('0x17')],{'raw':_0x2739ad[_0xf605('0x18')]?_0x2739ad[_0xf605('0x18')][_0xf605('0x19')]===undefined?!![]:![]:!![]})[_0xf605('0x9')](function(_0x477967){logger[_0xf605('0xa')](_0xf605('0x14'),_0x2739ad);logger[_0xf605('0xd')]('CreateChatQueueReport',_0x2739ad,JSON[_0xf605('0x1a')](_0x477967));_0x51fa70(_0x477967);})['catch'](function(_0x122c36){logger['error'](_0xf605('0x14'),_0x122c36['message'],_0x2739ad);_0x510ea1(_0x5f09c3[_0xf605('0xf')](0x1f4,_0x122c36[_0xf605('0x11')]));});});};exports[_0xf605('0x1b')]=function(_0x379c53){var _0x3d5d41=this;return new Promise(function(_0x4740a5,_0x5ad86d){return db[_0xf605('0x15')][_0xf605('0x1c')](_0x379c53['body'],{'raw':_0x379c53['options']?_0x379c53[_0xf605('0x18')][_0xf605('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x379c53[_0xf605('0x18')]?_0x379c53[_0xf605('0x18')][_0xf605('0x1d')]||null:null,'attributes':_0x379c53[_0xf605('0x18')]?_0x379c53[_0xf605('0x18')]['attributes']||null:null,'limit':_0x379c53[_0xf605('0x18')]?_0x379c53[_0xf605('0x18')][_0xf605('0x1e')]||null:null})['then'](function(_0x5f43fa){logger['info'](_0xf605('0x1b'),_0x379c53);logger[_0xf605('0xd')](_0xf605('0x1b'),_0x379c53,JSON[_0xf605('0x1a')](_0x5f43fa));_0x4740a5(_0x5f43fa);})[_0xf605('0x13')](function(_0x73aeb4){logger[_0xf605('0xf')](_0xf605('0x1b'),_0x73aeb4[_0xf605('0x11')],_0x379c53);_0x5ad86d(_0x3d5d41['error'](0x1f4,_0x73aeb4[_0xf605('0x11')]));});});}; \ No newline at end of file +var _0x6f2a=['request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','body','options','raw','update','where','attributes','limit','UpdateChatQueueReport','debug','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s'];(function(_0x27075a,_0x3c79b9){var _0x191311=function(_0x355d49){while(--_0x355d49){_0x27075a['push'](_0x27075a['shift']());}};_0x191311(++_0x3c79b9);}(_0x6f2a,0x189));var _0xa6f2=function(_0x44c316,_0x5d47a3){_0x44c316=_0x44c316-0x0;var _0x321904=_0x6f2a[_0x44c316];return _0x321904;};'use strict';var _=require(_0xa6f2('0x0'));var util=require('util');var moment=require(_0xa6f2('0x1'));var BPromise=require(_0xa6f2('0x2'));var rs=require(_0xa6f2('0x3'));var fs=require('fs');var Redis=require(_0xa6f2('0x4'));var db=require(_0xa6f2('0x5'))['db'];var utils=require(_0xa6f2('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xa6f2('0x7'));var jayson=require(_0xa6f2('0x8'));var client=jayson[_0xa6f2('0x9')][_0xa6f2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2dc568,_0x3e785f,_0x27fc13){return new BPromise(function(_0x400149,_0x24340c){return client[_0xa6f2('0xb')](_0x2dc568,_0x27fc13)[_0xa6f2('0xc')](function(_0x23a9fe){logger[_0xa6f2('0xd')](_0xa6f2('0xe'),_0x3e785f,_0xa6f2('0xf'));logger['debug'](_0xa6f2('0x10'),_0x3e785f,_0xa6f2('0xf'),JSON['stringify'](_0x23a9fe));if(_0x23a9fe[_0xa6f2('0x11')]){if(_0x23a9fe[_0xa6f2('0x11')][_0xa6f2('0x12')]===0x1f4){logger[_0xa6f2('0x11')](_0xa6f2('0xe'),_0x3e785f,_0x23a9fe[_0xa6f2('0x11')][_0xa6f2('0x13')]);return _0x24340c(_0x23a9fe[_0xa6f2('0x11')]['message']);}logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x3e785f,_0x23a9fe['error'][_0xa6f2('0x13')]);return _0x400149(_0x23a9fe[_0xa6f2('0x11')][_0xa6f2('0x13')]);}else{logger[_0xa6f2('0xd')]('ChatQueueReport,\x20%s,\x20%s',_0x3e785f,'request\x20sent');_0x400149(_0x23a9fe[_0xa6f2('0x14')][_0xa6f2('0x13')]);}})[_0xa6f2('0x15')](function(_0x5de7a9){logger['error'](_0xa6f2('0xe'),_0x3e785f,_0x5de7a9);_0x24340c(_0x5de7a9);});});}exports[_0xa6f2('0x16')]=function(_0x412692){var _0x5da4af=this;return new Promise(function(_0xc8696,_0x322209){return db[_0xa6f2('0x17')]['create'](_0x412692[_0xa6f2('0x18')],{'raw':_0x412692[_0xa6f2('0x19')]?_0x412692[_0xa6f2('0x19')][_0xa6f2('0x1a')]===undefined?!![]:![]:!![]})[_0xa6f2('0xc')](function(_0x125f55){logger[_0xa6f2('0xd')](_0xa6f2('0x16'),_0x412692);logger['debug'](_0xa6f2('0x16'),_0x412692,JSON['stringify'](_0x125f55));_0xc8696(_0x125f55);})['catch'](function(_0x81d365){logger[_0xa6f2('0x11')](_0xa6f2('0x16'),_0x81d365[_0xa6f2('0x13')],_0x412692);_0x322209(_0x5da4af[_0xa6f2('0x11')](0x1f4,_0x81d365['message']));});});};exports['UpdateChatQueueReport']=function(_0x48592e){var _0x46e12e=this;return new Promise(function(_0x3ebfea,_0x250912){return db[_0xa6f2('0x17')][_0xa6f2('0x1b')](_0x48592e[_0xa6f2('0x18')],{'raw':_0x48592e['options']?_0x48592e[_0xa6f2('0x19')][_0xa6f2('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48592e['options']?_0x48592e[_0xa6f2('0x19')][_0xa6f2('0x1c')]||null:null,'attributes':_0x48592e['options']?_0x48592e[_0xa6f2('0x19')][_0xa6f2('0x1d')]||null:null,'limit':_0x48592e['options']?_0x48592e[_0xa6f2('0x19')][_0xa6f2('0x1e')]||null:null})['then'](function(_0x2ab0cf){logger['info'](_0xa6f2('0x1f'),_0x48592e);logger[_0xa6f2('0x20')](_0xa6f2('0x1f'),_0x48592e,JSON[_0xa6f2('0x21')](_0x2ab0cf));_0x3ebfea(_0x2ab0cf);})[_0xa6f2('0x15')](function(_0x2712fa){logger[_0xa6f2('0x11')](_0xa6f2('0x1f'),_0x2712fa[_0xa6f2('0x13')],_0x48592e);_0x250912(_0x46e12e[_0xa6f2('0x11')](0x1f4,_0x2712fa[_0xa6f2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 1f6215d..c22a485 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 _0x445d=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','create','put','update','delete','exports','multer','util','path'];(function(_0x25a055,_0x173511){var _0x2295f9=function(_0x579d8e){while(--_0x579d8e){_0x25a055['push'](_0x25a055['shift']());}};_0x2295f9(++_0x173511);}(_0x445d,0x1c9));var _0xd445=function(_0x6ffea2,_0x40281d){_0x6ffea2=_0x6ffea2-0x0;var _0x27c8b3=_0x445d[_0x6ffea2];return _0x27c8b3;};'use strict';var multer=require(_0xd445('0x0'));var util=require(_0xd445('0x1'));var path=require(_0xd445('0x2'));var timeout=require(_0xd445('0x3'));var express=require(_0xd445('0x4'));var router=express['Router']();var fs_extra=require(_0xd445('0x5'));var auth=require(_0xd445('0x6'));var interaction=require(_0xd445('0x7'));var config=require(_0xd445('0x8'));var controller=require('./chatQueueReport.controller');router[_0xd445('0x9')]('/',auth[_0xd445('0xa')](),controller[_0xd445('0xb')]);router['get']('/describe',auth[_0xd445('0xa')](),controller[_0xd445('0xc')]);router[_0xd445('0x9')](_0xd445('0xd'),auth[_0xd445('0xa')](),controller[_0xd445('0xe')]);router['post']('/',auth[_0xd445('0xa')](),controller[_0xd445('0xf')]);router[_0xd445('0x10')](_0xd445('0xd'),auth[_0xd445('0xa')](),controller[_0xd445('0x11')]);router[_0xd445('0x12')](_0xd445('0xd'),auth[_0xd445('0xa')](),controller['destroy']);module[_0xd445('0x13')]=router; \ No newline at end of file +var _0x6ac1=['express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/describe','describe','get','/:id','show','post','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x3593ea,_0x295ab4){var _0x5be81c=function(_0x3ebca){while(--_0x3ebca){_0x3593ea['push'](_0x3593ea['shift']());}};_0x5be81c(++_0x295ab4);}(_0x6ac1,0x179));var _0x16ac=function(_0x2c03ca,_0xad92ca){_0x2c03ca=_0x2c03ca-0x0;var _0xe670b=_0x6ac1[_0x2c03ca];return _0xe670b;};'use strict';var multer=require('multer');var util=require(_0x16ac('0x0'));var path=require(_0x16ac('0x1'));var timeout=require(_0x16ac('0x2'));var express=require(_0x16ac('0x3'));var router=express['Router']();var fs_extra=require(_0x16ac('0x4'));var auth=require(_0x16ac('0x5'));var interaction=require(_0x16ac('0x6'));var config=require('../../config/environment');var controller=require('./chatQueueReport.controller');router['get']('/',auth[_0x16ac('0x7')](),controller[_0x16ac('0x8')]);router['get'](_0x16ac('0x9'),auth[_0x16ac('0x7')](),controller[_0x16ac('0xa')]);router[_0x16ac('0xb')](_0x16ac('0xc'),auth['isAuthenticated'](),controller[_0x16ac('0xd')]);router[_0x16ac('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x16ac('0xc'),auth['isAuthenticated'](),controller[_0x16ac('0xf')]);router[_0x16ac('0x10')](_0x16ac('0xc'),auth[_0x16ac('0x7')](),controller[_0x16ac('0x11')]);module[_0x16ac('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 0e63c33..10b903c 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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x202d24,_0x5e8641){var _0x2b3a8e=function(_0x4c7c4a){while(--_0x4c7c4a){_0x202d24['push'](_0x202d24['shift']());}};_0x2b3a8e(++_0x5e8641);}(_0x9bde,0xe1));var _0xe9bd=function(_0x467d8b,_0x8eb260){_0x467d8b=_0x467d8b-0x0;var _0x395255=_0x9bde[_0x467d8b];return _0x395255;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x21a1a6,_0x1474bf){var _0x5cec0e=function(_0x13abb9){while(--_0x13abb9){_0x21a1a6['push'](_0x21a1a6['shift']());}};_0x5cec0e(++_0x1474bf);}(_0x54ef,0x112));var _0xf54e=function(_0x3fd4a2,_0x13dc04){_0x3fd4a2=_0x3fd4a2-0x0;var _0x2404c6=_0x54ef[_0x3fd4a2];return _0x2404c6;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 8f5d996..06ef944 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 _0x4071=['hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','then','includeAll','catch','keys','include','create','body','update','find','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','destroy','error','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length'];(function(_0x405fb7,_0xb788df){var _0x1b4117=function(_0x5630ea){while(--_0x5630ea){_0x405fb7['push'](_0x405fb7['shift']());}};_0x1b4117(++_0xb788df);}(_0x4071,0x1d7));var _0x1407=function(_0x369064,_0x6f8096){_0x369064=_0x369064-0x0;var _0x2242c9=_0x4071[_0x369064];return _0x2242c9;};'use strict';var emlformat=require(_0x1407('0x0'));var rimraf=require(_0x1407('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1407('0x2'));var rp=require(_0x1407('0x3'));var moment=require(_0x1407('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1407('0x5'));var path=require(_0x1407('0x6'));var sox=require('sox');var csv=require(_0x1407('0x7'));var ejs=require(_0x1407('0x8'));var fs=require('fs');var fs_extra=require(_0x1407('0x9'));var _=require('lodash');var squel=require(_0x1407('0xa'));var crypto=require(_0x1407('0xb'));var jsforce=require(_0x1407('0xc'));var deskjs=require(_0x1407('0xd'));var toCsv=require(_0x1407('0x7'));var querystring=require(_0x1407('0xe'));var Papa=require(_0x1407('0xf'));var Redis=require(_0x1407('0x10'));var authService=require(_0x1407('0x11'));var qs=require(_0x1407('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1407('0x13'));var logger=require(_0x1407('0x14'))(_0x1407('0x15'));var utils=require(_0x1407('0x16'));var config=require(_0x1407('0x17'));var licenseUtil=require(_0x1407('0x18'));var db=require(_0x1407('0x19'))['db'];function respondWithStatusCode(_0x574130,_0x3bb0b6){_0x3bb0b6=_0x3bb0b6||0xcc;return function(_0x5d2fa0){if(_0x5d2fa0){return _0x574130[_0x1407('0x1a')](_0x3bb0b6);}return _0x574130[_0x1407('0x1b')](_0x3bb0b6)[_0x1407('0x1c')]();};}function respondWithResult(_0x11f075,_0x5a5492){_0x5a5492=_0x5a5492||0xc8;return function(_0x1e421f){if(_0x1e421f){return _0x11f075['status'](_0x5a5492)[_0x1407('0x1d')](_0x1e421f);}};}function respondWithFilteredResult(_0x415bc5,_0x5241ba){return function(_0x23e51c){if(_0x23e51c){var _0x534d2e=typeof _0x5241ba['offset']==='undefined'&&typeof _0x5241ba['limit']===_0x1407('0x1e');var _0x1a0889=_0x23e51c[_0x1407('0x1f')];var _0x40dff9=_0x534d2e?0x0:_0x5241ba[_0x1407('0x20')];var _0x542a31=_0x534d2e?_0x23e51c[_0x1407('0x1f')]:_0x5241ba['offset']+_0x5241ba[_0x1407('0x21')];var _0x542337;if(_0x542a31>=_0x1a0889){_0x542a31=_0x1a0889;_0x542337=0xc8;}else{_0x542337=0xce;}_0x415bc5[_0x1407('0x1b')](_0x542337);return _0x415bc5['set'](_0x1407('0x22'),_0x40dff9+'-'+_0x542a31+'/'+_0x1a0889)['json'](_0x23e51c);}return null;};}function patchUpdates(_0x51df64){return function(_0x4064e7){try{jsonpatch[_0x1407('0x23')](_0x4064e7,_0x51df64,!![]);}catch(_0x5d848e){return BPromise[_0x1407('0x24')](_0x5d848e);}return _0x4064e7['save']();};}function saveUpdates(_0x1ee891,_0x1b1180){return function(_0x430a66){if(_0x430a66){return _0x430a66['update'](_0x1ee891)['then'](function(_0x57fb2b){return _0x57fb2b;});}return null;};}function removeEntity(_0x5106a5,_0x425209){return function(_0x4fb71b){if(_0x4fb71b){return _0x4fb71b[_0x1407('0x25')]()['then'](function(){_0x5106a5[_0x1407('0x1b')](0xcc)[_0x1407('0x1c')]();});}};}function handleEntityNotFound(_0x5ad31b,_0x299692){return function(_0x121152){if(!_0x121152){_0x5ad31b[_0x1407('0x1a')](0x194);}return _0x121152;};}function handleError(_0x21b0b4,_0x555ab2){_0x555ab2=_0x555ab2||0x1f4;return function(_0x40dc6d){logger[_0x1407('0x26')](_0x40dc6d['stack']);if(_0x40dc6d[_0x1407('0x27')]){delete _0x40dc6d['name'];}_0x21b0b4['status'](_0x555ab2)[_0x1407('0x28')](_0x40dc6d);};}exports[_0x1407('0x29')]=function(_0x5a2359,_0x57331d){var _0x9ac8db={},_0x1867cc={},_0x5ae0e4={'count':0x0,'rows':[]};var _0x10aff6=_[_0x1407('0x2a')](db[_0x1407('0x2b')][_0x1407('0x2c')],function(_0x10a355){return{'name':_0x10a355[_0x1407('0x2d')],'type':_0x10a355[_0x1407('0x2e')][_0x1407('0x2f')]};});_0x1867cc['model']=_[_0x1407('0x2a')](_0x10aff6,'name');_0x1867cc['query']=_['keys'](_0x5a2359[_0x1407('0x30')]);_0x1867cc['filters']=_[_0x1407('0x31')](_0x1867cc[_0x1407('0x32')],_0x1867cc['query']);_0x9ac8db[_0x1407('0x33')]=_[_0x1407('0x31')](_0x1867cc[_0x1407('0x32')],qs[_0x1407('0x34')](_0x5a2359['query'][_0x1407('0x34')]));_0x9ac8db[_0x1407('0x33')]=_0x9ac8db[_0x1407('0x33')][_0x1407('0x35')]?_0x9ac8db[_0x1407('0x33')]:_0x1867cc[_0x1407('0x32')];if(!_0x5a2359['query'][_0x1407('0x36')](_0x1407('0x37'))){_0x9ac8db[_0x1407('0x21')]=qs[_0x1407('0x21')](_0x5a2359[_0x1407('0x30')][_0x1407('0x21')]);_0x9ac8db[_0x1407('0x20')]=qs[_0x1407('0x20')](_0x5a2359[_0x1407('0x30')][_0x1407('0x20')]);}_0x9ac8db['order']=qs[_0x1407('0x38')](_0x5a2359[_0x1407('0x30')][_0x1407('0x38')]);_0x9ac8db['where']=qs[_0x1407('0x39')](_[_0x1407('0x3a')](_0x5a2359[_0x1407('0x30')],_0x1867cc[_0x1407('0x39')]),_0x10aff6);if(_0x5a2359['query'][_0x1407('0x3b')]){_0x9ac8db[_0x1407('0x3c')]=_[_0x1407('0x3d')](_0x9ac8db['where'],{'$or':_[_0x1407('0x2a')](_0x10aff6,function(_0x4c4975){if(_0x4c4975[_0x1407('0x2e')]!==_0x1407('0x3e')){var _0x27460a={};_0x27460a[_0x4c4975['name']]={'$like':'%'+_0x5a2359[_0x1407('0x30')][_0x1407('0x3b')]+'%'};return _0x27460a;}})});}_0x9ac8db=_[_0x1407('0x3d')]({},_0x9ac8db,_0x5a2359[_0x1407('0x3f')]);var _0x4c9618={'where':_0x9ac8db[_0x1407('0x3c')]};return db[_0x1407('0x2b')][_0x1407('0x1f')](_0x4c9618)[_0x1407('0x40')](function(_0x589404){_0x5ae0e4[_0x1407('0x1f')]=_0x589404;if(_0x5a2359['query'][_0x1407('0x41')]){_0x9ac8db['include']=[{'all':!![]}];}return db[_0x1407('0x2b')]['findAll'](_0x9ac8db);})[_0x1407('0x40')](function(_0x4d0e72){_0x5ae0e4['rows']=_0x4d0e72;return _0x5ae0e4;})[_0x1407('0x40')](respondWithFilteredResult(_0x57331d,_0x9ac8db))[_0x1407('0x42')](handleError(_0x57331d,null));};exports['show']=function(_0x367807,_0x2da4de){var _0x34e81d={'raw':!![],'where':{'id':_0x367807['params']['id']}},_0x23fb02={};_0x23fb02['model']=_[_0x1407('0x43')](db['ChatTransferReport'][_0x1407('0x2c')]);_0x23fb02[_0x1407('0x30')]=_[_0x1407('0x43')](_0x367807[_0x1407('0x30')]);_0x23fb02[_0x1407('0x39')]=_['intersection'](_0x23fb02[_0x1407('0x32')],_0x23fb02['query']);_0x34e81d['attributes']=_[_0x1407('0x31')](_0x23fb02[_0x1407('0x32')],qs[_0x1407('0x34')](_0x367807[_0x1407('0x30')][_0x1407('0x34')]));_0x34e81d['attributes']=_0x34e81d['attributes']['length']?_0x34e81d[_0x1407('0x33')]:_0x23fb02[_0x1407('0x32')];if(_0x367807['query'][_0x1407('0x41')]){_0x34e81d[_0x1407('0x44')]=[{'all':!![]}];}_0x34e81d=_['merge']({},_0x34e81d,_0x367807[_0x1407('0x3f')]);return db[_0x1407('0x2b')]['find'](_0x34e81d)[_0x1407('0x40')](handleEntityNotFound(_0x2da4de,null))['then'](respondWithResult(_0x2da4de,null))[_0x1407('0x42')](handleError(_0x2da4de,null));};exports[_0x1407('0x45')]=function(_0x498652,_0x37e03e){return db[_0x1407('0x2b')][_0x1407('0x45')](_0x498652[_0x1407('0x46')],{})[_0x1407('0x40')](respondWithResult(_0x37e03e,0xc9))[_0x1407('0x42')](handleError(_0x37e03e,null));};exports[_0x1407('0x47')]=function(_0x4c02a9,_0x50643a){if(_0x4c02a9[_0x1407('0x46')]['id']){delete _0x4c02a9[_0x1407('0x46')]['id'];}return db[_0x1407('0x2b')][_0x1407('0x48')]({'where':{'id':_0x4c02a9[_0x1407('0x49')]['id']}})[_0x1407('0x40')](handleEntityNotFound(_0x50643a,null))['then'](saveUpdates(_0x4c02a9['body'],null))[_0x1407('0x40')](respondWithResult(_0x50643a,null))[_0x1407('0x42')](handleError(_0x50643a,null));};exports[_0x1407('0x25')]=function(_0x52d526,_0x17b680){return db['ChatTransferReport'][_0x1407('0x48')]({'where':{'id':_0x52d526[_0x1407('0x49')]['id']}})[_0x1407('0x40')](handleEntityNotFound(_0x17b680,null))['then'](removeEntity(_0x17b680,null))['catch'](handleError(_0x17b680,null));};exports['describe']=function(_0x108d8b,_0x1cf624){return db[_0x1407('0x2b')][_0x1407('0x4a')]()[_0x1407('0x40')](respondWithResult(_0x1cf624,null))[_0x1407('0x42')](handleError(_0x1cf624,null));}; \ No newline at end of file +var _0x158e=['map','ChatTransferReport','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','limit','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','findAll','catch','params','include','merge','find','body','describe','zip-dir','request-promise','bluebird','util','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','Content-Range','json','apply','reject','save','update','then','destroy','name','send','index'];(function(_0x5957b9,_0xbd5ce1){var _0x166fc6=function(_0x1133f6){while(--_0x1133f6){_0x5957b9['push'](_0x5957b9['shift']());}};_0x166fc6(++_0xbd5ce1);}(_0x158e,0xdd));var _0xe158=function(_0x32aa0c,_0x40ccce){_0x32aa0c=_0x32aa0c-0x0;var _0x21fb26=_0x158e[_0x32aa0c];return _0x21fb26;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe158('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe158('0x1'));var moment=require('moment');var BPromise=require(_0xe158('0x2'));var Mustache=require('mustache');var util=require(_0xe158('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0xe158('0x4'));var ejs=require(_0xe158('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe158('0x6'));var squel=require(_0xe158('0x7'));var crypto=require(_0xe158('0x8'));var jsforce=require(_0xe158('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xe158('0x4'));var querystring=require(_0xe158('0xa'));var Papa=require(_0xe158('0xb'));var Redis=require('ioredis');var authService=require(_0xe158('0xc'));var qs=require(_0xe158('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe158('0xe'));var logger=require(_0xe158('0xf'))('api');var utils=require('../../config/utils');var config=require(_0xe158('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0xe158('0x11'))['db'];function respondWithStatusCode(_0x3c8979,_0x26d12e){_0x26d12e=_0x26d12e||0xcc;return function(_0x2c9246){if(_0x2c9246){return _0x3c8979[_0xe158('0x12')](_0x26d12e);}return _0x3c8979[_0xe158('0x13')](_0x26d12e)[_0xe158('0x14')]();};}function respondWithResult(_0x5aaf8b,_0x2aa833){_0x2aa833=_0x2aa833||0xc8;return function(_0x11a3f9){if(_0x11a3f9){return _0x5aaf8b[_0xe158('0x13')](_0x2aa833)['json'](_0x11a3f9);}};}function respondWithFilteredResult(_0x5d8865,_0x26cd1e){return function(_0x54a627){if(_0x54a627){var _0xb73dbc=typeof _0x26cd1e[_0xe158('0x15')]===_0xe158('0x16')&&typeof _0x26cd1e['limit']==='undefined';var _0x12f09c=_0x54a627[_0xe158('0x17')];var _0x5beff6=_0xb73dbc?0x0:_0x26cd1e[_0xe158('0x15')];var _0x5ffda4=_0xb73dbc?_0x54a627[_0xe158('0x17')]:_0x26cd1e[_0xe158('0x15')]+_0x26cd1e['limit'];var _0x24dd0c;if(_0x5ffda4>=_0x12f09c){_0x5ffda4=_0x12f09c;_0x24dd0c=0xc8;}else{_0x24dd0c=0xce;}_0x5d8865[_0xe158('0x13')](_0x24dd0c);return _0x5d8865['set'](_0xe158('0x18'),_0x5beff6+'-'+_0x5ffda4+'/'+_0x12f09c)[_0xe158('0x19')](_0x54a627);}return null;};}function patchUpdates(_0x3e274d){return function(_0x53492d){try{jsonpatch[_0xe158('0x1a')](_0x53492d,_0x3e274d,!![]);}catch(_0x5cf83c){return BPromise[_0xe158('0x1b')](_0x5cf83c);}return _0x53492d[_0xe158('0x1c')]();};}function saveUpdates(_0x58139d,_0x4918ed){return function(_0x3da0b7){if(_0x3da0b7){return _0x3da0b7[_0xe158('0x1d')](_0x58139d)[_0xe158('0x1e')](function(_0x1870de){return _0x1870de;});}return null;};}function removeEntity(_0x35bf38,_0x14c413){return function(_0x3417de){if(_0x3417de){return _0x3417de[_0xe158('0x1f')]()[_0xe158('0x1e')](function(){_0x35bf38['status'](0xcc)[_0xe158('0x14')]();});}};}function handleEntityNotFound(_0x4352cc,_0xd9277a){return function(_0x125d67){if(!_0x125d67){_0x4352cc['sendStatus'](0x194);}return _0x125d67;};}function handleError(_0x7c7c79,_0x4c41b6){_0x4c41b6=_0x4c41b6||0x1f4;return function(_0x48199f){logger['error'](_0x48199f['stack']);if(_0x48199f[_0xe158('0x20')]){delete _0x48199f[_0xe158('0x20')];}_0x7c7c79[_0xe158('0x13')](_0x4c41b6)[_0xe158('0x21')](_0x48199f);};}exports[_0xe158('0x22')]=function(_0x4a8998,_0x1d2c7e){var _0x35ab5c={},_0x35e851={},_0x41ebdc={'count':0x0,'rows':[]};var _0x516d13=_[_0xe158('0x23')](db[_0xe158('0x24')][_0xe158('0x25')],function(_0x549e4e){return{'name':_0x549e4e['fieldName'],'type':_0x549e4e['type']['key']};});_0x35e851[_0xe158('0x26')]=_[_0xe158('0x23')](_0x516d13,_0xe158('0x20'));_0x35e851[_0xe158('0x27')]=_[_0xe158('0x28')](_0x4a8998[_0xe158('0x27')]);_0x35e851[_0xe158('0x29')]=_[_0xe158('0x2a')](_0x35e851[_0xe158('0x26')],_0x35e851[_0xe158('0x27')]);_0x35ab5c[_0xe158('0x2b')]=_['intersection'](_0x35e851[_0xe158('0x26')],qs[_0xe158('0x2c')](_0x4a8998['query'][_0xe158('0x2c')]));_0x35ab5c[_0xe158('0x2b')]=_0x35ab5c[_0xe158('0x2b')][_0xe158('0x2d')]?_0x35ab5c[_0xe158('0x2b')]:_0x35e851['model'];if(!_0x4a8998[_0xe158('0x27')]['hasOwnProperty']('nolimit')){_0x35ab5c[_0xe158('0x2e')]=qs[_0xe158('0x2e')](_0x4a8998[_0xe158('0x27')]['limit']);_0x35ab5c['offset']=qs['offset'](_0x4a8998[_0xe158('0x27')][_0xe158('0x15')]);}_0x35ab5c[_0xe158('0x2f')]=qs[_0xe158('0x30')](_0x4a8998[_0xe158('0x27')]['sort']);_0x35ab5c[_0xe158('0x31')]=qs[_0xe158('0x29')](_[_0xe158('0x32')](_0x4a8998[_0xe158('0x27')],_0x35e851['filters']),_0x516d13);if(_0x4a8998[_0xe158('0x27')][_0xe158('0x33')]){_0x35ab5c[_0xe158('0x31')]=_['merge'](_0x35ab5c['where'],{'$or':_['map'](_0x516d13,function(_0x461574){if(_0x461574[_0xe158('0x34')]!==_0xe158('0x35')){var _0x5a7c68={};_0x5a7c68[_0x461574['name']]={'$like':'%'+_0x4a8998[_0xe158('0x27')][_0xe158('0x33')]+'%'};return _0x5a7c68;}})});}_0x35ab5c=_['merge']({},_0x35ab5c,_0x4a8998[_0xe158('0x36')]);var _0x39ac56={'where':_0x35ab5c[_0xe158('0x31')]};return db[_0xe158('0x24')][_0xe158('0x17')](_0x39ac56)[_0xe158('0x1e')](function(_0x37f686){_0x41ebdc[_0xe158('0x17')]=_0x37f686;if(_0x4a8998[_0xe158('0x27')][_0xe158('0x37')]){_0x35ab5c['include']=[{'all':!![]}];}return db['ChatTransferReport'][_0xe158('0x38')](_0x35ab5c);})[_0xe158('0x1e')](function(_0xade240){_0x41ebdc['rows']=_0xade240;return _0x41ebdc;})[_0xe158('0x1e')](respondWithFilteredResult(_0x1d2c7e,_0x35ab5c))[_0xe158('0x39')](handleError(_0x1d2c7e,null));};exports['show']=function(_0x20fa12,_0x42d771){var _0x58e59c={'raw':!![],'where':{'id':_0x20fa12[_0xe158('0x3a')]['id']}},_0x95673c={};_0x95673c[_0xe158('0x26')]=_[_0xe158('0x28')](db[_0xe158('0x24')][_0xe158('0x25')]);_0x95673c[_0xe158('0x27')]=_[_0xe158('0x28')](_0x20fa12[_0xe158('0x27')]);_0x95673c['filters']=_[_0xe158('0x2a')](_0x95673c['model'],_0x95673c[_0xe158('0x27')]);_0x58e59c[_0xe158('0x2b')]=_[_0xe158('0x2a')](_0x95673c['model'],qs[_0xe158('0x2c')](_0x20fa12[_0xe158('0x27')]['fields']));_0x58e59c['attributes']=_0x58e59c[_0xe158('0x2b')]['length']?_0x58e59c[_0xe158('0x2b')]:_0x95673c[_0xe158('0x26')];if(_0x20fa12[_0xe158('0x27')][_0xe158('0x37')]){_0x58e59c[_0xe158('0x3b')]=[{'all':!![]}];}_0x58e59c=_[_0xe158('0x3c')]({},_0x58e59c,_0x20fa12['options']);return db[_0xe158('0x24')][_0xe158('0x3d')](_0x58e59c)[_0xe158('0x1e')](handleEntityNotFound(_0x42d771,null))[_0xe158('0x1e')](respondWithResult(_0x42d771,null))[_0xe158('0x39')](handleError(_0x42d771,null));};exports['create']=function(_0x4ed184,_0x3a43b8){return db['ChatTransferReport']['create'](_0x4ed184[_0xe158('0x3e')],{})[_0xe158('0x1e')](respondWithResult(_0x3a43b8,0xc9))[_0xe158('0x39')](handleError(_0x3a43b8,null));};exports[_0xe158('0x1d')]=function(_0x2f88a8,_0x4c649e){if(_0x2f88a8[_0xe158('0x3e')]['id']){delete _0x2f88a8['body']['id'];}return db[_0xe158('0x24')][_0xe158('0x3d')]({'where':{'id':_0x2f88a8[_0xe158('0x3a')]['id']}})[_0xe158('0x1e')](handleEntityNotFound(_0x4c649e,null))[_0xe158('0x1e')](saveUpdates(_0x2f88a8[_0xe158('0x3e')],null))[_0xe158('0x1e')](respondWithResult(_0x4c649e,null))['catch'](handleError(_0x4c649e,null));};exports['destroy']=function(_0x2c6461,_0x4c09c3){return db['ChatTransferReport'][_0xe158('0x3d')]({'where':{'id':_0x2c6461[_0xe158('0x3a')]['id']}})['then'](handleEntityNotFound(_0x4c09c3,null))[_0xe158('0x1e')](removeEntity(_0x4c09c3,null))[_0xe158('0x39')](handleError(_0x4c09c3,null));};exports[_0xe158('0x3f')]=function(_0x21d5e9,_0x1758c4){return db[_0xe158('0x24')][_0xe158('0x3f')]()[_0xe158('0x1e')](respondWithResult(_0x1758c4,null))[_0xe158('0x39')](handleError(_0x1758c4,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index e7c1fe5..92d4175 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 _0x8819=['exports','define','ChatTransferReport','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatTransferReport.attributes'];(function(_0x3ce9ee,_0x3a7252){var _0x5193f5=function(_0x1bfda0){while(--_0x1bfda0){_0x3ce9ee['push'](_0x3ce9ee['shift']());}};_0x5193f5(++_0x3a7252);}(_0x8819,0x156));var _0x9881=function(_0xd3ad15,_0x576f4b){_0xd3ad15=_0xd3ad15-0x0;var _0xcf308a=_0x8819[_0xd3ad15];return _0xcf308a;};'use strict';var _=require(_0x9881('0x0'));var util=require('util');var logger=require(_0x9881('0x1'))(_0x9881('0x2'));var moment=require(_0x9881('0x3'));var BPromise=require(_0x9881('0x4'));var rp=require(_0x9881('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9881('0x6'));var config=require(_0x9881('0x7'));var attributes=require(_0x9881('0x8'));module[_0x9881('0x9')]=function(_0x39fe36,_0x56aca5){return _0x39fe36[_0x9881('0xa')](_0x9881('0xb'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x9881('0xc'),'fields':[_0x9881('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdc9c=['path','rimraf','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','lodash','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdc9c,0x127));var _0xcdc9=function(_0x473b0b,_0x3c720c){_0x473b0b=_0x473b0b-0x0;var _0x1c44db=_0xdc9c[_0x473b0b];return _0x1c44db;};'use strict';var _=require(_0xcdc9('0x0'));var util=require('util');var logger=require(_0xcdc9('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcdc9('0x2'));var rimraf=require(_0xcdc9('0x3'));var config=require('../../config/environment');var attributes=require(_0xcdc9('0x4'));module[_0xcdc9('0x5')]=function(_0x47a10b,_0x3dc3e7){return _0x47a10b[_0xcdc9('0x6')](_0xcdc9('0x7'),attributes,{'tableName':_0xcdc9('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 8d1e212..9c26d19 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 _0xd78c=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','then','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','moment','bluebird','randomstring'];(function(_0x123630,_0x28b6f9){var _0x2e7dab=function(_0x2ba771){while(--_0x2ba771){_0x123630['push'](_0x123630['shift']());}};_0x2e7dab(++_0x28b6f9);}(_0xd78c,0x1e3));var _0xcd78=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xd78c[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcd78('0x0'));var BPromise=require(_0xcd78('0x1'));var rs=require(_0xcd78('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcd78('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xcd78('0x4'))('rpc');var config=require(_0xcd78('0x5'));var jayson=require(_0xcd78('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x53fec4,_0x2a535d,_0x1b95f4){return new BPromise(function(_0x282df1,_0x406f1c){return client['request'](_0x53fec4,_0x1b95f4)[_0xcd78('0x7')](function(_0xcd3268){logger['info'](_0xcd78('0x8'),_0x2a535d,_0xcd78('0x9'));logger[_0xcd78('0xa')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x2a535d,_0xcd78('0x9'),JSON[_0xcd78('0xb')](_0xcd3268));if(_0xcd3268['error']){if(_0xcd3268[_0xcd78('0xc')][_0xcd78('0xd')]===0x1f4){logger[_0xcd78('0xc')](_0xcd78('0x8'),_0x2a535d,_0xcd3268[_0xcd78('0xc')]['message']);return _0x406f1c(_0xcd3268[_0xcd78('0xc')][_0xcd78('0xe')]);}logger[_0xcd78('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x2a535d,_0xcd3268[_0xcd78('0xc')][_0xcd78('0xe')]);return _0x282df1(_0xcd3268[_0xcd78('0xc')]['message']);}else{logger[_0xcd78('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x2a535d,_0xcd78('0x9'));_0x282df1(_0xcd3268[_0xcd78('0x10')][_0xcd78('0xe')]);}})[_0xcd78('0x11')](function(_0x3a419d){logger[_0xcd78('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x2a535d,_0x3a419d);_0x406f1c(_0x3a419d);});});} \ No newline at end of file +var _0xbc7b=['info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x51a063,_0x675fc5){var _0x16f2cc=function(_0x493302){while(--_0x493302){_0x51a063['push'](_0x51a063['shift']());}};_0x16f2cc(++_0x675fc5);}(_0xbc7b,0xf0));var _0xbbc7=function(_0x122573,_0x3449c0){_0x122573=_0x122573-0x0;var _0x1c4981=_0xbc7b[_0x122573];return _0x1c4981;};'use strict';var _=require(_0xbbc7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbbc7('0x1'));var fs=require('fs');var Redis=require(_0xbbc7('0x2'));var db=require(_0xbbc7('0x3'))['db'];var utils=require(_0xbbc7('0x4'));var logger=require(_0xbbc7('0x5'))(_0xbbc7('0x6'));var config=require(_0xbbc7('0x7'));var jayson=require(_0xbbc7('0x8'));var client=jayson[_0xbbc7('0x9')][_0xbbc7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x377865,_0x34dfb8,_0x20c247){return new BPromise(function(_0x5c2ef9,_0x8352b0){return client[_0xbbc7('0xb')](_0x377865,_0x20c247)[_0xbbc7('0xc')](function(_0x2ae6aa){logger[_0xbbc7('0xd')](_0xbbc7('0xe'),_0x34dfb8,_0xbbc7('0xf'));logger['debug'](_0xbbc7('0x10'),_0x34dfb8,_0xbbc7('0xf'),JSON[_0xbbc7('0x11')](_0x2ae6aa));if(_0x2ae6aa[_0xbbc7('0x12')]){if(_0x2ae6aa['error'][_0xbbc7('0x13')]===0x1f4){logger['error'](_0xbbc7('0xe'),_0x34dfb8,_0x2ae6aa[_0xbbc7('0x12')][_0xbbc7('0x14')]);return _0x8352b0(_0x2ae6aa[_0xbbc7('0x12')][_0xbbc7('0x14')]);}logger[_0xbbc7('0x12')](_0xbbc7('0xe'),_0x34dfb8,_0x2ae6aa[_0xbbc7('0x12')][_0xbbc7('0x14')]);return _0x5c2ef9(_0x2ae6aa[_0xbbc7('0x12')][_0xbbc7('0x14')]);}else{logger['info'](_0xbbc7('0xe'),_0x34dfb8,_0xbbc7('0xf'));_0x5c2ef9(_0x2ae6aa[_0xbbc7('0x15')][_0xbbc7('0x14')]);}})[_0xbbc7('0x16')](function(_0x38a786){logger[_0xbbc7('0x12')](_0xbbc7('0xe'),_0x34dfb8,_0x38a786);_0x8352b0(_0x38a786);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index d65f68e..a6632db 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 _0x79a6=['../../components/interaction/service','../../config/environment','./chatTransferReport.controller','isAuthenticated','index','get','/describe','/:id','show','post','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x5c3ae9,_0x450f9a){var _0x3f5950=function(_0x594c1f){while(--_0x594c1f){_0x5c3ae9['push'](_0x5c3ae9['shift']());}};_0x3f5950(++_0x450f9a);}(_0x79a6,0xc1));var _0x679a=function(_0x7c0646,_0x45d16b){_0x7c0646=_0x7c0646-0x0;var _0x32416d=_0x79a6[_0x7c0646];return _0x32416d;};'use strict';var multer=require(_0x679a('0x0'));var util=require(_0x679a('0x1'));var path=require(_0x679a('0x2'));var timeout=require(_0x679a('0x3'));var express=require(_0x679a('0x4'));var router=express[_0x679a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x679a('0x6'));var interaction=require(_0x679a('0x7'));var config=require(_0x679a('0x8'));var controller=require(_0x679a('0x9'));router['get']('/',auth[_0x679a('0xa')](),controller[_0x679a('0xb')]);router[_0x679a('0xc')](_0x679a('0xd'),auth[_0x679a('0xa')](),controller['describe']);router[_0x679a('0xc')](_0x679a('0xe'),auth[_0x679a('0xa')](),controller[_0x679a('0xf')]);router[_0x679a('0x10')]('/',auth[_0x679a('0xa')](),controller['create']);router[_0x679a('0x11')](_0x679a('0xe'),auth[_0x679a('0xa')](),controller[_0x679a('0x12')]);router[_0x679a('0x13')](_0x679a('0xe'),auth[_0x679a('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x32f6=['util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','destroy','exports'];(function(_0x1acc2d,_0x597696){var _0xabfa6d=function(_0x41e83c){while(--_0x41e83c){_0x1acc2d['push'](_0x1acc2d['shift']());}};_0xabfa6d(++_0x597696);}(_0x32f6,0x78));var _0x632f=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x32f6[_0x25e7cb];return _0x375d92;};'use strict';var multer=require('multer');var util=require(_0x632f('0x0'));var path=require(_0x632f('0x1'));var timeout=require(_0x632f('0x2'));var express=require(_0x632f('0x3'));var router=express[_0x632f('0x4')]();var fs_extra=require(_0x632f('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x632f('0x6'));var controller=require(_0x632f('0x7'));router[_0x632f('0x8')]('/',auth[_0x632f('0x9')](),controller[_0x632f('0xa')]);router[_0x632f('0x8')]('/describe',auth[_0x632f('0x9')](),controller[_0x632f('0xb')]);router[_0x632f('0x8')](_0x632f('0xc'),auth[_0x632f('0x9')](),controller[_0x632f('0xd')]);router[_0x632f('0xe')]('/',auth['isAuthenticated'](),controller[_0x632f('0xf')]);router[_0x632f('0x10')](_0x632f('0xc'),auth[_0x632f('0x9')](),controller[_0x632f('0x11')]);router['delete'](_0x632f('0xc'),auth[_0x632f('0x9')](),controller[_0x632f('0x12')]);module[_0x632f('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 4b6453c..fd939e2 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 _0xcb91=['INTEGER','BOOLEAN','ENUM','squared','rounded','We\x20are\x20here!','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Type\x20a\x20message','Send','Skip','thumb','star','stringify','input','name','text','onlineForm','parse','getDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','exports','STRING','address','email','Agent','#011F6A','#ffffff'];(function(_0x3124f8,_0x1a8b23){var _0x5bab5f=function(_0x18b09b){while(--_0x18b09b){_0x3124f8['push'](_0x3124f8['shift']());}};_0x5bab5f(++_0x1a8b23);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x231b2e,_0x2a33f9){_0x231b2e=_0x231b2e-0x0;var _0x3feb2a=_0xcb91[_0x231b2e];return _0x3feb2a;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x1cb9('0x0')]={'name':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![],'unique':_0x1cb9('0x2')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x3')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x1cb9('0x3')},'key':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x1cb9('0x4')},'customerAlias':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1cb9('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1cb9('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x1cb9('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x1cb9('0x1')]},'animation':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x1cb9('0x9')]('rounded',_0x1cb9('0xa')),'defaultValue':_0x1cb9('0xb')},'header_online':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0xc')},'start_chat_button':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0xd')},'download_transcript':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x1cb9('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x1cb9('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x1cb9('0xf')]},'closingQuestion':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x10')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x11')},'noteTitle':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x12')},'placeholderMessage':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x13')},'closingMessage':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x1cb9('0x14')},'skipMessageButton':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x15')},'conditionAgreement':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x1cb9('0x9')]('star',_0x1cb9('0x16')),'defaultValue':_0x1cb9('0x17')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x1cb9('0x18')]({'items':[{'type':_0x1cb9('0x19'),'variable':null,'config':{'placeholder':_0x1cb9('0x1a'),'type':_0x1cb9('0x1b'),'required':!![]},'props':{'title':_0x1cb9('0x1a'),'helpText':''}},{'type':_0x1cb9('0x19'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x1cb9('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x1cb9('0x1c'))?JSON[_0x1cb9('0x1d')](this[_0x1cb9('0x1e')](_0x1cb9('0x1c'))):{};},'set':function(_0x43a100){return this['setDataValue'](_0x1cb9('0x1c'),JSON[_0x1cb9('0x18')](_0x43a100));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x1cb9('0x18')]({'items':[{'type':_0x1cb9('0x19'),'props':{'title':_0x1cb9('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x1cb9('0x3'),'type':_0x1cb9('0x3')},'variable':null},{'type':_0x1cb9('0x1f'),'config':{'placeholder':_0x1cb9('0x20')},'props':{'title':_0x1cb9('0x20'),'helpText':_0x1cb9('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0x1cb9('0x1e')]('offlineForm')?JSON[_0x1cb9('0x1d')](this['getDataValue'](_0x1cb9('0x22'))):{};},'set':function(_0x4efebc){return this[_0x1cb9('0x23')](_0x1cb9('0x22'),JSON[_0x1cb9('0x18')](_0x4efebc));}},'token':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x1cb9('0x1')]},'forwardOffline':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x24')},'offlineMessageBody':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x25')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x26')},'skipUnmanaged':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x15')},'sendUnmanaged':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x14')},'enableCustomerAttachment':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x1cb9('0xf')]},'showAgentAvatar':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x1cb9('0x1')]},'notificationTemplate':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':function(){return _0x1cb9('0x27');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x28')},'waitForTheAssignedAgent':{'type':Sequelize[_0x1cb9('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x29')},'verticalAlignment':{'type':Sequelize[_0x1cb9('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x2a')},'defaultTitle':{'type':Sequelize[_0x1cb9('0x1')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1cb9('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1cb9('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x2b')},'systemAvatar':{'type':Sequelize[_0x1cb9('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![],'comment':_0x1cb9('0x2c'),'set':function(_0x7a0d8b){if(!_0x7a0d8b)this[_0x1cb9('0x23')](_0x1cb9('0x2d'),null);this[_0x1cb9('0x23')](_0x1cb9('0x2e'),_0x7a0d8b);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x1cb9('0x1')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x1cb9('0x2f');}},'vidaooMetadata':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x1cb9('0xf')]}}; \ No newline at end of file +var _0xb903=['BOOLEAN','Feedback','star','thumb','INTEGER','TEXT','stringify','input','text','name','parse','getDataValue','onlineForm','textarea','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','CHAT','alternate','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','ENUM','rounded','Chat','Contact\x20us','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Thanks\x20you\x20for\x20your\x20time!','Send','Skip'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xb903,0x185));var _0x3b90=function(_0x54ae70,_0x16e7b1){_0x54ae70=_0x54ae70-0x0;var _0x3b3701=_0xb903[_0x54ae70];return _0x3b3701;};'use strict';var Sequelize=require(_0x3b90('0x0'));var rs=require(_0x3b90('0x1'));module[_0x3b90('0x2')]={'name':{'type':Sequelize[_0x3b90('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3b90('0x4')},'description':{'type':Sequelize[_0x3b90('0x3')]},'mapKey':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':_0x3b90('0x5')},'mapKeyOffline':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':_0x3b90('0x5')},'key':{'type':Sequelize[_0x3b90('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x3b90('0x6')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3b90('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x3b90('0x3')],'allowNull':![],'defaultValue':_0x3b90('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x3b90('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x3b90('0x8')](_0x3b90('0x9'),'squared'),'defaultValue':_0x3b90('0x9')},'header_online':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':_0x3b90('0xa')},'offline_chat_button':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':'Send'},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x3b90('0xb')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':_0x3b90('0xc')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':_0x3b90('0xd')},'formSubmitSuccessMessage':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':_0x3b90('0xe')},'formSubmitFailureMessage':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x3b90('0xf')},'placeholderMessage':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':_0x3b90('0x10')},'closingMessageButton':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':_0x3b90('0x11')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x3b90('0x12')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x3b90('0x13')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x3b90('0x13')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':_0x3b90('0x14')},'ratingType':{'type':Sequelize[_0x3b90('0x8')](_0x3b90('0x15'),_0x3b90('0x16')),'defaultValue':_0x3b90('0x15')},'ratingStarsNumber':{'type':Sequelize[_0x3b90('0x17')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x3b90('0x18')],'defaultValue':function(){return JSON[_0x3b90('0x19')]({'items':[{'type':_0x3b90('0x1a'),'variable':null,'config':{'placeholder':'name','type':_0x3b90('0x1b'),'required':!![]},'props':{'title':_0x3b90('0x1c'),'helpText':''}},{'type':_0x3b90('0x1a'),'props':{'title':_0x3b90('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x3b90('0x5'),'type':_0x3b90('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue']('onlineForm')?JSON[_0x3b90('0x1d')](this[_0x3b90('0x1e')](_0x3b90('0x1f'))):{};},'set':function(_0x2ffa1a){return this['setDataValue'](_0x3b90('0x1f'),JSON[_0x3b90('0x19')](_0x2ffa1a));}},'offlineForm':{'type':Sequelize[_0x3b90('0x18')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x3b90('0x1a'),'props':{'title':_0x3b90('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x3b90('0x5'),'type':_0x3b90('0x5')},'variable':null},{'type':_0x3b90('0x20'),'config':{'placeholder':_0x3b90('0x21')},'props':{'title':'Comments','helpText':_0x3b90('0x22')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x3b90('0x23'))?JSON[_0x3b90('0x1d')](this[_0x3b90('0x1e')](_0x3b90('0x23'))):{};},'set':function(_0xd515bd){return this[_0x3b90('0x24')](_0x3b90('0x23'),JSON[_0x3b90('0x19')](_0xd515bd));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x3b90('0x13')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x3b90('0x13')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x3b90('0x13')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x3b90('0x3')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':_0x3b90('0x25')},'waitingMessage':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x3b90('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0x3b90('0x13')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x3b90('0x27')},'skipUnmanaged':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':_0x3b90('0x12')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x3b90('0x13')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x3b90('0x13')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x3b90('0x18')]},'showAgentAvatar':{'type':Sequelize[_0x3b90('0x13')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x3b90('0x28');}},'notificationSound':{'type':Sequelize[_0x3b90('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':_0x3b90('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0x3b90('0x17')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x3b90('0x17')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0x3b90('0x2a')},'messagesAlignment':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':_0x3b90('0x2b')},'defaultTitle':{'type':Sequelize[_0x3b90('0x3')]},'customerAvatar':{'type':Sequelize[_0x3b90('0x18')]},'showCustomerAvatar':{'type':Sequelize[_0x3b90('0x13')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x3b90('0x17')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3b90('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x3b90('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3b90('0x17')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3b90('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3b90('0x17')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':_0x3b90('0x2d')},'systemAvatar':{'type':Sequelize[_0x3b90('0x18')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3b90('0x17')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x3b90('0x13')],'defaultValue':![],'comment':_0x3b90('0x2e'),'set':function(_0x40ce3a){if(!_0x40ce3a)this[_0x3b90('0x24')](_0x3b90('0x2f'),null);this[_0x3b90('0x24')](_0x3b90('0x30'),_0x40ce3a);}},'vidaooEscalation':{'type':Sequelize[_0x3b90('0x13')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x3b90('0x3')]},'vidaooTopic':{'type':Sequelize[_0x3b90('0x3')],'allowNull':![],'defaultValue':_0x3b90('0x31')},'vidaooNote':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':function(){return _0x3b90('0x32');}},'vidaooMetadata':{'type':Sequelize[_0x3b90('0x18')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x3b90('0x13')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x3b90('0x18')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index cb77513..53aaa0b 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 _0x0c44=['MailAccountId','toPairsIn','mapValues','email','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','getInteractions','Contact','fullname','internal','Tag','tag','Command','iftime\x20%s,%s','interval','timezone','iftime\x20%s','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','OFFLINE','inspect','getSnippet','Intervals','custom','License','increment','chatLicenseExceeded','Interval','push','some','server/files/chat/iframe.ejs','utf8','remote','x-real-ip','connection','remoteAddress','replace','render','alignment','verticalAlignment','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','priority','finally','getApplications','addProactiveActions','chatProactiveAction','omit','ChatProactiveAction','getProactiveActions','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Attachment','Attachments','addAgents','emit','userChatWebsite:remove','getAgents','bluebird','mustache','util','path','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','./chatWebsite.socket','register','html-to-text','jayson/promise','client','http','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','get','ChatWebsites','UserProfileResource','destroy','stack','index','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','type','key','model','map','name','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','body','ChatWebsiteId','Disposition','hasOwnProperty','merge','removeDispositions','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','ids','addLogo','file','filename','addAvatar','agentAvatar','addSystemAvatar','systemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','sitepic','../../config/license/util','getLicense','isNil','existsSync','server/files/images/logos/','root','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','customerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','user-agent-parser','setUA','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','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','DESC','ChatApplication','Applications','list','applications','asc','account','Contacts','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','%s\x20%s','device','vendor','threadId','externalUrl','interaction','ChatInteraction','spread','messageId','created','autoclose','close','unmanaged','*,*,*,*','ChatMessage','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','offline','files','send','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','ListId','readFileSync','server/files/templates/chatOfflineMessage.ejs','toPairs','offlineMessageBody','fromString','originalname','mimetype','server','attachments','offline-chat','basename','openNewInteraction','transaction','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','format','\x22%s\x22\x20<%s>','offlineMessageSubject'];(function(_0x377937,_0x35c135){var _0x3c8c93=function(_0xc29357){while(--_0xc29357){_0x377937['push'](_0x377937['shift']());}};_0x3c8c93(++_0x35c135);}(_0x0c44,0x17e));var _0x40c4=function(_0x451fc1,_0x5f4025){_0x451fc1=_0x451fc1-0x0;var _0x420837=_0x0c44[_0x451fc1];return _0x420837;};'use strict';var BPromise=require(_0x40c4('0x0'));var Mustache=require(_0x40c4('0x1'));var util=require(_0x40c4('0x2'));var path=require(_0x40c4('0x3'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x40c4('0x4'));var _=require(_0x40c4('0x5'));var querystring=require(_0x40c4('0x6'));var Redis=require(_0x40c4('0x7'));var qs=require(_0x40c4('0x8'));var logger=require(_0x40c4('0x9'))(_0x40c4('0xa'));var config=require('../../config/environment');var db=require(_0x40c4('0xb'))['db'];config[_0x40c4('0xc')]=_[_0x40c4('0xd')](config[_0x40c4('0xc')],{'host':_0x40c4('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x40c4('0xc')]));require(_0x40c4('0xf'))[_0x40c4('0x10')](socket);var htmlToText=require(_0x40c4('0x11'));var jayson=require(_0x40c4('0x12'));var client=jayson[_0x40c4('0x13')][_0x40c4('0x14')]({'port':0x232c});var client9002=jayson[_0x40c4('0x13')][_0x40c4('0x14')]({'port':0x232a});var client9003=jayson[_0x40c4('0x13')][_0x40c4('0x14')]({'port':0x232b});var client9001=jayson['client'][_0x40c4('0x14')]({'port':0x2329});function respondWithRpcPromise(_0x2c4364,_0xfe8913,_0xddf19c,_0x99f360){return new BPromise(function(_0x477c42,_0x668560){var _0x449f85=_0x99f360||client;return _0x449f85['request'](_0x2c4364,_0xddf19c)[_0x40c4('0x15')](function(_0x431d98){logger[_0x40c4('0x16')](_0x40c4('0x17'),_0xfe8913,_0x40c4('0x18'));logger[_0x40c4('0x19')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0xfe8913,_0x40c4('0x18'),JSON[_0x40c4('0x1a')](_0x431d98));if(_0x431d98[_0x40c4('0x1b')]){if(_0x431d98[_0x40c4('0x1b')][_0x40c4('0x1c')]===0x1f4){logger[_0x40c4('0x1b')](_0x40c4('0x17'),_0xfe8913,_0x431d98['error'][_0x40c4('0x1d')]);return _0x668560(_0x431d98[_0x40c4('0x1b')][_0x40c4('0x1d')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0xfe8913,_0x431d98['error'][_0x40c4('0x1d')]);return _0x477c42(_0x431d98[_0x40c4('0x1b')][_0x40c4('0x1d')]);}else{logger['info'](_0x40c4('0x17'),_0xfe8913,_0x40c4('0x18'));_0x477c42(_0x431d98[_0x40c4('0x1e')][_0x40c4('0x1d')]);}})['catch'](function(_0x373293){logger[_0x40c4('0x1b')](_0x40c4('0x17'),_0xfe8913,_0x373293);_0x668560(_0x373293);});});}function respondWithStatusCode(_0x10f123,_0x3d5f44){_0x3d5f44=_0x3d5f44||0xcc;return function(_0x3c9bf7){if(_0x3c9bf7){return _0x10f123[_0x40c4('0x1f')](_0x3d5f44);}return _0x10f123[_0x40c4('0x20')](_0x3d5f44)[_0x40c4('0x21')]();};}function respondWithResult(_0x1246ee,_0x3bcb51){_0x3bcb51=_0x3bcb51||0xc8;return function(_0x15e01e){if(_0x15e01e){return _0x1246ee['status'](_0x3bcb51)[_0x40c4('0x22')](_0x15e01e);}};}function respondWithFilteredResult(_0x4d5840,_0x2863c1){return function(_0x3d1eff){if(_0x3d1eff){var _0x44d295=typeof _0x2863c1[_0x40c4('0x23')]===_0x40c4('0x24')&&typeof _0x2863c1[_0x40c4('0x25')]===_0x40c4('0x24');var _0x2b360b=_0x3d1eff[_0x40c4('0x26')];var _0x9553d1=_0x44d295?0x0:_0x2863c1[_0x40c4('0x23')];var _0x527e56=_0x44d295?_0x3d1eff[_0x40c4('0x26')]:_0x2863c1[_0x40c4('0x23')]+_0x2863c1[_0x40c4('0x25')];var _0x1e6a8a;if(_0x527e56>=_0x2b360b){_0x527e56=_0x2b360b;_0x1e6a8a=0xc8;}else{_0x1e6a8a=0xce;}_0x4d5840['status'](_0x1e6a8a);return _0x4d5840[_0x40c4('0x27')](_0x40c4('0x28'),_0x9553d1+'-'+_0x527e56+'/'+_0x2b360b)[_0x40c4('0x22')](_0x3d1eff);}return null;};}function saveUpdates(_0x14fe73){return function(_0x3b85c5){if(_0x3b85c5){return _0x3b85c5[_0x40c4('0x29')](_0x14fe73)['then'](function(_0x32c7ad){return _0x32c7ad;});}return null;};}function removeEntity(_0x86ad81){return function(_0x6cc6f0){if(_0x6cc6f0){return _0x6cc6f0['destroy']()[_0x40c4('0x15')](function(){var _0x5b3145=_0x6cc6f0[_0x40c4('0x2a')]({'plain':!![]});var _0x95f156=_0x40c4('0x2b');return db[_0x40c4('0x2c')][_0x40c4('0x2d')]({'where':{'type':_0x95f156,'resourceId':_0x5b3145['id']}})[_0x40c4('0x15')](function(){return _0x6cc6f0;});})[_0x40c4('0x15')](function(){_0x86ad81[_0x40c4('0x20')](0xcc)[_0x40c4('0x21')]();});}};}function handleEntityNotFound(_0x8fa61c){return function(_0x40bd6f){if(!_0x40bd6f){_0x8fa61c[_0x40c4('0x1f')](0x194);}return _0x40bd6f;};}function handleError(_0x4a744c,_0x1b5576){_0x1b5576=_0x1b5576||0x1f4;return function(_0x2ade6e){logger[_0x40c4('0x1b')](_0x2ade6e[_0x40c4('0x2e')]);if(_0x2ade6e['name']){delete _0x2ade6e['name'];}_0x4a744c[_0x40c4('0x20')](_0x1b5576)['send'](_0x2ade6e);};}exports[_0x40c4('0x2f')]=function(_0x40c0bb,_0x402109){var _0x2d0bfb={'include':[{'model':db[_0x40c4('0x30')],'as':_0x40c4('0x31')}]},_0x146aea={},_0x1d9a79={'count':0x0,'rows':[]};var _0x21b452=_['map'](db[_0x40c4('0x32')][_0x40c4('0x33')],function(_0x25eff7){return{'name':_0x25eff7[_0x40c4('0x34')],'type':_0x25eff7[_0x40c4('0x35')][_0x40c4('0x36')]};});_0x146aea[_0x40c4('0x37')]=_[_0x40c4('0x38')](_0x21b452,_0x40c4('0x39'));_0x146aea['query']=_[_0x40c4('0x3a')](_0x40c0bb[_0x40c4('0x3b')]);_0x146aea[_0x40c4('0x3c')]=_[_0x40c4('0x3d')](_0x146aea[_0x40c4('0x37')],_0x146aea['query']);_0x2d0bfb[_0x40c4('0x3e')]=_['intersection'](_0x146aea['model'],qs['fields'](_0x40c0bb[_0x40c4('0x3b')][_0x40c4('0x3f')]));_0x2d0bfb['attributes']=_0x2d0bfb['attributes'][_0x40c4('0x40')]?_0x2d0bfb['attributes']:_0x146aea[_0x40c4('0x37')];if(!_0x40c0bb[_0x40c4('0x3b')]['hasOwnProperty'](_0x40c4('0x41'))){_0x2d0bfb[_0x40c4('0x25')]=qs[_0x40c4('0x25')](_0x40c0bb[_0x40c4('0x3b')]['limit']);_0x2d0bfb[_0x40c4('0x23')]=qs[_0x40c4('0x23')](_0x40c0bb[_0x40c4('0x3b')][_0x40c4('0x23')]);}_0x2d0bfb[_0x40c4('0x42')]=qs[_0x40c4('0x43')](_0x40c0bb['query'][_0x40c4('0x43')]);_0x2d0bfb['where']=qs[_0x40c4('0x3c')](_[_0x40c4('0x44')](_0x40c0bb['query'],_0x146aea['filters']),_0x21b452);if(_0x40c0bb[_0x40c4('0x3b')][_0x40c4('0x45')]){_0x2d0bfb[_0x40c4('0x46')]=_['merge'](_0x2d0bfb[_0x40c4('0x46')],{'$or':_['map'](_0x21b452,function(_0x283a78){if(_0x283a78['type']!==_0x40c4('0x47')){var _0x5ee607={};_0x5ee607[_0x283a78['name']]={'$like':'%'+_0x40c0bb[_0x40c4('0x3b')][_0x40c4('0x45')]+'%'};return _0x5ee607;}})});}_0x2d0bfb=_['merge']({},_0x2d0bfb,_0x40c0bb[_0x40c4('0x48')]);var _0x4586f1={'where':_0x2d0bfb['where']};return db[_0x40c4('0x32')][_0x40c4('0x26')](_0x4586f1)[_0x40c4('0x15')](function(_0x2972c2){_0x1d9a79['count']=_0x2972c2;if(_0x40c0bb['query'][_0x40c4('0x49')]){_0x2d0bfb['include']=[{'all':!![]}];}return db[_0x40c4('0x32')][_0x40c4('0x4a')](_0x2d0bfb);})['then'](function(_0x234af2){_0x1d9a79[_0x40c4('0x4b')]=_0x234af2;return _0x1d9a79;})[_0x40c4('0x15')](respondWithFilteredResult(_0x402109,_0x2d0bfb))[_0x40c4('0x4c')](handleError(_0x402109,null));};exports['show']=function(_0x2fa6fd,_0x55190a){var _0x4a8a41={'raw':![],'where':{'id':_0x2fa6fd[_0x40c4('0x4d')]['id']},'include':[{'model':db[_0x40c4('0x30')],'as':_0x40c4('0x31')}]},_0x5786b9={};_0x5786b9[_0x40c4('0x37')]=_[_0x40c4('0x3a')](db[_0x40c4('0x32')]['rawAttributes']);_0x5786b9[_0x40c4('0x3b')]=_[_0x40c4('0x3a')](_0x2fa6fd[_0x40c4('0x3b')]);_0x5786b9[_0x40c4('0x3c')]=_[_0x40c4('0x3d')](_0x5786b9['model'],_0x5786b9['query']);_0x4a8a41[_0x40c4('0x3e')]=_['intersection'](_0x5786b9[_0x40c4('0x37')],qs['fields'](_0x2fa6fd['query'][_0x40c4('0x3f')]));_0x4a8a41[_0x40c4('0x3e')]=_0x4a8a41[_0x40c4('0x3e')][_0x40c4('0x40')]?_0x4a8a41['attributes']:_0x5786b9[_0x40c4('0x37')];if(_0x2fa6fd['query'][_0x40c4('0x49')]){_0x4a8a41[_0x40c4('0x4e')]=[{'all':!![]}];}_0x4a8a41=_['merge']({},_0x4a8a41,_0x2fa6fd[_0x40c4('0x48')]);return db['ChatWebsite'][_0x40c4('0x4f')](_0x4a8a41)[_0x40c4('0x15')](handleEntityNotFound(_0x55190a,null))[_0x40c4('0x15')](respondWithResult(_0x55190a,null))[_0x40c4('0x4c')](handleError(_0x55190a,null));};exports[_0x40c4('0x50')]=function(_0x35911e,_0x5344fa){return db[_0x40c4('0x32')]['create'](_0x35911e['body'],{})[_0x40c4('0x15')](function(_0x19ddea){var _0x84956c=_0x35911e[_0x40c4('0x51')]['get']({'plain':!![]});if(!_0x84956c)throw new Error(_0x40c4('0x52'));if(_0x84956c[_0x40c4('0x53')]===_0x40c4('0x51')){var _0x3c0cfd=_0x19ddea[_0x40c4('0x2a')]({'plain':!![]});var _0x2e2f60=_0x40c4('0x2b');return db['UserProfileSection'][_0x40c4('0x4f')]({'where':{'name':_0x2e2f60,'userProfileId':_0x84956c[_0x40c4('0x54')]},'raw':!![]})[_0x40c4('0x15')](function(_0x18655c){if(_0x18655c&&_0x18655c[_0x40c4('0x55')]===0x0){return db[_0x40c4('0x2c')][_0x40c4('0x50')]({'name':_0x3c0cfd['name'],'resourceId':_0x3c0cfd['id'],'type':_0x18655c[_0x40c4('0x39')],'sectionId':_0x18655c['id']},{})[_0x40c4('0x15')](function(){return _0x19ddea;});}else{return _0x19ddea;}})[_0x40c4('0x4c')](function(_0x392ddd){logger['error'](_0x40c4('0x56'),_0x392ddd);throw _0x392ddd;});}return _0x19ddea;})[_0x40c4('0x15')](respondWithResult(_0x5344fa,0xc9))[_0x40c4('0x4c')](handleError(_0x5344fa,null));};exports['update']=function(_0x3348c3,_0x4e4591){if(_0x3348c3['body']['id']){delete _0x3348c3['body']['id'];}return db[_0x40c4('0x32')]['find']({'where':{'id':_0x3348c3[_0x40c4('0x4d')]['id']},'include':[{'model':db[_0x40c4('0x30')],'as':_0x40c4('0x31')}]})[_0x40c4('0x15')](handleEntityNotFound(_0x4e4591,null))['then'](saveUpdates(_0x3348c3['body'],null))[_0x40c4('0x15')](respondWithResult(_0x4e4591,null))[_0x40c4('0x4c')](handleError(_0x4e4591,null));};exports[_0x40c4('0x2d')]=function(_0xbf3782,_0x44238c){return db['ChatWebsite'][_0x40c4('0x4f')]({'where':{'id':_0xbf3782['params']['id']}})['then'](handleEntityNotFound(_0x44238c,null))[_0x40c4('0x15')](removeEntity(_0x44238c,null))[_0x40c4('0x4c')](handleError(_0x44238c,null));};exports[_0x40c4('0x57')]=function(_0x43862a,_0x3393a7){return db['ChatWebsite'][_0x40c4('0x57')]()[_0x40c4('0x15')](respondWithResult(_0x3393a7,null))['catch'](handleError(_0x3393a7,null));};exports[_0x40c4('0x58')]=function(_0x50e962,_0x57992a){if(_0x50e962['body']['id']){delete _0x50e962['body']['id'];}return db[_0x40c4('0x32')][_0x40c4('0x4f')]({'where':{'id':_0x50e962['params']['id']}})[_0x40c4('0x15')](handleEntityNotFound(_0x57992a,null))['then'](function(_0x142bcf){if(_0x142bcf){_0x50e962[_0x40c4('0x59')][_0x40c4('0x5a')]=_0x142bcf['id'];return db[_0x40c4('0x5b')]['create'](_0x50e962[_0x40c4('0x59')]);}})[_0x40c4('0x15')](respondWithResult(_0x57992a,null))[_0x40c4('0x4c')](handleError(_0x57992a,null));};exports['getDispositions']=function(_0x17638f,_0x5e408d){var _0x3b6885={'raw':![],'where':{}};var _0x3c9646={};var _0x27ff20={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x17638f[_0x40c4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5e408d,null))[_0x40c4('0x15')](function(_0x3f4f52){if(_0x3f4f52){_0x3c9646[_0x40c4('0x37')]=_[_0x40c4('0x3a')](db[_0x40c4('0x5b')][_0x40c4('0x33')]);_0x3c9646['query']=_['keys'](_0x17638f['query']);_0x3c9646[_0x40c4('0x3c')]=_['intersection'](_0x3c9646[_0x40c4('0x37')],_0x3c9646[_0x40c4('0x3b')]);_0x3b6885['attributes']=_['intersection'](_0x3c9646['model'],qs[_0x40c4('0x3f')](_0x17638f['query'][_0x40c4('0x3f')]));_0x3b6885[_0x40c4('0x3e')]=_0x3b6885['attributes'][_0x40c4('0x40')]?_0x3b6885[_0x40c4('0x3e')]:_0x3c9646[_0x40c4('0x37')];if(!_0x17638f[_0x40c4('0x3b')][_0x40c4('0x5c')](_0x40c4('0x41'))){_0x3b6885['limit']=qs[_0x40c4('0x25')](_0x17638f['query'][_0x40c4('0x25')]);_0x3b6885['offset']=qs['offset'](_0x17638f[_0x40c4('0x3b')][_0x40c4('0x23')]);}_0x3b6885[_0x40c4('0x42')]=qs[_0x40c4('0x43')](_0x17638f[_0x40c4('0x3b')][_0x40c4('0x43')]);_0x3b6885[_0x40c4('0x46')]=qs['filters'](_[_0x40c4('0x44')](_0x17638f['query'],_0x3c9646[_0x40c4('0x3c')]));_0x3b6885['where'][_0x40c4('0x5a')]=_0x3f4f52['id'];if(_0x17638f['query']['filter']){_0x3b6885[_0x40c4('0x46')]=_['merge'](_0x3b6885['where'],{'$or':_[_0x40c4('0x38')](_0x3b6885[_0x40c4('0x3e')],function(_0x2d84ba){var _0x33e8f8={};_0x33e8f8[_0x2d84ba]={'$like':'%'+_0x17638f[_0x40c4('0x3b')][_0x40c4('0x45')]+'%'};return _0x33e8f8;})});}_0x3b6885=_[_0x40c4('0x5d')]({},_0x3b6885,_0x17638f[_0x40c4('0x48')]);return db[_0x40c4('0x5b')]['count']({'where':_0x3b6885[_0x40c4('0x46')]})[_0x40c4('0x15')](function(_0x2b9a05){_0x27ff20[_0x40c4('0x26')]=_0x2b9a05;if(_0x17638f[_0x40c4('0x3b')][_0x40c4('0x49')]){_0x3b6885['include']=[{'all':!![]}];}return db[_0x40c4('0x5b')][_0x40c4('0x4a')](_0x3b6885);})[_0x40c4('0x15')](function(_0x106fd4){_0x27ff20[_0x40c4('0x4b')]=_0x106fd4;return _0x27ff20;});}})[_0x40c4('0x15')](respondWithFilteredResult(_0x5e408d,_0x3b6885))[_0x40c4('0x4c')](handleError(_0x5e408d,null));};exports[_0x40c4('0x5e')]=function(_0x2a9ab3,_0x257d1f){return db[_0x40c4('0x32')][_0x40c4('0x4f')]({'where':{'id':_0x2a9ab3[_0x40c4('0x4d')]['id']}})[_0x40c4('0x15')](handleEntityNotFound(_0x257d1f,null))[_0x40c4('0x15')](function(_0x3e654f){if(_0x3e654f){return _0x3e654f[_0x40c4('0x5e')](_0x2a9ab3[_0x40c4('0x3b')]['ids']);}})[_0x40c4('0x15')](respondWithStatusCode(_0x257d1f,null))['catch'](handleError(_0x257d1f,null));};exports[_0x40c4('0x5f')]=function(_0x40e696,_0x401104){if(_0x40e696[_0x40c4('0x59')]['id']){delete _0x40e696['body']['id'];}return db[_0x40c4('0x32')][_0x40c4('0x4f')]({'where':{'id':_0x40e696['params']['id']}})['then'](handleEntityNotFound(_0x401104,null))['then'](function(_0x239516){if(_0x239516){_0x40e696['body'][_0x40c4('0x5a')]=_0x239516['id'];return db['CannedAnswer'][_0x40c4('0x50')](_0x40e696[_0x40c4('0x59')]);}})[_0x40c4('0x15')](respondWithResult(_0x401104,null))[_0x40c4('0x4c')](handleError(_0x401104,null));};exports[_0x40c4('0x60')]=function(_0x4639f2,_0x5a7139){var _0x49753a={'raw':![],'where':{}};var _0x52d5ab={};var _0x1f673d={'count':0x0,'rows':[]};return db[_0x40c4('0x32')][_0x40c4('0x61')]({'where':{'id':_0x4639f2[_0x40c4('0x4d')]['id']}})[_0x40c4('0x15')](handleEntityNotFound(_0x5a7139,null))['then'](function(_0x37359c){if(_0x37359c){_0x52d5ab[_0x40c4('0x37')]=_[_0x40c4('0x3a')](db[_0x40c4('0x62')]['rawAttributes']);_0x52d5ab[_0x40c4('0x3b')]=_[_0x40c4('0x3a')](_0x4639f2[_0x40c4('0x3b')]);_0x52d5ab[_0x40c4('0x3c')]=_[_0x40c4('0x3d')](_0x52d5ab['model'],_0x52d5ab[_0x40c4('0x3b')]);_0x49753a['attributes']=_[_0x40c4('0x3d')](_0x52d5ab['model'],qs[_0x40c4('0x3f')](_0x4639f2[_0x40c4('0x3b')][_0x40c4('0x3f')]));_0x49753a[_0x40c4('0x3e')]=_0x49753a[_0x40c4('0x3e')]['length']?_0x49753a['attributes']:_0x52d5ab[_0x40c4('0x37')];if(!_0x4639f2[_0x40c4('0x3b')][_0x40c4('0x5c')](_0x40c4('0x41'))){_0x49753a['limit']=qs[_0x40c4('0x25')](_0x4639f2['query']['limit']);_0x49753a[_0x40c4('0x23')]=qs['offset'](_0x4639f2[_0x40c4('0x3b')][_0x40c4('0x23')]);}_0x49753a[_0x40c4('0x42')]=qs[_0x40c4('0x43')](_0x4639f2[_0x40c4('0x3b')][_0x40c4('0x43')]);_0x49753a['where']=qs[_0x40c4('0x3c')](_[_0x40c4('0x44')](_0x4639f2[_0x40c4('0x3b')],_0x52d5ab[_0x40c4('0x3c')]));_0x49753a[_0x40c4('0x46')]['ChatWebsiteId']=_0x37359c['id'];if(_0x4639f2[_0x40c4('0x3b')][_0x40c4('0x45')]){_0x49753a[_0x40c4('0x46')]=_[_0x40c4('0x5d')](_0x49753a['where'],{'$or':_[_0x40c4('0x38')](_0x49753a['attributes'],function(_0xe32bac){var _0x532377={};_0x532377[_0xe32bac]={'$like':'%'+_0x4639f2[_0x40c4('0x3b')][_0x40c4('0x45')]+'%'};return _0x532377;})});}_0x49753a=_[_0x40c4('0x5d')]({},_0x49753a,_0x4639f2[_0x40c4('0x48')]);return db[_0x40c4('0x62')][_0x40c4('0x26')]({'where':_0x49753a[_0x40c4('0x46')]})[_0x40c4('0x15')](function(_0x2ef7bb){_0x1f673d[_0x40c4('0x26')]=_0x2ef7bb;if(_0x4639f2[_0x40c4('0x3b')][_0x40c4('0x49')]){_0x49753a['include']=[{'all':!![]}];}return db[_0x40c4('0x62')]['findAll'](_0x49753a);})[_0x40c4('0x15')](function(_0x92f917){_0x1f673d[_0x40c4('0x4b')]=_0x92f917;return _0x1f673d;});}})[_0x40c4('0x15')](respondWithFilteredResult(_0x5a7139,_0x49753a))[_0x40c4('0x4c')](handleError(_0x5a7139,null));};exports[_0x40c4('0x63')]=function(_0x2f5978,_0x3207b3){return db[_0x40c4('0x32')]['find']({'where':{'id':_0x2f5978['params']['id']}})['then'](handleEntityNotFound(_0x3207b3,null))['then'](function(_0x4d4e90){if(_0x4d4e90){return _0x4d4e90['removeAnswers'](_0x2f5978['query'][_0x40c4('0x64')]);}})['then'](respondWithStatusCode(_0x3207b3,null))[_0x40c4('0x4c')](handleError(_0x3207b3,null));};exports[_0x40c4('0x65')]=function(_0x2a0147,_0x25ff91){_0x2a0147[_0x40c4('0x59')]['sitepic']=_0x2a0147[_0x40c4('0x66')][_0x40c4('0x67')];return db[_0x40c4('0x32')]['find']({'where':{'id':_0x2a0147[_0x40c4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x25ff91,null))[_0x40c4('0x15')](saveUpdates(_0x2a0147[_0x40c4('0x59')],null))[_0x40c4('0x15')](respondWithResult(_0x25ff91,null))[_0x40c4('0x4c')](handleError(_0x25ff91,null));};exports[_0x40c4('0x68')]=function(_0x559787,_0xa002e7){_0x559787['body'][_0x40c4('0x69')]=_0x559787['file']['filename'];return db['ChatWebsite'][_0x40c4('0x4f')]({'where':{'id':_0x559787[_0x40c4('0x4d')]['id']}})[_0x40c4('0x15')](handleEntityNotFound(_0xa002e7,null))['then'](saveUpdates(_0x559787['body'],null))[_0x40c4('0x15')](respondWithResult(_0xa002e7,null))[_0x40c4('0x4c')](handleError(_0xa002e7,null));};exports['addCustomerAvatar']=function(_0x3ea1b1,_0x3b0cce){_0x3ea1b1['body']['customerAvatar']=_0x3ea1b1[_0x40c4('0x66')][_0x40c4('0x67')];return db[_0x40c4('0x32')][_0x40c4('0x4f')]({'where':{'id':_0x3ea1b1['params']['id']}})[_0x40c4('0x15')](handleEntityNotFound(_0x3b0cce,null))[_0x40c4('0x15')](saveUpdates(_0x3ea1b1[_0x40c4('0x59')],null))[_0x40c4('0x15')](respondWithResult(_0x3b0cce,null))['catch'](handleError(_0x3b0cce,null));};exports[_0x40c4('0x6a')]=function(_0x582c84,_0x5adea4){_0x582c84[_0x40c4('0x59')][_0x40c4('0x6b')]=_0x582c84[_0x40c4('0x66')]['filename'];return db[_0x40c4('0x32')][_0x40c4('0x4f')]({'where':{'id':_0x582c84[_0x40c4('0x4d')]['id']}})[_0x40c4('0x15')](handleEntityNotFound(_0x5adea4,null))['then'](saveUpdates(_0x582c84[_0x40c4('0x59')],null))[_0x40c4('0x15')](respondWithResult(_0x5adea4,null))[_0x40c4('0x4c')](handleError(_0x5adea4,null));};exports[_0x40c4('0x6c')]=function(_0x337dd4,_0x47700c){var _0x227f7f=path[_0x40c4('0x6d')](config['root'],_0x40c4('0x6e'));var _0x7ffc11={'where':{'id':_0x337dd4[_0x40c4('0x4d')]['id']},'attributes':['id',_0x40c4('0x6f')],'raw':!![]};var _0x2a4fae=![];return require(_0x40c4('0x70'))[_0x40c4('0x71')]()[_0x40c4('0x15')](function(_0x29122f){if(_0x29122f){_0x2a4fae=_0x29122f['custom'];}})[_0x40c4('0x15')](function(){return db[_0x40c4('0x32')][_0x40c4('0x4f')](_0x7ffc11);})[_0x40c4('0x15')](handleEntityNotFound(_0x47700c,null))[_0x40c4('0x15')](function(_0x19946e){if(_0x19946e){if(!_[_0x40c4('0x72')](_0x19946e['sitepic'])){if(fs[_0x40c4('0x73')](path[_0x40c4('0x6d')](config['root'],_0x40c4('0x74'),_0x19946e[_0x40c4('0x6f')]))&&_0x2a4fae){_0x227f7f=path[_0x40c4('0x6d')](config[_0x40c4('0x75')],_0x40c4('0x74'),_0x19946e[_0x40c4('0x6f')]);}}return _0x47700c[_0x40c4('0x76')](_0x227f7f);}})[_0x40c4('0x4c')](handleError(_0x47700c,null));};exports['getAvatar']=function(_0xdcb110,_0x194438){var _0x407a2e=path[_0x40c4('0x6d')](config[_0x40c4('0x75')],_0x40c4('0x77'));var _0x32728f={'where':{'id':_0xdcb110[_0x40c4('0x4d')]['id']},'attributes':['id',_0x40c4('0x69')],'raw':!![]};return db['ChatWebsite'][_0x40c4('0x4f')](_0x32728f)[_0x40c4('0x15')](handleEntityNotFound(_0x194438,null))[_0x40c4('0x15')](function(_0x2ff028){if(_0x2ff028){if(!_[_0x40c4('0x72')](_0x2ff028[_0x40c4('0x69')])){if(fs['existsSync'](path[_0x40c4('0x6d')](config[_0x40c4('0x75')],_0x40c4('0x78'),_0x2ff028['agentAvatar']))){_0x407a2e=path[_0x40c4('0x6d')](config[_0x40c4('0x75')],_0x40c4('0x78'),_0x2ff028['agentAvatar']);}}return _0x194438['download'](_0x407a2e);}})[_0x40c4('0x4c')](handleError(_0x194438,null));};exports[_0x40c4('0x79')]=function(_0x576751,_0x563eee){var _0x1a6152=path['join'](config[_0x40c4('0x75')],'server/files/images/avatars/customer_avatar.png');var _0x2d986d={'where':{'id':_0x576751[_0x40c4('0x4d')]['id']},'attributes':['id',_0x40c4('0x7a'),_0x40c4('0x7b')],'raw':!![]};return db[_0x40c4('0x32')][_0x40c4('0x4f')](_0x2d986d)[_0x40c4('0x15')](handleEntityNotFound(_0x563eee,null))['then'](function(_0x2f44b0){if(_0x2f44b0){if(!_[_0x40c4('0x72')](_0x2f44b0['customerAvatar'])){if(fs[_0x40c4('0x73')](path[_0x40c4('0x6d')](config[_0x40c4('0x75')],'server/files/images/avatars/',_0x2f44b0[_0x40c4('0x7a')]))&&_0x2f44b0[_0x40c4('0x7b')]){_0x1a6152=path[_0x40c4('0x6d')](config[_0x40c4('0x75')],_0x40c4('0x78'),_0x2f44b0['customerAvatar']);}}return _0x563eee['download'](_0x1a6152);}})[_0x40c4('0x4c')](handleError(_0x563eee,null));};exports[_0x40c4('0x7c')]=function(_0x188a55,_0x467af1){var _0xa50ad2=path[_0x40c4('0x6d')](config[_0x40c4('0x75')],_0x40c4('0x7d'));var _0x19dd8a={'where':{'id':_0x188a55['params']['id']},'attributes':['id',_0x40c4('0x6b')],'raw':!![]};return db[_0x40c4('0x32')][_0x40c4('0x4f')](_0x19dd8a)['then'](handleEntityNotFound(_0x467af1,null))['then'](function(_0xa1f98b){if(_0xa1f98b){if(!_[_0x40c4('0x72')](_0xa1f98b[_0x40c4('0x6b')])){if(fs[_0x40c4('0x73')](path[_0x40c4('0x6d')](config[_0x40c4('0x75')],_0x40c4('0x78'),_0xa1f98b[_0x40c4('0x6b')]))){_0xa50ad2=path[_0x40c4('0x6d')](config[_0x40c4('0x75')],_0x40c4('0x78'),_0xa1f98b[_0x40c4('0x6b')]);}}return _0x467af1['download'](_0xa50ad2);}})[_0x40c4('0x4c')](handleError(_0x467af1,null));};exports['notify']=function(_0x5d73d5,_0x3b794e){var _0x5ad31c=require(_0x40c4('0x7e'));var _0x552179=new _0x5ad31c();var _0x17f071=_0x552179[_0x40c4('0x7f')](_0x5d73d5[_0x40c4('0x80')][_0x40c4('0x81')])[_0x40c4('0x82')]();var _0x4c57f1={'body':_0x5d73d5[_0x40c4('0x59')],'channel':_0x40c4('0x83')};var _0x5ae5a6=[];var _0x4130d1=[];var _0x3bc632={};var _0x2337cb=![];return db[_0x40c4('0x84')]['describe']()[_0x40c4('0x15')](function(_0x2a4ac6){if(!_0x2a4ac6){throw new db[(_0x40c4('0x85'))][(_0x40c4('0x86'))](_0x40c4('0x87'));}_0x5ae5a6=_[_0x40c4('0x88')](_['keys'](_0x2a4ac6),['createdAt',_0x40c4('0x89')]);_0x4130d1=_[_0x40c4('0x88')](_[_0x40c4('0x3a')](_0x2a4ac6),[_0x40c4('0x8a'),_0x40c4('0x89'),_0x40c4('0x8b'),'ListId']);if(_0x5d73d5[_0x40c4('0x59')]['id']){delete _0x5d73d5[_0x40c4('0x59')]['id'];}if(_['isNil'](_0x5d73d5['body'][_0x40c4('0x8c')])){throw new db[(_0x40c4('0x85'))][(_0x40c4('0x86'))](_0x40c4('0x8d'));}if(_[_0x40c4('0x72')](_0x5d73d5['body'][_0x40c4('0x59')])||_0x5d73d5[_0x40c4('0x59')]['body']===''){throw new db[(_0x40c4('0x85'))][(_0x40c4('0x86'))](_0x40c4('0x8e'));}if(_['isNil'](_0x5d73d5[_0x40c4('0x59')][_0x40c4('0x8f')])){throw new db[(_0x40c4('0x85'))]['ValidationError'](_0x40c4('0x90')+_0x4130d1);}if(!_[_0x40c4('0x91')](_0x4130d1,_0x5d73d5[_0x40c4('0x59')]['mapKey'])){throw new db['Sequelize'][(_0x40c4('0x86'))](_0x40c4('0x92')+_0x4130d1);}_0x3bc632[_0x5d73d5[_0x40c4('0x59')]['mapKey']]=_0x5d73d5['body'][_0x40c4('0x8c')];})[_0x40c4('0x15')](function(){return db['ChatWebsite'][_0x40c4('0x4f')]({'where':{'id':_0x5d73d5[_0x40c4('0x4d')]['id']},'include':[{'model':db[_0x40c4('0x93')],'as':_0x40c4('0x94'),'include':[{'model':db[_0x40c4('0x84')],'as':'Contacts','where':_0x3bc632,'limit':0x1,'order':[['updatedAt',_0x40c4('0x95')]]}]},{'model':db[_0x40c4('0x96')],'as':_0x40c4('0x97')}]});})['then'](handleEntityNotFound(_0x3b794e,null))[_0x40c4('0x15')](function(_0x49fcf9){if(_0x49fcf9&&_0x49fcf9[_0x40c4('0x94')]){_0x4c57f1['account']=_0x49fcf9;_0x4c57f1['applications']=_0x49fcf9[_0x40c4('0x97')];_0x4c57f1[_0x40c4('0x98')]=_0x49fcf9[_0x40c4('0x94')];_0x4c57f1[_0x40c4('0x99')]=_['orderBy'](_0x4c57f1[_0x40c4('0x99')],['priority'],[_0x40c4('0x9a')]);if(_0x4c57f1[_0x40c4('0x9b')][_0x40c4('0x97')]){delete _0x4c57f1['account']['Applications'];}if(_0x4c57f1[_0x40c4('0x9b')][_0x40c4('0x94')]&&_0x4c57f1[_0x40c4('0x9b')][_0x40c4('0x94')][_0x40c4('0x9c')][_0x40c4('0x40')]){return _0x4c57f1[_0x40c4('0x9b')][_0x40c4('0x94')][_0x40c4('0x9c')][0x0];}var _0x3ec92b=_['defaults'](_0x5d73d5['body'],{'firstName':_0x5d73d5['body'][_0x40c4('0x8c')],'ListId':_0x49fcf9['ListId']});_0x3ec92b[_0x5d73d5['body'][_0x40c4('0x8f')]]=_0x5d73d5['body'][_0x40c4('0x8c')];return db[_0x40c4('0x84')][_0x40c4('0x50')](_0x3ec92b,{'fields':_0x5ae5a6,'raw':!![]});}})['then'](handleEntityNotFound(_0x3b794e,null))[_0x40c4('0x15')](function(_0x616890){_0x4c57f1[_0x40c4('0x9d')]=_0x616890;var _0x20c926=_0x5d73d5[_0x40c4('0x59')][_0x40c4('0x9e')];if(_0x5d73d5['headers'][_0x40c4('0x9f')]){_0x20c926=_0x5d73d5[_0x40c4('0x80')][_0x40c4('0x9f')];}else if(_0x5d73d5['headers'][_0x40c4('0xa0')]){_0x20c926=_[_0x40c4('0xa1')](_0x5d73d5[_0x40c4('0x80')][_0x40c4('0xa0')][_0x40c4('0xa2')](','));}if(_0x616890){var _0x587865={'ContactId':_0x616890['id'],'ChatWebsiteId':_0x5d73d5['params']['id'],'from':(_0x616890[_0x40c4('0xa3')]||'')+'\x20'+(_0x616890[_0x40c4('0xa4')]||''),'customerIp':_0x20c926,'customerPort':_0x5d73d5[_0x40c4('0x80')][_0x40c4('0xa5')]?_0x5d73d5[_0x40c4('0x80')][_0x40c4('0xa5')]:null,'referer':_0x5d73d5[_0x40c4('0x59')][_0x40c4('0xa6')],'browserName':_0x17f071[_0x40c4('0xa7')]['name']&&_0x17f071[_0x40c4('0xa7')][_0x40c4('0xa8')]?util['format'](_0x40c4('0xa9'),_0x17f071['browser'][_0x40c4('0x39')],_0x17f071['browser']['version']):'unknown','browserVersion':_0x17f071[_0x40c4('0xa7')]['version']||'unknown','osName':util['format'](_0x40c4('0xa9'),_0x17f071['os'][_0x40c4('0x39')],_0x17f071['os']['version']),'osVersion':_0x17f071['os'][_0x40c4('0xa8')],'deviceModel':_0x17f071[_0x40c4('0xaa')][_0x40c4('0x37')]&&_0x17f071[_0x40c4('0xaa')][_0x40c4('0xab')]?util['format']('%s\x20%s\x20%s',_0x17f071['device'][_0x40c4('0x37')],_0x17f071['device'][_0x40c4('0xab')],_0x17f071['device'][_0x40c4('0x35')]):null,'deviceVendor':_0x17f071[_0x40c4('0xaa')][_0x40c4('0xab')],'deviceType':_0x17f071['device']['type'],'formData':JSON['stringify'](_0x5d73d5['body'])};var _0x7522c={'ChatWebsiteId':_0x5d73d5[_0x40c4('0x4d')]['id'],'closed':![]};if(_0x5d73d5[_0x40c4('0x59')][_0x40c4('0xac')]){_0x7522c[_0x40c4('0xac')]=_0x5d73d5[_0x40c4('0x59')][_0x40c4('0xac')];return db['ChatInteraction'][_0x40c4('0x4f')]({'where':_0x7522c})[_0x40c4('0x15')](function(_0x22c31e){if(_0x22c31e){return[_0x22c31e,![]];}_0x587865['threadId']=_0x5d73d5[_0x40c4('0x59')][_0x40c4('0xac')];_0x587865[_0x40c4('0xad')]=_0x5d73d5[_0x40c4('0x59')][_0x40c4('0xad')];return db['ChatInteraction'][_0x40c4('0x50')](_0x587865)[_0x40c4('0x15')](function(_0x5163c6){return[_0x5163c6,!![]];});});}_0x7522c['ContactId']=_0x616890['id'];if(_0x5d73d5['body'][_0x40c4('0xae')]&&_0x5d73d5[_0x40c4('0x59')]['interaction']['id']){_0x7522c['id']=_0x5d73d5['body'][_0x40c4('0xae')]['id'];return db[_0x40c4('0xaf')][_0x40c4('0x4f')]({'where':_0x7522c})['then'](function(_0x2f1550){if(_0x2f1550){return[_0x2f1550,![]];}return db[_0x40c4('0xaf')][_0x40c4('0x50')](_0x587865)[_0x40c4('0x15')](function(_0xdba345){return[_0xdba345,!![]];});});}return db[_0x40c4('0xaf')]['create'](_0x587865)[_0x40c4('0x15')](function(_0x3f48cd){return[_0x3f48cd,!![]];});}})[_0x40c4('0xb0')](function(_0x177be8,_0x478182){if(_0x177be8){_0x2337cb=_0x478182;if(!_0x478182){var _0x17fe5c={'from':(_0x4c57f1[_0x40c4('0x9d')][_0x40c4('0xa3')]||'')+'\x20'+(_0x4c57f1[_0x40c4('0x9d')][_0x40c4('0xa4')]||'')};if(_0x5d73d5[_0x40c4('0x59')][_0x40c4('0xac')]&&_0x5d73d5[_0x40c4('0x59')][_0x40c4('0xb1')]&&_0x5d73d5['body'][_0x40c4('0xac')]!=_0x5d73d5[_0x40c4('0x59')][_0x40c4('0xb1')]){_0x17fe5c[_0x40c4('0xac')]=_0x5d73d5['body'][_0x40c4('0xb1')];}return _0x177be8[_0x40c4('0x29')](_0x17fe5c);}else{return _0x177be8;}}})[_0x40c4('0x15')](function(_0xd38f05){_0x4c57f1[_0x40c4('0xae')]=_0xd38f05['get']({'plain':!![]});_0x4c57f1[_0x40c4('0xae')][_0x40c4('0xb2')]=_0x2337cb;if(_0x4c57f1[_0x40c4('0xae')][_0x40c4('0xb2')]){if(_0x4c57f1[_0x40c4('0x9b')][_0x40c4('0xb3')]){_0x4c57f1[_0x40c4('0x99')]['push']({'id':0x0,'priority':_0x4c57f1[_0x40c4('0x99')][_0x40c4('0x40')]+0x1,'app':_0x40c4('0xb4'),'appdata':_0x40c4('0xb5'),'interval':_0x40c4('0xb6')});}}return db[_0x40c4('0xb7')][_0x40c4('0x50')]({'body':_0x5d73d5['body']['body'],'ChatWebsiteId':_0x5d73d5[_0x40c4('0x4d')]['id'],'ChatInteractionId':_0xd38f05['id'],'direction':'in','ContactId':_0x4c57f1[_0x40c4('0x9d')]['id'],'AttachmentId':_0x5d73d5['body']['AttachmentId']});})[_0x40c4('0x15')](function(_0x5c3e7a){_0x4c57f1[_0x40c4('0x1d')]=_0x5c3e7a;if(_0x4c57f1[_0x40c4('0xae')][_0x40c4('0xb8')]){return db[_0x40c4('0xb9')][_0x40c4('0x4f')]({'attributes':['id',_0x40c4('0x39')],'where':{'id':_0x4c57f1['interaction'][_0x40c4('0xb8')]}})[_0x40c4('0x15')](function(_0x37f715){if(_0x37f715){_0x4c57f1[_0x40c4('0x99')]['unshift']({'id':0x0,'priority':0x0,'app':_0x40c4('0xba'),'appdata':_0x37f715[_0x40c4('0x39')]+','+(_0x4c57f1[_0x40c4('0x9b')][_0x40c4('0xbb')]||0xa),'interval':'*,*,*,*'});_0x4c57f1[_0x40c4('0xbc')]=!![];}return respondWithRpcPromise(_0x40c4('0xbd'),_0x40c4('0xbe'),_0x4c57f1);});}return respondWithRpcPromise(_0x40c4('0xbd'),'startRouting',_0x4c57f1);})[_0x40c4('0x15')](function(_0x113e7d){respondWithRpcPromise(_0x40c4('0xbf'),_0x40c4('0xbf'),{'event':_0x40c4('0xc0'),'message':_0x113e7d},client9002);return _0x113e7d;})['then'](respondWithResult(_0x3b794e,null))[_0x40c4('0x4c')](handleError(_0x3b794e,null));};exports[_0x40c4('0xc1')]=function(_0x2fd3e8,_0x1bab5b){var _0x2b481b,_0x2717d3,_0x9cfd54;var _0x572269=[];var _0x5a205f={};var _0x3cd793=_0x2fd3e8[_0x40c4('0xc2')]||[];var _0x2898ed=[];var _0x1589e4;return db['CmContact'][_0x40c4('0x57')]()[_0x40c4('0x15')](function(_0x5e6b80){if(!_0x5e6b80){throw new db[(_0x40c4('0x85'))][(_0x40c4('0x86'))](_0x40c4('0x87'));}_0x572269=_[_0x40c4('0x88')](_['keys'](_0x5e6b80),[_0x40c4('0x8a'),'updatedAt',_0x40c4('0x8b'),'ListId']);if(_0x2fd3e8[_0x40c4('0x59')]['id']){delete _0x2fd3e8[_0x40c4('0x59')]['id'];}if(_[_0x40c4('0x72')](_0x2fd3e8[_0x40c4('0x59')][_0x40c4('0x8c')])){throw _0x1bab5b[_0x40c4('0x20')](0x1f4)[_0x40c4('0xc3')](new db[(_0x40c4('0x85'))][(_0x40c4('0x86'))](_0x40c4('0x8d')));}if(_[_0x40c4('0x72')](_0x2fd3e8['body']['body'])||_0x2fd3e8[_0x40c4('0x59')][_0x40c4('0x59')]===''){throw _0x1bab5b[_0x40c4('0x20')](0x1f4)[_0x40c4('0xc3')](new db[(_0x40c4('0x85'))][(_0x40c4('0x86'))](_0x40c4('0x8e')));}if(_[_0x40c4('0x72')](_0x2fd3e8['body'][_0x40c4('0xc4')])){throw _0x1bab5b[_0x40c4('0x20')](0x1f4)[_0x40c4('0xc3')](new db[(_0x40c4('0x85'))][(_0x40c4('0x86'))](_0x40c4('0xc5')+_0x572269));}if(!_[_0x40c4('0x91')](_0x572269,_0x2fd3e8[_0x40c4('0x59')]['mapKeyOffline'])){throw _0x1bab5b[_0x40c4('0x20')](0x1f4)['send'](new db[(_0x40c4('0x85'))][(_0x40c4('0x86'))](_0x40c4('0xc6')+_0x572269));}_0x5a205f[_0x2fd3e8['body'][_0x40c4('0xc4')]]=_0x2fd3e8[_0x40c4('0x59')]['from'];})[_0x40c4('0x15')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x2fd3e8['params']['id']},'include':[{'model':db[_0x40c4('0x93')],'as':_0x40c4('0x94')},{'model':db[_0x40c4('0xc7')],'as':'MailAccount'}]});})[_0x40c4('0x15')](handleEntityNotFound(_0x1bab5b,null))['then'](function(_0x5d4cb3){if(_0x5d4cb3&&_0x5d4cb3[_0x40c4('0x94')]){_0x2717d3=_0x5d4cb3;var _0xb36084=_[_0x40c4('0xd')](_0x2fd3e8['body'],{'firstName':_0x2fd3e8['body'][_0x40c4('0x8c')],'phone':_0x2fd3e8[_0x40c4('0x59')][_0x40c4('0x8c')],'ListId':_0x5d4cb3[_0x40c4('0xc8')]});_0xb36084[_0x2fd3e8[_0x40c4('0x59')][_0x40c4('0xc4')]]=_0x2fd3e8[_0x40c4('0x59')][_0x40c4('0x8c')];return db[_0x40c4('0x84')]['findOrCreate']({'where':_0x5a205f,'defaults':_0xb36084});}})[_0x40c4('0xb0')](function(_0x3c25ba){if(_0x3c25ba){_0x9cfd54=_0x3c25ba;var _0x17e8f1=fs[_0x40c4('0xc9')](path['join'](config[_0x40c4('0x75')],_0x40c4('0xca')),'utf8');var _0x431401=ejs['render'](_0x17e8f1,{'body':_[_0x40c4('0xcb')](_0x2fd3e8[_0x40c4('0x59')][_0x40c4('0x59')]),'bodyTitle':_0x2717d3[_0x40c4('0xcc')]});return db['ChatOfflineMessage'][_0x40c4('0x50')]({'body':_0x431401,'plainBody':htmlToText[_0x40c4('0xcd')](_0x431401),'ContactId':_0x3c25ba['id'],'ChatWebsiteId':_0x2717d3['id']});}})[_0x40c4('0x15')](function(_0x38c580){_0x1589e4=_0x38c580;if(_0x3cd793[_0x40c4('0x40')]){var _0x52469f=_0x3cd793[_0x40c4('0x38')](function(_0x4f6438){return{'name':_0x4f6438[_0x40c4('0xce')],'basename':_0x4f6438[_0x40c4('0x67')],'type':_0x4f6438[_0x40c4('0xcf')],'ChatOfflineMessageId':_0x38c580['id']};});_0x2898ed=_0x52469f[_0x40c4('0x38')](_0x52e829=>{var _0x372977={'filename':_0x52e829[_0x40c4('0x39')],'path':path[_0x40c4('0x6d')](config[_0x40c4('0x75')],_0x40c4('0xd0'),_0x40c4('0xc2'),_0x40c4('0xd1'),_0x40c4('0xd2'),_0x52e829[_0x40c4('0xd3')])};return _0x372977;});if(!_0x2717d3[_0x40c4('0xd4')]){return db['sequelize'][_0x40c4('0xd5')](function(_0x1f2e9e){return db['Attachment'][_0x40c4('0xd6')](_0x52469f,{'transaction':_0x1f2e9e});});}}})[_0x40c4('0x15')](function(){if(_0x1589e4){_0x2b481b=_0x1589e4;return db['MailAccount'][_0x40c4('0x61')]({'where':{'service':!![]},'include':[{'model':db[_0x40c4('0xd7')],'as':_0x40c4('0xd8'),'raw':!![],'include':[{'model':db[_0x40c4('0xd9')],'as':_0x40c4('0xd9'),'raw':!![]}]}]});}})['then'](function(_0x1c8b92){if(_0x1c8b92&&_0x1c8b92['Smtp']&&_0x2717d3[_0x40c4('0xda')]&&_0x2717d3[_0x40c4('0xdb')]){var _0x4a3fb1=_0x1c8b92[_0x40c4('0xdc')]();return respondWithRpcPromise(_0x40c4('0xdd'),_0x40c4('0xde'),{'account':_0x4a3fb1,'message':{'from':util[_0x40c4('0xdf')](_0x40c4('0xe0'),_0x1c8b92[_0x40c4('0x39')],_0x1c8b92['email']||_0x1c8b92[_0x40c4('0xd8')][_0x40c4('0x51')]),'to':_0x2717d3[_0x40c4('0xdb')],'subject':_0x2717d3[_0x40c4('0xe1')],'html':_0x2b481b['body'],'attachments':_0x2898ed}},client9003)[_0x40c4('0x15')](function(){return _0x2b481b;})[_0x40c4('0x4c')](function(_0x3ea69c){logger[_0x40c4('0x1b')](_0x3ea69c);});}})[_0x40c4('0x15')](function(){if(_0x2717d3&&_0x2717d3[_0x40c4('0xd4')]&&_0x2717d3[_0x40c4('0xe2')]){var _0x553e44=[];if(_0x3cd793[_0x40c4('0x40')]){_0x553e44=_0x3cd793[_0x40c4('0x38')](function(_0xbc1340){return{'name':_0xbc1340[_0x40c4('0xce')],'basename':_0xbc1340[_0x40c4('0x67')],'type':_0xbc1340['mimetype'],'ChatOfflineMessageId':_0x1589e4['id']};});}var _0x2f1cc7;if(!_[_0x40c4('0x72')](_0x2717d3['subjectOffline'])){var _0x35e487=_[_0x40c4('0x38')](_0x2fd3e8[_0x40c4('0x59')],function(_0x55809e){return _0x55809e;});var _0x1111f9=_[_0x40c4('0xe3')](_0x35e487)[0x0];var _0x4a7433=_[_0x40c4('0xe4')](_0x1111f9,function(_0x42244c){return _0x42244c;});_0x2f1cc7=_0x4a7433[0x1][_0x2717d3['subjectOffline']];}var _0x28a6dc={'from':_0x9cfd54['email'],'firstName':_0x9cfd54[_0x40c4('0xa3')],'lastName':_0x9cfd54[_0x40c4('0xa4')],'mapKey':_0x40c4('0xe5'),'message':{'from':_0x9cfd54[_0x40c4('0xe5')],'to':_0x2717d3[_0x40c4('0xc7')][_0x40c4('0xe5')],'cc':'','subject':_[_0x40c4('0x72')](_0x2f1cc7)?_0x2717d3[_0x40c4('0xe1')]:_0x2f1cc7,'messageId':'','sentAt':new Date(),'attach':_0x553e44['length'],'attachments':_0x553e44,'originChannel':'Chat','ChatWebsiteId':_0x2717d3['id'],'ChatOfflineMessageId':_0x2b481b['id'],'originTo':_0x2717d3[_0x40c4('0xc7')][_0x40c4('0xe5')]},'body':_0x2b481b[_0x40c4('0x59')]};var _0x588ad3={'account':{'id':_0x2717d3[_0x40c4('0xe2')]},'body':_0x28a6dc,'log':_0x40c4('0xe6')};return respondWithRpcPromise(_0x40c4('0xe6'),_0x40c4('0xe7'),_0x588ad3,client9001)[_0x40c4('0x15')](function(){return _0x2b481b;})[_0x40c4('0x4c')](function(_0x4631e8){logger[_0x40c4('0x1b')](_0x4631e8);});}return;})[_0x40c4('0x15')](function(){if(_0x2b481b){return _0x2b481b;}})[_0x40c4('0x15')](respondWithResult(_0x1bab5b,null))[_0x40c4('0x4c')](function(_0x35af88){logger[_0x40c4('0x1b')](_0x40c4('0x4c'),_0x35af88);for(var _0x1c0f46 of _0x3cd793){var _0x42cfcc=path['join'](config[_0x40c4('0x75')],_0x40c4('0xd0'),_0x40c4('0xc2'),_0x40c4('0xd1'),_0x40c4('0xd2'),_0x1c0f46[_0x40c4('0x67')]);fs_extra[_0x40c4('0xe8')](_0x42cfcc)[_0x40c4('0x4c')](function(_0x466b8a){logger[_0x40c4('0x1b')](_0x40c4('0xe9'),_0x42cfcc,_0x466b8a);});}});};exports[_0x40c4('0xea')]=function(_0x458571,_0x4b8416){return db[_0x40c4('0xaf')][_0x40c4('0x4f')]({'where':{'id':_0x458571['params']['id']}})[_0x40c4('0x15')](handleEntityNotFound(_0x4b8416,null))[_0x40c4('0x15')](function(_0x2a85c9){if(_0x2a85c9){return _0x2a85c9[_0x40c4('0xea')](_0x458571[_0x40c4('0x59')][_0x40c4('0x64')],_['omit'](_0x458571[_0x40c4('0x59')],[_0x40c4('0x64'),'id'])||{});}})[_0x40c4('0x15')](respondWithResult(_0x4b8416,null))[_0x40c4('0x4c')](handleError(_0x4b8416,null));};exports[_0x40c4('0xeb')]=function(_0x3ad39b,_0x29d0a6){var _0x128788={'raw':![],'where':{}};var _0x6022ee={};var _0xa725aa={'count':0x0,'rows':[]};return db[_0x40c4('0x32')][_0x40c4('0x61')]({'where':{'id':_0x3ad39b[_0x40c4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x29d0a6,null))[_0x40c4('0x15')](function(_0x31ea3e){if(_0x31ea3e){_0x6022ee[_0x40c4('0x37')]=_['keys'](db[_0x40c4('0xaf')][_0x40c4('0x33')]);_0x6022ee[_0x40c4('0x3b')]=_[_0x40c4('0x3a')](_0x3ad39b[_0x40c4('0x3b')]);_0x6022ee['filters']=_[_0x40c4('0x3d')](_0x6022ee[_0x40c4('0x37')],_0x6022ee[_0x40c4('0x3b')]);_0x128788[_0x40c4('0x3e')]=_[_0x40c4('0x3d')](_0x6022ee[_0x40c4('0x37')],qs[_0x40c4('0x3f')](_0x3ad39b['query'][_0x40c4('0x3f')]));_0x128788[_0x40c4('0x3e')]=_0x128788[_0x40c4('0x3e')][_0x40c4('0x40')]?_0x128788[_0x40c4('0x3e')]:_0x6022ee[_0x40c4('0x37')];if(!_0x3ad39b[_0x40c4('0x3b')][_0x40c4('0x5c')](_0x40c4('0x41'))){_0x128788[_0x40c4('0x25')]=qs[_0x40c4('0x25')](_0x3ad39b[_0x40c4('0x3b')][_0x40c4('0x25')]);_0x128788[_0x40c4('0x23')]=qs[_0x40c4('0x23')](_0x3ad39b[_0x40c4('0x3b')][_0x40c4('0x23')]);}_0x128788[_0x40c4('0x42')]=qs[_0x40c4('0x43')](_0x3ad39b[_0x40c4('0x3b')][_0x40c4('0x43')]);_0x128788['where']=qs[_0x40c4('0x3c')](_[_0x40c4('0x44')](_0x3ad39b[_0x40c4('0x3b')],_0x6022ee[_0x40c4('0x3c')]));_0x128788[_0x40c4('0x46')][_0x40c4('0x5a')]=_0x31ea3e['id'];if(_0x3ad39b['query'][_0x40c4('0x45')]){_0x128788[_0x40c4('0x46')]=_[_0x40c4('0x5d')](_0x128788['where'],{'$or':_[_0x40c4('0x38')](_0x128788[_0x40c4('0x3e')],function(_0x224674){var _0xdbfec7={};_0xdbfec7[_0x224674]={'$like':'%'+_0x3ad39b[_0x40c4('0x3b')][_0x40c4('0x45')]+'%'};return _0xdbfec7;})});}_0x128788=_[_0x40c4('0x5d')]({},_0x128788,_0x3ad39b[_0x40c4('0x48')]);return db[_0x40c4('0xaf')][_0x40c4('0x26')]({'where':_0x128788['where']})[_0x40c4('0x15')](function(_0x456440){_0xa725aa[_0x40c4('0x26')]=_0x456440;if(_0x3ad39b['query'][_0x40c4('0x49')]){_0x128788[_0x40c4('0x4e')]=[{'model':db[_0x40c4('0x84')],'as':_0x40c4('0xec'),'required':![]},{'model':db[_0x40c4('0xb9')],'as':'Owner','attributes':[_0x40c4('0x39'),_0x40c4('0xed'),_0x40c4('0xee')],'required':![]},{'model':db[_0x40c4('0xef')],'as':'Tags','attributes':['id',_0x40c4('0x39'),'color'],'where':_0x3ad39b[_0x40c4('0x3b')][_0x40c4('0xf0')]?{'id':_0x3ad39b[_0x40c4('0x3b')]['tag']}:undefined,'required':_0x3ad39b[_0x40c4('0x3b')][_0x40c4('0xf0')]?!![]:![]}];}return db['ChatInteraction'][_0x40c4('0x4a')](_0x128788);})[_0x40c4('0x15')](function(_0x295e39){_0xa725aa[_0x40c4('0x4b')]=_0x295e39;return _0xa725aa;});}})['then'](respondWithFilteredResult(_0x29d0a6,_0x128788))[_0x40c4('0x4c')](handleError(_0x29d0a6,null));};function iftimePromise(_0x633d25,_0xb75c64){return respondWithRpcPromise(_0x40c4('0xf1'),'getSnippet',{'command':_0xb75c64['timezone']?util[_0x40c4('0xdf')](_0x40c4('0xf2'),_0x633d25[_0x40c4('0xf3')],_0xb75c64[_0x40c4('0xf4')]):util[_0x40c4('0xdf')](_0x40c4('0xf5'),_0x633d25['interval'])},client9002)[_0x40c4('0x15')](function(_0x4038d6){var _0x438269=_0x4038d6&&_0x4038d6['indexOf']('true')>=0x0?!![]:![];logger[_0x40c4('0x16')](_0x40c4('0xf6'),_0xb75c64['id'],_0x633d25['id'],_0x633d25['interval'],_0x438269?'ONLINE':_0x40c4('0xf7'),_0xb75c64[_0x40c4('0xf4')]?_0xb75c64[_0x40c4('0xf4')]:'No\x20timezone');return _0x438269;})[_0x40c4('0x4c')](function(_0x718606){logger[_0x40c4('0x1b')](_0x40c4('0xf6'),_0xb75c64['id'],_0x633d25['id'],_0x633d25[_0x40c4('0xf3')],util[_0x40c4('0xf8')](_0x718606,{'showHidden':![],'depth':null}),_0xb75c64[_0x40c4('0xf4')]?_0xb75c64[_0x40c4('0xf4')]:'No\x20timezone');return![];});}exports[_0x40c4('0xf9')]=function(_0x518d0a,_0x137244){var _0x4b645d=0x0;var _0x3b4d3c=0x0;var _0x177a58=![];var _0x5214a9;var _0x3487c4;return db[_0x40c4('0x32')][_0x40c4('0x4f')]({'where':{'id':_0x518d0a[_0x40c4('0x4d')]['id']},'include':[{'model':db['Interval'],'as':'Interval','include':[{'model':db['Interval'],'as':_0x40c4('0xfa'),'attributes':['id',_0x40c4('0xf3')],'raw':!![]}]}]})[_0x40c4('0x15')](handleEntityNotFound(_0x137244,null))[_0x40c4('0x15')](function(_0x18703a){if(_0x18703a){_0x5214a9=_0x18703a;return _0x18703a['getProactiveActions']({'raw':!![]});}})[_0x40c4('0x15')](function(_0x9b9a59){if(_0x5214a9){if(_0x9b9a59){_0x3487c4=_0x9b9a59;}}return require(_0x40c4('0x70'))[_0x40c4('0x71')]();})[_0x40c4('0x15')](function(_0x3846a2){if(_0x3846a2){_0x3b4d3c=_0x3846a2['virtual'];_0x177a58=_0x3846a2[_0x40c4('0xfb')];}})[_0x40c4('0x15')](function(){return db['ChatInteraction'][_0x40c4('0x26')]({'where':{'closed':![]}});})['then'](function(_0x2b010c){_0x4b645d=_0x2b010c;if(_0x3b4d3c&&_0x2b010c>_0x3b4d3c){return db[_0x40c4('0xfc')][_0x40c4('0x61')]({'where':{'id':0x1}})[_0x40c4('0x15')](function(_0x494d6b){if(_0x494d6b){_0x494d6b[_0x40c4('0xfd')](_0x40c4('0xfe'));}});}})[_0x40c4('0x15')](function(){if(_0x5214a9[_0x40c4('0xff')]&&_0x5214a9[_0x40c4('0xff')][_0x40c4('0xfa')]){var _0x3837ef=[];for(var _0x48aaf6=0x0;_0x48aaf6<_0x5214a9[_0x40c4('0xff')][_0x40c4('0xfa')][_0x40c4('0x40')];_0x48aaf6++){var _0x1a4af4=_0x5214a9['Interval'][_0x40c4('0xfa')][_0x48aaf6][_0x40c4('0x2a')]({'plain':!![]});_0x3837ef[_0x40c4('0x100')](iftimePromise(_0x1a4af4,_0x5214a9));}return BPromise['all'](_0x3837ef)[_0x40c4('0x15')](function(_0x313ced){return _[_0x40c4('0x101')](_0x313ced);});}else{return!![];}})[_0x40c4('0x15')](function(_0x1b7fdc){var _0x2eefa3=fs['readFileSync'](path[_0x40c4('0x6d')](config[_0x40c4('0x75')],_0x40c4('0x102')),_0x40c4('0x103'));var _0x13e252={'remote':_0x5214a9[_0x40c4('0x104')],'query':querystring[_0x40c4('0x1a')](_[_0x40c4('0x5d')](_0x5214a9[_0x40c4('0x2a')]({'plain':!![]}),{'customerIp':_0x518d0a[_0x40c4('0x80')][_0x40c4('0xa0')]||_0x518d0a['headers'][_0x40c4('0x105')]||_0x518d0a[_0x40c4('0x106')][_0x40c4('0x107')]||_0x518d0a['ip'],'referer':_0x518d0a['headers'][_0x40c4('0xa6')],'openedInteractions':_0x4b645d,'maxInteractions':_0x3b4d3c,'virtual':_0x177a58['virtual'],'online':_0x1b7fdc,'custom':_0x177a58}))[_0x40c4('0x108')](/'/g,'\x5c\x27')};_0x137244[_0x40c4('0xc3')](ejs[_0x40c4('0x109')](Mustache['render'](_0x2eefa3,_0x13e252),{'proactiveActions':_0x3487c4,'alignment':_0x5214a9[_0x40c4('0x10a')],'verticalAlignment':_0x5214a9[_0x40c4('0x10b')],'div_color':_0x5214a9['color'],'labelText':_0x5214a9[_0x40c4('0x10c')],'text_color':_0x5214a9[_0x40c4('0x10d')],'text_button_color':_0x5214a9[_0x40c4('0x10e')],'button_color':_0x5214a9[_0x40c4('0x10f')],'background_color':_0x5214a9[_0x40c4('0x110')],'hideWhenOffline':_0x5214a9[_0x40c4('0x111')],'interval':_0x5214a9[_0x40c4('0x112')]}));})[_0x40c4('0x4c')](handleError(_0x137244,null));};exports[_0x40c4('0x113')]=function(_0x7f929d,_0x5c4eb6){var _0x2f81e9=_0x7f929d[_0x40c4('0x4d')]['id'];var _0x14f31c=_0x7f929d[_0x40c4('0x59')];var _0x22ddee=0xc8;var _0x5e7ca1=null;return db[_0x40c4('0x114')]['transaction']({'isolationLevel':db['sequelize'][_0x40c4('0x115')][_0x40c4('0x116')][_0x40c4('0x117')]},function(_0x18b349){return db[_0x40c4('0x32')][_0x40c4('0x61')]({'where':{'id':_0x2f81e9},'transaction':_0x18b349})[_0x40c4('0x15')](function(_0x53184c){if(_0x53184c){return db[_0x40c4('0x96')][_0x40c4('0x2d')]({'where':{'ChatWebsiteId':_0x2f81e9},'transaction':_0x18b349})[_0x40c4('0x15')](function(){var _0x2aaa35=_['map'](_0x14f31c,function(_0xccc711){_0xccc711[_0x40c4('0x5a')]=_0x2f81e9;return _0xccc711;});return db[_0x40c4('0x96')]['bulkCreate'](_0x2aaa35,{'transaction':_0x18b349});});}else{_0x22ddee=0x194;_0x5e7ca1=[];}});})[_0x40c4('0x15')](function(){if(_0x22ddee!==0x194){return db[_0x40c4('0x96')][_0x40c4('0x118')]({'where':{'ChatWebsiteId':_0x2f81e9},'order':_0x40c4('0x119')})[_0x40c4('0x15')](function(_0x36b54d){_0x5e7ca1=_0x36b54d;});}})[_0x40c4('0x4c')](function(_0x9e1b80){_0x22ddee=0x1f4;logger[_0x40c4('0x1b')](_0x9e1b80[_0x40c4('0x2e')]);if(_0x9e1b80[_0x40c4('0x39')]){delete _0x9e1b80[_0x40c4('0x39')];}_0x5e7ca1=_0x9e1b80;})[_0x40c4('0x11a')](function(){if(_0x5e7ca1===null){_0x5c4eb6[_0x40c4('0x1f')](_0x22ddee);}else{if(_0x22ddee===0x1f4){_0x5c4eb6[_0x40c4('0x20')](_0x22ddee)[_0x40c4('0xc3')](_0x5e7ca1);}else{_0x5c4eb6['status'](_0x22ddee)[_0x40c4('0x22')](_0x5e7ca1);}}});};exports['getApplications']=function(_0x44f38f,_0x1fbd36){var _0x1af056={};var _0x149153={};var _0x4d353a;var _0x369d81;return db['ChatWebsite'][_0x40c4('0x61')]({'where':{'id':_0x44f38f[_0x40c4('0x4d')]['id']}})[_0x40c4('0x15')](handleEntityNotFound(_0x1fbd36,null))[_0x40c4('0x15')](function(_0x6db34e){if(_0x6db34e){_0x4d353a=_0x6db34e;_0x149153[_0x40c4('0x37')]=_['keys'](db[_0x40c4('0x96')][_0x40c4('0x33')]);_0x149153[_0x40c4('0x3b')]=_[_0x40c4('0x3a')](_0x44f38f[_0x40c4('0x3b')]);_0x149153[_0x40c4('0x3c')]=_[_0x40c4('0x3d')](_0x149153['model'],_0x149153[_0x40c4('0x3b')]);_0x1af056[_0x40c4('0x3e')]=_[_0x40c4('0x3d')](_0x149153[_0x40c4('0x37')],qs[_0x40c4('0x3f')](_0x44f38f[_0x40c4('0x3b')][_0x40c4('0x3f')]));_0x1af056[_0x40c4('0x3e')]=_0x1af056[_0x40c4('0x3e')][_0x40c4('0x40')]?_0x1af056[_0x40c4('0x3e')]:_0x149153[_0x40c4('0x37')];_0x1af056['order']=qs[_0x40c4('0x43')](_0x44f38f[_0x40c4('0x3b')][_0x40c4('0x43')]);_0x1af056[_0x40c4('0x46')]=qs[_0x40c4('0x3c')](_[_0x40c4('0x44')](_0x44f38f['query'],_0x149153[_0x40c4('0x3c')]));if(_0x44f38f['query'][_0x40c4('0x45')]){_0x1af056['where']=_['merge'](_0x1af056[_0x40c4('0x46')],{'$or':_[_0x40c4('0x38')](_0x1af056[_0x40c4('0x3e')],function(_0x2c5162){var _0x2d1396={};_0x2d1396[_0x2c5162]={'$like':'%'+_0x44f38f['query'][_0x40c4('0x45')]+'%'};return _0x2d1396;})});}_0x1af056=_[_0x40c4('0x5d')]({},_0x1af056,_0x44f38f['options']);return _0x4d353a[_0x40c4('0x11b')](_0x1af056);}})[_0x40c4('0x15')](function(_0x5a4496){if(_0x5a4496){_0x369d81=_0x5a4496[_0x40c4('0x40')];if(!_0x44f38f[_0x40c4('0x3b')][_0x40c4('0x5c')](_0x40c4('0x41'))){_0x1af056[_0x40c4('0x25')]=qs[_0x40c4('0x25')](_0x44f38f[_0x40c4('0x3b')][_0x40c4('0x25')]);_0x1af056[_0x40c4('0x23')]=qs['offset'](_0x44f38f[_0x40c4('0x3b')][_0x40c4('0x23')]);}return _0x4d353a[_0x40c4('0x11b')](_0x1af056);}})[_0x40c4('0x15')](function(_0x3a070b){if(_0x3a070b){return _0x3a070b?{'count':_0x369d81,'rows':_0x3a070b}:null;}})[_0x40c4('0x15')](respondWithResult(_0x1fbd36,null))[_0x40c4('0x4c')](handleError(_0x1fbd36,null));};exports[_0x40c4('0x11c')]=function(_0x43519,_0x255fef){return db[_0x40c4('0x11d')]['find']({'where':{'id':_0x43519['params']['id']}})['then'](handleEntityNotFound(_0x255fef,null))[_0x40c4('0x15')](function(_0x1a6376){if(_0x1a6376){return _0x1a6376['addProactiveActions'](_0x43519[_0x40c4('0x59')][_0x40c4('0x64')],_[_0x40c4('0x11e')](_0x43519[_0x40c4('0x59')],['ids','id'])||{});}})[_0x40c4('0x15')](respondWithResult(_0x255fef,null))[_0x40c4('0x4c')](handleError(_0x255fef,null));};exports['getProactiveActions']=function(_0x1757da,_0x1087cf){var _0x3fefe7={};var _0x462e61={};var _0xed58bf;var _0x235b25;return db['ChatWebsite'][_0x40c4('0x61')]({'where':{'id':_0x1757da[_0x40c4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1087cf,null))[_0x40c4('0x15')](function(_0xf765de){if(_0xf765de){_0xed58bf=_0xf765de;_0x462e61['model']=_[_0x40c4('0x3a')](db[_0x40c4('0x11f')][_0x40c4('0x33')]);_0x462e61[_0x40c4('0x3b')]=_[_0x40c4('0x3a')](_0x1757da[_0x40c4('0x3b')]);_0x462e61[_0x40c4('0x3c')]=_[_0x40c4('0x3d')](_0x462e61[_0x40c4('0x37')],_0x462e61[_0x40c4('0x3b')]);_0x3fefe7[_0x40c4('0x3e')]=_['intersection'](_0x462e61['model'],qs[_0x40c4('0x3f')](_0x1757da[_0x40c4('0x3b')][_0x40c4('0x3f')]));_0x3fefe7[_0x40c4('0x3e')]=_0x3fefe7[_0x40c4('0x3e')]['length']?_0x3fefe7[_0x40c4('0x3e')]:_0x462e61[_0x40c4('0x37')];_0x3fefe7['order']=qs['sort'](_0x1757da[_0x40c4('0x3b')][_0x40c4('0x43')]);_0x3fefe7[_0x40c4('0x46')]=qs[_0x40c4('0x3c')](_[_0x40c4('0x44')](_0x1757da['query'],_0x462e61['filters']));if(_0x1757da[_0x40c4('0x3b')][_0x40c4('0x45')]){_0x3fefe7[_0x40c4('0x46')]=_[_0x40c4('0x5d')](_0x3fefe7[_0x40c4('0x46')],{'$or':_['map'](_0x3fefe7[_0x40c4('0x3e')],function(_0x131b6d){var _0x1ba497={};_0x1ba497[_0x131b6d]={'$like':'%'+_0x1757da[_0x40c4('0x3b')][_0x40c4('0x45')]+'%'};return _0x1ba497;})});}_0x3fefe7=_[_0x40c4('0x5d')]({},_0x3fefe7,_0x1757da[_0x40c4('0x48')]);return _0xed58bf[_0x40c4('0x120')](_0x3fefe7);}})['then'](function(_0x6121d0){if(_0x6121d0){_0x235b25=_0x6121d0[_0x40c4('0x40')];if(!_0x1757da['query'][_0x40c4('0x5c')](_0x40c4('0x41'))){_0x3fefe7[_0x40c4('0x25')]=qs[_0x40c4('0x25')](_0x1757da[_0x40c4('0x3b')][_0x40c4('0x25')]);_0x3fefe7[_0x40c4('0x23')]=qs['offset'](_0x1757da['query'][_0x40c4('0x23')]);}return _0xed58bf[_0x40c4('0x120')](_0x3fefe7);}})[_0x40c4('0x15')](function(_0x17b826){if(_0x17b826){return _0x17b826?{'count':_0x235b25,'rows':_0x17b826}:null;}})[_0x40c4('0x15')](respondWithResult(_0x1087cf,null))[_0x40c4('0x4c')](handleError(_0x1087cf,null));};exports[_0x40c4('0x121')]=function(_0x39c590,_0x4d63bc){var _0x2208ca=_0x39c590[_0x40c4('0x3b')][_0x40c4('0x122')]===_0x40c4('0x123')?_0x40c4('0x124'):_0x40c4('0x125');return db[_0x40c4('0x32')][_0x40c4('0x4f')]({'attributes':['id',_0x2208ca],'where':{'id':_0x39c590[_0x40c4('0x4d')]['id']}})[_0x40c4('0x15')](handleEntityNotFound(_0x4d63bc,null))[_0x40c4('0x15')](function(_0x425c2d){if(_0x425c2d){var _0x37897f=_0x425c2d[_0x2208ca];var _0x3b04ab=_0x37897f&&_0x37897f[_0x40c4('0x126')]?_0x37897f[_0x40c4('0x126')]:[];_0x4d63bc[_0x40c4('0xc3')]({'fromKey':_['isNil'](_0x37897f[_0x40c4('0x127')])?undefined:_0x37897f[_0x40c4('0x127')],'count':_0x3b04ab[_0x40c4('0x40')],'rows':_0x3b04ab});}})[_0x40c4('0x4c')](handleError(_0x4d63bc,null));};exports[_0x40c4('0x128')]=function(_0x442f57,_0x40321f){var _0x4cba06={'raw':![],'where':{}};var _0x18ffb0={};var _0x1714e3={'count':0x0,'rows':[]};return db[_0x40c4('0x32')][_0x40c4('0x61')]({'where':{'id':_0x442f57[_0x40c4('0x4d')]['id']}})[_0x40c4('0x15')](handleEntityNotFound(_0x40321f,null))[_0x40c4('0x15')](function(_0x531c3d){if(_0x531c3d){_0x18ffb0[_0x40c4('0x37')]=_[_0x40c4('0x3a')](db[_0x40c4('0x129')][_0x40c4('0x33')]);_0x18ffb0['query']=_[_0x40c4('0x3a')](_0x442f57[_0x40c4('0x3b')]);_0x18ffb0[_0x40c4('0x3c')]=_[_0x40c4('0x3d')](_0x18ffb0[_0x40c4('0x37')],_0x18ffb0['query']);_0x4cba06[_0x40c4('0x3e')]=_[_0x40c4('0x3d')](_0x18ffb0[_0x40c4('0x37')],qs[_0x40c4('0x3f')](_0x442f57[_0x40c4('0x3b')][_0x40c4('0x3f')]));_0x4cba06['attributes']=_0x4cba06[_0x40c4('0x3e')][_0x40c4('0x40')]?_0x4cba06[_0x40c4('0x3e')]:_0x18ffb0[_0x40c4('0x37')];if(!_0x442f57[_0x40c4('0x3b')][_0x40c4('0x5c')](_0x40c4('0x41'))){_0x4cba06[_0x40c4('0x25')]=qs[_0x40c4('0x25')](_0x442f57['query']['limit']);_0x4cba06[_0x40c4('0x23')]=qs[_0x40c4('0x23')](_0x442f57[_0x40c4('0x3b')][_0x40c4('0x23')]);}_0x4cba06[_0x40c4('0x42')]=qs['sort'](_0x442f57[_0x40c4('0x3b')]['sort']);_0x4cba06[_0x40c4('0x46')]=qs[_0x40c4('0x3c')](_['pick'](_0x442f57['query'],_0x18ffb0[_0x40c4('0x3c')]));_0x4cba06[_0x40c4('0x46')][_0x40c4('0x5a')]=_0x531c3d['id'];if(_0x442f57[_0x40c4('0x3b')][_0x40c4('0x45')]){_0x4cba06[_0x40c4('0x46')]=_['merge'](_0x4cba06['where'],{'$or':_['map'](_0x4cba06[_0x40c4('0x3e')],function(_0x6de5be){var _0x3d8769={};_0x3d8769[_0x6de5be]={'$like':'%'+_0x442f57[_0x40c4('0x3b')][_0x40c4('0x45')]+'%'};return _0x3d8769;})});}_0x4cba06=_[_0x40c4('0x5d')]({},_0x4cba06,_0x442f57[_0x40c4('0x48')]);return db['ChatOfflineMessage']['count']({'where':_0x4cba06['where']})[_0x40c4('0x15')](function(_0x336d0a){_0x1714e3['count']=_0x336d0a;if(_0x442f57['query'][_0x40c4('0x49')]){_0x4cba06[_0x40c4('0x4e')]=[{'all':!![]}];}else{_0x4cba06[_0x40c4('0x4e')]=[{'model':db[_0x40c4('0x84')],'as':_0x40c4('0xec'),'required':![]},{'model':db[_0x40c4('0x12a')],'as':_0x40c4('0x12b'),'required':![]}];}return db[_0x40c4('0x129')][_0x40c4('0x4a')](_0x4cba06);})[_0x40c4('0x15')](function(_0x58e7b0){_0x1714e3[_0x40c4('0x4b')]=_0x58e7b0;return _0x1714e3;});}})[_0x40c4('0x15')](respondWithFilteredResult(_0x40321f,_0x4cba06))[_0x40c4('0x4c')](handleError(_0x40321f,null));};exports[_0x40c4('0x12c')]=function(_0x2dd722,_0x4372d9){return db['ChatWebsite'][_0x40c4('0x4f')]({'where':{'id':_0x2dd722[_0x40c4('0x4d')]['id']}})[_0x40c4('0x15')](handleEntityNotFound(_0x4372d9,null))[_0x40c4('0x15')](function(_0x5cc097){if(_0x5cc097){return _0x5cc097['addAgents'](_0x2dd722['body'][_0x40c4('0x64')],_[_0x40c4('0x11e')](_0x2dd722['body'],[_0x40c4('0x64'),'id'])||{})['spread'](function(_0x3a60ed){for(var _0x11d5a6=0x0;_0x11d5a6<_0x2dd722['body']['ids']['length'];_0x11d5a6+=0x1){socket[_0x40c4('0x12d')]('userChatWebsite:save',{'UserId':Number(_0x2dd722['body'][_0x40c4('0x64')][_0x11d5a6]),'ChatWebsiteId':Number(_0x2dd722[_0x40c4('0x4d')]['id'])});}return _0x3a60ed;});}})[_0x40c4('0x15')](respondWithResult(_0x4372d9,null))['catch'](handleError(_0x4372d9,null));};exports['removeAgents']=function(_0x2bbb77,_0x163ad8){return db[_0x40c4('0x32')]['find']({'where':{'id':_0x2bbb77[_0x40c4('0x4d')]['id']}})[_0x40c4('0x15')](handleEntityNotFound(_0x163ad8,null))[_0x40c4('0x15')](function(_0x4e24b6){if(_0x4e24b6){return _0x4e24b6['removeAgents'](_0x2bbb77[_0x40c4('0x3b')][_0x40c4('0x64')])[_0x40c4('0x15')](function(){if(_['isArray'](_0x2bbb77[_0x40c4('0x3b')]['ids'])){for(var _0x33caad=0x0;_0x33caad<_0x2bbb77[_0x40c4('0x3b')]['ids'][_0x40c4('0x40')];_0x33caad+=0x1){socket[_0x40c4('0x12d')](_0x40c4('0x12e'),{'UserId':Number(_0x2bbb77['query'][_0x40c4('0x64')][_0x33caad]),'ChatWebsiteId':Number(_0x2bbb77[_0x40c4('0x4d')]['id'])});}}else{socket['emit'](_0x40c4('0x12e'),{'UserId':Number(_0x2bbb77['query']['ids']),'ChatWebsiteId':Number(_0x2bbb77[_0x40c4('0x4d')]['id'])});}});}})[_0x40c4('0x15')](respondWithStatusCode(_0x163ad8,null))[_0x40c4('0x4c')](handleError(_0x163ad8,null));};exports[_0x40c4('0x12f')]=function(_0x4792cf,_0x55f167){var _0x125352={};var _0x283488={};var _0x2f1b55;var _0x1b6708;return db['ChatWebsite'][_0x40c4('0x61')]({'where':{'id':_0x4792cf[_0x40c4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x55f167,null))[_0x40c4('0x15')](function(_0x59c478){if(_0x59c478){_0x2f1b55=_0x59c478;_0x283488[_0x40c4('0x37')]=_[_0x40c4('0x3a')](db[_0x40c4('0xb9')][_0x40c4('0x33')]);_0x283488[_0x40c4('0x3b')]=_[_0x40c4('0x3a')](_0x4792cf['query']);_0x283488[_0x40c4('0x3c')]=_[_0x40c4('0x3d')](_0x283488['model'],_0x283488[_0x40c4('0x3b')]);_0x125352['attributes']=_[_0x40c4('0x3d')](_0x283488[_0x40c4('0x37')],qs[_0x40c4('0x3f')](_0x4792cf[_0x40c4('0x3b')][_0x40c4('0x3f')]));_0x125352[_0x40c4('0x3e')]=_0x125352[_0x40c4('0x3e')]['length']?_0x125352[_0x40c4('0x3e')]:_0x283488[_0x40c4('0x37')];_0x125352['order']=qs[_0x40c4('0x43')](_0x4792cf['query'][_0x40c4('0x43')]);_0x125352[_0x40c4('0x46')]=qs[_0x40c4('0x3c')](_[_0x40c4('0x44')](_0x4792cf[_0x40c4('0x3b')],_0x283488[_0x40c4('0x3c')]));if(_0x4792cf[_0x40c4('0x3b')][_0x40c4('0x45')]){_0x125352[_0x40c4('0x46')]=_[_0x40c4('0x5d')](_0x125352['where'],{'$or':_[_0x40c4('0x38')](_0x125352['attributes'],function(_0x27025c){var _0x29d92b={};_0x29d92b[_0x27025c]={'$like':'%'+_0x4792cf['query'][_0x40c4('0x45')]+'%'};return _0x29d92b;})});}_0x125352=_[_0x40c4('0x5d')]({},_0x125352,_0x4792cf[_0x40c4('0x48')]);return _0x2f1b55[_0x40c4('0x12f')](_0x125352);}})['then'](function(_0x366636){if(_0x366636){_0x1b6708=_0x366636[_0x40c4('0x40')];if(!_0x4792cf['query'][_0x40c4('0x5c')]('nolimit')){_0x125352['limit']=qs[_0x40c4('0x25')](_0x4792cf[_0x40c4('0x3b')][_0x40c4('0x25')]);_0x125352['offset']=qs['offset'](_0x4792cf['query'][_0x40c4('0x23')]);}return _0x2f1b55[_0x40c4('0x12f')](_0x125352);}})[_0x40c4('0x15')](function(_0x538cf0){if(_0x538cf0){return _0x538cf0?{'count':_0x1b6708,'rows':_0x538cf0}:null;}})[_0x40c4('0x15')](respondWithResult(_0x55f167,null))[_0x40c4('0x4c')](handleError(_0x55f167,null));}; \ No newline at end of file +var _0xd18e=['UserId','agent','forcedOwnership','Start','startRouting','EventManager','offline','files','no\x20available\x20attributes','CompanyId','mapKeyOffline','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','MailServerOut','Smtp','CloudProvider','forwardOffline','getSmtpOptions','SendMail','sendMail','email','forwardOfflineAddress','offlineMessageSubject','MailAccountId','subjectOffline','mapValues','Chat','NotifyMailAccount','notifyMail','server','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tags','tag','Command','iftime\x20%s,%s','interval','iftime\x20%s','true','ONLINE','OFFLINE','timezone','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','Interval','Intervals','License','chatLicenseExceeded','all','some','server/files/chat/iframe.ejs','remote','connection','remoteAddress','replace','alignment','color','textColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','stack','finally','addProactiveActions','chatProactiveAction','ChatProactiveAction','getProactiveActions','getFields','online','false','offlineForm','items','Attachments','addAgents','emit','removeAgents','userChatWebsite:remove','getAgents','bluebird','util','path','ejs','lodash','querystring','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','html-to-text','client','http','request','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','limit','count','set','Content-Range','update','then','get','UserProfileResource','destroy','name','send','mandatoryDispositionPause','map','ChatWebsite','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','include','findAll','rows','show','params','Pause','intersection','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatWebsites','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','rawAttributes','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','sitepic','filename','agentAvatar','file','customerAvatar','addSystemAvatar','systemAvatar','getLogo','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','existsSync','join','root','server/files/images/logos/','download','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','server/files/images/avatars/system_avatar.png','notify','setUA','headers','user-agent','getResult','chat','CmContact','Sequelize','difference','updatedAt','createdAt','ListId','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','DESC','ChatApplication','Applications','applications','account','Contacts','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','version','format','browser','unknown','%s\x20%s','device','vendor','%s\x20%s\x20%s','threadId','externalUrl','ChatInteraction','ContactId','interaction','spread','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId'];(function(_0x39a6ca,_0x10c9f0){var _0x752c2f=function(_0x3f6ed1){while(--_0x3f6ed1){_0x39a6ca['push'](_0x39a6ca['shift']());}};_0x752c2f(++_0x10c9f0);}(_0xd18e,0x18f));var _0xed18=function(_0x4c66b7,_0x5c3259){_0x4c66b7=_0x4c66b7-0x0;var _0x1f04e4=_0xd18e[_0x4c66b7];return _0x1f04e4;};'use strict';var BPromise=require(_0xed18('0x0'));var Mustache=require('mustache');var util=require(_0xed18('0x1'));var path=require(_0xed18('0x2'));var ejs=require(_0xed18('0x3'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xed18('0x4'));var querystring=require(_0xed18('0x5'));var Redis=require('ioredis');var qs=require(_0xed18('0x6'));var logger=require(_0xed18('0x7'))(_0xed18('0x8'));var config=require('../../config/environment');var db=require(_0xed18('0x9'))['db'];config[_0xed18('0xa')]=_[_0xed18('0xb')](config['redis'],{'host':_0xed18('0xc'),'port':0x18eb});var socket=require(_0xed18('0xd'))(new Redis(config[_0xed18('0xa')]));require(_0xed18('0xe'))[_0xed18('0xf')](socket);var htmlToText=require(_0xed18('0x10'));var jayson=require('jayson/promise');var client=jayson[_0xed18('0x11')]['http']({'port':0x232c});var client9002=jayson[_0xed18('0x11')][_0xed18('0x12')]({'port':0x232a});var client9003=jayson[_0xed18('0x11')]['http']({'port':0x232b});var client9001=jayson['client'][_0xed18('0x12')]({'port':0x2329});function respondWithRpcPromise(_0x1f15c8,_0x1e8c15,_0x4acdd0,_0x21aa81){return new BPromise(function(_0x549749,_0x38811e){var _0x478c42=_0x21aa81||client;return _0x478c42[_0xed18('0x13')](_0x1f15c8,_0x4acdd0)['then'](function(_0x26af4a){logger[_0xed18('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x1e8c15,_0xed18('0x15'));logger[_0xed18('0x16')](_0xed18('0x17'),_0x1e8c15,_0xed18('0x15'),JSON[_0xed18('0x18')](_0x26af4a));if(_0x26af4a[_0xed18('0x19')]){if(_0x26af4a[_0xed18('0x19')][_0xed18('0x1a')]===0x1f4){logger['error'](_0xed18('0x1b'),_0x1e8c15,_0x26af4a[_0xed18('0x19')][_0xed18('0x1c')]);return _0x38811e(_0x26af4a['error']['message']);}logger[_0xed18('0x19')](_0xed18('0x1b'),_0x1e8c15,_0x26af4a['error'][_0xed18('0x1c')]);return _0x549749(_0x26af4a['error'][_0xed18('0x1c')]);}else{logger[_0xed18('0x14')](_0xed18('0x1b'),_0x1e8c15,_0xed18('0x15'));_0x549749(_0x26af4a[_0xed18('0x1d')][_0xed18('0x1c')]);}})[_0xed18('0x1e')](function(_0x5832be){logger[_0xed18('0x19')](_0xed18('0x1b'),_0x1e8c15,_0x5832be);_0x38811e(_0x5832be);});});}function respondWithStatusCode(_0x11c82e,_0x490ba2){_0x490ba2=_0x490ba2||0xcc;return function(_0x16dd1a){if(_0x16dd1a){return _0x11c82e[_0xed18('0x1f')](_0x490ba2);}return _0x11c82e[_0xed18('0x20')](_0x490ba2)['end']();};}function respondWithResult(_0x23e9ad,_0x31eda3){_0x31eda3=_0x31eda3||0xc8;return function(_0x53696f){if(_0x53696f){return _0x23e9ad[_0xed18('0x20')](_0x31eda3)[_0xed18('0x21')](_0x53696f);}};}function respondWithFilteredResult(_0x29ae2d,_0x262fce){return function(_0x3d691b){if(_0x3d691b){var _0x124854=typeof _0x262fce[_0xed18('0x22')]==='undefined'&&typeof _0x262fce[_0xed18('0x23')]==='undefined';var _0x14c532=_0x3d691b[_0xed18('0x24')];var _0x37df05=_0x124854?0x0:_0x262fce[_0xed18('0x22')];var _0x146a4d=_0x124854?_0x3d691b['count']:_0x262fce['offset']+_0x262fce[_0xed18('0x23')];var _0x3c2d92;if(_0x146a4d>=_0x14c532){_0x146a4d=_0x14c532;_0x3c2d92=0xc8;}else{_0x3c2d92=0xce;}_0x29ae2d[_0xed18('0x20')](_0x3c2d92);return _0x29ae2d[_0xed18('0x25')](_0xed18('0x26'),_0x37df05+'-'+_0x146a4d+'/'+_0x14c532)['json'](_0x3d691b);}return null;};}function saveUpdates(_0x5223cc){return function(_0x45c25c){if(_0x45c25c){return _0x45c25c[_0xed18('0x27')](_0x5223cc)[_0xed18('0x28')](function(_0x37d2c9){return _0x37d2c9;});}return null;};}function removeEntity(_0x2aa464){return function(_0x5039dc){if(_0x5039dc){return _0x5039dc['destroy']()[_0xed18('0x28')](function(){var _0x32a281=_0x5039dc[_0xed18('0x29')]({'plain':!![]});var _0x5208a1='ChatWebsites';return db[_0xed18('0x2a')][_0xed18('0x2b')]({'where':{'type':_0x5208a1,'resourceId':_0x32a281['id']}})['then'](function(){return _0x5039dc;});})[_0xed18('0x28')](function(){_0x2aa464[_0xed18('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27bb14){return function(_0x250794){if(!_0x250794){_0x27bb14[_0xed18('0x1f')](0x194);}return _0x250794;};}function handleError(_0x241701,_0x15c009){_0x15c009=_0x15c009||0x1f4;return function(_0x3981d4){logger[_0xed18('0x19')](_0x3981d4['stack']);if(_0x3981d4[_0xed18('0x2c')]){delete _0x3981d4['name'];}_0x241701['status'](_0x15c009)[_0xed18('0x2d')](_0x3981d4);};}exports['index']=function(_0x395358,_0x1efe74){var _0x3002b9={'include':[{'model':db['Pause'],'as':_0xed18('0x2e')}]},_0x251686={},_0x3c54ed={'count':0x0,'rows':[]};var _0x37ef13=_[_0xed18('0x2f')](db[_0xed18('0x30')]['rawAttributes'],function(_0x12a988){return{'name':_0x12a988['fieldName'],'type':_0x12a988[_0xed18('0x31')]['key']};});_0x251686[_0xed18('0x32')]=_['map'](_0x37ef13,_0xed18('0x2c'));_0x251686[_0xed18('0x33')]=_[_0xed18('0x34')](_0x395358['query']);_0x251686[_0xed18('0x35')]=_['intersection'](_0x251686[_0xed18('0x32')],_0x251686[_0xed18('0x33')]);_0x3002b9[_0xed18('0x36')]=_['intersection'](_0x251686[_0xed18('0x32')],qs[_0xed18('0x37')](_0x395358['query'][_0xed18('0x37')]));_0x3002b9[_0xed18('0x36')]=_0x3002b9[_0xed18('0x36')][_0xed18('0x38')]?_0x3002b9['attributes']:_0x251686['model'];if(!_0x395358['query'][_0xed18('0x39')](_0xed18('0x3a'))){_0x3002b9[_0xed18('0x23')]=qs[_0xed18('0x23')](_0x395358['query']['limit']);_0x3002b9['offset']=qs[_0xed18('0x22')](_0x395358[_0xed18('0x33')][_0xed18('0x22')]);}_0x3002b9[_0xed18('0x3b')]=qs['sort'](_0x395358[_0xed18('0x33')][_0xed18('0x3c')]);_0x3002b9['where']=qs['filters'](_[_0xed18('0x3d')](_0x395358[_0xed18('0x33')],_0x251686[_0xed18('0x35')]),_0x37ef13);if(_0x395358[_0xed18('0x33')][_0xed18('0x3e')]){_0x3002b9[_0xed18('0x3f')]=_[_0xed18('0x40')](_0x3002b9['where'],{'$or':_['map'](_0x37ef13,function(_0x1d7927){if(_0x1d7927[_0xed18('0x31')]!=='VIRTUAL'){var _0x1de5e1={};_0x1de5e1[_0x1d7927['name']]={'$like':'%'+_0x395358[_0xed18('0x33')][_0xed18('0x3e')]+'%'};return _0x1de5e1;}})});}_0x3002b9=_['merge']({},_0x3002b9,_0x395358[_0xed18('0x41')]);var _0x54ab07={'where':_0x3002b9[_0xed18('0x3f')]};return db['ChatWebsite']['count'](_0x54ab07)[_0xed18('0x28')](function(_0x35e8ec){_0x3c54ed['count']=_0x35e8ec;if(_0x395358['query']['includeAll']){_0x3002b9[_0xed18('0x42')]=[{'all':!![]}];}return db[_0xed18('0x30')][_0xed18('0x43')](_0x3002b9);})[_0xed18('0x28')](function(_0x6aeed){_0x3c54ed[_0xed18('0x44')]=_0x6aeed;return _0x3c54ed;})[_0xed18('0x28')](respondWithFilteredResult(_0x1efe74,_0x3002b9))[_0xed18('0x1e')](handleError(_0x1efe74,null));};exports[_0xed18('0x45')]=function(_0x45611a,_0x14ed51){var _0x3a95f9={'raw':![],'where':{'id':_0x45611a[_0xed18('0x46')]['id']},'include':[{'model':db[_0xed18('0x47')],'as':'mandatoryDispositionPause'}]},_0x3b453c={};_0x3b453c['model']=_['keys'](db[_0xed18('0x30')]['rawAttributes']);_0x3b453c[_0xed18('0x33')]=_[_0xed18('0x34')](_0x45611a['query']);_0x3b453c[_0xed18('0x35')]=_[_0xed18('0x48')](_0x3b453c[_0xed18('0x32')],_0x3b453c['query']);_0x3a95f9[_0xed18('0x36')]=_[_0xed18('0x48')](_0x3b453c[_0xed18('0x32')],qs['fields'](_0x45611a[_0xed18('0x33')][_0xed18('0x37')]));_0x3a95f9['attributes']=_0x3a95f9['attributes'][_0xed18('0x38')]?_0x3a95f9[_0xed18('0x36')]:_0x3b453c[_0xed18('0x32')];if(_0x45611a[_0xed18('0x33')][_0xed18('0x49')]){_0x3a95f9[_0xed18('0x42')]=[{'all':!![]}];}_0x3a95f9=_[_0xed18('0x40')]({},_0x3a95f9,_0x45611a[_0xed18('0x41')]);return db[_0xed18('0x30')][_0xed18('0x4a')](_0x3a95f9)[_0xed18('0x28')](handleEntityNotFound(_0x14ed51,null))[_0xed18('0x28')](respondWithResult(_0x14ed51,null))[_0xed18('0x1e')](handleError(_0x14ed51,null));};exports[_0xed18('0x4b')]=function(_0x877f59,_0x3928a2){return db['ChatWebsite']['create'](_0x877f59[_0xed18('0x4c')],{})[_0xed18('0x28')](function(_0x5e2748){var _0x45975c=_0x877f59[_0xed18('0x4d')][_0xed18('0x29')]({'plain':!![]});if(!_0x45975c)throw new Error(_0xed18('0x4e'));if(_0x45975c[_0xed18('0x4f')]==='user'){var _0x305903=_0x5e2748['get']({'plain':!![]});var _0x3d84c0=_0xed18('0x50');return db[_0xed18('0x51')]['find']({'where':{'name':_0x3d84c0,'userProfileId':_0x45975c[_0xed18('0x52')]},'raw':!![]})[_0xed18('0x28')](function(_0x1ef9f5){if(_0x1ef9f5&&_0x1ef9f5[_0xed18('0x53')]===0x0){return db[_0xed18('0x2a')][_0xed18('0x4b')]({'name':_0x305903[_0xed18('0x2c')],'resourceId':_0x305903['id'],'type':_0x1ef9f5['name'],'sectionId':_0x1ef9f5['id']},{})[_0xed18('0x28')](function(){return _0x5e2748;});}else{return _0x5e2748;}})[_0xed18('0x1e')](function(_0x4f1ec0){logger[_0xed18('0x19')](_0xed18('0x54'),_0x4f1ec0);throw _0x4f1ec0;});}return _0x5e2748;})[_0xed18('0x28')](respondWithResult(_0x3928a2,0xc9))[_0xed18('0x1e')](handleError(_0x3928a2,null));};exports[_0xed18('0x27')]=function(_0x27c7da,_0x589f1c){if(_0x27c7da[_0xed18('0x4c')]['id']){delete _0x27c7da[_0xed18('0x4c')]['id'];}return db[_0xed18('0x30')][_0xed18('0x4a')]({'where':{'id':_0x27c7da[_0xed18('0x46')]['id']},'include':[{'model':db[_0xed18('0x47')],'as':_0xed18('0x2e')}]})[_0xed18('0x28')](handleEntityNotFound(_0x589f1c,null))[_0xed18('0x28')](saveUpdates(_0x27c7da['body'],null))[_0xed18('0x28')](respondWithResult(_0x589f1c,null))[_0xed18('0x1e')](handleError(_0x589f1c,null));};exports[_0xed18('0x2b')]=function(_0x1391a9,_0x5a78eb){return db[_0xed18('0x30')][_0xed18('0x4a')]({'where':{'id':_0x1391a9['params']['id']}})[_0xed18('0x28')](handleEntityNotFound(_0x5a78eb,null))[_0xed18('0x28')](removeEntity(_0x5a78eb,null))[_0xed18('0x1e')](handleError(_0x5a78eb,null));};exports[_0xed18('0x55')]=function(_0x5bb75b,_0x11287a){return db['ChatWebsite'][_0xed18('0x55')]()[_0xed18('0x28')](respondWithResult(_0x11287a,null))[_0xed18('0x1e')](handleError(_0x11287a,null));};exports[_0xed18('0x56')]=function(_0x23a5d8,_0x1034af){if(_0x23a5d8[_0xed18('0x4c')]['id']){delete _0x23a5d8[_0xed18('0x4c')]['id'];}return db[_0xed18('0x30')][_0xed18('0x4a')]({'where':{'id':_0x23a5d8[_0xed18('0x46')]['id']}})['then'](handleEntityNotFound(_0x1034af,null))[_0xed18('0x28')](function(_0x1654dd){if(_0x1654dd){_0x23a5d8[_0xed18('0x4c')][_0xed18('0x57')]=_0x1654dd['id'];return db[_0xed18('0x58')]['create'](_0x23a5d8['body']);}})[_0xed18('0x28')](respondWithResult(_0x1034af,null))[_0xed18('0x1e')](handleError(_0x1034af,null));};exports[_0xed18('0x59')]=function(_0x499b1b,_0x137eb4){var _0x4b72b7={'raw':![],'where':{}};var _0x3665a3={};var _0x4daac3={'count':0x0,'rows':[]};return db[_0xed18('0x30')][_0xed18('0x5a')]({'where':{'id':_0x499b1b['params']['id']}})[_0xed18('0x28')](handleEntityNotFound(_0x137eb4,null))[_0xed18('0x28')](function(_0x35cadf){if(_0x35cadf){_0x3665a3[_0xed18('0x32')]=_[_0xed18('0x34')](db[_0xed18('0x58')][_0xed18('0x5b')]);_0x3665a3[_0xed18('0x33')]=_['keys'](_0x499b1b[_0xed18('0x33')]);_0x3665a3['filters']=_[_0xed18('0x48')](_0x3665a3['model'],_0x3665a3[_0xed18('0x33')]);_0x4b72b7['attributes']=_[_0xed18('0x48')](_0x3665a3[_0xed18('0x32')],qs[_0xed18('0x37')](_0x499b1b[_0xed18('0x33')][_0xed18('0x37')]));_0x4b72b7[_0xed18('0x36')]=_0x4b72b7['attributes'][_0xed18('0x38')]?_0x4b72b7[_0xed18('0x36')]:_0x3665a3[_0xed18('0x32')];if(!_0x499b1b[_0xed18('0x33')][_0xed18('0x39')](_0xed18('0x3a'))){_0x4b72b7[_0xed18('0x23')]=qs[_0xed18('0x23')](_0x499b1b[_0xed18('0x33')][_0xed18('0x23')]);_0x4b72b7[_0xed18('0x22')]=qs[_0xed18('0x22')](_0x499b1b[_0xed18('0x33')]['offset']);}_0x4b72b7[_0xed18('0x3b')]=qs[_0xed18('0x3c')](_0x499b1b['query'][_0xed18('0x3c')]);_0x4b72b7['where']=qs[_0xed18('0x35')](_[_0xed18('0x3d')](_0x499b1b[_0xed18('0x33')],_0x3665a3[_0xed18('0x35')]));_0x4b72b7[_0xed18('0x3f')]['ChatWebsiteId']=_0x35cadf['id'];if(_0x499b1b[_0xed18('0x33')][_0xed18('0x3e')]){_0x4b72b7[_0xed18('0x3f')]=_[_0xed18('0x40')](_0x4b72b7[_0xed18('0x3f')],{'$or':_[_0xed18('0x2f')](_0x4b72b7[_0xed18('0x36')],function(_0xd4375){var _0x2a432e={};_0x2a432e[_0xd4375]={'$like':'%'+_0x499b1b[_0xed18('0x33')][_0xed18('0x3e')]+'%'};return _0x2a432e;})});}_0x4b72b7=_[_0xed18('0x40')]({},_0x4b72b7,_0x499b1b[_0xed18('0x41')]);return db['Disposition'][_0xed18('0x24')]({'where':_0x4b72b7['where']})['then'](function(_0xa01069){_0x4daac3[_0xed18('0x24')]=_0xa01069;if(_0x499b1b['query'][_0xed18('0x49')]){_0x4b72b7['include']=[{'all':!![]}];}return db['Disposition'][_0xed18('0x43')](_0x4b72b7);})[_0xed18('0x28')](function(_0x5c0a49){_0x4daac3['rows']=_0x5c0a49;return _0x4daac3;});}})[_0xed18('0x28')](respondWithFilteredResult(_0x137eb4,_0x4b72b7))['catch'](handleError(_0x137eb4,null));};exports['removeDispositions']=function(_0x400058,_0x577558){return db['ChatWebsite'][_0xed18('0x4a')]({'where':{'id':_0x400058[_0xed18('0x46')]['id']}})[_0xed18('0x28')](handleEntityNotFound(_0x577558,null))[_0xed18('0x28')](function(_0x296072){if(_0x296072){return _0x296072[_0xed18('0x5c')](_0x400058['query'][_0xed18('0x5d')]);}})[_0xed18('0x28')](respondWithStatusCode(_0x577558,null))['catch'](handleError(_0x577558,null));};exports[_0xed18('0x5e')]=function(_0x311fe0,_0x598ae7){if(_0x311fe0[_0xed18('0x4c')]['id']){delete _0x311fe0['body']['id'];}return db[_0xed18('0x30')][_0xed18('0x4a')]({'where':{'id':_0x311fe0['params']['id']}})[_0xed18('0x28')](handleEntityNotFound(_0x598ae7,null))[_0xed18('0x28')](function(_0x4f5716){if(_0x4f5716){_0x311fe0[_0xed18('0x4c')][_0xed18('0x57')]=_0x4f5716['id'];return db['CannedAnswer'][_0xed18('0x4b')](_0x311fe0[_0xed18('0x4c')]);}})['then'](respondWithResult(_0x598ae7,null))[_0xed18('0x1e')](handleError(_0x598ae7,null));};exports[_0xed18('0x5f')]=function(_0x3b4edf,_0x58b010){var _0x5f2085={'raw':![],'where':{}};var _0xfca6a4={};var _0x565c03={'count':0x0,'rows':[]};return db[_0xed18('0x30')][_0xed18('0x5a')]({'where':{'id':_0x3b4edf[_0xed18('0x46')]['id']}})[_0xed18('0x28')](handleEntityNotFound(_0x58b010,null))[_0xed18('0x28')](function(_0x309754){if(_0x309754){_0xfca6a4[_0xed18('0x32')]=_['keys'](db[_0xed18('0x60')]['rawAttributes']);_0xfca6a4[_0xed18('0x33')]=_[_0xed18('0x34')](_0x3b4edf[_0xed18('0x33')]);_0xfca6a4[_0xed18('0x35')]=_[_0xed18('0x48')](_0xfca6a4[_0xed18('0x32')],_0xfca6a4[_0xed18('0x33')]);_0x5f2085['attributes']=_[_0xed18('0x48')](_0xfca6a4[_0xed18('0x32')],qs[_0xed18('0x37')](_0x3b4edf[_0xed18('0x33')][_0xed18('0x37')]));_0x5f2085['attributes']=_0x5f2085[_0xed18('0x36')][_0xed18('0x38')]?_0x5f2085[_0xed18('0x36')]:_0xfca6a4[_0xed18('0x32')];if(!_0x3b4edf['query'][_0xed18('0x39')](_0xed18('0x3a'))){_0x5f2085[_0xed18('0x23')]=qs[_0xed18('0x23')](_0x3b4edf['query'][_0xed18('0x23')]);_0x5f2085[_0xed18('0x22')]=qs['offset'](_0x3b4edf[_0xed18('0x33')]['offset']);}_0x5f2085[_0xed18('0x3b')]=qs[_0xed18('0x3c')](_0x3b4edf[_0xed18('0x33')]['sort']);_0x5f2085[_0xed18('0x3f')]=qs[_0xed18('0x35')](_[_0xed18('0x3d')](_0x3b4edf[_0xed18('0x33')],_0xfca6a4['filters']));_0x5f2085[_0xed18('0x3f')][_0xed18('0x57')]=_0x309754['id'];if(_0x3b4edf[_0xed18('0x33')][_0xed18('0x3e')]){_0x5f2085[_0xed18('0x3f')]=_['merge'](_0x5f2085[_0xed18('0x3f')],{'$or':_[_0xed18('0x2f')](_0x5f2085['attributes'],function(_0x26f282){var _0x3f96a2={};_0x3f96a2[_0x26f282]={'$like':'%'+_0x3b4edf[_0xed18('0x33')][_0xed18('0x3e')]+'%'};return _0x3f96a2;})});}_0x5f2085=_[_0xed18('0x40')]({},_0x5f2085,_0x3b4edf['options']);return db[_0xed18('0x60')][_0xed18('0x24')]({'where':_0x5f2085[_0xed18('0x3f')]})[_0xed18('0x28')](function(_0x1805c6){_0x565c03['count']=_0x1805c6;if(_0x3b4edf['query'][_0xed18('0x49')]){_0x5f2085['include']=[{'all':!![]}];}return db[_0xed18('0x60')][_0xed18('0x43')](_0x5f2085);})[_0xed18('0x28')](function(_0x1e7bac){_0x565c03[_0xed18('0x44')]=_0x1e7bac;return _0x565c03;});}})[_0xed18('0x28')](respondWithFilteredResult(_0x58b010,_0x5f2085))['catch'](handleError(_0x58b010,null));};exports[_0xed18('0x61')]=function(_0x468475,_0xa0100){return db['ChatWebsite'][_0xed18('0x4a')]({'where':{'id':_0x468475[_0xed18('0x46')]['id']}})[_0xed18('0x28')](handleEntityNotFound(_0xa0100,null))[_0xed18('0x28')](function(_0x2f1285){if(_0x2f1285){return _0x2f1285[_0xed18('0x61')](_0x468475[_0xed18('0x33')][_0xed18('0x5d')]);}})[_0xed18('0x28')](respondWithStatusCode(_0xa0100,null))[_0xed18('0x1e')](handleError(_0xa0100,null));};exports['addLogo']=function(_0x39bc08,_0x199944){_0x39bc08[_0xed18('0x4c')][_0xed18('0x62')]=_0x39bc08['file'][_0xed18('0x63')];return db[_0xed18('0x30')][_0xed18('0x4a')]({'where':{'id':_0x39bc08[_0xed18('0x46')]['id']}})[_0xed18('0x28')](handleEntityNotFound(_0x199944,null))[_0xed18('0x28')](saveUpdates(_0x39bc08['body'],null))[_0xed18('0x28')](respondWithResult(_0x199944,null))[_0xed18('0x1e')](handleError(_0x199944,null));};exports['addAvatar']=function(_0x1b17aa,_0x2d2fa1){_0x1b17aa[_0xed18('0x4c')][_0xed18('0x64')]=_0x1b17aa[_0xed18('0x65')][_0xed18('0x63')];return db[_0xed18('0x30')][_0xed18('0x4a')]({'where':{'id':_0x1b17aa[_0xed18('0x46')]['id']}})[_0xed18('0x28')](handleEntityNotFound(_0x2d2fa1,null))[_0xed18('0x28')](saveUpdates(_0x1b17aa[_0xed18('0x4c')],null))['then'](respondWithResult(_0x2d2fa1,null))[_0xed18('0x1e')](handleError(_0x2d2fa1,null));};exports['addCustomerAvatar']=function(_0x26aee2,_0x6a9a09){_0x26aee2[_0xed18('0x4c')][_0xed18('0x66')]=_0x26aee2[_0xed18('0x65')][_0xed18('0x63')];return db[_0xed18('0x30')][_0xed18('0x4a')]({'where':{'id':_0x26aee2[_0xed18('0x46')]['id']}})[_0xed18('0x28')](handleEntityNotFound(_0x6a9a09,null))[_0xed18('0x28')](saveUpdates(_0x26aee2[_0xed18('0x4c')],null))[_0xed18('0x28')](respondWithResult(_0x6a9a09,null))['catch'](handleError(_0x6a9a09,null));};exports[_0xed18('0x67')]=function(_0x29fdac,_0x50a4b2){_0x29fdac['body'][_0xed18('0x68')]=_0x29fdac[_0xed18('0x65')]['filename'];return db[_0xed18('0x30')]['find']({'where':{'id':_0x29fdac['params']['id']}})['then'](handleEntityNotFound(_0x50a4b2,null))['then'](saveUpdates(_0x29fdac[_0xed18('0x4c')],null))[_0xed18('0x28')](respondWithResult(_0x50a4b2,null))['catch'](handleError(_0x50a4b2,null));};exports[_0xed18('0x69')]=function(_0x50fecc,_0x2160f5){var _0x8334ee=path['join'](config['root'],_0xed18('0x6a'));var _0x11a288={'where':{'id':_0x50fecc[_0xed18('0x46')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x20d0bd=![];return require('../../config/license/util')[_0xed18('0x6b')]()['then'](function(_0x3c354b){if(_0x3c354b){_0x20d0bd=_0x3c354b[_0xed18('0x6c')];}})['then'](function(){return db[_0xed18('0x30')][_0xed18('0x4a')](_0x11a288);})[_0xed18('0x28')](handleEntityNotFound(_0x2160f5,null))[_0xed18('0x28')](function(_0xf7c120){if(_0xf7c120){if(!_[_0xed18('0x6d')](_0xf7c120[_0xed18('0x62')])){if(fs[_0xed18('0x6e')](path[_0xed18('0x6f')](config[_0xed18('0x70')],_0xed18('0x71'),_0xf7c120[_0xed18('0x62')]))&&_0x20d0bd){_0x8334ee=path[_0xed18('0x6f')](config[_0xed18('0x70')],_0xed18('0x71'),_0xf7c120[_0xed18('0x62')]);}}return _0x2160f5[_0xed18('0x72')](_0x8334ee);}})[_0xed18('0x1e')](handleError(_0x2160f5,null));};exports['getAvatar']=function(_0x233f9d,_0x2b057a){var _0x5beac0=path[_0xed18('0x6f')](config[_0xed18('0x70')],'server/files/images/avatars/default_avatar.png');var _0x12cb86={'where':{'id':_0x233f9d[_0xed18('0x46')]['id']},'attributes':['id',_0xed18('0x64')],'raw':!![]};return db[_0xed18('0x30')][_0xed18('0x4a')](_0x12cb86)['then'](handleEntityNotFound(_0x2b057a,null))[_0xed18('0x28')](function(_0x101185){if(_0x101185){if(!_['isNil'](_0x101185[_0xed18('0x64')])){if(fs[_0xed18('0x6e')](path[_0xed18('0x6f')](config[_0xed18('0x70')],_0xed18('0x73'),_0x101185[_0xed18('0x64')]))){_0x5beac0=path[_0xed18('0x6f')](config[_0xed18('0x70')],'server/files/images/avatars/',_0x101185[_0xed18('0x64')]);}}return _0x2b057a[_0xed18('0x72')](_0x5beac0);}})[_0xed18('0x1e')](handleError(_0x2b057a,null));};exports[_0xed18('0x74')]=function(_0x4c8eff,_0x213590){var _0x17f3c6=path[_0xed18('0x6f')](config[_0xed18('0x70')],'server/files/images/avatars/customer_avatar.png');var _0x4860cc={'where':{'id':_0x4c8eff['params']['id']},'attributes':['id',_0xed18('0x66'),_0xed18('0x75')],'raw':!![]};return db[_0xed18('0x30')][_0xed18('0x4a')](_0x4860cc)[_0xed18('0x28')](handleEntityNotFound(_0x213590,null))[_0xed18('0x28')](function(_0x2aa343){if(_0x2aa343){if(!_['isNil'](_0x2aa343['customerAvatar'])){if(fs[_0xed18('0x6e')](path[_0xed18('0x6f')](config[_0xed18('0x70')],_0xed18('0x73'),_0x2aa343['customerAvatar']))&&_0x2aa343['showCustomerAvatar']){_0x17f3c6=path[_0xed18('0x6f')](config[_0xed18('0x70')],_0xed18('0x73'),_0x2aa343[_0xed18('0x66')]);}}return _0x213590[_0xed18('0x72')](_0x17f3c6);}})['catch'](handleError(_0x213590,null));};exports['getSystemAvatar']=function(_0x2fcd43,_0x162964){var _0x20311c=path[_0xed18('0x6f')](config[_0xed18('0x70')],_0xed18('0x76'));var _0x5300bb={'where':{'id':_0x2fcd43[_0xed18('0x46')]['id']},'attributes':['id',_0xed18('0x68')],'raw':!![]};return db[_0xed18('0x30')][_0xed18('0x4a')](_0x5300bb)[_0xed18('0x28')](handleEntityNotFound(_0x162964,null))[_0xed18('0x28')](function(_0x135b5c){if(_0x135b5c){if(!_['isNil'](_0x135b5c[_0xed18('0x68')])){if(fs[_0xed18('0x6e')](path[_0xed18('0x6f')](config[_0xed18('0x70')],_0xed18('0x73'),_0x135b5c['systemAvatar']))){_0x20311c=path[_0xed18('0x6f')](config['root'],_0xed18('0x73'),_0x135b5c[_0xed18('0x68')]);}}return _0x162964['download'](_0x20311c);}})['catch'](handleError(_0x162964,null));};exports[_0xed18('0x77')]=function(_0x1d25fc,_0x2ad5c7){var _0x2e6c66=require('user-agent-parser');var _0x4b1a54=new _0x2e6c66();var _0x2929fa=_0x4b1a54[_0xed18('0x78')](_0x1d25fc[_0xed18('0x79')][_0xed18('0x7a')])[_0xed18('0x7b')]();var _0x205ab8={'body':_0x1d25fc[_0xed18('0x4c')],'channel':_0xed18('0x7c')};var _0xf3be98=[];var _0x4077d3=[];var _0x50157a={};var _0x3a52a3=![];return db[_0xed18('0x7d')][_0xed18('0x55')]()[_0xed18('0x28')](function(_0x3c3ad6){if(!_0x3c3ad6){throw new db[(_0xed18('0x7e'))]['ValidationError']('no\x20available\x20attributes');}_0xf3be98=_[_0xed18('0x7f')](_[_0xed18('0x34')](_0x3c3ad6),['createdAt',_0xed18('0x80')]);_0x4077d3=_[_0xed18('0x7f')](_['keys'](_0x3c3ad6),[_0xed18('0x81'),'updatedAt','CompanyId',_0xed18('0x82')]);if(_0x1d25fc[_0xed18('0x4c')]['id']){delete _0x1d25fc[_0xed18('0x4c')]['id'];}if(_[_0xed18('0x6d')](_0x1d25fc[_0xed18('0x4c')][_0xed18('0x83')])){throw new db[(_0xed18('0x7e'))][(_0xed18('0x84'))](_0xed18('0x85'));}if(_['isNil'](_0x1d25fc[_0xed18('0x4c')][_0xed18('0x4c')])||_0x1d25fc[_0xed18('0x4c')][_0xed18('0x4c')]===''){throw new db[(_0xed18('0x7e'))]['ValidationError'](_0xed18('0x86'));}if(_[_0xed18('0x6d')](_0x1d25fc['body'][_0xed18('0x87')])){throw new db[(_0xed18('0x7e'))][(_0xed18('0x84'))](_0xed18('0x88')+_0x4077d3);}if(!_[_0xed18('0x89')](_0x4077d3,_0x1d25fc[_0xed18('0x4c')][_0xed18('0x87')])){throw new db['Sequelize'][(_0xed18('0x84'))](_0xed18('0x8a')+_0x4077d3);}_0x50157a[_0x1d25fc[_0xed18('0x4c')]['mapKey']]=_0x1d25fc['body'][_0xed18('0x83')];})[_0xed18('0x28')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x1d25fc['params']['id']},'include':[{'model':db[_0xed18('0x8b')],'as':_0xed18('0x8c'),'include':[{'model':db[_0xed18('0x7d')],'as':'Contacts','where':_0x50157a,'limit':0x1,'order':[[_0xed18('0x80'),_0xed18('0x8d')]]}]},{'model':db[_0xed18('0x8e')],'as':_0xed18('0x8f')}]});})[_0xed18('0x28')](handleEntityNotFound(_0x2ad5c7,null))[_0xed18('0x28')](function(_0x4fb137){if(_0x4fb137&&_0x4fb137[_0xed18('0x8c')]){_0x205ab8['account']=_0x4fb137;_0x205ab8[_0xed18('0x90')]=_0x4fb137[_0xed18('0x8f')];_0x205ab8['list']=_0x4fb137[_0xed18('0x8c')];_0x205ab8[_0xed18('0x90')]=_['orderBy'](_0x205ab8[_0xed18('0x90')],['priority'],['asc']);if(_0x205ab8['account']['Applications']){delete _0x205ab8[_0xed18('0x91')]['Applications'];}if(_0x205ab8[_0xed18('0x91')][_0xed18('0x8c')]&&_0x205ab8[_0xed18('0x91')][_0xed18('0x8c')][_0xed18('0x92')][_0xed18('0x38')]){return _0x205ab8[_0xed18('0x91')]['List'][_0xed18('0x92')][0x0];}var _0x32074b=_[_0xed18('0xb')](_0x1d25fc[_0xed18('0x4c')],{'firstName':_0x1d25fc[_0xed18('0x4c')][_0xed18('0x83')],'ListId':_0x4fb137[_0xed18('0x82')]});_0x32074b[_0x1d25fc['body'][_0xed18('0x87')]]=_0x1d25fc['body'][_0xed18('0x83')];return db[_0xed18('0x7d')][_0xed18('0x4b')](_0x32074b,{'fields':_0xf3be98,'raw':!![]});}})[_0xed18('0x28')](handleEntityNotFound(_0x2ad5c7,null))[_0xed18('0x28')](function(_0x3ad7ff){_0x205ab8[_0xed18('0x93')]=_0x3ad7ff;var _0x4ce7b1=_0x1d25fc[_0xed18('0x4c')][_0xed18('0x94')];if(_0x1d25fc[_0xed18('0x79')][_0xed18('0x95')]){_0x4ce7b1=_0x1d25fc[_0xed18('0x79')][_0xed18('0x95')];}else if(_0x1d25fc['headers'][_0xed18('0x96')]){_0x4ce7b1=_[_0xed18('0x97')](_0x1d25fc['headers'][_0xed18('0x96')][_0xed18('0x98')](','));}if(_0x3ad7ff){var _0x46b4f4={'ContactId':_0x3ad7ff['id'],'ChatWebsiteId':_0x1d25fc[_0xed18('0x46')]['id'],'from':(_0x3ad7ff[_0xed18('0x99')]||'')+'\x20'+(_0x3ad7ff[_0xed18('0x9a')]||''),'customerIp':_0x4ce7b1,'customerPort':_0x1d25fc[_0xed18('0x79')][_0xed18('0x9b')]?_0x1d25fc[_0xed18('0x79')]['x-real-port']:null,'referer':_0x1d25fc['body'][_0xed18('0x9c')],'browserName':_0x2929fa['browser'][_0xed18('0x2c')]&&_0x2929fa['browser'][_0xed18('0x9d')]?util[_0xed18('0x9e')]('%s\x20%s',_0x2929fa[_0xed18('0x9f')][_0xed18('0x2c')],_0x2929fa[_0xed18('0x9f')][_0xed18('0x9d')]):_0xed18('0xa0'),'browserVersion':_0x2929fa['browser'][_0xed18('0x9d')]||_0xed18('0xa0'),'osName':util[_0xed18('0x9e')](_0xed18('0xa1'),_0x2929fa['os']['name'],_0x2929fa['os'][_0xed18('0x9d')]),'osVersion':_0x2929fa['os'][_0xed18('0x9d')],'deviceModel':_0x2929fa[_0xed18('0xa2')]['model']&&_0x2929fa[_0xed18('0xa2')][_0xed18('0xa3')]?util['format'](_0xed18('0xa4'),_0x2929fa[_0xed18('0xa2')][_0xed18('0x32')],_0x2929fa[_0xed18('0xa2')]['vendor'],_0x2929fa[_0xed18('0xa2')][_0xed18('0x31')]):null,'deviceVendor':_0x2929fa[_0xed18('0xa2')][_0xed18('0xa3')],'deviceType':_0x2929fa[_0xed18('0xa2')][_0xed18('0x31')],'formData':JSON[_0xed18('0x18')](_0x1d25fc[_0xed18('0x4c')])};var _0x526ba0={'ChatWebsiteId':_0x1d25fc['params']['id'],'closed':![]};if(_0x1d25fc[_0xed18('0x4c')][_0xed18('0xa5')]){_0x526ba0[_0xed18('0xa5')]=_0x1d25fc[_0xed18('0x4c')]['threadId'];return db['ChatInteraction'][_0xed18('0x4a')]({'where':_0x526ba0})[_0xed18('0x28')](function(_0x295f5c){if(_0x295f5c){return[_0x295f5c,![]];}_0x46b4f4['threadId']=_0x1d25fc[_0xed18('0x4c')][_0xed18('0xa5')];_0x46b4f4[_0xed18('0xa6')]=_0x1d25fc[_0xed18('0x4c')]['externalUrl'];return db[_0xed18('0xa7')][_0xed18('0x4b')](_0x46b4f4)[_0xed18('0x28')](function(_0x2a9c5c){return[_0x2a9c5c,!![]];});});}_0x526ba0[_0xed18('0xa8')]=_0x3ad7ff['id'];if(_0x1d25fc[_0xed18('0x4c')]['interaction']&&_0x1d25fc[_0xed18('0x4c')][_0xed18('0xa9')]['id']){_0x526ba0['id']=_0x1d25fc[_0xed18('0x4c')]['interaction']['id'];return db[_0xed18('0xa7')][_0xed18('0x4a')]({'where':_0x526ba0})[_0xed18('0x28')](function(_0x28001f){if(_0x28001f){return[_0x28001f,![]];}return db[_0xed18('0xa7')][_0xed18('0x4b')](_0x46b4f4)[_0xed18('0x28')](function(_0x47012d){return[_0x47012d,!![]];});});}return db[_0xed18('0xa7')][_0xed18('0x4b')](_0x46b4f4)[_0xed18('0x28')](function(_0x2b0e9e){return[_0x2b0e9e,!![]];});}})[_0xed18('0xaa')](function(_0x4da4bc,_0x1ad05d){if(_0x4da4bc){_0x3a52a3=_0x1ad05d;if(!_0x1ad05d){var _0xefb6af={'from':(_0x205ab8[_0xed18('0x93')][_0xed18('0x99')]||'')+'\x20'+(_0x205ab8[_0xed18('0x93')][_0xed18('0x9a')]||'')};if(_0x1d25fc[_0xed18('0x4c')]['threadId']&&_0x1d25fc[_0xed18('0x4c')][_0xed18('0xab')]&&_0x1d25fc[_0xed18('0x4c')][_0xed18('0xa5')]!=_0x1d25fc[_0xed18('0x4c')][_0xed18('0xab')]){_0xefb6af[_0xed18('0xa5')]=_0x1d25fc[_0xed18('0x4c')][_0xed18('0xab')];}return _0x4da4bc[_0xed18('0x27')](_0xefb6af);}else{return _0x4da4bc;}}})[_0xed18('0x28')](function(_0x302622){_0x205ab8[_0xed18('0xa9')]=_0x302622[_0xed18('0x29')]({'plain':!![]});_0x205ab8['interaction'][_0xed18('0xac')]=_0x3a52a3;if(_0x205ab8['interaction'][_0xed18('0xac')]){if(_0x205ab8[_0xed18('0x91')][_0xed18('0xad')]){_0x205ab8[_0xed18('0x90')][_0xed18('0xae')]({'id':0x0,'priority':_0x205ab8[_0xed18('0x90')][_0xed18('0x38')]+0x1,'app':_0xed18('0xaf'),'appdata':_0xed18('0xb0'),'interval':_0xed18('0xb1')});}}return db['ChatMessage'][_0xed18('0x4b')]({'body':_0x1d25fc[_0xed18('0x4c')][_0xed18('0x4c')],'ChatWebsiteId':_0x1d25fc[_0xed18('0x46')]['id'],'ChatInteractionId':_0x302622['id'],'direction':'in','ContactId':_0x205ab8[_0xed18('0x93')]['id'],'AttachmentId':_0x1d25fc[_0xed18('0x4c')][_0xed18('0xb2')]});})[_0xed18('0x28')](function(_0x437867){_0x205ab8[_0xed18('0x1c')]=_0x437867;if(_0x205ab8[_0xed18('0xa9')][_0xed18('0xb3')]){return db['User'][_0xed18('0x4a')]({'attributes':['id',_0xed18('0x2c')],'where':{'id':_0x205ab8[_0xed18('0xa9')][_0xed18('0xb3')]}})[_0xed18('0x28')](function(_0x2dc5cd){if(_0x2dc5cd){_0x205ab8[_0xed18('0x90')]['unshift']({'id':0x0,'priority':0x0,'app':_0xed18('0xb4'),'appdata':_0x2dc5cd['name']+','+(_0x205ab8[_0xed18('0x91')]['waitForTheAssignedAgent']||0xa),'interval':_0xed18('0xb1')});_0x205ab8[_0xed18('0xb5')]=!![];}return respondWithRpcPromise(_0xed18('0xb6'),_0xed18('0xb7'),_0x205ab8);});}return respondWithRpcPromise(_0xed18('0xb6'),'startRouting',_0x205ab8);})[_0xed18('0x28')](function(_0x94173f){respondWithRpcPromise('EventManager',_0xed18('0xb8'),{'event':'notify','message':_0x94173f},client9002);return _0x94173f;})[_0xed18('0x28')](respondWithResult(_0x2ad5c7,null))['catch'](handleError(_0x2ad5c7,null));};exports[_0xed18('0xb9')]=function(_0x4ba413,_0xb47f5a){var _0x1e3440,_0x3cd812,_0x4c0fe0;var _0x5ca994=[];var _0x5b8dbd={};var _0x44962f=_0x4ba413[_0xed18('0xba')]||[];var _0x2ea77=[];var _0x10458a;return db['CmContact'][_0xed18('0x55')]()[_0xed18('0x28')](function(_0x5b479f){if(!_0x5b479f){throw new db[(_0xed18('0x7e'))]['ValidationError'](_0xed18('0xbb'));}_0x5ca994=_[_0xed18('0x7f')](_['keys'](_0x5b479f),[_0xed18('0x81'),'updatedAt',_0xed18('0xbc'),_0xed18('0x82')]);if(_0x4ba413[_0xed18('0x4c')]['id']){delete _0x4ba413[_0xed18('0x4c')]['id'];}if(_[_0xed18('0x6d')](_0x4ba413[_0xed18('0x4c')]['from'])){throw _0xb47f5a['status'](0x1f4)[_0xed18('0x2d')](new db[(_0xed18('0x7e'))][(_0xed18('0x84'))](_0xed18('0x85')));}if(_['isNil'](_0x4ba413[_0xed18('0x4c')][_0xed18('0x4c')])||_0x4ba413[_0xed18('0x4c')][_0xed18('0x4c')]===''){throw _0xb47f5a['status'](0x1f4)[_0xed18('0x2d')](new db[(_0xed18('0x7e'))]['ValidationError'](_0xed18('0x86')));}if(_[_0xed18('0x6d')](_0x4ba413[_0xed18('0x4c')][_0xed18('0xbd')])){throw _0xb47f5a[_0xed18('0x20')](0x1f4)[_0xed18('0x2d')](new db[(_0xed18('0x7e'))]['ValidationError']('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5ca994));}if(!_['includes'](_0x5ca994,_0x4ba413[_0xed18('0x4c')][_0xed18('0xbd')])){throw _0xb47f5a[_0xed18('0x20')](0x1f4)['send'](new db[(_0xed18('0x7e'))][(_0xed18('0x84'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5ca994));}_0x5b8dbd[_0x4ba413[_0xed18('0x4c')][_0xed18('0xbd')]]=_0x4ba413[_0xed18('0x4c')][_0xed18('0x83')];})[_0xed18('0x28')](function(){return db[_0xed18('0x30')]['find']({'where':{'id':_0x4ba413['params']['id']},'include':[{'model':db[_0xed18('0x8b')],'as':_0xed18('0x8c')},{'model':db[_0xed18('0xbe')],'as':_0xed18('0xbe')}]});})['then'](handleEntityNotFound(_0xb47f5a,null))[_0xed18('0x28')](function(_0x4583a3){if(_0x4583a3&&_0x4583a3[_0xed18('0x8c')]){_0x3cd812=_0x4583a3;var _0x246556=_[_0xed18('0xb')](_0x4ba413[_0xed18('0x4c')],{'firstName':_0x4ba413[_0xed18('0x4c')][_0xed18('0x83')],'phone':_0x4ba413[_0xed18('0x4c')]['from'],'ListId':_0x4583a3[_0xed18('0x82')]});_0x246556[_0x4ba413['body'][_0xed18('0xbd')]]=_0x4ba413[_0xed18('0x4c')][_0xed18('0x83')];return db[_0xed18('0x7d')][_0xed18('0xbf')]({'where':_0x5b8dbd,'defaults':_0x246556});}})[_0xed18('0xaa')](function(_0x379378){if(_0x379378){_0x4c0fe0=_0x379378;var _0x4b8163=fs[_0xed18('0xc0')](path[_0xed18('0x6f')](config[_0xed18('0x70')],_0xed18('0xc1')),_0xed18('0xc2'));var _0x2c92eb=ejs[_0xed18('0xc3')](_0x4b8163,{'body':_[_0xed18('0xc4')](_0x4ba413[_0xed18('0x4c')][_0xed18('0x4c')]),'bodyTitle':_0x3cd812[_0xed18('0xc5')]});return db[_0xed18('0xc6')]['create']({'body':_0x2c92eb,'plainBody':htmlToText[_0xed18('0xc7')](_0x2c92eb),'ContactId':_0x379378['id'],'ChatWebsiteId':_0x3cd812['id']});}})['then'](function(_0x1956da){_0x10458a=_0x1956da;if(_0x44962f[_0xed18('0x38')]){var _0x49e556=_0x44962f[_0xed18('0x2f')](function(_0x5137c8){return{'name':_0x5137c8[_0xed18('0xc8')],'basename':_0x5137c8['filename'],'type':_0x5137c8[_0xed18('0xc9')],'ChatOfflineMessageId':_0x1956da['id']};});_0x2ea77=_0x49e556[_0xed18('0x2f')](_0x1374d3=>{var _0x36c37f={'filename':_0x1374d3['name'],'path':path[_0xed18('0x6f')](config[_0xed18('0x70')],'server','files',_0xed18('0xca'),_0xed18('0xcb'),_0x1374d3[_0xed18('0xcc')])};return _0x36c37f;});if(!_0x3cd812[_0xed18('0xcd')]){return db[_0xed18('0xce')][_0xed18('0xcf')](function(_0xf47b07){return db[_0xed18('0xd0')]['bulkCreate'](_0x49e556,{'transaction':_0xf47b07});});}}})['then'](function(){if(_0x10458a){_0x1e3440=_0x10458a;return db[_0xed18('0xbe')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xed18('0xd1')],'as':_0xed18('0xd2'),'raw':!![],'include':[{'model':db[_0xed18('0xd3')],'as':_0xed18('0xd3'),'raw':!![]}]}]});}})['then'](function(_0x4fc19e){if(_0x4fc19e&&_0x4fc19e[_0xed18('0xd2')]&&_0x3cd812[_0xed18('0xd4')]&&_0x3cd812['forwardOfflineAddress']){var _0x4ea996=_0x4fc19e[_0xed18('0xd5')]();return respondWithRpcPromise(_0xed18('0xd6'),_0xed18('0xd7'),{'account':_0x4ea996,'message':{'from':util[_0xed18('0x9e')]('\x22%s\x22\x20<%s>',_0x4fc19e['name'],_0x4fc19e[_0xed18('0xd8')]||_0x4fc19e[_0xed18('0xd2')][_0xed18('0x4d')]),'to':_0x3cd812[_0xed18('0xd9')],'subject':_0x3cd812[_0xed18('0xda')],'html':_0x1e3440[_0xed18('0x4c')],'attachments':_0x2ea77}},client9003)[_0xed18('0x28')](function(){return _0x1e3440;})[_0xed18('0x1e')](function(_0x288667){logger['error'](_0x288667);});}})['then'](function(){if(_0x3cd812&&_0x3cd812[_0xed18('0xcd')]&&_0x3cd812[_0xed18('0xdb')]){var _0x2fb8fa=[];if(_0x44962f['length']){_0x2fb8fa=_0x44962f[_0xed18('0x2f')](function(_0x58e69e){return{'name':_0x58e69e[_0xed18('0xc8')],'basename':_0x58e69e[_0xed18('0x63')],'type':_0x58e69e[_0xed18('0xc9')],'ChatOfflineMessageId':_0x10458a['id']};});}var _0x578d31;if(!_[_0xed18('0x6d')](_0x3cd812[_0xed18('0xdc')])){var _0x53a831=_[_0xed18('0x2f')](_0x4ba413['body'],function(_0x18ee0d){return _0x18ee0d;});var _0x4f72fb=_['toPairsIn'](_0x53a831)[0x0];var _0x8876b0=_[_0xed18('0xdd')](_0x4f72fb,function(_0x4df5d0){return _0x4df5d0;});_0x578d31=_0x8876b0[0x1][_0x3cd812[_0xed18('0xdc')]];}var _0x325715={'from':_0x4c0fe0['email'],'firstName':_0x4c0fe0[_0xed18('0x99')],'lastName':_0x4c0fe0['lastName'],'mapKey':_0xed18('0xd8'),'message':{'from':_0x4c0fe0[_0xed18('0xd8')],'to':_0x3cd812[_0xed18('0xbe')]['email'],'cc':'','subject':_[_0xed18('0x6d')](_0x578d31)?_0x3cd812[_0xed18('0xda')]:_0x578d31,'messageId':'','sentAt':new Date(),'attach':_0x2fb8fa[_0xed18('0x38')],'attachments':_0x2fb8fa,'originChannel':_0xed18('0xde'),'ChatWebsiteId':_0x3cd812['id'],'ChatOfflineMessageId':_0x1e3440['id'],'originTo':_0x3cd812[_0xed18('0xbe')][_0xed18('0xd8')]},'body':_0x1e3440[_0xed18('0x4c')]};var _0x1a0158={'account':{'id':_0x3cd812[_0xed18('0xdb')]},'body':_0x325715,'log':_0xed18('0xdf')};return respondWithRpcPromise(_0xed18('0xdf'),_0xed18('0xe0'),_0x1a0158,client9001)[_0xed18('0x28')](function(){return _0x1e3440;})[_0xed18('0x1e')](function(_0x391ab9){logger[_0xed18('0x19')](_0x391ab9);});}return;})[_0xed18('0x28')](function(){if(_0x1e3440){return _0x1e3440;}})[_0xed18('0x28')](respondWithResult(_0xb47f5a,null))['catch'](function(_0x318ad4){logger['error'](_0xed18('0x1e'),_0x318ad4);for(var _0xc818f2 of _0x44962f){var _0x5009b7=path[_0xed18('0x6f')](config[_0xed18('0x70')],_0xed18('0xe1'),'files',_0xed18('0xca'),_0xed18('0xcb'),_0xc818f2['filename']);fs_extra[_0xed18('0xe2')](_0x5009b7)[_0xed18('0x1e')](function(_0x45fd2c){logger['error'](_0xed18('0xe3'),_0x5009b7,_0x45fd2c);});}});};exports[_0xed18('0xe4')]=function(_0x44684f,_0x4b1791){return db[_0xed18('0xa7')][_0xed18('0x4a')]({'where':{'id':_0x44684f[_0xed18('0x46')]['id']}})[_0xed18('0x28')](handleEntityNotFound(_0x4b1791,null))[_0xed18('0x28')](function(_0x5b37a4){if(_0x5b37a4){return _0x5b37a4['addInteraction'](_0x44684f[_0xed18('0x4c')][_0xed18('0x5d')],_[_0xed18('0xe5')](_0x44684f['body'],[_0xed18('0x5d'),'id'])||{});}})[_0xed18('0x28')](respondWithResult(_0x4b1791,null))[_0xed18('0x1e')](handleError(_0x4b1791,null));};exports[_0xed18('0xe6')]=function(_0x6e759b,_0x6dcc3d){var _0x74f64b={'raw':![],'where':{}};var _0x5d86bc={};var _0x3f2db9={'count':0x0,'rows':[]};return db[_0xed18('0x30')][_0xed18('0x5a')]({'where':{'id':_0x6e759b[_0xed18('0x46')]['id']}})[_0xed18('0x28')](handleEntityNotFound(_0x6dcc3d,null))[_0xed18('0x28')](function(_0x251bd8){if(_0x251bd8){_0x5d86bc['model']=_[_0xed18('0x34')](db[_0xed18('0xa7')][_0xed18('0x5b')]);_0x5d86bc[_0xed18('0x33')]=_[_0xed18('0x34')](_0x6e759b['query']);_0x5d86bc[_0xed18('0x35')]=_[_0xed18('0x48')](_0x5d86bc[_0xed18('0x32')],_0x5d86bc['query']);_0x74f64b['attributes']=_['intersection'](_0x5d86bc[_0xed18('0x32')],qs['fields'](_0x6e759b[_0xed18('0x33')][_0xed18('0x37')]));_0x74f64b[_0xed18('0x36')]=_0x74f64b[_0xed18('0x36')][_0xed18('0x38')]?_0x74f64b[_0xed18('0x36')]:_0x5d86bc[_0xed18('0x32')];if(!_0x6e759b[_0xed18('0x33')][_0xed18('0x39')]('nolimit')){_0x74f64b[_0xed18('0x23')]=qs[_0xed18('0x23')](_0x6e759b[_0xed18('0x33')][_0xed18('0x23')]);_0x74f64b['offset']=qs['offset'](_0x6e759b[_0xed18('0x33')][_0xed18('0x22')]);}_0x74f64b[_0xed18('0x3b')]=qs[_0xed18('0x3c')](_0x6e759b[_0xed18('0x33')][_0xed18('0x3c')]);_0x74f64b[_0xed18('0x3f')]=qs[_0xed18('0x35')](_[_0xed18('0x3d')](_0x6e759b['query'],_0x5d86bc['filters']));_0x74f64b[_0xed18('0x3f')][_0xed18('0x57')]=_0x251bd8['id'];if(_0x6e759b[_0xed18('0x33')]['filter']){_0x74f64b[_0xed18('0x3f')]=_[_0xed18('0x40')](_0x74f64b[_0xed18('0x3f')],{'$or':_[_0xed18('0x2f')](_0x74f64b[_0xed18('0x36')],function(_0x30a6c0){var _0x2b09fc={};_0x2b09fc[_0x30a6c0]={'$like':'%'+_0x6e759b[_0xed18('0x33')][_0xed18('0x3e')]+'%'};return _0x2b09fc;})});}_0x74f64b=_[_0xed18('0x40')]({},_0x74f64b,_0x6e759b[_0xed18('0x41')]);return db[_0xed18('0xa7')]['count']({'where':_0x74f64b['where']})[_0xed18('0x28')](function(_0x10c9b2){_0x3f2db9[_0xed18('0x24')]=_0x10c9b2;if(_0x6e759b['query'][_0xed18('0x49')]){_0x74f64b[_0xed18('0x42')]=[{'model':db[_0xed18('0x7d')],'as':_0xed18('0xe7'),'required':![]},{'model':db['User'],'as':_0xed18('0xe8'),'attributes':[_0xed18('0x2c'),_0xed18('0xe9'),_0xed18('0xea')],'required':![]},{'model':db['Tag'],'as':_0xed18('0xeb'),'attributes':['id',_0xed18('0x2c'),'color'],'where':_0x6e759b[_0xed18('0x33')]['tag']?{'id':_0x6e759b[_0xed18('0x33')][_0xed18('0xec')]}:undefined,'required':_0x6e759b[_0xed18('0x33')][_0xed18('0xec')]?!![]:![]}];}return db[_0xed18('0xa7')]['findAll'](_0x74f64b);})['then'](function(_0x54d9bd){_0x3f2db9[_0xed18('0x44')]=_0x54d9bd;return _0x3f2db9;});}})[_0xed18('0x28')](respondWithFilteredResult(_0x6dcc3d,_0x74f64b))[_0xed18('0x1e')](handleError(_0x6dcc3d,null));};function iftimePromise(_0x1b1390,_0x8b4535){return respondWithRpcPromise(_0xed18('0xed'),'getSnippet',{'command':_0x8b4535['timezone']?util[_0xed18('0x9e')](_0xed18('0xee'),_0x1b1390[_0xed18('0xef')],_0x8b4535['timezone']):util[_0xed18('0x9e')](_0xed18('0xf0'),_0x1b1390[_0xed18('0xef')])},client9002)[_0xed18('0x28')](function(_0x424ded){var _0x3bf2bd=_0x424ded&&_0x424ded['indexOf'](_0xed18('0xf1'))>=0x0?!![]:![];logger['info']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x8b4535['id'],_0x1b1390['id'],_0x1b1390[_0xed18('0xef')],_0x3bf2bd?_0xed18('0xf2'):_0xed18('0xf3'),_0x8b4535['timezone']?_0x8b4535[_0xed18('0xf4')]:_0xed18('0xf5'));return _0x3bf2bd;})[_0xed18('0x1e')](function(_0x41865c){logger[_0xed18('0x19')](_0xed18('0xf6'),_0x8b4535['id'],_0x1b1390['id'],_0x1b1390[_0xed18('0xef')],util[_0xed18('0xf7')](_0x41865c,{'showHidden':![],'depth':null}),_0x8b4535[_0xed18('0xf4')]?_0x8b4535['timezone']:_0xed18('0xf5'));return![];});}exports['getSnippet']=function(_0x45fb25,_0x521842){var _0x2391c4=0x0;var _0x1913f3=0x0;var _0x1c16ca=![];var _0x2ebaaa;var _0x4122b0;return db['ChatWebsite'][_0xed18('0x4a')]({'where':{'id':_0x45fb25['params']['id']},'include':[{'model':db['Interval'],'as':_0xed18('0xf8'),'include':[{'model':db[_0xed18('0xf8')],'as':_0xed18('0xf9'),'attributes':['id','interval'],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x521842,null))[_0xed18('0x28')](function(_0x15e32e){if(_0x15e32e){_0x2ebaaa=_0x15e32e;return _0x15e32e['getProactiveActions']({'raw':!![]});}})[_0xed18('0x28')](function(_0x5dd2d6){if(_0x2ebaaa){if(_0x5dd2d6){_0x4122b0=_0x5dd2d6;}}return require('../../config/license/util')[_0xed18('0x6b')]();})['then'](function(_0x49f705){if(_0x49f705){_0x1913f3=_0x49f705['virtual'];_0x1c16ca=_0x49f705[_0xed18('0x6c')];}})[_0xed18('0x28')](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})[_0xed18('0x28')](function(_0x3a69d0){_0x2391c4=_0x3a69d0;if(_0x1913f3&&_0x3a69d0>_0x1913f3){return db[_0xed18('0xfa')][_0xed18('0x5a')]({'where':{'id':0x1}})[_0xed18('0x28')](function(_0xecaad6){if(_0xecaad6){_0xecaad6['increment'](_0xed18('0xfb'));}});}})[_0xed18('0x28')](function(){if(_0x2ebaaa[_0xed18('0xf8')]&&_0x2ebaaa[_0xed18('0xf8')]['Intervals']){var _0x33956c=[];for(var _0x2e0909=0x0;_0x2e0909<_0x2ebaaa[_0xed18('0xf8')][_0xed18('0xf9')]['length'];_0x2e0909++){var _0x16c735=_0x2ebaaa[_0xed18('0xf8')][_0xed18('0xf9')][_0x2e0909][_0xed18('0x29')]({'plain':!![]});_0x33956c[_0xed18('0xae')](iftimePromise(_0x16c735,_0x2ebaaa));}return BPromise[_0xed18('0xfc')](_0x33956c)[_0xed18('0x28')](function(_0x2b62be){return _[_0xed18('0xfd')](_0x2b62be);});}else{return!![];}})['then'](function(_0x362d6f){var _0x9e69f2=fs[_0xed18('0xc0')](path[_0xed18('0x6f')](config[_0xed18('0x70')],_0xed18('0xfe')),_0xed18('0xc2'));var _0x37653b={'remote':_0x2ebaaa[_0xed18('0xff')],'query':querystring['stringify'](_[_0xed18('0x40')](_0x2ebaaa[_0xed18('0x29')]({'plain':!![]}),{'customerIp':_0x45fb25[_0xed18('0x79')][_0xed18('0x96')]||_0x45fb25[_0xed18('0x79')]['x-real-ip']||_0x45fb25[_0xed18('0x100')][_0xed18('0x101')]||_0x45fb25['ip'],'referer':_0x45fb25[_0xed18('0x79')][_0xed18('0x9c')],'openedInteractions':_0x2391c4,'maxInteractions':_0x1913f3,'virtual':_0x1c16ca['virtual'],'online':_0x362d6f,'custom':_0x1c16ca}))[_0xed18('0x102')](/'/g,'\x5c\x27')};_0x521842[_0xed18('0x2d')](ejs['render'](Mustache[_0xed18('0xc3')](_0x9e69f2,_0x37653b),{'proactiveActions':_0x4122b0,'alignment':_0x2ebaaa[_0xed18('0x103')],'verticalAlignment':_0x2ebaaa['verticalAlignment'],'div_color':_0x2ebaaa[_0xed18('0x104')],'labelText':_0x2ebaaa['labelText'],'text_color':_0x2ebaaa[_0xed18('0x105')],'text_button_color':_0x2ebaaa['textButtonColor'],'button_color':_0x2ebaaa[_0xed18('0x106')],'background_color':_0x2ebaaa[_0xed18('0x107')],'hideWhenOffline':_0x2ebaaa[_0xed18('0x108')],'interval':_0x2ebaaa[_0xed18('0x109')]}));})[_0xed18('0x1e')](handleError(_0x521842,null));};exports[_0xed18('0x10a')]=function(_0x4f5db1,_0x480349){var _0x7eb4c9=_0x4f5db1[_0xed18('0x46')]['id'];var _0x5d9a86=_0x4f5db1[_0xed18('0x4c')];var _0x309237=0xc8;var _0x443d41=null;return db[_0xed18('0xce')]['transaction']({'isolationLevel':db['sequelize'][_0xed18('0x10b')][_0xed18('0x10c')][_0xed18('0x10d')]},function(_0x1a2953){return db[_0xed18('0x30')]['findOne']({'where':{'id':_0x7eb4c9},'transaction':_0x1a2953})['then'](function(_0x59d511){if(_0x59d511){return db['ChatApplication'][_0xed18('0x2b')]({'where':{'ChatWebsiteId':_0x7eb4c9},'transaction':_0x1a2953})['then'](function(){var _0xb82e72=_['map'](_0x5d9a86,function(_0x2c8c50){_0x2c8c50[_0xed18('0x57')]=_0x7eb4c9;return _0x2c8c50;});return db['ChatApplication'][_0xed18('0x10e')](_0xb82e72,{'transaction':_0x1a2953});});}else{_0x309237=0x194;_0x443d41=[];}});})[_0xed18('0x28')](function(){if(_0x309237!==0x194){return db[_0xed18('0x8e')][_0xed18('0x10f')]({'where':{'ChatWebsiteId':_0x7eb4c9},'order':'priority'})[_0xed18('0x28')](function(_0x359cb8){_0x443d41=_0x359cb8;});}})[_0xed18('0x1e')](function(_0x297503){_0x309237=0x1f4;logger[_0xed18('0x19')](_0x297503[_0xed18('0x110')]);if(_0x297503['name']){delete _0x297503[_0xed18('0x2c')];}_0x443d41=_0x297503;})[_0xed18('0x111')](function(){if(_0x443d41===null){_0x480349['sendStatus'](_0x309237);}else{if(_0x309237===0x1f4){_0x480349[_0xed18('0x20')](_0x309237)[_0xed18('0x2d')](_0x443d41);}else{_0x480349['status'](_0x309237)[_0xed18('0x21')](_0x443d41);}}});};exports['getApplications']=function(_0x3074ed,_0x5ad88d){var _0x21a337={};var _0x56a59e={};var _0x4b5e30;var _0x17f165;return db[_0xed18('0x30')]['findOne']({'where':{'id':_0x3074ed[_0xed18('0x46')]['id']}})[_0xed18('0x28')](handleEntityNotFound(_0x5ad88d,null))['then'](function(_0x34dc01){if(_0x34dc01){_0x4b5e30=_0x34dc01;_0x56a59e[_0xed18('0x32')]=_[_0xed18('0x34')](db[_0xed18('0x8e')][_0xed18('0x5b')]);_0x56a59e['query']=_[_0xed18('0x34')](_0x3074ed[_0xed18('0x33')]);_0x56a59e['filters']=_[_0xed18('0x48')](_0x56a59e[_0xed18('0x32')],_0x56a59e[_0xed18('0x33')]);_0x21a337['attributes']=_['intersection'](_0x56a59e[_0xed18('0x32')],qs[_0xed18('0x37')](_0x3074ed['query'][_0xed18('0x37')]));_0x21a337['attributes']=_0x21a337['attributes'][_0xed18('0x38')]?_0x21a337[_0xed18('0x36')]:_0x56a59e[_0xed18('0x32')];_0x21a337[_0xed18('0x3b')]=qs[_0xed18('0x3c')](_0x3074ed[_0xed18('0x33')][_0xed18('0x3c')]);_0x21a337[_0xed18('0x3f')]=qs[_0xed18('0x35')](_['pick'](_0x3074ed[_0xed18('0x33')],_0x56a59e[_0xed18('0x35')]));if(_0x3074ed[_0xed18('0x33')][_0xed18('0x3e')]){_0x21a337[_0xed18('0x3f')]=_[_0xed18('0x40')](_0x21a337['where'],{'$or':_[_0xed18('0x2f')](_0x21a337[_0xed18('0x36')],function(_0x43ceae){var _0x14871c={};_0x14871c[_0x43ceae]={'$like':'%'+_0x3074ed[_0xed18('0x33')][_0xed18('0x3e')]+'%'};return _0x14871c;})});}_0x21a337=_[_0xed18('0x40')]({},_0x21a337,_0x3074ed['options']);return _0x4b5e30['getApplications'](_0x21a337);}})[_0xed18('0x28')](function(_0x2def4a){if(_0x2def4a){_0x17f165=_0x2def4a[_0xed18('0x38')];if(!_0x3074ed['query']['hasOwnProperty'](_0xed18('0x3a'))){_0x21a337[_0xed18('0x23')]=qs[_0xed18('0x23')](_0x3074ed['query'][_0xed18('0x23')]);_0x21a337['offset']=qs[_0xed18('0x22')](_0x3074ed[_0xed18('0x33')][_0xed18('0x22')]);}return _0x4b5e30['getApplications'](_0x21a337);}})[_0xed18('0x28')](function(_0x3bc20d){if(_0x3bc20d){return _0x3bc20d?{'count':_0x17f165,'rows':_0x3bc20d}:null;}})[_0xed18('0x28')](respondWithResult(_0x5ad88d,null))['catch'](handleError(_0x5ad88d,null));};exports[_0xed18('0x112')]=function(_0x228178,_0x228df5){return db[_0xed18('0x113')][_0xed18('0x4a')]({'where':{'id':_0x228178[_0xed18('0x46')]['id']}})[_0xed18('0x28')](handleEntityNotFound(_0x228df5,null))[_0xed18('0x28')](function(_0x3ea420){if(_0x3ea420){return _0x3ea420['addProactiveActions'](_0x228178[_0xed18('0x4c')][_0xed18('0x5d')],_['omit'](_0x228178[_0xed18('0x4c')],[_0xed18('0x5d'),'id'])||{});}})[_0xed18('0x28')](respondWithResult(_0x228df5,null))[_0xed18('0x1e')](handleError(_0x228df5,null));};exports['getProactiveActions']=function(_0x337ba5,_0x56a2aa){var _0x4d4b09={};var _0x381ea1={};var _0x4bfaac;var _0x53d938;return db[_0xed18('0x30')][_0xed18('0x5a')]({'where':{'id':_0x337ba5[_0xed18('0x46')]['id']}})[_0xed18('0x28')](handleEntityNotFound(_0x56a2aa,null))[_0xed18('0x28')](function(_0x188fc1){if(_0x188fc1){_0x4bfaac=_0x188fc1;_0x381ea1[_0xed18('0x32')]=_[_0xed18('0x34')](db[_0xed18('0x114')][_0xed18('0x5b')]);_0x381ea1['query']=_[_0xed18('0x34')](_0x337ba5[_0xed18('0x33')]);_0x381ea1[_0xed18('0x35')]=_[_0xed18('0x48')](_0x381ea1['model'],_0x381ea1[_0xed18('0x33')]);_0x4d4b09[_0xed18('0x36')]=_[_0xed18('0x48')](_0x381ea1[_0xed18('0x32')],qs[_0xed18('0x37')](_0x337ba5['query'][_0xed18('0x37')]));_0x4d4b09[_0xed18('0x36')]=_0x4d4b09['attributes'][_0xed18('0x38')]?_0x4d4b09['attributes']:_0x381ea1[_0xed18('0x32')];_0x4d4b09['order']=qs[_0xed18('0x3c')](_0x337ba5[_0xed18('0x33')]['sort']);_0x4d4b09[_0xed18('0x3f')]=qs[_0xed18('0x35')](_[_0xed18('0x3d')](_0x337ba5['query'],_0x381ea1[_0xed18('0x35')]));if(_0x337ba5['query'][_0xed18('0x3e')]){_0x4d4b09['where']=_['merge'](_0x4d4b09['where'],{'$or':_[_0xed18('0x2f')](_0x4d4b09['attributes'],function(_0x39d56f){var _0x341653={};_0x341653[_0x39d56f]={'$like':'%'+_0x337ba5[_0xed18('0x33')][_0xed18('0x3e')]+'%'};return _0x341653;})});}_0x4d4b09=_[_0xed18('0x40')]({},_0x4d4b09,_0x337ba5[_0xed18('0x41')]);return _0x4bfaac['getProactiveActions'](_0x4d4b09);}})['then'](function(_0x301d0e){if(_0x301d0e){_0x53d938=_0x301d0e['length'];if(!_0x337ba5[_0xed18('0x33')]['hasOwnProperty'](_0xed18('0x3a'))){_0x4d4b09[_0xed18('0x23')]=qs[_0xed18('0x23')](_0x337ba5[_0xed18('0x33')][_0xed18('0x23')]);_0x4d4b09['offset']=qs[_0xed18('0x22')](_0x337ba5[_0xed18('0x33')][_0xed18('0x22')]);}return _0x4bfaac[_0xed18('0x115')](_0x4d4b09);}})['then'](function(_0x379781){if(_0x379781){return _0x379781?{'count':_0x53d938,'rows':_0x379781}:null;}})['then'](respondWithResult(_0x56a2aa,null))[_0xed18('0x1e')](handleError(_0x56a2aa,null));};exports[_0xed18('0x116')]=function(_0x34c096,_0x851a07){var _0x4a9c38=_0x34c096['query'][_0xed18('0x117')]===_0xed18('0x118')?_0xed18('0x119'):'onlineForm';return db[_0xed18('0x30')][_0xed18('0x4a')]({'attributes':['id',_0x4a9c38],'where':{'id':_0x34c096[_0xed18('0x46')]['id']}})[_0xed18('0x28')](handleEntityNotFound(_0x851a07,null))[_0xed18('0x28')](function(_0x360d75){if(_0x360d75){var _0x19e852=_0x360d75[_0x4a9c38];var _0x146b69=_0x19e852&&_0x19e852[_0xed18('0x11a')]?_0x19e852[_0xed18('0x11a')]:[];_0x851a07['send']({'fromKey':_['isNil'](_0x19e852['fromKey'])?undefined:_0x19e852['fromKey'],'count':_0x146b69[_0xed18('0x38')],'rows':_0x146b69});}})[_0xed18('0x1e')](handleError(_0x851a07,null));};exports['getOfflineMessages']=function(_0x321078,_0x7abcf5){var _0x3f1067={'raw':![],'where':{}};var _0x3c55ac={};var _0x37d638={'count':0x0,'rows':[]};return db[_0xed18('0x30')][_0xed18('0x5a')]({'where':{'id':_0x321078[_0xed18('0x46')]['id']}})['then'](handleEntityNotFound(_0x7abcf5,null))['then'](function(_0x2941cd){if(_0x2941cd){_0x3c55ac['model']=_[_0xed18('0x34')](db[_0xed18('0xc6')][_0xed18('0x5b')]);_0x3c55ac['query']=_['keys'](_0x321078[_0xed18('0x33')]);_0x3c55ac[_0xed18('0x35')]=_[_0xed18('0x48')](_0x3c55ac['model'],_0x3c55ac[_0xed18('0x33')]);_0x3f1067['attributes']=_[_0xed18('0x48')](_0x3c55ac[_0xed18('0x32')],qs[_0xed18('0x37')](_0x321078[_0xed18('0x33')][_0xed18('0x37')]));_0x3f1067[_0xed18('0x36')]=_0x3f1067[_0xed18('0x36')]['length']?_0x3f1067[_0xed18('0x36')]:_0x3c55ac[_0xed18('0x32')];if(!_0x321078['query'][_0xed18('0x39')]('nolimit')){_0x3f1067['limit']=qs[_0xed18('0x23')](_0x321078['query']['limit']);_0x3f1067[_0xed18('0x22')]=qs[_0xed18('0x22')](_0x321078['query'][_0xed18('0x22')]);}_0x3f1067[_0xed18('0x3b')]=qs['sort'](_0x321078[_0xed18('0x33')][_0xed18('0x3c')]);_0x3f1067[_0xed18('0x3f')]=qs['filters'](_[_0xed18('0x3d')](_0x321078[_0xed18('0x33')],_0x3c55ac['filters']));_0x3f1067[_0xed18('0x3f')][_0xed18('0x57')]=_0x2941cd['id'];if(_0x321078['query'][_0xed18('0x3e')]){_0x3f1067[_0xed18('0x3f')]=_[_0xed18('0x40')](_0x3f1067[_0xed18('0x3f')],{'$or':_[_0xed18('0x2f')](_0x3f1067['attributes'],function(_0x5b3f2e){var _0x1c041d={};_0x1c041d[_0x5b3f2e]={'$like':'%'+_0x321078[_0xed18('0x33')][_0xed18('0x3e')]+'%'};return _0x1c041d;})});}_0x3f1067=_[_0xed18('0x40')]({},_0x3f1067,_0x321078[_0xed18('0x41')]);return db[_0xed18('0xc6')][_0xed18('0x24')]({'where':_0x3f1067[_0xed18('0x3f')]})[_0xed18('0x28')](function(_0x3a0176){_0x37d638[_0xed18('0x24')]=_0x3a0176;if(_0x321078[_0xed18('0x33')][_0xed18('0x49')]){_0x3f1067[_0xed18('0x42')]=[{'all':!![]}];}else{_0x3f1067['include']=[{'model':db[_0xed18('0x7d')],'as':_0xed18('0xe7'),'required':![]},{'model':db[_0xed18('0xd0')],'as':_0xed18('0x11b'),'required':![]}];}return db[_0xed18('0xc6')]['findAll'](_0x3f1067);})[_0xed18('0x28')](function(_0x2ad8bd){_0x37d638[_0xed18('0x44')]=_0x2ad8bd;return _0x37d638;});}})[_0xed18('0x28')](respondWithFilteredResult(_0x7abcf5,_0x3f1067))[_0xed18('0x1e')](handleError(_0x7abcf5,null));};exports[_0xed18('0x11c')]=function(_0x1e8332,_0x48e148){return db[_0xed18('0x30')][_0xed18('0x4a')]({'where':{'id':_0x1e8332[_0xed18('0x46')]['id']}})[_0xed18('0x28')](handleEntityNotFound(_0x48e148,null))[_0xed18('0x28')](function(_0x460b7b){if(_0x460b7b){return _0x460b7b['addAgents'](_0x1e8332['body'][_0xed18('0x5d')],_['omit'](_0x1e8332['body'],[_0xed18('0x5d'),'id'])||{})[_0xed18('0xaa')](function(_0x2047c6){for(var _0x3c74a1=0x0;_0x3c74a1<_0x1e8332['body']['ids'][_0xed18('0x38')];_0x3c74a1+=0x1){socket[_0xed18('0x11d')]('userChatWebsite:save',{'UserId':Number(_0x1e8332[_0xed18('0x4c')][_0xed18('0x5d')][_0x3c74a1]),'ChatWebsiteId':Number(_0x1e8332['params']['id'])});}return _0x2047c6;});}})[_0xed18('0x28')](respondWithResult(_0x48e148,null))[_0xed18('0x1e')](handleError(_0x48e148,null));};exports[_0xed18('0x11e')]=function(_0x581341,_0x4a77ae){return db[_0xed18('0x30')][_0xed18('0x4a')]({'where':{'id':_0x581341['params']['id']}})[_0xed18('0x28')](handleEntityNotFound(_0x4a77ae,null))['then'](function(_0x51a0e8){if(_0x51a0e8){return _0x51a0e8[_0xed18('0x11e')](_0x581341[_0xed18('0x33')]['ids'])[_0xed18('0x28')](function(){if(_['isArray'](_0x581341['query'][_0xed18('0x5d')])){for(var _0x2efe70=0x0;_0x2efe70<_0x581341[_0xed18('0x33')][_0xed18('0x5d')][_0xed18('0x38')];_0x2efe70+=0x1){socket[_0xed18('0x11d')]('userChatWebsite:remove',{'UserId':Number(_0x581341[_0xed18('0x33')][_0xed18('0x5d')][_0x2efe70]),'ChatWebsiteId':Number(_0x581341[_0xed18('0x46')]['id'])});}}else{socket[_0xed18('0x11d')](_0xed18('0x11f'),{'UserId':Number(_0x581341[_0xed18('0x33')][_0xed18('0x5d')]),'ChatWebsiteId':Number(_0x581341['params']['id'])});}});}})[_0xed18('0x28')](respondWithStatusCode(_0x4a77ae,null))[_0xed18('0x1e')](handleError(_0x4a77ae,null));};exports[_0xed18('0x120')]=function(_0x463dbe,_0x43e911){var _0x28432e={};var _0x1e78b5={};var _0x199b31;var _0x50cf73;return db['ChatWebsite'][_0xed18('0x5a')]({'where':{'id':_0x463dbe[_0xed18('0x46')]['id']}})[_0xed18('0x28')](handleEntityNotFound(_0x43e911,null))[_0xed18('0x28')](function(_0x71212e){if(_0x71212e){_0x199b31=_0x71212e;_0x1e78b5[_0xed18('0x32')]=_[_0xed18('0x34')](db['User']['rawAttributes']);_0x1e78b5['query']=_[_0xed18('0x34')](_0x463dbe[_0xed18('0x33')]);_0x1e78b5[_0xed18('0x35')]=_[_0xed18('0x48')](_0x1e78b5[_0xed18('0x32')],_0x1e78b5[_0xed18('0x33')]);_0x28432e['attributes']=_['intersection'](_0x1e78b5[_0xed18('0x32')],qs['fields'](_0x463dbe['query']['fields']));_0x28432e[_0xed18('0x36')]=_0x28432e['attributes'][_0xed18('0x38')]?_0x28432e[_0xed18('0x36')]:_0x1e78b5[_0xed18('0x32')];_0x28432e['order']=qs[_0xed18('0x3c')](_0x463dbe[_0xed18('0x33')][_0xed18('0x3c')]);_0x28432e[_0xed18('0x3f')]=qs[_0xed18('0x35')](_['pick'](_0x463dbe['query'],_0x1e78b5['filters']));if(_0x463dbe[_0xed18('0x33')]['filter']){_0x28432e[_0xed18('0x3f')]=_[_0xed18('0x40')](_0x28432e[_0xed18('0x3f')],{'$or':_[_0xed18('0x2f')](_0x28432e[_0xed18('0x36')],function(_0x321803){var _0x3421ec={};_0x3421ec[_0x321803]={'$like':'%'+_0x463dbe['query'][_0xed18('0x3e')]+'%'};return _0x3421ec;})});}_0x28432e=_[_0xed18('0x40')]({},_0x28432e,_0x463dbe['options']);return _0x199b31[_0xed18('0x120')](_0x28432e);}})['then'](function(_0x27d3f0){if(_0x27d3f0){_0x50cf73=_0x27d3f0['length'];if(!_0x463dbe['query']['hasOwnProperty'](_0xed18('0x3a'))){_0x28432e[_0xed18('0x23')]=qs['limit'](_0x463dbe[_0xed18('0x33')]['limit']);_0x28432e[_0xed18('0x22')]=qs[_0xed18('0x22')](_0x463dbe[_0xed18('0x33')]['offset']);}return _0x199b31[_0xed18('0x120')](_0x28432e);}})['then'](function(_0x463a24){if(_0x463a24){return _0x463a24?{'count':_0x50cf73,'rows':_0x463a24}:null;}})['then'](respondWithResult(_0x43e911,null))[_0xed18('0x1e')](handleError(_0x43e911,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index c36c38a..d439472 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 _0x097c=['hook','events','../../mysqldb','ChatWebsite','save','update','remove','emit','hasOwnProperty'];(function(_0x23b7a6,_0x220128){var _0x5a2b6f=function(_0x3f3449){while(--_0x3f3449){_0x23b7a6['push'](_0x23b7a6['shift']());}};_0x5a2b6f(++_0x220128);}(_0x097c,0x1d5));var _0xc097=function(_0x52f974,_0x2777d1){_0x52f974=_0x52f974-0x0;var _0x3b693e=_0x097c[_0x52f974];return _0x3b693e;};'use strict';var EventEmitter=require(_0xc097('0x0'));var ChatWebsite=require(_0xc097('0x1'))['db'][_0xc097('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc097('0x3'),'afterUpdate':_0xc097('0x4'),'afterDestroy':_0xc097('0x5')};function emitEvent(_0x1b9efd){return function(_0x5aa3c1,_0x265284,_0x4ac03b){ChatWebsiteEvents[_0xc097('0x6')](_0x1b9efd+':'+_0x5aa3c1['id'],_0x5aa3c1);ChatWebsiteEvents[_0xc097('0x6')](_0x1b9efd,_0x5aa3c1);_0x4ac03b(null);};}for(var e in events){if(events[_0xc097('0x7')](e)){var event=events[e];ChatWebsite[_0xc097('0x8')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0xa630=['exports','events','../../mysqldb','save','remove','emit','hook'];(function(_0x2e47a2,_0x2862e0){var _0x2965d2=function(_0x3d43ab){while(--_0x3d43ab){_0x2e47a2['push'](_0x2e47a2['shift']());}};_0x2965d2(++_0x2862e0);}(_0xa630,0xbe));var _0x0a63=function(_0x1e97a5,_0x1e03fd){_0x1e97a5=_0x1e97a5-0x0;var _0x53c1d4=_0xa630[_0x1e97a5];return _0x53c1d4;};'use strict';var EventEmitter=require(_0x0a63('0x0'));var ChatWebsite=require(_0x0a63('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0a63('0x2'),'afterUpdate':'update','afterDestroy':_0x0a63('0x3')};function emitEvent(_0x506b55){return function(_0x91a747,_0x3bcb90,_0x2cfdeb){ChatWebsiteEvents[_0x0a63('0x4')](_0x506b55+':'+_0x91a747['id'],_0x91a747);ChatWebsiteEvents[_0x0a63('0x4')](_0x506b55,_0x91a747);_0x2cfdeb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x0a63('0x5')](e,emitEvent(event));}}module[_0x0a63('0x6')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 9a9fed9..8955bd1 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 _0x907f=['ChatWebsite','chat_websites','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./chatWebsite.attributes','exports','define'];(function(_0x4726fd,_0x3a9f5f){var _0x50def0=function(_0x284e6e){while(--_0x284e6e){_0x4726fd['push'](_0x4726fd['shift']());}};_0x50def0(++_0x3a9f5f);}(_0x907f,0xfe));var _0xf907=function(_0x509276,_0x5ce6d3){_0x509276=_0x509276-0x0;var _0x352e71=_0x907f[_0x509276];return _0x352e71;};'use strict';var _=require(_0xf907('0x0'));var util=require('util');var logger=require(_0xf907('0x1'))(_0xf907('0x2'));var moment=require(_0xf907('0x3'));var BPromise=require(_0xf907('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf907('0x5'));var rimraf=require('rimraf');var config=require(_0xf907('0x6'));var attributes=require(_0xf907('0x7'));module[_0xf907('0x8')]=function(_0x47ccc3,_0x5d9d49){return _0x47ccc3[_0xf907('0x9')](_0xf907('0xa'),attributes,{'tableName':_0xf907('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd47c=['api','moment','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','ChatWebsite','chat_websites','lodash','util','../../config/logger'];(function(_0x2be339,_0x39f6fd){var _0xa3c769=function(_0x22e4f8){while(--_0x22e4f8){_0x2be339['push'](_0x2be339['shift']());}};_0xa3c769(++_0x39f6fd);}(_0xd47c,0xf9));var _0xcd47=function(_0x2827b0,_0x5c1edd){_0x2827b0=_0x2827b0-0x0;var _0x110efe=_0xd47c[_0x2827b0];return _0x110efe;};'use strict';var _=require(_0xcd47('0x0'));var util=require(_0xcd47('0x1'));var logger=require(_0xcd47('0x2'))(_0xcd47('0x3'));var moment=require(_0xcd47('0x4'));var BPromise=require('bluebird');var rp=require(_0xcd47('0x5'));var fs=require('fs');var path=require(_0xcd47('0x6'));var rimraf=require(_0xcd47('0x7'));var config=require(_0xcd47('0x8'));var attributes=require(_0xcd47('0x9'));module['exports']=function(_0x3ee3fd,_0x7ed31c){return _0x3ee3fd['define'](_0xcd47('0xa'),attributes,{'tableName':_0xcd47('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index a153b42..6ed25f1 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 _0x6326=['http','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x56ef8b,_0xdbf624){var _0x356f9c=function(_0x5df79a){while(--_0x5df79a){_0x56ef8b['push'](_0x56ef8b['shift']());}};_0x356f9c(++_0xdbf624);}(_0x6326,0x86));var _0x6632=function(_0x408b80,_0x50d130){_0x408b80=_0x408b80-0x0;var _0x257a4e=_0x6326[_0x408b80];return _0x257a4e;};'use strict';var _=require(_0x6632('0x0'));var util=require(_0x6632('0x1'));var moment=require(_0x6632('0x2'));var BPromise=require('bluebird');var rs=require(_0x6632('0x3'));var fs=require('fs');var Redis=require(_0x6632('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6632('0x5'));var logger=require(_0x6632('0x6'))(_0x6632('0x7'));var config=require(_0x6632('0x8'));var jayson=require(_0x6632('0x9'));var client=jayson[_0x6632('0xa')][_0x6632('0xb')]({'port':0x232a});config[_0x6632('0xc')]=_['defaults'](config['redis'],{'host':_0x6632('0xd'),'port':0x18eb});var socket=require(_0x6632('0xe'))(new Redis(config[_0x6632('0xc')]));require(_0x6632('0xf'))[_0x6632('0x10')](socket);function respondWithRpcPromise(_0x4016ed,_0x1359e1,_0x1e8bc3){return new BPromise(function(_0x138e4f,_0x3b7d81){return client['request'](_0x4016ed,_0x1e8bc3)[_0x6632('0x11')](function(_0x55bb9f){logger[_0x6632('0x12')](_0x6632('0x13'),_0x1359e1,_0x6632('0x14'));logger[_0x6632('0x15')](_0x6632('0x16'),_0x1359e1,_0x6632('0x14'),JSON[_0x6632('0x17')](_0x55bb9f));if(_0x55bb9f[_0x6632('0x18')]){if(_0x55bb9f[_0x6632('0x18')][_0x6632('0x19')]===0x1f4){logger[_0x6632('0x18')](_0x6632('0x13'),_0x1359e1,_0x55bb9f['error'][_0x6632('0x1a')]);return _0x3b7d81(_0x55bb9f[_0x6632('0x18')][_0x6632('0x1a')]);}logger[_0x6632('0x18')](_0x6632('0x13'),_0x1359e1,_0x55bb9f[_0x6632('0x18')][_0x6632('0x1a')]);return _0x138e4f(_0x55bb9f[_0x6632('0x18')][_0x6632('0x1a')]);}else{logger[_0x6632('0x12')](_0x6632('0x13'),_0x1359e1,_0x6632('0x14'));_0x138e4f(_0x55bb9f[_0x6632('0x1b')]['message']);}})[_0x6632('0x1c')](function(_0x4f0180){logger[_0x6632('0x18')](_0x6632('0x13'),_0x1359e1,_0x4f0180);_0x3b7d81(_0x4f0180);});});} \ No newline at end of file +var _0x8e8f=['defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis'];(function(_0x2c1d94,_0x1065c5){var _0x3586d8=function(_0x248d72){while(--_0x248d72){_0x2c1d94['push'](_0x2c1d94['shift']());}};_0x3586d8(++_0x1065c5);}(_0x8e8f,0x6c));var _0xf8e8=function(_0x55c6f2,_0x5efaf9){_0x55c6f2=_0x55c6f2-0x0;var _0x185c3c=_0x8e8f[_0x55c6f2];return _0x185c3c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf8e8('0x0'));var BPromise=require(_0xf8e8('0x1'));var rs=require(_0xf8e8('0x2'));var fs=require('fs');var Redis=require(_0xf8e8('0x3'));var db=require(_0xf8e8('0x4'))['db'];var utils=require(_0xf8e8('0x5'));var logger=require(_0xf8e8('0x6'))('rpc');var config=require(_0xf8e8('0x7'));var jayson=require(_0xf8e8('0x8'));var client=jayson[_0xf8e8('0x9')][_0xf8e8('0xa')]({'port':0x232a});config[_0xf8e8('0xb')]=_[_0xf8e8('0xc')](config[_0xf8e8('0xb')],{'host':_0xf8e8('0xd'),'port':0x18eb});var socket=require(_0xf8e8('0xe'))(new Redis(config['redis']));require(_0xf8e8('0xf'))[_0xf8e8('0x10')](socket);function respondWithRpcPromise(_0x3b17b5,_0x1b882e,_0x2668d3){return new BPromise(function(_0x467549,_0x23f228){return client[_0xf8e8('0x11')](_0x3b17b5,_0x2668d3)[_0xf8e8('0x12')](function(_0x30fa61){logger[_0xf8e8('0x13')](_0xf8e8('0x14'),_0x1b882e,_0xf8e8('0x15'));logger[_0xf8e8('0x16')](_0xf8e8('0x17'),_0x1b882e,'request\x20sent',JSON[_0xf8e8('0x18')](_0x30fa61));if(_0x30fa61[_0xf8e8('0x19')]){if(_0x30fa61[_0xf8e8('0x19')][_0xf8e8('0x1a')]===0x1f4){logger[_0xf8e8('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x1b882e,_0x30fa61[_0xf8e8('0x19')]['message']);return _0x23f228(_0x30fa61[_0xf8e8('0x19')][_0xf8e8('0x1b')]);}logger['error'](_0xf8e8('0x14'),_0x1b882e,_0x30fa61[_0xf8e8('0x19')][_0xf8e8('0x1b')]);return _0x467549(_0x30fa61[_0xf8e8('0x19')][_0xf8e8('0x1b')]);}else{logger[_0xf8e8('0x13')](_0xf8e8('0x14'),_0x1b882e,_0xf8e8('0x15'));_0x467549(_0x30fa61[_0xf8e8('0x1c')][_0xf8e8('0x1b')]);}})[_0xf8e8('0x1d')](function(_0x19e8b2){logger[_0xf8e8('0x19')](_0xf8e8('0x14'),_0x1b882e,_0x19e8b2);_0x23f228(_0x19e8b2);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 6eba0c7..1976db3 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 _0x5a1b=['chatWebsite:','./chatWebsite.events','save','remove','update','emit','removeListener','register'];(function(_0x2dd58e,_0x5de4a3){var _0x11e298=function(_0x1281a5){while(--_0x1281a5){_0x2dd58e['push'](_0x2dd58e['shift']());}};_0x11e298(++_0x5de4a3);}(_0x5a1b,0x1b9));var _0xb5a1=function(_0x2f4dda,_0x4eb009){_0x2f4dda=_0x2f4dda-0x0;var _0x459099=_0x5a1b[_0x2f4dda];return _0x459099;};'use strict';var ChatWebsiteEvents=require(_0xb5a1('0x0'));var events=[_0xb5a1('0x1'),_0xb5a1('0x2'),_0xb5a1('0x3')];function createListener(_0x371ab1,_0xec61d){return function(_0x451f9d){_0xec61d[_0xb5a1('0x4')](_0x371ab1,_0x451f9d);};}function removeListener(_0x35654c,_0x4e1af2){return function(){ChatWebsiteEvents[_0xb5a1('0x5')](_0x35654c,_0x4e1af2);};}exports[_0xb5a1('0x6')]=function(_0x29eff5){for(var _0xadeae=0x0,_0x22ff7c=events['length'];_0xadeae<_0x22ff7c;_0xadeae++){var _0x40f501=events[_0xadeae];var _0xf0ae28=createListener(_0xb5a1('0x7')+_0x40f501,_0x29eff5);ChatWebsiteEvents['on'](_0x40f501,_0xf0ae28);}}; \ No newline at end of file +var _0xd1b1=['removeListener','register','length','chatWebsite:','./chatWebsite.events','save','remove','update','emit'];(function(_0x282beb,_0xc55436){var _0x1a072b=function(_0x258fc3){while(--_0x258fc3){_0x282beb['push'](_0x282beb['shift']());}};_0x1a072b(++_0xc55436);}(_0xd1b1,0x16c));var _0x1d1b=function(_0x127f93,_0x4be621){_0x127f93=_0x127f93-0x0;var _0x1842e6=_0xd1b1[_0x127f93];return _0x1842e6;};'use strict';var ChatWebsiteEvents=require(_0x1d1b('0x0'));var events=[_0x1d1b('0x1'),_0x1d1b('0x2'),_0x1d1b('0x3')];function createListener(_0x182a31,_0x49be28){return function(_0x5a7e21){_0x49be28[_0x1d1b('0x4')](_0x182a31,_0x5a7e21);};}function removeListener(_0x536561,_0xbfee3e){return function(){ChatWebsiteEvents[_0x1d1b('0x5')](_0x536561,_0xbfee3e);};}exports[_0x1d1b('0x6')]=function(_0xbba179){for(var _0x2d77a4=0x0,_0x25a256=events[_0x1d1b('0x7')];_0x2d77a4<_0x25a256;_0x2d77a4++){var _0x1055a3=events[_0x2d77a4];var _0x57bf9b=createListener(_0x1d1b('0x8')+_0x1055a3,_0xbba179);ChatWebsiteEvents['on'](_0x1055a3,_0x57bf9b);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 2dd0737..3f2c6bf 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 _0x9548=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getLogo','getAvatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/offline_messages','post','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','/:id/logo','file','addLogo','server/files/images/avatars/','originalname','/:id/avatar','single','addAvatar','addCustomerAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addInteraction','addApplications','addProactiveActions','/:id/users','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents'];(function(_0x1b064d,_0x55b3ee){var _0x50c8fc=function(_0x4f965d){while(--_0x4f965d){_0x1b064d['push'](_0x1b064d['shift']());}};_0x50c8fc(++_0x55b3ee);}(_0x9548,0x1a4));var _0x8954=function(_0x2c4c98,_0x321f7f){_0x2c4c98=_0x2c4c98-0x0;var _0x472f65=_0x9548[_0x2c4c98];return _0x472f65;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8954('0x0'));var timeout=require('connect-timeout');var express=require(_0x8954('0x1'));var router=express[_0x8954('0x2')]();var fs_extra=require(_0x8954('0x3'));var auth=require(_0x8954('0x4'));var interaction=require(_0x8954('0x5'));var config=require(_0x8954('0x6'));var controller=require('./chatWebsite.controller');router[_0x8954('0x7')]('/',auth[_0x8954('0x8')](),controller[_0x8954('0x9')]);router[_0x8954('0x7')](_0x8954('0xa'),auth[_0x8954('0x8')](),controller['describe']);router[_0x8954('0x7')](_0x8954('0xb'),auth[_0x8954('0x8')](),controller['show']);router[_0x8954('0x7')](_0x8954('0xc'),auth[_0x8954('0x8')](),controller[_0x8954('0xd')]);router[_0x8954('0x7')](_0x8954('0xe'),auth[_0x8954('0x8')](),controller['getAnswers']);router[_0x8954('0x7')]('/:id/logo',controller[_0x8954('0xf')]);router['get']('/:id/avatar',controller[_0x8954('0x10')]);router['get'](_0x8954('0x11'),controller['getCustomerAvatar']);router[_0x8954('0x7')](_0x8954('0x12'),controller[_0x8954('0x13')]);router[_0x8954('0x7')](_0x8954('0x14'),auth[_0x8954('0x8')](),controller[_0x8954('0x15')]);router[_0x8954('0x7')](_0x8954('0x16'),controller[_0x8954('0x17')]);router[_0x8954('0x7')]('/:id/applications',auth['isAuthenticated'](),controller[_0x8954('0x18')]);router[_0x8954('0x7')](_0x8954('0x19'),auth[_0x8954('0x8')](),controller[_0x8954('0x1a')]);router[_0x8954('0x7')](_0x8954('0x1b'),controller['getFields']);router[_0x8954('0x7')](_0x8954('0x1c'),auth['isAuthenticated'](),controller['getOfflineMessages']);router[_0x8954('0x7')]('/:id/users',auth[_0x8954('0x8')](),controller['getAgents']);router['post']('/',auth[_0x8954('0x8')](),controller['create']);router[_0x8954('0x1d')](_0x8954('0xc'),auth[_0x8954('0x8')](),controller['addDisposition']);router[_0x8954('0x1d')]('/:id/canned_answers',auth[_0x8954('0x8')](),controller[_0x8954('0x1e')]);var upload=multer({'storage':multer[_0x8954('0x1f')]({'destination':function(_0x299aa5,_0x5757db,_0x40c75b){_0x40c75b(null,path[_0x8954('0x20')](config[_0x8954('0x21')],_0x8954('0x22')));},'filename':function(_0x2de715,_0x1537a8,_0x318d89){_0x318d89(null,util[_0x8954('0x23')](_0x8954('0x24'),Date[_0x8954('0x25')](),_0x1537a8['originalname']));}})});router[_0x8954('0x1d')](_0x8954('0x26'),upload['single'](_0x8954('0x27')),controller[_0x8954('0x28')]);var upload=multer({'storage':multer[_0x8954('0x1f')]({'destination':function(_0x398b8e,_0x505b9f,_0x35a306){_0x35a306(null,path[_0x8954('0x20')](config['root'],_0x8954('0x29')));},'filename':function(_0x231d49,_0x49f861,_0x3585c4){_0x3585c4(null,util['format'](_0x8954('0x24'),Date[_0x8954('0x25')](),_0x49f861[_0x8954('0x2a')]));}})});router[_0x8954('0x1d')](_0x8954('0x2b'),upload[_0x8954('0x2c')]('file'),controller[_0x8954('0x2d')]);var upload=multer({'storage':multer[_0x8954('0x1f')]({'destination':function(_0x21db80,_0x2680a5,_0x5ab34f){_0x5ab34f(null,path[_0x8954('0x20')](config[_0x8954('0x21')],_0x8954('0x29')));},'filename':function(_0x44f076,_0x5bdc7f,_0x246e60){_0x246e60(null,util[_0x8954('0x23')](_0x8954('0x24'),Date[_0x8954('0x25')](),_0x5bdc7f[_0x8954('0x2a')]));}})});router[_0x8954('0x1d')](_0x8954('0x11'),upload[_0x8954('0x2c')](_0x8954('0x27')),controller[_0x8954('0x2e')]);var upload=multer({'storage':multer[_0x8954('0x1f')]({'destination':function(_0xeb8ff8,_0x32fbfe,_0x6d11b5){_0x6d11b5(null,path[_0x8954('0x20')](config[_0x8954('0x21')],_0x8954('0x29')));},'filename':function(_0x390f60,_0xf9d38,_0x6ba5fa){_0x6ba5fa(null,util[_0x8954('0x23')](_0x8954('0x24'),Date['now'](),_0xf9d38[_0x8954('0x2a')]));}})});router['post'](_0x8954('0x12'),upload['single'](_0x8954('0x27')),controller['addSystemAvatar']);router['post'](_0x8954('0x2f'),controller[_0x8954('0x30')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x43b31d,_0x482981,_0x68fc59){const _0x19e5a6=path[_0x8954('0x20')](config['root'],_0x8954('0x31'),_0x8954('0x32'),_0x8954('0x33'));fs_extra[_0x8954('0x34')](_0x19e5a6,function(){_0x68fc59(null,_0x19e5a6);});},'filename':function(_0x46bbbe,_0x1b367a,_0x57e068){const _0x4cfdd4=_0x1b367a[_0x8954('0x2a')][_0x8954('0x35')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x201007=path[_0x8954('0x36')](_0x4cfdd4);const _0x51993d=Date[_0x8954('0x25')]()+'-'+_0x4cfdd4[_0x8954('0x35')](_0x201007,'')+_0x201007;_0x57e068(null,_0x51993d);}})});router[_0x8954('0x1d')](_0x8954('0x37'),offlineUploadMulter[_0x8954('0x38')](),controller[_0x8954('0x39')]);router[_0x8954('0x1d')](_0x8954('0x14'),auth['isAuthenticated'](),controller[_0x8954('0x3a')]);router[_0x8954('0x1d')]('/:id/applications',auth[_0x8954('0x8')](),controller[_0x8954('0x3b')]);router[_0x8954('0x1d')]('/:id/proactive_actions',auth[_0x8954('0x8')](),controller[_0x8954('0x3c')]);router[_0x8954('0x1d')](_0x8954('0x3d'),auth[_0x8954('0x8')](),controller[_0x8954('0x3e')]);router[_0x8954('0x3f')](_0x8954('0xb'),auth[_0x8954('0x8')](),controller[_0x8954('0x40')]);router[_0x8954('0x41')](_0x8954('0xb'),auth[_0x8954('0x8')](),controller[_0x8954('0x42')]);router[_0x8954('0x41')](_0x8954('0xc'),auth[_0x8954('0x8')](),controller[_0x8954('0x43')]);router[_0x8954('0x41')](_0x8954('0xe'),auth[_0x8954('0x8')](),controller[_0x8954('0x44')]);router[_0x8954('0x41')](_0x8954('0x3d'),auth['isAuthenticated'](),controller[_0x8954('0x45')]);module['exports']=router; \ No newline at end of file +var _0xe0bb=['getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/offline_messages','getOfflineMessages','getAgents','post','addAnswer','diskStorage','join','server/files/images/logos/','format','%s-%s','now','originalname','single','addLogo','server/files/images/avatars/','root','file','addCustomerAvatar','addSystemAvatar','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addInteraction','addApplications','addProactiveActions','/:id/users','put','/:id','update','destroy','delete','removeAnswers','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions'];(function(_0x9b3589,_0x4726ef){var _0x1cb999=function(_0x3a4f1a){while(--_0x3a4f1a){_0x9b3589['push'](_0x9b3589['shift']());}};_0x1cb999(++_0x4726ef);}(_0xe0bb,0x76));var _0xbe0b=function(_0x38c652,_0x1ea1b7){_0x38c652=_0x38c652-0x0;var _0x218a37=_0xe0bb[_0x38c652];return _0x218a37;};'use strict';var multer=require(_0xbe0b('0x0'));var util=require(_0xbe0b('0x1'));var path=require(_0xbe0b('0x2'));var timeout=require(_0xbe0b('0x3'));var express=require(_0xbe0b('0x4'));var router=express[_0xbe0b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbe0b('0x6'));var interaction=require(_0xbe0b('0x7'));var config=require(_0xbe0b('0x8'));var controller=require('./chatWebsite.controller');router[_0xbe0b('0x9')]('/',auth[_0xbe0b('0xa')](),controller['index']);router[_0xbe0b('0x9')](_0xbe0b('0xb'),auth[_0xbe0b('0xa')](),controller[_0xbe0b('0xc')]);router[_0xbe0b('0x9')]('/:id',auth[_0xbe0b('0xa')](),controller[_0xbe0b('0xd')]);router['get'](_0xbe0b('0xe'),auth[_0xbe0b('0xa')](),controller[_0xbe0b('0xf')]);router[_0xbe0b('0x9')](_0xbe0b('0x10'),auth[_0xbe0b('0xa')](),controller[_0xbe0b('0x11')]);router[_0xbe0b('0x9')](_0xbe0b('0x12'),controller[_0xbe0b('0x13')]);router['get'](_0xbe0b('0x14'),controller['getAvatar']);router[_0xbe0b('0x9')](_0xbe0b('0x15'),controller[_0xbe0b('0x16')]);router[_0xbe0b('0x9')](_0xbe0b('0x17'),controller[_0xbe0b('0x18')]);router[_0xbe0b('0x9')](_0xbe0b('0x19'),auth['isAuthenticated'](),controller[_0xbe0b('0x1a')]);router[_0xbe0b('0x9')](_0xbe0b('0x1b'),controller[_0xbe0b('0x1c')]);router[_0xbe0b('0x9')](_0xbe0b('0x1d'),auth['isAuthenticated'](),controller[_0xbe0b('0x1e')]);router[_0xbe0b('0x9')](_0xbe0b('0x1f'),auth['isAuthenticated'](),controller[_0xbe0b('0x20')]);router['get']('/:id/fields',controller['getFields']);router['get'](_0xbe0b('0x21'),auth[_0xbe0b('0xa')](),controller[_0xbe0b('0x22')]);router[_0xbe0b('0x9')]('/:id/users',auth[_0xbe0b('0xa')](),controller[_0xbe0b('0x23')]);router[_0xbe0b('0x24')]('/',auth[_0xbe0b('0xa')](),controller['create']);router[_0xbe0b('0x24')](_0xbe0b('0xe'),auth[_0xbe0b('0xa')](),controller['addDisposition']);router[_0xbe0b('0x24')]('/:id/canned_answers',auth[_0xbe0b('0xa')](),controller[_0xbe0b('0x25')]);var upload=multer({'storage':multer[_0xbe0b('0x26')]({'destination':function(_0x396d6d,_0x3f5616,_0x58b016){_0x58b016(null,path[_0xbe0b('0x27')](config['root'],_0xbe0b('0x28')));},'filename':function(_0x422d9f,_0x169e66,_0x451bef){_0x451bef(null,util[_0xbe0b('0x29')](_0xbe0b('0x2a'),Date[_0xbe0b('0x2b')](),_0x169e66[_0xbe0b('0x2c')]));}})});router[_0xbe0b('0x24')](_0xbe0b('0x12'),upload[_0xbe0b('0x2d')]('file'),controller[_0xbe0b('0x2e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x542735,_0x34b8a7,_0x1787f4){_0x1787f4(null,path[_0xbe0b('0x27')](config['root'],_0xbe0b('0x2f')));},'filename':function(_0x3cdcdc,_0x32ed9c,_0x495492){_0x495492(null,util[_0xbe0b('0x29')](_0xbe0b('0x2a'),Date[_0xbe0b('0x2b')](),_0x32ed9c['originalname']));}})});router[_0xbe0b('0x24')](_0xbe0b('0x14'),upload[_0xbe0b('0x2d')]('file'),controller['addAvatar']);var upload=multer({'storage':multer[_0xbe0b('0x26')]({'destination':function(_0x1eb7e8,_0x57e61f,_0x7f220f){_0x7f220f(null,path[_0xbe0b('0x27')](config[_0xbe0b('0x30')],_0xbe0b('0x2f')));},'filename':function(_0x30a9c2,_0x4263af,_0x1a7fdc){_0x1a7fdc(null,util[_0xbe0b('0x29')](_0xbe0b('0x2a'),Date[_0xbe0b('0x2b')](),_0x4263af[_0xbe0b('0x2c')]));}})});router[_0xbe0b('0x24')](_0xbe0b('0x15'),upload[_0xbe0b('0x2d')](_0xbe0b('0x31')),controller[_0xbe0b('0x32')]);var upload=multer({'storage':multer[_0xbe0b('0x26')]({'destination':function(_0x56d7f7,_0x272909,_0x5c79eb){_0x5c79eb(null,path[_0xbe0b('0x27')](config[_0xbe0b('0x30')],_0xbe0b('0x2f')));},'filename':function(_0x4f5b7e,_0x1b0307,_0x5cd6a2){_0x5cd6a2(null,util[_0xbe0b('0x29')](_0xbe0b('0x2a'),Date['now'](),_0x1b0307[_0xbe0b('0x2c')]));}})});router[_0xbe0b('0x24')]('/:id/system_avatar',upload['single'](_0xbe0b('0x31')),controller[_0xbe0b('0x33')]);router['post']('/:id/notify',controller['notify']);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x5192d5,_0x3cbf10,_0x1cce4b){const _0x402936=path[_0xbe0b('0x27')](config[_0xbe0b('0x30')],_0xbe0b('0x34'),_0xbe0b('0x35'),_0xbe0b('0x36'));fs_extra[_0xbe0b('0x37')](_0x402936,function(){_0x1cce4b(null,_0x402936);});},'filename':function(_0x55a0db,_0x3ac96e,_0x21970c){const _0x44c1f4=_0x3ac96e['originalname'][_0xbe0b('0x38')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x2e381c=path[_0xbe0b('0x39')](_0x44c1f4);const _0x5ef3f4=Date[_0xbe0b('0x2b')]()+'-'+_0x44c1f4[_0xbe0b('0x38')](_0x2e381c,'')+_0x2e381c;_0x21970c(null,_0x5ef3f4);}})});router[_0xbe0b('0x24')](_0xbe0b('0x3a'),offlineUploadMulter[_0xbe0b('0x3b')](),controller[_0xbe0b('0x3c')]);router[_0xbe0b('0x24')](_0xbe0b('0x19'),auth[_0xbe0b('0xa')](),controller[_0xbe0b('0x3d')]);router[_0xbe0b('0x24')]('/:id/applications',auth[_0xbe0b('0xa')](),controller[_0xbe0b('0x3e')]);router[_0xbe0b('0x24')](_0xbe0b('0x1f'),auth[_0xbe0b('0xa')](),controller[_0xbe0b('0x3f')]);router['post'](_0xbe0b('0x40'),auth['isAuthenticated'](),controller['addAgents']);router[_0xbe0b('0x41')](_0xbe0b('0x42'),auth[_0xbe0b('0xa')](),controller[_0xbe0b('0x43')]);router['delete'](_0xbe0b('0x42'),auth[_0xbe0b('0xa')](),controller[_0xbe0b('0x44')]);router[_0xbe0b('0x45')]('/:id/dispositions',auth[_0xbe0b('0xa')](),controller['removeDispositions']);router[_0xbe0b('0x45')](_0xbe0b('0x10'),auth['isAuthenticated'](),controller[_0xbe0b('0x46')]);router[_0xbe0b('0x45')](_0xbe0b('0x40'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xbe0b('0x47')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 8f7bcfa..88e37ea 100644 --- a/server/api/client-side-logs.js +++ b/server/api/client-side-logs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd97b=['Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','exports','beaver-logger/server','express','../components/auth/service','../config/environment','Router','env','production','get','client-side-logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd97b,0x1ef));var _0xbd97=function(_0x2adc52,_0x24cecb){_0x2adc52=_0x2adc52-0x0;var _0xb56489=_0xd97b[_0x2adc52];return _0xb56489;};var beaverLogger=require(_0xbd97('0x0'));var express=require(_0xbd97('0x1'));var auth=require(_0xbd97('0x2'));var config=require(_0xbd97('0x3'));var router=express[_0xbd97('0x4')]();var isProduction=config[_0xbd97('0x5')]===_0xbd97('0x6')||![];function clientSideLogs(_0x3b93a9,_0x23393d,_0x148697){var _0x580986=_0x3b93a9['app'][_0xbd97('0x7')](_0xbd97('0x8'));if(!_0x580986){throw new Error(_0xbd97('0x9'));}return beaverLogger[_0xbd97('0xa')]({'uri':_0xbd97('0xb'),'logger':_0x580986,'enableCors':!isProduction})(_0x3b93a9,_0x23393d,_0x148697);}router[_0xbd97('0xc')](auth['isAuthenticated'](),clientSideLogs);module[_0xbd97('0xd')]=router; \ No newline at end of file +var _0x8e57=['Router','app','get','client-side-logger','expressEndpoint','/client-logs','isAuthenticated','beaver-logger/server','express','../config/environment'];(function(_0x1ee9a1,_0x5f1434){var _0x21270f=function(_0x303251){while(--_0x303251){_0x1ee9a1['push'](_0x1ee9a1['shift']());}};_0x21270f(++_0x5f1434);}(_0x8e57,0x6b));var _0x78e5=function(_0x3b8746,_0x4796f4){_0x3b8746=_0x3b8746-0x0;var _0x491036=_0x8e57[_0x3b8746];return _0x491036;};var beaverLogger=require(_0x78e5('0x0'));var express=require(_0x78e5('0x1'));var auth=require('../components/auth/service');var config=require(_0x78e5('0x2'));var router=express[_0x78e5('0x3')]();var isProduction=config['env']==='production'||![];function clientSideLogs(_0x5bdc85,_0x40a950,_0x1508ea){var _0x2db7f8=_0x5bdc85[_0x78e5('0x4')][_0x78e5('0x5')](_0x78e5('0x6'));if(!_0x2db7f8){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger[_0x78e5('0x7')]({'uri':_0x78e5('0x8'),'logger':_0x2db7f8,'enableCors':!isProduction})(_0x5bdc85,_0x40a950,_0x1508ea);}router['use'](auth[_0x78e5('0x9')](),clientSideLogs);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 6c60fd9..dd541bc 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 _0x8f62=['Google','Outlook365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','exports','STRING','ENUM'];(function(_0x1df18d,_0x3cf08d){var _0x16250e=function(_0x5e8727){while(--_0x5e8727){_0x1df18d['push'](_0x1df18d['shift']());}};_0x16250e(++_0x3cf08d);}(_0x8f62,0x81));var _0x28f6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8f62[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x28f6('0x0')]={'name':{'type':Sequelize[_0x28f6('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x28f6('0x2')]('AmazonAWS',_0x28f6('0x3'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x28f6('0x2')](_0x28f6('0x4'),'Dynamics365')},'data1':{'type':Sequelize[_0x28f6('0x1')],'comment':_0x28f6('0x5')},'data2':{'type':Sequelize[_0x28f6('0x1')],'comment':_0x28f6('0x6')},'data3':{'type':Sequelize[_0x28f6('0x1')],'comment':_0x28f6('0x7')},'data4':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0x28f6('0x8')],'comment':_0x28f6('0x9')},'data6':{'type':Sequelize[_0x28f6('0x8')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0x28f6('0x8')],'comment':_0x28f6('0xa')}}; \ No newline at end of file +var _0xc47b=['MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','STRING','ENUM','Google','MicrosoftAzure','Outlook365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token'];(function(_0x203121,_0x1790d5){var _0x2978b7=function(_0x1c122c){while(--_0x1c122c){_0x203121['push'](_0x203121['shift']());}};_0x2978b7(++_0x1790d5);}(_0xc47b,0x19a));var _0xbc47=function(_0x3203e1,_0x305b1c){_0x3203e1=_0x3203e1-0x0;var _0x3139eb=_0xc47b[_0x3203e1];return _0x3139eb;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xbc47('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xbc47('0x1')]('AmazonAWS',_0xbc47('0x2'),_0xbc47('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xbc47('0x1')](_0xbc47('0x4'),'Dynamics365')},'data1':{'type':Sequelize['STRING'],'comment':_0xbc47('0x5')},'data2':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0xbc47('0x0')],'comment':_0xbc47('0x6')},'data4':{'type':Sequelize['STRING'],'comment':_0xbc47('0x7')},'data5':{'type':Sequelize[_0xbc47('0x8')],'comment':_0xbc47('0x9')},'data6':{'type':Sequelize['TEXT'],'comment':_0xbc47('0xa')},'data7':{'type':Sequelize[_0xbc47('0x8')],'comment':_0xbc47('0xb')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 1a988cf..51ac471 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 _0x7aba=['microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','send','message','stringify','lodash','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','redis','defaults','socket.io-emitter','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','error','name','slice','index','map','CloudProvider','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','filter','merge','type','where','includeAll','include','findAll','service','MicrosoftAzure','decryptString','data3','show','params','find','catch','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','encryptString','destroy','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','toString','isValidIdToken','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','data6','emit'];(function(_0x338adf,_0x822d51){var _0x1fee0a=function(_0x48aaf7){while(--_0x48aaf7){_0x338adf['push'](_0x338adf['shift']());}};_0x1fee0a(++_0x822d51);}(_0x7aba,0xaf));var _0xa7ab=function(_0x201b49,_0x2f73f0){_0x201b49=_0x201b49-0x0;var _0x4562d9=_0x7aba[_0x201b49];return _0x4562d9;};'use strict';var _=require(_0xa7ab('0x0'));var Redis=require('ioredis');var qs=require(_0xa7ab('0x1'));var encryptor=require(_0xa7ab('0x2'));var config=require(_0xa7ab('0x3'));var logger=require(_0xa7ab('0x4'))(_0xa7ab('0x5'));var db=require('../../mysqldb')['db'];var oauth=require('./cloudProvider.oauth');config[_0xa7ab('0x6')]=_[_0xa7ab('0x7')](config[_0xa7ab('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0xa7ab('0x8'))(new Redis(config[_0xa7ab('0x6')]));var redis=new Redis(config[_0xa7ab('0x6')]);function respondWithStatusCode(_0x37967d,_0x1700d7){_0x1700d7=_0x1700d7||0xcc;return function(_0x582541){if(_0x582541){return _0x37967d[_0xa7ab('0x9')](_0x1700d7);}return _0x37967d[_0xa7ab('0xa')](_0x1700d7)[_0xa7ab('0xb')]();};}function respondWithResult(_0x54b83f,_0xc35c0){_0xc35c0=_0xc35c0||0xc8;return function(_0x1d91c8){if(_0x1d91c8){return _0x54b83f[_0xa7ab('0xa')](_0xc35c0)[_0xa7ab('0xc')](_0x1d91c8);}};}function respondWithFilteredResult(_0x46c7f4,_0x160041){return function(_0x3a8294){if(_0x3a8294){var _0x3ef6be=typeof _0x160041[_0xa7ab('0xd')]===_0xa7ab('0xe')&&typeof _0x160041['limit']==='undefined';var _0x4c785f=_0x3a8294['count'];var _0x5542eb=_0x3ef6be?0x0:_0x160041['offset'];var _0x17ed27=_0x3ef6be?_0x3a8294[_0xa7ab('0xf')]:_0x160041[_0xa7ab('0xd')]+_0x160041[_0xa7ab('0x10')];var _0x568141;if(_0x17ed27>=_0x4c785f){_0x17ed27=_0x4c785f;_0x568141=0xc8;}else{_0x568141=0xce;}_0x46c7f4[_0xa7ab('0xa')](_0x568141);return _0x46c7f4[_0xa7ab('0x11')](_0xa7ab('0x12'),_0x5542eb+'-'+_0x17ed27+'/'+_0x4c785f)['json'](_0x3a8294);}return null;};}function saveUpdates(_0x40daeb){return function(_0x3fd4c4){if(_0x3fd4c4){return _0x3fd4c4[_0xa7ab('0x13')](_0x40daeb)[_0xa7ab('0x14')](function(_0x21443b){return _0x21443b;});}return null;};}function removeEntity(_0x136366){return function(_0x35248e){if(_0x35248e){return _0x35248e['destroy']()[_0xa7ab('0x14')](function(){_0x136366[_0xa7ab('0xa')](0xcc)[_0xa7ab('0xb')]();});}};}function handleEntityNotFound(_0x54cddf){return function(_0x187b8b){if(!_0x187b8b){_0x54cddf[_0xa7ab('0x9')](0x194);}return _0x187b8b;};}function handleError(_0x1919ee,_0x2fe446){_0x2fe446=_0x2fe446||0x1f4;return function(_0x42bb15){logger[_0xa7ab('0x15')](_0x42bb15['stack']);if(_0x42bb15[_0xa7ab('0x16')]){delete _0x42bb15[_0xa7ab('0x16')];}_0x1919ee[_0xa7ab('0xa')](_0x2fe446)['send'](_0x42bb15);};}function maskClientSecret(_0x59aed0){return _['padEnd'](_0x59aed0[_0xa7ab('0x17')](0x0,0x3),0x14,'*');}exports[_0xa7ab('0x18')]=function(_0x51daa0,_0xd8034){var _0x5d2b85={},_0x14478a={},_0x4eb43c={'count':0x0,'rows':[]};var _0xd527bc=_[_0xa7ab('0x19')](db[_0xa7ab('0x1a')][_0xa7ab('0x1b')],function(_0x1363dc){return{'name':_0x1363dc[_0xa7ab('0x1c')],'type':_0x1363dc['type'][_0xa7ab('0x1d')]};});_0x14478a[_0xa7ab('0x1e')]=_[_0xa7ab('0x19')](_0xd527bc,_0xa7ab('0x16'));_0x14478a[_0xa7ab('0x1f')]=_[_0xa7ab('0x20')](_0x51daa0['query']);_0x14478a[_0xa7ab('0x21')]=_[_0xa7ab('0x22')](_0x14478a[_0xa7ab('0x1e')],_0x14478a[_0xa7ab('0x1f')]);_0x5d2b85[_0xa7ab('0x23')]=_[_0xa7ab('0x22')](_0x14478a[_0xa7ab('0x1e')],qs[_0xa7ab('0x24')](_0x51daa0[_0xa7ab('0x1f')][_0xa7ab('0x24')]));_0x5d2b85['attributes']=_0x5d2b85[_0xa7ab('0x23')][_0xa7ab('0x25')]?_0x5d2b85['attributes']:_0x14478a[_0xa7ab('0x1e')];if(!_0x51daa0['query']['hasOwnProperty'](_0xa7ab('0x26'))){_0x5d2b85['limit']=qs[_0xa7ab('0x10')](_0x51daa0[_0xa7ab('0x1f')]['limit']);_0x5d2b85[_0xa7ab('0xd')]=qs[_0xa7ab('0xd')](_0x51daa0[_0xa7ab('0x1f')][_0xa7ab('0xd')]);}_0x5d2b85['order']=qs[_0xa7ab('0x27')](_0x51daa0[_0xa7ab('0x1f')][_0xa7ab('0x27')]);_0x5d2b85['where']=qs[_0xa7ab('0x21')](_['pick'](_0x51daa0['query'],_0x14478a[_0xa7ab('0x21')]),_0xd527bc);if(_0x51daa0[_0xa7ab('0x1f')][_0xa7ab('0x28')]){_0x5d2b85['where']=_[_0xa7ab('0x29')](_0x5d2b85['where'],{'$or':_[_0xa7ab('0x19')](_0xd527bc,function(_0x24a878){if(_0x24a878[_0xa7ab('0x2a')]!=='VIRTUAL'){var _0x1ef9d9={};_0x1ef9d9[_0x24a878[_0xa7ab('0x16')]]={'$like':'%'+_0x51daa0[_0xa7ab('0x1f')][_0xa7ab('0x28')]+'%'};return _0x1ef9d9;}})});}_0x5d2b85=_[_0xa7ab('0x29')]({},_0x5d2b85,_0x51daa0['options']);var _0x311941={'where':_0x5d2b85[_0xa7ab('0x2b')]};return db[_0xa7ab('0x1a')][_0xa7ab('0xf')](_0x311941)[_0xa7ab('0x14')](function(_0x440950){_0x4eb43c[_0xa7ab('0xf')]=_0x440950;if(_0x51daa0[_0xa7ab('0x1f')][_0xa7ab('0x2c')]){_0x5d2b85[_0xa7ab('0x2d')]=[{'all':!![]}];}return db['CloudProvider'][_0xa7ab('0x2e')](_0x5d2b85);})[_0xa7ab('0x14')](function(_0x2be7af){_0x4eb43c['rows']=_['map'](_0x2be7af,function(_0x1e36ee){if(_0x1e36ee[_0xa7ab('0x2f')]===_0xa7ab('0x30')){var _0x204ffa=encryptor[_0xa7ab('0x31')](_0x1e36ee['data3']);_0x1e36ee[_0xa7ab('0x32')]=maskClientSecret(_0x204ffa);}return _0x1e36ee;});return _0x4eb43c;})[_0xa7ab('0x14')](respondWithFilteredResult(_0xd8034,_0x5d2b85))['catch'](handleError(_0xd8034,null));};exports[_0xa7ab('0x33')]=function(_0x2b3449,_0x295168){var _0x9cc303={'raw':!![],'where':{'id':_0x2b3449[_0xa7ab('0x34')]['id']}},_0x39fc1d={};_0x39fc1d[_0xa7ab('0x1e')]=_['keys'](db[_0xa7ab('0x1a')][_0xa7ab('0x1b')]);_0x39fc1d[_0xa7ab('0x1f')]=_['keys'](_0x2b3449[_0xa7ab('0x1f')]);_0x39fc1d[_0xa7ab('0x21')]=_[_0xa7ab('0x22')](_0x39fc1d[_0xa7ab('0x1e')],_0x39fc1d[_0xa7ab('0x1f')]);_0x9cc303[_0xa7ab('0x23')]=_[_0xa7ab('0x22')](_0x39fc1d[_0xa7ab('0x1e')],qs[_0xa7ab('0x24')](_0x2b3449['query'][_0xa7ab('0x24')]));_0x9cc303[_0xa7ab('0x23')]=_0x9cc303['attributes']['length']?_0x9cc303['attributes']:_0x39fc1d[_0xa7ab('0x1e')];if(_0x2b3449['query']['includeAll']){_0x9cc303[_0xa7ab('0x2d')]=[{'all':!![]}];}_0x9cc303=_['merge']({},_0x9cc303,_0x2b3449['options']);return db[_0xa7ab('0x1a')][_0xa7ab('0x35')](_0x9cc303)[_0xa7ab('0x14')](handleEntityNotFound(_0x295168,null))[_0xa7ab('0x14')](function(_0x95ddbd){if(_0x95ddbd['service']===_0xa7ab('0x30')){var _0x75ad91=encryptor[_0xa7ab('0x31')](_0x95ddbd[_0xa7ab('0x32')]);_0x95ddbd[_0xa7ab('0x32')]=maskClientSecret(_0x75ad91);}return _0x95ddbd;})[_0xa7ab('0x14')](respondWithResult(_0x295168,null))[_0xa7ab('0x36')](handleError(_0x295168,null));};exports[_0xa7ab('0x37')]=function(_0xdec2cb,_0x1916a9){if(!_0xdec2cb[_0xa7ab('0x38')][_0xa7ab('0x16')])throw new Error(_0xa7ab('0x39'));if(!_0xdec2cb['body'][_0xa7ab('0x2f')])throw new Error(_0xa7ab('0x3a'));var _0x37fea9=db[_0xa7ab('0x1a')]['rawAttributes']['service'][_0xa7ab('0x3b')];if(!_0x37fea9[_0xa7ab('0x3c')](_0xdec2cb[_0xa7ab('0x38')][_0xa7ab('0x2f')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x37fea9['join'](',\x20'));if(_0xdec2cb[_0xa7ab('0x38')][_0xa7ab('0x2f')]==='MicrosoftAzure'&&_0xdec2cb[_0xa7ab('0x38')][_0xa7ab('0x32')]){_0xdec2cb[_0xa7ab('0x38')][_0xa7ab('0x32')]=encryptor[_0xa7ab('0x3d')](_0xdec2cb[_0xa7ab('0x38')][_0xa7ab('0x32')]);}return db[_0xa7ab('0x1a')][_0xa7ab('0x37')](_0xdec2cb[_0xa7ab('0x38')],{})[_0xa7ab('0x14')](respondWithResult(_0x1916a9,0xc9))[_0xa7ab('0x36')](handleError(_0x1916a9,null));};exports[_0xa7ab('0x13')]=function(_0x10f7eb,_0x36da24){if(_0x10f7eb[_0xa7ab('0x38')]['id']){delete _0x10f7eb[_0xa7ab('0x38')]['id'];}return db[_0xa7ab('0x1a')][_0xa7ab('0x35')]({'where':{'id':_0x10f7eb[_0xa7ab('0x34')]['id']}})['then'](handleEntityNotFound(_0x36da24,null))[_0xa7ab('0x14')](function(_0x12dcdd){if(_0x12dcdd[_0xa7ab('0x2f')]===_0xa7ab('0x30')&&_0x10f7eb[_0xa7ab('0x38')][_0xa7ab('0x32')]){_0x10f7eb['body'][_0xa7ab('0x32')]=encryptor[_0xa7ab('0x3d')](_0x10f7eb[_0xa7ab('0x38')][_0xa7ab('0x32')]);}return _0x12dcdd;})[_0xa7ab('0x14')](saveUpdates(_0x10f7eb['body'],null))[_0xa7ab('0x14')](respondWithResult(_0x36da24,null))['catch'](handleError(_0x36da24,null));};exports[_0xa7ab('0x3e')]=function(_0x4c8775,_0x1571a6){return db[_0xa7ab('0x1a')][_0xa7ab('0x35')]({'where':{'id':_0x4c8775[_0xa7ab('0x34')]['id']}})[_0xa7ab('0x14')](handleEntityNotFound(_0x1571a6,null))[_0xa7ab('0x14')](removeEntity(_0x1571a6,null))[_0xa7ab('0x36')](handleError(_0x1571a6,null));};exports['oauth2MicrosoftAuthorize']=function(_0x418f69,_0x43c00d){return db[_0xa7ab('0x1a')][_0xa7ab('0x3f')]({'where':{'id':_0x418f69[_0xa7ab('0x34')]['id']},'raw':!![]})[_0xa7ab('0x14')](function(_0x13ef1f){if(!_0x13ef1f)return _0x43c00d[_0xa7ab('0x9')](0x194);return{'url':oauth[_0xa7ab('0x40')](_0x13ef1f,_0x418f69[_0xa7ab('0x41')]['id'])};})[_0xa7ab('0x14')](respondWithResult(_0x43c00d,null))[_0xa7ab('0x36')](handleError(_0x43c00d,null));};exports[_0xa7ab('0x42')]=function(_0x1f5d04,_0x24c2af){var _0x55691e=_0x1f5d04['body'];var _0x44d065;var _0x2726b6;if(_0x55691e[_0xa7ab('0x15')])throw _0x55691e;redis[_0xa7ab('0x43')](_0x55691e[_0xa7ab('0x44')])['then'](function(_0x36b869){if(!_0x36b869)throw new Error(_0xa7ab('0x45'));_0x44d065=JSON[_0xa7ab('0x46')](_0x36b869);var _0x4f546c=Buffer['from'](_0x55691e[_0xa7ab('0x44')],'base64')[_0xa7ab('0x47')]('ascii');_0x2726b6=JSON[_0xa7ab('0x46')](_0x4f546c);if(!oauth[_0xa7ab('0x48')](_0x55691e['id_token'],_0x44d065['oauth2Claims']))throw new Error(_0xa7ab('0x49'));redis[_0xa7ab('0x4a')](_0x55691e['state']);return oauth[_0xa7ab('0x4b')](_0x55691e[_0xa7ab('0x4c')],_0x44d065);})[_0xa7ab('0x14')](function(_0x470ae3){_0x44d065[_0xa7ab('0x4d')]=_0x470ae3['access_token'];_0x44d065[_0xa7ab('0x4e')]=_0x470ae3['refresh_token'];return db[_0xa7ab('0x1a')][_0xa7ab('0x13')]({'data5':_0x44d065[_0xa7ab('0x4d')],'data6':_0x44d065[_0xa7ab('0x4e')]},{'where':{'id':_0x44d065['id']}});})[_0xa7ab('0x14')](function(){oauth['startRefreshInterval'](_0x44d065);socket[_0xa7ab('0x4f')]('microsoftAuthorization:success',{'id':_0x2726b6['id']});return;})[_0xa7ab('0x14')](respondWithStatusCode(_0x24c2af,null))[_0xa7ab('0x36')](function(_0x170650){if(_0x2726b6){socket[_0xa7ab('0x4f')](_0xa7ab('0x50'),{'id':_0x2726b6['id']});}if(!_0x44d065){logger['error'](_0xa7ab('0x51'),_0x170650);return _0x24c2af['status'](0x1f4)[_0xa7ab('0x52')](_0x170650[_0xa7ab('0x53')]);}logger['error']('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x44d065['id'],JSON[_0xa7ab('0x54')](_0x170650));});}; \ No newline at end of file +var _0xa4f0=['Invalid\x20state\x20parameter','parse','from','base64','isValidIdToken','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','access_token','refresh_token','data6','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','api','../../mysqldb','redis','defaults','socket.io-emitter','sendStatus','status','end','offset','undefined','limit','count','set','json','then','destroy','error','stack','name','send','map','CloudProvider','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','rows','MicrosoftAzure','decryptString','data3','show','params','includeAll','include','service','create','body','includes','join','update','find','encryptString','catch','findOne','oauth2MicrosoftCallback','get','state'];(function(_0x10ec0f,_0x5ece09){var _0x1587ee=function(_0x54ac17){while(--_0x54ac17){_0x10ec0f['push'](_0x10ec0f['shift']());}};_0x1587ee(++_0x5ece09);}(_0xa4f0,0x6d));var _0x0a4f=function(_0x24cfb2,_0x10a47c){_0x24cfb2=_0x24cfb2-0x0;var _0x520808=_0xa4f0[_0x24cfb2];return _0x520808;};'use strict';var _=require(_0x0a4f('0x0'));var Redis=require(_0x0a4f('0x1'));var qs=require(_0x0a4f('0x2'));var encryptor=require('../../components/encryptor');var config=require('../../config/environment');var logger=require('../../config/logger')(_0x0a4f('0x3'));var db=require(_0x0a4f('0x4'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x0a4f('0x5')]=_[_0x0a4f('0x6')](config[_0x0a4f('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0x0a4f('0x7'))(new Redis(config['redis']));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x404c6c,_0x4924b7){_0x4924b7=_0x4924b7||0xcc;return function(_0x1d1ed2){if(_0x1d1ed2){return _0x404c6c[_0x0a4f('0x8')](_0x4924b7);}return _0x404c6c[_0x0a4f('0x9')](_0x4924b7)[_0x0a4f('0xa')]();};}function respondWithResult(_0x230be9,_0x5bf13e){_0x5bf13e=_0x5bf13e||0xc8;return function(_0x4c2310){if(_0x4c2310){return _0x230be9[_0x0a4f('0x9')](_0x5bf13e)['json'](_0x4c2310);}};}function respondWithFilteredResult(_0x333489,_0xd973d2){return function(_0x137ce6){if(_0x137ce6){var _0x2e8425=typeof _0xd973d2[_0x0a4f('0xb')]===_0x0a4f('0xc')&&typeof _0xd973d2[_0x0a4f('0xd')]===_0x0a4f('0xc');var _0x29057b=_0x137ce6['count'];var _0x420a82=_0x2e8425?0x0:_0xd973d2[_0x0a4f('0xb')];var _0x115fe8=_0x2e8425?_0x137ce6[_0x0a4f('0xe')]:_0xd973d2['offset']+_0xd973d2[_0x0a4f('0xd')];var _0xa2b12f;if(_0x115fe8>=_0x29057b){_0x115fe8=_0x29057b;_0xa2b12f=0xc8;}else{_0xa2b12f=0xce;}_0x333489[_0x0a4f('0x9')](_0xa2b12f);return _0x333489[_0x0a4f('0xf')]('Content-Range',_0x420a82+'-'+_0x115fe8+'/'+_0x29057b)[_0x0a4f('0x10')](_0x137ce6);}return null;};}function saveUpdates(_0x33e9c5){return function(_0x616a1a){if(_0x616a1a){return _0x616a1a['update'](_0x33e9c5)[_0x0a4f('0x11')](function(_0x36366c){return _0x36366c;});}return null;};}function removeEntity(_0x2aee88){return function(_0x1e825e){if(_0x1e825e){return _0x1e825e[_0x0a4f('0x12')]()[_0x0a4f('0x11')](function(){_0x2aee88[_0x0a4f('0x9')](0xcc)[_0x0a4f('0xa')]();});}};}function handleEntityNotFound(_0x3658ae){return function(_0x17498e){if(!_0x17498e){_0x3658ae[_0x0a4f('0x8')](0x194);}return _0x17498e;};}function handleError(_0x42df4b,_0x1b4a5f){_0x1b4a5f=_0x1b4a5f||0x1f4;return function(_0x58c193){logger[_0x0a4f('0x13')](_0x58c193[_0x0a4f('0x14')]);if(_0x58c193['name']){delete _0x58c193[_0x0a4f('0x15')];}_0x42df4b[_0x0a4f('0x9')](_0x1b4a5f)[_0x0a4f('0x16')](_0x58c193);};}function maskClientSecret(_0x16d165){return _['padEnd'](_0x16d165['slice'](0x0,0x3),0x14,'*');}exports['index']=function(_0x178511,_0xe9cd7e){var _0x52357b={},_0x1fa74b={},_0x5c235d={'count':0x0,'rows':[]};var _0x34cd08=_[_0x0a4f('0x17')](db[_0x0a4f('0x18')][_0x0a4f('0x19')],function(_0xb48d55){return{'name':_0xb48d55[_0x0a4f('0x1a')],'type':_0xb48d55[_0x0a4f('0x1b')]['key']};});_0x1fa74b[_0x0a4f('0x1c')]=_[_0x0a4f('0x17')](_0x34cd08,'name');_0x1fa74b['query']=_[_0x0a4f('0x1d')](_0x178511[_0x0a4f('0x1e')]);_0x1fa74b[_0x0a4f('0x1f')]=_[_0x0a4f('0x20')](_0x1fa74b[_0x0a4f('0x1c')],_0x1fa74b[_0x0a4f('0x1e')]);_0x52357b[_0x0a4f('0x21')]=_['intersection'](_0x1fa74b[_0x0a4f('0x1c')],qs[_0x0a4f('0x22')](_0x178511[_0x0a4f('0x1e')][_0x0a4f('0x22')]));_0x52357b['attributes']=_0x52357b[_0x0a4f('0x21')][_0x0a4f('0x23')]?_0x52357b[_0x0a4f('0x21')]:_0x1fa74b[_0x0a4f('0x1c')];if(!_0x178511[_0x0a4f('0x1e')]['hasOwnProperty'](_0x0a4f('0x24'))){_0x52357b['limit']=qs['limit'](_0x178511[_0x0a4f('0x1e')][_0x0a4f('0xd')]);_0x52357b[_0x0a4f('0xb')]=qs[_0x0a4f('0xb')](_0x178511['query'][_0x0a4f('0xb')]);}_0x52357b[_0x0a4f('0x25')]=qs['sort'](_0x178511[_0x0a4f('0x1e')][_0x0a4f('0x26')]);_0x52357b[_0x0a4f('0x27')]=qs[_0x0a4f('0x1f')](_['pick'](_0x178511[_0x0a4f('0x1e')],_0x1fa74b[_0x0a4f('0x1f')]),_0x34cd08);if(_0x178511[_0x0a4f('0x1e')][_0x0a4f('0x28')]){_0x52357b['where']=_[_0x0a4f('0x29')](_0x52357b[_0x0a4f('0x27')],{'$or':_['map'](_0x34cd08,function(_0x1f79a4){if(_0x1f79a4[_0x0a4f('0x1b')]!==_0x0a4f('0x2a')){var _0x519d42={};_0x519d42[_0x1f79a4[_0x0a4f('0x15')]]={'$like':'%'+_0x178511[_0x0a4f('0x1e')][_0x0a4f('0x28')]+'%'};return _0x519d42;}})});}_0x52357b=_[_0x0a4f('0x29')]({},_0x52357b,_0x178511[_0x0a4f('0x2b')]);var _0x39996d={'where':_0x52357b[_0x0a4f('0x27')]};return db[_0x0a4f('0x18')]['count'](_0x39996d)[_0x0a4f('0x11')](function(_0x4413a3){_0x5c235d['count']=_0x4413a3;if(_0x178511['query']['includeAll']){_0x52357b['include']=[{'all':!![]}];}return db['CloudProvider']['findAll'](_0x52357b);})['then'](function(_0x81a892){_0x5c235d[_0x0a4f('0x2c')]=_['map'](_0x81a892,function(_0x58ee37){if(_0x58ee37['service']===_0x0a4f('0x2d')){var _0x4cf25f=encryptor[_0x0a4f('0x2e')](_0x58ee37[_0x0a4f('0x2f')]);_0x58ee37['data3']=maskClientSecret(_0x4cf25f);}return _0x58ee37;});return _0x5c235d;})[_0x0a4f('0x11')](respondWithFilteredResult(_0xe9cd7e,_0x52357b))['catch'](handleError(_0xe9cd7e,null));};exports[_0x0a4f('0x30')]=function(_0x2bd3bd,_0x17b12d){var _0x26c9b2={'raw':!![],'where':{'id':_0x2bd3bd[_0x0a4f('0x31')]['id']}},_0x4a528e={};_0x4a528e[_0x0a4f('0x1c')]=_['keys'](db[_0x0a4f('0x18')][_0x0a4f('0x19')]);_0x4a528e[_0x0a4f('0x1e')]=_[_0x0a4f('0x1d')](_0x2bd3bd[_0x0a4f('0x1e')]);_0x4a528e[_0x0a4f('0x1f')]=_[_0x0a4f('0x20')](_0x4a528e[_0x0a4f('0x1c')],_0x4a528e['query']);_0x26c9b2[_0x0a4f('0x21')]=_[_0x0a4f('0x20')](_0x4a528e[_0x0a4f('0x1c')],qs['fields'](_0x2bd3bd[_0x0a4f('0x1e')][_0x0a4f('0x22')]));_0x26c9b2[_0x0a4f('0x21')]=_0x26c9b2[_0x0a4f('0x21')][_0x0a4f('0x23')]?_0x26c9b2[_0x0a4f('0x21')]:_0x4a528e[_0x0a4f('0x1c')];if(_0x2bd3bd[_0x0a4f('0x1e')][_0x0a4f('0x32')]){_0x26c9b2[_0x0a4f('0x33')]=[{'all':!![]}];}_0x26c9b2=_[_0x0a4f('0x29')]({},_0x26c9b2,_0x2bd3bd[_0x0a4f('0x2b')]);return db[_0x0a4f('0x18')]['find'](_0x26c9b2)['then'](handleEntityNotFound(_0x17b12d,null))['then'](function(_0x391375){if(_0x391375[_0x0a4f('0x34')]===_0x0a4f('0x2d')){var _0x16f5df=encryptor[_0x0a4f('0x2e')](_0x391375[_0x0a4f('0x2f')]);_0x391375[_0x0a4f('0x2f')]=maskClientSecret(_0x16f5df);}return _0x391375;})[_0x0a4f('0x11')](respondWithResult(_0x17b12d,null))['catch'](handleError(_0x17b12d,null));};exports[_0x0a4f('0x35')]=function(_0x3bbdec,_0x5475dd){if(!_0x3bbdec[_0x0a4f('0x36')][_0x0a4f('0x15')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x3bbdec[_0x0a4f('0x36')][_0x0a4f('0x34')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x60adb6=db[_0x0a4f('0x18')][_0x0a4f('0x19')][_0x0a4f('0x34')]['values'];if(!_0x60adb6[_0x0a4f('0x37')](_0x3bbdec['body']['service']))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x60adb6[_0x0a4f('0x38')](',\x20'));if(_0x3bbdec[_0x0a4f('0x36')][_0x0a4f('0x34')]===_0x0a4f('0x2d')&&_0x3bbdec['body']['data3']){_0x3bbdec['body']['data3']=encryptor['encryptString'](_0x3bbdec[_0x0a4f('0x36')][_0x0a4f('0x2f')]);}return db['CloudProvider'][_0x0a4f('0x35')](_0x3bbdec[_0x0a4f('0x36')],{})[_0x0a4f('0x11')](respondWithResult(_0x5475dd,0xc9))['catch'](handleError(_0x5475dd,null));};exports[_0x0a4f('0x39')]=function(_0xd1ca4f,_0x13fadf){if(_0xd1ca4f[_0x0a4f('0x36')]['id']){delete _0xd1ca4f[_0x0a4f('0x36')]['id'];}return db[_0x0a4f('0x18')][_0x0a4f('0x3a')]({'where':{'id':_0xd1ca4f[_0x0a4f('0x31')]['id']}})[_0x0a4f('0x11')](handleEntityNotFound(_0x13fadf,null))[_0x0a4f('0x11')](function(_0x400afa){if(_0x400afa[_0x0a4f('0x34')]===_0x0a4f('0x2d')&&_0xd1ca4f[_0x0a4f('0x36')][_0x0a4f('0x2f')]){_0xd1ca4f[_0x0a4f('0x36')]['data3']=encryptor[_0x0a4f('0x3b')](_0xd1ca4f[_0x0a4f('0x36')][_0x0a4f('0x2f')]);}return _0x400afa;})[_0x0a4f('0x11')](saveUpdates(_0xd1ca4f['body'],null))[_0x0a4f('0x11')](respondWithResult(_0x13fadf,null))[_0x0a4f('0x3c')](handleError(_0x13fadf,null));};exports[_0x0a4f('0x12')]=function(_0x377333,_0x5b1378){return db[_0x0a4f('0x18')][_0x0a4f('0x3a')]({'where':{'id':_0x377333[_0x0a4f('0x31')]['id']}})[_0x0a4f('0x11')](handleEntityNotFound(_0x5b1378,null))[_0x0a4f('0x11')](removeEntity(_0x5b1378,null))[_0x0a4f('0x3c')](handleError(_0x5b1378,null));};exports['oauth2MicrosoftAuthorize']=function(_0x301aeb,_0x9c509c){return db[_0x0a4f('0x18')][_0x0a4f('0x3d')]({'where':{'id':_0x301aeb[_0x0a4f('0x31')]['id']},'raw':!![]})[_0x0a4f('0x11')](function(_0x37189d){if(!_0x37189d)return _0x9c509c[_0x0a4f('0x8')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x37189d,_0x301aeb['user']['id'])};})['then'](respondWithResult(_0x9c509c,null))['catch'](handleError(_0x9c509c,null));};exports[_0x0a4f('0x3e')]=function(_0x1167c8,_0x459f5c){var _0xc940fb=_0x1167c8[_0x0a4f('0x36')];var _0x315f5b;var _0x3c2ef2;if(_0xc940fb[_0x0a4f('0x13')])throw _0xc940fb;redis[_0x0a4f('0x3f')](_0xc940fb[_0x0a4f('0x40')])[_0x0a4f('0x11')](function(_0x41d012){if(!_0x41d012)throw new Error(_0x0a4f('0x41'));_0x315f5b=JSON[_0x0a4f('0x42')](_0x41d012);var _0x3cee6e=Buffer[_0x0a4f('0x43')](_0xc940fb[_0x0a4f('0x40')],_0x0a4f('0x44'))['toString']('ascii');_0x3c2ef2=JSON[_0x0a4f('0x42')](_0x3cee6e);if(!oauth[_0x0a4f('0x45')](_0xc940fb['id_token'],_0x315f5b[_0x0a4f('0x46')]))throw new Error(_0x0a4f('0x47'));redis[_0x0a4f('0x48')](_0xc940fb[_0x0a4f('0x40')]);return oauth[_0x0a4f('0x49')](_0xc940fb[_0x0a4f('0x4a')],_0x315f5b);})[_0x0a4f('0x11')](function(_0x3a8ec8){_0x315f5b[_0x0a4f('0x4b')]=_0x3a8ec8[_0x0a4f('0x4c')];_0x315f5b['data6']=_0x3a8ec8[_0x0a4f('0x4d')];return db[_0x0a4f('0x18')]['update']({'data5':_0x315f5b[_0x0a4f('0x4b')],'data6':_0x315f5b[_0x0a4f('0x4e')]},{'where':{'id':_0x315f5b['id']}});})[_0x0a4f('0x11')](function(){oauth[_0x0a4f('0x4f')](_0x315f5b);socket[_0x0a4f('0x50')](_0x0a4f('0x51'),{'id':_0x3c2ef2['id']});return;})[_0x0a4f('0x11')](respondWithStatusCode(_0x459f5c,null))[_0x0a4f('0x3c')](function(_0x593071){if(_0x3c2ef2){socket[_0x0a4f('0x50')](_0x0a4f('0x52'),{'id':_0x3c2ef2['id']});}if(!_0x315f5b){logger[_0x0a4f('0x13')](_0x0a4f('0x53'),_0x593071);return _0x459f5c[_0x0a4f('0x9')](0x1f4)[_0x0a4f('0x16')](_0x593071[_0x0a4f('0x54')]);}logger[_0x0a4f('0x13')](_0x0a4f('0x55'),_0x315f5b['id'],JSON[_0x0a4f('0x56')](_0x593071));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index b2735ed..0839d1f 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 _0xffd3=['CloudProvider','cloud_providers','util','api','moment','request-promise','path','rimraf','exports','define'];(function(_0x57dcad,_0x237449){var _0x4c968a=function(_0x2379dd){while(--_0x2379dd){_0x57dcad['push'](_0x57dcad['shift']());}};_0x4c968a(++_0x237449);}(_0xffd3,0x142));var _0x3ffd=function(_0x3a2b24,_0x401b6c){_0x3a2b24=_0x3a2b24-0x0;var _0x37e45b=_0xffd3[_0x3a2b24];return _0x37e45b;};'use strict';var _=require('lodash');var util=require(_0x3ffd('0x0'));var logger=require('../../config/logger')(_0x3ffd('0x1'));var moment=require(_0x3ffd('0x2'));var BPromise=require('bluebird');var rp=require(_0x3ffd('0x3'));var fs=require('fs');var path=require(_0x3ffd('0x4'));var rimraf=require(_0x3ffd('0x5'));var config=require('../../config/environment');var attributes=require('./cloudProvider.attributes');module[_0x3ffd('0x6')]=function(_0x14a613,_0x2990a0){return _0x14a613[_0x3ffd('0x7')](_0x3ffd('0x8'),attributes,{'tableName':_0x3ffd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe3e=['moment','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','define','CloudProvider','cloud_providers','lodash','util','api'];(function(_0x247f68,_0x5c7cd1){var _0x110f6b=function(_0xe994fa){while(--_0xe994fa){_0x247f68['push'](_0x247f68['shift']());}};_0x110f6b(++_0x5c7cd1);}(_0xfe3e,0x81));var _0xefe3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xfe3e[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xefe3('0x0'));var util=require(_0xefe3('0x1'));var logger=require('../../config/logger')(_0xefe3('0x2'));var moment=require(_0xefe3('0x3'));var BPromise=require('bluebird');var rp=require(_0xefe3('0x4'));var fs=require('fs');var path=require(_0xefe3('0x5'));var rimraf=require(_0xefe3('0x6'));var config=require(_0xefe3('0x7'));var attributes=require(_0xefe3('0x8'));module['exports']=function(_0x3e46dd,_0x5de65e){return _0x3e46dd[_0xefe3('0x9')](_0xefe3('0xa'),attributes,{'tableName':_0xefe3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 264dfe4..5a6d985 100644 --- a/server/api/cloudProvider/cloudProvider.oauth.js +++ b/server/api/cloudProvider/cloudProvider.oauth.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7afe=['data5','access_token','data6','update','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','data4','intervals','bind','findAll','map','all','catch','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','jsonwebtoken','moment','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','openid','/authorize','/token','type','Dynamics365','/.default','Outlook365','data7','replace','{TENANT_ID}','data2','code','id_token','from','stringify','base64','randomBytes','hex','response_type','join','redirect_uri','form_post','scope','state','nonce','prompt','login','key','oauth2/','data1','set','decode','payload','iss','issuer','aud','audience','isAfter','unix','exp','resolve','then','data3','CloudProvider','findOne','refresh_token','decryptString','POST'];(function(_0x81dfb5,_0x3545ca){var _0x1d7853=function(_0x51c1ee){while(--_0x51c1ee){_0x81dfb5['push'](_0x81dfb5['shift']());}};_0x1d7853(++_0x3545ca);}(_0x7afe,0x153));var _0xe7af=function(_0x15fd2c,_0x2efe29){_0x15fd2c=_0x15fd2c-0x0;var _0x314c47=_0x7afe[_0x15fd2c];return _0x314c47;};'use strict';var _=require('lodash');var crypto=require('crypto');var jwt=require(_0xe7af('0x0'));var moment=require(_0xe7af('0x1'));var Redis=require('ioredis');var rp=require(_0xe7af('0x2'));var util=require(_0xe7af('0x3'));var encryptor=require(_0xe7af('0x4'));var config=require(_0xe7af('0x5'));var logger=require(_0xe7af('0x6'))(_0xe7af('0x7'));var schedule=require('../../config/schedule/cloud-provider');var db=require(_0xe7af('0x8'))['db'];config[_0xe7af('0x9')]=_[_0xe7af('0xa')](config[_0xe7af('0x9')],{'host':_0xe7af('0xb'),'port':0x18eb});var redis=new Redis(config[_0xe7af('0x9')]);var MICROSOFT_AUTH_URL=_0xe7af('0xc');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0xe7af('0xd'),_0xe7af('0xe'),_0xe7af('0xf'),_0xe7af('0x10'),'https://outlook.office.com/POP.AccessAsUser.All',_0xe7af('0x11')],'Dynamics365':[_0xe7af('0x12'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0xe7af('0x13');var MICROSOFT_TOKEN_ENDPOINT=_0xe7af('0x14');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x4abc3b){var _0x434dc1=_['map'](AZURE_AUTH_SCOPES[_0x4abc3b[_0xe7af('0x15')]]);if(_0x4abc3b[_0xe7af('0x15')]===_0xe7af('0x16'))_0x434dc1['push'](_0x4abc3b['data7']+_0xe7af('0x17'));return _0x434dc1['join']('\x20');}function getAccessTokenScope(_0x1b6255){if(_0x1b6255[_0xe7af('0x15')]===_0xe7af('0x18'))return _0xe7af('0x10');if(_0x1b6255[_0xe7af('0x15')]===_0xe7af('0x16'))return _0x1b6255[_0xe7af('0x19')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x5a29b1,_0x823f37){var _0x332a4c=MICROSOFT_AUTH_URL[_0xe7af('0x1a')](_0xe7af('0x1b'),_0x5a29b1[_0xe7af('0x1c')]);var _0x3ae911=[_0xe7af('0x1d'),_0xe7af('0x1e')];var _0x1ccf5b=Buffer[_0xe7af('0x1f')](JSON[_0xe7af('0x20')]({'id':_0x823f37}))['toString'](_0xe7af('0x21'));var _0x6b04fb=crypto[_0xe7af('0x22')](0x10)['toString'](_0xe7af('0x23'));var _0x257239=getAuthorizationScopes(_0x5a29b1);var _0x402292=[{'key':'client_id','value':_0x5a29b1['data1']},{'key':_0xe7af('0x24'),'value':encodeURIComponent(_0x3ae911[_0xe7af('0x25')]('\x20'))},{'key':_0xe7af('0x26'),'value':_0x5a29b1['data4']},{'key':'response_mode','value':_0xe7af('0x27')},{'key':_0xe7af('0x28'),'value':encodeURIComponent(_0x257239)},{'key':_0xe7af('0x29'),'value':_0x1ccf5b},{'key':_0xe7af('0x2a'),'value':_0x6b04fb},{'key':_0xe7af('0x2b'),'value':_0xe7af('0x2c')}];var _0x3e575e=_0x332a4c+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x402292,function(_0x172470){return _0x172470[_0xe7af('0x2d')]+'='+_0x172470['value'];})[_0xe7af('0x25')]('&');_0x5a29b1['oauth2Claims']={'issuer':_0x332a4c[_0xe7af('0x1a')](_0xe7af('0x2e'),''),'audience':_0x5a29b1[_0xe7af('0x2f')],'state':_0x1ccf5b,'nonce':_0x6b04fb};redis[_0xe7af('0x30')](_0x1ccf5b,JSON['stringify'](_0x5a29b1));return _0x3e575e;}function isValidIdToken(_0x24715f,_0x34407a){try{var _0x212354=jwt[_0xe7af('0x31')](_0x24715f,{'complete':!![]});var _0x46002f=_0x212354[_0xe7af('0x32')];if(_0x46002f[_0xe7af('0x33')]!==_0x34407a[_0xe7af('0x34')])return![];if(_0x46002f[_0xe7af('0x35')]!==_0x34407a[_0xe7af('0x36')])return![];if(_0x46002f[_0xe7af('0x2a')]!==_0x34407a['nonce'])return![];if(moment()[_0xe7af('0x37')](moment[_0xe7af('0x38')](_0x46002f[_0xe7af('0x39')])))return![];return!![];}catch(_0x30664e){throw _0x30664e;}}function refreshOauth2MicrosoftAccessToken(_0x2349f8){return Promise[_0xe7af('0x3a')]()[_0xe7af('0x3b')](function(){if(_0x2349f8[_0xe7af('0x3c')])return _0x2349f8;return db[_0xe7af('0x3d')][_0xe7af('0x3e')]({'where':{'id':_0x2349f8['id']},'raw':!![]});})[_0xe7af('0x3b')](function(_0x2e6fa3){var _0x260890={'grant_type':_0xe7af('0x3f'),'refresh_token':_0x2e6fa3['data6'],'scope':getAccessTokenScope(_0x2e6fa3),'redirect_uri':_0x2e6fa3['data4'],'client_id':_0x2e6fa3['data1'],'client_secret':encryptor[_0xe7af('0x40')](_0x2e6fa3['data3'])};var _0x2af8fe={'method':_0xe7af('0x41'),'uri':MICROSOFT_AUTH_URL[_0xe7af('0x1a')](_0xe7af('0x1b'),_0x2e6fa3[_0xe7af('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x260890,'json':!![]};return rp(_0x2af8fe);})['then'](function(_0x4c7c6d){_0x2349f8[_0xe7af('0x42')]=_0x4c7c6d[_0xe7af('0x43')];_0x2349f8[_0xe7af('0x44')]=_0x4c7c6d['refresh_token'];return db[_0xe7af('0x3d')][_0xe7af('0x45')]({'data5':_0x2349f8['data5'],'data6':_0x2349f8[_0xe7af('0x44')]},{'where':{'id':_0x2349f8['id']}});})['then'](function(){return _0x2349f8;})['catch'](function(_0x38e063){logger[_0xe7af('0x46')](_0xe7af('0x47'),_0x2349f8['id'],_0x38e063);});}function getOauth2MicrosoftAccessToken(_0x34594e,_0x4ac5b8){var _0x3420cc={'grant_type':'authorization_code','code':_0x34594e,'scope':getAccessTokenScope(_0x4ac5b8),'redirect_uri':_0x4ac5b8[_0xe7af('0x48')],'client_id':_0x4ac5b8[_0xe7af('0x2f')],'client_secret':encryptor[_0xe7af('0x40')](_0x4ac5b8[_0xe7af('0x3c')])};var _0xbc6c7c={'method':_0xe7af('0x41'),'uri':MICROSOFT_AUTH_URL['replace'](_0xe7af('0x1b'),_0x4ac5b8['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3420cc,'json':!![]};return rp(_0xbc6c7c);}function startRefreshInterval(_0x8db681){var _0x20bcef=schedule[_0xe7af('0x49')];if(_0x20bcef[_0x8db681['id']])clearInterval(_0x20bcef[_0x8db681['id']]);_0x20bcef[_0x8db681['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xe7af('0x4a')](this,{'id':_0x8db681['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xe7af('0x49')]=_0x20bcef;}function startAllRefreshIntervals(){return db[_0xe7af('0x3d')][_0xe7af('0x4b')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xe7af('0x3b')](function(_0x325181){var _0x28665a=_0x325181[_0xe7af('0x4c')](function(_0x546524){return refreshOauth2MicrosoftAccessToken(_0x546524)['then'](function(_0x28729f){startRefreshInterval(_0x28729f);});});return Promise[_0xe7af('0x4d')](_0x28665a);})[_0xe7af('0x4e')](function(_0x3e8a15){var _0x7bb0b2=_0x3e8a15?util['inspect'](_0x3e8a15,{'showHidden':![],'depth':null}):'';logger[_0xe7af('0x46')](_0xe7af('0x4f'),_0x7bb0b2);});}module[_0xe7af('0x50')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x9534=['oauth2Claims','oauth2/','decode','payload','iss','issuer','aud','audience','isAfter','unix','resolve','CloudProvider','findOne','then','data6','data4','POST','{TENANT_ID}','data5','access_token','refresh_token','update','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','catch','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','lodash','jsonwebtoken','moment','ioredis','util','../../components/encryptor','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','map','type','Dynamics365','push','data7','join','Outlook365','/.default','replace','data2','code','id_token','from','stringify','toString','base64','randomBytes','hex','data1','redirect_uri','response_mode','form_post','scope','state','nonce','prompt','value'];(function(_0x5e8eaa,_0x594767){var _0x1cbf39=function(_0x5c70b7){while(--_0x5c70b7){_0x5e8eaa['push'](_0x5e8eaa['shift']());}};_0x1cbf39(++_0x594767);}(_0x9534,0xfb));var _0x4953=function(_0x4a906f,_0x45b442){_0x4a906f=_0x4a906f-0x0;var _0x291ca2=_0x9534[_0x4a906f];return _0x291ca2;};'use strict';var _=require(_0x4953('0x0'));var crypto=require('crypto');var jwt=require(_0x4953('0x1'));var moment=require(_0x4953('0x2'));var Redis=require(_0x4953('0x3'));var rp=require('request-promise');var util=require(_0x4953('0x4'));var encryptor=require(_0x4953('0x5'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x4953('0x6'));var schedule=require(_0x4953('0x7'));var db=require(_0x4953('0x8'))['db'];config[_0x4953('0x9')]=_[_0x4953('0xa')](config[_0x4953('0x9')],{'host':'localhost','port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0x4953('0xb'),_0x4953('0xc'),_0x4953('0xd'),_0x4953('0xe'),_0x4953('0xf'),_0x4953('0x10'),_0x4953('0x11')],'Dynamics365':[_0x4953('0xb'),_0x4953('0xe')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x399132){var _0x37196e=_[_0x4953('0x12')](AZURE_AUTH_SCOPES[_0x399132['type']]);if(_0x399132[_0x4953('0x13')]===_0x4953('0x14'))_0x37196e[_0x4953('0x15')](_0x399132[_0x4953('0x16')]+'/.default');return _0x37196e[_0x4953('0x17')]('\x20');}function getAccessTokenScope(_0x1969ea){if(_0x1969ea['type']===_0x4953('0x18'))return _0x4953('0xf');if(_0x1969ea[_0x4953('0x13')]===_0x4953('0x14'))return _0x1969ea[_0x4953('0x16')]+_0x4953('0x19');}function generateMicrosoftAuthorizationUrl(_0x1e32ba,_0x10f9e7){var _0x5eb417=MICROSOFT_AUTH_URL[_0x4953('0x1a')]('{TENANT_ID}',_0x1e32ba[_0x4953('0x1b')]);var _0x1818a4=[_0x4953('0x1c'),_0x4953('0x1d')];var _0x370a54=Buffer[_0x4953('0x1e')](JSON[_0x4953('0x1f')]({'id':_0x10f9e7}))[_0x4953('0x20')](_0x4953('0x21'));var _0x5779e1=crypto[_0x4953('0x22')](0x10)[_0x4953('0x20')](_0x4953('0x23'));var _0x42c116=getAuthorizationScopes(_0x1e32ba);var _0x1d4ecf=[{'key':'client_id','value':_0x1e32ba[_0x4953('0x24')]},{'key':'response_type','value':encodeURIComponent(_0x1818a4[_0x4953('0x17')]('\x20'))},{'key':_0x4953('0x25'),'value':_0x1e32ba['data4']},{'key':_0x4953('0x26'),'value':_0x4953('0x27')},{'key':_0x4953('0x28'),'value':encodeURIComponent(_0x42c116)},{'key':_0x4953('0x29'),'value':_0x370a54},{'key':_0x4953('0x2a'),'value':_0x5779e1},{'key':_0x4953('0x2b'),'value':'login'}];var _0x555ce5=_0x5eb417+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x4953('0x12')](_0x1d4ecf,function(_0x1f3f14){return _0x1f3f14['key']+'='+_0x1f3f14[_0x4953('0x2c')];})[_0x4953('0x17')]('&');_0x1e32ba[_0x4953('0x2d')]={'issuer':_0x5eb417[_0x4953('0x1a')](_0x4953('0x2e'),''),'audience':_0x1e32ba[_0x4953('0x24')],'state':_0x370a54,'nonce':_0x5779e1};redis['set'](_0x370a54,JSON['stringify'](_0x1e32ba));return _0x555ce5;}function isValidIdToken(_0x51715a,_0x2970d1){try{var _0x1e463d=jwt[_0x4953('0x2f')](_0x51715a,{'complete':!![]});var _0x58e29f=_0x1e463d[_0x4953('0x30')];if(_0x58e29f[_0x4953('0x31')]!==_0x2970d1[_0x4953('0x32')])return![];if(_0x58e29f[_0x4953('0x33')]!==_0x2970d1[_0x4953('0x34')])return![];if(_0x58e29f[_0x4953('0x2a')]!==_0x2970d1[_0x4953('0x2a')])return![];if(moment()[_0x4953('0x35')](moment[_0x4953('0x36')](_0x58e29f['exp'])))return![];return!![];}catch(_0x3905f8){throw _0x3905f8;}}function refreshOauth2MicrosoftAccessToken(_0x264e9a){return Promise[_0x4953('0x37')]()['then'](function(){if(_0x264e9a['data3'])return _0x264e9a;return db[_0x4953('0x38')][_0x4953('0x39')]({'where':{'id':_0x264e9a['id']},'raw':!![]});})[_0x4953('0x3a')](function(_0x27363c){var _0x5f10d3={'grant_type':'refresh_token','refresh_token':_0x27363c[_0x4953('0x3b')],'scope':getAccessTokenScope(_0x27363c),'redirect_uri':_0x27363c[_0x4953('0x3c')],'client_id':_0x27363c[_0x4953('0x24')],'client_secret':encryptor['decryptString'](_0x27363c['data3'])};var _0x1918e9={'method':_0x4953('0x3d'),'uri':MICROSOFT_AUTH_URL[_0x4953('0x1a')](_0x4953('0x3e'),_0x27363c['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5f10d3,'json':!![]};return rp(_0x1918e9);})[_0x4953('0x3a')](function(_0x5758dc){_0x264e9a[_0x4953('0x3f')]=_0x5758dc[_0x4953('0x40')];_0x264e9a[_0x4953('0x3b')]=_0x5758dc[_0x4953('0x41')];return db[_0x4953('0x38')][_0x4953('0x42')]({'data5':_0x264e9a[_0x4953('0x3f')],'data6':_0x264e9a[_0x4953('0x3b')]},{'where':{'id':_0x264e9a['id']}});})[_0x4953('0x3a')](function(){return _0x264e9a;})['catch'](function(_0x4cbfef){logger[_0x4953('0x43')](_0x4953('0x44'),_0x264e9a['id'],_0x4cbfef);});}function getOauth2MicrosoftAccessToken(_0xde43c0,_0x2a6223){var _0x17c9cf={'grant_type':_0x4953('0x45'),'code':_0xde43c0,'scope':getAccessTokenScope(_0x2a6223),'redirect_uri':_0x2a6223[_0x4953('0x3c')],'client_id':_0x2a6223['data1'],'client_secret':encryptor['decryptString'](_0x2a6223['data3'])};var _0x4b792a={'method':_0x4953('0x3d'),'uri':MICROSOFT_AUTH_URL[_0x4953('0x1a')](_0x4953('0x3e'),_0x2a6223[_0x4953('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x17c9cf,'json':!![]};return rp(_0x4b792a);}function startRefreshInterval(_0x51d559){var _0x5ac87f=schedule[_0x4953('0x46')];if(_0x5ac87f[_0x51d559['id']])clearInterval(_0x5ac87f[_0x51d559['id']]);_0x5ac87f[_0x51d559['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x51d559['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x4953('0x46')]=_0x5ac87f;}function startAllRefreshIntervals(){return db[_0x4953('0x38')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x4953('0x3a')](function(_0x30f4bd){var _0x3b405e=_0x30f4bd[_0x4953('0x12')](function(_0x16e246){return refreshOauth2MicrosoftAccessToken(_0x16e246)[_0x4953('0x3a')](function(_0x54ca12){startRefreshInterval(_0x54ca12);});});return Promise['all'](_0x3b405e);})[_0x4953('0x47')](function(_0x51087c){var _0x59c809=_0x51087c?util[_0x4953('0x48')](_0x51087c,{'showHidden':![],'depth':null}):'';logger[_0x4953('0x43')](_0x4953('0x49'),_0x59c809);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 283250f..766a923 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 _0x6d11=['message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','CloudProvider,\x20%s,\x20%s','debug','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x47c1f2,_0x234b80){var _0x29ec31=function(_0x3c57a1){while(--_0x3c57a1){_0x47c1f2['push'](_0x47c1f2['shift']());}};_0x29ec31(++_0x234b80);}(_0x6d11,0xbf));var _0x16d1=function(_0x47baed,_0x55d257){_0x47baed=_0x47baed-0x0;var _0x32cd90=_0x6d11[_0x47baed];return _0x32cd90;};'use strict';var _=require(_0x16d1('0x0'));var util=require(_0x16d1('0x1'));var moment=require(_0x16d1('0x2'));var BPromise=require('bluebird');var rs=require(_0x16d1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x16d1('0x4'))['db'];var utils=require(_0x16d1('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x16d1('0x6'));var jayson=require(_0x16d1('0x7'));var client=jayson[_0x16d1('0x8')][_0x16d1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1009dc,_0x150217,_0x19390d){return new BPromise(function(_0x5d0e3f,_0x58a7a2){return client['request'](_0x1009dc,_0x19390d)[_0x16d1('0xa')](function(_0xcfbb15){logger[_0x16d1('0xb')](_0x16d1('0xc'),_0x150217,'request\x20sent');logger[_0x16d1('0xd')](_0x16d1('0xe'),_0x150217,_0x16d1('0xf'),JSON[_0x16d1('0x10')](_0xcfbb15));if(_0xcfbb15[_0x16d1('0x11')]){if(_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x12')]===0x1f4){logger[_0x16d1('0x11')]('CloudProvider,\x20%s,\x20%s',_0x150217,_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x13')]);return _0x58a7a2(_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x13')]);}logger[_0x16d1('0x11')]('CloudProvider,\x20%s,\x20%s',_0x150217,_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x13')]);return _0x5d0e3f(_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x13')]);}else{logger[_0x16d1('0xb')](_0x16d1('0xc'),_0x150217,_0x16d1('0xf'));_0x5d0e3f(_0xcfbb15['result'][_0x16d1('0x13')]);}})[_0x16d1('0x14')](function(_0x555b2d){logger['error'](_0x16d1('0xc'),_0x150217,_0x555b2d);_0x58a7a2(_0x555b2d);});});} \ No newline at end of file +var _0xafcd=['debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent'];(function(_0x49b263,_0x1df0c1){var _0x26e630=function(_0x3c5c55){while(--_0x3c5c55){_0x49b263['push'](_0x49b263['shift']());}};_0x26e630(++_0x1df0c1);}(_0xafcd,0x157));var _0xdafc=function(_0x12a04a,_0x4e3d1a){_0x12a04a=_0x12a04a-0x0;var _0x6d5409=_0xafcd[_0x12a04a];return _0x6d5409;};'use strict';var _=require(_0xdafc('0x0'));var util=require(_0xdafc('0x1'));var moment=require(_0xdafc('0x2'));var BPromise=require(_0xdafc('0x3'));var rs=require(_0xdafc('0x4'));var fs=require('fs');var Redis=require(_0xdafc('0x5'));var db=require(_0xdafc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xdafc('0x7'))(_0xdafc('0x8'));var config=require(_0xdafc('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdafc('0xa')][_0xdafc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33adc9,_0x52872c,_0x24f2e7){return new BPromise(function(_0x255125,_0x397db6){return client[_0xdafc('0xc')](_0x33adc9,_0x24f2e7)[_0xdafc('0xd')](function(_0x241787){logger[_0xdafc('0xe')](_0xdafc('0xf'),_0x52872c,_0xdafc('0x10'));logger[_0xdafc('0x11')](_0xdafc('0x12'),_0x52872c,'request\x20sent',JSON['stringify'](_0x241787));if(_0x241787[_0xdafc('0x13')]){if(_0x241787[_0xdafc('0x13')][_0xdafc('0x14')]===0x1f4){logger[_0xdafc('0x13')](_0xdafc('0xf'),_0x52872c,_0x241787['error']['message']);return _0x397db6(_0x241787['error'][_0xdafc('0x15')]);}logger['error'](_0xdafc('0xf'),_0x52872c,_0x241787['error'][_0xdafc('0x15')]);return _0x255125(_0x241787[_0xdafc('0x13')][_0xdafc('0x15')]);}else{logger[_0xdafc('0xe')]('CloudProvider,\x20%s,\x20%s',_0x52872c,'request\x20sent');_0x255125(_0x241787[_0xdafc('0x16')][_0xdafc('0x15')]);}})[_0xdafc('0x17')](function(_0x5bfac1){logger['error'](_0xdafc('0xf'),_0x52872c,_0x5bfac1);_0x397db6(_0x5bfac1);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index b975e88..283cf3f 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','oauth2MicrosoftCallback','express','Router','../../components/auth/service','./cloudProvider.controller','isAuthenticated','index','get','/:id','post','update'];(function(_0x2d643f,_0x335fe6){var _0x23958b=function(_0x17e8fc){while(--_0x17e8fc){_0x2d643f['push'](_0x2d643f['shift']());}};_0x23958b(++_0x335fe6);}(_0xdb28,0x106));var _0x8db2=function(_0x19ccfb,_0x11d76e){_0x19ccfb=_0x19ccfb-0x0;var _0x3450c9=_0xdb28[_0x19ccfb];return _0x3450c9;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['get']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);router[_0x8db2('0x6')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller['show']);router[_0x8db2('0x8')]('/',auth[_0x8db2('0x4')](),controller['create']);router['put'](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0x9')]);router[_0x8db2('0xa')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xb')]);router['get'](_0x8db2('0xc'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xd')]);router['post'](_0x8db2('0xe'),controller[_0x8db2('0xf')]);module['exports']=router; \ No newline at end of file +var _0xadb5=['put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','Router','./cloudProvider.controller','get','isAuthenticated','/:id','post','create'];(function(_0x29a0c9,_0x512058){var _0x173b36=function(_0x462743){while(--_0x462743){_0x29a0c9['push'](_0x29a0c9['shift']());}};_0x173b36(++_0x512058);}(_0xadb5,0xad));var _0x5adb=function(_0x5680de,_0x123826){_0x5680de=_0x5680de-0x0;var _0xf04e55=_0xadb5[_0x5680de];return _0xf04e55;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['index']);router[_0x5adb('0x2')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller['show']);router[_0x5adb('0x5')]('/',auth[_0x5adb('0x3')](),controller[_0x5adb('0x6')]);router[_0x5adb('0x7')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0x8')]);router[_0x5adb('0x9')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0xa')]);router[_0x5adb('0x2')](_0x5adb('0xb'),auth[_0x5adb('0x3')](),controller['oauth2MicrosoftAuthorize']);router['post'](_0x5adb('0xc'),controller[_0x5adb('0xd')]);module[_0x5adb('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 2865a84..0a893eb 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 _0x31a2=['STRING','name','exports'];(function(_0x88eed3,_0x1741d7){var _0xf8b3a6=function(_0xb53a90){while(--_0xb53a90){_0x88eed3['push'](_0x88eed3['shift']());}};_0xf8b3a6(++_0x1741d7);}(_0x31a2,0x1eb));var _0x231a=function(_0x47180d,_0x1f18f3){_0x47180d=_0x47180d-0x0;var _0x2420eb=_0x31a2[_0x47180d];return _0x2420eb;};'use strict';var Sequelize=require('sequelize');module[_0x231a('0x0')]={'name':{'type':Sequelize[_0x231a('0x1')],'unique':_0x231a('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x231a('0x1')]},'companyId':{'type':Sequelize[_0x231a('0x1')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x231a('0x1')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x231a('0x1')]},'city':{'type':Sequelize[_0x231a('0x1')]},'country':{'type':Sequelize[_0x231a('0x1')]},'email':{'type':Sequelize[_0x231a('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x231a('0x1')]},'sPostalCode':{'type':Sequelize[_0x231a('0x1')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x231a('0x1')]},'description':{'type':Sequelize[_0x231a('0x1')]}}; \ No newline at end of file +var _0x1a54=['name','STRING','exports'];(function(_0x644977,_0x40749d){var _0x24c3c1=function(_0x4cbe1){while(--_0x4cbe1){_0x644977['push'](_0x644977['shift']());}};_0x24c3c1(++_0x40749d);}(_0x1a54,0x14f));var _0x41a5=function(_0x272943,_0x2c64f4){_0x272943=_0x272943-0x0;var _0x468f53=_0x1a54[_0x272943];return _0x468f53;};'use strict';var Sequelize=require('sequelize');module[_0x41a5('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x41a5('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x41a5('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x41a5('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x41a5('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x41a5('0x2')]},'postalCode':{'type':Sequelize[_0x41a5('0x2')]},'city':{'type':Sequelize[_0x41a5('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x41a5('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x41a5('0x2')]},'sStreet':{'type':Sequelize[_0x41a5('0x2')]},'sPostalCode':{'type':Sequelize[_0x41a5('0x2')]},'sCity':{'type':Sequelize[_0x41a5('0x2')]},'sCountry':{'type':Sequelize[_0x41a5('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index e726bf2..7d0be51 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 _0xbd47=['lodash','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','then','get','UserProfileResource','error','stack','name','send','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','CmCompany','includeAll','include','findAll','rows','params','filters','options','find','catch','create','body','user','role','Companies','autoAssociation','update','destroy','describe','addContacts','CmContact','ids','omit','rawAttributes','map','getContacts','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbd47,0x12e));var _0x7bd4=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xbd47[_0x36c5b0];return _0xf19333;};'use strict';var emlformat=require(_0x7bd4('0x0'));var rimraf=require(_0x7bd4('0x1'));var zipdir=require(_0x7bd4('0x2'));var jsonpatch=require(_0x7bd4('0x3'));var rp=require(_0x7bd4('0x4'));var moment=require(_0x7bd4('0x5'));var BPromise=require(_0x7bd4('0x6'));var Mustache=require('mustache');var util=require(_0x7bd4('0x7'));var path=require(_0x7bd4('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7bd4('0x9'));var _=require(_0x7bd4('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bd4('0xb'));var deskjs=require(_0x7bd4('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bd4('0xd'));var Redis=require('ioredis');var authService=require(_0x7bd4('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x7bd4('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7bd4('0x10'))('api');var utils=require(_0x7bd4('0x11'));var config=require(_0x7bd4('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x7bd4('0x13'))['db'];function respondWithStatusCode(_0x29100f,_0x29f652){_0x29f652=_0x29f652||0xcc;return function(_0x16f9ea){if(_0x16f9ea){return _0x29100f[_0x7bd4('0x14')](_0x29f652);}return _0x29100f[_0x7bd4('0x15')](_0x29f652)[_0x7bd4('0x16')]();};}function respondWithResult(_0x5b8af6,_0x2c1972){_0x2c1972=_0x2c1972||0xc8;return function(_0xd9fe7a){if(_0xd9fe7a){return _0x5b8af6['status'](_0x2c1972)[_0x7bd4('0x17')](_0xd9fe7a);}};}function respondWithFilteredResult(_0x3f4240,_0x276126){return function(_0x299b50){if(_0x299b50){var _0x2d88cf=typeof _0x276126[_0x7bd4('0x18')]==='undefined'&&typeof _0x276126[_0x7bd4('0x19')]===_0x7bd4('0x1a');var _0x1bbca7=_0x299b50[_0x7bd4('0x1b')];var _0x5efe42=_0x2d88cf?0x0:_0x276126[_0x7bd4('0x18')];var _0x3718f6=_0x2d88cf?_0x299b50['count']:_0x276126[_0x7bd4('0x18')]+_0x276126[_0x7bd4('0x19')];var _0x3cd5b2;if(_0x3718f6>=_0x1bbca7){_0x3718f6=_0x1bbca7;_0x3cd5b2=0xc8;}else{_0x3cd5b2=0xce;}_0x3f4240[_0x7bd4('0x15')](_0x3cd5b2);return _0x3f4240[_0x7bd4('0x1c')]('Content-Range',_0x5efe42+'-'+_0x3718f6+'/'+_0x1bbca7)[_0x7bd4('0x17')](_0x299b50);}return null;};}function patchUpdates(_0x57882c){return function(_0x3f5d39){try{jsonpatch[_0x7bd4('0x1d')](_0x3f5d39,_0x57882c,!![]);}catch(_0x5d8a58){return BPromise['reject'](_0x5d8a58);}return _0x3f5d39[_0x7bd4('0x1e')]();};}function saveUpdates(_0x122c29,_0x175728){return function(_0x57bc83){if(_0x57bc83){return _0x57bc83['update'](_0x122c29)[_0x7bd4('0x1f')](function(_0x3671cd){return _0x3671cd;});}return null;};}function removeEntity(_0x227efd,_0x12964f){return function(_0xf653ad){if(_0xf653ad){return _0xf653ad['destroy']()['then'](function(){var _0x33ff14=_0xf653ad[_0x7bd4('0x20')]({'plain':!![]});var _0x2bfef2='Companies';return db[_0x7bd4('0x21')]['destroy']({'where':{'type':_0x2bfef2,'resourceId':_0x33ff14['id']}})[_0x7bd4('0x1f')](function(){return _0xf653ad;});})[_0x7bd4('0x1f')](function(){_0x227efd[_0x7bd4('0x15')](0xcc)[_0x7bd4('0x16')]();});}};}function handleEntityNotFound(_0x4c531b,_0x452b23){return function(_0x3290e5){if(!_0x3290e5){_0x4c531b[_0x7bd4('0x14')](0x194);}return _0x3290e5;};}function handleError(_0x6e8e0c,_0x149f14){_0x149f14=_0x149f14||0x1f4;return function(_0xba4233){logger[_0x7bd4('0x22')](_0xba4233[_0x7bd4('0x23')]);if(_0xba4233[_0x7bd4('0x24')]){delete _0xba4233['name'];}_0x6e8e0c[_0x7bd4('0x15')](_0x149f14)[_0x7bd4('0x25')](_0xba4233);};}exports['index']=function(_0x255ad0,_0x51902a){var _0x33e28b={},_0x492bf0={},_0x17f4b5={'count':0x0,'rows':[]};return db['CmCompany']['describe']()[_0x7bd4('0x1f')](function(_0x25b772){_0x492bf0[_0x7bd4('0x26')]=_[_0x7bd4('0x27')](_0x25b772);_0x492bf0[_0x7bd4('0x28')]=_['keys'](_0x255ad0[_0x7bd4('0x28')]);_0x492bf0['filters']=_[_0x7bd4('0x29')](_0x492bf0['model'],_0x492bf0['query']);_0x33e28b['attributes']=_['intersection'](_0x492bf0[_0x7bd4('0x26')],qs[_0x7bd4('0x2a')](_0x255ad0[_0x7bd4('0x28')]['fields']));_0x33e28b[_0x7bd4('0x2b')]=_0x33e28b[_0x7bd4('0x2b')][_0x7bd4('0x2c')]?_0x33e28b[_0x7bd4('0x2b')]:_0x492bf0[_0x7bd4('0x26')];if(!_0x255ad0[_0x7bd4('0x28')][_0x7bd4('0x2d')](_0x7bd4('0x2e'))){_0x33e28b[_0x7bd4('0x19')]=qs['limit'](_0x255ad0[_0x7bd4('0x28')][_0x7bd4('0x19')]);_0x33e28b[_0x7bd4('0x18')]=qs[_0x7bd4('0x18')](_0x255ad0[_0x7bd4('0x28')][_0x7bd4('0x18')]);}_0x33e28b['order']=qs['sort'](_0x255ad0[_0x7bd4('0x28')][_0x7bd4('0x2f')]);_0x33e28b[_0x7bd4('0x30')]=qs['filters'](_[_0x7bd4('0x31')](_0x255ad0[_0x7bd4('0x28')],_0x492bf0['filters']),_0x25b772);if(_0x255ad0[_0x7bd4('0x28')][_0x7bd4('0x32')]){_0x33e28b[_0x7bd4('0x30')]=_[_0x7bd4('0x33')](_0x33e28b[_0x7bd4('0x30')],{'$or':_['map'](_0x33e28b[_0x7bd4('0x2b')],function(_0x484f6c){var _0x2f71cb={};_0x2f71cb[_0x484f6c]={'$like':'%'+_0x255ad0[_0x7bd4('0x28')]['filter']+'%'};return _0x2f71cb;})});}_0x33e28b=_['merge']({},_0x33e28b,_0x255ad0['options']);var _0x4ed8e0={'where':_0x33e28b[_0x7bd4('0x30')]};return db[_0x7bd4('0x34')][_0x7bd4('0x1b')](_0x4ed8e0)['then'](function(_0x51c550){_0x17f4b5[_0x7bd4('0x1b')]=_0x51c550;if(_0x255ad0[_0x7bd4('0x28')][_0x7bd4('0x35')]){_0x33e28b[_0x7bd4('0x36')]=[{'all':!![]}];}return db['CmCompany'][_0x7bd4('0x37')](_0x33e28b);})[_0x7bd4('0x1f')](function(_0x587c7e){_0x17f4b5[_0x7bd4('0x38')]=_0x587c7e;return _0x17f4b5;})[_0x7bd4('0x1f')](respondWithFilteredResult(_0x51902a,_0x33e28b))['catch'](handleError(_0x51902a,null));})['catch'](handleError(_0x51902a,null));};exports['show']=function(_0x2634da,_0x853c1){var _0x2cf33a={'raw':![],'where':{'id':_0x2634da[_0x7bd4('0x39')]['id']}},_0x4b496e={};_0x4b496e[_0x7bd4('0x26')]=_[_0x7bd4('0x27')](db[_0x7bd4('0x34')]['rawAttributes']);_0x4b496e[_0x7bd4('0x28')]=_[_0x7bd4('0x27')](_0x2634da[_0x7bd4('0x28')]);_0x4b496e[_0x7bd4('0x3a')]=_[_0x7bd4('0x29')](_0x4b496e[_0x7bd4('0x26')],_0x4b496e[_0x7bd4('0x28')]);_0x2cf33a[_0x7bd4('0x2b')]=_[_0x7bd4('0x29')](_0x4b496e['model'],qs[_0x7bd4('0x2a')](_0x2634da[_0x7bd4('0x28')][_0x7bd4('0x2a')]));_0x2cf33a[_0x7bd4('0x2b')]=_0x2cf33a['attributes'][_0x7bd4('0x2c')]?_0x2cf33a[_0x7bd4('0x2b')]:_0x4b496e[_0x7bd4('0x26')];if(_0x2634da[_0x7bd4('0x28')][_0x7bd4('0x35')]){_0x2cf33a[_0x7bd4('0x36')]=[{'all':!![]}];}_0x2cf33a=_[_0x7bd4('0x33')]({},_0x2cf33a,_0x2634da[_0x7bd4('0x3b')]);return db[_0x7bd4('0x34')][_0x7bd4('0x3c')](_0x2cf33a)[_0x7bd4('0x1f')](handleEntityNotFound(_0x853c1,null))['then'](respondWithResult(_0x853c1,null))[_0x7bd4('0x3d')](handleError(_0x853c1,null));};exports[_0x7bd4('0x3e')]=function(_0xff545b,_0x9b4dae){return db['CmCompany'][_0x7bd4('0x3e')](_0xff545b[_0x7bd4('0x3f')],{})['then'](function(_0x5b69e6){var _0x428b6e=_0xff545b[_0x7bd4('0x40')][_0x7bd4('0x20')]({'plain':!![]});if(!_0x428b6e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x428b6e[_0x7bd4('0x41')]===_0x7bd4('0x40')){var _0x1b5308=_0x5b69e6[_0x7bd4('0x20')]({'plain':!![]});var _0x189550=_0x7bd4('0x42');return db['UserProfileSection'][_0x7bd4('0x3c')]({'where':{'name':_0x189550,'userProfileId':_0x428b6e['userProfileId']},'raw':!![]})[_0x7bd4('0x1f')](function(_0x368118){if(_0x368118&&_0x368118[_0x7bd4('0x43')]===0x0){return db[_0x7bd4('0x21')]['create']({'name':_0x1b5308[_0x7bd4('0x24')],'resourceId':_0x1b5308['id'],'type':_0x368118['name'],'sectionId':_0x368118['id']},{})[_0x7bd4('0x1f')](function(){return _0x5b69e6;});}else{return _0x5b69e6;}})[_0x7bd4('0x3d')](function(_0x46b7e1){logger[_0x7bd4('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x46b7e1);throw _0x46b7e1;});}return _0x5b69e6;})[_0x7bd4('0x1f')](respondWithResult(_0x9b4dae,0xc9))[_0x7bd4('0x3d')](handleError(_0x9b4dae,null));};exports[_0x7bd4('0x44')]=function(_0x189063,_0x119dc5){if(_0x189063[_0x7bd4('0x3f')]['id']){delete _0x189063[_0x7bd4('0x3f')]['id'];}return db[_0x7bd4('0x34')][_0x7bd4('0x3c')]({'where':{'id':_0x189063[_0x7bd4('0x39')]['id']}})[_0x7bd4('0x1f')](handleEntityNotFound(_0x119dc5,null))[_0x7bd4('0x1f')](saveUpdates(_0x189063[_0x7bd4('0x3f')],null))['then'](respondWithResult(_0x119dc5,null))[_0x7bd4('0x3d')](handleError(_0x119dc5,null));};exports[_0x7bd4('0x45')]=function(_0x7da01a,_0x125116){return db[_0x7bd4('0x34')][_0x7bd4('0x3c')]({'where':{'id':_0x7da01a[_0x7bd4('0x39')]['id']}})['then'](handleEntityNotFound(_0x125116,null))['then'](removeEntity(_0x125116,null))[_0x7bd4('0x3d')](handleError(_0x125116,null));};exports[_0x7bd4('0x46')]=function(_0x567a74,_0x1e0d2c){return db[_0x7bd4('0x34')]['describe']()['then'](respondWithResult(_0x1e0d2c,null))[_0x7bd4('0x3d')](handleError(_0x1e0d2c,null));};exports[_0x7bd4('0x47')]=function(_0x5c96f1,_0x5ce460,_0x107a7b){return db[_0x7bd4('0x48')][_0x7bd4('0x3c')]({'where':{'id':_0x5c96f1['params']['id']}})['then'](handleEntityNotFound(_0x5ce460,null))[_0x7bd4('0x1f')](function(_0xf50d73){if(_0xf50d73){return _0xf50d73[_0x7bd4('0x47')](_0x5c96f1[_0x7bd4('0x3f')][_0x7bd4('0x49')],_[_0x7bd4('0x4a')](_0x5c96f1[_0x7bd4('0x3f')],[_0x7bd4('0x49'),'id'])||{});}})['then'](respondWithResult(_0x5ce460,null))['catch'](handleError(_0x5ce460,null));};exports['getContacts']=function(_0x56d4b0,_0x2aeba5,_0x28c2ce){var _0xb21434={};var _0xb7aa75={};var _0x7c3398;var _0x5a86ba;return db[_0x7bd4('0x34')]['findOne']({'where':{'id':_0x56d4b0[_0x7bd4('0x39')]['id']}})[_0x7bd4('0x1f')](handleEntityNotFound(_0x2aeba5,null))['then'](function(_0x5aa75b){if(_0x5aa75b){_0x7c3398=_0x5aa75b;_0xb7aa75['model']=_['keys'](db['CmContact'][_0x7bd4('0x4b')]);_0xb7aa75[_0x7bd4('0x28')]=_['keys'](_0x56d4b0['query']);_0xb7aa75[_0x7bd4('0x3a')]=_[_0x7bd4('0x29')](_0xb7aa75[_0x7bd4('0x26')],_0xb7aa75[_0x7bd4('0x28')]);_0xb21434['attributes']=_['intersection'](_0xb7aa75[_0x7bd4('0x26')],qs[_0x7bd4('0x2a')](_0x56d4b0[_0x7bd4('0x28')][_0x7bd4('0x2a')]));_0xb21434['attributes']=_0xb21434[_0x7bd4('0x2b')][_0x7bd4('0x2c')]?_0xb21434[_0x7bd4('0x2b')]:_0xb7aa75[_0x7bd4('0x26')];_0xb21434['order']=qs[_0x7bd4('0x2f')](_0x56d4b0[_0x7bd4('0x28')]['sort']);_0xb21434['where']=qs[_0x7bd4('0x3a')](_[_0x7bd4('0x31')](_0x56d4b0[_0x7bd4('0x28')],_0xb7aa75['filters']));if(_0x56d4b0[_0x7bd4('0x28')]['filter']){_0xb21434[_0x7bd4('0x30')]=_['merge'](_0xb21434[_0x7bd4('0x30')],{'$or':_[_0x7bd4('0x4c')](_0xb21434[_0x7bd4('0x2b')],function(_0x478a1e){var _0x4a9673={};_0x4a9673[_0x478a1e]={'$like':'%'+_0x56d4b0['query']['filter']+'%'};return _0x4a9673;})});}_0xb21434=_[_0x7bd4('0x33')]({},_0xb21434,_0x56d4b0[_0x7bd4('0x3b')]);return _0x7c3398['getContacts'](_0xb21434);}})[_0x7bd4('0x1f')](function(_0x2b1d73){if(_0x2b1d73){_0x5a86ba=_0x2b1d73[_0x7bd4('0x2c')];if(!_0x56d4b0[_0x7bd4('0x28')][_0x7bd4('0x2d')](_0x7bd4('0x2e'))){_0xb21434[_0x7bd4('0x19')]=qs['limit'](_0x56d4b0[_0x7bd4('0x28')]['limit']);_0xb21434[_0x7bd4('0x18')]=qs['offset'](_0x56d4b0[_0x7bd4('0x28')][_0x7bd4('0x18')]);}return _0x7c3398[_0x7bd4('0x4d')](_0xb21434);}})[_0x7bd4('0x1f')](function(_0x1ce5ee){if(_0x1ce5ee){return _0x1ce5ee?{'count':_0x5a86ba,'rows':_0x1ce5ee}:null;}})[_0x7bd4('0x1f')](respondWithResult(_0x2aeba5,null))['catch'](handleError(_0x2aeba5,null));}; \ No newline at end of file +var _0xa2fc=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','catch','error','body','addContacts','omit','ids','getContacts','findOne','CmContact','eml-format','zip-dir','request-promise','moment','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','Companies','UserProfileResource','name','send','index','CmCompany','describe','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','filter','includeAll','findAll','rows','show','params','rawAttributes','include','find','create'];(function(_0x1912fa,_0xb6bfa7){var _0x262a5c=function(_0xd6f3b6){while(--_0xd6f3b6){_0x1912fa['push'](_0x1912fa['shift']());}};_0x262a5c(++_0xb6bfa7);}(_0xa2fc,0x16d));var _0xca2f=function(_0x3fc97b,_0x20ca29){_0x3fc97b=_0x3fc97b-0x0;var _0x3a0c82=_0xa2fc[_0x3fc97b];return _0x3a0c82;};'use strict';var emlformat=require(_0xca2f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xca2f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xca2f('0x2'));var moment=require(_0xca2f('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xca2f('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xca2f('0x5'));var ejs=require(_0xca2f('0x6'));var fs=require('fs');var fs_extra=require(_0xca2f('0x7'));var _=require(_0xca2f('0x8'));var squel=require(_0xca2f('0x9'));var crypto=require('crypto');var jsforce=require(_0xca2f('0xa'));var deskjs=require(_0xca2f('0xb'));var toCsv=require(_0xca2f('0x5'));var querystring=require(_0xca2f('0xc'));var Papa=require(_0xca2f('0xd'));var Redis=require(_0xca2f('0xe'));var authService=require(_0xca2f('0xf'));var qs=require(_0xca2f('0x10'));var as=require(_0xca2f('0x11'));var hardwareService=require(_0xca2f('0x12'));var logger=require(_0xca2f('0x13'))(_0xca2f('0x14'));var utils=require(_0xca2f('0x15'));var config=require(_0xca2f('0x16'));var licenseUtil=require(_0xca2f('0x17'));var db=require(_0xca2f('0x18'))['db'];function respondWithStatusCode(_0x41c274,_0x536556){_0x536556=_0x536556||0xcc;return function(_0x297755){if(_0x297755){return _0x41c274[_0xca2f('0x19')](_0x536556);}return _0x41c274['status'](_0x536556)[_0xca2f('0x1a')]();};}function respondWithResult(_0x2711fa,_0x378253){_0x378253=_0x378253||0xc8;return function(_0x4dbd71){if(_0x4dbd71){return _0x2711fa[_0xca2f('0x1b')](_0x378253)[_0xca2f('0x1c')](_0x4dbd71);}};}function respondWithFilteredResult(_0x1942fd,_0x2ee0d7){return function(_0xbc46b5){if(_0xbc46b5){var _0x342887=typeof _0x2ee0d7[_0xca2f('0x1d')]===_0xca2f('0x1e')&&typeof _0x2ee0d7[_0xca2f('0x1f')]===_0xca2f('0x1e');var _0x3b9b95=_0xbc46b5[_0xca2f('0x20')];var _0x1e0921=_0x342887?0x0:_0x2ee0d7[_0xca2f('0x1d')];var _0x30db90=_0x342887?_0xbc46b5['count']:_0x2ee0d7['offset']+_0x2ee0d7[_0xca2f('0x1f')];var _0x46885f;if(_0x30db90>=_0x3b9b95){_0x30db90=_0x3b9b95;_0x46885f=0xc8;}else{_0x46885f=0xce;}_0x1942fd[_0xca2f('0x1b')](_0x46885f);return _0x1942fd[_0xca2f('0x21')](_0xca2f('0x22'),_0x1e0921+'-'+_0x30db90+'/'+_0x3b9b95)[_0xca2f('0x1c')](_0xbc46b5);}return null;};}function patchUpdates(_0x202461){return function(_0x1c1e3f){try{jsonpatch[_0xca2f('0x23')](_0x1c1e3f,_0x202461,!![]);}catch(_0x2337b4){return BPromise[_0xca2f('0x24')](_0x2337b4);}return _0x1c1e3f[_0xca2f('0x25')]();};}function saveUpdates(_0x5c4869,_0x459dd0){return function(_0x31fb53){if(_0x31fb53){return _0x31fb53[_0xca2f('0x26')](_0x5c4869)['then'](function(_0x2b8645){return _0x2b8645;});}return null;};}function removeEntity(_0xbdf308,_0x48b4d5){return function(_0x252f94){if(_0x252f94){return _0x252f94[_0xca2f('0x27')]()[_0xca2f('0x28')](function(){var _0x4355d7=_0x252f94[_0xca2f('0x29')]({'plain':!![]});var _0x13de45=_0xca2f('0x2a');return db[_0xca2f('0x2b')]['destroy']({'where':{'type':_0x13de45,'resourceId':_0x4355d7['id']}})[_0xca2f('0x28')](function(){return _0x252f94;});})[_0xca2f('0x28')](function(){_0xbdf308['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x34b38a,_0x43c681){return function(_0x3ec5e8){if(!_0x3ec5e8){_0x34b38a[_0xca2f('0x19')](0x194);}return _0x3ec5e8;};}function handleError(_0x30b513,_0xcd4a2d){_0xcd4a2d=_0xcd4a2d||0x1f4;return function(_0x13bd4f){logger['error'](_0x13bd4f['stack']);if(_0x13bd4f[_0xca2f('0x2c')]){delete _0x13bd4f[_0xca2f('0x2c')];}_0x30b513['status'](_0xcd4a2d)[_0xca2f('0x2d')](_0x13bd4f);};}exports[_0xca2f('0x2e')]=function(_0x5c27ef,_0x2584b8){var _0x42da9a={},_0x2dc739={},_0x597f79={'count':0x0,'rows':[]};return db[_0xca2f('0x2f')][_0xca2f('0x30')]()[_0xca2f('0x28')](function(_0x2e6bb4){_0x2dc739[_0xca2f('0x31')]=_[_0xca2f('0x32')](_0x2e6bb4);_0x2dc739[_0xca2f('0x33')]=_[_0xca2f('0x32')](_0x5c27ef[_0xca2f('0x33')]);_0x2dc739[_0xca2f('0x34')]=_['intersection'](_0x2dc739[_0xca2f('0x31')],_0x2dc739[_0xca2f('0x33')]);_0x42da9a[_0xca2f('0x35')]=_[_0xca2f('0x36')](_0x2dc739['model'],qs['fields'](_0x5c27ef['query'][_0xca2f('0x37')]));_0x42da9a[_0xca2f('0x35')]=_0x42da9a[_0xca2f('0x35')][_0xca2f('0x38')]?_0x42da9a[_0xca2f('0x35')]:_0x2dc739[_0xca2f('0x31')];if(!_0x5c27ef[_0xca2f('0x33')][_0xca2f('0x39')](_0xca2f('0x3a'))){_0x42da9a[_0xca2f('0x1f')]=qs[_0xca2f('0x1f')](_0x5c27ef[_0xca2f('0x33')]['limit']);_0x42da9a[_0xca2f('0x1d')]=qs['offset'](_0x5c27ef[_0xca2f('0x33')][_0xca2f('0x1d')]);}_0x42da9a[_0xca2f('0x3b')]=qs[_0xca2f('0x3c')](_0x5c27ef[_0xca2f('0x33')][_0xca2f('0x3c')]);_0x42da9a[_0xca2f('0x3d')]=qs[_0xca2f('0x34')](_[_0xca2f('0x3e')](_0x5c27ef[_0xca2f('0x33')],_0x2dc739[_0xca2f('0x34')]),_0x2e6bb4);if(_0x5c27ef[_0xca2f('0x33')]['filter']){_0x42da9a[_0xca2f('0x3d')]=_[_0xca2f('0x3f')](_0x42da9a['where'],{'$or':_[_0xca2f('0x40')](_0x42da9a[_0xca2f('0x35')],function(_0xae4faf){var _0xae4727={};_0xae4727[_0xae4faf]={'$like':'%'+_0x5c27ef[_0xca2f('0x33')][_0xca2f('0x41')]+'%'};return _0xae4727;})});}_0x42da9a=_['merge']({},_0x42da9a,_0x5c27ef['options']);var _0x5d6c20={'where':_0x42da9a['where']};return db['CmCompany']['count'](_0x5d6c20)[_0xca2f('0x28')](function(_0x4e5d5e){_0x597f79[_0xca2f('0x20')]=_0x4e5d5e;if(_0x5c27ef[_0xca2f('0x33')][_0xca2f('0x42')]){_0x42da9a['include']=[{'all':!![]}];}return db[_0xca2f('0x2f')][_0xca2f('0x43')](_0x42da9a);})[_0xca2f('0x28')](function(_0x49e636){_0x597f79[_0xca2f('0x44')]=_0x49e636;return _0x597f79;})['then'](respondWithFilteredResult(_0x2584b8,_0x42da9a))['catch'](handleError(_0x2584b8,null));})['catch'](handleError(_0x2584b8,null));};exports[_0xca2f('0x45')]=function(_0x5752b7,_0xe50861){var _0x28e5b0={'raw':![],'where':{'id':_0x5752b7[_0xca2f('0x46')]['id']}},_0x14df3a={};_0x14df3a['model']=_[_0xca2f('0x32')](db['CmCompany'][_0xca2f('0x47')]);_0x14df3a[_0xca2f('0x33')]=_['keys'](_0x5752b7[_0xca2f('0x33')]);_0x14df3a[_0xca2f('0x34')]=_[_0xca2f('0x36')](_0x14df3a[_0xca2f('0x31')],_0x14df3a[_0xca2f('0x33')]);_0x28e5b0[_0xca2f('0x35')]=_[_0xca2f('0x36')](_0x14df3a[_0xca2f('0x31')],qs[_0xca2f('0x37')](_0x5752b7[_0xca2f('0x33')]['fields']));_0x28e5b0[_0xca2f('0x35')]=_0x28e5b0[_0xca2f('0x35')]['length']?_0x28e5b0[_0xca2f('0x35')]:_0x14df3a[_0xca2f('0x31')];if(_0x5752b7['query'][_0xca2f('0x42')]){_0x28e5b0[_0xca2f('0x48')]=[{'all':!![]}];}_0x28e5b0=_[_0xca2f('0x3f')]({},_0x28e5b0,_0x5752b7['options']);return db[_0xca2f('0x2f')][_0xca2f('0x49')](_0x28e5b0)['then'](handleEntityNotFound(_0xe50861,null))['then'](respondWithResult(_0xe50861,null))['catch'](handleError(_0xe50861,null));};exports[_0xca2f('0x4a')]=function(_0x5ec77a,_0x28e414){return db[_0xca2f('0x2f')][_0xca2f('0x4a')](_0x5ec77a['body'],{})[_0xca2f('0x28')](function(_0x1b6716){var _0x282e84=_0x5ec77a[_0xca2f('0x4b')][_0xca2f('0x29')]({'plain':!![]});if(!_0x282e84)throw new Error(_0xca2f('0x4c'));if(_0x282e84['role']===_0xca2f('0x4b')){var _0x4c7536=_0x1b6716[_0xca2f('0x29')]({'plain':!![]});var _0x4401ba=_0xca2f('0x2a');return db[_0xca2f('0x4d')][_0xca2f('0x49')]({'where':{'name':_0x4401ba,'userProfileId':_0x282e84[_0xca2f('0x4e')]},'raw':!![]})[_0xca2f('0x28')](function(_0x28796a){if(_0x28796a&&_0x28796a['autoAssociation']===0x0){return db[_0xca2f('0x2b')]['create']({'name':_0x4c7536['name'],'resourceId':_0x4c7536['id'],'type':_0x28796a[_0xca2f('0x2c')],'sectionId':_0x28796a['id']},{})[_0xca2f('0x28')](function(){return _0x1b6716;});}else{return _0x1b6716;}})[_0xca2f('0x4f')](function(_0x1069fe){logger[_0xca2f('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1069fe);throw _0x1069fe;});}return _0x1b6716;})[_0xca2f('0x28')](respondWithResult(_0x28e414,0xc9))[_0xca2f('0x4f')](handleError(_0x28e414,null));};exports[_0xca2f('0x26')]=function(_0x50415a,_0x3cc3ff){if(_0x50415a[_0xca2f('0x51')]['id']){delete _0x50415a[_0xca2f('0x51')]['id'];}return db[_0xca2f('0x2f')][_0xca2f('0x49')]({'where':{'id':_0x50415a[_0xca2f('0x46')]['id']}})['then'](handleEntityNotFound(_0x3cc3ff,null))[_0xca2f('0x28')](saveUpdates(_0x50415a[_0xca2f('0x51')],null))['then'](respondWithResult(_0x3cc3ff,null))[_0xca2f('0x4f')](handleError(_0x3cc3ff,null));};exports[_0xca2f('0x27')]=function(_0x417dab,_0xb329aa){return db['CmCompany'][_0xca2f('0x49')]({'where':{'id':_0x417dab['params']['id']}})[_0xca2f('0x28')](handleEntityNotFound(_0xb329aa,null))[_0xca2f('0x28')](removeEntity(_0xb329aa,null))[_0xca2f('0x4f')](handleError(_0xb329aa,null));};exports[_0xca2f('0x30')]=function(_0x53890f,_0x153daa){return db['CmCompany']['describe']()[_0xca2f('0x28')](respondWithResult(_0x153daa,null))[_0xca2f('0x4f')](handleError(_0x153daa,null));};exports[_0xca2f('0x52')]=function(_0x1d14a4,_0x362e60,_0x356843){return db['CmContact'][_0xca2f('0x49')]({'where':{'id':_0x1d14a4[_0xca2f('0x46')]['id']}})[_0xca2f('0x28')](handleEntityNotFound(_0x362e60,null))[_0xca2f('0x28')](function(_0x22dba5){if(_0x22dba5){return _0x22dba5[_0xca2f('0x52')](_0x1d14a4[_0xca2f('0x51')]['ids'],_[_0xca2f('0x53')](_0x1d14a4[_0xca2f('0x51')],[_0xca2f('0x54'),'id'])||{});}})[_0xca2f('0x28')](respondWithResult(_0x362e60,null))[_0xca2f('0x4f')](handleError(_0x362e60,null));};exports[_0xca2f('0x55')]=function(_0x3d0bdc,_0x1abfb2,_0x1f869a){var _0x109ece={};var _0x17a827={};var _0x59a954;var _0x3d53fa;return db[_0xca2f('0x2f')][_0xca2f('0x56')]({'where':{'id':_0x3d0bdc[_0xca2f('0x46')]['id']}})[_0xca2f('0x28')](handleEntityNotFound(_0x1abfb2,null))['then'](function(_0x5daab2){if(_0x5daab2){_0x59a954=_0x5daab2;_0x17a827['model']=_[_0xca2f('0x32')](db[_0xca2f('0x57')]['rawAttributes']);_0x17a827['query']=_[_0xca2f('0x32')](_0x3d0bdc[_0xca2f('0x33')]);_0x17a827[_0xca2f('0x34')]=_[_0xca2f('0x36')](_0x17a827[_0xca2f('0x31')],_0x17a827[_0xca2f('0x33')]);_0x109ece[_0xca2f('0x35')]=_[_0xca2f('0x36')](_0x17a827['model'],qs[_0xca2f('0x37')](_0x3d0bdc[_0xca2f('0x33')][_0xca2f('0x37')]));_0x109ece['attributes']=_0x109ece[_0xca2f('0x35')][_0xca2f('0x38')]?_0x109ece[_0xca2f('0x35')]:_0x17a827['model'];_0x109ece[_0xca2f('0x3b')]=qs[_0xca2f('0x3c')](_0x3d0bdc[_0xca2f('0x33')][_0xca2f('0x3c')]);_0x109ece[_0xca2f('0x3d')]=qs[_0xca2f('0x34')](_[_0xca2f('0x3e')](_0x3d0bdc[_0xca2f('0x33')],_0x17a827[_0xca2f('0x34')]));if(_0x3d0bdc['query'][_0xca2f('0x41')]){_0x109ece['where']=_['merge'](_0x109ece[_0xca2f('0x3d')],{'$or':_[_0xca2f('0x40')](_0x109ece[_0xca2f('0x35')],function(_0x3fd5c6){var _0x441bc8={};_0x441bc8[_0x3fd5c6]={'$like':'%'+_0x3d0bdc[_0xca2f('0x33')][_0xca2f('0x41')]+'%'};return _0x441bc8;})});}_0x109ece=_[_0xca2f('0x3f')]({},_0x109ece,_0x3d0bdc['options']);return _0x59a954[_0xca2f('0x55')](_0x109ece);}})[_0xca2f('0x28')](function(_0x1441ff){if(_0x1441ff){_0x3d53fa=_0x1441ff[_0xca2f('0x38')];if(!_0x3d0bdc['query'][_0xca2f('0x39')](_0xca2f('0x3a'))){_0x109ece[_0xca2f('0x1f')]=qs[_0xca2f('0x1f')](_0x3d0bdc[_0xca2f('0x33')]['limit']);_0x109ece['offset']=qs[_0xca2f('0x1d')](_0x3d0bdc[_0xca2f('0x33')][_0xca2f('0x1d')]);}return _0x59a954[_0xca2f('0x55')](_0x109ece);}})[_0xca2f('0x28')](function(_0x1fa899){if(_0x1fa899){return _0x1fa899?{'count':_0x3d53fa,'rows':_0x1fa899}:null;}})[_0xca2f('0x28')](respondWithResult(_0x1abfb2,null))[_0xca2f('0x4f')](handleError(_0x1abfb2,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index bde2e3a..a6828eb 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 _0x8e6c=['./cmCompany.attributes','exports','define','CmCompany','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x3a439c,_0x29004f){var _0x1dda96=function(_0x29e6c7){while(--_0x29e6c7){_0x3a439c['push'](_0x3a439c['shift']());}};_0x1dda96(++_0x29004f);}(_0x8e6c,0xf6));var _0xc8e6=function(_0x4fa17f,_0x285b13){_0x4fa17f=_0x4fa17f-0x0;var _0x843bd8=_0x8e6c[_0x4fa17f];return _0x843bd8;};'use strict';var _=require('lodash');var util=require(_0xc8e6('0x0'));var logger=require(_0xc8e6('0x1'))(_0xc8e6('0x2'));var moment=require(_0xc8e6('0x3'));var BPromise=require(_0xc8e6('0x4'));var rp=require(_0xc8e6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc8e6('0x6'));var attributes=require(_0xc8e6('0x7'));module[_0xc8e6('0x8')]=function(_0x4fe700,_0x55005d){return _0x4fe700[_0xc8e6('0x9')](_0xc8e6('0xa'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9516=['cm_companies','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cmCompany.attributes','define'];(function(_0x3b9771,_0x2dfe72){var _0x16b062=function(_0x5d3d92){while(--_0x5d3d92){_0x3b9771['push'](_0x3b9771['shift']());}};_0x16b062(++_0x2dfe72);}(_0x9516,0x1ed));var _0x6951=function(_0x4024bd,_0x164def){_0x4024bd=_0x4024bd-0x0;var _0x5cbe79=_0x9516[_0x4024bd];return _0x5cbe79;};'use strict';var _=require(_0x6951('0x0'));var util=require(_0x6951('0x1'));var logger=require(_0x6951('0x2'))(_0x6951('0x3'));var moment=require(_0x6951('0x4'));var BPromise=require(_0x6951('0x5'));var rp=require(_0x6951('0x6'));var fs=require('fs');var path=require(_0x6951('0x7'));var rimraf=require('rimraf');var config=require(_0x6951('0x8'));var attributes=require(_0x6951('0x9'));module['exports']=function(_0x25654c,_0x550802){return _0x25654c[_0x6951('0xa')]('CmCompany',attributes,{'tableName':_0x6951('0xb'),'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 cc2f359..60d78cb 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 _0x360e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCompany,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x412041,_0x2d16aa){var _0x274fe2=function(_0x3f7578){while(--_0x3f7578){_0x412041['push'](_0x412041['shift']());}};_0x274fe2(++_0x2d16aa);}(_0x360e,0x64));var _0xe360=function(_0x4970d6,_0x2e6b07){_0x4970d6=_0x4970d6-0x0;var _0x2857f3=_0x360e[_0x4970d6];return _0x2857f3;};'use strict';var _=require(_0xe360('0x0'));var util=require(_0xe360('0x1'));var moment=require(_0xe360('0x2'));var BPromise=require(_0xe360('0x3'));var rs=require(_0xe360('0x4'));var fs=require('fs');var Redis=require(_0xe360('0x5'));var db=require(_0xe360('0x6'))['db'];var utils=require(_0xe360('0x7'));var logger=require(_0xe360('0x8'))(_0xe360('0x9'));var config=require(_0xe360('0xa'));var jayson=require(_0xe360('0xb'));var client=jayson[_0xe360('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4923e5,_0x4df28d,_0x2292e2){return new BPromise(function(_0x473efb,_0x1d8f3b){return client[_0xe360('0xd')](_0x4923e5,_0x2292e2)[_0xe360('0xe')](function(_0xd93048){logger[_0xe360('0xf')]('CmCompany,\x20%s,\x20%s',_0x4df28d,_0xe360('0x10'));logger[_0xe360('0x11')](_0xe360('0x12'),_0x4df28d,_0xe360('0x10'),JSON[_0xe360('0x13')](_0xd93048));if(_0xd93048['error']){if(_0xd93048[_0xe360('0x14')][_0xe360('0x15')]===0x1f4){logger[_0xe360('0x14')](_0xe360('0x16'),_0x4df28d,_0xd93048['error']['message']);return _0x1d8f3b(_0xd93048['error'][_0xe360('0x17')]);}logger[_0xe360('0x14')](_0xe360('0x16'),_0x4df28d,_0xd93048['error'][_0xe360('0x17')]);return _0x473efb(_0xd93048[_0xe360('0x14')][_0xe360('0x17')]);}else{logger[_0xe360('0xf')]('CmCompany,\x20%s,\x20%s',_0x4df28d,'request\x20sent');_0x473efb(_0xd93048[_0xe360('0x18')]['message']);}})[_0xe360('0x19')](function(_0x5631fd){logger[_0xe360('0x14')](_0xe360('0x16'),_0x4df28d,_0x5631fd);_0x1d8f3b(_0x5631fd);});});} \ No newline at end of file +var _0x01c2=['client','http','request','then','info','request\x20sent','debug','stringify','error','code','CmCompany,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0x4ad0f7,_0x1920b0){var _0x30f5c8=function(_0x2aa6b6){while(--_0x2aa6b6){_0x4ad0f7['push'](_0x4ad0f7['shift']());}};_0x30f5c8(++_0x1920b0);}(_0x01c2,0x1af));var _0x201c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x01c2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x201c('0x0'));var util=require(_0x201c('0x1'));var moment=require(_0x201c('0x2'));var BPromise=require(_0x201c('0x3'));var rs=require(_0x201c('0x4'));var fs=require('fs');var Redis=require(_0x201c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x201c('0x6'))(_0x201c('0x7'));var config=require(_0x201c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x201c('0x9')][_0x201c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54542a,_0x2adf4b,_0x4d8391){return new BPromise(function(_0x5afb10,_0x431487){return client[_0x201c('0xb')](_0x54542a,_0x4d8391)[_0x201c('0xc')](function(_0x3bbc30){logger[_0x201c('0xd')]('CmCompany,\x20%s,\x20%s',_0x2adf4b,_0x201c('0xe'));logger[_0x201c('0xf')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x2adf4b,_0x201c('0xe'),JSON[_0x201c('0x10')](_0x3bbc30));if(_0x3bbc30[_0x201c('0x11')]){if(_0x3bbc30[_0x201c('0x11')][_0x201c('0x12')]===0x1f4){logger[_0x201c('0x11')](_0x201c('0x13'),_0x2adf4b,_0x3bbc30['error'][_0x201c('0x14')]);return _0x431487(_0x3bbc30[_0x201c('0x11')][_0x201c('0x14')]);}logger[_0x201c('0x11')](_0x201c('0x13'),_0x2adf4b,_0x3bbc30['error'][_0x201c('0x14')]);return _0x5afb10(_0x3bbc30[_0x201c('0x11')]['message']);}else{logger['info'](_0x201c('0x13'),_0x2adf4b,_0x201c('0xe'));_0x5afb10(_0x3bbc30['result'][_0x201c('0x14')]);}})[_0x201c('0x15')](function(_0x539ee0){logger[_0x201c('0x11')](_0x201c('0x13'),_0x2adf4b,_0x539ee0);_0x431487(_0x539ee0);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 5e6f358..4167f79 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 _0x7b90=['/describe','describe','/:id','isAuthenticated','show','getContacts','post','create','/:id/contacts','addContacts','put','update','delete','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get'];(function(_0x2ea375,_0x5ed6b9){var _0x5df61f=function(_0x27471f){while(--_0x27471f){_0x2ea375['push'](_0x2ea375['shift']());}};_0x5df61f(++_0x5ed6b9);}(_0x7b90,0xea));var _0x07b9=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x7b90[_0x432682];return _0x463d05;};'use strict';var multer=require(_0x07b9('0x0'));var util=require('util');var path=require(_0x07b9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x07b9('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x07b9('0x3'));var interaction=require(_0x07b9('0x4'));var config=require(_0x07b9('0x5'));var controller=require(_0x07b9('0x6'));router[_0x07b9('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x07b9('0x7')](_0x07b9('0x8'),auth['isAuthenticated'](),controller[_0x07b9('0x9')]);router[_0x07b9('0x7')](_0x07b9('0xa'),auth[_0x07b9('0xb')](),controller[_0x07b9('0xc')]);router[_0x07b9('0x7')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x07b9('0xd')]);router[_0x07b9('0xe')]('/',auth[_0x07b9('0xb')](),controller[_0x07b9('0xf')]);router['post'](_0x07b9('0x10'),auth['isAuthenticated'](),controller[_0x07b9('0x11')]);router[_0x07b9('0x12')](_0x07b9('0xa'),auth[_0x07b9('0xb')](),controller[_0x07b9('0x13')]);router[_0x07b9('0x14')](_0x07b9('0xa'),auth[_0x07b9('0xb')](),controller['destroy']);module[_0x07b9('0x15')]=router; \ No newline at end of file +var _0x91e5=['addContacts','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/contacts','post'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x91e5,0x126));var _0x591e=function(_0x2e7d35,_0x1651e7){_0x2e7d35=_0x2e7d35-0x0;var _0x1acb86=_0x91e5[_0x2e7d35];return _0x1acb86;};'use strict';var multer=require(_0x591e('0x0'));var util=require(_0x591e('0x1'));var path=require(_0x591e('0x2'));var timeout=require(_0x591e('0x3'));var express=require(_0x591e('0x4'));var router=express[_0x591e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x591e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x591e('0x7'));var controller=require(_0x591e('0x8'));router[_0x591e('0x9')]('/',auth[_0x591e('0xa')](),controller[_0x591e('0xb')]);router[_0x591e('0x9')](_0x591e('0xc'),auth['isAuthenticated'](),controller[_0x591e('0xd')]);router[_0x591e('0x9')](_0x591e('0xe'),auth[_0x591e('0xa')](),controller[_0x591e('0xf')]);router[_0x591e('0x9')](_0x591e('0x10'),auth[_0x591e('0xa')](),controller['getContacts']);router[_0x591e('0x11')]('/',auth[_0x591e('0xa')](),controller['create']);router[_0x591e('0x11')]('/:id/contacts',auth[_0x591e('0xa')](),controller[_0x591e('0x12')]);router[_0x591e('0x13')]('/:id',auth[_0x591e('0xa')](),controller[_0x591e('0x14')]);router[_0x591e('0x15')](_0x591e('0xe'),auth[_0x591e('0xa')](),controller[_0x591e('0x16')]);module[_0x591e('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 043bcd1..de930e9 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 _0xcbe1=['UNSIGNED','NOW','lodash','sequelize','exports','STRING','TEXT','INTEGER'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xcbe1,0x1aa));var _0x1cbe=function(_0x8fee0f,_0x118ab0){_0x8fee0f=_0x8fee0f-0x0;var _0xa5e569=_0xcbe1[_0x8fee0f];return _0xa5e569;};'use strict';var _=require(_0x1cbe('0x0'));var Sequelize=require(_0x1cbe('0x1'));module[_0x1cbe('0x2')]={'firstName':{'type':Sequelize[_0x1cbe('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x1cbe('0x3')]},'street':{'type':Sequelize[_0x1cbe('0x3')]},'postalCode':{'type':Sequelize[_0x1cbe('0x3')]},'city':{'type':Sequelize[_0x1cbe('0x3')]},'country':{'type':Sequelize[_0x1cbe('0x3')]},'dateOfBirth':{'type':Sequelize[_0x1cbe('0x3')]},'description':{'type':Sequelize[_0x1cbe('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x1cbe('0x3')]},'fax':{'type':Sequelize[_0x1cbe('0x3')]},'email':{'type':Sequelize[_0x1cbe('0x3')]},'url':{'type':Sequelize[_0x1cbe('0x3')]},'facebook':{'type':Sequelize[_0x1cbe('0x3')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x1cbe('0x3')]},'skype':{'type':Sequelize[_0x1cbe('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x1cbe('0x3')]},'telegram':{'type':Sequelize[_0x1cbe('0x3')]},'UserId':{'type':Sequelize[_0x1cbe('0x5')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x1cbe('0x5')](0x2)[_0x1cbe('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x1cbe('0x7')]},'dialTimezone':{'type':Sequelize[_0x1cbe('0x3')]},'utcOffset':{'type':Sequelize[_0x1cbe('0x5')]}}; \ No newline at end of file +var _0xf382=['INTEGER','UNSIGNED','DATE','NOW','lodash','exports','STRING','TEXT'];(function(_0x104f4d,_0x49996d){var _0x50cf50=function(_0x2a4129){while(--_0x2a4129){_0x104f4d['push'](_0x104f4d['shift']());}};_0x50cf50(++_0x49996d);}(_0xf382,0x10c));var _0x2f38=function(_0x75e143,_0x218710){_0x75e143=_0x75e143-0x0;var _0xdddfdb=_0xf382[_0x75e143];return _0xdddfdb;};'use strict';var _=require(_0x2f38('0x0'));var Sequelize=require('sequelize');module[_0x2f38('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x2f38('0x2')]},'street':{'type':Sequelize[_0x2f38('0x2')]},'postalCode':{'type':Sequelize[_0x2f38('0x2')]},'city':{'type':Sequelize[_0x2f38('0x2')]},'country':{'type':Sequelize[_0x2f38('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2f38('0x3')]},'phone':{'type':Sequelize[_0x2f38('0x2')]},'mobile':{'type':Sequelize[_0x2f38('0x2')]},'fax':{'type':Sequelize[_0x2f38('0x2')]},'email':{'type':Sequelize[_0x2f38('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x2f38('0x2')]},'fb_data':{'type':Sequelize[_0x2f38('0x2')]},'twitter':{'type':Sequelize[_0x2f38('0x2')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x2f38('0x2')]},'line':{'type':Sequelize[_0x2f38('0x2')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x2f38('0x2')]},'UserId':{'type':Sequelize[_0x2f38('0x4')]},'AdditionalPhones':{'type':Sequelize[_0x2f38('0x2')]},'priority':{'type':Sequelize[_0x2f38('0x4')](0x2)[_0x2f38('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x2f38('0x6')],'defaultValue':Sequelize[_0x2f38('0x7')]},'dialTimezone':{'type':Sequelize[_0x2f38('0x2')]},'utcOffset':{'type':Sequelize[_0x2f38('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index aa7a59e..20634ce 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 _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x3df223,_0x1740fc){var _0x562d11=function(_0x343009){while(--_0x343009){_0x3df223['push'](_0x3df223['shift']());}};_0x562d11(++_0x1740fc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file +var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 8f84a03..2640d08 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1afb=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmContact','setMaxListeners'];(function(_0x2b0476,_0x508766){var _0x54dcde=function(_0x301cc8){while(--_0x301cc8){_0x2b0476['push'](_0x2b0476['shift']());}};_0x54dcde(++_0x508766);}(_0x1afb,0x194));var _0xb1af=function(_0x3676a1,_0x2b7b11){_0x3676a1=_0x3676a1-0x0;var _0x37531e=_0x1afb[_0x3676a1];return _0x37531e;};'use strict';var EventEmitter=require(_0xb1af('0x0'));var CmContact=require(_0xb1af('0x1'))['db'][_0xb1af('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xb1af('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x594f6a){return function(_0x58657b,_0x19d0e6,_0x1bd35b){CmContactEvents['emit'](_0x594f6a+':'+_0x58657b['id'],_0x58657b);CmContactEvents[_0xb1af('0x4')](_0x594f6a,_0x58657b);_0x1bd35b(null);};}for(var e in events){if(events[_0xb1af('0x5')](e)){var event=events[e];CmContact[_0xb1af('0x6')](e,emitEvent(event));}}module[_0xb1af('0x7')]=CmContactEvents; \ No newline at end of file +var _0x72c3=['remove','emit','hook','exports','events','../../mysqldb','CmContact','setMaxListeners','save','update'];(function(_0x575057,_0x14baf3){var _0x49dbc8=function(_0x23599a){while(--_0x23599a){_0x575057['push'](_0x575057['shift']());}};_0x49dbc8(++_0x14baf3);}(_0x72c3,0xb8));var _0x372c=function(_0x2c7010,_0x30a706){_0x2c7010=_0x2c7010-0x0;var _0x4fc45a=_0x72c3[_0x2c7010];return _0x4fc45a;};'use strict';var EventEmitter=require(_0x372c('0x0'));var CmContact=require(_0x372c('0x1'))['db'][_0x372c('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x372c('0x3')](0x0);var events={'afterCreate':_0x372c('0x4'),'afterUpdate':_0x372c('0x5'),'afterDestroy':_0x372c('0x6')};function emitEvent(_0x54d2d7){return function(_0x17c37d,_0x40a7ae,_0x157719){CmContactEvents[_0x372c('0x7')](_0x54d2d7+':'+_0x17c37d['id'],_0x17c37d);CmContactEvents[_0x372c('0x7')](_0x54d2d7,_0x17c37d);_0x157719(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0x372c('0x8')](e,emitEvent(event));}}module[_0x372c('0x9')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 20be264..08896e8 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe45b=['mobile','fax','email','FULLTEXT','error','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','timezones','utcOffset','minutes','ret','then','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopper','create','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','afterCreate','Campaign','add','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','outbound','dialCheckDuplicateType','CmList','Lists','length','onlyIfOpen','findAll','CmHopperBlack','cmContact,\x20%s,\x20%s','message','get','always','BlackLists','List\x20not\x20found','models','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','push','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','api','bluebird','request-promise','path','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','lastName'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0xe45b,0x16c));var _0xbe45=function(_0x53d447,_0xe8abb6){_0x53d447=_0x53d447-0x0;var _0x11f0b9=_0xe45b[_0x53d447];return _0x11f0b9;};'use strict';var _=require(_0xbe45('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbe45('0x1'));var moment=require('moment');var BPromise=require(_0xbe45('0x2'));var rp=require(_0xbe45('0x3'));var fs=require('fs');var path=require(_0xbe45('0x4'));var rimraf=require('rimraf');var config=require(_0xbe45('0x5'));var shared=require(_0xbe45('0x6'));var attributes=require(_0xbe45('0x7'));module[_0xbe45('0x8')]=function(_0x2e390a,_0x36160a){return _0x2e390a[_0xbe45('0x9')](_0xbe45('0xa'),attributes,{'tableName':_0xbe45('0xb'),'paranoid':!![],'indexes':[{'name':_0xbe45('0xc'),'fields':['phone']},{'name':_0xbe45('0xd'),'fields':[_0xbe45('0xe'),_0xbe45('0xf'),_0xbe45('0xc'),_0xbe45('0x10'),_0xbe45('0x11'),_0xbe45('0x12')],'type':_0xbe45('0x13')}],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0xf2fb8a,_0x234b62,_0x286d05){var _0x518f3c=_0x2e390a['models'];var _0x52f0bc=_0xf2fb8a['get']({'plain':!![]});function _0x1d4411(){return function(_0x3e6d00){logger[_0xbe45('0x14')]('cmContact','afterCreate',util[_0xbe45('0x15')](_0x3e6d00,{'showHidden':![],'depth':null}));};}function _0x560b26(_0x5286e7,_0x52c612){var _0x58a68e=_0x52c612[_0xbe45('0x16')]?_0x52c612[_0xbe45('0x16')]:moment()[_0xbe45('0x17')](_0xbe45('0x18'));return new BPromise(function(_0x4fa7ff,_0x380b9a){if(_[_0xbe45('0x19')](_0x52c612[_0xbe45('0x1a')])){_0x4fa7ff({'ret':_0x58a68e});}else{_0x518f3c[_0xbe45('0x1b')][_0xbe45('0x1c')]({'where':{'id':_0x5286e7['id']}})['then'](function(_0x24770d){if(!_[_0xbe45('0x19')](_0x24770d)){var _0x18fc27=_0x24770d['dialTimezone'];if(!_[_0xbe45('0x19')](_0x18fc27)){var _0x8d8885=shared[_0xbe45('0x1d')];var _0x55d31a=_0x8d8885[_0x18fc27];var _0x41e869=_0x8d8885[_0x52c612['dialTimezone']];if(!_[_0xbe45('0x19')](_0x55d31a)&&!_[_0xbe45('0x19')](_0x41e869)){var _0x2d52c5=_0x55d31a[_0xbe45('0x1e')]-_0x41e869['utcOffset'];_0x58a68e=_0x52c612[_0xbe45('0x16')]?_0x52c612['scheduledat']:moment();var _0x4ee2c9=moment(_0x58a68e)['add'](_0x2d52c5,_0xbe45('0x1f'));_0x4fa7ff({'ret':_0x4ee2c9[_0xbe45('0x17')](_0xbe45('0x18'))});}else _0x4fa7ff({'ret':_0x58a68e});}else _0x4fa7ff({'ret':_0x58a68e});}else{_0x4fa7ff({'ret':_0x58a68e});}});}});return 0xa;}var _0x3df306=function(_0x27b9eb){return new BPromise(function(_0x4cf264,_0x40c5aa){_0x560b26(_0x27b9eb,_0x52f0bc)['then'](function(_0x3e972e){_0x52f0bc[_0xbe45('0x16')]=_0x3e972e[_0xbe45('0x20')];_0x518f3c['CmHopper'][_0xbe45('0x1c')]({'where':{'phone':_0x52f0bc[_0xbe45('0xc')],'VoiceQueueId':_0x27b9eb['id']}})[_0xbe45('0x21')](function(_0x37c89e){if(!_['isNil'](_0x37c89e)){throw new Error(_0xbe45('0x22')+_0x52f0bc[_0xbe45('0xc')]+_0xbe45('0x23')+_0x27b9eb['id']);}return _0x518f3c[_0xbe45('0x24')][_0xbe45('0x25')]({'phone':_0x52f0bc[_0xbe45('0xc')],'ContactId':_0x52f0bc['id'],'ListId':_0x52f0bc[_0xbe45('0x26')],'priority':_0x52f0bc[_0xbe45('0x27')]?_0x52f0bc['priority']:0x2,'scheduledat':_0x52f0bc['scheduledat']?_0x52f0bc['scheduledat']:moment()[_0xbe45('0x17')](_0xbe45('0x18')),'callback':_0x52f0bc[_0xbe45('0x28')]?!![]:![],'callbackuniqueid':_0x52f0bc[_0xbe45('0x28')]?_0x52f0bc[_0xbe45('0x28')]:undefined,'callbackat':_0x52f0bc[_0xbe45('0x28')]?moment()[_0xbe45('0x17')](_0xbe45('0x18')):undefined,'VoiceQueueId':_0x27b9eb['id']});})[_0xbe45('0x29')](function(_0x509873){_0x40c5aa(_0x509873);});});});};var _0x86a5a1=function(_0x18de7d){return new BPromise(function(_0x5261d8,_0x1185ab){_0x560b26(_0x18de7d,_0x52f0bc)['then'](function(_0xcc375b){_0x52f0bc[_0xbe45('0x16')]=_0xcc375b['ret'];_0x518f3c['CmHopper'][_0xbe45('0x1c')]({'where':{'phone':_0x52f0bc[_0xbe45('0xc')],'VoiceQueueId':_0x18de7d['id']}})[_0xbe45('0x21')](function(_0x190f85){if(!_[_0xbe45('0x19')](_0x190f85)){throw new Error(_0xbe45('0x22')+_0x52f0bc[_0xbe45('0xc')]+_0xbe45('0x2a')+_0x18de7d['id']);}return _0x518f3c[_0xbe45('0x2b')][_0xbe45('0x1c')]({'where':{'calleridnum':_0x52f0bc[_0xbe45('0xc')],'VoiceQueueId':_0x18de7d['id']}});})['then'](function(_0x236946){if(!_[_0xbe45('0x19')](_0x236946)){throw new Error(_0xbe45('0x2c')+_0x52f0bc[_0xbe45('0xc')]+_0xbe45('0x2d')+_0x18de7d['id']);}return _0x518f3c['CmHopper'][_0xbe45('0x25')]({'phone':_0x52f0bc[_0xbe45('0xc')],'ContactId':_0x52f0bc['id'],'ListId':_0x52f0bc['ListId'],'priority':_0x52f0bc[_0xbe45('0x27')]?_0x52f0bc[_0xbe45('0x27')]:0x2,'scheduledat':_0x52f0bc[_0xbe45('0x16')]?_0x52f0bc[_0xbe45('0x16')]:moment()[_0xbe45('0x17')](_0xbe45('0x18')),'callback':_0x52f0bc[_0xbe45('0x28')]?!![]:![],'callbackuniqueid':_0x52f0bc[_0xbe45('0x28')]?_0x52f0bc[_0xbe45('0x28')]:undefined,'callbackat':_0x52f0bc[_0xbe45('0x28')]?moment()[_0xbe45('0x17')](_0xbe45('0x18')):undefined,'VoiceQueueId':_0x18de7d['id']});})['catch'](function(_0x570dcb){_0x1185ab(_0x570dcb);});});});};function _0x182e6c(){return function(_0x372aed){logger[_0xbe45('0x14')]('cmContact',_0xbe45('0x2e'),util[_0xbe45('0x15')](_0x372aed,{'showHidden':![],'depth':null}));};}function _0x4726b0(_0x56e67d,_0x2e3a60){var _0x5984fe=_0x2e3a60['scheduledat']?_0x2e3a60['scheduledat']:moment()[_0xbe45('0x17')](_0xbe45('0x18'));return new BPromise(function(_0x114405,_0x3da108){if(_[_0xbe45('0x19')](_0x2e3a60[_0xbe45('0x1a')])){_0x114405({'ret':_0x5984fe});}else{_0x518f3c[_0xbe45('0x2f')]['findOne']({'where':{'id':_0x56e67d['id']}})[_0xbe45('0x21')](function(_0x1a05f8){if(!_[_0xbe45('0x19')](_0x1a05f8)){var _0x1fa674=_0x1a05f8[_0xbe45('0x1a')];if(!_[_0xbe45('0x19')](_0x1fa674)){var _0xe3656e=shared[_0xbe45('0x1d')];var _0xbabaec=_0xe3656e[_0x1fa674];var _0x527498=_0xe3656e[_0x2e3a60['dialTimezone']];if(!_[_0xbe45('0x19')](_0xbabaec)&&!_[_0xbe45('0x19')](_0x527498)){var _0x38af1a=_0xbabaec['utcOffset']-_0x527498[_0xbe45('0x1e')];_0x5984fe=_0x2e3a60[_0xbe45('0x16')]?_0x2e3a60[_0xbe45('0x16')]:moment();var _0x1b8a63=moment(_0x5984fe)[_0xbe45('0x30')](_0x38af1a,_0xbe45('0x1f'));_0x114405({'ret':_0x1b8a63[_0xbe45('0x17')](_0xbe45('0x18'))});}else _0x114405({'ret':_0x5984fe});}else _0x114405({'ret':_0x5984fe});}else{_0x114405({'ret':_0x5984fe});}});}});return 0xa;}var _0x523be4=function(_0x160cfe){return new BPromise(function(_0x2b5c99,_0x10d901){_0x4726b0(_0x160cfe,_0x52f0bc)['then'](function(_0x3dbadb){_0x52f0bc[_0xbe45('0x16')]=_0x3dbadb[_0xbe45('0x20')];_0x518f3c[_0xbe45('0x24')]['findOne']({'where':{'phone':_0x52f0bc['phone'],'CampaignId':_0x160cfe['id']}})[_0xbe45('0x21')](function(_0x26d5ae){if(!_[_0xbe45('0x19')](_0x26d5ae)){throw new Error(_0xbe45('0x22')+_0x52f0bc[_0xbe45('0xc')]+_0xbe45('0x31')+_0x160cfe['id']);}return _0x518f3c[_0xbe45('0x24')][_0xbe45('0x25')]({'phone':_0x52f0bc[_0xbe45('0xc')],'ContactId':_0x52f0bc['id'],'ListId':_0x52f0bc[_0xbe45('0x26')],'priority':_0x52f0bc[_0xbe45('0x27')]?_0x52f0bc[_0xbe45('0x27')]:0x2,'scheduledat':_0x52f0bc[_0xbe45('0x16')]?_0x52f0bc[_0xbe45('0x16')]:moment()['format'](_0xbe45('0x18')),'callback':_0x52f0bc[_0xbe45('0x28')]?!![]:![],'callbackuniqueid':_0x52f0bc['callbackUniqueid']?_0x52f0bc[_0xbe45('0x28')]:undefined,'callbackat':_0x52f0bc[_0xbe45('0x28')]?moment()[_0xbe45('0x17')](_0xbe45('0x18')):undefined,'CampaignId':_0x160cfe['id']});})['catch'](function(_0x478199){_0x10d901(_0x478199);});});});};var _0xfccbb5=function(_0x5a8635){return new BPromise(function(_0x49c3ff,_0x2e0735){_0x4726b0(_0x5a8635,_0x52f0bc)['then'](function(_0x2e485d){_0x52f0bc[_0xbe45('0x16')]=_0x2e485d[_0xbe45('0x20')];_0x518f3c['CmHopper'][_0xbe45('0x1c')]({'where':{'phone':_0x52f0bc[_0xbe45('0xc')],'CampaignId':_0x5a8635['id']}})[_0xbe45('0x21')](function(_0x191ec2){if(!_[_0xbe45('0x19')](_0x191ec2)){throw new Error('cmContact,\x20afterCreate\x20'+_0x52f0bc['phone']+_0xbe45('0x32')+_0x5a8635['id']);}return _0x518f3c['CmHopperFinal'][_0xbe45('0x1c')]({'where':{'calleridnum':_0x52f0bc[_0xbe45('0xc')],'CampaignId':_0x5a8635['id']}});})['then'](function(_0x519dfc){if(!_[_0xbe45('0x19')](_0x519dfc)){throw new Error(_0xbe45('0x2c')+_0x52f0bc['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0x5a8635['id']);}return _0x518f3c[_0xbe45('0x24')][_0xbe45('0x25')]({'phone':_0x52f0bc[_0xbe45('0xc')],'ContactId':_0x52f0bc['id'],'ListId':_0x52f0bc['ListId'],'priority':_0x52f0bc[_0xbe45('0x27')]?_0x52f0bc[_0xbe45('0x27')]:0x2,'scheduledat':_0x52f0bc[_0xbe45('0x16')]?_0x52f0bc[_0xbe45('0x16')]:moment()[_0xbe45('0x17')](_0xbe45('0x18')),'callback':_0x52f0bc[_0xbe45('0x28')]?!![]:![],'callbackuniqueid':_0x52f0bc[_0xbe45('0x28')]?_0x52f0bc[_0xbe45('0x28')]:undefined,'callbackat':_0x52f0bc[_0xbe45('0x28')]?moment()[_0xbe45('0x17')](_0xbe45('0x18')):undefined,'CampaignId':_0x5a8635['id']});})['catch'](function(_0x3b12ed){_0x2e0735(_0x3b12ed);});});});};if(_0x52f0bc[_0xbe45('0x26')]){_0x518f3c['VoiceQueue']['findAll']({'where':{'type':_0xbe45('0x33')},'attributes':['id',_0xbe45('0x34'),_0xbe45('0x1a')],'include':[{'model':_0x518f3c[_0xbe45('0x35')],'as':_0xbe45('0x36'),'where':{'id':_0x52f0bc[_0xbe45('0x26')]}}]})[_0xbe45('0x21')](function(_0x1f889d){if(_0x1f889d){var _0x177505=[];for(var _0x14a204=0x0,_0x2788b5;_0x14a204<_0x1f889d[_0xbe45('0x37')];_0x14a204+=0x1){_0x2788b5=_0x1f889d[_0x14a204]['get']({'plain':!![]});switch(_0x2788b5[_0xbe45('0x34')]){case'always':_0x86a5a1(_0x2788b5)[_0xbe45('0x29')](_0x1d4411());break;case _0xbe45('0x38'):_0x3df306(_0x2788b5)[_0xbe45('0x29')](_0x1d4411());break;default:_0x4726b0(_0x2788b5,_0x52f0bc)[_0xbe45('0x21')](function(_0x27ff53){_0x52f0bc[_0xbe45('0x16')]=_0x27ff53['ret'];_0x518f3c[_0xbe45('0x24')][_0xbe45('0x25')]({'phone':_0x52f0bc['phone'],'ContactId':_0x52f0bc['id'],'ListId':_0x52f0bc['ListId'],'scheduledat':_0x52f0bc['scheduledat']?_0x52f0bc['scheduledat']:moment()['format'](_0xbe45('0x18')),'priority':_0x52f0bc['priority']?_0x52f0bc[_0xbe45('0x27')]:0x2,'callback':_0x52f0bc[_0xbe45('0x28')]?!![]:![],'callbackuniqueid':_0x52f0bc[_0xbe45('0x28')]?_0x52f0bc['callbackUniqueid']:undefined,'callbackat':_0x52f0bc[_0xbe45('0x28')]?moment()[_0xbe45('0x17')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x2788b5['id']})[_0xbe45('0x29')](_0x1d4411());});}}}})[_0xbe45('0x21')](function(){return _0x518f3c[_0xbe45('0x1b')][_0xbe45('0x39')]({'where':{'type':_0xbe45('0x33')},'attributes':['id'],'include':[{'model':_0x518f3c[_0xbe45('0x35')],'as':'BlackLists','where':{'id':_0x52f0bc[_0xbe45('0x26')]}}]})[_0xbe45('0x21')](function(_0x5ddc16){if(_0x5ddc16){var _0x37d51d=[];for(var _0x49b7fd=0x0,_0x145179;_0x49b7fd<_0x5ddc16[_0xbe45('0x37')];_0x49b7fd+=0x1){_0x145179=_0x5ddc16[_0x49b7fd]['get']({'plain':!![]});_0x518f3c[_0xbe45('0x3a')][_0xbe45('0x25')]({'phone':_0x52f0bc[_0xbe45('0xc')],'ContactId':_0x52f0bc['id'],'ListId':_0x52f0bc[_0xbe45('0x26')],'VoiceQueueId':_0x145179['id']})[_0xbe45('0x29')](function(_0x3689ec){logger[_0xbe45('0x14')](_0xbe45('0x3b'),'afterCreate',_0x3689ec[_0xbe45('0x3c')]);});}}});})[_0xbe45('0x21')](function(){return _0x518f3c[_0xbe45('0x2f')][_0xbe45('0x39')]({'attributes':['id','dialCheckDuplicateType',_0xbe45('0x1a')],'include':[{'model':_0x518f3c[_0xbe45('0x35')],'as':_0xbe45('0x36'),'where':{'id':_0x52f0bc[_0xbe45('0x26')]}}]})[_0xbe45('0x21')](function(_0xc69a4f){if(_0xc69a4f){var _0x5d71d3=[];for(var _0x4ffce2=0x0,_0x49dc74;_0x4ffce2<_0xc69a4f[_0xbe45('0x37')];_0x4ffce2+=0x1){_0x49dc74=_0xc69a4f[_0x4ffce2][_0xbe45('0x3d')]({'plain':!![]});switch(_0x49dc74[_0xbe45('0x34')]){case _0xbe45('0x3e'):_0xfccbb5(_0x49dc74)[_0xbe45('0x29')](_0x182e6c());break;case _0xbe45('0x38'):_0x523be4(_0x49dc74)['catch'](_0x182e6c());break;default:_0x518f3c[_0xbe45('0x24')][_0xbe45('0x25')]({'phone':_0x52f0bc[_0xbe45('0xc')],'ContactId':_0x52f0bc['id'],'ListId':_0x52f0bc[_0xbe45('0x26')],'scheduledat':_0x52f0bc[_0xbe45('0x16')]?_0x52f0bc[_0xbe45('0x16')]:moment()[_0xbe45('0x17')](_0xbe45('0x18')),'priority':_0x52f0bc['priority']?_0x52f0bc[_0xbe45('0x27')]:0x2,'callback':_0x52f0bc['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x52f0bc[_0xbe45('0x28')]?_0x52f0bc[_0xbe45('0x28')]:undefined,'callbackat':_0x52f0bc['callbackUniqueid']?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x49dc74['id']})[_0xbe45('0x29')](_0x182e6c());}}}});})['then'](function(){return _0x518f3c[_0xbe45('0x2f')][_0xbe45('0x39')]({'attributes':['id'],'include':[{'model':_0x518f3c['CmList'],'as':_0xbe45('0x3f'),'where':{'id':_0x52f0bc[_0xbe45('0x26')]}}]})[_0xbe45('0x21')](function(_0x30fb36){if(_0x30fb36){var _0x3768cd=[];for(var _0x2f7c7d=0x0,_0x16e494;_0x2f7c7d<_0x30fb36[_0xbe45('0x37')];_0x2f7c7d+=0x1){_0x16e494=_0x30fb36[_0x2f7c7d][_0xbe45('0x3d')]({'plain':!![]});_0x518f3c[_0xbe45('0x3a')][_0xbe45('0x25')]({'phone':_0x52f0bc[_0xbe45('0xc')],'ContactId':_0x52f0bc['id'],'ListId':_0x52f0bc[_0xbe45('0x26')],'CampaignId':_0x16e494['id']})[_0xbe45('0x29')](function(_0x1d0967){logger[_0xbe45('0x14')](_0xbe45('0x3b'),_0xbe45('0x2e'),_0x1d0967[_0xbe45('0x3c')]);});}}});})['then'](function(){_0x286d05();})[_0xbe45('0x29')](function(_0x29cc7d){logger[_0xbe45('0x14')](_0xbe45('0x3b'),_0xbe45('0x2e'),_0x29cc7d[_0xbe45('0x3c')]);_0x286d05(_0x29cc7d);});}else{_0x286d05(new Error(_0xbe45('0x40')));}},'afterDestroy':function(_0x21ed1f,_0x17e1b7,_0xcd3b6){var _0x2571c8=_0x2e390a[_0xbe45('0x41')];var _0x39d0c7=_0x21ed1f[_0xbe45('0x3d')]({'plain':!![]});return _0x2571c8['CmHopper'][_0xbe45('0x39')]({'raw':!![],'where':{'ListId':_0x39d0c7[_0xbe45('0x26')],'ContactId':_0x39d0c7['id']}})[_0xbe45('0x21')](function(_0x25b68a){if(!_[_0xbe45('0x42')](_0x25b68a)){var _0x226a39=[];for(var _0x4f2e89=0x0;_0x4f2e89<_0x25b68a[_0xbe45('0x37')];_0x4f2e89+=0x1){var _0x2108e5=_0x2571c8[_0xbe45('0x24')][_0xbe45('0x43')]({'where':{'ListId':_0x25b68a[_0x4f2e89]['ListId'],'ContactId':_0x25b68a[_0x4f2e89][_0xbe45('0x44')],'VoiceQueueId':_0x25b68a[_0x4f2e89][_0xbe45('0x45')],'CampaignId':_0x25b68a[_0x4f2e89][_0xbe45('0x46')]}});_0x226a39[_0xbe45('0x47')](_0x2108e5);}return BPromise[_0xbe45('0x48')](_0x226a39);}})[_0xbe45('0x21')](function(_0x3d028f){logger[_0xbe45('0x49')](_0xbe45('0x4a'),util['inspect'](_0x3d028f,{'showHidden':![],'depth':null}));_0xcd3b6();})['catch'](function(_0x18a90c){logger[_0xbe45('0x14')](_0xbe45('0x4b'),util[_0xbe45('0x15')](_0x18a90c,{'showHidden':![],'depth':null}));_0xcd3b6(_0x18a90c);});}}});}; \ No newline at end of file +var _0x29fa=['models','get','error','cmContact','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','dialTimezone','VoiceQueue','findOne','then','isNil','timezones','utcOffset','minutes','ret','CmHopper','create','ListId','priority','callbackUniqueid','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','Campaign','add','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','catch','findAll','outbound','CmList','Lists','length','dialCheckDuplicateType','always','onlyIfOpen','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','message','List\x20not\x20found','isEmpty','destroy','ContactId','CampaignId','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','lastName','mobile','fax','email','utf8mb4_unicode_ci'];(function(_0x6386d,_0x2ec37a){var _0x28f01d=function(_0x49b631){while(--_0x49b631){_0x6386d['push'](_0x6386d['shift']());}};_0x28f01d(++_0x2ec37a);}(_0x29fa,0x1b7));var _0xa29f=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x29fa[_0x46698a];return _0x356db0;};'use strict';var _=require(_0xa29f('0x0'));var util=require(_0xa29f('0x1'));var logger=require(_0xa29f('0x2'))(_0xa29f('0x3'));var moment=require(_0xa29f('0x4'));var BPromise=require('bluebird');var rp=require(_0xa29f('0x5'));var fs=require('fs');var path=require(_0xa29f('0x6'));var rimraf=require(_0xa29f('0x7'));var config=require(_0xa29f('0x8'));var shared=require(_0xa29f('0x9'));var attributes=require(_0xa29f('0xa'));module[_0xa29f('0xb')]=function(_0x25bfdf,_0x548d54){return _0x25bfdf[_0xa29f('0xc')](_0xa29f('0xd'),attributes,{'tableName':_0xa29f('0xe'),'paranoid':!![],'indexes':[{'name':_0xa29f('0xf'),'fields':[_0xa29f('0xf')]},{'name':_0xa29f('0x10'),'fields':[_0xa29f('0x11'),_0xa29f('0x12'),_0xa29f('0xf'),_0xa29f('0x13'),_0xa29f('0x14'),_0xa29f('0x15')],'type':'FULLTEXT'}],'timestamps':!![],'charset':'utf8mb4','collate':_0xa29f('0x16'),'hooks':{'afterCreate':function(_0x3e5815,_0x4e6252,_0x204069){var _0x17aa84=_0x25bfdf[_0xa29f('0x17')];var _0x3e1692=_0x3e5815[_0xa29f('0x18')]({'plain':!![]});function _0x35bb2d(){return function(_0x159669){logger[_0xa29f('0x19')](_0xa29f('0x1a'),_0xa29f('0x1b'),util[_0xa29f('0x1c')](_0x159669,{'showHidden':![],'depth':null}));};}function _0x575985(_0x3c4958,_0x3ed247){var _0x157b25=_0x3ed247[_0xa29f('0x1d')]?_0x3ed247[_0xa29f('0x1d')]:moment()[_0xa29f('0x1e')](_0xa29f('0x1f'));return new BPromise(function(_0x2fcab1,_0x5eee3f){if(_['isNil'](_0x3ed247[_0xa29f('0x20')])){_0x2fcab1({'ret':_0x157b25});}else{_0x17aa84[_0xa29f('0x21')][_0xa29f('0x22')]({'where':{'id':_0x3c4958['id']}})[_0xa29f('0x23')](function(_0x326dcf){if(!_['isNil'](_0x326dcf)){var _0x24b440=_0x326dcf[_0xa29f('0x20')];if(!_[_0xa29f('0x24')](_0x24b440)){var _0x4ecb16=shared[_0xa29f('0x25')];var _0x49d3d4=_0x4ecb16[_0x24b440];var _0x581d0b=_0x4ecb16[_0x3ed247[_0xa29f('0x20')]];if(!_[_0xa29f('0x24')](_0x49d3d4)&&!_[_0xa29f('0x24')](_0x581d0b)){var _0x4624c4=_0x49d3d4['utcOffset']-_0x581d0b[_0xa29f('0x26')];_0x157b25=_0x3ed247['scheduledat']?_0x3ed247[_0xa29f('0x1d')]:moment();var _0x21e436=moment(_0x157b25)['add'](_0x4624c4,_0xa29f('0x27'));_0x2fcab1({'ret':_0x21e436[_0xa29f('0x1e')](_0xa29f('0x1f'))});}else _0x2fcab1({'ret':_0x157b25});}else _0x2fcab1({'ret':_0x157b25});}else{_0x2fcab1({'ret':_0x157b25});}});}});return 0xa;}var _0x177cdb=function(_0x10d5e1){return new BPromise(function(_0x34324e,_0x1e6c12){_0x575985(_0x10d5e1,_0x3e1692)['then'](function(_0x380b0c){_0x3e1692['scheduledat']=_0x380b0c[_0xa29f('0x28')];_0x17aa84[_0xa29f('0x29')][_0xa29f('0x22')]({'where':{'phone':_0x3e1692[_0xa29f('0xf')],'VoiceQueueId':_0x10d5e1['id']}})['then'](function(_0x49c418){if(!_[_0xa29f('0x24')](_0x49c418)){throw new Error('cmContact,\x20afterCreate\x20'+_0x3e1692[_0xa29f('0xf')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x10d5e1['id']);}return _0x17aa84[_0xa29f('0x29')][_0xa29f('0x2a')]({'phone':_0x3e1692['phone'],'ContactId':_0x3e1692['id'],'ListId':_0x3e1692[_0xa29f('0x2b')],'priority':_0x3e1692[_0xa29f('0x2c')]?_0x3e1692[_0xa29f('0x2c')]:0x2,'scheduledat':_0x3e1692[_0xa29f('0x1d')]?_0x3e1692['scheduledat']:moment()[_0xa29f('0x1e')](_0xa29f('0x1f')),'callback':_0x3e1692['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x3e1692[_0xa29f('0x2d')]?_0x3e1692[_0xa29f('0x2d')]:undefined,'callbackat':_0x3e1692[_0xa29f('0x2d')]?moment()[_0xa29f('0x1e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x10d5e1['id']});})['catch'](function(_0x520996){_0x1e6c12(_0x520996);});});});};var _0x138c31=function(_0xeb7852){return new BPromise(function(_0x1b7e52,_0x59695a){_0x575985(_0xeb7852,_0x3e1692)[_0xa29f('0x23')](function(_0x5ab19a){_0x3e1692['scheduledat']=_0x5ab19a[_0xa29f('0x28')];_0x17aa84['CmHopper']['findOne']({'where':{'phone':_0x3e1692[_0xa29f('0xf')],'VoiceQueueId':_0xeb7852['id']}})[_0xa29f('0x23')](function(_0x20dedd){if(!_['isNil'](_0x20dedd)){throw new Error(_0xa29f('0x2e')+_0x3e1692['phone']+_0xa29f('0x2f')+_0xeb7852['id']);}return _0x17aa84[_0xa29f('0x30')][_0xa29f('0x22')]({'where':{'calleridnum':_0x3e1692[_0xa29f('0xf')],'VoiceQueueId':_0xeb7852['id']}});})[_0xa29f('0x23')](function(_0x5dc463){if(!_['isNil'](_0x5dc463)){throw new Error(_0xa29f('0x31')+_0x3e1692[_0xa29f('0xf')]+_0xa29f('0x32')+_0xeb7852['id']);}return _0x17aa84['CmHopper'][_0xa29f('0x2a')]({'phone':_0x3e1692[_0xa29f('0xf')],'ContactId':_0x3e1692['id'],'ListId':_0x3e1692[_0xa29f('0x2b')],'priority':_0x3e1692[_0xa29f('0x2c')]?_0x3e1692[_0xa29f('0x2c')]:0x2,'scheduledat':_0x3e1692[_0xa29f('0x1d')]?_0x3e1692[_0xa29f('0x1d')]:moment()[_0xa29f('0x1e')](_0xa29f('0x1f')),'callback':_0x3e1692[_0xa29f('0x2d')]?!![]:![],'callbackuniqueid':_0x3e1692[_0xa29f('0x2d')]?_0x3e1692[_0xa29f('0x2d')]:undefined,'callbackat':_0x3e1692[_0xa29f('0x2d')]?moment()['format'](_0xa29f('0x1f')):undefined,'VoiceQueueId':_0xeb7852['id']});})['catch'](function(_0x3b2e52){_0x59695a(_0x3b2e52);});});});};function _0x54f79c(){return function(_0x325118){logger[_0xa29f('0x19')]('cmContact',_0xa29f('0x1b'),util[_0xa29f('0x1c')](_0x325118,{'showHidden':![],'depth':null}));};}function _0x4910a5(_0x14bb84,_0x59141a){var _0x2c3100=_0x59141a[_0xa29f('0x1d')]?_0x59141a['scheduledat']:moment()[_0xa29f('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x5c522b,_0x2fb9a5){if(_[_0xa29f('0x24')](_0x59141a[_0xa29f('0x20')])){_0x5c522b({'ret':_0x2c3100});}else{_0x17aa84[_0xa29f('0x33')][_0xa29f('0x22')]({'where':{'id':_0x14bb84['id']}})['then'](function(_0x281800){if(!_[_0xa29f('0x24')](_0x281800)){var _0x9136cf=_0x281800[_0xa29f('0x20')];if(!_[_0xa29f('0x24')](_0x9136cf)){var _0x1139c6=shared[_0xa29f('0x25')];var _0x17ae0d=_0x1139c6[_0x9136cf];var _0x1aa5a2=_0x1139c6[_0x59141a[_0xa29f('0x20')]];if(!_[_0xa29f('0x24')](_0x17ae0d)&&!_[_0xa29f('0x24')](_0x1aa5a2)){var _0x260d47=_0x17ae0d[_0xa29f('0x26')]-_0x1aa5a2[_0xa29f('0x26')];_0x2c3100=_0x59141a['scheduledat']?_0x59141a[_0xa29f('0x1d')]:moment();var _0x334d0e=moment(_0x2c3100)[_0xa29f('0x34')](_0x260d47,_0xa29f('0x27'));_0x5c522b({'ret':_0x334d0e['format']('YYYY-MM-DD\x20HH:mm:ss')});}else _0x5c522b({'ret':_0x2c3100});}else _0x5c522b({'ret':_0x2c3100});}else{_0x5c522b({'ret':_0x2c3100});}});}});return 0xa;}var _0x29a681=function(_0x53d5d3){return new BPromise(function(_0x7d1083,_0xa576f4){_0x4910a5(_0x53d5d3,_0x3e1692)['then'](function(_0x10276e){_0x3e1692[_0xa29f('0x1d')]=_0x10276e[_0xa29f('0x28')];_0x17aa84[_0xa29f('0x29')][_0xa29f('0x22')]({'where':{'phone':_0x3e1692[_0xa29f('0xf')],'CampaignId':_0x53d5d3['id']}})[_0xa29f('0x23')](function(_0x4a8374){if(!_[_0xa29f('0x24')](_0x4a8374)){throw new Error(_0xa29f('0x2e')+_0x3e1692[_0xa29f('0xf')]+_0xa29f('0x35')+_0x53d5d3['id']);}return _0x17aa84[_0xa29f('0x29')][_0xa29f('0x2a')]({'phone':_0x3e1692[_0xa29f('0xf')],'ContactId':_0x3e1692['id'],'ListId':_0x3e1692[_0xa29f('0x2b')],'priority':_0x3e1692['priority']?_0x3e1692['priority']:0x2,'scheduledat':_0x3e1692[_0xa29f('0x1d')]?_0x3e1692[_0xa29f('0x1d')]:moment()[_0xa29f('0x1e')](_0xa29f('0x1f')),'callback':_0x3e1692[_0xa29f('0x2d')]?!![]:![],'callbackuniqueid':_0x3e1692[_0xa29f('0x2d')]?_0x3e1692[_0xa29f('0x2d')]:undefined,'callbackat':_0x3e1692[_0xa29f('0x2d')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x53d5d3['id']});})['catch'](function(_0x484e26){_0xa576f4(_0x484e26);});});});};var _0x1ffb21=function(_0x570512){return new BPromise(function(_0x244609,_0x4975da){_0x4910a5(_0x570512,_0x3e1692)[_0xa29f('0x23')](function(_0x26bd85){_0x3e1692['scheduledat']=_0x26bd85[_0xa29f('0x28')];_0x17aa84['CmHopper']['findOne']({'where':{'phone':_0x3e1692['phone'],'CampaignId':_0x570512['id']}})[_0xa29f('0x23')](function(_0x4b9bc2){if(!_['isNil'](_0x4b9bc2)){throw new Error(_0xa29f('0x2e')+_0x3e1692[_0xa29f('0xf')]+_0xa29f('0x36')+_0x570512['id']);}return _0x17aa84[_0xa29f('0x30')][_0xa29f('0x22')]({'where':{'calleridnum':_0x3e1692[_0xa29f('0xf')],'CampaignId':_0x570512['id']}});})[_0xa29f('0x23')](function(_0x12b6f3){if(!_['isNil'](_0x12b6f3)){throw new Error(_0xa29f('0x31')+_0x3e1692[_0xa29f('0xf')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0x570512['id']);}return _0x17aa84['CmHopper']['create']({'phone':_0x3e1692[_0xa29f('0xf')],'ContactId':_0x3e1692['id'],'ListId':_0x3e1692[_0xa29f('0x2b')],'priority':_0x3e1692[_0xa29f('0x2c')]?_0x3e1692[_0xa29f('0x2c')]:0x2,'scheduledat':_0x3e1692[_0xa29f('0x1d')]?_0x3e1692[_0xa29f('0x1d')]:moment()[_0xa29f('0x1e')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x3e1692[_0xa29f('0x2d')]?!![]:![],'callbackuniqueid':_0x3e1692[_0xa29f('0x2d')]?_0x3e1692['callbackUniqueid']:undefined,'callbackat':_0x3e1692[_0xa29f('0x2d')]?moment()['format'](_0xa29f('0x1f')):undefined,'CampaignId':_0x570512['id']});})[_0xa29f('0x37')](function(_0x398d8c){_0x4975da(_0x398d8c);});});});};if(_0x3e1692['ListId']){_0x17aa84['VoiceQueue'][_0xa29f('0x38')]({'where':{'type':_0xa29f('0x39')},'attributes':['id','dialCheckDuplicateType',_0xa29f('0x20')],'include':[{'model':_0x17aa84[_0xa29f('0x3a')],'as':_0xa29f('0x3b'),'where':{'id':_0x3e1692[_0xa29f('0x2b')]}}]})[_0xa29f('0x23')](function(_0x386455){if(_0x386455){var _0xabc931=[];for(var _0x451269=0x0,_0x4f1fd2;_0x451269<_0x386455[_0xa29f('0x3c')];_0x451269+=0x1){_0x4f1fd2=_0x386455[_0x451269][_0xa29f('0x18')]({'plain':!![]});switch(_0x4f1fd2[_0xa29f('0x3d')]){case _0xa29f('0x3e'):_0x138c31(_0x4f1fd2)['catch'](_0x35bb2d());break;case _0xa29f('0x3f'):_0x177cdb(_0x4f1fd2)[_0xa29f('0x37')](_0x35bb2d());break;default:_0x4910a5(_0x4f1fd2,_0x3e1692)[_0xa29f('0x23')](function(_0xb3b29b){_0x3e1692[_0xa29f('0x1d')]=_0xb3b29b[_0xa29f('0x28')];_0x17aa84[_0xa29f('0x29')]['create']({'phone':_0x3e1692[_0xa29f('0xf')],'ContactId':_0x3e1692['id'],'ListId':_0x3e1692[_0xa29f('0x2b')],'scheduledat':_0x3e1692[_0xa29f('0x1d')]?_0x3e1692[_0xa29f('0x1d')]:moment()[_0xa29f('0x1e')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x3e1692[_0xa29f('0x2c')]?_0x3e1692[_0xa29f('0x2c')]:0x2,'callback':_0x3e1692[_0xa29f('0x2d')]?!![]:![],'callbackuniqueid':_0x3e1692[_0xa29f('0x2d')]?_0x3e1692['callbackUniqueid']:undefined,'callbackat':_0x3e1692[_0xa29f('0x2d')]?moment()['format'](_0xa29f('0x1f')):undefined,'VoiceQueueId':_0x4f1fd2['id']})[_0xa29f('0x37')](_0x35bb2d());});}}}})[_0xa29f('0x23')](function(){return _0x17aa84[_0xa29f('0x21')][_0xa29f('0x38')]({'where':{'type':_0xa29f('0x39')},'attributes':['id'],'include':[{'model':_0x17aa84[_0xa29f('0x3a')],'as':_0xa29f('0x40'),'where':{'id':_0x3e1692[_0xa29f('0x2b')]}}]})[_0xa29f('0x23')](function(_0x23add9){if(_0x23add9){var _0x4ded78=[];for(var _0x4c02b7=0x0,_0x4f8aad;_0x4c02b7<_0x23add9[_0xa29f('0x3c')];_0x4c02b7+=0x1){_0x4f8aad=_0x23add9[_0x4c02b7][_0xa29f('0x18')]({'plain':!![]});_0x17aa84[_0xa29f('0x41')][_0xa29f('0x2a')]({'phone':_0x3e1692[_0xa29f('0xf')],'ContactId':_0x3e1692['id'],'ListId':_0x3e1692[_0xa29f('0x2b')],'VoiceQueueId':_0x4f8aad['id']})[_0xa29f('0x37')](function(_0x533a4b){logger[_0xa29f('0x19')](_0xa29f('0x42'),_0xa29f('0x1b'),_0x533a4b['message']);});}}});})[_0xa29f('0x23')](function(){return _0x17aa84[_0xa29f('0x33')][_0xa29f('0x38')]({'attributes':['id','dialCheckDuplicateType',_0xa29f('0x20')],'include':[{'model':_0x17aa84['CmList'],'as':_0xa29f('0x3b'),'where':{'id':_0x3e1692['ListId']}}]})[_0xa29f('0x23')](function(_0x5e0947){if(_0x5e0947){var _0x353fea=[];for(var _0x134987=0x0,_0x1e8424;_0x134987<_0x5e0947[_0xa29f('0x3c')];_0x134987+=0x1){_0x1e8424=_0x5e0947[_0x134987][_0xa29f('0x18')]({'plain':!![]});switch(_0x1e8424['dialCheckDuplicateType']){case _0xa29f('0x3e'):_0x1ffb21(_0x1e8424)[_0xa29f('0x37')](_0x54f79c());break;case _0xa29f('0x3f'):_0x29a681(_0x1e8424)[_0xa29f('0x37')](_0x54f79c());break;default:_0x17aa84[_0xa29f('0x29')][_0xa29f('0x2a')]({'phone':_0x3e1692[_0xa29f('0xf')],'ContactId':_0x3e1692['id'],'ListId':_0x3e1692[_0xa29f('0x2b')],'scheduledat':_0x3e1692[_0xa29f('0x1d')]?_0x3e1692[_0xa29f('0x1d')]:moment()[_0xa29f('0x1e')](_0xa29f('0x1f')),'priority':_0x3e1692[_0xa29f('0x2c')]?_0x3e1692[_0xa29f('0x2c')]:0x2,'callback':_0x3e1692[_0xa29f('0x2d')]?!![]:![],'callbackuniqueid':_0x3e1692[_0xa29f('0x2d')]?_0x3e1692[_0xa29f('0x2d')]:undefined,'callbackat':_0x3e1692[_0xa29f('0x2d')]?moment()[_0xa29f('0x1e')](_0xa29f('0x1f')):undefined,'CampaignId':_0x1e8424['id']})[_0xa29f('0x37')](_0x54f79c());}}}});})[_0xa29f('0x23')](function(){return _0x17aa84[_0xa29f('0x33')]['findAll']({'attributes':['id'],'include':[{'model':_0x17aa84[_0xa29f('0x3a')],'as':_0xa29f('0x40'),'where':{'id':_0x3e1692[_0xa29f('0x2b')]}}]})[_0xa29f('0x23')](function(_0x13cc5b){if(_0x13cc5b){var _0xaa1cc6=[];for(var _0x4c57c8=0x0,_0x2f6e62;_0x4c57c8<_0x13cc5b[_0xa29f('0x3c')];_0x4c57c8+=0x1){_0x2f6e62=_0x13cc5b[_0x4c57c8][_0xa29f('0x18')]({'plain':!![]});_0x17aa84[_0xa29f('0x41')][_0xa29f('0x2a')]({'phone':_0x3e1692[_0xa29f('0xf')],'ContactId':_0x3e1692['id'],'ListId':_0x3e1692['ListId'],'CampaignId':_0x2f6e62['id']})[_0xa29f('0x37')](function(_0x3b98db){logger['error'](_0xa29f('0x42'),'afterCreate',_0x3b98db[_0xa29f('0x43')]);});}}});})['then'](function(){_0x204069();})[_0xa29f('0x37')](function(_0x3b1ef0){logger['error'](_0xa29f('0x42'),_0xa29f('0x1b'),_0x3b1ef0['message']);_0x204069(_0x3b1ef0);});}else{_0x204069(new Error(_0xa29f('0x44')));}},'afterDestroy':function(_0x299918,_0x4cb0b5,_0x480c82){var _0x4ddec7=_0x25bfdf[_0xa29f('0x17')];var _0x133f67=_0x299918[_0xa29f('0x18')]({'plain':!![]});return _0x4ddec7[_0xa29f('0x29')][_0xa29f('0x38')]({'raw':!![],'where':{'ListId':_0x133f67[_0xa29f('0x2b')],'ContactId':_0x133f67['id']}})[_0xa29f('0x23')](function(_0xcfdfaf){if(!_[_0xa29f('0x45')](_0xcfdfaf)){var _0x519462=[];for(var _0x37df61=0x0;_0x37df61<_0xcfdfaf[_0xa29f('0x3c')];_0x37df61+=0x1){var _0x5ac92a=_0x4ddec7[_0xa29f('0x29')][_0xa29f('0x46')]({'where':{'ListId':_0xcfdfaf[_0x37df61][_0xa29f('0x2b')],'ContactId':_0xcfdfaf[_0x37df61][_0xa29f('0x47')],'VoiceQueueId':_0xcfdfaf[_0x37df61]['VoiceQueueId'],'CampaignId':_0xcfdfaf[_0x37df61][_0xa29f('0x48')]}});_0x519462['push'](_0x5ac92a);}return BPromise[_0xa29f('0x49')](_0x519462);}})[_0xa29f('0x23')](function(_0x2e5752){logger[_0xa29f('0x4a')](_0xa29f('0x4b'),util[_0xa29f('0x1c')](_0x2e5752,{'showHidden':![],'depth':null}));_0x480c82();})['catch'](function(_0x1fe29b){logger[_0xa29f('0x19')](_0xa29f('0x4c'),util[_0xa29f('0x1c')](_0x1fe29b,{'showHidden':![],'depth':null}));_0x480c82(_0x1fe29b);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index f3b9de4..7bbd753 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x6e6651,_0x4bd84c){var _0x5be69e=function(_0x458a72){while(--_0x458a72){_0x6e6651['push'](_0x6e6651['shift']());}};_0x5be69e(++_0x4bd84c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index 7b53d34..201d64a 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1782=['STRING','PHONE','sequelize','INTEGER'];(function(_0x460c9a,_0x513493){var _0xd77c57=function(_0x31bd21){while(--_0x31bd21){_0x460c9a['push'](_0x460c9a['shift']());}};_0xd77c57(++_0x513493);}(_0x1782,0x13e));var _0x2178=function(_0x420caf,_0x4827b1){_0x420caf=_0x420caf-0x0;var _0x3edd9a=_0x1782[_0x420caf];return _0x3edd9a;};'use strict';var Sequelize=require(_0x2178('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0x2178('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x2178('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x2178('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x2178('0x2')],'defaultValue':_0x2178('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0x2178('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x2750=['INTEGER','STRING','PHONE','sequelize'];(function(_0x23e2b7,_0x51c0da){var _0x588f00=function(_0x4805de){while(--_0x4805de){_0x23e2b7['push'](_0x23e2b7['shift']());}};_0x588f00(++_0x51c0da);}(_0x2750,0x13b));var _0x0275=function(_0x4e2f68,_0x931492){_0x4e2f68=_0x4e2f68-0x0;var _0x223709=_0x2750[_0x4e2f68];return _0x223709;};'use strict';var Sequelize=require(_0x0275('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0x0275('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x0275('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x0275('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x0275('0x2')],'defaultValue':_0x0275('0x3')},'OrderBy':{'type':Sequelize[_0x0275('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0x0275('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index d35fc88..286bed7 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d4e=['type','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','include','rows','params','CmContactHasItem','includeAll','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','then','destroy','get','CmContactHasItems','end','error','name','send','index','rawAttributes','fieldName'];(function(_0x5e19ce,_0xf69afe){var _0x4b8eb8=function(_0x151c8c){while(--_0x151c8c){_0x5e19ce['push'](_0x5e19ce['shift']());}};_0x4b8eb8(++_0xf69afe);}(_0x5d4e,0x1b0));var _0xe5d4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5d4e[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xe5d4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe5d4('0x1'));var jsonpatch=require(_0xe5d4('0x2'));var rp=require(_0xe5d4('0x3'));var moment=require(_0xe5d4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe5d4('0x5'));var util=require('util');var path=require('path');var sox=require(_0xe5d4('0x6'));var csv=require(_0xe5d4('0x7'));var ejs=require(_0xe5d4('0x8'));var fs=require('fs');var fs_extra=require(_0xe5d4('0x9'));var _=require(_0xe5d4('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe5d4('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xe5d4('0x7'));var querystring=require(_0xe5d4('0xc'));var Papa=require(_0xe5d4('0xd'));var Redis=require(_0xe5d4('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe5d4('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe5d4('0x10'));var logger=require(_0xe5d4('0x11'))('api');var utils=require(_0xe5d4('0x12'));var config=require(_0xe5d4('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f0bca,_0x2d80bb){_0x2d80bb=_0x2d80bb||0xcc;return function(_0x3a8b64){if(_0x3a8b64){return _0x2f0bca[_0xe5d4('0x14')](_0x2d80bb);}return _0x2f0bca[_0xe5d4('0x15')](_0x2d80bb)['end']();};}function respondWithResult(_0x4f5feb,_0x39d0cd){_0x39d0cd=_0x39d0cd||0xc8;return function(_0x23ffa5){if(_0x23ffa5){return _0x4f5feb[_0xe5d4('0x15')](_0x39d0cd)[_0xe5d4('0x16')](_0x23ffa5);}};}function respondWithFilteredResult(_0x1cc067,_0x35f6de){return function(_0x43d4c9){if(_0x43d4c9){var _0x1e0d86=typeof _0x35f6de[_0xe5d4('0x17')]==='undefined'&&typeof _0x35f6de[_0xe5d4('0x18')]===_0xe5d4('0x19');var _0x58b856=_0x43d4c9[_0xe5d4('0x1a')];var _0x29ad00=_0x1e0d86?0x0:_0x35f6de['offset'];var _0x3d9fac=_0x1e0d86?_0x43d4c9[_0xe5d4('0x1a')]:_0x35f6de[_0xe5d4('0x17')]+_0x35f6de[_0xe5d4('0x18')];var _0x39aef5;if(_0x3d9fac>=_0x58b856){_0x3d9fac=_0x58b856;_0x39aef5=0xc8;}else{_0x39aef5=0xce;}_0x1cc067[_0xe5d4('0x15')](_0x39aef5);return _0x1cc067['set'](_0xe5d4('0x1b'),_0x29ad00+'-'+_0x3d9fac+'/'+_0x58b856)[_0xe5d4('0x16')](_0x43d4c9);}return null;};}function patchUpdates(_0x47d9fe){return function(_0x1f8949){try{jsonpatch[_0xe5d4('0x1c')](_0x1f8949,_0x47d9fe,!![]);}catch(_0x37e6d8){return BPromise[_0xe5d4('0x1d')](_0x37e6d8);}return _0x1f8949[_0xe5d4('0x1e')]();};}function saveUpdates(_0x2101d9,_0xe79395){return function(_0x2e8d20){if(_0x2e8d20){return _0x2e8d20['update'](_0x2101d9)[_0xe5d4('0x1f')](function(_0x18041b){return _0x18041b;});}return null;};}function removeEntity(_0x489ffd,_0x1a51de){return function(_0x242b7e){if(_0x242b7e){return _0x242b7e[_0xe5d4('0x20')]()[_0xe5d4('0x1f')](function(){var _0x2ad9da=_0x242b7e[_0xe5d4('0x21')]({'plain':!![]});var _0x29b861=_0xe5d4('0x22');return db['UserProfileResource'][_0xe5d4('0x20')]({'where':{'type':_0x29b861,'resourceId':_0x2ad9da['id']}})[_0xe5d4('0x1f')](function(){return _0x242b7e;});})[_0xe5d4('0x1f')](function(){_0x489ffd[_0xe5d4('0x15')](0xcc)[_0xe5d4('0x23')]();});}};}function handleEntityNotFound(_0x336adb,_0xfa8d7){return function(_0x2db6df){if(!_0x2db6df){_0x336adb['sendStatus'](0x194);}return _0x2db6df;};}function handleError(_0x30654d,_0x25f04b){_0x25f04b=_0x25f04b||0x1f4;return function(_0x3e43ab){logger[_0xe5d4('0x24')](_0x3e43ab['stack']);if(_0x3e43ab[_0xe5d4('0x25')]){delete _0x3e43ab[_0xe5d4('0x25')];}_0x30654d['status'](_0x25f04b)[_0xe5d4('0x26')](_0x3e43ab);};}exports[_0xe5d4('0x27')]=function(_0x2c84a8,_0x5f56ec){var _0x4bd9a4={},_0x173b8b={},_0x29f47b={'count':0x0,'rows':[]};var _0xc815db=_['map'](db['CmContactHasItem'][_0xe5d4('0x28')],function(_0x41ac1b){return{'name':_0x41ac1b[_0xe5d4('0x29')],'type':_0x41ac1b[_0xe5d4('0x2a')][_0xe5d4('0x2b')]};});_0x173b8b[_0xe5d4('0x2c')]=_[_0xe5d4('0x2d')](_0xc815db,_0xe5d4('0x25'));_0x173b8b['query']=_[_0xe5d4('0x2e')](_0x2c84a8[_0xe5d4('0x2f')]);_0x173b8b[_0xe5d4('0x30')]=_['intersection'](_0x173b8b[_0xe5d4('0x2c')],_0x173b8b['query']);_0x4bd9a4[_0xe5d4('0x31')]=_[_0xe5d4('0x32')](_0x173b8b[_0xe5d4('0x2c')],qs['fields'](_0x2c84a8['query'][_0xe5d4('0x33')]));_0x4bd9a4[_0xe5d4('0x31')]=_0x4bd9a4[_0xe5d4('0x31')][_0xe5d4('0x34')]?_0x4bd9a4['attributes']:_0x173b8b[_0xe5d4('0x2c')];if(!_0x2c84a8['query'][_0xe5d4('0x35')](_0xe5d4('0x36'))){_0x4bd9a4[_0xe5d4('0x18')]=qs[_0xe5d4('0x18')](_0x2c84a8[_0xe5d4('0x2f')][_0xe5d4('0x18')]);_0x4bd9a4[_0xe5d4('0x17')]=qs['offset'](_0x2c84a8['query']['offset']);}_0x4bd9a4[_0xe5d4('0x37')]=qs[_0xe5d4('0x38')](_0x2c84a8[_0xe5d4('0x2f')][_0xe5d4('0x38')]);_0x4bd9a4['where']=qs[_0xe5d4('0x30')](_[_0xe5d4('0x39')](_0x2c84a8['query'],_0x173b8b['filters']),_0xc815db);if(_0x2c84a8[_0xe5d4('0x2f')][_0xe5d4('0x3a')]){_0x4bd9a4[_0xe5d4('0x3b')]=_[_0xe5d4('0x3c')](_0x4bd9a4[_0xe5d4('0x3b')],{'$or':_[_0xe5d4('0x2d')](_0xc815db,function(_0x5adcd9){if(_0x5adcd9[_0xe5d4('0x2a')]!=='VIRTUAL'){var _0x3007b6={};_0x3007b6[_0x5adcd9[_0xe5d4('0x25')]]={'$like':'%'+_0x2c84a8[_0xe5d4('0x2f')]['filter']+'%'};return _0x3007b6;}})});}_0x4bd9a4=_['merge']({},_0x4bd9a4,_0x2c84a8['options']);var _0x41fe82={'where':_0x4bd9a4[_0xe5d4('0x3b')]};return db['CmContactHasItem'][_0xe5d4('0x1a')](_0x41fe82)[_0xe5d4('0x1f')](function(_0x3517b7){_0x29f47b['count']=_0x3517b7;if(_0x2c84a8['query']['includeAll']){_0x4bd9a4[_0xe5d4('0x3d')]=[{'all':!![]}];}return db['CmContactHasItem']['findAll'](_0x4bd9a4);})[_0xe5d4('0x1f')](function(_0x214166){_0x29f47b[_0xe5d4('0x3e')]=_0x214166;return _0x29f47b;})['then'](respondWithFilteredResult(_0x5f56ec,_0x4bd9a4))['catch'](handleError(_0x5f56ec,null));};exports['show']=function(_0x48af99,_0x10b27f){var _0x25ac9a={'raw':!![],'where':{'id':_0x48af99[_0xe5d4('0x3f')]['id']}},_0x2e4207={};_0x2e4207[_0xe5d4('0x2c')]=_[_0xe5d4('0x2e')](db[_0xe5d4('0x40')][_0xe5d4('0x28')]);_0x2e4207['query']=_[_0xe5d4('0x2e')](_0x48af99['query']);_0x2e4207[_0xe5d4('0x30')]=_['intersection'](_0x2e4207['model'],_0x2e4207[_0xe5d4('0x2f')]);_0x25ac9a['attributes']=_[_0xe5d4('0x32')](_0x2e4207[_0xe5d4('0x2c')],qs['fields'](_0x48af99[_0xe5d4('0x2f')][_0xe5d4('0x33')]));_0x25ac9a[_0xe5d4('0x31')]=_0x25ac9a[_0xe5d4('0x31')]['length']?_0x25ac9a[_0xe5d4('0x31')]:_0x2e4207['model'];if(_0x48af99['query'][_0xe5d4('0x41')]){_0x25ac9a[_0xe5d4('0x3d')]=[{'all':!![]}];}_0x25ac9a=_[_0xe5d4('0x3c')]({},_0x25ac9a,_0x48af99[_0xe5d4('0x42')]);return db['CmContactHasItem']['find'](_0x25ac9a)[_0xe5d4('0x1f')](handleEntityNotFound(_0x10b27f,null))[_0xe5d4('0x1f')](respondWithResult(_0x10b27f,null))[_0xe5d4('0x43')](handleError(_0x10b27f,null));};exports[_0xe5d4('0x44')]=function(_0x58e623,_0x104bf6){return db['CmContactHasItem'][_0xe5d4('0x44')](_0x58e623[_0xe5d4('0x45')],{})['then'](function(_0x5c5552){var _0x2f240f=_0x58e623[_0xe5d4('0x46')]['get']({'plain':!![]});if(!_0x2f240f)throw new Error(_0xe5d4('0x47'));if(_0x2f240f[_0xe5d4('0x48')]==='user'){var _0x20c14d=_0x5c5552[_0xe5d4('0x21')]({'plain':!![]});var _0x2af53c=_0xe5d4('0x22');return db[_0xe5d4('0x49')][_0xe5d4('0x4a')]({'where':{'name':_0x2af53c,'userProfileId':_0x2f240f['userProfileId']},'raw':!![]})['then'](function(_0x31a2f5){if(_0x31a2f5&&_0x31a2f5[_0xe5d4('0x4b')]===0x0){return db[_0xe5d4('0x4c')][_0xe5d4('0x44')]({'name':_0x20c14d[_0xe5d4('0x25')],'resourceId':_0x20c14d['id'],'type':_0x31a2f5[_0xe5d4('0x25')],'sectionId':_0x31a2f5['id']},{})[_0xe5d4('0x1f')](function(){return _0x5c5552;});}else{return _0x5c5552;}})[_0xe5d4('0x43')](function(_0x5bc8f3){logger[_0xe5d4('0x24')](_0xe5d4('0x4d'),_0x5bc8f3);throw _0x5bc8f3;});}return _0x5c5552;})[_0xe5d4('0x1f')](respondWithResult(_0x104bf6,0xc9))[_0xe5d4('0x43')](handleError(_0x104bf6,null));};exports[_0xe5d4('0x4e')]=function(_0x1963dc,_0x56f7ac){if(_0x1963dc[_0xe5d4('0x45')]['id']){delete _0x1963dc[_0xe5d4('0x45')]['id'];}return db[_0xe5d4('0x40')]['find']({'where':{'id':_0x1963dc['params']['id']}})[_0xe5d4('0x1f')](handleEntityNotFound(_0x56f7ac,null))[_0xe5d4('0x1f')](saveUpdates(_0x1963dc[_0xe5d4('0x45')],null))[_0xe5d4('0x1f')](respondWithResult(_0x56f7ac,null))[_0xe5d4('0x43')](handleError(_0x56f7ac,null));};exports[_0xe5d4('0x20')]=function(_0x321069,_0x4feab9){return db[_0xe5d4('0x40')][_0xe5d4('0x4a')]({'where':{'id':_0x321069[_0xe5d4('0x3f')]['id']}})[_0xe5d4('0x1f')](handleEntityNotFound(_0x4feab9,null))[_0xe5d4('0x1f')](removeEntity(_0x4feab9,null))[_0xe5d4('0x43')](handleError(_0x4feab9,null));}; \ No newline at end of file +var _0x2b0f=['show','params','includeAll','find','create','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','Content-Range','reject','update','then','destroy','get','CmContactHasItems','UserProfileResource','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','where','pick','filter','merge','VIRTUAL','options','CmContactHasItem','findAll','rows','catch'];(function(_0x35aaf9,_0x3efa26){var _0x32e3ca=function(_0x5d1ebe){while(--_0x5d1ebe){_0x35aaf9['push'](_0x35aaf9['shift']());}};_0x32e3ca(++_0x3efa26);}(_0x2b0f,0x9f));var _0xf2b0=function(_0x4b768b,_0x2dc219){_0x4b768b=_0x4b768b-0x0;var _0x1ceca2=_0x2b0f[_0x4b768b];return _0x1ceca2;};'use strict';var emlformat=require(_0xf2b0('0x0'));var rimraf=require(_0xf2b0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf2b0('0x2'));var rp=require(_0xf2b0('0x3'));var moment=require(_0xf2b0('0x4'));var BPromise=require(_0xf2b0('0x5'));var Mustache=require(_0xf2b0('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf2b0('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf2b0('0x8'));var squel=require(_0xf2b0('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf2b0('0xa'));var toCsv=require('to-csv');var querystring=require(_0xf2b0('0xb'));var Papa=require(_0xf2b0('0xc'));var Redis=require(_0xf2b0('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xf2b0('0xe'));var as=require(_0xf2b0('0xf'));var hardwareService=require(_0xf2b0('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xf2b0('0x11'));var config=require(_0xf2b0('0x12'));var licenseUtil=require(_0xf2b0('0x13'));var db=require(_0xf2b0('0x14'))['db'];function respondWithStatusCode(_0x5d3a93,_0x2193a9){_0x2193a9=_0x2193a9||0xcc;return function(_0x42ed2e){if(_0x42ed2e){return _0x5d3a93[_0xf2b0('0x15')](_0x2193a9);}return _0x5d3a93[_0xf2b0('0x16')](_0x2193a9)[_0xf2b0('0x17')]();};}function respondWithResult(_0x3b911d,_0x35d074){_0x35d074=_0x35d074||0xc8;return function(_0x19e95c){if(_0x19e95c){return _0x3b911d['status'](_0x35d074)[_0xf2b0('0x18')](_0x19e95c);}};}function respondWithFilteredResult(_0x1b201d,_0x470a8e){return function(_0x4e4666){if(_0x4e4666){var _0x131fbd=typeof _0x470a8e[_0xf2b0('0x19')]==='undefined'&&typeof _0x470a8e[_0xf2b0('0x1a')]==='undefined';var _0x25192a=_0x4e4666[_0xf2b0('0x1b')];var _0x28d204=_0x131fbd?0x0:_0x470a8e[_0xf2b0('0x19')];var _0x3bb000=_0x131fbd?_0x4e4666[_0xf2b0('0x1b')]:_0x470a8e[_0xf2b0('0x19')]+_0x470a8e[_0xf2b0('0x1a')];var _0x21a9cc;if(_0x3bb000>=_0x25192a){_0x3bb000=_0x25192a;_0x21a9cc=0xc8;}else{_0x21a9cc=0xce;}_0x1b201d[_0xf2b0('0x16')](_0x21a9cc);return _0x1b201d['set'](_0xf2b0('0x1c'),_0x28d204+'-'+_0x3bb000+'/'+_0x25192a)[_0xf2b0('0x18')](_0x4e4666);}return null;};}function patchUpdates(_0x3ba7a5){return function(_0x3f443e){try{jsonpatch['apply'](_0x3f443e,_0x3ba7a5,!![]);}catch(_0x2b1584){return BPromise[_0xf2b0('0x1d')](_0x2b1584);}return _0x3f443e['save']();};}function saveUpdates(_0x3c5d45,_0x5a02af){return function(_0x3a3eb7){if(_0x3a3eb7){return _0x3a3eb7[_0xf2b0('0x1e')](_0x3c5d45)[_0xf2b0('0x1f')](function(_0x267008){return _0x267008;});}return null;};}function removeEntity(_0x5b85c9,_0x521fd5){return function(_0x5e9c5c){if(_0x5e9c5c){return _0x5e9c5c[_0xf2b0('0x20')]()[_0xf2b0('0x1f')](function(){var _0x571aea=_0x5e9c5c[_0xf2b0('0x21')]({'plain':!![]});var _0x27e12b=_0xf2b0('0x22');return db[_0xf2b0('0x23')]['destroy']({'where':{'type':_0x27e12b,'resourceId':_0x571aea['id']}})['then'](function(){return _0x5e9c5c;});})[_0xf2b0('0x1f')](function(){_0x5b85c9[_0xf2b0('0x16')](0xcc)[_0xf2b0('0x17')]();});}};}function handleEntityNotFound(_0x44c9ce,_0x168cee){return function(_0x53031a){if(!_0x53031a){_0x44c9ce[_0xf2b0('0x15')](0x194);}return _0x53031a;};}function handleError(_0xafbe48,_0x5a63d2){_0x5a63d2=_0x5a63d2||0x1f4;return function(_0x9e4815){logger[_0xf2b0('0x24')](_0x9e4815[_0xf2b0('0x25')]);if(_0x9e4815['name']){delete _0x9e4815[_0xf2b0('0x26')];}_0xafbe48['status'](_0x5a63d2)[_0xf2b0('0x27')](_0x9e4815);};}exports[_0xf2b0('0x28')]=function(_0x154a65,_0xc9bec9){var _0x1fc1e5={},_0x52185c={},_0x4629c2={'count':0x0,'rows':[]};var _0x545c62=_[_0xf2b0('0x29')](db['CmContactHasItem']['rawAttributes'],function(_0xea5b45){return{'name':_0xea5b45[_0xf2b0('0x2a')],'type':_0xea5b45[_0xf2b0('0x2b')][_0xf2b0('0x2c')]};});_0x52185c[_0xf2b0('0x2d')]=_['map'](_0x545c62,_0xf2b0('0x26'));_0x52185c[_0xf2b0('0x2e')]=_[_0xf2b0('0x2f')](_0x154a65[_0xf2b0('0x2e')]);_0x52185c[_0xf2b0('0x30')]=_['intersection'](_0x52185c[_0xf2b0('0x2d')],_0x52185c['query']);_0x1fc1e5['attributes']=_[_0xf2b0('0x31')](_0x52185c['model'],qs[_0xf2b0('0x32')](_0x154a65[_0xf2b0('0x2e')][_0xf2b0('0x32')]));_0x1fc1e5[_0xf2b0('0x33')]=_0x1fc1e5['attributes']['length']?_0x1fc1e5['attributes']:_0x52185c[_0xf2b0('0x2d')];if(!_0x154a65['query'][_0xf2b0('0x34')]('nolimit')){_0x1fc1e5['limit']=qs[_0xf2b0('0x1a')](_0x154a65['query'][_0xf2b0('0x1a')]);_0x1fc1e5[_0xf2b0('0x19')]=qs[_0xf2b0('0x19')](_0x154a65[_0xf2b0('0x2e')][_0xf2b0('0x19')]);}_0x1fc1e5['order']=qs['sort'](_0x154a65[_0xf2b0('0x2e')]['sort']);_0x1fc1e5[_0xf2b0('0x35')]=qs['filters'](_[_0xf2b0('0x36')](_0x154a65[_0xf2b0('0x2e')],_0x52185c[_0xf2b0('0x30')]),_0x545c62);if(_0x154a65['query'][_0xf2b0('0x37')]){_0x1fc1e5[_0xf2b0('0x35')]=_[_0xf2b0('0x38')](_0x1fc1e5[_0xf2b0('0x35')],{'$or':_[_0xf2b0('0x29')](_0x545c62,function(_0x19dcb0){if(_0x19dcb0[_0xf2b0('0x2b')]!==_0xf2b0('0x39')){var _0x5341da={};_0x5341da[_0x19dcb0[_0xf2b0('0x26')]]={'$like':'%'+_0x154a65[_0xf2b0('0x2e')][_0xf2b0('0x37')]+'%'};return _0x5341da;}})});}_0x1fc1e5=_[_0xf2b0('0x38')]({},_0x1fc1e5,_0x154a65[_0xf2b0('0x3a')]);var _0x2fe8d9={'where':_0x1fc1e5[_0xf2b0('0x35')]};return db[_0xf2b0('0x3b')][_0xf2b0('0x1b')](_0x2fe8d9)[_0xf2b0('0x1f')](function(_0x4cbd7e){_0x4629c2['count']=_0x4cbd7e;if(_0x154a65[_0xf2b0('0x2e')]['includeAll']){_0x1fc1e5['include']=[{'all':!![]}];}return db['CmContactHasItem'][_0xf2b0('0x3c')](_0x1fc1e5);})[_0xf2b0('0x1f')](function(_0x4e0c2a){_0x4629c2[_0xf2b0('0x3d')]=_0x4e0c2a;return _0x4629c2;})[_0xf2b0('0x1f')](respondWithFilteredResult(_0xc9bec9,_0x1fc1e5))[_0xf2b0('0x3e')](handleError(_0xc9bec9,null));};exports[_0xf2b0('0x3f')]=function(_0x46e7a9,_0x55fe70){var _0x56d684={'raw':!![],'where':{'id':_0x46e7a9[_0xf2b0('0x40')]['id']}},_0xba3cb4={};_0xba3cb4[_0xf2b0('0x2d')]=_[_0xf2b0('0x2f')](db[_0xf2b0('0x3b')]['rawAttributes']);_0xba3cb4[_0xf2b0('0x2e')]=_[_0xf2b0('0x2f')](_0x46e7a9['query']);_0xba3cb4[_0xf2b0('0x30')]=_[_0xf2b0('0x31')](_0xba3cb4['model'],_0xba3cb4[_0xf2b0('0x2e')]);_0x56d684[_0xf2b0('0x33')]=_[_0xf2b0('0x31')](_0xba3cb4['model'],qs['fields'](_0x46e7a9[_0xf2b0('0x2e')][_0xf2b0('0x32')]));_0x56d684[_0xf2b0('0x33')]=_0x56d684['attributes']['length']?_0x56d684[_0xf2b0('0x33')]:_0xba3cb4[_0xf2b0('0x2d')];if(_0x46e7a9[_0xf2b0('0x2e')][_0xf2b0('0x41')]){_0x56d684['include']=[{'all':!![]}];}_0x56d684=_[_0xf2b0('0x38')]({},_0x56d684,_0x46e7a9[_0xf2b0('0x3a')]);return db[_0xf2b0('0x3b')][_0xf2b0('0x42')](_0x56d684)[_0xf2b0('0x1f')](handleEntityNotFound(_0x55fe70,null))[_0xf2b0('0x1f')](respondWithResult(_0x55fe70,null))[_0xf2b0('0x3e')](handleError(_0x55fe70,null));};exports[_0xf2b0('0x43')]=function(_0x318025,_0x24b4a7){return db[_0xf2b0('0x3b')][_0xf2b0('0x43')](_0x318025['body'],{})['then'](function(_0x1a27fb){var _0x40f987=_0x318025[_0xf2b0('0x44')][_0xf2b0('0x21')]({'plain':!![]});if(!_0x40f987)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40f987['role']===_0xf2b0('0x44')){var _0x841f4a=_0x1a27fb[_0xf2b0('0x21')]({'plain':!![]});var _0x41d1a0='CmContactHasItems';return db[_0xf2b0('0x45')][_0xf2b0('0x42')]({'where':{'name':_0x41d1a0,'userProfileId':_0x40f987[_0xf2b0('0x46')]},'raw':!![]})[_0xf2b0('0x1f')](function(_0x410ed2){if(_0x410ed2&&_0x410ed2[_0xf2b0('0x47')]===0x0){return db[_0xf2b0('0x23')][_0xf2b0('0x43')]({'name':_0x841f4a['name'],'resourceId':_0x841f4a['id'],'type':_0x410ed2[_0xf2b0('0x26')],'sectionId':_0x410ed2['id']},{})[_0xf2b0('0x1f')](function(){return _0x1a27fb;});}else{return _0x1a27fb;}})[_0xf2b0('0x3e')](function(_0x111668){logger[_0xf2b0('0x24')](_0xf2b0('0x48'),_0x111668);throw _0x111668;});}return _0x1a27fb;})['then'](respondWithResult(_0x24b4a7,0xc9))[_0xf2b0('0x3e')](handleError(_0x24b4a7,null));};exports[_0xf2b0('0x1e')]=function(_0x21f088,_0x5a7cf3){if(_0x21f088[_0xf2b0('0x49')]['id']){delete _0x21f088[_0xf2b0('0x49')]['id'];}return db['CmContactHasItem'][_0xf2b0('0x42')]({'where':{'id':_0x21f088[_0xf2b0('0x40')]['id']}})['then'](handleEntityNotFound(_0x5a7cf3,null))[_0xf2b0('0x1f')](saveUpdates(_0x21f088['body'],null))[_0xf2b0('0x1f')](respondWithResult(_0x5a7cf3,null))[_0xf2b0('0x3e')](handleError(_0x5a7cf3,null));};exports[_0xf2b0('0x20')]=function(_0xc282a5,_0x4b0d76){return db[_0xf2b0('0x3b')][_0xf2b0('0x42')]({'where':{'id':_0xc282a5[_0xf2b0('0x40')]['id']}})[_0xf2b0('0x1f')](handleEntityNotFound(_0x4b0d76,null))[_0xf2b0('0x1f')](removeEntity(_0x4b0d76,null))[_0xf2b0('0x3e')](handleError(_0x4b0d76,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index dfc8f2a..ac89971 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2596=['CmContactHasItem','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmContactHasItem.attributes','define'];(function(_0x43c59d,_0x19dca9){var _0x5a6997=function(_0x5c5c2a){while(--_0x5c5c2a){_0x43c59d['push'](_0x43c59d['shift']());}};_0x5a6997(++_0x19dca9);}(_0x2596,0xe5));var _0x6259=function(_0x553a87,_0x1d621f){_0x553a87=_0x553a87-0x0;var _0x12d1e6=_0x2596[_0x553a87];return _0x12d1e6;};'use strict';var _=require(_0x6259('0x0'));var util=require(_0x6259('0x1'));var logger=require(_0x6259('0x2'))(_0x6259('0x3'));var moment=require(_0x6259('0x4'));var BPromise=require(_0x6259('0x5'));var rp=require(_0x6259('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6259('0x7'));var config=require(_0x6259('0x8'));var attributes=require(_0x6259('0x9'));module['exports']=function(_0x2ba1b5,_0x40b510){return _0x2ba1b5[_0x6259('0xa')](_0x6259('0xb'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98d1=['rimraf','../../config/environment','exports','define','CmContactHasItem','cm_contact_has_items','../../config/logger','bluebird','path'];(function(_0x1521be,_0x4f8835){var _0x5c248a=function(_0x4c7cc2){while(--_0x4c7cc2){_0x1521be['push'](_0x1521be['shift']());}};_0x5c248a(++_0x4f8835);}(_0x98d1,0x102));var _0x198d=function(_0x31bc6c,_0x9901dc){_0x31bc6c=_0x31bc6c-0x0;var _0x553de0=_0x98d1[_0x31bc6c];return _0x553de0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x198d('0x0'))('api');var moment=require('moment');var BPromise=require(_0x198d('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x198d('0x2'));var rimraf=require(_0x198d('0x3'));var config=require(_0x198d('0x4'));var attributes=require('./cmContactHasItem.attributes');module[_0x198d('0x5')]=function(_0x5d8e83,_0x3d008d){return _0x5d8e83[_0x198d('0x6')](_0x198d('0x7'),attributes,{'tableName':_0x198d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 9413074..92a9a2c 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa3d4=['code','message','lodash','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x32443e,_0x2d7d32){var _0x2aa089=function(_0x5d5924){while(--_0x5d5924){_0x32443e['push'](_0x32443e['shift']());}};_0x2aa089(++_0x2d7d32);}(_0xa3d4,0x8a));var _0x4a3d=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xa3d4[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x4a3d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4a3d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4a3d('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x4a3d('0x3'));var logger=require(_0x4a3d('0x4'))(_0x4a3d('0x5'));var config=require(_0x4a3d('0x6'));var jayson=require(_0x4a3d('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1dc5ae,_0xdf4e09,_0x20427f){return new BPromise(function(_0x1eabb7,_0x4ec4fa){return client[_0x4a3d('0x8')](_0x1dc5ae,_0x20427f)[_0x4a3d('0x9')](function(_0x4f44af){logger[_0x4a3d('0xa')](_0x4a3d('0xb'),_0xdf4e09,_0x4a3d('0xc'));logger['debug']('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0xdf4e09,_0x4a3d('0xc'),JSON[_0x4a3d('0xd')](_0x4f44af));if(_0x4f44af['error']){if(_0x4f44af[_0x4a3d('0xe')][_0x4a3d('0xf')]===0x1f4){logger[_0x4a3d('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0xdf4e09,_0x4f44af['error'][_0x4a3d('0x10')]);return _0x4ec4fa(_0x4f44af[_0x4a3d('0xe')]['message']);}logger['error'](_0x4a3d('0xb'),_0xdf4e09,_0x4f44af[_0x4a3d('0xe')][_0x4a3d('0x10')]);return _0x1eabb7(_0x4f44af[_0x4a3d('0xe')][_0x4a3d('0x10')]);}else{logger[_0x4a3d('0xa')](_0x4a3d('0xb'),_0xdf4e09,_0x4a3d('0xc'));_0x1eabb7(_0x4f44af['result']['message']);}})['catch'](function(_0x3664ed){logger[_0x4a3d('0xe')](_0x4a3d('0xb'),_0xdf4e09,_0x3664ed);_0x4ec4fa(_0x3664ed);});});} \ No newline at end of file +var _0x19ee=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x19ee,0xb0));var _0xe19e=function(_0x5d72da,_0xb7ce32){_0x5d72da=_0x5d72da-0x0;var _0x43ebe7=_0x19ee[_0x5d72da];return _0x43ebe7;};'use strict';var _=require(_0xe19e('0x0'));var util=require('util');var moment=require(_0xe19e('0x1'));var BPromise=require(_0xe19e('0x2'));var rs=require(_0xe19e('0x3'));var fs=require('fs');var Redis=require(_0xe19e('0x4'));var db=require(_0xe19e('0x5'))['db'];var utils=require(_0xe19e('0x6'));var logger=require(_0xe19e('0x7'))(_0xe19e('0x8'));var config=require(_0xe19e('0x9'));var jayson=require(_0xe19e('0xa'));var client=jayson[_0xe19e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f450d,_0x196e6e,_0x414a2c){return new BPromise(function(_0x4e6ce9,_0x9b2f84){return client[_0xe19e('0xc')](_0x2f450d,_0x414a2c)[_0xe19e('0xd')](function(_0x100457){logger[_0xe19e('0xe')](_0xe19e('0xf'),_0x196e6e,_0xe19e('0x10'));logger[_0xe19e('0x11')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x196e6e,_0xe19e('0x10'),JSON[_0xe19e('0x12')](_0x100457));if(_0x100457[_0xe19e('0x13')]){if(_0x100457[_0xe19e('0x13')]['code']===0x1f4){logger[_0xe19e('0x13')](_0xe19e('0xf'),_0x196e6e,_0x100457[_0xe19e('0x13')][_0xe19e('0x14')]);return _0x9b2f84(_0x100457[_0xe19e('0x13')][_0xe19e('0x14')]);}logger[_0xe19e('0x13')](_0xe19e('0xf'),_0x196e6e,_0x100457[_0xe19e('0x13')][_0xe19e('0x14')]);return _0x4e6ce9(_0x100457['error']['message']);}else{logger[_0xe19e('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0x196e6e,_0xe19e('0x10'));_0x4e6ce9(_0x100457[_0xe19e('0x15')][_0xe19e('0x14')]);}})['catch'](function(_0x350a04){logger[_0xe19e('0x13')](_0xe19e('0xf'),_0x196e6e,_0x350a04);_0x9b2f84(_0x350a04);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index ce087b4..f7edaf7 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd125=['show','create','put','update','destroy','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x587cef,_0x1a0c18){var _0x99e6ec=function(_0x5c0ca4){while(--_0x5c0ca4){_0x587cef['push'](_0x587cef['shift']());}};_0x99e6ec(++_0x1a0c18);}(_0xd125,0x176));var _0x5d12=function(_0x1340d5,_0x5e1f0b){_0x1340d5=_0x1340d5-0x0;var _0x58e35f=_0xd125[_0x1340d5];return _0x58e35f;};'use strict';var multer=require(_0x5d12('0x0'));var util=require(_0x5d12('0x1'));var path=require('path');var timeout=require(_0x5d12('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5d12('0x3'));var interaction=require(_0x5d12('0x4'));var config=require(_0x5d12('0x5'));var controller=require('./cmContactHasItem.controller');router[_0x5d12('0x6')]('/',auth[_0x5d12('0x7')](),controller[_0x5d12('0x8')]);router[_0x5d12('0x6')](_0x5d12('0x9'),auth['isAuthenticated'](),controller[_0x5d12('0xa')]);router['post']('/',auth[_0x5d12('0x7')](),controller[_0x5d12('0xb')]);router[_0x5d12('0xc')](_0x5d12('0x9'),auth[_0x5d12('0x7')](),controller[_0x5d12('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5d12('0xe')]);module[_0x5d12('0xf')]=router; \ No newline at end of file +var _0x96b8=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','show','create','put','/:id','update','delete','destroy','multer','util','path'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x96b8,0x179));var _0x896b=function(_0x440500,_0x1465b0){_0x440500=_0x440500-0x0;var _0x3411b5=_0x96b8[_0x440500];return _0x3411b5;};'use strict';var multer=require(_0x896b('0x0'));var util=require(_0x896b('0x1'));var path=require(_0x896b('0x2'));var timeout=require(_0x896b('0x3'));var express=require(_0x896b('0x4'));var router=express['Router']();var fs_extra=require(_0x896b('0x5'));var auth=require(_0x896b('0x6'));var interaction=require(_0x896b('0x7'));var config=require(_0x896b('0x8'));var controller=require(_0x896b('0x9'));router[_0x896b('0xa')]('/',auth[_0x896b('0xb')](),controller[_0x896b('0xc')]);router['get']('/:id',auth[_0x896b('0xb')](),controller[_0x896b('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x896b('0xe')]);router[_0x896b('0xf')](_0x896b('0x10'),auth['isAuthenticated'](),controller[_0x896b('0x11')]);router[_0x896b('0x12')]('/:id',auth[_0x896b('0xb')](),controller[_0x896b('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 995e718..22f5e42 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 _0x6ae9=['BOOLEAN','ENUM','voice','sequelize','exports','VIRTUAL','alias','name','STRING','TEXT','long','getDataValue','type','setDataValue','values','stringify'];(function(_0x415347,_0x342399){var _0x404730=function(_0x447e20){while(--_0x447e20){_0x415347['push'](_0x415347['shift']());}};_0x404730(++_0x342399);}(_0x6ae9,0x1d3));var _0x96ae=function(_0x4ececf,_0x416e36){_0x4ececf=_0x4ececf-0x0;var _0x8ff1d6=_0x6ae9[_0x4ececf];return _0x8ff1d6;};'use strict';var Sequelize=require(_0x96ae('0x0'));var _=require('lodash');module[_0x96ae('0x1')]={'name':{'type':Sequelize[_0x96ae('0x2')],'get':function(_0x5717e2){return this['getDataValue'](_0x96ae('0x3'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x54100b){this['setDataValue'](_0x96ae('0x3'),_0x54100b?_0x54100b:this['getDataValue'](_0x96ae('0x4')));}},'type':{'type':Sequelize[_0x96ae('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0x96ae('0x6')](_0x96ae('0x7')),'get':function(){if(this[_0x96ae('0x8')](_0x96ae('0x9'))==='select'){return JSON['parse'](this[_0x96ae('0x8')]('values'));}else{return this['getDataValue']('values');}},'set':function(_0x43a8f1){if(Array['isArray'](_0x43a8f1)){this[_0x96ae('0xa')](_0x96ae('0xb'),JSON[_0x96ae('0xc')](_0x43a8f1));}else{this[_0x96ae('0xa')](_0x96ae('0xb'),_0x43a8f1);}}},'required':{'type':Sequelize[_0x96ae('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x96ae('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x96ae('0xe')](_0x96ae('0xf'))}}; \ No newline at end of file +var _0x4277=['ENUM','voice','sequelize','exports','getDataValue','STRING','setDataValue','alias','name','TEXT','long','type','select','parse','values','stringify','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4277,0x9b));var _0x7427=function(_0x557f77,_0x2ff13f){_0x557f77=_0x557f77-0x0;var _0x166ce5=_0x4277[_0x557f77];return _0x166ce5;};'use strict';var Sequelize=require(_0x7427('0x0'));var _=require('lodash');module[_0x7427('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x42eafa){return this[_0x7427('0x2')]('alias');}},'alias':{'type':Sequelize[_0x7427('0x3')],'allowNull':![],'set':function(_0x56c3b0){this[_0x7427('0x4')](_0x7427('0x5'),_0x56c3b0?_0x56c3b0:this[_0x7427('0x2')](_0x7427('0x6')));}},'type':{'type':Sequelize[_0x7427('0x3')],'allowNull':![]},'values':{'type':Sequelize[_0x7427('0x7')](_0x7427('0x8')),'get':function(){if(this[_0x7427('0x2')](_0x7427('0x9'))===_0x7427('0xa')){return JSON[_0x7427('0xb')](this[_0x7427('0x2')](_0x7427('0xc')));}else{return this[_0x7427('0x2')](_0x7427('0xc'));}},'set':function(_0x4d858e){if(Array['isArray'](_0x4d858e)){this[_0x7427('0x4')](_0x7427('0xc'),JSON[_0x7427('0xd')](_0x4d858e));}else{this[_0x7427('0x4')](_0x7427('0xc'),_0x4d858e);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x7427('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x7427('0xf')](_0x7427('0x10'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 58c07a0..8cd598c 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 _0x41bd=['then','destroy','end','error','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','keys','filters','attributes','intersection','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','body','sequelize','transaction','Sequelize','TEXT','text','number','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','offset','limit','undefined','count','json','apply','reject','save','update'];(function(_0x3515b4,_0x1316a3){var _0x10c52f=function(_0x45c0d9){while(--_0x45c0d9){_0x3515b4['push'](_0x3515b4['shift']());}};_0x10c52f(++_0x1316a3);}(_0x41bd,0x8b));var _0xd41b=function(_0x13426c,_0x1057d8){_0x13426c=_0x13426c-0x0;var _0x398662=_0x41bd[_0x13426c];return _0x398662;};'use strict';var emlformat=require(_0xd41b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd41b('0x1'));var jsonpatch=require(_0xd41b('0x2'));var rp=require(_0xd41b('0x3'));var moment=require(_0xd41b('0x4'));var BPromise=require(_0xd41b('0x5'));var Mustache=require(_0xd41b('0x6'));var util=require(_0xd41b('0x7'));var path=require(_0xd41b('0x8'));var sox=require(_0xd41b('0x9'));var csv=require(_0xd41b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd41b('0xb'));var _=require(_0xd41b('0xc'));var squel=require('squel');var crypto=require(_0xd41b('0xd'));var jsforce=require(_0xd41b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd41b('0xa'));var querystring=require(_0xd41b('0xf'));var Papa=require('papaparse');var Redis=require(_0xd41b('0x10'));var authService=require(_0xd41b('0x11'));var qs=require(_0xd41b('0x12'));var as=require(_0xd41b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd41b('0x14'))(_0xd41b('0x15'));var utils=require(_0xd41b('0x16'));var config=require(_0xd41b('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xbdfe93,_0x29b18d){_0x29b18d=_0x29b18d||0xcc;return function(_0xc6d1a7){if(_0xc6d1a7){return _0xbdfe93[_0xd41b('0x18')](_0x29b18d);}return _0xbdfe93[_0xd41b('0x19')](_0x29b18d)['end']();};}function respondWithResult(_0x3dfda2,_0x1cb36b){_0x1cb36b=_0x1cb36b||0xc8;return function(_0x4c83c9){if(_0x4c83c9){return _0x3dfda2[_0xd41b('0x19')](_0x1cb36b)['json'](_0x4c83c9);}};}function respondWithFilteredResult(_0x4a464a,_0x2600ff){return function(_0x4fbac3){if(_0x4fbac3){var _0x55e852=typeof _0x2600ff[_0xd41b('0x1a')]==='undefined'&&typeof _0x2600ff[_0xd41b('0x1b')]===_0xd41b('0x1c');var _0x315f80=_0x4fbac3[_0xd41b('0x1d')];var _0x5d7393=_0x55e852?0x0:_0x2600ff[_0xd41b('0x1a')];var _0x3304c1=_0x55e852?_0x4fbac3['count']:_0x2600ff[_0xd41b('0x1a')]+_0x2600ff[_0xd41b('0x1b')];var _0x518833;if(_0x3304c1>=_0x315f80){_0x3304c1=_0x315f80;_0x518833=0xc8;}else{_0x518833=0xce;}_0x4a464a['status'](_0x518833);return _0x4a464a['set']('Content-Range',_0x5d7393+'-'+_0x3304c1+'/'+_0x315f80)[_0xd41b('0x1e')](_0x4fbac3);}return null;};}function patchUpdates(_0x1410be){return function(_0x421b1c){try{jsonpatch[_0xd41b('0x1f')](_0x421b1c,_0x1410be,!![]);}catch(_0x45dbd9){return BPromise[_0xd41b('0x20')](_0x45dbd9);}return _0x421b1c[_0xd41b('0x21')]();};}function saveUpdates(_0x3156e8,_0x27ffd0){return function(_0x11d844){if(_0x11d844){return _0x11d844[_0xd41b('0x22')](_0x3156e8)[_0xd41b('0x23')](function(_0xb5cc09){return _0xb5cc09;});}return null;};}function removeEntity(_0x381d4b,_0x34bdbb){return function(_0x26b441){if(_0x26b441){return _0x26b441[_0xd41b('0x24')]()[_0xd41b('0x23')](function(){_0x381d4b['status'](0xcc)[_0xd41b('0x25')]();});}};}function handleEntityNotFound(_0x104b1e,_0x303546){return function(_0x333b95){if(!_0x333b95){_0x104b1e['sendStatus'](0x194);}return _0x333b95;};}function handleError(_0x4d9757,_0x249041){_0x249041=_0x249041||0x1f4;return function(_0x2c0126){logger[_0xd41b('0x26')](_0x2c0126['stack']);if(_0x2c0126[_0xd41b('0x27')]){delete _0x2c0126['name'];}_0x4d9757[_0xd41b('0x19')](_0x249041)[_0xd41b('0x28')](_0x2c0126);};}exports[_0xd41b('0x29')]=function(_0x3e23d0,_0x44075b){var _0x471347={},_0x3196a8={},_0x33699b={'count':0x0,'rows':[]};var _0x1e2d8c=_[_0xd41b('0x2a')](db[_0xd41b('0x2b')][_0xd41b('0x2c')],function(_0x1ecaaf){return{'name':_0x1ecaaf[_0xd41b('0x2d')],'type':_0x1ecaaf[_0xd41b('0x2e')][_0xd41b('0x2f')]};});_0x3196a8[_0xd41b('0x30')]=_[_0xd41b('0x31')](_[_0xd41b('0x2a')](_0x1e2d8c,_0xd41b('0x27')),['name']);_0x3196a8['query']=_[_0xd41b('0x32')](_0x3e23d0['query']);_0x3196a8[_0xd41b('0x33')]=_['intersection'](_0x3196a8['model'],_0x3196a8['query']);_0x471347[_0xd41b('0x34')]=_[_0xd41b('0x35')](_0x3196a8[_0xd41b('0x30')],qs[_0xd41b('0x36')](_0x3e23d0[_0xd41b('0x37')][_0xd41b('0x36')]));_0x471347[_0xd41b('0x34')]=_0x471347[_0xd41b('0x34')][_0xd41b('0x38')]?_0x471347[_0xd41b('0x34')]:_0x3196a8['model'];if(!_0x3e23d0[_0xd41b('0x37')][_0xd41b('0x39')](_0xd41b('0x3a'))){_0x471347[_0xd41b('0x1b')]=qs[_0xd41b('0x1b')](_0x3e23d0[_0xd41b('0x37')]['limit']);_0x471347['offset']=qs[_0xd41b('0x1a')](_0x3e23d0['query'][_0xd41b('0x1a')]);}_0x471347[_0xd41b('0x3b')]=qs['sort'](_0x3e23d0['query'][_0xd41b('0x3c')]);_0x471347[_0xd41b('0x3d')]=qs[_0xd41b('0x33')](_[_0xd41b('0x3e')](_0x3e23d0['query'],_0x3196a8['filters']),_0x1e2d8c);if(_0x3e23d0[_0xd41b('0x37')][_0xd41b('0x3f')]){_0x471347[_0xd41b('0x3d')]=_['merge'](_0x471347[_0xd41b('0x3d')],{'$or':_['map'](_0x1e2d8c,function(_0x161d5a){if(_0x161d5a[_0xd41b('0x2e')]!=='VIRTUAL'){var _0x376a97={};_0x376a97[_0x161d5a[_0xd41b('0x27')]]={'$like':'%'+_0x3e23d0['query']['filter']+'%'};return _0x376a97;}})});}_0x471347=_[_0xd41b('0x40')]({},_0x471347,_0x3e23d0[_0xd41b('0x41')]);var _0x46c91e={'where':_0x471347[_0xd41b('0x3d')]};return db['CmCustomField'][_0xd41b('0x1d')](_0x46c91e)[_0xd41b('0x23')](function(_0x191b64){_0x33699b[_0xd41b('0x1d')]=_0x191b64;if(_0x3e23d0[_0xd41b('0x37')][_0xd41b('0x42')]){_0x471347[_0xd41b('0x43')]=[{'all':!![]}];}return db[_0xd41b('0x2b')][_0xd41b('0x44')](_0x471347);})['then'](function(_0x36b051){_0x33699b[_0xd41b('0x45')]=_0x36b051;return _0x33699b;})[_0xd41b('0x23')](respondWithFilteredResult(_0x44075b,_0x471347))[_0xd41b('0x46')](handleError(_0x44075b,null));};exports[_0xd41b('0x47')]=function(_0x3ca5fc,_0x2198b1){var _0x4c3205={'raw':!![],'where':{'id':_0x3ca5fc[_0xd41b('0x48')]['id']}},_0x154f8a={};_0x154f8a[_0xd41b('0x30')]=_[_0xd41b('0x32')](db[_0xd41b('0x2b')]['rawAttributes']);_0x154f8a['query']=_[_0xd41b('0x32')](_0x3ca5fc[_0xd41b('0x37')]);_0x154f8a[_0xd41b('0x33')]=_['intersection'](_0x154f8a[_0xd41b('0x30')],_0x154f8a[_0xd41b('0x37')]);_0x4c3205['attributes']=_[_0xd41b('0x35')](_0x154f8a[_0xd41b('0x30')],qs[_0xd41b('0x36')](_0x3ca5fc[_0xd41b('0x37')][_0xd41b('0x36')]));_0x4c3205['attributes']=_0x4c3205[_0xd41b('0x34')][_0xd41b('0x38')]?_0x4c3205['attributes']:_0x154f8a['model'];if(_0x3ca5fc[_0xd41b('0x37')][_0xd41b('0x42')]){_0x4c3205[_0xd41b('0x43')]=[{'all':!![]}];}_0x4c3205=_[_0xd41b('0x40')]({},_0x4c3205,_0x3ca5fc[_0xd41b('0x41')]);return db[_0xd41b('0x2b')][_0xd41b('0x49')](_0x4c3205)[_0xd41b('0x23')](handleEntityNotFound(_0x2198b1,null))[_0xd41b('0x23')](respondWithResult(_0x2198b1,null))[_0xd41b('0x46')](handleError(_0x2198b1,null));};exports['update']=function(_0x1e0844,_0x134490){if(_0x1e0844[_0xd41b('0x4a')]['id']){delete _0x1e0844['body']['id'];}return db[_0xd41b('0x2b')][_0xd41b('0x49')]({'where':{'id':_0x1e0844[_0xd41b('0x48')]['id']}})[_0xd41b('0x23')](handleEntityNotFound(_0x134490,null))[_0xd41b('0x23')](saveUpdates(_0x1e0844['body'],null))[_0xd41b('0x23')](respondWithResult(_0x134490,null))['catch'](handleError(_0x134490,null));};exports[_0xd41b('0x24')]=function(_0x52beb7,_0x31694a){return db[_0xd41b('0x2b')][_0xd41b('0x49')]({'where':{'id':_0x52beb7[_0xd41b('0x48')]['id']}})[_0xd41b('0x23')](handleEntityNotFound(_0x31694a,null))[_0xd41b('0x23')](removeEntity(_0x31694a,null))['catch'](handleError(_0x31694a,null));};exports['create']=function(_0x322a10,_0x4ab081){var _0x365435;return db[_0xd41b('0x4b')][_0xd41b('0x4c')](function(_0x8cdbc){return db[_0xd41b('0x2b')]['create'](_0x322a10['body'],{'transaction':_0x8cdbc})['then'](function(_0x1d795b){_0x365435=_0x1d795b;var _0x17f32b={'type':db[_0xd41b('0x4d')][_0xd41b('0x4e')],'transaction':_0x8cdbc};switch(_0x322a10['body'][_0xd41b('0x2e')]){case _0xd41b('0x4f'):_0x17f32b[_0xd41b('0x2e')]=db['Sequelize'][_0xd41b('0x4e')];break;case _0xd41b('0x50'):_0x17f32b['type']=db[_0xd41b('0x4d')]['INTEGER'];break;case'switch':_0x17f32b[_0xd41b('0x2e')]=db['Sequelize'][_0xd41b('0x51')];_0x17f32b[_0xd41b('0x52')]=![];break;default:}return db[_0xd41b('0x4b')][_0xd41b('0x53')][_0xd41b('0x54')](_0xd41b('0x55'),util[_0xd41b('0x56')]('cf_%d',_0x365435['id']),_0x17f32b);})['then'](function(){return _0x365435;});})[_0xd41b('0x23')](respondWithResult(_0x4ab081,0xc9))[_0xd41b('0x46')](handleError(_0x4ab081,null));}; \ No newline at end of file +var _0x853c=['findAll','rows','then','catch','show','keys','include','find','body','params','destroy','create','sequelize','Sequelize','TEXT','text','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','update','error','stack','name','map','CmCustomField','rawAttributes','differenceBy','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll'];(function(_0x8ad95e,_0x17e5d9){var _0x1b8fe5=function(_0x3ac49a){while(--_0x3ac49a){_0x8ad95e['push'](_0x8ad95e['shift']());}};_0x1b8fe5(++_0x17e5d9);}(_0x853c,0x162));var _0xc853=function(_0xc8a6c,_0x1f46eb){_0xc8a6c=_0xc8a6c-0x0;var _0x119c12=_0x853c[_0xc8a6c];return _0x119c12;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc853('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc853('0x1'));var rp=require(_0xc853('0x2'));var moment=require(_0xc853('0x3'));var BPromise=require(_0xc853('0x4'));var Mustache=require(_0xc853('0x5'));var util=require(_0xc853('0x6'));var path=require(_0xc853('0x7'));var sox=require(_0xc853('0x8'));var csv=require(_0xc853('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc853('0xa'));var squel=require(_0xc853('0xb'));var crypto=require(_0xc853('0xc'));var jsforce=require(_0xc853('0xd'));var deskjs=require(_0xc853('0xe'));var toCsv=require(_0xc853('0x9'));var querystring=require('querystring');var Papa=require(_0xc853('0xf'));var Redis=require(_0xc853('0x10'));var authService=require(_0xc853('0x11'));var qs=require(_0xc853('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc853('0x13'));var logger=require(_0xc853('0x14'))('api');var utils=require(_0xc853('0x15'));var config=require(_0xc853('0x16'));var licenseUtil=require(_0xc853('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17a5dc,_0xcd3c0e){_0xcd3c0e=_0xcd3c0e||0xcc;return function(_0x1abdee){if(_0x1abdee){return _0x17a5dc[_0xc853('0x18')](_0xcd3c0e);}return _0x17a5dc[_0xc853('0x19')](_0xcd3c0e)[_0xc853('0x1a')]();};}function respondWithResult(_0x5d45a1,_0x1d9283){_0x1d9283=_0x1d9283||0xc8;return function(_0x5e24c0){if(_0x5e24c0){return _0x5d45a1[_0xc853('0x19')](_0x1d9283)[_0xc853('0x1b')](_0x5e24c0);}};}function respondWithFilteredResult(_0x1f462d,_0x542610){return function(_0x2a372b){if(_0x2a372b){var _0x5b0ec0=typeof _0x542610[_0xc853('0x1c')]==='undefined'&&typeof _0x542610['limit']===_0xc853('0x1d');var _0xc5e421=_0x2a372b[_0xc853('0x1e')];var _0x4875b6=_0x5b0ec0?0x0:_0x542610[_0xc853('0x1c')];var _0x5a7e42=_0x5b0ec0?_0x2a372b[_0xc853('0x1e')]:_0x542610[_0xc853('0x1c')]+_0x542610[_0xc853('0x1f')];var _0x25e85a;if(_0x5a7e42>=_0xc5e421){_0x5a7e42=_0xc5e421;_0x25e85a=0xc8;}else{_0x25e85a=0xce;}_0x1f462d[_0xc853('0x19')](_0x25e85a);return _0x1f462d[_0xc853('0x20')]('Content-Range',_0x4875b6+'-'+_0x5a7e42+'/'+_0xc5e421)[_0xc853('0x1b')](_0x2a372b);}return null;};}function patchUpdates(_0x1e5414){return function(_0x16d4c5){try{jsonpatch[_0xc853('0x21')](_0x16d4c5,_0x1e5414,!![]);}catch(_0x442f40){return BPromise['reject'](_0x442f40);}return _0x16d4c5['save']();};}function saveUpdates(_0x2ddb99,_0x206a5f){return function(_0x82c2eb){if(_0x82c2eb){return _0x82c2eb[_0xc853('0x22')](_0x2ddb99)['then'](function(_0x7b5a75){return _0x7b5a75;});}return null;};}function removeEntity(_0x146e36,_0x2dab43){return function(_0x51ef9c){if(_0x51ef9c){return _0x51ef9c['destroy']()['then'](function(){_0x146e36['status'](0xcc)[_0xc853('0x1a')]();});}};}function handleEntityNotFound(_0x489fc1,_0x575a14){return function(_0x1b8afa){if(!_0x1b8afa){_0x489fc1['sendStatus'](0x194);}return _0x1b8afa;};}function handleError(_0x12a27c,_0x2b006a){_0x2b006a=_0x2b006a||0x1f4;return function(_0x25aecc){logger[_0xc853('0x23')](_0x25aecc[_0xc853('0x24')]);if(_0x25aecc['name']){delete _0x25aecc[_0xc853('0x25')];}_0x12a27c['status'](_0x2b006a)['send'](_0x25aecc);};}exports['index']=function(_0x1dd977,_0x2a0f9f){var _0x894a57={},_0x4cfafc={},_0x39c39d={'count':0x0,'rows':[]};var _0x4db132=_[_0xc853('0x26')](db[_0xc853('0x27')][_0xc853('0x28')],function(_0x4ef627){return{'name':_0x4ef627['fieldName'],'type':_0x4ef627['type']['key']};});_0x4cfafc['model']=_[_0xc853('0x29')](_[_0xc853('0x26')](_0x4db132,_0xc853('0x25')),[_0xc853('0x25')]);_0x4cfafc[_0xc853('0x2a')]=_['keys'](_0x1dd977[_0xc853('0x2a')]);_0x4cfafc[_0xc853('0x2b')]=_[_0xc853('0x2c')](_0x4cfafc[_0xc853('0x2d')],_0x4cfafc[_0xc853('0x2a')]);_0x894a57[_0xc853('0x2e')]=_[_0xc853('0x2c')](_0x4cfafc[_0xc853('0x2d')],qs[_0xc853('0x2f')](_0x1dd977['query']['fields']));_0x894a57[_0xc853('0x2e')]=_0x894a57['attributes'][_0xc853('0x30')]?_0x894a57[_0xc853('0x2e')]:_0x4cfafc[_0xc853('0x2d')];if(!_0x1dd977[_0xc853('0x2a')][_0xc853('0x31')](_0xc853('0x32'))){_0x894a57['limit']=qs['limit'](_0x1dd977[_0xc853('0x2a')][_0xc853('0x1f')]);_0x894a57[_0xc853('0x1c')]=qs[_0xc853('0x1c')](_0x1dd977['query']['offset']);}_0x894a57[_0xc853('0x33')]=qs[_0xc853('0x34')](_0x1dd977['query'][_0xc853('0x34')]);_0x894a57[_0xc853('0x35')]=qs[_0xc853('0x2b')](_[_0xc853('0x36')](_0x1dd977[_0xc853('0x2a')],_0x4cfafc['filters']),_0x4db132);if(_0x1dd977['query'][_0xc853('0x37')]){_0x894a57[_0xc853('0x35')]=_[_0xc853('0x38')](_0x894a57[_0xc853('0x35')],{'$or':_[_0xc853('0x26')](_0x4db132,function(_0x4b9344){if(_0x4b9344[_0xc853('0x39')]!==_0xc853('0x3a')){var _0x3678f3={};_0x3678f3[_0x4b9344[_0xc853('0x25')]]={'$like':'%'+_0x1dd977[_0xc853('0x2a')][_0xc853('0x37')]+'%'};return _0x3678f3;}})});}_0x894a57=_[_0xc853('0x38')]({},_0x894a57,_0x1dd977[_0xc853('0x3b')]);var _0x1dd8c6={'where':_0x894a57[_0xc853('0x35')]};return db[_0xc853('0x27')][_0xc853('0x1e')](_0x1dd8c6)['then'](function(_0x2b9896){_0x39c39d[_0xc853('0x1e')]=_0x2b9896;if(_0x1dd977[_0xc853('0x2a')][_0xc853('0x3c')]){_0x894a57['include']=[{'all':!![]}];}return db[_0xc853('0x27')][_0xc853('0x3d')](_0x894a57);})['then'](function(_0x30c597){_0x39c39d[_0xc853('0x3e')]=_0x30c597;return _0x39c39d;})[_0xc853('0x3f')](respondWithFilteredResult(_0x2a0f9f,_0x894a57))[_0xc853('0x40')](handleError(_0x2a0f9f,null));};exports[_0xc853('0x41')]=function(_0x488bb8,_0x336f24){var _0xb013bf={'raw':!![],'where':{'id':_0x488bb8['params']['id']}},_0x16a718={};_0x16a718[_0xc853('0x2d')]=_['keys'](db[_0xc853('0x27')]['rawAttributes']);_0x16a718[_0xc853('0x2a')]=_[_0xc853('0x42')](_0x488bb8[_0xc853('0x2a')]);_0x16a718[_0xc853('0x2b')]=_[_0xc853('0x2c')](_0x16a718[_0xc853('0x2d')],_0x16a718['query']);_0xb013bf[_0xc853('0x2e')]=_[_0xc853('0x2c')](_0x16a718[_0xc853('0x2d')],qs[_0xc853('0x2f')](_0x488bb8[_0xc853('0x2a')][_0xc853('0x2f')]));_0xb013bf[_0xc853('0x2e')]=_0xb013bf[_0xc853('0x2e')][_0xc853('0x30')]?_0xb013bf[_0xc853('0x2e')]:_0x16a718[_0xc853('0x2d')];if(_0x488bb8[_0xc853('0x2a')][_0xc853('0x3c')]){_0xb013bf[_0xc853('0x43')]=[{'all':!![]}];}_0xb013bf=_[_0xc853('0x38')]({},_0xb013bf,_0x488bb8[_0xc853('0x3b')]);return db['CmCustomField'][_0xc853('0x44')](_0xb013bf)['then'](handleEntityNotFound(_0x336f24,null))[_0xc853('0x3f')](respondWithResult(_0x336f24,null))[_0xc853('0x40')](handleError(_0x336f24,null));};exports[_0xc853('0x22')]=function(_0x28812b,_0x1f044f){if(_0x28812b[_0xc853('0x45')]['id']){delete _0x28812b[_0xc853('0x45')]['id'];}return db[_0xc853('0x27')][_0xc853('0x44')]({'where':{'id':_0x28812b[_0xc853('0x46')]['id']}})[_0xc853('0x3f')](handleEntityNotFound(_0x1f044f,null))[_0xc853('0x3f')](saveUpdates(_0x28812b[_0xc853('0x45')],null))['then'](respondWithResult(_0x1f044f,null))[_0xc853('0x40')](handleError(_0x1f044f,null));};exports[_0xc853('0x47')]=function(_0x281e19,_0x1ac3c0){return db['CmCustomField'][_0xc853('0x44')]({'where':{'id':_0x281e19[_0xc853('0x46')]['id']}})['then'](handleEntityNotFound(_0x1ac3c0,null))['then'](removeEntity(_0x1ac3c0,null))[_0xc853('0x40')](handleError(_0x1ac3c0,null));};exports[_0xc853('0x48')]=function(_0x435fe6,_0x5c844f){var _0x22bd81;return db[_0xc853('0x49')]['transaction'](function(_0x8622cb){return db[_0xc853('0x27')][_0xc853('0x48')](_0x435fe6[_0xc853('0x45')],{'transaction':_0x8622cb})[_0xc853('0x3f')](function(_0x5ca1e5){_0x22bd81=_0x5ca1e5;var _0x7f9785={'type':db[_0xc853('0x4a')][_0xc853('0x4b')],'transaction':_0x8622cb};switch(_0x435fe6['body'][_0xc853('0x39')]){case _0xc853('0x4c'):_0x7f9785['type']=db['Sequelize'][_0xc853('0x4b')];break;case'number':_0x7f9785['type']=db['Sequelize']['INTEGER'];break;case _0xc853('0x4d'):_0x7f9785[_0xc853('0x39')]=db[_0xc853('0x4a')][_0xc853('0x4e')];_0x7f9785[_0xc853('0x4f')]=![];break;default:}return db['sequelize']['queryInterface'][_0xc853('0x50')](_0xc853('0x51'),util[_0xc853('0x52')]('cf_%d',_0x22bd81['id']),_0x7f9785);})[_0xc853('0x3f')](function(){return _0x22bd81;});})[_0xc853('0x3f')](respondWithResult(_0x5c844f,0xc9))[_0xc853('0x40')](handleError(_0x5c844f,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 77f9a15..b0f68d8 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 _0x8229=['exports','define','CmCustomField','cm_custom_fields','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./cmCustomField.attributes'];(function(_0x5b4718,_0x2ac899){var _0x498f68=function(_0x10d93c){while(--_0x10d93c){_0x5b4718['push'](_0x5b4718['shift']());}};_0x498f68(++_0x2ac899);}(_0x8229,0xee));var _0x9822=function(_0x4d8267,_0x45e57a){_0x4d8267=_0x4d8267-0x0;var _0x3ce802=_0x8229[_0x4d8267];return _0x3ce802;};'use strict';var _=require(_0x9822('0x0'));var util=require(_0x9822('0x1'));var logger=require('../../config/logger')(_0x9822('0x2'));var moment=require(_0x9822('0x3'));var BPromise=require(_0x9822('0x4'));var rp=require(_0x9822('0x5'));var fs=require('fs');var path=require(_0x9822('0x6'));var rimraf=require(_0x9822('0x7'));var config=require('../../config/environment');var attributes=require(_0x9822('0x8'));module[_0x9822('0x9')]=function(_0x28bdc2,_0x58831f){return _0x28bdc2[_0x9822('0xa')](_0x9822('0xb'),attributes,{'tableName':_0x9822('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5060=['rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','util','api','bluebird','request-promise','path'];(function(_0x39c73a,_0x67e214){var _0x585871=function(_0x2081ea){while(--_0x2081ea){_0x39c73a['push'](_0x39c73a['shift']());}};_0x585871(++_0x67e214);}(_0x5060,0x1ce));var _0x0506=function(_0x3f520d,_0x10ba9b){_0x3f520d=_0x3f520d-0x0;var _0x409f64=_0x5060[_0x3f520d];return _0x409f64;};'use strict';var _=require(_0x0506('0x0'));var util=require(_0x0506('0x1'));var logger=require('../../config/logger')(_0x0506('0x2'));var moment=require('moment');var BPromise=require(_0x0506('0x3'));var rp=require(_0x0506('0x4'));var fs=require('fs');var path=require(_0x0506('0x5'));var rimraf=require(_0x0506('0x6'));var config=require(_0x0506('0x7'));var attributes=require(_0x0506('0x8'));module[_0x0506('0x9')]=function(_0x349896,_0x30b46a){return _0x349896[_0x0506('0xa')](_0x0506('0xb'),attributes,{'tableName':_0x0506('0xc'),'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 30c720c..f8a6d0b 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 _0x83ec=['moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','info','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x83ec,0xee));var _0xc83e=function(_0x29c028,_0x5a5327){_0x29c028=_0x29c028-0x0;var _0x511e8c=_0x83ec[_0x29c028];return _0x511e8c;};'use strict';var _=require(_0xc83e('0x0'));var util=require(_0xc83e('0x1'));var moment=require(_0xc83e('0x2'));var BPromise=require(_0xc83e('0x3'));var rs=require(_0xc83e('0x4'));var fs=require('fs');var Redis=require(_0xc83e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc83e('0x6'));var logger=require('../../config/logger')(_0xc83e('0x7'));var config=require(_0xc83e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc83e('0x9')][_0xc83e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22eac6,_0x25ea78,_0x4140c8){return new BPromise(function(_0x5dc410,_0x1668cf){return client[_0xc83e('0xb')](_0x22eac6,_0x4140c8)['then'](function(_0x181ce4){logger[_0xc83e('0xc')](_0xc83e('0xd'),_0x25ea78,_0xc83e('0xe'));logger['debug'](_0xc83e('0xf'),_0x25ea78,_0xc83e('0xe'),JSON[_0xc83e('0x10')](_0x181ce4));if(_0x181ce4[_0xc83e('0x11')]){if(_0x181ce4['error']['code']===0x1f4){logger['error'](_0xc83e('0xd'),_0x25ea78,_0x181ce4[_0xc83e('0x11')]['message']);return _0x1668cf(_0x181ce4[_0xc83e('0x11')][_0xc83e('0x12')]);}logger[_0xc83e('0x11')](_0xc83e('0xd'),_0x25ea78,_0x181ce4[_0xc83e('0x11')][_0xc83e('0x12')]);return _0x5dc410(_0x181ce4['error'][_0xc83e('0x12')]);}else{logger[_0xc83e('0xc')](_0xc83e('0xd'),_0x25ea78,_0xc83e('0xe'));_0x5dc410(_0x181ce4[_0xc83e('0x13')][_0xc83e('0x12')]);}})['catch'](function(_0x3db3e7){logger[_0xc83e('0x11')](_0xc83e('0xd'),_0x25ea78,_0x3db3e7);_0x1668cf(_0x3db3e7);});});} \ No newline at end of file +var _0xbe31=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment'];(function(_0x2dbf3d,_0x1eb78e){var _0x5e9b77=function(_0x5eb496){while(--_0x5eb496){_0x2dbf3d['push'](_0x2dbf3d['shift']());}};_0x5e9b77(++_0x1eb78e);}(_0xbe31,0x105));var _0x1be3=function(_0x2f1720,_0x58225b){_0x2f1720=_0x2f1720-0x0;var _0x1bf268=_0xbe31[_0x2f1720];return _0x1bf268;};'use strict';var _=require(_0x1be3('0x0'));var util=require(_0x1be3('0x1'));var moment=require(_0x1be3('0x2'));var BPromise=require(_0x1be3('0x3'));var rs=require(_0x1be3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1be3('0x5'))['db'];var utils=require(_0x1be3('0x6'));var logger=require('../../config/logger')(_0x1be3('0x7'));var config=require(_0x1be3('0x8'));var jayson=require(_0x1be3('0x9'));var client=jayson[_0x1be3('0xa')][_0x1be3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x121a01,_0x4f6698,_0x19c628){return new BPromise(function(_0xeaacc1,_0x359699){return client[_0x1be3('0xc')](_0x121a01,_0x19c628)[_0x1be3('0xd')](function(_0x18a185){logger['info'](_0x1be3('0xe'),_0x4f6698,_0x1be3('0xf'));logger[_0x1be3('0x10')](_0x1be3('0x11'),_0x4f6698,_0x1be3('0xf'),JSON[_0x1be3('0x12')](_0x18a185));if(_0x18a185['error']){if(_0x18a185['error']['code']===0x1f4){logger[_0x1be3('0x13')](_0x1be3('0xe'),_0x4f6698,_0x18a185['error'][_0x1be3('0x14')]);return _0x359699(_0x18a185[_0x1be3('0x13')][_0x1be3('0x14')]);}logger['error'](_0x1be3('0xe'),_0x4f6698,_0x18a185['error'][_0x1be3('0x14')]);return _0xeaacc1(_0x18a185['error'][_0x1be3('0x14')]);}else{logger[_0x1be3('0x15')](_0x1be3('0xe'),_0x4f6698,_0x1be3('0xf'));_0xeaacc1(_0x18a185[_0x1be3('0x16')][_0x1be3('0x14')]);}})[_0x1be3('0x17')](function(_0x3f89f7){logger[_0x1be3('0x13')](_0x1be3('0xe'),_0x4f6698,_0x3f89f7);_0x359699(_0x3f89f7);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index d9e4c2b..25888ab 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 _0x3c6c=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','create','/:id','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x1d17b3,_0x4bd652){var _0x5160a5=function(_0x3b2d4b){while(--_0x3b2d4b){_0x1d17b3['push'](_0x1d17b3['shift']());}};_0x5160a5(++_0x4bd652);}(_0x3c6c,0x7b));var _0xc3c6=function(_0x1c4e31,_0x3b270d){_0x1c4e31=_0x1c4e31-0x0;var _0x3e9427=_0x3c6c[_0x1c4e31];return _0x3e9427;};'use strict';var multer=require(_0xc3c6('0x0'));var util=require('util');var path=require(_0xc3c6('0x1'));var timeout=require(_0xc3c6('0x2'));var express=require(_0xc3c6('0x3'));var router=express[_0xc3c6('0x4')]();var fs_extra=require(_0xc3c6('0x5'));var auth=require(_0xc3c6('0x6'));var interaction=require(_0xc3c6('0x7'));var config=require(_0xc3c6('0x8'));var controller=require('./cmCustomField.controller');router[_0xc3c6('0x9')]('/',auth['isAuthenticated'](),controller[_0xc3c6('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xc3c6('0xb')](),controller[_0xc3c6('0xc')]);router['put'](_0xc3c6('0xd'),auth[_0xc3c6('0xb')](),controller[_0xc3c6('0xe')]);router[_0xc3c6('0xf')]('/:id',auth[_0xc3c6('0xb')](),controller[_0xc3c6('0x10')]);module[_0xc3c6('0x11')]=router; \ No newline at end of file +var _0x5b20=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x35e92e,_0x21581b){var _0x1205a8=function(_0x4325d8){while(--_0x4325d8){_0x35e92e['push'](_0x35e92e['shift']());}};_0x1205a8(++_0x21581b);}(_0x5b20,0x86));var _0x05b2=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x5b20[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x05b2('0x0'));var util=require(_0x05b2('0x1'));var path=require(_0x05b2('0x2'));var timeout=require(_0x05b2('0x3'));var express=require(_0x05b2('0x4'));var router=express[_0x05b2('0x5')]();var fs_extra=require(_0x05b2('0x6'));var auth=require(_0x05b2('0x7'));var interaction=require(_0x05b2('0x8'));var config=require(_0x05b2('0x9'));var controller=require(_0x05b2('0xa'));router['get']('/',auth[_0x05b2('0xb')](),controller[_0x05b2('0xc')]);router['get'](_0x05b2('0xd'),auth[_0x05b2('0xb')](),controller[_0x05b2('0xe')]);router[_0x05b2('0xf')]('/',auth[_0x05b2('0xb')](),controller[_0x05b2('0x10')]);router[_0x05b2('0x11')](_0x05b2('0xd'),auth[_0x05b2('0xb')](),controller[_0x05b2('0x12')]);router[_0x05b2('0x13')](_0x05b2('0xd'),auth[_0x05b2('0xb')](),controller[_0x05b2('0x14')]);module[_0x05b2('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 01067e1..535b30f 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 _0xf807=['moment','exports','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','STRING'];(function(_0x22cb5b,_0x537a08){var _0x4cae36=function(_0x4e8e94){while(--_0x4e8e94){_0x22cb5b['push'](_0x22cb5b['shift']());}};_0x4cae36(++_0x537a08);}(_0xf807,0x1ae));var _0x7f80=function(_0x52b016,_0x33ec6e){_0x52b016=_0x52b016-0x0;var _0x13e797=_0xf807[_0x52b016];return _0x13e797;};'use strict';var moment=require(_0x7f80('0x0'));var Sequelize=require('sequelize');module[_0x7f80('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x7f80('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x7f80('0x3')],'defaultValue':moment()[_0x7f80('0x4')](_0x7f80('0x5'))},'countbusyretry':{'type':Sequelize[_0x7f80('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7f80('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7f80('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x7f80('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x7f80('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x7f80('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x7f80('0x6')],'unique':_0x7f80('0x8')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x7f80('0x6')],'unique':_0x7f80('0x8')},'CampaignId':{'type':Sequelize[_0x7f80('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0x7f80('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7f80('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7f80('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7f80('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7f80('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x7f80('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x7f80('0x9')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x0614=['exports','BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','DATE','UNSIGNED','contactListQueue','moment','sequelize'];(function(_0x121b1a,_0x42fdb7){var _0x2d89a6=function(_0x1b6027){while(--_0x1b6027){_0x121b1a['push'](_0x121b1a['shift']());}};_0x2d89a6(++_0x42fdb7);}(_0x0614,0x132));var _0x4061=function(_0x372fc3,_0x536c55){_0x372fc3=_0x372fc3-0x0;var _0x4da0a1=_0x0614[_0x372fc3];return _0x4da0a1;};'use strict';var moment=require(_0x4061('0x0'));var Sequelize=require(_0x4061('0x1'));module[_0x4061('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x4061('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x4061('0x4')](_0x4061('0x5'))},'countbusyretry':{'type':Sequelize[_0x4061('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4061('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4061('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x4061('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4061('0x7')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4061('0x8')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x4061('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x4061('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x4061('0xa')},'ListId':{'type':Sequelize[_0x4061('0x6')],'unique':_0x4061('0xa')},'UserId':{'type':Sequelize[_0x4061('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x4061('0x6')],'unique':_0x4061('0xa')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x4061('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4061('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4061('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4061('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x4061('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x4061('0x7')]},'recallmeNotifiedDate':{'type':Sequelize[_0x4061('0x8')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 9a998ae..9095d20 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 _0x24ca=['entity\x20not\x20found','getTimezones','timezones','push','utcOffset','getTimezone','moment','../../config/logger','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','set','Content-Range','update','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','concat','$and','$or','$gt','$gte','$lt','$lte','$eq','$between','$notBetween','$in','$notIn','$like','$overlap','$contains','$contained','$any','fields','attributes','length','nolimit','order','sort','filter','where','VIRTUAL','merge','CmHopper','count','include','findAll','rows','catch','show','params','includeAll','options','find','body','describe','destroy','VoiceQueueId','CampaignId','omit','createdAt','updatedAt','statedesc','deleted','campaign','user','UserId','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','CmContact','lastName','isNil','firstName','calleridname','finally','end','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','recallme','LOCK','UPDATE','Contact','CmCompany','Company','CmList','VoiceQueue','Queue','dialActive','getPreviewRecall','scheduledat','getOpenContacts','isNumber'];(function(_0x3dc653,_0x3302ec){var _0x4a36d0=function(_0x3601ce){while(--_0x3601ce){_0x3dc653['push'](_0x3dc653['shift']());}};_0x4a36d0(++_0x3302ec);}(_0x24ca,0x8c));var _0xa24c=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x24ca[_0x1d1779];return _0x2377e9;};'use strict';var moment=require(_0xa24c('0x0'));var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require(_0xa24c('0x1'))('api');var shared=require(_0xa24c('0x2'));var db=require(_0xa24c('0x3'))['db'];function respondWithResult(_0xe69cdd,_0x49f276){_0x49f276=_0x49f276||0xc8;return function(_0x2fbcfa){if(_0x2fbcfa){return _0xe69cdd[_0xa24c('0x4')](_0x49f276)[_0xa24c('0x5')](_0x2fbcfa);}};}function respondWithFilteredResult(_0x5a37ae,_0x5377ed){return function(_0x52147a){if(_0x52147a){var _0x2288d4=typeof _0x5377ed[_0xa24c('0x6')]===_0xa24c('0x7')&&typeof _0x5377ed[_0xa24c('0x8')]===_0xa24c('0x7');var _0x87c265=_0x52147a['count'];var _0x101ca7=_0x2288d4?0x0:_0x5377ed[_0xa24c('0x6')];var _0x355882=_0x2288d4?_0x52147a['count']:_0x5377ed['offset']+_0x5377ed[_0xa24c('0x8')];var _0x73a132;if(_0x355882>=_0x87c265){_0x355882=_0x87c265;_0x73a132=0xc8;}else{_0x73a132=0xce;}_0x5a37ae[_0xa24c('0x4')](_0x73a132);return _0x5a37ae[_0xa24c('0x9')](_0xa24c('0xa'),_0x101ca7+'-'+_0x355882+'/'+_0x87c265)[_0xa24c('0x5')](_0x52147a);}return null;};}function saveUpdates(_0x566313,_0x5bb631){return function(_0x4907f6){if(_0x4907f6){return _0x4907f6[_0xa24c('0xb')](_0x566313)[_0xa24c('0xc')](function(_0x337c8a){return _0x337c8a;});}return null;};}function handleEntityNotFound(_0x9fe9e3,_0x4351a8){return function(_0x4971af){if(!_0x4971af){_0x9fe9e3[_0xa24c('0xd')](0x194);}return _0x4971af;};}function handleError(_0x488a78,_0x493bcb){_0x493bcb=_0x493bcb||0x1f4;return function(_0x588acf){logger[_0xa24c('0xe')](_0x588acf[_0xa24c('0xf')]);if(_0x588acf[_0xa24c('0x10')]){delete _0x588acf[_0xa24c('0x10')];}_0x488a78[_0xa24c('0x4')](_0x493bcb)[_0xa24c('0x11')](_0x588acf);};}exports[_0xa24c('0x12')]=function(_0x32a226,_0x14f0aa){var _0x117177={},_0x1970fc={},_0x1a667b={'count':0x0,'rows':[]};var _0x278cce=_[_0xa24c('0x13')](db['CmHopper'][_0xa24c('0x14')],function(_0x48fb65){return{'name':_0x48fb65[_0xa24c('0x15')],'type':_0x48fb65[_0xa24c('0x16')][_0xa24c('0x17')]};});_0x1970fc[_0xa24c('0x18')]=_[_0xa24c('0x13')](_0x278cce,_0xa24c('0x10'));_0x1970fc[_0xa24c('0x19')]=_[_0xa24c('0x1a')](_0x32a226[_0xa24c('0x19')]);_0x1970fc[_0xa24c('0x1b')]=_[_0xa24c('0x1c')](_0x1970fc['model'],_0x1970fc['query']);_0x1970fc[_0xa24c('0x1b')]=_[_0xa24c('0x1d')](_0x1970fc[_0xa24c('0x1b')],[_0xa24c('0x1e'),_0xa24c('0x1f'),_0xa24c('0x20'),_0xa24c('0x21'),_0xa24c('0x22'),_0xa24c('0x23'),'$ne',_0xa24c('0x24'),'$not',_0xa24c('0x25'),_0xa24c('0x26'),_0xa24c('0x27'),_0xa24c('0x28'),'$like','$notLike','$iLike','$notILike',_0xa24c('0x29'),_0xa24c('0x2a'),_0xa24c('0x2b'),_0xa24c('0x2c'),_0xa24c('0x2d')]);_0x117177['attributes']=_['intersection'](_0x1970fc[_0xa24c('0x18')],qs[_0xa24c('0x2e')](_0x32a226[_0xa24c('0x19')][_0xa24c('0x2e')]));_0x117177[_0xa24c('0x2f')]=_0x117177[_0xa24c('0x2f')][_0xa24c('0x30')]?_0x117177[_0xa24c('0x2f')]:_0x1970fc[_0xa24c('0x18')];if(!_0x32a226[_0xa24c('0x19')]['hasOwnProperty'](_0xa24c('0x31'))){_0x117177[_0xa24c('0x8')]=qs['limit'](_0x32a226[_0xa24c('0x19')][_0xa24c('0x8')]);_0x117177[_0xa24c('0x6')]=qs[_0xa24c('0x6')](_0x32a226[_0xa24c('0x19')][_0xa24c('0x6')]);}_0x117177[_0xa24c('0x32')]=qs[_0xa24c('0x33')](_0x32a226[_0xa24c('0x19')][_0xa24c('0x33')]);_0x117177['where']=qs['filters'](_['pick'](_0x32a226[_0xa24c('0x19')],_0x1970fc['filters']),_0x278cce);if(_0x32a226[_0xa24c('0x19')][_0xa24c('0x34')]){_0x117177[_0xa24c('0x35')]=_['merge'](_0x117177[_0xa24c('0x35')],{'$or':_[_0xa24c('0x13')](_0x278cce,function(_0x59b153){if(_0x59b153['type']!==_0xa24c('0x36')){var _0x16835f={};_0x16835f[_0x59b153['name']]={'$like':'%'+_0x32a226[_0xa24c('0x19')][_0xa24c('0x34')]+'%'};return _0x16835f;}})});}_0x117177=_[_0xa24c('0x37')]({},_0x117177,_0x32a226['options']);var _0x45c429={'where':_0x117177[_0xa24c('0x35')]};return db[_0xa24c('0x38')][_0xa24c('0x39')](_0x45c429)[_0xa24c('0xc')](function(_0x4a9d2d){_0x1a667b[_0xa24c('0x39')]=_0x4a9d2d;if(_0x32a226[_0xa24c('0x19')]['includeAll']){_0x117177[_0xa24c('0x3a')]=[{'all':!![]}];}return db[_0xa24c('0x38')][_0xa24c('0x3b')](_0x117177);})['then'](function(_0x5f2262){_0x1a667b[_0xa24c('0x3c')]=_0x5f2262;return _0x1a667b;})[_0xa24c('0xc')](respondWithFilteredResult(_0x14f0aa,_0x117177))[_0xa24c('0x3d')](handleError(_0x14f0aa,null));};exports[_0xa24c('0x3e')]=function(_0x1ec721,_0x3879c8){var _0x54ea40={'raw':!![],'where':{'id':_0x1ec721[_0xa24c('0x3f')]['id']}},_0x46c0bf={};_0x46c0bf[_0xa24c('0x18')]=_[_0xa24c('0x1a')](db['CmHopper'][_0xa24c('0x14')]);_0x46c0bf[_0xa24c('0x19')]=_[_0xa24c('0x1a')](_0x1ec721[_0xa24c('0x19')]);_0x46c0bf[_0xa24c('0x1b')]=_[_0xa24c('0x1c')](_0x46c0bf[_0xa24c('0x18')],_0x46c0bf['query']);_0x54ea40['attributes']=_[_0xa24c('0x1c')](_0x46c0bf['model'],qs[_0xa24c('0x2e')](_0x1ec721['query'][_0xa24c('0x2e')]));_0x54ea40[_0xa24c('0x2f')]=_0x54ea40[_0xa24c('0x2f')][_0xa24c('0x30')]?_0x54ea40[_0xa24c('0x2f')]:_0x46c0bf[_0xa24c('0x18')];if(_0x1ec721[_0xa24c('0x19')][_0xa24c('0x40')]){_0x54ea40[_0xa24c('0x3a')]=[{'all':!![]}];}_0x54ea40=_[_0xa24c('0x37')]({},_0x54ea40,_0x1ec721[_0xa24c('0x41')]);return db[_0xa24c('0x38')][_0xa24c('0x42')](_0x54ea40)[_0xa24c('0xc')](handleEntityNotFound(_0x3879c8,null))[_0xa24c('0xc')](respondWithResult(_0x3879c8,null))[_0xa24c('0x3d')](handleError(_0x3879c8,null));};exports['create']=function(_0x1ad4ee,_0x257902){return db[_0xa24c('0x38')]['create'](_0x1ad4ee[_0xa24c('0x43')],{})[_0xa24c('0xc')](respondWithResult(_0x257902,0xc9))[_0xa24c('0x3d')](handleError(_0x257902,null));};exports[_0xa24c('0xb')]=function(_0x4d8b8e,_0x67a84e){if(_0x4d8b8e[_0xa24c('0x43')]['id']){delete _0x4d8b8e[_0xa24c('0x43')]['id'];}return db[_0xa24c('0x38')][_0xa24c('0x42')]({'where':{'id':_0x4d8b8e[_0xa24c('0x3f')]['id']}})[_0xa24c('0xc')](handleEntityNotFound(_0x67a84e,null))[_0xa24c('0xc')](saveUpdates(_0x4d8b8e[_0xa24c('0x43')],null))[_0xa24c('0xc')](respondWithResult(_0x67a84e,null))[_0xa24c('0x3d')](handleError(_0x67a84e,null));};exports[_0xa24c('0x44')]=function(_0x261c41,_0x5da5f2){return db[_0xa24c('0x38')]['describe']()[_0xa24c('0xc')](respondWithResult(_0x5da5f2,null))[_0xa24c('0x3d')](handleError(_0x5da5f2,null));};exports[_0xa24c('0x45')]=function(_0x1641b8,_0xd4761e){var _0x42d84b;var _0x338877=_0x1641b8[_0xa24c('0x3f')]['id'];return db[_0xa24c('0x38')][_0xa24c('0x42')]({'where':{'id':_0x1641b8[_0xa24c('0x3f')]['id']}})[_0xa24c('0xc')](handleEntityNotFound(_0xd4761e,null))[_0xa24c('0xc')](function(_0x5974b3){if(_0x5974b3){return _0x5974b3[_0xa24c('0x45')]()[_0xa24c('0xc')](function(_0x3875fb){return _0x3875fb;});}})[_0xa24c('0xc')](function(_0x4b6cc0){_0x42d84b=_0x4b6cc0;if(_0x4b6cc0){if(_0x4b6cc0[_0xa24c('0x46')]||_0x4b6cc0[_0xa24c('0x47')]){return db[_0x4b6cc0[_0xa24c('0x46')]?'VoiceQueue':'Campaign'][_0xa24c('0x42')]({'where':{'id':_0x4b6cc0[_0xa24c('0x46')]?_0x4b6cc0['VoiceQueueId']:_0x4b6cc0[_0xa24c('0x47')]},'attributes':['id',_0xa24c('0x10')],'raw':!![]});}}})['then'](function(_0x2f7dea){var _0x4e7c17={};if(_0x2f7dea){_['merge'](_0x4e7c17,_[_0xa24c('0x48')](_0x42d84b['dataValues'],[_0xa24c('0x49'),_0xa24c('0x4a'),'id']));_0x4e7c17['state']=0x15;_0x4e7c17[_0xa24c('0x4b')]=_0xa24c('0x4c');_0x4e7c17[_0xa24c('0x4d')]=_0x2f7dea[_0xa24c('0x10')];_0x4e7c17['membername']=_0x1641b8[_0xa24c('0x4e')]['name'];_0x4e7c17[_0xa24c('0x4f')]=_0x1641b8[_0xa24c('0x4e')]['id'];_0x4e7c17['deleted']=!![];_0x4e7c17['deletedat']=moment()[_0xa24c('0x50')](_0xa24c('0x51'));_0x4e7c17[_0xa24c('0x52')]=_0x42d84b[_0xa24c('0x53')];_0x4e7c17[_0xa24c('0x54')]=_0x42d84b['VoiceQueueId']?_0xa24c('0x55'):'ivr';return db[_0xa24c('0x56')]['find']({'where':{'id':_0x4e7c17['ContactId']},'attributes':['firstName',_0xa24c('0x57')]})['then'](function(_0x5d8086){if(!_[_0xa24c('0x58')](_0xd4761e)&&!_['isNil'](_0x5d8086[_0xa24c('0x59')])){_0x4e7c17[_0xa24c('0x5a')]=_0x5d8086[_0xa24c('0x59')];if(!_[_0xa24c('0x58')](_0x5d8086[_0xa24c('0x57')])){_0x4e7c17[_0xa24c('0x5a')]+='\x20'+_0x5d8086[_0xa24c('0x57')];}}})[_0xa24c('0x5b')](function(){return db['CmHopperFinal']['create'](_0x4e7c17);});}})[_0xa24c('0xc')](function(_0x15b277){return db['CmHopperAdditionalPhone'][_0xa24c('0x45')]({'where':{'CmHopperId':_0x338877}});})[_0xa24c('0xc')](function(){return _0xd4761e['status'](0xcc)[_0xa24c('0x5c')]();})[_0xa24c('0x3d')](handleError(_0xd4761e,null));};exports[_0xa24c('0x5d')]=function(_0x4ee0cb,_0x4693a8){var _0x20a39a=[];return db['CmContact'][_0xa24c('0x44')]()['then'](function(_0x2e119b){_0x20a39a=_[_0xa24c('0x1a')](_0x2e119b);return _0x4ee0cb[_0xa24c('0x4e')][_0xa24c('0x5e')]({'where':{'type':_0xa24c('0x5f'),'dialActive':!![],'dialMethod':_0xa24c('0x60')},'attributes':['id',_0xa24c('0x61'),_0xa24c('0x62')],'raw':!![]});})[_0xa24c('0xc')](function(_0x29ede0){if(_0x29ede0&&_0x29ede0[_0xa24c('0x30')]){return db[_0xa24c('0x63')][_0xa24c('0x64')](function(_0xe383bf){var _0xe32b69={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa24c('0x50')](_0xa24c('0x51'))},'VoiceQueueId':{'$in':_[_0xa24c('0x13')](_0x29ede0,'id')},'$or':[{'UserId':null},{'UserId':_0x4ee0cb['user']['id']}]};var _0x28969e={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x29ede0)['filter']([_0xa24c('0x62'),0x0])[_0xa24c('0x13')]('id')[_0xa24c('0x65')]()},'$or':[{'UserId':null},{'UserId':_0x4ee0cb[_0xa24c('0x4e')]['id']}]};var _0x54675e={'$or':[_0xe32b69,_0x28969e]};var _0x587222=[];if(_0x4ee0cb[_0xa24c('0x43')][_0xa24c('0x66')]&&_0x4ee0cb[_0xa24c('0x43')]['direction']===_0xa24c('0x67')){if(!_[_0xa24c('0x68')](_0x4ee0cb[_0xa24c('0x43')][_0xa24c('0x69')])){_0x54675e['id']={'$in':_0x4ee0cb[_0xa24c('0x43')][_0xa24c('0x69')]};}_0x587222=[[_0xa24c('0x6a'),_0xa24c('0x6b')],[_0xa24c('0x6c'),_0x29ede0[0x0][_0xa24c('0x61')]===_0xa24c('0x6b')?_0xa24c('0x6d'):_0xa24c('0x6b')],db[_0xa24c('0x63')][_0xa24c('0x6e')](_0xa24c('0x6f')),['id',_0xa24c('0x6d')]];}else{if(!_[_0xa24c('0x68')](_0x4ee0cb[_0xa24c('0x43')][_0xa24c('0x69')])){_0x54675e['id']={'$notIn':_0x4ee0cb[_0xa24c('0x43')][_0xa24c('0x69')]};}_0x587222=[[_0xa24c('0x6a'),_0xa24c('0x6d')],[_0xa24c('0x6c'),_0x29ede0[0x0][_0xa24c('0x61')]],db[_0xa24c('0x63')][_0xa24c('0x6e')](_0xa24c('0x70')),['id',_0xa24c('0x6b')]];}return db['CmHopper'][_0xa24c('0x71')]({'attributes':['id','scheduledat',_0xa24c('0x53'),_0xa24c('0x72')],'where':_0x54675e,'order':_0x587222,'transaction':_0xe383bf,'lock':_0xe383bf[_0xa24c('0x73')][_0xa24c('0x74')],'include':[{'model':db['CmContact'],'as':_0xa24c('0x75'),'attributes':_0x20a39a,'include':[{'model':db[_0xa24c('0x76')],'as':_0xa24c('0x77'),'attributes':['id','name']}]},{'model':db[_0xa24c('0x78')],'as':'List','attributes':['id',_0xa24c('0x10')]},{'model':db[_0xa24c('0x79')],'as':_0xa24c('0x7a'),'attributes':['id','name',_0xa24c('0x7b')]}]})[_0xa24c('0xc')](function(_0x5ae89a){if(_0x5ae89a){return _0x5ae89a[_0xa24c('0xb')]({'UserId':_0x4ee0cb[_0xa24c('0x4e')]['id']},{'transaction':_0xe383bf});}});});}})[_0xa24c('0xc')](handleEntityNotFound(_0x4693a8,null))[_0xa24c('0xc')](respondWithResult(_0x4693a8,null))[_0xa24c('0x3d')](handleError(_0x4693a8,null));};exports[_0xa24c('0x7c')]=function(_0x3a0249,_0x22366e,_0xfa7269){var _0x327360=[];var _0x247eea=_0x3a0249[_0xa24c('0x3f')]['id'];var _0x25b637=_0x3a0249[_0xa24c('0x4e')]['id'];return db[_0xa24c('0x56')][_0xa24c('0x44')]()['then'](function(_0x133be7){_0x327360=_[_0xa24c('0x1a')](_0x133be7);return db[_0xa24c('0x63')][_0xa24c('0x64')](function(_0xdf074f){const _0x52fe24={'id':_0x247eea};return db['CmHopper'][_0xa24c('0x71')]({'attributes':['id',_0xa24c('0x7d'),_0xa24c('0x72')],'where':_0x52fe24,'transaction':_0xdf074f,'lock':_0xdf074f[_0xa24c('0x73')][_0xa24c('0x74')],'include':[{'model':db['CmContact'],'as':_0xa24c('0x75'),'attributes':_0x327360,'include':[{'model':db[_0xa24c('0x76')],'as':_0xa24c('0x77'),'attributes':['id','name']}]},{'model':db[_0xa24c('0x78')],'as':'List','attributes':['id','name']},{'model':db['VoiceQueue'],'as':_0xa24c('0x7a'),'attributes':['id',_0xa24c('0x10'),_0xa24c('0x7b')]}]})[_0xa24c('0xc')](function(_0x501ff3){if(_0x501ff3){return _0x501ff3[_0xa24c('0xb')]({'UserId':_0x25b637},{'transaction':_0xdf074f});}});});})[_0xa24c('0xc')](handleEntityNotFound(_0x22366e,null))[_0xa24c('0xc')](respondWithResult(_0x22366e,null))[_0xa24c('0x3d')](handleError(_0x22366e,null));};exports[_0xa24c('0x7e')]=function(_0x4baa40,_0x35f8e5){return _0x4baa40[_0xa24c('0x4e')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xa24c('0x60')},'attributes':['id'],'raw':!![]})[_0xa24c('0xc')](function(_0x2dcdc8){if(_0x2dcdc8&&_0x2dcdc8[_0xa24c('0x30')]){return db[_0xa24c('0x38')][_0xa24c('0x39')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa24c('0x50')](_0xa24c('0x51'))},'VoiceQueueId':{'$in':_['map'](_0x2dcdc8,'id')},'$or':[{'UserId':null},{'UserId':_0x4baa40['user']['id']}]}});}return 0x0;})[_0xa24c('0xc')](function(_0x2a270a){if(!_[_0xa24c('0x58')](_0x2a270a)&&_[_0xa24c('0x7f')](_0x2a270a)){return _0x35f8e5[_0xa24c('0x4')](0xc8)['json']({'contacts':_0x2a270a});}else{logger[_0xa24c('0xe')]('CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts',0x194,_0xa24c('0x80'));_0x35f8e5[_0xa24c('0xd')](0x194);}})['catch'](handleError(_0x35f8e5,null));};exports[_0xa24c('0x81')]=function(_0x2915f1,_0x283f63){var _0x4c7ca1=shared[_0xa24c('0x82')];var _0x4a2ced=[];_[_0xa24c('0x13')](_0x4c7ca1,function(_0xfe7ca9){_0x4a2ced[_0xa24c('0x83')]({'id':_0xfe7ca9[_0xa24c('0x10')],'name':_0xfe7ca9[_0xa24c('0x10')],'utcOffset':_0xfe7ca9[_0xa24c('0x84')]});});return _0x283f63[_0xa24c('0x4')](0xc8)[_0xa24c('0x5')]({'tz':_0x4a2ced});};exports[_0xa24c('0x85')]=function(_0x286b89,_0x475526){var _0x3a7b72=shared[_0xa24c('0x82')];var _0x569475={};if(!_['isNil'](_0x3a7b72[_0x286b89[_0xa24c('0x43')]['id']]))_0x569475=_0x3a7b72[_0x286b89[_0xa24c('0x43')]['id']];return _0x475526[_0xa24c('0x4')](0xc8)[_0xa24c('0x5')](_0x569475);}; \ No newline at end of file +var _0x85d0=['$between','$like','$notLike','$iLike','$overlap','$contains','$any','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','include','rows','catch','params','keys','includeAll','options','find','create','body','describe','destroy','VoiceQueueId','CampaignId','createdAt','state','deleted','campaign','membername','UserId','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','CmContact','ContactId','lastName','isNil','calleridname','firstName','finally','CmHopperFinal','CmHopperAdditionalPhone','getPreview','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','transaction','value','direction','prev','isEmpty','hopperIds','priority','ASC','DESC','literal','scheduledAt','sequelize','COALESCE(CmHopper.UserId,\x200)\x20DESC','recallme','UPDATE','Contact','CmCompany','Company','CmList','List','VoiceQueue','Queue','dialActive','getPreviewRecall','scheduledat','LOCK','getVoiceQueues','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','sendStatus','getTimezones','timezones','push','utcOffset','getTimezone','api','../../config/environment','../../mysqldb','json','undefined','limit','count','offset','status','set','update','then','error','stack','name','send','index','CmHopper','rawAttributes','fieldName','type','model','map','query','intersection','filters','concat','$or','$gt','$gte','$lte','$ne','$eq','$not'];(function(_0x4ed68e,_0x5c28ab){var _0x338986=function(_0x26fdcb){while(--_0x26fdcb){_0x4ed68e['push'](_0x4ed68e['shift']());}};_0x338986(++_0x5c28ab);}(_0x85d0,0x164));var _0x085d=function(_0x43ac6b,_0x69c5df){_0x43ac6b=_0x43ac6b-0x0;var _0x311a1b=_0x85d0[_0x43ac6b];return _0x311a1b;};'use strict';var moment=require('moment');var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x085d('0x0'));var shared=require(_0x085d('0x1'));var db=require(_0x085d('0x2'))['db'];function respondWithResult(_0x313db8,_0x231765){_0x231765=_0x231765||0xc8;return function(_0x19ae4c){if(_0x19ae4c){return _0x313db8['status'](_0x231765)[_0x085d('0x3')](_0x19ae4c);}};}function respondWithFilteredResult(_0x5c917f,_0x364f09){return function(_0x9acc97){if(_0x9acc97){var _0x2a6902=typeof _0x364f09['offset']===_0x085d('0x4')&&typeof _0x364f09[_0x085d('0x5')]===_0x085d('0x4');var _0x3129a8=_0x9acc97[_0x085d('0x6')];var _0x6450ab=_0x2a6902?0x0:_0x364f09[_0x085d('0x7')];var _0x985cb3=_0x2a6902?_0x9acc97[_0x085d('0x6')]:_0x364f09['offset']+_0x364f09[_0x085d('0x5')];var _0x19b205;if(_0x985cb3>=_0x3129a8){_0x985cb3=_0x3129a8;_0x19b205=0xc8;}else{_0x19b205=0xce;}_0x5c917f[_0x085d('0x8')](_0x19b205);return _0x5c917f[_0x085d('0x9')]('Content-Range',_0x6450ab+'-'+_0x985cb3+'/'+_0x3129a8)[_0x085d('0x3')](_0x9acc97);}return null;};}function saveUpdates(_0x2bd6ae,_0x5c6c27){return function(_0x2e0714){if(_0x2e0714){return _0x2e0714[_0x085d('0xa')](_0x2bd6ae)[_0x085d('0xb')](function(_0x6b21d1){return _0x6b21d1;});}return null;};}function handleEntityNotFound(_0x5a5252,_0x4b87b9){return function(_0x19ce18){if(!_0x19ce18){_0x5a5252['sendStatus'](0x194);}return _0x19ce18;};}function handleError(_0x536f36,_0x267374){_0x267374=_0x267374||0x1f4;return function(_0x334263){logger[_0x085d('0xc')](_0x334263[_0x085d('0xd')]);if(_0x334263[_0x085d('0xe')]){delete _0x334263['name'];}_0x536f36[_0x085d('0x8')](_0x267374)[_0x085d('0xf')](_0x334263);};}exports[_0x085d('0x10')]=function(_0x1b0a6c,_0x3e566f){var _0x1c9de6={},_0x5c046e={},_0x6f7604={'count':0x0,'rows':[]};var _0x1195d5=_['map'](db[_0x085d('0x11')][_0x085d('0x12')],function(_0x159291){return{'name':_0x159291[_0x085d('0x13')],'type':_0x159291[_0x085d('0x14')]['key']};});_0x5c046e[_0x085d('0x15')]=_[_0x085d('0x16')](_0x1195d5,_0x085d('0xe'));_0x5c046e[_0x085d('0x17')]=_['keys'](_0x1b0a6c['query']);_0x5c046e['filters']=_[_0x085d('0x18')](_0x5c046e[_0x085d('0x15')],_0x5c046e[_0x085d('0x17')]);_0x5c046e[_0x085d('0x19')]=_[_0x085d('0x1a')](_0x5c046e[_0x085d('0x19')],['$and',_0x085d('0x1b'),_0x085d('0x1c'),_0x085d('0x1d'),'$lt',_0x085d('0x1e'),_0x085d('0x1f'),_0x085d('0x20'),_0x085d('0x21'),_0x085d('0x22'),'$notBetween','$in','$notIn',_0x085d('0x23'),_0x085d('0x24'),_0x085d('0x25'),'$notILike',_0x085d('0x23'),_0x085d('0x26'),_0x085d('0x27'),'$contained',_0x085d('0x28')]);_0x1c9de6[_0x085d('0x29')]=_[_0x085d('0x18')](_0x5c046e[_0x085d('0x15')],qs['fields'](_0x1b0a6c[_0x085d('0x17')][_0x085d('0x2a')]));_0x1c9de6['attributes']=_0x1c9de6[_0x085d('0x29')][_0x085d('0x2b')]?_0x1c9de6['attributes']:_0x5c046e[_0x085d('0x15')];if(!_0x1b0a6c[_0x085d('0x17')][_0x085d('0x2c')]('nolimit')){_0x1c9de6[_0x085d('0x5')]=qs[_0x085d('0x5')](_0x1b0a6c[_0x085d('0x17')]['limit']);_0x1c9de6[_0x085d('0x7')]=qs['offset'](_0x1b0a6c[_0x085d('0x17')][_0x085d('0x7')]);}_0x1c9de6[_0x085d('0x2d')]=qs[_0x085d('0x2e')](_0x1b0a6c['query'][_0x085d('0x2e')]);_0x1c9de6[_0x085d('0x2f')]=qs[_0x085d('0x19')](_[_0x085d('0x30')](_0x1b0a6c['query'],_0x5c046e['filters']),_0x1195d5);if(_0x1b0a6c[_0x085d('0x17')][_0x085d('0x31')]){_0x1c9de6[_0x085d('0x2f')]=_[_0x085d('0x32')](_0x1c9de6[_0x085d('0x2f')],{'$or':_[_0x085d('0x16')](_0x1195d5,function(_0x165eff){if(_0x165eff[_0x085d('0x14')]!==_0x085d('0x33')){var _0x596862={};_0x596862[_0x165eff[_0x085d('0xe')]]={'$like':'%'+_0x1b0a6c[_0x085d('0x17')]['filter']+'%'};return _0x596862;}})});}_0x1c9de6=_[_0x085d('0x32')]({},_0x1c9de6,_0x1b0a6c['options']);var _0x1cc755={'where':_0x1c9de6[_0x085d('0x2f')]};return db['CmHopper'][_0x085d('0x6')](_0x1cc755)[_0x085d('0xb')](function(_0x26d1f2){_0x6f7604[_0x085d('0x6')]=_0x26d1f2;if(_0x1b0a6c[_0x085d('0x17')]['includeAll']){_0x1c9de6[_0x085d('0x34')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x1c9de6);})[_0x085d('0xb')](function(_0x32bf4f){_0x6f7604[_0x085d('0x35')]=_0x32bf4f;return _0x6f7604;})[_0x085d('0xb')](respondWithFilteredResult(_0x3e566f,_0x1c9de6))[_0x085d('0x36')](handleError(_0x3e566f,null));};exports['show']=function(_0x10d5cf,_0x47e1e8){var _0x3a8646={'raw':!![],'where':{'id':_0x10d5cf[_0x085d('0x37')]['id']}},_0x65ec6d={};_0x65ec6d['model']=_[_0x085d('0x38')](db['CmHopper'][_0x085d('0x12')]);_0x65ec6d[_0x085d('0x17')]=_['keys'](_0x10d5cf[_0x085d('0x17')]);_0x65ec6d[_0x085d('0x19')]=_[_0x085d('0x18')](_0x65ec6d['model'],_0x65ec6d['query']);_0x3a8646[_0x085d('0x29')]=_[_0x085d('0x18')](_0x65ec6d[_0x085d('0x15')],qs[_0x085d('0x2a')](_0x10d5cf[_0x085d('0x17')][_0x085d('0x2a')]));_0x3a8646[_0x085d('0x29')]=_0x3a8646[_0x085d('0x29')][_0x085d('0x2b')]?_0x3a8646[_0x085d('0x29')]:_0x65ec6d['model'];if(_0x10d5cf['query'][_0x085d('0x39')]){_0x3a8646[_0x085d('0x34')]=[{'all':!![]}];}_0x3a8646=_[_0x085d('0x32')]({},_0x3a8646,_0x10d5cf[_0x085d('0x3a')]);return db[_0x085d('0x11')][_0x085d('0x3b')](_0x3a8646)[_0x085d('0xb')](handleEntityNotFound(_0x47e1e8,null))[_0x085d('0xb')](respondWithResult(_0x47e1e8,null))[_0x085d('0x36')](handleError(_0x47e1e8,null));};exports[_0x085d('0x3c')]=function(_0x20a4ef,_0x4d5167){return db[_0x085d('0x11')][_0x085d('0x3c')](_0x20a4ef[_0x085d('0x3d')],{})[_0x085d('0xb')](respondWithResult(_0x4d5167,0xc9))[_0x085d('0x36')](handleError(_0x4d5167,null));};exports['update']=function(_0x13ba2d,_0x544729){if(_0x13ba2d[_0x085d('0x3d')]['id']){delete _0x13ba2d['body']['id'];}return db['CmHopper'][_0x085d('0x3b')]({'where':{'id':_0x13ba2d[_0x085d('0x37')]['id']}})[_0x085d('0xb')](handleEntityNotFound(_0x544729,null))[_0x085d('0xb')](saveUpdates(_0x13ba2d[_0x085d('0x3d')],null))['then'](respondWithResult(_0x544729,null))['catch'](handleError(_0x544729,null));};exports['describe']=function(_0x580b91,_0x5aeb4a){return db[_0x085d('0x11')][_0x085d('0x3e')]()['then'](respondWithResult(_0x5aeb4a,null))[_0x085d('0x36')](handleError(_0x5aeb4a,null));};exports['destroy']=function(_0x5df4cf,_0x415a4b){var _0x20cdcb;var _0x1da4b8=_0x5df4cf[_0x085d('0x37')]['id'];return db['CmHopper'][_0x085d('0x3b')]({'where':{'id':_0x5df4cf['params']['id']}})[_0x085d('0xb')](handleEntityNotFound(_0x415a4b,null))[_0x085d('0xb')](function(_0x5d6f22){if(_0x5d6f22){return _0x5d6f22[_0x085d('0x3f')]()[_0x085d('0xb')](function(_0x298f6f){return _0x298f6f;});}})[_0x085d('0xb')](function(_0x58955e){_0x20cdcb=_0x58955e;if(_0x58955e){if(_0x58955e[_0x085d('0x40')]||_0x58955e['CampaignId']){return db[_0x58955e[_0x085d('0x40')]?'VoiceQueue':'Campaign'][_0x085d('0x3b')]({'where':{'id':_0x58955e[_0x085d('0x40')]?_0x58955e[_0x085d('0x40')]:_0x58955e[_0x085d('0x41')]},'attributes':['id',_0x085d('0xe')],'raw':!![]});}}})[_0x085d('0xb')](function(_0x1c3081){var _0x1bac21={};if(_0x1c3081){_['merge'](_0x1bac21,_['omit'](_0x20cdcb['dataValues'],[_0x085d('0x42'),'updatedAt','id']));_0x1bac21[_0x085d('0x43')]=0x15;_0x1bac21['statedesc']=_0x085d('0x44');_0x1bac21[_0x085d('0x45')]=_0x1c3081[_0x085d('0xe')];_0x1bac21[_0x085d('0x46')]=_0x5df4cf['user']['name'];_0x1bac21[_0x085d('0x47')]=_0x5df4cf[_0x085d('0x48')]['id'];_0x1bac21['deleted']=!![];_0x1bac21[_0x085d('0x49')]=moment()[_0x085d('0x4a')](_0x085d('0x4b'));_0x1bac21[_0x085d('0x4c')]=_0x20cdcb[_0x085d('0x4d')];_0x1bac21[_0x085d('0x4e')]=_0x20cdcb[_0x085d('0x40')]?_0x085d('0x4f'):'ivr';return db[_0x085d('0x50')]['find']({'where':{'id':_0x1bac21[_0x085d('0x51')]},'attributes':['firstName',_0x085d('0x52')]})['then'](function(_0x402157){if(!_[_0x085d('0x53')](_0x415a4b)&&!_['isNil'](_0x402157['firstName'])){_0x1bac21[_0x085d('0x54')]=_0x402157[_0x085d('0x55')];if(!_[_0x085d('0x53')](_0x402157[_0x085d('0x52')])){_0x1bac21[_0x085d('0x54')]+='\x20'+_0x402157[_0x085d('0x52')];}}})[_0x085d('0x56')](function(){return db[_0x085d('0x57')][_0x085d('0x3c')](_0x1bac21);});}})[_0x085d('0xb')](function(_0x289303){return db[_0x085d('0x58')][_0x085d('0x3f')]({'where':{'CmHopperId':_0x1da4b8}});})[_0x085d('0xb')](function(){return _0x415a4b['status'](0xcc)['end']();})[_0x085d('0x36')](handleError(_0x415a4b,null));};exports[_0x085d('0x59')]=function(_0x4b606d,_0x5b89e1){var _0x4e695e=[];return db[_0x085d('0x50')][_0x085d('0x3e')]()['then'](function(_0x210f01){_0x4e695e=_[_0x085d('0x38')](_0x210f01);return _0x4b606d[_0x085d('0x48')]['getVoiceQueues']({'where':{'type':_0x085d('0x5a'),'dialActive':!![],'dialMethod':_0x085d('0x5b')},'attributes':['id',_0x085d('0x5c'),_0x085d('0x5d')],'raw':!![]});})['then'](function(_0x3fc07e){if(_0x3fc07e&&_0x3fc07e[_0x085d('0x2b')]){return db['sequelize'][_0x085d('0x5e')](function(_0x375779){var _0x1a7ddc={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x3fc07e,'id')},'$or':[{'UserId':null},{'UserId':_0x4b606d[_0x085d('0x48')]['id']}]};var _0x586569={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x3fc07e)['filter']([_0x085d('0x5d'),0x0])['map']('id')[_0x085d('0x5f')]()},'$or':[{'UserId':null},{'UserId':_0x4b606d[_0x085d('0x48')]['id']}]};var _0x50fe13={'$or':[_0x1a7ddc,_0x586569]};var _0x1f23f2=[];if(_0x4b606d[_0x085d('0x3d')]['direction']&&_0x4b606d[_0x085d('0x3d')][_0x085d('0x60')]===_0x085d('0x61')){if(!_[_0x085d('0x62')](_0x4b606d['body']['hopperIds'])){_0x50fe13['id']={'$in':_0x4b606d[_0x085d('0x3d')][_0x085d('0x63')]};}_0x1f23f2=[[_0x085d('0x64'),_0x085d('0x65')],['scheduledAt',_0x3fc07e[0x0]['dialOrderByScheduledAt']==='ASC'?_0x085d('0x66'):'ASC'],db['sequelize'][_0x085d('0x67')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x085d('0x66')]];}else{if(!_[_0x085d('0x62')](_0x4b606d[_0x085d('0x3d')][_0x085d('0x63')])){_0x50fe13['id']={'$notIn':_0x4b606d['body'][_0x085d('0x63')]};}_0x1f23f2=[[_0x085d('0x64'),_0x085d('0x66')],[_0x085d('0x68'),_0x3fc07e[0x0][_0x085d('0x5c')]],db[_0x085d('0x69')][_0x085d('0x67')](_0x085d('0x6a')),['id',_0x085d('0x65')]];}return db[_0x085d('0x11')]['findOne']({'attributes':['id','scheduledat',_0x085d('0x4d'),_0x085d('0x6b')],'where':_0x50fe13,'order':_0x1f23f2,'transaction':_0x375779,'lock':_0x375779['LOCK'][_0x085d('0x6c')],'include':[{'model':db[_0x085d('0x50')],'as':_0x085d('0x6d'),'attributes':_0x4e695e,'include':[{'model':db[_0x085d('0x6e')],'as':_0x085d('0x6f'),'attributes':['id',_0x085d('0xe')]}]},{'model':db[_0x085d('0x70')],'as':_0x085d('0x71'),'attributes':['id',_0x085d('0xe')]},{'model':db[_0x085d('0x72')],'as':_0x085d('0x73'),'attributes':['id',_0x085d('0xe'),_0x085d('0x74')]}]})[_0x085d('0xb')](function(_0xf17978){if(_0xf17978){return _0xf17978[_0x085d('0xa')]({'UserId':_0x4b606d[_0x085d('0x48')]['id']},{'transaction':_0x375779});}});});}})['then'](handleEntityNotFound(_0x5b89e1,null))[_0x085d('0xb')](respondWithResult(_0x5b89e1,null))[_0x085d('0x36')](handleError(_0x5b89e1,null));};exports[_0x085d('0x75')]=function(_0x53d5ba,_0x326e94,_0x4de098){var _0x53fd1b=[];var _0x261ac7=_0x53d5ba[_0x085d('0x37')]['id'];var _0x4ba7a8=_0x53d5ba[_0x085d('0x48')]['id'];return db[_0x085d('0x50')][_0x085d('0x3e')]()[_0x085d('0xb')](function(_0x2f21c0){_0x53fd1b=_['keys'](_0x2f21c0);return db[_0x085d('0x69')][_0x085d('0x5e')](function(_0x5ada01){const _0x52cc7b={'id':_0x261ac7};return db[_0x085d('0x11')]['findOne']({'attributes':['id',_0x085d('0x76'),_0x085d('0x6b')],'where':_0x52cc7b,'transaction':_0x5ada01,'lock':_0x5ada01[_0x085d('0x77')][_0x085d('0x6c')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x53fd1b,'include':[{'model':db[_0x085d('0x6e')],'as':_0x085d('0x6f'),'attributes':['id',_0x085d('0xe')]}]},{'model':db['CmList'],'as':_0x085d('0x71'),'attributes':['id','name']},{'model':db[_0x085d('0x72')],'as':_0x085d('0x73'),'attributes':['id',_0x085d('0xe'),'dialActive']}]})[_0x085d('0xb')](function(_0x5994ec){if(_0x5994ec){return _0x5994ec[_0x085d('0xa')]({'UserId':_0x4ba7a8},{'transaction':_0x5ada01});}});});})[_0x085d('0xb')](handleEntityNotFound(_0x326e94,null))[_0x085d('0xb')](respondWithResult(_0x326e94,null))['catch'](handleError(_0x326e94,null));};exports['getOpenContacts']=function(_0x1c62e5,_0x2bc093){return _0x1c62e5[_0x085d('0x48')][_0x085d('0x78')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})['then'](function(_0x143289){if(_0x143289&&_0x143289[_0x085d('0x2b')]){return db[_0x085d('0x11')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x085d('0x4b'))},'VoiceQueueId':{'$in':_[_0x085d('0x16')](_0x143289,'id')},'$or':[{'UserId':null},{'UserId':_0x1c62e5[_0x085d('0x48')]['id']}]}});}return 0x0;})['then'](function(_0x16f6e7){if(!_['isNil'](_0x16f6e7)&&_[_0x085d('0x79')](_0x16f6e7)){return _0x2bc093[_0x085d('0x8')](0xc8)['json']({'contacts':_0x16f6e7});}else{logger[_0x085d('0xc')](_0x085d('0x7a'),_0x085d('0x7b'),0x194,'entity\x20not\x20found');_0x2bc093[_0x085d('0x7c')](0x194);}})[_0x085d('0x36')](handleError(_0x2bc093,null));};exports[_0x085d('0x7d')]=function(_0x18809c,_0x2de70b){var _0x562711=shared[_0x085d('0x7e')];var _0x11a937=[];_[_0x085d('0x16')](_0x562711,function(_0x4f866b){_0x11a937[_0x085d('0x7f')]({'id':_0x4f866b[_0x085d('0xe')],'name':_0x4f866b[_0x085d('0xe')],'utcOffset':_0x4f866b[_0x085d('0x80')]});});return _0x2de70b[_0x085d('0x8')](0xc8)[_0x085d('0x3')]({'tz':_0x11a937});};exports[_0x085d('0x81')]=function(_0x32cbca,_0x57706d){var _0x1f3144=shared['timezones'];var _0x4a4e8e={};if(!_[_0x085d('0x53')](_0x1f3144[_0x32cbca[_0x085d('0x3d')]['id']]))_0x4a4e8e=_0x1f3144[_0x32cbca[_0x085d('0x3d')]['id']];return _0x57706d[_0x085d('0x8')](0xc8)[_0x085d('0x3')](_0x4a4e8e);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index c1dbf77..5efaf18 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 _0x1883=['../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x276ca1,_0x150313){var _0x30a59c=function(_0xd77a2c){while(--_0xd77a2c){_0x276ca1['push'](_0x276ca1['shift']());}};_0x30a59c(++_0x150313);}(_0x1883,0xab));var _0x3188=function(_0x3490ea,_0xa6a43a){_0x3490ea=_0x3490ea-0x0;var _0x54f2ce=_0x1883[_0x3490ea];return _0x54f2ce;};'use strict';var _=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var logger=require(_0x3188('0x2'))(_0x3188('0x3'));var moment=require(_0x3188('0x4'));var BPromise=require(_0x3188('0x5'));var rp=require(_0x3188('0x6'));var fs=require('fs');var path=require(_0x3188('0x7'));var rimraf=require(_0x3188('0x8'));var config=require(_0x3188('0x9'));var attributes=require(_0x3188('0xa'));module[_0x3188('0xb')]=function(_0x408ae0,_0x33b62d){return _0x408ae0[_0x3188('0xc')](_0x3188('0xd'),attributes,{'tableName':_0x3188('0xe'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x3188('0xf')]},{'name':_0x3188('0x10'),'fields':['phone']},{'name':_0x3188('0x11'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2a07=['api','moment','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger'];(function(_0x2ea900,_0xd4c112){var _0x20ab6e=function(_0x4cc0ca){while(--_0x4cc0ca){_0x2ea900['push'](_0x2ea900['shift']());}};_0x20ab6e(++_0xd4c112);}(_0x2a07,0x74));var _0x72a0=function(_0x3b8363,_0x17bc8){_0x3b8363=_0x3b8363-0x0;var _0x4d8289=_0x2a07[_0x3b8363];return _0x4d8289;};'use strict';var _=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var logger=require(_0x72a0('0x2'))(_0x72a0('0x3'));var moment=require(_0x72a0('0x4'));var BPromise=require('bluebird');var rp=require(_0x72a0('0x5'));var fs=require('fs');var path=require(_0x72a0('0x6'));var rimraf=require(_0x72a0('0x7'));var config=require(_0x72a0('0x8'));var attributes=require(_0x72a0('0x9'));module[_0x72a0('0xa')]=function(_0x3ccf6d,_0x20dab9){return _0x3ccf6d[_0x72a0('0xb')](_0x72a0('0xc'),attributes,{'tableName':_0x72a0('0xd'),'paranoid':![],'indexes':[{'name':_0x72a0('0xe'),'fields':[_0x72a0('0xe')]},{'name':_0x72a0('0xf'),'fields':[_0x72a0('0xf')]},{'name':_0x72a0('0x10'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 398f687..5babe3f 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 _0x93ed=['\x20,\x201,\x20null','GetContactRecallMe','CmContact','describe','UserId','keys','GetContactByPhone','findOne','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','literal','NOW()\x20+\x20INTERVAL\x20','CmList','NOW()','lodash','util','moment','bluebird','../../mysqldb','rpc','CmHopper','findAll','options','where','include','map','model','attributes','then','info','GetCmHopper','debug','stringify','message','error','find','raw','ShowCmHopper','create','body','CreateCmHopper','update','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','catch','DestroyCmHopper','sequelize','transaction','limit','order','LOCK','UPDATE','Contact','User','Agent','name','voicePause','length','push','includes','all','GetContactDialer','dataValues','ContactId','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x93ed,0xfe));var _0xd93e=function(_0x24ecff,_0x5f0aca){_0x24ecff=_0x24ecff-0x0;var _0x38984c=_0x93ed[_0x24ecff];return _0x38984c;};'use strict';var _=require(_0xd93e('0x0'));var util=require(_0xd93e('0x1'));var moment=require(_0xd93e('0x2'));var BPromise=require(_0xd93e('0x3'));var db=require(_0xd93e('0x4'))['db'];var logger=require('../../config/logger')(_0xd93e('0x5'));exports['GetCmHopper']=function(_0x5a6206){var _0x812267=this;return new Promise(function(_0x5a4150,_0x462444){return db[_0xd93e('0x6')][_0xd93e('0x7')]({'raw':_0x5a6206[_0xd93e('0x8')]?_0x5a6206[_0xd93e('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x5a6206['options']?_0x5a6206[_0xd93e('0x8')][_0xd93e('0x9')]||null:null,'attributes':_0x5a6206[_0xd93e('0x8')]?_0x5a6206[_0xd93e('0x8')]['attributes']||null:null,'limit':_0x5a6206['options']?_0x5a6206[_0xd93e('0x8')]['limit']||null:null,'include':_0x5a6206[_0xd93e('0x8')]?_0x5a6206[_0xd93e('0x8')][_0xd93e('0xa')]?_[_0xd93e('0xb')](_0x5a6206[_0xd93e('0x8')]['include'],function(_0x652ac9){return{'model':db[_0x652ac9[_0xd93e('0xc')]],'as':_0x652ac9['as'],'attributes':_0x652ac9[_0xd93e('0xd')],'include':_0x652ac9[_0xd93e('0xa')]?_[_0xd93e('0xb')](_0x652ac9['include'],function(_0x59f1c4){return{'model':db[_0x59f1c4['model']],'as':_0x59f1c4['as'],'attributes':_0x59f1c4['attributes'],'include':_0x59f1c4[_0xd93e('0xa')]?_[_0xd93e('0xb')](_0x59f1c4[_0xd93e('0xa')],function(_0x4e1ce2){return{'model':db[_0x4e1ce2[_0xd93e('0xc')]],'as':_0x4e1ce2['as'],'attributes':_0x4e1ce2['attributes']};}):[]};}):[]};}):[]:[]})[_0xd93e('0xe')](function(_0x164238){logger[_0xd93e('0xf')](_0xd93e('0x10'),_0x5a6206);logger[_0xd93e('0x11')](_0xd93e('0x10'),_0x5a6206,JSON[_0xd93e('0x12')](_0x164238));_0x5a4150(_0x164238);})['catch'](function(_0x50c196){logger['error'](_0xd93e('0x10'),_0x50c196[_0xd93e('0x13')],_0x5a6206);_0x462444(_0x812267[_0xd93e('0x14')](0x1f4,_0x50c196['message']));});});};exports['ShowCmHopper']=function(_0x332d46){var _0x316a4f=this;return new Promise(function(_0x34063c,_0x235687){return db['CmHopper'][_0xd93e('0x15')]({'raw':_0x332d46[_0xd93e('0x8')]?_0x332d46[_0xd93e('0x8')][_0xd93e('0x16')]===undefined?!![]:![]:!![],'where':_0x332d46[_0xd93e('0x8')]?_0x332d46['options']['where']||null:null,'attributes':_0x332d46[_0xd93e('0x8')]?_0x332d46[_0xd93e('0x8')][_0xd93e('0xd')]||null:null,'include':_0x332d46[_0xd93e('0x8')]?_0x332d46[_0xd93e('0x8')][_0xd93e('0xa')]?_[_0xd93e('0xb')](_0x332d46[_0xd93e('0x8')][_0xd93e('0xa')],function(_0x1525c1){return{'model':db[_0x1525c1[_0xd93e('0xc')]],'as':_0x1525c1['as'],'attributes':_0x1525c1['attributes'],'include':_0x1525c1[_0xd93e('0xa')]?_['map'](_0x1525c1['include'],function(_0x1b2f60){return{'model':db[_0x1b2f60[_0xd93e('0xc')]],'as':_0x1b2f60['as'],'attributes':_0x1b2f60['attributes'],'include':_0x1b2f60[_0xd93e('0xa')]?_[_0xd93e('0xb')](_0x1b2f60[_0xd93e('0xa')],function(_0x49ae2c){return{'model':db[_0x49ae2c[_0xd93e('0xc')]],'as':_0x49ae2c['as'],'attributes':_0x49ae2c[_0xd93e('0xd')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2bff6e){logger[_0xd93e('0xf')](_0xd93e('0x17'),_0x332d46);logger[_0xd93e('0x11')]('ShowCmHopper',_0x332d46,JSON['stringify'](_0x2bff6e));_0x34063c(_0x2bff6e);})['catch'](function(_0x149209){logger[_0xd93e('0x14')](_0xd93e('0x17'),_0x149209[_0xd93e('0x13')],_0x332d46);_0x235687(_0x316a4f[_0xd93e('0x14')](0x1f4,_0x149209[_0xd93e('0x13')]));});});};exports['CreateCmHopper']=function(_0x34e112){var _0x48289c=this;return new Promise(function(_0x3581d0,_0x1f8b40){return db[_0xd93e('0x6')][_0xd93e('0x18')](_0x34e112[_0xd93e('0x19')],{'raw':_0x34e112['options']?_0x34e112['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x52df22){logger[_0xd93e('0xf')](_0xd93e('0x1a'),_0x34e112);logger[_0xd93e('0x11')]('CreateCmHopper',_0x34e112,JSON[_0xd93e('0x12')](_0x52df22));_0x3581d0(_0x52df22);})['catch'](function(_0x599f40){logger[_0xd93e('0x14')](_0xd93e('0x1a'),_0x599f40[_0xd93e('0x13')],_0x34e112);_0x1f8b40(_0x48289c[_0xd93e('0x14')](0x1f4,_0x599f40['message']));});});};exports['UpdateCmHopper']=function(_0x1e19ec){var _0x18e59e=this;return new Promise(function(_0x23a4c7,_0x578c0d){return db[_0xd93e('0x6')][_0xd93e('0x1b')](_0x1e19ec['body'],{'raw':_0x1e19ec['options']?_0x1e19ec['options'][_0xd93e('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e19ec[_0xd93e('0x8')]?_0x1e19ec[_0xd93e('0x8')][_0xd93e('0x9')]||null:null,'attributes':_0x1e19ec[_0xd93e('0x8')]?_0x1e19ec[_0xd93e('0x8')][_0xd93e('0xd')]||null:null,'limit':_0x1e19ec['options']?_0x1e19ec[_0xd93e('0x8')]['limit']||null:null})[_0xd93e('0xe')](function(_0x593a35){logger[_0xd93e('0xf')](_0xd93e('0x1c'),_0x1e19ec);logger['info'](_0xd93e('0x1d'),JSON[_0xd93e('0x12')](_0x1e19ec['options'][_0xd93e('0x9')]),_0x1e19ec[_0xd93e('0x19')][_0xd93e('0x1e')]);logger['debug']('UpdateCmHopper',_0x1e19ec,JSON['stringify'](_0x593a35));_0x23a4c7(_0x593a35);})[_0xd93e('0x1f')](function(_0x1129ec){logger[_0xd93e('0x14')](_0xd93e('0x1c'),_0x1129ec[_0xd93e('0x13')],_0x1e19ec);_0x578c0d(_0x18e59e[_0xd93e('0x14')](0x1f4,_0x1129ec[_0xd93e('0x13')]));});});};exports[_0xd93e('0x20')]=function(_0x4ea2cb){var _0x2c7806=this;return new Promise(function(_0x5eeee6,_0xddb8a4){return db[_0xd93e('0x6')]['destroy']({'where':_0x4ea2cb[_0xd93e('0x8')]?_0x4ea2cb[_0xd93e('0x8')][_0xd93e('0x9')]||null:null})[_0xd93e('0xe')](function(_0x2204c3){logger['info'](_0xd93e('0x20'),_0x4ea2cb);logger[_0xd93e('0x11')](_0xd93e('0x20'),_0x4ea2cb,JSON['stringify'](_0x2204c3));_0x5eeee6(_0x2204c3);})[_0xd93e('0x1f')](function(_0x59add6){logger['error'](_0xd93e('0x20'),_0x59add6[_0xd93e('0x13')],_0x4ea2cb);_0xddb8a4(_0x2c7806[_0xd93e('0x14')](0x1f4,_0x59add6['message']));});});};exports['GetContactDialer']=function(_0x1919ba){var _0x417fdc=this;return new Promise(function(_0x1c04b9,_0x142ae2){return db['CmContact']['describe']()[_0xd93e('0xe')](function(_0xc50f32){return db[_0xd93e('0x21')][_0xd93e('0x22')](function(_0x319723){return db[_0xd93e('0x6')][_0xd93e('0x7')]({'where':_0x1919ba[_0xd93e('0x8')]?_0x1919ba[_0xd93e('0x8')][_0xd93e('0x9')]||null:null,'attributes':_0x1919ba[_0xd93e('0x8')]?_0x1919ba[_0xd93e('0x8')][_0xd93e('0xd')]||null:null,'limit':_0x1919ba[_0xd93e('0x8')]?_0x1919ba[_0xd93e('0x8')][_0xd93e('0x23')]||null:null,'order':_0x1919ba['options']?_0x1919ba[_0xd93e('0x8')][_0xd93e('0x24')]||null:null,'transaction':_0x319723,'lock':_0x319723[_0xd93e('0x25')][_0xd93e('0x26')],'include':[{'model':db['CmContact'],'as':_0xd93e('0x27'),'attributes':_['keys'](_0xc50f32)},{'model':db[_0xd93e('0x28')],'as':_0xd93e('0x29'),'attributes':['id',_0xd93e('0x2a'),_0xd93e('0x2b')]}]})[_0xd93e('0xe')](function(_0x48fff4){var _0x2beb6a=[];var _0x419004=[];for(var _0x3a2fe6=0x0;_0x3a2fe6<_0x48fff4[_0xd93e('0x2c')];_0x3a2fe6+=0x1){var _0xddb2ad=_0x48fff4[_0x3a2fe6]['UserId'];if(_0xddb2ad===null){_0x2beb6a[_0xd93e('0x2d')](_0x48fff4[_0x3a2fe6][_0xd93e('0x1b')](_0x1919ba[_0xd93e('0x19')],{'transaction':_0x319723}));}else if(!_0x419004[_0xd93e('0x2e')](_0xddb2ad)){_0x419004['push'](_0xddb2ad);_0x2beb6a['push'](_0x48fff4[_0x3a2fe6][_0xd93e('0x1b')](_0x1919ba[_0xd93e('0x19')],{'transaction':_0x319723}));}}return BPromise[_0xd93e('0x2f')](_0x2beb6a);});})[_0xd93e('0xe')](function(_0x3d197d){logger[_0xd93e('0xf')](_0xd93e('0x30'),_0x1919ba);if(_0x3d197d[_0xd93e('0x2c')]>0x0){logger['info']('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x3d197d[0x0][_0xd93e('0x31')]['id'],_0x3d197d[0x0]['dataValues'][_0xd93e('0x32')],_0x3d197d[0x0][_0xd93e('0x31')][_0xd93e('0x1e')]);}logger[_0xd93e('0x11')](_0xd93e('0x30'),_0x1919ba,JSON['stringify'](_0x3d197d));_0x1c04b9(_0x3d197d);})[_0xd93e('0x1f')](function(_0x4c953e){logger[_0xd93e('0x14')](_0xd93e('0x30'),_0x4c953e[_0xd93e('0x13')],_0x1919ba);_0x142ae2(_0x417fdc['error'](0x1f4,_0x4c953e[_0xd93e('0x13')]));});});});};exports['MoveContactManagedDialer']=function(_0x4e8e14){var _0x180303=this;return new Promise(function(_0x4080c9,_0x37b306){return db[_0xd93e('0x21')][_0xd93e('0x22')](function(_0x522310){return db['CmHopperFinal']['create'](_0x4e8e14['body'],{'raw':_0x4e8e14[_0xd93e('0x8')]?_0x4e8e14[_0xd93e('0x8')]['raw']===undefined?!![]:![]:!![],'transaction':_0x522310})[_0xd93e('0xe')](function(){logger['info'](_0xd93e('0x33'),JSON[_0xd93e('0x12')](_0x4e8e14[_0xd93e('0x8')][_0xd93e('0x9')]),_0x4e8e14[_0xd93e('0x8')][_0xd93e('0x9')][_0xd93e('0x1e')]);return db[_0xd93e('0x6')]['destroy']({'where':_0x4e8e14[_0xd93e('0x8')]?_0x4e8e14[_0xd93e('0x8')][_0xd93e('0x9')]||null:null,'transaction':_0x522310});});})[_0xd93e('0xe')](function(_0x3278c9){logger['info'](_0xd93e('0x34'),_0x4e8e14);logger[_0xd93e('0x11')](_0xd93e('0x34'),_0x4e8e14,JSON[_0xd93e('0x12')](_0x3278c9));_0x4080c9(_0x3278c9);})['catch'](function(_0x4cee73){logger[_0xd93e('0x14')](_0xd93e('0x34'),_0x4cee73[_0xd93e('0x13')],_0x4e8e14);_0x37b306(_0x180303[_0xd93e('0x14')](0x1f4,_0x4cee73[_0xd93e('0x13')]));});});};exports[_0xd93e('0x35')]=function(_0x1823f8){var _0x56b2c7=this;return new Promise(function(_0x1102c0,_0xb8b75d){return db['CmHopper'][_0xd93e('0x7')]({'raw':_0x1823f8['options']?_0x1823f8[_0xd93e('0x8')][_0xd93e('0x16')]===undefined?!![]:![]:!![],'where':_0x1823f8[_0xd93e('0x8')]?_0x1823f8[_0xd93e('0x8')]['where']||null:null,'attributes':[[db[_0xd93e('0x21')]['fn'](_0xd93e('0x36'),db['sequelize']['fn']('IF',db[_0xd93e('0x21')]['literal'](_0xd93e('0x37')+util[_0xd93e('0x38')](_0xd93e('0x39'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'))+_0xd93e('0x3a')))),'contactsRescheduled']]})[_0xd93e('0xe')](function(_0x3f415c){logger['info'](_0xd93e('0x35'),_0x1823f8);logger[_0xd93e('0x11')](_0xd93e('0x35'),_0x1823f8,JSON[_0xd93e('0x12')](_0x3f415c));_0x1102c0(_0x3f415c);})['catch'](function(_0x190ce2){logger[_0xd93e('0x14')](_0xd93e('0x35'),_0x190ce2['message'],_0x1823f8);_0xb8b75d(_0x56b2c7[_0xd93e('0x14')](0x1f4,_0x190ce2['message']));});});};exports[_0xd93e('0x3b')]=function(_0x4506dc){var _0x3a2cfc=this;return new Promise(function(_0x4dd2b3,_0x216240){return db[_0xd93e('0x3c')][_0xd93e('0x3d')]()[_0xd93e('0xe')](function(){return db[_0xd93e('0x21')][_0xd93e('0x22')](function(_0x185995){return db[_0xd93e('0x6')][_0xd93e('0x7')]({'where':_0x4506dc[_0xd93e('0x8')]?_0x4506dc[_0xd93e('0x8')]['where']||null:null,'attributes':_0x4506dc[_0xd93e('0x8')]?_0x4506dc[_0xd93e('0x8')][_0xd93e('0xd')]||null:null,'limit':0x1,'order':_0x4506dc[_0xd93e('0x8')]?_0x4506dc[_0xd93e('0x8')]['order']||null:null,'group':db[_0xd93e('0x6')][_0xd93e('0x3e')],'transaction':_0x185995,'lock':_0x185995[_0xd93e('0x25')][_0xd93e('0x26')],'include':_0x4506dc['options']?_0x4506dc[_0xd93e('0x8')][_0xd93e('0xa')]?_[_0xd93e('0xb')](_0x4506dc['options'][_0xd93e('0xa')],function(_0x2f1f4e){return{'model':db[_0x2f1f4e[_0xd93e('0xc')]],'as':_0x2f1f4e['as'],'attributes':_0x2f1f4e[_0xd93e('0xd')],'include':_0x2f1f4e[_0xd93e('0xa')]?_[_0xd93e('0xb')](_0x2f1f4e[_0xd93e('0xa')],function(_0x25e15f){return{'model':db[_0x25e15f[_0xd93e('0xc')]],'as':_0x25e15f['as'],'attributes':_0x25e15f['attributes'],'include':_0x25e15f[_0xd93e('0xa')]?_[_0xd93e('0xb')](_0x25e15f[_0xd93e('0xa')],function(_0x148861){return{'model':db[_0x148861[_0xd93e('0xc')]],'as':_0x148861['as'],'attributes':_0x148861[_0xd93e('0xd')]};}):[]};}):[]};}):[]:[]})[_0xd93e('0xe')](function(_0xea582e){var _0x2fd011=[];for(var _0x1eedd3=0x0;_0x1eedd3<_0xea582e[_0xd93e('0x2c')];_0x1eedd3+=0x1){_0x2fd011[_0xd93e('0x2d')](_0xea582e[_0x1eedd3]['update'](_0x4506dc[_0xd93e('0x19')],{'transaction':_0x185995}));}return BPromise[_0xd93e('0x2f')](_0x2fd011);});})[_0xd93e('0xe')](function(_0x489f32){logger[_0xd93e('0xf')](_0xd93e('0x3b'),_0x4506dc);logger[_0xd93e('0x11')](_0xd93e('0x3b'),_0x4506dc,JSON[_0xd93e('0x12')](_0x489f32));_0x4dd2b3(_0x489f32);})[_0xd93e('0x1f')](function(_0x29362f){logger['error'](_0xd93e('0x3b'),_0x29362f[_0xd93e('0x13')],_0x4506dc);_0x216240(_0x3a2cfc[_0xd93e('0x14')](0x1f4,_0x29362f[_0xd93e('0x13')]));});});});};exports['GetCmHopperPreview']=function(_0x55bbc5){var _0x18add0=this;return new Promise(function(_0x51130,_0x45024c){db[_0xd93e('0x3c')]['describe']()[_0xd93e('0xe')](function(_0x55d776){return db[_0xd93e('0x6')][_0xd93e('0x7')]({'raw':_0x55bbc5[_0xd93e('0x8')]?_0x55bbc5['options'][_0xd93e('0x16')]===undefined?!![]:![]:!![],'where':_0x55bbc5[_0xd93e('0x8')]?_0x55bbc5['options'][_0xd93e('0x9')]||null:null,'attributes':_0x55bbc5[_0xd93e('0x8')]?_0x55bbc5[_0xd93e('0x8')][_0xd93e('0xd')]||null:null,'limit':_0x55bbc5[_0xd93e('0x8')]?_0x55bbc5[_0xd93e('0x8')][_0xd93e('0x23')]||null:null,'include':_0x55bbc5[_0xd93e('0x8')]?_0x55bbc5[_0xd93e('0x8')][_0xd93e('0xa')]?_[_0xd93e('0xb')](_0x55bbc5[_0xd93e('0x8')][_0xd93e('0xa')],function(_0x1aa7ed){return{'model':db[_0x1aa7ed[_0xd93e('0xc')]],'as':_0x1aa7ed['as'],'attributes':_0x1aa7ed['as']===_0xd93e('0x27')?_[_0xd93e('0x3f')](_0x55d776):_0x1aa7ed[_0xd93e('0xd')],'include':_0x1aa7ed[_0xd93e('0xa')]?_[_0xd93e('0xb')](_0x1aa7ed['include'],function(_0x52a270){return{'model':db[_0x52a270[_0xd93e('0xc')]],'as':_0x52a270['as'],'attributes':_0x52a270[_0xd93e('0xd')],'include':_0x52a270[_0xd93e('0xa')]?_[_0xd93e('0xb')](_0x52a270[_0xd93e('0xa')],function(_0x2fc36c){return{'model':db[_0x2fc36c['model']],'as':_0x2fc36c['as'],'attributes':_0x2fc36c['attributes']};}):[]};}):[]};}):[]:[]})[_0xd93e('0xe')](function(_0x427689){logger['info']('GetCmHopper',_0x55bbc5);logger[_0xd93e('0x11')]('GetCmHopper',_0x55bbc5,JSON[_0xd93e('0x12')](_0x427689));_0x51130(_0x427689);})[_0xd93e('0x1f')](function(_0x267099){logger['error']('GetCmHopper',_0x267099[_0xd93e('0x13')],_0x55bbc5);_0x45024c(_0x18add0[_0xd93e('0x14')](0x1f4,_0x267099['message']));});});});};exports[_0xd93e('0x40')]=function(_0x50a5c5){var _0x59763b=this;return new Promise(function(_0x366310,_0x2d7a16){return db['CmContact'][_0xd93e('0x41')]({'raw':!![],'where':{'phone':_0x50a5c5[_0xd93e('0x8')]['where']['phone']},'attributes':['id',_0xd93e('0x42')],'order':[['id',_0xd93e('0x43')]]})[_0xd93e('0xe')](function(_0x489702){logger[_0xd93e('0xf')](_0xd93e('0x44'),_0x50a5c5);logger['debug'](_0xd93e('0x44'),_0x50a5c5,JSON[_0xd93e('0x12')](_0x489702));_0x366310(_0x489702);})['catch'](function(_0x503a73){logger[_0xd93e('0x14')](_0xd93e('0x44'),_0x503a73['message'],_0x50a5c5);_0x2d7a16(_0x59763b['error'](0x1f4,_0x503a73[_0xd93e('0x13')]));});});};exports[_0xd93e('0x45')]=function(_0x468e82){var _0x5e7b13=this;return new Promise(function(_0xff74b,_0x1c682f){return db['sequelize'][_0xd93e('0x22')](function(_0x59d321){var _0x20b1d3=_0x468e82['options']&&_0x468e82[_0xd93e('0x8')][_0xd93e('0x9')]?_0x468e82[_0xd93e('0x8')][_0xd93e('0x9')]:{};return db[_0xd93e('0x6')]['update'](_0x468e82[_0xd93e('0x19')],{'where':_0x20b1d3,'transaction':_0x59d321})[_0xd93e('0xe')](function(_0x4218cc){logger[_0xd93e('0xf')](_0xd93e('0x45'),_0x468e82);logger[_0xd93e('0x11')]('ResetActiveCalls',_0x468e82,JSON[_0xd93e('0x12')](_0x4218cc));_0xff74b(_0x4218cc);})[_0xd93e('0x1f')](function(_0x13bccd){logger[_0xd93e('0x14')](_0xd93e('0x45'),_0x13bccd[_0xd93e('0x13')],_0x468e82);_0x1c682f(_0x5e7b13[_0xd93e('0x14')](0x1f4,_0x13bccd[_0xd93e('0x13')]));});});});};exports[_0xd93e('0x46')]=function(_0x275033){var _0xf347d8=this;var _0x17b798=_0x275033[_0xd93e('0x19')][_0xd93e('0x9')][_0xd93e('0x47')];var _0x5b812c=_0x275033['body'][_0xd93e('0x9')][_0xd93e('0x48')];var _0x3653ba=_0x275033[_0xd93e('0x19')]['where'][_0xd93e('0x49')];return new Promise(function(_0x2b7976,_0x330524){return db['CmHopper'][_0xd93e('0x7')]({'where':{'voiceQueueId':{'$in':_0x17b798},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xd93e('0x21')][_0xd93e('0x4a')](_0xd93e('0x4b')+_0x5b812c+'\x20MINUTE'),'$gt':db[_0xd93e('0x21')][_0xd93e('0x4a')]('NOW()')}},'UserId':{'$in':_0x3653ba}},'include':[{'model':db[_0xd93e('0x3c')],'as':_0xd93e('0x27')},{'model':db[_0xd93e('0x28')],'as':_0xd93e('0x29'),'attributes':['id',_0xd93e('0x2a'),_0xd93e('0x2b')]},{'model':db[_0xd93e('0x4c')],'as':'List'}]})[_0xd93e('0xe')](function(_0x7651e8){if(_0x7651e8[_0xd93e('0x2c')]>0x0){return db[_0xd93e('0x21')][_0xd93e('0x22')](function(_0x4eed9d){return db[_0xd93e('0x6')]['update']({'recallmeNotifiedDate':db[_0xd93e('0x21')][_0xd93e('0x4a')](_0xd93e('0x4d'))},{'where':{'id':{'$in':_['map'](_0x7651e8,'id')}},'transaction':_0x4eed9d})['then'](function(){_0x2b7976(_0x7651e8);})['catch'](function(_0x940ef0){logger[_0xd93e('0x14')]('CmHopperHandlePreviewRecallNotifications',_0x940ef0['message'],_0x275033);_0x330524(_0xf347d8[_0xd93e('0x14')](0x1f4,_0x940ef0[_0xd93e('0x13')]));});})[_0xd93e('0x1f')](function(_0x3c937e){logger[_0xd93e('0x14')](_0xd93e('0x46'),_0x3c937e['message'],_0x275033);_0x330524(_0xf347d8['error'](0x1f4,_0x3c937e[_0xd93e('0x13')]));});}else{_0x2b7976(_0x7651e8);}});});}; \ No newline at end of file +var _0x6d40=['MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','format','\x22%s\x22','\x20,\x201,\x20null','GetContactRecallMe','order','UPDATE','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','CmList','NOW()','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model','then','info','debug','stringify','error','message','ShowCmHopper','find','catch','CreateCmHopper','create','body','UpdateCmHopper','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','Contact','keys','User','Agent','name','voicePause','length','UserId','push','update','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','MoveContactManagedDialer','CmHopperFinal'];(function(_0x1fb4a0,_0x48a602){var _0x1094e7=function(_0x25fcd5){while(--_0x25fcd5){_0x1fb4a0['push'](_0x1fb4a0['shift']());}};_0x1094e7(++_0x48a602);}(_0x6d40,0x1ec));var _0x06d4=function(_0x1893a6,_0x54b613){_0x1893a6=_0x1893a6-0x0;var _0x1ed2a2=_0x6d40[_0x1893a6];return _0x1ed2a2;};'use strict';var _=require(_0x06d4('0x0'));var util=require(_0x06d4('0x1'));var moment=require('moment');var BPromise=require(_0x06d4('0x2'));var db=require(_0x06d4('0x3'))['db'];var logger=require(_0x06d4('0x4'))(_0x06d4('0x5'));exports[_0x06d4('0x6')]=function(_0x22bdf7){var _0x14ef32=this;return new Promise(function(_0x894f46,_0x518698){return db[_0x06d4('0x7')][_0x06d4('0x8')]({'raw':_0x22bdf7[_0x06d4('0x9')]?_0x22bdf7[_0x06d4('0x9')][_0x06d4('0xa')]===undefined?!![]:![]:!![],'where':_0x22bdf7['options']?_0x22bdf7[_0x06d4('0x9')][_0x06d4('0xb')]||null:null,'attributes':_0x22bdf7[_0x06d4('0x9')]?_0x22bdf7[_0x06d4('0x9')][_0x06d4('0xc')]||null:null,'limit':_0x22bdf7[_0x06d4('0x9')]?_0x22bdf7[_0x06d4('0x9')][_0x06d4('0xd')]||null:null,'include':_0x22bdf7[_0x06d4('0x9')]?_0x22bdf7[_0x06d4('0x9')][_0x06d4('0xe')]?_[_0x06d4('0xf')](_0x22bdf7[_0x06d4('0x9')][_0x06d4('0xe')],function(_0x24e248){return{'model':db[_0x24e248[_0x06d4('0x10')]],'as':_0x24e248['as'],'attributes':_0x24e248[_0x06d4('0xc')],'include':_0x24e248[_0x06d4('0xe')]?_[_0x06d4('0xf')](_0x24e248['include'],function(_0x4fccfe){return{'model':db[_0x4fccfe[_0x06d4('0x10')]],'as':_0x4fccfe['as'],'attributes':_0x4fccfe['attributes'],'include':_0x4fccfe[_0x06d4('0xe')]?_[_0x06d4('0xf')](_0x4fccfe[_0x06d4('0xe')],function(_0x4be28c){return{'model':db[_0x4be28c['model']],'as':_0x4be28c['as'],'attributes':_0x4be28c[_0x06d4('0xc')]};}):[]};}):[]};}):[]:[]})[_0x06d4('0x11')](function(_0x125016){logger[_0x06d4('0x12')](_0x06d4('0x6'),_0x22bdf7);logger[_0x06d4('0x13')]('GetCmHopper',_0x22bdf7,JSON[_0x06d4('0x14')](_0x125016));_0x894f46(_0x125016);})['catch'](function(_0x343387){logger[_0x06d4('0x15')](_0x06d4('0x6'),_0x343387[_0x06d4('0x16')],_0x22bdf7);_0x518698(_0x14ef32['error'](0x1f4,_0x343387['message']));});});};exports[_0x06d4('0x17')]=function(_0x360c13){var _0x1d6721=this;return new Promise(function(_0x21b4ca,_0x10fbeb){return db[_0x06d4('0x7')][_0x06d4('0x18')]({'raw':_0x360c13['options']?_0x360c13[_0x06d4('0x9')][_0x06d4('0xa')]===undefined?!![]:![]:!![],'where':_0x360c13[_0x06d4('0x9')]?_0x360c13['options'][_0x06d4('0xb')]||null:null,'attributes':_0x360c13[_0x06d4('0x9')]?_0x360c13[_0x06d4('0x9')]['attributes']||null:null,'include':_0x360c13[_0x06d4('0x9')]?_0x360c13[_0x06d4('0x9')][_0x06d4('0xe')]?_['map'](_0x360c13[_0x06d4('0x9')][_0x06d4('0xe')],function(_0x283425){return{'model':db[_0x283425[_0x06d4('0x10')]],'as':_0x283425['as'],'attributes':_0x283425[_0x06d4('0xc')],'include':_0x283425[_0x06d4('0xe')]?_[_0x06d4('0xf')](_0x283425[_0x06d4('0xe')],function(_0x62cfaa){return{'model':db[_0x62cfaa[_0x06d4('0x10')]],'as':_0x62cfaa['as'],'attributes':_0x62cfaa['attributes'],'include':_0x62cfaa[_0x06d4('0xe')]?_['map'](_0x62cfaa[_0x06d4('0xe')],function(_0x438cd7){return{'model':db[_0x438cd7['model']],'as':_0x438cd7['as'],'attributes':_0x438cd7[_0x06d4('0xc')]};}):[]};}):[]};}):[]:[]})[_0x06d4('0x11')](function(_0x187da0){logger[_0x06d4('0x12')]('ShowCmHopper',_0x360c13);logger[_0x06d4('0x13')](_0x06d4('0x17'),_0x360c13,JSON[_0x06d4('0x14')](_0x187da0));_0x21b4ca(_0x187da0);})[_0x06d4('0x19')](function(_0x4c64b5){logger[_0x06d4('0x15')](_0x06d4('0x17'),_0x4c64b5[_0x06d4('0x16')],_0x360c13);_0x10fbeb(_0x1d6721[_0x06d4('0x15')](0x1f4,_0x4c64b5['message']));});});};exports[_0x06d4('0x1a')]=function(_0x276058){var _0x23903e=this;return new Promise(function(_0x24ce73,_0x52639f){return db[_0x06d4('0x7')][_0x06d4('0x1b')](_0x276058['body'],{'raw':_0x276058['options']?_0x276058[_0x06d4('0x9')][_0x06d4('0xa')]===undefined?!![]:![]:!![]})[_0x06d4('0x11')](function(_0x6ed1be){logger[_0x06d4('0x12')](_0x06d4('0x1a'),_0x276058);logger[_0x06d4('0x13')](_0x06d4('0x1a'),_0x276058,JSON[_0x06d4('0x14')](_0x6ed1be));_0x24ce73(_0x6ed1be);})[_0x06d4('0x19')](function(_0x44a8d8){logger[_0x06d4('0x15')](_0x06d4('0x1a'),_0x44a8d8[_0x06d4('0x16')],_0x276058);_0x52639f(_0x23903e[_0x06d4('0x15')](0x1f4,_0x44a8d8[_0x06d4('0x16')]));});});};exports['UpdateCmHopper']=function(_0x3a8f70){var _0x1ab3ec=this;return new Promise(function(_0x5dbcd2,_0x37fd23){return db['CmHopper']['update'](_0x3a8f70[_0x06d4('0x1c')],{'raw':_0x3a8f70[_0x06d4('0x9')]?_0x3a8f70[_0x06d4('0x9')][_0x06d4('0xa')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a8f70[_0x06d4('0x9')]?_0x3a8f70['options'][_0x06d4('0xb')]||null:null,'attributes':_0x3a8f70[_0x06d4('0x9')]?_0x3a8f70[_0x06d4('0x9')][_0x06d4('0xc')]||null:null,'limit':_0x3a8f70[_0x06d4('0x9')]?_0x3a8f70[_0x06d4('0x9')]['limit']||null:null})[_0x06d4('0x11')](function(_0x3c051c){logger['info'](_0x06d4('0x1d'),_0x3a8f70);logger['info']('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x06d4('0x14')](_0x3a8f70[_0x06d4('0x9')][_0x06d4('0xb')]),_0x3a8f70['body'][_0x06d4('0x1e')]);logger[_0x06d4('0x13')]('UpdateCmHopper',_0x3a8f70,JSON['stringify'](_0x3c051c));_0x5dbcd2(_0x3c051c);})['catch'](function(_0xe5e82e){logger[_0x06d4('0x15')](_0x06d4('0x1d'),_0xe5e82e[_0x06d4('0x16')],_0x3a8f70);_0x37fd23(_0x1ab3ec[_0x06d4('0x15')](0x1f4,_0xe5e82e[_0x06d4('0x16')]));});});};exports[_0x06d4('0x1f')]=function(_0x337358){var _0x4a6216=this;return new Promise(function(_0x5ada7e,_0x54004a){return db[_0x06d4('0x7')][_0x06d4('0x20')]({'where':_0x337358[_0x06d4('0x9')]?_0x337358[_0x06d4('0x9')][_0x06d4('0xb')]||null:null})[_0x06d4('0x11')](function(_0x3d76ff){logger[_0x06d4('0x12')](_0x06d4('0x1f'),_0x337358);logger[_0x06d4('0x13')](_0x06d4('0x1f'),_0x337358,JSON['stringify'](_0x3d76ff));_0x5ada7e(_0x3d76ff);})[_0x06d4('0x19')](function(_0x4a481e){logger['error'](_0x06d4('0x1f'),_0x4a481e['message'],_0x337358);_0x54004a(_0x4a6216[_0x06d4('0x15')](0x1f4,_0x4a481e[_0x06d4('0x16')]));});});};exports[_0x06d4('0x21')]=function(_0x487a2a){var _0x43e5b8=this;return new Promise(function(_0x3899ba,_0x5c16c9){return db[_0x06d4('0x22')][_0x06d4('0x23')]()[_0x06d4('0x11')](function(_0x2d164a){return db[_0x06d4('0x24')][_0x06d4('0x25')](function(_0x1ac5cb){return db[_0x06d4('0x7')]['findAll']({'where':_0x487a2a[_0x06d4('0x9')]?_0x487a2a['options'][_0x06d4('0xb')]||null:null,'attributes':_0x487a2a[_0x06d4('0x9')]?_0x487a2a[_0x06d4('0x9')][_0x06d4('0xc')]||null:null,'limit':_0x487a2a[_0x06d4('0x9')]?_0x487a2a[_0x06d4('0x9')][_0x06d4('0xd')]||null:null,'order':_0x487a2a[_0x06d4('0x9')]?_0x487a2a[_0x06d4('0x9')]['order']||null:null,'transaction':_0x1ac5cb,'lock':_0x1ac5cb['LOCK']['UPDATE'],'include':[{'model':db[_0x06d4('0x22')],'as':_0x06d4('0x26'),'attributes':_[_0x06d4('0x27')](_0x2d164a)},{'model':db[_0x06d4('0x28')],'as':_0x06d4('0x29'),'attributes':['id',_0x06d4('0x2a'),_0x06d4('0x2b')]}]})['then'](function(_0x56079c){var _0xd8d9df=[];var _0x3f0002=[];for(var _0x442e2f=0x0;_0x442e2f<_0x56079c[_0x06d4('0x2c')];_0x442e2f+=0x1){var _0x507946=_0x56079c[_0x442e2f][_0x06d4('0x2d')];if(_0x507946===null){_0xd8d9df[_0x06d4('0x2e')](_0x56079c[_0x442e2f][_0x06d4('0x2f')](_0x487a2a[_0x06d4('0x1c')],{'transaction':_0x1ac5cb}));}else if(!_0x3f0002[_0x06d4('0x30')](_0x507946)){_0x3f0002['push'](_0x507946);_0xd8d9df[_0x06d4('0x2e')](_0x56079c[_0x442e2f]['update'](_0x487a2a[_0x06d4('0x1c')],{'transaction':_0x1ac5cb}));}}return BPromise[_0x06d4('0x31')](_0xd8d9df);});})[_0x06d4('0x11')](function(_0x5e3311){logger[_0x06d4('0x12')](_0x06d4('0x21'),_0x487a2a);if(_0x5e3311[_0x06d4('0x2c')]>0x0){logger['info'](_0x06d4('0x32'),_0x5e3311[0x0]['dataValues']['id'],_0x5e3311[0x0]['dataValues']['ContactId'],_0x5e3311[0x0][_0x06d4('0x33')][_0x06d4('0x1e')]);}logger['debug'](_0x06d4('0x21'),_0x487a2a,JSON[_0x06d4('0x14')](_0x5e3311));_0x3899ba(_0x5e3311);})['catch'](function(_0x1c851d){logger['error']('GetContactDialer',_0x1c851d[_0x06d4('0x16')],_0x487a2a);_0x5c16c9(_0x43e5b8[_0x06d4('0x15')](0x1f4,_0x1c851d[_0x06d4('0x16')]));});});});};exports[_0x06d4('0x34')]=function(_0x3b5c44){var _0x4fb5f3=this;return new Promise(function(_0x54eb8f,_0x1ddaaa){return db[_0x06d4('0x24')][_0x06d4('0x25')](function(_0x4920df){return db[_0x06d4('0x35')][_0x06d4('0x1b')](_0x3b5c44[_0x06d4('0x1c')],{'raw':_0x3b5c44[_0x06d4('0x9')]?_0x3b5c44['options'][_0x06d4('0xa')]===undefined?!![]:![]:!![],'transaction':_0x4920df})['then'](function(){logger[_0x06d4('0x12')](_0x06d4('0x36'),JSON[_0x06d4('0x14')](_0x3b5c44['options']['where']),_0x3b5c44[_0x06d4('0x9')]['where'][_0x06d4('0x1e')]);return db[_0x06d4('0x7')][_0x06d4('0x20')]({'where':_0x3b5c44['options']?_0x3b5c44[_0x06d4('0x9')][_0x06d4('0xb')]||null:null,'transaction':_0x4920df});});})[_0x06d4('0x11')](function(_0x3309d6){logger[_0x06d4('0x12')](_0x06d4('0x34'),_0x3b5c44);logger['debug'](_0x06d4('0x34'),_0x3b5c44,JSON[_0x06d4('0x14')](_0x3309d6));_0x54eb8f(_0x3309d6);})[_0x06d4('0x19')](function(_0x26560b){logger[_0x06d4('0x15')]('MoveContactManagedDialer',_0x26560b[_0x06d4('0x16')],_0x3b5c44);_0x1ddaaa(_0x4fb5f3['error'](0x1f4,_0x26560b[_0x06d4('0x16')]));});});};exports[_0x06d4('0x37')]=function(_0x2939cd){var _0x288db2=this;return new Promise(function(_0x4ada21,_0x3223a9){return db[_0x06d4('0x7')][_0x06d4('0x8')]({'raw':_0x2939cd[_0x06d4('0x9')]?_0x2939cd[_0x06d4('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x2939cd[_0x06d4('0x9')]?_0x2939cd[_0x06d4('0x9')][_0x06d4('0xb')]||null:null,'attributes':[[db['sequelize']['fn'](_0x06d4('0x38'),db[_0x06d4('0x24')]['fn']('IF',db[_0x06d4('0x24')][_0x06d4('0x39')]('`scheduledat`\x20>=\x20'+util[_0x06d4('0x3a')](_0x06d4('0x3b'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'))+_0x06d4('0x3c')))),'contactsRescheduled']]})['then'](function(_0x118c39){logger[_0x06d4('0x12')](_0x06d4('0x37'),_0x2939cd);logger[_0x06d4('0x13')](_0x06d4('0x37'),_0x2939cd,JSON[_0x06d4('0x14')](_0x118c39));_0x4ada21(_0x118c39);})[_0x06d4('0x19')](function(_0x229310){logger[_0x06d4('0x15')](_0x06d4('0x37'),_0x229310['message'],_0x2939cd);_0x3223a9(_0x288db2[_0x06d4('0x15')](0x1f4,_0x229310['message']));});});};exports[_0x06d4('0x3d')]=function(_0x4b696d){var _0x180ae7=this;return new Promise(function(_0x3c6666,_0x43ec88){return db[_0x06d4('0x22')][_0x06d4('0x23')]()[_0x06d4('0x11')](function(){return db[_0x06d4('0x24')][_0x06d4('0x25')](function(_0x1b4a59){return db[_0x06d4('0x7')][_0x06d4('0x8')]({'where':_0x4b696d[_0x06d4('0x9')]?_0x4b696d[_0x06d4('0x9')][_0x06d4('0xb')]||null:null,'attributes':_0x4b696d[_0x06d4('0x9')]?_0x4b696d[_0x06d4('0x9')][_0x06d4('0xc')]||null:null,'limit':0x1,'order':_0x4b696d[_0x06d4('0x9')]?_0x4b696d['options'][_0x06d4('0x3e')]||null:null,'group':db[_0x06d4('0x7')][_0x06d4('0x2d')],'transaction':_0x1b4a59,'lock':_0x1b4a59['LOCK'][_0x06d4('0x3f')],'include':_0x4b696d[_0x06d4('0x9')]?_0x4b696d['options'][_0x06d4('0xe')]?_['map'](_0x4b696d['options']['include'],function(_0x2c84cc){return{'model':db[_0x2c84cc[_0x06d4('0x10')]],'as':_0x2c84cc['as'],'attributes':_0x2c84cc['attributes'],'include':_0x2c84cc['include']?_[_0x06d4('0xf')](_0x2c84cc['include'],function(_0x269a33){return{'model':db[_0x269a33[_0x06d4('0x10')]],'as':_0x269a33['as'],'attributes':_0x269a33['attributes'],'include':_0x269a33['include']?_[_0x06d4('0xf')](_0x269a33[_0x06d4('0xe')],function(_0x287c56){return{'model':db[_0x287c56['model']],'as':_0x287c56['as'],'attributes':_0x287c56[_0x06d4('0xc')]};}):[]};}):[]};}):[]:[]})[_0x06d4('0x11')](function(_0xb575d8){var _0x4099dc=[];for(var _0x5d8d9c=0x0;_0x5d8d9c<_0xb575d8[_0x06d4('0x2c')];_0x5d8d9c+=0x1){_0x4099dc[_0x06d4('0x2e')](_0xb575d8[_0x5d8d9c][_0x06d4('0x2f')](_0x4b696d[_0x06d4('0x1c')],{'transaction':_0x1b4a59}));}return BPromise[_0x06d4('0x31')](_0x4099dc);});})[_0x06d4('0x11')](function(_0x422f0f){logger[_0x06d4('0x12')](_0x06d4('0x3d'),_0x4b696d);logger[_0x06d4('0x13')](_0x06d4('0x3d'),_0x4b696d,JSON[_0x06d4('0x14')](_0x422f0f));_0x3c6666(_0x422f0f);})[_0x06d4('0x19')](function(_0x239478){logger[_0x06d4('0x15')](_0x06d4('0x3d'),_0x239478[_0x06d4('0x16')],_0x4b696d);_0x43ec88(_0x180ae7[_0x06d4('0x15')](0x1f4,_0x239478['message']));});});});};exports['GetCmHopperPreview']=function(_0x3eab04){var _0x5973eb=this;return new Promise(function(_0x51a74a,_0x26cb08){db['CmContact'][_0x06d4('0x23')]()['then'](function(_0x3981e4){return db[_0x06d4('0x7')][_0x06d4('0x8')]({'raw':_0x3eab04[_0x06d4('0x9')]?_0x3eab04['options'][_0x06d4('0xa')]===undefined?!![]:![]:!![],'where':_0x3eab04[_0x06d4('0x9')]?_0x3eab04[_0x06d4('0x9')][_0x06d4('0xb')]||null:null,'attributes':_0x3eab04[_0x06d4('0x9')]?_0x3eab04[_0x06d4('0x9')][_0x06d4('0xc')]||null:null,'limit':_0x3eab04[_0x06d4('0x9')]?_0x3eab04[_0x06d4('0x9')][_0x06d4('0xd')]||null:null,'include':_0x3eab04[_0x06d4('0x9')]?_0x3eab04[_0x06d4('0x9')][_0x06d4('0xe')]?_[_0x06d4('0xf')](_0x3eab04[_0x06d4('0x9')][_0x06d4('0xe')],function(_0x515ecb){return{'model':db[_0x515ecb[_0x06d4('0x10')]],'as':_0x515ecb['as'],'attributes':_0x515ecb['as']===_0x06d4('0x26')?_[_0x06d4('0x27')](_0x3981e4):_0x515ecb[_0x06d4('0xc')],'include':_0x515ecb['include']?_[_0x06d4('0xf')](_0x515ecb[_0x06d4('0xe')],function(_0x3e3002){return{'model':db[_0x3e3002[_0x06d4('0x10')]],'as':_0x3e3002['as'],'attributes':_0x3e3002[_0x06d4('0xc')],'include':_0x3e3002[_0x06d4('0xe')]?_[_0x06d4('0xf')](_0x3e3002[_0x06d4('0xe')],function(_0x472e13){return{'model':db[_0x472e13[_0x06d4('0x10')]],'as':_0x472e13['as'],'attributes':_0x472e13[_0x06d4('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x695d97){logger[_0x06d4('0x12')](_0x06d4('0x6'),_0x3eab04);logger[_0x06d4('0x13')](_0x06d4('0x6'),_0x3eab04,JSON['stringify'](_0x695d97));_0x51a74a(_0x695d97);})[_0x06d4('0x19')](function(_0x7deecb){logger[_0x06d4('0x15')](_0x06d4('0x6'),_0x7deecb[_0x06d4('0x16')],_0x3eab04);_0x26cb08(_0x5973eb[_0x06d4('0x15')](0x1f4,_0x7deecb[_0x06d4('0x16')]));});});});};exports[_0x06d4('0x40')]=function(_0x447d86){var _0xfea3eb=this;return new Promise(function(_0x2d5659,_0x3da31b){return db['CmContact'][_0x06d4('0x41')]({'raw':!![],'where':{'phone':_0x447d86[_0x06d4('0x9')][_0x06d4('0xb')][_0x06d4('0x42')]},'attributes':['id',_0x06d4('0x43')],'order':[['id',_0x06d4('0x44')]]})['then'](function(_0x3b4935){logger[_0x06d4('0x12')](_0x06d4('0x45'),_0x447d86);logger[_0x06d4('0x13')](_0x06d4('0x45'),_0x447d86,JSON['stringify'](_0x3b4935));_0x2d5659(_0x3b4935);})[_0x06d4('0x19')](function(_0x462f56){logger['error'](_0x06d4('0x45'),_0x462f56[_0x06d4('0x16')],_0x447d86);_0x3da31b(_0xfea3eb['error'](0x1f4,_0x462f56[_0x06d4('0x16')]));});});};exports[_0x06d4('0x46')]=function(_0x2f3dd8){var _0x1a0761=this;return new Promise(function(_0x4529e0,_0x73755c){return db[_0x06d4('0x24')][_0x06d4('0x25')](function(_0xc82b07){var _0x1322d0=_0x2f3dd8[_0x06d4('0x9')]&&_0x2f3dd8[_0x06d4('0x9')]['where']?_0x2f3dd8[_0x06d4('0x9')][_0x06d4('0xb')]:{};return db[_0x06d4('0x7')][_0x06d4('0x2f')](_0x2f3dd8[_0x06d4('0x1c')],{'where':_0x1322d0,'transaction':_0xc82b07})['then'](function(_0x5ee580){logger[_0x06d4('0x12')]('ResetActiveCalls',_0x2f3dd8);logger[_0x06d4('0x13')](_0x06d4('0x46'),_0x2f3dd8,JSON[_0x06d4('0x14')](_0x5ee580));_0x4529e0(_0x5ee580);})['catch'](function(_0x3d2068){logger[_0x06d4('0x15')](_0x06d4('0x46'),_0x3d2068[_0x06d4('0x16')],_0x2f3dd8);_0x73755c(_0x1a0761[_0x06d4('0x15')](0x1f4,_0x3d2068[_0x06d4('0x16')]));});});});};exports[_0x06d4('0x47')]=function(_0x15e0dc){var _0x2384d7=this;var _0x1c3f4f=_0x15e0dc[_0x06d4('0x1c')][_0x06d4('0xb')][_0x06d4('0x48')];var _0x35c9d4=_0x15e0dc[_0x06d4('0x1c')][_0x06d4('0xb')][_0x06d4('0x49')];var _0xdfb2ae=_0x15e0dc[_0x06d4('0x1c')][_0x06d4('0xb')]['availableAgentsIds'];return new Promise(function(_0x57164e,_0x1c7d93){return db['CmHopper'][_0x06d4('0x8')]({'where':{'voiceQueueId':{'$in':_0x1c3f4f},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x06d4('0x24')][_0x06d4('0x39')](_0x06d4('0x4a')+_0x35c9d4+_0x06d4('0x4b')),'$gt':db[_0x06d4('0x24')][_0x06d4('0x39')]('NOW()')}},'UserId':{'$in':_0xdfb2ae}},'include':[{'model':db['CmContact'],'as':'Contact'},{'model':db['User'],'as':_0x06d4('0x29'),'attributes':['id','name',_0x06d4('0x2b')]},{'model':db[_0x06d4('0x4c')],'as':'List'}]})[_0x06d4('0x11')](function(_0x5e2108){if(_0x5e2108['length']>0x0){return db['sequelize']['transaction'](function(_0x1247cc){return db[_0x06d4('0x7')][_0x06d4('0x2f')]({'recallmeNotifiedDate':db[_0x06d4('0x24')]['literal'](_0x06d4('0x4d'))},{'where':{'id':{'$in':_['map'](_0x5e2108,'id')}},'transaction':_0x1247cc})[_0x06d4('0x11')](function(){_0x57164e(_0x5e2108);})[_0x06d4('0x19')](function(_0x59a98a){logger[_0x06d4('0x15')](_0x06d4('0x47'),_0x59a98a[_0x06d4('0x16')],_0x15e0dc);_0x1c7d93(_0x2384d7['error'](0x1f4,_0x59a98a[_0x06d4('0x16')]));});})[_0x06d4('0x19')](function(_0x4ba178){logger['error']('CmHopperHandlePreviewRecallNotifications',_0x4ba178['message'],_0x15e0dc);_0x1c7d93(_0x2384d7['error'](0x1f4,_0x4ba178[_0x06d4('0x16')]));});}else{_0x57164e(_0x5e2108);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index ee65033..cef38bb 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 _0x3685=['index','/describe','isAuthenticated','describe','getOpenContacts','get','/timezones','getTimezones','/:id','getPreviewRecall','post','create','/preview','/timezone','getTimezone','put','update','delete','destroy','express','Router','../../components/auth/service','./cmHopper.controller'];(function(_0x3e9212,_0xf64901){var _0x481284=function(_0x313a4e){while(--_0x313a4e){_0x3e9212['push'](_0x3e9212['shift']());}};_0x481284(++_0xf64901);}(_0x3685,0xb4));var _0x5368=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3685[_0x122ef9];return _0x42fba0;};'use strict';var express=require(_0x5368('0x0'));var router=express[_0x5368('0x1')]();var auth=require(_0x5368('0x2'));var controller=require(_0x5368('0x3'));router['get']('/',auth['isAuthenticated'](),controller[_0x5368('0x4')]);router['get'](_0x5368('0x5'),auth[_0x5368('0x6')](),controller[_0x5368('0x7')]);router['get']('/opencontacts',auth['isAuthenticated'](),controller[_0x5368('0x8')]);router[_0x5368('0x9')](_0x5368('0xa'),auth[_0x5368('0x6')](),controller[_0x5368('0xb')]);router['get'](_0x5368('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x5368('0x9')]('/:id/previewrecall',auth[_0x5368('0x6')](),controller[_0x5368('0xd')]);router[_0x5368('0xe')]('/',auth[_0x5368('0x6')](),controller[_0x5368('0xf')]);router[_0x5368('0xe')](_0x5368('0x10'),auth[_0x5368('0x6')](),controller['getPreview']);router['post'](_0x5368('0x11'),auth['isAuthenticated'](),controller[_0x5368('0x12')]);router[_0x5368('0x13')](_0x5368('0xc'),auth[_0x5368('0x6')](),controller[_0x5368('0x14')]);router[_0x5368('0x15')](_0x5368('0xc'),auth[_0x5368('0x6')](),controller[_0x5368('0x16')]);module['exports']=router; \ No newline at end of file +var _0x7a4a=['/:id','destroy','express','Router','../../components/auth/service','get','/describe','isAuthenticated','/opencontacts','getOpenContacts','/timezones','getTimezones','show','/:id/previewrecall','post','create','/timezone','getTimezone','put','update'];(function(_0x5d6280,_0x3f72ab){var _0x77b738=function(_0x1b8208){while(--_0x1b8208){_0x5d6280['push'](_0x5d6280['shift']());}};_0x77b738(++_0x3f72ab);}(_0x7a4a,0x106));var _0xa7a4=function(_0x4066c2,_0xad48e8){_0x4066c2=_0x4066c2-0x0;var _0x3870a0=_0x7a4a[_0x4066c2];return _0x3870a0;};'use strict';var express=require(_0xa7a4('0x0'));var router=express[_0xa7a4('0x1')]();var auth=require(_0xa7a4('0x2'));var controller=require('./cmHopper.controller');router[_0xa7a4('0x3')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa7a4('0x3')](_0xa7a4('0x4'),auth[_0xa7a4('0x5')](),controller['describe']);router[_0xa7a4('0x3')](_0xa7a4('0x6'),auth[_0xa7a4('0x5')](),controller[_0xa7a4('0x7')]);router['get'](_0xa7a4('0x8'),auth[_0xa7a4('0x5')](),controller[_0xa7a4('0x9')]);router[_0xa7a4('0x3')]('/:id',auth[_0xa7a4('0x5')](),controller[_0xa7a4('0xa')]);router[_0xa7a4('0x3')](_0xa7a4('0xb'),auth[_0xa7a4('0x5')](),controller['getPreviewRecall']);router[_0xa7a4('0xc')]('/',auth['isAuthenticated'](),controller[_0xa7a4('0xd')]);router['post']('/preview',auth[_0xa7a4('0x5')](),controller['getPreview']);router[_0xa7a4('0xc')](_0xa7a4('0xe'),auth[_0xa7a4('0x5')](),controller[_0xa7a4('0xf')]);router[_0xa7a4('0x10')]('/:id',auth[_0xa7a4('0x5')](),controller[_0xa7a4('0x11')]);router['delete'](_0xa7a4('0x12'),auth['isAuthenticated'](),controller[_0xa7a4('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index d825b10..67d4899 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb935=['sequelize','exports','INTEGER','STRING','format','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0x3a20ae,_0x3233b1){var _0x4a012d=function(_0x2450c5){while(--_0x2450c5){_0x3a20ae['push'](_0x3a20ae['shift']());}};_0x4a012d(++_0x3233b1);}(_0xb935,0x19c));var _0x5b93=function(_0x3e4161,_0x1039e7){_0x3e4161=_0x3e4161-0x0;var _0x59286f=_0xb935[_0x3e4161];return _0x59286f;};'use strict';var moment=require(_0x5b93('0x0'));var Sequelize=require(_0x5b93('0x1'));module[_0x5b93('0x2')]={'CmHopperId':{'type':Sequelize[_0x5b93('0x3')]},'phone':{'type':Sequelize[_0x5b93('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x5b93('0x5')](_0x5b93('0x6'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5b93('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5b93('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x5b93('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x5b93('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xb270=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports','INTEGER','STRING'];(function(_0x30b1fd,_0x8a67f6){var _0x2c8838=function(_0x38fce5){while(--_0x38fce5){_0x30b1fd['push'](_0x30b1fd['shift']());}};_0x2c8838(++_0x8a67f6);}(_0xb270,0x1d3));var _0x0b27=function(_0x3ca891,_0x134385){_0x3ca891=_0x3ca891-0x0;var _0x3c4979=_0xb270[_0x3ca891];return _0x3c4979;};'use strict';var moment=require(_0x0b27('0x0'));var Sequelize=require(_0x0b27('0x1'));module[_0x0b27('0x2')]={'CmHopperId':{'type':Sequelize[_0x0b27('0x3')]},'phone':{'type':Sequelize[_0x0b27('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x0b27('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x0b27('0x5')],'defaultValue':moment()[_0x0b27('0x6')](_0x0b27('0x7'))},'countbusyretry':{'type':Sequelize[_0x0b27('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0b27('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0b27('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0b27('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0b27('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0b27('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index d169f85..1d95e5a 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1fd7=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','then','CmHopperAdditionalPhones','UserProfileResource','name','send','index','CmHopperAdditionalPhone','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filters','where','merge','map','VIRTUAL','includeAll','include','findAll','show','options','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','destroy','eml-format','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring'];(function(_0x202cb6,_0x11aa52){var _0x531ee8=function(_0x151ef0){while(--_0x151ef0){_0x202cb6['push'](_0x202cb6['shift']());}};_0x531ee8(++_0x11aa52);}(_0x1fd7,0x139));var _0x71fd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1fd7[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x71fd('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x71fd('0x1'));var rp=require(_0x71fd('0x2'));var moment=require(_0x71fd('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x71fd('0x4'));var util=require(_0x71fd('0x5'));var path=require('path');var sox=require(_0x71fd('0x6'));var csv=require(_0x71fd('0x7'));var ejs=require(_0x71fd('0x8'));var fs=require('fs');var fs_extra=require(_0x71fd('0x9'));var _=require(_0x71fd('0xa'));var squel=require('squel');var crypto=require(_0x71fd('0xb'));var jsforce=require(_0x71fd('0xc'));var deskjs=require(_0x71fd('0xd'));var toCsv=require(_0x71fd('0x7'));var querystring=require(_0x71fd('0xe'));var Papa=require('papaparse');var Redis=require(_0x71fd('0xf'));var authService=require(_0x71fd('0x10'));var qs=require(_0x71fd('0x11'));var as=require(_0x71fd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x71fd('0x13'))('api');var utils=require(_0x71fd('0x14'));var config=require(_0x71fd('0x15'));var licenseUtil=require(_0x71fd('0x16'));var db=require(_0x71fd('0x17'))['db'];function respondWithStatusCode(_0x577ba9,_0x409fe7){_0x409fe7=_0x409fe7||0xcc;return function(_0x110c72){if(_0x110c72){return _0x577ba9[_0x71fd('0x18')](_0x409fe7);}return _0x577ba9[_0x71fd('0x19')](_0x409fe7)[_0x71fd('0x1a')]();};}function respondWithResult(_0x5acd62,_0x4c14a0){_0x4c14a0=_0x4c14a0||0xc8;return function(_0x4db078){if(_0x4db078){return _0x5acd62[_0x71fd('0x19')](_0x4c14a0)[_0x71fd('0x1b')](_0x4db078);}};}function respondWithFilteredResult(_0x4428d3,_0x37a77e){return function(_0x16ac40){if(_0x16ac40){var _0x3349e1=typeof _0x37a77e[_0x71fd('0x1c')]===_0x71fd('0x1d')&&typeof _0x37a77e['limit']===_0x71fd('0x1d');var _0x1ab96a=_0x16ac40[_0x71fd('0x1e')];var _0x2c7001=_0x3349e1?0x0:_0x37a77e[_0x71fd('0x1c')];var _0x2218f6=_0x3349e1?_0x16ac40[_0x71fd('0x1e')]:_0x37a77e[_0x71fd('0x1c')]+_0x37a77e[_0x71fd('0x1f')];var _0x3015a6;if(_0x2218f6>=_0x1ab96a){_0x2218f6=_0x1ab96a;_0x3015a6=0xc8;}else{_0x3015a6=0xce;}_0x4428d3[_0x71fd('0x19')](_0x3015a6);return _0x4428d3[_0x71fd('0x20')](_0x71fd('0x21'),_0x2c7001+'-'+_0x2218f6+'/'+_0x1ab96a)[_0x71fd('0x1b')](_0x16ac40);}return null;};}function patchUpdates(_0x3ee7b1){return function(_0x4baa95){try{jsonpatch[_0x71fd('0x22')](_0x4baa95,_0x3ee7b1,!![]);}catch(_0x2661cb){return BPromise[_0x71fd('0x23')](_0x2661cb);}return _0x4baa95['save']();};}function saveUpdates(_0x4daeef,_0xb34804){return function(_0x1cc648){if(_0x1cc648){return _0x1cc648['update'](_0x4daeef)[_0x71fd('0x24')](function(_0x178596){return _0x178596;});}return null;};}function removeEntity(_0x18fbee,_0x381839){return function(_0x312e69){if(_0x312e69){return _0x312e69['destroy']()['then'](function(){var _0x33b223=_0x312e69['get']({'plain':!![]});var _0x363f1a=_0x71fd('0x25');return db[_0x71fd('0x26')]['destroy']({'where':{'type':_0x363f1a,'resourceId':_0x33b223['id']}})[_0x71fd('0x24')](function(){return _0x312e69;});})[_0x71fd('0x24')](function(){_0x18fbee[_0x71fd('0x19')](0xcc)[_0x71fd('0x1a')]();});}};}function handleEntityNotFound(_0x14420a,_0x364e97){return function(_0x11276d){if(!_0x11276d){_0x14420a[_0x71fd('0x18')](0x194);}return _0x11276d;};}function handleError(_0x4032ef,_0x563c0a){_0x563c0a=_0x563c0a||0x1f4;return function(_0x393f05){logger['error'](_0x393f05['stack']);if(_0x393f05['name']){delete _0x393f05[_0x71fd('0x27')];}_0x4032ef['status'](_0x563c0a)[_0x71fd('0x28')](_0x393f05);};}exports[_0x71fd('0x29')]=function(_0x136db5,_0x21a81d){var _0x1f3c20={},_0x3a5d9a={},_0x169757={'count':0x0,'rows':[]};var _0x4ea4c4=_['map'](db[_0x71fd('0x2a')][_0x71fd('0x2b')],function(_0x8dfcef){return{'name':_0x8dfcef[_0x71fd('0x2c')],'type':_0x8dfcef[_0x71fd('0x2d')]['key']};});_0x3a5d9a[_0x71fd('0x2e')]=_['map'](_0x4ea4c4,_0x71fd('0x27'));_0x3a5d9a[_0x71fd('0x2f')]=_[_0x71fd('0x30')](_0x136db5['query']);_0x3a5d9a['filters']=_[_0x71fd('0x31')](_0x3a5d9a[_0x71fd('0x2e')],_0x3a5d9a[_0x71fd('0x2f')]);_0x1f3c20[_0x71fd('0x32')]=_[_0x71fd('0x31')](_0x3a5d9a[_0x71fd('0x2e')],qs[_0x71fd('0x33')](_0x136db5['query'][_0x71fd('0x33')]));_0x1f3c20[_0x71fd('0x32')]=_0x1f3c20['attributes'][_0x71fd('0x34')]?_0x1f3c20['attributes']:_0x3a5d9a[_0x71fd('0x2e')];if(!_0x136db5[_0x71fd('0x2f')][_0x71fd('0x35')]('nolimit')){_0x1f3c20[_0x71fd('0x1f')]=qs[_0x71fd('0x1f')](_0x136db5[_0x71fd('0x2f')][_0x71fd('0x1f')]);_0x1f3c20['offset']=qs['offset'](_0x136db5['query'][_0x71fd('0x1c')]);}_0x1f3c20['order']=qs[_0x71fd('0x36')](_0x136db5[_0x71fd('0x2f')][_0x71fd('0x36')]);_0x1f3c20['where']=qs['filters'](_[_0x71fd('0x37')](_0x136db5[_0x71fd('0x2f')],_0x3a5d9a[_0x71fd('0x38')]),_0x4ea4c4);if(_0x136db5[_0x71fd('0x2f')]['filter']){_0x1f3c20[_0x71fd('0x39')]=_[_0x71fd('0x3a')](_0x1f3c20['where'],{'$or':_[_0x71fd('0x3b')](_0x4ea4c4,function(_0x4cadb5){if(_0x4cadb5[_0x71fd('0x2d')]!==_0x71fd('0x3c')){var _0xf68387={};_0xf68387[_0x4cadb5['name']]={'$like':'%'+_0x136db5[_0x71fd('0x2f')]['filter']+'%'};return _0xf68387;}})});}_0x1f3c20=_[_0x71fd('0x3a')]({},_0x1f3c20,_0x136db5['options']);var _0x53eb91={'where':_0x1f3c20[_0x71fd('0x39')]};return db[_0x71fd('0x2a')][_0x71fd('0x1e')](_0x53eb91)['then'](function(_0xb7ea9b){_0x169757[_0x71fd('0x1e')]=_0xb7ea9b;if(_0x136db5[_0x71fd('0x2f')][_0x71fd('0x3d')]){_0x1f3c20[_0x71fd('0x3e')]=[{'all':!![]}];}return db[_0x71fd('0x2a')][_0x71fd('0x3f')](_0x1f3c20);})[_0x71fd('0x24')](function(_0x3fa015){_0x169757['rows']=_0x3fa015;return _0x169757;})['then'](respondWithFilteredResult(_0x21a81d,_0x1f3c20))['catch'](handleError(_0x21a81d,null));};exports[_0x71fd('0x40')]=function(_0x1e18be,_0x3bd950){var _0x294a76={'raw':!![],'where':{'id':_0x1e18be['params']['id']}},_0x53269f={};_0x53269f[_0x71fd('0x2e')]=_[_0x71fd('0x30')](db['CmHopperAdditionalPhone'][_0x71fd('0x2b')]);_0x53269f[_0x71fd('0x2f')]=_[_0x71fd('0x30')](_0x1e18be[_0x71fd('0x2f')]);_0x53269f['filters']=_['intersection'](_0x53269f[_0x71fd('0x2e')],_0x53269f[_0x71fd('0x2f')]);_0x294a76['attributes']=_['intersection'](_0x53269f['model'],qs[_0x71fd('0x33')](_0x1e18be[_0x71fd('0x2f')][_0x71fd('0x33')]));_0x294a76['attributes']=_0x294a76[_0x71fd('0x32')][_0x71fd('0x34')]?_0x294a76['attributes']:_0x53269f[_0x71fd('0x2e')];if(_0x1e18be[_0x71fd('0x2f')][_0x71fd('0x3d')]){_0x294a76[_0x71fd('0x3e')]=[{'all':!![]}];}_0x294a76=_[_0x71fd('0x3a')]({},_0x294a76,_0x1e18be[_0x71fd('0x41')]);return db['CmHopperAdditionalPhone'][_0x71fd('0x42')](_0x294a76)[_0x71fd('0x24')](handleEntityNotFound(_0x3bd950,null))[_0x71fd('0x24')](respondWithResult(_0x3bd950,null))[_0x71fd('0x43')](handleError(_0x3bd950,null));};exports[_0x71fd('0x44')]=function(_0x384ed6,_0x297850){return db[_0x71fd('0x2a')][_0x71fd('0x44')](_0x384ed6[_0x71fd('0x45')],{})[_0x71fd('0x24')](function(_0x45887e){var _0x148eef=_0x384ed6[_0x71fd('0x46')][_0x71fd('0x47')]({'plain':!![]});if(!_0x148eef)throw new Error(_0x71fd('0x48'));if(_0x148eef[_0x71fd('0x49')]===_0x71fd('0x46')){var _0xc6eaee=_0x45887e[_0x71fd('0x47')]({'plain':!![]});var _0x498736=_0x71fd('0x25');return db[_0x71fd('0x4a')]['find']({'where':{'name':_0x498736,'userProfileId':_0x148eef[_0x71fd('0x4b')]},'raw':!![]})[_0x71fd('0x24')](function(_0xf72b2){if(_0xf72b2&&_0xf72b2[_0x71fd('0x4c')]===0x0){return db[_0x71fd('0x26')][_0x71fd('0x44')]({'name':_0xc6eaee[_0x71fd('0x27')],'resourceId':_0xc6eaee['id'],'type':_0xf72b2[_0x71fd('0x27')],'sectionId':_0xf72b2['id']},{})[_0x71fd('0x24')](function(){return _0x45887e;});}else{return _0x45887e;}})[_0x71fd('0x43')](function(_0x499811){logger[_0x71fd('0x4d')](_0x71fd('0x4e'),_0x499811);throw _0x499811;});}return _0x45887e;})['then'](respondWithResult(_0x297850,0xc9))[_0x71fd('0x43')](handleError(_0x297850,null));};exports[_0x71fd('0x4f')]=function(_0x5c1341,_0x2737c8){if(_0x5c1341['body']['id']){delete _0x5c1341[_0x71fd('0x45')]['id'];}return db[_0x71fd('0x2a')]['find']({'where':{'id':_0x5c1341[_0x71fd('0x50')]['id']}})['then'](handleEntityNotFound(_0x2737c8,null))[_0x71fd('0x24')](saveUpdates(_0x5c1341[_0x71fd('0x45')],null))['then'](respondWithResult(_0x2737c8,null))[_0x71fd('0x43')](handleError(_0x2737c8,null));};exports[_0x71fd('0x51')]=function(_0x34ed5e,_0x42ad4b){return db[_0x71fd('0x2a')]['find']({'where':{'id':_0x34ed5e[_0x71fd('0x50')]['id']}})[_0x71fd('0x24')](handleEntityNotFound(_0x42ad4b,null))[_0x71fd('0x24')](removeEntity(_0x42ad4b,null))['catch'](handleError(_0x42ad4b,null));}; \ No newline at end of file +var _0x64f9=['type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','keys','rawAttributes','length','includeAll','options','create','body','role','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','then','get','CmHopperAdditionalPhones','destroy','error','stack','name','send','index','map','CmHopperAdditionalPhone','fieldName'];(function(_0x248853,_0x4559bc){var _0x539106=function(_0x1388ad){while(--_0x1388ad){_0x248853['push'](_0x248853['shift']());}};_0x539106(++_0x4559bc);}(_0x64f9,0x122));var _0x964f=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0x64f9[_0x266618];return _0x54dbf5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x964f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x964f('0x1'));var rp=require(_0x964f('0x2'));var moment=require(_0x964f('0x3'));var BPromise=require(_0x964f('0x4'));var Mustache=require(_0x964f('0x5'));var util=require(_0x964f('0x6'));var path=require(_0x964f('0x7'));var sox=require(_0x964f('0x8'));var csv=require(_0x964f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x964f('0xa'));var _=require(_0x964f('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x964f('0xc'));var deskjs=require(_0x964f('0xd'));var toCsv=require(_0x964f('0x9'));var querystring=require('querystring');var Papa=require(_0x964f('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x964f('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x964f('0x10'));var logger=require(_0x964f('0x11'))(_0x964f('0x12'));var utils=require('../../config/utils');var config=require(_0x964f('0x13'));var licenseUtil=require(_0x964f('0x14'));var db=require(_0x964f('0x15'))['db'];function respondWithStatusCode(_0x268d63,_0x1943f6){_0x1943f6=_0x1943f6||0xcc;return function(_0x10ce36){if(_0x10ce36){return _0x268d63[_0x964f('0x16')](_0x1943f6);}return _0x268d63[_0x964f('0x17')](_0x1943f6)[_0x964f('0x18')]();};}function respondWithResult(_0x5ebcdc,_0x147467){_0x147467=_0x147467||0xc8;return function(_0x5cf878){if(_0x5cf878){return _0x5ebcdc[_0x964f('0x17')](_0x147467)[_0x964f('0x19')](_0x5cf878);}};}function respondWithFilteredResult(_0x500289,_0x529d41){return function(_0x33e850){if(_0x33e850){var _0x73d6ae=typeof _0x529d41['offset']===_0x964f('0x1a')&&typeof _0x529d41[_0x964f('0x1b')]===_0x964f('0x1a');var _0x784b95=_0x33e850[_0x964f('0x1c')];var _0x48434b=_0x73d6ae?0x0:_0x529d41[_0x964f('0x1d')];var _0x20c63b=_0x73d6ae?_0x33e850['count']:_0x529d41[_0x964f('0x1d')]+_0x529d41['limit'];var _0x17bbf8;if(_0x20c63b>=_0x784b95){_0x20c63b=_0x784b95;_0x17bbf8=0xc8;}else{_0x17bbf8=0xce;}_0x500289[_0x964f('0x17')](_0x17bbf8);return _0x500289['set'](_0x964f('0x1e'),_0x48434b+'-'+_0x20c63b+'/'+_0x784b95)[_0x964f('0x19')](_0x33e850);}return null;};}function patchUpdates(_0x148b1f){return function(_0x41198e){try{jsonpatch[_0x964f('0x1f')](_0x41198e,_0x148b1f,!![]);}catch(_0x2670fb){return BPromise[_0x964f('0x20')](_0x2670fb);}return _0x41198e[_0x964f('0x21')]();};}function saveUpdates(_0x59fa22,_0x146ac1){return function(_0x14c9fb){if(_0x14c9fb){return _0x14c9fb['update'](_0x59fa22)[_0x964f('0x22')](function(_0x2be3e2){return _0x2be3e2;});}return null;};}function removeEntity(_0x223f4b,_0x13cf98){return function(_0x162406){if(_0x162406){return _0x162406['destroy']()[_0x964f('0x22')](function(){var _0x306c94=_0x162406[_0x964f('0x23')]({'plain':!![]});var _0x4e2f58=_0x964f('0x24');return db['UserProfileResource'][_0x964f('0x25')]({'where':{'type':_0x4e2f58,'resourceId':_0x306c94['id']}})[_0x964f('0x22')](function(){return _0x162406;});})[_0x964f('0x22')](function(){_0x223f4b[_0x964f('0x17')](0xcc)[_0x964f('0x18')]();});}};}function handleEntityNotFound(_0xb32d44,_0x6cbd49){return function(_0x2b4e08){if(!_0x2b4e08){_0xb32d44[_0x964f('0x16')](0x194);}return _0x2b4e08;};}function handleError(_0x41ead8,_0x24a4c9){_0x24a4c9=_0x24a4c9||0x1f4;return function(_0x12edde){logger[_0x964f('0x26')](_0x12edde[_0x964f('0x27')]);if(_0x12edde[_0x964f('0x28')]){delete _0x12edde[_0x964f('0x28')];}_0x41ead8[_0x964f('0x17')](_0x24a4c9)[_0x964f('0x29')](_0x12edde);};}exports[_0x964f('0x2a')]=function(_0x459236,_0x238087){var _0x3bbd71={},_0x4dca65={},_0x3310b4={'count':0x0,'rows':[]};var _0x4b7ed3=_[_0x964f('0x2b')](db[_0x964f('0x2c')]['rawAttributes'],function(_0x561b91){return{'name':_0x561b91[_0x964f('0x2d')],'type':_0x561b91[_0x964f('0x2e')][_0x964f('0x2f')]};});_0x4dca65[_0x964f('0x30')]=_['map'](_0x4b7ed3,_0x964f('0x28'));_0x4dca65[_0x964f('0x31')]=_['keys'](_0x459236[_0x964f('0x31')]);_0x4dca65[_0x964f('0x32')]=_[_0x964f('0x33')](_0x4dca65[_0x964f('0x30')],_0x4dca65[_0x964f('0x31')]);_0x3bbd71['attributes']=_['intersection'](_0x4dca65[_0x964f('0x30')],qs[_0x964f('0x34')](_0x459236[_0x964f('0x31')][_0x964f('0x34')]));_0x3bbd71[_0x964f('0x35')]=_0x3bbd71[_0x964f('0x35')]['length']?_0x3bbd71['attributes']:_0x4dca65['model'];if(!_0x459236[_0x964f('0x31')][_0x964f('0x36')](_0x964f('0x37'))){_0x3bbd71['limit']=qs[_0x964f('0x1b')](_0x459236[_0x964f('0x31')][_0x964f('0x1b')]);_0x3bbd71['offset']=qs[_0x964f('0x1d')](_0x459236[_0x964f('0x31')]['offset']);}_0x3bbd71[_0x964f('0x38')]=qs[_0x964f('0x39')](_0x459236[_0x964f('0x31')][_0x964f('0x39')]);_0x3bbd71[_0x964f('0x3a')]=qs['filters'](_[_0x964f('0x3b')](_0x459236[_0x964f('0x31')],_0x4dca65[_0x964f('0x32')]),_0x4b7ed3);if(_0x459236['query'][_0x964f('0x3c')]){_0x3bbd71[_0x964f('0x3a')]=_[_0x964f('0x3d')](_0x3bbd71[_0x964f('0x3a')],{'$or':_[_0x964f('0x2b')](_0x4b7ed3,function(_0x30b8b8){if(_0x30b8b8[_0x964f('0x2e')]!==_0x964f('0x3e')){var _0x196050={};_0x196050[_0x30b8b8[_0x964f('0x28')]]={'$like':'%'+_0x459236['query'][_0x964f('0x3c')]+'%'};return _0x196050;}})});}_0x3bbd71=_['merge']({},_0x3bbd71,_0x459236['options']);var _0x484614={'where':_0x3bbd71[_0x964f('0x3a')]};return db[_0x964f('0x2c')][_0x964f('0x1c')](_0x484614)['then'](function(_0x382988){_0x3310b4[_0x964f('0x1c')]=_0x382988;if(_0x459236[_0x964f('0x31')]['includeAll']){_0x3bbd71[_0x964f('0x3f')]=[{'all':!![]}];}return db[_0x964f('0x2c')][_0x964f('0x40')](_0x3bbd71);})['then'](function(_0x4741b6){_0x3310b4[_0x964f('0x41')]=_0x4741b6;return _0x3310b4;})['then'](respondWithFilteredResult(_0x238087,_0x3bbd71))[_0x964f('0x42')](handleError(_0x238087,null));};exports[_0x964f('0x43')]=function(_0x49e7e5,_0x27bb1a){var _0x25ba02={'raw':!![],'where':{'id':_0x49e7e5['params']['id']}},_0x4349ce={};_0x4349ce[_0x964f('0x30')]=_[_0x964f('0x44')](db[_0x964f('0x2c')][_0x964f('0x45')]);_0x4349ce[_0x964f('0x31')]=_[_0x964f('0x44')](_0x49e7e5[_0x964f('0x31')]);_0x4349ce['filters']=_[_0x964f('0x33')](_0x4349ce[_0x964f('0x30')],_0x4349ce['query']);_0x25ba02[_0x964f('0x35')]=_[_0x964f('0x33')](_0x4349ce[_0x964f('0x30')],qs['fields'](_0x49e7e5['query']['fields']));_0x25ba02['attributes']=_0x25ba02[_0x964f('0x35')][_0x964f('0x46')]?_0x25ba02[_0x964f('0x35')]:_0x4349ce[_0x964f('0x30')];if(_0x49e7e5[_0x964f('0x31')][_0x964f('0x47')]){_0x25ba02[_0x964f('0x3f')]=[{'all':!![]}];}_0x25ba02=_['merge']({},_0x25ba02,_0x49e7e5[_0x964f('0x48')]);return db['CmHopperAdditionalPhone']['find'](_0x25ba02)[_0x964f('0x22')](handleEntityNotFound(_0x27bb1a,null))['then'](respondWithResult(_0x27bb1a,null))[_0x964f('0x42')](handleError(_0x27bb1a,null));};exports[_0x964f('0x49')]=function(_0x46bc66,_0x5287ba){return db['CmHopperAdditionalPhone'][_0x964f('0x49')](_0x46bc66[_0x964f('0x4a')],{})[_0x964f('0x22')](function(_0x13cb0a){var _0x59cf87=_0x46bc66['user']['get']({'plain':!![]});if(!_0x59cf87)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x59cf87[_0x964f('0x4b')]===_0x964f('0x4c')){var _0x675a6c=_0x13cb0a[_0x964f('0x23')]({'plain':!![]});var _0x363cf3=_0x964f('0x24');return db[_0x964f('0x4d')][_0x964f('0x4e')]({'where':{'name':_0x363cf3,'userProfileId':_0x59cf87[_0x964f('0x4f')]},'raw':!![]})[_0x964f('0x22')](function(_0x2df337){if(_0x2df337&&_0x2df337[_0x964f('0x50')]===0x0){return db[_0x964f('0x51')][_0x964f('0x49')]({'name':_0x675a6c[_0x964f('0x28')],'resourceId':_0x675a6c['id'],'type':_0x2df337[_0x964f('0x28')],'sectionId':_0x2df337['id']},{})[_0x964f('0x22')](function(){return _0x13cb0a;});}else{return _0x13cb0a;}})[_0x964f('0x42')](function(_0x2ec537){logger[_0x964f('0x26')](_0x964f('0x52'),_0x2ec537);throw _0x2ec537;});}return _0x13cb0a;})[_0x964f('0x22')](respondWithResult(_0x5287ba,0xc9))['catch'](handleError(_0x5287ba,null));};exports['update']=function(_0x2bce32,_0x24b984){if(_0x2bce32['body']['id']){delete _0x2bce32['body']['id'];}return db[_0x964f('0x2c')]['find']({'where':{'id':_0x2bce32[_0x964f('0x53')]['id']}})[_0x964f('0x22')](handleEntityNotFound(_0x24b984,null))[_0x964f('0x22')](saveUpdates(_0x2bce32[_0x964f('0x4a')],null))['then'](respondWithResult(_0x24b984,null))['catch'](handleError(_0x24b984,null));};exports['destroy']=function(_0x5a8582,_0x1fb1e3){return db[_0x964f('0x2c')]['find']({'where':{'id':_0x5a8582[_0x964f('0x53')]['id']}})['then'](handleEntityNotFound(_0x1fb1e3,null))[_0x964f('0x22')](removeEntity(_0x1fb1e3,null))[_0x964f('0x42')](handleError(_0x1fb1e3,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index c442b68..ff56d2d 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6138=['path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','util','../../config/logger','api','moment','bluebird'];(function(_0x175527,_0x3afd8c){var _0xcf98dc=function(_0x8176b8){while(--_0x8176b8){_0x175527['push'](_0x175527['shift']());}};_0xcf98dc(++_0x3afd8c);}(_0x6138,0xbe));var _0x8613=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x6138[_0x164eca];return _0x2ce562;};'use strict';var _=require('lodash');var util=require(_0x8613('0x0'));var logger=require(_0x8613('0x1'))(_0x8613('0x2'));var moment=require(_0x8613('0x3'));var BPromise=require(_0x8613('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8613('0x5'));var rimraf=require(_0x8613('0x6'));var config=require(_0x8613('0x7'));var attributes=require(_0x8613('0x8'));module[_0x8613('0x9')]=function(_0x2b8f55,_0xdfba09){return _0x2b8f55[_0x8613('0xa')](_0x8613('0xb'),attributes,{'tableName':_0x8613('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8781=['exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes'];(function(_0x21c2e8,_0x3c64a3){var _0x587975=function(_0xf85b7d){while(--_0xf85b7d){_0x21c2e8['push'](_0x21c2e8['shift']());}};_0x587975(++_0x3c64a3);}(_0x8781,0x118));var _0x1878=function(_0x29d29e,_0x2b1df9){_0x29d29e=_0x29d29e-0x0;var _0x218f4c=_0x8781[_0x29d29e];return _0x218f4c;};'use strict';var _=require(_0x1878('0x0'));var util=require(_0x1878('0x1'));var logger=require('../../config/logger')(_0x1878('0x2'));var moment=require(_0x1878('0x3'));var BPromise=require('bluebird');var rp=require(_0x1878('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1878('0x5'));var config=require(_0x1878('0x6'));var attributes=require(_0x1878('0x7'));module[_0x1878('0x8')]=function(_0x21515f,_0x5745c7){return _0x21515f[_0x1878('0x9')](_0x1878('0xa'),attributes,{'tableName':_0x1878('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 9c998d0..b224ddc 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa857=['../../config/environment','jayson/promise','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','countcongestionretry','SwapAdditionalPhones','ContactId','duration','waitTime','scheduledat','add','minutes','isNil','phone','countdropretry','createdAt','updatedAt','sequelize','transaction','update','IncrementPreviewCounters','field','lodash','util','bluebird','randomstring','../../mysqldb'];(function(_0x4a248b,_0x29e290){var _0x565f8c=function(_0x3944b1){while(--_0x3944b1){_0x4a248b['push'](_0x4a248b['shift']());}};_0x565f8c(++_0x29e290);}(_0xa857,0x1bb));var _0x7a85=function(_0x50ecd2,_0x5ddf30){_0x50ecd2=_0x50ecd2-0x0;var _0x4e256e=_0xa857[_0x50ecd2];return _0x4e256e;};'use strict';var _=require(_0x7a85('0x0'));var util=require(_0x7a85('0x1'));var moment=require('moment');var BPromise=require(_0x7a85('0x2'));var rs=require(_0x7a85('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7a85('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x7a85('0x5'));var jayson=require(_0x7a85('0x6'));var client=jayson['client'][_0x7a85('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4f0877,_0x340d51,_0x505f83){return new BPromise(function(_0x1b1c7b,_0x41b3c){return client[_0x7a85('0x8')](_0x4f0877,_0x505f83)[_0x7a85('0x9')](function(_0x5dceb1){logger[_0x7a85('0xa')](_0x7a85('0xb'),_0x340d51,_0x7a85('0xc'));logger[_0x7a85('0xd')](_0x7a85('0xe'),_0x340d51,_0x7a85('0xc'),JSON['stringify'](_0x5dceb1));if(_0x5dceb1[_0x7a85('0xf')]){if(_0x5dceb1[_0x7a85('0xf')][_0x7a85('0x10')]===0x1f4){logger[_0x7a85('0xf')](_0x7a85('0xb'),_0x340d51,_0x5dceb1[_0x7a85('0xf')]['message']);return _0x41b3c(_0x5dceb1[_0x7a85('0xf')]['message']);}logger[_0x7a85('0xf')](_0x7a85('0xb'),_0x340d51,_0x5dceb1[_0x7a85('0xf')][_0x7a85('0x11')]);return _0x1b1c7b(_0x5dceb1[_0x7a85('0xf')][_0x7a85('0x11')]);}else{logger['info'](_0x7a85('0xb'),_0x340d51,_0x7a85('0xc'));_0x1b1c7b(_0x5dceb1[_0x7a85('0x12')]['message']);}})[_0x7a85('0x13')](function(_0x36da2d){logger['error'](_0x7a85('0xb'),_0x340d51,_0x36da2d);_0x41b3c(_0x36da2d);});});}exports[_0x7a85('0x14')]=function(_0xaf1e7d){var _0x4c70d4=this;return new Promise(function(_0x2c572e,_0x38ac09){return db[_0x7a85('0x15')][_0x7a85('0x16')]({'raw':!![],'where':{'ContactId':_0xaf1e7d['body']['ContactId'],'ListId':_0xaf1e7d[_0x7a85('0x17')][_0x7a85('0x18')],'VoiceQueueId':_0xaf1e7d[_0x7a85('0x17')][_0x7a85('0x19')]===undefined?null:_0xaf1e7d[_0x7a85('0x17')][_0x7a85('0x19')],'CampaignId':_0xaf1e7d[_0x7a85('0x17')]['CampaignId']===undefined?null:_0xaf1e7d[_0x7a85('0x17')][_0x7a85('0x1a')]}})['then'](function(_0x82faff){if(_0x82faff!=null){return db[_0x7a85('0x1b')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x82faff['id'],'OrderBy':{'$gt':_0x82faff[_0x7a85('0x1c')]}},'order':[['OrderBy',_0x7a85('0x1d')]]})[_0x7a85('0x9')](function(_0x38b371){var _0xf7624c=0x0;if(_0x38b371){if(_0x38b371[_0x7a85('0x1e')]+_0x38b371['countcongestionretry']+_0x38b371[_0x7a85('0x1f')]+_0x38b371[_0x7a85('0x20')]+_0x38b371['countdropretry']+_0x38b371[_0x7a85('0x21')]+_0x38b371[_0x7a85('0x22')]+_0x38b371[_0x7a85('0x23')]<_0xaf1e7d[_0x7a85('0x24')][_0x7a85('0x25')])_0xf7624c=0x1;_0x2c572e({'additional':_0xf7624c});}else{return db['CmHopperAdditionalPhone'][_0x7a85('0x16')]({'raw':!![],'where':{'CmHopperId':_0x82faff['id']},'order':[[_0x7a85('0x1c'),_0x7a85('0x1d')]]})[_0x7a85('0x9')](function(_0x44be13){var _0x12cf34=0x0;if(_0x44be13){if(_0x44be13['countbusyretry']+_0x44be13[_0x7a85('0x26')]+_0x44be13[_0x7a85('0x1f')]+_0x44be13[_0x7a85('0x20')]+_0x44be13['countdropretry']+_0x44be13[_0x7a85('0x21')]+_0x44be13['countmachineretry']+_0x44be13[_0x7a85('0x23')]<_0xaf1e7d[_0x7a85('0x24')][_0x7a85('0x25')])_0x12cf34=0x1;_0x2c572e({'additional':_0x12cf34});}else{_0x2c572e({'additional':0x0});}})['catch'](function(_0x39613d){logger[_0x7a85('0xf')](_0x7a85('0x14'),_0x39613d[_0x7a85('0x11')]);_0x38ac09(_0x4c70d4[_0x7a85('0xf')](0x1f4,_0x39613d[_0x7a85('0x11')]));});}})[_0x7a85('0x13')](function(_0x5c699e){logger['error'](_0x7a85('0x14'),_0x5c699e[_0x7a85('0x11')]);_0x38ac09(_0x4c70d4['error'](0x1f4,_0x5c699e[_0x7a85('0x11')]));});}else _0x2c572e({'additional':0x0});});});};exports[_0x7a85('0x27')]=function(_0x448820){var _0x3c7454=this;return new Promise(function(_0xc07a4b,_0x1400b1){return db['CmHopper'][_0x7a85('0x16')]({'raw':!![],'where':{'ContactId':_0x448820[_0x7a85('0x17')][_0x7a85('0x28')],'ListId':_0x448820[_0x7a85('0x17')][_0x7a85('0x18')],'VoiceQueueId':_0x448820[_0x7a85('0x17')][_0x7a85('0x19')]===undefined?null:_0x448820[_0x7a85('0x17')][_0x7a85('0x19')],'CampaignId':_0x448820['body'][_0x7a85('0x1a')]===undefined?null:_0x448820['body'][_0x7a85('0x1a')]}})[_0x7a85('0x9')](function(_0x382a18){if(_0x382a18!=null){return db['CmHopperAdditionalPhone'][_0x7a85('0x16')]({'raw':!![],'where':{'CmHopperId':_0x382a18['id'],'OrderBy':{'$gte':_0x382a18[_0x7a85('0x1c')]}},'order':[['OrderBy',_0x7a85('0x1d')]]})[_0x7a85('0x9')](function(_0x3a2033){if(_0x3a2033)return activateAdditionalPhone(_0x382a18,_0x448820[_0x7a85('0x17')],_0x3a2033,_0x448820[_0x7a85('0x29')],_0x448820[_0x7a85('0x2a')])[_0x7a85('0x9')](function(_0x420d27){_0xc07a4b(_0x420d27);});else{return db[_0x7a85('0x1b')][_0x7a85('0x16')]({'raw':!![],'where':{'CmHopperId':_0x382a18['id']},'order':[[_0x7a85('0x1c'),_0x7a85('0x1d')]]})[_0x7a85('0x9')](function(_0x3f55ac){if(_0x3f55ac)return activateAdditionalPhone(_0x382a18,_0x448820[_0x7a85('0x17')],_0x3f55ac,_0x448820[_0x7a85('0x29')],_0x448820['waitTime'])[_0x7a85('0x9')](function(_0x22dd76){_0xc07a4b(_0x22dd76);});else{_0xc07a4b({'id':_0x382a18['id'],'phone':''});}})[_0x7a85('0x13')](function(_0x17667d){logger[_0x7a85('0xf')](_0x7a85('0x14'),_0x17667d[_0x7a85('0x11')]);_0x1400b1(_0x3c7454[_0x7a85('0xf')](0x1f4,_0x17667d[_0x7a85('0x11')]));});}})[_0x7a85('0x13')](function(_0x3b94a5){logger[_0x7a85('0xf')](_0x7a85('0x14'),_0x3b94a5[_0x7a85('0x11')]);_0x1400b1(_0x3c7454['error'](0x1f4,_0x3b94a5[_0x7a85('0x11')]));});}else _0xc07a4b(0x1);});});};function activateAdditionalPhone(_0x15c60,_0x34189b,_0x72c9c9,_0x431938,_0xf779fa){return new Promise(function(_0x30f35b,_0x4f9f36){var _0x5c6235;if(_['isNil'](_0x72c9c9[_0x7a85('0x2b')])){_0x72c9c9[_0x7a85('0x2b')]=moment();}if(moment()>moment(_0x72c9c9[_0x7a85('0x2b')])){_0x5c6235=moment()[_0x7a85('0x2c')](_0xf779fa||0x3,'minutes');}else{if(_0x72c9c9[_0x7a85('0x1c')]==0x0){_0x5c6235=moment(_0x72c9c9[_0x7a85('0x2b')]);}else{_0x5c6235=moment()[_0x7a85('0x2c')](_0xf779fa||0x3,_0x7a85('0x2d'));}}if(_[_0x7a85('0x2e')](_0x5c6235)){_0x5c6235=moment()['add'](_0xf779fa||0x3,_0x7a85('0x2d'));}var _0x43efed={'phone':_0x15c60[_0x7a85('0x2f')],'active':0x0,'OrderBy':_[_0x7a85('0x2e')](_0x15c60[_0x7a85('0x1c')])?0x0:_0x15c60[_0x7a85('0x1c')],'scheduledat':moment()[_0x7a85('0x2c')](_0x431938||0x1,_0x7a85('0x2d')),'countbusyretry':_0x34189b[_0x7a85('0x1e')],'countcongestionretry':_0x34189b[_0x7a85('0x26')],'countnoanswerretry':_0x34189b[_0x7a85('0x1f')],'countnosuchnumberretry':_0x34189b[_0x7a85('0x20')],'countdropretry':_0x34189b[_0x7a85('0x30')],'countabandonedretry':_0x34189b['countabandonedretry'],'countmachineretry':_0x34189b[_0x7a85('0x22')],'countagentrejectretry':_0x34189b[_0x7a85('0x23')],'createdAt':_0x34189b[_0x7a85('0x31')],'updatedAt':_0x34189b[_0x7a85('0x32')]};var _0x49a8dd={'CmHopperId':_0x15c60['id'],'phone':_0x72c9c9[_0x7a85('0x2f')],'active':0x0,'OrderBy':_[_0x7a85('0x2e')](_0x72c9c9[_0x7a85('0x1c')])?0x0:_0x72c9c9[_0x7a85('0x1c')],'scheduledat':_0x5c6235,'countbusyretry':_0x72c9c9['countbusyretry'],'countcongestionretry':_0x72c9c9[_0x7a85('0x26')],'countnoanswerretry':_0x72c9c9['countnoanswerretry'],'countnosuchnumberretry':_0x72c9c9['countnosuchnumberretry'],'countdropretry':_0x72c9c9[_0x7a85('0x30')],'countabandonedretry':_0x72c9c9[_0x7a85('0x21')],'countmachineretry':_0x72c9c9['countmachineretry'],'countagentrejectretry':_0x72c9c9[_0x7a85('0x23')],'createdAt':_0x72c9c9[_0x7a85('0x31')],'updatedAt':_0x72c9c9[_0x7a85('0x32')]};return db[_0x7a85('0x33')][_0x7a85('0x34')](function(_0x53b78f){return db[_0x7a85('0x1b')]['update'](_0x43efed,{'where':{'id':_0x72c9c9['id']}},{'transaction':_0x53b78f})[_0x7a85('0x9')](function(){return db[_0x7a85('0x15')][_0x7a85('0x35')](_0x49a8dd,{'where':{'id':_0x15c60['id']}},{'transaction':_0x53b78f});});})['then'](function(_0x31c955){_0x30f35b({'id':_0x15c60['id'],'phone':_0x72c9c9[_0x7a85('0x2f')]});})[_0x7a85('0x13')](function(_0xe4e895){logger[_0x7a85('0xf')]('activateAdditionalPhone',_0xe4e895[_0x7a85('0x11')]);_0x4f9f36({'error':_0xe4e895[_0x7a85('0x11')]});});});}exports[_0x7a85('0x36')]=function(_0x3bbee6){var _0x11eb5e=this;return new Promise(function(_0x3a0ec1,_0x2b45e6){return db[_0x7a85('0x15')]['update'](_0x3bbee6[_0x7a85('0x17')][_0x7a85('0x37')],{'where':{'id':_0x3bbee6[_0x7a85('0x17')]['id']}})[_0x7a85('0x9')](function(_0x3f4388){_0x3a0ec1(_0x3f4388);})['catch'](function(_0x350ef3){logger[_0x7a85('0xf')](_0x7a85('0x36'),_0x350ef3[_0x7a85('0x11')]);_0x2b45e6(_0x11eb5e[_0x7a85('0xf')](0x1f4,_0x350ef3[_0x7a85('0x11')]));});});}; \ No newline at end of file +var _0xed67=['result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','VoiceQueueId','CampaignId','OrderBy','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','ListId','ASC','duration','waitTime','isNil','minutes','add','phone','createdAt','updatedAt','sequelize','update','field','IncrementPreviewCounters','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','http','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1ee065,_0x13a805){var _0x4145a2=function(_0x4f2e55){while(--_0x4f2e55){_0x1ee065['push'](_0x1ee065['shift']());}};_0x4145a2(++_0x13a805);}(_0xed67,0x12c));var _0x7ed6=function(_0x53f04f,_0x419aa8){_0x53f04f=_0x53f04f-0x0;var _0x16a824=_0xed67[_0x53f04f];return _0x16a824;};'use strict';var _=require(_0x7ed6('0x0'));var util=require(_0x7ed6('0x1'));var moment=require(_0x7ed6('0x2'));var BPromise=require(_0x7ed6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7ed6('0x4'));var db=require(_0x7ed6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7ed6('0x6'))(_0x7ed6('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x7ed6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x372b44,_0x2f2c4b,_0x2b3315){return new BPromise(function(_0x36b0d3,_0x571852){return client['request'](_0x372b44,_0x2b3315)[_0x7ed6('0x9')](function(_0x194a55){logger[_0x7ed6('0xa')](_0x7ed6('0xb'),_0x2f2c4b,_0x7ed6('0xc'));logger['debug'](_0x7ed6('0xd'),_0x2f2c4b,'request\x20sent',JSON[_0x7ed6('0xe')](_0x194a55));if(_0x194a55[_0x7ed6('0xf')]){if(_0x194a55[_0x7ed6('0xf')][_0x7ed6('0x10')]===0x1f4){logger[_0x7ed6('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x2f2c4b,_0x194a55[_0x7ed6('0xf')][_0x7ed6('0x11')]);return _0x571852(_0x194a55['error'][_0x7ed6('0x11')]);}logger[_0x7ed6('0xf')](_0x7ed6('0xb'),_0x2f2c4b,_0x194a55['error']['message']);return _0x36b0d3(_0x194a55['error'][_0x7ed6('0x11')]);}else{logger[_0x7ed6('0xa')](_0x7ed6('0xb'),_0x2f2c4b,_0x7ed6('0xc'));_0x36b0d3(_0x194a55[_0x7ed6('0x12')]['message']);}})[_0x7ed6('0x13')](function(_0x304259){logger[_0x7ed6('0xf')](_0x7ed6('0xb'),_0x2f2c4b,_0x304259);_0x571852(_0x304259);});});}exports[_0x7ed6('0x14')]=function(_0x148576){var _0x4a12d8=this;return new Promise(function(_0x1c5b96,_0x323261){return db[_0x7ed6('0x15')][_0x7ed6('0x16')]({'raw':!![],'where':{'ContactId':_0x148576[_0x7ed6('0x17')][_0x7ed6('0x18')],'ListId':_0x148576['body']['ListId'],'VoiceQueueId':_0x148576[_0x7ed6('0x17')][_0x7ed6('0x19')]===undefined?null:_0x148576[_0x7ed6('0x17')]['VoiceQueueId'],'CampaignId':_0x148576['body'][_0x7ed6('0x1a')]===undefined?null:_0x148576[_0x7ed6('0x17')][_0x7ed6('0x1a')]}})['then'](function(_0x4c3ded){if(_0x4c3ded!=null){return db['CmHopperAdditionalPhone'][_0x7ed6('0x16')]({'raw':!![],'where':{'CmHopperId':_0x4c3ded['id'],'OrderBy':{'$gt':_0x4c3ded[_0x7ed6('0x1b')]}},'order':[['OrderBy','ASC']]})[_0x7ed6('0x9')](function(_0x1e7c3f){var _0x33915a=0x0;if(_0x1e7c3f){if(_0x1e7c3f[_0x7ed6('0x1c')]+_0x1e7c3f[_0x7ed6('0x1d')]+_0x1e7c3f[_0x7ed6('0x1e')]+_0x1e7c3f[_0x7ed6('0x1f')]+_0x1e7c3f[_0x7ed6('0x20')]+_0x1e7c3f[_0x7ed6('0x21')]+_0x1e7c3f[_0x7ed6('0x22')]+_0x1e7c3f[_0x7ed6('0x23')]<_0x148576[_0x7ed6('0x24')][_0x7ed6('0x25')])_0x33915a=0x1;_0x1c5b96({'additional':_0x33915a});}else{return db[_0x7ed6('0x26')][_0x7ed6('0x16')]({'raw':!![],'where':{'CmHopperId':_0x4c3ded['id']},'order':[['OrderBy','ASC']]})[_0x7ed6('0x9')](function(_0x22e121){var _0xb419e=0x0;if(_0x22e121){if(_0x22e121['countbusyretry']+_0x22e121[_0x7ed6('0x1d')]+_0x22e121[_0x7ed6('0x1e')]+_0x22e121['countnosuchnumberretry']+_0x22e121[_0x7ed6('0x20')]+_0x22e121[_0x7ed6('0x21')]+_0x22e121[_0x7ed6('0x22')]+_0x22e121[_0x7ed6('0x23')]<_0x148576[_0x7ed6('0x24')]['dialGlobalMaxRetry'])_0xb419e=0x1;_0x1c5b96({'additional':_0xb419e});}else{_0x1c5b96({'additional':0x0});}})[_0x7ed6('0x13')](function(_0xbecb41){logger[_0x7ed6('0xf')](_0x7ed6('0x14'),_0xbecb41[_0x7ed6('0x11')]);_0x323261(_0x4a12d8[_0x7ed6('0xf')](0x1f4,_0xbecb41['message']));});}})[_0x7ed6('0x13')](function(_0x85cd1e){logger[_0x7ed6('0xf')](_0x7ed6('0x14'),_0x85cd1e[_0x7ed6('0x11')]);_0x323261(_0x4a12d8[_0x7ed6('0xf')](0x1f4,_0x85cd1e['message']));});}else _0x1c5b96({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x67aa96){var _0x2387a8=this;return new Promise(function(_0x2e9c3a,_0x24ec93){return db[_0x7ed6('0x15')][_0x7ed6('0x16')]({'raw':!![],'where':{'ContactId':_0x67aa96[_0x7ed6('0x17')][_0x7ed6('0x18')],'ListId':_0x67aa96[_0x7ed6('0x17')][_0x7ed6('0x27')],'VoiceQueueId':_0x67aa96[_0x7ed6('0x17')]['VoiceQueueId']===undefined?null:_0x67aa96[_0x7ed6('0x17')][_0x7ed6('0x19')],'CampaignId':_0x67aa96[_0x7ed6('0x17')]['CampaignId']===undefined?null:_0x67aa96[_0x7ed6('0x17')][_0x7ed6('0x1a')]}})[_0x7ed6('0x9')](function(_0x2fb847){if(_0x2fb847!=null){return db[_0x7ed6('0x26')][_0x7ed6('0x16')]({'raw':!![],'where':{'CmHopperId':_0x2fb847['id'],'OrderBy':{'$gte':_0x2fb847[_0x7ed6('0x1b')]}},'order':[['OrderBy',_0x7ed6('0x28')]]})[_0x7ed6('0x9')](function(_0x992ee3){if(_0x992ee3)return activateAdditionalPhone(_0x2fb847,_0x67aa96['body'],_0x992ee3,_0x67aa96[_0x7ed6('0x29')],_0x67aa96[_0x7ed6('0x2a')])[_0x7ed6('0x9')](function(_0x17a6ad){_0x2e9c3a(_0x17a6ad);});else{return db[_0x7ed6('0x26')][_0x7ed6('0x16')]({'raw':!![],'where':{'CmHopperId':_0x2fb847['id']},'order':[[_0x7ed6('0x1b'),_0x7ed6('0x28')]]})[_0x7ed6('0x9')](function(_0x22440f){if(_0x22440f)return activateAdditionalPhone(_0x2fb847,_0x67aa96[_0x7ed6('0x17')],_0x22440f,_0x67aa96[_0x7ed6('0x29')],_0x67aa96[_0x7ed6('0x2a')])[_0x7ed6('0x9')](function(_0x304c95){_0x2e9c3a(_0x304c95);});else{_0x2e9c3a({'id':_0x2fb847['id'],'phone':''});}})['catch'](function(_0x4c75a8){logger[_0x7ed6('0xf')]('VerifyAdditionalPhones',_0x4c75a8[_0x7ed6('0x11')]);_0x24ec93(_0x2387a8[_0x7ed6('0xf')](0x1f4,_0x4c75a8['message']));});}})[_0x7ed6('0x13')](function(_0x4731b6){logger['error'](_0x7ed6('0x14'),_0x4731b6[_0x7ed6('0x11')]);_0x24ec93(_0x2387a8[_0x7ed6('0xf')](0x1f4,_0x4731b6[_0x7ed6('0x11')]));});}else _0x2e9c3a(0x1);});});};function activateAdditionalPhone(_0x6d9450,_0xe0ad34,_0x3c65ce,_0x38e71b,_0x474954){return new Promise(function(_0xe2b443,_0x330a42){var _0x5e9827;if(_[_0x7ed6('0x2b')](_0x3c65ce['scheduledat'])){_0x3c65ce['scheduledat']=moment();}if(moment()>moment(_0x3c65ce['scheduledat'])){_0x5e9827=moment()['add'](_0x474954||0x3,_0x7ed6('0x2c'));}else{if(_0x3c65ce[_0x7ed6('0x1b')]==0x0){_0x5e9827=moment(_0x3c65ce['scheduledat']);}else{_0x5e9827=moment()[_0x7ed6('0x2d')](_0x474954||0x3,'minutes');}}if(_[_0x7ed6('0x2b')](_0x5e9827)){_0x5e9827=moment()[_0x7ed6('0x2d')](_0x474954||0x3,_0x7ed6('0x2c'));}var _0x4566ef={'phone':_0x6d9450[_0x7ed6('0x2e')],'active':0x0,'OrderBy':_[_0x7ed6('0x2b')](_0x6d9450[_0x7ed6('0x1b')])?0x0:_0x6d9450[_0x7ed6('0x1b')],'scheduledat':moment()[_0x7ed6('0x2d')](_0x38e71b||0x1,_0x7ed6('0x2c')),'countbusyretry':_0xe0ad34['countbusyretry'],'countcongestionretry':_0xe0ad34[_0x7ed6('0x1d')],'countnoanswerretry':_0xe0ad34['countnoanswerretry'],'countnosuchnumberretry':_0xe0ad34[_0x7ed6('0x1f')],'countdropretry':_0xe0ad34['countdropretry'],'countabandonedretry':_0xe0ad34[_0x7ed6('0x21')],'countmachineretry':_0xe0ad34[_0x7ed6('0x22')],'countagentrejectretry':_0xe0ad34[_0x7ed6('0x23')],'createdAt':_0xe0ad34['createdAt'],'updatedAt':_0xe0ad34['updatedAt']};var _0x85d431={'CmHopperId':_0x6d9450['id'],'phone':_0x3c65ce[_0x7ed6('0x2e')],'active':0x0,'OrderBy':_['isNil'](_0x3c65ce[_0x7ed6('0x1b')])?0x0:_0x3c65ce[_0x7ed6('0x1b')],'scheduledat':_0x5e9827,'countbusyretry':_0x3c65ce[_0x7ed6('0x1c')],'countcongestionretry':_0x3c65ce[_0x7ed6('0x1d')],'countnoanswerretry':_0x3c65ce[_0x7ed6('0x1e')],'countnosuchnumberretry':_0x3c65ce[_0x7ed6('0x1f')],'countdropretry':_0x3c65ce[_0x7ed6('0x20')],'countabandonedretry':_0x3c65ce['countabandonedretry'],'countmachineretry':_0x3c65ce[_0x7ed6('0x22')],'countagentrejectretry':_0x3c65ce[_0x7ed6('0x23')],'createdAt':_0x3c65ce[_0x7ed6('0x2f')],'updatedAt':_0x3c65ce[_0x7ed6('0x30')]};return db[_0x7ed6('0x31')]['transaction'](function(_0x39c91e){return db[_0x7ed6('0x26')][_0x7ed6('0x32')](_0x4566ef,{'where':{'id':_0x3c65ce['id']}},{'transaction':_0x39c91e})[_0x7ed6('0x9')](function(){return db[_0x7ed6('0x15')][_0x7ed6('0x32')](_0x85d431,{'where':{'id':_0x6d9450['id']}},{'transaction':_0x39c91e});});})[_0x7ed6('0x9')](function(_0x593fd6){_0xe2b443({'id':_0x6d9450['id'],'phone':_0x3c65ce[_0x7ed6('0x2e')]});})[_0x7ed6('0x13')](function(_0x445e57){logger['error']('activateAdditionalPhone',_0x445e57[_0x7ed6('0x11')]);_0x330a42({'error':_0x445e57[_0x7ed6('0x11')]});});});}exports['IncrementPreviewCounters']=function(_0x3f746d){var _0x4acb41=this;return new Promise(function(_0xb39ecf,_0x45f63f){return db[_0x7ed6('0x15')]['update'](_0x3f746d[_0x7ed6('0x17')][_0x7ed6('0x33')],{'where':{'id':_0x3f746d['body']['id']}})[_0x7ed6('0x9')](function(_0x1137cb){_0xb39ecf(_0x1137cb);})[_0x7ed6('0x13')](function(_0x2dacd1){logger[_0x7ed6('0xf')](_0x7ed6('0x34'),_0x2dacd1[_0x7ed6('0x11')]);_0x45f63f(_0x4acb41[_0x7ed6('0xf')](0x1f4,_0x2dacd1[_0x7ed6('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index ccfe407..e86394a 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb2d8=['./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','show','post','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x546e49,_0x2b942a){var _0x1bbbf9=function(_0x96f5e0){while(--_0x96f5e0){_0x546e49['push'](_0x546e49['shift']());}};_0x1bbbf9(++_0x2b942a);}(_0xb2d8,0x188));var _0x8b2d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb2d8[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8b2d('0x0'));var timeout=require(_0x8b2d('0x1'));var express=require(_0x8b2d('0x2'));var router=express[_0x8b2d('0x3')]();var fs_extra=require(_0x8b2d('0x4'));var auth=require(_0x8b2d('0x5'));var interaction=require(_0x8b2d('0x6'));var config=require(_0x8b2d('0x7'));var controller=require(_0x8b2d('0x8'));router[_0x8b2d('0x9')]('/',auth[_0x8b2d('0xa')](),controller[_0x8b2d('0xb')]);router[_0x8b2d('0x9')]('/:id',auth[_0x8b2d('0xa')](),controller[_0x8b2d('0xc')]);router[_0x8b2d('0xd')]('/',auth[_0x8b2d('0xa')](),controller['create']);router[_0x8b2d('0xe')](_0x8b2d('0xf'),auth[_0x8b2d('0xa')](),controller[_0x8b2d('0x10')]);router[_0x8b2d('0x11')]('/:id',auth[_0x8b2d('0xa')](),controller[_0x8b2d('0x12')]);module[_0x8b2d('0x13')]=router; \ No newline at end of file +var _0x40bc=['express','Router','fs-extra','../../config/environment','./cmHopperAdditionalPhone.controller','index','get','show','isAuthenticated','create','/:id','update','delete','exports','multer','util'];(function(_0x50c672,_0x23f049){var _0x3fe3ef=function(_0x1f5792){while(--_0x1f5792){_0x50c672['push'](_0x50c672['shift']());}};_0x3fe3ef(++_0x23f049);}(_0x40bc,0x10e));var _0xc40b=function(_0x2ba735,_0x5998b5){_0x2ba735=_0x2ba735-0x0;var _0x378aa9=_0x40bc[_0x2ba735];return _0x378aa9;};'use strict';var multer=require(_0xc40b('0x0'));var util=require(_0xc40b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc40b('0x2'));var router=express[_0xc40b('0x3')]();var fs_extra=require(_0xc40b('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc40b('0x5'));var controller=require(_0xc40b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xc40b('0x7')]);router[_0xc40b('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xc40b('0x9')]);router['post']('/',auth[_0xc40b('0xa')](),controller[_0xc40b('0xb')]);router['put'](_0xc40b('0xc'),auth['isAuthenticated'](),controller[_0xc40b('0xd')]);router[_0xc40b('0xe')](_0xc40b('0xc'),auth[_0xc40b('0xa')](),controller['destroy']);module[_0xc40b('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 3404887..f70e6dd 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 _0xde81=['contactListQueue','moment','sequelize','exports','STRING','INTEGER'];(function(_0x249ee6,_0x47998b){var _0x13127c=function(_0x399de9){while(--_0x399de9){_0x249ee6['push'](_0x249ee6['shift']());}};_0x13127c(++_0x47998b);}(_0xde81,0x109));var _0x1de8=function(_0x7083a2,_0x5cc787){_0x7083a2=_0x7083a2-0x0;var _0x3d42aa=_0xde81[_0x7083a2];return _0x3d42aa;};'use strict';var moment=require(_0x1de8('0x0'));var Sequelize=require(_0x1de8('0x1'));module[_0x1de8('0x2')]={'phone':{'type':Sequelize[_0x1de8('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x1de8('0x4')],'unique':_0x1de8('0x5')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x1de8('0x4')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x251b=['exports','STRING','INTEGER','contactListQueue','moment'];(function(_0x15884b,_0x412b94){var _0xc5c0b7=function(_0x3ba981){while(--_0x3ba981){_0x15884b['push'](_0x15884b['shift']());}};_0xc5c0b7(++_0x412b94);}(_0x251b,0xcc));var _0xb251=function(_0x38c699,_0x56fea7){_0x38c699=_0x38c699-0x0;var _0x3b1ded=_0x251b[_0x38c699];return _0x3b1ded;};'use strict';var moment=require(_0xb251('0x0'));var Sequelize=require('sequelize');module[_0xb251('0x1')]={'phone':{'type':Sequelize[_0xb251('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xb251('0x3')],'unique':_0xb251('0x4')},'ListId':{'type':Sequelize[_0xb251('0x3')],'unique':_0xb251('0x4')},'VoiceQueueId':{'type':Sequelize[_0xb251('0x3')],'unique':_0xb251('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 325c494..5735344 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 _0x9127=['map','query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','body','describe','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','name','index','CmHopperBlack','rawAttributes','fieldName','type'];(function(_0x3775ea,_0x325f1e){var _0xbea397=function(_0x16c7dd){while(--_0x16c7dd){_0x3775ea['push'](_0x3775ea['shift']());}};_0xbea397(++_0x325f1e);}(_0x9127,0x1b9));var _0x7912=function(_0x34eb31,_0x8f0f70){_0x34eb31=_0x34eb31-0x0;var _0x254994=_0x9127[_0x34eb31];return _0x254994;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7912('0x0'));var zipdir=require(_0x7912('0x1'));var jsonpatch=require(_0x7912('0x2'));var rp=require('request-promise');var moment=require(_0x7912('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7912('0x4'));var util=require(_0x7912('0x5'));var path=require(_0x7912('0x6'));var sox=require('sox');var csv=require(_0x7912('0x7'));var ejs=require(_0x7912('0x8'));var fs=require('fs');var fs_extra=require(_0x7912('0x9'));var _=require(_0x7912('0xa'));var squel=require(_0x7912('0xb'));var crypto=require('crypto');var jsforce=require(_0x7912('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7912('0x7'));var querystring=require('querystring');var Papa=require(_0x7912('0xd'));var Redis=require(_0x7912('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x7912('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7912('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x7912('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x7912('0x12'));var db=require(_0x7912('0x13'))['db'];function respondWithStatusCode(_0x1ce4df,_0x297821){_0x297821=_0x297821||0xcc;return function(_0x1367ee){if(_0x1367ee){return _0x1ce4df[_0x7912('0x14')](_0x297821);}return _0x1ce4df[_0x7912('0x15')](_0x297821)[_0x7912('0x16')]();};}function respondWithResult(_0x3ece3d,_0x3ebc05){_0x3ebc05=_0x3ebc05||0xc8;return function(_0x169396){if(_0x169396){return _0x3ece3d['status'](_0x3ebc05)[_0x7912('0x17')](_0x169396);}};}function respondWithFilteredResult(_0x1a268f,_0xc7a849){return function(_0x2de881){if(_0x2de881){var _0x467018=typeof _0xc7a849[_0x7912('0x18')]===_0x7912('0x19')&&typeof _0xc7a849[_0x7912('0x1a')]==='undefined';var _0x2e95c2=_0x2de881[_0x7912('0x1b')];var _0x4251ac=_0x467018?0x0:_0xc7a849[_0x7912('0x18')];var _0x2c5820=_0x467018?_0x2de881[_0x7912('0x1b')]:_0xc7a849[_0x7912('0x18')]+_0xc7a849[_0x7912('0x1a')];var _0x3b278f;if(_0x2c5820>=_0x2e95c2){_0x2c5820=_0x2e95c2;_0x3b278f=0xc8;}else{_0x3b278f=0xce;}_0x1a268f[_0x7912('0x15')](_0x3b278f);return _0x1a268f[_0x7912('0x1c')](_0x7912('0x1d'),_0x4251ac+'-'+_0x2c5820+'/'+_0x2e95c2)[_0x7912('0x17')](_0x2de881);}return null;};}function patchUpdates(_0x8b404f){return function(_0x57e942){try{jsonpatch['apply'](_0x57e942,_0x8b404f,!![]);}catch(_0x5404e1){return BPromise[_0x7912('0x1e')](_0x5404e1);}return _0x57e942[_0x7912('0x1f')]();};}function saveUpdates(_0x415e0e,_0x28750c){return function(_0xe9930a){if(_0xe9930a){return _0xe9930a[_0x7912('0x20')](_0x415e0e)[_0x7912('0x21')](function(_0x235ff1){return _0x235ff1;});}return null;};}function removeEntity(_0x30de4a,_0x454fac){return function(_0x56f23b){if(_0x56f23b){return _0x56f23b[_0x7912('0x22')]()[_0x7912('0x21')](function(){_0x30de4a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ba333,_0x18a0a7){return function(_0x3007a4){if(!_0x3007a4){_0x1ba333[_0x7912('0x14')](0x194);}return _0x3007a4;};}function handleError(_0x2d16ba,_0x24ccab){_0x24ccab=_0x24ccab||0x1f4;return function(_0x2e924a){logger[_0x7912('0x23')](_0x2e924a['stack']);if(_0x2e924a[_0x7912('0x24')]){delete _0x2e924a[_0x7912('0x24')];}_0x2d16ba['status'](_0x24ccab)['send'](_0x2e924a);};}exports[_0x7912('0x25')]=function(_0x342681,_0x11bada){var _0x218d8e={},_0x39c1f2={},_0x3247be={'count':0x0,'rows':[]};var _0x3a1697=_['map'](db[_0x7912('0x26')][_0x7912('0x27')],function(_0x3f89e5){return{'name':_0x3f89e5[_0x7912('0x28')],'type':_0x3f89e5[_0x7912('0x29')]['key']};});_0x39c1f2['model']=_[_0x7912('0x2a')](_0x3a1697,'name');_0x39c1f2[_0x7912('0x2b')]=_[_0x7912('0x2c')](_0x342681['query']);_0x39c1f2[_0x7912('0x2d')]=_['intersection'](_0x39c1f2[_0x7912('0x2e')],_0x39c1f2[_0x7912('0x2b')]);_0x218d8e[_0x7912('0x2f')]=_[_0x7912('0x30')](_0x39c1f2['model'],qs['fields'](_0x342681[_0x7912('0x2b')][_0x7912('0x31')]));_0x218d8e[_0x7912('0x2f')]=_0x218d8e['attributes'][_0x7912('0x32')]?_0x218d8e[_0x7912('0x2f')]:_0x39c1f2[_0x7912('0x2e')];if(!_0x342681[_0x7912('0x2b')]['hasOwnProperty'](_0x7912('0x33'))){_0x218d8e[_0x7912('0x1a')]=qs['limit'](_0x342681[_0x7912('0x2b')][_0x7912('0x1a')]);_0x218d8e[_0x7912('0x18')]=qs[_0x7912('0x18')](_0x342681[_0x7912('0x2b')][_0x7912('0x18')]);}_0x218d8e[_0x7912('0x34')]=qs[_0x7912('0x35')](_0x342681[_0x7912('0x2b')][_0x7912('0x35')]);_0x218d8e[_0x7912('0x36')]=qs[_0x7912('0x2d')](_[_0x7912('0x37')](_0x342681[_0x7912('0x2b')],_0x39c1f2['filters']),_0x3a1697);if(_0x342681[_0x7912('0x2b')][_0x7912('0x38')]){_0x218d8e[_0x7912('0x36')]=_[_0x7912('0x39')](_0x218d8e['where'],{'$or':_[_0x7912('0x2a')](_0x3a1697,function(_0x481dd4){if(_0x481dd4[_0x7912('0x29')]!==_0x7912('0x3a')){var _0x7632a9={};_0x7632a9[_0x481dd4[_0x7912('0x24')]]={'$like':'%'+_0x342681[_0x7912('0x2b')]['filter']+'%'};return _0x7632a9;}})});}_0x218d8e=_[_0x7912('0x39')]({},_0x218d8e,_0x342681[_0x7912('0x3b')]);var _0x478063={'where':_0x218d8e[_0x7912('0x36')]};return db[_0x7912('0x26')][_0x7912('0x1b')](_0x478063)[_0x7912('0x21')](function(_0x5a74ca){_0x3247be[_0x7912('0x1b')]=_0x5a74ca;if(_0x342681[_0x7912('0x2b')][_0x7912('0x3c')]){_0x218d8e[_0x7912('0x3d')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x218d8e);})[_0x7912('0x21')](function(_0x246d6f){_0x3247be[_0x7912('0x3e')]=_0x246d6f;return _0x3247be;})['then'](respondWithFilteredResult(_0x11bada,_0x218d8e))[_0x7912('0x3f')](handleError(_0x11bada,null));};exports[_0x7912('0x40')]=function(_0x2660fb,_0x1499e4){var _0x26336d={'raw':!![],'where':{'id':_0x2660fb[_0x7912('0x41')]['id']}},_0x12ed5e={};_0x12ed5e[_0x7912('0x2e')]=_[_0x7912('0x2c')](db[_0x7912('0x26')][_0x7912('0x27')]);_0x12ed5e[_0x7912('0x2b')]=_[_0x7912('0x2c')](_0x2660fb['query']);_0x12ed5e[_0x7912('0x2d')]=_[_0x7912('0x30')](_0x12ed5e['model'],_0x12ed5e[_0x7912('0x2b')]);_0x26336d['attributes']=_[_0x7912('0x30')](_0x12ed5e['model'],qs[_0x7912('0x31')](_0x2660fb[_0x7912('0x2b')][_0x7912('0x31')]));_0x26336d[_0x7912('0x2f')]=_0x26336d[_0x7912('0x2f')][_0x7912('0x32')]?_0x26336d[_0x7912('0x2f')]:_0x12ed5e[_0x7912('0x2e')];if(_0x2660fb[_0x7912('0x2b')][_0x7912('0x3c')]){_0x26336d[_0x7912('0x3d')]=[{'all':!![]}];}_0x26336d=_[_0x7912('0x39')]({},_0x26336d,_0x2660fb[_0x7912('0x3b')]);return db['CmHopperBlack'][_0x7912('0x42')](_0x26336d)['then'](handleEntityNotFound(_0x1499e4,null))[_0x7912('0x21')](respondWithResult(_0x1499e4,null))[_0x7912('0x3f')](handleError(_0x1499e4,null));};exports[_0x7912('0x20')]=function(_0x314ce2,_0x2e416d){if(_0x314ce2[_0x7912('0x43')]['id']){delete _0x314ce2['body']['id'];}return db[_0x7912('0x26')]['find']({'where':{'id':_0x314ce2[_0x7912('0x41')]['id']}})[_0x7912('0x21')](handleEntityNotFound(_0x2e416d,null))[_0x7912('0x21')](saveUpdates(_0x314ce2[_0x7912('0x43')],null))['then'](respondWithResult(_0x2e416d,null))['catch'](handleError(_0x2e416d,null));};exports[_0x7912('0x22')]=function(_0x3b77a2,_0xd9a2e2){return db[_0x7912('0x26')]['find']({'where':{'id':_0x3b77a2[_0x7912('0x41')]['id']}})[_0x7912('0x21')](handleEntityNotFound(_0xd9a2e2,null))[_0x7912('0x21')](removeEntity(_0xd9a2e2,null))['catch'](handleError(_0xd9a2e2,null));};exports[_0x7912('0x44')]=function(_0xe1eb2b,_0x201622){return db['CmHopperBlack'][_0x7912('0x44')]()[_0x7912('0x21')](respondWithResult(_0x201622,null))['catch'](handleError(_0x201622,null));}; \ No newline at end of file +var _0x1d7c=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','save','update','then','destroy','error','stack','name','send','map','CmHopperBlack','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','include','find','catch','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x4b119f,_0x28f2ce){var _0x5f35ff=function(_0x519324){while(--_0x519324){_0x4b119f['push'](_0x4b119f['shift']());}};_0x5f35ff(++_0x28f2ce);}(_0x1d7c,0xdd));var _0xc1d7=function(_0x59ef3d,_0x5c7aee){_0x59ef3d=_0x59ef3d-0x0;var _0x585558=_0x1d7c[_0x59ef3d];return _0x585558;};'use strict';var emlformat=require(_0xc1d7('0x0'));var rimraf=require(_0xc1d7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc1d7('0x2'));var rp=require('request-promise');var moment=require(_0xc1d7('0x3'));var BPromise=require(_0xc1d7('0x4'));var Mustache=require(_0xc1d7('0x5'));var util=require(_0xc1d7('0x6'));var path=require(_0xc1d7('0x7'));var sox=require(_0xc1d7('0x8'));var csv=require(_0xc1d7('0x9'));var ejs=require(_0xc1d7('0xa'));var fs=require('fs');var fs_extra=require(_0xc1d7('0xb'));var _=require(_0xc1d7('0xc'));var squel=require(_0xc1d7('0xd'));var crypto=require(_0xc1d7('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc1d7('0xf'));var toCsv=require(_0xc1d7('0x9'));var querystring=require(_0xc1d7('0x10'));var Papa=require(_0xc1d7('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc1d7('0x12'));var hardwareService=require(_0xc1d7('0x13'));var logger=require(_0xc1d7('0x14'))(_0xc1d7('0x15'));var utils=require(_0xc1d7('0x16'));var config=require(_0xc1d7('0x17'));var licenseUtil=require(_0xc1d7('0x18'));var db=require(_0xc1d7('0x19'))['db'];function respondWithStatusCode(_0xd3324b,_0x108812){_0x108812=_0x108812||0xcc;return function(_0x5402c5){if(_0x5402c5){return _0xd3324b[_0xc1d7('0x1a')](_0x108812);}return _0xd3324b[_0xc1d7('0x1b')](_0x108812)[_0xc1d7('0x1c')]();};}function respondWithResult(_0x4b5a39,_0x216970){_0x216970=_0x216970||0xc8;return function(_0x5240e5){if(_0x5240e5){return _0x4b5a39[_0xc1d7('0x1b')](_0x216970)[_0xc1d7('0x1d')](_0x5240e5);}};}function respondWithFilteredResult(_0x1a0ecf,_0xb9ae8c){return function(_0x3d21d7){if(_0x3d21d7){var _0x58350f=typeof _0xb9ae8c['offset']===_0xc1d7('0x1e')&&typeof _0xb9ae8c['limit']===_0xc1d7('0x1e');var _0x58d096=_0x3d21d7[_0xc1d7('0x1f')];var _0x527b31=_0x58350f?0x0:_0xb9ae8c[_0xc1d7('0x20')];var _0x4adada=_0x58350f?_0x3d21d7[_0xc1d7('0x1f')]:_0xb9ae8c[_0xc1d7('0x20')]+_0xb9ae8c[_0xc1d7('0x21')];var _0x26bfd7;if(_0x4adada>=_0x58d096){_0x4adada=_0x58d096;_0x26bfd7=0xc8;}else{_0x26bfd7=0xce;}_0x1a0ecf[_0xc1d7('0x1b')](_0x26bfd7);return _0x1a0ecf[_0xc1d7('0x22')]('Content-Range',_0x527b31+'-'+_0x4adada+'/'+_0x58d096)['json'](_0x3d21d7);}return null;};}function patchUpdates(_0x8e6b0){return function(_0x4db800){try{jsonpatch['apply'](_0x4db800,_0x8e6b0,!![]);}catch(_0x4fe8a6){return BPromise['reject'](_0x4fe8a6);}return _0x4db800[_0xc1d7('0x23')]();};}function saveUpdates(_0x148eea,_0x2732b6){return function(_0x2a7828){if(_0x2a7828){return _0x2a7828[_0xc1d7('0x24')](_0x148eea)[_0xc1d7('0x25')](function(_0x3cbf55){return _0x3cbf55;});}return null;};}function removeEntity(_0x3a66ac,_0x8db688){return function(_0x1f5b0d){if(_0x1f5b0d){return _0x1f5b0d[_0xc1d7('0x26')]()[_0xc1d7('0x25')](function(){_0x3a66ac[_0xc1d7('0x1b')](0xcc)[_0xc1d7('0x1c')]();});}};}function handleEntityNotFound(_0x2fdd1f,_0x1614a1){return function(_0x1caa52){if(!_0x1caa52){_0x2fdd1f[_0xc1d7('0x1a')](0x194);}return _0x1caa52;};}function handleError(_0x277051,_0x14302f){_0x14302f=_0x14302f||0x1f4;return function(_0x5c0f9d){logger[_0xc1d7('0x27')](_0x5c0f9d[_0xc1d7('0x28')]);if(_0x5c0f9d[_0xc1d7('0x29')]){delete _0x5c0f9d[_0xc1d7('0x29')];}_0x277051[_0xc1d7('0x1b')](_0x14302f)[_0xc1d7('0x2a')](_0x5c0f9d);};}exports['index']=function(_0x382283,_0xfc086e){var _0x4e9307={},_0x41d6ee={},_0x44492e={'count':0x0,'rows':[]};var _0xdb6df7=_[_0xc1d7('0x2b')](db[_0xc1d7('0x2c')][_0xc1d7('0x2d')],function(_0x5bb666){return{'name':_0x5bb666[_0xc1d7('0x2e')],'type':_0x5bb666['type'][_0xc1d7('0x2f')]};});_0x41d6ee[_0xc1d7('0x30')]=_[_0xc1d7('0x2b')](_0xdb6df7,_0xc1d7('0x29'));_0x41d6ee[_0xc1d7('0x31')]=_['keys'](_0x382283[_0xc1d7('0x31')]);_0x41d6ee[_0xc1d7('0x32')]=_[_0xc1d7('0x33')](_0x41d6ee['model'],_0x41d6ee[_0xc1d7('0x31')]);_0x4e9307['attributes']=_[_0xc1d7('0x33')](_0x41d6ee[_0xc1d7('0x30')],qs[_0xc1d7('0x34')](_0x382283[_0xc1d7('0x31')]['fields']));_0x4e9307[_0xc1d7('0x35')]=_0x4e9307[_0xc1d7('0x35')][_0xc1d7('0x36')]?_0x4e9307['attributes']:_0x41d6ee[_0xc1d7('0x30')];if(!_0x382283[_0xc1d7('0x31')][_0xc1d7('0x37')](_0xc1d7('0x38'))){_0x4e9307[_0xc1d7('0x21')]=qs[_0xc1d7('0x21')](_0x382283['query'][_0xc1d7('0x21')]);_0x4e9307['offset']=qs[_0xc1d7('0x20')](_0x382283[_0xc1d7('0x31')][_0xc1d7('0x20')]);}_0x4e9307[_0xc1d7('0x39')]=qs['sort'](_0x382283[_0xc1d7('0x31')][_0xc1d7('0x3a')]);_0x4e9307['where']=qs['filters'](_[_0xc1d7('0x3b')](_0x382283[_0xc1d7('0x31')],_0x41d6ee[_0xc1d7('0x32')]),_0xdb6df7);if(_0x382283[_0xc1d7('0x31')][_0xc1d7('0x3c')]){_0x4e9307[_0xc1d7('0x3d')]=_[_0xc1d7('0x3e')](_0x4e9307[_0xc1d7('0x3d')],{'$or':_[_0xc1d7('0x2b')](_0xdb6df7,function(_0x52c102){if(_0x52c102[_0xc1d7('0x3f')]!==_0xc1d7('0x40')){var _0x4ab0e2={};_0x4ab0e2[_0x52c102['name']]={'$like':'%'+_0x382283['query'][_0xc1d7('0x3c')]+'%'};return _0x4ab0e2;}})});}_0x4e9307=_[_0xc1d7('0x3e')]({},_0x4e9307,_0x382283[_0xc1d7('0x41')]);var _0x1f6016={'where':_0x4e9307[_0xc1d7('0x3d')]};return db[_0xc1d7('0x2c')]['count'](_0x1f6016)[_0xc1d7('0x25')](function(_0x1821f0){_0x44492e['count']=_0x1821f0;if(_0x382283[_0xc1d7('0x31')][_0xc1d7('0x42')]){_0x4e9307['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0xc1d7('0x43')](_0x4e9307);})['then'](function(_0x27a078){_0x44492e[_0xc1d7('0x44')]=_0x27a078;return _0x44492e;})[_0xc1d7('0x25')](respondWithFilteredResult(_0xfc086e,_0x4e9307))['catch'](handleError(_0xfc086e,null));};exports[_0xc1d7('0x45')]=function(_0x1329c3,_0x43c109){var _0x13a75d={'raw':!![],'where':{'id':_0x1329c3[_0xc1d7('0x46')]['id']}},_0x1ce14d={};_0x1ce14d[_0xc1d7('0x30')]=_[_0xc1d7('0x47')](db['CmHopperBlack'][_0xc1d7('0x2d')]);_0x1ce14d['query']=_['keys'](_0x1329c3['query']);_0x1ce14d[_0xc1d7('0x32')]=_['intersection'](_0x1ce14d[_0xc1d7('0x30')],_0x1ce14d['query']);_0x13a75d[_0xc1d7('0x35')]=_[_0xc1d7('0x33')](_0x1ce14d[_0xc1d7('0x30')],qs['fields'](_0x1329c3[_0xc1d7('0x31')]['fields']));_0x13a75d[_0xc1d7('0x35')]=_0x13a75d[_0xc1d7('0x35')][_0xc1d7('0x36')]?_0x13a75d[_0xc1d7('0x35')]:_0x1ce14d['model'];if(_0x1329c3[_0xc1d7('0x31')][_0xc1d7('0x42')]){_0x13a75d[_0xc1d7('0x48')]=[{'all':!![]}];}_0x13a75d=_[_0xc1d7('0x3e')]({},_0x13a75d,_0x1329c3['options']);return db[_0xc1d7('0x2c')][_0xc1d7('0x49')](_0x13a75d)[_0xc1d7('0x25')](handleEntityNotFound(_0x43c109,null))[_0xc1d7('0x25')](respondWithResult(_0x43c109,null))[_0xc1d7('0x4a')](handleError(_0x43c109,null));};exports[_0xc1d7('0x24')]=function(_0x10b952,_0x1d0f80){if(_0x10b952['body']['id']){delete _0x10b952['body']['id'];}return db['CmHopperBlack'][_0xc1d7('0x49')]({'where':{'id':_0x10b952[_0xc1d7('0x46')]['id']}})['then'](handleEntityNotFound(_0x1d0f80,null))['then'](saveUpdates(_0x10b952['body'],null))[_0xc1d7('0x25')](respondWithResult(_0x1d0f80,null))['catch'](handleError(_0x1d0f80,null));};exports[_0xc1d7('0x26')]=function(_0x1ff4f8,_0x2c130f){return db[_0xc1d7('0x2c')][_0xc1d7('0x49')]({'where':{'id':_0x1ff4f8[_0xc1d7('0x46')]['id']}})['then'](handleEntityNotFound(_0x2c130f,null))['then'](removeEntity(_0x2c130f,null))[_0xc1d7('0x4a')](handleError(_0x2c130f,null));};exports['describe']=function(_0x3a23ad,_0x34e012){return db['CmHopperBlack'][_0xc1d7('0x4b')]()['then'](respondWithResult(_0x34e012,null))[_0xc1d7('0x4a')](handleError(_0x34e012,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 83b90ca..f1c9cd9 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 _0x1d6a=['request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','define','CmHopperBlack','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x54f493,_0x385811){var _0x5f2b47=function(_0x2d2323){while(--_0x2d2323){_0x54f493['push'](_0x54f493['shift']());}};_0x5f2b47(++_0x385811);}(_0x1d6a,0x1e8));var _0xa1d6=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x1d6a[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0xa1d6('0x0'));var util=require(_0xa1d6('0x1'));var logger=require(_0xa1d6('0x2'))(_0xa1d6('0x3'));var moment=require(_0xa1d6('0x4'));var BPromise=require(_0xa1d6('0x5'));var rp=require(_0xa1d6('0x6'));var fs=require('fs');var path=require(_0xa1d6('0x7'));var rimraf=require(_0xa1d6('0x8'));var config=require(_0xa1d6('0x9'));var attributes=require(_0xa1d6('0xa'));module['exports']=function(_0x35228d,_0x300554){return _0x35228d[_0xa1d6('0xb')](_0xa1d6('0xc'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe34b=['../../config/environment','./cmHopperBlack.attributes','CmHopperBlack','cm_hopper_black','util','../../config/logger','moment','bluebird','rimraf'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xe34b,0x1ab));var _0xbe34=function(_0x34b1b8,_0x54c9bf){_0x34b1b8=_0x34b1b8-0x0;var _0x542dd8=_0xe34b[_0x34b1b8];return _0x542dd8;};'use strict';var _=require('lodash');var util=require(_0xbe34('0x0'));var logger=require(_0xbe34('0x1'))('api');var moment=require(_0xbe34('0x2'));var BPromise=require(_0xbe34('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbe34('0x4'));var config=require(_0xbe34('0x5'));var attributes=require(_0xbe34('0x6'));module['exports']=function(_0x274b6f,_0x42168e){return _0x274b6f['define'](_0xbe34('0x7'),attributes,{'tableName':_0xbe34('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 2ae556b..5bd7e0c 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 _0x87de=['http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','attributes','limit','model','include','map','update','body','where','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3649ca,_0x3a2e7f){var _0x7b52c8=function(_0x57ecd6){while(--_0x57ecd6){_0x3649ca['push'](_0x3649ca['shift']());}};_0x7b52c8(++_0x3a2e7f);}(_0x87de,0x186));var _0xe87d=function(_0x59112b,_0x37177f){_0x59112b=_0x59112b-0x0;var _0x7efda0=_0x87de[_0x59112b];return _0x7efda0;};'use strict';var _=require(_0xe87d('0x0'));var util=require(_0xe87d('0x1'));var moment=require(_0xe87d('0x2'));var BPromise=require(_0xe87d('0x3'));var rs=require(_0xe87d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe87d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe87d('0x6'))(_0xe87d('0x7'));var config=require(_0xe87d('0x8'));var jayson=require(_0xe87d('0x9'));var client=jayson['client'][_0xe87d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59959a,_0x5003ba,_0x437ab3){return new BPromise(function(_0x359d7c,_0x5d29c0){return client[_0xe87d('0xb')](_0x59959a,_0x437ab3)[_0xe87d('0xc')](function(_0x2d277a){logger[_0xe87d('0xd')](_0xe87d('0xe'),_0x5003ba,_0xe87d('0xf'));logger[_0xe87d('0x10')](_0xe87d('0x11'),_0x5003ba,_0xe87d('0xf'),JSON[_0xe87d('0x12')](_0x2d277a));if(_0x2d277a[_0xe87d('0x13')]){if(_0x2d277a[_0xe87d('0x13')][_0xe87d('0x14')]===0x1f4){logger[_0xe87d('0x13')](_0xe87d('0xe'),_0x5003ba,_0x2d277a[_0xe87d('0x13')][_0xe87d('0x15')]);return _0x5d29c0(_0x2d277a[_0xe87d('0x13')][_0xe87d('0x15')]);}logger[_0xe87d('0x13')](_0xe87d('0xe'),_0x5003ba,_0x2d277a[_0xe87d('0x13')][_0xe87d('0x15')]);return _0x359d7c(_0x2d277a['error'][_0xe87d('0x15')]);}else{logger[_0xe87d('0xd')](_0xe87d('0xe'),_0x5003ba,_0xe87d('0xf'));_0x359d7c(_0x2d277a[_0xe87d('0x16')]['message']);}})[_0xe87d('0x17')](function(_0x479489){logger[_0xe87d('0x13')](_0xe87d('0xe'),_0x5003ba,_0x479489);_0x5d29c0(_0x479489);});});}exports[_0xe87d('0x18')]=function(_0x30c32a){var _0x51db09=this;return new Promise(function(_0x2f844a,_0x231e4a){return db[_0xe87d('0x19')][_0xe87d('0x1a')]({'raw':_0x30c32a[_0xe87d('0x1b')]?_0x30c32a['options'][_0xe87d('0x1c')]===undefined?!![]:![]:!![],'where':_0x30c32a[_0xe87d('0x1b')]?_0x30c32a['options']['where']||null:null,'attributes':_0x30c32a['options']?_0x30c32a['options'][_0xe87d('0x1d')]||null:null,'limit':_0x30c32a[_0xe87d('0x1b')]?_0x30c32a['options'][_0xe87d('0x1e')]||null:null,'include':_0x30c32a['options']?_0x30c32a['options']['include']?_['map'](_0x30c32a[_0xe87d('0x1b')]['include'],function(_0x4d432f){return{'model':db[_0x4d432f[_0xe87d('0x1f')]],'as':_0x4d432f['as'],'attributes':_0x4d432f[_0xe87d('0x1d')],'include':_0x4d432f[_0xe87d('0x20')]?_[_0xe87d('0x21')](_0x4d432f[_0xe87d('0x20')],function(_0x32e6c5){return{'model':db[_0x32e6c5[_0xe87d('0x1f')]],'as':_0x32e6c5['as'],'attributes':_0x32e6c5[_0xe87d('0x1d')],'include':_0x32e6c5[_0xe87d('0x20')]?_[_0xe87d('0x21')](_0x32e6c5[_0xe87d('0x20')],function(_0x3561df){return{'model':db[_0x3561df[_0xe87d('0x1f')]],'as':_0x3561df['as'],'attributes':_0x3561df[_0xe87d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe87d('0xc')](function(_0x215318){logger[_0xe87d('0xd')](_0xe87d('0x18'),_0x30c32a);logger['debug']('GetCmHopperBlack',_0x30c32a,JSON[_0xe87d('0x12')](_0x215318));_0x2f844a(_0x215318);})[_0xe87d('0x17')](function(_0x2abdf3){logger[_0xe87d('0x13')](_0xe87d('0x18'),_0x2abdf3[_0xe87d('0x15')],_0x30c32a);_0x231e4a(_0x51db09[_0xe87d('0x13')](0x1f4,_0x2abdf3[_0xe87d('0x15')]));});});};exports['UpdateCmHopperBlack']=function(_0x32e06e){var _0x472078=this;return new Promise(function(_0x45d263,_0xc9b62b){return db[_0xe87d('0x19')][_0xe87d('0x22')](_0x32e06e[_0xe87d('0x23')],{'raw':_0x32e06e[_0xe87d('0x1b')]?_0x32e06e[_0xe87d('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32e06e[_0xe87d('0x1b')]?_0x32e06e[_0xe87d('0x1b')][_0xe87d('0x24')]||null:null,'attributes':_0x32e06e[_0xe87d('0x1b')]?_0x32e06e['options'][_0xe87d('0x1d')]||null:null,'limit':_0x32e06e[_0xe87d('0x1b')]?_0x32e06e[_0xe87d('0x1b')][_0xe87d('0x1e')]||null:null})['then'](function(_0x5ede4d){logger[_0xe87d('0xd')](_0xe87d('0x25'),_0x32e06e);logger[_0xe87d('0x10')](_0xe87d('0x25'),_0x32e06e,JSON[_0xe87d('0x12')](_0x5ede4d));_0x45d263(_0x5ede4d);})[_0xe87d('0x17')](function(_0xefaa25){logger[_0xe87d('0x13')](_0xe87d('0x25'),_0xefaa25[_0xe87d('0x15')],_0x32e06e);_0xc9b62b(_0x472078[_0xe87d('0x13')](0x1f4,_0xefaa25[_0xe87d('0x15')]));});});};exports[_0xe87d('0x26')]=function(_0x16adc4){var _0x1e7297=this;return new Promise(function(_0x169d7e,_0x4b7faa){return db['CmHopperBlack'][_0xe87d('0x27')]({'where':_0x16adc4['options']?_0x16adc4[_0xe87d('0x1b')][_0xe87d('0x24')]||null:null})['then'](function(_0x2a40c7){logger['info'](_0xe87d('0x26'),_0x16adc4);logger[_0xe87d('0x10')](_0xe87d('0x26'),_0x16adc4,JSON[_0xe87d('0x12')](_0x2a40c7));_0x169d7e(_0x2a40c7);})[_0xe87d('0x17')](function(_0x4bbc73){logger[_0xe87d('0x13')](_0xe87d('0x26'),_0x4bbc73[_0xe87d('0x15')],_0x16adc4);_0x4b7faa(_0x1e7297[_0xe87d('0x13')](0x1f4,_0x4bbc73['message']));});});}; \ No newline at end of file +var _0x12dc=['options','where','attributes','include','model','map','debug','update','body','raw','limit','UpdateCmHopperBlack','DestroyCmHopperBlack','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperBlack,\x20%s,\x20%s','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetCmHopperBlack','CmHopperBlack','findAll'];(function(_0x3cea45,_0x5096ad){var _0x2744ab=function(_0x1306f8){while(--_0x1306f8){_0x3cea45['push'](_0x3cea45['shift']());}};_0x2744ab(++_0x5096ad);}(_0x12dc,0xd5));var _0xc12d=function(_0x4416ae,_0x1ac48b){_0x4416ae=_0x4416ae-0x0;var _0x39c90e=_0x12dc[_0x4416ae];return _0x39c90e;};'use strict';var _=require('lodash');var util=require(_0xc12d('0x0'));var moment=require(_0xc12d('0x1'));var BPromise=require(_0xc12d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc12d('0x3'));var db=require(_0xc12d('0x4'))['db'];var utils=require(_0xc12d('0x5'));var logger=require(_0xc12d('0x6'))(_0xc12d('0x7'));var config=require(_0xc12d('0x8'));var jayson=require(_0xc12d('0x9'));var client=jayson[_0xc12d('0xa')][_0xc12d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x334dd1,_0x3dbb7f,_0x3919f7){return new BPromise(function(_0x394111,_0x1c8a84){return client[_0xc12d('0xc')](_0x334dd1,_0x3919f7)[_0xc12d('0xd')](function(_0x5e84a9){logger['info'](_0xc12d('0xe'),_0x3dbb7f,'request\x20sent');logger['debug'](_0xc12d('0xf'),_0x3dbb7f,_0xc12d('0x10'),JSON[_0xc12d('0x11')](_0x5e84a9));if(_0x5e84a9[_0xc12d('0x12')]){if(_0x5e84a9['error'][_0xc12d('0x13')]===0x1f4){logger['error'](_0xc12d('0xe'),_0x3dbb7f,_0x5e84a9[_0xc12d('0x12')][_0xc12d('0x14')]);return _0x1c8a84(_0x5e84a9['error'][_0xc12d('0x14')]);}logger[_0xc12d('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x3dbb7f,_0x5e84a9[_0xc12d('0x12')][_0xc12d('0x14')]);return _0x394111(_0x5e84a9['error'][_0xc12d('0x14')]);}else{logger[_0xc12d('0x15')](_0xc12d('0xe'),_0x3dbb7f,_0xc12d('0x10'));_0x394111(_0x5e84a9[_0xc12d('0x16')][_0xc12d('0x14')]);}})[_0xc12d('0x17')](function(_0x8864e){logger[_0xc12d('0x12')](_0xc12d('0xe'),_0x3dbb7f,_0x8864e);_0x1c8a84(_0x8864e);});});}exports[_0xc12d('0x18')]=function(_0x4ba09c){var _0x2a4d3e=this;return new Promise(function(_0x407d20,_0x4748ae){return db[_0xc12d('0x19')][_0xc12d('0x1a')]({'raw':_0x4ba09c[_0xc12d('0x1b')]?_0x4ba09c[_0xc12d('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x4ba09c['options']?_0x4ba09c[_0xc12d('0x1b')][_0xc12d('0x1c')]||null:null,'attributes':_0x4ba09c[_0xc12d('0x1b')]?_0x4ba09c['options'][_0xc12d('0x1d')]||null:null,'limit':_0x4ba09c['options']?_0x4ba09c[_0xc12d('0x1b')]['limit']||null:null,'include':_0x4ba09c[_0xc12d('0x1b')]?_0x4ba09c['options'][_0xc12d('0x1e')]?_['map'](_0x4ba09c[_0xc12d('0x1b')][_0xc12d('0x1e')],function(_0x3d0b45){return{'model':db[_0x3d0b45[_0xc12d('0x1f')]],'as':_0x3d0b45['as'],'attributes':_0x3d0b45[_0xc12d('0x1d')],'include':_0x3d0b45[_0xc12d('0x1e')]?_['map'](_0x3d0b45['include'],function(_0x22a3c2){return{'model':db[_0x22a3c2[_0xc12d('0x1f')]],'as':_0x22a3c2['as'],'attributes':_0x22a3c2[_0xc12d('0x1d')],'include':_0x22a3c2['include']?_[_0xc12d('0x20')](_0x22a3c2['include'],function(_0x1de9c5){return{'model':db[_0x1de9c5['model']],'as':_0x1de9c5['as'],'attributes':_0x1de9c5[_0xc12d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc12d('0xd')](function(_0x401ef7){logger[_0xc12d('0x15')](_0xc12d('0x18'),_0x4ba09c);logger[_0xc12d('0x21')](_0xc12d('0x18'),_0x4ba09c,JSON[_0xc12d('0x11')](_0x401ef7));_0x407d20(_0x401ef7);})['catch'](function(_0x528e85){logger[_0xc12d('0x12')](_0xc12d('0x18'),_0x528e85[_0xc12d('0x14')],_0x4ba09c);_0x4748ae(_0x2a4d3e[_0xc12d('0x12')](0x1f4,_0x528e85['message']));});});};exports['UpdateCmHopperBlack']=function(_0x41ae1){var _0x4fe330=this;return new Promise(function(_0x5a47b6,_0x50f0bc){return db[_0xc12d('0x19')][_0xc12d('0x22')](_0x41ae1[_0xc12d('0x23')],{'raw':_0x41ae1[_0xc12d('0x1b')]?_0x41ae1['options'][_0xc12d('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41ae1[_0xc12d('0x1b')]?_0x41ae1[_0xc12d('0x1b')]['where']||null:null,'attributes':_0x41ae1[_0xc12d('0x1b')]?_0x41ae1[_0xc12d('0x1b')][_0xc12d('0x1d')]||null:null,'limit':_0x41ae1[_0xc12d('0x1b')]?_0x41ae1[_0xc12d('0x1b')][_0xc12d('0x25')]||null:null})[_0xc12d('0xd')](function(_0x5b1b82){logger[_0xc12d('0x15')](_0xc12d('0x26'),_0x41ae1);logger[_0xc12d('0x21')](_0xc12d('0x26'),_0x41ae1,JSON[_0xc12d('0x11')](_0x5b1b82));_0x5a47b6(_0x5b1b82);})['catch'](function(_0x1fb104){logger[_0xc12d('0x12')]('UpdateCmHopperBlack',_0x1fb104[_0xc12d('0x14')],_0x41ae1);_0x50f0bc(_0x4fe330['error'](0x1f4,_0x1fb104[_0xc12d('0x14')]));});});};exports['DestroyCmHopperBlack']=function(_0x297acf){var _0xe36a49=this;return new Promise(function(_0x35553f,_0x498fb2){return db[_0xc12d('0x19')]['destroy']({'where':_0x297acf[_0xc12d('0x1b')]?_0x297acf[_0xc12d('0x1b')][_0xc12d('0x1c')]||null:null})[_0xc12d('0xd')](function(_0x2ec50d){logger['info'](_0xc12d('0x27'),_0x297acf);logger[_0xc12d('0x21')]('DestroyCmHopperBlack',_0x297acf,JSON[_0xc12d('0x11')](_0x2ec50d));_0x35553f(_0x2ec50d);})[_0xc12d('0x17')](function(_0x7630ed){logger[_0xc12d('0x12')](_0xc12d('0x27'),_0x7630ed[_0xc12d('0x14')],_0x297acf);_0x498fb2(_0xe36a49['error'](0x1f4,_0x7630ed[_0xc12d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 70dd3db..e25c7d6 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 _0x4819=['show','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','/describe','describe','get','/:id'];(function(_0x69db79,_0x540d58){var _0x51e5dd=function(_0x32f35b){while(--_0x32f35b){_0x69db79['push'](_0x69db79['shift']());}};_0x51e5dd(++_0x540d58);}(_0x4819,0xcd));var _0x9481=function(_0x44be9a,_0x5ce1a6){_0x44be9a=_0x44be9a-0x0;var _0x3dbb78=_0x4819[_0x44be9a];return _0x3dbb78;};'use strict';var multer=require('multer');var util=require(_0x9481('0x0'));var path=require(_0x9481('0x1'));var timeout=require(_0x9481('0x2'));var express=require(_0x9481('0x3'));var router=express[_0x9481('0x4')]();var fs_extra=require(_0x9481('0x5'));var auth=require(_0x9481('0x6'));var interaction=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var controller=require(_0x9481('0x9'));router['get']('/',auth[_0x9481('0xa')](),controller['index']);router['get'](_0x9481('0xb'),auth[_0x9481('0xa')](),controller[_0x9481('0xc')]);router[_0x9481('0xd')](_0x9481('0xe'),auth['isAuthenticated'](),controller[_0x9481('0xf')]);router['put'](_0x9481('0xe'),auth['isAuthenticated'](),controller[_0x9481('0x10')]);router[_0x9481('0x11')](_0x9481('0xe'),auth[_0x9481('0xa')](),controller[_0x9481('0x12')]);module[_0x9481('0x13')]=router; \ No newline at end of file +var _0x5430=['path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','destroy','exports','multer','util'];(function(_0xa3f3b4,_0x828dea){var _0x15f6f7=function(_0x2f4845){while(--_0x2f4845){_0xa3f3b4['push'](_0xa3f3b4['shift']());}};_0x15f6f7(++_0x828dea);}(_0x5430,0x10c));var _0x0543=function(_0x314c44,_0x31c1a0){_0x314c44=_0x314c44-0x0;var _0x54a02b=_0x5430[_0x314c44];return _0x54a02b;};'use strict';var multer=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var path=require(_0x0543('0x2'));var timeout=require(_0x0543('0x3'));var express=require(_0x0543('0x4'));var router=express[_0x0543('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0543('0x6'));var config=require('../../config/environment');var controller=require('./cmHopperBlack.controller');router[_0x0543('0x7')]('/',auth[_0x0543('0x8')](),controller[_0x0543('0x9')]);router[_0x0543('0x7')](_0x0543('0xa'),auth['isAuthenticated'](),controller[_0x0543('0xb')]);router[_0x0543('0x7')](_0x0543('0xc'),auth[_0x0543('0x8')](),controller[_0x0543('0xd')]);router[_0x0543('0xe')]('/:id',auth[_0x0543('0x8')](),controller[_0x0543('0xf')]);router['delete'](_0x0543('0xc'),auth[_0x0543('0x8')](),controller[_0x0543('0x10')]);module[_0x0543('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 7890c1e..42deb8d 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 _0x8462=['followuptime','seconds','BOOLEAN','moment','exports','STRING','DATE','INTEGER','setDataValue'];(function(_0x1f1641,_0x42ad9d){var _0x9660b4=function(_0x545ff2){while(--_0x545ff2){_0x1f1641['push'](_0x1f1641['shift']());}};_0x9660b4(++_0x42ad9d);}(_0x8462,0xa5));var _0x2846=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x8462[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x2846('0x0'));module[_0x2846('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x2846('0x2')]},'scheduledat':{'type':Sequelize[_0x2846('0x3')]},'countbusyretry':{'type':Sequelize[_0x2846('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2846('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2846('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x2846('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x2846('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x2846('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x2846('0x3')]},'responsetime':{'type':Sequelize[_0x2846('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x2846('0x3')]},'ringtime':{'type':Sequelize[_0x2846('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x2846('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x2846('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x2846('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x2846('0x2')]},'campaign':{'type':Sequelize[_0x2846('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x2846('0x2')]},'reason':{'type':Sequelize[_0x2846('0x2')]},'disposition':{'type':Sequelize[_0x2846('0x2')]},'secondDisposition':{'type':Sequelize[_0x2846('0x2')]},'thirdDisposition':{'type':Sequelize[_0x2846('0x2')]},'dispositionat':{'type':Sequelize[_0x2846('0x3')],'set':function(_0x552244){var _0x553cad=this['getDataValue']('endtime');if(_0x553cad&&_0x552244){this[_0x2846('0x5')](_0x2846('0x6'),moment(_0x552244)['diff'](moment(_0x553cad),_0x2846('0x7')));}}},'amd':{'type':Sequelize[_0x2846('0x8')],'defaultValue':![]},'fax':{'type':Sequelize[_0x2846('0x8')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x2846('0x8')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x2846('0x3')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x2846('0x3')]},'deleted':{'type':Sequelize[_0x2846('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x2846('0x3')]},'recallme':{'type':Sequelize[_0x2846('0x8')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x2846('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0x2846('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x2846('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x2846('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x2846('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9318=['INTEGER','STRING','DATE','endtime','followuptime','diff','seconds','BOOLEAN','sequelize','moment'];(function(_0x3ee21e,_0x5cf64c){var _0x10755a=function(_0x31d3a9){while(--_0x31d3a9){_0x3ee21e['push'](_0x3ee21e['shift']());}};_0x10755a(++_0x5cf64c);}(_0x9318,0x80));var _0x8931=function(_0x28191a,_0x374ff5){_0x28191a=_0x28191a-0x0;var _0x3402ee=_0x9318[_0x28191a];return _0x3402ee;};'use strict';var Sequelize=require(_0x8931('0x0'));var moment=require(_0x8931('0x1'));module['exports']={'state':{'type':Sequelize[_0x8931('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x8931('0x3')]},'scheduledat':{'type':Sequelize[_0x8931('0x4')]},'countbusyretry':{'type':Sequelize[_0x8931('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8931('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8931('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x8931('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x8931('0x3')]},'originatecalleridname':{'type':Sequelize[_0x8931('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x8931('0x3')]},'starttime':{'type':Sequelize[_0x8931('0x4')]},'responsetime':{'type':Sequelize[_0x8931('0x4')]},'answertime':{'type':Sequelize[_0x8931('0x4')]},'droptime':{'type':Sequelize[_0x8931('0x4')]},'endtime':{'type':Sequelize[_0x8931('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x8931('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x8931('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x8931('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x8931('0x3')]},'membername':{'type':Sequelize[_0x8931('0x3')]},'reason':{'type':Sequelize[_0x8931('0x3')]},'disposition':{'type':Sequelize[_0x8931('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x8931('0x3')]},'dispositionat':{'type':Sequelize[_0x8931('0x4')],'set':function(_0x4b2398){var _0x4172e8=this['getDataValue'](_0x8931('0x5'));if(_0x4172e8&&_0x4b2398){this['setDataValue'](_0x8931('0x6'),moment(_0x4b2398)[_0x8931('0x7')](moment(_0x4172e8),_0x8931('0x8')));}}},'amd':{'type':Sequelize[_0x8931('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0x8931('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x8931('0x4')]},'callback':{'type':Sequelize[_0x8931('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x8931('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x8931('0x4')]},'recallme':{'type':Sequelize[_0x8931('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x8931('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x8931('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8931('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8931('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8931('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 5733284..2162d17 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 _0x57ca=['state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','cm_hopper','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','toString','group','moveContactsIvrCampaignHopperFinal','scheduledAt','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','from','state\x20=\x204','checkContactHopper','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','CmHopperFinal','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','params','find','catch','describe','uniqueid','body','countContactsQueueCampaignHopperFinal','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`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','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','noAnswerContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','fromQuery','phone','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','cm_hopper_final','VoiceQueueId\x20=\x20?'];(function(_0x233345,_0x5dce01){var _0x575524=function(_0x39af30){while(--_0x39af30){_0x233345['push'](_0x233345['shift']());}};_0x575524(++_0x5dce01);}(_0x57ca,0x108));var _0xa57c=function(_0x5cce45,_0x3ee968){_0x5cce45=_0x5cce45-0x0;var _0x4d95b6=_0x57ca[_0x5cce45];return _0x4d95b6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa57c('0x0'));var zipdir=require(_0xa57c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa57c('0x2'));var moment=require(_0xa57c('0x3'));var BPromise=require(_0xa57c('0x4'));var Mustache=require(_0xa57c('0x5'));var util=require(_0xa57c('0x6'));var path=require('path');var sox=require(_0xa57c('0x7'));var csv=require(_0xa57c('0x8'));var ejs=require(_0xa57c('0x9'));var fs=require('fs');var fs_extra=require(_0xa57c('0xa'));var _=require(_0xa57c('0xb'));var squel=require(_0xa57c('0xc'));var crypto=require(_0xa57c('0xd'));var jsforce=require(_0xa57c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa57c('0x8'));var querystring=require('querystring');var Papa=require(_0xa57c('0xf'));var Redis=require(_0xa57c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa57c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa57c('0x12'));var logger=require(_0xa57c('0x13'))('api');var utils=require(_0xa57c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa57c('0x15'));var db=require(_0xa57c('0x16'))['db'];function respondWithStatusCode(_0x1f2bb5,_0x9e25bf){_0x9e25bf=_0x9e25bf||0xcc;return function(_0x205e72){if(_0x205e72){return _0x1f2bb5['sendStatus'](_0x9e25bf);}return _0x1f2bb5[_0xa57c('0x17')](_0x9e25bf)['end']();};}function respondWithResult(_0x30d23d,_0x3d5995){_0x3d5995=_0x3d5995||0xc8;return function(_0x30940d){if(_0x30940d){return _0x30d23d[_0xa57c('0x17')](_0x3d5995)[_0xa57c('0x18')](_0x30940d);}};}function respondWithFilteredResult(_0x37a323,_0x3f900a){return function(_0x4b4bdb){if(_0x4b4bdb){var _0x26607a=typeof _0x3f900a[_0xa57c('0x19')]===_0xa57c('0x1a')&&typeof _0x3f900a['limit']===_0xa57c('0x1a');var _0x5f33f1=_0x4b4bdb[_0xa57c('0x1b')];var _0x3d781d=_0x26607a?0x0:_0x3f900a[_0xa57c('0x19')];var _0xe3d505=_0x26607a?_0x4b4bdb[_0xa57c('0x1b')]:_0x3f900a[_0xa57c('0x19')]+_0x3f900a[_0xa57c('0x1c')];var _0x595c7a;if(_0xe3d505>=_0x5f33f1){_0xe3d505=_0x5f33f1;_0x595c7a=0xc8;}else{_0x595c7a=0xce;}_0x37a323['status'](_0x595c7a);return _0x37a323[_0xa57c('0x1d')]('Content-Range',_0x3d781d+'-'+_0xe3d505+'/'+_0x5f33f1)['json'](_0x4b4bdb);}return null;};}function patchUpdates(_0x418415){return function(_0xa5b314){try{jsonpatch[_0xa57c('0x1e')](_0xa5b314,_0x418415,!![]);}catch(_0x23bec0){return BPromise['reject'](_0x23bec0);}return _0xa5b314[_0xa57c('0x1f')]();};}function saveUpdates(_0x25715f,_0x34d1bc){return function(_0x2213b2){if(_0x2213b2){return _0x2213b2[_0xa57c('0x20')](_0x25715f)[_0xa57c('0x21')](function(_0x1e0192){return _0x1e0192;});}return null;};}function removeEntity(_0x42038e,_0x2e99ed){return function(_0xdf65dd){if(_0xdf65dd){return _0xdf65dd[_0xa57c('0x22')]()[_0xa57c('0x21')](function(){_0x42038e[_0xa57c('0x17')](0xcc)[_0xa57c('0x23')]();});}};}function handleEntityNotFound(_0x431bec,_0x511a26){return function(_0x2db443){if(!_0x2db443){_0x431bec[_0xa57c('0x24')](0x194);}return _0x2db443;};}function handleError(_0x27884d,_0x5228b9){_0x5228b9=_0x5228b9||0x1f4;return function(_0x315ad7){logger[_0xa57c('0x25')](_0x315ad7[_0xa57c('0x26')]);if(_0x315ad7[_0xa57c('0x27')]){delete _0x315ad7[_0xa57c('0x27')];}_0x27884d[_0xa57c('0x17')](_0x5228b9)['send'](_0x315ad7);};}exports[_0xa57c('0x28')]=function(_0x4c1478,_0x54a18b){var _0x257661={},_0x7d10ec={},_0x5a3e03={'count':0x0,'rows':[]};var _0x12898b=_[_0xa57c('0x29')](db[_0xa57c('0x2a')]['rawAttributes'],function(_0xd779f1){return{'name':_0xd779f1['fieldName'],'type':_0xd779f1[_0xa57c('0x2b')]['key']};});_0x7d10ec[_0xa57c('0x2c')]=_['map'](_0x12898b,_0xa57c('0x27'));_0x7d10ec['query']=_[_0xa57c('0x2d')](_0x4c1478[_0xa57c('0x2e')]);_0x7d10ec[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x7d10ec[_0xa57c('0x2c')],_0x7d10ec[_0xa57c('0x2e')]);_0x257661[_0xa57c('0x31')]=_['intersection'](_0x7d10ec[_0xa57c('0x2c')],qs['fields'](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x257661[_0xa57c('0x31')]=_0x257661['attributes'][_0xa57c('0x33')]?_0x257661['attributes']:_0x7d10ec[_0xa57c('0x2c')];if(!_0x4c1478['query'][_0xa57c('0x34')]('nolimit')){_0x257661[_0xa57c('0x1c')]=qs[_0xa57c('0x1c')](_0x4c1478['query'][_0xa57c('0x1c')]);_0x257661['offset']=qs[_0xa57c('0x19')](_0x4c1478['query'][_0xa57c('0x19')]);}_0x257661[_0xa57c('0x35')]=qs[_0xa57c('0x36')](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x36')]);_0x257661[_0xa57c('0x37')]=qs['filters'](_['pick'](_0x4c1478[_0xa57c('0x2e')],_0x7d10ec[_0xa57c('0x2f')]),_0x12898b);if(_0x4c1478[_0xa57c('0x2e')]['filter']){_0x257661[_0xa57c('0x37')]=_['merge'](_0x257661[_0xa57c('0x37')],{'$or':_[_0xa57c('0x29')](_0x12898b,function(_0x5c8256){if(_0x5c8256['type']!=='VIRTUAL'){var _0x3be888={};_0x3be888[_0x5c8256[_0xa57c('0x27')]]={'$like':'%'+_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x38')]+'%'};return _0x3be888;}})});}_0x257661=_[_0xa57c('0x39')]({},_0x257661,_0x4c1478[_0xa57c('0x3a')]);var _0x5a444a={'where':_0x257661[_0xa57c('0x37')]};return db[_0xa57c('0x2a')]['count'](_0x5a444a)['then'](function(_0x5e10b){_0x5a3e03[_0xa57c('0x1b')]=_0x5e10b;if(_0x4c1478['query'][_0xa57c('0x3b')]){_0x257661[_0xa57c('0x3c')]=[{'all':!![]}];}return db[_0xa57c('0x2a')][_0xa57c('0x3d')](_0x257661);})[_0xa57c('0x21')](function(_0x43c1d7){_0x5a3e03['rows']=_0x43c1d7;return _0x5a3e03;})[_0xa57c('0x21')](respondWithFilteredResult(_0x54a18b,_0x257661))['catch'](handleError(_0x54a18b,null));};exports['show']=function(_0x5b3300,_0x520383){var _0x588199={'raw':!![],'where':{'id':_0x5b3300[_0xa57c('0x3e')]['id']}},_0x39b20f={};_0x39b20f[_0xa57c('0x2c')]=_['keys'](db['CmHopperFinal']['rawAttributes']);_0x39b20f[_0xa57c('0x2e')]=_[_0xa57c('0x2d')](_0x5b3300[_0xa57c('0x2e')]);_0x39b20f[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],_0x39b20f['query']);_0x588199[_0xa57c('0x31')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],qs[_0xa57c('0x32')](_0x5b3300[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x588199['attributes']=_0x588199[_0xa57c('0x31')][_0xa57c('0x33')]?_0x588199[_0xa57c('0x31')]:_0x39b20f[_0xa57c('0x2c')];if(_0x5b3300[_0xa57c('0x2e')]['includeAll']){_0x588199[_0xa57c('0x3c')]=[{'all':!![]}];}_0x588199=_[_0xa57c('0x39')]({},_0x588199,_0x5b3300[_0xa57c('0x3a')]);return db[_0xa57c('0x2a')][_0xa57c('0x3f')](_0x588199)[_0xa57c('0x21')](handleEntityNotFound(_0x520383,null))['then'](respondWithResult(_0x520383,null))[_0xa57c('0x40')](handleError(_0x520383,null));};exports[_0xa57c('0x41')]=function(_0x247906,_0x44ea0a){return db[_0xa57c('0x2a')][_0xa57c('0x41')]()['then'](respondWithResult(_0x44ea0a,null))['catch'](handleError(_0x44ea0a,null));};exports['update']=function(_0x5082ef,_0x232675){if(_0x5082ef['body'][_0xa57c('0x42')]){delete _0x5082ef[_0xa57c('0x43')]['uniqueid'];}return db[_0xa57c('0x2a')][_0xa57c('0x3f')]({'where':{'uniqueid':_0x5082ef[_0xa57c('0x3e')]['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x232675,null))[_0xa57c('0x21')](saveUpdates(_0x5082ef['body'],null))[_0xa57c('0x21')](respondWithResult(_0x232675,null))[_0xa57c('0x40')](handleError(_0x232675,null));};exports[_0xa57c('0x44')]=function(_0xd57bac,_0x2e4b84,_0x5ace6d){return db[_0xa57c('0x2a')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0xd57bac['params']['id']},'attributes':[[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db[_0xa57c('0x45')]['fn']('IF',db['sequelize']['literal'](_0xa57c('0x47')))),_0xa57c('0x48')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db['sequelize']['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x4a')))),'noAnswerContacts'],[db['sequelize']['fn'](_0xa57c('0x46'),db[_0xa57c('0x45')]['fn']('IF',db['sequelize'][_0xa57c('0x49')](_0xa57c('0x4b')))),_0xa57c('0x4c')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db[_0xa57c('0x45')]['fn']('IF',db[_0xa57c('0x45')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0xa57c('0x4d')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db[_0xa57c('0x45')]['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x4e')))),_0xa57c('0x4f')],[db['sequelize']['fn']('COUNT',db[_0xa57c('0x45')]['fn']('IF',db['sequelize'][_0xa57c('0x49')](_0xa57c('0x50')))),_0xa57c('0x51')],[db['sequelize']['fn'](_0xa57c('0x46'),db['sequelize']['fn']('IF',db[_0xa57c('0x45')]['literal'](_0xa57c('0x52')))),_0xa57c('0x53')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db['sequelize']['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x54')))),_0xa57c('0x55')]]})[_0xa57c('0x21')](handleEntityNotFound(_0x2e4b84,null))['then'](respondWithResult(_0x2e4b84,null))[_0xa57c('0x40')](handleError(_0x2e4b84,null));};exports[_0xa57c('0x56')]=function(_0x1899ad,_0xb19d93,_0x2adcf6){return db[_0xa57c('0x2a')][_0xa57c('0x3d')]({'raw':![],'where':{'CampaignId':_0x1899ad[_0xa57c('0x3e')]['id']},'attributes':[[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db['sequelize']['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x47')))),_0xa57c('0x48')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db['sequelize']['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')]('`state`\x20=\x203,\x201,\x20null'))),_0xa57c('0x57')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db[_0xa57c('0x45')]['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x4b')))),'busyContacts'],[db[_0xa57c('0x45')]['fn']('COUNT',db[_0xa57c('0x45')]['fn']('IF',db['sequelize'][_0xa57c('0x49')]('`state`\x20=\x208,\x201,\x20null'))),_0xa57c('0x4d')],[db[_0xa57c('0x45')]['fn']('COUNT',db[_0xa57c('0x45')]['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x4e')))),'dropContacts'],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db[_0xa57c('0x45')]['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x50')))),_0xa57c('0x51')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db[_0xa57c('0x45')]['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x52')))),_0xa57c('0x53')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db['sequelize']['fn']('IF',db[_0xa57c('0x45')]['literal'](_0xa57c('0x54')))),_0xa57c('0x55')]]})[_0xa57c('0x21')](handleEntityNotFound(_0xb19d93,null))['then'](respondWithResult(_0xb19d93,null))[_0xa57c('0x40')](handleError(_0xb19d93,null));};exports[_0xa57c('0x58')]=function(_0x1be631,_0x47e3d5,_0x571e10){return db[_0xa57c('0x59')][_0xa57c('0x3f')]({'where':{'id':_0x1be631[_0xa57c('0x3e')]['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x47e3d5,null))[_0xa57c('0x21')](function(_0x39411b){var _0x2a7aab;if(_0x39411b){_0x2a7aab=squel[_0xa57c('0x5a')]()[_0xa57c('0x5b')]('cm_hopper')[_0xa57c('0x5c')]([_0xa57c('0x5d'),'scheduledAt',_0xa57c('0x5e'),_0xa57c('0x5f'),_0xa57c('0x60'),_0xa57c('0x61'),_0xa57c('0x62')],squel[_0xa57c('0x63')]()[_0xa57c('0x64')](_0xa57c('0x65'),'phone')[_0xa57c('0x64')](_0xa57c('0x66'),'scheduledAt')[_0xa57c('0x64')](_0xa57c('0x67'),'ContactId')['field'](_0xa57c('0x68'),_0xa57c('0x5f'))[_0xa57c('0x64')](_0xa57c('0x69'),_0xa57c('0x60'))['field'](_0xa57c('0x66'),_0xa57c('0x61'))[_0xa57c('0x64')]('NOW()',_0xa57c('0x62'))['from'](_0xa57c('0x6a'))[_0xa57c('0x37')](_0xa57c('0x6b'),_0x1be631[_0xa57c('0x3e')]['id']['toString']())[_0xa57c('0x37')](_0xa57c('0x6c'),_0x1be631[_0xa57c('0x43')][_0xa57c('0x6d')]['toString']())[_0xa57c('0x37')](_0xa57c('0x6e'))[_0xa57c('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xa57c('0x63')]()[_0xa57c('0x64')](_0xa57c('0x5d'))['from'](_0xa57c('0x6f'))[_0xa57c('0x37')](_0xa57c('0x6b'),_0x1be631[_0xa57c('0x3e')]['id']['toString']()))[_0xa57c('0x37')](_0xa57c('0x70'),squel['select']()[_0xa57c('0x64')](_0xa57c('0x71'))['from'](_0xa57c('0x6a'))['where'](_0xa57c('0x6b'),_0x1be631[_0xa57c('0x3e')]['id'][_0xa57c('0x72')]())[_0xa57c('0x37')]('state\x20=\x204'))[_0xa57c('0x73')](_0xa57c('0x5e')))[_0xa57c('0x72')]();return db[_0xa57c('0x45')][_0xa57c('0x2e')](_0x2a7aab);}return[];})[_0xa57c('0x21')](respondWithResult(_0x47e3d5,null))[_0xa57c('0x40')](handleError(_0x47e3d5,null));};exports[_0xa57c('0x74')]=function(_0x1129f,_0x2c4e6c,_0x46dbb1){return db['Campaign']['find']({'where':{'id':_0x1129f['params']['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x2c4e6c,null))['then'](function(_0x43c430){var _0x442dc7;if(_0x43c430){_0x442dc7=squel[_0xa57c('0x5a')]()['into'](_0xa57c('0x6f'))[_0xa57c('0x5c')]([_0xa57c('0x5d'),_0xa57c('0x75'),_0xa57c('0x5e'),_0xa57c('0x5f'),_0xa57c('0x76'),'createdAt',_0xa57c('0x62')],squel[_0xa57c('0x63')]()['field']('ANY_VALUE(calleridnum)',_0xa57c('0x5d'))[_0xa57c('0x64')]('NOW()','scheduledAt')[_0xa57c('0x64')]('ANY_VALUE(ContactId)',_0xa57c('0x5e'))[_0xa57c('0x64')]('ANY_VALUE(ListId)',_0xa57c('0x5f'))[_0xa57c('0x64')](_0xa57c('0x77'),_0xa57c('0x76'))[_0xa57c('0x64')]('NOW()',_0xa57c('0x61'))['field'](_0xa57c('0x66'),_0xa57c('0x62'))['from']('cm_hopper_final')['where'](_0xa57c('0x78'),_0x1129f['params']['id']['toString']())[_0xa57c('0x37')](_0xa57c('0x6c'),_0x1129f[_0xa57c('0x43')]['state'][_0xa57c('0x72')]())[_0xa57c('0x37')](_0xa57c('0x6e'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xa57c('0x63')]()['field'](_0xa57c('0x5d'))[_0xa57c('0x79')]('cm_hopper')[_0xa57c('0x37')]('CampaignId\x20=\x20?',_0x1129f['params']['id']['toString']()))[_0xa57c('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0xa57c('0x71'))[_0xa57c('0x79')]('cm_hopper_final')[_0xa57c('0x37')](_0xa57c('0x78'),_0x1129f[_0xa57c('0x3e')]['id']['toString']())[_0xa57c('0x37')](_0xa57c('0x7a')))[_0xa57c('0x73')](_0xa57c('0x5e')))['toString']();return db['sequelize'][_0xa57c('0x2e')](_0x442dc7);}return[];})['then'](respondWithResult(_0x2c4e6c,null))[_0xa57c('0x40')](handleError(_0x2c4e6c,null));};exports[_0xa57c('0x7b')]=function(_0x2cc12b,_0x4dc6ac,_0x138c4e){return db['CmHopper']['findOne']({'where':{'VoiceQueueId':_0x2cc12b[_0xa57c('0x43')]['VoiceQueueId'],'CampaignId':_0x2cc12b[_0xa57c('0x43')][_0xa57c('0x76')],'ContactId':_0x2cc12b['body']['ContactId']}})[_0xa57c('0x21')](handleEntityNotFound(_0x4dc6ac,null))[_0xa57c('0x21')](function(_0x50a940){if(_0x50a940){return _0x50a940;}return null;})['then'](respondWithResult(_0x4dc6ac,null))[_0xa57c('0x40')](handleError(_0x4dc6ac,null));}; \ No newline at end of file +var _0x5d58=['calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','fromQuery','CampaignId','ANY_VALUE(CampaignId)','cm_hopper_final','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../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','CmHopperFinal','include','findAll','rows','show','params','rawAttributes','keys','length','includeAll','merge','describe','catch','body','find','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)'];(function(_0x27bcb2,_0x412da4){var _0xef0f33=function(_0x248910){while(--_0x248910){_0x27bcb2['push'](_0x27bcb2['shift']());}};_0xef0f33(++_0x412da4);}(_0x5d58,0x187));var _0x85d5=function(_0xee936d,_0x58cfce){_0xee936d=_0xee936d-0x0;var _0x3aaffd=_0x5d58[_0xee936d];return _0x3aaffd;};'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['CmHopperFinal']['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['CmHopperFinal'][_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')]()['then'](respondWithResult(_0x12a03,null))[_0x85d5('0x40')](handleError(_0x12a03,null));};exports['update']=function(_0x1f2ef9,_0xd8db57){if(_0x1f2ef9[_0x85d5('0x41')]['uniqueid']){delete _0x1f2ef9['body']['uniqueid'];}return db[_0x85d5('0x34')][_0x85d5('0x42')]({'where':{'uniqueid':_0x1f2ef9[_0x85d5('0x39')]['id']}})['then'](handleEntityNotFound(_0xd8db57,null))['then'](saveUpdates(_0x1f2ef9[_0x85d5('0x41')],null))[_0x85d5('0x1c')](respondWithResult(_0xd8db57,null))[_0x85d5('0x40')](handleError(_0xd8db57,null));};exports[_0x85d5('0x43')]=function(_0x4b2dce,_0x3f69ea,_0x29442a){return db[_0x85d5('0x34')][_0x85d5('0x36')]({'raw':![],'where':{'VoiceQueueId':_0x4b2dce[_0x85d5('0x39')]['id']},'attributes':[[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')](_0x85d5('0x47')))),_0x85d5('0x48')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db['sequelize'][_0x85d5('0x46')](_0x85d5('0x49')))),_0x85d5('0x4a')],[db[_0x85d5('0x44')]['fn']('COUNT',db[_0x85d5('0x44')]['fn']('IF',db['sequelize'][_0x85d5('0x46')](_0x85d5('0x4b')))),_0x85d5('0x4c')],[db[_0x85d5('0x44')]['fn']('COUNT',db[_0x85d5('0x44')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x208,\x201,\x20null'))),_0x85d5('0x4d')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x85d5('0x4e')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db['sequelize'][_0x85d5('0x46')](_0x85d5('0x4f')))),_0x85d5('0x50')],[db['sequelize']['fn']('COUNT',db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')]('`state`\x20=\x2022,\x201,\x20null'))),_0x85d5('0x51')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db['sequelize'][_0x85d5('0x46')](_0x85d5('0x52')))),_0x85d5('0x53')]]})['then'](handleEntityNotFound(_0x3f69ea,null))[_0x85d5('0x1c')](respondWithResult(_0x3f69ea,null))[_0x85d5('0x40')](handleError(_0x3f69ea,null));};exports[_0x85d5('0x54')]=function(_0x561bde,_0x34aa42,_0x1c3e2c){return db['CmHopperFinal'][_0x85d5('0x36')]({'raw':![],'where':{'CampaignId':_0x561bde['params']['id']},'attributes':[[db[_0x85d5('0x44')]['fn']('COUNT',db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')](_0x85d5('0x47')))),'noSuchContacts'],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')](_0x85d5('0x49')))),_0x85d5('0x4a')],[db[_0x85d5('0x44')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x85d5('0x44')]['literal'](_0x85d5('0x4b')))),_0x85d5('0x4c')],[db['sequelize']['fn']('COUNT',db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')]('`state`\x20=\x208,\x201,\x20null'))),_0x85d5('0x4d')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db['sequelize']['literal'](_0x85d5('0x55')))),'dropContacts'],[db['sequelize']['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x85d5('0x50')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db['sequelize']['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')](_0x85d5('0x56')))),_0x85d5('0x51')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0x85d5('0x53')]]})[_0x85d5('0x1c')](handleEntityNotFound(_0x34aa42,null))[_0x85d5('0x1c')](respondWithResult(_0x34aa42,null))['catch'](handleError(_0x34aa42,null));};exports[_0x85d5('0x57')]=function(_0x1fdefb,_0x496586,_0x2dbd18){return db[_0x85d5('0x58')][_0x85d5('0x42')]({'where':{'id':_0x1fdefb[_0x85d5('0x39')]['id']}})[_0x85d5('0x1c')](handleEntityNotFound(_0x496586,null))['then'](function(_0x35ba15){var _0x1b96eb;if(_0x35ba15){_0x1b96eb=squel[_0x85d5('0x59')]()[_0x85d5('0x5a')](_0x85d5('0x5b'))['fromQuery']([_0x85d5('0x5c'),_0x85d5('0x5d'),_0x85d5('0x5e'),_0x85d5('0x5f'),_0x85d5('0x60'),_0x85d5('0x61'),_0x85d5('0x62')],squel[_0x85d5('0x63')]()[_0x85d5('0x64')](_0x85d5('0x65'),'phone')[_0x85d5('0x64')](_0x85d5('0x66'),_0x85d5('0x5d'))[_0x85d5('0x64')](_0x85d5('0x67'),_0x85d5('0x5e'))['field'](_0x85d5('0x68'),'ListId')['field'](_0x85d5('0x69'),_0x85d5('0x60'))[_0x85d5('0x64')](_0x85d5('0x66'),_0x85d5('0x61'))[_0x85d5('0x64')](_0x85d5('0x66'),_0x85d5('0x62'))[_0x85d5('0x6a')]('cm_hopper_final')[_0x85d5('0x30')](_0x85d5('0x6b'),_0x1fdefb[_0x85d5('0x39')]['id'][_0x85d5('0x6c')]())[_0x85d5('0x30')](_0x85d5('0x6d'),_0x1fdefb[_0x85d5('0x41')][_0x85d5('0x6e')][_0x85d5('0x6c')]())[_0x85d5('0x30')](_0x85d5('0x6f'))[_0x85d5('0x30')](_0x85d5('0x70'),squel[_0x85d5('0x63')]()[_0x85d5('0x64')]('phone')['from'](_0x85d5('0x5b'))['where'](_0x85d5('0x6b'),_0x1fdefb[_0x85d5('0x39')]['id'][_0x85d5('0x6c')]()))[_0x85d5('0x30')](_0x85d5('0x70'),squel[_0x85d5('0x63')]()[_0x85d5('0x64')](_0x85d5('0x71'))[_0x85d5('0x6a')]('cm_hopper_final')[_0x85d5('0x30')](_0x85d5('0x6b'),_0x1fdefb['params']['id'][_0x85d5('0x6c')]())['where'](_0x85d5('0x72')))[_0x85d5('0x73')](_0x85d5('0x5e')))[_0x85d5('0x6c')]();return db['sequelize'][_0x85d5('0x27')](_0x1b96eb);}return[];})[_0x85d5('0x1c')](respondWithResult(_0x496586,null))['catch'](handleError(_0x496586,null));};exports[_0x85d5('0x74')]=function(_0x14e4e8,_0x57f26b,_0x45b1e2){return db[_0x85d5('0x75')][_0x85d5('0x42')]({'where':{'id':_0x14e4e8['params']['id']}})[_0x85d5('0x1c')](handleEntityNotFound(_0x57f26b,null))[_0x85d5('0x1c')](function(_0x2dacf7){var _0x387a3b;if(_0x2dacf7){_0x387a3b=squel[_0x85d5('0x59')]()[_0x85d5('0x5a')]('cm_hopper')[_0x85d5('0x76')]([_0x85d5('0x5c'),'scheduledAt',_0x85d5('0x5e'),'ListId',_0x85d5('0x77'),_0x85d5('0x61'),_0x85d5('0x62')],squel['select']()[_0x85d5('0x64')](_0x85d5('0x65'),_0x85d5('0x5c'))[_0x85d5('0x64')](_0x85d5('0x66'),'scheduledAt')[_0x85d5('0x64')](_0x85d5('0x67'),_0x85d5('0x5e'))[_0x85d5('0x64')]('ANY_VALUE(ListId)',_0x85d5('0x5f'))[_0x85d5('0x64')](_0x85d5('0x78'),'CampaignId')[_0x85d5('0x64')]('NOW()',_0x85d5('0x61'))[_0x85d5('0x64')]('NOW()','updatedAt')[_0x85d5('0x6a')](_0x85d5('0x79'))[_0x85d5('0x30')](_0x85d5('0x7a'),_0x14e4e8[_0x85d5('0x39')]['id'][_0x85d5('0x6c')]())[_0x85d5('0x30')](_0x85d5('0x6d'),_0x14e4e8['body'][_0x85d5('0x6e')][_0x85d5('0x6c')]())[_0x85d5('0x30')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x85d5('0x30')](_0x85d5('0x70'),squel['select']()[_0x85d5('0x64')](_0x85d5('0x5c'))[_0x85d5('0x6a')](_0x85d5('0x5b'))[_0x85d5('0x30')](_0x85d5('0x7a'),_0x14e4e8[_0x85d5('0x39')]['id']['toString']()))[_0x85d5('0x30')](_0x85d5('0x70'),squel[_0x85d5('0x63')]()[_0x85d5('0x64')]('calleridnum')[_0x85d5('0x6a')](_0x85d5('0x79'))[_0x85d5('0x30')](_0x85d5('0x7a'),_0x14e4e8[_0x85d5('0x39')]['id']['toString']())['where'](_0x85d5('0x72')))['group'](_0x85d5('0x5e')))[_0x85d5('0x6c')]();return db[_0x85d5('0x44')][_0x85d5('0x27')](_0x387a3b);}return[];})[_0x85d5('0x1c')](respondWithResult(_0x57f26b,null))[_0x85d5('0x40')](handleError(_0x57f26b,null));};exports[_0x85d5('0x7b')]=function(_0x48553d,_0xedb32d,_0x5366bc){return db[_0x85d5('0x7c')][_0x85d5('0x7d')]({'where':{'VoiceQueueId':_0x48553d[_0x85d5('0x41')]['VoiceQueueId'],'CampaignId':_0x48553d[_0x85d5('0x41')][_0x85d5('0x77')],'ContactId':_0x48553d[_0x85d5('0x41')]['ContactId']}})['then'](handleEntityNotFound(_0xedb32d,null))[_0x85d5('0x1c')](function(_0x428fd4){if(_0x428fd4){return _0x428fd4;}return null;})['then'](respondWithResult(_0xedb32d,null))[_0x85d5('0x40')](handleError(_0xedb32d,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 7a73357..373e74c 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 _0x9622=['../../config/environment','./cmHopperFinal.attributes','exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xc048e2,_0x3825ef){var _0x4012ed=function(_0x40740b){while(--_0x40740b){_0xc048e2['push'](_0xc048e2['shift']());}};_0x4012ed(++_0x3825ef);}(_0x9622,0xd9));var _0x2962=function(_0x5c9f56,_0x42c9ad){_0x5c9f56=_0x5c9f56-0x0;var _0x2a726b=_0x9622[_0x5c9f56];return _0x2a726b;};'use strict';var _=require(_0x2962('0x0'));var util=require(_0x2962('0x1'));var logger=require('../../config/logger')(_0x2962('0x2'));var moment=require(_0x2962('0x3'));var BPromise=require(_0x2962('0x4'));var rp=require(_0x2962('0x5'));var fs=require('fs');var path=require(_0x2962('0x6'));var rimraf=require(_0x2962('0x7'));var config=require(_0x2962('0x8'));var attributes=require(_0x2962('0x9'));module[_0x2962('0xa')]=function(_0x11f4e2,_0xf9d0b3){return _0x11f4e2['define'](_0x2962('0xb'),attributes,{'tableName':_0x2962('0xc'),'paranoid':![],'indexes':[{'name':_0x2962('0xd'),'fields':['calleridnum']},{'name':_0x2962('0xe'),'fields':[_0x2962('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6736=['./cmHopperFinal.attributes','define','cm_hopper_final','calleridnum','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5e3296,_0x3f2454){var _0x457bc6=function(_0x563b5c){while(--_0x563b5c){_0x5e3296['push'](_0x5e3296['shift']());}};_0x457bc6(++_0x3f2454);}(_0x6736,0x9f));var _0x6673=function(_0x17dd55,_0x36f813){_0x17dd55=_0x17dd55-0x0;var _0x70acf8=_0x6736[_0x17dd55];return _0x70acf8;};'use strict';var _=require('lodash');var util=require(_0x6673('0x0'));var logger=require(_0x6673('0x1'))(_0x6673('0x2'));var moment=require(_0x6673('0x3'));var BPromise=require(_0x6673('0x4'));var rp=require(_0x6673('0x5'));var fs=require('fs');var path=require(_0x6673('0x6'));var rimraf=require(_0x6673('0x7'));var config=require(_0x6673('0x8'));var attributes=require(_0x6673('0x9'));module['exports']=function(_0x38723f,_0x483700){return _0x38723f[_0x6673('0xa')]('CmHopperFinal',attributes,{'tableName':_0x6673('0xb'),'paranoid':![],'indexes':[{'name':_0x6673('0xc'),'fields':['calleridnum']},{'name':_0x6673('0xd'),'fields':[_0x6673('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 6e12e6f..d5b3525 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(_0x1a3632,_0x27f4c4){var _0xe60bab=function(_0x56b11d){while(--_0x56b11d){_0x1a3632['push'](_0x1a3632['shift']());}};_0xe60bab(++_0x27f4c4);}(_0xb10b,0x12a));var _0xbb10=function(_0x5afa42,_0x30a006){_0x5afa42=_0x5afa42-0x0;var _0x10e567=_0xb10b[_0x5afa42];return _0x10e567;};'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(_0x4fe684,_0x3b6019){var _0x2c1667=function(_0x8c92ae){while(--_0x8c92ae){_0x4fe684['push'](_0x4fe684['shift']());}};_0x2c1667(++_0x3b6019);}(_0xb10b,0x12a));var _0xbb10=function(_0x15942a,_0x13b58c){_0x15942a=_0x15942a-0x0;var _0x36a9fb=_0xb10b[_0x15942a];return _0x36a9fb;};'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 56baeba..ea7c5a6 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 _0xb1b9=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','/:id','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','util'];(function(_0x2f9700,_0x55f4cf){var _0x5256f8=function(_0xf76a21){while(--_0xf76a21){_0x2f9700['push'](_0x2f9700['shift']());}};_0x5256f8(++_0x55f4cf);}(_0xb1b9,0x186));var _0x9b1b=function(_0x2bb9fc,_0x2efe5b){_0x2bb9fc=_0x2bb9fc-0x0;var _0x561667=_0xb1b9[_0x2bb9fc];return _0x561667;};'use strict';var multer=require('multer');var util=require(_0x9b1b('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9b1b('0x1'));var router=express[_0x9b1b('0x2')]();var fs_extra=require(_0x9b1b('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9b1b('0x4'));var config=require(_0x9b1b('0x5'));var controller=require(_0x9b1b('0x6'));router[_0x9b1b('0x7')]('/',auth[_0x9b1b('0x8')](),controller[_0x9b1b('0x9')]);router[_0x9b1b('0x7')](_0x9b1b('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x9b1b('0x7')](_0x9b1b('0xb'),auth[_0x9b1b('0x8')](),controller[_0x9b1b('0xc')]);router[_0x9b1b('0x7')]('/voice/queue/countAttributes/:id',auth['isAuthenticated'](),controller[_0x9b1b('0xd')]);router[_0x9b1b('0x7')](_0x9b1b('0xe'),auth[_0x9b1b('0x8')](),controller[_0x9b1b('0xf')]);router[_0x9b1b('0x10')]('/voice/queue/moveContacts/:id',auth[_0x9b1b('0x8')](),controller[_0x9b1b('0x11')]);router[_0x9b1b('0x10')]('/voice/campaign/moveContacts/:id',auth[_0x9b1b('0x8')](),controller[_0x9b1b('0x12')]);router[_0x9b1b('0x10')](_0x9b1b('0x13'),auth[_0x9b1b('0x8')](),controller[_0x9b1b('0x14')]);router[_0x9b1b('0x15')](_0x9b1b('0xb'),auth[_0x9b1b('0x8')](),controller[_0x9b1b('0x16')]);module['exports']=router; \ No newline at end of file +var _0xb2ed=['countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','checkContactHopper','put','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','index','get','describe','show','countContactsQueueCampaignHopperFinal'];(function(_0x3357b8,_0xeb406){var _0x50737a=function(_0x43a94b){while(--_0x43a94b){_0x3357b8['push'](_0x3357b8['shift']());}};_0x50737a(++_0xeb406);}(_0xb2ed,0x86));var _0xdb2e=function(_0x587fb5,_0x59cb3b){_0x587fb5=_0x587fb5-0x0;var _0x551105=_0xb2ed[_0x587fb5];return _0x551105;};'use strict';var multer=require(_0xdb2e('0x0'));var util=require(_0xdb2e('0x1'));var path=require('path');var timeout=require(_0xdb2e('0x2'));var express=require(_0xdb2e('0x3'));var router=express[_0xdb2e('0x4')]();var fs_extra=require(_0xdb2e('0x5'));var auth=require(_0xdb2e('0x6'));var interaction=require(_0xdb2e('0x7'));var config=require(_0xdb2e('0x8'));var controller=require(_0xdb2e('0x9'));router['get']('/',auth[_0xdb2e('0xa')](),controller[_0xdb2e('0xb')]);router[_0xdb2e('0xc')]('/describe',auth['isAuthenticated'](),controller[_0xdb2e('0xd')]);router[_0xdb2e('0xc')]('/:id',auth[_0xdb2e('0xa')](),controller[_0xdb2e('0xe')]);router['get']('/voice/queue/countAttributes/:id',auth[_0xdb2e('0xa')](),controller[_0xdb2e('0xf')]);router['get']('/campaign/countAttributes/:id',auth['isAuthenticated'](),controller[_0xdb2e('0x10')]);router[_0xdb2e('0x11')]('/voice/queue/moveContacts/:id',auth[_0xdb2e('0xa')](),controller[_0xdb2e('0x12')]);router[_0xdb2e('0x11')](_0xdb2e('0x13'),auth[_0xdb2e('0xa')](),controller[_0xdb2e('0x14')]);router['post']('/checkContactHopper',auth[_0xdb2e('0xa')](),controller[_0xdb2e('0x15')]);router[_0xdb2e('0x16')]('/:id',auth[_0xdb2e('0xa')](),controller[_0xdb2e('0x17')]);module[_0xdb2e('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index c9b1e49..d70264e 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 _0x0aa1=['STRING','BOOLEAN','sequelize','INTEGER','DATE'];(function(_0x58999b,_0xea4695){var _0x5efc3a=function(_0x98de31){while(--_0x98de31){_0x58999b['push'](_0x58999b['shift']());}};_0x5efc3a(++_0xea4695);}(_0x0aa1,0x129));var _0x10aa=function(_0x14f865,_0x8801d5){_0x14f865=_0x14f865-0x0;var _0x5d68bc=_0x0aa1[_0x14f865];return _0x5d68bc;};'use strict';var Sequelize=require(_0x10aa('0x0'));module['exports']={'state':{'type':Sequelize[_0x10aa('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x10aa('0x2')]},'countbusyretry':{'type':Sequelize[_0x10aa('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x10aa('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x10aa('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x10aa('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x10aa('0x3')]},'originatecalleridname':{'type':Sequelize[_0x10aa('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x10aa('0x2')]},'responsetime':{'type':Sequelize[_0x10aa('0x2')]},'answertime':{'type':Sequelize[_0x10aa('0x2')]},'droptime':{'type':Sequelize[_0x10aa('0x2')]},'endtime':{'type':Sequelize[_0x10aa('0x2')]},'ringtime':{'type':Sequelize[_0x10aa('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x10aa('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x10aa('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x10aa('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x10aa('0x3')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x10aa('0x4')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x10aa('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x10aa('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x10aa('0x2')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x10aa('0x2')]},'edited':{'type':Sequelize[_0x10aa('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x10aa('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x10aa('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x10aa('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x10aa('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x10aa('0x3')]}}; \ No newline at end of file +var _0x16a8=['sequelize','INTEGER','STRING','DATE','BOOLEAN'];(function(_0xce5f67,_0x505608){var _0x59e21e=function(_0x285028){while(--_0x285028){_0xce5f67['push'](_0xce5f67['shift']());}};_0x59e21e(++_0x505608);}(_0x16a8,0xb4));var _0x816a=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x16a8[_0x618414];return _0x21c19a;};'use strict';var Sequelize=require(_0x816a('0x0'));module['exports']={'state':{'type':Sequelize[_0x816a('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x816a('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x816a('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x816a('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x816a('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x816a('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x816a('0x2')]},'originatecalleridname':{'type':Sequelize[_0x816a('0x2')]},'calleridnum':{'type':Sequelize[_0x816a('0x2')]},'calleridname':{'type':Sequelize[_0x816a('0x2')]},'starttime':{'type':Sequelize[_0x816a('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x816a('0x3')]},'droptime':{'type':Sequelize[_0x816a('0x3')]},'endtime':{'type':Sequelize[_0x816a('0x3')]},'ringtime':{'type':Sequelize[_0x816a('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x816a('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x816a('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x816a('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x816a('0x2')]},'campaign':{'type':Sequelize[_0x816a('0x2')]},'campaigntype':{'type':Sequelize[_0x816a('0x2')]},'membername':{'type':Sequelize[_0x816a('0x2')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x816a('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x816a('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x816a('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x816a('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x816a('0x3')]},'edited':{'type':Sequelize[_0x816a('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x816a('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x816a('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x816a('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x816a('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x816a('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x816a('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 315b66d..892331b 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 _0x4d57=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','count','set','Content-Range','save','update','destroy','then','status','error','stack','name','send','CmHopperHistory','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','rows','catch','find','create','body','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service'];(function(_0x2f7ee1,_0x238541){var _0x298295=function(_0x124360){while(--_0x124360){_0x2f7ee1['push'](_0x2f7ee1['shift']());}};_0x298295(++_0x238541);}(_0x4d57,0x1a1));var _0x74d5=function(_0x276eb8,_0x177e0e){_0x276eb8=_0x276eb8-0x0;var _0x48d9b4=_0x4d57[_0x276eb8];return _0x48d9b4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x74d5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x74d5('0x1'));var rp=require(_0x74d5('0x2'));var moment=require(_0x74d5('0x3'));var BPromise=require(_0x74d5('0x4'));var Mustache=require(_0x74d5('0x5'));var util=require('util');var path=require(_0x74d5('0x6'));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(_0x74d5('0x7'));var squel=require('squel');var crypto=require(_0x74d5('0x8'));var jsforce=require(_0x74d5('0x9'));var deskjs=require(_0x74d5('0xa'));var toCsv=require(_0x74d5('0xb'));var querystring=require(_0x74d5('0xc'));var Papa=require('papaparse');var Redis=require(_0x74d5('0xd'));var authService=require(_0x74d5('0xe'));var qs=require(_0x74d5('0xf'));var as=require(_0x74d5('0x10'));var hardwareService=require(_0x74d5('0x11'));var logger=require(_0x74d5('0x12'))(_0x74d5('0x13'));var utils=require(_0x74d5('0x14'));var config=require(_0x74d5('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x74d5('0x16'))['db'];function respondWithStatusCode(_0x436be9,_0x45e0b8){_0x45e0b8=_0x45e0b8||0xcc;return function(_0x3b4f2f){if(_0x3b4f2f){return _0x436be9[_0x74d5('0x17')](_0x45e0b8);}return _0x436be9['status'](_0x45e0b8)[_0x74d5('0x18')]();};}function respondWithResult(_0x113193,_0x54b401){_0x54b401=_0x54b401||0xc8;return function(_0x50263f){if(_0x50263f){return _0x113193['status'](_0x54b401)[_0x74d5('0x19')](_0x50263f);}};}function respondWithFilteredResult(_0x498f3a,_0x2c5e71){return function(_0x5e7345){if(_0x5e7345){var _0x28c2b8=typeof _0x2c5e71[_0x74d5('0x1a')]===_0x74d5('0x1b')&&typeof _0x2c5e71['limit']===_0x74d5('0x1b');var _0x537c9e=_0x5e7345['count'];var _0x20186e=_0x28c2b8?0x0:_0x2c5e71[_0x74d5('0x1a')];var _0x17b30e=_0x28c2b8?_0x5e7345[_0x74d5('0x1c')]:_0x2c5e71[_0x74d5('0x1a')]+_0x2c5e71['limit'];var _0x1a3437;if(_0x17b30e>=_0x537c9e){_0x17b30e=_0x537c9e;_0x1a3437=0xc8;}else{_0x1a3437=0xce;}_0x498f3a['status'](_0x1a3437);return _0x498f3a[_0x74d5('0x1d')](_0x74d5('0x1e'),_0x20186e+'-'+_0x17b30e+'/'+_0x537c9e)[_0x74d5('0x19')](_0x5e7345);}return null;};}function patchUpdates(_0x39cfa3){return function(_0x54d900){try{jsonpatch['apply'](_0x54d900,_0x39cfa3,!![]);}catch(_0x4823a6){return BPromise['reject'](_0x4823a6);}return _0x54d900[_0x74d5('0x1f')]();};}function saveUpdates(_0x49ac19,_0x2b7710){return function(_0x54ab4f){if(_0x54ab4f){return _0x54ab4f[_0x74d5('0x20')](_0x49ac19)['then'](function(_0x29a085){return _0x29a085;});}return null;};}function removeEntity(_0x2d1700,_0x4d9545){return function(_0x119f06){if(_0x119f06){return _0x119f06[_0x74d5('0x21')]()[_0x74d5('0x22')](function(){_0x2d1700[_0x74d5('0x23')](0xcc)[_0x74d5('0x18')]();});}};}function handleEntityNotFound(_0x1159e6,_0x43a6ce){return function(_0x4d2098){if(!_0x4d2098){_0x1159e6[_0x74d5('0x17')](0x194);}return _0x4d2098;};}function handleError(_0xbdd8ba,_0x25fd07){_0x25fd07=_0x25fd07||0x1f4;return function(_0x4d8ddc){logger[_0x74d5('0x24')](_0x4d8ddc[_0x74d5('0x25')]);if(_0x4d8ddc['name']){delete _0x4d8ddc[_0x74d5('0x26')];}_0xbdd8ba[_0x74d5('0x23')](_0x25fd07)[_0x74d5('0x27')](_0x4d8ddc);};}exports['index']=function(_0x4d19dc,_0x511845){var _0xa2d0df={},_0x1e2807={},_0x556890={'count':0x0,'rows':[]};var _0x21402c=_['map'](db[_0x74d5('0x28')][_0x74d5('0x29')],function(_0x26c5c6){return{'name':_0x26c5c6['fieldName'],'type':_0x26c5c6[_0x74d5('0x2a')][_0x74d5('0x2b')]};});_0x1e2807[_0x74d5('0x2c')]=_['map'](_0x21402c,_0x74d5('0x26'));_0x1e2807['query']=_[_0x74d5('0x2d')](_0x4d19dc[_0x74d5('0x2e')]);_0x1e2807[_0x74d5('0x2f')]=_[_0x74d5('0x30')](_0x1e2807[_0x74d5('0x2c')],_0x1e2807[_0x74d5('0x2e')]);_0xa2d0df['attributes']=_['intersection'](_0x1e2807[_0x74d5('0x2c')],qs[_0x74d5('0x31')](_0x4d19dc[_0x74d5('0x2e')][_0x74d5('0x31')]));_0xa2d0df[_0x74d5('0x32')]=_0xa2d0df[_0x74d5('0x32')][_0x74d5('0x33')]?_0xa2d0df[_0x74d5('0x32')]:_0x1e2807[_0x74d5('0x2c')];if(!_0x4d19dc[_0x74d5('0x2e')][_0x74d5('0x34')](_0x74d5('0x35'))){_0xa2d0df['limit']=qs[_0x74d5('0x36')](_0x4d19dc[_0x74d5('0x2e')][_0x74d5('0x36')]);_0xa2d0df[_0x74d5('0x1a')]=qs['offset'](_0x4d19dc[_0x74d5('0x2e')][_0x74d5('0x1a')]);}_0xa2d0df['order']=qs[_0x74d5('0x37')](_0x4d19dc['query'][_0x74d5('0x37')]);_0xa2d0df[_0x74d5('0x38')]=qs[_0x74d5('0x2f')](_[_0x74d5('0x39')](_0x4d19dc[_0x74d5('0x2e')],_0x1e2807['filters']),_0x21402c);if(_0x4d19dc['query'][_0x74d5('0x3a')]){_0xa2d0df[_0x74d5('0x38')]=_[_0x74d5('0x3b')](_0xa2d0df[_0x74d5('0x38')],{'$or':_[_0x74d5('0x3c')](_0x21402c,function(_0x29276d){if(_0x29276d[_0x74d5('0x2a')]!==_0x74d5('0x3d')){var _0x153233={};_0x153233[_0x29276d[_0x74d5('0x26')]]={'$like':'%'+_0x4d19dc[_0x74d5('0x2e')][_0x74d5('0x3a')]+'%'};return _0x153233;}})});}_0xa2d0df=_[_0x74d5('0x3b')]({},_0xa2d0df,_0x4d19dc[_0x74d5('0x3e')]);var _0x136660={'where':_0xa2d0df[_0x74d5('0x38')]};return db['CmHopperHistory'][_0x74d5('0x1c')](_0x136660)['then'](function(_0x9157e9){_0x556890[_0x74d5('0x1c')]=_0x9157e9;if(_0x4d19dc[_0x74d5('0x2e')][_0x74d5('0x3f')]){_0xa2d0df[_0x74d5('0x40')]=[{'all':!![]}];}return db[_0x74d5('0x28')]['findAll'](_0xa2d0df);})['then'](function(_0x3431da){_0x556890[_0x74d5('0x41')]=_0x3431da;return _0x556890;})['then'](respondWithFilteredResult(_0x511845,_0xa2d0df))[_0x74d5('0x42')](handleError(_0x511845,null));};exports['show']=function(_0x100e51,_0x18820c){var _0x227cd6={'raw':!![],'where':{'id':_0x100e51['params']['id']}},_0x10a086={};_0x10a086[_0x74d5('0x2c')]=_['keys'](db[_0x74d5('0x28')][_0x74d5('0x29')]);_0x10a086[_0x74d5('0x2e')]=_['keys'](_0x100e51[_0x74d5('0x2e')]);_0x10a086[_0x74d5('0x2f')]=_[_0x74d5('0x30')](_0x10a086[_0x74d5('0x2c')],_0x10a086[_0x74d5('0x2e')]);_0x227cd6[_0x74d5('0x32')]=_[_0x74d5('0x30')](_0x10a086[_0x74d5('0x2c')],qs[_0x74d5('0x31')](_0x100e51['query']['fields']));_0x227cd6[_0x74d5('0x32')]=_0x227cd6[_0x74d5('0x32')]['length']?_0x227cd6[_0x74d5('0x32')]:_0x10a086[_0x74d5('0x2c')];if(_0x100e51[_0x74d5('0x2e')][_0x74d5('0x3f')]){_0x227cd6[_0x74d5('0x40')]=[{'all':!![]}];}_0x227cd6=_[_0x74d5('0x3b')]({},_0x227cd6,_0x100e51['options']);return db['CmHopperHistory'][_0x74d5('0x43')](_0x227cd6)[_0x74d5('0x22')](handleEntityNotFound(_0x18820c,null))[_0x74d5('0x22')](respondWithResult(_0x18820c,null))[_0x74d5('0x42')](handleError(_0x18820c,null));};exports[_0x74d5('0x44')]=function(_0x1f930d,_0x2f0b04){return db[_0x74d5('0x28')][_0x74d5('0x44')](_0x1f930d[_0x74d5('0x45')],{})[_0x74d5('0x22')](respondWithResult(_0x2f0b04,0xc9))[_0x74d5('0x42')](handleError(_0x2f0b04,null));};exports[_0x74d5('0x46')]=function(_0x32a07d,_0x56d7a3){return db[_0x74d5('0x28')]['describe']()['then'](respondWithResult(_0x56d7a3,null))[_0x74d5('0x42')](handleError(_0x56d7a3,null));};exports[_0x74d5('0x20')]=function(_0x4d32dc,_0xff4688){if(_0x4d32dc[_0x74d5('0x45')][_0x74d5('0x47')]){delete _0x4d32dc[_0x74d5('0x45')][_0x74d5('0x47')];}return db['CmHopperHistory']['find']({'where':{'uniqueid':_0x4d32dc['params']['id']}})[_0x74d5('0x22')](handleEntityNotFound(_0xff4688,null))[_0x74d5('0x22')](saveUpdates(_0x4d32dc[_0x74d5('0x45')],null))['then'](respondWithResult(_0xff4688,null))[_0x74d5('0x42')](handleError(_0xff4688,null));}; \ No newline at end of file +var _0x789b=['query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','rows','catch','show','params','length','find','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','end','status','undefined','limit','count','offset','apply','reject','update','then','destroy','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','model'];(function(_0x568437,_0x2651dd){var _0x2852a4=function(_0x19d85d){while(--_0x19d85d){_0x568437['push'](_0x568437['shift']());}};_0x2852a4(++_0x2651dd);}(_0x789b,0x187));var _0xb789=function(_0xf5a75d,_0x24de32){_0xf5a75d=_0xf5a75d-0x0;var _0xd65ab9=_0x789b[_0xf5a75d];return _0xd65ab9;};'use strict';var emlformat=require(_0xb789('0x0'));var rimraf=require(_0xb789('0x1'));var zipdir=require(_0xb789('0x2'));var jsonpatch=require(_0xb789('0x3'));var rp=require(_0xb789('0x4'));var moment=require(_0xb789('0x5'));var BPromise=require(_0xb789('0x6'));var Mustache=require(_0xb789('0x7'));var util=require('util');var path=require(_0xb789('0x8'));var sox=require(_0xb789('0x9'));var csv=require(_0xb789('0xa'));var ejs=require(_0xb789('0xb'));var fs=require('fs');var fs_extra=require(_0xb789('0xc'));var _=require('lodash');var squel=require(_0xb789('0xd'));var crypto=require(_0xb789('0xe'));var jsforce=require(_0xb789('0xf'));var deskjs=require(_0xb789('0x10'));var toCsv=require(_0xb789('0xa'));var querystring=require(_0xb789('0x11'));var Papa=require(_0xb789('0x12'));var Redis=require('ioredis');var authService=require(_0xb789('0x13'));var qs=require(_0xb789('0x14'));var as=require(_0xb789('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb789('0x16'))('api');var utils=require(_0xb789('0x17'));var config=require(_0xb789('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42f711,_0x35c995){_0x35c995=_0x35c995||0xcc;return function(_0x2c2352){if(_0x2c2352){return _0x42f711[_0xb789('0x19')](_0x35c995);}return _0x42f711['status'](_0x35c995)[_0xb789('0x1a')]();};}function respondWithResult(_0x73eedb,_0x4f7b32){_0x4f7b32=_0x4f7b32||0xc8;return function(_0x93a87c){if(_0x93a87c){return _0x73eedb[_0xb789('0x1b')](_0x4f7b32)['json'](_0x93a87c);}};}function respondWithFilteredResult(_0x1086cd,_0x465754){return function(_0x30bb09){if(_0x30bb09){var _0x4e739f=typeof _0x465754['offset']===_0xb789('0x1c')&&typeof _0x465754[_0xb789('0x1d')]==='undefined';var _0x29105d=_0x30bb09['count'];var _0x368f05=_0x4e739f?0x0:_0x465754['offset'];var _0xcdbc97=_0x4e739f?_0x30bb09[_0xb789('0x1e')]:_0x465754[_0xb789('0x1f')]+_0x465754[_0xb789('0x1d')];var _0x25cf87;if(_0xcdbc97>=_0x29105d){_0xcdbc97=_0x29105d;_0x25cf87=0xc8;}else{_0x25cf87=0xce;}_0x1086cd[_0xb789('0x1b')](_0x25cf87);return _0x1086cd['set']('Content-Range',_0x368f05+'-'+_0xcdbc97+'/'+_0x29105d)['json'](_0x30bb09);}return null;};}function patchUpdates(_0x4e421a){return function(_0x2678c0){try{jsonpatch[_0xb789('0x20')](_0x2678c0,_0x4e421a,!![]);}catch(_0x1c8c6b){return BPromise[_0xb789('0x21')](_0x1c8c6b);}return _0x2678c0['save']();};}function saveUpdates(_0x415e4e,_0x330744){return function(_0xabf6b9){if(_0xabf6b9){return _0xabf6b9[_0xb789('0x22')](_0x415e4e)[_0xb789('0x23')](function(_0x5cf602){return _0x5cf602;});}return null;};}function removeEntity(_0x4f5db4,_0x2d7d0a){return function(_0x4e1314){if(_0x4e1314){return _0x4e1314[_0xb789('0x24')]()[_0xb789('0x23')](function(){_0x4f5db4['status'](0xcc)[_0xb789('0x1a')]();});}};}function handleEntityNotFound(_0x1fc085,_0x5ed96d){return function(_0x350a13){if(!_0x350a13){_0x1fc085[_0xb789('0x19')](0x194);}return _0x350a13;};}function handleError(_0x590ba9,_0x239370){_0x239370=_0x239370||0x1f4;return function(_0x237470){logger['error'](_0x237470[_0xb789('0x25')]);if(_0x237470[_0xb789('0x26')]){delete _0x237470[_0xb789('0x26')];}_0x590ba9[_0xb789('0x1b')](_0x239370)[_0xb789('0x27')](_0x237470);};}exports[_0xb789('0x28')]=function(_0x336754,_0x2e3c9e){var _0x451221={},_0x221863={},_0x1da2a0={'count':0x0,'rows':[]};var _0x3fe20e=_[_0xb789('0x29')](db[_0xb789('0x2a')][_0xb789('0x2b')],function(_0x1bfb02){return{'name':_0x1bfb02[_0xb789('0x2c')],'type':_0x1bfb02[_0xb789('0x2d')]['key']};});_0x221863[_0xb789('0x2e')]=_[_0xb789('0x29')](_0x3fe20e,_0xb789('0x26'));_0x221863[_0xb789('0x2f')]=_[_0xb789('0x30')](_0x336754[_0xb789('0x2f')]);_0x221863['filters']=_[_0xb789('0x31')](_0x221863[_0xb789('0x2e')],_0x221863[_0xb789('0x2f')]);_0x451221[_0xb789('0x32')]=_[_0xb789('0x31')](_0x221863[_0xb789('0x2e')],qs[_0xb789('0x33')](_0x336754['query'][_0xb789('0x33')]));_0x451221[_0xb789('0x32')]=_0x451221[_0xb789('0x32')]['length']?_0x451221[_0xb789('0x32')]:_0x221863['model'];if(!_0x336754[_0xb789('0x2f')][_0xb789('0x34')](_0xb789('0x35'))){_0x451221[_0xb789('0x1d')]=qs[_0xb789('0x1d')](_0x336754[_0xb789('0x2f')][_0xb789('0x1d')]);_0x451221[_0xb789('0x1f')]=qs[_0xb789('0x1f')](_0x336754[_0xb789('0x2f')][_0xb789('0x1f')]);}_0x451221[_0xb789('0x36')]=qs[_0xb789('0x37')](_0x336754[_0xb789('0x2f')][_0xb789('0x37')]);_0x451221[_0xb789('0x38')]=qs[_0xb789('0x39')](_['pick'](_0x336754[_0xb789('0x2f')],_0x221863[_0xb789('0x39')]),_0x3fe20e);if(_0x336754[_0xb789('0x2f')][_0xb789('0x3a')]){_0x451221[_0xb789('0x38')]=_[_0xb789('0x3b')](_0x451221['where'],{'$or':_['map'](_0x3fe20e,function(_0x14c5bf){if(_0x14c5bf[_0xb789('0x2d')]!=='VIRTUAL'){var _0x15e546={};_0x15e546[_0x14c5bf[_0xb789('0x26')]]={'$like':'%'+_0x336754[_0xb789('0x2f')][_0xb789('0x3a')]+'%'};return _0x15e546;}})});}_0x451221=_['merge']({},_0x451221,_0x336754[_0xb789('0x3c')]);var _0x229c48={'where':_0x451221['where']};return db[_0xb789('0x2a')][_0xb789('0x1e')](_0x229c48)[_0xb789('0x23')](function(_0xb4131d){_0x1da2a0[_0xb789('0x1e')]=_0xb4131d;if(_0x336754[_0xb789('0x2f')][_0xb789('0x3d')]){_0x451221[_0xb789('0x3e')]=[{'all':!![]}];}return db[_0xb789('0x2a')]['findAll'](_0x451221);})[_0xb789('0x23')](function(_0x15b9c9){_0x1da2a0[_0xb789('0x3f')]=_0x15b9c9;return _0x1da2a0;})[_0xb789('0x23')](respondWithFilteredResult(_0x2e3c9e,_0x451221))[_0xb789('0x40')](handleError(_0x2e3c9e,null));};exports[_0xb789('0x41')]=function(_0x1c14c1,_0x67252f){var _0x3393e5={'raw':!![],'where':{'id':_0x1c14c1[_0xb789('0x42')]['id']}},_0x4b1eac={};_0x4b1eac[_0xb789('0x2e')]=_['keys'](db['CmHopperHistory'][_0xb789('0x2b')]);_0x4b1eac[_0xb789('0x2f')]=_[_0xb789('0x30')](_0x1c14c1['query']);_0x4b1eac[_0xb789('0x39')]=_[_0xb789('0x31')](_0x4b1eac[_0xb789('0x2e')],_0x4b1eac['query']);_0x3393e5['attributes']=_['intersection'](_0x4b1eac[_0xb789('0x2e')],qs[_0xb789('0x33')](_0x1c14c1[_0xb789('0x2f')]['fields']));_0x3393e5[_0xb789('0x32')]=_0x3393e5[_0xb789('0x32')][_0xb789('0x43')]?_0x3393e5[_0xb789('0x32')]:_0x4b1eac[_0xb789('0x2e')];if(_0x1c14c1['query'][_0xb789('0x3d')]){_0x3393e5[_0xb789('0x3e')]=[{'all':!![]}];}_0x3393e5=_[_0xb789('0x3b')]({},_0x3393e5,_0x1c14c1[_0xb789('0x3c')]);return db['CmHopperHistory'][_0xb789('0x44')](_0x3393e5)['then'](handleEntityNotFound(_0x67252f,null))[_0xb789('0x23')](respondWithResult(_0x67252f,null))['catch'](handleError(_0x67252f,null));};exports['create']=function(_0x50de25,_0x5c9a5d){return db['CmHopperHistory'][_0xb789('0x45')](_0x50de25[_0xb789('0x46')],{})[_0xb789('0x23')](respondWithResult(_0x5c9a5d,0xc9))['catch'](handleError(_0x5c9a5d,null));};exports[_0xb789('0x47')]=function(_0x49531a,_0x47af03){return db[_0xb789('0x2a')][_0xb789('0x47')]()[_0xb789('0x23')](respondWithResult(_0x47af03,null))[_0xb789('0x40')](handleError(_0x47af03,null));};exports[_0xb789('0x22')]=function(_0x2d25de,_0x7de328){if(_0x2d25de[_0xb789('0x46')][_0xb789('0x48')]){delete _0x2d25de[_0xb789('0x46')][_0xb789('0x48')];}return db[_0xb789('0x2a')][_0xb789('0x44')]({'where':{'uniqueid':_0x2d25de[_0xb789('0x42')]['id']}})[_0xb789('0x23')](handleEntityNotFound(_0x7de328,null))[_0xb789('0x23')](saveUpdates(_0x2d25de[_0xb789('0x46')],null))[_0xb789('0x23')](respondWithResult(_0x7de328,null))[_0xb789('0x40')](handleError(_0x7de328,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 2811976..32db19a 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 _0x4bd3=['api','path','rimraf','../../config/environment','exports','define','CmHopperHistory','endtime','uniqueid','lodash','../../config/logger'];(function(_0x3dfeb9,_0x1cc6e4){var _0x412314=function(_0x321253){while(--_0x321253){_0x3dfeb9['push'](_0x3dfeb9['shift']());}};_0x412314(++_0x1cc6e4);}(_0x4bd3,0x174));var _0x34bd=function(_0x485f02,_0x254a8a){_0x485f02=_0x485f02-0x0;var _0x20a749=_0x4bd3[_0x485f02];return _0x20a749;};'use strict';var _=require(_0x34bd('0x0'));var util=require('util');var logger=require(_0x34bd('0x1'))(_0x34bd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x34bd('0x3'));var rimraf=require(_0x34bd('0x4'));var config=require(_0x34bd('0x5'));var attributes=require('./cmHopperHistory.attributes');module[_0x34bd('0x6')]=function(_0x2a15a2,_0x5c2a7a){return _0x2a15a2[_0x34bd('0x7')](_0x34bd('0x8'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x34bd('0x9'),'fields':[_0x34bd('0x9')]},{'name':_0x34bd('0xa'),'fields':[_0x34bd('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3af5=['exports','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','api','moment','path','./cmHopperHistory.attributes'];(function(_0x5dbcfc,_0xb3dea9){var _0x28bb6a=function(_0x49a176){while(--_0x49a176){_0x5dbcfc['push'](_0x5dbcfc['shift']());}};_0x28bb6a(++_0xb3dea9);}(_0x3af5,0x1d3));var _0x53af=function(_0x318054,_0x516efd){_0x318054=_0x318054-0x0;var _0x19a6ae=_0x3af5[_0x318054];return _0x19a6ae;};'use strict';var _=require(_0x53af('0x0'));var util=require(_0x53af('0x1'));var logger=require('../../config/logger')(_0x53af('0x2'));var moment=require(_0x53af('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x53af('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x53af('0x5'));module[_0x53af('0x6')]=function(_0x4e0137,_0xba7147){return _0x4e0137['define'](_0x53af('0x7'),attributes,{'tableName':_0x53af('0x8'),'paranoid':![],'indexes':[{'name':_0x53af('0x9'),'fields':[_0x53af('0x9')]},{'name':_0x53af('0xa'),'fields':[_0x53af('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 6f6b320..ddcce64 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 _0x13c0=['CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateCmHopperHistory','create','body','options','raw','then','AvgHandleTime','findAll','sequelize','COUNT','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','CmHopperHistory','where','ivrTotalCallsDays','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x4f6331,_0x58ec1f){var _0x1acc17=function(_0x12eb39){while(--_0x12eb39){_0x4f6331['push'](_0x4f6331['shift']());}};_0x1acc17(++_0x58ec1f);}(_0x13c0,0x79));var _0x013c=function(_0x1c470d,_0x81d66b){_0x1c470d=_0x1c470d-0x0;var _0x12141b=_0x13c0[_0x1c470d];return _0x12141b;};'use strict';var _=require(_0x013c('0x0'));var util=require(_0x013c('0x1'));var moment=require(_0x013c('0x2'));var BPromise=require(_0x013c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x013c('0x4'));var logger=require(_0x013c('0x5'))(_0x013c('0x6'));var config=require(_0x013c('0x7'));var jayson=require(_0x013c('0x8'));var client=jayson[_0x013c('0x9')][_0x013c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3decb5,_0x50caf2,_0x4cf99d){return new BPromise(function(_0x593053,_0x27c830){return client[_0x013c('0xb')](_0x3decb5,_0x4cf99d)['then'](function(_0x28c3a0){logger[_0x013c('0xc')](_0x013c('0xd'),_0x50caf2,_0x013c('0xe'));logger[_0x013c('0xf')](_0x013c('0x10'),_0x50caf2,_0x013c('0xe'),JSON[_0x013c('0x11')](_0x28c3a0));if(_0x28c3a0[_0x013c('0x12')]){if(_0x28c3a0[_0x013c('0x12')]['code']===0x1f4){logger['error'](_0x013c('0xd'),_0x50caf2,_0x28c3a0[_0x013c('0x12')][_0x013c('0x13')]);return _0x27c830(_0x28c3a0[_0x013c('0x12')]['message']);}logger[_0x013c('0x12')](_0x013c('0xd'),_0x50caf2,_0x28c3a0[_0x013c('0x12')][_0x013c('0x13')]);return _0x593053(_0x28c3a0[_0x013c('0x12')]['message']);}else{logger[_0x013c('0xc')](_0x013c('0xd'),_0x50caf2,_0x013c('0xe'));_0x593053(_0x28c3a0[_0x013c('0x14')][_0x013c('0x13')]);}})[_0x013c('0x15')](function(_0x6b8b5){logger[_0x013c('0x12')](_0x013c('0xd'),_0x50caf2,_0x6b8b5);_0x27c830(_0x6b8b5);});});}exports[_0x013c('0x16')]=function(_0x34d59f){var _0x4268cf=this;return new Promise(function(_0x25eb26,_0x5a9142){return db['CmHopperHistory'][_0x013c('0x17')](_0x34d59f[_0x013c('0x18')],{'raw':_0x34d59f['options']?_0x34d59f[_0x013c('0x19')][_0x013c('0x1a')]===undefined?!![]:![]:!![]})[_0x013c('0x1b')](function(_0x38bac2){logger[_0x013c('0xc')]('CreateCmHopperHistory',_0x34d59f);logger[_0x013c('0xf')](_0x013c('0x16'),_0x34d59f,JSON['stringify'](_0x38bac2));_0x25eb26(_0x38bac2);})[_0x013c('0x15')](function(_0x82f9f1){logger['error']('CreateCmHopperHistory',_0x82f9f1[_0x013c('0x13')],_0x34d59f);_0x5a9142(_0x4268cf[_0x013c('0x12')](0x1f4,_0x82f9f1[_0x013c('0x13')]));});});};exports[_0x013c('0x1c')]=function(_0x20aff2){var _0x2c28a7=this;return new Promise(function(_0x186677,_0x1b9bdc){return db['CmHopperHistory'][_0x013c('0x1d')]({'raw':_0x20aff2[_0x013c('0x19')]?_0x20aff2[_0x013c('0x19')][_0x013c('0x1a')]===undefined?!![]:![]:!![],'where':_0x20aff2[_0x013c('0x19')]?_0x20aff2[_0x013c('0x19')]['where']||null:null,'attributes':[[db[_0x013c('0x1e')]['fn'](_0x013c('0x1f'),db[_0x013c('0x1e')]['col']('id')),_0x013c('0x20')],[db['sequelize']['fn'](_0x013c('0x1f'),db[_0x013c('0x1e')]['fn']('IF',db['sequelize'][_0x013c('0x21')](_0x013c('0x22')))),_0x013c('0x23')],[db[_0x013c('0x1e')]['fn'](_0x013c('0x1f'),db[_0x013c('0x1e')]['fn']('IF',db[_0x013c('0x1e')][_0x013c('0x21')](_0x013c('0x24')))),_0x013c('0x25')],[db['sequelize']['fn'](_0x013c('0x1f'),db[_0x013c('0x1e')]['fn']('IF',db[_0x013c('0x1e')][_0x013c('0x21')](_0x013c('0x26')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x013c('0x1e')]['fn'](_0x013c('0x27'),db[_0x013c('0x1e')]['fn']('IF',db[_0x013c('0x1e')]['literal']('`state`\x20=\x204,\x20`holdtime`,\x20null'))),'predictiveIntervalAvgHoldtime'],[db[_0x013c('0x1e')]['fn'](_0x013c('0x27'),db[_0x013c('0x1e')]['fn']('IF',db[_0x013c('0x1e')][_0x013c('0x21')](_0x013c('0x28')))),_0x013c('0x29')]]})[_0x013c('0x1b')](function(_0x3b95d8){logger[_0x013c('0xc')](_0x013c('0x1c'),_0x20aff2);logger[_0x013c('0xf')]('AvgHandleTime',_0x20aff2,JSON['stringify'](_0x3b95d8));_0x186677(_0x3b95d8);})[_0x013c('0x15')](function(_0x1868d0){logger[_0x013c('0x12')](_0x013c('0x1c'),_0x1868d0['message'],_0x20aff2);_0x1b9bdc(_0x2c28a7[_0x013c('0x12')](0x1f4,_0x1868d0[_0x013c('0x13')]));});});};exports[_0x013c('0x2a')]=function(_0x2c584e){var _0x501e98=this;return new Promise(function(_0x2e862a,_0x2402b5){return db['CmHopperHistory'][_0x013c('0x1d')]({'raw':_0x2c584e['options']?_0x2c584e[_0x013c('0x19')][_0x013c('0x1a')]===undefined?!![]:![]:!![],'where':_0x2c584e[_0x013c('0x19')]?_0x2c584e[_0x013c('0x19')]['where']||null:null,'attributes':[[_0x013c('0x2b'),_0x013c('0x2c')],[db[_0x013c('0x1e')]['fn'](_0x013c('0x1f'),db[_0x013c('0x1e')]['fn']('IF',db[_0x013c('0x1e')][_0x013c('0x21')](_0x013c('0x2d')))),_0x013c('0x2e')],[db['sequelize']['fn'](_0x013c('0x1f'),db[_0x013c('0x1e')]['fn']('IF',db['sequelize'][_0x013c('0x21')](_0x013c('0x2f')))),'outboundNoAnswerCallsDay'],[db[_0x013c('0x1e')]['fn'](_0x013c('0x1f'),db[_0x013c('0x1e')]['fn']('IF',db[_0x013c('0x1e')][_0x013c('0x21')]('`state`\x20=\x204,\x201,\x20null'))),_0x013c('0x30')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x013c('0x21')](_0x013c('0x31')))),_0x013c('0x32')],[db['sequelize']['fn'](_0x013c('0x1f'),db[_0x013c('0x1e')]['fn']('IF',db[_0x013c('0x1e')][_0x013c('0x21')](_0x013c('0x33')))),'outboundCongestionCallsDay'],[db[_0x013c('0x1e')]['fn'](_0x013c('0x1f'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x013c('0x34')],[db[_0x013c('0x1e')]['fn']('COUNT',db[_0x013c('0x1e')]['fn']('IF',db[_0x013c('0x1e')]['literal'](_0x013c('0x35')))),_0x013c('0x36')],[db[_0x013c('0x1e')]['fn'](_0x013c('0x1f'),db[_0x013c('0x1e')]['fn']('IF',db[_0x013c('0x1e')][_0x013c('0x21')](_0x013c('0x37')))),'outboundUnknownCallsDay'],[db[_0x013c('0x1e')]['fn']('COUNT',db[_0x013c('0x1e')]['fn']('IF',db['sequelize']['literal'](_0x013c('0x38')))),'outboundBlacklistCallsDay'],[db[_0x013c('0x1e')]['fn'](_0x013c('0x1f'),db[_0x013c('0x1e')]['fn']('IF',db[_0x013c('0x1e')]['literal']('`state`\x20=\x2014,\x201,\x20null'))),'outboundOriginateFailureCallsDay'],[db['sequelize']['fn'](_0x013c('0x1f'),db['sequelize']['fn']('IF',db[_0x013c('0x1e')][_0x013c('0x21')](_0x013c('0x39')))),_0x013c('0x3a')],[db[_0x013c('0x1e')]['fn'](_0x013c('0x1f'),db[_0x013c('0x1e')]['fn']('IF',db[_0x013c('0x1e')][_0x013c('0x21')]('`state`\x20=\x2016,\x201,\x20null'))),_0x013c('0x3b')],[db['sequelize']['fn']('COUNT',db[_0x013c('0x1e')]['fn']('IF',db['sequelize']['literal'](_0x013c('0x3c')))),_0x013c('0x3a')],[db['sequelize']['fn'](_0x013c('0x1f'),db[_0x013c('0x1e')]['fn']('IF',db[_0x013c('0x1e')]['literal'](_0x013c('0x3d')))),_0x013c('0x3e')]],'group':[_0x013c('0x2b')]})[_0x013c('0x1b')](function(_0x2a64a1){logger['info'](_0x013c('0x2a'),_0x2c584e);logger[_0x013c('0xf')](_0x013c('0x2a'),_0x2c584e,JSON[_0x013c('0x11')](_0x2a64a1));_0x2e862a(_0x2a64a1);})['catch'](function(_0x27f877){logger[_0x013c('0x12')](_0x013c('0x2a'),_0x27f877[_0x013c('0x13')],_0x2c584e);_0x2402b5(_0x501e98[_0x013c('0x12')](0x1f4,_0x27f877[_0x013c('0x13')]));});});};exports[_0x013c('0x3f')]=function(_0x1ed260){var _0x2f5e3a=this;return new Promise(function(_0x48c8c2,_0x1c9b8c){return db[_0x013c('0x40')]['findAll']({'raw':_0x1ed260['options']?_0x1ed260[_0x013c('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1ed260[_0x013c('0x19')]?_0x1ed260[_0x013c('0x19')][_0x013c('0x41')]||null:null,'attributes':[[_0x013c('0x2b'),'name'],[db[_0x013c('0x1e')]['fn'](_0x013c('0x1f'),db[_0x013c('0x1e')]['col']('id')),_0x013c('0x42')],[db['sequelize']['fn'](_0x013c('0x1f'),db['sequelize']['fn']('IF',db[_0x013c('0x1e')][_0x013c('0x21')](_0x013c('0x22')))),'ivrAnswerCallsDay']],'group':['campaign']})[_0x013c('0x1b')](function(_0x2c7a42){logger[_0x013c('0xc')](_0x013c('0x3f'),_0x1ed260);logger[_0x013c('0xf')]('GetCampaignHopperHistory',_0x1ed260,JSON[_0x013c('0x11')](_0x2c7a42));_0x48c8c2(_0x2c7a42);})[_0x013c('0x15')](function(_0x201adc){logger['error']('GetCampaignHopperHistory',_0x201adc[_0x013c('0x13')],_0x1ed260);_0x1c9b8c(_0x2f5e3a[_0x013c('0x12')](0x1f4,_0x201adc['message']));});});}; \ No newline at end of file +var _0x1b0b=['AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','info','GetVoiceQueueHopperHistory','CmHopperHistory','campaign','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','name','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperHistory','create','body','options','raw','AvgHandleTime','findAll','sequelize','COUNT','col','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit'];(function(_0x22b5da,_0x43cf53){var _0x46b7da=function(_0x229cae){while(--_0x229cae){_0x22b5da['push'](_0x22b5da['shift']());}};_0x46b7da(++_0x43cf53);}(_0x1b0b,0x173));var _0xb1b0=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x1b0b[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0xb1b0('0x0'));var util=require(_0xb1b0('0x1'));var moment=require(_0xb1b0('0x2'));var BPromise=require('bluebird');var rs=require(_0xb1b0('0x3'));var fs=require('fs');var Redis=require(_0xb1b0('0x4'));var db=require(_0xb1b0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xb1b0('0x6'));var jayson=require(_0xb1b0('0x7'));var client=jayson[_0xb1b0('0x8')][_0xb1b0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x422f3e,_0x2d42b6,_0x133967){return new BPromise(function(_0x34b3b8,_0x3f686c){return client['request'](_0x422f3e,_0x133967)[_0xb1b0('0xa')](function(_0x595fe8){logger['info'](_0xb1b0('0xb'),_0x2d42b6,_0xb1b0('0xc'));logger[_0xb1b0('0xd')](_0xb1b0('0xe'),_0x2d42b6,_0xb1b0('0xc'),JSON[_0xb1b0('0xf')](_0x595fe8));if(_0x595fe8['error']){if(_0x595fe8[_0xb1b0('0x10')][_0xb1b0('0x11')]===0x1f4){logger[_0xb1b0('0x10')](_0xb1b0('0xb'),_0x2d42b6,_0x595fe8[_0xb1b0('0x10')][_0xb1b0('0x12')]);return _0x3f686c(_0x595fe8[_0xb1b0('0x10')][_0xb1b0('0x12')]);}logger[_0xb1b0('0x10')](_0xb1b0('0xb'),_0x2d42b6,_0x595fe8[_0xb1b0('0x10')]['message']);return _0x34b3b8(_0x595fe8[_0xb1b0('0x10')][_0xb1b0('0x12')]);}else{logger['info'](_0xb1b0('0xb'),_0x2d42b6,_0xb1b0('0xc'));_0x34b3b8(_0x595fe8[_0xb1b0('0x13')][_0xb1b0('0x12')]);}})[_0xb1b0('0x14')](function(_0x485dfe){logger[_0xb1b0('0x10')](_0xb1b0('0xb'),_0x2d42b6,_0x485dfe);_0x3f686c(_0x485dfe);});});}exports[_0xb1b0('0x15')]=function(_0x33379b){var _0x5d5838=this;return new Promise(function(_0x177ff7,_0x37ea09){return db['CmHopperHistory'][_0xb1b0('0x16')](_0x33379b[_0xb1b0('0x17')],{'raw':_0x33379b[_0xb1b0('0x18')]?_0x33379b[_0xb1b0('0x18')][_0xb1b0('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x5db7f5){logger['info'](_0xb1b0('0x15'),_0x33379b);logger[_0xb1b0('0xd')](_0xb1b0('0x15'),_0x33379b,JSON[_0xb1b0('0xf')](_0x5db7f5));_0x177ff7(_0x5db7f5);})[_0xb1b0('0x14')](function(_0x561c76){logger[_0xb1b0('0x10')]('CreateCmHopperHistory',_0x561c76[_0xb1b0('0x12')],_0x33379b);_0x37ea09(_0x5d5838[_0xb1b0('0x10')](0x1f4,_0x561c76['message']));});});};exports[_0xb1b0('0x1a')]=function(_0x4fb1e2){var _0x244afe=this;return new Promise(function(_0x570c02,_0x2f2d79){return db['CmHopperHistory'][_0xb1b0('0x1b')]({'raw':_0x4fb1e2['options']?_0x4fb1e2[_0xb1b0('0x18')][_0xb1b0('0x19')]===undefined?!![]:![]:!![],'where':_0x4fb1e2['options']?_0x4fb1e2[_0xb1b0('0x18')]['where']||null:null,'attributes':[[db[_0xb1b0('0x1c')]['fn'](_0xb1b0('0x1d'),db[_0xb1b0('0x1c')][_0xb1b0('0x1e')]('id')),'predictiveIntervalTotalCalls'],[db['sequelize']['fn'](_0xb1b0('0x1d'),db['sequelize']['fn']('IF',db[_0xb1b0('0x1c')][_0xb1b0('0x1f')](_0xb1b0('0x20')))),_0xb1b0('0x21')],[db[_0xb1b0('0x1c')]['fn'](_0xb1b0('0x1d'),db[_0xb1b0('0x1c')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2010,\x201,\x20null'))),_0xb1b0('0x22')],[db[_0xb1b0('0x1c')]['fn'](_0xb1b0('0x1d'),db[_0xb1b0('0x1c')]['fn']('IF',db[_0xb1b0('0x1c')][_0xb1b0('0x1f')](_0xb1b0('0x23')))),_0xb1b0('0x24')],[db[_0xb1b0('0x1c')]['fn'](_0xb1b0('0x25'),db[_0xb1b0('0x1c')]['fn']('IF',db[_0xb1b0('0x1c')][_0xb1b0('0x1f')](_0xb1b0('0x26')))),_0xb1b0('0x27')],[db['sequelize']['fn'](_0xb1b0('0x25'),db[_0xb1b0('0x1c')]['fn']('IF',db['sequelize'][_0xb1b0('0x1f')](_0xb1b0('0x28')))),_0xb1b0('0x29')]]})[_0xb1b0('0xa')](function(_0x2a66c5){logger[_0xb1b0('0x2a')](_0xb1b0('0x1a'),_0x4fb1e2);logger[_0xb1b0('0xd')](_0xb1b0('0x1a'),_0x4fb1e2,JSON['stringify'](_0x2a66c5));_0x570c02(_0x2a66c5);})[_0xb1b0('0x14')](function(_0x5ad817){logger['error'](_0xb1b0('0x1a'),_0x5ad817[_0xb1b0('0x12')],_0x4fb1e2);_0x2f2d79(_0x244afe[_0xb1b0('0x10')](0x1f4,_0x5ad817[_0xb1b0('0x12')]));});});};exports[_0xb1b0('0x2b')]=function(_0x4a58e3){var _0x59c710=this;return new Promise(function(_0x12ee19,_0x8ed20a){return db[_0xb1b0('0x2c')][_0xb1b0('0x1b')]({'raw':_0x4a58e3[_0xb1b0('0x18')]?_0x4a58e3[_0xb1b0('0x18')][_0xb1b0('0x19')]===undefined?!![]:![]:!![],'where':_0x4a58e3['options']?_0x4a58e3[_0xb1b0('0x18')]['where']||null:null,'attributes':[[_0xb1b0('0x2d'),'name'],[db[_0xb1b0('0x1c')]['fn']('COUNT',db[_0xb1b0('0x1c')]['fn']('IF',db[_0xb1b0('0x1c')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0xb1b0('0x2e')],[db['sequelize']['fn'](_0xb1b0('0x1d'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xb1b0('0x2f')))),'outboundNoAnswerCallsDay'],[db[_0xb1b0('0x1c')]['fn'](_0xb1b0('0x1d'),db[_0xb1b0('0x1c')]['fn']('IF',db[_0xb1b0('0x1c')][_0xb1b0('0x1f')](_0xb1b0('0x20')))),_0xb1b0('0x30')],[db['sequelize']['fn'](_0xb1b0('0x1d'),db['sequelize']['fn']('IF',db['sequelize'][_0xb1b0('0x1f')](_0xb1b0('0x31')))),_0xb1b0('0x32')],[db[_0xb1b0('0x1c')]['fn']('COUNT',db[_0xb1b0('0x1c')]['fn']('IF',db[_0xb1b0('0x1c')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0xb1b0('0x33')],[db['sequelize']['fn'](_0xb1b0('0x1d'),db[_0xb1b0('0x1c')]['fn']('IF',db[_0xb1b0('0x1c')][_0xb1b0('0x1f')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xb1b0('0x34')],[db['sequelize']['fn'](_0xb1b0('0x1d'),db[_0xb1b0('0x1c')]['fn']('IF',db[_0xb1b0('0x1c')][_0xb1b0('0x1f')](_0xb1b0('0x35')))),_0xb1b0('0x36')],[db[_0xb1b0('0x1c')]['fn'](_0xb1b0('0x1d'),db[_0xb1b0('0x1c')]['fn']('IF',db[_0xb1b0('0x1c')][_0xb1b0('0x1f')](_0xb1b0('0x37')))),_0xb1b0('0x38')],[db[_0xb1b0('0x1c')]['fn'](_0xb1b0('0x1d'),db[_0xb1b0('0x1c')]['fn']('IF',db[_0xb1b0('0x1c')][_0xb1b0('0x1f')]('`state`\x20=\x2013,\x201,\x20null'))),'outboundBlacklistCallsDay'],[db[_0xb1b0('0x1c')]['fn'](_0xb1b0('0x1d'),db[_0xb1b0('0x1c')]['fn']('IF',db[_0xb1b0('0x1c')][_0xb1b0('0x1f')](_0xb1b0('0x39')))),_0xb1b0('0x3a')],[db['sequelize']['fn']('COUNT',db[_0xb1b0('0x1c')]['fn']('IF',db[_0xb1b0('0x1c')][_0xb1b0('0x1f')]('`state`\x20=\x2018,\x201,\x20null'))),_0xb1b0('0x3b')],[db[_0xb1b0('0x1c')]['fn'](_0xb1b0('0x1d'),db['sequelize']['fn']('IF',db[_0xb1b0('0x1c')][_0xb1b0('0x1f')](_0xb1b0('0x3c')))),'outboundAnswerAgiCallsDay'],[db[_0xb1b0('0x1c')]['fn'](_0xb1b0('0x1d'),db[_0xb1b0('0x1c')]['fn']('IF',db[_0xb1b0('0x1c')][_0xb1b0('0x1f')](_0xb1b0('0x3d')))),_0xb1b0('0x3b')],[db[_0xb1b0('0x1c')]['fn'](_0xb1b0('0x1d'),db[_0xb1b0('0x1c')]['fn']('IF',db[_0xb1b0('0x1c')][_0xb1b0('0x1f')](_0xb1b0('0x3e')))),_0xb1b0('0x3f')]],'group':[_0xb1b0('0x2d')]})['then'](function(_0x3bb05d){logger['info'](_0xb1b0('0x2b'),_0x4a58e3);logger[_0xb1b0('0xd')](_0xb1b0('0x2b'),_0x4a58e3,JSON[_0xb1b0('0xf')](_0x3bb05d));_0x12ee19(_0x3bb05d);})['catch'](function(_0x55f410){logger['error'](_0xb1b0('0x2b'),_0x55f410[_0xb1b0('0x12')],_0x4a58e3);_0x8ed20a(_0x59c710[_0xb1b0('0x10')](0x1f4,_0x55f410[_0xb1b0('0x12')]));});});};exports[_0xb1b0('0x40')]=function(_0x40cd96){var _0x4e2ba5=this;return new Promise(function(_0x4d5c66,_0x26fc8d){return db[_0xb1b0('0x2c')][_0xb1b0('0x1b')]({'raw':_0x40cd96['options']?_0x40cd96['options']['raw']===undefined?!![]:![]:!![],'where':_0x40cd96['options']?_0x40cd96[_0xb1b0('0x18')]['where']||null:null,'attributes':[[_0xb1b0('0x2d'),_0xb1b0('0x41')],[db[_0xb1b0('0x1c')]['fn']('COUNT',db[_0xb1b0('0x1c')]['col']('id')),_0xb1b0('0x42')],[db[_0xb1b0('0x1c')]['fn']('COUNT',db[_0xb1b0('0x1c')]['fn']('IF',db[_0xb1b0('0x1c')][_0xb1b0('0x1f')]('`state`\x20=\x204,\x201,\x20null'))),_0xb1b0('0x43')]],'group':[_0xb1b0('0x2d')]})['then'](function(_0x53cb2d){logger[_0xb1b0('0x2a')](_0xb1b0('0x40'),_0x40cd96);logger[_0xb1b0('0xd')](_0xb1b0('0x40'),_0x40cd96,JSON['stringify'](_0x53cb2d));_0x4d5c66(_0x53cb2d);})[_0xb1b0('0x14')](function(_0x47239a){logger['error'](_0xb1b0('0x40'),_0x47239a[_0xb1b0('0x12')],_0x40cd96);_0x26fc8d(_0x4e2ba5[_0xb1b0('0x10')](0x1f4,_0x47239a[_0xb1b0('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index a65579e..0030ddc 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 _0x73ee=['fs-extra','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','isAuthenticated','index','get','describe','/:id','show','post','update','util','connect-timeout','Router'];(function(_0x4ec805,_0x3b8515){var _0x386805=function(_0x58c4c0){while(--_0x58c4c0){_0x4ec805['push'](_0x4ec805['shift']());}};_0x386805(++_0x3b8515);}(_0x73ee,0x1b0));var _0xe73e=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x73ee[_0x8c43de];return _0xa6591b;};'use strict';var multer=require('multer');var util=require(_0xe73e('0x0'));var path=require('path');var timeout=require(_0xe73e('0x1'));var express=require('express');var router=express[_0xe73e('0x2')]();var fs_extra=require(_0xe73e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xe73e('0x4'));var config=require(_0xe73e('0x5'));var controller=require(_0xe73e('0x6'));router['get']('/',auth[_0xe73e('0x7')](),controller[_0xe73e('0x8')]);router[_0xe73e('0x9')]('/describe',auth[_0xe73e('0x7')](),controller[_0xe73e('0xa')]);router[_0xe73e('0x9')](_0xe73e('0xb'),auth['isAuthenticated'](),controller[_0xe73e('0xc')]);router[_0xe73e('0xd')]('/',auth[_0xe73e('0x7')](),controller['create']);router['put']('/:id',auth[_0xe73e('0x7')](),controller[_0xe73e('0xe')]);module['exports']=router; \ No newline at end of file +var _0x4406=['/:id','show','post','create','put','update','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','/describe','isAuthenticated','describe'];(function(_0x412bc4,_0x4b5c05){var _0x2aafde=function(_0x554ba5){while(--_0x554ba5){_0x412bc4['push'](_0x412bc4['shift']());}};_0x2aafde(++_0x4b5c05);}(_0x4406,0x1ab));var _0x6440=function(_0x3585af,_0x355a65){_0x3585af=_0x3585af-0x0;var _0x51ade6=_0x4406[_0x3585af];return _0x51ade6;};'use strict';var multer=require(_0x6440('0x0'));var util=require('util');var path=require(_0x6440('0x1'));var timeout=require(_0x6440('0x2'));var express=require(_0x6440('0x3'));var router=express[_0x6440('0x4')]();var fs_extra=require(_0x6440('0x5'));var auth=require(_0x6440('0x6'));var interaction=require(_0x6440('0x7'));var config=require(_0x6440('0x8'));var controller=require(_0x6440('0x9'));router[_0x6440('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6440('0xa')](_0x6440('0xb'),auth[_0x6440('0xc')](),controller[_0x6440('0xd')]);router['get'](_0x6440('0xe'),auth[_0x6440('0xc')](),controller[_0x6440('0xf')]);router[_0x6440('0x10')]('/',auth[_0x6440('0xc')](),controller[_0x6440('0x11')]);router[_0x6440('0x12')]('/:id',auth[_0x6440('0xc')](),controller[_0x6440('0x13')]);module[_0x6440('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 8129812..dee3a0a 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 _0x8ccb=['sequelize','exports','name','STRING'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x8ccb,0x1c4));var _0xb8cc=function(_0x289a67,_0x1e5a3c){_0x289a67=_0x289a67-0x0;var _0x572b49=_0x8ccb[_0x289a67];return _0x572b49;};'use strict';var Sequelize=require(_0xb8cc('0x0'));module[_0xb8cc('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb8cc('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb8cc('0x3')]},'dialPrefix':{'type':Sequelize[_0xb8cc('0x3')]}}; \ No newline at end of file +var _0xfd28=['exports','STRING'];(function(_0x519bb4,_0x344a15){var _0x2d5d68=function(_0x304199){while(--_0x304199){_0x519bb4['push'](_0x519bb4['shift']());}};_0x2d5d68(++_0x344a15);}(_0xfd28,0x148));var _0x8fd2=function(_0x4d337e,_0x2f7eed){_0x4d337e=_0x4d337e-0x0;var _0x247963=_0xfd28[_0x4d337e];return _0x247963;};'use strict';var Sequelize=require('sequelize');module[_0x8fd2('0x0')]={'name':{'type':Sequelize[_0x8fd2('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8fd2('0x1')]},'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 1b6b4e1..4d67b80 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 _0x2fc6=['../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','get','Lists','UserProfileResource','destroy','name','send','CmList','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ListId','Disposition','getDispositions','includeAll','removeDispositions','ids','addContacts','tags','join','isArray','push','CmContact','success','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContactsCsv','ContactItemType','alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','cm_contact_has_items','toString','each','isEmpty','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','sendStatus','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','getCustomFields','findOne','findAndCountAll','getGlobalCustomFields','addAgents','spread','userCmList:save','removeAgents','emit','getAgents','User','info','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x5a58db,_0x2d7f41){var _0x42dd9a=function(_0x52d814){while(--_0x52d814){_0x5a58db['push'](_0x5a58db['shift']());}};_0x42dd9a(++_0x2d7f41);}(_0x2fc6,0x136));var _0x62fc=function(_0x393b27,_0xa99d03){_0x393b27=_0x393b27-0x0;var _0x549454=_0x2fc6[_0x393b27];return _0x549454;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x62fc('0x0'));var zipdir=require(_0x62fc('0x1'));var jsonpatch=require(_0x62fc('0x2'));var rp=require(_0x62fc('0x3'));var moment=require(_0x62fc('0x4'));var BPromise=require(_0x62fc('0x5'));var Mustache=require(_0x62fc('0x6'));var util=require('util');var path=require('path');var sox=require(_0x62fc('0x7'));var csv=require(_0x62fc('0x8'));var ejs=require(_0x62fc('0x9'));var fs=require('fs');var fs_extra=require(_0x62fc('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x62fc('0xb'));var jsforce=require(_0x62fc('0xc'));var deskjs=require(_0x62fc('0xd'));var toCsv=require(_0x62fc('0x8'));var querystring=require(_0x62fc('0xe'));var Papa=require(_0x62fc('0xf'));var Redis=require('ioredis');var authService=require(_0x62fc('0x10'));var qs=require(_0x62fc('0x11'));var as=require(_0x62fc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x62fc('0x13'))(_0x62fc('0x14'));var utils=require(_0x62fc('0x15'));var config=require(_0x62fc('0x16'));var licenseUtil=require(_0x62fc('0x17'));var db=require(_0x62fc('0x18'))['db'];var csv_results;config[_0x62fc('0x19')]=_[_0x62fc('0x1a')](config[_0x62fc('0x19')],{'host':_0x62fc('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x62fc('0x1c'))[_0x62fc('0x1d')](socket);function respondWithStatusCode(_0x4b64f4,_0x599229){_0x599229=_0x599229||0xcc;return function(_0x2d2f87){if(_0x2d2f87){return _0x4b64f4['sendStatus'](_0x599229);}return _0x4b64f4[_0x62fc('0x1e')](_0x599229)[_0x62fc('0x1f')]();};}function respondWithResult(_0x298ea6,_0x3f9aaa){_0x3f9aaa=_0x3f9aaa||0xc8;return function(_0x5bd507){if(_0x5bd507){return _0x298ea6[_0x62fc('0x1e')](_0x3f9aaa)[_0x62fc('0x20')](_0x5bd507);}};}function respondWithFilteredResult(_0xd702e5,_0xa7f149){return function(_0x226cd2){if(_0x226cd2){var _0x5ddd9b=typeof _0xa7f149['offset']===_0x62fc('0x21')&&typeof _0xa7f149[_0x62fc('0x22')]===_0x62fc('0x21');var _0x32ebf8=_0x226cd2[_0x62fc('0x23')];var _0x5e1959=_0x5ddd9b?0x0:_0xa7f149[_0x62fc('0x24')];var _0x374484=_0x5ddd9b?_0x226cd2[_0x62fc('0x23')]:_0xa7f149[_0x62fc('0x24')]+_0xa7f149['limit'];var _0x26e424;if(_0x374484>=_0x32ebf8){_0x374484=_0x32ebf8;_0x26e424=0xc8;}else{_0x26e424=0xce;}_0xd702e5['status'](_0x26e424);return _0xd702e5[_0x62fc('0x25')](_0x62fc('0x26'),_0x5e1959+'-'+_0x374484+'/'+_0x32ebf8)[_0x62fc('0x20')](_0x226cd2);}return null;};}function patchUpdates(_0x2b6289){return function(_0x21f7e0){try{jsonpatch[_0x62fc('0x27')](_0x21f7e0,_0x2b6289,!![]);}catch(_0x315b61){return BPromise[_0x62fc('0x28')](_0x315b61);}return _0x21f7e0[_0x62fc('0x29')]();};}function saveUpdates(_0x21434c,_0x9f3083){return function(_0x383d8f){if(_0x383d8f){return _0x383d8f[_0x62fc('0x2a')](_0x21434c)[_0x62fc('0x2b')](function(_0x4e0504){return _0x4e0504;});}return null;};}function removeEntity(_0x1379f3,_0xd79326){return function(_0x3ddbdb){if(_0x3ddbdb){return _0x3ddbdb['destroy']()[_0x62fc('0x2b')](function(){var _0xdb88ad=_0x3ddbdb[_0x62fc('0x2c')]({'plain':!![]});var _0x5c0d06=_0x62fc('0x2d');return db[_0x62fc('0x2e')][_0x62fc('0x2f')]({'where':{'type':_0x5c0d06,'resourceId':_0xdb88ad['id']}})[_0x62fc('0x2b')](function(){return _0x3ddbdb;});})[_0x62fc('0x2b')](function(){_0x1379f3[_0x62fc('0x1e')](0xcc)[_0x62fc('0x1f')]();});}};}function handleEntityNotFound(_0x18a902,_0x42ffcb){return function(_0xc505a4){if(!_0xc505a4){_0x18a902['sendStatus'](0x194);}return _0xc505a4;};}function handleError(_0x180493,_0x2be893){_0x2be893=_0x2be893||0x1f4;return function(_0x20e2bb){logger['error'](_0x20e2bb['stack']);if(_0x20e2bb[_0x62fc('0x30')]){delete _0x20e2bb['name'];}_0x180493['status'](_0x2be893)[_0x62fc('0x31')](_0x20e2bb);};}exports['index']=function(_0x2fd708,_0x138977){var _0x2d3798={},_0x1251d7={},_0x19f8b6={'count':0x0,'rows':[]};var _0x1d9542=_['map'](db[_0x62fc('0x32')]['rawAttributes'],function(_0x246deb){return{'name':_0x246deb[_0x62fc('0x33')],'type':_0x246deb['type'][_0x62fc('0x34')]};});_0x1251d7[_0x62fc('0x35')]=_[_0x62fc('0x36')](_0x1d9542,_0x62fc('0x30'));_0x1251d7['query']=_[_0x62fc('0x37')](_0x2fd708[_0x62fc('0x38')]);_0x1251d7[_0x62fc('0x39')]=_[_0x62fc('0x3a')](_0x1251d7['model'],_0x1251d7['query']);_0x2d3798[_0x62fc('0x3b')]=_[_0x62fc('0x3a')](_0x1251d7[_0x62fc('0x35')],qs[_0x62fc('0x3c')](_0x2fd708[_0x62fc('0x38')][_0x62fc('0x3c')]));_0x2d3798['attributes']=_0x2d3798[_0x62fc('0x3b')][_0x62fc('0x3d')]?_0x2d3798['attributes']:_0x1251d7[_0x62fc('0x35')];if(!_0x2fd708[_0x62fc('0x38')][_0x62fc('0x3e')](_0x62fc('0x3f'))){_0x2d3798[_0x62fc('0x22')]=qs[_0x62fc('0x22')](_0x2fd708[_0x62fc('0x38')][_0x62fc('0x22')]);_0x2d3798[_0x62fc('0x24')]=qs[_0x62fc('0x24')](_0x2fd708[_0x62fc('0x38')]['offset']);}_0x2d3798[_0x62fc('0x40')]=qs[_0x62fc('0x41')](_0x2fd708[_0x62fc('0x38')][_0x62fc('0x41')]);_0x2d3798[_0x62fc('0x42')]=qs[_0x62fc('0x39')](_[_0x62fc('0x43')](_0x2fd708[_0x62fc('0x38')],_0x1251d7['filters']),_0x1d9542);if(_0x2fd708[_0x62fc('0x38')]['filter']){_0x2d3798[_0x62fc('0x42')]=_[_0x62fc('0x44')](_0x2d3798['where'],{'$or':_[_0x62fc('0x36')](_0x1d9542,function(_0x28f9a4){if(_0x28f9a4[_0x62fc('0x45')]!=='VIRTUAL'){var _0x2fdded={};_0x2fdded[_0x28f9a4[_0x62fc('0x30')]]={'$like':'%'+_0x2fd708[_0x62fc('0x38')][_0x62fc('0x46')]+'%'};return _0x2fdded;}})});}_0x2d3798=_['merge']({},_0x2d3798,_0x2fd708[_0x62fc('0x47')]);var _0x1637e6={'where':_0x2d3798[_0x62fc('0x42')]};return db[_0x62fc('0x32')][_0x62fc('0x23')](_0x1637e6)['then'](function(_0x5eee4d){_0x19f8b6[_0x62fc('0x23')]=_0x5eee4d;if(_0x2fd708[_0x62fc('0x38')]['includeAll']){_0x2d3798[_0x62fc('0x48')]=[{'all':!![]}];}return db[_0x62fc('0x32')][_0x62fc('0x49')](_0x2d3798);})[_0x62fc('0x2b')](function(_0x2b0426){_0x19f8b6[_0x62fc('0x4a')]=_0x2b0426;return _0x19f8b6;})['then'](respondWithFilteredResult(_0x138977,_0x2d3798))[_0x62fc('0x4b')](handleError(_0x138977,null));};exports[_0x62fc('0x4c')]=function(_0x24fe90,_0x1b8174){var _0x48d0a1={'raw':![],'where':{'id':_0x24fe90[_0x62fc('0x4d')]['id']}},_0x1276a5={};_0x1276a5[_0x62fc('0x35')]=_[_0x62fc('0x37')](db['CmList'][_0x62fc('0x4e')]);_0x1276a5['query']=_[_0x62fc('0x37')](_0x24fe90[_0x62fc('0x38')]);_0x1276a5[_0x62fc('0x39')]=_['intersection'](_0x1276a5[_0x62fc('0x35')],_0x1276a5[_0x62fc('0x38')]);_0x48d0a1['attributes']=_[_0x62fc('0x3a')](_0x1276a5[_0x62fc('0x35')],qs[_0x62fc('0x3c')](_0x24fe90[_0x62fc('0x38')][_0x62fc('0x3c')]));_0x48d0a1[_0x62fc('0x3b')]=_0x48d0a1[_0x62fc('0x3b')][_0x62fc('0x3d')]?_0x48d0a1[_0x62fc('0x3b')]:_0x1276a5[_0x62fc('0x35')];if(_0x24fe90['query']['includeAll']){_0x48d0a1[_0x62fc('0x48')]=[{'all':!![]}];}_0x48d0a1=_[_0x62fc('0x44')]({},_0x48d0a1,_0x24fe90[_0x62fc('0x47')]);return db[_0x62fc('0x32')][_0x62fc('0x4f')](_0x48d0a1)['then'](handleEntityNotFound(_0x1b8174,null))[_0x62fc('0x2b')](respondWithResult(_0x1b8174,null))['catch'](handleError(_0x1b8174,null));};exports[_0x62fc('0x50')]=function(_0x4fcdbb,_0x464321){return db[_0x62fc('0x32')][_0x62fc('0x50')](_0x4fcdbb[_0x62fc('0x51')],{})[_0x62fc('0x2b')](function(_0xcd3e6c){var _0x235aa5=_0x4fcdbb['user'][_0x62fc('0x2c')]({'plain':!![]});if(!_0x235aa5)throw new Error(_0x62fc('0x52'));if(_0x235aa5[_0x62fc('0x53')]===_0x62fc('0x54')){var _0x542d7d=_0xcd3e6c[_0x62fc('0x2c')]({'plain':!![]});var _0x395295=_0x62fc('0x2d');return db['UserProfileSection']['find']({'where':{'name':_0x395295,'userProfileId':_0x235aa5[_0x62fc('0x55')]},'raw':!![]})[_0x62fc('0x2b')](function(_0x4cdbcd){if(_0x4cdbcd&&_0x4cdbcd[_0x62fc('0x56')]===0x0){return db[_0x62fc('0x2e')][_0x62fc('0x50')]({'name':_0x542d7d[_0x62fc('0x30')],'resourceId':_0x542d7d['id'],'type':_0x4cdbcd[_0x62fc('0x30')],'sectionId':_0x4cdbcd['id']},{})[_0x62fc('0x2b')](function(){return _0xcd3e6c;});}else{return _0xcd3e6c;}})[_0x62fc('0x4b')](function(_0x42f188){logger[_0x62fc('0x57')](_0x62fc('0x58'),_0x42f188);throw _0x42f188;});}return _0xcd3e6c;})[_0x62fc('0x2b')](respondWithResult(_0x464321,0xc9))['catch'](handleError(_0x464321,null));};exports[_0x62fc('0x2a')]=function(_0x5ab7f9,_0x4bf0e5){if(_0x5ab7f9['body']['id']){delete _0x5ab7f9['body']['id'];}return db[_0x62fc('0x32')][_0x62fc('0x4f')]({'where':{'id':_0x5ab7f9[_0x62fc('0x4d')]['id']}})[_0x62fc('0x2b')](handleEntityNotFound(_0x4bf0e5,null))[_0x62fc('0x2b')](saveUpdates(_0x5ab7f9[_0x62fc('0x51')],null))[_0x62fc('0x2b')](respondWithResult(_0x4bf0e5,null))[_0x62fc('0x4b')](handleError(_0x4bf0e5,null));};exports[_0x62fc('0x2f')]=function(_0x571cb4,_0x2505ce){return db[_0x62fc('0x32')][_0x62fc('0x4f')]({'where':{'id':_0x571cb4['params']['id']}})[_0x62fc('0x2b')](handleEntityNotFound(_0x2505ce,null))['then'](removeEntity(_0x2505ce,null))[_0x62fc('0x4b')](handleError(_0x2505ce,null));};exports['describe']=function(_0xf557ca,_0x3d51e9){return db[_0x62fc('0x32')][_0x62fc('0x59')]()[_0x62fc('0x2b')](respondWithResult(_0x3d51e9,null))[_0x62fc('0x4b')](handleError(_0x3d51e9,null));};exports['addDisposition']=function(_0x3d64eb,_0x557a8b,_0x376bd5){if(_0x3d64eb[_0x62fc('0x51')]['id']){delete _0x3d64eb[_0x62fc('0x51')]['id'];}return db[_0x62fc('0x32')]['find']({'where':{'id':_0x3d64eb[_0x62fc('0x4d')]['id']}})['then'](handleEntityNotFound(_0x557a8b,null))['then'](function(_0x24e194){if(_0x24e194){_0x3d64eb[_0x62fc('0x51')][_0x62fc('0x5a')]=_0x24e194['id'];return db[_0x62fc('0x5b')][_0x62fc('0x50')](_0x3d64eb[_0x62fc('0x51')]);}})[_0x62fc('0x2b')](respondWithResult(_0x557a8b,null))[_0x62fc('0x4b')](handleError(_0x557a8b,null));};exports[_0x62fc('0x5c')]=function(_0x535836,_0x235ab2,_0x371b6d){var _0x4a785a={'raw':![],'where':{}};var _0x5068da={};var _0x5f19c3={'count':0x0,'rows':[]};return db[_0x62fc('0x32')]['findOne']({'where':{'id':_0x535836['params']['id']}})[_0x62fc('0x2b')](handleEntityNotFound(_0x235ab2,null))[_0x62fc('0x2b')](function(_0x2cb4c3){if(_0x2cb4c3){_0x5068da[_0x62fc('0x35')]=_[_0x62fc('0x37')](db[_0x62fc('0x5b')]['rawAttributes']);_0x5068da[_0x62fc('0x38')]=_[_0x62fc('0x37')](_0x535836['query']);_0x5068da[_0x62fc('0x39')]=_[_0x62fc('0x3a')](_0x5068da['model'],_0x5068da[_0x62fc('0x38')]);_0x4a785a['attributes']=_[_0x62fc('0x3a')](_0x5068da[_0x62fc('0x35')],qs[_0x62fc('0x3c')](_0x535836[_0x62fc('0x38')]['fields']));_0x4a785a[_0x62fc('0x3b')]=_0x4a785a['attributes'][_0x62fc('0x3d')]?_0x4a785a['attributes']:_0x5068da['model'];if(!_0x535836['query'][_0x62fc('0x3e')]('nolimit')){_0x4a785a[_0x62fc('0x22')]=qs['limit'](_0x535836[_0x62fc('0x38')][_0x62fc('0x22')]);_0x4a785a['offset']=qs[_0x62fc('0x24')](_0x535836[_0x62fc('0x38')][_0x62fc('0x24')]);}_0x4a785a[_0x62fc('0x40')]=qs[_0x62fc('0x41')](_0x535836[_0x62fc('0x38')]['sort']);_0x4a785a[_0x62fc('0x42')]=qs[_0x62fc('0x39')](_[_0x62fc('0x43')](_0x535836['query'],_0x5068da['filters']));_0x4a785a[_0x62fc('0x42')][_0x62fc('0x5a')]=_0x2cb4c3['id'];if(_0x535836[_0x62fc('0x38')][_0x62fc('0x46')]){_0x4a785a[_0x62fc('0x42')]=_[_0x62fc('0x44')](_0x4a785a[_0x62fc('0x42')],{'$or':_[_0x62fc('0x36')](_0x4a785a[_0x62fc('0x3b')],function(_0x4c88f6){var _0x327f87={};_0x327f87[_0x4c88f6]={'$like':'%'+_0x535836[_0x62fc('0x38')][_0x62fc('0x46')]+'%'};return _0x327f87;})});}_0x4a785a=_[_0x62fc('0x44')]({},_0x4a785a,_0x535836[_0x62fc('0x47')]);return db['Disposition'][_0x62fc('0x23')]({'where':_0x4a785a[_0x62fc('0x42')]})[_0x62fc('0x2b')](function(_0x4edf07){_0x5f19c3[_0x62fc('0x23')]=_0x4edf07;if(_0x535836[_0x62fc('0x38')][_0x62fc('0x5d')]){_0x4a785a[_0x62fc('0x48')]=[{'all':!![]}];}return db[_0x62fc('0x5b')][_0x62fc('0x49')](_0x4a785a);})[_0x62fc('0x2b')](function(_0x4f2a7d){_0x5f19c3['rows']=_0x4f2a7d;return _0x5f19c3;});}})[_0x62fc('0x2b')](respondWithFilteredResult(_0x235ab2,_0x4a785a))['catch'](handleError(_0x235ab2,null));};exports[_0x62fc('0x5e')]=function(_0x3a03c3,_0x5220a3,_0x54c34c){return db[_0x62fc('0x32')][_0x62fc('0x4f')]({'where':{'id':_0x3a03c3[_0x62fc('0x4d')]['id']}})[_0x62fc('0x2b')](handleEntityNotFound(_0x5220a3,null))['then'](function(_0x345d97){if(_0x345d97){return _0x345d97[_0x62fc('0x5e')](_0x3a03c3[_0x62fc('0x38')][_0x62fc('0x5f')]);}})[_0x62fc('0x2b')](respondWithStatusCode(_0x5220a3,null))['catch'](handleError(_0x5220a3,null));};exports[_0x62fc('0x60')]=function(_0x3c1210,_0x216c76,_0x5b5ac6){return db[_0x62fc('0x32')][_0x62fc('0x4f')]({'where':{'id':_0x3c1210[_0x62fc('0x4d')]['id']}})[_0x62fc('0x2b')](handleEntityNotFound(_0x216c76,null))[_0x62fc('0x2b')](function(_0x5513e9){if(_0x5513e9){var _0x44b148=[];var _0x278f25={'success':[],'errors':[]};return db['CmContact'][_0x62fc('0x59')]()[_0x62fc('0x2b')](function(_0x34a459){if(_0x3c1210[_0x62fc('0x51')][_0x62fc('0x61')]&&_['isArray'](_0x3c1210['body'][_0x62fc('0x61')])){if(_0x3c1210[_0x62fc('0x51')]['tags']['length']){_0x3c1210[_0x62fc('0x51')][_0x62fc('0x61')]=_0x3c1210[_0x62fc('0x51')]['tags'][_0x62fc('0x62')](';')+';';}else{_0x3c1210[_0x62fc('0x51')]['tags']=null;}}else{_0x3c1210[_0x62fc('0x51')][_0x62fc('0x61')]=null;}if(_0x3c1210[_0x62fc('0x51')]&&_[_0x62fc('0x63')](_0x3c1210[_0x62fc('0x51')])){for(var _0x27133f=0x0;_0x27133f<_0x3c1210['body']['length'];_0x27133f+=0x1){_0x3c1210['body'][_0x27133f]['ListId']=_0x3c1210[_0x62fc('0x4d')]['id'];_0x44b148[_0x62fc('0x64')](_0x3c1210[_0x62fc('0x51')][_0x27133f]);}return BPromise['each'](_0x44b148,function(_0x4dcb55){return db[_0x62fc('0x65')][_0x62fc('0x50')](_['omit'](_0x4dcb55,[_0x62fc('0x5f'),'id'])||{},{'fields':_['keys'](_0x34a459),'raw':!![]})[_0x62fc('0x2b')](function(_0x1adfb0){_0x278f25[_0x62fc('0x66')]['push'](_0x1adfb0['dataValues']);})[_0x62fc('0x4b')](function(_0x441047){_0x278f25[_0x62fc('0x67')]['push']({'data':_0x4dcb55,'error':_0x441047[_0x62fc('0x68')]});});})[_0x62fc('0x2b')](function(_0x5a596e){return _0x278f25;})['catch'](function(_0x2cceb1){return _0x2cceb1;});}else{_0x216c76['status'](0x190)[_0x62fc('0x20')]({'message':_0x62fc('0x69')});}});}})[_0x62fc('0x2b')](respondWithResult(_0x216c76,null))[_0x62fc('0x4b')](handleError(_0x216c76,null));};exports[_0x62fc('0x6a')]=function(_0x4ee788,_0x53fa7b,_0x3695c0){var _0x12eead;return db[_0x62fc('0x32')][_0x62fc('0x4f')]({'where':{'id':_0x4ee788['params']['id']},'include':[{'model':db[_0x62fc('0x6b')],'as':_0x62fc('0x6c')}]})[_0x62fc('0x2b')](handleEntityNotFound(_0x53fa7b,null))[_0x62fc('0x2b')](function(_0x10bca1){if(_0x10bca1){_0x12eead=_0x10bca1;return db[_0x62fc('0x65')][_0x62fc('0x4e')];}})[_0x62fc('0x2b')](function(_0x38f774){if(_0x38f774){var _0x5e9e13={};var _0x7a9671={};_0x7a9671[_0x62fc('0x35')]=_[_0x62fc('0x6d')](_['keys'](_0x38f774),_[_0x62fc('0x36')](_0x12eead[_0x62fc('0x6c')],function(_0x5ee224){return util[_0x62fc('0x6e')](_0x62fc('0x6f'),_0x5ee224['id']);}));_0x7a9671[_0x62fc('0x38')]=_['keys'](_0x4ee788[_0x62fc('0x38')]);_0x7a9671['filters']=_[_0x62fc('0x3a')](_0x7a9671[_0x62fc('0x35')],_0x7a9671[_0x62fc('0x38')]);_0x5e9e13[_0x62fc('0x3b')]=_['intersection'](_0x7a9671[_0x62fc('0x35')],qs['fields'](_0x4ee788[_0x62fc('0x38')][_0x62fc('0x3c')]));_0x5e9e13['attributes']=_0x5e9e13[_0x62fc('0x3b')][_0x62fc('0x3d')]?_0x5e9e13['attributes']:_0x7a9671[_0x62fc('0x35')];if(!_0x4ee788[_0x62fc('0x38')][_0x62fc('0x3e')](_0x62fc('0x3f'))){_0x5e9e13[_0x62fc('0x22')]=qs[_0x62fc('0x22')](_0x4ee788['query']['limit']);_0x5e9e13[_0x62fc('0x24')]=qs[_0x62fc('0x24')](_0x4ee788[_0x62fc('0x38')][_0x62fc('0x24')]);}_0x5e9e13[_0x62fc('0x40')]=qs[_0x62fc('0x41')](_0x4ee788[_0x62fc('0x38')][_0x62fc('0x41')]);_0x5e9e13[_0x62fc('0x42')]=qs[_0x62fc('0x39')](_['pick'](_0x4ee788[_0x62fc('0x38')],_0x7a9671[_0x62fc('0x39')]));_0x5e9e13[_0x62fc('0x70')]=!![];if(_0x4ee788['query'][_0x62fc('0x46')]){_0x5e9e13['where']=_[_0x62fc('0x44')](_0x5e9e13[_0x62fc('0x42')],{'$or':_[_0x62fc('0x36')](_0x5e9e13[_0x62fc('0x3b')],function(_0x5ac607){var _0x297c8c={};_0x297c8c[_0x5ac607]={'$like':'%'+_0x4ee788[_0x62fc('0x38')]['filter']+'%'};return _0x297c8c;})});}_0x5e9e13=_[_0x62fc('0x44')]({},_0x5e9e13,_0x4ee788[_0x62fc('0x47')]);return _0x12eead[_0x62fc('0x6a')](_0x5e9e13);}})['then'](respondWithResult(_0x53fa7b,null))[_0x62fc('0x4b')](handleError(_0x53fa7b,null));};exports[_0x62fc('0x71')]=function(_0x1a8de9,_0x36cfcf,_0x46e265){var _0x4ca2d5;var _0xa02fa7;var _0x2fd358;var _0x1fca29=_0x1a8de9[_0x62fc('0x4d')]['id'];csv_results=[];return db[_0x62fc('0x72')]['findAll']({'attributes':['id',_0x62fc('0x30')],'raw':!![],'order':['OrderBy']})[_0x62fc('0x2b')](function(_0x2cf9c4){_0x4ca2d5=_0x2cf9c4;var _0x13f3ba=_['keys'](db[_0x62fc('0x65')][_0x62fc('0x4e')]);return db[_0x62fc('0x6b')][_0x62fc('0x49')]({'raw':!![],'attributes':['id',_0x62fc('0x73')]})[_0x62fc('0x2b')](function(_0x1b7540){_0xa02fa7=_0x1b7540;var _0x175d27=squel[_0x62fc('0x74')]()[_0x62fc('0x3c')](_0x13f3ba)[_0x62fc('0x75')](_0x62fc('0x76'),'c')[_0x62fc('0x42')](_0x62fc('0x77'),_0x1fca29)['where'](_0x62fc('0x78'))[_0x62fc('0x79')]();for(var _0x3f217f=0x0;_0x3f217f<_0xa02fa7['length'];_0x3f217f++){_0x175d27[_0x62fc('0x7a')](_0x62fc('0x7b')+_0xa02fa7[_0x3f217f]['id'],_0x62fc('0x7c')+_0xa02fa7[_0x3f217f]['alias']);}for(var _0x3f217f=0x0;_0x3f217f<_0x4ca2d5['length'];_0x3f217f++){_0x175d27[_0x62fc('0x7a')](squel[_0x62fc('0x74')]()[_0x62fc('0x7a')]('item')[_0x62fc('0x75')]('cm_contact_has_items')[_0x62fc('0x42')](_0x62fc('0x7d'),_0x4ca2d5[_0x3f217f]['id'])['where'](_0x62fc('0x7e')),_0x62fc('0x7f')+_0x4ca2d5[_0x3f217f][_0x62fc('0x30')]);_0x175d27[_0x62fc('0x7a')](squel[_0x62fc('0x74')]()[_0x62fc('0x7a')]('description')[_0x62fc('0x75')](_0x62fc('0x80'))[_0x62fc('0x42')]('ItemTypeId\x20=\x20?',_0x4ca2d5[_0x3f217f]['id'])[_0x62fc('0x42')](_0x62fc('0x7e')),'description_additionalPhone_'+_0x4ca2d5[_0x3f217f]['name']);}var _0xdaf5b4=[];_0xdaf5b4['push'](_0x175d27[_0x62fc('0x81')]());BPromise[_0x62fc('0x82')](_0xdaf5b4,handleQuery)[_0x62fc('0x2b')](function(_0x2f07eb){handleQuery(_0x175d27[_0x62fc('0x81')]());var _0x5984c8=csv_results[0x0];if(!_[_0x62fc('0x83')](_0x5984c8)){var _0x13730e=toCsv(_0x5984c8);var _0x9e9381=Date['now']();fs[_0x62fc('0x84')](util[_0x62fc('0x6e')]('/tmp/list_%d_%s.csv',_0x1fca29,_0x9e9381),_0x13730e);_0x36cfcf[_0x62fc('0x85')](_0x62fc('0x86'),_0x62fc('0x87')+util[_0x62fc('0x6e')](_0x62fc('0x88'),_0x1fca29,_0x9e9381));_0x36cfcf[_0x62fc('0x85')](_0x62fc('0x89'),_0x62fc('0x8a'));return _0x36cfcf[_0x62fc('0x8b')](util[_0x62fc('0x6e')]('/tmp/list_%d_%s.csv',_0x1fca29,_0x9e9381));}else{return _0x36cfcf[_0x62fc('0x8c')](0xcc);}});});});};exports[_0x62fc('0x8d')]=function(_0x17a8e7,_0x169523,_0xa7b33b){var _0x4c6d30;delete _0x17a8e7[_0x62fc('0x51')]['id'];return db[_0x62fc('0x32')]['findOne']({'where':{'id':_0x17a8e7[_0x62fc('0x4d')]['id']}})[_0x62fc('0x2b')](handleEntityNotFound(_0x169523,null))['then'](function(_0x37d398){if(_0x37d398){return db[_0x62fc('0x8e')][_0x62fc('0x8f')](function(_0x109425){return db[_0x62fc('0x6b')][_0x62fc('0x50')](_0x17a8e7[_0x62fc('0x51')],{'transaction':_0x109425})[_0x62fc('0x2b')](function(_0x590dfa){_0x4c6d30=_0x590dfa;return _0x37d398[_0x62fc('0x90')](_0x590dfa,{'transaction':_0x109425});})[_0x62fc('0x2b')](function(){var _0x2eb7a2={'type':db[_0x62fc('0x91')][_0x62fc('0x92')],'transaction':_0x109425};switch(_0x17a8e7[_0x62fc('0x51')][_0x62fc('0x45')]){case _0x62fc('0x93'):_0x2eb7a2['type']=db[_0x62fc('0x91')][_0x62fc('0x92')];break;case _0x62fc('0x94'):_0x2eb7a2['type']=db[_0x62fc('0x91')][_0x62fc('0x95')];break;case'switch':_0x2eb7a2[_0x62fc('0x45')]=db[_0x62fc('0x91')][_0x62fc('0x96')];_0x2eb7a2[_0x62fc('0x97')]=![];break;default:}return db['sequelize'][_0x62fc('0x98')][_0x62fc('0x99')](_0x62fc('0x76'),util[_0x62fc('0x6e')]('cf_%s',_0x4c6d30['id']),_0x2eb7a2);})[_0x62fc('0x2b')](function(){return _0x4c6d30;});});}})[_0x62fc('0x2b')](respondWithResult(_0x169523,null))[_0x62fc('0x4b')](handleError(_0x169523,null));};exports[_0x62fc('0x9a')]=function(_0x2cd93d,_0xbecfcb,_0x5c21db){var _0x2ca518={};var _0x656599={};var _0x325f9e;var _0x26f55f;return db[_0x62fc('0x32')][_0x62fc('0x9b')]({'where':{'id':_0x2cd93d[_0x62fc('0x4d')]['id']}})[_0x62fc('0x2b')](handleEntityNotFound(_0xbecfcb,null))[_0x62fc('0x2b')](function(_0x3a2c6a){if(_0x3a2c6a){_0x325f9e=_0x3a2c6a;_0x656599[_0x62fc('0x35')]=_[_0x62fc('0x37')](db[_0x62fc('0x6b')][_0x62fc('0x4e')]);_0x656599['query']=_[_0x62fc('0x37')](_0x2cd93d[_0x62fc('0x38')]);_0x656599[_0x62fc('0x39')]=_[_0x62fc('0x3a')](_0x656599[_0x62fc('0x35')],_0x656599['query']);_0x2ca518['attributes']=_['intersection'](_0x656599[_0x62fc('0x35')],qs[_0x62fc('0x3c')](_0x2cd93d['query'][_0x62fc('0x3c')]));_0x2ca518['attributes']=_0x2ca518['attributes'][_0x62fc('0x3d')]?_0x2ca518['attributes']:_0x656599[_0x62fc('0x35')];_0x2ca518[_0x62fc('0x40')]=qs['sort'](_0x2cd93d['query'][_0x62fc('0x41')]);_0x2ca518[_0x62fc('0x42')]=qs[_0x62fc('0x39')](_[_0x62fc('0x43')](_0x2cd93d[_0x62fc('0x38')],_0x656599[_0x62fc('0x39')]));_0x2ca518[_0x62fc('0x42')]=_['merge'](_0x2ca518[_0x62fc('0x42')],{'$or':[{'ListId':_0x3a2c6a['id']},{'ListId':null}]});if(_0x2cd93d['query']['filter']){_0x2ca518['where']=_['merge'](_0x2ca518[_0x62fc('0x42')],{'$or':_[_0x62fc('0x36')](_0x2ca518['attributes'],function(_0xabd5fd){var _0x26ff98={};_0x26ff98[_0xabd5fd]={'$like':'%'+_0x2cd93d[_0x62fc('0x38')][_0x62fc('0x46')]+'%'};return _0x26ff98;})});}_0x2ca518=_['merge']({},_0x2ca518,_0x2cd93d[_0x62fc('0x47')]);return db[_0x62fc('0x6b')][_0x62fc('0x9c')](_0x2ca518);}})[_0x62fc('0x2b')](respondWithResult(_0xbecfcb,null))[_0x62fc('0x4b')](handleError(_0xbecfcb,null));};exports[_0x62fc('0x9d')]=function(_0x465ee2,_0x2a9b6a){return db['CmCustomField'][_0x62fc('0x9c')]({'where':{'ListId':null}})[_0x62fc('0x2b')](handleEntityNotFound(_0x2a9b6a,null))[_0x62fc('0x2b')](function(_0x48be24){return _0x48be24;})['then'](respondWithResult(_0x2a9b6a,null))[_0x62fc('0x4b')](handleError(_0x2a9b6a,null));};exports[_0x62fc('0x9e')]=function(_0xd57221,_0x581a20,_0x310984){return db[_0x62fc('0x32')]['find']({'where':{'id':_0xd57221[_0x62fc('0x4d')]['id']}})[_0x62fc('0x2b')](handleEntityNotFound(_0x581a20,null))['then'](function(_0x685b4a){if(_0x685b4a){return _0x685b4a[_0x62fc('0x9e')](_0xd57221[_0x62fc('0x51')][_0x62fc('0x5f')],_['omit'](_0xd57221[_0x62fc('0x51')],[_0x62fc('0x5f'),'id'])||{})[_0x62fc('0x9f')](function(_0x2f2538){for(var _0x4c59e4=0x0;_0x4c59e4<_0xd57221[_0x62fc('0x51')][_0x62fc('0x5f')][_0x62fc('0x3d')];_0x4c59e4+=0x1){socket['emit'](_0x62fc('0xa0'),{'UserId':Number(_0xd57221[_0x62fc('0x51')][_0x62fc('0x5f')][_0x4c59e4]),'CmListId':Number(_0xd57221['params']['id'])});}return _0x2f2538;});}})[_0x62fc('0x2b')](respondWithResult(_0x581a20,null))[_0x62fc('0x4b')](handleError(_0x581a20,null));};exports['removeAgents']=function(_0x339695,_0x1898fd,_0x2ff473){return db[_0x62fc('0x32')]['find']({'where':{'id':_0x339695[_0x62fc('0x4d')]['id']}})[_0x62fc('0x2b')](handleEntityNotFound(_0x1898fd,null))['then'](function(_0x5d8c86){if(_0x5d8c86){return _0x5d8c86[_0x62fc('0xa1')](_0x339695[_0x62fc('0x38')][_0x62fc('0x5f')])['then'](function(){if(_[_0x62fc('0x63')](_0x339695[_0x62fc('0x38')][_0x62fc('0x5f')])){for(var _0xd8d909=0x0;_0xd8d909<_0x339695['query'][_0x62fc('0x5f')][_0x62fc('0x3d')];_0xd8d909+=0x1){socket[_0x62fc('0xa2')]('userCmList:remove',{'UserId':Number(_0x339695[_0x62fc('0x38')][_0x62fc('0x5f')][_0xd8d909]),'CmListId':Number(_0x339695[_0x62fc('0x4d')]['id'])});}}else{socket[_0x62fc('0xa2')]('userCmList:remove',{'UserId':Number(_0x339695[_0x62fc('0x38')][_0x62fc('0x5f')]),'CmListId':Number(_0x339695[_0x62fc('0x4d')]['id'])});}});}})[_0x62fc('0x2b')](respondWithStatusCode(_0x1898fd,null))['catch'](handleError(_0x1898fd,null));};exports[_0x62fc('0xa3')]=function(_0x5a92e2,_0x1a0769,_0x32e787){var _0x3884b={};var _0x528691={};var _0x5ecd5c;var _0x47f70e;return db[_0x62fc('0x32')]['findOne']({'where':{'id':_0x5a92e2[_0x62fc('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1a0769,null))[_0x62fc('0x2b')](function(_0x5268a5){if(_0x5268a5){_0x5ecd5c=_0x5268a5;_0x528691[_0x62fc('0x35')]=_['keys'](db[_0x62fc('0xa4')][_0x62fc('0x4e')]);_0x528691[_0x62fc('0x38')]=_[_0x62fc('0x37')](_0x5a92e2['query']);_0x528691[_0x62fc('0x39')]=_[_0x62fc('0x3a')](_0x528691['model'],_0x528691[_0x62fc('0x38')]);_0x3884b[_0x62fc('0x3b')]=_[_0x62fc('0x3a')](_0x528691[_0x62fc('0x35')],qs[_0x62fc('0x3c')](_0x5a92e2[_0x62fc('0x38')][_0x62fc('0x3c')]));_0x3884b[_0x62fc('0x3b')]=_0x3884b['attributes'][_0x62fc('0x3d')]?_0x3884b[_0x62fc('0x3b')]:_0x528691[_0x62fc('0x35')];_0x3884b[_0x62fc('0x40')]=qs[_0x62fc('0x41')](_0x5a92e2[_0x62fc('0x38')][_0x62fc('0x41')]);_0x3884b[_0x62fc('0x42')]=qs[_0x62fc('0x39')](_[_0x62fc('0x43')](_0x5a92e2[_0x62fc('0x38')],_0x528691[_0x62fc('0x39')]));if(_0x5a92e2[_0x62fc('0x38')][_0x62fc('0x46')]){_0x3884b[_0x62fc('0x42')]=_[_0x62fc('0x44')](_0x3884b[_0x62fc('0x42')],{'$or':_[_0x62fc('0x36')](_0x3884b[_0x62fc('0x3b')],function(_0xe4f485){var _0x47cb1a={};_0x47cb1a[_0xe4f485]={'$like':'%'+_0x5a92e2[_0x62fc('0x38')][_0x62fc('0x46')]+'%'};return _0x47cb1a;})});}_0x3884b=_[_0x62fc('0x44')]({},_0x3884b,_0x5a92e2[_0x62fc('0x47')]);return _0x5ecd5c[_0x62fc('0xa3')](_0x3884b);}})[_0x62fc('0x2b')](function(_0xf9cf85){if(_0xf9cf85){_0x47f70e=_0xf9cf85[_0x62fc('0x3d')];if(!_0x5a92e2[_0x62fc('0x38')][_0x62fc('0x3e')](_0x62fc('0x3f'))){_0x3884b[_0x62fc('0x22')]=qs[_0x62fc('0x22')](_0x5a92e2[_0x62fc('0x38')]['limit']);_0x3884b['offset']=qs[_0x62fc('0x24')](_0x5a92e2['query']['offset']);}return _0x5ecd5c['getAgents'](_0x3884b);}})['then'](function(_0x4bbe22){if(_0x4bbe22){return _0x4bbe22?{'count':_0x47f70e,'rows':_0x4bbe22}:null;}})[_0x62fc('0x2b')](respondWithResult(_0x1a0769,null))[_0x62fc('0x4b')](handleError(_0x1a0769,null));};function handleQuery(_0x359c64){logger[_0x62fc('0xa5')](_0x359c64);return db[_0x62fc('0x8e')][_0x62fc('0x38')](_0x359c64)[_0x62fc('0x9f')](function(_0x8ddcd3){csv_results[_0x62fc('0x64')](_0x8ddcd3);})[_0x62fc('0x4b')](function(_0x497256){logger[_0x62fc('0x57')](_0x497256[_0x62fc('0x68')]);});} \ No newline at end of file +var _0xb707=['moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./cmList.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Lists','UserProfileResource','error','name','send','index','map','CmList','fieldName','key','keys','query','filters','intersection','model','attributes','length','nolimit','order','pick','filter','where','merge','type','VIRTUAL','options','include','rows','catch','params','rawAttributes','fields','find','create','body','user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','getDispositions','findOne','hasOwnProperty','sort','includeAll','findAll','removeDispositions','addContacts','CmContact','tags','isArray','push','each','omit','ids','dataValues','errors','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','format','cf_%d','getContacts','OrderBy','alias','select','cm_contacts','c.ListId\x20=\x20?','distinct','field','item','ItemTypeId\x20=\x20?','from','cm_contact_has_items','description_additionalPhone_','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-type','text/csv','download','sequelize','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','userCmList:remove','getAgents','User','info','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x4b043b,_0x598b17){var _0x398f5a=function(_0x59bea2){while(--_0x59bea2){_0x4b043b['push'](_0x4b043b['shift']());}};_0x398f5a(++_0x598b17);}(_0xb707,0x9a));var _0x7b70=function(_0x367ea3,_0x1f6b26){_0x367ea3=_0x367ea3-0x0;var _0x1f2d9a=_0xb707[_0x367ea3];return _0x1f2d9a;};'use strict';var emlformat=require(_0x7b70('0x0'));var rimraf=require(_0x7b70('0x1'));var zipdir=require(_0x7b70('0x2'));var jsonpatch=require(_0x7b70('0x3'));var rp=require('request-promise');var moment=require(_0x7b70('0x4'));var BPromise=require(_0x7b70('0x5'));var Mustache=require(_0x7b70('0x6'));var util=require('util');var path=require(_0x7b70('0x7'));var sox=require(_0x7b70('0x8'));var csv=require(_0x7b70('0x9'));var ejs=require(_0x7b70('0xa'));var fs=require('fs');var fs_extra=require(_0x7b70('0xb'));var _=require(_0x7b70('0xc'));var squel=require(_0x7b70('0xd'));var crypto=require('crypto');var jsforce=require(_0x7b70('0xe'));var deskjs=require(_0x7b70('0xf'));var toCsv=require(_0x7b70('0x9'));var querystring=require(_0x7b70('0x10'));var Papa=require(_0x7b70('0x11'));var Redis=require(_0x7b70('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7b70('0x13'));var as=require(_0x7b70('0x14'));var hardwareService=require(_0x7b70('0x15'));var logger=require(_0x7b70('0x16'))(_0x7b70('0x17'));var utils=require(_0x7b70('0x18'));var config=require(_0x7b70('0x19'));var licenseUtil=require(_0x7b70('0x1a'));var db=require(_0x7b70('0x1b'))['db'];var csv_results;config[_0x7b70('0x1c')]=_[_0x7b70('0x1d')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7b70('0x1e'))[_0x7b70('0x1f')](socket);function respondWithStatusCode(_0x49858a,_0x65492f){_0x65492f=_0x65492f||0xcc;return function(_0x4bb593){if(_0x4bb593){return _0x49858a[_0x7b70('0x20')](_0x65492f);}return _0x49858a[_0x7b70('0x21')](_0x65492f)[_0x7b70('0x22')]();};}function respondWithResult(_0x457aa2,_0x164491){_0x164491=_0x164491||0xc8;return function(_0x5c21d5){if(_0x5c21d5){return _0x457aa2[_0x7b70('0x21')](_0x164491)[_0x7b70('0x23')](_0x5c21d5);}};}function respondWithFilteredResult(_0x1a2834,_0x3fb230){return function(_0x3fbb82){if(_0x3fbb82){var _0x5d78ca=typeof _0x3fb230[_0x7b70('0x24')]==='undefined'&&typeof _0x3fb230[_0x7b70('0x25')]===_0x7b70('0x26');var _0x4c8581=_0x3fbb82[_0x7b70('0x27')];var _0x5280ee=_0x5d78ca?0x0:_0x3fb230[_0x7b70('0x24')];var _0x5ba16a=_0x5d78ca?_0x3fbb82[_0x7b70('0x27')]:_0x3fb230[_0x7b70('0x24')]+_0x3fb230[_0x7b70('0x25')];var _0x379afd;if(_0x5ba16a>=_0x4c8581){_0x5ba16a=_0x4c8581;_0x379afd=0xc8;}else{_0x379afd=0xce;}_0x1a2834[_0x7b70('0x21')](_0x379afd);return _0x1a2834[_0x7b70('0x28')](_0x7b70('0x29'),_0x5280ee+'-'+_0x5ba16a+'/'+_0x4c8581)[_0x7b70('0x23')](_0x3fbb82);}return null;};}function patchUpdates(_0x19ee59){return function(_0x412fa6){try{jsonpatch[_0x7b70('0x2a')](_0x412fa6,_0x19ee59,!![]);}catch(_0x32e8d8){return BPromise[_0x7b70('0x2b')](_0x32e8d8);}return _0x412fa6[_0x7b70('0x2c')]();};}function saveUpdates(_0x449a8b,_0x37c539){return function(_0x4e9bdb){if(_0x4e9bdb){return _0x4e9bdb[_0x7b70('0x2d')](_0x449a8b)[_0x7b70('0x2e')](function(_0x42f9b4){return _0x42f9b4;});}return null;};}function removeEntity(_0x395314,_0x2550f6){return function(_0x9da23){if(_0x9da23){return _0x9da23[_0x7b70('0x2f')]()['then'](function(){var _0x351762=_0x9da23[_0x7b70('0x30')]({'plain':!![]});var _0x2c713c=_0x7b70('0x31');return db[_0x7b70('0x32')]['destroy']({'where':{'type':_0x2c713c,'resourceId':_0x351762['id']}})['then'](function(){return _0x9da23;});})['then'](function(){_0x395314[_0x7b70('0x21')](0xcc)[_0x7b70('0x22')]();});}};}function handleEntityNotFound(_0x52cd4e,_0x443a5c){return function(_0x4e1097){if(!_0x4e1097){_0x52cd4e[_0x7b70('0x20')](0x194);}return _0x4e1097;};}function handleError(_0x42692a,_0x24107c){_0x24107c=_0x24107c||0x1f4;return function(_0x37e1cc){logger[_0x7b70('0x33')](_0x37e1cc['stack']);if(_0x37e1cc[_0x7b70('0x34')]){delete _0x37e1cc[_0x7b70('0x34')];}_0x42692a[_0x7b70('0x21')](_0x24107c)[_0x7b70('0x35')](_0x37e1cc);};}exports[_0x7b70('0x36')]=function(_0x43ef53,_0x49d43f){var _0x3c1edc={},_0x3d0106={},_0x32feed={'count':0x0,'rows':[]};var _0xe2ac01=_[_0x7b70('0x37')](db[_0x7b70('0x38')]['rawAttributes'],function(_0x5c77d0){return{'name':_0x5c77d0[_0x7b70('0x39')],'type':_0x5c77d0['type'][_0x7b70('0x3a')]};});_0x3d0106['model']=_[_0x7b70('0x37')](_0xe2ac01,'name');_0x3d0106['query']=_[_0x7b70('0x3b')](_0x43ef53[_0x7b70('0x3c')]);_0x3d0106[_0x7b70('0x3d')]=_[_0x7b70('0x3e')](_0x3d0106[_0x7b70('0x3f')],_0x3d0106[_0x7b70('0x3c')]);_0x3c1edc[_0x7b70('0x40')]=_['intersection'](_0x3d0106[_0x7b70('0x3f')],qs['fields'](_0x43ef53[_0x7b70('0x3c')]['fields']));_0x3c1edc[_0x7b70('0x40')]=_0x3c1edc['attributes'][_0x7b70('0x41')]?_0x3c1edc[_0x7b70('0x40')]:_0x3d0106['model'];if(!_0x43ef53[_0x7b70('0x3c')]['hasOwnProperty'](_0x7b70('0x42'))){_0x3c1edc[_0x7b70('0x25')]=qs[_0x7b70('0x25')](_0x43ef53[_0x7b70('0x3c')][_0x7b70('0x25')]);_0x3c1edc[_0x7b70('0x24')]=qs[_0x7b70('0x24')](_0x43ef53[_0x7b70('0x3c')]['offset']);}_0x3c1edc[_0x7b70('0x43')]=qs['sort'](_0x43ef53['query']['sort']);_0x3c1edc['where']=qs['filters'](_[_0x7b70('0x44')](_0x43ef53[_0x7b70('0x3c')],_0x3d0106[_0x7b70('0x3d')]),_0xe2ac01);if(_0x43ef53['query'][_0x7b70('0x45')]){_0x3c1edc[_0x7b70('0x46')]=_[_0x7b70('0x47')](_0x3c1edc[_0x7b70('0x46')],{'$or':_['map'](_0xe2ac01,function(_0x32f626){if(_0x32f626[_0x7b70('0x48')]!==_0x7b70('0x49')){var _0x217e38={};_0x217e38[_0x32f626[_0x7b70('0x34')]]={'$like':'%'+_0x43ef53[_0x7b70('0x3c')][_0x7b70('0x45')]+'%'};return _0x217e38;}})});}_0x3c1edc=_[_0x7b70('0x47')]({},_0x3c1edc,_0x43ef53[_0x7b70('0x4a')]);var _0x421a41={'where':_0x3c1edc[_0x7b70('0x46')]};return db['CmList']['count'](_0x421a41)[_0x7b70('0x2e')](function(_0x48fe5b){_0x32feed['count']=_0x48fe5b;if(_0x43ef53[_0x7b70('0x3c')]['includeAll']){_0x3c1edc[_0x7b70('0x4b')]=[{'all':!![]}];}return db[_0x7b70('0x38')]['findAll'](_0x3c1edc);})[_0x7b70('0x2e')](function(_0x337d6f){_0x32feed[_0x7b70('0x4c')]=_0x337d6f;return _0x32feed;})['then'](respondWithFilteredResult(_0x49d43f,_0x3c1edc))[_0x7b70('0x4d')](handleError(_0x49d43f,null));};exports['show']=function(_0x426adc,_0x4f184b){var _0x26373a={'raw':![],'where':{'id':_0x426adc[_0x7b70('0x4e')]['id']}},_0x46535f={};_0x46535f['model']=_[_0x7b70('0x3b')](db[_0x7b70('0x38')][_0x7b70('0x4f')]);_0x46535f[_0x7b70('0x3c')]=_[_0x7b70('0x3b')](_0x426adc[_0x7b70('0x3c')]);_0x46535f['filters']=_[_0x7b70('0x3e')](_0x46535f[_0x7b70('0x3f')],_0x46535f[_0x7b70('0x3c')]);_0x26373a[_0x7b70('0x40')]=_[_0x7b70('0x3e')](_0x46535f[_0x7b70('0x3f')],qs['fields'](_0x426adc[_0x7b70('0x3c')][_0x7b70('0x50')]));_0x26373a[_0x7b70('0x40')]=_0x26373a['attributes']['length']?_0x26373a[_0x7b70('0x40')]:_0x46535f['model'];if(_0x426adc[_0x7b70('0x3c')]['includeAll']){_0x26373a[_0x7b70('0x4b')]=[{'all':!![]}];}_0x26373a=_[_0x7b70('0x47')]({},_0x26373a,_0x426adc['options']);return db[_0x7b70('0x38')][_0x7b70('0x51')](_0x26373a)[_0x7b70('0x2e')](handleEntityNotFound(_0x4f184b,null))[_0x7b70('0x2e')](respondWithResult(_0x4f184b,null))[_0x7b70('0x4d')](handleError(_0x4f184b,null));};exports[_0x7b70('0x52')]=function(_0x1f78bd,_0x458cf8){return db['CmList'][_0x7b70('0x52')](_0x1f78bd[_0x7b70('0x53')],{})[_0x7b70('0x2e')](function(_0x14fbf6){var _0x4c4e90=_0x1f78bd[_0x7b70('0x54')][_0x7b70('0x30')]({'plain':!![]});if(!_0x4c4e90)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c4e90[_0x7b70('0x55')]==='user'){var _0x13a840=_0x14fbf6[_0x7b70('0x30')]({'plain':!![]});var _0x4dc76f=_0x7b70('0x31');return db['UserProfileSection'][_0x7b70('0x51')]({'where':{'name':_0x4dc76f,'userProfileId':_0x4c4e90['userProfileId']},'raw':!![]})[_0x7b70('0x2e')](function(_0x726284){if(_0x726284&&_0x726284['autoAssociation']===0x0){return db['UserProfileResource'][_0x7b70('0x52')]({'name':_0x13a840[_0x7b70('0x34')],'resourceId':_0x13a840['id'],'type':_0x726284[_0x7b70('0x34')],'sectionId':_0x726284['id']},{})[_0x7b70('0x2e')](function(){return _0x14fbf6;});}else{return _0x14fbf6;}})[_0x7b70('0x4d')](function(_0x1f061b){logger[_0x7b70('0x33')](_0x7b70('0x56'),_0x1f061b);throw _0x1f061b;});}return _0x14fbf6;})[_0x7b70('0x2e')](respondWithResult(_0x458cf8,0xc9))[_0x7b70('0x4d')](handleError(_0x458cf8,null));};exports['update']=function(_0x3fdc68,_0x15308a){if(_0x3fdc68[_0x7b70('0x53')]['id']){delete _0x3fdc68[_0x7b70('0x53')]['id'];}return db[_0x7b70('0x38')][_0x7b70('0x51')]({'where':{'id':_0x3fdc68[_0x7b70('0x4e')]['id']}})[_0x7b70('0x2e')](handleEntityNotFound(_0x15308a,null))[_0x7b70('0x2e')](saveUpdates(_0x3fdc68[_0x7b70('0x53')],null))[_0x7b70('0x2e')](respondWithResult(_0x15308a,null))[_0x7b70('0x4d')](handleError(_0x15308a,null));};exports[_0x7b70('0x2f')]=function(_0x3e9aac,_0x797e47){return db[_0x7b70('0x38')]['find']({'where':{'id':_0x3e9aac[_0x7b70('0x4e')]['id']}})['then'](handleEntityNotFound(_0x797e47,null))[_0x7b70('0x2e')](removeEntity(_0x797e47,null))['catch'](handleError(_0x797e47,null));};exports[_0x7b70('0x57')]=function(_0x3fd763,_0x447c81){return db['CmList'][_0x7b70('0x57')]()[_0x7b70('0x2e')](respondWithResult(_0x447c81,null))['catch'](handleError(_0x447c81,null));};exports[_0x7b70('0x58')]=function(_0x16923d,_0x10c1dc,_0x24b68f){if(_0x16923d[_0x7b70('0x53')]['id']){delete _0x16923d[_0x7b70('0x53')]['id'];}return db[_0x7b70('0x38')]['find']({'where':{'id':_0x16923d['params']['id']}})[_0x7b70('0x2e')](handleEntityNotFound(_0x10c1dc,null))['then'](function(_0x16da9f){if(_0x16da9f){_0x16923d[_0x7b70('0x53')][_0x7b70('0x59')]=_0x16da9f['id'];return db[_0x7b70('0x5a')][_0x7b70('0x52')](_0x16923d[_0x7b70('0x53')]);}})[_0x7b70('0x2e')](respondWithResult(_0x10c1dc,null))[_0x7b70('0x4d')](handleError(_0x10c1dc,null));};exports[_0x7b70('0x5b')]=function(_0x74af7f,_0x11ecdc,_0xdfcfb6){var _0x5feef={'raw':![],'where':{}};var _0x1e17b8={};var _0x44d7a7={'count':0x0,'rows':[]};return db[_0x7b70('0x38')][_0x7b70('0x5c')]({'where':{'id':_0x74af7f[_0x7b70('0x4e')]['id']}})[_0x7b70('0x2e')](handleEntityNotFound(_0x11ecdc,null))[_0x7b70('0x2e')](function(_0x4edfb9){if(_0x4edfb9){_0x1e17b8[_0x7b70('0x3f')]=_[_0x7b70('0x3b')](db[_0x7b70('0x5a')][_0x7b70('0x4f')]);_0x1e17b8['query']=_[_0x7b70('0x3b')](_0x74af7f['query']);_0x1e17b8['filters']=_[_0x7b70('0x3e')](_0x1e17b8[_0x7b70('0x3f')],_0x1e17b8[_0x7b70('0x3c')]);_0x5feef[_0x7b70('0x40')]=_[_0x7b70('0x3e')](_0x1e17b8[_0x7b70('0x3f')],qs[_0x7b70('0x50')](_0x74af7f[_0x7b70('0x3c')][_0x7b70('0x50')]));_0x5feef[_0x7b70('0x40')]=_0x5feef['attributes']['length']?_0x5feef['attributes']:_0x1e17b8['model'];if(!_0x74af7f[_0x7b70('0x3c')][_0x7b70('0x5d')](_0x7b70('0x42'))){_0x5feef['limit']=qs['limit'](_0x74af7f['query'][_0x7b70('0x25')]);_0x5feef[_0x7b70('0x24')]=qs['offset'](_0x74af7f['query'][_0x7b70('0x24')]);}_0x5feef['order']=qs[_0x7b70('0x5e')](_0x74af7f[_0x7b70('0x3c')][_0x7b70('0x5e')]);_0x5feef[_0x7b70('0x46')]=qs[_0x7b70('0x3d')](_[_0x7b70('0x44')](_0x74af7f['query'],_0x1e17b8['filters']));_0x5feef[_0x7b70('0x46')][_0x7b70('0x59')]=_0x4edfb9['id'];if(_0x74af7f[_0x7b70('0x3c')][_0x7b70('0x45')]){_0x5feef['where']=_[_0x7b70('0x47')](_0x5feef[_0x7b70('0x46')],{'$or':_[_0x7b70('0x37')](_0x5feef[_0x7b70('0x40')],function(_0x52a95f){var _0x4c627a={};_0x4c627a[_0x52a95f]={'$like':'%'+_0x74af7f[_0x7b70('0x3c')][_0x7b70('0x45')]+'%'};return _0x4c627a;})});}_0x5feef=_[_0x7b70('0x47')]({},_0x5feef,_0x74af7f[_0x7b70('0x4a')]);return db[_0x7b70('0x5a')]['count']({'where':_0x5feef[_0x7b70('0x46')]})[_0x7b70('0x2e')](function(_0x5d71e8){_0x44d7a7['count']=_0x5d71e8;if(_0x74af7f[_0x7b70('0x3c')][_0x7b70('0x5f')]){_0x5feef[_0x7b70('0x4b')]=[{'all':!![]}];}return db['Disposition'][_0x7b70('0x60')](_0x5feef);})[_0x7b70('0x2e')](function(_0x449d71){_0x44d7a7[_0x7b70('0x4c')]=_0x449d71;return _0x44d7a7;});}})[_0x7b70('0x2e')](respondWithFilteredResult(_0x11ecdc,_0x5feef))[_0x7b70('0x4d')](handleError(_0x11ecdc,null));};exports[_0x7b70('0x61')]=function(_0x21961b,_0x1004f9,_0x93b945){return db[_0x7b70('0x38')][_0x7b70('0x51')]({'where':{'id':_0x21961b['params']['id']}})['then'](handleEntityNotFound(_0x1004f9,null))[_0x7b70('0x2e')](function(_0xf34c20){if(_0xf34c20){return _0xf34c20[_0x7b70('0x61')](_0x21961b[_0x7b70('0x3c')]['ids']);}})['then'](respondWithStatusCode(_0x1004f9,null))[_0x7b70('0x4d')](handleError(_0x1004f9,null));};exports[_0x7b70('0x62')]=function(_0x3131c3,_0x272576,_0x1a10ba){return db[_0x7b70('0x38')]['find']({'where':{'id':_0x3131c3['params']['id']}})[_0x7b70('0x2e')](handleEntityNotFound(_0x272576,null))[_0x7b70('0x2e')](function(_0x31e5e0){if(_0x31e5e0){var _0x577f03=[];var _0x4147a8={'success':[],'errors':[]};return db[_0x7b70('0x63')][_0x7b70('0x57')]()['then'](function(_0x21b3e3){if(_0x3131c3['body']['tags']&&_['isArray'](_0x3131c3[_0x7b70('0x53')][_0x7b70('0x64')])){if(_0x3131c3['body'][_0x7b70('0x64')][_0x7b70('0x41')]){_0x3131c3['body']['tags']=_0x3131c3[_0x7b70('0x53')][_0x7b70('0x64')]['join'](';')+';';}else{_0x3131c3['body']['tags']=null;}}else{_0x3131c3[_0x7b70('0x53')][_0x7b70('0x64')]=null;}if(_0x3131c3[_0x7b70('0x53')]&&_[_0x7b70('0x65')](_0x3131c3[_0x7b70('0x53')])){for(var _0x7b5153=0x0;_0x7b5153<_0x3131c3['body'][_0x7b70('0x41')];_0x7b5153+=0x1){_0x3131c3['body'][_0x7b5153]['ListId']=_0x3131c3[_0x7b70('0x4e')]['id'];_0x577f03[_0x7b70('0x66')](_0x3131c3[_0x7b70('0x53')][_0x7b5153]);}return BPromise[_0x7b70('0x67')](_0x577f03,function(_0x23d2d4){return db[_0x7b70('0x63')][_0x7b70('0x52')](_[_0x7b70('0x68')](_0x23d2d4,[_0x7b70('0x69'),'id'])||{},{'fields':_[_0x7b70('0x3b')](_0x21b3e3),'raw':!![]})['then'](function(_0x564715){_0x4147a8['success'][_0x7b70('0x66')](_0x564715[_0x7b70('0x6a')]);})[_0x7b70('0x4d')](function(_0x10cdb2){_0x4147a8[_0x7b70('0x6b')][_0x7b70('0x66')]({'data':_0x23d2d4,'error':_0x10cdb2[_0x7b70('0x6c')]});});})[_0x7b70('0x2e')](function(_0x3fb6a0){return _0x4147a8;})[_0x7b70('0x4d')](function(_0x4e6532){return _0x4e6532;});}else{_0x272576[_0x7b70('0x21')](0x190)['json']({'message':_0x7b70('0x6d')});}});}})[_0x7b70('0x2e')](respondWithResult(_0x272576,null))[_0x7b70('0x4d')](handleError(_0x272576,null));};exports['getContacts']=function(_0x339349,_0x32e016,_0x207576){var _0x15c76e;return db['CmList']['find']({'where':{'id':_0x339349[_0x7b70('0x4e')]['id']},'include':[{'model':db[_0x7b70('0x6e')],'as':_0x7b70('0x6f')}]})[_0x7b70('0x2e')](handleEntityNotFound(_0x32e016,null))['then'](function(_0x101d5f){if(_0x101d5f){_0x15c76e=_0x101d5f;return db[_0x7b70('0x63')]['rawAttributes'];}})['then'](function(_0x5a4663){if(_0x5a4663){var _0x16aa43={};var _0x6b317b={};_0x6b317b['model']=_['concat'](_[_0x7b70('0x3b')](_0x5a4663),_[_0x7b70('0x37')](_0x15c76e['CustomFields'],function(_0x86342c){return util[_0x7b70('0x70')](_0x7b70('0x71'),_0x86342c['id']);}));_0x6b317b[_0x7b70('0x3c')]=_[_0x7b70('0x3b')](_0x339349['query']);_0x6b317b[_0x7b70('0x3d')]=_[_0x7b70('0x3e')](_0x6b317b[_0x7b70('0x3f')],_0x6b317b[_0x7b70('0x3c')]);_0x16aa43[_0x7b70('0x40')]=_['intersection'](_0x6b317b['model'],qs[_0x7b70('0x50')](_0x339349['query'][_0x7b70('0x50')]));_0x16aa43['attributes']=_0x16aa43[_0x7b70('0x40')][_0x7b70('0x41')]?_0x16aa43[_0x7b70('0x40')]:_0x6b317b[_0x7b70('0x3f')];if(!_0x339349['query']['hasOwnProperty'](_0x7b70('0x42'))){_0x16aa43['limit']=qs[_0x7b70('0x25')](_0x339349[_0x7b70('0x3c')][_0x7b70('0x25')]);_0x16aa43['offset']=qs[_0x7b70('0x24')](_0x339349[_0x7b70('0x3c')]['offset']);}_0x16aa43[_0x7b70('0x43')]=qs[_0x7b70('0x5e')](_0x339349[_0x7b70('0x3c')][_0x7b70('0x5e')]);_0x16aa43[_0x7b70('0x46')]=qs[_0x7b70('0x3d')](_[_0x7b70('0x44')](_0x339349[_0x7b70('0x3c')],_0x6b317b[_0x7b70('0x3d')]));_0x16aa43['raw']=!![];if(_0x339349[_0x7b70('0x3c')][_0x7b70('0x45')]){_0x16aa43[_0x7b70('0x46')]=_[_0x7b70('0x47')](_0x16aa43[_0x7b70('0x46')],{'$or':_[_0x7b70('0x37')](_0x16aa43[_0x7b70('0x40')],function(_0x113863){var _0xe36cf5={};_0xe36cf5[_0x113863]={'$like':'%'+_0x339349[_0x7b70('0x3c')][_0x7b70('0x45')]+'%'};return _0xe36cf5;})});}_0x16aa43=_[_0x7b70('0x47')]({},_0x16aa43,_0x339349['options']);return _0x15c76e[_0x7b70('0x72')](_0x16aa43);}})[_0x7b70('0x2e')](respondWithResult(_0x32e016,null))[_0x7b70('0x4d')](handleError(_0x32e016,null));};exports['getContactsCsv']=function(_0x2383cd,_0x4c1fe7,_0x306db0){var _0x5d04b2;var _0x58c95b;var _0x657132;var _0x2edfce=_0x2383cd[_0x7b70('0x4e')]['id'];csv_results=[];return db['ContactItemType'][_0x7b70('0x60')]({'attributes':['id',_0x7b70('0x34')],'raw':!![],'order':[_0x7b70('0x73')]})['then'](function(_0x2fbb06){_0x5d04b2=_0x2fbb06;var _0x526d31=_[_0x7b70('0x3b')](db[_0x7b70('0x63')][_0x7b70('0x4f')]);return db[_0x7b70('0x6e')][_0x7b70('0x60')]({'raw':!![],'attributes':['id',_0x7b70('0x74')]})[_0x7b70('0x2e')](function(_0x7f5ca0){_0x58c95b=_0x7f5ca0;var _0x57124a=squel[_0x7b70('0x75')]()[_0x7b70('0x50')](_0x526d31)['from'](_0x7b70('0x76'),'c')[_0x7b70('0x46')](_0x7b70('0x77'),_0x2edfce)[_0x7b70('0x46')]('c.deletedAt\x20is\x20null')[_0x7b70('0x78')]();for(var _0x794d21=0x0;_0x794d21<_0x58c95b['length'];_0x794d21++){_0x57124a[_0x7b70('0x79')]('c.cf_'+_0x58c95b[_0x794d21]['id'],'customField_'+_0x58c95b[_0x794d21][_0x7b70('0x74')]);}for(var _0x794d21=0x0;_0x794d21<_0x5d04b2[_0x7b70('0x41')];_0x794d21++){_0x57124a[_0x7b70('0x79')](squel[_0x7b70('0x75')]()['field'](_0x7b70('0x7a'))['from']('cm_contact_has_items')[_0x7b70('0x46')](_0x7b70('0x7b'),_0x5d04b2[_0x794d21]['id'])[_0x7b70('0x46')]('CmContactId\x20=\x20c.id'),'additionalPhone_'+_0x5d04b2[_0x794d21][_0x7b70('0x34')]);_0x57124a[_0x7b70('0x79')](squel[_0x7b70('0x75')]()['field']('description')[_0x7b70('0x7c')](_0x7b70('0x7d'))['where'](_0x7b70('0x7b'),_0x5d04b2[_0x794d21]['id'])[_0x7b70('0x46')]('CmContactId\x20=\x20c.id'),_0x7b70('0x7e')+_0x5d04b2[_0x794d21][_0x7b70('0x34')]);}var _0x351e37=[];_0x351e37[_0x7b70('0x66')](_0x57124a['toString']());BPromise['each'](_0x351e37,handleQuery)[_0x7b70('0x2e')](function(_0x16c746){handleQuery(_0x57124a[_0x7b70('0x7f')]());var _0x2f6381=csv_results[0x0];if(!_[_0x7b70('0x80')](_0x2f6381)){var _0x448385=toCsv(_0x2f6381);var _0x5104d2=Date[_0x7b70('0x81')]();fs[_0x7b70('0x82')](util['format'](_0x7b70('0x83'),_0x2edfce,_0x5104d2),_0x448385);_0x4c1fe7[_0x7b70('0x84')]('Content-disposition','attachment;\x20filename='+util['format']('list_%d_%s.csv',_0x2edfce,_0x5104d2));_0x4c1fe7[_0x7b70('0x84')](_0x7b70('0x85'),_0x7b70('0x86'));return _0x4c1fe7[_0x7b70('0x87')](util['format']('/tmp/list_%d_%s.csv',_0x2edfce,_0x5104d2));}else{return _0x4c1fe7[_0x7b70('0x20')](0xcc);}});});});};exports['addCustomField']=function(_0x272656,_0x15ad8c,_0x5dc734){var _0x17762d;delete _0x272656[_0x7b70('0x53')]['id'];return db[_0x7b70('0x38')][_0x7b70('0x5c')]({'where':{'id':_0x272656['params']['id']}})[_0x7b70('0x2e')](handleEntityNotFound(_0x15ad8c,null))['then'](function(_0x4f30f2){if(_0x4f30f2){return db[_0x7b70('0x88')]['transaction'](function(_0x3ccf4c){return db[_0x7b70('0x6e')][_0x7b70('0x52')](_0x272656['body'],{'transaction':_0x3ccf4c})[_0x7b70('0x2e')](function(_0x32256a){_0x17762d=_0x32256a;return _0x4f30f2[_0x7b70('0x89')](_0x32256a,{'transaction':_0x3ccf4c});})[_0x7b70('0x2e')](function(){var _0x5c25ef={'type':db[_0x7b70('0x8a')][_0x7b70('0x8b')],'transaction':_0x3ccf4c};switch(_0x272656[_0x7b70('0x53')][_0x7b70('0x48')]){case _0x7b70('0x8c'):_0x5c25ef[_0x7b70('0x48')]=db[_0x7b70('0x8a')]['TEXT'];break;case _0x7b70('0x8d'):_0x5c25ef[_0x7b70('0x48')]=db[_0x7b70('0x8a')][_0x7b70('0x8e')];break;case _0x7b70('0x8f'):_0x5c25ef[_0x7b70('0x48')]=db[_0x7b70('0x8a')][_0x7b70('0x90')];_0x5c25ef[_0x7b70('0x91')]=![];break;default:}return db[_0x7b70('0x88')][_0x7b70('0x92')][_0x7b70('0x93')](_0x7b70('0x76'),util['format']('cf_%s',_0x17762d['id']),_0x5c25ef);})[_0x7b70('0x2e')](function(){return _0x17762d;});});}})[_0x7b70('0x2e')](respondWithResult(_0x15ad8c,null))['catch'](handleError(_0x15ad8c,null));};exports['getCustomFields']=function(_0x175b22,_0x36842e,_0x43f2ad){var _0x1c0b98={};var _0x124784={};var _0x6f0271;var _0x2f0554;return db['CmList']['findOne']({'where':{'id':_0x175b22[_0x7b70('0x4e')]['id']}})[_0x7b70('0x2e')](handleEntityNotFound(_0x36842e,null))['then'](function(_0x351251){if(_0x351251){_0x6f0271=_0x351251;_0x124784['model']=_[_0x7b70('0x3b')](db[_0x7b70('0x6e')]['rawAttributes']);_0x124784['query']=_['keys'](_0x175b22[_0x7b70('0x3c')]);_0x124784[_0x7b70('0x3d')]=_[_0x7b70('0x3e')](_0x124784[_0x7b70('0x3f')],_0x124784['query']);_0x1c0b98[_0x7b70('0x40')]=_['intersection'](_0x124784[_0x7b70('0x3f')],qs['fields'](_0x175b22[_0x7b70('0x3c')][_0x7b70('0x50')]));_0x1c0b98['attributes']=_0x1c0b98[_0x7b70('0x40')]['length']?_0x1c0b98[_0x7b70('0x40')]:_0x124784['model'];_0x1c0b98[_0x7b70('0x43')]=qs[_0x7b70('0x5e')](_0x175b22[_0x7b70('0x3c')][_0x7b70('0x5e')]);_0x1c0b98['where']=qs[_0x7b70('0x3d')](_[_0x7b70('0x44')](_0x175b22[_0x7b70('0x3c')],_0x124784[_0x7b70('0x3d')]));_0x1c0b98[_0x7b70('0x46')]=_[_0x7b70('0x47')](_0x1c0b98['where'],{'$or':[{'ListId':_0x351251['id']},{'ListId':null}]});if(_0x175b22[_0x7b70('0x3c')]['filter']){_0x1c0b98['where']=_[_0x7b70('0x47')](_0x1c0b98['where'],{'$or':_[_0x7b70('0x37')](_0x1c0b98[_0x7b70('0x40')],function(_0x3828cc){var _0x39f070={};_0x39f070[_0x3828cc]={'$like':'%'+_0x175b22['query'][_0x7b70('0x45')]+'%'};return _0x39f070;})});}_0x1c0b98=_[_0x7b70('0x47')]({},_0x1c0b98,_0x175b22['options']);return db[_0x7b70('0x6e')][_0x7b70('0x94')](_0x1c0b98);}})['then'](respondWithResult(_0x36842e,null))[_0x7b70('0x4d')](handleError(_0x36842e,null));};exports[_0x7b70('0x95')]=function(_0x21f35a,_0x54af9c){return db[_0x7b70('0x6e')]['findAndCountAll']({'where':{'ListId':null}})[_0x7b70('0x2e')](handleEntityNotFound(_0x54af9c,null))[_0x7b70('0x2e')](function(_0x58a8c0){return _0x58a8c0;})[_0x7b70('0x2e')](respondWithResult(_0x54af9c,null))[_0x7b70('0x4d')](handleError(_0x54af9c,null));};exports[_0x7b70('0x96')]=function(_0xca0042,_0x4594a5,_0x370ddb){return db[_0x7b70('0x38')][_0x7b70('0x51')]({'where':{'id':_0xca0042[_0x7b70('0x4e')]['id']}})[_0x7b70('0x2e')](handleEntityNotFound(_0x4594a5,null))[_0x7b70('0x2e')](function(_0x59f09c){if(_0x59f09c){return _0x59f09c[_0x7b70('0x96')](_0xca0042[_0x7b70('0x53')]['ids'],_[_0x7b70('0x68')](_0xca0042[_0x7b70('0x53')],[_0x7b70('0x69'),'id'])||{})[_0x7b70('0x97')](function(_0x111d3f){for(var _0x371534=0x0;_0x371534<_0xca0042['body'][_0x7b70('0x69')][_0x7b70('0x41')];_0x371534+=0x1){socket[_0x7b70('0x98')](_0x7b70('0x99'),{'UserId':Number(_0xca0042[_0x7b70('0x53')][_0x7b70('0x69')][_0x371534]),'CmListId':Number(_0xca0042[_0x7b70('0x4e')]['id'])});}return _0x111d3f;});}})['then'](respondWithResult(_0x4594a5,null))[_0x7b70('0x4d')](handleError(_0x4594a5,null));};exports['removeAgents']=function(_0x3b3321,_0x4d8c12,_0x2535ea){return db[_0x7b70('0x38')][_0x7b70('0x51')]({'where':{'id':_0x3b3321[_0x7b70('0x4e')]['id']}})[_0x7b70('0x2e')](handleEntityNotFound(_0x4d8c12,null))['then'](function(_0x19f2d6){if(_0x19f2d6){return _0x19f2d6['removeAgents'](_0x3b3321[_0x7b70('0x3c')][_0x7b70('0x69')])[_0x7b70('0x2e')](function(){if(_[_0x7b70('0x65')](_0x3b3321['query'][_0x7b70('0x69')])){for(var _0x2cfb39=0x0;_0x2cfb39<_0x3b3321[_0x7b70('0x3c')][_0x7b70('0x69')][_0x7b70('0x41')];_0x2cfb39+=0x1){socket['emit'](_0x7b70('0x9a'),{'UserId':Number(_0x3b3321[_0x7b70('0x3c')][_0x7b70('0x69')][_0x2cfb39]),'CmListId':Number(_0x3b3321[_0x7b70('0x4e')]['id'])});}}else{socket['emit'](_0x7b70('0x9a'),{'UserId':Number(_0x3b3321['query']['ids']),'CmListId':Number(_0x3b3321[_0x7b70('0x4e')]['id'])});}});}})['then'](respondWithStatusCode(_0x4d8c12,null))[_0x7b70('0x4d')](handleError(_0x4d8c12,null));};exports[_0x7b70('0x9b')]=function(_0x21319f,_0x2a0e5f,_0x51c4d4){var _0x37fc9d={};var _0x3543e3={};var _0x150b00;var _0x1f7fef;return db[_0x7b70('0x38')][_0x7b70('0x5c')]({'where':{'id':_0x21319f['params']['id']}})['then'](handleEntityNotFound(_0x2a0e5f,null))[_0x7b70('0x2e')](function(_0x477ba4){if(_0x477ba4){_0x150b00=_0x477ba4;_0x3543e3['model']=_[_0x7b70('0x3b')](db[_0x7b70('0x9c')]['rawAttributes']);_0x3543e3[_0x7b70('0x3c')]=_[_0x7b70('0x3b')](_0x21319f[_0x7b70('0x3c')]);_0x3543e3['filters']=_['intersection'](_0x3543e3[_0x7b70('0x3f')],_0x3543e3['query']);_0x37fc9d[_0x7b70('0x40')]=_[_0x7b70('0x3e')](_0x3543e3[_0x7b70('0x3f')],qs['fields'](_0x21319f[_0x7b70('0x3c')][_0x7b70('0x50')]));_0x37fc9d[_0x7b70('0x40')]=_0x37fc9d['attributes'][_0x7b70('0x41')]?_0x37fc9d[_0x7b70('0x40')]:_0x3543e3[_0x7b70('0x3f')];_0x37fc9d[_0x7b70('0x43')]=qs['sort'](_0x21319f[_0x7b70('0x3c')]['sort']);_0x37fc9d[_0x7b70('0x46')]=qs[_0x7b70('0x3d')](_[_0x7b70('0x44')](_0x21319f[_0x7b70('0x3c')],_0x3543e3[_0x7b70('0x3d')]));if(_0x21319f[_0x7b70('0x3c')][_0x7b70('0x45')]){_0x37fc9d['where']=_['merge'](_0x37fc9d[_0x7b70('0x46')],{'$or':_[_0x7b70('0x37')](_0x37fc9d[_0x7b70('0x40')],function(_0x59e62b){var _0x10a083={};_0x10a083[_0x59e62b]={'$like':'%'+_0x21319f[_0x7b70('0x3c')][_0x7b70('0x45')]+'%'};return _0x10a083;})});}_0x37fc9d=_[_0x7b70('0x47')]({},_0x37fc9d,_0x21319f[_0x7b70('0x4a')]);return _0x150b00[_0x7b70('0x9b')](_0x37fc9d);}})[_0x7b70('0x2e')](function(_0x552d16){if(_0x552d16){_0x1f7fef=_0x552d16['length'];if(!_0x21319f[_0x7b70('0x3c')][_0x7b70('0x5d')](_0x7b70('0x42'))){_0x37fc9d[_0x7b70('0x25')]=qs[_0x7b70('0x25')](_0x21319f['query'][_0x7b70('0x25')]);_0x37fc9d['offset']=qs[_0x7b70('0x24')](_0x21319f['query'][_0x7b70('0x24')]);}return _0x150b00[_0x7b70('0x9b')](_0x37fc9d);}})[_0x7b70('0x2e')](function(_0x11b8c5){if(_0x11b8c5){return _0x11b8c5?{'count':_0x1f7fef,'rows':_0x11b8c5}:null;}})[_0x7b70('0x2e')](respondWithResult(_0x2a0e5f,null))[_0x7b70('0x4d')](handleError(_0x2a0e5f,null));};function handleQuery(_0x256913){logger[_0x7b70('0x9d')](_0x256913);return db['sequelize'][_0x7b70('0x3c')](_0x256913)[_0x7b70('0x97')](function(_0x5cb99b){csv_results['push'](_0x5cb99b);})[_0x7b70('0x4d')](function(_0x330595){logger['error'](_0x330595[_0x7b70('0x6c')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 8076ac8..00fa7bf 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x1f833b,_0x20143c){var _0x1bf872=function(_0xc8e31d){while(--_0xc8e31d){_0x1f833b['push'](_0x1f833b['shift']());}};_0x1bf872(++_0x20143c);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file +var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe14b,0x93));var _0xbe14=function(_0x20592c,_0x576756){_0x20592c=_0x20592c-0x0;var _0xdb501d=_0xe14b[_0x20592c];return _0xdb501d;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 17ded4e..d90b83f 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 _0x54ef=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','define','CmList','lodash','util'];(function(_0x23308f,_0x2b3b3b){var _0x2f2899=function(_0x2b8478){while(--_0x2b8478){_0x23308f['push'](_0x23308f['shift']());}};_0x2f2899(++_0x2b3b3b);}(_0x54ef,0x112));var _0xf54e=function(_0x2bf0ea,_0xf285bb){_0x2bf0ea=_0x2bf0ea-0x0;var _0x306a01=_0x54ef[_0x2bf0ea];return _0x306a01;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var logger=require(_0xf54e('0x2'))('api');var moment=require(_0xf54e('0x3'));var BPromise=require(_0xf54e('0x4'));var rp=require(_0xf54e('0x5'));var fs=require('fs');var path=require(_0xf54e('0x6'));var rimraf=require(_0xf54e('0x7'));var config=require(_0xf54e('0x8'));var attributes=require(_0xf54e('0x9'));module['exports']=function(_0x55e611,_0x18e84e){return _0x55e611[_0xf54e('0xa')](_0xf54e('0xb'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb821=['rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','util','../../config/logger','bluebird'];(function(_0x1d8d0f,_0x4b4649){var _0xf12686=function(_0x15751f){while(--_0x15751f){_0x1d8d0f['push'](_0x1d8d0f['shift']());}};_0xf12686(++_0x4b4649);}(_0xb821,0xa7));var _0x1b82=function(_0x15647a,_0x12e776){_0x15647a=_0x15647a-0x0;var _0x346664=_0xb821[_0x15647a];return _0x346664;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var logger=require(_0x1b82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1b82('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var attributes=require(_0x1b82('0x5'));module[_0x1b82('0x6')]=function(_0x597ca7,_0x3e27c4){return _0x597ca7[_0x1b82('0x7')](_0x1b82('0x8'),attributes,{'tableName':_0x1b82('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 1914ca5..8a171d6 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 _0xa2fd=['defaults','localhost','./cmList.socket','request','then','CmList,\x20%s,\x20%s','request\x20sent','error','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis'];(function(_0x24f5c8,_0x228ef4){var _0xcb078d=function(_0x4e3acf){while(--_0x4e3acf){_0x24f5c8['push'](_0x24f5c8['shift']());}};_0xcb078d(++_0x228ef4);}(_0xa2fd,0x13f));var _0xda2f=function(_0x559235,_0x1e05b3){_0x559235=_0x559235-0x0;var _0x468aee=_0xa2fd[_0x559235];return _0x468aee;};'use strict';var _=require('lodash');var util=require(_0xda2f('0x0'));var moment=require(_0xda2f('0x1'));var BPromise=require(_0xda2f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xda2f('0x3'));var db=require(_0xda2f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xda2f('0x5'))(_0xda2f('0x6'));var config=require(_0xda2f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xda2f('0x8')][_0xda2f('0x9')]({'port':0x232a});config[_0xda2f('0xa')]=_[_0xda2f('0xb')](config['redis'],{'host':_0xda2f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xda2f('0xa')]));require(_0xda2f('0xd'))['register'](socket);function respondWithRpcPromise(_0x22e839,_0x9937be,_0x35fedb){return new BPromise(function(_0x5aef2f,_0x3907be){return client[_0xda2f('0xe')](_0x22e839,_0x35fedb)[_0xda2f('0xf')](function(_0x3ff150){logger['info'](_0xda2f('0x10'),_0x9937be,_0xda2f('0x11'));logger['debug']('CmList,\x20%s,\x20%s,\x20%s',_0x9937be,'request\x20sent',JSON['stringify'](_0x3ff150));if(_0x3ff150['error']){if(_0x3ff150['error']['code']===0x1f4){logger[_0xda2f('0x12')](_0xda2f('0x10'),_0x9937be,_0x3ff150[_0xda2f('0x12')][_0xda2f('0x13')]);return _0x3907be(_0x3ff150[_0xda2f('0x12')]['message']);}logger[_0xda2f('0x12')](_0xda2f('0x10'),_0x9937be,_0x3ff150[_0xda2f('0x12')]['message']);return _0x5aef2f(_0x3ff150[_0xda2f('0x12')][_0xda2f('0x13')]);}else{logger['info'](_0xda2f('0x10'),_0x9937be,_0xda2f('0x11'));_0x5aef2f(_0x3ff150[_0xda2f('0x14')][_0xda2f('0x13')]);}})[_0xda2f('0x15')](function(_0x21f69a){logger[_0xda2f('0x12')](_0xda2f('0x10'),_0x9937be,_0x21f69a);_0x3907be(_0x21f69a);});});} \ No newline at end of file +var _0xa859=['register','then','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./cmList.socket'];(function(_0x40927b,_0xf9b0a0){var _0x2635e8=function(_0x1f2b8c){while(--_0x1f2b8c){_0x40927b['push'](_0x40927b['shift']());}};_0x2635e8(++_0xf9b0a0);}(_0xa859,0xba));var _0x9a85=function(_0x39fbf9,_0x21c85c){_0x39fbf9=_0x39fbf9-0x0;var _0x299aee=_0xa859[_0x39fbf9];return _0x299aee;};'use strict';var _=require(_0x9a85('0x0'));var util=require(_0x9a85('0x1'));var moment=require(_0x9a85('0x2'));var BPromise=require(_0x9a85('0x3'));var rs=require(_0x9a85('0x4'));var fs=require('fs');var Redis=require(_0x9a85('0x5'));var db=require(_0x9a85('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9a85('0x7'))(_0x9a85('0x8'));var config=require(_0x9a85('0x9'));var jayson=require(_0x9a85('0xa'));var client=jayson[_0x9a85('0xb')][_0x9a85('0xc')]({'port':0x232a});config[_0x9a85('0xd')]=_['defaults'](config[_0x9a85('0xd')],{'host':_0x9a85('0xe'),'port':0x18eb});var socket=require(_0x9a85('0xf'))(new Redis(config[_0x9a85('0xd')]));require(_0x9a85('0x10'))[_0x9a85('0x11')](socket);function respondWithRpcPromise(_0x27b230,_0x24fe83,_0x1bc9fe){return new BPromise(function(_0x7eb0dd,_0x2d772e){return client['request'](_0x27b230,_0x1bc9fe)[_0x9a85('0x12')](function(_0x5099f3){logger['info'](_0x9a85('0x13'),_0x24fe83,_0x9a85('0x14'));logger[_0x9a85('0x15')](_0x9a85('0x16'),_0x24fe83,_0x9a85('0x14'),JSON[_0x9a85('0x17')](_0x5099f3));if(_0x5099f3[_0x9a85('0x18')]){if(_0x5099f3[_0x9a85('0x18')]['code']===0x1f4){logger[_0x9a85('0x18')](_0x9a85('0x13'),_0x24fe83,_0x5099f3[_0x9a85('0x18')][_0x9a85('0x19')]);return _0x2d772e(_0x5099f3[_0x9a85('0x18')][_0x9a85('0x19')]);}logger[_0x9a85('0x18')](_0x9a85('0x13'),_0x24fe83,_0x5099f3['error'][_0x9a85('0x19')]);return _0x7eb0dd(_0x5099f3[_0x9a85('0x18')][_0x9a85('0x19')]);}else{logger[_0x9a85('0x1a')](_0x9a85('0x13'),_0x24fe83,_0x9a85('0x14'));_0x7eb0dd(_0x5099f3[_0x9a85('0x1b')][_0x9a85('0x19')]);}})[_0x9a85('0x1c')](function(_0x421e2e){logger[_0x9a85('0x18')]('CmList,\x20%s,\x20%s',_0x24fe83,_0x421e2e);_0x2d772e(_0x421e2e);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index d1784fc..51674a3 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 _0x39e4=['update','emit','register','length','cmList:','./cmList.events','save','remove'];(function(_0x5a39e9,_0xac35b8){var _0x48b71b=function(_0x5eeaab){while(--_0x5eeaab){_0x5a39e9['push'](_0x5a39e9['shift']());}};_0x48b71b(++_0xac35b8);}(_0x39e4,0x1a5));var _0x439e=function(_0x241e93,_0x595ec4){_0x241e93=_0x241e93-0x0;var _0x61940d=_0x39e4[_0x241e93];return _0x61940d;};'use strict';var CmListEvents=require(_0x439e('0x0'));var events=[_0x439e('0x1'),_0x439e('0x2'),_0x439e('0x3')];function createListener(_0x545d46,_0x30c192){return function(_0x346997){_0x30c192[_0x439e('0x4')](_0x545d46,_0x346997);};}function removeListener(_0x12b3f3,_0x173ce6){return function(){CmListEvents['removeListener'](_0x12b3f3,_0x173ce6);};}exports[_0x439e('0x5')]=function(_0x1daba3){for(var _0x59e65d=0x0,_0x27c5df=events[_0x439e('0x6')];_0x59e65d<_0x27c5df;_0x59e65d++){var _0x581293=events[_0x59e65d];var _0xdb42cf=createListener(_0x439e('0x7')+_0x581293,_0x1daba3);CmListEvents['on'](_0x581293,_0xdb42cf);}}; \ No newline at end of file +var _0x0e99=['save','update','removeListener','length','cmList:','./cmList.events'];(function(_0x487177,_0x1ddcd6){var _0x147202=function(_0xa5105){while(--_0xa5105){_0x487177['push'](_0x487177['shift']());}};_0x147202(++_0x1ddcd6);}(_0x0e99,0x14f));var _0x90e9=function(_0x509dad,_0x1f995f){_0x509dad=_0x509dad-0x0;var _0x21e122=_0x0e99[_0x509dad];return _0x21e122;};'use strict';var CmListEvents=require(_0x90e9('0x0'));var events=[_0x90e9('0x1'),'remove',_0x90e9('0x2')];function createListener(_0x20a4f4,_0x23d2cb){return function(_0x2df307){_0x23d2cb['emit'](_0x20a4f4,_0x2df307);};}function removeListener(_0xdcaa95,_0xaadad4){return function(){CmListEvents[_0x90e9('0x3')](_0xdcaa95,_0xaadad4);};}exports['register']=function(_0x3e69ea){for(var _0x246f72=0x0,_0x5cb7ba=events[_0x90e9('0x4')];_0x246f72<_0x5cb7ba;_0x246f72++){var _0x1787d9=events[_0x246f72];var _0x520245=createListener(_0x90e9('0x5')+_0x1787d9,_0x3e69ea);CmListEvents['on'](_0x1787d9,_0x520245);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index cac509b..4f3aa23 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 _0x1ddc=['describe','/global_fields','getGlobalCustomFields','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','getAgents','create','post','addDisposition','addContacts','/:id/users','addAgents','put','delete','destroy','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe'];(function(_0x4e6fa9,_0x2fe9ca){var _0x1029f5=function(_0x266878){while(--_0x266878){_0x4e6fa9['push'](_0x4e6fa9['shift']());}};_0x1029f5(++_0x2fe9ca);}(_0x1ddc,0x7f));var _0xc1dd=function(_0x5590f3,_0x510dae){_0x5590f3=_0x5590f3-0x0;var _0x52bfc8=_0x1ddc[_0x5590f3];return _0x52bfc8;};'use strict';var multer=require(_0xc1dd('0x0'));var util=require(_0xc1dd('0x1'));var path=require('path');var timeout=require(_0xc1dd('0x2'));var express=require(_0xc1dd('0x3'));var router=express[_0xc1dd('0x4')]();var fs_extra=require(_0xc1dd('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc1dd('0x6'));var config=require(_0xc1dd('0x7'));var controller=require(_0xc1dd('0x8'));router[_0xc1dd('0x9')]('/',auth[_0xc1dd('0xa')](),controller[_0xc1dd('0xb')]);router[_0xc1dd('0x9')](_0xc1dd('0xc'),auth[_0xc1dd('0xa')](),controller[_0xc1dd('0xd')]);router['get'](_0xc1dd('0xe'),auth[_0xc1dd('0xa')](),controller[_0xc1dd('0xf')]);router[_0xc1dd('0x9')](_0xc1dd('0x10'),auth[_0xc1dd('0xa')](),controller['show']);router['get'](_0xc1dd('0x11'),auth['isAuthenticated'](),controller[_0xc1dd('0x12')]);router['get'](_0xc1dd('0x13'),auth[_0xc1dd('0xa')](),controller[_0xc1dd('0x14')]);router[_0xc1dd('0x9')](_0xc1dd('0x15'),auth[_0xc1dd('0xa')](),controller['getContactsCsv']);router[_0xc1dd('0x9')](_0xc1dd('0x16'),auth[_0xc1dd('0xa')](),controller['getCustomFields']);router['get']('/:id/users',auth[_0xc1dd('0xa')](),controller[_0xc1dd('0x17')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc1dd('0x18')]);router[_0xc1dd('0x19')](_0xc1dd('0x11'),auth[_0xc1dd('0xa')](),controller[_0xc1dd('0x1a')]);router['post'](_0xc1dd('0x13'),auth[_0xc1dd('0xa')](),controller[_0xc1dd('0x1b')]);router[_0xc1dd('0x19')](_0xc1dd('0x16'),auth['isAuthenticated'](),controller['addCustomField']);router[_0xc1dd('0x19')](_0xc1dd('0x1c'),auth[_0xc1dd('0xa')](),controller[_0xc1dd('0x1d')]);router[_0xc1dd('0x1e')]('/:id',auth[_0xc1dd('0xa')](),controller['update']);router[_0xc1dd('0x1f')](_0xc1dd('0x10'),auth[_0xc1dd('0xa')](),controller[_0xc1dd('0x20')]);router[_0xc1dd('0x1f')](_0xc1dd('0x11'),auth[_0xc1dd('0xa')](),controller['removeDispositions']);router[_0xc1dd('0x1f')](_0xc1dd('0x1c'),auth['isAuthenticated'](),controller[_0xc1dd('0x21')]);module[_0xc1dd('0x22')]=router; \ No newline at end of file +var _0xb74d=['./cmList.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','getAgents','post','addContacts','addCustomField','put','update','destroy','delete','removeDispositions','/:id/users','removeAgents','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x386d6b,_0x54078a){var _0x3c8892=function(_0x505aca){while(--_0x505aca){_0x386d6b['push'](_0x386d6b['shift']());}};_0x3c8892(++_0x54078a);}(_0xb74d,0x16e));var _0xdb74=function(_0x3bfdde,_0x306be4){_0x3bfdde=_0x3bfdde-0x0;var _0x3f752a=_0xb74d[_0x3bfdde];return _0x3f752a;};'use strict';var multer=require(_0xdb74('0x0'));var util=require('util');var path=require(_0xdb74('0x1'));var timeout=require('connect-timeout');var express=require(_0xdb74('0x2'));var router=express['Router']();var fs_extra=require(_0xdb74('0x3'));var auth=require(_0xdb74('0x4'));var interaction=require(_0xdb74('0x5'));var config=require('../../config/environment');var controller=require(_0xdb74('0x6'));router[_0xdb74('0x7')]('/',auth[_0xdb74('0x8')](),controller['index']);router['get'](_0xdb74('0x9'),auth['isAuthenticated'](),controller[_0xdb74('0xa')]);router[_0xdb74('0x7')]('/global_fields',auth[_0xdb74('0x8')](),controller['getGlobalCustomFields']);router[_0xdb74('0x7')](_0xdb74('0xb'),auth['isAuthenticated'](),controller[_0xdb74('0xc')]);router[_0xdb74('0x7')](_0xdb74('0xd'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xdb74('0x7')](_0xdb74('0xe'),auth[_0xdb74('0x8')](),controller[_0xdb74('0xf')]);router[_0xdb74('0x7')](_0xdb74('0x10'),auth[_0xdb74('0x8')](),controller[_0xdb74('0x11')]);router[_0xdb74('0x7')](_0xdb74('0x12'),auth[_0xdb74('0x8')](),controller[_0xdb74('0x13')]);router[_0xdb74('0x7')]('/:id/users',auth[_0xdb74('0x8')](),controller[_0xdb74('0x14')]);router[_0xdb74('0x15')]('/',auth[_0xdb74('0x8')](),controller['create']);router['post'](_0xdb74('0xd'),auth[_0xdb74('0x8')](),controller['addDisposition']);router[_0xdb74('0x15')](_0xdb74('0xe'),auth[_0xdb74('0x8')](),controller[_0xdb74('0x16')]);router['post'](_0xdb74('0x12'),auth[_0xdb74('0x8')](),controller[_0xdb74('0x17')]);router['post']('/:id/users',auth[_0xdb74('0x8')](),controller['addAgents']);router[_0xdb74('0x18')](_0xdb74('0xb'),auth[_0xdb74('0x8')](),controller[_0xdb74('0x19')]);router['delete'](_0xdb74('0xb'),auth[_0xdb74('0x8')](),controller[_0xdb74('0x1a')]);router[_0xdb74('0x1b')](_0xdb74('0xd'),auth['isAuthenticated'](),controller[_0xdb74('0x1c')]);router['delete'](_0xdb74('0x1d'),auth[_0xdb74('0x8')](),controller[_0xdb74('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 4c47000..ef06abe 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 _0x71d2=['getDataValue','field','STRING','sequelize'];(function(_0x3e742b,_0x2c85b0){var _0x355480=function(_0x147fbd){while(--_0x147fbd){_0x3e742b['push'](_0x3e742b['shift']());}};_0x355480(++_0x2c85b0);}(_0x71d2,0x163));var _0x271d=function(_0x2620d4,_0x59c400){_0x2620d4=_0x2620d4-0x0;var _0x49530d=_0x71d2[_0x2620d4];return _0x49530d;};'use strict';var Sequelize=require(_0x271d('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x396a98){return this[_0x271d('0x1')](_0x271d('0x2'));}},'field':{'type':Sequelize[_0x271d('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x271d('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x271d('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0x4e24=['VIRTUAL','getDataValue','STRING','sequelize'];(function(_0x36b44f,_0x397c22){var _0x2473cb=function(_0x45a950){while(--_0x45a950){_0x36b44f['push'](_0x36b44f['shift']());}};_0x2473cb(++_0x397c22);}(_0x4e24,0xab));var _0x44e2=function(_0x17c003,_0x13411d){_0x17c003=_0x17c003-0x0;var _0x34e788=_0x4e24[_0x17c003];return _0x34e788;};'use strict';var Sequelize=require(_0x44e2('0x0'));module['exports']={'name':{'type':Sequelize[_0x44e2('0x1')],'get':function(_0x276528){return this[_0x44e2('0x2')]('field');}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x44e2('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x44e2('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 7e15b6f..3be31ae 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x2f356a,_0x32455d){var _0x143acf=function(_0x4379d6){while(--_0x4379d6){_0x2f356a['push'](_0x2f356a['shift']());}};_0x143acf(++_0x32455d);}(_0x7a54,0x106));var _0x47a5=function(_0x312f13,_0x49aaad){_0x312f13=_0x312f13-0x0;var _0xbb2265=_0x7a54[_0x312f13];return _0xbb2265;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _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(_0x463463,_0xc22e74){var _0x3b2c97=function(_0xcb9ad3){while(--_0xcb9ad3){_0x463463['push'](_0x463463['shift']());}};_0x3b2c97(++_0xc22e74);}(_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 f83f429..fa24b19 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 _0xe3a5=['rimraf','../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x237fd6,_0x59d931){var _0x253f77=function(_0x77a4e3){while(--_0x77a4e3){_0x237fd6['push'](_0x237fd6['shift']());}};_0x253f77(++_0x59d931);}(_0xe3a5,0x180));var _0x5e3a=function(_0x4d810b,_0x5e56ba){_0x4d810b=_0x4d810b-0x0;var _0x3c0c35=_0xe3a5[_0x4d810b];return _0x3c0c35;};'use strict';var _=require(_0x5e3a('0x0'));var util=require('util');var logger=require(_0x5e3a('0x1'))(_0x5e3a('0x2'));var moment=require('moment');var BPromise=require(_0x5e3a('0x3'));var rp=require(_0x5e3a('0x4'));var fs=require('fs');var path=require(_0x5e3a('0x5'));var rimraf=require(_0x5e3a('0x6'));var config=require(_0x5e3a('0x7'));var attributes=require(_0x5e3a('0x8'));module[_0x5e3a('0x9')]=function(_0x2055e7,_0x2fb383){return _0x2055e7[_0x5e3a('0xa')](_0x5e3a('0xb'),attributes,{'tableName':_0x5e3a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfbe4=['request-promise','path','rimraf','./condition.attributes','exports','define','Condition','tools_conditions','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x40ca98,_0x39f6de){var _0x1d7fee=function(_0x23ea77){while(--_0x23ea77){_0x40ca98['push'](_0x40ca98['shift']());}};_0x1d7fee(++_0x39f6de);}(_0xfbe4,0x166));var _0x4fbe=function(_0x12cdd1,_0x53cac6){_0x12cdd1=_0x12cdd1-0x0;var _0x23e424=_0xfbe4[_0x12cdd1];return _0x23e424;};'use strict';var _=require(_0x4fbe('0x0'));var util=require(_0x4fbe('0x1'));var logger=require(_0x4fbe('0x2'))(_0x4fbe('0x3'));var moment=require(_0x4fbe('0x4'));var BPromise=require(_0x4fbe('0x5'));var rp=require(_0x4fbe('0x6'));var fs=require('fs');var path=require(_0x4fbe('0x7'));var rimraf=require(_0x4fbe('0x8'));var config=require('../../config/environment');var attributes=require(_0x4fbe('0x9'));module[_0x4fbe('0xa')]=function(_0x5766b5,_0x2b4d04){return _0x5766b5[_0x4fbe('0xb')](_0x4fbe('0xc'),attributes,{'tableName':_0x4fbe('0xd'),'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 c15a739..0ef508e 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 _0x894e=['info','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x202517,_0x47ada9){var _0x72463a=function(_0x452ad4){while(--_0x452ad4){_0x202517['push'](_0x202517['shift']());}};_0x72463a(++_0x47ada9);}(_0x894e,0x1bc));var _0xe894=function(_0x336280,_0x10a45c){_0x336280=_0x336280-0x0;var _0x2a1b5b=_0x894e[_0x336280];return _0x2a1b5b;};'use strict';var _=require(_0xe894('0x0'));var util=require('util');var moment=require(_0xe894('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe894('0x2'));var db=require(_0xe894('0x3'))['db'];var utils=require(_0xe894('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xe894('0x5'));var jayson=require(_0xe894('0x6'));var client=jayson[_0xe894('0x7')][_0xe894('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x309033,_0x46bffc,_0x3ff88f){return new BPromise(function(_0x27a516,_0x22ec25){return client[_0xe894('0x9')](_0x309033,_0x3ff88f)[_0xe894('0xa')](function(_0x465a4c){logger['info'](_0xe894('0xb'),_0x46bffc,'request\x20sent');logger[_0xe894('0xc')](_0xe894('0xd'),_0x46bffc,_0xe894('0xe'),JSON['stringify'](_0x465a4c));if(_0x465a4c['error']){if(_0x465a4c[_0xe894('0xf')][_0xe894('0x10')]===0x1f4){logger[_0xe894('0xf')](_0xe894('0xb'),_0x46bffc,_0x465a4c[_0xe894('0xf')][_0xe894('0x11')]);return _0x22ec25(_0x465a4c[_0xe894('0xf')][_0xe894('0x11')]);}logger[_0xe894('0xf')](_0xe894('0xb'),_0x46bffc,_0x465a4c[_0xe894('0xf')]['message']);return _0x27a516(_0x465a4c['error'][_0xe894('0x11')]);}else{logger[_0xe894('0x12')]('Condition,\x20%s,\x20%s',_0x46bffc,_0xe894('0xe'));_0x27a516(_0x465a4c[_0xe894('0x13')][_0xe894('0x11')]);}})[_0xe894('0x14')](function(_0xb16763){logger[_0xe894('0xf')](_0xe894('0xb'),_0x46bffc,_0xb16763);_0x22ec25(_0xb16763);});});} \ No newline at end of file +var _0x58b4=['result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4f9f3b,_0x59e798){var _0x19cfa1=function(_0x1e61e3){while(--_0x1e61e3){_0x4f9f3b['push'](_0x4f9f3b['shift']());}};_0x19cfa1(++_0x59e798);}(_0x58b4,0xe3));var _0x458b=function(_0x31fb46,_0x3c2e4){_0x31fb46=_0x31fb46-0x0;var _0x567bc9=_0x58b4[_0x31fb46];return _0x567bc9;};'use strict';var _=require(_0x458b('0x0'));var util=require(_0x458b('0x1'));var moment=require(_0x458b('0x2'));var BPromise=require('bluebird');var rs=require(_0x458b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x458b('0x4'))['db'];var utils=require(_0x458b('0x5'));var logger=require(_0x458b('0x6'))(_0x458b('0x7'));var config=require(_0x458b('0x8'));var jayson=require(_0x458b('0x9'));var client=jayson[_0x458b('0xa')][_0x458b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x14503a,_0xdda3bc,_0x4aea26){return new BPromise(function(_0xc88867,_0x5a197e){return client[_0x458b('0xc')](_0x14503a,_0x4aea26)[_0x458b('0xd')](function(_0x27279d){logger[_0x458b('0xe')](_0x458b('0xf'),_0xdda3bc,_0x458b('0x10'));logger[_0x458b('0x11')](_0x458b('0x12'),_0xdda3bc,_0x458b('0x10'),JSON[_0x458b('0x13')](_0x27279d));if(_0x27279d[_0x458b('0x14')]){if(_0x27279d[_0x458b('0x14')][_0x458b('0x15')]===0x1f4){logger['error'](_0x458b('0xf'),_0xdda3bc,_0x27279d[_0x458b('0x14')][_0x458b('0x16')]);return _0x5a197e(_0x27279d[_0x458b('0x14')][_0x458b('0x16')]);}logger[_0x458b('0x14')](_0x458b('0xf'),_0xdda3bc,_0x27279d[_0x458b('0x14')][_0x458b('0x16')]);return _0xc88867(_0x27279d[_0x458b('0x14')]['message']);}else{logger['info'](_0x458b('0xf'),_0xdda3bc,_0x458b('0x10'));_0xc88867(_0x27279d[_0x458b('0x17')]['message']);}})[_0x458b('0x18')](function(_0x55ea65){logger[_0x458b('0x14')](_0x458b('0xf'),_0xdda3bc,_0x55ea65);_0x5a197e(_0x55ea65);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 3fd1043..b935ea6 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 _0x3f1b=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','delete','/:id','destroy','exports','multer'];(function(_0x267925,_0xd0e4e0){var _0x523022=function(_0x38b461){while(--_0x38b461){_0x267925['push'](_0x267925['shift']());}};_0x523022(++_0xd0e4e0);}(_0x3f1b,0xa7));var _0xb3f1=function(_0x591ca9,_0x202374){_0x591ca9=_0x591ca9-0x0;var _0x4ad232=_0x3f1b[_0x591ca9];return _0x4ad232;};'use strict';var multer=require(_0xb3f1('0x0'));var util=require(_0xb3f1('0x1'));var path=require('path');var timeout=require(_0xb3f1('0x2'));var express=require(_0xb3f1('0x3'));var router=express[_0xb3f1('0x4')]();var fs_extra=require(_0xb3f1('0x5'));var auth=require(_0xb3f1('0x6'));var interaction=require(_0xb3f1('0x7'));var config=require(_0xb3f1('0x8'));var controller=require('./condition.controller');router['put']('/:id',auth[_0xb3f1('0x9')](),controller['update']);router[_0xb3f1('0xa')](_0xb3f1('0xb'),auth[_0xb3f1('0x9')](),controller[_0xb3f1('0xc')]);module[_0xb3f1('0xd')]=router; \ No newline at end of file +var _0x85d0=['isAuthenticated','destroy','exports','util','path','connect-timeout','express','../../components/interaction/service','put','/:id','delete'];(function(_0x445555,_0x5a562e){var _0x48baf5=function(_0x4fcd33){while(--_0x4fcd33){_0x445555['push'](_0x445555['shift']());}};_0x48baf5(++_0x5a562e);}(_0x85d0,0x142));var _0x085d=function(_0x28c3eb,_0x542f25){_0x28c3eb=_0x28c3eb-0x0;var _0x24daef=_0x85d0[_0x28c3eb];return _0x24daef;};'use strict';var multer=require('multer');var util=require(_0x085d('0x0'));var path=require(_0x085d('0x1'));var timeout=require(_0x085d('0x2'));var express=require(_0x085d('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x085d('0x4'));var config=require('../../config/environment');var controller=require('./condition.controller');router[_0x085d('0x5')](_0x085d('0x6'),auth['isAuthenticated'](),controller['update']);router[_0x085d('0x7')](_0x085d('0x6'),auth[_0x085d('0x8')](),controller[_0x085d('0x9')]);module[_0x085d('0xa')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 5261dcb..e9240f8 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd1d9=['exports','name','INTEGER'];(function(_0x3b0a38,_0x2c9cd2){var _0x35aadf=function(_0x18e954){while(--_0x18e954){_0x3b0a38['push'](_0x3b0a38['shift']());}};_0x35aadf(++_0x2c9cd2);}(_0xd1d9,0x15c));var _0x9d1d=function(_0x1a1f6b,_0x179c64){_0x1a1f6b=_0x1a1f6b-0x0;var _0xbf8bdd=_0xd1d9[_0x1a1f6b];return _0xbf8bdd;};'use strict';var Sequelize=require('sequelize');module[_0x9d1d('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9d1d('0x1')},'OrderBy':{'type':Sequelize[_0x9d1d('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x9556=['STRING','name','INTEGER','exports'];(function(_0x4eed2a,_0x8684b4){var _0x1f7711=function(_0x2f88e2){while(--_0x2f88e2){_0x4eed2a['push'](_0x4eed2a['shift']());}};_0x1f7711(++_0x8684b4);}(_0x9556,0x17b));var _0x6955=function(_0x3bfe03,_0x583bae){_0x3bfe03=_0x3bfe03-0x0;var _0x253ec3=_0x9556[_0x3bfe03];return _0x253ec3;};'use strict';var Sequelize=require('sequelize');module[_0x6955('0x0')]={'name':{'type':Sequelize[_0x6955('0x1')],'allowNull':![],'unique':_0x6955('0x2')},'OrderBy':{'type':Sequelize[_0x6955('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x6955('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 673590e..0ae565e 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','sort','where','filters','filter','merge','options','ContactItemType','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','ContactItemTypes','UserProfileResource','name','send','index','map'];(function(_0x81fdbe,_0x46f63f){var _0x5adc49=function(_0x14dfda){while(--_0x14dfda){_0x81fdbe['push'](_0x81fdbe['shift']());}};_0x5adc49(++_0x46f63f);}(_0x5f66,0x1a0));var _0x65f6=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x5f66[_0x297fd3];return _0x2af381;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){var _0x2774a1=_0x1eeaaa['get']({'plain':!![]});var _0x9d7bb0=_0x65f6('0x22');return db[_0x65f6('0x23')]['destroy']({'where':{'type':_0x9d7bb0,'resourceId':_0x2774a1['id']}})['then'](function(){return _0x1eeaaa;});})['then'](function(){_0xd173f4[_0x65f6('0x15')](0xcc)[_0x65f6('0x16')]();});}};}function handleEntityNotFound(_0x4b2292,_0x296cd9){return function(_0x28f710){if(!_0x28f710){_0x4b2292['sendStatus'](0x194);}return _0x28f710;};}function handleError(_0x325cb4,_0x2bff2b){_0x2bff2b=_0x2bff2b||0x1f4;return function(_0x28d0df){logger['error'](_0x28d0df['stack']);if(_0x28d0df['name']){delete _0x28d0df[_0x65f6('0x24')];}_0x325cb4[_0x65f6('0x15')](_0x2bff2b)[_0x65f6('0x25')](_0x28d0df);};}exports[_0x65f6('0x26')]=function(_0x518cac,_0x14a387){var _0x144e55={},_0x4ace4c={},_0x4ea23d={'count':0x0,'rows':[]};var _0x154cbd=_[_0x65f6('0x27')](db['ContactItemType']['rawAttributes'],function(_0x10b368){return{'name':_0x10b368[_0x65f6('0x28')],'type':_0x10b368[_0x65f6('0x29')][_0x65f6('0x2a')]};});_0x4ace4c[_0x65f6('0x2b')]=_[_0x65f6('0x27')](_0x154cbd,'name');_0x4ace4c[_0x65f6('0x2c')]=_[_0x65f6('0x2d')](_0x518cac[_0x65f6('0x2c')]);_0x4ace4c['filters']=_[_0x65f6('0x2e')](_0x4ace4c[_0x65f6('0x2b')],_0x4ace4c[_0x65f6('0x2c')]);_0x144e55[_0x65f6('0x2f')]=_[_0x65f6('0x2e')](_0x4ace4c[_0x65f6('0x2b')],qs['fields'](_0x518cac[_0x65f6('0x2c')][_0x65f6('0x30')]));_0x144e55['attributes']=_0x144e55[_0x65f6('0x2f')]['length']?_0x144e55[_0x65f6('0x2f')]:_0x4ace4c['model'];if(!_0x518cac[_0x65f6('0x2c')][_0x65f6('0x31')]('nolimit')){_0x144e55[_0x65f6('0x19')]=qs[_0x65f6('0x19')](_0x518cac[_0x65f6('0x2c')]['limit']);_0x144e55['offset']=qs[_0x65f6('0x1b')](_0x518cac['query'][_0x65f6('0x1b')]);}_0x144e55['order']=qs[_0x65f6('0x32')](_0x518cac[_0x65f6('0x2c')]['sort']);_0x144e55[_0x65f6('0x33')]=qs['filters'](_['pick'](_0x518cac[_0x65f6('0x2c')],_0x4ace4c[_0x65f6('0x34')]),_0x154cbd);if(_0x518cac[_0x65f6('0x2c')][_0x65f6('0x35')]){_0x144e55[_0x65f6('0x33')]=_[_0x65f6('0x36')](_0x144e55[_0x65f6('0x33')],{'$or':_[_0x65f6('0x27')](_0x154cbd,function(_0x4f933b){if(_0x4f933b[_0x65f6('0x29')]!=='VIRTUAL'){var _0x12a589={};_0x12a589[_0x4f933b[_0x65f6('0x24')]]={'$like':'%'+_0x518cac[_0x65f6('0x2c')][_0x65f6('0x35')]+'%'};return _0x12a589;}})});}_0x144e55=_['merge']({},_0x144e55,_0x518cac[_0x65f6('0x37')]);var _0x1d6421={'where':_0x144e55[_0x65f6('0x33')]};return db[_0x65f6('0x38')][_0x65f6('0x1a')](_0x1d6421)[_0x65f6('0x21')](function(_0xed4c96){_0x4ea23d[_0x65f6('0x1a')]=_0xed4c96;if(_0x518cac[_0x65f6('0x2c')]['includeAll']){_0x144e55[_0x65f6('0x39')]=[{'all':!![]}];}return db[_0x65f6('0x38')][_0x65f6('0x3a')](_0x144e55);})[_0x65f6('0x21')](function(_0x83e2d9){_0x4ea23d[_0x65f6('0x3b')]=_0x83e2d9;return _0x4ea23d;})[_0x65f6('0x21')](respondWithFilteredResult(_0x14a387,_0x144e55))[_0x65f6('0x3c')](handleError(_0x14a387,null));};exports[_0x65f6('0x3d')]=function(_0x2abbed,_0xcf19da){var _0x2c008a={'raw':!![],'where':{'id':_0x2abbed[_0x65f6('0x3e')]['id']}},_0x6c4d94={};_0x6c4d94[_0x65f6('0x2b')]=_[_0x65f6('0x2d')](db['ContactItemType'][_0x65f6('0x3f')]);_0x6c4d94[_0x65f6('0x2c')]=_[_0x65f6('0x2d')](_0x2abbed[_0x65f6('0x2c')]);_0x6c4d94['filters']=_[_0x65f6('0x2e')](_0x6c4d94[_0x65f6('0x2b')],_0x6c4d94[_0x65f6('0x2c')]);_0x2c008a['attributes']=_[_0x65f6('0x2e')](_0x6c4d94[_0x65f6('0x2b')],qs[_0x65f6('0x30')](_0x2abbed[_0x65f6('0x2c')]['fields']));_0x2c008a[_0x65f6('0x2f')]=_0x2c008a['attributes'][_0x65f6('0x40')]?_0x2c008a[_0x65f6('0x2f')]:_0x6c4d94['model'];if(_0x2abbed[_0x65f6('0x2c')]['includeAll']){_0x2c008a[_0x65f6('0x39')]=[{'all':!![]}];}_0x2c008a=_[_0x65f6('0x36')]({},_0x2c008a,_0x2abbed[_0x65f6('0x37')]);return db[_0x65f6('0x38')][_0x65f6('0x41')](_0x2c008a)[_0x65f6('0x21')](handleEntityNotFound(_0xcf19da,null))['then'](respondWithResult(_0xcf19da,null))['catch'](handleError(_0xcf19da,null));};exports[_0x65f6('0x42')]=function(_0x15d3ba,_0x3b647a){return db[_0x65f6('0x38')][_0x65f6('0x42')](_0x15d3ba[_0x65f6('0x43')],{})[_0x65f6('0x21')](function(_0x41690c){var _0x414f49=_0x15d3ba['user'][_0x65f6('0x44')]({'plain':!![]});if(!_0x414f49)throw new Error(_0x65f6('0x45'));if(_0x414f49[_0x65f6('0x46')]==='user'){var _0x47e749=_0x41690c[_0x65f6('0x44')]({'plain':!![]});var _0x49ba5a=_0x65f6('0x22');return db[_0x65f6('0x47')]['find']({'where':{'name':_0x49ba5a,'userProfileId':_0x414f49[_0x65f6('0x48')]},'raw':!![]})['then'](function(_0x247be3){if(_0x247be3&&_0x247be3[_0x65f6('0x49')]===0x0){return db[_0x65f6('0x23')]['create']({'name':_0x47e749[_0x65f6('0x24')],'resourceId':_0x47e749['id'],'type':_0x247be3[_0x65f6('0x24')],'sectionId':_0x247be3['id']},{})['then'](function(){return _0x41690c;});}else{return _0x41690c;}})[_0x65f6('0x3c')](function(_0x34312c){logger['error'](_0x65f6('0x4a'),_0x34312c);throw _0x34312c;});}return _0x41690c;})[_0x65f6('0x21')](respondWithResult(_0x3b647a,0xc9))[_0x65f6('0x3c')](handleError(_0x3b647a,null));};exports[_0x65f6('0x4b')]=function(_0x234fa7,_0x2350ca){if(_0x234fa7[_0x65f6('0x43')]['id']){delete _0x234fa7[_0x65f6('0x43')]['id'];}return db['ContactItemType']['find']({'where':{'id':_0x234fa7['params']['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x2350ca,null))[_0x65f6('0x21')](saveUpdates(_0x234fa7[_0x65f6('0x43')],null))[_0x65f6('0x21')](respondWithResult(_0x2350ca,null))['catch'](handleError(_0x2350ca,null));};exports[_0x65f6('0x20')]=function(_0x2032b9,_0x9ff849){return db['ContactItemType'][_0x65f6('0x41')]({'where':{'id':_0x2032b9[_0x65f6('0x3e')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x9ff849,null))['then'](db['CmContactHasItem'][_0x65f6('0x4b')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x2032b9[_0x65f6('0x3e')]['id']}}))[_0x65f6('0x21')](removeEntity(_0x9ff849,null))[_0x65f6('0x3c')](handleError(_0x9ff849,null));}; \ No newline at end of file +var _0x7d25=['limit','Content-Range','apply','reject','save','update','then','destroy','get','ContactItemTypes','UserProfileResource','error','stack','name','send','index','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','rows','catch','includeAll','include','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','CmContactHasItem','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7d25,0x8a));var _0x57d2=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0x7d25[_0x62c958];return _0x57ec61;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x57d2('0x0'));var zipdir=require(_0x57d2('0x1'));var jsonpatch=require(_0x57d2('0x2'));var rp=require(_0x57d2('0x3'));var moment=require(_0x57d2('0x4'));var BPromise=require(_0x57d2('0x5'));var Mustache=require(_0x57d2('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x57d2('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x57d2('0x8'));var squel=require(_0x57d2('0x9'));var crypto=require(_0x57d2('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x57d2('0xb'));var querystring=require('querystring');var Papa=require(_0x57d2('0xc'));var Redis=require(_0x57d2('0xd'));var authService=require(_0x57d2('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x57d2('0xf'));var hardwareService=require(_0x57d2('0x10'));var logger=require(_0x57d2('0x11'))(_0x57d2('0x12'));var utils=require(_0x57d2('0x13'));var config=require(_0x57d2('0x14'));var licenseUtil=require(_0x57d2('0x15'));var db=require(_0x57d2('0x16'))['db'];function respondWithStatusCode(_0x43d7fb,_0x32c33a){_0x32c33a=_0x32c33a||0xcc;return function(_0x28428b){if(_0x28428b){return _0x43d7fb[_0x57d2('0x17')](_0x32c33a);}return _0x43d7fb[_0x57d2('0x18')](_0x32c33a)[_0x57d2('0x19')]();};}function respondWithResult(_0x1ba57e,_0x4086f3){_0x4086f3=_0x4086f3||0xc8;return function(_0x5382d9){if(_0x5382d9){return _0x1ba57e['status'](_0x4086f3)[_0x57d2('0x1a')](_0x5382d9);}};}function respondWithFilteredResult(_0x148ef3,_0x4ec4b1){return function(_0x8cf637){if(_0x8cf637){var _0x319489=typeof _0x4ec4b1['offset']===_0x57d2('0x1b')&&typeof _0x4ec4b1['limit']===_0x57d2('0x1b');var _0x4b4fe0=_0x8cf637[_0x57d2('0x1c')];var _0x7d4cf1=_0x319489?0x0:_0x4ec4b1[_0x57d2('0x1d')];var _0x4a94e3=_0x319489?_0x8cf637['count']:_0x4ec4b1[_0x57d2('0x1d')]+_0x4ec4b1[_0x57d2('0x1e')];var _0x2662cd;if(_0x4a94e3>=_0x4b4fe0){_0x4a94e3=_0x4b4fe0;_0x2662cd=0xc8;}else{_0x2662cd=0xce;}_0x148ef3[_0x57d2('0x18')](_0x2662cd);return _0x148ef3['set'](_0x57d2('0x1f'),_0x7d4cf1+'-'+_0x4a94e3+'/'+_0x4b4fe0)[_0x57d2('0x1a')](_0x8cf637);}return null;};}function patchUpdates(_0x55191e){return function(_0x5f3fd5){try{jsonpatch[_0x57d2('0x20')](_0x5f3fd5,_0x55191e,!![]);}catch(_0x326d49){return BPromise[_0x57d2('0x21')](_0x326d49);}return _0x5f3fd5[_0x57d2('0x22')]();};}function saveUpdates(_0x386196,_0x803c25){return function(_0x32c7c8){if(_0x32c7c8){return _0x32c7c8[_0x57d2('0x23')](_0x386196)[_0x57d2('0x24')](function(_0x26718e){return _0x26718e;});}return null;};}function removeEntity(_0x46a4d1,_0x456fe1){return function(_0x12ff19){if(_0x12ff19){return _0x12ff19[_0x57d2('0x25')]()['then'](function(){var _0x424ddc=_0x12ff19[_0x57d2('0x26')]({'plain':!![]});var _0x3c7de8=_0x57d2('0x27');return db[_0x57d2('0x28')]['destroy']({'where':{'type':_0x3c7de8,'resourceId':_0x424ddc['id']}})[_0x57d2('0x24')](function(){return _0x12ff19;});})[_0x57d2('0x24')](function(){_0x46a4d1[_0x57d2('0x18')](0xcc)[_0x57d2('0x19')]();});}};}function handleEntityNotFound(_0x18d500,_0x4b3d8e){return function(_0x9bdb11){if(!_0x9bdb11){_0x18d500['sendStatus'](0x194);}return _0x9bdb11;};}function handleError(_0x1ae5ff,_0x15f1ba){_0x15f1ba=_0x15f1ba||0x1f4;return function(_0x277426){logger[_0x57d2('0x29')](_0x277426[_0x57d2('0x2a')]);if(_0x277426[_0x57d2('0x2b')]){delete _0x277426[_0x57d2('0x2b')];}_0x1ae5ff[_0x57d2('0x18')](_0x15f1ba)[_0x57d2('0x2c')](_0x277426);};}exports[_0x57d2('0x2d')]=function(_0x574589,_0x4e9178){var _0x3da926={},_0x26e052={},_0x3e017c={'count':0x0,'rows':[]};var _0x484597=_[_0x57d2('0x2e')](db[_0x57d2('0x2f')][_0x57d2('0x30')],function(_0x290c2d){return{'name':_0x290c2d[_0x57d2('0x31')],'type':_0x290c2d[_0x57d2('0x32')][_0x57d2('0x33')]};});_0x26e052[_0x57d2('0x34')]=_[_0x57d2('0x2e')](_0x484597,'name');_0x26e052[_0x57d2('0x35')]=_[_0x57d2('0x36')](_0x574589['query']);_0x26e052[_0x57d2('0x37')]=_[_0x57d2('0x38')](_0x26e052['model'],_0x26e052[_0x57d2('0x35')]);_0x3da926[_0x57d2('0x39')]=_[_0x57d2('0x38')](_0x26e052[_0x57d2('0x34')],qs[_0x57d2('0x3a')](_0x574589['query']['fields']));_0x3da926['attributes']=_0x3da926['attributes'][_0x57d2('0x3b')]?_0x3da926[_0x57d2('0x39')]:_0x26e052[_0x57d2('0x34')];if(!_0x574589[_0x57d2('0x35')][_0x57d2('0x3c')]('nolimit')){_0x3da926[_0x57d2('0x1e')]=qs['limit'](_0x574589[_0x57d2('0x35')][_0x57d2('0x1e')]);_0x3da926[_0x57d2('0x1d')]=qs['offset'](_0x574589[_0x57d2('0x35')][_0x57d2('0x1d')]);}_0x3da926['order']=qs[_0x57d2('0x3d')](_0x574589[_0x57d2('0x35')][_0x57d2('0x3d')]);_0x3da926[_0x57d2('0x3e')]=qs[_0x57d2('0x37')](_[_0x57d2('0x3f')](_0x574589['query'],_0x26e052[_0x57d2('0x37')]),_0x484597);if(_0x574589['query'][_0x57d2('0x40')]){_0x3da926[_0x57d2('0x3e')]=_[_0x57d2('0x41')](_0x3da926[_0x57d2('0x3e')],{'$or':_[_0x57d2('0x2e')](_0x484597,function(_0x512dbf){if(_0x512dbf[_0x57d2('0x32')]!==_0x57d2('0x42')){var _0x4f6955={};_0x4f6955[_0x512dbf[_0x57d2('0x2b')]]={'$like':'%'+_0x574589[_0x57d2('0x35')][_0x57d2('0x40')]+'%'};return _0x4f6955;}})});}_0x3da926=_['merge']({},_0x3da926,_0x574589[_0x57d2('0x43')]);var _0x2fe0cd={'where':_0x3da926[_0x57d2('0x3e')]};return db[_0x57d2('0x2f')]['count'](_0x2fe0cd)['then'](function(_0x11a2ec){_0x3e017c[_0x57d2('0x1c')]=_0x11a2ec;if(_0x574589[_0x57d2('0x35')]['includeAll']){_0x3da926['include']=[{'all':!![]}];}return db[_0x57d2('0x2f')]['findAll'](_0x3da926);})[_0x57d2('0x24')](function(_0x1bb8ad){_0x3e017c[_0x57d2('0x44')]=_0x1bb8ad;return _0x3e017c;})[_0x57d2('0x24')](respondWithFilteredResult(_0x4e9178,_0x3da926))[_0x57d2('0x45')](handleError(_0x4e9178,null));};exports['show']=function(_0x13216b,_0x1c069a){var _0x53ab43={'raw':!![],'where':{'id':_0x13216b['params']['id']}},_0x775f8c={};_0x775f8c[_0x57d2('0x34')]=_[_0x57d2('0x36')](db[_0x57d2('0x2f')][_0x57d2('0x30')]);_0x775f8c['query']=_['keys'](_0x13216b[_0x57d2('0x35')]);_0x775f8c['filters']=_['intersection'](_0x775f8c[_0x57d2('0x34')],_0x775f8c['query']);_0x53ab43['attributes']=_[_0x57d2('0x38')](_0x775f8c['model'],qs[_0x57d2('0x3a')](_0x13216b['query'][_0x57d2('0x3a')]));_0x53ab43['attributes']=_0x53ab43['attributes'][_0x57d2('0x3b')]?_0x53ab43[_0x57d2('0x39')]:_0x775f8c[_0x57d2('0x34')];if(_0x13216b[_0x57d2('0x35')][_0x57d2('0x46')]){_0x53ab43[_0x57d2('0x47')]=[{'all':!![]}];}_0x53ab43=_['merge']({},_0x53ab43,_0x13216b[_0x57d2('0x43')]);return db[_0x57d2('0x2f')][_0x57d2('0x48')](_0x53ab43)[_0x57d2('0x24')](handleEntityNotFound(_0x1c069a,null))[_0x57d2('0x24')](respondWithResult(_0x1c069a,null))[_0x57d2('0x45')](handleError(_0x1c069a,null));};exports[_0x57d2('0x49')]=function(_0x406375,_0x51f172){return db[_0x57d2('0x2f')][_0x57d2('0x49')](_0x406375['body'],{})[_0x57d2('0x24')](function(_0x5b06f7){var _0x59a6eb=_0x406375[_0x57d2('0x4a')][_0x57d2('0x26')]({'plain':!![]});if(!_0x59a6eb)throw new Error(_0x57d2('0x4b'));if(_0x59a6eb[_0x57d2('0x4c')]==='user'){var _0x265d24=_0x5b06f7[_0x57d2('0x26')]({'plain':!![]});var _0x51b535='ContactItemTypes';return db[_0x57d2('0x4d')][_0x57d2('0x48')]({'where':{'name':_0x51b535,'userProfileId':_0x59a6eb[_0x57d2('0x4e')]},'raw':!![]})[_0x57d2('0x24')](function(_0x3092c8){if(_0x3092c8&&_0x3092c8[_0x57d2('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x265d24['name'],'resourceId':_0x265d24['id'],'type':_0x3092c8[_0x57d2('0x2b')],'sectionId':_0x3092c8['id']},{})['then'](function(){return _0x5b06f7;});}else{return _0x5b06f7;}})[_0x57d2('0x45')](function(_0x2ef710){logger['error'](_0x57d2('0x50'),_0x2ef710);throw _0x2ef710;});}return _0x5b06f7;})[_0x57d2('0x24')](respondWithResult(_0x51f172,0xc9))[_0x57d2('0x45')](handleError(_0x51f172,null));};exports['update']=function(_0x10d4e5,_0x224b7d){if(_0x10d4e5[_0x57d2('0x51')]['id']){delete _0x10d4e5[_0x57d2('0x51')]['id'];}return db[_0x57d2('0x2f')][_0x57d2('0x48')]({'where':{'id':_0x10d4e5[_0x57d2('0x52')]['id']}})[_0x57d2('0x24')](handleEntityNotFound(_0x224b7d,null))[_0x57d2('0x24')](saveUpdates(_0x10d4e5['body'],null))[_0x57d2('0x24')](respondWithResult(_0x224b7d,null))[_0x57d2('0x45')](handleError(_0x224b7d,null));};exports[_0x57d2('0x25')]=function(_0x5e3289,_0x7b334f){return db[_0x57d2('0x2f')][_0x57d2('0x48')]({'where':{'id':_0x5e3289['params']['id']}})['then'](handleEntityNotFound(_0x7b334f,null))['then'](db[_0x57d2('0x53')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x5e3289[_0x57d2('0x52')]['id']}}))['then'](removeEntity(_0x7b334f,null))[_0x57d2('0x45')](handleError(_0x7b334f,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index bfc991a..e5cd19a 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x37cc=['./contactItemType.attributes','exports','define','tools_contact_item_types','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x8e8f89,_0x4254f3){var _0x151938=function(_0x21c367){while(--_0x21c367){_0x8e8f89['push'](_0x8e8f89['shift']());}};_0x151938(++_0x4254f3);}(_0x37cc,0xf6));var _0xc37c=function(_0x3dd567,_0x276ca9){_0x3dd567=_0x3dd567-0x0;var _0x415024=_0x37cc[_0x3dd567];return _0x415024;};'use strict';var _=require('lodash');var util=require(_0xc37c('0x0'));var logger=require(_0xc37c('0x1'))('api');var moment=require(_0xc37c('0x2'));var BPromise=require(_0xc37c('0x3'));var rp=require(_0xc37c('0x4'));var fs=require('fs');var path=require(_0xc37c('0x5'));var rimraf=require(_0xc37c('0x6'));var config=require('../../config/environment');var attributes=require(_0xc37c('0x7'));module[_0xc37c('0x8')]=function(_0x33b49b,_0x56522a){return _0x33b49b[_0xc37c('0x9')]('ContactItemType',attributes,{'tableName':_0xc37c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xecd2=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','define','ContactItemType'];(function(_0xce8d65,_0x4b3f6a){var _0x1a0629=function(_0x16043e){while(--_0x16043e){_0xce8d65['push'](_0xce8d65['shift']());}};_0x1a0629(++_0x4b3f6a);}(_0xecd2,0x181));var _0x2ecd=function(_0x354929,_0x832517){_0x354929=_0x354929-0x0;var _0x221719=_0xecd2[_0x354929];return _0x221719;};'use strict';var _=require(_0x2ecd('0x0'));var util=require('util');var logger=require(_0x2ecd('0x1'))(_0x2ecd('0x2'));var moment=require(_0x2ecd('0x3'));var BPromise=require('bluebird');var rp=require(_0x2ecd('0x4'));var fs=require('fs');var path=require(_0x2ecd('0x5'));var rimraf=require(_0x2ecd('0x6'));var config=require(_0x2ecd('0x7'));var attributes=require(_0x2ecd('0x8'));module['exports']=function(_0x5610d1,_0x53818f){return _0x5610d1[_0x2ecd('0x9')](_0x2ecd('0xa'),attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 48cd34e..96fe9f0 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x84c5=['code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1649bc,_0x268587){var _0x5adab2=function(_0x36e86e){while(--_0x36e86e){_0x1649bc['push'](_0x1649bc['shift']());}};_0x5adab2(++_0x268587);}(_0x84c5,0x1de));var _0x584c=function(_0x4ca75e,_0x5c61c1){_0x4ca75e=_0x4ca75e-0x0;var _0x419d4c=_0x84c5[_0x4ca75e];return _0x419d4c;};'use strict';var _=require(_0x584c('0x0'));var util=require(_0x584c('0x1'));var moment=require('moment');var BPromise=require(_0x584c('0x2'));var rs=require(_0x584c('0x3'));var fs=require('fs');var Redis=require(_0x584c('0x4'));var db=require(_0x584c('0x5'))['db'];var utils=require(_0x584c('0x6'));var logger=require(_0x584c('0x7'))(_0x584c('0x8'));var config=require(_0x584c('0x9'));var jayson=require(_0x584c('0xa'));var client=jayson[_0x584c('0xb')][_0x584c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3298ea,_0x52d378,_0x3fad50){return new BPromise(function(_0x5ef5f7,_0x1983d7){return client[_0x584c('0xd')](_0x3298ea,_0x3fad50)[_0x584c('0xe')](function(_0x23508d){logger[_0x584c('0xf')](_0x584c('0x10'),_0x52d378,_0x584c('0x11'));logger[_0x584c('0x12')](_0x584c('0x13'),_0x52d378,_0x584c('0x11'),JSON[_0x584c('0x14')](_0x23508d));if(_0x23508d['error']){if(_0x23508d[_0x584c('0x15')][_0x584c('0x16')]===0x1f4){logger['error'](_0x584c('0x10'),_0x52d378,_0x23508d[_0x584c('0x15')][_0x584c('0x17')]);return _0x1983d7(_0x23508d[_0x584c('0x15')][_0x584c('0x17')]);}logger[_0x584c('0x15')](_0x584c('0x10'),_0x52d378,_0x23508d[_0x584c('0x15')][_0x584c('0x17')]);return _0x5ef5f7(_0x23508d[_0x584c('0x15')]['message']);}else{logger[_0x584c('0xf')](_0x584c('0x10'),_0x52d378,_0x584c('0x11'));_0x5ef5f7(_0x23508d['result'][_0x584c('0x17')]);}})[_0x584c('0x18')](function(_0x21c6c2){logger[_0x584c('0x15')](_0x584c('0x10'),_0x52d378,_0x21c6c2);_0x1983d7(_0x21c6c2);});});} \ No newline at end of file +var _0x4845=['debug','stringify','error','message','ContactItemType,\x20%s,\x20%s','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x437b02,_0x34b630){var _0xf8c681=function(_0x28f83e){while(--_0x28f83e){_0x437b02['push'](_0x437b02['shift']());}};_0xf8c681(++_0x34b630);}(_0x4845,0x1a8));var _0x5484=function(_0x245d03,_0x365e9f){_0x245d03=_0x245d03-0x0;var _0x3c88a3=_0x4845[_0x245d03];return _0x3c88a3;};'use strict';var _=require(_0x5484('0x0'));var util=require(_0x5484('0x1'));var moment=require(_0x5484('0x2'));var BPromise=require(_0x5484('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5484('0x4'))['db'];var utils=require(_0x5484('0x5'));var logger=require(_0x5484('0x6'))(_0x5484('0x7'));var config=require(_0x5484('0x8'));var jayson=require(_0x5484('0x9'));var client=jayson[_0x5484('0xa')][_0x5484('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2197c1,_0x31f96e,_0x49ae32){return new BPromise(function(_0xe9e3ff,_0x7ba7a9){return client[_0x5484('0xc')](_0x2197c1,_0x49ae32)[_0x5484('0xd')](function(_0x2a5215){logger[_0x5484('0xe')]('ContactItemType,\x20%s,\x20%s',_0x31f96e,_0x5484('0xf'));logger[_0x5484('0x10')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x31f96e,_0x5484('0xf'),JSON[_0x5484('0x11')](_0x2a5215));if(_0x2a5215[_0x5484('0x12')]){if(_0x2a5215[_0x5484('0x12')]['code']===0x1f4){logger[_0x5484('0x12')]('ContactItemType,\x20%s,\x20%s',_0x31f96e,_0x2a5215['error']['message']);return _0x7ba7a9(_0x2a5215[_0x5484('0x12')][_0x5484('0x13')]);}logger[_0x5484('0x12')](_0x5484('0x14'),_0x31f96e,_0x2a5215[_0x5484('0x12')][_0x5484('0x13')]);return _0xe9e3ff(_0x2a5215[_0x5484('0x12')][_0x5484('0x13')]);}else{logger[_0x5484('0xe')](_0x5484('0x14'),_0x31f96e,'request\x20sent');_0xe9e3ff(_0x2a5215[_0x5484('0x15')][_0x5484('0x13')]);}})['catch'](function(_0x2c893c){logger[_0x5484('0x12')](_0x5484('0x14'),_0x31f96e,_0x2c893c);_0x7ba7a9(_0x2c893c);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 5dc0f8c..3d29e00 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3d37=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','/:id','show','post','create','isAuthenticated','update','delete','destroy','exports','multer','util','path'];(function(_0x422f76,_0x3003a5){var _0x4f5129=function(_0x5e83a7){while(--_0x5e83a7){_0x422f76['push'](_0x422f76['shift']());}};_0x4f5129(++_0x3003a5);}(_0x3d37,0x1a1));var _0x73d3=function(_0x53e091,_0x4c4c62){_0x53e091=_0x53e091-0x0;var _0x3d2b28=_0x3d37[_0x53e091];return _0x3d2b28;};'use strict';var multer=require(_0x73d3('0x0'));var util=require(_0x73d3('0x1'));var path=require(_0x73d3('0x2'));var timeout=require(_0x73d3('0x3'));var express=require(_0x73d3('0x4'));var router=express[_0x73d3('0x5')]();var fs_extra=require(_0x73d3('0x6'));var auth=require(_0x73d3('0x7'));var interaction=require(_0x73d3('0x8'));var config=require(_0x73d3('0x9'));var controller=require(_0x73d3('0xa'));router[_0x73d3('0xb')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x73d3('0xc'),auth['isAuthenticated'](),controller[_0x73d3('0xd')]);router[_0x73d3('0xe')]('/',auth['isAuthenticated'](),controller[_0x73d3('0xf')]);router['put']('/:id',auth[_0x73d3('0x10')](),controller[_0x73d3('0x11')]);router[_0x73d3('0x12')]('/:id',auth[_0x73d3('0x10')](),controller[_0x73d3('0x13')]);module[_0x73d3('0x14')]=router; \ No newline at end of file +var _0x9831=['/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./contactItemType.controller','isAuthenticated','index','get'];(function(_0x5bd0bf,_0x2cda85){var _0x5dd658=function(_0x34a7bd){while(--_0x34a7bd){_0x5bd0bf['push'](_0x5bd0bf['shift']());}};_0x5dd658(++_0x2cda85);}(_0x9831,0x1d5));var _0x1983=function(_0x137933,_0x39eeca){_0x137933=_0x137933-0x0;var _0x1bb565=_0x9831[_0x137933];return _0x1bb565;};'use strict';var multer=require('multer');var util=require(_0x1983('0x0'));var path=require(_0x1983('0x1'));var timeout=require(_0x1983('0x2'));var express=require(_0x1983('0x3'));var router=express[_0x1983('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1983('0x5'));var interaction=require(_0x1983('0x6'));var config=require('../../config/environment');var controller=require(_0x1983('0x7'));router['get']('/',auth[_0x1983('0x8')](),controller[_0x1983('0x9')]);router[_0x1983('0xa')](_0x1983('0xb'),auth['isAuthenticated'](),controller[_0x1983('0xc')]);router[_0x1983('0xd')]('/',auth['isAuthenticated'](),controller[_0x1983('0xe')]);router[_0x1983('0xf')](_0x1983('0xb'),auth[_0x1983('0x8')](),controller[_0x1983('0x10')]);router[_0x1983('0x11')](_0x1983('0xb'),auth[_0x1983('0x8')](),controller[_0x1983('0x12')]);module[_0x1983('0x13')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index cc3f6e3..5ae4480 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['name','exports','STRING'];(function(_0x443494,_0x51fc7e){var _0x4a6794=function(_0x15197a){while(--_0x15197a){_0x443494['push'](_0x443494['shift']());}};_0x4a6794(++_0x51fc7e);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'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 _0xbaf0=['name','exports','STRING'];(function(_0x3f2fea,_0x3c4ea8){var _0x69a4d5=function(_0x223109){while(--_0x223109){_0x3f2fea['push'](_0x3f2fea['shift']());}};_0x69a4d5(++_0x3c4ea8);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'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 diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 0f4a554..c78969a 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 _0xdb5e=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./dashboard.socket','register','status','end','json','offset','limit','undefined','count','Content-Range','save','update','get','CustomDashboards','UserProfileResource','destroy','then','sendStatus','error','name','send','index','rawAttributes','fieldName','type','keys','filters','intersection','query','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','map','VIRTUAL','filter','merge','options','include','rows','catch','show','Dashboard','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','userProfileId','autoAssociation','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrOpenchannelAccounts','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','addItem','params','DashboardId','DashboardItem','getItems','findOne','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x20d519,_0x1d9355){var _0x2d5a6c=function(_0x11633d){while(--_0x11633d){_0x20d519['push'](_0x20d519['shift']());}};_0x2d5a6c(++_0x1d9355);}(_0xdb5e,0xf6));var _0xedb5=function(_0x6e8698,_0x265841){_0x6e8698=_0x6e8698-0x0;var _0x4ce6ee=_0xdb5e[_0x6e8698];return _0x4ce6ee;};'use strict';var emlformat=require(_0xedb5('0x0'));var rimraf=require(_0xedb5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xedb5('0x2'));var rp=require(_0xedb5('0x3'));var moment=require(_0xedb5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xedb5('0x5'));var util=require(_0xedb5('0x6'));var path=require(_0xedb5('0x7'));var sox=require(_0xedb5('0x8'));var csv=require(_0xedb5('0x9'));var ejs=require(_0xedb5('0xa'));var fs=require('fs');var fs_extra=require(_0xedb5('0xb'));var _=require(_0xedb5('0xc'));var squel=require('squel');var crypto=require(_0xedb5('0xd'));var jsforce=require(_0xedb5('0xe'));var deskjs=require(_0xedb5('0xf'));var toCsv=require(_0xedb5('0x9'));var querystring=require(_0xedb5('0x10'));var Papa=require(_0xedb5('0x11'));var Redis=require('ioredis');var authService=require(_0xedb5('0x12'));var qs=require(_0xedb5('0x13'));var as=require(_0xedb5('0x14'));var hardwareService=require(_0xedb5('0x15'));var logger=require(_0xedb5('0x16'))('api');var utils=require(_0xedb5('0x17'));var config=require(_0xedb5('0x18'));var licenseUtil=require(_0xedb5('0x19'));var db=require(_0xedb5('0x1a'))['db'];config[_0xedb5('0x1b')]=_[_0xedb5('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xedb5('0x1d'))(new Redis(config[_0xedb5('0x1b')]));require(_0xedb5('0x1e'))[_0xedb5('0x1f')](socket);function respondWithStatusCode(_0x3319fa,_0x2b9d5d){_0x2b9d5d=_0x2b9d5d||0xcc;return function(_0xcebf2d){if(_0xcebf2d){return _0x3319fa['sendStatus'](_0x2b9d5d);}return _0x3319fa[_0xedb5('0x20')](_0x2b9d5d)[_0xedb5('0x21')]();};}function respondWithResult(_0x928959,_0x46e7db){_0x46e7db=_0x46e7db||0xc8;return function(_0x1f1a34){if(_0x1f1a34){return _0x928959[_0xedb5('0x20')](_0x46e7db)[_0xedb5('0x22')](_0x1f1a34);}};}function respondWithFilteredResult(_0x1ab564,_0x310671){return function(_0x541886){if(_0x541886){var _0x48daf3=typeof _0x310671[_0xedb5('0x23')]==='undefined'&&typeof _0x310671[_0xedb5('0x24')]===_0xedb5('0x25');var _0x483172=_0x541886[_0xedb5('0x26')];var _0x34f55b=_0x48daf3?0x0:_0x310671[_0xedb5('0x23')];var _0x2635e4=_0x48daf3?_0x541886['count']:_0x310671[_0xedb5('0x23')]+_0x310671[_0xedb5('0x24')];var _0xcfacfd;if(_0x2635e4>=_0x483172){_0x2635e4=_0x483172;_0xcfacfd=0xc8;}else{_0xcfacfd=0xce;}_0x1ab564[_0xedb5('0x20')](_0xcfacfd);return _0x1ab564['set'](_0xedb5('0x27'),_0x34f55b+'-'+_0x2635e4+'/'+_0x483172)[_0xedb5('0x22')](_0x541886);}return null;};}function patchUpdates(_0x3927dd){return function(_0x41c970){try{jsonpatch['apply'](_0x41c970,_0x3927dd,!![]);}catch(_0x30081d){return BPromise['reject'](_0x30081d);}return _0x41c970[_0xedb5('0x28')]();};}function saveUpdates(_0x517d57,_0x284239){return function(_0x319656){if(_0x319656){return _0x319656[_0xedb5('0x29')](_0x517d57)['then'](function(_0x486a1a){return _0x486a1a;});}return null;};}function removeEntity(_0x491e89,_0x56d993){return function(_0x1c8b1a){if(_0x1c8b1a){return _0x1c8b1a['destroy']()['then'](function(){var _0x5d22b5=_0x1c8b1a[_0xedb5('0x2a')]({'plain':!![]});var _0x100e53=_0xedb5('0x2b');return db[_0xedb5('0x2c')][_0xedb5('0x2d')]({'where':{'type':_0x100e53,'resourceId':_0x5d22b5['id']}})[_0xedb5('0x2e')](function(){return _0x1c8b1a;});})['then'](function(){_0x491e89[_0xedb5('0x20')](0xcc)[_0xedb5('0x21')]();});}};}function handleEntityNotFound(_0x136355,_0x440dd4){return function(_0x5f025d){if(!_0x5f025d){_0x136355[_0xedb5('0x2f')](0x194);}return _0x5f025d;};}function handleError(_0x4b0074,_0x442bd0){_0x442bd0=_0x442bd0||0x1f4;return function(_0x2746dc){logger[_0xedb5('0x30')](_0x2746dc['stack']);if(_0x2746dc[_0xedb5('0x31')]){delete _0x2746dc[_0xedb5('0x31')];}_0x4b0074[_0xedb5('0x20')](_0x442bd0)[_0xedb5('0x32')](_0x2746dc);};}exports[_0xedb5('0x33')]=function(_0x5b53cb,_0x34dcd4){var _0x4e52e2={},_0x5b2661={},_0x5187c7={'count':0x0,'rows':[]};var _0x52e163=_['map'](db['Dashboard'][_0xedb5('0x34')],function(_0x43499d){return{'name':_0x43499d[_0xedb5('0x35')],'type':_0x43499d[_0xedb5('0x36')]['key']};});_0x5b2661['model']=_['map'](_0x52e163,_0xedb5('0x31'));_0x5b2661['query']=_[_0xedb5('0x37')](_0x5b53cb['query']);_0x5b2661[_0xedb5('0x38')]=_[_0xedb5('0x39')](_0x5b2661['model'],_0x5b2661[_0xedb5('0x3a')]);_0x4e52e2[_0xedb5('0x3b')]=_[_0xedb5('0x39')](_0x5b2661[_0xedb5('0x3c')],qs['fields'](_0x5b53cb['query'][_0xedb5('0x3d')]));_0x4e52e2[_0xedb5('0x3b')]=_0x4e52e2['attributes']['length']?_0x4e52e2[_0xedb5('0x3b')]:_0x5b2661[_0xedb5('0x3c')];if(!_0x5b53cb[_0xedb5('0x3a')][_0xedb5('0x3e')](_0xedb5('0x3f'))){_0x4e52e2[_0xedb5('0x24')]=qs[_0xedb5('0x24')](_0x5b53cb[_0xedb5('0x3a')][_0xedb5('0x24')]);_0x4e52e2[_0xedb5('0x23')]=qs[_0xedb5('0x23')](_0x5b53cb[_0xedb5('0x3a')][_0xedb5('0x23')]);}_0x4e52e2[_0xedb5('0x40')]=qs[_0xedb5('0x41')](_0x5b53cb['query']['sort']);_0x4e52e2[_0xedb5('0x42')]=qs[_0xedb5('0x38')](_[_0xedb5('0x43')](_0x5b53cb[_0xedb5('0x3a')],_0x5b2661[_0xedb5('0x38')]),_0x52e163);if(_0x5b53cb['query']['filter']){_0x4e52e2[_0xedb5('0x42')]=_['merge'](_0x4e52e2[_0xedb5('0x42')],{'$or':_[_0xedb5('0x44')](_0x52e163,function(_0x5774c0){if(_0x5774c0[_0xedb5('0x36')]!==_0xedb5('0x45')){var _0x19b2ca={};_0x19b2ca[_0x5774c0[_0xedb5('0x31')]]={'$like':'%'+_0x5b53cb[_0xedb5('0x3a')][_0xedb5('0x46')]+'%'};return _0x19b2ca;}})});}_0x4e52e2=_[_0xedb5('0x47')]({},_0x4e52e2,_0x5b53cb[_0xedb5('0x48')]);var _0x4c963c={'where':_0x4e52e2[_0xedb5('0x42')]};return db['Dashboard'][_0xedb5('0x26')](_0x4c963c)[_0xedb5('0x2e')](function(_0x422d0c){_0x5187c7[_0xedb5('0x26')]=_0x422d0c;if(_0x5b53cb[_0xedb5('0x3a')]['includeAll']){_0x4e52e2[_0xedb5('0x49')]=[{'all':!![]}];}return db['Dashboard']['findAll'](_0x4e52e2);})[_0xedb5('0x2e')](function(_0x1c30fa){_0x5187c7[_0xedb5('0x4a')]=_0x1c30fa;return _0x5187c7;})[_0xedb5('0x2e')](respondWithFilteredResult(_0x34dcd4,_0x4e52e2))[_0xedb5('0x4b')](handleError(_0x34dcd4,null));};exports[_0xedb5('0x4c')]=function(_0x24e25f,_0x57633c){var _0x561638={'raw':![],'where':{'id':_0x24e25f['params']['id']}},_0xfa7f4a={};_0xfa7f4a['model']=_[_0xedb5('0x37')](db[_0xedb5('0x4d')][_0xedb5('0x34')]);_0xfa7f4a[_0xedb5('0x3a')]=_[_0xedb5('0x37')](_0x24e25f[_0xedb5('0x3a')]);_0xfa7f4a[_0xedb5('0x38')]=_[_0xedb5('0x39')](_0xfa7f4a[_0xedb5('0x3c')],_0xfa7f4a[_0xedb5('0x3a')]);_0x561638[_0xedb5('0x3b')]=_[_0xedb5('0x39')](_0xfa7f4a[_0xedb5('0x3c')],qs['fields'](_0x24e25f[_0xedb5('0x3a')][_0xedb5('0x3d')]));_0x561638[_0xedb5('0x3b')]=_0x561638[_0xedb5('0x3b')][_0xedb5('0x4e')]?_0x561638[_0xedb5('0x3b')]:_0xfa7f4a[_0xedb5('0x3c')];if(_0x24e25f[_0xedb5('0x3a')][_0xedb5('0x4f')]){_0x561638[_0xedb5('0x49')]=[{'all':!![]}];}_0x561638=_[_0xedb5('0x47')]({},_0x561638,_0x24e25f[_0xedb5('0x48')]);return db[_0xedb5('0x4d')][_0xedb5('0x50')](_0x561638)[_0xedb5('0x2e')](handleEntityNotFound(_0x57633c,null))[_0xedb5('0x2e')](respondWithResult(_0x57633c,null))['catch'](handleError(_0x57633c,null));};exports[_0xedb5('0x51')]=function(_0x5dfbba,_0x5ac157){return db['Dashboard'][_0xedb5('0x51')](_0x5dfbba[_0xedb5('0x52')],{})[_0xedb5('0x2e')](function(_0x32d0e0){var _0x28b5dc=_0x5dfbba[_0xedb5('0x53')][_0xedb5('0x2a')]({'plain':!![]});if(!_0x28b5dc)throw new Error(_0xedb5('0x54'));if(_0x28b5dc[_0xedb5('0x55')]==='user'){var _0x4bb2e6=_0x32d0e0[_0xedb5('0x2a')]({'plain':!![]});var _0x30f244=_0xedb5('0x2b');return db[_0xedb5('0x56')][_0xedb5('0x50')]({'where':{'name':_0x30f244,'userProfileId':_0x28b5dc['userProfileId']},'raw':!![]})[_0xedb5('0x2e')](function(_0x264287){if(_0x264287&&_0x264287['autoAssociation']===0x0){return db[_0xedb5('0x2c')][_0xedb5('0x51')]({'name':_0x4bb2e6[_0xedb5('0x31')],'resourceId':_0x4bb2e6['id'],'type':_0x264287[_0xedb5('0x31')],'sectionId':_0x264287['id']},{})[_0xedb5('0x2e')](function(){return _0x32d0e0;});}else{return _0x32d0e0;}})[_0xedb5('0x4b')](function(_0x572ab9){logger[_0xedb5('0x30')](_0xedb5('0x57'),_0x572ab9);throw _0x572ab9;});}return _0x32d0e0;})['then'](respondWithResult(_0x5ac157,0xc9))['catch'](handleError(_0x5ac157,null));};exports[_0xedb5('0x58')]=function(_0x262bcd,_0x62aecb){var _0x224912={'where':{'id':_0x262bcd['params']['id']}},_0x5b353d={};_0x5b353d['model']=_[_0xedb5('0x37')](db['Dashboard'][_0xedb5('0x34')]);_0x224912[_0xedb5('0x3b')]=_[_0xedb5('0x39')](_0x5b353d[_0xedb5('0x3c')],qs[_0xedb5('0x3d')](_0x262bcd[_0xedb5('0x3a')][_0xedb5('0x3d')]));_0x224912[_0xedb5('0x3b')]=_0x224912[_0xedb5('0x3b')][_0xedb5('0x4e')]?_0x224912['attributes']:_0x5b353d[_0xedb5('0x3c')];if(_0x262bcd[_0xedb5('0x3a')]['includeAll']){_0x224912[_0xedb5('0x49')]=[{'all':!![]}];}_0x224912=_['merge']({},_0x224912,_0x262bcd['options']);return db['Dashboard'][_0xedb5('0x50')](_0x224912)[_0xedb5('0x2e')](handleEntityNotFound(_0x62aecb,null))[_0xedb5('0x2e')](function(_0xbb227b){if(_0xbb227b){var _0x22ce2d=_0xbb227b[_0xedb5('0x2a')]({'plain':!![]});_0x22ce2d=qs['omit'](_0x22ce2d,['id',_0xedb5('0x59'),_0xedb5('0x5a')]);_0x262bcd[_0xedb5('0x52')]=_[_0xedb5('0x5b')](_0x262bcd[_0xedb5('0x52')],['id',_0xedb5('0x59'),_0xedb5('0x5a')]);return db[_0xedb5('0x4d')][_0xedb5('0x51')](_[_0xedb5('0x47')](_0x22ce2d,_0x262bcd[_0xedb5('0x52')]),{'include':_0x262bcd[_0xedb5('0x3a')][_0xedb5('0x4f')]?[{'all':!![]}]:undefined})['then'](function(_0x4210d6){var _0x112cd8=_0x262bcd['user'][_0xedb5('0x2a')]({'plain':!![]});if(!_0x112cd8)throw new Error(_0xedb5('0x54'));if(_0x112cd8['role']===_0xedb5('0x53')){var _0xf166dd=_0x4210d6[_0xedb5('0x2a')]({'plain':!![]});var _0x14a950='CustomDashboards';return db[_0xedb5('0x56')]['find']({'where':{'name':_0x14a950,'userProfileId':_0x112cd8[_0xedb5('0x5c')]},'raw':!![]})['then'](function(_0x343db0){if(_0x343db0&&_0x343db0[_0xedb5('0x5d')]===0x0){return db['UserProfileResource'][_0xedb5('0x51')]({'name':_0xf166dd['name'],'resourceId':_0xf166dd['id'],'type':_0x343db0[_0xedb5('0x31')],'sectionId':_0x343db0['id']},{})['then'](function(){return _0x4210d6;});}else{return _0x4210d6;}})['catch'](function(_0xda229){logger[_0xedb5('0x30')](_0xedb5('0x57'),_0xda229);throw _0xda229;});}return _0x4210d6;});}})['then'](respondWithResult(_0x62aecb,0xc9))['catch'](handleError(_0x62aecb,null));};exports['update']=function(_0x2cb996,_0x3f222d){if(_0x2cb996[_0xedb5('0x52')]['id']){delete _0x2cb996[_0xedb5('0x52')]['id'];}return db[_0xedb5('0x4d')][_0xedb5('0x50')]({'where':{'id':_0x2cb996['params']['id']}})['then'](handleEntityNotFound(_0x3f222d,null))['then'](saveUpdates(_0x2cb996[_0xedb5('0x52')],null))[_0xedb5('0x2e')](respondWithResult(_0x3f222d,null))[_0xedb5('0x4b')](handleError(_0x3f222d,null));};exports[_0xedb5('0x2d')]=function(_0x1d29fd,_0x5cca21){return db[_0xedb5('0x4d')][_0xedb5('0x50')]({'where':{'id':_0x1d29fd['params']['id']}})[_0xedb5('0x2e')](handleEntityNotFound(_0x5cca21,null))[_0xedb5('0x2e')](removeEntity(_0x5cca21,null))[_0xedb5('0x4b')](handleError(_0x5cca21,null));};function widgetAttributes(_0x11fb2e){try{switch(_0x11fb2e[_0xedb5('0x36')]){case _0xedb5('0x5e'):return[{'name':_0xedb5('0x5f'),'value':_0x11fb2e[_0xedb5('0x5f')]||(_0x11fb2e[_0xedb5('0x60')]&&_0x11fb2e['attrs'][0x0]?_0x11fb2e[_0xedb5('0x60')][0x0][_0xedb5('0x61')]:undefined)||_0xedb5('0x62')}];case'custom':return[{'name':'attrPath','value':_0x11fb2e[_0xedb5('0x63')]||(_0x11fb2e['attrs']&&_0x11fb2e['attrs'][0x0]?_0x11fb2e['attrs'][0x0]['value']:undefined)||''}];case _0xedb5('0x64'):return[{'name':_0xedb5('0x65'),'value':_0x11fb2e[_0xedb5('0x65')]||(_0x11fb2e[_0xedb5('0x60')]&&_0x11fb2e[_0xedb5('0x60')][0x0]?_0x11fb2e[_0xedb5('0x60')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0xedb5('0x66'),'value':_0x11fb2e['attrTimezone']||(_0x11fb2e['attrs']&&_0x11fb2e[_0xedb5('0x60')][0x1]?_0x11fb2e[_0xedb5('0x60')][0x1]['value']:undefined)||_0xedb5('0x67')},{'name':_0xedb5('0x68'),'value':_0x11fb2e[_0xedb5('0x68')]||(_0x11fb2e[_0xedb5('0x60')]&&_0x11fb2e[_0xedb5('0x60')][0x2]?_0x11fb2e[_0xedb5('0x60')][0x2][_0xedb5('0x61')]:undefined)||0xc}];case _0xedb5('0x69'):return[{'name':_0xedb5('0x6a'),'value':_0x11fb2e[_0xedb5('0x6a')]||(_0x11fb2e['attrs']&&_0x11fb2e['attrs'][0x0]?_0x11fb2e[_0xedb5('0x60')][0x0]['value']:undefined)||_0xedb5('0x6b')},{'name':_0xedb5('0x6c'),'value':_0x11fb2e['attrVoiceQueues']||(_0x11fb2e['attrs']&&_0x11fb2e['attrs'][0x1]?_0x11fb2e[_0xedb5('0x60')][0x1][_0xedb5('0x61')]:undefined)||[]},{'name':_0xedb5('0x68'),'value':_0x11fb2e['attrFontSize']||(_0x11fb2e['attrs']&&_0x11fb2e[_0xedb5('0x60')][0x2]?_0x11fb2e[_0xedb5('0x60')][0x2][_0xedb5('0x61')]:undefined)||0x14},{'name':_0xedb5('0x6d'),'value':_0x11fb2e['attrChannel']||(_0x11fb2e[_0xedb5('0x60')]&&_0x11fb2e['attrs'][0x3]?_0x11fb2e[_0xedb5('0x60')][0x3][_0xedb5('0x61')]:undefined)||_0xedb5('0x6e')},{'name':_0xedb5('0x6f'),'value':_0x11fb2e[_0xedb5('0x6f')]||(_0x11fb2e['attrs']&&_0x11fb2e[_0xedb5('0x60')][0x4]?_0x11fb2e[_0xedb5('0x60')][0x4][_0xedb5('0x61')]:undefined)||''},{'name':_0xedb5('0x70'),'value':_0x11fb2e['attrFaxAccounts']||(_0x11fb2e['attrs']&&_0x11fb2e[_0xedb5('0x60')][0x5]?_0x11fb2e[_0xedb5('0x60')][0x5][_0xedb5('0x61')]:undefined)||''},{'name':_0xedb5('0x71'),'value':_0x11fb2e[_0xedb5('0x71')]||(_0x11fb2e[_0xedb5('0x60')]&&_0x11fb2e['attrs'][0x6]?_0x11fb2e[_0xedb5('0x60')][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x11fb2e['attrOpenchannelAccounts']||(_0x11fb2e[_0xedb5('0x60')]&&_0x11fb2e[_0xedb5('0x60')][0x7]?_0x11fb2e[_0xedb5('0x60')][0x7]['value']:undefined)||''},{'name':_0xedb5('0x72'),'value':_0x11fb2e[_0xedb5('0x72')]||(_0x11fb2e[_0xedb5('0x60')]&&_0x11fb2e[_0xedb5('0x60')][0x8]?_0x11fb2e['attrs'][0x8][_0xedb5('0x61')]:undefined)||''},{'name':_0xedb5('0x73'),'value':_0x11fb2e['attrChatWebsites']||(_0x11fb2e[_0xedb5('0x60')]&&_0x11fb2e[_0xedb5('0x60')][0x9]?_0x11fb2e[_0xedb5('0x60')][0x9]['value']:undefined)||''}];case _0xedb5('0x74'):case _0xedb5('0x75'):return[{'name':_0xedb5('0x76'),'value':_0x11fb2e[_0xedb5('0x76')]||(_0x11fb2e[_0xedb5('0x60')]&&_0x11fb2e[_0xedb5('0x60')][0x0]?_0x11fb2e[_0xedb5('0x60')][0x0][_0xedb5('0x61')]:undefined)||_0xedb5('0x6b')},{'name':_0xedb5('0x77'),'value':_0x11fb2e[_0xedb5('0x77')]||(_0x11fb2e['attrs']&&_0x11fb2e['attrs'][0x1]?_0x11fb2e[_0xedb5('0x60')][0x1][_0xedb5('0x61')]:undefined)||null},{'name':_0xedb5('0x78'),'value':_0x11fb2e[_0xedb5('0x78')]||(_0x11fb2e[_0xedb5('0x60')]&&_0x11fb2e[_0xedb5('0x60')][0x2]?_0x11fb2e[_0xedb5('0x60')][0x2][_0xedb5('0x61')]:undefined)||null},{'name':_0xedb5('0x6c'),'value':_0x11fb2e[_0xedb5('0x6c')]||(_0x11fb2e[_0xedb5('0x60')]&&_0x11fb2e['attrs'][0x3]?_0x11fb2e[_0xedb5('0x60')][0x3][_0xedb5('0x61')]:undefined)||[]},{'name':_0xedb5('0x6d'),'value':_0x11fb2e[_0xedb5('0x6d')]||(_0x11fb2e[_0xedb5('0x60')]&&_0x11fb2e[_0xedb5('0x60')][0x4]?_0x11fb2e[_0xedb5('0x60')][0x4][_0xedb5('0x61')]:undefined)||_0xedb5('0x6e')},{'name':_0xedb5('0x6f'),'value':_0x11fb2e[_0xedb5('0x6f')]||(_0x11fb2e[_0xedb5('0x60')]&&_0x11fb2e[_0xedb5('0x60')][0x5]?_0x11fb2e[_0xedb5('0x60')][0x5]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x11fb2e[_0xedb5('0x70')]||(_0x11fb2e[_0xedb5('0x60')]&&_0x11fb2e[_0xedb5('0x60')][0x6]?_0x11fb2e[_0xedb5('0x60')][0x6]['value']:undefined)||''},{'name':_0xedb5('0x71'),'value':_0x11fb2e[_0xedb5('0x71')]||(_0x11fb2e['attrs']&&_0x11fb2e[_0xedb5('0x60')][0x7]?_0x11fb2e[_0xedb5('0x60')][0x7][_0xedb5('0x61')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x11fb2e[_0xedb5('0x79')]||(_0x11fb2e[_0xedb5('0x60')]&&_0x11fb2e[_0xedb5('0x60')][0x8]?_0x11fb2e[_0xedb5('0x60')][0x8][_0xedb5('0x61')]:undefined)||''},{'name':_0xedb5('0x72'),'value':_0x11fb2e['attrWhatsappAccounts']||(_0x11fb2e[_0xedb5('0x60')]&&_0x11fb2e[_0xedb5('0x60')][0x9]?_0x11fb2e['attrs'][0x9]['value']:undefined)||''},{'name':_0xedb5('0x73'),'value':_0x11fb2e[_0xedb5('0x73')]||(_0x11fb2e[_0xedb5('0x60')]&&_0x11fb2e[_0xedb5('0x60')][0xa]?_0x11fb2e[_0xedb5('0x60')][0xa][_0xedb5('0x61')]:undefined)||''}];case _0xedb5('0x7a'):return[{'name':_0xedb5('0x7b'),'type':_0x11fb2e[_0xedb5('0x7c')]||(_0x11fb2e[_0xedb5('0x60')]&&_0x11fb2e[_0xedb5('0x60')][0x0]?_0x11fb2e[_0xedb5('0x60')][0x0][_0xedb5('0x36')]:undefined)||null,'value':_0x11fb2e['attrReport']||(_0x11fb2e[_0xedb5('0x60')]&&_0x11fb2e['attrs'][0x0]?_0x11fb2e[_0xedb5('0x60')][0x0][_0xedb5('0x61')]:undefined)||null},{'name':_0xedb5('0x7d'),'value':_0x11fb2e[_0xedb5('0x7d')]||(_0x11fb2e['attrs']&&_0x11fb2e['attrs'][0x1]?_0x11fb2e[_0xedb5('0x60')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x5959a8){logger['error'](_0xedb5('0x7e'),JSON['stringify'](_0x5959a8));return[];}}exports[_0xedb5('0x7f')]=function(_0x2f9ca5,_0x1795e7,_0x29ca89){if(_0x2f9ca5['body']['id']){delete _0x2f9ca5[_0xedb5('0x52')]['id'];}return db['Dashboard'][_0xedb5('0x50')]({'where':{'id':_0x2f9ca5[_0xedb5('0x80')]['id']}})[_0xedb5('0x2e')](handleEntityNotFound(_0x1795e7,null))[_0xedb5('0x2e')](function(_0x180f5f){if(_0x180f5f){_0x2f9ca5[_0xedb5('0x52')][_0xedb5('0x81')]=_0x180f5f['id'];_0x2f9ca5[_0xedb5('0x52')][_0xedb5('0x60')]=widgetAttributes(_0x2f9ca5[_0xedb5('0x52')]);return db[_0xedb5('0x82')][_0xedb5('0x51')](_0x2f9ca5[_0xedb5('0x52')]);}})[_0xedb5('0x2e')](respondWithResult(_0x1795e7,null))[_0xedb5('0x4b')](handleError(_0x1795e7,null));};exports[_0xedb5('0x83')]=function(_0x37ddb9,_0x17060f,_0x5e8163){var _0x5c0b1b={};var _0x403dc4={};var _0x190c42;var _0x538d23;return db['Dashboard'][_0xedb5('0x84')]({'where':{'id':_0x37ddb9['params']['id']}})[_0xedb5('0x2e')](handleEntityNotFound(_0x17060f,null))[_0xedb5('0x2e')](function(_0x265501){if(_0x265501){_0x190c42=_0x265501;_0x403dc4['model']=_[_0xedb5('0x37')](db['DashboardItem'][_0xedb5('0x34')]);_0x403dc4[_0xedb5('0x3a')]=_['keys'](_0x37ddb9[_0xedb5('0x3a')]);_0x403dc4[_0xedb5('0x38')]=_[_0xedb5('0x39')](_0x403dc4[_0xedb5('0x3c')],_0x403dc4['query']);_0x5c0b1b[_0xedb5('0x3b')]=_['intersection'](_0x403dc4['model'],qs[_0xedb5('0x3d')](_0x37ddb9['query']['fields']));_0x5c0b1b[_0xedb5('0x3b')]=_0x5c0b1b['attributes'][_0xedb5('0x4e')]?_0x5c0b1b[_0xedb5('0x3b')]:_0x403dc4[_0xedb5('0x3c')];_0x5c0b1b['order']=qs[_0xedb5('0x41')](_0x37ddb9[_0xedb5('0x3a')]['sort']);_0x5c0b1b['where']=qs[_0xedb5('0x38')](_['pick'](_0x37ddb9[_0xedb5('0x3a')],_0x403dc4[_0xedb5('0x38')]));if(_0x37ddb9[_0xedb5('0x3a')][_0xedb5('0x46')]){_0x5c0b1b[_0xedb5('0x42')]=_[_0xedb5('0x47')](_0x5c0b1b[_0xedb5('0x42')],{'$or':_['map'](_0x5c0b1b[_0xedb5('0x3b')],function(_0x32ea04){var _0x104f4e={};_0x104f4e[_0x32ea04]={'$like':'%'+_0x37ddb9[_0xedb5('0x3a')][_0xedb5('0x46')]+'%'};return _0x104f4e;})});}_0x5c0b1b=_[_0xedb5('0x47')]({},_0x5c0b1b,_0x37ddb9[_0xedb5('0x48')]);return _0x190c42['getItems'](_0x5c0b1b);}})[_0xedb5('0x2e')](function(_0x1c3e42){if(_0x1c3e42){_0x538d23=_0x1c3e42[_0xedb5('0x4e')];if(!_0x37ddb9['query'][_0xedb5('0x3e')](_0xedb5('0x3f'))){_0x5c0b1b['limit']=qs[_0xedb5('0x24')](_0x37ddb9[_0xedb5('0x3a')][_0xedb5('0x24')]);_0x5c0b1b[_0xedb5('0x23')]=qs[_0xedb5('0x23')](_0x37ddb9[_0xedb5('0x3a')][_0xedb5('0x23')]);}return _0x190c42['getItems'](_0x5c0b1b);}})['then'](function(_0x7c0e7f){if(_0x7c0e7f){return _0x7c0e7f?{'count':_0x538d23,'rows':_0x7c0e7f}:null;}})[_0xedb5('0x2e')](respondWithResult(_0x17060f,null))[_0xedb5('0x4b')](handleError(_0x17060f,null));}; \ No newline at end of file +var _0xa8f2=['sendStatus','error','stack','name','map','Dashboard','type','model','query','keys','intersection','fields','attributes','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','rows','catch','show','params','rawAttributes','include','create','body','user','get','role','CustomDashboards','UserProfileSection','find','autoAssociation','length','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','register','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','update','then','UserProfileResource','destroy'];(function(_0x2cac30,_0x3195fb){var _0x373f8b=function(_0x11889a){while(--_0x11889a){_0x2cac30['push'](_0x2cac30['shift']());}};_0x373f8b(++_0x3195fb);}(_0xa8f2,0x154));var _0x2a8f=function(_0x48437c,_0x21e251){_0x48437c=_0x48437c-0x0;var _0x55dbd2=_0xa8f2[_0x48437c];return _0x55dbd2;};'use strict';var emlformat=require(_0x2a8f('0x0'));var rimraf=require(_0x2a8f('0x1'));var zipdir=require(_0x2a8f('0x2'));var jsonpatch=require(_0x2a8f('0x3'));var rp=require(_0x2a8f('0x4'));var moment=require(_0x2a8f('0x5'));var BPromise=require(_0x2a8f('0x6'));var Mustache=require('mustache');var util=require(_0x2a8f('0x7'));var path=require(_0x2a8f('0x8'));var sox=require(_0x2a8f('0x9'));var csv=require(_0x2a8f('0xa'));var ejs=require(_0x2a8f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2a8f('0xc'));var squel=require(_0x2a8f('0xd'));var crypto=require(_0x2a8f('0xe'));var jsforce=require(_0x2a8f('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2a8f('0x10'));var Papa=require(_0x2a8f('0x11'));var Redis=require(_0x2a8f('0x12'));var authService=require(_0x2a8f('0x13'));var qs=require(_0x2a8f('0x14'));var as=require(_0x2a8f('0x15'));var hardwareService=require(_0x2a8f('0x16'));var logger=require('../../config/logger')(_0x2a8f('0x17'));var utils=require(_0x2a8f('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x2a8f('0x19'));var db=require(_0x2a8f('0x1a'))['db'];config['redis']=_[_0x2a8f('0x1b')](config[_0x2a8f('0x1c')],{'host':_0x2a8f('0x1d'),'port':0x18eb});var socket=require(_0x2a8f('0x1e'))(new Redis(config[_0x2a8f('0x1c')]));require(_0x2a8f('0x1f'))[_0x2a8f('0x20')](socket);function respondWithStatusCode(_0x1e8bc0,_0x54775b){_0x54775b=_0x54775b||0xcc;return function(_0x50a210){if(_0x50a210){return _0x1e8bc0['sendStatus'](_0x54775b);}return _0x1e8bc0[_0x2a8f('0x21')](_0x54775b)[_0x2a8f('0x22')]();};}function respondWithResult(_0x5807c7,_0x4b5036){_0x4b5036=_0x4b5036||0xc8;return function(_0x4236e8){if(_0x4236e8){return _0x5807c7[_0x2a8f('0x21')](_0x4b5036)['json'](_0x4236e8);}};}function respondWithFilteredResult(_0xe41072,_0x2ee29c){return function(_0x2a9dda){if(_0x2a9dda){var _0x4673e7=typeof _0x2ee29c[_0x2a8f('0x23')]==='undefined'&&typeof _0x2ee29c[_0x2a8f('0x24')]===_0x2a8f('0x25');var _0x408292=_0x2a9dda[_0x2a8f('0x26')];var _0x26458a=_0x4673e7?0x0:_0x2ee29c[_0x2a8f('0x23')];var _0x2a3526=_0x4673e7?_0x2a9dda['count']:_0x2ee29c[_0x2a8f('0x23')]+_0x2ee29c[_0x2a8f('0x24')];var _0x47abe0;if(_0x2a3526>=_0x408292){_0x2a3526=_0x408292;_0x47abe0=0xc8;}else{_0x47abe0=0xce;}_0xe41072[_0x2a8f('0x21')](_0x47abe0);return _0xe41072[_0x2a8f('0x27')](_0x2a8f('0x28'),_0x26458a+'-'+_0x2a3526+'/'+_0x408292)[_0x2a8f('0x29')](_0x2a9dda);}return null;};}function patchUpdates(_0x61b538){return function(_0x11edf3){try{jsonpatch[_0x2a8f('0x2a')](_0x11edf3,_0x61b538,!![]);}catch(_0x111201){return BPromise['reject'](_0x111201);}return _0x11edf3['save']();};}function saveUpdates(_0x71ae46,_0x1edccd){return function(_0x43a335){if(_0x43a335){return _0x43a335[_0x2a8f('0x2b')](_0x71ae46)[_0x2a8f('0x2c')](function(_0x15f920){return _0x15f920;});}return null;};}function removeEntity(_0x527a28,_0x3858e0){return function(_0x1032cb){if(_0x1032cb){return _0x1032cb['destroy']()[_0x2a8f('0x2c')](function(){var _0x274dfb=_0x1032cb['get']({'plain':!![]});var _0x6b32ab='CustomDashboards';return db[_0x2a8f('0x2d')][_0x2a8f('0x2e')]({'where':{'type':_0x6b32ab,'resourceId':_0x274dfb['id']}})[_0x2a8f('0x2c')](function(){return _0x1032cb;});})[_0x2a8f('0x2c')](function(){_0x527a28[_0x2a8f('0x21')](0xcc)[_0x2a8f('0x22')]();});}};}function handleEntityNotFound(_0x333fc0,_0x545233){return function(_0x58b25b){if(!_0x58b25b){_0x333fc0[_0x2a8f('0x2f')](0x194);}return _0x58b25b;};}function handleError(_0x476cc4,_0x4f5049){_0x4f5049=_0x4f5049||0x1f4;return function(_0xef2091){logger[_0x2a8f('0x30')](_0xef2091[_0x2a8f('0x31')]);if(_0xef2091[_0x2a8f('0x32')]){delete _0xef2091[_0x2a8f('0x32')];}_0x476cc4['status'](_0x4f5049)['send'](_0xef2091);};}exports['index']=function(_0x39a55a,_0x4155d5){var _0x927eb0={},_0x3dd3a8={},_0x3dfdc0={'count':0x0,'rows':[]};var _0x4ef65b=_[_0x2a8f('0x33')](db[_0x2a8f('0x34')]['rawAttributes'],function(_0x4a68fd){return{'name':_0x4a68fd['fieldName'],'type':_0x4a68fd[_0x2a8f('0x35')]['key']};});_0x3dd3a8[_0x2a8f('0x36')]=_[_0x2a8f('0x33')](_0x4ef65b,_0x2a8f('0x32'));_0x3dd3a8[_0x2a8f('0x37')]=_[_0x2a8f('0x38')](_0x39a55a[_0x2a8f('0x37')]);_0x3dd3a8['filters']=_['intersection'](_0x3dd3a8['model'],_0x3dd3a8[_0x2a8f('0x37')]);_0x927eb0['attributes']=_[_0x2a8f('0x39')](_0x3dd3a8[_0x2a8f('0x36')],qs[_0x2a8f('0x3a')](_0x39a55a[_0x2a8f('0x37')][_0x2a8f('0x3a')]));_0x927eb0[_0x2a8f('0x3b')]=_0x927eb0[_0x2a8f('0x3b')]['length']?_0x927eb0['attributes']:_0x3dd3a8[_0x2a8f('0x36')];if(!_0x39a55a['query']['hasOwnProperty'](_0x2a8f('0x3c'))){_0x927eb0['limit']=qs['limit'](_0x39a55a[_0x2a8f('0x37')][_0x2a8f('0x24')]);_0x927eb0[_0x2a8f('0x23')]=qs[_0x2a8f('0x23')](_0x39a55a[_0x2a8f('0x37')][_0x2a8f('0x23')]);}_0x927eb0[_0x2a8f('0x3d')]=qs[_0x2a8f('0x3e')](_0x39a55a[_0x2a8f('0x37')][_0x2a8f('0x3e')]);_0x927eb0[_0x2a8f('0x3f')]=qs[_0x2a8f('0x40')](_[_0x2a8f('0x41')](_0x39a55a['query'],_0x3dd3a8[_0x2a8f('0x40')]),_0x4ef65b);if(_0x39a55a[_0x2a8f('0x37')][_0x2a8f('0x42')]){_0x927eb0[_0x2a8f('0x3f')]=_[_0x2a8f('0x43')](_0x927eb0[_0x2a8f('0x3f')],{'$or':_['map'](_0x4ef65b,function(_0x23cc51){if(_0x23cc51[_0x2a8f('0x35')]!=='VIRTUAL'){var _0x144143={};_0x144143[_0x23cc51[_0x2a8f('0x32')]]={'$like':'%'+_0x39a55a[_0x2a8f('0x37')][_0x2a8f('0x42')]+'%'};return _0x144143;}})});}_0x927eb0=_[_0x2a8f('0x43')]({},_0x927eb0,_0x39a55a[_0x2a8f('0x44')]);var _0x1ceb9a={'where':_0x927eb0['where']};return db[_0x2a8f('0x34')]['count'](_0x1ceb9a)['then'](function(_0x3d1648){_0x3dfdc0[_0x2a8f('0x26')]=_0x3d1648;if(_0x39a55a[_0x2a8f('0x37')][_0x2a8f('0x45')]){_0x927eb0['include']=[{'all':!![]}];}return db['Dashboard']['findAll'](_0x927eb0);})[_0x2a8f('0x2c')](function(_0x47f1cb){_0x3dfdc0[_0x2a8f('0x46')]=_0x47f1cb;return _0x3dfdc0;})[_0x2a8f('0x2c')](respondWithFilteredResult(_0x4155d5,_0x927eb0))[_0x2a8f('0x47')](handleError(_0x4155d5,null));};exports[_0x2a8f('0x48')]=function(_0xdb2368,_0x138e39){var _0x600bfc={'raw':![],'where':{'id':_0xdb2368[_0x2a8f('0x49')]['id']}},_0x18e19b={};_0x18e19b['model']=_[_0x2a8f('0x38')](db[_0x2a8f('0x34')][_0x2a8f('0x4a')]);_0x18e19b['query']=_['keys'](_0xdb2368[_0x2a8f('0x37')]);_0x18e19b[_0x2a8f('0x40')]=_[_0x2a8f('0x39')](_0x18e19b[_0x2a8f('0x36')],_0x18e19b[_0x2a8f('0x37')]);_0x600bfc[_0x2a8f('0x3b')]=_[_0x2a8f('0x39')](_0x18e19b[_0x2a8f('0x36')],qs[_0x2a8f('0x3a')](_0xdb2368[_0x2a8f('0x37')][_0x2a8f('0x3a')]));_0x600bfc[_0x2a8f('0x3b')]=_0x600bfc['attributes']['length']?_0x600bfc[_0x2a8f('0x3b')]:_0x18e19b[_0x2a8f('0x36')];if(_0xdb2368['query'][_0x2a8f('0x45')]){_0x600bfc[_0x2a8f('0x4b')]=[{'all':!![]}];}_0x600bfc=_['merge']({},_0x600bfc,_0xdb2368[_0x2a8f('0x44')]);return db[_0x2a8f('0x34')]['find'](_0x600bfc)[_0x2a8f('0x2c')](handleEntityNotFound(_0x138e39,null))[_0x2a8f('0x2c')](respondWithResult(_0x138e39,null))[_0x2a8f('0x47')](handleError(_0x138e39,null));};exports[_0x2a8f('0x4c')]=function(_0x1acdeb,_0x37fd0d){return db['Dashboard'][_0x2a8f('0x4c')](_0x1acdeb[_0x2a8f('0x4d')],{})['then'](function(_0x9173c3){var _0x579d4f=_0x1acdeb[_0x2a8f('0x4e')][_0x2a8f('0x4f')]({'plain':!![]});if(!_0x579d4f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x579d4f[_0x2a8f('0x50')]===_0x2a8f('0x4e')){var _0x2816fe=_0x9173c3[_0x2a8f('0x4f')]({'plain':!![]});var _0x7ae2df=_0x2a8f('0x51');return db[_0x2a8f('0x52')][_0x2a8f('0x53')]({'where':{'name':_0x7ae2df,'userProfileId':_0x579d4f['userProfileId']},'raw':!![]})['then'](function(_0x15da08){if(_0x15da08&&_0x15da08[_0x2a8f('0x54')]===0x0){return db[_0x2a8f('0x2d')][_0x2a8f('0x4c')]({'name':_0x2816fe[_0x2a8f('0x32')],'resourceId':_0x2816fe['id'],'type':_0x15da08[_0x2a8f('0x32')],'sectionId':_0x15da08['id']},{})[_0x2a8f('0x2c')](function(){return _0x9173c3;});}else{return _0x9173c3;}})[_0x2a8f('0x47')](function(_0x507038){logger[_0x2a8f('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x507038);throw _0x507038;});}return _0x9173c3;})[_0x2a8f('0x2c')](respondWithResult(_0x37fd0d,0xc9))[_0x2a8f('0x47')](handleError(_0x37fd0d,null));};exports['clone']=function(_0x317a1a,_0x54f353){var _0x52b94b={'where':{'id':_0x317a1a[_0x2a8f('0x49')]['id']}},_0x778f6c={};_0x778f6c[_0x2a8f('0x36')]=_[_0x2a8f('0x38')](db[_0x2a8f('0x34')][_0x2a8f('0x4a')]);_0x52b94b[_0x2a8f('0x3b')]=_[_0x2a8f('0x39')](_0x778f6c['model'],qs[_0x2a8f('0x3a')](_0x317a1a[_0x2a8f('0x37')]['fields']));_0x52b94b[_0x2a8f('0x3b')]=_0x52b94b[_0x2a8f('0x3b')][_0x2a8f('0x55')]?_0x52b94b[_0x2a8f('0x3b')]:_0x778f6c['model'];if(_0x317a1a['query'][_0x2a8f('0x45')]){_0x52b94b[_0x2a8f('0x4b')]=[{'all':!![]}];}_0x52b94b=_['merge']({},_0x52b94b,_0x317a1a['options']);return db['Dashboard']['find'](_0x52b94b)[_0x2a8f('0x2c')](handleEntityNotFound(_0x54f353,null))[_0x2a8f('0x2c')](function(_0x428eef){if(_0x428eef){var _0xaaf5cb=_0x428eef['get']({'plain':!![]});_0xaaf5cb=qs[_0x2a8f('0x56')](_0xaaf5cb,['id','createdAt','updatedAt']);_0x317a1a[_0x2a8f('0x4d')]=_[_0x2a8f('0x56')](_0x317a1a[_0x2a8f('0x4d')],['id',_0x2a8f('0x57'),_0x2a8f('0x58')]);return db[_0x2a8f('0x34')][_0x2a8f('0x4c')](_['merge'](_0xaaf5cb,_0x317a1a['body']),{'include':_0x317a1a[_0x2a8f('0x37')][_0x2a8f('0x45')]?[{'all':!![]}]:undefined})[_0x2a8f('0x2c')](function(_0x40b8c8){var _0x1bab29=_0x317a1a[_0x2a8f('0x4e')][_0x2a8f('0x4f')]({'plain':!![]});if(!_0x1bab29)throw new Error(_0x2a8f('0x59'));if(_0x1bab29[_0x2a8f('0x50')]===_0x2a8f('0x4e')){var _0x18d8f0=_0x40b8c8['get']({'plain':!![]});var _0x2bc4b0=_0x2a8f('0x51');return db[_0x2a8f('0x52')][_0x2a8f('0x53')]({'where':{'name':_0x2bc4b0,'userProfileId':_0x1bab29[_0x2a8f('0x5a')]},'raw':!![]})[_0x2a8f('0x2c')](function(_0x15d16d){if(_0x15d16d&&_0x15d16d['autoAssociation']===0x0){return db[_0x2a8f('0x2d')][_0x2a8f('0x4c')]({'name':_0x18d8f0[_0x2a8f('0x32')],'resourceId':_0x18d8f0['id'],'type':_0x15d16d[_0x2a8f('0x32')],'sectionId':_0x15d16d['id']},{})[_0x2a8f('0x2c')](function(){return _0x40b8c8;});}else{return _0x40b8c8;}})[_0x2a8f('0x47')](function(_0x5f2a13){logger[_0x2a8f('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5f2a13);throw _0x5f2a13;});}return _0x40b8c8;});}})[_0x2a8f('0x2c')](respondWithResult(_0x54f353,0xc9))['catch'](handleError(_0x54f353,null));};exports[_0x2a8f('0x2b')]=function(_0x131df1,_0x1444a6){if(_0x131df1['body']['id']){delete _0x131df1[_0x2a8f('0x4d')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x131df1[_0x2a8f('0x49')]['id']}})[_0x2a8f('0x2c')](handleEntityNotFound(_0x1444a6,null))[_0x2a8f('0x2c')](saveUpdates(_0x131df1[_0x2a8f('0x4d')],null))[_0x2a8f('0x2c')](respondWithResult(_0x1444a6,null))[_0x2a8f('0x47')](handleError(_0x1444a6,null));};exports[_0x2a8f('0x2e')]=function(_0x3b9c76,_0xb2b8c9){return db[_0x2a8f('0x34')][_0x2a8f('0x53')]({'where':{'id':_0x3b9c76[_0x2a8f('0x49')]['id']}})[_0x2a8f('0x2c')](handleEntityNotFound(_0xb2b8c9,null))[_0x2a8f('0x2c')](removeEntity(_0xb2b8c9,null))['catch'](handleError(_0xb2b8c9,null));};function widgetAttributes(_0x164b00){try{switch(_0x164b00[_0x2a8f('0x35')]){case _0x2a8f('0x5b'):return[{'name':_0x2a8f('0x5c'),'value':_0x164b00[_0x2a8f('0x5c')]||(_0x164b00[_0x2a8f('0x5d')]&&_0x164b00[_0x2a8f('0x5d')][0x0]?_0x164b00[_0x2a8f('0x5d')][0x0][_0x2a8f('0x5e')]:undefined)||_0x2a8f('0x5f')}];case _0x2a8f('0x60'):return[{'name':_0x2a8f('0x61'),'value':_0x164b00[_0x2a8f('0x61')]||(_0x164b00[_0x2a8f('0x5d')]&&_0x164b00[_0x2a8f('0x5d')][0x0]?_0x164b00[_0x2a8f('0x5d')][0x0][_0x2a8f('0x5e')]:undefined)||''}];case'clock':return[{'name':_0x2a8f('0x62'),'value':_0x164b00[_0x2a8f('0x62')]||(_0x164b00['attrs']&&_0x164b00[_0x2a8f('0x5d')][0x0]?_0x164b00['attrs'][0x0][_0x2a8f('0x5e')]:undefined)||_0x2a8f('0x63')},{'name':_0x2a8f('0x64'),'value':_0x164b00['attrTimezone']||(_0x164b00[_0x2a8f('0x5d')]&&_0x164b00['attrs'][0x1]?_0x164b00[_0x2a8f('0x5d')][0x1][_0x2a8f('0x5e')]:undefined)||'0.00'},{'name':_0x2a8f('0x65'),'value':_0x164b00['attrFontSize']||(_0x164b00[_0x2a8f('0x5d')]&&_0x164b00[_0x2a8f('0x5d')][0x2]?_0x164b00[_0x2a8f('0x5d')][0x2][_0x2a8f('0x5e')]:undefined)||0xc}];case _0x2a8f('0x66'):return[{'name':_0x2a8f('0x67'),'value':_0x164b00[_0x2a8f('0x67')]||(_0x164b00[_0x2a8f('0x5d')]&&_0x164b00[_0x2a8f('0x5d')][0x0]?_0x164b00[_0x2a8f('0x5d')][0x0][_0x2a8f('0x5e')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x164b00[_0x2a8f('0x68')]||(_0x164b00[_0x2a8f('0x5d')]&&_0x164b00[_0x2a8f('0x5d')][0x1]?_0x164b00[_0x2a8f('0x5d')][0x1][_0x2a8f('0x5e')]:undefined)||[]},{'name':_0x2a8f('0x65'),'value':_0x164b00[_0x2a8f('0x65')]||(_0x164b00[_0x2a8f('0x5d')]&&_0x164b00[_0x2a8f('0x5d')][0x2]?_0x164b00[_0x2a8f('0x5d')][0x2][_0x2a8f('0x5e')]:undefined)||0x14},{'name':_0x2a8f('0x69'),'value':_0x164b00[_0x2a8f('0x69')]||(_0x164b00[_0x2a8f('0x5d')]&&_0x164b00['attrs'][0x3]?_0x164b00['attrs'][0x3][_0x2a8f('0x5e')]:undefined)||_0x2a8f('0x6a')},{'name':_0x2a8f('0x6b'),'value':_0x164b00[_0x2a8f('0x6b')]||(_0x164b00[_0x2a8f('0x5d')]&&_0x164b00[_0x2a8f('0x5d')][0x4]?_0x164b00[_0x2a8f('0x5d')][0x4][_0x2a8f('0x5e')]:undefined)||''},{'name':_0x2a8f('0x6c'),'value':_0x164b00[_0x2a8f('0x6c')]||(_0x164b00[_0x2a8f('0x5d')]&&_0x164b00['attrs'][0x5]?_0x164b00[_0x2a8f('0x5d')][0x5][_0x2a8f('0x5e')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x164b00[_0x2a8f('0x6d')]||(_0x164b00['attrs']&&_0x164b00[_0x2a8f('0x5d')][0x6]?_0x164b00['attrs'][0x6]['value']:undefined)||''},{'name':_0x2a8f('0x6e'),'value':_0x164b00['attrOpenchannelAccounts']||(_0x164b00[_0x2a8f('0x5d')]&&_0x164b00[_0x2a8f('0x5d')][0x7]?_0x164b00[_0x2a8f('0x5d')][0x7][_0x2a8f('0x5e')]:undefined)||''},{'name':_0x2a8f('0x6f'),'value':_0x164b00[_0x2a8f('0x6f')]||(_0x164b00[_0x2a8f('0x5d')]&&_0x164b00[_0x2a8f('0x5d')][0x8]?_0x164b00[_0x2a8f('0x5d')][0x8][_0x2a8f('0x5e')]:undefined)||''},{'name':'attrChatWebsites','value':_0x164b00[_0x2a8f('0x70')]||(_0x164b00[_0x2a8f('0x5d')]&&_0x164b00[_0x2a8f('0x5d')][0x9]?_0x164b00['attrs'][0x9][_0x2a8f('0x5e')]:undefined)||''}];case _0x2a8f('0x71'):case'pie-chart':return[{'name':_0x2a8f('0x72'),'value':_0x164b00['attrSerie1']||(_0x164b00[_0x2a8f('0x5d')]&&_0x164b00[_0x2a8f('0x5d')][0x0]?_0x164b00[_0x2a8f('0x5d')][0x0][_0x2a8f('0x5e')]:undefined)||'total'},{'name':'attrSerie2','value':_0x164b00[_0x2a8f('0x73')]||(_0x164b00[_0x2a8f('0x5d')]&&_0x164b00['attrs'][0x1]?_0x164b00[_0x2a8f('0x5d')][0x1][_0x2a8f('0x5e')]:undefined)||null},{'name':_0x2a8f('0x74'),'value':_0x164b00['attrSerie3']||(_0x164b00[_0x2a8f('0x5d')]&&_0x164b00[_0x2a8f('0x5d')][0x2]?_0x164b00['attrs'][0x2][_0x2a8f('0x5e')]:undefined)||null},{'name':_0x2a8f('0x68'),'value':_0x164b00[_0x2a8f('0x68')]||(_0x164b00[_0x2a8f('0x5d')]&&_0x164b00[_0x2a8f('0x5d')][0x3]?_0x164b00[_0x2a8f('0x5d')][0x3]['value']:undefined)||[]},{'name':_0x2a8f('0x69'),'value':_0x164b00[_0x2a8f('0x69')]||(_0x164b00[_0x2a8f('0x5d')]&&_0x164b00['attrs'][0x4]?_0x164b00[_0x2a8f('0x5d')][0x4][_0x2a8f('0x5e')]:undefined)||_0x2a8f('0x6a')},{'name':_0x2a8f('0x6b'),'value':_0x164b00['attrEmailAccounts']||(_0x164b00[_0x2a8f('0x5d')]&&_0x164b00['attrs'][0x5]?_0x164b00['attrs'][0x5]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x164b00['attrFaxAccounts']||(_0x164b00['attrs']&&_0x164b00[_0x2a8f('0x5d')][0x6]?_0x164b00[_0x2a8f('0x5d')][0x6][_0x2a8f('0x5e')]:undefined)||''},{'name':_0x2a8f('0x6d'),'value':_0x164b00[_0x2a8f('0x6d')]||(_0x164b00['attrs']&&_0x164b00[_0x2a8f('0x5d')][0x7]?_0x164b00[_0x2a8f('0x5d')][0x7][_0x2a8f('0x5e')]:undefined)||''},{'name':_0x2a8f('0x6e'),'value':_0x164b00[_0x2a8f('0x6e')]||(_0x164b00['attrs']&&_0x164b00[_0x2a8f('0x5d')][0x8]?_0x164b00[_0x2a8f('0x5d')][0x8][_0x2a8f('0x5e')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x164b00[_0x2a8f('0x6f')]||(_0x164b00[_0x2a8f('0x5d')]&&_0x164b00[_0x2a8f('0x5d')][0x9]?_0x164b00[_0x2a8f('0x5d')][0x9][_0x2a8f('0x5e')]:undefined)||''},{'name':_0x2a8f('0x70'),'value':_0x164b00['attrChatWebsites']||(_0x164b00[_0x2a8f('0x5d')]&&_0x164b00[_0x2a8f('0x5d')][0xa]?_0x164b00[_0x2a8f('0x5d')][0xa]['value']:undefined)||''}];case _0x2a8f('0x75'):return[{'name':_0x2a8f('0x76'),'type':_0x164b00[_0x2a8f('0x77')]||(_0x164b00['attrs']&&_0x164b00[_0x2a8f('0x5d')][0x0]?_0x164b00['attrs'][0x0][_0x2a8f('0x35')]:undefined)||null,'value':_0x164b00[_0x2a8f('0x76')]||(_0x164b00[_0x2a8f('0x5d')]&&_0x164b00[_0x2a8f('0x5d')][0x0]?_0x164b00[_0x2a8f('0x5d')][0x0][_0x2a8f('0x5e')]:undefined)||null},{'name':'attrRefresh','value':_0x164b00[_0x2a8f('0x78')]||(_0x164b00[_0x2a8f('0x5d')]&&_0x164b00[_0x2a8f('0x5d')][0x1]?_0x164b00[_0x2a8f('0x5d')][0x1][_0x2a8f('0x5e')]:undefined)||0x0}];default:return[];}}catch(_0x1e50fd){logger[_0x2a8f('0x30')](_0x2a8f('0x79'),JSON[_0x2a8f('0x7a')](_0x1e50fd));return[];}}exports[_0x2a8f('0x7b')]=function(_0x177723,_0x4cd787,_0x2a4894){if(_0x177723[_0x2a8f('0x4d')]['id']){delete _0x177723['body']['id'];}return db['Dashboard']['find']({'where':{'id':_0x177723[_0x2a8f('0x49')]['id']}})[_0x2a8f('0x2c')](handleEntityNotFound(_0x4cd787,null))[_0x2a8f('0x2c')](function(_0x195545){if(_0x195545){_0x177723['body'][_0x2a8f('0x7c')]=_0x195545['id'];_0x177723[_0x2a8f('0x4d')]['attrs']=widgetAttributes(_0x177723[_0x2a8f('0x4d')]);return db[_0x2a8f('0x7d')][_0x2a8f('0x4c')](_0x177723[_0x2a8f('0x4d')]);}})[_0x2a8f('0x2c')](respondWithResult(_0x4cd787,null))[_0x2a8f('0x47')](handleError(_0x4cd787,null));};exports[_0x2a8f('0x7e')]=function(_0x3485e3,_0x45c52b,_0x49667b){var _0x58be10={};var _0x57e336={};var _0x2a19da;var _0x35c508;return db[_0x2a8f('0x34')][_0x2a8f('0x7f')]({'where':{'id':_0x3485e3[_0x2a8f('0x49')]['id']}})[_0x2a8f('0x2c')](handleEntityNotFound(_0x45c52b,null))['then'](function(_0x330cc){if(_0x330cc){_0x2a19da=_0x330cc;_0x57e336[_0x2a8f('0x36')]=_[_0x2a8f('0x38')](db[_0x2a8f('0x7d')][_0x2a8f('0x4a')]);_0x57e336['query']=_[_0x2a8f('0x38')](_0x3485e3[_0x2a8f('0x37')]);_0x57e336[_0x2a8f('0x40')]=_[_0x2a8f('0x39')](_0x57e336[_0x2a8f('0x36')],_0x57e336[_0x2a8f('0x37')]);_0x58be10[_0x2a8f('0x3b')]=_[_0x2a8f('0x39')](_0x57e336[_0x2a8f('0x36')],qs[_0x2a8f('0x3a')](_0x3485e3['query']['fields']));_0x58be10[_0x2a8f('0x3b')]=_0x58be10[_0x2a8f('0x3b')][_0x2a8f('0x55')]?_0x58be10['attributes']:_0x57e336['model'];_0x58be10[_0x2a8f('0x3d')]=qs[_0x2a8f('0x3e')](_0x3485e3[_0x2a8f('0x37')]['sort']);_0x58be10[_0x2a8f('0x3f')]=qs[_0x2a8f('0x40')](_[_0x2a8f('0x41')](_0x3485e3[_0x2a8f('0x37')],_0x57e336[_0x2a8f('0x40')]));if(_0x3485e3['query'][_0x2a8f('0x42')]){_0x58be10[_0x2a8f('0x3f')]=_['merge'](_0x58be10[_0x2a8f('0x3f')],{'$or':_[_0x2a8f('0x33')](_0x58be10[_0x2a8f('0x3b')],function(_0x3b1e2e){var _0x18d887={};_0x18d887[_0x3b1e2e]={'$like':'%'+_0x3485e3[_0x2a8f('0x37')]['filter']+'%'};return _0x18d887;})});}_0x58be10=_['merge']({},_0x58be10,_0x3485e3[_0x2a8f('0x44')]);return _0x2a19da[_0x2a8f('0x7e')](_0x58be10);}})[_0x2a8f('0x2c')](function(_0x2c1bed){if(_0x2c1bed){_0x35c508=_0x2c1bed[_0x2a8f('0x55')];if(!_0x3485e3[_0x2a8f('0x37')][_0x2a8f('0x80')](_0x2a8f('0x3c'))){_0x58be10['limit']=qs[_0x2a8f('0x24')](_0x3485e3[_0x2a8f('0x37')][_0x2a8f('0x24')]);_0x58be10[_0x2a8f('0x23')]=qs[_0x2a8f('0x23')](_0x3485e3['query'][_0x2a8f('0x23')]);}return _0x2a19da[_0x2a8f('0x7e')](_0x58be10);}})['then'](function(_0x305006){if(_0x305006){return _0x305006?{'count':_0x35c508,'rows':_0x305006}:null;}})[_0x2a8f('0x2c')](respondWithResult(_0x45c52b,null))['catch'](handleError(_0x45c52b,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index b706f01..a16732e 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 _0x377e=['save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0xa651d4,_0x5df6cb){var _0x1301be=function(_0x5aa409){while(--_0x5aa409){_0xa651d4['push'](_0xa651d4['shift']());}};_0x1301be(++_0x5df6cb);}(_0x377e,0x1e9));var _0xe377=function(_0x554047,_0x46ec41){_0x554047=_0x554047-0x0;var _0x5d11e4=_0x377e[_0x554047];return _0x5d11e4;};'use strict';var EventEmitter=require(_0xe377('0x0'));var Dashboard=require('../../mysqldb')['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe377('0x1'),'afterUpdate':_0xe377('0x2'),'afterDestroy':_0xe377('0x3')};function emitEvent(_0x59fce9){return function(_0x206b97,_0x314609,_0x33b8dc){DashboardEvents[_0xe377('0x4')](_0x59fce9+':'+_0x206b97['id'],_0x206b97);DashboardEvents[_0xe377('0x4')](_0x59fce9,_0x206b97);_0x33b8dc(null);};}for(var e in events){if(events[_0xe377('0x5')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0xe377('0x6')]=DashboardEvents; \ No newline at end of file +var _0x2c75=['../../mysqldb','setMaxListeners','save','update','remove','emit','hook','events'];(function(_0x2e9613,_0x3dca7d){var _0x264f2d=function(_0x4fcc3f){while(--_0x4fcc3f){_0x2e9613['push'](_0x2e9613['shift']());}};_0x264f2d(++_0x3dca7d);}(_0x2c75,0x127));var _0x52c7=function(_0xaaf2e2,_0x19d28a){_0xaaf2e2=_0xaaf2e2-0x0;var _0x28bc36=_0x2c75[_0xaaf2e2];return _0x28bc36;};'use strict';var EventEmitter=require(_0x52c7('0x0'));var Dashboard=require(_0x52c7('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x52c7('0x2')](0x0);var events={'afterCreate':_0x52c7('0x3'),'afterUpdate':_0x52c7('0x4'),'afterDestroy':_0x52c7('0x5')};function emitEvent(_0x5ce750){return function(_0x4041a1,_0x3ce05c,_0x382bd5){DashboardEvents[_0x52c7('0x6')](_0x5ce750+':'+_0x4041a1['id'],_0x4041a1);DashboardEvents[_0x52c7('0x6')](_0x5ce750,_0x4041a1);_0x382bd5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x52c7('0x7')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index b36e54e..169f575 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 _0x4e0c=['path','./dashboard.attributes','define','util','moment','bluebird','request-promise'];(function(_0x5b791d,_0x49cc81){var _0xdd1c36=function(_0x46f98b){while(--_0x46f98b){_0x5b791d['push'](_0x5b791d['shift']());}};_0xdd1c36(++_0x49cc81);}(_0x4e0c,0xb2));var _0xc4e0=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x4e0c[_0x11c573];return _0x6b72de;};'use strict';var _=require('lodash');var util=require(_0xc4e0('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xc4e0('0x1'));var BPromise=require(_0xc4e0('0x2'));var rp=require(_0xc4e0('0x3'));var fs=require('fs');var path=require(_0xc4e0('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc4e0('0x5'));module['exports']=function(_0x223c45,_0x335d10){return _0x223c45[_0xc4e0('0x6')]('Dashboard',attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x675e=['rimraf','../../config/environment','./dashboard.attributes','define','util','../../config/logger','api','moment','request-promise','path'];(function(_0x278d73,_0xb20d63){var _0x31ca5c=function(_0x3355d5){while(--_0x3355d5){_0x278d73['push'](_0x278d73['shift']());}};_0x31ca5c(++_0xb20d63);}(_0x675e,0x18a));var _0xe675=function(_0x25df80,_0xa2aec5){_0x25df80=_0x25df80-0x0;var _0x17b6d0=_0x675e[_0x25df80];return _0x17b6d0;};'use strict';var _=require('lodash');var util=require(_0xe675('0x0'));var logger=require(_0xe675('0x1'))(_0xe675('0x2'));var moment=require(_0xe675('0x3'));var BPromise=require('bluebird');var rp=require(_0xe675('0x4'));var fs=require('fs');var path=require(_0xe675('0x5'));var rimraf=require(_0xe675('0x6'));var config=require(_0xe675('0x7'));var attributes=require(_0xe675('0x8'));module['exports']=function(_0x2c69f0,_0x1152e3){return _0x2c69f0[_0xe675('0x9')]('Dashboard',attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 9f6529b..e172f8e 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 _0x89bc=['ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','bluebird','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x89bc,0x183));var _0xc89b=function(_0x2a0738,_0x3c0bc5){_0x2a0738=_0x2a0738-0x0;var _0x159679=_0x89bc[_0x2a0738];return _0x159679;};'use strict';var _=require('lodash');var util=require(_0xc89b('0x0'));var moment=require('moment');var BPromise=require(_0xc89b('0x1'));var rs=require(_0xc89b('0x2'));var fs=require('fs');var Redis=require(_0xc89b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc89b('0x4'));var logger=require('../../config/logger')(_0xc89b('0x5'));var config=require(_0xc89b('0x6'));var jayson=require(_0xc89b('0x7'));var client=jayson[_0xc89b('0x8')][_0xc89b('0x9')]({'port':0x232a});config['redis']=_[_0xc89b('0xa')](config[_0xc89b('0xb')],{'host':_0xc89b('0xc'),'port':0x18eb});var socket=require(_0xc89b('0xd'))(new Redis(config[_0xc89b('0xb')]));require(_0xc89b('0xe'))['register'](socket);function respondWithRpcPromise(_0x27c5c1,_0x47a67c,_0x30d359){return new BPromise(function(_0x2cffba,_0x4f81ab){return client[_0xc89b('0xf')](_0x27c5c1,_0x30d359)[_0xc89b('0x10')](function(_0xc3266f){logger[_0xc89b('0x11')](_0xc89b('0x12'),_0x47a67c,_0xc89b('0x13'));logger[_0xc89b('0x14')](_0xc89b('0x15'),_0x47a67c,'request\x20sent',JSON[_0xc89b('0x16')](_0xc3266f));if(_0xc3266f[_0xc89b('0x17')]){if(_0xc3266f[_0xc89b('0x17')]['code']===0x1f4){logger[_0xc89b('0x17')](_0xc89b('0x12'),_0x47a67c,_0xc3266f[_0xc89b('0x17')][_0xc89b('0x18')]);return _0x4f81ab(_0xc3266f[_0xc89b('0x17')][_0xc89b('0x18')]);}logger[_0xc89b('0x17')](_0xc89b('0x12'),_0x47a67c,_0xc3266f[_0xc89b('0x17')]['message']);return _0x2cffba(_0xc3266f[_0xc89b('0x17')][_0xc89b('0x18')]);}else{logger['info'](_0xc89b('0x12'),_0x47a67c,'request\x20sent');_0x2cffba(_0xc3266f[_0xc89b('0x19')][_0xc89b('0x18')]);}})['catch'](function(_0x55213c){logger[_0xc89b('0x17')](_0xc89b('0x12'),_0x47a67c,_0x55213c);_0x4f81ab(_0x55213c);});});} \ No newline at end of file +var _0x0941=['message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','then','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x455b63,_0x109257){var _0x1ccedf=function(_0x430afc){while(--_0x430afc){_0x455b63['push'](_0x455b63['shift']());}};_0x1ccedf(++_0x109257);}(_0x0941,0xc0));var _0x1094=function(_0xefa111,_0x368165){_0xefa111=_0xefa111-0x0;var _0x3c8762=_0x0941[_0xefa111];return _0x3c8762;};'use strict';var _=require(_0x1094('0x0'));var util=require(_0x1094('0x1'));var moment=require(_0x1094('0x2'));var BPromise=require('bluebird');var rs=require(_0x1094('0x3'));var fs=require('fs');var Redis=require(_0x1094('0x4'));var db=require(_0x1094('0x5'))['db'];var utils=require(_0x1094('0x6'));var logger=require('../../config/logger')(_0x1094('0x7'));var config=require(_0x1094('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1094('0x9')][_0x1094('0xa')]({'port':0x232a});config[_0x1094('0xb')]=_[_0x1094('0xc')](config[_0x1094('0xb')],{'host':_0x1094('0xd'),'port':0x18eb});var socket=require(_0x1094('0xe'))(new Redis(config[_0x1094('0xb')]));require(_0x1094('0xf'))['register'](socket);function respondWithRpcPromise(_0x29798d,_0x3e3d51,_0x3bf2d0){return new BPromise(function(_0x52fb55,_0x479c53){return client['request'](_0x29798d,_0x3bf2d0)[_0x1094('0x10')](function(_0xb1cb95){logger['info'](_0x1094('0x11'),_0x3e3d51,_0x1094('0x12'));logger[_0x1094('0x13')](_0x1094('0x14'),_0x3e3d51,_0x1094('0x12'),JSON[_0x1094('0x15')](_0xb1cb95));if(_0xb1cb95[_0x1094('0x16')]){if(_0xb1cb95[_0x1094('0x16')][_0x1094('0x17')]===0x1f4){logger['error'](_0x1094('0x11'),_0x3e3d51,_0xb1cb95['error'][_0x1094('0x18')]);return _0x479c53(_0xb1cb95[_0x1094('0x16')]['message']);}logger[_0x1094('0x16')](_0x1094('0x11'),_0x3e3d51,_0xb1cb95[_0x1094('0x16')][_0x1094('0x18')]);return _0x52fb55(_0xb1cb95['error'][_0x1094('0x18')]);}else{logger['info']('Dashboard,\x20%s,\x20%s',_0x3e3d51,_0x1094('0x12'));_0x52fb55(_0xb1cb95[_0x1094('0x19')][_0x1094('0x18')]);}})[_0x1094('0x1a')](function(_0x547139){logger[_0x1094('0x16')](_0x1094('0x11'),_0x3e3d51,_0x547139);_0x479c53(_0x547139);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 9635569..860d6b4 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 _0xc26e=['removeListener','register','./dashboard.events','save','update','emit'];(function(_0x5741a1,_0x48cf64){var _0x58687e=function(_0xdb5ae4){while(--_0xdb5ae4){_0x5741a1['push'](_0x5741a1['shift']());}};_0x58687e(++_0x48cf64);}(_0xc26e,0x18e));var _0xec26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc26e[_0x3dd15e];return _0x231fd0;};'use strict';var DashboardEvents=require(_0xec26('0x0'));var events=[_0xec26('0x1'),'remove',_0xec26('0x2')];function createListener(_0x5bb265,_0x101d60){return function(_0x52db56){_0x101d60[_0xec26('0x3')](_0x5bb265,_0x52db56);};}function removeListener(_0x3b14a6,_0x17583c){return function(){DashboardEvents[_0xec26('0x4')](_0x3b14a6,_0x17583c);};}exports[_0xec26('0x5')]=function(_0x16e5c4){for(var _0x350888=0x0,_0x5d2eed=events['length'];_0x350888<_0x5d2eed;_0x350888++){var _0x278b07=events[_0x350888];var _0x2caaad=createListener('dashboard:'+_0x278b07,_0x16e5c4);DashboardEvents['on'](_0x278b07,_0x2caaad);}}; \ No newline at end of file +var _0x4267=['register','length','dashboard:','remove','update','emit','removeListener'];(function(_0x5dffc0,_0x38a88d){var _0x2b47ef=function(_0x51626c){while(--_0x51626c){_0x5dffc0['push'](_0x5dffc0['shift']());}};_0x2b47ef(++_0x38a88d);}(_0x4267,0x14c));var _0x7426=function(_0x465334,_0x47bcc9){_0x465334=_0x465334-0x0;var _0x103577=_0x4267[_0x465334];return _0x103577;};'use strict';var DashboardEvents=require('./dashboard.events');var events=['save',_0x7426('0x0'),_0x7426('0x1')];function createListener(_0x4d6401,_0x295ff8){return function(_0x41d54d){_0x295ff8[_0x7426('0x2')](_0x4d6401,_0x41d54d);};}function removeListener(_0x2f34eb,_0x219433){return function(){DashboardEvents[_0x7426('0x3')](_0x2f34eb,_0x219433);};}exports[_0x7426('0x4')]=function(_0x47f2b0){for(var _0x1609a1=0x0,_0x3841ec=events[_0x7426('0x5')];_0x1609a1<_0x3841ec;_0x1609a1++){var _0x30b613=events[_0x1609a1];var _0x3080e2=createListener(_0x7426('0x6')+_0x30b613,_0x47f2b0);DashboardEvents['on'](_0x30b613,_0x3080e2);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 8eec9c3..600d25b 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 _0x0f7f=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','/:id','show','isAuthenticated','getItems','post','create','/:id/items','addItem','put','update','destroy','exports','multer','util','path'];(function(_0x1e42e8,_0x1f9cb8){var _0x26e32c=function(_0x433217){while(--_0x433217){_0x1e42e8['push'](_0x1e42e8['shift']());}};_0x26e32c(++_0x1f9cb8);}(_0x0f7f,0x8d));var _0xf0f7=function(_0x1ee512,_0x1da3f5){_0x1ee512=_0x1ee512-0x0;var _0x32c2c8=_0x0f7f[_0x1ee512];return _0x32c2c8;};'use strict';var multer=require(_0xf0f7('0x0'));var util=require(_0xf0f7('0x1'));var path=require(_0xf0f7('0x2'));var timeout=require(_0xf0f7('0x3'));var express=require(_0xf0f7('0x4'));var router=express[_0xf0f7('0x5')]();var fs_extra=require(_0xf0f7('0x6'));var auth=require(_0xf0f7('0x7'));var interaction=require(_0xf0f7('0x8'));var config=require(_0xf0f7('0x9'));var controller=require(_0xf0f7('0xa'));router[_0xf0f7('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf0f7('0xb')](_0xf0f7('0xc'),auth['isAuthenticated'](),controller[_0xf0f7('0xd')]);router[_0xf0f7('0xb')]('/:id/items',auth[_0xf0f7('0xe')](),controller[_0xf0f7('0xf')]);router[_0xf0f7('0x10')]('/',auth[_0xf0f7('0xe')](),controller[_0xf0f7('0x11')]);router['post']('/:id/clone',auth[_0xf0f7('0xe')](),controller['clone']);router['post'](_0xf0f7('0x12'),auth[_0xf0f7('0xe')](),controller[_0xf0f7('0x13')]);router[_0xf0f7('0x14')](_0xf0f7('0xc'),auth['isAuthenticated'](),controller[_0xf0f7('0x15')]);router['delete'](_0xf0f7('0xc'),auth[_0xf0f7('0xe')](),controller[_0xf0f7('0x16')]);module[_0xf0f7('0x17')]=router; \ No newline at end of file +var _0xb1cb=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','isAuthenticated','index','get','/:id','show','/:id/items','getItems','post','/:id/clone','clone','put','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x217d77,_0x4d0b41){var _0x21eabf=function(_0x1ba22c){while(--_0x1ba22c){_0x217d77['push'](_0x217d77['shift']());}};_0x21eabf(++_0x4d0b41);}(_0xb1cb,0x1c4));var _0xbb1c=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xb1cb[_0x2b7764];return _0x848dcb;};'use strict';var multer=require(_0xbb1c('0x0'));var util=require(_0xbb1c('0x1'));var path=require('path');var timeout=require(_0xbb1c('0x2'));var express=require(_0xbb1c('0x3'));var router=express[_0xbb1c('0x4')]();var fs_extra=require(_0xbb1c('0x5'));var auth=require(_0xbb1c('0x6'));var interaction=require(_0xbb1c('0x7'));var config=require(_0xbb1c('0x8'));var controller=require(_0xbb1c('0x9'));router['get']('/',auth[_0xbb1c('0xa')](),controller[_0xbb1c('0xb')]);router[_0xbb1c('0xc')](_0xbb1c('0xd'),auth[_0xbb1c('0xa')](),controller[_0xbb1c('0xe')]);router[_0xbb1c('0xc')](_0xbb1c('0xf'),auth[_0xbb1c('0xa')](),controller[_0xbb1c('0x10')]);router['post']('/',auth[_0xbb1c('0xa')](),controller['create']);router[_0xbb1c('0x11')](_0xbb1c('0x12'),auth[_0xbb1c('0xa')](),controller[_0xbb1c('0x13')]);router[_0xbb1c('0x11')](_0xbb1c('0xf'),auth['isAuthenticated'](),controller['addItem']);router[_0xbb1c('0x14')](_0xbb1c('0xd'),auth[_0xbb1c('0xa')](),controller['update']);router[_0xbb1c('0x15')]('/:id',auth[_0xbb1c('0xa')](),controller[_0xbb1c('0x16')]);module[_0xbb1c('0x17')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 14a5ef2..8a58b78 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 _0xadb5=['long','parse','getDataValue','setDataValue','attrs','stringify','INTEGER','#2196f3','squel','exports','STRING'];(function(_0x31b190,_0x53f19c){var _0x49075b=function(_0x3565f5){while(--_0x3565f5){_0x31b190['push'](_0x31b190['shift']());}};_0x49075b(++_0x53f19c);}(_0xadb5,0xad));var _0x5adb=function(_0x2daa74,_0x496567){_0x2daa74=_0x2daa74-0x0;var _0x927309=_0xadb5[_0x2daa74];return _0x927309;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x5adb('0x0'));var _=require('lodash');module[_0x5adb('0x1')]={'title':{'type':Sequelize[_0x5adb('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5adb('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x5adb('0x3')),'get':function(){try{return JSON[_0x5adb('0x4')](this[_0x5adb('0x5')]('attrs'));}catch(_0x35a5d3){return[];}},'set':function(_0x168d89){try{this[_0x5adb('0x6')](_0x5adb('0x7'),JSON[_0x5adb('0x8')](_0x168d89));}catch(_0x353885){this[_0x5adb('0x6')](_0x5adb('0x7'),JSON[_0x5adb('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x5adb('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x5adb('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x5adb('0x9')]},'col':{'type':Sequelize[_0x5adb('0x9')]},'background':{'type':Sequelize[_0x5adb('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5adb('0xa'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x5adb('0x2')]},'titleFontSize':{'type':Sequelize[_0x5adb('0x9')],'defaultValue':0xc}}; \ No newline at end of file +var _0x5d58=['attrs','stringify','INTEGER','#2196f3','STRING','TEXT','parse','getDataValue','setDataValue'];(function(_0x234f97,_0x1fe7ef){var _0x4d058f=function(_0x2b4122){while(--_0x2b4122){_0x234f97['push'](_0x234f97['shift']());}};_0x4d058f(++_0x1fe7ef);}(_0x5d58,0x187));var _0x85d5=function(_0x4bccda,_0x56dbcb){_0x4bccda=_0x4bccda-0x0;var _0x322b93=_0x5d58[_0x4bccda];return _0x322b93;};'use strict';var Sequelize=require('sequelize');var squel=require('squel');var _=require('lodash');module['exports']={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x85d5('0x0')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x85d5('0x1')]('long'),'get':function(){try{return JSON[_0x85d5('0x2')](this[_0x85d5('0x3')]('attrs'));}catch(_0x1eb211){return[];}},'set':function(_0x2d457a){try{this[_0x85d5('0x4')](_0x85d5('0x5'),JSON['stringify'](_0x2d457a));}catch(_0x98c963){this[_0x85d5('0x4')]('attrs',JSON[_0x85d5('0x6')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x85d5('0x7')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x85d5('0x7')]},'col':{'type':Sequelize[_0x85d5('0x7')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x85d5('0x8'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x85d5('0x0')]},'titleFontSize':{'type':Sequelize[_0x85d5('0x7')],'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 82af0b6..23f930d 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 _0xe0ae=['redis','localhost','./dashboardItem.socket','register','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','show','params','keys','DashboardItem','rawAttributes','query','intersection','model','attributes','fields','include','merge','options','find','catch','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','attrMetric','total','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','web-report','attrReport','reportType','type','attrRefresh','widgetAttributes:\x20%s','create','body','zip-dir','fast-json-patch','moment','mustache','util','sox','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util'];(function(_0x437f65,_0x120f06){var _0x2928bc=function(_0x51db88){while(--_0x51db88){_0x437f65['push'](_0x437f65['shift']());}};_0x2928bc(++_0x120f06);}(_0xe0ae,0xa1));var _0xee0a=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xe0ae[_0x46e363];return _0x3fb059;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xee0a('0x0'));var jsonpatch=require(_0xee0a('0x1'));var rp=require('request-promise');var moment=require(_0xee0a('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xee0a('0x3'));var util=require(_0xee0a('0x4'));var path=require('path');var sox=require(_0xee0a('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xee0a('0x6'));var _=require(_0xee0a('0x7'));var squel=require(_0xee0a('0x8'));var crypto=require(_0xee0a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xee0a('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xee0a('0xb'));var Redis=require(_0xee0a('0xc'));var authService=require(_0xee0a('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xee0a('0xe'));var hardwareService=require(_0xee0a('0xf'));var logger=require('../../config/logger')(_0xee0a('0x10'));var utils=require('../../config/utils');var config=require(_0xee0a('0x11'));var licenseUtil=require(_0xee0a('0x12'));var db=require('../../mysqldb')['db'];config[_0xee0a('0x13')]=_['defaults'](config[_0xee0a('0x13')],{'host':_0xee0a('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xee0a('0x15'))[_0xee0a('0x16')](socket);function respondWithStatusCode(_0x347604,_0x427b5c){_0x427b5c=_0x427b5c||0xcc;return function(_0x41d4e4){if(_0x41d4e4){return _0x347604['sendStatus'](_0x427b5c);}return _0x347604[_0xee0a('0x17')](_0x427b5c)[_0xee0a('0x18')]();};}function respondWithResult(_0x50063f,_0x2c804a){_0x2c804a=_0x2c804a||0xc8;return function(_0x35d1e4){if(_0x35d1e4){return _0x50063f[_0xee0a('0x17')](_0x2c804a)[_0xee0a('0x19')](_0x35d1e4);}};}function respondWithFilteredResult(_0x4f711b,_0x3114b2){return function(_0x1d7a8a){if(_0x1d7a8a){var _0x14ef67=typeof _0x3114b2['offset']===_0xee0a('0x1a')&&typeof _0x3114b2[_0xee0a('0x1b')]===_0xee0a('0x1a');var _0x24f8f1=_0x1d7a8a['count'];var _0xe9d5d4=_0x14ef67?0x0:_0x3114b2[_0xee0a('0x1c')];var _0x452d97=_0x14ef67?_0x1d7a8a[_0xee0a('0x1d')]:_0x3114b2['offset']+_0x3114b2[_0xee0a('0x1b')];var _0xff2f14;if(_0x452d97>=_0x24f8f1){_0x452d97=_0x24f8f1;_0xff2f14=0xc8;}else{_0xff2f14=0xce;}_0x4f711b[_0xee0a('0x17')](_0xff2f14);return _0x4f711b[_0xee0a('0x1e')](_0xee0a('0x1f'),_0xe9d5d4+'-'+_0x452d97+'/'+_0x24f8f1)[_0xee0a('0x19')](_0x1d7a8a);}return null;};}function patchUpdates(_0x2c543c){return function(_0x493e86){try{jsonpatch[_0xee0a('0x20')](_0x493e86,_0x2c543c,!![]);}catch(_0x3d5459){return BPromise[_0xee0a('0x21')](_0x3d5459);}return _0x493e86[_0xee0a('0x22')]();};}function saveUpdates(_0x567810,_0xea31ce){return function(_0x197616){if(_0x197616){return _0x197616[_0xee0a('0x23')](_0x567810)[_0xee0a('0x24')](function(_0x4c61e2){return _0x4c61e2;});}return null;};}function removeEntity(_0x50e9d1,_0x578ecf){return function(_0x2c6929){if(_0x2c6929){return _0x2c6929['destroy']()['then'](function(){_0x50e9d1[_0xee0a('0x17')](0xcc)[_0xee0a('0x18')]();});}};}function handleEntityNotFound(_0xe5365f,_0x50d415){return function(_0x3c3d48){if(!_0x3c3d48){_0xe5365f[_0xee0a('0x25')](0x194);}return _0x3c3d48;};}function handleError(_0x15b1c0,_0x30d1f1){_0x30d1f1=_0x30d1f1||0x1f4;return function(_0x2e7f18){logger[_0xee0a('0x26')](_0x2e7f18[_0xee0a('0x27')]);if(_0x2e7f18[_0xee0a('0x28')]){delete _0x2e7f18[_0xee0a('0x28')];}_0x15b1c0[_0xee0a('0x17')](_0x30d1f1)['send'](_0x2e7f18);};}exports[_0xee0a('0x29')]=function(_0x1a97e0,_0x284be5){var _0x34569c={'raw':![],'where':{'id':_0x1a97e0[_0xee0a('0x2a')]['id']}},_0x45feeb={};_0x45feeb['model']=_[_0xee0a('0x2b')](db[_0xee0a('0x2c')][_0xee0a('0x2d')]);_0x45feeb[_0xee0a('0x2e')]=_['keys'](_0x1a97e0[_0xee0a('0x2e')]);_0x45feeb['filters']=_[_0xee0a('0x2f')](_0x45feeb[_0xee0a('0x30')],_0x45feeb[_0xee0a('0x2e')]);_0x34569c[_0xee0a('0x31')]=_[_0xee0a('0x2f')](_0x45feeb[_0xee0a('0x30')],qs[_0xee0a('0x32')](_0x1a97e0[_0xee0a('0x2e')]['fields']));_0x34569c[_0xee0a('0x31')]=_0x34569c[_0xee0a('0x31')]['length']?_0x34569c[_0xee0a('0x31')]:_0x45feeb[_0xee0a('0x30')];if(_0x1a97e0[_0xee0a('0x2e')]['includeAll']){_0x34569c[_0xee0a('0x33')]=[{'all':!![]}];}_0x34569c=_[_0xee0a('0x34')]({},_0x34569c,_0x1a97e0[_0xee0a('0x35')]);return db['DashboardItem'][_0xee0a('0x36')](_0x34569c)[_0xee0a('0x24')](handleEntityNotFound(_0x284be5,null))[_0xee0a('0x24')](respondWithResult(_0x284be5,null))['catch'](handleError(_0x284be5,null));};exports['destroy']=function(_0x7db483,_0x10e8a5){return db[_0xee0a('0x2c')][_0xee0a('0x36')]({'where':{'id':_0x7db483[_0xee0a('0x2a')]['id']}})[_0xee0a('0x24')](handleEntityNotFound(_0x10e8a5,null))[_0xee0a('0x24')](removeEntity(_0x10e8a5,null))[_0xee0a('0x37')](handleError(_0x10e8a5,null));};function widgetAttributes(_0x22d505){try{switch(_0x22d505['type']){case _0xee0a('0x38'):return[{'name':_0xee0a('0x39'),'value':_0x22d505['attrUrl']||(_0x22d505[_0xee0a('0x3a')]&&_0x22d505[_0xee0a('0x3a')][0x0]?_0x22d505['attrs'][0x0][_0xee0a('0x3b')]:undefined)||_0xee0a('0x3c')}];case _0xee0a('0x3d'):return[{'name':_0xee0a('0x3e'),'value':_0x22d505[_0xee0a('0x3e')]||(_0x22d505[_0xee0a('0x3a')]&&_0x22d505[_0xee0a('0x3a')][0x0]?_0x22d505[_0xee0a('0x3a')][0x0][_0xee0a('0x3b')]:undefined)||''}];case'clock':return[{'name':_0xee0a('0x3f'),'value':_0x22d505[_0xee0a('0x3f')]||(_0x22d505[_0xee0a('0x3a')]&&_0x22d505[_0xee0a('0x3a')][0x0]?_0x22d505['attrs'][0x0]['value']:undefined)||_0xee0a('0x40')},{'name':_0xee0a('0x41'),'value':_0x22d505[_0xee0a('0x41')]||(_0x22d505[_0xee0a('0x3a')]&&_0x22d505[_0xee0a('0x3a')][0x1]?_0x22d505[_0xee0a('0x3a')][0x1][_0xee0a('0x3b')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x22d505[_0xee0a('0x42')]||(_0x22d505[_0xee0a('0x3a')]&&_0x22d505['attrs'][0x2]?_0x22d505[_0xee0a('0x3a')][0x2][_0xee0a('0x3b')]:undefined)||0xc}];case'counter':return[{'name':_0xee0a('0x43'),'value':_0x22d505[_0xee0a('0x43')]||(_0x22d505[_0xee0a('0x3a')]&&_0x22d505[_0xee0a('0x3a')][0x0]?_0x22d505[_0xee0a('0x3a')][0x0][_0xee0a('0x3b')]:undefined)||_0xee0a('0x44')},{'name':'attrVoiceQueues','value':_0x22d505['attrVoiceQueues']||(_0x22d505[_0xee0a('0x3a')]&&_0x22d505['attrs'][0x1]?_0x22d505['attrs'][0x1]['value']:undefined)||[]},{'name':_0xee0a('0x42'),'value':_0x22d505[_0xee0a('0x42')]||(_0x22d505['attrs']&&_0x22d505['attrs'][0x2]?_0x22d505['attrs'][0x2]['value']:undefined)||0x14},{'name':_0xee0a('0x45'),'value':_0x22d505[_0xee0a('0x45')]||(_0x22d505[_0xee0a('0x3a')]&&_0x22d505[_0xee0a('0x3a')][0x3]?_0x22d505[_0xee0a('0x3a')][0x3][_0xee0a('0x3b')]:undefined)||'voice'},{'name':_0xee0a('0x46'),'value':_0x22d505['attrEmailAccounts']||(_0x22d505[_0xee0a('0x3a')]&&_0x22d505[_0xee0a('0x3a')][0x4]?_0x22d505[_0xee0a('0x3a')][0x4][_0xee0a('0x3b')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x22d505[_0xee0a('0x47')]||(_0x22d505[_0xee0a('0x3a')]&&_0x22d505[_0xee0a('0x3a')][0x5]?_0x22d505[_0xee0a('0x3a')][0x5][_0xee0a('0x3b')]:undefined)||''},{'name':_0xee0a('0x48'),'value':_0x22d505[_0xee0a('0x48')]||(_0x22d505['attrs']&&_0x22d505['attrs'][0x6]?_0x22d505[_0xee0a('0x3a')][0x6][_0xee0a('0x3b')]:undefined)||''},{'name':_0xee0a('0x49'),'value':_0x22d505[_0xee0a('0x49')]||(_0x22d505[_0xee0a('0x3a')]&&_0x22d505[_0xee0a('0x3a')][0x7]?_0x22d505[_0xee0a('0x3a')][0x7][_0xee0a('0x3b')]:undefined)||''},{'name':_0xee0a('0x4a'),'value':_0x22d505[_0xee0a('0x4a')]||(_0x22d505[_0xee0a('0x3a')]&&_0x22d505[_0xee0a('0x3a')][0x8]?_0x22d505['attrs'][0x8][_0xee0a('0x3b')]:undefined)||''},{'name':_0xee0a('0x4b'),'value':_0x22d505[_0xee0a('0x4b')]||(_0x22d505[_0xee0a('0x3a')]&&_0x22d505[_0xee0a('0x3a')][0x9]?_0x22d505['attrs'][0x9][_0xee0a('0x3b')]:undefined)||''}];case _0xee0a('0x4c'):case _0xee0a('0x4d'):return[{'name':_0xee0a('0x4e'),'value':_0x22d505[_0xee0a('0x4e')]||(_0x22d505['attrs']&&_0x22d505[_0xee0a('0x3a')][0x0]?_0x22d505[_0xee0a('0x3a')][0x0][_0xee0a('0x3b')]:undefined)||_0xee0a('0x44')},{'name':_0xee0a('0x4f'),'value':_0x22d505['attrSerie2']||(_0x22d505[_0xee0a('0x3a')]&&_0x22d505[_0xee0a('0x3a')][0x1]?_0x22d505[_0xee0a('0x3a')][0x1][_0xee0a('0x3b')]:undefined)||null},{'name':_0xee0a('0x50'),'value':_0x22d505[_0xee0a('0x50')]||(_0x22d505[_0xee0a('0x3a')]&&_0x22d505[_0xee0a('0x3a')][0x2]?_0x22d505[_0xee0a('0x3a')][0x2][_0xee0a('0x3b')]:undefined)||null},{'name':_0xee0a('0x51'),'value':_0x22d505[_0xee0a('0x51')]||(_0x22d505[_0xee0a('0x3a')]&&_0x22d505[_0xee0a('0x3a')][0x3]?_0x22d505[_0xee0a('0x3a')][0x3][_0xee0a('0x3b')]:undefined)||[]},{'name':_0xee0a('0x45'),'value':_0x22d505[_0xee0a('0x45')]||(_0x22d505[_0xee0a('0x3a')]&&_0x22d505[_0xee0a('0x3a')][0x4]?_0x22d505[_0xee0a('0x3a')][0x4][_0xee0a('0x3b')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x22d505['attrEmailAccounts']||(_0x22d505[_0xee0a('0x3a')]&&_0x22d505['attrs'][0x5]?_0x22d505[_0xee0a('0x3a')][0x5][_0xee0a('0x3b')]:undefined)||''},{'name':_0xee0a('0x47'),'value':_0x22d505[_0xee0a('0x47')]||(_0x22d505['attrs']&&_0x22d505[_0xee0a('0x3a')][0x6]?_0x22d505[_0xee0a('0x3a')][0x6][_0xee0a('0x3b')]:undefined)||''},{'name':_0xee0a('0x48'),'value':_0x22d505[_0xee0a('0x48')]||(_0x22d505[_0xee0a('0x3a')]&&_0x22d505[_0xee0a('0x3a')][0x7]?_0x22d505[_0xee0a('0x3a')][0x7][_0xee0a('0x3b')]:undefined)||''},{'name':_0xee0a('0x49'),'value':_0x22d505[_0xee0a('0x49')]||(_0x22d505[_0xee0a('0x3a')]&&_0x22d505[_0xee0a('0x3a')][0x8]?_0x22d505[_0xee0a('0x3a')][0x8]['value']:undefined)||''},{'name':_0xee0a('0x4a'),'value':_0x22d505['attrWhatsappAccounts']||(_0x22d505[_0xee0a('0x3a')]&&_0x22d505[_0xee0a('0x3a')][0x9]?_0x22d505['attrs'][0x9][_0xee0a('0x3b')]:undefined)||''},{'name':'attrChatWebsites','value':_0x22d505[_0xee0a('0x4b')]||(_0x22d505['attrs']&&_0x22d505['attrs'][0xa]?_0x22d505['attrs'][0xa][_0xee0a('0x3b')]:undefined)||''}];case _0xee0a('0x52'):return[{'name':_0xee0a('0x53'),'type':_0x22d505[_0xee0a('0x54')]||(_0x22d505[_0xee0a('0x3a')]&&_0x22d505[_0xee0a('0x3a')][0x0]?_0x22d505[_0xee0a('0x3a')][0x0][_0xee0a('0x55')]:undefined)||null,'value':_0x22d505['attrReport']||(_0x22d505[_0xee0a('0x3a')]&&_0x22d505['attrs'][0x0]?_0x22d505['attrs'][0x0][_0xee0a('0x3b')]:undefined)||null},{'name':_0xee0a('0x56'),'value':_0x22d505[_0xee0a('0x56')]||(_0x22d505[_0xee0a('0x3a')]&&_0x22d505[_0xee0a('0x3a')][0x1]?_0x22d505[_0xee0a('0x3a')][0x1][_0xee0a('0x3b')]:undefined)||0x0}];default:return[];}}catch(_0x461f9b){logger['error'](_0xee0a('0x57'),JSON['stringify'](_0x461f9b));return[];}}exports[_0xee0a('0x58')]=function(_0x176ffe,_0xaf0c43){if(_0x176ffe[_0xee0a('0x59')]){_0x176ffe[_0xee0a('0x59')][_0xee0a('0x3a')]=widgetAttributes(_0x176ffe['body']);}return db[_0xee0a('0x2c')][_0xee0a('0x58')](_0x176ffe[_0xee0a('0x59')],{})['then'](respondWithResult(_0xaf0c43,0xc9))[_0xee0a('0x37')](handleError(_0xaf0c43,null));};exports[_0xee0a('0x23')]=function(_0x4d5c5b,_0x46e0b1){if(_0x4d5c5b['body']['id']){delete _0x4d5c5b['body']['id'];}_0x4d5c5b['body']['attrs']=widgetAttributes(_0x4d5c5b[_0xee0a('0x59')]);return db['DashboardItem'][_0xee0a('0x36')]({'where':{'id':_0x4d5c5b['params']['id']}})[_0xee0a('0x24')](handleEntityNotFound(_0x46e0b1,null))[_0xee0a('0x24')](saveUpdates(_0x4d5c5b[_0xee0a('0x59')],null))[_0xee0a('0x24')](respondWithResult(_0x46e0b1,null))['catch'](handleError(_0x46e0b1,null));}; \ No newline at end of file +var _0xdcd5=['limit','count','set','Content-Range','json','apply','reject','save','update','destroy','error','stack','name','send','show','params','model','DashboardItem','rawAttributes','keys','query','filters','intersection','attributes','includeAll','include','merge','options','find','then','catch','iframe','attrUrl','attrs','value','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','end','status','offset','undefined'];(function(_0x272648,_0x33e2ca){var _0x2c8c68=function(_0xb2dcd9){while(--_0xb2dcd9){_0x272648['push'](_0x272648['shift']());}};_0x2c8c68(++_0x33e2ca);}(_0xdcd5,0x110));var _0x5dcd=function(_0x45161c,_0x5494fc){_0x45161c=_0x45161c-0x0;var _0x186581=_0xdcd5[_0x45161c];return _0x186581;};'use strict';var emlformat=require(_0x5dcd('0x0'));var rimraf=require(_0x5dcd('0x1'));var zipdir=require(_0x5dcd('0x2'));var jsonpatch=require(_0x5dcd('0x3'));var rp=require(_0x5dcd('0x4'));var moment=require(_0x5dcd('0x5'));var BPromise=require(_0x5dcd('0x6'));var Mustache=require('mustache');var util=require(_0x5dcd('0x7'));var path=require(_0x5dcd('0x8'));var sox=require(_0x5dcd('0x9'));var csv=require(_0x5dcd('0xa'));var ejs=require(_0x5dcd('0xb'));var fs=require('fs');var fs_extra=require(_0x5dcd('0xc'));var _=require(_0x5dcd('0xd'));var squel=require(_0x5dcd('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5dcd('0xf'));var toCsv=require(_0x5dcd('0xa'));var querystring=require(_0x5dcd('0x10'));var Papa=require('papaparse');var Redis=require(_0x5dcd('0x11'));var authService=require(_0x5dcd('0x12'));var qs=require(_0x5dcd('0x13'));var as=require(_0x5dcd('0x14'));var hardwareService=require(_0x5dcd('0x15'));var logger=require(_0x5dcd('0x16'))(_0x5dcd('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5dcd('0x18'));var db=require(_0x5dcd('0x19'))['db'];config['redis']=_[_0x5dcd('0x1a')](config[_0x5dcd('0x1b')],{'host':_0x5dcd('0x1c'),'port':0x18eb});var socket=require(_0x5dcd('0x1d'))(new Redis(config[_0x5dcd('0x1b')]));require(_0x5dcd('0x1e'))[_0x5dcd('0x1f')](socket);function respondWithStatusCode(_0x40062e,_0x5cc0d7){_0x5cc0d7=_0x5cc0d7||0xcc;return function(_0x9ebce6){if(_0x9ebce6){return _0x40062e[_0x5dcd('0x20')](_0x5cc0d7);}return _0x40062e['status'](_0x5cc0d7)[_0x5dcd('0x21')]();};}function respondWithResult(_0x537aed,_0x3a9ab9){_0x3a9ab9=_0x3a9ab9||0xc8;return function(_0x67a19e){if(_0x67a19e){return _0x537aed[_0x5dcd('0x22')](_0x3a9ab9)['json'](_0x67a19e);}};}function respondWithFilteredResult(_0x1a4643,_0x1ac9d5){return function(_0xc7d7d7){if(_0xc7d7d7){var _0x5074b2=typeof _0x1ac9d5[_0x5dcd('0x23')]===_0x5dcd('0x24')&&typeof _0x1ac9d5[_0x5dcd('0x25')]==='undefined';var _0x1e423c=_0xc7d7d7[_0x5dcd('0x26')];var _0x40dd59=_0x5074b2?0x0:_0x1ac9d5[_0x5dcd('0x23')];var _0x597b14=_0x5074b2?_0xc7d7d7[_0x5dcd('0x26')]:_0x1ac9d5[_0x5dcd('0x23')]+_0x1ac9d5['limit'];var _0x557e94;if(_0x597b14>=_0x1e423c){_0x597b14=_0x1e423c;_0x557e94=0xc8;}else{_0x557e94=0xce;}_0x1a4643[_0x5dcd('0x22')](_0x557e94);return _0x1a4643[_0x5dcd('0x27')](_0x5dcd('0x28'),_0x40dd59+'-'+_0x597b14+'/'+_0x1e423c)[_0x5dcd('0x29')](_0xc7d7d7);}return null;};}function patchUpdates(_0x305466){return function(_0x136fb0){try{jsonpatch[_0x5dcd('0x2a')](_0x136fb0,_0x305466,!![]);}catch(_0x46102a){return BPromise[_0x5dcd('0x2b')](_0x46102a);}return _0x136fb0[_0x5dcd('0x2c')]();};}function saveUpdates(_0x5d3fa0,_0x750c06){return function(_0x3c7054){if(_0x3c7054){return _0x3c7054[_0x5dcd('0x2d')](_0x5d3fa0)['then'](function(_0x30fe1f){return _0x30fe1f;});}return null;};}function removeEntity(_0x4b07c7,_0xc0cadb){return function(_0x11daa8){if(_0x11daa8){return _0x11daa8[_0x5dcd('0x2e')]()['then'](function(){_0x4b07c7[_0x5dcd('0x22')](0xcc)[_0x5dcd('0x21')]();});}};}function handleEntityNotFound(_0x1f7536,_0x147edf){return function(_0x379f3c){if(!_0x379f3c){_0x1f7536['sendStatus'](0x194);}return _0x379f3c;};}function handleError(_0x16a94e,_0x277179){_0x277179=_0x277179||0x1f4;return function(_0x440e47){logger[_0x5dcd('0x2f')](_0x440e47[_0x5dcd('0x30')]);if(_0x440e47[_0x5dcd('0x31')]){delete _0x440e47[_0x5dcd('0x31')];}_0x16a94e[_0x5dcd('0x22')](_0x277179)[_0x5dcd('0x32')](_0x440e47);};}exports[_0x5dcd('0x33')]=function(_0x4df421,_0x3bed3f){var _0x510e49={'raw':![],'where':{'id':_0x4df421[_0x5dcd('0x34')]['id']}},_0x4f65bf={};_0x4f65bf[_0x5dcd('0x35')]=_['keys'](db[_0x5dcd('0x36')][_0x5dcd('0x37')]);_0x4f65bf['query']=_[_0x5dcd('0x38')](_0x4df421[_0x5dcd('0x39')]);_0x4f65bf[_0x5dcd('0x3a')]=_[_0x5dcd('0x3b')](_0x4f65bf['model'],_0x4f65bf['query']);_0x510e49[_0x5dcd('0x3c')]=_[_0x5dcd('0x3b')](_0x4f65bf['model'],qs['fields'](_0x4df421[_0x5dcd('0x39')]['fields']));_0x510e49[_0x5dcd('0x3c')]=_0x510e49['attributes']['length']?_0x510e49[_0x5dcd('0x3c')]:_0x4f65bf[_0x5dcd('0x35')];if(_0x4df421[_0x5dcd('0x39')][_0x5dcd('0x3d')]){_0x510e49[_0x5dcd('0x3e')]=[{'all':!![]}];}_0x510e49=_[_0x5dcd('0x3f')]({},_0x510e49,_0x4df421[_0x5dcd('0x40')]);return db[_0x5dcd('0x36')][_0x5dcd('0x41')](_0x510e49)[_0x5dcd('0x42')](handleEntityNotFound(_0x3bed3f,null))[_0x5dcd('0x42')](respondWithResult(_0x3bed3f,null))[_0x5dcd('0x43')](handleError(_0x3bed3f,null));};exports[_0x5dcd('0x2e')]=function(_0x2d11fb,_0xd60d64){return db[_0x5dcd('0x36')][_0x5dcd('0x41')]({'where':{'id':_0x2d11fb[_0x5dcd('0x34')]['id']}})[_0x5dcd('0x42')](handleEntityNotFound(_0xd60d64,null))['then'](removeEntity(_0xd60d64,null))[_0x5dcd('0x43')](handleError(_0xd60d64,null));};function widgetAttributes(_0x154a83){try{switch(_0x154a83['type']){case _0x5dcd('0x44'):return[{'name':_0x5dcd('0x45'),'value':_0x154a83[_0x5dcd('0x45')]||(_0x154a83[_0x5dcd('0x46')]&&_0x154a83[_0x5dcd('0x46')][0x0]?_0x154a83[_0x5dcd('0x46')][0x0][_0x5dcd('0x47')]:undefined)||'https://'}];case _0x5dcd('0x48'):return[{'name':_0x5dcd('0x49'),'value':_0x154a83[_0x5dcd('0x49')]||(_0x154a83[_0x5dcd('0x46')]&&_0x154a83[_0x5dcd('0x46')][0x0]?_0x154a83[_0x5dcd('0x46')][0x0]['value']:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x154a83[_0x5dcd('0x4a')]||(_0x154a83['attrs']&&_0x154a83['attrs'][0x0]?_0x154a83['attrs'][0x0]['value']:undefined)||_0x5dcd('0x4b')},{'name':_0x5dcd('0x4c'),'value':_0x154a83[_0x5dcd('0x4c')]||(_0x154a83['attrs']&&_0x154a83[_0x5dcd('0x46')][0x1]?_0x154a83[_0x5dcd('0x46')][0x1][_0x5dcd('0x47')]:undefined)||_0x5dcd('0x4d')},{'name':_0x5dcd('0x4e'),'value':_0x154a83[_0x5dcd('0x4e')]||(_0x154a83[_0x5dcd('0x46')]&&_0x154a83[_0x5dcd('0x46')][0x2]?_0x154a83[_0x5dcd('0x46')][0x2][_0x5dcd('0x47')]:undefined)||0xc}];case _0x5dcd('0x4f'):return[{'name':_0x5dcd('0x50'),'value':_0x154a83[_0x5dcd('0x50')]||(_0x154a83[_0x5dcd('0x46')]&&_0x154a83['attrs'][0x0]?_0x154a83['attrs'][0x0][_0x5dcd('0x47')]:undefined)||_0x5dcd('0x51')},{'name':_0x5dcd('0x52'),'value':_0x154a83[_0x5dcd('0x52')]||(_0x154a83[_0x5dcd('0x46')]&&_0x154a83[_0x5dcd('0x46')][0x1]?_0x154a83[_0x5dcd('0x46')][0x1]['value']:undefined)||[]},{'name':_0x5dcd('0x4e'),'value':_0x154a83[_0x5dcd('0x4e')]||(_0x154a83[_0x5dcd('0x46')]&&_0x154a83[_0x5dcd('0x46')][0x2]?_0x154a83[_0x5dcd('0x46')][0x2][_0x5dcd('0x47')]:undefined)||0x14},{'name':_0x5dcd('0x53'),'value':_0x154a83[_0x5dcd('0x53')]||(_0x154a83[_0x5dcd('0x46')]&&_0x154a83[_0x5dcd('0x46')][0x3]?_0x154a83[_0x5dcd('0x46')][0x3][_0x5dcd('0x47')]:undefined)||_0x5dcd('0x54')},{'name':_0x5dcd('0x55'),'value':_0x154a83['attrEmailAccounts']||(_0x154a83[_0x5dcd('0x46')]&&_0x154a83[_0x5dcd('0x46')][0x4]?_0x154a83['attrs'][0x4][_0x5dcd('0x47')]:undefined)||''},{'name':_0x5dcd('0x56'),'value':_0x154a83['attrFaxAccounts']||(_0x154a83['attrs']&&_0x154a83[_0x5dcd('0x46')][0x5]?_0x154a83[_0x5dcd('0x46')][0x5][_0x5dcd('0x47')]:undefined)||''},{'name':_0x5dcd('0x57'),'value':_0x154a83[_0x5dcd('0x57')]||(_0x154a83[_0x5dcd('0x46')]&&_0x154a83[_0x5dcd('0x46')][0x6]?_0x154a83['attrs'][0x6][_0x5dcd('0x47')]:undefined)||''},{'name':_0x5dcd('0x58'),'value':_0x154a83[_0x5dcd('0x58')]||(_0x154a83[_0x5dcd('0x46')]&&_0x154a83[_0x5dcd('0x46')][0x7]?_0x154a83[_0x5dcd('0x46')][0x7][_0x5dcd('0x47')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x154a83[_0x5dcd('0x59')]||(_0x154a83[_0x5dcd('0x46')]&&_0x154a83[_0x5dcd('0x46')][0x8]?_0x154a83[_0x5dcd('0x46')][0x8]['value']:undefined)||''},{'name':_0x5dcd('0x5a'),'value':_0x154a83[_0x5dcd('0x5a')]||(_0x154a83[_0x5dcd('0x46')]&&_0x154a83[_0x5dcd('0x46')][0x9]?_0x154a83['attrs'][0x9][_0x5dcd('0x47')]:undefined)||''}];case _0x5dcd('0x5b'):case _0x5dcd('0x5c'):return[{'name':_0x5dcd('0x5d'),'value':_0x154a83[_0x5dcd('0x5d')]||(_0x154a83[_0x5dcd('0x46')]&&_0x154a83[_0x5dcd('0x46')][0x0]?_0x154a83[_0x5dcd('0x46')][0x0][_0x5dcd('0x47')]:undefined)||'total'},{'name':_0x5dcd('0x5e'),'value':_0x154a83[_0x5dcd('0x5e')]||(_0x154a83[_0x5dcd('0x46')]&&_0x154a83['attrs'][0x1]?_0x154a83['attrs'][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x154a83['attrSerie3']||(_0x154a83[_0x5dcd('0x46')]&&_0x154a83[_0x5dcd('0x46')][0x2]?_0x154a83['attrs'][0x2]['value']:undefined)||null},{'name':_0x5dcd('0x52'),'value':_0x154a83[_0x5dcd('0x52')]||(_0x154a83[_0x5dcd('0x46')]&&_0x154a83[_0x5dcd('0x46')][0x3]?_0x154a83[_0x5dcd('0x46')][0x3][_0x5dcd('0x47')]:undefined)||[]},{'name':_0x5dcd('0x53'),'value':_0x154a83['attrChannel']||(_0x154a83['attrs']&&_0x154a83[_0x5dcd('0x46')][0x4]?_0x154a83[_0x5dcd('0x46')][0x4]['value']:undefined)||_0x5dcd('0x54')},{'name':_0x5dcd('0x55'),'value':_0x154a83[_0x5dcd('0x55')]||(_0x154a83['attrs']&&_0x154a83['attrs'][0x5]?_0x154a83[_0x5dcd('0x46')][0x5][_0x5dcd('0x47')]:undefined)||''},{'name':_0x5dcd('0x56'),'value':_0x154a83[_0x5dcd('0x56')]||(_0x154a83[_0x5dcd('0x46')]&&_0x154a83[_0x5dcd('0x46')][0x6]?_0x154a83[_0x5dcd('0x46')][0x6][_0x5dcd('0x47')]:undefined)||''},{'name':_0x5dcd('0x57'),'value':_0x154a83[_0x5dcd('0x57')]||(_0x154a83[_0x5dcd('0x46')]&&_0x154a83[_0x5dcd('0x46')][0x7]?_0x154a83[_0x5dcd('0x46')][0x7]['value']:undefined)||''},{'name':_0x5dcd('0x58'),'value':_0x154a83['attrOpenchannelAccounts']||(_0x154a83[_0x5dcd('0x46')]&&_0x154a83['attrs'][0x8]?_0x154a83['attrs'][0x8][_0x5dcd('0x47')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x154a83[_0x5dcd('0x59')]||(_0x154a83[_0x5dcd('0x46')]&&_0x154a83['attrs'][0x9]?_0x154a83[_0x5dcd('0x46')][0x9][_0x5dcd('0x47')]:undefined)||''},{'name':'attrChatWebsites','value':_0x154a83['attrChatWebsites']||(_0x154a83[_0x5dcd('0x46')]&&_0x154a83[_0x5dcd('0x46')][0xa]?_0x154a83['attrs'][0xa][_0x5dcd('0x47')]:undefined)||''}];case _0x5dcd('0x5f'):return[{'name':'attrReport','type':_0x154a83[_0x5dcd('0x60')]||(_0x154a83['attrs']&&_0x154a83[_0x5dcd('0x46')][0x0]?_0x154a83['attrs'][0x0]['type']:undefined)||null,'value':_0x154a83[_0x5dcd('0x61')]||(_0x154a83['attrs']&&_0x154a83[_0x5dcd('0x46')][0x0]?_0x154a83[_0x5dcd('0x46')][0x0][_0x5dcd('0x47')]:undefined)||null},{'name':_0x5dcd('0x62'),'value':_0x154a83['attrRefresh']||(_0x154a83[_0x5dcd('0x46')]&&_0x154a83[_0x5dcd('0x46')][0x1]?_0x154a83['attrs'][0x1][_0x5dcd('0x47')]:undefined)||0x0}];default:return[];}}catch(_0x215fad){logger['error'](_0x5dcd('0x63'),JSON[_0x5dcd('0x64')](_0x215fad));return[];}}exports[_0x5dcd('0x65')]=function(_0x261b12,_0x322d0e){if(_0x261b12[_0x5dcd('0x66')]){_0x261b12[_0x5dcd('0x66')][_0x5dcd('0x46')]=widgetAttributes(_0x261b12[_0x5dcd('0x66')]);}return db['DashboardItem'][_0x5dcd('0x65')](_0x261b12[_0x5dcd('0x66')],{})[_0x5dcd('0x42')](respondWithResult(_0x322d0e,0xc9))['catch'](handleError(_0x322d0e,null));};exports[_0x5dcd('0x2d')]=function(_0x2e1fd8,_0x5c7f73){if(_0x2e1fd8[_0x5dcd('0x66')]['id']){delete _0x2e1fd8[_0x5dcd('0x66')]['id'];}_0x2e1fd8[_0x5dcd('0x66')]['attrs']=widgetAttributes(_0x2e1fd8[_0x5dcd('0x66')]);return db[_0x5dcd('0x36')][_0x5dcd('0x41')]({'where':{'id':_0x2e1fd8[_0x5dcd('0x34')]['id']}})[_0x5dcd('0x42')](handleEntityNotFound(_0x5c7f73,null))[_0x5dcd('0x42')](saveUpdates(_0x2e1fd8[_0x5dcd('0x66')],null))[_0x5dcd('0x42')](respondWithResult(_0x5c7f73,null))[_0x5dcd('0x43')](handleError(_0x5c7f73,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 6f4841f..10bad67 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 _0x34f0=['events','../../mysqldb','setMaxListeners','update','remove','emit','hook'];(function(_0x5d68a2,_0x4304cf){var _0x5b3088=function(_0x25a360){while(--_0x25a360){_0x5d68a2['push'](_0x5d68a2['shift']());}};_0x5b3088(++_0x4304cf);}(_0x34f0,0x13b));var _0x034f=function(_0x5d4956,_0x565573){_0x5d4956=_0x5d4956-0x0;var _0x486b98=_0x34f0[_0x5d4956];return _0x486b98;};'use strict';var EventEmitter=require(_0x034f('0x0'));var DashboardItem=require(_0x034f('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x034f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x034f('0x3'),'afterDestroy':_0x034f('0x4')};function emitEvent(_0x30e99f){return function(_0x1f0c8a,_0x2bd6d1,_0x5011cd){DashboardItemEvents[_0x034f('0x5')](_0x30e99f+':'+_0x1f0c8a['id'],_0x1f0c8a);DashboardItemEvents[_0x034f('0x5')](_0x30e99f,_0x1f0c8a);_0x5011cd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x034f('0x6')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0xa4ee=['emit','hasOwnProperty','exports','events','save','update','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa4ee,0xd5));var _0xea4e=function(_0x48ae62,_0x3cfce7){_0x48ae62=_0x48ae62-0x0;var _0x2634a6=_0xa4ee[_0x48ae62];return _0x2634a6;};'use strict';var EventEmitter=require(_0xea4e('0x0'));var DashboardItem=require('../../mysqldb')['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xea4e('0x1'),'afterUpdate':_0xea4e('0x2'),'afterDestroy':_0xea4e('0x3')};function emitEvent(_0x2d2f10){return function(_0x2f2c49,_0x47d0fd,_0xb22ee7){DashboardItemEvents[_0xea4e('0x4')](_0x2d2f10+':'+_0x2f2c49['id'],_0x2f2c49);DashboardItemEvents[_0xea4e('0x4')](_0x2d2f10,_0x2f2c49);_0xb22ee7(null);};}for(var e in events){if(events[_0xea4e('0x5')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0xea4e('0x6')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 86761ce..836b514 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 _0xb009=['define','DashboardItem','dashboard_items','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./dashboardItem.attributes','exports'];(function(_0xd713d,_0x24eb9b){var _0x529488=function(_0x376c87){while(--_0x376c87){_0xd713d['push'](_0xd713d['shift']());}};_0x529488(++_0x24eb9b);}(_0xb009,0xe0));var _0x9b00=function(_0x49e8e2,_0x44d58c){_0x49e8e2=_0x49e8e2-0x0;var _0x1ee938=_0xb009[_0x49e8e2];return _0x1ee938;};'use strict';var _=require(_0x9b00('0x0'));var util=require('util');var logger=require(_0x9b00('0x1'))(_0x9b00('0x2'));var moment=require(_0x9b00('0x3'));var BPromise=require(_0x9b00('0x4'));var rp=require(_0x9b00('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9b00('0x6'));var config=require(_0x9b00('0x7'));var attributes=require(_0x9b00('0x8'));module[_0x9b00('0x9')]=function(_0x107a9d,_0x4429a0){return _0x107a9d[_0x9b00('0xa')](_0x9b00('0xb'),attributes,{'tableName':_0x9b00('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x10bd=['dashboard_items','util','api','moment','path','rimraf','../../config/environment','./dashboardItem.attributes','define','DashboardItem'];(function(_0xbf48eb,_0x54fb10){var _0x306c75=function(_0x408cab){while(--_0x408cab){_0xbf48eb['push'](_0xbf48eb['shift']());}};_0x306c75(++_0x54fb10);}(_0x10bd,0x97));var _0xd10b=function(_0x2d4cbc,_0x2fd6bb){_0x2d4cbc=_0x2d4cbc-0x0;var _0x41263f=_0x10bd[_0x2d4cbc];return _0x41263f;};'use strict';var _=require('lodash');var util=require(_0xd10b('0x0'));var logger=require('../../config/logger')(_0xd10b('0x1'));var moment=require(_0xd10b('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd10b('0x3'));var rimraf=require(_0xd10b('0x4'));var config=require(_0xd10b('0x5'));var attributes=require(_0xd10b('0x6'));module['exports']=function(_0xab72c9,_0x14540c){return _0xab72c9[_0xd10b('0x7')](_0xd10b('0x8'),attributes,{'tableName':_0xd10b('0x9'),'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 b23db5f..3fadfed 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 _0xbd77=['request','then','info','request\x20sent','debug','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0xbd77,0xc7));var _0x7bd7=function(_0x7e1f64,_0x3d2632){_0x7e1f64=_0x7e1f64-0x0;var _0x1108d2=_0xbd77[_0x7e1f64];return _0x1108d2;};'use strict';var _=require(_0x7bd7('0x0'));var util=require(_0x7bd7('0x1'));var moment=require(_0x7bd7('0x2'));var BPromise=require(_0x7bd7('0x3'));var rs=require(_0x7bd7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7bd7('0x5'))['db'];var utils=require(_0x7bd7('0x6'));var logger=require(_0x7bd7('0x7'))(_0x7bd7('0x8'));var config=require(_0x7bd7('0x9'));var jayson=require(_0x7bd7('0xa'));var client=jayson[_0x7bd7('0xb')][_0x7bd7('0xc')]({'port':0x232a});config[_0x7bd7('0xd')]=_[_0x7bd7('0xe')](config[_0x7bd7('0xd')],{'host':_0x7bd7('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7bd7('0xd')]));require('./dashboardItem.socket')[_0x7bd7('0x10')](socket);function respondWithRpcPromise(_0x4c33ea,_0x2c8459,_0x2a2777){return new BPromise(function(_0x22e02d,_0x14588d){return client[_0x7bd7('0x11')](_0x4c33ea,_0x2a2777)[_0x7bd7('0x12')](function(_0x3eba49){logger[_0x7bd7('0x13')]('DashboardItem,\x20%s,\x20%s',_0x2c8459,_0x7bd7('0x14'));logger[_0x7bd7('0x15')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x2c8459,_0x7bd7('0x14'),JSON[_0x7bd7('0x16')](_0x3eba49));if(_0x3eba49[_0x7bd7('0x17')]){if(_0x3eba49[_0x7bd7('0x17')][_0x7bd7('0x18')]===0x1f4){logger[_0x7bd7('0x17')](_0x7bd7('0x19'),_0x2c8459,_0x3eba49['error'][_0x7bd7('0x1a')]);return _0x14588d(_0x3eba49[_0x7bd7('0x17')][_0x7bd7('0x1a')]);}logger[_0x7bd7('0x17')]('DashboardItem,\x20%s,\x20%s',_0x2c8459,_0x3eba49[_0x7bd7('0x17')][_0x7bd7('0x1a')]);return _0x22e02d(_0x3eba49['error'][_0x7bd7('0x1a')]);}else{logger[_0x7bd7('0x13')]('DashboardItem,\x20%s,\x20%s',_0x2c8459,_0x7bd7('0x14'));_0x22e02d(_0x3eba49['result'][_0x7bd7('0x1a')]);}})['catch'](function(_0x4ea535){logger[_0x7bd7('0x17')](_0x7bd7('0x19'),_0x2c8459,_0x4ea535);_0x14588d(_0x4ea535);});});} \ No newline at end of file +var _0x509b=['request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','DashboardItem,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','request','info'];(function(_0x510aa1,_0x495174){var _0x2e6561=function(_0x353d3f){while(--_0x353d3f){_0x510aa1['push'](_0x510aa1['shift']());}};_0x2e6561(++_0x495174);}(_0x509b,0xb7));var _0xb509=function(_0x1cc511,_0x54584a){_0x1cc511=_0x1cc511-0x0;var _0x3303a1=_0x509b[_0x1cc511];return _0x3303a1;};'use strict';var _=require(_0xb509('0x0'));var util=require(_0xb509('0x1'));var moment=require(_0xb509('0x2'));var BPromise=require(_0xb509('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb509('0x4'))['db'];var utils=require(_0xb509('0x5'));var logger=require(_0xb509('0x6'))(_0xb509('0x7'));var config=require('../../config/environment');var jayson=require(_0xb509('0x8'));var client=jayson[_0xb509('0x9')]['http']({'port':0x232a});config[_0xb509('0xa')]=_['defaults'](config[_0xb509('0xa')],{'host':_0xb509('0xb'),'port':0x18eb});var socket=require(_0xb509('0xc'))(new Redis(config[_0xb509('0xa')]));require(_0xb509('0xd'))[_0xb509('0xe')](socket);function respondWithRpcPromise(_0x19c455,_0x35b1ec,_0x1a438a){return new BPromise(function(_0x5594ba,_0x37dfb3){return client[_0xb509('0xf')](_0x19c455,_0x1a438a)['then'](function(_0x36cd89){logger[_0xb509('0x10')]('DashboardItem,\x20%s,\x20%s',_0x35b1ec,_0xb509('0x11'));logger['debug'](_0xb509('0x12'),_0x35b1ec,_0xb509('0x11'),JSON[_0xb509('0x13')](_0x36cd89));if(_0x36cd89[_0xb509('0x14')]){if(_0x36cd89['error']['code']===0x1f4){logger[_0xb509('0x14')]('DashboardItem,\x20%s,\x20%s',_0x35b1ec,_0x36cd89['error'][_0xb509('0x15')]);return _0x37dfb3(_0x36cd89['error']['message']);}logger[_0xb509('0x14')](_0xb509('0x16'),_0x35b1ec,_0x36cd89['error']['message']);return _0x5594ba(_0x36cd89['error']['message']);}else{logger[_0xb509('0x10')](_0xb509('0x16'),_0x35b1ec,_0xb509('0x11'));_0x5594ba(_0x36cd89[_0xb509('0x17')]['message']);}})[_0xb509('0x18')](function(_0x1da2a1){logger['error'](_0xb509('0x16'),_0x35b1ec,_0x1da2a1);_0x37dfb3(_0x1da2a1);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index d8e813e..32c436a 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 _0xfb88=['removeListener','register','length','dashboardItem:','./dashboardItem.events','save','remove','update','emit'];(function(_0xdf2472,_0x50acec){var _0x35b148=function(_0x5cc6b8){while(--_0x5cc6b8){_0xdf2472['push'](_0xdf2472['shift']());}};_0x35b148(++_0x50acec);}(_0xfb88,0x16c));var _0x8fb8=function(_0x22f4fd,_0x4c6f98){_0x22f4fd=_0x22f4fd-0x0;var _0x3d315b=_0xfb88[_0x22f4fd];return _0x3d315b;};'use strict';var DashboardItemEvents=require(_0x8fb8('0x0'));var events=[_0x8fb8('0x1'),_0x8fb8('0x2'),_0x8fb8('0x3')];function createListener(_0x12a15e,_0x377796){return function(_0xc28770){_0x377796[_0x8fb8('0x4')](_0x12a15e,_0xc28770);};}function removeListener(_0x544a7b,_0xdf55b2){return function(){DashboardItemEvents[_0x8fb8('0x5')](_0x544a7b,_0xdf55b2);};}exports[_0x8fb8('0x6')]=function(_0x532747){for(var _0x4e9ba2=0x0,_0x4c70f2=events[_0x8fb8('0x7')];_0x4e9ba2<_0x4c70f2;_0x4e9ba2++){var _0x5ada15=events[_0x4e9ba2];var _0xd76e58=createListener(_0x8fb8('0x8')+_0x5ada15,_0x532747);DashboardItemEvents['on'](_0x5ada15,_0xd76e58);}}; \ No newline at end of file +var _0x336d=['dashboardItem:','./dashboardItem.events','save','remove','emit','register'];(function(_0x4c06a3,_0x1e6b6f){var _0x7ff53c=function(_0x559eff){while(--_0x559eff){_0x4c06a3['push'](_0x4c06a3['shift']());}};_0x7ff53c(++_0x1e6b6f);}(_0x336d,0x1ab));var _0xd336=function(_0xc81f05,_0x34076a){_0xc81f05=_0xc81f05-0x0;var _0x5dc4e6=_0x336d[_0xc81f05];return _0x5dc4e6;};'use strict';var DashboardItemEvents=require(_0xd336('0x0'));var events=[_0xd336('0x1'),_0xd336('0x2'),'update'];function createListener(_0x5d1004,_0x291695){return function(_0x3c9d12){_0x291695[_0xd336('0x3')](_0x5d1004,_0x3c9d12);};}function removeListener(_0x1d5ffd,_0x13e155){return function(){DashboardItemEvents['removeListener'](_0x1d5ffd,_0x13e155);};}exports[_0xd336('0x4')]=function(_0x4dcc2a){for(var _0x708eac=0x0,_0x348d3d=events['length'];_0x708eac<_0x348d3d;_0x708eac++){var _0xbc6b47=events[_0x708eac];var _0x41461c=createListener(_0xd336('0x5')+_0xbc6b47,_0x4dcc2a);DashboardItemEvents['on'](_0xbc6b47,_0x41461c);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index c3811a9..6c34fe4 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 _0x2a33=['fs-extra','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','create','delete','exports','multer','util','connect-timeout','express','Router'];(function(_0x7d653b,_0x3f3341){var _0x3a30e7=function(_0x4e7b60){while(--_0x4e7b60){_0x7d653b['push'](_0x7d653b['shift']());}};_0x3a30e7(++_0x3f3341);}(_0x2a33,0xe9));var _0x32a3=function(_0x33aecb,_0x36c2fc){_0x33aecb=_0x33aecb-0x0;var _0x1bf053=_0x2a33[_0x33aecb];return _0x1bf053;};'use strict';var multer=require(_0x32a3('0x0'));var util=require(_0x32a3('0x1'));var path=require('path');var timeout=require(_0x32a3('0x2'));var express=require(_0x32a3('0x3'));var router=express[_0x32a3('0x4')]();var fs_extra=require(_0x32a3('0x5'));var auth=require(_0x32a3('0x6'));var interaction=require(_0x32a3('0x7'));var config=require('../../config/environment');var controller=require(_0x32a3('0x8'));router[_0x32a3('0x9')](_0x32a3('0xa'),auth[_0x32a3('0xb')](),controller[_0x32a3('0xc')]);router[_0x32a3('0xd')]('/',auth[_0x32a3('0xb')](),controller[_0x32a3('0xe')]);router['put'](_0x32a3('0xa'),auth[_0x32a3('0xb')](),controller['update']);router[_0x32a3('0xf')]('/:id',auth[_0x32a3('0xb')](),controller['destroy']);module[_0x32a3('0x10')]=router; \ No newline at end of file +var _0xe782=['get','/:id','isAuthenticated','show','create','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x1e4215,_0x567081){var _0x10bfcd=function(_0x4cc643){while(--_0x4cc643){_0x1e4215['push'](_0x1e4215['shift']());}};_0x10bfcd(++_0x567081);}(_0xe782,0xd5));var _0x2e78=function(_0x5298fe,_0x3ddd71){_0x5298fe=_0x5298fe-0x0;var _0x5507e5=_0xe782[_0x5298fe];return _0x5507e5;};'use strict';var multer=require(_0x2e78('0x0'));var util=require(_0x2e78('0x1'));var path=require(_0x2e78('0x2'));var timeout=require('connect-timeout');var express=require(_0x2e78('0x3'));var router=express[_0x2e78('0x4')]();var fs_extra=require(_0x2e78('0x5'));var auth=require(_0x2e78('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2e78('0x7'));var controller=require('./dashboardItem.controller');router[_0x2e78('0x8')](_0x2e78('0x9'),auth[_0x2e78('0xa')](),controller[_0x2e78('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2e78('0xc')]);router[_0x2e78('0xd')](_0x2e78('0x9'),auth[_0x2e78('0xa')](),controller[_0x2e78('0xe')]);router[_0x2e78('0xf')](_0x2e78('0x9'),auth[_0x2e78('0xa')](),controller[_0x2e78('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index ae71c70..58eb9f2 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 _0x8d25=['first','second','third','STRING','sequelize','exports','ENUM'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x8d25,0x97));var _0x58d2=function(_0x163eca,_0x1c3875){_0x163eca=_0x163eca-0x0;var _0x2882cd=_0x8d25[_0x163eca];return _0x2882cd;};'use strict';var Sequelize=require(_0x58d2('0x0'));module[_0x58d2('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x58d2('0x2')](_0x58d2('0x3'),_0x58d2('0x4'),_0x58d2('0x5')),'allowNull':![],'defaultValue':_0x58d2('0x3')},'description':{'type':Sequelize[_0x58d2('0x6')]}}; \ No newline at end of file +var _0xc304=['exports','ENUM','first','second','third','STRING','sequelize'];(function(_0x3e5dd4,_0x24e966){var _0x33d3b7=function(_0x349612){while(--_0x349612){_0x3e5dd4['push'](_0x3e5dd4['shift']());}};_0x33d3b7(++_0x24e966);}(_0xc304,0xf4));var _0x4c30=function(_0x2ef8f1,_0x1280a3){_0x2ef8f1=_0x2ef8f1-0x0;var _0x17498d=_0xc304[_0x2ef8f1];return _0x17498d;};'use strict';var Sequelize=require(_0x4c30('0x0'));module[_0x4c30('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x4c30('0x2')](_0x4c30('0x3'),_0x4c30('0x4'),_0x4c30('0x5')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x4c30('0x6')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 32ab9a8..8c15394 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 _0x3dba=['model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Dispositions','end','error','stack','name','send','index','map','Disposition','fieldName'];(function(_0x577dc6,_0x4daaeb){var _0x1477a6=function(_0x5e0a97){while(--_0x5e0a97){_0x577dc6['push'](_0x577dc6['shift']());}};_0x1477a6(++_0x4daaeb);}(_0x3dba,0x73));var _0xa3db=function(_0x25ea25,_0x1e6541){_0x25ea25=_0x25ea25-0x0;var _0x150ba9=_0x3dba[_0x25ea25];return _0x150ba9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa3db('0x0'));var rp=require(_0xa3db('0x1'));var moment=require('moment');var BPromise=require(_0xa3db('0x2'));var Mustache=require(_0xa3db('0x3'));var util=require(_0xa3db('0x4'));var path=require(_0xa3db('0x5'));var sox=require(_0xa3db('0x6'));var csv=require(_0xa3db('0x7'));var ejs=require(_0xa3db('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa3db('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa3db('0xa'));var Redis=require(_0xa3db('0xb'));var authService=require(_0xa3db('0xc'));var qs=require(_0xa3db('0xd'));var as=require(_0xa3db('0xe'));var hardwareService=require(_0xa3db('0xf'));var logger=require(_0xa3db('0x10'))(_0xa3db('0x11'));var utils=require(_0xa3db('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xa3db('0x13'));var db=require(_0xa3db('0x14'))['db'];function respondWithStatusCode(_0x56c636,_0x20f91f){_0x20f91f=_0x20f91f||0xcc;return function(_0x42f8e0){if(_0x42f8e0){return _0x56c636[_0xa3db('0x15')](_0x20f91f);}return _0x56c636['status'](_0x20f91f)['end']();};}function respondWithResult(_0x221695,_0x302c34){_0x302c34=_0x302c34||0xc8;return function(_0x4f323b){if(_0x4f323b){return _0x221695[_0xa3db('0x16')](_0x302c34)[_0xa3db('0x17')](_0x4f323b);}};}function respondWithFilteredResult(_0xb75bcc,_0x1d07c5){return function(_0xaa5756){if(_0xaa5756){var _0xd53611=typeof _0x1d07c5[_0xa3db('0x18')]===_0xa3db('0x19')&&typeof _0x1d07c5[_0xa3db('0x1a')]==='undefined';var _0x558581=_0xaa5756[_0xa3db('0x1b')];var _0x278c2a=_0xd53611?0x0:_0x1d07c5[_0xa3db('0x18')];var _0x3f5e3e=_0xd53611?_0xaa5756['count']:_0x1d07c5[_0xa3db('0x18')]+_0x1d07c5[_0xa3db('0x1a')];var _0x356f63;if(_0x3f5e3e>=_0x558581){_0x3f5e3e=_0x558581;_0x356f63=0xc8;}else{_0x356f63=0xce;}_0xb75bcc[_0xa3db('0x16')](_0x356f63);return _0xb75bcc[_0xa3db('0x1c')](_0xa3db('0x1d'),_0x278c2a+'-'+_0x3f5e3e+'/'+_0x558581)[_0xa3db('0x17')](_0xaa5756);}return null;};}function patchUpdates(_0x2c817c){return function(_0x1eee9e){try{jsonpatch[_0xa3db('0x1e')](_0x1eee9e,_0x2c817c,!![]);}catch(_0x2581e2){return BPromise[_0xa3db('0x1f')](_0x2581e2);}return _0x1eee9e[_0xa3db('0x20')]();};}function saveUpdates(_0x5de05c,_0x195f57){return function(_0x16bc03){if(_0x16bc03){return _0x16bc03[_0xa3db('0x21')](_0x5de05c)[_0xa3db('0x22')](function(_0x989eed){return _0x989eed;});}return null;};}function removeEntity(_0x55a7cf,_0x3eab0c){return function(_0x49bc1b){if(_0x49bc1b){return _0x49bc1b[_0xa3db('0x23')]()[_0xa3db('0x22')](function(){var _0x5c02ce=_0x49bc1b[_0xa3db('0x24')]({'plain':!![]});var _0xe0be83=_0xa3db('0x25');return db['UserProfileResource'][_0xa3db('0x23')]({'where':{'type':_0xe0be83,'resourceId':_0x5c02ce['id']}})[_0xa3db('0x22')](function(){return _0x49bc1b;});})[_0xa3db('0x22')](function(){_0x55a7cf[_0xa3db('0x16')](0xcc)[_0xa3db('0x26')]();});}};}function handleEntityNotFound(_0x53e89f,_0x1d050b){return function(_0x4697e5){if(!_0x4697e5){_0x53e89f[_0xa3db('0x15')](0x194);}return _0x4697e5;};}function handleError(_0x1ce477,_0x244d2c){_0x244d2c=_0x244d2c||0x1f4;return function(_0x2f8602){logger[_0xa3db('0x27')](_0x2f8602[_0xa3db('0x28')]);if(_0x2f8602[_0xa3db('0x29')]){delete _0x2f8602[_0xa3db('0x29')];}_0x1ce477['status'](_0x244d2c)[_0xa3db('0x2a')](_0x2f8602);};}exports[_0xa3db('0x2b')]=function(_0x1f34da,_0x551010){var _0x296f6d={},_0x3b3436={},_0x581e1b={'count':0x0,'rows':[]};var _0x2bc60f=_[_0xa3db('0x2c')](db[_0xa3db('0x2d')]['rawAttributes'],function(_0x390595){return{'name':_0x390595[_0xa3db('0x2e')],'type':_0x390595['type']['key']};});_0x3b3436[_0xa3db('0x2f')]=_[_0xa3db('0x2c')](_0x2bc60f,_0xa3db('0x29'));_0x3b3436[_0xa3db('0x30')]=_[_0xa3db('0x31')](_0x1f34da[_0xa3db('0x30')]);_0x3b3436[_0xa3db('0x32')]=_[_0xa3db('0x33')](_0x3b3436['model'],_0x3b3436[_0xa3db('0x30')]);_0x296f6d['attributes']=_[_0xa3db('0x33')](_0x3b3436[_0xa3db('0x2f')],qs[_0xa3db('0x34')](_0x1f34da[_0xa3db('0x30')][_0xa3db('0x34')]));_0x296f6d[_0xa3db('0x35')]=_0x296f6d[_0xa3db('0x35')][_0xa3db('0x36')]?_0x296f6d['attributes']:_0x3b3436[_0xa3db('0x2f')];if(!_0x1f34da[_0xa3db('0x30')][_0xa3db('0x37')]('nolimit')){_0x296f6d[_0xa3db('0x1a')]=qs[_0xa3db('0x1a')](_0x1f34da[_0xa3db('0x30')][_0xa3db('0x1a')]);_0x296f6d[_0xa3db('0x18')]=qs['offset'](_0x1f34da[_0xa3db('0x30')]['offset']);}_0x296f6d['order']=qs[_0xa3db('0x38')](_0x1f34da[_0xa3db('0x30')][_0xa3db('0x38')]);_0x296f6d[_0xa3db('0x39')]=qs[_0xa3db('0x32')](_[_0xa3db('0x3a')](_0x1f34da[_0xa3db('0x30')],_0x3b3436[_0xa3db('0x32')]),_0x2bc60f);if(_0x1f34da[_0xa3db('0x30')][_0xa3db('0x3b')]){_0x296f6d[_0xa3db('0x39')]=_[_0xa3db('0x3c')](_0x296f6d['where'],{'$or':_[_0xa3db('0x2c')](_0x2bc60f,function(_0x24c4a3){if(_0x24c4a3[_0xa3db('0x3d')]!==_0xa3db('0x3e')){var _0x2a8527={};_0x2a8527[_0x24c4a3['name']]={'$like':'%'+_0x1f34da['query'][_0xa3db('0x3b')]+'%'};return _0x2a8527;}})});}_0x296f6d=_[_0xa3db('0x3c')]({},_0x296f6d,_0x1f34da[_0xa3db('0x3f')]);var _0x30cd2f={'where':_0x296f6d[_0xa3db('0x39')]};return db[_0xa3db('0x2d')][_0xa3db('0x1b')](_0x30cd2f)[_0xa3db('0x22')](function(_0x57350f){_0x581e1b['count']=_0x57350f;if(_0x1f34da[_0xa3db('0x30')][_0xa3db('0x40')]){_0x296f6d[_0xa3db('0x41')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x296f6d);})[_0xa3db('0x22')](function(_0x47e625){_0x581e1b[_0xa3db('0x42')]=_0x47e625;return _0x581e1b;})['then'](respondWithFilteredResult(_0x551010,_0x296f6d))[_0xa3db('0x43')](handleError(_0x551010,null));};exports[_0xa3db('0x44')]=function(_0x4455c5,_0x22f3ed){var _0x3cffad={'raw':!![],'where':{'id':_0x4455c5[_0xa3db('0x45')]['id']}},_0x2875b8={};_0x2875b8['model']=_[_0xa3db('0x31')](db[_0xa3db('0x2d')][_0xa3db('0x46')]);_0x2875b8[_0xa3db('0x30')]=_['keys'](_0x4455c5[_0xa3db('0x30')]);_0x2875b8['filters']=_[_0xa3db('0x33')](_0x2875b8[_0xa3db('0x2f')],_0x2875b8['query']);_0x3cffad['attributes']=_[_0xa3db('0x33')](_0x2875b8['model'],qs[_0xa3db('0x34')](_0x4455c5[_0xa3db('0x30')][_0xa3db('0x34')]));_0x3cffad[_0xa3db('0x35')]=_0x3cffad['attributes'][_0xa3db('0x36')]?_0x3cffad[_0xa3db('0x35')]:_0x2875b8[_0xa3db('0x2f')];if(_0x4455c5[_0xa3db('0x30')][_0xa3db('0x40')]){_0x3cffad[_0xa3db('0x41')]=[{'all':!![]}];}_0x3cffad=_['merge']({},_0x3cffad,_0x4455c5[_0xa3db('0x3f')]);return db[_0xa3db('0x2d')]['find'](_0x3cffad)[_0xa3db('0x22')](handleEntityNotFound(_0x22f3ed,null))['then'](respondWithResult(_0x22f3ed,null))[_0xa3db('0x43')](handleError(_0x22f3ed,null));};exports[_0xa3db('0x47')]=function(_0x2207e9,_0x4b55a9){return db[_0xa3db('0x2d')][_0xa3db('0x47')](_0x2207e9[_0xa3db('0x48')],{})[_0xa3db('0x22')](function(_0x48f3f8){var _0x14b37e=_0x2207e9[_0xa3db('0x49')][_0xa3db('0x24')]({'plain':!![]});if(!_0x14b37e)throw new Error(_0xa3db('0x4a'));if(_0x14b37e[_0xa3db('0x4b')]===_0xa3db('0x49')){var _0x40a45b=_0x48f3f8[_0xa3db('0x24')]({'plain':!![]});var _0x4c049a='Dispositions';return db[_0xa3db('0x4c')][_0xa3db('0x4d')]({'where':{'name':_0x4c049a,'userProfileId':_0x14b37e[_0xa3db('0x4e')]},'raw':!![]})[_0xa3db('0x22')](function(_0x47f828){if(_0x47f828&&_0x47f828[_0xa3db('0x4f')]===0x0){return db[_0xa3db('0x50')][_0xa3db('0x47')]({'name':_0x40a45b[_0xa3db('0x29')],'resourceId':_0x40a45b['id'],'type':_0x47f828[_0xa3db('0x29')],'sectionId':_0x47f828['id']},{})['then'](function(){return _0x48f3f8;});}else{return _0x48f3f8;}})[_0xa3db('0x43')](function(_0x32c634){logger[_0xa3db('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32c634);throw _0x32c634;});}return _0x48f3f8;})[_0xa3db('0x22')](respondWithResult(_0x4b55a9,0xc9))[_0xa3db('0x43')](handleError(_0x4b55a9,null));};exports[_0xa3db('0x21')]=function(_0x34ccb2,_0x15a9fd){if(_0x34ccb2['body']['id']){delete _0x34ccb2[_0xa3db('0x48')]['id'];}return db['Disposition'][_0xa3db('0x4d')]({'where':{'id':_0x34ccb2[_0xa3db('0x45')]['id']}})[_0xa3db('0x22')](handleEntityNotFound(_0x15a9fd,null))[_0xa3db('0x22')](saveUpdates(_0x34ccb2[_0xa3db('0x48')],null))[_0xa3db('0x22')](respondWithResult(_0x15a9fd,null))[_0xa3db('0x43')](handleError(_0x15a9fd,null));};exports['destroy']=function(_0x383d3b,_0x5f337e){return db[_0xa3db('0x2d')]['find']({'where':{'id':_0x383d3b[_0xa3db('0x45')]['id']}})[_0xa3db('0x22')](handleEntityNotFound(_0x5f337e,null))[_0xa3db('0x22')](removeEntity(_0x5f337e,null))[_0xa3db('0x43')](handleError(_0x5f337e,null));}; \ No newline at end of file +var _0xb714=['user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filters','filter','merge','map','VIRTUAL','options','Disposition','includeAll','catch','show','params','length','include','create','body'];(function(_0x5e7556,_0x59519b){var _0x52c32d=function(_0x510edc){while(--_0x510edc){_0x5e7556['push'](_0x5e7556['shift']());}};_0x52c32d(++_0x59519b);}(_0xb714,0x196));var _0x4b71=function(_0x43d0e6,_0x3c1489){_0x43d0e6=_0x43d0e6-0x0;var _0x51d841=_0xb714[_0x43d0e6];return _0x51d841;};'use strict';var emlformat=require(_0x4b71('0x0'));var rimraf=require(_0x4b71('0x1'));var zipdir=require(_0x4b71('0x2'));var jsonpatch=require(_0x4b71('0x3'));var rp=require('request-promise');var moment=require(_0x4b71('0x4'));var BPromise=require(_0x4b71('0x5'));var Mustache=require('mustache');var util=require(_0x4b71('0x6'));var path=require(_0x4b71('0x7'));var sox=require('sox');var csv=require(_0x4b71('0x8'));var ejs=require(_0x4b71('0x9'));var fs=require('fs');var fs_extra=require(_0x4b71('0xa'));var _=require('lodash');var squel=require(_0x4b71('0xb'));var crypto=require(_0x4b71('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4b71('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4b71('0xe'));var authService=require(_0x4b71('0xf'));var qs=require(_0x4b71('0x10'));var as=require(_0x4b71('0x11'));var hardwareService=require(_0x4b71('0x12'));var logger=require(_0x4b71('0x13'))('api');var utils=require(_0x4b71('0x14'));var config=require(_0x4b71('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x4b71('0x16'))['db'];function respondWithStatusCode(_0x780f9,_0xdca8a6){_0xdca8a6=_0xdca8a6||0xcc;return function(_0x1d9b9b){if(_0x1d9b9b){return _0x780f9['sendStatus'](_0xdca8a6);}return _0x780f9[_0x4b71('0x17')](_0xdca8a6)[_0x4b71('0x18')]();};}function respondWithResult(_0x235804,_0x11edeb){_0x11edeb=_0x11edeb||0xc8;return function(_0x14bdcb){if(_0x14bdcb){return _0x235804[_0x4b71('0x17')](_0x11edeb)[_0x4b71('0x19')](_0x14bdcb);}};}function respondWithFilteredResult(_0x13a1a3,_0x3e9724){return function(_0x75daa9){if(_0x75daa9){var _0x3e9e5c=typeof _0x3e9724[_0x4b71('0x1a')]===_0x4b71('0x1b')&&typeof _0x3e9724[_0x4b71('0x1c')]===_0x4b71('0x1b');var _0x175c42=_0x75daa9[_0x4b71('0x1d')];var _0x30a4fd=_0x3e9e5c?0x0:_0x3e9724[_0x4b71('0x1a')];var _0x33202c=_0x3e9e5c?_0x75daa9[_0x4b71('0x1d')]:_0x3e9724[_0x4b71('0x1a')]+_0x3e9724[_0x4b71('0x1c')];var _0x2b977e;if(_0x33202c>=_0x175c42){_0x33202c=_0x175c42;_0x2b977e=0xc8;}else{_0x2b977e=0xce;}_0x13a1a3[_0x4b71('0x17')](_0x2b977e);return _0x13a1a3['set']('Content-Range',_0x30a4fd+'-'+_0x33202c+'/'+_0x175c42)['json'](_0x75daa9);}return null;};}function patchUpdates(_0x2d5fa5){return function(_0x594567){try{jsonpatch[_0x4b71('0x1e')](_0x594567,_0x2d5fa5,!![]);}catch(_0x5cf54e){return BPromise[_0x4b71('0x1f')](_0x5cf54e);}return _0x594567[_0x4b71('0x20')]();};}function saveUpdates(_0x19486c,_0x22719f){return function(_0xf3c3d2){if(_0xf3c3d2){return _0xf3c3d2[_0x4b71('0x21')](_0x19486c)[_0x4b71('0x22')](function(_0x8248bc){return _0x8248bc;});}return null;};}function removeEntity(_0x796e75,_0x4ae2da){return function(_0x133568){if(_0x133568){return _0x133568[_0x4b71('0x23')]()[_0x4b71('0x22')](function(){var _0x322723=_0x133568[_0x4b71('0x24')]({'plain':!![]});var _0x4a184f=_0x4b71('0x25');return db[_0x4b71('0x26')][_0x4b71('0x23')]({'where':{'type':_0x4a184f,'resourceId':_0x322723['id']}})[_0x4b71('0x22')](function(){return _0x133568;});})[_0x4b71('0x22')](function(){_0x796e75[_0x4b71('0x17')](0xcc)[_0x4b71('0x18')]();});}};}function handleEntityNotFound(_0x3e781d,_0x14c168){return function(_0x5989ef){if(!_0x5989ef){_0x3e781d['sendStatus'](0x194);}return _0x5989ef;};}function handleError(_0x365be6,_0x199ab7){_0x199ab7=_0x199ab7||0x1f4;return function(_0x915871){logger[_0x4b71('0x27')](_0x915871[_0x4b71('0x28')]);if(_0x915871[_0x4b71('0x29')]){delete _0x915871[_0x4b71('0x29')];}_0x365be6[_0x4b71('0x17')](_0x199ab7)[_0x4b71('0x2a')](_0x915871);};}exports[_0x4b71('0x2b')]=function(_0x30c41b,_0x470bfc){var _0x35d2b7={},_0x426bdb={},_0x5e179b={'count':0x0,'rows':[]};var _0x50bfc8=_['map'](db['Disposition'][_0x4b71('0x2c')],function(_0x450485){return{'name':_0x450485[_0x4b71('0x2d')],'type':_0x450485[_0x4b71('0x2e')][_0x4b71('0x2f')]};});_0x426bdb[_0x4b71('0x30')]=_['map'](_0x50bfc8,_0x4b71('0x29'));_0x426bdb[_0x4b71('0x31')]=_[_0x4b71('0x32')](_0x30c41b['query']);_0x426bdb['filters']=_[_0x4b71('0x33')](_0x426bdb['model'],_0x426bdb[_0x4b71('0x31')]);_0x35d2b7[_0x4b71('0x34')]=_[_0x4b71('0x33')](_0x426bdb[_0x4b71('0x30')],qs['fields'](_0x30c41b[_0x4b71('0x31')][_0x4b71('0x35')]));_0x35d2b7[_0x4b71('0x34')]=_0x35d2b7['attributes']['length']?_0x35d2b7['attributes']:_0x426bdb[_0x4b71('0x30')];if(!_0x30c41b['query'][_0x4b71('0x36')]('nolimit')){_0x35d2b7[_0x4b71('0x1c')]=qs[_0x4b71('0x1c')](_0x30c41b[_0x4b71('0x31')]['limit']);_0x35d2b7[_0x4b71('0x1a')]=qs[_0x4b71('0x1a')](_0x30c41b[_0x4b71('0x31')][_0x4b71('0x1a')]);}_0x35d2b7[_0x4b71('0x37')]=qs[_0x4b71('0x38')](_0x30c41b[_0x4b71('0x31')][_0x4b71('0x38')]);_0x35d2b7[_0x4b71('0x39')]=qs['filters'](_[_0x4b71('0x3a')](_0x30c41b[_0x4b71('0x31')],_0x426bdb[_0x4b71('0x3b')]),_0x50bfc8);if(_0x30c41b[_0x4b71('0x31')][_0x4b71('0x3c')]){_0x35d2b7[_0x4b71('0x39')]=_[_0x4b71('0x3d')](_0x35d2b7['where'],{'$or':_[_0x4b71('0x3e')](_0x50bfc8,function(_0xd1ab1){if(_0xd1ab1['type']!==_0x4b71('0x3f')){var _0x4de48={};_0x4de48[_0xd1ab1[_0x4b71('0x29')]]={'$like':'%'+_0x30c41b[_0x4b71('0x31')]['filter']+'%'};return _0x4de48;}})});}_0x35d2b7=_[_0x4b71('0x3d')]({},_0x35d2b7,_0x30c41b[_0x4b71('0x40')]);var _0x3a50a6={'where':_0x35d2b7[_0x4b71('0x39')]};return db[_0x4b71('0x41')][_0x4b71('0x1d')](_0x3a50a6)['then'](function(_0xcb00a7){_0x5e179b[_0x4b71('0x1d')]=_0xcb00a7;if(_0x30c41b[_0x4b71('0x31')][_0x4b71('0x42')]){_0x35d2b7['include']=[{'all':!![]}];}return db[_0x4b71('0x41')]['findAll'](_0x35d2b7);})[_0x4b71('0x22')](function(_0x36ab63){_0x5e179b['rows']=_0x36ab63;return _0x5e179b;})[_0x4b71('0x22')](respondWithFilteredResult(_0x470bfc,_0x35d2b7))[_0x4b71('0x43')](handleError(_0x470bfc,null));};exports[_0x4b71('0x44')]=function(_0x44c599,_0xcc3287){var _0x35a1d0={'raw':!![],'where':{'id':_0x44c599[_0x4b71('0x45')]['id']}},_0x19005b={};_0x19005b[_0x4b71('0x30')]=_['keys'](db[_0x4b71('0x41')]['rawAttributes']);_0x19005b[_0x4b71('0x31')]=_[_0x4b71('0x32')](_0x44c599['query']);_0x19005b[_0x4b71('0x3b')]=_[_0x4b71('0x33')](_0x19005b[_0x4b71('0x30')],_0x19005b['query']);_0x35a1d0[_0x4b71('0x34')]=_[_0x4b71('0x33')](_0x19005b['model'],qs[_0x4b71('0x35')](_0x44c599['query']['fields']));_0x35a1d0['attributes']=_0x35a1d0[_0x4b71('0x34')][_0x4b71('0x46')]?_0x35a1d0[_0x4b71('0x34')]:_0x19005b[_0x4b71('0x30')];if(_0x44c599[_0x4b71('0x31')]['includeAll']){_0x35a1d0[_0x4b71('0x47')]=[{'all':!![]}];}_0x35a1d0=_[_0x4b71('0x3d')]({},_0x35a1d0,_0x44c599['options']);return db[_0x4b71('0x41')]['find'](_0x35a1d0)['then'](handleEntityNotFound(_0xcc3287,null))[_0x4b71('0x22')](respondWithResult(_0xcc3287,null))[_0x4b71('0x43')](handleError(_0xcc3287,null));};exports['create']=function(_0x1e61de,_0x143931){return db[_0x4b71('0x41')][_0x4b71('0x48')](_0x1e61de[_0x4b71('0x49')],{})[_0x4b71('0x22')](function(_0x3991a1){var _0x1304a5=_0x1e61de[_0x4b71('0x4a')][_0x4b71('0x24')]({'plain':!![]});if(!_0x1304a5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1304a5['role']===_0x4b71('0x4a')){var _0x27dec8=_0x3991a1[_0x4b71('0x24')]({'plain':!![]});var _0x5555e7='Dispositions';return db[_0x4b71('0x4b')][_0x4b71('0x4c')]({'where':{'name':_0x5555e7,'userProfileId':_0x1304a5[_0x4b71('0x4d')]},'raw':!![]})[_0x4b71('0x22')](function(_0x334c22){if(_0x334c22&&_0x334c22[_0x4b71('0x4e')]===0x0){return db[_0x4b71('0x26')][_0x4b71('0x48')]({'name':_0x27dec8[_0x4b71('0x29')],'resourceId':_0x27dec8['id'],'type':_0x334c22[_0x4b71('0x29')],'sectionId':_0x334c22['id']},{})[_0x4b71('0x22')](function(){return _0x3991a1;});}else{return _0x3991a1;}})['catch'](function(_0x4c800c){logger['error'](_0x4b71('0x4f'),_0x4c800c);throw _0x4c800c;});}return _0x3991a1;})[_0x4b71('0x22')](respondWithResult(_0x143931,0xc9))[_0x4b71('0x43')](handleError(_0x143931,null));};exports[_0x4b71('0x21')]=function(_0x1d6cb3,_0x69a93b){if(_0x1d6cb3[_0x4b71('0x49')]['id']){delete _0x1d6cb3[_0x4b71('0x49')]['id'];}return db['Disposition'][_0x4b71('0x4c')]({'where':{'id':_0x1d6cb3[_0x4b71('0x45')]['id']}})['then'](handleEntityNotFound(_0x69a93b,null))['then'](saveUpdates(_0x1d6cb3[_0x4b71('0x49')],null))['then'](respondWithResult(_0x69a93b,null))[_0x4b71('0x43')](handleError(_0x69a93b,null));};exports[_0x4b71('0x23')]=function(_0x5e20e2,_0x317583){return db[_0x4b71('0x41')]['find']({'where':{'id':_0x5e20e2[_0x4b71('0x45')]['id']}})['then'](handleEntityNotFound(_0x317583,null))[_0x4b71('0x22')](removeEntity(_0x317583,null))[_0x4b71('0x43')](handleError(_0x317583,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 10a26b9..acbc10a 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 _0x2ed9=['name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','util','../../config/logger','api','bluebird','path','rimraf','tools_dispositions','name_voice','name','ListId','name_chat'];(function(_0x341bde,_0x6d77a8){var _0xbc7f3d=function(_0x106369){while(--_0x106369){_0x341bde['push'](_0x341bde['shift']());}};_0xbc7f3d(++_0x6d77a8);}(_0x2ed9,0xf1));var _0x92ed=function(_0x7b717,_0x311539){_0x7b717=_0x7b717-0x0;var _0x50d254=_0x2ed9[_0x7b717];return _0x50d254;};'use strict';var _=require('lodash');var util=require(_0x92ed('0x0'));var logger=require(_0x92ed('0x1'))(_0x92ed('0x2'));var moment=require('moment');var BPromise=require(_0x92ed('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x92ed('0x4'));var rimraf=require(_0x92ed('0x5'));var config=require('../../config/environment');var attributes=require('./disposition.attributes');module['exports']=function(_0x6867f,_0x465bcd){return _0x6867f['define']('Disposition',attributes,{'tableName':_0x92ed('0x6'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x92ed('0x7'),'fields':[_0x92ed('0x8'),_0x92ed('0x9')]},{'unique':!![],'name':_0x92ed('0xa'),'fields':[_0x92ed('0x8'),'ChatWebsiteId']},{'unique':!![],'name':_0x92ed('0xb'),'fields':[_0x92ed('0x8'),_0x92ed('0xc')]},{'unique':!![],'name':_0x92ed('0xd'),'fields':[_0x92ed('0x8'),_0x92ed('0xe')]},{'unique':!![],'name':_0x92ed('0xf'),'fields':[_0x92ed('0x8'),_0x92ed('0x10')]},{'unique':!![],'name':_0x92ed('0x11'),'fields':[_0x92ed('0x8'),_0x92ed('0x12')]},{'unique':!![],'name':_0x92ed('0x13'),'fields':['name',_0x92ed('0x14')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1cb0=['moment','request-promise','path','../../config/environment','./disposition.attributes','exports','define','tools_dispositions','name_voice','name','name_chat','ChatWebsiteId','name_mail','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','api'];(function(_0x57e18a,_0x199383){var _0x1181c7=function(_0x2503e8){while(--_0x2503e8){_0x57e18a['push'](_0x57e18a['shift']());}};_0x1181c7(++_0x199383);}(_0x1cb0,0x70));var _0x01cb=function(_0x2e4eea,_0x5db9bf){_0x2e4eea=_0x2e4eea-0x0;var _0x3e5788=_0x1cb0[_0x2e4eea];return _0x3e5788;};'use strict';var _=require(_0x01cb('0x0'));var util=require('util');var logger=require(_0x01cb('0x1'))(_0x01cb('0x2'));var moment=require(_0x01cb('0x3'));var BPromise=require('bluebird');var rp=require(_0x01cb('0x4'));var fs=require('fs');var path=require(_0x01cb('0x5'));var rimraf=require('rimraf');var config=require(_0x01cb('0x6'));var attributes=require(_0x01cb('0x7'));module[_0x01cb('0x8')]=function(_0x567d20,_0x166c68){return _0x567d20[_0x01cb('0x9')]('Disposition',attributes,{'tableName':_0x01cb('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x01cb('0xb'),'fields':[_0x01cb('0xc'),'ListId']},{'unique':!![],'name':_0x01cb('0xd'),'fields':['name',_0x01cb('0xe')]},{'unique':!![],'name':_0x01cb('0xf'),'fields':[_0x01cb('0xc'),'MailAccountId']},{'unique':!![],'name':'name_sms','fields':[_0x01cb('0xc'),_0x01cb('0x10')]},{'unique':!![],'name':_0x01cb('0x11'),'fields':[_0x01cb('0xc'),_0x01cb('0x12')]},{'unique':!![],'name':_0x01cb('0x13'),'fields':[_0x01cb('0xc'),_0x01cb('0x14')]},{'unique':!![],'name':_0x01cb('0x15'),'fields':[_0x01cb('0xc'),_0x01cb('0x16')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index d00d75f..a17b661 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(_0x58d2b2,_0x5d3219){var _0x3887bd=function(_0x4110ec){while(--_0x4110ec){_0x58d2b2['push'](_0x58d2b2['shift']());}};_0x3887bd(++_0x5d3219);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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(_0x43f838,_0x437577){var _0x1abeb1=function(_0x37fbc8){while(--_0x37fbc8){_0x43f838['push'](_0x43f838['shift']());}};_0x1abeb1(++_0x437577);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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 db829f3..8ea9240 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 _0x19a2=['isAuthenticated','post','create','put','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','index','/:id'];(function(_0x4575b0,_0x3d35cb){var _0x4c19d0=function(_0x2a44ee){while(--_0x2a44ee){_0x4575b0['push'](_0x4575b0['shift']());}};_0x4c19d0(++_0x3d35cb);}(_0x19a2,0x124));var _0x219a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x19a2[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x219a('0x0'));var util=require('util');var path=require(_0x219a('0x1'));var timeout=require(_0x219a('0x2'));var express=require('express');var router=express[_0x219a('0x3')]();var fs_extra=require(_0x219a('0x4'));var auth=require(_0x219a('0x5'));var interaction=require(_0x219a('0x6'));var config=require(_0x219a('0x7'));var controller=require(_0x219a('0x8'));router[_0x219a('0x9')]('/',auth['isAuthenticated'](),controller[_0x219a('0xa')]);router[_0x219a('0x9')](_0x219a('0xb'),auth[_0x219a('0xc')](),controller['show']);router[_0x219a('0xd')]('/',auth['isAuthenticated'](),controller[_0x219a('0xe')]);router[_0x219a('0xf')]('/:id',auth[_0x219a('0xc')](),controller['update']);router[_0x219a('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x219a('0x11')]);module[_0x219a('0x12')]=router; \ No newline at end of file +var _0x8a87=['../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','post','create','put','exports','multer','path','connect-timeout','Router','fs-extra'];(function(_0xd2548e,_0x556106){var _0x1258d3=function(_0x4d4b7f){while(--_0x4d4b7f){_0xd2548e['push'](_0xd2548e['shift']());}};_0x1258d3(++_0x556106);}(_0x8a87,0xa5));var _0x78a8=function(_0x1326e3,_0x1c6728){_0x1326e3=_0x1326e3-0x0;var _0x33d5bb=_0x8a87[_0x1326e3];return _0x33d5bb;};'use strict';var multer=require(_0x78a8('0x0'));var util=require('util');var path=require(_0x78a8('0x1'));var timeout=require(_0x78a8('0x2'));var express=require('express');var router=express[_0x78a8('0x3')]();var fs_extra=require(_0x78a8('0x4'));var auth=require(_0x78a8('0x5'));var interaction=require(_0x78a8('0x6'));var config=require(_0x78a8('0x7'));var controller=require(_0x78a8('0x8'));router[_0x78a8('0x9')]('/',auth[_0x78a8('0xa')](),controller[_0x78a8('0xb')]);router[_0x78a8('0x9')](_0x78a8('0xc'),auth[_0x78a8('0xa')](),controller['show']);router[_0x78a8('0xd')]('/',auth[_0x78a8('0xa')](),controller[_0x78a8('0xe')]);router[_0x78a8('0xf')](_0x78a8('0xc'),auth[_0x78a8('0xa')](),controller['update']);router['delete'](_0x78a8('0xc'),auth[_0x78a8('0xa')](),controller['destroy']);module[_0x78a8('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index cd62756..debdee5 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 _0x6b81=['4800','INTEGER','IAX','DADHI','KHOMP','SIP','TEXT','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','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','localstationid','2400','7200','9600','12000','14400'];(function(_0xb6ff1c,_0x550989){var _0x5c55dc=function(_0x51093e){while(--_0x51093e){_0xb6ff1c['push'](_0xb6ff1c['shift']());}};_0x5c55dc(++_0x550989);}(_0x6b81,0x16c));var _0x16b8=function(_0x1e33fd,_0x12d3a5){_0x1e33fd=_0x1e33fd-0x0;var _0x4f4ea7=_0x6b81[_0x1e33fd];return _0x4f4ea7;};'use strict';var Sequelize=require(_0x16b8('0x0'));module[_0x16b8('0x1')]={'name':{'type':Sequelize[_0x16b8('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x16b8('0x2')]},'ecm':{'type':Sequelize[_0x16b8('0x3')](_0x16b8('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x16b8('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x16b8('0x2')],'unique':_0x16b8('0x5')},'minrate':{'type':Sequelize[_0x16b8('0x3')](_0x16b8('0x6'),'4800',_0x16b8('0x7'),_0x16b8('0x8'),_0x16b8('0x9'),_0x16b8('0xa')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x16b8('0x3')](_0x16b8('0x6'),_0x16b8('0xb'),_0x16b8('0x7'),_0x16b8('0x8'),_0x16b8('0x9'),_0x16b8('0xa')),'defaultValue':_0x16b8('0xa')},'modem':{'type':Sequelize['STRING'],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x16b8('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x16b8('0x3')]('SIP',_0x16b8('0xd'),_0x16b8('0xe'),_0x16b8('0xf')),'defaultValue':_0x16b8('0x10')},'key':{'type':Sequelize[_0x16b8('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x16b8('0x11')],'defaultValue':function(){return _0x16b8('0x12');}},'notificationSound':{'type':Sequelize[_0x16b8('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x16b8('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x16b8('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x16b8('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x16b8('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x16b8('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x16b8('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x16b8('0x13')],'defaultValue':![],'comment':_0x16b8('0x15'),'set':function(_0x3a2485){if(!_0x3a2485)this[_0x16b8('0x16')](_0x16b8('0x17'),null);this[_0x16b8('0x16')](_0x16b8('0x18'),_0x3a2485);}}}; \ No newline at end of file +var _0x68e3=['exports','ENUM','yes','STRING','localstationid','2400','4800','7200','9600','12000','14400','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize'];(function(_0x44db68,_0x39ca75){var _0x5de6b6=function(_0x457fd9){while(--_0x457fd9){_0x44db68['push'](_0x44db68['shift']());}};_0x5de6b6(++_0x39ca75);}(_0x68e3,0x12b));var _0x368e=function(_0x293b37,_0x5d8f35){_0x293b37=_0x293b37-0x0;var _0x2665e9=_0x68e3[_0x293b37];return _0x2665e9;};'use strict';var Sequelize=require(_0x368e('0x0'));module[_0x368e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x368e('0x2')](_0x368e('0x3'),'no'),'defaultValue':_0x368e('0x3')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x368e('0x4')],'unique':_0x368e('0x5')},'minrate':{'type':Sequelize[_0x368e('0x2')](_0x368e('0x6'),_0x368e('0x7'),_0x368e('0x8'),_0x368e('0x9'),_0x368e('0xa'),'14400'),'defaultValue':_0x368e('0x7')},'maxrate':{'type':Sequelize['ENUM'](_0x368e('0x6'),_0x368e('0x7'),_0x368e('0x8'),_0x368e('0x9'),_0x368e('0xa'),_0x368e('0xb')),'defaultValue':_0x368e('0xb')},'modem':{'type':Sequelize[_0x368e('0x4')],'defaultValue':_0x368e('0xc')},'gateway':{'type':Sequelize[_0x368e('0x4')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x368e('0x4')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x368e('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x368e('0x2')](_0x368e('0xe'),_0x368e('0xf'),_0x368e('0x10'),_0x368e('0x11')),'defaultValue':_0x368e('0xe')},'key':{'type':Sequelize[_0x368e('0x4')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x368e('0x12')],'defaultValue':function(){return _0x368e('0x13');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x368e('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x368e('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x368e('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x368e('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x368e('0x15')],'defaultValue':![],'comment':_0x368e('0x16'),'set':function(_0x1d5741){if(!_0x1d5741)this[_0x368e('0x17')]('mandatoryDispositionPauseId',null);this[_0x368e('0x17')](_0x368e('0x18'),_0x1d5741);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index cffe20c..4b6d51f 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 _0xcdb8=['UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','FaxAccount','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','nolimit','map','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','FaxInteraction','addInteraction','getInteractions','CmContact','Contact','User','Owner','internal','Tag','Tags','color','tag','addApplications','transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','findAndCountAll','finally','sendStatus','context','exten','localstationid','app','system','priority','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','VoiceExtension','bulkCreate','sequelize','omit','tech','updatedAt','TrunkId','findById','getMessages','FaxMessage','$gte','split','format','CmList','List','Contacts','attachments','join','CheckAfterSend','isNil','from','fax','ListId','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','jayson/promise','client','http','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','get','FaxAccounts'];(function(_0x5d938f,_0x2f8f41){var _0x1471a5=function(_0x5dcabe){while(--_0x5dcabe){_0x5d938f['push'](_0x5d938f['shift']());}};_0x1471a5(++_0x2f8f41);}(_0xcdb8,0x8b));var _0x8cdb=function(_0x2bf031,_0x2e84d8){_0x2bf031=_0x2bf031-0x0;var _0x215504=_0xcdb8[_0x2bf031];return _0x215504;};'use strict';var emlformat=require(_0x8cdb('0x0'));var rimraf=require(_0x8cdb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8cdb('0x2'));var rp=require('request-promise');var moment=require(_0x8cdb('0x3'));var BPromise=require(_0x8cdb('0x4'));var Mustache=require(_0x8cdb('0x5'));var util=require(_0x8cdb('0x6'));var path=require(_0x8cdb('0x7'));var sox=require(_0x8cdb('0x8'));var csv=require(_0x8cdb('0x9'));var ejs=require(_0x8cdb('0xa'));var fs=require('fs');var fs_extra=require(_0x8cdb('0xb'));var _=require(_0x8cdb('0xc'));var squel=require(_0x8cdb('0xd'));var crypto=require(_0x8cdb('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8cdb('0x9'));var querystring=require('querystring');var Papa=require(_0x8cdb('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8cdb('0x10'));var as=require(_0x8cdb('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8cdb('0x12'));var utils=require(_0x8cdb('0x13'));var config=require(_0x8cdb('0x14'));var licenseUtil=require(_0x8cdb('0x15'));var db=require(_0x8cdb('0x16'))['db'];config[_0x8cdb('0x17')]=_[_0x8cdb('0x18')](config[_0x8cdb('0x17')],{'host':_0x8cdb('0x19'),'port':0x18eb});var socket=require(_0x8cdb('0x1a'))(new Redis(config[_0x8cdb('0x17')]));require(_0x8cdb('0x1b'))['register'](socket);var jayson=require(_0x8cdb('0x1c'));var client=jayson[_0x8cdb('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0x8cdb('0x1d')][_0x8cdb('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x372dac,_0x519b1d,_0x1232f5,_0x4b7c49){return new BPromise(function(_0x2dfad9,_0x1d28cc){var _0x5e949f=_0x4b7c49||client;return _0x5e949f['request'](_0x372dac,_0x1232f5)[_0x8cdb('0x1f')](function(_0x2df2c2){logger[_0x8cdb('0x20')](_0x8cdb('0x21'),_0x519b1d,_0x8cdb('0x22'));logger['debug'](_0x8cdb('0x23'),_0x519b1d,_0x8cdb('0x22'),JSON[_0x8cdb('0x24')](_0x2df2c2));if(_0x2df2c2[_0x8cdb('0x25')]){if(_0x2df2c2[_0x8cdb('0x25')][_0x8cdb('0x26')]===0x1f4){logger[_0x8cdb('0x25')](_0x8cdb('0x21'),_0x519b1d,_0x2df2c2[_0x8cdb('0x25')][_0x8cdb('0x27')]);return _0x1d28cc(_0x2df2c2[_0x8cdb('0x25')][_0x8cdb('0x27')]);}logger['error'](_0x8cdb('0x21'),_0x519b1d,_0x2df2c2['error'][_0x8cdb('0x27')]);return _0x2dfad9(_0x2df2c2[_0x8cdb('0x25')][_0x8cdb('0x27')]);}else{logger[_0x8cdb('0x20')](_0x8cdb('0x21'),_0x519b1d,_0x8cdb('0x22'));_0x2dfad9(_0x2df2c2['result'][_0x8cdb('0x27')]);}})[_0x8cdb('0x28')](function(_0x23d0c3){logger[_0x8cdb('0x25')](_0x8cdb('0x21'),_0x519b1d,_0x23d0c3);_0x1d28cc(_0x23d0c3);});});}function respondWithStatusCode(_0x111aa0,_0x2ee739){_0x2ee739=_0x2ee739||0xcc;return function(_0x1e3c86){if(_0x1e3c86){return _0x111aa0['sendStatus'](_0x2ee739);}return _0x111aa0[_0x8cdb('0x29')](_0x2ee739)[_0x8cdb('0x2a')]();};}function respondWithResult(_0x4bbc7c,_0x532e56){_0x532e56=_0x532e56||0xc8;return function(_0x1d761a){if(_0x1d761a){return _0x4bbc7c[_0x8cdb('0x29')](_0x532e56)['json'](_0x1d761a);}};}function respondWithFilteredResult(_0x9a8830,_0x9d9cfd){return function(_0x1cb6d4){if(_0x1cb6d4){var _0x4e7e4c=typeof _0x9d9cfd[_0x8cdb('0x2b')]===_0x8cdb('0x2c')&&typeof _0x9d9cfd[_0x8cdb('0x2d')]===_0x8cdb('0x2c');var _0x1bb61a=_0x1cb6d4[_0x8cdb('0x2e')];var _0x54f903=_0x4e7e4c?0x0:_0x9d9cfd['offset'];var _0x2719d1=_0x4e7e4c?_0x1cb6d4['count']:_0x9d9cfd[_0x8cdb('0x2b')]+_0x9d9cfd[_0x8cdb('0x2d')];var _0x5f06ef;if(_0x2719d1>=_0x1bb61a){_0x2719d1=_0x1bb61a;_0x5f06ef=0xc8;}else{_0x5f06ef=0xce;}_0x9a8830[_0x8cdb('0x29')](_0x5f06ef);return _0x9a8830[_0x8cdb('0x2f')](_0x8cdb('0x30'),_0x54f903+'-'+_0x2719d1+'/'+_0x1bb61a)[_0x8cdb('0x31')](_0x1cb6d4);}return null;};}function patchUpdates(_0x570c7d){return function(_0x38adc5){try{jsonpatch[_0x8cdb('0x32')](_0x38adc5,_0x570c7d,!![]);}catch(_0x487b81){return BPromise[_0x8cdb('0x33')](_0x487b81);}return _0x38adc5[_0x8cdb('0x34')]();};}function saveUpdates(_0x3a6411,_0xb39ef6){return function(_0x27a78a){if(_0x27a78a){return _0x27a78a[_0x8cdb('0x35')](_0x3a6411)[_0x8cdb('0x1f')](function(_0x45ec9a){return _0x45ec9a;});}return null;};}function removeEntity(_0x5c6631,_0x3334b2){return function(_0x5d3a6e){if(_0x5d3a6e){return _0x5d3a6e['destroy']()['then'](function(){var _0x4e45dd=_0x5d3a6e[_0x8cdb('0x36')]({'plain':!![]});var _0x42423f=_0x8cdb('0x37');return db[_0x8cdb('0x38')][_0x8cdb('0x39')]({'where':{'type':_0x42423f,'resourceId':_0x4e45dd['id']}})[_0x8cdb('0x1f')](function(){return _0x5d3a6e;});})['then'](function(){_0x5c6631[_0x8cdb('0x29')](0xcc)[_0x8cdb('0x2a')]();});}};}function handleEntityNotFound(_0x11ed56,_0x5b5e34){return function(_0xb776a5){if(!_0xb776a5){_0x11ed56['sendStatus'](0x194);}return _0xb776a5;};}function handleError(_0x3088b9,_0x161f82){_0x161f82=_0x161f82||0x1f4;return function(_0x3219c1){logger[_0x8cdb('0x25')](_0x3219c1[_0x8cdb('0x3a')]);if(_0x3219c1[_0x8cdb('0x3b')]){delete _0x3219c1[_0x8cdb('0x3b')];}_0x3088b9[_0x8cdb('0x29')](_0x161f82)[_0x8cdb('0x3c')](_0x3219c1);};}exports[_0x8cdb('0x3d')]=function(_0x2e2fb8,_0x57857b){var _0x42343c={'include':[{'model':db[_0x8cdb('0x3e')],'as':_0x8cdb('0x3f')}]},_0x4fd16a={},_0x4eee7e={'count':0x0,'rows':[]};var _0xb6d304=_['map'](db[_0x8cdb('0x40')]['rawAttributes'],function(_0xb5344a){return{'name':_0xb5344a['fieldName'],'type':_0xb5344a['type'][_0x8cdb('0x41')]};});_0x4fd16a[_0x8cdb('0x42')]=_['map'](_0xb6d304,'name');_0x4fd16a[_0x8cdb('0x43')]=_[_0x8cdb('0x44')](_0x2e2fb8['query']);_0x4fd16a[_0x8cdb('0x45')]=_['intersection'](_0x4fd16a[_0x8cdb('0x42')],_0x4fd16a[_0x8cdb('0x43')]);_0x42343c[_0x8cdb('0x46')]=_[_0x8cdb('0x47')](_0x4fd16a[_0x8cdb('0x42')],qs[_0x8cdb('0x48')](_0x2e2fb8[_0x8cdb('0x43')][_0x8cdb('0x48')]));_0x42343c[_0x8cdb('0x46')]=_0x42343c[_0x8cdb('0x46')][_0x8cdb('0x49')]?_0x42343c[_0x8cdb('0x46')]:_0x4fd16a[_0x8cdb('0x42')];if(!_0x2e2fb8[_0x8cdb('0x43')][_0x8cdb('0x4a')]('nolimit')){_0x42343c[_0x8cdb('0x2d')]=qs['limit'](_0x2e2fb8[_0x8cdb('0x43')][_0x8cdb('0x2d')]);_0x42343c['offset']=qs[_0x8cdb('0x2b')](_0x2e2fb8[_0x8cdb('0x43')][_0x8cdb('0x2b')]);}_0x42343c[_0x8cdb('0x4b')]=qs[_0x8cdb('0x4c')](_0x2e2fb8[_0x8cdb('0x43')]['sort']);_0x42343c[_0x8cdb('0x4d')]=qs[_0x8cdb('0x45')](_[_0x8cdb('0x4e')](_0x2e2fb8[_0x8cdb('0x43')],_0x4fd16a[_0x8cdb('0x45')]),_0xb6d304);if(_0x2e2fb8[_0x8cdb('0x43')]['filter']){_0x42343c[_0x8cdb('0x4d')]=_[_0x8cdb('0x4f')](_0x42343c[_0x8cdb('0x4d')],{'$or':_['map'](_0xb6d304,function(_0x23c38b){if(_0x23c38b[_0x8cdb('0x50')]!==_0x8cdb('0x51')){var _0x326853={};_0x326853[_0x23c38b[_0x8cdb('0x3b')]]={'$like':'%'+_0x2e2fb8['query'][_0x8cdb('0x52')]+'%'};return _0x326853;}})});}_0x42343c=_[_0x8cdb('0x4f')]({},_0x42343c,_0x2e2fb8[_0x8cdb('0x53')]);var _0x100d20={'where':_0x42343c[_0x8cdb('0x4d')]};return db[_0x8cdb('0x40')]['count'](_0x100d20)[_0x8cdb('0x1f')](function(_0x6255bf){_0x4eee7e['count']=_0x6255bf;if(_0x2e2fb8[_0x8cdb('0x43')][_0x8cdb('0x54')]){_0x42343c[_0x8cdb('0x55')]=[{'all':!![]}];}return db[_0x8cdb('0x40')][_0x8cdb('0x56')](_0x42343c);})[_0x8cdb('0x1f')](function(_0xaed6ff){_0x4eee7e[_0x8cdb('0x57')]=_0xaed6ff;return _0x4eee7e;})[_0x8cdb('0x1f')](respondWithFilteredResult(_0x57857b,_0x42343c))['catch'](handleError(_0x57857b,null));};exports[_0x8cdb('0x58')]=function(_0xfdc7c8,_0x5eea43){var _0x2622e2={'raw':![],'where':{'id':_0xfdc7c8[_0x8cdb('0x59')]['id']},'include':[{'model':db[_0x8cdb('0x3e')],'as':'mandatoryDispositionPause'}]},_0x22511a={};_0x22511a['model']=_['keys'](db[_0x8cdb('0x40')][_0x8cdb('0x5a')]);_0x22511a[_0x8cdb('0x43')]=_[_0x8cdb('0x44')](_0xfdc7c8['query']);_0x22511a['filters']=_[_0x8cdb('0x47')](_0x22511a[_0x8cdb('0x42')],_0x22511a['query']);_0x2622e2['attributes']=_[_0x8cdb('0x47')](_0x22511a[_0x8cdb('0x42')],qs['fields'](_0xfdc7c8['query'][_0x8cdb('0x48')]));_0x2622e2[_0x8cdb('0x46')]=_0x2622e2[_0x8cdb('0x46')][_0x8cdb('0x49')]?_0x2622e2[_0x8cdb('0x46')]:_0x22511a[_0x8cdb('0x42')];if(_0xfdc7c8[_0x8cdb('0x43')]['includeAll']){_0x2622e2[_0x8cdb('0x55')]=[{'all':!![]}];}_0x2622e2=_[_0x8cdb('0x4f')]({},_0x2622e2,_0xfdc7c8[_0x8cdb('0x53')]);return db[_0x8cdb('0x40')][_0x8cdb('0x5b')](_0x2622e2)[_0x8cdb('0x1f')](handleEntityNotFound(_0x5eea43,null))[_0x8cdb('0x1f')](respondWithResult(_0x5eea43,null))['catch'](handleError(_0x5eea43,null));};exports['create']=function(_0x3aeb58,_0xe6c224){return db[_0x8cdb('0x40')]['create'](_0x3aeb58['body'],{})[_0x8cdb('0x1f')](function(_0x4bd960){var _0x3b3891=_0x3aeb58[_0x8cdb('0x5c')]['get']({'plain':!![]});if(!_0x3b3891)throw new Error(_0x8cdb('0x5d'));if(_0x3b3891[_0x8cdb('0x5e')]===_0x8cdb('0x5c')){var _0x50d828=_0x4bd960[_0x8cdb('0x36')]({'plain':!![]});var _0xf71fe3=_0x8cdb('0x37');return db[_0x8cdb('0x5f')][_0x8cdb('0x5b')]({'where':{'name':_0xf71fe3,'userProfileId':_0x3b3891[_0x8cdb('0x60')]},'raw':!![]})[_0x8cdb('0x1f')](function(_0x6db4b2){if(_0x6db4b2&&_0x6db4b2[_0x8cdb('0x61')]===0x0){return db[_0x8cdb('0x38')][_0x8cdb('0x62')]({'name':_0x50d828[_0x8cdb('0x3b')],'resourceId':_0x50d828['id'],'type':_0x6db4b2[_0x8cdb('0x3b')],'sectionId':_0x6db4b2['id']},{})['then'](function(){return _0x4bd960;});}else{return _0x4bd960;}})[_0x8cdb('0x28')](function(_0x2a1781){logger[_0x8cdb('0x25')](_0x8cdb('0x63'),_0x2a1781);throw _0x2a1781;});}return _0x4bd960;})[_0x8cdb('0x1f')](respondWithResult(_0xe6c224,0xc9))[_0x8cdb('0x28')](handleError(_0xe6c224,null));};exports['update']=function(_0x30d068,_0x10d01a){if(_0x30d068['body']['id']){delete _0x30d068[_0x8cdb('0x64')]['id'];}return db[_0x8cdb('0x40')][_0x8cdb('0x5b')]({'where':{'id':_0x30d068[_0x8cdb('0x59')]['id']},'include':[{'model':db[_0x8cdb('0x3e')],'as':_0x8cdb('0x3f')}]})[_0x8cdb('0x1f')](handleEntityNotFound(_0x10d01a,null))[_0x8cdb('0x1f')](saveUpdates(_0x30d068['body'],null))[_0x8cdb('0x1f')](respondWithResult(_0x10d01a,null))[_0x8cdb('0x28')](handleError(_0x10d01a,null));};exports[_0x8cdb('0x39')]=function(_0x59d2ed,_0x37ebf4){return db[_0x8cdb('0x40')][_0x8cdb('0x5b')]({'where':{'id':_0x59d2ed[_0x8cdb('0x59')]['id']}})[_0x8cdb('0x1f')](handleEntityNotFound(_0x37ebf4,null))[_0x8cdb('0x1f')](removeEntity(_0x37ebf4,null))[_0x8cdb('0x28')](handleError(_0x37ebf4,null));};exports['describe']=function(_0x2fe166,_0x46f705){return db[_0x8cdb('0x40')][_0x8cdb('0x65')]()[_0x8cdb('0x1f')](respondWithResult(_0x46f705,null))[_0x8cdb('0x28')](handleError(_0x46f705,null));};exports[_0x8cdb('0x66')]=function(_0xf1f3bd,_0x4d2f7c,_0x77e7bc){if(_0xf1f3bd[_0x8cdb('0x64')]['id']){delete _0xf1f3bd[_0x8cdb('0x64')]['id'];}return db[_0x8cdb('0x40')][_0x8cdb('0x5b')]({'where':{'id':_0xf1f3bd['params']['id']}})[_0x8cdb('0x1f')](handleEntityNotFound(_0x4d2f7c,null))[_0x8cdb('0x1f')](function(_0x147cc4){if(_0x147cc4){_0xf1f3bd[_0x8cdb('0x64')][_0x8cdb('0x67')]=_0x147cc4['id'];return db[_0x8cdb('0x68')][_0x8cdb('0x62')](_0xf1f3bd[_0x8cdb('0x64')]);}})[_0x8cdb('0x1f')](respondWithResult(_0x4d2f7c,null))[_0x8cdb('0x28')](handleError(_0x4d2f7c,null));};exports[_0x8cdb('0x69')]=function(_0x3bac6f,_0x868d10,_0x2f99a7){var _0x1dd38d={'raw':![],'where':{}};var _0x3e55dc={};var _0x5de64e={'count':0x0,'rows':[]};return db[_0x8cdb('0x40')][_0x8cdb('0x6a')]({'where':{'id':_0x3bac6f[_0x8cdb('0x59')]['id']}})[_0x8cdb('0x1f')](handleEntityNotFound(_0x868d10,null))[_0x8cdb('0x1f')](function(_0x36ab04){if(_0x36ab04){_0x3e55dc[_0x8cdb('0x42')]=_[_0x8cdb('0x44')](db[_0x8cdb('0x68')]['rawAttributes']);_0x3e55dc[_0x8cdb('0x43')]=_['keys'](_0x3bac6f['query']);_0x3e55dc[_0x8cdb('0x45')]=_[_0x8cdb('0x47')](_0x3e55dc[_0x8cdb('0x42')],_0x3e55dc[_0x8cdb('0x43')]);_0x1dd38d[_0x8cdb('0x46')]=_['intersection'](_0x3e55dc[_0x8cdb('0x42')],qs[_0x8cdb('0x48')](_0x3bac6f[_0x8cdb('0x43')][_0x8cdb('0x48')]));_0x1dd38d[_0x8cdb('0x46')]=_0x1dd38d[_0x8cdb('0x46')][_0x8cdb('0x49')]?_0x1dd38d[_0x8cdb('0x46')]:_0x3e55dc[_0x8cdb('0x42')];if(!_0x3bac6f[_0x8cdb('0x43')][_0x8cdb('0x4a')](_0x8cdb('0x6b'))){_0x1dd38d[_0x8cdb('0x2d')]=qs[_0x8cdb('0x2d')](_0x3bac6f[_0x8cdb('0x43')][_0x8cdb('0x2d')]);_0x1dd38d['offset']=qs['offset'](_0x3bac6f['query'][_0x8cdb('0x2b')]);}_0x1dd38d[_0x8cdb('0x4b')]=qs[_0x8cdb('0x4c')](_0x3bac6f[_0x8cdb('0x43')][_0x8cdb('0x4c')]);_0x1dd38d['where']=qs[_0x8cdb('0x45')](_['pick'](_0x3bac6f['query'],_0x3e55dc[_0x8cdb('0x45')]));_0x1dd38d[_0x8cdb('0x4d')][_0x8cdb('0x67')]=_0x36ab04['id'];if(_0x3bac6f[_0x8cdb('0x43')]['filter']){_0x1dd38d['where']=_['merge'](_0x1dd38d[_0x8cdb('0x4d')],{'$or':_[_0x8cdb('0x6c')](_0x1dd38d[_0x8cdb('0x46')],function(_0x9b8a54){var _0x1e02b2={};_0x1e02b2[_0x9b8a54]={'$like':'%'+_0x3bac6f[_0x8cdb('0x43')]['filter']+'%'};return _0x1e02b2;})});}_0x1dd38d=_[_0x8cdb('0x4f')]({},_0x1dd38d,_0x3bac6f[_0x8cdb('0x53')]);return db[_0x8cdb('0x68')][_0x8cdb('0x2e')]({'where':_0x1dd38d['where']})['then'](function(_0xffdfe1){_0x5de64e[_0x8cdb('0x2e')]=_0xffdfe1;if(_0x3bac6f['query'][_0x8cdb('0x54')]){_0x1dd38d[_0x8cdb('0x55')]=[{'all':!![]}];}return db[_0x8cdb('0x68')]['findAll'](_0x1dd38d);})['then'](function(_0x55e109){_0x5de64e['rows']=_0x55e109;return _0x5de64e;});}})[_0x8cdb('0x1f')](respondWithFilteredResult(_0x868d10,_0x1dd38d))[_0x8cdb('0x28')](handleError(_0x868d10,null));};exports[_0x8cdb('0x6d')]=function(_0x5baf5c,_0x49a497,_0xd1b237){return db[_0x8cdb('0x40')][_0x8cdb('0x5b')]({'where':{'id':_0x5baf5c['params']['id']}})[_0x8cdb('0x1f')](handleEntityNotFound(_0x49a497,null))[_0x8cdb('0x1f')](function(_0x167b69){if(_0x167b69){return _0x167b69['removeDispositions'](_0x5baf5c[_0x8cdb('0x43')][_0x8cdb('0x6e')]);}})[_0x8cdb('0x1f')](respondWithStatusCode(_0x49a497,null))[_0x8cdb('0x28')](handleError(_0x49a497,null));};exports['addAnswer']=function(_0x254adc,_0x4a403e,_0x2992f2){if(_0x254adc[_0x8cdb('0x64')]['id']){delete _0x254adc[_0x8cdb('0x64')]['id'];}return db[_0x8cdb('0x40')][_0x8cdb('0x5b')]({'where':{'id':_0x254adc[_0x8cdb('0x59')]['id']}})[_0x8cdb('0x1f')](handleEntityNotFound(_0x4a403e,null))[_0x8cdb('0x1f')](function(_0x3e5f4e){if(_0x3e5f4e){_0x254adc[_0x8cdb('0x64')][_0x8cdb('0x67')]=_0x3e5f4e['id'];return db['CannedAnswer'][_0x8cdb('0x62')](_0x254adc[_0x8cdb('0x64')]);}})[_0x8cdb('0x1f')](respondWithResult(_0x4a403e,null))[_0x8cdb('0x28')](handleError(_0x4a403e,null));};exports[_0x8cdb('0x6f')]=function(_0x15f1b2,_0x312a40,_0x42e6b8){var _0x482838={'raw':![],'where':{}};var _0x2e9c1e={};var _0x565969={'count':0x0,'rows':[]};return db['FaxAccount'][_0x8cdb('0x6a')]({'where':{'id':_0x15f1b2[_0x8cdb('0x59')]['id']}})[_0x8cdb('0x1f')](handleEntityNotFound(_0x312a40,null))[_0x8cdb('0x1f')](function(_0x37fd43){if(_0x37fd43){_0x2e9c1e[_0x8cdb('0x42')]=_[_0x8cdb('0x44')](db['CannedAnswer'][_0x8cdb('0x5a')]);_0x2e9c1e[_0x8cdb('0x43')]=_['keys'](_0x15f1b2[_0x8cdb('0x43')]);_0x2e9c1e[_0x8cdb('0x45')]=_[_0x8cdb('0x47')](_0x2e9c1e[_0x8cdb('0x42')],_0x2e9c1e[_0x8cdb('0x43')]);_0x482838[_0x8cdb('0x46')]=_[_0x8cdb('0x47')](_0x2e9c1e[_0x8cdb('0x42')],qs[_0x8cdb('0x48')](_0x15f1b2[_0x8cdb('0x43')][_0x8cdb('0x48')]));_0x482838[_0x8cdb('0x46')]=_0x482838[_0x8cdb('0x46')][_0x8cdb('0x49')]?_0x482838[_0x8cdb('0x46')]:_0x2e9c1e[_0x8cdb('0x42')];if(!_0x15f1b2[_0x8cdb('0x43')]['hasOwnProperty']('nolimit')){_0x482838['limit']=qs[_0x8cdb('0x2d')](_0x15f1b2['query'][_0x8cdb('0x2d')]);_0x482838[_0x8cdb('0x2b')]=qs[_0x8cdb('0x2b')](_0x15f1b2['query'][_0x8cdb('0x2b')]);}_0x482838[_0x8cdb('0x4b')]=qs[_0x8cdb('0x4c')](_0x15f1b2['query'][_0x8cdb('0x4c')]);_0x482838[_0x8cdb('0x4d')]=qs[_0x8cdb('0x45')](_[_0x8cdb('0x4e')](_0x15f1b2[_0x8cdb('0x43')],_0x2e9c1e[_0x8cdb('0x45')]));_0x482838[_0x8cdb('0x4d')][_0x8cdb('0x67')]=_0x37fd43['id'];if(_0x15f1b2[_0x8cdb('0x43')][_0x8cdb('0x52')]){_0x482838['where']=_[_0x8cdb('0x4f')](_0x482838[_0x8cdb('0x4d')],{'$or':_[_0x8cdb('0x6c')](_0x482838[_0x8cdb('0x46')],function(_0x26f084){var _0x25f394={};_0x25f394[_0x26f084]={'$like':'%'+_0x15f1b2['query'][_0x8cdb('0x52')]+'%'};return _0x25f394;})});}_0x482838=_[_0x8cdb('0x4f')]({},_0x482838,_0x15f1b2[_0x8cdb('0x53')]);return db[_0x8cdb('0x70')]['count']({'where':_0x482838[_0x8cdb('0x4d')]})['then'](function(_0x45a71c){_0x565969['count']=_0x45a71c;if(_0x15f1b2[_0x8cdb('0x43')][_0x8cdb('0x54')]){_0x482838['include']=[{'all':!![]}];}return db[_0x8cdb('0x70')][_0x8cdb('0x56')](_0x482838);})['then'](function(_0xf141d1){_0x565969['rows']=_0xf141d1;return _0x565969;});}})[_0x8cdb('0x1f')](respondWithFilteredResult(_0x312a40,_0x482838))[_0x8cdb('0x28')](handleError(_0x312a40,null));};exports['removeAnswers']=function(_0x3c4514,_0x4626cd,_0x138dd5){return db['FaxAccount'][_0x8cdb('0x5b')]({'where':{'id':_0x3c4514[_0x8cdb('0x59')]['id']}})['then'](handleEntityNotFound(_0x4626cd,null))[_0x8cdb('0x1f')](function(_0xe8767){if(_0xe8767){return _0xe8767[_0x8cdb('0x71')](_0x3c4514[_0x8cdb('0x43')][_0x8cdb('0x6e')]);}})[_0x8cdb('0x1f')](respondWithStatusCode(_0x4626cd,null))[_0x8cdb('0x28')](handleError(_0x4626cd,null));};exports['addInteraction']=function(_0x1e4eb3,_0x12bcbe,_0x1845a9){return db[_0x8cdb('0x72')][_0x8cdb('0x5b')]({'where':{'id':_0x1e4eb3[_0x8cdb('0x59')]['id']}})['then'](handleEntityNotFound(_0x12bcbe,null))[_0x8cdb('0x1f')](function(_0x4f3bc4){if(_0x4f3bc4){return _0x4f3bc4[_0x8cdb('0x73')](_0x1e4eb3[_0x8cdb('0x64')][_0x8cdb('0x6e')],_['omit'](_0x1e4eb3[_0x8cdb('0x64')],['ids','id'])||{});}})[_0x8cdb('0x1f')](respondWithResult(_0x12bcbe,null))[_0x8cdb('0x28')](handleError(_0x12bcbe,null));};exports[_0x8cdb('0x74')]=function(_0x1559fd,_0x27d277,_0x49d32b){var _0x3cf139={'raw':![],'where':{}};var _0x49f622={};var _0x160cb0={'count':0x0,'rows':[]};return db[_0x8cdb('0x40')]['findOne']({'where':{'id':_0x1559fd[_0x8cdb('0x59')]['id']}})[_0x8cdb('0x1f')](handleEntityNotFound(_0x27d277,null))['then'](function(_0x3d4b2d){if(_0x3d4b2d){_0x49f622['model']=_[_0x8cdb('0x44')](db[_0x8cdb('0x72')][_0x8cdb('0x5a')]);_0x49f622[_0x8cdb('0x43')]=_[_0x8cdb('0x44')](_0x1559fd['query']);_0x49f622[_0x8cdb('0x45')]=_[_0x8cdb('0x47')](_0x49f622['model'],_0x49f622[_0x8cdb('0x43')]);_0x3cf139[_0x8cdb('0x46')]=_['intersection'](_0x49f622['model'],qs['fields'](_0x1559fd['query']['fields']));_0x3cf139['attributes']=_0x3cf139['attributes'][_0x8cdb('0x49')]?_0x3cf139[_0x8cdb('0x46')]:_0x49f622[_0x8cdb('0x42')];if(!_0x1559fd[_0x8cdb('0x43')][_0x8cdb('0x4a')]('nolimit')){_0x3cf139[_0x8cdb('0x2d')]=qs[_0x8cdb('0x2d')](_0x1559fd[_0x8cdb('0x43')]['limit']);_0x3cf139[_0x8cdb('0x2b')]=qs[_0x8cdb('0x2b')](_0x1559fd['query']['offset']);}_0x3cf139[_0x8cdb('0x4b')]=qs[_0x8cdb('0x4c')](_0x1559fd[_0x8cdb('0x43')][_0x8cdb('0x4c')]);_0x3cf139['where']=qs[_0x8cdb('0x45')](_[_0x8cdb('0x4e')](_0x1559fd['query'],_0x49f622['filters']));_0x3cf139[_0x8cdb('0x4d')]['FaxAccountId']=_0x3d4b2d['id'];if(_0x1559fd[_0x8cdb('0x43')][_0x8cdb('0x52')]){_0x3cf139[_0x8cdb('0x4d')]=_[_0x8cdb('0x4f')](_0x3cf139[_0x8cdb('0x4d')],{'$or':_[_0x8cdb('0x6c')](_0x3cf139[_0x8cdb('0x46')],function(_0x535f94){var _0x4451bb={};_0x4451bb[_0x535f94]={'$like':'%'+_0x1559fd[_0x8cdb('0x43')][_0x8cdb('0x52')]+'%'};return _0x4451bb;})});}_0x3cf139=_[_0x8cdb('0x4f')]({},_0x3cf139,_0x1559fd[_0x8cdb('0x53')]);return db['FaxInteraction'][_0x8cdb('0x2e')]({'where':_0x3cf139[_0x8cdb('0x4d')]})[_0x8cdb('0x1f')](function(_0x2c805a){_0x160cb0[_0x8cdb('0x2e')]=_0x2c805a;if(_0x1559fd[_0x8cdb('0x43')][_0x8cdb('0x54')]){_0x3cf139[_0x8cdb('0x55')]=[{'model':db[_0x8cdb('0x75')],'as':_0x8cdb('0x76'),'required':![]},{'model':db[_0x8cdb('0x77')],'as':_0x8cdb('0x78'),'attributes':[_0x8cdb('0x3b'),'fullname',_0x8cdb('0x79')],'required':![]},{'model':db[_0x8cdb('0x7a')],'as':_0x8cdb('0x7b'),'attributes':['id',_0x8cdb('0x3b'),_0x8cdb('0x7c')],'where':_0x1559fd[_0x8cdb('0x43')][_0x8cdb('0x7d')]?{'id':_0x1559fd[_0x8cdb('0x43')]['tag']}:undefined,'required':_0x1559fd[_0x8cdb('0x43')][_0x8cdb('0x7d')]?!![]:![]}];}return db[_0x8cdb('0x72')]['findAll'](_0x3cf139);})[_0x8cdb('0x1f')](function(_0x551783){_0x160cb0[_0x8cdb('0x57')]=_0x551783;return _0x160cb0;});}})[_0x8cdb('0x1f')](respondWithFilteredResult(_0x27d277,_0x3cf139))['catch'](handleError(_0x27d277,null));};exports[_0x8cdb('0x7e')]=function(_0x30c08b,_0x1a062d){var _0x50cb61=_0x30c08b[_0x8cdb('0x59')]['id'];var _0x8507c9=_0x30c08b[_0x8cdb('0x64')];var _0x52e4f3=0xc8;var _0x360551=null;return db['sequelize'][_0x8cdb('0x7f')]({'isolationLevel':db['sequelize']['Transaction'][_0x8cdb('0x80')][_0x8cdb('0x81')]},function(_0x3a022c){return db[_0x8cdb('0x40')][_0x8cdb('0x6a')]({'where':{'id':_0x50cb61},'transaction':_0x3a022c})[_0x8cdb('0x1f')](function(_0x35e901){if(_0x35e901){return db[_0x8cdb('0x82')]['destroy']({'where':{'FaxAccountId':_0x50cb61},'transaction':_0x3a022c})[_0x8cdb('0x1f')](function(){var _0x44f2f2=_[_0x8cdb('0x6c')](_0x8507c9,function(_0x3d0985){_0x3d0985[_0x8cdb('0x67')]=_0x50cb61;return _0x3d0985;});return db['FaxApplication']['bulkCreate'](_0x44f2f2,{'transaction':_0x3a022c});});}else{_0x52e4f3=0x194;_0x360551=[];}});})[_0x8cdb('0x1f')](function(){if(_0x52e4f3!==0x194){return db['FaxApplication'][_0x8cdb('0x83')]({'where':{'FaxAccountId':_0x50cb61},'order':'priority'})['then'](function(_0x1ca72b){_0x360551=_0x1ca72b;});}})[_0x8cdb('0x28')](function(_0xbfd3eb){_0x52e4f3=0x1f4;logger[_0x8cdb('0x25')](_0xbfd3eb['stack']);if(_0xbfd3eb['name']){delete _0xbfd3eb[_0x8cdb('0x3b')];}_0x360551=_0xbfd3eb;})[_0x8cdb('0x84')](function(){if(_0x360551===null){_0x1a062d[_0x8cdb('0x85')](_0x52e4f3);}else{if(_0x52e4f3===0x1f4){_0x1a062d['status'](_0x52e4f3)['send'](_0x360551);}else{_0x1a062d[_0x8cdb('0x29')](_0x52e4f3)[_0x8cdb('0x31')](_0x360551);}}});};exports['getApplications']=function(_0x14ff6b,_0x3dd986,_0x507493){var _0x374411={};var _0x4e3245={};var _0x66e672;var _0x18c27f;return db[_0x8cdb('0x40')]['findOne']({'where':{'id':_0x14ff6b[_0x8cdb('0x59')]['id']}})['then'](handleEntityNotFound(_0x3dd986,null))[_0x8cdb('0x1f')](function(_0x1b3759){if(_0x1b3759){_0x66e672=_0x1b3759;_0x4e3245[_0x8cdb('0x42')]=_[_0x8cdb('0x44')](db[_0x8cdb('0x82')][_0x8cdb('0x5a')]);_0x4e3245[_0x8cdb('0x43')]=_[_0x8cdb('0x44')](_0x14ff6b['query']);_0x4e3245['filters']=_[_0x8cdb('0x47')](_0x4e3245[_0x8cdb('0x42')],_0x4e3245[_0x8cdb('0x43')]);_0x374411['attributes']=_[_0x8cdb('0x47')](_0x4e3245[_0x8cdb('0x42')],qs['fields'](_0x14ff6b[_0x8cdb('0x43')][_0x8cdb('0x48')]));_0x374411[_0x8cdb('0x46')]=_0x374411[_0x8cdb('0x46')][_0x8cdb('0x49')]?_0x374411['attributes']:_0x4e3245[_0x8cdb('0x42')];_0x374411[_0x8cdb('0x4b')]=qs[_0x8cdb('0x4c')](_0x14ff6b['query'][_0x8cdb('0x4c')]);_0x374411[_0x8cdb('0x4d')]=qs[_0x8cdb('0x45')](_[_0x8cdb('0x4e')](_0x14ff6b[_0x8cdb('0x43')],_0x4e3245[_0x8cdb('0x45')]));if(_0x14ff6b[_0x8cdb('0x43')][_0x8cdb('0x52')]){_0x374411[_0x8cdb('0x4d')]=_[_0x8cdb('0x4f')](_0x374411[_0x8cdb('0x4d')],{'$or':_[_0x8cdb('0x6c')](_0x374411[_0x8cdb('0x46')],function(_0x2b681b){var _0x3545eb={};_0x3545eb[_0x2b681b]={'$like':'%'+_0x14ff6b[_0x8cdb('0x43')]['filter']+'%'};return _0x3545eb;})});}_0x374411=_['merge']({},_0x374411,_0x14ff6b[_0x8cdb('0x53')]);return _0x66e672['getApplications'](_0x374411);}})['then'](function(_0x36a3a7){if(_0x36a3a7){_0x18c27f=_0x36a3a7[_0x8cdb('0x49')];if(!_0x14ff6b['query'][_0x8cdb('0x4a')](_0x8cdb('0x6b'))){_0x374411[_0x8cdb('0x2d')]=qs[_0x8cdb('0x2d')](_0x14ff6b[_0x8cdb('0x43')][_0x8cdb('0x2d')]);_0x374411[_0x8cdb('0x2b')]=qs[_0x8cdb('0x2b')](_0x14ff6b[_0x8cdb('0x43')][_0x8cdb('0x2b')]);}return _0x66e672['getApplications'](_0x374411);}})[_0x8cdb('0x1f')](function(_0x1f527e){if(_0x1f527e){return _0x1f527e?{'count':_0x18c27f,'rows':_0x1f527e}:null;}})['then'](respondWithResult(_0x3dd986,null))[_0x8cdb('0x28')](handleError(_0x3dd986,null));};function Extension(_0x5c5596,_0x301152,_0x402fd9,_0x25c620){this[_0x8cdb('0x86')]='from-voip-provider';this[_0x8cdb('0x87')]=_0x5c5596[_0x8cdb('0x88')];this[_0x8cdb('0x89')]=_0x25c620;this['type']=_0x8cdb('0x8a');this['description']='Fax\x20Extension';this[_0x8cdb('0x67')]=_0x5c5596['id'];this[_0x8cdb('0x8b')]=_0x301152;this[_0x8cdb('0x8c')]=_0x402fd9;}function createExtensionsReciveFax(_0x5e1ee9){var _0x2dcad3=0x1;var _0x303d58=[];_0x303d58[_0x8cdb('0x8d')](new Extension(_0x5e1ee9,_0x2dcad3,'',_0x8cdb('0x8e')));_0x2dcad3+=0x1;_0x303d58[_0x8cdb('0x8d')](new Extension(_0x5e1ee9,_0x2dcad3,_0x8cdb('0x8f'),_0x8cdb('0x90')));_0x2dcad3+=0x1;for(var _0x10209f in _0x5e1ee9){if(_0x5e1ee9[_0x8cdb('0x4a')](_0x10209f)&&(_0x10209f===_0x8cdb('0x91')||_0x10209f==='localstationid'||_0x10209f===_0x8cdb('0x92')||_0x10209f==='faxdetect'||_0x10209f===_0x8cdb('0x93')||_0x10209f===_0x8cdb('0x94')||_0x10209f===_0x8cdb('0x95')||_0x10209f===_0x8cdb('0x96')||_0x10209f===_0x8cdb('0x97'))){_0x303d58[_0x8cdb('0x8d')](new Extension(_0x5e1ee9,_0x2dcad3,_0x8cdb('0x98')+_0x10209f+')='+_0x5e1ee9[_0x10209f],'Set'));_0x2dcad3+=0x1;}}_0x303d58['push'](new Extension(_0x5e1ee9,_0x2dcad3,'6',_0x8cdb('0x99')));_0x2dcad3+=0x1;_0x303d58[_0x8cdb('0x8d')](new Extension(_0x5e1ee9,_0x2dcad3,'/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'));_0x2dcad3=0x0;return _0x303d58;}exports['addAccountApplications']=function(_0x4f6ba4,_0x8466bf,_0x47f096){var _0x533ee;return db['sequelize'][_0x8cdb('0x7f')](function(_0x22daf1){return db[_0x8cdb('0x40')][_0x8cdb('0x62')](_0x4f6ba4[_0x8cdb('0x64')],{'transaction':_0x22daf1})['then'](function(_0x2ff5af){_0x533ee=_0x2ff5af[_0x8cdb('0x36')]({'plain':!![]});return db[_0x8cdb('0x9a')][_0x8cdb('0x9b')](createExtensionsReciveFax(_0x533ee),{'transaction':_0x22daf1});});})[_0x8cdb('0x1f')](function(){return _0x533ee;})[_0x8cdb('0x1f')](respondWithResult(_0x8466bf,null))['catch'](handleError(_0x8466bf,null));};exports['updateAccountApplications']=function(_0x10adec,_0x38cbbc,_0x16b68d){var _0x4f8624;return db[_0x8cdb('0x9c')][_0x8cdb('0x7f')](function(_0x25d461){return db['FaxAccount'][_0x8cdb('0x35')](_0x10adec[_0x8cdb('0x64')],{'where':{'id':_0x10adec[_0x8cdb('0x64')]['id']},'transaction':_0x25d461})['then'](function(_0x2d235e){return db[_0x8cdb('0x9a')][_0x8cdb('0x39')]({'where':{'FaxAccountId':_0x10adec[_0x8cdb('0x64')]['id']},'transaction':_0x25d461})[_0x8cdb('0x1f')](function(_0xae71cd){return db['VoiceExtension'][_0x8cdb('0x9b')](createExtensionsReciveFax(_[_0x8cdb('0x9d')](_0x10adec['body'],[_0x8cdb('0x9e'),'key','createdAt',_0x8cdb('0x9f'),_0x8cdb('0xa0'),'ListId'])),{'transaction':_0x25d461});});});})[_0x8cdb('0x1f')](function(){return db[_0x8cdb('0x40')][_0x8cdb('0xa1')](_0x10adec[_0x8cdb('0x64')]['id']);})['then'](respondWithResult(_0x38cbbc,null))[_0x8cdb('0x28')](handleError(_0x38cbbc,null));};exports[_0x8cdb('0xa2')]=function(_0x1f7c10,_0x3ac127,_0x1813d7){var _0xbf16c0={'raw':!![],'where':{}};var _0x2be3a9={};var _0x4a35f4={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x1f7c10['params']['id']}})['then'](handleEntityNotFound(_0x3ac127,null))[_0x8cdb('0x1f')](function(_0x1efc7d){if(_0x1efc7d){_0x2be3a9[_0x8cdb('0x42')]=_[_0x8cdb('0x44')](db[_0x8cdb('0xa3')][_0x8cdb('0x5a')]);_0x2be3a9['query']=_[_0x8cdb('0x44')](_0x1f7c10[_0x8cdb('0x43')]);_0x2be3a9[_0x8cdb('0x45')]=_[_0x8cdb('0x47')](_0x2be3a9[_0x8cdb('0x42')],_0x2be3a9[_0x8cdb('0x43')]);_0xbf16c0[_0x8cdb('0x46')]=_['intersection'](_0x2be3a9[_0x8cdb('0x42')],qs['fields'](_0x1f7c10[_0x8cdb('0x43')]['fields']));_0xbf16c0[_0x8cdb('0x46')]=_0xbf16c0[_0x8cdb('0x46')][_0x8cdb('0x49')]?_0xbf16c0['attributes']:_0x2be3a9['model'];if(!_0x1f7c10[_0x8cdb('0x43')][_0x8cdb('0x4a')](_0x8cdb('0x6b'))){_0xbf16c0[_0x8cdb('0x2d')]=qs[_0x8cdb('0x2d')](_0x1f7c10[_0x8cdb('0x43')][_0x8cdb('0x2d')]);_0xbf16c0[_0x8cdb('0x2b')]=qs[_0x8cdb('0x2b')](_0x1f7c10[_0x8cdb('0x43')]['offset']);}_0xbf16c0[_0x8cdb('0x4b')]=qs[_0x8cdb('0x4c')](_0x1f7c10['query']['sort']);_0xbf16c0[_0x8cdb('0x4d')]=qs[_0x8cdb('0x45')](_[_0x8cdb('0x4e')](_0x1f7c10[_0x8cdb('0x43')],_0x2be3a9[_0x8cdb('0x45')]));_0xbf16c0['where']['FaxAccountId']=_0x1efc7d['id'];if(_0x1f7c10[_0x8cdb('0x43')]['filter']){_0xbf16c0[_0x8cdb('0x4d')]=_['merge'](_0xbf16c0['where'],{'$or':_[_0x8cdb('0x6c')](_0xbf16c0[_0x8cdb('0x46')],function(_0x32d775){var _0x34e079={};_0x34e079[_0x32d775]={'$like':'%'+_0x1f7c10[_0x8cdb('0x43')][_0x8cdb('0x52')]+'%'};return _0x34e079;})});}if(_0x1f7c10[_0x8cdb('0x43')][_0x8cdb('0xa4')]){var _0xe69f27=_0x1f7c10[_0x8cdb('0x43')]['$gte'][_0x8cdb('0xa5')](',');var _0x5c7510={};_0x5c7510[_0xe69f27[0x0]]={'$gte':moment(_0xe69f27[0x1])[_0x8cdb('0xa6')]('YYYY-MM-DD\x20HH:mm:ss')};_0xbf16c0[_0x8cdb('0x4d')]=_[_0x8cdb('0x4f')](_0xbf16c0[_0x8cdb('0x4d')],_0x5c7510);}_0xbf16c0=_['merge']({},_0xbf16c0,_0x1f7c10[_0x8cdb('0x53')]);return db[_0x8cdb('0xa3')][_0x8cdb('0x2e')]({'where':_0xbf16c0[_0x8cdb('0x4d')]})[_0x8cdb('0x1f')](function(_0x4e4bd4){_0x4a35f4[_0x8cdb('0x2e')]=_0x4e4bd4;if(_0x1f7c10[_0x8cdb('0x43')][_0x8cdb('0x54')]){_0xbf16c0['include']=[{'all':!![]}];}return db[_0x8cdb('0xa3')][_0x8cdb('0x56')](_0xbf16c0);})[_0x8cdb('0x1f')](function(_0x4c7e17){_0x4a35f4[_0x8cdb('0x57')]=_0x4c7e17;return _0x4a35f4;});}})[_0x8cdb('0x1f')](respondWithFilteredResult(_0x3ac127,_0xbf16c0))[_0x8cdb('0x28')](handleError(_0x3ac127,null));};exports[_0x8cdb('0x3c')]=function(_0x292200,_0x2c1195,_0x2a16f2){var _0x150d29,_0x1f2d7e={},_0x7e5088;if(_0x292200['body']['to']){_0x7e5088=_0x292200[_0x8cdb('0x64')]['to'][0x0];}return db[_0x8cdb('0x40')]['find']({'where':{'id':_0x292200[_0x8cdb('0x59')]['id']},'include':[{'model':db[_0x8cdb('0xa7')],'as':_0x8cdb('0xa8'),'include':[{'model':db[_0x8cdb('0x75')],'as':_0x8cdb('0xa9'),'where':{'fax':_0x7e5088},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x8cdb('0x1f')](handleEntityNotFound(_0x2c1195,null))[_0x8cdb('0x1f')](function(_0x3072a7){_0x150d29=_0x3072a7;if(_0x292200[_0x8cdb('0x64')][_0x8cdb('0xaa')]&&_0x292200[_0x8cdb('0x64')]['attachments'][_0x8cdb('0x49')]){for(var _0x278761=0x0;_0x278761<_0x292200[_0x8cdb('0x64')][_0x8cdb('0xaa')][_0x8cdb('0x49')];_0x278761+=0x1){_0x292200[_0x8cdb('0x64')][_0x8cdb('0xaa')][_0x278761]={'filename':_0x292200[_0x8cdb('0x64')][_0x8cdb('0xaa')][_0x278761][_0x8cdb('0x3b')],'id':_0x292200[_0x8cdb('0x64')][_0x8cdb('0xaa')][_0x278761]['id'],'path':path[_0x8cdb('0xab')](config['root'],'server/files/attachments',_0x292200['body'][_0x8cdb('0xaa')][_0x278761]['basename'])};}}return respondWithRpcPromise(_0x8cdb('0xac'),_0x8cdb('0xac'),{'FaxAccountId':_[_0x8cdb('0xad')](_0x292200['params']['id'])?undefined:_0x292200[_0x8cdb('0x59')]['id'],'path':_[_0x8cdb('0xad')](_0x292200['body']['attachments'][0x0]['path'])?undefined:_0x292200[_0x8cdb('0x64')][_0x8cdb('0xaa')][0x0][_0x8cdb('0x7')],'fax':_[_0x8cdb('0xad')](_0x292200[_0x8cdb('0x64')]['to'][0x0])?undefined:_0x292200['body']['to'][0x0]},client9002);})[_0x8cdb('0x1f')](function(){if(_0x150d29){if(_[_0x8cdb('0xad')](_0x292200['body'][_0x8cdb('0xae')])){_0x292200[_0x8cdb('0x64')]['from']=util['format']('\x22%s\x22\x20<%s>',_0x150d29[_0x8cdb('0x3b')],_0x150d29[_0x8cdb('0xaf')]);}if(_0x150d29[_0x8cdb('0xa8')]){if(_0x150d29[_0x8cdb('0xa8')]['Contacts']['length']){return _0x150d29['List']['Contacts'][0x0];}else{return db['CmContact']['create'](_['defaults'](_0x292200[_0x8cdb('0x64')],{'firstName':_0x292200[_0x8cdb('0x64')]['to'][0x0],'phone':_0x292200[_0x8cdb('0x64')]['to'][0x0],'fax':_0x292200[_0x8cdb('0x64')]['to'][0x0],'ListId':_0x150d29[_0x8cdb('0xb0')]}));}}else{throw new Error(_0x8cdb('0xb1'));}}else{throw new Error(_0x8cdb('0xb2'));}})['then'](function(_0x111b94){if(_0x111b94){return db[_0x8cdb('0x72')][_0x8cdb('0x5b')]({'where':{'ContactId':_0x111b94['id'],'closed':![],'FaxAccountId':_0x150d29['id']}})[_0x8cdb('0x1f')](function(_0x3534d8){if(_0x3534d8){return[_0x3534d8,![]];}return db[_0x8cdb('0x72')]['create']({'UserId':_0x292200['user']['id'],'ContactId':_0x111b94['id'],'FaxAccountId':_0x150d29['id'],'fax':_0x292200[_0x8cdb('0x64')]['to'][0x0],'firstMsgDirection':_0x8cdb('0xb3'),'Messages':[_['merge'](_0x292200[_0x8cdb('0x64')],{'read':![],'body':_0x292200[_0x8cdb('0x64')][_0x8cdb('0xaa')][0x0][_0x8cdb('0xb4')],'FaxAccountId':_0x150d29['id'],'UserId':_0x292200[_0x8cdb('0x5c')]['id'],'ContactId':_0x111b94['id'],'AttachmentId':_0x292200[_0x8cdb('0x64')][_0x8cdb('0xaa')][0x0]['id']})]},{'include':[{'model':db[_0x8cdb('0xa3')],'as':_0x8cdb('0xb5')}]})[_0x8cdb('0x1f')](function(_0x5f2b86){return[_0x5f2b86,!![]];});});}else{throw new Error(_0x8cdb('0xb6'));}})[_0x8cdb('0xb7')](function(_0x24ff76,_0x50951e){if(_0x50951e){return _0x24ff76;}return db['FaxMessage']['create']({'direction':_0x8cdb('0xb3'),'read':![],'body':_0x292200[_0x8cdb('0x64')][_0x8cdb('0xaa')][0x0]['filename'],'FaxAccountId':_0x150d29['id'],'FaxInteractionId':_0x24ff76['id'],'UserId':_0x292200[_0x8cdb('0x5c')]['id'],'ContactId':_0x24ff76[_0x8cdb('0xb8')],'AttachmentId':_0x292200[_0x8cdb('0x64')][_0x8cdb('0xaa')][0x0]['id']})[_0x8cdb('0x1f')](function(_0x490f7f){_0x24ff76[_0x8cdb('0xb9')][_0x8cdb('0xb5')]=[];_0x24ff76[_0x8cdb('0xb9')][_0x8cdb('0xb5')]['push'](_0x490f7f[_0x8cdb('0xb9')]);return _0x24ff76;});})[_0x8cdb('0x1f')](function(_0x12c0ec){respondWithRpcPromise(_0x8cdb('0xba'),_0x8cdb('0xba'),{'FaxAccountId':_[_0x8cdb('0xad')](_0x292200[_0x8cdb('0x59')]['id'])?undefined:_0x292200[_0x8cdb('0x59')]['id'],'path':_[_0x8cdb('0xad')](_0x292200[_0x8cdb('0x64')][_0x8cdb('0xaa')][0x0][_0x8cdb('0x7')])?undefined:_0x292200['body'][_0x8cdb('0xaa')][0x0]['path'],'fax':_[_0x8cdb('0xad')](_0x292200[_0x8cdb('0x64')]['to'][0x0])?undefined:_0x292200['body']['to'][0x0],'AttachmentId':_0x292200['body'][_0x8cdb('0xaa')][0x0]['id']},client9002)[_0x8cdb('0x1f')](function(_0x2b6c53){logger[_0x8cdb('0x20')](_0x8cdb('0xbb'),_0x2b6c53);})['catch'](function(_0x4ec2a3){logger[_0x8cdb('0x20')](_0x8cdb('0xbb'),_0x4ec2a3);});return _0x12c0ec;})[_0x8cdb('0x1f')](respondWithResult(_0x2c1195,null))['catch'](handleError(_0x2c1195,null));};exports[_0x8cdb('0xbc')]=function(_0xaf5e79,_0x894ed3,_0x2a3f39){return db['FaxAccount'][_0x8cdb('0x5b')]({'where':{'id':_0xaf5e79[_0x8cdb('0x59')]['id']}})[_0x8cdb('0x1f')](handleEntityNotFound(_0x894ed3,null))['then'](function(_0x7f4d3){if(_0x7f4d3){return _0x7f4d3[_0x8cdb('0xbc')](_0xaf5e79[_0x8cdb('0x64')][_0x8cdb('0x6e')],_[_0x8cdb('0x9d')](_0xaf5e79[_0x8cdb('0x64')],['ids','id'])||{})[_0x8cdb('0xb7')](function(_0x46a85d){for(var _0x45a45f=0x0;_0x45a45f<_0xaf5e79[_0x8cdb('0x64')][_0x8cdb('0x6e')][_0x8cdb('0x49')];_0x45a45f+=0x1){socket[_0x8cdb('0xbd')](_0x8cdb('0xbe'),{'UserId':Number(_0xaf5e79['body']['ids'][_0x45a45f]),'FaxAccountId':Number(_0xaf5e79[_0x8cdb('0x59')]['id'])});}return _0x46a85d;});}})[_0x8cdb('0x1f')](respondWithResult(_0x894ed3,null))[_0x8cdb('0x28')](handleError(_0x894ed3,null));};exports[_0x8cdb('0xbf')]=function(_0x567f7c,_0x4c2699,_0x364fd8){return db[_0x8cdb('0x40')][_0x8cdb('0x5b')]({'where':{'id':_0x567f7c['params']['id']}})[_0x8cdb('0x1f')](handleEntityNotFound(_0x4c2699,null))['then'](function(_0x2832df){if(_0x2832df){return _0x2832df['removeAgents'](_0x567f7c[_0x8cdb('0x43')][_0x8cdb('0x6e')])[_0x8cdb('0x1f')](function(){if(_[_0x8cdb('0xc0')](_0x567f7c[_0x8cdb('0x43')][_0x8cdb('0x6e')])){for(var _0x1c8cf2=0x0;_0x1c8cf2<_0x567f7c[_0x8cdb('0x43')][_0x8cdb('0x6e')]['length'];_0x1c8cf2+=0x1){socket[_0x8cdb('0xbd')](_0x8cdb('0xc1'),{'UserId':Number(_0x567f7c[_0x8cdb('0x43')][_0x8cdb('0x6e')][_0x1c8cf2]),'FaxAccountId':Number(_0x567f7c[_0x8cdb('0x59')]['id'])});}}else{socket[_0x8cdb('0xbd')](_0x8cdb('0xc1'),{'UserId':Number(_0x567f7c[_0x8cdb('0x43')][_0x8cdb('0x6e')]),'FaxAccountId':Number(_0x567f7c[_0x8cdb('0x59')]['id'])});}});}})[_0x8cdb('0x1f')](respondWithStatusCode(_0x4c2699,null))['catch'](handleError(_0x4c2699,null));};exports['getAgents']=function(_0x1468d9,_0x2a3a23,_0x6cc74){var _0x463b92={};var _0x5c565c={};var _0x44bf21;var _0x29d375;return db[_0x8cdb('0x40')]['findOne']({'where':{'id':_0x1468d9['params']['id']}})[_0x8cdb('0x1f')](handleEntityNotFound(_0x2a3a23,null))[_0x8cdb('0x1f')](function(_0x258d61){if(_0x258d61){_0x44bf21=_0x258d61;_0x5c565c[_0x8cdb('0x42')]=_[_0x8cdb('0x44')](db['User'][_0x8cdb('0x5a')]);_0x5c565c[_0x8cdb('0x43')]=_[_0x8cdb('0x44')](_0x1468d9['query']);_0x5c565c[_0x8cdb('0x45')]=_['intersection'](_0x5c565c[_0x8cdb('0x42')],_0x5c565c[_0x8cdb('0x43')]);_0x463b92[_0x8cdb('0x46')]=_[_0x8cdb('0x47')](_0x5c565c[_0x8cdb('0x42')],qs[_0x8cdb('0x48')](_0x1468d9[_0x8cdb('0x43')]['fields']));_0x463b92[_0x8cdb('0x46')]=_0x463b92[_0x8cdb('0x46')][_0x8cdb('0x49')]?_0x463b92[_0x8cdb('0x46')]:_0x5c565c[_0x8cdb('0x42')];_0x463b92[_0x8cdb('0x4b')]=qs['sort'](_0x1468d9[_0x8cdb('0x43')][_0x8cdb('0x4c')]);_0x463b92[_0x8cdb('0x4d')]=qs[_0x8cdb('0x45')](_[_0x8cdb('0x4e')](_0x1468d9[_0x8cdb('0x43')],_0x5c565c['filters']));if(_0x1468d9['query'][_0x8cdb('0x52')]){_0x463b92['where']=_[_0x8cdb('0x4f')](_0x463b92[_0x8cdb('0x4d')],{'$or':_[_0x8cdb('0x6c')](_0x463b92[_0x8cdb('0x46')],function(_0x3a09f8){var _0x4fb441={};_0x4fb441[_0x3a09f8]={'$like':'%'+_0x1468d9[_0x8cdb('0x43')][_0x8cdb('0x52')]+'%'};return _0x4fb441;})});}_0x463b92=_[_0x8cdb('0x4f')]({},_0x463b92,_0x1468d9['options']);return _0x44bf21[_0x8cdb('0xc2')](_0x463b92);}})[_0x8cdb('0x1f')](function(_0x1c4700){if(_0x1c4700){_0x29d375=_0x1c4700[_0x8cdb('0x49')];if(!_0x1468d9['query'][_0x8cdb('0x4a')]('nolimit')){_0x463b92[_0x8cdb('0x2d')]=qs['limit'](_0x1468d9[_0x8cdb('0x43')]['limit']);_0x463b92[_0x8cdb('0x2b')]=qs[_0x8cdb('0x2b')](_0x1468d9[_0x8cdb('0x43')][_0x8cdb('0x2b')]);}return _0x44bf21[_0x8cdb('0xc2')](_0x463b92);}})[_0x8cdb('0x1f')](function(_0x316e94){if(_0x316e94){return _0x316e94?{'count':_0x29d375,'rows':_0x316e94}:null;}})['then'](respondWithResult(_0x2a3a23,null))[_0x8cdb('0x28')](handleError(_0x2a3a23,null));}; \ No newline at end of file +var _0x10ff=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./faxAccount.socket','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','offset','undefined','count','set','json','apply','reject','save','update','destroy','FaxAccounts','UserProfileResource','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','include','findAll','rows','show','filters','options','find','create','body','user','get','UserProfileSection','userProfileId','autoAssociation','params','describe','addDisposition','getDispositions','findOne','FaxAccountId','includeAll','Disposition','removeDispositions','ids','CannedAnswer','getAnswers','hasOwnProperty','merge','removeAnswers','addInteraction','FaxInteraction','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','tag','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','localstationid','type','system','description','appdata','push','CDR(type)=inbound-fax','ecm','gateway','faxdetect','maxrate','minrate','t38timeout','FAXOPT(','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','omit','tech','key','createdAt','updatedAt','ListId','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','Contacts','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x10ff,0xb9));var _0xf10f=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x10ff[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0xf10f('0x0'));var rimraf=require(_0xf10f('0x1'));var zipdir=require(_0xf10f('0x2'));var jsonpatch=require(_0xf10f('0x3'));var rp=require(_0xf10f('0x4'));var moment=require(_0xf10f('0x5'));var BPromise=require(_0xf10f('0x6'));var Mustache=require(_0xf10f('0x7'));var util=require('util');var path=require(_0xf10f('0x8'));var sox=require(_0xf10f('0x9'));var csv=require(_0xf10f('0xa'));var ejs=require(_0xf10f('0xb'));var fs=require('fs');var fs_extra=require(_0xf10f('0xc'));var _=require(_0xf10f('0xd'));var squel=require(_0xf10f('0xe'));var crypto=require(_0xf10f('0xf'));var jsforce=require(_0xf10f('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf10f('0x11'));var Papa=require(_0xf10f('0x12'));var Redis=require(_0xf10f('0x13'));var authService=require(_0xf10f('0x14'));var qs=require(_0xf10f('0x15'));var as=require(_0xf10f('0x16'));var hardwareService=require(_0xf10f('0x17'));var logger=require(_0xf10f('0x18'))('api');var utils=require(_0xf10f('0x19'));var config=require(_0xf10f('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xf10f('0x1b')]=_['defaults'](config[_0xf10f('0x1b')],{'host':_0xf10f('0x1c'),'port':0x18eb});var socket=require(_0xf10f('0x1d'))(new Redis(config['redis']));require(_0xf10f('0x1e'))['register'](socket);var jayson=require(_0xf10f('0x1f'));var client=jayson[_0xf10f('0x20')][_0xf10f('0x21')]({'port':0x232c});var client9002=jayson[_0xf10f('0x20')][_0xf10f('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x24c61c,_0x5ec9f7,_0x1a766a,_0x176b22){return new BPromise(function(_0x239072,_0x2272cf){var _0x32aed4=_0x176b22||client;return _0x32aed4[_0xf10f('0x22')](_0x24c61c,_0x1a766a)[_0xf10f('0x23')](function(_0x11e993){logger[_0xf10f('0x24')](_0xf10f('0x25'),_0x5ec9f7,_0xf10f('0x26'));logger[_0xf10f('0x27')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x5ec9f7,'request\x20sent',JSON[_0xf10f('0x28')](_0x11e993));if(_0x11e993[_0xf10f('0x29')]){if(_0x11e993[_0xf10f('0x29')][_0xf10f('0x2a')]===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x5ec9f7,_0x11e993[_0xf10f('0x29')][_0xf10f('0x2b')]);return _0x2272cf(_0x11e993['error'][_0xf10f('0x2b')]);}logger[_0xf10f('0x29')](_0xf10f('0x25'),_0x5ec9f7,_0x11e993[_0xf10f('0x29')][_0xf10f('0x2b')]);return _0x239072(_0x11e993[_0xf10f('0x29')][_0xf10f('0x2b')]);}else{logger[_0xf10f('0x24')]('FaxAccount,\x20%s,\x20%s',_0x5ec9f7,_0xf10f('0x26'));_0x239072(_0x11e993[_0xf10f('0x2c')][_0xf10f('0x2b')]);}})[_0xf10f('0x2d')](function(_0x304246){logger[_0xf10f('0x29')]('FaxAccount,\x20%s,\x20%s',_0x5ec9f7,_0x304246);_0x2272cf(_0x304246);});});}function respondWithStatusCode(_0x5cda0a,_0x2ba18b){_0x2ba18b=_0x2ba18b||0xcc;return function(_0x3a6142){if(_0x3a6142){return _0x5cda0a[_0xf10f('0x2e')](_0x2ba18b);}return _0x5cda0a[_0xf10f('0x2f')](_0x2ba18b)['end']();};}function respondWithResult(_0x48b1f2,_0x188c7c){_0x188c7c=_0x188c7c||0xc8;return function(_0x26a122){if(_0x26a122){return _0x48b1f2[_0xf10f('0x2f')](_0x188c7c)['json'](_0x26a122);}};}function respondWithFilteredResult(_0x51fc56,_0x15272c){return function(_0x10444b){if(_0x10444b){var _0x482024=typeof _0x15272c[_0xf10f('0x30')]===_0xf10f('0x31')&&typeof _0x15272c['limit']===_0xf10f('0x31');var _0x19e21e=_0x10444b[_0xf10f('0x32')];var _0x477cc1=_0x482024?0x0:_0x15272c['offset'];var _0x2c632b=_0x482024?_0x10444b[_0xf10f('0x32')]:_0x15272c[_0xf10f('0x30')]+_0x15272c['limit'];var _0x34893b;if(_0x2c632b>=_0x19e21e){_0x2c632b=_0x19e21e;_0x34893b=0xc8;}else{_0x34893b=0xce;}_0x51fc56[_0xf10f('0x2f')](_0x34893b);return _0x51fc56[_0xf10f('0x33')]('Content-Range',_0x477cc1+'-'+_0x2c632b+'/'+_0x19e21e)[_0xf10f('0x34')](_0x10444b);}return null;};}function patchUpdates(_0x118359){return function(_0x2d876b){try{jsonpatch[_0xf10f('0x35')](_0x2d876b,_0x118359,!![]);}catch(_0x157f60){return BPromise[_0xf10f('0x36')](_0x157f60);}return _0x2d876b[_0xf10f('0x37')]();};}function saveUpdates(_0x289593,_0x2b9215){return function(_0x1a0115){if(_0x1a0115){return _0x1a0115[_0xf10f('0x38')](_0x289593)['then'](function(_0x3fbd8c){return _0x3fbd8c;});}return null;};}function removeEntity(_0x2d0979,_0x4c30ca){return function(_0x3b5854){if(_0x3b5854){return _0x3b5854[_0xf10f('0x39')]()[_0xf10f('0x23')](function(){var _0x4b61c6=_0x3b5854['get']({'plain':!![]});var _0x39cf27=_0xf10f('0x3a');return db[_0xf10f('0x3b')][_0xf10f('0x39')]({'where':{'type':_0x39cf27,'resourceId':_0x4b61c6['id']}})[_0xf10f('0x23')](function(){return _0x3b5854;});})[_0xf10f('0x23')](function(){_0x2d0979[_0xf10f('0x2f')](0xcc)[_0xf10f('0x3c')]();});}};}function handleEntityNotFound(_0x4fd8f4,_0x48d93a){return function(_0x51ce12){if(!_0x51ce12){_0x4fd8f4['sendStatus'](0x194);}return _0x51ce12;};}function handleError(_0x1f140d,_0x1615dd){_0x1615dd=_0x1615dd||0x1f4;return function(_0x31c905){logger['error'](_0x31c905[_0xf10f('0x3d')]);if(_0x31c905['name']){delete _0x31c905[_0xf10f('0x3e')];}_0x1f140d[_0xf10f('0x2f')](_0x1615dd)[_0xf10f('0x3f')](_0x31c905);};}exports[_0xf10f('0x40')]=function(_0xba4fa,_0x22f951){var _0x3d6e7e={'include':[{'model':db[_0xf10f('0x41')],'as':_0xf10f('0x42')}]},_0x123077={},_0x1d6538={'count':0x0,'rows':[]};var _0x2ec59c=_[_0xf10f('0x43')](db[_0xf10f('0x44')][_0xf10f('0x45')],function(_0x2cee8b){return{'name':_0x2cee8b[_0xf10f('0x46')],'type':_0x2cee8b['type']['key']};});_0x123077[_0xf10f('0x47')]=_[_0xf10f('0x43')](_0x2ec59c,_0xf10f('0x3e'));_0x123077[_0xf10f('0x48')]=_[_0xf10f('0x49')](_0xba4fa[_0xf10f('0x48')]);_0x123077['filters']=_[_0xf10f('0x4a')](_0x123077[_0xf10f('0x47')],_0x123077[_0xf10f('0x48')]);_0x3d6e7e[_0xf10f('0x4b')]=_[_0xf10f('0x4a')](_0x123077[_0xf10f('0x47')],qs[_0xf10f('0x4c')](_0xba4fa[_0xf10f('0x48')]['fields']));_0x3d6e7e[_0xf10f('0x4b')]=_0x3d6e7e[_0xf10f('0x4b')][_0xf10f('0x4d')]?_0x3d6e7e[_0xf10f('0x4b')]:_0x123077[_0xf10f('0x47')];if(!_0xba4fa[_0xf10f('0x48')]['hasOwnProperty'](_0xf10f('0x4e'))){_0x3d6e7e[_0xf10f('0x4f')]=qs[_0xf10f('0x4f')](_0xba4fa[_0xf10f('0x48')]['limit']);_0x3d6e7e['offset']=qs['offset'](_0xba4fa['query'][_0xf10f('0x30')]);}_0x3d6e7e[_0xf10f('0x50')]=qs[_0xf10f('0x51')](_0xba4fa['query'][_0xf10f('0x51')]);_0x3d6e7e[_0xf10f('0x52')]=qs['filters'](_[_0xf10f('0x53')](_0xba4fa[_0xf10f('0x48')],_0x123077['filters']),_0x2ec59c);if(_0xba4fa[_0xf10f('0x48')][_0xf10f('0x54')]){_0x3d6e7e[_0xf10f('0x52')]=_['merge'](_0x3d6e7e[_0xf10f('0x52')],{'$or':_['map'](_0x2ec59c,function(_0x292bef){if(_0x292bef['type']!==_0xf10f('0x55')){var _0x4e3f91={};_0x4e3f91[_0x292bef[_0xf10f('0x3e')]]={'$like':'%'+_0xba4fa[_0xf10f('0x48')][_0xf10f('0x54')]+'%'};return _0x4e3f91;}})});}_0x3d6e7e=_['merge']({},_0x3d6e7e,_0xba4fa['options']);var _0x429390={'where':_0x3d6e7e[_0xf10f('0x52')]};return db[_0xf10f('0x44')]['count'](_0x429390)['then'](function(_0x3a4b7b){_0x1d6538[_0xf10f('0x32')]=_0x3a4b7b;if(_0xba4fa[_0xf10f('0x48')]['includeAll']){_0x3d6e7e[_0xf10f('0x56')]=[{'all':!![]}];}return db[_0xf10f('0x44')][_0xf10f('0x57')](_0x3d6e7e);})['then'](function(_0x37001f){_0x1d6538[_0xf10f('0x58')]=_0x37001f;return _0x1d6538;})[_0xf10f('0x23')](respondWithFilteredResult(_0x22f951,_0x3d6e7e))[_0xf10f('0x2d')](handleError(_0x22f951,null));};exports[_0xf10f('0x59')]=function(_0x51dd2f,_0x4c640d){var _0x5b48cc={'raw':![],'where':{'id':_0x51dd2f['params']['id']},'include':[{'model':db[_0xf10f('0x41')],'as':'mandatoryDispositionPause'}]},_0x282711={};_0x282711[_0xf10f('0x47')]=_[_0xf10f('0x49')](db[_0xf10f('0x44')][_0xf10f('0x45')]);_0x282711['query']=_[_0xf10f('0x49')](_0x51dd2f[_0xf10f('0x48')]);_0x282711[_0xf10f('0x5a')]=_[_0xf10f('0x4a')](_0x282711[_0xf10f('0x47')],_0x282711[_0xf10f('0x48')]);_0x5b48cc[_0xf10f('0x4b')]=_['intersection'](_0x282711[_0xf10f('0x47')],qs['fields'](_0x51dd2f[_0xf10f('0x48')][_0xf10f('0x4c')]));_0x5b48cc[_0xf10f('0x4b')]=_0x5b48cc[_0xf10f('0x4b')]['length']?_0x5b48cc[_0xf10f('0x4b')]:_0x282711[_0xf10f('0x47')];if(_0x51dd2f['query']['includeAll']){_0x5b48cc[_0xf10f('0x56')]=[{'all':!![]}];}_0x5b48cc=_['merge']({},_0x5b48cc,_0x51dd2f[_0xf10f('0x5b')]);return db[_0xf10f('0x44')][_0xf10f('0x5c')](_0x5b48cc)[_0xf10f('0x23')](handleEntityNotFound(_0x4c640d,null))[_0xf10f('0x23')](respondWithResult(_0x4c640d,null))['catch'](handleError(_0x4c640d,null));};exports['create']=function(_0x623ea1,_0x4d14fa){return db[_0xf10f('0x44')][_0xf10f('0x5d')](_0x623ea1[_0xf10f('0x5e')],{})[_0xf10f('0x23')](function(_0x2e5761){var _0x314c3e=_0x623ea1[_0xf10f('0x5f')]['get']({'plain':!![]});if(!_0x314c3e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x314c3e['role']==='user'){var _0x505838=_0x2e5761[_0xf10f('0x60')]({'plain':!![]});var _0x3c8016=_0xf10f('0x3a');return db[_0xf10f('0x61')][_0xf10f('0x5c')]({'where':{'name':_0x3c8016,'userProfileId':_0x314c3e[_0xf10f('0x62')]},'raw':!![]})['then'](function(_0x366d02){if(_0x366d02&&_0x366d02[_0xf10f('0x63')]===0x0){return db[_0xf10f('0x3b')][_0xf10f('0x5d')]({'name':_0x505838[_0xf10f('0x3e')],'resourceId':_0x505838['id'],'type':_0x366d02[_0xf10f('0x3e')],'sectionId':_0x366d02['id']},{})[_0xf10f('0x23')](function(){return _0x2e5761;});}else{return _0x2e5761;}})[_0xf10f('0x2d')](function(_0x4e1feb){logger[_0xf10f('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e1feb);throw _0x4e1feb;});}return _0x2e5761;})['then'](respondWithResult(_0x4d14fa,0xc9))[_0xf10f('0x2d')](handleError(_0x4d14fa,null));};exports[_0xf10f('0x38')]=function(_0x3591a5,_0x530b23){if(_0x3591a5[_0xf10f('0x5e')]['id']){delete _0x3591a5[_0xf10f('0x5e')]['id'];}return db[_0xf10f('0x44')]['find']({'where':{'id':_0x3591a5[_0xf10f('0x64')]['id']},'include':[{'model':db[_0xf10f('0x41')],'as':_0xf10f('0x42')}]})[_0xf10f('0x23')](handleEntityNotFound(_0x530b23,null))[_0xf10f('0x23')](saveUpdates(_0x3591a5[_0xf10f('0x5e')],null))['then'](respondWithResult(_0x530b23,null))[_0xf10f('0x2d')](handleError(_0x530b23,null));};exports['destroy']=function(_0x39663a,_0x55518b){return db[_0xf10f('0x44')][_0xf10f('0x5c')]({'where':{'id':_0x39663a[_0xf10f('0x64')]['id']}})[_0xf10f('0x23')](handleEntityNotFound(_0x55518b,null))['then'](removeEntity(_0x55518b,null))[_0xf10f('0x2d')](handleError(_0x55518b,null));};exports[_0xf10f('0x65')]=function(_0x2446ab,_0xb32b62){return db[_0xf10f('0x44')][_0xf10f('0x65')]()[_0xf10f('0x23')](respondWithResult(_0xb32b62,null))[_0xf10f('0x2d')](handleError(_0xb32b62,null));};exports[_0xf10f('0x66')]=function(_0x4f3f7a,_0x5d8726,_0x4b078e){if(_0x4f3f7a['body']['id']){delete _0x4f3f7a[_0xf10f('0x5e')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x4f3f7a[_0xf10f('0x64')]['id']}})[_0xf10f('0x23')](handleEntityNotFound(_0x5d8726,null))[_0xf10f('0x23')](function(_0x24cb57){if(_0x24cb57){_0x4f3f7a[_0xf10f('0x5e')]['FaxAccountId']=_0x24cb57['id'];return db['Disposition'][_0xf10f('0x5d')](_0x4f3f7a[_0xf10f('0x5e')]);}})[_0xf10f('0x23')](respondWithResult(_0x5d8726,null))['catch'](handleError(_0x5d8726,null));};exports[_0xf10f('0x67')]=function(_0x79fb9d,_0x13ca0a,_0x5b587f){var _0x24ce04={'raw':![],'where':{}};var _0x3f069b={};var _0x1645ad={'count':0x0,'rows':[]};return db[_0xf10f('0x44')][_0xf10f('0x68')]({'where':{'id':_0x79fb9d[_0xf10f('0x64')]['id']}})[_0xf10f('0x23')](handleEntityNotFound(_0x13ca0a,null))[_0xf10f('0x23')](function(_0x1d4c49){if(_0x1d4c49){_0x3f069b[_0xf10f('0x47')]=_['keys'](db['Disposition']['rawAttributes']);_0x3f069b[_0xf10f('0x48')]=_[_0xf10f('0x49')](_0x79fb9d['query']);_0x3f069b['filters']=_[_0xf10f('0x4a')](_0x3f069b[_0xf10f('0x47')],_0x3f069b['query']);_0x24ce04[_0xf10f('0x4b')]=_[_0xf10f('0x4a')](_0x3f069b[_0xf10f('0x47')],qs[_0xf10f('0x4c')](_0x79fb9d[_0xf10f('0x48')][_0xf10f('0x4c')]));_0x24ce04[_0xf10f('0x4b')]=_0x24ce04[_0xf10f('0x4b')][_0xf10f('0x4d')]?_0x24ce04[_0xf10f('0x4b')]:_0x3f069b['model'];if(!_0x79fb9d['query']['hasOwnProperty'](_0xf10f('0x4e'))){_0x24ce04[_0xf10f('0x4f')]=qs['limit'](_0x79fb9d[_0xf10f('0x48')][_0xf10f('0x4f')]);_0x24ce04[_0xf10f('0x30')]=qs[_0xf10f('0x30')](_0x79fb9d[_0xf10f('0x48')][_0xf10f('0x30')]);}_0x24ce04[_0xf10f('0x50')]=qs[_0xf10f('0x51')](_0x79fb9d[_0xf10f('0x48')]['sort']);_0x24ce04[_0xf10f('0x52')]=qs[_0xf10f('0x5a')](_[_0xf10f('0x53')](_0x79fb9d[_0xf10f('0x48')],_0x3f069b['filters']));_0x24ce04[_0xf10f('0x52')][_0xf10f('0x69')]=_0x1d4c49['id'];if(_0x79fb9d['query']['filter']){_0x24ce04[_0xf10f('0x52')]=_['merge'](_0x24ce04[_0xf10f('0x52')],{'$or':_['map'](_0x24ce04[_0xf10f('0x4b')],function(_0x57fc04){var _0x501ec1={};_0x501ec1[_0x57fc04]={'$like':'%'+_0x79fb9d[_0xf10f('0x48')][_0xf10f('0x54')]+'%'};return _0x501ec1;})});}_0x24ce04=_['merge']({},_0x24ce04,_0x79fb9d['options']);return db['Disposition'][_0xf10f('0x32')]({'where':_0x24ce04[_0xf10f('0x52')]})[_0xf10f('0x23')](function(_0x3012e5){_0x1645ad[_0xf10f('0x32')]=_0x3012e5;if(_0x79fb9d['query'][_0xf10f('0x6a')]){_0x24ce04[_0xf10f('0x56')]=[{'all':!![]}];}return db[_0xf10f('0x6b')][_0xf10f('0x57')](_0x24ce04);})[_0xf10f('0x23')](function(_0xcffdca){_0x1645ad['rows']=_0xcffdca;return _0x1645ad;});}})[_0xf10f('0x23')](respondWithFilteredResult(_0x13ca0a,_0x24ce04))[_0xf10f('0x2d')](handleError(_0x13ca0a,null));};exports['removeDispositions']=function(_0x5b0425,_0x8bbe93,_0x5989ac){return db['FaxAccount'][_0xf10f('0x5c')]({'where':{'id':_0x5b0425['params']['id']}})[_0xf10f('0x23')](handleEntityNotFound(_0x8bbe93,null))[_0xf10f('0x23')](function(_0x1c343d){if(_0x1c343d){return _0x1c343d[_0xf10f('0x6c')](_0x5b0425[_0xf10f('0x48')][_0xf10f('0x6d')]);}})['then'](respondWithStatusCode(_0x8bbe93,null))[_0xf10f('0x2d')](handleError(_0x8bbe93,null));};exports['addAnswer']=function(_0x32a5c5,_0xc72a6e,_0x42d02e){if(_0x32a5c5[_0xf10f('0x5e')]['id']){delete _0x32a5c5[_0xf10f('0x5e')]['id'];}return db[_0xf10f('0x44')]['find']({'where':{'id':_0x32a5c5['params']['id']}})[_0xf10f('0x23')](handleEntityNotFound(_0xc72a6e,null))['then'](function(_0x1a8180){if(_0x1a8180){_0x32a5c5[_0xf10f('0x5e')][_0xf10f('0x69')]=_0x1a8180['id'];return db[_0xf10f('0x6e')][_0xf10f('0x5d')](_0x32a5c5['body']);}})[_0xf10f('0x23')](respondWithResult(_0xc72a6e,null))['catch'](handleError(_0xc72a6e,null));};exports[_0xf10f('0x6f')]=function(_0x43a6f2,_0x55e6b8,_0x2edf14){var _0x465b30={'raw':![],'where':{}};var _0x1904b4={};var _0xe96cb4={'count':0x0,'rows':[]};return db[_0xf10f('0x44')][_0xf10f('0x68')]({'where':{'id':_0x43a6f2[_0xf10f('0x64')]['id']}})[_0xf10f('0x23')](handleEntityNotFound(_0x55e6b8,null))['then'](function(_0x1fc968){if(_0x1fc968){_0x1904b4[_0xf10f('0x47')]=_[_0xf10f('0x49')](db[_0xf10f('0x6e')][_0xf10f('0x45')]);_0x1904b4[_0xf10f('0x48')]=_[_0xf10f('0x49')](_0x43a6f2['query']);_0x1904b4[_0xf10f('0x5a')]=_['intersection'](_0x1904b4['model'],_0x1904b4[_0xf10f('0x48')]);_0x465b30[_0xf10f('0x4b')]=_['intersection'](_0x1904b4[_0xf10f('0x47')],qs[_0xf10f('0x4c')](_0x43a6f2[_0xf10f('0x48')]['fields']));_0x465b30[_0xf10f('0x4b')]=_0x465b30['attributes'][_0xf10f('0x4d')]?_0x465b30[_0xf10f('0x4b')]:_0x1904b4[_0xf10f('0x47')];if(!_0x43a6f2[_0xf10f('0x48')][_0xf10f('0x70')]('nolimit')){_0x465b30[_0xf10f('0x4f')]=qs[_0xf10f('0x4f')](_0x43a6f2[_0xf10f('0x48')][_0xf10f('0x4f')]);_0x465b30['offset']=qs['offset'](_0x43a6f2[_0xf10f('0x48')][_0xf10f('0x30')]);}_0x465b30['order']=qs[_0xf10f('0x51')](_0x43a6f2[_0xf10f('0x48')][_0xf10f('0x51')]);_0x465b30[_0xf10f('0x52')]=qs[_0xf10f('0x5a')](_[_0xf10f('0x53')](_0x43a6f2[_0xf10f('0x48')],_0x1904b4[_0xf10f('0x5a')]));_0x465b30[_0xf10f('0x52')][_0xf10f('0x69')]=_0x1fc968['id'];if(_0x43a6f2[_0xf10f('0x48')][_0xf10f('0x54')]){_0x465b30[_0xf10f('0x52')]=_[_0xf10f('0x71')](_0x465b30[_0xf10f('0x52')],{'$or':_[_0xf10f('0x43')](_0x465b30[_0xf10f('0x4b')],function(_0x8cdbdb){var _0x41e4e1={};_0x41e4e1[_0x8cdbdb]={'$like':'%'+_0x43a6f2[_0xf10f('0x48')][_0xf10f('0x54')]+'%'};return _0x41e4e1;})});}_0x465b30=_[_0xf10f('0x71')]({},_0x465b30,_0x43a6f2[_0xf10f('0x5b')]);return db['CannedAnswer'][_0xf10f('0x32')]({'where':_0x465b30[_0xf10f('0x52')]})[_0xf10f('0x23')](function(_0xe3bccf){_0xe96cb4['count']=_0xe3bccf;if(_0x43a6f2[_0xf10f('0x48')][_0xf10f('0x6a')]){_0x465b30[_0xf10f('0x56')]=[{'all':!![]}];}return db[_0xf10f('0x6e')][_0xf10f('0x57')](_0x465b30);})['then'](function(_0xa916f5){_0xe96cb4[_0xf10f('0x58')]=_0xa916f5;return _0xe96cb4;});}})[_0xf10f('0x23')](respondWithFilteredResult(_0x55e6b8,_0x465b30))[_0xf10f('0x2d')](handleError(_0x55e6b8,null));};exports['removeAnswers']=function(_0x3fe965,_0x4bff8a,_0x4444c6){return db[_0xf10f('0x44')][_0xf10f('0x5c')]({'where':{'id':_0x3fe965[_0xf10f('0x64')]['id']}})[_0xf10f('0x23')](handleEntityNotFound(_0x4bff8a,null))[_0xf10f('0x23')](function(_0x3db1a4){if(_0x3db1a4){return _0x3db1a4[_0xf10f('0x72')](_0x3fe965[_0xf10f('0x48')][_0xf10f('0x6d')]);}})[_0xf10f('0x23')](respondWithStatusCode(_0x4bff8a,null))[_0xf10f('0x2d')](handleError(_0x4bff8a,null));};exports[_0xf10f('0x73')]=function(_0x23de27,_0x1f0f56,_0x5f675b){return db[_0xf10f('0x74')]['find']({'where':{'id':_0x23de27[_0xf10f('0x64')]['id']}})['then'](handleEntityNotFound(_0x1f0f56,null))['then'](function(_0x54bf8c){if(_0x54bf8c){return _0x54bf8c[_0xf10f('0x73')](_0x23de27[_0xf10f('0x5e')][_0xf10f('0x6d')],_['omit'](_0x23de27['body'],[_0xf10f('0x6d'),'id'])||{});}})[_0xf10f('0x23')](respondWithResult(_0x1f0f56,null))[_0xf10f('0x2d')](handleError(_0x1f0f56,null));};exports[_0xf10f('0x75')]=function(_0xbb5017,_0x5cba6e,_0x4bcb5e){var _0x2c5d24={'raw':![],'where':{}};var _0x669f0c={};var _0x2e2143={'count':0x0,'rows':[]};return db[_0xf10f('0x44')]['findOne']({'where':{'id':_0xbb5017[_0xf10f('0x64')]['id']}})['then'](handleEntityNotFound(_0x5cba6e,null))[_0xf10f('0x23')](function(_0x328b1d){if(_0x328b1d){_0x669f0c['model']=_[_0xf10f('0x49')](db[_0xf10f('0x74')][_0xf10f('0x45')]);_0x669f0c['query']=_[_0xf10f('0x49')](_0xbb5017['query']);_0x669f0c[_0xf10f('0x5a')]=_[_0xf10f('0x4a')](_0x669f0c[_0xf10f('0x47')],_0x669f0c[_0xf10f('0x48')]);_0x2c5d24[_0xf10f('0x4b')]=_[_0xf10f('0x4a')](_0x669f0c[_0xf10f('0x47')],qs['fields'](_0xbb5017[_0xf10f('0x48')][_0xf10f('0x4c')]));_0x2c5d24[_0xf10f('0x4b')]=_0x2c5d24[_0xf10f('0x4b')][_0xf10f('0x4d')]?_0x2c5d24[_0xf10f('0x4b')]:_0x669f0c[_0xf10f('0x47')];if(!_0xbb5017['query'][_0xf10f('0x70')]('nolimit')){_0x2c5d24[_0xf10f('0x4f')]=qs[_0xf10f('0x4f')](_0xbb5017[_0xf10f('0x48')]['limit']);_0x2c5d24[_0xf10f('0x30')]=qs[_0xf10f('0x30')](_0xbb5017[_0xf10f('0x48')][_0xf10f('0x30')]);}_0x2c5d24[_0xf10f('0x50')]=qs[_0xf10f('0x51')](_0xbb5017[_0xf10f('0x48')]['sort']);_0x2c5d24[_0xf10f('0x52')]=qs[_0xf10f('0x5a')](_[_0xf10f('0x53')](_0xbb5017['query'],_0x669f0c[_0xf10f('0x5a')]));_0x2c5d24[_0xf10f('0x52')][_0xf10f('0x69')]=_0x328b1d['id'];if(_0xbb5017[_0xf10f('0x48')][_0xf10f('0x54')]){_0x2c5d24[_0xf10f('0x52')]=_['merge'](_0x2c5d24[_0xf10f('0x52')],{'$or':_[_0xf10f('0x43')](_0x2c5d24[_0xf10f('0x4b')],function(_0x79da34){var _0x320b53={};_0x320b53[_0x79da34]={'$like':'%'+_0xbb5017['query'][_0xf10f('0x54')]+'%'};return _0x320b53;})});}_0x2c5d24=_[_0xf10f('0x71')]({},_0x2c5d24,_0xbb5017['options']);return db['FaxInteraction'][_0xf10f('0x32')]({'where':_0x2c5d24[_0xf10f('0x52')]})[_0xf10f('0x23')](function(_0xe71c28){_0x2e2143[_0xf10f('0x32')]=_0xe71c28;if(_0xbb5017[_0xf10f('0x48')][_0xf10f('0x6a')]){_0x2c5d24[_0xf10f('0x56')]=[{'model':db[_0xf10f('0x76')],'as':_0xf10f('0x77'),'required':![]},{'model':db[_0xf10f('0x78')],'as':_0xf10f('0x79'),'attributes':['name',_0xf10f('0x7a'),_0xf10f('0x7b')],'required':![]},{'model':db[_0xf10f('0x7c')],'as':'Tags','attributes':['id',_0xf10f('0x3e'),'color'],'where':_0xbb5017['query'][_0xf10f('0x7d')]?{'id':_0xbb5017[_0xf10f('0x48')][_0xf10f('0x7d')]}:undefined,'required':_0xbb5017[_0xf10f('0x48')][_0xf10f('0x7d')]?!![]:![]}];}return db[_0xf10f('0x74')][_0xf10f('0x57')](_0x2c5d24);})[_0xf10f('0x23')](function(_0x2e1072){_0x2e2143['rows']=_0x2e1072;return _0x2e2143;});}})[_0xf10f('0x23')](respondWithFilteredResult(_0x5cba6e,_0x2c5d24))['catch'](handleError(_0x5cba6e,null));};exports[_0xf10f('0x7e')]=function(_0x8a4fd0,_0x1062d2){var _0x6ade27=_0x8a4fd0['params']['id'];var _0x5588a3=_0x8a4fd0['body'];var _0x3d0b03=0xc8;var _0x21b477=null;return db['sequelize'][_0xf10f('0x7f')]({'isolationLevel':db[_0xf10f('0x80')][_0xf10f('0x81')][_0xf10f('0x82')][_0xf10f('0x83')]},function(_0x1cd04f){return db['FaxAccount'][_0xf10f('0x68')]({'where':{'id':_0x6ade27},'transaction':_0x1cd04f})[_0xf10f('0x23')](function(_0x1f0ec0){if(_0x1f0ec0){return db[_0xf10f('0x84')]['destroy']({'where':{'FaxAccountId':_0x6ade27},'transaction':_0x1cd04f})[_0xf10f('0x23')](function(){var _0xfd9d9c=_['map'](_0x5588a3,function(_0x5cf995){_0x5cf995[_0xf10f('0x69')]=_0x6ade27;return _0x5cf995;});return db[_0xf10f('0x84')][_0xf10f('0x85')](_0xfd9d9c,{'transaction':_0x1cd04f});});}else{_0x3d0b03=0x194;_0x21b477=[];}});})[_0xf10f('0x23')](function(){if(_0x3d0b03!==0x194){return db[_0xf10f('0x84')][_0xf10f('0x86')]({'where':{'FaxAccountId':_0x6ade27},'order':_0xf10f('0x87')})[_0xf10f('0x23')](function(_0x2178e0){_0x21b477=_0x2178e0;});}})['catch'](function(_0xde47d4){_0x3d0b03=0x1f4;logger[_0xf10f('0x29')](_0xde47d4[_0xf10f('0x3d')]);if(_0xde47d4[_0xf10f('0x3e')]){delete _0xde47d4[_0xf10f('0x3e')];}_0x21b477=_0xde47d4;})['finally'](function(){if(_0x21b477===null){_0x1062d2[_0xf10f('0x2e')](_0x3d0b03);}else{if(_0x3d0b03===0x1f4){_0x1062d2[_0xf10f('0x2f')](_0x3d0b03)[_0xf10f('0x3f')](_0x21b477);}else{_0x1062d2[_0xf10f('0x2f')](_0x3d0b03)[_0xf10f('0x34')](_0x21b477);}}});};exports[_0xf10f('0x88')]=function(_0x41d3e9,_0xf947e8,_0x4c885f){var _0x4b7c6e={};var _0x1a193d={};var _0x6d3868;var _0x53ef16;return db[_0xf10f('0x44')][_0xf10f('0x68')]({'where':{'id':_0x41d3e9[_0xf10f('0x64')]['id']}})[_0xf10f('0x23')](handleEntityNotFound(_0xf947e8,null))[_0xf10f('0x23')](function(_0x20f41d){if(_0x20f41d){_0x6d3868=_0x20f41d;_0x1a193d[_0xf10f('0x47')]=_[_0xf10f('0x49')](db[_0xf10f('0x84')][_0xf10f('0x45')]);_0x1a193d[_0xf10f('0x48')]=_[_0xf10f('0x49')](_0x41d3e9[_0xf10f('0x48')]);_0x1a193d[_0xf10f('0x5a')]=_[_0xf10f('0x4a')](_0x1a193d['model'],_0x1a193d[_0xf10f('0x48')]);_0x4b7c6e['attributes']=_[_0xf10f('0x4a')](_0x1a193d[_0xf10f('0x47')],qs[_0xf10f('0x4c')](_0x41d3e9[_0xf10f('0x48')][_0xf10f('0x4c')]));_0x4b7c6e[_0xf10f('0x4b')]=_0x4b7c6e[_0xf10f('0x4b')][_0xf10f('0x4d')]?_0x4b7c6e[_0xf10f('0x4b')]:_0x1a193d['model'];_0x4b7c6e[_0xf10f('0x50')]=qs[_0xf10f('0x51')](_0x41d3e9[_0xf10f('0x48')][_0xf10f('0x51')]);_0x4b7c6e['where']=qs['filters'](_['pick'](_0x41d3e9[_0xf10f('0x48')],_0x1a193d[_0xf10f('0x5a')]));if(_0x41d3e9['query'][_0xf10f('0x54')]){_0x4b7c6e[_0xf10f('0x52')]=_['merge'](_0x4b7c6e[_0xf10f('0x52')],{'$or':_[_0xf10f('0x43')](_0x4b7c6e[_0xf10f('0x4b')],function(_0x120e69){var _0x4ab098={};_0x4ab098[_0x120e69]={'$like':'%'+_0x41d3e9[_0xf10f('0x48')][_0xf10f('0x54')]+'%'};return _0x4ab098;})});}_0x4b7c6e=_[_0xf10f('0x71')]({},_0x4b7c6e,_0x41d3e9[_0xf10f('0x5b')]);return _0x6d3868[_0xf10f('0x88')](_0x4b7c6e);}})[_0xf10f('0x23')](function(_0x3b00bc){if(_0x3b00bc){_0x53ef16=_0x3b00bc['length'];if(!_0x41d3e9[_0xf10f('0x48')]['hasOwnProperty']('nolimit')){_0x4b7c6e[_0xf10f('0x4f')]=qs[_0xf10f('0x4f')](_0x41d3e9['query'][_0xf10f('0x4f')]);_0x4b7c6e['offset']=qs['offset'](_0x41d3e9[_0xf10f('0x48')]['offset']);}return _0x6d3868[_0xf10f('0x88')](_0x4b7c6e);}})[_0xf10f('0x23')](function(_0x7efce6){if(_0x7efce6){return _0x7efce6?{'count':_0x53ef16,'rows':_0x7efce6}:null;}})[_0xf10f('0x23')](respondWithResult(_0xf947e8,null))[_0xf10f('0x2d')](handleError(_0xf947e8,null));};function Extension(_0xcdebe4,_0x18e8ca,_0x2f876e,_0x1c7346){this[_0xf10f('0x89')]=_0xf10f('0x8a');this[_0xf10f('0x8b')]=_0xcdebe4[_0xf10f('0x8c')];this['app']=_0x1c7346;this[_0xf10f('0x8d')]=_0xf10f('0x8e');this[_0xf10f('0x8f')]='Fax\x20Extension';this[_0xf10f('0x69')]=_0xcdebe4['id'];this[_0xf10f('0x87')]=_0x18e8ca;this[_0xf10f('0x90')]=_0x2f876e;}function createExtensionsReciveFax(_0x3dc074){var _0x1b4509=0x1;var _0x2f92c9=[];_0x2f92c9[_0xf10f('0x91')](new Extension(_0x3dc074,_0x1b4509,'','Answer'));_0x1b4509+=0x1;_0x2f92c9[_0xf10f('0x91')](new Extension(_0x3dc074,_0x1b4509,_0xf10f('0x92'),'Set'));_0x1b4509+=0x1;for(var _0x4c925e in _0x3dc074){if(_0x3dc074['hasOwnProperty'](_0x4c925e)&&(_0x4c925e===_0xf10f('0x93')||_0x4c925e==='localstationid'||_0x4c925e===_0xf10f('0x94')||_0x4c925e===_0xf10f('0x95')||_0x4c925e==='headerinfo'||_0x4c925e===_0xf10f('0x96')||_0x4c925e===_0xf10f('0x97')||_0x4c925e==='modem'||_0x4c925e===_0xf10f('0x98'))){_0x2f92c9[_0xf10f('0x91')](new Extension(_0x3dc074,_0x1b4509,_0xf10f('0x99')+_0x4c925e+')='+_0x3dc074[_0x4c925e],_0xf10f('0x9a')));_0x1b4509+=0x1;}}_0x2f92c9[_0xf10f('0x91')](new Extension(_0x3dc074,_0x1b4509,'6',_0xf10f('0x9b')));_0x1b4509+=0x1;_0x2f92c9[_0xf10f('0x91')](new Extension(_0x3dc074,_0x1b4509,_0xf10f('0x9c'),_0xf10f('0x9d')));_0x1b4509=0x0;return _0x2f92c9;}exports[_0xf10f('0x9e')]=function(_0xfc6a80,_0x2b593a,_0x4f1317){var _0x5ee3d2;return db[_0xf10f('0x80')][_0xf10f('0x7f')](function(_0x3ce1a8){return db[_0xf10f('0x44')][_0xf10f('0x5d')](_0xfc6a80[_0xf10f('0x5e')],{'transaction':_0x3ce1a8})[_0xf10f('0x23')](function(_0x1750e1){_0x5ee3d2=_0x1750e1[_0xf10f('0x60')]({'plain':!![]});return db[_0xf10f('0x9f')][_0xf10f('0x85')](createExtensionsReciveFax(_0x5ee3d2),{'transaction':_0x3ce1a8});});})[_0xf10f('0x23')](function(){return _0x5ee3d2;})[_0xf10f('0x23')](respondWithResult(_0x2b593a,null))['catch'](handleError(_0x2b593a,null));};exports[_0xf10f('0xa0')]=function(_0x3eb4a6,_0xf256bf,_0x5e06c8){var _0x3395e5;return db['sequelize'][_0xf10f('0x7f')](function(_0x3bc2f3){return db[_0xf10f('0x44')][_0xf10f('0x38')](_0x3eb4a6['body'],{'where':{'id':_0x3eb4a6[_0xf10f('0x5e')]['id']},'transaction':_0x3bc2f3})['then'](function(_0x5d446d){return db[_0xf10f('0x9f')][_0xf10f('0x39')]({'where':{'FaxAccountId':_0x3eb4a6[_0xf10f('0x5e')]['id']},'transaction':_0x3bc2f3})['then'](function(_0x17d1d2){return db['VoiceExtension'][_0xf10f('0x85')](createExtensionsReciveFax(_[_0xf10f('0xa1')](_0x3eb4a6['body'],[_0xf10f('0xa2'),_0xf10f('0xa3'),_0xf10f('0xa4'),_0xf10f('0xa5'),'TrunkId',_0xf10f('0xa6')])),{'transaction':_0x3bc2f3});});});})[_0xf10f('0x23')](function(){return db[_0xf10f('0x44')]['findById'](_0x3eb4a6[_0xf10f('0x5e')]['id']);})['then'](respondWithResult(_0xf256bf,null))[_0xf10f('0x2d')](handleError(_0xf256bf,null));};exports[_0xf10f('0xa7')]=function(_0x4688b5,_0x23570b,_0x3d32f0){var _0x37538a={'raw':!![],'where':{}};var _0x1cc852={};var _0x4c58fa={'count':0x0,'rows':[]};return db[_0xf10f('0x44')][_0xf10f('0x68')]({'where':{'id':_0x4688b5[_0xf10f('0x64')]['id']}})[_0xf10f('0x23')](handleEntityNotFound(_0x23570b,null))[_0xf10f('0x23')](function(_0x1b8f79){if(_0x1b8f79){_0x1cc852[_0xf10f('0x47')]=_['keys'](db['FaxMessage'][_0xf10f('0x45')]);_0x1cc852[_0xf10f('0x48')]=_[_0xf10f('0x49')](_0x4688b5[_0xf10f('0x48')]);_0x1cc852[_0xf10f('0x5a')]=_[_0xf10f('0x4a')](_0x1cc852[_0xf10f('0x47')],_0x1cc852[_0xf10f('0x48')]);_0x37538a[_0xf10f('0x4b')]=_[_0xf10f('0x4a')](_0x1cc852[_0xf10f('0x47')],qs[_0xf10f('0x4c')](_0x4688b5[_0xf10f('0x48')]['fields']));_0x37538a[_0xf10f('0x4b')]=_0x37538a[_0xf10f('0x4b')][_0xf10f('0x4d')]?_0x37538a[_0xf10f('0x4b')]:_0x1cc852[_0xf10f('0x47')];if(!_0x4688b5['query'][_0xf10f('0x70')]('nolimit')){_0x37538a[_0xf10f('0x4f')]=qs[_0xf10f('0x4f')](_0x4688b5[_0xf10f('0x48')][_0xf10f('0x4f')]);_0x37538a[_0xf10f('0x30')]=qs[_0xf10f('0x30')](_0x4688b5['query'][_0xf10f('0x30')]);}_0x37538a[_0xf10f('0x50')]=qs[_0xf10f('0x51')](_0x4688b5['query']['sort']);_0x37538a[_0xf10f('0x52')]=qs[_0xf10f('0x5a')](_['pick'](_0x4688b5[_0xf10f('0x48')],_0x1cc852['filters']));_0x37538a['where']['FaxAccountId']=_0x1b8f79['id'];if(_0x4688b5['query'][_0xf10f('0x54')]){_0x37538a[_0xf10f('0x52')]=_[_0xf10f('0x71')](_0x37538a[_0xf10f('0x52')],{'$or':_['map'](_0x37538a[_0xf10f('0x4b')],function(_0x1e56d9){var _0x1991b4={};_0x1991b4[_0x1e56d9]={'$like':'%'+_0x4688b5[_0xf10f('0x48')]['filter']+'%'};return _0x1991b4;})});}if(_0x4688b5[_0xf10f('0x48')][_0xf10f('0xa8')]){var _0x2ccea4=_0x4688b5[_0xf10f('0x48')]['$gte'][_0xf10f('0xa9')](',');var _0x5324e9={};_0x5324e9[_0x2ccea4[0x0]]={'$gte':moment(_0x2ccea4[0x1])['format'](_0xf10f('0xaa'))};_0x37538a[_0xf10f('0x52')]=_['merge'](_0x37538a[_0xf10f('0x52')],_0x5324e9);}_0x37538a=_[_0xf10f('0x71')]({},_0x37538a,_0x4688b5[_0xf10f('0x5b')]);return db['FaxMessage'][_0xf10f('0x32')]({'where':_0x37538a[_0xf10f('0x52')]})['then'](function(_0x27f3fc){_0x4c58fa[_0xf10f('0x32')]=_0x27f3fc;if(_0x4688b5[_0xf10f('0x48')][_0xf10f('0x6a')]){_0x37538a['include']=[{'all':!![]}];}return db[_0xf10f('0xab')][_0xf10f('0x57')](_0x37538a);})[_0xf10f('0x23')](function(_0x19438f){_0x4c58fa[_0xf10f('0x58')]=_0x19438f;return _0x4c58fa;});}})[_0xf10f('0x23')](respondWithFilteredResult(_0x23570b,_0x37538a))['catch'](handleError(_0x23570b,null));};exports[_0xf10f('0x3f')]=function(_0x15c99b,_0x57a34c,_0x4063a9){var _0x243de7,_0x3e1955={},_0x44be41;if(_0x15c99b[_0xf10f('0x5e')]['to']){_0x44be41=_0x15c99b[_0xf10f('0x5e')]['to'][0x0];}return db[_0xf10f('0x44')][_0xf10f('0x5c')]({'where':{'id':_0x15c99b[_0xf10f('0x64')]['id']},'include':[{'model':db[_0xf10f('0xac')],'as':_0xf10f('0xad'),'include':[{'model':db[_0xf10f('0x76')],'as':_0xf10f('0xae'),'where':{'fax':_0x44be41},'limit':0x1,'order':[[_0xf10f('0xa5'),_0xf10f('0xaf')]]}]}]})[_0xf10f('0x23')](handleEntityNotFound(_0x57a34c,null))[_0xf10f('0x23')](function(_0x467035){_0x243de7=_0x467035;if(_0x15c99b['body'][_0xf10f('0xb0')]&&_0x15c99b[_0xf10f('0x5e')][_0xf10f('0xb0')][_0xf10f('0x4d')]){for(var _0x4b770c=0x0;_0x4b770c<_0x15c99b['body'][_0xf10f('0xb0')][_0xf10f('0x4d')];_0x4b770c+=0x1){_0x15c99b[_0xf10f('0x5e')][_0xf10f('0xb0')][_0x4b770c]={'filename':_0x15c99b[_0xf10f('0x5e')]['attachments'][_0x4b770c][_0xf10f('0x3e')],'id':_0x15c99b[_0xf10f('0x5e')]['attachments'][_0x4b770c]['id'],'path':path['join'](config[_0xf10f('0xb1')],_0xf10f('0xb2'),_0x15c99b[_0xf10f('0x5e')][_0xf10f('0xb0')][_0x4b770c][_0xf10f('0xb3')])};}}return respondWithRpcPromise(_0xf10f('0xb4'),_0xf10f('0xb4'),{'FaxAccountId':_[_0xf10f('0xb5')](_0x15c99b[_0xf10f('0x64')]['id'])?undefined:_0x15c99b[_0xf10f('0x64')]['id'],'path':_[_0xf10f('0xb5')](_0x15c99b[_0xf10f('0x5e')][_0xf10f('0xb0')][0x0][_0xf10f('0x8')])?undefined:_0x15c99b[_0xf10f('0x5e')]['attachments'][0x0][_0xf10f('0x8')],'fax':_[_0xf10f('0xb5')](_0x15c99b[_0xf10f('0x5e')]['to'][0x0])?undefined:_0x15c99b[_0xf10f('0x5e')]['to'][0x0]},client9002);})['then'](function(){if(_0x243de7){if(_[_0xf10f('0xb5')](_0x15c99b[_0xf10f('0x5e')]['from'])){_0x15c99b[_0xf10f('0x5e')][_0xf10f('0xb6')]=util[_0xf10f('0xb7')](_0xf10f('0xb8'),_0x243de7[_0xf10f('0x3e')],_0x243de7[_0xf10f('0xb9')]);}if(_0x243de7[_0xf10f('0xad')]){if(_0x243de7['List'][_0xf10f('0xae')][_0xf10f('0x4d')]){return _0x243de7[_0xf10f('0xad')][_0xf10f('0xae')][0x0];}else{return db['CmContact']['create'](_['defaults'](_0x15c99b[_0xf10f('0x5e')],{'firstName':_0x15c99b[_0xf10f('0x5e')]['to'][0x0],'phone':_0x15c99b['body']['to'][0x0],'fax':_0x15c99b[_0xf10f('0x5e')]['to'][0x0],'ListId':_0x243de7['ListId']}));}}else{throw new Error(_0xf10f('0xba'));}}else{throw new Error(_0xf10f('0xbb'));}})[_0xf10f('0x23')](function(_0xdb959e){if(_0xdb959e){return db[_0xf10f('0x74')][_0xf10f('0x5c')]({'where':{'ContactId':_0xdb959e['id'],'closed':![],'FaxAccountId':_0x243de7['id']}})['then'](function(_0x31d61f){if(_0x31d61f){return[_0x31d61f,![]];}return db['FaxInteraction'][_0xf10f('0x5d')]({'UserId':_0x15c99b[_0xf10f('0x5f')]['id'],'ContactId':_0xdb959e['id'],'FaxAccountId':_0x243de7['id'],'fax':_0x15c99b[_0xf10f('0x5e')]['to'][0x0],'firstMsgDirection':_0xf10f('0xbc'),'Messages':[_['merge'](_0x15c99b[_0xf10f('0x5e')],{'read':![],'body':_0x15c99b[_0xf10f('0x5e')][_0xf10f('0xb0')][0x0][_0xf10f('0xbd')],'FaxAccountId':_0x243de7['id'],'UserId':_0x15c99b[_0xf10f('0x5f')]['id'],'ContactId':_0xdb959e['id'],'AttachmentId':_0x15c99b[_0xf10f('0x5e')][_0xf10f('0xb0')][0x0]['id']})]},{'include':[{'model':db[_0xf10f('0xab')],'as':_0xf10f('0xbe')}]})[_0xf10f('0x23')](function(_0x5afd05){return[_0x5afd05,!![]];});});}else{throw new Error(_0xf10f('0xbf'));}})[_0xf10f('0xc0')](function(_0x20f837,_0x7d370b){if(_0x7d370b){return _0x20f837;}return db[_0xf10f('0xab')]['create']({'direction':_0xf10f('0xbc'),'read':![],'body':_0x15c99b['body'][_0xf10f('0xb0')][0x0][_0xf10f('0xbd')],'FaxAccountId':_0x243de7['id'],'FaxInteractionId':_0x20f837['id'],'UserId':_0x15c99b['user']['id'],'ContactId':_0x20f837[_0xf10f('0xc1')],'AttachmentId':_0x15c99b['body']['attachments'][0x0]['id']})[_0xf10f('0x23')](function(_0x3228a3){_0x20f837['dataValues'][_0xf10f('0xbe')]=[];_0x20f837[_0xf10f('0xc2')][_0xf10f('0xbe')]['push'](_0x3228a3[_0xf10f('0xc2')]);return _0x20f837;});})[_0xf10f('0x23')](function(_0x3dc625){respondWithRpcPromise(_0xf10f('0xc3'),'SendFax',{'FaxAccountId':_[_0xf10f('0xb5')](_0x15c99b[_0xf10f('0x64')]['id'])?undefined:_0x15c99b['params']['id'],'path':_[_0xf10f('0xb5')](_0x15c99b['body'][_0xf10f('0xb0')][0x0]['path'])?undefined:_0x15c99b['body']['attachments'][0x0][_0xf10f('0x8')],'fax':_['isNil'](_0x15c99b[_0xf10f('0x5e')]['to'][0x0])?undefined:_0x15c99b[_0xf10f('0x5e')]['to'][0x0],'AttachmentId':_0x15c99b[_0xf10f('0x5e')][_0xf10f('0xb0')][0x0]['id']},client9002)[_0xf10f('0x23')](function(_0x499834){logger['info']('SendFaxRpc,\x20%s',_0x499834);})[_0xf10f('0x2d')](function(_0x5b6bb3){logger[_0xf10f('0x24')]('SendFaxRpc,\x20%s',_0x5b6bb3);});return _0x3dc625;})[_0xf10f('0x23')](respondWithResult(_0x57a34c,null))[_0xf10f('0x2d')](handleError(_0x57a34c,null));};exports[_0xf10f('0xc4')]=function(_0x4c5fa2,_0x117213,_0x3d3666){return db[_0xf10f('0x44')][_0xf10f('0x5c')]({'where':{'id':_0x4c5fa2[_0xf10f('0x64')]['id']}})['then'](handleEntityNotFound(_0x117213,null))[_0xf10f('0x23')](function(_0x35c129){if(_0x35c129){return _0x35c129['addAgents'](_0x4c5fa2[_0xf10f('0x5e')][_0xf10f('0x6d')],_[_0xf10f('0xa1')](_0x4c5fa2['body'],[_0xf10f('0x6d'),'id'])||{})[_0xf10f('0xc0')](function(_0x134dd1){for(var _0x328c7c=0x0;_0x328c7c<_0x4c5fa2[_0xf10f('0x5e')][_0xf10f('0x6d')][_0xf10f('0x4d')];_0x328c7c+=0x1){socket[_0xf10f('0xc5')](_0xf10f('0xc6'),{'UserId':Number(_0x4c5fa2[_0xf10f('0x5e')][_0xf10f('0x6d')][_0x328c7c]),'FaxAccountId':Number(_0x4c5fa2[_0xf10f('0x64')]['id'])});}return _0x134dd1;});}})['then'](respondWithResult(_0x117213,null))[_0xf10f('0x2d')](handleError(_0x117213,null));};exports[_0xf10f('0xc7')]=function(_0x50d374,_0x374c2d,_0x1d972c){return db[_0xf10f('0x44')]['find']({'where':{'id':_0x50d374[_0xf10f('0x64')]['id']}})[_0xf10f('0x23')](handleEntityNotFound(_0x374c2d,null))['then'](function(_0x1c0779){if(_0x1c0779){return _0x1c0779[_0xf10f('0xc7')](_0x50d374[_0xf10f('0x48')][_0xf10f('0x6d')])[_0xf10f('0x23')](function(){if(_[_0xf10f('0xc8')](_0x50d374[_0xf10f('0x48')]['ids'])){for(var _0x4f5c6c=0x0;_0x4f5c6c<_0x50d374[_0xf10f('0x48')][_0xf10f('0x6d')][_0xf10f('0x4d')];_0x4f5c6c+=0x1){socket['emit'](_0xf10f('0xc9'),{'UserId':Number(_0x50d374[_0xf10f('0x48')][_0xf10f('0x6d')][_0x4f5c6c]),'FaxAccountId':Number(_0x50d374['params']['id'])});}}else{socket[_0xf10f('0xc5')](_0xf10f('0xc9'),{'UserId':Number(_0x50d374[_0xf10f('0x48')][_0xf10f('0x6d')]),'FaxAccountId':Number(_0x50d374[_0xf10f('0x64')]['id'])});}});}})[_0xf10f('0x23')](respondWithStatusCode(_0x374c2d,null))[_0xf10f('0x2d')](handleError(_0x374c2d,null));};exports[_0xf10f('0xca')]=function(_0x4ec7dc,_0x3c03da,_0xbda484){var _0x207753={};var _0x1caf58={};var _0x9b8061;var _0x658e86;return db[_0xf10f('0x44')][_0xf10f('0x68')]({'where':{'id':_0x4ec7dc['params']['id']}})[_0xf10f('0x23')](handleEntityNotFound(_0x3c03da,null))[_0xf10f('0x23')](function(_0xfa92d3){if(_0xfa92d3){_0x9b8061=_0xfa92d3;_0x1caf58['model']=_[_0xf10f('0x49')](db[_0xf10f('0x78')]['rawAttributes']);_0x1caf58[_0xf10f('0x48')]=_[_0xf10f('0x49')](_0x4ec7dc['query']);_0x1caf58['filters']=_['intersection'](_0x1caf58[_0xf10f('0x47')],_0x1caf58[_0xf10f('0x48')]);_0x207753['attributes']=_[_0xf10f('0x4a')](_0x1caf58['model'],qs['fields'](_0x4ec7dc['query']['fields']));_0x207753['attributes']=_0x207753[_0xf10f('0x4b')]['length']?_0x207753['attributes']:_0x1caf58[_0xf10f('0x47')];_0x207753[_0xf10f('0x50')]=qs[_0xf10f('0x51')](_0x4ec7dc['query']['sort']);_0x207753[_0xf10f('0x52')]=qs['filters'](_[_0xf10f('0x53')](_0x4ec7dc['query'],_0x1caf58['filters']));if(_0x4ec7dc['query']['filter']){_0x207753['where']=_[_0xf10f('0x71')](_0x207753[_0xf10f('0x52')],{'$or':_['map'](_0x207753[_0xf10f('0x4b')],function(_0x52b60d){var _0x506c52={};_0x506c52[_0x52b60d]={'$like':'%'+_0x4ec7dc[_0xf10f('0x48')][_0xf10f('0x54')]+'%'};return _0x506c52;})});}_0x207753=_[_0xf10f('0x71')]({},_0x207753,_0x4ec7dc[_0xf10f('0x5b')]);return _0x9b8061[_0xf10f('0xca')](_0x207753);}})[_0xf10f('0x23')](function(_0x1f557f){if(_0x1f557f){_0x658e86=_0x1f557f['length'];if(!_0x4ec7dc[_0xf10f('0x48')][_0xf10f('0x70')](_0xf10f('0x4e'))){_0x207753[_0xf10f('0x4f')]=qs['limit'](_0x4ec7dc[_0xf10f('0x48')][_0xf10f('0x4f')]);_0x207753[_0xf10f('0x30')]=qs[_0xf10f('0x30')](_0x4ec7dc[_0xf10f('0x48')]['offset']);}return _0x9b8061[_0xf10f('0xca')](_0x207753);}})[_0xf10f('0x23')](function(_0x55f21e){if(_0x55f21e){return _0x55f21e?{'count':_0x658e86,'rows':_0x55f21e}:null;}})[_0xf10f('0x23')](respondWithResult(_0x3c03da,null))[_0xf10f('0x2d')](handleError(_0x3c03da,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 299337a..383c236 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 _0x3753=['update','emit','hasOwnProperty','hook','exports','events','FaxAccount','setMaxListeners'];(function(_0x3e3dac,_0x123047){var _0x72137f=function(_0x2c9e67){while(--_0x2c9e67){_0x3e3dac['push'](_0x3e3dac['shift']());}};_0x72137f(++_0x123047);}(_0x3753,0x6d));var _0x3375=function(_0x2d4b1a,_0x361485){_0x2d4b1a=_0x2d4b1a-0x0;var _0x330e55=_0x3753[_0x2d4b1a];return _0x330e55;};'use strict';var EventEmitter=require(_0x3375('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x3375('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x3375('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3375('0x3'),'afterDestroy':'remove'};function emitEvent(_0x468722){return function(_0x5abd89,_0x2f2719,_0x206edf){FaxAccountEvents[_0x3375('0x4')](_0x468722+':'+_0x5abd89['id'],_0x5abd89);FaxAccountEvents[_0x3375('0x4')](_0x468722,_0x5abd89);_0x206edf(null);};}for(var e in events){if(events[_0x3375('0x5')](e)){var event=events[e];FaxAccount[_0x3375('0x6')](e,emitEvent(event));}}module[_0x3375('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0x7095=['emit','hasOwnProperty','hook','exports','../../mysqldb','FaxAccount','setMaxListeners','save','update','remove'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7095,0xae));var _0x5709=function(_0x457ddc,_0xdd6ef1){_0x457ddc=_0x457ddc-0x0;var _0x1dbc0d=_0x7095[_0x457ddc];return _0x1dbc0d;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x5709('0x0'))['db'][_0x5709('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x5709('0x2')](0x0);var events={'afterCreate':_0x5709('0x3'),'afterUpdate':_0x5709('0x4'),'afterDestroy':_0x5709('0x5')};function emitEvent(_0x5caa66){return function(_0x305344,_0xa8cd48,_0x97fa11){FaxAccountEvents[_0x5709('0x6')](_0x5caa66+':'+_0x305344['id'],_0x305344);FaxAccountEvents[_0x5709('0x6')](_0x5caa66,_0x305344);_0x97fa11(null);};}for(var e in events){if(events[_0x5709('0x7')](e)){var event=events[e];FaxAccount[_0x5709('0x8')](e,emitEvent(event));}}module[_0x5709('0x9')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index caaa680..ecee93c 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 _0x0de3=['util','../../config/logger','api','path','rimraf','../../config/environment','./faxAccount.attributes','FaxAccount','fax_accounts','lodash'];(function(_0x12171f,_0xd9e2ad){var _0x5277e9=function(_0x1ee79b){while(--_0x1ee79b){_0x12171f['push'](_0x12171f['shift']());}};_0x5277e9(++_0xd9e2ad);}(_0x0de3,0x1df));var _0x30de=function(_0x4d782a,_0x262515){_0x4d782a=_0x4d782a-0x0;var _0x291c8d=_0x0de3[_0x4d782a];return _0x291c8d;};'use strict';var _=require(_0x30de('0x0'));var util=require(_0x30de('0x1'));var logger=require(_0x30de('0x2'))(_0x30de('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x30de('0x4'));var rimraf=require(_0x30de('0x5'));var config=require(_0x30de('0x6'));var attributes=require(_0x30de('0x7'));module['exports']=function(_0xcced7e,_0x17abcd){return _0xcced7e['define'](_0x30de('0x8'),attributes,{'tableName':_0x30de('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0acb=['define','FaxAccount','util','api','moment','bluebird','path','rimraf','./faxAccount.attributes','exports'];(function(_0x44d542,_0x281279){var _0x47e667=function(_0x54ded0){while(--_0x54ded0){_0x44d542['push'](_0x44d542['shift']());}};_0x47e667(++_0x281279);}(_0x0acb,0x17e));var _0xb0ac=function(_0x105b0b,_0x2073d9){_0x105b0b=_0x105b0b-0x0;var _0x3e14b7=_0x0acb[_0x105b0b];return _0x3e14b7;};'use strict';var _=require('lodash');var util=require(_0xb0ac('0x0'));var logger=require('../../config/logger')(_0xb0ac('0x1'));var moment=require(_0xb0ac('0x2'));var BPromise=require(_0xb0ac('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb0ac('0x4'));var rimraf=require(_0xb0ac('0x5'));var config=require('../../config/environment');var attributes=require(_0xb0ac('0x6'));module[_0xb0ac('0x7')]=function(_0x2d680d,_0x5a955c){return _0x2d680d[_0xb0ac('0x8')](_0xb0ac('0x9'),attributes,{'tableName':'fax_accounts','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 09e9cf9..f813d90 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 _0x644f=['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','FaxApplication','Applications','account','applications','orderBy','length','ListId','create','then','contact','fax','FaxInteraction','Contact\x20not\x20found','spread','get','push','close','*,*,*,*','created','interaction','ContactId','AttachmentId','UserId','User','find','unshift','agent','name','Start','startRouting','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','info','debug','request\x20sent','stringify','error','message','FaxAccount,\x20%s,\x20%s','result','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','NotifyFaxAccount','body','CmContact','describe','Sequelize','ValidationError','difference','keys','createdAt','updatedAt','CompanyId','isNil','from'];(function(_0x1cb701,_0xaebc06){var _0x2ac38d=function(_0x33003b){while(--_0x33003b){_0x1cb701['push'](_0x1cb701['shift']());}};_0x2ac38d(++_0xaebc06);}(_0x644f,0x1e5));var _0xf644=function(_0x31c19c,_0xbe4b70){_0x31c19c=_0x31c19c-0x0;var _0x1a87f7=_0x644f[_0x31c19c];return _0x1a87f7;};'use strict';var _=require(_0xf644('0x0'));var util=require(_0xf644('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf644('0x2'));var fs=require('fs');var Redis=require(_0xf644('0x3'));var db=require(_0xf644('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf644('0x5'))('rpc');var config=require(_0xf644('0x6'));var jayson=require(_0xf644('0x7'));var client=jayson[_0xf644('0x8')][_0xf644('0x9')]({'port':0x232c});config[_0xf644('0xa')]=_[_0xf644('0xb')](config[_0xf644('0xa')],{'host':_0xf644('0xc'),'port':0x18eb});var socket=require(_0xf644('0xd'))(new Redis(config[_0xf644('0xa')]));require(_0xf644('0xe'))[_0xf644('0xf')](socket);function respondWithRpcPromise(_0x1b990f,_0x4d581f,_0x5ae2ed){return new BPromise(function(_0x2a91e0,_0x2f3386){return client[_0xf644('0x10')](_0x1b990f,_0x5ae2ed)['then'](function(_0x5e4935){logger[_0xf644('0x11')]('FaxAccount,\x20%s,\x20%s',_0x4d581f,'request\x20sent');logger[_0xf644('0x12')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x4d581f,_0xf644('0x13'),JSON[_0xf644('0x14')](_0x5e4935));if(_0x5e4935['error']){if(_0x5e4935[_0xf644('0x15')]['code']===0x1f4){logger[_0xf644('0x15')]('FaxAccount,\x20%s,\x20%s',_0x4d581f,_0x5e4935['error']['message']);return _0x2f3386(_0x5e4935['error'][_0xf644('0x16')]);}logger['error'](_0xf644('0x17'),_0x4d581f,_0x5e4935['error'][_0xf644('0x16')]);return _0x2a91e0(_0x5e4935['error'][_0xf644('0x16')]);}else{logger[_0xf644('0x11')](_0xf644('0x17'),_0x4d581f,_0xf644('0x13'));_0x2a91e0(_0x5e4935[_0xf644('0x18')][_0xf644('0x16')]);}})['catch'](function(_0x5a3b23){logger[_0xf644('0x15')](_0xf644('0x17'),_0x4d581f,_0x5a3b23);_0x2f3386(_0x5a3b23);});});}exports[_0xf644('0x19')]=function(_0x4cc6d8){var _0x3b1fb3=this;return new Promise(function(_0x4887c3,_0x4e873a){return db[_0xf644('0x1a')][_0xf644('0x1b')]({'raw':_0x4cc6d8[_0xf644('0x1c')]?_0x4cc6d8['options'][_0xf644('0x1d')]===undefined?!![]:![]:!![],'where':_0x4cc6d8[_0xf644('0x1c')]?_0x4cc6d8[_0xf644('0x1c')][_0xf644('0x1e')]||null:null,'attributes':_0x4cc6d8[_0xf644('0x1c')]?_0x4cc6d8[_0xf644('0x1c')][_0xf644('0x1f')]||null:null,'limit':_0x4cc6d8['options']?_0x4cc6d8[_0xf644('0x1c')][_0xf644('0x20')]||null:null,'include':_0x4cc6d8[_0xf644('0x1c')]?_0x4cc6d8[_0xf644('0x1c')][_0xf644('0x21')]?_[_0xf644('0x22')](_0x4cc6d8[_0xf644('0x1c')]['include'],function(_0x2239a9){return{'model':db[_0x2239a9[_0xf644('0x23')]],'as':_0x2239a9['as'],'attributes':_0x2239a9[_0xf644('0x1f')],'include':_0x2239a9[_0xf644('0x21')]?_[_0xf644('0x22')](_0x2239a9[_0xf644('0x21')],function(_0x3436c1){return{'model':db[_0x3436c1[_0xf644('0x23')]],'as':_0x3436c1['as'],'attributes':_0x3436c1[_0xf644('0x1f')],'include':_0x3436c1[_0xf644('0x21')]?_['map'](_0x3436c1[_0xf644('0x21')],function(_0x44c02e){return{'model':db[_0x44c02e[_0xf644('0x23')]],'as':_0x44c02e['as'],'attributes':_0x44c02e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x37f20f){logger[_0xf644('0x11')](_0xf644('0x19'),_0x4cc6d8);logger['debug'](_0xf644('0x19'),_0x4cc6d8,JSON['stringify'](_0x37f20f));_0x4887c3(_0x37f20f);})['catch'](function(_0x5b1d7d){logger[_0xf644('0x15')](_0xf644('0x19'),_0x5b1d7d[_0xf644('0x16')],_0x4cc6d8);_0x4e873a(_0x3b1fb3['error'](0x1f4,_0x5b1d7d['message']));});});};exports[_0xf644('0x24')]=function(_0x3a54a2,_0x3ef4e2,_0x2c19b7){var _0x1c7fcb=this;return new Promise(function(_0x5ba787,_0x295600){var _0x124b9d={'body':_0x3a54a2[_0xf644('0x25')],'channel':'fax'};var _0x542cc0=[];var _0x5338e6=[];var _0x18c067={};return db[_0xf644('0x26')][_0xf644('0x27')]()['then'](function(_0x5d7357){if(!_0x5d7357){throw new db[(_0xf644('0x28'))][(_0xf644('0x29'))]('no\x20available\x20attributes');}_0x542cc0=_[_0xf644('0x2a')](_[_0xf644('0x2b')](_0x5d7357),[_0xf644('0x2c'),_0xf644('0x2d')]);_0x5338e6=_['difference'](_[_0xf644('0x2b')](_0x5d7357),[_0xf644('0x2c'),'updatedAt',_0xf644('0x2e'),'ListId']);if(_0x3a54a2[_0xf644('0x25')]['id']){delete _0x3a54a2['body']['id'];}if(_[_0xf644('0x2f')](_0x3a54a2[_0xf644('0x25')][_0xf644('0x30')])){throw new db[(_0xf644('0x28'))][(_0xf644('0x29'))](_0xf644('0x31'));}if(_[_0xf644('0x2f')](_0x3a54a2['body'][_0xf644('0x25')])||_0x3a54a2['body'][_0xf644('0x25')]===''){throw new db[(_0xf644('0x28'))][(_0xf644('0x29'))](_0xf644('0x32'));}if(_[_0xf644('0x2f')](_0x3a54a2[_0xf644('0x25')][_0xf644('0x33')])){throw new db[(_0xf644('0x28'))][(_0xf644('0x29'))](_0xf644('0x34')+_0x5338e6);}if(!_[_0xf644('0x35')](_0x5338e6,_0x3a54a2[_0xf644('0x25')][_0xf644('0x33')])){throw new db['Sequelize'][(_0xf644('0x29'))](_0xf644('0x36')+_0x5338e6);}_0x18c067[_0x3a54a2['body']['mapKey']]=_0x3a54a2[_0xf644('0x25')][_0xf644('0x30')];})['then'](function(){return db[_0xf644('0x1a')]['find']({'where':{'id':_0x3a54a2['account']['id']},'include':[{'model':db[_0xf644('0x37')],'as':_0xf644('0x38'),'include':[{'model':db['CmContact'],'as':_0xf644('0x39'),'where':_0x18c067,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xf644('0x3a')],'as':_0xf644('0x3b')}]});})['then'](function(_0x3ca7ee){if(_0x3ca7ee&&_0x3ca7ee['List']){var _0x3265bb=_0x3ca7ee['get']({'plain':!![]});_0x124b9d[_0xf644('0x3c')]=_0x3265bb;_0x124b9d[_0xf644('0x3d')]=_0x3265bb[_0xf644('0x3b')];_0x124b9d['list']=_0x3265bb[_0xf644('0x38')];_0x124b9d[_0xf644('0x3d')]=_[_0xf644('0x3e')](_0x124b9d[_0xf644('0x3d')],['priority'],['asc']);if(_0x124b9d[_0xf644('0x3c')][_0xf644('0x3b')]){delete _0x124b9d[_0xf644('0x3c')][_0xf644('0x3b')];}if(_0x124b9d['account'][_0xf644('0x38')]&&_0x124b9d['account'][_0xf644('0x38')][_0xf644('0x39')][_0xf644('0x3f')]){return _0x124b9d[_0xf644('0x3c')][_0xf644('0x38')][_0xf644('0x39')][0x0];}var _0x58c5ea=_[_0xf644('0xb')](_0x3a54a2[_0xf644('0x25')],{'firstName':_0x3a54a2[_0xf644('0x25')][_0xf644('0x30')],'ListId':_0x3265bb[_0xf644('0x40')]});_0x58c5ea[_0x3a54a2[_0xf644('0x25')]['mapKey']]=_0x3a54a2[_0xf644('0x25')]['from'];return db[_0xf644('0x26')][_0xf644('0x41')](_0x58c5ea,{'fields':_0x542cc0,'raw':!![]});}})[_0xf644('0x42')](function(_0x339ab5){_0x124b9d[_0xf644('0x43')]=_0x339ab5;if(_0x339ab5){var _0x38c42c={'ContactId':_0x339ab5['id'],'FaxAccountId':_0x3a54a2[_0xf644('0x3c')]['id'],'fax':_0x339ab5[_0xf644('0x44')]};return db[_0xf644('0x45')]['find']({'where':{'ContactId':_0x339ab5['id'],'closed':![],'FaxAccountId':_0x3a54a2['account']['id']}})[_0xf644('0x42')](function(_0x1fe4a6){if(_0x1fe4a6){return[_0x1fe4a6,![]];}return db['FaxInteraction'][_0xf644('0x41')](_0x38c42c)['then'](function(_0x147abf){return[_0x147abf,!![]];});});}else{throw new Error(_0xf644('0x46'));}})[_0xf644('0x47')](function(_0x1750e1,_0x791348){var _0x42f8b5=_0x1750e1[_0xf644('0x48')]({'plain':!![]});if(_0x791348){if(_0x124b9d[_0xf644('0x3c')]['autoclose']){_0x124b9d['applications'][_0xf644('0x49')]({'id':0x0,'priority':_0x124b9d['applications'][_0xf644('0x3f')]+0x1,'app':_0xf644('0x4a'),'appdata':'unmanaged','interval':_0xf644('0x4b')});}_0x42f8b5[_0xf644('0x4c')]=!![];}else{_0x42f8b5[_0xf644('0x4c')]=![];}_0x124b9d[_0xf644('0x4d')]=_0x42f8b5;return db['FaxMessage'][_0xf644('0x41')]({'body':_0x3a54a2[_0xf644('0x25')][_0xf644('0x25')],'FaxAccountId':_0x3a54a2['account']['id'],'FaxInteractionId':_0x1750e1['id'],'direction':'in','ContactId':_0x1750e1[_0xf644('0x4e')],'AttachmentId':_0x3a54a2['body'][_0xf644('0x4f')]});})[_0xf644('0x42')](function(_0x467324){_0x124b9d[_0xf644('0x16')]=_0x467324;if(_0x124b9d[_0xf644('0x4d')][_0xf644('0x50')]){return db[_0xf644('0x51')][_0xf644('0x52')]({'attributes':['id','name'],'where':{'id':_0x124b9d['interaction'][_0xf644('0x50')]}})['then'](function(_0x4dcfcc){if(_0x4dcfcc){_0x124b9d[_0xf644('0x3d')][_0xf644('0x53')]({'id':0x0,'priority':0x0,'app':_0xf644('0x54'),'appdata':_0x4dcfcc[_0xf644('0x55')]+','+(_0x124b9d[_0xf644('0x3c')]['waitForTheAssignedAgent']||0xa),'interval':_0xf644('0x4b')});}return respondWithRpcPromise(_0xf644('0x56'),_0xf644('0x57'),_0x124b9d);});}return respondWithRpcPromise(_0xf644('0x56'),'startRouting',_0x124b9d);})[_0xf644('0x42')](function(_0x56fadb){_0x5ba787(_0x56fadb);})[_0xf644('0x58')](function(_0x1ab6c4){_0x295600(_0x1c7fcb[_0xf644('0x15')](0x1f4,_0x1ab6c4[_0xf644('0x16')]));});});}; \ No newline at end of file +var _0x8d33=['push','close','unmanaged','created','interaction','FaxMessage','UserId','User','name','unshift','agent','*,*,*,*','startRouting','Start','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxAccount','findAll','options','where','attributes','limit','include','model','then','body','CmContact','Sequelize','no\x20available\x20attributes','updatedAt','difference','keys','createdAt','ListId','isNil','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','FaxAccount','CmList','Contacts','DESC','FaxApplication','Applications','List','get','account','applications','orderBy','priority','asc','length','from','create','contact','fax','FaxInteraction','find','Contact\x20not\x20found','autoclose'];(function(_0x401587,_0x5f19be){var _0x238e81=function(_0x1e91d4){while(--_0x1e91d4){_0x401587['push'](_0x401587['shift']());}};_0x238e81(++_0x5f19be);}(_0x8d33,0x68));var _0x38d3=function(_0x2a416e,_0x3161cd){_0x2a416e=_0x2a416e-0x0;var _0x5878f1=_0x8d33[_0x2a416e];return _0x5878f1;};'use strict';var _=require('lodash');var util=require(_0x38d3('0x0'));var moment=require(_0x38d3('0x1'));var BPromise=require(_0x38d3('0x2'));var rs=require(_0x38d3('0x3'));var fs=require('fs');var Redis=require(_0x38d3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x38d3('0x5'));var logger=require(_0x38d3('0x6'))(_0x38d3('0x7'));var config=require('../../config/environment');var jayson=require(_0x38d3('0x8'));var client=jayson[_0x38d3('0x9')][_0x38d3('0xa')]({'port':0x232c});config[_0x38d3('0xb')]=_[_0x38d3('0xc')](config[_0x38d3('0xb')],{'host':_0x38d3('0xd'),'port':0x18eb});var socket=require(_0x38d3('0xe'))(new Redis(config[_0x38d3('0xb')]));require(_0x38d3('0xf'))[_0x38d3('0x10')](socket);function respondWithRpcPromise(_0x15b124,_0x4c6f81,_0x3090f8){return new BPromise(function(_0xbb2abd,_0x2335b2){return client[_0x38d3('0x11')](_0x15b124,_0x3090f8)['then'](function(_0x3d425b){logger[_0x38d3('0x12')](_0x38d3('0x13'),_0x4c6f81,_0x38d3('0x14'));logger[_0x38d3('0x15')](_0x38d3('0x16'),_0x4c6f81,'request\x20sent',JSON[_0x38d3('0x17')](_0x3d425b));if(_0x3d425b[_0x38d3('0x18')]){if(_0x3d425b[_0x38d3('0x18')][_0x38d3('0x19')]===0x1f4){logger[_0x38d3('0x18')]('FaxAccount,\x20%s,\x20%s',_0x4c6f81,_0x3d425b[_0x38d3('0x18')][_0x38d3('0x1a')]);return _0x2335b2(_0x3d425b[_0x38d3('0x18')][_0x38d3('0x1a')]);}logger[_0x38d3('0x18')](_0x38d3('0x13'),_0x4c6f81,_0x3d425b[_0x38d3('0x18')][_0x38d3('0x1a')]);return _0xbb2abd(_0x3d425b[_0x38d3('0x18')][_0x38d3('0x1a')]);}else{logger['info'](_0x38d3('0x13'),_0x4c6f81,_0x38d3('0x14'));_0xbb2abd(_0x3d425b[_0x38d3('0x1b')][_0x38d3('0x1a')]);}})[_0x38d3('0x1c')](function(_0x3d0003){logger['error'](_0x38d3('0x13'),_0x4c6f81,_0x3d0003);_0x2335b2(_0x3d0003);});});}exports[_0x38d3('0x1d')]=function(_0x125b6b){var _0x594051=this;return new Promise(function(_0x45c699,_0x1835eb){return db['FaxAccount'][_0x38d3('0x1e')]({'raw':_0x125b6b[_0x38d3('0x1f')]?_0x125b6b[_0x38d3('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x125b6b[_0x38d3('0x1f')]?_0x125b6b[_0x38d3('0x1f')][_0x38d3('0x20')]||null:null,'attributes':_0x125b6b[_0x38d3('0x1f')]?_0x125b6b[_0x38d3('0x1f')][_0x38d3('0x21')]||null:null,'limit':_0x125b6b[_0x38d3('0x1f')]?_0x125b6b['options'][_0x38d3('0x22')]||null:null,'include':_0x125b6b[_0x38d3('0x1f')]?_0x125b6b[_0x38d3('0x1f')][_0x38d3('0x23')]?_['map'](_0x125b6b[_0x38d3('0x1f')][_0x38d3('0x23')],function(_0x679959){return{'model':db[_0x679959['model']],'as':_0x679959['as'],'attributes':_0x679959[_0x38d3('0x21')],'include':_0x679959[_0x38d3('0x23')]?_['map'](_0x679959[_0x38d3('0x23')],function(_0x15b041){return{'model':db[_0x15b041[_0x38d3('0x24')]],'as':_0x15b041['as'],'attributes':_0x15b041[_0x38d3('0x21')],'include':_0x15b041['include']?_['map'](_0x15b041['include'],function(_0x2a3715){return{'model':db[_0x2a3715[_0x38d3('0x24')]],'as':_0x2a3715['as'],'attributes':_0x2a3715[_0x38d3('0x21')]};}):[]};}):[]};}):[]:[]})[_0x38d3('0x25')](function(_0x2b0f30){logger['info'](_0x38d3('0x1d'),_0x125b6b);logger['debug'](_0x38d3('0x1d'),_0x125b6b,JSON[_0x38d3('0x17')](_0x2b0f30));_0x45c699(_0x2b0f30);})[_0x38d3('0x1c')](function(_0x148b61){logger[_0x38d3('0x18')](_0x38d3('0x1d'),_0x148b61['message'],_0x125b6b);_0x1835eb(_0x594051[_0x38d3('0x18')](0x1f4,_0x148b61[_0x38d3('0x1a')]));});});};exports['NotifyFaxAccount']=function(_0x1c2846,_0x9ae969,_0x3ab3b6){var _0x430c0c=this;return new Promise(function(_0x335b73,_0x5d0a9f){var _0x4d6674={'body':_0x1c2846[_0x38d3('0x26')],'channel':'fax'};var _0x4ab240=[];var _0x21d12b=[];var _0xb2c402={};return db[_0x38d3('0x27')]['describe']()[_0x38d3('0x25')](function(_0x2a50a5){if(!_0x2a50a5){throw new db[(_0x38d3('0x28'))]['ValidationError'](_0x38d3('0x29'));}_0x4ab240=_['difference'](_['keys'](_0x2a50a5),['createdAt',_0x38d3('0x2a')]);_0x21d12b=_[_0x38d3('0x2b')](_[_0x38d3('0x2c')](_0x2a50a5),[_0x38d3('0x2d'),_0x38d3('0x2a'),'CompanyId',_0x38d3('0x2e')]);if(_0x1c2846[_0x38d3('0x26')]['id']){delete _0x1c2846['body']['id'];}if(_[_0x38d3('0x2f')](_0x1c2846[_0x38d3('0x26')]['from'])){throw new db[(_0x38d3('0x28'))][(_0x38d3('0x30'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x1c2846[_0x38d3('0x26')]['body'])||_0x1c2846[_0x38d3('0x26')]['body']===''){throw new db[(_0x38d3('0x28'))]['ValidationError'](_0x38d3('0x31'));}if(_[_0x38d3('0x2f')](_0x1c2846[_0x38d3('0x26')]['mapKey'])){throw new db[(_0x38d3('0x28'))][(_0x38d3('0x30'))](_0x38d3('0x32')+_0x21d12b);}if(!_[_0x38d3('0x33')](_0x21d12b,_0x1c2846['body']['mapKey'])){throw new db[(_0x38d3('0x28'))][(_0x38d3('0x30'))](_0x38d3('0x34')+_0x21d12b);}_0xb2c402[_0x1c2846['body'][_0x38d3('0x35')]]=_0x1c2846[_0x38d3('0x26')]['from'];})['then'](function(){return db[_0x38d3('0x36')]['find']({'where':{'id':_0x1c2846['account']['id']},'include':[{'model':db[_0x38d3('0x37')],'as':'List','include':[{'model':db['CmContact'],'as':_0x38d3('0x38'),'where':_0xb2c402,'limit':0x1,'order':[[_0x38d3('0x2a'),_0x38d3('0x39')]]}]},{'model':db[_0x38d3('0x3a')],'as':_0x38d3('0x3b')}]});})[_0x38d3('0x25')](function(_0x5f3e41){if(_0x5f3e41&&_0x5f3e41[_0x38d3('0x3c')]){var _0x19e4c0=_0x5f3e41[_0x38d3('0x3d')]({'plain':!![]});_0x4d6674[_0x38d3('0x3e')]=_0x19e4c0;_0x4d6674[_0x38d3('0x3f')]=_0x19e4c0[_0x38d3('0x3b')];_0x4d6674['list']=_0x19e4c0['List'];_0x4d6674[_0x38d3('0x3f')]=_[_0x38d3('0x40')](_0x4d6674[_0x38d3('0x3f')],[_0x38d3('0x41')],[_0x38d3('0x42')]);if(_0x4d6674[_0x38d3('0x3e')][_0x38d3('0x3b')]){delete _0x4d6674[_0x38d3('0x3e')][_0x38d3('0x3b')];}if(_0x4d6674[_0x38d3('0x3e')][_0x38d3('0x3c')]&&_0x4d6674['account'][_0x38d3('0x3c')][_0x38d3('0x38')][_0x38d3('0x43')]){return _0x4d6674[_0x38d3('0x3e')][_0x38d3('0x3c')][_0x38d3('0x38')][0x0];}var _0xcc12b3=_[_0x38d3('0xc')](_0x1c2846[_0x38d3('0x26')],{'firstName':_0x1c2846[_0x38d3('0x26')][_0x38d3('0x44')],'ListId':_0x19e4c0[_0x38d3('0x2e')]});_0xcc12b3[_0x1c2846[_0x38d3('0x26')][_0x38d3('0x35')]]=_0x1c2846[_0x38d3('0x26')][_0x38d3('0x44')];return db[_0x38d3('0x27')][_0x38d3('0x45')](_0xcc12b3,{'fields':_0x4ab240,'raw':!![]});}})[_0x38d3('0x25')](function(_0x2d096d){_0x4d6674[_0x38d3('0x46')]=_0x2d096d;if(_0x2d096d){var _0x382666={'ContactId':_0x2d096d['id'],'FaxAccountId':_0x1c2846[_0x38d3('0x3e')]['id'],'fax':_0x2d096d[_0x38d3('0x47')]};return db[_0x38d3('0x48')][_0x38d3('0x49')]({'where':{'ContactId':_0x2d096d['id'],'closed':![],'FaxAccountId':_0x1c2846[_0x38d3('0x3e')]['id']}})[_0x38d3('0x25')](function(_0x287f23){if(_0x287f23){return[_0x287f23,![]];}return db[_0x38d3('0x48')][_0x38d3('0x45')](_0x382666)[_0x38d3('0x25')](function(_0xcb97df){return[_0xcb97df,!![]];});});}else{throw new Error(_0x38d3('0x4a'));}})['spread'](function(_0x3d2a3d,_0x260e9e){var _0x2da408=_0x3d2a3d[_0x38d3('0x3d')]({'plain':!![]});if(_0x260e9e){if(_0x4d6674[_0x38d3('0x3e')][_0x38d3('0x4b')]){_0x4d6674[_0x38d3('0x3f')][_0x38d3('0x4c')]({'id':0x0,'priority':_0x4d6674['applications']['length']+0x1,'app':_0x38d3('0x4d'),'appdata':_0x38d3('0x4e'),'interval':'*,*,*,*'});}_0x2da408[_0x38d3('0x4f')]=!![];}else{_0x2da408[_0x38d3('0x4f')]=![];}_0x4d6674[_0x38d3('0x50')]=_0x2da408;return db[_0x38d3('0x51')][_0x38d3('0x45')]({'body':_0x1c2846['body'][_0x38d3('0x26')],'FaxAccountId':_0x1c2846[_0x38d3('0x3e')]['id'],'FaxInteractionId':_0x3d2a3d['id'],'direction':'in','ContactId':_0x3d2a3d['ContactId'],'AttachmentId':_0x1c2846[_0x38d3('0x26')]['AttachmentId']});})['then'](function(_0x13e87b){_0x4d6674[_0x38d3('0x1a')]=_0x13e87b;if(_0x4d6674[_0x38d3('0x50')][_0x38d3('0x52')]){return db[_0x38d3('0x53')][_0x38d3('0x49')]({'attributes':['id',_0x38d3('0x54')],'where':{'id':_0x4d6674[_0x38d3('0x50')][_0x38d3('0x52')]}})['then'](function(_0x461c64){if(_0x461c64){_0x4d6674['applications'][_0x38d3('0x55')]({'id':0x0,'priority':0x0,'app':_0x38d3('0x56'),'appdata':_0x461c64[_0x38d3('0x54')]+','+(_0x4d6674[_0x38d3('0x3e')]['waitForTheAssignedAgent']||0xa),'interval':_0x38d3('0x57')});}return respondWithRpcPromise('Start',_0x38d3('0x58'),_0x4d6674);});}return respondWithRpcPromise(_0x38d3('0x59'),_0x38d3('0x58'),_0x4d6674);})['then'](function(_0x581787){_0x335b73(_0x581787);})['catch'](function(_0x2d88a7){_0x5d0a9f(_0x430c0c[_0x38d3('0x18')](0x1f4,_0x2d88a7[_0x38d3('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 2d8d1ff..778f3c4 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 _0xd456=['./faxAccount.events','save','remove','emit','register','length','faxAccount:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd456,0x17a));var _0x6d45=function(_0x4a4536,_0x492b4f){_0x4a4536=_0x4a4536-0x0;var _0x3d9b6a=_0xd456[_0x4a4536];return _0x3d9b6a;};'use strict';var FaxAccountEvents=require(_0x6d45('0x0'));var events=[_0x6d45('0x1'),_0x6d45('0x2'),'update'];function createListener(_0x3e67a0,_0x111970){return function(_0x1b9111){_0x111970[_0x6d45('0x3')](_0x3e67a0,_0x1b9111);};}function removeListener(_0x405f9f,_0x456cfa){return function(){FaxAccountEvents['removeListener'](_0x405f9f,_0x456cfa);};}exports[_0x6d45('0x4')]=function(_0xd68235){for(var _0x5def61=0x0,_0x59b5e7=events[_0x6d45('0x5')];_0x5def61<_0x59b5e7;_0x5def61++){var _0x275126=events[_0x5def61];var _0x6a4348=createListener(_0x6d45('0x6')+_0x275126,_0xd68235);FaxAccountEvents['on'](_0x275126,_0x6a4348);}}; \ No newline at end of file +var _0x7ed4=['faxAccount:','./faxAccount.events','save','remove','emit','removeListener','register','length'];(function(_0x2aae45,_0x5d856e){var _0x22172b=function(_0x389a62){while(--_0x389a62){_0x2aae45['push'](_0x2aae45['shift']());}};_0x22172b(++_0x5d856e);}(_0x7ed4,0x79));var _0x47ed=function(_0x51b80a,_0x355fe3){_0x51b80a=_0x51b80a-0x0;var _0x22fdf0=_0x7ed4[_0x51b80a];return _0x22fdf0;};'use strict';var FaxAccountEvents=require(_0x47ed('0x0'));var events=[_0x47ed('0x1'),_0x47ed('0x2'),'update'];function createListener(_0x321498,_0x5ea98f){return function(_0x41797d){_0x5ea98f[_0x47ed('0x3')](_0x321498,_0x41797d);};}function removeListener(_0x4f0887,_0x20232a){return function(){FaxAccountEvents[_0x47ed('0x4')](_0x4f0887,_0x20232a);};}exports[_0x47ed('0x5')]=function(_0x4749b6){for(var _0xf5fc6e=0x0,_0x1716fe=events[_0x47ed('0x6')];_0xf5fc6e<_0x1716fe;_0xf5fc6e++){var _0xba7d7e=events[_0xf5fc6e];var _0x1c369a=createListener(_0x47ed('0x7')+_0xba7d7e,_0x4749b6);FaxAccountEvents['on'](_0xba7d7e,_0x1c369a);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 545e778..0df698f 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(_0x34c03b,_0x3a85c9){var _0x2e5517=function(_0x19f947){while(--_0x19f947){_0x34c03b['push'](_0x34c03b['shift']());}};_0x2e5517(++_0x3a85c9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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(_0x5bfc72,_0x959e59){var _0x11fe83=function(_0x51cbb9){while(--_0x51cbb9){_0x5bfc72['push'](_0x5bfc72['shift']());}};_0x11fe83(++_0x959e59);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'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 0a9baf0..8579674 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 _0xf86a=['exports','INTEGER','STRING','noop','*,*,*,*','sequelize'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0xf86a,0x131));var _0xaf86=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xf86a[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0xaf86('0x0'));module[_0xaf86('0x1')]={'priority':{'type':Sequelize[_0xaf86('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xaf86('0x3')],'allowNull':![],'defaultValue':_0xaf86('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xaf86('0x3')]},'interval':{'type':Sequelize[_0xaf86('0x3')],'defaultValue':_0xaf86('0x5')}}; \ No newline at end of file +var _0x9915=['STRING','noop','TEXT','*,*,*,*','exports','INTEGER'];(function(_0x39df5a,_0x151e63){var _0x4cc398=function(_0xe956af){while(--_0xe956af){_0x39df5a['push'](_0x39df5a['shift']());}};_0x4cc398(++_0x151e63);}(_0x9915,0xd6));var _0x5991=function(_0x1b597f,_0x48c352){_0x1b597f=_0x1b597f-0x0;var _0x6758f9=_0x9915[_0x1b597f];return _0x6758f9;};'use strict';var Sequelize=require('sequelize');module[_0x5991('0x0')]={'priority':{'type':Sequelize[_0x5991('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x5991('0x2')],'allowNull':![],'defaultValue':_0x5991('0x3')},'appdata':{'type':Sequelize[_0x5991('0x4')]()},'description':{'type':Sequelize[_0x5991('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x5991('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 2ef08f5..3364a34 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 _0x7e12=['create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','save','update','then','sendStatus','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','keys','filters','intersection','fields','query','attributes','length','model','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch'];(function(_0x395667,_0x45593a){var _0x5cdb8f=function(_0x2be0fd){while(--_0x2be0fd){_0x395667['push'](_0x395667['shift']());}};_0x5cdb8f(++_0x45593a);}(_0x7e12,0x184));var _0x27e1=function(_0x3d78d7,_0x44acea){_0x3d78d7=_0x3d78d7-0x0;var _0x4b6784=_0x7e12[_0x3d78d7];return _0x4b6784;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x27e1('0x0'));var zipdir=require(_0x27e1('0x1'));var jsonpatch=require(_0x27e1('0x2'));var rp=require(_0x27e1('0x3'));var moment=require(_0x27e1('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x27e1('0x5'));var path=require(_0x27e1('0x6'));var sox=require('sox');var csv=require(_0x27e1('0x7'));var ejs=require(_0x27e1('0x8'));var fs=require('fs');var fs_extra=require(_0x27e1('0x9'));var _=require(_0x27e1('0xa'));var squel=require('squel');var crypto=require(_0x27e1('0xb'));var jsforce=require(_0x27e1('0xc'));var deskjs=require(_0x27e1('0xd'));var toCsv=require(_0x27e1('0x7'));var querystring=require(_0x27e1('0xe'));var Papa=require(_0x27e1('0xf'));var Redis=require(_0x27e1('0x10'));var authService=require(_0x27e1('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x27e1('0x12'));var hardwareService=require(_0x27e1('0x13'));var logger=require(_0x27e1('0x14'))(_0x27e1('0x15'));var utils=require(_0x27e1('0x16'));var config=require(_0x27e1('0x17'));var licenseUtil=require(_0x27e1('0x18'));var db=require(_0x27e1('0x19'))['db'];function respondWithStatusCode(_0x269d2d,_0x1f4011){_0x1f4011=_0x1f4011||0xcc;return function(_0x39664b){if(_0x39664b){return _0x269d2d['sendStatus'](_0x1f4011);}return _0x269d2d['status'](_0x1f4011)[_0x27e1('0x1a')]();};}function respondWithResult(_0x142772,_0x184252){_0x184252=_0x184252||0xc8;return function(_0x3feaf7){if(_0x3feaf7){return _0x142772[_0x27e1('0x1b')](_0x184252)[_0x27e1('0x1c')](_0x3feaf7);}};}function respondWithFilteredResult(_0x2e5ab2,_0x56d968){return function(_0xe9023b){if(_0xe9023b){var _0x2b564b=typeof _0x56d968[_0x27e1('0x1d')]===_0x27e1('0x1e')&&typeof _0x56d968['limit']===_0x27e1('0x1e');var _0x3a062f=_0xe9023b['count'];var _0x56a0a6=_0x2b564b?0x0:_0x56d968['offset'];var _0x381363=_0x2b564b?_0xe9023b[_0x27e1('0x1f')]:_0x56d968[_0x27e1('0x1d')]+_0x56d968[_0x27e1('0x20')];var _0x1555b8;if(_0x381363>=_0x3a062f){_0x381363=_0x3a062f;_0x1555b8=0xc8;}else{_0x1555b8=0xce;}_0x2e5ab2[_0x27e1('0x1b')](_0x1555b8);return _0x2e5ab2[_0x27e1('0x21')](_0x27e1('0x22'),_0x56a0a6+'-'+_0x381363+'/'+_0x3a062f)[_0x27e1('0x1c')](_0xe9023b);}return null;};}function patchUpdates(_0x1cd43c){return function(_0xa1091b){try{jsonpatch['apply'](_0xa1091b,_0x1cd43c,!![]);}catch(_0x2e6e1f){return BPromise['reject'](_0x2e6e1f);}return _0xa1091b[_0x27e1('0x23')]();};}function saveUpdates(_0x3d90be,_0x72daba){return function(_0x50c249){if(_0x50c249){return _0x50c249[_0x27e1('0x24')](_0x3d90be)[_0x27e1('0x25')](function(_0x12ce9f){return _0x12ce9f;});}return null;};}function removeEntity(_0x399a4,_0x43d960){return function(_0x1d22c0){if(_0x1d22c0){return _0x1d22c0['destroy']()['then'](function(){_0x399a4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a58f1,_0x5aa714){return function(_0x4c4bab){if(!_0x4c4bab){_0x2a58f1[_0x27e1('0x26')](0x194);}return _0x4c4bab;};}function handleError(_0xb4827c,_0xc8d809){_0xc8d809=_0xc8d809||0x1f4;return function(_0x17591c){logger[_0x27e1('0x27')](_0x17591c[_0x27e1('0x28')]);if(_0x17591c[_0x27e1('0x29')]){delete _0x17591c[_0x27e1('0x29')];}_0xb4827c['status'](_0xc8d809)[_0x27e1('0x2a')](_0x17591c);};}exports[_0x27e1('0x2b')]=function(_0x26e268,_0x16a039){var _0x1faabc={},_0x5b5494={},_0xb2edaa={'count':0x0,'rows':[]};var _0x10205=_[_0x27e1('0x2c')](db[_0x27e1('0x2d')][_0x27e1('0x2e')],function(_0x897985){return{'name':_0x897985[_0x27e1('0x2f')],'type':_0x897985[_0x27e1('0x30')][_0x27e1('0x31')]};});_0x5b5494['model']=_[_0x27e1('0x2c')](_0x10205,'name');_0x5b5494['query']=_[_0x27e1('0x32')](_0x26e268['query']);_0x5b5494[_0x27e1('0x33')]=_[_0x27e1('0x34')](_0x5b5494['model'],_0x5b5494['query']);_0x1faabc['attributes']=_['intersection'](_0x5b5494['model'],qs[_0x27e1('0x35')](_0x26e268[_0x27e1('0x36')]['fields']));_0x1faabc[_0x27e1('0x37')]=_0x1faabc[_0x27e1('0x37')][_0x27e1('0x38')]?_0x1faabc[_0x27e1('0x37')]:_0x5b5494[_0x27e1('0x39')];if(!_0x26e268[_0x27e1('0x36')][_0x27e1('0x3a')](_0x27e1('0x3b'))){_0x1faabc['limit']=qs[_0x27e1('0x20')](_0x26e268['query'][_0x27e1('0x20')]);_0x1faabc[_0x27e1('0x1d')]=qs[_0x27e1('0x1d')](_0x26e268['query']['offset']);}_0x1faabc[_0x27e1('0x3c')]=qs[_0x27e1('0x3d')](_0x26e268[_0x27e1('0x36')][_0x27e1('0x3d')]);_0x1faabc[_0x27e1('0x3e')]=qs[_0x27e1('0x33')](_['pick'](_0x26e268[_0x27e1('0x36')],_0x5b5494[_0x27e1('0x33')]),_0x10205);if(_0x26e268[_0x27e1('0x36')][_0x27e1('0x3f')]){_0x1faabc[_0x27e1('0x3e')]=_[_0x27e1('0x40')](_0x1faabc[_0x27e1('0x3e')],{'$or':_[_0x27e1('0x2c')](_0x10205,function(_0x26223b){if(_0x26223b[_0x27e1('0x30')]!==_0x27e1('0x41')){var _0x5257dd={};_0x5257dd[_0x26223b[_0x27e1('0x29')]]={'$like':'%'+_0x26e268['query'][_0x27e1('0x3f')]+'%'};return _0x5257dd;}})});}_0x1faabc=_[_0x27e1('0x40')]({},_0x1faabc,_0x26e268[_0x27e1('0x42')]);var _0x17fd8c={'where':_0x1faabc[_0x27e1('0x3e')]};return db['FaxApplication'][_0x27e1('0x1f')](_0x17fd8c)[_0x27e1('0x25')](function(_0x49b3dc){_0xb2edaa['count']=_0x49b3dc;if(_0x26e268[_0x27e1('0x36')][_0x27e1('0x43')]){_0x1faabc[_0x27e1('0x44')]=[{'all':!![]}];}return db[_0x27e1('0x2d')][_0x27e1('0x45')](_0x1faabc);})[_0x27e1('0x25')](function(_0x1de283){_0xb2edaa['rows']=_0x1de283;return _0xb2edaa;})['then'](respondWithFilteredResult(_0x16a039,_0x1faabc))['catch'](handleError(_0x16a039,null));};exports[_0x27e1('0x46')]=function(_0xa7d004,_0x29b5fd){var _0x2907da={'raw':!![],'where':{'id':_0xa7d004[_0x27e1('0x47')]['id']}},_0x74d46f={};_0x74d46f[_0x27e1('0x39')]=_[_0x27e1('0x32')](db['FaxApplication']['rawAttributes']);_0x74d46f[_0x27e1('0x36')]=_[_0x27e1('0x32')](_0xa7d004[_0x27e1('0x36')]);_0x74d46f[_0x27e1('0x33')]=_[_0x27e1('0x34')](_0x74d46f[_0x27e1('0x39')],_0x74d46f[_0x27e1('0x36')]);_0x2907da['attributes']=_['intersection'](_0x74d46f[_0x27e1('0x39')],qs[_0x27e1('0x35')](_0xa7d004[_0x27e1('0x36')]['fields']));_0x2907da[_0x27e1('0x37')]=_0x2907da[_0x27e1('0x37')]['length']?_0x2907da[_0x27e1('0x37')]:_0x74d46f['model'];if(_0xa7d004[_0x27e1('0x36')]['includeAll']){_0x2907da[_0x27e1('0x44')]=[{'all':!![]}];}_0x2907da=_[_0x27e1('0x40')]({},_0x2907da,_0xa7d004['options']);return db[_0x27e1('0x2d')][_0x27e1('0x48')](_0x2907da)[_0x27e1('0x25')](handleEntityNotFound(_0x29b5fd,null))[_0x27e1('0x25')](respondWithResult(_0x29b5fd,null))[_0x27e1('0x49')](handleError(_0x29b5fd,null));};exports[_0x27e1('0x4a')]=function(_0x1b62d4,_0x201857){return db['FaxApplication']['create'](_0x1b62d4[_0x27e1('0x4b')],{})[_0x27e1('0x25')](respondWithResult(_0x201857,0xc9))['catch'](handleError(_0x201857,null));};exports['update']=function(_0x4b1122,_0x46f9f9){if(_0x4b1122[_0x27e1('0x4b')]['id']){delete _0x4b1122[_0x27e1('0x4b')]['id'];}return db[_0x27e1('0x2d')]['find']({'where':{'id':_0x4b1122['params']['id']}})[_0x27e1('0x25')](handleEntityNotFound(_0x46f9f9,null))['then'](saveUpdates(_0x4b1122['body'],null))['then'](respondWithResult(_0x46f9f9,null))['catch'](handleError(_0x46f9f9,null));};exports[_0x27e1('0x4c')]=function(_0x3c78e8,_0x4edba2){return db[_0x27e1('0x2d')][_0x27e1('0x48')]({'where':{'id':_0x3c78e8[_0x27e1('0x47')]['id']}})[_0x27e1('0x25')](handleEntityNotFound(_0x4edba2,null))[_0x27e1('0x25')](removeEntity(_0x4edba2,null))[_0x27e1('0x49')](handleError(_0x4edba2,null));}; \ No newline at end of file +var _0x1522=['name','send','index','map','FaxApplication','type','query','keys','attributes','intersection','model','fields','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','then','include','findAll','rows','catch','params','includeAll','find','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','error','stack'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x1522,0xac));var _0x2152=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1522[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2152('0x0'));var zipdir=require(_0x2152('0x1'));var jsonpatch=require(_0x2152('0x2'));var rp=require('request-promise');var moment=require(_0x2152('0x3'));var BPromise=require(_0x2152('0x4'));var Mustache=require(_0x2152('0x5'));var util=require('util');var path=require('path');var sox=require(_0x2152('0x6'));var csv=require(_0x2152('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2152('0x8'));var _=require('lodash');var squel=require(_0x2152('0x9'));var crypto=require(_0x2152('0xa'));var jsforce=require(_0x2152('0xb'));var deskjs=require(_0x2152('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2152('0xd'));var Redis=require('ioredis');var authService=require(_0x2152('0xe'));var qs=require(_0x2152('0xf'));var as=require(_0x2152('0x10'));var hardwareService=require(_0x2152('0x11'));var logger=require(_0x2152('0x12'))(_0x2152('0x13'));var utils=require('../../config/utils');var config=require(_0x2152('0x14'));var licenseUtil=require(_0x2152('0x15'));var db=require(_0x2152('0x16'))['db'];function respondWithStatusCode(_0x1bb5c9,_0x541839){_0x541839=_0x541839||0xcc;return function(_0x17a39a){if(_0x17a39a){return _0x1bb5c9[_0x2152('0x17')](_0x541839);}return _0x1bb5c9[_0x2152('0x18')](_0x541839)[_0x2152('0x19')]();};}function respondWithResult(_0x481e4e,_0x1b7d89){_0x1b7d89=_0x1b7d89||0xc8;return function(_0x4be4aa){if(_0x4be4aa){return _0x481e4e[_0x2152('0x18')](_0x1b7d89)[_0x2152('0x1a')](_0x4be4aa);}};}function respondWithFilteredResult(_0x3f92a8,_0x29a0f4){return function(_0x422820){if(_0x422820){var _0x117be4=typeof _0x29a0f4[_0x2152('0x1b')]===_0x2152('0x1c')&&typeof _0x29a0f4[_0x2152('0x1d')]===_0x2152('0x1c');var _0x2a85cf=_0x422820[_0x2152('0x1e')];var _0x35a79d=_0x117be4?0x0:_0x29a0f4[_0x2152('0x1b')];var _0x52b0e6=_0x117be4?_0x422820['count']:_0x29a0f4[_0x2152('0x1b')]+_0x29a0f4[_0x2152('0x1d')];var _0x19bd48;if(_0x52b0e6>=_0x2a85cf){_0x52b0e6=_0x2a85cf;_0x19bd48=0xc8;}else{_0x19bd48=0xce;}_0x3f92a8[_0x2152('0x18')](_0x19bd48);return _0x3f92a8['set'](_0x2152('0x1f'),_0x35a79d+'-'+_0x52b0e6+'/'+_0x2a85cf)[_0x2152('0x1a')](_0x422820);}return null;};}function patchUpdates(_0x5d699e){return function(_0x4d9390){try{jsonpatch['apply'](_0x4d9390,_0x5d699e,!![]);}catch(_0x3c3c56){return BPromise[_0x2152('0x20')](_0x3c3c56);}return _0x4d9390[_0x2152('0x21')]();};}function saveUpdates(_0x48d86e,_0x26a261){return function(_0x199abe){if(_0x199abe){return _0x199abe[_0x2152('0x22')](_0x48d86e)['then'](function(_0x2d063a){return _0x2d063a;});}return null;};}function removeEntity(_0x5d7227,_0x57af30){return function(_0x3694eb){if(_0x3694eb){return _0x3694eb[_0x2152('0x23')]()['then'](function(){_0x5d7227[_0x2152('0x18')](0xcc)[_0x2152('0x19')]();});}};}function handleEntityNotFound(_0x1d4eb3,_0x4395ff){return function(_0xfa7527){if(!_0xfa7527){_0x1d4eb3[_0x2152('0x17')](0x194);}return _0xfa7527;};}function handleError(_0x387cc8,_0x154ca9){_0x154ca9=_0x154ca9||0x1f4;return function(_0x4cd7df){logger[_0x2152('0x24')](_0x4cd7df[_0x2152('0x25')]);if(_0x4cd7df['name']){delete _0x4cd7df[_0x2152('0x26')];}_0x387cc8[_0x2152('0x18')](_0x154ca9)[_0x2152('0x27')](_0x4cd7df);};}exports[_0x2152('0x28')]=function(_0x36a132,_0x426cc8){var _0x40f83c={},_0x4dd3e5={},_0x51abc3={'count':0x0,'rows':[]};var _0x254ae6=_[_0x2152('0x29')](db[_0x2152('0x2a')]['rawAttributes'],function(_0x568c6d){return{'name':_0x568c6d['fieldName'],'type':_0x568c6d[_0x2152('0x2b')]['key']};});_0x4dd3e5['model']=_[_0x2152('0x29')](_0x254ae6,_0x2152('0x26'));_0x4dd3e5[_0x2152('0x2c')]=_[_0x2152('0x2d')](_0x36a132['query']);_0x4dd3e5['filters']=_['intersection'](_0x4dd3e5['model'],_0x4dd3e5[_0x2152('0x2c')]);_0x40f83c[_0x2152('0x2e')]=_[_0x2152('0x2f')](_0x4dd3e5[_0x2152('0x30')],qs[_0x2152('0x31')](_0x36a132[_0x2152('0x2c')][_0x2152('0x31')]));_0x40f83c[_0x2152('0x2e')]=_0x40f83c[_0x2152('0x2e')][_0x2152('0x32')]?_0x40f83c[_0x2152('0x2e')]:_0x4dd3e5[_0x2152('0x30')];if(!_0x36a132[_0x2152('0x2c')]['hasOwnProperty'](_0x2152('0x33'))){_0x40f83c[_0x2152('0x1d')]=qs['limit'](_0x36a132['query'][_0x2152('0x1d')]);_0x40f83c[_0x2152('0x1b')]=qs[_0x2152('0x1b')](_0x36a132[_0x2152('0x2c')]['offset']);}_0x40f83c['order']=qs[_0x2152('0x34')](_0x36a132[_0x2152('0x2c')][_0x2152('0x34')]);_0x40f83c[_0x2152('0x35')]=qs[_0x2152('0x36')](_[_0x2152('0x37')](_0x36a132[_0x2152('0x2c')],_0x4dd3e5['filters']),_0x254ae6);if(_0x36a132['query'][_0x2152('0x38')]){_0x40f83c[_0x2152('0x35')]=_[_0x2152('0x39')](_0x40f83c['where'],{'$or':_[_0x2152('0x29')](_0x254ae6,function(_0x410743){if(_0x410743[_0x2152('0x2b')]!==_0x2152('0x3a')){var _0x1d31fb={};_0x1d31fb[_0x410743[_0x2152('0x26')]]={'$like':'%'+_0x36a132[_0x2152('0x2c')][_0x2152('0x38')]+'%'};return _0x1d31fb;}})});}_0x40f83c=_[_0x2152('0x39')]({},_0x40f83c,_0x36a132[_0x2152('0x3b')]);var _0xfa9a24={'where':_0x40f83c[_0x2152('0x35')]};return db['FaxApplication'][_0x2152('0x1e')](_0xfa9a24)[_0x2152('0x3c')](function(_0x24f64d){_0x51abc3[_0x2152('0x1e')]=_0x24f64d;if(_0x36a132['query']['includeAll']){_0x40f83c[_0x2152('0x3d')]=[{'all':!![]}];}return db[_0x2152('0x2a')][_0x2152('0x3e')](_0x40f83c);})[_0x2152('0x3c')](function(_0x1dde47){_0x51abc3[_0x2152('0x3f')]=_0x1dde47;return _0x51abc3;})[_0x2152('0x3c')](respondWithFilteredResult(_0x426cc8,_0x40f83c))[_0x2152('0x40')](handleError(_0x426cc8,null));};exports['show']=function(_0x1b7063,_0x1345af){var _0x440e5c={'raw':!![],'where':{'id':_0x1b7063[_0x2152('0x41')]['id']}},_0x6fa5eb={};_0x6fa5eb[_0x2152('0x30')]=_[_0x2152('0x2d')](db[_0x2152('0x2a')]['rawAttributes']);_0x6fa5eb['query']=_[_0x2152('0x2d')](_0x1b7063[_0x2152('0x2c')]);_0x6fa5eb[_0x2152('0x36')]=_['intersection'](_0x6fa5eb[_0x2152('0x30')],_0x6fa5eb['query']);_0x440e5c[_0x2152('0x2e')]=_[_0x2152('0x2f')](_0x6fa5eb[_0x2152('0x30')],qs[_0x2152('0x31')](_0x1b7063[_0x2152('0x2c')][_0x2152('0x31')]));_0x440e5c['attributes']=_0x440e5c[_0x2152('0x2e')][_0x2152('0x32')]?_0x440e5c[_0x2152('0x2e')]:_0x6fa5eb[_0x2152('0x30')];if(_0x1b7063['query'][_0x2152('0x42')]){_0x440e5c[_0x2152('0x3d')]=[{'all':!![]}];}_0x440e5c=_[_0x2152('0x39')]({},_0x440e5c,_0x1b7063['options']);return db[_0x2152('0x2a')][_0x2152('0x43')](_0x440e5c)['then'](handleEntityNotFound(_0x1345af,null))[_0x2152('0x3c')](respondWithResult(_0x1345af,null))[_0x2152('0x40')](handleError(_0x1345af,null));};exports[_0x2152('0x44')]=function(_0x47f98c,_0x462e6d){return db[_0x2152('0x2a')][_0x2152('0x44')](_0x47f98c[_0x2152('0x45')],{})['then'](respondWithResult(_0x462e6d,0xc9))[_0x2152('0x40')](handleError(_0x462e6d,null));};exports['update']=function(_0x16f1a4,_0x10fe91){if(_0x16f1a4[_0x2152('0x45')]['id']){delete _0x16f1a4['body']['id'];}return db[_0x2152('0x2a')][_0x2152('0x43')]({'where':{'id':_0x16f1a4[_0x2152('0x41')]['id']}})['then'](handleEntityNotFound(_0x10fe91,null))[_0x2152('0x3c')](saveUpdates(_0x16f1a4[_0x2152('0x45')],null))[_0x2152('0x3c')](respondWithResult(_0x10fe91,null))[_0x2152('0x40')](handleError(_0x10fe91,null));};exports[_0x2152('0x23')]=function(_0x4e4314,_0x2c3a78){return db[_0x2152('0x2a')]['find']({'where':{'id':_0x4e4314[_0x2152('0x41')]['id']}})[_0x2152('0x3c')](handleEntityNotFound(_0x2c3a78,null))[_0x2152('0x3c')](removeEntity(_0x2c3a78,null))[_0x2152('0x40')](handleError(_0x2c3a78,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 48813d0..04973ed 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 _0xa43d=['rimraf','../../config/environment','./faxApplication.attributes','exports','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x4fb38a,_0x36f5ba){var _0x17d645=function(_0x72edb0){while(--_0x72edb0){_0x4fb38a['push'](_0x4fb38a['shift']());}};_0x17d645(++_0x36f5ba);}(_0xa43d,0x8f));var _0xda43=function(_0x4df85c,_0x248dfb){_0x4df85c=_0x4df85c-0x0;var _0x4e2a61=_0xa43d[_0x4df85c];return _0x4e2a61;};'use strict';var _=require(_0xda43('0x0'));var util=require(_0xda43('0x1'));var logger=require(_0xda43('0x2'))('api');var moment=require(_0xda43('0x3'));var BPromise=require(_0xda43('0x4'));var rp=require(_0xda43('0x5'));var fs=require('fs');var path=require(_0xda43('0x6'));var rimraf=require(_0xda43('0x7'));var config=require(_0xda43('0x8'));var attributes=require(_0xda43('0x9'));module[_0xda43('0xa')]=function(_0x1fa2a9,_0x260741){return _0x1fa2a9['define'](_0xda43('0xb'),attributes,{'tableName':_0xda43('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xda43('0xd'),'collate':_0xda43('0xe')});}; \ No newline at end of file +var _0x8945=['path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5eb22e,_0x27cbac){var _0x27fed5=function(_0x565467){while(--_0x565467){_0x5eb22e['push'](_0x5eb22e['shift']());}};_0x27fed5(++_0x27cbac);}(_0x8945,0x1db));var _0x5894=function(_0x82ad62,_0x1a4fc9){_0x82ad62=_0x82ad62-0x0;var _0x39434e=_0x8945[_0x82ad62];return _0x39434e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5894('0x0'))(_0x5894('0x1'));var moment=require(_0x5894('0x2'));var BPromise=require(_0x5894('0x3'));var rp=require(_0x5894('0x4'));var fs=require('fs');var path=require(_0x5894('0x5'));var rimraf=require(_0x5894('0x6'));var config=require(_0x5894('0x7'));var attributes=require(_0x5894('0x8'));module[_0x5894('0x9')]=function(_0x28e4cf,_0x1ab8cb){return _0x28e4cf[_0x5894('0xa')](_0x5894('0xb'),attributes,{'tableName':_0x5894('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5894('0xd'),'collate':_0x5894('0xe')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index e12cfc3..3e150c3 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 _0x04e9=['update','body','options','raw','where','attributes','debug','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxApplication'];(function(_0x3540e7,_0x4d0dec){var _0x5a9d97=function(_0x5b7296){while(--_0x5b7296){_0x3540e7['push'](_0x3540e7['shift']());}};_0x5a9d97(++_0x4d0dec);}(_0x04e9,0x7b));var _0x904e=function(_0x4f3ff7,_0x53b299){_0x4f3ff7=_0x4f3ff7-0x0;var _0x1fc7f5=_0x04e9[_0x4f3ff7];return _0x1fc7f5;};'use strict';var _=require('lodash');var util=require(_0x904e('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x904e('0x1'));var fs=require('fs');var Redis=require(_0x904e('0x2'));var db=require(_0x904e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x904e('0x4'))(_0x904e('0x5'));var config=require(_0x904e('0x6'));var jayson=require(_0x904e('0x7'));var client=jayson['client'][_0x904e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1a08d8,_0x28e159,_0xfb02ff){return new BPromise(function(_0x1977dd,_0x429570){return client[_0x904e('0x9')](_0x1a08d8,_0xfb02ff)[_0x904e('0xa')](function(_0x524643){logger[_0x904e('0xb')](_0x904e('0xc'),_0x28e159,_0x904e('0xd'));logger['debug'](_0x904e('0xe'),_0x28e159,_0x904e('0xd'),JSON[_0x904e('0xf')](_0x524643));if(_0x524643[_0x904e('0x10')]){if(_0x524643[_0x904e('0x10')][_0x904e('0x11')]===0x1f4){logger[_0x904e('0x10')](_0x904e('0xc'),_0x28e159,_0x524643['error'][_0x904e('0x12')]);return _0x429570(_0x524643['error'][_0x904e('0x12')]);}logger[_0x904e('0x10')](_0x904e('0xc'),_0x28e159,_0x524643[_0x904e('0x10')]['message']);return _0x1977dd(_0x524643[_0x904e('0x10')][_0x904e('0x12')]);}else{logger['info'](_0x904e('0xc'),_0x28e159,_0x904e('0xd'));_0x1977dd(_0x524643[_0x904e('0x13')][_0x904e('0x12')]);}})[_0x904e('0x14')](function(_0x12d7b5){logger[_0x904e('0x10')](_0x904e('0xc'),_0x28e159,_0x12d7b5);_0x429570(_0x12d7b5);});});}exports[_0x904e('0x15')]=function(_0x49ec70){var _0x3ee07d=this;return new Promise(function(_0x18b8bf,_0xe99734){return db['FaxApplication'][_0x904e('0x16')](_0x49ec70[_0x904e('0x17')],{'raw':_0x49ec70[_0x904e('0x18')]?_0x49ec70[_0x904e('0x18')][_0x904e('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49ec70[_0x904e('0x18')]?_0x49ec70[_0x904e('0x18')][_0x904e('0x1a')]||null:null,'attributes':_0x49ec70[_0x904e('0x18')]?_0x49ec70[_0x904e('0x18')][_0x904e('0x1b')]||null:null,'limit':_0x49ec70[_0x904e('0x18')]?_0x49ec70[_0x904e('0x18')]['limit']||null:null})['then'](function(_0x190b0e){logger[_0x904e('0xb')](_0x904e('0x15'),_0x49ec70);logger[_0x904e('0x1c')](_0x904e('0x15'),_0x49ec70,JSON[_0x904e('0xf')](_0x190b0e));_0x18b8bf(_0x190b0e);})[_0x904e('0x14')](function(_0x261e12){logger[_0x904e('0x10')](_0x904e('0x15'),_0x261e12[_0x904e('0x12')],_0x49ec70);_0xe99734(_0x3ee07d[_0x904e('0x10')](0x1f4,_0x261e12['message']));});});}; \ No newline at end of file +var _0x3dff=['../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxApplication,\x20%s,\x20%s','message','result','catch','UpdateFaxApplication','FaxApplication','update','options','raw','where','attributes','limit','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x302973,_0x2d321a){var _0x4b26da=function(_0x593a3d){while(--_0x593a3d){_0x302973['push'](_0x302973['shift']());}};_0x4b26da(++_0x2d321a);}(_0x3dff,0x1bc));var _0xf3df=function(_0x37083f,_0x590ca0){_0x37083f=_0x37083f-0x0;var _0x5c717c=_0x3dff[_0x37083f];return _0x5c717c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xf3df('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf3df('0x1'));var db=require(_0xf3df('0x2'))['db'];var utils=require(_0xf3df('0x3'));var logger=require(_0xf3df('0x4'))(_0xf3df('0x5'));var config=require(_0xf3df('0x6'));var jayson=require(_0xf3df('0x7'));var client=jayson[_0xf3df('0x8')][_0xf3df('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2779b8,_0x558a12,_0x5ee88b){return new BPromise(function(_0x13577e,_0x3354a1){return client['request'](_0x2779b8,_0x5ee88b)[_0xf3df('0xa')](function(_0x172267){logger[_0xf3df('0xb')]('FaxApplication,\x20%s,\x20%s',_0x558a12,_0xf3df('0xc'));logger[_0xf3df('0xd')](_0xf3df('0xe'),_0x558a12,_0xf3df('0xc'),JSON[_0xf3df('0xf')](_0x172267));if(_0x172267[_0xf3df('0x10')]){if(_0x172267['error'][_0xf3df('0x11')]===0x1f4){logger[_0xf3df('0x10')](_0xf3df('0x12'),_0x558a12,_0x172267[_0xf3df('0x10')][_0xf3df('0x13')]);return _0x3354a1(_0x172267[_0xf3df('0x10')][_0xf3df('0x13')]);}logger['error'](_0xf3df('0x12'),_0x558a12,_0x172267[_0xf3df('0x10')][_0xf3df('0x13')]);return _0x13577e(_0x172267[_0xf3df('0x10')]['message']);}else{logger[_0xf3df('0xb')]('FaxApplication,\x20%s,\x20%s',_0x558a12,_0xf3df('0xc'));_0x13577e(_0x172267[_0xf3df('0x14')][_0xf3df('0x13')]);}})[_0xf3df('0x15')](function(_0x366fc6){logger[_0xf3df('0x10')](_0xf3df('0x12'),_0x558a12,_0x366fc6);_0x3354a1(_0x366fc6);});});}exports[_0xf3df('0x16')]=function(_0x589d26){var _0x428796=this;return new Promise(function(_0x3b98cc,_0x21b2b8){return db[_0xf3df('0x17')][_0xf3df('0x18')](_0x589d26['body'],{'raw':_0x589d26[_0xf3df('0x19')]?_0x589d26[_0xf3df('0x19')][_0xf3df('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x589d26[_0xf3df('0x19')]?_0x589d26[_0xf3df('0x19')][_0xf3df('0x1b')]||null:null,'attributes':_0x589d26[_0xf3df('0x19')]?_0x589d26[_0xf3df('0x19')][_0xf3df('0x1c')]||null:null,'limit':_0x589d26['options']?_0x589d26['options'][_0xf3df('0x1d')]||null:null})[_0xf3df('0xa')](function(_0x508dbf){logger[_0xf3df('0xb')](_0xf3df('0x16'),_0x589d26);logger[_0xf3df('0xd')](_0xf3df('0x16'),_0x589d26,JSON[_0xf3df('0xf')](_0x508dbf));_0x3b98cc(_0x508dbf);})[_0xf3df('0x15')](function(_0x105176){logger['error'](_0xf3df('0x16'),_0x105176[_0xf3df('0x13')],_0x589d26);_0x21b2b8(_0x428796[_0xf3df('0x10')](0x1f4,_0x105176[_0xf3df('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 93870d0..61edc98 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 _0xa571=['index','/:id','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated'];(function(_0x48605c,_0x1c9657){var _0x484cee=function(_0x55b67b){while(--_0x55b67b){_0x48605c['push'](_0x48605c['shift']());}};_0x484cee(++_0x1c9657);}(_0xa571,0x107));var _0x1a57=function(_0x1e2dd9,_0x49786f){_0x1e2dd9=_0x1e2dd9-0x0;var _0x5e3782=_0xa571[_0x1e2dd9];return _0x5e3782;};'use strict';var multer=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var path=require(_0x1a57('0x2'));var timeout=require(_0x1a57('0x3'));var express=require('express');var router=express[_0x1a57('0x4')]();var fs_extra=require(_0x1a57('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1a57('0x6'));var controller=require('./faxApplication.controller');router[_0x1a57('0x7')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0x9')]);router[_0x1a57('0x7')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller['show']);router[_0x1a57('0xb')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0xc')]);router['put'](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xd')]);router[_0x1a57('0xe')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xf')]);module[_0x1a57('0x10')]=router; \ No newline at end of file +var _0xe511=['/:id','isAuthenticated','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','index','show','post','put'];(function(_0x5ac165,_0xd01193){var _0x6a5996=function(_0x1d62f5){while(--_0x1d62f5){_0x5ac165['push'](_0x5ac165['shift']());}};_0x6a5996(++_0xd01193);}(_0xe511,0x16f));var _0x1e51=function(_0x41aaa5,_0x5d880b){_0x41aaa5=_0x41aaa5-0x0;var _0x35c60f=_0xe511[_0x41aaa5];return _0x35c60f;};'use strict';var multer=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var path=require('path');var timeout=require(_0x1e51('0x2'));var express=require('express');var router=express[_0x1e51('0x3')]();var fs_extra=require(_0x1e51('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1e51('0x5'));var config=require(_0x1e51('0x6'));var controller=require(_0x1e51('0x7'));router[_0x1e51('0x8')]('/',auth['isAuthenticated'](),controller[_0x1e51('0x9')]);router[_0x1e51('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x1e51('0xa')]);router[_0x1e51('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1e51('0xc')](_0x1e51('0xd'),auth[_0x1e51('0xe')](),controller[_0x1e51('0xf')]);router[_0x1e51('0x10')](_0x1e51('0xd'),auth['isAuthenticated'](),controller[_0x1e51('0x11')]);module[_0x1e51('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 74873bc..ceee845 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 _0xbd63=['DATE','ENUM','out','exports','STRING'];(function(_0x33837e,_0x507b2f){var _0xbcb7ab=function(_0x1b93c2){while(--_0x1b93c2){_0x33837e['push'](_0x33837e['shift']());}};_0xbcb7ab(++_0x507b2f);}(_0xbd63,0x99));var _0x3bd6=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xbd63[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require('sequelize');module[_0x3bd6('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x3bd6('0x1')]},'secondDisposition':{'type':Sequelize[_0x3bd6('0x1')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x3bd6('0x1')]},'read1stAt':{'type':Sequelize[_0x3bd6('0x2')]},'fax':{'type':Sequelize[_0x3bd6('0x1')]},'firstMsgDirection':{'type':Sequelize[_0x3bd6('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3bd6('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x3bd6('0x3')]('in',_0x3bd6('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x51ca=['BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x2a3896,_0x485e42){var _0x31d61c=function(_0x32e8dc){while(--_0x32e8dc){_0x2a3896['push'](_0x2a3896['shift']());}};_0x31d61c(++_0x485e42);}(_0x51ca,0x119));var _0xa51c=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x51ca[_0xaa1b3e];return _0x454d7d;};'use strict';var Sequelize=require(_0xa51c('0x0'));module['exports']={'closed':{'type':Sequelize[_0xa51c('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa51c('0x2')]},'disposition':{'type':Sequelize[_0xa51c('0x3')]},'secondDisposition':{'type':Sequelize[_0xa51c('0x3')]},'thirdDisposition':{'type':Sequelize[_0xa51c('0x3')]},'note':{'type':Sequelize[_0xa51c('0x3')]},'read1stAt':{'type':Sequelize[_0xa51c('0x2')]},'fax':{'type':Sequelize[_0xa51c('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xa51c('0x4')]('in',_0xa51c('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa51c('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xa51c('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 025269b..a4da984 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 _0x1f7f=['offset','undefined','limit','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','FaxInteraction','fieldName','type','key','getOptions','fax','catch','params','model','keys','attributes','fields','query','length','include','merge','options','find','create','body','describe','FaxMessage','addMessage','omit','ids','getMessages','findOne','rawAttributes','filters','intersection','nolimit','sort','where','pick','FaxInteractionId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','count','includeAll','addTags','setTags','spread','findAll','color','emit','removeTags','download','unix','toString','join','server','root','transcript-%d-%s.zip','Attachment','Messages','createdAt','get','mkdirSync','basename','createReadStream','pipe','createWriteStream','resolve','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','lodash','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','sendStatus','status','end','json'];(function(_0x528274,_0x836480){var _0x250bc7=function(_0x237640){while(--_0x237640){_0x528274['push'](_0x528274['shift']());}};_0x250bc7(++_0x836480);}(_0x1f7f,0x11b));var _0xf1f7=function(_0x174a72,_0x46034c){_0x174a72=_0x174a72-0x0;var _0x32cecd=_0x1f7f[_0x174a72];return _0x32cecd;};'use strict';var rimraf=require(_0xf1f7('0x0'));var zipdir=require(_0xf1f7('0x1'));var moment=require(_0xf1f7('0x2'));var BPromise=require(_0xf1f7('0x3'));var util=require(_0xf1f7('0x4'));var path=require('path');var fs=require('fs');var _=require(_0xf1f7('0x5'));var Redis=require('ioredis');var interaction=require(_0xf1f7('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0xf1f7('0x7'))(_0xf1f7('0x8'));var config=require(_0xf1f7('0x9'));var db=require(_0xf1f7('0xa'))['db'];config[_0xf1f7('0xb')]=_[_0xf1f7('0xc')](config['redis'],{'host':_0xf1f7('0xd'),'port':0x18eb});var socket=require(_0xf1f7('0xe'))(new Redis(config['redis']));require(_0xf1f7('0xf'))['register'](socket);function respondWithStatusCode(_0x13e13f,_0x2d3551){_0x2d3551=_0x2d3551||0xcc;return function(_0x269808){if(_0x269808){return _0x13e13f[_0xf1f7('0x10')](_0x2d3551);}return _0x13e13f[_0xf1f7('0x11')](_0x2d3551)[_0xf1f7('0x12')]();};}function respondWithResult(_0x71d971,_0x2e9b1e){_0x2e9b1e=_0x2e9b1e||0xc8;return function(_0x42463b){if(_0x42463b){return _0x71d971['status'](_0x2e9b1e)[_0xf1f7('0x13')](_0x42463b);}};}function respondWithFilteredResult(_0x279f2f,_0x38a8e1){return function(_0x125a3e){if(_0x125a3e){var _0x40e08e=typeof _0x38a8e1[_0xf1f7('0x14')]===_0xf1f7('0x15')&&typeof _0x38a8e1[_0xf1f7('0x16')]===_0xf1f7('0x15');var _0x4d745a=_0x125a3e['count'];var _0x34358f=_0x40e08e?0x0:_0x38a8e1[_0xf1f7('0x14')];var _0x49d69e=_0x40e08e?_0x125a3e['count']:_0x38a8e1[_0xf1f7('0x14')]+_0x38a8e1[_0xf1f7('0x16')];var _0x3baa5b;if(_0x49d69e>=_0x4d745a){_0x49d69e=_0x4d745a;_0x3baa5b=0xc8;}else{_0x3baa5b=0xce;}_0x279f2f[_0xf1f7('0x11')](_0x3baa5b);return _0x279f2f[_0xf1f7('0x17')](_0xf1f7('0x18'),_0x34358f+'-'+_0x49d69e+'/'+_0x4d745a)[_0xf1f7('0x13')](_0x125a3e);}return null;};}function saveUpdates(_0x7babf4){return function(_0x58fe74){if(_0x58fe74){return _0x58fe74[_0xf1f7('0x19')](_0x7babf4)[_0xf1f7('0x1a')](function(_0x15bb56){return _0x15bb56;});}return null;};}function removeEntity(_0x4e6275){return function(_0x3cab74){if(_0x3cab74){return _0x3cab74[_0xf1f7('0x1b')]()[_0xf1f7('0x1a')](function(){_0x4e6275[_0xf1f7('0x11')](0xcc)[_0xf1f7('0x12')]();});}};}function handleEntityNotFound(_0x209083){return function(_0x448511){if(!_0x448511){_0x209083[_0xf1f7('0x10')](0x194);}return _0x448511;};}function handleError(_0x374afd,_0x5c4f02){_0x5c4f02=_0x5c4f02||0x1f4;return function(_0x54caa8){logger[_0xf1f7('0x1c')](_0x54caa8[_0xf1f7('0x1d')]);if(_0x54caa8[_0xf1f7('0x1e')]){delete _0x54caa8[_0xf1f7('0x1e')];}_0x374afd[_0xf1f7('0x11')](_0x5c4f02)[_0xf1f7('0x1f')](_0x54caa8);};}exports[_0xf1f7('0x20')]=function(_0x2fb3ae,_0x19e7a9){var _0x3f87f4={};var _0x1b36f9=_[_0xf1f7('0x21')](db[_0xf1f7('0x22')]['rawAttributes'],function(_0x56dff){return{'name':_0x56dff[_0xf1f7('0x23')],'type':_0x56dff[_0xf1f7('0x24')][_0xf1f7('0x25')]};});_0x3f87f4=qs[_0xf1f7('0x26')](_0x1b36f9,_0x2fb3ae);return interaction['findAll'](_0xf1f7('0x27'),_0x2fb3ae['query'],_0x2fb3ae['user'],_0x3f87f4,_0x1b36f9)['then'](respondWithFilteredResult(_0x19e7a9,_0x3f87f4))[_0xf1f7('0x28')](handleError(_0x19e7a9,null));};exports['show']=function(_0x3f13fd,_0x528f00){var _0x4f15b9={'raw':![],'where':{'id':_0x3f13fd[_0xf1f7('0x29')]['id']}},_0x55af4a={};_0x55af4a[_0xf1f7('0x2a')]=_[_0xf1f7('0x2b')](db['FaxInteraction']['rawAttributes']);_0x55af4a['query']=_['keys'](_0x3f13fd['query']);_0x55af4a['filters']=_['intersection'](_0x55af4a[_0xf1f7('0x2a')],_0x55af4a['query']);_0x4f15b9[_0xf1f7('0x2c')]=_['intersection'](_0x55af4a[_0xf1f7('0x2a')],qs[_0xf1f7('0x2d')](_0x3f13fd[_0xf1f7('0x2e')][_0xf1f7('0x2d')]));_0x4f15b9['attributes']=_0x4f15b9['attributes'][_0xf1f7('0x2f')]?_0x4f15b9[_0xf1f7('0x2c')]:_0x55af4a[_0xf1f7('0x2a')];if(_0x3f13fd[_0xf1f7('0x2e')]['includeAll']){_0x4f15b9[_0xf1f7('0x30')]=[{'all':!![]}];}_0x4f15b9=_[_0xf1f7('0x31')]({},_0x4f15b9,_0x3f13fd[_0xf1f7('0x32')]);return db['FaxInteraction'][_0xf1f7('0x33')](_0x4f15b9)['then'](handleEntityNotFound(_0x528f00,null))[_0xf1f7('0x1a')](respondWithResult(_0x528f00,null))['catch'](handleError(_0x528f00,null));};exports[_0xf1f7('0x34')]=function(_0x26021b,_0x13ba54){return db['FaxInteraction'][_0xf1f7('0x34')](_0x26021b[_0xf1f7('0x35')],{})['then'](respondWithResult(_0x13ba54,0xc9))[_0xf1f7('0x28')](handleError(_0x13ba54,null));};exports[_0xf1f7('0x19')]=function(_0x7a224,_0x4dd90b){if(_0x7a224[_0xf1f7('0x35')]['id']){delete _0x7a224[_0xf1f7('0x35')]['id'];}return db['FaxInteraction'][_0xf1f7('0x33')]({'where':{'id':_0x7a224[_0xf1f7('0x29')]['id']}})['then'](handleEntityNotFound(_0x4dd90b,null))[_0xf1f7('0x1a')](saveUpdates(_0x7a224[_0xf1f7('0x35')],null))[_0xf1f7('0x1a')](respondWithResult(_0x4dd90b,null))['catch'](handleError(_0x4dd90b,null));};exports[_0xf1f7('0x1b')]=function(_0x57d354,_0x2d6efc){return db[_0xf1f7('0x22')][_0xf1f7('0x33')]({'where':{'id':_0x57d354[_0xf1f7('0x29')]['id']}})[_0xf1f7('0x1a')](handleEntityNotFound(_0x2d6efc,null))[_0xf1f7('0x1a')](removeEntity(_0x2d6efc,null))[_0xf1f7('0x28')](handleError(_0x2d6efc,null));};exports[_0xf1f7('0x36')]=function(_0x411bad,_0xc9795e){return db[_0xf1f7('0x22')][_0xf1f7('0x36')]()['then'](respondWithResult(_0xc9795e,null))[_0xf1f7('0x28')](handleError(_0xc9795e,null));};exports['addMessage']=function(_0x241033,_0x3d4983){return db[_0xf1f7('0x37')][_0xf1f7('0x33')]({'where':{'id':_0x241033[_0xf1f7('0x29')]['id']}})[_0xf1f7('0x1a')](handleEntityNotFound(_0x3d4983,null))[_0xf1f7('0x1a')](function(_0x4ca002){if(_0x4ca002){return _0x4ca002[_0xf1f7('0x38')](_0x241033['body']['ids'],_[_0xf1f7('0x39')](_0x241033[_0xf1f7('0x35')],[_0xf1f7('0x3a'),'id'])||{});}})['then'](respondWithResult(_0x3d4983,null))[_0xf1f7('0x28')](handleError(_0x3d4983,null));};exports[_0xf1f7('0x3b')]=function(_0x4077e1,_0xe9bb92){var _0x53fc52={'raw':![],'where':{}};var _0x9cb6b4={};var _0x1f48b4={'count':0x0,'rows':[]};return db['FaxInteraction'][_0xf1f7('0x3c')]({'where':{'id':_0x4077e1[_0xf1f7('0x29')]['id']}})['then'](handleEntityNotFound(_0xe9bb92,null))['then'](function(_0x17104c){if(_0x17104c){_0x9cb6b4['model']=_[_0xf1f7('0x2b')](db[_0xf1f7('0x37')][_0xf1f7('0x3d')]);_0x9cb6b4[_0xf1f7('0x2e')]=_[_0xf1f7('0x2b')](_0x4077e1[_0xf1f7('0x2e')]);_0x9cb6b4[_0xf1f7('0x3e')]=_[_0xf1f7('0x3f')](_0x9cb6b4[_0xf1f7('0x2a')],_0x9cb6b4[_0xf1f7('0x2e')]);_0x53fc52['attributes']=_['intersection'](_0x9cb6b4[_0xf1f7('0x2a')],qs[_0xf1f7('0x2d')](_0x4077e1[_0xf1f7('0x2e')][_0xf1f7('0x2d')]));_0x53fc52['attributes']=_0x53fc52[_0xf1f7('0x2c')][_0xf1f7('0x2f')]?_0x53fc52[_0xf1f7('0x2c')]:_0x9cb6b4[_0xf1f7('0x2a')];if(!_0x4077e1[_0xf1f7('0x2e')]['hasOwnProperty'](_0xf1f7('0x40'))){_0x53fc52[_0xf1f7('0x16')]=qs[_0xf1f7('0x16')](_0x4077e1[_0xf1f7('0x2e')][_0xf1f7('0x16')]);_0x53fc52[_0xf1f7('0x14')]=qs[_0xf1f7('0x14')](_0x4077e1[_0xf1f7('0x2e')][_0xf1f7('0x14')]);}_0x53fc52['order']=qs[_0xf1f7('0x41')](_0x4077e1[_0xf1f7('0x2e')][_0xf1f7('0x41')]);_0x53fc52[_0xf1f7('0x42')]=qs['filters'](_[_0xf1f7('0x43')](_0x4077e1[_0xf1f7('0x2e')],_0x9cb6b4['filters']));_0x53fc52['where'][_0xf1f7('0x44')]=_0x17104c['id'];if(_0x4077e1[_0xf1f7('0x2e')]['filter']){_0x53fc52[_0xf1f7('0x42')]=_['merge'](_0x53fc52[_0xf1f7('0x42')],{'$or':_[_0xf1f7('0x21')](_0x53fc52[_0xf1f7('0x2c')],function(_0x21bc62){var _0xf1a26b={};_0xf1a26b[_0x21bc62]={'$like':'%'+_0x4077e1[_0xf1f7('0x2e')]['filter']+'%'};return _0xf1a26b;})});}if(_0x4077e1[_0xf1f7('0x2e')][_0xf1f7('0x45')]){var _0x5de5d3=_0x4077e1[_0xf1f7('0x2e')]['$gte'][_0xf1f7('0x46')](',');var _0x320cad={};_0x320cad[_0x5de5d3[0x0]]={'$gte':moment(_0x5de5d3[0x1])[_0xf1f7('0x47')](_0xf1f7('0x48'))};_0x53fc52['where']=_['merge'](_0x53fc52[_0xf1f7('0x42')],_0x320cad);}_0x53fc52=_[_0xf1f7('0x31')]({},_0x53fc52,_0x4077e1[_0xf1f7('0x32')]);return db[_0xf1f7('0x37')]['count']({'where':_0x53fc52[_0xf1f7('0x42')]})[_0xf1f7('0x1a')](function(_0xa4a6ea){_0x1f48b4[_0xf1f7('0x49')]=_0xa4a6ea;if(_0x4077e1[_0xf1f7('0x2e')][_0xf1f7('0x4a')]){_0x53fc52[_0xf1f7('0x30')]=[{'all':!![]}];}return db[_0xf1f7('0x37')]['findAll'](_0x53fc52);})['then'](function(_0x47ea68){_0x1f48b4['rows']=_0x47ea68;return _0x1f48b4;});}})[_0xf1f7('0x1a')](respondWithFilteredResult(_0xe9bb92,_0x53fc52))[_0xf1f7('0x28')](handleError(_0xe9bb92,null));};exports[_0xf1f7('0x4b')]=function(_0x5b64bc,_0x17b93e){return db['FaxInteraction'][_0xf1f7('0x33')]({'where':{'id':_0x5b64bc['params']['id']}})[_0xf1f7('0x1a')](handleEntityNotFound(_0x17b93e,null))[_0xf1f7('0x1a')](function(_0x59ace5){if(_0x59ace5){return _0x59ace5[_0xf1f7('0x4c')](_0x5b64bc['body'][_0xf1f7('0x3a')],_[_0xf1f7('0x39')](_0x5b64bc[_0xf1f7('0x35')],['ids','id'])||{})[_0xf1f7('0x4d')](function(){return db['Tag'][_0xf1f7('0x4e')]({'attributes':['id','name',_0xf1f7('0x4f')],'where':{'id':_0x5b64bc[_0xf1f7('0x35')][_0xf1f7('0x3a')]}});})[_0xf1f7('0x1a')](function(_0xc06ffa){socket[_0xf1f7('0x50')]('faxInteractionTags:save',{'id':Number(_0x5b64bc['params']['id']),'tags':_0xc06ffa||[]});return{'id':Number(_0x5b64bc[_0xf1f7('0x29')]['id']),'tags':_0xc06ffa||[]};});}})['then'](respondWithResult(_0x17b93e,null))[_0xf1f7('0x28')](handleError(_0x17b93e,null));};exports['removeTags']=function(_0x31fb11,_0x586d27){return db[_0xf1f7('0x22')][_0xf1f7('0x33')]({'where':{'id':_0x31fb11[_0xf1f7('0x29')]['id']}})[_0xf1f7('0x1a')](handleEntityNotFound(_0x586d27,null))[_0xf1f7('0x1a')](function(_0x599c82){if(_0x599c82){return _0x599c82[_0xf1f7('0x51')](_0x31fb11[_0xf1f7('0x2e')][_0xf1f7('0x3a')]);}})[_0xf1f7('0x1a')](respondWithStatusCode(_0x586d27,null))[_0xf1f7('0x28')](handleError(_0x586d27,null));};exports[_0xf1f7('0x52')]=function(_0x4b67cf,_0x5c9f98){var _0x33508a=moment()[_0xf1f7('0x53')]()[_0xf1f7('0x54')]();var _0x2c549c=path[_0xf1f7('0x55')](config['root'],_0xf1f7('0x56'),'files','tmp');var _0x3bbf45=path[_0xf1f7('0x55')](config[_0xf1f7('0x57')],_0xf1f7('0x56'),'files','attachments');var _0x57dfef=path['join'](_0x2c549c,_0x33508a);var _0x289a22=util[_0xf1f7('0x47')](_0xf1f7('0x58'),_0x4b67cf[_0xf1f7('0x29')]['id'],_0x33508a);var _0x34a553=path[_0xf1f7('0x55')](_0x2c549c,_0x289a22);var _0xfbfb0f=[];_0xfbfb0f['push']({'model':db[_0xf1f7('0x59')],'as':_0xf1f7('0x59'),'raw':!![]});var _0x15e614=[{'model':db[_0xf1f7('0x37')],'as':_0xf1f7('0x5a'),'attributes':['id','body',_0xf1f7('0x5b')],'include':_0xfbfb0f}];return db['FaxInteraction'][_0xf1f7('0x33')]({'where':{'id':_0x4b67cf[_0xf1f7('0x29')]['id']},'include':_0x15e614})[_0xf1f7('0x1a')](handleEntityNotFound(_0x5c9f98,null))[_0xf1f7('0x1a')](function(_0xadcf2){if(_0xadcf2&&_0xadcf2['Messages']){var _0x1fe394=_0xadcf2[_0xf1f7('0x5c')]({'plain':!![]});fs[_0xf1f7('0x5d')](_0x57dfef);for(var _0x1676af=0x0;_0x1676af<_0x1fe394[_0xf1f7('0x5a')]['length'];_0x1676af++){var _0x15ae08=_0x1fe394[_0xf1f7('0x5a')][_0x1676af][_0xf1f7('0x59')];if(_0x15ae08){var _0xde7160=path[_0xf1f7('0x55')](_0x3bbf45,_0x15ae08[_0xf1f7('0x5e')]);if(fs['existsSync'](_0xde7160)){fs[_0xf1f7('0x5f')](_0xde7160)[_0xf1f7('0x60')](fs[_0xf1f7('0x61')](path[_0xf1f7('0x55')](_0x57dfef,_0x15ae08[_0xf1f7('0x5e')])));}}}return BPromise[_0xf1f7('0x62')]()[_0xf1f7('0x1a')](function(){return new BPromise(function(_0xe5d4f2,_0x4667c2){zipdir(_0x57dfef,{'saveTo':_0x34a553},function(_0x4ba341,_0x30999f){if(_0x4ba341)return _0x4667c2(_0x4ba341);return _0xe5d4f2(_0x30999f);});})[_0xf1f7('0x1a')](function(){return new BPromise(function(_0x264c82,_0x35339c){rimraf(_0x57dfef,function(_0x1f7454){if(_0x1f7454)_0x35339c(_0x1f7454);return _0x264c82();});});})[_0xf1f7('0x1a')](function(){return _0x5c9f98[_0xf1f7('0x52')](_0x34a553,_0x289a22,function(_0x39956e){if(_0x39956e){console['log'](_0xf1f7('0x63'),_0x39956e);}else{fs[_0xf1f7('0x64')](_0x34a553);}});});});}else{return _0x5c9f98[_0xf1f7('0x10')](0xc8);}})['catch'](handleError(_0x5c9f98,null));}; \ No newline at end of file +var _0x301f=['where','FaxInteractionId','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','count','includeAll','rows','spread','Tag','color','emit','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','Attachment','Messages','get','mkdirSync','existsSync','pipe','createWriteStream','basename','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','lodash','../../components/interaction/service','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','undefined','limit','set','Content-Range','update','then','destroy','stack','name','send','index','FaxInteraction','rawAttributes','fieldName','key','findAll','catch','show','params','model','query','intersection','attributes','fields','length','include','find','create','body','addMessage','FaxMessage','ids','omit','getMessages','findOne','keys','filters','hasOwnProperty','nolimit','offset','order','sort'];(function(_0x1380f6,_0x5e7f74){var _0x1ad17e=function(_0x5e65cc){while(--_0x5e65cc){_0x1380f6['push'](_0x1380f6['shift']());}};_0x1ad17e(++_0x5e7f74);}(_0x301f,0x14f));var _0xf301=function(_0x90ef06,_0x277f1a){_0x90ef06=_0x90ef06-0x0;var _0x2ab1a7=_0x301f[_0x90ef06];return _0x2ab1a7;};'use strict';var rimraf=require(_0xf301('0x0'));var zipdir=require(_0xf301('0x1'));var moment=require(_0xf301('0x2'));var BPromise=require(_0xf301('0x3'));var util=require(_0xf301('0x4'));var path=require(_0xf301('0x5'));var fs=require('fs');var _=require(_0xf301('0x6'));var Redis=require('ioredis');var interaction=require(_0xf301('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0xf301('0x8'))('api');var config=require(_0xf301('0x9'));var db=require(_0xf301('0xa'))['db'];config[_0xf301('0xb')]=_[_0xf301('0xc')](config[_0xf301('0xb')],{'host':_0xf301('0xd'),'port':0x18eb});var socket=require(_0xf301('0xe'))(new Redis(config[_0xf301('0xb')]));require('./faxInteraction.socket')['register'](socket);function respondWithStatusCode(_0x352551,_0x3c8601){_0x3c8601=_0x3c8601||0xcc;return function(_0x117d55){if(_0x117d55){return _0x352551[_0xf301('0xf')](_0x3c8601);}return _0x352551[_0xf301('0x10')](_0x3c8601)[_0xf301('0x11')]();};}function respondWithResult(_0x53cffe,_0x53097b){_0x53097b=_0x53097b||0xc8;return function(_0x581db1){if(_0x581db1){return _0x53cffe[_0xf301('0x10')](_0x53097b)[_0xf301('0x12')](_0x581db1);}};}function respondWithFilteredResult(_0x57a5f7,_0x5aeb1a){return function(_0xe7bd19){if(_0xe7bd19){var _0x343fbc=typeof _0x5aeb1a['offset']===_0xf301('0x13')&&typeof _0x5aeb1a['limit']===_0xf301('0x13');var _0x34f812=_0xe7bd19['count'];var _0x46fb83=_0x343fbc?0x0:_0x5aeb1a['offset'];var _0x460347=_0x343fbc?_0xe7bd19['count']:_0x5aeb1a['offset']+_0x5aeb1a[_0xf301('0x14')];var _0x5cf9ce;if(_0x460347>=_0x34f812){_0x460347=_0x34f812;_0x5cf9ce=0xc8;}else{_0x5cf9ce=0xce;}_0x57a5f7[_0xf301('0x10')](_0x5cf9ce);return _0x57a5f7[_0xf301('0x15')](_0xf301('0x16'),_0x46fb83+'-'+_0x460347+'/'+_0x34f812)[_0xf301('0x12')](_0xe7bd19);}return null;};}function saveUpdates(_0x52af36){return function(_0x3f331a){if(_0x3f331a){return _0x3f331a[_0xf301('0x17')](_0x52af36)[_0xf301('0x18')](function(_0x1c6821){return _0x1c6821;});}return null;};}function removeEntity(_0x410e53){return function(_0x5398bd){if(_0x5398bd){return _0x5398bd[_0xf301('0x19')]()['then'](function(){_0x410e53[_0xf301('0x10')](0xcc)[_0xf301('0x11')]();});}};}function handleEntityNotFound(_0x44b96f){return function(_0x1a0ed9){if(!_0x1a0ed9){_0x44b96f[_0xf301('0xf')](0x194);}return _0x1a0ed9;};}function handleError(_0x4185bd,_0x389037){_0x389037=_0x389037||0x1f4;return function(_0x17bd1b){logger['error'](_0x17bd1b[_0xf301('0x1a')]);if(_0x17bd1b['name']){delete _0x17bd1b[_0xf301('0x1b')];}_0x4185bd[_0xf301('0x10')](_0x389037)[_0xf301('0x1c')](_0x17bd1b);};}exports[_0xf301('0x1d')]=function(_0x3af456,_0x31c523){var _0x2fb6b8={};var _0x13e407=_['map'](db[_0xf301('0x1e')][_0xf301('0x1f')],function(_0x5c917d){return{'name':_0x5c917d[_0xf301('0x20')],'type':_0x5c917d['type'][_0xf301('0x21')]};});_0x2fb6b8=qs['getOptions'](_0x13e407,_0x3af456);return interaction[_0xf301('0x22')]('fax',_0x3af456['query'],_0x3af456['user'],_0x2fb6b8,_0x13e407)[_0xf301('0x18')](respondWithFilteredResult(_0x31c523,_0x2fb6b8))[_0xf301('0x23')](handleError(_0x31c523,null));};exports[_0xf301('0x24')]=function(_0x52c9c5,_0x431a59){var _0x42c288={'raw':![],'where':{'id':_0x52c9c5[_0xf301('0x25')]['id']}},_0x285cbf={};_0x285cbf[_0xf301('0x26')]=_['keys'](db[_0xf301('0x1e')]['rawAttributes']);_0x285cbf[_0xf301('0x27')]=_['keys'](_0x52c9c5[_0xf301('0x27')]);_0x285cbf['filters']=_[_0xf301('0x28')](_0x285cbf[_0xf301('0x26')],_0x285cbf[_0xf301('0x27')]);_0x42c288[_0xf301('0x29')]=_[_0xf301('0x28')](_0x285cbf['model'],qs[_0xf301('0x2a')](_0x52c9c5[_0xf301('0x27')]['fields']));_0x42c288[_0xf301('0x29')]=_0x42c288['attributes'][_0xf301('0x2b')]?_0x42c288[_0xf301('0x29')]:_0x285cbf[_0xf301('0x26')];if(_0x52c9c5[_0xf301('0x27')]['includeAll']){_0x42c288[_0xf301('0x2c')]=[{'all':!![]}];}_0x42c288=_['merge']({},_0x42c288,_0x52c9c5['options']);return db[_0xf301('0x1e')][_0xf301('0x2d')](_0x42c288)[_0xf301('0x18')](handleEntityNotFound(_0x431a59,null))[_0xf301('0x18')](respondWithResult(_0x431a59,null))[_0xf301('0x23')](handleError(_0x431a59,null));};exports['create']=function(_0x29e051,_0x3762e2){return db[_0xf301('0x1e')][_0xf301('0x2e')](_0x29e051[_0xf301('0x2f')],{})[_0xf301('0x18')](respondWithResult(_0x3762e2,0xc9))[_0xf301('0x23')](handleError(_0x3762e2,null));};exports[_0xf301('0x17')]=function(_0xbcc51d,_0x120337){if(_0xbcc51d['body']['id']){delete _0xbcc51d[_0xf301('0x2f')]['id'];}return db[_0xf301('0x1e')]['find']({'where':{'id':_0xbcc51d['params']['id']}})[_0xf301('0x18')](handleEntityNotFound(_0x120337,null))[_0xf301('0x18')](saveUpdates(_0xbcc51d[_0xf301('0x2f')],null))[_0xf301('0x18')](respondWithResult(_0x120337,null))[_0xf301('0x23')](handleError(_0x120337,null));};exports[_0xf301('0x19')]=function(_0x209823,_0x28a18f){return db[_0xf301('0x1e')][_0xf301('0x2d')]({'where':{'id':_0x209823[_0xf301('0x25')]['id']}})[_0xf301('0x18')](handleEntityNotFound(_0x28a18f,null))[_0xf301('0x18')](removeEntity(_0x28a18f,null))[_0xf301('0x23')](handleError(_0x28a18f,null));};exports['describe']=function(_0x2aab99,_0x1ab289){return db[_0xf301('0x1e')]['describe']()[_0xf301('0x18')](respondWithResult(_0x1ab289,null))[_0xf301('0x23')](handleError(_0x1ab289,null));};exports[_0xf301('0x30')]=function(_0x184bbb,_0xc5f1d2){return db[_0xf301('0x31')][_0xf301('0x2d')]({'where':{'id':_0x184bbb[_0xf301('0x25')]['id']}})['then'](handleEntityNotFound(_0xc5f1d2,null))[_0xf301('0x18')](function(_0x11c07b){if(_0x11c07b){return _0x11c07b[_0xf301('0x30')](_0x184bbb[_0xf301('0x2f')][_0xf301('0x32')],_[_0xf301('0x33')](_0x184bbb['body'],[_0xf301('0x32'),'id'])||{});}})[_0xf301('0x18')](respondWithResult(_0xc5f1d2,null))[_0xf301('0x23')](handleError(_0xc5f1d2,null));};exports[_0xf301('0x34')]=function(_0x2278ab,_0x3bf27f){var _0x51e33c={'raw':![],'where':{}};var _0x209bd4={};var _0x5b905e={'count':0x0,'rows':[]};return db[_0xf301('0x1e')][_0xf301('0x35')]({'where':{'id':_0x2278ab['params']['id']}})[_0xf301('0x18')](handleEntityNotFound(_0x3bf27f,null))[_0xf301('0x18')](function(_0x6478ea){if(_0x6478ea){_0x209bd4[_0xf301('0x26')]=_[_0xf301('0x36')](db[_0xf301('0x31')][_0xf301('0x1f')]);_0x209bd4[_0xf301('0x27')]=_['keys'](_0x2278ab[_0xf301('0x27')]);_0x209bd4[_0xf301('0x37')]=_[_0xf301('0x28')](_0x209bd4[_0xf301('0x26')],_0x209bd4[_0xf301('0x27')]);_0x51e33c['attributes']=_['intersection'](_0x209bd4[_0xf301('0x26')],qs['fields'](_0x2278ab[_0xf301('0x27')]['fields']));_0x51e33c[_0xf301('0x29')]=_0x51e33c[_0xf301('0x29')]['length']?_0x51e33c[_0xf301('0x29')]:_0x209bd4['model'];if(!_0x2278ab['query'][_0xf301('0x38')](_0xf301('0x39'))){_0x51e33c[_0xf301('0x14')]=qs[_0xf301('0x14')](_0x2278ab['query']['limit']);_0x51e33c[_0xf301('0x3a')]=qs[_0xf301('0x3a')](_0x2278ab['query']['offset']);}_0x51e33c[_0xf301('0x3b')]=qs['sort'](_0x2278ab['query'][_0xf301('0x3c')]);_0x51e33c[_0xf301('0x3d')]=qs[_0xf301('0x37')](_['pick'](_0x2278ab[_0xf301('0x27')],_0x209bd4[_0xf301('0x37')]));_0x51e33c[_0xf301('0x3d')][_0xf301('0x3e')]=_0x6478ea['id'];if(_0x2278ab['query'][_0xf301('0x3f')]){_0x51e33c[_0xf301('0x3d')]=_[_0xf301('0x40')](_0x51e33c[_0xf301('0x3d')],{'$or':_['map'](_0x51e33c['attributes'],function(_0x55d88d){var _0x10ab39={};_0x10ab39[_0x55d88d]={'$like':'%'+_0x2278ab[_0xf301('0x27')][_0xf301('0x3f')]+'%'};return _0x10ab39;})});}if(_0x2278ab['query'][_0xf301('0x41')]){var _0x39848b=_0x2278ab[_0xf301('0x27')][_0xf301('0x41')][_0xf301('0x42')](',');var _0x395c5b={};_0x395c5b[_0x39848b[0x0]]={'$gte':moment(_0x39848b[0x1])[_0xf301('0x43')](_0xf301('0x44'))};_0x51e33c[_0xf301('0x3d')]=_[_0xf301('0x40')](_0x51e33c[_0xf301('0x3d')],_0x395c5b);}_0x51e33c=_['merge']({},_0x51e33c,_0x2278ab[_0xf301('0x45')]);return db[_0xf301('0x31')][_0xf301('0x46')]({'where':_0x51e33c[_0xf301('0x3d')]})[_0xf301('0x18')](function(_0x3aa05b){_0x5b905e[_0xf301('0x46')]=_0x3aa05b;if(_0x2278ab[_0xf301('0x27')][_0xf301('0x47')]){_0x51e33c[_0xf301('0x2c')]=[{'all':!![]}];}return db[_0xf301('0x31')][_0xf301('0x22')](_0x51e33c);})[_0xf301('0x18')](function(_0x285341){_0x5b905e[_0xf301('0x48')]=_0x285341;return _0x5b905e;});}})[_0xf301('0x18')](respondWithFilteredResult(_0x3bf27f,_0x51e33c))['catch'](handleError(_0x3bf27f,null));};exports['addTags']=function(_0x54b3a4,_0x112960){return db[_0xf301('0x1e')][_0xf301('0x2d')]({'where':{'id':_0x54b3a4[_0xf301('0x25')]['id']}})['then'](handleEntityNotFound(_0x112960,null))[_0xf301('0x18')](function(_0x2d9412){if(_0x2d9412){return _0x2d9412['setTags'](_0x54b3a4['body'][_0xf301('0x32')],_[_0xf301('0x33')](_0x54b3a4[_0xf301('0x2f')],[_0xf301('0x32'),'id'])||{})[_0xf301('0x49')](function(){return db[_0xf301('0x4a')][_0xf301('0x22')]({'attributes':['id',_0xf301('0x1b'),_0xf301('0x4b')],'where':{'id':_0x54b3a4[_0xf301('0x2f')][_0xf301('0x32')]}});})[_0xf301('0x18')](function(_0x646e26){socket[_0xf301('0x4c')](_0xf301('0x4d'),{'id':Number(_0x54b3a4[_0xf301('0x25')]['id']),'tags':_0x646e26||[]});return{'id':Number(_0x54b3a4[_0xf301('0x25')]['id']),'tags':_0x646e26||[]};});}})[_0xf301('0x18')](respondWithResult(_0x112960,null))[_0xf301('0x23')](handleError(_0x112960,null));};exports[_0xf301('0x4e')]=function(_0x507de1,_0x121299){return db[_0xf301('0x1e')][_0xf301('0x2d')]({'where':{'id':_0x507de1['params']['id']}})['then'](handleEntityNotFound(_0x121299,null))[_0xf301('0x18')](function(_0x278895){if(_0x278895){return _0x278895[_0xf301('0x4e')](_0x507de1['query'][_0xf301('0x32')]);}})[_0xf301('0x18')](respondWithStatusCode(_0x121299,null))[_0xf301('0x23')](handleError(_0x121299,null));};exports[_0xf301('0x4f')]=function(_0xc01baf,_0x57990e){var _0x3c23ad=moment()[_0xf301('0x50')]()['toString']();var _0x2a1da1=path[_0xf301('0x51')](config[_0xf301('0x52')],_0xf301('0x53'),_0xf301('0x54'),_0xf301('0x55'));var _0x3994e3=path['join'](config[_0xf301('0x52')],'server',_0xf301('0x54'),_0xf301('0x56'));var _0x85d933=path[_0xf301('0x51')](_0x2a1da1,_0x3c23ad);var _0x692a8e=util['format'](_0xf301('0x57'),_0xc01baf[_0xf301('0x25')]['id'],_0x3c23ad);var _0xfd8b2c=path[_0xf301('0x51')](_0x2a1da1,_0x692a8e);var _0xa8adf3=[];_0xa8adf3[_0xf301('0x58')]({'model':db[_0xf301('0x59')],'as':_0xf301('0x59'),'raw':!![]});var _0x47cd09=[{'model':db[_0xf301('0x31')],'as':_0xf301('0x5a'),'attributes':['id',_0xf301('0x2f'),'createdAt'],'include':_0xa8adf3}];return db[_0xf301('0x1e')][_0xf301('0x2d')]({'where':{'id':_0xc01baf[_0xf301('0x25')]['id']},'include':_0x47cd09})['then'](handleEntityNotFound(_0x57990e,null))[_0xf301('0x18')](function(_0xf32ac2){if(_0xf32ac2&&_0xf32ac2[_0xf301('0x5a')]){var _0x46e406=_0xf32ac2[_0xf301('0x5b')]({'plain':!![]});fs[_0xf301('0x5c')](_0x85d933);for(var _0x4a456b=0x0;_0x4a456b<_0x46e406[_0xf301('0x5a')][_0xf301('0x2b')];_0x4a456b++){var _0x5ebcb8=_0x46e406[_0xf301('0x5a')][_0x4a456b][_0xf301('0x59')];if(_0x5ebcb8){var _0x2da421=path[_0xf301('0x51')](_0x3994e3,_0x5ebcb8['basename']);if(fs[_0xf301('0x5d')](_0x2da421)){fs['createReadStream'](_0x2da421)[_0xf301('0x5e')](fs[_0xf301('0x5f')](path[_0xf301('0x51')](_0x85d933,_0x5ebcb8[_0xf301('0x60')])));}}}return BPromise['resolve']()['then'](function(){return new BPromise(function(_0x2ad2fd,_0x309371){zipdir(_0x85d933,{'saveTo':_0xfd8b2c},function(_0x4beead,_0x3a65b3){if(_0x4beead)return _0x309371(_0x4beead);return _0x2ad2fd(_0x3a65b3);});})[_0xf301('0x18')](function(){return new BPromise(function(_0x1f1577,_0x4eccb1){rimraf(_0x85d933,function(_0x44c285){if(_0x44c285)_0x4eccb1(_0x44c285);return _0x1f1577();});});})[_0xf301('0x18')](function(){return _0x57990e[_0xf301('0x4f')](_0xfd8b2c,_0x692a8e,function(_0x535b09){if(_0x535b09){console['log'](_0xf301('0x61'),_0x535b09);}else{fs[_0xf301('0x62')](_0xfd8b2c);}});});});}else{return _0x57990e[_0xf301('0xf')](0xc8);}})[_0xf301('0x23')](handleError(_0x57990e,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 74ca802..e295dcc 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 _0x171a=['map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','FaxInteraction','FaxMessage','save','update','getUsers','then','setDataValue','Users'];(function(_0xcd3c01,_0x3fe8fc){var _0x55ab17=function(_0x59742a){while(--_0x59742a){_0xcd3c01['push'](_0xcd3c01['shift']());}};_0x55ab17(++_0x3fe8fc);}(_0x171a,0x13a));var _0xa171=function(_0x4edac5,_0x41d853){_0x4edac5=_0x4edac5-0x0;var _0x572b3b=_0x171a[_0x4edac5];return _0x572b3b;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0xa171('0x0'))['db'][_0xa171('0x1')];var FaxMessage=require('../../mysqldb')['db'][_0xa171('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa171('0x3'),'afterUpdate':_0xa171('0x4'),'afterDestroy':'remove'};function emitEvent(_0x28f203){return function(_0x3bdfd2,_0x491f36,_0x20c3cc){_0x3bdfd2[_0xa171('0x5')]({'attributes':['id'],'raw':!![]})[_0xa171('0x6')](function(_0x2fd50e){_0x3bdfd2[_0xa171('0x7')](_0xa171('0x8'),_0x2fd50e[_0xa171('0x9')](function(_0x4e0d82){return{'id':_0x4e0d82['id']};}));return FaxMessage[_0xa171('0xa')]({'where':{'FaxInteractionId':_0x3bdfd2['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x364335){_0x3bdfd2[_0xa171('0x7')](_0xa171('0xb'),_0x364335['length']);FaxInteractionEvents[_0xa171('0xc')](_0x28f203+':'+_0x3bdfd2['id'],_0x3bdfd2);FaxInteractionEvents[_0xa171('0xc')](_0x28f203,_0x3bdfd2);_0x20c3cc(null);})[_0xa171('0xd')](_0x20c3cc(null));};}for(var e in events){if(events[_0xa171('0xe')](e)){var event=events[e];FaxInteraction[_0xa171('0xf')](e,emitEvent(event));}}module[_0xa171('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0x25a1=['length','emit','catch','hasOwnProperty','exports','events','FaxInteraction','FaxMessage','save','getUsers','then','Users','map','findAll'];(function(_0x7880d2,_0x32e7d6){var _0x35ebbe=function(_0x5c27fa){while(--_0x5c27fa){_0x7880d2['push'](_0x7880d2['shift']());}};_0x35ebbe(++_0x32e7d6);}(_0x25a1,0x1ef));var _0x125a=function(_0x36d431,_0x279034){_0x36d431=_0x36d431-0x0;var _0x2b3b25=_0x25a1[_0x36d431];return _0x2b3b25;};'use strict';var EventEmitter=require(_0x125a('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0x125a('0x1')];var FaxMessage=require('../../mysqldb')['db'][_0x125a('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x125a('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x37702b){return function(_0x5647f7,_0x25b639,_0xf5ef1c){_0x5647f7[_0x125a('0x4')]({'attributes':['id'],'raw':!![]})[_0x125a('0x5')](function(_0x1af01e){_0x5647f7['setDataValue'](_0x125a('0x6'),_0x1af01e[_0x125a('0x7')](function(_0x3977a8){return{'id':_0x3977a8['id']};}));return FaxMessage[_0x125a('0x8')]({'where':{'FaxInteractionId':_0x5647f7['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x428a64){_0x5647f7['setDataValue']('unreadMessages',_0x428a64[_0x125a('0x9')]);FaxInteractionEvents[_0x125a('0xa')](_0x37702b+':'+_0x5647f7['id'],_0x5647f7);FaxInteractionEvents[_0x125a('0xa')](_0x37702b,_0x5647f7);_0xf5ef1c(null);})[_0x125a('0xb')](_0xf5ef1c(null));};}for(var e in events){if(events[_0x125a('0xc')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x125a('0xd')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index cf1a7ac..1d23bd8 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 _0xc953=['changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','FaxInteraction','fax_interactions'];(function(_0xa306f3,_0x48828e){var _0x2b870c=function(_0x136cef){while(--_0x136cef){_0xa306f3['push'](_0xa306f3['shift']());}};_0x2b870c(++_0x48828e);}(_0xc953,0x84));var _0x3c95=function(_0x3042c5,_0x36cb88){_0x3042c5=_0x3042c5-0x0;var _0x7cd140=_0xc953[_0x3042c5];return _0x7cd140;};'use strict';var _=require(_0x3c95('0x0'));var util=require(_0x3c95('0x1'));var logger=require(_0x3c95('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3c95('0x3'));var rp=require(_0x3c95('0x4'));var fs=require('fs');var path=require(_0x3c95('0x5'));var rimraf=require(_0x3c95('0x6'));var config=require(_0x3c95('0x7'));var attributes=require(_0x3c95('0x8'));module[_0x3c95('0x9')]=function(_0x2dba7c,_0x5dc307){return _0x2dba7c['define'](_0x3c95('0xa'),attributes,{'tableName':_0x3c95('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x476ee8,_0x17d4ab,_0x309dbb){if(_0x476ee8[_0x3c95('0xc')](_0x3c95('0xd'))){_0x476ee8['closedAt']=moment()[_0x3c95('0xe')](_0x3c95('0xf'));}_0x309dbb(null,_0x476ee8);}}});}; \ No newline at end of file +var _0xab77=['format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','moment','path','rimraf','../../config/environment','./faxInteraction.attributes','define','FaxInteraction','closed','closedAt'];(function(_0x4a13cd,_0x5635cb){var _0x4210d4=function(_0x4bf236){while(--_0x4bf236){_0x4a13cd['push'](_0x4a13cd['shift']());}};_0x4210d4(++_0x5635cb);}(_0xab77,0x1e3));var _0x7ab7=function(_0x4cfb78,_0x4c1da6){_0x4cfb78=_0x4cfb78-0x0;var _0xc1250e=_0xab77[_0x4cfb78];return _0xc1250e;};'use strict';var _=require('lodash');var util=require(_0x7ab7('0x0'));var logger=require(_0x7ab7('0x1'))('api');var moment=require(_0x7ab7('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7ab7('0x3'));var rimraf=require(_0x7ab7('0x4'));var config=require(_0x7ab7('0x5'));var attributes=require(_0x7ab7('0x6'));module['exports']=function(_0x29e3bf,_0x2e9d45){return _0x29e3bf[_0x7ab7('0x7')](_0x7ab7('0x8'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x325848,_0x12f427,_0x471a07){if(_0x325848['changed'](_0x7ab7('0x9'))){_0x325848[_0x7ab7('0xa')]=moment()[_0x7ab7('0xb')](_0x7ab7('0xc'));}_0x471a07(null,_0x325848);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index c270ddd..07cf728 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 _0xa5ce=['AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','UpdateFaxInteraction','FaxInteraction','update','options','raw','where','attributes','stringify','find','addTags','omit','ids','spread'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa5ce,0xfd));var _0xea5c=function(_0x23c091,_0x28692c){_0x23c091=_0x23c091-0x0;var _0x336a47=_0xa5ce[_0x23c091];return _0x336a47;};'use strict';var _=require(_0xea5c('0x0'));var util=require(_0xea5c('0x1'));var moment=require(_0xea5c('0x2'));var BPromise=require(_0xea5c('0x3'));var rs=require(_0xea5c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xea5c('0x5'))['db'];var utils=require(_0xea5c('0x6'));var logger=require(_0xea5c('0x7'))(_0xea5c('0x8'));var config=require(_0xea5c('0x9'));var jayson=require(_0xea5c('0xa'));var client=jayson['client'][_0xea5c('0xb')]({'port':0x232a});config[_0xea5c('0xc')]=_[_0xea5c('0xd')](config[_0xea5c('0xc')],{'host':_0xea5c('0xe'),'port':0x18eb});var socket=require(_0xea5c('0xf'))(new Redis(config[_0xea5c('0xc')]));require('./faxInteraction.socket')[_0xea5c('0x10')](socket);function respondWithRpcPromise(_0x2e05f2,_0xe42a9e,_0x58ad70){return new BPromise(function(_0x399f67,_0x3255c1){return client[_0xea5c('0x11')](_0x2e05f2,_0x58ad70)[_0xea5c('0x12')](function(_0xabf2ca){logger['info'](_0xea5c('0x13'),_0xe42a9e,'request\x20sent');logger[_0xea5c('0x14')](_0xea5c('0x15'),_0xe42a9e,_0xea5c('0x16'),JSON['stringify'](_0xabf2ca));if(_0xabf2ca[_0xea5c('0x17')]){if(_0xabf2ca[_0xea5c('0x17')][_0xea5c('0x18')]===0x1f4){logger[_0xea5c('0x17')](_0xea5c('0x13'),_0xe42a9e,_0xabf2ca['error']['message']);return _0x3255c1(_0xabf2ca[_0xea5c('0x17')][_0xea5c('0x19')]);}logger[_0xea5c('0x17')](_0xea5c('0x13'),_0xe42a9e,_0xabf2ca[_0xea5c('0x17')][_0xea5c('0x19')]);return _0x399f67(_0xabf2ca[_0xea5c('0x17')]['message']);}else{logger[_0xea5c('0x1a')]('FaxInteraction,\x20%s,\x20%s',_0xe42a9e,_0xea5c('0x16'));_0x399f67(_0xabf2ca['result'][_0xea5c('0x19')]);}})[_0xea5c('0x1b')](function(_0x3e5032){logger[_0xea5c('0x17')]('FaxInteraction,\x20%s,\x20%s',_0xe42a9e,_0x3e5032);_0x3255c1(_0x3e5032);});});}exports[_0xea5c('0x1c')]=function(_0x29f542){var _0x625c28=this;return new Promise(function(_0x4c04ae,_0x241efa){return db[_0xea5c('0x1d')][_0xea5c('0x1e')](_0x29f542['body'],{'raw':_0x29f542[_0xea5c('0x1f')]?_0x29f542[_0xea5c('0x1f')][_0xea5c('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29f542[_0xea5c('0x1f')]?_0x29f542[_0xea5c('0x1f')][_0xea5c('0x21')]||null:null,'attributes':_0x29f542[_0xea5c('0x1f')]?_0x29f542[_0xea5c('0x1f')][_0xea5c('0x22')]||null:null,'limit':_0x29f542[_0xea5c('0x1f')]?_0x29f542[_0xea5c('0x1f')]['limit']||null:null})['then'](function(_0x4900ac){logger[_0xea5c('0x1a')](_0xea5c('0x1c'),_0x29f542);logger['debug'](_0xea5c('0x1c'),_0x29f542,JSON[_0xea5c('0x23')](_0x4900ac));_0x4c04ae(_0x4900ac);})[_0xea5c('0x1b')](function(_0xc869ea){logger[_0xea5c('0x17')](_0xea5c('0x1c'),_0xc869ea[_0xea5c('0x19')],_0x29f542);_0x241efa(_0x625c28[_0xea5c('0x17')](0x1f4,_0xc869ea[_0xea5c('0x19')]));});});};exports['AddTagsToFaxInteraction']=function(_0x580db2){return new Promise(function(_0x373d6d,_0x3b7583){return db[_0xea5c('0x1d')][_0xea5c('0x24')]({'where':_0x580db2['options']?_0x580db2[_0xea5c('0x1f')]['where']||null:null})[_0xea5c('0x12')](function(_0x3c2265){if(_0x3c2265){return _0x3c2265[_0xea5c('0x25')](_0x580db2['body']['ids'],_[_0xea5c('0x26')](_0x580db2['body'],[_0xea5c('0x27'),'id'])||{});}})[_0xea5c('0x28')](function(_0x155293){logger[_0xea5c('0x1a')](_0xea5c('0x29'),_0x580db2);logger[_0xea5c('0x14')](_0xea5c('0x29'),_0x580db2,JSON[_0xea5c('0x23')](_0x155293));_0x373d6d(_0x155293);})['catch'](function(_0x56bf16){logger[_0xea5c('0x17')](_0xea5c('0x29'),_0x56bf16['message'],_0x580db2);_0x3b7583(_this[_0xea5c('0x17')](0x1f4,_0x56bf16[_0xea5c('0x19')]));});});}; \ No newline at end of file +var _0x6daf=['bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','UpdateFaxInteraction','FaxInteraction','update','options','where','attributes','limit','catch','AddTagsToFaxInteraction','addTags','ids','spread','AddTags','lodash','util','moment'];(function(_0x2ba7c4,_0x5a9a03){var _0x14da79=function(_0x37d14b){while(--_0x37d14b){_0x2ba7c4['push'](_0x2ba7c4['shift']());}};_0x14da79(++_0x5a9a03);}(_0x6daf,0x115));var _0xf6da=function(_0x4f2462,_0x4ce99d){_0x4f2462=_0x4f2462-0x0;var _0xc4e6c0=_0x6daf[_0x4f2462];return _0xc4e6c0;};'use strict';var _=require(_0xf6da('0x0'));var util=require(_0xf6da('0x1'));var moment=require(_0xf6da('0x2'));var BPromise=require(_0xf6da('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf6da('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf6da('0x5'));var logger=require('../../config/logger')(_0xf6da('0x6'));var config=require(_0xf6da('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf6da('0x8')][_0xf6da('0x9')]({'port':0x232a});config[_0xf6da('0xa')]=_[_0xf6da('0xb')](config[_0xf6da('0xa')],{'host':_0xf6da('0xc'),'port':0x18eb});var socket=require(_0xf6da('0xd'))(new Redis(config[_0xf6da('0xa')]));require(_0xf6da('0xe'))[_0xf6da('0xf')](socket);function respondWithRpcPromise(_0x291593,_0x578424,_0x533f82){return new BPromise(function(_0x461b6a,_0x329ca7){return client[_0xf6da('0x10')](_0x291593,_0x533f82)[_0xf6da('0x11')](function(_0xfb923a){logger[_0xf6da('0x12')](_0xf6da('0x13'),_0x578424,_0xf6da('0x14'));logger[_0xf6da('0x15')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x578424,_0xf6da('0x14'),JSON[_0xf6da('0x16')](_0xfb923a));if(_0xfb923a[_0xf6da('0x17')]){if(_0xfb923a[_0xf6da('0x17')][_0xf6da('0x18')]===0x1f4){logger['error'](_0xf6da('0x13'),_0x578424,_0xfb923a[_0xf6da('0x17')][_0xf6da('0x19')]);return _0x329ca7(_0xfb923a[_0xf6da('0x17')][_0xf6da('0x19')]);}logger[_0xf6da('0x17')](_0xf6da('0x13'),_0x578424,_0xfb923a[_0xf6da('0x17')][_0xf6da('0x19')]);return _0x461b6a(_0xfb923a[_0xf6da('0x17')][_0xf6da('0x19')]);}else{logger[_0xf6da('0x12')]('FaxInteraction,\x20%s,\x20%s',_0x578424,_0xf6da('0x14'));_0x461b6a(_0xfb923a[_0xf6da('0x1a')]['message']);}})['catch'](function(_0x4c639f){logger[_0xf6da('0x17')](_0xf6da('0x13'),_0x578424,_0x4c639f);_0x329ca7(_0x4c639f);});});}exports[_0xf6da('0x1b')]=function(_0x591b68){var _0x252c1f=this;return new Promise(function(_0x293f07,_0x105a68){return db[_0xf6da('0x1c')][_0xf6da('0x1d')](_0x591b68['body'],{'raw':_0x591b68[_0xf6da('0x1e')]?_0x591b68[_0xf6da('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x591b68['options']?_0x591b68[_0xf6da('0x1e')][_0xf6da('0x1f')]||null:null,'attributes':_0x591b68[_0xf6da('0x1e')]?_0x591b68['options'][_0xf6da('0x20')]||null:null,'limit':_0x591b68[_0xf6da('0x1e')]?_0x591b68[_0xf6da('0x1e')][_0xf6da('0x21')]||null:null})['then'](function(_0x3aaeb4){logger[_0xf6da('0x12')](_0xf6da('0x1b'),_0x591b68);logger[_0xf6da('0x15')]('UpdateFaxInteraction',_0x591b68,JSON[_0xf6da('0x16')](_0x3aaeb4));_0x293f07(_0x3aaeb4);})[_0xf6da('0x22')](function(_0x1546a7){logger[_0xf6da('0x17')]('UpdateFaxInteraction',_0x1546a7['message'],_0x591b68);_0x105a68(_0x252c1f['error'](0x1f4,_0x1546a7[_0xf6da('0x19')]));});});};exports[_0xf6da('0x23')]=function(_0x39e5ce){return new Promise(function(_0x3f5b4d,_0x4b6291){return db['FaxInteraction']['find']({'where':_0x39e5ce[_0xf6da('0x1e')]?_0x39e5ce[_0xf6da('0x1e')][_0xf6da('0x1f')]||null:null})[_0xf6da('0x11')](function(_0x54ffe5){if(_0x54ffe5){return _0x54ffe5[_0xf6da('0x24')](_0x39e5ce['body'][_0xf6da('0x25')],_['omit'](_0x39e5ce['body'],['ids','id'])||{});}})[_0xf6da('0x26')](function(_0x27705d){logger['info'](_0xf6da('0x27'),_0x39e5ce);logger[_0xf6da('0x15')](_0xf6da('0x27'),_0x39e5ce,JSON[_0xf6da('0x16')](_0x27705d));_0x3f5b4d(_0x27705d);})[_0xf6da('0x22')](function(_0x2935b5){logger[_0xf6da('0x17')]('AddTags',_0x2935b5[_0xf6da('0x19')],_0x39e5ce);_0x4b6291(_this['error'](0x1f4,_0x2935b5[_0xf6da('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index acf0524..cffc2d2 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 _0x2e47=['remove','update','emit','register','length','faxInteraction:','./faxInteraction.events','save'];(function(_0x218428,_0x9c5fdf){var _0x10504f=function(_0x11e3d4){while(--_0x11e3d4){_0x218428['push'](_0x218428['shift']());}};_0x10504f(++_0x9c5fdf);}(_0x2e47,0x66));var _0x72e4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2e47[_0x3dd15e];return _0x231fd0;};'use strict';var FaxInteractionEvents=require(_0x72e4('0x0'));var events=[_0x72e4('0x1'),_0x72e4('0x2'),_0x72e4('0x3')];function createListener(_0x25cfaa,_0x3ba62f){return function(_0x1b5f8d){_0x3ba62f[_0x72e4('0x4')](_0x25cfaa,_0x1b5f8d);};}function removeListener(_0x57e675,_0x3f272e){return function(){FaxInteractionEvents['removeListener'](_0x57e675,_0x3f272e);};}exports[_0x72e4('0x5')]=function(_0x347d7c){for(var _0x5c27f7=0x0,_0x28718b=events[_0x72e4('0x6')];_0x5c27f7<_0x28718b;_0x5c27f7++){var _0x32cb04=events[_0x5c27f7];var _0x51b705=createListener(_0x72e4('0x7')+_0x32cb04,_0x347d7c);FaxInteractionEvents['on'](_0x32cb04,_0x51b705);}}; \ No newline at end of file +var _0xfd7c=['emit','removeListener','register','./faxInteraction.events','save','update'];(function(_0x5c815a,_0x4a614){var _0x1532e1=function(_0x1d0137){while(--_0x1d0137){_0x5c815a['push'](_0x5c815a['shift']());}};_0x1532e1(++_0x4a614);}(_0xfd7c,0x135));var _0xcfd7=function(_0x56c1d9,_0x2b85de){_0x56c1d9=_0x56c1d9-0x0;var _0x4b6f61=_0xfd7c[_0x56c1d9];return _0x4b6f61;};'use strict';var FaxInteractionEvents=require(_0xcfd7('0x0'));var events=[_0xcfd7('0x1'),'remove',_0xcfd7('0x2')];function createListener(_0x2f7412,_0x199f00){return function(_0x54ec44){_0x199f00[_0xcfd7('0x3')](_0x2f7412,_0x54ec44);};}function removeListener(_0x548f88,_0x265264){return function(){FaxInteractionEvents[_0xcfd7('0x4')](_0x548f88,_0x265264);};}exports[_0xcfd7('0x5')]=function(_0x321594){for(var _0x2e2574=0x0,_0x49ee52=events['length'];_0x2e2574<_0x49ee52;_0x2e2574++){var _0x7d8065=events[_0x2e2574];var _0x34b67b=createListener('faxInteraction:'+_0x7d8065,_0x321594);FaxInteractionEvents['on'](_0x7d8065,_0x34b67b);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 61ae0c0..d1b427d 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 _0x8373=['faxinteraction:update','delete','faxinteraction:destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages','/:id/download','create','post','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','put'];(function(_0x2fe3c0,_0x5d3e98){var _0x246d14=function(_0x119efa){while(--_0x119efa){_0x2fe3c0['push'](_0x2fe3c0['shift']());}};_0x246d14(++_0x5d3e98);}(_0x8373,0x1c5));var _0x3837=function(_0xc4ad37,_0x237318){_0xc4ad37=_0xc4ad37-0x0;var _0x4da885=_0x8373[_0xc4ad37];return _0x4da885;};'use strict';var multer=require(_0x3837('0x0'));var util=require(_0x3837('0x1'));var path=require(_0x3837('0x2'));var timeout=require(_0x3837('0x3'));var express=require(_0x3837('0x4'));var router=express[_0x3837('0x5')]();var fs_extra=require(_0x3837('0x6'));var auth=require(_0x3837('0x7'));var interaction=require(_0x3837('0x8'));var config=require(_0x3837('0x9'));var controller=require('./faxInteraction.controller');router[_0x3837('0xa')]('/',auth[_0x3837('0xb')](),controller[_0x3837('0xc')]);router['get'](_0x3837('0xd'),auth[_0x3837('0xb')](),controller[_0x3837('0xe')]);router['get'](_0x3837('0xf'),auth['isAuthenticated'](),controller['show']);router['get'](_0x3837('0x10'),auth[_0x3837('0xb')](),controller[_0x3837('0x11')]);router['get'](_0x3837('0x12'),auth[_0x3837('0xb')](),controller['download']);router['post']('/',auth[_0x3837('0xb')](),controller[_0x3837('0x13')]);router[_0x3837('0x14')](_0x3837('0x10'),auth['isAuthenticated'](),controller[_0x3837('0x15')]);router[_0x3837('0x14')](_0x3837('0x16'),auth[_0x3837('0xb')](),interaction[_0x3837('0x17')](_0x3837('0x18'),_0x3837('0x19')),controller['addTags']);router[_0x3837('0x1a')](_0x3837('0xf'),auth[_0x3837('0xb')](),interaction['tracked'](_0x3837('0x18'),_0x3837('0x1b')),controller['update']);router[_0x3837('0x1c')](_0x3837('0xf'),auth['isAuthenticated'](),interaction[_0x3837('0x17')](_0x3837('0x18'),_0x3837('0x1d')),controller['destroy']);router[_0x3837('0x1c')](_0x3837('0x16'),auth[_0x3837('0xb')](),controller[_0x3837('0x1e')]);module[_0x3837('0x1f')]=router; \ No newline at end of file +var _0xd0fe=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','faxinteraction:addtags','addTags','put','/:id','fax','faxinteraction:update','delete','faxinteraction:destroy','removeTags','exports','multer','util','connect-timeout','Router','fs-extra'];(function(_0xf33afd,_0x2363b6){var _0x5f432a=function(_0x2599b5){while(--_0x2599b5){_0xf33afd['push'](_0xf33afd['shift']());}};_0x5f432a(++_0x2363b6);}(_0xd0fe,0xdb));var _0xed0f=function(_0x58b4c8,_0x4cb93c){_0x58b4c8=_0x58b4c8-0x0;var _0x310786=_0xd0fe[_0x58b4c8];return _0x310786;};'use strict';var multer=require(_0xed0f('0x0'));var util=require(_0xed0f('0x1'));var path=require('path');var timeout=require(_0xed0f('0x2'));var express=require('express');var router=express[_0xed0f('0x3')]();var fs_extra=require(_0xed0f('0x4'));var auth=require(_0xed0f('0x5'));var interaction=require(_0xed0f('0x6'));var config=require(_0xed0f('0x7'));var controller=require('./faxInteraction.controller');router[_0xed0f('0x8')]('/',auth[_0xed0f('0x9')](),controller[_0xed0f('0xa')]);router[_0xed0f('0x8')](_0xed0f('0xb'),auth[_0xed0f('0x9')](),controller['describe']);router[_0xed0f('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xed0f('0xc')]);router['get'](_0xed0f('0xd'),auth[_0xed0f('0x9')](),controller[_0xed0f('0xe')]);router['get'](_0xed0f('0xf'),auth[_0xed0f('0x9')](),controller[_0xed0f('0x10')]);router['post']('/',auth[_0xed0f('0x9')](),controller[_0xed0f('0x11')]);router[_0xed0f('0x12')](_0xed0f('0xd'),auth[_0xed0f('0x9')](),controller[_0xed0f('0x13')]);router['post'](_0xed0f('0x14'),auth[_0xed0f('0x9')](),interaction[_0xed0f('0x15')]('fax',_0xed0f('0x16')),controller[_0xed0f('0x17')]);router[_0xed0f('0x18')](_0xed0f('0x19'),auth[_0xed0f('0x9')](),interaction[_0xed0f('0x15')](_0xed0f('0x1a'),_0xed0f('0x1b')),controller['update']);router[_0xed0f('0x1c')](_0xed0f('0x19'),auth[_0xed0f('0x9')](),interaction[_0xed0f('0x15')]('fax',_0xed0f('0x1d')),controller['destroy']);router[_0xed0f('0x1c')]('/:id/tags',auth[_0xed0f('0x9')](),controller[_0xed0f('0x1e')]);module[_0xed0f('0x1f')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index ed248ba..2d1db32 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 _0xed95=['DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x621a5d,_0x335855){var _0x4f2e4a=function(_0x2d5baf){while(--_0x2d5baf){_0x621a5d['push'](_0x621a5d['shift']());}};_0x4f2e4a(++_0x335855);}(_0xed95,0xb9));var _0x5ed9=function(_0xceaa17,_0x3811ee){_0xceaa17=_0xceaa17-0x0;var _0x29dc4a=_0xed95[_0xceaa17];return _0x29dc4a;};'use strict';var Sequelize=require(_0x5ed9('0x0'));module[_0x5ed9('0x1')]={'body':{'type':Sequelize[_0x5ed9('0x2')](_0x5ed9('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x5ed9('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5ed9('0x5')]('in',_0x5ed9('0x6')),'defaultValue':_0x5ed9('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x5ed9('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x5ed9('0x7')]}}; \ No newline at end of file +var _0x5455=['TEXT','medium','BOOLEAN','ENUM','out','exports'];(function(_0x311fd6,_0xd22798){var _0x561e3c=function(_0x40ebaa){while(--_0x40ebaa){_0x311fd6['push'](_0x311fd6['shift']());}};_0x561e3c(++_0xd22798);}(_0x5455,0x197));var _0x5545=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x5455[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require('sequelize');module[_0x5545('0x0')]={'body':{'type':Sequelize[_0x5545('0x1')](_0x5545('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x5545('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5545('0x4')]('in',_0x5545('0x5')),'defaultValue':_0x5545('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 18bb6ca..c437349 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 _0xc1f5=['SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','SELECT','User','agent','fullname','email','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','fax-interactions','FaxInteractionId','rejectMessage','Sequelize','QueryTypes','contact','internal','interface','create','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','download','join','root','server','attachments','basename','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','options','includeAll','findAll','params','include','body','find','describe','accept','fax','read','readAt','format','UserId','user','get','FaxInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage'];(function(_0x31a37b,_0x826249){var _0x49ae16=function(_0x2e8d52){while(--_0x2e8d52){_0x31a37b['push'](_0x31a37b['shift']());}};_0x49ae16(++_0x826249);}(_0xc1f5,0xb6));var _0x5c1f=function(_0x41a043,_0x3ec55f){_0x41a043=_0x41a043-0x0;var _0x1548b5=_0xc1f5[_0x41a043];return _0x1548b5;};'use strict';var emlformat=require(_0x5c1f('0x0'));var rimraf=require(_0x5c1f('0x1'));var zipdir=require(_0x5c1f('0x2'));var jsonpatch=require(_0x5c1f('0x3'));var rp=require(_0x5c1f('0x4'));var moment=require(_0x5c1f('0x5'));var BPromise=require(_0x5c1f('0x6'));var Mustache=require('mustache');var util=require(_0x5c1f('0x7'));var path=require(_0x5c1f('0x8'));var sox=require('sox');var csv=require(_0x5c1f('0x9'));var ejs=require(_0x5c1f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5c1f('0xb'));var squel=require(_0x5c1f('0xc'));var crypto=require(_0x5c1f('0xd'));var jsforce=require(_0x5c1f('0xe'));var deskjs=require(_0x5c1f('0xf'));var toCsv=require(_0x5c1f('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5c1f('0x10'));var authService=require(_0x5c1f('0x11'));var qs=require(_0x5c1f('0x12'));var as=require(_0x5c1f('0x13'));var hardwareService=require(_0x5c1f('0x14'));var logger=require(_0x5c1f('0x15'))(_0x5c1f('0x16'));var utils=require(_0x5c1f('0x17'));var config=require(_0x5c1f('0x18'));var licenseUtil=require(_0x5c1f('0x19'));var db=require('../../mysqldb')['db'];config[_0x5c1f('0x1a')]=_[_0x5c1f('0x1b')](config['redis'],{'host':_0x5c1f('0x1c'),'port':0x18eb});var socket=require(_0x5c1f('0x1d'))(new Redis(config[_0x5c1f('0x1a')]));require(_0x5c1f('0x1e'))[_0x5c1f('0x1f')](socket);var jayson=require(_0x5c1f('0x20'));var client=jayson[_0x5c1f('0x21')]['http']({'port':0x232c});var client9002=jayson['client'][_0x5c1f('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x318a6a,_0x22215e,_0x198e82,_0x226ccb){return new BPromise(function(_0x2cb79c,_0x14a137){var _0x392eca=_0x226ccb||client;return _0x392eca[_0x5c1f('0x23')](_0x318a6a,_0x198e82)[_0x5c1f('0x24')](function(_0x24f047){logger[_0x5c1f('0x25')](_0x5c1f('0x26'),_0x22215e,_0x5c1f('0x27'));logger['debug'](_0x5c1f('0x28'),_0x22215e,_0x5c1f('0x27'),JSON[_0x5c1f('0x29')](_0x24f047));if(_0x24f047[_0x5c1f('0x2a')]){if(_0x24f047[_0x5c1f('0x2a')]['code']===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x22215e,_0x24f047[_0x5c1f('0x2a')][_0x5c1f('0x2b')]);return _0x14a137(_0x24f047[_0x5c1f('0x2a')][_0x5c1f('0x2b')]);}logger[_0x5c1f('0x2a')](_0x5c1f('0x26'),_0x22215e,_0x24f047[_0x5c1f('0x2a')][_0x5c1f('0x2b')]);return _0x2cb79c(_0x24f047[_0x5c1f('0x2a')][_0x5c1f('0x2b')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x22215e,'request\x20sent');_0x2cb79c(_0x24f047[_0x5c1f('0x2c')][_0x5c1f('0x2b')]);}})[_0x5c1f('0x2d')](function(_0xe389bd){logger[_0x5c1f('0x2a')](_0x5c1f('0x26'),_0x22215e,_0xe389bd);_0x14a137(_0xe389bd);});});}function respondWithStatusCode(_0x572e72,_0x3db78c){_0x3db78c=_0x3db78c||0xcc;return function(_0xccad90){if(_0xccad90){return _0x572e72[_0x5c1f('0x2e')](_0x3db78c);}return _0x572e72[_0x5c1f('0x2f')](_0x3db78c)[_0x5c1f('0x30')]();};}function respondWithResult(_0x18b30f,_0x4593db){_0x4593db=_0x4593db||0xc8;return function(_0x4fed05){if(_0x4fed05){return _0x18b30f[_0x5c1f('0x2f')](_0x4593db)[_0x5c1f('0x31')](_0x4fed05);}};}function respondWithFilteredResult(_0x23338d,_0x4a4b9c){return function(_0x18fc37){if(_0x18fc37){var _0x415455=typeof _0x4a4b9c[_0x5c1f('0x32')]===_0x5c1f('0x33')&&typeof _0x4a4b9c[_0x5c1f('0x34')]===_0x5c1f('0x33');var _0x10caf0=_0x18fc37[_0x5c1f('0x35')];var _0x584547=_0x415455?0x0:_0x4a4b9c['offset'];var _0xb22ddf=_0x415455?_0x18fc37[_0x5c1f('0x35')]:_0x4a4b9c[_0x5c1f('0x32')]+_0x4a4b9c[_0x5c1f('0x34')];var _0x5f4795;if(_0xb22ddf>=_0x10caf0){_0xb22ddf=_0x10caf0;_0x5f4795=0xc8;}else{_0x5f4795=0xce;}_0x23338d['status'](_0x5f4795);return _0x23338d[_0x5c1f('0x36')](_0x5c1f('0x37'),_0x584547+'-'+_0xb22ddf+'/'+_0x10caf0)['json'](_0x18fc37);}return null;};}function patchUpdates(_0x22fffd){return function(_0x7ab4e2){try{jsonpatch[_0x5c1f('0x38')](_0x7ab4e2,_0x22fffd,!![]);}catch(_0x216e23){return BPromise[_0x5c1f('0x39')](_0x216e23);}return _0x7ab4e2[_0x5c1f('0x3a')]();};}function saveUpdates(_0x68d4e5,_0x27aac2){return function(_0x36fcdc){if(_0x36fcdc){return _0x36fcdc[_0x5c1f('0x3b')](_0x68d4e5)[_0x5c1f('0x24')](function(_0xd01ab7){return _0xd01ab7;});}return null;};}function removeEntity(_0x2196fd,_0x20eba6){return function(_0x941ab7){if(_0x941ab7){return _0x941ab7[_0x5c1f('0x3c')]()[_0x5c1f('0x24')](function(){_0x2196fd[_0x5c1f('0x2f')](0xcc)[_0x5c1f('0x30')]();});}};}function handleEntityNotFound(_0xe974a9,_0x5dffe5){return function(_0x463760){if(!_0x463760){_0xe974a9['sendStatus'](0x194);}return _0x463760;};}function handleError(_0x3058f4,_0x8c9ef8){_0x8c9ef8=_0x8c9ef8||0x1f4;return function(_0x561048){logger[_0x5c1f('0x2a')](_0x561048[_0x5c1f('0x3d')]);if(_0x561048[_0x5c1f('0x3e')]){delete _0x561048[_0x5c1f('0x3e')];}_0x3058f4['status'](_0x8c9ef8)[_0x5c1f('0x3f')](_0x561048);};}exports[_0x5c1f('0x40')]=function(_0xa98e6e,_0x1a5c9c){var _0x4631d0={},_0x3443fa={},_0x143c68={'count':0x0,'rows':[]};var _0x3229c1=_[_0x5c1f('0x41')](db[_0x5c1f('0x42')][_0x5c1f('0x43')],function(_0x136f89){return{'name':_0x136f89[_0x5c1f('0x44')],'type':_0x136f89[_0x5c1f('0x45')]['key']};});_0x3443fa[_0x5c1f('0x46')]=_[_0x5c1f('0x41')](_0x3229c1,_0x5c1f('0x3e'));_0x3443fa[_0x5c1f('0x47')]=_[_0x5c1f('0x48')](_0xa98e6e['query']);_0x3443fa[_0x5c1f('0x49')]=_[_0x5c1f('0x4a')](_0x3443fa[_0x5c1f('0x46')],_0x3443fa[_0x5c1f('0x47')]);_0x4631d0['attributes']=_[_0x5c1f('0x4a')](_0x3443fa[_0x5c1f('0x46')],qs['fields'](_0xa98e6e[_0x5c1f('0x47')][_0x5c1f('0x4b')]));_0x4631d0['attributes']=_0x4631d0[_0x5c1f('0x4c')][_0x5c1f('0x4d')]?_0x4631d0[_0x5c1f('0x4c')]:_0x3443fa[_0x5c1f('0x46')];if(!_0xa98e6e[_0x5c1f('0x47')][_0x5c1f('0x4e')]('nolimit')){_0x4631d0[_0x5c1f('0x34')]=qs[_0x5c1f('0x34')](_0xa98e6e['query'][_0x5c1f('0x34')]);_0x4631d0[_0x5c1f('0x32')]=qs[_0x5c1f('0x32')](_0xa98e6e['query']['offset']);}_0x4631d0[_0x5c1f('0x4f')]=qs[_0x5c1f('0x50')](_0xa98e6e[_0x5c1f('0x47')][_0x5c1f('0x50')]);_0x4631d0['where']=qs['filters'](_[_0x5c1f('0x51')](_0xa98e6e[_0x5c1f('0x47')],_0x3443fa[_0x5c1f('0x49')]),_0x3229c1);if(_0xa98e6e[_0x5c1f('0x47')][_0x5c1f('0x52')]){_0x4631d0[_0x5c1f('0x53')]=_['merge'](_0x4631d0[_0x5c1f('0x53')],{'$or':_[_0x5c1f('0x41')](_0x3229c1,function(_0x3060c4){if(_0x3060c4[_0x5c1f('0x45')]!=='VIRTUAL'){var _0x170c07={};_0x170c07[_0x3060c4[_0x5c1f('0x3e')]]={'$like':'%'+_0xa98e6e['query'][_0x5c1f('0x52')]+'%'};return _0x170c07;}})});}_0x4631d0=_['merge']({},_0x4631d0,_0xa98e6e[_0x5c1f('0x54')]);var _0x1a9c72={'where':_0x4631d0['where']};return db[_0x5c1f('0x42')][_0x5c1f('0x35')](_0x1a9c72)[_0x5c1f('0x24')](function(_0xf234a4){_0x143c68[_0x5c1f('0x35')]=_0xf234a4;if(_0xa98e6e[_0x5c1f('0x47')][_0x5c1f('0x55')]){_0x4631d0['include']=[{'all':!![]}];}return db['FaxMessage'][_0x5c1f('0x56')](_0x4631d0);})['then'](function(_0x192b01){_0x143c68['rows']=_0x192b01;return _0x143c68;})[_0x5c1f('0x24')](respondWithFilteredResult(_0x1a5c9c,_0x4631d0))['catch'](handleError(_0x1a5c9c,null));};exports['show']=function(_0x15cb1c,_0x163d71){var _0x18bd90={'raw':!![],'where':{'id':_0x15cb1c[_0x5c1f('0x57')]['id']}},_0x135854={};_0x135854[_0x5c1f('0x46')]=_[_0x5c1f('0x48')](db[_0x5c1f('0x42')][_0x5c1f('0x43')]);_0x135854[_0x5c1f('0x47')]=_['keys'](_0x15cb1c[_0x5c1f('0x47')]);_0x135854['filters']=_[_0x5c1f('0x4a')](_0x135854[_0x5c1f('0x46')],_0x135854[_0x5c1f('0x47')]);_0x18bd90[_0x5c1f('0x4c')]=_[_0x5c1f('0x4a')](_0x135854[_0x5c1f('0x46')],qs[_0x5c1f('0x4b')](_0x15cb1c[_0x5c1f('0x47')][_0x5c1f('0x4b')]));_0x18bd90[_0x5c1f('0x4c')]=_0x18bd90[_0x5c1f('0x4c')]['length']?_0x18bd90[_0x5c1f('0x4c')]:_0x135854[_0x5c1f('0x46')];if(_0x15cb1c[_0x5c1f('0x47')][_0x5c1f('0x55')]){_0x18bd90[_0x5c1f('0x58')]=[{'all':!![]}];}_0x18bd90=_['merge']({},_0x18bd90,_0x15cb1c['options']);return db['FaxMessage']['find'](_0x18bd90)[_0x5c1f('0x24')](handleEntityNotFound(_0x163d71,null))[_0x5c1f('0x24')](respondWithResult(_0x163d71,null))[_0x5c1f('0x2d')](handleError(_0x163d71,null));};exports[_0x5c1f('0x3b')]=function(_0x8aa1bc,_0x299069){if(_0x8aa1bc[_0x5c1f('0x59')]['id']){delete _0x8aa1bc['body']['id'];}return db[_0x5c1f('0x42')][_0x5c1f('0x5a')]({'where':{'id':_0x8aa1bc[_0x5c1f('0x57')]['id']}})[_0x5c1f('0x24')](handleEntityNotFound(_0x299069,null))['then'](saveUpdates(_0x8aa1bc[_0x5c1f('0x59')],null))[_0x5c1f('0x24')](respondWithResult(_0x299069,null))['catch'](handleError(_0x299069,null));};exports[_0x5c1f('0x3c')]=function(_0x575bd1,_0x1d2bc3){return db[_0x5c1f('0x42')]['find']({'where':{'id':_0x575bd1[_0x5c1f('0x57')]['id']}})[_0x5c1f('0x24')](handleEntityNotFound(_0x1d2bc3,null))[_0x5c1f('0x24')](removeEntity(_0x1d2bc3,null))[_0x5c1f('0x2d')](handleError(_0x1d2bc3,null));};exports['describe']=function(_0x3af494,_0xa74a12){return db[_0x5c1f('0x42')][_0x5c1f('0x5b')]()['then'](respondWithResult(_0xa74a12,null))[_0x5c1f('0x2d')](handleError(_0xa74a12,null));};var interaction_log=require(_0x5c1f('0x15'))('fax-interactions');exports[_0x5c1f('0x5c')]=function(_0x3df3b6,_0x3caee8,_0x34a675){var _0x2e5a83={'agent':{},'channel':_0x5c1f('0x5d')};if(_0x3df3b6['body']['id']){delete _0x3df3b6[_0x5c1f('0x59')]['id'];}_0x3df3b6[_0x5c1f('0x59')][_0x5c1f('0x5e')]=!![];_0x3df3b6['body'][_0x5c1f('0x5f')]=moment()[_0x5c1f('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x3df3b6[_0x5c1f('0x59')][_0x5c1f('0x61')]=_0x3df3b6[_0x5c1f('0x59')][_0x5c1f('0x61')]||_0x3df3b6[_0x5c1f('0x62')]['id'];_0x2e5a83['agent']['id']=_0x3df3b6[_0x5c1f('0x59')]['UserId'];return db['FaxMessage'][_0x5c1f('0x5a')]({'where':{'id':_0x3df3b6[_0x5c1f('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3caee8,null))[_0x5c1f('0x24')](saveUpdates(_0x3df3b6[_0x5c1f('0x59')],null))[_0x5c1f('0x24')](function(_0x448405){if(_0x448405){_0x2e5a83[_0x5c1f('0x2b')]=_0x448405[_0x5c1f('0x63')]({'plain':!![]});return db[_0x5c1f('0x64')][_0x5c1f('0x5a')]({'where':{'id':_0x448405['FaxInteractionId']}});}return null;})[_0x5c1f('0x24')](handleEntityNotFound(_0x3caee8,null))[_0x5c1f('0x24')](function(_0x1878e0){if(_0x1878e0){return _0x1878e0[_0x5c1f('0x3b')]({'UserId':_0x3df3b6[_0x5c1f('0x59')][_0x5c1f('0x61')],'read1stAt':_[_0x5c1f('0x65')](_0x1878e0[_0x5c1f('0x66')])?moment()['format'](_0x5c1f('0x67')):undefined});}return null;})[_0x5c1f('0x24')](function(_0x30a82e){if(_0x30a82e){_0x2e5a83[_0x5c1f('0x68')]=_0x30a82e[_0x5c1f('0x63')]({'plain':!![]});interaction_log[_0x5c1f('0x25')](_0x5c1f('0x69'),_0x3df3b6[_0x5c1f('0x62')]['id'],_0x3df3b6['user']['name'],_0x3df3b6[_0x5c1f('0x62')][_0x5c1f('0x6a')],_0x2e5a83['interaction']['id'],_0x3df3b6[_0x5c1f('0x59')]?JSON[_0x5c1f('0x29')](_0x3df3b6['body']):_0x5c1f('0x6b'));return respondWithRpcPromise(_0x5c1f('0x6c'),_0x5c1f('0x6d'),_0x2e5a83);}return null;})['then'](function(_0x1ed816){var _0x526cc6=_0x5c1f('0x6e')+_0x1ed816[_0x5c1f('0x2b')][_0x5c1f('0x6f')];return db[_0x5c1f('0x70')][_0x5c1f('0x47')](_0x526cc6,{'type':db['Sequelize']['QueryTypes'][_0x5c1f('0x71')],'raw':!![]})[_0x5c1f('0x24')](function(_0xccb0ba){return _0xccb0ba;});})[_0x5c1f('0x24')](function(_0x34f31f){if(_0x34f31f){_0x2e5a83[_0x5c1f('0x2b')]['contact']=_0x34f31f[0x0];if(!_0x3df3b6['body'][_0x5c1f('0x61')])return;return db[_0x5c1f('0x72')][_0x5c1f('0x5a')]({'where':{'id':_0x3df3b6[_0x5c1f('0x59')][_0x5c1f('0x61')],'role':_0x5c1f('0x73')},'attributes':['id',_0x5c1f('0x3e'),_0x5c1f('0x74'),_0x5c1f('0x75'),'internal'],'raw':!![]});}return null;})[_0x5c1f('0x24')](function(_0x268084){if(!_0x268084)return null;_0x2e5a83[_0x5c1f('0x2b')][_0x5c1f('0x73')]=_0x268084;return _0x2e5a83;})[_0x5c1f('0x24')](function(_0x5f2f5f){if(_0x5f2f5f){if(_0x3df3b6['body'][_0x5c1f('0x76')]){_0x2e5a83[_0x5c1f('0x2b')]['interface']=util['format'](_0x5c1f('0x77'),_0x3df3b6[_0x5c1f('0x62')][_0x5c1f('0x3e')]);_0x2e5a83[_0x5c1f('0x2b')][_0x5c1f('0x78')]=_0x2e5a83[_0x5c1f('0x78')];_0x2e5a83[_0x5c1f('0x2b')][_0x5c1f('0x79')]=_0x2e5a83['channel'];_0x2e5a83[_0x5c1f('0x2b')][_0x5c1f('0x7a')]=_0x5c1f('0x5c');return respondWithRpcPromise(_0x5c1f('0x7b'),_0x5c1f('0x7b'),{'event':_0x5c1f('0x7c'),'message':_0x2e5a83[_0x5c1f('0x2b')]},client9002)['then'](function(){return _0x2e5a83;});}return _0x2e5a83;}return null;})[_0x5c1f('0x24')](respondWithResult(_0x3caee8,null))[_0x5c1f('0x2d')](handleError(_0x3caee8,null));};var interaction_log=require(_0x5c1f('0x15'))(_0x5c1f('0x7d'));exports['reject']=function(_0x3d55a7,_0xeba6b,_0x1c8580){var _0x4f55ff={'agent':{},'channel':_0x5c1f('0x5d')};if(_0x3d55a7[_0x5c1f('0x59')]['id']){delete _0x3d55a7[_0x5c1f('0x59')]['id'];}_0x3d55a7[_0x5c1f('0x59')]['UserId']=_0x3d55a7['body'][_0x5c1f('0x61')]||_0x3d55a7['user']['id'];_0x4f55ff[_0x5c1f('0x73')]['id']=_0x3d55a7['body'][_0x5c1f('0x61')];return db[_0x5c1f('0x42')][_0x5c1f('0x5a')]({'where':{'id':_0x3d55a7[_0x5c1f('0x57')]['id'],'UserId':null}})[_0x5c1f('0x24')](handleEntityNotFound(_0xeba6b,null))[_0x5c1f('0x24')](function(_0x1eb4b7){if(_0x1eb4b7){_0x4f55ff[_0x5c1f('0x2b')]=_0x1eb4b7['get']({'plain':!![]});return db[_0x5c1f('0x64')][_0x5c1f('0x5a')]({'where':{'id':_0x1eb4b7[_0x5c1f('0x7e')]}});}return null;})['then'](handleEntityNotFound(_0xeba6b,null))['then'](function(_0x358b49){if(_0x358b49){_0x4f55ff[_0x5c1f('0x68')]=_0x358b49[_0x5c1f('0x63')]({'plain':!![]});interaction_log[_0x5c1f('0x25')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3d55a7[_0x5c1f('0x62')]['id'],_0x3d55a7[_0x5c1f('0x62')][_0x5c1f('0x3e')],_0x3d55a7[_0x5c1f('0x62')][_0x5c1f('0x6a')],_0x4f55ff[_0x5c1f('0x68')]['id'],_0x3d55a7[_0x5c1f('0x59')]?JSON['stringify'](_0x3d55a7[_0x5c1f('0x59')]):_0x5c1f('0x6b'));return respondWithRpcPromise('RejectMessage',_0x5c1f('0x7f'),_0x4f55ff);}return null;})[_0x5c1f('0x24')](function(_0x3c441b){var _0x4fdaf1='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3c441b[_0x5c1f('0x2b')]['ContactId'];return db[_0x5c1f('0x70')][_0x5c1f('0x47')](_0x4fdaf1,{'type':db[_0x5c1f('0x80')][_0x5c1f('0x81')][_0x5c1f('0x71')],'raw':!![]})[_0x5c1f('0x24')](function(_0x152edd){return _0x152edd;});})[_0x5c1f('0x24')](function(_0x3ef41f){if(_0x3ef41f){_0x4f55ff[_0x5c1f('0x2b')][_0x5c1f('0x82')]=_0x3ef41f[0x0];if(!_0x3d55a7[_0x5c1f('0x59')][_0x5c1f('0x61')])return;return db[_0x5c1f('0x72')][_0x5c1f('0x5a')]({'where':{'id':_0x3d55a7['body'][_0x5c1f('0x61')],'role':_0x5c1f('0x73')},'attributes':['id','name','fullname',_0x5c1f('0x75'),_0x5c1f('0x83')],'raw':!![]});}return null;})['then'](function(_0x2ae6ed){if(!_0x2ae6ed)return null;_0x4f55ff[_0x5c1f('0x2b')][_0x5c1f('0x73')]=_0x2ae6ed;return _0x4f55ff;})['then'](function(_0x407f80){if(_0x407f80){_0x407f80[_0x5c1f('0x2b')][_0x5c1f('0x84')]=util['format'](_0x5c1f('0x77'),_0x3d55a7['user'][_0x5c1f('0x3e')]);_0x407f80[_0x5c1f('0x2b')]['channel']=_0x4f55ff[_0x5c1f('0x78')];_0x407f80[_0x5c1f('0x2b')][_0x5c1f('0x79')]=_0x4f55ff['channel'];_0x407f80[_0x5c1f('0x2b')][_0x5c1f('0x7a')]=_0x5c1f('0x39');respondWithRpcPromise(_0x5c1f('0x7b'),'EventManager',{'event':'rejectmessage','message':_0x407f80['message']},client9002);return _0x4f55ff;}return null;})[_0x5c1f('0x24')](respondWithResult(_0xeba6b,null))[_0x5c1f('0x2d')](handleError(_0xeba6b,null));};exports[_0x5c1f('0x85')]=function(_0x7f0da1,_0x3e42b6){var _0x1a7e05;return db['FaxMessage'][_0x5c1f('0x85')](_0x7f0da1[_0x5c1f('0x59')],{})[_0x5c1f('0x24')](function(_0x9eb481){_0x1a7e05=_0x9eb481;return db['CmContact'][_0x5c1f('0x86')]({'where':{'id':_0x1a7e05[_0x5c1f('0x6f')]}});})[_0x5c1f('0x24')](function(_0x2a8305){if(_[_0x5c1f('0x65')](_0x2a8305)){return;}else{_0x1a7e05[_0x5c1f('0x5d')]=_0x2a8305[_0x5c1f('0x5d')];return db[_0x5c1f('0x87')][_0x5c1f('0x86')]({'where':{'id':_0x1a7e05[_0x5c1f('0x88')]}});}})[_0x5c1f('0x24')](function(_0x245c3d){return respondWithRpcPromise(_0x5c1f('0x89'),_0x5c1f('0x89'),{'FaxAccountId':_['isNil'](_0x7f0da1['body'])?undefined:_0x7f0da1[_0x5c1f('0x59')][_0x5c1f('0x8a')],'path':_[_0x5c1f('0x65')](_0x245c3d)?undefined:util['format'](_0x5c1f('0x8b'),_0x245c3d['basename']),'fax':_[_0x5c1f('0x65')](_0x1a7e05[_0x5c1f('0x5d')])?undefined:_0x1a7e05[_0x5c1f('0x5d')],'AttachmentId':_0x1a7e05['AttachmentId']},client9002);})[_0x5c1f('0x24')](respondWithResult(_0x3e42b6,0xc9))[_0x5c1f('0x2d')](handleError(_0x3e42b6,null));};exports[_0x5c1f('0x8c')]=function(_0x2eba3f,_0x380982){var _0x51dddf=path[_0x5c1f('0x8d')](config[_0x5c1f('0x8e')],_0x5c1f('0x8f'),'files',_0x5c1f('0x90'));return db[_0x5c1f('0x42')]['find']({'where':{'id':_0x2eba3f[_0x5c1f('0x57')]['id']},'include':[{'model':db['Attachment'],'as':_0x5c1f('0x87')}]})['then'](handleEntityNotFound(_0x380982,null))['then'](function(_0x23c128){if(_0x23c128){return _0x380982[_0x5c1f('0x8c')](path[_0x5c1f('0x8d')](_0x51dddf,_0x23c128['Attachment'][_0x5c1f('0x91')]));}})[_0x5c1f('0x2d')](handleError(_0x380982,null));}; \ No newline at end of file +var _0x5850=['sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','body','describe','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','FaxInteraction','FaxInteractionId','interaction','role','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','email','internal','interface','channel','motionChannel','EventManager','acceptmessage','fax-interactions','reject','get','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','fullname','SIP/%s','event','create','CmContact','findOne','isNil','fax','Attachment','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','download','join','server','files','attachments','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxMessage.socket','register','client','http','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','sendStatus','stack','name','send','index','FaxMessage','rawAttributes','fieldName','type','key','model','map','query','attributes','intersection','fields','length','hasOwnProperty'];(function(_0x12009f,_0x70d95){var _0xc6ea8=function(_0x570303){while(--_0x570303){_0x12009f['push'](_0x12009f['shift']());}};_0xc6ea8(++_0x70d95);}(_0x5850,0x1e9));var _0x0585=function(_0x128892,_0x1f93c2){_0x128892=_0x128892-0x0;var _0x4209d6=_0x5850[_0x128892];return _0x4209d6;};'use strict';var emlformat=require(_0x0585('0x0'));var rimraf=require(_0x0585('0x1'));var zipdir=require(_0x0585('0x2'));var jsonpatch=require(_0x0585('0x3'));var rp=require(_0x0585('0x4'));var moment=require(_0x0585('0x5'));var BPromise=require(_0x0585('0x6'));var Mustache=require(_0x0585('0x7'));var util=require('util');var path=require(_0x0585('0x8'));var sox=require('sox');var csv=require(_0x0585('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0585('0xa'));var _=require(_0x0585('0xb'));var squel=require('squel');var crypto=require(_0x0585('0xc'));var jsforce=require(_0x0585('0xd'));var deskjs=require(_0x0585('0xe'));var toCsv=require(_0x0585('0x9'));var querystring=require('querystring');var Papa=require(_0x0585('0xf'));var Redis=require(_0x0585('0x10'));var authService=require(_0x0585('0x11'));var qs=require(_0x0585('0x12'));var as=require(_0x0585('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x0585('0x14'));var config=require(_0x0585('0x15'));var licenseUtil=require(_0x0585('0x16'));var db=require(_0x0585('0x17'))['db'];config[_0x0585('0x18')]=_[_0x0585('0x19')](config[_0x0585('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x0585('0x1a'))(new Redis(config[_0x0585('0x18')]));require(_0x0585('0x1b'))[_0x0585('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x0585('0x1d')][_0x0585('0x1e')]({'port':0x232c});var client9002=jayson[_0x0585('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22466c,_0x13f7ff,_0x3a84a1,_0x13eb2e){return new BPromise(function(_0x35e3a3,_0xdaff03){var _0x5b729d=_0x13eb2e||client;return _0x5b729d['request'](_0x22466c,_0x3a84a1)['then'](function(_0x41cc17){logger[_0x0585('0x1f')](_0x0585('0x20'),_0x13f7ff,_0x0585('0x21'));logger[_0x0585('0x22')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x13f7ff,_0x0585('0x21'),JSON[_0x0585('0x23')](_0x41cc17));if(_0x41cc17[_0x0585('0x24')]){if(_0x41cc17[_0x0585('0x24')]['code']===0x1f4){logger[_0x0585('0x24')](_0x0585('0x20'),_0x13f7ff,_0x41cc17['error']['message']);return _0xdaff03(_0x41cc17[_0x0585('0x24')]['message']);}logger['error'](_0x0585('0x20'),_0x13f7ff,_0x41cc17[_0x0585('0x24')][_0x0585('0x25')]);return _0x35e3a3(_0x41cc17[_0x0585('0x24')]['message']);}else{logger[_0x0585('0x1f')](_0x0585('0x20'),_0x13f7ff,_0x0585('0x21'));_0x35e3a3(_0x41cc17[_0x0585('0x26')][_0x0585('0x25')]);}})[_0x0585('0x27')](function(_0x1a446f){logger['error'](_0x0585('0x20'),_0x13f7ff,_0x1a446f);_0xdaff03(_0x1a446f);});});}function respondWithStatusCode(_0x3c4f32,_0x104608){_0x104608=_0x104608||0xcc;return function(_0x1c4ef0){if(_0x1c4ef0){return _0x3c4f32['sendStatus'](_0x104608);}return _0x3c4f32[_0x0585('0x28')](_0x104608)[_0x0585('0x29')]();};}function respondWithResult(_0x2bdc44,_0x114c1b){_0x114c1b=_0x114c1b||0xc8;return function(_0x17d144){if(_0x17d144){return _0x2bdc44[_0x0585('0x28')](_0x114c1b)[_0x0585('0x2a')](_0x17d144);}};}function respondWithFilteredResult(_0x30b235,_0x5e6361){return function(_0x3c548b){if(_0x3c548b){var _0x44792b=typeof _0x5e6361[_0x0585('0x2b')]===_0x0585('0x2c')&&typeof _0x5e6361[_0x0585('0x2d')]===_0x0585('0x2c');var _0x179567=_0x3c548b[_0x0585('0x2e')];var _0xbcbb8c=_0x44792b?0x0:_0x5e6361[_0x0585('0x2b')];var _0x517e0=_0x44792b?_0x3c548b[_0x0585('0x2e')]:_0x5e6361['offset']+_0x5e6361[_0x0585('0x2d')];var _0x1cdbaa;if(_0x517e0>=_0x179567){_0x517e0=_0x179567;_0x1cdbaa=0xc8;}else{_0x1cdbaa=0xce;}_0x30b235[_0x0585('0x28')](_0x1cdbaa);return _0x30b235[_0x0585('0x2f')](_0x0585('0x30'),_0xbcbb8c+'-'+_0x517e0+'/'+_0x179567)[_0x0585('0x2a')](_0x3c548b);}return null;};}function patchUpdates(_0x5f28d0){return function(_0x488f15){try{jsonpatch['apply'](_0x488f15,_0x5f28d0,!![]);}catch(_0x1139f9){return BPromise['reject'](_0x1139f9);}return _0x488f15[_0x0585('0x31')]();};}function saveUpdates(_0x5a08c9,_0x331570){return function(_0x4491fd){if(_0x4491fd){return _0x4491fd[_0x0585('0x32')](_0x5a08c9)[_0x0585('0x33')](function(_0x21538){return _0x21538;});}return null;};}function removeEntity(_0x26c21a,_0x2208e9){return function(_0x16c716){if(_0x16c716){return _0x16c716[_0x0585('0x34')]()[_0x0585('0x33')](function(){_0x26c21a[_0x0585('0x28')](0xcc)[_0x0585('0x29')]();});}};}function handleEntityNotFound(_0x4719b6,_0x24a8b9){return function(_0x866a1c){if(!_0x866a1c){_0x4719b6[_0x0585('0x35')](0x194);}return _0x866a1c;};}function handleError(_0xb70325,_0x35e195){_0x35e195=_0x35e195||0x1f4;return function(_0x3990b5){logger['error'](_0x3990b5[_0x0585('0x36')]);if(_0x3990b5[_0x0585('0x37')]){delete _0x3990b5[_0x0585('0x37')];}_0xb70325[_0x0585('0x28')](_0x35e195)[_0x0585('0x38')](_0x3990b5);};}exports[_0x0585('0x39')]=function(_0x165477,_0x285125){var _0x552ef5={},_0x4898d2={},_0x38773a={'count':0x0,'rows':[]};var _0x4b17ef=_['map'](db[_0x0585('0x3a')][_0x0585('0x3b')],function(_0x4db1a2){return{'name':_0x4db1a2[_0x0585('0x3c')],'type':_0x4db1a2[_0x0585('0x3d')][_0x0585('0x3e')]};});_0x4898d2[_0x0585('0x3f')]=_[_0x0585('0x40')](_0x4b17ef,'name');_0x4898d2[_0x0585('0x41')]=_['keys'](_0x165477[_0x0585('0x41')]);_0x4898d2['filters']=_['intersection'](_0x4898d2['model'],_0x4898d2['query']);_0x552ef5[_0x0585('0x42')]=_[_0x0585('0x43')](_0x4898d2[_0x0585('0x3f')],qs[_0x0585('0x44')](_0x165477[_0x0585('0x41')][_0x0585('0x44')]));_0x552ef5[_0x0585('0x42')]=_0x552ef5['attributes'][_0x0585('0x45')]?_0x552ef5[_0x0585('0x42')]:_0x4898d2[_0x0585('0x3f')];if(!_0x165477['query'][_0x0585('0x46')]('nolimit')){_0x552ef5[_0x0585('0x2d')]=qs[_0x0585('0x2d')](_0x165477[_0x0585('0x41')][_0x0585('0x2d')]);_0x552ef5[_0x0585('0x2b')]=qs[_0x0585('0x2b')](_0x165477[_0x0585('0x41')][_0x0585('0x2b')]);}_0x552ef5['order']=qs[_0x0585('0x47')](_0x165477[_0x0585('0x41')][_0x0585('0x47')]);_0x552ef5[_0x0585('0x48')]=qs[_0x0585('0x49')](_['pick'](_0x165477[_0x0585('0x41')],_0x4898d2[_0x0585('0x49')]),_0x4b17ef);if(_0x165477['query'][_0x0585('0x4a')]){_0x552ef5['where']=_[_0x0585('0x4b')](_0x552ef5['where'],{'$or':_[_0x0585('0x40')](_0x4b17ef,function(_0x49a53d){if(_0x49a53d[_0x0585('0x3d')]!==_0x0585('0x4c')){var _0x24408f={};_0x24408f[_0x49a53d['name']]={'$like':'%'+_0x165477['query'][_0x0585('0x4a')]+'%'};return _0x24408f;}})});}_0x552ef5=_[_0x0585('0x4b')]({},_0x552ef5,_0x165477[_0x0585('0x4d')]);var _0x4bd103={'where':_0x552ef5[_0x0585('0x48')]};return db[_0x0585('0x3a')][_0x0585('0x2e')](_0x4bd103)['then'](function(_0x16ea06){_0x38773a['count']=_0x16ea06;if(_0x165477['query'][_0x0585('0x4e')]){_0x552ef5[_0x0585('0x4f')]=[{'all':!![]}];}return db[_0x0585('0x3a')][_0x0585('0x50')](_0x552ef5);})[_0x0585('0x33')](function(_0x5e3bc1){_0x38773a[_0x0585('0x51')]=_0x5e3bc1;return _0x38773a;})[_0x0585('0x33')](respondWithFilteredResult(_0x285125,_0x552ef5))[_0x0585('0x27')](handleError(_0x285125,null));};exports[_0x0585('0x52')]=function(_0x4f3568,_0x113885){var _0x3033e7={'raw':!![],'where':{'id':_0x4f3568[_0x0585('0x53')]['id']}},_0x146795={};_0x146795[_0x0585('0x3f')]=_[_0x0585('0x54')](db[_0x0585('0x3a')]['rawAttributes']);_0x146795[_0x0585('0x41')]=_[_0x0585('0x54')](_0x4f3568[_0x0585('0x41')]);_0x146795['filters']=_[_0x0585('0x43')](_0x146795[_0x0585('0x3f')],_0x146795['query']);_0x3033e7[_0x0585('0x42')]=_[_0x0585('0x43')](_0x146795[_0x0585('0x3f')],qs[_0x0585('0x44')](_0x4f3568['query'][_0x0585('0x44')]));_0x3033e7[_0x0585('0x42')]=_0x3033e7['attributes'][_0x0585('0x45')]?_0x3033e7[_0x0585('0x42')]:_0x146795['model'];if(_0x4f3568[_0x0585('0x41')]['includeAll']){_0x3033e7[_0x0585('0x4f')]=[{'all':!![]}];}_0x3033e7=_['merge']({},_0x3033e7,_0x4f3568[_0x0585('0x4d')]);return db[_0x0585('0x3a')][_0x0585('0x55')](_0x3033e7)[_0x0585('0x33')](handleEntityNotFound(_0x113885,null))[_0x0585('0x33')](respondWithResult(_0x113885,null))[_0x0585('0x27')](handleError(_0x113885,null));};exports[_0x0585('0x32')]=function(_0x1e4c17,_0xf0aa8){if(_0x1e4c17[_0x0585('0x56')]['id']){delete _0x1e4c17[_0x0585('0x56')]['id'];}return db['FaxMessage']['find']({'where':{'id':_0x1e4c17[_0x0585('0x53')]['id']}})['then'](handleEntityNotFound(_0xf0aa8,null))[_0x0585('0x33')](saveUpdates(_0x1e4c17[_0x0585('0x56')],null))[_0x0585('0x33')](respondWithResult(_0xf0aa8,null))[_0x0585('0x27')](handleError(_0xf0aa8,null));};exports[_0x0585('0x34')]=function(_0xf2ff,_0x32b45b){return db[_0x0585('0x3a')]['find']({'where':{'id':_0xf2ff[_0x0585('0x53')]['id']}})[_0x0585('0x33')](handleEntityNotFound(_0x32b45b,null))[_0x0585('0x33')](removeEntity(_0x32b45b,null))[_0x0585('0x27')](handleError(_0x32b45b,null));};exports[_0x0585('0x57')]=function(_0x14bc2d,_0x787c33){return db['FaxMessage']['describe']()[_0x0585('0x33')](respondWithResult(_0x787c33,null))[_0x0585('0x27')](handleError(_0x787c33,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0x0585('0x58')]=function(_0x46dda1,_0x4e3ac7,_0x6227d7){var _0x3ba230={'agent':{},'channel':'fax'};if(_0x46dda1['body']['id']){delete _0x46dda1[_0x0585('0x56')]['id'];}_0x46dda1['body'][_0x0585('0x59')]=!![];_0x46dda1[_0x0585('0x56')][_0x0585('0x5a')]=moment()[_0x0585('0x5b')](_0x0585('0x5c'));_0x46dda1['body'][_0x0585('0x5d')]=_0x46dda1['body']['UserId']||_0x46dda1[_0x0585('0x5e')]['id'];_0x3ba230[_0x0585('0x5f')]['id']=_0x46dda1[_0x0585('0x56')][_0x0585('0x5d')];return db['FaxMessage'][_0x0585('0x55')]({'where':{'id':_0x46dda1[_0x0585('0x53')]['id'],'UserId':null}})[_0x0585('0x33')](handleEntityNotFound(_0x4e3ac7,null))[_0x0585('0x33')](saveUpdates(_0x46dda1[_0x0585('0x56')],null))[_0x0585('0x33')](function(_0x4aa421){if(_0x4aa421){_0x3ba230[_0x0585('0x25')]=_0x4aa421['get']({'plain':!![]});return db[_0x0585('0x60')]['find']({'where':{'id':_0x4aa421[_0x0585('0x61')]}});}return null;})[_0x0585('0x33')](handleEntityNotFound(_0x4e3ac7,null))[_0x0585('0x33')](function(_0x1af638){if(_0x1af638){return _0x1af638['update']({'UserId':_0x46dda1[_0x0585('0x56')][_0x0585('0x5d')],'read1stAt':_['isNil'](_0x1af638['read1stAt'])?moment()[_0x0585('0x5b')](_0x0585('0x5c')):undefined});}return null;})[_0x0585('0x33')](function(_0x45a260){if(_0x45a260){_0x3ba230[_0x0585('0x62')]=_0x45a260['get']({'plain':!![]});interaction_log[_0x0585('0x1f')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x46dda1[_0x0585('0x5e')]['id'],_0x46dda1[_0x0585('0x5e')][_0x0585('0x37')],_0x46dda1[_0x0585('0x5e')][_0x0585('0x63')],_0x3ba230['interaction']['id'],_0x46dda1['body']?JSON[_0x0585('0x23')](_0x46dda1[_0x0585('0x56')]):_0x0585('0x64'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x3ba230);}return null;})[_0x0585('0x33')](function(_0x5aa3e8){var _0x428060=_0x0585('0x65')+_0x5aa3e8[_0x0585('0x25')][_0x0585('0x66')];return db[_0x0585('0x67')][_0x0585('0x41')](_0x428060,{'type':db[_0x0585('0x68')][_0x0585('0x69')][_0x0585('0x6a')],'raw':!![]})[_0x0585('0x33')](function(_0xab64a){return _0xab64a;});})[_0x0585('0x33')](function(_0x4f1f32){if(_0x4f1f32){_0x3ba230['message'][_0x0585('0x6b')]=_0x4f1f32[0x0];if(!_0x46dda1['body'][_0x0585('0x5d')])return;return db[_0x0585('0x6c')][_0x0585('0x55')]({'where':{'id':_0x46dda1['body'][_0x0585('0x5d')],'role':_0x0585('0x5f')},'attributes':['id',_0x0585('0x37'),'fullname',_0x0585('0x6d'),_0x0585('0x6e')],'raw':!![]});}return null;})[_0x0585('0x33')](function(_0x592c9f){if(!_0x592c9f)return null;_0x3ba230[_0x0585('0x25')]['agent']=_0x592c9f;return _0x3ba230;})[_0x0585('0x33')](function(_0x46b359){if(_0x46b359){if(_0x46dda1[_0x0585('0x56')]['manual']){_0x3ba230['message'][_0x0585('0x6f')]=util[_0x0585('0x5b')]('SIP/%s',_0x46dda1[_0x0585('0x5e')][_0x0585('0x37')]);_0x3ba230['message'][_0x0585('0x70')]=_0x3ba230[_0x0585('0x70')];_0x3ba230[_0x0585('0x25')][_0x0585('0x71')]=_0x3ba230['channel'];_0x3ba230[_0x0585('0x25')]['event']=_0x0585('0x58');return respondWithRpcPromise(_0x0585('0x72'),_0x0585('0x72'),{'event':_0x0585('0x73'),'message':_0x3ba230[_0x0585('0x25')]},client9002)[_0x0585('0x33')](function(){return _0x3ba230;});}return _0x3ba230;}return null;})[_0x0585('0x33')](respondWithResult(_0x4e3ac7,null))[_0x0585('0x27')](handleError(_0x4e3ac7,null));};var interaction_log=require('../../config/logger')(_0x0585('0x74'));exports[_0x0585('0x75')]=function(_0x27eae3,_0x37b549,_0x12232b){var _0x5d6852={'agent':{},'channel':'fax'};if(_0x27eae3['body']['id']){delete _0x27eae3[_0x0585('0x56')]['id'];}_0x27eae3['body'][_0x0585('0x5d')]=_0x27eae3[_0x0585('0x56')]['UserId']||_0x27eae3['user']['id'];_0x5d6852[_0x0585('0x5f')]['id']=_0x27eae3[_0x0585('0x56')][_0x0585('0x5d')];return db[_0x0585('0x3a')][_0x0585('0x55')]({'where':{'id':_0x27eae3[_0x0585('0x53')]['id'],'UserId':null}})[_0x0585('0x33')](handleEntityNotFound(_0x37b549,null))['then'](function(_0x54adc8){if(_0x54adc8){_0x5d6852[_0x0585('0x25')]=_0x54adc8[_0x0585('0x76')]({'plain':!![]});return db['FaxInteraction'][_0x0585('0x55')]({'where':{'id':_0x54adc8[_0x0585('0x61')]}});}return null;})[_0x0585('0x33')](handleEntityNotFound(_0x37b549,null))[_0x0585('0x33')](function(_0x11672a){if(_0x11672a){_0x5d6852[_0x0585('0x62')]=_0x11672a[_0x0585('0x76')]({'plain':!![]});interaction_log['info'](_0x0585('0x77'),_0x27eae3[_0x0585('0x5e')]['id'],_0x27eae3[_0x0585('0x5e')][_0x0585('0x37')],_0x27eae3['user'][_0x0585('0x63')],_0x5d6852[_0x0585('0x62')]['id'],_0x27eae3[_0x0585('0x56')]?JSON['stringify'](_0x27eae3[_0x0585('0x56')]):_0x0585('0x64'));return respondWithRpcPromise(_0x0585('0x78'),_0x0585('0x79'),_0x5d6852);}return null;})[_0x0585('0x33')](function(_0xc64f2c){var _0x37427a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xc64f2c[_0x0585('0x25')][_0x0585('0x66')];return db[_0x0585('0x67')]['query'](_0x37427a,{'type':db[_0x0585('0x68')][_0x0585('0x69')][_0x0585('0x6a')],'raw':!![]})[_0x0585('0x33')](function(_0x687f9){return _0x687f9;});})[_0x0585('0x33')](function(_0x5bbe4b){if(_0x5bbe4b){_0x5d6852[_0x0585('0x25')]['contact']=_0x5bbe4b[0x0];if(!_0x27eae3[_0x0585('0x56')][_0x0585('0x5d')])return;return db[_0x0585('0x6c')][_0x0585('0x55')]({'where':{'id':_0x27eae3['body'][_0x0585('0x5d')],'role':_0x0585('0x5f')},'attributes':['id',_0x0585('0x37'),_0x0585('0x7a'),_0x0585('0x6d'),_0x0585('0x6e')],'raw':!![]});}return null;})['then'](function(_0x56527d){if(!_0x56527d)return null;_0x5d6852[_0x0585('0x25')]['agent']=_0x56527d;return _0x5d6852;})[_0x0585('0x33')](function(_0x312cb2){if(_0x312cb2){_0x312cb2['message']['interface']=util[_0x0585('0x5b')](_0x0585('0x7b'),_0x27eae3[_0x0585('0x5e')][_0x0585('0x37')]);_0x312cb2[_0x0585('0x25')][_0x0585('0x70')]=_0x5d6852[_0x0585('0x70')];_0x312cb2['message'][_0x0585('0x71')]=_0x5d6852[_0x0585('0x70')];_0x312cb2[_0x0585('0x25')][_0x0585('0x7c')]=_0x0585('0x75');respondWithRpcPromise(_0x0585('0x72'),'EventManager',{'event':'rejectmessage','message':_0x312cb2[_0x0585('0x25')]},client9002);return _0x5d6852;}return null;})['then'](respondWithResult(_0x37b549,null))[_0x0585('0x27')](handleError(_0x37b549,null));};exports[_0x0585('0x7d')]=function(_0x1e0054,_0x31c58e){var _0x4c8452;return db[_0x0585('0x3a')][_0x0585('0x7d')](_0x1e0054[_0x0585('0x56')],{})[_0x0585('0x33')](function(_0x11edbe){_0x4c8452=_0x11edbe;return db[_0x0585('0x7e')][_0x0585('0x7f')]({'where':{'id':_0x4c8452[_0x0585('0x66')]}});})[_0x0585('0x33')](function(_0x47097a){if(_[_0x0585('0x80')](_0x47097a)){return;}else{_0x4c8452[_0x0585('0x81')]=_0x47097a[_0x0585('0x81')];return db[_0x0585('0x82')][_0x0585('0x7f')]({'where':{'id':_0x4c8452[_0x0585('0x83')]}});}})['then'](function(_0x17d8de){return respondWithRpcPromise(_0x0585('0x84'),_0x0585('0x84'),{'FaxAccountId':_[_0x0585('0x80')](_0x1e0054[_0x0585('0x56')])?undefined:_0x1e0054['body']['FaxAccountId'],'path':_[_0x0585('0x80')](_0x17d8de)?undefined:util['format'](_0x0585('0x85'),_0x17d8de[_0x0585('0x86')]),'fax':_[_0x0585('0x80')](_0x4c8452[_0x0585('0x81')])?undefined:_0x4c8452[_0x0585('0x81')],'AttachmentId':_0x4c8452[_0x0585('0x83')]},client9002);})[_0x0585('0x33')](respondWithResult(_0x31c58e,0xc9))[_0x0585('0x27')](handleError(_0x31c58e,null));};exports[_0x0585('0x87')]=function(_0x38d6ca,_0x5819c7){var _0x16c005=path[_0x0585('0x88')](config['root'],_0x0585('0x89'),_0x0585('0x8a'),_0x0585('0x8b'));return db[_0x0585('0x3a')][_0x0585('0x55')]({'where':{'id':_0x38d6ca['params']['id']},'include':[{'model':db[_0x0585('0x82')],'as':_0x0585('0x82')}]})['then'](handleEntityNotFound(_0x5819c7,null))[_0x0585('0x33')](function(_0x3fad04){if(_0x3fad04){return _0x5819c7[_0x0585('0x87')](path[_0x0585('0x88')](_0x16c005,_0x3fad04[_0x0585('0x82')][_0x0585('0x86')]));}})['catch'](handleError(_0x5819c7,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 37db5b4..f792b73 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 _0xf417=['FaxMessage','setMaxListeners','update','hasOwnProperty','exports','../../mysqldb'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0xf417,0x8f));var _0x7f41=function(_0x56f3d4,_0xfc65dd){_0x56f3d4=_0x56f3d4-0x0;var _0x2c7ef0=_0xf417[_0x56f3d4];return _0x2c7ef0;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x7f41('0x0'))['db'][_0x7f41('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x7f41('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7f41('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4c7081){return function(_0x2b7d4c,_0x5170ec,_0x51b0cb){FaxMessageEvents['emit'](_0x4c7081+':'+_0x2b7d4c['id'],_0x2b7d4c);FaxMessageEvents['emit'](_0x4c7081,_0x2b7d4c);_0x51b0cb(null);};}for(var e in events){if(events[_0x7f41('0x4')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x7f41('0x5')]=FaxMessageEvents; \ No newline at end of file +var _0x3914=['emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','remove'];(function(_0x54a6b4,_0x93c0e6){var _0x12acc7=function(_0x235217){while(--_0x235217){_0x54a6b4['push'](_0x54a6b4['shift']());}};_0x12acc7(++_0x93c0e6);}(_0x3914,0xeb));var _0x4391=function(_0x307086,_0x3bfe4e){_0x307086=_0x307086-0x0;var _0x699043=_0x3914[_0x307086];return _0x699043;};'use strict';var EventEmitter=require(_0x4391('0x0'));var FaxMessage=require(_0x4391('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x4391('0x2')](0x0);var events={'afterCreate':_0x4391('0x3'),'afterUpdate':'update','afterDestroy':_0x4391('0x4')};function emitEvent(_0x343fb7){return function(_0x175dbc,_0x5b5acb,_0x1eecd4){FaxMessageEvents[_0x4391('0x5')](_0x343fb7+':'+_0x175dbc['id'],_0x175dbc);FaxMessageEvents['emit'](_0x343fb7,_0x175dbc);_0x1eecd4(null);};}for(var e in events){if(events[_0x4391('0x6')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x4391('0x7')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 6a1fbe5..90aa966 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 _0x5a12=['define','fax_messages','fti_fax_messages','body','models','direction','toLowerCase','secret','UserId','FaxInteraction','FaxInteractionId','then','update','createdAt','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','../../config/environment','./faxMessage.attributes','exports'];(function(_0xb2a4d,_0x1a1203){var _0x262217=function(_0x4b06b7){while(--_0x4b06b7){_0xb2a4d['push'](_0xb2a4d['shift']());}};_0x262217(++_0x1a1203);}(_0x5a12,0x197));var _0x25a1=function(_0xa76abf,_0x374706){_0xa76abf=_0xa76abf-0x0;var _0x11c861=_0x5a12[_0xa76abf];return _0x11c861;};'use strict';var _=require(_0x25a1('0x0'));var util=require(_0x25a1('0x1'));var logger=require(_0x25a1('0x2'))('api');var moment=require('moment');var BPromise=require(_0x25a1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x25a1('0x4'));var attributes=require(_0x25a1('0x5'));module[_0x25a1('0x6')]=function(_0x3dc4fe,_0xa879cd){return _0x3dc4fe[_0x25a1('0x7')]('FaxMessage',attributes,{'tableName':_0x25a1('0x8'),'paranoid':![],'indexes':[{'name':_0x25a1('0x9'),'fields':[_0x25a1('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x243fd7,_0x3f8ddd,_0x51795f){var _0x434319=_0x3dc4fe[_0x25a1('0xb')];var _0x2a7532=_0x243fd7['get']({'plain':!![]});if(_0x2a7532[_0x25a1('0xc')][_0x25a1('0xd')]()==='in'||_0x2a7532[_0x25a1('0xc')][_0x25a1('0xd')]()==='out'&&!_0x2a7532[_0x25a1('0xe')]&&!_['isNil'](_0x2a7532[_0x25a1('0xf')])){_0x434319[_0x25a1('0x10')]['findOne']({'where':{'id':_0x2a7532[_0x25a1('0x11')]}})[_0x25a1('0x12')](function(_0x50cacf){if(_0x50cacf){_0x50cacf[_0x25a1('0x13')]({'lastMsgAt':_0x2a7532[_0x25a1('0x14')],'lastMsgDirection':_0x2a7532['direction'][_0x25a1('0xd')]()});}})['catch'](function(_0x5d6f8d){console['error'](_0x5d6f8d);});}_0x51795f();}},'charset':_0x25a1('0x15'),'collate':_0x25a1('0x16')});}; \ No newline at end of file +var _0xa2dc=['findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./faxMessage.attributes','define','FaxMessage','fti_fax_messages','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa2dc,0x78));var _0xca2d=function(_0xe84805,_0x2702d9){_0xe84805=_0xe84805-0x0;var _0x398efd=_0xa2dc[_0xe84805];return _0x398efd;};'use strict';var _=require(_0xca2d('0x0'));var util=require(_0xca2d('0x1'));var logger=require('../../config/logger')(_0xca2d('0x2'));var moment=require(_0xca2d('0x3'));var BPromise=require(_0xca2d('0x4'));var rp=require(_0xca2d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xca2d('0x6'));var attributes=require(_0xca2d('0x7'));module['exports']=function(_0x497e26,_0xfcc3f6){return _0x497e26[_0xca2d('0x8')](_0xca2d('0x9'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xca2d('0xa'),'fields':['body'],'type':_0xca2d('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3f3847,_0x1ad90c,_0x18aaa3){var _0x5080b2=_0x497e26['models'];var _0x1de0ab=_0x3f3847[_0xca2d('0xc')]({'plain':!![]});if(_0x1de0ab[_0xca2d('0xd')][_0xca2d('0xe')]()==='in'||_0x1de0ab['direction'][_0xca2d('0xe')]()===_0xca2d('0xf')&&!_0x1de0ab[_0xca2d('0x10')]&&!_[_0xca2d('0x11')](_0x1de0ab[_0xca2d('0x12')])){_0x5080b2[_0xca2d('0x13')][_0xca2d('0x14')]({'where':{'id':_0x1de0ab[_0xca2d('0x15')]}})[_0xca2d('0x16')](function(_0x4d47ac){if(_0x4d47ac){_0x4d47ac[_0xca2d('0x17')]({'lastMsgAt':_0x1de0ab[_0xca2d('0x18')],'lastMsgDirection':_0x1de0ab[_0xca2d('0xd')][_0xca2d('0xe')]()});}})[_0xca2d('0x19')](function(_0x469c00){console[_0xca2d('0x1a')](_0x469c00);});}_0x18aaa3();}},'charset':'utf8mb4','collate':_0xca2d('0x1b')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 51eccb8..a2ee12f 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 _0x17ba=['CreateFaxMessage','FaxMessage','create','options','raw','info','UpdateFaxMessage','update','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch'];(function(_0x44c237,_0xe00537){var _0x5af99f=function(_0x454233){while(--_0x454233){_0x44c237['push'](_0x44c237['shift']());}};_0x5af99f(++_0xe00537);}(_0x17ba,0xab));var _0xa17b=function(_0x50c7c2,_0x5d1273){_0x50c7c2=_0x50c7c2-0x0;var _0x2c5015=_0x17ba[_0x50c7c2];return _0x2c5015;};'use strict';var _=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var moment=require('moment');var BPromise=require(_0xa17b('0x2'));var rs=require(_0xa17b('0x3'));var fs=require('fs');var Redis=require(_0xa17b('0x4'));var db=require(_0xa17b('0x5'))['db'];var utils=require(_0xa17b('0x6'));var logger=require(_0xa17b('0x7'))(_0xa17b('0x8'));var config=require(_0xa17b('0x9'));var jayson=require(_0xa17b('0xa'));var client=jayson[_0xa17b('0xb')][_0xa17b('0xc')]({'port':0x232a});config[_0xa17b('0xd')]=_[_0xa17b('0xe')](config[_0xa17b('0xd')],{'host':_0xa17b('0xf'),'port':0x18eb});var socket=require(_0xa17b('0x10'))(new Redis(config[_0xa17b('0xd')]));require(_0xa17b('0x11'))[_0xa17b('0x12')](socket);function respondWithRpcPromise(_0x578799,_0x2556c4,_0x38b8f1){return new BPromise(function(_0x322dc0,_0x1e799a){return client[_0xa17b('0x13')](_0x578799,_0x38b8f1)[_0xa17b('0x14')](function(_0xc5ef2e){logger['info'](_0xa17b('0x15'),_0x2556c4,_0xa17b('0x16'));logger[_0xa17b('0x17')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x2556c4,_0xa17b('0x16'),JSON[_0xa17b('0x18')](_0xc5ef2e));if(_0xc5ef2e[_0xa17b('0x19')]){if(_0xc5ef2e[_0xa17b('0x19')]['code']===0x1f4){logger[_0xa17b('0x19')]('FaxMessage,\x20%s,\x20%s',_0x2556c4,_0xc5ef2e[_0xa17b('0x19')][_0xa17b('0x1a')]);return _0x1e799a(_0xc5ef2e['error'][_0xa17b('0x1a')]);}logger[_0xa17b('0x19')](_0xa17b('0x15'),_0x2556c4,_0xc5ef2e[_0xa17b('0x19')]['message']);return _0x322dc0(_0xc5ef2e[_0xa17b('0x19')]['message']);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x2556c4,_0xa17b('0x16'));_0x322dc0(_0xc5ef2e[_0xa17b('0x1b')]['message']);}})[_0xa17b('0x1c')](function(_0x166d44){logger[_0xa17b('0x19')](_0xa17b('0x15'),_0x2556c4,_0x166d44);_0x1e799a(_0x166d44);});});}exports[_0xa17b('0x1d')]=function(_0x1ecaa2){var _0x24afc2=this;return new Promise(function(_0x584a0a,_0x610c2b){return db[_0xa17b('0x1e')][_0xa17b('0x1f')](_0x1ecaa2['body'],{'raw':_0x1ecaa2[_0xa17b('0x20')]?_0x1ecaa2[_0xa17b('0x20')][_0xa17b('0x21')]===undefined?!![]:![]:!![]})[_0xa17b('0x14')](function(_0x3c7ec2){logger[_0xa17b('0x22')]('CreateFaxMessage',_0x1ecaa2);logger[_0xa17b('0x17')]('CreateFaxMessage',_0x1ecaa2,JSON[_0xa17b('0x18')](_0x3c7ec2));_0x584a0a(_0x3c7ec2);})[_0xa17b('0x1c')](function(_0x4ba608){logger['error'](_0xa17b('0x1d'),_0x4ba608[_0xa17b('0x1a')],_0x1ecaa2);_0x610c2b(_0x24afc2[_0xa17b('0x19')](0x1f4,_0x4ba608[_0xa17b('0x1a')]));});});};exports[_0xa17b('0x23')]=function(_0x3a64f5){var _0x4cd38e=this;return new Promise(function(_0x47aff8,_0x5c98fe){return db['FaxMessage'][_0xa17b('0x24')](_0x3a64f5['body'],{'raw':_0x3a64f5[_0xa17b('0x20')]?_0x3a64f5['options'][_0xa17b('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a64f5[_0xa17b('0x20')]?_0x3a64f5[_0xa17b('0x20')][_0xa17b('0x25')]||null:null,'attributes':_0x3a64f5[_0xa17b('0x20')]?_0x3a64f5[_0xa17b('0x20')][_0xa17b('0x26')]||null:null,'limit':_0x3a64f5[_0xa17b('0x20')]?_0x3a64f5[_0xa17b('0x20')][_0xa17b('0x27')]||null:null})[_0xa17b('0x14')](function(_0x573585){logger['info']('UpdateFaxMessage',_0x3a64f5);logger[_0xa17b('0x17')](_0xa17b('0x23'),_0x3a64f5,JSON[_0xa17b('0x18')](_0x573585));_0x47aff8(_0x573585);})[_0xa17b('0x1c')](function(_0x16dd1f){logger[_0xa17b('0x19')](_0xa17b('0x23'),_0x16dd1f[_0xa17b('0x1a')],_0x3a64f5);_0x5c98fe(_0x4cd38e['error'](0x1f4,_0x16dd1f[_0xa17b('0x1a')]));});});}; \ No newline at end of file +var _0x54ef=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','./faxMessage.socket','request','then','info','request\x20sent','stringify','error','FaxMessage,\x20%s,\x20%s','message','result','catch','FaxMessage','create','body','options','raw','CreateFaxMessage','UpdateFaxMessage','where','attributes','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0xa9797f,_0x4a4011){var _0x532d04=function(_0x22cd06){while(--_0x22cd06){_0xa9797f['push'](_0xa9797f['shift']());}};_0x532d04(++_0x4a4011);}(_0x54ef,0x112));var _0xf54e=function(_0x55416d,_0x214461){_0x55416d=_0x55416d-0x0;var _0x4d2b18=_0x54ef[_0x55416d];return _0x4d2b18;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var moment=require(_0xf54e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf54e('0x3'));var fs=require('fs');var Redis=require(_0xf54e('0x4'));var db=require(_0xf54e('0x5'))['db'];var utils=require(_0xf54e('0x6'));var logger=require(_0xf54e('0x7'))(_0xf54e('0x8'));var config=require(_0xf54e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0xa')]({'port':0x232a});config[_0xf54e('0xb')]=_[_0xf54e('0xc')](config['redis'],{'host':_0xf54e('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf54e('0xb')]));require(_0xf54e('0xe'))['register'](socket);function respondWithRpcPromise(_0x26fc3e,_0xefa1c0,_0x6b9e61){return new BPromise(function(_0x3ecfb3,_0x5f232a){return client[_0xf54e('0xf')](_0x26fc3e,_0x6b9e61)[_0xf54e('0x10')](function(_0x143d66){logger[_0xf54e('0x11')]('FaxMessage,\x20%s,\x20%s',_0xefa1c0,_0xf54e('0x12'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0xefa1c0,_0xf54e('0x12'),JSON[_0xf54e('0x13')](_0x143d66));if(_0x143d66[_0xf54e('0x14')]){if(_0x143d66[_0xf54e('0x14')]['code']===0x1f4){logger[_0xf54e('0x14')](_0xf54e('0x15'),_0xefa1c0,_0x143d66[_0xf54e('0x14')][_0xf54e('0x16')]);return _0x5f232a(_0x143d66['error'][_0xf54e('0x16')]);}logger[_0xf54e('0x14')](_0xf54e('0x15'),_0xefa1c0,_0x143d66['error']['message']);return _0x3ecfb3(_0x143d66[_0xf54e('0x14')][_0xf54e('0x16')]);}else{logger[_0xf54e('0x11')](_0xf54e('0x15'),_0xefa1c0,_0xf54e('0x12'));_0x3ecfb3(_0x143d66[_0xf54e('0x17')][_0xf54e('0x16')]);}})[_0xf54e('0x18')](function(_0x1dcc04){logger[_0xf54e('0x14')](_0xf54e('0x15'),_0xefa1c0,_0x1dcc04);_0x5f232a(_0x1dcc04);});});}exports['CreateFaxMessage']=function(_0x48a7e1){var _0x23e14=this;return new Promise(function(_0x59f338,_0x3e1556){return db[_0xf54e('0x19')][_0xf54e('0x1a')](_0x48a7e1[_0xf54e('0x1b')],{'raw':_0x48a7e1[_0xf54e('0x1c')]?_0x48a7e1[_0xf54e('0x1c')][_0xf54e('0x1d')]===undefined?!![]:![]:!![]})[_0xf54e('0x10')](function(_0x3c0169){logger[_0xf54e('0x11')](_0xf54e('0x1e'),_0x48a7e1);logger['debug'](_0xf54e('0x1e'),_0x48a7e1,JSON['stringify'](_0x3c0169));_0x59f338(_0x3c0169);})[_0xf54e('0x18')](function(_0x272df6){logger[_0xf54e('0x14')](_0xf54e('0x1e'),_0x272df6[_0xf54e('0x16')],_0x48a7e1);_0x3e1556(_0x23e14[_0xf54e('0x14')](0x1f4,_0x272df6[_0xf54e('0x16')]));});});};exports[_0xf54e('0x1f')]=function(_0x2342a9){var _0x33457f=this;return new Promise(function(_0xf6cdd7,_0x39c0ae){return db[_0xf54e('0x19')]['update'](_0x2342a9[_0xf54e('0x1b')],{'raw':_0x2342a9['options']?_0x2342a9[_0xf54e('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2342a9[_0xf54e('0x1c')]?_0x2342a9[_0xf54e('0x1c')][_0xf54e('0x20')]||null:null,'attributes':_0x2342a9[_0xf54e('0x1c')]?_0x2342a9[_0xf54e('0x1c')][_0xf54e('0x21')]||null:null,'limit':_0x2342a9[_0xf54e('0x1c')]?_0x2342a9['options']['limit']||null:null})[_0xf54e('0x10')](function(_0x258d29){logger[_0xf54e('0x11')](_0xf54e('0x1f'),_0x2342a9);logger[_0xf54e('0x22')](_0xf54e('0x1f'),_0x2342a9,JSON[_0xf54e('0x13')](_0x258d29));_0xf6cdd7(_0x258d29);})[_0xf54e('0x18')](function(_0x3ae704){logger[_0xf54e('0x14')]('UpdateFaxMessage',_0x3ae704['message'],_0x2342a9);_0x39c0ae(_0x33457f[_0xf54e('0x14')](0x1f4,_0x3ae704[_0xf54e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 029262b..54d2e28 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 _0x1b94=['./faxMessage.events','save','update','emit','register','length','faxMessage:'];(function(_0x589f71,_0x212326){var _0x5763bd=function(_0x2cb8e1){while(--_0x2cb8e1){_0x589f71['push'](_0x589f71['shift']());}};_0x5763bd(++_0x212326);}(_0x1b94,0x77));var _0x41b9=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x1b94[_0x32f7d7];return _0x133d09;};'use strict';var FaxMessageEvents=require(_0x41b9('0x0'));var events=[_0x41b9('0x1'),'remove',_0x41b9('0x2')];function createListener(_0x52f788,_0x20f89d){return function(_0x3aaf6c){_0x20f89d[_0x41b9('0x3')](_0x52f788,_0x3aaf6c);};}function removeListener(_0x542e28,_0x10aa4e){return function(){FaxMessageEvents['removeListener'](_0x542e28,_0x10aa4e);};}exports[_0x41b9('0x4')]=function(_0x29eec7){for(var _0x12adc3=0x0,_0x3be03c=events[_0x41b9('0x5')];_0x12adc3<_0x3be03c;_0x12adc3++){var _0x4de8a8=events[_0x12adc3];var _0x58a411=createListener(_0x41b9('0x6')+_0x4de8a8,_0x29eec7);FaxMessageEvents['on'](_0x4de8a8,_0x58a411);}}; \ No newline at end of file +var _0x53cf=['./faxMessage.events','save','remove','removeListener','register','length','faxMessage:'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x53cf,0x165));var _0xf53c=function(_0x32497d,_0x43b441){_0x32497d=_0x32497d-0x0;var _0x4c1d98=_0x53cf[_0x32497d];return _0x4c1d98;};'use strict';var FaxMessageEvents=require(_0xf53c('0x0'));var events=[_0xf53c('0x1'),_0xf53c('0x2'),'update'];function createListener(_0xf6b028,_0x5c293a){return function(_0x45117e){_0x5c293a['emit'](_0xf6b028,_0x45117e);};}function removeListener(_0x34ec83,_0x163d1c){return function(){FaxMessageEvents[_0xf53c('0x3')](_0x34ec83,_0x163d1c);};}exports[_0xf53c('0x4')]=function(_0x27ac1b){for(var _0x39a554=0x0,_0x208d6f=events[_0xf53c('0x5')];_0x39a554<_0x208d6f;_0x39a554++){var _0x2056eb=events[_0x39a554];var _0x498f73=createListener(_0xf53c('0x6')+_0x2056eb,_0x27ac1b);FaxMessageEvents['on'](_0x2056eb,_0x498f73);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 2f4d4c1..ab03b4e 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 _0x0fd9=['../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','/describe','/:id','show','/:id/download','download','post','tracked','fax','create','put','update','/:id/reject','reject','delete','util','path','connect-timeout','express','../../components/auth/service'];(function(_0xfe4704,_0x4d4a7e){var _0x588a01=function(_0x5ce1c5){while(--_0x5ce1c5){_0xfe4704['push'](_0xfe4704['shift']());}};_0x588a01(++_0x4d4a7e);}(_0x0fd9,0xa3));var _0x90fd=function(_0x422be2,_0x1c439e){_0x422be2=_0x422be2-0x0;var _0x1b820e=_0x0fd9[_0x422be2];return _0x1b820e;};'use strict';var multer=require('multer');var util=require(_0x90fd('0x0'));var path=require(_0x90fd('0x1'));var timeout=require(_0x90fd('0x2'));var express=require(_0x90fd('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x90fd('0x4'));var interaction=require(_0x90fd('0x5'));var config=require(_0x90fd('0x6'));var controller=require(_0x90fd('0x7'));router[_0x90fd('0x8')]('/',auth[_0x90fd('0x9')](),controller['index']);router['get'](_0x90fd('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x90fd('0x8')](_0x90fd('0xb'),auth['isAuthenticated'](),controller[_0x90fd('0xc')]);router[_0x90fd('0x8')](_0x90fd('0xd'),auth[_0x90fd('0x9')](),controller[_0x90fd('0xe')]);router[_0x90fd('0xf')]('/',auth[_0x90fd('0x9')](),interaction[_0x90fd('0x10')](_0x90fd('0x11'),'faxmessage:create'),controller[_0x90fd('0x12')]);router[_0x90fd('0x13')]('/:id',auth[_0x90fd('0x9')](),controller[_0x90fd('0x14')]);router[_0x90fd('0x13')]('/:id/accept',auth[_0x90fd('0x9')](),controller['accept']);router[_0x90fd('0x13')](_0x90fd('0x15'),auth[_0x90fd('0x9')](),controller[_0x90fd('0x16')]);router[_0x90fd('0x17')](_0x90fd('0xb'),auth[_0x90fd('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x39cb=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','index','/describe','isAuthenticated','/:id','show','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','path','express'];(function(_0x1cbcf1,_0x3f9fd9){var _0x3a06f0=function(_0x5425d4){while(--_0x5425d4){_0x1cbcf1['push'](_0x1cbcf1['shift']());}};_0x3a06f0(++_0x3f9fd9);}(_0x39cb,0x1bd));var _0xb39c=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x39cb[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require('multer');var util=require(_0xb39c('0x0'));var path=require(_0xb39c('0x1'));var timeout=require('connect-timeout');var express=require(_0xb39c('0x2'));var router=express[_0xb39c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb39c('0x4'));var interaction=require(_0xb39c('0x5'));var config=require(_0xb39c('0x6'));var controller=require(_0xb39c('0x7'));router[_0xb39c('0x8')]('/',auth['isAuthenticated'](),controller[_0xb39c('0x9')]);router[_0xb39c('0x8')](_0xb39c('0xa'),auth[_0xb39c('0xb')](),controller['describe']);router['get'](_0xb39c('0xc'),auth[_0xb39c('0xb')](),controller[_0xb39c('0xd')]);router[_0xb39c('0x8')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0xb39c('0xe')]('/',auth[_0xb39c('0xb')](),interaction[_0xb39c('0xf')](_0xb39c('0x10'),_0xb39c('0x11')),controller[_0xb39c('0x12')]);router[_0xb39c('0x13')](_0xb39c('0xc'),auth['isAuthenticated'](),controller[_0xb39c('0x14')]);router[_0xb39c('0x13')](_0xb39c('0x15'),auth['isAuthenticated'](),controller[_0xb39c('0x16')]);router[_0xb39c('0x13')](_0xb39c('0x17'),auth[_0xb39c('0xb')](),controller[_0xb39c('0x18')]);router[_0xb39c('0x19')](_0xb39c('0xc'),auth['isAuthenticated'](),controller[_0xb39c('0x1a')]);module[_0xb39c('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 1d5bc38..ce7593c 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 _0xb1be=['ENUM','rrmemory','beepall','roundrobin','STRING','INTEGER'];(function(_0xa301b7,_0x204c08){var _0x57fb62=function(_0x17629b){while(--_0x17629b){_0xa301b7['push'](_0xa301b7['shift']());}};_0x57fb62(++_0x204c08);}(_0xb1be,0x118));var _0xeb1b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb1be[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xeb1b('0x0')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xeb1b('0x0')]},'timeout':{'type':Sequelize[_0xeb1b('0x1')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xeb1b('0x2')](_0xeb1b('0x3'),_0xeb1b('0x4'),_0xeb1b('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xeb1b('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x514d=['ENUM','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x303ccb,_0x26c70e){var _0x58d378=function(_0xefd8fd){while(--_0xefd8fd){_0x303ccb['push'](_0x303ccb['shift']());}};_0x58d378(++_0x26c70e);}(_0x514d,0x87));var _0xd514=function(_0x2edf72,_0xd4571b){_0x2edf72=_0x2edf72-0x0;var _0xb8b5dd=_0x514d[_0x2edf72];return _0xb8b5dd;};'use strict';var Sequelize=require(_0xd514('0x0'));module[_0xd514('0x1')]={'name':{'type':Sequelize[_0xd514('0x2')],'unique':_0xd514('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd514('0x2')]},'timeout':{'type':Sequelize[_0xd514('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd514('0x5')]('rrmemory','beepall',_0xd514('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xd514('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 4e3e26c..d956ac8 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 _0xa408=['forEach','userFaxQueue:remove','ids','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','FaxQueues','UserProfileResource','error','stack','name','send','index','map','FaxQueue','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','rows','catch','show','params','include','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserFaxQueue','FaxQueueId','findAndCountAll','UserId','updatedAt','createdAt','format','%s/%s','faxPause','getTeams','findOne','Team','addTeams','findAll','User','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','emit','removeTeams','select','tq.TeamId','from','team_has_fax_queues','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','every','includes','all','union','compact','isEmpty','removeAgents'];(function(_0x19ac6e,_0x435862){var _0x1cdcf3=function(_0x23151c){while(--_0x23151c){_0x19ac6e['push'](_0x19ac6e['shift']());}};_0x1cdcf3(++_0x435862);}(_0xa408,0x92));var _0x8a40=function(_0x438685,_0x4ec0c0){_0x438685=_0x438685-0x0;var _0x41cca2=_0xa408[_0x438685];return _0x41cca2;};'use strict';var emlformat=require(_0x8a40('0x0'));var rimraf=require(_0x8a40('0x1'));var zipdir=require(_0x8a40('0x2'));var jsonpatch=require(_0x8a40('0x3'));var rp=require(_0x8a40('0x4'));var moment=require(_0x8a40('0x5'));var BPromise=require(_0x8a40('0x6'));var Mustache=require('mustache');var util=require(_0x8a40('0x7'));var path=require('path');var sox=require(_0x8a40('0x8'));var csv=require(_0x8a40('0x9'));var ejs=require(_0x8a40('0xa'));var fs=require('fs');var fs_extra=require(_0x8a40('0xb'));var _=require(_0x8a40('0xc'));var squel=require('squel');var crypto=require(_0x8a40('0xd'));var jsforce=require(_0x8a40('0xe'));var deskjs=require(_0x8a40('0xf'));var toCsv=require(_0x8a40('0x9'));var querystring=require(_0x8a40('0x10'));var Papa=require('papaparse');var Redis=require(_0x8a40('0x11'));var authService=require(_0x8a40('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8a40('0x13'));var hardwareService=require(_0x8a40('0x14'));var logger=require(_0x8a40('0x15'))(_0x8a40('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8a40('0x17'));var db=require(_0x8a40('0x18'))['db'];config[_0x8a40('0x19')]=_[_0x8a40('0x1a')](config['redis'],{'host':_0x8a40('0x1b'),'port':0x18eb});var socket=require(_0x8a40('0x1c'))(new Redis(config[_0x8a40('0x19')]));require('./faxQueue.socket')[_0x8a40('0x1d')](socket);function respondWithStatusCode(_0x47bb3d,_0xe3a956){_0xe3a956=_0xe3a956||0xcc;return function(_0x35216b){if(_0x35216b){return _0x47bb3d[_0x8a40('0x1e')](_0xe3a956);}return _0x47bb3d['status'](_0xe3a956)[_0x8a40('0x1f')]();};}function respondWithResult(_0x420515,_0x390c0e){_0x390c0e=_0x390c0e||0xc8;return function(_0x1be656){if(_0x1be656){return _0x420515[_0x8a40('0x20')](_0x390c0e)[_0x8a40('0x21')](_0x1be656);}};}function respondWithFilteredResult(_0x10cb5c,_0x8f7414){return function(_0xefa7cc){if(_0xefa7cc){var _0x49bea3=typeof _0x8f7414[_0x8a40('0x22')]===_0x8a40('0x23')&&typeof _0x8f7414['limit']===_0x8a40('0x23');var _0x54742b=_0xefa7cc[_0x8a40('0x24')];var _0x227e23=_0x49bea3?0x0:_0x8f7414[_0x8a40('0x22')];var _0x1e97d3=_0x49bea3?_0xefa7cc[_0x8a40('0x24')]:_0x8f7414[_0x8a40('0x22')]+_0x8f7414['limit'];var _0x5272eb;if(_0x1e97d3>=_0x54742b){_0x1e97d3=_0x54742b;_0x5272eb=0xc8;}else{_0x5272eb=0xce;}_0x10cb5c['status'](_0x5272eb);return _0x10cb5c[_0x8a40('0x25')](_0x8a40('0x26'),_0x227e23+'-'+_0x1e97d3+'/'+_0x54742b)['json'](_0xefa7cc);}return null;};}function patchUpdates(_0x5a1e74){return function(_0x318da7){try{jsonpatch[_0x8a40('0x27')](_0x318da7,_0x5a1e74,!![]);}catch(_0x2f7615){return BPromise[_0x8a40('0x28')](_0x2f7615);}return _0x318da7[_0x8a40('0x29')]();};}function saveUpdates(_0x3862f4,_0x341aca){return function(_0x1567b2){if(_0x1567b2){return _0x1567b2['update'](_0x3862f4)[_0x8a40('0x2a')](function(_0x49702f){return _0x49702f;});}return null;};}function removeEntity(_0x1e1fa6,_0x3679ae){return function(_0x1046f9){if(_0x1046f9){return _0x1046f9[_0x8a40('0x2b')]()[_0x8a40('0x2a')](function(){var _0x2146b9=_0x1046f9['get']({'plain':!![]});var _0x379052=_0x8a40('0x2c');return db[_0x8a40('0x2d')][_0x8a40('0x2b')]({'where':{'type':_0x379052,'resourceId':_0x2146b9['id']}})[_0x8a40('0x2a')](function(){return _0x1046f9;});})['then'](function(){_0x1e1fa6[_0x8a40('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3443f1,_0x36ae06){return function(_0x1e9cf6){if(!_0x1e9cf6){_0x3443f1[_0x8a40('0x1e')](0x194);}return _0x1e9cf6;};}function handleError(_0x4b481b,_0x5708ec){_0x5708ec=_0x5708ec||0x1f4;return function(_0x411b00){logger[_0x8a40('0x2e')](_0x411b00[_0x8a40('0x2f')]);if(_0x411b00['name']){delete _0x411b00[_0x8a40('0x30')];}_0x4b481b[_0x8a40('0x20')](_0x5708ec)[_0x8a40('0x31')](_0x411b00);};}exports[_0x8a40('0x32')]=function(_0x2da0f1,_0x306ec4){var _0x1efe0d={},_0x3dfe2f={},_0x38cf5f={'count':0x0,'rows':[]};var _0x3235fb=_[_0x8a40('0x33')](db[_0x8a40('0x34')][_0x8a40('0x35')],function(_0x235ccb){return{'name':_0x235ccb['fieldName'],'type':_0x235ccb['type'][_0x8a40('0x36')]};});_0x3dfe2f[_0x8a40('0x37')]=_['map'](_0x3235fb,'name');_0x3dfe2f[_0x8a40('0x38')]=_[_0x8a40('0x39')](_0x2da0f1[_0x8a40('0x38')]);_0x3dfe2f[_0x8a40('0x3a')]=_[_0x8a40('0x3b')](_0x3dfe2f[_0x8a40('0x37')],_0x3dfe2f[_0x8a40('0x38')]);_0x1efe0d['attributes']=_['intersection'](_0x3dfe2f[_0x8a40('0x37')],qs[_0x8a40('0x3c')](_0x2da0f1[_0x8a40('0x38')][_0x8a40('0x3c')]));_0x1efe0d[_0x8a40('0x3d')]=_0x1efe0d[_0x8a40('0x3d')][_0x8a40('0x3e')]?_0x1efe0d['attributes']:_0x3dfe2f['model'];if(!_0x2da0f1[_0x8a40('0x38')][_0x8a40('0x3f')](_0x8a40('0x40'))){_0x1efe0d[_0x8a40('0x41')]=qs['limit'](_0x2da0f1[_0x8a40('0x38')][_0x8a40('0x41')]);_0x1efe0d[_0x8a40('0x22')]=qs['offset'](_0x2da0f1[_0x8a40('0x38')][_0x8a40('0x22')]);}_0x1efe0d[_0x8a40('0x42')]=qs[_0x8a40('0x43')](_0x2da0f1['query']['sort']);_0x1efe0d[_0x8a40('0x44')]=qs[_0x8a40('0x3a')](_[_0x8a40('0x45')](_0x2da0f1[_0x8a40('0x38')],_0x3dfe2f['filters']),_0x3235fb);if(_0x2da0f1['query'][_0x8a40('0x46')]){_0x1efe0d['where']=_['merge'](_0x1efe0d[_0x8a40('0x44')],{'$or':_[_0x8a40('0x33')](_0x3235fb,function(_0x465261){if(_0x465261['type']!==_0x8a40('0x47')){var _0x2d2bf0={};_0x2d2bf0[_0x465261[_0x8a40('0x30')]]={'$like':'%'+_0x2da0f1[_0x8a40('0x38')][_0x8a40('0x46')]+'%'};return _0x2d2bf0;}})});}_0x1efe0d=_[_0x8a40('0x48')]({},_0x1efe0d,_0x2da0f1['options']);var _0xef66e4={'where':_0x1efe0d[_0x8a40('0x44')]};return db[_0x8a40('0x34')][_0x8a40('0x24')](_0xef66e4)['then'](function(_0x4e9a87){_0x38cf5f['count']=_0x4e9a87;if(_0x2da0f1[_0x8a40('0x38')][_0x8a40('0x49')]){_0x1efe0d['include']=[{'all':!![]}];}return db[_0x8a40('0x34')]['findAll'](_0x1efe0d);})['then'](function(_0x1447f6){_0x38cf5f[_0x8a40('0x4a')]=_0x1447f6;return _0x38cf5f;})[_0x8a40('0x2a')](respondWithFilteredResult(_0x306ec4,_0x1efe0d))[_0x8a40('0x4b')](handleError(_0x306ec4,null));};exports[_0x8a40('0x4c')]=function(_0x4719f3,_0x4560b5){var _0x250581={'raw':!![],'where':{'id':_0x4719f3[_0x8a40('0x4d')]['id']}},_0x2f174e={};_0x2f174e[_0x8a40('0x37')]=_['keys'](db['FaxQueue'][_0x8a40('0x35')]);_0x2f174e[_0x8a40('0x38')]=_[_0x8a40('0x39')](_0x4719f3['query']);_0x2f174e[_0x8a40('0x3a')]=_[_0x8a40('0x3b')](_0x2f174e['model'],_0x2f174e[_0x8a40('0x38')]);_0x250581[_0x8a40('0x3d')]=_[_0x8a40('0x3b')](_0x2f174e[_0x8a40('0x37')],qs[_0x8a40('0x3c')](_0x4719f3[_0x8a40('0x38')]['fields']));_0x250581['attributes']=_0x250581['attributes'][_0x8a40('0x3e')]?_0x250581[_0x8a40('0x3d')]:_0x2f174e[_0x8a40('0x37')];if(_0x4719f3[_0x8a40('0x38')]['includeAll']){_0x250581[_0x8a40('0x4e')]=[{'all':!![]}];}_0x250581=_[_0x8a40('0x48')]({},_0x250581,_0x4719f3[_0x8a40('0x4f')]);return db[_0x8a40('0x34')][_0x8a40('0x50')](_0x250581)[_0x8a40('0x2a')](handleEntityNotFound(_0x4560b5,null))[_0x8a40('0x2a')](respondWithResult(_0x4560b5,null))[_0x8a40('0x4b')](handleError(_0x4560b5,null));};exports[_0x8a40('0x51')]=function(_0x3af379,_0x30aea2){return db[_0x8a40('0x34')][_0x8a40('0x51')](_0x3af379[_0x8a40('0x52')],{})[_0x8a40('0x2a')](function(_0xd972f6){var _0x1fb980=_0x3af379['user'][_0x8a40('0x53')]({'plain':!![]});if(!_0x1fb980)throw new Error(_0x8a40('0x54'));if(_0x1fb980[_0x8a40('0x55')]==='user'){var _0x31fdc2=_0xd972f6[_0x8a40('0x53')]({'plain':!![]});var _0x9352f7=_0x8a40('0x2c');return db[_0x8a40('0x56')][_0x8a40('0x50')]({'where':{'name':_0x9352f7,'userProfileId':_0x1fb980[_0x8a40('0x57')]},'raw':!![]})[_0x8a40('0x2a')](function(_0x49072b){if(_0x49072b&&_0x49072b[_0x8a40('0x58')]===0x0){return db['UserProfileResource'][_0x8a40('0x51')]({'name':_0x31fdc2['name'],'resourceId':_0x31fdc2['id'],'type':_0x49072b[_0x8a40('0x30')],'sectionId':_0x49072b['id']},{})[_0x8a40('0x2a')](function(){return _0xd972f6;});}else{return _0xd972f6;}})[_0x8a40('0x4b')](function(_0x2866fc){logger[_0x8a40('0x2e')](_0x8a40('0x59'),_0x2866fc);throw _0x2866fc;});}return _0xd972f6;})[_0x8a40('0x2a')](respondWithResult(_0x30aea2,0xc9))[_0x8a40('0x4b')](handleError(_0x30aea2,null));};exports['update']=function(_0x5d261b,_0x56c4fe){if(_0x5d261b['body']['id']){delete _0x5d261b[_0x8a40('0x52')]['id'];}return db[_0x8a40('0x34')][_0x8a40('0x50')]({'where':{'id':_0x5d261b['params']['id']}})[_0x8a40('0x2a')](handleEntityNotFound(_0x56c4fe,null))['then'](saveUpdates(_0x5d261b[_0x8a40('0x52')],null))[_0x8a40('0x2a')](respondWithResult(_0x56c4fe,null))['catch'](handleError(_0x56c4fe,null));};exports['destroy']=function(_0x35cf54,_0x50051d){return db[_0x8a40('0x34')][_0x8a40('0x50')]({'where':{'id':_0x35cf54[_0x8a40('0x4d')]['id']}})[_0x8a40('0x2a')](handleEntityNotFound(_0x50051d,null))['then'](removeEntity(_0x50051d,null))[_0x8a40('0x4b')](handleError(_0x50051d,null));};exports[_0x8a40('0x5a')]=function(_0x2e74f9,_0xf57998){return db['FaxQueue']['describe']()[_0x8a40('0x2a')](respondWithResult(_0xf57998,null))[_0x8a40('0x4b')](handleError(_0xf57998,null));};exports[_0x8a40('0x5b')]=function(_0x140d6d,_0x19e52f,_0x1dac0a){var _0xea9a74={'raw':!![],'where':{}},_0xb194c={},_0x29f095;return db[_0x8a40('0x34')]['findOne']({'where':{'id':_0x140d6d[_0x8a40('0x4d')]['id']}})[_0x8a40('0x2a')](handleEntityNotFound(_0x19e52f,null))['then'](function(_0x297af1){if(_0x297af1){_0x29f095=_0x297af1['get']({'plain':!![]});_0xb194c[_0x8a40('0x37')]=_[_0x8a40('0x39')](db[_0x8a40('0x5c')][_0x8a40('0x35')]);_0xb194c[_0x8a40('0x38')]=_[_0x8a40('0x39')](_0x140d6d[_0x8a40('0x38')]);_0xb194c['filters']=_[_0x8a40('0x3b')](_0xb194c[_0x8a40('0x37')],_0xb194c[_0x8a40('0x38')]);_0xea9a74[_0x8a40('0x3d')]=_[_0x8a40('0x3b')](_0xb194c[_0x8a40('0x37')],qs['fields'](_0x140d6d[_0x8a40('0x38')]['fields']));_0xea9a74[_0x8a40('0x3d')]=_0xea9a74[_0x8a40('0x3d')]['length']?_0xea9a74[_0x8a40('0x3d')]:_0xb194c[_0x8a40('0x37')];if(!_0x140d6d[_0x8a40('0x38')][_0x8a40('0x3f')]('nolimit')){_0xea9a74[_0x8a40('0x41')]=qs[_0x8a40('0x41')](_0x140d6d[_0x8a40('0x38')]['limit']);_0xea9a74[_0x8a40('0x22')]=qs[_0x8a40('0x22')](_0x140d6d['query'][_0x8a40('0x22')]);}_0xea9a74[_0x8a40('0x42')]=qs['sort'](_0x140d6d[_0x8a40('0x38')][_0x8a40('0x43')]);_0xea9a74['where']=qs['filters'](_[_0x8a40('0x45')](_0x140d6d['query'],_0xb194c[_0x8a40('0x3a')]));_0xea9a74[_0x8a40('0x44')][_0x8a40('0x5d')]=_0x297af1['id'];if(_0x140d6d[_0x8a40('0x38')]['filter']){_0xea9a74[_0x8a40('0x44')]=_[_0x8a40('0x48')](_0xea9a74['where'],{'$or':_[_0x8a40('0x33')](_0xea9a74['attributes'],function(_0x306f9f){var _0x387e44={};_0x387e44[_0x306f9f]={'$like':'%'+_0x140d6d['query'][_0x8a40('0x46')]+'%'};return _0x387e44;})});}_0xea9a74=_[_0x8a40('0x48')]({},_0xea9a74,_0x140d6d[_0x8a40('0x4f')]);return db[_0x8a40('0x5c')]['findAll'](_0xea9a74);}})[_0x8a40('0x2a')](function(_0x59de44){if(_0x59de44){return db['User'][_0x8a40('0x5e')]({'where':{'id':_[_0x8a40('0x33')](_0x59de44,_0x8a40('0x5f')),'role':'agent'},'attributes':['id','name','faxPause',_0x8a40('0x60'),_0x8a40('0x61')]});}})[_0x8a40('0x2a')](function(_0x40fa19){if(_0x40fa19){return{'count':_0x40fa19[_0x8a40('0x24')],'rows':_[_0x8a40('0x33')](_0x40fa19[_0x8a40('0x4a')],function(_0x332920){return{'membername':_0x332920['name'],'UserId':_0x332920['id'],'queue_name':_0x29f095[_0x8a40('0x30')],'FaxQueueId':_0x29f095['id'],'interface':util[_0x8a40('0x62')](_0x8a40('0x63'),'SIP',_0x332920[_0x8a40('0x30')]),'penalty':0x0,'paused':_0x332920[_0x8a40('0x64')],'createdAt':_0x332920['createdAt'],'updatedAt':_0x332920[_0x8a40('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x19e52f,_0xea9a74))[_0x8a40('0x4b')](handleError(_0x19e52f,null));};exports[_0x8a40('0x65')]=function(_0x39d262,_0x3098f4,_0x5303b2){var _0x37c4ee={};var _0x38efb5={};var _0x3dd9d7;var _0x57d134;return db['FaxQueue'][_0x8a40('0x66')]({'where':{'id':_0x39d262[_0x8a40('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3098f4,null))[_0x8a40('0x2a')](function(_0x1f2872){if(_0x1f2872){_0x3dd9d7=_0x1f2872;_0x38efb5[_0x8a40('0x37')]=_[_0x8a40('0x39')](db[_0x8a40('0x67')]['rawAttributes']);_0x38efb5[_0x8a40('0x38')]=_[_0x8a40('0x39')](_0x39d262['query']);_0x38efb5[_0x8a40('0x3a')]=_[_0x8a40('0x3b')](_0x38efb5[_0x8a40('0x37')],_0x38efb5[_0x8a40('0x38')]);_0x37c4ee[_0x8a40('0x3d')]=_[_0x8a40('0x3b')](_0x38efb5['model'],qs[_0x8a40('0x3c')](_0x39d262[_0x8a40('0x38')]['fields']));_0x37c4ee[_0x8a40('0x3d')]=_0x37c4ee[_0x8a40('0x3d')][_0x8a40('0x3e')]?_0x37c4ee[_0x8a40('0x3d')]:_0x38efb5[_0x8a40('0x37')];_0x37c4ee['order']=qs['sort'](_0x39d262['query'][_0x8a40('0x43')]);_0x37c4ee['where']=qs[_0x8a40('0x3a')](_[_0x8a40('0x45')](_0x39d262['query'],_0x38efb5[_0x8a40('0x3a')]));if(_0x39d262[_0x8a40('0x38')][_0x8a40('0x46')]){_0x37c4ee['where']=_[_0x8a40('0x48')](_0x37c4ee[_0x8a40('0x44')],{'$or':_[_0x8a40('0x33')](_0x37c4ee['attributes'],function(_0x7398e4){var _0x33b61a={};_0x33b61a[_0x7398e4]={'$like':'%'+_0x39d262['query']['filter']+'%'};return _0x33b61a;})});}_0x37c4ee=_[_0x8a40('0x48')]({},_0x37c4ee,_0x39d262['options']);return _0x3dd9d7[_0x8a40('0x65')](_0x37c4ee);}})[_0x8a40('0x2a')](function(_0x193430){if(_0x193430){_0x57d134=_0x193430[_0x8a40('0x3e')];if(!_0x39d262[_0x8a40('0x38')]['hasOwnProperty'](_0x8a40('0x40'))){_0x37c4ee[_0x8a40('0x41')]=qs[_0x8a40('0x41')](_0x39d262['query'][_0x8a40('0x41')]);_0x37c4ee[_0x8a40('0x22')]=qs[_0x8a40('0x22')](_0x39d262[_0x8a40('0x38')][_0x8a40('0x22')]);}return _0x3dd9d7[_0x8a40('0x65')](_0x37c4ee);}})[_0x8a40('0x2a')](function(_0x65503d){if(_0x65503d){return _0x65503d?{'count':_0x57d134,'rows':_0x65503d}:null;}})[_0x8a40('0x2a')](respondWithResult(_0x3098f4,null))[_0x8a40('0x4b')](handleError(_0x3098f4,null));};exports[_0x8a40('0x68')]=function(_0x9a5543,_0x55c8e4,_0x4868f8){var _0x328aea=_0x9a5543[_0x8a40('0x52')]['ids'];return db[_0x8a40('0x67')][_0x8a40('0x69')]({'where':{'id':_0x328aea},'attributes':['id'],'include':[{'model':db[_0x8a40('0x6a')],'as':_0x8a40('0x6b'),'attributes':['id',_0x8a40('0x30'),_0x8a40('0x6c'),_0x8a40('0x6d'),_0x8a40('0x6e')],'raw':!![]}]})['then'](function(_0x45bf5f){if(_0x45bf5f){var _0x5e230e=_['flatMap'](_0x45bf5f,function(_0x363806){var _0x47ef3f=_0x363806[_0x8a40('0x53')]({'plain':!![]});return _0x47ef3f['Agents'];});return db[_0x8a40('0x34')][_0x8a40('0x50')]({'where':{'id':_0x9a5543['params']['id']}})[_0x8a40('0x2a')](function(_0x31e9af){return db[_0x8a40('0x6f')][_0x8a40('0x70')](function(_0x338e69){return _0x31e9af[_0x8a40('0x68')](_0x328aea,{'transaction':_0x338e69})[_0x8a40('0x2a')](function(){return BPromise[_0x8a40('0x71')](_0x5e230e,function(_0x33f7c9){return db['UserFaxQueue'][_0x8a40('0x72')]({'where':{'UserId':_0x33f7c9['id'],'FaxQueueId':_0x9a5543['params']['id']},'transaction':_0x338e69});});})['then'](function(){_0x5e230e['forEach'](function(_0x1f9531){socket[_0x8a40('0x73')]('userFaxQueue:save',{'UserId':_0x1f9531['id'],'FaxQueueId':_0x31e9af['id']});});});});});}})[_0x8a40('0x2a')](respondWithStatusCode(_0x55c8e4,null))[_0x8a40('0x4b')](handleError(_0x55c8e4,null));};exports[_0x8a40('0x74')]=function(_0x2824b5,_0x3c33fb,_0x4aeea7){return db[_0x8a40('0x67')][_0x8a40('0x69')]({'where':{'id':_0x2824b5[_0x8a40('0x38')]['ids']},'attributes':['id'],'include':[{'model':db[_0x8a40('0x6a')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x8a40('0x2a')](handleEntityNotFound(_0x3c33fb,null))['then'](function(_0x45100b){var _0x5923dc=_[_0x8a40('0x33')](_0x45100b,'id');var _0x5cc0c1=[];var _0x46206f=[];var _0x4cd632=squel[_0x8a40('0x75')]();_0x4cd632['field'](_0x8a40('0x76'))[_0x8a40('0x77')](_0x8a40('0x78'),'tq')['join']('user_has_teams','ut',_0x8a40('0x79'))[_0x8a40('0x44')](_0x8a40('0x7a'),_0x2824b5[_0x8a40('0x4d')]['id']);for(var _0x248991=0x0;_0x248991<_0x45100b[_0x8a40('0x3e')];_0x248991+=0x1){let _0x3b1043=_0x45100b[_0x248991];for(var _0x44335b=0x0;_0x44335b<_0x3b1043[_0x8a40('0x6b')][_0x8a40('0x3e')];_0x44335b+=0x1){let _0x3814ed=_0x3b1043[_0x8a40('0x6b')][_0x44335b];var _0xae90f7=_0x4cd632[_0x8a40('0x7b')]();_0xae90f7[_0x8a40('0x44')](_0x8a40('0x7c'),_0x3814ed['id']);_0x46206f['push'](db[_0x8a40('0x6f')][_0x8a40('0x38')](_0xae90f7[_0x8a40('0x7d')](),{'type':db[_0x8a40('0x6f')]['QueryTypes'][_0x8a40('0x7e')]})[_0x8a40('0x2a')](function(_0xf49350){if(_0xf49350['length']===0x1){return _0x3814ed['id'];}else{var _0x2fdbef=_[_0x8a40('0x7f')](_[_0x8a40('0x33')](_0xf49350,'TeamId'),function(_0x405dc3){return _[_0x8a40('0x80')](_0x5923dc,_0x405dc3);});if(_0x2fdbef){return _0x3814ed['id'];}}}));}}return BPromise[_0x8a40('0x81')](_0x46206f)[_0x8a40('0x2a')](function(_0x1773da){_0x5cc0c1=_(_0x5cc0c1)[_0x8a40('0x82')](_0x1773da)[_0x8a40('0x83')]()['value']();return db[_0x8a40('0x34')]['find']({'where':{'id':_0x2824b5[_0x8a40('0x4d')]['id']}})[_0x8a40('0x2a')](function(_0x2c8533){return db['sequelize'][_0x8a40('0x70')](function(_0xf80f85){return _0x2c8533['removeTeams'](_0x2824b5[_0x8a40('0x38')]['ids'],{'transaction':_0xf80f85})['then'](function(){if(!_[_0x8a40('0x84')](_0x5cc0c1)){return _0x2c8533[_0x8a40('0x85')](_0x5cc0c1,{'transaction':_0xf80f85});}})['then'](function(){_0x5cc0c1[_0x8a40('0x86')](function(_0xc46293){socket[_0x8a40('0x73')](_0x8a40('0x87'),{'UserId':_0xc46293,'FaxQueueId':_0x2c8533['id']});});});});});});})[_0x8a40('0x2a')](respondWithStatusCode(_0x3c33fb,null))[_0x8a40('0x4b')](handleError(_0x3c33fb,null));};exports['addAgents']=function(_0x5d9ace,_0x317990,_0x7f8435){return db[_0x8a40('0x34')][_0x8a40('0x50')]({'where':{'id':_0x5d9ace[_0x8a40('0x4d')]['id']}})[_0x8a40('0x2a')](handleEntityNotFound(_0x317990,null))['then'](function(_0xc54860){if(_0xc54860){return _0xc54860['addAgents'](_0x5d9ace[_0x8a40('0x52')]['ids'],_['omit'](_0x5d9ace[_0x8a40('0x52')],[_0x8a40('0x88'),'id'])||{})[_0x8a40('0x89')](function(_0x219f37){for(var _0x4256f3=0x0;_0x4256f3<_0x5d9ace['body'][_0x8a40('0x88')][_0x8a40('0x3e')];_0x4256f3+=0x1){socket['emit']('userFaxQueue:save',{'UserId':Number(_0x5d9ace[_0x8a40('0x52')][_0x8a40('0x88')][_0x4256f3]),'FaxQueueId':Number(_0x5d9ace[_0x8a40('0x4d')]['id'])});}return _0x219f37;});}})[_0x8a40('0x2a')](respondWithResult(_0x317990,null))[_0x8a40('0x4b')](handleError(_0x317990,null));};exports[_0x8a40('0x85')]=function(_0x52a26a,_0x5246b7,_0xbd095b){return db[_0x8a40('0x34')][_0x8a40('0x50')]({'where':{'id':_0x52a26a[_0x8a40('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5246b7,null))[_0x8a40('0x2a')](function(_0x14377e){if(_0x14377e){return _0x14377e[_0x8a40('0x85')](_0x52a26a['query'][_0x8a40('0x88')])[_0x8a40('0x2a')](function(){if(_[_0x8a40('0x8a')](_0x52a26a[_0x8a40('0x38')][_0x8a40('0x88')])){for(var _0x16ca85=0x0;_0x16ca85<_0x52a26a['query'][_0x8a40('0x88')][_0x8a40('0x3e')];_0x16ca85+=0x1){socket[_0x8a40('0x73')](_0x8a40('0x87'),{'UserId':Number(_0x52a26a[_0x8a40('0x38')][_0x8a40('0x88')][_0x16ca85]),'FaxQueueId':Number(_0x52a26a[_0x8a40('0x4d')]['id'])});}}else{socket[_0x8a40('0x73')](_0x8a40('0x87'),{'UserId':Number(_0x52a26a['query']['ids']),'FaxQueueId':Number(_0x52a26a[_0x8a40('0x4d')]['id'])});}});}})[_0x8a40('0x2a')](respondWithStatusCode(_0x5246b7,null))['catch'](handleError(_0x5246b7,null));};exports['getAgents']=function(_0x1597c9,_0x584b3b,_0x21d0cb){var _0x386277={};var _0x13197a={};var _0x427ec1;var _0x338d86;return db[_0x8a40('0x34')][_0x8a40('0x66')]({'where':{'id':_0x1597c9[_0x8a40('0x4d')]['id']}})[_0x8a40('0x2a')](handleEntityNotFound(_0x584b3b,null))['then'](function(_0x39d902){if(_0x39d902){_0x427ec1=_0x39d902;_0x13197a[_0x8a40('0x37')]=_[_0x8a40('0x39')](db[_0x8a40('0x6a')][_0x8a40('0x35')]);_0x13197a[_0x8a40('0x38')]=_[_0x8a40('0x39')](_0x1597c9[_0x8a40('0x38')]);_0x13197a[_0x8a40('0x3a')]=_[_0x8a40('0x3b')](_0x13197a[_0x8a40('0x37')],_0x13197a['query']);_0x386277[_0x8a40('0x3d')]=_['intersection'](_0x13197a[_0x8a40('0x37')],qs[_0x8a40('0x3c')](_0x1597c9[_0x8a40('0x38')]['fields']));_0x386277[_0x8a40('0x3d')]=_0x386277['attributes']['length']?_0x386277[_0x8a40('0x3d')]:_0x13197a[_0x8a40('0x37')];_0x386277[_0x8a40('0x42')]=qs['sort'](_0x1597c9[_0x8a40('0x38')][_0x8a40('0x43')]);_0x386277[_0x8a40('0x44')]=qs[_0x8a40('0x3a')](_[_0x8a40('0x45')](_0x1597c9[_0x8a40('0x38')],_0x13197a[_0x8a40('0x3a')]));if(_0x1597c9['query'][_0x8a40('0x46')]){_0x386277[_0x8a40('0x44')]=_[_0x8a40('0x48')](_0x386277[_0x8a40('0x44')],{'$or':_[_0x8a40('0x33')](_0x386277[_0x8a40('0x3d')],function(_0x53e165){var _0x405915={};_0x405915[_0x53e165]={'$like':'%'+_0x1597c9['query'][_0x8a40('0x46')]+'%'};return _0x405915;})});}_0x386277=_[_0x8a40('0x48')]({},_0x386277,_0x1597c9['options']);return _0x427ec1[_0x8a40('0x8b')](_0x386277);}})[_0x8a40('0x2a')](function(_0x18eead){if(_0x18eead){_0x338d86=_0x18eead[_0x8a40('0x3e')];if(!_0x1597c9[_0x8a40('0x38')][_0x8a40('0x3f')](_0x8a40('0x40'))){_0x386277['limit']=qs[_0x8a40('0x41')](_0x1597c9[_0x8a40('0x38')][_0x8a40('0x41')]);_0x386277[_0x8a40('0x22')]=qs[_0x8a40('0x22')](_0x1597c9[_0x8a40('0x38')][_0x8a40('0x22')]);}return _0x427ec1[_0x8a40('0x8b')](_0x386277);}})[_0x8a40('0x2a')](function(_0x218fb0){if(_0x218fb0){return _0x218fb0?{'count':_0x338d86,'rows':_0x218fb0}:null;}})['then'](respondWithResult(_0x584b3b,null))[_0x8a40('0x4b')](handleError(_0x584b3b,null));}; \ No newline at end of file +var _0x6933=['value','removeAgents','emit','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','show','fields','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','FaxQueues','UserProfileSection','userProfileId','autoAssociation','params','describe','getMembers','findOne','pick','FaxQueueId','UserFaxQueue','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','rows','format','getTeams','Team','ids','User','Agents','online','interface','transaction','each','findOrCreate','forEach','userFaxQueue:save','removeTeams','select','field','join','user_has_teams','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','TeamId','includes'];(function(_0x3b594b,_0x5835c3){var _0x1ea5f8=function(_0x191b3e){while(--_0x191b3e){_0x3b594b['push'](_0x3b594b['shift']());}};_0x1ea5f8(++_0x5835c3);}(_0x6933,0x1b0));var _0x3693=function(_0x906ca6,_0x592235){_0x906ca6=_0x906ca6-0x0;var _0x12dd8b=_0x6933[_0x906ca6];return _0x12dd8b;};'use strict';var emlformat=require(_0x3693('0x0'));var rimraf=require(_0x3693('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3693('0x2'));var rp=require(_0x3693('0x3'));var moment=require(_0x3693('0x4'));var BPromise=require(_0x3693('0x5'));var Mustache=require(_0x3693('0x6'));var util=require(_0x3693('0x7'));var path=require(_0x3693('0x8'));var sox=require(_0x3693('0x9'));var csv=require(_0x3693('0xa'));var ejs=require(_0x3693('0xb'));var fs=require('fs');var fs_extra=require(_0x3693('0xc'));var _=require(_0x3693('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3693('0xe'));var deskjs=require(_0x3693('0xf'));var toCsv=require(_0x3693('0xa'));var querystring=require(_0x3693('0x10'));var Papa=require(_0x3693('0x11'));var Redis=require(_0x3693('0x12'));var authService=require(_0x3693('0x13'));var qs=require(_0x3693('0x14'));var as=require(_0x3693('0x15'));var hardwareService=require(_0x3693('0x16'));var logger=require(_0x3693('0x17'))('api');var utils=require(_0x3693('0x18'));var config=require(_0x3693('0x19'));var licenseUtil=require(_0x3693('0x1a'));var db=require(_0x3693('0x1b'))['db'];config[_0x3693('0x1c')]=_[_0x3693('0x1d')](config['redis'],{'host':_0x3693('0x1e'),'port':0x18eb});var socket=require(_0x3693('0x1f'))(new Redis(config['redis']));require(_0x3693('0x20'))[_0x3693('0x21')](socket);function respondWithStatusCode(_0x4dce8c,_0x174e30){_0x174e30=_0x174e30||0xcc;return function(_0x300692){if(_0x300692){return _0x4dce8c[_0x3693('0x22')](_0x174e30);}return _0x4dce8c[_0x3693('0x23')](_0x174e30)['end']();};}function respondWithResult(_0x4d1338,_0x4b7bda){_0x4b7bda=_0x4b7bda||0xc8;return function(_0x100f19){if(_0x100f19){return _0x4d1338[_0x3693('0x23')](_0x4b7bda)[_0x3693('0x24')](_0x100f19);}};}function respondWithFilteredResult(_0x553a03,_0x12a0da){return function(_0x179921){if(_0x179921){var _0x1c3c2b=typeof _0x12a0da[_0x3693('0x25')]===_0x3693('0x26')&&typeof _0x12a0da[_0x3693('0x27')]===_0x3693('0x26');var _0x3cc559=_0x179921[_0x3693('0x28')];var _0x543e56=_0x1c3c2b?0x0:_0x12a0da[_0x3693('0x25')];var _0x15a908=_0x1c3c2b?_0x179921[_0x3693('0x28')]:_0x12a0da[_0x3693('0x25')]+_0x12a0da['limit'];var _0x4992ec;if(_0x15a908>=_0x3cc559){_0x15a908=_0x3cc559;_0x4992ec=0xc8;}else{_0x4992ec=0xce;}_0x553a03[_0x3693('0x23')](_0x4992ec);return _0x553a03['set'](_0x3693('0x29'),_0x543e56+'-'+_0x15a908+'/'+_0x3cc559)[_0x3693('0x24')](_0x179921);}return null;};}function patchUpdates(_0x5747fc){return function(_0x1f7db8){try{jsonpatch[_0x3693('0x2a')](_0x1f7db8,_0x5747fc,!![]);}catch(_0x1e2493){return BPromise[_0x3693('0x2b')](_0x1e2493);}return _0x1f7db8[_0x3693('0x2c')]();};}function saveUpdates(_0x3f091d,_0x51a58d){return function(_0x53ce3e){if(_0x53ce3e){return _0x53ce3e[_0x3693('0x2d')](_0x3f091d)[_0x3693('0x2e')](function(_0x22eaa0){return _0x22eaa0;});}return null;};}function removeEntity(_0xfbdd0f,_0x21538e){return function(_0x3a012d){if(_0x3a012d){return _0x3a012d[_0x3693('0x2f')]()['then'](function(){var _0x37dd57=_0x3a012d[_0x3693('0x30')]({'plain':!![]});var _0x2e34c3='FaxQueues';return db[_0x3693('0x31')][_0x3693('0x2f')]({'where':{'type':_0x2e34c3,'resourceId':_0x37dd57['id']}})['then'](function(){return _0x3a012d;});})[_0x3693('0x2e')](function(){_0xfbdd0f[_0x3693('0x23')](0xcc)[_0x3693('0x32')]();});}};}function handleEntityNotFound(_0x3ae80f,_0x55aeb0){return function(_0x5b5df4){if(!_0x5b5df4){_0x3ae80f[_0x3693('0x22')](0x194);}return _0x5b5df4;};}function handleError(_0x293443,_0xc6a4f1){_0xc6a4f1=_0xc6a4f1||0x1f4;return function(_0x202a04){logger[_0x3693('0x33')](_0x202a04['stack']);if(_0x202a04[_0x3693('0x34')]){delete _0x202a04['name'];}_0x293443[_0x3693('0x23')](_0xc6a4f1)[_0x3693('0x35')](_0x202a04);};}exports[_0x3693('0x36')]=function(_0x8c454a,_0x59d58a){var _0x44be3c={},_0x52f924={},_0x35fce3={'count':0x0,'rows':[]};var _0x334d4b=_[_0x3693('0x37')](db[_0x3693('0x38')][_0x3693('0x39')],function(_0x1a9b01){return{'name':_0x1a9b01[_0x3693('0x3a')],'type':_0x1a9b01[_0x3693('0x3b')][_0x3693('0x3c')]};});_0x52f924[_0x3693('0x3d')]=_[_0x3693('0x37')](_0x334d4b,'name');_0x52f924[_0x3693('0x3e')]=_[_0x3693('0x3f')](_0x8c454a[_0x3693('0x3e')]);_0x52f924[_0x3693('0x40')]=_['intersection'](_0x52f924[_0x3693('0x3d')],_0x52f924[_0x3693('0x3e')]);_0x44be3c[_0x3693('0x41')]=_[_0x3693('0x42')](_0x52f924[_0x3693('0x3d')],qs['fields'](_0x8c454a[_0x3693('0x3e')]['fields']));_0x44be3c[_0x3693('0x41')]=_0x44be3c[_0x3693('0x41')][_0x3693('0x43')]?_0x44be3c[_0x3693('0x41')]:_0x52f924[_0x3693('0x3d')];if(!_0x8c454a[_0x3693('0x3e')][_0x3693('0x44')](_0x3693('0x45'))){_0x44be3c[_0x3693('0x27')]=qs['limit'](_0x8c454a[_0x3693('0x3e')]['limit']);_0x44be3c[_0x3693('0x25')]=qs[_0x3693('0x25')](_0x8c454a[_0x3693('0x3e')][_0x3693('0x25')]);}_0x44be3c[_0x3693('0x46')]=qs[_0x3693('0x47')](_0x8c454a[_0x3693('0x3e')][_0x3693('0x47')]);_0x44be3c[_0x3693('0x48')]=qs['filters'](_['pick'](_0x8c454a[_0x3693('0x3e')],_0x52f924[_0x3693('0x40')]),_0x334d4b);if(_0x8c454a[_0x3693('0x3e')][_0x3693('0x49')]){_0x44be3c[_0x3693('0x48')]=_['merge'](_0x44be3c['where'],{'$or':_[_0x3693('0x37')](_0x334d4b,function(_0x595143){if(_0x595143['type']!==_0x3693('0x4a')){var _0x171636={};_0x171636[_0x595143[_0x3693('0x34')]]={'$like':'%'+_0x8c454a['query'][_0x3693('0x49')]+'%'};return _0x171636;}})});}_0x44be3c=_[_0x3693('0x4b')]({},_0x44be3c,_0x8c454a[_0x3693('0x4c')]);var _0x53cc7b={'where':_0x44be3c[_0x3693('0x48')]};return db[_0x3693('0x38')]['count'](_0x53cc7b)['then'](function(_0x4603c4){_0x35fce3[_0x3693('0x28')]=_0x4603c4;if(_0x8c454a['query'][_0x3693('0x4d')]){_0x44be3c['include']=[{'all':!![]}];}return db[_0x3693('0x38')][_0x3693('0x4e')](_0x44be3c);})[_0x3693('0x2e')](function(_0x2bbd03){_0x35fce3['rows']=_0x2bbd03;return _0x35fce3;})[_0x3693('0x2e')](respondWithFilteredResult(_0x59d58a,_0x44be3c))['catch'](handleError(_0x59d58a,null));};exports[_0x3693('0x4f')]=function(_0x2a1c12,_0x4ba120){var _0x2ea1de={'raw':!![],'where':{'id':_0x2a1c12['params']['id']}},_0x552745={};_0x552745[_0x3693('0x3d')]=_[_0x3693('0x3f')](db['FaxQueue'][_0x3693('0x39')]);_0x552745[_0x3693('0x3e')]=_[_0x3693('0x3f')](_0x2a1c12[_0x3693('0x3e')]);_0x552745[_0x3693('0x40')]=_[_0x3693('0x42')](_0x552745[_0x3693('0x3d')],_0x552745['query']);_0x2ea1de[_0x3693('0x41')]=_[_0x3693('0x42')](_0x552745['model'],qs[_0x3693('0x50')](_0x2a1c12[_0x3693('0x3e')][_0x3693('0x50')]));_0x2ea1de[_0x3693('0x41')]=_0x2ea1de[_0x3693('0x41')]['length']?_0x2ea1de[_0x3693('0x41')]:_0x552745[_0x3693('0x3d')];if(_0x2a1c12[_0x3693('0x3e')][_0x3693('0x4d')]){_0x2ea1de['include']=[{'all':!![]}];}_0x2ea1de=_[_0x3693('0x4b')]({},_0x2ea1de,_0x2a1c12['options']);return db[_0x3693('0x38')][_0x3693('0x51')](_0x2ea1de)[_0x3693('0x2e')](handleEntityNotFound(_0x4ba120,null))[_0x3693('0x2e')](respondWithResult(_0x4ba120,null))[_0x3693('0x52')](handleError(_0x4ba120,null));};exports[_0x3693('0x53')]=function(_0x41889b,_0x3b03b6){return db[_0x3693('0x38')][_0x3693('0x53')](_0x41889b[_0x3693('0x54')],{})[_0x3693('0x2e')](function(_0x2aee47){var _0x21b904=_0x41889b[_0x3693('0x55')][_0x3693('0x30')]({'plain':!![]});if(!_0x21b904)throw new Error(_0x3693('0x56'));if(_0x21b904['role']===_0x3693('0x55')){var _0x5d7d53=_0x2aee47[_0x3693('0x30')]({'plain':!![]});var _0x4fef62=_0x3693('0x57');return db[_0x3693('0x58')]['find']({'where':{'name':_0x4fef62,'userProfileId':_0x21b904[_0x3693('0x59')]},'raw':!![]})[_0x3693('0x2e')](function(_0x41adc2){if(_0x41adc2&&_0x41adc2[_0x3693('0x5a')]===0x0){return db[_0x3693('0x31')][_0x3693('0x53')]({'name':_0x5d7d53[_0x3693('0x34')],'resourceId':_0x5d7d53['id'],'type':_0x41adc2[_0x3693('0x34')],'sectionId':_0x41adc2['id']},{})[_0x3693('0x2e')](function(){return _0x2aee47;});}else{return _0x2aee47;}})[_0x3693('0x52')](function(_0x31d999){logger[_0x3693('0x33')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x31d999);throw _0x31d999;});}return _0x2aee47;})[_0x3693('0x2e')](respondWithResult(_0x3b03b6,0xc9))['catch'](handleError(_0x3b03b6,null));};exports[_0x3693('0x2d')]=function(_0x4b1d04,_0x524bcb){if(_0x4b1d04[_0x3693('0x54')]['id']){delete _0x4b1d04[_0x3693('0x54')]['id'];}return db[_0x3693('0x38')][_0x3693('0x51')]({'where':{'id':_0x4b1d04['params']['id']}})[_0x3693('0x2e')](handleEntityNotFound(_0x524bcb,null))[_0x3693('0x2e')](saveUpdates(_0x4b1d04[_0x3693('0x54')],null))['then'](respondWithResult(_0x524bcb,null))[_0x3693('0x52')](handleError(_0x524bcb,null));};exports['destroy']=function(_0xf861c2,_0x45c740){return db['FaxQueue']['find']({'where':{'id':_0xf861c2[_0x3693('0x5b')]['id']}})['then'](handleEntityNotFound(_0x45c740,null))[_0x3693('0x2e')](removeEntity(_0x45c740,null))[_0x3693('0x52')](handleError(_0x45c740,null));};exports[_0x3693('0x5c')]=function(_0x43789e,_0x20e08f){return db[_0x3693('0x38')][_0x3693('0x5c')]()[_0x3693('0x2e')](respondWithResult(_0x20e08f,null))['catch'](handleError(_0x20e08f,null));};exports[_0x3693('0x5d')]=function(_0x4728f6,_0x327bb2,_0x55c3c2){var _0x549b2b={'raw':!![],'where':{}},_0x177e16={},_0xa17e16;return db[_0x3693('0x38')][_0x3693('0x5e')]({'where':{'id':_0x4728f6[_0x3693('0x5b')]['id']}})[_0x3693('0x2e')](handleEntityNotFound(_0x327bb2,null))[_0x3693('0x2e')](function(_0x3fa5ec){if(_0x3fa5ec){_0xa17e16=_0x3fa5ec['get']({'plain':!![]});_0x177e16[_0x3693('0x3d')]=_['keys'](db['UserFaxQueue'][_0x3693('0x39')]);_0x177e16[_0x3693('0x3e')]=_[_0x3693('0x3f')](_0x4728f6[_0x3693('0x3e')]);_0x177e16[_0x3693('0x40')]=_['intersection'](_0x177e16[_0x3693('0x3d')],_0x177e16[_0x3693('0x3e')]);_0x549b2b[_0x3693('0x41')]=_['intersection'](_0x177e16[_0x3693('0x3d')],qs['fields'](_0x4728f6[_0x3693('0x3e')][_0x3693('0x50')]));_0x549b2b['attributes']=_0x549b2b['attributes'][_0x3693('0x43')]?_0x549b2b[_0x3693('0x41')]:_0x177e16[_0x3693('0x3d')];if(!_0x4728f6['query'][_0x3693('0x44')]('nolimit')){_0x549b2b[_0x3693('0x27')]=qs['limit'](_0x4728f6[_0x3693('0x3e')][_0x3693('0x27')]);_0x549b2b[_0x3693('0x25')]=qs[_0x3693('0x25')](_0x4728f6[_0x3693('0x3e')][_0x3693('0x25')]);}_0x549b2b[_0x3693('0x46')]=qs[_0x3693('0x47')](_0x4728f6[_0x3693('0x3e')][_0x3693('0x47')]);_0x549b2b['where']=qs[_0x3693('0x40')](_[_0x3693('0x5f')](_0x4728f6[_0x3693('0x3e')],_0x177e16['filters']));_0x549b2b[_0x3693('0x48')][_0x3693('0x60')]=_0x3fa5ec['id'];if(_0x4728f6['query'][_0x3693('0x49')]){_0x549b2b[_0x3693('0x48')]=_[_0x3693('0x4b')](_0x549b2b['where'],{'$or':_['map'](_0x549b2b['attributes'],function(_0x36a04b){var _0x3ca389={};_0x3ca389[_0x36a04b]={'$like':'%'+_0x4728f6[_0x3693('0x3e')][_0x3693('0x49')]+'%'};return _0x3ca389;})});}_0x549b2b=_[_0x3693('0x4b')]({},_0x549b2b,_0x4728f6['options']);return db[_0x3693('0x61')][_0x3693('0x4e')](_0x549b2b);}})[_0x3693('0x2e')](function(_0x58434f){if(_0x58434f){return db['User'][_0x3693('0x62')]({'where':{'id':_[_0x3693('0x37')](_0x58434f,_0x3693('0x63')),'role':_0x3693('0x64')},'attributes':['id',_0x3693('0x34'),_0x3693('0x65'),_0x3693('0x66'),_0x3693('0x67')]});}})[_0x3693('0x2e')](function(_0x25eaf0){if(_0x25eaf0){return{'count':_0x25eaf0[_0x3693('0x28')],'rows':_[_0x3693('0x37')](_0x25eaf0[_0x3693('0x68')],function(_0x2010a9){return{'membername':_0x2010a9[_0x3693('0x34')],'UserId':_0x2010a9['id'],'queue_name':_0xa17e16['name'],'FaxQueueId':_0xa17e16['id'],'interface':util[_0x3693('0x69')]('%s/%s','SIP',_0x2010a9[_0x3693('0x34')]),'penalty':0x0,'paused':_0x2010a9[_0x3693('0x65')],'createdAt':_0x2010a9[_0x3693('0x67')],'updatedAt':_0x2010a9[_0x3693('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x327bb2,_0x549b2b))['catch'](handleError(_0x327bb2,null));};exports[_0x3693('0x6a')]=function(_0x5b1864,_0x3ba4f5,_0x1a2e3f){var _0x4eef32={};var _0x244f19={};var _0x427fe4;var _0x591d7d;return db[_0x3693('0x38')][_0x3693('0x5e')]({'where':{'id':_0x5b1864[_0x3693('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3ba4f5,null))[_0x3693('0x2e')](function(_0x4f6f0f){if(_0x4f6f0f){_0x427fe4=_0x4f6f0f;_0x244f19['model']=_['keys'](db[_0x3693('0x6b')]['rawAttributes']);_0x244f19[_0x3693('0x3e')]=_[_0x3693('0x3f')](_0x5b1864['query']);_0x244f19[_0x3693('0x40')]=_[_0x3693('0x42')](_0x244f19[_0x3693('0x3d')],_0x244f19[_0x3693('0x3e')]);_0x4eef32[_0x3693('0x41')]=_[_0x3693('0x42')](_0x244f19[_0x3693('0x3d')],qs[_0x3693('0x50')](_0x5b1864[_0x3693('0x3e')]['fields']));_0x4eef32[_0x3693('0x41')]=_0x4eef32[_0x3693('0x41')][_0x3693('0x43')]?_0x4eef32[_0x3693('0x41')]:_0x244f19[_0x3693('0x3d')];_0x4eef32['order']=qs[_0x3693('0x47')](_0x5b1864['query']['sort']);_0x4eef32[_0x3693('0x48')]=qs[_0x3693('0x40')](_[_0x3693('0x5f')](_0x5b1864['query'],_0x244f19[_0x3693('0x40')]));if(_0x5b1864['query'][_0x3693('0x49')]){_0x4eef32['where']=_[_0x3693('0x4b')](_0x4eef32[_0x3693('0x48')],{'$or':_[_0x3693('0x37')](_0x4eef32[_0x3693('0x41')],function(_0x467c1e){var _0x359034={};_0x359034[_0x467c1e]={'$like':'%'+_0x5b1864[_0x3693('0x3e')]['filter']+'%'};return _0x359034;})});}_0x4eef32=_[_0x3693('0x4b')]({},_0x4eef32,_0x5b1864[_0x3693('0x4c')]);return _0x427fe4[_0x3693('0x6a')](_0x4eef32);}})[_0x3693('0x2e')](function(_0x49aedc){if(_0x49aedc){_0x591d7d=_0x49aedc[_0x3693('0x43')];if(!_0x5b1864[_0x3693('0x3e')][_0x3693('0x44')]('nolimit')){_0x4eef32[_0x3693('0x27')]=qs[_0x3693('0x27')](_0x5b1864[_0x3693('0x3e')]['limit']);_0x4eef32[_0x3693('0x25')]=qs['offset'](_0x5b1864[_0x3693('0x3e')][_0x3693('0x25')]);}return _0x427fe4['getTeams'](_0x4eef32);}})[_0x3693('0x2e')](function(_0x58f6c7){if(_0x58f6c7){return _0x58f6c7?{'count':_0x591d7d,'rows':_0x58f6c7}:null;}})[_0x3693('0x2e')](respondWithResult(_0x3ba4f5,null))[_0x3693('0x52')](handleError(_0x3ba4f5,null));};exports['addTeams']=function(_0x37f626,_0x308d45,_0x3035be){var _0x546d44=_0x37f626[_0x3693('0x54')][_0x3693('0x6c')];return db[_0x3693('0x6b')]['findAll']({'where':{'id':_0x546d44},'attributes':['id'],'include':[{'model':db[_0x3693('0x6d')],'as':_0x3693('0x6e'),'attributes':['id',_0x3693('0x34'),_0x3693('0x6f'),'voicePause',_0x3693('0x70')],'raw':!![]}]})[_0x3693('0x2e')](function(_0x56693d){if(_0x56693d){var _0x5da670=_['flatMap'](_0x56693d,function(_0x2a9efd){var _0x5d985f=_0x2a9efd[_0x3693('0x30')]({'plain':!![]});return _0x5d985f[_0x3693('0x6e')];});return db[_0x3693('0x38')][_0x3693('0x51')]({'where':{'id':_0x37f626['params']['id']}})['then'](function(_0x283078){return db['sequelize'][_0x3693('0x71')](function(_0x158b31){return _0x283078['addTeams'](_0x546d44,{'transaction':_0x158b31})[_0x3693('0x2e')](function(){return BPromise[_0x3693('0x72')](_0x5da670,function(_0x4d9153){return db['UserFaxQueue'][_0x3693('0x73')]({'where':{'UserId':_0x4d9153['id'],'FaxQueueId':_0x37f626[_0x3693('0x5b')]['id']},'transaction':_0x158b31});});})[_0x3693('0x2e')](function(){_0x5da670[_0x3693('0x74')](function(_0x241ddd){socket['emit'](_0x3693('0x75'),{'UserId':_0x241ddd['id'],'FaxQueueId':_0x283078['id']});});});});});}})['then'](respondWithStatusCode(_0x308d45,null))[_0x3693('0x52')](handleError(_0x308d45,null));};exports[_0x3693('0x76')]=function(_0x4fbd4d,_0x32866e,_0x1b4004){return db[_0x3693('0x6b')]['findAll']({'where':{'id':_0x4fbd4d['query'][_0x3693('0x6c')]},'attributes':['id'],'include':[{'model':db[_0x3693('0x6d')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x32866e,null))[_0x3693('0x2e')](function(_0x1a2686){var _0x1a93ee=_[_0x3693('0x37')](_0x1a2686,'id');var _0x2b4465=[];var _0xe2c492=[];var _0x382cb3=squel[_0x3693('0x77')]();_0x382cb3[_0x3693('0x78')]('tq.TeamId')['from']('team_has_fax_queues','tq')[_0x3693('0x79')](_0x3693('0x7a'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x3693('0x7b'),_0x4fbd4d[_0x3693('0x5b')]['id']);for(var _0x5de235=0x0;_0x5de235<_0x1a2686['length'];_0x5de235+=0x1){let _0x50ab39=_0x1a2686[_0x5de235];for(var _0x11c369=0x0;_0x11c369<_0x50ab39['Agents'][_0x3693('0x43')];_0x11c369+=0x1){let _0x2b2700=_0x50ab39[_0x3693('0x6e')][_0x11c369];var _0x31ec3c=_0x382cb3['clone']();_0x31ec3c['where'](_0x3693('0x7c'),_0x2b2700['id']);_0xe2c492[_0x3693('0x7d')](db[_0x3693('0x7e')][_0x3693('0x3e')](_0x31ec3c[_0x3693('0x7f')](),{'type':db[_0x3693('0x7e')][_0x3693('0x80')][_0x3693('0x81')]})[_0x3693('0x2e')](function(_0x2baea5){if(_0x2baea5[_0x3693('0x43')]===0x1){return _0x2b2700['id'];}else{var _0x5f5086=_['every'](_['map'](_0x2baea5,_0x3693('0x82')),function(_0x152877){return _[_0x3693('0x83')](_0x1a93ee,_0x152877);});if(_0x5f5086){return _0x2b2700['id'];}}}));}}return BPromise['all'](_0xe2c492)[_0x3693('0x2e')](function(_0x207988){_0x2b4465=_(_0x2b4465)['union'](_0x207988)['compact']()[_0x3693('0x84')]();return db['FaxQueue']['find']({'where':{'id':_0x4fbd4d[_0x3693('0x5b')]['id']}})[_0x3693('0x2e')](function(_0x4a6056){return db[_0x3693('0x7e')]['transaction'](function(_0x525075){return _0x4a6056[_0x3693('0x76')](_0x4fbd4d[_0x3693('0x3e')][_0x3693('0x6c')],{'transaction':_0x525075})[_0x3693('0x2e')](function(){if(!_['isEmpty'](_0x2b4465)){return _0x4a6056[_0x3693('0x85')](_0x2b4465,{'transaction':_0x525075});}})[_0x3693('0x2e')](function(){_0x2b4465[_0x3693('0x74')](function(_0x20ff33){socket[_0x3693('0x86')](_0x3693('0x87'),{'UserId':_0x20ff33,'FaxQueueId':_0x4a6056['id']});});});});});});})['then'](respondWithStatusCode(_0x32866e,null))[_0x3693('0x52')](handleError(_0x32866e,null));};exports['addAgents']=function(_0x2ec182,_0x1a99eb,_0x18e132){return db[_0x3693('0x38')][_0x3693('0x51')]({'where':{'id':_0x2ec182[_0x3693('0x5b')]['id']}})[_0x3693('0x2e')](handleEntityNotFound(_0x1a99eb,null))[_0x3693('0x2e')](function(_0x16770f){if(_0x16770f){return _0x16770f[_0x3693('0x88')](_0x2ec182[_0x3693('0x54')][_0x3693('0x6c')],_[_0x3693('0x89')](_0x2ec182['body'],['ids','id'])||{})[_0x3693('0x8a')](function(_0x3a2e1d){for(var _0x401c02=0x0;_0x401c02<_0x2ec182[_0x3693('0x54')][_0x3693('0x6c')][_0x3693('0x43')];_0x401c02+=0x1){socket[_0x3693('0x86')](_0x3693('0x75'),{'UserId':Number(_0x2ec182[_0x3693('0x54')]['ids'][_0x401c02]),'FaxQueueId':Number(_0x2ec182[_0x3693('0x5b')]['id'])});}return _0x3a2e1d;});}})[_0x3693('0x2e')](respondWithResult(_0x1a99eb,null))[_0x3693('0x52')](handleError(_0x1a99eb,null));};exports['removeAgents']=function(_0x395315,_0x5d30a8,_0x135d3f){return db['FaxQueue'][_0x3693('0x51')]({'where':{'id':_0x395315[_0x3693('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5d30a8,null))[_0x3693('0x2e')](function(_0x14e31d){if(_0x14e31d){return _0x14e31d['removeAgents'](_0x395315[_0x3693('0x3e')][_0x3693('0x6c')])['then'](function(){if(_[_0x3693('0x8b')](_0x395315[_0x3693('0x3e')][_0x3693('0x6c')])){for(var _0x2d0a3e=0x0;_0x2d0a3e<_0x395315['query'][_0x3693('0x6c')][_0x3693('0x43')];_0x2d0a3e+=0x1){socket[_0x3693('0x86')](_0x3693('0x87'),{'UserId':Number(_0x395315[_0x3693('0x3e')][_0x3693('0x6c')][_0x2d0a3e]),'FaxQueueId':Number(_0x395315[_0x3693('0x5b')]['id'])});}}else{socket[_0x3693('0x86')](_0x3693('0x87'),{'UserId':Number(_0x395315[_0x3693('0x3e')][_0x3693('0x6c')]),'FaxQueueId':Number(_0x395315[_0x3693('0x5b')]['id'])});}});}})[_0x3693('0x2e')](respondWithStatusCode(_0x5d30a8,null))[_0x3693('0x52')](handleError(_0x5d30a8,null));};exports[_0x3693('0x8c')]=function(_0x31df3b,_0x51aa9d,_0x2b7644){var _0x33bb61={};var _0x444b0d={};var _0x12574d;var _0x27158f;return db[_0x3693('0x38')][_0x3693('0x5e')]({'where':{'id':_0x31df3b[_0x3693('0x5b')]['id']}})[_0x3693('0x2e')](handleEntityNotFound(_0x51aa9d,null))['then'](function(_0x45ea50){if(_0x45ea50){_0x12574d=_0x45ea50;_0x444b0d[_0x3693('0x3d')]=_[_0x3693('0x3f')](db['User'][_0x3693('0x39')]);_0x444b0d[_0x3693('0x3e')]=_[_0x3693('0x3f')](_0x31df3b[_0x3693('0x3e')]);_0x444b0d['filters']=_[_0x3693('0x42')](_0x444b0d['model'],_0x444b0d[_0x3693('0x3e')]);_0x33bb61[_0x3693('0x41')]=_[_0x3693('0x42')](_0x444b0d[_0x3693('0x3d')],qs[_0x3693('0x50')](_0x31df3b[_0x3693('0x3e')][_0x3693('0x50')]));_0x33bb61[_0x3693('0x41')]=_0x33bb61['attributes']['length']?_0x33bb61['attributes']:_0x444b0d[_0x3693('0x3d')];_0x33bb61[_0x3693('0x46')]=qs[_0x3693('0x47')](_0x31df3b[_0x3693('0x3e')][_0x3693('0x47')]);_0x33bb61[_0x3693('0x48')]=qs[_0x3693('0x40')](_[_0x3693('0x5f')](_0x31df3b['query'],_0x444b0d[_0x3693('0x40')]));if(_0x31df3b['query'][_0x3693('0x49')]){_0x33bb61[_0x3693('0x48')]=_[_0x3693('0x4b')](_0x33bb61[_0x3693('0x48')],{'$or':_[_0x3693('0x37')](_0x33bb61[_0x3693('0x41')],function(_0x42d2cb){var _0x1b5430={};_0x1b5430[_0x42d2cb]={'$like':'%'+_0x31df3b[_0x3693('0x3e')][_0x3693('0x49')]+'%'};return _0x1b5430;})});}_0x33bb61=_[_0x3693('0x4b')]({},_0x33bb61,_0x31df3b[_0x3693('0x4c')]);return _0x12574d[_0x3693('0x8c')](_0x33bb61);}})['then'](function(_0x1ac139){if(_0x1ac139){_0x27158f=_0x1ac139[_0x3693('0x43')];if(!_0x31df3b[_0x3693('0x3e')][_0x3693('0x44')]('nolimit')){_0x33bb61[_0x3693('0x27')]=qs['limit'](_0x31df3b['query'][_0x3693('0x27')]);_0x33bb61['offset']=qs['offset'](_0x31df3b['query'][_0x3693('0x25')]);}return _0x12574d[_0x3693('0x8c')](_0x33bb61);}})[_0x3693('0x2e')](function(_0x36ebd5){if(_0x36ebd5){return _0x36ebd5?{'count':_0x27158f,'rows':_0x36ebd5}:null;}})[_0x3693('0x2e')](respondWithResult(_0x51aa9d,null))[_0x3693('0x52')](handleError(_0x51aa9d,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 70f1ee6..1518135 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 _0xab16=['hasOwnProperty','hook','exports','events','FaxQueue','save','update','remove','emit'];(function(_0x16795d,_0x483da3){var _0x4bca22=function(_0x7d9883){while(--_0x7d9883){_0x16795d['push'](_0x16795d['shift']());}};_0x4bca22(++_0x483da3);}(_0xab16,0x150));var _0x6ab1=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xab16[_0x4a9fb1];return _0x348672;};'use strict';var EventEmitter=require(_0x6ab1('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x6ab1('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6ab1('0x2'),'afterUpdate':_0x6ab1('0x3'),'afterDestroy':_0x6ab1('0x4')};function emitEvent(_0x2e910b){return function(_0x5025e8,_0xb6e325,_0x581c4a){FaxQueueEvents[_0x6ab1('0x5')](_0x2e910b+':'+_0x5025e8['id'],_0x5025e8);FaxQueueEvents[_0x6ab1('0x5')](_0x2e910b,_0x5025e8);_0x581c4a(null);};}for(var e in events){if(events[_0x6ab1('0x6')](e)){var event=events[e];FaxQueue[_0x6ab1('0x7')](e,emitEvent(event));}}module[_0x6ab1('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0xfb80=['FaxQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3380a3,_0x304761){var _0x4b7c8c=function(_0x434753){while(--_0x434753){_0x3380a3['push'](_0x3380a3['shift']());}};_0x4b7c8c(++_0x304761);}(_0xfb80,0x76));var _0x0fb8=function(_0x110a03,_0x473e90){_0x110a03=_0x110a03-0x0;var _0x4f738b=_0xfb80[_0x110a03];return _0x4f738b;};'use strict';var EventEmitter=require(_0x0fb8('0x0'));var FaxQueue=require(_0x0fb8('0x1'))['db'][_0x0fb8('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x0fb8('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0fb8('0x4'),'afterDestroy':_0x0fb8('0x5')};function emitEvent(_0x31d65d){return function(_0x63a48a,_0x3067ad,_0x5ccc01){FaxQueueEvents[_0x0fb8('0x6')](_0x31d65d+':'+_0x63a48a['id'],_0x63a48a);FaxQueueEvents[_0x0fb8('0x6')](_0x31d65d,_0x63a48a);_0x5ccc01(null);};}for(var e in events){if(events[_0x0fb8('0x7')](e)){var event=events[e];FaxQueue[_0x0fb8('0x8')](e,emitEvent(event));}}module[_0x0fb8('0x9')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index cf84fc0..eee405c 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 _0x78ba=['api','bluebird','request-promise','path','rimraf','../../config/environment','exports','fax_queues','lodash','util'];(function(_0x5486b7,_0x4be4d0){var _0x305ebe=function(_0x3d8e6c){while(--_0x3d8e6c){_0x5486b7['push'](_0x5486b7['shift']());}};_0x305ebe(++_0x4be4d0);}(_0x78ba,0x134));var _0xa78b=function(_0x409fd7,_0x489598){_0x409fd7=_0x409fd7-0x0;var _0x192065=_0x78ba[_0x409fd7];return _0x192065;};'use strict';var _=require(_0xa78b('0x0'));var util=require(_0xa78b('0x1'));var logger=require('../../config/logger')(_0xa78b('0x2'));var moment=require('moment');var BPromise=require(_0xa78b('0x3'));var rp=require(_0xa78b('0x4'));var fs=require('fs');var path=require(_0xa78b('0x5'));var rimraf=require(_0xa78b('0x6'));var config=require(_0xa78b('0x7'));var attributes=require('./faxQueue.attributes');module[_0xa78b('0x8')]=function(_0x593e1d,_0x6d0800){return _0x593e1d['define']('FaxQueue',attributes,{'tableName':_0xa78b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0439=['exports','FaxQueue','fax_queues','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./faxQueue.attributes'];(function(_0x1c5a72,_0x5cca8e){var _0x476e91=function(_0x1785d3){while(--_0x1785d3){_0x1c5a72['push'](_0x1c5a72['shift']());}};_0x476e91(++_0x5cca8e);}(_0x0439,0x7c));var _0x9043=function(_0x562071,_0x57a342){_0x562071=_0x562071-0x0;var _0x45db81=_0x0439[_0x562071];return _0x45db81;};'use strict';var _=require('lodash');var util=require(_0x9043('0x0'));var logger=require(_0x9043('0x1'))(_0x9043('0x2'));var moment=require('moment');var BPromise=require(_0x9043('0x3'));var rp=require(_0x9043('0x4'));var fs=require('fs');var path=require(_0x9043('0x5'));var rimraf=require(_0x9043('0x6'));var config=require('../../config/environment');var attributes=require(_0x9043('0x7'));module[_0x9043('0x8')]=function(_0x1df801,_0x25ca86){return _0x1df801['define'](_0x9043('0x9'),attributes,{'tableName':_0x9043('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index e6efbfd..011147b 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 _0x1857=['lodash','util','moment','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','request','request\x20sent','debug','stringify','error','message','FaxQueue,\x20%s,\x20%s','info','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowFaxQueue'];(function(_0x197d9a,_0x9c38c4){var _0x1b4b1b=function(_0x46840c){while(--_0x46840c){_0x197d9a['push'](_0x197d9a['shift']());}};_0x1b4b1b(++_0x9c38c4);}(_0x1857,0xd8));var _0x7185=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1857[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x7185('0x0'));var util=require(_0x7185('0x1'));var moment=require(_0x7185('0x2'));var BPromise=require(_0x7185('0x3'));var rs=require(_0x7185('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7185('0x5'));var config=require(_0x7185('0x6'));var jayson=require(_0x7185('0x7'));var client=jayson[_0x7185('0x8')][_0x7185('0x9')]({'port':0x232a});config[_0x7185('0xa')]=_['defaults'](config[_0x7185('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x7185('0xb'))(new Redis(config[_0x7185('0xa')]));require('./faxQueue.socket')[_0x7185('0xc')](socket);function respondWithRpcPromise(_0x30117d,_0x62b9dd,_0x237313){return new BPromise(function(_0x2fd09b,_0xadf9bb){return client[_0x7185('0xd')](_0x30117d,_0x237313)['then'](function(_0x423288){logger['info']('FaxQueue,\x20%s,\x20%s',_0x62b9dd,_0x7185('0xe'));logger[_0x7185('0xf')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x62b9dd,_0x7185('0xe'),JSON[_0x7185('0x10')](_0x423288));if(_0x423288['error']){if(_0x423288[_0x7185('0x11')]['code']===0x1f4){logger['error']('FaxQueue,\x20%s,\x20%s',_0x62b9dd,_0x423288[_0x7185('0x11')][_0x7185('0x12')]);return _0xadf9bb(_0x423288[_0x7185('0x11')]['message']);}logger['error'](_0x7185('0x13'),_0x62b9dd,_0x423288['error'][_0x7185('0x12')]);return _0x2fd09b(_0x423288[_0x7185('0x11')]['message']);}else{logger[_0x7185('0x14')](_0x7185('0x13'),_0x62b9dd,_0x7185('0xe'));_0x2fd09b(_0x423288[_0x7185('0x15')][_0x7185('0x12')]);}})[_0x7185('0x16')](function(_0xc74ea5){logger[_0x7185('0x11')](_0x7185('0x13'),_0x62b9dd,_0xc74ea5);_0xadf9bb(_0xc74ea5);});});}exports[_0x7185('0x17')]=function(_0x384839){var _0x102038=this;return new Promise(function(_0x351203,_0x21e92f){return db[_0x7185('0x18')][_0x7185('0x19')]({'raw':_0x384839['options']?_0x384839[_0x7185('0x1a')][_0x7185('0x1b')]===undefined?!![]:![]:!![],'where':_0x384839['options']?_0x384839['options'][_0x7185('0x1c')]||null:null,'attributes':_0x384839['options']?_0x384839['options'][_0x7185('0x1d')]||null:null,'limit':_0x384839['options']?_0x384839[_0x7185('0x1a')][_0x7185('0x1e')]||null:null,'include':_0x384839[_0x7185('0x1a')]?_0x384839[_0x7185('0x1a')][_0x7185('0x1f')]?_[_0x7185('0x20')](_0x384839[_0x7185('0x1a')][_0x7185('0x1f')],function(_0x1b2c73){return{'model':db[_0x1b2c73[_0x7185('0x21')]],'as':_0x1b2c73['as'],'attributes':_0x1b2c73[_0x7185('0x1d')],'include':_0x1b2c73[_0x7185('0x1f')]?_['map'](_0x1b2c73[_0x7185('0x1f')],function(_0x4c878b){return{'model':db[_0x4c878b['model']],'as':_0x4c878b['as'],'attributes':_0x4c878b[_0x7185('0x1d')],'include':_0x4c878b[_0x7185('0x1f')]?_[_0x7185('0x20')](_0x4c878b[_0x7185('0x1f')],function(_0x2e7e88){return{'model':db[_0x2e7e88[_0x7185('0x21')]],'as':_0x2e7e88['as'],'attributes':_0x2e7e88['attributes']};}):[]};}):[]};}):[]:[]})[_0x7185('0x22')](function(_0x25f017){logger[_0x7185('0x14')](_0x7185('0x17'),_0x384839);logger[_0x7185('0xf')](_0x7185('0x17'),_0x384839,JSON[_0x7185('0x10')](_0x25f017));_0x351203(_0x25f017);})[_0x7185('0x16')](function(_0x488b2a){logger[_0x7185('0x11')](_0x7185('0x17'),_0x488b2a[_0x7185('0x12')],_0x384839);_0x21e92f(_0x102038['error'](0x1f4,_0x488b2a[_0x7185('0x12')]));});});};exports[_0x7185('0x23')]=function(_0x3c7113){var _0x399943=this;return new Promise(function(_0x3143da,_0x49daec){return db[_0x7185('0x18')]['find']({'raw':_0x3c7113[_0x7185('0x1a')]?_0x3c7113[_0x7185('0x1a')][_0x7185('0x1b')]===undefined?!![]:![]:!![],'where':_0x3c7113[_0x7185('0x1a')]?_0x3c7113[_0x7185('0x1a')]['where']||null:null,'attributes':_0x3c7113[_0x7185('0x1a')]?_0x3c7113['options']['attributes']||null:null,'include':_0x3c7113[_0x7185('0x1a')]?_0x3c7113['options'][_0x7185('0x1f')]?_[_0x7185('0x20')](_0x3c7113[_0x7185('0x1a')][_0x7185('0x1f')],function(_0x222333){return{'model':db[_0x222333[_0x7185('0x21')]],'as':_0x222333['as'],'attributes':_0x222333[_0x7185('0x1d')],'include':_0x222333['include']?_[_0x7185('0x20')](_0x222333[_0x7185('0x1f')],function(_0x5a90df){return{'model':db[_0x5a90df[_0x7185('0x21')]],'as':_0x5a90df['as'],'attributes':_0x5a90df['attributes'],'include':_0x5a90df[_0x7185('0x1f')]?_['map'](_0x5a90df[_0x7185('0x1f')],function(_0x5549c7){return{'model':db[_0x5549c7[_0x7185('0x21')]],'as':_0x5549c7['as'],'attributes':_0x5549c7[_0x7185('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7185('0x22')](function(_0xd92ab0){logger[_0x7185('0x14')](_0x7185('0x23'),_0x3c7113);logger[_0x7185('0xf')](_0x7185('0x23'),_0x3c7113,JSON[_0x7185('0x10')](_0xd92ab0));_0x3143da(_0xd92ab0);})[_0x7185('0x16')](function(_0x1a2a54){logger[_0x7185('0x11')]('ShowFaxQueue',_0x1a2a54[_0x7185('0x12')],_0x3c7113);_0x49daec(_0x399943['error'](0x1f4,_0x1a2a54['message']));});});}; \ No newline at end of file +var _0x97f8=['../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','FaxQueue,\x20%s,\x20%s','error','message','result','GetFaxQueue','FaxQueue','findAll','options','raw','where','limit','map','include','model','attributes','stringify','catch','ShowFaxQueue','find','lodash','util','bluebird','randomstring','../../config/utils'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x97f8,0x9f));var _0x897f=function(_0x2df1c1,_0x360e2f){_0x2df1c1=_0x2df1c1-0x0;var _0x4e20d5=_0x97f8[_0x2df1c1];return _0x4e20d5;};'use strict';var _=require(_0x897f('0x0'));var util=require(_0x897f('0x1'));var moment=require('moment');var BPromise=require(_0x897f('0x2'));var rs=require(_0x897f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x897f('0x4'));var logger=require(_0x897f('0x5'))(_0x897f('0x6'));var config=require('../../config/environment');var jayson=require(_0x897f('0x7'));var client=jayson[_0x897f('0x8')][_0x897f('0x9')]({'port':0x232a});config['redis']=_[_0x897f('0xa')](config[_0x897f('0xb')],{'host':_0x897f('0xc'),'port':0x18eb});var socket=require(_0x897f('0xd'))(new Redis(config[_0x897f('0xb')]));require(_0x897f('0xe'))[_0x897f('0xf')](socket);function respondWithRpcPromise(_0x3c932d,_0x2f5b97,_0x219089){return new BPromise(function(_0x321b93,_0xd302d6){return client[_0x897f('0x10')](_0x3c932d,_0x219089)[_0x897f('0x11')](function(_0x4c6fcc){logger[_0x897f('0x12')]('FaxQueue,\x20%s,\x20%s',_0x2f5b97,_0x897f('0x13'));logger[_0x897f('0x14')](_0x897f('0x15'),_0x2f5b97,_0x897f('0x13'),JSON['stringify'](_0x4c6fcc));if(_0x4c6fcc['error']){if(_0x4c6fcc['error']['code']===0x1f4){logger['error'](_0x897f('0x16'),_0x2f5b97,_0x4c6fcc[_0x897f('0x17')][_0x897f('0x18')]);return _0xd302d6(_0x4c6fcc[_0x897f('0x17')][_0x897f('0x18')]);}logger[_0x897f('0x17')](_0x897f('0x16'),_0x2f5b97,_0x4c6fcc[_0x897f('0x17')][_0x897f('0x18')]);return _0x321b93(_0x4c6fcc['error'][_0x897f('0x18')]);}else{logger[_0x897f('0x12')]('FaxQueue,\x20%s,\x20%s',_0x2f5b97,_0x897f('0x13'));_0x321b93(_0x4c6fcc[_0x897f('0x19')]['message']);}})['catch'](function(_0x11e8ad){logger['error'](_0x897f('0x16'),_0x2f5b97,_0x11e8ad);_0xd302d6(_0x11e8ad);});});}exports[_0x897f('0x1a')]=function(_0x31b287){var _0x260937=this;return new Promise(function(_0x4322b7,_0xc1f27f){return db[_0x897f('0x1b')][_0x897f('0x1c')]({'raw':_0x31b287[_0x897f('0x1d')]?_0x31b287[_0x897f('0x1d')][_0x897f('0x1e')]===undefined?!![]:![]:!![],'where':_0x31b287[_0x897f('0x1d')]?_0x31b287[_0x897f('0x1d')][_0x897f('0x1f')]||null:null,'attributes':_0x31b287[_0x897f('0x1d')]?_0x31b287[_0x897f('0x1d')]['attributes']||null:null,'limit':_0x31b287['options']?_0x31b287['options'][_0x897f('0x20')]||null:null,'include':_0x31b287[_0x897f('0x1d')]?_0x31b287[_0x897f('0x1d')]['include']?_[_0x897f('0x21')](_0x31b287[_0x897f('0x1d')][_0x897f('0x22')],function(_0x1f5f8b){return{'model':db[_0x1f5f8b[_0x897f('0x23')]],'as':_0x1f5f8b['as'],'attributes':_0x1f5f8b[_0x897f('0x24')],'include':_0x1f5f8b[_0x897f('0x22')]?_[_0x897f('0x21')](_0x1f5f8b[_0x897f('0x22')],function(_0x907cdf){return{'model':db[_0x907cdf['model']],'as':_0x907cdf['as'],'attributes':_0x907cdf['attributes'],'include':_0x907cdf[_0x897f('0x22')]?_[_0x897f('0x21')](_0x907cdf[_0x897f('0x22')],function(_0xc52e24){return{'model':db[_0xc52e24['model']],'as':_0xc52e24['as'],'attributes':_0xc52e24[_0x897f('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x175de1){logger[_0x897f('0x12')](_0x897f('0x1a'),_0x31b287);logger[_0x897f('0x14')](_0x897f('0x1a'),_0x31b287,JSON[_0x897f('0x25')](_0x175de1));_0x4322b7(_0x175de1);})[_0x897f('0x26')](function(_0x5054a1){logger[_0x897f('0x17')](_0x897f('0x1a'),_0x5054a1['message'],_0x31b287);_0xc1f27f(_0x260937['error'](0x1f4,_0x5054a1['message']));});});};exports[_0x897f('0x27')]=function(_0x113ebd){var _0x2f8bc0=this;return new Promise(function(_0x24a4c6,_0x4e9fdd){return db[_0x897f('0x1b')][_0x897f('0x28')]({'raw':_0x113ebd[_0x897f('0x1d')]?_0x113ebd[_0x897f('0x1d')][_0x897f('0x1e')]===undefined?!![]:![]:!![],'where':_0x113ebd[_0x897f('0x1d')]?_0x113ebd['options'][_0x897f('0x1f')]||null:null,'attributes':_0x113ebd[_0x897f('0x1d')]?_0x113ebd[_0x897f('0x1d')][_0x897f('0x24')]||null:null,'include':_0x113ebd[_0x897f('0x1d')]?_0x113ebd[_0x897f('0x1d')]['include']?_[_0x897f('0x21')](_0x113ebd[_0x897f('0x1d')]['include'],function(_0x231cb1){return{'model':db[_0x231cb1[_0x897f('0x23')]],'as':_0x231cb1['as'],'attributes':_0x231cb1[_0x897f('0x24')],'include':_0x231cb1[_0x897f('0x22')]?_['map'](_0x231cb1[_0x897f('0x22')],function(_0x120530){return{'model':db[_0x120530[_0x897f('0x23')]],'as':_0x120530['as'],'attributes':_0x120530[_0x897f('0x24')],'include':_0x120530[_0x897f('0x22')]?_[_0x897f('0x21')](_0x120530[_0x897f('0x22')],function(_0x53beb6){return{'model':db[_0x53beb6[_0x897f('0x23')]],'as':_0x53beb6['as'],'attributes':_0x53beb6[_0x897f('0x24')]};}):[]};}):[]};}):[]:[]})[_0x897f('0x11')](function(_0x4b2368){logger['info']('ShowFaxQueue',_0x113ebd);logger['debug'](_0x897f('0x27'),_0x113ebd,JSON['stringify'](_0x4b2368));_0x24a4c6(_0x4b2368);})[_0x897f('0x26')](function(_0x443c74){logger[_0x897f('0x17')](_0x897f('0x27'),_0x443c74[_0x897f('0x18')],_0x113ebd);_0x4e9fdd(_0x2f8bc0[_0x897f('0x17')](0x1f4,_0x443c74[_0x897f('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 6efcc0f..9fc4e3f 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 _0xdb37=['update','emit','removeListener','register','length','faxQueue:','save','remove'];(function(_0x36909d,_0x2795f1){var _0x1fd29d=function(_0x27d0fa){while(--_0x27d0fa){_0x36909d['push'](_0x36909d['shift']());}};_0x1fd29d(++_0x2795f1);}(_0xdb37,0x9e));var _0x7db3=function(_0x495a82,_0x3afb8c){_0x495a82=_0x495a82-0x0;var _0xdf018a=_0xdb37[_0x495a82];return _0xdf018a;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x7db3('0x0'),_0x7db3('0x1'),_0x7db3('0x2')];function createListener(_0x568de3,_0x492e58){return function(_0x327ce7){_0x492e58[_0x7db3('0x3')](_0x568de3,_0x327ce7);};}function removeListener(_0x170e3c,_0x40f160){return function(){FaxQueueEvents[_0x7db3('0x4')](_0x170e3c,_0x40f160);};}exports[_0x7db3('0x5')]=function(_0x3f70a0){for(var _0x391135=0x0,_0x354d5e=events[_0x7db3('0x6')];_0x391135<_0x354d5e;_0x391135++){var _0xf23570=events[_0x391135];var _0x10f723=createListener(_0x7db3('0x7')+_0xf23570,_0x3f70a0);FaxQueueEvents['on'](_0xf23570,_0x10f723);}}; \ No newline at end of file +var _0x1d07=['remove','update','removeListener','register','length','faxQueue:','./faxQueue.events','save'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x1d07,0x1e6));var _0x71d0=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x1d07[_0x346737];return _0x1ade2e;};'use strict';var FaxQueueEvents=require(_0x71d0('0x0'));var events=[_0x71d0('0x1'),_0x71d0('0x2'),_0x71d0('0x3')];function createListener(_0xabf7eb,_0x4276da){return function(_0x7ae145){_0x4276da['emit'](_0xabf7eb,_0x7ae145);};}function removeListener(_0x4e423c,_0x2bfcbc){return function(){FaxQueueEvents[_0x71d0('0x4')](_0x4e423c,_0x2bfcbc);};}exports[_0x71d0('0x5')]=function(_0x26b1b3){for(var _0xcd6c1e=0x0,_0x1f31cc=events[_0x71d0('0x6')];_0xcd6c1e<_0x1f31cc;_0xcd6c1e++){var _0x4a9f1a=events[_0xcd6c1e];var _0x360310=createListener(_0x71d0('0x7')+_0x4a9f1a,_0x26b1b3);FaxQueueEvents['on'](_0x4a9f1a,_0x360310);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 5cf29bb..51042e3 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 _0x8085=['Router','fs-extra','../../config/environment','./faxQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents','put','update','destroy','delete','removeTeams','removeAgents','multer','connect-timeout','express'];(function(_0xd6a258,_0x5c32cf){var _0xc6e348=function(_0x3a923a){while(--_0x3a923a){_0xd6a258['push'](_0xd6a258['shift']());}};_0xc6e348(++_0x5c32cf);}(_0x8085,0x71));var _0x5808=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x8085[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0x5808('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5808('0x1'));var express=require(_0x5808('0x2'));var router=express[_0x5808('0x3')]();var fs_extra=require(_0x5808('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5808('0x5'));var controller=require(_0x5808('0x6'));router['get']('/',auth[_0x5808('0x7')](),controller[_0x5808('0x8')]);router[_0x5808('0x9')](_0x5808('0xa'),auth[_0x5808('0x7')](),controller[_0x5808('0xb')]);router[_0x5808('0x9')](_0x5808('0xc'),auth[_0x5808('0x7')](),controller[_0x5808('0xd')]);router[_0x5808('0x9')](_0x5808('0xe'),auth[_0x5808('0x7')](),controller[_0x5808('0xf')]);router[_0x5808('0x9')]('/:id/teams',auth['isAuthenticated'](),controller[_0x5808('0x10')]);router[_0x5808('0x9')](_0x5808('0x11'),auth[_0x5808('0x7')](),controller[_0x5808('0x12')]);router[_0x5808('0x13')]('/',auth[_0x5808('0x7')](),controller['create']);router['post'](_0x5808('0x14'),auth[_0x5808('0x7')](),controller[_0x5808('0x15')]);router[_0x5808('0x13')](_0x5808('0x11'),auth[_0x5808('0x7')](),controller[_0x5808('0x16')]);router[_0x5808('0x17')](_0x5808('0xc'),auth[_0x5808('0x7')](),controller[_0x5808('0x18')]);router['delete'](_0x5808('0xc'),auth['isAuthenticated'](),controller[_0x5808('0x19')]);router[_0x5808('0x1a')](_0x5808('0x14'),auth['isAuthenticated'](),controller[_0x5808('0x1b')]);router[_0x5808('0x1a')]('/:id/users',auth['isAuthenticated'](),controller[_0x5808('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x323f=['getTeams','getAgents','post','create','addTeams','addAgents','put','update','destroy','delete','removeTeams','/:id/users','removeAgents','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x323f,0x1ee));var _0xf323=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x323f[_0x5c351c];return _0x26f3b3;};'use strict';var multer=require('multer');var util=require(_0xf323('0x0'));var path=require('path');var timeout=require(_0xf323('0x1'));var express=require(_0xf323('0x2'));var router=express[_0xf323('0x3')]();var fs_extra=require(_0xf323('0x4'));var auth=require(_0xf323('0x5'));var interaction=require(_0xf323('0x6'));var config=require(_0xf323('0x7'));var controller=require(_0xf323('0x8'));router[_0xf323('0x9')]('/',auth[_0xf323('0xa')](),controller['index']);router[_0xf323('0x9')](_0xf323('0xb'),auth[_0xf323('0xa')](),controller[_0xf323('0xc')]);router[_0xf323('0x9')](_0xf323('0xd'),auth[_0xf323('0xa')](),controller[_0xf323('0xe')]);router[_0xf323('0x9')](_0xf323('0xf'),auth[_0xf323('0xa')](),controller[_0xf323('0x10')]);router[_0xf323('0x9')](_0xf323('0x11'),auth[_0xf323('0xa')](),controller[_0xf323('0x12')]);router[_0xf323('0x9')]('/:id/users',auth[_0xf323('0xa')](),controller[_0xf323('0x13')]);router[_0xf323('0x14')]('/',auth['isAuthenticated'](),controller[_0xf323('0x15')]);router[_0xf323('0x14')](_0xf323('0x11'),auth[_0xf323('0xa')](),controller[_0xf323('0x16')]);router[_0xf323('0x14')]('/:id/users',auth['isAuthenticated'](),controller[_0xf323('0x17')]);router[_0xf323('0x18')](_0xf323('0xd'),auth[_0xf323('0xa')](),controller[_0xf323('0x19')]);router['delete'](_0xf323('0xd'),auth[_0xf323('0xa')](),controller[_0xf323('0x1a')]);router[_0xf323('0x1b')]('/:id/teams',auth[_0xf323('0xa')](),controller[_0xf323('0x1c')]);router[_0xf323('0x1b')](_0xf323('0x1d'),auth['isAuthenticated'](),controller[_0xf323('0x1e')]);module[_0xf323('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 c3ea136..508d2aa 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 _0x262f=['STRING','DATE','moment','sequelize'];(function(_0x18e2dd,_0x2ee742){var _0x58d661=function(_0x5b3869){while(--_0x5b3869){_0x18e2dd['push'](_0x18e2dd['shift']());}};_0x58d661(++_0x2ee742);}(_0x262f,0xb6));var _0xf262=function(_0x395ad4,_0x30d99e){_0x395ad4=_0x395ad4-0x0;var _0x40e057=_0x262f[_0x395ad4];return _0x40e057;};'use strict';var moment=require(_0xf262('0x0'));var Sequelize=require(_0xf262('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xf262('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xf262('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xf262('0x3')]},'exitAt':{'type':Sequelize[_0xf262('0x3')]},'reason':{'type':Sequelize[_0xf262('0x2')]}}; \ No newline at end of file +var _0xb219=['DATE','moment','sequelize','exports','STRING'];(function(_0x5e172a,_0x16c139){var _0x4444ac=function(_0xd6b107){while(--_0xd6b107){_0x5e172a['push'](_0x5e172a['shift']());}};_0x4444ac(++_0x16c139);}(_0xb219,0xe2));var _0x9b21=function(_0x43bfce,_0x4c8bd1){_0x43bfce=_0x43bfce-0x0;var _0x4f9c55=_0xb219[_0x43bfce];return _0x4f9c55;};'use strict';var moment=require(_0x9b21('0x0'));var Sequelize=require(_0x9b21('0x1'));module[_0x9b21('0x2')]={'uniqueid':{'type':Sequelize[_0x9b21('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x9b21('0x3')]},'joinAt':{'type':Sequelize[_0x9b21('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x9b21('0x4')]},'reason':{'type':Sequelize[_0x9b21('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 80221cd..99ea805 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 _0xe14d=['hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0xe14d,0x1ee));var _0xde14=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xe14d[_0x5608a3];return _0x1ed50a;};'use strict';var emlformat=require(_0xde14('0x0'));var rimraf=require(_0xde14('0x1'));var zipdir=require(_0xde14('0x2'));var jsonpatch=require(_0xde14('0x3'));var rp=require('request-promise');var moment=require(_0xde14('0x4'));var BPromise=require(_0xde14('0x5'));var Mustache=require('mustache');var util=require(_0xde14('0x6'));var path=require(_0xde14('0x7'));var sox=require(_0xde14('0x8'));var csv=require(_0xde14('0x9'));var ejs=require(_0xde14('0xa'));var fs=require('fs');var fs_extra=require(_0xde14('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xde14('0xc'));var jsforce=require(_0xde14('0xd'));var deskjs=require(_0xde14('0xe'));var toCsv=require(_0xde14('0x9'));var querystring=require(_0xde14('0xf'));var Papa=require(_0xde14('0x10'));var Redis=require(_0xde14('0x11'));var authService=require(_0xde14('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xde14('0x13'));var hardwareService=require(_0xde14('0x14'));var logger=require(_0xde14('0x15'))(_0xde14('0x16'));var utils=require(_0xde14('0x17'));var config=require(_0xde14('0x18'));var licenseUtil=require(_0xde14('0x19'));var db=require(_0xde14('0x1a'))['db'];function respondWithStatusCode(_0x34e28f,_0x29e3ca){_0x29e3ca=_0x29e3ca||0xcc;return function(_0x105f96){if(_0x105f96){return _0x34e28f[_0xde14('0x1b')](_0x29e3ca);}return _0x34e28f[_0xde14('0x1c')](_0x29e3ca)[_0xde14('0x1d')]();};}function respondWithResult(_0x1489e9,_0x54c58b){_0x54c58b=_0x54c58b||0xc8;return function(_0x584959){if(_0x584959){return _0x1489e9[_0xde14('0x1c')](_0x54c58b)[_0xde14('0x1e')](_0x584959);}};}function respondWithFilteredResult(_0x26c1ec,_0x4c86ff){return function(_0x16aa55){if(_0x16aa55){var _0x31adb3=typeof _0x4c86ff[_0xde14('0x1f')]===_0xde14('0x20')&&typeof _0x4c86ff[_0xde14('0x21')]===_0xde14('0x20');var _0x29e243=_0x16aa55[_0xde14('0x22')];var _0x3cc317=_0x31adb3?0x0:_0x4c86ff[_0xde14('0x1f')];var _0x590a8b=_0x31adb3?_0x16aa55[_0xde14('0x22')]:_0x4c86ff[_0xde14('0x1f')]+_0x4c86ff[_0xde14('0x21')];var _0x44ce4c;if(_0x590a8b>=_0x29e243){_0x590a8b=_0x29e243;_0x44ce4c=0xc8;}else{_0x44ce4c=0xce;}_0x26c1ec['status'](_0x44ce4c);return _0x26c1ec[_0xde14('0x23')]('Content-Range',_0x3cc317+'-'+_0x590a8b+'/'+_0x29e243)[_0xde14('0x1e')](_0x16aa55);}return null;};}function patchUpdates(_0x4c24a8){return function(_0xa50687){try{jsonpatch[_0xde14('0x24')](_0xa50687,_0x4c24a8,!![]);}catch(_0x51ee8d){return BPromise[_0xde14('0x25')](_0x51ee8d);}return _0xa50687[_0xde14('0x26')]();};}function saveUpdates(_0x11a4d9,_0x40b648){return function(_0x2dd9e7){if(_0x2dd9e7){return _0x2dd9e7[_0xde14('0x27')](_0x11a4d9)[_0xde14('0x28')](function(_0x475f2f){return _0x475f2f;});}return null;};}function removeEntity(_0xbaa078,_0x8f8033){return function(_0x5ae4c1){if(_0x5ae4c1){return _0x5ae4c1[_0xde14('0x29')]()[_0xde14('0x28')](function(){_0xbaa078[_0xde14('0x1c')](0xcc)[_0xde14('0x1d')]();});}};}function handleEntityNotFound(_0x1bb7be,_0x21ef15){return function(_0x310d75){if(!_0x310d75){_0x1bb7be[_0xde14('0x1b')](0x194);}return _0x310d75;};}function handleError(_0x1618e1,_0x350a78){_0x350a78=_0x350a78||0x1f4;return function(_0x4eff65){logger[_0xde14('0x2a')](_0x4eff65[_0xde14('0x2b')]);if(_0x4eff65[_0xde14('0x2c')]){delete _0x4eff65[_0xde14('0x2c')];}_0x1618e1['status'](_0x350a78)[_0xde14('0x2d')](_0x4eff65);};}exports[_0xde14('0x2e')]=function(_0x30c4a8,_0x553cab){var _0x4655fb={},_0x582537={},_0x2760f9={'count':0x0,'rows':[]};var _0x361b2c=_[_0xde14('0x2f')](db[_0xde14('0x30')][_0xde14('0x31')],function(_0x237d3f){return{'name':_0x237d3f[_0xde14('0x32')],'type':_0x237d3f[_0xde14('0x33')]['key']};});_0x582537[_0xde14('0x34')]=_[_0xde14('0x2f')](_0x361b2c,'name');_0x582537[_0xde14('0x35')]=_['keys'](_0x30c4a8[_0xde14('0x35')]);_0x582537[_0xde14('0x36')]=_[_0xde14('0x37')](_0x582537[_0xde14('0x34')],_0x582537[_0xde14('0x35')]);_0x4655fb['attributes']=_[_0xde14('0x37')](_0x582537[_0xde14('0x34')],qs['fields'](_0x30c4a8[_0xde14('0x35')][_0xde14('0x38')]));_0x4655fb[_0xde14('0x39')]=_0x4655fb[_0xde14('0x39')][_0xde14('0x3a')]?_0x4655fb[_0xde14('0x39')]:_0x582537[_0xde14('0x34')];if(!_0x30c4a8[_0xde14('0x35')][_0xde14('0x3b')]('nolimit')){_0x4655fb['limit']=qs[_0xde14('0x21')](_0x30c4a8[_0xde14('0x35')][_0xde14('0x21')]);_0x4655fb[_0xde14('0x1f')]=qs[_0xde14('0x1f')](_0x30c4a8[_0xde14('0x35')][_0xde14('0x1f')]);}_0x4655fb[_0xde14('0x3c')]=qs[_0xde14('0x3d')](_0x30c4a8['query'][_0xde14('0x3d')]);_0x4655fb['where']=qs['filters'](_['pick'](_0x30c4a8[_0xde14('0x35')],_0x582537[_0xde14('0x36')]),_0x361b2c);if(_0x30c4a8[_0xde14('0x35')][_0xde14('0x3e')]){_0x4655fb[_0xde14('0x3f')]=_[_0xde14('0x40')](_0x4655fb[_0xde14('0x3f')],{'$or':_[_0xde14('0x2f')](_0x361b2c,function(_0x5df6b3){if(_0x5df6b3[_0xde14('0x33')]!==_0xde14('0x41')){var _0x3864ff={};_0x3864ff[_0x5df6b3[_0xde14('0x2c')]]={'$like':'%'+_0x30c4a8[_0xde14('0x35')][_0xde14('0x3e')]+'%'};return _0x3864ff;}})});}_0x4655fb=_[_0xde14('0x40')]({},_0x4655fb,_0x30c4a8[_0xde14('0x42')]);var _0x50db0d={'where':_0x4655fb[_0xde14('0x3f')]};return db[_0xde14('0x30')][_0xde14('0x22')](_0x50db0d)[_0xde14('0x28')](function(_0x4f7141){_0x2760f9['count']=_0x4f7141;if(_0x30c4a8[_0xde14('0x35')][_0xde14('0x43')]){_0x4655fb[_0xde14('0x44')]=[{'all':!![]}];}return db[_0xde14('0x30')][_0xde14('0x45')](_0x4655fb);})['then'](function(_0x24b02c){_0x2760f9[_0xde14('0x46')]=_0x24b02c;return _0x2760f9;})[_0xde14('0x28')](respondWithFilteredResult(_0x553cab,_0x4655fb))['catch'](handleError(_0x553cab,null));};exports[_0xde14('0x47')]=function(_0x571c2c,_0x46ac22){var _0x51ace9={'raw':!![],'where':{'id':_0x571c2c[_0xde14('0x48')]['id']}},_0x102770={};_0x102770[_0xde14('0x34')]=_[_0xde14('0x49')](db[_0xde14('0x30')][_0xde14('0x31')]);_0x102770[_0xde14('0x35')]=_[_0xde14('0x49')](_0x571c2c['query']);_0x102770[_0xde14('0x36')]=_['intersection'](_0x102770[_0xde14('0x34')],_0x102770['query']);_0x51ace9[_0xde14('0x39')]=_[_0xde14('0x37')](_0x102770[_0xde14('0x34')],qs[_0xde14('0x38')](_0x571c2c[_0xde14('0x35')][_0xde14('0x38')]));_0x51ace9[_0xde14('0x39')]=_0x51ace9[_0xde14('0x39')]['length']?_0x51ace9[_0xde14('0x39')]:_0x102770[_0xde14('0x34')];if(_0x571c2c[_0xde14('0x35')][_0xde14('0x43')]){_0x51ace9['include']=[{'all':!![]}];}_0x51ace9=_[_0xde14('0x40')]({},_0x51ace9,_0x571c2c[_0xde14('0x42')]);return db[_0xde14('0x30')][_0xde14('0x4a')](_0x51ace9)[_0xde14('0x28')](handleEntityNotFound(_0x46ac22,null))[_0xde14('0x28')](respondWithResult(_0x46ac22,null))['catch'](handleError(_0x46ac22,null));};exports[_0xde14('0x4b')]=function(_0x518426,_0xa408ec){return db[_0xde14('0x30')]['create'](_0x518426[_0xde14('0x4c')],{})[_0xde14('0x28')](respondWithResult(_0xa408ec,0xc9))[_0xde14('0x4d')](handleError(_0xa408ec,null));};exports[_0xde14('0x27')]=function(_0x2d05c7,_0x1c87e1){if(_0x2d05c7[_0xde14('0x4c')]['id']){delete _0x2d05c7['body']['id'];}return db[_0xde14('0x30')]['find']({'where':{'id':_0x2d05c7[_0xde14('0x48')]['id']}})[_0xde14('0x28')](handleEntityNotFound(_0x1c87e1,null))[_0xde14('0x28')](saveUpdates(_0x2d05c7[_0xde14('0x4c')],null))[_0xde14('0x28')](respondWithResult(_0x1c87e1,null))[_0xde14('0x4d')](handleError(_0x1c87e1,null));};exports[_0xde14('0x29')]=function(_0x1f7316,_0x3495d1){return db[_0xde14('0x30')]['find']({'where':{'id':_0x1f7316[_0xde14('0x48')]['id']}})[_0xde14('0x28')](handleEntityNotFound(_0x3495d1,null))[_0xde14('0x28')](removeEntity(_0x3495d1,null))[_0xde14('0x4d')](handleError(_0x3495d1,null));};exports[_0xde14('0x4e')]=function(_0x4874ed,_0x3a0e32){return db['FaxQueueReport'][_0xde14('0x4e')]()[_0xde14('0x28')](respondWithResult(_0x3a0e32,null))[_0xde14('0x4d')](handleError(_0x3a0e32,null));}; \ No newline at end of file +var _0x780f=['fieldName','key','map','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','find','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','update','then','destroy','error','stack','send','index','FaxQueueReport','rawAttributes'];(function(_0x215896,_0xd6471f){var _0x52ec84=function(_0x3b0ceb){while(--_0x3b0ceb){_0x215896['push'](_0x215896['shift']());}};_0x52ec84(++_0xd6471f);}(_0x780f,0x6c));var _0xf780=function(_0x2d89ce,_0x24d58d){_0x2d89ce=_0x2d89ce-0x0;var _0x3fad10=_0x780f[_0x2d89ce];return _0x3fad10;};'use strict';var emlformat=require(_0xf780('0x0'));var rimraf=require(_0xf780('0x1'));var zipdir=require(_0xf780('0x2'));var jsonpatch=require(_0xf780('0x3'));var rp=require(_0xf780('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf780('0x5'));var util=require(_0xf780('0x6'));var path=require(_0xf780('0x7'));var sox=require(_0xf780('0x8'));var csv=require('to-csv');var ejs=require(_0xf780('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf780('0xa'));var squel=require(_0xf780('0xb'));var crypto=require(_0xf780('0xc'));var jsforce=require(_0xf780('0xd'));var deskjs=require(_0xf780('0xe'));var toCsv=require(_0xf780('0xf'));var querystring=require('querystring');var Papa=require(_0xf780('0x10'));var Redis=require(_0xf780('0x11'));var authService=require(_0xf780('0x12'));var qs=require(_0xf780('0x13'));var as=require(_0xf780('0x14'));var hardwareService=require(_0xf780('0x15'));var logger=require(_0xf780('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xf780('0x17'));var licenseUtil=require(_0xf780('0x18'));var db=require(_0xf780('0x19'))['db'];function respondWithStatusCode(_0x1a8520,_0x5f04e1){_0x5f04e1=_0x5f04e1||0xcc;return function(_0x24aa4f){if(_0x24aa4f){return _0x1a8520[_0xf780('0x1a')](_0x5f04e1);}return _0x1a8520[_0xf780('0x1b')](_0x5f04e1)[_0xf780('0x1c')]();};}function respondWithResult(_0x5c353b,_0x5a64bc){_0x5a64bc=_0x5a64bc||0xc8;return function(_0x4be599){if(_0x4be599){return _0x5c353b[_0xf780('0x1b')](_0x5a64bc)[_0xf780('0x1d')](_0x4be599);}};}function respondWithFilteredResult(_0xc1e872,_0x187b6d){return function(_0x206d34){if(_0x206d34){var _0x335ba6=typeof _0x187b6d[_0xf780('0x1e')]==='undefined'&&typeof _0x187b6d[_0xf780('0x1f')]===_0xf780('0x20');var _0xa78b1b=_0x206d34[_0xf780('0x21')];var _0x5d5a81=_0x335ba6?0x0:_0x187b6d[_0xf780('0x1e')];var _0x53dfee=_0x335ba6?_0x206d34[_0xf780('0x21')]:_0x187b6d[_0xf780('0x1e')]+_0x187b6d['limit'];var _0x29dae1;if(_0x53dfee>=_0xa78b1b){_0x53dfee=_0xa78b1b;_0x29dae1=0xc8;}else{_0x29dae1=0xce;}_0xc1e872[_0xf780('0x1b')](_0x29dae1);return _0xc1e872['set'](_0xf780('0x22'),_0x5d5a81+'-'+_0x53dfee+'/'+_0xa78b1b)[_0xf780('0x1d')](_0x206d34);}return null;};}function patchUpdates(_0x3c7054){return function(_0x4065bb){try{jsonpatch[_0xf780('0x23')](_0x4065bb,_0x3c7054,!![]);}catch(_0x147de9){return BPromise['reject'](_0x147de9);}return _0x4065bb[_0xf780('0x24')]();};}function saveUpdates(_0x4de546,_0x5853ea){return function(_0x45d80e){if(_0x45d80e){return _0x45d80e[_0xf780('0x25')](_0x4de546)[_0xf780('0x26')](function(_0x58bb66){return _0x58bb66;});}return null;};}function removeEntity(_0x2fcb2d,_0x373dce){return function(_0x4f59b1){if(_0x4f59b1){return _0x4f59b1[_0xf780('0x27')]()['then'](function(){_0x2fcb2d[_0xf780('0x1b')](0xcc)[_0xf780('0x1c')]();});}};}function handleEntityNotFound(_0x5d4053,_0x589208){return function(_0x3710bb){if(!_0x3710bb){_0x5d4053[_0xf780('0x1a')](0x194);}return _0x3710bb;};}function handleError(_0x462435,_0x40d9c9){_0x40d9c9=_0x40d9c9||0x1f4;return function(_0x458c76){logger[_0xf780('0x28')](_0x458c76[_0xf780('0x29')]);if(_0x458c76['name']){delete _0x458c76['name'];}_0x462435['status'](_0x40d9c9)[_0xf780('0x2a')](_0x458c76);};}exports[_0xf780('0x2b')]=function(_0x26452f,_0x4ef8c3){var _0x4ed256={},_0x36bc63={},_0x149190={'count':0x0,'rows':[]};var _0x2b832d=_['map'](db[_0xf780('0x2c')][_0xf780('0x2d')],function(_0x2368e3){return{'name':_0x2368e3[_0xf780('0x2e')],'type':_0x2368e3['type'][_0xf780('0x2f')]};});_0x36bc63['model']=_[_0xf780('0x30')](_0x2b832d,_0xf780('0x31'));_0x36bc63[_0xf780('0x32')]=_[_0xf780('0x33')](_0x26452f[_0xf780('0x32')]);_0x36bc63[_0xf780('0x34')]=_[_0xf780('0x35')](_0x36bc63[_0xf780('0x36')],_0x36bc63['query']);_0x4ed256[_0xf780('0x37')]=_[_0xf780('0x35')](_0x36bc63[_0xf780('0x36')],qs[_0xf780('0x38')](_0x26452f[_0xf780('0x32')]['fields']));_0x4ed256[_0xf780('0x37')]=_0x4ed256['attributes'][_0xf780('0x39')]?_0x4ed256[_0xf780('0x37')]:_0x36bc63[_0xf780('0x36')];if(!_0x26452f['query'][_0xf780('0x3a')](_0xf780('0x3b'))){_0x4ed256[_0xf780('0x1f')]=qs[_0xf780('0x1f')](_0x26452f['query'][_0xf780('0x1f')]);_0x4ed256['offset']=qs[_0xf780('0x1e')](_0x26452f['query']['offset']);}_0x4ed256[_0xf780('0x3c')]=qs['sort'](_0x26452f[_0xf780('0x32')][_0xf780('0x3d')]);_0x4ed256[_0xf780('0x3e')]=qs[_0xf780('0x34')](_['pick'](_0x26452f[_0xf780('0x32')],_0x36bc63[_0xf780('0x34')]),_0x2b832d);if(_0x26452f[_0xf780('0x32')][_0xf780('0x3f')]){_0x4ed256['where']=_[_0xf780('0x40')](_0x4ed256[_0xf780('0x3e')],{'$or':_[_0xf780('0x30')](_0x2b832d,function(_0xdac8ab){if(_0xdac8ab[_0xf780('0x41')]!=='VIRTUAL'){var _0x4b8a3c={};_0x4b8a3c[_0xdac8ab[_0xf780('0x31')]]={'$like':'%'+_0x26452f[_0xf780('0x32')][_0xf780('0x3f')]+'%'};return _0x4b8a3c;}})});}_0x4ed256=_[_0xf780('0x40')]({},_0x4ed256,_0x26452f[_0xf780('0x42')]);var _0x4a0efe={'where':_0x4ed256[_0xf780('0x3e')]};return db['FaxQueueReport'][_0xf780('0x21')](_0x4a0efe)[_0xf780('0x26')](function(_0x28783f){_0x149190[_0xf780('0x21')]=_0x28783f;if(_0x26452f['query'][_0xf780('0x43')]){_0x4ed256[_0xf780('0x44')]=[{'all':!![]}];}return db[_0xf780('0x2c')][_0xf780('0x45')](_0x4ed256);})[_0xf780('0x26')](function(_0x12ae9a){_0x149190[_0xf780('0x46')]=_0x12ae9a;return _0x149190;})[_0xf780('0x26')](respondWithFilteredResult(_0x4ef8c3,_0x4ed256))[_0xf780('0x47')](handleError(_0x4ef8c3,null));};exports[_0xf780('0x48')]=function(_0x143118,_0x30a036){var _0x406a9e={'raw':!![],'where':{'id':_0x143118['params']['id']}},_0x42a710={};_0x42a710[_0xf780('0x36')]=_['keys'](db[_0xf780('0x2c')][_0xf780('0x2d')]);_0x42a710['query']=_['keys'](_0x143118['query']);_0x42a710['filters']=_[_0xf780('0x35')](_0x42a710['model'],_0x42a710[_0xf780('0x32')]);_0x406a9e[_0xf780('0x37')]=_[_0xf780('0x35')](_0x42a710[_0xf780('0x36')],qs[_0xf780('0x38')](_0x143118['query']['fields']));_0x406a9e['attributes']=_0x406a9e['attributes'][_0xf780('0x39')]?_0x406a9e[_0xf780('0x37')]:_0x42a710[_0xf780('0x36')];if(_0x143118[_0xf780('0x32')][_0xf780('0x43')]){_0x406a9e[_0xf780('0x44')]=[{'all':!![]}];}_0x406a9e=_['merge']({},_0x406a9e,_0x143118[_0xf780('0x42')]);return db[_0xf780('0x2c')][_0xf780('0x49')](_0x406a9e)[_0xf780('0x26')](handleEntityNotFound(_0x30a036,null))[_0xf780('0x26')](respondWithResult(_0x30a036,null))[_0xf780('0x47')](handleError(_0x30a036,null));};exports['create']=function(_0x26fe74,_0x5c4170){return db[_0xf780('0x2c')]['create'](_0x26fe74[_0xf780('0x4a')],{})['then'](respondWithResult(_0x5c4170,0xc9))['catch'](handleError(_0x5c4170,null));};exports[_0xf780('0x25')]=function(_0x72a225,_0x189717){if(_0x72a225[_0xf780('0x4a')]['id']){delete _0x72a225['body']['id'];}return db[_0xf780('0x2c')][_0xf780('0x49')]({'where':{'id':_0x72a225[_0xf780('0x4b')]['id']}})[_0xf780('0x26')](handleEntityNotFound(_0x189717,null))[_0xf780('0x26')](saveUpdates(_0x72a225['body'],null))[_0xf780('0x26')](respondWithResult(_0x189717,null))['catch'](handleError(_0x189717,null));};exports[_0xf780('0x27')]=function(_0x1b492a,_0x22c52d){return db[_0xf780('0x2c')][_0xf780('0x49')]({'where':{'id':_0x1b492a['params']['id']}})['then'](handleEntityNotFound(_0x22c52d,null))[_0xf780('0x26')](removeEntity(_0x22c52d,null))[_0xf780('0x47')](handleError(_0x22c52d,null));};exports[_0xf780('0x4c')]=function(_0x3fead1,_0x4eebe5){return db[_0xf780('0x2c')][_0xf780('0x4c')]()[_0xf780('0x26')](respondWithResult(_0x4eebe5,null))[_0xf780('0x47')](handleError(_0x4eebe5,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 41d3929..37825fe 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 _0xe14b=['bluebird','path','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','moment'];(function(_0x584513,_0x37c6c9){var _0xe4a14e=function(_0x4aadc0){while(--_0x4aadc0){_0x584513['push'](_0x584513['shift']());}};_0xe4a14e(++_0x37c6c9);}(_0xe14b,0x93));var _0xbe14=function(_0x388992,_0x9386b8){_0x388992=_0x388992-0x0;var _0x51b3dc=_0xe14b[_0x388992];return _0x51b3dc;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['report_fax_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport'];(function(_0xdf334a,_0x59d3b4){var _0xed2c13=function(_0x2a841e){while(--_0x2a841e){_0xdf334a['push'](_0xdf334a['shift']());}};_0xed2c13(++_0x59d3b4);}(_0x7a54,0x106));var _0x47a5=function(_0x5c5ca9,_0x6170d8){_0x5c5ca9=_0x5c5ca9-0x0;var _0x3303e0=_0x7a54[_0x5c5ca9];return _0x3303e0;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 3f249d2..9739d24 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 _0x02a0=['UpdateFaxQueueReport','body','where','limit','lodash','util','moment','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FaxQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','CreateFaxQueueReport','FaxQueueReport','create','options','raw','then','catch'];(function(_0x5d61b4,_0x4f7b91){var _0x183fc5=function(_0x5ecf92){while(--_0x5ecf92){_0x5d61b4['push'](_0x5d61b4['shift']());}};_0x183fc5(++_0x4f7b91);}(_0x02a0,0x1d5));var _0x002a=function(_0x3b7528,_0x2d540e){_0x3b7528=_0x3b7528-0x0;var _0x57d580=_0x02a0[_0x3b7528];return _0x57d580;};'use strict';var _=require(_0x002a('0x0'));var util=require(_0x002a('0x1'));var moment=require(_0x002a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x002a('0x3'));var logger=require(_0x002a('0x4'))(_0x002a('0x5'));var config=require(_0x002a('0x6'));var jayson=require(_0x002a('0x7'));var client=jayson[_0x002a('0x8')][_0x002a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a3d0a,_0x1cad4a,_0x2e9921){return new BPromise(function(_0x18baf7,_0xc62dde){return client[_0x002a('0xa')](_0x1a3d0a,_0x2e9921)['then'](function(_0x46770e){logger[_0x002a('0xb')](_0x002a('0xc'),_0x1cad4a,'request\x20sent');logger[_0x002a('0xd')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x1cad4a,_0x002a('0xe'),JSON[_0x002a('0xf')](_0x46770e));if(_0x46770e[_0x002a('0x10')]){if(_0x46770e['error'][_0x002a('0x11')]===0x1f4){logger['error'](_0x002a('0xc'),_0x1cad4a,_0x46770e[_0x002a('0x10')]['message']);return _0xc62dde(_0x46770e[_0x002a('0x10')]['message']);}logger[_0x002a('0x10')](_0x002a('0xc'),_0x1cad4a,_0x46770e[_0x002a('0x10')][_0x002a('0x12')]);return _0x18baf7(_0x46770e[_0x002a('0x10')][_0x002a('0x12')]);}else{logger[_0x002a('0xb')](_0x002a('0xc'),_0x1cad4a,_0x002a('0xe'));_0x18baf7(_0x46770e[_0x002a('0x13')][_0x002a('0x12')]);}})['catch'](function(_0x1258a4){logger['error'](_0x002a('0xc'),_0x1cad4a,_0x1258a4);_0xc62dde(_0x1258a4);});});}exports[_0x002a('0x14')]=function(_0x5e79fa){var _0x55ba7d=this;return new Promise(function(_0x11abd2,_0x52cd3c){return db[_0x002a('0x15')][_0x002a('0x16')](_0x5e79fa['body'],{'raw':_0x5e79fa[_0x002a('0x17')]?_0x5e79fa[_0x002a('0x17')][_0x002a('0x18')]===undefined?!![]:![]:!![]})[_0x002a('0x19')](function(_0x11fe13){logger['info'](_0x002a('0x14'),_0x5e79fa);logger[_0x002a('0xd')](_0x002a('0x14'),_0x5e79fa,JSON[_0x002a('0xf')](_0x11fe13));_0x11abd2(_0x11fe13);})[_0x002a('0x1a')](function(_0x376c96){logger[_0x002a('0x10')](_0x002a('0x14'),_0x376c96[_0x002a('0x12')],_0x5e79fa);_0x52cd3c(_0x55ba7d[_0x002a('0x10')](0x1f4,_0x376c96[_0x002a('0x12')]));});});};exports[_0x002a('0x1b')]=function(_0x1953d4){var _0x535926=this;return new Promise(function(_0xdf5028,_0x1a117f){return db[_0x002a('0x15')]['update'](_0x1953d4[_0x002a('0x1c')],{'raw':_0x1953d4[_0x002a('0x17')]?_0x1953d4[_0x002a('0x17')][_0x002a('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1953d4['options']?_0x1953d4[_0x002a('0x17')][_0x002a('0x1d')]||null:null,'attributes':_0x1953d4[_0x002a('0x17')]?_0x1953d4['options']['attributes']||null:null,'limit':_0x1953d4[_0x002a('0x17')]?_0x1953d4[_0x002a('0x17')][_0x002a('0x1e')]||null:null})[_0x002a('0x19')](function(_0x150056){logger[_0x002a('0xb')]('UpdateFaxQueueReport',_0x1953d4);logger[_0x002a('0xd')](_0x002a('0x1b'),_0x1953d4,JSON[_0x002a('0xf')](_0x150056));_0xdf5028(_0x150056);})['catch'](function(_0x373e2a){logger['error'](_0x002a('0x1b'),_0x373e2a['message'],_0x1953d4);_0x1a117f(_0x535926[_0x002a('0x10')](0x1f4,_0x373e2a['message']));});});}; \ No newline at end of file +var _0xf6d8=['message','info','catch','CreateFaxQueueReport','FaxQueueReport','create','raw','UpdateFaxQueueReport','update','options','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2acec2,_0x12ebf1){var _0x19aa0d=function(_0x312e8e){while(--_0x312e8e){_0x2acec2['push'](_0x2acec2['shift']());}};_0x19aa0d(++_0x12ebf1);}(_0xf6d8,0x1db));var _0x8f6d=function(_0x4052be,_0x4c2c7f){_0x4052be=_0x4052be-0x0;var _0x58ce54=_0xf6d8[_0x4052be];return _0x58ce54;};'use strict';var _=require(_0x8f6d('0x0'));var util=require('util');var moment=require(_0x8f6d('0x1'));var BPromise=require(_0x8f6d('0x2'));var rs=require(_0x8f6d('0x3'));var fs=require('fs');var Redis=require(_0x8f6d('0x4'));var db=require(_0x8f6d('0x5'))['db'];var utils=require(_0x8f6d('0x6'));var logger=require(_0x8f6d('0x7'))(_0x8f6d('0x8'));var config=require(_0x8f6d('0x9'));var jayson=require(_0x8f6d('0xa'));var client=jayson['client'][_0x8f6d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e5fe3,_0x3abaeb,_0x121a0c){return new BPromise(function(_0x3992de,_0x5348ce){return client[_0x8f6d('0xc')](_0x2e5fe3,_0x121a0c)[_0x8f6d('0xd')](function(_0x51436a){logger['info'](_0x8f6d('0xe'),_0x3abaeb,_0x8f6d('0xf'));logger[_0x8f6d('0x10')](_0x8f6d('0x11'),_0x3abaeb,_0x8f6d('0xf'),JSON[_0x8f6d('0x12')](_0x51436a));if(_0x51436a[_0x8f6d('0x13')]){if(_0x51436a[_0x8f6d('0x13')]['code']===0x1f4){logger[_0x8f6d('0x13')](_0x8f6d('0xe'),_0x3abaeb,_0x51436a[_0x8f6d('0x13')]['message']);return _0x5348ce(_0x51436a[_0x8f6d('0x13')][_0x8f6d('0x14')]);}logger[_0x8f6d('0x13')](_0x8f6d('0xe'),_0x3abaeb,_0x51436a[_0x8f6d('0x13')][_0x8f6d('0x14')]);return _0x3992de(_0x51436a[_0x8f6d('0x13')]['message']);}else{logger[_0x8f6d('0x15')](_0x8f6d('0xe'),_0x3abaeb,_0x8f6d('0xf'));_0x3992de(_0x51436a['result'][_0x8f6d('0x14')]);}})[_0x8f6d('0x16')](function(_0x8b5c77){logger[_0x8f6d('0x13')](_0x8f6d('0xe'),_0x3abaeb,_0x8b5c77);_0x5348ce(_0x8b5c77);});});}exports[_0x8f6d('0x17')]=function(_0x3f6905){var _0x238482=this;return new Promise(function(_0x644d49,_0x40167f){return db[_0x8f6d('0x18')][_0x8f6d('0x19')](_0x3f6905['body'],{'raw':_0x3f6905['options']?_0x3f6905['options'][_0x8f6d('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x114c40){logger[_0x8f6d('0x15')](_0x8f6d('0x17'),_0x3f6905);logger[_0x8f6d('0x10')](_0x8f6d('0x17'),_0x3f6905,JSON[_0x8f6d('0x12')](_0x114c40));_0x644d49(_0x114c40);})['catch'](function(_0x58fa4a){logger[_0x8f6d('0x13')](_0x8f6d('0x17'),_0x58fa4a[_0x8f6d('0x14')],_0x3f6905);_0x40167f(_0x238482['error'](0x1f4,_0x58fa4a[_0x8f6d('0x14')]));});});};exports[_0x8f6d('0x1b')]=function(_0x2dd63a){var _0x184462=this;return new Promise(function(_0x4d1518,_0x35c550){return db[_0x8f6d('0x18')][_0x8f6d('0x1c')](_0x2dd63a['body'],{'raw':_0x2dd63a['options']?_0x2dd63a[_0x8f6d('0x1d')][_0x8f6d('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2dd63a[_0x8f6d('0x1d')]?_0x2dd63a[_0x8f6d('0x1d')][_0x8f6d('0x1e')]||null:null,'attributes':_0x2dd63a[_0x8f6d('0x1d')]?_0x2dd63a[_0x8f6d('0x1d')][_0x8f6d('0x1f')]||null:null,'limit':_0x2dd63a['options']?_0x2dd63a[_0x8f6d('0x1d')][_0x8f6d('0x20')]||null:null})[_0x8f6d('0xd')](function(_0x56965e){logger[_0x8f6d('0x15')]('UpdateFaxQueueReport',_0x2dd63a);logger[_0x8f6d('0x10')](_0x8f6d('0x1b'),_0x2dd63a,JSON['stringify'](_0x56965e));_0x4d1518(_0x56965e);})[_0x8f6d('0x16')](function(_0x3e0192){logger['error'](_0x8f6d('0x1b'),_0x3e0192[_0x8f6d('0x14')],_0x2dd63a);_0x35c550(_0x184462['error'](0x1f4,_0x3e0192[_0x8f6d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 914da05..82a81b1 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 _0xd080=['/:id','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','/describe','describe'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xd080,0x176));var _0x0d08=function(_0x1bc27f,_0x26152d){_0x1bc27f=_0x1bc27f-0x0;var _0x5b6d9c=_0xd080[_0x1bc27f];return _0x5b6d9c;};'use strict';var multer=require('multer');var util=require(_0x0d08('0x0'));var path=require(_0x0d08('0x1'));var timeout=require(_0x0d08('0x2'));var express=require(_0x0d08('0x3'));var router=express[_0x0d08('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0d08('0x5'));var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router[_0x0d08('0x6')]('/',auth[_0x0d08('0x7')](),controller['index']);router['get'](_0x0d08('0x8'),auth[_0x0d08('0x7')](),controller[_0x0d08('0x9')]);router[_0x0d08('0x6')](_0x0d08('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x0d08('0x7')](),controller[_0x0d08('0xb')]);router[_0x0d08('0xc')](_0x0d08('0xa'),auth['isAuthenticated'](),controller[_0x0d08('0xd')]);router[_0x0d08('0xe')](_0x0d08('0xa'),auth[_0x0d08('0x7')](),controller[_0x0d08('0xf')]);module['exports']=router; \ No newline at end of file +var _0x79d7=['./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x504851,_0x2480a3){var _0x5be34b=function(_0x291037){while(--_0x291037){_0x504851['push'](_0x504851['shift']());}};_0x5be34b(++_0x2480a3);}(_0x79d7,0x123));var _0x779d=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x79d7[_0x50a0c2];return _0x5ebadd;};'use strict';var multer=require(_0x779d('0x0'));var util=require(_0x779d('0x1'));var path=require(_0x779d('0x2'));var timeout=require('connect-timeout');var express=require(_0x779d('0x3'));var router=express[_0x779d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x779d('0x5'));var interaction=require(_0x779d('0x6'));var config=require(_0x779d('0x7'));var controller=require(_0x779d('0x8'));router[_0x779d('0x9')]('/',auth[_0x779d('0xa')](),controller[_0x779d('0xb')]);router[_0x779d('0x9')](_0x779d('0xc'),auth[_0x779d('0xa')](),controller[_0x779d('0xd')]);router[_0x779d('0x9')](_0x779d('0xe'),auth[_0x779d('0xa')](),controller[_0x779d('0xf')]);router[_0x779d('0x10')]('/',auth[_0x779d('0xa')](),controller[_0x779d('0x11')]);router[_0x779d('0x12')]('/:id',auth[_0x779d('0xa')](),controller[_0x779d('0x13')]);router[_0x779d('0x14')](_0x779d('0xe'),auth[_0x779d('0xa')](),controller[_0x779d('0x15')]);module[_0x779d('0x16')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 503330e..7316461 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x26d398,_0x22f9b0){var _0x3e65f2=function(_0x20c15f){while(--_0x20c15f){_0x26d398['push'](_0x26d398['shift']());}};_0x3e65f2(++_0x22f9b0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x479f17,_0x3ddb13){var _0xba4508=function(_0x21eb51){while(--_0x21eb51){_0x479f17['push'](_0x479f17['shift']());}};_0xba4508(++_0x3ddb13);}(_0x54ef,0x112));var _0xf54e=function(_0x14aebb,_0x51e772){_0x14aebb=_0x14aebb-0x0;var _0x4f9cbc=_0x54ef[_0x14aebb];return _0x4f9cbc;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 8465982..7c4d072 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 _0x7341=['count','Content-Range','apply','update','then','error','stack','name','index','map','FaxTransferReport','rawAttributes','key','model','filters','intersection','attributes','fields','query','length','hasOwnProperty','order','sort','filter','where','merge','type','VIRTUAL','options','include','rows','catch','show','keys','includeAll','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x284b22,_0x1e0f2c){var _0x261e08=function(_0x167b12){while(--_0x167b12){_0x284b22['push'](_0x284b22['shift']());}};_0x261e08(++_0x1e0f2c);}(_0x7341,0x1a4));var _0x1734=function(_0xc5fc86,_0x4eec30){_0xc5fc86=_0xc5fc86-0x0;var _0x155374=_0x7341[_0xc5fc86];return _0x155374;};'use strict';var emlformat=require(_0x1734('0x0'));var rimraf=require(_0x1734('0x1'));var zipdir=require(_0x1734('0x2'));var jsonpatch=require(_0x1734('0x3'));var rp=require(_0x1734('0x4'));var moment=require(_0x1734('0x5'));var BPromise=require(_0x1734('0x6'));var Mustache=require(_0x1734('0x7'));var util=require(_0x1734('0x8'));var path=require(_0x1734('0x9'));var sox=require(_0x1734('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1734('0xb'));var _=require(_0x1734('0xc'));var squel=require(_0x1734('0xd'));var crypto=require(_0x1734('0xe'));var jsforce=require(_0x1734('0xf'));var deskjs=require(_0x1734('0x10'));var toCsv=require(_0x1734('0x11'));var querystring=require(_0x1734('0x12'));var Papa=require(_0x1734('0x13'));var Redis=require(_0x1734('0x14'));var authService=require(_0x1734('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x1734('0x16'));var hardwareService=require(_0x1734('0x17'));var logger=require(_0x1734('0x18'))(_0x1734('0x19'));var utils=require(_0x1734('0x1a'));var config=require(_0x1734('0x1b'));var licenseUtil=require(_0x1734('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x532767,_0x5472b1){_0x5472b1=_0x5472b1||0xcc;return function(_0x23d540){if(_0x23d540){return _0x532767[_0x1734('0x1d')](_0x5472b1);}return _0x532767[_0x1734('0x1e')](_0x5472b1)[_0x1734('0x1f')]();};}function respondWithResult(_0x5a8497,_0x565023){_0x565023=_0x565023||0xc8;return function(_0x473404){if(_0x473404){return _0x5a8497[_0x1734('0x1e')](_0x565023)[_0x1734('0x20')](_0x473404);}};}function respondWithFilteredResult(_0x4e539e,_0x594efb){return function(_0x4fd63b){if(_0x4fd63b){var _0x2712a9=typeof _0x594efb[_0x1734('0x21')]===_0x1734('0x22')&&typeof _0x594efb[_0x1734('0x23')]==='undefined';var _0x448c51=_0x4fd63b[_0x1734('0x24')];var _0x4cbc10=_0x2712a9?0x0:_0x594efb['offset'];var _0x94fdc8=_0x2712a9?_0x4fd63b[_0x1734('0x24')]:_0x594efb['offset']+_0x594efb[_0x1734('0x23')];var _0x41b79b;if(_0x94fdc8>=_0x448c51){_0x94fdc8=_0x448c51;_0x41b79b=0xc8;}else{_0x41b79b=0xce;}_0x4e539e[_0x1734('0x1e')](_0x41b79b);return _0x4e539e['set'](_0x1734('0x25'),_0x4cbc10+'-'+_0x94fdc8+'/'+_0x448c51)[_0x1734('0x20')](_0x4fd63b);}return null;};}function patchUpdates(_0x19ec3d){return function(_0x22b8b1){try{jsonpatch[_0x1734('0x26')](_0x22b8b1,_0x19ec3d,!![]);}catch(_0x5b3b8d){return BPromise['reject'](_0x5b3b8d);}return _0x22b8b1['save']();};}function saveUpdates(_0x5f597f,_0x274ba6){return function(_0x286e39){if(_0x286e39){return _0x286e39[_0x1734('0x27')](_0x5f597f)[_0x1734('0x28')](function(_0xe3f631){return _0xe3f631;});}return null;};}function removeEntity(_0x35c8eb,_0x4f9df3){return function(_0x2d5d6a){if(_0x2d5d6a){return _0x2d5d6a['destroy']()[_0x1734('0x28')](function(){_0x35c8eb['status'](0xcc)[_0x1734('0x1f')]();});}};}function handleEntityNotFound(_0x9ac433,_0x34a394){return function(_0x4fceb9){if(!_0x4fceb9){_0x9ac433[_0x1734('0x1d')](0x194);}return _0x4fceb9;};}function handleError(_0x2a44b4,_0x488325){_0x488325=_0x488325||0x1f4;return function(_0x12e723){logger[_0x1734('0x29')](_0x12e723[_0x1734('0x2a')]);if(_0x12e723[_0x1734('0x2b')]){delete _0x12e723[_0x1734('0x2b')];}_0x2a44b4[_0x1734('0x1e')](_0x488325)['send'](_0x12e723);};}exports[_0x1734('0x2c')]=function(_0x395e4c,_0x490cbc){var _0x319198={},_0x10de90={},_0x4f4f34={'count':0x0,'rows':[]};var _0x3f3d44=_[_0x1734('0x2d')](db[_0x1734('0x2e')][_0x1734('0x2f')],function(_0x23a350){return{'name':_0x23a350['fieldName'],'type':_0x23a350['type'][_0x1734('0x30')]};});_0x10de90[_0x1734('0x31')]=_[_0x1734('0x2d')](_0x3f3d44,_0x1734('0x2b'));_0x10de90['query']=_['keys'](_0x395e4c['query']);_0x10de90[_0x1734('0x32')]=_[_0x1734('0x33')](_0x10de90[_0x1734('0x31')],_0x10de90['query']);_0x319198[_0x1734('0x34')]=_['intersection'](_0x10de90['model'],qs[_0x1734('0x35')](_0x395e4c[_0x1734('0x36')][_0x1734('0x35')]));_0x319198[_0x1734('0x34')]=_0x319198['attributes'][_0x1734('0x37')]?_0x319198[_0x1734('0x34')]:_0x10de90['model'];if(!_0x395e4c['query'][_0x1734('0x38')]('nolimit')){_0x319198[_0x1734('0x23')]=qs[_0x1734('0x23')](_0x395e4c[_0x1734('0x36')][_0x1734('0x23')]);_0x319198['offset']=qs[_0x1734('0x21')](_0x395e4c['query'][_0x1734('0x21')]);}_0x319198[_0x1734('0x39')]=qs[_0x1734('0x3a')](_0x395e4c[_0x1734('0x36')]['sort']);_0x319198['where']=qs[_0x1734('0x32')](_['pick'](_0x395e4c['query'],_0x10de90[_0x1734('0x32')]),_0x3f3d44);if(_0x395e4c[_0x1734('0x36')][_0x1734('0x3b')]){_0x319198[_0x1734('0x3c')]=_[_0x1734('0x3d')](_0x319198[_0x1734('0x3c')],{'$or':_[_0x1734('0x2d')](_0x3f3d44,function(_0x5e3e8d){if(_0x5e3e8d[_0x1734('0x3e')]!==_0x1734('0x3f')){var _0x214038={};_0x214038[_0x5e3e8d[_0x1734('0x2b')]]={'$like':'%'+_0x395e4c[_0x1734('0x36')][_0x1734('0x3b')]+'%'};return _0x214038;}})});}_0x319198=_[_0x1734('0x3d')]({},_0x319198,_0x395e4c[_0x1734('0x40')]);var _0x29aa3a={'where':_0x319198[_0x1734('0x3c')]};return db[_0x1734('0x2e')][_0x1734('0x24')](_0x29aa3a)[_0x1734('0x28')](function(_0x27ddd0){_0x4f4f34['count']=_0x27ddd0;if(_0x395e4c['query']['includeAll']){_0x319198[_0x1734('0x41')]=[{'all':!![]}];}return db[_0x1734('0x2e')]['findAll'](_0x319198);})[_0x1734('0x28')](function(_0x12c99d){_0x4f4f34[_0x1734('0x42')]=_0x12c99d;return _0x4f4f34;})['then'](respondWithFilteredResult(_0x490cbc,_0x319198))[_0x1734('0x43')](handleError(_0x490cbc,null));};exports[_0x1734('0x44')]=function(_0x5da44a,_0x4002d2){var _0xd36c12={'raw':!![],'where':{'id':_0x5da44a['params']['id']}},_0x4ec338={};_0x4ec338[_0x1734('0x31')]=_[_0x1734('0x45')](db[_0x1734('0x2e')][_0x1734('0x2f')]);_0x4ec338[_0x1734('0x36')]=_[_0x1734('0x45')](_0x5da44a[_0x1734('0x36')]);_0x4ec338[_0x1734('0x32')]=_[_0x1734('0x33')](_0x4ec338[_0x1734('0x31')],_0x4ec338['query']);_0xd36c12[_0x1734('0x34')]=_[_0x1734('0x33')](_0x4ec338[_0x1734('0x31')],qs['fields'](_0x5da44a[_0x1734('0x36')]['fields']));_0xd36c12[_0x1734('0x34')]=_0xd36c12[_0x1734('0x34')][_0x1734('0x37')]?_0xd36c12['attributes']:_0x4ec338['model'];if(_0x5da44a[_0x1734('0x36')][_0x1734('0x46')]){_0xd36c12[_0x1734('0x41')]=[{'all':!![]}];}_0xd36c12=_['merge']({},_0xd36c12,_0x5da44a[_0x1734('0x40')]);return db[_0x1734('0x2e')][_0x1734('0x47')](_0xd36c12)[_0x1734('0x28')](handleEntityNotFound(_0x4002d2,null))[_0x1734('0x28')](respondWithResult(_0x4002d2,null))['catch'](handleError(_0x4002d2,null));};exports[_0x1734('0x48')]=function(_0x3bfafd,_0x2dab83){return db[_0x1734('0x2e')]['create'](_0x3bfafd[_0x1734('0x49')],{})[_0x1734('0x28')](respondWithResult(_0x2dab83,0xc9))['catch'](handleError(_0x2dab83,null));};exports[_0x1734('0x27')]=function(_0x50439f,_0x17d3e9){if(_0x50439f[_0x1734('0x49')]['id']){delete _0x50439f[_0x1734('0x49')]['id'];}return db[_0x1734('0x2e')][_0x1734('0x47')]({'where':{'id':_0x50439f[_0x1734('0x4a')]['id']}})[_0x1734('0x28')](handleEntityNotFound(_0x17d3e9,null))[_0x1734('0x28')](saveUpdates(_0x50439f['body'],null))[_0x1734('0x28')](respondWithResult(_0x17d3e9,null))[_0x1734('0x43')](handleError(_0x17d3e9,null));};exports['destroy']=function(_0x483588,_0x313012){return db[_0x1734('0x2e')][_0x1734('0x47')]({'where':{'id':_0x483588['params']['id']}})[_0x1734('0x28')](handleEntityNotFound(_0x313012,null))[_0x1734('0x28')](removeEntity(_0x313012,null))['catch'](handleError(_0x313012,null));};exports[_0x1734('0x4b')]=function(_0xeceae7,_0x2ed507){return db[_0x1734('0x2e')][_0x1734('0x4b')]()[_0x1734('0x28')](respondWithResult(_0x2ed507,null))[_0x1734('0x43')](handleError(_0x2ed507,null));}; \ No newline at end of file +var _0x0ba7=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','save','end','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','FaxTransferReport','includeAll','rows','then','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js'];(function(_0x3f7a42,_0x13703f){var _0x2c213f=function(_0x381bc4){while(--_0x381bc4){_0x3f7a42['push'](_0x3f7a42['shift']());}};_0x2c213f(++_0x13703f);}(_0x0ba7,0x1a7));var _0x70ba=function(_0x44174e,_0x1e54ac){_0x44174e=_0x44174e-0x0;var _0xedf1a0=_0x0ba7[_0x44174e];return _0xedf1a0;};'use strict';var emlformat=require(_0x70ba('0x0'));var rimraf=require(_0x70ba('0x1'));var zipdir=require(_0x70ba('0x2'));var jsonpatch=require(_0x70ba('0x3'));var rp=require(_0x70ba('0x4'));var moment=require(_0x70ba('0x5'));var BPromise=require(_0x70ba('0x6'));var Mustache=require('mustache');var util=require(_0x70ba('0x7'));var path=require(_0x70ba('0x8'));var sox=require(_0x70ba('0x9'));var csv=require(_0x70ba('0xa'));var ejs=require(_0x70ba('0xb'));var fs=require('fs');var fs_extra=require(_0x70ba('0xc'));var _=require('lodash');var squel=require(_0x70ba('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x70ba('0xe'));var toCsv=require('to-csv');var querystring=require(_0x70ba('0xf'));var Papa=require(_0x70ba('0x10'));var Redis=require(_0x70ba('0x11'));var authService=require(_0x70ba('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x70ba('0x13'));var hardwareService=require(_0x70ba('0x14'));var logger=require(_0x70ba('0x15'))(_0x70ba('0x16'));var utils=require(_0x70ba('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x70ba('0x18'))['db'];function respondWithStatusCode(_0x4f6bfb,_0x37f03f){_0x37f03f=_0x37f03f||0xcc;return function(_0x581c28){if(_0x581c28){return _0x4f6bfb[_0x70ba('0x19')](_0x37f03f);}return _0x4f6bfb['status'](_0x37f03f)['end']();};}function respondWithResult(_0x57d1da,_0x4f1dd8){_0x4f1dd8=_0x4f1dd8||0xc8;return function(_0x1cf6c5){if(_0x1cf6c5){return _0x57d1da[_0x70ba('0x1a')](_0x4f1dd8)[_0x70ba('0x1b')](_0x1cf6c5);}};}function respondWithFilteredResult(_0x25fb68,_0xb43025){return function(_0x8c76ff){if(_0x8c76ff){var _0x561bba=typeof _0xb43025[_0x70ba('0x1c')]===_0x70ba('0x1d')&&typeof _0xb43025['limit']==='undefined';var _0x528816=_0x8c76ff[_0x70ba('0x1e')];var _0x4e0ed1=_0x561bba?0x0:_0xb43025[_0x70ba('0x1c')];var _0x3d9e95=_0x561bba?_0x8c76ff['count']:_0xb43025[_0x70ba('0x1c')]+_0xb43025[_0x70ba('0x1f')];var _0x1e1f1a;if(_0x3d9e95>=_0x528816){_0x3d9e95=_0x528816;_0x1e1f1a=0xc8;}else{_0x1e1f1a=0xce;}_0x25fb68[_0x70ba('0x1a')](_0x1e1f1a);return _0x25fb68[_0x70ba('0x20')]('Content-Range',_0x4e0ed1+'-'+_0x3d9e95+'/'+_0x528816)[_0x70ba('0x1b')](_0x8c76ff);}return null;};}function patchUpdates(_0x37bbeb){return function(_0x5d7474){try{jsonpatch[_0x70ba('0x21')](_0x5d7474,_0x37bbeb,!![]);}catch(_0x3fc2c6){return BPromise[_0x70ba('0x22')](_0x3fc2c6);}return _0x5d7474[_0x70ba('0x23')]();};}function saveUpdates(_0x32159e,_0x406746){return function(_0xcc85d9){if(_0xcc85d9){return _0xcc85d9['update'](_0x32159e)['then'](function(_0x49962e){return _0x49962e;});}return null;};}function removeEntity(_0x2d18f4,_0x57a84f){return function(_0x394cde){if(_0x394cde){return _0x394cde['destroy']()['then'](function(){_0x2d18f4[_0x70ba('0x1a')](0xcc)[_0x70ba('0x24')]();});}};}function handleEntityNotFound(_0x1d299c,_0xf0f9cf){return function(_0x433c1c){if(!_0x433c1c){_0x1d299c[_0x70ba('0x19')](0x194);}return _0x433c1c;};}function handleError(_0x4f8456,_0x19c377){_0x19c377=_0x19c377||0x1f4;return function(_0x196907){logger['error'](_0x196907[_0x70ba('0x25')]);if(_0x196907[_0x70ba('0x26')]){delete _0x196907[_0x70ba('0x26')];}_0x4f8456[_0x70ba('0x1a')](_0x19c377)['send'](_0x196907);};}exports[_0x70ba('0x27')]=function(_0x3f4712,_0x5d874d){var _0x477342={},_0x53e341={},_0x4cf6a9={'count':0x0,'rows':[]};var _0x4dddbe=_[_0x70ba('0x28')](db['FaxTransferReport'][_0x70ba('0x29')],function(_0x9897fa){return{'name':_0x9897fa[_0x70ba('0x2a')],'type':_0x9897fa[_0x70ba('0x2b')][_0x70ba('0x2c')]};});_0x53e341[_0x70ba('0x2d')]=_[_0x70ba('0x28')](_0x4dddbe,'name');_0x53e341[_0x70ba('0x2e')]=_[_0x70ba('0x2f')](_0x3f4712['query']);_0x53e341['filters']=_[_0x70ba('0x30')](_0x53e341[_0x70ba('0x2d')],_0x53e341[_0x70ba('0x2e')]);_0x477342[_0x70ba('0x31')]=_[_0x70ba('0x30')](_0x53e341[_0x70ba('0x2d')],qs['fields'](_0x3f4712[_0x70ba('0x2e')][_0x70ba('0x32')]));_0x477342[_0x70ba('0x31')]=_0x477342[_0x70ba('0x31')]['length']?_0x477342[_0x70ba('0x31')]:_0x53e341[_0x70ba('0x2d')];if(!_0x3f4712['query'][_0x70ba('0x33')](_0x70ba('0x34'))){_0x477342[_0x70ba('0x1f')]=qs[_0x70ba('0x1f')](_0x3f4712[_0x70ba('0x2e')][_0x70ba('0x1f')]);_0x477342['offset']=qs['offset'](_0x3f4712[_0x70ba('0x2e')][_0x70ba('0x1c')]);}_0x477342[_0x70ba('0x35')]=qs[_0x70ba('0x36')](_0x3f4712[_0x70ba('0x2e')][_0x70ba('0x36')]);_0x477342[_0x70ba('0x37')]=qs[_0x70ba('0x38')](_[_0x70ba('0x39')](_0x3f4712[_0x70ba('0x2e')],_0x53e341[_0x70ba('0x38')]),_0x4dddbe);if(_0x3f4712[_0x70ba('0x2e')][_0x70ba('0x3a')]){_0x477342['where']=_[_0x70ba('0x3b')](_0x477342[_0x70ba('0x37')],{'$or':_[_0x70ba('0x28')](_0x4dddbe,function(_0xd9396b){if(_0xd9396b[_0x70ba('0x2b')]!=='VIRTUAL'){var _0x5f1e7e={};_0x5f1e7e[_0xd9396b[_0x70ba('0x26')]]={'$like':'%'+_0x3f4712[_0x70ba('0x2e')][_0x70ba('0x3a')]+'%'};return _0x5f1e7e;}})});}_0x477342=_[_0x70ba('0x3b')]({},_0x477342,_0x3f4712[_0x70ba('0x3c')]);var _0x3827a7={'where':_0x477342[_0x70ba('0x37')]};return db[_0x70ba('0x3d')][_0x70ba('0x1e')](_0x3827a7)['then'](function(_0x2421ee){_0x4cf6a9['count']=_0x2421ee;if(_0x3f4712[_0x70ba('0x2e')][_0x70ba('0x3e')]){_0x477342['include']=[{'all':!![]}];}return db[_0x70ba('0x3d')]['findAll'](_0x477342);})['then'](function(_0x3ae6be){_0x4cf6a9[_0x70ba('0x3f')]=_0x3ae6be;return _0x4cf6a9;})[_0x70ba('0x40')](respondWithFilteredResult(_0x5d874d,_0x477342))[_0x70ba('0x41')](handleError(_0x5d874d,null));};exports[_0x70ba('0x42')]=function(_0x2314d0,_0x10ca2a){var _0x44f47d={'raw':!![],'where':{'id':_0x2314d0[_0x70ba('0x43')]['id']}},_0x17d517={};_0x17d517['model']=_[_0x70ba('0x2f')](db[_0x70ba('0x3d')][_0x70ba('0x29')]);_0x17d517[_0x70ba('0x2e')]=_[_0x70ba('0x2f')](_0x2314d0['query']);_0x17d517[_0x70ba('0x38')]=_[_0x70ba('0x30')](_0x17d517[_0x70ba('0x2d')],_0x17d517[_0x70ba('0x2e')]);_0x44f47d[_0x70ba('0x31')]=_['intersection'](_0x17d517[_0x70ba('0x2d')],qs[_0x70ba('0x32')](_0x2314d0[_0x70ba('0x2e')]['fields']));_0x44f47d[_0x70ba('0x31')]=_0x44f47d[_0x70ba('0x31')]['length']?_0x44f47d['attributes']:_0x17d517['model'];if(_0x2314d0[_0x70ba('0x2e')][_0x70ba('0x3e')]){_0x44f47d['include']=[{'all':!![]}];}_0x44f47d=_[_0x70ba('0x3b')]({},_0x44f47d,_0x2314d0[_0x70ba('0x3c')]);return db[_0x70ba('0x3d')][_0x70ba('0x44')](_0x44f47d)[_0x70ba('0x40')](handleEntityNotFound(_0x10ca2a,null))[_0x70ba('0x40')](respondWithResult(_0x10ca2a,null))[_0x70ba('0x41')](handleError(_0x10ca2a,null));};exports[_0x70ba('0x45')]=function(_0x218279,_0x492a52){return db[_0x70ba('0x3d')]['create'](_0x218279[_0x70ba('0x46')],{})[_0x70ba('0x40')](respondWithResult(_0x492a52,0xc9))[_0x70ba('0x41')](handleError(_0x492a52,null));};exports['update']=function(_0x183e62,_0x5711a0){if(_0x183e62[_0x70ba('0x46')]['id']){delete _0x183e62[_0x70ba('0x46')]['id'];}return db['FaxTransferReport'][_0x70ba('0x44')]({'where':{'id':_0x183e62[_0x70ba('0x43')]['id']}})[_0x70ba('0x40')](handleEntityNotFound(_0x5711a0,null))[_0x70ba('0x40')](saveUpdates(_0x183e62[_0x70ba('0x46')],null))[_0x70ba('0x40')](respondWithResult(_0x5711a0,null))[_0x70ba('0x41')](handleError(_0x5711a0,null));};exports[_0x70ba('0x47')]=function(_0x5e92b0,_0x57bfc6){return db[_0x70ba('0x3d')][_0x70ba('0x44')]({'where':{'id':_0x5e92b0[_0x70ba('0x43')]['id']}})[_0x70ba('0x40')](handleEntityNotFound(_0x57bfc6,null))[_0x70ba('0x40')](removeEntity(_0x57bfc6,null))[_0x70ba('0x41')](handleError(_0x57bfc6,null));};exports['describe']=function(_0x34816c,_0x62c04a){return db[_0x70ba('0x3d')][_0x70ba('0x48')]()[_0x70ba('0x40')](respondWithResult(_0x62c04a,null))[_0x70ba('0x41')](handleError(_0x62c04a,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 8e42c43..132d929 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 _0x0c78=['request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0x2db8db,_0xfbcaea){var _0x2c0053=function(_0x5e45d2){while(--_0x5e45d2){_0x2db8db['push'](_0x2db8db['shift']());}};_0x2c0053(++_0xfbcaea);}(_0x0c78,0x1ea));var _0x80c7=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x0c78[_0x4ea69d];return _0x5318e0;};'use strict';var _=require(_0x80c7('0x0'));var util=require(_0x80c7('0x1'));var logger=require(_0x80c7('0x2'))(_0x80c7('0x3'));var moment=require('moment');var BPromise=require(_0x80c7('0x4'));var rp=require(_0x80c7('0x5'));var fs=require('fs');var path=require(_0x80c7('0x6'));var rimraf=require(_0x80c7('0x7'));var config=require(_0x80c7('0x8'));var attributes=require(_0x80c7('0x9'));module[_0x80c7('0xa')]=function(_0x485262,_0x20dcfa){return _0x485262[_0x80c7('0xb')](_0x80c7('0xc'),attributes,{'tableName':_0x80c7('0xd'),'paranoid':![],'indexes':[{'name':_0x80c7('0xe'),'fields':[_0x80c7('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xedd8=['moment','request-promise','rimraf','../../config/environment','./faxTransferReport.attributes','exports','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0xedd8,0xb2));var _0x8edd=function(_0x90f34f,_0x404021){_0x90f34f=_0x90f34f-0x0;var _0x4b18cf=_0xedd8[_0x90f34f];return _0x4b18cf;};'use strict';var _=require(_0x8edd('0x0'));var util=require(_0x8edd('0x1'));var logger=require(_0x8edd('0x2'))(_0x8edd('0x3'));var moment=require(_0x8edd('0x4'));var BPromise=require('bluebird');var rp=require(_0x8edd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8edd('0x6'));var config=require(_0x8edd('0x7'));var attributes=require(_0x8edd('0x8'));module[_0x8edd('0x9')]=function(_0x752e5,_0x2a921d){return _0x752e5['define'](_0x8edd('0xa'),attributes,{'tableName':_0x8edd('0xb'),'paranoid':![],'indexes':[{'name':_0x8edd('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index ab73821..66719d1 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 _0xfe7e=['lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch'];(function(_0x4b7a68,_0x2d75b8){var _0x192677=function(_0x593a12){while(--_0x593a12){_0x4b7a68['push'](_0x4b7a68['shift']());}};_0x192677(++_0x2d75b8);}(_0xfe7e,0x108));var _0xefe7=function(_0x4d905c,_0x1ad25f){_0x4d905c=_0x4d905c-0x0;var _0x5d5c90=_0xfe7e[_0x4d905c];return _0x5d5c90;};'use strict';var _=require(_0xefe7('0x0'));var util=require(_0xefe7('0x1'));var moment=require('moment');var BPromise=require(_0xefe7('0x2'));var rs=require(_0xefe7('0x3'));var fs=require('fs');var Redis=require(_0xefe7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xefe7('0x5'));var logger=require(_0xefe7('0x6'))(_0xefe7('0x7'));var config=require(_0xefe7('0x8'));var jayson=require(_0xefe7('0x9'));var client=jayson[_0xefe7('0xa')][_0xefe7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x221477,_0x40c5cd,_0x55f1c4){return new BPromise(function(_0x58e3a5,_0x1eb8fa){return client[_0xefe7('0xc')](_0x221477,_0x55f1c4)[_0xefe7('0xd')](function(_0x58bc88){logger[_0xefe7('0xe')](_0xefe7('0xf'),_0x40c5cd,'request\x20sent');logger[_0xefe7('0x10')](_0xefe7('0x11'),_0x40c5cd,_0xefe7('0x12'),JSON['stringify'](_0x58bc88));if(_0x58bc88[_0xefe7('0x13')]){if(_0x58bc88[_0xefe7('0x13')]['code']===0x1f4){logger[_0xefe7('0x13')](_0xefe7('0xf'),_0x40c5cd,_0x58bc88['error'][_0xefe7('0x14')]);return _0x1eb8fa(_0x58bc88[_0xefe7('0x13')][_0xefe7('0x14')]);}logger[_0xefe7('0x13')]('FaxTransferReport,\x20%s,\x20%s',_0x40c5cd,_0x58bc88[_0xefe7('0x13')][_0xefe7('0x14')]);return _0x58e3a5(_0x58bc88[_0xefe7('0x13')]['message']);}else{logger[_0xefe7('0xe')](_0xefe7('0xf'),_0x40c5cd,_0xefe7('0x12'));_0x58e3a5(_0x58bc88['result'][_0xefe7('0x14')]);}})[_0xefe7('0x15')](function(_0x3e0198){logger[_0xefe7('0x13')](_0xefe7('0xf'),_0x40c5cd,_0x3e0198);_0x1eb8fa(_0x3e0198);});});} \ No newline at end of file +var _0xf154=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent'];(function(_0x3d5660,_0x313fba){var _0xc4c832=function(_0xd9093f){while(--_0xd9093f){_0x3d5660['push'](_0x3d5660['shift']());}};_0xc4c832(++_0x313fba);}(_0xf154,0xb0));var _0x4f15=function(_0x2ddc5b,_0x5eae54){_0x2ddc5b=_0x2ddc5b-0x0;var _0x41eefe=_0xf154[_0x2ddc5b];return _0x41eefe;};'use strict';var _=require('lodash');var util=require(_0x4f15('0x0'));var moment=require(_0x4f15('0x1'));var BPromise=require(_0x4f15('0x2'));var rs=require(_0x4f15('0x3'));var fs=require('fs');var Redis=require(_0x4f15('0x4'));var db=require(_0x4f15('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4f15('0x6'))('rpc');var config=require(_0x4f15('0x7'));var jayson=require(_0x4f15('0x8'));var client=jayson[_0x4f15('0x9')][_0x4f15('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37580d,_0x364331,_0x387372){return new BPromise(function(_0x193fc8,_0x4a8d1d){return client[_0x4f15('0xb')](_0x37580d,_0x387372)[_0x4f15('0xc')](function(_0x3344ec){logger[_0x4f15('0xd')](_0x4f15('0xe'),_0x364331,'request\x20sent');logger[_0x4f15('0xf')](_0x4f15('0x10'),_0x364331,'request\x20sent',JSON[_0x4f15('0x11')](_0x3344ec));if(_0x3344ec[_0x4f15('0x12')]){if(_0x3344ec[_0x4f15('0x12')][_0x4f15('0x13')]===0x1f4){logger[_0x4f15('0x12')](_0x4f15('0xe'),_0x364331,_0x3344ec[_0x4f15('0x12')][_0x4f15('0x14')]);return _0x4a8d1d(_0x3344ec[_0x4f15('0x12')][_0x4f15('0x14')]);}logger[_0x4f15('0x12')](_0x4f15('0xe'),_0x364331,_0x3344ec[_0x4f15('0x12')]['message']);return _0x193fc8(_0x3344ec[_0x4f15('0x12')][_0x4f15('0x14')]);}else{logger[_0x4f15('0xd')](_0x4f15('0xe'),_0x364331,_0x4f15('0x15'));_0x193fc8(_0x3344ec['result'][_0x4f15('0x14')]);}})['catch'](function(_0x183054){logger['error'](_0x4f15('0xe'),_0x364331,_0x183054);_0x4a8d1d(_0x183054);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index e9d8603..403be98 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 _0xdfdc=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','/describe','describe','isAuthenticated','show','post','put','update','delete','/:id','multer','util','path'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xdfdc,0xb1));var _0xcdfd=function(_0x292d17,_0x212e6a){_0x292d17=_0x292d17-0x0;var _0x521211=_0xdfdc[_0x292d17];return _0x521211;};'use strict';var multer=require(_0xcdfd('0x0'));var util=require(_0xcdfd('0x1'));var path=require(_0xcdfd('0x2'));var timeout=require(_0xcdfd('0x3'));var express=require(_0xcdfd('0x4'));var router=express['Router']();var fs_extra=require(_0xcdfd('0x5'));var auth=require(_0xcdfd('0x6'));var interaction=require(_0xcdfd('0x7'));var config=require(_0xcdfd('0x8'));var controller=require(_0xcdfd('0x9'));router[_0xcdfd('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xcdfd('0xa')](_0xcdfd('0xb'),auth['isAuthenticated'](),controller[_0xcdfd('0xc')]);router['get']('/:id',auth[_0xcdfd('0xd')](),controller[_0xcdfd('0xe')]);router[_0xcdfd('0xf')]('/',auth[_0xcdfd('0xd')](),controller['create']);router[_0xcdfd('0x10')]('/:id',auth[_0xcdfd('0xd')](),controller[_0xcdfd('0x11')]);router[_0xcdfd('0x12')](_0xcdfd('0x13'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6d5d=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','index','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x5b01bc,_0x223e34){var _0x1b1af2=function(_0x18702a){while(--_0x18702a){_0x5b01bc['push'](_0x5b01bc['shift']());}};_0x1b1af2(++_0x223e34);}(_0x6d5d,0x6b));var _0xd6d5=function(_0x58c011,_0x3afdc8){_0x58c011=_0x58c011-0x0;var _0x359028=_0x6d5d[_0x58c011];return _0x359028;};'use strict';var multer=require(_0xd6d5('0x0'));var util=require('util');var path=require(_0xd6d5('0x1'));var timeout=require(_0xd6d5('0x2'));var express=require('express');var router=express[_0xd6d5('0x3')]();var fs_extra=require(_0xd6d5('0x4'));var auth=require(_0xd6d5('0x5'));var interaction=require(_0xd6d5('0x6'));var config=require(_0xd6d5('0x7'));var controller=require(_0xd6d5('0x8'));router[_0xd6d5('0x9')]('/',auth['isAuthenticated'](),controller[_0xd6d5('0xa')]);router[_0xd6d5('0x9')]('/describe',auth[_0xd6d5('0xb')](),controller[_0xd6d5('0xc')]);router[_0xd6d5('0x9')](_0xd6d5('0xd'),auth['isAuthenticated'](),controller[_0xd6d5('0xe')]);router[_0xd6d5('0xf')]('/',auth['isAuthenticated'](),controller[_0xd6d5('0x10')]);router[_0xd6d5('0x11')](_0xd6d5('0xd'),auth[_0xd6d5('0xb')](),controller[_0xd6d5('0x12')]);router[_0xd6d5('0x13')]('/:id',auth[_0xd6d5('0xb')](),controller[_0xd6d5('0x14')]);module[_0xd6d5('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 81a4f1a..8d4bfb5 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 _0xccf2=['get','isAuthenticated','index','/:id','show','getConfigurations','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller'];(function(_0x1a7530,_0x1132ee){var _0x12a450=function(_0x340b43){while(--_0x340b43){_0x1a7530['push'](_0x1a7530['shift']());}};_0x12a450(++_0x1132ee);}(_0xccf2,0x1e4));var _0x2ccf=function(_0x5be46a,_0x2fb035){_0x5be46a=_0x5be46a-0x0;var _0x1ce3b8=_0xccf2[_0x5be46a];return _0x1ce3b8;};'use strict';var multer=require(_0x2ccf('0x0'));var util=require(_0x2ccf('0x1'));var path=require(_0x2ccf('0x2'));var timeout=require(_0x2ccf('0x3'));var express=require(_0x2ccf('0x4'));var router=express[_0x2ccf('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2ccf('0x6'));var interaction=require(_0x2ccf('0x7'));var config=require(_0x2ccf('0x8'));var controller=require(_0x2ccf('0x9'));router[_0x2ccf('0xa')]('/',auth[_0x2ccf('0xb')](),controller[_0x2ccf('0xc')]);router['get'](_0x2ccf('0xd'),auth[_0x2ccf('0xb')](),controller[_0x2ccf('0xe')]);router[_0x2ccf('0xa')]('/:id/configurations',auth[_0x2ccf('0xb')](),controller[_0x2ccf('0xf')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x2ccf('0x10')]);router[_0x2ccf('0x11')]('/',auth['isAuthenticated'](),controller[_0x2ccf('0x12')]);router[_0x2ccf('0x11')](_0x2ccf('0x13'),auth[_0x2ccf('0xb')](),controller[_0x2ccf('0x14')]);router[_0x2ccf('0x15')]('/:id',auth[_0x2ccf('0xb')](),controller[_0x2ccf('0x16')]);router[_0x2ccf('0x17')](_0x2ccf('0xd'),auth[_0x2ccf('0xb')](),controller[_0x2ccf('0x18')]);module[_0x2ccf('0x19')]=router; \ No newline at end of file +var _0xa479=['put','exports','multer','util','express','Router','fs-extra','../../components/auth/service','./intDeskAccount.controller','isAuthenticated','/:id','show','get','/:id/configurations','getConfigurations','getFields','post','addConfiguration'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0xa479,0xfe));var _0x9a47=function(_0x3154ce,_0x519819){_0x3154ce=_0x3154ce-0x0;var _0x4f4c43=_0xa479[_0x3154ce];return _0x4f4c43;};'use strict';var multer=require(_0x9a47('0x0'));var util=require(_0x9a47('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9a47('0x2'));var router=express[_0x9a47('0x3')]();var fs_extra=require(_0x9a47('0x4'));var auth=require(_0x9a47('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9a47('0x6'));router['get']('/',auth[_0x9a47('0x7')](),controller['index']);router['get'](_0x9a47('0x8'),auth[_0x9a47('0x7')](),controller[_0x9a47('0x9')]);router[_0x9a47('0xa')](_0x9a47('0xb'),auth['isAuthenticated'](),controller[_0x9a47('0xc')]);router[_0x9a47('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0x9a47('0xd')]);router[_0x9a47('0xe')]('/',auth[_0x9a47('0x7')](),controller['create']);router[_0x9a47('0xe')](_0x9a47('0xb'),auth['isAuthenticated'](),controller[_0x9a47('0xf')]);router[_0x9a47('0x10')](_0x9a47('0x8'),auth[_0x9a47('0x7')](),controller['update']);router['delete'](_0x9a47('0x8'),auth[_0x9a47('0x7')](),controller['destroy']);module[_0x9a47('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 9cd1140..622e504 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 _0xaf8b=['basic','newTab','integrationTab','sequelize','exports','STRING','ENUM'];(function(_0x1709e7,_0x2ced21){var _0x402819=function(_0x3637a0){while(--_0x3637a0){_0x1709e7['push'](_0x1709e7['shift']());}};_0x402819(++_0x2ced21);}(_0xaf8b,0x199));var _0xbaf8=function(_0x20a21e,_0x1a99e5){_0x20a21e=_0x20a21e-0x0;var _0x5f44cd=_0xaf8b[_0x20a21e];return _0x5f44cd;};'use strict';var Sequelize=require(_0xbaf8('0x0'));module[_0xbaf8('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbaf8('0x2')]},'username':{'type':Sequelize[_0xbaf8('0x2')]},'remoteUri':{'type':Sequelize[_0xbaf8('0x2')]},'authType':{'type':Sequelize[_0xbaf8('0x3')]('basic'),'defaultValue':_0xbaf8('0x4')},'password':{'type':Sequelize[_0xbaf8('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xbaf8('0x2')]},'token':{'type':Sequelize[_0xbaf8('0x2')]},'tokenSecret':{'type':Sequelize[_0xbaf8('0x2')]},'serverUrl':{'type':Sequelize[_0xbaf8('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbaf8('0x3')]('integrationTab',_0xbaf8('0x5')),'defaultValue':_0xbaf8('0x6')}}; \ No newline at end of file +var _0x1262=['exports','STRING','ENUM','basic','integrationTab','sequelize'];(function(_0x5efeea,_0x57d7ca){var _0x120a29=function(_0x5dd966){while(--_0x5dd966){_0x5efeea['push'](_0x5efeea['shift']());}};_0x120a29(++_0x57d7ca);}(_0x1262,0x131));var _0x2126=function(_0x513baf,_0x102de7){_0x513baf=_0x513baf-0x0;var _0x573de4=_0x1262[_0x513baf];return _0x573de4;};'use strict';var Sequelize=require(_0x2126('0x0'));module[_0x2126('0x1')]={'name':{'type':Sequelize[_0x2126('0x2')]},'description':{'type':Sequelize[_0x2126('0x2')]},'username':{'type':Sequelize[_0x2126('0x2')]},'remoteUri':{'type':Sequelize[_0x2126('0x2')]},'authType':{'type':Sequelize[_0x2126('0x3')](_0x2126('0x4')),'defaultValue':_0x2126('0x4')},'password':{'type':Sequelize[_0x2126('0x2')]},'consumerKey':{'type':Sequelize[_0x2126('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x2126('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x2126('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2126('0x3')](_0x2126('0x5'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 46a0f68..53bc4d3 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 _0x5c98=['Content-Range','apply','reject','save','then','error','name','send','map','DeskAccount','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','options','create','body','find','params','getConfigurations','DeskConfiguration','length','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','DeskField','getFields','priority','remoteUri','authType','username','password','consumerSecret','token','tokenSecret','substring','GET','%s/custom_fields','application/json','headers','Authorization','format','toString','base64','concat','_embedded','test','statusCode','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set'];(function(_0x2818d9,_0x345d9e){var _0xd0130c=function(_0x2c4008){while(--_0x2c4008){_0x2818d9['push'](_0x2818d9['shift']());}};_0xd0130c(++_0x345d9e);}(_0x5c98,0xb7));var _0x85c9=function(_0x5242e8,_0x4963fc){_0x5242e8=_0x5242e8-0x0;var _0x27cf95=_0x5c98[_0x5242e8];return _0x27cf95;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x85c9('0x0'));var zipdir=require(_0x85c9('0x1'));var jsonpatch=require(_0x85c9('0x2'));var rp=require(_0x85c9('0x3'));var moment=require('moment');var BPromise=require(_0x85c9('0x4'));var Mustache=require(_0x85c9('0x5'));var util=require(_0x85c9('0x6'));var path=require(_0x85c9('0x7'));var sox=require(_0x85c9('0x8'));var csv=require(_0x85c9('0x9'));var ejs=require(_0x85c9('0xa'));var fs=require('fs');var fs_extra=require(_0x85c9('0xb'));var _=require(_0x85c9('0xc'));var squel=require(_0x85c9('0xd'));var crypto=require('crypto');var jsforce=require(_0x85c9('0xe'));var deskjs=require(_0x85c9('0xf'));var toCsv=require(_0x85c9('0x9'));var querystring=require(_0x85c9('0x10'));var Papa=require(_0x85c9('0x11'));var Redis=require('ioredis');var authService=require(_0x85c9('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x85c9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x85c9('0x14'))('api');var utils=require(_0x85c9('0x15'));var config=require(_0x85c9('0x16'));var licenseUtil=require(_0x85c9('0x17'));var db=require(_0x85c9('0x18'))['db'];var integrations=require(_0x85c9('0x19'));function respondWithStatusCode(_0x1320c7,_0x229055){_0x229055=_0x229055||0xcc;return function(_0x2a64de){if(_0x2a64de){return _0x1320c7[_0x85c9('0x1a')](_0x229055);}return _0x1320c7['status'](_0x229055)[_0x85c9('0x1b')]();};}function respondWithResult(_0x23cdbe,_0xd3d410){_0xd3d410=_0xd3d410||0xc8;return function(_0x1b6011){if(_0x1b6011){return _0x23cdbe[_0x85c9('0x1c')](_0xd3d410)[_0x85c9('0x1d')](_0x1b6011);}};}function respondWithFilteredResult(_0x1d0a36,_0x2ea2e4){return function(_0xe9d36e){if(_0xe9d36e){var _0x4d0a89=typeof _0x2ea2e4[_0x85c9('0x1e')]===_0x85c9('0x1f')&&typeof _0x2ea2e4[_0x85c9('0x20')]===_0x85c9('0x1f');var _0x2e640f=_0xe9d36e[_0x85c9('0x21')];var _0x207b5e=_0x4d0a89?0x0:_0x2ea2e4[_0x85c9('0x1e')];var _0x343953=_0x4d0a89?_0xe9d36e['count']:_0x2ea2e4[_0x85c9('0x1e')]+_0x2ea2e4[_0x85c9('0x20')];var _0x159097;if(_0x343953>=_0x2e640f){_0x343953=_0x2e640f;_0x159097=0xc8;}else{_0x159097=0xce;}_0x1d0a36['status'](_0x159097);return _0x1d0a36[_0x85c9('0x22')](_0x85c9('0x23'),_0x207b5e+'-'+_0x343953+'/'+_0x2e640f)['json'](_0xe9d36e);}return null;};}function patchUpdates(_0x1f74b3){return function(_0x4e50d2){try{jsonpatch[_0x85c9('0x24')](_0x4e50d2,_0x1f74b3,!![]);}catch(_0x96530b){return BPromise[_0x85c9('0x25')](_0x96530b);}return _0x4e50d2[_0x85c9('0x26')]();};}function saveUpdates(_0x1228ad,_0x553cfc){return function(_0x191490){if(_0x191490){return _0x191490['update'](_0x1228ad)['then'](function(_0x1ff0db){return _0x1ff0db;});}return null;};}function removeEntity(_0x11ef15,_0x244d55){return function(_0x4da301){if(_0x4da301){return _0x4da301['destroy']()[_0x85c9('0x27')](function(){_0x11ef15['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c4a39,_0x12d80a){return function(_0x54a85a){if(!_0x54a85a){_0x3c4a39[_0x85c9('0x1a')](0x194);}return _0x54a85a;};}function handleError(_0x107b7b,_0x4c1d2e){_0x4c1d2e=_0x4c1d2e||0x1f4;return function(_0x2a09ff){logger[_0x85c9('0x28')](_0x2a09ff['stack']);if(_0x2a09ff[_0x85c9('0x29')]){delete _0x2a09ff[_0x85c9('0x29')];}_0x107b7b[_0x85c9('0x1c')](_0x4c1d2e)[_0x85c9('0x2a')](_0x2a09ff);};}exports['index']=function(_0x54f65c,_0x52b5f4){var _0x2ae405={},_0x32822e={},_0x9df4cb={'count':0x0,'rows':[]};var _0x5036d3=_[_0x85c9('0x2b')](db[_0x85c9('0x2c')][_0x85c9('0x2d')],function(_0x25677c){return{'name':_0x25677c[_0x85c9('0x2e')],'type':_0x25677c[_0x85c9('0x2f')][_0x85c9('0x30')]};});_0x32822e['model']=_[_0x85c9('0x2b')](_0x5036d3,_0x85c9('0x29'));_0x32822e['query']=_[_0x85c9('0x31')](_0x54f65c[_0x85c9('0x32')]);_0x32822e[_0x85c9('0x33')]=_[_0x85c9('0x34')](_0x32822e[_0x85c9('0x35')],_0x32822e[_0x85c9('0x32')]);_0x2ae405[_0x85c9('0x36')]=_[_0x85c9('0x34')](_0x32822e[_0x85c9('0x35')],qs[_0x85c9('0x37')](_0x54f65c[_0x85c9('0x32')]['fields']));_0x2ae405['attributes']=_0x2ae405['attributes']['length']?_0x2ae405['attributes']:_0x32822e[_0x85c9('0x35')];if(!_0x54f65c['query']['hasOwnProperty'](_0x85c9('0x38'))){_0x2ae405[_0x85c9('0x20')]=qs[_0x85c9('0x20')](_0x54f65c[_0x85c9('0x32')]['limit']);_0x2ae405['offset']=qs[_0x85c9('0x1e')](_0x54f65c[_0x85c9('0x32')][_0x85c9('0x1e')]);}_0x2ae405[_0x85c9('0x39')]=qs[_0x85c9('0x3a')](_0x54f65c[_0x85c9('0x32')][_0x85c9('0x3a')]);_0x2ae405['where']=qs[_0x85c9('0x33')](_[_0x85c9('0x3b')](_0x54f65c[_0x85c9('0x32')],_0x32822e[_0x85c9('0x33')]),_0x5036d3);if(_0x54f65c['query'][_0x85c9('0x3c')]){_0x2ae405[_0x85c9('0x3d')]=_[_0x85c9('0x3e')](_0x2ae405[_0x85c9('0x3d')],{'$or':_[_0x85c9('0x2b')](_0x5036d3,function(_0x250307){if(_0x250307[_0x85c9('0x2f')]!==_0x85c9('0x3f')){var _0x223ba5={};_0x223ba5[_0x250307[_0x85c9('0x29')]]={'$like':'%'+_0x54f65c[_0x85c9('0x32')][_0x85c9('0x3c')]+'%'};return _0x223ba5;}})});}_0x2ae405=_[_0x85c9('0x3e')]({},_0x2ae405,_0x54f65c['options']);var _0x4f5195={'where':_0x2ae405['where']};return db[_0x85c9('0x2c')][_0x85c9('0x21')](_0x4f5195)['then'](function(_0x319bf3){_0x9df4cb[_0x85c9('0x21')]=_0x319bf3;if(_0x54f65c[_0x85c9('0x32')][_0x85c9('0x40')]){_0x2ae405[_0x85c9('0x41')]=[{'all':!![]}];}return db[_0x85c9('0x2c')][_0x85c9('0x42')](_0x2ae405);})[_0x85c9('0x27')](function(_0x403a0c){_0x9df4cb[_0x85c9('0x43')]=_0x403a0c;return _0x9df4cb;})[_0x85c9('0x27')](respondWithFilteredResult(_0x52b5f4,_0x2ae405))[_0x85c9('0x44')](handleError(_0x52b5f4,null));};exports['show']=function(_0x28292d,_0x32670b){var _0x2f3553={'raw':![],'where':{'id':_0x28292d['params']['id']}},_0x19fb57={};_0x19fb57[_0x85c9('0x35')]=_[_0x85c9('0x31')](db[_0x85c9('0x2c')]['rawAttributes']);_0x19fb57[_0x85c9('0x32')]=_[_0x85c9('0x31')](_0x28292d[_0x85c9('0x32')]);_0x19fb57[_0x85c9('0x33')]=_['intersection'](_0x19fb57[_0x85c9('0x35')],_0x19fb57[_0x85c9('0x32')]);_0x2f3553[_0x85c9('0x36')]=_[_0x85c9('0x34')](_0x19fb57['model'],qs[_0x85c9('0x37')](_0x28292d[_0x85c9('0x32')][_0x85c9('0x37')]));_0x2f3553[_0x85c9('0x36')]=_0x2f3553[_0x85c9('0x36')]['length']?_0x2f3553['attributes']:_0x19fb57[_0x85c9('0x35')];if(_0x28292d[_0x85c9('0x32')][_0x85c9('0x40')]){_0x2f3553[_0x85c9('0x41')]=[{'all':!![]}];}_0x2f3553=_[_0x85c9('0x3e')]({},_0x2f3553,_0x28292d[_0x85c9('0x45')]);return db['DeskAccount']['find'](_0x2f3553)['then'](handleEntityNotFound(_0x32670b,null))[_0x85c9('0x27')](respondWithResult(_0x32670b,null))[_0x85c9('0x44')](handleError(_0x32670b,null));};exports[_0x85c9('0x46')]=function(_0x2bff30,_0x1a6807){return db[_0x85c9('0x2c')][_0x85c9('0x46')](_0x2bff30[_0x85c9('0x47')],{})['then'](respondWithResult(_0x1a6807,0xc9))[_0x85c9('0x44')](handleError(_0x1a6807,null));};exports['update']=function(_0xb1b918,_0x5e9bd4){if(_0xb1b918['body']['id']){delete _0xb1b918[_0x85c9('0x47')]['id'];}return db['DeskAccount'][_0x85c9('0x48')]({'where':{'id':_0xb1b918[_0x85c9('0x49')]['id']}})['then'](handleEntityNotFound(_0x5e9bd4,null))['then'](saveUpdates(_0xb1b918['body'],null))[_0x85c9('0x27')](respondWithResult(_0x5e9bd4,null))[_0x85c9('0x44')](handleError(_0x5e9bd4,null));};exports['destroy']=function(_0x1c6dd5,_0x49761f){return db['DeskAccount'][_0x85c9('0x48')]({'where':{'id':_0x1c6dd5[_0x85c9('0x49')]['id']}})['then'](handleEntityNotFound(_0x49761f,null))[_0x85c9('0x27')](removeEntity(_0x49761f,null))[_0x85c9('0x44')](handleError(_0x49761f,null));};exports[_0x85c9('0x4a')]=function(_0x4543d2,_0x167519,_0x337398){var _0x1813df={};var _0x253557={};var _0x4c4b9d;var _0x2b84b9;return db[_0x85c9('0x2c')]['findOne']({'where':{'id':_0x4543d2[_0x85c9('0x49')]['id']}})['then'](handleEntityNotFound(_0x167519,null))[_0x85c9('0x27')](function(_0x3d421a){if(_0x3d421a){_0x4c4b9d=_0x3d421a;_0x253557[_0x85c9('0x35')]=_[_0x85c9('0x31')](db[_0x85c9('0x4b')]['rawAttributes']);_0x253557['query']=_[_0x85c9('0x31')](_0x4543d2['query']);_0x253557[_0x85c9('0x33')]=_['intersection'](_0x253557[_0x85c9('0x35')],_0x253557['query']);_0x1813df[_0x85c9('0x36')]=_[_0x85c9('0x34')](_0x253557[_0x85c9('0x35')],qs[_0x85c9('0x37')](_0x4543d2[_0x85c9('0x32')][_0x85c9('0x37')]));_0x1813df['attributes']=_0x1813df[_0x85c9('0x36')][_0x85c9('0x4c')]?_0x1813df[_0x85c9('0x36')]:_0x253557['model'];_0x1813df[_0x85c9('0x39')]=qs[_0x85c9('0x3a')](_0x4543d2['query'][_0x85c9('0x3a')]);_0x1813df[_0x85c9('0x3d')]=qs[_0x85c9('0x33')](_[_0x85c9('0x3b')](_0x4543d2[_0x85c9('0x32')],_0x253557[_0x85c9('0x33')]));if(_0x4543d2[_0x85c9('0x32')][_0x85c9('0x3c')]){_0x1813df[_0x85c9('0x3d')]=_[_0x85c9('0x3e')](_0x1813df[_0x85c9('0x3d')],{'$or':_['map'](_0x1813df[_0x85c9('0x36')],function(_0x27d0b1){var _0x28879a={};_0x28879a[_0x27d0b1]={'$like':'%'+_0x4543d2[_0x85c9('0x32')][_0x85c9('0x3c')]+'%'};return _0x28879a;})});}_0x1813df=_[_0x85c9('0x3e')]({},_0x1813df,_0x4543d2['options']);return _0x4c4b9d['getConfigurations'](_0x1813df);}})[_0x85c9('0x27')](function(_0x1ec9a8){if(_0x1ec9a8){_0x2b84b9=_0x1ec9a8['length'];if(!_0x4543d2[_0x85c9('0x32')]['hasOwnProperty']('nolimit')){_0x1813df[_0x85c9('0x20')]=qs[_0x85c9('0x20')](_0x4543d2[_0x85c9('0x32')][_0x85c9('0x20')]);_0x1813df['offset']=qs['offset'](_0x4543d2['query'][_0x85c9('0x1e')]);}return _0x4c4b9d['getConfigurations'](_0x1813df);}})[_0x85c9('0x27')](function(_0x53313f){if(_0x53313f){return _0x53313f?{'count':_0x2b84b9,'rows':_0x53313f}:null;}})['then'](respondWithResult(_0x167519,null))[_0x85c9('0x44')](handleError(_0x167519,null));};exports[_0x85c9('0x4d')]=function(_0x1ce455,_0x189730,_0x2df81a){if(_0x1ce455[_0x85c9('0x47')]['id']){delete _0x1ce455[_0x85c9('0x47')]['id'];}return db['DeskAccount'][_0x85c9('0x4e')]({'where':{'id':_0x1ce455['params']['id']}})['then'](handleEntityNotFound(_0x189730,null))[_0x85c9('0x27')](function(_0x144150){if(_0x144150){_0x1ce455[_0x85c9('0x47')][_0x85c9('0x4f')]=_0x144150['id'];_0x1ce455[_0x85c9('0x47')][_0x85c9('0x50')]=integrations[_0x85c9('0x51')](_0x1ce455[_0x85c9('0x47')][_0x85c9('0x52')],_0x1ce455[_0x85c9('0x47')][_0x85c9('0x2f')]);_0x1ce455[_0x85c9('0x47')][_0x85c9('0x53')]=integrations['getDescriptions'](_0x1ce455[_0x85c9('0x47')]['channel'],_0x1ce455['body'][_0x85c9('0x2f')]);return db[_0x85c9('0x4b')][_0x85c9('0x46')](_0x1ce455[_0x85c9('0x47')],{'include':[{'model':db['DeskField'],'as':'Subjects'},{'model':db[_0x85c9('0x54')],'as':_0x85c9('0x53')}]});}return null;})[_0x85c9('0x27')](respondWithResult(_0x189730,null))[_0x85c9('0x44')](handleError(_0x189730,null));};exports[_0x85c9('0x55')]=function(_0x259066,_0x3b7088,_0x5c6bb5){var _0x26f22e=[{'name':_0x85c9('0x56'),'label':_0x85c9('0x56'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x1d5d19='';return db[_0x85c9('0x2c')]['findOne']({'where':{'id':_0x259066[_0x85c9('0x49')]['id']},'attributes':['id',_0x85c9('0x57'),_0x85c9('0x58'),_0x85c9('0x59'),_0x85c9('0x5a'),'consumerKey',_0x85c9('0x5b'),_0x85c9('0x5c'),_0x85c9('0x5d')]})[_0x85c9('0x27')](handleEntityNotFound(_0x3b7088,null))[_0x85c9('0x27')](function(_0x2e2275){if(_0x2e2275){_0x1d5d19=_0x2e2275['remoteUri'];var _0x2dd619=_0x1d5d19['slice'](-0x1);if(_0x2dd619==='/'){_0x1d5d19=_0x1d5d19[_0x85c9('0x5e')](0x0,_0x1d5d19['lastIndexOf'](_0x2dd619));}var _0x20471e={'method':_0x85c9('0x5f'),'uri':util['format'](_0x85c9('0x60'),_0x1d5d19),'headers':{'Content-Type':_0x85c9('0x61'),'Accept':'application/json'},'json':!![]};if(_0x2e2275[_0x85c9('0x58')]==='basic'){_0x20471e[_0x85c9('0x62')][_0x85c9('0x63')]=util['format']('Basic\x20%s',new Buffer(util[_0x85c9('0x64')]('%s:%s',_0x2e2275[_0x85c9('0x59')],_0x2e2275[_0x85c9('0x5a')]))[_0x85c9('0x65')](_0x85c9('0x66')));}return rp(_0x20471e)['then'](function(_0x3c47ed){return _0x26f22e[_0x85c9('0x67')](_['map'](_0x3c47ed[_0x85c9('0x68')]['entries'],function(_0xacc489){return{'id':_0xacc489['name'],'name':_0xacc489[_0x85c9('0x29')],'type':_0xacc489[_0x85c9('0x2f')],'active':_0xacc489['active'],'label':_0xacc489['label'],'custom':!![]};}));});}})[_0x85c9('0x27')](function(_0x251032){return{'count':_0x251032[_0x85c9('0x4c')],'rows':_0x251032};})['then'](respondWithResult(_0x3b7088,null))[_0x85c9('0x44')](function(_0xff95cf){var _0x15f64b=_0x259066[_0x85c9('0x32')][_0x85c9('0x69')]?0x1f4:_0xff95cf[_0x85c9('0x6a')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x15f64b,JSON[_0x85c9('0x6b')](_0xff95cf));delete _0xff95cf[_0x85c9('0x29')];if(_0x15f64b===0x191){_0x15f64b=0x190;}_0x3b7088[_0x85c9('0x1c')](_0x15f64b)['send'](_0x259066[_0x85c9('0x32')][_0x85c9('0x69')]?{'message':_0x85c9('0x6c'),'statusCode':_0xff95cf[_0x85c9('0x6a')]}:_0xff95cf);});}; \ No newline at end of file +var _0x4deb=['tokenSecret','slice','substring','lastIndexOf','GET','%s/custom_fields','application/json','headers','Basic\x20%s','format','%s:%s','toString','concat','_embedded','entries','label','statusCode','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','error','name','send','index','DeskAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','then','include','show','includeAll','options','catch','create','body','params','find','getConfigurations','findOne','DeskConfiguration','order','pick','AccountId','getSubjects','Descriptions','getDescriptions','Subjects','getFields','priority','remoteUri','authType','username','password','consumerSecret','token'];(function(_0x34fd33,_0x380ab){var _0xae5d03=function(_0x2a9b4e){while(--_0x2a9b4e){_0x34fd33['push'](_0x34fd33['shift']());}};_0xae5d03(++_0x380ab);}(_0x4deb,0x166));var _0xb4de=function(_0x35af98,_0x103f33){_0x35af98=_0x35af98-0x0;var _0x5f5a62=_0x4deb[_0x35af98];return _0x5f5a62;};'use strict';var emlformat=require(_0xb4de('0x0'));var rimraf=require(_0xb4de('0x1'));var zipdir=require(_0xb4de('0x2'));var jsonpatch=require(_0xb4de('0x3'));var rp=require(_0xb4de('0x4'));var moment=require(_0xb4de('0x5'));var BPromise=require(_0xb4de('0x6'));var Mustache=require(_0xb4de('0x7'));var util=require(_0xb4de('0x8'));var path=require(_0xb4de('0x9'));var sox=require(_0xb4de('0xa'));var csv=require(_0xb4de('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb4de('0xc'));var _=require(_0xb4de('0xd'));var squel=require(_0xb4de('0xe'));var crypto=require(_0xb4de('0xf'));var jsforce=require(_0xb4de('0x10'));var deskjs=require(_0xb4de('0x11'));var toCsv=require('to-csv');var querystring=require(_0xb4de('0x12'));var Papa=require(_0xb4de('0x13'));var Redis=require(_0xb4de('0x14'));var authService=require(_0xb4de('0x15'));var qs=require(_0xb4de('0x16'));var as=require(_0xb4de('0x17'));var hardwareService=require(_0xb4de('0x18'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xb4de('0x19'));var licenseUtil=require(_0xb4de('0x1a'));var db=require(_0xb4de('0x1b'))['db'];var integrations=require(_0xb4de('0x1c'));function respondWithStatusCode(_0x341abf,_0x37b046){_0x37b046=_0x37b046||0xcc;return function(_0x644c8d){if(_0x644c8d){return _0x341abf[_0xb4de('0x1d')](_0x37b046);}return _0x341abf[_0xb4de('0x1e')](_0x37b046)[_0xb4de('0x1f')]();};}function respondWithResult(_0x103ddb,_0x9f50bd){_0x9f50bd=_0x9f50bd||0xc8;return function(_0x50bead){if(_0x50bead){return _0x103ddb['status'](_0x9f50bd)[_0xb4de('0x20')](_0x50bead);}};}function respondWithFilteredResult(_0x271002,_0x3146ea){return function(_0x782af8){if(_0x782af8){var _0x3ef589=typeof _0x3146ea[_0xb4de('0x21')]===_0xb4de('0x22')&&typeof _0x3146ea[_0xb4de('0x23')]===_0xb4de('0x22');var _0x658273=_0x782af8['count'];var _0x3df28f=_0x3ef589?0x0:_0x3146ea['offset'];var _0x142811=_0x3ef589?_0x782af8[_0xb4de('0x24')]:_0x3146ea[_0xb4de('0x21')]+_0x3146ea[_0xb4de('0x23')];var _0x5554be;if(_0x142811>=_0x658273){_0x142811=_0x658273;_0x5554be=0xc8;}else{_0x5554be=0xce;}_0x271002[_0xb4de('0x1e')](_0x5554be);return _0x271002[_0xb4de('0x25')]('Content-Range',_0x3df28f+'-'+_0x142811+'/'+_0x658273)[_0xb4de('0x20')](_0x782af8);}return null;};}function patchUpdates(_0x30cf3b){return function(_0x33c000){try{jsonpatch[_0xb4de('0x26')](_0x33c000,_0x30cf3b,!![]);}catch(_0x2f10ef){return BPromise[_0xb4de('0x27')](_0x2f10ef);}return _0x33c000[_0xb4de('0x28')]();};}function saveUpdates(_0x50c44b,_0x11911f){return function(_0x31079e){if(_0x31079e){return _0x31079e[_0xb4de('0x29')](_0x50c44b)['then'](function(_0x48f90e){return _0x48f90e;});}return null;};}function removeEntity(_0x4e543f,_0x5a9c4c){return function(_0x743e23){if(_0x743e23){return _0x743e23[_0xb4de('0x2a')]()['then'](function(){_0x4e543f[_0xb4de('0x1e')](0xcc)[_0xb4de('0x1f')]();});}};}function handleEntityNotFound(_0x1262df,_0x2dab22){return function(_0xf2049a){if(!_0xf2049a){_0x1262df[_0xb4de('0x1d')](0x194);}return _0xf2049a;};}function handleError(_0x5b5096,_0x4a2bcc){_0x4a2bcc=_0x4a2bcc||0x1f4;return function(_0x2a74bb){logger[_0xb4de('0x2b')](_0x2a74bb['stack']);if(_0x2a74bb[_0xb4de('0x2c')]){delete _0x2a74bb[_0xb4de('0x2c')];}_0x5b5096[_0xb4de('0x1e')](_0x4a2bcc)[_0xb4de('0x2d')](_0x2a74bb);};}exports[_0xb4de('0x2e')]=function(_0x32d154,_0x46525d){var _0x426ab3={},_0x3f65ad={},_0x2280f2={'count':0x0,'rows':[]};var _0x5dc5de=_['map'](db[_0xb4de('0x2f')][_0xb4de('0x30')],function(_0x28dff0){return{'name':_0x28dff0[_0xb4de('0x31')],'type':_0x28dff0[_0xb4de('0x32')]['key']};});_0x3f65ad[_0xb4de('0x33')]=_[_0xb4de('0x34')](_0x5dc5de,_0xb4de('0x2c'));_0x3f65ad[_0xb4de('0x35')]=_[_0xb4de('0x36')](_0x32d154[_0xb4de('0x35')]);_0x3f65ad[_0xb4de('0x37')]=_[_0xb4de('0x38')](_0x3f65ad[_0xb4de('0x33')],_0x3f65ad[_0xb4de('0x35')]);_0x426ab3[_0xb4de('0x39')]=_[_0xb4de('0x38')](_0x3f65ad[_0xb4de('0x33')],qs['fields'](_0x32d154[_0xb4de('0x35')][_0xb4de('0x3a')]));_0x426ab3['attributes']=_0x426ab3['attributes'][_0xb4de('0x3b')]?_0x426ab3['attributes']:_0x3f65ad[_0xb4de('0x33')];if(!_0x32d154[_0xb4de('0x35')][_0xb4de('0x3c')](_0xb4de('0x3d'))){_0x426ab3[_0xb4de('0x23')]=qs[_0xb4de('0x23')](_0x32d154['query'][_0xb4de('0x23')]);_0x426ab3[_0xb4de('0x21')]=qs['offset'](_0x32d154[_0xb4de('0x35')][_0xb4de('0x21')]);}_0x426ab3['order']=qs[_0xb4de('0x3e')](_0x32d154[_0xb4de('0x35')][_0xb4de('0x3e')]);_0x426ab3[_0xb4de('0x3f')]=qs[_0xb4de('0x37')](_['pick'](_0x32d154['query'],_0x3f65ad[_0xb4de('0x37')]),_0x5dc5de);if(_0x32d154[_0xb4de('0x35')][_0xb4de('0x40')]){_0x426ab3['where']=_[_0xb4de('0x41')](_0x426ab3[_0xb4de('0x3f')],{'$or':_[_0xb4de('0x34')](_0x5dc5de,function(_0x43fa71){if(_0x43fa71[_0xb4de('0x32')]!=='VIRTUAL'){var _0x5737a8={};_0x5737a8[_0x43fa71[_0xb4de('0x2c')]]={'$like':'%'+_0x32d154[_0xb4de('0x35')][_0xb4de('0x40')]+'%'};return _0x5737a8;}})});}_0x426ab3=_[_0xb4de('0x41')]({},_0x426ab3,_0x32d154['options']);var _0x23ec94={'where':_0x426ab3[_0xb4de('0x3f')]};return db[_0xb4de('0x2f')][_0xb4de('0x24')](_0x23ec94)[_0xb4de('0x42')](function(_0x8f74b7){_0x2280f2[_0xb4de('0x24')]=_0x8f74b7;if(_0x32d154[_0xb4de('0x35')]['includeAll']){_0x426ab3[_0xb4de('0x43')]=[{'all':!![]}];}return db['DeskAccount']['findAll'](_0x426ab3);})[_0xb4de('0x42')](function(_0x183b86){_0x2280f2['rows']=_0x183b86;return _0x2280f2;})[_0xb4de('0x42')](respondWithFilteredResult(_0x46525d,_0x426ab3))['catch'](handleError(_0x46525d,null));};exports[_0xb4de('0x44')]=function(_0x4e0369,_0x907a4d){var _0x529a0b={'raw':![],'where':{'id':_0x4e0369['params']['id']}},_0x15c198={};_0x15c198[_0xb4de('0x33')]=_[_0xb4de('0x36')](db['DeskAccount'][_0xb4de('0x30')]);_0x15c198['query']=_[_0xb4de('0x36')](_0x4e0369['query']);_0x15c198[_0xb4de('0x37')]=_[_0xb4de('0x38')](_0x15c198[_0xb4de('0x33')],_0x15c198[_0xb4de('0x35')]);_0x529a0b['attributes']=_[_0xb4de('0x38')](_0x15c198[_0xb4de('0x33')],qs[_0xb4de('0x3a')](_0x4e0369[_0xb4de('0x35')][_0xb4de('0x3a')]));_0x529a0b[_0xb4de('0x39')]=_0x529a0b['attributes']['length']?_0x529a0b[_0xb4de('0x39')]:_0x15c198[_0xb4de('0x33')];if(_0x4e0369[_0xb4de('0x35')][_0xb4de('0x45')]){_0x529a0b[_0xb4de('0x43')]=[{'all':!![]}];}_0x529a0b=_['merge']({},_0x529a0b,_0x4e0369[_0xb4de('0x46')]);return db['DeskAccount']['find'](_0x529a0b)[_0xb4de('0x42')](handleEntityNotFound(_0x907a4d,null))[_0xb4de('0x42')](respondWithResult(_0x907a4d,null))[_0xb4de('0x47')](handleError(_0x907a4d,null));};exports[_0xb4de('0x48')]=function(_0x537f8d,_0x30926a){return db[_0xb4de('0x2f')][_0xb4de('0x48')](_0x537f8d['body'],{})[_0xb4de('0x42')](respondWithResult(_0x30926a,0xc9))[_0xb4de('0x47')](handleError(_0x30926a,null));};exports[_0xb4de('0x29')]=function(_0x44c23f,_0xf0c18a){if(_0x44c23f[_0xb4de('0x49')]['id']){delete _0x44c23f[_0xb4de('0x49')]['id'];}return db[_0xb4de('0x2f')]['find']({'where':{'id':_0x44c23f[_0xb4de('0x4a')]['id']}})[_0xb4de('0x42')](handleEntityNotFound(_0xf0c18a,null))['then'](saveUpdates(_0x44c23f[_0xb4de('0x49')],null))['then'](respondWithResult(_0xf0c18a,null))[_0xb4de('0x47')](handleError(_0xf0c18a,null));};exports['destroy']=function(_0x3c2fdd,_0x9e7b31){return db[_0xb4de('0x2f')][_0xb4de('0x4b')]({'where':{'id':_0x3c2fdd['params']['id']}})['then'](handleEntityNotFound(_0x9e7b31,null))['then'](removeEntity(_0x9e7b31,null))['catch'](handleError(_0x9e7b31,null));};exports[_0xb4de('0x4c')]=function(_0x5bcd06,_0x44d23d,_0x287240){var _0x76ce16={};var _0x48fcfa={};var _0x29e36e;var _0x2c9b53;return db['DeskAccount'][_0xb4de('0x4d')]({'where':{'id':_0x5bcd06[_0xb4de('0x4a')]['id']}})[_0xb4de('0x42')](handleEntityNotFound(_0x44d23d,null))[_0xb4de('0x42')](function(_0x220857){if(_0x220857){_0x29e36e=_0x220857;_0x48fcfa['model']=_[_0xb4de('0x36')](db[_0xb4de('0x4e')][_0xb4de('0x30')]);_0x48fcfa['query']=_[_0xb4de('0x36')](_0x5bcd06[_0xb4de('0x35')]);_0x48fcfa[_0xb4de('0x37')]=_['intersection'](_0x48fcfa[_0xb4de('0x33')],_0x48fcfa[_0xb4de('0x35')]);_0x76ce16[_0xb4de('0x39')]=_[_0xb4de('0x38')](_0x48fcfa[_0xb4de('0x33')],qs[_0xb4de('0x3a')](_0x5bcd06[_0xb4de('0x35')][_0xb4de('0x3a')]));_0x76ce16[_0xb4de('0x39')]=_0x76ce16['attributes'][_0xb4de('0x3b')]?_0x76ce16[_0xb4de('0x39')]:_0x48fcfa[_0xb4de('0x33')];_0x76ce16[_0xb4de('0x4f')]=qs['sort'](_0x5bcd06['query'][_0xb4de('0x3e')]);_0x76ce16[_0xb4de('0x3f')]=qs[_0xb4de('0x37')](_[_0xb4de('0x50')](_0x5bcd06[_0xb4de('0x35')],_0x48fcfa['filters']));if(_0x5bcd06[_0xb4de('0x35')][_0xb4de('0x40')]){_0x76ce16[_0xb4de('0x3f')]=_[_0xb4de('0x41')](_0x76ce16['where'],{'$or':_[_0xb4de('0x34')](_0x76ce16[_0xb4de('0x39')],function(_0x5d8a6e){var _0x5b37e3={};_0x5b37e3[_0x5d8a6e]={'$like':'%'+_0x5bcd06[_0xb4de('0x35')][_0xb4de('0x40')]+'%'};return _0x5b37e3;})});}_0x76ce16=_['merge']({},_0x76ce16,_0x5bcd06['options']);return _0x29e36e['getConfigurations'](_0x76ce16);}})[_0xb4de('0x42')](function(_0x27232a){if(_0x27232a){_0x2c9b53=_0x27232a[_0xb4de('0x3b')];if(!_0x5bcd06[_0xb4de('0x35')]['hasOwnProperty'](_0xb4de('0x3d'))){_0x76ce16[_0xb4de('0x23')]=qs[_0xb4de('0x23')](_0x5bcd06[_0xb4de('0x35')][_0xb4de('0x23')]);_0x76ce16[_0xb4de('0x21')]=qs[_0xb4de('0x21')](_0x5bcd06[_0xb4de('0x35')][_0xb4de('0x21')]);}return _0x29e36e[_0xb4de('0x4c')](_0x76ce16);}})['then'](function(_0x5b9d9c){if(_0x5b9d9c){return _0x5b9d9c?{'count':_0x2c9b53,'rows':_0x5b9d9c}:null;}})[_0xb4de('0x42')](respondWithResult(_0x44d23d,null))[_0xb4de('0x47')](handleError(_0x44d23d,null));};exports['addConfiguration']=function(_0x220e24,_0x2d1ade,_0x3ed98e){if(_0x220e24[_0xb4de('0x49')]['id']){delete _0x220e24[_0xb4de('0x49')]['id'];}return db[_0xb4de('0x2f')][_0xb4de('0x4d')]({'where':{'id':_0x220e24[_0xb4de('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2d1ade,null))[_0xb4de('0x42')](function(_0x2eb3e7){if(_0x2eb3e7){_0x220e24['body'][_0xb4de('0x51')]=_0x2eb3e7['id'];_0x220e24[_0xb4de('0x49')]['Subjects']=integrations[_0xb4de('0x52')](_0x220e24['body']['channel'],_0x220e24[_0xb4de('0x49')][_0xb4de('0x32')]);_0x220e24[_0xb4de('0x49')][_0xb4de('0x53')]=integrations[_0xb4de('0x54')](_0x220e24[_0xb4de('0x49')]['channel'],_0x220e24[_0xb4de('0x49')][_0xb4de('0x32')]);return db[_0xb4de('0x4e')][_0xb4de('0x48')](_0x220e24[_0xb4de('0x49')],{'include':[{'model':db['DeskField'],'as':_0xb4de('0x55')},{'model':db['DeskField'],'as':_0xb4de('0x53')}]});}return null;})[_0xb4de('0x42')](respondWithResult(_0x2d1ade,null))[_0xb4de('0x47')](handleError(_0x2d1ade,null));};exports[_0xb4de('0x56')]=function(_0x8fe4e1,_0x1e592c,_0x1659b8){var _0x1a2d9d=[{'name':_0xb4de('0x57'),'label':_0xb4de('0x57'),'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 _0x155863='';return db[_0xb4de('0x2f')]['findOne']({'where':{'id':_0x8fe4e1['params']['id']},'attributes':['id',_0xb4de('0x58'),_0xb4de('0x59'),_0xb4de('0x5a'),_0xb4de('0x5b'),'consumerKey',_0xb4de('0x5c'),_0xb4de('0x5d'),_0xb4de('0x5e')]})[_0xb4de('0x42')](handleEntityNotFound(_0x1e592c,null))['then'](function(_0x4f07c8){if(_0x4f07c8){_0x155863=_0x4f07c8['remoteUri'];var _0x426520=_0x155863[_0xb4de('0x5f')](-0x1);if(_0x426520==='/'){_0x155863=_0x155863[_0xb4de('0x60')](0x0,_0x155863[_0xb4de('0x61')](_0x426520));}var _0x5ea0d0={'method':_0xb4de('0x62'),'uri':util['format'](_0xb4de('0x63'),_0x155863),'headers':{'Content-Type':'application/json','Accept':_0xb4de('0x64')},'json':!![]};if(_0x4f07c8[_0xb4de('0x59')]==='basic'){_0x5ea0d0[_0xb4de('0x65')]['Authorization']=util['format'](_0xb4de('0x66'),new Buffer(util[_0xb4de('0x67')](_0xb4de('0x68'),_0x4f07c8[_0xb4de('0x5a')],_0x4f07c8[_0xb4de('0x5b')]))[_0xb4de('0x69')]('base64'));}return rp(_0x5ea0d0)[_0xb4de('0x42')](function(_0x3ab4e7){return _0x1a2d9d[_0xb4de('0x6a')](_[_0xb4de('0x34')](_0x3ab4e7[_0xb4de('0x6b')][_0xb4de('0x6c')],function(_0x3f40a5){return{'id':_0x3f40a5[_0xb4de('0x2c')],'name':_0x3f40a5[_0xb4de('0x2c')],'type':_0x3f40a5['type'],'active':_0x3f40a5['active'],'label':_0x3f40a5[_0xb4de('0x6d')],'custom':!![]};}));});}})[_0xb4de('0x42')](function(_0x57940e){return{'count':_0x57940e[_0xb4de('0x3b')],'rows':_0x57940e};})['then'](respondWithResult(_0x1e592c,null))[_0xb4de('0x47')](function(_0x95c072){var _0x5f324a=_0x8fe4e1['query']['test']?0x1f4:_0x95c072[_0xb4de('0x6e')]||0x1f4;logger[_0xb4de('0x2b')]('getFields,\x20%s,\x20%s,\x20%s',_0xb4de('0x56'),_0x5f324a,JSON['stringify'](_0x95c072));delete _0x95c072[_0xb4de('0x2c')];if(_0x5f324a===0x191){_0x5f324a=0x190;}_0x1e592c['status'](_0x5f324a)[_0xb4de('0x2d')](_0x8fe4e1[_0xb4de('0x35')][_0xb4de('0x6f')]?{'message':_0xb4de('0x70'),'statusCode':_0x95c072[_0xb4de('0x6e')]}:_0x95c072);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 3954d28..f822262 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 _0xaeb9=['./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','moment','path','rimraf'];(function(_0xe1f858,_0xb86c44){var _0x367af6=function(_0x40ee87){while(--_0x40ee87){_0xe1f858['push'](_0xe1f858['shift']());}};_0x367af6(++_0xb86c44);}(_0xaeb9,0x17a));var _0x9aeb=function(_0x27a336,_0x4ad3ee){_0x27a336=_0x27a336-0x0;var _0x52d0b9=_0xaeb9[_0x27a336];return _0x52d0b9;};'use strict';var _=require(_0x9aeb('0x0'));var util=require(_0x9aeb('0x1'));var logger=require(_0x9aeb('0x2'))('api');var moment=require(_0x9aeb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9aeb('0x4'));var rimraf=require(_0x9aeb('0x5'));var config=require('../../config/environment');var attributes=require(_0x9aeb('0x6'));var integrations=require(_0x9aeb('0x7'));module[_0x9aeb('0x8')]=function(_0x3f0324,_0x228551){return _0x3f0324[_0x9aeb('0x9')](_0x9aeb('0xa'),attributes,{'tableName':_0x9aeb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x92d6=['../../config/environment','./intDeskAccount.attributes','exports','define','DeskAccount','int_desk_accounts','lodash','util','api','moment','bluebird','request-promise'];(function(_0x16f8b8,_0x104860){var _0x4151f3=function(_0xdd00e8){while(--_0xdd00e8){_0x16f8b8['push'](_0x16f8b8['shift']());}};_0x4151f3(++_0x104860);}(_0x92d6,0xae));var _0x692d=function(_0x2b87a8,_0x15d4f1){_0x2b87a8=_0x2b87a8-0x0;var _0x51e15b=_0x92d6[_0x2b87a8];return _0x51e15b;};'use strict';var _=require(_0x692d('0x0'));var util=require(_0x692d('0x1'));var logger=require('../../config/logger')(_0x692d('0x2'));var moment=require(_0x692d('0x3'));var BPromise=require(_0x692d('0x4'));var rp=require(_0x692d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x692d('0x6'));var attributes=require(_0x692d('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x692d('0x8')]=function(_0x4f9571,_0x4c6ebe){return _0x4f9571[_0x692d('0x9')](_0x692d('0xa'),attributes,{'tableName':_0x692d('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 2b9ffb3..7de5c2d 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 _0x314e=['then','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetDeskAccount','DeskAccount','options','raw','where','attributes','limit','include','model','map','ShowDeskAccount'];(function(_0x162d31,_0xa7a81b){var _0x449977=function(_0xc1b381){while(--_0xc1b381){_0x162d31['push'](_0x162d31['shift']());}};_0x449977(++_0xa7a81b);}(_0x314e,0xa1));var _0xe314=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x314e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xe314('0x0'));var moment=require(_0xe314('0x1'));var BPromise=require('bluebird');var rs=require(_0xe314('0x2'));var fs=require('fs');var Redis=require(_0xe314('0x3'));var db=require(_0xe314('0x4'))['db'];var utils=require(_0xe314('0x5'));var logger=require('../../config/logger')(_0xe314('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe314('0x7')][_0xe314('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4dc7a7,_0x4f4d54,_0x11fd97){return new BPromise(function(_0x40dade,_0x5018b4){return client['request'](_0x4dc7a7,_0x11fd97)['then'](function(_0x1216c5){logger['info'](_0xe314('0x9'),_0x4f4d54,_0xe314('0xa'));logger[_0xe314('0xb')](_0xe314('0xc'),_0x4f4d54,_0xe314('0xa'),JSON[_0xe314('0xd')](_0x1216c5));if(_0x1216c5['error']){if(_0x1216c5[_0xe314('0xe')][_0xe314('0xf')]===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x4f4d54,_0x1216c5['error']['message']);return _0x5018b4(_0x1216c5['error'][_0xe314('0x10')]);}logger[_0xe314('0xe')](_0xe314('0x9'),_0x4f4d54,_0x1216c5['error'][_0xe314('0x10')]);return _0x40dade(_0x1216c5[_0xe314('0xe')][_0xe314('0x10')]);}else{logger[_0xe314('0x11')](_0xe314('0x9'),_0x4f4d54,_0xe314('0xa'));_0x40dade(_0x1216c5[_0xe314('0x12')][_0xe314('0x10')]);}})[_0xe314('0x13')](function(_0x557134){logger[_0xe314('0xe')](_0xe314('0x9'),_0x4f4d54,_0x557134);_0x5018b4(_0x557134);});});}exports[_0xe314('0x14')]=function(_0x3aa234){var _0x1ef994=this;return new Promise(function(_0x2dd934,_0xb5538){return db[_0xe314('0x15')]['findAll']({'raw':_0x3aa234['options']?_0x3aa234[_0xe314('0x16')][_0xe314('0x17')]===undefined?!![]:![]:!![],'where':_0x3aa234[_0xe314('0x16')]?_0x3aa234[_0xe314('0x16')][_0xe314('0x18')]||null:null,'attributes':_0x3aa234['options']?_0x3aa234[_0xe314('0x16')][_0xe314('0x19')]||null:null,'limit':_0x3aa234[_0xe314('0x16')]?_0x3aa234[_0xe314('0x16')][_0xe314('0x1a')]||null:null,'include':_0x3aa234[_0xe314('0x16')]?_0x3aa234['options'][_0xe314('0x1b')]?_['map'](_0x3aa234['options'][_0xe314('0x1b')],function(_0x3f65a4){return{'model':db[_0x3f65a4[_0xe314('0x1c')]],'as':_0x3f65a4['as'],'attributes':_0x3f65a4['attributes'],'include':_0x3f65a4[_0xe314('0x1b')]?_[_0xe314('0x1d')](_0x3f65a4['include'],function(_0x40d748){return{'model':db[_0x40d748['model']],'as':_0x40d748['as'],'attributes':_0x40d748['attributes'],'include':_0x40d748['include']?_['map'](_0x40d748[_0xe314('0x1b')],function(_0x132760){return{'model':db[_0x132760[_0xe314('0x1c')]],'as':_0x132760['as'],'attributes':_0x132760[_0xe314('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2868d1){logger[_0xe314('0x11')]('GetDeskAccount',_0x3aa234);logger[_0xe314('0xb')](_0xe314('0x14'),_0x3aa234,JSON[_0xe314('0xd')](_0x2868d1));_0x2dd934(_0x2868d1);})[_0xe314('0x13')](function(_0x275e7d){logger['error'](_0xe314('0x14'),_0x275e7d[_0xe314('0x10')],_0x3aa234);_0xb5538(_0x1ef994['error'](0x1f4,_0x275e7d[_0xe314('0x10')]));});});};exports[_0xe314('0x1e')]=function(_0x5e7d0b){var _0x172004=this;return new Promise(function(_0x265042,_0xda191b){return db[_0xe314('0x15')]['find']({'raw':_0x5e7d0b[_0xe314('0x16')]?_0x5e7d0b[_0xe314('0x16')][_0xe314('0x17')]===undefined?!![]:![]:!![],'where':_0x5e7d0b['options']?_0x5e7d0b['options'][_0xe314('0x18')]||null:null,'attributes':_0x5e7d0b[_0xe314('0x16')]?_0x5e7d0b[_0xe314('0x16')][_0xe314('0x19')]||null:null,'include':_0x5e7d0b[_0xe314('0x16')]?_0x5e7d0b[_0xe314('0x16')][_0xe314('0x1b')]?_[_0xe314('0x1d')](_0x5e7d0b['options'][_0xe314('0x1b')],function(_0x117814){return{'model':db[_0x117814['model']],'as':_0x117814['as'],'attributes':_0x117814[_0xe314('0x19')],'include':_0x117814[_0xe314('0x1b')]?_['map'](_0x117814[_0xe314('0x1b')],function(_0x20d8ce){return{'model':db[_0x20d8ce['model']],'as':_0x20d8ce['as'],'attributes':_0x20d8ce[_0xe314('0x19')],'include':_0x20d8ce[_0xe314('0x1b')]?_['map'](_0x20d8ce[_0xe314('0x1b')],function(_0x523307){return{'model':db[_0x523307[_0xe314('0x1c')]],'as':_0x523307['as'],'attributes':_0x523307[_0xe314('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe314('0x1f')](function(_0x35b511){logger[_0xe314('0x11')](_0xe314('0x1e'),_0x5e7d0b);logger['debug'](_0xe314('0x1e'),_0x5e7d0b,JSON['stringify'](_0x35b511));_0x265042(_0x35b511);})['catch'](function(_0x57d144){logger[_0xe314('0xe')](_0xe314('0x1e'),_0x57d144[_0xe314('0x10')],_0x5e7d0b);_0xda191b(_0x172004[_0xe314('0xe')](0x1f4,_0x57d144['message']));});});}; \ No newline at end of file +var _0x9dd4=['request','then','info','DeskAccount,\x20%s,\x20%s','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','DeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetDeskAccount','debug','stringify','ShowDeskAccount','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/environment','client','http'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x9dd4,0x1e6));var _0x49dd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9dd4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x49dd('0x0'));var util=require(_0x49dd('0x1'));var moment=require(_0x49dd('0x2'));var BPromise=require('bluebird');var rs=require(_0x49dd('0x3'));var fs=require('fs');var Redis=require(_0x49dd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x49dd('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49dd('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49dd('0x7')][_0x49dd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2ada82,_0x5e14a4,_0x24993c){return new BPromise(function(_0x58dfdd,_0x348a15){return client[_0x49dd('0x9')](_0x2ada82,_0x24993c)[_0x49dd('0xa')](function(_0x4452da){logger[_0x49dd('0xb')](_0x49dd('0xc'),_0x5e14a4,'request\x20sent');logger['debug'](_0x49dd('0xd'),_0x5e14a4,_0x49dd('0xe'),JSON['stringify'](_0x4452da));if(_0x4452da['error']){if(_0x4452da[_0x49dd('0xf')]['code']===0x1f4){logger[_0x49dd('0xf')](_0x49dd('0xc'),_0x5e14a4,_0x4452da[_0x49dd('0xf')]['message']);return _0x348a15(_0x4452da[_0x49dd('0xf')][_0x49dd('0x10')]);}logger[_0x49dd('0xf')]('DeskAccount,\x20%s,\x20%s',_0x5e14a4,_0x4452da[_0x49dd('0xf')][_0x49dd('0x10')]);return _0x58dfdd(_0x4452da[_0x49dd('0xf')][_0x49dd('0x10')]);}else{logger[_0x49dd('0xb')](_0x49dd('0xc'),_0x5e14a4,_0x49dd('0xe'));_0x58dfdd(_0x4452da[_0x49dd('0x11')][_0x49dd('0x10')]);}})[_0x49dd('0x12')](function(_0x8eb976){logger[_0x49dd('0xf')](_0x49dd('0xc'),_0x5e14a4,_0x8eb976);_0x348a15(_0x8eb976);});});}exports['GetDeskAccount']=function(_0x2ed0bd){var _0x42b694=this;return new Promise(function(_0xc40b1b,_0x3ceaac){return db[_0x49dd('0x13')][_0x49dd('0x14')]({'raw':_0x2ed0bd['options']?_0x2ed0bd[_0x49dd('0x15')][_0x49dd('0x16')]===undefined?!![]:![]:!![],'where':_0x2ed0bd[_0x49dd('0x15')]?_0x2ed0bd[_0x49dd('0x15')][_0x49dd('0x17')]||null:null,'attributes':_0x2ed0bd[_0x49dd('0x15')]?_0x2ed0bd['options'][_0x49dd('0x18')]||null:null,'limit':_0x2ed0bd[_0x49dd('0x15')]?_0x2ed0bd['options'][_0x49dd('0x19')]||null:null,'include':_0x2ed0bd['options']?_0x2ed0bd[_0x49dd('0x15')][_0x49dd('0x1a')]?_[_0x49dd('0x1b')](_0x2ed0bd['options'][_0x49dd('0x1a')],function(_0x1cc440){return{'model':db[_0x1cc440[_0x49dd('0x1c')]],'as':_0x1cc440['as'],'attributes':_0x1cc440['attributes'],'include':_0x1cc440[_0x49dd('0x1a')]?_[_0x49dd('0x1b')](_0x1cc440['include'],function(_0x374fb3){return{'model':db[_0x374fb3[_0x49dd('0x1c')]],'as':_0x374fb3['as'],'attributes':_0x374fb3[_0x49dd('0x18')],'include':_0x374fb3[_0x49dd('0x1a')]?_['map'](_0x374fb3['include'],function(_0x204e5c){return{'model':db[_0x204e5c[_0x49dd('0x1c')]],'as':_0x204e5c['as'],'attributes':_0x204e5c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ee970){logger[_0x49dd('0xb')](_0x49dd('0x1d'),_0x2ed0bd);logger[_0x49dd('0x1e')](_0x49dd('0x1d'),_0x2ed0bd,JSON[_0x49dd('0x1f')](_0x4ee970));_0xc40b1b(_0x4ee970);})[_0x49dd('0x12')](function(_0xc514e){logger[_0x49dd('0xf')](_0x49dd('0x1d'),_0xc514e[_0x49dd('0x10')],_0x2ed0bd);_0x3ceaac(_0x42b694[_0x49dd('0xf')](0x1f4,_0xc514e['message']));});});};exports['ShowDeskAccount']=function(_0x46a8c8){var _0x1ac55c=this;return new Promise(function(_0x21f750,_0x38ce6a){return db[_0x49dd('0x13')]['find']({'raw':_0x46a8c8[_0x49dd('0x15')]?_0x46a8c8['options'][_0x49dd('0x16')]===undefined?!![]:![]:!![],'where':_0x46a8c8[_0x49dd('0x15')]?_0x46a8c8['options'][_0x49dd('0x17')]||null:null,'attributes':_0x46a8c8['options']?_0x46a8c8[_0x49dd('0x15')]['attributes']||null:null,'include':_0x46a8c8[_0x49dd('0x15')]?_0x46a8c8[_0x49dd('0x15')][_0x49dd('0x1a')]?_[_0x49dd('0x1b')](_0x46a8c8[_0x49dd('0x15')][_0x49dd('0x1a')],function(_0x47cee4){return{'model':db[_0x47cee4[_0x49dd('0x1c')]],'as':_0x47cee4['as'],'attributes':_0x47cee4[_0x49dd('0x18')],'include':_0x47cee4[_0x49dd('0x1a')]?_['map'](_0x47cee4[_0x49dd('0x1a')],function(_0x2ddd39){return{'model':db[_0x2ddd39[_0x49dd('0x1c')]],'as':_0x2ddd39['as'],'attributes':_0x2ddd39[_0x49dd('0x18')],'include':_0x2ddd39[_0x49dd('0x1a')]?_['map'](_0x2ddd39[_0x49dd('0x1a')],function(_0x570575){return{'model':db[_0x570575[_0x49dd('0x1c')]],'as':_0x570575['as'],'attributes':_0x570575[_0x49dd('0x18')]};}):[]};}):[]};}):[]:[]})[_0x49dd('0xa')](function(_0x2170f5){logger[_0x49dd('0xb')]('ShowDeskAccount',_0x46a8c8);logger[_0x49dd('0x1e')](_0x49dd('0x20'),_0x46a8c8,JSON[_0x49dd('0x1f')](_0x2170f5));_0x21f750(_0x2170f5);})[_0x49dd('0x12')](function(_0x16b807){logger['error'](_0x49dd('0x20'),_0x16b807[_0x49dd('0x10')],_0x46a8c8);_0x38ce6a(_0x1ac55c[_0x49dd('0xf')](0x1f4,_0x16b807[_0x49dd('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index b21603a..fa29257 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','getTags','post','/:id/tags','setTags','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x518d5e,_0x17b17d){var _0x146f16=function(_0xaa6782){while(--_0xaa6782){_0x518d5e['push'](_0x518d5e['shift']());}};_0x146f16(++_0x17b17d);}(_0x3e74,0x175));var _0x43e7=function(_0x412e30,_0xfc1084){_0x412e30=_0x412e30-0x0;var _0x18d348=_0x3e74[_0x412e30];return _0x18d348;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/subjects',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/tags',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0x13'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router['put']('/:id',auth[_0x43e7('0x8')](),controller[_0x43e7('0x15')]);router[_0x43e7('0x16')](_0x43e7('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x43e7('0x17')]=router; \ No newline at end of file +var _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x9530e4,_0x495559){var _0xac8d69=function(_0xa8aa6){while(--_0xa8aa6){_0x9530e4['push'](_0x9530e4['shift']());}};_0xac8d69(++_0x495559);}(_0xedd9,0xfc));var _0x9edd=function(_0x2d586a,_0x594a56){_0x2d586a=_0x2d586a-0x0;var _0x8daaa9=_0xedd9[_0x2d586a];return _0x8daaa9;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 5439ce9..a32273e 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 _0x0ffd=['exports','STRING'];(function(_0x394c30,_0x1cff55){var _0x57df38=function(_0x4a583e){while(--_0x4a583e){_0x394c30['push'](_0x394c30['shift']());}};_0x57df38(++_0x1cff55);}(_0x0ffd,0x18e));var _0xd0ff=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x0ffd[_0xefd519];return _0x4bb882;};'use strict';var Sequelize=require('sequelize');module[_0xd0ff('0x0')]={'name':{'type':Sequelize[_0xd0ff('0x1')]},'description':{'type':Sequelize[_0xd0ff('0x1')]}}; \ No newline at end of file +var _0xe7e3=['STRING','exports'];(function(_0x1358ab,_0x350960){var _0x578518=function(_0x332ef3){while(--_0x332ef3){_0x1358ab['push'](_0x1358ab['shift']());}};_0x578518(++_0x350960);}(_0xe7e3,0x67));var _0x3e7e=function(_0x3e2fcf,_0x579110){_0x3e2fcf=_0x3e2fcf-0x0;var _0x497db7=_0xe7e3[_0x3e2fcf];return _0x497db7;};'use strict';var Sequelize=require('sequelize');module[_0x3e7e('0x0')]={'name':{'type':Sequelize[_0x3e7e('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 4eb214c..010e694 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 _0xa5dd=['../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','save','update','then','error','stack','name','send','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','DeskField','sort','pick','getSubjects','order','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment'];(function(_0x387f65,_0x16502b){var _0x49b3ed=function(_0x30e3ca){while(--_0x30e3ca){_0x387f65['push'](_0x387f65['shift']());}};_0x49b3ed(++_0x16502b);}(_0xa5dd,0x177));var _0xda5d=function(_0x47c2d5,_0x265411){_0x47c2d5=_0x47c2d5-0x0;var _0x387914=_0xa5dd[_0x47c2d5];return _0x387914;};'use strict';var emlformat=require(_0xda5d('0x0'));var rimraf=require(_0xda5d('0x1'));var zipdir=require(_0xda5d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xda5d('0x3'));var BPromise=require(_0xda5d('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xda5d('0x5'));var sox=require(_0xda5d('0x6'));var csv=require(_0xda5d('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xda5d('0x8'));var _=require(_0xda5d('0x9'));var squel=require(_0xda5d('0xa'));var crypto=require('crypto');var jsforce=require(_0xda5d('0xb'));var deskjs=require(_0xda5d('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xda5d('0xd'));var Redis=require(_0xda5d('0xe'));var authService=require(_0xda5d('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xda5d('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xda5d('0x11'));var utils=require(_0xda5d('0x12'));var config=require(_0xda5d('0x13'));var licenseUtil=require(_0xda5d('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a1f42,_0x10375d){_0x10375d=_0x10375d||0xcc;return function(_0x3b22fc){if(_0x3b22fc){return _0x3a1f42[_0xda5d('0x15')](_0x10375d);}return _0x3a1f42[_0xda5d('0x16')](_0x10375d)[_0xda5d('0x17')]();};}function respondWithResult(_0x540cdb,_0x16f078){_0x16f078=_0x16f078||0xc8;return function(_0x49ffe4){if(_0x49ffe4){return _0x540cdb['status'](_0x16f078)[_0xda5d('0x18')](_0x49ffe4);}};}function respondWithFilteredResult(_0x124b18,_0x4c92d1){return function(_0x1dd282){if(_0x1dd282){var _0xce32d5=typeof _0x4c92d1['offset']===_0xda5d('0x19')&&typeof _0x4c92d1[_0xda5d('0x1a')]==='undefined';var _0x171dec=_0x1dd282[_0xda5d('0x1b')];var _0x120e5c=_0xce32d5?0x0:_0x4c92d1['offset'];var _0x541222=_0xce32d5?_0x1dd282[_0xda5d('0x1b')]:_0x4c92d1[_0xda5d('0x1c')]+_0x4c92d1['limit'];var _0x509fa0;if(_0x541222>=_0x171dec){_0x541222=_0x171dec;_0x509fa0=0xc8;}else{_0x509fa0=0xce;}_0x124b18[_0xda5d('0x16')](_0x509fa0);return _0x124b18[_0xda5d('0x1d')]('Content-Range',_0x120e5c+'-'+_0x541222+'/'+_0x171dec)[_0xda5d('0x18')](_0x1dd282);}return null;};}function patchUpdates(_0x4f4439){return function(_0x3f6bac){try{jsonpatch['apply'](_0x3f6bac,_0x4f4439,!![]);}catch(_0x3f5a4e){return BPromise['reject'](_0x3f5a4e);}return _0x3f6bac[_0xda5d('0x1e')]();};}function saveUpdates(_0x5539e8,_0x3441fe){return function(_0x394768){if(_0x394768){return _0x394768[_0xda5d('0x1f')](_0x5539e8)[_0xda5d('0x20')](function(_0xdfc3b7){return _0xdfc3b7;});}return null;};}function removeEntity(_0x3fdd4b,_0x1b069f){return function(_0x577c52){if(_0x577c52){return _0x577c52['destroy']()['then'](function(){_0x3fdd4b[_0xda5d('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58e5db,_0x2ee1da){return function(_0x34545e){if(!_0x34545e){_0x58e5db[_0xda5d('0x15')](0x194);}return _0x34545e;};}function handleError(_0x2211cc,_0x36b04b){_0x36b04b=_0x36b04b||0x1f4;return function(_0x191e4a){logger[_0xda5d('0x21')](_0x191e4a[_0xda5d('0x22')]);if(_0x191e4a[_0xda5d('0x23')]){delete _0x191e4a[_0xda5d('0x23')];}_0x2211cc[_0xda5d('0x16')](_0x36b04b)[_0xda5d('0x24')](_0x191e4a);};}exports['index']=function(_0x2bda73,_0x4bd54f){var _0x35152f={},_0x180a85={},_0x3200e3={'count':0x0,'rows':[]};var _0x426f3f=_[_0xda5d('0x25')](db[_0xda5d('0x26')][_0xda5d('0x27')],function(_0x1a7896){return{'name':_0x1a7896[_0xda5d('0x28')],'type':_0x1a7896[_0xda5d('0x29')][_0xda5d('0x2a')]};});_0x180a85[_0xda5d('0x2b')]=_[_0xda5d('0x25')](_0x426f3f,'name');_0x180a85[_0xda5d('0x2c')]=_[_0xda5d('0x2d')](_0x2bda73[_0xda5d('0x2c')]);_0x180a85[_0xda5d('0x2e')]=_[_0xda5d('0x2f')](_0x180a85[_0xda5d('0x2b')],_0x180a85['query']);_0x35152f['attributes']=_[_0xda5d('0x2f')](_0x180a85[_0xda5d('0x2b')],qs['fields'](_0x2bda73[_0xda5d('0x2c')][_0xda5d('0x30')]));_0x35152f[_0xda5d('0x31')]=_0x35152f[_0xda5d('0x31')][_0xda5d('0x32')]?_0x35152f[_0xda5d('0x31')]:_0x180a85[_0xda5d('0x2b')];if(!_0x2bda73['query'][_0xda5d('0x33')](_0xda5d('0x34'))){_0x35152f[_0xda5d('0x1a')]=qs['limit'](_0x2bda73[_0xda5d('0x2c')][_0xda5d('0x1a')]);_0x35152f[_0xda5d('0x1c')]=qs[_0xda5d('0x1c')](_0x2bda73[_0xda5d('0x2c')][_0xda5d('0x1c')]);}_0x35152f['order']=qs['sort'](_0x2bda73[_0xda5d('0x2c')]['sort']);_0x35152f[_0xda5d('0x35')]=qs[_0xda5d('0x2e')](_['pick'](_0x2bda73[_0xda5d('0x2c')],_0x180a85['filters']),_0x426f3f);if(_0x2bda73[_0xda5d('0x2c')][_0xda5d('0x36')]){_0x35152f[_0xda5d('0x35')]=_[_0xda5d('0x37')](_0x35152f['where'],{'$or':_[_0xda5d('0x25')](_0x426f3f,function(_0x1e2421){if(_0x1e2421[_0xda5d('0x29')]!=='VIRTUAL'){var _0x507c0e={};_0x507c0e[_0x1e2421['name']]={'$like':'%'+_0x2bda73[_0xda5d('0x2c')][_0xda5d('0x36')]+'%'};return _0x507c0e;}})});}_0x35152f=_['merge']({},_0x35152f,_0x2bda73[_0xda5d('0x38')]);var _0x5deb63={'where':_0x35152f[_0xda5d('0x35')]};return db[_0xda5d('0x26')][_0xda5d('0x1b')](_0x5deb63)['then'](function(_0x284c35){_0x3200e3[_0xda5d('0x1b')]=_0x284c35;if(_0x2bda73[_0xda5d('0x2c')][_0xda5d('0x39')]){_0x35152f[_0xda5d('0x3a')]=[{'all':!![]}];}return db['DeskConfiguration'][_0xda5d('0x3b')](_0x35152f);})[_0xda5d('0x20')](function(_0x25b733){_0x3200e3[_0xda5d('0x3c')]=_0x25b733;return _0x3200e3;})[_0xda5d('0x20')](respondWithFilteredResult(_0x4bd54f,_0x35152f))[_0xda5d('0x3d')](handleError(_0x4bd54f,null));};exports[_0xda5d('0x3e')]=function(_0x2adb16,_0x3967a1){var _0x593da9={'raw':![],'where':{'id':_0x2adb16[_0xda5d('0x3f')]['id']}},_0x4234de={};_0x4234de['model']=_[_0xda5d('0x2d')](db['DeskConfiguration'][_0xda5d('0x27')]);_0x4234de[_0xda5d('0x2c')]=_['keys'](_0x2adb16['query']);_0x4234de[_0xda5d('0x2e')]=_[_0xda5d('0x2f')](_0x4234de['model'],_0x4234de['query']);_0x593da9[_0xda5d('0x31')]=_[_0xda5d('0x2f')](_0x4234de[_0xda5d('0x2b')],qs['fields'](_0x2adb16['query'][_0xda5d('0x30')]));_0x593da9[_0xda5d('0x31')]=_0x593da9[_0xda5d('0x31')][_0xda5d('0x32')]?_0x593da9[_0xda5d('0x31')]:_0x4234de[_0xda5d('0x2b')];if(_0x2adb16[_0xda5d('0x2c')]['includeAll']){_0x593da9[_0xda5d('0x3a')]=[{'all':!![]}];}_0x593da9=_[_0xda5d('0x37')]({},_0x593da9,_0x2adb16[_0xda5d('0x38')]);return db[_0xda5d('0x26')][_0xda5d('0x40')](_0x593da9)[_0xda5d('0x20')](handleEntityNotFound(_0x3967a1,null))['then'](respondWithResult(_0x3967a1,null))['catch'](handleError(_0x3967a1,null));};exports[_0xda5d('0x41')]=function(_0x3c5613,_0x4729ef){return db[_0xda5d('0x26')][_0xda5d('0x41')](_0x3c5613[_0xda5d('0x42')],{})['then'](respondWithResult(_0x4729ef,0xc9))[_0xda5d('0x3d')](handleError(_0x4729ef,null));};exports['update']=function(_0x260f71,_0x1f73f9){if(_0x260f71[_0xda5d('0x42')]['id']){delete _0x260f71[_0xda5d('0x42')]['id'];}return db[_0xda5d('0x26')][_0xda5d('0x40')]({'where':{'id':_0x260f71[_0xda5d('0x3f')]['id']}})[_0xda5d('0x20')](handleEntityNotFound(_0x1f73f9,null))[_0xda5d('0x20')](saveUpdates(_0x260f71[_0xda5d('0x42')],null))['then'](respondWithResult(_0x1f73f9,null))[_0xda5d('0x3d')](handleError(_0x1f73f9,null));};exports['destroy']=function(_0x45e6e4,_0x2ba499){return db[_0xda5d('0x26')][_0xda5d('0x40')]({'where':{'id':_0x45e6e4['params']['id']}})[_0xda5d('0x20')](handleEntityNotFound(_0x2ba499,null))[_0xda5d('0x20')](removeEntity(_0x2ba499,null))[_0xda5d('0x3d')](handleError(_0x2ba499,null));};exports[_0xda5d('0x43')]=function(_0x336487,_0x823c52,_0x14f144){var _0x34c672={};var _0x313d08={};var _0x5102c6;var _0x47aa09;return db['DeskConfiguration'][_0xda5d('0x44')]({'where':{'id':_0x336487[_0xda5d('0x3f')]['id']}})[_0xda5d('0x20')](handleEntityNotFound(_0x823c52,null))['then'](function(_0x18c5ff){if(_0x18c5ff){_0x5102c6=_0x18c5ff;_0x313d08['model']=_[_0xda5d('0x2d')](db[_0xda5d('0x45')][_0xda5d('0x27')]);_0x313d08['query']=_[_0xda5d('0x2d')](_0x336487['query']);_0x313d08[_0xda5d('0x2e')]=_[_0xda5d('0x2f')](_0x313d08[_0xda5d('0x2b')],_0x313d08[_0xda5d('0x2c')]);_0x34c672[_0xda5d('0x31')]=_[_0xda5d('0x2f')](_0x313d08[_0xda5d('0x2b')],qs['fields'](_0x336487[_0xda5d('0x2c')][_0xda5d('0x30')]));_0x34c672[_0xda5d('0x31')]=_0x34c672[_0xda5d('0x31')][_0xda5d('0x32')]?_0x34c672[_0xda5d('0x31')]:_0x313d08[_0xda5d('0x2b')];_0x34c672['order']=qs[_0xda5d('0x46')](_0x336487['query'][_0xda5d('0x46')]);_0x34c672[_0xda5d('0x35')]=qs[_0xda5d('0x2e')](_[_0xda5d('0x47')](_0x336487[_0xda5d('0x2c')],_0x313d08[_0xda5d('0x2e')]));if(_0x336487[_0xda5d('0x2c')][_0xda5d('0x36')]){_0x34c672[_0xda5d('0x35')]=_[_0xda5d('0x37')](_0x34c672[_0xda5d('0x35')],{'$or':_[_0xda5d('0x25')](_0x34c672[_0xda5d('0x31')],function(_0x40b88e){var _0x5588f1={};_0x5588f1[_0x40b88e]={'$like':'%'+_0x336487[_0xda5d('0x2c')]['filter']+'%'};return _0x5588f1;})});}_0x34c672=_[_0xda5d('0x37')]({},_0x34c672,_0x336487[_0xda5d('0x38')]);return _0x5102c6[_0xda5d('0x43')](_0x34c672);}})[_0xda5d('0x20')](function(_0x2569e7){if(_0x2569e7){_0x47aa09=_0x2569e7[_0xda5d('0x32')];if(!_0x336487[_0xda5d('0x2c')][_0xda5d('0x33')](_0xda5d('0x34'))){_0x34c672[_0xda5d('0x1a')]=qs[_0xda5d('0x1a')](_0x336487[_0xda5d('0x2c')]['limit']);_0x34c672[_0xda5d('0x1c')]=qs[_0xda5d('0x1c')](_0x336487[_0xda5d('0x2c')][_0xda5d('0x1c')]);}return _0x5102c6[_0xda5d('0x43')](_0x34c672);}})['then'](function(_0x577b8f){if(_0x577b8f){return _0x577b8f?{'count':_0x47aa09,'rows':_0x577b8f}:null;}})[_0xda5d('0x20')](respondWithResult(_0x823c52,null))[_0xda5d('0x3d')](handleError(_0x823c52,null));};exports[_0xda5d('0x48')]=function(_0x32ae24,_0x732ffc,_0x22389a){var _0x50d552={};var _0x462062={};var _0x3341c1;var _0x23fd74;return db[_0xda5d('0x26')][_0xda5d('0x44')]({'where':{'id':_0x32ae24['params']['id']}})[_0xda5d('0x20')](handleEntityNotFound(_0x732ffc,null))[_0xda5d('0x20')](function(_0x345cdd){if(_0x345cdd){_0x3341c1=_0x345cdd;_0x462062[_0xda5d('0x2b')]=_[_0xda5d('0x2d')](db[_0xda5d('0x45')]['rawAttributes']);_0x462062[_0xda5d('0x2c')]=_['keys'](_0x32ae24['query']);_0x462062[_0xda5d('0x2e')]=_[_0xda5d('0x2f')](_0x462062['model'],_0x462062[_0xda5d('0x2c')]);_0x50d552[_0xda5d('0x31')]=_[_0xda5d('0x2f')](_0x462062['model'],qs[_0xda5d('0x30')](_0x32ae24[_0xda5d('0x2c')][_0xda5d('0x30')]));_0x50d552[_0xda5d('0x31')]=_0x50d552[_0xda5d('0x31')][_0xda5d('0x32')]?_0x50d552[_0xda5d('0x31')]:_0x462062[_0xda5d('0x2b')];_0x50d552[_0xda5d('0x49')]=qs['sort'](_0x32ae24[_0xda5d('0x2c')][_0xda5d('0x46')]);_0x50d552[_0xda5d('0x35')]=qs['filters'](_[_0xda5d('0x47')](_0x32ae24['query'],_0x462062['filters']));if(_0x32ae24['query'][_0xda5d('0x36')]){_0x50d552[_0xda5d('0x35')]=_[_0xda5d('0x37')](_0x50d552[_0xda5d('0x35')],{'$or':_[_0xda5d('0x25')](_0x50d552[_0xda5d('0x31')],function(_0x22d5bd){var _0x32de0e={};_0x32de0e[_0x22d5bd]={'$like':'%'+_0x32ae24['query'][_0xda5d('0x36')]+'%'};return _0x32de0e;})});}_0x50d552=_['merge']({},_0x50d552,_0x32ae24[_0xda5d('0x38')]);return _0x3341c1[_0xda5d('0x48')](_0x50d552);}})[_0xda5d('0x20')](function(_0x302f03){if(_0x302f03){_0x23fd74=_0x302f03[_0xda5d('0x32')];if(!_0x32ae24[_0xda5d('0x2c')][_0xda5d('0x33')](_0xda5d('0x34'))){_0x50d552[_0xda5d('0x1a')]=qs['limit'](_0x32ae24[_0xda5d('0x2c')]['limit']);_0x50d552[_0xda5d('0x1c')]=qs[_0xda5d('0x1c')](_0x32ae24[_0xda5d('0x2c')]['offset']);}return _0x3341c1[_0xda5d('0x48')](_0x50d552);}})[_0xda5d('0x20')](function(_0x216102){if(_0x216102){return _0x216102?{'count':_0x23fd74,'rows':_0x216102}:null;}})[_0xda5d('0x20')](respondWithResult(_0x732ffc,null))[_0xda5d('0x3d')](handleError(_0x732ffc,null));};exports[_0xda5d('0x4a')]=function(_0x53560c,_0x1698f1,_0x108551){var _0x33e089={};var _0x115faa={};var _0x2c8a81;var _0x16eaba;return db[_0xda5d('0x26')]['findOne']({'where':{'id':_0x53560c[_0xda5d('0x3f')]['id']}})[_0xda5d('0x20')](handleEntityNotFound(_0x1698f1,null))[_0xda5d('0x20')](function(_0x4c2790){if(_0x4c2790){_0x2c8a81=_0x4c2790;_0x115faa[_0xda5d('0x2b')]=_[_0xda5d('0x2d')](db[_0xda5d('0x45')][_0xda5d('0x27')]);_0x115faa[_0xda5d('0x2c')]=_[_0xda5d('0x2d')](_0x53560c[_0xda5d('0x2c')]);_0x115faa[_0xda5d('0x2e')]=_[_0xda5d('0x2f')](_0x115faa[_0xda5d('0x2b')],_0x115faa[_0xda5d('0x2c')]);_0x33e089[_0xda5d('0x31')]=_[_0xda5d('0x2f')](_0x115faa[_0xda5d('0x2b')],qs[_0xda5d('0x30')](_0x53560c[_0xda5d('0x2c')][_0xda5d('0x30')]));_0x33e089[_0xda5d('0x31')]=_0x33e089[_0xda5d('0x31')][_0xda5d('0x32')]?_0x33e089['attributes']:_0x115faa[_0xda5d('0x2b')];_0x33e089[_0xda5d('0x49')]=qs[_0xda5d('0x46')](_0x53560c[_0xda5d('0x2c')][_0xda5d('0x46')]);_0x33e089[_0xda5d('0x35')]=qs[_0xda5d('0x2e')](_[_0xda5d('0x47')](_0x53560c[_0xda5d('0x2c')],_0x115faa[_0xda5d('0x2e')]));if(_0x53560c[_0xda5d('0x2c')][_0xda5d('0x36')]){_0x33e089[_0xda5d('0x35')]=_[_0xda5d('0x37')](_0x33e089['where'],{'$or':_[_0xda5d('0x25')](_0x33e089[_0xda5d('0x31')],function(_0x4b51d6){var _0x54e76a={};_0x54e76a[_0x4b51d6]={'$like':'%'+_0x53560c['query'][_0xda5d('0x36')]+'%'};return _0x54e76a;})});}_0x33e089=_['merge']({},_0x33e089,_0x53560c['options']);return _0x2c8a81[_0xda5d('0x4a')](_0x33e089);}})[_0xda5d('0x20')](function(_0x3c5a55){if(_0x3c5a55){_0x16eaba=_0x3c5a55['length'];if(!_0x53560c['query'][_0xda5d('0x33')](_0xda5d('0x34'))){_0x33e089[_0xda5d('0x1a')]=qs[_0xda5d('0x1a')](_0x53560c[_0xda5d('0x2c')][_0xda5d('0x1a')]);_0x33e089[_0xda5d('0x1c')]=qs[_0xda5d('0x1c')](_0x53560c[_0xda5d('0x2c')][_0xda5d('0x1c')]);}return _0x2c8a81[_0xda5d('0x4a')](_0x33e089);}})[_0xda5d('0x20')](function(_0x51e8e4){if(_0x51e8e4){return _0x51e8e4?{'count':_0x16eaba,'rows':_0x51e8e4}:null;}})[_0xda5d('0x20')](respondWithResult(_0x1698f1,null))[_0xda5d('0x3d')](handleError(_0x1698f1,null));};exports['getTags']=function(_0x418447,_0x5d16e2,_0x51483b){var _0xae2387={};var _0x27cfe9={};var _0x46c7a6;var _0x4db2ad;return db[_0xda5d('0x26')][_0xda5d('0x44')]({'where':{'id':_0x418447['params']['id']}})[_0xda5d('0x20')](handleEntityNotFound(_0x5d16e2,null))['then'](function(_0x30fd4b){if(_0x30fd4b){_0x46c7a6=_0x30fd4b;_0x27cfe9[_0xda5d('0x2b')]=_[_0xda5d('0x2d')](db[_0xda5d('0x4b')][_0xda5d('0x27')]);_0x27cfe9[_0xda5d('0x2c')]=_[_0xda5d('0x2d')](_0x418447['query']);_0x27cfe9[_0xda5d('0x2e')]=_[_0xda5d('0x2f')](_0x27cfe9[_0xda5d('0x2b')],_0x27cfe9[_0xda5d('0x2c')]);_0xae2387['attributes']=_['intersection'](_0x27cfe9[_0xda5d('0x2b')],qs[_0xda5d('0x30')](_0x418447[_0xda5d('0x2c')][_0xda5d('0x30')]));_0xae2387[_0xda5d('0x31')]=_0xae2387['attributes'][_0xda5d('0x32')]?_0xae2387[_0xda5d('0x31')]:_0x27cfe9['model'];_0xae2387[_0xda5d('0x49')]=qs[_0xda5d('0x46')](_0x418447[_0xda5d('0x2c')]['sort']);_0xae2387[_0xda5d('0x35')]=qs['filters'](_['pick'](_0x418447['query'],_0x27cfe9[_0xda5d('0x2e')]));if(_0x418447[_0xda5d('0x2c')][_0xda5d('0x36')]){_0xae2387[_0xda5d('0x35')]=_['merge'](_0xae2387['where'],{'$or':_[_0xda5d('0x25')](_0xae2387['attributes'],function(_0x50b5b4){var _0x5cfb0b={};_0x5cfb0b[_0x50b5b4]={'$like':'%'+_0x418447[_0xda5d('0x2c')][_0xda5d('0x36')]+'%'};return _0x5cfb0b;})});}_0xae2387=_[_0xda5d('0x37')]({},_0xae2387,_0x418447['options']);return _0x46c7a6[_0xda5d('0x4c')](_0xae2387);}})[_0xda5d('0x20')](function(_0x4df933){if(_0x4df933){_0x4db2ad=_0x4df933[_0xda5d('0x32')];if(!_0x418447[_0xda5d('0x2c')]['hasOwnProperty']('nolimit')){_0xae2387[_0xda5d('0x1a')]=qs[_0xda5d('0x1a')](_0x418447[_0xda5d('0x2c')]['limit']);_0xae2387[_0xda5d('0x1c')]=qs[_0xda5d('0x1c')](_0x418447['query'][_0xda5d('0x1c')]);}return _0x46c7a6[_0xda5d('0x4c')](_0xae2387);}})['then'](function(_0x33a8e1){if(_0x33a8e1){return _0x33a8e1?{'count':_0x4db2ad,'rows':_0x33a8e1}:null;}})[_0xda5d('0x20')](respondWithResult(_0x5d16e2,null))[_0xda5d('0x3d')](handleError(_0x5d16e2,null));};exports[_0xda5d('0x4d')]=function(_0x2dbeea,_0x42ed42,_0xb51828){if(_0x2dbeea[_0xda5d('0x42')]['id']){delete _0x2dbeea[_0xda5d('0x42')]['id'];}return db['DeskConfiguration'][_0xda5d('0x44')]({'where':{'id':_0x2dbeea[_0xda5d('0x3f')]['id']}})[_0xda5d('0x20')](handleEntityNotFound(_0x42ed42,null))[_0xda5d('0x20')](function(_0x7b1a81){if(_0x7b1a81){return _0x7b1a81['setTags'](_0x2dbeea[_0xda5d('0x42')][_0xda5d('0x4e')]||[]);}return null;})[_0xda5d('0x20')](respondWithResult(_0x42ed42,null))[_0xda5d('0x3d')](handleError(_0x42ed42,null));}; \ No newline at end of file +var _0xc5c2=['../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','nolimit','limit','offset','order','sort','where','filters','merge','type','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','length','find','create','body','DeskField','pick','getFields','hasOwnProperty','getSubjects','findOne','getDescriptions','getTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x5678f8,_0x1d6245){var _0x1e0db7=function(_0x54214c){while(--_0x54214c){_0x5678f8['push'](_0x5678f8['shift']());}};_0x1e0db7(++_0x1d6245);}(_0xc5c2,0x91));var _0x2c5c=function(_0x291ac6,_0xd04e8a){_0x291ac6=_0x291ac6-0x0;var _0x32a027=_0xc5c2[_0x291ac6];return _0x32a027;};'use strict';var emlformat=require(_0x2c5c('0x0'));var rimraf=require(_0x2c5c('0x1'));var zipdir=require(_0x2c5c('0x2'));var jsonpatch=require(_0x2c5c('0x3'));var rp=require(_0x2c5c('0x4'));var moment=require('moment');var BPromise=require(_0x2c5c('0x5'));var Mustache=require(_0x2c5c('0x6'));var util=require('util');var path=require(_0x2c5c('0x7'));var sox=require(_0x2c5c('0x8'));var csv=require(_0x2c5c('0x9'));var ejs=require(_0x2c5c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2c5c('0xb'));var squel=require(_0x2c5c('0xc'));var crypto=require(_0x2c5c('0xd'));var jsforce=require(_0x2c5c('0xe'));var deskjs=require(_0x2c5c('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2c5c('0x10'));var Papa=require(_0x2c5c('0x11'));var Redis=require(_0x2c5c('0x12'));var authService=require(_0x2c5c('0x13'));var qs=require(_0x2c5c('0x14'));var as=require(_0x2c5c('0x15'));var hardwareService=require(_0x2c5c('0x16'));var logger=require(_0x2c5c('0x17'))(_0x2c5c('0x18'));var utils=require('../../config/utils');var config=require(_0x2c5c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x2c5c('0x1a'))['db'];function respondWithStatusCode(_0x258a0c,_0x1ff1cb){_0x1ff1cb=_0x1ff1cb||0xcc;return function(_0x3919f7){if(_0x3919f7){return _0x258a0c[_0x2c5c('0x1b')](_0x1ff1cb);}return _0x258a0c['status'](_0x1ff1cb)[_0x2c5c('0x1c')]();};}function respondWithResult(_0x41343a,_0x2e5c60){_0x2e5c60=_0x2e5c60||0xc8;return function(_0x28c98c){if(_0x28c98c){return _0x41343a[_0x2c5c('0x1d')](_0x2e5c60)[_0x2c5c('0x1e')](_0x28c98c);}};}function respondWithFilteredResult(_0x3dff9e,_0x3115e4){return function(_0x5192ec){if(_0x5192ec){var _0x21b7e9=typeof _0x3115e4['offset']===_0x2c5c('0x1f')&&typeof _0x3115e4['limit']===_0x2c5c('0x1f');var _0x83394e=_0x5192ec['count'];var _0x3ef9bf=_0x21b7e9?0x0:_0x3115e4['offset'];var _0x3e61b1=_0x21b7e9?_0x5192ec[_0x2c5c('0x20')]:_0x3115e4['offset']+_0x3115e4['limit'];var _0x595686;if(_0x3e61b1>=_0x83394e){_0x3e61b1=_0x83394e;_0x595686=0xc8;}else{_0x595686=0xce;}_0x3dff9e[_0x2c5c('0x1d')](_0x595686);return _0x3dff9e[_0x2c5c('0x21')](_0x2c5c('0x22'),_0x3ef9bf+'-'+_0x3e61b1+'/'+_0x83394e)[_0x2c5c('0x1e')](_0x5192ec);}return null;};}function patchUpdates(_0x5994a7){return function(_0xd8a9e8){try{jsonpatch['apply'](_0xd8a9e8,_0x5994a7,!![]);}catch(_0x48dd1a){return BPromise[_0x2c5c('0x23')](_0x48dd1a);}return _0xd8a9e8[_0x2c5c('0x24')]();};}function saveUpdates(_0x2afed5,_0x410181){return function(_0x209251){if(_0x209251){return _0x209251[_0x2c5c('0x25')](_0x2afed5)[_0x2c5c('0x26')](function(_0x7aad5a){return _0x7aad5a;});}return null;};}function removeEntity(_0x37c243,_0x352b95){return function(_0x20e0ea){if(_0x20e0ea){return _0x20e0ea[_0x2c5c('0x27')]()[_0x2c5c('0x26')](function(){_0x37c243[_0x2c5c('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x562899,_0x3b145b){return function(_0xbfe49c){if(!_0xbfe49c){_0x562899[_0x2c5c('0x1b')](0x194);}return _0xbfe49c;};}function handleError(_0x5a4250,_0x3b1b0e){_0x3b1b0e=_0x3b1b0e||0x1f4;return function(_0x1742e2){logger['error'](_0x1742e2[_0x2c5c('0x28')]);if(_0x1742e2['name']){delete _0x1742e2[_0x2c5c('0x29')];}_0x5a4250[_0x2c5c('0x1d')](_0x3b1b0e)[_0x2c5c('0x2a')](_0x1742e2);};}exports[_0x2c5c('0x2b')]=function(_0x518d83,_0x241b58){var _0xfbe87b={},_0x2ef00c={},_0x35a5c6={'count':0x0,'rows':[]};var _0x123d7f=_[_0x2c5c('0x2c')](db[_0x2c5c('0x2d')][_0x2c5c('0x2e')],function(_0x317759){return{'name':_0x317759[_0x2c5c('0x2f')],'type':_0x317759['type'][_0x2c5c('0x30')]};});_0x2ef00c['model']=_[_0x2c5c('0x2c')](_0x123d7f,'name');_0x2ef00c[_0x2c5c('0x31')]=_[_0x2c5c('0x32')](_0x518d83[_0x2c5c('0x31')]);_0x2ef00c['filters']=_[_0x2c5c('0x33')](_0x2ef00c[_0x2c5c('0x34')],_0x2ef00c[_0x2c5c('0x31')]);_0xfbe87b[_0x2c5c('0x35')]=_[_0x2c5c('0x33')](_0x2ef00c[_0x2c5c('0x34')],qs[_0x2c5c('0x36')](_0x518d83['query'][_0x2c5c('0x36')]));_0xfbe87b[_0x2c5c('0x35')]=_0xfbe87b[_0x2c5c('0x35')]['length']?_0xfbe87b[_0x2c5c('0x35')]:_0x2ef00c[_0x2c5c('0x34')];if(!_0x518d83[_0x2c5c('0x31')]['hasOwnProperty'](_0x2c5c('0x37'))){_0xfbe87b[_0x2c5c('0x38')]=qs[_0x2c5c('0x38')](_0x518d83[_0x2c5c('0x31')]['limit']);_0xfbe87b[_0x2c5c('0x39')]=qs[_0x2c5c('0x39')](_0x518d83[_0x2c5c('0x31')][_0x2c5c('0x39')]);}_0xfbe87b[_0x2c5c('0x3a')]=qs[_0x2c5c('0x3b')](_0x518d83[_0x2c5c('0x31')][_0x2c5c('0x3b')]);_0xfbe87b[_0x2c5c('0x3c')]=qs[_0x2c5c('0x3d')](_['pick'](_0x518d83['query'],_0x2ef00c[_0x2c5c('0x3d')]),_0x123d7f);if(_0x518d83[_0x2c5c('0x31')]['filter']){_0xfbe87b[_0x2c5c('0x3c')]=_[_0x2c5c('0x3e')](_0xfbe87b[_0x2c5c('0x3c')],{'$or':_[_0x2c5c('0x2c')](_0x123d7f,function(_0x3de358){if(_0x3de358[_0x2c5c('0x3f')]!==_0x2c5c('0x40')){var _0xb40381={};_0xb40381[_0x3de358[_0x2c5c('0x29')]]={'$like':'%'+_0x518d83[_0x2c5c('0x31')][_0x2c5c('0x41')]+'%'};return _0xb40381;}})});}_0xfbe87b=_['merge']({},_0xfbe87b,_0x518d83[_0x2c5c('0x42')]);var _0x182bf1={'where':_0xfbe87b[_0x2c5c('0x3c')]};return db['DeskConfiguration'][_0x2c5c('0x20')](_0x182bf1)['then'](function(_0x38ec71){_0x35a5c6[_0x2c5c('0x20')]=_0x38ec71;if(_0x518d83[_0x2c5c('0x31')][_0x2c5c('0x43')]){_0xfbe87b[_0x2c5c('0x44')]=[{'all':!![]}];}return db[_0x2c5c('0x2d')]['findAll'](_0xfbe87b);})['then'](function(_0x10a9f7){_0x35a5c6[_0x2c5c('0x45')]=_0x10a9f7;return _0x35a5c6;})[_0x2c5c('0x26')](respondWithFilteredResult(_0x241b58,_0xfbe87b))[_0x2c5c('0x46')](handleError(_0x241b58,null));};exports[_0x2c5c('0x47')]=function(_0x4c09b2,_0x337def){var _0x3e1113={'raw':![],'where':{'id':_0x4c09b2[_0x2c5c('0x48')]['id']}},_0x13cd81={};_0x13cd81[_0x2c5c('0x34')]=_[_0x2c5c('0x32')](db[_0x2c5c('0x2d')][_0x2c5c('0x2e')]);_0x13cd81[_0x2c5c('0x31')]=_[_0x2c5c('0x32')](_0x4c09b2[_0x2c5c('0x31')]);_0x13cd81[_0x2c5c('0x3d')]=_['intersection'](_0x13cd81[_0x2c5c('0x34')],_0x13cd81[_0x2c5c('0x31')]);_0x3e1113['attributes']=_[_0x2c5c('0x33')](_0x13cd81[_0x2c5c('0x34')],qs[_0x2c5c('0x36')](_0x4c09b2['query']['fields']));_0x3e1113['attributes']=_0x3e1113[_0x2c5c('0x35')][_0x2c5c('0x49')]?_0x3e1113[_0x2c5c('0x35')]:_0x13cd81[_0x2c5c('0x34')];if(_0x4c09b2[_0x2c5c('0x31')][_0x2c5c('0x43')]){_0x3e1113[_0x2c5c('0x44')]=[{'all':!![]}];}_0x3e1113=_[_0x2c5c('0x3e')]({},_0x3e1113,_0x4c09b2[_0x2c5c('0x42')]);return db[_0x2c5c('0x2d')][_0x2c5c('0x4a')](_0x3e1113)['then'](handleEntityNotFound(_0x337def,null))['then'](respondWithResult(_0x337def,null))[_0x2c5c('0x46')](handleError(_0x337def,null));};exports['create']=function(_0x33adc6,_0x4208cd){return db['DeskConfiguration'][_0x2c5c('0x4b')](_0x33adc6['body'],{})['then'](respondWithResult(_0x4208cd,0xc9))[_0x2c5c('0x46')](handleError(_0x4208cd,null));};exports[_0x2c5c('0x25')]=function(_0x8a5b87,_0x36221c){if(_0x8a5b87[_0x2c5c('0x4c')]['id']){delete _0x8a5b87[_0x2c5c('0x4c')]['id'];}return db['DeskConfiguration'][_0x2c5c('0x4a')]({'where':{'id':_0x8a5b87[_0x2c5c('0x48')]['id']}})[_0x2c5c('0x26')](handleEntityNotFound(_0x36221c,null))['then'](saveUpdates(_0x8a5b87[_0x2c5c('0x4c')],null))['then'](respondWithResult(_0x36221c,null))[_0x2c5c('0x46')](handleError(_0x36221c,null));};exports[_0x2c5c('0x27')]=function(_0x1f95cd,_0x5134c7){return db[_0x2c5c('0x2d')]['find']({'where':{'id':_0x1f95cd[_0x2c5c('0x48')]['id']}})[_0x2c5c('0x26')](handleEntityNotFound(_0x5134c7,null))['then'](removeEntity(_0x5134c7,null))[_0x2c5c('0x46')](handleError(_0x5134c7,null));};exports['getFields']=function(_0x20246c,_0x23a19b,_0x571a89){var _0x1d1c1b={};var _0x27f2d4={};var _0xc9fc4c;var _0x9cafb3;return db[_0x2c5c('0x2d')]['findOne']({'where':{'id':_0x20246c['params']['id']}})[_0x2c5c('0x26')](handleEntityNotFound(_0x23a19b,null))['then'](function(_0x3ba57b){if(_0x3ba57b){_0xc9fc4c=_0x3ba57b;_0x27f2d4['model']=_[_0x2c5c('0x32')](db[_0x2c5c('0x4d')][_0x2c5c('0x2e')]);_0x27f2d4[_0x2c5c('0x31')]=_['keys'](_0x20246c[_0x2c5c('0x31')]);_0x27f2d4[_0x2c5c('0x3d')]=_['intersection'](_0x27f2d4['model'],_0x27f2d4['query']);_0x1d1c1b[_0x2c5c('0x35')]=_[_0x2c5c('0x33')](_0x27f2d4['model'],qs[_0x2c5c('0x36')](_0x20246c[_0x2c5c('0x31')][_0x2c5c('0x36')]));_0x1d1c1b['attributes']=_0x1d1c1b[_0x2c5c('0x35')][_0x2c5c('0x49')]?_0x1d1c1b[_0x2c5c('0x35')]:_0x27f2d4[_0x2c5c('0x34')];_0x1d1c1b['order']=qs[_0x2c5c('0x3b')](_0x20246c[_0x2c5c('0x31')]['sort']);_0x1d1c1b['where']=qs['filters'](_[_0x2c5c('0x4e')](_0x20246c['query'],_0x27f2d4[_0x2c5c('0x3d')]));if(_0x20246c[_0x2c5c('0x31')][_0x2c5c('0x41')]){_0x1d1c1b[_0x2c5c('0x3c')]=_[_0x2c5c('0x3e')](_0x1d1c1b[_0x2c5c('0x3c')],{'$or':_[_0x2c5c('0x2c')](_0x1d1c1b[_0x2c5c('0x35')],function(_0x2635f5){var _0x24d42e={};_0x24d42e[_0x2635f5]={'$like':'%'+_0x20246c[_0x2c5c('0x31')][_0x2c5c('0x41')]+'%'};return _0x24d42e;})});}_0x1d1c1b=_['merge']({},_0x1d1c1b,_0x20246c[_0x2c5c('0x42')]);return _0xc9fc4c[_0x2c5c('0x4f')](_0x1d1c1b);}})['then'](function(_0x484003){if(_0x484003){_0x9cafb3=_0x484003[_0x2c5c('0x49')];if(!_0x20246c[_0x2c5c('0x31')][_0x2c5c('0x50')]('nolimit')){_0x1d1c1b[_0x2c5c('0x38')]=qs['limit'](_0x20246c[_0x2c5c('0x31')][_0x2c5c('0x38')]);_0x1d1c1b[_0x2c5c('0x39')]=qs[_0x2c5c('0x39')](_0x20246c[_0x2c5c('0x31')][_0x2c5c('0x39')]);}return _0xc9fc4c[_0x2c5c('0x4f')](_0x1d1c1b);}})[_0x2c5c('0x26')](function(_0x1e411d){if(_0x1e411d){return _0x1e411d?{'count':_0x9cafb3,'rows':_0x1e411d}:null;}})[_0x2c5c('0x26')](respondWithResult(_0x23a19b,null))['catch'](handleError(_0x23a19b,null));};exports[_0x2c5c('0x51')]=function(_0x5850fd,_0x5c6456,_0x421b3f){var _0x9ddb18={};var _0x298239={};var _0x447b37;var _0x503b50;return db[_0x2c5c('0x2d')][_0x2c5c('0x52')]({'where':{'id':_0x5850fd[_0x2c5c('0x48')]['id']}})[_0x2c5c('0x26')](handleEntityNotFound(_0x5c6456,null))[_0x2c5c('0x26')](function(_0x22f11f){if(_0x22f11f){_0x447b37=_0x22f11f;_0x298239[_0x2c5c('0x34')]=_[_0x2c5c('0x32')](db[_0x2c5c('0x4d')][_0x2c5c('0x2e')]);_0x298239[_0x2c5c('0x31')]=_[_0x2c5c('0x32')](_0x5850fd[_0x2c5c('0x31')]);_0x298239['filters']=_[_0x2c5c('0x33')](_0x298239['model'],_0x298239['query']);_0x9ddb18[_0x2c5c('0x35')]=_[_0x2c5c('0x33')](_0x298239[_0x2c5c('0x34')],qs[_0x2c5c('0x36')](_0x5850fd[_0x2c5c('0x31')][_0x2c5c('0x36')]));_0x9ddb18[_0x2c5c('0x35')]=_0x9ddb18['attributes'][_0x2c5c('0x49')]?_0x9ddb18[_0x2c5c('0x35')]:_0x298239[_0x2c5c('0x34')];_0x9ddb18['order']=qs['sort'](_0x5850fd[_0x2c5c('0x31')][_0x2c5c('0x3b')]);_0x9ddb18['where']=qs[_0x2c5c('0x3d')](_[_0x2c5c('0x4e')](_0x5850fd[_0x2c5c('0x31')],_0x298239[_0x2c5c('0x3d')]));if(_0x5850fd['query'][_0x2c5c('0x41')]){_0x9ddb18[_0x2c5c('0x3c')]=_[_0x2c5c('0x3e')](_0x9ddb18['where'],{'$or':_['map'](_0x9ddb18['attributes'],function(_0x2ef6b1){var _0x5033dd={};_0x5033dd[_0x2ef6b1]={'$like':'%'+_0x5850fd['query'][_0x2c5c('0x41')]+'%'};return _0x5033dd;})});}_0x9ddb18=_[_0x2c5c('0x3e')]({},_0x9ddb18,_0x5850fd[_0x2c5c('0x42')]);return _0x447b37[_0x2c5c('0x51')](_0x9ddb18);}})['then'](function(_0x33de09){if(_0x33de09){_0x503b50=_0x33de09[_0x2c5c('0x49')];if(!_0x5850fd['query'][_0x2c5c('0x50')](_0x2c5c('0x37'))){_0x9ddb18[_0x2c5c('0x38')]=qs[_0x2c5c('0x38')](_0x5850fd[_0x2c5c('0x31')]['limit']);_0x9ddb18['offset']=qs[_0x2c5c('0x39')](_0x5850fd[_0x2c5c('0x31')][_0x2c5c('0x39')]);}return _0x447b37[_0x2c5c('0x51')](_0x9ddb18);}})[_0x2c5c('0x26')](function(_0x2490d8){if(_0x2490d8){return _0x2490d8?{'count':_0x503b50,'rows':_0x2490d8}:null;}})[_0x2c5c('0x26')](respondWithResult(_0x5c6456,null))[_0x2c5c('0x46')](handleError(_0x5c6456,null));};exports['getDescriptions']=function(_0x5a48f6,_0x1b8c71,_0x48b029){var _0xe7e70b={};var _0x43b9b9={};var _0x4c58bd;var _0x2d080c;return db['DeskConfiguration'][_0x2c5c('0x52')]({'where':{'id':_0x5a48f6[_0x2c5c('0x48')]['id']}})['then'](handleEntityNotFound(_0x1b8c71,null))[_0x2c5c('0x26')](function(_0x3a22b2){if(_0x3a22b2){_0x4c58bd=_0x3a22b2;_0x43b9b9[_0x2c5c('0x34')]=_[_0x2c5c('0x32')](db[_0x2c5c('0x4d')][_0x2c5c('0x2e')]);_0x43b9b9['query']=_[_0x2c5c('0x32')](_0x5a48f6[_0x2c5c('0x31')]);_0x43b9b9[_0x2c5c('0x3d')]=_[_0x2c5c('0x33')](_0x43b9b9[_0x2c5c('0x34')],_0x43b9b9[_0x2c5c('0x31')]);_0xe7e70b[_0x2c5c('0x35')]=_[_0x2c5c('0x33')](_0x43b9b9['model'],qs[_0x2c5c('0x36')](_0x5a48f6[_0x2c5c('0x31')][_0x2c5c('0x36')]));_0xe7e70b['attributes']=_0xe7e70b[_0x2c5c('0x35')][_0x2c5c('0x49')]?_0xe7e70b[_0x2c5c('0x35')]:_0x43b9b9[_0x2c5c('0x34')];_0xe7e70b['order']=qs[_0x2c5c('0x3b')](_0x5a48f6[_0x2c5c('0x31')][_0x2c5c('0x3b')]);_0xe7e70b[_0x2c5c('0x3c')]=qs[_0x2c5c('0x3d')](_['pick'](_0x5a48f6[_0x2c5c('0x31')],_0x43b9b9[_0x2c5c('0x3d')]));if(_0x5a48f6[_0x2c5c('0x31')]['filter']){_0xe7e70b[_0x2c5c('0x3c')]=_[_0x2c5c('0x3e')](_0xe7e70b['where'],{'$or':_[_0x2c5c('0x2c')](_0xe7e70b[_0x2c5c('0x35')],function(_0x4b940f){var _0x1f6264={};_0x1f6264[_0x4b940f]={'$like':'%'+_0x5a48f6['query'][_0x2c5c('0x41')]+'%'};return _0x1f6264;})});}_0xe7e70b=_[_0x2c5c('0x3e')]({},_0xe7e70b,_0x5a48f6[_0x2c5c('0x42')]);return _0x4c58bd[_0x2c5c('0x53')](_0xe7e70b);}})[_0x2c5c('0x26')](function(_0x4faa92){if(_0x4faa92){_0x2d080c=_0x4faa92['length'];if(!_0x5a48f6[_0x2c5c('0x31')]['hasOwnProperty'](_0x2c5c('0x37'))){_0xe7e70b['limit']=qs[_0x2c5c('0x38')](_0x5a48f6[_0x2c5c('0x31')][_0x2c5c('0x38')]);_0xe7e70b[_0x2c5c('0x39')]=qs[_0x2c5c('0x39')](_0x5a48f6[_0x2c5c('0x31')]['offset']);}return _0x4c58bd[_0x2c5c('0x53')](_0xe7e70b);}})['then'](function(_0x31289c){if(_0x31289c){return _0x31289c?{'count':_0x2d080c,'rows':_0x31289c}:null;}})[_0x2c5c('0x26')](respondWithResult(_0x1b8c71,null))['catch'](handleError(_0x1b8c71,null));};exports[_0x2c5c('0x54')]=function(_0x9f04cc,_0x158f1f,_0x44ed46){var _0xec7202={};var _0x4ad7bd={};var _0x2540ae;var _0x4c8c0a;return db[_0x2c5c('0x2d')][_0x2c5c('0x52')]({'where':{'id':_0x9f04cc[_0x2c5c('0x48')]['id']}})[_0x2c5c('0x26')](handleEntityNotFound(_0x158f1f,null))[_0x2c5c('0x26')](function(_0x2ed974){if(_0x2ed974){_0x2540ae=_0x2ed974;_0x4ad7bd['model']=_['keys'](db['Tag'][_0x2c5c('0x2e')]);_0x4ad7bd[_0x2c5c('0x31')]=_[_0x2c5c('0x32')](_0x9f04cc[_0x2c5c('0x31')]);_0x4ad7bd[_0x2c5c('0x3d')]=_[_0x2c5c('0x33')](_0x4ad7bd[_0x2c5c('0x34')],_0x4ad7bd[_0x2c5c('0x31')]);_0xec7202['attributes']=_[_0x2c5c('0x33')](_0x4ad7bd[_0x2c5c('0x34')],qs[_0x2c5c('0x36')](_0x9f04cc[_0x2c5c('0x31')][_0x2c5c('0x36')]));_0xec7202[_0x2c5c('0x35')]=_0xec7202[_0x2c5c('0x35')][_0x2c5c('0x49')]?_0xec7202[_0x2c5c('0x35')]:_0x4ad7bd[_0x2c5c('0x34')];_0xec7202[_0x2c5c('0x3a')]=qs['sort'](_0x9f04cc[_0x2c5c('0x31')][_0x2c5c('0x3b')]);_0xec7202[_0x2c5c('0x3c')]=qs[_0x2c5c('0x3d')](_['pick'](_0x9f04cc[_0x2c5c('0x31')],_0x4ad7bd[_0x2c5c('0x3d')]));if(_0x9f04cc[_0x2c5c('0x31')]['filter']){_0xec7202[_0x2c5c('0x3c')]=_[_0x2c5c('0x3e')](_0xec7202[_0x2c5c('0x3c')],{'$or':_[_0x2c5c('0x2c')](_0xec7202[_0x2c5c('0x35')],function(_0x214e5a){var _0x2d3494={};_0x2d3494[_0x214e5a]={'$like':'%'+_0x9f04cc[_0x2c5c('0x31')]['filter']+'%'};return _0x2d3494;})});}_0xec7202=_[_0x2c5c('0x3e')]({},_0xec7202,_0x9f04cc['options']);return _0x2540ae[_0x2c5c('0x54')](_0xec7202);}})[_0x2c5c('0x26')](function(_0x1810e9){if(_0x1810e9){_0x4c8c0a=_0x1810e9[_0x2c5c('0x49')];if(!_0x9f04cc[_0x2c5c('0x31')][_0x2c5c('0x50')]('nolimit')){_0xec7202['limit']=qs[_0x2c5c('0x38')](_0x9f04cc['query'][_0x2c5c('0x38')]);_0xec7202[_0x2c5c('0x39')]=qs[_0x2c5c('0x39')](_0x9f04cc['query'][_0x2c5c('0x39')]);}return _0x2540ae['getTags'](_0xec7202);}})['then'](function(_0xfbfad7){if(_0xfbfad7){return _0xfbfad7?{'count':_0x4c8c0a,'rows':_0xfbfad7}:null;}})[_0x2c5c('0x26')](respondWithResult(_0x158f1f,null))[_0x2c5c('0x46')](handleError(_0x158f1f,null));};exports['setTags']=function(_0xbc58dc,_0x205c24,_0xdecdf0){if(_0xbc58dc[_0x2c5c('0x4c')]['id']){delete _0xbc58dc[_0x2c5c('0x4c')]['id'];}return db[_0x2c5c('0x2d')][_0x2c5c('0x52')]({'where':{'id':_0xbc58dc[_0x2c5c('0x48')]['id']}})[_0x2c5c('0x26')](handleEntityNotFound(_0x205c24,null))['then'](function(_0x5cf1d6){if(_0x5cf1d6){return _0x5cf1d6['setTags'](_0xbc58dc[_0x2c5c('0x4c')]['ids']||[]);}return null;})[_0x2c5c('0x26')](respondWithResult(_0x205c24,null))[_0x2c5c('0x46')](handleError(_0x205c24,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index b6507f9..980b9be 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 _0xde41=['define','DeskConfiguration','int_desk_configurations','lodash','../../config/logger','bluebird','path','../../config/environment','./intDeskConfiguration.attributes'];(function(_0x1752e2,_0xbb3dcc){var _0x4ceab3=function(_0x422ff9){while(--_0x422ff9){_0x1752e2['push'](_0x1752e2['shift']());}};_0x4ceab3(++_0xbb3dcc);}(_0xde41,0x1b3));var _0x1de4=function(_0x3f5bd4,_0x23e6e7){_0x3f5bd4=_0x3f5bd4-0x0;var _0xa79006=_0xde41[_0x3f5bd4];return _0xa79006;};'use strict';var _=require(_0x1de4('0x0'));var util=require('util');var logger=require(_0x1de4('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1de4('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1de4('0x3'));var rimraf=require('rimraf');var config=require(_0x1de4('0x4'));var attributes=require(_0x1de4('0x5'));module['exports']=function(_0x581607,_0x1f2abe){return _0x581607[_0x1de4('0x6')](_0x1de4('0x7'),attributes,{'tableName':_0x1de4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d88=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','int_desk_configurations','lodash','util'];(function(_0x64d4b9,_0x25c4d2){var _0x37de0=function(_0x51a062){while(--_0x51a062){_0x64d4b9['push'](_0x64d4b9['shift']());}};_0x37de0(++_0x25c4d2);}(_0x1d88,0x6c));var _0x81d8=function(_0x27b5e9,_0x59e2b8){_0x27b5e9=_0x27b5e9-0x0;var _0x40f7ae=_0x1d88[_0x27b5e9];return _0x40f7ae;};'use strict';var _=require(_0x81d8('0x0'));var util=require(_0x81d8('0x1'));var logger=require(_0x81d8('0x2'))(_0x81d8('0x3'));var moment=require(_0x81d8('0x4'));var BPromise=require(_0x81d8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x81d8('0x6'));var config=require(_0x81d8('0x7'));var attributes=require(_0x81d8('0x8'));module[_0x81d8('0x9')]=function(_0x10606b,_0x496a63){return _0x10606b['define']('DeskConfiguration',attributes,{'tableName':_0x81d8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 330dbda..cd34c5e 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 _0xa72d=['info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xa72d,0x1bf));var _0xda72=function(_0x20b2d8,_0xa8b759){_0x20b2d8=_0x20b2d8-0x0;var _0x1a8bf2=_0xa72d[_0x20b2d8];return _0x1a8bf2;};'use strict';var _=require(_0xda72('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xda72('0x1'));var rs=require(_0xda72('0x2'));var fs=require('fs');var Redis=require(_0xda72('0x3'));var db=require(_0xda72('0x4'))['db'];var utils=require(_0xda72('0x5'));var logger=require(_0xda72('0x6'))(_0xda72('0x7'));var config=require(_0xda72('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xda72('0x9')][_0xda72('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16c101,_0x4b35c9,_0x317312){return new BPromise(function(_0x2b1750,_0x290eff){return client[_0xda72('0xb')](_0x16c101,_0x317312)[_0xda72('0xc')](function(_0x40e9eb){logger[_0xda72('0xd')](_0xda72('0xe'),_0x4b35c9,_0xda72('0xf'));logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4b35c9,_0xda72('0xf'),JSON['stringify'](_0x40e9eb));if(_0x40e9eb['error']){if(_0x40e9eb[_0xda72('0x10')][_0xda72('0x11')]===0x1f4){logger['error'](_0xda72('0xe'),_0x4b35c9,_0x40e9eb[_0xda72('0x10')][_0xda72('0x12')]);return _0x290eff(_0x40e9eb[_0xda72('0x10')][_0xda72('0x12')]);}logger['error'](_0xda72('0xe'),_0x4b35c9,_0x40e9eb[_0xda72('0x10')][_0xda72('0x12')]);return _0x2b1750(_0x40e9eb[_0xda72('0x10')][_0xda72('0x12')]);}else{logger[_0xda72('0xd')](_0xda72('0xe'),_0x4b35c9,_0xda72('0xf'));_0x2b1750(_0x40e9eb['result']['message']);}})[_0xda72('0x13')](function(_0x1aa4fe){logger[_0xda72('0x10')](_0xda72('0xe'),_0x4b35c9,_0x1aa4fe);_0x290eff(_0x1aa4fe);});});} \ No newline at end of file +var _0x598a=['ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x598a,0x1c9));var _0xa598=function(_0x2bf78d,_0x4365cf){_0x2bf78d=_0x2bf78d-0x0;var _0x223653=_0x598a[_0x2bf78d];return _0x223653;};'use strict';var _=require(_0xa598('0x0'));var util=require(_0xa598('0x1'));var moment=require(_0xa598('0x2'));var BPromise=require(_0xa598('0x3'));var rs=require(_0xa598('0x4'));var fs=require('fs');var Redis=require(_0xa598('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa598('0x6'));var logger=require(_0xa598('0x7'))('rpc');var config=require(_0xa598('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa598('0x9')][_0xa598('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4fe11c,_0x16e4a7,_0x35aa05){return new BPromise(function(_0x3ba3e7,_0x1462cc){return client[_0xa598('0xb')](_0x4fe11c,_0x35aa05)[_0xa598('0xc')](function(_0x506164){logger[_0xa598('0xd')](_0xa598('0xe'),_0x16e4a7,_0xa598('0xf'));logger['debug'](_0xa598('0x10'),_0x16e4a7,_0xa598('0xf'),JSON[_0xa598('0x11')](_0x506164));if(_0x506164['error']){if(_0x506164[_0xa598('0x12')]['code']===0x1f4){logger['error'](_0xa598('0xe'),_0x16e4a7,_0x506164[_0xa598('0x12')]['message']);return _0x1462cc(_0x506164[_0xa598('0x12')][_0xa598('0x13')]);}logger[_0xa598('0x12')](_0xa598('0xe'),_0x16e4a7,_0x506164[_0xa598('0x12')]['message']);return _0x3ba3e7(_0x506164['error'][_0xa598('0x13')]);}else{logger['info'](_0xa598('0xe'),_0x16e4a7,_0xa598('0xf'));_0x3ba3e7(_0x506164[_0xa598('0x14')][_0xa598('0x13')]);}})['catch'](function(_0xcf7b45){logger[_0xa598('0x12')](_0xa598('0xe'),_0x16e4a7,_0xcf7b45);_0x1462cc(_0xcf7b45);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index f47e527..c9f93c9 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 _0x8786=['multer','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','put'];(function(_0x28c752,_0x238454){var _0x30cd6c=function(_0x4c71be){while(--_0x4c71be){_0x28c752['push'](_0x28c752['shift']());}};_0x30cd6c(++_0x238454);}(_0x8786,0x138));var _0x6878=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x8786[_0x1035c1];return _0x308d67;};'use strict';var multer=require(_0x6878('0x0'));var util=require('util');var path=require(_0x6878('0x1'));var timeout=require(_0x6878('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6878('0x3'));var auth=require(_0x6878('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6878('0x5'));var controller=require(_0x6878('0x6'));router[_0x6878('0x7')]('/',auth[_0x6878('0x8')](),controller[_0x6878('0x9')]);router[_0x6878('0x7')](_0x6878('0xa'),auth[_0x6878('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x6878('0xb')](_0x6878('0xa'),auth[_0x6878('0x8')](),controller['update']);router['delete'](_0x6878('0xa'),auth[_0x6878('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x98d4=['./intDeskField.controller','index','/:id','isAuthenticated','show','post','create','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x5c850c,_0x26d7ec){var _0x10c0eb=function(_0x2b502d){while(--_0x2b502d){_0x5c850c['push'](_0x5c850c['shift']());}};_0x10c0eb(++_0x26d7ec);}(_0x98d4,0x13a));var _0x498d=function(_0x142232,_0x4f466d){_0x142232=_0x142232-0x0;var _0x235292=_0x98d4[_0x142232];return _0x235292;};'use strict';var multer=require(_0x498d('0x0'));var util=require(_0x498d('0x1'));var path=require(_0x498d('0x2'));var timeout=require('connect-timeout');var express=require(_0x498d('0x3'));var router=express[_0x498d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x498d('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x498d('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x498d('0x7')]);router['get'](_0x498d('0x8'),auth[_0x498d('0x9')](),controller[_0x498d('0xa')]);router[_0x498d('0xb')]('/',auth[_0x498d('0x9')](),controller[_0x498d('0xc')]);router['put'](_0x498d('0x8'),auth['isAuthenticated'](),controller[_0x498d('0xd')]);router['delete'](_0x498d('0x8'),auth[_0x498d('0x9')](),controller[_0x498d('0xe')]);module[_0x498d('0xf')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 95975cd..77b0f08 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 _0xfebf=['variable','customVariable','string','STRING','BOOLEAN','exports','ENUM'];(function(_0x7e907d,_0x54ba4e){var _0x870afb=function(_0x304a73){while(--_0x304a73){_0x7e907d['push'](_0x7e907d['shift']());}};_0x870afb(++_0x54ba4e);}(_0xfebf,0x8a));var _0xffeb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfebf[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xffeb('0x0')]={'type':{'type':Sequelize[_0xffeb('0x1')]('string',_0xffeb('0x2'),_0xffeb('0x3'),'keyValue','picklist'),'defaultValue':_0xffeb('0x4')},'content':{'type':Sequelize[_0xffeb('0x5')]},'key':{'type':Sequelize[_0xffeb('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xffeb('0x4'),_0xffeb('0x2'),_0xffeb('0x3'))},'keyContent':{'type':Sequelize[_0xffeb('0x5')]},'idField':{'type':Sequelize[_0xffeb('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xffeb('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xffeb('0x5')]}}; \ No newline at end of file +var _0x0947=['keyValue','picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x531a19,_0x43e019){var _0x4845d2=function(_0x4c9b62){while(--_0x4c9b62){_0x531a19['push'](_0x531a19['shift']());}};_0x4845d2(++_0x43e019);}(_0x0947,0x147));var _0x7094=function(_0x2a06ce,_0x1736b6){_0x2a06ce=_0x2a06ce-0x0;var _0x284207=_0x0947[_0x2a06ce];return _0x284207;};'use strict';var Sequelize=require(_0x7094('0x0'));module[_0x7094('0x1')]={'type':{'type':Sequelize[_0x7094('0x2')](_0x7094('0x3'),_0x7094('0x4'),_0x7094('0x5'),_0x7094('0x6'),_0x7094('0x7')),'defaultValue':_0x7094('0x3')},'content':{'type':Sequelize[_0x7094('0x8')]},'key':{'type':Sequelize[_0x7094('0x8')]},'keyType':{'type':Sequelize[_0x7094('0x2')](_0x7094('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x7094('0x8')]},'idField':{'type':Sequelize[_0x7094('0x8')]},'nameField':{'type':Sequelize[_0x7094('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7094('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index a97aa67..06a23e7 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 _0x6b8f=['fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','rows','catch','show','params','keys','find','create','body','rimraf','fast-json-patch','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','apply','reject','save','update','destroy','then','end','name','send','index','map','DeskField','rawAttributes'];(function(_0x3db811,_0x3f5c1e){var _0x728ba8=function(_0xf40fe0){while(--_0xf40fe0){_0x3db811['push'](_0x3db811['shift']());}};_0x728ba8(++_0x3f5c1e);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x4a0000,_0x7efe3){_0x4a0000=_0x4a0000-0x0;var _0x4973d2=_0x6b8f[_0x4a0000];return _0x4973d2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf6b8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf6b8('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf6b8('0x2'));var Mustache=require(_0xf6b8('0x3'));var util=require('util');var path=require(_0xf6b8('0x4'));var sox=require(_0xf6b8('0x5'));var csv=require(_0xf6b8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf6b8('0x7'));var _=require(_0xf6b8('0x8'));var squel=require(_0xf6b8('0x9'));var crypto=require(_0xf6b8('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf6b8('0x6'));var querystring=require('querystring');var Papa=require(_0xf6b8('0xb'));var Redis=require(_0xf6b8('0xc'));var authService=require(_0xf6b8('0xd'));var qs=require(_0xf6b8('0xe'));var as=require(_0xf6b8('0xf'));var hardwareService=require(_0xf6b8('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xf6b8('0x11'));var licenseUtil=require(_0xf6b8('0x12'));var db=require(_0xf6b8('0x13'))['db'];function respondWithStatusCode(_0x1d96b9,_0x5a6118){_0x5a6118=_0x5a6118||0xcc;return function(_0x4e5235){if(_0x4e5235){return _0x1d96b9[_0xf6b8('0x14')](_0x5a6118);}return _0x1d96b9[_0xf6b8('0x15')](_0x5a6118)['end']();};}function respondWithResult(_0xfcecc9,_0x2db10c){_0x2db10c=_0x2db10c||0xc8;return function(_0x454d8a){if(_0x454d8a){return _0xfcecc9['status'](_0x2db10c)[_0xf6b8('0x16')](_0x454d8a);}};}function respondWithFilteredResult(_0x53d744,_0x410345){return function(_0x1ee041){if(_0x1ee041){var _0x2e1748=typeof _0x410345[_0xf6b8('0x17')]===_0xf6b8('0x18')&&typeof _0x410345['limit']==='undefined';var _0x3bb9ae=_0x1ee041['count'];var _0x3cf63c=_0x2e1748?0x0:_0x410345[_0xf6b8('0x17')];var _0x4a93a8=_0x2e1748?_0x1ee041['count']:_0x410345[_0xf6b8('0x17')]+_0x410345[_0xf6b8('0x19')];var _0x3081db;if(_0x4a93a8>=_0x3bb9ae){_0x4a93a8=_0x3bb9ae;_0x3081db=0xc8;}else{_0x3081db=0xce;}_0x53d744[_0xf6b8('0x15')](_0x3081db);return _0x53d744['set']('Content-Range',_0x3cf63c+'-'+_0x4a93a8+'/'+_0x3bb9ae)['json'](_0x1ee041);}return null;};}function patchUpdates(_0x3298a4){return function(_0x2a8195){try{jsonpatch[_0xf6b8('0x1a')](_0x2a8195,_0x3298a4,!![]);}catch(_0x56b48a){return BPromise[_0xf6b8('0x1b')](_0x56b48a);}return _0x2a8195[_0xf6b8('0x1c')]();};}function saveUpdates(_0x3d2c57,_0x9c660c){return function(_0x5dd616){if(_0x5dd616){return _0x5dd616[_0xf6b8('0x1d')](_0x3d2c57)['then'](function(_0x22c52d){return _0x22c52d;});}return null;};}function removeEntity(_0x2b5bd3,_0x13a451){return function(_0x4127c9){if(_0x4127c9){return _0x4127c9[_0xf6b8('0x1e')]()[_0xf6b8('0x1f')](function(){_0x2b5bd3['status'](0xcc)[_0xf6b8('0x20')]();});}};}function handleEntityNotFound(_0x1ebfea,_0x4815f7){return function(_0x205d6c){if(!_0x205d6c){_0x1ebfea[_0xf6b8('0x14')](0x194);}return _0x205d6c;};}function handleError(_0x324057,_0xd5ebb5){_0xd5ebb5=_0xd5ebb5||0x1f4;return function(_0x3365b8){logger['error'](_0x3365b8['stack']);if(_0x3365b8[_0xf6b8('0x21')]){delete _0x3365b8[_0xf6b8('0x21')];}_0x324057['status'](_0xd5ebb5)[_0xf6b8('0x22')](_0x3365b8);};}exports[_0xf6b8('0x23')]=function(_0x888319,_0x5a7f55){var _0x458935={},_0xc958f4={},_0x511896={'count':0x0,'rows':[]};var _0x309f04=_[_0xf6b8('0x24')](db[_0xf6b8('0x25')][_0xf6b8('0x26')],function(_0x51ffcf){return{'name':_0x51ffcf[_0xf6b8('0x27')],'type':_0x51ffcf[_0xf6b8('0x28')][_0xf6b8('0x29')]};});_0xc958f4['model']=_[_0xf6b8('0x24')](_0x309f04,_0xf6b8('0x21'));_0xc958f4[_0xf6b8('0x2a')]=_['keys'](_0x888319[_0xf6b8('0x2a')]);_0xc958f4[_0xf6b8('0x2b')]=_[_0xf6b8('0x2c')](_0xc958f4[_0xf6b8('0x2d')],_0xc958f4['query']);_0x458935[_0xf6b8('0x2e')]=_[_0xf6b8('0x2c')](_0xc958f4[_0xf6b8('0x2d')],qs['fields'](_0x888319['query'][_0xf6b8('0x2f')]));_0x458935[_0xf6b8('0x2e')]=_0x458935[_0xf6b8('0x2e')][_0xf6b8('0x30')]?_0x458935[_0xf6b8('0x2e')]:_0xc958f4[_0xf6b8('0x2d')];if(!_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x31')](_0xf6b8('0x32'))){_0x458935[_0xf6b8('0x19')]=qs[_0xf6b8('0x19')](_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x19')]);_0x458935[_0xf6b8('0x17')]=qs[_0xf6b8('0x17')](_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x17')]);}_0x458935[_0xf6b8('0x33')]=qs['sort'](_0x888319['query'][_0xf6b8('0x34')]);_0x458935[_0xf6b8('0x35')]=qs[_0xf6b8('0x2b')](_[_0xf6b8('0x36')](_0x888319[_0xf6b8('0x2a')],_0xc958f4[_0xf6b8('0x2b')]),_0x309f04);if(_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x37')]){_0x458935[_0xf6b8('0x35')]=_[_0xf6b8('0x38')](_0x458935[_0xf6b8('0x35')],{'$or':_[_0xf6b8('0x24')](_0x309f04,function(_0x4a8c49){if(_0x4a8c49[_0xf6b8('0x28')]!==_0xf6b8('0x39')){var _0x5d26ad={};_0x5d26ad[_0x4a8c49[_0xf6b8('0x21')]]={'$like':'%'+_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x37')]+'%'};return _0x5d26ad;}})});}_0x458935=_[_0xf6b8('0x38')]({},_0x458935,_0x888319[_0xf6b8('0x3a')]);var _0x87a4ee={'where':_0x458935[_0xf6b8('0x35')]};return db[_0xf6b8('0x25')][_0xf6b8('0x3b')](_0x87a4ee)[_0xf6b8('0x1f')](function(_0x15a63b){_0x511896[_0xf6b8('0x3b')]=_0x15a63b;if(_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x3c')]){_0x458935['include']=[{'all':!![]}];}return db['DeskField']['findAll'](_0x458935);})[_0xf6b8('0x1f')](function(_0x2c68f5){_0x511896[_0xf6b8('0x3d')]=_0x2c68f5;return _0x511896;})[_0xf6b8('0x1f')](respondWithFilteredResult(_0x5a7f55,_0x458935))[_0xf6b8('0x3e')](handleError(_0x5a7f55,null));};exports[_0xf6b8('0x3f')]=function(_0x1390dc,_0x48f4cb){var _0x1f5e72={'raw':!![],'where':{'id':_0x1390dc[_0xf6b8('0x40')]['id']}},_0x5086d9={};_0x5086d9[_0xf6b8('0x2d')]=_[_0xf6b8('0x41')](db[_0xf6b8('0x25')][_0xf6b8('0x26')]);_0x5086d9['query']=_[_0xf6b8('0x41')](_0x1390dc[_0xf6b8('0x2a')]);_0x5086d9[_0xf6b8('0x2b')]=_[_0xf6b8('0x2c')](_0x5086d9[_0xf6b8('0x2d')],_0x5086d9['query']);_0x1f5e72[_0xf6b8('0x2e')]=_[_0xf6b8('0x2c')](_0x5086d9[_0xf6b8('0x2d')],qs['fields'](_0x1390dc['query'][_0xf6b8('0x2f')]));_0x1f5e72[_0xf6b8('0x2e')]=_0x1f5e72[_0xf6b8('0x2e')][_0xf6b8('0x30')]?_0x1f5e72['attributes']:_0x5086d9['model'];if(_0x1390dc['query'][_0xf6b8('0x3c')]){_0x1f5e72['include']=[{'all':!![]}];}_0x1f5e72=_[_0xf6b8('0x38')]({},_0x1f5e72,_0x1390dc[_0xf6b8('0x3a')]);return db[_0xf6b8('0x25')][_0xf6b8('0x42')](_0x1f5e72)[_0xf6b8('0x1f')](handleEntityNotFound(_0x48f4cb,null))[_0xf6b8('0x1f')](respondWithResult(_0x48f4cb,null))[_0xf6b8('0x3e')](handleError(_0x48f4cb,null));};exports[_0xf6b8('0x43')]=function(_0x394a34,_0x597511){return db[_0xf6b8('0x25')]['create'](_0x394a34[_0xf6b8('0x44')],{})[_0xf6b8('0x1f')](respondWithResult(_0x597511,0xc9))[_0xf6b8('0x3e')](handleError(_0x597511,null));};exports[_0xf6b8('0x1d')]=function(_0x1abf17,_0x291845){if(_0x1abf17[_0xf6b8('0x44')]['id']){delete _0x1abf17['body']['id'];}return db[_0xf6b8('0x25')][_0xf6b8('0x42')]({'where':{'id':_0x1abf17[_0xf6b8('0x40')]['id']}})[_0xf6b8('0x1f')](handleEntityNotFound(_0x291845,null))['then'](saveUpdates(_0x1abf17[_0xf6b8('0x44')],null))[_0xf6b8('0x1f')](respondWithResult(_0x291845,null))['catch'](handleError(_0x291845,null));};exports[_0xf6b8('0x1e')]=function(_0x143164,_0x392582){return db[_0xf6b8('0x25')][_0xf6b8('0x42')]({'where':{'id':_0x143164['params']['id']}})[_0xf6b8('0x1f')](handleEntityNotFound(_0x392582,null))[_0xf6b8('0x1f')](removeEntity(_0x392582,null))['catch'](handleError(_0x392582,null));}; \ No newline at end of file +var _0x995a=['fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','destroy','sendStatus','error','name','send','index','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','then','includeAll','include','findAll','rows','show','params','options','find','catch','create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x995a,0x176));var _0xa995=function(_0x26a25,_0xfa3135){_0x26a25=_0x26a25-0x0;var _0x4398b5=_0x995a[_0x26a25];return _0x4398b5;};'use strict';var emlformat=require(_0xa995('0x0'));var rimraf=require(_0xa995('0x1'));var zipdir=require(_0xa995('0x2'));var jsonpatch=require(_0xa995('0x3'));var rp=require(_0xa995('0x4'));var moment=require(_0xa995('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa995('0x6'));var util=require(_0xa995('0x7'));var path=require(_0xa995('0x8'));var sox=require(_0xa995('0x9'));var csv=require('to-csv');var ejs=require(_0xa995('0xa'));var fs=require('fs');var fs_extra=require(_0xa995('0xb'));var _=require(_0xa995('0xc'));var squel=require(_0xa995('0xd'));var crypto=require(_0xa995('0xe'));var jsforce=require(_0xa995('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa995('0x10'));var querystring=require(_0xa995('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa995('0x12'));var hardwareService=require(_0xa995('0x13'));var logger=require(_0xa995('0x14'))(_0xa995('0x15'));var utils=require(_0xa995('0x16'));var config=require(_0xa995('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d69f8,_0x35d112){_0x35d112=_0x35d112||0xcc;return function(_0x5e4f65){if(_0x5e4f65){return _0x5d69f8['sendStatus'](_0x35d112);}return _0x5d69f8[_0xa995('0x18')](_0x35d112)[_0xa995('0x19')]();};}function respondWithResult(_0x2a6b3f,_0x4cb7a7){_0x4cb7a7=_0x4cb7a7||0xc8;return function(_0x94493e){if(_0x94493e){return _0x2a6b3f['status'](_0x4cb7a7)[_0xa995('0x1a')](_0x94493e);}};}function respondWithFilteredResult(_0x4d386e,_0x4e5f38){return function(_0x472336){if(_0x472336){var _0x11a06e=typeof _0x4e5f38['offset']===_0xa995('0x1b')&&typeof _0x4e5f38[_0xa995('0x1c')]===_0xa995('0x1b');var _0x133a76=_0x472336[_0xa995('0x1d')];var _0x1e976d=_0x11a06e?0x0:_0x4e5f38[_0xa995('0x1e')];var _0x53d594=_0x11a06e?_0x472336[_0xa995('0x1d')]:_0x4e5f38[_0xa995('0x1e')]+_0x4e5f38[_0xa995('0x1c')];var _0xbe3511;if(_0x53d594>=_0x133a76){_0x53d594=_0x133a76;_0xbe3511=0xc8;}else{_0xbe3511=0xce;}_0x4d386e[_0xa995('0x18')](_0xbe3511);return _0x4d386e[_0xa995('0x1f')](_0xa995('0x20'),_0x1e976d+'-'+_0x53d594+'/'+_0x133a76)[_0xa995('0x1a')](_0x472336);}return null;};}function patchUpdates(_0x2e585d){return function(_0x17de44){try{jsonpatch['apply'](_0x17de44,_0x2e585d,!![]);}catch(_0x554fb8){return BPromise[_0xa995('0x21')](_0x554fb8);}return _0x17de44[_0xa995('0x22')]();};}function saveUpdates(_0x5a4b8e,_0x3f907b){return function(_0x498710){if(_0x498710){return _0x498710['update'](_0x5a4b8e)['then'](function(_0x959af3){return _0x959af3;});}return null;};}function removeEntity(_0x579949,_0x136318){return function(_0x28c32f){if(_0x28c32f){return _0x28c32f[_0xa995('0x23')]()['then'](function(){_0x579949[_0xa995('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25282f,_0x4748f0){return function(_0x48db60){if(!_0x48db60){_0x25282f[_0xa995('0x24')](0x194);}return _0x48db60;};}function handleError(_0x18387b,_0x5a5523){_0x5a5523=_0x5a5523||0x1f4;return function(_0x3ff57e){logger[_0xa995('0x25')](_0x3ff57e['stack']);if(_0x3ff57e[_0xa995('0x26')]){delete _0x3ff57e[_0xa995('0x26')];}_0x18387b[_0xa995('0x18')](_0x5a5523)[_0xa995('0x27')](_0x3ff57e);};}exports[_0xa995('0x28')]=function(_0x12cd02,_0xe76880){var _0x17e739={},_0x47092d={},_0x9b5038={'count':0x0,'rows':[]};var _0x415ba4=_[_0xa995('0x29')](db[_0xa995('0x2a')][_0xa995('0x2b')],function(_0xbcaccb){return{'name':_0xbcaccb[_0xa995('0x2c')],'type':_0xbcaccb[_0xa995('0x2d')][_0xa995('0x2e')]};});_0x47092d[_0xa995('0x2f')]=_[_0xa995('0x29')](_0x415ba4,_0xa995('0x26'));_0x47092d[_0xa995('0x30')]=_[_0xa995('0x31')](_0x12cd02['query']);_0x47092d[_0xa995('0x32')]=_['intersection'](_0x47092d['model'],_0x47092d['query']);_0x17e739[_0xa995('0x33')]=_[_0xa995('0x34')](_0x47092d['model'],qs[_0xa995('0x35')](_0x12cd02['query'][_0xa995('0x35')]));_0x17e739[_0xa995('0x33')]=_0x17e739[_0xa995('0x33')][_0xa995('0x36')]?_0x17e739['attributes']:_0x47092d['model'];if(!_0x12cd02[_0xa995('0x30')][_0xa995('0x37')](_0xa995('0x38'))){_0x17e739[_0xa995('0x1c')]=qs[_0xa995('0x1c')](_0x12cd02[_0xa995('0x30')]['limit']);_0x17e739[_0xa995('0x1e')]=qs['offset'](_0x12cd02[_0xa995('0x30')][_0xa995('0x1e')]);}_0x17e739[_0xa995('0x39')]=qs[_0xa995('0x3a')](_0x12cd02[_0xa995('0x30')][_0xa995('0x3a')]);_0x17e739[_0xa995('0x3b')]=qs['filters'](_[_0xa995('0x3c')](_0x12cd02['query'],_0x47092d[_0xa995('0x32')]),_0x415ba4);if(_0x12cd02['query'][_0xa995('0x3d')]){_0x17e739[_0xa995('0x3b')]=_[_0xa995('0x3e')](_0x17e739[_0xa995('0x3b')],{'$or':_['map'](_0x415ba4,function(_0x2453a7){if(_0x2453a7[_0xa995('0x2d')]!==_0xa995('0x3f')){var _0x4cf016={};_0x4cf016[_0x2453a7[_0xa995('0x26')]]={'$like':'%'+_0x12cd02[_0xa995('0x30')]['filter']+'%'};return _0x4cf016;}})});}_0x17e739=_['merge']({},_0x17e739,_0x12cd02['options']);var _0x41f29c={'where':_0x17e739[_0xa995('0x3b')]};return db[_0xa995('0x2a')][_0xa995('0x1d')](_0x41f29c)[_0xa995('0x40')](function(_0x2934f4){_0x9b5038['count']=_0x2934f4;if(_0x12cd02[_0xa995('0x30')][_0xa995('0x41')]){_0x17e739[_0xa995('0x42')]=[{'all':!![]}];}return db[_0xa995('0x2a')][_0xa995('0x43')](_0x17e739);})[_0xa995('0x40')](function(_0x512058){_0x9b5038[_0xa995('0x44')]=_0x512058;return _0x9b5038;})[_0xa995('0x40')](respondWithFilteredResult(_0xe76880,_0x17e739))['catch'](handleError(_0xe76880,null));};exports[_0xa995('0x45')]=function(_0x4ff194,_0x122665){var _0xf4e29a={'raw':!![],'where':{'id':_0x4ff194[_0xa995('0x46')]['id']}},_0x4d0dbf={};_0x4d0dbf[_0xa995('0x2f')]=_[_0xa995('0x31')](db['DeskField'][_0xa995('0x2b')]);_0x4d0dbf['query']=_['keys'](_0x4ff194[_0xa995('0x30')]);_0x4d0dbf[_0xa995('0x32')]=_[_0xa995('0x34')](_0x4d0dbf[_0xa995('0x2f')],_0x4d0dbf[_0xa995('0x30')]);_0xf4e29a[_0xa995('0x33')]=_[_0xa995('0x34')](_0x4d0dbf['model'],qs['fields'](_0x4ff194['query'][_0xa995('0x35')]));_0xf4e29a[_0xa995('0x33')]=_0xf4e29a[_0xa995('0x33')][_0xa995('0x36')]?_0xf4e29a[_0xa995('0x33')]:_0x4d0dbf[_0xa995('0x2f')];if(_0x4ff194[_0xa995('0x30')]['includeAll']){_0xf4e29a[_0xa995('0x42')]=[{'all':!![]}];}_0xf4e29a=_[_0xa995('0x3e')]({},_0xf4e29a,_0x4ff194[_0xa995('0x47')]);return db[_0xa995('0x2a')][_0xa995('0x48')](_0xf4e29a)['then'](handleEntityNotFound(_0x122665,null))[_0xa995('0x40')](respondWithResult(_0x122665,null))[_0xa995('0x49')](handleError(_0x122665,null));};exports[_0xa995('0x4a')]=function(_0x501613,_0x4d41b5){return db[_0xa995('0x2a')][_0xa995('0x4a')](_0x501613['body'],{})[_0xa995('0x40')](respondWithResult(_0x4d41b5,0xc9))['catch'](handleError(_0x4d41b5,null));};exports[_0xa995('0x4b')]=function(_0x4ba8c5,_0x5af788){if(_0x4ba8c5[_0xa995('0x4c')]['id']){delete _0x4ba8c5[_0xa995('0x4c')]['id'];}return db[_0xa995('0x2a')][_0xa995('0x48')]({'where':{'id':_0x4ba8c5['params']['id']}})['then'](handleEntityNotFound(_0x5af788,null))[_0xa995('0x40')](saveUpdates(_0x4ba8c5[_0xa995('0x4c')],null))['then'](respondWithResult(_0x5af788,null))[_0xa995('0x49')](handleError(_0x5af788,null));};exports['destroy']=function(_0x5e3ce7,_0x199b25){return db[_0xa995('0x2a')][_0xa995('0x48')]({'where':{'id':_0x5e3ce7[_0xa995('0x46')]['id']}})[_0xa995('0x40')](handleEntityNotFound(_0x199b25,null))[_0xa995('0x40')](removeEntity(_0x199b25,null))[_0xa995('0x49')](handleError(_0x199b25,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 3adf8f0..c1a3322 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 _0xc4cb=['./intDeskField.attributes','exports','DeskField','desk_unique_index','idField','FieldId','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x46cf08,_0x1c5941){var _0x581819=function(_0x407809){while(--_0x407809){_0x46cf08['push'](_0x46cf08['shift']());}};_0x581819(++_0x1c5941);}(_0xc4cb,0x1d4));var _0xbc4c=function(_0x302ebe,_0x4f4943){_0x302ebe=_0x302ebe-0x0;var _0x3c7926=_0xc4cb[_0x302ebe];return _0x3c7926;};'use strict';var _=require(_0xbc4c('0x0'));var util=require(_0xbc4c('0x1'));var logger=require('../../config/logger')(_0xbc4c('0x2'));var moment=require('moment');var BPromise=require(_0xbc4c('0x3'));var rp=require(_0xbc4c('0x4'));var fs=require('fs');var path=require(_0xbc4c('0x5'));var rimraf=require(_0xbc4c('0x6'));var config=require(_0xbc4c('0x7'));var attributes=require(_0xbc4c('0x8'));module[_0xbc4c('0x9')]=function(_0x2fb4b1,_0x4e73be){return _0x2fb4b1['define'](_0xbc4c('0xa'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0xbc4c('0xb'),'fields':[_0xbc4c('0xc'),_0xbc4c('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1646=['idField','FieldId','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./intDeskField.attributes','define','int_desk_fields','desk_unique_index'];(function(_0x2216b6,_0x1aad3d){var _0x2e237a=function(_0x25d978){while(--_0x25d978){_0x2216b6['push'](_0x2216b6['shift']());}};_0x2e237a(++_0x1aad3d);}(_0x1646,0x18a));var _0x6164=function(_0x34d275,_0x5d84ee){_0x34d275=_0x34d275-0x0;var _0x1379cc=_0x1646[_0x34d275];return _0x1379cc;};'use strict';var _=require(_0x6164('0x0'));var util=require(_0x6164('0x1'));var logger=require('../../config/logger')(_0x6164('0x2'));var moment=require(_0x6164('0x3'));var BPromise=require(_0x6164('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6164('0x5'));var rimraf=require(_0x6164('0x6'));var config=require(_0x6164('0x7'));var attributes=require(_0x6164('0x8'));module['exports']=function(_0x4c64e7,_0x289e90){return _0x4c64e7[_0x6164('0x9')]('DeskField',attributes,{'tableName':_0x6164('0xa'),'paranoid':![],'indexes':[{'name':_0x6164('0xb'),'fields':[_0x6164('0xc'),_0x6164('0xd')],'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 19b8375..f461b96 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 _0x0088=['../../config/logger','rpc','../../config/environment','http','request','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1af415,_0x54e052){var _0xc13cd7=function(_0x29e232){while(--_0x29e232){_0x1af415['push'](_0x1af415['shift']());}};_0xc13cd7(++_0x54e052);}(_0x0088,0x112));var _0x8008=function(_0x2ce61a,_0x2c54ae){_0x2ce61a=_0x2ce61a-0x0;var _0x6fe3f5=_0x0088[_0x2ce61a];return _0x6fe3f5;};'use strict';var _=require(_0x8008('0x0'));var util=require('util');var moment=require(_0x8008('0x1'));var BPromise=require(_0x8008('0x2'));var rs=require(_0x8008('0x3'));var fs=require('fs');var Redis=require(_0x8008('0x4'));var db=require(_0x8008('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8008('0x6'))(_0x8008('0x7'));var config=require(_0x8008('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8008('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3fe66e,_0xf55cc0,_0x3f718c){return new BPromise(function(_0x8379c1,_0x10b824){return client[_0x8008('0xa')](_0x3fe66e,_0x3f718c)['then'](function(_0x236c18){logger[_0x8008('0xb')](_0x8008('0xc'),_0xf55cc0,_0x8008('0xd'));logger[_0x8008('0xe')](_0x8008('0xf'),_0xf55cc0,'request\x20sent',JSON[_0x8008('0x10')](_0x236c18));if(_0x236c18['error']){if(_0x236c18[_0x8008('0x11')][_0x8008('0x12')]===0x1f4){logger['error'](_0x8008('0xc'),_0xf55cc0,_0x236c18[_0x8008('0x11')][_0x8008('0x13')]);return _0x10b824(_0x236c18[_0x8008('0x11')][_0x8008('0x13')]);}logger['error'](_0x8008('0xc'),_0xf55cc0,_0x236c18[_0x8008('0x11')][_0x8008('0x13')]);return _0x8379c1(_0x236c18[_0x8008('0x11')]['message']);}else{logger['info'](_0x8008('0xc'),_0xf55cc0,'request\x20sent');_0x8379c1(_0x236c18['result']['message']);}})['catch'](function(_0x3c1d91){logger[_0x8008('0x11')](_0x8008('0xc'),_0xf55cc0,_0x3c1d91);_0x10b824(_0x3c1d91);});});} \ No newline at end of file +var _0xe927=['DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info'];(function(_0x3c1463,_0x368f5a){var _0x140f4b=function(_0x3701ba){while(--_0x3701ba){_0x3c1463['push'](_0x3c1463['shift']());}};_0x140f4b(++_0x368f5a);}(_0xe927,0x110));var _0x7e92=function(_0x197954,_0x3f61d0){_0x197954=_0x197954-0x0;var _0x231d54=_0xe927[_0x197954];return _0x231d54;};'use strict';var _=require(_0x7e92('0x0'));var util=require(_0x7e92('0x1'));var moment=require(_0x7e92('0x2'));var BPromise=require(_0x7e92('0x3'));var rs=require(_0x7e92('0x4'));var fs=require('fs');var Redis=require(_0x7e92('0x5'));var db=require(_0x7e92('0x6'))['db'];var utils=require(_0x7e92('0x7'));var logger=require(_0x7e92('0x8'))('rpc');var config=require(_0x7e92('0x9'));var jayson=require(_0x7e92('0xa'));var client=jayson[_0x7e92('0xb')][_0x7e92('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a450e,_0x48d9f8,_0x153850){return new BPromise(function(_0x2fcf11,_0x3dbd2b){return client['request'](_0x5a450e,_0x153850)['then'](function(_0x245c7d){logger[_0x7e92('0xd')](_0x7e92('0xe'),_0x48d9f8,_0x7e92('0xf'));logger[_0x7e92('0x10')](_0x7e92('0x11'),_0x48d9f8,_0x7e92('0xf'),JSON[_0x7e92('0x12')](_0x245c7d));if(_0x245c7d[_0x7e92('0x13')]){if(_0x245c7d[_0x7e92('0x13')]['code']===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x48d9f8,_0x245c7d['error']['message']);return _0x3dbd2b(_0x245c7d[_0x7e92('0x13')]['message']);}logger['error'](_0x7e92('0xe'),_0x48d9f8,_0x245c7d[_0x7e92('0x13')][_0x7e92('0x14')]);return _0x2fcf11(_0x245c7d[_0x7e92('0x13')]['message']);}else{logger[_0x7e92('0xd')]('DeskField,\x20%s,\x20%s',_0x48d9f8,_0x7e92('0xf'));_0x2fcf11(_0x245c7d[_0x7e92('0x15')][_0x7e92('0x14')]);}})['catch'](function(_0x21c3d5){logger['error'](_0x7e92('0xe'),_0x48d9f8,_0x21c3d5);_0x3dbd2b(_0x21c3d5);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 7580695..5552997 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 _0x68a6=['post','create','addConfiguration','put','/:id','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','show','/:id/configurations','/:id/fields','getFields'];(function(_0x51fe4c,_0x2ccf8f){var _0x219c45=function(_0x1fd2f1){while(--_0x1fd2f1){_0x51fe4c['push'](_0x51fe4c['shift']());}};_0x219c45(++_0x2ccf8f);}(_0x68a6,0x187));var _0x668a=function(_0x51f9ad,_0x1619cf){_0x51f9ad=_0x51f9ad-0x0;var _0x322e62=_0x68a6[_0x51f9ad];return _0x322e62;};'use strict';var multer=require(_0x668a('0x0'));var util=require(_0x668a('0x1'));var path=require(_0x668a('0x2'));var timeout=require(_0x668a('0x3'));var express=require(_0x668a('0x4'));var router=express['Router']();var fs_extra=require(_0x668a('0x5'));var auth=require(_0x668a('0x6'));var interaction=require(_0x668a('0x7'));var config=require(_0x668a('0x8'));var controller=require(_0x668a('0x9'));router[_0x668a('0xa')]('/',auth[_0x668a('0xb')](),controller[_0x668a('0xc')]);router['get']('/:id',auth[_0x668a('0xb')](),controller[_0x668a('0xd')]);router[_0x668a('0xa')](_0x668a('0xe'),auth[_0x668a('0xb')](),controller['getConfigurations']);router[_0x668a('0xa')](_0x668a('0xf'),auth[_0x668a('0xb')](),controller[_0x668a('0x10')]);router[_0x668a('0x11')]('/',auth['isAuthenticated'](),controller[_0x668a('0x12')]);router[_0x668a('0x11')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x668a('0x13')]);router[_0x668a('0x14')](_0x668a('0x15'),auth[_0x668a('0xb')](),controller['update']);router[_0x668a('0x16')](_0x668a('0x15'),auth[_0x668a('0xb')](),controller['destroy']);module[_0x668a('0x17')]=router; \ No newline at end of file +var _0x8aa1=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration'];(function(_0x2446b4,_0x3d901d){var _0x53f146=function(_0x208d33){while(--_0x208d33){_0x2446b4['push'](_0x2446b4['shift']());}};_0x53f146(++_0x3d901d);}(_0x8aa1,0xea));var _0x18aa=function(_0x2d17ec,_0x54eb4d){_0x2d17ec=_0x2d17ec-0x0;var _0x162002=_0x8aa1[_0x2d17ec];return _0x162002;};'use strict';var multer=require('multer');var util=require(_0x18aa('0x0'));var path=require(_0x18aa('0x1'));var timeout=require(_0x18aa('0x2'));var express=require(_0x18aa('0x3'));var router=express[_0x18aa('0x4')]();var fs_extra=require(_0x18aa('0x5'));var auth=require(_0x18aa('0x6'));var interaction=require(_0x18aa('0x7'));var config=require('../../config/environment');var controller=require('./intDynamics365Account.controller');router[_0x18aa('0x8')]('/',auth['isAuthenticated'](),controller[_0x18aa('0x9')]);router['get'](_0x18aa('0xa'),auth[_0x18aa('0xb')](),controller['show']);router[_0x18aa('0x8')]('/:id/configurations',auth[_0x18aa('0xb')](),controller[_0x18aa('0xc')]);router[_0x18aa('0x8')](_0x18aa('0xd'),auth['isAuthenticated'](),controller[_0x18aa('0xe')]);router[_0x18aa('0xf')]('/',auth[_0x18aa('0xb')](),controller[_0x18aa('0x10')]);router[_0x18aa('0xf')](_0x18aa('0x11'),auth[_0x18aa('0xb')](),controller[_0x18aa('0x12')]);router['put'](_0x18aa('0xa'),auth[_0x18aa('0xb')](),controller[_0x18aa('0x13')]);router[_0x18aa('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x18aa('0x15')]);module[_0x18aa('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index b0a5a92..7e4ec7f 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 _0x2123=['sequelize','exports','STRING','BOOLEAN'];(function(_0x58c481,_0x38f5fa){var _0x460889=function(_0x125904){while(--_0x125904){_0x58c481['push'](_0x58c481['shift']());}};_0x460889(++_0x38f5fa);}(_0x2123,0x190));var _0x3212=function(_0x5b9267,_0x53577a){_0x5b9267=_0x5b9267-0x0;var _0x35f4ed=_0x2123[_0x5b9267];return _0x35f4ed;};'use strict';var Sequelize=require(_0x3212('0x0'));module[_0x3212('0x1')]={'name':{'type':Sequelize[_0x3212('0x2')]},'username':{'type':Sequelize[_0x3212('0x2')]},'password':{'type':Sequelize[_0x3212('0x2')]},'remoteUri':{'type':Sequelize[_0x3212('0x2')]},'tenantId':{'type':Sequelize[_0x3212('0x2')]},'clientId':{'type':Sequelize[_0x3212('0x2')]},'clientSecret':{'type':Sequelize[_0x3212('0x2')]},'serverUrl':{'type':Sequelize[_0x3212('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3212('0x2')]},'modernAuthentication':{'type':Sequelize[_0x3212('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xaab2=['BOOLEAN','exports','STRING'];(function(_0x1ac2d8,_0xe1aa59){var _0x2744af=function(_0x37a898){while(--_0x37a898){_0x1ac2d8['push'](_0x1ac2d8['shift']());}};_0x2744af(++_0xe1aa59);}(_0xaab2,0xca));var _0x2aab=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xaab2[_0x55f8b4];return _0x2475f9;};'use strict';var Sequelize=require('sequelize');module[_0x2aab('0x0')]={'name':{'type':Sequelize[_0x2aab('0x1')]},'username':{'type':Sequelize[_0x2aab('0x1')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2aab('0x1')]},'tenantId':{'type':Sequelize[_0x2aab('0x1')]},'clientId':{'type':Sequelize[_0x2aab('0x1')]},'clientSecret':{'type':Sequelize[_0x2aab('0x1')]},'serverUrl':{'type':Sequelize[_0x2aab('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x2aab('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 8402fec..e409e36 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 _0x125f=['subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyyominame','customeridname','customeridtype','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','onholdtime','overriddencreatedon','owneridtype','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','responseby','responsiblecontactidyominame','slainvokedidname','slaname','socialprofileidname','statecode','subjectidname','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','username','password','remoteUri','tenantId','clientId','modernAuthentication','CloudProvider','data5','access_token','data7','POST','/oauth2/token','clientSecret','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','isNil','BooleanAttributeMetadata','push','all','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','test','Wrong\x20credentials','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Bearer\x20','OptionSet','Label','Value','DisplayName','UserLocalizedLabel','TrueOption','true','FalseOption',')/Microsoft.Dynamics.CRM.','request-promise','../../components/parsers/qs','../../mysqldb','../../components/integrations/configuration','status','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','Dynamics365Account','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','find','create','body','params','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','Subjects','type','Descriptions','Dynamics365Field','slice','substring','lastIndexOf','format','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode'];(function(_0x12dba2,_0x35e075){var _0x5b2daa=function(_0x2a9bca){while(--_0x2a9bca){_0x12dba2['push'](_0x12dba2['shift']());}};_0x5b2daa(++_0x35e075);}(_0x125f,0x1e4));var _0xf125=function(_0xe43728,_0x388ff9){_0xe43728=_0xe43728-0x0;var _0x59bd89=_0x125f[_0xe43728];return _0x59bd89;};'use strict';var rp=require(_0xf125('0x0'));var util=require('util');var _=require('lodash');var qs=require(_0xf125('0x1'));var logger=require('../../config/logger')('api');var db=require(_0xf125('0x2'))['db'];var integrations=require(_0xf125('0x3'));function respondWithResult(_0x1e2563,_0x3e01bf){_0x3e01bf=_0x3e01bf||0xc8;return function(_0x35fb4f){if(_0x35fb4f){return _0x1e2563[_0xf125('0x4')](_0x3e01bf)['json'](_0x35fb4f);}};}function respondWithFilteredResult(_0x173183,_0x32577c){return function(_0xd44e14){if(_0xd44e14){var _0x4de5f4=typeof _0x32577c[_0xf125('0x5')]===_0xf125('0x6')&&typeof _0x32577c[_0xf125('0x7')]===_0xf125('0x6');var _0x3cf53f=_0xd44e14[_0xf125('0x8')];var _0xa76502=_0x4de5f4?0x0:_0x32577c[_0xf125('0x5')];var _0x3ba39e=_0x4de5f4?_0xd44e14[_0xf125('0x8')]:_0x32577c[_0xf125('0x5')]+_0x32577c['limit'];var _0x2e0f33;if(_0x3ba39e>=_0x3cf53f){_0x3ba39e=_0x3cf53f;_0x2e0f33=0xc8;}else{_0x2e0f33=0xce;}_0x173183[_0xf125('0x4')](_0x2e0f33);return _0x173183[_0xf125('0x9')](_0xf125('0xa'),_0xa76502+'-'+_0x3ba39e+'/'+_0x3cf53f)['json'](_0xd44e14);}return null;};}function saveUpdates(_0x14b2fc){return function(_0x25dd45){if(_0x25dd45){return _0x25dd45[_0xf125('0xb')](_0x14b2fc)[_0xf125('0xc')](function(_0x2c0d0c){return _0x2c0d0c;});}return null;};}function removeEntity(_0x538fd0){return function(_0x5c2c83){if(_0x5c2c83){return _0x5c2c83[_0xf125('0xd')]()['then'](function(){_0x538fd0[_0xf125('0x4')](0xcc)[_0xf125('0xe')]();});}};}function handleEntityNotFound(_0x37abc6){return function(_0x54985f){if(!_0x54985f){_0x37abc6[_0xf125('0xf')](0x194);}return _0x54985f;};}function handleError(_0x1fc755,_0x70cdb5){_0x70cdb5=_0x70cdb5||0x1f4;return function(_0x1d0737){logger[_0xf125('0x10')](_0x1d0737[_0xf125('0x11')]);if(_0x1d0737[_0xf125('0x12')]){delete _0x1d0737[_0xf125('0x12')];}_0x1fc755[_0xf125('0x4')](_0x70cdb5)[_0xf125('0x13')](_0x1d0737);};}exports['index']=function(_0x4f6827,_0x152c03){var _0x12449a={},_0x54de0b={},_0x3f861f={'count':0x0,'rows':[]};var _0x3178ce=_['map'](db[_0xf125('0x14')][_0xf125('0x15')],function(_0x4b118a){return{'name':_0x4b118a[_0xf125('0x16')],'type':_0x4b118a['type'][_0xf125('0x17')]};});_0x54de0b['model']=_[_0xf125('0x18')](_0x3178ce,_0xf125('0x12'));_0x54de0b[_0xf125('0x19')]=_[_0xf125('0x1a')](_0x4f6827[_0xf125('0x19')]);_0x54de0b[_0xf125('0x1b')]=_[_0xf125('0x1c')](_0x54de0b[_0xf125('0x1d')],_0x54de0b['query']);_0x12449a[_0xf125('0x1e')]=_[_0xf125('0x1c')](_0x54de0b[_0xf125('0x1d')],qs[_0xf125('0x1f')](_0x4f6827[_0xf125('0x19')]['fields']));_0x12449a[_0xf125('0x1e')]=_0x12449a[_0xf125('0x1e')][_0xf125('0x20')]?_0x12449a[_0xf125('0x1e')]:_0x54de0b[_0xf125('0x1d')];if(!_0x4f6827[_0xf125('0x19')]['hasOwnProperty'](_0xf125('0x21'))){_0x12449a[_0xf125('0x7')]=qs[_0xf125('0x7')](_0x4f6827['query'][_0xf125('0x7')]);_0x12449a[_0xf125('0x5')]=qs[_0xf125('0x5')](_0x4f6827[_0xf125('0x19')]['offset']);}_0x12449a[_0xf125('0x22')]=qs[_0xf125('0x23')](_0x4f6827[_0xf125('0x19')][_0xf125('0x23')]);_0x12449a[_0xf125('0x24')]=qs[_0xf125('0x1b')](_[_0xf125('0x25')](_0x4f6827['query'],_0x54de0b[_0xf125('0x1b')]),_0x3178ce);if(_0x4f6827[_0xf125('0x19')][_0xf125('0x26')]){_0x12449a['where']=_[_0xf125('0x27')](_0x12449a[_0xf125('0x24')],{'$or':_['map'](_0x3178ce,function(_0x2ef85b){if(_0x2ef85b['type']!==_0xf125('0x28')){var _0x4bdc8b={};_0x4bdc8b[_0x2ef85b[_0xf125('0x12')]]={'$like':'%'+_0x4f6827[_0xf125('0x19')][_0xf125('0x26')]+'%'};return _0x4bdc8b;}})});}_0x12449a=_['merge']({},_0x12449a,_0x4f6827[_0xf125('0x29')]);var _0x22f34e={'where':_0x12449a[_0xf125('0x24')]};return db[_0xf125('0x14')][_0xf125('0x8')](_0x22f34e)[_0xf125('0xc')](function(_0x20afc6){_0x3f861f[_0xf125('0x8')]=_0x20afc6;if(_0x4f6827[_0xf125('0x19')]['includeAll']){_0x12449a[_0xf125('0x2a')]=[{'all':!![]}];}return db[_0xf125('0x14')][_0xf125('0x2b')](_0x12449a);})[_0xf125('0xc')](function(_0x430455){_0x3f861f[_0xf125('0x2c')]=_0x430455;return _0x3f861f;})[_0xf125('0xc')](respondWithFilteredResult(_0x152c03,_0x12449a))[_0xf125('0x2d')](handleError(_0x152c03,null));};exports[_0xf125('0x2e')]=function(_0x261f98,_0x179764){var _0x447541={'raw':![],'where':{'id':_0x261f98['params']['id']}},_0x30c794={};_0x30c794['model']=_[_0xf125('0x1a')](db[_0xf125('0x14')][_0xf125('0x15')]);_0x30c794[_0xf125('0x19')]=_[_0xf125('0x1a')](_0x261f98[_0xf125('0x19')]);_0x30c794['filters']=_[_0xf125('0x1c')](_0x30c794[_0xf125('0x1d')],_0x30c794['query']);_0x447541[_0xf125('0x1e')]=_[_0xf125('0x1c')](_0x30c794[_0xf125('0x1d')],qs[_0xf125('0x1f')](_0x261f98[_0xf125('0x19')][_0xf125('0x1f')]));_0x447541[_0xf125('0x1e')]=_0x447541['attributes'][_0xf125('0x20')]?_0x447541[_0xf125('0x1e')]:_0x30c794[_0xf125('0x1d')];if(_0x261f98[_0xf125('0x19')][_0xf125('0x2f')]){_0x447541[_0xf125('0x2a')]=[{'all':!![]}];}_0x447541=_[_0xf125('0x27')]({},_0x447541,_0x261f98[_0xf125('0x29')]);return db[_0xf125('0x14')][_0xf125('0x30')](_0x447541)[_0xf125('0xc')](handleEntityNotFound(_0x179764,null))[_0xf125('0xc')](respondWithResult(_0x179764,null))[_0xf125('0x2d')](handleError(_0x179764,null));};exports[_0xf125('0x31')]=function(_0x5eaca2,_0x4acbbd){return db['Dynamics365Account']['create'](_0x5eaca2[_0xf125('0x32')],{})['then'](respondWithResult(_0x4acbbd,0xc9))[_0xf125('0x2d')](handleError(_0x4acbbd,null));};exports[_0xf125('0xb')]=function(_0x1c44aa,_0x4290c5){if(_0x1c44aa[_0xf125('0x32')]['id']){delete _0x1c44aa[_0xf125('0x32')]['id'];}return db[_0xf125('0x14')][_0xf125('0x30')]({'where':{'id':_0x1c44aa[_0xf125('0x33')]['id']}})[_0xf125('0xc')](handleEntityNotFound(_0x4290c5,null))[_0xf125('0xc')](saveUpdates(_0x1c44aa['body'],null))[_0xf125('0xc')](respondWithResult(_0x4290c5,null))[_0xf125('0x2d')](handleError(_0x4290c5,null));};exports[_0xf125('0xd')]=function(_0x169b8c,_0x151c61){return db[_0xf125('0x14')][_0xf125('0x30')]({'where':{'id':_0x169b8c['params']['id']}})[_0xf125('0xc')](handleEntityNotFound(_0x151c61,null))[_0xf125('0xc')](removeEntity(_0x151c61,null))['catch'](handleError(_0x151c61,null));};exports[_0xf125('0x34')]=function(_0x462072,_0x72fccd){var _0x10e483={};var _0x544d18={};var _0x3a191c;var _0x366d55;return db[_0xf125('0x14')][_0xf125('0x35')]({'where':{'id':_0x462072[_0xf125('0x33')]['id']}})['then'](handleEntityNotFound(_0x72fccd,null))[_0xf125('0xc')](function(_0x31349d){if(_0x31349d){_0x3a191c=_0x31349d;_0x544d18[_0xf125('0x1d')]=_[_0xf125('0x1a')](db[_0xf125('0x36')][_0xf125('0x15')]);_0x544d18[_0xf125('0x19')]=_[_0xf125('0x1a')](_0x462072['query']);_0x544d18[_0xf125('0x1b')]=_[_0xf125('0x1c')](_0x544d18[_0xf125('0x1d')],_0x544d18['query']);_0x10e483[_0xf125('0x1e')]=_[_0xf125('0x1c')](_0x544d18['model'],qs[_0xf125('0x1f')](_0x462072[_0xf125('0x19')][_0xf125('0x1f')]));_0x10e483[_0xf125('0x1e')]=_0x10e483[_0xf125('0x1e')]['length']?_0x10e483['attributes']:_0x544d18[_0xf125('0x1d')];_0x10e483['order']=qs[_0xf125('0x23')](_0x462072[_0xf125('0x19')][_0xf125('0x23')]);_0x10e483[_0xf125('0x24')]=qs[_0xf125('0x1b')](_[_0xf125('0x25')](_0x462072['query'],_0x544d18[_0xf125('0x1b')]));if(_0x462072[_0xf125('0x19')]['filter']){_0x10e483[_0xf125('0x24')]=_[_0xf125('0x27')](_0x10e483[_0xf125('0x24')],{'$or':_[_0xf125('0x18')](_0x10e483[_0xf125('0x1e')],function(_0x54f2d4){var _0x1a7ac8={};_0x1a7ac8[_0x54f2d4]={'$like':'%'+_0x462072[_0xf125('0x19')]['filter']+'%'};return _0x1a7ac8;})});}_0x10e483=_[_0xf125('0x27')]({},_0x10e483,_0x462072[_0xf125('0x29')]);return _0x3a191c[_0xf125('0x34')](_0x10e483);}})['then'](function(_0x21a2e0){if(_0x21a2e0){_0x366d55=_0x21a2e0[_0xf125('0x20')];if(!_0x462072[_0xf125('0x19')]['hasOwnProperty'](_0xf125('0x21'))){_0x10e483[_0xf125('0x7')]=qs[_0xf125('0x7')](_0x462072['query'][_0xf125('0x7')]);_0x10e483[_0xf125('0x5')]=qs[_0xf125('0x5')](_0x462072['query'][_0xf125('0x5')]);}return _0x3a191c[_0xf125('0x34')](_0x10e483);}})['then'](function(_0x2ad8a3){if(_0x2ad8a3){return _0x2ad8a3?{'count':_0x366d55,'rows':_0x2ad8a3}:null;}})[_0xf125('0xc')](respondWithResult(_0x72fccd,null))[_0xf125('0x2d')](handleError(_0x72fccd,null));};exports[_0xf125('0x37')]=function(_0x2ee956,_0x30a056){if(_0x2ee956['body']['id']){delete _0x2ee956[_0xf125('0x32')]['id'];}return db['Dynamics365Account'][_0xf125('0x35')]({'where':{'id':_0x2ee956[_0xf125('0x33')]['id']}})[_0xf125('0xc')](handleEntityNotFound(_0x30a056,null))['then'](function(_0x2dd533){if(_0x2dd533){_0x2ee956[_0xf125('0x32')]['AccountId']=_0x2dd533['id'];_0x2ee956[_0xf125('0x32')][_0xf125('0x38')]=integrations['getSubjects'](_0x2ee956[_0xf125('0x32')]['channel'],_0x2ee956[_0xf125('0x32')][_0xf125('0x39')]);_0x2ee956[_0xf125('0x32')][_0xf125('0x3a')]=integrations['getDescriptions'](_0x2ee956[_0xf125('0x32')]['channel'],_0x2ee956[_0xf125('0x32')][_0xf125('0x39')]);return db[_0xf125('0x36')][_0xf125('0x31')](_0x2ee956['body'],{'include':[{'model':db[_0xf125('0x3b')],'as':'Subjects'},{'model':db[_0xf125('0x3b')],'as':_0xf125('0x3a')}]});}return null;})[_0xf125('0xc')](respondWithResult(_0x30a056,null))[_0xf125('0x2d')](handleError(_0x30a056,null));};function sanitizeRemoteUri(_0x173cda){var _0x466196=_0x173cda[_0xf125('0x3c')](-0x1);if(_0x466196==='/')return _0x173cda[_0xf125('0x3d')](0x0,_0x173cda[_0xf125('0x3e')](_0x466196));return _0x173cda;}function getWebApiUrl(_0x34d12c){return util[_0xf125('0x3f')]('%s/api/data/v9.0/',_0x34d12c);}exports[_0xf125('0x40')]=function(_0x5b654f,_0x42d103){var _0x48bc3f=_0x5b654f[_0xf125('0x19')][_0xf125('0x41')];var _0x24e04b=_0x48bc3f===_0xf125('0x42')?_0xf125('0x43'):_0xf125('0x44');var _0x5a8efc='';var _0x3200c3='';var _0x1fa7ef='';var _0x40b1af='';var _0x2e8814='';var _0x2055eb='';var _0x1a74db='';var _0xdf0b1a='';var _0x3f80c8=[_0xf125('0x45'),_0xf125('0x46'),_0xf125('0x47'),_0xf125('0x48'),_0xf125('0x49'),_0xf125('0x4a'),_0xf125('0x4b'),_0xf125('0x4c'),_0xf125('0x4d'),_0xf125('0x4e')];var _0x5cf2d6=[_0xf125('0x4f'),_0xf125('0x50'),'actualserviceunits',_0xf125('0x51'),_0xf125('0x52'),_0xf125('0x53'),_0xf125('0x54'),_0xf125('0x55'),'createdbyexternalpartyname',_0xf125('0x56'),_0xf125('0x57'),_0xf125('0x58'),_0xf125('0x59'),'createdonbehalfbyname',_0xf125('0x5a'),_0xf125('0x5b'),_0xf125('0x5c'),'customeridyominame','emailaddress',_0xf125('0x5d'),_0xf125('0x5e'),_0xf125('0x5f'),_0xf125('0x60'),_0xf125('0x61'),_0xf125('0x62'),'followupby',_0xf125('0x63'),_0xf125('0x64'),_0xf125('0x65'),_0xf125('0x66'),_0xf125('0x67'),_0xf125('0x68'),'modifiedbyexternalpartyyominame',_0xf125('0x69'),'modifiedbyyominame',_0xf125('0x6a'),_0xf125('0x6b'),_0xf125('0x6c'),_0xf125('0x6d'),'msdyn_iotalertname','numberofchildincidents',_0xf125('0x6e'),_0xf125('0x6f'),'owneridname',_0xf125('0x70'),'owneridyominame','parentcaseidname',_0xf125('0x71'),_0xf125('0x72'),_0xf125('0x73'),_0xf125('0x74'),_0xf125('0x75'),_0xf125('0x76'),'resolvebykpiidname',_0xf125('0x77'),'responsiblecontactidname',_0xf125('0x78'),'sentimentvalue',_0xf125('0x79'),_0xf125('0x7a'),_0xf125('0x7b'),_0xf125('0x7c'),'statuscode',_0xf125('0x7d'),'ticketnumber','timezoneruleversionnumber',_0xf125('0x7e'),_0xf125('0x7f'),_0xf125('0x80'),_0xf125('0x81')];var _0x11fe7a=_0x3f80c8['concat'](_0x5cf2d6);return db[_0xf125('0x14')][_0xf125('0x35')]({'where':{'id':_0x5b654f[_0xf125('0x33')]['id']},'attributes':['id',_0xf125('0x82'),_0xf125('0x83'),_0xf125('0x84'),_0xf125('0x85'),_0xf125('0x86'),'clientSecret',_0xf125('0x87')],'include':[{'model':db[_0xf125('0x88')],'as':_0xf125('0x88'),'attributes':['id',_0xf125('0x89'),'data7']}]})[_0xf125('0xc')](handleEntityNotFound(_0x42d103,null))[_0xf125('0xc')](function(_0x4a02bd){if(_0x4a02bd){if(_0x4a02bd[_0xf125('0x87')]){_0x4a02bd[_0xf125('0x8a')]=_0x4a02bd[_0xf125('0x88')][_0xf125('0x89')];_0xdf0b1a=sanitizeRemoteUri(_0x4a02bd[_0xf125('0x88')][_0xf125('0x8b')]);_0x1a74db=getWebApiUrl(_0xdf0b1a);return _0x4a02bd;}_0xdf0b1a=sanitizeRemoteUri(_0x4a02bd[_0xf125('0x84')]);_0x1a74db=getWebApiUrl(_0xdf0b1a);var _0x1a701d={'method':_0xf125('0x8c'),'uri':'https://login.microsoftonline.com/'+_0x4a02bd[_0xf125('0x85')]+_0xf125('0x8d'),'form':{'client_id':_0x4a02bd[_0xf125('0x86')],'resource':_0xdf0b1a,'username':_0x4a02bd[_0xf125('0x82')],'password':_0x4a02bd[_0xf125('0x83')],'grant_type':'password','client_secret':_0x4a02bd[_0xf125('0x8e')]},'json':!![]};return rp(_0x1a701d);}})[_0xf125('0xc')](function(_0x34d954){_0x2055eb=_0x34d954[_0xf125('0x8a')];var _0x117784={'method':_0xf125('0x8f'),'uri':encodeURI(_0x1a74db+_0xf125('0x90')+_0x24e04b+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x2055eb,'If-None-Match':null,'OData-Version':_0xf125('0x91')},'json':!![]};return rp(_0x117784);})[_0xf125('0xc')](function(_0x2de858){var _0x4486dc=_0x2de858[_0xf125('0x92')][0x0];var _0x961ec5=_0x4486dc[_0xf125('0x93')];var _0x290022={'method':_0xf125('0x8f'),'uri':_0x1a74db+_0xf125('0x94')+_0x961ec5+_0xf125('0x95'),'headers':{'Authorization':'Bearer\x20'+_0x2055eb,'If-None-Match':null,'OData-Version':_0xf125('0x91')},'json':!![]};return rp(_0x290022);})['then'](function(_0x3c1172){_0x5a8efc=_0x3c1172;_0x3200c3=_0x5a8efc[_0xf125('0x96')];_0x3200c3=_[_0xf125('0x97')](_0x3200c3,function(_0x54dd06){return!_0x11fe7a[_0xf125('0x98')](_0x54dd06[_0xf125('0x99')]);});var _0x3194fc=[];var _0x265cad=[];_0x3200c3[_0xf125('0x9a')](function(_0x2b695e){if(_0x2b695e['@odata.type']){var _0x43cc59=_0x2b695e[_0xf125('0x9b')]['substring'](_0x2b695e['@odata.type']['lastIndexOf']('.')+0x1);if(_0x43cc59===_0xf125('0x9c')){_0x3194fc['push'](getSelectList(_0x1a74db,_0x48bc3f,_0x265cad,_0x5a8efc[_0xf125('0x93')],_0x2b695e[_0xf125('0x93')],_0x2055eb));}}});return Promise['all'](_0x3194fc);})[_0xf125('0xc')](function(_0x2dc156){_0x1fa7ef=_0x2dc156[0x0];var _0x3cf4b7=[];var _0x2f3a9f=[];_0x3200c3[_0xf125('0x9a')](function(_0x50b80e){if(!_[_0xf125('0x9d')](_0x50b80e['@odata.type'])){var _0x400294=_0x50b80e[_0xf125('0x9b')][_0xf125('0x3d')](_0x50b80e[_0xf125('0x9b')]['lastIndexOf']('.')+0x1);if(_0x400294===_0xf125('0x9e')){_0x3cf4b7[_0xf125('0x9f')](getBooleanList(_0x1a74db,_0x48bc3f,_0x2f3a9f,_0x5a8efc[_0xf125('0x93')],_0x50b80e[_0xf125('0x93')],_0x2055eb));}}});return Promise[_0xf125('0xa0')](_0x3cf4b7);})['then'](function(_0x2ce5aa){_0x40b1af=_0x2ce5aa[0x0];var _0x4103be=[];var _0x2729dc=[];_0x3200c3['forEach'](function(_0x3807cb){if(_0x3807cb[_0xf125('0x9b')]){var _0x2e4b5b=_0x3807cb[_0xf125('0x9b')][_0xf125('0x3d')](_0x3807cb['@odata.type'][_0xf125('0x3e')]('.')+0x1);if(_0x2e4b5b===_0xf125('0xa1')||_0x2e4b5b===_0xf125('0xa2')||_0x2e4b5b===_0xf125('0xa3')||_0x2e4b5b===_0xf125('0xa4')||_0x2e4b5b==='MemoAttributeMetadata'||_0x2e4b5b==='DateTimeAttributeMetadata'||_0x2e4b5b===_0xf125('0xa5')||_0x2e4b5b===_0xf125('0xa6')||_0x2e4b5b===_0xf125('0xa7')||_0x2e4b5b===_0xf125('0xa8')){_0x4103be[_0xf125('0x9f')](getInputList(_0x1a74db,_0x48bc3f,_0x2e4b5b,_0x2729dc,_0x5a8efc[_0xf125('0x93')],_0x3807cb[_0xf125('0x93')],_0x2055eb));}}});return Promise['all'](_0x4103be);})[_0xf125('0xc')](function(_0x1522c1){_0x2e8814=_0x1522c1[0x0];var _0x572f85=_0x1fa7ef[_0xf125('0xa9')](_0x40b1af)['concat'](_0x2e8814);var _0x566751={'count':_0x572f85['length'],'rows':_0x572f85};return _0x566751;})[_0xf125('0xc')](respondWithResult(_0x42d103,null))[_0xf125('0x2d')](function(_0x1c1630){var _0x201ee3=_0x5b654f['query'][_0xf125('0xaa')]?0x1f4:_0x1c1630['statusCode']||0x1f4;logger[_0xf125('0x10')](_0x1c1630['stack']);delete _0x1c1630[_0xf125('0x12')];if(_0x201ee3===0x191){_0x201ee3=0x190;}_0x42d103[_0xf125('0x4')](_0x201ee3)[_0xf125('0x13')](_0x5b654f[_0xf125('0x19')][_0xf125('0xaa')]?{'message':_0xf125('0xab'),'statusCode':_0x1c1630[_0xf125('0xac')]}:_0x1c1630);});};function getSelectList(_0x3506f5,_0x35ceed,_0x1bccf0,_0x292828,_0x170af5,_0x21abee){var _0x1b1fb2={'method':_0xf125('0x8f'),'uri':_0x3506f5+_0xf125('0x94')+_0x292828+_0xf125('0xad')+_0x170af5+_0xf125('0xae')+_0xf125('0xaf'),'headers':{'Authorization':_0xf125('0xb0')+_0x21abee,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1b1fb2)[_0xf125('0xc')](function(_0x1ef563){var _0x5a5e2e=[];var _0x5402c2=_0x1ef563[_0xf125('0xb1')]['Options'];_0x5402c2[_0xf125('0x9a')](function(_0x256847){_0x5a5e2e[_0xf125('0x9f')]({'name':_0x256847[_0xf125('0xb2')]['UserLocalizedLabel'][_0xf125('0xb2')],'value':String(_0x256847[_0xf125('0xb3')])});});var _0x14ab61={'id':_0x35ceed+'_'+_0x1ef563[_0xf125('0x99')],'name':_0x1ef563[_0xf125('0xb4')][_0xf125('0xb5')]['Label'],'custom':![],'options':_0x5a5e2e};_0x1bccf0[_0xf125('0x9f')](_0x14ab61);return _0x1bccf0;});}function getBooleanList(_0x15ec54,_0xbc66f1,_0x202dee,_0x1b610a,_0x1e3ba3,_0x5d07ec){var _0x152284={'method':_0xf125('0x8f'),'uri':_0x15ec54+_0xf125('0x94')+_0x1b610a+')/Attributes('+_0x1e3ba3+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xf125('0xb0')+_0x5d07ec,'If-None-Match':null,'OData-Version':_0xf125('0x91')},'json':!![]};return rp(_0x152284)[_0xf125('0xc')](function(_0x50b37f){var _0x3b4ee8=[];_0x3b4ee8[_0xf125('0x9f')]({'name':_0x50b37f[_0xf125('0xb1')][_0xf125('0xb6')][_0xf125('0xb2')][_0xf125('0xb5')]['Label'],'value':_0xf125('0xb7')},{'name':_0x50b37f[_0xf125('0xb1')][_0xf125('0xb8')][_0xf125('0xb2')][_0xf125('0xb5')][_0xf125('0xb2')],'value':'false'});var _0x43a280={'id':_0xbc66f1+'_'+_0x50b37f[_0xf125('0x99')],'name':_0x50b37f[_0xf125('0xb4')][_0xf125('0xb5')]['Label'],'custom':![],'options':_0x3b4ee8};_0x202dee['push'](_0x43a280);return _0x202dee;});}function getInputList(_0x396cc6,_0x3b379a,_0x51dc53,_0x5066c1,_0x3dab68,_0x5b7ea6,_0x2f6f28){var _0x49e63a={'method':_0xf125('0x8f'),'uri':_0x396cc6+_0xf125('0x94')+_0x3dab68+_0xf125('0xad')+_0x5b7ea6+_0xf125('0xb9')+_0x51dc53+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0xf125('0xb0')+_0x2f6f28,'If-None-Match':null,'OData-Version':_0xf125('0x91')},'json':!![]};return rp(_0x49e63a)[_0xf125('0xc')](function(_0x1b75ce){var _0x1ff330={'id':_0x3b379a+'_'+_0x1b75ce[_0xf125('0x99')],'name':_0x1b75ce[_0xf125('0xb4')][_0xf125('0xb5')]?_0x1b75ce[_0xf125('0xb4')][_0xf125('0xb5')][_0xf125('0xb2')]:_0x1b75ce['LogicalName'],'custom':![],'options':[]};_0x5066c1[_0xf125('0x9f')](_0x1ff330);return _0x5066c1;});} \ No newline at end of file +var _0xe28e=['statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','CloudProvider','data5','data7','modernAuthentication','POST','https://login.microsoftonline.com/','/oauth2/token','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','includes','forEach','@odata.type','lastIndexOf','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','Wrong\x20credentials','statusCode',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','UserLocalizedLabel','LogicalName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','OptionSet','FalseOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','set','Content-Range','update','destroy','then','end','sendStatus','error','name','send','map','Dynamics365Account','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','catch','show','params','keys','options','find','body','getConfigurations','findOne','Dynamics365Configuration','hasOwnProperty','nolimit','addConfiguration','AccountId','getSubjects','channel','Descriptions','create','Dynamics365Field','Subjects','slice','substring','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidyominame','actualserviceunits','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode'];(function(_0x3d38ae,_0x51102b){var _0x3757ee=function(_0x22bac8){while(--_0x22bac8){_0x3d38ae['push'](_0x3d38ae['shift']());}};_0x3757ee(++_0x51102b);}(_0xe28e,0x1ba));var _0xee28=function(_0x44f321,_0x5dc5a9){_0x44f321=_0x44f321-0x0;var _0x2f8c87=_0xe28e[_0x44f321];return _0x2f8c87;};'use strict';var rp=require(_0xee28('0x0'));var util=require(_0xee28('0x1'));var _=require(_0xee28('0x2'));var qs=require(_0xee28('0x3'));var logger=require(_0xee28('0x4'))(_0xee28('0x5'));var db=require(_0xee28('0x6'))['db'];var integrations=require(_0xee28('0x7'));function respondWithResult(_0xdc22c0,_0x40fdf8){_0x40fdf8=_0x40fdf8||0xc8;return function(_0x1c7cb1){if(_0x1c7cb1){return _0xdc22c0[_0xee28('0x8')](_0x40fdf8)[_0xee28('0x9')](_0x1c7cb1);}};}function respondWithFilteredResult(_0x48e72f,_0x39b337){return function(_0x30224a){if(_0x30224a){var _0x3f9bd9=typeof _0x39b337[_0xee28('0xa')]===_0xee28('0xb')&&typeof _0x39b337[_0xee28('0xc')]===_0xee28('0xb');var _0x5d7562=_0x30224a['count'];var _0x561fe4=_0x3f9bd9?0x0:_0x39b337[_0xee28('0xa')];var _0x7e67b2=_0x3f9bd9?_0x30224a['count']:_0x39b337[_0xee28('0xa')]+_0x39b337[_0xee28('0xc')];var _0x542c21;if(_0x7e67b2>=_0x5d7562){_0x7e67b2=_0x5d7562;_0x542c21=0xc8;}else{_0x542c21=0xce;}_0x48e72f[_0xee28('0x8')](_0x542c21);return _0x48e72f[_0xee28('0xd')](_0xee28('0xe'),_0x561fe4+'-'+_0x7e67b2+'/'+_0x5d7562)[_0xee28('0x9')](_0x30224a);}return null;};}function saveUpdates(_0x267031){return function(_0x46e784){if(_0x46e784){return _0x46e784[_0xee28('0xf')](_0x267031)['then'](function(_0x4201ad){return _0x4201ad;});}return null;};}function removeEntity(_0x1df69a){return function(_0x555b9c){if(_0x555b9c){return _0x555b9c[_0xee28('0x10')]()[_0xee28('0x11')](function(){_0x1df69a['status'](0xcc)[_0xee28('0x12')]();});}};}function handleEntityNotFound(_0x17c99a){return function(_0x3d3a5c){if(!_0x3d3a5c){_0x17c99a[_0xee28('0x13')](0x194);}return _0x3d3a5c;};}function handleError(_0x1ff99e,_0x11c95d){_0x11c95d=_0x11c95d||0x1f4;return function(_0x4c0eb9){logger[_0xee28('0x14')](_0x4c0eb9['stack']);if(_0x4c0eb9[_0xee28('0x15')]){delete _0x4c0eb9[_0xee28('0x15')];}_0x1ff99e['status'](_0x11c95d)[_0xee28('0x16')](_0x4c0eb9);};}exports['index']=function(_0x3c9ac6,_0x575259){var _0x28da88={},_0x577332={},_0xc753e9={'count':0x0,'rows':[]};var _0x590137=_[_0xee28('0x17')](db[_0xee28('0x18')][_0xee28('0x19')],function(_0x3674c7){return{'name':_0x3674c7[_0xee28('0x1a')],'type':_0x3674c7[_0xee28('0x1b')][_0xee28('0x1c')]};});_0x577332['model']=_[_0xee28('0x17')](_0x590137,_0xee28('0x15'));_0x577332[_0xee28('0x1d')]=_['keys'](_0x3c9ac6['query']);_0x577332[_0xee28('0x1e')]=_[_0xee28('0x1f')](_0x577332[_0xee28('0x20')],_0x577332[_0xee28('0x1d')]);_0x28da88[_0xee28('0x21')]=_[_0xee28('0x1f')](_0x577332[_0xee28('0x20')],qs[_0xee28('0x22')](_0x3c9ac6[_0xee28('0x1d')][_0xee28('0x22')]));_0x28da88[_0xee28('0x21')]=_0x28da88['attributes'][_0xee28('0x23')]?_0x28da88['attributes']:_0x577332['model'];if(!_0x3c9ac6['query']['hasOwnProperty']('nolimit')){_0x28da88[_0xee28('0xc')]=qs[_0xee28('0xc')](_0x3c9ac6[_0xee28('0x1d')][_0xee28('0xc')]);_0x28da88[_0xee28('0xa')]=qs[_0xee28('0xa')](_0x3c9ac6[_0xee28('0x1d')]['offset']);}_0x28da88[_0xee28('0x24')]=qs[_0xee28('0x25')](_0x3c9ac6[_0xee28('0x1d')]['sort']);_0x28da88[_0xee28('0x26')]=qs[_0xee28('0x1e')](_[_0xee28('0x27')](_0x3c9ac6[_0xee28('0x1d')],_0x577332[_0xee28('0x1e')]),_0x590137);if(_0x3c9ac6[_0xee28('0x1d')][_0xee28('0x28')]){_0x28da88['where']=_[_0xee28('0x29')](_0x28da88[_0xee28('0x26')],{'$or':_['map'](_0x590137,function(_0x6605d8){if(_0x6605d8[_0xee28('0x1b')]!==_0xee28('0x2a')){var _0x3d3a8f={};_0x3d3a8f[_0x6605d8[_0xee28('0x15')]]={'$like':'%'+_0x3c9ac6[_0xee28('0x1d')][_0xee28('0x28')]+'%'};return _0x3d3a8f;}})});}_0x28da88=_['merge']({},_0x28da88,_0x3c9ac6['options']);var _0x48daf4={'where':_0x28da88[_0xee28('0x26')]};return db[_0xee28('0x18')][_0xee28('0x2b')](_0x48daf4)[_0xee28('0x11')](function(_0x455385){_0xc753e9[_0xee28('0x2b')]=_0x455385;if(_0x3c9ac6['query'][_0xee28('0x2c')]){_0x28da88[_0xee28('0x2d')]=[{'all':!![]}];}return db['Dynamics365Account']['findAll'](_0x28da88);})[_0xee28('0x11')](function(_0x38bcb0){_0xc753e9['rows']=_0x38bcb0;return _0xc753e9;})['then'](respondWithFilteredResult(_0x575259,_0x28da88))[_0xee28('0x2e')](handleError(_0x575259,null));};exports[_0xee28('0x2f')]=function(_0x57aa38,_0x26bff6){var _0x1eddc8={'raw':![],'where':{'id':_0x57aa38[_0xee28('0x30')]['id']}},_0x2f8e04={};_0x2f8e04[_0xee28('0x20')]=_[_0xee28('0x31')](db[_0xee28('0x18')][_0xee28('0x19')]);_0x2f8e04[_0xee28('0x1d')]=_[_0xee28('0x31')](_0x57aa38[_0xee28('0x1d')]);_0x2f8e04[_0xee28('0x1e')]=_['intersection'](_0x2f8e04[_0xee28('0x20')],_0x2f8e04['query']);_0x1eddc8['attributes']=_[_0xee28('0x1f')](_0x2f8e04['model'],qs[_0xee28('0x22')](_0x57aa38['query'][_0xee28('0x22')]));_0x1eddc8['attributes']=_0x1eddc8[_0xee28('0x21')][_0xee28('0x23')]?_0x1eddc8[_0xee28('0x21')]:_0x2f8e04[_0xee28('0x20')];if(_0x57aa38['query'][_0xee28('0x2c')]){_0x1eddc8['include']=[{'all':!![]}];}_0x1eddc8=_[_0xee28('0x29')]({},_0x1eddc8,_0x57aa38[_0xee28('0x32')]);return db[_0xee28('0x18')][_0xee28('0x33')](_0x1eddc8)[_0xee28('0x11')](handleEntityNotFound(_0x26bff6,null))[_0xee28('0x11')](respondWithResult(_0x26bff6,null))[_0xee28('0x2e')](handleError(_0x26bff6,null));};exports['create']=function(_0x4d9d21,_0x383c70){return db['Dynamics365Account']['create'](_0x4d9d21[_0xee28('0x34')],{})[_0xee28('0x11')](respondWithResult(_0x383c70,0xc9))['catch'](handleError(_0x383c70,null));};exports[_0xee28('0xf')]=function(_0x1fe811,_0x3d375b){if(_0x1fe811[_0xee28('0x34')]['id']){delete _0x1fe811[_0xee28('0x34')]['id'];}return db[_0xee28('0x18')][_0xee28('0x33')]({'where':{'id':_0x1fe811['params']['id']}})[_0xee28('0x11')](handleEntityNotFound(_0x3d375b,null))[_0xee28('0x11')](saveUpdates(_0x1fe811[_0xee28('0x34')],null))[_0xee28('0x11')](respondWithResult(_0x3d375b,null))[_0xee28('0x2e')](handleError(_0x3d375b,null));};exports['destroy']=function(_0x3dda4e,_0x45f644){return db['Dynamics365Account'][_0xee28('0x33')]({'where':{'id':_0x3dda4e[_0xee28('0x30')]['id']}})[_0xee28('0x11')](handleEntityNotFound(_0x45f644,null))[_0xee28('0x11')](removeEntity(_0x45f644,null))[_0xee28('0x2e')](handleError(_0x45f644,null));};exports[_0xee28('0x35')]=function(_0x54ab7b,_0x36e5bb){var _0x48e801={};var _0x4a50e6={};var _0x272216;var _0x2f240f;return db['Dynamics365Account'][_0xee28('0x36')]({'where':{'id':_0x54ab7b[_0xee28('0x30')]['id']}})[_0xee28('0x11')](handleEntityNotFound(_0x36e5bb,null))['then'](function(_0x57e57e){if(_0x57e57e){_0x272216=_0x57e57e;_0x4a50e6[_0xee28('0x20')]=_[_0xee28('0x31')](db[_0xee28('0x37')][_0xee28('0x19')]);_0x4a50e6[_0xee28('0x1d')]=_[_0xee28('0x31')](_0x54ab7b[_0xee28('0x1d')]);_0x4a50e6[_0xee28('0x1e')]=_[_0xee28('0x1f')](_0x4a50e6[_0xee28('0x20')],_0x4a50e6['query']);_0x48e801[_0xee28('0x21')]=_['intersection'](_0x4a50e6[_0xee28('0x20')],qs[_0xee28('0x22')](_0x54ab7b[_0xee28('0x1d')][_0xee28('0x22')]));_0x48e801[_0xee28('0x21')]=_0x48e801['attributes']['length']?_0x48e801['attributes']:_0x4a50e6[_0xee28('0x20')];_0x48e801['order']=qs['sort'](_0x54ab7b[_0xee28('0x1d')]['sort']);_0x48e801[_0xee28('0x26')]=qs[_0xee28('0x1e')](_[_0xee28('0x27')](_0x54ab7b[_0xee28('0x1d')],_0x4a50e6[_0xee28('0x1e')]));if(_0x54ab7b[_0xee28('0x1d')][_0xee28('0x28')]){_0x48e801[_0xee28('0x26')]=_[_0xee28('0x29')](_0x48e801[_0xee28('0x26')],{'$or':_['map'](_0x48e801[_0xee28('0x21')],function(_0x298e0f){var _0xfd185d={};_0xfd185d[_0x298e0f]={'$like':'%'+_0x54ab7b['query']['filter']+'%'};return _0xfd185d;})});}_0x48e801=_['merge']({},_0x48e801,_0x54ab7b['options']);return _0x272216[_0xee28('0x35')](_0x48e801);}})[_0xee28('0x11')](function(_0x186306){if(_0x186306){_0x2f240f=_0x186306['length'];if(!_0x54ab7b[_0xee28('0x1d')][_0xee28('0x38')](_0xee28('0x39'))){_0x48e801[_0xee28('0xc')]=qs[_0xee28('0xc')](_0x54ab7b['query'][_0xee28('0xc')]);_0x48e801[_0xee28('0xa')]=qs[_0xee28('0xa')](_0x54ab7b['query'][_0xee28('0xa')]);}return _0x272216[_0xee28('0x35')](_0x48e801);}})[_0xee28('0x11')](function(_0x47794a){if(_0x47794a){return _0x47794a?{'count':_0x2f240f,'rows':_0x47794a}:null;}})[_0xee28('0x11')](respondWithResult(_0x36e5bb,null))[_0xee28('0x2e')](handleError(_0x36e5bb,null));};exports[_0xee28('0x3a')]=function(_0x48c55f,_0x161394){if(_0x48c55f['body']['id']){delete _0x48c55f['body']['id'];}return db['Dynamics365Account'][_0xee28('0x36')]({'where':{'id':_0x48c55f[_0xee28('0x30')]['id']}})[_0xee28('0x11')](handleEntityNotFound(_0x161394,null))[_0xee28('0x11')](function(_0x3fa67c){if(_0x3fa67c){_0x48c55f[_0xee28('0x34')][_0xee28('0x3b')]=_0x3fa67c['id'];_0x48c55f[_0xee28('0x34')]['Subjects']=integrations[_0xee28('0x3c')](_0x48c55f[_0xee28('0x34')][_0xee28('0x3d')],_0x48c55f[_0xee28('0x34')][_0xee28('0x1b')]);_0x48c55f[_0xee28('0x34')][_0xee28('0x3e')]=integrations['getDescriptions'](_0x48c55f[_0xee28('0x34')]['channel'],_0x48c55f[_0xee28('0x34')][_0xee28('0x1b')]);return db['Dynamics365Configuration'][_0xee28('0x3f')](_0x48c55f[_0xee28('0x34')],{'include':[{'model':db[_0xee28('0x40')],'as':_0xee28('0x41')},{'model':db['Dynamics365Field'],'as':_0xee28('0x3e')}]});}return null;})[_0xee28('0x11')](respondWithResult(_0x161394,null))[_0xee28('0x2e')](handleError(_0x161394,null));};function sanitizeRemoteUri(_0x2247cd){var _0xd20b0e=_0x2247cd[_0xee28('0x42')](-0x1);if(_0xd20b0e==='/')return _0x2247cd[_0xee28('0x43')](0x0,_0x2247cd['lastIndexOf'](_0xd20b0e));return _0x2247cd;}function getWebApiUrl(_0x39341d){return util['format'](_0xee28('0x44'),_0x39341d);}exports[_0xee28('0x45')]=function(_0x48ad2b,_0x4b222a){var _0x14bc7a=_0x48ad2b['query'][_0xee28('0x46')];var _0x1b1b0e=_0x14bc7a===_0xee28('0x47')?_0xee28('0x48'):_0xee28('0x49');var _0x3f35bd='';var _0x1d7357='';var _0x4c4e32='';var _0x179ce6='';var _0x597918='';var _0x185c8f='';var _0x57ded5='';var _0x44d67d='';var _0x40b1a6=[_0xee28('0x4a'),_0xee28('0x4b'),_0xee28('0x4c'),_0xee28('0x4d'),'caseorigincode',_0xee28('0x4e'),_0xee28('0x4f'),_0xee28('0x50'),_0xee28('0x51'),_0xee28('0x52')];var _0x2d5252=['accountidname',_0xee28('0x53'),_0xee28('0x54'),'billedserviceunits','contactidname','contactidyominame',_0xee28('0x55'),_0xee28('0x56'),'createdbyexternalpartyname',_0xee28('0x57'),_0xee28('0x58'),_0xee28('0x59'),'createdon',_0xee28('0x5a'),_0xee28('0x5b'),_0xee28('0x5c'),_0xee28('0x5d'),'customeridyominame',_0xee28('0x5e'),'entitlementidname',_0xee28('0x5f'),_0xee28('0x60'),_0xee28('0x61'),'exchangerate',_0xee28('0x62'),_0xee28('0x63'),_0xee28('0x64'),_0xee28('0x65'),'kbarticleidname',_0xee28('0x66'),'masteridname',_0xee28('0x67'),_0xee28('0x68'),_0xee28('0x69'),_0xee28('0x6a'),'modifiedon',_0xee28('0x6b'),_0xee28('0x6c'),_0xee28('0x6d'),'msdyn_iotalertname',_0xee28('0x6e'),'onholdtime',_0xee28('0x6f'),_0xee28('0x70'),_0xee28('0x71'),_0xee28('0x72'),_0xee28('0x73'),_0xee28('0x74'),'primarycontactidyominame','prioritycodename',_0xee28('0x75'),_0xee28('0x76'),_0xee28('0x77'),_0xee28('0x78'),_0xee28('0x79'),_0xee28('0x7a'),'responsiblecontactidyominame',_0xee28('0x7b'),_0xee28('0x7c'),_0xee28('0x7d'),_0xee28('0x7e'),_0xee28('0x7f'),_0xee28('0x80'),_0xee28('0x81'),_0xee28('0x82'),_0xee28('0x83'),_0xee28('0x84'),_0xee28('0x85'),_0xee28('0x86'),_0xee28('0x87')];var _0x441ac1=_0x40b1a6[_0xee28('0x88')](_0x2d5252);return db[_0xee28('0x18')][_0xee28('0x36')]({'where':{'id':_0x48ad2b['params']['id']},'attributes':['id',_0xee28('0x89'),_0xee28('0x8a'),_0xee28('0x8b'),_0xee28('0x8c'),_0xee28('0x8d'),_0xee28('0x8e'),'modernAuthentication'],'include':[{'model':db[_0xee28('0x8f')],'as':'CloudProvider','attributes':['id',_0xee28('0x90'),_0xee28('0x91')]}]})[_0xee28('0x11')](handleEntityNotFound(_0x4b222a,null))[_0xee28('0x11')](function(_0x549a33){if(_0x549a33){if(_0x549a33[_0xee28('0x92')]){_0x549a33['access_token']=_0x549a33[_0xee28('0x8f')][_0xee28('0x90')];_0x44d67d=sanitizeRemoteUri(_0x549a33[_0xee28('0x8f')][_0xee28('0x91')]);_0x57ded5=getWebApiUrl(_0x44d67d);return _0x549a33;}_0x44d67d=sanitizeRemoteUri(_0x549a33[_0xee28('0x8b')]);_0x57ded5=getWebApiUrl(_0x44d67d);var _0x10cda9={'method':_0xee28('0x93'),'uri':_0xee28('0x94')+_0x549a33['tenantId']+_0xee28('0x95'),'form':{'client_id':_0x549a33[_0xee28('0x8d')],'resource':_0x44d67d,'username':_0x549a33[_0xee28('0x89')],'password':_0x549a33[_0xee28('0x8a')],'grant_type':_0xee28('0x8a'),'client_secret':_0x549a33['clientSecret']},'json':!![]};return rp(_0x10cda9);}})[_0xee28('0x11')](function(_0x5bb1d4){_0x185c8f=_0x5bb1d4[_0xee28('0x96')];var _0x1003a1={'method':_0xee28('0x97'),'uri':encodeURI(_0x57ded5+_0xee28('0x98')+_0x1b1b0e+'\x27'),'headers':{'Authorization':_0xee28('0x99')+_0x185c8f,'If-None-Match':null,'OData-Version':_0xee28('0x9a')},'json':!![]};return rp(_0x1003a1);})[_0xee28('0x11')](function(_0x51721c){var _0x10b1e4=_0x51721c['value'][0x0];var _0xcc9fbf=_0x10b1e4[_0xee28('0x9b')];var _0x23ada5={'method':_0xee28('0x97'),'uri':_0x57ded5+_0xee28('0x9c')+_0xcc9fbf+_0xee28('0x9d'),'headers':{'Authorization':_0xee28('0x99')+_0x185c8f,'If-None-Match':null,'OData-Version':_0xee28('0x9a')},'json':!![]};return rp(_0x23ada5);})[_0xee28('0x11')](function(_0x335354){_0x3f35bd=_0x335354;_0x1d7357=_0x3f35bd[_0xee28('0x9e')];_0x1d7357=_['remove'](_0x1d7357,function(_0x582ee5){return!_0x441ac1[_0xee28('0x9f')](_0x582ee5['LogicalName']);});var _0x3b9af4=[];var _0x5e90f6=[];_0x1d7357[_0xee28('0xa0')](function(_0xc49ee7){if(_0xc49ee7[_0xee28('0xa1')]){var _0x4d3fd=_0xc49ee7['@odata.type'][_0xee28('0x43')](_0xc49ee7['@odata.type'][_0xee28('0xa2')]('.')+0x1);if(_0x4d3fd===_0xee28('0xa3')){_0x3b9af4[_0xee28('0xa4')](getSelectList(_0x57ded5,_0x14bc7a,_0x5e90f6,_0x3f35bd['MetadataId'],_0xc49ee7[_0xee28('0x9b')],_0x185c8f));}}});return Promise[_0xee28('0xa5')](_0x3b9af4);})[_0xee28('0x11')](function(_0x4b9b32){_0x4c4e32=_0x4b9b32[0x0];var _0x3779b4=[];var _0x15c5b0=[];_0x1d7357['forEach'](function(_0x14dffc){if(!_[_0xee28('0xa6')](_0x14dffc[_0xee28('0xa1')])){var _0x3f6691=_0x14dffc[_0xee28('0xa1')][_0xee28('0x43')](_0x14dffc['@odata.type'][_0xee28('0xa2')]('.')+0x1);if(_0x3f6691===_0xee28('0xa7')){_0x3779b4[_0xee28('0xa4')](getBooleanList(_0x57ded5,_0x14bc7a,_0x15c5b0,_0x3f35bd[_0xee28('0x9b')],_0x14dffc[_0xee28('0x9b')],_0x185c8f));}}});return Promise[_0xee28('0xa5')](_0x3779b4);})[_0xee28('0x11')](function(_0x1e4bf9){_0x179ce6=_0x1e4bf9[0x0];var _0x49fba5=[];var _0x5bf36d=[];_0x1d7357[_0xee28('0xa0')](function(_0x36fd3e){if(_0x36fd3e[_0xee28('0xa1')]){var _0x1abf0b=_0x36fd3e[_0xee28('0xa1')]['substring'](_0x36fd3e[_0xee28('0xa1')]['lastIndexOf']('.')+0x1);if(_0x1abf0b===_0xee28('0xa8')||_0x1abf0b===_0xee28('0xa9')||_0x1abf0b===_0xee28('0xaa')||_0x1abf0b==='IntegerAttributeMetadata'||_0x1abf0b==='MemoAttributeMetadata'||_0x1abf0b===_0xee28('0xab')||_0x1abf0b===_0xee28('0xac')||_0x1abf0b===_0xee28('0xad')||_0x1abf0b==='StateAttributeMetadata'||_0x1abf0b==='DecimalAttributeMetadata'){_0x49fba5['push'](getInputList(_0x57ded5,_0x14bc7a,_0x1abf0b,_0x5bf36d,_0x3f35bd[_0xee28('0x9b')],_0x36fd3e[_0xee28('0x9b')],_0x185c8f));}}});return Promise['all'](_0x49fba5);})[_0xee28('0x11')](function(_0x28e64e){_0x597918=_0x28e64e[0x0];var _0x380abd=_0x4c4e32['concat'](_0x179ce6)[_0xee28('0x88')](_0x597918);var _0x4d928d={'count':_0x380abd['length'],'rows':_0x380abd};return _0x4d928d;})[_0xee28('0x11')](respondWithResult(_0x4b222a,null))[_0xee28('0x2e')](function(_0x37dd1a){var _0x32f772=_0x48ad2b[_0xee28('0x1d')]['test']?0x1f4:_0x37dd1a['statusCode']||0x1f4;logger[_0xee28('0x14')](_0x37dd1a['stack']);delete _0x37dd1a[_0xee28('0x15')];if(_0x32f772===0x191){_0x32f772=0x190;}_0x4b222a[_0xee28('0x8')](_0x32f772)[_0xee28('0x16')](_0x48ad2b[_0xee28('0x1d')]['test']?{'message':_0xee28('0xae'),'statusCode':_0x37dd1a[_0xee28('0xaf')]}:_0x37dd1a);});};function getSelectList(_0x5d9000,_0x3b89d5,_0x9fc7b1,_0x4d803f,_0x3fa6a8,_0x17ad27){var _0xd0cc1e={'method':_0xee28('0x97'),'uri':_0x5d9000+_0xee28('0x9c')+_0x4d803f+_0xee28('0xb0')+_0x3fa6a8+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0xee28('0xb1'),'headers':{'Authorization':'Bearer\x20'+_0x17ad27,'If-None-Match':null,'OData-Version':_0xee28('0x9a')},'json':!![]};return rp(_0xd0cc1e)[_0xee28('0x11')](function(_0x337f07){var _0xdd0416=[];var _0x587de4=_0x337f07['OptionSet'][_0xee28('0xb2')];_0x587de4[_0xee28('0xa0')](function(_0x2e2760){_0xdd0416['push']({'name':_0x2e2760[_0xee28('0xb3')][_0xee28('0xb4')][_0xee28('0xb3')],'value':String(_0x2e2760['Value'])});});var _0x5668b0={'id':_0x3b89d5+'_'+_0x337f07[_0xee28('0xb5')],'name':_0x337f07['DisplayName']['UserLocalizedLabel']['Label'],'custom':![],'options':_0xdd0416};_0x9fc7b1[_0xee28('0xa4')](_0x5668b0);return _0x9fc7b1;});}function getBooleanList(_0x4dda27,_0xcb11fa,_0x19b6a8,_0x5e8589,_0x32237e,_0x23acd2){var _0x3199b3={'method':_0xee28('0x97'),'uri':_0x4dda27+'EntityDefinitions('+_0x5e8589+_0xee28('0xb0')+_0x32237e+_0xee28('0xb6'),'headers':{'Authorization':'Bearer\x20'+_0x23acd2,'If-None-Match':null,'OData-Version':_0xee28('0x9a')},'json':!![]};return rp(_0x3199b3)[_0xee28('0x11')](function(_0x512448){var _0x1dd507=[];_0x1dd507[_0xee28('0xa4')]({'name':_0x512448['OptionSet'][_0xee28('0xb7')]['Label'][_0xee28('0xb4')]['Label'],'value':_0xee28('0xb8')},{'name':_0x512448[_0xee28('0xb9')][_0xee28('0xba')][_0xee28('0xb3')][_0xee28('0xb4')]['Label'],'value':_0xee28('0xbb')});var _0x4b73db={'id':_0xcb11fa+'_'+_0x512448[_0xee28('0xb5')],'name':_0x512448[_0xee28('0xbc')][_0xee28('0xb4')][_0xee28('0xb3')],'custom':![],'options':_0x1dd507};_0x19b6a8[_0xee28('0xa4')](_0x4b73db);return _0x19b6a8;});}function getInputList(_0x5f2f15,_0x1820fc,_0x4b9b12,_0x1afe38,_0x1a7f09,_0x37e177,_0x513422){var _0x350490={'method':_0xee28('0x97'),'uri':_0x5f2f15+_0xee28('0x9c')+_0x1a7f09+_0xee28('0xb0')+_0x37e177+_0xee28('0xbd')+_0x4b9b12+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0xee28('0x99')+_0x513422,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x350490)['then'](function(_0x1719a4){var _0x5b4633={'id':_0x1820fc+'_'+_0x1719a4['LogicalName'],'name':_0x1719a4[_0xee28('0xbc')][_0xee28('0xb4')]?_0x1719a4[_0xee28('0xbc')][_0xee28('0xb4')]['Label']:_0x1719a4[_0xee28('0xb5')],'custom':![],'options':[]};_0x1afe38[_0xee28('0xa4')](_0x5b4633);return _0x1afe38;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index d293d70..7e4c29a 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 _0xcb91=['rimraf','./intDynamics365Account.attributes','../../components/integrations/configuration','Dynamics365Account','int_dynamics365_accounts','../../config/logger','api','moment','bluebird','path'];(function(_0x10ae41,_0x2bf6d2){var _0x86337b=function(_0x162479){while(--_0x162479){_0x10ae41['push'](_0x10ae41['shift']());}};_0x86337b(++_0x2bf6d2);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4b6830,_0x2bf6fb){_0x4b6830=_0x4b6830-0x0;var _0x239e4a=_0xcb91[_0x4b6830];return _0x239e4a;};'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'));var integrations=require(_0x1cb9('0x7'));module['exports']=function(_0x226b69,_0x3f7deb){return _0x226b69['define'](_0x1cb9('0x8'),attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x424357,_0x9ebe3e){var _0x29c68e=function(_0x663b5d){while(--_0x663b5d){_0x424357['push'](_0x424357['shift']());}};_0x29c68e(++_0x9ebe3e);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'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 3558778..6e5d5fc 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 _0x9ad6=['moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','map','include','model','ShowDynamics365Account','find','then','lodash','util'];(function(_0x555e89,_0x13f902){var _0x392854=function(_0x27383b){while(--_0x27383b){_0x555e89['push'](_0x555e89['shift']());}};_0x392854(++_0x13f902);}(_0x9ad6,0x174));var _0x69ad=function(_0x329954,_0x3b9066){_0x329954=_0x329954-0x0;var _0x53daeb=_0x9ad6[_0x329954];return _0x53daeb;};'use strict';var _=require(_0x69ad('0x0'));var util=require(_0x69ad('0x1'));var moment=require(_0x69ad('0x2'));var BPromise=require(_0x69ad('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x69ad('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x69ad('0x5'))(_0x69ad('0x6'));var config=require('../../config/environment');var jayson=require(_0x69ad('0x7'));var client=jayson[_0x69ad('0x8')][_0x69ad('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x463912,_0x3e7398,_0x5398ce){return new BPromise(function(_0xeff4f0,_0x5c8b22){return client[_0x69ad('0xa')](_0x463912,_0x5398ce)['then'](function(_0x26ad6b){logger[_0x69ad('0xb')](_0x69ad('0xc'),_0x3e7398,_0x69ad('0xd'));logger[_0x69ad('0xe')](_0x69ad('0xf'),_0x3e7398,_0x69ad('0xd'),JSON[_0x69ad('0x10')](_0x26ad6b));if(_0x26ad6b['error']){if(_0x26ad6b[_0x69ad('0x11')]['code']===0x1f4){logger[_0x69ad('0x11')](_0x69ad('0xc'),_0x3e7398,_0x26ad6b[_0x69ad('0x11')][_0x69ad('0x12')]);return _0x5c8b22(_0x26ad6b[_0x69ad('0x11')][_0x69ad('0x12')]);}logger['error'](_0x69ad('0xc'),_0x3e7398,_0x26ad6b[_0x69ad('0x11')][_0x69ad('0x12')]);return _0xeff4f0(_0x26ad6b[_0x69ad('0x11')][_0x69ad('0x12')]);}else{logger[_0x69ad('0xb')](_0x69ad('0xc'),_0x3e7398,'request\x20sent');_0xeff4f0(_0x26ad6b[_0x69ad('0x13')][_0x69ad('0x12')]);}})[_0x69ad('0x14')](function(_0x506d6f){logger[_0x69ad('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x3e7398,_0x506d6f);_0x5c8b22(_0x506d6f);});});}exports[_0x69ad('0x15')]=function(_0x31db4c){var _0xf22828=this;return new Promise(function(_0x5dcf11,_0xb6c3bd){return db[_0x69ad('0x16')][_0x69ad('0x17')]({'raw':_0x31db4c['options']?_0x31db4c[_0x69ad('0x18')][_0x69ad('0x19')]===undefined?!![]:![]:!![],'where':_0x31db4c['options']?_0x31db4c['options'][_0x69ad('0x1a')]||null:null,'attributes':_0x31db4c['options']?_0x31db4c['options'][_0x69ad('0x1b')]||null:null,'limit':_0x31db4c[_0x69ad('0x18')]?_0x31db4c[_0x69ad('0x18')]['limit']||null:null,'include':_0x31db4c['options']?_0x31db4c[_0x69ad('0x18')]['include']?_[_0x69ad('0x1c')](_0x31db4c[_0x69ad('0x18')][_0x69ad('0x1d')],function(_0x3a7666){return{'model':db[_0x3a7666[_0x69ad('0x1e')]],'as':_0x3a7666['as'],'attributes':_0x3a7666['attributes'],'include':_0x3a7666['include']?_[_0x69ad('0x1c')](_0x3a7666[_0x69ad('0x1d')],function(_0x5f187e){return{'model':db[_0x5f187e[_0x69ad('0x1e')]],'as':_0x5f187e['as'],'attributes':_0x5f187e[_0x69ad('0x1b')],'include':_0x5f187e[_0x69ad('0x1d')]?_[_0x69ad('0x1c')](_0x5f187e[_0x69ad('0x1d')],function(_0x399230){return{'model':db[_0x399230['model']],'as':_0x399230['as'],'attributes':_0x399230[_0x69ad('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4094fb){logger[_0x69ad('0xb')](_0x69ad('0x15'),_0x31db4c);logger['debug'](_0x69ad('0x15'),_0x31db4c,JSON[_0x69ad('0x10')](_0x4094fb));_0x5dcf11(_0x4094fb);})[_0x69ad('0x14')](function(_0x23caa0){logger[_0x69ad('0x11')](_0x69ad('0x15'),_0x23caa0[_0x69ad('0x12')],_0x31db4c);_0xb6c3bd(_0xf22828['error'](0x1f4,_0x23caa0[_0x69ad('0x12')]));});});};exports[_0x69ad('0x1f')]=function(_0x23b021){var _0x12719e=this;return new Promise(function(_0x97765c,_0x40440f){return db[_0x69ad('0x16')][_0x69ad('0x20')]({'raw':_0x23b021['options']?_0x23b021['options'][_0x69ad('0x19')]===undefined?!![]:![]:!![],'where':_0x23b021[_0x69ad('0x18')]?_0x23b021['options'][_0x69ad('0x1a')]||null:null,'attributes':_0x23b021[_0x69ad('0x18')]?_0x23b021[_0x69ad('0x18')][_0x69ad('0x1b')]||null:null,'include':_0x23b021['options']?_0x23b021[_0x69ad('0x18')]['include']?_[_0x69ad('0x1c')](_0x23b021['options'][_0x69ad('0x1d')],function(_0x3b71b8){return{'model':db[_0x3b71b8['model']],'as':_0x3b71b8['as'],'attributes':_0x3b71b8[_0x69ad('0x1b')],'include':_0x3b71b8[_0x69ad('0x1d')]?_[_0x69ad('0x1c')](_0x3b71b8[_0x69ad('0x1d')],function(_0x181309){return{'model':db[_0x181309[_0x69ad('0x1e')]],'as':_0x181309['as'],'attributes':_0x181309[_0x69ad('0x1b')],'include':_0x181309['include']?_[_0x69ad('0x1c')](_0x181309['include'],function(_0x15645c){return{'model':db[_0x15645c[_0x69ad('0x1e')]],'as':_0x15645c['as'],'attributes':_0x15645c['attributes']};}):[]};}):[]};}):[]:[]})[_0x69ad('0x21')](function(_0x2ddbef){logger['info'](_0x69ad('0x1f'),_0x23b021);logger[_0x69ad('0xe')](_0x69ad('0x1f'),_0x23b021,JSON['stringify'](_0x2ddbef));_0x97765c(_0x2ddbef);})[_0x69ad('0x14')](function(_0x4703c2){logger['error'](_0x69ad('0x1f'),_0x4703c2[_0x69ad('0x12')],_0x23b021);_0x40440f(_0x12719e[_0x69ad('0x11')](0x1f4,_0x4703c2[_0x69ad('0x12')]));});});}; \ No newline at end of file +var _0x0b91=['debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetDynamics365Account','Dynamics365Account','findAll','options','where','attributes','include','map','model','ShowDynamics365Account','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent'];(function(_0x7ad6cb,_0xffee6c){var _0x22a0ba=function(_0x47f291){while(--_0x47f291){_0x7ad6cb['push'](_0x7ad6cb['shift']());}};_0x22a0ba(++_0xffee6c);}(_0x0b91,0x16f));var _0x10b9=function(_0x114f7f,_0x266931){_0x114f7f=_0x114f7f-0x0;var _0x4025ad=_0x0b91[_0x114f7f];return _0x4025ad;};'use strict';var _=require(_0x10b9('0x0'));var util=require(_0x10b9('0x1'));var moment=require(_0x10b9('0x2'));var BPromise=require(_0x10b9('0x3'));var rs=require(_0x10b9('0x4'));var fs=require('fs');var Redis=require(_0x10b9('0x5'));var db=require(_0x10b9('0x6'))['db'];var utils=require(_0x10b9('0x7'));var logger=require(_0x10b9('0x8'))(_0x10b9('0x9'));var config=require(_0x10b9('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x10b9('0xb')][_0x10b9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x308b94,_0x1d06e7,_0x152fb4){return new BPromise(function(_0x48f86c,_0x1f6f49){return client[_0x10b9('0xd')](_0x308b94,_0x152fb4)[_0x10b9('0xe')](function(_0x55d4f1){logger[_0x10b9('0xf')](_0x10b9('0x10'),_0x1d06e7,_0x10b9('0x11'));logger[_0x10b9('0x12')](_0x10b9('0x13'),_0x1d06e7,_0x10b9('0x11'),JSON[_0x10b9('0x14')](_0x55d4f1));if(_0x55d4f1['error']){if(_0x55d4f1[_0x10b9('0x15')]['code']===0x1f4){logger[_0x10b9('0x15')](_0x10b9('0x10'),_0x1d06e7,_0x55d4f1[_0x10b9('0x15')][_0x10b9('0x16')]);return _0x1f6f49(_0x55d4f1['error'][_0x10b9('0x16')]);}logger[_0x10b9('0x15')](_0x10b9('0x10'),_0x1d06e7,_0x55d4f1[_0x10b9('0x15')][_0x10b9('0x16')]);return _0x48f86c(_0x55d4f1[_0x10b9('0x15')][_0x10b9('0x16')]);}else{logger[_0x10b9('0xf')](_0x10b9('0x10'),_0x1d06e7,'request\x20sent');_0x48f86c(_0x55d4f1['result'][_0x10b9('0x16')]);}})[_0x10b9('0x17')](function(_0x2ce1c1){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x1d06e7,_0x2ce1c1);_0x1f6f49(_0x2ce1c1);});});}exports[_0x10b9('0x18')]=function(_0x49a776){var _0xf44b5f=this;return new Promise(function(_0x5c60fe,_0x5bd24f){return db[_0x10b9('0x19')][_0x10b9('0x1a')]({'raw':_0x49a776[_0x10b9('0x1b')]?_0x49a776[_0x10b9('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x49a776['options']?_0x49a776[_0x10b9('0x1b')][_0x10b9('0x1c')]||null:null,'attributes':_0x49a776[_0x10b9('0x1b')]?_0x49a776[_0x10b9('0x1b')][_0x10b9('0x1d')]||null:null,'limit':_0x49a776[_0x10b9('0x1b')]?_0x49a776['options']['limit']||null:null,'include':_0x49a776[_0x10b9('0x1b')]?_0x49a776[_0x10b9('0x1b')][_0x10b9('0x1e')]?_[_0x10b9('0x1f')](_0x49a776[_0x10b9('0x1b')][_0x10b9('0x1e')],function(_0x5879d0){return{'model':db[_0x5879d0[_0x10b9('0x20')]],'as':_0x5879d0['as'],'attributes':_0x5879d0[_0x10b9('0x1d')],'include':_0x5879d0['include']?_['map'](_0x5879d0[_0x10b9('0x1e')],function(_0x1b322f){return{'model':db[_0x1b322f[_0x10b9('0x20')]],'as':_0x1b322f['as'],'attributes':_0x1b322f[_0x10b9('0x1d')],'include':_0x1b322f[_0x10b9('0x1e')]?_[_0x10b9('0x1f')](_0x1b322f['include'],function(_0x11e255){return{'model':db[_0x11e255[_0x10b9('0x20')]],'as':_0x11e255['as'],'attributes':_0x11e255[_0x10b9('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x10b9('0xe')](function(_0x3cd9ae){logger[_0x10b9('0xf')](_0x10b9('0x18'),_0x49a776);logger['debug'](_0x10b9('0x18'),_0x49a776,JSON[_0x10b9('0x14')](_0x3cd9ae));_0x5c60fe(_0x3cd9ae);})['catch'](function(_0x24614e){logger[_0x10b9('0x15')](_0x10b9('0x18'),_0x24614e['message'],_0x49a776);_0x5bd24f(_0xf44b5f[_0x10b9('0x15')](0x1f4,_0x24614e[_0x10b9('0x16')]));});});};exports[_0x10b9('0x21')]=function(_0x4e8031){var _0x5c4f25=this;return new Promise(function(_0x60381d,_0x5db2bd){return db['Dynamics365Account'][_0x10b9('0x22')]({'raw':_0x4e8031['options']?_0x4e8031['options']['raw']===undefined?!![]:![]:!![],'where':_0x4e8031[_0x10b9('0x1b')]?_0x4e8031['options'][_0x10b9('0x1c')]||null:null,'attributes':_0x4e8031['options']?_0x4e8031[_0x10b9('0x1b')][_0x10b9('0x1d')]||null:null,'include':_0x4e8031[_0x10b9('0x1b')]?_0x4e8031[_0x10b9('0x1b')][_0x10b9('0x1e')]?_['map'](_0x4e8031[_0x10b9('0x1b')]['include'],function(_0x5d36ab){return{'model':db[_0x5d36ab['model']],'as':_0x5d36ab['as'],'attributes':_0x5d36ab[_0x10b9('0x1d')],'include':_0x5d36ab[_0x10b9('0x1e')]?_['map'](_0x5d36ab['include'],function(_0x204bf8){return{'model':db[_0x204bf8[_0x10b9('0x20')]],'as':_0x204bf8['as'],'attributes':_0x204bf8['attributes'],'include':_0x204bf8['include']?_[_0x10b9('0x1f')](_0x204bf8[_0x10b9('0x1e')],function(_0x20f7cc){return{'model':db[_0x20f7cc[_0x10b9('0x20')]],'as':_0x20f7cc['as'],'attributes':_0x20f7cc[_0x10b9('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x10b9('0xe')](function(_0x4d2896){logger[_0x10b9('0xf')]('ShowDynamics365Account',_0x4e8031);logger[_0x10b9('0x12')](_0x10b9('0x21'),_0x4e8031,JSON['stringify'](_0x4d2896));_0x60381d(_0x4d2896);})['catch'](function(_0x3d21b5){logger[_0x10b9('0x15')](_0x10b9('0x21'),_0x3d21b5[_0x10b9('0x16')],_0x4e8031);_0x5db2bd(_0x5c4f25[_0x10b9('0x15')](0x1f4,_0x3d21b5[_0x10b9('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 93998fc..01b932a 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 _0xd945=['show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Configuration.controller','get','isAuthenticated','index'];(function(_0x110c93,_0x54f055){var _0xf35ef6=function(_0x4195e5){while(--_0x4195e5){_0x110c93['push'](_0x110c93['shift']());}};_0xf35ef6(++_0x54f055);}(_0xd945,0x84));var _0x5d94=function(_0x1a826f,_0x398b2d){_0x1a826f=_0x1a826f-0x0;var _0x20905b=_0xd945[_0x1a826f];return _0x20905b;};'use strict';var multer=require(_0x5d94('0x0'));var util=require(_0x5d94('0x1'));var path=require(_0x5d94('0x2'));var timeout=require('connect-timeout');var express=require(_0x5d94('0x3'));var router=express[_0x5d94('0x4')]();var fs_extra=require(_0x5d94('0x5'));var auth=require(_0x5d94('0x6'));var interaction=require(_0x5d94('0x7'));var config=require('../../config/environment');var controller=require(_0x5d94('0x8'));router[_0x5d94('0x9')]('/',auth[_0x5d94('0xa')](),controller[_0x5d94('0xb')]);router[_0x5d94('0x9')]('/:id',auth[_0x5d94('0xa')](),controller[_0x5d94('0xc')]);router[_0x5d94('0x9')]('/:id/fields',auth[_0x5d94('0xa')](),controller[_0x5d94('0xd')]);router[_0x5d94('0x9')](_0x5d94('0xe'),auth['isAuthenticated'](),controller[_0x5d94('0xf')]);router['get'](_0x5d94('0x10'),auth[_0x5d94('0xa')](),controller[_0x5d94('0x11')]);router[_0x5d94('0x12')]('/',auth[_0x5d94('0xa')](),controller[_0x5d94('0x13')]);router[_0x5d94('0x14')](_0x5d94('0x15'),auth[_0x5d94('0xa')](),controller[_0x5d94('0x16')]);router['delete'](_0x5d94('0x15'),auth[_0x5d94('0xa')](),controller['destroy']);module[_0x5d94('0x17')]=router; \ No newline at end of file +var _0xfc61=['show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','put','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','index','get','/:id','isAuthenticated'];(function(_0x8d98b4,_0x2e63ef){var _0x58fa6f=function(_0x145967){while(--_0x145967){_0x8d98b4['push'](_0x8d98b4['shift']());}};_0x58fa6f(++_0x2e63ef);}(_0xfc61,0x78));var _0x1fc6=function(_0x286810,_0xf9161d){_0x286810=_0x286810-0x0;var _0x303ec8=_0xfc61[_0x286810];return _0x303ec8;};'use strict';var multer=require(_0x1fc6('0x0'));var util=require(_0x1fc6('0x1'));var path=require(_0x1fc6('0x2'));var timeout=require(_0x1fc6('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1fc6('0x4'));var interaction=require(_0x1fc6('0x5'));var config=require(_0x1fc6('0x6'));var controller=require(_0x1fc6('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x1fc6('0x8')]);router[_0x1fc6('0x9')](_0x1fc6('0xa'),auth[_0x1fc6('0xb')](),controller[_0x1fc6('0xc')]);router['get'](_0x1fc6('0xd'),auth[_0x1fc6('0xb')](),controller[_0x1fc6('0xe')]);router[_0x1fc6('0x9')]('/:id/subjects',auth[_0x1fc6('0xb')](),controller[_0x1fc6('0xf')]);router['get'](_0x1fc6('0x10'),auth[_0x1fc6('0xb')](),controller[_0x1fc6('0x11')]);router[_0x1fc6('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1fc6('0x13')](_0x1fc6('0xa'),auth[_0x1fc6('0xb')](),controller['update']);router['delete'](_0x1fc6('0xa'),auth['isAuthenticated'](),controller[_0x1fc6('0x14')]);module[_0x1fc6('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index e416b92..468bd82 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 _0xaa46=['ENUM','contact','nothing','BOOLEAN','sequelize','exports','STRING','incident','phonecall'];(function(_0x4ab99,_0x219ed2){var _0x29e39c=function(_0x2dd986){while(--_0x2dd986){_0x4ab99['push'](_0x4ab99['shift']());}};_0x29e39c(++_0x219ed2);}(_0xaa46,0x1a2));var _0x6aa4=function(_0x50cb4b,_0x140d9a){_0x50cb4b=_0x50cb4b-0x0;var _0x53b81a=_0xaa46[_0x50cb4b];return _0x53b81a;};'use strict';var Sequelize=require(_0x6aa4('0x0'));module[_0x6aa4('0x1')]={'name':{'type':Sequelize[_0x6aa4('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x6aa4('0x3'),_0x6aa4('0x4')),'defaultValue':_0x6aa4('0x3')},'moduleCreate':{'type':Sequelize[_0x6aa4('0x5')](_0x6aa4('0x6'),_0x6aa4('0x7')),'defaultValue':_0x6aa4('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x6aa4('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x6aa4('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0x6127=['contact','nothing','exports','STRING','ENUM','incident','phonecall'];(function(_0x31b71b,_0xe42ad2){var _0x4ba405=function(_0x151358){while(--_0x151358){_0x31b71b['push'](_0x31b71b['shift']());}};_0x4ba405(++_0xe42ad2);}(_0x6127,0x1e5));var _0x7612=function(_0x215971,_0x37ea84){_0x215971=_0x215971-0x0;var _0x1031a4=_0x6127[_0x215971];return _0x1031a4;};'use strict';var Sequelize=require('sequelize');module[_0x7612('0x0')]={'name':{'type':Sequelize[_0x7612('0x1')]},'description':{'type':Sequelize[_0x7612('0x1')]},'ticketType':{'type':Sequelize[_0x7612('0x2')](_0x7612('0x3'),_0x7612('0x4')),'defaultValue':_0x7612('0x3')},'moduleCreate':{'type':Sequelize[_0x7612('0x2')](_0x7612('0x5'),_0x7612('0x6')),'defaultValue':_0x7612('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x7612('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 96dee2e..358d033 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 _0xb32e=['params','includeAll','find','create','body','getFields','findOne','getSubjects','Dynamics365Field','order','getDescriptions','eml-format','rimraf','zip-dir','request-promise','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/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','include','Dynamics365Configuration','findAll','rows','catch','show'];(function(_0x530b21,_0x38839d){var _0x2e7930=function(_0x2a438e){while(--_0x2a438e){_0x530b21['push'](_0x530b21['shift']());}};_0x2e7930(++_0x38839d);}(_0xb32e,0x1aa));var _0xeb32=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb32e[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xeb32('0x0'));var rimraf=require(_0xeb32('0x1'));var zipdir=require(_0xeb32('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeb32('0x3'));var moment=require('moment');var BPromise=require(_0xeb32('0x4'));var Mustache=require(_0xeb32('0x5'));var util=require(_0xeb32('0x6'));var path=require(_0xeb32('0x7'));var sox=require(_0xeb32('0x8'));var csv=require(_0xeb32('0x9'));var ejs=require(_0xeb32('0xa'));var fs=require('fs');var fs_extra=require(_0xeb32('0xb'));var _=require(_0xeb32('0xc'));var squel=require(_0xeb32('0xd'));var crypto=require(_0xeb32('0xe'));var jsforce=require(_0xeb32('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xeb32('0x9'));var querystring=require(_0xeb32('0x10'));var Papa=require('papaparse');var Redis=require(_0xeb32('0x11'));var authService=require(_0xeb32('0x12'));var qs=require(_0xeb32('0x13'));var as=require(_0xeb32('0x14'));var hardwareService=require(_0xeb32('0x15'));var logger=require(_0xeb32('0x16'))('api');var utils=require(_0xeb32('0x17'));var config=require(_0xeb32('0x18'));var licenseUtil=require(_0xeb32('0x19'));var db=require(_0xeb32('0x1a'))['db'];function respondWithStatusCode(_0x25c29f,_0x20bfa0){_0x20bfa0=_0x20bfa0||0xcc;return function(_0x3696be){if(_0x3696be){return _0x25c29f[_0xeb32('0x1b')](_0x20bfa0);}return _0x25c29f[_0xeb32('0x1c')](_0x20bfa0)[_0xeb32('0x1d')]();};}function respondWithResult(_0x1b695f,_0x2e47e3){_0x2e47e3=_0x2e47e3||0xc8;return function(_0x319784){if(_0x319784){return _0x1b695f[_0xeb32('0x1c')](_0x2e47e3)[_0xeb32('0x1e')](_0x319784);}};}function respondWithFilteredResult(_0x4163bb,_0x3b20ac){return function(_0x487507){if(_0x487507){var _0x5c22ef=typeof _0x3b20ac['offset']===_0xeb32('0x1f')&&typeof _0x3b20ac[_0xeb32('0x20')]===_0xeb32('0x1f');var _0x4efae3=_0x487507[_0xeb32('0x21')];var _0x38c340=_0x5c22ef?0x0:_0x3b20ac[_0xeb32('0x22')];var _0x5178c4=_0x5c22ef?_0x487507[_0xeb32('0x21')]:_0x3b20ac[_0xeb32('0x22')]+_0x3b20ac[_0xeb32('0x20')];var _0x3ff70e;if(_0x5178c4>=_0x4efae3){_0x5178c4=_0x4efae3;_0x3ff70e=0xc8;}else{_0x3ff70e=0xce;}_0x4163bb[_0xeb32('0x1c')](_0x3ff70e);return _0x4163bb['set']('Content-Range',_0x38c340+'-'+_0x5178c4+'/'+_0x4efae3)[_0xeb32('0x1e')](_0x487507);}return null;};}function patchUpdates(_0x31bab7){return function(_0xe1c2e7){try{jsonpatch[_0xeb32('0x23')](_0xe1c2e7,_0x31bab7,!![]);}catch(_0x17b874){return BPromise[_0xeb32('0x24')](_0x17b874);}return _0xe1c2e7[_0xeb32('0x25')]();};}function saveUpdates(_0x106f21,_0xf488fb){return function(_0x11656e){if(_0x11656e){return _0x11656e[_0xeb32('0x26')](_0x106f21)[_0xeb32('0x27')](function(_0x1c9b53){return _0x1c9b53;});}return null;};}function removeEntity(_0x3a6f23,_0x426b8e){return function(_0x630a92){if(_0x630a92){return _0x630a92[_0xeb32('0x28')]()['then'](function(){_0x3a6f23[_0xeb32('0x1c')](0xcc)[_0xeb32('0x1d')]();});}};}function handleEntityNotFound(_0x9335ed,_0x1d6805){return function(_0x49f25f){if(!_0x49f25f){_0x9335ed[_0xeb32('0x1b')](0x194);}return _0x49f25f;};}function handleError(_0x9a30e4,_0x321626){_0x321626=_0x321626||0x1f4;return function(_0x5575f5){logger['error'](_0x5575f5[_0xeb32('0x29')]);if(_0x5575f5[_0xeb32('0x2a')]){delete _0x5575f5[_0xeb32('0x2a')];}_0x9a30e4['status'](_0x321626)[_0xeb32('0x2b')](_0x5575f5);};}exports[_0xeb32('0x2c')]=function(_0x48e16b,_0xe96c00){var _0x460c2d={},_0x22cb84={},_0x3cae9a={'count':0x0,'rows':[]};var _0x1b1ead=_[_0xeb32('0x2d')](db['Dynamics365Configuration'][_0xeb32('0x2e')],function(_0x285b99){return{'name':_0x285b99['fieldName'],'type':_0x285b99['type'][_0xeb32('0x2f')]};});_0x22cb84['model']=_[_0xeb32('0x2d')](_0x1b1ead,_0xeb32('0x2a'));_0x22cb84[_0xeb32('0x30')]=_[_0xeb32('0x31')](_0x48e16b[_0xeb32('0x30')]);_0x22cb84[_0xeb32('0x32')]=_[_0xeb32('0x33')](_0x22cb84['model'],_0x22cb84[_0xeb32('0x30')]);_0x460c2d[_0xeb32('0x34')]=_[_0xeb32('0x33')](_0x22cb84[_0xeb32('0x35')],qs[_0xeb32('0x36')](_0x48e16b['query'][_0xeb32('0x36')]));_0x460c2d[_0xeb32('0x34')]=_0x460c2d[_0xeb32('0x34')][_0xeb32('0x37')]?_0x460c2d[_0xeb32('0x34')]:_0x22cb84[_0xeb32('0x35')];if(!_0x48e16b['query'][_0xeb32('0x38')](_0xeb32('0x39'))){_0x460c2d[_0xeb32('0x20')]=qs[_0xeb32('0x20')](_0x48e16b[_0xeb32('0x30')][_0xeb32('0x20')]);_0x460c2d['offset']=qs[_0xeb32('0x22')](_0x48e16b['query'][_0xeb32('0x22')]);}_0x460c2d['order']=qs['sort'](_0x48e16b[_0xeb32('0x30')][_0xeb32('0x3a')]);_0x460c2d[_0xeb32('0x3b')]=qs[_0xeb32('0x32')](_[_0xeb32('0x3c')](_0x48e16b[_0xeb32('0x30')],_0x22cb84[_0xeb32('0x32')]),_0x1b1ead);if(_0x48e16b[_0xeb32('0x30')][_0xeb32('0x3d')]){_0x460c2d['where']=_[_0xeb32('0x3e')](_0x460c2d[_0xeb32('0x3b')],{'$or':_[_0xeb32('0x2d')](_0x1b1ead,function(_0x442543){if(_0x442543[_0xeb32('0x3f')]!==_0xeb32('0x40')){var _0x823467={};_0x823467[_0x442543[_0xeb32('0x2a')]]={'$like':'%'+_0x48e16b['query'][_0xeb32('0x3d')]+'%'};return _0x823467;}})});}_0x460c2d=_['merge']({},_0x460c2d,_0x48e16b[_0xeb32('0x41')]);var _0x11413f={'where':_0x460c2d[_0xeb32('0x3b')]};return db['Dynamics365Configuration']['count'](_0x11413f)[_0xeb32('0x27')](function(_0x18464){_0x3cae9a['count']=_0x18464;if(_0x48e16b[_0xeb32('0x30')]['includeAll']){_0x460c2d[_0xeb32('0x42')]=[{'all':!![]}];}return db[_0xeb32('0x43')][_0xeb32('0x44')](_0x460c2d);})[_0xeb32('0x27')](function(_0x4b0039){_0x3cae9a[_0xeb32('0x45')]=_0x4b0039;return _0x3cae9a;})[_0xeb32('0x27')](respondWithFilteredResult(_0xe96c00,_0x460c2d))[_0xeb32('0x46')](handleError(_0xe96c00,null));};exports[_0xeb32('0x47')]=function(_0x5a5885,_0x28aa34){var _0x2be053={'raw':![],'where':{'id':_0x5a5885[_0xeb32('0x48')]['id']}},_0x3fd80c={};_0x3fd80c[_0xeb32('0x35')]=_[_0xeb32('0x31')](db['Dynamics365Configuration'][_0xeb32('0x2e')]);_0x3fd80c['query']=_[_0xeb32('0x31')](_0x5a5885[_0xeb32('0x30')]);_0x3fd80c['filters']=_[_0xeb32('0x33')](_0x3fd80c[_0xeb32('0x35')],_0x3fd80c['query']);_0x2be053[_0xeb32('0x34')]=_[_0xeb32('0x33')](_0x3fd80c['model'],qs['fields'](_0x5a5885['query'][_0xeb32('0x36')]));_0x2be053[_0xeb32('0x34')]=_0x2be053['attributes'][_0xeb32('0x37')]?_0x2be053[_0xeb32('0x34')]:_0x3fd80c[_0xeb32('0x35')];if(_0x5a5885['query'][_0xeb32('0x49')]){_0x2be053[_0xeb32('0x42')]=[{'all':!![]}];}_0x2be053=_[_0xeb32('0x3e')]({},_0x2be053,_0x5a5885[_0xeb32('0x41')]);return db[_0xeb32('0x43')][_0xeb32('0x4a')](_0x2be053)[_0xeb32('0x27')](handleEntityNotFound(_0x28aa34,null))[_0xeb32('0x27')](respondWithResult(_0x28aa34,null))['catch'](handleError(_0x28aa34,null));};exports['create']=function(_0x14d4e5,_0x148061){return db[_0xeb32('0x43')][_0xeb32('0x4b')](_0x14d4e5[_0xeb32('0x4c')],{})['then'](respondWithResult(_0x148061,0xc9))['catch'](handleError(_0x148061,null));};exports[_0xeb32('0x26')]=function(_0x4ad547,_0x61e301){if(_0x4ad547['body']['id']){delete _0x4ad547[_0xeb32('0x4c')]['id'];}return db[_0xeb32('0x43')][_0xeb32('0x4a')]({'where':{'id':_0x4ad547[_0xeb32('0x48')]['id']}})[_0xeb32('0x27')](handleEntityNotFound(_0x61e301,null))[_0xeb32('0x27')](saveUpdates(_0x4ad547[_0xeb32('0x4c')],null))[_0xeb32('0x27')](respondWithResult(_0x61e301,null))[_0xeb32('0x46')](handleError(_0x61e301,null));};exports['destroy']=function(_0x4a7de4,_0x16e419){return db[_0xeb32('0x43')][_0xeb32('0x4a')]({'where':{'id':_0x4a7de4['params']['id']}})[_0xeb32('0x27')](handleEntityNotFound(_0x16e419,null))['then'](removeEntity(_0x16e419,null))[_0xeb32('0x46')](handleError(_0x16e419,null));};exports[_0xeb32('0x4d')]=function(_0x1f3237,_0xd8dd8e,_0x34e527){var _0x402807={};var _0x548128={};var _0x46229b;var _0xb0e82b;return db[_0xeb32('0x43')][_0xeb32('0x4e')]({'where':{'id':_0x1f3237[_0xeb32('0x48')]['id']}})['then'](handleEntityNotFound(_0xd8dd8e,null))['then'](function(_0x2795e7){if(_0x2795e7){_0x46229b=_0x2795e7;_0x548128['model']=_[_0xeb32('0x31')](db['Dynamics365Field'][_0xeb32('0x2e')]);_0x548128[_0xeb32('0x30')]=_[_0xeb32('0x31')](_0x1f3237[_0xeb32('0x30')]);_0x548128[_0xeb32('0x32')]=_[_0xeb32('0x33')](_0x548128[_0xeb32('0x35')],_0x548128[_0xeb32('0x30')]);_0x402807[_0xeb32('0x34')]=_[_0xeb32('0x33')](_0x548128[_0xeb32('0x35')],qs[_0xeb32('0x36')](_0x1f3237['query']['fields']));_0x402807[_0xeb32('0x34')]=_0x402807[_0xeb32('0x34')][_0xeb32('0x37')]?_0x402807[_0xeb32('0x34')]:_0x548128[_0xeb32('0x35')];_0x402807['order']=qs[_0xeb32('0x3a')](_0x1f3237[_0xeb32('0x30')][_0xeb32('0x3a')]);_0x402807[_0xeb32('0x3b')]=qs['filters'](_[_0xeb32('0x3c')](_0x1f3237[_0xeb32('0x30')],_0x548128[_0xeb32('0x32')]));if(_0x1f3237[_0xeb32('0x30')][_0xeb32('0x3d')]){_0x402807['where']=_[_0xeb32('0x3e')](_0x402807[_0xeb32('0x3b')],{'$or':_[_0xeb32('0x2d')](_0x402807[_0xeb32('0x34')],function(_0xe9974){var _0x5e2770={};_0x5e2770[_0xe9974]={'$like':'%'+_0x1f3237[_0xeb32('0x30')][_0xeb32('0x3d')]+'%'};return _0x5e2770;})});}_0x402807=_['merge']({},_0x402807,_0x1f3237[_0xeb32('0x41')]);return _0x46229b[_0xeb32('0x4d')](_0x402807);}})[_0xeb32('0x27')](function(_0x51345b){if(_0x51345b){_0xb0e82b=_0x51345b[_0xeb32('0x37')];if(!_0x1f3237[_0xeb32('0x30')][_0xeb32('0x38')](_0xeb32('0x39'))){_0x402807[_0xeb32('0x20')]=qs[_0xeb32('0x20')](_0x1f3237['query'][_0xeb32('0x20')]);_0x402807[_0xeb32('0x22')]=qs[_0xeb32('0x22')](_0x1f3237[_0xeb32('0x30')][_0xeb32('0x22')]);}return _0x46229b[_0xeb32('0x4d')](_0x402807);}})[_0xeb32('0x27')](function(_0x46d46d){if(_0x46d46d){return _0x46d46d?{'count':_0xb0e82b,'rows':_0x46d46d}:null;}})['then'](respondWithResult(_0xd8dd8e,null))[_0xeb32('0x46')](handleError(_0xd8dd8e,null));};exports[_0xeb32('0x4f')]=function(_0x3b0d86,_0x51f565,_0x2483a5){var _0x551a82={};var _0x5d89b0={};var _0x37360b;var _0x5be64f;return db[_0xeb32('0x43')][_0xeb32('0x4e')]({'where':{'id':_0x3b0d86['params']['id']}})[_0xeb32('0x27')](handleEntityNotFound(_0x51f565,null))[_0xeb32('0x27')](function(_0x47509d){if(_0x47509d){_0x37360b=_0x47509d;_0x5d89b0[_0xeb32('0x35')]=_[_0xeb32('0x31')](db[_0xeb32('0x50')][_0xeb32('0x2e')]);_0x5d89b0[_0xeb32('0x30')]=_[_0xeb32('0x31')](_0x3b0d86[_0xeb32('0x30')]);_0x5d89b0[_0xeb32('0x32')]=_['intersection'](_0x5d89b0['model'],_0x5d89b0[_0xeb32('0x30')]);_0x551a82['attributes']=_[_0xeb32('0x33')](_0x5d89b0['model'],qs[_0xeb32('0x36')](_0x3b0d86[_0xeb32('0x30')][_0xeb32('0x36')]));_0x551a82[_0xeb32('0x34')]=_0x551a82['attributes'][_0xeb32('0x37')]?_0x551a82['attributes']:_0x5d89b0[_0xeb32('0x35')];_0x551a82[_0xeb32('0x51')]=qs[_0xeb32('0x3a')](_0x3b0d86['query']['sort']);_0x551a82[_0xeb32('0x3b')]=qs['filters'](_[_0xeb32('0x3c')](_0x3b0d86[_0xeb32('0x30')],_0x5d89b0[_0xeb32('0x32')]));if(_0x3b0d86['query'][_0xeb32('0x3d')]){_0x551a82[_0xeb32('0x3b')]=_[_0xeb32('0x3e')](_0x551a82[_0xeb32('0x3b')],{'$or':_[_0xeb32('0x2d')](_0x551a82[_0xeb32('0x34')],function(_0xc85639){var _0x596843={};_0x596843[_0xc85639]={'$like':'%'+_0x3b0d86['query'][_0xeb32('0x3d')]+'%'};return _0x596843;})});}_0x551a82=_[_0xeb32('0x3e')]({},_0x551a82,_0x3b0d86[_0xeb32('0x41')]);return _0x37360b['getSubjects'](_0x551a82);}})['then'](function(_0x1388e8){if(_0x1388e8){_0x5be64f=_0x1388e8['length'];if(!_0x3b0d86[_0xeb32('0x30')][_0xeb32('0x38')]('nolimit')){_0x551a82['limit']=qs[_0xeb32('0x20')](_0x3b0d86['query'][_0xeb32('0x20')]);_0x551a82[_0xeb32('0x22')]=qs['offset'](_0x3b0d86[_0xeb32('0x30')]['offset']);}return _0x37360b[_0xeb32('0x4f')](_0x551a82);}})[_0xeb32('0x27')](function(_0x482ab5){if(_0x482ab5){return _0x482ab5?{'count':_0x5be64f,'rows':_0x482ab5}:null;}})[_0xeb32('0x27')](respondWithResult(_0x51f565,null))[_0xeb32('0x46')](handleError(_0x51f565,null));};exports[_0xeb32('0x52')]=function(_0x4da8c1,_0x3a27d3,_0xbface0){var _0x4916dd={};var _0xc96ccb={};var _0x9996b5;var _0x266072;return db[_0xeb32('0x43')][_0xeb32('0x4e')]({'where':{'id':_0x4da8c1['params']['id']}})['then'](handleEntityNotFound(_0x3a27d3,null))[_0xeb32('0x27')](function(_0xb09e21){if(_0xb09e21){_0x9996b5=_0xb09e21;_0xc96ccb[_0xeb32('0x35')]=_[_0xeb32('0x31')](db[_0xeb32('0x50')][_0xeb32('0x2e')]);_0xc96ccb[_0xeb32('0x30')]=_[_0xeb32('0x31')](_0x4da8c1[_0xeb32('0x30')]);_0xc96ccb[_0xeb32('0x32')]=_[_0xeb32('0x33')](_0xc96ccb[_0xeb32('0x35')],_0xc96ccb[_0xeb32('0x30')]);_0x4916dd[_0xeb32('0x34')]=_[_0xeb32('0x33')](_0xc96ccb['model'],qs[_0xeb32('0x36')](_0x4da8c1[_0xeb32('0x30')][_0xeb32('0x36')]));_0x4916dd['attributes']=_0x4916dd['attributes'][_0xeb32('0x37')]?_0x4916dd[_0xeb32('0x34')]:_0xc96ccb[_0xeb32('0x35')];_0x4916dd['order']=qs['sort'](_0x4da8c1[_0xeb32('0x30')][_0xeb32('0x3a')]);_0x4916dd[_0xeb32('0x3b')]=qs[_0xeb32('0x32')](_[_0xeb32('0x3c')](_0x4da8c1[_0xeb32('0x30')],_0xc96ccb['filters']));if(_0x4da8c1[_0xeb32('0x30')]['filter']){_0x4916dd[_0xeb32('0x3b')]=_[_0xeb32('0x3e')](_0x4916dd[_0xeb32('0x3b')],{'$or':_[_0xeb32('0x2d')](_0x4916dd[_0xeb32('0x34')],function(_0xc3d6be){var _0xc9e9af={};_0xc9e9af[_0xc3d6be]={'$like':'%'+_0x4da8c1[_0xeb32('0x30')][_0xeb32('0x3d')]+'%'};return _0xc9e9af;})});}_0x4916dd=_['merge']({},_0x4916dd,_0x4da8c1[_0xeb32('0x41')]);return _0x9996b5[_0xeb32('0x52')](_0x4916dd);}})[_0xeb32('0x27')](function(_0x2d73de){if(_0x2d73de){_0x266072=_0x2d73de['length'];if(!_0x4da8c1[_0xeb32('0x30')][_0xeb32('0x38')]('nolimit')){_0x4916dd['limit']=qs[_0xeb32('0x20')](_0x4da8c1[_0xeb32('0x30')][_0xeb32('0x20')]);_0x4916dd['offset']=qs['offset'](_0x4da8c1[_0xeb32('0x30')][_0xeb32('0x22')]);}return _0x9996b5[_0xeb32('0x52')](_0x4916dd);}})[_0xeb32('0x27')](function(_0x1a111a){if(_0x1a111a){return _0x1a111a?{'count':_0x266072,'rows':_0x1a111a}:null;}})['then'](respondWithResult(_0x3a27d3,null))[_0xeb32('0x46')](handleError(_0x3a27d3,null));}; \ No newline at end of file +var _0x666c=['intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','options','Dynamics365Configuration','include','findAll','rows','catch','show','params','includeAll','merge','create','body','destroy','getFields','findOne','Dynamics365Field','order','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x10a7f1,_0x2e446e){var _0x1248cc=function(_0x39478a){while(--_0x39478a){_0x10a7f1['push'](_0x10a7f1['shift']());}};_0x1248cc(++_0x2e446e);}(_0x666c,0x162));var _0xc666=function(_0x23292a,_0x1e08ea){_0x23292a=_0x23292a-0x0;var _0x4564f2=_0x666c[_0x23292a];return _0x4564f2;};'use strict';var emlformat=require(_0xc666('0x0'));var rimraf=require(_0xc666('0x1'));var zipdir=require(_0xc666('0x2'));var jsonpatch=require(_0xc666('0x3'));var rp=require(_0xc666('0x4'));var moment=require(_0xc666('0x5'));var BPromise=require(_0xc666('0x6'));var Mustache=require(_0xc666('0x7'));var util=require('util');var path=require(_0xc666('0x8'));var sox=require('sox');var csv=require(_0xc666('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc666('0xa'));var _=require('lodash');var squel=require(_0xc666('0xb'));var crypto=require(_0xc666('0xc'));var jsforce=require(_0xc666('0xd'));var deskjs=require(_0xc666('0xe'));var toCsv=require(_0xc666('0x9'));var querystring=require(_0xc666('0xf'));var Papa=require(_0xc666('0x10'));var Redis=require(_0xc666('0x11'));var authService=require(_0xc666('0x12'));var qs=require(_0xc666('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc666('0x14'))(_0xc666('0x15'));var utils=require(_0xc666('0x16'));var config=require(_0xc666('0x17'));var licenseUtil=require(_0xc666('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x106efc,_0x28e4a7){_0x28e4a7=_0x28e4a7||0xcc;return function(_0x701ce3){if(_0x701ce3){return _0x106efc[_0xc666('0x19')](_0x28e4a7);}return _0x106efc[_0xc666('0x1a')](_0x28e4a7)[_0xc666('0x1b')]();};}function respondWithResult(_0x138203,_0x58f7f2){_0x58f7f2=_0x58f7f2||0xc8;return function(_0x8b2f3e){if(_0x8b2f3e){return _0x138203['status'](_0x58f7f2)[_0xc666('0x1c')](_0x8b2f3e);}};}function respondWithFilteredResult(_0x249b9a,_0x56a1d7){return function(_0x49a777){if(_0x49a777){var _0x5a1b1f=typeof _0x56a1d7[_0xc666('0x1d')]===_0xc666('0x1e')&&typeof _0x56a1d7[_0xc666('0x1f')]==='undefined';var _0x42ca5a=_0x49a777[_0xc666('0x20')];var _0x3a8528=_0x5a1b1f?0x0:_0x56a1d7['offset'];var _0x5ccdb5=_0x5a1b1f?_0x49a777['count']:_0x56a1d7[_0xc666('0x1d')]+_0x56a1d7[_0xc666('0x1f')];var _0xd504ce;if(_0x5ccdb5>=_0x42ca5a){_0x5ccdb5=_0x42ca5a;_0xd504ce=0xc8;}else{_0xd504ce=0xce;}_0x249b9a[_0xc666('0x1a')](_0xd504ce);return _0x249b9a['set'](_0xc666('0x21'),_0x3a8528+'-'+_0x5ccdb5+'/'+_0x42ca5a)[_0xc666('0x1c')](_0x49a777);}return null;};}function patchUpdates(_0x1842f9){return function(_0xf13812){try{jsonpatch[_0xc666('0x22')](_0xf13812,_0x1842f9,!![]);}catch(_0xc12be4){return BPromise[_0xc666('0x23')](_0xc12be4);}return _0xf13812['save']();};}function saveUpdates(_0x1ef7e8,_0x57025c){return function(_0x26ee9f){if(_0x26ee9f){return _0x26ee9f[_0xc666('0x24')](_0x1ef7e8)[_0xc666('0x25')](function(_0x3ca17e){return _0x3ca17e;});}return null;};}function removeEntity(_0x10dfd6,_0x2e091a){return function(_0x2937c9){if(_0x2937c9){return _0x2937c9['destroy']()[_0xc666('0x25')](function(){_0x10dfd6[_0xc666('0x1a')](0xcc)[_0xc666('0x1b')]();});}};}function handleEntityNotFound(_0x2a7eb3,_0xd7c8a7){return function(_0x2a130c){if(!_0x2a130c){_0x2a7eb3['sendStatus'](0x194);}return _0x2a130c;};}function handleError(_0xa1b8d,_0x4ee171){_0x4ee171=_0x4ee171||0x1f4;return function(_0x22ee7c){logger[_0xc666('0x26')](_0x22ee7c['stack']);if(_0x22ee7c[_0xc666('0x27')]){delete _0x22ee7c[_0xc666('0x27')];}_0xa1b8d['status'](_0x4ee171)[_0xc666('0x28')](_0x22ee7c);};}exports[_0xc666('0x29')]=function(_0x130f09,_0x329a5a){var _0xe694be={},_0x511363={},_0x36be01={'count':0x0,'rows':[]};var _0x5cad9a=_[_0xc666('0x2a')](db['Dynamics365Configuration'][_0xc666('0x2b')],function(_0x42e72c){return{'name':_0x42e72c[_0xc666('0x2c')],'type':_0x42e72c[_0xc666('0x2d')][_0xc666('0x2e')]};});_0x511363[_0xc666('0x2f')]=_[_0xc666('0x2a')](_0x5cad9a,_0xc666('0x27'));_0x511363[_0xc666('0x30')]=_[_0xc666('0x31')](_0x130f09[_0xc666('0x30')]);_0x511363[_0xc666('0x32')]=_[_0xc666('0x33')](_0x511363[_0xc666('0x2f')],_0x511363[_0xc666('0x30')]);_0xe694be['attributes']=_[_0xc666('0x33')](_0x511363[_0xc666('0x2f')],qs[_0xc666('0x34')](_0x130f09[_0xc666('0x30')][_0xc666('0x34')]));_0xe694be[_0xc666('0x35')]=_0xe694be[_0xc666('0x35')][_0xc666('0x36')]?_0xe694be[_0xc666('0x35')]:_0x511363[_0xc666('0x2f')];if(!_0x130f09[_0xc666('0x30')][_0xc666('0x37')]('nolimit')){_0xe694be[_0xc666('0x1f')]=qs['limit'](_0x130f09[_0xc666('0x30')][_0xc666('0x1f')]);_0xe694be[_0xc666('0x1d')]=qs[_0xc666('0x1d')](_0x130f09[_0xc666('0x30')][_0xc666('0x1d')]);}_0xe694be['order']=qs[_0xc666('0x38')](_0x130f09['query'][_0xc666('0x38')]);_0xe694be[_0xc666('0x39')]=qs['filters'](_[_0xc666('0x3a')](_0x130f09[_0xc666('0x30')],_0x511363[_0xc666('0x32')]),_0x5cad9a);if(_0x130f09[_0xc666('0x30')][_0xc666('0x3b')]){_0xe694be[_0xc666('0x39')]=_['merge'](_0xe694be[_0xc666('0x39')],{'$or':_[_0xc666('0x2a')](_0x5cad9a,function(_0xb059c1){if(_0xb059c1[_0xc666('0x2d')]!==_0xc666('0x3c')){var _0x1cd51c={};_0x1cd51c[_0xb059c1[_0xc666('0x27')]]={'$like':'%'+_0x130f09[_0xc666('0x30')][_0xc666('0x3b')]+'%'};return _0x1cd51c;}})});}_0xe694be=_['merge']({},_0xe694be,_0x130f09[_0xc666('0x3d')]);var _0x46afdc={'where':_0xe694be[_0xc666('0x39')]};return db[_0xc666('0x3e')][_0xc666('0x20')](_0x46afdc)[_0xc666('0x25')](function(_0x2e07af){_0x36be01[_0xc666('0x20')]=_0x2e07af;if(_0x130f09[_0xc666('0x30')]['includeAll']){_0xe694be[_0xc666('0x3f')]=[{'all':!![]}];}return db[_0xc666('0x3e')][_0xc666('0x40')](_0xe694be);})[_0xc666('0x25')](function(_0x4f907b){_0x36be01[_0xc666('0x41')]=_0x4f907b;return _0x36be01;})['then'](respondWithFilteredResult(_0x329a5a,_0xe694be))[_0xc666('0x42')](handleError(_0x329a5a,null));};exports[_0xc666('0x43')]=function(_0x2176fb,_0x2f897a){var _0x37f27d={'raw':![],'where':{'id':_0x2176fb[_0xc666('0x44')]['id']}},_0x181f7d={};_0x181f7d[_0xc666('0x2f')]=_[_0xc666('0x31')](db[_0xc666('0x3e')][_0xc666('0x2b')]);_0x181f7d[_0xc666('0x30')]=_['keys'](_0x2176fb['query']);_0x181f7d[_0xc666('0x32')]=_['intersection'](_0x181f7d[_0xc666('0x2f')],_0x181f7d['query']);_0x37f27d[_0xc666('0x35')]=_['intersection'](_0x181f7d[_0xc666('0x2f')],qs[_0xc666('0x34')](_0x2176fb[_0xc666('0x30')][_0xc666('0x34')]));_0x37f27d[_0xc666('0x35')]=_0x37f27d['attributes'][_0xc666('0x36')]?_0x37f27d[_0xc666('0x35')]:_0x181f7d['model'];if(_0x2176fb[_0xc666('0x30')][_0xc666('0x45')]){_0x37f27d[_0xc666('0x3f')]=[{'all':!![]}];}_0x37f27d=_[_0xc666('0x46')]({},_0x37f27d,_0x2176fb[_0xc666('0x3d')]);return db[_0xc666('0x3e')]['find'](_0x37f27d)[_0xc666('0x25')](handleEntityNotFound(_0x2f897a,null))[_0xc666('0x25')](respondWithResult(_0x2f897a,null))[_0xc666('0x42')](handleError(_0x2f897a,null));};exports['create']=function(_0x187256,_0x34c459){return db['Dynamics365Configuration'][_0xc666('0x47')](_0x187256[_0xc666('0x48')],{})[_0xc666('0x25')](respondWithResult(_0x34c459,0xc9))['catch'](handleError(_0x34c459,null));};exports[_0xc666('0x24')]=function(_0x459678,_0xa40b24){if(_0x459678[_0xc666('0x48')]['id']){delete _0x459678[_0xc666('0x48')]['id'];}return db[_0xc666('0x3e')]['find']({'where':{'id':_0x459678['params']['id']}})[_0xc666('0x25')](handleEntityNotFound(_0xa40b24,null))[_0xc666('0x25')](saveUpdates(_0x459678[_0xc666('0x48')],null))['then'](respondWithResult(_0xa40b24,null))[_0xc666('0x42')](handleError(_0xa40b24,null));};exports[_0xc666('0x49')]=function(_0x550352,_0x3b72a4){return db[_0xc666('0x3e')]['find']({'where':{'id':_0x550352[_0xc666('0x44')]['id']}})[_0xc666('0x25')](handleEntityNotFound(_0x3b72a4,null))[_0xc666('0x25')](removeEntity(_0x3b72a4,null))[_0xc666('0x42')](handleError(_0x3b72a4,null));};exports[_0xc666('0x4a')]=function(_0x44067e,_0x17c439,_0x2bb52b){var _0x751bad={};var _0x57b127={};var _0x59fa32;var _0xee758c;return db[_0xc666('0x3e')][_0xc666('0x4b')]({'where':{'id':_0x44067e['params']['id']}})['then'](handleEntityNotFound(_0x17c439,null))[_0xc666('0x25')](function(_0x20e4fe){if(_0x20e4fe){_0x59fa32=_0x20e4fe;_0x57b127[_0xc666('0x2f')]=_[_0xc666('0x31')](db[_0xc666('0x4c')]['rawAttributes']);_0x57b127[_0xc666('0x30')]=_[_0xc666('0x31')](_0x44067e[_0xc666('0x30')]);_0x57b127[_0xc666('0x32')]=_[_0xc666('0x33')](_0x57b127[_0xc666('0x2f')],_0x57b127[_0xc666('0x30')]);_0x751bad[_0xc666('0x35')]=_[_0xc666('0x33')](_0x57b127['model'],qs[_0xc666('0x34')](_0x44067e[_0xc666('0x30')][_0xc666('0x34')]));_0x751bad[_0xc666('0x35')]=_0x751bad['attributes'][_0xc666('0x36')]?_0x751bad['attributes']:_0x57b127['model'];_0x751bad[_0xc666('0x4d')]=qs[_0xc666('0x38')](_0x44067e[_0xc666('0x30')][_0xc666('0x38')]);_0x751bad[_0xc666('0x39')]=qs[_0xc666('0x32')](_[_0xc666('0x3a')](_0x44067e[_0xc666('0x30')],_0x57b127[_0xc666('0x32')]));if(_0x44067e[_0xc666('0x30')][_0xc666('0x3b')]){_0x751bad[_0xc666('0x39')]=_[_0xc666('0x46')](_0x751bad[_0xc666('0x39')],{'$or':_[_0xc666('0x2a')](_0x751bad[_0xc666('0x35')],function(_0x130dfd){var _0x2f4edc={};_0x2f4edc[_0x130dfd]={'$like':'%'+_0x44067e[_0xc666('0x30')][_0xc666('0x3b')]+'%'};return _0x2f4edc;})});}_0x751bad=_[_0xc666('0x46')]({},_0x751bad,_0x44067e[_0xc666('0x3d')]);return _0x59fa32['getFields'](_0x751bad);}})[_0xc666('0x25')](function(_0x18404a){if(_0x18404a){_0xee758c=_0x18404a[_0xc666('0x36')];if(!_0x44067e[_0xc666('0x30')][_0xc666('0x37')](_0xc666('0x4e'))){_0x751bad['limit']=qs['limit'](_0x44067e[_0xc666('0x30')][_0xc666('0x1f')]);_0x751bad['offset']=qs[_0xc666('0x1d')](_0x44067e[_0xc666('0x30')][_0xc666('0x1d')]);}return _0x59fa32[_0xc666('0x4a')](_0x751bad);}})['then'](function(_0x5aaa0f){if(_0x5aaa0f){return _0x5aaa0f?{'count':_0xee758c,'rows':_0x5aaa0f}:null;}})[_0xc666('0x25')](respondWithResult(_0x17c439,null))['catch'](handleError(_0x17c439,null));};exports[_0xc666('0x4f')]=function(_0x28d449,_0x253d35,_0x5c960c){var _0x4b72d5={};var _0x468090={};var _0x33871b;var _0x7acde2;return db[_0xc666('0x3e')][_0xc666('0x4b')]({'where':{'id':_0x28d449[_0xc666('0x44')]['id']}})['then'](handleEntityNotFound(_0x253d35,null))[_0xc666('0x25')](function(_0x2b9aba){if(_0x2b9aba){_0x33871b=_0x2b9aba;_0x468090[_0xc666('0x2f')]=_['keys'](db[_0xc666('0x4c')][_0xc666('0x2b')]);_0x468090[_0xc666('0x30')]=_['keys'](_0x28d449[_0xc666('0x30')]);_0x468090[_0xc666('0x32')]=_['intersection'](_0x468090[_0xc666('0x2f')],_0x468090[_0xc666('0x30')]);_0x4b72d5['attributes']=_['intersection'](_0x468090[_0xc666('0x2f')],qs[_0xc666('0x34')](_0x28d449[_0xc666('0x30')][_0xc666('0x34')]));_0x4b72d5[_0xc666('0x35')]=_0x4b72d5[_0xc666('0x35')][_0xc666('0x36')]?_0x4b72d5[_0xc666('0x35')]:_0x468090[_0xc666('0x2f')];_0x4b72d5[_0xc666('0x4d')]=qs[_0xc666('0x38')](_0x28d449['query'][_0xc666('0x38')]);_0x4b72d5[_0xc666('0x39')]=qs[_0xc666('0x32')](_[_0xc666('0x3a')](_0x28d449[_0xc666('0x30')],_0x468090[_0xc666('0x32')]));if(_0x28d449[_0xc666('0x30')]['filter']){_0x4b72d5[_0xc666('0x39')]=_[_0xc666('0x46')](_0x4b72d5['where'],{'$or':_[_0xc666('0x2a')](_0x4b72d5[_0xc666('0x35')],function(_0x6d59a4){var _0xe33528={};_0xe33528[_0x6d59a4]={'$like':'%'+_0x28d449[_0xc666('0x30')][_0xc666('0x3b')]+'%'};return _0xe33528;})});}_0x4b72d5=_[_0xc666('0x46')]({},_0x4b72d5,_0x28d449[_0xc666('0x3d')]);return _0x33871b['getSubjects'](_0x4b72d5);}})['then'](function(_0x1c5f47){if(_0x1c5f47){_0x7acde2=_0x1c5f47['length'];if(!_0x28d449[_0xc666('0x30')]['hasOwnProperty'](_0xc666('0x4e'))){_0x4b72d5[_0xc666('0x1f')]=qs[_0xc666('0x1f')](_0x28d449['query']['limit']);_0x4b72d5[_0xc666('0x1d')]=qs[_0xc666('0x1d')](_0x28d449[_0xc666('0x30')][_0xc666('0x1d')]);}return _0x33871b[_0xc666('0x4f')](_0x4b72d5);}})[_0xc666('0x25')](function(_0x26814d){if(_0x26814d){return _0x26814d?{'count':_0x7acde2,'rows':_0x26814d}:null;}})[_0xc666('0x25')](respondWithResult(_0x253d35,null))['catch'](handleError(_0x253d35,null));};exports['getDescriptions']=function(_0x481683,_0x19b36b,_0x19e66a){var _0x1e5f76={};var _0x1b36cb={};var _0x260c4f;var _0x43b118;return db[_0xc666('0x3e')][_0xc666('0x4b')]({'where':{'id':_0x481683[_0xc666('0x44')]['id']}})[_0xc666('0x25')](handleEntityNotFound(_0x19b36b,null))[_0xc666('0x25')](function(_0x397d91){if(_0x397d91){_0x260c4f=_0x397d91;_0x1b36cb[_0xc666('0x2f')]=_['keys'](db['Dynamics365Field'][_0xc666('0x2b')]);_0x1b36cb[_0xc666('0x30')]=_['keys'](_0x481683[_0xc666('0x30')]);_0x1b36cb['filters']=_[_0xc666('0x33')](_0x1b36cb[_0xc666('0x2f')],_0x1b36cb['query']);_0x1e5f76[_0xc666('0x35')]=_[_0xc666('0x33')](_0x1b36cb[_0xc666('0x2f')],qs[_0xc666('0x34')](_0x481683[_0xc666('0x30')][_0xc666('0x34')]));_0x1e5f76[_0xc666('0x35')]=_0x1e5f76[_0xc666('0x35')][_0xc666('0x36')]?_0x1e5f76[_0xc666('0x35')]:_0x1b36cb[_0xc666('0x2f')];_0x1e5f76['order']=qs[_0xc666('0x38')](_0x481683[_0xc666('0x30')][_0xc666('0x38')]);_0x1e5f76[_0xc666('0x39')]=qs[_0xc666('0x32')](_[_0xc666('0x3a')](_0x481683['query'],_0x1b36cb['filters']));if(_0x481683[_0xc666('0x30')][_0xc666('0x3b')]){_0x1e5f76[_0xc666('0x39')]=_[_0xc666('0x46')](_0x1e5f76[_0xc666('0x39')],{'$or':_[_0xc666('0x2a')](_0x1e5f76['attributes'],function(_0x4b69ab){var _0x437649={};_0x437649[_0x4b69ab]={'$like':'%'+_0x481683[_0xc666('0x30')][_0xc666('0x3b')]+'%'};return _0x437649;})});}_0x1e5f76=_[_0xc666('0x46')]({},_0x1e5f76,_0x481683[_0xc666('0x3d')]);return _0x260c4f[_0xc666('0x50')](_0x1e5f76);}})['then'](function(_0x21cf1b){if(_0x21cf1b){_0x43b118=_0x21cf1b[_0xc666('0x36')];if(!_0x481683['query'][_0xc666('0x37')](_0xc666('0x4e'))){_0x1e5f76[_0xc666('0x1f')]=qs[_0xc666('0x1f')](_0x481683['query'][_0xc666('0x1f')]);_0x1e5f76[_0xc666('0x1d')]=qs[_0xc666('0x1d')](_0x481683[_0xc666('0x30')][_0xc666('0x1d')]);}return _0x260c4f[_0xc666('0x50')](_0x1e5f76);}})[_0xc666('0x25')](function(_0x5cc581){if(_0x5cc581){return _0x5cc581?{'count':_0x43b118,'rows':_0x5cc581}:null;}})['then'](respondWithResult(_0x19b36b,null))['catch'](handleError(_0x19b36b,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index c329b45..1272549 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 _0x9a19=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x9a19,0x114));var _0x99a1=function(_0x2aecb2,_0x343312){_0x2aecb2=_0x2aecb2-0x0;var _0x3ebb80=_0x9a19[_0x2aecb2];return _0x3ebb80;};'use strict';var _=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var logger=require(_0x99a1('0x2'))('api');var moment=require(_0x99a1('0x3'));var BPromise=require(_0x99a1('0x4'));var rp=require(_0x99a1('0x5'));var fs=require('fs');var path=require(_0x99a1('0x6'));var rimraf=require(_0x99a1('0x7'));var config=require(_0x99a1('0x8'));var attributes=require(_0x99a1('0x9'));module[_0x99a1('0xa')]=function(_0x3eff4a,_0xff0240){return _0x3eff4a[_0x99a1('0xb')]('Dynamics365Configuration',attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b84=['moment','path','rimraf','../../config/environment','Dynamics365Configuration','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b84,0x1cc));var _0x44b8=function(_0x1a8bbc,_0x17a086){_0x1a8bbc=_0x1a8bbc-0x0;var _0x212fc2=_0x4b84[_0x1a8bbc];return _0x212fc2;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x44b8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x44b8('0x3'));var rimraf=require(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var attributes=require('./intDynamics365Configuration.attributes');module['exports']=function(_0x55f25d,_0x996a8b){return _0x55f25d['define'](_0x44b8('0x6'),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 6c6fd44..b67ac6e 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 _0xea20=['lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x35377d,_0x40cf30){var _0x298de6=function(_0x1b6d4d){while(--_0x1b6d4d){_0x35377d['push'](_0x35377d['shift']());}};_0x298de6(++_0x40cf30);}(_0xea20,0xfc));var _0x0ea2=function(_0x39fe8c,_0x41f88d){_0x39fe8c=_0x39fe8c-0x0;var _0x8e432d=_0xea20[_0x39fe8c];return _0x8e432d;};'use strict';var _=require(_0x0ea2('0x0'));var util=require(_0x0ea2('0x1'));var moment=require(_0x0ea2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ea2('0x3'));var db=require(_0x0ea2('0x4'))['db'];var utils=require(_0x0ea2('0x5'));var logger=require(_0x0ea2('0x6'))(_0x0ea2('0x7'));var config=require(_0x0ea2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0ea2('0x9')][_0x0ea2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d6b5a,_0x2c4126,_0x4162eb){return new BPromise(function(_0x40ec40,_0x36c6e9){return client[_0x0ea2('0xb')](_0x4d6b5a,_0x4162eb)['then'](function(_0x5d50f0){logger[_0x0ea2('0xc')](_0x0ea2('0xd'),_0x2c4126,_0x0ea2('0xe'));logger['debug'](_0x0ea2('0xf'),_0x2c4126,_0x0ea2('0xe'),JSON['stringify'](_0x5d50f0));if(_0x5d50f0[_0x0ea2('0x10')]){if(_0x5d50f0[_0x0ea2('0x10')][_0x0ea2('0x11')]===0x1f4){logger[_0x0ea2('0x10')](_0x0ea2('0xd'),_0x2c4126,_0x5d50f0['error'][_0x0ea2('0x12')]);return _0x36c6e9(_0x5d50f0[_0x0ea2('0x10')][_0x0ea2('0x12')]);}logger[_0x0ea2('0x10')](_0x0ea2('0xd'),_0x2c4126,_0x5d50f0[_0x0ea2('0x10')][_0x0ea2('0x12')]);return _0x40ec40(_0x5d50f0[_0x0ea2('0x10')][_0x0ea2('0x12')]);}else{logger[_0x0ea2('0xc')](_0x0ea2('0xd'),_0x2c4126,_0x0ea2('0xe'));_0x40ec40(_0x5d50f0[_0x0ea2('0x13')][_0x0ea2('0x12')]);}})[_0x0ea2('0x14')](function(_0x33a268){logger['error'](_0x0ea2('0xd'),_0x2c4126,_0x33a268);_0x36c6e9(_0x33a268);});});} \ No newline at end of file +var _0x3ab6=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird'];(function(_0x491ec3,_0x213b90){var _0x221393=function(_0xb71bfa){while(--_0xb71bfa){_0x491ec3['push'](_0x491ec3['shift']());}};_0x221393(++_0x213b90);}(_0x3ab6,0xc4));var _0x63ab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ab6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x63ab('0x0'));var util=require(_0x63ab('0x1'));var moment=require(_0x63ab('0x2'));var BPromise=require(_0x63ab('0x3'));var rs=require(_0x63ab('0x4'));var fs=require('fs');var Redis=require(_0x63ab('0x5'));var db=require(_0x63ab('0x6'))['db'];var utils=require(_0x63ab('0x7'));var logger=require(_0x63ab('0x8'))(_0x63ab('0x9'));var config=require(_0x63ab('0xa'));var jayson=require(_0x63ab('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1553e8,_0x46f15d,_0x22e425){return new BPromise(function(_0xfef6cc,_0x30d050){return client[_0x63ab('0xc')](_0x1553e8,_0x22e425)[_0x63ab('0xd')](function(_0x2e7ec9){logger[_0x63ab('0xe')](_0x63ab('0xf'),_0x46f15d,'request\x20sent');logger[_0x63ab('0x10')](_0x63ab('0x11'),_0x46f15d,'request\x20sent',JSON[_0x63ab('0x12')](_0x2e7ec9));if(_0x2e7ec9[_0x63ab('0x13')]){if(_0x2e7ec9[_0x63ab('0x13')][_0x63ab('0x14')]===0x1f4){logger[_0x63ab('0x13')]('Dynamics365Configuration,\x20%s,\x20%s',_0x46f15d,_0x2e7ec9[_0x63ab('0x13')][_0x63ab('0x15')]);return _0x30d050(_0x2e7ec9['error'][_0x63ab('0x15')]);}logger[_0x63ab('0x13')]('Dynamics365Configuration,\x20%s,\x20%s',_0x46f15d,_0x2e7ec9[_0x63ab('0x13')][_0x63ab('0x15')]);return _0xfef6cc(_0x2e7ec9[_0x63ab('0x13')][_0x63ab('0x15')]);}else{logger[_0x63ab('0xe')]('Dynamics365Configuration,\x20%s,\x20%s',_0x46f15d,_0x63ab('0x16'));_0xfef6cc(_0x2e7ec9[_0x63ab('0x17')][_0x63ab('0x15')]);}})[_0x63ab('0x18')](function(_0x281ae4){logger['error'](_0x63ab('0xf'),_0x46f15d,_0x281ae4);_0x30d050(_0x281ae4);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index eac5111..7ad4236 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 _0x9c90=['update','destroy','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','post','create','put'];(function(_0x3fcb43,_0x1d3a5c){var _0x19e95a=function(_0x52c1f2){while(--_0x52c1f2){_0x3fcb43['push'](_0x3fcb43['shift']());}};_0x19e95a(++_0x1d3a5c);}(_0x9c90,0x1b4));var _0x09c9=function(_0x1b2422,_0x1e98d4){_0x1b2422=_0x1b2422-0x0;var _0x376573=_0x9c90[_0x1b2422];return _0x376573;};'use strict';var multer=require('multer');var util=require(_0x09c9('0x0'));var path=require(_0x09c9('0x1'));var timeout=require(_0x09c9('0x2'));var express=require(_0x09c9('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x09c9('0x4'));var config=require(_0x09c9('0x5'));var controller=require('./intDynamics365Field.controller');router[_0x09c9('0x6')]('/',auth[_0x09c9('0x7')](),controller['index']);router['get'](_0x09c9('0x8'),auth[_0x09c9('0x7')](),controller['show']);router[_0x09c9('0x9')]('/',auth[_0x09c9('0x7')](),controller[_0x09c9('0xa')]);router[_0x09c9('0xb')]('/:id',auth[_0x09c9('0x7')](),controller[_0x09c9('0xc')]);router['delete'](_0x09c9('0x8'),auth[_0x09c9('0x7')](),controller[_0x09c9('0xd')]);module['exports']=router; \ No newline at end of file +var _0x0e11=['../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x1de890,_0x23fd46){var _0x35832d=function(_0x2346db){while(--_0x2346db){_0x1de890['push'](_0x1de890['shift']());}};_0x35832d(++_0x23fd46);}(_0x0e11,0x18a));var _0x10e1=function(_0x494088,_0x3065fd){_0x494088=_0x494088-0x0;var _0x1538bb=_0x0e11[_0x494088];return _0x1538bb;};'use strict';var multer=require(_0x10e1('0x0'));var util=require(_0x10e1('0x1'));var path=require(_0x10e1('0x2'));var timeout=require(_0x10e1('0x3'));var express=require('express');var router=express[_0x10e1('0x4')]();var fs_extra=require(_0x10e1('0x5'));var auth=require(_0x10e1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x10e1('0x7'));var controller=require('./intDynamics365Field.controller');router[_0x10e1('0x8')]('/',auth[_0x10e1('0x9')](),controller[_0x10e1('0xa')]);router['get'](_0x10e1('0xb'),auth[_0x10e1('0x9')](),controller[_0x10e1('0xc')]);router[_0x10e1('0xd')]('/',auth['isAuthenticated'](),controller[_0x10e1('0xe')]);router[_0x10e1('0xf')](_0x10e1('0xb'),auth['isAuthenticated'](),controller[_0x10e1('0x10')]);router[_0x10e1('0x11')]('/:id',auth[_0x10e1('0x9')](),controller[_0x10e1('0x12')]);module[_0x10e1('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 5411602..1adff2f 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 _0x0c0f=['customVariable','picklist','STRING','variable','BOOLEAN','sequelize','exports','string'];(function(_0x280ded,_0x3b44f3){var _0x138b4f=function(_0x4c1e71){while(--_0x4c1e71){_0x280ded['push'](_0x280ded['shift']());}};_0x138b4f(++_0x3b44f3);}(_0x0c0f,0xd5));var _0xf0c0=function(_0x130281,_0x2c932e){_0x130281=_0x130281-0x0;var _0x2b3014=_0x0c0f[_0x130281];return _0x2b3014;};'use strict';var Sequelize=require(_0xf0c0('0x0'));module[_0xf0c0('0x1')]={'type':{'type':Sequelize['ENUM'](_0xf0c0('0x2'),'variable',_0xf0c0('0x3'),'keyValue',_0xf0c0('0x4')),'defaultValue':_0xf0c0('0x2')},'content':{'type':Sequelize[_0xf0c0('0x5')]},'key':{'type':Sequelize[_0xf0c0('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xf0c0('0x2'),_0xf0c0('0x6'),_0xf0c0('0x3'))},'keyContent':{'type':Sequelize[_0xf0c0('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xf0c0('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf0c0('0x5')]}}; \ No newline at end of file +var _0xe0a6=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x2579c8,_0xa1d210){var _0x16deec=function(_0x20cd0d){while(--_0x20cd0d){_0x2579c8['push'](_0x2579c8['shift']());}};_0x16deec(++_0xa1d210);}(_0xe0a6,0x130));var _0x6e0a=function(_0x53bbf5,_0x1526dc){_0x53bbf5=_0x53bbf5-0x0;var _0x389b8c=_0xe0a6[_0x53bbf5];return _0x389b8c;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x6e0a('0x0')](_0x6e0a('0x1'),_0x6e0a('0x2'),_0x6e0a('0x3'),_0x6e0a('0x4'),_0x6e0a('0x5')),'defaultValue':_0x6e0a('0x1')},'content':{'type':Sequelize[_0x6e0a('0x6')]},'key':{'type':Sequelize[_0x6e0a('0x6')]},'keyType':{'type':Sequelize[_0x6e0a('0x0')]('string',_0x6e0a('0x2'),_0x6e0a('0x3'))},'keyContent':{'type':Sequelize[_0x6e0a('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x6e0a('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6e0a('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 5efd140..ef37983 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 _0x7c6b=['include','rows','show','length','includeAll','find','catch','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','filters','pick','filter','merge','where','options'];(function(_0x48025f,_0x1bbb2a){var _0x593ade=function(_0x784e87){while(--_0x784e87){_0x48025f['push'](_0x48025f['shift']());}};_0x593ade(++_0x1bbb2a);}(_0x7c6b,0x1c1));var _0xb7c6=function(_0x212a37,_0xf35b2e){_0x212a37=_0x212a37-0x0;var _0x5d0bf9=_0x7c6b[_0x212a37];return _0x5d0bf9;};'use strict';var emlformat=require(_0xb7c6('0x0'));var rimraf=require(_0xb7c6('0x1'));var zipdir=require(_0xb7c6('0x2'));var jsonpatch=require(_0xb7c6('0x3'));var rp=require(_0xb7c6('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb7c6('0x5'));var path=require(_0xb7c6('0x6'));var sox=require('sox');var csv=require(_0xb7c6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb7c6('0x8'));var _=require(_0xb7c6('0x9'));var squel=require(_0xb7c6('0xa'));var crypto=require(_0xb7c6('0xb'));var jsforce=require(_0xb7c6('0xc'));var deskjs=require(_0xb7c6('0xd'));var toCsv=require(_0xb7c6('0x7'));var querystring=require(_0xb7c6('0xe'));var Papa=require(_0xb7c6('0xf'));var Redis=require(_0xb7c6('0x10'));var authService=require(_0xb7c6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb7c6('0x12'));var hardwareService=require(_0xb7c6('0x13'));var logger=require('../../config/logger')(_0xb7c6('0x14'));var utils=require(_0xb7c6('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb7c6('0x16'))['db'];function respondWithStatusCode(_0x1a9d76,_0x2103c6){_0x2103c6=_0x2103c6||0xcc;return function(_0x13df63){if(_0x13df63){return _0x1a9d76['sendStatus'](_0x2103c6);}return _0x1a9d76[_0xb7c6('0x17')](_0x2103c6)['end']();};}function respondWithResult(_0x5683df,_0x4aae6c){_0x4aae6c=_0x4aae6c||0xc8;return function(_0x359fa8){if(_0x359fa8){return _0x5683df[_0xb7c6('0x17')](_0x4aae6c)[_0xb7c6('0x18')](_0x359fa8);}};}function respondWithFilteredResult(_0x5aa2b6,_0x2068c5){return function(_0x21a6d6){if(_0x21a6d6){var _0xb0d784=typeof _0x2068c5[_0xb7c6('0x19')]===_0xb7c6('0x1a')&&typeof _0x2068c5[_0xb7c6('0x1b')]===_0xb7c6('0x1a');var _0x5b4856=_0x21a6d6[_0xb7c6('0x1c')];var _0x2af665=_0xb0d784?0x0:_0x2068c5[_0xb7c6('0x19')];var _0x1ea8a7=_0xb0d784?_0x21a6d6[_0xb7c6('0x1c')]:_0x2068c5[_0xb7c6('0x19')]+_0x2068c5[_0xb7c6('0x1b')];var _0x277365;if(_0x1ea8a7>=_0x5b4856){_0x1ea8a7=_0x5b4856;_0x277365=0xc8;}else{_0x277365=0xce;}_0x5aa2b6[_0xb7c6('0x17')](_0x277365);return _0x5aa2b6[_0xb7c6('0x1d')](_0xb7c6('0x1e'),_0x2af665+'-'+_0x1ea8a7+'/'+_0x5b4856)[_0xb7c6('0x18')](_0x21a6d6);}return null;};}function patchUpdates(_0x136f23){return function(_0x2568bd){try{jsonpatch[_0xb7c6('0x1f')](_0x2568bd,_0x136f23,!![]);}catch(_0x7f4da7){return BPromise[_0xb7c6('0x20')](_0x7f4da7);}return _0x2568bd[_0xb7c6('0x21')]();};}function saveUpdates(_0x20ad5f,_0x2c33fb){return function(_0x5afd10){if(_0x5afd10){return _0x5afd10[_0xb7c6('0x22')](_0x20ad5f)[_0xb7c6('0x23')](function(_0x4a12b2){return _0x4a12b2;});}return null;};}function removeEntity(_0x11e3fc,_0x1a0ee3){return function(_0x5665af){if(_0x5665af){return _0x5665af['destroy']()[_0xb7c6('0x23')](function(){_0x11e3fc[_0xb7c6('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18028f,_0x4dc863){return function(_0x9de53){if(!_0x9de53){_0x18028f[_0xb7c6('0x24')](0x194);}return _0x9de53;};}function handleError(_0x57a7f1,_0x28375a){_0x28375a=_0x28375a||0x1f4;return function(_0x28500d){logger['error'](_0x28500d[_0xb7c6('0x25')]);if(_0x28500d[_0xb7c6('0x26')]){delete _0x28500d[_0xb7c6('0x26')];}_0x57a7f1['status'](_0x28375a)[_0xb7c6('0x27')](_0x28500d);};}exports[_0xb7c6('0x28')]=function(_0xde58ac,_0x12e9af){var _0x30cb2f={},_0x41940c={},_0x5c0955={'count':0x0,'rows':[]};var _0x25688f=_[_0xb7c6('0x29')](db[_0xb7c6('0x2a')][_0xb7c6('0x2b')],function(_0x36774e){return{'name':_0x36774e[_0xb7c6('0x2c')],'type':_0x36774e[_0xb7c6('0x2d')][_0xb7c6('0x2e')]};});_0x41940c[_0xb7c6('0x2f')]=_['map'](_0x25688f,_0xb7c6('0x26'));_0x41940c[_0xb7c6('0x30')]=_[_0xb7c6('0x31')](_0xde58ac['query']);_0x41940c['filters']=_[_0xb7c6('0x32')](_0x41940c['model'],_0x41940c[_0xb7c6('0x30')]);_0x30cb2f[_0xb7c6('0x33')]=_[_0xb7c6('0x32')](_0x41940c['model'],qs[_0xb7c6('0x34')](_0xde58ac[_0xb7c6('0x30')][_0xb7c6('0x34')]));_0x30cb2f[_0xb7c6('0x33')]=_0x30cb2f['attributes']['length']?_0x30cb2f['attributes']:_0x41940c['model'];if(!_0xde58ac[_0xb7c6('0x30')]['hasOwnProperty'](_0xb7c6('0x35'))){_0x30cb2f['limit']=qs['limit'](_0xde58ac[_0xb7c6('0x30')][_0xb7c6('0x1b')]);_0x30cb2f[_0xb7c6('0x19')]=qs[_0xb7c6('0x19')](_0xde58ac[_0xb7c6('0x30')]['offset']);}_0x30cb2f[_0xb7c6('0x36')]=qs['sort'](_0xde58ac[_0xb7c6('0x30')][_0xb7c6('0x37')]);_0x30cb2f['where']=qs[_0xb7c6('0x38')](_[_0xb7c6('0x39')](_0xde58ac[_0xb7c6('0x30')],_0x41940c[_0xb7c6('0x38')]),_0x25688f);if(_0xde58ac['query'][_0xb7c6('0x3a')]){_0x30cb2f['where']=_[_0xb7c6('0x3b')](_0x30cb2f[_0xb7c6('0x3c')],{'$or':_[_0xb7c6('0x29')](_0x25688f,function(_0x146b1f){if(_0x146b1f[_0xb7c6('0x2d')]!=='VIRTUAL'){var _0x1774f5={};_0x1774f5[_0x146b1f['name']]={'$like':'%'+_0xde58ac[_0xb7c6('0x30')]['filter']+'%'};return _0x1774f5;}})});}_0x30cb2f=_['merge']({},_0x30cb2f,_0xde58ac[_0xb7c6('0x3d')]);var _0x464499={'where':_0x30cb2f[_0xb7c6('0x3c')]};return db[_0xb7c6('0x2a')][_0xb7c6('0x1c')](_0x464499)[_0xb7c6('0x23')](function(_0x2222f2){_0x5c0955[_0xb7c6('0x1c')]=_0x2222f2;if(_0xde58ac[_0xb7c6('0x30')]['includeAll']){_0x30cb2f[_0xb7c6('0x3e')]=[{'all':!![]}];}return db[_0xb7c6('0x2a')]['findAll'](_0x30cb2f);})['then'](function(_0x135b96){_0x5c0955[_0xb7c6('0x3f')]=_0x135b96;return _0x5c0955;})['then'](respondWithFilteredResult(_0x12e9af,_0x30cb2f))['catch'](handleError(_0x12e9af,null));};exports[_0xb7c6('0x40')]=function(_0x405f0a,_0x44fe99){var _0x5e96fc={'raw':!![],'where':{'id':_0x405f0a['params']['id']}},_0x4c8e73={};_0x4c8e73[_0xb7c6('0x2f')]=_[_0xb7c6('0x31')](db[_0xb7c6('0x2a')]['rawAttributes']);_0x4c8e73['query']=_[_0xb7c6('0x31')](_0x405f0a[_0xb7c6('0x30')]);_0x4c8e73[_0xb7c6('0x38')]=_[_0xb7c6('0x32')](_0x4c8e73['model'],_0x4c8e73[_0xb7c6('0x30')]);_0x5e96fc['attributes']=_['intersection'](_0x4c8e73[_0xb7c6('0x2f')],qs['fields'](_0x405f0a[_0xb7c6('0x30')]['fields']));_0x5e96fc[_0xb7c6('0x33')]=_0x5e96fc[_0xb7c6('0x33')][_0xb7c6('0x41')]?_0x5e96fc[_0xb7c6('0x33')]:_0x4c8e73['model'];if(_0x405f0a[_0xb7c6('0x30')][_0xb7c6('0x42')]){_0x5e96fc[_0xb7c6('0x3e')]=[{'all':!![]}];}_0x5e96fc=_[_0xb7c6('0x3b')]({},_0x5e96fc,_0x405f0a['options']);return db[_0xb7c6('0x2a')][_0xb7c6('0x43')](_0x5e96fc)[_0xb7c6('0x23')](handleEntityNotFound(_0x44fe99,null))[_0xb7c6('0x23')](respondWithResult(_0x44fe99,null))[_0xb7c6('0x44')](handleError(_0x44fe99,null));};exports[_0xb7c6('0x45')]=function(_0x5ab74,_0x1f55b1){return db[_0xb7c6('0x2a')]['create'](_0x5ab74[_0xb7c6('0x46')],{})['then'](respondWithResult(_0x1f55b1,0xc9))[_0xb7c6('0x44')](handleError(_0x1f55b1,null));};exports[_0xb7c6('0x22')]=function(_0x598ff3,_0x55ff78){if(_0x598ff3['body']['id']){delete _0x598ff3[_0xb7c6('0x46')]['id'];}return db[_0xb7c6('0x2a')][_0xb7c6('0x43')]({'where':{'id':_0x598ff3[_0xb7c6('0x47')]['id']}})['then'](handleEntityNotFound(_0x55ff78,null))['then'](saveUpdates(_0x598ff3[_0xb7c6('0x46')],null))[_0xb7c6('0x23')](respondWithResult(_0x55ff78,null))['catch'](handleError(_0x55ff78,null));};exports[_0xb7c6('0x48')]=function(_0x157fa3,_0x285492){return db['Dynamics365Field'][_0xb7c6('0x43')]({'where':{'id':_0x157fa3['params']['id']}})[_0xb7c6('0x23')](handleEntityNotFound(_0x285492,null))[_0xb7c6('0x23')](removeEntity(_0x285492,null))[_0xb7c6('0x44')](handleError(_0x285492,null));}; \ No newline at end of file +var _0xbd87=['destroy','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','offset','undefined','limit','set','Content-Range','reject','save','update','then','end','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','merge','VIRTUAL','count','include','findAll','rows','show','includeAll','options','find','catch','create','body'];(function(_0xc9c9ef,_0x34f550){var _0x3fcea8=function(_0x4d427f){while(--_0x4d427f){_0xc9c9ef['push'](_0xc9c9ef['shift']());}};_0x3fcea8(++_0x34f550);}(_0xbd87,0x11a));var _0x7bd8=function(_0x12315f,_0x4f8d2e){_0x12315f=_0x12315f-0x0;var _0x44eb16=_0xbd87[_0x12315f];return _0x44eb16;};'use strict';var emlformat=require(_0x7bd8('0x0'));var rimraf=require(_0x7bd8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7bd8('0x2'));var rp=require(_0x7bd8('0x3'));var moment=require(_0x7bd8('0x4'));var BPromise=require(_0x7bd8('0x5'));var Mustache=require('mustache');var util=require(_0x7bd8('0x6'));var path=require('path');var sox=require(_0x7bd8('0x7'));var csv=require(_0x7bd8('0x8'));var ejs=require(_0x7bd8('0x9'));var fs=require('fs');var fs_extra=require(_0x7bd8('0xa'));var _=require(_0x7bd8('0xb'));var squel=require(_0x7bd8('0xc'));var crypto=require('crypto');var jsforce=require(_0x7bd8('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bd8('0xe'));var Redis=require(_0x7bd8('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7bd8('0x10'));var as=require(_0x7bd8('0x11'));var hardwareService=require(_0x7bd8('0x12'));var logger=require(_0x7bd8('0x13'))('api');var utils=require(_0x7bd8('0x14'));var config=require(_0x7bd8('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7bd8('0x16'))['db'];function respondWithStatusCode(_0x3cb960,_0x3afe00){_0x3afe00=_0x3afe00||0xcc;return function(_0x3e9727){if(_0x3e9727){return _0x3cb960['sendStatus'](_0x3afe00);}return _0x3cb960['status'](_0x3afe00)['end']();};}function respondWithResult(_0x4592b8,_0x317a99){_0x317a99=_0x317a99||0xc8;return function(_0x14326f){if(_0x14326f){return _0x4592b8[_0x7bd8('0x17')](_0x317a99)['json'](_0x14326f);}};}function respondWithFilteredResult(_0x45b09d,_0x1ac1a2){return function(_0x453c4a){if(_0x453c4a){var _0x525f9f=typeof _0x1ac1a2[_0x7bd8('0x18')]===_0x7bd8('0x19')&&typeof _0x1ac1a2[_0x7bd8('0x1a')]===_0x7bd8('0x19');var _0x333869=_0x453c4a['count'];var _0x559990=_0x525f9f?0x0:_0x1ac1a2[_0x7bd8('0x18')];var _0x3c73e0=_0x525f9f?_0x453c4a['count']:_0x1ac1a2[_0x7bd8('0x18')]+_0x1ac1a2[_0x7bd8('0x1a')];var _0x5eb87a;if(_0x3c73e0>=_0x333869){_0x3c73e0=_0x333869;_0x5eb87a=0xc8;}else{_0x5eb87a=0xce;}_0x45b09d[_0x7bd8('0x17')](_0x5eb87a);return _0x45b09d[_0x7bd8('0x1b')](_0x7bd8('0x1c'),_0x559990+'-'+_0x3c73e0+'/'+_0x333869)['json'](_0x453c4a);}return null;};}function patchUpdates(_0x2e2926){return function(_0x548211){try{jsonpatch['apply'](_0x548211,_0x2e2926,!![]);}catch(_0x1176df){return BPromise[_0x7bd8('0x1d')](_0x1176df);}return _0x548211[_0x7bd8('0x1e')]();};}function saveUpdates(_0xbe8924,_0x485988){return function(_0x97424a){if(_0x97424a){return _0x97424a[_0x7bd8('0x1f')](_0xbe8924)[_0x7bd8('0x20')](function(_0x2a96e0){return _0x2a96e0;});}return null;};}function removeEntity(_0xedec20,_0x4e6210){return function(_0x853398){if(_0x853398){return _0x853398['destroy']()[_0x7bd8('0x20')](function(){_0xedec20[_0x7bd8('0x17')](0xcc)[_0x7bd8('0x21')]();});}};}function handleEntityNotFound(_0x5ef4ac,_0x3464fc){return function(_0x367012){if(!_0x367012){_0x5ef4ac['sendStatus'](0x194);}return _0x367012;};}function handleError(_0x1a9978,_0x15e6c8){_0x15e6c8=_0x15e6c8||0x1f4;return function(_0x32f824){logger['error'](_0x32f824['stack']);if(_0x32f824[_0x7bd8('0x22')]){delete _0x32f824[_0x7bd8('0x22')];}_0x1a9978['status'](_0x15e6c8)[_0x7bd8('0x23')](_0x32f824);};}exports[_0x7bd8('0x24')]=function(_0x44e46c,_0x775ccb){var _0x4a3213={},_0x883939={},_0x271c0f={'count':0x0,'rows':[]};var _0x4b99fd=_[_0x7bd8('0x25')](db[_0x7bd8('0x26')][_0x7bd8('0x27')],function(_0x40420d){return{'name':_0x40420d[_0x7bd8('0x28')],'type':_0x40420d[_0x7bd8('0x29')][_0x7bd8('0x2a')]};});_0x883939[_0x7bd8('0x2b')]=_[_0x7bd8('0x25')](_0x4b99fd,_0x7bd8('0x22'));_0x883939[_0x7bd8('0x2c')]=_[_0x7bd8('0x2d')](_0x44e46c[_0x7bd8('0x2c')]);_0x883939['filters']=_[_0x7bd8('0x2e')](_0x883939[_0x7bd8('0x2b')],_0x883939['query']);_0x4a3213[_0x7bd8('0x2f')]=_['intersection'](_0x883939[_0x7bd8('0x2b')],qs[_0x7bd8('0x30')](_0x44e46c[_0x7bd8('0x2c')][_0x7bd8('0x30')]));_0x4a3213[_0x7bd8('0x2f')]=_0x4a3213[_0x7bd8('0x2f')][_0x7bd8('0x31')]?_0x4a3213[_0x7bd8('0x2f')]:_0x883939[_0x7bd8('0x2b')];if(!_0x44e46c[_0x7bd8('0x2c')]['hasOwnProperty'](_0x7bd8('0x32'))){_0x4a3213[_0x7bd8('0x1a')]=qs[_0x7bd8('0x1a')](_0x44e46c[_0x7bd8('0x2c')][_0x7bd8('0x1a')]);_0x4a3213[_0x7bd8('0x18')]=qs[_0x7bd8('0x18')](_0x44e46c[_0x7bd8('0x2c')]['offset']);}_0x4a3213['order']=qs['sort'](_0x44e46c['query'][_0x7bd8('0x33')]);_0x4a3213[_0x7bd8('0x34')]=qs[_0x7bd8('0x35')](_[_0x7bd8('0x36')](_0x44e46c['query'],_0x883939[_0x7bd8('0x35')]),_0x4b99fd);if(_0x44e46c[_0x7bd8('0x2c')]['filter']){_0x4a3213[_0x7bd8('0x34')]=_[_0x7bd8('0x37')](_0x4a3213[_0x7bd8('0x34')],{'$or':_[_0x7bd8('0x25')](_0x4b99fd,function(_0x8ed4c5){if(_0x8ed4c5[_0x7bd8('0x29')]!==_0x7bd8('0x38')){var _0x372132={};_0x372132[_0x8ed4c5[_0x7bd8('0x22')]]={'$like':'%'+_0x44e46c['query']['filter']+'%'};return _0x372132;}})});}_0x4a3213=_[_0x7bd8('0x37')]({},_0x4a3213,_0x44e46c['options']);var _0x5e3d6d={'where':_0x4a3213[_0x7bd8('0x34')]};return db[_0x7bd8('0x26')]['count'](_0x5e3d6d)[_0x7bd8('0x20')](function(_0x1d04d9){_0x271c0f[_0x7bd8('0x39')]=_0x1d04d9;if(_0x44e46c['query']['includeAll']){_0x4a3213[_0x7bd8('0x3a')]=[{'all':!![]}];}return db[_0x7bd8('0x26')][_0x7bd8('0x3b')](_0x4a3213);})[_0x7bd8('0x20')](function(_0x56da9f){_0x271c0f[_0x7bd8('0x3c')]=_0x56da9f;return _0x271c0f;})[_0x7bd8('0x20')](respondWithFilteredResult(_0x775ccb,_0x4a3213))['catch'](handleError(_0x775ccb,null));};exports[_0x7bd8('0x3d')]=function(_0x31d61b,_0xcb1533){var _0x1a6a7d={'raw':!![],'where':{'id':_0x31d61b['params']['id']}},_0x1d8b6f={};_0x1d8b6f[_0x7bd8('0x2b')]=_[_0x7bd8('0x2d')](db[_0x7bd8('0x26')][_0x7bd8('0x27')]);_0x1d8b6f[_0x7bd8('0x2c')]=_[_0x7bd8('0x2d')](_0x31d61b[_0x7bd8('0x2c')]);_0x1d8b6f['filters']=_[_0x7bd8('0x2e')](_0x1d8b6f['model'],_0x1d8b6f[_0x7bd8('0x2c')]);_0x1a6a7d['attributes']=_[_0x7bd8('0x2e')](_0x1d8b6f[_0x7bd8('0x2b')],qs[_0x7bd8('0x30')](_0x31d61b[_0x7bd8('0x2c')]['fields']));_0x1a6a7d['attributes']=_0x1a6a7d[_0x7bd8('0x2f')][_0x7bd8('0x31')]?_0x1a6a7d[_0x7bd8('0x2f')]:_0x1d8b6f['model'];if(_0x31d61b['query'][_0x7bd8('0x3e')]){_0x1a6a7d[_0x7bd8('0x3a')]=[{'all':!![]}];}_0x1a6a7d=_[_0x7bd8('0x37')]({},_0x1a6a7d,_0x31d61b[_0x7bd8('0x3f')]);return db[_0x7bd8('0x26')][_0x7bd8('0x40')](_0x1a6a7d)['then'](handleEntityNotFound(_0xcb1533,null))[_0x7bd8('0x20')](respondWithResult(_0xcb1533,null))[_0x7bd8('0x41')](handleError(_0xcb1533,null));};exports[_0x7bd8('0x42')]=function(_0x22d5a2,_0x3d942f){return db[_0x7bd8('0x26')]['create'](_0x22d5a2[_0x7bd8('0x43')],{})[_0x7bd8('0x20')](respondWithResult(_0x3d942f,0xc9))['catch'](handleError(_0x3d942f,null));};exports['update']=function(_0x627ee4,_0x590e88){if(_0x627ee4[_0x7bd8('0x43')]['id']){delete _0x627ee4[_0x7bd8('0x43')]['id'];}return db[_0x7bd8('0x26')][_0x7bd8('0x40')]({'where':{'id':_0x627ee4['params']['id']}})[_0x7bd8('0x20')](handleEntityNotFound(_0x590e88,null))['then'](saveUpdates(_0x627ee4['body'],null))[_0x7bd8('0x20')](respondWithResult(_0x590e88,null))[_0x7bd8('0x41')](handleError(_0x590e88,null));};exports[_0x7bd8('0x44')]=function(_0x48c6f2,_0x4ce446){return db[_0x7bd8('0x26')][_0x7bd8('0x40')]({'where':{'id':_0x48c6f2[_0x7bd8('0x45')]['id']}})[_0x7bd8('0x20')](handleEntityNotFound(_0x4ce446,null))[_0x7bd8('0x20')](removeEntity(_0x4ce446,null))['catch'](handleError(_0x4ce446,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 27c88ba..affd2f0 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 _0x8f44=['dynamics365_unique_index','FieldId','lodash','util','../../config/logger','api','moment','define','int_dynamics365_fields'];(function(_0x4e48f4,_0x4f2833){var _0x218ad3=function(_0x5c7013){while(--_0x5c7013){_0x4e48f4['push'](_0x4e48f4['shift']());}};_0x218ad3(++_0x4f2833);}(_0x8f44,0x18e));var _0x48f4=function(_0x43096f,_0x4f19fe){_0x43096f=_0x43096f-0x0;var _0x4e3bdd=_0x8f44[_0x43096f];return _0x4e3bdd;};'use strict';var _=require(_0x48f4('0x0'));var util=require(_0x48f4('0x1'));var logger=require(_0x48f4('0x2'))(_0x48f4('0x3'));var moment=require(_0x48f4('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intDynamics365Field.attributes');module['exports']=function(_0x56995b,_0x4889cc){return _0x56995b[_0x48f4('0x5')]('Dynamics365Field',attributes,{'tableName':_0x48f4('0x6'),'paranoid':![],'indexes':[{'name':_0x48f4('0x7'),'fields':['idField',_0x48f4('0x8')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa124=['request-promise','path','rimraf','../../config/environment','exports','define','idField','FieldId','lodash','util','api','moment','bluebird'];(function(_0x28f9ac,_0x207060){var _0x2ab321=function(_0x10ed84){while(--_0x10ed84){_0x28f9ac['push'](_0x28f9ac['shift']());}};_0x2ab321(++_0x207060);}(_0xa124,0x167));var _0x4a12=function(_0x35ef6b,_0x202c42){_0x35ef6b=_0x35ef6b-0x0;var _0x3ad145=_0xa124[_0x35ef6b];return _0x3ad145;};'use strict';var _=require(_0x4a12('0x0'));var util=require(_0x4a12('0x1'));var logger=require('../../config/logger')(_0x4a12('0x2'));var moment=require(_0x4a12('0x3'));var BPromise=require(_0x4a12('0x4'));var rp=require(_0x4a12('0x5'));var fs=require('fs');var path=require(_0x4a12('0x6'));var rimraf=require(_0x4a12('0x7'));var config=require(_0x4a12('0x8'));var attributes=require('./intDynamics365Field.attributes');module[_0x4a12('0x9')]=function(_0x2607d7,_0x3335de){return _0x2607d7[_0x4a12('0xa')]('Dynamics365Field',attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x4a12('0xb'),_0x4a12('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 6180365..7e933eb 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 _0x5207=['debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent'];(function(_0x329a15,_0x4723b6){var _0x53496b=function(_0x1e3e0b){while(--_0x1e3e0b){_0x329a15['push'](_0x329a15['shift']());}};_0x53496b(++_0x4723b6);}(_0x5207,0x1a0));var _0x7520=function(_0x1ccb65,_0x3d0dff){_0x1ccb65=_0x1ccb65-0x0;var _0x51ec77=_0x5207[_0x1ccb65];return _0x51ec77;};'use strict';var _=require(_0x7520('0x0'));var util=require(_0x7520('0x1'));var moment=require(_0x7520('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7520('0x3'));var db=require(_0x7520('0x4'))['db'];var utils=require(_0x7520('0x5'));var logger=require(_0x7520('0x6'))(_0x7520('0x7'));var config=require(_0x7520('0x8'));var jayson=require(_0x7520('0x9'));var client=jayson['client'][_0x7520('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7a631,_0x4a6d03,_0x73e860){return new BPromise(function(_0x390779,_0x3e116c){return client[_0x7520('0xb')](_0x7a631,_0x73e860)[_0x7520('0xc')](function(_0x50aad5){logger[_0x7520('0xd')](_0x7520('0xe'),_0x4a6d03,_0x7520('0xf'));logger[_0x7520('0x10')](_0x7520('0x11'),_0x4a6d03,'request\x20sent',JSON[_0x7520('0x12')](_0x50aad5));if(_0x50aad5['error']){if(_0x50aad5[_0x7520('0x13')][_0x7520('0x14')]===0x1f4){logger[_0x7520('0x13')](_0x7520('0xe'),_0x4a6d03,_0x50aad5[_0x7520('0x13')][_0x7520('0x15')]);return _0x3e116c(_0x50aad5[_0x7520('0x13')]['message']);}logger[_0x7520('0x13')]('Dynamics365Field,\x20%s,\x20%s',_0x4a6d03,_0x50aad5[_0x7520('0x13')][_0x7520('0x15')]);return _0x390779(_0x50aad5[_0x7520('0x13')][_0x7520('0x15')]);}else{logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x4a6d03,_0x7520('0xf'));_0x390779(_0x50aad5[_0x7520('0x16')][_0x7520('0x15')]);}})[_0x7520('0x17')](function(_0x546de8){logger[_0x7520('0x13')](_0x7520('0xe'),_0x4a6d03,_0x546de8);_0x3e116c(_0x546de8);});});} \ No newline at end of file +var _0x2490=['error','code','Dynamics365Field,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xacc540,_0x49b661){var _0x1edb63=function(_0x2dab3e){while(--_0x2dab3e){_0xacc540['push'](_0xacc540['shift']());}};_0x1edb63(++_0x49b661);}(_0x2490,0x147));var _0x0249=function(_0x13a741,_0xa18893){_0x13a741=_0x13a741-0x0;var _0x2c3e40=_0x2490[_0x13a741];return _0x2c3e40;};'use strict';var _=require('lodash');var util=require(_0x0249('0x0'));var moment=require(_0x0249('0x1'));var BPromise=require(_0x0249('0x2'));var rs=require(_0x0249('0x3'));var fs=require('fs');var Redis=require(_0x0249('0x4'));var db=require(_0x0249('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0249('0x6'))(_0x0249('0x7'));var config=require(_0x0249('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0249('0x9')][_0x0249('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc9e9c1,_0x5a2cfc,_0x42f05a){return new BPromise(function(_0x4f8500,_0x23ae64){return client[_0x0249('0xb')](_0xc9e9c1,_0x42f05a)[_0x0249('0xc')](function(_0x439d0c){logger[_0x0249('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x5a2cfc,_0x0249('0xe'));logger[_0x0249('0xf')](_0x0249('0x10'),_0x5a2cfc,_0x0249('0xe'),JSON[_0x0249('0x11')](_0x439d0c));if(_0x439d0c[_0x0249('0x12')]){if(_0x439d0c[_0x0249('0x12')][_0x0249('0x13')]===0x1f4){logger['error'](_0x0249('0x14'),_0x5a2cfc,_0x439d0c[_0x0249('0x12')][_0x0249('0x15')]);return _0x23ae64(_0x439d0c[_0x0249('0x12')]['message']);}logger[_0x0249('0x12')](_0x0249('0x14'),_0x5a2cfc,_0x439d0c['error'][_0x0249('0x15')]);return _0x4f8500(_0x439d0c[_0x0249('0x12')][_0x0249('0x15')]);}else{logger['info'](_0x0249('0x14'),_0x5a2cfc,_0x0249('0xe'));_0x4f8500(_0x439d0c['result'][_0x0249('0x15')]);}})[_0x0249('0x16')](function(_0x16ca8f){logger['error'](_0x0249('0x14'),_0x5a2cfc,_0x16ca8f);_0x23ae64(_0x16ca8f);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 88be4b6..379bef2 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 _0xa7f3=['./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment'];(function(_0xd39959,_0x302d09){var _0x1ff69c=function(_0x17c97f){while(--_0x17c97f){_0xd39959['push'](_0xd39959['shift']());}};_0x1ff69c(++_0x302d09);}(_0xa7f3,0x9a));var _0x3a7f=function(_0x33af5e,_0x4656d6){_0x33af5e=_0x33af5e-0x0;var _0x5722a3=_0xa7f3[_0x33af5e];return _0x5722a3;};'use strict';var multer=require(_0x3a7f('0x0'));var util=require(_0x3a7f('0x1'));var path=require(_0x3a7f('0x2'));var timeout=require(_0x3a7f('0x3'));var express=require('express');var router=express[_0x3a7f('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3a7f('0x5'));var config=require(_0x3a7f('0x6'));var controller=require(_0x3a7f('0x7'));router[_0x3a7f('0x8')]('/',auth[_0x3a7f('0x9')](),controller[_0x3a7f('0xa')]);router[_0x3a7f('0x8')](_0x3a7f('0xb'),auth[_0x3a7f('0x9')](),controller[_0x3a7f('0xc')]);router['get'](_0x3a7f('0xd'),auth[_0x3a7f('0x9')](),controller[_0x3a7f('0xe')]);router[_0x3a7f('0x8')](_0x3a7f('0xf'),auth[_0x3a7f('0x9')](),controller[_0x3a7f('0x10')]);router[_0x3a7f('0x11')]('/',auth[_0x3a7f('0x9')](),controller['create']);router['post'](_0x3a7f('0xd'),auth['isAuthenticated'](),controller[_0x3a7f('0x12')]);router[_0x3a7f('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x3a7f('0x14')]);router['delete'](_0x3a7f('0xb'),auth[_0x3a7f('0x9')](),controller[_0x3a7f('0x15')]);module[_0x3a7f('0x16')]=router; \ No newline at end of file +var _0xc485=['util','path','express','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','/:id/fields','post','addConfiguration','put','/:id','update','destroy','exports','multer'];(function(_0x4fdc26,_0x5765b4){var _0x3df58f=function(_0x284cd0){while(--_0x284cd0){_0x4fdc26['push'](_0x4fdc26['shift']());}};_0x3df58f(++_0x5765b4);}(_0xc485,0x8b));var _0x5c48=function(_0x4cdcdc,_0x34eac7){_0x4cdcdc=_0x4cdcdc-0x0;var _0x4704ce=_0xc485[_0x4cdcdc];return _0x4704ce;};'use strict';var multer=require(_0x5c48('0x0'));var util=require(_0x5c48('0x1'));var path=require(_0x5c48('0x2'));var timeout=require('connect-timeout');var express=require(_0x5c48('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5c48('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5c48('0x5'));var controller=require(_0x5c48('0x6'));router[_0x5c48('0x7')]('/',auth[_0x5c48('0x8')](),controller[_0x5c48('0x9')]);router[_0x5c48('0x7')]('/:id',auth[_0x5c48('0x8')](),controller[_0x5c48('0xa')]);router[_0x5c48('0x7')](_0x5c48('0xb'),auth[_0x5c48('0x8')](),controller['getConfigurations']);router[_0x5c48('0x7')](_0x5c48('0xc'),auth[_0x5c48('0x8')](),controller['getFields']);router['post']('/',auth[_0x5c48('0x8')](),controller['create']);router[_0x5c48('0xd')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x5c48('0xe')]);router[_0x5c48('0xf')](_0x5c48('0x10'),auth[_0x5c48('0x8')](),controller[_0x5c48('0x11')]);router['delete'](_0x5c48('0x10'),auth[_0x5c48('0x8')](),controller[_0x5c48('0x12')]);module[_0x5c48('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 092af6e..d52b1c1 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 _0x0adf=['remoteUri','sequelize','exports','STRING','username'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x5d8035,_0x54667d){_0x5d8035=_0x5d8035-0x0;var _0xe21b2d=_0x0adf[_0x5d8035];return _0xe21b2d;};'use strict';var Sequelize=require(_0xf0ad('0x0'));module[_0xf0ad('0x1')]={'name':{'type':Sequelize[_0xf0ad('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf0ad('0x2')],'unique':_0xf0ad('0x3')},'apiKey':{'type':Sequelize[_0xf0ad('0x2')]},'remoteUri':{'type':Sequelize[_0xf0ad('0x2')],'unique':_0xf0ad('0x4')},'serverUrl':{'type':Sequelize[_0xf0ad('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x4991=['STRING','username','remoteUri','sequelize'];(function(_0x38a3d3,_0x4d5040){var _0x2960dc=function(_0xb12181){while(--_0xb12181){_0x38a3d3['push'](_0x38a3d3['shift']());}};_0x2960dc(++_0x4d5040);}(_0x4991,0xf7));var _0x1499=function(_0x51ece3,_0x5a446f){_0x51ece3=_0x51ece3-0x0;var _0x1ad73f=_0x4991[_0x51ece3];return _0x1ad73f;};'use strict';var Sequelize=require(_0x1499('0x0'));module['exports']={'name':{'type':Sequelize[_0x1499('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x1499('0x1')],'unique':_0x1499('0x2')},'apiKey':{'type':Sequelize[_0x1499('0x1')]},'remoteUri':{'type':Sequelize[_0x1499('0x1')],'unique':_0x1499('0x3')},'serverUrl':{'type':Sequelize[_0x1499('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 925e4c3..839622c 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 _0xd3a8=['sendStatus','error','name','send','index','FreshdeskAccount','rawAttributes','type','model','map','keys','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','options','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','slice','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','base64','requester','subject','description','priority','ticket_type','group','company','remove','includes','default','custom_text','custom_dropdown','choices','capitalize','stringify','test','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xd3a8,0x135));var _0x8d3a=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xd3a8[_0x46698a];return _0x356db0;};'use strict';var emlformat=require(_0x8d3a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8d3a('0x1'));var jsonpatch=require(_0x8d3a('0x2'));var rp=require(_0x8d3a('0x3'));var moment=require(_0x8d3a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8d3a('0x5'));var util=require(_0x8d3a('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8d3a('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8d3a('0x8'));var crypto=require(_0x8d3a('0x9'));var jsforce=require(_0x8d3a('0xa'));var deskjs=require(_0x8d3a('0xb'));var toCsv=require(_0x8d3a('0xc'));var querystring=require(_0x8d3a('0xd'));var Papa=require(_0x8d3a('0xe'));var Redis=require(_0x8d3a('0xf'));var authService=require(_0x8d3a('0x10'));var qs=require(_0x8d3a('0x11'));var as=require(_0x8d3a('0x12'));var hardwareService=require(_0x8d3a('0x13'));var logger=require(_0x8d3a('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8d3a('0x15'));var db=require(_0x8d3a('0x16'))['db'];var integrations=require(_0x8d3a('0x17'));function respondWithStatusCode(_0x43b1ca,_0x4759cd){_0x4759cd=_0x4759cd||0xcc;return function(_0x29b7b9){if(_0x29b7b9){return _0x43b1ca['sendStatus'](_0x4759cd);}return _0x43b1ca[_0x8d3a('0x18')](_0x4759cd)[_0x8d3a('0x19')]();};}function respondWithResult(_0x5c6ed1,_0x4c11b3){_0x4c11b3=_0x4c11b3||0xc8;return function(_0x2fd704){if(_0x2fd704){return _0x5c6ed1['status'](_0x4c11b3)[_0x8d3a('0x1a')](_0x2fd704);}};}function respondWithFilteredResult(_0x4225d9,_0x10f582){return function(_0x4c915d){if(_0x4c915d){var _0x33eefb=typeof _0x10f582['offset']===_0x8d3a('0x1b')&&typeof _0x10f582['limit']===_0x8d3a('0x1b');var _0x36cc0b=_0x4c915d[_0x8d3a('0x1c')];var _0x5cf34a=_0x33eefb?0x0:_0x10f582['offset'];var _0x1bbbe1=_0x33eefb?_0x4c915d[_0x8d3a('0x1c')]:_0x10f582[_0x8d3a('0x1d')]+_0x10f582[_0x8d3a('0x1e')];var _0x38284e;if(_0x1bbbe1>=_0x36cc0b){_0x1bbbe1=_0x36cc0b;_0x38284e=0xc8;}else{_0x38284e=0xce;}_0x4225d9['status'](_0x38284e);return _0x4225d9[_0x8d3a('0x1f')](_0x8d3a('0x20'),_0x5cf34a+'-'+_0x1bbbe1+'/'+_0x36cc0b)[_0x8d3a('0x1a')](_0x4c915d);}return null;};}function patchUpdates(_0xd390c2){return function(_0x230971){try{jsonpatch[_0x8d3a('0x21')](_0x230971,_0xd390c2,!![]);}catch(_0x563d44){return BPromise[_0x8d3a('0x22')](_0x563d44);}return _0x230971[_0x8d3a('0x23')]();};}function saveUpdates(_0x46fcf1,_0x412126){return function(_0x5c32bf){if(_0x5c32bf){return _0x5c32bf[_0x8d3a('0x24')](_0x46fcf1)[_0x8d3a('0x25')](function(_0x246275){return _0x246275;});}return null;};}function removeEntity(_0x53916d,_0x10b997){return function(_0x477070){if(_0x477070){return _0x477070[_0x8d3a('0x26')]()[_0x8d3a('0x25')](function(){_0x53916d[_0x8d3a('0x18')](0xcc)[_0x8d3a('0x19')]();});}};}function handleEntityNotFound(_0x3bff9e,_0x4f6551){return function(_0x5f268b){if(!_0x5f268b){_0x3bff9e[_0x8d3a('0x27')](0x194);}return _0x5f268b;};}function handleError(_0x2204a7,_0x45451e){_0x45451e=_0x45451e||0x1f4;return function(_0x360fcc){logger[_0x8d3a('0x28')](_0x360fcc['stack']);if(_0x360fcc['name']){delete _0x360fcc[_0x8d3a('0x29')];}_0x2204a7[_0x8d3a('0x18')](_0x45451e)[_0x8d3a('0x2a')](_0x360fcc);};}exports[_0x8d3a('0x2b')]=function(_0x1c6ff6,_0x24e990){var _0x497328={},_0x400ee4={},_0x266a4c={'count':0x0,'rows':[]};var _0x18f710=_['map'](db[_0x8d3a('0x2c')][_0x8d3a('0x2d')],function(_0x2ffd78){return{'name':_0x2ffd78['fieldName'],'type':_0x2ffd78[_0x8d3a('0x2e')]['key']};});_0x400ee4[_0x8d3a('0x2f')]=_[_0x8d3a('0x30')](_0x18f710,_0x8d3a('0x29'));_0x400ee4['query']=_[_0x8d3a('0x31')](_0x1c6ff6['query']);_0x400ee4['filters']=_[_0x8d3a('0x32')](_0x400ee4[_0x8d3a('0x2f')],_0x400ee4['query']);_0x497328[_0x8d3a('0x33')]=_['intersection'](_0x400ee4['model'],qs[_0x8d3a('0x34')](_0x1c6ff6[_0x8d3a('0x35')]['fields']));_0x497328[_0x8d3a('0x33')]=_0x497328[_0x8d3a('0x33')][_0x8d3a('0x36')]?_0x497328[_0x8d3a('0x33')]:_0x400ee4[_0x8d3a('0x2f')];if(!_0x1c6ff6[_0x8d3a('0x35')][_0x8d3a('0x37')](_0x8d3a('0x38'))){_0x497328[_0x8d3a('0x1e')]=qs[_0x8d3a('0x1e')](_0x1c6ff6['query'][_0x8d3a('0x1e')]);_0x497328[_0x8d3a('0x1d')]=qs['offset'](_0x1c6ff6['query'][_0x8d3a('0x1d')]);}_0x497328[_0x8d3a('0x39')]=qs[_0x8d3a('0x3a')](_0x1c6ff6['query'][_0x8d3a('0x3a')]);_0x497328[_0x8d3a('0x3b')]=qs['filters'](_[_0x8d3a('0x3c')](_0x1c6ff6[_0x8d3a('0x35')],_0x400ee4[_0x8d3a('0x3d')]),_0x18f710);if(_0x1c6ff6[_0x8d3a('0x35')][_0x8d3a('0x3e')]){_0x497328[_0x8d3a('0x3b')]=_['merge'](_0x497328[_0x8d3a('0x3b')],{'$or':_[_0x8d3a('0x30')](_0x18f710,function(_0x3976aa){if(_0x3976aa[_0x8d3a('0x2e')]!==_0x8d3a('0x3f')){var _0x2c05f6={};_0x2c05f6[_0x3976aa[_0x8d3a('0x29')]]={'$like':'%'+_0x1c6ff6[_0x8d3a('0x35')][_0x8d3a('0x3e')]+'%'};return _0x2c05f6;}})});}_0x497328=_[_0x8d3a('0x40')]({},_0x497328,_0x1c6ff6['options']);var _0x509f7d={'where':_0x497328[_0x8d3a('0x3b')]};return db[_0x8d3a('0x2c')][_0x8d3a('0x1c')](_0x509f7d)[_0x8d3a('0x25')](function(_0x39e5de){_0x266a4c[_0x8d3a('0x1c')]=_0x39e5de;if(_0x1c6ff6['query'][_0x8d3a('0x41')]){_0x497328[_0x8d3a('0x42')]=[{'all':!![]}];}return db[_0x8d3a('0x2c')][_0x8d3a('0x43')](_0x497328);})[_0x8d3a('0x25')](function(_0x35ad38){_0x266a4c[_0x8d3a('0x44')]=_0x35ad38;return _0x266a4c;})[_0x8d3a('0x25')](respondWithFilteredResult(_0x24e990,_0x497328))[_0x8d3a('0x45')](handleError(_0x24e990,null));};exports[_0x8d3a('0x46')]=function(_0x99bc22,_0x337995){var _0x54b19a={'raw':![],'where':{'id':_0x99bc22[_0x8d3a('0x47')]['id']}},_0x5b7f4c={};_0x5b7f4c[_0x8d3a('0x2f')]=_['keys'](db[_0x8d3a('0x2c')][_0x8d3a('0x2d')]);_0x5b7f4c[_0x8d3a('0x35')]=_['keys'](_0x99bc22['query']);_0x5b7f4c[_0x8d3a('0x3d')]=_[_0x8d3a('0x32')](_0x5b7f4c[_0x8d3a('0x2f')],_0x5b7f4c[_0x8d3a('0x35')]);_0x54b19a[_0x8d3a('0x33')]=_['intersection'](_0x5b7f4c[_0x8d3a('0x2f')],qs[_0x8d3a('0x34')](_0x99bc22[_0x8d3a('0x35')][_0x8d3a('0x34')]));_0x54b19a['attributes']=_0x54b19a['attributes']['length']?_0x54b19a[_0x8d3a('0x33')]:_0x5b7f4c[_0x8d3a('0x2f')];if(_0x99bc22[_0x8d3a('0x35')][_0x8d3a('0x41')]){_0x54b19a[_0x8d3a('0x42')]=[{'all':!![]}];}_0x54b19a=_[_0x8d3a('0x40')]({},_0x54b19a,_0x99bc22['options']);return db[_0x8d3a('0x2c')][_0x8d3a('0x48')](_0x54b19a)['then'](handleEntityNotFound(_0x337995,null))[_0x8d3a('0x25')](respondWithResult(_0x337995,null))[_0x8d3a('0x45')](handleError(_0x337995,null));};exports[_0x8d3a('0x49')]=function(_0x29cb19,_0x4940c5){return db[_0x8d3a('0x2c')][_0x8d3a('0x49')](_0x29cb19[_0x8d3a('0x4a')],{})[_0x8d3a('0x25')](respondWithResult(_0x4940c5,0xc9))[_0x8d3a('0x45')](handleError(_0x4940c5,null));};exports[_0x8d3a('0x24')]=function(_0x1ffb91,_0x2b73be){if(_0x1ffb91[_0x8d3a('0x4a')]['id']){delete _0x1ffb91[_0x8d3a('0x4a')]['id'];}return db['FreshdeskAccount'][_0x8d3a('0x48')]({'where':{'id':_0x1ffb91[_0x8d3a('0x47')]['id']}})['then'](handleEntityNotFound(_0x2b73be,null))[_0x8d3a('0x25')](saveUpdates(_0x1ffb91['body'],null))[_0x8d3a('0x25')](respondWithResult(_0x2b73be,null))[_0x8d3a('0x45')](handleError(_0x2b73be,null));};exports[_0x8d3a('0x26')]=function(_0x9116e9,_0x4acffb){return db[_0x8d3a('0x2c')][_0x8d3a('0x48')]({'where':{'id':_0x9116e9[_0x8d3a('0x47')]['id']}})[_0x8d3a('0x25')](handleEntityNotFound(_0x4acffb,null))[_0x8d3a('0x25')](removeEntity(_0x4acffb,null))[_0x8d3a('0x45')](handleError(_0x4acffb,null));};exports[_0x8d3a('0x4b')]=function(_0x10cf29,_0x5c9341,_0x50be89){var _0x1f46df={};var _0x3f7805={};var _0x285602;var _0x55dd25;return db[_0x8d3a('0x2c')][_0x8d3a('0x4c')]({'where':{'id':_0x10cf29['params']['id']}})[_0x8d3a('0x25')](handleEntityNotFound(_0x5c9341,null))[_0x8d3a('0x25')](function(_0x2b835d){if(_0x2b835d){_0x285602=_0x2b835d;_0x3f7805[_0x8d3a('0x2f')]=_[_0x8d3a('0x31')](db[_0x8d3a('0x4d')]['rawAttributes']);_0x3f7805[_0x8d3a('0x35')]=_[_0x8d3a('0x31')](_0x10cf29[_0x8d3a('0x35')]);_0x3f7805['filters']=_[_0x8d3a('0x32')](_0x3f7805[_0x8d3a('0x2f')],_0x3f7805['query']);_0x1f46df['attributes']=_[_0x8d3a('0x32')](_0x3f7805[_0x8d3a('0x2f')],qs[_0x8d3a('0x34')](_0x10cf29['query']['fields']));_0x1f46df[_0x8d3a('0x33')]=_0x1f46df[_0x8d3a('0x33')][_0x8d3a('0x36')]?_0x1f46df[_0x8d3a('0x33')]:_0x3f7805[_0x8d3a('0x2f')];_0x1f46df[_0x8d3a('0x39')]=qs[_0x8d3a('0x3a')](_0x10cf29[_0x8d3a('0x35')]['sort']);_0x1f46df[_0x8d3a('0x3b')]=qs[_0x8d3a('0x3d')](_[_0x8d3a('0x3c')](_0x10cf29[_0x8d3a('0x35')],_0x3f7805['filters']));if(_0x10cf29['query']['filter']){_0x1f46df[_0x8d3a('0x3b')]=_['merge'](_0x1f46df[_0x8d3a('0x3b')],{'$or':_[_0x8d3a('0x30')](_0x1f46df['attributes'],function(_0x20a490){var _0x1d41e8={};_0x1d41e8[_0x20a490]={'$like':'%'+_0x10cf29['query']['filter']+'%'};return _0x1d41e8;})});}_0x1f46df=_[_0x8d3a('0x40')]({},_0x1f46df,_0x10cf29[_0x8d3a('0x4e')]);return _0x285602[_0x8d3a('0x4b')](_0x1f46df);}})[_0x8d3a('0x25')](function(_0x786c6b){if(_0x786c6b){_0x55dd25=_0x786c6b['length'];if(!_0x10cf29['query']['hasOwnProperty'](_0x8d3a('0x38'))){_0x1f46df['limit']=qs[_0x8d3a('0x1e')](_0x10cf29[_0x8d3a('0x35')][_0x8d3a('0x1e')]);_0x1f46df[_0x8d3a('0x1d')]=qs['offset'](_0x10cf29[_0x8d3a('0x35')][_0x8d3a('0x1d')]);}return _0x285602[_0x8d3a('0x4b')](_0x1f46df);}})[_0x8d3a('0x25')](function(_0x5631ac){if(_0x5631ac){return _0x5631ac?{'count':_0x55dd25,'rows':_0x5631ac}:null;}})[_0x8d3a('0x25')](respondWithResult(_0x5c9341,null))[_0x8d3a('0x45')](handleError(_0x5c9341,null));};exports[_0x8d3a('0x4f')]=function(_0x47f18e,_0x12104d,_0x4c6fa6){if(_0x47f18e[_0x8d3a('0x4a')]['id']){delete _0x47f18e[_0x8d3a('0x4a')]['id'];}return db[_0x8d3a('0x2c')]['findOne']({'where':{'id':_0x47f18e[_0x8d3a('0x47')]['id']}})[_0x8d3a('0x25')](handleEntityNotFound(_0x12104d,null))[_0x8d3a('0x25')](function(_0x2a6471){if(_0x2a6471){_0x47f18e[_0x8d3a('0x4a')][_0x8d3a('0x50')]=_0x2a6471['id'];_0x47f18e[_0x8d3a('0x4a')][_0x8d3a('0x51')]=integrations[_0x8d3a('0x52')](_0x47f18e[_0x8d3a('0x4a')][_0x8d3a('0x53')],_0x47f18e[_0x8d3a('0x4a')][_0x8d3a('0x2e')]);_0x47f18e[_0x8d3a('0x4a')]['Descriptions']=integrations[_0x8d3a('0x54')](_0x47f18e[_0x8d3a('0x4a')][_0x8d3a('0x53')],_0x47f18e[_0x8d3a('0x4a')][_0x8d3a('0x2e')]);return db['FreshdeskConfiguration']['create'](_0x47f18e[_0x8d3a('0x4a')],{'include':[{'model':db['FreshdeskField'],'as':_0x8d3a('0x51')},{'model':db[_0x8d3a('0x55')],'as':_0x8d3a('0x56')}]});}return null;})[_0x8d3a('0x25')](respondWithResult(_0x12104d,null))[_0x8d3a('0x45')](handleError(_0x12104d,null));};exports[_0x8d3a('0x57')]=function(_0x335bfe,_0x3554cc,_0x3a62bf){var _0x4f4a9c='';return db[_0x8d3a('0x2c')][_0x8d3a('0x4c')]({'where':{'id':_0x335bfe[_0x8d3a('0x47')]['id']},'attributes':['id',_0x8d3a('0x58'),_0x8d3a('0x59')]})['then'](handleEntityNotFound(_0x3554cc,null))[_0x8d3a('0x25')](function(_0x443056){if(_0x443056){_0x4f4a9c=_0x443056[_0x8d3a('0x58')];var _0x1198b9=_0x4f4a9c[_0x8d3a('0x5a')](-0x1);if(_0x1198b9==='/'){_0x4f4a9c=_0x4f4a9c['substring'](0x0,_0x4f4a9c[_0x8d3a('0x5b')](_0x1198b9));}return rp({'method':_0x8d3a('0x5c'),'uri':util[_0x8d3a('0x5d')](_0x8d3a('0x5e'),_0x4f4a9c,_0x8d3a('0x5f')),'headers':{'Authorization':util['format'](_0x8d3a('0x60'),new Buffer(util[_0x8d3a('0x5d')](_0x8d3a('0x61'),_0x443056['apiKey']))['toString'](_0x8d3a('0x62')))},'json':!![]});}})['then'](function(_0x690c31){if(_0x690c31){var _0x134377=[_0x8d3a('0x63'),_0x8d3a('0x64'),'agent',_0x8d3a('0x65'),_0x8d3a('0x18'),_0x8d3a('0x66'),'group','source',_0x8d3a('0x67'),_0x8d3a('0x68'),_0x8d3a('0x69')];_[_0x8d3a('0x6a')](_0x690c31,function(_0x5976af){return _0x134377[_0x8d3a('0x6b')](_0x5976af[_0x8d3a('0x29')])||!_0x5976af[_0x8d3a('0x6c')]&&_0x5976af[_0x8d3a('0x2e')]!==_0x8d3a('0x6d')&&_0x5976af[_0x8d3a('0x2e')]!==_0x8d3a('0x6e');});return{'count':_0x690c31[_0x8d3a('0x36')],'rows':_[_0x8d3a('0x30')](_0x690c31,function(_0x344d46){return{'id':_0x344d46['name'],'name':_0x344d46['label'],'custom':!_0x344d46[_0x8d3a('0x6c')],'options':_0x344d46[_0x8d3a('0x6f')]?_['map'](_0x344d46[_0x8d3a('0x6f')],function(_0x3af89d){return{'name':_[_0x8d3a('0x70')](_0x3af89d),'value':_0x3af89d};}):[]};})};}})[_0x8d3a('0x25')](respondWithResult(_0x3554cc,null))[_0x8d3a('0x45')](function(_0x833d34){var _0x3a6e2f=_0x335bfe[_0x8d3a('0x35')]['test']?0x1f4:_0x833d34['statusCode']||0x1f4;logger[_0x8d3a('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0x8d3a('0x57'),_0x3a6e2f,JSON[_0x8d3a('0x71')](_0x833d34));delete _0x833d34['name'];if(_0x3a6e2f===0x191){_0x3a6e2f=0x190;}_0x3554cc[_0x8d3a('0x18')](_0x3a6e2f)[_0x8d3a('0x2a')](_0x335bfe['query'][_0x8d3a('0x72')]?{'message':_0x8d3a('0x73'),'statusCode':_0x833d34['statusCode']}:_0x833d34);});}; \ No newline at end of file +var _0x17d1=['set','json','apply','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','FreshdeskAccount','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','show','find','create','body','params','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','base64','requester','subject','agent','description','priority','group','source','company','includes','default','custom_text','choices','test','stringify','statusCode','eml-format','rimraf','request-promise','moment','util','path','sox','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','undefined','limit','offset'];(function(_0x20f060,_0xe160c9){var _0x46077c=function(_0x3c615a){while(--_0x3c615a){_0x20f060['push'](_0x20f060['shift']());}};_0x46077c(++_0xe160c9);}(_0x17d1,0xc9));var _0x117d=function(_0x4d78bc,_0x250889){_0x4d78bc=_0x4d78bc-0x0;var _0x2489fd=_0x17d1[_0x4d78bc];return _0x2489fd;};'use strict';var emlformat=require(_0x117d('0x0'));var rimraf=require(_0x117d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x117d('0x2'));var moment=require(_0x117d('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x117d('0x4'));var path=require(_0x117d('0x5'));var sox=require(_0x117d('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x117d('0x7'));var _=require('lodash');var squel=require(_0x117d('0x8'));var crypto=require(_0x117d('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x117d('0xa'));var toCsv=require(_0x117d('0xb'));var querystring=require(_0x117d('0xc'));var Papa=require(_0x117d('0xd'));var Redis=require(_0x117d('0xe'));var authService=require(_0x117d('0xf'));var qs=require(_0x117d('0x10'));var as=require(_0x117d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x117d('0x12'))(_0x117d('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x117d('0x14'));var db=require(_0x117d('0x15'))['db'];var integrations=require(_0x117d('0x16'));function respondWithStatusCode(_0x46ba04,_0x4e486d){_0x4e486d=_0x4e486d||0xcc;return function(_0x29b874){if(_0x29b874){return _0x46ba04['sendStatus'](_0x4e486d);}return _0x46ba04[_0x117d('0x17')](_0x4e486d)['end']();};}function respondWithResult(_0x322bd6,_0x2f8e6a){_0x2f8e6a=_0x2f8e6a||0xc8;return function(_0x363d13){if(_0x363d13){return _0x322bd6[_0x117d('0x17')](_0x2f8e6a)['json'](_0x363d13);}};}function respondWithFilteredResult(_0x3d7151,_0x47055e){return function(_0x24de6b){if(_0x24de6b){var _0x1be81c=typeof _0x47055e['offset']===_0x117d('0x18')&&typeof _0x47055e[_0x117d('0x19')]===_0x117d('0x18');var _0x1b487d=_0x24de6b['count'];var _0xaac8a4=_0x1be81c?0x0:_0x47055e['offset'];var _0x341dbe=_0x1be81c?_0x24de6b['count']:_0x47055e[_0x117d('0x1a')]+_0x47055e[_0x117d('0x19')];var _0x2adca2;if(_0x341dbe>=_0x1b487d){_0x341dbe=_0x1b487d;_0x2adca2=0xc8;}else{_0x2adca2=0xce;}_0x3d7151[_0x117d('0x17')](_0x2adca2);return _0x3d7151[_0x117d('0x1b')]('Content-Range',_0xaac8a4+'-'+_0x341dbe+'/'+_0x1b487d)[_0x117d('0x1c')](_0x24de6b);}return null;};}function patchUpdates(_0x1a816f){return function(_0x3e047e){try{jsonpatch[_0x117d('0x1d')](_0x3e047e,_0x1a816f,!![]);}catch(_0x385af8){return BPromise['reject'](_0x385af8);}return _0x3e047e[_0x117d('0x1e')]();};}function saveUpdates(_0x1def09,_0x512740){return function(_0x4f47ce){if(_0x4f47ce){return _0x4f47ce[_0x117d('0x1f')](_0x1def09)[_0x117d('0x20')](function(_0x4085d0){return _0x4085d0;});}return null;};}function removeEntity(_0x150cdf,_0x1fb841){return function(_0x460c06){if(_0x460c06){return _0x460c06[_0x117d('0x21')]()[_0x117d('0x20')](function(){_0x150cdf['status'](0xcc)[_0x117d('0x22')]();});}};}function handleEntityNotFound(_0x4cd194,_0x1cfc01){return function(_0x20915c){if(!_0x20915c){_0x4cd194[_0x117d('0x23')](0x194);}return _0x20915c;};}function handleError(_0x3d1722,_0x7aa4e3){_0x7aa4e3=_0x7aa4e3||0x1f4;return function(_0x5b95c6){logger[_0x117d('0x24')](_0x5b95c6[_0x117d('0x25')]);if(_0x5b95c6[_0x117d('0x26')]){delete _0x5b95c6[_0x117d('0x26')];}_0x3d1722[_0x117d('0x17')](_0x7aa4e3)[_0x117d('0x27')](_0x5b95c6);};}exports[_0x117d('0x28')]=function(_0x50f6b4,_0x27a526){var _0x2edd00={},_0x9bb65d={},_0x2f90fa={'count':0x0,'rows':[]};var _0x1cf52b=_[_0x117d('0x29')](db[_0x117d('0x2a')][_0x117d('0x2b')],function(_0x125055){return{'name':_0x125055['fieldName'],'type':_0x125055['type'][_0x117d('0x2c')]};});_0x9bb65d[_0x117d('0x2d')]=_[_0x117d('0x29')](_0x1cf52b,_0x117d('0x26'));_0x9bb65d[_0x117d('0x2e')]=_[_0x117d('0x2f')](_0x50f6b4['query']);_0x9bb65d[_0x117d('0x30')]=_[_0x117d('0x31')](_0x9bb65d[_0x117d('0x2d')],_0x9bb65d['query']);_0x2edd00[_0x117d('0x32')]=_[_0x117d('0x31')](_0x9bb65d[_0x117d('0x2d')],qs[_0x117d('0x33')](_0x50f6b4[_0x117d('0x2e')]['fields']));_0x2edd00[_0x117d('0x32')]=_0x2edd00[_0x117d('0x32')][_0x117d('0x34')]?_0x2edd00[_0x117d('0x32')]:_0x9bb65d[_0x117d('0x2d')];if(!_0x50f6b4[_0x117d('0x2e')][_0x117d('0x35')](_0x117d('0x36'))){_0x2edd00[_0x117d('0x19')]=qs[_0x117d('0x19')](_0x50f6b4[_0x117d('0x2e')][_0x117d('0x19')]);_0x2edd00['offset']=qs[_0x117d('0x1a')](_0x50f6b4[_0x117d('0x2e')][_0x117d('0x1a')]);}_0x2edd00[_0x117d('0x37')]=qs['sort'](_0x50f6b4[_0x117d('0x2e')][_0x117d('0x38')]);_0x2edd00[_0x117d('0x39')]=qs[_0x117d('0x30')](_[_0x117d('0x3a')](_0x50f6b4['query'],_0x9bb65d[_0x117d('0x30')]),_0x1cf52b);if(_0x50f6b4[_0x117d('0x2e')][_0x117d('0x3b')]){_0x2edd00['where']=_['merge'](_0x2edd00[_0x117d('0x39')],{'$or':_[_0x117d('0x29')](_0x1cf52b,function(_0x787407){if(_0x787407[_0x117d('0x3c')]!==_0x117d('0x3d')){var _0x794d8d={};_0x794d8d[_0x787407['name']]={'$like':'%'+_0x50f6b4[_0x117d('0x2e')]['filter']+'%'};return _0x794d8d;}})});}_0x2edd00=_[_0x117d('0x3e')]({},_0x2edd00,_0x50f6b4[_0x117d('0x3f')]);var _0x38a986={'where':_0x2edd00[_0x117d('0x39')]};return db[_0x117d('0x2a')][_0x117d('0x40')](_0x38a986)[_0x117d('0x20')](function(_0x4179fc){_0x2f90fa[_0x117d('0x40')]=_0x4179fc;if(_0x50f6b4[_0x117d('0x2e')][_0x117d('0x41')]){_0x2edd00[_0x117d('0x42')]=[{'all':!![]}];}return db[_0x117d('0x2a')][_0x117d('0x43')](_0x2edd00);})[_0x117d('0x20')](function(_0x59cf25){_0x2f90fa[_0x117d('0x44')]=_0x59cf25;return _0x2f90fa;})[_0x117d('0x20')](respondWithFilteredResult(_0x27a526,_0x2edd00))[_0x117d('0x45')](handleError(_0x27a526,null));};exports[_0x117d('0x46')]=function(_0x2e9f7b,_0x232abb){var _0x405901={'raw':![],'where':{'id':_0x2e9f7b['params']['id']}},_0x145d41={};_0x145d41[_0x117d('0x2d')]=_[_0x117d('0x2f')](db['FreshdeskAccount'][_0x117d('0x2b')]);_0x145d41[_0x117d('0x2e')]=_[_0x117d('0x2f')](_0x2e9f7b[_0x117d('0x2e')]);_0x145d41[_0x117d('0x30')]=_[_0x117d('0x31')](_0x145d41[_0x117d('0x2d')],_0x145d41[_0x117d('0x2e')]);_0x405901[_0x117d('0x32')]=_['intersection'](_0x145d41[_0x117d('0x2d')],qs[_0x117d('0x33')](_0x2e9f7b['query']['fields']));_0x405901[_0x117d('0x32')]=_0x405901[_0x117d('0x32')][_0x117d('0x34')]?_0x405901[_0x117d('0x32')]:_0x145d41[_0x117d('0x2d')];if(_0x2e9f7b[_0x117d('0x2e')][_0x117d('0x41')]){_0x405901[_0x117d('0x42')]=[{'all':!![]}];}_0x405901=_[_0x117d('0x3e')]({},_0x405901,_0x2e9f7b[_0x117d('0x3f')]);return db[_0x117d('0x2a')][_0x117d('0x47')](_0x405901)[_0x117d('0x20')](handleEntityNotFound(_0x232abb,null))[_0x117d('0x20')](respondWithResult(_0x232abb,null))['catch'](handleError(_0x232abb,null));};exports['create']=function(_0xc7c49f,_0xf926e2){return db[_0x117d('0x2a')][_0x117d('0x48')](_0xc7c49f[_0x117d('0x49')],{})[_0x117d('0x20')](respondWithResult(_0xf926e2,0xc9))[_0x117d('0x45')](handleError(_0xf926e2,null));};exports[_0x117d('0x1f')]=function(_0x678640,_0x48e879){if(_0x678640[_0x117d('0x49')]['id']){delete _0x678640[_0x117d('0x49')]['id'];}return db[_0x117d('0x2a')][_0x117d('0x47')]({'where':{'id':_0x678640['params']['id']}})['then'](handleEntityNotFound(_0x48e879,null))[_0x117d('0x20')](saveUpdates(_0x678640[_0x117d('0x49')],null))['then'](respondWithResult(_0x48e879,null))[_0x117d('0x45')](handleError(_0x48e879,null));};exports[_0x117d('0x21')]=function(_0x1d127e,_0x2cdbe2){return db[_0x117d('0x2a')][_0x117d('0x47')]({'where':{'id':_0x1d127e[_0x117d('0x4a')]['id']}})[_0x117d('0x20')](handleEntityNotFound(_0x2cdbe2,null))['then'](removeEntity(_0x2cdbe2,null))['catch'](handleError(_0x2cdbe2,null));};exports[_0x117d('0x4b')]=function(_0x2d96dd,_0x5d541e,_0x7d0cf8){var _0xb936e={};var _0x4919d9={};var _0x15ca3f;var _0x44330c;return db['FreshdeskAccount'][_0x117d('0x4c')]({'where':{'id':_0x2d96dd[_0x117d('0x4a')]['id']}})[_0x117d('0x20')](handleEntityNotFound(_0x5d541e,null))[_0x117d('0x20')](function(_0xc92cd){if(_0xc92cd){_0x15ca3f=_0xc92cd;_0x4919d9[_0x117d('0x2d')]=_[_0x117d('0x2f')](db[_0x117d('0x4d')][_0x117d('0x2b')]);_0x4919d9[_0x117d('0x2e')]=_[_0x117d('0x2f')](_0x2d96dd[_0x117d('0x2e')]);_0x4919d9[_0x117d('0x30')]=_[_0x117d('0x31')](_0x4919d9['model'],_0x4919d9['query']);_0xb936e['attributes']=_[_0x117d('0x31')](_0x4919d9[_0x117d('0x2d')],qs[_0x117d('0x33')](_0x2d96dd[_0x117d('0x2e')][_0x117d('0x33')]));_0xb936e[_0x117d('0x32')]=_0xb936e[_0x117d('0x32')][_0x117d('0x34')]?_0xb936e[_0x117d('0x32')]:_0x4919d9[_0x117d('0x2d')];_0xb936e['order']=qs[_0x117d('0x38')](_0x2d96dd[_0x117d('0x2e')]['sort']);_0xb936e[_0x117d('0x39')]=qs['filters'](_[_0x117d('0x3a')](_0x2d96dd[_0x117d('0x2e')],_0x4919d9[_0x117d('0x30')]));if(_0x2d96dd[_0x117d('0x2e')]['filter']){_0xb936e['where']=_[_0x117d('0x3e')](_0xb936e[_0x117d('0x39')],{'$or':_[_0x117d('0x29')](_0xb936e[_0x117d('0x32')],function(_0x439c78){var _0x4223f5={};_0x4223f5[_0x439c78]={'$like':'%'+_0x2d96dd[_0x117d('0x2e')][_0x117d('0x3b')]+'%'};return _0x4223f5;})});}_0xb936e=_[_0x117d('0x3e')]({},_0xb936e,_0x2d96dd['options']);return _0x15ca3f[_0x117d('0x4b')](_0xb936e);}})['then'](function(_0x5d2aaa){if(_0x5d2aaa){_0x44330c=_0x5d2aaa[_0x117d('0x34')];if(!_0x2d96dd[_0x117d('0x2e')][_0x117d('0x35')]('nolimit')){_0xb936e[_0x117d('0x19')]=qs[_0x117d('0x19')](_0x2d96dd[_0x117d('0x2e')]['limit']);_0xb936e[_0x117d('0x1a')]=qs['offset'](_0x2d96dd[_0x117d('0x2e')]['offset']);}return _0x15ca3f['getConfigurations'](_0xb936e);}})['then'](function(_0x1eaef0){if(_0x1eaef0){return _0x1eaef0?{'count':_0x44330c,'rows':_0x1eaef0}:null;}})[_0x117d('0x20')](respondWithResult(_0x5d541e,null))[_0x117d('0x45')](handleError(_0x5d541e,null));};exports[_0x117d('0x4e')]=function(_0x474ee3,_0x50b903,_0x1a0c04){if(_0x474ee3[_0x117d('0x49')]['id']){delete _0x474ee3[_0x117d('0x49')]['id'];}return db[_0x117d('0x2a')][_0x117d('0x4c')]({'where':{'id':_0x474ee3['params']['id']}})[_0x117d('0x20')](handleEntityNotFound(_0x50b903,null))[_0x117d('0x20')](function(_0xe1e45){if(_0xe1e45){_0x474ee3[_0x117d('0x49')][_0x117d('0x4f')]=_0xe1e45['id'];_0x474ee3['body'][_0x117d('0x50')]=integrations[_0x117d('0x51')](_0x474ee3[_0x117d('0x49')][_0x117d('0x52')],_0x474ee3[_0x117d('0x49')][_0x117d('0x3c')]);_0x474ee3[_0x117d('0x49')]['Descriptions']=integrations[_0x117d('0x53')](_0x474ee3[_0x117d('0x49')][_0x117d('0x52')],_0x474ee3['body']['type']);return db[_0x117d('0x4d')]['create'](_0x474ee3[_0x117d('0x49')],{'include':[{'model':db[_0x117d('0x54')],'as':_0x117d('0x50')},{'model':db[_0x117d('0x54')],'as':_0x117d('0x55')}]});}return null;})['then'](respondWithResult(_0x50b903,null))[_0x117d('0x45')](handleError(_0x50b903,null));};exports[_0x117d('0x56')]=function(_0xd9cd9,_0x223c4e,_0x387a5e){var _0x4cd6d4='';return db['FreshdeskAccount']['findOne']({'where':{'id':_0xd9cd9[_0x117d('0x4a')]['id']},'attributes':['id',_0x117d('0x57'),_0x117d('0x58')]})['then'](handleEntityNotFound(_0x223c4e,null))['then'](function(_0x5c34a0){if(_0x5c34a0){_0x4cd6d4=_0x5c34a0['remoteUri'];var _0xdfdcff=_0x4cd6d4[_0x117d('0x59')](-0x1);if(_0xdfdcff==='/'){_0x4cd6d4=_0x4cd6d4[_0x117d('0x5a')](0x0,_0x4cd6d4[_0x117d('0x5b')](_0xdfdcff));}return rp({'method':_0x117d('0x5c'),'uri':util[_0x117d('0x5d')](_0x117d('0x5e'),_0x4cd6d4,_0x117d('0x5f')),'headers':{'Authorization':util[_0x117d('0x5d')](_0x117d('0x60'),new Buffer(util[_0x117d('0x5d')](_0x117d('0x61'),_0x5c34a0['apiKey']))['toString'](_0x117d('0x62')))},'json':!![]});}})['then'](function(_0x38d024){if(_0x38d024){var _0x3e9387=[_0x117d('0x63'),_0x117d('0x64'),_0x117d('0x65'),_0x117d('0x66'),_0x117d('0x17'),_0x117d('0x67'),_0x117d('0x68'),_0x117d('0x69'),'ticket_type',_0x117d('0x68'),_0x117d('0x6a')];_['remove'](_0x38d024,function(_0x566094){return _0x3e9387[_0x117d('0x6b')](_0x566094[_0x117d('0x26')])||!_0x566094[_0x117d('0x6c')]&&_0x566094[_0x117d('0x3c')]!==_0x117d('0x6d')&&_0x566094[_0x117d('0x3c')]!=='custom_dropdown';});return{'count':_0x38d024['length'],'rows':_['map'](_0x38d024,function(_0x27592d){return{'id':_0x27592d['name'],'name':_0x27592d['label'],'custom':!_0x27592d['default'],'options':_0x27592d['choices']?_[_0x117d('0x29')](_0x27592d[_0x117d('0x6e')],function(_0x211ed7){return{'name':_['capitalize'](_0x211ed7),'value':_0x211ed7};}):[]};})};}})['then'](respondWithResult(_0x223c4e,null))[_0x117d('0x45')](function(_0x113c0b){var _0x440fe4=_0xd9cd9[_0x117d('0x2e')][_0x117d('0x6f')]?0x1f4:_0x113c0b['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x440fe4,JSON[_0x117d('0x70')](_0x113c0b));delete _0x113c0b['name'];if(_0x440fe4===0x191){_0x440fe4=0x190;}_0x223c4e['status'](_0x440fe4)[_0x117d('0x27')](_0xd9cd9['query'][_0x117d('0x6f')]?{'message':'Wrong\x20credentials','statusCode':_0x113c0b[_0x117d('0x71')]}:_0x113c0b);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index ed560f8..0bef299 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 _0xa3fa=['./intFreshdeskAccount.attributes','../../components/integrations/configuration','define','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x4c6461,_0x5c946b){var _0x1fd033=function(_0x59a801){while(--_0x59a801){_0x4c6461['push'](_0x4c6461['shift']());}};_0x1fd033(++_0x5c946b);}(_0xa3fa,0xff));var _0xaa3f=function(_0x3e4754,_0x659edc){_0x3e4754=_0x3e4754-0x0;var _0x176b21=_0xa3fa[_0x3e4754];return _0x176b21;};'use strict';var _=require(_0xaa3f('0x0'));var util=require(_0xaa3f('0x1'));var logger=require(_0xaa3f('0x2'))(_0xaa3f('0x3'));var moment=require('moment');var BPromise=require(_0xaa3f('0x4'));var rp=require(_0xaa3f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xaa3f('0x6'));var integrations=require(_0xaa3f('0x7'));module['exports']=function(_0x354222,_0x3771e9){return _0x354222[_0xaa3f('0x8')]('FreshdeskAccount',attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98b9=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','define'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x98b9,0x181));var _0x998b=function(_0x4f3a4d,_0x1c0514){_0x4f3a4d=_0x4f3a4d-0x0;var _0x1b48b6=_0x98b9[_0x4f3a4d];return _0x1b48b6;};'use strict';var _=require(_0x998b('0x0'));var util=require(_0x998b('0x1'));var logger=require(_0x998b('0x2'))('api');var moment=require(_0x998b('0x3'));var BPromise=require(_0x998b('0x4'));var rp=require(_0x998b('0x5'));var fs=require('fs');var path=require(_0x998b('0x6'));var rimraf=require(_0x998b('0x7'));var config=require(_0x998b('0x8'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x998b('0x9'));module['exports']=function(_0x463932,_0x58a56f){return _0x463932[_0x998b('0xa')]('FreshdeskAccount',attributes,{'tableName':'int_freshdesk_accounts','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 5399a0e..1ed7eef 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 _0x8176=['options','raw','where','attributes','include','map','model','find','ShowFreshdeskAccount','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll'];(function(_0x2581f6,_0x4fee77){var _0x5a1884=function(_0x1d22c6){while(--_0x1d22c6){_0x2581f6['push'](_0x2581f6['shift']());}};_0x5a1884(++_0x4fee77);}(_0x8176,0xfe));var _0x6817=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x8176[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0x6817('0x0'));var util=require('util');var moment=require(_0x6817('0x1'));var BPromise=require(_0x6817('0x2'));var rs=require(_0x6817('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6817('0x4'))['db'];var utils=require(_0x6817('0x5'));var logger=require(_0x6817('0x6'))('rpc');var config=require(_0x6817('0x7'));var jayson=require(_0x6817('0x8'));var client=jayson[_0x6817('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x236e94,_0x1089df,_0x54279b){return new BPromise(function(_0x401d5d,_0xa96e7a){return client[_0x6817('0xa')](_0x236e94,_0x54279b)[_0x6817('0xb')](function(_0x250453){logger['info'](_0x6817('0xc'),_0x1089df,_0x6817('0xd'));logger[_0x6817('0xe')](_0x6817('0xf'),_0x1089df,'request\x20sent',JSON[_0x6817('0x10')](_0x250453));if(_0x250453[_0x6817('0x11')]){if(_0x250453['error'][_0x6817('0x12')]===0x1f4){logger[_0x6817('0x11')](_0x6817('0xc'),_0x1089df,_0x250453[_0x6817('0x11')][_0x6817('0x13')]);return _0xa96e7a(_0x250453[_0x6817('0x11')][_0x6817('0x13')]);}logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x1089df,_0x250453[_0x6817('0x11')][_0x6817('0x13')]);return _0x401d5d(_0x250453[_0x6817('0x11')][_0x6817('0x13')]);}else{logger[_0x6817('0x14')](_0x6817('0xc'),_0x1089df,_0x6817('0xd'));_0x401d5d(_0x250453[_0x6817('0x15')][_0x6817('0x13')]);}})[_0x6817('0x16')](function(_0x4ec8c1){logger['error'](_0x6817('0xc'),_0x1089df,_0x4ec8c1);_0xa96e7a(_0x4ec8c1);});});}exports[_0x6817('0x17')]=function(_0x3a5578){var _0xf3d25d=this;return new Promise(function(_0x3efc6d,_0x212828){return db[_0x6817('0x18')][_0x6817('0x19')]({'raw':_0x3a5578[_0x6817('0x1a')]?_0x3a5578[_0x6817('0x1a')][_0x6817('0x1b')]===undefined?!![]:![]:!![],'where':_0x3a5578[_0x6817('0x1a')]?_0x3a5578['options'][_0x6817('0x1c')]||null:null,'attributes':_0x3a5578[_0x6817('0x1a')]?_0x3a5578[_0x6817('0x1a')][_0x6817('0x1d')]||null:null,'limit':_0x3a5578[_0x6817('0x1a')]?_0x3a5578[_0x6817('0x1a')]['limit']||null:null,'include':_0x3a5578[_0x6817('0x1a')]?_0x3a5578['options'][_0x6817('0x1e')]?_[_0x6817('0x1f')](_0x3a5578[_0x6817('0x1a')][_0x6817('0x1e')],function(_0x19cc32){return{'model':db[_0x19cc32[_0x6817('0x20')]],'as':_0x19cc32['as'],'attributes':_0x19cc32[_0x6817('0x1d')],'include':_0x19cc32[_0x6817('0x1e')]?_[_0x6817('0x1f')](_0x19cc32[_0x6817('0x1e')],function(_0x4b60d8){return{'model':db[_0x4b60d8[_0x6817('0x20')]],'as':_0x4b60d8['as'],'attributes':_0x4b60d8[_0x6817('0x1d')],'include':_0x4b60d8['include']?_[_0x6817('0x1f')](_0x4b60d8['include'],function(_0x356c7c){return{'model':db[_0x356c7c[_0x6817('0x20')]],'as':_0x356c7c['as'],'attributes':_0x356c7c[_0x6817('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6817('0xb')](function(_0x156c63){logger[_0x6817('0x14')](_0x6817('0x17'),_0x3a5578);logger[_0x6817('0xe')]('GetFreshdeskAccount',_0x3a5578,JSON[_0x6817('0x10')](_0x156c63));_0x3efc6d(_0x156c63);})[_0x6817('0x16')](function(_0xb4f19c){logger[_0x6817('0x11')](_0x6817('0x17'),_0xb4f19c[_0x6817('0x13')],_0x3a5578);_0x212828(_0xf3d25d[_0x6817('0x11')](0x1f4,_0xb4f19c[_0x6817('0x13')]));});});};exports['ShowFreshdeskAccount']=function(_0x2f30a5){var _0x7f4c23=this;return new Promise(function(_0x3f58c3,_0x35f866){return db[_0x6817('0x18')][_0x6817('0x21')]({'raw':_0x2f30a5[_0x6817('0x1a')]?_0x2f30a5[_0x6817('0x1a')][_0x6817('0x1b')]===undefined?!![]:![]:!![],'where':_0x2f30a5[_0x6817('0x1a')]?_0x2f30a5[_0x6817('0x1a')][_0x6817('0x1c')]||null:null,'attributes':_0x2f30a5[_0x6817('0x1a')]?_0x2f30a5[_0x6817('0x1a')][_0x6817('0x1d')]||null:null,'include':_0x2f30a5[_0x6817('0x1a')]?_0x2f30a5[_0x6817('0x1a')][_0x6817('0x1e')]?_[_0x6817('0x1f')](_0x2f30a5[_0x6817('0x1a')][_0x6817('0x1e')],function(_0x21ffb1){return{'model':db[_0x21ffb1[_0x6817('0x20')]],'as':_0x21ffb1['as'],'attributes':_0x21ffb1['attributes'],'include':_0x21ffb1[_0x6817('0x1e')]?_[_0x6817('0x1f')](_0x21ffb1[_0x6817('0x1e')],function(_0x1a6de0){return{'model':db[_0x1a6de0[_0x6817('0x20')]],'as':_0x1a6de0['as'],'attributes':_0x1a6de0[_0x6817('0x1d')],'include':_0x1a6de0[_0x6817('0x1e')]?_['map'](_0x1a6de0[_0x6817('0x1e')],function(_0x43f867){return{'model':db[_0x43f867[_0x6817('0x20')]],'as':_0x43f867['as'],'attributes':_0x43f867[_0x6817('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6817('0xb')](function(_0x12c567){logger[_0x6817('0x14')](_0x6817('0x22'),_0x2f30a5);logger[_0x6817('0xe')](_0x6817('0x22'),_0x2f30a5,JSON[_0x6817('0x10')](_0x12c567));_0x3f58c3(_0x12c567);})[_0x6817('0x16')](function(_0x235279){logger[_0x6817('0x11')](_0x6817('0x22'),_0x235279[_0x6817('0x13')],_0x2f30a5);_0x35f866(_0x7f4c23[_0x6817('0x11')](0x1f4,_0x235279[_0x6817('0x13')]));});});}; \ No newline at end of file +var _0x3890=['catch','GetFreshdeskAccount','FreshdeskAccount','options','where','include','model','attributes','map','debug','find','raw','ShowFreshdeskAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result'];(function(_0x15f9c4,_0x4a7bf1){var _0x3d045e=function(_0x5efb2d){while(--_0x5efb2d){_0x15f9c4['push'](_0x15f9c4['shift']());}};_0x3d045e(++_0x4a7bf1);}(_0x3890,0x161));var _0x0389=function(_0x4c0386,_0x424d6d){_0x4c0386=_0x4c0386-0x0;var _0x3969ba=_0x3890[_0x4c0386];return _0x3969ba;};'use strict';var _=require(_0x0389('0x0'));var util=require('util');var moment=require(_0x0389('0x1'));var BPromise=require(_0x0389('0x2'));var rs=require(_0x0389('0x3'));var fs=require('fs');var Redis=require(_0x0389('0x4'));var db=require(_0x0389('0x5'))['db'];var utils=require(_0x0389('0x6'));var logger=require(_0x0389('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0389('0x8'));var client=jayson['client'][_0x0389('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1dd3db,_0x354aeb,_0x278843){return new BPromise(function(_0x2db737,_0x5a93ec){return client[_0x0389('0xa')](_0x1dd3db,_0x278843)[_0x0389('0xb')](function(_0x3d98c0){logger['info'](_0x0389('0xc'),_0x354aeb,_0x0389('0xd'));logger['debug'](_0x0389('0xe'),_0x354aeb,_0x0389('0xd'),JSON[_0x0389('0xf')](_0x3d98c0));if(_0x3d98c0['error']){if(_0x3d98c0['error'][_0x0389('0x10')]===0x1f4){logger[_0x0389('0x11')](_0x0389('0xc'),_0x354aeb,_0x3d98c0[_0x0389('0x11')][_0x0389('0x12')]);return _0x5a93ec(_0x3d98c0['error']['message']);}logger[_0x0389('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x354aeb,_0x3d98c0['error'][_0x0389('0x12')]);return _0x2db737(_0x3d98c0[_0x0389('0x11')][_0x0389('0x12')]);}else{logger[_0x0389('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0x354aeb,_0x0389('0xd'));_0x2db737(_0x3d98c0[_0x0389('0x14')][_0x0389('0x12')]);}})[_0x0389('0x15')](function(_0x2eeafb){logger[_0x0389('0x11')](_0x0389('0xc'),_0x354aeb,_0x2eeafb);_0x5a93ec(_0x2eeafb);});});}exports[_0x0389('0x16')]=function(_0x29fbf5){var _0x1b3fcc=this;return new Promise(function(_0x28496b,_0x5751d3){return db[_0x0389('0x17')]['findAll']({'raw':_0x29fbf5['options']?_0x29fbf5[_0x0389('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x29fbf5[_0x0389('0x18')]?_0x29fbf5[_0x0389('0x18')][_0x0389('0x19')]||null:null,'attributes':_0x29fbf5['options']?_0x29fbf5[_0x0389('0x18')]['attributes']||null:null,'limit':_0x29fbf5[_0x0389('0x18')]?_0x29fbf5[_0x0389('0x18')]['limit']||null:null,'include':_0x29fbf5[_0x0389('0x18')]?_0x29fbf5[_0x0389('0x18')][_0x0389('0x1a')]?_['map'](_0x29fbf5[_0x0389('0x18')]['include'],function(_0x2b1cd5){return{'model':db[_0x2b1cd5[_0x0389('0x1b')]],'as':_0x2b1cd5['as'],'attributes':_0x2b1cd5[_0x0389('0x1c')],'include':_0x2b1cd5[_0x0389('0x1a')]?_[_0x0389('0x1d')](_0x2b1cd5[_0x0389('0x1a')],function(_0x25968f){return{'model':db[_0x25968f['model']],'as':_0x25968f['as'],'attributes':_0x25968f['attributes'],'include':_0x25968f[_0x0389('0x1a')]?_['map'](_0x25968f[_0x0389('0x1a')],function(_0x20dd61){return{'model':db[_0x20dd61['model']],'as':_0x20dd61['as'],'attributes':_0x20dd61['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ca5e1){logger[_0x0389('0x13')](_0x0389('0x16'),_0x29fbf5);logger[_0x0389('0x1e')](_0x0389('0x16'),_0x29fbf5,JSON[_0x0389('0xf')](_0x3ca5e1));_0x28496b(_0x3ca5e1);})[_0x0389('0x15')](function(_0xcfaf22){logger[_0x0389('0x11')](_0x0389('0x16'),_0xcfaf22[_0x0389('0x12')],_0x29fbf5);_0x5751d3(_0x1b3fcc[_0x0389('0x11')](0x1f4,_0xcfaf22['message']));});});};exports['ShowFreshdeskAccount']=function(_0x360191){var _0x303eea=this;return new Promise(function(_0x321cc6,_0x451225){return db[_0x0389('0x17')][_0x0389('0x1f')]({'raw':_0x360191[_0x0389('0x18')]?_0x360191[_0x0389('0x18')][_0x0389('0x20')]===undefined?!![]:![]:!![],'where':_0x360191['options']?_0x360191['options'][_0x0389('0x19')]||null:null,'attributes':_0x360191[_0x0389('0x18')]?_0x360191[_0x0389('0x18')][_0x0389('0x1c')]||null:null,'include':_0x360191[_0x0389('0x18')]?_0x360191[_0x0389('0x18')][_0x0389('0x1a')]?_[_0x0389('0x1d')](_0x360191['options']['include'],function(_0x441571){return{'model':db[_0x441571['model']],'as':_0x441571['as'],'attributes':_0x441571['attributes'],'include':_0x441571['include']?_[_0x0389('0x1d')](_0x441571[_0x0389('0x1a')],function(_0x3f80d6){return{'model':db[_0x3f80d6['model']],'as':_0x3f80d6['as'],'attributes':_0x3f80d6[_0x0389('0x1c')],'include':_0x3f80d6[_0x0389('0x1a')]?_[_0x0389('0x1d')](_0x3f80d6[_0x0389('0x1a')],function(_0x2f3a0f){return{'model':db[_0x2f3a0f[_0x0389('0x1b')]],'as':_0x2f3a0f['as'],'attributes':_0x2f3a0f[_0x0389('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0389('0xb')](function(_0x535c0e){logger['info'](_0x0389('0x21'),_0x360191);logger[_0x0389('0x1e')]('ShowFreshdeskAccount',_0x360191,JSON['stringify'](_0x535c0e));_0x321cc6(_0x535c0e);})['catch'](function(_0x31a41b){logger[_0x0389('0x11')](_0x0389('0x21'),_0x31a41b[_0x0389('0x12')],_0x360191);_0x451225(_0x303eea[_0x0389('0x11')](0x1f4,_0x31a41b[_0x0389('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index b3e7c96..0dec449 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 _0x9da7=['create','post','put','update','destroy','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags'];(function(_0x500768,_0x470ae4){var _0x523ac5=function(_0x299672){while(--_0x299672){_0x500768['push'](_0x500768['shift']());}};_0x523ac5(++_0x470ae4);}(_0x9da7,0xe6));var _0x79da=function(_0x2a8cb7,_0x314d29){_0x2a8cb7=_0x2a8cb7-0x0;var _0x183a1f=_0x9da7[_0x2a8cb7];return _0x183a1f;};'use strict';var multer=require(_0x79da('0x0'));var util=require('util');var path=require(_0x79da('0x1'));var timeout=require('connect-timeout');var express=require(_0x79da('0x2'));var router=express[_0x79da('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x79da('0x4'));var interaction=require(_0x79da('0x5'));var config=require('../../config/environment');var controller=require(_0x79da('0x6'));router[_0x79da('0x7')]('/',auth[_0x79da('0x8')](),controller[_0x79da('0x9')]);router['get'](_0x79da('0xa'),auth[_0x79da('0x8')](),controller[_0x79da('0xb')]);router[_0x79da('0x7')](_0x79da('0xc'),auth[_0x79da('0x8')](),controller[_0x79da('0xd')]);router[_0x79da('0x7')](_0x79da('0xe'),auth[_0x79da('0x8')](),controller[_0x79da('0xf')]);router[_0x79da('0x7')](_0x79da('0x10'),auth[_0x79da('0x8')](),controller[_0x79da('0x11')]);router[_0x79da('0x7')](_0x79da('0x12'),auth['isAuthenticated'](),controller[_0x79da('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0x79da('0x14')]);router[_0x79da('0x15')]('/:id/tags',auth[_0x79da('0x8')](),controller['setTags']);router[_0x79da('0x16')](_0x79da('0xa'),auth['isAuthenticated'](),controller[_0x79da('0x17')]);router['delete']('/:id',auth[_0x79da('0x8')](),controller[_0x79da('0x18')]);module['exports']=router; \ No newline at end of file +var _0xf7d6=['get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','/:id','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./intFreshdeskConfiguration.controller'];(function(_0x108b66,_0x46f926){var _0x3e3e81=function(_0x9387c){while(--_0x9387c){_0x108b66['push'](_0x108b66['shift']());}};_0x3e3e81(++_0x46f926);}(_0xf7d6,0xb5));var _0x6f7d=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xf7d6[_0x49ca18];return _0x145d54;};'use strict';var multer=require(_0x6f7d('0x0'));var util=require(_0x6f7d('0x1'));var path=require('path');var timeout=require(_0x6f7d('0x2'));var express=require(_0x6f7d('0x3'));var router=express[_0x6f7d('0x4')]();var fs_extra=require(_0x6f7d('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6f7d('0x6'));var controller=require(_0x6f7d('0x7'));router[_0x6f7d('0x8')]('/',auth[_0x6f7d('0x9')](),controller[_0x6f7d('0xa')]);router[_0x6f7d('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x6f7d('0xb')]);router[_0x6f7d('0x8')](_0x6f7d('0xc'),auth[_0x6f7d('0x9')](),controller[_0x6f7d('0xd')]);router['get'](_0x6f7d('0xe'),auth['isAuthenticated'](),controller[_0x6f7d('0xf')]);router[_0x6f7d('0x8')](_0x6f7d('0x10'),auth[_0x6f7d('0x9')](),controller[_0x6f7d('0x11')]);router[_0x6f7d('0x8')](_0x6f7d('0x12'),auth[_0x6f7d('0x9')](),controller[_0x6f7d('0x13')]);router[_0x6f7d('0x14')]('/',auth[_0x6f7d('0x9')](),controller[_0x6f7d('0x15')]);router[_0x6f7d('0x14')](_0x6f7d('0x12'),auth['isAuthenticated'](),controller[_0x6f7d('0x16')]);router[_0x6f7d('0x17')](_0x6f7d('0x18'),auth[_0x6f7d('0x9')](),controller[_0x6f7d('0x19')]);router['delete']('/:id',auth[_0x6f7d('0x9')](),controller['destroy']);module[_0x6f7d('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index b8f217a..ecebd8c 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 _0x2f0f=['sequelize','exports','STRING'];(function(_0x448f46,_0xe5067c){var _0x12878b=function(_0x2f5f50){while(--_0x2f5f50){_0x448f46['push'](_0x448f46['shift']());}};_0x12878b(++_0xe5067c);}(_0x2f0f,0x123));var _0xf2f0=function(_0x1efc8c,_0x46e5ef){_0x1efc8c=_0x1efc8c-0x0;var _0x2f2ace=_0x2f0f[_0x1efc8c];return _0x2f2ace;};'use strict';var Sequelize=require(_0xf2f0('0x0'));module[_0xf2f0('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf2f0('0x2')]}}; \ No newline at end of file +var _0x469c=['exports','STRING'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x469c,0xe4));var _0xc469=function(_0x5d6280,_0x3f72ab){_0x5d6280=_0x5d6280-0x0;var _0x77b738=_0x469c[_0x5d6280];return _0x77b738;};'use strict';var Sequelize=require('sequelize');module[_0xc469('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc469('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index ad0e258..966bf24 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 _0x3cba=['apply','reject','save','update','destroy','then','stack','name','rawAttributes','type','key','model','map','keys','query','filters','attributes','fields','hasOwnProperty','nolimit','where','filter','VIRTUAL','options','FreshdeskConfiguration','includeAll','include','rows','catch','show','intersection','length','merge','find','create','body','params','getFields','findOne','sort','pick','getSubjects','FreshdeskField','getDescriptions','order','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range'];(function(_0x228d4e,_0x2dd698){var _0x1fbc13=function(_0x74bde3){while(--_0x74bde3){_0x228d4e['push'](_0x228d4e['shift']());}};_0x1fbc13(++_0x2dd698);}(_0x3cba,0x85));var _0xa3cb=function(_0x553150,_0x589ff3){_0x553150=_0x553150-0x0;var _0x18193d=_0x3cba[_0x553150];return _0x18193d;};'use strict';var emlformat=require(_0xa3cb('0x0'));var rimraf=require(_0xa3cb('0x1'));var zipdir=require(_0xa3cb('0x2'));var jsonpatch=require(_0xa3cb('0x3'));var rp=require('request-promise');var moment=require(_0xa3cb('0x4'));var BPromise=require(_0xa3cb('0x5'));var Mustache=require('mustache');var util=require(_0xa3cb('0x6'));var path=require(_0xa3cb('0x7'));var sox=require(_0xa3cb('0x8'));var csv=require('to-csv');var ejs=require(_0xa3cb('0x9'));var fs=require('fs');var fs_extra=require(_0xa3cb('0xa'));var _=require(_0xa3cb('0xb'));var squel=require(_0xa3cb('0xc'));var crypto=require(_0xa3cb('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa3cb('0xe'));var toCsv=require(_0xa3cb('0xf'));var querystring=require('querystring');var Papa=require(_0xa3cb('0x10'));var Redis=require('ioredis');var authService=require(_0xa3cb('0x11'));var qs=require(_0xa3cb('0x12'));var as=require(_0xa3cb('0x13'));var hardwareService=require(_0xa3cb('0x14'));var logger=require('../../config/logger')(_0xa3cb('0x15'));var utils=require(_0xa3cb('0x16'));var config=require(_0xa3cb('0x17'));var licenseUtil=require(_0xa3cb('0x18'));var db=require(_0xa3cb('0x19'))['db'];function respondWithStatusCode(_0x423876,_0xb3a72b){_0xb3a72b=_0xb3a72b||0xcc;return function(_0x359eaa){if(_0x359eaa){return _0x423876[_0xa3cb('0x1a')](_0xb3a72b);}return _0x423876[_0xa3cb('0x1b')](_0xb3a72b)[_0xa3cb('0x1c')]();};}function respondWithResult(_0x356f01,_0x46ce1d){_0x46ce1d=_0x46ce1d||0xc8;return function(_0x113f90){if(_0x113f90){return _0x356f01[_0xa3cb('0x1b')](_0x46ce1d)[_0xa3cb('0x1d')](_0x113f90);}};}function respondWithFilteredResult(_0x3e1e95,_0x1fe920){return function(_0x5b6b3b){if(_0x5b6b3b){var _0x860ee5=typeof _0x1fe920[_0xa3cb('0x1e')]==='undefined'&&typeof _0x1fe920[_0xa3cb('0x1f')]===_0xa3cb('0x20');var _0x3afc65=_0x5b6b3b[_0xa3cb('0x21')];var _0x94b32c=_0x860ee5?0x0:_0x1fe920['offset'];var _0x5f4809=_0x860ee5?_0x5b6b3b[_0xa3cb('0x21')]:_0x1fe920['offset']+_0x1fe920[_0xa3cb('0x1f')];var _0x4ac229;if(_0x5f4809>=_0x3afc65){_0x5f4809=_0x3afc65;_0x4ac229=0xc8;}else{_0x4ac229=0xce;}_0x3e1e95['status'](_0x4ac229);return _0x3e1e95['set'](_0xa3cb('0x22'),_0x94b32c+'-'+_0x5f4809+'/'+_0x3afc65)[_0xa3cb('0x1d')](_0x5b6b3b);}return null;};}function patchUpdates(_0x25fa87){return function(_0x1c7cc5){try{jsonpatch[_0xa3cb('0x23')](_0x1c7cc5,_0x25fa87,!![]);}catch(_0x351cf3){return BPromise[_0xa3cb('0x24')](_0x351cf3);}return _0x1c7cc5[_0xa3cb('0x25')]();};}function saveUpdates(_0x26c396,_0x8aa352){return function(_0x288fd9){if(_0x288fd9){return _0x288fd9[_0xa3cb('0x26')](_0x26c396)['then'](function(_0xb73043){return _0xb73043;});}return null;};}function removeEntity(_0x3ccd65,_0x9f1681){return function(_0x2cd0f4){if(_0x2cd0f4){return _0x2cd0f4[_0xa3cb('0x27')]()[_0xa3cb('0x28')](function(){_0x3ccd65['status'](0xcc)[_0xa3cb('0x1c')]();});}};}function handleEntityNotFound(_0x4b51b9,_0x9b1529){return function(_0x116190){if(!_0x116190){_0x4b51b9['sendStatus'](0x194);}return _0x116190;};}function handleError(_0x453d39,_0x2335b9){_0x2335b9=_0x2335b9||0x1f4;return function(_0x5300b6){logger['error'](_0x5300b6[_0xa3cb('0x29')]);if(_0x5300b6[_0xa3cb('0x2a')]){delete _0x5300b6['name'];}_0x453d39[_0xa3cb('0x1b')](_0x2335b9)['send'](_0x5300b6);};}exports['index']=function(_0x7d44ea,_0x5a5157){var _0x4abf61={},_0x3da044={},_0xbcee27={'count':0x0,'rows':[]};var _0x2c793a=_['map'](db['FreshdeskConfiguration'][_0xa3cb('0x2b')],function(_0x309550){return{'name':_0x309550['fieldName'],'type':_0x309550[_0xa3cb('0x2c')][_0xa3cb('0x2d')]};});_0x3da044[_0xa3cb('0x2e')]=_[_0xa3cb('0x2f')](_0x2c793a,_0xa3cb('0x2a'));_0x3da044['query']=_[_0xa3cb('0x30')](_0x7d44ea[_0xa3cb('0x31')]);_0x3da044[_0xa3cb('0x32')]=_['intersection'](_0x3da044[_0xa3cb('0x2e')],_0x3da044['query']);_0x4abf61[_0xa3cb('0x33')]=_['intersection'](_0x3da044[_0xa3cb('0x2e')],qs[_0xa3cb('0x34')](_0x7d44ea[_0xa3cb('0x31')][_0xa3cb('0x34')]));_0x4abf61[_0xa3cb('0x33')]=_0x4abf61['attributes']['length']?_0x4abf61[_0xa3cb('0x33')]:_0x3da044['model'];if(!_0x7d44ea[_0xa3cb('0x31')][_0xa3cb('0x35')](_0xa3cb('0x36'))){_0x4abf61[_0xa3cb('0x1f')]=qs['limit'](_0x7d44ea[_0xa3cb('0x31')][_0xa3cb('0x1f')]);_0x4abf61['offset']=qs[_0xa3cb('0x1e')](_0x7d44ea[_0xa3cb('0x31')]['offset']);}_0x4abf61['order']=qs['sort'](_0x7d44ea[_0xa3cb('0x31')]['sort']);_0x4abf61[_0xa3cb('0x37')]=qs['filters'](_['pick'](_0x7d44ea[_0xa3cb('0x31')],_0x3da044['filters']),_0x2c793a);if(_0x7d44ea[_0xa3cb('0x31')][_0xa3cb('0x38')]){_0x4abf61[_0xa3cb('0x37')]=_['merge'](_0x4abf61[_0xa3cb('0x37')],{'$or':_[_0xa3cb('0x2f')](_0x2c793a,function(_0x211535){if(_0x211535[_0xa3cb('0x2c')]!==_0xa3cb('0x39')){var _0x51f310={};_0x51f310[_0x211535[_0xa3cb('0x2a')]]={'$like':'%'+_0x7d44ea['query'][_0xa3cb('0x38')]+'%'};return _0x51f310;}})});}_0x4abf61=_['merge']({},_0x4abf61,_0x7d44ea[_0xa3cb('0x3a')]);var _0x30fd1a={'where':_0x4abf61[_0xa3cb('0x37')]};return db[_0xa3cb('0x3b')][_0xa3cb('0x21')](_0x30fd1a)[_0xa3cb('0x28')](function(_0x14f856){_0xbcee27[_0xa3cb('0x21')]=_0x14f856;if(_0x7d44ea[_0xa3cb('0x31')][_0xa3cb('0x3c')]){_0x4abf61[_0xa3cb('0x3d')]=[{'all':!![]}];}return db['FreshdeskConfiguration']['findAll'](_0x4abf61);})['then'](function(_0x501788){_0xbcee27[_0xa3cb('0x3e')]=_0x501788;return _0xbcee27;})[_0xa3cb('0x28')](respondWithFilteredResult(_0x5a5157,_0x4abf61))[_0xa3cb('0x3f')](handleError(_0x5a5157,null));};exports[_0xa3cb('0x40')]=function(_0x51dcaa,_0x457bb6){var _0x4599e4={'raw':![],'where':{'id':_0x51dcaa['params']['id']}},_0x4af042={};_0x4af042[_0xa3cb('0x2e')]=_[_0xa3cb('0x30')](db[_0xa3cb('0x3b')][_0xa3cb('0x2b')]);_0x4af042[_0xa3cb('0x31')]=_[_0xa3cb('0x30')](_0x51dcaa[_0xa3cb('0x31')]);_0x4af042[_0xa3cb('0x32')]=_[_0xa3cb('0x41')](_0x4af042[_0xa3cb('0x2e')],_0x4af042['query']);_0x4599e4[_0xa3cb('0x33')]=_['intersection'](_0x4af042['model'],qs['fields'](_0x51dcaa[_0xa3cb('0x31')]['fields']));_0x4599e4[_0xa3cb('0x33')]=_0x4599e4[_0xa3cb('0x33')][_0xa3cb('0x42')]?_0x4599e4['attributes']:_0x4af042[_0xa3cb('0x2e')];if(_0x51dcaa[_0xa3cb('0x31')]['includeAll']){_0x4599e4[_0xa3cb('0x3d')]=[{'all':!![]}];}_0x4599e4=_[_0xa3cb('0x43')]({},_0x4599e4,_0x51dcaa['options']);return db[_0xa3cb('0x3b')][_0xa3cb('0x44')](_0x4599e4)[_0xa3cb('0x28')](handleEntityNotFound(_0x457bb6,null))[_0xa3cb('0x28')](respondWithResult(_0x457bb6,null))['catch'](handleError(_0x457bb6,null));};exports[_0xa3cb('0x45')]=function(_0x43a638,_0x26c7fa){return db[_0xa3cb('0x3b')][_0xa3cb('0x45')](_0x43a638[_0xa3cb('0x46')],{})['then'](respondWithResult(_0x26c7fa,0xc9))[_0xa3cb('0x3f')](handleError(_0x26c7fa,null));};exports[_0xa3cb('0x26')]=function(_0x5327a6,_0x3a671e){if(_0x5327a6[_0xa3cb('0x46')]['id']){delete _0x5327a6[_0xa3cb('0x46')]['id'];}return db[_0xa3cb('0x3b')][_0xa3cb('0x44')]({'where':{'id':_0x5327a6[_0xa3cb('0x47')]['id']}})[_0xa3cb('0x28')](handleEntityNotFound(_0x3a671e,null))[_0xa3cb('0x28')](saveUpdates(_0x5327a6[_0xa3cb('0x46')],null))[_0xa3cb('0x28')](respondWithResult(_0x3a671e,null))[_0xa3cb('0x3f')](handleError(_0x3a671e,null));};exports[_0xa3cb('0x27')]=function(_0x1d526d,_0x18c8c9){return db[_0xa3cb('0x3b')][_0xa3cb('0x44')]({'where':{'id':_0x1d526d[_0xa3cb('0x47')]['id']}})[_0xa3cb('0x28')](handleEntityNotFound(_0x18c8c9,null))[_0xa3cb('0x28')](removeEntity(_0x18c8c9,null))[_0xa3cb('0x3f')](handleError(_0x18c8c9,null));};exports[_0xa3cb('0x48')]=function(_0x869f5d,_0x974760,_0x3482c1){var _0x22a569={};var _0x3c86a4={};var _0x2feecb;var _0x4fb0a7;return db['FreshdeskConfiguration'][_0xa3cb('0x49')]({'where':{'id':_0x869f5d[_0xa3cb('0x47')]['id']}})[_0xa3cb('0x28')](handleEntityNotFound(_0x974760,null))['then'](function(_0x1da47b){if(_0x1da47b){_0x2feecb=_0x1da47b;_0x3c86a4[_0xa3cb('0x2e')]=_[_0xa3cb('0x30')](db['FreshdeskField'][_0xa3cb('0x2b')]);_0x3c86a4[_0xa3cb('0x31')]=_[_0xa3cb('0x30')](_0x869f5d[_0xa3cb('0x31')]);_0x3c86a4[_0xa3cb('0x32')]=_[_0xa3cb('0x41')](_0x3c86a4[_0xa3cb('0x2e')],_0x3c86a4[_0xa3cb('0x31')]);_0x22a569[_0xa3cb('0x33')]=_[_0xa3cb('0x41')](_0x3c86a4['model'],qs['fields'](_0x869f5d['query'][_0xa3cb('0x34')]));_0x22a569['attributes']=_0x22a569['attributes'][_0xa3cb('0x42')]?_0x22a569[_0xa3cb('0x33')]:_0x3c86a4[_0xa3cb('0x2e')];_0x22a569['order']=qs[_0xa3cb('0x4a')](_0x869f5d[_0xa3cb('0x31')][_0xa3cb('0x4a')]);_0x22a569[_0xa3cb('0x37')]=qs[_0xa3cb('0x32')](_[_0xa3cb('0x4b')](_0x869f5d[_0xa3cb('0x31')],_0x3c86a4[_0xa3cb('0x32')]));if(_0x869f5d['query'][_0xa3cb('0x38')]){_0x22a569['where']=_[_0xa3cb('0x43')](_0x22a569[_0xa3cb('0x37')],{'$or':_[_0xa3cb('0x2f')](_0x22a569['attributes'],function(_0x1629d0){var _0x93dd53={};_0x93dd53[_0x1629d0]={'$like':'%'+_0x869f5d[_0xa3cb('0x31')][_0xa3cb('0x38')]+'%'};return _0x93dd53;})});}_0x22a569=_[_0xa3cb('0x43')]({},_0x22a569,_0x869f5d['options']);return _0x2feecb['getFields'](_0x22a569);}})[_0xa3cb('0x28')](function(_0x20d737){if(_0x20d737){_0x4fb0a7=_0x20d737[_0xa3cb('0x42')];if(!_0x869f5d[_0xa3cb('0x31')]['hasOwnProperty'](_0xa3cb('0x36'))){_0x22a569[_0xa3cb('0x1f')]=qs[_0xa3cb('0x1f')](_0x869f5d['query'][_0xa3cb('0x1f')]);_0x22a569[_0xa3cb('0x1e')]=qs[_0xa3cb('0x1e')](_0x869f5d['query'][_0xa3cb('0x1e')]);}return _0x2feecb[_0xa3cb('0x48')](_0x22a569);}})[_0xa3cb('0x28')](function(_0x2a8f29){if(_0x2a8f29){return _0x2a8f29?{'count':_0x4fb0a7,'rows':_0x2a8f29}:null;}})[_0xa3cb('0x28')](respondWithResult(_0x974760,null))['catch'](handleError(_0x974760,null));};exports[_0xa3cb('0x4c')]=function(_0x4c43e6,_0x1c0480,_0x1ca771){var _0x416657={};var _0x55d4d9={};var _0x27153b;var _0x52b0ff;return db[_0xa3cb('0x3b')][_0xa3cb('0x49')]({'where':{'id':_0x4c43e6[_0xa3cb('0x47')]['id']}})[_0xa3cb('0x28')](handleEntityNotFound(_0x1c0480,null))['then'](function(_0x394ac3){if(_0x394ac3){_0x27153b=_0x394ac3;_0x55d4d9[_0xa3cb('0x2e')]=_[_0xa3cb('0x30')](db[_0xa3cb('0x4d')][_0xa3cb('0x2b')]);_0x55d4d9[_0xa3cb('0x31')]=_[_0xa3cb('0x30')](_0x4c43e6[_0xa3cb('0x31')]);_0x55d4d9[_0xa3cb('0x32')]=_[_0xa3cb('0x41')](_0x55d4d9[_0xa3cb('0x2e')],_0x55d4d9[_0xa3cb('0x31')]);_0x416657['attributes']=_[_0xa3cb('0x41')](_0x55d4d9[_0xa3cb('0x2e')],qs[_0xa3cb('0x34')](_0x4c43e6[_0xa3cb('0x31')][_0xa3cb('0x34')]));_0x416657['attributes']=_0x416657[_0xa3cb('0x33')][_0xa3cb('0x42')]?_0x416657[_0xa3cb('0x33')]:_0x55d4d9[_0xa3cb('0x2e')];_0x416657['order']=qs[_0xa3cb('0x4a')](_0x4c43e6[_0xa3cb('0x31')][_0xa3cb('0x4a')]);_0x416657[_0xa3cb('0x37')]=qs['filters'](_[_0xa3cb('0x4b')](_0x4c43e6[_0xa3cb('0x31')],_0x55d4d9[_0xa3cb('0x32')]));if(_0x4c43e6[_0xa3cb('0x31')][_0xa3cb('0x38')]){_0x416657[_0xa3cb('0x37')]=_[_0xa3cb('0x43')](_0x416657[_0xa3cb('0x37')],{'$or':_[_0xa3cb('0x2f')](_0x416657[_0xa3cb('0x33')],function(_0x4140cf){var _0x3d8166={};_0x3d8166[_0x4140cf]={'$like':'%'+_0x4c43e6['query'][_0xa3cb('0x38')]+'%'};return _0x3d8166;})});}_0x416657=_[_0xa3cb('0x43')]({},_0x416657,_0x4c43e6['options']);return _0x27153b[_0xa3cb('0x4c')](_0x416657);}})[_0xa3cb('0x28')](function(_0x465a2c){if(_0x465a2c){_0x52b0ff=_0x465a2c[_0xa3cb('0x42')];if(!_0x4c43e6[_0xa3cb('0x31')][_0xa3cb('0x35')](_0xa3cb('0x36'))){_0x416657[_0xa3cb('0x1f')]=qs[_0xa3cb('0x1f')](_0x4c43e6[_0xa3cb('0x31')][_0xa3cb('0x1f')]);_0x416657['offset']=qs[_0xa3cb('0x1e')](_0x4c43e6['query'][_0xa3cb('0x1e')]);}return _0x27153b[_0xa3cb('0x4c')](_0x416657);}})[_0xa3cb('0x28')](function(_0x9b151e){if(_0x9b151e){return _0x9b151e?{'count':_0x52b0ff,'rows':_0x9b151e}:null;}})[_0xa3cb('0x28')](respondWithResult(_0x1c0480,null))[_0xa3cb('0x3f')](handleError(_0x1c0480,null));};exports[_0xa3cb('0x4e')]=function(_0x590e1e,_0x5115c1,_0x1889cb){var _0x4ec137={};var _0x172ee0={};var _0xeadbc9;var _0x3ada4b;return db[_0xa3cb('0x3b')][_0xa3cb('0x49')]({'where':{'id':_0x590e1e[_0xa3cb('0x47')]['id']}})[_0xa3cb('0x28')](handleEntityNotFound(_0x5115c1,null))[_0xa3cb('0x28')](function(_0x1f2bf2){if(_0x1f2bf2){_0xeadbc9=_0x1f2bf2;_0x172ee0[_0xa3cb('0x2e')]=_[_0xa3cb('0x30')](db[_0xa3cb('0x4d')]['rawAttributes']);_0x172ee0[_0xa3cb('0x31')]=_[_0xa3cb('0x30')](_0x590e1e[_0xa3cb('0x31')]);_0x172ee0[_0xa3cb('0x32')]=_[_0xa3cb('0x41')](_0x172ee0[_0xa3cb('0x2e')],_0x172ee0[_0xa3cb('0x31')]);_0x4ec137['attributes']=_['intersection'](_0x172ee0[_0xa3cb('0x2e')],qs['fields'](_0x590e1e['query'][_0xa3cb('0x34')]));_0x4ec137['attributes']=_0x4ec137[_0xa3cb('0x33')][_0xa3cb('0x42')]?_0x4ec137[_0xa3cb('0x33')]:_0x172ee0['model'];_0x4ec137[_0xa3cb('0x4f')]=qs[_0xa3cb('0x4a')](_0x590e1e[_0xa3cb('0x31')]['sort']);_0x4ec137[_0xa3cb('0x37')]=qs[_0xa3cb('0x32')](_[_0xa3cb('0x4b')](_0x590e1e[_0xa3cb('0x31')],_0x172ee0['filters']));if(_0x590e1e[_0xa3cb('0x31')][_0xa3cb('0x38')]){_0x4ec137[_0xa3cb('0x37')]=_[_0xa3cb('0x43')](_0x4ec137['where'],{'$or':_[_0xa3cb('0x2f')](_0x4ec137[_0xa3cb('0x33')],function(_0x105fcf){var _0x5ede92={};_0x5ede92[_0x105fcf]={'$like':'%'+_0x590e1e[_0xa3cb('0x31')][_0xa3cb('0x38')]+'%'};return _0x5ede92;})});}_0x4ec137=_['merge']({},_0x4ec137,_0x590e1e[_0xa3cb('0x3a')]);return _0xeadbc9[_0xa3cb('0x4e')](_0x4ec137);}})['then'](function(_0x2686a2){if(_0x2686a2){_0x3ada4b=_0x2686a2[_0xa3cb('0x42')];if(!_0x590e1e[_0xa3cb('0x31')][_0xa3cb('0x35')](_0xa3cb('0x36'))){_0x4ec137[_0xa3cb('0x1f')]=qs[_0xa3cb('0x1f')](_0x590e1e[_0xa3cb('0x31')]['limit']);_0x4ec137[_0xa3cb('0x1e')]=qs['offset'](_0x590e1e[_0xa3cb('0x31')]['offset']);}return _0xeadbc9['getDescriptions'](_0x4ec137);}})[_0xa3cb('0x28')](function(_0x55acfd){if(_0x55acfd){return _0x55acfd?{'count':_0x3ada4b,'rows':_0x55acfd}:null;}})['then'](respondWithResult(_0x5115c1,null))['catch'](handleError(_0x5115c1,null));};exports[_0xa3cb('0x50')]=function(_0xa99d64,_0x27d5a2,_0x233c42){var _0x11ef13={};var _0x5cafb1={};var _0x31e2a3;var _0x274e10;return db[_0xa3cb('0x3b')][_0xa3cb('0x49')]({'where':{'id':_0xa99d64['params']['id']}})[_0xa3cb('0x28')](handleEntityNotFound(_0x27d5a2,null))[_0xa3cb('0x28')](function(_0x30f888){if(_0x30f888){_0x31e2a3=_0x30f888;_0x5cafb1[_0xa3cb('0x2e')]=_[_0xa3cb('0x30')](db[_0xa3cb('0x51')][_0xa3cb('0x2b')]);_0x5cafb1[_0xa3cb('0x31')]=_['keys'](_0xa99d64[_0xa3cb('0x31')]);_0x5cafb1['filters']=_[_0xa3cb('0x41')](_0x5cafb1['model'],_0x5cafb1[_0xa3cb('0x31')]);_0x11ef13['attributes']=_[_0xa3cb('0x41')](_0x5cafb1[_0xa3cb('0x2e')],qs['fields'](_0xa99d64[_0xa3cb('0x31')][_0xa3cb('0x34')]));_0x11ef13[_0xa3cb('0x33')]=_0x11ef13[_0xa3cb('0x33')][_0xa3cb('0x42')]?_0x11ef13[_0xa3cb('0x33')]:_0x5cafb1[_0xa3cb('0x2e')];_0x11ef13[_0xa3cb('0x4f')]=qs['sort'](_0xa99d64['query'][_0xa3cb('0x4a')]);_0x11ef13['where']=qs[_0xa3cb('0x32')](_['pick'](_0xa99d64['query'],_0x5cafb1[_0xa3cb('0x32')]));if(_0xa99d64[_0xa3cb('0x31')][_0xa3cb('0x38')]){_0x11ef13[_0xa3cb('0x37')]=_['merge'](_0x11ef13[_0xa3cb('0x37')],{'$or':_[_0xa3cb('0x2f')](_0x11ef13[_0xa3cb('0x33')],function(_0x1d5ff9){var _0x789ec4={};_0x789ec4[_0x1d5ff9]={'$like':'%'+_0xa99d64[_0xa3cb('0x31')][_0xa3cb('0x38')]+'%'};return _0x789ec4;})});}_0x11ef13=_[_0xa3cb('0x43')]({},_0x11ef13,_0xa99d64[_0xa3cb('0x3a')]);return _0x31e2a3['getTags'](_0x11ef13);}})[_0xa3cb('0x28')](function(_0x3efd26){if(_0x3efd26){_0x274e10=_0x3efd26['length'];if(!_0xa99d64[_0xa3cb('0x31')][_0xa3cb('0x35')](_0xa3cb('0x36'))){_0x11ef13[_0xa3cb('0x1f')]=qs[_0xa3cb('0x1f')](_0xa99d64[_0xa3cb('0x31')][_0xa3cb('0x1f')]);_0x11ef13['offset']=qs[_0xa3cb('0x1e')](_0xa99d64[_0xa3cb('0x31')]['offset']);}return _0x31e2a3[_0xa3cb('0x50')](_0x11ef13);}})[_0xa3cb('0x28')](function(_0x15f8bb){if(_0x15f8bb){return _0x15f8bb?{'count':_0x274e10,'rows':_0x15f8bb}:null;}})[_0xa3cb('0x28')](respondWithResult(_0x27d5a2,null))['catch'](handleError(_0x27d5a2,null));};exports[_0xa3cb('0x52')]=function(_0x225e0e,_0x2d8f34,_0x5f5022){if(_0x225e0e[_0xa3cb('0x46')]['id']){delete _0x225e0e['body']['id'];}return db[_0xa3cb('0x3b')][_0xa3cb('0x49')]({'where':{'id':_0x225e0e['params']['id']}})['then'](handleEntityNotFound(_0x2d8f34,null))['then'](function(_0x572744){if(_0x572744){return _0x572744['setTags'](_0x225e0e[_0xa3cb('0x46')][_0xa3cb('0x53')]||[]);}return null;})[_0xa3cb('0x28')](respondWithResult(_0x2d8f34,null))[_0xa3cb('0x3f')](handleError(_0x2d8f34,null));}; \ No newline at end of file +var _0x1d3c=['path','sox','fs-extra','squel','crypto','jsforce','to-csv','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','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','send','index','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','map','VIRTUAL','name','filter','options','includeAll','include','rows','catch','show','params','length','find','create','body','getFields','findOne','FreshdeskField','getSubjects','hasOwnProperty','getDescriptions','getTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x53aebc,_0x1f4960){var _0x2cf45d=function(_0xf5f345){while(--_0xf5f345){_0x53aebc['push'](_0x53aebc['shift']());}};_0x2cf45d(++_0x1f4960);}(_0x1d3c,0xa6));var _0xc1d3=function(_0x2742db,_0x58e00c){_0x2742db=_0x2742db-0x0;var _0x18659e=_0x1d3c[_0x2742db];return _0x18659e;};'use strict';var emlformat=require(_0xc1d3('0x0'));var rimraf=require(_0xc1d3('0x1'));var zipdir=require(_0xc1d3('0x2'));var jsonpatch=require(_0xc1d3('0x3'));var rp=require(_0xc1d3('0x4'));var moment=require('moment');var BPromise=require(_0xc1d3('0x5'));var Mustache=require(_0xc1d3('0x6'));var util=require(_0xc1d3('0x7'));var path=require(_0xc1d3('0x8'));var sox=require(_0xc1d3('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc1d3('0xa'));var _=require('lodash');var squel=require(_0xc1d3('0xb'));var crypto=require(_0xc1d3('0xc'));var jsforce=require(_0xc1d3('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc1d3('0xe'));var querystring=require('querystring');var Papa=require(_0xc1d3('0xf'));var Redis=require(_0xc1d3('0x10'));var authService=require(_0xc1d3('0x11'));var qs=require(_0xc1d3('0x12'));var as=require(_0xc1d3('0x13'));var hardwareService=require(_0xc1d3('0x14'));var logger=require(_0xc1d3('0x15'))(_0xc1d3('0x16'));var utils=require(_0xc1d3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc1d3('0x18'));var db=require(_0xc1d3('0x19'))['db'];function respondWithStatusCode(_0x1ac42a,_0x41dbd4){_0x41dbd4=_0x41dbd4||0xcc;return function(_0x588903){if(_0x588903){return _0x1ac42a[_0xc1d3('0x1a')](_0x41dbd4);}return _0x1ac42a[_0xc1d3('0x1b')](_0x41dbd4)[_0xc1d3('0x1c')]();};}function respondWithResult(_0x50e554,_0x28b80a){_0x28b80a=_0x28b80a||0xc8;return function(_0xf7b513){if(_0xf7b513){return _0x50e554[_0xc1d3('0x1b')](_0x28b80a)[_0xc1d3('0x1d')](_0xf7b513);}};}function respondWithFilteredResult(_0x411330,_0x2015c5){return function(_0xb0440e){if(_0xb0440e){var _0x232e11=typeof _0x2015c5[_0xc1d3('0x1e')]===_0xc1d3('0x1f')&&typeof _0x2015c5['limit']===_0xc1d3('0x1f');var _0x4e7f3b=_0xb0440e['count'];var _0x316dce=_0x232e11?0x0:_0x2015c5['offset'];var _0x103f65=_0x232e11?_0xb0440e[_0xc1d3('0x20')]:_0x2015c5[_0xc1d3('0x1e')]+_0x2015c5[_0xc1d3('0x21')];var _0x35dd9e;if(_0x103f65>=_0x4e7f3b){_0x103f65=_0x4e7f3b;_0x35dd9e=0xc8;}else{_0x35dd9e=0xce;}_0x411330[_0xc1d3('0x1b')](_0x35dd9e);return _0x411330[_0xc1d3('0x22')](_0xc1d3('0x23'),_0x316dce+'-'+_0x103f65+'/'+_0x4e7f3b)[_0xc1d3('0x1d')](_0xb0440e);}return null;};}function patchUpdates(_0x5d52c8){return function(_0x5aa2dd){try{jsonpatch[_0xc1d3('0x24')](_0x5aa2dd,_0x5d52c8,!![]);}catch(_0x4b4ee1){return BPromise[_0xc1d3('0x25')](_0x4b4ee1);}return _0x5aa2dd[_0xc1d3('0x26')]();};}function saveUpdates(_0x9738cc,_0x131881){return function(_0xabd422){if(_0xabd422){return _0xabd422[_0xc1d3('0x27')](_0x9738cc)['then'](function(_0x97a64c){return _0x97a64c;});}return null;};}function removeEntity(_0x300d30,_0x5bd7f8){return function(_0x12bfcc){if(_0x12bfcc){return _0x12bfcc[_0xc1d3('0x28')]()[_0xc1d3('0x29')](function(){_0x300d30['status'](0xcc)[_0xc1d3('0x1c')]();});}};}function handleEntityNotFound(_0x2fe140,_0x1956c6){return function(_0x462ed7){if(!_0x462ed7){_0x2fe140['sendStatus'](0x194);}return _0x462ed7;};}function handleError(_0x2fbd01,_0x12d714){_0x12d714=_0x12d714||0x1f4;return function(_0x17a3c0){logger[_0xc1d3('0x2a')](_0x17a3c0[_0xc1d3('0x2b')]);if(_0x17a3c0['name']){delete _0x17a3c0['name'];}_0x2fbd01[_0xc1d3('0x1b')](_0x12d714)[_0xc1d3('0x2c')](_0x17a3c0);};}exports[_0xc1d3('0x2d')]=function(_0x5cd051,_0x3f5f8b){var _0x2bf167={},_0x1f1335={},_0x1cd1f8={'count':0x0,'rows':[]};var _0x395be4=_['map'](db[_0xc1d3('0x2e')][_0xc1d3('0x2f')],function(_0x385d0b){return{'name':_0x385d0b[_0xc1d3('0x30')],'type':_0x385d0b[_0xc1d3('0x31')][_0xc1d3('0x32')]};});_0x1f1335[_0xc1d3('0x33')]=_['map'](_0x395be4,'name');_0x1f1335['query']=_[_0xc1d3('0x34')](_0x5cd051[_0xc1d3('0x35')]);_0x1f1335[_0xc1d3('0x36')]=_[_0xc1d3('0x37')](_0x1f1335[_0xc1d3('0x33')],_0x1f1335[_0xc1d3('0x35')]);_0x2bf167[_0xc1d3('0x38')]=_[_0xc1d3('0x37')](_0x1f1335[_0xc1d3('0x33')],qs[_0xc1d3('0x39')](_0x5cd051[_0xc1d3('0x35')][_0xc1d3('0x39')]));_0x2bf167[_0xc1d3('0x38')]=_0x2bf167['attributes']['length']?_0x2bf167[_0xc1d3('0x38')]:_0x1f1335[_0xc1d3('0x33')];if(!_0x5cd051[_0xc1d3('0x35')]['hasOwnProperty'](_0xc1d3('0x3a'))){_0x2bf167['limit']=qs[_0xc1d3('0x21')](_0x5cd051[_0xc1d3('0x35')][_0xc1d3('0x21')]);_0x2bf167[_0xc1d3('0x1e')]=qs['offset'](_0x5cd051[_0xc1d3('0x35')][_0xc1d3('0x1e')]);}_0x2bf167[_0xc1d3('0x3b')]=qs['sort'](_0x5cd051[_0xc1d3('0x35')][_0xc1d3('0x3c')]);_0x2bf167[_0xc1d3('0x3d')]=qs[_0xc1d3('0x36')](_[_0xc1d3('0x3e')](_0x5cd051[_0xc1d3('0x35')],_0x1f1335[_0xc1d3('0x36')]),_0x395be4);if(_0x5cd051['query']['filter']){_0x2bf167[_0xc1d3('0x3d')]=_[_0xc1d3('0x3f')](_0x2bf167[_0xc1d3('0x3d')],{'$or':_[_0xc1d3('0x40')](_0x395be4,function(_0x56a3ec){if(_0x56a3ec[_0xc1d3('0x31')]!==_0xc1d3('0x41')){var _0x34a6e8={};_0x34a6e8[_0x56a3ec[_0xc1d3('0x42')]]={'$like':'%'+_0x5cd051['query'][_0xc1d3('0x43')]+'%'};return _0x34a6e8;}})});}_0x2bf167=_['merge']({},_0x2bf167,_0x5cd051[_0xc1d3('0x44')]);var _0x177b3a={'where':_0x2bf167[_0xc1d3('0x3d')]};return db[_0xc1d3('0x2e')][_0xc1d3('0x20')](_0x177b3a)['then'](function(_0x2349e0){_0x1cd1f8['count']=_0x2349e0;if(_0x5cd051[_0xc1d3('0x35')][_0xc1d3('0x45')]){_0x2bf167[_0xc1d3('0x46')]=[{'all':!![]}];}return db[_0xc1d3('0x2e')]['findAll'](_0x2bf167);})[_0xc1d3('0x29')](function(_0x2fff8a){_0x1cd1f8[_0xc1d3('0x47')]=_0x2fff8a;return _0x1cd1f8;})[_0xc1d3('0x29')](respondWithFilteredResult(_0x3f5f8b,_0x2bf167))[_0xc1d3('0x48')](handleError(_0x3f5f8b,null));};exports[_0xc1d3('0x49')]=function(_0xba1fb4,_0x7f6c1a){var _0x13a69c={'raw':![],'where':{'id':_0xba1fb4[_0xc1d3('0x4a')]['id']}},_0x332898={};_0x332898['model']=_[_0xc1d3('0x34')](db[_0xc1d3('0x2e')][_0xc1d3('0x2f')]);_0x332898[_0xc1d3('0x35')]=_[_0xc1d3('0x34')](_0xba1fb4[_0xc1d3('0x35')]);_0x332898[_0xc1d3('0x36')]=_[_0xc1d3('0x37')](_0x332898[_0xc1d3('0x33')],_0x332898[_0xc1d3('0x35')]);_0x13a69c[_0xc1d3('0x38')]=_[_0xc1d3('0x37')](_0x332898['model'],qs[_0xc1d3('0x39')](_0xba1fb4[_0xc1d3('0x35')][_0xc1d3('0x39')]));_0x13a69c[_0xc1d3('0x38')]=_0x13a69c[_0xc1d3('0x38')][_0xc1d3('0x4b')]?_0x13a69c['attributes']:_0x332898[_0xc1d3('0x33')];if(_0xba1fb4[_0xc1d3('0x35')][_0xc1d3('0x45')]){_0x13a69c['include']=[{'all':!![]}];}_0x13a69c=_['merge']({},_0x13a69c,_0xba1fb4[_0xc1d3('0x44')]);return db[_0xc1d3('0x2e')][_0xc1d3('0x4c')](_0x13a69c)[_0xc1d3('0x29')](handleEntityNotFound(_0x7f6c1a,null))['then'](respondWithResult(_0x7f6c1a,null))[_0xc1d3('0x48')](handleError(_0x7f6c1a,null));};exports[_0xc1d3('0x4d')]=function(_0x2c54a5,_0x297f1d){return db['FreshdeskConfiguration'][_0xc1d3('0x4d')](_0x2c54a5[_0xc1d3('0x4e')],{})[_0xc1d3('0x29')](respondWithResult(_0x297f1d,0xc9))[_0xc1d3('0x48')](handleError(_0x297f1d,null));};exports[_0xc1d3('0x27')]=function(_0x2bb274,_0x343251){if(_0x2bb274[_0xc1d3('0x4e')]['id']){delete _0x2bb274[_0xc1d3('0x4e')]['id'];}return db['FreshdeskConfiguration'][_0xc1d3('0x4c')]({'where':{'id':_0x2bb274[_0xc1d3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x343251,null))['then'](saveUpdates(_0x2bb274[_0xc1d3('0x4e')],null))[_0xc1d3('0x29')](respondWithResult(_0x343251,null))['catch'](handleError(_0x343251,null));};exports['destroy']=function(_0x34a937,_0x24678f){return db[_0xc1d3('0x2e')][_0xc1d3('0x4c')]({'where':{'id':_0x34a937[_0xc1d3('0x4a')]['id']}})[_0xc1d3('0x29')](handleEntityNotFound(_0x24678f,null))[_0xc1d3('0x29')](removeEntity(_0x24678f,null))[_0xc1d3('0x48')](handleError(_0x24678f,null));};exports[_0xc1d3('0x4f')]=function(_0x28e5dd,_0x3aac2c,_0x203b45){var _0x3962c5={};var _0x3f123a={};var _0x52da19;var _0xb1bcf;return db['FreshdeskConfiguration'][_0xc1d3('0x50')]({'where':{'id':_0x28e5dd['params']['id']}})[_0xc1d3('0x29')](handleEntityNotFound(_0x3aac2c,null))[_0xc1d3('0x29')](function(_0x3b4a8b){if(_0x3b4a8b){_0x52da19=_0x3b4a8b;_0x3f123a['model']=_[_0xc1d3('0x34')](db[_0xc1d3('0x51')][_0xc1d3('0x2f')]);_0x3f123a[_0xc1d3('0x35')]=_[_0xc1d3('0x34')](_0x28e5dd[_0xc1d3('0x35')]);_0x3f123a['filters']=_['intersection'](_0x3f123a[_0xc1d3('0x33')],_0x3f123a['query']);_0x3962c5[_0xc1d3('0x38')]=_[_0xc1d3('0x37')](_0x3f123a[_0xc1d3('0x33')],qs[_0xc1d3('0x39')](_0x28e5dd[_0xc1d3('0x35')][_0xc1d3('0x39')]));_0x3962c5[_0xc1d3('0x38')]=_0x3962c5[_0xc1d3('0x38')][_0xc1d3('0x4b')]?_0x3962c5['attributes']:_0x3f123a[_0xc1d3('0x33')];_0x3962c5[_0xc1d3('0x3b')]=qs['sort'](_0x28e5dd[_0xc1d3('0x35')][_0xc1d3('0x3c')]);_0x3962c5[_0xc1d3('0x3d')]=qs['filters'](_[_0xc1d3('0x3e')](_0x28e5dd[_0xc1d3('0x35')],_0x3f123a['filters']));if(_0x28e5dd[_0xc1d3('0x35')][_0xc1d3('0x43')]){_0x3962c5[_0xc1d3('0x3d')]=_['merge'](_0x3962c5[_0xc1d3('0x3d')],{'$or':_[_0xc1d3('0x40')](_0x3962c5[_0xc1d3('0x38')],function(_0x3c1788){var _0x20ef9c={};_0x20ef9c[_0x3c1788]={'$like':'%'+_0x28e5dd['query'][_0xc1d3('0x43')]+'%'};return _0x20ef9c;})});}_0x3962c5=_[_0xc1d3('0x3f')]({},_0x3962c5,_0x28e5dd[_0xc1d3('0x44')]);return _0x52da19[_0xc1d3('0x4f')](_0x3962c5);}})[_0xc1d3('0x29')](function(_0x3541de){if(_0x3541de){_0xb1bcf=_0x3541de[_0xc1d3('0x4b')];if(!_0x28e5dd[_0xc1d3('0x35')]['hasOwnProperty'](_0xc1d3('0x3a'))){_0x3962c5['limit']=qs['limit'](_0x28e5dd[_0xc1d3('0x35')][_0xc1d3('0x21')]);_0x3962c5[_0xc1d3('0x1e')]=qs[_0xc1d3('0x1e')](_0x28e5dd[_0xc1d3('0x35')]['offset']);}return _0x52da19[_0xc1d3('0x4f')](_0x3962c5);}})[_0xc1d3('0x29')](function(_0xb0200a){if(_0xb0200a){return _0xb0200a?{'count':_0xb1bcf,'rows':_0xb0200a}:null;}})[_0xc1d3('0x29')](respondWithResult(_0x3aac2c,null))['catch'](handleError(_0x3aac2c,null));};exports[_0xc1d3('0x52')]=function(_0x2cee07,_0x4561dd,_0x637026){var _0x75612d={};var _0x158a76={};var _0x4a1b44;var _0x589195;return db[_0xc1d3('0x2e')][_0xc1d3('0x50')]({'where':{'id':_0x2cee07[_0xc1d3('0x4a')]['id']}})[_0xc1d3('0x29')](handleEntityNotFound(_0x4561dd,null))[_0xc1d3('0x29')](function(_0x273c36){if(_0x273c36){_0x4a1b44=_0x273c36;_0x158a76[_0xc1d3('0x33')]=_[_0xc1d3('0x34')](db[_0xc1d3('0x51')][_0xc1d3('0x2f')]);_0x158a76[_0xc1d3('0x35')]=_[_0xc1d3('0x34')](_0x2cee07[_0xc1d3('0x35')]);_0x158a76['filters']=_[_0xc1d3('0x37')](_0x158a76[_0xc1d3('0x33')],_0x158a76[_0xc1d3('0x35')]);_0x75612d[_0xc1d3('0x38')]=_[_0xc1d3('0x37')](_0x158a76[_0xc1d3('0x33')],qs[_0xc1d3('0x39')](_0x2cee07[_0xc1d3('0x35')][_0xc1d3('0x39')]));_0x75612d['attributes']=_0x75612d[_0xc1d3('0x38')]['length']?_0x75612d['attributes']:_0x158a76[_0xc1d3('0x33')];_0x75612d['order']=qs[_0xc1d3('0x3c')](_0x2cee07[_0xc1d3('0x35')][_0xc1d3('0x3c')]);_0x75612d['where']=qs[_0xc1d3('0x36')](_[_0xc1d3('0x3e')](_0x2cee07[_0xc1d3('0x35')],_0x158a76[_0xc1d3('0x36')]));if(_0x2cee07[_0xc1d3('0x35')][_0xc1d3('0x43')]){_0x75612d[_0xc1d3('0x3d')]=_[_0xc1d3('0x3f')](_0x75612d[_0xc1d3('0x3d')],{'$or':_[_0xc1d3('0x40')](_0x75612d[_0xc1d3('0x38')],function(_0x3e24df){var _0x435d5f={};_0x435d5f[_0x3e24df]={'$like':'%'+_0x2cee07['query'][_0xc1d3('0x43')]+'%'};return _0x435d5f;})});}_0x75612d=_[_0xc1d3('0x3f')]({},_0x75612d,_0x2cee07['options']);return _0x4a1b44[_0xc1d3('0x52')](_0x75612d);}})[_0xc1d3('0x29')](function(_0x5d1758){if(_0x5d1758){_0x589195=_0x5d1758[_0xc1d3('0x4b')];if(!_0x2cee07[_0xc1d3('0x35')][_0xc1d3('0x53')](_0xc1d3('0x3a'))){_0x75612d[_0xc1d3('0x21')]=qs[_0xc1d3('0x21')](_0x2cee07['query']['limit']);_0x75612d[_0xc1d3('0x1e')]=qs['offset'](_0x2cee07[_0xc1d3('0x35')][_0xc1d3('0x1e')]);}return _0x4a1b44[_0xc1d3('0x52')](_0x75612d);}})['then'](function(_0x1810d7){if(_0x1810d7){return _0x1810d7?{'count':_0x589195,'rows':_0x1810d7}:null;}})[_0xc1d3('0x29')](respondWithResult(_0x4561dd,null))[_0xc1d3('0x48')](handleError(_0x4561dd,null));};exports[_0xc1d3('0x54')]=function(_0x8cfdc,_0x17e249,_0x5e1c30){var _0x5801e6={};var _0x17c57d={};var _0x1a4d5d;var _0x5d3e01;return db[_0xc1d3('0x2e')]['findOne']({'where':{'id':_0x8cfdc[_0xc1d3('0x4a')]['id']}})[_0xc1d3('0x29')](handleEntityNotFound(_0x17e249,null))[_0xc1d3('0x29')](function(_0x584138){if(_0x584138){_0x1a4d5d=_0x584138;_0x17c57d[_0xc1d3('0x33')]=_['keys'](db[_0xc1d3('0x51')]['rawAttributes']);_0x17c57d[_0xc1d3('0x35')]=_[_0xc1d3('0x34')](_0x8cfdc['query']);_0x17c57d[_0xc1d3('0x36')]=_[_0xc1d3('0x37')](_0x17c57d[_0xc1d3('0x33')],_0x17c57d['query']);_0x5801e6['attributes']=_[_0xc1d3('0x37')](_0x17c57d[_0xc1d3('0x33')],qs[_0xc1d3('0x39')](_0x8cfdc[_0xc1d3('0x35')][_0xc1d3('0x39')]));_0x5801e6[_0xc1d3('0x38')]=_0x5801e6['attributes']['length']?_0x5801e6['attributes']:_0x17c57d[_0xc1d3('0x33')];_0x5801e6[_0xc1d3('0x3b')]=qs[_0xc1d3('0x3c')](_0x8cfdc[_0xc1d3('0x35')][_0xc1d3('0x3c')]);_0x5801e6[_0xc1d3('0x3d')]=qs[_0xc1d3('0x36')](_[_0xc1d3('0x3e')](_0x8cfdc[_0xc1d3('0x35')],_0x17c57d['filters']));if(_0x8cfdc[_0xc1d3('0x35')][_0xc1d3('0x43')]){_0x5801e6['where']=_['merge'](_0x5801e6[_0xc1d3('0x3d')],{'$or':_[_0xc1d3('0x40')](_0x5801e6[_0xc1d3('0x38')],function(_0x1cb5c6){var _0x323793={};_0x323793[_0x1cb5c6]={'$like':'%'+_0x8cfdc[_0xc1d3('0x35')][_0xc1d3('0x43')]+'%'};return _0x323793;})});}_0x5801e6=_['merge']({},_0x5801e6,_0x8cfdc[_0xc1d3('0x44')]);return _0x1a4d5d['getDescriptions'](_0x5801e6);}})[_0xc1d3('0x29')](function(_0x22c59f){if(_0x22c59f){_0x5d3e01=_0x22c59f[_0xc1d3('0x4b')];if(!_0x8cfdc[_0xc1d3('0x35')][_0xc1d3('0x53')](_0xc1d3('0x3a'))){_0x5801e6[_0xc1d3('0x21')]=qs[_0xc1d3('0x21')](_0x8cfdc[_0xc1d3('0x35')][_0xc1d3('0x21')]);_0x5801e6[_0xc1d3('0x1e')]=qs[_0xc1d3('0x1e')](_0x8cfdc['query'][_0xc1d3('0x1e')]);}return _0x1a4d5d['getDescriptions'](_0x5801e6);}})['then'](function(_0xf27431){if(_0xf27431){return _0xf27431?{'count':_0x5d3e01,'rows':_0xf27431}:null;}})[_0xc1d3('0x29')](respondWithResult(_0x17e249,null))[_0xc1d3('0x48')](handleError(_0x17e249,null));};exports[_0xc1d3('0x55')]=function(_0x3cc640,_0x5c100e,_0x13a00b){var _0xd8869a={};var _0x64a5a9={};var _0x576c37;var _0x456c26;return db[_0xc1d3('0x2e')][_0xc1d3('0x50')]({'where':{'id':_0x3cc640['params']['id']}})['then'](handleEntityNotFound(_0x5c100e,null))[_0xc1d3('0x29')](function(_0x366ca2){if(_0x366ca2){_0x576c37=_0x366ca2;_0x64a5a9[_0xc1d3('0x33')]=_[_0xc1d3('0x34')](db['Tag'][_0xc1d3('0x2f')]);_0x64a5a9[_0xc1d3('0x35')]=_[_0xc1d3('0x34')](_0x3cc640[_0xc1d3('0x35')]);_0x64a5a9[_0xc1d3('0x36')]=_[_0xc1d3('0x37')](_0x64a5a9[_0xc1d3('0x33')],_0x64a5a9[_0xc1d3('0x35')]);_0xd8869a[_0xc1d3('0x38')]=_['intersection'](_0x64a5a9[_0xc1d3('0x33')],qs['fields'](_0x3cc640[_0xc1d3('0x35')][_0xc1d3('0x39')]));_0xd8869a['attributes']=_0xd8869a[_0xc1d3('0x38')]['length']?_0xd8869a[_0xc1d3('0x38')]:_0x64a5a9[_0xc1d3('0x33')];_0xd8869a[_0xc1d3('0x3b')]=qs[_0xc1d3('0x3c')](_0x3cc640[_0xc1d3('0x35')][_0xc1d3('0x3c')]);_0xd8869a[_0xc1d3('0x3d')]=qs['filters'](_[_0xc1d3('0x3e')](_0x3cc640[_0xc1d3('0x35')],_0x64a5a9[_0xc1d3('0x36')]));if(_0x3cc640[_0xc1d3('0x35')]['filter']){_0xd8869a[_0xc1d3('0x3d')]=_['merge'](_0xd8869a[_0xc1d3('0x3d')],{'$or':_[_0xc1d3('0x40')](_0xd8869a['attributes'],function(_0x2bde6f){var _0x1cec8c={};_0x1cec8c[_0x2bde6f]={'$like':'%'+_0x3cc640[_0xc1d3('0x35')][_0xc1d3('0x43')]+'%'};return _0x1cec8c;})});}_0xd8869a=_[_0xc1d3('0x3f')]({},_0xd8869a,_0x3cc640[_0xc1d3('0x44')]);return _0x576c37[_0xc1d3('0x55')](_0xd8869a);}})[_0xc1d3('0x29')](function(_0x45ae90){if(_0x45ae90){_0x456c26=_0x45ae90[_0xc1d3('0x4b')];if(!_0x3cc640[_0xc1d3('0x35')][_0xc1d3('0x53')](_0xc1d3('0x3a'))){_0xd8869a[_0xc1d3('0x21')]=qs[_0xc1d3('0x21')](_0x3cc640[_0xc1d3('0x35')][_0xc1d3('0x21')]);_0xd8869a[_0xc1d3('0x1e')]=qs[_0xc1d3('0x1e')](_0x3cc640[_0xc1d3('0x35')][_0xc1d3('0x1e')]);}return _0x576c37[_0xc1d3('0x55')](_0xd8869a);}})['then'](function(_0x13e584){if(_0x13e584){return _0x13e584?{'count':_0x456c26,'rows':_0x13e584}:null;}})[_0xc1d3('0x29')](respondWithResult(_0x5c100e,null))[_0xc1d3('0x48')](handleError(_0x5c100e,null));};exports['setTags']=function(_0x15d7d8,_0xaa6413,_0x15a723){if(_0x15d7d8['body']['id']){delete _0x15d7d8[_0xc1d3('0x4e')]['id'];}return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x15d7d8[_0xc1d3('0x4a')]['id']}})[_0xc1d3('0x29')](handleEntityNotFound(_0xaa6413,null))['then'](function(_0x1d5292){if(_0x1d5292){return _0x1d5292['setTags'](_0x15d7d8[_0xc1d3('0x4e')][_0xc1d3('0x56')]||[]);}return null;})['then'](respondWithResult(_0xaa6413,null))[_0xc1d3('0x48')](handleError(_0xaa6413,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 545eaed..39f3e0c 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 _0x94b9=['../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','lodash','util','api','bluebird','rimraf'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x94b9,0x17e));var _0x994b=function(_0xc73980,_0x5c08ad){_0xc73980=_0xc73980-0x0;var _0x1ac3b5=_0x94b9[_0xc73980];return _0x1ac3b5;};'use strict';var _=require(_0x994b('0x0'));var util=require(_0x994b('0x1'));var logger=require('../../config/logger')(_0x994b('0x2'));var moment=require('moment');var BPromise=require(_0x994b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x994b('0x4'));var config=require(_0x994b('0x5'));var attributes=require(_0x994b('0x6'));module['exports']=function(_0x16a9a7,_0x28870c){return _0x16a9a7[_0x994b('0x7')](_0x994b('0x8'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6923=['request-promise','rimraf','./intFreshdeskConfiguration.attributes','exports','define','int_freshdesk_configurations','lodash','util','../../config/logger','moment','bluebird'];(function(_0x59522a,_0x14d1e5){var _0x30f09d=function(_0x5cab74){while(--_0x5cab74){_0x59522a['push'](_0x59522a['shift']());}};_0x30f09d(++_0x14d1e5);}(_0x6923,0x166));var _0x3692=function(_0xb48278,_0x13b57b){_0xb48278=_0xb48278-0x0;var _0x1e6301=_0x6923[_0xb48278];return _0x1e6301;};'use strict';var _=require(_0x3692('0x0'));var util=require(_0x3692('0x1'));var logger=require(_0x3692('0x2'))('api');var moment=require(_0x3692('0x3'));var BPromise=require(_0x3692('0x4'));var rp=require(_0x3692('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3692('0x6'));var config=require('../../config/environment');var attributes=require(_0x3692('0x7'));module[_0x3692('0x8')]=function(_0x1c338f,_0x2ef252){return _0x1c338f[_0x3692('0x9')]('FreshdeskConfiguration',attributes,{'tableName':_0x3692('0xa'),'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 3e165a3..1206d7b 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 _0x762a=['request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','FreshdeskConfiguration,\x20%s,\x20%s'];(function(_0x37ffea,_0x25b006){var _0x2e2615=function(_0x5e6c74){while(--_0x5e6c74){_0x37ffea['push'](_0x37ffea['shift']());}};_0x2e2615(++_0x25b006);}(_0x762a,0xd8));var _0xa762=function(_0x5e20a8,_0x5986e5){_0x5e20a8=_0x5e20a8-0x0;var _0x4d7d16=_0x762a[_0x5e20a8];return _0x4d7d16;};'use strict';var _=require(_0xa762('0x0'));var util=require(_0xa762('0x1'));var moment=require(_0xa762('0x2'));var BPromise=require('bluebird');var rs=require(_0xa762('0x3'));var fs=require('fs');var Redis=require(_0xa762('0x4'));var db=require(_0xa762('0x5'))['db'];var utils=require(_0xa762('0x6'));var logger=require(_0xa762('0x7'))(_0xa762('0x8'));var config=require('../../config/environment');var jayson=require(_0xa762('0x9'));var client=jayson['client'][_0xa762('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f3692,_0x5b60de,_0x2c59b5){return new BPromise(function(_0x85793c,_0xec0a7a){return client[_0xa762('0xb')](_0x1f3692,_0x2c59b5)[_0xa762('0xc')](function(_0x3959da){logger['info'](_0xa762('0xd'),_0x5b60de,_0xa762('0xe'));logger['debug'](_0xa762('0xf'),_0x5b60de,_0xa762('0xe'),JSON[_0xa762('0x10')](_0x3959da));if(_0x3959da[_0xa762('0x11')]){if(_0x3959da[_0xa762('0x11')][_0xa762('0x12')]===0x1f4){logger[_0xa762('0x11')](_0xa762('0xd'),_0x5b60de,_0x3959da[_0xa762('0x11')]['message']);return _0xec0a7a(_0x3959da[_0xa762('0x11')][_0xa762('0x13')]);}logger['error'](_0xa762('0xd'),_0x5b60de,_0x3959da['error'][_0xa762('0x13')]);return _0x85793c(_0x3959da[_0xa762('0x11')][_0xa762('0x13')]);}else{logger[_0xa762('0x14')](_0xa762('0xd'),_0x5b60de,_0xa762('0xe'));_0x85793c(_0x3959da[_0xa762('0x15')][_0xa762('0x13')]);}})[_0xa762('0x16')](function(_0x20c411){logger[_0xa762('0x11')](_0xa762('0xd'),_0x5b60de,_0x20c411);_0xec0a7a(_0x20c411);});});} \ No newline at end of file +var _0x094c=['rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','bluebird','randomstring','../../config/logger'];(function(_0x27d8bc,_0x19e010){var _0x4b04cb=function(_0x524568){while(--_0x524568){_0x27d8bc['push'](_0x27d8bc['shift']());}};_0x4b04cb(++_0x19e010);}(_0x094c,0xc4));var _0xc094=function(_0x567312,_0x33020e){_0x567312=_0x567312-0x0;var _0xea4df1=_0x094c[_0x567312];return _0xea4df1;};'use strict';var _=require('lodash');var util=require(_0xc094('0x0'));var moment=require('moment');var BPromise=require(_0xc094('0x1'));var rs=require(_0xc094('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc094('0x3'))(_0xc094('0x4'));var config=require(_0xc094('0x5'));var jayson=require(_0xc094('0x6'));var client=jayson['client'][_0xc094('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x457036,_0x4b0ee5,_0x559501){return new BPromise(function(_0x816548,_0x161f25){return client[_0xc094('0x8')](_0x457036,_0x559501)[_0xc094('0x9')](function(_0x4c0fa3){logger[_0xc094('0xa')](_0xc094('0xb'),_0x4b0ee5,_0xc094('0xc'));logger[_0xc094('0xd')](_0xc094('0xe'),_0x4b0ee5,_0xc094('0xc'),JSON[_0xc094('0xf')](_0x4c0fa3));if(_0x4c0fa3[_0xc094('0x10')]){if(_0x4c0fa3[_0xc094('0x10')][_0xc094('0x11')]===0x1f4){logger['error'](_0xc094('0xb'),_0x4b0ee5,_0x4c0fa3['error'][_0xc094('0x12')]);return _0x161f25(_0x4c0fa3[_0xc094('0x10')][_0xc094('0x12')]);}logger[_0xc094('0x10')](_0xc094('0xb'),_0x4b0ee5,_0x4c0fa3[_0xc094('0x10')][_0xc094('0x12')]);return _0x816548(_0x4c0fa3[_0xc094('0x10')][_0xc094('0x12')]);}else{logger[_0xc094('0xa')](_0xc094('0xb'),_0x4b0ee5,'request\x20sent');_0x816548(_0x4c0fa3[_0xc094('0x13')][_0xc094('0x12')]);}})['catch'](function(_0x59a812){logger['error'](_0xc094('0xb'),_0x4b0ee5,_0x59a812);_0x161f25(_0x59a812);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 2a5ac0c..043794b 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 _0x8f08=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../config/environment','./intFreshdeskField.controller'];(function(_0x425d30,_0x134e9e){var _0x1bbfef=function(_0x4f3746){while(--_0x4f3746){_0x425d30['push'](_0x425d30['shift']());}};_0x1bbfef(++_0x134e9e);}(_0x8f08,0x7e));var _0x88f0=function(_0x3a3c17,_0x5b7b7e){_0x3a3c17=_0x3a3c17-0x0;var _0xd07f21=_0x8f08[_0x3a3c17];return _0xd07f21;};'use strict';var multer=require(_0x88f0('0x0'));var util=require(_0x88f0('0x1'));var path=require('path');var timeout=require(_0x88f0('0x2'));var express=require('express');var router=express[_0x88f0('0x3')]();var fs_extra=require(_0x88f0('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x88f0('0x5'));var controller=require(_0x88f0('0x6'));router[_0x88f0('0x7')]('/',auth[_0x88f0('0x8')](),controller[_0x88f0('0x9')]);router[_0x88f0('0x7')](_0x88f0('0xa'),auth['isAuthenticated'](),controller[_0x88f0('0xb')]);router[_0x88f0('0xc')]('/',auth[_0x88f0('0x8')](),controller[_0x88f0('0xd')]);router[_0x88f0('0xe')](_0x88f0('0xa'),auth[_0x88f0('0x8')](),controller[_0x88f0('0xf')]);router[_0x88f0('0x10')](_0x88f0('0xa'),auth['isAuthenticated'](),controller[_0x88f0('0x11')]);module[_0x88f0('0x12')]=router; \ No newline at end of file +var _0x6f23=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','index','/:id','isAuthenticated','show','post','create','update','delete','multer'];(function(_0x592df4,_0x4e719b){var _0x3b4fe4=function(_0x5ebf53){while(--_0x5ebf53){_0x592df4['push'](_0x592df4['shift']());}};_0x3b4fe4(++_0x4e719b);}(_0x6f23,0x18f));var _0x36f2=function(_0x4fe93e,_0x44f9e2){_0x4fe93e=_0x4fe93e-0x0;var _0x5f1d5a=_0x6f23[_0x4fe93e];return _0x5f1d5a;};'use strict';var multer=require(_0x36f2('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x36f2('0x1')]();var fs_extra=require(_0x36f2('0x2'));var auth=require(_0x36f2('0x3'));var interaction=require(_0x36f2('0x4'));var config=require(_0x36f2('0x5'));var controller=require(_0x36f2('0x6'));router[_0x36f2('0x7')]('/',auth['isAuthenticated'](),controller[_0x36f2('0x8')]);router[_0x36f2('0x7')](_0x36f2('0x9'),auth[_0x36f2('0xa')](),controller[_0x36f2('0xb')]);router[_0x36f2('0xc')]('/',auth[_0x36f2('0xa')](),controller[_0x36f2('0xd')]);router['put']('/:id',auth[_0x36f2('0xa')](),controller[_0x36f2('0xe')]);router[_0x36f2('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 26ed446..c13cd7c 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 _0x9e09=['variable','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x2f2051,_0x222252){var _0x22fd2a=function(_0x157e5c){while(--_0x157e5c){_0x2f2051['push'](_0x2f2051['shift']());}};_0x22fd2a(++_0x222252);}(_0x9e09,0x17c));var _0x99e0=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x9e09[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0x99e0('0x0'));module[_0x99e0('0x1')]={'type':{'type':Sequelize[_0x99e0('0x2')](_0x99e0('0x3'),_0x99e0('0x4'),'customVariable','keyValue','picklist'),'defaultValue':_0x99e0('0x3')},'content':{'type':Sequelize[_0x99e0('0x5')]},'key':{'type':Sequelize[_0x99e0('0x5')]},'keyType':{'type':Sequelize[_0x99e0('0x2')]('string',_0x99e0('0x4'),_0x99e0('0x6'))},'keyContent':{'type':Sequelize[_0x99e0('0x5')]},'idField':{'type':Sequelize[_0x99e0('0x5')]},'nameField':{'type':Sequelize[_0x99e0('0x5')]},'customField':{'type':Sequelize[_0x99e0('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x99e0('0x5')]}}; \ No newline at end of file +var _0xee8b=['STRING','variable','customVariable','BOOLEAN','ENUM','string','keyValue'];(function(_0x6182ff,_0x59d492){var _0x1cec22=function(_0x2e96f8){while(--_0x2e96f8){_0x6182ff['push'](_0x6182ff['shift']());}};_0x1cec22(++_0x59d492);}(_0xee8b,0x13f));var _0xbee8=function(_0x4d1586,_0x5b4027){_0x4d1586=_0x4d1586-0x0;var _0x88d36e=_0xee8b[_0x4d1586];return _0x88d36e;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xbee8('0x0')](_0xbee8('0x1'),'variable','customVariable',_0xbee8('0x2'),'picklist'),'defaultValue':_0xbee8('0x1')},'content':{'type':Sequelize[_0xbee8('0x3')]},'key':{'type':Sequelize[_0xbee8('0x3')]},'keyType':{'type':Sequelize[_0xbee8('0x0')]('string',_0xbee8('0x4'),_0xbee8('0x5'))},'keyContent':{'type':Sequelize[_0xbee8('0x3')]},'idField':{'type':Sequelize[_0xbee8('0x3')]},'nameField':{'type':Sequelize[_0xbee8('0x3')]},'customField':{'type':Sequelize[_0xbee8('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbee8('0x3')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 2ce4443..b1c4542 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 _0x9c44=['options','then','includeAll','include','findAll','rows','catch','params','find','create','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL'];(function(_0x160c2f,_0x1accec){var _0x3d55cb=function(_0x2b7236){while(--_0x2b7236){_0x160c2f['push'](_0x160c2f['shift']());}};_0x3d55cb(++_0x1accec);}(_0x9c44,0x178));var _0x49c4=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x9c44[_0x3511d3];return _0x5d6321;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['FreshdeskField'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['FreshdeskField'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));}; \ No newline at end of file +var _0xfe57=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','apply','reject','save','update','then','name','send','map','FreshdeskField','fieldName','key','model','query','filters','intersection','fields','attributes','length','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','rows','params','keys','includeAll','find','catch','create','body','destroy','eml-format','rimraf','request-promise'];(function(_0x1481bd,_0x195410){var _0x4d8cca=function(_0x85ee6c){while(--_0x85ee6c){_0x1481bd['push'](_0x1481bd['shift']());}};_0x4d8cca(++_0x195410);}(_0xfe57,0x195));var _0x7fe5=function(_0x319cb9,_0x4b8d35){_0x319cb9=_0x319cb9-0x0;var _0x1735fc=_0xfe57[_0x319cb9];return _0x1735fc;};'use strict';var emlformat=require(_0x7fe5('0x0'));var rimraf=require(_0x7fe5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7fe5('0x2'));var moment=require(_0x7fe5('0x3'));var BPromise=require(_0x7fe5('0x4'));var Mustache=require(_0x7fe5('0x5'));var util=require(_0x7fe5('0x6'));var path=require(_0x7fe5('0x7'));var sox=require(_0x7fe5('0x8'));var csv=require(_0x7fe5('0x9'));var ejs=require(_0x7fe5('0xa'));var fs=require('fs');var fs_extra=require(_0x7fe5('0xb'));var _=require(_0x7fe5('0xc'));var squel=require(_0x7fe5('0xd'));var crypto=require(_0x7fe5('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x7fe5('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7fe5('0x10'));var Papa=require(_0x7fe5('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7fe5('0x12'));var as=require(_0x7fe5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7fe5('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x7fe5('0x15'));var licenseUtil=require(_0x7fe5('0x16'));var db=require(_0x7fe5('0x17'))['db'];function respondWithStatusCode(_0x225fc3,_0x53f76c){_0x53f76c=_0x53f76c||0xcc;return function(_0x329c95){if(_0x329c95){return _0x225fc3[_0x7fe5('0x18')](_0x53f76c);}return _0x225fc3['status'](_0x53f76c)[_0x7fe5('0x19')]();};}function respondWithResult(_0x54cfb2,_0x1f84b5){_0x1f84b5=_0x1f84b5||0xc8;return function(_0x2d297b){if(_0x2d297b){return _0x54cfb2['status'](_0x1f84b5)[_0x7fe5('0x1a')](_0x2d297b);}};}function respondWithFilteredResult(_0x56e76f,_0x39f175){return function(_0x221ab2){if(_0x221ab2){var _0xbdf0a4=typeof _0x39f175[_0x7fe5('0x1b')]===_0x7fe5('0x1c')&&typeof _0x39f175[_0x7fe5('0x1d')]==='undefined';var _0x166e23=_0x221ab2[_0x7fe5('0x1e')];var _0x340d5e=_0xbdf0a4?0x0:_0x39f175[_0x7fe5('0x1b')];var _0x2533db=_0xbdf0a4?_0x221ab2[_0x7fe5('0x1e')]:_0x39f175[_0x7fe5('0x1b')]+_0x39f175[_0x7fe5('0x1d')];var _0x478523;if(_0x2533db>=_0x166e23){_0x2533db=_0x166e23;_0x478523=0xc8;}else{_0x478523=0xce;}_0x56e76f[_0x7fe5('0x1f')](_0x478523);return _0x56e76f['set']('Content-Range',_0x340d5e+'-'+_0x2533db+'/'+_0x166e23)[_0x7fe5('0x1a')](_0x221ab2);}return null;};}function patchUpdates(_0x459c2d){return function(_0x2f6592){try{jsonpatch[_0x7fe5('0x20')](_0x2f6592,_0x459c2d,!![]);}catch(_0x39c560){return BPromise[_0x7fe5('0x21')](_0x39c560);}return _0x2f6592[_0x7fe5('0x22')]();};}function saveUpdates(_0xdd9df7,_0x1b271c){return function(_0x28a7fd){if(_0x28a7fd){return _0x28a7fd[_0x7fe5('0x23')](_0xdd9df7)[_0x7fe5('0x24')](function(_0x54ee98){return _0x54ee98;});}return null;};}function removeEntity(_0x3e7340,_0x2f39e0){return function(_0x43e547){if(_0x43e547){return _0x43e547['destroy']()[_0x7fe5('0x24')](function(){_0x3e7340['status'](0xcc)[_0x7fe5('0x19')]();});}};}function handleEntityNotFound(_0x53f522,_0x5c3b37){return function(_0x190355){if(!_0x190355){_0x53f522[_0x7fe5('0x18')](0x194);}return _0x190355;};}function handleError(_0x2a96f4,_0x399c55){_0x399c55=_0x399c55||0x1f4;return function(_0x4393c3){logger['error'](_0x4393c3['stack']);if(_0x4393c3[_0x7fe5('0x25')]){delete _0x4393c3[_0x7fe5('0x25')];}_0x2a96f4[_0x7fe5('0x1f')](_0x399c55)[_0x7fe5('0x26')](_0x4393c3);};}exports['index']=function(_0x46f816,_0x4a77e9){var _0x150ab9={},_0x1420de={},_0x204bc8={'count':0x0,'rows':[]};var _0x28a689=_[_0x7fe5('0x27')](db[_0x7fe5('0x28')]['rawAttributes'],function(_0xe521c6){return{'name':_0xe521c6[_0x7fe5('0x29')],'type':_0xe521c6['type'][_0x7fe5('0x2a')]};});_0x1420de[_0x7fe5('0x2b')]=_[_0x7fe5('0x27')](_0x28a689,_0x7fe5('0x25'));_0x1420de[_0x7fe5('0x2c')]=_['keys'](_0x46f816['query']);_0x1420de[_0x7fe5('0x2d')]=_[_0x7fe5('0x2e')](_0x1420de[_0x7fe5('0x2b')],_0x1420de[_0x7fe5('0x2c')]);_0x150ab9['attributes']=_[_0x7fe5('0x2e')](_0x1420de[_0x7fe5('0x2b')],qs[_0x7fe5('0x2f')](_0x46f816[_0x7fe5('0x2c')][_0x7fe5('0x2f')]));_0x150ab9[_0x7fe5('0x30')]=_0x150ab9['attributes'][_0x7fe5('0x31')]?_0x150ab9[_0x7fe5('0x30')]:_0x1420de[_0x7fe5('0x2b')];if(!_0x46f816[_0x7fe5('0x2c')]['hasOwnProperty']('nolimit')){_0x150ab9[_0x7fe5('0x1d')]=qs['limit'](_0x46f816[_0x7fe5('0x2c')]['limit']);_0x150ab9[_0x7fe5('0x1b')]=qs['offset'](_0x46f816['query']['offset']);}_0x150ab9['order']=qs[_0x7fe5('0x32')](_0x46f816[_0x7fe5('0x2c')]['sort']);_0x150ab9[_0x7fe5('0x33')]=qs[_0x7fe5('0x2d')](_['pick'](_0x46f816[_0x7fe5('0x2c')],_0x1420de['filters']),_0x28a689);if(_0x46f816['query'][_0x7fe5('0x34')]){_0x150ab9[_0x7fe5('0x33')]=_[_0x7fe5('0x35')](_0x150ab9[_0x7fe5('0x33')],{'$or':_[_0x7fe5('0x27')](_0x28a689,function(_0x4c4b05){if(_0x4c4b05[_0x7fe5('0x36')]!==_0x7fe5('0x37')){var _0x5839b2={};_0x5839b2[_0x4c4b05[_0x7fe5('0x25')]]={'$like':'%'+_0x46f816[_0x7fe5('0x2c')][_0x7fe5('0x34')]+'%'};return _0x5839b2;}})});}_0x150ab9=_[_0x7fe5('0x35')]({},_0x150ab9,_0x46f816[_0x7fe5('0x38')]);var _0x1c81c8={'where':_0x150ab9[_0x7fe5('0x33')]};return db['FreshdeskField']['count'](_0x1c81c8)[_0x7fe5('0x24')](function(_0x5f5db0){_0x204bc8[_0x7fe5('0x1e')]=_0x5f5db0;if(_0x46f816[_0x7fe5('0x2c')]['includeAll']){_0x150ab9[_0x7fe5('0x39')]=[{'all':!![]}];}return db[_0x7fe5('0x28')][_0x7fe5('0x3a')](_0x150ab9);})[_0x7fe5('0x24')](function(_0x2fd004){_0x204bc8[_0x7fe5('0x3b')]=_0x2fd004;return _0x204bc8;})[_0x7fe5('0x24')](respondWithFilteredResult(_0x4a77e9,_0x150ab9))['catch'](handleError(_0x4a77e9,null));};exports['show']=function(_0x411002,_0x4f81ca){var _0xad0b05={'raw':!![],'where':{'id':_0x411002[_0x7fe5('0x3c')]['id']}},_0x1a3e0d={};_0x1a3e0d[_0x7fe5('0x2b')]=_['keys'](db[_0x7fe5('0x28')]['rawAttributes']);_0x1a3e0d['query']=_[_0x7fe5('0x3d')](_0x411002[_0x7fe5('0x2c')]);_0x1a3e0d['filters']=_[_0x7fe5('0x2e')](_0x1a3e0d[_0x7fe5('0x2b')],_0x1a3e0d[_0x7fe5('0x2c')]);_0xad0b05[_0x7fe5('0x30')]=_[_0x7fe5('0x2e')](_0x1a3e0d['model'],qs[_0x7fe5('0x2f')](_0x411002[_0x7fe5('0x2c')]['fields']));_0xad0b05[_0x7fe5('0x30')]=_0xad0b05[_0x7fe5('0x30')][_0x7fe5('0x31')]?_0xad0b05[_0x7fe5('0x30')]:_0x1a3e0d['model'];if(_0x411002[_0x7fe5('0x2c')][_0x7fe5('0x3e')]){_0xad0b05[_0x7fe5('0x39')]=[{'all':!![]}];}_0xad0b05=_['merge']({},_0xad0b05,_0x411002[_0x7fe5('0x38')]);return db[_0x7fe5('0x28')][_0x7fe5('0x3f')](_0xad0b05)['then'](handleEntityNotFound(_0x4f81ca,null))[_0x7fe5('0x24')](respondWithResult(_0x4f81ca,null))[_0x7fe5('0x40')](handleError(_0x4f81ca,null));};exports[_0x7fe5('0x41')]=function(_0x4b8642,_0x19c4a6){return db[_0x7fe5('0x28')][_0x7fe5('0x41')](_0x4b8642[_0x7fe5('0x42')],{})[_0x7fe5('0x24')](respondWithResult(_0x19c4a6,0xc9))[_0x7fe5('0x40')](handleError(_0x19c4a6,null));};exports[_0x7fe5('0x23')]=function(_0x447b57,_0x446f01){if(_0x447b57[_0x7fe5('0x42')]['id']){delete _0x447b57[_0x7fe5('0x42')]['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x447b57['params']['id']}})['then'](handleEntityNotFound(_0x446f01,null))[_0x7fe5('0x24')](saveUpdates(_0x447b57['body'],null))[_0x7fe5('0x24')](respondWithResult(_0x446f01,null))[_0x7fe5('0x40')](handleError(_0x446f01,null));};exports[_0x7fe5('0x43')]=function(_0x1d9ca8,_0x362f33){return db['FreshdeskField'][_0x7fe5('0x3f')]({'where':{'id':_0x1d9ca8[_0x7fe5('0x3c')]['id']}})[_0x7fe5('0x24')](handleEntityNotFound(_0x362f33,null))[_0x7fe5('0x24')](removeEntity(_0x362f33,null))[_0x7fe5('0x40')](handleError(_0x362f33,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 23ef91f..201a552 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 _0xf33f=['api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x1a8e49,_0x42d2cb){var _0x43aad0=function(_0x4abccf){while(--_0x4abccf){_0x1a8e49['push'](_0x1a8e49['shift']());}};_0x43aad0(++_0x42d2cb);}(_0xf33f,0x13d));var _0xff33=function(_0x3ab1d4,_0x4e7da0){_0x3ab1d4=_0x3ab1d4-0x0;var _0x45b41b=_0xf33f[_0x3ab1d4];return _0x45b41b;};'use strict';var _=require(_0xff33('0x0'));var util=require(_0xff33('0x1'));var logger=require(_0xff33('0x2'))(_0xff33('0x3'));var moment=require('moment');var BPromise=require(_0xff33('0x4'));var rp=require(_0xff33('0x5'));var fs=require('fs');var path=require(_0xff33('0x6'));var rimraf=require(_0xff33('0x7'));var config=require(_0xff33('0x8'));var attributes=require(_0xff33('0x9'));module[_0xff33('0xa')]=function(_0x15a0b4,_0xb5c43e){return _0x15a0b4['define'](_0xff33('0xb'),attributes,{'tableName':_0xff33('0xc'),'paranoid':![],'indexes':[{'name':_0xff33('0xd'),'fields':[_0xff33('0xe'),_0xff33('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbe23=['rimraf','../../config/environment','./intFreshdeskField.attributes','exports','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','lodash','api','moment','bluebird','path'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xbe23,0x1c2));var _0x3be2=function(_0x464967,_0x587304){_0x464967=_0x464967-0x0;var _0x35a36b=_0xbe23[_0x464967];return _0x35a36b;};'use strict';var _=require(_0x3be2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3be2('0x1'));var moment=require(_0x3be2('0x2'));var BPromise=require(_0x3be2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3be2('0x4'));var rimraf=require(_0x3be2('0x5'));var config=require(_0x3be2('0x6'));var attributes=require(_0x3be2('0x7'));module[_0x3be2('0x8')]=function(_0x3d9e74,_0x573121){return _0x3d9e74['define'](_0x3be2('0x9'),attributes,{'tableName':_0x3be2('0xa'),'paranoid':![],'indexes':[{'name':_0x3be2('0xb'),'fields':[_0x3be2('0xc'),'FieldId'],'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 8eadf9b..60415bb 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 _0x42b8=['error','code','FreshdeskField,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s'];(function(_0x42b306,_0x4c8cc6){var _0x42cbfd=function(_0x147a76){while(--_0x147a76){_0x42b306['push'](_0x42b306['shift']());}};_0x42cbfd(++_0x4c8cc6);}(_0x42b8,0x145));var _0x842b=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x42b8[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x842b('0x0'));var util=require(_0x842b('0x1'));var moment=require(_0x842b('0x2'));var BPromise=require('bluebird');var rs=require(_0x842b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x842b('0x4'));var logger=require(_0x842b('0x5'))(_0x842b('0x6'));var config=require(_0x842b('0x7'));var jayson=require(_0x842b('0x8'));var client=jayson[_0x842b('0x9')][_0x842b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x439bb7,_0x481c0a,_0x825586){return new BPromise(function(_0x3b8b69,_0xe0aebf){return client[_0x842b('0xb')](_0x439bb7,_0x825586)['then'](function(_0x5f1aab){logger[_0x842b('0xc')]('FreshdeskField,\x20%s,\x20%s',_0x481c0a,_0x842b('0xd'));logger['debug'](_0x842b('0xe'),_0x481c0a,_0x842b('0xd'),JSON['stringify'](_0x5f1aab));if(_0x5f1aab[_0x842b('0xf')]){if(_0x5f1aab[_0x842b('0xf')][_0x842b('0x10')]===0x1f4){logger['error'](_0x842b('0x11'),_0x481c0a,_0x5f1aab[_0x842b('0xf')][_0x842b('0x12')]);return _0xe0aebf(_0x5f1aab[_0x842b('0xf')][_0x842b('0x12')]);}logger['error'](_0x842b('0x11'),_0x481c0a,_0x5f1aab[_0x842b('0xf')][_0x842b('0x12')]);return _0x3b8b69(_0x5f1aab[_0x842b('0xf')]['message']);}else{logger[_0x842b('0xc')](_0x842b('0x11'),_0x481c0a,_0x842b('0xd'));_0x3b8b69(_0x5f1aab['result']['message']);}})[_0x842b('0x13')](function(_0x2c5e8f){logger[_0x842b('0xf')](_0x842b('0x11'),_0x481c0a,_0x2c5e8f);_0xe0aebf(_0x2c5e8f);});});} \ No newline at end of file +var _0x89e6=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','bluebird'];(function(_0xdab6d8,_0x51a29c){var _0x4ed618=function(_0x42fd84){while(--_0x42fd84){_0xdab6d8['push'](_0xdab6d8['shift']());}};_0x4ed618(++_0x51a29c);}(_0x89e6,0x108));var _0x689e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x89e6[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x689e('0x0'));var moment=require('moment');var BPromise=require(_0x689e('0x1'));var rs=require(_0x689e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x689e('0x3'))['db'];var utils=require(_0x689e('0x4'));var logger=require(_0x689e('0x5'))(_0x689e('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x689e('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45c4f7,_0x3913c6,_0x204111){return new BPromise(function(_0x47556e,_0x431456){return client[_0x689e('0x8')](_0x45c4f7,_0x204111)[_0x689e('0x9')](function(_0x2d9899){logger[_0x689e('0xa')](_0x689e('0xb'),_0x3913c6,_0x689e('0xc'));logger[_0x689e('0xd')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x3913c6,'request\x20sent',JSON['stringify'](_0x2d9899));if(_0x2d9899[_0x689e('0xe')]){if(_0x2d9899[_0x689e('0xe')][_0x689e('0xf')]===0x1f4){logger[_0x689e('0xe')]('FreshdeskField,\x20%s,\x20%s',_0x3913c6,_0x2d9899[_0x689e('0xe')][_0x689e('0x10')]);return _0x431456(_0x2d9899[_0x689e('0xe')][_0x689e('0x10')]);}logger[_0x689e('0xe')](_0x689e('0xb'),_0x3913c6,_0x2d9899[_0x689e('0xe')]['message']);return _0x47556e(_0x2d9899[_0x689e('0xe')][_0x689e('0x10')]);}else{logger[_0x689e('0xa')](_0x689e('0xb'),_0x3913c6,_0x689e('0xc'));_0x47556e(_0x2d9899[_0x689e('0x11')][_0x689e('0x10')]);}})[_0x689e('0x12')](function(_0x85ed2f){logger[_0x689e('0xe')](_0x689e('0xb'),_0x3913c6,_0x85ed2f);_0x431456(_0x85ed2f);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 820a46f..000e86a 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 _0x9aea=['index','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0x9aea,0xdd));var _0xa9ae=function(_0x9cbd37,_0x493b56){_0x9cbd37=_0x9cbd37-0x0;var _0x47d426=_0x9aea[_0x9cbd37];return _0x47d426;};'use strict';var multer=require(_0xa9ae('0x0'));var util=require('util');var path=require(_0xa9ae('0x1'));var timeout=require('connect-timeout');var express=require(_0xa9ae('0x2'));var router=express[_0xa9ae('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa9ae('0x4'));var interaction=require(_0xa9ae('0x5'));var config=require(_0xa9ae('0x6'));var controller=require(_0xa9ae('0x7'));router[_0xa9ae('0x8')]('/',auth['isAuthenticated'](),controller[_0xa9ae('0x9')]);router[_0xa9ae('0x8')](_0xa9ae('0xa'),auth['isAuthenticated'](),controller[_0xa9ae('0xb')]);router[_0xa9ae('0x8')](_0xa9ae('0xc'),auth[_0xa9ae('0xd')](),controller[_0xa9ae('0xe')]);router[_0xa9ae('0x8')](_0xa9ae('0xf'),auth[_0xa9ae('0xd')](),controller[_0xa9ae('0x10')]);router['post']('/',auth[_0xa9ae('0xd')](),controller['create']);router[_0xa9ae('0x11')](_0xa9ae('0xc'),auth[_0xa9ae('0xd')](),controller[_0xa9ae('0x12')]);router[_0xa9ae('0x13')](_0xa9ae('0xa'),auth[_0xa9ae('0xd')](),controller[_0xa9ae('0x14')]);router['delete'](_0xa9ae('0xa'),auth[_0xa9ae('0xd')](),controller[_0xa9ae('0x15')]);module[_0xa9ae('0x16')]=router; \ No newline at end of file +var _0x0565=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','post','create','delete','/:id','exports'];(function(_0x1b4a18,_0x5646c4){var _0x3a29d0=function(_0x51d426){while(--_0x51d426){_0x1b4a18['push'](_0x1b4a18['shift']());}};_0x3a29d0(++_0x5646c4);}(_0x0565,0xf2));var _0x5056=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x0565[_0x1cc8fe];return _0x230054;};'use strict';var multer=require(_0x5056('0x0'));var util=require(_0x5056('0x1'));var path=require(_0x5056('0x2'));var timeout=require(_0x5056('0x3'));var express=require(_0x5056('0x4'));var router=express[_0x5056('0x5')]();var fs_extra=require(_0x5056('0x6'));var auth=require(_0x5056('0x7'));var interaction=require(_0x5056('0x8'));var config=require(_0x5056('0x9'));var controller=require('./intFreshsalesAccount.controller');router[_0x5056('0xa')]('/',auth[_0x5056('0xb')](),controller[_0x5056('0xc')]);router[_0x5056('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x5056('0xd')]);router[_0x5056('0xa')](_0x5056('0xe'),auth[_0x5056('0xb')](),controller[_0x5056('0xf')]);router[_0x5056('0xa')](_0x5056('0x10'),auth[_0x5056('0xb')](),controller['getFields']);router[_0x5056('0x11')]('/',auth[_0x5056('0xb')](),controller[_0x5056('0x12')]);router['post']('/:id/configurations',auth[_0x5056('0xb')](),controller['addConfiguration']);router['put']('/:id',auth[_0x5056('0xb')](),controller['update']);router[_0x5056('0x13')](_0x5056('0x14'),auth[_0x5056('0xb')](),controller['destroy']);module[_0x5056('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index f63ab34..8bbd104 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 _0x3a6d=['exports','STRING','username','sequelize'];(function(_0xfcb984,_0x4165bd){var _0x32e3de=function(_0xb7e7d9){while(--_0xb7e7d9){_0xfcb984['push'](_0xfcb984['shift']());}};_0x32e3de(++_0x4165bd);}(_0x3a6d,0x143));var _0xd3a6=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x3a6d[_0x68c979];return _0x4f0001;};'use strict';var Sequelize=require(_0xd3a6('0x0'));module[_0xd3a6('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd3a6('0x2')]},'username':{'type':Sequelize[_0xd3a6('0x2')],'unique':_0xd3a6('0x3')},'apiKey':{'type':Sequelize[_0xd3a6('0x2')]},'remoteUri':{'type':Sequelize[_0xd3a6('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xd3a6('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa30a=['sequelize','exports','STRING','username','remoteUri'];(function(_0x1bc600,_0x16c367){var _0x131b38=function(_0x4c2991){while(--_0x4c2991){_0x1bc600['push'](_0x1bc600['shift']());}};_0x131b38(++_0x16c367);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xaa30('0x0'));module[_0xaa30('0x1')]={'name':{'type':Sequelize[_0xaa30('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xaa30('0x2')],'unique':_0xaa30('0x3')},'apiKey':{'type':Sequelize[_0xaa30('0x2')]},'remoteUri':{'type':Sequelize[_0xaa30('0x2')],'unique':_0xaa30('0x4')},'serverUrl':{'type':Sequelize[_0xaa30('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 6289222..a486a47 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 _0x8888=['model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','order','addConfiguration','AccountId','getSubjects','Descriptions','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','getFields,\x20%s,\x20%s,\x20%s','stringify','test','statusCode','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','FreshsalesAccount','rawAttributes','fieldName','type'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8888,0x99));var _0x8888=function(_0x511a0d,_0xc0c804){_0x511a0d=_0x511a0d-0x0;var _0xc33dd7=_0x8888[_0x511a0d];return _0xc33dd7;};'use strict';var emlformat=require(_0x8888('0x0'));var rimraf=require(_0x8888('0x1'));var zipdir=require(_0x8888('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8888('0x3'));var moment=require('moment');var BPromise=require(_0x8888('0x4'));var Mustache=require('mustache');var util=require(_0x8888('0x5'));var path=require(_0x8888('0x6'));var sox=require('sox');var csv=require(_0x8888('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8888('0x8'));var _=require(_0x8888('0x9'));var squel=require(_0x8888('0xa'));var crypto=require(_0x8888('0xb'));var jsforce=require(_0x8888('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8888('0xd'));var Papa=require('papaparse');var Redis=require(_0x8888('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x8888('0xf'));var as=require(_0x8888('0x10'));var hardwareService=require(_0x8888('0x11'));var logger=require(_0x8888('0x12'))(_0x8888('0x13'));var utils=require(_0x8888('0x14'));var config=require(_0x8888('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x8888('0x16'));function respondWithStatusCode(_0x494422,_0x73d925){_0x73d925=_0x73d925||0xcc;return function(_0x4505f3){if(_0x4505f3){return _0x494422[_0x8888('0x17')](_0x73d925);}return _0x494422[_0x8888('0x18')](_0x73d925)[_0x8888('0x19')]();};}function respondWithResult(_0x4edafa,_0x571375){_0x571375=_0x571375||0xc8;return function(_0x1be38e){if(_0x1be38e){return _0x4edafa[_0x8888('0x18')](_0x571375)[_0x8888('0x1a')](_0x1be38e);}};}function respondWithFilteredResult(_0x3e7c95,_0xa5bb17){return function(_0x4743ec){if(_0x4743ec){var _0x1c13e3=typeof _0xa5bb17[_0x8888('0x1b')]==='undefined'&&typeof _0xa5bb17[_0x8888('0x1c')]===_0x8888('0x1d');var _0x5fa14b=_0x4743ec[_0x8888('0x1e')];var _0x7900da=_0x1c13e3?0x0:_0xa5bb17[_0x8888('0x1b')];var _0x361ce3=_0x1c13e3?_0x4743ec[_0x8888('0x1e')]:_0xa5bb17[_0x8888('0x1b')]+_0xa5bb17['limit'];var _0x2ccc0f;if(_0x361ce3>=_0x5fa14b){_0x361ce3=_0x5fa14b;_0x2ccc0f=0xc8;}else{_0x2ccc0f=0xce;}_0x3e7c95['status'](_0x2ccc0f);return _0x3e7c95[_0x8888('0x1f')](_0x8888('0x20'),_0x7900da+'-'+_0x361ce3+'/'+_0x5fa14b)[_0x8888('0x1a')](_0x4743ec);}return null;};}function patchUpdates(_0x44f284){return function(_0x2c8081){try{jsonpatch['apply'](_0x2c8081,_0x44f284,!![]);}catch(_0x49f72b){return BPromise[_0x8888('0x21')](_0x49f72b);}return _0x2c8081[_0x8888('0x22')]();};}function saveUpdates(_0x265450,_0x1d9d67){return function(_0x11c5a5){if(_0x11c5a5){return _0x11c5a5[_0x8888('0x23')](_0x265450)[_0x8888('0x24')](function(_0x3e4e4e){return _0x3e4e4e;});}return null;};}function removeEntity(_0x43536f,_0x43935e){return function(_0x50ae9c){if(_0x50ae9c){return _0x50ae9c[_0x8888('0x25')]()[_0x8888('0x24')](function(){_0x43536f[_0x8888('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fb7d6,_0x25a083){return function(_0x31ebff){if(!_0x31ebff){_0x2fb7d6[_0x8888('0x17')](0x194);}return _0x31ebff;};}function handleError(_0x558be0,_0x4d4eec){_0x4d4eec=_0x4d4eec||0x1f4;return function(_0xb7ac6c){logger[_0x8888('0x26')](_0xb7ac6c[_0x8888('0x27')]);if(_0xb7ac6c[_0x8888('0x28')]){delete _0xb7ac6c[_0x8888('0x28')];}_0x558be0[_0x8888('0x18')](_0x4d4eec)[_0x8888('0x29')](_0xb7ac6c);};}exports['index']=function(_0x368e7b,_0x5c216d){var _0x599c64={},_0x41980c={},_0x40b3e0={'count':0x0,'rows':[]};var _0x3904a6=_[_0x8888('0x2a')](db[_0x8888('0x2b')][_0x8888('0x2c')],function(_0x2946cd){return{'name':_0x2946cd[_0x8888('0x2d')],'type':_0x2946cd[_0x8888('0x2e')]['key']};});_0x41980c[_0x8888('0x2f')]=_['map'](_0x3904a6,_0x8888('0x28'));_0x41980c[_0x8888('0x30')]=_[_0x8888('0x31')](_0x368e7b[_0x8888('0x30')]);_0x41980c['filters']=_[_0x8888('0x32')](_0x41980c[_0x8888('0x2f')],_0x41980c[_0x8888('0x30')]);_0x599c64[_0x8888('0x33')]=_[_0x8888('0x32')](_0x41980c[_0x8888('0x2f')],qs[_0x8888('0x34')](_0x368e7b['query'][_0x8888('0x34')]));_0x599c64[_0x8888('0x33')]=_0x599c64[_0x8888('0x33')][_0x8888('0x35')]?_0x599c64[_0x8888('0x33')]:_0x41980c['model'];if(!_0x368e7b['query'][_0x8888('0x36')](_0x8888('0x37'))){_0x599c64['limit']=qs[_0x8888('0x1c')](_0x368e7b[_0x8888('0x30')][_0x8888('0x1c')]);_0x599c64[_0x8888('0x1b')]=qs['offset'](_0x368e7b[_0x8888('0x30')]['offset']);}_0x599c64['order']=qs['sort'](_0x368e7b[_0x8888('0x30')][_0x8888('0x38')]);_0x599c64[_0x8888('0x39')]=qs[_0x8888('0x3a')](_[_0x8888('0x3b')](_0x368e7b[_0x8888('0x30')],_0x41980c[_0x8888('0x3a')]),_0x3904a6);if(_0x368e7b['query'][_0x8888('0x3c')]){_0x599c64[_0x8888('0x39')]=_[_0x8888('0x3d')](_0x599c64[_0x8888('0x39')],{'$or':_[_0x8888('0x2a')](_0x3904a6,function(_0x249fc5){if(_0x249fc5[_0x8888('0x2e')]!==_0x8888('0x3e')){var _0x190654={};_0x190654[_0x249fc5[_0x8888('0x28')]]={'$like':'%'+_0x368e7b[_0x8888('0x30')][_0x8888('0x3c')]+'%'};return _0x190654;}})});}_0x599c64=_['merge']({},_0x599c64,_0x368e7b[_0x8888('0x3f')]);var _0x57c8cd={'where':_0x599c64[_0x8888('0x39')]};return db[_0x8888('0x2b')][_0x8888('0x1e')](_0x57c8cd)[_0x8888('0x24')](function(_0x20cc64){_0x40b3e0[_0x8888('0x1e')]=_0x20cc64;if(_0x368e7b[_0x8888('0x30')][_0x8888('0x40')]){_0x599c64[_0x8888('0x41')]=[{'all':!![]}];}return db[_0x8888('0x2b')][_0x8888('0x42')](_0x599c64);})[_0x8888('0x24')](function(_0x493449){_0x40b3e0['rows']=_0x493449;return _0x40b3e0;})[_0x8888('0x24')](respondWithFilteredResult(_0x5c216d,_0x599c64))[_0x8888('0x43')](handleError(_0x5c216d,null));};exports['show']=function(_0x141f9f,_0x68a7f0){var _0xd065e4={'raw':![],'where':{'id':_0x141f9f[_0x8888('0x44')]['id']}},_0x477e42={};_0x477e42['model']=_['keys'](db['FreshsalesAccount'][_0x8888('0x2c')]);_0x477e42[_0x8888('0x30')]=_['keys'](_0x141f9f[_0x8888('0x30')]);_0x477e42['filters']=_[_0x8888('0x32')](_0x477e42[_0x8888('0x2f')],_0x477e42[_0x8888('0x30')]);_0xd065e4['attributes']=_[_0x8888('0x32')](_0x477e42[_0x8888('0x2f')],qs[_0x8888('0x34')](_0x141f9f['query']['fields']));_0xd065e4[_0x8888('0x33')]=_0xd065e4[_0x8888('0x33')][_0x8888('0x35')]?_0xd065e4[_0x8888('0x33')]:_0x477e42[_0x8888('0x2f')];if(_0x141f9f[_0x8888('0x30')]['includeAll']){_0xd065e4['include']=[{'all':!![]}];}_0xd065e4=_['merge']({},_0xd065e4,_0x141f9f[_0x8888('0x3f')]);return db[_0x8888('0x2b')][_0x8888('0x45')](_0xd065e4)['then'](handleEntityNotFound(_0x68a7f0,null))['then'](respondWithResult(_0x68a7f0,null))[_0x8888('0x43')](handleError(_0x68a7f0,null));};exports[_0x8888('0x46')]=function(_0x135591,_0x529c58){return db[_0x8888('0x2b')][_0x8888('0x46')](_0x135591['body'],{})[_0x8888('0x24')](respondWithResult(_0x529c58,0xc9))[_0x8888('0x43')](handleError(_0x529c58,null));};exports[_0x8888('0x23')]=function(_0x5582e6,_0x24fefc){if(_0x5582e6[_0x8888('0x47')]['id']){delete _0x5582e6[_0x8888('0x47')]['id'];}return db[_0x8888('0x2b')][_0x8888('0x45')]({'where':{'id':_0x5582e6[_0x8888('0x44')]['id']}})[_0x8888('0x24')](handleEntityNotFound(_0x24fefc,null))[_0x8888('0x24')](saveUpdates(_0x5582e6['body'],null))[_0x8888('0x24')](respondWithResult(_0x24fefc,null))[_0x8888('0x43')](handleError(_0x24fefc,null));};exports[_0x8888('0x25')]=function(_0x28e2d5,_0x154c0f){return db[_0x8888('0x2b')]['find']({'where':{'id':_0x28e2d5[_0x8888('0x44')]['id']}})['then'](handleEntityNotFound(_0x154c0f,null))[_0x8888('0x24')](removeEntity(_0x154c0f,null))['catch'](handleError(_0x154c0f,null));};exports[_0x8888('0x48')]=function(_0x29f91a,_0x509a0d,_0x1543d8){var _0x36fc3d={};var _0x32cb71={};var _0x5914a9;var _0xd23300;return db['FreshsalesAccount'][_0x8888('0x49')]({'where':{'id':_0x29f91a[_0x8888('0x44')]['id']}})[_0x8888('0x24')](handleEntityNotFound(_0x509a0d,null))['then'](function(_0x322d01){if(_0x322d01){_0x5914a9=_0x322d01;_0x32cb71[_0x8888('0x2f')]=_[_0x8888('0x31')](db[_0x8888('0x4a')][_0x8888('0x2c')]);_0x32cb71[_0x8888('0x30')]=_[_0x8888('0x31')](_0x29f91a['query']);_0x32cb71[_0x8888('0x3a')]=_[_0x8888('0x32')](_0x32cb71[_0x8888('0x2f')],_0x32cb71[_0x8888('0x30')]);_0x36fc3d[_0x8888('0x33')]=_[_0x8888('0x32')](_0x32cb71[_0x8888('0x2f')],qs[_0x8888('0x34')](_0x29f91a['query'][_0x8888('0x34')]));_0x36fc3d['attributes']=_0x36fc3d['attributes']['length']?_0x36fc3d[_0x8888('0x33')]:_0x32cb71['model'];_0x36fc3d[_0x8888('0x4b')]=qs[_0x8888('0x38')](_0x29f91a['query'][_0x8888('0x38')]);_0x36fc3d[_0x8888('0x39')]=qs[_0x8888('0x3a')](_[_0x8888('0x3b')](_0x29f91a[_0x8888('0x30')],_0x32cb71['filters']));if(_0x29f91a[_0x8888('0x30')][_0x8888('0x3c')]){_0x36fc3d[_0x8888('0x39')]=_[_0x8888('0x3d')](_0x36fc3d[_0x8888('0x39')],{'$or':_['map'](_0x36fc3d['attributes'],function(_0x5b1681){var _0x9d9ed1={};_0x9d9ed1[_0x5b1681]={'$like':'%'+_0x29f91a['query'][_0x8888('0x3c')]+'%'};return _0x9d9ed1;})});}_0x36fc3d=_[_0x8888('0x3d')]({},_0x36fc3d,_0x29f91a[_0x8888('0x3f')]);return _0x5914a9[_0x8888('0x48')](_0x36fc3d);}})[_0x8888('0x24')](function(_0xe85787){if(_0xe85787){_0xd23300=_0xe85787[_0x8888('0x35')];if(!_0x29f91a[_0x8888('0x30')][_0x8888('0x36')](_0x8888('0x37'))){_0x36fc3d[_0x8888('0x1c')]=qs[_0x8888('0x1c')](_0x29f91a[_0x8888('0x30')][_0x8888('0x1c')]);_0x36fc3d[_0x8888('0x1b')]=qs[_0x8888('0x1b')](_0x29f91a[_0x8888('0x30')][_0x8888('0x1b')]);}return _0x5914a9[_0x8888('0x48')](_0x36fc3d);}})['then'](function(_0x36464b){if(_0x36464b){return _0x36464b?{'count':_0xd23300,'rows':_0x36464b}:null;}})[_0x8888('0x24')](respondWithResult(_0x509a0d,null))[_0x8888('0x43')](handleError(_0x509a0d,null));};exports[_0x8888('0x4c')]=function(_0x541703,_0x3042d1,_0x2531ab){if(_0x541703[_0x8888('0x47')]['id']){delete _0x541703[_0x8888('0x47')]['id'];}return db[_0x8888('0x2b')][_0x8888('0x49')]({'where':{'id':_0x541703[_0x8888('0x44')]['id']}})[_0x8888('0x24')](handleEntityNotFound(_0x3042d1,null))[_0x8888('0x24')](function(_0x45551c){if(_0x45551c){_0x541703[_0x8888('0x47')][_0x8888('0x4d')]=_0x45551c['id'];_0x541703['body']['Subjects']=integrations[_0x8888('0x4e')](_0x541703[_0x8888('0x47')]['channel'],_0x541703[_0x8888('0x47')][_0x8888('0x2e')]);_0x541703[_0x8888('0x47')][_0x8888('0x4f')]=integrations['getDescriptions'](_0x541703[_0x8888('0x47')]['channel'],_0x541703[_0x8888('0x47')][_0x8888('0x2e')]);return db[_0x8888('0x4a')][_0x8888('0x46')](_0x541703['body'],{'include':[{'model':db[_0x8888('0x50')],'as':'Subjects'},{'model':db[_0x8888('0x50')],'as':_0x8888('0x4f')}]});}return null;})[_0x8888('0x24')](respondWithResult(_0x3042d1,null))[_0x8888('0x43')](handleError(_0x3042d1,null));};exports[_0x8888('0x51')]=function(_0x3eefd1,_0x5a0ddb,_0xd432a1){var _0x2755cb='';var _0x3cca5c='';return db[_0x8888('0x2b')]['findOne']({'where':{'id':_0x3eefd1[_0x8888('0x44')]['id']},'attributes':['id',_0x8888('0x52'),_0x8888('0x53'),_0x8888('0x54')]})['then'](handleEntityNotFound(_0x5a0ddb,null))['then'](function(_0x523bd0){if(_0x523bd0){_0x3cca5c=_0x523bd0['username'];_0x2755cb=_0x523bd0[_0x8888('0x53')];var _0x2ab56c=_0x523bd0[_0x8888('0x53')][_0x8888('0x55')](-0x1);if(_0x2ab56c==='/'){_0x2755cb=_0x2755cb[_0x8888('0x56')](0x0,_0x2755cb[_0x8888('0x57')](_0x2ab56c));}return rp({'method':_0x8888('0x58'),'uri':util[_0x8888('0x59')](_0x8888('0x5a'),_0x2755cb,_0x8888('0x5b')),'headers':{'Authorization':_0x8888('0x5c')+_0x523bd0[_0x8888('0x54')]},'json':!![]});}})['then'](function(_0x58e4b9){if(_0x58e4b9){var _0x2170b0=_0x58e4b9[_0x8888('0x5d')];var _0x282358=![];var _0x1eb05c=null;for(_0x1eb05c=0x0;_0x1eb05c<_0x2170b0[_0x8888('0x35')];_0x1eb05c++){if(_0x2170b0[_0x1eb05c][_0x8888('0x5e')]===_0x3cca5c){_0x282358=!![];}}if(_0x282358){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x8888('0x5f')});}}})[_0x8888('0x24')](respondWithResult(_0x5a0ddb,null))[_0x8888('0x43')](function(_0x3ed333){var _0x49e5ea=_0x3eefd1[_0x8888('0x30')]['test']?0x1f4:_0x3ed333['statusCode']||0x1f4;logger['error'](_0x8888('0x60'),_0x8888('0x51'),_0x49e5ea,JSON[_0x8888('0x61')](_0x3ed333));delete _0x3ed333[_0x8888('0x28')];if(_0x49e5ea===0x191){_0x49e5ea=0x190;}_0x5a0ddb[_0x8888('0x18')](_0x49e5ea)[_0x8888('0x29')](_0x3eefd1[_0x8888('0x30')][_0x8888('0x62')]?{'message':'Wrong\x20credentials','statusCode':_0x3ed333[_0x8888('0x63')]}:_0x3ed333);});}; \ No newline at end of file +var _0x231f=['Requested\x20Resource\x20not\x20Found','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','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','sendStatus','status','offset','limit','undefined','count','Content-Range','save','update','then','destroy','end','name','send','index','map','FreshsalesAccount','rawAttributes','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','params','keys','find','catch','create','body','getConfigurations','findOne','length','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','remoteUri','apiKey','username','slice','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email'];(function(_0x46f135,_0x37507a){var _0x59fe32=function(_0x1d7ef3){while(--_0x1d7ef3){_0x46f135['push'](_0x46f135['shift']());}};_0x59fe32(++_0x37507a);}(_0x231f,0x193));var _0xf231=function(_0x385f94,_0x370451){_0x385f94=_0x385f94-0x0;var _0x2c1a55=_0x231f[_0x385f94];return _0x2c1a55;};'use strict';var emlformat=require(_0xf231('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf231('0x1'));var rp=require(_0xf231('0x2'));var moment=require(_0xf231('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf231('0x4'));var util=require(_0xf231('0x5'));var path=require(_0xf231('0x6'));var sox=require(_0xf231('0x7'));var csv=require('to-csv');var ejs=require(_0xf231('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf231('0x9'));var squel=require(_0xf231('0xa'));var crypto=require(_0xf231('0xb'));var jsforce=require(_0xf231('0xc'));var deskjs=require(_0xf231('0xd'));var toCsv=require(_0xf231('0xe'));var querystring=require(_0xf231('0xf'));var Papa=require(_0xf231('0x10'));var Redis=require(_0xf231('0x11'));var authService=require(_0xf231('0x12'));var qs=require(_0xf231('0x13'));var as=require(_0xf231('0x14'));var hardwareService=require(_0xf231('0x15'));var logger=require(_0xf231('0x16'))(_0xf231('0x17'));var utils=require(_0xf231('0x18'));var config=require(_0xf231('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5d0c85,_0x2ae77a){_0x2ae77a=_0x2ae77a||0xcc;return function(_0x1e1253){if(_0x1e1253){return _0x5d0c85[_0xf231('0x1a')](_0x2ae77a);}return _0x5d0c85[_0xf231('0x1b')](_0x2ae77a)['end']();};}function respondWithResult(_0x10205d,_0x18c621){_0x18c621=_0x18c621||0xc8;return function(_0x3bb521){if(_0x3bb521){return _0x10205d[_0xf231('0x1b')](_0x18c621)['json'](_0x3bb521);}};}function respondWithFilteredResult(_0x170633,_0x5b0890){return function(_0x35b1b6){if(_0x35b1b6){var _0x2e75c1=typeof _0x5b0890[_0xf231('0x1c')]==='undefined'&&typeof _0x5b0890[_0xf231('0x1d')]===_0xf231('0x1e');var _0xf84248=_0x35b1b6['count'];var _0x32852a=_0x2e75c1?0x0:_0x5b0890[_0xf231('0x1c')];var _0x34d0ab=_0x2e75c1?_0x35b1b6[_0xf231('0x1f')]:_0x5b0890[_0xf231('0x1c')]+_0x5b0890[_0xf231('0x1d')];var _0x3a3de9;if(_0x34d0ab>=_0xf84248){_0x34d0ab=_0xf84248;_0x3a3de9=0xc8;}else{_0x3a3de9=0xce;}_0x170633['status'](_0x3a3de9);return _0x170633['set'](_0xf231('0x20'),_0x32852a+'-'+_0x34d0ab+'/'+_0xf84248)['json'](_0x35b1b6);}return null;};}function patchUpdates(_0x18ef3f){return function(_0x335088){try{jsonpatch['apply'](_0x335088,_0x18ef3f,!![]);}catch(_0x143e1d){return BPromise['reject'](_0x143e1d);}return _0x335088[_0xf231('0x21')]();};}function saveUpdates(_0x36b085,_0x56ce14){return function(_0x25d56c){if(_0x25d56c){return _0x25d56c[_0xf231('0x22')](_0x36b085)[_0xf231('0x23')](function(_0x3771c9){return _0x3771c9;});}return null;};}function removeEntity(_0x3da40e,_0x187fce){return function(_0xc4a1d){if(_0xc4a1d){return _0xc4a1d[_0xf231('0x24')]()[_0xf231('0x23')](function(){_0x3da40e[_0xf231('0x1b')](0xcc)[_0xf231('0x25')]();});}};}function handleEntityNotFound(_0x45c12b,_0x8d20b5){return function(_0x45c20e){if(!_0x45c20e){_0x45c12b['sendStatus'](0x194);}return _0x45c20e;};}function handleError(_0x2cbc67,_0x34f28c){_0x34f28c=_0x34f28c||0x1f4;return function(_0x484833){logger['error'](_0x484833['stack']);if(_0x484833[_0xf231('0x26')]){delete _0x484833[_0xf231('0x26')];}_0x2cbc67[_0xf231('0x1b')](_0x34f28c)[_0xf231('0x27')](_0x484833);};}exports[_0xf231('0x28')]=function(_0x3731cd,_0x495815){var _0x3f9e5e={},_0x20ad55={},_0x5371b0={'count':0x0,'rows':[]};var _0x57969d=_[_0xf231('0x29')](db[_0xf231('0x2a')][_0xf231('0x2b')],function(_0x4bd51b){return{'name':_0x4bd51b['fieldName'],'type':_0x4bd51b[_0xf231('0x2c')][_0xf231('0x2d')]};});_0x20ad55[_0xf231('0x2e')]=_[_0xf231('0x29')](_0x57969d,'name');_0x20ad55[_0xf231('0x2f')]=_['keys'](_0x3731cd[_0xf231('0x2f')]);_0x20ad55['filters']=_[_0xf231('0x30')](_0x20ad55['model'],_0x20ad55[_0xf231('0x2f')]);_0x3f9e5e[_0xf231('0x31')]=_[_0xf231('0x30')](_0x20ad55['model'],qs['fields'](_0x3731cd[_0xf231('0x2f')][_0xf231('0x32')]));_0x3f9e5e[_0xf231('0x31')]=_0x3f9e5e[_0xf231('0x31')]['length']?_0x3f9e5e[_0xf231('0x31')]:_0x20ad55['model'];if(!_0x3731cd[_0xf231('0x2f')][_0xf231('0x33')](_0xf231('0x34'))){_0x3f9e5e[_0xf231('0x1d')]=qs[_0xf231('0x1d')](_0x3731cd[_0xf231('0x2f')]['limit']);_0x3f9e5e[_0xf231('0x1c')]=qs[_0xf231('0x1c')](_0x3731cd[_0xf231('0x2f')][_0xf231('0x1c')]);}_0x3f9e5e[_0xf231('0x35')]=qs[_0xf231('0x36')](_0x3731cd[_0xf231('0x2f')][_0xf231('0x36')]);_0x3f9e5e[_0xf231('0x37')]=qs[_0xf231('0x38')](_[_0xf231('0x39')](_0x3731cd[_0xf231('0x2f')],_0x20ad55[_0xf231('0x38')]),_0x57969d);if(_0x3731cd['query'][_0xf231('0x3a')]){_0x3f9e5e[_0xf231('0x37')]=_[_0xf231('0x3b')](_0x3f9e5e[_0xf231('0x37')],{'$or':_[_0xf231('0x29')](_0x57969d,function(_0x3de1fd){if(_0x3de1fd[_0xf231('0x2c')]!==_0xf231('0x3c')){var _0x329cf0={};_0x329cf0[_0x3de1fd[_0xf231('0x26')]]={'$like':'%'+_0x3731cd[_0xf231('0x2f')][_0xf231('0x3a')]+'%'};return _0x329cf0;}})});}_0x3f9e5e=_['merge']({},_0x3f9e5e,_0x3731cd[_0xf231('0x3d')]);var _0x97645f={'where':_0x3f9e5e['where']};return db[_0xf231('0x2a')][_0xf231('0x1f')](_0x97645f)[_0xf231('0x23')](function(_0x153937){_0x5371b0[_0xf231('0x1f')]=_0x153937;if(_0x3731cd[_0xf231('0x2f')][_0xf231('0x3e')]){_0x3f9e5e[_0xf231('0x3f')]=[{'all':!![]}];}return db[_0xf231('0x2a')]['findAll'](_0x3f9e5e);})['then'](function(_0x1444fd){_0x5371b0[_0xf231('0x40')]=_0x1444fd;return _0x5371b0;})[_0xf231('0x23')](respondWithFilteredResult(_0x495815,_0x3f9e5e))['catch'](handleError(_0x495815,null));};exports['show']=function(_0x2e0479,_0x1f783f){var _0x2108b9={'raw':![],'where':{'id':_0x2e0479[_0xf231('0x41')]['id']}},_0x580aec={};_0x580aec[_0xf231('0x2e')]=_[_0xf231('0x42')](db['FreshsalesAccount'][_0xf231('0x2b')]);_0x580aec[_0xf231('0x2f')]=_[_0xf231('0x42')](_0x2e0479[_0xf231('0x2f')]);_0x580aec[_0xf231('0x38')]=_['intersection'](_0x580aec[_0xf231('0x2e')],_0x580aec['query']);_0x2108b9[_0xf231('0x31')]=_[_0xf231('0x30')](_0x580aec['model'],qs[_0xf231('0x32')](_0x2e0479[_0xf231('0x2f')][_0xf231('0x32')]));_0x2108b9[_0xf231('0x31')]=_0x2108b9[_0xf231('0x31')]['length']?_0x2108b9[_0xf231('0x31')]:_0x580aec[_0xf231('0x2e')];if(_0x2e0479[_0xf231('0x2f')][_0xf231('0x3e')]){_0x2108b9[_0xf231('0x3f')]=[{'all':!![]}];}_0x2108b9=_[_0xf231('0x3b')]({},_0x2108b9,_0x2e0479[_0xf231('0x3d')]);return db[_0xf231('0x2a')][_0xf231('0x43')](_0x2108b9)[_0xf231('0x23')](handleEntityNotFound(_0x1f783f,null))[_0xf231('0x23')](respondWithResult(_0x1f783f,null))[_0xf231('0x44')](handleError(_0x1f783f,null));};exports['create']=function(_0x1b36d2,_0xbc6361){return db[_0xf231('0x2a')][_0xf231('0x45')](_0x1b36d2[_0xf231('0x46')],{})[_0xf231('0x23')](respondWithResult(_0xbc6361,0xc9))[_0xf231('0x44')](handleError(_0xbc6361,null));};exports['update']=function(_0x59ea0b,_0x31e217){if(_0x59ea0b[_0xf231('0x46')]['id']){delete _0x59ea0b[_0xf231('0x46')]['id'];}return db[_0xf231('0x2a')][_0xf231('0x43')]({'where':{'id':_0x59ea0b['params']['id']}})['then'](handleEntityNotFound(_0x31e217,null))[_0xf231('0x23')](saveUpdates(_0x59ea0b[_0xf231('0x46')],null))[_0xf231('0x23')](respondWithResult(_0x31e217,null))[_0xf231('0x44')](handleError(_0x31e217,null));};exports[_0xf231('0x24')]=function(_0x32f494,_0x218db2){return db[_0xf231('0x2a')][_0xf231('0x43')]({'where':{'id':_0x32f494[_0xf231('0x41')]['id']}})[_0xf231('0x23')](handleEntityNotFound(_0x218db2,null))['then'](removeEntity(_0x218db2,null))[_0xf231('0x44')](handleError(_0x218db2,null));};exports[_0xf231('0x47')]=function(_0x9da269,_0x5bba55,_0x170a96){var _0x42590d={};var _0x3aa17c={};var _0x58ebb5;var _0x486806;return db[_0xf231('0x2a')][_0xf231('0x48')]({'where':{'id':_0x9da269['params']['id']}})[_0xf231('0x23')](handleEntityNotFound(_0x5bba55,null))[_0xf231('0x23')](function(_0x1e9e03){if(_0x1e9e03){_0x58ebb5=_0x1e9e03;_0x3aa17c[_0xf231('0x2e')]=_[_0xf231('0x42')](db['FreshsalesConfiguration'][_0xf231('0x2b')]);_0x3aa17c[_0xf231('0x2f')]=_['keys'](_0x9da269['query']);_0x3aa17c['filters']=_[_0xf231('0x30')](_0x3aa17c['model'],_0x3aa17c[_0xf231('0x2f')]);_0x42590d[_0xf231('0x31')]=_[_0xf231('0x30')](_0x3aa17c['model'],qs[_0xf231('0x32')](_0x9da269[_0xf231('0x2f')][_0xf231('0x32')]));_0x42590d[_0xf231('0x31')]=_0x42590d[_0xf231('0x31')]['length']?_0x42590d[_0xf231('0x31')]:_0x3aa17c[_0xf231('0x2e')];_0x42590d['order']=qs[_0xf231('0x36')](_0x9da269['query'][_0xf231('0x36')]);_0x42590d['where']=qs['filters'](_['pick'](_0x9da269[_0xf231('0x2f')],_0x3aa17c[_0xf231('0x38')]));if(_0x9da269[_0xf231('0x2f')][_0xf231('0x3a')]){_0x42590d[_0xf231('0x37')]=_[_0xf231('0x3b')](_0x42590d[_0xf231('0x37')],{'$or':_[_0xf231('0x29')](_0x42590d[_0xf231('0x31')],function(_0x587314){var _0x45005b={};_0x45005b[_0x587314]={'$like':'%'+_0x9da269[_0xf231('0x2f')][_0xf231('0x3a')]+'%'};return _0x45005b;})});}_0x42590d=_['merge']({},_0x42590d,_0x9da269[_0xf231('0x3d')]);return _0x58ebb5[_0xf231('0x47')](_0x42590d);}})[_0xf231('0x23')](function(_0xb060ac){if(_0xb060ac){_0x486806=_0xb060ac[_0xf231('0x49')];if(!_0x9da269[_0xf231('0x2f')][_0xf231('0x33')](_0xf231('0x34'))){_0x42590d[_0xf231('0x1d')]=qs[_0xf231('0x1d')](_0x9da269[_0xf231('0x2f')][_0xf231('0x1d')]);_0x42590d[_0xf231('0x1c')]=qs[_0xf231('0x1c')](_0x9da269[_0xf231('0x2f')][_0xf231('0x1c')]);}return _0x58ebb5['getConfigurations'](_0x42590d);}})[_0xf231('0x23')](function(_0x26aac8){if(_0x26aac8){return _0x26aac8?{'count':_0x486806,'rows':_0x26aac8}:null;}})['then'](respondWithResult(_0x5bba55,null))[_0xf231('0x44')](handleError(_0x5bba55,null));};exports[_0xf231('0x4a')]=function(_0x183143,_0x11f85e,_0x1ceef7){if(_0x183143[_0xf231('0x46')]['id']){delete _0x183143[_0xf231('0x46')]['id'];}return db['FreshsalesAccount'][_0xf231('0x48')]({'where':{'id':_0x183143[_0xf231('0x41')]['id']}})['then'](handleEntityNotFound(_0x11f85e,null))[_0xf231('0x23')](function(_0x818ca0){if(_0x818ca0){_0x183143['body'][_0xf231('0x4b')]=_0x818ca0['id'];_0x183143[_0xf231('0x46')]['Subjects']=integrations[_0xf231('0x4c')](_0x183143[_0xf231('0x46')][_0xf231('0x4d')],_0x183143['body'][_0xf231('0x2c')]);_0x183143['body'][_0xf231('0x4e')]=integrations[_0xf231('0x4f')](_0x183143[_0xf231('0x46')]['channel'],_0x183143[_0xf231('0x46')][_0xf231('0x2c')]);return db['FreshsalesConfiguration'][_0xf231('0x45')](_0x183143[_0xf231('0x46')],{'include':[{'model':db[_0xf231('0x50')],'as':'Subjects'},{'model':db[_0xf231('0x50')],'as':_0xf231('0x4e')}]});}return null;})[_0xf231('0x23')](respondWithResult(_0x11f85e,null))[_0xf231('0x44')](handleError(_0x11f85e,null));};exports['getFields']=function(_0xc8404f,_0x15f74f,_0x39c0a9){var _0x5d4740='';var _0x168ff2='';return db[_0xf231('0x2a')]['findOne']({'where':{'id':_0xc8404f['params']['id']},'attributes':['id','username',_0xf231('0x51'),_0xf231('0x52')]})[_0xf231('0x23')](handleEntityNotFound(_0x15f74f,null))[_0xf231('0x23')](function(_0x3f9a47){if(_0x3f9a47){_0x168ff2=_0x3f9a47[_0xf231('0x53')];_0x5d4740=_0x3f9a47[_0xf231('0x51')];var _0xb8f712=_0x3f9a47[_0xf231('0x51')][_0xf231('0x54')](-0x1);if(_0xb8f712==='/'){_0x5d4740=_0x5d4740['substring'](0x0,_0x5d4740['lastIndexOf'](_0xb8f712));}return rp({'method':_0xf231('0x55'),'uri':util[_0xf231('0x56')](_0xf231('0x57'),_0x5d4740,_0xf231('0x58')),'headers':{'Authorization':_0xf231('0x59')+_0x3f9a47[_0xf231('0x52')]},'json':!![]});}})[_0xf231('0x23')](function(_0x31b0eb){if(_0x31b0eb){var _0x27446a=_0x31b0eb[_0xf231('0x5a')];var _0x338cff=![];var _0x26961a=null;for(_0x26961a=0x0;_0x26961a<_0x27446a[_0xf231('0x49')];_0x26961a++){if(_0x27446a[_0x26961a][_0xf231('0x5b')]===_0x168ff2){_0x338cff=!![];}}if(_0x338cff){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xf231('0x5c')});}}})[_0xf231('0x23')](respondWithResult(_0x15f74f,null))[_0xf231('0x44')](function(_0x334b7d){var _0x35380a=_0xc8404f[_0xf231('0x2f')][_0xf231('0x5d')]?0x1f4:_0x334b7d[_0xf231('0x5e')]||0x1f4;logger[_0xf231('0x5f')](_0xf231('0x60'),'getFields',_0x35380a,JSON[_0xf231('0x61')](_0x334b7d));delete _0x334b7d['name'];if(_0x35380a===0x191){_0x35380a=0x190;}_0x15f74f[_0xf231('0x1b')](_0x35380a)[_0xf231('0x27')](_0xc8404f[_0xf231('0x2f')][_0xf231('0x5d')]?{'message':_0xf231('0x62'),'statusCode':_0x334b7d[_0xf231('0x5e')]}:_0x334b7d);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index aa6ed29..a8ed0cf 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 _0xd101=['moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','../../config/logger','api'];(function(_0x5e6890,_0x154b6d){var _0x590471=function(_0x413185){while(--_0x413185){_0x5e6890['push'](_0x5e6890['shift']());}};_0x590471(++_0x154b6d);}(_0xd101,0xc1));var _0x1d10=function(_0x1a0b5d,_0x34f183){_0x1a0b5d=_0x1a0b5d-0x0;var _0x43b1b8=_0xd101[_0x1a0b5d];return _0x43b1b8;};'use strict';var _=require(_0x1d10('0x0'));var util=require('util');var logger=require(_0x1d10('0x1'))(_0x1d10('0x2'));var moment=require(_0x1d10('0x3'));var BPromise=require(_0x1d10('0x4'));var rp=require(_0x1d10('0x5'));var fs=require('fs');var path=require(_0x1d10('0x6'));var rimraf=require(_0x1d10('0x7'));var config=require(_0x1d10('0x8'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x1d10('0x9'));module[_0x1d10('0xa')]=function(_0x2a4e2d,_0x27d569){return _0x2a4e2d[_0x1d10('0xb')](_0x1d10('0xc'),attributes,{'tableName':_0x1d10('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a6b=['request-promise','path','rimraf','./intFreshsalesAccount.attributes','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','moment'];(function(_0x23d993,_0x21800d){var _0x2f6b15=function(_0x4a7ec9){while(--_0x4a7ec9){_0x23d993['push'](_0x23d993['shift']());}};_0x2f6b15(++_0x21800d);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x396130,_0x3fc68f){_0x396130=_0x396130-0x0;var _0x134e36=_0x0a6b[_0x396130];return _0x134e36;};'use strict';var _=require(_0xb0a6('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb0a6('0x1'));var BPromise=require('bluebird');var rp=require(_0xb0a6('0x2'));var fs=require('fs');var path=require(_0xb0a6('0x3'));var rimraf=require(_0xb0a6('0x4'));var config=require('../../config/environment');var attributes=require(_0xb0a6('0x5'));var integrations=require('../../components/integrations/configuration');module[_0xb0a6('0x6')]=function(_0x415e9e,_0x5e2d2d){return _0x415e9e[_0xb0a6('0x7')](_0xb0a6('0x8'),attributes,{'tableName':_0xb0a6('0x9'),'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 e8645a5..88cdc26 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 _0x4888=['FreshsalesAccount','findAll','options','raw','where','attributes','limit','map','include','model','catch','ShowFreshsalesAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetFreshsalesAccount'];(function(_0x41778b,_0x3525d7){var _0x4c3c9d=function(_0x5b9903){while(--_0x5b9903){_0x41778b['push'](_0x41778b['shift']());}};_0x4c3c9d(++_0x3525d7);}(_0x4888,0x198));var _0x8488=function(_0x4cd4e4,_0x1857a2){_0x4cd4e4=_0x4cd4e4-0x0;var _0x18cf3b=_0x4888[_0x4cd4e4];return _0x18cf3b;};'use strict';var _=require('lodash');var util=require(_0x8488('0x0'));var moment=require(_0x8488('0x1'));var BPromise=require(_0x8488('0x2'));var rs=require(_0x8488('0x3'));var fs=require('fs');var Redis=require(_0x8488('0x4'));var db=require(_0x8488('0x5'))['db'];var utils=require(_0x8488('0x6'));var logger=require('../../config/logger')(_0x8488('0x7'));var config=require(_0x8488('0x8'));var jayson=require(_0x8488('0x9'));var client=jayson[_0x8488('0xa')][_0x8488('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19e508,_0x5250a1,_0x5b30a7){return new BPromise(function(_0x56aad0,_0x568a82){return client[_0x8488('0xc')](_0x19e508,_0x5b30a7)[_0x8488('0xd')](function(_0x542bd8){logger[_0x8488('0xe')](_0x8488('0xf'),_0x5250a1,_0x8488('0x10'));logger[_0x8488('0x11')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x5250a1,_0x8488('0x10'),JSON[_0x8488('0x12')](_0x542bd8));if(_0x542bd8[_0x8488('0x13')]){if(_0x542bd8[_0x8488('0x13')][_0x8488('0x14')]===0x1f4){logger['error'](_0x8488('0xf'),_0x5250a1,_0x542bd8[_0x8488('0x13')]['message']);return _0x568a82(_0x542bd8['error'][_0x8488('0x15')]);}logger['error'](_0x8488('0xf'),_0x5250a1,_0x542bd8['error']['message']);return _0x56aad0(_0x542bd8[_0x8488('0x13')][_0x8488('0x15')]);}else{logger[_0x8488('0xe')](_0x8488('0xf'),_0x5250a1,_0x8488('0x10'));_0x56aad0(_0x542bd8[_0x8488('0x16')][_0x8488('0x15')]);}})['catch'](function(_0x3dad45){logger[_0x8488('0x13')](_0x8488('0xf'),_0x5250a1,_0x3dad45);_0x568a82(_0x3dad45);});});}exports[_0x8488('0x17')]=function(_0x60ae2f){var _0x39775f=this;return new Promise(function(_0x1aedb1,_0x27c62a){return db[_0x8488('0x18')][_0x8488('0x19')]({'raw':_0x60ae2f[_0x8488('0x1a')]?_0x60ae2f[_0x8488('0x1a')][_0x8488('0x1b')]===undefined?!![]:![]:!![],'where':_0x60ae2f['options']?_0x60ae2f['options'][_0x8488('0x1c')]||null:null,'attributes':_0x60ae2f[_0x8488('0x1a')]?_0x60ae2f[_0x8488('0x1a')][_0x8488('0x1d')]||null:null,'limit':_0x60ae2f[_0x8488('0x1a')]?_0x60ae2f[_0x8488('0x1a')][_0x8488('0x1e')]||null:null,'include':_0x60ae2f[_0x8488('0x1a')]?_0x60ae2f[_0x8488('0x1a')]['include']?_[_0x8488('0x1f')](_0x60ae2f[_0x8488('0x1a')][_0x8488('0x20')],function(_0x1361a6){return{'model':db[_0x1361a6[_0x8488('0x21')]],'as':_0x1361a6['as'],'attributes':_0x1361a6['attributes'],'include':_0x1361a6['include']?_['map'](_0x1361a6['include'],function(_0x472624){return{'model':db[_0x472624['model']],'as':_0x472624['as'],'attributes':_0x472624['attributes'],'include':_0x472624[_0x8488('0x20')]?_[_0x8488('0x1f')](_0x472624[_0x8488('0x20')],function(_0x6ebee0){return{'model':db[_0x6ebee0[_0x8488('0x21')]],'as':_0x6ebee0['as'],'attributes':_0x6ebee0['attributes']};}):[]};}):[]};}):[]:[]})[_0x8488('0xd')](function(_0x38c137){logger[_0x8488('0xe')](_0x8488('0x17'),_0x60ae2f);logger[_0x8488('0x11')](_0x8488('0x17'),_0x60ae2f,JSON[_0x8488('0x12')](_0x38c137));_0x1aedb1(_0x38c137);})[_0x8488('0x22')](function(_0x368f9c){logger[_0x8488('0x13')](_0x8488('0x17'),_0x368f9c['message'],_0x60ae2f);_0x27c62a(_0x39775f['error'](0x1f4,_0x368f9c['message']));});});};exports[_0x8488('0x23')]=function(_0x408c36){var _0x19cf42=this;return new Promise(function(_0x121dcc,_0x117321){return db[_0x8488('0x18')]['find']({'raw':_0x408c36[_0x8488('0x1a')]?_0x408c36[_0x8488('0x1a')][_0x8488('0x1b')]===undefined?!![]:![]:!![],'where':_0x408c36[_0x8488('0x1a')]?_0x408c36[_0x8488('0x1a')]['where']||null:null,'attributes':_0x408c36[_0x8488('0x1a')]?_0x408c36[_0x8488('0x1a')]['attributes']||null:null,'include':_0x408c36[_0x8488('0x1a')]?_0x408c36[_0x8488('0x1a')][_0x8488('0x20')]?_[_0x8488('0x1f')](_0x408c36[_0x8488('0x1a')]['include'],function(_0x44c8f3){return{'model':db[_0x44c8f3[_0x8488('0x21')]],'as':_0x44c8f3['as'],'attributes':_0x44c8f3[_0x8488('0x1d')],'include':_0x44c8f3['include']?_[_0x8488('0x1f')](_0x44c8f3['include'],function(_0x205ccc){return{'model':db[_0x205ccc[_0x8488('0x21')]],'as':_0x205ccc['as'],'attributes':_0x205ccc[_0x8488('0x1d')],'include':_0x205ccc[_0x8488('0x20')]?_['map'](_0x205ccc[_0x8488('0x20')],function(_0xe71bd9){return{'model':db[_0xe71bd9[_0x8488('0x21')]],'as':_0xe71bd9['as'],'attributes':_0xe71bd9['attributes']};}):[]};}):[]};}):[]:[]})[_0x8488('0xd')](function(_0x17bfea){logger[_0x8488('0xe')](_0x8488('0x23'),_0x408c36);logger[_0x8488('0x11')](_0x8488('0x23'),_0x408c36,JSON[_0x8488('0x12')](_0x17bfea));_0x121dcc(_0x17bfea);})[_0x8488('0x22')](function(_0x1a8235){logger[_0x8488('0x13')](_0x8488('0x23'),_0x1a8235['message'],_0x408c36);_0x117321(_0x19cf42['error'](0x1f4,_0x1a8235[_0x8488('0x15')]));});});}; \ No newline at end of file +var _0x0a6b=['find','map','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','model','then','debug','stringify','catch','ShowFreshsalesAccount'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x18a16d,_0x199976){_0x18a16d=_0x18a16d-0x0;var _0x21cf0c=_0x0a6b[_0x18a16d];return _0x21cf0c;};'use strict';var _=require(_0xb0a6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb0a6('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb0a6('0x2'))['db'];var utils=require(_0xb0a6('0x3'));var logger=require(_0xb0a6('0x4'))('rpc');var config=require(_0xb0a6('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xb0a6('0x6')][_0xb0a6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5e2d2d,_0x11cd5b,_0x24515c){return new BPromise(function(_0x2a8516,_0x530c05){return client['request'](_0x5e2d2d,_0x24515c)['then'](function(_0x2ded05){logger[_0xb0a6('0x8')](_0xb0a6('0x9'),_0x11cd5b,_0xb0a6('0xa'));logger['debug'](_0xb0a6('0xb'),_0x11cd5b,_0xb0a6('0xa'),JSON['stringify'](_0x2ded05));if(_0x2ded05[_0xb0a6('0xc')]){if(_0x2ded05[_0xb0a6('0xc')][_0xb0a6('0xd')]===0x1f4){logger[_0xb0a6('0xc')](_0xb0a6('0x9'),_0x11cd5b,_0x2ded05[_0xb0a6('0xc')][_0xb0a6('0xe')]);return _0x530c05(_0x2ded05[_0xb0a6('0xc')][_0xb0a6('0xe')]);}logger[_0xb0a6('0xc')]('FreshsalesAccount,\x20%s,\x20%s',_0x11cd5b,_0x2ded05[_0xb0a6('0xc')]['message']);return _0x2a8516(_0x2ded05[_0xb0a6('0xc')]['message']);}else{logger[_0xb0a6('0x8')]('FreshsalesAccount,\x20%s,\x20%s',_0x11cd5b,_0xb0a6('0xa'));_0x2a8516(_0x2ded05[_0xb0a6('0xf')][_0xb0a6('0xe')]);}})['catch'](function(_0x56b594){logger[_0xb0a6('0xc')](_0xb0a6('0x9'),_0x11cd5b,_0x56b594);_0x530c05(_0x56b594);});});}exports[_0xb0a6('0x10')]=function(_0x18f994){var _0x10f504=this;return new Promise(function(_0x13a1c8,_0x567dd5){return db[_0xb0a6('0x11')][_0xb0a6('0x12')]({'raw':_0x18f994[_0xb0a6('0x13')]?_0x18f994[_0xb0a6('0x13')][_0xb0a6('0x14')]===undefined?!![]:![]:!![],'where':_0x18f994[_0xb0a6('0x13')]?_0x18f994['options'][_0xb0a6('0x15')]||null:null,'attributes':_0x18f994[_0xb0a6('0x13')]?_0x18f994[_0xb0a6('0x13')][_0xb0a6('0x16')]||null:null,'limit':_0x18f994[_0xb0a6('0x13')]?_0x18f994[_0xb0a6('0x13')][_0xb0a6('0x17')]||null:null,'include':_0x18f994[_0xb0a6('0x13')]?_0x18f994['options'][_0xb0a6('0x18')]?_['map'](_0x18f994[_0xb0a6('0x13')][_0xb0a6('0x18')],function(_0x4997df){return{'model':db[_0x4997df['model']],'as':_0x4997df['as'],'attributes':_0x4997df[_0xb0a6('0x16')],'include':_0x4997df[_0xb0a6('0x18')]?_['map'](_0x4997df[_0xb0a6('0x18')],function(_0x24574a){return{'model':db[_0x24574a[_0xb0a6('0x19')]],'as':_0x24574a['as'],'attributes':_0x24574a[_0xb0a6('0x16')],'include':_0x24574a['include']?_['map'](_0x24574a[_0xb0a6('0x18')],function(_0x1e9947){return{'model':db[_0x1e9947[_0xb0a6('0x19')]],'as':_0x1e9947['as'],'attributes':_0x1e9947['attributes']};}):[]};}):[]};}):[]:[]})[_0xb0a6('0x1a')](function(_0x3347ac){logger[_0xb0a6('0x8')](_0xb0a6('0x10'),_0x18f994);logger[_0xb0a6('0x1b')](_0xb0a6('0x10'),_0x18f994,JSON[_0xb0a6('0x1c')](_0x3347ac));_0x13a1c8(_0x3347ac);})[_0xb0a6('0x1d')](function(_0x4255b9){logger['error'](_0xb0a6('0x10'),_0x4255b9[_0xb0a6('0xe')],_0x18f994);_0x567dd5(_0x10f504[_0xb0a6('0xc')](0x1f4,_0x4255b9['message']));});});};exports[_0xb0a6('0x1e')]=function(_0x582fc2){var _0x131e46=this;return new Promise(function(_0x309a91,_0x114f91){return db[_0xb0a6('0x11')][_0xb0a6('0x1f')]({'raw':_0x582fc2[_0xb0a6('0x13')]?_0x582fc2[_0xb0a6('0x13')][_0xb0a6('0x14')]===undefined?!![]:![]:!![],'where':_0x582fc2[_0xb0a6('0x13')]?_0x582fc2[_0xb0a6('0x13')]['where']||null:null,'attributes':_0x582fc2['options']?_0x582fc2[_0xb0a6('0x13')][_0xb0a6('0x16')]||null:null,'include':_0x582fc2[_0xb0a6('0x13')]?_0x582fc2[_0xb0a6('0x13')][_0xb0a6('0x18')]?_[_0xb0a6('0x20')](_0x582fc2[_0xb0a6('0x13')][_0xb0a6('0x18')],function(_0x4b0479){return{'model':db[_0x4b0479[_0xb0a6('0x19')]],'as':_0x4b0479['as'],'attributes':_0x4b0479[_0xb0a6('0x16')],'include':_0x4b0479['include']?_[_0xb0a6('0x20')](_0x4b0479[_0xb0a6('0x18')],function(_0x52e397){return{'model':db[_0x52e397['model']],'as':_0x52e397['as'],'attributes':_0x52e397[_0xb0a6('0x16')],'include':_0x52e397[_0xb0a6('0x18')]?_[_0xb0a6('0x20')](_0x52e397[_0xb0a6('0x18')],function(_0x4310ae){return{'model':db[_0x4310ae[_0xb0a6('0x19')]],'as':_0x4310ae['as'],'attributes':_0x4310ae['attributes']};}):[]};}):[]};}):[]:[]})[_0xb0a6('0x1a')](function(_0x5c280e){logger[_0xb0a6('0x8')](_0xb0a6('0x1e'),_0x582fc2);logger['debug']('ShowFreshsalesAccount',_0x582fc2,JSON['stringify'](_0x5c280e));_0x309a91(_0x5c280e);})[_0xb0a6('0x1d')](function(_0xd484f){logger[_0xb0a6('0xc')](_0xb0a6('0x1e'),_0xd484f[_0xb0a6('0xe')],_0x582fc2);_0x114f91(_0x131e46['error'](0x1f4,_0xd484f[_0xb0a6('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 9e20e2a..6193d23 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 _0xa4aa=['Router','fs-extra','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','update','delete','multer','util','path','connect-timeout'];(function(_0x1f9ae0,_0x15f09f){var _0x31d851=function(_0x2b0679){while(--_0x2b0679){_0x1f9ae0['push'](_0x1f9ae0['shift']());}};_0x31d851(++_0x15f09f);}(_0xa4aa,0x1e0));var _0xaa4a=function(_0x14c96f,_0x2cd0e4){_0x14c96f=_0x14c96f-0x0;var _0x499e5f=_0xa4aa[_0x14c96f];return _0x499e5f;};'use strict';var multer=require(_0xaa4a('0x0'));var util=require(_0xaa4a('0x1'));var path=require(_0xaa4a('0x2'));var timeout=require(_0xaa4a('0x3'));var express=require('express');var router=express[_0xaa4a('0x4')]();var fs_extra=require(_0xaa4a('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshsalesConfiguration.controller');router[_0xaa4a('0x6')]('/',auth[_0xaa4a('0x7')](),controller[_0xaa4a('0x8')]);router[_0xaa4a('0x6')](_0xaa4a('0x9'),auth[_0xaa4a('0x7')](),controller[_0xaa4a('0xa')]);router[_0xaa4a('0x6')](_0xaa4a('0xb'),auth[_0xaa4a('0x7')](),controller[_0xaa4a('0xc')]);router[_0xaa4a('0x6')](_0xaa4a('0xd'),auth[_0xaa4a('0x7')](),controller[_0xaa4a('0xe')]);router[_0xaa4a('0x6')](_0xaa4a('0xf'),auth['isAuthenticated'](),controller[_0xaa4a('0x10')]);router[_0xaa4a('0x11')]('/',auth['isAuthenticated'](),controller[_0xaa4a('0x12')]);router[_0xaa4a('0x13')]('/:id',auth[_0xaa4a('0x7')](),controller[_0xaa4a('0x14')]);router[_0xaa4a('0x15')](_0xaa4a('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb15b=['../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra'];(function(_0x2bcb75,_0x5789a7){var _0x175345=function(_0x3a7d41){while(--_0x3a7d41){_0x2bcb75['push'](_0x2bcb75['shift']());}};_0x175345(++_0x5789a7);}(_0xb15b,0x85));var _0xbb15=function(_0x27b550,_0x2f3f07){_0x27b550=_0x27b550-0x0;var _0x5f3d3f=_0xb15b[_0x27b550];return _0x5f3d3f;};'use strict';var multer=require(_0xbb15('0x0'));var util=require('util');var path=require(_0xbb15('0x1'));var timeout=require(_0xbb15('0x2'));var express=require('express');var router=express[_0xbb15('0x3')]();var fs_extra=require(_0xbb15('0x4'));var auth=require(_0xbb15('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbb15('0x6'));var controller=require(_0xbb15('0x7'));router[_0xbb15('0x8')]('/',auth[_0xbb15('0x9')](),controller[_0xbb15('0xa')]);router[_0xbb15('0x8')](_0xbb15('0xb'),auth[_0xbb15('0x9')](),controller[_0xbb15('0xc')]);router[_0xbb15('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xbb15('0x8')](_0xbb15('0xd'),auth['isAuthenticated'](),controller[_0xbb15('0xe')]);router[_0xbb15('0x8')](_0xbb15('0xf'),auth[_0xbb15('0x9')](),controller[_0xbb15('0x10')]);router[_0xbb15('0x11')]('/',auth[_0xbb15('0x9')](),controller[_0xbb15('0x12')]);router[_0xbb15('0x13')](_0xbb15('0xb'),auth[_0xbb15('0x9')](),controller['update']);router[_0xbb15('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xbb15('0x15')]);module[_0xbb15('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index b2d3e54..9e7d4c2 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 _0xf63f=['sequelize','exports','STRING'];(function(_0x5db351,_0x43d3d4){var _0x2103e7=function(_0x4f5497){while(--_0x4f5497){_0x5db351['push'](_0x5db351['shift']());}};_0x2103e7(++_0x43d3d4);}(_0xf63f,0xcf));var _0xff63=function(_0x350600,_0x289889){_0x350600=_0x350600-0x0;var _0x108a1b=_0xf63f[_0x350600];return _0x108a1b;};'use strict';var Sequelize=require(_0xff63('0x0'));module[_0xff63('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xff63('0x2')]}}; \ No newline at end of file +var _0xa03d=['exports'];(function(_0x101ccf,_0x37e172){var _0x99b0f1=function(_0x4111c8){while(--_0x4111c8){_0x101ccf['push'](_0x101ccf['shift']());}};_0x99b0f1(++_0x37e172);}(_0xa03d,0x1c1));var _0xda03=function(_0xc03da0,_0x3b0a98){_0xc03da0=_0xc03da0-0x0;var _0x2f1918=_0xa03d[_0xc03da0];return _0x2f1918;};'use strict';var Sequelize=require('sequelize');module[_0xda03('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 2f76de3..f381289 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 _0x9828=['nolimit','order','sort','where','pick','map','VIRTUAL','merge','includeAll','include','FreshsalesConfiguration','findAll','rows','catch','show','params','length','options','find','create','body','getSubjects','findOne','FreshsalesField','filter','getDescriptions','getFields','eml-format','rimraf','zip-dir','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','sendStatus','error','stack','send','index','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty'];(function(_0x203271,_0x542139){var _0x37b0dd=function(_0x21d4d6){while(--_0x21d4d6){_0x203271['push'](_0x203271['shift']());}};_0x37b0dd(++_0x542139);}(_0x9828,0x1a6));var _0x8982=function(_0x3aa8db,_0x36ac4f){_0x3aa8db=_0x3aa8db-0x0;var _0x280899=_0x9828[_0x3aa8db];return _0x280899;};'use strict';var emlformat=require(_0x8982('0x0'));var rimraf=require(_0x8982('0x1'));var zipdir=require(_0x8982('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8982('0x3'));var BPromise=require(_0x8982('0x4'));var Mustache=require(_0x8982('0x5'));var util=require('util');var path=require('path');var sox=require(_0x8982('0x6'));var csv=require(_0x8982('0x7'));var ejs=require(_0x8982('0x8'));var fs=require('fs');var fs_extra=require(_0x8982('0x9'));var _=require(_0x8982('0xa'));var squel=require(_0x8982('0xb'));var crypto=require('crypto');var jsforce=require(_0x8982('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8982('0xd'));var Redis=require(_0x8982('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x8982('0xf'));var as=require(_0x8982('0x10'));var hardwareService=require(_0x8982('0x11'));var logger=require(_0x8982('0x12'))(_0x8982('0x13'));var utils=require(_0x8982('0x14'));var config=require(_0x8982('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8982('0x16'))['db'];function respondWithStatusCode(_0x2c891a,_0xead0bd){_0xead0bd=_0xead0bd||0xcc;return function(_0x86f696){if(_0x86f696){return _0x2c891a['sendStatus'](_0xead0bd);}return _0x2c891a[_0x8982('0x17')](_0xead0bd)[_0x8982('0x18')]();};}function respondWithResult(_0x3ba2d,_0x2334c5){_0x2334c5=_0x2334c5||0xc8;return function(_0x4ea2b1){if(_0x4ea2b1){return _0x3ba2d['status'](_0x2334c5)[_0x8982('0x19')](_0x4ea2b1);}};}function respondWithFilteredResult(_0x5a7573,_0x414725){return function(_0x9573b){if(_0x9573b){var _0x5cccc8=typeof _0x414725[_0x8982('0x1a')]==='undefined'&&typeof _0x414725[_0x8982('0x1b')]===_0x8982('0x1c');var _0x45399c=_0x9573b[_0x8982('0x1d')];var _0x58b868=_0x5cccc8?0x0:_0x414725['offset'];var _0xe5535=_0x5cccc8?_0x9573b['count']:_0x414725[_0x8982('0x1a')]+_0x414725['limit'];var _0x4bbd1b;if(_0xe5535>=_0x45399c){_0xe5535=_0x45399c;_0x4bbd1b=0xc8;}else{_0x4bbd1b=0xce;}_0x5a7573[_0x8982('0x17')](_0x4bbd1b);return _0x5a7573[_0x8982('0x1e')](_0x8982('0x1f'),_0x58b868+'-'+_0xe5535+'/'+_0x45399c)[_0x8982('0x19')](_0x9573b);}return null;};}function patchUpdates(_0x114b5e){return function(_0x238dbb){try{jsonpatch['apply'](_0x238dbb,_0x114b5e,!![]);}catch(_0x49cdc6){return BPromise[_0x8982('0x20')](_0x49cdc6);}return _0x238dbb['save']();};}function saveUpdates(_0xe8c922,_0x16b737){return function(_0x30db38){if(_0x30db38){return _0x30db38[_0x8982('0x21')](_0xe8c922)[_0x8982('0x22')](function(_0x1716c0){return _0x1716c0;});}return null;};}function removeEntity(_0x14ba36,_0x48db57){return function(_0x207918){if(_0x207918){return _0x207918[_0x8982('0x23')]()['then'](function(){_0x14ba36[_0x8982('0x17')](0xcc)[_0x8982('0x18')]();});}};}function handleEntityNotFound(_0x1e94c9,_0x4c6bae){return function(_0x31295b){if(!_0x31295b){_0x1e94c9[_0x8982('0x24')](0x194);}return _0x31295b;};}function handleError(_0x515574,_0x4006cf){_0x4006cf=_0x4006cf||0x1f4;return function(_0x51dab3){logger[_0x8982('0x25')](_0x51dab3[_0x8982('0x26')]);if(_0x51dab3['name']){delete _0x51dab3['name'];}_0x515574[_0x8982('0x17')](_0x4006cf)[_0x8982('0x27')](_0x51dab3);};}exports[_0x8982('0x28')]=function(_0x479b59,_0x2c689b){var _0x4f8de2={},_0x46effa={},_0xec2a87={'count':0x0,'rows':[]};var _0x51176c=_['map'](db['FreshsalesConfiguration'][_0x8982('0x29')],function(_0x160979){return{'name':_0x160979[_0x8982('0x2a')],'type':_0x160979[_0x8982('0x2b')]['key']};});_0x46effa['model']=_['map'](_0x51176c,'name');_0x46effa[_0x8982('0x2c')]=_[_0x8982('0x2d')](_0x479b59[_0x8982('0x2c')]);_0x46effa[_0x8982('0x2e')]=_['intersection'](_0x46effa[_0x8982('0x2f')],_0x46effa[_0x8982('0x2c')]);_0x4f8de2[_0x8982('0x30')]=_[_0x8982('0x31')](_0x46effa['model'],qs[_0x8982('0x32')](_0x479b59[_0x8982('0x2c')][_0x8982('0x32')]));_0x4f8de2['attributes']=_0x4f8de2[_0x8982('0x30')]['length']?_0x4f8de2['attributes']:_0x46effa[_0x8982('0x2f')];if(!_0x479b59[_0x8982('0x2c')][_0x8982('0x33')](_0x8982('0x34'))){_0x4f8de2[_0x8982('0x1b')]=qs[_0x8982('0x1b')](_0x479b59['query'][_0x8982('0x1b')]);_0x4f8de2[_0x8982('0x1a')]=qs[_0x8982('0x1a')](_0x479b59[_0x8982('0x2c')][_0x8982('0x1a')]);}_0x4f8de2[_0x8982('0x35')]=qs[_0x8982('0x36')](_0x479b59['query'][_0x8982('0x36')]);_0x4f8de2[_0x8982('0x37')]=qs['filters'](_[_0x8982('0x38')](_0x479b59[_0x8982('0x2c')],_0x46effa[_0x8982('0x2e')]),_0x51176c);if(_0x479b59[_0x8982('0x2c')]['filter']){_0x4f8de2[_0x8982('0x37')]=_['merge'](_0x4f8de2['where'],{'$or':_[_0x8982('0x39')](_0x51176c,function(_0x4dc6e0){if(_0x4dc6e0['type']!==_0x8982('0x3a')){var _0x3ce711={};_0x3ce711[_0x4dc6e0['name']]={'$like':'%'+_0x479b59[_0x8982('0x2c')]['filter']+'%'};return _0x3ce711;}})});}_0x4f8de2=_[_0x8982('0x3b')]({},_0x4f8de2,_0x479b59['options']);var _0x35c097={'where':_0x4f8de2[_0x8982('0x37')]};return db['FreshsalesConfiguration']['count'](_0x35c097)[_0x8982('0x22')](function(_0x1ffab7){_0xec2a87['count']=_0x1ffab7;if(_0x479b59[_0x8982('0x2c')][_0x8982('0x3c')]){_0x4f8de2[_0x8982('0x3d')]=[{'all':!![]}];}return db[_0x8982('0x3e')][_0x8982('0x3f')](_0x4f8de2);})[_0x8982('0x22')](function(_0x5702b1){_0xec2a87[_0x8982('0x40')]=_0x5702b1;return _0xec2a87;})[_0x8982('0x22')](respondWithFilteredResult(_0x2c689b,_0x4f8de2))[_0x8982('0x41')](handleError(_0x2c689b,null));};exports[_0x8982('0x42')]=function(_0x477a20,_0x431f44){var _0x394888={'raw':![],'where':{'id':_0x477a20[_0x8982('0x43')]['id']}},_0x42a804={};_0x42a804[_0x8982('0x2f')]=_[_0x8982('0x2d')](db[_0x8982('0x3e')][_0x8982('0x29')]);_0x42a804[_0x8982('0x2c')]=_[_0x8982('0x2d')](_0x477a20['query']);_0x42a804[_0x8982('0x2e')]=_['intersection'](_0x42a804[_0x8982('0x2f')],_0x42a804[_0x8982('0x2c')]);_0x394888[_0x8982('0x30')]=_[_0x8982('0x31')](_0x42a804[_0x8982('0x2f')],qs['fields'](_0x477a20['query'][_0x8982('0x32')]));_0x394888[_0x8982('0x30')]=_0x394888[_0x8982('0x30')][_0x8982('0x44')]?_0x394888[_0x8982('0x30')]:_0x42a804['model'];if(_0x477a20[_0x8982('0x2c')]['includeAll']){_0x394888[_0x8982('0x3d')]=[{'all':!![]}];}_0x394888=_[_0x8982('0x3b')]({},_0x394888,_0x477a20[_0x8982('0x45')]);return db['FreshsalesConfiguration'][_0x8982('0x46')](_0x394888)[_0x8982('0x22')](handleEntityNotFound(_0x431f44,null))[_0x8982('0x22')](respondWithResult(_0x431f44,null))[_0x8982('0x41')](handleError(_0x431f44,null));};exports[_0x8982('0x47')]=function(_0x12e6d1,_0x3e5761){return db['FreshsalesConfiguration'][_0x8982('0x47')](_0x12e6d1[_0x8982('0x48')],{})[_0x8982('0x22')](respondWithResult(_0x3e5761,0xc9))[_0x8982('0x41')](handleError(_0x3e5761,null));};exports[_0x8982('0x21')]=function(_0x26dd6d,_0x391f50){if(_0x26dd6d[_0x8982('0x48')]['id']){delete _0x26dd6d['body']['id'];}return db[_0x8982('0x3e')][_0x8982('0x46')]({'where':{'id':_0x26dd6d[_0x8982('0x43')]['id']}})['then'](handleEntityNotFound(_0x391f50,null))['then'](saveUpdates(_0x26dd6d[_0x8982('0x48')],null))[_0x8982('0x22')](respondWithResult(_0x391f50,null))[_0x8982('0x41')](handleError(_0x391f50,null));};exports['destroy']=function(_0x647974,_0x14bdf3){return db[_0x8982('0x3e')][_0x8982('0x46')]({'where':{'id':_0x647974[_0x8982('0x43')]['id']}})[_0x8982('0x22')](handleEntityNotFound(_0x14bdf3,null))['then'](removeEntity(_0x14bdf3,null))[_0x8982('0x41')](handleError(_0x14bdf3,null));};exports[_0x8982('0x49')]=function(_0x36f4c4,_0x19a64b,_0x54b7a1){var _0x3e9f77={};var _0x3bde2e={};var _0x57475e;var _0x13f73a;return db[_0x8982('0x3e')][_0x8982('0x4a')]({'where':{'id':_0x36f4c4[_0x8982('0x43')]['id']}})[_0x8982('0x22')](handleEntityNotFound(_0x19a64b,null))['then'](function(_0x5d9080){if(_0x5d9080){_0x57475e=_0x5d9080;_0x3bde2e[_0x8982('0x2f')]=_['keys'](db[_0x8982('0x4b')][_0x8982('0x29')]);_0x3bde2e[_0x8982('0x2c')]=_[_0x8982('0x2d')](_0x36f4c4[_0x8982('0x2c')]);_0x3bde2e['filters']=_[_0x8982('0x31')](_0x3bde2e['model'],_0x3bde2e[_0x8982('0x2c')]);_0x3e9f77['attributes']=_['intersection'](_0x3bde2e[_0x8982('0x2f')],qs[_0x8982('0x32')](_0x36f4c4[_0x8982('0x2c')]['fields']));_0x3e9f77['attributes']=_0x3e9f77[_0x8982('0x30')][_0x8982('0x44')]?_0x3e9f77[_0x8982('0x30')]:_0x3bde2e[_0x8982('0x2f')];_0x3e9f77[_0x8982('0x35')]=qs[_0x8982('0x36')](_0x36f4c4[_0x8982('0x2c')][_0x8982('0x36')]);_0x3e9f77[_0x8982('0x37')]=qs['filters'](_[_0x8982('0x38')](_0x36f4c4[_0x8982('0x2c')],_0x3bde2e['filters']));if(_0x36f4c4[_0x8982('0x2c')][_0x8982('0x4c')]){_0x3e9f77[_0x8982('0x37')]=_['merge'](_0x3e9f77[_0x8982('0x37')],{'$or':_[_0x8982('0x39')](_0x3e9f77[_0x8982('0x30')],function(_0x57b159){var _0x421f0d={};_0x421f0d[_0x57b159]={'$like':'%'+_0x36f4c4[_0x8982('0x2c')][_0x8982('0x4c')]+'%'};return _0x421f0d;})});}_0x3e9f77=_[_0x8982('0x3b')]({},_0x3e9f77,_0x36f4c4['options']);return _0x57475e[_0x8982('0x49')](_0x3e9f77);}})[_0x8982('0x22')](function(_0xf9b6){if(_0xf9b6){_0x13f73a=_0xf9b6['length'];if(!_0x36f4c4[_0x8982('0x2c')][_0x8982('0x33')](_0x8982('0x34'))){_0x3e9f77[_0x8982('0x1b')]=qs[_0x8982('0x1b')](_0x36f4c4[_0x8982('0x2c')]['limit']);_0x3e9f77[_0x8982('0x1a')]=qs[_0x8982('0x1a')](_0x36f4c4['query'][_0x8982('0x1a')]);}return _0x57475e[_0x8982('0x49')](_0x3e9f77);}})[_0x8982('0x22')](function(_0x31d08e){if(_0x31d08e){return _0x31d08e?{'count':_0x13f73a,'rows':_0x31d08e}:null;}})[_0x8982('0x22')](respondWithResult(_0x19a64b,null))['catch'](handleError(_0x19a64b,null));};exports[_0x8982('0x4d')]=function(_0x2ce813,_0x3fe67d,_0x1cee6f){var _0x1aaf86={};var _0x49c35a={};var _0x445440;var _0x2bd4b0;return db[_0x8982('0x3e')][_0x8982('0x4a')]({'where':{'id':_0x2ce813['params']['id']}})[_0x8982('0x22')](handleEntityNotFound(_0x3fe67d,null))[_0x8982('0x22')](function(_0x37ac90){if(_0x37ac90){_0x445440=_0x37ac90;_0x49c35a[_0x8982('0x2f')]=_[_0x8982('0x2d')](db['FreshsalesField'][_0x8982('0x29')]);_0x49c35a[_0x8982('0x2c')]=_[_0x8982('0x2d')](_0x2ce813[_0x8982('0x2c')]);_0x49c35a['filters']=_[_0x8982('0x31')](_0x49c35a[_0x8982('0x2f')],_0x49c35a['query']);_0x1aaf86[_0x8982('0x30')]=_[_0x8982('0x31')](_0x49c35a[_0x8982('0x2f')],qs[_0x8982('0x32')](_0x2ce813[_0x8982('0x2c')][_0x8982('0x32')]));_0x1aaf86[_0x8982('0x30')]=_0x1aaf86['attributes'][_0x8982('0x44')]?_0x1aaf86['attributes']:_0x49c35a['model'];_0x1aaf86[_0x8982('0x35')]=qs[_0x8982('0x36')](_0x2ce813[_0x8982('0x2c')][_0x8982('0x36')]);_0x1aaf86['where']=qs['filters'](_[_0x8982('0x38')](_0x2ce813['query'],_0x49c35a[_0x8982('0x2e')]));if(_0x2ce813[_0x8982('0x2c')][_0x8982('0x4c')]){_0x1aaf86['where']=_[_0x8982('0x3b')](_0x1aaf86[_0x8982('0x37')],{'$or':_[_0x8982('0x39')](_0x1aaf86[_0x8982('0x30')],function(_0x4376c9){var _0x55aefc={};_0x55aefc[_0x4376c9]={'$like':'%'+_0x2ce813[_0x8982('0x2c')][_0x8982('0x4c')]+'%'};return _0x55aefc;})});}_0x1aaf86=_[_0x8982('0x3b')]({},_0x1aaf86,_0x2ce813['options']);return _0x445440[_0x8982('0x4d')](_0x1aaf86);}})[_0x8982('0x22')](function(_0x1cc58d){if(_0x1cc58d){_0x2bd4b0=_0x1cc58d[_0x8982('0x44')];if(!_0x2ce813[_0x8982('0x2c')]['hasOwnProperty']('nolimit')){_0x1aaf86['limit']=qs[_0x8982('0x1b')](_0x2ce813[_0x8982('0x2c')][_0x8982('0x1b')]);_0x1aaf86['offset']=qs['offset'](_0x2ce813['query']['offset']);}return _0x445440[_0x8982('0x4d')](_0x1aaf86);}})['then'](function(_0xa24eba){if(_0xa24eba){return _0xa24eba?{'count':_0x2bd4b0,'rows':_0xa24eba}:null;}})[_0x8982('0x22')](respondWithResult(_0x3fe67d,null))['catch'](handleError(_0x3fe67d,null));};exports[_0x8982('0x4e')]=function(_0x55df55,_0x1ffe29,_0x15ce19){var _0x50288e={};var _0x188be3={};var _0x5077c2;var _0x586767;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x55df55[_0x8982('0x43')]['id']}})[_0x8982('0x22')](handleEntityNotFound(_0x1ffe29,null))[_0x8982('0x22')](function(_0x31254e){if(_0x31254e){_0x5077c2=_0x31254e;_0x188be3['model']=_[_0x8982('0x2d')](db[_0x8982('0x4b')][_0x8982('0x29')]);_0x188be3['query']=_[_0x8982('0x2d')](_0x55df55['query']);_0x188be3[_0x8982('0x2e')]=_[_0x8982('0x31')](_0x188be3[_0x8982('0x2f')],_0x188be3[_0x8982('0x2c')]);_0x50288e[_0x8982('0x30')]=_[_0x8982('0x31')](_0x188be3[_0x8982('0x2f')],qs[_0x8982('0x32')](_0x55df55[_0x8982('0x2c')][_0x8982('0x32')]));_0x50288e[_0x8982('0x30')]=_0x50288e[_0x8982('0x30')]['length']?_0x50288e[_0x8982('0x30')]:_0x188be3[_0x8982('0x2f')];_0x50288e[_0x8982('0x35')]=qs['sort'](_0x55df55['query'][_0x8982('0x36')]);_0x50288e[_0x8982('0x37')]=qs[_0x8982('0x2e')](_[_0x8982('0x38')](_0x55df55['query'],_0x188be3['filters']));if(_0x55df55[_0x8982('0x2c')][_0x8982('0x4c')]){_0x50288e[_0x8982('0x37')]=_['merge'](_0x50288e['where'],{'$or':_[_0x8982('0x39')](_0x50288e[_0x8982('0x30')],function(_0x32ce06){var _0x463f3c={};_0x463f3c[_0x32ce06]={'$like':'%'+_0x55df55['query']['filter']+'%'};return _0x463f3c;})});}_0x50288e=_[_0x8982('0x3b')]({},_0x50288e,_0x55df55[_0x8982('0x45')]);return _0x5077c2['getFields'](_0x50288e);}})['then'](function(_0x1d0331){if(_0x1d0331){_0x586767=_0x1d0331[_0x8982('0x44')];if(!_0x55df55[_0x8982('0x2c')][_0x8982('0x33')](_0x8982('0x34'))){_0x50288e['limit']=qs[_0x8982('0x1b')](_0x55df55[_0x8982('0x2c')]['limit']);_0x50288e['offset']=qs[_0x8982('0x1a')](_0x55df55[_0x8982('0x2c')]['offset']);}return _0x5077c2[_0x8982('0x4e')](_0x50288e);}})[_0x8982('0x22')](function(_0x37b49e){if(_0x37b49e){return _0x37b49e?{'count':_0x586767,'rows':_0x37b49e}:null;}})[_0x8982('0x22')](respondWithResult(_0x1ffe29,null))['catch'](handleError(_0x1ffe29,null));}; \ No newline at end of file +var _0xb413=['fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FreshsalesConfiguration','includeAll','include','findAll','catch','show','params','rawAttributes','create','body','find','getSubjects','findOne','FreshsalesField','hasOwnProperty','getDescriptions','getFields','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','name','index','map'];(function(_0x11bef7,_0x35cfa2){var _0x516854=function(_0x45eb17){while(--_0x45eb17){_0x11bef7['push'](_0x11bef7['shift']());}};_0x516854(++_0x35cfa2);}(_0xb413,0x158));var _0x3b41=function(_0xd9ad6e,_0x37cfbe){_0xd9ad6e=_0xd9ad6e-0x0;var _0x5b1155=_0xb413[_0xd9ad6e];return _0x5b1155;};'use strict';var emlformat=require(_0x3b41('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3b41('0x1'));var jsonpatch=require(_0x3b41('0x2'));var rp=require(_0x3b41('0x3'));var moment=require(_0x3b41('0x4'));var BPromise=require(_0x3b41('0x5'));var Mustache=require(_0x3b41('0x6'));var util=require(_0x3b41('0x7'));var path=require(_0x3b41('0x8'));var sox=require('sox');var csv=require(_0x3b41('0x9'));var ejs=require(_0x3b41('0xa'));var fs=require('fs');var fs_extra=require(_0x3b41('0xb'));var _=require(_0x3b41('0xc'));var squel=require('squel');var crypto=require(_0x3b41('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3b41('0xe'));var toCsv=require(_0x3b41('0x9'));var querystring=require(_0x3b41('0xf'));var Papa=require(_0x3b41('0x10'));var Redis=require(_0x3b41('0x11'));var authService=require(_0x3b41('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3b41('0x13'));var logger=require(_0x3b41('0x14'))(_0x3b41('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3b41('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d3e7c,_0x5e7dab){_0x5e7dab=_0x5e7dab||0xcc;return function(_0x266f20){if(_0x266f20){return _0x4d3e7c[_0x3b41('0x17')](_0x5e7dab);}return _0x4d3e7c[_0x3b41('0x18')](_0x5e7dab)[_0x3b41('0x19')]();};}function respondWithResult(_0x2bdfdf,_0x3105b4){_0x3105b4=_0x3105b4||0xc8;return function(_0xf5fdf0){if(_0xf5fdf0){return _0x2bdfdf['status'](_0x3105b4)[_0x3b41('0x1a')](_0xf5fdf0);}};}function respondWithFilteredResult(_0x1b8803,_0x532624){return function(_0x3bb9a6){if(_0x3bb9a6){var _0x35f929=typeof _0x532624['offset']===_0x3b41('0x1b')&&typeof _0x532624['limit']==='undefined';var _0x36a5e8=_0x3bb9a6[_0x3b41('0x1c')];var _0xd9ba19=_0x35f929?0x0:_0x532624[_0x3b41('0x1d')];var _0x1ea574=_0x35f929?_0x3bb9a6[_0x3b41('0x1c')]:_0x532624['offset']+_0x532624[_0x3b41('0x1e')];var _0x455f8c;if(_0x1ea574>=_0x36a5e8){_0x1ea574=_0x36a5e8;_0x455f8c=0xc8;}else{_0x455f8c=0xce;}_0x1b8803[_0x3b41('0x18')](_0x455f8c);return _0x1b8803[_0x3b41('0x1f')](_0x3b41('0x20'),_0xd9ba19+'-'+_0x1ea574+'/'+_0x36a5e8)['json'](_0x3bb9a6);}return null;};}function patchUpdates(_0x11ae8f){return function(_0x176204){try{jsonpatch[_0x3b41('0x21')](_0x176204,_0x11ae8f,!![]);}catch(_0x54822c){return BPromise[_0x3b41('0x22')](_0x54822c);}return _0x176204['save']();};}function saveUpdates(_0x1ce6cc,_0x338f67){return function(_0x1b0026){if(_0x1b0026){return _0x1b0026[_0x3b41('0x23')](_0x1ce6cc)[_0x3b41('0x24')](function(_0x1cc63e){return _0x1cc63e;});}return null;};}function removeEntity(_0x4a91b2,_0x4a8cd6){return function(_0x3dc81e){if(_0x3dc81e){return _0x3dc81e[_0x3b41('0x25')]()['then'](function(){_0x4a91b2[_0x3b41('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x417e74,_0x4b0db1){return function(_0x3b9916){if(!_0x3b9916){_0x417e74[_0x3b41('0x17')](0x194);}return _0x3b9916;};}function handleError(_0x32ce3b,_0x2ccd93){_0x2ccd93=_0x2ccd93||0x1f4;return function(_0x2df003){logger['error'](_0x2df003['stack']);if(_0x2df003[_0x3b41('0x26')]){delete _0x2df003['name'];}_0x32ce3b[_0x3b41('0x18')](_0x2ccd93)['send'](_0x2df003);};}exports[_0x3b41('0x27')]=function(_0x160298,_0x1cb8ae){var _0x4ac0b9={},_0x4c0bc7={},_0x25fedd={'count':0x0,'rows':[]};var _0x42766c=_[_0x3b41('0x28')](db['FreshsalesConfiguration']['rawAttributes'],function(_0x2d7c4d){return{'name':_0x2d7c4d[_0x3b41('0x29')],'type':_0x2d7c4d[_0x3b41('0x2a')]['key']};});_0x4c0bc7[_0x3b41('0x2b')]=_[_0x3b41('0x28')](_0x42766c,'name');_0x4c0bc7['query']=_[_0x3b41('0x2c')](_0x160298['query']);_0x4c0bc7[_0x3b41('0x2d')]=_[_0x3b41('0x2e')](_0x4c0bc7[_0x3b41('0x2b')],_0x4c0bc7[_0x3b41('0x2f')]);_0x4ac0b9[_0x3b41('0x30')]=_['intersection'](_0x4c0bc7[_0x3b41('0x2b')],qs[_0x3b41('0x31')](_0x160298['query'][_0x3b41('0x31')]));_0x4ac0b9[_0x3b41('0x30')]=_0x4ac0b9[_0x3b41('0x30')][_0x3b41('0x32')]?_0x4ac0b9[_0x3b41('0x30')]:_0x4c0bc7['model'];if(!_0x160298[_0x3b41('0x2f')]['hasOwnProperty'](_0x3b41('0x33'))){_0x4ac0b9[_0x3b41('0x1e')]=qs[_0x3b41('0x1e')](_0x160298[_0x3b41('0x2f')][_0x3b41('0x1e')]);_0x4ac0b9[_0x3b41('0x1d')]=qs[_0x3b41('0x1d')](_0x160298[_0x3b41('0x2f')][_0x3b41('0x1d')]);}_0x4ac0b9[_0x3b41('0x34')]=qs[_0x3b41('0x35')](_0x160298[_0x3b41('0x2f')]['sort']);_0x4ac0b9[_0x3b41('0x36')]=qs[_0x3b41('0x2d')](_[_0x3b41('0x37')](_0x160298[_0x3b41('0x2f')],_0x4c0bc7[_0x3b41('0x2d')]),_0x42766c);if(_0x160298[_0x3b41('0x2f')][_0x3b41('0x38')]){_0x4ac0b9[_0x3b41('0x36')]=_[_0x3b41('0x39')](_0x4ac0b9[_0x3b41('0x36')],{'$or':_[_0x3b41('0x28')](_0x42766c,function(_0xe45331){if(_0xe45331['type']!==_0x3b41('0x3a')){var _0x505d3d={};_0x505d3d[_0xe45331['name']]={'$like':'%'+_0x160298['query']['filter']+'%'};return _0x505d3d;}})});}_0x4ac0b9=_['merge']({},_0x4ac0b9,_0x160298[_0x3b41('0x3b')]);var _0x195839={'where':_0x4ac0b9['where']};return db[_0x3b41('0x3c')][_0x3b41('0x1c')](_0x195839)[_0x3b41('0x24')](function(_0x48ddc7){_0x25fedd['count']=_0x48ddc7;if(_0x160298['query'][_0x3b41('0x3d')]){_0x4ac0b9[_0x3b41('0x3e')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x3b41('0x3f')](_0x4ac0b9);})[_0x3b41('0x24')](function(_0x5d77af){_0x25fedd['rows']=_0x5d77af;return _0x25fedd;})[_0x3b41('0x24')](respondWithFilteredResult(_0x1cb8ae,_0x4ac0b9))[_0x3b41('0x40')](handleError(_0x1cb8ae,null));};exports[_0x3b41('0x41')]=function(_0x29ca69,_0x4e97bd){var _0x1c07bb={'raw':![],'where':{'id':_0x29ca69[_0x3b41('0x42')]['id']}},_0x10e8b1={};_0x10e8b1['model']=_[_0x3b41('0x2c')](db[_0x3b41('0x3c')][_0x3b41('0x43')]);_0x10e8b1[_0x3b41('0x2f')]=_[_0x3b41('0x2c')](_0x29ca69[_0x3b41('0x2f')]);_0x10e8b1['filters']=_[_0x3b41('0x2e')](_0x10e8b1[_0x3b41('0x2b')],_0x10e8b1[_0x3b41('0x2f')]);_0x1c07bb[_0x3b41('0x30')]=_[_0x3b41('0x2e')](_0x10e8b1[_0x3b41('0x2b')],qs[_0x3b41('0x31')](_0x29ca69[_0x3b41('0x2f')][_0x3b41('0x31')]));_0x1c07bb['attributes']=_0x1c07bb[_0x3b41('0x30')]['length']?_0x1c07bb[_0x3b41('0x30')]:_0x10e8b1[_0x3b41('0x2b')];if(_0x29ca69[_0x3b41('0x2f')]['includeAll']){_0x1c07bb[_0x3b41('0x3e')]=[{'all':!![]}];}_0x1c07bb=_[_0x3b41('0x39')]({},_0x1c07bb,_0x29ca69[_0x3b41('0x3b')]);return db[_0x3b41('0x3c')]['find'](_0x1c07bb)[_0x3b41('0x24')](handleEntityNotFound(_0x4e97bd,null))['then'](respondWithResult(_0x4e97bd,null))[_0x3b41('0x40')](handleError(_0x4e97bd,null));};exports['create']=function(_0x2b38ae,_0x4ee837){return db[_0x3b41('0x3c')][_0x3b41('0x44')](_0x2b38ae[_0x3b41('0x45')],{})[_0x3b41('0x24')](respondWithResult(_0x4ee837,0xc9))[_0x3b41('0x40')](handleError(_0x4ee837,null));};exports[_0x3b41('0x23')]=function(_0x18f4b0,_0x31d419){if(_0x18f4b0['body']['id']){delete _0x18f4b0['body']['id'];}return db[_0x3b41('0x3c')][_0x3b41('0x46')]({'where':{'id':_0x18f4b0['params']['id']}})[_0x3b41('0x24')](handleEntityNotFound(_0x31d419,null))[_0x3b41('0x24')](saveUpdates(_0x18f4b0[_0x3b41('0x45')],null))[_0x3b41('0x24')](respondWithResult(_0x31d419,null))[_0x3b41('0x40')](handleError(_0x31d419,null));};exports[_0x3b41('0x25')]=function(_0x3d9151,_0x29e004){return db['FreshsalesConfiguration'][_0x3b41('0x46')]({'where':{'id':_0x3d9151[_0x3b41('0x42')]['id']}})[_0x3b41('0x24')](handleEntityNotFound(_0x29e004,null))[_0x3b41('0x24')](removeEntity(_0x29e004,null))[_0x3b41('0x40')](handleError(_0x29e004,null));};exports[_0x3b41('0x47')]=function(_0x599565,_0x84238d,_0x56cc05){var _0x523728={};var _0x38e735={};var _0x1834f0;var _0x4df971;return db['FreshsalesConfiguration'][_0x3b41('0x48')]({'where':{'id':_0x599565[_0x3b41('0x42')]['id']}})[_0x3b41('0x24')](handleEntityNotFound(_0x84238d,null))['then'](function(_0x3fe7d2){if(_0x3fe7d2){_0x1834f0=_0x3fe7d2;_0x38e735[_0x3b41('0x2b')]=_[_0x3b41('0x2c')](db[_0x3b41('0x49')][_0x3b41('0x43')]);_0x38e735['query']=_[_0x3b41('0x2c')](_0x599565['query']);_0x38e735[_0x3b41('0x2d')]=_[_0x3b41('0x2e')](_0x38e735[_0x3b41('0x2b')],_0x38e735[_0x3b41('0x2f')]);_0x523728[_0x3b41('0x30')]=_[_0x3b41('0x2e')](_0x38e735[_0x3b41('0x2b')],qs['fields'](_0x599565[_0x3b41('0x2f')][_0x3b41('0x31')]));_0x523728[_0x3b41('0x30')]=_0x523728[_0x3b41('0x30')]['length']?_0x523728[_0x3b41('0x30')]:_0x38e735[_0x3b41('0x2b')];_0x523728[_0x3b41('0x34')]=qs[_0x3b41('0x35')](_0x599565['query']['sort']);_0x523728[_0x3b41('0x36')]=qs[_0x3b41('0x2d')](_[_0x3b41('0x37')](_0x599565[_0x3b41('0x2f')],_0x38e735[_0x3b41('0x2d')]));if(_0x599565['query'][_0x3b41('0x38')]){_0x523728['where']=_[_0x3b41('0x39')](_0x523728['where'],{'$or':_['map'](_0x523728[_0x3b41('0x30')],function(_0x5c9f25){var _0x890235={};_0x890235[_0x5c9f25]={'$like':'%'+_0x599565['query'][_0x3b41('0x38')]+'%'};return _0x890235;})});}_0x523728=_[_0x3b41('0x39')]({},_0x523728,_0x599565['options']);return _0x1834f0[_0x3b41('0x47')](_0x523728);}})['then'](function(_0x465c01){if(_0x465c01){_0x4df971=_0x465c01['length'];if(!_0x599565[_0x3b41('0x2f')][_0x3b41('0x4a')]('nolimit')){_0x523728['limit']=qs['limit'](_0x599565[_0x3b41('0x2f')][_0x3b41('0x1e')]);_0x523728[_0x3b41('0x1d')]=qs[_0x3b41('0x1d')](_0x599565[_0x3b41('0x2f')][_0x3b41('0x1d')]);}return _0x1834f0[_0x3b41('0x47')](_0x523728);}})[_0x3b41('0x24')](function(_0x48e386){if(_0x48e386){return _0x48e386?{'count':_0x4df971,'rows':_0x48e386}:null;}})[_0x3b41('0x24')](respondWithResult(_0x84238d,null))[_0x3b41('0x40')](handleError(_0x84238d,null));};exports[_0x3b41('0x4b')]=function(_0x3283d9,_0x3cebb5,_0x1e36e4){var _0xbfb3e5={};var _0x2a04ce={};var _0x36521e;var _0x152664;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x3283d9[_0x3b41('0x42')]['id']}})[_0x3b41('0x24')](handleEntityNotFound(_0x3cebb5,null))[_0x3b41('0x24')](function(_0xd53eff){if(_0xd53eff){_0x36521e=_0xd53eff;_0x2a04ce[_0x3b41('0x2b')]=_[_0x3b41('0x2c')](db['FreshsalesField'][_0x3b41('0x43')]);_0x2a04ce[_0x3b41('0x2f')]=_[_0x3b41('0x2c')](_0x3283d9['query']);_0x2a04ce['filters']=_['intersection'](_0x2a04ce[_0x3b41('0x2b')],_0x2a04ce[_0x3b41('0x2f')]);_0xbfb3e5['attributes']=_[_0x3b41('0x2e')](_0x2a04ce[_0x3b41('0x2b')],qs[_0x3b41('0x31')](_0x3283d9[_0x3b41('0x2f')]['fields']));_0xbfb3e5[_0x3b41('0x30')]=_0xbfb3e5['attributes'][_0x3b41('0x32')]?_0xbfb3e5['attributes']:_0x2a04ce['model'];_0xbfb3e5['order']=qs[_0x3b41('0x35')](_0x3283d9[_0x3b41('0x2f')]['sort']);_0xbfb3e5[_0x3b41('0x36')]=qs['filters'](_[_0x3b41('0x37')](_0x3283d9[_0x3b41('0x2f')],_0x2a04ce[_0x3b41('0x2d')]));if(_0x3283d9['query']['filter']){_0xbfb3e5[_0x3b41('0x36')]=_['merge'](_0xbfb3e5[_0x3b41('0x36')],{'$or':_[_0x3b41('0x28')](_0xbfb3e5[_0x3b41('0x30')],function(_0x50d912){var _0x3f40da={};_0x3f40da[_0x50d912]={'$like':'%'+_0x3283d9['query'][_0x3b41('0x38')]+'%'};return _0x3f40da;})});}_0xbfb3e5=_[_0x3b41('0x39')]({},_0xbfb3e5,_0x3283d9[_0x3b41('0x3b')]);return _0x36521e[_0x3b41('0x4b')](_0xbfb3e5);}})['then'](function(_0x129985){if(_0x129985){_0x152664=_0x129985[_0x3b41('0x32')];if(!_0x3283d9[_0x3b41('0x2f')][_0x3b41('0x4a')]('nolimit')){_0xbfb3e5[_0x3b41('0x1e')]=qs['limit'](_0x3283d9[_0x3b41('0x2f')][_0x3b41('0x1e')]);_0xbfb3e5[_0x3b41('0x1d')]=qs[_0x3b41('0x1d')](_0x3283d9['query'][_0x3b41('0x1d')]);}return _0x36521e[_0x3b41('0x4b')](_0xbfb3e5);}})[_0x3b41('0x24')](function(_0x1024b6){if(_0x1024b6){return _0x1024b6?{'count':_0x152664,'rows':_0x1024b6}:null;}})[_0x3b41('0x24')](respondWithResult(_0x3cebb5,null))[_0x3b41('0x40')](handleError(_0x3cebb5,null));};exports[_0x3b41('0x4c')]=function(_0x10e216,_0x2986fa,_0x308be7){var _0x2da6d4={};var _0x3905a0={};var _0x36cf7c;var _0x1e7732;return db[_0x3b41('0x3c')][_0x3b41('0x48')]({'where':{'id':_0x10e216[_0x3b41('0x42')]['id']}})[_0x3b41('0x24')](handleEntityNotFound(_0x2986fa,null))['then'](function(_0x51c569){if(_0x51c569){_0x36cf7c=_0x51c569;_0x3905a0[_0x3b41('0x2b')]=_[_0x3b41('0x2c')](db[_0x3b41('0x49')][_0x3b41('0x43')]);_0x3905a0[_0x3b41('0x2f')]=_[_0x3b41('0x2c')](_0x10e216[_0x3b41('0x2f')]);_0x3905a0[_0x3b41('0x2d')]=_[_0x3b41('0x2e')](_0x3905a0[_0x3b41('0x2b')],_0x3905a0['query']);_0x2da6d4[_0x3b41('0x30')]=_[_0x3b41('0x2e')](_0x3905a0[_0x3b41('0x2b')],qs[_0x3b41('0x31')](_0x10e216[_0x3b41('0x2f')][_0x3b41('0x31')]));_0x2da6d4['attributes']=_0x2da6d4[_0x3b41('0x30')]['length']?_0x2da6d4[_0x3b41('0x30')]:_0x3905a0['model'];_0x2da6d4[_0x3b41('0x34')]=qs['sort'](_0x10e216[_0x3b41('0x2f')][_0x3b41('0x35')]);_0x2da6d4['where']=qs[_0x3b41('0x2d')](_[_0x3b41('0x37')](_0x10e216['query'],_0x3905a0[_0x3b41('0x2d')]));if(_0x10e216[_0x3b41('0x2f')][_0x3b41('0x38')]){_0x2da6d4[_0x3b41('0x36')]=_[_0x3b41('0x39')](_0x2da6d4['where'],{'$or':_['map'](_0x2da6d4[_0x3b41('0x30')],function(_0x223a85){var _0x1eb072={};_0x1eb072[_0x223a85]={'$like':'%'+_0x10e216[_0x3b41('0x2f')][_0x3b41('0x38')]+'%'};return _0x1eb072;})});}_0x2da6d4=_[_0x3b41('0x39')]({},_0x2da6d4,_0x10e216[_0x3b41('0x3b')]);return _0x36cf7c[_0x3b41('0x4c')](_0x2da6d4);}})[_0x3b41('0x24')](function(_0x4b612b){if(_0x4b612b){_0x1e7732=_0x4b612b[_0x3b41('0x32')];if(!_0x10e216[_0x3b41('0x2f')]['hasOwnProperty'](_0x3b41('0x33'))){_0x2da6d4[_0x3b41('0x1e')]=qs['limit'](_0x10e216[_0x3b41('0x2f')][_0x3b41('0x1e')]);_0x2da6d4['offset']=qs[_0x3b41('0x1d')](_0x10e216[_0x3b41('0x2f')][_0x3b41('0x1d')]);}return _0x36cf7c[_0x3b41('0x4c')](_0x2da6d4);}})[_0x3b41('0x24')](function(_0xa521b6){if(_0xa521b6){return _0xa521b6?{'count':_0x1e7732,'rows':_0xa521b6}:null;}})[_0x3b41('0x24')](respondWithResult(_0x2986fa,null))[_0x3b41('0x40')](handleError(_0x2986fa,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 8871688..513de2a 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 _0x8fdf=['../../config/environment','./intFreshsalesConfiguration.attributes','exports','FreshsalesConfiguration','int_freshsales_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x8fdf,0x116));var _0xf8fd=function(_0x369c6c,_0x52c73d){_0x369c6c=_0x369c6c-0x0;var _0x47f5cc=_0x8fdf[_0x369c6c];return _0x47f5cc;};'use strict';var _=require(_0xf8fd('0x0'));var util=require('util');var logger=require(_0xf8fd('0x1'))(_0xf8fd('0x2'));var moment=require(_0xf8fd('0x3'));var BPromise=require(_0xf8fd('0x4'));var rp=require(_0xf8fd('0x5'));var fs=require('fs');var path=require(_0xf8fd('0x6'));var rimraf=require(_0xf8fd('0x7'));var config=require(_0xf8fd('0x8'));var attributes=require(_0xf8fd('0x9'));module[_0xf8fd('0xa')]=function(_0x107be0,_0x372a1b){return _0x107be0['define'](_0xf8fd('0xb'),attributes,{'tableName':_0xf8fd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x78b0=['../../config/environment','./intFreshsalesConfiguration.attributes','exports','FreshsalesConfiguration','int_freshsales_configurations','lodash','../../config/logger','api','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x78b0,0xcb));var _0x078b=function(_0x481780,_0x3db65d){_0x481780=_0x481780-0x0;var _0x2d2b2b=_0x78b0[_0x481780];return _0x2d2b2b;};'use strict';var _=require(_0x078b('0x0'));var util=require('util');var logger=require(_0x078b('0x1'))(_0x078b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x078b('0x3'));var fs=require('fs');var path=require(_0x078b('0x4'));var rimraf=require(_0x078b('0x5'));var config=require(_0x078b('0x6'));var attributes=require(_0x078b('0x7'));module[_0x078b('0x8')]=function(_0x4f5643,_0xa5a179){return _0x4f5643['define'](_0x078b('0x9'),attributes,{'tableName':_0x078b('0xa'),'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 e8426dc..032894f 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 _0x7e1f=['info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','util','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x4827a0,_0x528dcd){var _0x474a87=function(_0x2d7633){while(--_0x2d7633){_0x4827a0['push'](_0x4827a0['shift']());}};_0x474a87(++_0x528dcd);}(_0x7e1f,0x6e));var _0xf7e1=function(_0xbef445,_0x4d994a){_0xbef445=_0xbef445-0x0;var _0x12d448=_0x7e1f[_0xbef445];return _0x12d448;};'use strict';var _=require(_0xf7e1('0x0'));var util=require(_0xf7e1('0x1'));var moment=require('moment');var BPromise=require(_0xf7e1('0x2'));var rs=require(_0xf7e1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf7e1('0x4'))('rpc');var config=require(_0xf7e1('0x5'));var jayson=require(_0xf7e1('0x6'));var client=jayson[_0xf7e1('0x7')][_0xf7e1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3c306c,_0xe0014d,_0x194f84){return new BPromise(function(_0x2d5858,_0x1ca9a5){return client['request'](_0x3c306c,_0x194f84)['then'](function(_0x1a4423){logger[_0xf7e1('0x9')](_0xf7e1('0xa'),_0xe0014d,_0xf7e1('0xb'));logger[_0xf7e1('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0xe0014d,_0xf7e1('0xb'),JSON['stringify'](_0x1a4423));if(_0x1a4423[_0xf7e1('0xd')]){if(_0x1a4423['error']['code']===0x1f4){logger[_0xf7e1('0xd')](_0xf7e1('0xa'),_0xe0014d,_0x1a4423[_0xf7e1('0xd')]['message']);return _0x1ca9a5(_0x1a4423['error'][_0xf7e1('0xe')]);}logger[_0xf7e1('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s',_0xe0014d,_0x1a4423[_0xf7e1('0xd')]['message']);return _0x2d5858(_0x1a4423[_0xf7e1('0xd')]['message']);}else{logger[_0xf7e1('0x9')]('FreshsalesConfiguration,\x20%s,\x20%s',_0xe0014d,_0xf7e1('0xb'));_0x2d5858(_0x1a4423[_0xf7e1('0xf')][_0xf7e1('0xe')]);}})[_0xf7e1('0x10')](function(_0x27f8f4){logger['error'](_0xf7e1('0xa'),_0xe0014d,_0x27f8f4);_0x1ca9a5(_0x27f8f4);});});} \ No newline at end of file +var _0x4f72=['lodash','moment','ioredis','../../config/logger','rpc','jayson/promise','client','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','message','catch'];(function(_0x21b74b,_0x543c76){var _0x518cc6=function(_0x5b3010){while(--_0x5b3010){_0x21b74b['push'](_0x21b74b['shift']());}};_0x518cc6(++_0x543c76);}(_0x4f72,0x77));var _0x24f7=function(_0x188b0d,_0x4dc99d){_0x188b0d=_0x188b0d-0x0;var _0x1a185d=_0x4f72[_0x188b0d];return _0x1a185d;};'use strict';var _=require(_0x24f7('0x0'));var util=require('util');var moment=require(_0x24f7('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24f7('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x24f7('0x3'))(_0x24f7('0x4'));var config=require('../../config/environment');var jayson=require(_0x24f7('0x5'));var client=jayson[_0x24f7('0x6')][_0x24f7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xc52bd6,_0x732c42,_0x3fee0c){return new BPromise(function(_0x37b5bb,_0x45e7f9){return client['request'](_0xc52bd6,_0x3fee0c)[_0x24f7('0x8')](function(_0xb797b6){logger[_0x24f7('0x9')](_0x24f7('0xa'),_0x732c42,_0x24f7('0xb'));logger[_0x24f7('0xc')](_0x24f7('0xd'),_0x732c42,_0x24f7('0xb'),JSON['stringify'](_0xb797b6));if(_0xb797b6['error']){if(_0xb797b6[_0x24f7('0xe')]['code']===0x1f4){logger['error'](_0x24f7('0xa'),_0x732c42,_0xb797b6['error'][_0x24f7('0xf')]);return _0x45e7f9(_0xb797b6[_0x24f7('0xe')][_0x24f7('0xf')]);}logger[_0x24f7('0xe')](_0x24f7('0xa'),_0x732c42,_0xb797b6['error']['message']);return _0x37b5bb(_0xb797b6[_0x24f7('0xe')]['message']);}else{logger[_0x24f7('0x9')](_0x24f7('0xa'),_0x732c42,_0x24f7('0xb'));_0x37b5bb(_0xb797b6['result'][_0x24f7('0xf')]);}})[_0x24f7('0x10')](function(_0x4ea6a3){logger[_0x24f7('0xe')](_0x24f7('0xa'),_0x732c42,_0x4ea6a3);_0x45e7f9(_0x4ea6a3);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 22415c0..f1a4065 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 _0x47d6=['update','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','get','index','/:id','isAuthenticated','show','post','create','put'];(function(_0x463f44,_0x68f3ea){var _0x92860e=function(_0xa2f9a2){while(--_0xa2f9a2){_0x463f44['push'](_0x463f44['shift']());}};_0x92860e(++_0x68f3ea);}(_0x47d6,0x1de));var _0x647d=function(_0x34c985,_0x50d323){_0x34c985=_0x34c985-0x0;var _0x4c1497=_0x47d6[_0x34c985];return _0x4c1497;};'use strict';var multer=require(_0x647d('0x0'));var util=require(_0x647d('0x1'));var path=require(_0x647d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x647d('0x3')]();var fs_extra=require(_0x647d('0x4'));var auth=require(_0x647d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x647d('0x6'));var controller=require(_0x647d('0x7'));router[_0x647d('0x8')]('/',auth['isAuthenticated'](),controller[_0x647d('0x9')]);router[_0x647d('0x8')](_0x647d('0xa'),auth[_0x647d('0xb')](),controller[_0x647d('0xc')]);router[_0x647d('0xd')]('/',auth[_0x647d('0xb')](),controller[_0x647d('0xe')]);router[_0x647d('0xf')](_0x647d('0xa'),auth[_0x647d('0xb')](),controller[_0x647d('0x10')]);router['delete'](_0x647d('0xa'),auth[_0x647d('0xb')](),controller[_0x647d('0x11')]);module[_0x647d('0x12')]=router; \ No newline at end of file +var _0x795a=['fs-extra','../../components/auth/service','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','util','path','express'];(function(_0x3237bb,_0x1e768c){var _0x31678c=function(_0x13c95a){while(--_0x13c95a){_0x3237bb['push'](_0x3237bb['shift']());}};_0x31678c(++_0x1e768c);}(_0x795a,0xa2));var _0xa795=function(_0x3a924c,_0x2e5580){_0x3a924c=_0x3a924c-0x0;var _0xa1352b=_0x795a[_0x3a924c];return _0xa1352b;};'use strict';var multer=require('multer');var util=require(_0xa795('0x0'));var path=require(_0xa795('0x1'));var timeout=require('connect-timeout');var express=require(_0xa795('0x2'));var router=express['Router']();var fs_extra=require(_0xa795('0x3'));var auth=require(_0xa795('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa795('0x5'));router[_0xa795('0x6')]('/',auth[_0xa795('0x7')](),controller[_0xa795('0x8')]);router['get'](_0xa795('0x9'),auth['isAuthenticated'](),controller[_0xa795('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa795('0xb')]);router[_0xa795('0xc')](_0xa795('0x9'),auth[_0xa795('0x7')](),controller[_0xa795('0xd')]);router[_0xa795('0xe')](_0xa795('0x9'),auth[_0xa795('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index e93f2d9..a890088 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 _0x3ca5=['picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable'];(function(_0x28163e,_0x1bcee9){var _0x20081c=function(_0x5c123d){while(--_0x5c123d){_0x28163e['push'](_0x28163e['shift']());}};_0x20081c(++_0x1bcee9);}(_0x3ca5,0x1e1));var _0x53ca=function(_0x2049e8,_0x5b07e5){_0x2049e8=_0x2049e8-0x0;var _0x3ad5db=_0x3ca5[_0x2049e8];return _0x3ad5db;};'use strict';var Sequelize=require(_0x53ca('0x0'));module[_0x53ca('0x1')]={'type':{'type':Sequelize[_0x53ca('0x2')]('string',_0x53ca('0x3'),_0x53ca('0x4'),'keyValue',_0x53ca('0x5')),'defaultValue':_0x53ca('0x6')},'content':{'type':Sequelize[_0x53ca('0x7')]},'key':{'type':Sequelize[_0x53ca('0x7')]},'keyType':{'type':Sequelize[_0x53ca('0x2')](_0x53ca('0x6'),_0x53ca('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x53ca('0x7')]},'idField':{'type':Sequelize[_0x53ca('0x7')]},'nameField':{'type':Sequelize[_0x53ca('0x7')]},'customField':{'type':Sequelize[_0x53ca('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5ec6=['exports','ENUM','variable','customVariable','keyValue','picklist','string','STRING','sequelize'];(function(_0x2f622a,_0x55ef9){var _0x4b7cc9=function(_0x7c6ce3){while(--_0x7c6ce3){_0x2f622a['push'](_0x2f622a['shift']());}};_0x4b7cc9(++_0x55ef9);}(_0x5ec6,0xc5));var _0x65ec=function(_0x5bba4b,_0x2f0d98){_0x5bba4b=_0x5bba4b-0x0;var _0x399265=_0x5ec6[_0x5bba4b];return _0x399265;};'use strict';var Sequelize=require(_0x65ec('0x0'));module[_0x65ec('0x1')]={'type':{'type':Sequelize[_0x65ec('0x2')]('string',_0x65ec('0x3'),_0x65ec('0x4'),_0x65ec('0x5'),_0x65ec('0x6')),'defaultValue':_0x65ec('0x7')},'content':{'type':Sequelize[_0x65ec('0x8')]},'key':{'type':Sequelize[_0x65ec('0x8')]},'keyType':{'type':Sequelize[_0x65ec('0x2')](_0x65ec('0x7'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x65ec('0x8')]},'idField':{'type':Sequelize[_0x65ec('0x8')]},'nameField':{'type':Sequelize[_0x65ec('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x65ec('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 5b42008..3df0d45 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 _0xc748=['to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','offset','set','Content-Range','apply','reject','update','then','destroy','sendStatus','stack','name','send','map','FreshsalesField','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','filter','type','VIRTUAL','merge','options','count','includeAll','findAll','rows','catch','show','find','create','body','params','eml-format','zip-dir','request-promise','moment','bluebird','util','sox'];(function(_0x2ffc46,_0x35ce3c){var _0x1eda8f=function(_0x285344){while(--_0x285344){_0x2ffc46['push'](_0x2ffc46['shift']());}};_0x1eda8f(++_0x35ce3c);}(_0xc748,0x85));var _0x8c74=function(_0x39f34f,_0x298f45){_0x39f34f=_0x39f34f-0x0;var _0x59fee1=_0xc748[_0x39f34f];return _0x59fee1;};'use strict';var emlformat=require(_0x8c74('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8c74('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8c74('0x2'));var moment=require(_0x8c74('0x3'));var BPromise=require(_0x8c74('0x4'));var Mustache=require('mustache');var util=require(_0x8c74('0x5'));var path=require('path');var sox=require(_0x8c74('0x6'));var csv=require(_0x8c74('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8c74('0x8'));var _=require(_0x8c74('0x9'));var squel=require(_0x8c74('0xa'));var crypto=require('crypto');var jsforce=require(_0x8c74('0xb'));var deskjs=require(_0x8c74('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8c74('0xd'));var Papa=require(_0x8c74('0xe'));var Redis=require(_0x8c74('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8c74('0x10'));var as=require(_0x8c74('0x11'));var hardwareService=require(_0x8c74('0x12'));var logger=require('../../config/logger')(_0x8c74('0x13'));var utils=require(_0x8c74('0x14'));var config=require(_0x8c74('0x15'));var licenseUtil=require(_0x8c74('0x16'));var db=require(_0x8c74('0x17'))['db'];function respondWithStatusCode(_0x1c4f3e,_0x28fe58){_0x28fe58=_0x28fe58||0xcc;return function(_0x58c875){if(_0x58c875){return _0x1c4f3e['sendStatus'](_0x28fe58);}return _0x1c4f3e[_0x8c74('0x18')](_0x28fe58)[_0x8c74('0x19')]();};}function respondWithResult(_0x38800e,_0x585f26){_0x585f26=_0x585f26||0xc8;return function(_0x41c60a){if(_0x41c60a){return _0x38800e['status'](_0x585f26)['json'](_0x41c60a);}};}function respondWithFilteredResult(_0x1e277d,_0x3296c8){return function(_0x59bd2c){if(_0x59bd2c){var _0x3f5af6=typeof _0x3296c8['offset']==='undefined'&&typeof _0x3296c8['limit']===_0x8c74('0x1a');var _0x5f43bb=_0x59bd2c['count'];var _0x1f2db2=_0x3f5af6?0x0:_0x3296c8[_0x8c74('0x1b')];var _0x480bba=_0x3f5af6?_0x59bd2c['count']:_0x3296c8[_0x8c74('0x1b')]+_0x3296c8['limit'];var _0x2c7b26;if(_0x480bba>=_0x5f43bb){_0x480bba=_0x5f43bb;_0x2c7b26=0xc8;}else{_0x2c7b26=0xce;}_0x1e277d[_0x8c74('0x18')](_0x2c7b26);return _0x1e277d[_0x8c74('0x1c')](_0x8c74('0x1d'),_0x1f2db2+'-'+_0x480bba+'/'+_0x5f43bb)['json'](_0x59bd2c);}return null;};}function patchUpdates(_0x5d3e9e){return function(_0x121246){try{jsonpatch[_0x8c74('0x1e')](_0x121246,_0x5d3e9e,!![]);}catch(_0x17a9b8){return BPromise[_0x8c74('0x1f')](_0x17a9b8);}return _0x121246['save']();};}function saveUpdates(_0x4fb917,_0x5bf76c){return function(_0x15d426){if(_0x15d426){return _0x15d426[_0x8c74('0x20')](_0x4fb917)[_0x8c74('0x21')](function(_0x45af54){return _0x45af54;});}return null;};}function removeEntity(_0x21a1a7,_0x3ea546){return function(_0x1eff6a){if(_0x1eff6a){return _0x1eff6a[_0x8c74('0x22')]()[_0x8c74('0x21')](function(){_0x21a1a7[_0x8c74('0x18')](0xcc)[_0x8c74('0x19')]();});}};}function handleEntityNotFound(_0x596c69,_0x1714ac){return function(_0x58b114){if(!_0x58b114){_0x596c69[_0x8c74('0x23')](0x194);}return _0x58b114;};}function handleError(_0x21b21f,_0x3ca2a8){_0x3ca2a8=_0x3ca2a8||0x1f4;return function(_0x1f29f1){logger['error'](_0x1f29f1[_0x8c74('0x24')]);if(_0x1f29f1[_0x8c74('0x25')]){delete _0x1f29f1['name'];}_0x21b21f[_0x8c74('0x18')](_0x3ca2a8)[_0x8c74('0x26')](_0x1f29f1);};}exports['index']=function(_0x2d4bb4,_0x2da479){var _0x43b1eb={},_0x5d6d78={},_0x398651={'count':0x0,'rows':[]};var _0x183065=_[_0x8c74('0x27')](db[_0x8c74('0x28')][_0x8c74('0x29')],function(_0x5d5b44){return{'name':_0x5d5b44[_0x8c74('0x2a')],'type':_0x5d5b44['type']['key']};});_0x5d6d78[_0x8c74('0x2b')]=_[_0x8c74('0x27')](_0x183065,_0x8c74('0x25'));_0x5d6d78['query']=_[_0x8c74('0x2c')](_0x2d4bb4[_0x8c74('0x2d')]);_0x5d6d78[_0x8c74('0x2e')]=_[_0x8c74('0x2f')](_0x5d6d78[_0x8c74('0x2b')],_0x5d6d78[_0x8c74('0x2d')]);_0x43b1eb[_0x8c74('0x30')]=_[_0x8c74('0x2f')](_0x5d6d78[_0x8c74('0x2b')],qs['fields'](_0x2d4bb4[_0x8c74('0x2d')][_0x8c74('0x31')]));_0x43b1eb[_0x8c74('0x30')]=_0x43b1eb[_0x8c74('0x30')][_0x8c74('0x32')]?_0x43b1eb['attributes']:_0x5d6d78['model'];if(!_0x2d4bb4[_0x8c74('0x2d')][_0x8c74('0x33')]('nolimit')){_0x43b1eb['limit']=qs[_0x8c74('0x34')](_0x2d4bb4[_0x8c74('0x2d')][_0x8c74('0x34')]);_0x43b1eb[_0x8c74('0x1b')]=qs['offset'](_0x2d4bb4[_0x8c74('0x2d')][_0x8c74('0x1b')]);}_0x43b1eb['order']=qs['sort'](_0x2d4bb4[_0x8c74('0x2d')][_0x8c74('0x35')]);_0x43b1eb[_0x8c74('0x36')]=qs[_0x8c74('0x2e')](_['pick'](_0x2d4bb4[_0x8c74('0x2d')],_0x5d6d78[_0x8c74('0x2e')]),_0x183065);if(_0x2d4bb4['query'][_0x8c74('0x37')]){_0x43b1eb[_0x8c74('0x36')]=_['merge'](_0x43b1eb[_0x8c74('0x36')],{'$or':_[_0x8c74('0x27')](_0x183065,function(_0x4dce17){if(_0x4dce17[_0x8c74('0x38')]!==_0x8c74('0x39')){var _0xca83a0={};_0xca83a0[_0x4dce17['name']]={'$like':'%'+_0x2d4bb4['query'][_0x8c74('0x37')]+'%'};return _0xca83a0;}})});}_0x43b1eb=_[_0x8c74('0x3a')]({},_0x43b1eb,_0x2d4bb4[_0x8c74('0x3b')]);var _0x1b2789={'where':_0x43b1eb[_0x8c74('0x36')]};return db[_0x8c74('0x28')][_0x8c74('0x3c')](_0x1b2789)['then'](function(_0x26e1c1){_0x398651[_0x8c74('0x3c')]=_0x26e1c1;if(_0x2d4bb4[_0x8c74('0x2d')][_0x8c74('0x3d')]){_0x43b1eb['include']=[{'all':!![]}];}return db[_0x8c74('0x28')][_0x8c74('0x3e')](_0x43b1eb);})[_0x8c74('0x21')](function(_0x14edfb){_0x398651[_0x8c74('0x3f')]=_0x14edfb;return _0x398651;})[_0x8c74('0x21')](respondWithFilteredResult(_0x2da479,_0x43b1eb))[_0x8c74('0x40')](handleError(_0x2da479,null));};exports[_0x8c74('0x41')]=function(_0x3f2e07,_0x5af7e1){var _0x3d407b={'raw':!![],'where':{'id':_0x3f2e07['params']['id']}},_0x5895f5={};_0x5895f5['model']=_[_0x8c74('0x2c')](db['FreshsalesField'][_0x8c74('0x29')]);_0x5895f5[_0x8c74('0x2d')]=_[_0x8c74('0x2c')](_0x3f2e07[_0x8c74('0x2d')]);_0x5895f5[_0x8c74('0x2e')]=_[_0x8c74('0x2f')](_0x5895f5[_0x8c74('0x2b')],_0x5895f5[_0x8c74('0x2d')]);_0x3d407b['attributes']=_[_0x8c74('0x2f')](_0x5895f5[_0x8c74('0x2b')],qs['fields'](_0x3f2e07[_0x8c74('0x2d')][_0x8c74('0x31')]));_0x3d407b[_0x8c74('0x30')]=_0x3d407b[_0x8c74('0x30')][_0x8c74('0x32')]?_0x3d407b[_0x8c74('0x30')]:_0x5895f5[_0x8c74('0x2b')];if(_0x3f2e07[_0x8c74('0x2d')][_0x8c74('0x3d')]){_0x3d407b['include']=[{'all':!![]}];}_0x3d407b=_[_0x8c74('0x3a')]({},_0x3d407b,_0x3f2e07['options']);return db[_0x8c74('0x28')][_0x8c74('0x42')](_0x3d407b)[_0x8c74('0x21')](handleEntityNotFound(_0x5af7e1,null))[_0x8c74('0x21')](respondWithResult(_0x5af7e1,null))[_0x8c74('0x40')](handleError(_0x5af7e1,null));};exports[_0x8c74('0x43')]=function(_0x49bd2a,_0x4f9451){return db['FreshsalesField'][_0x8c74('0x43')](_0x49bd2a[_0x8c74('0x44')],{})[_0x8c74('0x21')](respondWithResult(_0x4f9451,0xc9))[_0x8c74('0x40')](handleError(_0x4f9451,null));};exports[_0x8c74('0x20')]=function(_0x12f8d2,_0x5b1e98){if(_0x12f8d2[_0x8c74('0x44')]['id']){delete _0x12f8d2[_0x8c74('0x44')]['id'];}return db['FreshsalesField'][_0x8c74('0x42')]({'where':{'id':_0x12f8d2[_0x8c74('0x45')]['id']}})[_0x8c74('0x21')](handleEntityNotFound(_0x5b1e98,null))[_0x8c74('0x21')](saveUpdates(_0x12f8d2['body'],null))[_0x8c74('0x21')](respondWithResult(_0x5b1e98,null))[_0x8c74('0x40')](handleError(_0x5b1e98,null));};exports['destroy']=function(_0x5b72bf,_0x5c56b7){return db[_0x8c74('0x28')][_0x8c74('0x42')]({'where':{'id':_0x5b72bf[_0x8c74('0x45')]['id']}})[_0x8c74('0x21')](handleEntityNotFound(_0x5c56b7,null))['then'](removeEntity(_0x5c56b7,null))[_0x8c74('0x40')](handleError(_0x5c56b7,null));}; \ No newline at end of file +var _0x4199=['send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','FreshsalesField','includeAll','include','findAll','catch','show','params','find','create','body','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','apply','reject','update','then','destroy','error','name'];(function(_0x49ab12,_0x59a9e2){var _0x12eee9=function(_0x1158d2){while(--_0x1158d2){_0x49ab12['push'](_0x49ab12['shift']());}};_0x12eee9(++_0x59a9e2);}(_0x4199,0x141));var _0x9419=function(_0x51cdaa,_0x2f4b51){_0x51cdaa=_0x51cdaa-0x0;var _0x36c5e0=_0x4199[_0x51cdaa];return _0x36c5e0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9419('0x0'));var jsonpatch=require(_0x9419('0x1'));var rp=require(_0x9419('0x2'));var moment=require(_0x9419('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9419('0x4'));var util=require(_0x9419('0x5'));var path=require(_0x9419('0x6'));var sox=require(_0x9419('0x7'));var csv=require('to-csv');var ejs=require(_0x9419('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9419('0x9'));var squel=require(_0x9419('0xa'));var crypto=require(_0x9419('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9419('0xc'));var Redis=require('ioredis');var authService=require(_0x9419('0xd'));var qs=require(_0x9419('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9419('0xf'));var logger=require(_0x9419('0x10'))(_0x9419('0x11'));var utils=require(_0x9419('0x12'));var config=require(_0x9419('0x13'));var licenseUtil=require(_0x9419('0x14'));var db=require(_0x9419('0x15'))['db'];function respondWithStatusCode(_0x3309a0,_0x10fb1a){_0x10fb1a=_0x10fb1a||0xcc;return function(_0x16146b){if(_0x16146b){return _0x3309a0[_0x9419('0x16')](_0x10fb1a);}return _0x3309a0['status'](_0x10fb1a)[_0x9419('0x17')]();};}function respondWithResult(_0x1ce2a5,_0x168e1d){_0x168e1d=_0x168e1d||0xc8;return function(_0x349c89){if(_0x349c89){return _0x1ce2a5['status'](_0x168e1d)[_0x9419('0x18')](_0x349c89);}};}function respondWithFilteredResult(_0x4ba154,_0x3a9457){return function(_0x15610b){if(_0x15610b){var _0x3b4ffb=typeof _0x3a9457[_0x9419('0x19')]==='undefined'&&typeof _0x3a9457[_0x9419('0x1a')]===_0x9419('0x1b');var _0x585dd8=_0x15610b[_0x9419('0x1c')];var _0x594ce1=_0x3b4ffb?0x0:_0x3a9457[_0x9419('0x19')];var _0xd4838a=_0x3b4ffb?_0x15610b['count']:_0x3a9457[_0x9419('0x19')]+_0x3a9457[_0x9419('0x1a')];var _0x264de7;if(_0xd4838a>=_0x585dd8){_0xd4838a=_0x585dd8;_0x264de7=0xc8;}else{_0x264de7=0xce;}_0x4ba154[_0x9419('0x1d')](_0x264de7);return _0x4ba154[_0x9419('0x1e')](_0x9419('0x1f'),_0x594ce1+'-'+_0xd4838a+'/'+_0x585dd8)[_0x9419('0x18')](_0x15610b);}return null;};}function patchUpdates(_0x585d98){return function(_0x4a5f40){try{jsonpatch[_0x9419('0x20')](_0x4a5f40,_0x585d98,!![]);}catch(_0x2f80d7){return BPromise[_0x9419('0x21')](_0x2f80d7);}return _0x4a5f40['save']();};}function saveUpdates(_0x5672ae,_0x5df7a8){return function(_0x5cb36d){if(_0x5cb36d){return _0x5cb36d[_0x9419('0x22')](_0x5672ae)[_0x9419('0x23')](function(_0x245ce6){return _0x245ce6;});}return null;};}function removeEntity(_0x45dcb1,_0x496d88){return function(_0x132985){if(_0x132985){return _0x132985[_0x9419('0x24')]()[_0x9419('0x23')](function(){_0x45dcb1[_0x9419('0x1d')](0xcc)[_0x9419('0x17')]();});}};}function handleEntityNotFound(_0x20fdb6,_0xc74114){return function(_0x5f370e){if(!_0x5f370e){_0x20fdb6['sendStatus'](0x194);}return _0x5f370e;};}function handleError(_0x4e5751,_0x4e906b){_0x4e906b=_0x4e906b||0x1f4;return function(_0x223712){logger[_0x9419('0x25')](_0x223712['stack']);if(_0x223712['name']){delete _0x223712[_0x9419('0x26')];}_0x4e5751[_0x9419('0x1d')](_0x4e906b)[_0x9419('0x27')](_0x223712);};}exports[_0x9419('0x28')]=function(_0x3a7eef,_0x559a07){var _0x10b24f={},_0x457f9c={},_0x1bb1bb={'count':0x0,'rows':[]};var _0x433346=_[_0x9419('0x29')](db['FreshsalesField']['rawAttributes'],function(_0x1ff2df){return{'name':_0x1ff2df[_0x9419('0x2a')],'type':_0x1ff2df[_0x9419('0x2b')][_0x9419('0x2c')]};});_0x457f9c[_0x9419('0x2d')]=_[_0x9419('0x29')](_0x433346,_0x9419('0x26'));_0x457f9c[_0x9419('0x2e')]=_[_0x9419('0x2f')](_0x3a7eef[_0x9419('0x2e')]);_0x457f9c[_0x9419('0x30')]=_[_0x9419('0x31')](_0x457f9c[_0x9419('0x2d')],_0x457f9c['query']);_0x10b24f[_0x9419('0x32')]=_[_0x9419('0x31')](_0x457f9c[_0x9419('0x2d')],qs[_0x9419('0x33')](_0x3a7eef[_0x9419('0x2e')][_0x9419('0x33')]));_0x10b24f[_0x9419('0x32')]=_0x10b24f['attributes'][_0x9419('0x34')]?_0x10b24f[_0x9419('0x32')]:_0x457f9c[_0x9419('0x2d')];if(!_0x3a7eef[_0x9419('0x2e')][_0x9419('0x35')](_0x9419('0x36'))){_0x10b24f['limit']=qs[_0x9419('0x1a')](_0x3a7eef[_0x9419('0x2e')]['limit']);_0x10b24f[_0x9419('0x19')]=qs[_0x9419('0x19')](_0x3a7eef['query'][_0x9419('0x19')]);}_0x10b24f[_0x9419('0x37')]=qs[_0x9419('0x38')](_0x3a7eef[_0x9419('0x2e')][_0x9419('0x38')]);_0x10b24f[_0x9419('0x39')]=qs[_0x9419('0x30')](_['pick'](_0x3a7eef[_0x9419('0x2e')],_0x457f9c[_0x9419('0x30')]),_0x433346);if(_0x3a7eef[_0x9419('0x2e')][_0x9419('0x3a')]){_0x10b24f[_0x9419('0x39')]=_[_0x9419('0x3b')](_0x10b24f[_0x9419('0x39')],{'$or':_[_0x9419('0x29')](_0x433346,function(_0x38c379){if(_0x38c379[_0x9419('0x2b')]!==_0x9419('0x3c')){var _0x54a8a8={};_0x54a8a8[_0x38c379['name']]={'$like':'%'+_0x3a7eef[_0x9419('0x2e')][_0x9419('0x3a')]+'%'};return _0x54a8a8;}})});}_0x10b24f=_[_0x9419('0x3b')]({},_0x10b24f,_0x3a7eef[_0x9419('0x3d')]);var _0x5b1912={'where':_0x10b24f[_0x9419('0x39')]};return db[_0x9419('0x3e')][_0x9419('0x1c')](_0x5b1912)[_0x9419('0x23')](function(_0x15c955){_0x1bb1bb[_0x9419('0x1c')]=_0x15c955;if(_0x3a7eef[_0x9419('0x2e')][_0x9419('0x3f')]){_0x10b24f[_0x9419('0x40')]=[{'all':!![]}];}return db[_0x9419('0x3e')][_0x9419('0x41')](_0x10b24f);})[_0x9419('0x23')](function(_0x58643c){_0x1bb1bb['rows']=_0x58643c;return _0x1bb1bb;})['then'](respondWithFilteredResult(_0x559a07,_0x10b24f))[_0x9419('0x42')](handleError(_0x559a07,null));};exports[_0x9419('0x43')]=function(_0x3a9f39,_0x5b3286){var _0x13f962={'raw':!![],'where':{'id':_0x3a9f39[_0x9419('0x44')]['id']}},_0x14c893={};_0x14c893[_0x9419('0x2d')]=_[_0x9419('0x2f')](db['FreshsalesField']['rawAttributes']);_0x14c893['query']=_[_0x9419('0x2f')](_0x3a9f39[_0x9419('0x2e')]);_0x14c893[_0x9419('0x30')]=_[_0x9419('0x31')](_0x14c893[_0x9419('0x2d')],_0x14c893[_0x9419('0x2e')]);_0x13f962[_0x9419('0x32')]=_[_0x9419('0x31')](_0x14c893[_0x9419('0x2d')],qs[_0x9419('0x33')](_0x3a9f39[_0x9419('0x2e')][_0x9419('0x33')]));_0x13f962[_0x9419('0x32')]=_0x13f962[_0x9419('0x32')]['length']?_0x13f962['attributes']:_0x14c893['model'];if(_0x3a9f39[_0x9419('0x2e')][_0x9419('0x3f')]){_0x13f962[_0x9419('0x40')]=[{'all':!![]}];}_0x13f962=_['merge']({},_0x13f962,_0x3a9f39[_0x9419('0x3d')]);return db[_0x9419('0x3e')][_0x9419('0x45')](_0x13f962)[_0x9419('0x23')](handleEntityNotFound(_0x5b3286,null))[_0x9419('0x23')](respondWithResult(_0x5b3286,null))[_0x9419('0x42')](handleError(_0x5b3286,null));};exports[_0x9419('0x46')]=function(_0x342064,_0x3da80c){return db['FreshsalesField'][_0x9419('0x46')](_0x342064['body'],{})[_0x9419('0x23')](respondWithResult(_0x3da80c,0xc9))[_0x9419('0x42')](handleError(_0x3da80c,null));};exports['update']=function(_0x105009,_0x31ac23){if(_0x105009['body']['id']){delete _0x105009['body']['id'];}return db['FreshsalesField']['find']({'where':{'id':_0x105009[_0x9419('0x44')]['id']}})[_0x9419('0x23')](handleEntityNotFound(_0x31ac23,null))[_0x9419('0x23')](saveUpdates(_0x105009[_0x9419('0x47')],null))[_0x9419('0x23')](respondWithResult(_0x31ac23,null))[_0x9419('0x42')](handleError(_0x31ac23,null));};exports['destroy']=function(_0x17de39,_0x49866d){return db[_0x9419('0x3e')][_0x9419('0x45')]({'where':{'id':_0x17de39[_0x9419('0x44')]['id']}})[_0x9419('0x23')](handleEntityNotFound(_0x49866d,null))[_0x9419('0x23')](removeEntity(_0x49866d,null))['catch'](handleError(_0x49866d,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index ea1c8b6..e71bdc9 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 _0x7497=['../../config/logger','request-promise','path','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util'];(function(_0x525033,_0x4e7ae8){var _0x5217ed=function(_0x117d8c){while(--_0x117d8c){_0x525033['push'](_0x525033['shift']());}};_0x5217ed(++_0x4e7ae8);}(_0x7497,0xd0));var _0x7749=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7497[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7749('0x0'));var util=require(_0x7749('0x1'));var logger=require(_0x7749('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7749('0x3'));var fs=require('fs');var path=require(_0x7749('0x4'));var rimraf=require('rimraf');var config=require(_0x7749('0x5'));var attributes=require(_0x7749('0x6'));module[_0x7749('0x7')]=function(_0x455d05,_0x289268){return _0x455d05[_0x7749('0x8')](_0x7749('0x9'),attributes,{'tableName':_0x7749('0xa'),'paranoid':![],'indexes':[{'name':_0x7749('0xb'),'fields':[_0x7749('0xc'),_0x7749('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x457b=['path','../../config/environment','./intFreshsalesField.attributes','exports','FreshsalesField','int_freshsales_fields','freshsales_unique_index','lodash','util','api','moment','bluebird','request-promise'];(function(_0x494ed2,_0x3e6f24){var _0x5182fb=function(_0x226a35){while(--_0x226a35){_0x494ed2['push'](_0x494ed2['shift']());}};_0x5182fb(++_0x3e6f24);}(_0x457b,0xca));var _0xb457=function(_0x3c9a89,_0x378778){_0x3c9a89=_0x3c9a89-0x0;var _0x1eb47b=_0x457b[_0x3c9a89];return _0x1eb47b;};'use strict';var _=require(_0xb457('0x0'));var util=require(_0xb457('0x1'));var logger=require('../../config/logger')(_0xb457('0x2'));var moment=require(_0xb457('0x3'));var BPromise=require(_0xb457('0x4'));var rp=require(_0xb457('0x5'));var fs=require('fs');var path=require(_0xb457('0x6'));var rimraf=require('rimraf');var config=require(_0xb457('0x7'));var attributes=require(_0xb457('0x8'));module[_0xb457('0x9')]=function(_0x3823c7,_0x3cefc3){return _0x3823c7['define'](_0xb457('0xa'),attributes,{'tableName':_0xb457('0xb'),'paranoid':![],'indexes':[{'name':_0xb457('0xc'),'fields':['idField','FieldId'],'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 f572e3f..1899f24 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 _0x7a54=['info','FreshsalesField,\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(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x566579,_0x3ac1ab){_0x566579=_0x566579-0x0;var _0x179156=_0x7a54[_0x566579];return _0x179156;};'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')]('FreshsalesField,\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 _0x1967=['then','info','FreshsalesField,\x20%s,\x20%s','FreshsalesField,\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(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x1967,0x173));var _0x7196=function(_0x3eca44,_0x2ea843){_0x3eca44=_0x3eca44-0x0;var _0xed1aa3=_0x1967[_0x3eca44];return _0xed1aa3;};'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/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index c81815d..48ed426 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x177c8e,_0x39b157){var _0x5d402c=function(_0x5276f0){while(--_0x5276f0){_0x177c8e['push'](_0x177c8e['shift']());}};_0x5d402c(++_0x39b157);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x35194c,_0x19d6a3){var _0x589b6d=function(_0x360596){while(--_0x360596){_0x35194c['push'](_0x35194c['shift']());}};_0x589b6d(++_0x19d6a3);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index e636731..c5aa26c 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 _0xd291=['exports','STRING','username','ENUM','integrationTab','newTab','sequelize'];(function(_0x4de698,_0x15539b){var _0x57c953=function(_0x1770af){while(--_0x1770af){_0x4de698['push'](_0x4de698['shift']());}};_0x57c953(++_0x15539b);}(_0xd291,0xae));var _0x1d29=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd291[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x1d29('0x0'));module[_0x1d29('0x1')]={'name':{'type':Sequelize[_0x1d29('0x2')]},'description':{'type':Sequelize[_0x1d29('0x2')]},'username':{'type':Sequelize[_0x1d29('0x2')],'unique':_0x1d29('0x3')},'remoteUri':{'type':Sequelize[_0x1d29('0x2')]},'password':{'type':Sequelize[_0x1d29('0x2')]},'clientId':{'type':Sequelize[_0x1d29('0x2')]},'clientSecret':{'type':Sequelize[_0x1d29('0x2')]},'securityToken':{'type':Sequelize[_0x1d29('0x2')]},'serverUrl':{'type':Sequelize[_0x1d29('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1d29('0x4')](_0x1d29('0x5'),_0x1d29('0x6')),'defaultValue':_0x1d29('0x5')}}; \ No newline at end of file +var _0x6b47=['STRING','username','ENUM','newTab','integrationTab','exports'];(function(_0x41f529,_0x1483bd){var _0x2901ac=function(_0xbd3c40){while(--_0xbd3c40){_0x41f529['push'](_0x41f529['shift']());}};_0x2901ac(++_0x1483bd);}(_0x6b47,0xe9));var _0x76b4=function(_0x39d9ec,_0x4ed6e5){_0x39d9ec=_0x39d9ec-0x0;var _0x499ff0=_0x6b47[_0x39d9ec];return _0x499ff0;};'use strict';var Sequelize=require('sequelize');module[_0x76b4('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x76b4('0x1')]},'username':{'type':Sequelize[_0x76b4('0x1')],'unique':_0x76b4('0x2')},'remoteUri':{'type':Sequelize[_0x76b4('0x1')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x76b4('0x1')]},'clientSecret':{'type':Sequelize[_0x76b4('0x1')]},'securityToken':{'type':Sequelize[_0x76b4('0x1')]},'serverUrl':{'type':Sequelize[_0x76b4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x76b4('0x3')]('integrationTab',_0x76b4('0x4')),'defaultValue':_0x76b4('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 8f4443a..adc21ac 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 _0x95c9=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','offset','undefined','count','limit','Content-Range','json','apply','reject','save','destroy','then','end','sendStatus','error','name','send','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','findAll','rows','catch','params','fields','includeAll','create','body','update','find','getConfigurations','findOne','SalesforceConfiguration','pick','AccountId','Subjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','substring','login','username','password','concat','securityToken','isNil','ticketType','sobject','describe','OwnerId','IsReminderSet','Subject','string','int','picklist','boolean','email','remove','includes','label','custom','picklistValues','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','desk.js','papaparse','ioredis'];(function(_0x1ff575,_0xdba21f){var _0x48fc9e=function(_0x51cf97){while(--_0x51cf97){_0x1ff575['push'](_0x1ff575['shift']());}};_0x48fc9e(++_0xdba21f);}(_0x95c9,0xe2));var _0x995c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x95c9[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x995c('0x0'));var rimraf=require(_0x995c('0x1'));var zipdir=require(_0x995c('0x2'));var jsonpatch=require(_0x995c('0x3'));var rp=require('request-promise');var moment=require(_0x995c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x995c('0x5'));var util=require(_0x995c('0x6'));var path=require(_0x995c('0x7'));var sox=require(_0x995c('0x8'));var csv=require(_0x995c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x995c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x995c('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x995c('0xc'));var Redis=require(_0x995c('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x995c('0xe'));var as=require(_0x995c('0xf'));var hardwareService=require(_0x995c('0x10'));var logger=require(_0x995c('0x11'))(_0x995c('0x12'));var utils=require(_0x995c('0x13'));var config=require(_0x995c('0x14'));var licenseUtil=require(_0x995c('0x15'));var db=require(_0x995c('0x16'))['db'];var integrations=require(_0x995c('0x17'));function respondWithStatusCode(_0x5321a5,_0x4ad3af){_0x4ad3af=_0x4ad3af||0xcc;return function(_0x519bd9){if(_0x519bd9){return _0x5321a5['sendStatus'](_0x4ad3af);}return _0x5321a5[_0x995c('0x18')](_0x4ad3af)['end']();};}function respondWithResult(_0x40f7ae,_0x1572ed){_0x1572ed=_0x1572ed||0xc8;return function(_0x574d52){if(_0x574d52){return _0x40f7ae[_0x995c('0x18')](_0x1572ed)['json'](_0x574d52);}};}function respondWithFilteredResult(_0x4f81f5,_0x80a7c7){return function(_0x2adb8c){if(_0x2adb8c){var _0x21e984=typeof _0x80a7c7[_0x995c('0x19')]===_0x995c('0x1a')&&typeof _0x80a7c7['limit']===_0x995c('0x1a');var _0x340c6f=_0x2adb8c[_0x995c('0x1b')];var _0x1b5af5=_0x21e984?0x0:_0x80a7c7[_0x995c('0x19')];var _0x3be8b6=_0x21e984?_0x2adb8c[_0x995c('0x1b')]:_0x80a7c7[_0x995c('0x19')]+_0x80a7c7[_0x995c('0x1c')];var _0x417d1d;if(_0x3be8b6>=_0x340c6f){_0x3be8b6=_0x340c6f;_0x417d1d=0xc8;}else{_0x417d1d=0xce;}_0x4f81f5[_0x995c('0x18')](_0x417d1d);return _0x4f81f5['set'](_0x995c('0x1d'),_0x1b5af5+'-'+_0x3be8b6+'/'+_0x340c6f)[_0x995c('0x1e')](_0x2adb8c);}return null;};}function patchUpdates(_0x2d9e10){return function(_0x4136f1){try{jsonpatch[_0x995c('0x1f')](_0x4136f1,_0x2d9e10,!![]);}catch(_0x4a3480){return BPromise[_0x995c('0x20')](_0x4a3480);}return _0x4136f1[_0x995c('0x21')]();};}function saveUpdates(_0x59b948,_0x484fe4){return function(_0x3c64fa){if(_0x3c64fa){return _0x3c64fa['update'](_0x59b948)['then'](function(_0x234e33){return _0x234e33;});}return null;};}function removeEntity(_0x58e937,_0x4d09e9){return function(_0x4c27d8){if(_0x4c27d8){return _0x4c27d8[_0x995c('0x22')]()[_0x995c('0x23')](function(){_0x58e937[_0x995c('0x18')](0xcc)[_0x995c('0x24')]();});}};}function handleEntityNotFound(_0x449a73,_0x22710f){return function(_0x49d3ac){if(!_0x49d3ac){_0x449a73[_0x995c('0x25')](0x194);}return _0x49d3ac;};}function handleError(_0x5bfd4f,_0x45b1a5){_0x45b1a5=_0x45b1a5||0x1f4;return function(_0x27d9fb){logger[_0x995c('0x26')](_0x27d9fb['stack']);if(_0x27d9fb[_0x995c('0x27')]){delete _0x27d9fb[_0x995c('0x27')];}_0x5bfd4f[_0x995c('0x18')](_0x45b1a5)[_0x995c('0x28')](_0x27d9fb);};}exports['index']=function(_0x4a73e6,_0x63f119){var _0x1f5150={},_0x23aefb={},_0xf1dbfa={'count':0x0,'rows':[]};var _0x502d92=_[_0x995c('0x29')](db[_0x995c('0x2a')][_0x995c('0x2b')],function(_0x2f6686){return{'name':_0x2f6686[_0x995c('0x2c')],'type':_0x2f6686[_0x995c('0x2d')][_0x995c('0x2e')]};});_0x23aefb[_0x995c('0x2f')]=_[_0x995c('0x29')](_0x502d92,_0x995c('0x27'));_0x23aefb[_0x995c('0x30')]=_[_0x995c('0x31')](_0x4a73e6[_0x995c('0x30')]);_0x23aefb[_0x995c('0x32')]=_[_0x995c('0x33')](_0x23aefb['model'],_0x23aefb[_0x995c('0x30')]);_0x1f5150[_0x995c('0x34')]=_['intersection'](_0x23aefb['model'],qs['fields'](_0x4a73e6['query']['fields']));_0x1f5150[_0x995c('0x34')]=_0x1f5150[_0x995c('0x34')][_0x995c('0x35')]?_0x1f5150['attributes']:_0x23aefb[_0x995c('0x2f')];if(!_0x4a73e6[_0x995c('0x30')][_0x995c('0x36')](_0x995c('0x37'))){_0x1f5150[_0x995c('0x1c')]=qs[_0x995c('0x1c')](_0x4a73e6[_0x995c('0x30')][_0x995c('0x1c')]);_0x1f5150[_0x995c('0x19')]=qs[_0x995c('0x19')](_0x4a73e6[_0x995c('0x30')][_0x995c('0x19')]);}_0x1f5150[_0x995c('0x38')]=qs[_0x995c('0x39')](_0x4a73e6['query'][_0x995c('0x39')]);_0x1f5150[_0x995c('0x3a')]=qs['filters'](_['pick'](_0x4a73e6[_0x995c('0x30')],_0x23aefb['filters']),_0x502d92);if(_0x4a73e6[_0x995c('0x30')][_0x995c('0x3b')]){_0x1f5150[_0x995c('0x3a')]=_[_0x995c('0x3c')](_0x1f5150[_0x995c('0x3a')],{'$or':_['map'](_0x502d92,function(_0x43f805){if(_0x43f805[_0x995c('0x2d')]!=='VIRTUAL'){var _0x37d0c6={};_0x37d0c6[_0x43f805['name']]={'$like':'%'+_0x4a73e6['query'][_0x995c('0x3b')]+'%'};return _0x37d0c6;}})});}_0x1f5150=_[_0x995c('0x3c')]({},_0x1f5150,_0x4a73e6[_0x995c('0x3d')]);var _0x56c6ff={'where':_0x1f5150[_0x995c('0x3a')]};return db[_0x995c('0x2a')]['count'](_0x56c6ff)[_0x995c('0x23')](function(_0x4eb283){_0xf1dbfa[_0x995c('0x1b')]=_0x4eb283;if(_0x4a73e6['query']['includeAll']){_0x1f5150[_0x995c('0x3e')]=[{'all':!![]}];}return db[_0x995c('0x2a')][_0x995c('0x3f')](_0x1f5150);})[_0x995c('0x23')](function(_0x50919f){_0xf1dbfa[_0x995c('0x40')]=_0x50919f;return _0xf1dbfa;})[_0x995c('0x23')](respondWithFilteredResult(_0x63f119,_0x1f5150))[_0x995c('0x41')](handleError(_0x63f119,null));};exports['show']=function(_0x6bf911,_0x2d3e3d){var _0x4315c5={'raw':![],'where':{'id':_0x6bf911[_0x995c('0x42')]['id']}},_0x1e3600={};_0x1e3600[_0x995c('0x2f')]=_[_0x995c('0x31')](db[_0x995c('0x2a')][_0x995c('0x2b')]);_0x1e3600[_0x995c('0x30')]=_[_0x995c('0x31')](_0x6bf911['query']);_0x1e3600['filters']=_['intersection'](_0x1e3600[_0x995c('0x2f')],_0x1e3600[_0x995c('0x30')]);_0x4315c5['attributes']=_[_0x995c('0x33')](_0x1e3600[_0x995c('0x2f')],qs[_0x995c('0x43')](_0x6bf911['query'][_0x995c('0x43')]));_0x4315c5[_0x995c('0x34')]=_0x4315c5[_0x995c('0x34')][_0x995c('0x35')]?_0x4315c5[_0x995c('0x34')]:_0x1e3600[_0x995c('0x2f')];if(_0x6bf911[_0x995c('0x30')][_0x995c('0x44')]){_0x4315c5[_0x995c('0x3e')]=[{'all':!![]}];}_0x4315c5=_[_0x995c('0x3c')]({},_0x4315c5,_0x6bf911[_0x995c('0x3d')]);return db['SalesforceAccount']['find'](_0x4315c5)['then'](handleEntityNotFound(_0x2d3e3d,null))[_0x995c('0x23')](respondWithResult(_0x2d3e3d,null))[_0x995c('0x41')](handleError(_0x2d3e3d,null));};exports[_0x995c('0x45')]=function(_0x4786b1,_0x5168b5){return db[_0x995c('0x2a')][_0x995c('0x45')](_0x4786b1[_0x995c('0x46')],{})[_0x995c('0x23')](respondWithResult(_0x5168b5,0xc9))[_0x995c('0x41')](handleError(_0x5168b5,null));};exports[_0x995c('0x47')]=function(_0x59df98,_0x30288b){if(_0x59df98[_0x995c('0x46')]['id']){delete _0x59df98[_0x995c('0x46')]['id'];}return db[_0x995c('0x2a')]['find']({'where':{'id':_0x59df98[_0x995c('0x42')]['id']}})['then'](handleEntityNotFound(_0x30288b,null))[_0x995c('0x23')](saveUpdates(_0x59df98[_0x995c('0x46')],null))[_0x995c('0x23')](respondWithResult(_0x30288b,null))['catch'](handleError(_0x30288b,null));};exports[_0x995c('0x22')]=function(_0x296b3c,_0x2d33af){return db[_0x995c('0x2a')][_0x995c('0x48')]({'where':{'id':_0x296b3c['params']['id']}})['then'](handleEntityNotFound(_0x2d33af,null))[_0x995c('0x23')](removeEntity(_0x2d33af,null))['catch'](handleError(_0x2d33af,null));};exports[_0x995c('0x49')]=function(_0x24b208,_0x4b5a32,_0x7de973){var _0x5c5699={};var _0xd8108c={};var _0x23e15c;var _0x43212c;return db[_0x995c('0x2a')][_0x995c('0x4a')]({'where':{'id':_0x24b208['params']['id']}})[_0x995c('0x23')](handleEntityNotFound(_0x4b5a32,null))[_0x995c('0x23')](function(_0x5ba45c){if(_0x5ba45c){_0x23e15c=_0x5ba45c;_0xd8108c[_0x995c('0x2f')]=_[_0x995c('0x31')](db[_0x995c('0x4b')]['rawAttributes']);_0xd8108c['query']=_[_0x995c('0x31')](_0x24b208['query']);_0xd8108c[_0x995c('0x32')]=_['intersection'](_0xd8108c['model'],_0xd8108c[_0x995c('0x30')]);_0x5c5699[_0x995c('0x34')]=_[_0x995c('0x33')](_0xd8108c[_0x995c('0x2f')],qs[_0x995c('0x43')](_0x24b208[_0x995c('0x30')]['fields']));_0x5c5699['attributes']=_0x5c5699[_0x995c('0x34')]['length']?_0x5c5699['attributes']:_0xd8108c[_0x995c('0x2f')];_0x5c5699[_0x995c('0x38')]=qs[_0x995c('0x39')](_0x24b208['query'][_0x995c('0x39')]);_0x5c5699[_0x995c('0x3a')]=qs[_0x995c('0x32')](_[_0x995c('0x4c')](_0x24b208['query'],_0xd8108c[_0x995c('0x32')]));if(_0x24b208['query']['filter']){_0x5c5699[_0x995c('0x3a')]=_[_0x995c('0x3c')](_0x5c5699['where'],{'$or':_['map'](_0x5c5699[_0x995c('0x34')],function(_0xd050fd){var _0x39926b={};_0x39926b[_0xd050fd]={'$like':'%'+_0x24b208['query'][_0x995c('0x3b')]+'%'};return _0x39926b;})});}_0x5c5699=_[_0x995c('0x3c')]({},_0x5c5699,_0x24b208[_0x995c('0x3d')]);return _0x23e15c[_0x995c('0x49')](_0x5c5699);}})['then'](function(_0x4ac503){if(_0x4ac503){_0x43212c=_0x4ac503[_0x995c('0x35')];if(!_0x24b208[_0x995c('0x30')][_0x995c('0x36')](_0x995c('0x37'))){_0x5c5699[_0x995c('0x1c')]=qs['limit'](_0x24b208[_0x995c('0x30')][_0x995c('0x1c')]);_0x5c5699[_0x995c('0x19')]=qs[_0x995c('0x19')](_0x24b208['query'][_0x995c('0x19')]);}return _0x23e15c['getConfigurations'](_0x5c5699);}})['then'](function(_0x4b4577){if(_0x4b4577){return _0x4b4577?{'count':_0x43212c,'rows':_0x4b4577}:null;}})['then'](respondWithResult(_0x4b5a32,null))[_0x995c('0x41')](handleError(_0x4b5a32,null));};exports['addConfiguration']=function(_0xd20fe9,_0x1bc32,_0x44e1b9){if(_0xd20fe9[_0x995c('0x46')]['id']){delete _0xd20fe9[_0x995c('0x46')]['id'];}return db['SalesforceAccount']['findOne']({'where':{'id':_0xd20fe9[_0x995c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1bc32,null))[_0x995c('0x23')](function(_0x2e9860){if(_0x2e9860){_0xd20fe9[_0x995c('0x46')][_0x995c('0x4d')]=_0x2e9860['id'];_0xd20fe9['body'][_0x995c('0x4e')]=integrations['getSubjects'](_0xd20fe9[_0x995c('0x46')][_0x995c('0x4f')],_0xd20fe9['body']['type']);_0xd20fe9[_0x995c('0x46')][_0x995c('0x50')]=integrations[_0x995c('0x51')](_0xd20fe9[_0x995c('0x46')]['channel'],_0xd20fe9['body'][_0x995c('0x2d')]);return db[_0x995c('0x4b')][_0x995c('0x45')](_0xd20fe9[_0x995c('0x46')],{'include':[{'model':db[_0x995c('0x52')],'as':'Subjects'},{'model':db[_0x995c('0x52')],'as':'Descriptions'}]});}return null;})[_0x995c('0x23')](respondWithResult(_0x1bc32,null))['catch'](handleError(_0x1bc32,null));};exports[_0x995c('0x53')]=function(_0x870d95,_0xff4d96,_0x685037){var _0x3ad51e;var _0x588cb6='';var _0x2beb98=_0x995c('0x54');return db['SalesforceAccount'][_0x995c('0x4a')]({'where':{'id':_0x870d95[_0x995c('0x42')]['id']},'attributes':['id',_0x995c('0x55'),_0x995c('0x56'),_0x995c('0x57'),'username','password','securityToken']})['then'](handleEntityNotFound(_0xff4d96,null))[_0x995c('0x23')](function(_0x32625f){if(_0x32625f){_0x588cb6=_0x32625f['remoteUri'];var _0x5d8660=_0x588cb6['slice'](-0x1);if(_0x5d8660==='/'){_0x588cb6=_0x588cb6[_0x995c('0x58')](0x0,_0x588cb6['lastIndexOf'](_0x5d8660));}_0x3ad51e=new jsforce['Connection']({'oauth2':{'loginUrl':_0x588cb6,'clientId':_0x32625f[_0x995c('0x56')],'clientSecret':_0x32625f[_0x995c('0x57')]}});return _0x3ad51e[_0x995c('0x59')](_0x32625f[_0x995c('0x5a')],_0x32625f[_0x995c('0x5b')][_0x995c('0x5c')](_0x32625f[_0x995c('0x5d')]));}})[_0x995c('0x23')](function(_0x3ba620){if(_0x3ba620){if(!_[_0x995c('0x5e')](_0x870d95[_0x995c('0x30')][_0x995c('0x5f')])){_0x2beb98=_0x870d95[_0x995c('0x30')][_0x995c('0x5f')];}return _0x3ad51e[_0x995c('0x60')](_0x2beb98)[_0x995c('0x61')]();}})['then'](function(_0x3fd81d){var _0x418d39=[_0x995c('0x62'),'ActivityDate',_0x995c('0x63'),'IsRecurrence',_0x995c('0x64'),'Description'];var _0x506a5d=[_0x995c('0x65'),_0x995c('0x66'),_0x995c('0x67'),_0x995c('0x68'),_0x995c('0x69'),'textarea','phone'];if(_0x3fd81d){_[_0x995c('0x6a')](_0x3fd81d['fields'],function(_0x11a6d7){return _0x418d39[_0x995c('0x6b')](_0x11a6d7[_0x995c('0x27')])||!_0x506a5d[_0x995c('0x6b')](_0x11a6d7['type']);});return{'count':_0x3fd81d[_0x995c('0x43')][_0x995c('0x35')],'rows':_[_0x995c('0x29')](_0x3fd81d[_0x995c('0x43')],function(_0x5b1631){return{'id':_0x5b1631[_0x995c('0x27')],'name':_0x5b1631[_0x995c('0x6c')],'custom':_0x5b1631[_0x995c('0x6d')],'options':_0x5b1631['picklistValues']['length']>0x0?_[_0x995c('0x29')](_0x5b1631[_0x995c('0x6e')],function(_0x2ec96e){return{'name':_0x2ec96e[_0x995c('0x6c')],'value':_0x2ec96e['value']};}):_0x5b1631[_0x995c('0x2d')]=='boolean'?[{'name':_0x995c('0x6f'),'value':_0x995c('0x70')},{'name':_0x995c('0x71'),'value':_0x995c('0x72')}]:[]};})};}})[_0x995c('0x23')](respondWithResult(_0xff4d96,null))[_0x995c('0x41')](function(_0xcc2018){var _0x470ce0=_0x870d95['query'][_0x995c('0x73')]?0x1f4:_0xcc2018[_0x995c('0x74')]||0x1f4;logger[_0x995c('0x26')](_0x995c('0x75'),_0x995c('0x53'),_0x470ce0,JSON[_0x995c('0x76')](_0xcc2018));delete _0xcc2018[_0x995c('0x27')];if(_0x470ce0===0x191){_0x470ce0=0x190;}_0xff4d96[_0x995c('0x18')](_0x470ce0)[_0x995c('0x28')](_0x870d95[_0x995c('0x30')][_0x995c('0x73')]?{'message':_0x995c('0x77'),'statusCode':_0xcc2018[_0x995c('0x74')]}:_0xcc2018);});}; \ No newline at end of file +var _0x1a59=['index','SalesforceAccount','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','include','findAll','show','params','find','catch','create','body','SalesforceConfiguration','filter','getConfigurations','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','clientId','clientSecret','username','password','remoteUri','slice','substring','lastIndexOf','Connection','securityToken','isNil','describe','ActivityDate','IsRecurrence','Description','string','picklist','textarea','remove','includes','label','picklistValues','boolean','True','false','test','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','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','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send'];(function(_0x1c716a,_0x559f71){var _0x5c0634=function(_0xa642d8){while(--_0xa642d8){_0x1c716a['push'](_0x1c716a['shift']());}};_0x5c0634(++_0x559f71);}(_0x1a59,0x12c));var _0x91a5=function(_0x41deb8,_0x458105){_0x41deb8=_0x41deb8-0x0;var _0x1e2084=_0x1a59[_0x41deb8];return _0x1e2084;};'use strict';var emlformat=require(_0x91a5('0x0'));var rimraf=require(_0x91a5('0x1'));var zipdir=require(_0x91a5('0x2'));var jsonpatch=require(_0x91a5('0x3'));var rp=require('request-promise');var moment=require(_0x91a5('0x4'));var BPromise=require(_0x91a5('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x91a5('0x6'));var csv=require(_0x91a5('0x7'));var ejs=require(_0x91a5('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x91a5('0x9'));var squel=require(_0x91a5('0xa'));var crypto=require(_0x91a5('0xb'));var jsforce=require(_0x91a5('0xc'));var deskjs=require(_0x91a5('0xd'));var toCsv=require(_0x91a5('0x7'));var querystring=require(_0x91a5('0xe'));var Papa=require('papaparse');var Redis=require(_0x91a5('0xf'));var authService=require(_0x91a5('0x10'));var qs=require(_0x91a5('0x11'));var as=require(_0x91a5('0x12'));var hardwareService=require(_0x91a5('0x13'));var logger=require(_0x91a5('0x14'))(_0x91a5('0x15'));var utils=require(_0x91a5('0x16'));var config=require(_0x91a5('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91a5('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5c154e,_0x3920e4){_0x3920e4=_0x3920e4||0xcc;return function(_0x588358){if(_0x588358){return _0x5c154e['sendStatus'](_0x3920e4);}return _0x5c154e[_0x91a5('0x19')](_0x3920e4)['end']();};}function respondWithResult(_0x371141,_0x155d83){_0x155d83=_0x155d83||0xc8;return function(_0x4d26ae){if(_0x4d26ae){return _0x371141[_0x91a5('0x19')](_0x155d83)[_0x91a5('0x1a')](_0x4d26ae);}};}function respondWithFilteredResult(_0x12d166,_0x4ce042){return function(_0x3bcfa9){if(_0x3bcfa9){var _0x266496=typeof _0x4ce042[_0x91a5('0x1b')]===_0x91a5('0x1c')&&typeof _0x4ce042[_0x91a5('0x1d')]===_0x91a5('0x1c');var _0x5f24e8=_0x3bcfa9[_0x91a5('0x1e')];var _0x2b5f8f=_0x266496?0x0:_0x4ce042[_0x91a5('0x1b')];var _0x19247a=_0x266496?_0x3bcfa9[_0x91a5('0x1e')]:_0x4ce042[_0x91a5('0x1b')]+_0x4ce042[_0x91a5('0x1d')];var _0x32a9bc;if(_0x19247a>=_0x5f24e8){_0x19247a=_0x5f24e8;_0x32a9bc=0xc8;}else{_0x32a9bc=0xce;}_0x12d166[_0x91a5('0x19')](_0x32a9bc);return _0x12d166[_0x91a5('0x1f')](_0x91a5('0x20'),_0x2b5f8f+'-'+_0x19247a+'/'+_0x5f24e8)['json'](_0x3bcfa9);}return null;};}function patchUpdates(_0xe592fb){return function(_0x23e722){try{jsonpatch['apply'](_0x23e722,_0xe592fb,!![]);}catch(_0x14296a){return BPromise['reject'](_0x14296a);}return _0x23e722['save']();};}function saveUpdates(_0x21eaed,_0x59bf42){return function(_0x59cf46){if(_0x59cf46){return _0x59cf46[_0x91a5('0x21')](_0x21eaed)[_0x91a5('0x22')](function(_0x4187e7){return _0x4187e7;});}return null;};}function removeEntity(_0x418470,_0x467973){return function(_0x24d990){if(_0x24d990){return _0x24d990[_0x91a5('0x23')]()[_0x91a5('0x22')](function(){_0x418470['status'](0xcc)[_0x91a5('0x24')]();});}};}function handleEntityNotFound(_0x104322,_0x2eb390){return function(_0x3c610d){if(!_0x3c610d){_0x104322[_0x91a5('0x25')](0x194);}return _0x3c610d;};}function handleError(_0x2fd677,_0x165dbe){_0x165dbe=_0x165dbe||0x1f4;return function(_0x864296){logger[_0x91a5('0x26')](_0x864296[_0x91a5('0x27')]);if(_0x864296[_0x91a5('0x28')]){delete _0x864296[_0x91a5('0x28')];}_0x2fd677[_0x91a5('0x19')](_0x165dbe)[_0x91a5('0x29')](_0x864296);};}exports[_0x91a5('0x2a')]=function(_0x16b85f,_0x2f1b67){var _0x547b97={},_0x2735aa={},_0x3e5923={'count':0x0,'rows':[]};var _0x37cb5f=_['map'](db[_0x91a5('0x2b')][_0x91a5('0x2c')],function(_0x283b70){return{'name':_0x283b70['fieldName'],'type':_0x283b70[_0x91a5('0x2d')]['key']};});_0x2735aa[_0x91a5('0x2e')]=_[_0x91a5('0x2f')](_0x37cb5f,'name');_0x2735aa[_0x91a5('0x30')]=_[_0x91a5('0x31')](_0x16b85f[_0x91a5('0x30')]);_0x2735aa[_0x91a5('0x32')]=_[_0x91a5('0x33')](_0x2735aa['model'],_0x2735aa['query']);_0x547b97[_0x91a5('0x34')]=_[_0x91a5('0x33')](_0x2735aa[_0x91a5('0x2e')],qs[_0x91a5('0x35')](_0x16b85f[_0x91a5('0x30')][_0x91a5('0x35')]));_0x547b97[_0x91a5('0x34')]=_0x547b97[_0x91a5('0x34')][_0x91a5('0x36')]?_0x547b97[_0x91a5('0x34')]:_0x2735aa['model'];if(!_0x16b85f['query'][_0x91a5('0x37')](_0x91a5('0x38'))){_0x547b97[_0x91a5('0x1d')]=qs[_0x91a5('0x1d')](_0x16b85f[_0x91a5('0x30')]['limit']);_0x547b97[_0x91a5('0x1b')]=qs[_0x91a5('0x1b')](_0x16b85f[_0x91a5('0x30')][_0x91a5('0x1b')]);}_0x547b97[_0x91a5('0x39')]=qs[_0x91a5('0x3a')](_0x16b85f[_0x91a5('0x30')][_0x91a5('0x3a')]);_0x547b97[_0x91a5('0x3b')]=qs[_0x91a5('0x32')](_[_0x91a5('0x3c')](_0x16b85f[_0x91a5('0x30')],_0x2735aa['filters']),_0x37cb5f);if(_0x16b85f[_0x91a5('0x30')]['filter']){_0x547b97[_0x91a5('0x3b')]=_[_0x91a5('0x3d')](_0x547b97[_0x91a5('0x3b')],{'$or':_[_0x91a5('0x2f')](_0x37cb5f,function(_0x292923){if(_0x292923[_0x91a5('0x2d')]!==_0x91a5('0x3e')){var _0x199f60={};_0x199f60[_0x292923[_0x91a5('0x28')]]={'$like':'%'+_0x16b85f['query']['filter']+'%'};return _0x199f60;}})});}_0x547b97=_['merge']({},_0x547b97,_0x16b85f[_0x91a5('0x3f')]);var _0x933dde={'where':_0x547b97[_0x91a5('0x3b')]};return db[_0x91a5('0x2b')][_0x91a5('0x1e')](_0x933dde)['then'](function(_0x4652e5){_0x3e5923[_0x91a5('0x1e')]=_0x4652e5;if(_0x16b85f['query']['includeAll']){_0x547b97[_0x91a5('0x40')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x91a5('0x41')](_0x547b97);})[_0x91a5('0x22')](function(_0x21853d){_0x3e5923['rows']=_0x21853d;return _0x3e5923;})[_0x91a5('0x22')](respondWithFilteredResult(_0x2f1b67,_0x547b97))['catch'](handleError(_0x2f1b67,null));};exports[_0x91a5('0x42')]=function(_0x2adeb7,_0x3c5343){var _0x597197={'raw':![],'where':{'id':_0x2adeb7[_0x91a5('0x43')]['id']}},_0x303025={};_0x303025['model']=_[_0x91a5('0x31')](db[_0x91a5('0x2b')]['rawAttributes']);_0x303025['query']=_[_0x91a5('0x31')](_0x2adeb7[_0x91a5('0x30')]);_0x303025['filters']=_[_0x91a5('0x33')](_0x303025[_0x91a5('0x2e')],_0x303025['query']);_0x597197[_0x91a5('0x34')]=_['intersection'](_0x303025[_0x91a5('0x2e')],qs[_0x91a5('0x35')](_0x2adeb7['query'][_0x91a5('0x35')]));_0x597197['attributes']=_0x597197[_0x91a5('0x34')][_0x91a5('0x36')]?_0x597197[_0x91a5('0x34')]:_0x303025[_0x91a5('0x2e')];if(_0x2adeb7[_0x91a5('0x30')]['includeAll']){_0x597197[_0x91a5('0x40')]=[{'all':!![]}];}_0x597197=_['merge']({},_0x597197,_0x2adeb7['options']);return db[_0x91a5('0x2b')][_0x91a5('0x44')](_0x597197)[_0x91a5('0x22')](handleEntityNotFound(_0x3c5343,null))[_0x91a5('0x22')](respondWithResult(_0x3c5343,null))[_0x91a5('0x45')](handleError(_0x3c5343,null));};exports[_0x91a5('0x46')]=function(_0xaf711c,_0x3ba2b6){return db[_0x91a5('0x2b')][_0x91a5('0x46')](_0xaf711c[_0x91a5('0x47')],{})[_0x91a5('0x22')](respondWithResult(_0x3ba2b6,0xc9))['catch'](handleError(_0x3ba2b6,null));};exports[_0x91a5('0x21')]=function(_0x700228,_0x4056da){if(_0x700228['body']['id']){delete _0x700228[_0x91a5('0x47')]['id'];}return db[_0x91a5('0x2b')][_0x91a5('0x44')]({'where':{'id':_0x700228[_0x91a5('0x43')]['id']}})[_0x91a5('0x22')](handleEntityNotFound(_0x4056da,null))[_0x91a5('0x22')](saveUpdates(_0x700228[_0x91a5('0x47')],null))[_0x91a5('0x22')](respondWithResult(_0x4056da,null))['catch'](handleError(_0x4056da,null));};exports[_0x91a5('0x23')]=function(_0x339c51,_0x6c8346){return db[_0x91a5('0x2b')][_0x91a5('0x44')]({'where':{'id':_0x339c51[_0x91a5('0x43')]['id']}})[_0x91a5('0x22')](handleEntityNotFound(_0x6c8346,null))['then'](removeEntity(_0x6c8346,null))[_0x91a5('0x45')](handleError(_0x6c8346,null));};exports['getConfigurations']=function(_0x3af35a,_0x3b2076,_0x201923){var _0x4dc9c9={};var _0x1b4af9={};var _0x49eef4;var _0xf09c80;return db[_0x91a5('0x2b')]['findOne']({'where':{'id':_0x3af35a['params']['id']}})[_0x91a5('0x22')](handleEntityNotFound(_0x3b2076,null))[_0x91a5('0x22')](function(_0x6ccbb0){if(_0x6ccbb0){_0x49eef4=_0x6ccbb0;_0x1b4af9[_0x91a5('0x2e')]=_[_0x91a5('0x31')](db[_0x91a5('0x48')][_0x91a5('0x2c')]);_0x1b4af9['query']=_[_0x91a5('0x31')](_0x3af35a[_0x91a5('0x30')]);_0x1b4af9[_0x91a5('0x32')]=_['intersection'](_0x1b4af9[_0x91a5('0x2e')],_0x1b4af9['query']);_0x4dc9c9[_0x91a5('0x34')]=_[_0x91a5('0x33')](_0x1b4af9['model'],qs[_0x91a5('0x35')](_0x3af35a[_0x91a5('0x30')][_0x91a5('0x35')]));_0x4dc9c9[_0x91a5('0x34')]=_0x4dc9c9[_0x91a5('0x34')]['length']?_0x4dc9c9[_0x91a5('0x34')]:_0x1b4af9[_0x91a5('0x2e')];_0x4dc9c9[_0x91a5('0x39')]=qs[_0x91a5('0x3a')](_0x3af35a[_0x91a5('0x30')]['sort']);_0x4dc9c9[_0x91a5('0x3b')]=qs[_0x91a5('0x32')](_[_0x91a5('0x3c')](_0x3af35a['query'],_0x1b4af9['filters']));if(_0x3af35a['query']['filter']){_0x4dc9c9[_0x91a5('0x3b')]=_[_0x91a5('0x3d')](_0x4dc9c9['where'],{'$or':_[_0x91a5('0x2f')](_0x4dc9c9['attributes'],function(_0x1257fe){var _0x33ab62={};_0x33ab62[_0x1257fe]={'$like':'%'+_0x3af35a[_0x91a5('0x30')][_0x91a5('0x49')]+'%'};return _0x33ab62;})});}_0x4dc9c9=_['merge']({},_0x4dc9c9,_0x3af35a[_0x91a5('0x3f')]);return _0x49eef4[_0x91a5('0x4a')](_0x4dc9c9);}})['then'](function(_0x2c6852){if(_0x2c6852){_0xf09c80=_0x2c6852[_0x91a5('0x36')];if(!_0x3af35a[_0x91a5('0x30')][_0x91a5('0x37')](_0x91a5('0x38'))){_0x4dc9c9['limit']=qs[_0x91a5('0x1d')](_0x3af35a['query'][_0x91a5('0x1d')]);_0x4dc9c9['offset']=qs['offset'](_0x3af35a[_0x91a5('0x30')][_0x91a5('0x1b')]);}return _0x49eef4[_0x91a5('0x4a')](_0x4dc9c9);}})['then'](function(_0x4b46c6){if(_0x4b46c6){return _0x4b46c6?{'count':_0xf09c80,'rows':_0x4b46c6}:null;}})['then'](respondWithResult(_0x3b2076,null))[_0x91a5('0x45')](handleError(_0x3b2076,null));};exports['addConfiguration']=function(_0x4137db,_0x483197,_0x93f626){if(_0x4137db[_0x91a5('0x47')]['id']){delete _0x4137db['body']['id'];}return db[_0x91a5('0x2b')][_0x91a5('0x4b')]({'where':{'id':_0x4137db['params']['id']}})['then'](handleEntityNotFound(_0x483197,null))[_0x91a5('0x22')](function(_0x38a4d4){if(_0x38a4d4){_0x4137db[_0x91a5('0x47')][_0x91a5('0x4c')]=_0x38a4d4['id'];_0x4137db[_0x91a5('0x47')][_0x91a5('0x4d')]=integrations[_0x91a5('0x4e')](_0x4137db[_0x91a5('0x47')][_0x91a5('0x4f')],_0x4137db[_0x91a5('0x47')]['type']);_0x4137db[_0x91a5('0x47')][_0x91a5('0x50')]=integrations[_0x91a5('0x51')](_0x4137db[_0x91a5('0x47')][_0x91a5('0x4f')],_0x4137db[_0x91a5('0x47')][_0x91a5('0x2d')]);return db['SalesforceConfiguration'][_0x91a5('0x46')](_0x4137db[_0x91a5('0x47')],{'include':[{'model':db[_0x91a5('0x52')],'as':_0x91a5('0x4d')},{'model':db[_0x91a5('0x52')],'as':_0x91a5('0x50')}]});}return null;})['then'](respondWithResult(_0x483197,null))[_0x91a5('0x45')](handleError(_0x483197,null));};exports[_0x91a5('0x53')]=function(_0x27a1f8,_0x496344,_0xa61f5c){var _0xc68d99;var _0x358055='';var _0x185210=_0x91a5('0x54');return db[_0x91a5('0x2b')]['findOne']({'where':{'id':_0x27a1f8['params']['id']},'attributes':['id','remoteUri',_0x91a5('0x55'),_0x91a5('0x56'),_0x91a5('0x57'),_0x91a5('0x58'),'securityToken']})['then'](handleEntityNotFound(_0x496344,null))['then'](function(_0x56ce5b){if(_0x56ce5b){_0x358055=_0x56ce5b[_0x91a5('0x59')];var _0x4841bd=_0x358055[_0x91a5('0x5a')](-0x1);if(_0x4841bd==='/'){_0x358055=_0x358055[_0x91a5('0x5b')](0x0,_0x358055[_0x91a5('0x5c')](_0x4841bd));}_0xc68d99=new jsforce[(_0x91a5('0x5d'))]({'oauth2':{'loginUrl':_0x358055,'clientId':_0x56ce5b[_0x91a5('0x55')],'clientSecret':_0x56ce5b[_0x91a5('0x56')]}});return _0xc68d99['login'](_0x56ce5b['username'],_0x56ce5b[_0x91a5('0x58')]['concat'](_0x56ce5b[_0x91a5('0x5e')]));}})['then'](function(_0x1ed143){if(_0x1ed143){if(!_[_0x91a5('0x5f')](_0x27a1f8[_0x91a5('0x30')]['ticketType'])){_0x185210=_0x27a1f8[_0x91a5('0x30')]['ticketType'];}return _0xc68d99['sobject'](_0x185210)[_0x91a5('0x60')]();}})['then'](function(_0x11ce51){var _0x14a90a=['OwnerId',_0x91a5('0x61'),'IsReminderSet',_0x91a5('0x62'),'Subject',_0x91a5('0x63')];var _0x58d600=[_0x91a5('0x64'),'int',_0x91a5('0x65'),'boolean','email',_0x91a5('0x66'),'phone'];if(_0x11ce51){_[_0x91a5('0x67')](_0x11ce51['fields'],function(_0x55dd46){return _0x14a90a[_0x91a5('0x68')](_0x55dd46[_0x91a5('0x28')])||!_0x58d600[_0x91a5('0x68')](_0x55dd46[_0x91a5('0x2d')]);});return{'count':_0x11ce51[_0x91a5('0x35')]['length'],'rows':_[_0x91a5('0x2f')](_0x11ce51['fields'],function(_0x58b5d5){return{'id':_0x58b5d5[_0x91a5('0x28')],'name':_0x58b5d5[_0x91a5('0x69')],'custom':_0x58b5d5['custom'],'options':_0x58b5d5[_0x91a5('0x6a')][_0x91a5('0x36')]>0x0?_[_0x91a5('0x2f')](_0x58b5d5[_0x91a5('0x6a')],function(_0x4422e5){return{'name':_0x4422e5[_0x91a5('0x69')],'value':_0x4422e5['value']};}):_0x58b5d5['type']==_0x91a5('0x6b')?[{'name':_0x91a5('0x6c'),'value':'true'},{'name':'False','value':_0x91a5('0x6d')}]:[]};})};}})['then'](respondWithResult(_0x496344,null))[_0x91a5('0x45')](function(_0xf064fe){var _0xd98319=_0x27a1f8[_0x91a5('0x30')][_0x91a5('0x6e')]?0x1f4:_0xf064fe['statusCode']||0x1f4;logger[_0x91a5('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0x91a5('0x53'),_0xd98319,JSON[_0x91a5('0x6f')](_0xf064fe));delete _0xf064fe[_0x91a5('0x28')];if(_0xd98319===0x191){_0xd98319=0x190;}_0x496344['status'](_0xd98319)[_0x91a5('0x29')](_0x27a1f8['query'][_0x91a5('0x6e')]?{'message':_0x91a5('0x70'),'statusCode':_0xf064fe[_0x91a5('0x71')]}:_0xf064fe);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 2ea635e..ebbcc1d 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 _0x65d9=['exports','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intSalesforceAccount.attributes'];(function(_0x3b2244,_0x54873f){var _0x2dcc14=function(_0x53d73f){while(--_0x53d73f){_0x3b2244['push'](_0x3b2244['shift']());}};_0x2dcc14(++_0x54873f);}(_0x65d9,0x1bf));var _0x965d=function(_0x3580a8,_0xdfdad6){_0x3580a8=_0x3580a8-0x0;var _0x16e30f=_0x65d9[_0x3580a8];return _0x16e30f;};'use strict';var _=require(_0x965d('0x0'));var util=require(_0x965d('0x1'));var logger=require(_0x965d('0x2'))('api');var moment=require(_0x965d('0x3'));var BPromise=require(_0x965d('0x4'));var rp=require(_0x965d('0x5'));var fs=require('fs');var path=require(_0x965d('0x6'));var rimraf=require(_0x965d('0x7'));var config=require('../../config/environment');var attributes=require(_0x965d('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x965d('0x9')]=function(_0x36fe2c,_0x4d67d0){return _0x36fe2c['define'](_0x965d('0xa'),attributes,{'tableName':_0x965d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c65=['moment','bluebird','request-promise','path','../../config/environment','./intSalesforceAccount.attributes','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','../../config/logger','api'];(function(_0x2c065a,_0x44e071){var _0x16dcf0=function(_0x4ef63d){while(--_0x4ef63d){_0x2c065a['push'](_0x2c065a['shift']());}};_0x16dcf0(++_0x44e071);}(_0x0c65,0x19d));var _0x50c6=function(_0x5c3151,_0x18bfe0){_0x5c3151=_0x5c3151-0x0;var _0x2c4a35=_0x0c65[_0x5c3151];return _0x2c4a35;};'use strict';var _=require(_0x50c6('0x0'));var util=require('util');var logger=require(_0x50c6('0x1'))(_0x50c6('0x2'));var moment=require(_0x50c6('0x3'));var BPromise=require(_0x50c6('0x4'));var rp=require(_0x50c6('0x5'));var fs=require('fs');var path=require(_0x50c6('0x6'));var rimraf=require('rimraf');var config=require(_0x50c6('0x7'));var attributes=require(_0x50c6('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x50c6('0x9')]=function(_0x55d805,_0x301fa9){return _0x55d805[_0x50c6('0xa')](_0x50c6('0xb'),attributes,{'tableName':_0x50c6('0xc'),'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 68856da..25aa82e 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 _0x0dfa=['debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetSalesforceAccount','SalesforceAccount','findAll','options','where','limit','include','model','attributes','map','catch','ShowSalesforceAccount','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x1e876c,_0x3b245d){var _0x3dcc27=function(_0x381eff){while(--_0x381eff){_0x1e876c['push'](_0x1e876c['shift']());}};_0x3dcc27(++_0x3b245d);}(_0x0dfa,0x13e));var _0xa0df=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x0dfa[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0xa0df('0x0'));var moment=require(_0xa0df('0x1'));var BPromise=require(_0xa0df('0x2'));var rs=require(_0xa0df('0x3'));var fs=require('fs');var Redis=require(_0xa0df('0x4'));var db=require(_0xa0df('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa0df('0x6'))(_0xa0df('0x7'));var config=require(_0xa0df('0x8'));var jayson=require(_0xa0df('0x9'));var client=jayson[_0xa0df('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6c2e24,_0x332ae1,_0x54ecf8){return new BPromise(function(_0x3f74d6,_0x3deaa6){return client[_0xa0df('0xb')](_0x6c2e24,_0x54ecf8)[_0xa0df('0xc')](function(_0x3b85b0){logger['info'](_0xa0df('0xd'),_0x332ae1,_0xa0df('0xe'));logger[_0xa0df('0xf')](_0xa0df('0x10'),_0x332ae1,_0xa0df('0xe'),JSON[_0xa0df('0x11')](_0x3b85b0));if(_0x3b85b0[_0xa0df('0x12')]){if(_0x3b85b0[_0xa0df('0x12')][_0xa0df('0x13')]===0x1f4){logger[_0xa0df('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0x332ae1,_0x3b85b0['error'][_0xa0df('0x14')]);return _0x3deaa6(_0x3b85b0[_0xa0df('0x12')][_0xa0df('0x14')]);}logger[_0xa0df('0x12')](_0xa0df('0xd'),_0x332ae1,_0x3b85b0[_0xa0df('0x12')]['message']);return _0x3f74d6(_0x3b85b0[_0xa0df('0x12')][_0xa0df('0x14')]);}else{logger[_0xa0df('0x15')](_0xa0df('0xd'),_0x332ae1,_0xa0df('0xe'));_0x3f74d6(_0x3b85b0[_0xa0df('0x16')][_0xa0df('0x14')]);}})['catch'](function(_0x13fd78){logger[_0xa0df('0x12')](_0xa0df('0xd'),_0x332ae1,_0x13fd78);_0x3deaa6(_0x13fd78);});});}exports[_0xa0df('0x17')]=function(_0x32dd26){var _0x5f5bf1=this;return new Promise(function(_0x1a3c0f,_0x53152e){return db[_0xa0df('0x18')][_0xa0df('0x19')]({'raw':_0x32dd26[_0xa0df('0x1a')]?_0x32dd26[_0xa0df('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x32dd26[_0xa0df('0x1a')]?_0x32dd26[_0xa0df('0x1a')][_0xa0df('0x1b')]||null:null,'attributes':_0x32dd26[_0xa0df('0x1a')]?_0x32dd26[_0xa0df('0x1a')]['attributes']||null:null,'limit':_0x32dd26[_0xa0df('0x1a')]?_0x32dd26[_0xa0df('0x1a')][_0xa0df('0x1c')]||null:null,'include':_0x32dd26[_0xa0df('0x1a')]?_0x32dd26[_0xa0df('0x1a')][_0xa0df('0x1d')]?_['map'](_0x32dd26[_0xa0df('0x1a')][_0xa0df('0x1d')],function(_0x4db95f){return{'model':db[_0x4db95f[_0xa0df('0x1e')]],'as':_0x4db95f['as'],'attributes':_0x4db95f[_0xa0df('0x1f')],'include':_0x4db95f[_0xa0df('0x1d')]?_[_0xa0df('0x20')](_0x4db95f[_0xa0df('0x1d')],function(_0x8a16c5){return{'model':db[_0x8a16c5['model']],'as':_0x8a16c5['as'],'attributes':_0x8a16c5['attributes'],'include':_0x8a16c5[_0xa0df('0x1d')]?_[_0xa0df('0x20')](_0x8a16c5[_0xa0df('0x1d')],function(_0x225d82){return{'model':db[_0x225d82[_0xa0df('0x1e')]],'as':_0x225d82['as'],'attributes':_0x225d82[_0xa0df('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa0df('0xc')](function(_0x1dcd84){logger['info'](_0xa0df('0x17'),_0x32dd26);logger[_0xa0df('0xf')](_0xa0df('0x17'),_0x32dd26,JSON[_0xa0df('0x11')](_0x1dcd84));_0x1a3c0f(_0x1dcd84);})[_0xa0df('0x21')](function(_0x47890d){logger[_0xa0df('0x12')](_0xa0df('0x17'),_0x47890d['message'],_0x32dd26);_0x53152e(_0x5f5bf1['error'](0x1f4,_0x47890d['message']));});});};exports[_0xa0df('0x22')]=function(_0x1b1178){var _0x14e9d2=this;return new Promise(function(_0x39de43,_0xbad996){return db['SalesforceAccount'][_0xa0df('0x23')]({'raw':_0x1b1178[_0xa0df('0x1a')]?_0x1b1178[_0xa0df('0x1a')][_0xa0df('0x24')]===undefined?!![]:![]:!![],'where':_0x1b1178[_0xa0df('0x1a')]?_0x1b1178[_0xa0df('0x1a')][_0xa0df('0x1b')]||null:null,'attributes':_0x1b1178['options']?_0x1b1178[_0xa0df('0x1a')]['attributes']||null:null,'include':_0x1b1178[_0xa0df('0x1a')]?_0x1b1178[_0xa0df('0x1a')][_0xa0df('0x1d')]?_[_0xa0df('0x20')](_0x1b1178[_0xa0df('0x1a')]['include'],function(_0x5345b0){return{'model':db[_0x5345b0[_0xa0df('0x1e')]],'as':_0x5345b0['as'],'attributes':_0x5345b0[_0xa0df('0x1f')],'include':_0x5345b0['include']?_[_0xa0df('0x20')](_0x5345b0[_0xa0df('0x1d')],function(_0x15ce23){return{'model':db[_0x15ce23[_0xa0df('0x1e')]],'as':_0x15ce23['as'],'attributes':_0x15ce23[_0xa0df('0x1f')],'include':_0x15ce23[_0xa0df('0x1d')]?_[_0xa0df('0x20')](_0x15ce23['include'],function(_0x4efa59){return{'model':db[_0x4efa59[_0xa0df('0x1e')]],'as':_0x4efa59['as'],'attributes':_0x4efa59['attributes']};}):[]};}):[]};}):[]:[]})[_0xa0df('0xc')](function(_0x248ee3){logger[_0xa0df('0x15')]('ShowSalesforceAccount',_0x1b1178);logger[_0xa0df('0xf')](_0xa0df('0x22'),_0x1b1178,JSON['stringify'](_0x248ee3));_0x39de43(_0x248ee3);})['catch'](function(_0x470c81){logger[_0xa0df('0x12')]('ShowSalesforceAccount',_0x470c81[_0xa0df('0x14')],_0x1b1178);_0xbad996(_0x14e9d2['error'](0x1f4,_0x470c81[_0xa0df('0x14')]));});});}; \ No newline at end of file +var _0x9250=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowSalesforceAccount','find','lodash'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x9250,0x1b9));var _0x0925=function(_0x5d46ab,_0x31f000){_0x5d46ab=_0x5d46ab-0x0;var _0x1b9a28=_0x9250[_0x5d46ab];return _0x1b9a28;};'use strict';var _=require(_0x0925('0x0'));var util=require(_0x0925('0x1'));var moment=require('moment');var BPromise=require(_0x0925('0x2'));var rs=require(_0x0925('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0925('0x4'))['db'];var utils=require(_0x0925('0x5'));var logger=require(_0x0925('0x6'))('rpc');var config=require(_0x0925('0x7'));var jayson=require(_0x0925('0x8'));var client=jayson[_0x0925('0x9')][_0x0925('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41fe59,_0x3fa5d4,_0x4c04ea){return new BPromise(function(_0x389625,_0x2ee825){return client['request'](_0x41fe59,_0x4c04ea)[_0x0925('0xb')](function(_0x3018ad){logger[_0x0925('0xc')](_0x0925('0xd'),_0x3fa5d4,_0x0925('0xe'));logger[_0x0925('0xf')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x3fa5d4,_0x0925('0xe'),JSON[_0x0925('0x10')](_0x3018ad));if(_0x3018ad[_0x0925('0x11')]){if(_0x3018ad[_0x0925('0x11')][_0x0925('0x12')]===0x1f4){logger[_0x0925('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x3fa5d4,_0x3018ad[_0x0925('0x11')][_0x0925('0x13')]);return _0x2ee825(_0x3018ad['error'][_0x0925('0x13')]);}logger['error'](_0x0925('0xd'),_0x3fa5d4,_0x3018ad['error'][_0x0925('0x13')]);return _0x389625(_0x3018ad[_0x0925('0x11')]['message']);}else{logger['info'](_0x0925('0xd'),_0x3fa5d4,'request\x20sent');_0x389625(_0x3018ad['result'][_0x0925('0x13')]);}})[_0x0925('0x14')](function(_0x43c173){logger[_0x0925('0x11')](_0x0925('0xd'),_0x3fa5d4,_0x43c173);_0x2ee825(_0x43c173);});});}exports[_0x0925('0x15')]=function(_0x1905a8){var _0x2a6c35=this;return new Promise(function(_0xb5e915,_0x4f4578){return db[_0x0925('0x16')][_0x0925('0x17')]({'raw':_0x1905a8[_0x0925('0x18')]?_0x1905a8['options'][_0x0925('0x19')]===undefined?!![]:![]:!![],'where':_0x1905a8[_0x0925('0x18')]?_0x1905a8[_0x0925('0x18')][_0x0925('0x1a')]||null:null,'attributes':_0x1905a8[_0x0925('0x18')]?_0x1905a8[_0x0925('0x18')][_0x0925('0x1b')]||null:null,'limit':_0x1905a8['options']?_0x1905a8[_0x0925('0x18')][_0x0925('0x1c')]||null:null,'include':_0x1905a8[_0x0925('0x18')]?_0x1905a8[_0x0925('0x18')][_0x0925('0x1d')]?_[_0x0925('0x1e')](_0x1905a8[_0x0925('0x18')]['include'],function(_0x7d59cb){return{'model':db[_0x7d59cb[_0x0925('0x1f')]],'as':_0x7d59cb['as'],'attributes':_0x7d59cb[_0x0925('0x1b')],'include':_0x7d59cb['include']?_[_0x0925('0x1e')](_0x7d59cb[_0x0925('0x1d')],function(_0x363bf3){return{'model':db[_0x363bf3[_0x0925('0x1f')]],'as':_0x363bf3['as'],'attributes':_0x363bf3['attributes'],'include':_0x363bf3[_0x0925('0x1d')]?_[_0x0925('0x1e')](_0x363bf3[_0x0925('0x1d')],function(_0x2bf89b){return{'model':db[_0x2bf89b['model']],'as':_0x2bf89b['as'],'attributes':_0x2bf89b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x11e372){logger['info'](_0x0925('0x15'),_0x1905a8);logger[_0x0925('0xf')]('GetSalesforceAccount',_0x1905a8,JSON[_0x0925('0x10')](_0x11e372));_0xb5e915(_0x11e372);})[_0x0925('0x14')](function(_0x28ec94){logger['error'](_0x0925('0x15'),_0x28ec94['message'],_0x1905a8);_0x4f4578(_0x2a6c35[_0x0925('0x11')](0x1f4,_0x28ec94['message']));});});};exports[_0x0925('0x20')]=function(_0x416491){var _0x1447e9=this;return new Promise(function(_0x490411,_0x328855){return db[_0x0925('0x16')][_0x0925('0x21')]({'raw':_0x416491[_0x0925('0x18')]?_0x416491[_0x0925('0x18')][_0x0925('0x19')]===undefined?!![]:![]:!![],'where':_0x416491[_0x0925('0x18')]?_0x416491['options']['where']||null:null,'attributes':_0x416491['options']?_0x416491[_0x0925('0x18')][_0x0925('0x1b')]||null:null,'include':_0x416491[_0x0925('0x18')]?_0x416491[_0x0925('0x18')][_0x0925('0x1d')]?_[_0x0925('0x1e')](_0x416491['options'][_0x0925('0x1d')],function(_0x5b4b0b){return{'model':db[_0x5b4b0b[_0x0925('0x1f')]],'as':_0x5b4b0b['as'],'attributes':_0x5b4b0b[_0x0925('0x1b')],'include':_0x5b4b0b[_0x0925('0x1d')]?_[_0x0925('0x1e')](_0x5b4b0b[_0x0925('0x1d')],function(_0x2cc942){return{'model':db[_0x2cc942[_0x0925('0x1f')]],'as':_0x2cc942['as'],'attributes':_0x2cc942['attributes'],'include':_0x2cc942[_0x0925('0x1d')]?_['map'](_0x2cc942[_0x0925('0x1d')],function(_0x3f7e7d){return{'model':db[_0x3f7e7d[_0x0925('0x1f')]],'as':_0x3f7e7d['as'],'attributes':_0x3f7e7d[_0x0925('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0925('0xb')](function(_0x5b8c10){logger['info']('ShowSalesforceAccount',_0x416491);logger[_0x0925('0xf')](_0x0925('0x20'),_0x416491,JSON['stringify'](_0x5b8c10));_0x490411(_0x5b8c10);})['catch'](function(_0x31ed26){logger[_0x0925('0x11')](_0x0925('0x20'),_0x31ed26[_0x0925('0x13')],_0x416491);_0x328855(_0x1447e9[_0x0925('0x11')](0x1f4,_0x31ed26['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 2002586..45e6e37 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['Router','fs-extra','../../components/auth/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x36e94c,_0x1ba427){var _0x2d5743=function(_0x1477a5){while(--_0x1477a5){_0x36e94c['push'](_0x36e94c['shift']());}};_0x2d5743(++_0x1ba427);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3dc274,_0x46be09){_0x3dc274=_0x3dc274-0x0;var _0x1672f4=_0x5f2f[_0x3dc274];return _0x1672f4;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/descriptions',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['post']('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x15')]);router['delete'](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x16')]);module[_0xf5f2('0x17')]=router; \ No newline at end of file +var _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x24da2f,_0x5117ff){var _0x3c38d0=function(_0x7796f8){while(--_0x7796f8){_0x24da2f['push'](_0x24da2f['shift']());}};_0x3c38d0(++_0x5117ff);}(_0x5f66,0x1a0));var _0x65f6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5f66[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index f157d8c..36feaac 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 _0x5d4c=['account','nothing','sequelize','exports','STRING','ENUM','Task','contact_lead','contact','lead','account_contact_lead'];(function(_0x1a4cfc,_0x53a1af){var _0x1bb003=function(_0x2396f5){while(--_0x2396f5){_0x1a4cfc['push'](_0x1a4cfc['shift']());}};_0x1bb003(++_0x53a1af);}(_0x5d4c,0x1ba));var _0xc5d4=function(_0x23a0ce,_0x7603c){_0x23a0ce=_0x23a0ce-0x0;var _0x34c318=_0x5d4c[_0x23a0ce];return _0x34c318;};'use strict';var Sequelize=require(_0xc5d4('0x0'));module[_0xc5d4('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc5d4('0x2')]},'ticketType':{'type':Sequelize[_0xc5d4('0x3')](_0xc5d4('0x4'),'Case'),'defaultValue':_0xc5d4('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0xc5d4('0x5'),_0xc5d4('0x6'),_0xc5d4('0x7'),_0xc5d4('0x8'),_0xc5d4('0x9')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0xc5d4('0x3')](_0xc5d4('0xa'),_0xc5d4('0x6'),_0xc5d4('0x7'),_0xc5d4('0x9')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0xc5d4('0x2')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0xc5d4('0x2')]}}; \ No newline at end of file +var _0xa74f=['lead','account_contact_lead','account','nothing','sequelize','STRING','Task','Case','ENUM','contact_lead'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xa74f,0xe0));var _0xfa74=function(_0x593d89,_0x45145f){_0x593d89=_0x593d89-0x0;var _0x4aa403=_0xa74f[_0x593d89];return _0x4aa403;};'use strict';var Sequelize=require(_0xfa74('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfa74('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0xfa74('0x2'),_0xfa74('0x3')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0xfa74('0x4')](_0xfa74('0x5'),'contact',_0xfa74('0x6'),_0xfa74('0x7'),_0xfa74('0x8')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0xfa74('0x4')](_0xfa74('0x9'),'contact','lead',_0xfa74('0x8')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0xfa74('0x1')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0xfa74('0x1')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 1281150..78c54ad 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 _0xa8eb=['apply','reject','save','destroy','then','error','stack','name','send','index','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SalesforceConfiguration','includeAll','include','findAll','rows','show','rawAttributes','find','catch','create','update','body','params','getFields','SalesforceField','getSubjects','findOne','getDescriptions','eml-format','zip-dir','request-promise','moment','bluebird','util','path','to-csv','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range'];(function(_0x309159,_0x2a4604){var _0x1f763e=function(_0xb9045b){while(--_0xb9045b){_0x309159['push'](_0x309159['shift']());}};_0x1f763e(++_0x2a4604);}(_0xa8eb,0x179));var _0xba8e=function(_0x2abffd,_0x398d13){_0x2abffd=_0x2abffd-0x0;var _0x38cbf1=_0xa8eb[_0x2abffd];return _0x38cbf1;};'use strict';var emlformat=require(_0xba8e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xba8e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xba8e('0x2'));var moment=require(_0xba8e('0x3'));var BPromise=require(_0xba8e('0x4'));var Mustache=require('mustache');var util=require(_0xba8e('0x5'));var path=require(_0xba8e('0x6'));var sox=require('sox');var csv=require(_0xba8e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xba8e('0x8'));var _=require('lodash');var squel=require(_0xba8e('0x9'));var crypto=require(_0xba8e('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xba8e('0x7'));var querystring=require(_0xba8e('0xb'));var Papa=require(_0xba8e('0xc'));var Redis=require(_0xba8e('0xd'));var authService=require(_0xba8e('0xe'));var qs=require(_0xba8e('0xf'));var as=require(_0xba8e('0x10'));var hardwareService=require(_0xba8e('0x11'));var logger=require(_0xba8e('0x12'))('api');var utils=require(_0xba8e('0x13'));var config=require(_0xba8e('0x14'));var licenseUtil=require(_0xba8e('0x15'));var db=require(_0xba8e('0x16'))['db'];function respondWithStatusCode(_0x380631,_0x56e63e){_0x56e63e=_0x56e63e||0xcc;return function(_0x4e9f6d){if(_0x4e9f6d){return _0x380631[_0xba8e('0x17')](_0x56e63e);}return _0x380631[_0xba8e('0x18')](_0x56e63e)[_0xba8e('0x19')]();};}function respondWithResult(_0x10f136,_0xec4952){_0xec4952=_0xec4952||0xc8;return function(_0x327fc5){if(_0x327fc5){return _0x10f136[_0xba8e('0x18')](_0xec4952)[_0xba8e('0x1a')](_0x327fc5);}};}function respondWithFilteredResult(_0x362973,_0x310513){return function(_0x414a6e){if(_0x414a6e){var _0x579249=typeof _0x310513[_0xba8e('0x1b')]==='undefined'&&typeof _0x310513[_0xba8e('0x1c')]===_0xba8e('0x1d');var _0x476fcf=_0x414a6e['count'];var _0x3e213c=_0x579249?0x0:_0x310513[_0xba8e('0x1b')];var _0x1627c7=_0x579249?_0x414a6e[_0xba8e('0x1e')]:_0x310513[_0xba8e('0x1b')]+_0x310513[_0xba8e('0x1c')];var _0x1d6f2a;if(_0x1627c7>=_0x476fcf){_0x1627c7=_0x476fcf;_0x1d6f2a=0xc8;}else{_0x1d6f2a=0xce;}_0x362973[_0xba8e('0x18')](_0x1d6f2a);return _0x362973[_0xba8e('0x1f')](_0xba8e('0x20'),_0x3e213c+'-'+_0x1627c7+'/'+_0x476fcf)[_0xba8e('0x1a')](_0x414a6e);}return null;};}function patchUpdates(_0x9c93d3){return function(_0x19b728){try{jsonpatch[_0xba8e('0x21')](_0x19b728,_0x9c93d3,!![]);}catch(_0x7592ce){return BPromise[_0xba8e('0x22')](_0x7592ce);}return _0x19b728[_0xba8e('0x23')]();};}function saveUpdates(_0x3bee6,_0x1564fc){return function(_0x49323a){if(_0x49323a){return _0x49323a['update'](_0x3bee6)['then'](function(_0x23f338){return _0x23f338;});}return null;};}function removeEntity(_0x7d4ca,_0x5a8ab1){return function(_0x3421b1){if(_0x3421b1){return _0x3421b1[_0xba8e('0x24')]()[_0xba8e('0x25')](function(){_0x7d4ca['status'](0xcc)[_0xba8e('0x19')]();});}};}function handleEntityNotFound(_0x2fa7c0,_0x46dca7){return function(_0x57f4a2){if(!_0x57f4a2){_0x2fa7c0[_0xba8e('0x17')](0x194);}return _0x57f4a2;};}function handleError(_0x17a4b8,_0x507c31){_0x507c31=_0x507c31||0x1f4;return function(_0xcbec){logger[_0xba8e('0x26')](_0xcbec[_0xba8e('0x27')]);if(_0xcbec[_0xba8e('0x28')]){delete _0xcbec[_0xba8e('0x28')];}_0x17a4b8[_0xba8e('0x18')](_0x507c31)[_0xba8e('0x29')](_0xcbec);};}exports[_0xba8e('0x2a')]=function(_0x264520,_0x40f988){var _0x1abc58={},_0x22571f={},_0x1baffd={'count':0x0,'rows':[]};var _0x5c0434=_[_0xba8e('0x2b')](db['SalesforceConfiguration']['rawAttributes'],function(_0x2242f0){return{'name':_0x2242f0[_0xba8e('0x2c')],'type':_0x2242f0[_0xba8e('0x2d')]['key']};});_0x22571f[_0xba8e('0x2e')]=_[_0xba8e('0x2b')](_0x5c0434,_0xba8e('0x28'));_0x22571f[_0xba8e('0x2f')]=_[_0xba8e('0x30')](_0x264520[_0xba8e('0x2f')]);_0x22571f[_0xba8e('0x31')]=_[_0xba8e('0x32')](_0x22571f['model'],_0x22571f['query']);_0x1abc58[_0xba8e('0x33')]=_[_0xba8e('0x32')](_0x22571f['model'],qs[_0xba8e('0x34')](_0x264520['query'][_0xba8e('0x34')]));_0x1abc58[_0xba8e('0x33')]=_0x1abc58['attributes'][_0xba8e('0x35')]?_0x1abc58[_0xba8e('0x33')]:_0x22571f['model'];if(!_0x264520[_0xba8e('0x2f')][_0xba8e('0x36')](_0xba8e('0x37'))){_0x1abc58[_0xba8e('0x1c')]=qs[_0xba8e('0x1c')](_0x264520[_0xba8e('0x2f')][_0xba8e('0x1c')]);_0x1abc58['offset']=qs[_0xba8e('0x1b')](_0x264520[_0xba8e('0x2f')]['offset']);}_0x1abc58[_0xba8e('0x38')]=qs['sort'](_0x264520['query'][_0xba8e('0x39')]);_0x1abc58[_0xba8e('0x3a')]=qs['filters'](_[_0xba8e('0x3b')](_0x264520[_0xba8e('0x2f')],_0x22571f['filters']),_0x5c0434);if(_0x264520['query'][_0xba8e('0x3c')]){_0x1abc58['where']=_[_0xba8e('0x3d')](_0x1abc58[_0xba8e('0x3a')],{'$or':_[_0xba8e('0x2b')](_0x5c0434,function(_0x28f9a5){if(_0x28f9a5[_0xba8e('0x2d')]!==_0xba8e('0x3e')){var _0x4a9d4d={};_0x4a9d4d[_0x28f9a5[_0xba8e('0x28')]]={'$like':'%'+_0x264520[_0xba8e('0x2f')][_0xba8e('0x3c')]+'%'};return _0x4a9d4d;}})});}_0x1abc58=_[_0xba8e('0x3d')]({},_0x1abc58,_0x264520[_0xba8e('0x3f')]);var _0x1287c7={'where':_0x1abc58['where']};return db[_0xba8e('0x40')]['count'](_0x1287c7)[_0xba8e('0x25')](function(_0x8d91be){_0x1baffd[_0xba8e('0x1e')]=_0x8d91be;if(_0x264520['query'][_0xba8e('0x41')]){_0x1abc58[_0xba8e('0x42')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0xba8e('0x43')](_0x1abc58);})[_0xba8e('0x25')](function(_0x5a2156){_0x1baffd[_0xba8e('0x44')]=_0x5a2156;return _0x1baffd;})[_0xba8e('0x25')](respondWithFilteredResult(_0x40f988,_0x1abc58))['catch'](handleError(_0x40f988,null));};exports[_0xba8e('0x45')]=function(_0x397c78,_0x5387a8){var _0x371877={'raw':![],'where':{'id':_0x397c78['params']['id']}},_0xd624a6={};_0xd624a6[_0xba8e('0x2e')]=_['keys'](db[_0xba8e('0x40')][_0xba8e('0x46')]);_0xd624a6[_0xba8e('0x2f')]=_[_0xba8e('0x30')](_0x397c78[_0xba8e('0x2f')]);_0xd624a6['filters']=_['intersection'](_0xd624a6[_0xba8e('0x2e')],_0xd624a6[_0xba8e('0x2f')]);_0x371877['attributes']=_[_0xba8e('0x32')](_0xd624a6[_0xba8e('0x2e')],qs[_0xba8e('0x34')](_0x397c78[_0xba8e('0x2f')][_0xba8e('0x34')]));_0x371877[_0xba8e('0x33')]=_0x371877[_0xba8e('0x33')][_0xba8e('0x35')]?_0x371877[_0xba8e('0x33')]:_0xd624a6[_0xba8e('0x2e')];if(_0x397c78[_0xba8e('0x2f')][_0xba8e('0x41')]){_0x371877[_0xba8e('0x42')]=[{'all':!![]}];}_0x371877=_[_0xba8e('0x3d')]({},_0x371877,_0x397c78[_0xba8e('0x3f')]);return db['SalesforceConfiguration'][_0xba8e('0x47')](_0x371877)[_0xba8e('0x25')](handleEntityNotFound(_0x5387a8,null))['then'](respondWithResult(_0x5387a8,null))[_0xba8e('0x48')](handleError(_0x5387a8,null));};exports['create']=function(_0x59fe66,_0xefd3b7){return db[_0xba8e('0x40')][_0xba8e('0x49')](_0x59fe66['body'],{})['then'](respondWithResult(_0xefd3b7,0xc9))['catch'](handleError(_0xefd3b7,null));};exports[_0xba8e('0x4a')]=function(_0x58c318,_0x901bdf){if(_0x58c318[_0xba8e('0x4b')]['id']){delete _0x58c318['body']['id'];}return db[_0xba8e('0x40')][_0xba8e('0x47')]({'where':{'id':_0x58c318[_0xba8e('0x4c')]['id']}})[_0xba8e('0x25')](handleEntityNotFound(_0x901bdf,null))[_0xba8e('0x25')](saveUpdates(_0x58c318[_0xba8e('0x4b')],null))[_0xba8e('0x25')](respondWithResult(_0x901bdf,null))['catch'](handleError(_0x901bdf,null));};exports[_0xba8e('0x24')]=function(_0x9eb202,_0x2410d2){return db[_0xba8e('0x40')][_0xba8e('0x47')]({'where':{'id':_0x9eb202[_0xba8e('0x4c')]['id']}})[_0xba8e('0x25')](handleEntityNotFound(_0x2410d2,null))[_0xba8e('0x25')](removeEntity(_0x2410d2,null))[_0xba8e('0x48')](handleError(_0x2410d2,null));};exports[_0xba8e('0x4d')]=function(_0x469001,_0xc8d9f1,_0x519c73){var _0x232610={};var _0xc7db2f={};var _0x288570;var _0x3fcdee;return db[_0xba8e('0x40')]['findOne']({'where':{'id':_0x469001['params']['id']}})[_0xba8e('0x25')](handleEntityNotFound(_0xc8d9f1,null))[_0xba8e('0x25')](function(_0x4331c5){if(_0x4331c5){_0x288570=_0x4331c5;_0xc7db2f[_0xba8e('0x2e')]=_['keys'](db[_0xba8e('0x4e')][_0xba8e('0x46')]);_0xc7db2f[_0xba8e('0x2f')]=_[_0xba8e('0x30')](_0x469001[_0xba8e('0x2f')]);_0xc7db2f['filters']=_[_0xba8e('0x32')](_0xc7db2f[_0xba8e('0x2e')],_0xc7db2f['query']);_0x232610[_0xba8e('0x33')]=_['intersection'](_0xc7db2f[_0xba8e('0x2e')],qs[_0xba8e('0x34')](_0x469001[_0xba8e('0x2f')][_0xba8e('0x34')]));_0x232610[_0xba8e('0x33')]=_0x232610[_0xba8e('0x33')]['length']?_0x232610[_0xba8e('0x33')]:_0xc7db2f[_0xba8e('0x2e')];_0x232610[_0xba8e('0x38')]=qs[_0xba8e('0x39')](_0x469001['query']['sort']);_0x232610['where']=qs[_0xba8e('0x31')](_['pick'](_0x469001[_0xba8e('0x2f')],_0xc7db2f[_0xba8e('0x31')]));if(_0x469001[_0xba8e('0x2f')][_0xba8e('0x3c')]){_0x232610[_0xba8e('0x3a')]=_[_0xba8e('0x3d')](_0x232610[_0xba8e('0x3a')],{'$or':_[_0xba8e('0x2b')](_0x232610[_0xba8e('0x33')],function(_0x583b02){var _0x5c41c2={};_0x5c41c2[_0x583b02]={'$like':'%'+_0x469001[_0xba8e('0x2f')][_0xba8e('0x3c')]+'%'};return _0x5c41c2;})});}_0x232610=_[_0xba8e('0x3d')]({},_0x232610,_0x469001[_0xba8e('0x3f')]);return _0x288570[_0xba8e('0x4d')](_0x232610);}})[_0xba8e('0x25')](function(_0x21daa9){if(_0x21daa9){_0x3fcdee=_0x21daa9['length'];if(!_0x469001['query'][_0xba8e('0x36')]('nolimit')){_0x232610['limit']=qs['limit'](_0x469001[_0xba8e('0x2f')][_0xba8e('0x1c')]);_0x232610[_0xba8e('0x1b')]=qs[_0xba8e('0x1b')](_0x469001[_0xba8e('0x2f')][_0xba8e('0x1b')]);}return _0x288570[_0xba8e('0x4d')](_0x232610);}})[_0xba8e('0x25')](function(_0x3444bc){if(_0x3444bc){return _0x3444bc?{'count':_0x3fcdee,'rows':_0x3444bc}:null;}})[_0xba8e('0x25')](respondWithResult(_0xc8d9f1,null))['catch'](handleError(_0xc8d9f1,null));};exports[_0xba8e('0x4f')]=function(_0x4a13b1,_0x443499,_0x9338a7){var _0x1e4111={};var _0x3c0345={};var _0x12e05c;var _0x2e60f7;return db[_0xba8e('0x40')][_0xba8e('0x50')]({'where':{'id':_0x4a13b1[_0xba8e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x443499,null))[_0xba8e('0x25')](function(_0x4e1d9a){if(_0x4e1d9a){_0x12e05c=_0x4e1d9a;_0x3c0345[_0xba8e('0x2e')]=_[_0xba8e('0x30')](db['SalesforceField'][_0xba8e('0x46')]);_0x3c0345[_0xba8e('0x2f')]=_[_0xba8e('0x30')](_0x4a13b1[_0xba8e('0x2f')]);_0x3c0345['filters']=_[_0xba8e('0x32')](_0x3c0345[_0xba8e('0x2e')],_0x3c0345[_0xba8e('0x2f')]);_0x1e4111[_0xba8e('0x33')]=_[_0xba8e('0x32')](_0x3c0345[_0xba8e('0x2e')],qs[_0xba8e('0x34')](_0x4a13b1[_0xba8e('0x2f')][_0xba8e('0x34')]));_0x1e4111['attributes']=_0x1e4111[_0xba8e('0x33')][_0xba8e('0x35')]?_0x1e4111[_0xba8e('0x33')]:_0x3c0345[_0xba8e('0x2e')];_0x1e4111[_0xba8e('0x38')]=qs[_0xba8e('0x39')](_0x4a13b1[_0xba8e('0x2f')][_0xba8e('0x39')]);_0x1e4111['where']=qs[_0xba8e('0x31')](_[_0xba8e('0x3b')](_0x4a13b1['query'],_0x3c0345[_0xba8e('0x31')]));if(_0x4a13b1['query']['filter']){_0x1e4111['where']=_[_0xba8e('0x3d')](_0x1e4111['where'],{'$or':_[_0xba8e('0x2b')](_0x1e4111[_0xba8e('0x33')],function(_0x226286){var _0x2de86b={};_0x2de86b[_0x226286]={'$like':'%'+_0x4a13b1[_0xba8e('0x2f')][_0xba8e('0x3c')]+'%'};return _0x2de86b;})});}_0x1e4111=_[_0xba8e('0x3d')]({},_0x1e4111,_0x4a13b1[_0xba8e('0x3f')]);return _0x12e05c[_0xba8e('0x4f')](_0x1e4111);}})['then'](function(_0x929339){if(_0x929339){_0x2e60f7=_0x929339['length'];if(!_0x4a13b1['query'][_0xba8e('0x36')]('nolimit')){_0x1e4111['limit']=qs[_0xba8e('0x1c')](_0x4a13b1['query']['limit']);_0x1e4111[_0xba8e('0x1b')]=qs['offset'](_0x4a13b1[_0xba8e('0x2f')][_0xba8e('0x1b')]);}return _0x12e05c[_0xba8e('0x4f')](_0x1e4111);}})['then'](function(_0x5113c4){if(_0x5113c4){return _0x5113c4?{'count':_0x2e60f7,'rows':_0x5113c4}:null;}})[_0xba8e('0x25')](respondWithResult(_0x443499,null))[_0xba8e('0x48')](handleError(_0x443499,null));};exports['getDescriptions']=function(_0x2877ce,_0x5cea50,_0xa9961c){var _0x5bd5ff={};var _0x261ccd={};var _0x2f85ee;var _0x294366;return db['SalesforceConfiguration'][_0xba8e('0x50')]({'where':{'id':_0x2877ce['params']['id']}})[_0xba8e('0x25')](handleEntityNotFound(_0x5cea50,null))[_0xba8e('0x25')](function(_0x4493e4){if(_0x4493e4){_0x2f85ee=_0x4493e4;_0x261ccd[_0xba8e('0x2e')]=_[_0xba8e('0x30')](db[_0xba8e('0x4e')]['rawAttributes']);_0x261ccd[_0xba8e('0x2f')]=_[_0xba8e('0x30')](_0x2877ce[_0xba8e('0x2f')]);_0x261ccd[_0xba8e('0x31')]=_[_0xba8e('0x32')](_0x261ccd[_0xba8e('0x2e')],_0x261ccd[_0xba8e('0x2f')]);_0x5bd5ff['attributes']=_[_0xba8e('0x32')](_0x261ccd['model'],qs[_0xba8e('0x34')](_0x2877ce[_0xba8e('0x2f')][_0xba8e('0x34')]));_0x5bd5ff[_0xba8e('0x33')]=_0x5bd5ff['attributes'][_0xba8e('0x35')]?_0x5bd5ff[_0xba8e('0x33')]:_0x261ccd[_0xba8e('0x2e')];_0x5bd5ff[_0xba8e('0x38')]=qs['sort'](_0x2877ce[_0xba8e('0x2f')][_0xba8e('0x39')]);_0x5bd5ff[_0xba8e('0x3a')]=qs[_0xba8e('0x31')](_[_0xba8e('0x3b')](_0x2877ce[_0xba8e('0x2f')],_0x261ccd[_0xba8e('0x31')]));if(_0x2877ce[_0xba8e('0x2f')][_0xba8e('0x3c')]){_0x5bd5ff[_0xba8e('0x3a')]=_[_0xba8e('0x3d')](_0x5bd5ff['where'],{'$or':_[_0xba8e('0x2b')](_0x5bd5ff[_0xba8e('0x33')],function(_0x139525){var _0x104a33={};_0x104a33[_0x139525]={'$like':'%'+_0x2877ce[_0xba8e('0x2f')][_0xba8e('0x3c')]+'%'};return _0x104a33;})});}_0x5bd5ff=_[_0xba8e('0x3d')]({},_0x5bd5ff,_0x2877ce[_0xba8e('0x3f')]);return _0x2f85ee[_0xba8e('0x51')](_0x5bd5ff);}})['then'](function(_0x4fe776){if(_0x4fe776){_0x294366=_0x4fe776[_0xba8e('0x35')];if(!_0x2877ce[_0xba8e('0x2f')][_0xba8e('0x36')](_0xba8e('0x37'))){_0x5bd5ff['limit']=qs['limit'](_0x2877ce[_0xba8e('0x2f')][_0xba8e('0x1c')]);_0x5bd5ff[_0xba8e('0x1b')]=qs[_0xba8e('0x1b')](_0x2877ce[_0xba8e('0x2f')][_0xba8e('0x1b')]);}return _0x2f85ee[_0xba8e('0x51')](_0x5bd5ff);}})[_0xba8e('0x25')](function(_0x29406d){if(_0x29406d){return _0x29406d?{'count':_0x294366,'rows':_0x29406d}:null;}})[_0xba8e('0x25')](respondWithResult(_0x5cea50,null))[_0xba8e('0x48')](handleError(_0x5cea50,null));}; \ No newline at end of file +var _0x9dd1=['attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','SalesforceConfiguration','includeAll','include','findAll','catch','params','find','create','body','findOne','SalesforceField','getFields','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','key','keys','query','filters','model'];(function(_0x14dad8,_0x595247){var _0x3713f2=function(_0xc703ed){while(--_0xc703ed){_0x14dad8['push'](_0x14dad8['shift']());}};_0x3713f2(++_0x595247);}(_0x9dd1,0x160));var _0x19dd=function(_0x2d9e27,_0x5965b2){_0x2d9e27=_0x2d9e27-0x0;var _0xd35381=_0x9dd1[_0x2d9e27];return _0xd35381;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x19dd('0x0'));var zipdir=require(_0x19dd('0x1'));var jsonpatch=require(_0x19dd('0x2'));var rp=require(_0x19dd('0x3'));var moment=require(_0x19dd('0x4'));var BPromise=require(_0x19dd('0x5'));var Mustache=require(_0x19dd('0x6'));var util=require(_0x19dd('0x7'));var path=require(_0x19dd('0x8'));var sox=require(_0x19dd('0x9'));var csv=require(_0x19dd('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x19dd('0xb'));var squel=require(_0x19dd('0xc'));var crypto=require(_0x19dd('0xd'));var jsforce=require(_0x19dd('0xe'));var deskjs=require(_0x19dd('0xf'));var toCsv=require(_0x19dd('0xa'));var querystring=require(_0x19dd('0x10'));var Papa=require(_0x19dd('0x11'));var Redis=require(_0x19dd('0x12'));var authService=require(_0x19dd('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x19dd('0x14'))(_0x19dd('0x15'));var utils=require(_0x19dd('0x16'));var config=require(_0x19dd('0x17'));var licenseUtil=require(_0x19dd('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a2a4b,_0x24d430){_0x24d430=_0x24d430||0xcc;return function(_0x33c379){if(_0x33c379){return _0x5a2a4b[_0x19dd('0x19')](_0x24d430);}return _0x5a2a4b[_0x19dd('0x1a')](_0x24d430)[_0x19dd('0x1b')]();};}function respondWithResult(_0x4f867,_0x5d9d98){_0x5d9d98=_0x5d9d98||0xc8;return function(_0x2bcbe7){if(_0x2bcbe7){return _0x4f867[_0x19dd('0x1a')](_0x5d9d98)[_0x19dd('0x1c')](_0x2bcbe7);}};}function respondWithFilteredResult(_0x49f9d0,_0x54d9a4){return function(_0x4bc7ec){if(_0x4bc7ec){var _0x11e164=typeof _0x54d9a4[_0x19dd('0x1d')]===_0x19dd('0x1e')&&typeof _0x54d9a4[_0x19dd('0x1f')]==='undefined';var _0x3e82e0=_0x4bc7ec[_0x19dd('0x20')];var _0xd136b7=_0x11e164?0x0:_0x54d9a4['offset'];var _0x1239b7=_0x11e164?_0x4bc7ec['count']:_0x54d9a4[_0x19dd('0x1d')]+_0x54d9a4[_0x19dd('0x1f')];var _0x3ea7bb;if(_0x1239b7>=_0x3e82e0){_0x1239b7=_0x3e82e0;_0x3ea7bb=0xc8;}else{_0x3ea7bb=0xce;}_0x49f9d0[_0x19dd('0x1a')](_0x3ea7bb);return _0x49f9d0[_0x19dd('0x21')](_0x19dd('0x22'),_0xd136b7+'-'+_0x1239b7+'/'+_0x3e82e0)[_0x19dd('0x1c')](_0x4bc7ec);}return null;};}function patchUpdates(_0x1403de){return function(_0xf539d8){try{jsonpatch[_0x19dd('0x23')](_0xf539d8,_0x1403de,!![]);}catch(_0x28587b){return BPromise[_0x19dd('0x24')](_0x28587b);}return _0xf539d8[_0x19dd('0x25')]();};}function saveUpdates(_0x26f863,_0x125c47){return function(_0x129ff9){if(_0x129ff9){return _0x129ff9[_0x19dd('0x26')](_0x26f863)[_0x19dd('0x27')](function(_0xbed71c){return _0xbed71c;});}return null;};}function removeEntity(_0x738661,_0x113256){return function(_0x23844a){if(_0x23844a){return _0x23844a[_0x19dd('0x28')]()['then'](function(){_0x738661[_0x19dd('0x1a')](0xcc)[_0x19dd('0x1b')]();});}};}function handleEntityNotFound(_0x5c08e4,_0xfaf7d3){return function(_0x3ffcc0){if(!_0x3ffcc0){_0x5c08e4['sendStatus'](0x194);}return _0x3ffcc0;};}function handleError(_0x27c552,_0x42ea13){_0x42ea13=_0x42ea13||0x1f4;return function(_0x38111e){logger[_0x19dd('0x29')](_0x38111e[_0x19dd('0x2a')]);if(_0x38111e[_0x19dd('0x2b')]){delete _0x38111e[_0x19dd('0x2b')];}_0x27c552['status'](_0x42ea13)['send'](_0x38111e);};}exports[_0x19dd('0x2c')]=function(_0x391a2f,_0xa232c9){var _0x18b534={},_0x43d35b={},_0xcd4106={'count':0x0,'rows':[]};var _0x348eed=_[_0x19dd('0x2d')](db['SalesforceConfiguration'][_0x19dd('0x2e')],function(_0x542f49){return{'name':_0x542f49[_0x19dd('0x2f')],'type':_0x542f49['type'][_0x19dd('0x30')]};});_0x43d35b['model']=_[_0x19dd('0x2d')](_0x348eed,'name');_0x43d35b['query']=_[_0x19dd('0x31')](_0x391a2f[_0x19dd('0x32')]);_0x43d35b[_0x19dd('0x33')]=_['intersection'](_0x43d35b[_0x19dd('0x34')],_0x43d35b[_0x19dd('0x32')]);_0x18b534[_0x19dd('0x35')]=_[_0x19dd('0x36')](_0x43d35b['model'],qs[_0x19dd('0x37')](_0x391a2f[_0x19dd('0x32')][_0x19dd('0x37')]));_0x18b534[_0x19dd('0x35')]=_0x18b534[_0x19dd('0x35')][_0x19dd('0x38')]?_0x18b534[_0x19dd('0x35')]:_0x43d35b[_0x19dd('0x34')];if(!_0x391a2f['query'][_0x19dd('0x39')](_0x19dd('0x3a'))){_0x18b534['limit']=qs['limit'](_0x391a2f['query'][_0x19dd('0x1f')]);_0x18b534['offset']=qs[_0x19dd('0x1d')](_0x391a2f['query']['offset']);}_0x18b534[_0x19dd('0x3b')]=qs[_0x19dd('0x3c')](_0x391a2f[_0x19dd('0x32')][_0x19dd('0x3c')]);_0x18b534[_0x19dd('0x3d')]=qs['filters'](_[_0x19dd('0x3e')](_0x391a2f['query'],_0x43d35b[_0x19dd('0x33')]),_0x348eed);if(_0x391a2f['query'][_0x19dd('0x3f')]){_0x18b534[_0x19dd('0x3d')]=_[_0x19dd('0x40')](_0x18b534['where'],{'$or':_[_0x19dd('0x2d')](_0x348eed,function(_0x1f6e00){if(_0x1f6e00[_0x19dd('0x41')]!=='VIRTUAL'){var _0x436257={};_0x436257[_0x1f6e00[_0x19dd('0x2b')]]={'$like':'%'+_0x391a2f[_0x19dd('0x32')]['filter']+'%'};return _0x436257;}})});}_0x18b534=_[_0x19dd('0x40')]({},_0x18b534,_0x391a2f[_0x19dd('0x42')]);var _0x1afb3d={'where':_0x18b534['where']};return db[_0x19dd('0x43')][_0x19dd('0x20')](_0x1afb3d)[_0x19dd('0x27')](function(_0x50046d){_0xcd4106['count']=_0x50046d;if(_0x391a2f['query'][_0x19dd('0x44')]){_0x18b534[_0x19dd('0x45')]=[{'all':!![]}];}return db[_0x19dd('0x43')][_0x19dd('0x46')](_0x18b534);})[_0x19dd('0x27')](function(_0x2527f9){_0xcd4106['rows']=_0x2527f9;return _0xcd4106;})[_0x19dd('0x27')](respondWithFilteredResult(_0xa232c9,_0x18b534))[_0x19dd('0x47')](handleError(_0xa232c9,null));};exports['show']=function(_0x1139c7,_0x28b2e6){var _0x575742={'raw':![],'where':{'id':_0x1139c7[_0x19dd('0x48')]['id']}},_0x1ab59b={};_0x1ab59b[_0x19dd('0x34')]=_['keys'](db[_0x19dd('0x43')][_0x19dd('0x2e')]);_0x1ab59b[_0x19dd('0x32')]=_[_0x19dd('0x31')](_0x1139c7[_0x19dd('0x32')]);_0x1ab59b['filters']=_['intersection'](_0x1ab59b[_0x19dd('0x34')],_0x1ab59b['query']);_0x575742['attributes']=_[_0x19dd('0x36')](_0x1ab59b[_0x19dd('0x34')],qs['fields'](_0x1139c7[_0x19dd('0x32')]['fields']));_0x575742[_0x19dd('0x35')]=_0x575742[_0x19dd('0x35')]['length']?_0x575742['attributes']:_0x1ab59b[_0x19dd('0x34')];if(_0x1139c7[_0x19dd('0x32')][_0x19dd('0x44')]){_0x575742['include']=[{'all':!![]}];}_0x575742=_['merge']({},_0x575742,_0x1139c7[_0x19dd('0x42')]);return db[_0x19dd('0x43')][_0x19dd('0x49')](_0x575742)['then'](handleEntityNotFound(_0x28b2e6,null))['then'](respondWithResult(_0x28b2e6,null))[_0x19dd('0x47')](handleError(_0x28b2e6,null));};exports[_0x19dd('0x4a')]=function(_0x1daeb1,_0x1a7b9d){return db['SalesforceConfiguration'][_0x19dd('0x4a')](_0x1daeb1[_0x19dd('0x4b')],{})['then'](respondWithResult(_0x1a7b9d,0xc9))[_0x19dd('0x47')](handleError(_0x1a7b9d,null));};exports['update']=function(_0x6f803e,_0x390ac4){if(_0x6f803e[_0x19dd('0x4b')]['id']){delete _0x6f803e['body']['id'];}return db[_0x19dd('0x43')][_0x19dd('0x49')]({'where':{'id':_0x6f803e[_0x19dd('0x48')]['id']}})[_0x19dd('0x27')](handleEntityNotFound(_0x390ac4,null))[_0x19dd('0x27')](saveUpdates(_0x6f803e[_0x19dd('0x4b')],null))[_0x19dd('0x27')](respondWithResult(_0x390ac4,null))[_0x19dd('0x47')](handleError(_0x390ac4,null));};exports[_0x19dd('0x28')]=function(_0x6d32d8,_0x276ffe){return db[_0x19dd('0x43')][_0x19dd('0x49')]({'where':{'id':_0x6d32d8['params']['id']}})[_0x19dd('0x27')](handleEntityNotFound(_0x276ffe,null))[_0x19dd('0x27')](removeEntity(_0x276ffe,null))['catch'](handleError(_0x276ffe,null));};exports['getFields']=function(_0x4a4f65,_0x4a97f5,_0x50a273){var _0x1cd063={};var _0x3276b={};var _0x31e6f4;var _0x4dbeba;return db[_0x19dd('0x43')][_0x19dd('0x4c')]({'where':{'id':_0x4a4f65[_0x19dd('0x48')]['id']}})[_0x19dd('0x27')](handleEntityNotFound(_0x4a97f5,null))[_0x19dd('0x27')](function(_0x411fbd){if(_0x411fbd){_0x31e6f4=_0x411fbd;_0x3276b[_0x19dd('0x34')]=_[_0x19dd('0x31')](db[_0x19dd('0x4d')]['rawAttributes']);_0x3276b[_0x19dd('0x32')]=_[_0x19dd('0x31')](_0x4a4f65['query']);_0x3276b['filters']=_[_0x19dd('0x36')](_0x3276b['model'],_0x3276b[_0x19dd('0x32')]);_0x1cd063[_0x19dd('0x35')]=_[_0x19dd('0x36')](_0x3276b['model'],qs['fields'](_0x4a4f65[_0x19dd('0x32')][_0x19dd('0x37')]));_0x1cd063[_0x19dd('0x35')]=_0x1cd063[_0x19dd('0x35')][_0x19dd('0x38')]?_0x1cd063[_0x19dd('0x35')]:_0x3276b[_0x19dd('0x34')];_0x1cd063[_0x19dd('0x3b')]=qs[_0x19dd('0x3c')](_0x4a4f65['query']['sort']);_0x1cd063[_0x19dd('0x3d')]=qs['filters'](_[_0x19dd('0x3e')](_0x4a4f65['query'],_0x3276b['filters']));if(_0x4a4f65[_0x19dd('0x32')]['filter']){_0x1cd063[_0x19dd('0x3d')]=_[_0x19dd('0x40')](_0x1cd063[_0x19dd('0x3d')],{'$or':_[_0x19dd('0x2d')](_0x1cd063['attributes'],function(_0x47634f){var _0x154beb={};_0x154beb[_0x47634f]={'$like':'%'+_0x4a4f65[_0x19dd('0x32')][_0x19dd('0x3f')]+'%'};return _0x154beb;})});}_0x1cd063=_[_0x19dd('0x40')]({},_0x1cd063,_0x4a4f65[_0x19dd('0x42')]);return _0x31e6f4[_0x19dd('0x4e')](_0x1cd063);}})[_0x19dd('0x27')](function(_0x5a463d){if(_0x5a463d){_0x4dbeba=_0x5a463d[_0x19dd('0x38')];if(!_0x4a4f65[_0x19dd('0x32')][_0x19dd('0x39')](_0x19dd('0x3a'))){_0x1cd063[_0x19dd('0x1f')]=qs[_0x19dd('0x1f')](_0x4a4f65[_0x19dd('0x32')]['limit']);_0x1cd063[_0x19dd('0x1d')]=qs[_0x19dd('0x1d')](_0x4a4f65[_0x19dd('0x32')][_0x19dd('0x1d')]);}return _0x31e6f4[_0x19dd('0x4e')](_0x1cd063);}})[_0x19dd('0x27')](function(_0x12ab45){if(_0x12ab45){return _0x12ab45?{'count':_0x4dbeba,'rows':_0x12ab45}:null;}})[_0x19dd('0x27')](respondWithResult(_0x4a97f5,null))[_0x19dd('0x47')](handleError(_0x4a97f5,null));};exports['getSubjects']=function(_0x5b3498,_0xda5773,_0xf1c61f){var _0x40e850={};var _0x51b192={};var _0x2eb13b;var _0x3b965e;return db[_0x19dd('0x43')]['findOne']({'where':{'id':_0x5b3498['params']['id']}})[_0x19dd('0x27')](handleEntityNotFound(_0xda5773,null))[_0x19dd('0x27')](function(_0x1678fd){if(_0x1678fd){_0x2eb13b=_0x1678fd;_0x51b192[_0x19dd('0x34')]=_['keys'](db[_0x19dd('0x4d')][_0x19dd('0x2e')]);_0x51b192[_0x19dd('0x32')]=_[_0x19dd('0x31')](_0x5b3498['query']);_0x51b192['filters']=_['intersection'](_0x51b192[_0x19dd('0x34')],_0x51b192[_0x19dd('0x32')]);_0x40e850['attributes']=_[_0x19dd('0x36')](_0x51b192[_0x19dd('0x34')],qs[_0x19dd('0x37')](_0x5b3498[_0x19dd('0x32')][_0x19dd('0x37')]));_0x40e850[_0x19dd('0x35')]=_0x40e850['attributes'][_0x19dd('0x38')]?_0x40e850['attributes']:_0x51b192[_0x19dd('0x34')];_0x40e850['order']=qs['sort'](_0x5b3498[_0x19dd('0x32')][_0x19dd('0x3c')]);_0x40e850[_0x19dd('0x3d')]=qs[_0x19dd('0x33')](_['pick'](_0x5b3498['query'],_0x51b192[_0x19dd('0x33')]));if(_0x5b3498['query'][_0x19dd('0x3f')]){_0x40e850[_0x19dd('0x3d')]=_[_0x19dd('0x40')](_0x40e850[_0x19dd('0x3d')],{'$or':_['map'](_0x40e850[_0x19dd('0x35')],function(_0x627648){var _0x5c86c9={};_0x5c86c9[_0x627648]={'$like':'%'+_0x5b3498['query']['filter']+'%'};return _0x5c86c9;})});}_0x40e850=_['merge']({},_0x40e850,_0x5b3498['options']);return _0x2eb13b[_0x19dd('0x4f')](_0x40e850);}})[_0x19dd('0x27')](function(_0x2752d7){if(_0x2752d7){_0x3b965e=_0x2752d7[_0x19dd('0x38')];if(!_0x5b3498['query'][_0x19dd('0x39')](_0x19dd('0x3a'))){_0x40e850['limit']=qs[_0x19dd('0x1f')](_0x5b3498[_0x19dd('0x32')][_0x19dd('0x1f')]);_0x40e850[_0x19dd('0x1d')]=qs[_0x19dd('0x1d')](_0x5b3498[_0x19dd('0x32')][_0x19dd('0x1d')]);}return _0x2eb13b[_0x19dd('0x4f')](_0x40e850);}})['then'](function(_0x11a3e7){if(_0x11a3e7){return _0x11a3e7?{'count':_0x3b965e,'rows':_0x11a3e7}:null;}})['then'](respondWithResult(_0xda5773,null))[_0x19dd('0x47')](handleError(_0xda5773,null));};exports['getDescriptions']=function(_0x206f10,_0x2ae82b,_0x3adefb){var _0x3d5a58={};var _0x5839ef={};var _0x477088;var _0x36f88b;return db[_0x19dd('0x43')][_0x19dd('0x4c')]({'where':{'id':_0x206f10[_0x19dd('0x48')]['id']}})[_0x19dd('0x27')](handleEntityNotFound(_0x2ae82b,null))['then'](function(_0x2d80bd){if(_0x2d80bd){_0x477088=_0x2d80bd;_0x5839ef[_0x19dd('0x34')]=_[_0x19dd('0x31')](db[_0x19dd('0x4d')][_0x19dd('0x2e')]);_0x5839ef['query']=_[_0x19dd('0x31')](_0x206f10[_0x19dd('0x32')]);_0x5839ef['filters']=_['intersection'](_0x5839ef[_0x19dd('0x34')],_0x5839ef['query']);_0x3d5a58[_0x19dd('0x35')]=_[_0x19dd('0x36')](_0x5839ef['model'],qs[_0x19dd('0x37')](_0x206f10[_0x19dd('0x32')][_0x19dd('0x37')]));_0x3d5a58[_0x19dd('0x35')]=_0x3d5a58['attributes'][_0x19dd('0x38')]?_0x3d5a58[_0x19dd('0x35')]:_0x5839ef['model'];_0x3d5a58[_0x19dd('0x3b')]=qs[_0x19dd('0x3c')](_0x206f10['query']['sort']);_0x3d5a58[_0x19dd('0x3d')]=qs[_0x19dd('0x33')](_[_0x19dd('0x3e')](_0x206f10[_0x19dd('0x32')],_0x5839ef[_0x19dd('0x33')]));if(_0x206f10[_0x19dd('0x32')][_0x19dd('0x3f')]){_0x3d5a58['where']=_[_0x19dd('0x40')](_0x3d5a58['where'],{'$or':_[_0x19dd('0x2d')](_0x3d5a58[_0x19dd('0x35')],function(_0x2e8a48){var _0x3d2bbb={};_0x3d2bbb[_0x2e8a48]={'$like':'%'+_0x206f10[_0x19dd('0x32')][_0x19dd('0x3f')]+'%'};return _0x3d2bbb;})});}_0x3d5a58=_[_0x19dd('0x40')]({},_0x3d5a58,_0x206f10[_0x19dd('0x42')]);return _0x477088[_0x19dd('0x50')](_0x3d5a58);}})[_0x19dd('0x27')](function(_0x3f9048){if(_0x3f9048){_0x36f88b=_0x3f9048[_0x19dd('0x38')];if(!_0x206f10[_0x19dd('0x32')][_0x19dd('0x39')](_0x19dd('0x3a'))){_0x3d5a58['limit']=qs[_0x19dd('0x1f')](_0x206f10[_0x19dd('0x32')][_0x19dd('0x1f')]);_0x3d5a58[_0x19dd('0x1d')]=qs['offset'](_0x206f10[_0x19dd('0x32')][_0x19dd('0x1d')]);}return _0x477088[_0x19dd('0x50')](_0x3d5a58);}})[_0x19dd('0x27')](function(_0x426b2d){if(_0x426b2d){return _0x426b2d?{'count':_0x36f88b,'rows':_0x426b2d}:null;}})['then'](respondWithResult(_0x2ae82b,null))[_0x19dd('0x47')](handleError(_0x2ae82b,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index d676b75..6359033 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 _0x04b8=['define','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x49d641,_0x5d4770){var _0x25aad5=function(_0x31984a){while(--_0x31984a){_0x49d641['push'](_0x49d641['shift']());}};_0x25aad5(++_0x5d4770);}(_0x04b8,0xb6));var _0x804b=function(_0x13a1fa,_0x2eac1b){_0x13a1fa=_0x13a1fa-0x0;var _0x33d0b9=_0x04b8[_0x13a1fa];return _0x33d0b9;};'use strict';var _=require(_0x804b('0x0'));var util=require(_0x804b('0x1'));var logger=require(_0x804b('0x2'))(_0x804b('0x3'));var moment=require(_0x804b('0x4'));var BPromise=require(_0x804b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x804b('0x6'));var rimraf=require(_0x804b('0x7'));var config=require('../../config/environment');var attributes=require('./intSalesforceConfiguration.attributes');module['exports']=function(_0x5d17e0,_0x5782fb){return _0x5d17e0[_0x804b('0x8')]('SalesforceConfiguration',attributes,{'tableName':_0x804b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc106=['rimraf','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x19f406,_0x59f4cf){var _0x4c6c74=function(_0x26a52f){while(--_0x26a52f){_0x19f406['push'](_0x19f406['shift']());}};_0x4c6c74(++_0x59f4cf);}(_0xc106,0x1a6));var _0x6c10=function(_0x43d34e,_0x50d0ff){_0x43d34e=_0x43d34e-0x0;var _0x10127a=_0xc106[_0x43d34e];return _0x10127a;};'use strict';var _=require(_0x6c10('0x0'));var util=require(_0x6c10('0x1'));var logger=require(_0x6c10('0x2'))('api');var moment=require(_0x6c10('0x3'));var BPromise=require(_0x6c10('0x4'));var rp=require(_0x6c10('0x5'));var fs=require('fs');var path=require(_0x6c10('0x6'));var rimraf=require(_0x6c10('0x7'));var config=require('../../config/environment');var attributes=require('./intSalesforceConfiguration.attributes');module['exports']=function(_0x441d40,_0x497d54){return _0x441d40[_0x6c10('0x8')](_0x6c10('0x9'),attributes,{'tableName':_0x6c10('0xa'),'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 90661b9..c16ccc7 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 _0xb9ea=['error','code','message','result','catch','lodash','util','moment','ioredis','../../config/utils','jayson/promise','request','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3a0a99,_0x5e07f2){var _0x4b04e2=function(_0x2af4a8){while(--_0x2af4a8){_0x3a0a99['push'](_0x3a0a99['shift']());}};_0x4b04e2(++_0x5e07f2);}(_0xb9ea,0x1eb));var _0xab9e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb9ea[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xab9e('0x0'));var util=require(_0xab9e('0x1'));var moment=require(_0xab9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xab9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xab9e('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xab9e('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xe8f268,_0x38cf88,_0x21c3ec){return new BPromise(function(_0x4dbe9a,_0x32f188){return client[_0xab9e('0x6')](_0xe8f268,_0x21c3ec)['then'](function(_0x5c3bb8){logger[_0xab9e('0x7')](_0xab9e('0x8'),_0x38cf88,'request\x20sent');logger[_0xab9e('0x9')](_0xab9e('0xa'),_0x38cf88,_0xab9e('0xb'),JSON[_0xab9e('0xc')](_0x5c3bb8));if(_0x5c3bb8['error']){if(_0x5c3bb8[_0xab9e('0xd')][_0xab9e('0xe')]===0x1f4){logger[_0xab9e('0xd')](_0xab9e('0x8'),_0x38cf88,_0x5c3bb8[_0xab9e('0xd')][_0xab9e('0xf')]);return _0x32f188(_0x5c3bb8['error'][_0xab9e('0xf')]);}logger[_0xab9e('0xd')](_0xab9e('0x8'),_0x38cf88,_0x5c3bb8['error'][_0xab9e('0xf')]);return _0x4dbe9a(_0x5c3bb8['error'][_0xab9e('0xf')]);}else{logger[_0xab9e('0x7')]('SalesforceConfiguration,\x20%s,\x20%s',_0x38cf88,_0xab9e('0xb'));_0x4dbe9a(_0x5c3bb8[_0xab9e('0x10')][_0xab9e('0xf')]);}})[_0xab9e('0x11')](function(_0x2c1c2f){logger[_0xab9e('0xd')](_0xab9e('0x8'),_0x38cf88,_0x2c1c2f);_0x32f188(_0x2c1c2f);});});} \ No newline at end of file +var _0xee69=['debug','stringify','error','code','message','result','catch','util','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x11deef,_0x34bbdb){var _0xe9ba85=function(_0x591377){while(--_0x591377){_0x11deef['push'](_0x11deef['shift']());}};_0xe9ba85(++_0x34bbdb);}(_0xee69,0x115));var _0x9ee6=function(_0x36e3a9,_0x259dd0){_0x36e3a9=_0x36e3a9-0x0;var _0x92f5c4=_0xee69[_0x36e3a9];return _0x92f5c4;};'use strict';var _=require('lodash');var util=require(_0x9ee6('0x0'));var moment=require('moment');var BPromise=require(_0x9ee6('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9ee6('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9ee6('0x3'))('rpc');var config=require(_0x9ee6('0x4'));var jayson=require(_0x9ee6('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x11d642,_0x52fcf9,_0x17038f){return new BPromise(function(_0x2dfdcc,_0x66997){return client[_0x9ee6('0x6')](_0x11d642,_0x17038f)[_0x9ee6('0x7')](function(_0x1911ac){logger[_0x9ee6('0x8')](_0x9ee6('0x9'),_0x52fcf9,_0x9ee6('0xa'));logger[_0x9ee6('0xb')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x52fcf9,_0x9ee6('0xa'),JSON[_0x9ee6('0xc')](_0x1911ac));if(_0x1911ac[_0x9ee6('0xd')]){if(_0x1911ac[_0x9ee6('0xd')][_0x9ee6('0xe')]===0x1f4){logger['error'](_0x9ee6('0x9'),_0x52fcf9,_0x1911ac['error']['message']);return _0x66997(_0x1911ac[_0x9ee6('0xd')]['message']);}logger[_0x9ee6('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x52fcf9,_0x1911ac['error'][_0x9ee6('0xf')]);return _0x2dfdcc(_0x1911ac[_0x9ee6('0xd')][_0x9ee6('0xf')]);}else{logger[_0x9ee6('0x8')](_0x9ee6('0x9'),_0x52fcf9,_0x9ee6('0xa'));_0x2dfdcc(_0x1911ac[_0x9ee6('0x10')][_0x9ee6('0xf')]);}})[_0x9ee6('0x11')](function(_0x4eaa73){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x52fcf9,_0x4eaa73);_0x66997(_0x4eaa73);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 8dc0033..ab106ea 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 _0x894c=['path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','get','index','show','post','isAuthenticated','/:id','update','exports','multer','util'];(function(_0x39f6d6,_0x556810){var _0x38b1ee=function(_0x51196c){while(--_0x51196c){_0x39f6d6['push'](_0x39f6d6['shift']());}};_0x38b1ee(++_0x556810);}(_0x894c,0xde));var _0xc894=function(_0x2bbd7c,_0xd5a7f){_0x2bbd7c=_0x2bbd7c-0x0;var _0x351708=_0x894c[_0x2bbd7c];return _0x351708;};'use strict';var multer=require(_0xc894('0x0'));var util=require(_0xc894('0x1'));var path=require(_0xc894('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc894('0x3')]();var fs_extra=require(_0xc894('0x4'));var auth=require(_0xc894('0x5'));var interaction=require(_0xc894('0x6'));var config=require('../../config/environment');var controller=require(_0xc894('0x7'));router[_0xc894('0x8')]('/',auth['isAuthenticated'](),controller[_0xc894('0x9')]);router[_0xc894('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xc894('0xa')]);router[_0xc894('0xb')]('/',auth[_0xc894('0xc')](),controller['create']);router['put'](_0xc894('0xd'),auth[_0xc894('0xc')](),controller[_0xc894('0xe')]);router['delete'](_0xc894('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xc894('0xf')]=router; \ No newline at end of file +var _0x7fff=['index','post','create','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x27a62d,_0x4bab75){var _0x492cee=function(_0x1ed5a7){while(--_0x1ed5a7){_0x27a62d['push'](_0x27a62d['shift']());}};_0x492cee(++_0x4bab75);}(_0x7fff,0x1cf));var _0xf7ff=function(_0x591486,_0x230ff2){_0x591486=_0x591486-0x0;var _0x59e96a=_0x7fff[_0x591486];return _0x59e96a;};'use strict';var multer=require(_0xf7ff('0x0'));var util=require(_0xf7ff('0x1'));var path=require(_0xf7ff('0x2'));var timeout=require(_0xf7ff('0x3'));var express=require(_0xf7ff('0x4'));var router=express[_0xf7ff('0x5')]();var fs_extra=require(_0xf7ff('0x6'));var auth=require(_0xf7ff('0x7'));var interaction=require(_0xf7ff('0x8'));var config=require(_0xf7ff('0x9'));var controller=require('./intSalesforceField.controller');router[_0xf7ff('0xa')]('/',auth[_0xf7ff('0xb')](),controller[_0xf7ff('0xc')]);router['get']('/:id',auth[_0xf7ff('0xb')](),controller['show']);router[_0xf7ff('0xd')]('/',auth['isAuthenticated'](),controller[_0xf7ff('0xe')]);router['put'](_0xf7ff('0xf'),auth[_0xf7ff('0xb')](),controller[_0xf7ff('0x10')]);router[_0xf7ff('0x11')](_0xf7ff('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0xf7ff('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 5d3b33f..1053996 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 _0x51cc=['string','variable','keyValue','STRING','sequelize','exports','ENUM'];(function(_0x23055f,_0x22a833){var _0x31bd9d=function(_0x4dc9df){while(--_0x4dc9df){_0x23055f['push'](_0x23055f['shift']());}};_0x31bd9d(++_0x22a833);}(_0x51cc,0x131));var _0xc51c=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x51cc[_0x36eaaa];return _0x461349;};'use strict';var Sequelize=require(_0xc51c('0x0'));module[_0xc51c('0x1')]={'type':{'type':Sequelize[_0xc51c('0x2')](_0xc51c('0x3'),_0xc51c('0x4'),'customVariable',_0xc51c('0x5'),'picklist'),'defaultValue':_0xc51c('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xc51c('0x3'),_0xc51c('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xc51c('0x6')]},'idField':{'type':Sequelize[_0xc51c('0x6')]},'variableName':{'type':Sequelize[_0xc51c('0x6')]}}; \ No newline at end of file +var _0xf9c5=['variable','sequelize','exports','ENUM','string','customVariable','keyValue','picklist','STRING'];(function(_0x17641a,_0x5a8685){var _0x8bce90=function(_0x4323f0){while(--_0x4323f0){_0x17641a['push'](_0x17641a['shift']());}};_0x8bce90(++_0x5a8685);}(_0xf9c5,0xac));var _0x5f9c=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xf9c5[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0x5f9c('0x0'));module[_0x5f9c('0x1')]={'type':{'type':Sequelize[_0x5f9c('0x2')](_0x5f9c('0x3'),'variable',_0x5f9c('0x4'),_0x5f9c('0x5'),_0x5f9c('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x5f9c('0x7')]},'key':{'type':Sequelize[_0x5f9c('0x7')]},'keyType':{'type':Sequelize[_0x5f9c('0x2')](_0x5f9c('0x3'),_0x5f9c('0x8'),'customVariable')},'keyContent':{'type':Sequelize[_0x5f9c('0x7')]},'idField':{'type':Sequelize[_0x5f9c('0x7')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 7fbb957..8523768 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 _0x1e4e=['sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','destroy','then','error','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','rows','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x2ba259,_0x50301b){var _0x5c249d=function(_0x390443){while(--_0x390443){_0x2ba259['push'](_0x2ba259['shift']());}};_0x5c249d(++_0x50301b);}(_0x1e4e,0x79));var _0xe1e4=function(_0x4a7e4d,_0x1a68b9){_0x4a7e4d=_0x4a7e4d-0x0;var _0x2b5790=_0x1e4e[_0x4a7e4d];return _0x2b5790;};'use strict';var emlformat=require(_0xe1e4('0x0'));var rimraf=require(_0xe1e4('0x1'));var zipdir=require(_0xe1e4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe1e4('0x3'));var moment=require(_0xe1e4('0x4'));var BPromise=require(_0xe1e4('0x5'));var Mustache=require('mustache');var util=require(_0xe1e4('0x6'));var path=require(_0xe1e4('0x7'));var sox=require(_0xe1e4('0x8'));var csv=require(_0xe1e4('0x9'));var ejs=require(_0xe1e4('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe1e4('0xb'));var crypto=require('crypto');var jsforce=require(_0xe1e4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe1e4('0x9'));var querystring=require('querystring');var Papa=require(_0xe1e4('0xd'));var Redis=require('ioredis');var authService=require(_0xe1e4('0xe'));var qs=require(_0xe1e4('0xf'));var as=require(_0xe1e4('0x10'));var hardwareService=require(_0xe1e4('0x11'));var logger=require('../../config/logger')(_0xe1e4('0x12'));var utils=require(_0xe1e4('0x13'));var config=require(_0xe1e4('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52b58e,_0x579ed4){_0x579ed4=_0x579ed4||0xcc;return function(_0x4d372c){if(_0x4d372c){return _0x52b58e[_0xe1e4('0x15')](_0x579ed4);}return _0x52b58e[_0xe1e4('0x16')](_0x579ed4)[_0xe1e4('0x17')]();};}function respondWithResult(_0x515589,_0x90ff95){_0x90ff95=_0x90ff95||0xc8;return function(_0x26fbe2){if(_0x26fbe2){return _0x515589[_0xe1e4('0x16')](_0x90ff95)[_0xe1e4('0x18')](_0x26fbe2);}};}function respondWithFilteredResult(_0x54709d,_0x16ebab){return function(_0x4a5dca){if(_0x4a5dca){var _0x93abb1=typeof _0x16ebab[_0xe1e4('0x19')]===_0xe1e4('0x1a')&&typeof _0x16ebab['limit']===_0xe1e4('0x1a');var _0x4433f9=_0x4a5dca[_0xe1e4('0x1b')];var _0x52239b=_0x93abb1?0x0:_0x16ebab[_0xe1e4('0x19')];var _0x41bb1f=_0x93abb1?_0x4a5dca[_0xe1e4('0x1b')]:_0x16ebab['offset']+_0x16ebab[_0xe1e4('0x1c')];var _0x3ea9e0;if(_0x41bb1f>=_0x4433f9){_0x41bb1f=_0x4433f9;_0x3ea9e0=0xc8;}else{_0x3ea9e0=0xce;}_0x54709d['status'](_0x3ea9e0);return _0x54709d[_0xe1e4('0x1d')](_0xe1e4('0x1e'),_0x52239b+'-'+_0x41bb1f+'/'+_0x4433f9)[_0xe1e4('0x18')](_0x4a5dca);}return null;};}function patchUpdates(_0x5870ce){return function(_0x3b1b1c){try{jsonpatch[_0xe1e4('0x1f')](_0x3b1b1c,_0x5870ce,!![]);}catch(_0xef687b){return BPromise['reject'](_0xef687b);}return _0x3b1b1c['save']();};}function saveUpdates(_0x308358,_0x5b21fd){return function(_0x920b17){if(_0x920b17){return _0x920b17[_0xe1e4('0x20')](_0x308358)['then'](function(_0x41bd28){return _0x41bd28;});}return null;};}function removeEntity(_0xdc18ce,_0x5a5c1e){return function(_0x52f27f){if(_0x52f27f){return _0x52f27f[_0xe1e4('0x21')]()[_0xe1e4('0x22')](function(){_0xdc18ce[_0xe1e4('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bf2ad,_0x43d3c3){return function(_0x15fb63){if(!_0x15fb63){_0x4bf2ad['sendStatus'](0x194);}return _0x15fb63;};}function handleError(_0x26ba71,_0x4b0123){_0x4b0123=_0x4b0123||0x1f4;return function(_0xb312c3){logger[_0xe1e4('0x23')](_0xb312c3['stack']);if(_0xb312c3[_0xe1e4('0x24')]){delete _0xb312c3[_0xe1e4('0x24')];}_0x26ba71[_0xe1e4('0x16')](_0x4b0123)[_0xe1e4('0x25')](_0xb312c3);};}exports[_0xe1e4('0x26')]=function(_0x124b07,_0x4150b2){var _0xd6ad6c={},_0x3c7b16={},_0x6cf68a={'count':0x0,'rows':[]};var _0x4cf728=_[_0xe1e4('0x27')](db[_0xe1e4('0x28')][_0xe1e4('0x29')],function(_0x5ca244){return{'name':_0x5ca244[_0xe1e4('0x2a')],'type':_0x5ca244[_0xe1e4('0x2b')][_0xe1e4('0x2c')]};});_0x3c7b16[_0xe1e4('0x2d')]=_[_0xe1e4('0x27')](_0x4cf728,_0xe1e4('0x24'));_0x3c7b16['query']=_[_0xe1e4('0x2e')](_0x124b07['query']);_0x3c7b16[_0xe1e4('0x2f')]=_['intersection'](_0x3c7b16['model'],_0x3c7b16[_0xe1e4('0x30')]);_0xd6ad6c[_0xe1e4('0x31')]=_[_0xe1e4('0x32')](_0x3c7b16[_0xe1e4('0x2d')],qs[_0xe1e4('0x33')](_0x124b07[_0xe1e4('0x30')][_0xe1e4('0x33')]));_0xd6ad6c[_0xe1e4('0x31')]=_0xd6ad6c[_0xe1e4('0x31')][_0xe1e4('0x34')]?_0xd6ad6c[_0xe1e4('0x31')]:_0x3c7b16[_0xe1e4('0x2d')];if(!_0x124b07[_0xe1e4('0x30')][_0xe1e4('0x35')](_0xe1e4('0x36'))){_0xd6ad6c[_0xe1e4('0x1c')]=qs['limit'](_0x124b07[_0xe1e4('0x30')][_0xe1e4('0x1c')]);_0xd6ad6c[_0xe1e4('0x19')]=qs[_0xe1e4('0x19')](_0x124b07['query'][_0xe1e4('0x19')]);}_0xd6ad6c[_0xe1e4('0x37')]=qs[_0xe1e4('0x38')](_0x124b07['query']['sort']);_0xd6ad6c[_0xe1e4('0x39')]=qs[_0xe1e4('0x2f')](_[_0xe1e4('0x3a')](_0x124b07[_0xe1e4('0x30')],_0x3c7b16[_0xe1e4('0x2f')]),_0x4cf728);if(_0x124b07[_0xe1e4('0x30')][_0xe1e4('0x3b')]){_0xd6ad6c[_0xe1e4('0x39')]=_[_0xe1e4('0x3c')](_0xd6ad6c[_0xe1e4('0x39')],{'$or':_['map'](_0x4cf728,function(_0x5d8413){if(_0x5d8413['type']!=='VIRTUAL'){var _0x25fccc={};_0x25fccc[_0x5d8413[_0xe1e4('0x24')]]={'$like':'%'+_0x124b07[_0xe1e4('0x30')][_0xe1e4('0x3b')]+'%'};return _0x25fccc;}})});}_0xd6ad6c=_['merge']({},_0xd6ad6c,_0x124b07[_0xe1e4('0x3d')]);var _0x32a703={'where':_0xd6ad6c['where']};return db[_0xe1e4('0x28')][_0xe1e4('0x1b')](_0x32a703)[_0xe1e4('0x22')](function(_0x5afc1b){_0x6cf68a[_0xe1e4('0x1b')]=_0x5afc1b;if(_0x124b07[_0xe1e4('0x30')]['includeAll']){_0xd6ad6c[_0xe1e4('0x3e')]=[{'all':!![]}];}return db['SalesforceField']['findAll'](_0xd6ad6c);})[_0xe1e4('0x22')](function(_0x59046f){_0x6cf68a[_0xe1e4('0x3f')]=_0x59046f;return _0x6cf68a;})[_0xe1e4('0x22')](respondWithFilteredResult(_0x4150b2,_0xd6ad6c))[_0xe1e4('0x40')](handleError(_0x4150b2,null));};exports[_0xe1e4('0x41')]=function(_0x5696be,_0x126b9e){var _0x1d2cbb={'raw':!![],'where':{'id':_0x5696be[_0xe1e4('0x42')]['id']}},_0xad7141={};_0xad7141[_0xe1e4('0x2d')]=_[_0xe1e4('0x2e')](db['SalesforceField'][_0xe1e4('0x29')]);_0xad7141[_0xe1e4('0x30')]=_[_0xe1e4('0x2e')](_0x5696be[_0xe1e4('0x30')]);_0xad7141['filters']=_[_0xe1e4('0x32')](_0xad7141['model'],_0xad7141[_0xe1e4('0x30')]);_0x1d2cbb[_0xe1e4('0x31')]=_[_0xe1e4('0x32')](_0xad7141['model'],qs[_0xe1e4('0x33')](_0x5696be[_0xe1e4('0x30')][_0xe1e4('0x33')]));_0x1d2cbb['attributes']=_0x1d2cbb[_0xe1e4('0x31')][_0xe1e4('0x34')]?_0x1d2cbb[_0xe1e4('0x31')]:_0xad7141[_0xe1e4('0x2d')];if(_0x5696be[_0xe1e4('0x30')][_0xe1e4('0x43')]){_0x1d2cbb[_0xe1e4('0x3e')]=[{'all':!![]}];}_0x1d2cbb=_[_0xe1e4('0x3c')]({},_0x1d2cbb,_0x5696be[_0xe1e4('0x3d')]);return db[_0xe1e4('0x28')][_0xe1e4('0x44')](_0x1d2cbb)[_0xe1e4('0x22')](handleEntityNotFound(_0x126b9e,null))[_0xe1e4('0x22')](respondWithResult(_0x126b9e,null))['catch'](handleError(_0x126b9e,null));};exports[_0xe1e4('0x45')]=function(_0x440e5e,_0x228a4d){return db[_0xe1e4('0x28')][_0xe1e4('0x45')](_0x440e5e[_0xe1e4('0x46')],{})[_0xe1e4('0x22')](respondWithResult(_0x228a4d,0xc9))['catch'](handleError(_0x228a4d,null));};exports[_0xe1e4('0x20')]=function(_0x3ffce1,_0x36e60d){if(_0x3ffce1['body']['id']){delete _0x3ffce1['body']['id'];}return db[_0xe1e4('0x28')][_0xe1e4('0x44')]({'where':{'id':_0x3ffce1[_0xe1e4('0x42')]['id']}})['then'](handleEntityNotFound(_0x36e60d,null))[_0xe1e4('0x22')](saveUpdates(_0x3ffce1[_0xe1e4('0x46')],null))[_0xe1e4('0x22')](respondWithResult(_0x36e60d,null))[_0xe1e4('0x40')](handleError(_0x36e60d,null));};exports[_0xe1e4('0x21')]=function(_0x1e6c0c,_0x20384d){return db[_0xe1e4('0x28')]['find']({'where':{'id':_0x1e6c0c['params']['id']}})['then'](handleEntityNotFound(_0x20384d,null))[_0xe1e4('0x22')](removeEntity(_0x20384d,null))[_0xe1e4('0x40')](handleError(_0x20384d,null));}; \ No newline at end of file +var _0xcb30=['show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcb30,0x186));var _0x0cb3=function(_0x244f56,_0x21e76b){_0x244f56=_0x244f56-0x0;var _0x1e16b1=_0xcb30[_0x244f56];return _0x1e16b1;};'use strict';var emlformat=require(_0x0cb3('0x0'));var rimraf=require(_0x0cb3('0x1'));var zipdir=require(_0x0cb3('0x2'));var jsonpatch=require(_0x0cb3('0x3'));var rp=require('request-promise');var moment=require(_0x0cb3('0x4'));var BPromise=require(_0x0cb3('0x5'));var Mustache=require('mustache');var util=require(_0x0cb3('0x6'));var path=require(_0x0cb3('0x7'));var sox=require(_0x0cb3('0x8'));var csv=require(_0x0cb3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0cb3('0xa'));var _=require('lodash');var squel=require(_0x0cb3('0xb'));var crypto=require(_0x0cb3('0xc'));var jsforce=require(_0x0cb3('0xd'));var deskjs=require(_0x0cb3('0xe'));var toCsv=require(_0x0cb3('0x9'));var querystring=require(_0x0cb3('0xf'));var Papa=require(_0x0cb3('0x10'));var Redis=require(_0x0cb3('0x11'));var authService=require(_0x0cb3('0x12'));var qs=require(_0x0cb3('0x13'));var as=require(_0x0cb3('0x14'));var hardwareService=require(_0x0cb3('0x15'));var logger=require(_0x0cb3('0x16'))(_0x0cb3('0x17'));var utils=require(_0x0cb3('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0cb3('0x19'))['db'];function respondWithStatusCode(_0x5e180a,_0x6096f4){_0x6096f4=_0x6096f4||0xcc;return function(_0x73eea1){if(_0x73eea1){return _0x5e180a[_0x0cb3('0x1a')](_0x6096f4);}return _0x5e180a[_0x0cb3('0x1b')](_0x6096f4)[_0x0cb3('0x1c')]();};}function respondWithResult(_0x2decd4,_0x1ed003){_0x1ed003=_0x1ed003||0xc8;return function(_0x1e1089){if(_0x1e1089){return _0x2decd4['status'](_0x1ed003)[_0x0cb3('0x1d')](_0x1e1089);}};}function respondWithFilteredResult(_0x566da9,_0x290793){return function(_0x8b269b){if(_0x8b269b){var _0x4165c0=typeof _0x290793[_0x0cb3('0x1e')]===_0x0cb3('0x1f')&&typeof _0x290793[_0x0cb3('0x20')]==='undefined';var _0x55326c=_0x8b269b['count'];var _0x335091=_0x4165c0?0x0:_0x290793['offset'];var _0x55b25c=_0x4165c0?_0x8b269b[_0x0cb3('0x21')]:_0x290793[_0x0cb3('0x1e')]+_0x290793[_0x0cb3('0x20')];var _0x289a67;if(_0x55b25c>=_0x55326c){_0x55b25c=_0x55326c;_0x289a67=0xc8;}else{_0x289a67=0xce;}_0x566da9['status'](_0x289a67);return _0x566da9[_0x0cb3('0x22')](_0x0cb3('0x23'),_0x335091+'-'+_0x55b25c+'/'+_0x55326c)[_0x0cb3('0x1d')](_0x8b269b);}return null;};}function patchUpdates(_0x2d487e){return function(_0x2f3bee){try{jsonpatch[_0x0cb3('0x24')](_0x2f3bee,_0x2d487e,!![]);}catch(_0x144426){return BPromise[_0x0cb3('0x25')](_0x144426);}return _0x2f3bee[_0x0cb3('0x26')]();};}function saveUpdates(_0x14d017,_0x47aa43){return function(_0x2121e7){if(_0x2121e7){return _0x2121e7[_0x0cb3('0x27')](_0x14d017)[_0x0cb3('0x28')](function(_0x66dc00){return _0x66dc00;});}return null;};}function removeEntity(_0x3bd23c,_0x3e2aa2){return function(_0x16161e){if(_0x16161e){return _0x16161e[_0x0cb3('0x29')]()[_0x0cb3('0x28')](function(){_0x3bd23c['status'](0xcc)[_0x0cb3('0x1c')]();});}};}function handleEntityNotFound(_0xf3847b,_0x51ed40){return function(_0x447b9d){if(!_0x447b9d){_0xf3847b[_0x0cb3('0x1a')](0x194);}return _0x447b9d;};}function handleError(_0x2c1494,_0x7cdcb9){_0x7cdcb9=_0x7cdcb9||0x1f4;return function(_0x27eb6d){logger[_0x0cb3('0x2a')](_0x27eb6d['stack']);if(_0x27eb6d[_0x0cb3('0x2b')]){delete _0x27eb6d['name'];}_0x2c1494[_0x0cb3('0x1b')](_0x7cdcb9)[_0x0cb3('0x2c')](_0x27eb6d);};}exports['index']=function(_0x22c59b,_0x9b8528){var _0x3e1364={},_0x2da988={},_0x200130={'count':0x0,'rows':[]};var _0x3e0d09=_[_0x0cb3('0x2d')](db[_0x0cb3('0x2e')][_0x0cb3('0x2f')],function(_0x36e605){return{'name':_0x36e605[_0x0cb3('0x30')],'type':_0x36e605[_0x0cb3('0x31')][_0x0cb3('0x32')]};});_0x2da988[_0x0cb3('0x33')]=_[_0x0cb3('0x2d')](_0x3e0d09,_0x0cb3('0x2b'));_0x2da988[_0x0cb3('0x34')]=_[_0x0cb3('0x35')](_0x22c59b['query']);_0x2da988[_0x0cb3('0x36')]=_[_0x0cb3('0x37')](_0x2da988[_0x0cb3('0x33')],_0x2da988[_0x0cb3('0x34')]);_0x3e1364['attributes']=_[_0x0cb3('0x37')](_0x2da988[_0x0cb3('0x33')],qs['fields'](_0x22c59b[_0x0cb3('0x34')][_0x0cb3('0x38')]));_0x3e1364[_0x0cb3('0x39')]=_0x3e1364[_0x0cb3('0x39')]['length']?_0x3e1364[_0x0cb3('0x39')]:_0x2da988[_0x0cb3('0x33')];if(!_0x22c59b['query'][_0x0cb3('0x3a')]('nolimit')){_0x3e1364[_0x0cb3('0x20')]=qs[_0x0cb3('0x20')](_0x22c59b[_0x0cb3('0x34')][_0x0cb3('0x20')]);_0x3e1364['offset']=qs[_0x0cb3('0x1e')](_0x22c59b[_0x0cb3('0x34')][_0x0cb3('0x1e')]);}_0x3e1364[_0x0cb3('0x3b')]=qs['sort'](_0x22c59b['query'][_0x0cb3('0x3c')]);_0x3e1364[_0x0cb3('0x3d')]=qs['filters'](_[_0x0cb3('0x3e')](_0x22c59b[_0x0cb3('0x34')],_0x2da988[_0x0cb3('0x36')]),_0x3e0d09);if(_0x22c59b[_0x0cb3('0x34')][_0x0cb3('0x3f')]){_0x3e1364['where']=_[_0x0cb3('0x40')](_0x3e1364['where'],{'$or':_['map'](_0x3e0d09,function(_0x508855){if(_0x508855[_0x0cb3('0x31')]!==_0x0cb3('0x41')){var _0x4fc867={};_0x4fc867[_0x508855[_0x0cb3('0x2b')]]={'$like':'%'+_0x22c59b[_0x0cb3('0x34')][_0x0cb3('0x3f')]+'%'};return _0x4fc867;}})});}_0x3e1364=_[_0x0cb3('0x40')]({},_0x3e1364,_0x22c59b[_0x0cb3('0x42')]);var _0xacf413={'where':_0x3e1364[_0x0cb3('0x3d')]};return db[_0x0cb3('0x2e')][_0x0cb3('0x21')](_0xacf413)['then'](function(_0x2a9047){_0x200130['count']=_0x2a9047;if(_0x22c59b[_0x0cb3('0x34')][_0x0cb3('0x43')]){_0x3e1364[_0x0cb3('0x44')]=[{'all':!![]}];}return db['SalesforceField'][_0x0cb3('0x45')](_0x3e1364);})['then'](function(_0xd2852e){_0x200130[_0x0cb3('0x46')]=_0xd2852e;return _0x200130;})[_0x0cb3('0x28')](respondWithFilteredResult(_0x9b8528,_0x3e1364))[_0x0cb3('0x47')](handleError(_0x9b8528,null));};exports[_0x0cb3('0x48')]=function(_0xd709f,_0x16c09e){var _0x55adeb={'raw':!![],'where':{'id':_0xd709f[_0x0cb3('0x49')]['id']}},_0x51f329={};_0x51f329[_0x0cb3('0x33')]=_[_0x0cb3('0x35')](db[_0x0cb3('0x2e')]['rawAttributes']);_0x51f329[_0x0cb3('0x34')]=_['keys'](_0xd709f[_0x0cb3('0x34')]);_0x51f329[_0x0cb3('0x36')]=_[_0x0cb3('0x37')](_0x51f329[_0x0cb3('0x33')],_0x51f329['query']);_0x55adeb[_0x0cb3('0x39')]=_['intersection'](_0x51f329[_0x0cb3('0x33')],qs[_0x0cb3('0x38')](_0xd709f[_0x0cb3('0x34')][_0x0cb3('0x38')]));_0x55adeb[_0x0cb3('0x39')]=_0x55adeb[_0x0cb3('0x39')]['length']?_0x55adeb[_0x0cb3('0x39')]:_0x51f329[_0x0cb3('0x33')];if(_0xd709f['query'][_0x0cb3('0x43')]){_0x55adeb['include']=[{'all':!![]}];}_0x55adeb=_['merge']({},_0x55adeb,_0xd709f[_0x0cb3('0x42')]);return db[_0x0cb3('0x2e')][_0x0cb3('0x4a')](_0x55adeb)[_0x0cb3('0x28')](handleEntityNotFound(_0x16c09e,null))['then'](respondWithResult(_0x16c09e,null))[_0x0cb3('0x47')](handleError(_0x16c09e,null));};exports[_0x0cb3('0x4b')]=function(_0x1254b3,_0x203c45){return db[_0x0cb3('0x2e')]['create'](_0x1254b3['body'],{})[_0x0cb3('0x28')](respondWithResult(_0x203c45,0xc9))[_0x0cb3('0x47')](handleError(_0x203c45,null));};exports[_0x0cb3('0x27')]=function(_0x19ffb8,_0x29668f){if(_0x19ffb8[_0x0cb3('0x4c')]['id']){delete _0x19ffb8[_0x0cb3('0x4c')]['id'];}return db[_0x0cb3('0x2e')][_0x0cb3('0x4a')]({'where':{'id':_0x19ffb8[_0x0cb3('0x49')]['id']}})[_0x0cb3('0x28')](handleEntityNotFound(_0x29668f,null))[_0x0cb3('0x28')](saveUpdates(_0x19ffb8[_0x0cb3('0x4c')],null))[_0x0cb3('0x28')](respondWithResult(_0x29668f,null))[_0x0cb3('0x47')](handleError(_0x29668f,null));};exports['destroy']=function(_0x411f44,_0x16e4c4){return db['SalesforceField'][_0x0cb3('0x4a')]({'where':{'id':_0x411f44[_0x0cb3('0x49')]['id']}})['then'](handleEntityNotFound(_0x16e4c4,null))['then'](removeEntity(_0x16e4c4,null))['catch'](handleError(_0x16e4c4,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index f008ce4..189cfa9 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 _0x60a7=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x60a7,0xe0));var _0x760a=function(_0x4169e6,_0x21e53b){_0x4169e6=_0x4169e6-0x0;var _0x40d18c=_0x60a7[_0x4169e6];return _0x40d18c;};'use strict';var _=require(_0x760a('0x0'));var util=require(_0x760a('0x1'));var logger=require(_0x760a('0x2'))('api');var moment=require(_0x760a('0x3'));var BPromise=require(_0x760a('0x4'));var rp=require(_0x760a('0x5'));var fs=require('fs');var path=require(_0x760a('0x6'));var rimraf=require(_0x760a('0x7'));var config=require(_0x760a('0x8'));var attributes=require(_0x760a('0x9'));module['exports']=function(_0x209793,_0x4c8fa6){return _0x209793['define'](_0x760a('0xa'),attributes,{'tableName':_0x760a('0xb'),'paranoid':![],'indexes':[{'name':_0x760a('0xc'),'fields':[_0x760a('0xd'),_0x760a('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb3ca=['FieldId','lodash','util','api','bluebird','request-promise','path','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','idField'];(function(_0x463e29,_0xfc1e0c){var _0x4a09ad=function(_0x1a684c){while(--_0x1a684c){_0x463e29['push'](_0x463e29['shift']());}};_0x4a09ad(++_0xfc1e0c);}(_0xb3ca,0x1e2));var _0xab3c=function(_0x12f59c,_0x13d956){_0x12f59c=_0x12f59c-0x0;var _0x2db43e=_0xb3ca[_0x12f59c];return _0x2db43e;};'use strict';var _=require(_0xab3c('0x0'));var util=require(_0xab3c('0x1'));var logger=require('../../config/logger')(_0xab3c('0x2'));var moment=require('moment');var BPromise=require(_0xab3c('0x3'));var rp=require(_0xab3c('0x4'));var fs=require('fs');var path=require(_0xab3c('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xab3c('0x6'));module[_0xab3c('0x7')]=function(_0x5d1786,_0x721e2c){return _0x5d1786[_0xab3c('0x8')](_0xab3c('0x9'),attributes,{'tableName':_0xab3c('0xa'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0xab3c('0xb'),_0xab3c('0xc')],'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 d720ee8..6a0cb14 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 _0xb2dd=['http','request','then','info','SalesforceField,\x20%s,\x20%s','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x44d45c,_0x4b0046){var _0x4b1388=function(_0x17e325){while(--_0x17e325){_0x44d45c['push'](_0x44d45c['shift']());}};_0x4b1388(++_0x4b0046);}(_0xb2dd,0x89));var _0xdb2d=function(_0x20b18f,_0xf29421){_0x20b18f=_0x20b18f-0x0;var _0x510ea8=_0xb2dd[_0x20b18f];return _0x510ea8;};'use strict';var _=require(_0xdb2d('0x0'));var util=require(_0xdb2d('0x1'));var moment=require(_0xdb2d('0x2'));var BPromise=require(_0xdb2d('0x3'));var rs=require(_0xdb2d('0x4'));var fs=require('fs');var Redis=require(_0xdb2d('0x5'));var db=require(_0xdb2d('0x6'))['db'];var utils=require(_0xdb2d('0x7'));var logger=require(_0xdb2d('0x8'))(_0xdb2d('0x9'));var config=require(_0xdb2d('0xa'));var jayson=require(_0xdb2d('0xb'));var client=jayson[_0xdb2d('0xc')][_0xdb2d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x23cde0,_0x528ef8,_0x375540){return new BPromise(function(_0x1f0d16,_0x1e7ccc){return client[_0xdb2d('0xe')](_0x23cde0,_0x375540)[_0xdb2d('0xf')](function(_0xdada24){logger[_0xdb2d('0x10')](_0xdb2d('0x11'),_0x528ef8,'request\x20sent');logger[_0xdb2d('0x12')](_0xdb2d('0x13'),_0x528ef8,'request\x20sent',JSON[_0xdb2d('0x14')](_0xdada24));if(_0xdada24[_0xdb2d('0x15')]){if(_0xdada24['error']['code']===0x1f4){logger['error'](_0xdb2d('0x11'),_0x528ef8,_0xdada24['error'][_0xdb2d('0x16')]);return _0x1e7ccc(_0xdada24[_0xdb2d('0x15')]['message']);}logger[_0xdb2d('0x15')](_0xdb2d('0x11'),_0x528ef8,_0xdada24[_0xdb2d('0x15')][_0xdb2d('0x16')]);return _0x1f0d16(_0xdada24[_0xdb2d('0x15')][_0xdb2d('0x16')]);}else{logger[_0xdb2d('0x10')](_0xdb2d('0x11'),_0x528ef8,_0xdb2d('0x17'));_0x1f0d16(_0xdada24[_0xdb2d('0x18')][_0xdb2d('0x16')]);}})['catch'](function(_0x54c006){logger[_0xdb2d('0x15')](_0xdb2d('0x11'),_0x528ef8,_0x54c006);_0x1e7ccc(_0x54c006);});});} \ No newline at end of file +var _0x86ab=['debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','message','SalesforceField,\x20%s,\x20%s','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info'];(function(_0x5af410,_0x4e9ee4){var _0x170c35=function(_0x57c0f6){while(--_0x57c0f6){_0x5af410['push'](_0x5af410['shift']());}};_0x170c35(++_0x4e9ee4);}(_0x86ab,0xfe));var _0xb86a=function(_0xb59ef6,_0x2221d5){_0xb59ef6=_0xb59ef6-0x0;var _0x4f6528=_0x86ab[_0xb59ef6];return _0x4f6528;};'use strict';var _=require(_0xb86a('0x0'));var util=require(_0xb86a('0x1'));var moment=require('moment');var BPromise=require(_0xb86a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb86a('0x3'));var db=require(_0xb86a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb86a('0x5'))(_0xb86a('0x6'));var config=require('../../config/environment');var jayson=require(_0xb86a('0x7'));var client=jayson[_0xb86a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2eb18d,_0x35793d,_0x41b2df){return new BPromise(function(_0x4811be,_0x49c405){return client[_0xb86a('0x9')](_0x2eb18d,_0x41b2df)[_0xb86a('0xa')](function(_0x211a48){logger[_0xb86a('0xb')]('SalesforceField,\x20%s,\x20%s',_0x35793d,'request\x20sent');logger[_0xb86a('0xc')](_0xb86a('0xd'),_0x35793d,'request\x20sent',JSON['stringify'](_0x211a48));if(_0x211a48[_0xb86a('0xe')]){if(_0x211a48[_0xb86a('0xe')][_0xb86a('0xf')]===0x1f4){logger[_0xb86a('0xe')]('SalesforceField,\x20%s,\x20%s',_0x35793d,_0x211a48[_0xb86a('0xe')]['message']);return _0x49c405(_0x211a48['error'][_0xb86a('0x10')]);}logger[_0xb86a('0xe')](_0xb86a('0x11'),_0x35793d,_0x211a48[_0xb86a('0xe')]['message']);return _0x4811be(_0x211a48['error'][_0xb86a('0x10')]);}else{logger[_0xb86a('0xb')](_0xb86a('0x11'),_0x35793d,'request\x20sent');_0x4811be(_0x211a48[_0xb86a('0x12')][_0xb86a('0x10')]);}})['catch'](function(_0x46aca3){logger[_0xb86a('0xe')]('SalesforceField,\x20%s,\x20%s',_0x35793d,_0x46aca3);_0x49c405(_0x46aca3);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index abdac36..9fa66b5 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 _0x01e1=['delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intServicenowAccount.controller','isAuthenticated','index','/:id','show','get','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x01e1,0xff));var _0x101e=function(_0x34fea1,_0xce12e8){_0x34fea1=_0x34fea1-0x0;var _0x5d8bb7=_0x01e1[_0x34fea1];return _0x5d8bb7;};'use strict';var multer=require(_0x101e('0x0'));var util=require(_0x101e('0x1'));var path=require(_0x101e('0x2'));var timeout=require(_0x101e('0x3'));var express=require(_0x101e('0x4'));var router=express[_0x101e('0x5')]();var fs_extra=require(_0x101e('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x101e('0x7'));var controller=require(_0x101e('0x8'));router['get']('/',auth[_0x101e('0x9')](),controller[_0x101e('0xa')]);router['get'](_0x101e('0xb'),auth[_0x101e('0x9')](),controller[_0x101e('0xc')]);router[_0x101e('0xd')](_0x101e('0xe'),auth[_0x101e('0x9')](),controller[_0x101e('0xf')]);router['get'](_0x101e('0x10'),auth[_0x101e('0x9')](),controller['getFields']);router[_0x101e('0x11')]('/',auth[_0x101e('0x9')](),controller[_0x101e('0x12')]);router[_0x101e('0x11')](_0x101e('0xe'),auth['isAuthenticated'](),controller[_0x101e('0x13')]);router['put'](_0x101e('0xb'),auth[_0x101e('0x9')](),controller[_0x101e('0x14')]);router[_0x101e('0x15')](_0x101e('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x101e('0x16')]=router; \ No newline at end of file +var _0xe802=['./intServicenowAccount.controller','get','isAuthenticated','index','/:id','getConfigurations','/:id/fields','getFields','post','/:id/configurations','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x29771f,_0x1189ae){var _0x279baf=function(_0xd66325){while(--_0xd66325){_0x29771f['push'](_0x29771f['shift']());}};_0x279baf(++_0x1189ae);}(_0xe802,0xc2));var _0x2e80=function(_0x20c9cb,_0x125b0b){_0x20c9cb=_0x20c9cb-0x0;var _0x2fdae3=_0xe802[_0x20c9cb];return _0x2fdae3;};'use strict';var multer=require('multer');var util=require(_0x2e80('0x0'));var path=require('path');var timeout=require(_0x2e80('0x1'));var express=require(_0x2e80('0x2'));var router=express[_0x2e80('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2e80('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2e80('0x5'));var controller=require(_0x2e80('0x6'));router[_0x2e80('0x7')]('/',auth[_0x2e80('0x8')](),controller[_0x2e80('0x9')]);router[_0x2e80('0x7')](_0x2e80('0xa'),auth[_0x2e80('0x8')](),controller['show']);router['get']('/:id/configurations',auth[_0x2e80('0x8')](),controller[_0x2e80('0xb')]);router[_0x2e80('0x7')](_0x2e80('0xc'),auth[_0x2e80('0x8')](),controller[_0x2e80('0xd')]);router[_0x2e80('0xe')]('/',auth[_0x2e80('0x8')](),controller['create']);router[_0x2e80('0xe')](_0x2e80('0xf'),auth[_0x2e80('0x8')](),controller['addConfiguration']);router['put'](_0x2e80('0xa'),auth[_0x2e80('0x8')](),controller[_0x2e80('0x10')]);router[_0x2e80('0x11')]('/:id',auth[_0x2e80('0x8')](),controller[_0x2e80('0x12')]);module[_0x2e80('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 8a8c783..39db3f8 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 _0x856c=['STRING','username','remoteUri','exports'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x856c,0x1ef));var _0xc856=function(_0x517dee,_0x1b0340){_0x517dee=_0x517dee-0x0;var _0x109f5e=_0x856c[_0x517dee];return _0x109f5e;};'use strict';var Sequelize=require('sequelize');module[_0xc856('0x0')]={'name':{'type':Sequelize[_0xc856('0x1')]},'description':{'type':Sequelize[_0xc856('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xc856('0x2')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xc856('0x1')]},'remoteUri':{'type':Sequelize[_0xc856('0x1')],'unique':_0xc856('0x3')},'serverUrl':{'type':Sequelize[_0xc856('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xbba8=['remoteUri','STRING','username'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0xbba8,0x1c6));var _0x8bba=function(_0x5d3f4c,_0x2e1411){_0x5d3f4c=_0x5d3f4c-0x0;var _0x2f1440=_0xbba8[_0x5d3f4c];return _0x2f1440;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8bba('0x0')]},'description':{'type':Sequelize[_0x8bba('0x0')]},'username':{'type':Sequelize['STRING'],'unique':_0x8bba('0x1')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x8bba('0x0')],'unique':_0x8bba('0x2')},'serverUrl':{'type':Sequelize[_0x8bba('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index de665b3..63a8922 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 _0x9661=['find','getConfigurations','findOne','ServicenowConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','create','ServicenowField','getFields','made_sla','hold_reason','subcategory','notify','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','resolved_by','opened_by','user_input','sys_created_on','state','sys_created_by','calendar_stc','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','time_worked','expected_start','opened_at','business_duration','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','close_code','correlation_display','delivery_task','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','parent_incident','reopened_by','incident_state','urgency','problem_id','company','activity_due','comments','sla_due','approval','comments_and_work_notes','sys_mod_count','sys_tags','escalation','correlation_id','location','username','email','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','password','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','all','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','ServiceNow\x20error:\x20','test','statusCode','error','Wrong\x20credentials','boolean','True','true','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','save','update','destroy','stack','name','send','map','ServicenowAccount','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','then','rows','catch','params','keys','length','include','body'];(function(_0x10011d,_0x323714){var _0x5c39d7=function(_0x1cee59){while(--_0x1cee59){_0x10011d['push'](_0x10011d['shift']());}};_0x5c39d7(++_0x323714);}(_0x9661,0x1eb));var _0x1966=function(_0x3300ed,_0x5cc822){_0x3300ed=_0x3300ed-0x0;var _0x3f5395=_0x9661[_0x3300ed];return _0x3f5395;};'use strict';var emlformat=require(_0x1966('0x0'));var rimraf=require(_0x1966('0x1'));var zipdir=require(_0x1966('0x2'));var jsonpatch=require(_0x1966('0x3'));var rp=require(_0x1966('0x4'));var moment=require(_0x1966('0x5'));var BPromise=require(_0x1966('0x6'));var Mustache=require(_0x1966('0x7'));var util=require(_0x1966('0x8'));var path=require(_0x1966('0x9'));var sox=require(_0x1966('0xa'));var csv=require(_0x1966('0xb'));var ejs=require(_0x1966('0xc'));var fs=require('fs');var fs_extra=require(_0x1966('0xd'));var _=require(_0x1966('0xe'));var squel=require(_0x1966('0xf'));var crypto=require(_0x1966('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x1966('0x11'));var toCsv=require(_0x1966('0xb'));var querystring=require('querystring');var Papa=require(_0x1966('0x12'));var Redis=require(_0x1966('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x1966('0x14'));var as=require(_0x1966('0x15'));var hardwareService=require(_0x1966('0x16'));var logger=require(_0x1966('0x17'))(_0x1966('0x18'));var utils=require(_0x1966('0x19'));var config=require(_0x1966('0x1a'));var licenseUtil=require(_0x1966('0x1b'));var db=require(_0x1966('0x1c'))['db'];var integrations=require(_0x1966('0x1d'));function respondWithStatusCode(_0x1a3286,_0x5b99d6){_0x5b99d6=_0x5b99d6||0xcc;return function(_0x2c8743){if(_0x2c8743){return _0x1a3286[_0x1966('0x1e')](_0x5b99d6);}return _0x1a3286[_0x1966('0x1f')](_0x5b99d6)['end']();};}function respondWithResult(_0x56e202,_0x405dea){_0x405dea=_0x405dea||0xc8;return function(_0x50685f){if(_0x50685f){return _0x56e202[_0x1966('0x1f')](_0x405dea)[_0x1966('0x20')](_0x50685f);}};}function respondWithFilteredResult(_0x372092,_0x329fb8){return function(_0x1e2234){if(_0x1e2234){var _0x8ec253=typeof _0x329fb8[_0x1966('0x21')]===_0x1966('0x22')&&typeof _0x329fb8['limit']===_0x1966('0x22');var _0x46e77d=_0x1e2234[_0x1966('0x23')];var _0x50405d=_0x8ec253?0x0:_0x329fb8[_0x1966('0x21')];var _0x574ce0=_0x8ec253?_0x1e2234[_0x1966('0x23')]:_0x329fb8[_0x1966('0x21')]+_0x329fb8[_0x1966('0x24')];var _0x577305;if(_0x574ce0>=_0x46e77d){_0x574ce0=_0x46e77d;_0x577305=0xc8;}else{_0x577305=0xce;}_0x372092[_0x1966('0x1f')](_0x577305);return _0x372092[_0x1966('0x25')]('Content-Range',_0x50405d+'-'+_0x574ce0+'/'+_0x46e77d)[_0x1966('0x20')](_0x1e2234);}return null;};}function patchUpdates(_0x1e0344){return function(_0xfe0fea){try{jsonpatch[_0x1966('0x26')](_0xfe0fea,_0x1e0344,!![]);}catch(_0x41e6cb){return BPromise[_0x1966('0x27')](_0x41e6cb);}return _0xfe0fea[_0x1966('0x28')]();};}function saveUpdates(_0x2d94eb,_0x144e0c){return function(_0xe59668){if(_0xe59668){return _0xe59668[_0x1966('0x29')](_0x2d94eb)['then'](function(_0x4e0ab0){return _0x4e0ab0;});}return null;};}function removeEntity(_0x4d2ef6,_0x41896b){return function(_0x219b43){if(_0x219b43){return _0x219b43[_0x1966('0x2a')]()['then'](function(){_0x4d2ef6[_0x1966('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ed1bc,_0x5c8113){return function(_0x5474fd){if(!_0x5474fd){_0x5ed1bc['sendStatus'](0x194);}return _0x5474fd;};}function handleError(_0x5babb3,_0x4d01b8){_0x4d01b8=_0x4d01b8||0x1f4;return function(_0x2cdd31){logger['error'](_0x2cdd31[_0x1966('0x2b')]);if(_0x2cdd31[_0x1966('0x2c')]){delete _0x2cdd31[_0x1966('0x2c')];}_0x5babb3[_0x1966('0x1f')](_0x4d01b8)[_0x1966('0x2d')](_0x2cdd31);};}exports['index']=function(_0x1d8313,_0x4c8b14){var _0x4d1bf7={},_0x2cacb3={},_0x5b8ac0={'count':0x0,'rows':[]};var _0x26d701=_[_0x1966('0x2e')](db[_0x1966('0x2f')][_0x1966('0x30')],function(_0x1ffef1){return{'name':_0x1ffef1[_0x1966('0x31')],'type':_0x1ffef1[_0x1966('0x32')]['key']};});_0x2cacb3['model']=_[_0x1966('0x2e')](_0x26d701,'name');_0x2cacb3[_0x1966('0x33')]=_['keys'](_0x1d8313[_0x1966('0x33')]);_0x2cacb3[_0x1966('0x34')]=_[_0x1966('0x35')](_0x2cacb3[_0x1966('0x36')],_0x2cacb3[_0x1966('0x33')]);_0x4d1bf7[_0x1966('0x37')]=_[_0x1966('0x35')](_0x2cacb3['model'],qs[_0x1966('0x38')](_0x1d8313[_0x1966('0x33')][_0x1966('0x38')]));_0x4d1bf7[_0x1966('0x37')]=_0x4d1bf7[_0x1966('0x37')]['length']?_0x4d1bf7[_0x1966('0x37')]:_0x2cacb3[_0x1966('0x36')];if(!_0x1d8313['query']['hasOwnProperty'](_0x1966('0x39'))){_0x4d1bf7[_0x1966('0x24')]=qs[_0x1966('0x24')](_0x1d8313[_0x1966('0x33')][_0x1966('0x24')]);_0x4d1bf7[_0x1966('0x21')]=qs[_0x1966('0x21')](_0x1d8313[_0x1966('0x33')][_0x1966('0x21')]);}_0x4d1bf7[_0x1966('0x3a')]=qs[_0x1966('0x3b')](_0x1d8313[_0x1966('0x33')][_0x1966('0x3b')]);_0x4d1bf7[_0x1966('0x3c')]=qs[_0x1966('0x34')](_[_0x1966('0x3d')](_0x1d8313[_0x1966('0x33')],_0x2cacb3[_0x1966('0x34')]),_0x26d701);if(_0x1d8313['query'][_0x1966('0x3e')]){_0x4d1bf7[_0x1966('0x3c')]=_[_0x1966('0x3f')](_0x4d1bf7[_0x1966('0x3c')],{'$or':_[_0x1966('0x2e')](_0x26d701,function(_0x461ee5){if(_0x461ee5[_0x1966('0x32')]!==_0x1966('0x40')){var _0x129127={};_0x129127[_0x461ee5[_0x1966('0x2c')]]={'$like':'%'+_0x1d8313[_0x1966('0x33')][_0x1966('0x3e')]+'%'};return _0x129127;}})});}_0x4d1bf7=_[_0x1966('0x3f')]({},_0x4d1bf7,_0x1d8313[_0x1966('0x41')]);var _0xd8c074={'where':_0x4d1bf7[_0x1966('0x3c')]};return db[_0x1966('0x2f')][_0x1966('0x23')](_0xd8c074)['then'](function(_0x503fb3){_0x5b8ac0[_0x1966('0x23')]=_0x503fb3;if(_0x1d8313[_0x1966('0x33')][_0x1966('0x42')]){_0x4d1bf7['include']=[{'all':!![]}];}return db[_0x1966('0x2f')][_0x1966('0x43')](_0x4d1bf7);})[_0x1966('0x44')](function(_0x648395){_0x5b8ac0[_0x1966('0x45')]=_0x648395;return _0x5b8ac0;})['then'](respondWithFilteredResult(_0x4c8b14,_0x4d1bf7))[_0x1966('0x46')](handleError(_0x4c8b14,null));};exports['show']=function(_0x367b21,_0x2e4872){var _0x576ab4={'raw':![],'where':{'id':_0x367b21[_0x1966('0x47')]['id']}},_0x2e2ab5={};_0x2e2ab5['model']=_[_0x1966('0x48')](db[_0x1966('0x2f')][_0x1966('0x30')]);_0x2e2ab5[_0x1966('0x33')]=_[_0x1966('0x48')](_0x367b21[_0x1966('0x33')]);_0x2e2ab5[_0x1966('0x34')]=_[_0x1966('0x35')](_0x2e2ab5['model'],_0x2e2ab5[_0x1966('0x33')]);_0x576ab4[_0x1966('0x37')]=_['intersection'](_0x2e2ab5[_0x1966('0x36')],qs[_0x1966('0x38')](_0x367b21['query'][_0x1966('0x38')]));_0x576ab4[_0x1966('0x37')]=_0x576ab4['attributes'][_0x1966('0x49')]?_0x576ab4[_0x1966('0x37')]:_0x2e2ab5[_0x1966('0x36')];if(_0x367b21['query'][_0x1966('0x42')]){_0x576ab4[_0x1966('0x4a')]=[{'all':!![]}];}_0x576ab4=_[_0x1966('0x3f')]({},_0x576ab4,_0x367b21[_0x1966('0x41')]);return db[_0x1966('0x2f')]['find'](_0x576ab4)[_0x1966('0x44')](handleEntityNotFound(_0x2e4872,null))['then'](respondWithResult(_0x2e4872,null))[_0x1966('0x46')](handleError(_0x2e4872,null));};exports['create']=function(_0x4a2e49,_0x41b4c2){return db[_0x1966('0x2f')]['create'](_0x4a2e49[_0x1966('0x4b')],{})[_0x1966('0x44')](respondWithResult(_0x41b4c2,0xc9))[_0x1966('0x46')](handleError(_0x41b4c2,null));};exports['update']=function(_0x150465,_0x1556d2){if(_0x150465[_0x1966('0x4b')]['id']){delete _0x150465[_0x1966('0x4b')]['id'];}return db[_0x1966('0x2f')][_0x1966('0x4c')]({'where':{'id':_0x150465[_0x1966('0x47')]['id']}})[_0x1966('0x44')](handleEntityNotFound(_0x1556d2,null))[_0x1966('0x44')](saveUpdates(_0x150465[_0x1966('0x4b')],null))['then'](respondWithResult(_0x1556d2,null))['catch'](handleError(_0x1556d2,null));};exports[_0x1966('0x2a')]=function(_0x4fa065,_0x359bdc){return db[_0x1966('0x2f')][_0x1966('0x4c')]({'where':{'id':_0x4fa065[_0x1966('0x47')]['id']}})[_0x1966('0x44')](handleEntityNotFound(_0x359bdc,null))[_0x1966('0x44')](removeEntity(_0x359bdc,null))[_0x1966('0x46')](handleError(_0x359bdc,null));};exports[_0x1966('0x4d')]=function(_0x2b9d25,_0x430414,_0x5a83c7){var _0x43ad65={};var _0x52dade={};var _0x9b6ad9;var _0x21d188;return db[_0x1966('0x2f')][_0x1966('0x4e')]({'where':{'id':_0x2b9d25[_0x1966('0x47')]['id']}})[_0x1966('0x44')](handleEntityNotFound(_0x430414,null))['then'](function(_0x208537){if(_0x208537){_0x9b6ad9=_0x208537;_0x52dade['model']=_['keys'](db[_0x1966('0x4f')]['rawAttributes']);_0x52dade[_0x1966('0x33')]=_[_0x1966('0x48')](_0x2b9d25['query']);_0x52dade[_0x1966('0x34')]=_[_0x1966('0x35')](_0x52dade[_0x1966('0x36')],_0x52dade['query']);_0x43ad65[_0x1966('0x37')]=_[_0x1966('0x35')](_0x52dade[_0x1966('0x36')],qs[_0x1966('0x38')](_0x2b9d25[_0x1966('0x33')][_0x1966('0x38')]));_0x43ad65['attributes']=_0x43ad65['attributes'][_0x1966('0x49')]?_0x43ad65['attributes']:_0x52dade[_0x1966('0x36')];_0x43ad65[_0x1966('0x3a')]=qs[_0x1966('0x3b')](_0x2b9d25[_0x1966('0x33')][_0x1966('0x3b')]);_0x43ad65[_0x1966('0x3c')]=qs[_0x1966('0x34')](_['pick'](_0x2b9d25['query'],_0x52dade['filters']));if(_0x2b9d25['query'][_0x1966('0x3e')]){_0x43ad65[_0x1966('0x3c')]=_[_0x1966('0x3f')](_0x43ad65[_0x1966('0x3c')],{'$or':_[_0x1966('0x2e')](_0x43ad65['attributes'],function(_0x4c105f){var _0x3b3339={};_0x3b3339[_0x4c105f]={'$like':'%'+_0x2b9d25[_0x1966('0x33')][_0x1966('0x3e')]+'%'};return _0x3b3339;})});}_0x43ad65=_['merge']({},_0x43ad65,_0x2b9d25[_0x1966('0x41')]);return _0x9b6ad9[_0x1966('0x4d')](_0x43ad65);}})[_0x1966('0x44')](function(_0x404bcf){if(_0x404bcf){_0x21d188=_0x404bcf['length'];if(!_0x2b9d25[_0x1966('0x33')][_0x1966('0x50')](_0x1966('0x39'))){_0x43ad65[_0x1966('0x24')]=qs[_0x1966('0x24')](_0x2b9d25['query'][_0x1966('0x24')]);_0x43ad65[_0x1966('0x21')]=qs[_0x1966('0x21')](_0x2b9d25['query'][_0x1966('0x21')]);}return _0x9b6ad9[_0x1966('0x4d')](_0x43ad65);}})[_0x1966('0x44')](function(_0x20f541){if(_0x20f541){return _0x20f541?{'count':_0x21d188,'rows':_0x20f541}:null;}})[_0x1966('0x44')](respondWithResult(_0x430414,null))[_0x1966('0x46')](handleError(_0x430414,null));};exports[_0x1966('0x51')]=function(_0x1870ab,_0xf0687a,_0x1faf13){if(_0x1870ab[_0x1966('0x4b')]['id']){delete _0x1870ab[_0x1966('0x4b')]['id'];}return db[_0x1966('0x2f')][_0x1966('0x4e')]({'where':{'id':_0x1870ab['params']['id']}})['then'](handleEntityNotFound(_0xf0687a,null))[_0x1966('0x44')](function(_0x17a86b){if(_0x17a86b){_0x1870ab['body'][_0x1966('0x52')]=_0x17a86b['id'];_0x1870ab[_0x1966('0x4b')][_0x1966('0x53')]=integrations[_0x1966('0x54')](_0x1870ab[_0x1966('0x4b')][_0x1966('0x55')],_0x1870ab[_0x1966('0x4b')]['type']);_0x1870ab['body'][_0x1966('0x56')]=integrations[_0x1966('0x57')](_0x1870ab[_0x1966('0x4b')]['channel'],_0x1870ab[_0x1966('0x4b')][_0x1966('0x32')]);return db[_0x1966('0x4f')][_0x1966('0x58')](_0x1870ab[_0x1966('0x4b')],{'include':[{'model':db[_0x1966('0x59')],'as':'Subjects'},{'model':db[_0x1966('0x59')],'as':_0x1966('0x56')}]});}return null;})[_0x1966('0x44')](respondWithResult(_0xf0687a,null))[_0x1966('0x46')](handleError(_0xf0687a,null));};exports[_0x1966('0x5a')]=function(_0x540d7e,_0x2b1907,_0x491ea7){var _0x21dea9=[_0x1966('0x5b'),_0x1966('0x5c'),'knowledge',_0x1966('0x5d'),'close_code',_0x1966('0x5e'),'incident_state',_0x1966('0x5f'),_0x1966('0x60')];var _0x4979c3=[_0x1966('0x61'),_0x1966('0x5b'),_0x1966('0x62'),_0x1966('0x63'),_0x1966('0x64'),_0x1966('0x65'),_0x1966('0x66'),_0x1966('0x5c'),'approval_history','number',_0x1966('0x67'),'sys_updated_by',_0x1966('0x68'),_0x1966('0x69'),_0x1966('0x6a'),'sys_domain',_0x1966('0x6b'),_0x1966('0x6c'),'knowledge',_0x1966('0x3a'),_0x1966('0x6d'),'closed_at',_0x1966('0x6e'),_0x1966('0x6f'),_0x1966('0x70'),_0x1966('0x71'),_0x1966('0x72'),_0x1966('0x73'),_0x1966('0x74'),_0x1966('0x75'),'rfc',_0x1966('0x76'),_0x1966('0x77'),_0x1966('0x78'),_0x1966('0x79'),'group_list','work_end',_0x1966('0x7a'),_0x1966('0x7b'),_0x1966('0x7c'),_0x1966('0x7d'),_0x1966('0x5d'),_0x1966('0x7e'),_0x1966('0x7f'),_0x1966('0x80'),_0x1966('0x81'),_0x1966('0x82'),'work_start','assignment_group','business_stc',_0x1966('0x83'),_0x1966('0x84'),_0x1966('0x85'),_0x1966('0x5e'),_0x1966('0x86'),_0x1966('0x87'),_0x1966('0x88'),'follow_up',_0x1966('0x89'),'sys_id','contact_type',_0x1966('0x8a'),_0x1966('0x8b'),_0x1966('0x8c'),_0x1966('0x8d'),_0x1966('0x8e'),'reassignment_count',_0x1966('0x8f'),'assigned_to',_0x1966('0x5f'),_0x1966('0x90'),_0x1966('0x91'),_0x1966('0x92'),_0x1966('0x93'),'due_date',_0x1966('0x94'),'reopen_count',_0x1966('0x95'),_0x1966('0x96'),'upon_approval',_0x1966('0x97'),_0x1966('0x98'),_0x1966('0x60')];var _0x3ab70b='';var _0x48e448='';var _0x1e6a9e=[];var _0x438ac9='';var _0x108065='';var _0x70edb3=[];var _0x8e2626='';var _0x35d7b7='';var _0x554a01={};var _0x47c350='';return db[_0x1966('0x2f')][_0x1966('0x4e')]({'where':{'id':_0x540d7e[_0x1966('0x47')]['id']},'attributes':['id',_0x1966('0x99'),'password',_0x1966('0x9a'),_0x1966('0x9b'),'serverUrl']})[_0x1966('0x44')](handleEntityNotFound(_0x2b1907,null))['then'](function(_0x12e7e6){if(_0x12e7e6){_0x47c350=_0x12e7e6[_0x1966('0x9b')];var _0x1d23e1=_0x47c350[_0x1966('0x9c')](-0x1);if(_0x1d23e1==='/'){_0x47c350=_0x47c350[_0x1966('0x9d')](0x0,_0x47c350[_0x1966('0x9e')](_0x1d23e1));}_0x35d7b7=util[_0x1966('0x9f')](_0x1966('0xa0'),_0x47c350);_0x8e2626=util[_0x1966('0x9f')](_0x1966('0xa1'),_0x47c350);_0x554a01={'user':_0x12e7e6[_0x1966('0x99')],'pass':_0x12e7e6[_0x1966('0xa2')]};var _0x367e43={'method':_0x1966('0xa3'),'uri':_0x35d7b7+_0x1966('0xa4'),'auth':_0x554a01,'json':!![]};return rp(_0x367e43);}})['then'](function(_0x1dc2c1){if(_0x1dc2c1['result'][_0x1966('0x49')]>0x0){_0x3ab70b=_0x1dc2c1[_0x1966('0xa5')];}console[_0x1966('0xa6')](_0x1966('0xa7'),_0x3ab70b);_0x70edb3=[];_0x48e448=Object[_0x1966('0xa8')]([],_0x3ab70b);_[_0x1966('0xa9')](_0x48e448,function(_0x59b93b){return!_0x21dea9[_0x1966('0xaa')](_0x59b93b[_0x1966('0x2c')]);});_0x48e448[_0x1966('0xab')](function(_0x4a5962){var _0xee9b26=createFieldObject(_0x8e2626,_0x554a01,_0x4a5962[_0x1966('0xac')],_0x4a5962[_0x1966('0x2c')],_0x4a5962[_0x1966('0xad')],![]);_0x70edb3[_0x1966('0xae')](_0xee9b26);});return Promise[_0x1966('0xaf')](_0x70edb3);})[_0x1966('0x44')](function(_0x40bb1f){_0x1e6a9e=_0x40bb1f;_0x438ac9=Object['assign']([],_0x3ab70b);console[_0x1966('0xa6')]('TCL:\x20_object',_0x3ab70b);_[_0x1966('0xa9')](_0x438ac9,function(_0x626322){return _0x4979c3[_0x1966('0xaa')](_0x626322[_0x1966('0x2c')]);});console[_0x1966('0xa6')](_0x1966('0xb0'),_0x438ac9);_0x70edb3=[];_0x438ac9[_0x1966('0xab')](function(_0x501f0b){var _0x1735d8=createFieldObject(_0x8e2626,_0x554a01,_0x501f0b['internalType'],_0x501f0b['name'],_0x501f0b[_0x1966('0xad')],!![]);_0x70edb3[_0x1966('0xae')](_0x1735d8);});return Promise[_0x1966('0xaf')](_0x70edb3);})['then'](function(_0x32186c){_0x108065=_0x32186c;var _0x5a8090=_0x1e6a9e['concat'](_0x108065);return{'count':_0x5a8090[_0x1966('0x49')],'rows':_0x5a8090};})[_0x1966('0x44')](respondWithResult(_0x2b1907,null))[_0x1966('0x46')](function(_0x323539){console[_0x1966('0xa6')](_0x1966('0xb1')+_0x323539);var _0x5740cc=_0x540d7e[_0x1966('0x33')][_0x1966('0xb2')]?0x1f4:_0x323539[_0x1966('0xb3')]||0x1f4;logger[_0x1966('0xb4')](_0x323539[_0x1966('0x2b')]);delete _0x323539[_0x1966('0x2c')];if(_0x5740cc===0x191){_0x5740cc=0x190;}_0x2b1907[_0x1966('0x1f')](_0x5740cc)[_0x1966('0x2d')](_0x540d7e[_0x1966('0x33')][_0x1966('0xb2')]?{'message':_0x1966('0xb5'),'statusCode':_0x323539[_0x1966('0xb3')]}:_0x323539);});};function createFieldObject(_0x9bb174,_0x47577d,_0x35c83d,_0x50353e,_0x234a4a,_0x1bd51b){return new Promise(function(_0x260468,_0x1080d3){var _0x1fa5f4={'id':_0x50353e,'name':_0x234a4a,'custom':_0x1bd51b};if(_0x35c83d===_0x1966('0xb6')){_0x1fa5f4[_0x1966('0x41')]=[{'name':_0x1966('0xb7'),'value':_0x1966('0xb8')},{'name':'False','value':_0x1966('0xb9')}];_0x260468(_0x1fa5f4);}else{var _0x1fd983={'method':_0x1966('0xa3'),'uri':_0x9bb174+_0x1966('0xba')+_0x50353e,'auth':_0x47577d,'json':!![]};return rp(_0x1fd983)['then'](function(_0x5e105b){var _0x24c96b=[];if(_0x5e105b[_0x1966('0xa5')]['length']>0x0){_0x5e105b[_0x1966('0xa5')][_0x1966('0xab')](function(_0x8cb77b){if(_0x8cb77b[_0x1966('0xbb')]==='false'){var _0x3f1138={'name':_0x8cb77b[_0x1966('0xad')],'value':_0x8cb77b[_0x1966('0xbc')]};_0x24c96b[_0x1966('0xae')](_0x3f1138);}});}_0x1fa5f4[_0x1966('0x41')]=_0x24c96b;if(_0x1fa5f4[_0x1966('0x41')]['length']>0x0){_0x260468(_0x1fa5f4);}else{if(_0x1bd51b==![]){_0x260468();}else{_0x260468(_0x1fa5f4);}}});}});} \ No newline at end of file +var _0x70ce=['limit','count','set','Content-Range','reject','update','then','destroy','sendStatus','error','stack','name','send','ServicenowAccount','rawAttributes','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','merge','type','VIRTUAL','options','includeAll','findAll','catch','params','include','find','create','body','findOne','filter','getConfigurations','Subjects','getSubjects','channel','Descriptions','ServicenowConfiguration','getFields','made_sla','hold_reason','subcategory','close_code','notify','incident_state','caused_by','watch_list','sys_updated_on','child_incidents','number','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','knowledge','order','cmdb_ci','priority','sys_domain_path','time_worked','expected_start','business_duration','group_list','work_end','reopened_time','approval_set','short_description','correlation_display','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','closed_by','sys_id','contact_type','urgency','company','activity_due','assigned_to','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','escalation','upon_approval','correlation_id','location','category','username','password','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','incident?sysparm_display_value=all','result','incident\x20table\x20objects','assign','includes','internalType','label','all','log','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','push','test','statusCode','Wrong\x20credentials','boolean','False','false','GET','sys_choice?sysparm_query=name=incident^element=','inactive','zip-dir','fast-json-patch','bluebird','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','json','offset','undefined'];(function(_0x185698,_0x112df){var _0x2589fc=function(_0x12ca5f){while(--_0x12ca5f){_0x185698['push'](_0x185698['shift']());}};_0x2589fc(++_0x112df);}(_0x70ce,0x87));var _0xe70c=function(_0x14a1c8,_0x22b96d){_0x14a1c8=_0x14a1c8-0x0;var _0x17b2cd=_0x70ce[_0x14a1c8];return _0x17b2cd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe70c('0x0'));var jsonpatch=require(_0xe70c('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe70c('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe70c('0x3'));var sox=require('sox');var csv=require(_0xe70c('0x4'));var ejs=require(_0xe70c('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe70c('0x6'));var squel=require(_0xe70c('0x7'));var crypto=require(_0xe70c('0x8'));var jsforce=require(_0xe70c('0x9'));var deskjs=require(_0xe70c('0xa'));var toCsv=require('to-csv');var querystring=require(_0xe70c('0xb'));var Papa=require(_0xe70c('0xc'));var Redis=require(_0xe70c('0xd'));var authService=require(_0xe70c('0xe'));var qs=require(_0xe70c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe70c('0x10'));var logger=require(_0xe70c('0x11'))(_0xe70c('0x12'));var utils=require(_0xe70c('0x13'));var config=require(_0xe70c('0x14'));var licenseUtil=require(_0xe70c('0x15'));var db=require(_0xe70c('0x16'))['db'];var integrations=require(_0xe70c('0x17'));function respondWithStatusCode(_0x124f33,_0x8d5feb){_0x8d5feb=_0x8d5feb||0xcc;return function(_0x42379e){if(_0x42379e){return _0x124f33['sendStatus'](_0x8d5feb);}return _0x124f33['status'](_0x8d5feb)[_0xe70c('0x18')]();};}function respondWithResult(_0x1ef663,_0xfdb69f){_0xfdb69f=_0xfdb69f||0xc8;return function(_0x3538d3){if(_0x3538d3){return _0x1ef663[_0xe70c('0x19')](_0xfdb69f)[_0xe70c('0x1a')](_0x3538d3);}};}function respondWithFilteredResult(_0x49b04f,_0x5ce6f9){return function(_0x2eea25){if(_0x2eea25){var _0x54bc30=typeof _0x5ce6f9[_0xe70c('0x1b')]===_0xe70c('0x1c')&&typeof _0x5ce6f9[_0xe70c('0x1d')]===_0xe70c('0x1c');var _0x40c1f4=_0x2eea25['count'];var _0x4c3914=_0x54bc30?0x0:_0x5ce6f9[_0xe70c('0x1b')];var _0x5d36a5=_0x54bc30?_0x2eea25[_0xe70c('0x1e')]:_0x5ce6f9['offset']+_0x5ce6f9[_0xe70c('0x1d')];var _0x4826ed;if(_0x5d36a5>=_0x40c1f4){_0x5d36a5=_0x40c1f4;_0x4826ed=0xc8;}else{_0x4826ed=0xce;}_0x49b04f[_0xe70c('0x19')](_0x4826ed);return _0x49b04f[_0xe70c('0x1f')](_0xe70c('0x20'),_0x4c3914+'-'+_0x5d36a5+'/'+_0x40c1f4)[_0xe70c('0x1a')](_0x2eea25);}return null;};}function patchUpdates(_0x50cd89){return function(_0x552b8c){try{jsonpatch['apply'](_0x552b8c,_0x50cd89,!![]);}catch(_0x4e1879){return BPromise[_0xe70c('0x21')](_0x4e1879);}return _0x552b8c['save']();};}function saveUpdates(_0x5c09eb,_0x268ac7){return function(_0x37f791){if(_0x37f791){return _0x37f791[_0xe70c('0x22')](_0x5c09eb)[_0xe70c('0x23')](function(_0x13948a){return _0x13948a;});}return null;};}function removeEntity(_0x3d758a,_0x321657){return function(_0x4cfdcc){if(_0x4cfdcc){return _0x4cfdcc[_0xe70c('0x24')]()['then'](function(){_0x3d758a[_0xe70c('0x19')](0xcc)[_0xe70c('0x18')]();});}};}function handleEntityNotFound(_0x4f516f,_0x3159c7){return function(_0x3747f1){if(!_0x3747f1){_0x4f516f[_0xe70c('0x25')](0x194);}return _0x3747f1;};}function handleError(_0x4fdc55,_0x48aa19){_0x48aa19=_0x48aa19||0x1f4;return function(_0x3fda14){logger[_0xe70c('0x26')](_0x3fda14[_0xe70c('0x27')]);if(_0x3fda14[_0xe70c('0x28')]){delete _0x3fda14[_0xe70c('0x28')];}_0x4fdc55[_0xe70c('0x19')](_0x48aa19)[_0xe70c('0x29')](_0x3fda14);};}exports['index']=function(_0x16fdfa,_0x460b82){var _0x1da332={},_0x4e99a9={},_0x22ab1f={'count':0x0,'rows':[]};var _0x299f86=_['map'](db[_0xe70c('0x2a')][_0xe70c('0x2b')],function(_0x47edbd){return{'name':_0x47edbd['fieldName'],'type':_0x47edbd['type']['key']};});_0x4e99a9[_0xe70c('0x2c')]=_[_0xe70c('0x2d')](_0x299f86,_0xe70c('0x28'));_0x4e99a9[_0xe70c('0x2e')]=_[_0xe70c('0x2f')](_0x16fdfa['query']);_0x4e99a9[_0xe70c('0x30')]=_['intersection'](_0x4e99a9['model'],_0x4e99a9[_0xe70c('0x2e')]);_0x1da332[_0xe70c('0x31')]=_[_0xe70c('0x32')](_0x4e99a9[_0xe70c('0x2c')],qs['fields'](_0x16fdfa[_0xe70c('0x2e')][_0xe70c('0x33')]));_0x1da332['attributes']=_0x1da332[_0xe70c('0x31')][_0xe70c('0x34')]?_0x1da332[_0xe70c('0x31')]:_0x4e99a9[_0xe70c('0x2c')];if(!_0x16fdfa[_0xe70c('0x2e')][_0xe70c('0x35')](_0xe70c('0x36'))){_0x1da332[_0xe70c('0x1d')]=qs['limit'](_0x16fdfa[_0xe70c('0x2e')]['limit']);_0x1da332['offset']=qs[_0xe70c('0x1b')](_0x16fdfa['query'][_0xe70c('0x1b')]);}_0x1da332['order']=qs[_0xe70c('0x37')](_0x16fdfa[_0xe70c('0x2e')][_0xe70c('0x37')]);_0x1da332[_0xe70c('0x38')]=qs[_0xe70c('0x30')](_['pick'](_0x16fdfa['query'],_0x4e99a9[_0xe70c('0x30')]),_0x299f86);if(_0x16fdfa[_0xe70c('0x2e')]['filter']){_0x1da332[_0xe70c('0x38')]=_[_0xe70c('0x39')](_0x1da332[_0xe70c('0x38')],{'$or':_[_0xe70c('0x2d')](_0x299f86,function(_0x229907){if(_0x229907[_0xe70c('0x3a')]!==_0xe70c('0x3b')){var _0x37a3ed={};_0x37a3ed[_0x229907[_0xe70c('0x28')]]={'$like':'%'+_0x16fdfa[_0xe70c('0x2e')]['filter']+'%'};return _0x37a3ed;}})});}_0x1da332=_[_0xe70c('0x39')]({},_0x1da332,_0x16fdfa[_0xe70c('0x3c')]);var _0x2b5d00={'where':_0x1da332[_0xe70c('0x38')]};return db[_0xe70c('0x2a')][_0xe70c('0x1e')](_0x2b5d00)['then'](function(_0xc9aacb){_0x22ab1f['count']=_0xc9aacb;if(_0x16fdfa[_0xe70c('0x2e')][_0xe70c('0x3d')]){_0x1da332['include']=[{'all':!![]}];}return db[_0xe70c('0x2a')][_0xe70c('0x3e')](_0x1da332);})['then'](function(_0x528c00){_0x22ab1f['rows']=_0x528c00;return _0x22ab1f;})[_0xe70c('0x23')](respondWithFilteredResult(_0x460b82,_0x1da332))[_0xe70c('0x3f')](handleError(_0x460b82,null));};exports['show']=function(_0x20ba04,_0x158a11){var _0x1de732={'raw':![],'where':{'id':_0x20ba04[_0xe70c('0x40')]['id']}},_0x5e8336={};_0x5e8336[_0xe70c('0x2c')]=_[_0xe70c('0x2f')](db['ServicenowAccount']['rawAttributes']);_0x5e8336['query']=_[_0xe70c('0x2f')](_0x20ba04['query']);_0x5e8336[_0xe70c('0x30')]=_[_0xe70c('0x32')](_0x5e8336[_0xe70c('0x2c')],_0x5e8336[_0xe70c('0x2e')]);_0x1de732['attributes']=_[_0xe70c('0x32')](_0x5e8336['model'],qs[_0xe70c('0x33')](_0x20ba04[_0xe70c('0x2e')][_0xe70c('0x33')]));_0x1de732['attributes']=_0x1de732['attributes']['length']?_0x1de732[_0xe70c('0x31')]:_0x5e8336[_0xe70c('0x2c')];if(_0x20ba04[_0xe70c('0x2e')][_0xe70c('0x3d')]){_0x1de732[_0xe70c('0x41')]=[{'all':!![]}];}_0x1de732=_['merge']({},_0x1de732,_0x20ba04['options']);return db[_0xe70c('0x2a')][_0xe70c('0x42')](_0x1de732)['then'](handleEntityNotFound(_0x158a11,null))[_0xe70c('0x23')](respondWithResult(_0x158a11,null))[_0xe70c('0x3f')](handleError(_0x158a11,null));};exports['create']=function(_0x43d51c,_0x2f9c03){return db[_0xe70c('0x2a')][_0xe70c('0x43')](_0x43d51c[_0xe70c('0x44')],{})[_0xe70c('0x23')](respondWithResult(_0x2f9c03,0xc9))[_0xe70c('0x3f')](handleError(_0x2f9c03,null));};exports[_0xe70c('0x22')]=function(_0x448d37,_0x584bcf){if(_0x448d37[_0xe70c('0x44')]['id']){delete _0x448d37[_0xe70c('0x44')]['id'];}return db[_0xe70c('0x2a')][_0xe70c('0x42')]({'where':{'id':_0x448d37[_0xe70c('0x40')]['id']}})[_0xe70c('0x23')](handleEntityNotFound(_0x584bcf,null))[_0xe70c('0x23')](saveUpdates(_0x448d37['body'],null))[_0xe70c('0x23')](respondWithResult(_0x584bcf,null))[_0xe70c('0x3f')](handleError(_0x584bcf,null));};exports[_0xe70c('0x24')]=function(_0x19927b,_0xa3ab1c){return db['ServicenowAccount']['find']({'where':{'id':_0x19927b['params']['id']}})['then'](handleEntityNotFound(_0xa3ab1c,null))[_0xe70c('0x23')](removeEntity(_0xa3ab1c,null))[_0xe70c('0x3f')](handleError(_0xa3ab1c,null));};exports['getConfigurations']=function(_0x548a62,_0x3357b4,_0x320f2e){var _0xba185={};var _0x4ab7d2={};var _0x332934;var _0x5e54b8;return db[_0xe70c('0x2a')][_0xe70c('0x45')]({'where':{'id':_0x548a62[_0xe70c('0x40')]['id']}})[_0xe70c('0x23')](handleEntityNotFound(_0x3357b4,null))[_0xe70c('0x23')](function(_0x505bcb){if(_0x505bcb){_0x332934=_0x505bcb;_0x4ab7d2[_0xe70c('0x2c')]=_[_0xe70c('0x2f')](db['ServicenowConfiguration']['rawAttributes']);_0x4ab7d2[_0xe70c('0x2e')]=_[_0xe70c('0x2f')](_0x548a62[_0xe70c('0x2e')]);_0x4ab7d2[_0xe70c('0x30')]=_[_0xe70c('0x32')](_0x4ab7d2[_0xe70c('0x2c')],_0x4ab7d2[_0xe70c('0x2e')]);_0xba185[_0xe70c('0x31')]=_[_0xe70c('0x32')](_0x4ab7d2[_0xe70c('0x2c')],qs[_0xe70c('0x33')](_0x548a62[_0xe70c('0x2e')][_0xe70c('0x33')]));_0xba185[_0xe70c('0x31')]=_0xba185[_0xe70c('0x31')][_0xe70c('0x34')]?_0xba185[_0xe70c('0x31')]:_0x4ab7d2[_0xe70c('0x2c')];_0xba185['order']=qs[_0xe70c('0x37')](_0x548a62[_0xe70c('0x2e')][_0xe70c('0x37')]);_0xba185[_0xe70c('0x38')]=qs[_0xe70c('0x30')](_['pick'](_0x548a62[_0xe70c('0x2e')],_0x4ab7d2[_0xe70c('0x30')]));if(_0x548a62[_0xe70c('0x2e')]['filter']){_0xba185['where']=_[_0xe70c('0x39')](_0xba185[_0xe70c('0x38')],{'$or':_['map'](_0xba185[_0xe70c('0x31')],function(_0x662aa6){var _0x31ee30={};_0x31ee30[_0x662aa6]={'$like':'%'+_0x548a62[_0xe70c('0x2e')][_0xe70c('0x46')]+'%'};return _0x31ee30;})});}_0xba185=_[_0xe70c('0x39')]({},_0xba185,_0x548a62[_0xe70c('0x3c')]);return _0x332934['getConfigurations'](_0xba185);}})[_0xe70c('0x23')](function(_0x2eda07){if(_0x2eda07){_0x5e54b8=_0x2eda07[_0xe70c('0x34')];if(!_0x548a62[_0xe70c('0x2e')][_0xe70c('0x35')]('nolimit')){_0xba185[_0xe70c('0x1d')]=qs[_0xe70c('0x1d')](_0x548a62[_0xe70c('0x2e')]['limit']);_0xba185['offset']=qs[_0xe70c('0x1b')](_0x548a62[_0xe70c('0x2e')]['offset']);}return _0x332934[_0xe70c('0x47')](_0xba185);}})['then'](function(_0x185bc3){if(_0x185bc3){return _0x185bc3?{'count':_0x5e54b8,'rows':_0x185bc3}:null;}})['then'](respondWithResult(_0x3357b4,null))[_0xe70c('0x3f')](handleError(_0x3357b4,null));};exports['addConfiguration']=function(_0xda9acf,_0x2f9ea5,_0x3ea873){if(_0xda9acf[_0xe70c('0x44')]['id']){delete _0xda9acf['body']['id'];}return db[_0xe70c('0x2a')][_0xe70c('0x45')]({'where':{'id':_0xda9acf[_0xe70c('0x40')]['id']}})[_0xe70c('0x23')](handleEntityNotFound(_0x2f9ea5,null))[_0xe70c('0x23')](function(_0x5eb653){if(_0x5eb653){_0xda9acf[_0xe70c('0x44')]['AccountId']=_0x5eb653['id'];_0xda9acf[_0xe70c('0x44')][_0xe70c('0x48')]=integrations[_0xe70c('0x49')](_0xda9acf['body'][_0xe70c('0x4a')],_0xda9acf[_0xe70c('0x44')][_0xe70c('0x3a')]);_0xda9acf[_0xe70c('0x44')][_0xe70c('0x4b')]=integrations['getDescriptions'](_0xda9acf[_0xe70c('0x44')][_0xe70c('0x4a')],_0xda9acf[_0xe70c('0x44')]['type']);return db[_0xe70c('0x4c')]['create'](_0xda9acf[_0xe70c('0x44')],{'include':[{'model':db['ServicenowField'],'as':_0xe70c('0x48')},{'model':db['ServicenowField'],'as':'Descriptions'}]});}return null;})[_0xe70c('0x23')](respondWithResult(_0x2f9ea5,null))[_0xe70c('0x3f')](handleError(_0x2f9ea5,null));};exports[_0xe70c('0x4d')]=function(_0x3420fe,_0x3829ba,_0xdad1e4){var _0x48494c=[_0xe70c('0x4e'),_0xe70c('0x4f'),'knowledge',_0xe70c('0x50'),_0xe70c('0x51'),_0xe70c('0x52'),_0xe70c('0x53'),'severity','category'];var _0x36b09d=['parent',_0xe70c('0x4e'),_0xe70c('0x54'),_0xe70c('0x55'),'upon_reject',_0xe70c('0x56'),_0xe70c('0x57'),'hold_reason','approval_history',_0xe70c('0x58'),'resolved_by','sys_updated_by',_0xe70c('0x59'),_0xe70c('0x5a'),_0xe70c('0x5b'),_0xe70c('0x5c'),_0xe70c('0x5d'),_0xe70c('0x5e'),_0xe70c('0x5f'),_0xe70c('0x60'),'calendar_stc','closed_at',_0xe70c('0x61'),'delivery_plan','impact','active','work_notes_list','business_service',_0xe70c('0x62'),_0xe70c('0x63'),'rfc',_0xe70c('0x64'),_0xe70c('0x65'),'opened_at',_0xe70c('0x66'),_0xe70c('0x67'),_0xe70c('0x68'),_0xe70c('0x69'),'resolved_at','caller_id',_0xe70c('0x6a'),_0xe70c('0x50'),'work_notes',_0xe70c('0x6b'),_0xe70c('0x51'),_0xe70c('0x6c'),'delivery_task','work_start',_0xe70c('0x6d'),_0xe70c('0x6e'),_0xe70c('0x6f'),_0xe70c('0x70'),_0xe70c('0x71'),_0xe70c('0x52'),_0xe70c('0x72'),'close_notes',_0xe70c('0x73'),'follow_up','parent_incident',_0xe70c('0x74'),_0xe70c('0x75'),'reopened_by',_0xe70c('0x53'),_0xe70c('0x76'),'problem_id',_0xe70c('0x77'),'reassignment_count',_0xe70c('0x78'),_0xe70c('0x79'),'severity','comments',_0xe70c('0x7a'),_0xe70c('0x7b'),_0xe70c('0x7c'),_0xe70c('0x7d'),_0xe70c('0x7e'),'reopen_count','sys_tags',_0xe70c('0x7f'),_0xe70c('0x80'),_0xe70c('0x81'),_0xe70c('0x82'),_0xe70c('0x83')];var _0x43ef02='';var _0x207be3='';var _0x6427b7=[];var _0x1c0749='';var _0x20a6c5='';var _0x1e8140=[];var _0x38d53d='';var _0x5d62bf='';var _0x5e3656={};var _0x410d52='';return db[_0xe70c('0x2a')]['findOne']({'where':{'id':_0x3420fe[_0xe70c('0x40')]['id']},'attributes':['id',_0xe70c('0x84'),_0xe70c('0x85'),'email',_0xe70c('0x86'),_0xe70c('0x87')]})[_0xe70c('0x23')](handleEntityNotFound(_0x3829ba,null))[_0xe70c('0x23')](function(_0x4c76f3){if(_0x4c76f3){_0x410d52=_0x4c76f3[_0xe70c('0x86')];var _0x6aa168=_0x410d52[_0xe70c('0x88')](-0x1);if(_0x6aa168==='/'){_0x410d52=_0x410d52[_0xe70c('0x89')](0x0,_0x410d52[_0xe70c('0x8a')](_0x6aa168));}_0x5d62bf=util[_0xe70c('0x8b')](_0xe70c('0x8c'),_0x410d52);_0x38d53d=util['format'](_0xe70c('0x8d'),_0x410d52);_0x5e3656={'user':_0x4c76f3['username'],'pass':_0x4c76f3[_0xe70c('0x85')]};var _0x284255={'method':'GET','uri':_0x5d62bf+_0xe70c('0x8e'),'auth':_0x5e3656,'json':!![]};return rp(_0x284255);}})[_0xe70c('0x23')](function(_0x4ac501){if(_0x4ac501[_0xe70c('0x8f')][_0xe70c('0x34')]>0x0){_0x43ef02=_0x4ac501[_0xe70c('0x8f')];}console['log'](_0xe70c('0x90'),_0x43ef02);_0x1e8140=[];_0x207be3=Object[_0xe70c('0x91')]([],_0x43ef02);_['remove'](_0x207be3,function(_0x370fac){return!_0x48494c[_0xe70c('0x92')](_0x370fac[_0xe70c('0x28')]);});_0x207be3['forEach'](function(_0x372ef8){var _0x56f0c9=createFieldObject(_0x38d53d,_0x5e3656,_0x372ef8[_0xe70c('0x93')],_0x372ef8[_0xe70c('0x28')],_0x372ef8[_0xe70c('0x94')],![]);_0x1e8140['push'](_0x56f0c9);});return Promise[_0xe70c('0x95')](_0x1e8140);})['then'](function(_0x18ae0e){_0x6427b7=_0x18ae0e;_0x1c0749=Object[_0xe70c('0x91')]([],_0x43ef02);console[_0xe70c('0x96')]('TCL:\x20_object',_0x43ef02);_[_0xe70c('0x97')](_0x1c0749,function(_0x35ac58){return _0x36b09d['includes'](_0x35ac58[_0xe70c('0x28')]);});console[_0xe70c('0x96')](_0xe70c('0x98'),_0x1c0749);_0x1e8140=[];_0x1c0749[_0xe70c('0x99')](function(_0x5e53ab){var _0x20370c=createFieldObject(_0x38d53d,_0x5e3656,_0x5e53ab['internalType'],_0x5e53ab[_0xe70c('0x28')],_0x5e53ab[_0xe70c('0x94')],!![]);_0x1e8140[_0xe70c('0x9a')](_0x20370c);});return Promise['all'](_0x1e8140);})[_0xe70c('0x23')](function(_0x50969f){_0x20a6c5=_0x50969f;var _0x1ede62=_0x6427b7['concat'](_0x20a6c5);return{'count':_0x1ede62[_0xe70c('0x34')],'rows':_0x1ede62};})['then'](respondWithResult(_0x3829ba,null))[_0xe70c('0x3f')](function(_0x40e0fa){console[_0xe70c('0x96')]('ServiceNow\x20error:\x20'+_0x40e0fa);var _0x1c422f=_0x3420fe[_0xe70c('0x2e')][_0xe70c('0x9b')]?0x1f4:_0x40e0fa[_0xe70c('0x9c')]||0x1f4;logger[_0xe70c('0x26')](_0x40e0fa[_0xe70c('0x27')]);delete _0x40e0fa[_0xe70c('0x28')];if(_0x1c422f===0x191){_0x1c422f=0x190;}_0x3829ba[_0xe70c('0x19')](_0x1c422f)['send'](_0x3420fe[_0xe70c('0x2e')][_0xe70c('0x9b')]?{'message':_0xe70c('0x9d'),'statusCode':_0x40e0fa[_0xe70c('0x9c')]}:_0x40e0fa);});};function createFieldObject(_0x3501ff,_0x36670d,_0xe19cfd,_0x3d7915,_0xc2aeb6,_0x4e0ba4){return new Promise(function(_0x32acdf,_0x185f6d){var _0x5238db={'id':_0x3d7915,'name':_0xc2aeb6,'custom':_0x4e0ba4};if(_0xe19cfd===_0xe70c('0x9e')){_0x5238db[_0xe70c('0x3c')]=[{'name':'True','value':'true'},{'name':_0xe70c('0x9f'),'value':_0xe70c('0xa0')}];_0x32acdf(_0x5238db);}else{var _0x36c6e9={'method':_0xe70c('0xa1'),'uri':_0x3501ff+_0xe70c('0xa2')+_0x3d7915,'auth':_0x36670d,'json':!![]};return rp(_0x36c6e9)[_0xe70c('0x23')](function(_0x5db5c7){var _0x232725=[];if(_0x5db5c7[_0xe70c('0x8f')][_0xe70c('0x34')]>0x0){_0x5db5c7[_0xe70c('0x8f')][_0xe70c('0x99')](function(_0x4260f9){if(_0x4260f9[_0xe70c('0xa3')]===_0xe70c('0xa0')){var _0x16ac78={'name':_0x4260f9['label'],'value':_0x4260f9['value']};_0x232725['push'](_0x16ac78);}});}_0x5238db[_0xe70c('0x3c')]=_0x232725;if(_0x5238db[_0xe70c('0x3c')][_0xe70c('0x34')]>0x0){_0x32acdf(_0x5238db);}else{if(_0x4e0ba4==![]){_0x32acdf();}else{_0x32acdf(_0x5238db);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 2580492..44b3d25 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 _0x5fab=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts'];(function(_0x4f386e,_0x56ffdd){var _0x4694e2=function(_0x3d16e4){while(--_0x3d16e4){_0x4f386e['push'](_0x4f386e['shift']());}};_0x4694e2(++_0x56ffdd);}(_0x5fab,0x177));var _0xb5fa=function(_0x3a607e,_0x54d530){_0x3a607e=_0x3a607e-0x0;var _0x37b106=_0x5fab[_0x3a607e];return _0x37b106;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));var integrations=require(_0xb5fa('0xa'));module[_0xb5fa('0xb')]=function(_0x4a0249,_0x5d70f6){return _0x4a0249[_0xb5fa('0xc')](_0xb5fa('0xd'),attributes,{'tableName':_0xb5fa('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x687b=['./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x7aaac2,_0x4bc922){var _0x58357a=function(_0x4c9aba){while(--_0x4c9aba){_0x7aaac2['push'](_0x7aaac2['shift']());}};_0x58357a(++_0x4bc922);}(_0x687b,0x14a));var _0xb687=function(_0x506d83,_0x1899e9){_0x506d83=_0x506d83-0x0;var _0x335e8b=_0x687b[_0x506d83];return _0x335e8b;};'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'));var integrations=require(_0xb687('0x9'));module[_0xb687('0xa')]=function(_0xf43a1f,_0x47ffea){return _0xf43a1f[_0xb687('0xb')]('ServicenowAccount',attributes,{'tableName':_0xb687('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 a60ff41..65244be 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 _0xb903=['options','raw','where','limit','map','model','attributes','include','info','GetServicenowAccount','ShowServicenowAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ServicenowAccount'];(function(_0x359beb,_0x4a4ef9){var _0xfafdc4=function(_0x1b2e81){while(--_0x1b2e81){_0x359beb['push'](_0x359beb['shift']());}};_0xfafdc4(++_0x4a4ef9);}(_0xb903,0x98));var _0x3b90=function(_0xb56659,_0x463ba7){_0xb56659=_0xb56659-0x0;var _0x249955=_0xb903[_0xb56659];return _0x249955;};'use strict';var _=require(_0x3b90('0x0'));var util=require('util');var moment=require(_0x3b90('0x1'));var BPromise=require(_0x3b90('0x2'));var rs=require(_0x3b90('0x3'));var fs=require('fs');var Redis=require(_0x3b90('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3b90('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3b90('0x6'));var jayson=require(_0x3b90('0x7'));var client=jayson[_0x3b90('0x8')][_0x3b90('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f7050,_0x3e9ac6,_0x210a73){return new BPromise(function(_0x159d9,_0x3dd69b){return client[_0x3b90('0xa')](_0x1f7050,_0x210a73)[_0x3b90('0xb')](function(_0xa379af){logger['info'](_0x3b90('0xc'),_0x3e9ac6,_0x3b90('0xd'));logger[_0x3b90('0xe')](_0x3b90('0xf'),_0x3e9ac6,_0x3b90('0xd'),JSON[_0x3b90('0x10')](_0xa379af));if(_0xa379af[_0x3b90('0x11')]){if(_0xa379af[_0x3b90('0x11')][_0x3b90('0x12')]===0x1f4){logger[_0x3b90('0x11')](_0x3b90('0xc'),_0x3e9ac6,_0xa379af[_0x3b90('0x11')]['message']);return _0x3dd69b(_0xa379af[_0x3b90('0x11')][_0x3b90('0x13')]);}logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x3e9ac6,_0xa379af[_0x3b90('0x11')][_0x3b90('0x13')]);return _0x159d9(_0xa379af['error'][_0x3b90('0x13')]);}else{logger['info'](_0x3b90('0xc'),_0x3e9ac6,_0x3b90('0xd'));_0x159d9(_0xa379af[_0x3b90('0x14')][_0x3b90('0x13')]);}})[_0x3b90('0x15')](function(_0x5e2957){logger['error'](_0x3b90('0xc'),_0x3e9ac6,_0x5e2957);_0x3dd69b(_0x5e2957);});});}exports['GetServicenowAccount']=function(_0x5723a1){var _0x33111c=this;return new Promise(function(_0x575747,_0x559eac){return db[_0x3b90('0x16')]['findAll']({'raw':_0x5723a1[_0x3b90('0x17')]?_0x5723a1[_0x3b90('0x17')][_0x3b90('0x18')]===undefined?!![]:![]:!![],'where':_0x5723a1[_0x3b90('0x17')]?_0x5723a1[_0x3b90('0x17')][_0x3b90('0x19')]||null:null,'attributes':_0x5723a1[_0x3b90('0x17')]?_0x5723a1[_0x3b90('0x17')]['attributes']||null:null,'limit':_0x5723a1[_0x3b90('0x17')]?_0x5723a1[_0x3b90('0x17')][_0x3b90('0x1a')]||null:null,'include':_0x5723a1[_0x3b90('0x17')]?_0x5723a1[_0x3b90('0x17')]['include']?_[_0x3b90('0x1b')](_0x5723a1[_0x3b90('0x17')]['include'],function(_0x5849d8){return{'model':db[_0x5849d8[_0x3b90('0x1c')]],'as':_0x5849d8['as'],'attributes':_0x5849d8[_0x3b90('0x1d')],'include':_0x5849d8[_0x3b90('0x1e')]?_[_0x3b90('0x1b')](_0x5849d8['include'],function(_0x12b51c){return{'model':db[_0x12b51c[_0x3b90('0x1c')]],'as':_0x12b51c['as'],'attributes':_0x12b51c['attributes'],'include':_0x12b51c['include']?_[_0x3b90('0x1b')](_0x12b51c['include'],function(_0x310a3c){return{'model':db[_0x310a3c['model']],'as':_0x310a3c['as'],'attributes':_0x310a3c['attributes']};}):[]};}):[]};}):[]:[]})[_0x3b90('0xb')](function(_0x5ddc95){logger[_0x3b90('0x1f')](_0x3b90('0x20'),_0x5723a1);logger[_0x3b90('0xe')](_0x3b90('0x20'),_0x5723a1,JSON['stringify'](_0x5ddc95));_0x575747(_0x5ddc95);})[_0x3b90('0x15')](function(_0x1c9b1f){logger['error']('GetServicenowAccount',_0x1c9b1f[_0x3b90('0x13')],_0x5723a1);_0x559eac(_0x33111c[_0x3b90('0x11')](0x1f4,_0x1c9b1f[_0x3b90('0x13')]));});});};exports[_0x3b90('0x21')]=function(_0x1e3a64){var _0x33a4bb=this;return new Promise(function(_0x31ef97,_0x4dadff){return db[_0x3b90('0x16')][_0x3b90('0x22')]({'raw':_0x1e3a64[_0x3b90('0x17')]?_0x1e3a64[_0x3b90('0x17')][_0x3b90('0x18')]===undefined?!![]:![]:!![],'where':_0x1e3a64[_0x3b90('0x17')]?_0x1e3a64[_0x3b90('0x17')][_0x3b90('0x19')]||null:null,'attributes':_0x1e3a64[_0x3b90('0x17')]?_0x1e3a64[_0x3b90('0x17')][_0x3b90('0x1d')]||null:null,'include':_0x1e3a64[_0x3b90('0x17')]?_0x1e3a64[_0x3b90('0x17')][_0x3b90('0x1e')]?_[_0x3b90('0x1b')](_0x1e3a64[_0x3b90('0x17')][_0x3b90('0x1e')],function(_0x5f0c5f){return{'model':db[_0x5f0c5f['model']],'as':_0x5f0c5f['as'],'attributes':_0x5f0c5f[_0x3b90('0x1d')],'include':_0x5f0c5f['include']?_[_0x3b90('0x1b')](_0x5f0c5f[_0x3b90('0x1e')],function(_0x457d12){return{'model':db[_0x457d12[_0x3b90('0x1c')]],'as':_0x457d12['as'],'attributes':_0x457d12['attributes'],'include':_0x457d12[_0x3b90('0x1e')]?_[_0x3b90('0x1b')](_0x457d12[_0x3b90('0x1e')],function(_0x51378b){return{'model':db[_0x51378b[_0x3b90('0x1c')]],'as':_0x51378b['as'],'attributes':_0x51378b[_0x3b90('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1618fc){logger[_0x3b90('0x1f')](_0x3b90('0x21'),_0x1e3a64);logger[_0x3b90('0xe')](_0x3b90('0x21'),_0x1e3a64,JSON['stringify'](_0x1618fc));_0x31ef97(_0x1618fc);})[_0x3b90('0x15')](function(_0x1e0f15){logger[_0x3b90('0x11')](_0x3b90('0x21'),_0x1e0f15['message'],_0x1e3a64);_0x4dadff(_0x33a4bb[_0x3b90('0x11')](0x1f4,_0x1e0f15[_0x3b90('0x13')]));});});}; \ No newline at end of file +var _0xa300=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','ServicenowAccount','findAll','options','attributes','limit','map','include','model','GetServicenowAccount','catch','ShowServicenowAccount','find','raw','where','lodash','bluebird'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xa300,0x170));var _0x0a30=function(_0xdda6f3,_0x4df09b){_0xdda6f3=_0xdda6f3-0x0;var _0x1679c2=_0xa300[_0xdda6f3];return _0x1679c2;};'use strict';var _=require(_0x0a30('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0a30('0x1'));var rs=require(_0x0a30('0x2'));var fs=require('fs');var Redis=require(_0x0a30('0x3'));var db=require(_0x0a30('0x4'))['db'];var utils=require(_0x0a30('0x5'));var logger=require(_0x0a30('0x6'))(_0x0a30('0x7'));var config=require(_0x0a30('0x8'));var jayson=require(_0x0a30('0x9'));var client=jayson[_0x0a30('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ba996,_0x2b2880,_0x51b5d6){return new BPromise(function(_0x25a518,_0x35e247){return client[_0x0a30('0xb')](_0x4ba996,_0x51b5d6)[_0x0a30('0xc')](function(_0x3b5890){logger[_0x0a30('0xd')](_0x0a30('0xe'),_0x2b2880,'request\x20sent');logger[_0x0a30('0xf')](_0x0a30('0x10'),_0x2b2880,_0x0a30('0x11'),JSON[_0x0a30('0x12')](_0x3b5890));if(_0x3b5890['error']){if(_0x3b5890[_0x0a30('0x13')][_0x0a30('0x14')]===0x1f4){logger[_0x0a30('0x13')](_0x0a30('0xe'),_0x2b2880,_0x3b5890[_0x0a30('0x13')]['message']);return _0x35e247(_0x3b5890[_0x0a30('0x13')][_0x0a30('0x15')]);}logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x2b2880,_0x3b5890[_0x0a30('0x13')][_0x0a30('0x15')]);return _0x25a518(_0x3b5890[_0x0a30('0x13')][_0x0a30('0x15')]);}else{logger[_0x0a30('0xd')](_0x0a30('0xe'),_0x2b2880,_0x0a30('0x11'));_0x25a518(_0x3b5890[_0x0a30('0x16')][_0x0a30('0x15')]);}})['catch'](function(_0x1738f9){logger[_0x0a30('0x13')](_0x0a30('0xe'),_0x2b2880,_0x1738f9);_0x35e247(_0x1738f9);});});}exports['GetServicenowAccount']=function(_0x122b7e){var _0x3d7d67=this;return new Promise(function(_0x2ae4ef,_0x53aa08){return db[_0x0a30('0x17')][_0x0a30('0x18')]({'raw':_0x122b7e[_0x0a30('0x19')]?_0x122b7e['options']['raw']===undefined?!![]:![]:!![],'where':_0x122b7e[_0x0a30('0x19')]?_0x122b7e[_0x0a30('0x19')]['where']||null:null,'attributes':_0x122b7e[_0x0a30('0x19')]?_0x122b7e[_0x0a30('0x19')][_0x0a30('0x1a')]||null:null,'limit':_0x122b7e[_0x0a30('0x19')]?_0x122b7e[_0x0a30('0x19')][_0x0a30('0x1b')]||null:null,'include':_0x122b7e[_0x0a30('0x19')]?_0x122b7e[_0x0a30('0x19')]['include']?_[_0x0a30('0x1c')](_0x122b7e['options'][_0x0a30('0x1d')],function(_0x1482ef){return{'model':db[_0x1482ef[_0x0a30('0x1e')]],'as':_0x1482ef['as'],'attributes':_0x1482ef['attributes'],'include':_0x1482ef['include']?_[_0x0a30('0x1c')](_0x1482ef[_0x0a30('0x1d')],function(_0x28c90f){return{'model':db[_0x28c90f['model']],'as':_0x28c90f['as'],'attributes':_0x28c90f[_0x0a30('0x1a')],'include':_0x28c90f['include']?_['map'](_0x28c90f['include'],function(_0x253fa5){return{'model':db[_0x253fa5[_0x0a30('0x1e')]],'as':_0x253fa5['as'],'attributes':_0x253fa5[_0x0a30('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0a30('0xc')](function(_0x353775){logger['info'](_0x0a30('0x1f'),_0x122b7e);logger[_0x0a30('0xf')](_0x0a30('0x1f'),_0x122b7e,JSON[_0x0a30('0x12')](_0x353775));_0x2ae4ef(_0x353775);})[_0x0a30('0x20')](function(_0x307c73){logger[_0x0a30('0x13')](_0x0a30('0x1f'),_0x307c73[_0x0a30('0x15')],_0x122b7e);_0x53aa08(_0x3d7d67[_0x0a30('0x13')](0x1f4,_0x307c73['message']));});});};exports[_0x0a30('0x21')]=function(_0x106486){var _0x3b5bb8=this;return new Promise(function(_0x4e57bf,_0x4c70b5){return db[_0x0a30('0x17')][_0x0a30('0x22')]({'raw':_0x106486['options']?_0x106486[_0x0a30('0x19')][_0x0a30('0x23')]===undefined?!![]:![]:!![],'where':_0x106486[_0x0a30('0x19')]?_0x106486[_0x0a30('0x19')][_0x0a30('0x24')]||null:null,'attributes':_0x106486[_0x0a30('0x19')]?_0x106486[_0x0a30('0x19')][_0x0a30('0x1a')]||null:null,'include':_0x106486[_0x0a30('0x19')]?_0x106486[_0x0a30('0x19')][_0x0a30('0x1d')]?_[_0x0a30('0x1c')](_0x106486[_0x0a30('0x19')][_0x0a30('0x1d')],function(_0x5ce3c1){return{'model':db[_0x5ce3c1[_0x0a30('0x1e')]],'as':_0x5ce3c1['as'],'attributes':_0x5ce3c1[_0x0a30('0x1a')],'include':_0x5ce3c1[_0x0a30('0x1d')]?_[_0x0a30('0x1c')](_0x5ce3c1['include'],function(_0x28071c){return{'model':db[_0x28071c['model']],'as':_0x28071c['as'],'attributes':_0x28071c[_0x0a30('0x1a')],'include':_0x28071c[_0x0a30('0x1d')]?_['map'](_0x28071c[_0x0a30('0x1d')],function(_0xbac949){return{'model':db[_0xbac949['model']],'as':_0xbac949['as'],'attributes':_0xbac949[_0x0a30('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0a30('0xc')](function(_0x3053ed){logger[_0x0a30('0xd')](_0x0a30('0x21'),_0x106486);logger[_0x0a30('0xf')](_0x0a30('0x21'),_0x106486,JSON[_0x0a30('0x12')](_0x3053ed));_0x4e57bf(_0x3053ed);})[_0x0a30('0x20')](function(_0x31d74b){logger['error'](_0x0a30('0x21'),_0x31d74b[_0x0a30('0x15')],_0x106486);_0x4c70b5(_0x3b5bb8[_0x0a30('0x13')](0x1f4,_0x31d74b[_0x0a30('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index afe71ee..c3a3563 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 _0xe6c1=['/:id/subjects','getSubjects','post','create','put','/:id','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','show','isAuthenticated','getFields'];(function(_0x4b0aa3,_0x198647){var _0x126ad5=function(_0x3c0c98){while(--_0x3c0c98){_0x4b0aa3['push'](_0x4b0aa3['shift']());}};_0x126ad5(++_0x198647);}(_0xe6c1,0x193));var _0x1e6c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe6c1[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x1e6c('0x0'));var path=require(_0x1e6c('0x1'));var timeout=require(_0x1e6c('0x2'));var express=require(_0x1e6c('0x3'));var router=express['Router']();var fs_extra=require(_0x1e6c('0x4'));var auth=require(_0x1e6c('0x5'));var interaction=require(_0x1e6c('0x6'));var config=require('../../config/environment');var controller=require('./intServicenowConfiguration.controller');router[_0x1e6c('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1e6c('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x1e6c('0x8')]);router['get']('/:id/fields',auth[_0x1e6c('0x9')](),controller[_0x1e6c('0xa')]);router[_0x1e6c('0x7')](_0x1e6c('0xb'),auth[_0x1e6c('0x9')](),controller[_0x1e6c('0xc')]);router[_0x1e6c('0x7')]('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0x1e6c('0xd')]('/',auth['isAuthenticated'](),controller[_0x1e6c('0xe')]);router[_0x1e6c('0xf')](_0x1e6c('0x10'),auth[_0x1e6c('0x9')](),controller['update']);router['delete'](_0x1e6c('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x1e6c('0x11')]=router; \ No newline at end of file +var _0xf9d4=['isAuthenticated','index','get','show','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller'];(function(_0x9cdedf,_0x5ad1c5){var _0x300f0b=function(_0x3afeae){while(--_0x3afeae){_0x9cdedf['push'](_0x9cdedf['shift']());}};_0x300f0b(++_0x5ad1c5);}(_0xf9d4,0x9e));var _0x4f9d=function(_0x135b9b,_0x27af46){_0x135b9b=_0x135b9b-0x0;var _0x27e44a=_0xf9d4[_0x135b9b];return _0x27e44a;};'use strict';var multer=require(_0x4f9d('0x0'));var util=require(_0x4f9d('0x1'));var path=require('path');var timeout=require(_0x4f9d('0x2'));var express=require(_0x4f9d('0x3'));var router=express[_0x4f9d('0x4')]();var fs_extra=require(_0x4f9d('0x5'));var auth=require(_0x4f9d('0x6'));var interaction=require(_0x4f9d('0x7'));var config=require(_0x4f9d('0x8'));var controller=require(_0x4f9d('0x9'));router['get']('/',auth[_0x4f9d('0xa')](),controller[_0x4f9d('0xb')]);router[_0x4f9d('0xc')]('/:id',auth[_0x4f9d('0xa')](),controller[_0x4f9d('0xd')]);router[_0x4f9d('0xc')]('/:id/fields',auth[_0x4f9d('0xa')](),controller['getFields']);router['get'](_0x4f9d('0xe'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x4f9d('0xc')](_0x4f9d('0xf'),auth['isAuthenticated'](),controller[_0x4f9d('0x10')]);router[_0x4f9d('0x11')]('/',auth['isAuthenticated'](),controller[_0x4f9d('0x12')]);router[_0x4f9d('0x13')](_0x4f9d('0x14'),auth['isAuthenticated'](),controller[_0x4f9d('0x15')]);router[_0x4f9d('0x16')](_0x4f9d('0x14'),auth[_0x4f9d('0xa')](),controller['destroy']);module[_0x4f9d('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 316cf6f..f6ae141 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 _0x084d=['STRING','exports'];(function(_0x13c86c,_0x47538f){var _0x890e1e=function(_0x5e5b76){while(--_0x5e5b76){_0x13c86c['push'](_0x13c86c['shift']());}};_0x890e1e(++_0x47538f);}(_0x084d,0x9d));var _0xd084=function(_0x3e8690,_0x10eb63){_0x3e8690=_0x3e8690-0x0;var _0x101521=_0x084d[_0x3e8690];return _0x101521;};'use strict';var Sequelize=require('sequelize');module[_0xd084('0x0')]={'name':{'type':Sequelize[_0xd084('0x1')]},'description':{'type':Sequelize[_0xd084('0x1')]}}; \ No newline at end of file +var _0x993e=['sequelize','exports','STRING'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x993e,0x90));var _0xe993=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x993e[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xe993('0x0'));module[_0xe993('0x1')]={'name':{'type':Sequelize[_0xe993('0x2')]},'description':{'type':Sequelize[_0xe993('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index e844644..5f80d7c 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 _0x489a=['merge','VIRTUAL','options','includeAll','include','rows','catch','show','find','body','params','getFields','findOne','length','order','getSubjects','ServicenowField','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter'];(function(_0x13137e,_0x29c0f3){var _0x346261=function(_0x8c7d4f){while(--_0x8c7d4f){_0x13137e['push'](_0x13137e['shift']());}};_0x346261(++_0x29c0f3);}(_0x489a,0x15a));var _0xa489=function(_0x2068ee,_0x42966a){_0x2068ee=_0x2068ee-0x0;var _0xa36814=_0x489a[_0x2068ee];return _0xa36814;};'use strict';var emlformat=require(_0xa489('0x0'));var rimraf=require(_0xa489('0x1'));var zipdir=require(_0xa489('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa489('0x3'));var moment=require(_0xa489('0x4'));var BPromise=require(_0xa489('0x5'));var Mustache=require(_0xa489('0x6'));var util=require(_0xa489('0x7'));var path=require(_0xa489('0x8'));var sox=require(_0xa489('0x9'));var csv=require(_0xa489('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa489('0xb'));var _=require(_0xa489('0xc'));var squel=require(_0xa489('0xd'));var crypto=require('crypto');var jsforce=require(_0xa489('0xe'));var deskjs=require(_0xa489('0xf'));var toCsv=require(_0xa489('0xa'));var querystring=require(_0xa489('0x10'));var Papa=require('papaparse');var Redis=require(_0xa489('0x11'));var authService=require(_0xa489('0x12'));var qs=require(_0xa489('0x13'));var as=require(_0xa489('0x14'));var hardwareService=require(_0xa489('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xa489('0x16'));var config=require(_0xa489('0x17'));var licenseUtil=require(_0xa489('0x18'));var db=require(_0xa489('0x19'))['db'];function respondWithStatusCode(_0x596773,_0x14222e){_0x14222e=_0x14222e||0xcc;return function(_0x70b0ab){if(_0x70b0ab){return _0x596773['sendStatus'](_0x14222e);}return _0x596773[_0xa489('0x1a')](_0x14222e)[_0xa489('0x1b')]();};}function respondWithResult(_0x4f2aea,_0x13c189){_0x13c189=_0x13c189||0xc8;return function(_0x3965dc){if(_0x3965dc){return _0x4f2aea[_0xa489('0x1a')](_0x13c189)['json'](_0x3965dc);}};}function respondWithFilteredResult(_0x88c978,_0x2a6b95){return function(_0x3c5ea5){if(_0x3c5ea5){var _0xf9c24a=typeof _0x2a6b95[_0xa489('0x1c')]===_0xa489('0x1d')&&typeof _0x2a6b95[_0xa489('0x1e')]===_0xa489('0x1d');var _0x4871b9=_0x3c5ea5[_0xa489('0x1f')];var _0x38f22a=_0xf9c24a?0x0:_0x2a6b95['offset'];var _0x189474=_0xf9c24a?_0x3c5ea5['count']:_0x2a6b95['offset']+_0x2a6b95[_0xa489('0x1e')];var _0x9b96e6;if(_0x189474>=_0x4871b9){_0x189474=_0x4871b9;_0x9b96e6=0xc8;}else{_0x9b96e6=0xce;}_0x88c978['status'](_0x9b96e6);return _0x88c978[_0xa489('0x20')](_0xa489('0x21'),_0x38f22a+'-'+_0x189474+'/'+_0x4871b9)[_0xa489('0x22')](_0x3c5ea5);}return null;};}function patchUpdates(_0xe5b322){return function(_0x53f854){try{jsonpatch['apply'](_0x53f854,_0xe5b322,!![]);}catch(_0x10fe51){return BPromise[_0xa489('0x23')](_0x10fe51);}return _0x53f854[_0xa489('0x24')]();};}function saveUpdates(_0x286a48,_0x276bc4){return function(_0x66d4b){if(_0x66d4b){return _0x66d4b[_0xa489('0x25')](_0x286a48)[_0xa489('0x26')](function(_0x5945d6){return _0x5945d6;});}return null;};}function removeEntity(_0x10794c,_0x363c75){return function(_0x2700dc){if(_0x2700dc){return _0x2700dc[_0xa489('0x27')]()[_0xa489('0x26')](function(){_0x10794c[_0xa489('0x1a')](0xcc)[_0xa489('0x1b')]();});}};}function handleEntityNotFound(_0x2de0b9,_0x137c35){return function(_0x1bf2d9){if(!_0x1bf2d9){_0x2de0b9[_0xa489('0x28')](0x194);}return _0x1bf2d9;};}function handleError(_0x145b71,_0xe61be){_0xe61be=_0xe61be||0x1f4;return function(_0x57c9c2){logger[_0xa489('0x29')](_0x57c9c2['stack']);if(_0x57c9c2['name']){delete _0x57c9c2[_0xa489('0x2a')];}_0x145b71[_0xa489('0x1a')](_0xe61be)[_0xa489('0x2b')](_0x57c9c2);};}exports[_0xa489('0x2c')]=function(_0x53e618,_0x11aaaf){var _0x2a3e0a={},_0x412ba7={},_0x38e5c7={'count':0x0,'rows':[]};var _0x8c184d=_[_0xa489('0x2d')](db[_0xa489('0x2e')][_0xa489('0x2f')],function(_0x3b7fc7){return{'name':_0x3b7fc7[_0xa489('0x30')],'type':_0x3b7fc7[_0xa489('0x31')][_0xa489('0x32')]};});_0x412ba7[_0xa489('0x33')]=_[_0xa489('0x2d')](_0x8c184d,_0xa489('0x2a'));_0x412ba7[_0xa489('0x34')]=_[_0xa489('0x35')](_0x53e618['query']);_0x412ba7[_0xa489('0x36')]=_[_0xa489('0x37')](_0x412ba7[_0xa489('0x33')],_0x412ba7['query']);_0x2a3e0a['attributes']=_[_0xa489('0x37')](_0x412ba7[_0xa489('0x33')],qs[_0xa489('0x38')](_0x53e618[_0xa489('0x34')][_0xa489('0x38')]));_0x2a3e0a[_0xa489('0x39')]=_0x2a3e0a[_0xa489('0x39')]['length']?_0x2a3e0a['attributes']:_0x412ba7['model'];if(!_0x53e618[_0xa489('0x34')][_0xa489('0x3a')](_0xa489('0x3b'))){_0x2a3e0a[_0xa489('0x1e')]=qs[_0xa489('0x1e')](_0x53e618[_0xa489('0x34')]['limit']);_0x2a3e0a[_0xa489('0x1c')]=qs[_0xa489('0x1c')](_0x53e618[_0xa489('0x34')][_0xa489('0x1c')]);}_0x2a3e0a['order']=qs[_0xa489('0x3c')](_0x53e618[_0xa489('0x34')]['sort']);_0x2a3e0a[_0xa489('0x3d')]=qs[_0xa489('0x36')](_[_0xa489('0x3e')](_0x53e618[_0xa489('0x34')],_0x412ba7[_0xa489('0x36')]),_0x8c184d);if(_0x53e618[_0xa489('0x34')][_0xa489('0x3f')]){_0x2a3e0a[_0xa489('0x3d')]=_[_0xa489('0x40')](_0x2a3e0a[_0xa489('0x3d')],{'$or':_[_0xa489('0x2d')](_0x8c184d,function(_0x4325c9){if(_0x4325c9[_0xa489('0x31')]!==_0xa489('0x41')){var _0x5b3b60={};_0x5b3b60[_0x4325c9[_0xa489('0x2a')]]={'$like':'%'+_0x53e618['query'][_0xa489('0x3f')]+'%'};return _0x5b3b60;}})});}_0x2a3e0a=_[_0xa489('0x40')]({},_0x2a3e0a,_0x53e618[_0xa489('0x42')]);var _0x16323c={'where':_0x2a3e0a[_0xa489('0x3d')]};return db['ServicenowConfiguration'][_0xa489('0x1f')](_0x16323c)[_0xa489('0x26')](function(_0x114945){_0x38e5c7['count']=_0x114945;if(_0x53e618[_0xa489('0x34')][_0xa489('0x43')]){_0x2a3e0a[_0xa489('0x44')]=[{'all':!![]}];}return db[_0xa489('0x2e')]['findAll'](_0x2a3e0a);})[_0xa489('0x26')](function(_0x15e57e){_0x38e5c7[_0xa489('0x45')]=_0x15e57e;return _0x38e5c7;})['then'](respondWithFilteredResult(_0x11aaaf,_0x2a3e0a))[_0xa489('0x46')](handleError(_0x11aaaf,null));};exports[_0xa489('0x47')]=function(_0x4e6c41,_0x3a357d){var _0x5c71f7={'raw':![],'where':{'id':_0x4e6c41['params']['id']}},_0x104d98={};_0x104d98['model']=_['keys'](db[_0xa489('0x2e')][_0xa489('0x2f')]);_0x104d98[_0xa489('0x34')]=_['keys'](_0x4e6c41[_0xa489('0x34')]);_0x104d98['filters']=_['intersection'](_0x104d98['model'],_0x104d98['query']);_0x5c71f7[_0xa489('0x39')]=_['intersection'](_0x104d98[_0xa489('0x33')],qs[_0xa489('0x38')](_0x4e6c41[_0xa489('0x34')][_0xa489('0x38')]));_0x5c71f7[_0xa489('0x39')]=_0x5c71f7['attributes']['length']?_0x5c71f7[_0xa489('0x39')]:_0x104d98[_0xa489('0x33')];if(_0x4e6c41[_0xa489('0x34')][_0xa489('0x43')]){_0x5c71f7[_0xa489('0x44')]=[{'all':!![]}];}_0x5c71f7=_[_0xa489('0x40')]({},_0x5c71f7,_0x4e6c41[_0xa489('0x42')]);return db['ServicenowConfiguration'][_0xa489('0x48')](_0x5c71f7)[_0xa489('0x26')](handleEntityNotFound(_0x3a357d,null))[_0xa489('0x26')](respondWithResult(_0x3a357d,null))[_0xa489('0x46')](handleError(_0x3a357d,null));};exports['create']=function(_0x3fdcdf,_0x1e757b){return db['ServicenowConfiguration']['create'](_0x3fdcdf['body'],{})[_0xa489('0x26')](respondWithResult(_0x1e757b,0xc9))[_0xa489('0x46')](handleError(_0x1e757b,null));};exports['update']=function(_0x153b69,_0x1dda97){if(_0x153b69[_0xa489('0x49')]['id']){delete _0x153b69['body']['id'];}return db['ServicenowConfiguration'][_0xa489('0x48')]({'where':{'id':_0x153b69[_0xa489('0x4a')]['id']}})[_0xa489('0x26')](handleEntityNotFound(_0x1dda97,null))['then'](saveUpdates(_0x153b69[_0xa489('0x49')],null))[_0xa489('0x26')](respondWithResult(_0x1dda97,null))['catch'](handleError(_0x1dda97,null));};exports[_0xa489('0x27')]=function(_0x3ed1a5,_0x525d6b){return db[_0xa489('0x2e')]['find']({'where':{'id':_0x3ed1a5[_0xa489('0x4a')]['id']}})[_0xa489('0x26')](handleEntityNotFound(_0x525d6b,null))[_0xa489('0x26')](removeEntity(_0x525d6b,null))[_0xa489('0x46')](handleError(_0x525d6b,null));};exports[_0xa489('0x4b')]=function(_0x538d31,_0x258559,_0x492043){var _0x15740f={};var _0xa0d09={};var _0x2cd41d;var _0x48f89e;return db[_0xa489('0x2e')][_0xa489('0x4c')]({'where':{'id':_0x538d31[_0xa489('0x4a')]['id']}})[_0xa489('0x26')](handleEntityNotFound(_0x258559,null))[_0xa489('0x26')](function(_0x526e42){if(_0x526e42){_0x2cd41d=_0x526e42;_0xa0d09['model']=_[_0xa489('0x35')](db['ServicenowField'][_0xa489('0x2f')]);_0xa0d09[_0xa489('0x34')]=_[_0xa489('0x35')](_0x538d31[_0xa489('0x34')]);_0xa0d09[_0xa489('0x36')]=_[_0xa489('0x37')](_0xa0d09[_0xa489('0x33')],_0xa0d09[_0xa489('0x34')]);_0x15740f['attributes']=_[_0xa489('0x37')](_0xa0d09[_0xa489('0x33')],qs['fields'](_0x538d31[_0xa489('0x34')][_0xa489('0x38')]));_0x15740f['attributes']=_0x15740f[_0xa489('0x39')][_0xa489('0x4d')]?_0x15740f[_0xa489('0x39')]:_0xa0d09['model'];_0x15740f[_0xa489('0x4e')]=qs['sort'](_0x538d31['query'][_0xa489('0x3c')]);_0x15740f[_0xa489('0x3d')]=qs[_0xa489('0x36')](_[_0xa489('0x3e')](_0x538d31[_0xa489('0x34')],_0xa0d09[_0xa489('0x36')]));if(_0x538d31[_0xa489('0x34')]['filter']){_0x15740f['where']=_[_0xa489('0x40')](_0x15740f[_0xa489('0x3d')],{'$or':_[_0xa489('0x2d')](_0x15740f[_0xa489('0x39')],function(_0x90402b){var _0x1f4be1={};_0x1f4be1[_0x90402b]={'$like':'%'+_0x538d31[_0xa489('0x34')][_0xa489('0x3f')]+'%'};return _0x1f4be1;})});}_0x15740f=_[_0xa489('0x40')]({},_0x15740f,_0x538d31[_0xa489('0x42')]);return _0x2cd41d[_0xa489('0x4b')](_0x15740f);}})[_0xa489('0x26')](function(_0x30aff3){if(_0x30aff3){_0x48f89e=_0x30aff3[_0xa489('0x4d')];if(!_0x538d31['query']['hasOwnProperty'](_0xa489('0x3b'))){_0x15740f[_0xa489('0x1e')]=qs[_0xa489('0x1e')](_0x538d31['query'][_0xa489('0x1e')]);_0x15740f[_0xa489('0x1c')]=qs[_0xa489('0x1c')](_0x538d31[_0xa489('0x34')][_0xa489('0x1c')]);}return _0x2cd41d[_0xa489('0x4b')](_0x15740f);}})[_0xa489('0x26')](function(_0x146abe){if(_0x146abe){return _0x146abe?{'count':_0x48f89e,'rows':_0x146abe}:null;}})[_0xa489('0x26')](respondWithResult(_0x258559,null))[_0xa489('0x46')](handleError(_0x258559,null));};exports[_0xa489('0x4f')]=function(_0x5e344d,_0x32c52a,_0x35db8e){var _0x167f99={};var _0x2c8e3e={};var _0x46397d;var _0x3d4056;return db[_0xa489('0x2e')]['findOne']({'where':{'id':_0x5e344d[_0xa489('0x4a')]['id']}})['then'](handleEntityNotFound(_0x32c52a,null))[_0xa489('0x26')](function(_0x3ec18a){if(_0x3ec18a){_0x46397d=_0x3ec18a;_0x2c8e3e['model']=_[_0xa489('0x35')](db[_0xa489('0x50')]['rawAttributes']);_0x2c8e3e[_0xa489('0x34')]=_[_0xa489('0x35')](_0x5e344d[_0xa489('0x34')]);_0x2c8e3e[_0xa489('0x36')]=_[_0xa489('0x37')](_0x2c8e3e[_0xa489('0x33')],_0x2c8e3e[_0xa489('0x34')]);_0x167f99[_0xa489('0x39')]=_[_0xa489('0x37')](_0x2c8e3e[_0xa489('0x33')],qs['fields'](_0x5e344d[_0xa489('0x34')]['fields']));_0x167f99[_0xa489('0x39')]=_0x167f99[_0xa489('0x39')][_0xa489('0x4d')]?_0x167f99[_0xa489('0x39')]:_0x2c8e3e[_0xa489('0x33')];_0x167f99[_0xa489('0x4e')]=qs[_0xa489('0x3c')](_0x5e344d[_0xa489('0x34')][_0xa489('0x3c')]);_0x167f99['where']=qs[_0xa489('0x36')](_['pick'](_0x5e344d[_0xa489('0x34')],_0x2c8e3e[_0xa489('0x36')]));if(_0x5e344d['query'][_0xa489('0x3f')]){_0x167f99[_0xa489('0x3d')]=_[_0xa489('0x40')](_0x167f99[_0xa489('0x3d')],{'$or':_['map'](_0x167f99['attributes'],function(_0x5d7318){var _0x5d7a25={};_0x5d7a25[_0x5d7318]={'$like':'%'+_0x5e344d[_0xa489('0x34')][_0xa489('0x3f')]+'%'};return _0x5d7a25;})});}_0x167f99=_[_0xa489('0x40')]({},_0x167f99,_0x5e344d[_0xa489('0x42')]);return _0x46397d['getSubjects'](_0x167f99);}})[_0xa489('0x26')](function(_0x578e5b){if(_0x578e5b){_0x3d4056=_0x578e5b['length'];if(!_0x5e344d[_0xa489('0x34')][_0xa489('0x3a')](_0xa489('0x3b'))){_0x167f99[_0xa489('0x1e')]=qs[_0xa489('0x1e')](_0x5e344d[_0xa489('0x34')][_0xa489('0x1e')]);_0x167f99[_0xa489('0x1c')]=qs[_0xa489('0x1c')](_0x5e344d[_0xa489('0x34')]['offset']);}return _0x46397d[_0xa489('0x4f')](_0x167f99);}})[_0xa489('0x26')](function(_0x3f004a){if(_0x3f004a){return _0x3f004a?{'count':_0x3d4056,'rows':_0x3f004a}:null;}})[_0xa489('0x26')](respondWithResult(_0x32c52a,null))[_0xa489('0x46')](handleError(_0x32c52a,null));};exports['getDescriptions']=function(_0x2a3fe0,_0x535b9c,_0x3dfa8b){var _0x2681d1={};var _0x20ba50={};var _0x4895ac;var _0x53a7d2;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x2a3fe0[_0xa489('0x4a')]['id']}})[_0xa489('0x26')](handleEntityNotFound(_0x535b9c,null))[_0xa489('0x26')](function(_0x18721e){if(_0x18721e){_0x4895ac=_0x18721e;_0x20ba50[_0xa489('0x33')]=_['keys'](db[_0xa489('0x50')][_0xa489('0x2f')]);_0x20ba50[_0xa489('0x34')]=_[_0xa489('0x35')](_0x2a3fe0[_0xa489('0x34')]);_0x20ba50['filters']=_[_0xa489('0x37')](_0x20ba50['model'],_0x20ba50['query']);_0x2681d1['attributes']=_[_0xa489('0x37')](_0x20ba50['model'],qs[_0xa489('0x38')](_0x2a3fe0['query'][_0xa489('0x38')]));_0x2681d1[_0xa489('0x39')]=_0x2681d1[_0xa489('0x39')][_0xa489('0x4d')]?_0x2681d1[_0xa489('0x39')]:_0x20ba50[_0xa489('0x33')];_0x2681d1[_0xa489('0x4e')]=qs[_0xa489('0x3c')](_0x2a3fe0[_0xa489('0x34')][_0xa489('0x3c')]);_0x2681d1[_0xa489('0x3d')]=qs[_0xa489('0x36')](_['pick'](_0x2a3fe0[_0xa489('0x34')],_0x20ba50[_0xa489('0x36')]));if(_0x2a3fe0[_0xa489('0x34')][_0xa489('0x3f')]){_0x2681d1[_0xa489('0x3d')]=_[_0xa489('0x40')](_0x2681d1[_0xa489('0x3d')],{'$or':_[_0xa489('0x2d')](_0x2681d1[_0xa489('0x39')],function(_0x32c4b7){var _0x536454={};_0x536454[_0x32c4b7]={'$like':'%'+_0x2a3fe0[_0xa489('0x34')][_0xa489('0x3f')]+'%'};return _0x536454;})});}_0x2681d1=_['merge']({},_0x2681d1,_0x2a3fe0[_0xa489('0x42')]);return _0x4895ac[_0xa489('0x51')](_0x2681d1);}})[_0xa489('0x26')](function(_0x24ec8c){if(_0x24ec8c){_0x53a7d2=_0x24ec8c[_0xa489('0x4d')];if(!_0x2a3fe0[_0xa489('0x34')][_0xa489('0x3a')](_0xa489('0x3b'))){_0x2681d1[_0xa489('0x1e')]=qs['limit'](_0x2a3fe0['query'][_0xa489('0x1e')]);_0x2681d1[_0xa489('0x1c')]=qs[_0xa489('0x1c')](_0x2a3fe0[_0xa489('0x34')][_0xa489('0x1c')]);}return _0x4895ac[_0xa489('0x51')](_0x2681d1);}})[_0xa489('0x26')](function(_0x2b7033){if(_0x2b7033){return _0x2b7033?{'count':_0x53a7d2,'rows':_0x2b7033}:null;}})['then'](respondWithResult(_0x535b9c,null))['catch'](handleError(_0x535b9c,null));}; \ No newline at end of file +var _0x9673=['update','then','sendStatus','error','stack','name','map','ServicenowConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','include','find','create','body','destroy','getFields','getSubjects','ServicenowField','getDescriptions','findOne','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0x9673,0x7b));var _0x3967=function(_0x214fed,_0x1715b6){_0x214fed=_0x214fed-0x0;var _0xb57921=_0x9673[_0x214fed];return _0xb57921;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3967('0x0'));var jsonpatch=require(_0x3967('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3967('0x2'));var Mustache=require(_0x3967('0x3'));var util=require(_0x3967('0x4'));var path=require(_0x3967('0x5'));var sox=require(_0x3967('0x6'));var csv=require('to-csv');var ejs=require(_0x3967('0x7'));var fs=require('fs');var fs_extra=require(_0x3967('0x8'));var _=require(_0x3967('0x9'));var squel=require(_0x3967('0xa'));var crypto=require(_0x3967('0xb'));var jsforce=require(_0x3967('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3967('0xd'));var querystring=require(_0x3967('0xe'));var Papa=require(_0x3967('0xf'));var Redis=require(_0x3967('0x10'));var authService=require(_0x3967('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3967('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3967('0x13'));var utils=require('../../config/utils');var config=require(_0x3967('0x14'));var licenseUtil=require(_0x3967('0x15'));var db=require(_0x3967('0x16'))['db'];function respondWithStatusCode(_0x5efcb2,_0x483155){_0x483155=_0x483155||0xcc;return function(_0x2e4b91){if(_0x2e4b91){return _0x5efcb2['sendStatus'](_0x483155);}return _0x5efcb2[_0x3967('0x17')](_0x483155)[_0x3967('0x18')]();};}function respondWithResult(_0x317c2d,_0x43095a){_0x43095a=_0x43095a||0xc8;return function(_0xff95db){if(_0xff95db){return _0x317c2d[_0x3967('0x17')](_0x43095a)['json'](_0xff95db);}};}function respondWithFilteredResult(_0x1bae89,_0x198387){return function(_0x4ed899){if(_0x4ed899){var _0xa5fd56=typeof _0x198387[_0x3967('0x19')]===_0x3967('0x1a')&&typeof _0x198387[_0x3967('0x1b')]===_0x3967('0x1a');var _0x2f238a=_0x4ed899[_0x3967('0x1c')];var _0x40b711=_0xa5fd56?0x0:_0x198387[_0x3967('0x19')];var _0x28726e=_0xa5fd56?_0x4ed899[_0x3967('0x1c')]:_0x198387[_0x3967('0x19')]+_0x198387[_0x3967('0x1b')];var _0x1542e2;if(_0x28726e>=_0x2f238a){_0x28726e=_0x2f238a;_0x1542e2=0xc8;}else{_0x1542e2=0xce;}_0x1bae89[_0x3967('0x17')](_0x1542e2);return _0x1bae89[_0x3967('0x1d')](_0x3967('0x1e'),_0x40b711+'-'+_0x28726e+'/'+_0x2f238a)[_0x3967('0x1f')](_0x4ed899);}return null;};}function patchUpdates(_0x529f24){return function(_0x1379a9){try{jsonpatch[_0x3967('0x20')](_0x1379a9,_0x529f24,!![]);}catch(_0x4c8eb5){return BPromise[_0x3967('0x21')](_0x4c8eb5);}return _0x1379a9[_0x3967('0x22')]();};}function saveUpdates(_0x2933fa,_0x457685){return function(_0x40de6d){if(_0x40de6d){return _0x40de6d[_0x3967('0x23')](_0x2933fa)[_0x3967('0x24')](function(_0x402ab7){return _0x402ab7;});}return null;};}function removeEntity(_0x550ca3,_0x4b93da){return function(_0x2c3f1d){if(_0x2c3f1d){return _0x2c3f1d['destroy']()['then'](function(){_0x550ca3[_0x3967('0x17')](0xcc)[_0x3967('0x18')]();});}};}function handleEntityNotFound(_0x481cde,_0x38dc0d){return function(_0x65aad0){if(!_0x65aad0){_0x481cde[_0x3967('0x25')](0x194);}return _0x65aad0;};}function handleError(_0x4eb1ef,_0x38f2ac){_0x38f2ac=_0x38f2ac||0x1f4;return function(_0xfe2218){logger[_0x3967('0x26')](_0xfe2218[_0x3967('0x27')]);if(_0xfe2218[_0x3967('0x28')]){delete _0xfe2218[_0x3967('0x28')];}_0x4eb1ef['status'](_0x38f2ac)['send'](_0xfe2218);};}exports['index']=function(_0x4a3bbe,_0x37afb2){var _0x216a90={},_0x57dec6={},_0x17d531={'count':0x0,'rows':[]};var _0x4dfff5=_[_0x3967('0x29')](db[_0x3967('0x2a')][_0x3967('0x2b')],function(_0x15e134){return{'name':_0x15e134['fieldName'],'type':_0x15e134[_0x3967('0x2c')][_0x3967('0x2d')]};});_0x57dec6[_0x3967('0x2e')]=_[_0x3967('0x29')](_0x4dfff5,'name');_0x57dec6[_0x3967('0x2f')]=_[_0x3967('0x30')](_0x4a3bbe['query']);_0x57dec6[_0x3967('0x31')]=_[_0x3967('0x32')](_0x57dec6['model'],_0x57dec6['query']);_0x216a90[_0x3967('0x33')]=_[_0x3967('0x32')](_0x57dec6[_0x3967('0x2e')],qs['fields'](_0x4a3bbe['query'][_0x3967('0x34')]));_0x216a90[_0x3967('0x33')]=_0x216a90[_0x3967('0x33')][_0x3967('0x35')]?_0x216a90['attributes']:_0x57dec6[_0x3967('0x2e')];if(!_0x4a3bbe[_0x3967('0x2f')][_0x3967('0x36')](_0x3967('0x37'))){_0x216a90['limit']=qs[_0x3967('0x1b')](_0x4a3bbe['query'][_0x3967('0x1b')]);_0x216a90[_0x3967('0x19')]=qs[_0x3967('0x19')](_0x4a3bbe[_0x3967('0x2f')][_0x3967('0x19')]);}_0x216a90[_0x3967('0x38')]=qs[_0x3967('0x39')](_0x4a3bbe[_0x3967('0x2f')][_0x3967('0x39')]);_0x216a90['where']=qs[_0x3967('0x31')](_[_0x3967('0x3a')](_0x4a3bbe[_0x3967('0x2f')],_0x57dec6[_0x3967('0x31')]),_0x4dfff5);if(_0x4a3bbe[_0x3967('0x2f')][_0x3967('0x3b')]){_0x216a90[_0x3967('0x3c')]=_['merge'](_0x216a90[_0x3967('0x3c')],{'$or':_[_0x3967('0x29')](_0x4dfff5,function(_0x4abf17){if(_0x4abf17[_0x3967('0x2c')]!==_0x3967('0x3d')){var _0x40edad={};_0x40edad[_0x4abf17[_0x3967('0x28')]]={'$like':'%'+_0x4a3bbe[_0x3967('0x2f')][_0x3967('0x3b')]+'%'};return _0x40edad;}})});}_0x216a90=_[_0x3967('0x3e')]({},_0x216a90,_0x4a3bbe[_0x3967('0x3f')]);var _0x1f2d2b={'where':_0x216a90['where']};return db[_0x3967('0x2a')][_0x3967('0x1c')](_0x1f2d2b)[_0x3967('0x24')](function(_0x55eab7){_0x17d531[_0x3967('0x1c')]=_0x55eab7;if(_0x4a3bbe[_0x3967('0x2f')][_0x3967('0x40')]){_0x216a90['include']=[{'all':!![]}];}return db[_0x3967('0x2a')][_0x3967('0x41')](_0x216a90);})[_0x3967('0x24')](function(_0x44393c){_0x17d531[_0x3967('0x42')]=_0x44393c;return _0x17d531;})[_0x3967('0x24')](respondWithFilteredResult(_0x37afb2,_0x216a90))[_0x3967('0x43')](handleError(_0x37afb2,null));};exports['show']=function(_0x5a4c4d,_0x468a64){var _0x2cd892={'raw':![],'where':{'id':_0x5a4c4d[_0x3967('0x44')]['id']}},_0x945924={};_0x945924[_0x3967('0x2e')]=_['keys'](db[_0x3967('0x2a')][_0x3967('0x2b')]);_0x945924[_0x3967('0x2f')]=_['keys'](_0x5a4c4d[_0x3967('0x2f')]);_0x945924[_0x3967('0x31')]=_[_0x3967('0x32')](_0x945924['model'],_0x945924[_0x3967('0x2f')]);_0x2cd892[_0x3967('0x33')]=_[_0x3967('0x32')](_0x945924[_0x3967('0x2e')],qs[_0x3967('0x34')](_0x5a4c4d['query'][_0x3967('0x34')]));_0x2cd892[_0x3967('0x33')]=_0x2cd892['attributes'][_0x3967('0x35')]?_0x2cd892[_0x3967('0x33')]:_0x945924['model'];if(_0x5a4c4d[_0x3967('0x2f')]['includeAll']){_0x2cd892[_0x3967('0x45')]=[{'all':!![]}];}_0x2cd892=_[_0x3967('0x3e')]({},_0x2cd892,_0x5a4c4d['options']);return db[_0x3967('0x2a')][_0x3967('0x46')](_0x2cd892)['then'](handleEntityNotFound(_0x468a64,null))[_0x3967('0x24')](respondWithResult(_0x468a64,null))['catch'](handleError(_0x468a64,null));};exports['create']=function(_0x5df255,_0xcde80d){return db[_0x3967('0x2a')][_0x3967('0x47')](_0x5df255['body'],{})[_0x3967('0x24')](respondWithResult(_0xcde80d,0xc9))[_0x3967('0x43')](handleError(_0xcde80d,null));};exports[_0x3967('0x23')]=function(_0x41c74c,_0xd18e89){if(_0x41c74c[_0x3967('0x48')]['id']){delete _0x41c74c[_0x3967('0x48')]['id'];}return db[_0x3967('0x2a')]['find']({'where':{'id':_0x41c74c['params']['id']}})['then'](handleEntityNotFound(_0xd18e89,null))[_0x3967('0x24')](saveUpdates(_0x41c74c[_0x3967('0x48')],null))[_0x3967('0x24')](respondWithResult(_0xd18e89,null))[_0x3967('0x43')](handleError(_0xd18e89,null));};exports[_0x3967('0x49')]=function(_0x4233e1,_0x557ca1){return db[_0x3967('0x2a')]['find']({'where':{'id':_0x4233e1['params']['id']}})[_0x3967('0x24')](handleEntityNotFound(_0x557ca1,null))[_0x3967('0x24')](removeEntity(_0x557ca1,null))['catch'](handleError(_0x557ca1,null));};exports[_0x3967('0x4a')]=function(_0x37e2ba,_0x2d6ba0,_0x412365){var _0x21a94f={};var _0x5954dc={};var _0x2b7b28;var _0x33f698;return db[_0x3967('0x2a')]['findOne']({'where':{'id':_0x37e2ba['params']['id']}})['then'](handleEntityNotFound(_0x2d6ba0,null))[_0x3967('0x24')](function(_0x13b10b){if(_0x13b10b){_0x2b7b28=_0x13b10b;_0x5954dc[_0x3967('0x2e')]=_[_0x3967('0x30')](db['ServicenowField'][_0x3967('0x2b')]);_0x5954dc[_0x3967('0x2f')]=_[_0x3967('0x30')](_0x37e2ba[_0x3967('0x2f')]);_0x5954dc[_0x3967('0x31')]=_['intersection'](_0x5954dc[_0x3967('0x2e')],_0x5954dc[_0x3967('0x2f')]);_0x21a94f[_0x3967('0x33')]=_[_0x3967('0x32')](_0x5954dc['model'],qs[_0x3967('0x34')](_0x37e2ba[_0x3967('0x2f')]['fields']));_0x21a94f['attributes']=_0x21a94f['attributes'][_0x3967('0x35')]?_0x21a94f[_0x3967('0x33')]:_0x5954dc[_0x3967('0x2e')];_0x21a94f['order']=qs['sort'](_0x37e2ba[_0x3967('0x2f')][_0x3967('0x39')]);_0x21a94f['where']=qs['filters'](_[_0x3967('0x3a')](_0x37e2ba['query'],_0x5954dc['filters']));if(_0x37e2ba[_0x3967('0x2f')][_0x3967('0x3b')]){_0x21a94f[_0x3967('0x3c')]=_[_0x3967('0x3e')](_0x21a94f[_0x3967('0x3c')],{'$or':_[_0x3967('0x29')](_0x21a94f[_0x3967('0x33')],function(_0x22fd8d){var _0x46350d={};_0x46350d[_0x22fd8d]={'$like':'%'+_0x37e2ba['query'][_0x3967('0x3b')]+'%'};return _0x46350d;})});}_0x21a94f=_[_0x3967('0x3e')]({},_0x21a94f,_0x37e2ba['options']);return _0x2b7b28[_0x3967('0x4a')](_0x21a94f);}})[_0x3967('0x24')](function(_0x1817e6){if(_0x1817e6){_0x33f698=_0x1817e6[_0x3967('0x35')];if(!_0x37e2ba[_0x3967('0x2f')]['hasOwnProperty'](_0x3967('0x37'))){_0x21a94f[_0x3967('0x1b')]=qs[_0x3967('0x1b')](_0x37e2ba[_0x3967('0x2f')][_0x3967('0x1b')]);_0x21a94f[_0x3967('0x19')]=qs[_0x3967('0x19')](_0x37e2ba[_0x3967('0x2f')][_0x3967('0x19')]);}return _0x2b7b28[_0x3967('0x4a')](_0x21a94f);}})[_0x3967('0x24')](function(_0x48bb7d){if(_0x48bb7d){return _0x48bb7d?{'count':_0x33f698,'rows':_0x48bb7d}:null;}})['then'](respondWithResult(_0x2d6ba0,null))[_0x3967('0x43')](handleError(_0x2d6ba0,null));};exports[_0x3967('0x4b')]=function(_0x35e538,_0x4c91df,_0x48035c){var _0x3280b6={};var _0x9e059b={};var _0x5997de;var _0x58b047;return db[_0x3967('0x2a')]['findOne']({'where':{'id':_0x35e538[_0x3967('0x44')]['id']}})[_0x3967('0x24')](handleEntityNotFound(_0x4c91df,null))[_0x3967('0x24')](function(_0x5786eb){if(_0x5786eb){_0x5997de=_0x5786eb;_0x9e059b[_0x3967('0x2e')]=_[_0x3967('0x30')](db[_0x3967('0x4c')][_0x3967('0x2b')]);_0x9e059b[_0x3967('0x2f')]=_[_0x3967('0x30')](_0x35e538[_0x3967('0x2f')]);_0x9e059b[_0x3967('0x31')]=_['intersection'](_0x9e059b[_0x3967('0x2e')],_0x9e059b[_0x3967('0x2f')]);_0x3280b6[_0x3967('0x33')]=_[_0x3967('0x32')](_0x9e059b[_0x3967('0x2e')],qs[_0x3967('0x34')](_0x35e538[_0x3967('0x2f')][_0x3967('0x34')]));_0x3280b6[_0x3967('0x33')]=_0x3280b6[_0x3967('0x33')][_0x3967('0x35')]?_0x3280b6['attributes']:_0x9e059b[_0x3967('0x2e')];_0x3280b6['order']=qs[_0x3967('0x39')](_0x35e538[_0x3967('0x2f')][_0x3967('0x39')]);_0x3280b6[_0x3967('0x3c')]=qs[_0x3967('0x31')](_['pick'](_0x35e538[_0x3967('0x2f')],_0x9e059b[_0x3967('0x31')]));if(_0x35e538['query']['filter']){_0x3280b6[_0x3967('0x3c')]=_[_0x3967('0x3e')](_0x3280b6[_0x3967('0x3c')],{'$or':_[_0x3967('0x29')](_0x3280b6[_0x3967('0x33')],function(_0xb52a94){var _0x3a6983={};_0x3a6983[_0xb52a94]={'$like':'%'+_0x35e538['query'][_0x3967('0x3b')]+'%'};return _0x3a6983;})});}_0x3280b6=_[_0x3967('0x3e')]({},_0x3280b6,_0x35e538[_0x3967('0x3f')]);return _0x5997de[_0x3967('0x4b')](_0x3280b6);}})[_0x3967('0x24')](function(_0x3e423e){if(_0x3e423e){_0x58b047=_0x3e423e[_0x3967('0x35')];if(!_0x35e538[_0x3967('0x2f')][_0x3967('0x36')](_0x3967('0x37'))){_0x3280b6[_0x3967('0x1b')]=qs['limit'](_0x35e538[_0x3967('0x2f')][_0x3967('0x1b')]);_0x3280b6[_0x3967('0x19')]=qs[_0x3967('0x19')](_0x35e538[_0x3967('0x2f')][_0x3967('0x19')]);}return _0x5997de[_0x3967('0x4b')](_0x3280b6);}})[_0x3967('0x24')](function(_0x37f87d){if(_0x37f87d){return _0x37f87d?{'count':_0x58b047,'rows':_0x37f87d}:null;}})[_0x3967('0x24')](respondWithResult(_0x4c91df,null))[_0x3967('0x43')](handleError(_0x4c91df,null));};exports[_0x3967('0x4d')]=function(_0x4d4215,_0x2cebec,_0x1964b9){var _0x5deeec={};var _0x4f0123={};var _0x547f3c;var _0x846456;return db['ServicenowConfiguration'][_0x3967('0x4e')]({'where':{'id':_0x4d4215[_0x3967('0x44')]['id']}})[_0x3967('0x24')](handleEntityNotFound(_0x2cebec,null))[_0x3967('0x24')](function(_0x56c288){if(_0x56c288){_0x547f3c=_0x56c288;_0x4f0123[_0x3967('0x2e')]=_[_0x3967('0x30')](db[_0x3967('0x4c')][_0x3967('0x2b')]);_0x4f0123[_0x3967('0x2f')]=_[_0x3967('0x30')](_0x4d4215[_0x3967('0x2f')]);_0x4f0123[_0x3967('0x31')]=_[_0x3967('0x32')](_0x4f0123['model'],_0x4f0123[_0x3967('0x2f')]);_0x5deeec[_0x3967('0x33')]=_['intersection'](_0x4f0123[_0x3967('0x2e')],qs[_0x3967('0x34')](_0x4d4215[_0x3967('0x2f')][_0x3967('0x34')]));_0x5deeec[_0x3967('0x33')]=_0x5deeec[_0x3967('0x33')][_0x3967('0x35')]?_0x5deeec[_0x3967('0x33')]:_0x4f0123[_0x3967('0x2e')];_0x5deeec['order']=qs['sort'](_0x4d4215[_0x3967('0x2f')][_0x3967('0x39')]);_0x5deeec[_0x3967('0x3c')]=qs[_0x3967('0x31')](_[_0x3967('0x3a')](_0x4d4215[_0x3967('0x2f')],_0x4f0123[_0x3967('0x31')]));if(_0x4d4215[_0x3967('0x2f')][_0x3967('0x3b')]){_0x5deeec[_0x3967('0x3c')]=_[_0x3967('0x3e')](_0x5deeec['where'],{'$or':_[_0x3967('0x29')](_0x5deeec['attributes'],function(_0x47735e){var _0x3d25c1={};_0x3d25c1[_0x47735e]={'$like':'%'+_0x4d4215[_0x3967('0x2f')][_0x3967('0x3b')]+'%'};return _0x3d25c1;})});}_0x5deeec=_[_0x3967('0x3e')]({},_0x5deeec,_0x4d4215[_0x3967('0x3f')]);return _0x547f3c[_0x3967('0x4d')](_0x5deeec);}})['then'](function(_0x1b6690){if(_0x1b6690){_0x846456=_0x1b6690['length'];if(!_0x4d4215['query'][_0x3967('0x36')](_0x3967('0x37'))){_0x5deeec[_0x3967('0x1b')]=qs[_0x3967('0x1b')](_0x4d4215[_0x3967('0x2f')][_0x3967('0x1b')]);_0x5deeec['offset']=qs[_0x3967('0x19')](_0x4d4215[_0x3967('0x2f')]['offset']);}return _0x547f3c[_0x3967('0x4d')](_0x5deeec);}})['then'](function(_0x21ce31){if(_0x21ce31){return _0x21ce31?{'count':_0x846456,'rows':_0x21ce31}:null;}})[_0x3967('0x24')](respondWithResult(_0x2cebec,null))[_0x3967('0x43')](handleError(_0x2cebec,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index e79b942..ed2069b 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 _0x71f4=['api','moment','bluebird','request-promise','rimraf','./intServicenowConfiguration.attributes','define','ServicenowConfiguration','int_servicenow_configurations','../../config/logger'];(function(_0x5455cc,_0x30e037){var _0x58cab8=function(_0x1735a5){while(--_0x1735a5){_0x5455cc['push'](_0x5455cc['shift']());}};_0x58cab8(++_0x30e037);}(_0x71f4,0xf9));var _0x471f=function(_0xfacf25,_0x312501){_0xfacf25=_0xfacf25-0x0;var _0xf23e7c=_0x71f4[_0xfacf25];return _0xf23e7c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x471f('0x0'))(_0x471f('0x1'));var moment=require(_0x471f('0x2'));var BPromise=require(_0x471f('0x3'));var rp=require(_0x471f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x471f('0x5'));var config=require('../../config/environment');var attributes=require(_0x471f('0x6'));module['exports']=function(_0x1d0101,_0x3bdf82){return _0x1d0101[_0x471f('0x7')](_0x471f('0x8'),attributes,{'tableName':_0x471f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa958=['exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./intServicenowConfiguration.attributes'];(function(_0x8d0992,_0x26cb0d){var _0x5626ec=function(_0x11161e){while(--_0x11161e){_0x8d0992['push'](_0x8d0992['shift']());}};_0x5626ec(++_0x26cb0d);}(_0xa958,0x94));var _0x8a95=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xa958[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0x8a95('0x0'));var util=require('util');var logger=require(_0x8a95('0x1'))(_0x8a95('0x2'));var moment=require(_0x8a95('0x3'));var BPromise=require(_0x8a95('0x4'));var rp=require(_0x8a95('0x5'));var fs=require('fs');var path=require(_0x8a95('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8a95('0x7'));module[_0x8a95('0x8')]=function(_0x403364,_0x141f82){return _0x403364[_0x8a95('0x9')](_0x8a95('0xa'),attributes,{'tableName':_0x8a95('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 5965887..ee5ba31 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 _0xfe7c=['message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x3838a4,_0x2ae1e6){var _0x3c56b4=function(_0x4cbf64){while(--_0x4cbf64){_0x3838a4['push'](_0x3838a4['shift']());}};_0x3c56b4(++_0x2ae1e6);}(_0xfe7c,0xc8));var _0xcfe7=function(_0xa4c3d8,_0x5503c9){_0xa4c3d8=_0xa4c3d8-0x0;var _0x17dc5f=_0xfe7c[_0xa4c3d8];return _0x17dc5f;};'use strict';var _=require(_0xcfe7('0x0'));var util=require(_0xcfe7('0x1'));var moment=require(_0xcfe7('0x2'));var BPromise=require('bluebird');var rs=require(_0xcfe7('0x3'));var fs=require('fs');var Redis=require(_0xcfe7('0x4'));var db=require(_0xcfe7('0x5'))['db'];var utils=require(_0xcfe7('0x6'));var logger=require('../../config/logger')(_0xcfe7('0x7'));var config=require(_0xcfe7('0x8'));var jayson=require(_0xcfe7('0x9'));var client=jayson[_0xcfe7('0xa')][_0xcfe7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5945df,_0x240b56,_0x3ecad3){return new BPromise(function(_0x21148c,_0x23280b){return client[_0xcfe7('0xc')](_0x5945df,_0x3ecad3)['then'](function(_0x367a31){logger[_0xcfe7('0xd')](_0xcfe7('0xe'),_0x240b56,_0xcfe7('0xf'));logger[_0xcfe7('0x10')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x240b56,_0xcfe7('0xf'),JSON[_0xcfe7('0x11')](_0x367a31));if(_0x367a31[_0xcfe7('0x12')]){if(_0x367a31[_0xcfe7('0x12')][_0xcfe7('0x13')]===0x1f4){logger[_0xcfe7('0x12')](_0xcfe7('0xe'),_0x240b56,_0x367a31[_0xcfe7('0x12')]['message']);return _0x23280b(_0x367a31[_0xcfe7('0x12')]['message']);}logger['error'](_0xcfe7('0xe'),_0x240b56,_0x367a31['error'][_0xcfe7('0x14')]);return _0x21148c(_0x367a31[_0xcfe7('0x12')]['message']);}else{logger['info'](_0xcfe7('0xe'),_0x240b56,_0xcfe7('0xf'));_0x21148c(_0x367a31[_0xcfe7('0x15')][_0xcfe7('0x14')]);}})['catch'](function(_0x1b05cc){logger[_0xcfe7('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x240b56,_0x1b05cc);_0x23280b(_0x1b05cc);});});} \ No newline at end of file +var _0xad5f=['then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x10e302,_0x35a8c8){var _0x4b8dd4=function(_0x2597d9){while(--_0x2597d9){_0x10e302['push'](_0x10e302['shift']());}};_0x4b8dd4(++_0x35a8c8);}(_0xad5f,0x1a8));var _0xfad5=function(_0x1765dc,_0x17d194){_0x1765dc=_0x1765dc-0x0;var _0x5e7800=_0xad5f[_0x1765dc];return _0x5e7800;};'use strict';var _=require(_0xfad5('0x0'));var util=require(_0xfad5('0x1'));var moment=require(_0xfad5('0x2'));var BPromise=require(_0xfad5('0x3'));var rs=require(_0xfad5('0x4'));var fs=require('fs');var Redis=require(_0xfad5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfad5('0x6'));var logger=require(_0xfad5('0x7'))(_0xfad5('0x8'));var config=require(_0xfad5('0x9'));var jayson=require(_0xfad5('0xa'));var client=jayson[_0xfad5('0xb')][_0xfad5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5811f7,_0xf71084,_0x28566c){return new BPromise(function(_0x39d228,_0xbe8f56){return client['request'](_0x5811f7,_0x28566c)[_0xfad5('0xd')](function(_0xac127d){logger[_0xfad5('0xe')](_0xfad5('0xf'),_0xf71084,_0xfad5('0x10'));logger[_0xfad5('0x11')](_0xfad5('0x12'),_0xf71084,'request\x20sent',JSON[_0xfad5('0x13')](_0xac127d));if(_0xac127d[_0xfad5('0x14')]){if(_0xac127d[_0xfad5('0x14')]['code']===0x1f4){logger['error'](_0xfad5('0xf'),_0xf71084,_0xac127d[_0xfad5('0x14')][_0xfad5('0x15')]);return _0xbe8f56(_0xac127d[_0xfad5('0x14')][_0xfad5('0x15')]);}logger['error'](_0xfad5('0xf'),_0xf71084,_0xac127d[_0xfad5('0x14')][_0xfad5('0x15')]);return _0x39d228(_0xac127d[_0xfad5('0x14')][_0xfad5('0x15')]);}else{logger[_0xfad5('0xe')](_0xfad5('0xf'),_0xf71084,'request\x20sent');_0x39d228(_0xac127d['result'][_0xfad5('0x15')]);}})[_0xfad5('0x16')](function(_0x311e75){logger[_0xfad5('0x14')](_0xfad5('0xf'),_0xf71084,_0x311e75);_0xbe8f56(_0x311e75);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 4369430..807c1ed 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 _0xaecc=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./intServicenowField.controller','isAuthenticated','index','/:id','show','post','create','update','destroy'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xaecc,0x155));var _0xcaec=function(_0x58a1ef,_0x4938cd){_0x58a1ef=_0x58a1ef-0x0;var _0x384e65=_0xaecc[_0x58a1ef];return _0x384e65;};'use strict';var multer=require(_0xcaec('0x0'));var util=require(_0xcaec('0x1'));var path=require(_0xcaec('0x2'));var timeout=require(_0xcaec('0x3'));var express=require(_0xcaec('0x4'));var router=express['Router']();var fs_extra=require(_0xcaec('0x5'));var auth=require(_0xcaec('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xcaec('0x7'));router['get']('/',auth[_0xcaec('0x8')](),controller[_0xcaec('0x9')]);router['get'](_0xcaec('0xa'),auth[_0xcaec('0x8')](),controller[_0xcaec('0xb')]);router[_0xcaec('0xc')]('/',auth[_0xcaec('0x8')](),controller[_0xcaec('0xd')]);router['put'](_0xcaec('0xa'),auth[_0xcaec('0x8')](),controller[_0xcaec('0xe')]);router['delete'](_0xcaec('0xa'),auth['isAuthenticated'](),controller[_0xcaec('0xf')]);module[_0xcaec('0x10')]=router; \ No newline at end of file +var _0x95c6=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','post','put'];(function(_0x742108,_0x324b80){var _0x5391f4=function(_0x2e9704){while(--_0x2e9704){_0x742108['push'](_0x742108['shift']());}};_0x5391f4(++_0x324b80);}(_0x95c6,0x1de));var _0x695c=function(_0x290acf,_0x19563f){_0x290acf=_0x290acf-0x0;var _0x350eff=_0x95c6[_0x290acf];return _0x350eff;};'use strict';var multer=require(_0x695c('0x0'));var util=require(_0x695c('0x1'));var path=require(_0x695c('0x2'));var timeout=require(_0x695c('0x3'));var express=require(_0x695c('0x4'));var router=express[_0x695c('0x5')]();var fs_extra=require(_0x695c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x695c('0x7'));var config=require(_0x695c('0x8'));var controller=require(_0x695c('0x9'));router[_0x695c('0xa')]('/',auth[_0x695c('0xb')](),controller[_0x695c('0xc')]);router[_0x695c('0xa')](_0x695c('0xd'),auth[_0x695c('0xb')](),controller['show']);router[_0x695c('0xe')]('/',auth[_0x695c('0xb')](),controller['create']);router[_0x695c('0xf')]('/:id',auth[_0x695c('0xb')](),controller[_0x695c('0x10')]);router['delete'](_0x695c('0xd'),auth[_0x695c('0xb')](),controller[_0x695c('0x11')]);module[_0x695c('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index cd238c4..6d77f08 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 _0xe4e7=['ENUM','string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN','exports'];(function(_0x45a06f,_0x254a92){var _0x1dd577=function(_0x1afe49){while(--_0x1afe49){_0x45a06f['push'](_0x45a06f['shift']());}};_0x1dd577(++_0x254a92);}(_0xe4e7,0xf2));var _0x7e4e=function(_0x2b9630,_0x394f14){_0x2b9630=_0x2b9630-0x0;var _0x5cb3ba=_0xe4e7[_0x2b9630];return _0x5cb3ba;};'use strict';var Sequelize=require('sequelize');module[_0x7e4e('0x0')]={'type':{'type':Sequelize[_0x7e4e('0x1')](_0x7e4e('0x2'),'variable',_0x7e4e('0x3'),_0x7e4e('0x4'),_0x7e4e('0x5')),'defaultValue':_0x7e4e('0x2')},'content':{'type':Sequelize[_0x7e4e('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x7e4e('0x1')]('string',_0x7e4e('0x7'),_0x7e4e('0x3'))},'keyContent':{'type':Sequelize[_0x7e4e('0x6')]},'idField':{'type':Sequelize[_0x7e4e('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x7e4e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7e4e('0x6')]}}; \ No newline at end of file +var _0x12a1=['BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','STRING','customVariable'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x12a1,0x91));var _0x112a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x12a1[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x112a('0x0'));module[_0x112a('0x1')]={'type':{'type':Sequelize[_0x112a('0x2')](_0x112a('0x3'),_0x112a('0x4'),'customVariable',_0x112a('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x112a('0x6')]},'key':{'type':Sequelize[_0x112a('0x6')]},'keyType':{'type':Sequelize[_0x112a('0x2')](_0x112a('0x3'),'variable',_0x112a('0x7'))},'keyContent':{'type':Sequelize[_0x112a('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x112a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x112a('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index d55ded4..5435b36 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 _0xe7db=['mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','save','update','destroy','then','error','stack','name','map','ServicenowField','fieldName','type','key','query','keys','filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','rawAttributes','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird'];(function(_0x322522,_0x4db288){var _0x293bcf=function(_0xf108b8){while(--_0xf108b8){_0x322522['push'](_0x322522['shift']());}};_0x293bcf(++_0x4db288);}(_0xe7db,0x12b));var _0xbe7d=function(_0x37b0da,_0x42982f){_0x37b0da=_0x37b0da-0x0;var _0x18c5b6=_0xe7db[_0x37b0da];return _0x18c5b6;};'use strict';var emlformat=require(_0xbe7d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbe7d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbe7d('0x2'));var moment=require(_0xbe7d('0x3'));var BPromise=require(_0xbe7d('0x4'));var Mustache=require(_0xbe7d('0x5'));var util=require(_0xbe7d('0x6'));var path=require(_0xbe7d('0x7'));var sox=require(_0xbe7d('0x8'));var csv=require('to-csv');var ejs=require(_0xbe7d('0x9'));var fs=require('fs');var fs_extra=require(_0xbe7d('0xa'));var _=require(_0xbe7d('0xb'));var squel=require(_0xbe7d('0xc'));var crypto=require(_0xbe7d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbe7d('0xe'));var toCsv=require(_0xbe7d('0xf'));var querystring=require(_0xbe7d('0x10'));var Papa=require(_0xbe7d('0x11'));var Redis=require('ioredis');var authService=require(_0xbe7d('0x12'));var qs=require(_0xbe7d('0x13'));var as=require(_0xbe7d('0x14'));var hardwareService=require(_0xbe7d('0x15'));var logger=require(_0xbe7d('0x16'))(_0xbe7d('0x17'));var utils=require(_0xbe7d('0x18'));var config=require(_0xbe7d('0x19'));var licenseUtil=require(_0xbe7d('0x1a'));var db=require(_0xbe7d('0x1b'))['db'];function respondWithStatusCode(_0x123b24,_0x56aa51){_0x56aa51=_0x56aa51||0xcc;return function(_0x278526){if(_0x278526){return _0x123b24[_0xbe7d('0x1c')](_0x56aa51);}return _0x123b24[_0xbe7d('0x1d')](_0x56aa51)[_0xbe7d('0x1e')]();};}function respondWithResult(_0x2931e3,_0x4c90b4){_0x4c90b4=_0x4c90b4||0xc8;return function(_0x36595b){if(_0x36595b){return _0x2931e3[_0xbe7d('0x1d')](_0x4c90b4)['json'](_0x36595b);}};}function respondWithFilteredResult(_0xc84532,_0x2ac8de){return function(_0x424cde){if(_0x424cde){var _0x30c8cd=typeof _0x2ac8de[_0xbe7d('0x1f')]===_0xbe7d('0x20')&&typeof _0x2ac8de['limit']==='undefined';var _0x5945c0=_0x424cde[_0xbe7d('0x21')];var _0x3d727f=_0x30c8cd?0x0:_0x2ac8de[_0xbe7d('0x1f')];var _0x2bfec8=_0x30c8cd?_0x424cde['count']:_0x2ac8de[_0xbe7d('0x1f')]+_0x2ac8de[_0xbe7d('0x22')];var _0x5484fb;if(_0x2bfec8>=_0x5945c0){_0x2bfec8=_0x5945c0;_0x5484fb=0xc8;}else{_0x5484fb=0xce;}_0xc84532[_0xbe7d('0x1d')](_0x5484fb);return _0xc84532['set'](_0xbe7d('0x23'),_0x3d727f+'-'+_0x2bfec8+'/'+_0x5945c0)[_0xbe7d('0x24')](_0x424cde);}return null;};}function patchUpdates(_0x40c5e8){return function(_0x49d7da){try{jsonpatch[_0xbe7d('0x25')](_0x49d7da,_0x40c5e8,!![]);}catch(_0x54adad){return BPromise['reject'](_0x54adad);}return _0x49d7da[_0xbe7d('0x26')]();};}function saveUpdates(_0x349188,_0x303ba1){return function(_0x56f51e){if(_0x56f51e){return _0x56f51e[_0xbe7d('0x27')](_0x349188)['then'](function(_0x5502b8){return _0x5502b8;});}return null;};}function removeEntity(_0x2e6032,_0xadc2c5){return function(_0x1983b0){if(_0x1983b0){return _0x1983b0[_0xbe7d('0x28')]()[_0xbe7d('0x29')](function(){_0x2e6032[_0xbe7d('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36a056,_0x197bca){return function(_0x98a990){if(!_0x98a990){_0x36a056[_0xbe7d('0x1c')](0x194);}return _0x98a990;};}function handleError(_0x7fec1,_0x224fe1){_0x224fe1=_0x224fe1||0x1f4;return function(_0x48cace){logger[_0xbe7d('0x2a')](_0x48cace[_0xbe7d('0x2b')]);if(_0x48cace[_0xbe7d('0x2c')]){delete _0x48cace[_0xbe7d('0x2c')];}_0x7fec1[_0xbe7d('0x1d')](_0x224fe1)['send'](_0x48cace);};}exports['index']=function(_0x22ffae,_0x213d92){var _0x39a08e={},_0x2641b4={},_0x31222d={'count':0x0,'rows':[]};var _0xa2645d=_[_0xbe7d('0x2d')](db[_0xbe7d('0x2e')]['rawAttributes'],function(_0x1cfdd2){return{'name':_0x1cfdd2[_0xbe7d('0x2f')],'type':_0x1cfdd2[_0xbe7d('0x30')][_0xbe7d('0x31')]};});_0x2641b4['model']=_['map'](_0xa2645d,'name');_0x2641b4[_0xbe7d('0x32')]=_[_0xbe7d('0x33')](_0x22ffae[_0xbe7d('0x32')]);_0x2641b4[_0xbe7d('0x34')]=_[_0xbe7d('0x35')](_0x2641b4['model'],_0x2641b4[_0xbe7d('0x32')]);_0x39a08e['attributes']=_[_0xbe7d('0x35')](_0x2641b4['model'],qs[_0xbe7d('0x36')](_0x22ffae[_0xbe7d('0x32')][_0xbe7d('0x36')]));_0x39a08e[_0xbe7d('0x37')]=_0x39a08e[_0xbe7d('0x37')][_0xbe7d('0x38')]?_0x39a08e[_0xbe7d('0x37')]:_0x2641b4[_0xbe7d('0x39')];if(!_0x22ffae[_0xbe7d('0x32')][_0xbe7d('0x3a')](_0xbe7d('0x3b'))){_0x39a08e['limit']=qs[_0xbe7d('0x22')](_0x22ffae[_0xbe7d('0x32')]['limit']);_0x39a08e[_0xbe7d('0x1f')]=qs[_0xbe7d('0x1f')](_0x22ffae['query']['offset']);}_0x39a08e[_0xbe7d('0x3c')]=qs['sort'](_0x22ffae['query'][_0xbe7d('0x3d')]);_0x39a08e[_0xbe7d('0x3e')]=qs[_0xbe7d('0x34')](_['pick'](_0x22ffae[_0xbe7d('0x32')],_0x2641b4[_0xbe7d('0x34')]),_0xa2645d);if(_0x22ffae[_0xbe7d('0x32')][_0xbe7d('0x3f')]){_0x39a08e[_0xbe7d('0x3e')]=_[_0xbe7d('0x40')](_0x39a08e[_0xbe7d('0x3e')],{'$or':_[_0xbe7d('0x2d')](_0xa2645d,function(_0x2f8907){if(_0x2f8907[_0xbe7d('0x30')]!==_0xbe7d('0x41')){var _0x4e0fa9={};_0x4e0fa9[_0x2f8907[_0xbe7d('0x2c')]]={'$like':'%'+_0x22ffae[_0xbe7d('0x32')][_0xbe7d('0x3f')]+'%'};return _0x4e0fa9;}})});}_0x39a08e=_[_0xbe7d('0x40')]({},_0x39a08e,_0x22ffae[_0xbe7d('0x42')]);var _0x431470={'where':_0x39a08e['where']};return db[_0xbe7d('0x2e')][_0xbe7d('0x21')](_0x431470)[_0xbe7d('0x29')](function(_0x3796da){_0x31222d[_0xbe7d('0x21')]=_0x3796da;if(_0x22ffae['query'][_0xbe7d('0x43')]){_0x39a08e[_0xbe7d('0x44')]=[{'all':!![]}];}return db[_0xbe7d('0x2e')]['findAll'](_0x39a08e);})['then'](function(_0x4a795b){_0x31222d['rows']=_0x4a795b;return _0x31222d;})[_0xbe7d('0x29')](respondWithFilteredResult(_0x213d92,_0x39a08e))[_0xbe7d('0x45')](handleError(_0x213d92,null));};exports[_0xbe7d('0x46')]=function(_0x53f597,_0xb389de){var _0x2c7926={'raw':!![],'where':{'id':_0x53f597[_0xbe7d('0x47')]['id']}},_0x2df9f2={};_0x2df9f2[_0xbe7d('0x39')]=_[_0xbe7d('0x33')](db['ServicenowField'][_0xbe7d('0x48')]);_0x2df9f2[_0xbe7d('0x32')]=_[_0xbe7d('0x33')](_0x53f597[_0xbe7d('0x32')]);_0x2df9f2[_0xbe7d('0x34')]=_['intersection'](_0x2df9f2[_0xbe7d('0x39')],_0x2df9f2[_0xbe7d('0x32')]);_0x2c7926[_0xbe7d('0x37')]=_[_0xbe7d('0x35')](_0x2df9f2['model'],qs[_0xbe7d('0x36')](_0x53f597[_0xbe7d('0x32')]['fields']));_0x2c7926[_0xbe7d('0x37')]=_0x2c7926['attributes']['length']?_0x2c7926[_0xbe7d('0x37')]:_0x2df9f2[_0xbe7d('0x39')];if(_0x53f597[_0xbe7d('0x32')]['includeAll']){_0x2c7926['include']=[{'all':!![]}];}_0x2c7926=_[_0xbe7d('0x40')]({},_0x2c7926,_0x53f597[_0xbe7d('0x42')]);return db[_0xbe7d('0x2e')][_0xbe7d('0x49')](_0x2c7926)[_0xbe7d('0x29')](handleEntityNotFound(_0xb389de,null))[_0xbe7d('0x29')](respondWithResult(_0xb389de,null))[_0xbe7d('0x45')](handleError(_0xb389de,null));};exports['create']=function(_0x29a761,_0x4e4ef1){return db[_0xbe7d('0x2e')][_0xbe7d('0x4a')](_0x29a761[_0xbe7d('0x4b')],{})[_0xbe7d('0x29')](respondWithResult(_0x4e4ef1,0xc9))[_0xbe7d('0x45')](handleError(_0x4e4ef1,null));};exports[_0xbe7d('0x27')]=function(_0xee2e81,_0x508a79){if(_0xee2e81[_0xbe7d('0x4b')]['id']){delete _0xee2e81[_0xbe7d('0x4b')]['id'];}return db['ServicenowField'][_0xbe7d('0x49')]({'where':{'id':_0xee2e81[_0xbe7d('0x47')]['id']}})[_0xbe7d('0x29')](handleEntityNotFound(_0x508a79,null))[_0xbe7d('0x29')](saveUpdates(_0xee2e81[_0xbe7d('0x4b')],null))[_0xbe7d('0x29')](respondWithResult(_0x508a79,null))[_0xbe7d('0x45')](handleError(_0x508a79,null));};exports['destroy']=function(_0x364559,_0x12823e){return db[_0xbe7d('0x2e')]['find']({'where':{'id':_0x364559[_0xbe7d('0x47')]['id']}})[_0xbe7d('0x29')](handleEntityNotFound(_0x12823e,null))['then'](removeEntity(_0x12823e,null))[_0xbe7d('0x45')](handleError(_0x12823e,null));}; \ No newline at end of file +var _0x58a4=['offset','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','ServicenowField','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','catch','params','include','find','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x58a4,0x70));var _0x458a=function(_0x112a3e,_0x23f15c){_0x112a3e=_0x112a3e-0x0;var _0x577bfc=_0x58a4[_0x112a3e];return _0x577bfc;};'use strict';var emlformat=require(_0x458a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x458a('0x1'));var jsonpatch=require(_0x458a('0x2'));var rp=require('request-promise');var moment=require(_0x458a('0x3'));var BPromise=require(_0x458a('0x4'));var Mustache=require(_0x458a('0x5'));var util=require('util');var path=require('path');var sox=require(_0x458a('0x6'));var csv=require(_0x458a('0x7'));var ejs=require(_0x458a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x458a('0x9'));var jsforce=require(_0x458a('0xa'));var deskjs=require(_0x458a('0xb'));var toCsv=require('to-csv');var querystring=require(_0x458a('0xc'));var Papa=require(_0x458a('0xd'));var Redis=require(_0x458a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x458a('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x458a('0x10'));var logger=require(_0x458a('0x11'))(_0x458a('0x12'));var utils=require('../../config/utils');var config=require(_0x458a('0x13'));var licenseUtil=require(_0x458a('0x14'));var db=require(_0x458a('0x15'))['db'];function respondWithStatusCode(_0x42bdf0,_0x477916){_0x477916=_0x477916||0xcc;return function(_0x4d55d8){if(_0x4d55d8){return _0x42bdf0[_0x458a('0x16')](_0x477916);}return _0x42bdf0['status'](_0x477916)[_0x458a('0x17')]();};}function respondWithResult(_0x2217e9,_0x5359eb){_0x5359eb=_0x5359eb||0xc8;return function(_0x403e1a){if(_0x403e1a){return _0x2217e9[_0x458a('0x18')](_0x5359eb)['json'](_0x403e1a);}};}function respondWithFilteredResult(_0x1b7d2b,_0x4eb7f0){return function(_0x481db5){if(_0x481db5){var _0x4ed02d=typeof _0x4eb7f0['offset']===_0x458a('0x19')&&typeof _0x4eb7f0[_0x458a('0x1a')]===_0x458a('0x19');var _0x4191ec=_0x481db5[_0x458a('0x1b')];var _0xc61516=_0x4ed02d?0x0:_0x4eb7f0[_0x458a('0x1c')];var _0x50dfb4=_0x4ed02d?_0x481db5[_0x458a('0x1b')]:_0x4eb7f0[_0x458a('0x1c')]+_0x4eb7f0[_0x458a('0x1a')];var _0xe4b2c7;if(_0x50dfb4>=_0x4191ec){_0x50dfb4=_0x4191ec;_0xe4b2c7=0xc8;}else{_0xe4b2c7=0xce;}_0x1b7d2b['status'](_0xe4b2c7);return _0x1b7d2b[_0x458a('0x1d')](_0x458a('0x1e'),_0xc61516+'-'+_0x50dfb4+'/'+_0x4191ec)[_0x458a('0x1f')](_0x481db5);}return null;};}function patchUpdates(_0x21fcea){return function(_0x429149){try{jsonpatch[_0x458a('0x20')](_0x429149,_0x21fcea,!![]);}catch(_0x278890){return BPromise[_0x458a('0x21')](_0x278890);}return _0x429149[_0x458a('0x22')]();};}function saveUpdates(_0x4c8f3f,_0x4a6f86){return function(_0x5d96da){if(_0x5d96da){return _0x5d96da[_0x458a('0x23')](_0x4c8f3f)[_0x458a('0x24')](function(_0x3b5143){return _0x3b5143;});}return null;};}function removeEntity(_0x4476cb,_0xddfac0){return function(_0x8ea737){if(_0x8ea737){return _0x8ea737['destroy']()[_0x458a('0x24')](function(){_0x4476cb[_0x458a('0x18')](0xcc)[_0x458a('0x17')]();});}};}function handleEntityNotFound(_0x153fb7,_0x30c733){return function(_0x392dda){if(!_0x392dda){_0x153fb7[_0x458a('0x16')](0x194);}return _0x392dda;};}function handleError(_0x484515,_0xf59977){_0xf59977=_0xf59977||0x1f4;return function(_0x2f7caf){logger[_0x458a('0x25')](_0x2f7caf[_0x458a('0x26')]);if(_0x2f7caf['name']){delete _0x2f7caf[_0x458a('0x27')];}_0x484515['status'](_0xf59977)['send'](_0x2f7caf);};}exports['index']=function(_0x209128,_0x77a71f){var _0x4e7f0d={},_0x344bb6={},_0x397dcc={'count':0x0,'rows':[]};var _0x2f456d=_['map'](db[_0x458a('0x28')][_0x458a('0x29')],function(_0x2b2692){return{'name':_0x2b2692[_0x458a('0x2a')],'type':_0x2b2692[_0x458a('0x2b')][_0x458a('0x2c')]};});_0x344bb6[_0x458a('0x2d')]=_[_0x458a('0x2e')](_0x2f456d,_0x458a('0x27'));_0x344bb6['query']=_[_0x458a('0x2f')](_0x209128[_0x458a('0x30')]);_0x344bb6[_0x458a('0x31')]=_[_0x458a('0x32')](_0x344bb6['model'],_0x344bb6[_0x458a('0x30')]);_0x4e7f0d['attributes']=_[_0x458a('0x32')](_0x344bb6[_0x458a('0x2d')],qs[_0x458a('0x33')](_0x209128[_0x458a('0x30')][_0x458a('0x33')]));_0x4e7f0d[_0x458a('0x34')]=_0x4e7f0d[_0x458a('0x34')][_0x458a('0x35')]?_0x4e7f0d[_0x458a('0x34')]:_0x344bb6['model'];if(!_0x209128[_0x458a('0x30')][_0x458a('0x36')](_0x458a('0x37'))){_0x4e7f0d[_0x458a('0x1a')]=qs[_0x458a('0x1a')](_0x209128[_0x458a('0x30')]['limit']);_0x4e7f0d[_0x458a('0x1c')]=qs[_0x458a('0x1c')](_0x209128[_0x458a('0x30')][_0x458a('0x1c')]);}_0x4e7f0d[_0x458a('0x38')]=qs[_0x458a('0x39')](_0x209128[_0x458a('0x30')][_0x458a('0x39')]);_0x4e7f0d[_0x458a('0x3a')]=qs[_0x458a('0x31')](_['pick'](_0x209128[_0x458a('0x30')],_0x344bb6[_0x458a('0x31')]),_0x2f456d);if(_0x209128[_0x458a('0x30')][_0x458a('0x3b')]){_0x4e7f0d[_0x458a('0x3a')]=_[_0x458a('0x3c')](_0x4e7f0d['where'],{'$or':_[_0x458a('0x2e')](_0x2f456d,function(_0x16ade0){if(_0x16ade0[_0x458a('0x2b')]!==_0x458a('0x3d')){var _0x4b36e6={};_0x4b36e6[_0x16ade0[_0x458a('0x27')]]={'$like':'%'+_0x209128[_0x458a('0x30')][_0x458a('0x3b')]+'%'};return _0x4b36e6;}})});}_0x4e7f0d=_['merge']({},_0x4e7f0d,_0x209128[_0x458a('0x3e')]);var _0x3c8a94={'where':_0x4e7f0d['where']};return db[_0x458a('0x28')][_0x458a('0x1b')](_0x3c8a94)['then'](function(_0x4a97e7){_0x397dcc[_0x458a('0x1b')]=_0x4a97e7;if(_0x209128['query'][_0x458a('0x3f')]){_0x4e7f0d['include']=[{'all':!![]}];}return db[_0x458a('0x28')]['findAll'](_0x4e7f0d);})['then'](function(_0x2f610a){_0x397dcc['rows']=_0x2f610a;return _0x397dcc;})['then'](respondWithFilteredResult(_0x77a71f,_0x4e7f0d))[_0x458a('0x40')](handleError(_0x77a71f,null));};exports['show']=function(_0x4b70ea,_0x2ee1d6){var _0x105d8c={'raw':!![],'where':{'id':_0x4b70ea[_0x458a('0x41')]['id']}},_0x38dbb4={};_0x38dbb4[_0x458a('0x2d')]=_[_0x458a('0x2f')](db[_0x458a('0x28')][_0x458a('0x29')]);_0x38dbb4[_0x458a('0x30')]=_[_0x458a('0x2f')](_0x4b70ea['query']);_0x38dbb4[_0x458a('0x31')]=_[_0x458a('0x32')](_0x38dbb4[_0x458a('0x2d')],_0x38dbb4[_0x458a('0x30')]);_0x105d8c[_0x458a('0x34')]=_[_0x458a('0x32')](_0x38dbb4[_0x458a('0x2d')],qs['fields'](_0x4b70ea[_0x458a('0x30')]['fields']));_0x105d8c['attributes']=_0x105d8c['attributes'][_0x458a('0x35')]?_0x105d8c[_0x458a('0x34')]:_0x38dbb4[_0x458a('0x2d')];if(_0x4b70ea[_0x458a('0x30')][_0x458a('0x3f')]){_0x105d8c[_0x458a('0x42')]=[{'all':!![]}];}_0x105d8c=_[_0x458a('0x3c')]({},_0x105d8c,_0x4b70ea[_0x458a('0x3e')]);return db[_0x458a('0x28')][_0x458a('0x43')](_0x105d8c)['then'](handleEntityNotFound(_0x2ee1d6,null))[_0x458a('0x24')](respondWithResult(_0x2ee1d6,null))[_0x458a('0x40')](handleError(_0x2ee1d6,null));};exports[_0x458a('0x44')]=function(_0xaa5319,_0x38139f){return db['ServicenowField'][_0x458a('0x44')](_0xaa5319['body'],{})[_0x458a('0x24')](respondWithResult(_0x38139f,0xc9))[_0x458a('0x40')](handleError(_0x38139f,null));};exports[_0x458a('0x23')]=function(_0x21cd15,_0x268091){if(_0x21cd15['body']['id']){delete _0x21cd15[_0x458a('0x45')]['id'];}return db[_0x458a('0x28')][_0x458a('0x43')]({'where':{'id':_0x21cd15[_0x458a('0x41')]['id']}})[_0x458a('0x24')](handleEntityNotFound(_0x268091,null))[_0x458a('0x24')](saveUpdates(_0x21cd15[_0x458a('0x45')],null))[_0x458a('0x24')](respondWithResult(_0x268091,null))[_0x458a('0x40')](handleError(_0x268091,null));};exports['destroy']=function(_0x56e7b6,_0x54ccdc){return db[_0x458a('0x28')][_0x458a('0x43')]({'where':{'id':_0x56e7b6['params']['id']}})[_0x458a('0x24')](handleEntityNotFound(_0x54ccdc,null))[_0x458a('0x24')](removeEntity(_0x54ccdc,null))[_0x458a('0x40')](handleError(_0x54ccdc,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index dd93b23..98498a4 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 _0xefe0=['bluebird','request-promise','path','../../config/environment','./intServicenowField.attributes','exports','define','int_servicenow_fields','idField','lodash','util','../../config/logger','api','moment'];(function(_0x1b5805,_0x1d1f54){var _0x4b0de6=function(_0x40de7b){while(--_0x40de7b){_0x1b5805['push'](_0x1b5805['shift']());}};_0x4b0de6(++_0x1d1f54);}(_0xefe0,0xa3));var _0x0efe=function(_0x1aad88,_0x551794){_0x1aad88=_0x1aad88-0x0;var _0x1bbfe9=_0xefe0[_0x1aad88];return _0x1bbfe9;};'use strict';var _=require(_0x0efe('0x0'));var util=require(_0x0efe('0x1'));var logger=require(_0x0efe('0x2'))(_0x0efe('0x3'));var moment=require(_0x0efe('0x4'));var BPromise=require(_0x0efe('0x5'));var rp=require(_0x0efe('0x6'));var fs=require('fs');var path=require(_0x0efe('0x7'));var rimraf=require('rimraf');var config=require(_0x0efe('0x8'));var attributes=require(_0x0efe('0x9'));module[_0x0efe('0xa')]=function(_0x2aeb0f,_0xa4df89){return _0x2aeb0f[_0x0efe('0xb')]('ServicenowField',attributes,{'tableName':_0x0efe('0xc'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x0efe('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2048=['path','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x5bcdba,_0x2cf1d8){var _0x40f17c=function(_0x1f74b4){while(--_0x1f74b4){_0x5bcdba['push'](_0x5bcdba['shift']());}};_0x40f17c(++_0x2cf1d8);}(_0x2048,0x150));var _0x8204=function(_0x3fb947,_0x162636){_0x3fb947=_0x3fb947-0x0;var _0x2ced66=_0x2048[_0x3fb947];return _0x2ced66;};'use strict';var _=require(_0x8204('0x0'));var util=require('util');var logger=require(_0x8204('0x1'))('api');var moment=require(_0x8204('0x2'));var BPromise=require(_0x8204('0x3'));var rp=require(_0x8204('0x4'));var fs=require('fs');var path=require(_0x8204('0x5'));var rimraf=require('rimraf');var config=require(_0x8204('0x6'));var attributes=require(_0x8204('0x7'));module[_0x8204('0x8')]=function(_0x317cf9,_0xd98dff){return _0x317cf9[_0x8204('0x9')](_0x8204('0xa'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':['idField','FieldId'],'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 edb86a1..579699c 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 _0xbaf0=['client','http','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x74892f,_0x1e981b){var _0x10ee61=function(_0x3c480a){while(--_0x3c480a){_0x74892f['push'](_0x74892f['shift']());}};_0x10ee61(++_0x1e981b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});} \ No newline at end of file +var _0x9bde=['code','message','ServicenowField,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x30f798,_0xa28524){var _0x54dc45=function(_0x502e70){while(--_0x502e70){_0x30f798['push'](_0x30f798['shift']());}};_0x54dc45(++_0xa28524);}(_0x9bde,0xe1));var _0xe9bd=function(_0x55da49,_0x346ea2){_0x55da49=_0x55da49-0x0;var _0x253b4d=_0x9bde[_0x55da49];return _0x253b4d;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f18fe,_0x22a438,_0xa66ae2){return new BPromise(function(_0x2d5c75,_0x3ef9e3){return client[_0xe9bd('0xa')](_0x5f18fe,_0xa66ae2)[_0xe9bd('0xb')](function(_0x439abc){logger[_0xe9bd('0xc')]('ServicenowField,\x20%s,\x20%s',_0x22a438,'request\x20sent');logger[_0xe9bd('0xd')](_0xe9bd('0xe'),_0x22a438,_0xe9bd('0xf'),JSON['stringify'](_0x439abc));if(_0x439abc[_0xe9bd('0x10')]){if(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x11')]===0x1f4){logger[_0xe9bd('0x10')]('ServicenowField,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('ServicenowField,\x20%s,\x20%s',_0x22a438,_0x439abc['error'][_0xe9bd('0x12')]);return _0x2d5c75(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}else{logger[_0xe9bd('0xc')](_0xe9bd('0x13'),_0x22a438,_0xe9bd('0xf'));_0x2d5c75(_0x439abc[_0xe9bd('0x14')]['message']);}})[_0xe9bd('0x15')](function(_0x464a1b){logger[_0xe9bd('0x10')]('ServicenowField,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index c4a7e29..35cd7a2 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(_0xbcd55c,_0x418541){var _0x183a80=function(_0x33421e){while(--_0x33421e){_0xbcd55c['push'](_0xbcd55c['shift']());}};_0x183a80(++_0x418541);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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(_0x46556f,_0x5a947a){var _0x410d6d=function(_0x4ca869){while(--_0x4ca869){_0x46556f['push'](_0x46556f['shift']());}};_0x410d6d(++_0x5a947a);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 7fe551a..e82a586 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(_0x1fb280,_0x9af46b){var _0x50672a=function(_0x279233){while(--_0x279233){_0x1fb280['push'](_0x1fb280['shift']());}};_0x50672a(++_0x9af46b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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(_0x4bbc64,_0x4e75a8){var _0x455084=function(_0x5077ca){while(--_0x5077ca){_0x4bbc64['push'](_0x4bbc64['shift']());}};_0x455084(++_0x4e75a8);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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 948fb1a..7a26bfd 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 _0x1169=['Wrong\x20credentials','statusCode','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','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','undefined','count','offset','limit','Content-Range','json','apply','reject','update','then','stack','name','send','SugarcrmAccount','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','where','pick','filter','merge','map','includeAll','findAll','rows','catch','show','params','length','find','create','body','destroy','findOne','SugarcrmConfiguration','rawAttributes','order','sort','options','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','created_by','description','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','remoteUri','slice','lastIndexOf','POST','format','/service/v4_1/rest.php','JSON','PLAIN','Invalid\x20Login','Password\x20Expired','%s%s','stringify','values','remove','includes','label','endsWith','error','getFields,\x20%s,\x20%s,\x20%s','test'];(function(_0x49980e,_0x1af8d2){var _0x2eef7d=function(_0x5926c4){while(--_0x5926c4){_0x49980e['push'](_0x49980e['shift']());}};_0x2eef7d(++_0x1af8d2);}(_0x1169,0xe8));var _0x9116=function(_0x4516d5,_0x54e488){_0x4516d5=_0x4516d5-0x0;var _0x4134d0=_0x1169[_0x4516d5];return _0x4134d0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9116('0x0'));var rp=require(_0x9116('0x1'));var moment=require(_0x9116('0x2'));var BPromise=require(_0x9116('0x3'));var Mustache=require(_0x9116('0x4'));var util=require(_0x9116('0x5'));var path=require(_0x9116('0x6'));var sox=require(_0x9116('0x7'));var csv=require(_0x9116('0x8'));var ejs=require(_0x9116('0x9'));var fs=require('fs');var fs_extra=require(_0x9116('0xa'));var _=require(_0x9116('0xb'));var squel=require(_0x9116('0xc'));var crypto=require(_0x9116('0xd'));var jsforce=require(_0x9116('0xe'));var deskjs=require(_0x9116('0xf'));var toCsv=require(_0x9116('0x8'));var querystring=require('querystring');var Papa=require(_0x9116('0x10'));var Redis=require('ioredis');var authService=require(_0x9116('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9116('0x12'))(_0x9116('0x13'));var utils=require('../../config/utils');var config=require(_0x9116('0x14'));var licenseUtil=require(_0x9116('0x15'));var db=require(_0x9116('0x16'))['db'];var integrations=require(_0x9116('0x17'));function respondWithStatusCode(_0x572639,_0x4dfa1d){_0x4dfa1d=_0x4dfa1d||0xcc;return function(_0x3ef925){if(_0x3ef925){return _0x572639[_0x9116('0x18')](_0x4dfa1d);}return _0x572639[_0x9116('0x19')](_0x4dfa1d)[_0x9116('0x1a')]();};}function respondWithResult(_0x1f5583,_0x59c151){_0x59c151=_0x59c151||0xc8;return function(_0x2bae36){if(_0x2bae36){return _0x1f5583[_0x9116('0x19')](_0x59c151)['json'](_0x2bae36);}};}function respondWithFilteredResult(_0x38e992,_0x30b7e3){return function(_0x52b8a5){if(_0x52b8a5){var _0x4180ab=typeof _0x30b7e3['offset']==='undefined'&&typeof _0x30b7e3['limit']===_0x9116('0x1b');var _0x2378e0=_0x52b8a5[_0x9116('0x1c')];var _0x38d635=_0x4180ab?0x0:_0x30b7e3[_0x9116('0x1d')];var _0x4eb465=_0x4180ab?_0x52b8a5[_0x9116('0x1c')]:_0x30b7e3['offset']+_0x30b7e3[_0x9116('0x1e')];var _0x3d779a;if(_0x4eb465>=_0x2378e0){_0x4eb465=_0x2378e0;_0x3d779a=0xc8;}else{_0x3d779a=0xce;}_0x38e992[_0x9116('0x19')](_0x3d779a);return _0x38e992['set'](_0x9116('0x1f'),_0x38d635+'-'+_0x4eb465+'/'+_0x2378e0)[_0x9116('0x20')](_0x52b8a5);}return null;};}function patchUpdates(_0x3e71ae){return function(_0x47efde){try{jsonpatch[_0x9116('0x21')](_0x47efde,_0x3e71ae,!![]);}catch(_0x5a58f9){return BPromise[_0x9116('0x22')](_0x5a58f9);}return _0x47efde['save']();};}function saveUpdates(_0x226079,_0x34bdae){return function(_0x313bbf){if(_0x313bbf){return _0x313bbf[_0x9116('0x23')](_0x226079)[_0x9116('0x24')](function(_0x16eb27){return _0x16eb27;});}return null;};}function removeEntity(_0x688c9e,_0x524978){return function(_0x51e077){if(_0x51e077){return _0x51e077['destroy']()[_0x9116('0x24')](function(){_0x688c9e['status'](0xcc)[_0x9116('0x1a')]();});}};}function handleEntityNotFound(_0xeed9bf,_0x5c0c1e){return function(_0x1a2a7f){if(!_0x1a2a7f){_0xeed9bf[_0x9116('0x18')](0x194);}return _0x1a2a7f;};}function handleError(_0x468bcb,_0xa52e42){_0xa52e42=_0xa52e42||0x1f4;return function(_0x2b66cb){logger['error'](_0x2b66cb[_0x9116('0x25')]);if(_0x2b66cb[_0x9116('0x26')]){delete _0x2b66cb[_0x9116('0x26')];}_0x468bcb[_0x9116('0x19')](_0xa52e42)[_0x9116('0x27')](_0x2b66cb);};}exports['index']=function(_0x38e7d9,_0x28dcda){var _0x2466df={},_0x2c5a58={},_0x49d001={'count':0x0,'rows':[]};var _0x548267=_['map'](db[_0x9116('0x28')]['rawAttributes'],function(_0x3b2f6e){return{'name':_0x3b2f6e[_0x9116('0x29')],'type':_0x3b2f6e[_0x9116('0x2a')][_0x9116('0x2b')]};});_0x2c5a58[_0x9116('0x2c')]=_['map'](_0x548267,'name');_0x2c5a58[_0x9116('0x2d')]=_[_0x9116('0x2e')](_0x38e7d9[_0x9116('0x2d')]);_0x2c5a58[_0x9116('0x2f')]=_['intersection'](_0x2c5a58[_0x9116('0x2c')],_0x2c5a58[_0x9116('0x2d')]);_0x2466df[_0x9116('0x30')]=_[_0x9116('0x31')](_0x2c5a58[_0x9116('0x2c')],qs['fields'](_0x38e7d9[_0x9116('0x2d')][_0x9116('0x32')]));_0x2466df[_0x9116('0x30')]=_0x2466df[_0x9116('0x30')]['length']?_0x2466df[_0x9116('0x30')]:_0x2c5a58[_0x9116('0x2c')];if(!_0x38e7d9[_0x9116('0x2d')][_0x9116('0x33')](_0x9116('0x34'))){_0x2466df['limit']=qs[_0x9116('0x1e')](_0x38e7d9[_0x9116('0x2d')][_0x9116('0x1e')]);_0x2466df[_0x9116('0x1d')]=qs[_0x9116('0x1d')](_0x38e7d9[_0x9116('0x2d')][_0x9116('0x1d')]);}_0x2466df['order']=qs['sort'](_0x38e7d9[_0x9116('0x2d')]['sort']);_0x2466df[_0x9116('0x35')]=qs['filters'](_[_0x9116('0x36')](_0x38e7d9[_0x9116('0x2d')],_0x2c5a58['filters']),_0x548267);if(_0x38e7d9[_0x9116('0x2d')][_0x9116('0x37')]){_0x2466df[_0x9116('0x35')]=_[_0x9116('0x38')](_0x2466df[_0x9116('0x35')],{'$or':_[_0x9116('0x39')](_0x548267,function(_0x1d82ad){if(_0x1d82ad['type']!=='VIRTUAL'){var _0x5a3f49={};_0x5a3f49[_0x1d82ad[_0x9116('0x26')]]={'$like':'%'+_0x38e7d9[_0x9116('0x2d')][_0x9116('0x37')]+'%'};return _0x5a3f49;}})});}_0x2466df=_[_0x9116('0x38')]({},_0x2466df,_0x38e7d9['options']);var _0x25ea8e={'where':_0x2466df[_0x9116('0x35')]};return db['SugarcrmAccount'][_0x9116('0x1c')](_0x25ea8e)[_0x9116('0x24')](function(_0x55c212){_0x49d001[_0x9116('0x1c')]=_0x55c212;if(_0x38e7d9[_0x9116('0x2d')][_0x9116('0x3a')]){_0x2466df['include']=[{'all':!![]}];}return db[_0x9116('0x28')][_0x9116('0x3b')](_0x2466df);})['then'](function(_0x517ce0){_0x49d001[_0x9116('0x3c')]=_0x517ce0;return _0x49d001;})[_0x9116('0x24')](respondWithFilteredResult(_0x28dcda,_0x2466df))[_0x9116('0x3d')](handleError(_0x28dcda,null));};exports[_0x9116('0x3e')]=function(_0x3880d0,_0x55ca62){var _0xdc42fe={'raw':![],'where':{'id':_0x3880d0[_0x9116('0x3f')]['id']}},_0x526293={};_0x526293['model']=_['keys'](db[_0x9116('0x28')]['rawAttributes']);_0x526293[_0x9116('0x2d')]=_[_0x9116('0x2e')](_0x3880d0['query']);_0x526293[_0x9116('0x2f')]=_['intersection'](_0x526293[_0x9116('0x2c')],_0x526293['query']);_0xdc42fe[_0x9116('0x30')]=_['intersection'](_0x526293[_0x9116('0x2c')],qs[_0x9116('0x32')](_0x3880d0[_0x9116('0x2d')]['fields']));_0xdc42fe[_0x9116('0x30')]=_0xdc42fe['attributes'][_0x9116('0x40')]?_0xdc42fe['attributes']:_0x526293[_0x9116('0x2c')];if(_0x3880d0[_0x9116('0x2d')][_0x9116('0x3a')]){_0xdc42fe['include']=[{'all':!![]}];}_0xdc42fe=_['merge']({},_0xdc42fe,_0x3880d0['options']);return db['SugarcrmAccount'][_0x9116('0x41')](_0xdc42fe)['then'](handleEntityNotFound(_0x55ca62,null))[_0x9116('0x24')](respondWithResult(_0x55ca62,null))[_0x9116('0x3d')](handleError(_0x55ca62,null));};exports[_0x9116('0x42')]=function(_0x7d049b,_0x2e0398){return db[_0x9116('0x28')]['create'](_0x7d049b['body'],{})[_0x9116('0x24')](respondWithResult(_0x2e0398,0xc9))[_0x9116('0x3d')](handleError(_0x2e0398,null));};exports['update']=function(_0x1462f7,_0x3e259b){if(_0x1462f7[_0x9116('0x43')]['id']){delete _0x1462f7[_0x9116('0x43')]['id'];}return db[_0x9116('0x28')][_0x9116('0x41')]({'where':{'id':_0x1462f7[_0x9116('0x3f')]['id']}})[_0x9116('0x24')](handleEntityNotFound(_0x3e259b,null))['then'](saveUpdates(_0x1462f7[_0x9116('0x43')],null))[_0x9116('0x24')](respondWithResult(_0x3e259b,null))[_0x9116('0x3d')](handleError(_0x3e259b,null));};exports[_0x9116('0x44')]=function(_0x566ade,_0x5d33f5){return db[_0x9116('0x28')][_0x9116('0x41')]({'where':{'id':_0x566ade[_0x9116('0x3f')]['id']}})[_0x9116('0x24')](handleEntityNotFound(_0x5d33f5,null))[_0x9116('0x24')](removeEntity(_0x5d33f5,null))[_0x9116('0x3d')](handleError(_0x5d33f5,null));};exports['getConfigurations']=function(_0x286d06,_0x1ea19c,_0x59d60b){var _0x425f43={};var _0x15fcf5={};var _0x510fab;var _0x4ddecd;return db[_0x9116('0x28')][_0x9116('0x45')]({'where':{'id':_0x286d06['params']['id']}})['then'](handleEntityNotFound(_0x1ea19c,null))[_0x9116('0x24')](function(_0x10510e){if(_0x10510e){_0x510fab=_0x10510e;_0x15fcf5[_0x9116('0x2c')]=_[_0x9116('0x2e')](db[_0x9116('0x46')][_0x9116('0x47')]);_0x15fcf5[_0x9116('0x2d')]=_['keys'](_0x286d06[_0x9116('0x2d')]);_0x15fcf5['filters']=_['intersection'](_0x15fcf5[_0x9116('0x2c')],_0x15fcf5[_0x9116('0x2d')]);_0x425f43[_0x9116('0x30')]=_[_0x9116('0x31')](_0x15fcf5[_0x9116('0x2c')],qs[_0x9116('0x32')](_0x286d06[_0x9116('0x2d')][_0x9116('0x32')]));_0x425f43[_0x9116('0x30')]=_0x425f43[_0x9116('0x30')][_0x9116('0x40')]?_0x425f43['attributes']:_0x15fcf5['model'];_0x425f43[_0x9116('0x48')]=qs[_0x9116('0x49')](_0x286d06[_0x9116('0x2d')]['sort']);_0x425f43['where']=qs[_0x9116('0x2f')](_[_0x9116('0x36')](_0x286d06[_0x9116('0x2d')],_0x15fcf5[_0x9116('0x2f')]));if(_0x286d06[_0x9116('0x2d')][_0x9116('0x37')]){_0x425f43['where']=_['merge'](_0x425f43[_0x9116('0x35')],{'$or':_['map'](_0x425f43['attributes'],function(_0x848559){var _0xd3d27e={};_0xd3d27e[_0x848559]={'$like':'%'+_0x286d06[_0x9116('0x2d')][_0x9116('0x37')]+'%'};return _0xd3d27e;})});}_0x425f43=_[_0x9116('0x38')]({},_0x425f43,_0x286d06[_0x9116('0x4a')]);return _0x510fab[_0x9116('0x4b')](_0x425f43);}})[_0x9116('0x24')](function(_0x1f3356){if(_0x1f3356){_0x4ddecd=_0x1f3356[_0x9116('0x40')];if(!_0x286d06[_0x9116('0x2d')][_0x9116('0x33')]('nolimit')){_0x425f43[_0x9116('0x1e')]=qs[_0x9116('0x1e')](_0x286d06[_0x9116('0x2d')]['limit']);_0x425f43[_0x9116('0x1d')]=qs[_0x9116('0x1d')](_0x286d06[_0x9116('0x2d')]['offset']);}return _0x510fab[_0x9116('0x4b')](_0x425f43);}})[_0x9116('0x24')](function(_0x51d030){if(_0x51d030){return _0x51d030?{'count':_0x4ddecd,'rows':_0x51d030}:null;}})['then'](respondWithResult(_0x1ea19c,null))[_0x9116('0x3d')](handleError(_0x1ea19c,null));};exports[_0x9116('0x4c')]=function(_0x53ac03,_0x367428,_0x97150f){if(_0x53ac03[_0x9116('0x43')]['id']){delete _0x53ac03[_0x9116('0x43')]['id'];}return db['SugarcrmAccount'][_0x9116('0x45')]({'where':{'id':_0x53ac03['params']['id']}})[_0x9116('0x24')](handleEntityNotFound(_0x367428,null))['then'](function(_0x4d2530){if(_0x4d2530){_0x53ac03[_0x9116('0x43')][_0x9116('0x4d')]=_0x4d2530['id'];_0x53ac03['body'][_0x9116('0x4e')]=integrations[_0x9116('0x4f')](_0x53ac03[_0x9116('0x43')][_0x9116('0x50')],_0x53ac03[_0x9116('0x43')]['type']);_0x53ac03['body'][_0x9116('0x51')]=integrations[_0x9116('0x52')](_0x53ac03[_0x9116('0x43')][_0x9116('0x50')],_0x53ac03[_0x9116('0x43')][_0x9116('0x2a')]);return db[_0x9116('0x46')]['create'](_0x53ac03[_0x9116('0x43')],{'include':[{'model':db['SugarcrmField'],'as':_0x9116('0x4e')},{'model':db[_0x9116('0x53')],'as':_0x9116('0x51')}]});}return null;})['then'](respondWithResult(_0x367428,null))[_0x9116('0x3d')](handleError(_0x367428,null));};exports['getFields']=function(_0x32a8b7,_0x2c2d31,_0x326aa8){var _0x5e0a83='';var _0x41da05=['id',_0x9116('0x26'),'assigned_user_id',_0x9116('0x54'),_0x9116('0x55'),'date_start',_0x9116('0x56'),_0x9116('0x57'),_0x9116('0x58'),_0x9116('0x59'),_0x9116('0x5a'),_0x9116('0x5b')];return db[_0x9116('0x28')][_0x9116('0x45')]({'where':{'id':_0x32a8b7[_0x9116('0x3f')]['id']},'attributes':['id',_0x9116('0x5c'),'password','remoteUri']})[_0x9116('0x24')](handleEntityNotFound(_0x2c2d31,null))[_0x9116('0x24')](function(_0x599614){if(_0x599614){_0x5e0a83=_0x599614[_0x9116('0x5d')];var _0x2bbae6=_0x5e0a83[_0x9116('0x5e')](-0x1);if(_0x2bbae6==='/'){_0x5e0a83=_0x5e0a83['substring'](0x0,_0x5e0a83[_0x9116('0x5f')](_0x2bbae6));}return rp({'method':_0x9116('0x60'),'uri':util[_0x9116('0x61')]('%s%s',_0x5e0a83,_0x9116('0x62')),'json':!![],'form':{'method':'login','input_type':_0x9116('0x63'),'response_type':_0x9116('0x63'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x599614[_0x9116('0x5c')],'password':_0x599614['password'],'encryption':_0x9116('0x64')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x9116('0x24')](function(_0xf52104){if(_0xf52104&&_0xf52104[_0x9116('0x26')]!==_0x9116('0x65')&&_0xf52104[_0x9116('0x26')]!==_0x9116('0x66')){return rp({'method':'POST','uri':util[_0x9116('0x61')](_0x9116('0x67'),_0x5e0a83,_0x9116('0x62')),'json':!![],'form':{'method':'get_module_fields','input_type':_0x9116('0x63'),'response_type':'JSON','rest_data':JSON[_0x9116('0x68')]({'session':_0xf52104['id'],'module_name':'Calls'})}})[_0x9116('0x24')](function(_0x137b09){if(_0x137b09){var _0x2e7d03=_[_0x9116('0x69')](_0x137b09['module_fields']);_[_0x9116('0x6a')](_0x2e7d03,function(_0x586011){return _0x41da05[_0x9116('0x6b')](_0x586011[_0x9116('0x26')]);});return{'count':_0x2e7d03[_0x9116('0x40')],'rows':_[_0x9116('0x39')](_0x2e7d03,function(_0x5d61ed){return{'id':_0x5d61ed[_0x9116('0x26')],'name':_0x5d61ed[_0x9116('0x6c')],'custom':_[_0x9116('0x6d')](_0x5d61ed['name'],'_c')?!![]:![],'options':_0x5d61ed[_0x9116('0x4a')]?_['map'](_[_0x9116('0x69')](_0x5d61ed[_0x9116('0x4a')]),function(_0x2648f9){return{'name':_0x2648f9['value'],'value':_0x2648f9[_0x9116('0x26')]};}):[]};})};}})[_0x9116('0x24')](respondWithResult(_0x2c2d31,null))[_0x9116('0x3d')](function(_0x25c929){var _0x25c101=_0x32a8b7['query']['test']?0x1f4:_0x25c929['statusCode']||0x1f4;logger[_0x9116('0x6e')](_0x9116('0x6f'),'getFields',_0x25c101,JSON[_0x9116('0x68')](_0x25c929));delete _0x25c929['name'];if(_0x25c101===0x191){_0x25c101=0x190;}_0x2c2d31['status'](_0x25c101)[_0x9116('0x27')](_0x32a8b7[_0x9116('0x2d')][_0x9116('0x70')]?{'message':_0x9116('0x71'),'statusCode':_0x25c929[_0x9116('0x72')]}:_0x25c929);});}else{var _0x53441b=0x1f4;_0x2c2d31[_0x9116('0x19')](_0x53441b)[_0x9116('0x27')]({'message':_0x9116('0x71'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x6150=['findAll','rows','catch','show','keys','rawAttributes','includeAll','include','find','create','body','params','getConfigurations','findOne','SugarcrmConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','assigned_user_id','created_by','date_start','duration_hours','parent_type','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','JSON','stringify','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','values','label','endsWith','value','test','statusCode','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','update','destroy','error','stack','name','index','map','SugarcrmAccount','fieldName','type','key','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','merge','where','VIRTUAL','filter','options','then'];(function(_0x2ae2ad,_0xac5b0c){var _0x26dbd7=function(_0x5e685b){while(--_0x5e685b){_0x2ae2ad['push'](_0x2ae2ad['shift']());}};_0x26dbd7(++_0xac5b0c);}(_0x6150,0xb2));var _0x0615=function(_0x2d2013,_0x35d948){_0x2d2013=_0x2d2013-0x0;var _0x2e6169=_0x6150[_0x2d2013];return _0x2e6169;};'use strict';var emlformat=require(_0x0615('0x0'));var rimraf=require(_0x0615('0x1'));var zipdir=require(_0x0615('0x2'));var jsonpatch=require(_0x0615('0x3'));var rp=require(_0x0615('0x4'));var moment=require(_0x0615('0x5'));var BPromise=require(_0x0615('0x6'));var Mustache=require(_0x0615('0x7'));var util=require(_0x0615('0x8'));var path=require(_0x0615('0x9'));var sox=require(_0x0615('0xa'));var csv=require(_0x0615('0xb'));var ejs=require(_0x0615('0xc'));var fs=require('fs');var fs_extra=require(_0x0615('0xd'));var _=require(_0x0615('0xe'));var squel=require(_0x0615('0xf'));var crypto=require(_0x0615('0x10'));var jsforce=require(_0x0615('0x11'));var deskjs=require(_0x0615('0x12'));var toCsv=require('to-csv');var querystring=require(_0x0615('0x13'));var Papa=require(_0x0615('0x14'));var Redis=require(_0x0615('0x15'));var authService=require(_0x0615('0x16'));var qs=require(_0x0615('0x17'));var as=require(_0x0615('0x18'));var hardwareService=require(_0x0615('0x19'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0615('0x1a'));var db=require(_0x0615('0x1b'))['db'];var integrations=require(_0x0615('0x1c'));function respondWithStatusCode(_0x2b8939,_0x1546bd){_0x1546bd=_0x1546bd||0xcc;return function(_0x4e79b6){if(_0x4e79b6){return _0x2b8939[_0x0615('0x1d')](_0x1546bd);}return _0x2b8939[_0x0615('0x1e')](_0x1546bd)[_0x0615('0x1f')]();};}function respondWithResult(_0x3e6f56,_0x4cae49){_0x4cae49=_0x4cae49||0xc8;return function(_0x4af6a1){if(_0x4af6a1){return _0x3e6f56[_0x0615('0x1e')](_0x4cae49)[_0x0615('0x20')](_0x4af6a1);}};}function respondWithFilteredResult(_0x1f8fc7,_0x5f2116){return function(_0x3c5b2d){if(_0x3c5b2d){var _0x575472=typeof _0x5f2116[_0x0615('0x21')]==='undefined'&&typeof _0x5f2116[_0x0615('0x22')]===_0x0615('0x23');var _0x4ddf3d=_0x3c5b2d['count'];var _0x1db527=_0x575472?0x0:_0x5f2116['offset'];var _0x29d00d=_0x575472?_0x3c5b2d[_0x0615('0x24')]:_0x5f2116['offset']+_0x5f2116[_0x0615('0x22')];var _0x33a920;if(_0x29d00d>=_0x4ddf3d){_0x29d00d=_0x4ddf3d;_0x33a920=0xc8;}else{_0x33a920=0xce;}_0x1f8fc7[_0x0615('0x1e')](_0x33a920);return _0x1f8fc7['set'](_0x0615('0x25'),_0x1db527+'-'+_0x29d00d+'/'+_0x4ddf3d)[_0x0615('0x20')](_0x3c5b2d);}return null;};}function patchUpdates(_0x45fc39){return function(_0x3cb689){try{jsonpatch[_0x0615('0x26')](_0x3cb689,_0x45fc39,!![]);}catch(_0x2e28fd){return BPromise['reject'](_0x2e28fd);}return _0x3cb689[_0x0615('0x27')]();};}function saveUpdates(_0x4817aa,_0x4e70e7){return function(_0x5d0f87){if(_0x5d0f87){return _0x5d0f87[_0x0615('0x28')](_0x4817aa)['then'](function(_0x577492){return _0x577492;});}return null;};}function removeEntity(_0x4a1a40,_0x5d9731){return function(_0x47f7b7){if(_0x47f7b7){return _0x47f7b7[_0x0615('0x29')]()['then'](function(){_0x4a1a40[_0x0615('0x1e')](0xcc)[_0x0615('0x1f')]();});}};}function handleEntityNotFound(_0x389bfb,_0x124ccf){return function(_0x148a7c){if(!_0x148a7c){_0x389bfb[_0x0615('0x1d')](0x194);}return _0x148a7c;};}function handleError(_0x34bfe4,_0x36455){_0x36455=_0x36455||0x1f4;return function(_0x452aad){logger[_0x0615('0x2a')](_0x452aad[_0x0615('0x2b')]);if(_0x452aad[_0x0615('0x2c')]){delete _0x452aad[_0x0615('0x2c')];}_0x34bfe4[_0x0615('0x1e')](_0x36455)['send'](_0x452aad);};}exports[_0x0615('0x2d')]=function(_0x26ad8d,_0x2335bd){var _0x1d497f={},_0x514e64={},_0x1a9bc4={'count':0x0,'rows':[]};var _0x2beabd=_[_0x0615('0x2e')](db[_0x0615('0x2f')]['rawAttributes'],function(_0x5395e4){return{'name':_0x5395e4[_0x0615('0x30')],'type':_0x5395e4[_0x0615('0x31')][_0x0615('0x32')]};});_0x514e64['model']=_[_0x0615('0x2e')](_0x2beabd,_0x0615('0x2c'));_0x514e64['query']=_['keys'](_0x26ad8d['query']);_0x514e64[_0x0615('0x33')]=_[_0x0615('0x34')](_0x514e64[_0x0615('0x35')],_0x514e64[_0x0615('0x36')]);_0x1d497f[_0x0615('0x37')]=_[_0x0615('0x34')](_0x514e64[_0x0615('0x35')],qs['fields'](_0x26ad8d[_0x0615('0x36')][_0x0615('0x38')]));_0x1d497f['attributes']=_0x1d497f[_0x0615('0x37')][_0x0615('0x39')]?_0x1d497f[_0x0615('0x37')]:_0x514e64['model'];if(!_0x26ad8d[_0x0615('0x36')][_0x0615('0x3a')](_0x0615('0x3b'))){_0x1d497f[_0x0615('0x22')]=qs[_0x0615('0x22')](_0x26ad8d['query'][_0x0615('0x22')]);_0x1d497f[_0x0615('0x21')]=qs[_0x0615('0x21')](_0x26ad8d[_0x0615('0x36')][_0x0615('0x21')]);}_0x1d497f[_0x0615('0x3c')]=qs['sort'](_0x26ad8d['query'][_0x0615('0x3d')]);_0x1d497f['where']=qs[_0x0615('0x33')](_['pick'](_0x26ad8d[_0x0615('0x36')],_0x514e64[_0x0615('0x33')]),_0x2beabd);if(_0x26ad8d[_0x0615('0x36')]['filter']){_0x1d497f['where']=_[_0x0615('0x3e')](_0x1d497f[_0x0615('0x3f')],{'$or':_[_0x0615('0x2e')](_0x2beabd,function(_0x3b2177){if(_0x3b2177[_0x0615('0x31')]!==_0x0615('0x40')){var _0x3c03bb={};_0x3c03bb[_0x3b2177[_0x0615('0x2c')]]={'$like':'%'+_0x26ad8d[_0x0615('0x36')][_0x0615('0x41')]+'%'};return _0x3c03bb;}})});}_0x1d497f=_['merge']({},_0x1d497f,_0x26ad8d[_0x0615('0x42')]);var _0xb3a1d4={'where':_0x1d497f[_0x0615('0x3f')]};return db['SugarcrmAccount'][_0x0615('0x24')](_0xb3a1d4)[_0x0615('0x43')](function(_0x472d52){_0x1a9bc4[_0x0615('0x24')]=_0x472d52;if(_0x26ad8d[_0x0615('0x36')]['includeAll']){_0x1d497f['include']=[{'all':!![]}];}return db[_0x0615('0x2f')][_0x0615('0x44')](_0x1d497f);})[_0x0615('0x43')](function(_0x4d11aa){_0x1a9bc4[_0x0615('0x45')]=_0x4d11aa;return _0x1a9bc4;})[_0x0615('0x43')](respondWithFilteredResult(_0x2335bd,_0x1d497f))[_0x0615('0x46')](handleError(_0x2335bd,null));};exports[_0x0615('0x47')]=function(_0x52befc,_0x9a4a7a){var _0x495efa={'raw':![],'where':{'id':_0x52befc['params']['id']}},_0x1db88d={};_0x1db88d[_0x0615('0x35')]=_[_0x0615('0x48')](db[_0x0615('0x2f')][_0x0615('0x49')]);_0x1db88d[_0x0615('0x36')]=_[_0x0615('0x48')](_0x52befc[_0x0615('0x36')]);_0x1db88d[_0x0615('0x33')]=_[_0x0615('0x34')](_0x1db88d[_0x0615('0x35')],_0x1db88d[_0x0615('0x36')]);_0x495efa['attributes']=_[_0x0615('0x34')](_0x1db88d[_0x0615('0x35')],qs[_0x0615('0x38')](_0x52befc[_0x0615('0x36')][_0x0615('0x38')]));_0x495efa['attributes']=_0x495efa[_0x0615('0x37')][_0x0615('0x39')]?_0x495efa['attributes']:_0x1db88d[_0x0615('0x35')];if(_0x52befc[_0x0615('0x36')][_0x0615('0x4a')]){_0x495efa[_0x0615('0x4b')]=[{'all':!![]}];}_0x495efa=_[_0x0615('0x3e')]({},_0x495efa,_0x52befc['options']);return db[_0x0615('0x2f')][_0x0615('0x4c')](_0x495efa)[_0x0615('0x43')](handleEntityNotFound(_0x9a4a7a,null))[_0x0615('0x43')](respondWithResult(_0x9a4a7a,null))[_0x0615('0x46')](handleError(_0x9a4a7a,null));};exports['create']=function(_0x2f335b,_0x493f54){return db[_0x0615('0x2f')][_0x0615('0x4d')](_0x2f335b[_0x0615('0x4e')],{})[_0x0615('0x43')](respondWithResult(_0x493f54,0xc9))['catch'](handleError(_0x493f54,null));};exports[_0x0615('0x28')]=function(_0x4bb52e,_0x43ef7b){if(_0x4bb52e['body']['id']){delete _0x4bb52e[_0x0615('0x4e')]['id'];}return db[_0x0615('0x2f')][_0x0615('0x4c')]({'where':{'id':_0x4bb52e[_0x0615('0x4f')]['id']}})[_0x0615('0x43')](handleEntityNotFound(_0x43ef7b,null))['then'](saveUpdates(_0x4bb52e['body'],null))[_0x0615('0x43')](respondWithResult(_0x43ef7b,null))['catch'](handleError(_0x43ef7b,null));};exports[_0x0615('0x29')]=function(_0xbf68be,_0x2b5106){return db[_0x0615('0x2f')]['find']({'where':{'id':_0xbf68be[_0x0615('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2b5106,null))[_0x0615('0x43')](removeEntity(_0x2b5106,null))[_0x0615('0x46')](handleError(_0x2b5106,null));};exports[_0x0615('0x50')]=function(_0x57963e,_0x1c62c8,_0x11d313){var _0x303385={};var _0x161877={};var _0x1ce627;var _0x45640b;return db[_0x0615('0x2f')][_0x0615('0x51')]({'where':{'id':_0x57963e[_0x0615('0x4f')]['id']}})[_0x0615('0x43')](handleEntityNotFound(_0x1c62c8,null))[_0x0615('0x43')](function(_0x579114){if(_0x579114){_0x1ce627=_0x579114;_0x161877[_0x0615('0x35')]=_[_0x0615('0x48')](db[_0x0615('0x52')]['rawAttributes']);_0x161877[_0x0615('0x36')]=_[_0x0615('0x48')](_0x57963e[_0x0615('0x36')]);_0x161877['filters']=_['intersection'](_0x161877[_0x0615('0x35')],_0x161877[_0x0615('0x36')]);_0x303385[_0x0615('0x37')]=_[_0x0615('0x34')](_0x161877[_0x0615('0x35')],qs[_0x0615('0x38')](_0x57963e[_0x0615('0x36')][_0x0615('0x38')]));_0x303385[_0x0615('0x37')]=_0x303385['attributes']['length']?_0x303385['attributes']:_0x161877[_0x0615('0x35')];_0x303385[_0x0615('0x3c')]=qs[_0x0615('0x3d')](_0x57963e[_0x0615('0x36')][_0x0615('0x3d')]);_0x303385[_0x0615('0x3f')]=qs[_0x0615('0x33')](_[_0x0615('0x53')](_0x57963e[_0x0615('0x36')],_0x161877[_0x0615('0x33')]));if(_0x57963e[_0x0615('0x36')][_0x0615('0x41')]){_0x303385[_0x0615('0x3f')]=_[_0x0615('0x3e')](_0x303385['where'],{'$or':_[_0x0615('0x2e')](_0x303385[_0x0615('0x37')],function(_0x1ed043){var _0x438d03={};_0x438d03[_0x1ed043]={'$like':'%'+_0x57963e[_0x0615('0x36')][_0x0615('0x41')]+'%'};return _0x438d03;})});}_0x303385=_[_0x0615('0x3e')]({},_0x303385,_0x57963e[_0x0615('0x42')]);return _0x1ce627[_0x0615('0x50')](_0x303385);}})[_0x0615('0x43')](function(_0x270cab){if(_0x270cab){_0x45640b=_0x270cab[_0x0615('0x39')];if(!_0x57963e[_0x0615('0x36')][_0x0615('0x3a')](_0x0615('0x3b'))){_0x303385['limit']=qs[_0x0615('0x22')](_0x57963e[_0x0615('0x36')][_0x0615('0x22')]);_0x303385[_0x0615('0x21')]=qs['offset'](_0x57963e['query']['offset']);}return _0x1ce627['getConfigurations'](_0x303385);}})[_0x0615('0x43')](function(_0x47cead){if(_0x47cead){return _0x47cead?{'count':_0x45640b,'rows':_0x47cead}:null;}})[_0x0615('0x43')](respondWithResult(_0x1c62c8,null))['catch'](handleError(_0x1c62c8,null));};exports[_0x0615('0x54')]=function(_0x3e5ab7,_0x477fdc,_0x451553){if(_0x3e5ab7[_0x0615('0x4e')]['id']){delete _0x3e5ab7['body']['id'];}return db['SugarcrmAccount'][_0x0615('0x51')]({'where':{'id':_0x3e5ab7[_0x0615('0x4f')]['id']}})['then'](handleEntityNotFound(_0x477fdc,null))[_0x0615('0x43')](function(_0x1ed515){if(_0x1ed515){_0x3e5ab7[_0x0615('0x4e')][_0x0615('0x55')]=_0x1ed515['id'];_0x3e5ab7[_0x0615('0x4e')][_0x0615('0x56')]=integrations[_0x0615('0x57')](_0x3e5ab7[_0x0615('0x4e')][_0x0615('0x58')],_0x3e5ab7['body']['type']);_0x3e5ab7['body'][_0x0615('0x59')]=integrations[_0x0615('0x5a')](_0x3e5ab7[_0x0615('0x4e')][_0x0615('0x58')],_0x3e5ab7[_0x0615('0x4e')][_0x0615('0x31')]);return db[_0x0615('0x52')]['create'](_0x3e5ab7['body'],{'include':[{'model':db[_0x0615('0x5b')],'as':_0x0615('0x56')},{'model':db['SugarcrmField'],'as':_0x0615('0x59')}]});}return null;})[_0x0615('0x43')](respondWithResult(_0x477fdc,null))[_0x0615('0x46')](handleError(_0x477fdc,null));};exports['getFields']=function(_0xb15837,_0x3e131f,_0xa3a013){var _0x3ecf12='';var _0x239bdc=['id',_0x0615('0x2c'),_0x0615('0x5c'),_0x0615('0x5d'),'description',_0x0615('0x5e'),_0x0615('0x5f'),'duration_minutes','parent_id',_0x0615('0x60'),'parent_name',_0x0615('0x61')];return db['SugarcrmAccount']['findOne']({'where':{'id':_0xb15837[_0x0615('0x4f')]['id']},'attributes':['id',_0x0615('0x62'),_0x0615('0x63'),_0x0615('0x64')]})[_0x0615('0x43')](handleEntityNotFound(_0x3e131f,null))[_0x0615('0x43')](function(_0x417c28){if(_0x417c28){_0x3ecf12=_0x417c28['remoteUri'];var _0x1fc1d5=_0x3ecf12[_0x0615('0x65')](-0x1);if(_0x1fc1d5==='/'){_0x3ecf12=_0x3ecf12[_0x0615('0x66')](0x0,_0x3ecf12[_0x0615('0x67')](_0x1fc1d5));}return rp({'method':_0x0615('0x68'),'uri':util[_0x0615('0x69')](_0x0615('0x6a'),_0x3ecf12,_0x0615('0x6b')),'json':!![],'form':{'method':'login','input_type':_0x0615('0x6c'),'response_type':_0x0615('0x6c'),'rest_data':JSON[_0x0615('0x6d')]({'user_auth':{'user_name':_0x417c28[_0x0615('0x62')],'password':_0x417c28[_0x0615('0x63')],'encryption':'PLAIN'},'application':_0x0615('0x6e')})}});}})[_0x0615('0x43')](function(_0x5b9ac7){if(_0x5b9ac7&&_0x5b9ac7['name']!==_0x0615('0x6f')&&_0x5b9ac7[_0x0615('0x2c')]!==_0x0615('0x70')){return rp({'method':_0x0615('0x68'),'uri':util[_0x0615('0x69')](_0x0615('0x6a'),_0x3ecf12,_0x0615('0x6b')),'json':!![],'form':{'method':_0x0615('0x71'),'input_type':_0x0615('0x6c'),'response_type':'JSON','rest_data':JSON[_0x0615('0x6d')]({'session':_0x5b9ac7['id'],'module_name':_0x0615('0x72')})}})[_0x0615('0x43')](function(_0x26d81e){if(_0x26d81e){var _0x52f727=_[_0x0615('0x73')](_0x26d81e['module_fields']);_['remove'](_0x52f727,function(_0x4d7ebf){return _0x239bdc['includes'](_0x4d7ebf[_0x0615('0x2c')]);});return{'count':_0x52f727[_0x0615('0x39')],'rows':_[_0x0615('0x2e')](_0x52f727,function(_0x2e6550){return{'id':_0x2e6550[_0x0615('0x2c')],'name':_0x2e6550[_0x0615('0x74')],'custom':_[_0x0615('0x75')](_0x2e6550['name'],'_c')?!![]:![],'options':_0x2e6550[_0x0615('0x42')]?_[_0x0615('0x2e')](_[_0x0615('0x73')](_0x2e6550['options']),function(_0x4c3f57){return{'name':_0x4c3f57[_0x0615('0x76')],'value':_0x4c3f57[_0x0615('0x2c')]};}):[]};})};}})[_0x0615('0x43')](respondWithResult(_0x3e131f,null))[_0x0615('0x46')](function(_0x37a408){var _0x2998db=_0xb15837[_0x0615('0x36')][_0x0615('0x77')]?0x1f4:_0x37a408[_0x0615('0x78')]||0x1f4;logger[_0x0615('0x2a')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x2998db,JSON['stringify'](_0x37a408));delete _0x37a408[_0x0615('0x2c')];if(_0x2998db===0x191){_0x2998db=0x190;}_0x3e131f[_0x0615('0x1e')](_0x2998db)[_0x0615('0x79')](_0xb15837['query'][_0x0615('0x77')]?{'message':_0x0615('0x7a'),'statusCode':_0x37a408[_0x0615('0x78')]}:_0x37a408);});}else{var _0x20e5db=0x1f4;_0x3e131f[_0x0615('0x1e')](_0x20e5db)['send']({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 3d41cec..5d04b9b 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 _0x337f=['rimraf','../../config/environment','../../components/integrations/configuration','define','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x5ad692,_0x1bf686){var _0x2d34ae=function(_0x3cd62f){while(--_0x3cd62f){_0x5ad692['push'](_0x5ad692['shift']());}};_0x2d34ae(++_0x1bf686);}(_0x337f,0x11c));var _0xf337=function(_0x3e4cbb,_0x1ec2fd){_0x3e4cbb=_0x3e4cbb-0x0;var _0x78c593=_0x337f[_0x3e4cbb];return _0x78c593;};'use strict';var _=require(_0xf337('0x0'));var util=require(_0xf337('0x1'));var logger=require(_0xf337('0x2'))('api');var moment=require(_0xf337('0x3'));var BPromise=require(_0xf337('0x4'));var rp=require(_0xf337('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf337('0x6'));var config=require(_0xf337('0x7'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0xf337('0x8'));module['exports']=function(_0x4580a3,_0x5ae4d6){return _0x4580a3[_0xf337('0x9')]('SugarcrmAccount',attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa000=['define','SugarcrmAccount','int_sugarcrm_accounts','util','../../config/logger','moment','request-promise','path','rimraf','./intSugarcrmAccount.attributes','exports'];(function(_0x472d44,_0x28e3b7){var _0x285048=function(_0x349ffe){while(--_0x349ffe){_0x472d44['push'](_0x472d44['shift']());}};_0x285048(++_0x28e3b7);}(_0xa000,0x18f));var _0x0a00=function(_0x80daab,_0x3e82b7){_0x80daab=_0x80daab-0x0;var _0x201c7a=_0xa000[_0x80daab];return _0x201c7a;};'use strict';var _=require('lodash');var util=require(_0x0a00('0x0'));var logger=require(_0x0a00('0x1'))('api');var moment=require(_0x0a00('0x2'));var BPromise=require('bluebird');var rp=require(_0x0a00('0x3'));var fs=require('fs');var path=require(_0x0a00('0x4'));var rimraf=require(_0x0a00('0x5'));var config=require('../../config/environment');var attributes=require(_0x0a00('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x0a00('0x7')]=function(_0xb2c74c,_0x72ffc){return _0xb2c74c[_0x0a00('0x8')](_0x0a00('0x9'),attributes,{'tableName':_0x0a00('0xa'),'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 a15a629..41e387e 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 _0xc8ac=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','where','attributes','limit','include','model','map','ShowSugarcrmAccount','find','raw','lodash','util','moment','bluebird','ioredis'];(function(_0x588fb3,_0x15cc42){var _0x4fbb9a=function(_0x5292ca){while(--_0x5292ca){_0x588fb3['push'](_0x588fb3['shift']());}};_0x4fbb9a(++_0x15cc42);}(_0xc8ac,0xe9));var _0xcc8a=function(_0x4c2623,_0x4838bb){_0x4c2623=_0x4c2623-0x0;var _0x2be431=_0xc8ac[_0x4c2623];return _0x2be431;};'use strict';var _=require(_0xcc8a('0x0'));var util=require(_0xcc8a('0x1'));var moment=require(_0xcc8a('0x2'));var BPromise=require(_0xcc8a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcc8a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcc8a('0x5'));var logger=require(_0xcc8a('0x6'))(_0xcc8a('0x7'));var config=require(_0xcc8a('0x8'));var jayson=require(_0xcc8a('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1904fa,_0x40d548,_0x3bd2e3){return new BPromise(function(_0x4e4982,_0x55031d){return client[_0xcc8a('0xa')](_0x1904fa,_0x3bd2e3)[_0xcc8a('0xb')](function(_0x5f3565){logger[_0xcc8a('0xc')](_0xcc8a('0xd'),_0x40d548,'request\x20sent');logger[_0xcc8a('0xe')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x40d548,'request\x20sent',JSON[_0xcc8a('0xf')](_0x5f3565));if(_0x5f3565[_0xcc8a('0x10')]){if(_0x5f3565[_0xcc8a('0x10')][_0xcc8a('0x11')]===0x1f4){logger[_0xcc8a('0x10')](_0xcc8a('0xd'),_0x40d548,_0x5f3565[_0xcc8a('0x10')][_0xcc8a('0x12')]);return _0x55031d(_0x5f3565[_0xcc8a('0x10')][_0xcc8a('0x12')]);}logger[_0xcc8a('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x40d548,_0x5f3565[_0xcc8a('0x10')][_0xcc8a('0x12')]);return _0x4e4982(_0x5f3565[_0xcc8a('0x10')][_0xcc8a('0x12')]);}else{logger[_0xcc8a('0xc')](_0xcc8a('0xd'),_0x40d548,'request\x20sent');_0x4e4982(_0x5f3565[_0xcc8a('0x13')][_0xcc8a('0x12')]);}})[_0xcc8a('0x14')](function(_0x2b40c2){logger[_0xcc8a('0x10')](_0xcc8a('0xd'),_0x40d548,_0x2b40c2);_0x55031d(_0x2b40c2);});});}exports[_0xcc8a('0x15')]=function(_0x49189d){var _0x50d87b=this;return new Promise(function(_0x20f13f,_0x38b8a1){return db[_0xcc8a('0x16')][_0xcc8a('0x17')]({'raw':_0x49189d['options']?_0x49189d[_0xcc8a('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x49189d[_0xcc8a('0x18')]?_0x49189d[_0xcc8a('0x18')][_0xcc8a('0x19')]||null:null,'attributes':_0x49189d['options']?_0x49189d[_0xcc8a('0x18')][_0xcc8a('0x1a')]||null:null,'limit':_0x49189d['options']?_0x49189d[_0xcc8a('0x18')][_0xcc8a('0x1b')]||null:null,'include':_0x49189d[_0xcc8a('0x18')]?_0x49189d[_0xcc8a('0x18')][_0xcc8a('0x1c')]?_['map'](_0x49189d[_0xcc8a('0x18')][_0xcc8a('0x1c')],function(_0x536fea){return{'model':db[_0x536fea[_0xcc8a('0x1d')]],'as':_0x536fea['as'],'attributes':_0x536fea[_0xcc8a('0x1a')],'include':_0x536fea['include']?_[_0xcc8a('0x1e')](_0x536fea[_0xcc8a('0x1c')],function(_0x22ce21){return{'model':db[_0x22ce21[_0xcc8a('0x1d')]],'as':_0x22ce21['as'],'attributes':_0x22ce21[_0xcc8a('0x1a')],'include':_0x22ce21[_0xcc8a('0x1c')]?_[_0xcc8a('0x1e')](_0x22ce21[_0xcc8a('0x1c')],function(_0x33ea69){return{'model':db[_0x33ea69[_0xcc8a('0x1d')]],'as':_0x33ea69['as'],'attributes':_0x33ea69[_0xcc8a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xcc8a('0xb')](function(_0x4ad499){logger[_0xcc8a('0xc')](_0xcc8a('0x15'),_0x49189d);logger['debug'](_0xcc8a('0x15'),_0x49189d,JSON[_0xcc8a('0xf')](_0x4ad499));_0x20f13f(_0x4ad499);})[_0xcc8a('0x14')](function(_0xa05041){logger['error'](_0xcc8a('0x15'),_0xa05041[_0xcc8a('0x12')],_0x49189d);_0x38b8a1(_0x50d87b[_0xcc8a('0x10')](0x1f4,_0xa05041[_0xcc8a('0x12')]));});});};exports[_0xcc8a('0x1f')]=function(_0x213957){var _0x2a877f=this;return new Promise(function(_0x3a9031,_0x597a76){return db['SugarcrmAccount'][_0xcc8a('0x20')]({'raw':_0x213957['options']?_0x213957[_0xcc8a('0x18')][_0xcc8a('0x21')]===undefined?!![]:![]:!![],'where':_0x213957['options']?_0x213957[_0xcc8a('0x18')]['where']||null:null,'attributes':_0x213957['options']?_0x213957[_0xcc8a('0x18')][_0xcc8a('0x1a')]||null:null,'include':_0x213957[_0xcc8a('0x18')]?_0x213957[_0xcc8a('0x18')]['include']?_['map'](_0x213957[_0xcc8a('0x18')][_0xcc8a('0x1c')],function(_0x3c262a){return{'model':db[_0x3c262a[_0xcc8a('0x1d')]],'as':_0x3c262a['as'],'attributes':_0x3c262a[_0xcc8a('0x1a')],'include':_0x3c262a[_0xcc8a('0x1c')]?_[_0xcc8a('0x1e')](_0x3c262a[_0xcc8a('0x1c')],function(_0x22a4cf){return{'model':db[_0x22a4cf[_0xcc8a('0x1d')]],'as':_0x22a4cf['as'],'attributes':_0x22a4cf[_0xcc8a('0x1a')],'include':_0x22a4cf[_0xcc8a('0x1c')]?_['map'](_0x22a4cf[_0xcc8a('0x1c')],function(_0x26c577){return{'model':db[_0x26c577[_0xcc8a('0x1d')]],'as':_0x26c577['as'],'attributes':_0x26c577['attributes']};}):[]};}):[]};}):[]:[]})[_0xcc8a('0xb')](function(_0x5bce62){logger['info'](_0xcc8a('0x1f'),_0x213957);logger['debug'](_0xcc8a('0x1f'),_0x213957,JSON[_0xcc8a('0xf')](_0x5bce62));_0x3a9031(_0x5bce62);})[_0xcc8a('0x14')](function(_0x374984){logger[_0xcc8a('0x10')]('ShowSugarcrmAccount',_0x374984[_0xcc8a('0x12')],_0x213957);_0x597a76(_0x2a877f[_0xcc8a('0x10')](0x1f4,_0x374984[_0xcc8a('0x12')]));});});}; \ No newline at end of file +var _0x608c=['raw','where','attributes','include','map','model','ShowSugarcrmAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options'];(function(_0x564dab,_0x141238){var _0x1c69d0=function(_0x49bec5){while(--_0x49bec5){_0x564dab['push'](_0x564dab['shift']());}};_0x1c69d0(++_0x141238);}(_0x608c,0x74));var _0xc608=function(_0x3ae1c8,_0x4f1c21){_0x3ae1c8=_0x3ae1c8-0x0;var _0x5a2621=_0x608c[_0x3ae1c8];return _0x5a2621;};'use strict';var _=require(_0xc608('0x0'));var util=require(_0xc608('0x1'));var moment=require(_0xc608('0x2'));var BPromise=require(_0xc608('0x3'));var rs=require(_0xc608('0x4'));var fs=require('fs');var Redis=require(_0xc608('0x5'));var db=require(_0xc608('0x6'))['db'];var utils=require(_0xc608('0x7'));var logger=require(_0xc608('0x8'))(_0xc608('0x9'));var config=require(_0xc608('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xc608('0xb')][_0xc608('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4121db,_0x2461af,_0x3964d5){return new BPromise(function(_0x509a56,_0x152ed6){return client['request'](_0x4121db,_0x3964d5)[_0xc608('0xd')](function(_0x1e2573){logger[_0xc608('0xe')](_0xc608('0xf'),_0x2461af,_0xc608('0x10'));logger[_0xc608('0x11')](_0xc608('0x12'),_0x2461af,_0xc608('0x10'),JSON[_0xc608('0x13')](_0x1e2573));if(_0x1e2573[_0xc608('0x14')]){if(_0x1e2573[_0xc608('0x14')][_0xc608('0x15')]===0x1f4){logger['error'](_0xc608('0xf'),_0x2461af,_0x1e2573[_0xc608('0x14')]['message']);return _0x152ed6(_0x1e2573[_0xc608('0x14')][_0xc608('0x16')]);}logger['error'](_0xc608('0xf'),_0x2461af,_0x1e2573[_0xc608('0x14')][_0xc608('0x16')]);return _0x509a56(_0x1e2573['error'][_0xc608('0x16')]);}else{logger[_0xc608('0xe')](_0xc608('0xf'),_0x2461af,_0xc608('0x10'));_0x509a56(_0x1e2573['result'][_0xc608('0x16')]);}})[_0xc608('0x17')](function(_0x516369){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x2461af,_0x516369);_0x152ed6(_0x516369);});});}exports[_0xc608('0x18')]=function(_0x4b8ab9){var _0x211ca4=this;return new Promise(function(_0x1f5a9b,_0x55f93a){return db[_0xc608('0x19')][_0xc608('0x1a')]({'raw':_0x4b8ab9[_0xc608('0x1b')]?_0x4b8ab9['options'][_0xc608('0x1c')]===undefined?!![]:![]:!![],'where':_0x4b8ab9[_0xc608('0x1b')]?_0x4b8ab9[_0xc608('0x1b')][_0xc608('0x1d')]||null:null,'attributes':_0x4b8ab9['options']?_0x4b8ab9[_0xc608('0x1b')][_0xc608('0x1e')]||null:null,'limit':_0x4b8ab9[_0xc608('0x1b')]?_0x4b8ab9[_0xc608('0x1b')]['limit']||null:null,'include':_0x4b8ab9[_0xc608('0x1b')]?_0x4b8ab9[_0xc608('0x1b')][_0xc608('0x1f')]?_[_0xc608('0x20')](_0x4b8ab9[_0xc608('0x1b')][_0xc608('0x1f')],function(_0x2cf260){return{'model':db[_0x2cf260[_0xc608('0x21')]],'as':_0x2cf260['as'],'attributes':_0x2cf260[_0xc608('0x1e')],'include':_0x2cf260['include']?_[_0xc608('0x20')](_0x2cf260[_0xc608('0x1f')],function(_0x1216a2){return{'model':db[_0x1216a2[_0xc608('0x21')]],'as':_0x1216a2['as'],'attributes':_0x1216a2[_0xc608('0x1e')],'include':_0x1216a2['include']?_[_0xc608('0x20')](_0x1216a2[_0xc608('0x1f')],function(_0xf8b26f){return{'model':db[_0xf8b26f[_0xc608('0x21')]],'as':_0xf8b26f['as'],'attributes':_0xf8b26f[_0xc608('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc608('0xd')](function(_0x4e8680){logger[_0xc608('0xe')](_0xc608('0x18'),_0x4b8ab9);logger[_0xc608('0x11')](_0xc608('0x18'),_0x4b8ab9,JSON['stringify'](_0x4e8680));_0x1f5a9b(_0x4e8680);})[_0xc608('0x17')](function(_0x407d3d){logger['error'](_0xc608('0x18'),_0x407d3d[_0xc608('0x16')],_0x4b8ab9);_0x55f93a(_0x211ca4['error'](0x1f4,_0x407d3d[_0xc608('0x16')]));});});};exports[_0xc608('0x22')]=function(_0x8599e4){var _0x43ee97=this;return new Promise(function(_0x5bb4ec,_0x164a0f){return db[_0xc608('0x19')][_0xc608('0x23')]({'raw':_0x8599e4[_0xc608('0x1b')]?_0x8599e4[_0xc608('0x1b')][_0xc608('0x1c')]===undefined?!![]:![]:!![],'where':_0x8599e4['options']?_0x8599e4[_0xc608('0x1b')][_0xc608('0x1d')]||null:null,'attributes':_0x8599e4['options']?_0x8599e4[_0xc608('0x1b')][_0xc608('0x1e')]||null:null,'include':_0x8599e4['options']?_0x8599e4['options'][_0xc608('0x1f')]?_['map'](_0x8599e4[_0xc608('0x1b')][_0xc608('0x1f')],function(_0x5a8727){return{'model':db[_0x5a8727[_0xc608('0x21')]],'as':_0x5a8727['as'],'attributes':_0x5a8727[_0xc608('0x1e')],'include':_0x5a8727[_0xc608('0x1f')]?_['map'](_0x5a8727[_0xc608('0x1f')],function(_0x3aed91){return{'model':db[_0x3aed91[_0xc608('0x21')]],'as':_0x3aed91['as'],'attributes':_0x3aed91['attributes'],'include':_0x3aed91[_0xc608('0x1f')]?_['map'](_0x3aed91[_0xc608('0x1f')],function(_0x27c187){return{'model':db[_0x27c187[_0xc608('0x21')]],'as':_0x27c187['as'],'attributes':_0x27c187[_0xc608('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc608('0xd')](function(_0x4c0bb8){logger[_0xc608('0xe')](_0xc608('0x22'),_0x8599e4);logger['debug'](_0xc608('0x22'),_0x8599e4,JSON[_0xc608('0x13')](_0x4c0bb8));_0x5bb4ec(_0x4c0bb8);})[_0xc608('0x17')](function(_0xf793b){logger[_0xc608('0x14')](_0xc608('0x22'),_0xf793b[_0xc608('0x16')],_0x8599e4);_0x164a0f(_0x43ee97[_0xc608('0x14')](0x1f4,_0xf793b[_0xc608('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index c275ab1..1bd2735 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 _0xa9ba=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','/:id','delete','destroy','exports','util','path'];(function(_0x3e5e03,_0x2fac27){var _0x45279e=function(_0xb0f1c8){while(--_0xb0f1c8){_0x3e5e03['push'](_0x3e5e03['shift']());}};_0x45279e(++_0x2fac27);}(_0xa9ba,0x16e));var _0xaa9b=function(_0x21451e,_0x291c58){_0x21451e=_0x21451e-0x0;var _0x387e1b=_0xa9ba[_0x21451e];return _0x387e1b;};'use strict';var multer=require('multer');var util=require(_0xaa9b('0x0'));var path=require(_0xaa9b('0x1'));var timeout=require(_0xaa9b('0x2'));var express=require(_0xaa9b('0x3'));var router=express[_0xaa9b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xaa9b('0x5'));var interaction=require(_0xaa9b('0x6'));var config=require(_0xaa9b('0x7'));var controller=require('./intSugarcrmConfiguration.controller');router['get']('/',auth[_0xaa9b('0x8')](),controller[_0xaa9b('0x9')]);router[_0xaa9b('0xa')]('/:id',auth[_0xaa9b('0x8')](),controller[_0xaa9b('0xb')]);router[_0xaa9b('0xa')](_0xaa9b('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0xaa9b('0xa')](_0xaa9b('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router['get'](_0xaa9b('0xe'),auth[_0xaa9b('0x8')](),controller[_0xaa9b('0xf')]);router[_0xaa9b('0x10')]('/',auth['isAuthenticated'](),controller[_0xaa9b('0x11')]);router[_0xaa9b('0x12')](_0xaa9b('0x13'),auth['isAuthenticated'](),controller['update']);router[_0xaa9b('0x14')](_0xaa9b('0x13'),auth[_0xaa9b('0x8')](),controller[_0xaa9b('0x15')]);module[_0xaa9b('0x16')]=router; \ No newline at end of file +var _0xb77a=['util','path','Router','../../components/interaction/service','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','update','/:id','destroy','exports','multer'];(function(_0x48a032,_0x1f92e8){var _0xb7cb07=function(_0x351e41){while(--_0x351e41){_0x48a032['push'](_0x48a032['shift']());}};_0xb7cb07(++_0x1f92e8);}(_0xb77a,0x17b));var _0xab77=function(_0x31fe47,_0x32640f){_0x31fe47=_0x31fe47-0x0;var _0x2e78a8=_0xb77a[_0x31fe47];return _0x2e78a8;};'use strict';var multer=require(_0xab77('0x0'));var util=require(_0xab77('0x1'));var path=require(_0xab77('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xab77('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xab77('0x4'));var config=require('../../config/environment');var controller=require(_0xab77('0x5'));router[_0xab77('0x6')]('/',auth[_0xab77('0x7')](),controller[_0xab77('0x8')]);router[_0xab77('0x6')]('/:id',auth[_0xab77('0x7')](),controller[_0xab77('0x9')]);router[_0xab77('0x6')](_0xab77('0xa'),auth['isAuthenticated'](),controller['getFields']);router['get'](_0xab77('0xb'),auth['isAuthenticated'](),controller[_0xab77('0xc')]);router[_0xab77('0x6')](_0xab77('0xd'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xab77('0xe')]('/',auth[_0xab77('0x7')](),controller['create']);router['put']('/:id',auth[_0xab77('0x7')](),controller[_0xab77('0xf')]);router['delete'](_0xab77('0x10'),auth[_0xab77('0x7')](),controller[_0xab77('0x11')]);module[_0xab77('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 62866b8..834e50c 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 _0x5eed=['exports','STRING'];(function(_0x39bfb6,_0x4272c8){var _0x23fef9=function(_0x5f83c1){while(--_0x5f83c1){_0x39bfb6['push'](_0x39bfb6['shift']());}};_0x23fef9(++_0x4272c8);}(_0x5eed,0x14c));var _0xd5ee=function(_0x357407,_0x1e1c83){_0x357407=_0x357407-0x0;var _0x53c9d9=_0x5eed[_0x357407];return _0x53c9d9;};'use strict';var Sequelize=require('sequelize');module[_0xd5ee('0x0')]={'name':{'type':Sequelize[_0xd5ee('0x1')]},'description':{'type':Sequelize[_0xd5ee('0x1')]}}; \ No newline at end of file +var _0xd9dd=['STRING','sequelize','exports'];(function(_0x8866a1,_0x5ef05e){var _0x35c5d4=function(_0x3d19e4){while(--_0x3d19e4){_0x8866a1['push'](_0x8866a1['shift']());}};_0x35c5d4(++_0x5ef05e);}(_0xd9dd,0xd3));var _0xdd9d=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd9dd[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xdd9d('0x0'));module[_0xdd9d('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xdd9d('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index d7ce213..df10824 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 _0xea98=['pick','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','destroy','then','error','name','map','SugarcrmConfiguration','fieldName','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','find','create','body','update','getFields','SugarcrmField','order','findOne'];(function(_0x2d92e2,_0x5815d0){var _0x30892f=function(_0x4e2ccd){while(--_0x4e2ccd){_0x2d92e2['push'](_0x2d92e2['shift']());}};_0x30892f(++_0x5815d0);}(_0xea98,0x1a7));var _0x8ea9=function(_0x56d637,_0x571ac){_0x56d637=_0x56d637-0x0;var _0x56868c=_0xea98[_0x56d637];return _0x56868c;};'use strict';var emlformat=require(_0x8ea9('0x0'));var rimraf=require(_0x8ea9('0x1'));var zipdir=require(_0x8ea9('0x2'));var jsonpatch=require(_0x8ea9('0x3'));var rp=require(_0x8ea9('0x4'));var moment=require(_0x8ea9('0x5'));var BPromise=require(_0x8ea9('0x6'));var Mustache=require(_0x8ea9('0x7'));var util=require(_0x8ea9('0x8'));var path=require(_0x8ea9('0x9'));var sox=require(_0x8ea9('0xa'));var csv=require(_0x8ea9('0xb'));var ejs=require(_0x8ea9('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8ea9('0xd'));var squel=require(_0x8ea9('0xe'));var crypto=require('crypto');var jsforce=require(_0x8ea9('0xf'));var deskjs=require(_0x8ea9('0x10'));var toCsv=require(_0x8ea9('0xb'));var querystring=require(_0x8ea9('0x11'));var Papa=require(_0x8ea9('0x12'));var Redis=require(_0x8ea9('0x13'));var authService=require(_0x8ea9('0x14'));var qs=require(_0x8ea9('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8ea9('0x16'));var logger=require(_0x8ea9('0x17'))(_0x8ea9('0x18'));var utils=require(_0x8ea9('0x19'));var config=require(_0x8ea9('0x1a'));var licenseUtil=require(_0x8ea9('0x1b'));var db=require(_0x8ea9('0x1c'))['db'];function respondWithStatusCode(_0x146a9a,_0x5c81db){_0x5c81db=_0x5c81db||0xcc;return function(_0x4e4cab){if(_0x4e4cab){return _0x146a9a[_0x8ea9('0x1d')](_0x5c81db);}return _0x146a9a[_0x8ea9('0x1e')](_0x5c81db)[_0x8ea9('0x1f')]();};}function respondWithResult(_0x401e66,_0x4c4809){_0x4c4809=_0x4c4809||0xc8;return function(_0x135bd1){if(_0x135bd1){return _0x401e66['status'](_0x4c4809)[_0x8ea9('0x20')](_0x135bd1);}};}function respondWithFilteredResult(_0x547cb4,_0x55a79f){return function(_0x366bcc){if(_0x366bcc){var _0x4ed9ee=typeof _0x55a79f[_0x8ea9('0x21')]==='undefined'&&typeof _0x55a79f['limit']===_0x8ea9('0x22');var _0x37eda9=_0x366bcc[_0x8ea9('0x23')];var _0x3e8424=_0x4ed9ee?0x0:_0x55a79f[_0x8ea9('0x21')];var _0x166373=_0x4ed9ee?_0x366bcc['count']:_0x55a79f['offset']+_0x55a79f[_0x8ea9('0x24')];var _0x4b506e;if(_0x166373>=_0x37eda9){_0x166373=_0x37eda9;_0x4b506e=0xc8;}else{_0x4b506e=0xce;}_0x547cb4['status'](_0x4b506e);return _0x547cb4['set'](_0x8ea9('0x25'),_0x3e8424+'-'+_0x166373+'/'+_0x37eda9)[_0x8ea9('0x20')](_0x366bcc);}return null;};}function patchUpdates(_0xdcc238){return function(_0x2a456f){try{jsonpatch[_0x8ea9('0x26')](_0x2a456f,_0xdcc238,!![]);}catch(_0x19f62d){return BPromise['reject'](_0x19f62d);}return _0x2a456f[_0x8ea9('0x27')]();};}function saveUpdates(_0x501079,_0x513f94){return function(_0xa4650c){if(_0xa4650c){return _0xa4650c['update'](_0x501079)['then'](function(_0xac0c7a){return _0xac0c7a;});}return null;};}function removeEntity(_0x5bddfa,_0x11c18f){return function(_0x32ece5){if(_0x32ece5){return _0x32ece5[_0x8ea9('0x28')]()[_0x8ea9('0x29')](function(){_0x5bddfa[_0x8ea9('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x160e68,_0x226091){return function(_0x338314){if(!_0x338314){_0x160e68[_0x8ea9('0x1d')](0x194);}return _0x338314;};}function handleError(_0x2a7dd6,_0x292131){_0x292131=_0x292131||0x1f4;return function(_0x1191ea){logger[_0x8ea9('0x2a')](_0x1191ea['stack']);if(_0x1191ea[_0x8ea9('0x2b')]){delete _0x1191ea[_0x8ea9('0x2b')];}_0x2a7dd6[_0x8ea9('0x1e')](_0x292131)['send'](_0x1191ea);};}exports['index']=function(_0x4b71aa,_0x44ca37){var _0x28a354={},_0x317fad={},_0x543b20={'count':0x0,'rows':[]};var _0x37dfb2=_[_0x8ea9('0x2c')](db[_0x8ea9('0x2d')]['rawAttributes'],function(_0x144abc){return{'name':_0x144abc[_0x8ea9('0x2e')],'type':_0x144abc[_0x8ea9('0x2f')][_0x8ea9('0x30')]};});_0x317fad['model']=_[_0x8ea9('0x2c')](_0x37dfb2,'name');_0x317fad[_0x8ea9('0x31')]=_[_0x8ea9('0x32')](_0x4b71aa['query']);_0x317fad[_0x8ea9('0x33')]=_['intersection'](_0x317fad[_0x8ea9('0x34')],_0x317fad[_0x8ea9('0x31')]);_0x28a354[_0x8ea9('0x35')]=_['intersection'](_0x317fad[_0x8ea9('0x34')],qs[_0x8ea9('0x36')](_0x4b71aa['query']['fields']));_0x28a354[_0x8ea9('0x35')]=_0x28a354[_0x8ea9('0x35')][_0x8ea9('0x37')]?_0x28a354[_0x8ea9('0x35')]:_0x317fad[_0x8ea9('0x34')];if(!_0x4b71aa[_0x8ea9('0x31')][_0x8ea9('0x38')](_0x8ea9('0x39'))){_0x28a354['limit']=qs[_0x8ea9('0x24')](_0x4b71aa[_0x8ea9('0x31')][_0x8ea9('0x24')]);_0x28a354[_0x8ea9('0x21')]=qs['offset'](_0x4b71aa['query'][_0x8ea9('0x21')]);}_0x28a354['order']=qs['sort'](_0x4b71aa[_0x8ea9('0x31')][_0x8ea9('0x3a')]);_0x28a354[_0x8ea9('0x3b')]=qs[_0x8ea9('0x33')](_['pick'](_0x4b71aa['query'],_0x317fad[_0x8ea9('0x33')]),_0x37dfb2);if(_0x4b71aa[_0x8ea9('0x31')][_0x8ea9('0x3c')]){_0x28a354[_0x8ea9('0x3b')]=_[_0x8ea9('0x3d')](_0x28a354[_0x8ea9('0x3b')],{'$or':_[_0x8ea9('0x2c')](_0x37dfb2,function(_0x4f1705){if(_0x4f1705[_0x8ea9('0x2f')]!==_0x8ea9('0x3e')){var _0xd94d98={};_0xd94d98[_0x4f1705['name']]={'$like':'%'+_0x4b71aa[_0x8ea9('0x31')][_0x8ea9('0x3c')]+'%'};return _0xd94d98;}})});}_0x28a354=_['merge']({},_0x28a354,_0x4b71aa[_0x8ea9('0x3f')]);var _0x4ee263={'where':_0x28a354[_0x8ea9('0x3b')]};return db[_0x8ea9('0x2d')][_0x8ea9('0x23')](_0x4ee263)['then'](function(_0x21dee0){_0x543b20[_0x8ea9('0x23')]=_0x21dee0;if(_0x4b71aa[_0x8ea9('0x31')][_0x8ea9('0x40')]){_0x28a354[_0x8ea9('0x41')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x8ea9('0x42')](_0x28a354);})[_0x8ea9('0x29')](function(_0x5af464){_0x543b20[_0x8ea9('0x43')]=_0x5af464;return _0x543b20;})['then'](respondWithFilteredResult(_0x44ca37,_0x28a354))[_0x8ea9('0x44')](handleError(_0x44ca37,null));};exports[_0x8ea9('0x45')]=function(_0x4ec126,_0x8d42d0){var _0x26979d={'raw':![],'where':{'id':_0x4ec126[_0x8ea9('0x46')]['id']}},_0xcab77c={};_0xcab77c[_0x8ea9('0x34')]=_[_0x8ea9('0x32')](db[_0x8ea9('0x2d')][_0x8ea9('0x47')]);_0xcab77c['query']=_[_0x8ea9('0x32')](_0x4ec126[_0x8ea9('0x31')]);_0xcab77c[_0x8ea9('0x33')]=_[_0x8ea9('0x48')](_0xcab77c[_0x8ea9('0x34')],_0xcab77c['query']);_0x26979d['attributes']=_[_0x8ea9('0x48')](_0xcab77c[_0x8ea9('0x34')],qs[_0x8ea9('0x36')](_0x4ec126[_0x8ea9('0x31')][_0x8ea9('0x36')]));_0x26979d[_0x8ea9('0x35')]=_0x26979d[_0x8ea9('0x35')][_0x8ea9('0x37')]?_0x26979d[_0x8ea9('0x35')]:_0xcab77c[_0x8ea9('0x34')];if(_0x4ec126[_0x8ea9('0x31')]['includeAll']){_0x26979d[_0x8ea9('0x41')]=[{'all':!![]}];}_0x26979d=_[_0x8ea9('0x3d')]({},_0x26979d,_0x4ec126['options']);return db[_0x8ea9('0x2d')][_0x8ea9('0x49')](_0x26979d)[_0x8ea9('0x29')](handleEntityNotFound(_0x8d42d0,null))[_0x8ea9('0x29')](respondWithResult(_0x8d42d0,null))[_0x8ea9('0x44')](handleError(_0x8d42d0,null));};exports['create']=function(_0x2871ba,_0x5ab9a7){return db[_0x8ea9('0x2d')][_0x8ea9('0x4a')](_0x2871ba[_0x8ea9('0x4b')],{})[_0x8ea9('0x29')](respondWithResult(_0x5ab9a7,0xc9))[_0x8ea9('0x44')](handleError(_0x5ab9a7,null));};exports[_0x8ea9('0x4c')]=function(_0x272368,_0x545e0f){if(_0x272368['body']['id']){delete _0x272368[_0x8ea9('0x4b')]['id'];}return db[_0x8ea9('0x2d')]['find']({'where':{'id':_0x272368[_0x8ea9('0x46')]['id']}})['then'](handleEntityNotFound(_0x545e0f,null))[_0x8ea9('0x29')](saveUpdates(_0x272368[_0x8ea9('0x4b')],null))[_0x8ea9('0x29')](respondWithResult(_0x545e0f,null))[_0x8ea9('0x44')](handleError(_0x545e0f,null));};exports[_0x8ea9('0x28')]=function(_0x41ca8f,_0x2c4e18){return db[_0x8ea9('0x2d')][_0x8ea9('0x49')]({'where':{'id':_0x41ca8f['params']['id']}})[_0x8ea9('0x29')](handleEntityNotFound(_0x2c4e18,null))[_0x8ea9('0x29')](removeEntity(_0x2c4e18,null))[_0x8ea9('0x44')](handleError(_0x2c4e18,null));};exports[_0x8ea9('0x4d')]=function(_0x503150,_0x133643,_0x57f076){var _0x4be924={};var _0x53a828={};var _0xe4b6a3;var _0xd9a6ae;return db[_0x8ea9('0x2d')]['findOne']({'where':{'id':_0x503150[_0x8ea9('0x46')]['id']}})[_0x8ea9('0x29')](handleEntityNotFound(_0x133643,null))[_0x8ea9('0x29')](function(_0x109b0b){if(_0x109b0b){_0xe4b6a3=_0x109b0b;_0x53a828[_0x8ea9('0x34')]=_['keys'](db[_0x8ea9('0x4e')][_0x8ea9('0x47')]);_0x53a828[_0x8ea9('0x31')]=_[_0x8ea9('0x32')](_0x503150[_0x8ea9('0x31')]);_0x53a828[_0x8ea9('0x33')]=_[_0x8ea9('0x48')](_0x53a828[_0x8ea9('0x34')],_0x53a828['query']);_0x4be924[_0x8ea9('0x35')]=_[_0x8ea9('0x48')](_0x53a828[_0x8ea9('0x34')],qs[_0x8ea9('0x36')](_0x503150[_0x8ea9('0x31')][_0x8ea9('0x36')]));_0x4be924[_0x8ea9('0x35')]=_0x4be924[_0x8ea9('0x35')]['length']?_0x4be924[_0x8ea9('0x35')]:_0x53a828[_0x8ea9('0x34')];_0x4be924[_0x8ea9('0x4f')]=qs[_0x8ea9('0x3a')](_0x503150[_0x8ea9('0x31')][_0x8ea9('0x3a')]);_0x4be924[_0x8ea9('0x3b')]=qs['filters'](_['pick'](_0x503150[_0x8ea9('0x31')],_0x53a828[_0x8ea9('0x33')]));if(_0x503150[_0x8ea9('0x31')][_0x8ea9('0x3c')]){_0x4be924[_0x8ea9('0x3b')]=_['merge'](_0x4be924['where'],{'$or':_['map'](_0x4be924[_0x8ea9('0x35')],function(_0x327b04){var _0x2f12cd={};_0x2f12cd[_0x327b04]={'$like':'%'+_0x503150[_0x8ea9('0x31')]['filter']+'%'};return _0x2f12cd;})});}_0x4be924=_[_0x8ea9('0x3d')]({},_0x4be924,_0x503150[_0x8ea9('0x3f')]);return _0xe4b6a3[_0x8ea9('0x4d')](_0x4be924);}})[_0x8ea9('0x29')](function(_0x29120d){if(_0x29120d){_0xd9a6ae=_0x29120d[_0x8ea9('0x37')];if(!_0x503150[_0x8ea9('0x31')]['hasOwnProperty']('nolimit')){_0x4be924[_0x8ea9('0x24')]=qs[_0x8ea9('0x24')](_0x503150[_0x8ea9('0x31')][_0x8ea9('0x24')]);_0x4be924[_0x8ea9('0x21')]=qs['offset'](_0x503150['query']['offset']);}return _0xe4b6a3[_0x8ea9('0x4d')](_0x4be924);}})[_0x8ea9('0x29')](function(_0x529eab){if(_0x529eab){return _0x529eab?{'count':_0xd9a6ae,'rows':_0x529eab}:null;}})[_0x8ea9('0x29')](respondWithResult(_0x133643,null))[_0x8ea9('0x44')](handleError(_0x133643,null));};exports['getSubjects']=function(_0x3ecdde,_0x4cb79c,_0x1b1c75){var _0x3f84bc={};var _0x5105ee={};var _0x261e9c;var _0x4d519c;return db[_0x8ea9('0x2d')][_0x8ea9('0x50')]({'where':{'id':_0x3ecdde[_0x8ea9('0x46')]['id']}})[_0x8ea9('0x29')](handleEntityNotFound(_0x4cb79c,null))['then'](function(_0x226c12){if(_0x226c12){_0x261e9c=_0x226c12;_0x5105ee[_0x8ea9('0x34')]=_['keys'](db[_0x8ea9('0x4e')][_0x8ea9('0x47')]);_0x5105ee[_0x8ea9('0x31')]=_['keys'](_0x3ecdde[_0x8ea9('0x31')]);_0x5105ee[_0x8ea9('0x33')]=_[_0x8ea9('0x48')](_0x5105ee[_0x8ea9('0x34')],_0x5105ee[_0x8ea9('0x31')]);_0x3f84bc[_0x8ea9('0x35')]=_[_0x8ea9('0x48')](_0x5105ee[_0x8ea9('0x34')],qs['fields'](_0x3ecdde[_0x8ea9('0x31')][_0x8ea9('0x36')]));_0x3f84bc[_0x8ea9('0x35')]=_0x3f84bc['attributes'][_0x8ea9('0x37')]?_0x3f84bc['attributes']:_0x5105ee[_0x8ea9('0x34')];_0x3f84bc[_0x8ea9('0x4f')]=qs[_0x8ea9('0x3a')](_0x3ecdde[_0x8ea9('0x31')][_0x8ea9('0x3a')]);_0x3f84bc[_0x8ea9('0x3b')]=qs[_0x8ea9('0x33')](_[_0x8ea9('0x51')](_0x3ecdde[_0x8ea9('0x31')],_0x5105ee[_0x8ea9('0x33')]));if(_0x3ecdde[_0x8ea9('0x31')][_0x8ea9('0x3c')]){_0x3f84bc[_0x8ea9('0x3b')]=_[_0x8ea9('0x3d')](_0x3f84bc['where'],{'$or':_[_0x8ea9('0x2c')](_0x3f84bc[_0x8ea9('0x35')],function(_0x19fa6b){var _0x499987={};_0x499987[_0x19fa6b]={'$like':'%'+_0x3ecdde[_0x8ea9('0x31')][_0x8ea9('0x3c')]+'%'};return _0x499987;})});}_0x3f84bc=_[_0x8ea9('0x3d')]({},_0x3f84bc,_0x3ecdde[_0x8ea9('0x3f')]);return _0x261e9c[_0x8ea9('0x52')](_0x3f84bc);}})[_0x8ea9('0x29')](function(_0x2eb3f5){if(_0x2eb3f5){_0x4d519c=_0x2eb3f5[_0x8ea9('0x37')];if(!_0x3ecdde['query'][_0x8ea9('0x38')](_0x8ea9('0x39'))){_0x3f84bc[_0x8ea9('0x24')]=qs[_0x8ea9('0x24')](_0x3ecdde[_0x8ea9('0x31')]['limit']);_0x3f84bc[_0x8ea9('0x21')]=qs[_0x8ea9('0x21')](_0x3ecdde[_0x8ea9('0x31')][_0x8ea9('0x21')]);}return _0x261e9c['getSubjects'](_0x3f84bc);}})['then'](function(_0x24d105){if(_0x24d105){return _0x24d105?{'count':_0x4d519c,'rows':_0x24d105}:null;}})[_0x8ea9('0x29')](respondWithResult(_0x4cb79c,null))[_0x8ea9('0x44')](handleError(_0x4cb79c,null));};exports[_0x8ea9('0x53')]=function(_0x2659a1,_0x15cb3f,_0x37919a){var _0x1c8e98={};var _0x4490cd={};var _0x42bd41;var _0x5b7083;return db[_0x8ea9('0x2d')]['findOne']({'where':{'id':_0x2659a1['params']['id']}})[_0x8ea9('0x29')](handleEntityNotFound(_0x15cb3f,null))[_0x8ea9('0x29')](function(_0x2d375f){if(_0x2d375f){_0x42bd41=_0x2d375f;_0x4490cd[_0x8ea9('0x34')]=_[_0x8ea9('0x32')](db[_0x8ea9('0x4e')][_0x8ea9('0x47')]);_0x4490cd['query']=_[_0x8ea9('0x32')](_0x2659a1['query']);_0x4490cd[_0x8ea9('0x33')]=_[_0x8ea9('0x48')](_0x4490cd['model'],_0x4490cd[_0x8ea9('0x31')]);_0x1c8e98[_0x8ea9('0x35')]=_[_0x8ea9('0x48')](_0x4490cd[_0x8ea9('0x34')],qs[_0x8ea9('0x36')](_0x2659a1['query'][_0x8ea9('0x36')]));_0x1c8e98[_0x8ea9('0x35')]=_0x1c8e98[_0x8ea9('0x35')][_0x8ea9('0x37')]?_0x1c8e98[_0x8ea9('0x35')]:_0x4490cd[_0x8ea9('0x34')];_0x1c8e98[_0x8ea9('0x4f')]=qs[_0x8ea9('0x3a')](_0x2659a1[_0x8ea9('0x31')][_0x8ea9('0x3a')]);_0x1c8e98[_0x8ea9('0x3b')]=qs[_0x8ea9('0x33')](_[_0x8ea9('0x51')](_0x2659a1['query'],_0x4490cd['filters']));if(_0x2659a1[_0x8ea9('0x31')][_0x8ea9('0x3c')]){_0x1c8e98[_0x8ea9('0x3b')]=_[_0x8ea9('0x3d')](_0x1c8e98[_0x8ea9('0x3b')],{'$or':_['map'](_0x1c8e98[_0x8ea9('0x35')],function(_0x178340){var _0x45c9ac={};_0x45c9ac[_0x178340]={'$like':'%'+_0x2659a1[_0x8ea9('0x31')][_0x8ea9('0x3c')]+'%'};return _0x45c9ac;})});}_0x1c8e98=_[_0x8ea9('0x3d')]({},_0x1c8e98,_0x2659a1[_0x8ea9('0x3f')]);return _0x42bd41[_0x8ea9('0x53')](_0x1c8e98);}})[_0x8ea9('0x29')](function(_0x2c7974){if(_0x2c7974){_0x5b7083=_0x2c7974[_0x8ea9('0x37')];if(!_0x2659a1[_0x8ea9('0x31')][_0x8ea9('0x38')]('nolimit')){_0x1c8e98['limit']=qs['limit'](_0x2659a1[_0x8ea9('0x31')][_0x8ea9('0x24')]);_0x1c8e98[_0x8ea9('0x21')]=qs[_0x8ea9('0x21')](_0x2659a1[_0x8ea9('0x31')][_0x8ea9('0x21')]);}return _0x42bd41['getDescriptions'](_0x1c8e98);}})['then'](function(_0x5bead8){if(_0x5bead8){return _0x5bead8?{'count':_0x5b7083,'rows':_0x5bead8}:null;}})[_0x8ea9('0x29')](respondWithResult(_0x15cb3f,null))[_0x8ea9('0x44')](handleError(_0x15cb3f,null));}; \ No newline at end of file +var _0x0e6c=['filter','SugarcrmConfiguration','then','includeAll','include','findAll','rows','catch','params','rawAttributes','intersection','fields','find','update','body','SugarcrmField','order','options','getFields','getSubjects','findOne','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','error','stack','name','index','type','key','model','query','keys','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','map','VIRTUAL'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x0e6c,0xb4));var _0xc0e6=function(_0x1e94b1,_0x442482){_0x1e94b1=_0x1e94b1-0x0;var _0x412e45=_0x0e6c[_0x1e94b1];return _0x412e45;};'use strict';var emlformat=require(_0xc0e6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc0e6('0x1'));var jsonpatch=require(_0xc0e6('0x2'));var rp=require(_0xc0e6('0x3'));var moment=require(_0xc0e6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc0e6('0x5'));var util=require(_0xc0e6('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xc0e6('0x7'));var ejs=require(_0xc0e6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc0e6('0x9'));var squel=require(_0xc0e6('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc0e6('0xb'));var toCsv=require(_0xc0e6('0x7'));var querystring=require(_0xc0e6('0xc'));var Papa=require(_0xc0e6('0xd'));var Redis=require(_0xc0e6('0xe'));var authService=require(_0xc0e6('0xf'));var qs=require(_0xc0e6('0x10'));var as=require(_0xc0e6('0x11'));var hardwareService=require(_0xc0e6('0x12'));var logger=require(_0xc0e6('0x13'))(_0xc0e6('0x14'));var utils=require(_0xc0e6('0x15'));var config=require(_0xc0e6('0x16'));var licenseUtil=require(_0xc0e6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cc8c7,_0x2d3f2d){_0x2d3f2d=_0x2d3f2d||0xcc;return function(_0x2a5438){if(_0x2a5438){return _0x4cc8c7[_0xc0e6('0x18')](_0x2d3f2d);}return _0x4cc8c7['status'](_0x2d3f2d)[_0xc0e6('0x19')]();};}function respondWithResult(_0x5aa17f,_0x25c4ad){_0x25c4ad=_0x25c4ad||0xc8;return function(_0x4c5517){if(_0x4c5517){return _0x5aa17f[_0xc0e6('0x1a')](_0x25c4ad)[_0xc0e6('0x1b')](_0x4c5517);}};}function respondWithFilteredResult(_0x589f28,_0x40182e){return function(_0x5d821a){if(_0x5d821a){var _0x22daa2=typeof _0x40182e[_0xc0e6('0x1c')]===_0xc0e6('0x1d')&&typeof _0x40182e[_0xc0e6('0x1e')]==='undefined';var _0x33f40e=_0x5d821a[_0xc0e6('0x1f')];var _0x41f73c=_0x22daa2?0x0:_0x40182e[_0xc0e6('0x1c')];var _0x565d04=_0x22daa2?_0x5d821a[_0xc0e6('0x1f')]:_0x40182e[_0xc0e6('0x1c')]+_0x40182e[_0xc0e6('0x1e')];var _0x35ba96;if(_0x565d04>=_0x33f40e){_0x565d04=_0x33f40e;_0x35ba96=0xc8;}else{_0x35ba96=0xce;}_0x589f28[_0xc0e6('0x1a')](_0x35ba96);return _0x589f28[_0xc0e6('0x20')](_0xc0e6('0x21'),_0x41f73c+'-'+_0x565d04+'/'+_0x33f40e)[_0xc0e6('0x1b')](_0x5d821a);}return null;};}function patchUpdates(_0x2132e7){return function(_0x3e2361){try{jsonpatch[_0xc0e6('0x22')](_0x3e2361,_0x2132e7,!![]);}catch(_0x547d37){return BPromise['reject'](_0x547d37);}return _0x3e2361[_0xc0e6('0x23')]();};}function saveUpdates(_0x144044,_0x255c77){return function(_0x16cb4d){if(_0x16cb4d){return _0x16cb4d['update'](_0x144044)['then'](function(_0x40d14c){return _0x40d14c;});}return null;};}function removeEntity(_0x321308,_0x464f99){return function(_0x139daf){if(_0x139daf){return _0x139daf[_0xc0e6('0x24')]()['then'](function(){_0x321308['status'](0xcc)[_0xc0e6('0x19')]();});}};}function handleEntityNotFound(_0x24df25,_0x36400c){return function(_0x327cf7){if(!_0x327cf7){_0x24df25[_0xc0e6('0x18')](0x194);}return _0x327cf7;};}function handleError(_0x2d11ec,_0x384aa8){_0x384aa8=_0x384aa8||0x1f4;return function(_0x2dce24){logger[_0xc0e6('0x25')](_0x2dce24[_0xc0e6('0x26')]);if(_0x2dce24[_0xc0e6('0x27')]){delete _0x2dce24['name'];}_0x2d11ec[_0xc0e6('0x1a')](_0x384aa8)['send'](_0x2dce24);};}exports[_0xc0e6('0x28')]=function(_0x476173,_0xe1920f){var _0x5c5d51={},_0x1787f7={},_0x2fa318={'count':0x0,'rows':[]};var _0x5df8a4=_['map'](db['SugarcrmConfiguration']['rawAttributes'],function(_0x5dcd6c){return{'name':_0x5dcd6c['fieldName'],'type':_0x5dcd6c[_0xc0e6('0x29')][_0xc0e6('0x2a')]};});_0x1787f7[_0xc0e6('0x2b')]=_['map'](_0x5df8a4,'name');_0x1787f7[_0xc0e6('0x2c')]=_[_0xc0e6('0x2d')](_0x476173['query']);_0x1787f7['filters']=_['intersection'](_0x1787f7[_0xc0e6('0x2b')],_0x1787f7[_0xc0e6('0x2c')]);_0x5c5d51[_0xc0e6('0x2e')]=_['intersection'](_0x1787f7[_0xc0e6('0x2b')],qs['fields'](_0x476173[_0xc0e6('0x2c')]['fields']));_0x5c5d51[_0xc0e6('0x2e')]=_0x5c5d51[_0xc0e6('0x2e')][_0xc0e6('0x2f')]?_0x5c5d51[_0xc0e6('0x2e')]:_0x1787f7[_0xc0e6('0x2b')];if(!_0x476173['query'][_0xc0e6('0x30')](_0xc0e6('0x31'))){_0x5c5d51['limit']=qs[_0xc0e6('0x1e')](_0x476173[_0xc0e6('0x2c')][_0xc0e6('0x1e')]);_0x5c5d51[_0xc0e6('0x1c')]=qs[_0xc0e6('0x1c')](_0x476173[_0xc0e6('0x2c')][_0xc0e6('0x1c')]);}_0x5c5d51['order']=qs[_0xc0e6('0x32')](_0x476173[_0xc0e6('0x2c')][_0xc0e6('0x32')]);_0x5c5d51[_0xc0e6('0x33')]=qs[_0xc0e6('0x34')](_[_0xc0e6('0x35')](_0x476173[_0xc0e6('0x2c')],_0x1787f7[_0xc0e6('0x34')]),_0x5df8a4);if(_0x476173['query']['filter']){_0x5c5d51[_0xc0e6('0x33')]=_[_0xc0e6('0x36')](_0x5c5d51['where'],{'$or':_[_0xc0e6('0x37')](_0x5df8a4,function(_0x36fb7a){if(_0x36fb7a[_0xc0e6('0x29')]!==_0xc0e6('0x38')){var _0x23154d={};_0x23154d[_0x36fb7a[_0xc0e6('0x27')]]={'$like':'%'+_0x476173[_0xc0e6('0x2c')][_0xc0e6('0x39')]+'%'};return _0x23154d;}})});}_0x5c5d51=_[_0xc0e6('0x36')]({},_0x5c5d51,_0x476173['options']);var _0x5f2694={'where':_0x5c5d51['where']};return db[_0xc0e6('0x3a')][_0xc0e6('0x1f')](_0x5f2694)[_0xc0e6('0x3b')](function(_0x226f05){_0x2fa318[_0xc0e6('0x1f')]=_0x226f05;if(_0x476173[_0xc0e6('0x2c')][_0xc0e6('0x3c')]){_0x5c5d51[_0xc0e6('0x3d')]=[{'all':!![]}];}return db[_0xc0e6('0x3a')][_0xc0e6('0x3e')](_0x5c5d51);})[_0xc0e6('0x3b')](function(_0x252bee){_0x2fa318[_0xc0e6('0x3f')]=_0x252bee;return _0x2fa318;})[_0xc0e6('0x3b')](respondWithFilteredResult(_0xe1920f,_0x5c5d51))[_0xc0e6('0x40')](handleError(_0xe1920f,null));};exports['show']=function(_0x28c082,_0x56bb25){var _0x320f88={'raw':![],'where':{'id':_0x28c082[_0xc0e6('0x41')]['id']}},_0x3472cf={};_0x3472cf['model']=_['keys'](db['SugarcrmConfiguration'][_0xc0e6('0x42')]);_0x3472cf[_0xc0e6('0x2c')]=_[_0xc0e6('0x2d')](_0x28c082[_0xc0e6('0x2c')]);_0x3472cf['filters']=_[_0xc0e6('0x43')](_0x3472cf[_0xc0e6('0x2b')],_0x3472cf[_0xc0e6('0x2c')]);_0x320f88[_0xc0e6('0x2e')]=_[_0xc0e6('0x43')](_0x3472cf[_0xc0e6('0x2b')],qs[_0xc0e6('0x44')](_0x28c082[_0xc0e6('0x2c')][_0xc0e6('0x44')]));_0x320f88[_0xc0e6('0x2e')]=_0x320f88[_0xc0e6('0x2e')][_0xc0e6('0x2f')]?_0x320f88['attributes']:_0x3472cf[_0xc0e6('0x2b')];if(_0x28c082['query'][_0xc0e6('0x3c')]){_0x320f88[_0xc0e6('0x3d')]=[{'all':!![]}];}_0x320f88=_[_0xc0e6('0x36')]({},_0x320f88,_0x28c082['options']);return db['SugarcrmConfiguration'][_0xc0e6('0x45')](_0x320f88)['then'](handleEntityNotFound(_0x56bb25,null))['then'](respondWithResult(_0x56bb25,null))[_0xc0e6('0x40')](handleError(_0x56bb25,null));};exports['create']=function(_0x413a64,_0x49fd3b){return db[_0xc0e6('0x3a')]['create'](_0x413a64['body'],{})[_0xc0e6('0x3b')](respondWithResult(_0x49fd3b,0xc9))['catch'](handleError(_0x49fd3b,null));};exports[_0xc0e6('0x46')]=function(_0x376db1,_0x35ef38){if(_0x376db1[_0xc0e6('0x47')]['id']){delete _0x376db1['body']['id'];}return db[_0xc0e6('0x3a')]['find']({'where':{'id':_0x376db1['params']['id']}})['then'](handleEntityNotFound(_0x35ef38,null))[_0xc0e6('0x3b')](saveUpdates(_0x376db1[_0xc0e6('0x47')],null))[_0xc0e6('0x3b')](respondWithResult(_0x35ef38,null))[_0xc0e6('0x40')](handleError(_0x35ef38,null));};exports[_0xc0e6('0x24')]=function(_0x14cd7e,_0x38c86c){return db[_0xc0e6('0x3a')][_0xc0e6('0x45')]({'where':{'id':_0x14cd7e[_0xc0e6('0x41')]['id']}})[_0xc0e6('0x3b')](handleEntityNotFound(_0x38c86c,null))[_0xc0e6('0x3b')](removeEntity(_0x38c86c,null))['catch'](handleError(_0x38c86c,null));};exports['getFields']=function(_0x26affe,_0x2bc579,_0x4bd927){var _0x3163ca={};var _0x59b5aa={};var _0x4bb995;var _0x273836;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x26affe[_0xc0e6('0x41')]['id']}})[_0xc0e6('0x3b')](handleEntityNotFound(_0x2bc579,null))['then'](function(_0x78984a){if(_0x78984a){_0x4bb995=_0x78984a;_0x59b5aa['model']=_['keys'](db[_0xc0e6('0x48')][_0xc0e6('0x42')]);_0x59b5aa[_0xc0e6('0x2c')]=_[_0xc0e6('0x2d')](_0x26affe[_0xc0e6('0x2c')]);_0x59b5aa[_0xc0e6('0x34')]=_[_0xc0e6('0x43')](_0x59b5aa['model'],_0x59b5aa[_0xc0e6('0x2c')]);_0x3163ca[_0xc0e6('0x2e')]=_[_0xc0e6('0x43')](_0x59b5aa[_0xc0e6('0x2b')],qs['fields'](_0x26affe[_0xc0e6('0x2c')][_0xc0e6('0x44')]));_0x3163ca[_0xc0e6('0x2e')]=_0x3163ca[_0xc0e6('0x2e')][_0xc0e6('0x2f')]?_0x3163ca[_0xc0e6('0x2e')]:_0x59b5aa['model'];_0x3163ca[_0xc0e6('0x49')]=qs[_0xc0e6('0x32')](_0x26affe[_0xc0e6('0x2c')][_0xc0e6('0x32')]);_0x3163ca[_0xc0e6('0x33')]=qs[_0xc0e6('0x34')](_[_0xc0e6('0x35')](_0x26affe[_0xc0e6('0x2c')],_0x59b5aa[_0xc0e6('0x34')]));if(_0x26affe[_0xc0e6('0x2c')][_0xc0e6('0x39')]){_0x3163ca['where']=_[_0xc0e6('0x36')](_0x3163ca[_0xc0e6('0x33')],{'$or':_[_0xc0e6('0x37')](_0x3163ca[_0xc0e6('0x2e')],function(_0x8dfe28){var _0x37b32a={};_0x37b32a[_0x8dfe28]={'$like':'%'+_0x26affe[_0xc0e6('0x2c')][_0xc0e6('0x39')]+'%'};return _0x37b32a;})});}_0x3163ca=_[_0xc0e6('0x36')]({},_0x3163ca,_0x26affe[_0xc0e6('0x4a')]);return _0x4bb995[_0xc0e6('0x4b')](_0x3163ca);}})[_0xc0e6('0x3b')](function(_0x53a54f){if(_0x53a54f){_0x273836=_0x53a54f[_0xc0e6('0x2f')];if(!_0x26affe[_0xc0e6('0x2c')][_0xc0e6('0x30')](_0xc0e6('0x31'))){_0x3163ca['limit']=qs['limit'](_0x26affe[_0xc0e6('0x2c')][_0xc0e6('0x1e')]);_0x3163ca['offset']=qs[_0xc0e6('0x1c')](_0x26affe[_0xc0e6('0x2c')][_0xc0e6('0x1c')]);}return _0x4bb995[_0xc0e6('0x4b')](_0x3163ca);}})[_0xc0e6('0x3b')](function(_0x4e9161){if(_0x4e9161){return _0x4e9161?{'count':_0x273836,'rows':_0x4e9161}:null;}})[_0xc0e6('0x3b')](respondWithResult(_0x2bc579,null))[_0xc0e6('0x40')](handleError(_0x2bc579,null));};exports[_0xc0e6('0x4c')]=function(_0xab5a05,_0x128156,_0x13fe71){var _0x5e53bb={};var _0x364e97={};var _0x5c7425;var _0x29114a;return db[_0xc0e6('0x3a')][_0xc0e6('0x4d')]({'where':{'id':_0xab5a05[_0xc0e6('0x41')]['id']}})[_0xc0e6('0x3b')](handleEntityNotFound(_0x128156,null))['then'](function(_0x3a5f8b){if(_0x3a5f8b){_0x5c7425=_0x3a5f8b;_0x364e97[_0xc0e6('0x2b')]=_[_0xc0e6('0x2d')](db[_0xc0e6('0x48')][_0xc0e6('0x42')]);_0x364e97[_0xc0e6('0x2c')]=_[_0xc0e6('0x2d')](_0xab5a05[_0xc0e6('0x2c')]);_0x364e97[_0xc0e6('0x34')]=_[_0xc0e6('0x43')](_0x364e97['model'],_0x364e97[_0xc0e6('0x2c')]);_0x5e53bb[_0xc0e6('0x2e')]=_[_0xc0e6('0x43')](_0x364e97[_0xc0e6('0x2b')],qs[_0xc0e6('0x44')](_0xab5a05[_0xc0e6('0x2c')][_0xc0e6('0x44')]));_0x5e53bb['attributes']=_0x5e53bb['attributes'][_0xc0e6('0x2f')]?_0x5e53bb[_0xc0e6('0x2e')]:_0x364e97[_0xc0e6('0x2b')];_0x5e53bb['order']=qs[_0xc0e6('0x32')](_0xab5a05[_0xc0e6('0x2c')]['sort']);_0x5e53bb[_0xc0e6('0x33')]=qs[_0xc0e6('0x34')](_[_0xc0e6('0x35')](_0xab5a05[_0xc0e6('0x2c')],_0x364e97[_0xc0e6('0x34')]));if(_0xab5a05['query'][_0xc0e6('0x39')]){_0x5e53bb[_0xc0e6('0x33')]=_[_0xc0e6('0x36')](_0x5e53bb[_0xc0e6('0x33')],{'$or':_[_0xc0e6('0x37')](_0x5e53bb[_0xc0e6('0x2e')],function(_0x378200){var _0x3c0e75={};_0x3c0e75[_0x378200]={'$like':'%'+_0xab5a05['query'][_0xc0e6('0x39')]+'%'};return _0x3c0e75;})});}_0x5e53bb=_[_0xc0e6('0x36')]({},_0x5e53bb,_0xab5a05[_0xc0e6('0x4a')]);return _0x5c7425[_0xc0e6('0x4c')](_0x5e53bb);}})[_0xc0e6('0x3b')](function(_0x540e68){if(_0x540e68){_0x29114a=_0x540e68['length'];if(!_0xab5a05['query'][_0xc0e6('0x30')](_0xc0e6('0x31'))){_0x5e53bb[_0xc0e6('0x1e')]=qs['limit'](_0xab5a05[_0xc0e6('0x2c')][_0xc0e6('0x1e')]);_0x5e53bb['offset']=qs['offset'](_0xab5a05['query']['offset']);}return _0x5c7425[_0xc0e6('0x4c')](_0x5e53bb);}})[_0xc0e6('0x3b')](function(_0x225e57){if(_0x225e57){return _0x225e57?{'count':_0x29114a,'rows':_0x225e57}:null;}})[_0xc0e6('0x3b')](respondWithResult(_0x128156,null))[_0xc0e6('0x40')](handleError(_0x128156,null));};exports['getDescriptions']=function(_0x417b25,_0x378992,_0x15acc3){var _0x358120={};var _0x235710={};var _0x6946da;var _0x2b72f8;return db[_0xc0e6('0x3a')]['findOne']({'where':{'id':_0x417b25[_0xc0e6('0x41')]['id']}})[_0xc0e6('0x3b')](handleEntityNotFound(_0x378992,null))['then'](function(_0x39214e){if(_0x39214e){_0x6946da=_0x39214e;_0x235710[_0xc0e6('0x2b')]=_[_0xc0e6('0x2d')](db['SugarcrmField']['rawAttributes']);_0x235710['query']=_[_0xc0e6('0x2d')](_0x417b25[_0xc0e6('0x2c')]);_0x235710['filters']=_['intersection'](_0x235710[_0xc0e6('0x2b')],_0x235710[_0xc0e6('0x2c')]);_0x358120[_0xc0e6('0x2e')]=_[_0xc0e6('0x43')](_0x235710['model'],qs[_0xc0e6('0x44')](_0x417b25[_0xc0e6('0x2c')]['fields']));_0x358120[_0xc0e6('0x2e')]=_0x358120['attributes'][_0xc0e6('0x2f')]?_0x358120[_0xc0e6('0x2e')]:_0x235710['model'];_0x358120[_0xc0e6('0x49')]=qs['sort'](_0x417b25[_0xc0e6('0x2c')][_0xc0e6('0x32')]);_0x358120[_0xc0e6('0x33')]=qs[_0xc0e6('0x34')](_[_0xc0e6('0x35')](_0x417b25['query'],_0x235710['filters']));if(_0x417b25['query'][_0xc0e6('0x39')]){_0x358120[_0xc0e6('0x33')]=_[_0xc0e6('0x36')](_0x358120['where'],{'$or':_[_0xc0e6('0x37')](_0x358120[_0xc0e6('0x2e')],function(_0x2b1086){var _0x4c6a31={};_0x4c6a31[_0x2b1086]={'$like':'%'+_0x417b25[_0xc0e6('0x2c')]['filter']+'%'};return _0x4c6a31;})});}_0x358120=_[_0xc0e6('0x36')]({},_0x358120,_0x417b25[_0xc0e6('0x4a')]);return _0x6946da[_0xc0e6('0x4e')](_0x358120);}})[_0xc0e6('0x3b')](function(_0x24f527){if(_0x24f527){_0x2b72f8=_0x24f527['length'];if(!_0x417b25[_0xc0e6('0x2c')][_0xc0e6('0x30')](_0xc0e6('0x31'))){_0x358120['limit']=qs[_0xc0e6('0x1e')](_0x417b25['query']['limit']);_0x358120[_0xc0e6('0x1c')]=qs[_0xc0e6('0x1c')](_0x417b25[_0xc0e6('0x2c')][_0xc0e6('0x1c')]);}return _0x6946da[_0xc0e6('0x4e')](_0x358120);}})['then'](function(_0x3edc5f){if(_0x3edc5f){return _0x3edc5f?{'count':_0x2b72f8,'rows':_0x3edc5f}:null;}})[_0xc0e6('0x3b')](respondWithResult(_0x378992,null))[_0xc0e6('0x40')](handleError(_0x378992,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 96e06ae..05a3896 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 _0xe02f=['../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2dec28,_0x5e13b1){var _0x4c485e=function(_0x2e9812){while(--_0x2e9812){_0x2dec28['push'](_0x2dec28['shift']());}};_0x4c485e(++_0x5e13b1);}(_0xe02f,0x76));var _0xfe02=function(_0x58f245,_0x3e4f31){_0x58f245=_0x58f245-0x0;var _0x1f0cfb=_0xe02f[_0x58f245];return _0x1f0cfb;};'use strict';var _=require('lodash');var util=require(_0xfe02('0x0'));var logger=require(_0xfe02('0x1'))(_0xfe02('0x2'));var moment=require(_0xfe02('0x3'));var BPromise=require(_0xfe02('0x4'));var rp=require(_0xfe02('0x5'));var fs=require('fs');var path=require(_0xfe02('0x6'));var rimraf=require(_0xfe02('0x7'));var config=require(_0xfe02('0x8'));var attributes=require(_0xfe02('0x9'));module[_0xfe02('0xa')]=function(_0x35855e,_0x27529){return _0x35855e[_0xfe02('0xb')](_0xfe02('0xc'),attributes,{'tableName':_0xfe02('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f16=['SugarcrmConfiguration','int_sugarcrm_configurations','util','moment','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','define'];(function(_0x398d30,_0x4a3599){var _0x2baa48=function(_0x4f294e){while(--_0x4f294e){_0x398d30['push'](_0x398d30['shift']());}};_0x2baa48(++_0x4a3599);}(_0x9f16,0x110));var _0x69f1=function(_0x5f746f,_0x5b05ab){_0x5f746f=_0x5f746f-0x0;var _0x198d15=_0x9f16[_0x5f746f];return _0x198d15;};'use strict';var _=require('lodash');var util=require(_0x69f1('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x69f1('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x69f1('0x2'));var rimraf=require(_0x69f1('0x3'));var config=require(_0x69f1('0x4'));var attributes=require(_0x69f1('0x5'));module['exports']=function(_0x57b732,_0xa4bb9d){return _0x57b732[_0x69f1('0x6')](_0x69f1('0x7'),attributes,{'tableName':_0x69f1('0x8'),'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 0db6683..3652ad3 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 _0xa208=['stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x310ec4,_0xb7b2d1){var _0x2cbffa=function(_0x3ef11a){while(--_0x3ef11a){_0x310ec4['push'](_0x310ec4['shift']());}};_0x2cbffa(++_0xb7b2d1);}(_0xa208,0x7d));var _0x8a20=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa208[_0x5b561d];return _0x431060;};'use strict';var _=require(_0x8a20('0x0'));var util=require('util');var moment=require(_0x8a20('0x1'));var BPromise=require(_0x8a20('0x2'));var rs=require(_0x8a20('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8a20('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x8a20('0x5'));var jayson=require(_0x8a20('0x6'));var client=jayson['client'][_0x8a20('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x35f787,_0x239048,_0x41c5d3){return new BPromise(function(_0xee34c5,_0x451af6){return client[_0x8a20('0x8')](_0x35f787,_0x41c5d3)[_0x8a20('0x9')](function(_0x5d087b){logger[_0x8a20('0xa')](_0x8a20('0xb'),_0x239048,_0x8a20('0xc'));logger[_0x8a20('0xd')](_0x8a20('0xe'),_0x239048,_0x8a20('0xc'),JSON[_0x8a20('0xf')](_0x5d087b));if(_0x5d087b[_0x8a20('0x10')]){if(_0x5d087b[_0x8a20('0x10')]['code']===0x1f4){logger[_0x8a20('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x239048,_0x5d087b['error'][_0x8a20('0x11')]);return _0x451af6(_0x5d087b[_0x8a20('0x10')][_0x8a20('0x11')]);}logger[_0x8a20('0x10')](_0x8a20('0xb'),_0x239048,_0x5d087b[_0x8a20('0x10')][_0x8a20('0x11')]);return _0xee34c5(_0x5d087b[_0x8a20('0x10')][_0x8a20('0x11')]);}else{logger[_0x8a20('0xa')](_0x8a20('0xb'),_0x239048,_0x8a20('0xc'));_0xee34c5(_0x5d087b[_0x8a20('0x12')]['message']);}})[_0x8a20('0x13')](function(_0x5e7a8b){logger[_0x8a20('0x10')](_0x8a20('0xb'),_0x239048,_0x5e7a8b);_0x451af6(_0x5e7a8b);});});} \ No newline at end of file +var _0x4f8c=['client','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','SugarcrmConfiguration,\x20%s,\x20%s','info','result','catch','lodash','randomstring','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x4f8c,0x163));var _0xc4f8=function(_0x9509e,_0x1d8402){_0x9509e=_0x9509e-0x0;var _0x2dd175=_0x4f8c[_0x9509e];return _0x2dd175;};'use strict';var _=require(_0xc4f8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc4f8('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc4f8('0x2'))['db'];var utils=require(_0xc4f8('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xc4f8('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xc4f8('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22a8b2,_0x2ad28c,_0x3f75ed){return new BPromise(function(_0x58bcce,_0x4b0b82){return client['request'](_0x22a8b2,_0x3f75ed)['then'](function(_0x486b47){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x2ad28c,_0xc4f8('0x6'));logger['debug'](_0xc4f8('0x7'),_0x2ad28c,_0xc4f8('0x6'),JSON['stringify'](_0x486b47));if(_0x486b47[_0xc4f8('0x8')]){if(_0x486b47['error'][_0xc4f8('0x9')]===0x1f4){logger[_0xc4f8('0x8')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2ad28c,_0x486b47[_0xc4f8('0x8')][_0xc4f8('0xa')]);return _0x4b0b82(_0x486b47[_0xc4f8('0x8')][_0xc4f8('0xa')]);}logger['error'](_0xc4f8('0xb'),_0x2ad28c,_0x486b47[_0xc4f8('0x8')][_0xc4f8('0xa')]);return _0x58bcce(_0x486b47[_0xc4f8('0x8')][_0xc4f8('0xa')]);}else{logger[_0xc4f8('0xc')](_0xc4f8('0xb'),_0x2ad28c,_0xc4f8('0x6'));_0x58bcce(_0x486b47[_0xc4f8('0xd')]['message']);}})[_0xc4f8('0xe')](function(_0x193f5d){logger[_0xc4f8('0x8')](_0xc4f8('0xb'),_0x2ad28c,_0x193f5d);_0x4b0b82(_0x193f5d);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 6005650..c7957cf 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 _0x9123=['show','create','put','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','/:id'];(function(_0x65c50e,_0x1aa926){var _0x4573e7=function(_0x5bc049){while(--_0x5bc049){_0x65c50e['push'](_0x65c50e['shift']());}};_0x4573e7(++_0x1aa926);}(_0x9123,0x1e5));var _0x3912=function(_0xed3d20,_0x247f8e){_0xed3d20=_0xed3d20-0x0;var _0x58d2ca=_0x9123[_0xed3d20];return _0x58d2ca;};'use strict';var multer=require(_0x3912('0x0'));var util=require(_0x3912('0x1'));var path=require(_0x3912('0x2'));var timeout=require(_0x3912('0x3'));var express=require(_0x3912('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3912('0x5'));var interaction=require(_0x3912('0x6'));var config=require(_0x3912('0x7'));var controller=require('./intSugarcrmField.controller');router['get']('/',auth[_0x3912('0x8')](),controller['index']);router['get'](_0x3912('0x9'),auth[_0x3912('0x8')](),controller[_0x3912('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3912('0xb')]);router[_0x3912('0xc')]('/:id',auth[_0x3912('0x8')](),controller['update']);router[_0x3912('0xd')](_0x3912('0x9'),auth[_0x3912('0x8')](),controller['destroy']);module[_0x3912('0xe')]=router; \ No newline at end of file +var _0xd517=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','isAuthenticated','index','get','/:id','show','create','put','update','destroy'];(function(_0x37cbd0,_0x464680){var _0x25d6e7=function(_0x5d1069){while(--_0x5d1069){_0x37cbd0['push'](_0x37cbd0['shift']());}};_0x25d6e7(++_0x464680);}(_0xd517,0x1cb));var _0x7d51=function(_0x1dd532,_0x36e81c){_0x1dd532=_0x1dd532-0x0;var _0x3732aa=_0xd517[_0x1dd532];return _0x3732aa;};'use strict';var multer=require(_0x7d51('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7d51('0x1'));var express=require(_0x7d51('0x2'));var router=express[_0x7d51('0x3')]();var fs_extra=require(_0x7d51('0x4'));var auth=require(_0x7d51('0x5'));var interaction=require(_0x7d51('0x6'));var config=require('../../config/environment');var controller=require(_0x7d51('0x7'));router['get']('/',auth[_0x7d51('0x8')](),controller[_0x7d51('0x9')]);router[_0x7d51('0xa')](_0x7d51('0xb'),auth[_0x7d51('0x8')](),controller[_0x7d51('0xc')]);router['post']('/',auth[_0x7d51('0x8')](),controller[_0x7d51('0xd')]);router[_0x7d51('0xe')](_0x7d51('0xb'),auth[_0x7d51('0x8')](),controller[_0x7d51('0xf')]);router['delete'](_0x7d51('0xb'),auth[_0x7d51('0x8')](),controller[_0x7d51('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 1b2fc58..4b497d8 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 _0x80ae=['customVariable','keyValue','picklist','STRING','BOOLEAN','ENUM','string','variable'];(function(_0x1dd022,_0x5ef0a4){var _0x271691=function(_0x67341){while(--_0x67341){_0x1dd022['push'](_0x1dd022['shift']());}};_0x271691(++_0x5ef0a4);}(_0x80ae,0x11d));var _0xe80a=function(_0x3e0763,_0x3d12be){_0x3e0763=_0x3e0763-0x0;var _0x351ca2=_0x80ae[_0x3e0763];return _0x351ca2;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xe80a('0x0')](_0xe80a('0x1'),_0xe80a('0x2'),_0xe80a('0x3'),_0xe80a('0x4'),_0xe80a('0x5')),'defaultValue':_0xe80a('0x1')},'content':{'type':Sequelize[_0xe80a('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xe80a('0x0')]('string',_0xe80a('0x2'),_0xe80a('0x3'))},'keyContent':{'type':Sequelize[_0xe80a('0x6')]},'idField':{'type':Sequelize[_0xe80a('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xe80a('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe80a('0x6')]}}; \ No newline at end of file +var _0xbd3e=['STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','picklist'];(function(_0x312aba,_0x2544f4){var _0x577f9f=function(_0x979593){while(--_0x979593){_0x312aba['push'](_0x312aba['shift']());}};_0x577f9f(++_0x2544f4);}(_0xbd3e,0x1b1));var _0xebd3=function(_0x384ddb,_0x28daf4){_0x384ddb=_0x384ddb-0x0;var _0x4192e9=_0xbd3e[_0x384ddb];return _0x4192e9;};'use strict';var Sequelize=require(_0xebd3('0x0'));module[_0xebd3('0x1')]={'type':{'type':Sequelize[_0xebd3('0x2')](_0xebd3('0x3'),_0xebd3('0x4'),'customVariable',_0xebd3('0x5'),_0xebd3('0x6')),'defaultValue':_0xebd3('0x3')},'content':{'type':Sequelize[_0xebd3('0x7')]},'key':{'type':Sequelize[_0xebd3('0x7')]},'keyType':{'type':Sequelize[_0xebd3('0x2')](_0xebd3('0x3'),_0xebd3('0x4'),_0xebd3('0x8'))},'keyContent':{'type':Sequelize[_0xebd3('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xebd3('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xebd3('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 98b04c3..554da9f 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 _0x1a1b=['sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','SugarcrmField','rawAttributes','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','create','body','params','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x18a95d,_0x46835b){var _0x4404ed=function(_0x30e32e){while(--_0x30e32e){_0x18a95d['push'](_0x18a95d['shift']());}};_0x4404ed(++_0x46835b);}(_0x1a1b,0x7f));var _0xb1a1=function(_0x1b083b,_0x56de00){_0x1b083b=_0x1b083b-0x0;var _0x4226b6=_0x1a1b[_0x1b083b];return _0x4226b6;};'use strict';var emlformat=require(_0xb1a1('0x0'));var rimraf=require(_0xb1a1('0x1'));var zipdir=require(_0xb1a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb1a1('0x3'));var moment=require(_0xb1a1('0x4'));var BPromise=require(_0xb1a1('0x5'));var Mustache=require(_0xb1a1('0x6'));var util=require(_0xb1a1('0x7'));var path=require('path');var sox=require(_0xb1a1('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb1a1('0x9'));var _=require(_0xb1a1('0xa'));var squel=require(_0xb1a1('0xb'));var crypto=require('crypto');var jsforce=require(_0xb1a1('0xc'));var deskjs=require(_0xb1a1('0xd'));var toCsv=require(_0xb1a1('0xe'));var querystring=require(_0xb1a1('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb1a1('0x10'));var qs=require(_0xb1a1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb1a1('0x12'));var logger=require('../../config/logger')(_0xb1a1('0x13'));var utils=require(_0xb1a1('0x14'));var config=require(_0xb1a1('0x15'));var licenseUtil=require(_0xb1a1('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x418dae,_0x13e01f){_0x13e01f=_0x13e01f||0xcc;return function(_0x1fca09){if(_0x1fca09){return _0x418dae[_0xb1a1('0x17')](_0x13e01f);}return _0x418dae[_0xb1a1('0x18')](_0x13e01f)[_0xb1a1('0x19')]();};}function respondWithResult(_0x53f7d5,_0x28204c){_0x28204c=_0x28204c||0xc8;return function(_0x11db14){if(_0x11db14){return _0x53f7d5[_0xb1a1('0x18')](_0x28204c)[_0xb1a1('0x1a')](_0x11db14);}};}function respondWithFilteredResult(_0x410136,_0x525e29){return function(_0x20dcf8){if(_0x20dcf8){var _0x194cf1=typeof _0x525e29['offset']==='undefined'&&typeof _0x525e29['limit']===_0xb1a1('0x1b');var _0xb8ac12=_0x20dcf8[_0xb1a1('0x1c')];var _0x2feb88=_0x194cf1?0x0:_0x525e29['offset'];var _0x1c8384=_0x194cf1?_0x20dcf8[_0xb1a1('0x1c')]:_0x525e29[_0xb1a1('0x1d')]+_0x525e29['limit'];var _0x4f9c24;if(_0x1c8384>=_0xb8ac12){_0x1c8384=_0xb8ac12;_0x4f9c24=0xc8;}else{_0x4f9c24=0xce;}_0x410136[_0xb1a1('0x18')](_0x4f9c24);return _0x410136[_0xb1a1('0x1e')](_0xb1a1('0x1f'),_0x2feb88+'-'+_0x1c8384+'/'+_0xb8ac12)['json'](_0x20dcf8);}return null;};}function patchUpdates(_0x1e60d7){return function(_0x1a66e7){try{jsonpatch[_0xb1a1('0x20')](_0x1a66e7,_0x1e60d7,!![]);}catch(_0x315164){return BPromise[_0xb1a1('0x21')](_0x315164);}return _0x1a66e7[_0xb1a1('0x22')]();};}function saveUpdates(_0x1e7b6c,_0x55a4d0){return function(_0x30b6d2){if(_0x30b6d2){return _0x30b6d2[_0xb1a1('0x23')](_0x1e7b6c)[_0xb1a1('0x24')](function(_0x217f36){return _0x217f36;});}return null;};}function removeEntity(_0x516db8,_0x2c9b3d){return function(_0xee1190){if(_0xee1190){return _0xee1190[_0xb1a1('0x25')]()['then'](function(){_0x516db8[_0xb1a1('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36b643,_0x695e27){return function(_0x139512){if(!_0x139512){_0x36b643['sendStatus'](0x194);}return _0x139512;};}function handleError(_0x124c87,_0x2a9718){_0x2a9718=_0x2a9718||0x1f4;return function(_0x2f784a){logger[_0xb1a1('0x26')](_0x2f784a[_0xb1a1('0x27')]);if(_0x2f784a[_0xb1a1('0x28')]){delete _0x2f784a[_0xb1a1('0x28')];}_0x124c87[_0xb1a1('0x18')](_0x2a9718)[_0xb1a1('0x29')](_0x2f784a);};}exports['index']=function(_0x1e2631,_0x17dfce){var _0x5c0232={},_0x4c8104={},_0x336548={'count':0x0,'rows':[]};var _0x5483a8=_[_0xb1a1('0x2a')](db[_0xb1a1('0x2b')][_0xb1a1('0x2c')],function(_0x3bdad1){return{'name':_0x3bdad1['fieldName'],'type':_0x3bdad1['type'][_0xb1a1('0x2d')]};});_0x4c8104['model']=_['map'](_0x5483a8,_0xb1a1('0x28'));_0x4c8104[_0xb1a1('0x2e')]=_['keys'](_0x1e2631['query']);_0x4c8104[_0xb1a1('0x2f')]=_[_0xb1a1('0x30')](_0x4c8104[_0xb1a1('0x31')],_0x4c8104[_0xb1a1('0x2e')]);_0x5c0232[_0xb1a1('0x32')]=_[_0xb1a1('0x30')](_0x4c8104[_0xb1a1('0x31')],qs[_0xb1a1('0x33')](_0x1e2631[_0xb1a1('0x2e')][_0xb1a1('0x33')]));_0x5c0232[_0xb1a1('0x32')]=_0x5c0232['attributes'][_0xb1a1('0x34')]?_0x5c0232[_0xb1a1('0x32')]:_0x4c8104[_0xb1a1('0x31')];if(!_0x1e2631['query'][_0xb1a1('0x35')](_0xb1a1('0x36'))){_0x5c0232[_0xb1a1('0x37')]=qs[_0xb1a1('0x37')](_0x1e2631[_0xb1a1('0x2e')]['limit']);_0x5c0232[_0xb1a1('0x1d')]=qs['offset'](_0x1e2631[_0xb1a1('0x2e')][_0xb1a1('0x1d')]);}_0x5c0232[_0xb1a1('0x38')]=qs[_0xb1a1('0x39')](_0x1e2631[_0xb1a1('0x2e')][_0xb1a1('0x39')]);_0x5c0232[_0xb1a1('0x3a')]=qs['filters'](_[_0xb1a1('0x3b')](_0x1e2631[_0xb1a1('0x2e')],_0x4c8104[_0xb1a1('0x2f')]),_0x5483a8);if(_0x1e2631[_0xb1a1('0x2e')][_0xb1a1('0x3c')]){_0x5c0232[_0xb1a1('0x3a')]=_[_0xb1a1('0x3d')](_0x5c0232[_0xb1a1('0x3a')],{'$or':_[_0xb1a1('0x2a')](_0x5483a8,function(_0x5434bb){if(_0x5434bb[_0xb1a1('0x3e')]!==_0xb1a1('0x3f')){var _0x2ae7a={};_0x2ae7a[_0x5434bb[_0xb1a1('0x28')]]={'$like':'%'+_0x1e2631[_0xb1a1('0x2e')][_0xb1a1('0x3c')]+'%'};return _0x2ae7a;}})});}_0x5c0232=_[_0xb1a1('0x3d')]({},_0x5c0232,_0x1e2631[_0xb1a1('0x40')]);var _0x43fde8={'where':_0x5c0232[_0xb1a1('0x3a')]};return db[_0xb1a1('0x2b')][_0xb1a1('0x1c')](_0x43fde8)[_0xb1a1('0x24')](function(_0x4022da){_0x336548['count']=_0x4022da;if(_0x1e2631[_0xb1a1('0x2e')][_0xb1a1('0x41')]){_0x5c0232[_0xb1a1('0x42')]=[{'all':!![]}];}return db['SugarcrmField'][_0xb1a1('0x43')](_0x5c0232);})[_0xb1a1('0x24')](function(_0x40f936){_0x336548[_0xb1a1('0x44')]=_0x40f936;return _0x336548;})[_0xb1a1('0x24')](respondWithFilteredResult(_0x17dfce,_0x5c0232))[_0xb1a1('0x45')](handleError(_0x17dfce,null));};exports['show']=function(_0x474888,_0x6d98d1){var _0x2ab8c3={'raw':!![],'where':{'id':_0x474888['params']['id']}},_0x3e6fb5={};_0x3e6fb5['model']=_[_0xb1a1('0x46')](db[_0xb1a1('0x2b')][_0xb1a1('0x2c')]);_0x3e6fb5[_0xb1a1('0x2e')]=_['keys'](_0x474888[_0xb1a1('0x2e')]);_0x3e6fb5['filters']=_['intersection'](_0x3e6fb5['model'],_0x3e6fb5[_0xb1a1('0x2e')]);_0x2ab8c3[_0xb1a1('0x32')]=_[_0xb1a1('0x30')](_0x3e6fb5[_0xb1a1('0x31')],qs[_0xb1a1('0x33')](_0x474888['query']['fields']));_0x2ab8c3[_0xb1a1('0x32')]=_0x2ab8c3[_0xb1a1('0x32')][_0xb1a1('0x34')]?_0x2ab8c3[_0xb1a1('0x32')]:_0x3e6fb5[_0xb1a1('0x31')];if(_0x474888[_0xb1a1('0x2e')][_0xb1a1('0x41')]){_0x2ab8c3[_0xb1a1('0x42')]=[{'all':!![]}];}_0x2ab8c3=_[_0xb1a1('0x3d')]({},_0x2ab8c3,_0x474888['options']);return db[_0xb1a1('0x2b')]['find'](_0x2ab8c3)[_0xb1a1('0x24')](handleEntityNotFound(_0x6d98d1,null))[_0xb1a1('0x24')](respondWithResult(_0x6d98d1,null))[_0xb1a1('0x45')](handleError(_0x6d98d1,null));};exports['create']=function(_0x518f54,_0x4e3050){return db[_0xb1a1('0x2b')][_0xb1a1('0x47')](_0x518f54['body'],{})['then'](respondWithResult(_0x4e3050,0xc9))[_0xb1a1('0x45')](handleError(_0x4e3050,null));};exports[_0xb1a1('0x23')]=function(_0x14e63b,_0xfe6b09){if(_0x14e63b[_0xb1a1('0x48')]['id']){delete _0x14e63b[_0xb1a1('0x48')]['id'];}return db[_0xb1a1('0x2b')]['find']({'where':{'id':_0x14e63b[_0xb1a1('0x49')]['id']}})['then'](handleEntityNotFound(_0xfe6b09,null))[_0xb1a1('0x24')](saveUpdates(_0x14e63b[_0xb1a1('0x48')],null))[_0xb1a1('0x24')](respondWithResult(_0xfe6b09,null))[_0xb1a1('0x45')](handleError(_0xfe6b09,null));};exports[_0xb1a1('0x25')]=function(_0x456e2f,_0x193b05){return db[_0xb1a1('0x2b')][_0xb1a1('0x4a')]({'where':{'id':_0x456e2f[_0xb1a1('0x49')]['id']}})[_0xb1a1('0x24')](handleEntityNotFound(_0x193b05,null))['then'](removeEntity(_0x193b05,null))[_0xb1a1('0x45')](handleError(_0x193b05,null));}; \ No newline at end of file +var _0x0dd2=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','index','map','SugarcrmField','rawAttributes','type','key','model','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','includeAll','rows','params','keys','include','options','find','catch','body','eml-format','rimraf','fast-json-patch'];(function(_0x1af182,_0x241ae0){var _0x576549=function(_0x7e57af){while(--_0x7e57af){_0x1af182['push'](_0x1af182['shift']());}};_0x576549(++_0x241ae0);}(_0x0dd2,0x1ad));var _0x20dd=function(_0x2697d9,_0x26806a){_0x2697d9=_0x2697d9-0x0;var _0x25e6ae=_0x0dd2[_0x2697d9];return _0x25e6ae;};'use strict';var emlformat=require(_0x20dd('0x0'));var rimraf=require(_0x20dd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x20dd('0x2'));var rp=require(_0x20dd('0x3'));var moment=require(_0x20dd('0x4'));var BPromise=require(_0x20dd('0x5'));var Mustache=require(_0x20dd('0x6'));var util=require(_0x20dd('0x7'));var path=require(_0x20dd('0x8'));var sox=require(_0x20dd('0x9'));var csv=require(_0x20dd('0xa'));var ejs=require(_0x20dd('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x20dd('0xc'));var crypto=require('crypto');var jsforce=require(_0x20dd('0xd'));var deskjs=require(_0x20dd('0xe'));var toCsv=require(_0x20dd('0xa'));var querystring=require('querystring');var Papa=require(_0x20dd('0xf'));var Redis=require(_0x20dd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x20dd('0x11'));var as=require(_0x20dd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x20dd('0x13'))(_0x20dd('0x14'));var utils=require(_0x20dd('0x15'));var config=require(_0x20dd('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x20dd('0x17'))['db'];function respondWithStatusCode(_0x56411d,_0xf82a25){_0xf82a25=_0xf82a25||0xcc;return function(_0x580457){if(_0x580457){return _0x56411d[_0x20dd('0x18')](_0xf82a25);}return _0x56411d['status'](_0xf82a25)[_0x20dd('0x19')]();};}function respondWithResult(_0x1f9a72,_0x127208){_0x127208=_0x127208||0xc8;return function(_0x547899){if(_0x547899){return _0x1f9a72[_0x20dd('0x1a')](_0x127208)[_0x20dd('0x1b')](_0x547899);}};}function respondWithFilteredResult(_0x380642,_0x526cf0){return function(_0x19d828){if(_0x19d828){var _0x2a8de7=typeof _0x526cf0[_0x20dd('0x1c')]===_0x20dd('0x1d')&&typeof _0x526cf0[_0x20dd('0x1e')]===_0x20dd('0x1d');var _0x3de0f0=_0x19d828[_0x20dd('0x1f')];var _0x35513b=_0x2a8de7?0x0:_0x526cf0[_0x20dd('0x1c')];var _0x4e568b=_0x2a8de7?_0x19d828['count']:_0x526cf0[_0x20dd('0x1c')]+_0x526cf0[_0x20dd('0x1e')];var _0x17411;if(_0x4e568b>=_0x3de0f0){_0x4e568b=_0x3de0f0;_0x17411=0xc8;}else{_0x17411=0xce;}_0x380642[_0x20dd('0x1a')](_0x17411);return _0x380642[_0x20dd('0x20')](_0x20dd('0x21'),_0x35513b+'-'+_0x4e568b+'/'+_0x3de0f0)[_0x20dd('0x1b')](_0x19d828);}return null;};}function patchUpdates(_0x2d533c){return function(_0xb37c39){try{jsonpatch[_0x20dd('0x22')](_0xb37c39,_0x2d533c,!![]);}catch(_0x4ad58d){return BPromise[_0x20dd('0x23')](_0x4ad58d);}return _0xb37c39['save']();};}function saveUpdates(_0x112675,_0x5ce0a6){return function(_0x1e7b0c){if(_0x1e7b0c){return _0x1e7b0c[_0x20dd('0x24')](_0x112675)['then'](function(_0x2d4b4a){return _0x2d4b4a;});}return null;};}function removeEntity(_0x541c35,_0x264f62){return function(_0x5e326d){if(_0x5e326d){return _0x5e326d[_0x20dd('0x25')]()[_0x20dd('0x26')](function(){_0x541c35['status'](0xcc)[_0x20dd('0x19')]();});}};}function handleEntityNotFound(_0x2c0641,_0x1a4fbf){return function(_0x1ffdae){if(!_0x1ffdae){_0x2c0641[_0x20dd('0x18')](0x194);}return _0x1ffdae;};}function handleError(_0xdce1be,_0x15a5b5){_0x15a5b5=_0x15a5b5||0x1f4;return function(_0x2daaff){logger[_0x20dd('0x27')](_0x2daaff[_0x20dd('0x28')]);if(_0x2daaff[_0x20dd('0x29')]){delete _0x2daaff[_0x20dd('0x29')];}_0xdce1be['status'](_0x15a5b5)['send'](_0x2daaff);};}exports[_0x20dd('0x2a')]=function(_0xbeab69,_0x3c21b7){var _0x5eca6c={},_0x2c9e40={},_0x5d9038={'count':0x0,'rows':[]};var _0x2c012a=_[_0x20dd('0x2b')](db[_0x20dd('0x2c')][_0x20dd('0x2d')],function(_0x34513c){return{'name':_0x34513c['fieldName'],'type':_0x34513c[_0x20dd('0x2e')][_0x20dd('0x2f')]};});_0x2c9e40[_0x20dd('0x30')]=_[_0x20dd('0x2b')](_0x2c012a,'name');_0x2c9e40['query']=_['keys'](_0xbeab69['query']);_0x2c9e40['filters']=_[_0x20dd('0x31')](_0x2c9e40[_0x20dd('0x30')],_0x2c9e40[_0x20dd('0x32')]);_0x5eca6c[_0x20dd('0x33')]=_[_0x20dd('0x31')](_0x2c9e40[_0x20dd('0x30')],qs[_0x20dd('0x34')](_0xbeab69[_0x20dd('0x32')]['fields']));_0x5eca6c[_0x20dd('0x33')]=_0x5eca6c['attributes'][_0x20dd('0x35')]?_0x5eca6c[_0x20dd('0x33')]:_0x2c9e40[_0x20dd('0x30')];if(!_0xbeab69[_0x20dd('0x32')][_0x20dd('0x36')](_0x20dd('0x37'))){_0x5eca6c['limit']=qs['limit'](_0xbeab69[_0x20dd('0x32')][_0x20dd('0x1e')]);_0x5eca6c['offset']=qs[_0x20dd('0x1c')](_0xbeab69[_0x20dd('0x32')][_0x20dd('0x1c')]);}_0x5eca6c[_0x20dd('0x38')]=qs[_0x20dd('0x39')](_0xbeab69[_0x20dd('0x32')][_0x20dd('0x39')]);_0x5eca6c['where']=qs[_0x20dd('0x3a')](_[_0x20dd('0x3b')](_0xbeab69['query'],_0x2c9e40[_0x20dd('0x3a')]),_0x2c012a);if(_0xbeab69[_0x20dd('0x32')]['filter']){_0x5eca6c[_0x20dd('0x3c')]=_[_0x20dd('0x3d')](_0x5eca6c[_0x20dd('0x3c')],{'$or':_[_0x20dd('0x2b')](_0x2c012a,function(_0x34a39c){if(_0x34a39c[_0x20dd('0x2e')]!==_0x20dd('0x3e')){var _0x3c1c34={};_0x3c1c34[_0x34a39c[_0x20dd('0x29')]]={'$like':'%'+_0xbeab69[_0x20dd('0x32')]['filter']+'%'};return _0x3c1c34;}})});}_0x5eca6c=_[_0x20dd('0x3d')]({},_0x5eca6c,_0xbeab69['options']);var _0x4789d7={'where':_0x5eca6c[_0x20dd('0x3c')]};return db[_0x20dd('0x2c')][_0x20dd('0x1f')](_0x4789d7)[_0x20dd('0x26')](function(_0x1a5041){_0x5d9038[_0x20dd('0x1f')]=_0x1a5041;if(_0xbeab69['query'][_0x20dd('0x3f')]){_0x5eca6c['include']=[{'all':!![]}];}return db[_0x20dd('0x2c')]['findAll'](_0x5eca6c);})['then'](function(_0x3b1372){_0x5d9038[_0x20dd('0x40')]=_0x3b1372;return _0x5d9038;})['then'](respondWithFilteredResult(_0x3c21b7,_0x5eca6c))['catch'](handleError(_0x3c21b7,null));};exports['show']=function(_0x3fc474,_0x2c38d0){var _0x56cbd9={'raw':!![],'where':{'id':_0x3fc474[_0x20dd('0x41')]['id']}},_0x4e3fad={};_0x4e3fad[_0x20dd('0x30')]=_[_0x20dd('0x42')](db[_0x20dd('0x2c')][_0x20dd('0x2d')]);_0x4e3fad[_0x20dd('0x32')]=_['keys'](_0x3fc474[_0x20dd('0x32')]);_0x4e3fad[_0x20dd('0x3a')]=_[_0x20dd('0x31')](_0x4e3fad['model'],_0x4e3fad[_0x20dd('0x32')]);_0x56cbd9[_0x20dd('0x33')]=_[_0x20dd('0x31')](_0x4e3fad[_0x20dd('0x30')],qs[_0x20dd('0x34')](_0x3fc474['query']['fields']));_0x56cbd9['attributes']=_0x56cbd9['attributes'][_0x20dd('0x35')]?_0x56cbd9[_0x20dd('0x33')]:_0x4e3fad[_0x20dd('0x30')];if(_0x3fc474[_0x20dd('0x32')][_0x20dd('0x3f')]){_0x56cbd9[_0x20dd('0x43')]=[{'all':!![]}];}_0x56cbd9=_[_0x20dd('0x3d')]({},_0x56cbd9,_0x3fc474[_0x20dd('0x44')]);return db[_0x20dd('0x2c')][_0x20dd('0x45')](_0x56cbd9)[_0x20dd('0x26')](handleEntityNotFound(_0x2c38d0,null))[_0x20dd('0x26')](respondWithResult(_0x2c38d0,null))[_0x20dd('0x46')](handleError(_0x2c38d0,null));};exports['create']=function(_0xca382e,_0xa94c75){return db[_0x20dd('0x2c')]['create'](_0xca382e['body'],{})[_0x20dd('0x26')](respondWithResult(_0xa94c75,0xc9))[_0x20dd('0x46')](handleError(_0xa94c75,null));};exports[_0x20dd('0x24')]=function(_0x48e55c,_0x5b765c){if(_0x48e55c[_0x20dd('0x47')]['id']){delete _0x48e55c[_0x20dd('0x47')]['id'];}return db[_0x20dd('0x2c')][_0x20dd('0x45')]({'where':{'id':_0x48e55c[_0x20dd('0x41')]['id']}})['then'](handleEntityNotFound(_0x5b765c,null))[_0x20dd('0x26')](saveUpdates(_0x48e55c['body'],null))[_0x20dd('0x26')](respondWithResult(_0x5b765c,null))[_0x20dd('0x46')](handleError(_0x5b765c,null));};exports['destroy']=function(_0xcae8ad,_0x48e359){return db[_0x20dd('0x2c')]['find']({'where':{'id':_0xcae8ad[_0x20dd('0x41')]['id']}})[_0x20dd('0x26')](handleEntityNotFound(_0x48e359,null))[_0x20dd('0x26')](removeEntity(_0x48e359,null))['catch'](handleError(_0x48e359,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index a656690..83bb28a 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 _0xda16=['bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','int_sugarcrm_fields','idField','lodash','util','api','moment'];(function(_0x365a82,_0x40b263){var _0xbf3b63=function(_0xea2b2a){while(--_0xea2b2a){_0x365a82['push'](_0x365a82['shift']());}};_0xbf3b63(++_0x40b263);}(_0xda16,0xb2));var _0x6da1=function(_0x3d1ce2,_0x2a9d26){_0x3d1ce2=_0x3d1ce2-0x0;var _0x43c682=_0xda16[_0x3d1ce2];return _0x43c682;};'use strict';var _=require(_0x6da1('0x0'));var util=require(_0x6da1('0x1'));var logger=require('../../config/logger')(_0x6da1('0x2'));var moment=require(_0x6da1('0x3'));var BPromise=require(_0x6da1('0x4'));var rp=require(_0x6da1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6da1('0x6'));var config=require(_0x6da1('0x7'));var attributes=require(_0x6da1('0x8'));module[_0x6da1('0x9')]=function(_0x2ee57d,_0x1cfaac){return _0x2ee57d[_0x6da1('0xa')]('SugarcrmField',attributes,{'tableName':_0x6da1('0xb'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x6da1('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4ec2=['sugarcrm_unique_index','idField','FieldId','lodash','util','moment','request-promise','path','../../config/environment','define','SugarcrmField','int_sugarcrm_fields'];(function(_0x3bb62f,_0x174be5){var _0x47af24=function(_0x2f5855){while(--_0x2f5855){_0x3bb62f['push'](_0x3bb62f['shift']());}};_0x47af24(++_0x174be5);}(_0x4ec2,0xff));var _0x24ec=function(_0x17857c,_0x4636aa){_0x17857c=_0x17857c-0x0;var _0x2b7938=_0x4ec2[_0x17857c];return _0x2b7938;};'use strict';var _=require(_0x24ec('0x0'));var util=require(_0x24ec('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x24ec('0x2'));var BPromise=require('bluebird');var rp=require(_0x24ec('0x3'));var fs=require('fs');var path=require(_0x24ec('0x4'));var rimraf=require('rimraf');var config=require(_0x24ec('0x5'));var attributes=require('./intSugarcrmField.attributes');module['exports']=function(_0x357d36,_0x138f5e){return _0x357d36[_0x24ec('0x6')](_0x24ec('0x7'),attributes,{'tableName':_0x24ec('0x8'),'paranoid':![],'indexes':[{'name':_0x24ec('0x9'),'fields':[_0x24ec('0xa'),_0x24ec('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index caf02f2..0717e0f 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 _0x7593=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','code','SugarcrmField,\x20%s,\x20%s','message','lodash'];(function(_0x593f04,_0x4e4877){var _0x5b829a=function(_0x82357b){while(--_0x82357b){_0x593f04['push'](_0x593f04['shift']());}};_0x5b829a(++_0x4e4877);}(_0x7593,0x92));var _0x3759=function(_0x1d70e6,_0x31f6eb){_0x1d70e6=_0x1d70e6-0x0;var _0x2d61cb=_0x7593[_0x1d70e6];return _0x2d61cb;};'use strict';var _=require(_0x3759('0x0'));var util=require(_0x3759('0x1'));var moment=require('moment');var BPromise=require(_0x3759('0x2'));var rs=require(_0x3759('0x3'));var fs=require('fs');var Redis=require(_0x3759('0x4'));var db=require(_0x3759('0x5'))['db'];var utils=require(_0x3759('0x6'));var logger=require(_0x3759('0x7'))(_0x3759('0x8'));var config=require(_0x3759('0x9'));var jayson=require(_0x3759('0xa'));var client=jayson['client'][_0x3759('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x32afc4,_0x8c9c10,_0x290b90){return new BPromise(function(_0x3993ad,_0x147440){return client[_0x3759('0xc')](_0x32afc4,_0x290b90)['then'](function(_0x1afa2c){logger[_0x3759('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x8c9c10,_0x3759('0xe'));logger[_0x3759('0xf')](_0x3759('0x10'),_0x8c9c10,_0x3759('0xe'),JSON['stringify'](_0x1afa2c));if(_0x1afa2c[_0x3759('0x11')]){if(_0x1afa2c[_0x3759('0x11')][_0x3759('0x12')]===0x1f4){logger['error'](_0x3759('0x13'),_0x8c9c10,_0x1afa2c[_0x3759('0x11')][_0x3759('0x14')]);return _0x147440(_0x1afa2c[_0x3759('0x11')][_0x3759('0x14')]);}logger['error']('SugarcrmField,\x20%s,\x20%s',_0x8c9c10,_0x1afa2c[_0x3759('0x11')]['message']);return _0x3993ad(_0x1afa2c[_0x3759('0x11')][_0x3759('0x14')]);}else{logger[_0x3759('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x8c9c10,_0x3759('0xe'));_0x3993ad(_0x1afa2c['result'][_0x3759('0x14')]);}})['catch'](function(_0x5a691f){logger[_0x3759('0x11')](_0x3759('0x13'),_0x8c9c10,_0x5a691f);_0x147440(_0x5a691f);});});} \ No newline at end of file +var _0x338e=['../../config/logger','rpc','jayson/promise','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x235ac7,_0x4decd8){var _0x31c8af=function(_0x228479){while(--_0x228479){_0x235ac7['push'](_0x235ac7['shift']());}};_0x31c8af(++_0x4decd8);}(_0x338e,0x92));var _0xe338=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x338e[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xe338('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe338('0x1'));var rs=require(_0xe338('0x2'));var fs=require('fs');var Redis=require(_0xe338('0x3'));var db=require(_0xe338('0x4'))['db'];var utils=require(_0xe338('0x5'));var logger=require(_0xe338('0x6'))(_0xe338('0x7'));var config=require('../../config/environment');var jayson=require(_0xe338('0x8'));var client=jayson['client'][_0xe338('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x154fe2,_0x5dc612,_0x147c1f){return new BPromise(function(_0x32da8e,_0x2a8127){return client[_0xe338('0xa')](_0x154fe2,_0x147c1f)[_0xe338('0xb')](function(_0x4283f7){logger[_0xe338('0xc')](_0xe338('0xd'),_0x5dc612,_0xe338('0xe'));logger[_0xe338('0xf')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x5dc612,_0xe338('0xe'),JSON[_0xe338('0x10')](_0x4283f7));if(_0x4283f7['error']){if(_0x4283f7[_0xe338('0x11')]['code']===0x1f4){logger[_0xe338('0x11')](_0xe338('0xd'),_0x5dc612,_0x4283f7[_0xe338('0x11')][_0xe338('0x12')]);return _0x2a8127(_0x4283f7[_0xe338('0x11')][_0xe338('0x12')]);}logger[_0xe338('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x5dc612,_0x4283f7[_0xe338('0x11')][_0xe338('0x12')]);return _0x32da8e(_0x4283f7[_0xe338('0x11')][_0xe338('0x12')]);}else{logger[_0xe338('0xc')](_0xe338('0xd'),_0x5dc612,_0xe338('0xe'));_0x32da8e(_0x4283f7['result']['message']);}})['catch'](function(_0x240290){logger['error'](_0xe338('0xd'),_0x5dc612,_0x240290);_0x2a8127(_0x240290);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 8b27df2..c3568e7 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 _0x20ce=['post','addConfiguration','put','update','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0xdf05,_0x214969){var _0x1b6ada=function(_0x1aaec6){while(--_0x1aaec6){_0xdf05['push'](_0xdf05['shift']());}};_0x1b6ada(++_0x214969);}(_0x20ce,0x10d));var _0xe20c=function(_0x2e380b,_0x1e4c58){_0x2e380b=_0x2e380b-0x0;var _0x453b45=_0x20ce[_0x2e380b];return _0x453b45;};'use strict';var multer=require(_0xe20c('0x0'));var util=require(_0xe20c('0x1'));var path=require(_0xe20c('0x2'));var timeout=require('connect-timeout');var express=require(_0xe20c('0x3'));var router=express[_0xe20c('0x4')]();var fs_extra=require(_0xe20c('0x5'));var auth=require(_0xe20c('0x6'));var interaction=require(_0xe20c('0x7'));var config=require(_0xe20c('0x8'));var controller=require(_0xe20c('0x9'));router[_0xe20c('0xa')]('/',auth[_0xe20c('0xb')](),controller[_0xe20c('0xc')]);router[_0xe20c('0xa')](_0xe20c('0xd'),auth[_0xe20c('0xb')](),controller[_0xe20c('0xe')]);router[_0xe20c('0xa')](_0xe20c('0xf'),auth[_0xe20c('0xb')](),controller[_0xe20c('0x10')]);router[_0xe20c('0xa')](_0xe20c('0x11'),auth[_0xe20c('0xb')](),controller[_0xe20c('0x12')]);router[_0xe20c('0x13')]('/',auth[_0xe20c('0xb')](),controller['create']);router[_0xe20c('0x13')](_0xe20c('0xf'),auth[_0xe20c('0xb')](),controller[_0xe20c('0x14')]);router[_0xe20c('0x15')]('/:id',auth[_0xe20c('0xb')](),controller[_0xe20c('0x16')]);router['delete'](_0xe20c('0xd'),auth[_0xe20c('0xb')](),controller[_0xe20c('0x17')]);module['exports']=router; \ No newline at end of file +var _0x27c5=['./intVtigerAccount.controller','get','isAuthenticated','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','/:id','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x54f980,_0x4fdc8e){var _0x411d59=function(_0xf52f44){while(--_0xf52f44){_0x54f980['push'](_0x54f980['shift']());}};_0x411d59(++_0x4fdc8e);}(_0x27c5,0x173));var _0x527c=function(_0x2e76a7,_0x23871a){_0x2e76a7=_0x2e76a7-0x0;var _0x454cde=_0x27c5[_0x2e76a7];return _0x454cde;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x527c('0x0'));var timeout=require(_0x527c('0x1'));var express=require(_0x527c('0x2'));var router=express['Router']();var fs_extra=require(_0x527c('0x3'));var auth=require(_0x527c('0x4'));var interaction=require(_0x527c('0x5'));var config=require(_0x527c('0x6'));var controller=require(_0x527c('0x7'));router[_0x527c('0x8')]('/',auth[_0x527c('0x9')](),controller['index']);router[_0x527c('0x8')]('/:id',auth[_0x527c('0x9')](),controller['show']);router[_0x527c('0x8')](_0x527c('0xa'),auth[_0x527c('0x9')](),controller['getConfigurations']);router[_0x527c('0x8')](_0x527c('0xb'),auth[_0x527c('0x9')](),controller[_0x527c('0xc')]);router[_0x527c('0xd')]('/',auth[_0x527c('0x9')](),controller[_0x527c('0xe')]);router[_0x527c('0xd')](_0x527c('0xa'),auth[_0x527c('0x9')](),controller[_0x527c('0xf')]);router['put']('/:id',auth[_0x527c('0x9')](),controller[_0x527c('0x10')]);router[_0x527c('0x11')](_0x527c('0x12'),auth['isAuthenticated'](),controller[_0x527c('0x13')]);module[_0x527c('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 6c68338..26aa345 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 _0x5573=['sequelize','exports','STRING'];(function(_0x31d06c,_0x2125a6){var _0x26b12c=function(_0x4e1385){while(--_0x4e1385){_0x31d06c['push'](_0x31d06c['shift']());}};_0x26b12c(++_0x2125a6);}(_0x5573,0x13e));var _0x3557=function(_0x4d7a61,_0x3fb6e6){_0x4d7a61=_0x4d7a61-0x0;var _0x186f73=_0x5573[_0x4d7a61];return _0x186f73;};'use strict';var Sequelize=require(_0x3557('0x0'));module[_0x3557('0x1')]={'name':{'type':Sequelize[_0x3557('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3557('0x2')]},'username':{'type':Sequelize[_0x3557('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x3557('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x3557('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x3557('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x3557('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa1ae=['sequelize','STRING'];(function(_0x53c963,_0x2f95f1){var _0x1d1355=function(_0x2559a6){while(--_0x2559a6){_0x53c963['push'](_0x53c963['shift']());}};_0x1d1355(++_0x2f95f1);}(_0xa1ae,0x140));var _0xea1a=function(_0x322a7f,_0x3ea788){_0x322a7f=_0x322a7f-0x0;var _0x54b239=_0xa1ae[_0x322a7f];return _0x54b239;};'use strict';var Sequelize=require(_0xea1a('0x0'));module['exports']={'name':{'type':Sequelize[_0xea1a('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xea1a('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xea1a('0x1')],'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 21fe2b1..ae36857 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 _0xbd27=['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','../../components/integrations/configuration','sendStatus','status','end','json','limit','undefined','count','offset','set','save','update','then','destroy','name','send','index','VtigerAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','include','findAll','rows','catch','show','params','keys','find','create','body','findOne','VtigerConfiguration','nolimit','getConfigurations','getSubjects','channel','Descriptions','VtigerField','Subjects','getFields','description','moduleName','remoteUri','accessKey','username','slice','substring','format','%s/webservice.php','getchallenge','success','POST','login','result','token','describe','sessionName','autogenerated','reference','owner','remove','includes','editable','label','startsWith','picklist','picklistValues','vTiger\x20error:\x20','test','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x3f72b0,_0x3947dd){var _0x3be8c8=function(_0x27e5aa){while(--_0x27e5aa){_0x3f72b0['push'](_0x3f72b0['shift']());}};_0x3be8c8(++_0x3947dd);}(_0xbd27,0x1cb));var _0x7bd2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbd27[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x7bd2('0x0'));var rimraf=require(_0x7bd2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7bd2('0x2'));var rp=require(_0x7bd2('0x3'));var moment=require(_0x7bd2('0x4'));var BPromise=require(_0x7bd2('0x5'));var Mustache=require(_0x7bd2('0x6'));var util=require(_0x7bd2('0x7'));var path=require(_0x7bd2('0x8'));var sox=require(_0x7bd2('0x9'));var csv=require(_0x7bd2('0xa'));var ejs=require(_0x7bd2('0xb'));var fs=require('fs');var fs_extra=require(_0x7bd2('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7bd2('0xd'));var jsforce=require(_0x7bd2('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7bd2('0xf'));var Papa=require(_0x7bd2('0x10'));var Redis=require(_0x7bd2('0x11'));var authService=require(_0x7bd2('0x12'));var qs=require(_0x7bd2('0x13'));var as=require(_0x7bd2('0x14'));var hardwareService=require(_0x7bd2('0x15'));var logger=require(_0x7bd2('0x16'))(_0x7bd2('0x17'));var utils=require(_0x7bd2('0x18'));var config=require(_0x7bd2('0x19'));var licenseUtil=require(_0x7bd2('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0x7bd2('0x1b'));function respondWithStatusCode(_0x2d7877,_0x4a0e19){_0x4a0e19=_0x4a0e19||0xcc;return function(_0x44cee5){if(_0x44cee5){return _0x2d7877[_0x7bd2('0x1c')](_0x4a0e19);}return _0x2d7877[_0x7bd2('0x1d')](_0x4a0e19)[_0x7bd2('0x1e')]();};}function respondWithResult(_0x12f55f,_0x539556){_0x539556=_0x539556||0xc8;return function(_0x19ea04){if(_0x19ea04){return _0x12f55f[_0x7bd2('0x1d')](_0x539556)[_0x7bd2('0x1f')](_0x19ea04);}};}function respondWithFilteredResult(_0x3da50f,_0x134bf0){return function(_0x1c0845){if(_0x1c0845){var _0x4f3ec6=typeof _0x134bf0['offset']==='undefined'&&typeof _0x134bf0[_0x7bd2('0x20')]===_0x7bd2('0x21');var _0x59ca7a=_0x1c0845[_0x7bd2('0x22')];var _0x37f52c=_0x4f3ec6?0x0:_0x134bf0['offset'];var _0x2d830d=_0x4f3ec6?_0x1c0845[_0x7bd2('0x22')]:_0x134bf0[_0x7bd2('0x23')]+_0x134bf0['limit'];var _0x647811;if(_0x2d830d>=_0x59ca7a){_0x2d830d=_0x59ca7a;_0x647811=0xc8;}else{_0x647811=0xce;}_0x3da50f[_0x7bd2('0x1d')](_0x647811);return _0x3da50f[_0x7bd2('0x24')]('Content-Range',_0x37f52c+'-'+_0x2d830d+'/'+_0x59ca7a)[_0x7bd2('0x1f')](_0x1c0845);}return null;};}function patchUpdates(_0xcf197f){return function(_0x1c301e){try{jsonpatch['apply'](_0x1c301e,_0xcf197f,!![]);}catch(_0xe32e24){return BPromise['reject'](_0xe32e24);}return _0x1c301e[_0x7bd2('0x25')]();};}function saveUpdates(_0x4c0782,_0x580e2e){return function(_0x4cd32e){if(_0x4cd32e){return _0x4cd32e[_0x7bd2('0x26')](_0x4c0782)[_0x7bd2('0x27')](function(_0x3d1da4){return _0x3d1da4;});}return null;};}function removeEntity(_0x46d913,_0x13f3ac){return function(_0x3279bd){if(_0x3279bd){return _0x3279bd[_0x7bd2('0x28')]()['then'](function(){_0x46d913[_0x7bd2('0x1d')](0xcc)[_0x7bd2('0x1e')]();});}};}function handleEntityNotFound(_0x488c45,_0x7651e7){return function(_0x3ff311){if(!_0x3ff311){_0x488c45['sendStatus'](0x194);}return _0x3ff311;};}function handleError(_0x4fcda9,_0x4288ec){_0x4288ec=_0x4288ec||0x1f4;return function(_0x5bfb6c){logger['error'](_0x5bfb6c['stack']);if(_0x5bfb6c[_0x7bd2('0x29')]){delete _0x5bfb6c[_0x7bd2('0x29')];}_0x4fcda9[_0x7bd2('0x1d')](_0x4288ec)[_0x7bd2('0x2a')](_0x5bfb6c);};}exports[_0x7bd2('0x2b')]=function(_0x3431b9,_0xe49611){var _0x436072={},_0x3dec17={},_0x5b7fda={'count':0x0,'rows':[]};var _0x5a64f2=_['map'](db[_0x7bd2('0x2c')][_0x7bd2('0x2d')],function(_0x110486){return{'name':_0x110486[_0x7bd2('0x2e')],'type':_0x110486[_0x7bd2('0x2f')][_0x7bd2('0x30')]};});_0x3dec17[_0x7bd2('0x31')]=_['map'](_0x5a64f2,_0x7bd2('0x29'));_0x3dec17['query']=_['keys'](_0x3431b9[_0x7bd2('0x32')]);_0x3dec17[_0x7bd2('0x33')]=_[_0x7bd2('0x34')](_0x3dec17['model'],_0x3dec17[_0x7bd2('0x32')]);_0x436072['attributes']=_[_0x7bd2('0x34')](_0x3dec17[_0x7bd2('0x31')],qs[_0x7bd2('0x35')](_0x3431b9[_0x7bd2('0x32')]['fields']));_0x436072[_0x7bd2('0x36')]=_0x436072['attributes'][_0x7bd2('0x37')]?_0x436072['attributes']:_0x3dec17['model'];if(!_0x3431b9[_0x7bd2('0x32')][_0x7bd2('0x38')]('nolimit')){_0x436072['limit']=qs['limit'](_0x3431b9['query'][_0x7bd2('0x20')]);_0x436072[_0x7bd2('0x23')]=qs[_0x7bd2('0x23')](_0x3431b9[_0x7bd2('0x32')][_0x7bd2('0x23')]);}_0x436072[_0x7bd2('0x39')]=qs[_0x7bd2('0x3a')](_0x3431b9['query'][_0x7bd2('0x3a')]);_0x436072[_0x7bd2('0x3b')]=qs['filters'](_[_0x7bd2('0x3c')](_0x3431b9[_0x7bd2('0x32')],_0x3dec17[_0x7bd2('0x33')]),_0x5a64f2);if(_0x3431b9[_0x7bd2('0x32')][_0x7bd2('0x3d')]){_0x436072['where']=_[_0x7bd2('0x3e')](_0x436072[_0x7bd2('0x3b')],{'$or':_[_0x7bd2('0x3f')](_0x5a64f2,function(_0x4d4461){if(_0x4d4461[_0x7bd2('0x2f')]!==_0x7bd2('0x40')){var _0x444320={};_0x444320[_0x4d4461[_0x7bd2('0x29')]]={'$like':'%'+_0x3431b9[_0x7bd2('0x32')][_0x7bd2('0x3d')]+'%'};return _0x444320;}})});}_0x436072=_[_0x7bd2('0x3e')]({},_0x436072,_0x3431b9['options']);var _0xa5803d={'where':_0x436072[_0x7bd2('0x3b')]};return db[_0x7bd2('0x2c')][_0x7bd2('0x22')](_0xa5803d)['then'](function(_0x263549){_0x5b7fda['count']=_0x263549;if(_0x3431b9[_0x7bd2('0x32')]['includeAll']){_0x436072[_0x7bd2('0x41')]=[{'all':!![]}];}return db['VtigerAccount'][_0x7bd2('0x42')](_0x436072);})[_0x7bd2('0x27')](function(_0x1e7aba){_0x5b7fda[_0x7bd2('0x43')]=_0x1e7aba;return _0x5b7fda;})['then'](respondWithFilteredResult(_0xe49611,_0x436072))[_0x7bd2('0x44')](handleError(_0xe49611,null));};exports[_0x7bd2('0x45')]=function(_0x302f09,_0x40dd8e){var _0x198dce={'raw':![],'where':{'id':_0x302f09[_0x7bd2('0x46')]['id']}},_0x511883={};_0x511883[_0x7bd2('0x31')]=_[_0x7bd2('0x47')](db[_0x7bd2('0x2c')][_0x7bd2('0x2d')]);_0x511883[_0x7bd2('0x32')]=_['keys'](_0x302f09[_0x7bd2('0x32')]);_0x511883[_0x7bd2('0x33')]=_['intersection'](_0x511883[_0x7bd2('0x31')],_0x511883[_0x7bd2('0x32')]);_0x198dce[_0x7bd2('0x36')]=_[_0x7bd2('0x34')](_0x511883[_0x7bd2('0x31')],qs[_0x7bd2('0x35')](_0x302f09[_0x7bd2('0x32')][_0x7bd2('0x35')]));_0x198dce[_0x7bd2('0x36')]=_0x198dce[_0x7bd2('0x36')][_0x7bd2('0x37')]?_0x198dce[_0x7bd2('0x36')]:_0x511883[_0x7bd2('0x31')];if(_0x302f09[_0x7bd2('0x32')]['includeAll']){_0x198dce['include']=[{'all':!![]}];}_0x198dce=_[_0x7bd2('0x3e')]({},_0x198dce,_0x302f09['options']);return db[_0x7bd2('0x2c')][_0x7bd2('0x48')](_0x198dce)[_0x7bd2('0x27')](handleEntityNotFound(_0x40dd8e,null))[_0x7bd2('0x27')](respondWithResult(_0x40dd8e,null))[_0x7bd2('0x44')](handleError(_0x40dd8e,null));};exports[_0x7bd2('0x49')]=function(_0x201032,_0x41012b){return db[_0x7bd2('0x2c')][_0x7bd2('0x49')](_0x201032[_0x7bd2('0x4a')],{})['then'](respondWithResult(_0x41012b,0xc9))[_0x7bd2('0x44')](handleError(_0x41012b,null));};exports[_0x7bd2('0x26')]=function(_0x158bbc,_0x3a6701){if(_0x158bbc[_0x7bd2('0x4a')]['id']){delete _0x158bbc[_0x7bd2('0x4a')]['id'];}return db[_0x7bd2('0x2c')][_0x7bd2('0x48')]({'where':{'id':_0x158bbc[_0x7bd2('0x46')]['id']}})[_0x7bd2('0x27')](handleEntityNotFound(_0x3a6701,null))[_0x7bd2('0x27')](saveUpdates(_0x158bbc['body'],null))['then'](respondWithResult(_0x3a6701,null))[_0x7bd2('0x44')](handleError(_0x3a6701,null));};exports[_0x7bd2('0x28')]=function(_0x3fece8,_0x3f6cfb){return db['VtigerAccount']['find']({'where':{'id':_0x3fece8[_0x7bd2('0x46')]['id']}})[_0x7bd2('0x27')](handleEntityNotFound(_0x3f6cfb,null))['then'](removeEntity(_0x3f6cfb,null))[_0x7bd2('0x44')](handleError(_0x3f6cfb,null));};exports['getConfigurations']=function(_0x5bdb6d,_0x218ef3,_0x2a30de){var _0x4adf68={};var _0x5c78a0={};var _0x23ca28;var _0x2775b3;return db[_0x7bd2('0x2c')][_0x7bd2('0x4b')]({'where':{'id':_0x5bdb6d[_0x7bd2('0x46')]['id']}})[_0x7bd2('0x27')](handleEntityNotFound(_0x218ef3,null))[_0x7bd2('0x27')](function(_0x274c48){if(_0x274c48){_0x23ca28=_0x274c48;_0x5c78a0['model']=_['keys'](db[_0x7bd2('0x4c')][_0x7bd2('0x2d')]);_0x5c78a0[_0x7bd2('0x32')]=_[_0x7bd2('0x47')](_0x5bdb6d[_0x7bd2('0x32')]);_0x5c78a0[_0x7bd2('0x33')]=_[_0x7bd2('0x34')](_0x5c78a0['model'],_0x5c78a0[_0x7bd2('0x32')]);_0x4adf68[_0x7bd2('0x36')]=_[_0x7bd2('0x34')](_0x5c78a0['model'],qs[_0x7bd2('0x35')](_0x5bdb6d['query'][_0x7bd2('0x35')]));_0x4adf68['attributes']=_0x4adf68[_0x7bd2('0x36')][_0x7bd2('0x37')]?_0x4adf68[_0x7bd2('0x36')]:_0x5c78a0[_0x7bd2('0x31')];_0x4adf68[_0x7bd2('0x39')]=qs[_0x7bd2('0x3a')](_0x5bdb6d['query'][_0x7bd2('0x3a')]);_0x4adf68[_0x7bd2('0x3b')]=qs['filters'](_['pick'](_0x5bdb6d['query'],_0x5c78a0[_0x7bd2('0x33')]));if(_0x5bdb6d['query'][_0x7bd2('0x3d')]){_0x4adf68[_0x7bd2('0x3b')]=_[_0x7bd2('0x3e')](_0x4adf68['where'],{'$or':_[_0x7bd2('0x3f')](_0x4adf68['attributes'],function(_0x4bf056){var _0x57cace={};_0x57cace[_0x4bf056]={'$like':'%'+_0x5bdb6d[_0x7bd2('0x32')][_0x7bd2('0x3d')]+'%'};return _0x57cace;})});}_0x4adf68=_['merge']({},_0x4adf68,_0x5bdb6d['options']);return _0x23ca28['getConfigurations'](_0x4adf68);}})['then'](function(_0x5831e7){if(_0x5831e7){_0x2775b3=_0x5831e7['length'];if(!_0x5bdb6d[_0x7bd2('0x32')][_0x7bd2('0x38')](_0x7bd2('0x4d'))){_0x4adf68[_0x7bd2('0x20')]=qs[_0x7bd2('0x20')](_0x5bdb6d['query'][_0x7bd2('0x20')]);_0x4adf68[_0x7bd2('0x23')]=qs[_0x7bd2('0x23')](_0x5bdb6d['query']['offset']);}return _0x23ca28[_0x7bd2('0x4e')](_0x4adf68);}})[_0x7bd2('0x27')](function(_0x18d21e){if(_0x18d21e){return _0x18d21e?{'count':_0x2775b3,'rows':_0x18d21e}:null;}})[_0x7bd2('0x27')](respondWithResult(_0x218ef3,null))[_0x7bd2('0x44')](handleError(_0x218ef3,null));};exports['addConfiguration']=function(_0x51c55c,_0xb9f70f,_0x1feea6){if(_0x51c55c[_0x7bd2('0x4a')]['id']){delete _0x51c55c['body']['id'];}return db[_0x7bd2('0x2c')]['findOne']({'where':{'id':_0x51c55c[_0x7bd2('0x46')]['id']}})['then'](handleEntityNotFound(_0xb9f70f,null))[_0x7bd2('0x27')](function(_0x5be31b){if(_0x5be31b){_0x51c55c['body']['AccountId']=_0x5be31b['id'];_0x51c55c[_0x7bd2('0x4a')]['Subjects']=integrations[_0x7bd2('0x4f')](_0x51c55c['body'][_0x7bd2('0x50')],_0x51c55c[_0x7bd2('0x4a')][_0x7bd2('0x2f')]);_0x51c55c['body'][_0x7bd2('0x51')]=integrations['getDescriptions'](_0x51c55c[_0x7bd2('0x4a')][_0x7bd2('0x50')],_0x51c55c[_0x7bd2('0x4a')]['type']);return db['VtigerConfiguration']['create'](_0x51c55c['body'],{'include':[{'model':db[_0x7bd2('0x52')],'as':_0x7bd2('0x53')},{'model':db['VtigerField'],'as':_0x7bd2('0x51')}]});}return null;})[_0x7bd2('0x27')](respondWithResult(_0xb9f70f,null))[_0x7bd2('0x44')](handleError(_0xb9f70f,null));};var md5=require('md5');exports[_0x7bd2('0x54')]=function(_0x172304,_0x506f9d,_0x440945){var _0x3a8e58=null;var _0x43bbef=null;var _0x3a29a0=null;var _0x34c363=null;var _0x45e71e='';return db['VtigerAccount'][_0x7bd2('0x4b')]({'where':{'id':_0x172304[_0x7bd2('0x46')]['id']},'attributes':['id','name','username',_0x7bd2('0x55'),_0x7bd2('0x56'),_0x7bd2('0x57'),'serverUrl',_0x7bd2('0x58')]})['then'](handleEntityNotFound(_0x506f9d,null))[_0x7bd2('0x27')](function(_0x54f91d){if(_0x54f91d){_0x3a8e58=_0x54f91d[_0x7bd2('0x59')];_0x43bbef=_0x54f91d[_0x7bd2('0x58')];_0x3a29a0=_0x54f91d['moduleName'];_0x45e71e=_0x54f91d[_0x7bd2('0x57')];var _0x1c7766=_0x45e71e[_0x7bd2('0x5a')](-0x1);if(_0x1c7766==='/'){_0x45e71e=_0x45e71e[_0x7bd2('0x5b')](0x0,_0x45e71e['lastIndexOf'](_0x1c7766));}_0x34c363=util[_0x7bd2('0x5c')](_0x7bd2('0x5d'),_0x45e71e);var _0x11458f={'method':'GET','uri':_0x34c363,'qs':{'operation':_0x7bd2('0x5e'),'username':_0x54f91d[_0x7bd2('0x59')]},'json':!![]};return rp(_0x11458f);}})[_0x7bd2('0x27')](function(_0x3af469){if(_0x3af469[_0x7bd2('0x5f')]){var _0x4d3710={'method':_0x7bd2('0x60'),'uri':_0x34c363,'form':{'operation':_0x7bd2('0x61'),'username':_0x3a8e58,'accessKey':md5(_0x3af469[_0x7bd2('0x62')][_0x7bd2('0x63')]+_0x43bbef)},'json':!![]};return rp(_0x4d3710);}})[_0x7bd2('0x27')](function(_0x251913){if(_0x251913['success']){var _0x3f639d={'method':'GET','uri':_0x34c363,'qs':{'operation':_0x7bd2('0x64'),'username':_0x3a8e58,'sessionName':_0x251913['result'][_0x7bd2('0x65')],'elementType':_0x3a29a0},'json':!![]};return rp(_0x3f639d);}})[_0x7bd2('0x27')](function(_0xbce7b9){if(_0xbce7b9[_0x7bd2('0x5f')]){var _0x4ede2e=[_0x7bd2('0x66'),_0x7bd2('0x67'),_0x7bd2('0x68')];_[_0x7bd2('0x69')](_0xbce7b9[_0x7bd2('0x62')]['fields'],function(_0x43099d){return _0x4ede2e[_0x7bd2('0x6a')](_0x43099d['type'][_0x7bd2('0x29')]);});_[_0x7bd2('0x69')](_0xbce7b9[_0x7bd2('0x62')][_0x7bd2('0x35')],function(_0x8785c2){return _0x8785c2[_0x7bd2('0x6b')]==='false';});return{'count':_0xbce7b9[_0x7bd2('0x62')]['fields'][_0x7bd2('0x37')],'rows':_[_0x7bd2('0x3f')](_0xbce7b9['result'][_0x7bd2('0x35')],function(_0x5c3cb1){return{'id':_0x5c3cb1['name'],'name':_0x5c3cb1[_0x7bd2('0x6c')],'custom':_[_0x7bd2('0x6d')](_0x5c3cb1[_0x7bd2('0x29')],'cf_')?!![]:![],'options':_0x5c3cb1[_0x7bd2('0x2f')][_0x7bd2('0x29')]===_0x7bd2('0x6e')&&_0x5c3cb1[_0x7bd2('0x2f')][_0x7bd2('0x6f')][_0x7bd2('0x37')]>0x0?_[_0x7bd2('0x3f')](_0x5c3cb1['type']['picklistValues'],function(_0x454a18){return{'name':_0x454a18['label'],'value':_0x454a18['value']};}):[]};})};}})[_0x7bd2('0x27')](respondWithResult(_0x506f9d,null))['catch'](function(_0x4e6fee){console['log'](_0x7bd2('0x70')+_0x4e6fee);var _0x2ce223=_0x172304[_0x7bd2('0x32')][_0x7bd2('0x71')]?0x1f4:_0x4e6fee['statusCode']||0x1f4;logger[_0x7bd2('0x72')](_0x7bd2('0x73'),_0x7bd2('0x54'),_0x2ce223,JSON['stringify'](_0x4e6fee));delete _0x4e6fee[_0x7bd2('0x29')];if(_0x2ce223===0x191){_0x2ce223=0x190;}_0x506f9d[_0x7bd2('0x1d')](_0x2ce223)[_0x7bd2('0x2a')](_0x172304['query'][_0x7bd2('0x71')]?{'message':_0x7bd2('0x74'),'statusCode':_0x4e6fee[_0x7bd2('0x75')]}:_0x4e6fee);});}; \ No newline at end of file +var _0xf678=['%s/webservice.php','GET','POST','login','result','token','success','describe','sessionName','owner','includes','remove','editable','false','startsWith','cf_','picklist','picklistValues','label','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','path','to-csv','ejs','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../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','apply','save','update','then','destroy','end','error','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','where','filters','filter','merge','VIRTUAL','options','include','rows','show','params','find','create','body','catch','findOne','VtigerConfiguration','sort','pick','getConfigurations','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','VtigerField','Subjects','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring'];(function(_0x38b685,_0x304c25){var _0x572ac8=function(_0x2718f7){while(--_0x2718f7){_0x38b685['push'](_0x38b685['shift']());}};_0x572ac8(++_0x304c25);}(_0xf678,0x8f));var _0x8f67=function(_0x19b258,_0x43832e){_0x19b258=_0x19b258-0x0;var _0x2d6519=_0xf678[_0x19b258];return _0x2d6519;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8f67('0x0'));var zipdir=require(_0x8f67('0x1'));var jsonpatch=require(_0x8f67('0x2'));var rp=require(_0x8f67('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x8f67('0x4'));var sox=require('sox');var csv=require(_0x8f67('0x5'));var ejs=require(_0x8f67('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8f67('0x7'));var toCsv=require(_0x8f67('0x5'));var querystring=require(_0x8f67('0x8'));var Papa=require(_0x8f67('0x9'));var Redis=require(_0x8f67('0xa'));var authService=require(_0x8f67('0xb'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8f67('0xc'));var logger=require(_0x8f67('0xd'))(_0x8f67('0xe'));var utils=require(_0x8f67('0xf'));var config=require(_0x8f67('0x10'));var licenseUtil=require(_0x8f67('0x11'));var db=require(_0x8f67('0x12'))['db'];var integrations=require(_0x8f67('0x13'));function respondWithStatusCode(_0x4eabc1,_0x3acc98){_0x3acc98=_0x3acc98||0xcc;return function(_0xcf475b){if(_0xcf475b){return _0x4eabc1[_0x8f67('0x14')](_0x3acc98);}return _0x4eabc1[_0x8f67('0x15')](_0x3acc98)['end']();};}function respondWithResult(_0x47903f,_0x268d32){_0x268d32=_0x268d32||0xc8;return function(_0x41f9f3){if(_0x41f9f3){return _0x47903f[_0x8f67('0x15')](_0x268d32)[_0x8f67('0x16')](_0x41f9f3);}};}function respondWithFilteredResult(_0x3a2ac7,_0x1c4289){return function(_0x44fdb4){if(_0x44fdb4){var _0x198765=typeof _0x1c4289[_0x8f67('0x17')]===_0x8f67('0x18')&&typeof _0x1c4289['limit']==='undefined';var _0x413a73=_0x44fdb4[_0x8f67('0x19')];var _0x28e009=_0x198765?0x0:_0x1c4289[_0x8f67('0x17')];var _0x1c1435=_0x198765?_0x44fdb4['count']:_0x1c4289[_0x8f67('0x17')]+_0x1c4289[_0x8f67('0x1a')];var _0x822796;if(_0x1c1435>=_0x413a73){_0x1c1435=_0x413a73;_0x822796=0xc8;}else{_0x822796=0xce;}_0x3a2ac7[_0x8f67('0x15')](_0x822796);return _0x3a2ac7[_0x8f67('0x1b')]('Content-Range',_0x28e009+'-'+_0x1c1435+'/'+_0x413a73)[_0x8f67('0x16')](_0x44fdb4);}return null;};}function patchUpdates(_0x15d3af){return function(_0x40d102){try{jsonpatch[_0x8f67('0x1c')](_0x40d102,_0x15d3af,!![]);}catch(_0x4d6a6d){return BPromise['reject'](_0x4d6a6d);}return _0x40d102[_0x8f67('0x1d')]();};}function saveUpdates(_0x473b54,_0x27a81e){return function(_0x41c735){if(_0x41c735){return _0x41c735[_0x8f67('0x1e')](_0x473b54)[_0x8f67('0x1f')](function(_0x9cecfa){return _0x9cecfa;});}return null;};}function removeEntity(_0x4669e3,_0x1aa4ab){return function(_0x21262b){if(_0x21262b){return _0x21262b[_0x8f67('0x20')]()[_0x8f67('0x1f')](function(){_0x4669e3[_0x8f67('0x15')](0xcc)[_0x8f67('0x21')]();});}};}function handleEntityNotFound(_0x2bb975,_0x21cb6b){return function(_0x161422){if(!_0x161422){_0x2bb975[_0x8f67('0x14')](0x194);}return _0x161422;};}function handleError(_0x2d56b3,_0x51d008){_0x51d008=_0x51d008||0x1f4;return function(_0xd96064){logger[_0x8f67('0x22')](_0xd96064[_0x8f67('0x23')]);if(_0xd96064['name']){delete _0xd96064[_0x8f67('0x24')];}_0x2d56b3[_0x8f67('0x15')](_0x51d008)[_0x8f67('0x25')](_0xd96064);};}exports[_0x8f67('0x26')]=function(_0x2004aa,_0x5d0423){var _0x337283={},_0x143ead={},_0x3514ce={'count':0x0,'rows':[]};var _0x2740f4=_[_0x8f67('0x27')](db[_0x8f67('0x28')][_0x8f67('0x29')],function(_0x1b7682){return{'name':_0x1b7682[_0x8f67('0x2a')],'type':_0x1b7682[_0x8f67('0x2b')][_0x8f67('0x2c')]};});_0x143ead[_0x8f67('0x2d')]=_[_0x8f67('0x27')](_0x2740f4,_0x8f67('0x24'));_0x143ead[_0x8f67('0x2e')]=_[_0x8f67('0x2f')](_0x2004aa[_0x8f67('0x2e')]);_0x143ead['filters']=_[_0x8f67('0x30')](_0x143ead['model'],_0x143ead[_0x8f67('0x2e')]);_0x337283[_0x8f67('0x31')]=_['intersection'](_0x143ead[_0x8f67('0x2d')],qs[_0x8f67('0x32')](_0x2004aa[_0x8f67('0x2e')][_0x8f67('0x32')]));_0x337283[_0x8f67('0x31')]=_0x337283['attributes'][_0x8f67('0x33')]?_0x337283[_0x8f67('0x31')]:_0x143ead[_0x8f67('0x2d')];if(!_0x2004aa['query']['hasOwnProperty'](_0x8f67('0x34'))){_0x337283[_0x8f67('0x1a')]=qs['limit'](_0x2004aa[_0x8f67('0x2e')]['limit']);_0x337283[_0x8f67('0x17')]=qs[_0x8f67('0x17')](_0x2004aa[_0x8f67('0x2e')][_0x8f67('0x17')]);}_0x337283[_0x8f67('0x35')]=qs['sort'](_0x2004aa[_0x8f67('0x2e')]['sort']);_0x337283[_0x8f67('0x36')]=qs[_0x8f67('0x37')](_['pick'](_0x2004aa[_0x8f67('0x2e')],_0x143ead[_0x8f67('0x37')]),_0x2740f4);if(_0x2004aa[_0x8f67('0x2e')][_0x8f67('0x38')]){_0x337283[_0x8f67('0x36')]=_[_0x8f67('0x39')](_0x337283['where'],{'$or':_['map'](_0x2740f4,function(_0x1e1240){if(_0x1e1240['type']!==_0x8f67('0x3a')){var _0x50ed4a={};_0x50ed4a[_0x1e1240['name']]={'$like':'%'+_0x2004aa['query'][_0x8f67('0x38')]+'%'};return _0x50ed4a;}})});}_0x337283=_[_0x8f67('0x39')]({},_0x337283,_0x2004aa[_0x8f67('0x3b')]);var _0x593075={'where':_0x337283['where']};return db[_0x8f67('0x28')]['count'](_0x593075)[_0x8f67('0x1f')](function(_0x22a984){_0x3514ce[_0x8f67('0x19')]=_0x22a984;if(_0x2004aa[_0x8f67('0x2e')]['includeAll']){_0x337283[_0x8f67('0x3c')]=[{'all':!![]}];}return db['VtigerAccount']['findAll'](_0x337283);})['then'](function(_0x58e100){_0x3514ce[_0x8f67('0x3d')]=_0x58e100;return _0x3514ce;})['then'](respondWithFilteredResult(_0x5d0423,_0x337283))['catch'](handleError(_0x5d0423,null));};exports[_0x8f67('0x3e')]=function(_0x221c99,_0xceeddd){var _0x54aab4={'raw':![],'where':{'id':_0x221c99[_0x8f67('0x3f')]['id']}},_0x1d21b5={};_0x1d21b5[_0x8f67('0x2d')]=_[_0x8f67('0x2f')](db[_0x8f67('0x28')]['rawAttributes']);_0x1d21b5[_0x8f67('0x2e')]=_[_0x8f67('0x2f')](_0x221c99[_0x8f67('0x2e')]);_0x1d21b5['filters']=_[_0x8f67('0x30')](_0x1d21b5[_0x8f67('0x2d')],_0x1d21b5['query']);_0x54aab4[_0x8f67('0x31')]=_[_0x8f67('0x30')](_0x1d21b5['model'],qs[_0x8f67('0x32')](_0x221c99['query'][_0x8f67('0x32')]));_0x54aab4[_0x8f67('0x31')]=_0x54aab4['attributes'][_0x8f67('0x33')]?_0x54aab4[_0x8f67('0x31')]:_0x1d21b5[_0x8f67('0x2d')];if(_0x221c99[_0x8f67('0x2e')]['includeAll']){_0x54aab4[_0x8f67('0x3c')]=[{'all':!![]}];}_0x54aab4=_[_0x8f67('0x39')]({},_0x54aab4,_0x221c99[_0x8f67('0x3b')]);return db[_0x8f67('0x28')][_0x8f67('0x40')](_0x54aab4)[_0x8f67('0x1f')](handleEntityNotFound(_0xceeddd,null))['then'](respondWithResult(_0xceeddd,null))['catch'](handleError(_0xceeddd,null));};exports[_0x8f67('0x41')]=function(_0x48e975,_0x5345eb){return db[_0x8f67('0x28')][_0x8f67('0x41')](_0x48e975[_0x8f67('0x42')],{})[_0x8f67('0x1f')](respondWithResult(_0x5345eb,0xc9))[_0x8f67('0x43')](handleError(_0x5345eb,null));};exports[_0x8f67('0x1e')]=function(_0xd0892a,_0xa27efe){if(_0xd0892a['body']['id']){delete _0xd0892a[_0x8f67('0x42')]['id'];}return db[_0x8f67('0x28')][_0x8f67('0x40')]({'where':{'id':_0xd0892a['params']['id']}})['then'](handleEntityNotFound(_0xa27efe,null))[_0x8f67('0x1f')](saveUpdates(_0xd0892a['body'],null))[_0x8f67('0x1f')](respondWithResult(_0xa27efe,null))['catch'](handleError(_0xa27efe,null));};exports[_0x8f67('0x20')]=function(_0x377570,_0x554a8d){return db[_0x8f67('0x28')][_0x8f67('0x40')]({'where':{'id':_0x377570[_0x8f67('0x3f')]['id']}})[_0x8f67('0x1f')](handleEntityNotFound(_0x554a8d,null))[_0x8f67('0x1f')](removeEntity(_0x554a8d,null))[_0x8f67('0x43')](handleError(_0x554a8d,null));};exports['getConfigurations']=function(_0x3de429,_0x76ab8,_0x52c0ef){var _0x36b242={};var _0x5476b6={};var _0x34ed1f;var _0x267f81;return db[_0x8f67('0x28')][_0x8f67('0x44')]({'where':{'id':_0x3de429['params']['id']}})[_0x8f67('0x1f')](handleEntityNotFound(_0x76ab8,null))['then'](function(_0x4298a9){if(_0x4298a9){_0x34ed1f=_0x4298a9;_0x5476b6[_0x8f67('0x2d')]=_[_0x8f67('0x2f')](db[_0x8f67('0x45')][_0x8f67('0x29')]);_0x5476b6['query']=_['keys'](_0x3de429[_0x8f67('0x2e')]);_0x5476b6[_0x8f67('0x37')]=_[_0x8f67('0x30')](_0x5476b6[_0x8f67('0x2d')],_0x5476b6[_0x8f67('0x2e')]);_0x36b242[_0x8f67('0x31')]=_['intersection'](_0x5476b6[_0x8f67('0x2d')],qs[_0x8f67('0x32')](_0x3de429[_0x8f67('0x2e')][_0x8f67('0x32')]));_0x36b242['attributes']=_0x36b242[_0x8f67('0x31')][_0x8f67('0x33')]?_0x36b242['attributes']:_0x5476b6['model'];_0x36b242[_0x8f67('0x35')]=qs[_0x8f67('0x46')](_0x3de429[_0x8f67('0x2e')][_0x8f67('0x46')]);_0x36b242['where']=qs[_0x8f67('0x37')](_[_0x8f67('0x47')](_0x3de429['query'],_0x5476b6['filters']));if(_0x3de429[_0x8f67('0x2e')][_0x8f67('0x38')]){_0x36b242[_0x8f67('0x36')]=_[_0x8f67('0x39')](_0x36b242[_0x8f67('0x36')],{'$or':_[_0x8f67('0x27')](_0x36b242[_0x8f67('0x31')],function(_0x28fd12){var _0xed1e9f={};_0xed1e9f[_0x28fd12]={'$like':'%'+_0x3de429['query'][_0x8f67('0x38')]+'%'};return _0xed1e9f;})});}_0x36b242=_['merge']({},_0x36b242,_0x3de429['options']);return _0x34ed1f[_0x8f67('0x48')](_0x36b242);}})[_0x8f67('0x1f')](function(_0x5977b3){if(_0x5977b3){_0x267f81=_0x5977b3[_0x8f67('0x33')];if(!_0x3de429[_0x8f67('0x2e')][_0x8f67('0x49')](_0x8f67('0x34'))){_0x36b242['limit']=qs['limit'](_0x3de429[_0x8f67('0x2e')][_0x8f67('0x1a')]);_0x36b242['offset']=qs[_0x8f67('0x17')](_0x3de429[_0x8f67('0x2e')][_0x8f67('0x17')]);}return _0x34ed1f[_0x8f67('0x48')](_0x36b242);}})[_0x8f67('0x1f')](function(_0x4e9528){if(_0x4e9528){return _0x4e9528?{'count':_0x267f81,'rows':_0x4e9528}:null;}})[_0x8f67('0x1f')](respondWithResult(_0x76ab8,null))[_0x8f67('0x43')](handleError(_0x76ab8,null));};exports[_0x8f67('0x4a')]=function(_0x4531a8,_0x21bcfd,_0x29d178){if(_0x4531a8[_0x8f67('0x42')]['id']){delete _0x4531a8['body']['id'];}return db[_0x8f67('0x28')]['findOne']({'where':{'id':_0x4531a8[_0x8f67('0x3f')]['id']}})[_0x8f67('0x1f')](handleEntityNotFound(_0x21bcfd,null))['then'](function(_0x38a377){if(_0x38a377){_0x4531a8['body'][_0x8f67('0x4b')]=_0x38a377['id'];_0x4531a8[_0x8f67('0x42')]['Subjects']=integrations[_0x8f67('0x4c')](_0x4531a8[_0x8f67('0x42')][_0x8f67('0x4d')],_0x4531a8[_0x8f67('0x42')][_0x8f67('0x2b')]);_0x4531a8[_0x8f67('0x42')][_0x8f67('0x4e')]=integrations[_0x8f67('0x4f')](_0x4531a8[_0x8f67('0x42')]['channel'],_0x4531a8[_0x8f67('0x42')]['type']);return db[_0x8f67('0x45')][_0x8f67('0x41')](_0x4531a8[_0x8f67('0x42')],{'include':[{'model':db[_0x8f67('0x50')],'as':_0x8f67('0x51')},{'model':db[_0x8f67('0x50')],'as':_0x8f67('0x4e')}]});}return null;})[_0x8f67('0x1f')](respondWithResult(_0x21bcfd,null))[_0x8f67('0x43')](handleError(_0x21bcfd,null));};var md5=require('md5');exports[_0x8f67('0x52')]=function(_0x17f82c,_0x5147a3,_0x19e9d6){var _0x54c77a=null;var _0x5ab991=null;var _0x351db4=null;var _0x308162=null;var _0xe9d574='';return db[_0x8f67('0x28')][_0x8f67('0x44')]({'where':{'id':_0x17f82c[_0x8f67('0x3f')]['id']},'attributes':['id',_0x8f67('0x24'),_0x8f67('0x53'),_0x8f67('0x54'),_0x8f67('0x55'),_0x8f67('0x56'),_0x8f67('0x57'),'accessKey']})[_0x8f67('0x1f')](handleEntityNotFound(_0x5147a3,null))[_0x8f67('0x1f')](function(_0x290a1d){if(_0x290a1d){_0x54c77a=_0x290a1d[_0x8f67('0x53')];_0x5ab991=_0x290a1d[_0x8f67('0x58')];_0x351db4=_0x290a1d[_0x8f67('0x55')];_0xe9d574=_0x290a1d[_0x8f67('0x56')];var _0x866ab7=_0xe9d574[_0x8f67('0x59')](-0x1);if(_0x866ab7==='/'){_0xe9d574=_0xe9d574[_0x8f67('0x5a')](0x0,_0xe9d574['lastIndexOf'](_0x866ab7));}_0x308162=util['format'](_0x8f67('0x5b'),_0xe9d574);var _0x27adfb={'method':_0x8f67('0x5c'),'uri':_0x308162,'qs':{'operation':'getchallenge','username':_0x290a1d['username']},'json':!![]};return rp(_0x27adfb);}})[_0x8f67('0x1f')](function(_0x49fd9a){if(_0x49fd9a['success']){var _0x429f93={'method':_0x8f67('0x5d'),'uri':_0x308162,'form':{'operation':_0x8f67('0x5e'),'username':_0x54c77a,'accessKey':md5(_0x49fd9a[_0x8f67('0x5f')][_0x8f67('0x60')]+_0x5ab991)},'json':!![]};return rp(_0x429f93);}})[_0x8f67('0x1f')](function(_0x3ed974){if(_0x3ed974[_0x8f67('0x61')]){var _0x1f2fab={'method':_0x8f67('0x5c'),'uri':_0x308162,'qs':{'operation':_0x8f67('0x62'),'username':_0x54c77a,'sessionName':_0x3ed974[_0x8f67('0x5f')][_0x8f67('0x63')],'elementType':_0x351db4},'json':!![]};return rp(_0x1f2fab);}})[_0x8f67('0x1f')](function(_0x21dcdb){if(_0x21dcdb[_0x8f67('0x61')]){var _0x3475cd=['autogenerated','reference',_0x8f67('0x64')];_['remove'](_0x21dcdb[_0x8f67('0x5f')]['fields'],function(_0x181e27){return _0x3475cd[_0x8f67('0x65')](_0x181e27['type'][_0x8f67('0x24')]);});_[_0x8f67('0x66')](_0x21dcdb[_0x8f67('0x5f')][_0x8f67('0x32')],function(_0x1aa2c9){return _0x1aa2c9[_0x8f67('0x67')]===_0x8f67('0x68');});return{'count':_0x21dcdb[_0x8f67('0x5f')][_0x8f67('0x32')][_0x8f67('0x33')],'rows':_[_0x8f67('0x27')](_0x21dcdb[_0x8f67('0x5f')][_0x8f67('0x32')],function(_0x16c424){return{'id':_0x16c424[_0x8f67('0x24')],'name':_0x16c424['label'],'custom':_[_0x8f67('0x69')](_0x16c424[_0x8f67('0x24')],_0x8f67('0x6a'))?!![]:![],'options':_0x16c424[_0x8f67('0x2b')][_0x8f67('0x24')]===_0x8f67('0x6b')&&_0x16c424[_0x8f67('0x2b')][_0x8f67('0x6c')][_0x8f67('0x33')]>0x0?_[_0x8f67('0x27')](_0x16c424[_0x8f67('0x2b')]['picklistValues'],function(_0x2eff2c){return{'name':_0x2eff2c[_0x8f67('0x6d')],'value':_0x2eff2c['value']};}):[]};})};}})[_0x8f67('0x1f')](respondWithResult(_0x5147a3,null))[_0x8f67('0x43')](function(_0x3b253a){console[_0x8f67('0x6e')](_0x8f67('0x6f')+_0x3b253a);var _0x5c4537=_0x17f82c[_0x8f67('0x2e')][_0x8f67('0x70')]?0x1f4:_0x3b253a[_0x8f67('0x71')]||0x1f4;logger[_0x8f67('0x22')](_0x8f67('0x72'),_0x8f67('0x52'),_0x5c4537,JSON[_0x8f67('0x73')](_0x3b253a));delete _0x3b253a[_0x8f67('0x24')];if(_0x5c4537===0x191){_0x5c4537=0x190;}_0x5147a3[_0x8f67('0x15')](_0x5c4537)[_0x8f67('0x25')](_0x17f82c[_0x8f67('0x2e')][_0x8f67('0x70')]?{'message':_0x8f67('0x74'),'statusCode':_0x3b253a['statusCode']}:_0x3b253a);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 9d8c3f2..321bc2c 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 _0x4a4d=['path','rimraf','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','bluebird'];(function(_0x17751e,_0xd45b33){var _0x5f0c3e=function(_0x310a27){while(--_0x310a27){_0x17751e['push'](_0x17751e['shift']());}};_0x5f0c3e(++_0xd45b33);}(_0x4a4d,0x1cf));var _0xd4a4=function(_0x119a2a,_0x52a94f){_0x119a2a=_0x119a2a-0x0;var _0x22d268=_0x4a4d[_0x119a2a];return _0x22d268;};'use strict';var _=require(_0xd4a4('0x0'));var util=require(_0xd4a4('0x1'));var logger=require(_0xd4a4('0x2'))(_0xd4a4('0x3'));var moment=require('moment');var BPromise=require(_0xd4a4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd4a4('0x5'));var rimraf=require(_0xd4a4('0x6'));var config=require('../../config/environment');var attributes=require(_0xd4a4('0x7'));var integrations=require(_0xd4a4('0x8'));module[_0xd4a4('0x9')]=function(_0x458c4a,_0xb0b1c8){return _0x458c4a[_0xd4a4('0xa')](_0xd4a4('0xb'),attributes,{'tableName':_0xd4a4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf122=['bluebird','request-promise','path','rimraf','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','lodash','util','../../config/logger','moment'];(function(_0x4a4563,_0x2771c3){var _0x201be1=function(_0x32505c){while(--_0x32505c){_0x4a4563['push'](_0x4a4563['shift']());}};_0x201be1(++_0x2771c3);}(_0xf122,0x1b6));var _0x2f12=function(_0x45e3af,_0x2a6ed2){_0x45e3af=_0x45e3af-0x0;var _0x1497fd=_0xf122[_0x45e3af];return _0x1497fd;};'use strict';var _=require(_0x2f12('0x0'));var util=require(_0x2f12('0x1'));var logger=require(_0x2f12('0x2'))('api');var moment=require(_0x2f12('0x3'));var BPromise=require(_0x2f12('0x4'));var rp=require(_0x2f12('0x5'));var fs=require('fs');var path=require(_0x2f12('0x6'));var rimraf=require(_0x2f12('0x7'));var config=require('../../config/environment');var attributes=require(_0x2f12('0x8'));var integrations=require(_0x2f12('0x9'));module[_0x2f12('0xa')]=function(_0x2319f5,_0x379c29){return _0x2319f5[_0x2f12('0xb')](_0x2f12('0xc'),attributes,{'tableName':'int_vtiger_accounts','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 21a3a73..45f5e6f 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 _0x593e=['findAll','options','raw','where','attributes','limit','include','model','map','stringify','ShowVtigerAccount','VtigerAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VtigerAccount,\x20%s,\x20%s','message','result','catch','GetVtigerAccount'];(function(_0x3c5ca4,_0x1f6dd4){var _0x151a6b=function(_0x2664b7){while(--_0x2664b7){_0x3c5ca4['push'](_0x3c5ca4['shift']());}};_0x151a6b(++_0x1f6dd4);}(_0x593e,0xcb));var _0xe593=function(_0x40ce1d,_0x12b040){_0x40ce1d=_0x40ce1d-0x0;var _0x51b757=_0x593e[_0x40ce1d];return _0x51b757;};'use strict';var _=require(_0xe593('0x0'));var util=require(_0xe593('0x1'));var moment=require(_0xe593('0x2'));var BPromise=require(_0xe593('0x3'));var rs=require(_0xe593('0x4'));var fs=require('fs');var Redis=require(_0xe593('0x5'));var db=require(_0xe593('0x6'))['db'];var utils=require(_0xe593('0x7'));var logger=require('../../config/logger')(_0xe593('0x8'));var config=require(_0xe593('0x9'));var jayson=require(_0xe593('0xa'));var client=jayson[_0xe593('0xb')][_0xe593('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x14cff3,_0x1cda29,_0x307dad){return new BPromise(function(_0x169c08,_0x265099){return client['request'](_0x14cff3,_0x307dad)[_0xe593('0xd')](function(_0x4091db){logger[_0xe593('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x1cda29,'request\x20sent');logger[_0xe593('0xf')](_0xe593('0x10'),_0x1cda29,_0xe593('0x11'),JSON['stringify'](_0x4091db));if(_0x4091db[_0xe593('0x12')]){if(_0x4091db[_0xe593('0x12')][_0xe593('0x13')]===0x1f4){logger[_0xe593('0x12')](_0xe593('0x14'),_0x1cda29,_0x4091db[_0xe593('0x12')][_0xe593('0x15')]);return _0x265099(_0x4091db[_0xe593('0x12')][_0xe593('0x15')]);}logger[_0xe593('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x1cda29,_0x4091db[_0xe593('0x12')][_0xe593('0x15')]);return _0x169c08(_0x4091db['error'][_0xe593('0x15')]);}else{logger[_0xe593('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x1cda29,_0xe593('0x11'));_0x169c08(_0x4091db[_0xe593('0x16')][_0xe593('0x15')]);}})[_0xe593('0x17')](function(_0x3408ec){logger[_0xe593('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x1cda29,_0x3408ec);_0x265099(_0x3408ec);});});}exports[_0xe593('0x18')]=function(_0x470d07){var _0x5f57ce=this;return new Promise(function(_0xd1020e,_0x28b5ed){return db['VtigerAccount'][_0xe593('0x19')]({'raw':_0x470d07[_0xe593('0x1a')]?_0x470d07[_0xe593('0x1a')][_0xe593('0x1b')]===undefined?!![]:![]:!![],'where':_0x470d07[_0xe593('0x1a')]?_0x470d07[_0xe593('0x1a')][_0xe593('0x1c')]||null:null,'attributes':_0x470d07['options']?_0x470d07['options'][_0xe593('0x1d')]||null:null,'limit':_0x470d07['options']?_0x470d07['options'][_0xe593('0x1e')]||null:null,'include':_0x470d07[_0xe593('0x1a')]?_0x470d07['options'][_0xe593('0x1f')]?_['map'](_0x470d07[_0xe593('0x1a')][_0xe593('0x1f')],function(_0x185cea){return{'model':db[_0x185cea[_0xe593('0x20')]],'as':_0x185cea['as'],'attributes':_0x185cea[_0xe593('0x1d')],'include':_0x185cea[_0xe593('0x1f')]?_[_0xe593('0x21')](_0x185cea[_0xe593('0x1f')],function(_0x4fc483){return{'model':db[_0x4fc483[_0xe593('0x20')]],'as':_0x4fc483['as'],'attributes':_0x4fc483[_0xe593('0x1d')],'include':_0x4fc483['include']?_['map'](_0x4fc483[_0xe593('0x1f')],function(_0x25238f){return{'model':db[_0x25238f[_0xe593('0x20')]],'as':_0x25238f['as'],'attributes':_0x25238f[_0xe593('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe593('0xd')](function(_0x27a3d2){logger['info'](_0xe593('0x18'),_0x470d07);logger['debug'](_0xe593('0x18'),_0x470d07,JSON[_0xe593('0x22')](_0x27a3d2));_0xd1020e(_0x27a3d2);})['catch'](function(_0x337ee0){logger['error'](_0xe593('0x18'),_0x337ee0[_0xe593('0x15')],_0x470d07);_0x28b5ed(_0x5f57ce[_0xe593('0x12')](0x1f4,_0x337ee0['message']));});});};exports[_0xe593('0x23')]=function(_0x13f44){var _0x3066ed=this;return new Promise(function(_0x338222,_0x2588be){return db[_0xe593('0x24')][_0xe593('0x25')]({'raw':_0x13f44['options']?_0x13f44[_0xe593('0x1a')][_0xe593('0x1b')]===undefined?!![]:![]:!![],'where':_0x13f44['options']?_0x13f44[_0xe593('0x1a')]['where']||null:null,'attributes':_0x13f44[_0xe593('0x1a')]?_0x13f44[_0xe593('0x1a')][_0xe593('0x1d')]||null:null,'include':_0x13f44[_0xe593('0x1a')]?_0x13f44[_0xe593('0x1a')][_0xe593('0x1f')]?_[_0xe593('0x21')](_0x13f44[_0xe593('0x1a')][_0xe593('0x1f')],function(_0x4305de){return{'model':db[_0x4305de['model']],'as':_0x4305de['as'],'attributes':_0x4305de[_0xe593('0x1d')],'include':_0x4305de[_0xe593('0x1f')]?_[_0xe593('0x21')](_0x4305de['include'],function(_0x4fefb3){return{'model':db[_0x4fefb3[_0xe593('0x20')]],'as':_0x4fefb3['as'],'attributes':_0x4fefb3['attributes'],'include':_0x4fefb3[_0xe593('0x1f')]?_[_0xe593('0x21')](_0x4fefb3[_0xe593('0x1f')],function(_0x30511c){return{'model':db[_0x30511c[_0xe593('0x20')]],'as':_0x30511c['as'],'attributes':_0x30511c[_0xe593('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe593('0xd')](function(_0x4889cc){logger['info'](_0xe593('0x23'),_0x13f44);logger['debug'](_0xe593('0x23'),_0x13f44,JSON['stringify'](_0x4889cc));_0x338222(_0x4889cc);})[_0xe593('0x17')](function(_0x5b9589){logger['error'](_0xe593('0x23'),_0x5b9589[_0xe593('0x15')],_0x13f44);_0x2588be(_0x3066ed[_0xe593('0x12')](0x1f4,_0x5b9589['message']));});});}; \ No newline at end of file +var _0x2547=['../../config/logger','../../config/environment','jayson/promise','client','http','request','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowVtigerAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x16f123,_0x1b8631){var _0x4540bf=function(_0x923961){while(--_0x923961){_0x16f123['push'](_0x16f123['shift']());}};_0x4540bf(++_0x1b8631);}(_0x2547,0x1cd));var _0x7254=function(_0x26514f,_0x5af1c1){_0x26514f=_0x26514f-0x0;var _0x793ddc=_0x2547[_0x26514f];return _0x793ddc;};'use strict';var _=require('lodash');var util=require(_0x7254('0x0'));var moment=require(_0x7254('0x1'));var BPromise=require(_0x7254('0x2'));var rs=require(_0x7254('0x3'));var fs=require('fs');var Redis=require(_0x7254('0x4'));var db=require(_0x7254('0x5'))['db'];var utils=require(_0x7254('0x6'));var logger=require(_0x7254('0x7'))('rpc');var config=require(_0x7254('0x8'));var jayson=require(_0x7254('0x9'));var client=jayson[_0x7254('0xa')][_0x7254('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b845f,_0x253b1e,_0x6e3d84){return new BPromise(function(_0x395913,_0x5da1ec){return client[_0x7254('0xc')](_0x4b845f,_0x6e3d84)['then'](function(_0x50925f){logger['info'](_0x7254('0xd'),_0x253b1e,_0x7254('0xe'));logger[_0x7254('0xf')](_0x7254('0x10'),_0x253b1e,_0x7254('0xe'),JSON[_0x7254('0x11')](_0x50925f));if(_0x50925f['error']){if(_0x50925f[_0x7254('0x12')]['code']===0x1f4){logger[_0x7254('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x253b1e,_0x50925f[_0x7254('0x12')][_0x7254('0x13')]);return _0x5da1ec(_0x50925f[_0x7254('0x12')][_0x7254('0x13')]);}logger[_0x7254('0x12')](_0x7254('0xd'),_0x253b1e,_0x50925f[_0x7254('0x12')][_0x7254('0x13')]);return _0x395913(_0x50925f[_0x7254('0x12')][_0x7254('0x13')]);}else{logger[_0x7254('0x14')](_0x7254('0xd'),_0x253b1e,_0x7254('0xe'));_0x395913(_0x50925f['result'][_0x7254('0x13')]);}})[_0x7254('0x15')](function(_0xf47255){logger[_0x7254('0x12')](_0x7254('0xd'),_0x253b1e,_0xf47255);_0x5da1ec(_0xf47255);});});}exports[_0x7254('0x16')]=function(_0x2737e0){var _0x5dd23b=this;return new Promise(function(_0x1f48f6,_0x2283b7){return db[_0x7254('0x17')][_0x7254('0x18')]({'raw':_0x2737e0[_0x7254('0x19')]?_0x2737e0[_0x7254('0x19')][_0x7254('0x1a')]===undefined?!![]:![]:!![],'where':_0x2737e0[_0x7254('0x19')]?_0x2737e0[_0x7254('0x19')][_0x7254('0x1b')]||null:null,'attributes':_0x2737e0[_0x7254('0x19')]?_0x2737e0[_0x7254('0x19')][_0x7254('0x1c')]||null:null,'limit':_0x2737e0[_0x7254('0x19')]?_0x2737e0[_0x7254('0x19')][_0x7254('0x1d')]||null:null,'include':_0x2737e0[_0x7254('0x19')]?_0x2737e0[_0x7254('0x19')][_0x7254('0x1e')]?_[_0x7254('0x1f')](_0x2737e0[_0x7254('0x19')]['include'],function(_0x493bfd){return{'model':db[_0x493bfd[_0x7254('0x20')]],'as':_0x493bfd['as'],'attributes':_0x493bfd[_0x7254('0x1c')],'include':_0x493bfd[_0x7254('0x1e')]?_[_0x7254('0x1f')](_0x493bfd[_0x7254('0x1e')],function(_0x36b5d5){return{'model':db[_0x36b5d5[_0x7254('0x20')]],'as':_0x36b5d5['as'],'attributes':_0x36b5d5['attributes'],'include':_0x36b5d5[_0x7254('0x1e')]?_[_0x7254('0x1f')](_0x36b5d5[_0x7254('0x1e')],function(_0x494cdb){return{'model':db[_0x494cdb[_0x7254('0x20')]],'as':_0x494cdb['as'],'attributes':_0x494cdb['attributes']};}):[]};}):[]};}):[]:[]})[_0x7254('0x21')](function(_0x134a9e){logger['info'](_0x7254('0x16'),_0x2737e0);logger[_0x7254('0xf')]('GetVtigerAccount',_0x2737e0,JSON[_0x7254('0x11')](_0x134a9e));_0x1f48f6(_0x134a9e);})[_0x7254('0x15')](function(_0x37cb5c){logger[_0x7254('0x12')](_0x7254('0x16'),_0x37cb5c[_0x7254('0x13')],_0x2737e0);_0x2283b7(_0x5dd23b['error'](0x1f4,_0x37cb5c[_0x7254('0x13')]));});});};exports[_0x7254('0x22')]=function(_0x5569be){var _0x2f75ea=this;return new Promise(function(_0x1279cd,_0x2be5fc){return db['VtigerAccount'][_0x7254('0x23')]({'raw':_0x5569be[_0x7254('0x19')]?_0x5569be[_0x7254('0x19')][_0x7254('0x1a')]===undefined?!![]:![]:!![],'where':_0x5569be[_0x7254('0x19')]?_0x5569be[_0x7254('0x19')][_0x7254('0x1b')]||null:null,'attributes':_0x5569be['options']?_0x5569be[_0x7254('0x19')]['attributes']||null:null,'include':_0x5569be['options']?_0x5569be[_0x7254('0x19')][_0x7254('0x1e')]?_[_0x7254('0x1f')](_0x5569be[_0x7254('0x19')][_0x7254('0x1e')],function(_0x430420){return{'model':db[_0x430420[_0x7254('0x20')]],'as':_0x430420['as'],'attributes':_0x430420[_0x7254('0x1c')],'include':_0x430420[_0x7254('0x1e')]?_[_0x7254('0x1f')](_0x430420[_0x7254('0x1e')],function(_0x3b0abd){return{'model':db[_0x3b0abd[_0x7254('0x20')]],'as':_0x3b0abd['as'],'attributes':_0x3b0abd[_0x7254('0x1c')],'include':_0x3b0abd['include']?_[_0x7254('0x1f')](_0x3b0abd[_0x7254('0x1e')],function(_0x2ea976){return{'model':db[_0x2ea976[_0x7254('0x20')]],'as':_0x2ea976['as'],'attributes':_0x2ea976[_0x7254('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x140bb2){logger['info'](_0x7254('0x22'),_0x5569be);logger[_0x7254('0xf')](_0x7254('0x22'),_0x5569be,JSON[_0x7254('0x11')](_0x140bb2));_0x1279cd(_0x140bb2);})[_0x7254('0x15')](function(_0x4e6213){logger[_0x7254('0x12')]('ShowVtigerAccount',_0x4e6213[_0x7254('0x13')],_0x5569be);_0x2be5fc(_0x2f75ea[_0x7254('0x12')](0x1f4,_0x4e6213['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 328ebdc..afd89a7 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 _0x0efe=['create','put','update','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post'];(function(_0x4afb11,_0x1a07da){var _0x475934=function(_0x1cb002){while(--_0x1cb002){_0x4afb11['push'](_0x4afb11['shift']());}};_0x475934(++_0x1a07da);}(_0x0efe,0x119));var _0xe0ef=function(_0x140fec,_0x1d267e){_0x140fec=_0x140fec-0x0;var _0x2a2b1f=_0x0efe[_0x140fec];return _0x2a2b1f;};'use strict';var multer=require(_0xe0ef('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe0ef('0x1'));var express=require(_0xe0ef('0x2'));var router=express['Router']();var fs_extra=require(_0xe0ef('0x3'));var auth=require(_0xe0ef('0x4'));var interaction=require(_0xe0ef('0x5'));var config=require(_0xe0ef('0x6'));var controller=require(_0xe0ef('0x7'));router[_0xe0ef('0x8')]('/',auth[_0xe0ef('0x9')](),controller[_0xe0ef('0xa')]);router[_0xe0ef('0x8')](_0xe0ef('0xb'),auth[_0xe0ef('0x9')](),controller[_0xe0ef('0xc')]);router[_0xe0ef('0x8')]('/:id/fields',auth[_0xe0ef('0x9')](),controller[_0xe0ef('0xd')]);router[_0xe0ef('0x8')](_0xe0ef('0xe'),auth[_0xe0ef('0x9')](),controller[_0xe0ef('0xf')]);router['get'](_0xe0ef('0x10'),auth['isAuthenticated'](),controller[_0xe0ef('0x11')]);router[_0xe0ef('0x12')]('/',auth[_0xe0ef('0x9')](),controller[_0xe0ef('0x13')]);router[_0xe0ef('0x14')]('/:id',auth[_0xe0ef('0x9')](),controller[_0xe0ef('0x15')]);router[_0xe0ef('0x16')](_0xe0ef('0xb'),auth['isAuthenticated'](),controller[_0xe0ef('0x17')]);module[_0xe0ef('0x18')]=router; \ No newline at end of file +var _0x77eb=['connect-timeout','express','Router','fs-extra','../../config/environment','./intVtigerConfiguration.controller','get','/:id','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','path'];(function(_0x29a903,_0x1a2bef){var _0x2eac73=function(_0xea88b){while(--_0xea88b){_0x29a903['push'](_0x29a903['shift']());}};_0x2eac73(++_0x1a2bef);}(_0x77eb,0xbe));var _0xb77e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x77eb[_0x5447fd];return _0x15b28a;};'use strict';var multer=require(_0xb77e('0x0'));var util=require('util');var path=require(_0xb77e('0x1'));var timeout=require(_0xb77e('0x2'));var express=require(_0xb77e('0x3'));var router=express[_0xb77e('0x4')]();var fs_extra=require(_0xb77e('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb77e('0x6'));var controller=require(_0xb77e('0x7'));router[_0xb77e('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb77e('0x9'),auth['isAuthenticated'](),controller[_0xb77e('0xa')]);router[_0xb77e('0x8')](_0xb77e('0xb'),auth[_0xb77e('0xc')](),controller[_0xb77e('0xd')]);router[_0xb77e('0x8')](_0xb77e('0xe'),auth[_0xb77e('0xc')](),controller['getSubjects']);router[_0xb77e('0x8')](_0xb77e('0xf'),auth[_0xb77e('0xc')](),controller[_0xb77e('0x10')]);router[_0xb77e('0x11')]('/',auth[_0xb77e('0xc')](),controller[_0xb77e('0x12')]);router[_0xb77e('0x13')](_0xb77e('0x9'),auth[_0xb77e('0xc')](),controller[_0xb77e('0x14')]);router[_0xb77e('0x15')](_0xb77e('0x9'),auth[_0xb77e('0xc')](),controller[_0xb77e('0x16')]);module[_0xb77e('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 c2ca29e..591535e 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 _0x6957=['exports','STRING','sequelize'];(function(_0x5214fd,_0x238b9d){var _0x4c22f8=function(_0x53b8bf){while(--_0x53b8bf){_0x5214fd['push'](_0x5214fd['shift']());}};_0x4c22f8(++_0x238b9d);}(_0x6957,0xec));var _0x7695=function(_0x2e2fe8,_0x1b9082){_0x2e2fe8=_0x2e2fe8-0x0;var _0x2e555a=_0x6957[_0x2e2fe8];return _0x2e555a;};'use strict';var Sequelize=require(_0x7695('0x0'));module[_0x7695('0x1')]={'name':{'type':Sequelize[_0x7695('0x2')]},'description':{'type':Sequelize[_0x7695('0x2')]}}; \ No newline at end of file +var _0xf4ab=['STRING','sequelize','exports'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xf4ab,0x1a2));var _0xbf4a=function(_0x1399d6,_0x2c1661){_0x1399d6=_0x1399d6-0x0;var _0x4a9db4=_0xf4ab[_0x1399d6];return _0x4a9db4;};'use strict';var Sequelize=require(_0xbf4a('0x0'));module[_0xbf4a('0x1')]={'name':{'type':Sequelize[_0xbf4a('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index af0793a..43a3b71 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 _0x9a69=['fieldName','type','key','map','query','keys','filters','model','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','create','body','update','params','find','getFields','hasOwnProperty','getSubjects','findOne','VtigerField','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','set','Content-Range','reject','save','then','destroy','error','stack','name','index','VtigerConfiguration','rawAttributes'];(function(_0x3458b2,_0x1b5ed1){var _0x2a36db=function(_0xb50a8){while(--_0xb50a8){_0x3458b2['push'](_0x3458b2['shift']());}};_0x2a36db(++_0x1b5ed1);}(_0x9a69,0x75));var _0x99a6=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x9a69[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x99a6('0x0'));var zipdir=require(_0x99a6('0x1'));var jsonpatch=require(_0x99a6('0x2'));var rp=require(_0x99a6('0x3'));var moment=require(_0x99a6('0x4'));var BPromise=require(_0x99a6('0x5'));var Mustache=require(_0x99a6('0x6'));var util=require('util');var path=require(_0x99a6('0x7'));var sox=require('sox');var csv=require(_0x99a6('0x8'));var ejs=require(_0x99a6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x99a6('0xa'));var squel=require(_0x99a6('0xb'));var crypto=require(_0x99a6('0xc'));var jsforce=require(_0x99a6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x99a6('0x8'));var querystring=require(_0x99a6('0xe'));var Papa=require(_0x99a6('0xf'));var Redis=require(_0x99a6('0x10'));var authService=require(_0x99a6('0x11'));var qs=require(_0x99a6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x99a6('0x13'))('api');var utils=require(_0x99a6('0x14'));var config=require(_0x99a6('0x15'));var licenseUtil=require(_0x99a6('0x16'));var db=require(_0x99a6('0x17'))['db'];function respondWithStatusCode(_0x56c119,_0x11932e){_0x11932e=_0x11932e||0xcc;return function(_0x18378f){if(_0x18378f){return _0x56c119[_0x99a6('0x18')](_0x11932e);}return _0x56c119['status'](_0x11932e)[_0x99a6('0x19')]();};}function respondWithResult(_0x1da8ff,_0x4dfba3){_0x4dfba3=_0x4dfba3||0xc8;return function(_0x119b96){if(_0x119b96){return _0x1da8ff[_0x99a6('0x1a')](_0x4dfba3)[_0x99a6('0x1b')](_0x119b96);}};}function respondWithFilteredResult(_0x1fdce2,_0x28d297){return function(_0x235512){if(_0x235512){var _0x1cc25e=typeof _0x28d297[_0x99a6('0x1c')]==='undefined'&&typeof _0x28d297[_0x99a6('0x1d')]==='undefined';var _0x360877=_0x235512[_0x99a6('0x1e')];var _0x1cb84e=_0x1cc25e?0x0:_0x28d297['offset'];var _0x1715c8=_0x1cc25e?_0x235512['count']:_0x28d297['offset']+_0x28d297[_0x99a6('0x1d')];var _0x3d9ac7;if(_0x1715c8>=_0x360877){_0x1715c8=_0x360877;_0x3d9ac7=0xc8;}else{_0x3d9ac7=0xce;}_0x1fdce2[_0x99a6('0x1a')](_0x3d9ac7);return _0x1fdce2[_0x99a6('0x1f')](_0x99a6('0x20'),_0x1cb84e+'-'+_0x1715c8+'/'+_0x360877)[_0x99a6('0x1b')](_0x235512);}return null;};}function patchUpdates(_0x31670b){return function(_0xdb40fd){try{jsonpatch['apply'](_0xdb40fd,_0x31670b,!![]);}catch(_0x3b7908){return BPromise[_0x99a6('0x21')](_0x3b7908);}return _0xdb40fd[_0x99a6('0x22')]();};}function saveUpdates(_0xd39f88,_0x2df044){return function(_0x53f33d){if(_0x53f33d){return _0x53f33d['update'](_0xd39f88)[_0x99a6('0x23')](function(_0x5e637c){return _0x5e637c;});}return null;};}function removeEntity(_0x23f21b,_0x35490c){return function(_0x2a6a72){if(_0x2a6a72){return _0x2a6a72[_0x99a6('0x24')]()['then'](function(){_0x23f21b[_0x99a6('0x1a')](0xcc)[_0x99a6('0x19')]();});}};}function handleEntityNotFound(_0x567d9c,_0x20e006){return function(_0x5c0d50){if(!_0x5c0d50){_0x567d9c[_0x99a6('0x18')](0x194);}return _0x5c0d50;};}function handleError(_0x2ca2da,_0x321f89){_0x321f89=_0x321f89||0x1f4;return function(_0x28cbc2){logger[_0x99a6('0x25')](_0x28cbc2[_0x99a6('0x26')]);if(_0x28cbc2[_0x99a6('0x27')]){delete _0x28cbc2['name'];}_0x2ca2da[_0x99a6('0x1a')](_0x321f89)['send'](_0x28cbc2);};}exports[_0x99a6('0x28')]=function(_0x594f99,_0x312ac1){var _0x4d969a={},_0x3fe999={},_0x387fa0={'count':0x0,'rows':[]};var _0x47c403=_['map'](db[_0x99a6('0x29')][_0x99a6('0x2a')],function(_0x5dcc00){return{'name':_0x5dcc00[_0x99a6('0x2b')],'type':_0x5dcc00[_0x99a6('0x2c')][_0x99a6('0x2d')]};});_0x3fe999['model']=_[_0x99a6('0x2e')](_0x47c403,_0x99a6('0x27'));_0x3fe999[_0x99a6('0x2f')]=_[_0x99a6('0x30')](_0x594f99[_0x99a6('0x2f')]);_0x3fe999[_0x99a6('0x31')]=_['intersection'](_0x3fe999[_0x99a6('0x32')],_0x3fe999[_0x99a6('0x2f')]);_0x4d969a['attributes']=_[_0x99a6('0x33')](_0x3fe999[_0x99a6('0x32')],qs[_0x99a6('0x34')](_0x594f99[_0x99a6('0x2f')][_0x99a6('0x34')]));_0x4d969a[_0x99a6('0x35')]=_0x4d969a['attributes'][_0x99a6('0x36')]?_0x4d969a[_0x99a6('0x35')]:_0x3fe999[_0x99a6('0x32')];if(!_0x594f99['query']['hasOwnProperty'](_0x99a6('0x37'))){_0x4d969a[_0x99a6('0x1d')]=qs['limit'](_0x594f99['query'][_0x99a6('0x1d')]);_0x4d969a[_0x99a6('0x1c')]=qs[_0x99a6('0x1c')](_0x594f99['query'][_0x99a6('0x1c')]);}_0x4d969a[_0x99a6('0x38')]=qs[_0x99a6('0x39')](_0x594f99[_0x99a6('0x2f')][_0x99a6('0x39')]);_0x4d969a[_0x99a6('0x3a')]=qs[_0x99a6('0x31')](_[_0x99a6('0x3b')](_0x594f99[_0x99a6('0x2f')],_0x3fe999[_0x99a6('0x31')]),_0x47c403);if(_0x594f99[_0x99a6('0x2f')][_0x99a6('0x3c')]){_0x4d969a['where']=_[_0x99a6('0x3d')](_0x4d969a[_0x99a6('0x3a')],{'$or':_[_0x99a6('0x2e')](_0x47c403,function(_0x1aa8f4){if(_0x1aa8f4[_0x99a6('0x2c')]!=='VIRTUAL'){var _0x48f37f={};_0x48f37f[_0x1aa8f4[_0x99a6('0x27')]]={'$like':'%'+_0x594f99[_0x99a6('0x2f')][_0x99a6('0x3c')]+'%'};return _0x48f37f;}})});}_0x4d969a=_[_0x99a6('0x3d')]({},_0x4d969a,_0x594f99[_0x99a6('0x3e')]);var _0x3cb951={'where':_0x4d969a['where']};return db[_0x99a6('0x29')][_0x99a6('0x1e')](_0x3cb951)[_0x99a6('0x23')](function(_0x162eea){_0x387fa0[_0x99a6('0x1e')]=_0x162eea;if(_0x594f99['query'][_0x99a6('0x3f')]){_0x4d969a[_0x99a6('0x40')]=[{'all':!![]}];}return db[_0x99a6('0x29')][_0x99a6('0x41')](_0x4d969a);})[_0x99a6('0x23')](function(_0x21bb3b){_0x387fa0[_0x99a6('0x42')]=_0x21bb3b;return _0x387fa0;})[_0x99a6('0x23')](respondWithFilteredResult(_0x312ac1,_0x4d969a))[_0x99a6('0x43')](handleError(_0x312ac1,null));};exports[_0x99a6('0x44')]=function(_0x1db513,_0x33292b){var _0x410c9a={'raw':![],'where':{'id':_0x1db513['params']['id']}},_0x5c1f0d={};_0x5c1f0d[_0x99a6('0x32')]=_[_0x99a6('0x30')](db[_0x99a6('0x29')][_0x99a6('0x2a')]);_0x5c1f0d[_0x99a6('0x2f')]=_['keys'](_0x1db513[_0x99a6('0x2f')]);_0x5c1f0d[_0x99a6('0x31')]=_[_0x99a6('0x33')](_0x5c1f0d[_0x99a6('0x32')],_0x5c1f0d[_0x99a6('0x2f')]);_0x410c9a['attributes']=_[_0x99a6('0x33')](_0x5c1f0d[_0x99a6('0x32')],qs[_0x99a6('0x34')](_0x1db513['query'][_0x99a6('0x34')]));_0x410c9a[_0x99a6('0x35')]=_0x410c9a[_0x99a6('0x35')][_0x99a6('0x36')]?_0x410c9a[_0x99a6('0x35')]:_0x5c1f0d[_0x99a6('0x32')];if(_0x1db513[_0x99a6('0x2f')][_0x99a6('0x3f')]){_0x410c9a[_0x99a6('0x40')]=[{'all':!![]}];}_0x410c9a=_[_0x99a6('0x3d')]({},_0x410c9a,_0x1db513['options']);return db[_0x99a6('0x29')]['find'](_0x410c9a)[_0x99a6('0x23')](handleEntityNotFound(_0x33292b,null))['then'](respondWithResult(_0x33292b,null))[_0x99a6('0x43')](handleError(_0x33292b,null));};exports[_0x99a6('0x45')]=function(_0x124d79,_0x3ed058){return db[_0x99a6('0x29')][_0x99a6('0x45')](_0x124d79[_0x99a6('0x46')],{})[_0x99a6('0x23')](respondWithResult(_0x3ed058,0xc9))['catch'](handleError(_0x3ed058,null));};exports[_0x99a6('0x47')]=function(_0xade4d7,_0x5c0fc6){if(_0xade4d7['body']['id']){delete _0xade4d7[_0x99a6('0x46')]['id'];}return db[_0x99a6('0x29')]['find']({'where':{'id':_0xade4d7[_0x99a6('0x48')]['id']}})['then'](handleEntityNotFound(_0x5c0fc6,null))['then'](saveUpdates(_0xade4d7[_0x99a6('0x46')],null))[_0x99a6('0x23')](respondWithResult(_0x5c0fc6,null))[_0x99a6('0x43')](handleError(_0x5c0fc6,null));};exports[_0x99a6('0x24')]=function(_0x22672a,_0x44605b){return db[_0x99a6('0x29')][_0x99a6('0x49')]({'where':{'id':_0x22672a[_0x99a6('0x48')]['id']}})[_0x99a6('0x23')](handleEntityNotFound(_0x44605b,null))['then'](removeEntity(_0x44605b,null))['catch'](handleError(_0x44605b,null));};exports[_0x99a6('0x4a')]=function(_0x258de6,_0x399cd6,_0x876ba){var _0xfb7f7a={};var _0x59d5d5={};var _0x127401;var _0x66d2e8;return db[_0x99a6('0x29')]['findOne']({'where':{'id':_0x258de6['params']['id']}})['then'](handleEntityNotFound(_0x399cd6,null))[_0x99a6('0x23')](function(_0x28fee9){if(_0x28fee9){_0x127401=_0x28fee9;_0x59d5d5[_0x99a6('0x32')]=_[_0x99a6('0x30')](db['VtigerField'][_0x99a6('0x2a')]);_0x59d5d5[_0x99a6('0x2f')]=_[_0x99a6('0x30')](_0x258de6[_0x99a6('0x2f')]);_0x59d5d5['filters']=_[_0x99a6('0x33')](_0x59d5d5[_0x99a6('0x32')],_0x59d5d5[_0x99a6('0x2f')]);_0xfb7f7a['attributes']=_[_0x99a6('0x33')](_0x59d5d5[_0x99a6('0x32')],qs['fields'](_0x258de6[_0x99a6('0x2f')][_0x99a6('0x34')]));_0xfb7f7a[_0x99a6('0x35')]=_0xfb7f7a[_0x99a6('0x35')][_0x99a6('0x36')]?_0xfb7f7a['attributes']:_0x59d5d5['model'];_0xfb7f7a[_0x99a6('0x38')]=qs['sort'](_0x258de6[_0x99a6('0x2f')]['sort']);_0xfb7f7a[_0x99a6('0x3a')]=qs['filters'](_[_0x99a6('0x3b')](_0x258de6[_0x99a6('0x2f')],_0x59d5d5[_0x99a6('0x31')]));if(_0x258de6['query'][_0x99a6('0x3c')]){_0xfb7f7a[_0x99a6('0x3a')]=_[_0x99a6('0x3d')](_0xfb7f7a['where'],{'$or':_[_0x99a6('0x2e')](_0xfb7f7a[_0x99a6('0x35')],function(_0x2626e9){var _0x19e68f={};_0x19e68f[_0x2626e9]={'$like':'%'+_0x258de6[_0x99a6('0x2f')][_0x99a6('0x3c')]+'%'};return _0x19e68f;})});}_0xfb7f7a=_[_0x99a6('0x3d')]({},_0xfb7f7a,_0x258de6[_0x99a6('0x3e')]);return _0x127401[_0x99a6('0x4a')](_0xfb7f7a);}})[_0x99a6('0x23')](function(_0x37b50b){if(_0x37b50b){_0x66d2e8=_0x37b50b[_0x99a6('0x36')];if(!_0x258de6[_0x99a6('0x2f')][_0x99a6('0x4b')](_0x99a6('0x37'))){_0xfb7f7a[_0x99a6('0x1d')]=qs[_0x99a6('0x1d')](_0x258de6[_0x99a6('0x2f')][_0x99a6('0x1d')]);_0xfb7f7a[_0x99a6('0x1c')]=qs['offset'](_0x258de6[_0x99a6('0x2f')][_0x99a6('0x1c')]);}return _0x127401[_0x99a6('0x4a')](_0xfb7f7a);}})[_0x99a6('0x23')](function(_0x5a7b5b){if(_0x5a7b5b){return _0x5a7b5b?{'count':_0x66d2e8,'rows':_0x5a7b5b}:null;}})[_0x99a6('0x23')](respondWithResult(_0x399cd6,null))['catch'](handleError(_0x399cd6,null));};exports[_0x99a6('0x4c')]=function(_0x1ba33e,_0x3bba3f,_0xa93d87){var _0x307d7e={};var _0x597760={};var _0x1bff9d;var _0x5de72f;return db[_0x99a6('0x29')][_0x99a6('0x4d')]({'where':{'id':_0x1ba33e['params']['id']}})[_0x99a6('0x23')](handleEntityNotFound(_0x3bba3f,null))[_0x99a6('0x23')](function(_0x36e790){if(_0x36e790){_0x1bff9d=_0x36e790;_0x597760[_0x99a6('0x32')]=_['keys'](db[_0x99a6('0x4e')]['rawAttributes']);_0x597760[_0x99a6('0x2f')]=_['keys'](_0x1ba33e[_0x99a6('0x2f')]);_0x597760[_0x99a6('0x31')]=_[_0x99a6('0x33')](_0x597760[_0x99a6('0x32')],_0x597760[_0x99a6('0x2f')]);_0x307d7e['attributes']=_[_0x99a6('0x33')](_0x597760[_0x99a6('0x32')],qs[_0x99a6('0x34')](_0x1ba33e['query']['fields']));_0x307d7e[_0x99a6('0x35')]=_0x307d7e[_0x99a6('0x35')][_0x99a6('0x36')]?_0x307d7e['attributes']:_0x597760[_0x99a6('0x32')];_0x307d7e[_0x99a6('0x38')]=qs[_0x99a6('0x39')](_0x1ba33e['query'][_0x99a6('0x39')]);_0x307d7e[_0x99a6('0x3a')]=qs['filters'](_[_0x99a6('0x3b')](_0x1ba33e[_0x99a6('0x2f')],_0x597760[_0x99a6('0x31')]));if(_0x1ba33e['query'][_0x99a6('0x3c')]){_0x307d7e[_0x99a6('0x3a')]=_[_0x99a6('0x3d')](_0x307d7e['where'],{'$or':_[_0x99a6('0x2e')](_0x307d7e['attributes'],function(_0x6d6d02){var _0x4a4882={};_0x4a4882[_0x6d6d02]={'$like':'%'+_0x1ba33e[_0x99a6('0x2f')]['filter']+'%'};return _0x4a4882;})});}_0x307d7e=_[_0x99a6('0x3d')]({},_0x307d7e,_0x1ba33e['options']);return _0x1bff9d[_0x99a6('0x4c')](_0x307d7e);}})[_0x99a6('0x23')](function(_0x561107){if(_0x561107){_0x5de72f=_0x561107[_0x99a6('0x36')];if(!_0x1ba33e[_0x99a6('0x2f')][_0x99a6('0x4b')](_0x99a6('0x37'))){_0x307d7e['limit']=qs[_0x99a6('0x1d')](_0x1ba33e[_0x99a6('0x2f')]['limit']);_0x307d7e[_0x99a6('0x1c')]=qs[_0x99a6('0x1c')](_0x1ba33e[_0x99a6('0x2f')][_0x99a6('0x1c')]);}return _0x1bff9d['getSubjects'](_0x307d7e);}})[_0x99a6('0x23')](function(_0xee3712){if(_0xee3712){return _0xee3712?{'count':_0x5de72f,'rows':_0xee3712}:null;}})[_0x99a6('0x23')](respondWithResult(_0x3bba3f,null))[_0x99a6('0x43')](handleError(_0x3bba3f,null));};exports[_0x99a6('0x4f')]=function(_0x277e8b,_0x571333,_0x5386a9){var _0x474c63={};var _0x319b41={};var _0x5c9969;var _0x234cbd;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x277e8b[_0x99a6('0x48')]['id']}})[_0x99a6('0x23')](handleEntityNotFound(_0x571333,null))[_0x99a6('0x23')](function(_0x42721c){if(_0x42721c){_0x5c9969=_0x42721c;_0x319b41['model']=_[_0x99a6('0x30')](db[_0x99a6('0x4e')][_0x99a6('0x2a')]);_0x319b41[_0x99a6('0x2f')]=_['keys'](_0x277e8b['query']);_0x319b41[_0x99a6('0x31')]=_['intersection'](_0x319b41[_0x99a6('0x32')],_0x319b41[_0x99a6('0x2f')]);_0x474c63[_0x99a6('0x35')]=_['intersection'](_0x319b41[_0x99a6('0x32')],qs[_0x99a6('0x34')](_0x277e8b[_0x99a6('0x2f')][_0x99a6('0x34')]));_0x474c63['attributes']=_0x474c63[_0x99a6('0x35')]['length']?_0x474c63['attributes']:_0x319b41[_0x99a6('0x32')];_0x474c63[_0x99a6('0x38')]=qs[_0x99a6('0x39')](_0x277e8b[_0x99a6('0x2f')][_0x99a6('0x39')]);_0x474c63['where']=qs[_0x99a6('0x31')](_[_0x99a6('0x3b')](_0x277e8b[_0x99a6('0x2f')],_0x319b41['filters']));if(_0x277e8b[_0x99a6('0x2f')]['filter']){_0x474c63[_0x99a6('0x3a')]=_[_0x99a6('0x3d')](_0x474c63[_0x99a6('0x3a')],{'$or':_[_0x99a6('0x2e')](_0x474c63['attributes'],function(_0x39dadf){var _0x4c690c={};_0x4c690c[_0x39dadf]={'$like':'%'+_0x277e8b[_0x99a6('0x2f')]['filter']+'%'};return _0x4c690c;})});}_0x474c63=_[_0x99a6('0x3d')]({},_0x474c63,_0x277e8b[_0x99a6('0x3e')]);return _0x5c9969[_0x99a6('0x4f')](_0x474c63);}})[_0x99a6('0x23')](function(_0x3a76ad){if(_0x3a76ad){_0x234cbd=_0x3a76ad[_0x99a6('0x36')];if(!_0x277e8b[_0x99a6('0x2f')][_0x99a6('0x4b')]('nolimit')){_0x474c63[_0x99a6('0x1d')]=qs[_0x99a6('0x1d')](_0x277e8b[_0x99a6('0x2f')][_0x99a6('0x1d')]);_0x474c63[_0x99a6('0x1c')]=qs[_0x99a6('0x1c')](_0x277e8b[_0x99a6('0x2f')][_0x99a6('0x1c')]);}return _0x5c9969[_0x99a6('0x4f')](_0x474c63);}})[_0x99a6('0x23')](function(_0x3e98c0){if(_0x3e98c0){return _0x3e98c0?{'count':_0x234cbd,'rows':_0x3e98c0}:null;}})[_0x99a6('0x23')](respondWithResult(_0x571333,null))[_0x99a6('0x43')](handleError(_0x571333,null));}; \ No newline at end of file +var _0x28a3=['rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','VtigerConfiguration','find','create','body','getFields','findOne','VtigerField','filter','getSubjects','hasOwnProperty','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','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','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','then','sendStatus','error','name','send','index','map'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x28a3,0x79));var _0x328a=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x28a3[_0x199572];return _0x13cfa3;};'use strict';var emlformat=require(_0x328a('0x0'));var rimraf=require(_0x328a('0x1'));var zipdir=require(_0x328a('0x2'));var jsonpatch=require(_0x328a('0x3'));var rp=require(_0x328a('0x4'));var moment=require(_0x328a('0x5'));var BPromise=require(_0x328a('0x6'));var Mustache=require(_0x328a('0x7'));var util=require(_0x328a('0x8'));var path=require(_0x328a('0x9'));var sox=require(_0x328a('0xa'));var csv=require('to-csv');var ejs=require(_0x328a('0xb'));var fs=require('fs');var fs_extra=require(_0x328a('0xc'));var _=require(_0x328a('0xd'));var squel=require(_0x328a('0xe'));var crypto=require(_0x328a('0xf'));var jsforce=require(_0x328a('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x328a('0x11'));var Papa=require(_0x328a('0x12'));var Redis=require(_0x328a('0x13'));var authService=require(_0x328a('0x14'));var qs=require(_0x328a('0x15'));var as=require(_0x328a('0x16'));var hardwareService=require(_0x328a('0x17'));var logger=require(_0x328a('0x18'))(_0x328a('0x19'));var utils=require(_0x328a('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x328a('0x1b'));var db=require(_0x328a('0x1c'))['db'];function respondWithStatusCode(_0x218fb5,_0x256702){_0x256702=_0x256702||0xcc;return function(_0x44fb9b){if(_0x44fb9b){return _0x218fb5['sendStatus'](_0x256702);}return _0x218fb5[_0x328a('0x1d')](_0x256702)[_0x328a('0x1e')]();};}function respondWithResult(_0x2df749,_0x5c8e90){_0x5c8e90=_0x5c8e90||0xc8;return function(_0x3e028f){if(_0x3e028f){return _0x2df749[_0x328a('0x1d')](_0x5c8e90)[_0x328a('0x1f')](_0x3e028f);}};}function respondWithFilteredResult(_0xa6ade1,_0x5dda9e){return function(_0x13c555){if(_0x13c555){var _0x32178f=typeof _0x5dda9e['offset']===_0x328a('0x20')&&typeof _0x5dda9e[_0x328a('0x21')]===_0x328a('0x20');var _0x1aa2f8=_0x13c555[_0x328a('0x22')];var _0x2ab979=_0x32178f?0x0:_0x5dda9e[_0x328a('0x23')];var _0x22398a=_0x32178f?_0x13c555[_0x328a('0x22')]:_0x5dda9e[_0x328a('0x23')]+_0x5dda9e['limit'];var _0x1f4906;if(_0x22398a>=_0x1aa2f8){_0x22398a=_0x1aa2f8;_0x1f4906=0xc8;}else{_0x1f4906=0xce;}_0xa6ade1[_0x328a('0x1d')](_0x1f4906);return _0xa6ade1['set'](_0x328a('0x24'),_0x2ab979+'-'+_0x22398a+'/'+_0x1aa2f8)[_0x328a('0x1f')](_0x13c555);}return null;};}function patchUpdates(_0x2433d3){return function(_0x39c5f3){try{jsonpatch[_0x328a('0x25')](_0x39c5f3,_0x2433d3,!![]);}catch(_0xa394be){return BPromise[_0x328a('0x26')](_0xa394be);}return _0x39c5f3[_0x328a('0x27')]();};}function saveUpdates(_0x3c032a,_0x19e4a2){return function(_0x2c1f7a){if(_0x2c1f7a){return _0x2c1f7a['update'](_0x3c032a)[_0x328a('0x28')](function(_0x190614){return _0x190614;});}return null;};}function removeEntity(_0x420e87,_0x2bf0d7){return function(_0x4b9bf1){if(_0x4b9bf1){return _0x4b9bf1['destroy']()[_0x328a('0x28')](function(){_0x420e87[_0x328a('0x1d')](0xcc)[_0x328a('0x1e')]();});}};}function handleEntityNotFound(_0x4bd734,_0x49d690){return function(_0x25a287){if(!_0x25a287){_0x4bd734[_0x328a('0x29')](0x194);}return _0x25a287;};}function handleError(_0x42d2a8,_0x31a7ea){_0x31a7ea=_0x31a7ea||0x1f4;return function(_0x25749f){logger[_0x328a('0x2a')](_0x25749f['stack']);if(_0x25749f[_0x328a('0x2b')]){delete _0x25749f['name'];}_0x42d2a8[_0x328a('0x1d')](_0x31a7ea)[_0x328a('0x2c')](_0x25749f);};}exports[_0x328a('0x2d')]=function(_0x2cc959,_0x30f278){var _0x157dd8={},_0x47e444={},_0x474197={'count':0x0,'rows':[]};var _0x264c93=_[_0x328a('0x2e')](db['VtigerConfiguration'][_0x328a('0x2f')],function(_0x41cf26){return{'name':_0x41cf26['fieldName'],'type':_0x41cf26[_0x328a('0x30')][_0x328a('0x31')]};});_0x47e444[_0x328a('0x32')]=_['map'](_0x264c93,_0x328a('0x2b'));_0x47e444[_0x328a('0x33')]=_['keys'](_0x2cc959['query']);_0x47e444[_0x328a('0x34')]=_[_0x328a('0x35')](_0x47e444['model'],_0x47e444['query']);_0x157dd8[_0x328a('0x36')]=_[_0x328a('0x35')](_0x47e444[_0x328a('0x32')],qs[_0x328a('0x37')](_0x2cc959[_0x328a('0x33')][_0x328a('0x37')]));_0x157dd8[_0x328a('0x36')]=_0x157dd8[_0x328a('0x36')][_0x328a('0x38')]?_0x157dd8[_0x328a('0x36')]:_0x47e444[_0x328a('0x32')];if(!_0x2cc959[_0x328a('0x33')]['hasOwnProperty'](_0x328a('0x39'))){_0x157dd8[_0x328a('0x21')]=qs[_0x328a('0x21')](_0x2cc959[_0x328a('0x33')][_0x328a('0x21')]);_0x157dd8[_0x328a('0x23')]=qs[_0x328a('0x23')](_0x2cc959[_0x328a('0x33')]['offset']);}_0x157dd8[_0x328a('0x3a')]=qs[_0x328a('0x3b')](_0x2cc959[_0x328a('0x33')][_0x328a('0x3b')]);_0x157dd8[_0x328a('0x3c')]=qs[_0x328a('0x34')](_[_0x328a('0x3d')](_0x2cc959[_0x328a('0x33')],_0x47e444[_0x328a('0x34')]),_0x264c93);if(_0x2cc959[_0x328a('0x33')]['filter']){_0x157dd8[_0x328a('0x3c')]=_['merge'](_0x157dd8[_0x328a('0x3c')],{'$or':_[_0x328a('0x2e')](_0x264c93,function(_0x3234f1){if(_0x3234f1[_0x328a('0x30')]!==_0x328a('0x3e')){var _0x24a5aa={};_0x24a5aa[_0x3234f1['name']]={'$like':'%'+_0x2cc959[_0x328a('0x33')]['filter']+'%'};return _0x24a5aa;}})});}_0x157dd8=_[_0x328a('0x3f')]({},_0x157dd8,_0x2cc959[_0x328a('0x40')]);var _0x293d8e={'where':_0x157dd8[_0x328a('0x3c')]};return db['VtigerConfiguration'][_0x328a('0x22')](_0x293d8e)[_0x328a('0x28')](function(_0x4cd243){_0x474197[_0x328a('0x22')]=_0x4cd243;if(_0x2cc959[_0x328a('0x33')][_0x328a('0x41')]){_0x157dd8[_0x328a('0x42')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0x328a('0x43')](_0x157dd8);})[_0x328a('0x28')](function(_0x31c135){_0x474197[_0x328a('0x44')]=_0x31c135;return _0x474197;})[_0x328a('0x28')](respondWithFilteredResult(_0x30f278,_0x157dd8))[_0x328a('0x45')](handleError(_0x30f278,null));};exports[_0x328a('0x46')]=function(_0xdfe3f3,_0x43fe0d){var _0xee0777={'raw':![],'where':{'id':_0xdfe3f3[_0x328a('0x47')]['id']}},_0x1fea23={};_0x1fea23['model']=_[_0x328a('0x48')](db[_0x328a('0x49')][_0x328a('0x2f')]);_0x1fea23['query']=_[_0x328a('0x48')](_0xdfe3f3['query']);_0x1fea23[_0x328a('0x34')]=_[_0x328a('0x35')](_0x1fea23[_0x328a('0x32')],_0x1fea23[_0x328a('0x33')]);_0xee0777['attributes']=_[_0x328a('0x35')](_0x1fea23[_0x328a('0x32')],qs[_0x328a('0x37')](_0xdfe3f3[_0x328a('0x33')][_0x328a('0x37')]));_0xee0777[_0x328a('0x36')]=_0xee0777[_0x328a('0x36')]['length']?_0xee0777[_0x328a('0x36')]:_0x1fea23['model'];if(_0xdfe3f3[_0x328a('0x33')][_0x328a('0x41')]){_0xee0777['include']=[{'all':!![]}];}_0xee0777=_[_0x328a('0x3f')]({},_0xee0777,_0xdfe3f3['options']);return db[_0x328a('0x49')][_0x328a('0x4a')](_0xee0777)[_0x328a('0x28')](handleEntityNotFound(_0x43fe0d,null))['then'](respondWithResult(_0x43fe0d,null))[_0x328a('0x45')](handleError(_0x43fe0d,null));};exports[_0x328a('0x4b')]=function(_0x542266,_0x497bd9){return db['VtigerConfiguration'][_0x328a('0x4b')](_0x542266[_0x328a('0x4c')],{})[_0x328a('0x28')](respondWithResult(_0x497bd9,0xc9))['catch'](handleError(_0x497bd9,null));};exports['update']=function(_0x1c9673,_0x19b384){if(_0x1c9673[_0x328a('0x4c')]['id']){delete _0x1c9673[_0x328a('0x4c')]['id'];}return db['VtigerConfiguration'][_0x328a('0x4a')]({'where':{'id':_0x1c9673[_0x328a('0x47')]['id']}})['then'](handleEntityNotFound(_0x19b384,null))[_0x328a('0x28')](saveUpdates(_0x1c9673[_0x328a('0x4c')],null))['then'](respondWithResult(_0x19b384,null))[_0x328a('0x45')](handleError(_0x19b384,null));};exports['destroy']=function(_0x430aab,_0x57f036){return db[_0x328a('0x49')][_0x328a('0x4a')]({'where':{'id':_0x430aab[_0x328a('0x47')]['id']}})[_0x328a('0x28')](handleEntityNotFound(_0x57f036,null))[_0x328a('0x28')](removeEntity(_0x57f036,null))[_0x328a('0x45')](handleError(_0x57f036,null));};exports[_0x328a('0x4d')]=function(_0x459f19,_0x14d820,_0x147097){var _0x8718c3={};var _0x2c4df5={};var _0x960877;var _0x4366c9;return db[_0x328a('0x49')][_0x328a('0x4e')]({'where':{'id':_0x459f19['params']['id']}})[_0x328a('0x28')](handleEntityNotFound(_0x14d820,null))[_0x328a('0x28')](function(_0x1cf302){if(_0x1cf302){_0x960877=_0x1cf302;_0x2c4df5[_0x328a('0x32')]=_[_0x328a('0x48')](db[_0x328a('0x4f')][_0x328a('0x2f')]);_0x2c4df5[_0x328a('0x33')]=_[_0x328a('0x48')](_0x459f19[_0x328a('0x33')]);_0x2c4df5[_0x328a('0x34')]=_['intersection'](_0x2c4df5[_0x328a('0x32')],_0x2c4df5[_0x328a('0x33')]);_0x8718c3[_0x328a('0x36')]=_[_0x328a('0x35')](_0x2c4df5[_0x328a('0x32')],qs[_0x328a('0x37')](_0x459f19['query'][_0x328a('0x37')]));_0x8718c3['attributes']=_0x8718c3[_0x328a('0x36')][_0x328a('0x38')]?_0x8718c3[_0x328a('0x36')]:_0x2c4df5['model'];_0x8718c3[_0x328a('0x3a')]=qs['sort'](_0x459f19[_0x328a('0x33')]['sort']);_0x8718c3[_0x328a('0x3c')]=qs[_0x328a('0x34')](_[_0x328a('0x3d')](_0x459f19[_0x328a('0x33')],_0x2c4df5['filters']));if(_0x459f19[_0x328a('0x33')][_0x328a('0x50')]){_0x8718c3[_0x328a('0x3c')]=_[_0x328a('0x3f')](_0x8718c3[_0x328a('0x3c')],{'$or':_[_0x328a('0x2e')](_0x8718c3['attributes'],function(_0x5ba44b){var _0x40c509={};_0x40c509[_0x5ba44b]={'$like':'%'+_0x459f19[_0x328a('0x33')][_0x328a('0x50')]+'%'};return _0x40c509;})});}_0x8718c3=_[_0x328a('0x3f')]({},_0x8718c3,_0x459f19[_0x328a('0x40')]);return _0x960877['getFields'](_0x8718c3);}})[_0x328a('0x28')](function(_0x39a66a){if(_0x39a66a){_0x4366c9=_0x39a66a[_0x328a('0x38')];if(!_0x459f19[_0x328a('0x33')]['hasOwnProperty'](_0x328a('0x39'))){_0x8718c3[_0x328a('0x21')]=qs['limit'](_0x459f19[_0x328a('0x33')][_0x328a('0x21')]);_0x8718c3[_0x328a('0x23')]=qs['offset'](_0x459f19[_0x328a('0x33')][_0x328a('0x23')]);}return _0x960877['getFields'](_0x8718c3);}})[_0x328a('0x28')](function(_0x285119){if(_0x285119){return _0x285119?{'count':_0x4366c9,'rows':_0x285119}:null;}})[_0x328a('0x28')](respondWithResult(_0x14d820,null))[_0x328a('0x45')](handleError(_0x14d820,null));};exports[_0x328a('0x51')]=function(_0x3b73c0,_0x12fe03,_0x5d7d52){var _0x2eea69={};var _0xb0f531={};var _0x4e9b47;var _0x5a2f23;return db[_0x328a('0x49')][_0x328a('0x4e')]({'where':{'id':_0x3b73c0[_0x328a('0x47')]['id']}})[_0x328a('0x28')](handleEntityNotFound(_0x12fe03,null))['then'](function(_0x103a21){if(_0x103a21){_0x4e9b47=_0x103a21;_0xb0f531[_0x328a('0x32')]=_['keys'](db['VtigerField'][_0x328a('0x2f')]);_0xb0f531[_0x328a('0x33')]=_[_0x328a('0x48')](_0x3b73c0[_0x328a('0x33')]);_0xb0f531[_0x328a('0x34')]=_[_0x328a('0x35')](_0xb0f531[_0x328a('0x32')],_0xb0f531[_0x328a('0x33')]);_0x2eea69[_0x328a('0x36')]=_['intersection'](_0xb0f531['model'],qs['fields'](_0x3b73c0[_0x328a('0x33')][_0x328a('0x37')]));_0x2eea69[_0x328a('0x36')]=_0x2eea69[_0x328a('0x36')][_0x328a('0x38')]?_0x2eea69[_0x328a('0x36')]:_0xb0f531[_0x328a('0x32')];_0x2eea69[_0x328a('0x3a')]=qs[_0x328a('0x3b')](_0x3b73c0[_0x328a('0x33')][_0x328a('0x3b')]);_0x2eea69[_0x328a('0x3c')]=qs[_0x328a('0x34')](_[_0x328a('0x3d')](_0x3b73c0[_0x328a('0x33')],_0xb0f531[_0x328a('0x34')]));if(_0x3b73c0[_0x328a('0x33')]['filter']){_0x2eea69['where']=_[_0x328a('0x3f')](_0x2eea69['where'],{'$or':_[_0x328a('0x2e')](_0x2eea69[_0x328a('0x36')],function(_0x3750dd){var _0x2ab572={};_0x2ab572[_0x3750dd]={'$like':'%'+_0x3b73c0[_0x328a('0x33')]['filter']+'%'};return _0x2ab572;})});}_0x2eea69=_[_0x328a('0x3f')]({},_0x2eea69,_0x3b73c0[_0x328a('0x40')]);return _0x4e9b47[_0x328a('0x51')](_0x2eea69);}})[_0x328a('0x28')](function(_0x1270d7){if(_0x1270d7){_0x5a2f23=_0x1270d7[_0x328a('0x38')];if(!_0x3b73c0[_0x328a('0x33')][_0x328a('0x52')](_0x328a('0x39'))){_0x2eea69[_0x328a('0x21')]=qs['limit'](_0x3b73c0[_0x328a('0x33')][_0x328a('0x21')]);_0x2eea69[_0x328a('0x23')]=qs['offset'](_0x3b73c0[_0x328a('0x33')][_0x328a('0x23')]);}return _0x4e9b47[_0x328a('0x51')](_0x2eea69);}})['then'](function(_0x1f1180){if(_0x1f1180){return _0x1f1180?{'count':_0x5a2f23,'rows':_0x1f1180}:null;}})[_0x328a('0x28')](respondWithResult(_0x12fe03,null))['catch'](handleError(_0x12fe03,null));};exports['getDescriptions']=function(_0x1b74b6,_0xb7edc4,_0x431093){var _0x2ce754={};var _0x33b4d4={};var _0x530661;var _0x31daed;return db[_0x328a('0x49')][_0x328a('0x4e')]({'where':{'id':_0x1b74b6[_0x328a('0x47')]['id']}})[_0x328a('0x28')](handleEntityNotFound(_0xb7edc4,null))[_0x328a('0x28')](function(_0x5c7fb2){if(_0x5c7fb2){_0x530661=_0x5c7fb2;_0x33b4d4['model']=_[_0x328a('0x48')](db['VtigerField'][_0x328a('0x2f')]);_0x33b4d4[_0x328a('0x33')]=_[_0x328a('0x48')](_0x1b74b6[_0x328a('0x33')]);_0x33b4d4[_0x328a('0x34')]=_[_0x328a('0x35')](_0x33b4d4['model'],_0x33b4d4[_0x328a('0x33')]);_0x2ce754[_0x328a('0x36')]=_[_0x328a('0x35')](_0x33b4d4['model'],qs[_0x328a('0x37')](_0x1b74b6[_0x328a('0x33')][_0x328a('0x37')]));_0x2ce754[_0x328a('0x36')]=_0x2ce754[_0x328a('0x36')][_0x328a('0x38')]?_0x2ce754[_0x328a('0x36')]:_0x33b4d4[_0x328a('0x32')];_0x2ce754[_0x328a('0x3a')]=qs['sort'](_0x1b74b6[_0x328a('0x33')][_0x328a('0x3b')]);_0x2ce754[_0x328a('0x3c')]=qs[_0x328a('0x34')](_[_0x328a('0x3d')](_0x1b74b6[_0x328a('0x33')],_0x33b4d4[_0x328a('0x34')]));if(_0x1b74b6['query']['filter']){_0x2ce754[_0x328a('0x3c')]=_['merge'](_0x2ce754[_0x328a('0x3c')],{'$or':_[_0x328a('0x2e')](_0x2ce754[_0x328a('0x36')],function(_0x3d3dbd){var _0x380998={};_0x380998[_0x3d3dbd]={'$like':'%'+_0x1b74b6[_0x328a('0x33')][_0x328a('0x50')]+'%'};return _0x380998;})});}_0x2ce754=_[_0x328a('0x3f')]({},_0x2ce754,_0x1b74b6[_0x328a('0x40')]);return _0x530661[_0x328a('0x53')](_0x2ce754);}})[_0x328a('0x28')](function(_0x3829ad){if(_0x3829ad){_0x31daed=_0x3829ad['length'];if(!_0x1b74b6[_0x328a('0x33')][_0x328a('0x52')](_0x328a('0x39'))){_0x2ce754[_0x328a('0x21')]=qs[_0x328a('0x21')](_0x1b74b6['query'][_0x328a('0x21')]);_0x2ce754[_0x328a('0x23')]=qs['offset'](_0x1b74b6[_0x328a('0x33')][_0x328a('0x23')]);}return _0x530661[_0x328a('0x53')](_0x2ce754);}})[_0x328a('0x28')](function(_0x4c2fa6){if(_0x4c2fa6){return _0x4c2fa6?{'count':_0x31daed,'rows':_0x4c2fa6}:null;}})[_0x328a('0x28')](respondWithResult(_0xb7edc4,null))[_0x328a('0x45')](handleError(_0xb7edc4,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 35d29af..0f58ec7 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 _0x2180=['path','rimraf','./intVtigerConfiguration.attributes','define','int_vtiger_configurations','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x125900,_0x3ee45a){var _0x4fd5c4=function(_0x3f84fe){while(--_0x3f84fe){_0x125900['push'](_0x125900['shift']());}};_0x4fd5c4(++_0x3ee45a);}(_0x2180,0xd6));var _0x0218=function(_0x141e03,_0x18340e){_0x141e03=_0x141e03-0x0;var _0x2074e3=_0x2180[_0x141e03];return _0x2074e3;};'use strict';var _=require('lodash');var util=require(_0x0218('0x0'));var logger=require(_0x0218('0x1'))(_0x0218('0x2'));var moment=require(_0x0218('0x3'));var BPromise=require(_0x0218('0x4'));var rp=require(_0x0218('0x5'));var fs=require('fs');var path=require(_0x0218('0x6'));var rimraf=require(_0x0218('0x7'));var config=require('../../config/environment');var attributes=require(_0x0218('0x8'));module['exports']=function(_0x52498a,_0x8facaf){return _0x52498a[_0x0218('0x9')]('VtigerConfiguration',attributes,{'tableName':_0x0218('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b7d=['VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intVtigerConfiguration.attributes'];(function(_0x3815e9,_0x37e741){var _0x519fa7=function(_0x56a8a6){while(--_0x56a8a6){_0x3815e9['push'](_0x3815e9['shift']());}};_0x519fa7(++_0x37e741);}(_0x0b7d,0x122));var _0xd0b7=function(_0x55af0d,_0x5db5c9){_0x55af0d=_0x55af0d-0x0;var _0x245085=_0x0b7d[_0x55af0d];return _0x245085;};'use strict';var _=require(_0xd0b7('0x0'));var util=require(_0xd0b7('0x1'));var logger=require(_0xd0b7('0x2'))(_0xd0b7('0x3'));var moment=require(_0xd0b7('0x4'));var BPromise=require(_0xd0b7('0x5'));var rp=require(_0xd0b7('0x6'));var fs=require('fs');var path=require(_0xd0b7('0x7'));var rimraf=require('rimraf');var config=require(_0xd0b7('0x8'));var attributes=require(_0xd0b7('0x9'));module['exports']=function(_0x5ba117,_0x2388bc){return _0x5ba117['define'](_0xd0b7('0xa'),attributes,{'tableName':_0xd0b7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 608011c..cc35a2e 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 _0x55bc=['debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','VtigerConfiguration,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x55bc,0xc8));var _0xc55b=function(_0x2bde88,_0xf8ef2d){_0x2bde88=_0x2bde88-0x0;var _0x61f8d1=_0x55bc[_0x2bde88];return _0x61f8d1;};'use strict';var _=require(_0xc55b('0x0'));var util=require(_0xc55b('0x1'));var moment=require(_0xc55b('0x2'));var BPromise=require(_0xc55b('0x3'));var rs=require(_0xc55b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc55b('0x5'));var logger=require(_0xc55b('0x6'))(_0xc55b('0x7'));var config=require('../../config/environment');var jayson=require(_0xc55b('0x8'));var client=jayson[_0xc55b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x324d82,_0x336003,_0x8ef206){return new BPromise(function(_0x585197,_0x20aa32){return client['request'](_0x324d82,_0x8ef206)['then'](function(_0x578fb3){logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x336003,'request\x20sent');logger[_0xc55b('0xa')](_0xc55b('0xb'),_0x336003,_0xc55b('0xc'),JSON[_0xc55b('0xd')](_0x578fb3));if(_0x578fb3['error']){if(_0x578fb3[_0xc55b('0xe')][_0xc55b('0xf')]===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x336003,_0x578fb3['error'][_0xc55b('0x10')]);return _0x20aa32(_0x578fb3[_0xc55b('0xe')][_0xc55b('0x10')]);}logger[_0xc55b('0xe')](_0xc55b('0x11'),_0x336003,_0x578fb3[_0xc55b('0xe')][_0xc55b('0x10')]);return _0x585197(_0x578fb3['error'][_0xc55b('0x10')]);}else{logger[_0xc55b('0x12')](_0xc55b('0x11'),_0x336003,_0xc55b('0xc'));_0x585197(_0x578fb3[_0xc55b('0x13')][_0xc55b('0x10')]);}})[_0xc55b('0x14')](function(_0x4b8587){logger[_0xc55b('0xe')](_0xc55b('0x11'),_0x336003,_0x4b8587);_0x20aa32(_0x4b8587);});});} \ No newline at end of file +var _0xe734=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3c513c,_0x421e4d){var _0x415530=function(_0x1af5ca){while(--_0x1af5ca){_0x3c513c['push'](_0x3c513c['shift']());}};_0x415530(++_0x421e4d);}(_0xe734,0x78));var _0x4e73=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0xe734[_0x40a825];return _0x273a54;};'use strict';var _=require('lodash');var util=require(_0x4e73('0x0'));var moment=require(_0x4e73('0x1'));var BPromise=require(_0x4e73('0x2'));var rs=require(_0x4e73('0x3'));var fs=require('fs');var Redis=require(_0x4e73('0x4'));var db=require(_0x4e73('0x5'))['db'];var utils=require(_0x4e73('0x6'));var logger=require(_0x4e73('0x7'))(_0x4e73('0x8'));var config=require(_0x4e73('0x9'));var jayson=require(_0x4e73('0xa'));var client=jayson['client'][_0x4e73('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1722d9,_0x29aead,_0x2c75b8){return new BPromise(function(_0x1aecba,_0x322b25){return client[_0x4e73('0xc')](_0x1722d9,_0x2c75b8)[_0x4e73('0xd')](function(_0x2f6aad){logger[_0x4e73('0xe')](_0x4e73('0xf'),_0x29aead,_0x4e73('0x10'));logger[_0x4e73('0x11')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x29aead,_0x4e73('0x10'),JSON['stringify'](_0x2f6aad));if(_0x2f6aad[_0x4e73('0x12')]){if(_0x2f6aad[_0x4e73('0x12')][_0x4e73('0x13')]===0x1f4){logger[_0x4e73('0x12')](_0x4e73('0xf'),_0x29aead,_0x2f6aad[_0x4e73('0x12')][_0x4e73('0x14')]);return _0x322b25(_0x2f6aad[_0x4e73('0x12')][_0x4e73('0x14')]);}logger[_0x4e73('0x12')](_0x4e73('0xf'),_0x29aead,_0x2f6aad['error'][_0x4e73('0x14')]);return _0x1aecba(_0x2f6aad[_0x4e73('0x12')][_0x4e73('0x14')]);}else{logger[_0x4e73('0xe')](_0x4e73('0xf'),_0x29aead,_0x4e73('0x10'));_0x1aecba(_0x2f6aad['result']['message']);}})['catch'](function(_0x4419d3){logger['error'](_0x4e73('0xf'),_0x29aead,_0x4419d3);_0x322b25(_0x4419d3);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index ca140d6..4e88fd6 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 _0x2311=['index','create','/:id','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated'];(function(_0x46bd99,_0x25c97d){var _0x51903b=function(_0x190f06){while(--_0x190f06){_0x46bd99['push'](_0x46bd99['shift']());}};_0x51903b(++_0x25c97d);}(_0x2311,0xb5));var _0x1231=function(_0xc362d5,_0x1edaad){_0xc362d5=_0xc362d5-0x0;var _0x32a542=_0x2311[_0xc362d5];return _0x32a542;};'use strict';var multer=require(_0x1231('0x0'));var util=require('util');var path=require(_0x1231('0x1'));var timeout=require(_0x1231('0x2'));var express=require(_0x1231('0x3'));var router=express['Router']();var fs_extra=require(_0x1231('0x4'));var auth=require(_0x1231('0x5'));var interaction=require(_0x1231('0x6'));var config=require(_0x1231('0x7'));var controller=require(_0x1231('0x8'));router[_0x1231('0x9')]('/',auth[_0x1231('0xa')](),controller[_0x1231('0xb')]);router['get']('/:id',auth[_0x1231('0xa')](),controller['show']);router['post']('/',auth[_0x1231('0xa')](),controller[_0x1231('0xc')]);router['put'](_0x1231('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x1231('0xe')]('/:id',auth[_0x1231('0xa')](),controller['destroy']);module[_0x1231('0xf')]=router; \ No newline at end of file +var _0x9c9c=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x583669,_0x1670c0){var _0x2d924c=function(_0x1dd339){while(--_0x1dd339){_0x583669['push'](_0x583669['shift']());}};_0x2d924c(++_0x1670c0);}(_0x9c9c,0x11b));var _0xc9c9=function(_0x529902,_0x1c9253){_0x529902=_0x529902-0x0;var _0x6f4be6=_0x9c9c[_0x529902];return _0x6f4be6;};'use strict';var multer=require('multer');var util=require(_0xc9c9('0x0'));var path=require(_0xc9c9('0x1'));var timeout=require(_0xc9c9('0x2'));var express=require(_0xc9c9('0x3'));var router=express[_0xc9c9('0x4')]();var fs_extra=require(_0xc9c9('0x5'));var auth=require(_0xc9c9('0x6'));var interaction=require(_0xc9c9('0x7'));var config=require(_0xc9c9('0x8'));var controller=require(_0xc9c9('0x9'));router['get']('/',auth[_0xc9c9('0xa')](),controller[_0xc9c9('0xb')]);router[_0xc9c9('0xc')](_0xc9c9('0xd'),auth['isAuthenticated'](),controller[_0xc9c9('0xe')]);router[_0xc9c9('0xf')]('/',auth['isAuthenticated'](),controller[_0xc9c9('0x10')]);router[_0xc9c9('0x11')]('/:id',auth[_0xc9c9('0xa')](),controller[_0xc9c9('0x12')]);router[_0xc9c9('0x13')](_0xc9c9('0xd'),auth[_0xc9c9('0xa')](),controller[_0xc9c9('0x14')]);module[_0xc9c9('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 3c61fd5..8c8e230 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 _0x6d18=['variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','picklist','STRING'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x6d18,0x16a));var _0x86d1=function(_0x2ed8f8,_0x2ebafd){_0x2ed8f8=_0x2ed8f8-0x0;var _0x20e341=_0x6d18[_0x2ed8f8];return _0x20e341;};'use strict';var Sequelize=require(_0x86d1('0x0'));module[_0x86d1('0x1')]={'type':{'type':Sequelize[_0x86d1('0x2')](_0x86d1('0x3'),'variable',_0x86d1('0x4'),_0x86d1('0x5'),_0x86d1('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x86d1('0x7')]},'key':{'type':Sequelize[_0x86d1('0x7')]},'keyType':{'type':Sequelize[_0x86d1('0x2')](_0x86d1('0x3'),_0x86d1('0x8'),_0x86d1('0x4'))},'keyContent':{'type':Sequelize[_0x86d1('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x86d1('0x7')]},'customField':{'type':Sequelize[_0x86d1('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x86d1('0x7')]}}; \ No newline at end of file +var _0x3eef=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x504df1,_0x289598){var _0x1063b5=function(_0x627abd){while(--_0x627abd){_0x504df1['push'](_0x504df1['shift']());}};_0x1063b5(++_0x289598);}(_0x3eef,0xbb));var _0xf3ee=function(_0x41b0f4,_0x48ca5f){_0x41b0f4=_0x41b0f4-0x0;var _0x58e944=_0x3eef[_0x41b0f4];return _0x58e944;};'use strict';var Sequelize=require(_0xf3ee('0x0'));module[_0xf3ee('0x1')]={'type':{'type':Sequelize[_0xf3ee('0x2')](_0xf3ee('0x3'),_0xf3ee('0x4'),_0xf3ee('0x5'),_0xf3ee('0x6'),_0xf3ee('0x7')),'defaultValue':_0xf3ee('0x3')},'content':{'type':Sequelize[_0xf3ee('0x8')]},'key':{'type':Sequelize[_0xf3ee('0x8')]},'keyType':{'type':Sequelize[_0xf3ee('0x2')](_0xf3ee('0x3'),_0xf3ee('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xf3ee('0x8')]},'idField':{'type':Sequelize[_0xf3ee('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xf3ee('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf3ee('0x8')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index a62c6fb..2d5b48a 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 _0x7d04=['findAll','rows','catch','show','params','find','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','type','key','model','keys','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','options','where','includeAll','include'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7d04,0x9d));var _0x47d0=function(_0x4021c0,_0x5439c5){_0x4021c0=_0x4021c0-0x0;var _0x4f162a=_0x7d04[_0x4021c0];return _0x4f162a;};'use strict';var emlformat=require(_0x47d0('0x0'));var rimraf=require(_0x47d0('0x1'));var zipdir=require(_0x47d0('0x2'));var jsonpatch=require(_0x47d0('0x3'));var rp=require(_0x47d0('0x4'));var moment=require(_0x47d0('0x5'));var BPromise=require(_0x47d0('0x6'));var Mustache=require('mustache');var util=require(_0x47d0('0x7'));var path=require(_0x47d0('0x8'));var sox=require('sox');var csv=require(_0x47d0('0x9'));var ejs=require(_0x47d0('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x47d0('0xb'));var squel=require(_0x47d0('0xc'));var crypto=require(_0x47d0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x47d0('0xe'));var toCsv=require(_0x47d0('0x9'));var querystring=require(_0x47d0('0xf'));var Papa=require('papaparse');var Redis=require(_0x47d0('0x10'));var authService=require(_0x47d0('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x47d0('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x47d0('0x13'));var config=require(_0x47d0('0x14'));var licenseUtil=require(_0x47d0('0x15'));var db=require(_0x47d0('0x16'))['db'];function respondWithStatusCode(_0x1af350,_0xb1c4ba){_0xb1c4ba=_0xb1c4ba||0xcc;return function(_0x256667){if(_0x256667){return _0x1af350[_0x47d0('0x17')](_0xb1c4ba);}return _0x1af350['status'](_0xb1c4ba)['end']();};}function respondWithResult(_0x40a7b9,_0x239942){_0x239942=_0x239942||0xc8;return function(_0xf45827){if(_0xf45827){return _0x40a7b9[_0x47d0('0x18')](_0x239942)[_0x47d0('0x19')](_0xf45827);}};}function respondWithFilteredResult(_0xb727e6,_0x2af864){return function(_0x103dd7){if(_0x103dd7){var _0x5b49ac=typeof _0x2af864[_0x47d0('0x1a')]===_0x47d0('0x1b')&&typeof _0x2af864[_0x47d0('0x1c')]===_0x47d0('0x1b');var _0x4e5db6=_0x103dd7['count'];var _0xf8c72d=_0x5b49ac?0x0:_0x2af864['offset'];var _0x51f722=_0x5b49ac?_0x103dd7[_0x47d0('0x1d')]:_0x2af864[_0x47d0('0x1a')]+_0x2af864[_0x47d0('0x1c')];var _0x5602ff;if(_0x51f722>=_0x4e5db6){_0x51f722=_0x4e5db6;_0x5602ff=0xc8;}else{_0x5602ff=0xce;}_0xb727e6[_0x47d0('0x18')](_0x5602ff);return _0xb727e6[_0x47d0('0x1e')](_0x47d0('0x1f'),_0xf8c72d+'-'+_0x51f722+'/'+_0x4e5db6)[_0x47d0('0x19')](_0x103dd7);}return null;};}function patchUpdates(_0x3afbf6){return function(_0x3e676d){try{jsonpatch[_0x47d0('0x20')](_0x3e676d,_0x3afbf6,!![]);}catch(_0x1f6076){return BPromise[_0x47d0('0x21')](_0x1f6076);}return _0x3e676d[_0x47d0('0x22')]();};}function saveUpdates(_0x321024,_0x31c9c3){return function(_0x431a38){if(_0x431a38){return _0x431a38[_0x47d0('0x23')](_0x321024)[_0x47d0('0x24')](function(_0x14536e){return _0x14536e;});}return null;};}function removeEntity(_0x42682e,_0x3db72c){return function(_0x3a2636){if(_0x3a2636){return _0x3a2636[_0x47d0('0x25')]()[_0x47d0('0x24')](function(){_0x42682e[_0x47d0('0x18')](0xcc)[_0x47d0('0x26')]();});}};}function handleEntityNotFound(_0x354921,_0x58eaf7){return function(_0x33404a){if(!_0x33404a){_0x354921[_0x47d0('0x17')](0x194);}return _0x33404a;};}function handleError(_0x3748d4,_0x5e6220){_0x5e6220=_0x5e6220||0x1f4;return function(_0x212d6c){logger[_0x47d0('0x27')](_0x212d6c[_0x47d0('0x28')]);if(_0x212d6c[_0x47d0('0x29')]){delete _0x212d6c['name'];}_0x3748d4['status'](_0x5e6220)[_0x47d0('0x2a')](_0x212d6c);};}exports[_0x47d0('0x2b')]=function(_0x5e5b0b,_0x1edd7d){var _0x50fba1={},_0x82377b={},_0x20e2f4={'count':0x0,'rows':[]};var _0x7deb3=_[_0x47d0('0x2c')](db[_0x47d0('0x2d')][_0x47d0('0x2e')],function(_0xf8e287){return{'name':_0xf8e287[_0x47d0('0x2f')],'type':_0xf8e287[_0x47d0('0x30')][_0x47d0('0x31')]};});_0x82377b[_0x47d0('0x32')]=_[_0x47d0('0x2c')](_0x7deb3,'name');_0x82377b['query']=_[_0x47d0('0x33')](_0x5e5b0b['query']);_0x82377b['filters']=_[_0x47d0('0x34')](_0x82377b[_0x47d0('0x32')],_0x82377b[_0x47d0('0x35')]);_0x50fba1['attributes']=_['intersection'](_0x82377b[_0x47d0('0x32')],qs[_0x47d0('0x36')](_0x5e5b0b[_0x47d0('0x35')]['fields']));_0x50fba1[_0x47d0('0x37')]=_0x50fba1['attributes'][_0x47d0('0x38')]?_0x50fba1[_0x47d0('0x37')]:_0x82377b[_0x47d0('0x32')];if(!_0x5e5b0b['query'][_0x47d0('0x39')](_0x47d0('0x3a'))){_0x50fba1['limit']=qs[_0x47d0('0x1c')](_0x5e5b0b[_0x47d0('0x35')][_0x47d0('0x1c')]);_0x50fba1[_0x47d0('0x1a')]=qs[_0x47d0('0x1a')](_0x5e5b0b[_0x47d0('0x35')][_0x47d0('0x1a')]);}_0x50fba1[_0x47d0('0x3b')]=qs[_0x47d0('0x3c')](_0x5e5b0b['query'][_0x47d0('0x3c')]);_0x50fba1['where']=qs['filters'](_['pick'](_0x5e5b0b[_0x47d0('0x35')],_0x82377b[_0x47d0('0x3d')]),_0x7deb3);if(_0x5e5b0b[_0x47d0('0x35')][_0x47d0('0x3e')]){_0x50fba1['where']=_[_0x47d0('0x3f')](_0x50fba1['where'],{'$or':_['map'](_0x7deb3,function(_0x26583a){if(_0x26583a[_0x47d0('0x30')]!=='VIRTUAL'){var _0x2302f1={};_0x2302f1[_0x26583a[_0x47d0('0x29')]]={'$like':'%'+_0x5e5b0b['query'][_0x47d0('0x3e')]+'%'};return _0x2302f1;}})});}_0x50fba1=_['merge']({},_0x50fba1,_0x5e5b0b[_0x47d0('0x40')]);var _0x3e3d08={'where':_0x50fba1[_0x47d0('0x41')]};return db['VtigerField'][_0x47d0('0x1d')](_0x3e3d08)[_0x47d0('0x24')](function(_0x4870ba){_0x20e2f4[_0x47d0('0x1d')]=_0x4870ba;if(_0x5e5b0b['query'][_0x47d0('0x42')]){_0x50fba1[_0x47d0('0x43')]=[{'all':!![]}];}return db['VtigerField'][_0x47d0('0x44')](_0x50fba1);})['then'](function(_0x3f6601){_0x20e2f4[_0x47d0('0x45')]=_0x3f6601;return _0x20e2f4;})[_0x47d0('0x24')](respondWithFilteredResult(_0x1edd7d,_0x50fba1))[_0x47d0('0x46')](handleError(_0x1edd7d,null));};exports[_0x47d0('0x47')]=function(_0x3978c8,_0x5556e2){var _0x38b9bb={'raw':!![],'where':{'id':_0x3978c8[_0x47d0('0x48')]['id']}},_0x2431a2={};_0x2431a2[_0x47d0('0x32')]=_['keys'](db[_0x47d0('0x2d')][_0x47d0('0x2e')]);_0x2431a2[_0x47d0('0x35')]=_[_0x47d0('0x33')](_0x3978c8[_0x47d0('0x35')]);_0x2431a2[_0x47d0('0x3d')]=_[_0x47d0('0x34')](_0x2431a2[_0x47d0('0x32')],_0x2431a2[_0x47d0('0x35')]);_0x38b9bb['attributes']=_[_0x47d0('0x34')](_0x2431a2['model'],qs[_0x47d0('0x36')](_0x3978c8[_0x47d0('0x35')][_0x47d0('0x36')]));_0x38b9bb[_0x47d0('0x37')]=_0x38b9bb[_0x47d0('0x37')][_0x47d0('0x38')]?_0x38b9bb[_0x47d0('0x37')]:_0x2431a2['model'];if(_0x3978c8[_0x47d0('0x35')][_0x47d0('0x42')]){_0x38b9bb[_0x47d0('0x43')]=[{'all':!![]}];}_0x38b9bb=_['merge']({},_0x38b9bb,_0x3978c8[_0x47d0('0x40')]);return db['VtigerField'][_0x47d0('0x49')](_0x38b9bb)['then'](handleEntityNotFound(_0x5556e2,null))[_0x47d0('0x24')](respondWithResult(_0x5556e2,null))[_0x47d0('0x46')](handleError(_0x5556e2,null));};exports['create']=function(_0x2fbd26,_0x2f49e9){return db[_0x47d0('0x2d')]['create'](_0x2fbd26[_0x47d0('0x4a')],{})[_0x47d0('0x24')](respondWithResult(_0x2f49e9,0xc9))[_0x47d0('0x46')](handleError(_0x2f49e9,null));};exports[_0x47d0('0x23')]=function(_0x58204a,_0x19f55e){if(_0x58204a[_0x47d0('0x4a')]['id']){delete _0x58204a['body']['id'];}return db[_0x47d0('0x2d')][_0x47d0('0x49')]({'where':{'id':_0x58204a[_0x47d0('0x48')]['id']}})[_0x47d0('0x24')](handleEntityNotFound(_0x19f55e,null))['then'](saveUpdates(_0x58204a[_0x47d0('0x4a')],null))[_0x47d0('0x24')](respondWithResult(_0x19f55e,null))[_0x47d0('0x46')](handleError(_0x19f55e,null));};exports[_0x47d0('0x25')]=function(_0x41977e,_0x20d9bd){return db[_0x47d0('0x2d')][_0x47d0('0x49')]({'where':{'id':_0x41977e[_0x47d0('0x48')]['id']}})[_0x47d0('0x24')](handleEntityNotFound(_0x20d9bd,null))[_0x47d0('0x24')](removeEntity(_0x20d9bd,null))['catch'](handleError(_0x20d9bd,null));}; \ No newline at end of file +var _0x15c3=['util','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','update','then','destroy','stack','name','send','index','map','VtigerField','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','rimraf','zip-dir','fast-json-patch','bluebird'];(function(_0x367c8e,_0x3a6502){var _0x1c2789=function(_0x908461){while(--_0x908461){_0x367c8e['push'](_0x367c8e['shift']());}};_0x1c2789(++_0x3a6502);}(_0x15c3,0xd1));var _0x315c=function(_0x400374,_0x57b486){_0x400374=_0x400374-0x0;var _0x187397=_0x15c3[_0x400374];return _0x187397;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x315c('0x0'));var zipdir=require(_0x315c('0x1'));var jsonpatch=require(_0x315c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x315c('0x3'));var Mustache=require('mustache');var util=require(_0x315c('0x4'));var path=require(_0x315c('0x5'));var sox=require(_0x315c('0x6'));var csv=require('to-csv');var ejs=require(_0x315c('0x7'));var fs=require('fs');var fs_extra=require(_0x315c('0x8'));var _=require('lodash');var squel=require(_0x315c('0x9'));var crypto=require(_0x315c('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x315c('0xb'));var toCsv=require(_0x315c('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x315c('0xd'));var authService=require(_0x315c('0xe'));var qs=require(_0x315c('0xf'));var as=require(_0x315c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x315c('0x11'))(_0x315c('0x12'));var utils=require(_0x315c('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x315c('0x14'));var db=require(_0x315c('0x15'))['db'];function respondWithStatusCode(_0x2a5ce7,_0x9b9082){_0x9b9082=_0x9b9082||0xcc;return function(_0x1aca04){if(_0x1aca04){return _0x2a5ce7[_0x315c('0x16')](_0x9b9082);}return _0x2a5ce7[_0x315c('0x17')](_0x9b9082)[_0x315c('0x18')]();};}function respondWithResult(_0x3d3f00,_0x5b0035){_0x5b0035=_0x5b0035||0xc8;return function(_0x47539e){if(_0x47539e){return _0x3d3f00[_0x315c('0x17')](_0x5b0035)[_0x315c('0x19')](_0x47539e);}};}function respondWithFilteredResult(_0x3407f4,_0x4fece7){return function(_0x399c1b){if(_0x399c1b){var _0x3da817=typeof _0x4fece7[_0x315c('0x1a')]===_0x315c('0x1b')&&typeof _0x4fece7['limit']===_0x315c('0x1b');var _0x1d8756=_0x399c1b[_0x315c('0x1c')];var _0x54235f=_0x3da817?0x0:_0x4fece7['offset'];var _0x5c4522=_0x3da817?_0x399c1b[_0x315c('0x1c')]:_0x4fece7['offset']+_0x4fece7[_0x315c('0x1d')];var _0x35560f;if(_0x5c4522>=_0x1d8756){_0x5c4522=_0x1d8756;_0x35560f=0xc8;}else{_0x35560f=0xce;}_0x3407f4[_0x315c('0x17')](_0x35560f);return _0x3407f4[_0x315c('0x1e')]('Content-Range',_0x54235f+'-'+_0x5c4522+'/'+_0x1d8756)['json'](_0x399c1b);}return null;};}function patchUpdates(_0x15a27d){return function(_0x3da682){try{jsonpatch['apply'](_0x3da682,_0x15a27d,!![]);}catch(_0x20fbb0){return BPromise[_0x315c('0x1f')](_0x20fbb0);}return _0x3da682['save']();};}function saveUpdates(_0x1d2931,_0x3457e9){return function(_0x1e03d6){if(_0x1e03d6){return _0x1e03d6[_0x315c('0x20')](_0x1d2931)[_0x315c('0x21')](function(_0x20bb11){return _0x20bb11;});}return null;};}function removeEntity(_0x1e2d79,_0x1a0c68){return function(_0x52e5bf){if(_0x52e5bf){return _0x52e5bf[_0x315c('0x22')]()[_0x315c('0x21')](function(){_0x1e2d79[_0x315c('0x17')](0xcc)[_0x315c('0x18')]();});}};}function handleEntityNotFound(_0x4c6b47,_0xd0570){return function(_0x53084a){if(!_0x53084a){_0x4c6b47[_0x315c('0x16')](0x194);}return _0x53084a;};}function handleError(_0x5ae35c,_0x57bf5b){_0x57bf5b=_0x57bf5b||0x1f4;return function(_0x185a55){logger['error'](_0x185a55[_0x315c('0x23')]);if(_0x185a55[_0x315c('0x24')]){delete _0x185a55[_0x315c('0x24')];}_0x5ae35c[_0x315c('0x17')](_0x57bf5b)[_0x315c('0x25')](_0x185a55);};}exports[_0x315c('0x26')]=function(_0x3c7081,_0x5372e2){var _0xece99f={},_0xcbe56b={},_0x46e40f={'count':0x0,'rows':[]};var _0x27dba5=_[_0x315c('0x27')](db[_0x315c('0x28')][_0x315c('0x29')],function(_0x1546ec){return{'name':_0x1546ec['fieldName'],'type':_0x1546ec[_0x315c('0x2a')][_0x315c('0x2b')]};});_0xcbe56b[_0x315c('0x2c')]=_['map'](_0x27dba5,'name');_0xcbe56b[_0x315c('0x2d')]=_['keys'](_0x3c7081[_0x315c('0x2d')]);_0xcbe56b[_0x315c('0x2e')]=_[_0x315c('0x2f')](_0xcbe56b[_0x315c('0x2c')],_0xcbe56b[_0x315c('0x2d')]);_0xece99f[_0x315c('0x30')]=_[_0x315c('0x2f')](_0xcbe56b[_0x315c('0x2c')],qs[_0x315c('0x31')](_0x3c7081[_0x315c('0x2d')][_0x315c('0x31')]));_0xece99f[_0x315c('0x30')]=_0xece99f['attributes'][_0x315c('0x32')]?_0xece99f[_0x315c('0x30')]:_0xcbe56b['model'];if(!_0x3c7081[_0x315c('0x2d')][_0x315c('0x33')](_0x315c('0x34'))){_0xece99f[_0x315c('0x1d')]=qs[_0x315c('0x1d')](_0x3c7081[_0x315c('0x2d')][_0x315c('0x1d')]);_0xece99f[_0x315c('0x1a')]=qs['offset'](_0x3c7081[_0x315c('0x2d')][_0x315c('0x1a')]);}_0xece99f[_0x315c('0x35')]=qs[_0x315c('0x36')](_0x3c7081[_0x315c('0x2d')][_0x315c('0x36')]);_0xece99f[_0x315c('0x37')]=qs[_0x315c('0x2e')](_[_0x315c('0x38')](_0x3c7081['query'],_0xcbe56b[_0x315c('0x2e')]),_0x27dba5);if(_0x3c7081[_0x315c('0x2d')][_0x315c('0x39')]){_0xece99f[_0x315c('0x37')]=_[_0x315c('0x3a')](_0xece99f[_0x315c('0x37')],{'$or':_['map'](_0x27dba5,function(_0x3fd586){if(_0x3fd586[_0x315c('0x2a')]!==_0x315c('0x3b')){var _0x3ba0e3={};_0x3ba0e3[_0x3fd586[_0x315c('0x24')]]={'$like':'%'+_0x3c7081['query']['filter']+'%'};return _0x3ba0e3;}})});}_0xece99f=_[_0x315c('0x3a')]({},_0xece99f,_0x3c7081[_0x315c('0x3c')]);var _0x1d93c3={'where':_0xece99f[_0x315c('0x37')]};return db[_0x315c('0x28')][_0x315c('0x1c')](_0x1d93c3)['then'](function(_0x173ecf){_0x46e40f[_0x315c('0x1c')]=_0x173ecf;if(_0x3c7081['query'][_0x315c('0x3d')]){_0xece99f[_0x315c('0x3e')]=[{'all':!![]}];}return db[_0x315c('0x28')][_0x315c('0x3f')](_0xece99f);})['then'](function(_0x3af458){_0x46e40f['rows']=_0x3af458;return _0x46e40f;})[_0x315c('0x21')](respondWithFilteredResult(_0x5372e2,_0xece99f))[_0x315c('0x40')](handleError(_0x5372e2,null));};exports[_0x315c('0x41')]=function(_0x5b7617,_0xad27af){var _0x1a7590={'raw':!![],'where':{'id':_0x5b7617[_0x315c('0x42')]['id']}},_0x2dea3f={};_0x2dea3f['model']=_[_0x315c('0x43')](db[_0x315c('0x28')][_0x315c('0x29')]);_0x2dea3f['query']=_[_0x315c('0x43')](_0x5b7617[_0x315c('0x2d')]);_0x2dea3f['filters']=_['intersection'](_0x2dea3f[_0x315c('0x2c')],_0x2dea3f[_0x315c('0x2d')]);_0x1a7590[_0x315c('0x30')]=_[_0x315c('0x2f')](_0x2dea3f[_0x315c('0x2c')],qs[_0x315c('0x31')](_0x5b7617[_0x315c('0x2d')][_0x315c('0x31')]));_0x1a7590[_0x315c('0x30')]=_0x1a7590[_0x315c('0x30')][_0x315c('0x32')]?_0x1a7590[_0x315c('0x30')]:_0x2dea3f[_0x315c('0x2c')];if(_0x5b7617[_0x315c('0x2d')][_0x315c('0x3d')]){_0x1a7590[_0x315c('0x3e')]=[{'all':!![]}];}_0x1a7590=_[_0x315c('0x3a')]({},_0x1a7590,_0x5b7617[_0x315c('0x3c')]);return db[_0x315c('0x28')][_0x315c('0x44')](_0x1a7590)[_0x315c('0x21')](handleEntityNotFound(_0xad27af,null))[_0x315c('0x21')](respondWithResult(_0xad27af,null))['catch'](handleError(_0xad27af,null));};exports[_0x315c('0x45')]=function(_0x18f701,_0x3b3ddd){return db[_0x315c('0x28')][_0x315c('0x45')](_0x18f701[_0x315c('0x46')],{})[_0x315c('0x21')](respondWithResult(_0x3b3ddd,0xc9))[_0x315c('0x40')](handleError(_0x3b3ddd,null));};exports[_0x315c('0x20')]=function(_0x1b19ee,_0x549612){if(_0x1b19ee[_0x315c('0x46')]['id']){delete _0x1b19ee['body']['id'];}return db[_0x315c('0x28')]['find']({'where':{'id':_0x1b19ee['params']['id']}})[_0x315c('0x21')](handleEntityNotFound(_0x549612,null))['then'](saveUpdates(_0x1b19ee[_0x315c('0x46')],null))[_0x315c('0x21')](respondWithResult(_0x549612,null))[_0x315c('0x40')](handleError(_0x549612,null));};exports['destroy']=function(_0x9a6149,_0x1e9432){return db[_0x315c('0x28')][_0x315c('0x44')]({'where':{'id':_0x9a6149[_0x315c('0x42')]['id']}})[_0x315c('0x21')](handleEntityNotFound(_0x1e9432,null))[_0x315c('0x21')](removeEntity(_0x1e9432,null))[_0x315c('0x40')](handleError(_0x1e9432,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 707d63f..4a914c5 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 _0x4521=['VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','../../config/logger','api','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','define'];(function(_0x16161d,_0x470bed){var _0xb7f451=function(_0x122ec){while(--_0x122ec){_0x16161d['push'](_0x16161d['shift']());}};_0xb7f451(++_0x470bed);}(_0x4521,0x101));var _0x1452=function(_0x2b8d39,_0x23d1d2){_0x2b8d39=_0x2b8d39-0x0;var _0x37c777=_0x4521[_0x2b8d39];return _0x37c777;};'use strict';var _=require(_0x1452('0x0'));var util=require('util');var logger=require(_0x1452('0x1'))(_0x1452('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1452('0x3'));var rimraf=require(_0x1452('0x4'));var config=require(_0x1452('0x5'));var attributes=require(_0x1452('0x6'));module[_0x1452('0x7')]=function(_0x1e8c30,_0x4df726){return _0x1e8c30[_0x1452('0x8')](_0x1452('0x9'),attributes,{'tableName':_0x1452('0xa'),'paranoid':![],'indexes':[{'name':_0x1452('0xb'),'fields':[_0x1452('0xc'),_0x1452('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0e26=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x0e26,0x198));var _0x60e2=function(_0x34c94c,_0x56a5b8){_0x34c94c=_0x34c94c-0x0;var _0xf04b4d=_0x0e26[_0x34c94c];return _0xf04b4d;};'use strict';var _=require(_0x60e2('0x0'));var util=require(_0x60e2('0x1'));var logger=require(_0x60e2('0x2'))(_0x60e2('0x3'));var moment=require(_0x60e2('0x4'));var BPromise=require(_0x60e2('0x5'));var rp=require(_0x60e2('0x6'));var fs=require('fs');var path=require(_0x60e2('0x7'));var rimraf=require(_0x60e2('0x8'));var config=require(_0x60e2('0x9'));var attributes=require(_0x60e2('0xa'));module[_0x60e2('0xb')]=function(_0x275bb1,_0x4e35f7){return _0x275bb1['define'](_0x60e2('0xc'),attributes,{'tableName':_0x60e2('0xd'),'paranoid':![],'indexes':[{'name':_0x60e2('0xe'),'fields':[_0x60e2('0xf'),_0x60e2('0x10')],'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 8d9a5ad..5e4dc41 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 _0xf518=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment'];(function(_0x3c0edc,_0x4ba422){var _0x1fa59d=function(_0x5aadf6){while(--_0x5aadf6){_0x3c0edc['push'](_0x3c0edc['shift']());}};_0x1fa59d(++_0x4ba422);}(_0xf518,0x11b));var _0x8f51=function(_0x16b1a5,_0x318267){_0x16b1a5=_0x16b1a5-0x0;var _0x475e25=_0xf518[_0x16b1a5];return _0x475e25;};'use strict';var _=require(_0x8f51('0x0'));var util=require(_0x8f51('0x1'));var moment=require(_0x8f51('0x2'));var BPromise=require(_0x8f51('0x3'));var rs=require(_0x8f51('0x4'));var fs=require('fs');var Redis=require(_0x8f51('0x5'));var db=require(_0x8f51('0x6'))['db'];var utils=require(_0x8f51('0x7'));var logger=require(_0x8f51('0x8'))(_0x8f51('0x9'));var config=require(_0x8f51('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x8f51('0xb')][_0x8f51('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4be23e,_0x2dee33,_0x181ac7){return new BPromise(function(_0x2f3d66,_0x1b7c04){return client[_0x8f51('0xd')](_0x4be23e,_0x181ac7)[_0x8f51('0xe')](function(_0x460499){logger['info'](_0x8f51('0xf'),_0x2dee33,'request\x20sent');logger[_0x8f51('0x10')](_0x8f51('0x11'),_0x2dee33,_0x8f51('0x12'),JSON[_0x8f51('0x13')](_0x460499));if(_0x460499[_0x8f51('0x14')]){if(_0x460499[_0x8f51('0x14')][_0x8f51('0x15')]===0x1f4){logger[_0x8f51('0x14')]('VtigerField,\x20%s,\x20%s',_0x2dee33,_0x460499[_0x8f51('0x14')][_0x8f51('0x16')]);return _0x1b7c04(_0x460499['error'][_0x8f51('0x16')]);}logger['error']('VtigerField,\x20%s,\x20%s',_0x2dee33,_0x460499[_0x8f51('0x14')][_0x8f51('0x16')]);return _0x2f3d66(_0x460499['error'][_0x8f51('0x16')]);}else{logger[_0x8f51('0x17')](_0x8f51('0xf'),_0x2dee33,_0x8f51('0x12'));_0x2f3d66(_0x460499[_0x8f51('0x18')][_0x8f51('0x16')]);}})[_0x8f51('0x19')](function(_0x252a79){logger[_0x8f51('0x14')](_0x8f51('0xf'),_0x2dee33,_0x252a79);_0x1b7c04(_0x252a79);});});} \ No newline at end of file +var _0x5db6=['VtigerField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x53da0e,_0x2c4eb0){var _0x3a6ae7=function(_0xbcafb3){while(--_0xbcafb3){_0x53da0e['push'](_0x53da0e['shift']());}};_0x3a6ae7(++_0x2c4eb0);}(_0x5db6,0x1ed));var _0x65db=function(_0x4af0a7,_0x49afdd){_0x4af0a7=_0x4af0a7-0x0;var _0x2d7cc9=_0x5db6[_0x4af0a7];return _0x2d7cc9;};'use strict';var _=require('lodash');var util=require(_0x65db('0x0'));var moment=require(_0x65db('0x1'));var BPromise=require(_0x65db('0x2'));var rs=require(_0x65db('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x65db('0x4'))['db'];var utils=require(_0x65db('0x5'));var logger=require('../../config/logger')(_0x65db('0x6'));var config=require(_0x65db('0x7'));var jayson=require(_0x65db('0x8'));var client=jayson[_0x65db('0x9')][_0x65db('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6a5b17,_0x11799c,_0x5d31df){return new BPromise(function(_0x3da21c,_0x55710d){return client['request'](_0x6a5b17,_0x5d31df)[_0x65db('0xb')](function(_0x35f975){logger[_0x65db('0xc')](_0x65db('0xd'),_0x11799c,_0x65db('0xe'));logger[_0x65db('0xf')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x11799c,_0x65db('0xe'),JSON[_0x65db('0x10')](_0x35f975));if(_0x35f975['error']){if(_0x35f975[_0x65db('0x11')][_0x65db('0x12')]===0x1f4){logger['error'](_0x65db('0xd'),_0x11799c,_0x35f975[_0x65db('0x11')][_0x65db('0x13')]);return _0x55710d(_0x35f975['error'][_0x65db('0x13')]);}logger['error'](_0x65db('0xd'),_0x11799c,_0x35f975['error'][_0x65db('0x13')]);return _0x3da21c(_0x35f975[_0x65db('0x11')][_0x65db('0x13')]);}else{logger[_0x65db('0xc')](_0x65db('0xd'),_0x11799c,_0x65db('0xe'));_0x3da21c(_0x35f975[_0x65db('0x14')]['message']);}})[_0x65db('0x15')](function(_0x25740f){logger[_0x65db('0x11')](_0x65db('0xd'),_0x11799c,_0x25740f);_0x55710d(_0x25740f);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 43db5b5..91b28ea 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 _0x9dc9=['exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','show','getConfigurations','/:id/fields','create','post','addConfiguration','put','/:id','update','delete','destroy'];(function(_0x460fd7,_0x2012db){var _0x44d1c2=function(_0x545e11){while(--_0x545e11){_0x460fd7['push'](_0x460fd7['shift']());}};_0x44d1c2(++_0x2012db);}(_0x9dc9,0x121));var _0x99dc=function(_0x5ed8f1,_0x21ee5e){_0x5ed8f1=_0x5ed8f1-0x0;var _0x2aedd6=_0x9dc9[_0x5ed8f1];return _0x2aedd6;};'use strict';var multer=require(_0x99dc('0x0'));var util=require(_0x99dc('0x1'));var path=require(_0x99dc('0x2'));var timeout=require(_0x99dc('0x3'));var express=require(_0x99dc('0x4'));var router=express[_0x99dc('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x99dc('0x6'));var config=require(_0x99dc('0x7'));var controller=require(_0x99dc('0x8'));router[_0x99dc('0x9')]('/',auth[_0x99dc('0xa')](),controller[_0x99dc('0xb')]);router['get']('/:id',auth[_0x99dc('0xa')](),controller[_0x99dc('0xc')]);router[_0x99dc('0x9')]('/:id/configurations',auth[_0x99dc('0xa')](),controller[_0x99dc('0xd')]);router[_0x99dc('0x9')](_0x99dc('0xe'),auth[_0x99dc('0xa')](),controller['getFields']);router['post']('/',auth[_0x99dc('0xa')](),controller[_0x99dc('0xf')]);router[_0x99dc('0x10')]('/:id/configurations',auth[_0x99dc('0xa')](),controller[_0x99dc('0x11')]);router[_0x99dc('0x12')](_0x99dc('0x13'),auth[_0x99dc('0xa')](),controller[_0x99dc('0x14')]);router[_0x99dc('0x15')](_0x99dc('0x13'),auth['isAuthenticated'](),controller[_0x99dc('0x16')]);module[_0x99dc('0x17')]=router; \ No newline at end of file +var _0x2b48=['multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','index','get','isAuthenticated','show','/:id/configurations','/:id/fields','post','create','addConfiguration','/:id','update','delete','destroy','exports'];(function(_0x49fc1a,_0x1a9f49){var _0x248191=function(_0x2b808b){while(--_0x2b808b){_0x49fc1a['push'](_0x49fc1a['shift']());}};_0x248191(++_0x1a9f49);}(_0x2b48,0xe6));var _0x82b4=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x2b48[_0x4e676e];return _0x336a3c;};'use strict';var multer=require(_0x82b4('0x0'));var util=require(_0x82b4('0x1'));var path=require('path');var timeout=require(_0x82b4('0x2'));var express=require(_0x82b4('0x3'));var router=express['Router']();var fs_extra=require(_0x82b4('0x4'));var auth=require(_0x82b4('0x5'));var interaction=require(_0x82b4('0x6'));var config=require(_0x82b4('0x7'));var controller=require(_0x82b4('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x82b4('0x9')]);router[_0x82b4('0xa')]('/:id',auth[_0x82b4('0xb')](),controller[_0x82b4('0xc')]);router[_0x82b4('0xa')](_0x82b4('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x82b4('0xa')](_0x82b4('0xe'),auth[_0x82b4('0xb')](),controller['getFields']);router[_0x82b4('0xf')]('/',auth[_0x82b4('0xb')](),controller[_0x82b4('0x10')]);router[_0x82b4('0xf')](_0x82b4('0xd'),auth[_0x82b4('0xb')](),controller[_0x82b4('0x11')]);router['put'](_0x82b4('0x12'),auth[_0x82b4('0xb')](),controller[_0x82b4('0x13')]);router[_0x82b4('0x14')](_0x82b4('0x12'),auth['isAuthenticated'](),controller[_0x82b4('0x15')]);module[_0x82b4('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 89471a4..c5621f0 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 _0xee87=['remoteUri','ENUM','token','integrationTab','newTab','exports','STRING','username'];(function(_0x80fdc8,_0x3f7a30){var _0x9105c6=function(_0xd21e41){while(--_0xd21e41){_0x80fdc8['push'](_0x80fdc8['shift']());}};_0x9105c6(++_0x3f7a30);}(_0xee87,0x10d));var _0x7ee8=function(_0x921a75,_0x3fb631){_0x921a75=_0x921a75-0x0;var _0x40697f=_0xee87[_0x921a75];return _0x40697f;};'use strict';var Sequelize=require('sequelize');module[_0x7ee8('0x0')]={'name':{'type':Sequelize[_0x7ee8('0x1')]},'description':{'type':Sequelize[_0x7ee8('0x1')]},'username':{'type':Sequelize[_0x7ee8('0x1')],'unique':_0x7ee8('0x2')},'password':{'type':Sequelize[_0x7ee8('0x1')]},'token':{'type':Sequelize[_0x7ee8('0x1')]},'remoteUri':{'type':Sequelize[_0x7ee8('0x1')],'unique':_0x7ee8('0x3')},'authType':{'type':Sequelize[_0x7ee8('0x4')]('password',_0x7ee8('0x5')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x7ee8('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x7ee8('0x4')](_0x7ee8('0x6'),_0x7ee8('0x7')),'defaultValue':_0x7ee8('0x6')}}; \ No newline at end of file +var _0x4fb4=['password','token','newTab','integrationTab','exports','STRING','username','remoteUri','ENUM'];(function(_0x54e6f5,_0x4f4e99){var _0x5e8794=function(_0x27512b){while(--_0x27512b){_0x54e6f5['push'](_0x54e6f5['shift']());}};_0x5e8794(++_0x4f4e99);}(_0x4fb4,0x190));var _0x44fb=function(_0x34fb16,_0x23ef77){_0x34fb16=_0x34fb16-0x0;var _0x18b8fd=_0x4fb4[_0x34fb16];return _0x18b8fd;};'use strict';var Sequelize=require('sequelize');module[_0x44fb('0x0')]={'name':{'type':Sequelize[_0x44fb('0x1')]},'description':{'type':Sequelize[_0x44fb('0x1')]},'username':{'type':Sequelize[_0x44fb('0x1')],'unique':_0x44fb('0x2')},'password':{'type':Sequelize[_0x44fb('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x44fb('0x1')],'unique':_0x44fb('0x3')},'authType':{'type':Sequelize[_0x44fb('0x4')](_0x44fb('0x5'),_0x44fb('0x6')),'defaultValue':_0x44fb('0x5')},'serverUrl':{'type':Sequelize[_0x44fb('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x44fb('0x4')]('integrationTab',_0x44fb('0x7')),'defaultValue':_0x44fb('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 3387133..691acc3 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 _0x878f=['username','password','token','authType','remoteUri','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','Basic\x20%s','%s:%s','toString','headers','%s/token:%s','base64','Sequelize','ValidationError','subject','description','group','assignee','includes','position','title','system_field_options','test','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','then','error','name','send','index','ZendeskAccount','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','filters','catch','create','body','destroy','getConfigurations','findOne','ZendeskConfiguration','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','Subjects'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x878f,0x173));var _0xf878=function(_0x32abd1,_0x35db4c){_0x32abd1=_0x32abd1-0x0;var _0x50dd95=_0x878f[_0x32abd1];return _0x50dd95;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf878('0x0'));var zipdir=require(_0xf878('0x1'));var jsonpatch=require(_0xf878('0x2'));var rp=require(_0xf878('0x3'));var moment=require(_0xf878('0x4'));var BPromise=require(_0xf878('0x5'));var Mustache=require(_0xf878('0x6'));var util=require(_0xf878('0x7'));var path=require(_0xf878('0x8'));var sox=require(_0xf878('0x9'));var csv=require(_0xf878('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf878('0xb'));var squel=require(_0xf878('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf878('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf878('0xd'));var authService=require(_0xf878('0xe'));var qs=require(_0xf878('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf878('0x10'));var logger=require(_0xf878('0x11'))('api');var utils=require(_0xf878('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xf878('0x13'));var db=require(_0xf878('0x14'))['db'];var integrations=require(_0xf878('0x15'));function respondWithStatusCode(_0x596fb5,_0x1ce004){_0x1ce004=_0x1ce004||0xcc;return function(_0x38eddf){if(_0x38eddf){return _0x596fb5[_0xf878('0x16')](_0x1ce004);}return _0x596fb5['status'](_0x1ce004)[_0xf878('0x17')]();};}function respondWithResult(_0x3902f7,_0x119e9e){_0x119e9e=_0x119e9e||0xc8;return function(_0x492260){if(_0x492260){return _0x3902f7['status'](_0x119e9e)[_0xf878('0x18')](_0x492260);}};}function respondWithFilteredResult(_0x35ff2d,_0x31d888){return function(_0x6dbeca){if(_0x6dbeca){var _0x44aacc=typeof _0x31d888[_0xf878('0x19')]===_0xf878('0x1a')&&typeof _0x31d888[_0xf878('0x1b')]===_0xf878('0x1a');var _0x3a55f3=_0x6dbeca[_0xf878('0x1c')];var _0x47a91a=_0x44aacc?0x0:_0x31d888[_0xf878('0x19')];var _0x34ae59=_0x44aacc?_0x6dbeca[_0xf878('0x1c')]:_0x31d888[_0xf878('0x19')]+_0x31d888[_0xf878('0x1b')];var _0x237d15;if(_0x34ae59>=_0x3a55f3){_0x34ae59=_0x3a55f3;_0x237d15=0xc8;}else{_0x237d15=0xce;}_0x35ff2d[_0xf878('0x1d')](_0x237d15);return _0x35ff2d['set'](_0xf878('0x1e'),_0x47a91a+'-'+_0x34ae59+'/'+_0x3a55f3)[_0xf878('0x18')](_0x6dbeca);}return null;};}function patchUpdates(_0x250f85){return function(_0x59efcb){try{jsonpatch[_0xf878('0x1f')](_0x59efcb,_0x250f85,!![]);}catch(_0x23590c){return BPromise[_0xf878('0x20')](_0x23590c);}return _0x59efcb[_0xf878('0x21')]();};}function saveUpdates(_0x22d884,_0x442450){return function(_0x1cbc92){if(_0x1cbc92){return _0x1cbc92[_0xf878('0x22')](_0x22d884)[_0xf878('0x23')](function(_0x1a6506){return _0x1a6506;});}return null;};}function removeEntity(_0x45e61f,_0x566995){return function(_0x2ac38b){if(_0x2ac38b){return _0x2ac38b['destroy']()[_0xf878('0x23')](function(){_0x45e61f[_0xf878('0x1d')](0xcc)[_0xf878('0x17')]();});}};}function handleEntityNotFound(_0x280036,_0x20449e){return function(_0x5ebaa0){if(!_0x5ebaa0){_0x280036['sendStatus'](0x194);}return _0x5ebaa0;};}function handleError(_0x59ba7b,_0x242926){_0x242926=_0x242926||0x1f4;return function(_0x3baba4){logger[_0xf878('0x24')](_0x3baba4['stack']);if(_0x3baba4[_0xf878('0x25')]){delete _0x3baba4[_0xf878('0x25')];}_0x59ba7b[_0xf878('0x1d')](_0x242926)[_0xf878('0x26')](_0x3baba4);};}exports[_0xf878('0x27')]=function(_0x5aff46,_0x502322){var _0x9a127d={},_0x5d9c97={},_0x4a0286={'count':0x0,'rows':[]};var _0x31e2e1=_['map'](db[_0xf878('0x28')]['rawAttributes'],function(_0x2c61c1){return{'name':_0x2c61c1['fieldName'],'type':_0x2c61c1[_0xf878('0x29')]['key']};});_0x5d9c97[_0xf878('0x2a')]=_[_0xf878('0x2b')](_0x31e2e1,_0xf878('0x25'));_0x5d9c97[_0xf878('0x2c')]=_[_0xf878('0x2d')](_0x5aff46[_0xf878('0x2c')]);_0x5d9c97['filters']=_[_0xf878('0x2e')](_0x5d9c97[_0xf878('0x2a')],_0x5d9c97[_0xf878('0x2c')]);_0x9a127d[_0xf878('0x2f')]=_[_0xf878('0x2e')](_0x5d9c97['model'],qs[_0xf878('0x30')](_0x5aff46[_0xf878('0x2c')]['fields']));_0x9a127d[_0xf878('0x2f')]=_0x9a127d[_0xf878('0x2f')][_0xf878('0x31')]?_0x9a127d[_0xf878('0x2f')]:_0x5d9c97[_0xf878('0x2a')];if(!_0x5aff46['query'][_0xf878('0x32')](_0xf878('0x33'))){_0x9a127d[_0xf878('0x1b')]=qs[_0xf878('0x1b')](_0x5aff46['query'][_0xf878('0x1b')]);_0x9a127d['offset']=qs['offset'](_0x5aff46[_0xf878('0x2c')][_0xf878('0x19')]);}_0x9a127d[_0xf878('0x34')]=qs[_0xf878('0x35')](_0x5aff46[_0xf878('0x2c')]['sort']);_0x9a127d[_0xf878('0x36')]=qs['filters'](_[_0xf878('0x37')](_0x5aff46[_0xf878('0x2c')],_0x5d9c97['filters']),_0x31e2e1);if(_0x5aff46[_0xf878('0x2c')][_0xf878('0x38')]){_0x9a127d['where']=_[_0xf878('0x39')](_0x9a127d[_0xf878('0x36')],{'$or':_['map'](_0x31e2e1,function(_0x4129c2){if(_0x4129c2[_0xf878('0x29')]!==_0xf878('0x3a')){var _0xc8eb91={};_0xc8eb91[_0x4129c2[_0xf878('0x25')]]={'$like':'%'+_0x5aff46[_0xf878('0x2c')][_0xf878('0x38')]+'%'};return _0xc8eb91;}})});}_0x9a127d=_['merge']({},_0x9a127d,_0x5aff46[_0xf878('0x3b')]);var _0x14340d={'where':_0x9a127d['where']};return db[_0xf878('0x28')]['count'](_0x14340d)['then'](function(_0x2ec109){_0x4a0286[_0xf878('0x1c')]=_0x2ec109;if(_0x5aff46[_0xf878('0x2c')][_0xf878('0x3c')]){_0x9a127d[_0xf878('0x3d')]=[{'all':!![]}];}return db['ZendeskAccount'][_0xf878('0x3e')](_0x9a127d);})['then'](function(_0xb09736){_0x4a0286[_0xf878('0x3f')]=_0xb09736;return _0x4a0286;})['then'](respondWithFilteredResult(_0x502322,_0x9a127d))['catch'](handleError(_0x502322,null));};exports[_0xf878('0x40')]=function(_0x2a66c1,_0x13fcd3){var _0x2f6ee5={'raw':![],'where':{'id':_0x2a66c1[_0xf878('0x41')]['id']}},_0x5d6e03={};_0x5d6e03[_0xf878('0x2a')]=_[_0xf878('0x2d')](db[_0xf878('0x28')]['rawAttributes']);_0x5d6e03[_0xf878('0x2c')]=_[_0xf878('0x2d')](_0x2a66c1[_0xf878('0x2c')]);_0x5d6e03[_0xf878('0x42')]=_[_0xf878('0x2e')](_0x5d6e03[_0xf878('0x2a')],_0x5d6e03['query']);_0x2f6ee5[_0xf878('0x2f')]=_[_0xf878('0x2e')](_0x5d6e03[_0xf878('0x2a')],qs[_0xf878('0x30')](_0x2a66c1[_0xf878('0x2c')]['fields']));_0x2f6ee5[_0xf878('0x2f')]=_0x2f6ee5[_0xf878('0x2f')][_0xf878('0x31')]?_0x2f6ee5[_0xf878('0x2f')]:_0x5d6e03['model'];if(_0x2a66c1[_0xf878('0x2c')][_0xf878('0x3c')]){_0x2f6ee5[_0xf878('0x3d')]=[{'all':!![]}];}_0x2f6ee5=_['merge']({},_0x2f6ee5,_0x2a66c1['options']);return db[_0xf878('0x28')]['find'](_0x2f6ee5)['then'](handleEntityNotFound(_0x13fcd3,null))['then'](respondWithResult(_0x13fcd3,null))[_0xf878('0x43')](handleError(_0x13fcd3,null));};exports['create']=function(_0x156fdb,_0x450a10){return db[_0xf878('0x28')][_0xf878('0x44')](_0x156fdb[_0xf878('0x45')],{})[_0xf878('0x23')](respondWithResult(_0x450a10,0xc9))[_0xf878('0x43')](handleError(_0x450a10,null));};exports['update']=function(_0xb0bf4c,_0x361ac8){if(_0xb0bf4c[_0xf878('0x45')]['id']){delete _0xb0bf4c[_0xf878('0x45')]['id'];}return db[_0xf878('0x28')]['find']({'where':{'id':_0xb0bf4c['params']['id']}})[_0xf878('0x23')](handleEntityNotFound(_0x361ac8,null))[_0xf878('0x23')](saveUpdates(_0xb0bf4c['body'],null))[_0xf878('0x23')](respondWithResult(_0x361ac8,null))['catch'](handleError(_0x361ac8,null));};exports[_0xf878('0x46')]=function(_0x31adde,_0x379912){return db[_0xf878('0x28')]['find']({'where':{'id':_0x31adde[_0xf878('0x41')]['id']}})[_0xf878('0x23')](handleEntityNotFound(_0x379912,null))[_0xf878('0x23')](removeEntity(_0x379912,null))['catch'](handleError(_0x379912,null));};exports[_0xf878('0x47')]=function(_0x30df05,_0x1d3427,_0x28c393){var _0x53e3c3={};var _0x112f2a={};var _0x181f09;var _0x3f9fce;return db['ZendeskAccount'][_0xf878('0x48')]({'where':{'id':_0x30df05[_0xf878('0x41')]['id']}})[_0xf878('0x23')](handleEntityNotFound(_0x1d3427,null))[_0xf878('0x23')](function(_0x5118f4){if(_0x5118f4){_0x181f09=_0x5118f4;_0x112f2a['model']=_['keys'](db[_0xf878('0x49')]['rawAttributes']);_0x112f2a['query']=_['keys'](_0x30df05[_0xf878('0x2c')]);_0x112f2a[_0xf878('0x42')]=_['intersection'](_0x112f2a[_0xf878('0x2a')],_0x112f2a[_0xf878('0x2c')]);_0x53e3c3[_0xf878('0x2f')]=_['intersection'](_0x112f2a['model'],qs[_0xf878('0x30')](_0x30df05['query'][_0xf878('0x30')]));_0x53e3c3[_0xf878('0x2f')]=_0x53e3c3[_0xf878('0x2f')][_0xf878('0x31')]?_0x53e3c3[_0xf878('0x2f')]:_0x112f2a[_0xf878('0x2a')];_0x53e3c3['order']=qs[_0xf878('0x35')](_0x30df05[_0xf878('0x2c')]['sort']);_0x53e3c3[_0xf878('0x36')]=qs[_0xf878('0x42')](_[_0xf878('0x37')](_0x30df05[_0xf878('0x2c')],_0x112f2a[_0xf878('0x42')]));if(_0x30df05[_0xf878('0x2c')][_0xf878('0x38')]){_0x53e3c3['where']=_[_0xf878('0x39')](_0x53e3c3[_0xf878('0x36')],{'$or':_[_0xf878('0x2b')](_0x53e3c3['attributes'],function(_0x392242){var _0x560e0b={};_0x560e0b[_0x392242]={'$like':'%'+_0x30df05[_0xf878('0x2c')][_0xf878('0x38')]+'%'};return _0x560e0b;})});}_0x53e3c3=_[_0xf878('0x39')]({},_0x53e3c3,_0x30df05[_0xf878('0x3b')]);return _0x181f09[_0xf878('0x47')](_0x53e3c3);}})[_0xf878('0x23')](function(_0x1141dd){if(_0x1141dd){_0x3f9fce=_0x1141dd[_0xf878('0x31')];if(!_0x30df05[_0xf878('0x2c')][_0xf878('0x32')]('nolimit')){_0x53e3c3['limit']=qs['limit'](_0x30df05[_0xf878('0x2c')]['limit']);_0x53e3c3[_0xf878('0x19')]=qs[_0xf878('0x19')](_0x30df05['query']['offset']);}return _0x181f09[_0xf878('0x47')](_0x53e3c3);}})[_0xf878('0x23')](function(_0x3340c1){if(_0x3340c1){return _0x3340c1?{'count':_0x3f9fce,'rows':_0x3340c1}:null;}})[_0xf878('0x23')](respondWithResult(_0x1d3427,null))[_0xf878('0x43')](handleError(_0x1d3427,null));};exports[_0xf878('0x4a')]=function(_0x3e78fc,_0x302258,_0x1602ed){if(_0x3e78fc[_0xf878('0x45')]['id']){delete _0x3e78fc[_0xf878('0x45')]['id'];}return db[_0xf878('0x28')][_0xf878('0x48')]({'where':{'id':_0x3e78fc[_0xf878('0x41')]['id']}})[_0xf878('0x23')](handleEntityNotFound(_0x302258,null))[_0xf878('0x23')](function(_0x1254dd){if(_0x1254dd){_0x3e78fc[_0xf878('0x45')]['AccountId']=_0x1254dd['id'];_0x3e78fc[_0xf878('0x45')]['Subjects']=integrations[_0xf878('0x4b')](_0x3e78fc[_0xf878('0x45')][_0xf878('0x4c')],_0x3e78fc[_0xf878('0x45')][_0xf878('0x29')]);_0x3e78fc[_0xf878('0x45')][_0xf878('0x4d')]=integrations[_0xf878('0x4e')](_0x3e78fc[_0xf878('0x45')]['channel'],_0x3e78fc[_0xf878('0x45')][_0xf878('0x29')]);return db[_0xf878('0x49')][_0xf878('0x44')](_0x3e78fc['body'],{'include':[{'model':db[_0xf878('0x4f')],'as':_0xf878('0x50')},{'model':db[_0xf878('0x4f')],'as':_0xf878('0x4d')}]});}return null;})[_0xf878('0x23')](respondWithResult(_0x302258,null))['catch'](handleError(_0x302258,null));};exports['getFields']=function(_0x453644,_0x1b0230,_0x193f6c){var _0x251613='';return db[_0xf878('0x28')][_0xf878('0x48')]({'where':{'id':_0x453644[_0xf878('0x41')]['id']},'attributes':['id',_0xf878('0x51'),_0xf878('0x52'),_0xf878('0x53'),_0xf878('0x54'),_0xf878('0x55')]})[_0xf878('0x23')](handleEntityNotFound(_0x1b0230,null))[_0xf878('0x23')](function(_0x3bfd00){if(_0x3bfd00){_0x251613=_0x3bfd00[_0xf878('0x55')];var _0x153069=_0x251613['slice'](-0x1);if(_0x153069==='/'){_0x251613=_0x251613[_0xf878('0x56')](0x0,_0x251613[_0xf878('0x57')](_0x153069));}var _0x288235={'method':_0xf878('0x58'),'uri':util[_0xf878('0x59')](_0xf878('0x5a'),_0x251613,_0xf878('0x5b')),'json':!![]};switch(_0x3bfd00[_0xf878('0x54')]){case _0xf878('0x52'):_0x288235['headers']={'Authorization':util[_0xf878('0x59')](_0xf878('0x5c'),new Buffer(util[_0xf878('0x59')](_0xf878('0x5d'),_0x3bfd00[_0xf878('0x51')],_0x3bfd00[_0xf878('0x52')]))[_0xf878('0x5e')]('base64'))};break;case'token':_0x288235[_0xf878('0x5f')]={'Authorization':util['format'](_0xf878('0x5c'),new Buffer(util[_0xf878('0x59')](_0xf878('0x60'),_0x3bfd00[_0xf878('0x51')],_0x3bfd00['token']))[_0xf878('0x5e')](_0xf878('0x61')))};break;default:throw new db[(_0xf878('0x62'))][(_0xf878('0x63'))]('Unknown\x20authentication\x20type');}return rp(_0x288235);}})[_0xf878('0x23')](function(_0x565e8c){if(_0x565e8c){var _0x21537f=[_0xf878('0x64'),_0xf878('0x65'),_0xf878('0x66'),_0xf878('0x67')];_['remove'](_0x565e8c[_0xf878('0x5b')],function(_0x21c5d1){return _0x21537f[_0xf878('0x68')](_0x21c5d1[_0xf878('0x29')]);});return{'count':_0x565e8c['ticket_fields'][_0xf878('0x31')],'rows':_['map'](_0x565e8c[_0xf878('0x5b')],function(_0x107456){return{'id':_0x107456['id'],'name':_0x107456[_0xf878('0x69')]>0x7?_0x107456[_0xf878('0x6a')]:_0x107456[_0xf878('0x29')],'custom':_0x107456[_0xf878('0x69')]>0x7?!![]:![],'options':_0x107456[_0xf878('0x6b')]?_0x107456[_0xf878('0x6b')]:_0x107456['custom_field_options']?_0x107456['custom_field_options']:[]};})};}})['then'](respondWithResult(_0x1b0230,null))[_0xf878('0x43')](function(_0x1a9af7){var _0x497b7a=_0x453644['query'][_0xf878('0x6c')]?0x1f4:_0x1a9af7['statusCode']||0x1f4;logger[_0xf878('0x24')](_0xf878('0x6d'),_0xf878('0x6e'),_0x497b7a,JSON[_0xf878('0x6f')](_0x1a9af7));delete _0x1a9af7[_0xf878('0x25')];if(_0x497b7a===0x191){_0x497b7a=0x190;}_0x1b0230[_0xf878('0x1d')](_0x497b7a)[_0xf878('0x26')](_0x453644[_0xf878('0x2c')][_0xf878('0x6c')]?{'message':'Wrong\x20credentials','statusCode':_0x1a9af7[_0xf878('0x70')]}:_0x1a9af7);});}; \ No newline at end of file +var _0xa74f=['Subjects','getSubjects','channel','type','Descriptions','getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','toString','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','zip-dir','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','then','destroy','sendStatus','stack','name','index','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','ZendeskAccount','findAll','rows','params','length','find','catch','create','body','findOne','getConfigurations','addConfiguration'];(function(_0x576d8a,_0x2d7bde){var _0x3dc3ef=function(_0xc76758){while(--_0xc76758){_0x576d8a['push'](_0x576d8a['shift']());}};_0x3dc3ef(++_0x2d7bde);}(_0xa74f,0x9a));var _0xfa74=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0xa74f[_0x4c440b];return _0x2d48cf;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfa74('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfa74('0x1'));var BPromise=require(_0xfa74('0x2'));var Mustache=require(_0xfa74('0x3'));var util=require(_0xfa74('0x4'));var path=require('path');var sox=require(_0xfa74('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfa74('0x6'));var _=require(_0xfa74('0x7'));var squel=require(_0xfa74('0x8'));var crypto=require(_0xfa74('0x9'));var jsforce=require(_0xfa74('0xa'));var deskjs=require(_0xfa74('0xb'));var toCsv=require('to-csv');var querystring=require(_0xfa74('0xc'));var Papa=require(_0xfa74('0xd'));var Redis=require(_0xfa74('0xe'));var authService=require(_0xfa74('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xfa74('0x10'));var hardwareService=require(_0xfa74('0x11'));var logger=require('../../config/logger')(_0xfa74('0x12'));var utils=require(_0xfa74('0x13'));var config=require(_0xfa74('0x14'));var licenseUtil=require(_0xfa74('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0xfa74('0x16'));function respondWithStatusCode(_0x998585,_0x78173f){_0x78173f=_0x78173f||0xcc;return function(_0x278e8b){if(_0x278e8b){return _0x998585['sendStatus'](_0x78173f);}return _0x998585[_0xfa74('0x17')](_0x78173f)[_0xfa74('0x18')]();};}function respondWithResult(_0x3eb49b,_0x3947ca){_0x3947ca=_0x3947ca||0xc8;return function(_0xe3c97e){if(_0xe3c97e){return _0x3eb49b['status'](_0x3947ca)[_0xfa74('0x19')](_0xe3c97e);}};}function respondWithFilteredResult(_0x13d911,_0x947da6){return function(_0x1f1de0){if(_0x1f1de0){var _0x3867f8=typeof _0x947da6[_0xfa74('0x1a')]===_0xfa74('0x1b')&&typeof _0x947da6['limit']===_0xfa74('0x1b');var _0xe0e33d=_0x1f1de0['count'];var _0x4928b6=_0x3867f8?0x0:_0x947da6[_0xfa74('0x1a')];var _0x25a36b=_0x3867f8?_0x1f1de0[_0xfa74('0x1c')]:_0x947da6['offset']+_0x947da6[_0xfa74('0x1d')];var _0x2edebb;if(_0x25a36b>=_0xe0e33d){_0x25a36b=_0xe0e33d;_0x2edebb=0xc8;}else{_0x2edebb=0xce;}_0x13d911[_0xfa74('0x17')](_0x2edebb);return _0x13d911['set'](_0xfa74('0x1e'),_0x4928b6+'-'+_0x25a36b+'/'+_0xe0e33d)[_0xfa74('0x19')](_0x1f1de0);}return null;};}function patchUpdates(_0x2e6c33){return function(_0x4a5ee4){try{jsonpatch['apply'](_0x4a5ee4,_0x2e6c33,!![]);}catch(_0x100851){return BPromise[_0xfa74('0x1f')](_0x100851);}return _0x4a5ee4[_0xfa74('0x20')]();};}function saveUpdates(_0xeaaa19,_0x1a453d){return function(_0x554e0e){if(_0x554e0e){return _0x554e0e['update'](_0xeaaa19)[_0xfa74('0x21')](function(_0x5aa8a7){return _0x5aa8a7;});}return null;};}function removeEntity(_0x48cbd3,_0x529810){return function(_0x42c439){if(_0x42c439){return _0x42c439[_0xfa74('0x22')]()[_0xfa74('0x21')](function(){_0x48cbd3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x9eb68c,_0xeb6c11){return function(_0x5ed1c8){if(!_0x5ed1c8){_0x9eb68c[_0xfa74('0x23')](0x194);}return _0x5ed1c8;};}function handleError(_0x5d3b26,_0x1a8cf7){_0x1a8cf7=_0x1a8cf7||0x1f4;return function(_0x153b2a){logger['error'](_0x153b2a[_0xfa74('0x24')]);if(_0x153b2a[_0xfa74('0x25')]){delete _0x153b2a[_0xfa74('0x25')];}_0x5d3b26[_0xfa74('0x17')](_0x1a8cf7)['send'](_0x153b2a);};}exports[_0xfa74('0x26')]=function(_0x2f7cd7,_0x204e01){var _0x57d90e={},_0x4d4bed={},_0x1322a4={'count':0x0,'rows':[]};var _0x8b706e=_['map'](db['ZendeskAccount'][_0xfa74('0x27')],function(_0x564060){return{'name':_0x564060[_0xfa74('0x28')],'type':_0x564060['type'][_0xfa74('0x29')]};});_0x4d4bed[_0xfa74('0x2a')]=_[_0xfa74('0x2b')](_0x8b706e,_0xfa74('0x25'));_0x4d4bed['query']=_[_0xfa74('0x2c')](_0x2f7cd7[_0xfa74('0x2d')]);_0x4d4bed[_0xfa74('0x2e')]=_[_0xfa74('0x2f')](_0x4d4bed[_0xfa74('0x2a')],_0x4d4bed[_0xfa74('0x2d')]);_0x57d90e[_0xfa74('0x30')]=_['intersection'](_0x4d4bed[_0xfa74('0x2a')],qs['fields'](_0x2f7cd7[_0xfa74('0x2d')][_0xfa74('0x31')]));_0x57d90e[_0xfa74('0x30')]=_0x57d90e[_0xfa74('0x30')]['length']?_0x57d90e['attributes']:_0x4d4bed[_0xfa74('0x2a')];if(!_0x2f7cd7[_0xfa74('0x2d')][_0xfa74('0x32')](_0xfa74('0x33'))){_0x57d90e['limit']=qs[_0xfa74('0x1d')](_0x2f7cd7[_0xfa74('0x2d')]['limit']);_0x57d90e['offset']=qs['offset'](_0x2f7cd7['query']['offset']);}_0x57d90e[_0xfa74('0x34')]=qs[_0xfa74('0x35')](_0x2f7cd7[_0xfa74('0x2d')][_0xfa74('0x35')]);_0x57d90e[_0xfa74('0x36')]=qs[_0xfa74('0x2e')](_[_0xfa74('0x37')](_0x2f7cd7[_0xfa74('0x2d')],_0x4d4bed[_0xfa74('0x2e')]),_0x8b706e);if(_0x2f7cd7['query'][_0xfa74('0x38')]){_0x57d90e[_0xfa74('0x36')]=_[_0xfa74('0x39')](_0x57d90e[_0xfa74('0x36')],{'$or':_[_0xfa74('0x2b')](_0x8b706e,function(_0x186126){if(_0x186126['type']!==_0xfa74('0x3a')){var _0x1f0806={};_0x1f0806[_0x186126[_0xfa74('0x25')]]={'$like':'%'+_0x2f7cd7[_0xfa74('0x2d')]['filter']+'%'};return _0x1f0806;}})});}_0x57d90e=_[_0xfa74('0x39')]({},_0x57d90e,_0x2f7cd7[_0xfa74('0x3b')]);var _0xe8491b={'where':_0x57d90e[_0xfa74('0x36')]};return db['ZendeskAccount'][_0xfa74('0x1c')](_0xe8491b)[_0xfa74('0x21')](function(_0x3dacc2){_0x1322a4['count']=_0x3dacc2;if(_0x2f7cd7['query'][_0xfa74('0x3c')]){_0x57d90e[_0xfa74('0x3d')]=[{'all':!![]}];}return db[_0xfa74('0x3e')][_0xfa74('0x3f')](_0x57d90e);})['then'](function(_0x1ab026){_0x1322a4[_0xfa74('0x40')]=_0x1ab026;return _0x1322a4;})['then'](respondWithFilteredResult(_0x204e01,_0x57d90e))['catch'](handleError(_0x204e01,null));};exports['show']=function(_0x492c7d,_0x95c891){var _0x3098ca={'raw':![],'where':{'id':_0x492c7d[_0xfa74('0x41')]['id']}},_0x3f92b2={};_0x3f92b2[_0xfa74('0x2a')]=_[_0xfa74('0x2c')](db[_0xfa74('0x3e')]['rawAttributes']);_0x3f92b2[_0xfa74('0x2d')]=_[_0xfa74('0x2c')](_0x492c7d[_0xfa74('0x2d')]);_0x3f92b2[_0xfa74('0x2e')]=_[_0xfa74('0x2f')](_0x3f92b2['model'],_0x3f92b2[_0xfa74('0x2d')]);_0x3098ca[_0xfa74('0x30')]=_[_0xfa74('0x2f')](_0x3f92b2[_0xfa74('0x2a')],qs[_0xfa74('0x31')](_0x492c7d[_0xfa74('0x2d')][_0xfa74('0x31')]));_0x3098ca[_0xfa74('0x30')]=_0x3098ca[_0xfa74('0x30')][_0xfa74('0x42')]?_0x3098ca['attributes']:_0x3f92b2[_0xfa74('0x2a')];if(_0x492c7d['query'][_0xfa74('0x3c')]){_0x3098ca[_0xfa74('0x3d')]=[{'all':!![]}];}_0x3098ca=_[_0xfa74('0x39')]({},_0x3098ca,_0x492c7d[_0xfa74('0x3b')]);return db['ZendeskAccount'][_0xfa74('0x43')](_0x3098ca)[_0xfa74('0x21')](handleEntityNotFound(_0x95c891,null))['then'](respondWithResult(_0x95c891,null))[_0xfa74('0x44')](handleError(_0x95c891,null));};exports[_0xfa74('0x45')]=function(_0x5cbb70,_0x2be89f){return db[_0xfa74('0x3e')][_0xfa74('0x45')](_0x5cbb70[_0xfa74('0x46')],{})[_0xfa74('0x21')](respondWithResult(_0x2be89f,0xc9))['catch'](handleError(_0x2be89f,null));};exports['update']=function(_0x36f6ca,_0x91df44){if(_0x36f6ca['body']['id']){delete _0x36f6ca[_0xfa74('0x46')]['id'];}return db[_0xfa74('0x3e')][_0xfa74('0x43')]({'where':{'id':_0x36f6ca['params']['id']}})['then'](handleEntityNotFound(_0x91df44,null))[_0xfa74('0x21')](saveUpdates(_0x36f6ca[_0xfa74('0x46')],null))[_0xfa74('0x21')](respondWithResult(_0x91df44,null))[_0xfa74('0x44')](handleError(_0x91df44,null));};exports[_0xfa74('0x22')]=function(_0x3cb23d,_0x2d217d){return db[_0xfa74('0x3e')]['find']({'where':{'id':_0x3cb23d[_0xfa74('0x41')]['id']}})[_0xfa74('0x21')](handleEntityNotFound(_0x2d217d,null))[_0xfa74('0x21')](removeEntity(_0x2d217d,null))[_0xfa74('0x44')](handleError(_0x2d217d,null));};exports['getConfigurations']=function(_0x4ec218,_0x3146de,_0x5b3404){var _0x152eaa={};var _0x221dc7={};var _0x427469;var _0x33e31e;return db[_0xfa74('0x3e')][_0xfa74('0x47')]({'where':{'id':_0x4ec218[_0xfa74('0x41')]['id']}})['then'](handleEntityNotFound(_0x3146de,null))[_0xfa74('0x21')](function(_0x4bcee3){if(_0x4bcee3){_0x427469=_0x4bcee3;_0x221dc7[_0xfa74('0x2a')]=_['keys'](db['ZendeskConfiguration'][_0xfa74('0x27')]);_0x221dc7[_0xfa74('0x2d')]=_['keys'](_0x4ec218['query']);_0x221dc7[_0xfa74('0x2e')]=_[_0xfa74('0x2f')](_0x221dc7[_0xfa74('0x2a')],_0x221dc7[_0xfa74('0x2d')]);_0x152eaa[_0xfa74('0x30')]=_[_0xfa74('0x2f')](_0x221dc7[_0xfa74('0x2a')],qs[_0xfa74('0x31')](_0x4ec218[_0xfa74('0x2d')][_0xfa74('0x31')]));_0x152eaa['attributes']=_0x152eaa[_0xfa74('0x30')][_0xfa74('0x42')]?_0x152eaa['attributes']:_0x221dc7['model'];_0x152eaa[_0xfa74('0x34')]=qs[_0xfa74('0x35')](_0x4ec218[_0xfa74('0x2d')][_0xfa74('0x35')]);_0x152eaa[_0xfa74('0x36')]=qs['filters'](_[_0xfa74('0x37')](_0x4ec218['query'],_0x221dc7[_0xfa74('0x2e')]));if(_0x4ec218[_0xfa74('0x2d')][_0xfa74('0x38')]){_0x152eaa['where']=_['merge'](_0x152eaa[_0xfa74('0x36')],{'$or':_[_0xfa74('0x2b')](_0x152eaa[_0xfa74('0x30')],function(_0x1b3484){var _0x53eca4={};_0x53eca4[_0x1b3484]={'$like':'%'+_0x4ec218[_0xfa74('0x2d')][_0xfa74('0x38')]+'%'};return _0x53eca4;})});}_0x152eaa=_['merge']({},_0x152eaa,_0x4ec218[_0xfa74('0x3b')]);return _0x427469[_0xfa74('0x48')](_0x152eaa);}})[_0xfa74('0x21')](function(_0x1681e7){if(_0x1681e7){_0x33e31e=_0x1681e7['length'];if(!_0x4ec218[_0xfa74('0x2d')]['hasOwnProperty'](_0xfa74('0x33'))){_0x152eaa[_0xfa74('0x1d')]=qs[_0xfa74('0x1d')](_0x4ec218[_0xfa74('0x2d')][_0xfa74('0x1d')]);_0x152eaa[_0xfa74('0x1a')]=qs[_0xfa74('0x1a')](_0x4ec218[_0xfa74('0x2d')][_0xfa74('0x1a')]);}return _0x427469[_0xfa74('0x48')](_0x152eaa);}})[_0xfa74('0x21')](function(_0x930728){if(_0x930728){return _0x930728?{'count':_0x33e31e,'rows':_0x930728}:null;}})[_0xfa74('0x21')](respondWithResult(_0x3146de,null))[_0xfa74('0x44')](handleError(_0x3146de,null));};exports[_0xfa74('0x49')]=function(_0x512b58,_0x2361d2,_0x3b0dd5){if(_0x512b58['body']['id']){delete _0x512b58['body']['id'];}return db[_0xfa74('0x3e')]['findOne']({'where':{'id':_0x512b58[_0xfa74('0x41')]['id']}})[_0xfa74('0x21')](handleEntityNotFound(_0x2361d2,null))[_0xfa74('0x21')](function(_0x529921){if(_0x529921){_0x512b58[_0xfa74('0x46')]['AccountId']=_0x529921['id'];_0x512b58['body'][_0xfa74('0x4a')]=integrations[_0xfa74('0x4b')](_0x512b58[_0xfa74('0x46')][_0xfa74('0x4c')],_0x512b58[_0xfa74('0x46')][_0xfa74('0x4d')]);_0x512b58[_0xfa74('0x46')][_0xfa74('0x4e')]=integrations[_0xfa74('0x4f')](_0x512b58[_0xfa74('0x46')][_0xfa74('0x4c')],_0x512b58['body'][_0xfa74('0x4d')]);return db['ZendeskConfiguration'][_0xfa74('0x45')](_0x512b58[_0xfa74('0x46')],{'include':[{'model':db[_0xfa74('0x50')],'as':'Subjects'},{'model':db[_0xfa74('0x50')],'as':_0xfa74('0x4e')}]});}return null;})[_0xfa74('0x21')](respondWithResult(_0x2361d2,null))['catch'](handleError(_0x2361d2,null));};exports[_0xfa74('0x51')]=function(_0x34e772,_0x474462,_0x1105e5){var _0x10e5f5='';return db['ZendeskAccount'][_0xfa74('0x47')]({'where':{'id':_0x34e772[_0xfa74('0x41')]['id']},'attributes':['id',_0xfa74('0x52'),_0xfa74('0x53'),_0xfa74('0x54'),_0xfa74('0x55'),_0xfa74('0x56')]})[_0xfa74('0x21')](handleEntityNotFound(_0x474462,null))[_0xfa74('0x21')](function(_0x3526d7){if(_0x3526d7){_0x10e5f5=_0x3526d7[_0xfa74('0x56')];var _0x30aec7=_0x10e5f5['slice'](-0x1);if(_0x30aec7==='/'){_0x10e5f5=_0x10e5f5[_0xfa74('0x57')](0x0,_0x10e5f5[_0xfa74('0x58')](_0x30aec7));}var _0xdffc88={'method':_0xfa74('0x59'),'uri':util[_0xfa74('0x5a')](_0xfa74('0x5b'),_0x10e5f5,_0xfa74('0x5c')),'json':!![]};switch(_0x3526d7[_0xfa74('0x55')]){case'password':_0xdffc88[_0xfa74('0x5d')]={'Authorization':util[_0xfa74('0x5a')](_0xfa74('0x5e'),new Buffer(util[_0xfa74('0x5a')]('%s:%s',_0x3526d7[_0xfa74('0x52')],_0x3526d7[_0xfa74('0x53')]))[_0xfa74('0x5f')](_0xfa74('0x60')))};break;case'token':_0xdffc88[_0xfa74('0x5d')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0xfa74('0x5a')]('%s/token:%s',_0x3526d7[_0xfa74('0x52')],_0x3526d7[_0xfa74('0x54')]))['toString']('base64'))};break;default:throw new db[(_0xfa74('0x61'))][(_0xfa74('0x62'))](_0xfa74('0x63'));}return rp(_0xdffc88);}})[_0xfa74('0x21')](function(_0x4f1acc){if(_0x4f1acc){var _0x5acb9b=['subject',_0xfa74('0x64'),_0xfa74('0x65'),_0xfa74('0x66')];_[_0xfa74('0x67')](_0x4f1acc[_0xfa74('0x5c')],function(_0x52e8ac){return _0x5acb9b[_0xfa74('0x68')](_0x52e8ac[_0xfa74('0x4d')]);});return{'count':_0x4f1acc[_0xfa74('0x5c')][_0xfa74('0x42')],'rows':_[_0xfa74('0x2b')](_0x4f1acc[_0xfa74('0x5c')],function(_0x358db2){return{'id':_0x358db2['id'],'name':_0x358db2[_0xfa74('0x69')]>0x7?_0x358db2[_0xfa74('0x6a')]:_0x358db2['type'],'custom':_0x358db2['position']>0x7?!![]:![],'options':_0x358db2['system_field_options']?_0x358db2[_0xfa74('0x6b')]:_0x358db2[_0xfa74('0x6c')]?_0x358db2[_0xfa74('0x6c')]:[]};})};}})[_0xfa74('0x21')](respondWithResult(_0x474462,null))[_0xfa74('0x44')](function(_0x533649){var _0x3e4323=_0x34e772[_0xfa74('0x2d')]['test']?0x1f4:_0x533649[_0xfa74('0x6d')]||0x1f4;logger['error'](_0xfa74('0x6e'),_0xfa74('0x51'),_0x3e4323,JSON[_0xfa74('0x6f')](_0x533649));delete _0x533649[_0xfa74('0x25')];if(_0x3e4323===0x191){_0x3e4323=0x190;}_0x474462[_0xfa74('0x17')](_0x3e4323)[_0xfa74('0x70')](_0x34e772[_0xfa74('0x2d')][_0xfa74('0x71')]?{'message':'Wrong\x20credentials','statusCode':_0x533649['statusCode']}:_0x533649);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 3d345f7..c7f2371 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 _0x8850=['../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xbb0d87,_0x1597ee){var _0x1e6557=function(_0x53f375){while(--_0x53f375){_0xbb0d87['push'](_0xbb0d87['shift']());}};_0x1e6557(++_0x1597ee);}(_0x8850,0xd5));var _0x0885=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8850[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x0885('0x0'));var util=require('util');var logger=require(_0x0885('0x1'))('api');var moment=require(_0x0885('0x2'));var BPromise=require(_0x0885('0x3'));var rp=require(_0x0885('0x4'));var fs=require('fs');var path=require(_0x0885('0x5'));var rimraf=require(_0x0885('0x6'));var config=require(_0x0885('0x7'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x0885('0x8'));module[_0x0885('0x9')]=function(_0x158636,_0x4d817e){return _0x158636[_0x0885('0xa')](_0x0885('0xb'),attributes,{'tableName':_0x0885('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf5d=['util','moment','request-promise','path','rimraf','../../components/integrations/configuration','define','ZendeskAccount','lodash'];(function(_0x70bb8,_0x1da278){var _0x48ba84=function(_0xb567b9){while(--_0xb567b9){_0x70bb8['push'](_0x70bb8['shift']());}};_0x48ba84(++_0x1da278);}(_0xcf5d,0x86));var _0xdcf5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf5d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdcf5('0x0'));var util=require(_0xdcf5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xdcf5('0x2'));var BPromise=require('bluebird');var rp=require(_0xdcf5('0x3'));var fs=require('fs');var path=require(_0xdcf5('0x4'));var rimraf=require(_0xdcf5('0x5'));var config=require('../../config/environment');var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0xdcf5('0x6'));module['exports']=function(_0x1abe4c,_0x3bc877){return _0x1abe4c[_0xdcf5('0x7')](_0xdcf5('0x8'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index cd3a6ea..b6fff6b 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 _0x51db=['ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','include','map','model','ShowZendeskAccount','lodash','util','moment'];(function(_0x324464,_0x16a066){var _0x1d8400=function(_0x410046){while(--_0x410046){_0x324464['push'](_0x324464['shift']());}};_0x1d8400(++_0x16a066);}(_0x51db,0x75));var _0xb51d=function(_0x21774b,_0x4a6d2b){_0x21774b=_0x21774b-0x0;var _0x4675b2=_0x51db[_0x21774b];return _0x4675b2;};'use strict';var _=require(_0xb51d('0x0'));var util=require(_0xb51d('0x1'));var moment=require(_0xb51d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb51d('0x3'));var db=require(_0xb51d('0x4'))['db'];var utils=require(_0xb51d('0x5'));var logger=require(_0xb51d('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xb51d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x322260,_0x283177,_0x1619f5){return new BPromise(function(_0x4a02ec,_0x5dcc1d){return client[_0xb51d('0x8')](_0x322260,_0x1619f5)[_0xb51d('0x9')](function(_0x45104b){logger['info'](_0xb51d('0xa'),_0x283177,_0xb51d('0xb'));logger[_0xb51d('0xc')](_0xb51d('0xd'),_0x283177,_0xb51d('0xb'),JSON[_0xb51d('0xe')](_0x45104b));if(_0x45104b[_0xb51d('0xf')]){if(_0x45104b[_0xb51d('0xf')]['code']===0x1f4){logger[_0xb51d('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x283177,_0x45104b[_0xb51d('0xf')]['message']);return _0x5dcc1d(_0x45104b[_0xb51d('0xf')][_0xb51d('0x10')]);}logger['error'](_0xb51d('0xa'),_0x283177,_0x45104b[_0xb51d('0xf')]['message']);return _0x4a02ec(_0x45104b[_0xb51d('0xf')]['message']);}else{logger[_0xb51d('0x11')](_0xb51d('0xa'),_0x283177,'request\x20sent');_0x4a02ec(_0x45104b['result']['message']);}})[_0xb51d('0x12')](function(_0x1f018d){logger[_0xb51d('0xf')](_0xb51d('0xa'),_0x283177,_0x1f018d);_0x5dcc1d(_0x1f018d);});});}exports[_0xb51d('0x13')]=function(_0x10c14f){var _0x35623d=this;return new Promise(function(_0x2e5d68,_0x11cf36){return db[_0xb51d('0x14')][_0xb51d('0x15')]({'raw':_0x10c14f[_0xb51d('0x16')]?_0x10c14f['options'][_0xb51d('0x17')]===undefined?!![]:![]:!![],'where':_0x10c14f[_0xb51d('0x16')]?_0x10c14f[_0xb51d('0x16')][_0xb51d('0x18')]||null:null,'attributes':_0x10c14f['options']?_0x10c14f[_0xb51d('0x16')][_0xb51d('0x19')]||null:null,'limit':_0x10c14f[_0xb51d('0x16')]?_0x10c14f[_0xb51d('0x16')]['limit']||null:null,'include':_0x10c14f[_0xb51d('0x16')]?_0x10c14f[_0xb51d('0x16')][_0xb51d('0x1a')]?_[_0xb51d('0x1b')](_0x10c14f[_0xb51d('0x16')][_0xb51d('0x1a')],function(_0x3ef076){return{'model':db[_0x3ef076['model']],'as':_0x3ef076['as'],'attributes':_0x3ef076[_0xb51d('0x19')],'include':_0x3ef076[_0xb51d('0x1a')]?_['map'](_0x3ef076[_0xb51d('0x1a')],function(_0xbe289b){return{'model':db[_0xbe289b['model']],'as':_0xbe289b['as'],'attributes':_0xbe289b[_0xb51d('0x19')],'include':_0xbe289b['include']?_['map'](_0xbe289b[_0xb51d('0x1a')],function(_0x42cf94){return{'model':db[_0x42cf94[_0xb51d('0x1c')]],'as':_0x42cf94['as'],'attributes':_0x42cf94[_0xb51d('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x501228){logger['info'](_0xb51d('0x13'),_0x10c14f);logger['debug']('GetZendeskAccount',_0x10c14f,JSON[_0xb51d('0xe')](_0x501228));_0x2e5d68(_0x501228);})[_0xb51d('0x12')](function(_0xa651df){logger[_0xb51d('0xf')](_0xb51d('0x13'),_0xa651df[_0xb51d('0x10')],_0x10c14f);_0x11cf36(_0x35623d[_0xb51d('0xf')](0x1f4,_0xa651df['message']));});});};exports[_0xb51d('0x1d')]=function(_0x6acac8){var _0x3a481e=this;return new Promise(function(_0x5be711,_0x1052de){return db['ZendeskAccount']['find']({'raw':_0x6acac8[_0xb51d('0x16')]?_0x6acac8['options'][_0xb51d('0x17')]===undefined?!![]:![]:!![],'where':_0x6acac8[_0xb51d('0x16')]?_0x6acac8['options'][_0xb51d('0x18')]||null:null,'attributes':_0x6acac8['options']?_0x6acac8[_0xb51d('0x16')][_0xb51d('0x19')]||null:null,'include':_0x6acac8[_0xb51d('0x16')]?_0x6acac8[_0xb51d('0x16')]['include']?_[_0xb51d('0x1b')](_0x6acac8['options'][_0xb51d('0x1a')],function(_0x19ff4e){return{'model':db[_0x19ff4e[_0xb51d('0x1c')]],'as':_0x19ff4e['as'],'attributes':_0x19ff4e['attributes'],'include':_0x19ff4e[_0xb51d('0x1a')]?_[_0xb51d('0x1b')](_0x19ff4e[_0xb51d('0x1a')],function(_0x1c3189){return{'model':db[_0x1c3189[_0xb51d('0x1c')]],'as':_0x1c3189['as'],'attributes':_0x1c3189[_0xb51d('0x19')],'include':_0x1c3189['include']?_[_0xb51d('0x1b')](_0x1c3189[_0xb51d('0x1a')],function(_0x21e42f){return{'model':db[_0x21e42f[_0xb51d('0x1c')]],'as':_0x21e42f['as'],'attributes':_0x21e42f['attributes']};}):[]};}):[]};}):[]:[]})[_0xb51d('0x9')](function(_0x4be36c){logger['info'](_0xb51d('0x1d'),_0x6acac8);logger[_0xb51d('0xc')](_0xb51d('0x1d'),_0x6acac8,JSON[_0xb51d('0xe')](_0x4be36c));_0x5be711(_0x4be36c);})[_0xb51d('0x12')](function(_0x2e1c71){logger[_0xb51d('0xf')](_0xb51d('0x1d'),_0x2e1c71[_0xb51d('0x10')],_0x6acac8);_0x1052de(_0x3a481e[_0xb51d('0xf')](0x1f4,_0x2e1c71[_0xb51d('0x10')]));});});}; \ No newline at end of file +var _0x92d4=['model','GetZendeskAccount','debug','ShowZendeskAccount','find','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message','result','catch','ZendeskAccount','findAll','options','raw','where','attributes','limit','map','include'];(function(_0x33a43f,_0x51a2e1){var _0x1e28a9=function(_0x2d8004){while(--_0x2d8004){_0x33a43f['push'](_0x33a43f['shift']());}};_0x1e28a9(++_0x51a2e1);}(_0x92d4,0x95));var _0x492d=function(_0x11d6dc,_0x5897d7){_0x11d6dc=_0x11d6dc-0x0;var _0x379076=_0x92d4[_0x11d6dc];return _0x379076;};'use strict';var _=require(_0x492d('0x0'));var util=require(_0x492d('0x1'));var moment=require(_0x492d('0x2'));var BPromise=require(_0x492d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x492d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x492d('0x5'));var logger=require(_0x492d('0x6'))(_0x492d('0x7'));var config=require('../../config/environment');var jayson=require(_0x492d('0x8'));var client=jayson[_0x492d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f1b71,_0x36c2ae,_0x3fbe64){return new BPromise(function(_0x4b3303,_0x470341){return client[_0x492d('0xa')](_0x3f1b71,_0x3fbe64)[_0x492d('0xb')](function(_0x5f14ba){logger[_0x492d('0xc')]('ZendeskAccount,\x20%s,\x20%s',_0x36c2ae,'request\x20sent');logger['debug'](_0x492d('0xd'),_0x36c2ae,_0x492d('0xe'),JSON[_0x492d('0xf')](_0x5f14ba));if(_0x5f14ba['error']){if(_0x5f14ba[_0x492d('0x10')][_0x492d('0x11')]===0x1f4){logger[_0x492d('0x10')](_0x492d('0x12'),_0x36c2ae,_0x5f14ba['error']['message']);return _0x470341(_0x5f14ba[_0x492d('0x10')][_0x492d('0x13')]);}logger[_0x492d('0x10')](_0x492d('0x12'),_0x36c2ae,_0x5f14ba[_0x492d('0x10')][_0x492d('0x13')]);return _0x4b3303(_0x5f14ba[_0x492d('0x10')][_0x492d('0x13')]);}else{logger[_0x492d('0xc')](_0x492d('0x12'),_0x36c2ae,'request\x20sent');_0x4b3303(_0x5f14ba[_0x492d('0x14')][_0x492d('0x13')]);}})[_0x492d('0x15')](function(_0x2ff9a1){logger[_0x492d('0x10')](_0x492d('0x12'),_0x36c2ae,_0x2ff9a1);_0x470341(_0x2ff9a1);});});}exports['GetZendeskAccount']=function(_0x281ede){var _0x584cc6=this;return new Promise(function(_0x53ec40,_0x2802b4){return db[_0x492d('0x16')][_0x492d('0x17')]({'raw':_0x281ede[_0x492d('0x18')]?_0x281ede[_0x492d('0x18')][_0x492d('0x19')]===undefined?!![]:![]:!![],'where':_0x281ede[_0x492d('0x18')]?_0x281ede[_0x492d('0x18')][_0x492d('0x1a')]||null:null,'attributes':_0x281ede[_0x492d('0x18')]?_0x281ede['options'][_0x492d('0x1b')]||null:null,'limit':_0x281ede[_0x492d('0x18')]?_0x281ede['options'][_0x492d('0x1c')]||null:null,'include':_0x281ede['options']?_0x281ede['options']['include']?_[_0x492d('0x1d')](_0x281ede['options'][_0x492d('0x1e')],function(_0x5434c2){return{'model':db[_0x5434c2['model']],'as':_0x5434c2['as'],'attributes':_0x5434c2[_0x492d('0x1b')],'include':_0x5434c2['include']?_[_0x492d('0x1d')](_0x5434c2[_0x492d('0x1e')],function(_0x5e0244){return{'model':db[_0x5e0244[_0x492d('0x1f')]],'as':_0x5e0244['as'],'attributes':_0x5e0244[_0x492d('0x1b')],'include':_0x5e0244[_0x492d('0x1e')]?_[_0x492d('0x1d')](_0x5e0244[_0x492d('0x1e')],function(_0x1691d5){return{'model':db[_0x1691d5[_0x492d('0x1f')]],'as':_0x1691d5['as'],'attributes':_0x1691d5[_0x492d('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x54c053){logger[_0x492d('0xc')](_0x492d('0x20'),_0x281ede);logger[_0x492d('0x21')]('GetZendeskAccount',_0x281ede,JSON[_0x492d('0xf')](_0x54c053));_0x53ec40(_0x54c053);})['catch'](function(_0x249f4a){logger['error'](_0x492d('0x20'),_0x249f4a[_0x492d('0x13')],_0x281ede);_0x2802b4(_0x584cc6[_0x492d('0x10')](0x1f4,_0x249f4a['message']));});});};exports[_0x492d('0x22')]=function(_0x1a86fd){var _0x3fb517=this;return new Promise(function(_0x4df3bd,_0x453349){return db[_0x492d('0x16')][_0x492d('0x23')]({'raw':_0x1a86fd[_0x492d('0x18')]?_0x1a86fd[_0x492d('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1a86fd[_0x492d('0x18')]?_0x1a86fd[_0x492d('0x18')][_0x492d('0x1a')]||null:null,'attributes':_0x1a86fd[_0x492d('0x18')]?_0x1a86fd[_0x492d('0x18')][_0x492d('0x1b')]||null:null,'include':_0x1a86fd['options']?_0x1a86fd[_0x492d('0x18')][_0x492d('0x1e')]?_[_0x492d('0x1d')](_0x1a86fd[_0x492d('0x18')][_0x492d('0x1e')],function(_0x4ace13){return{'model':db[_0x4ace13[_0x492d('0x1f')]],'as':_0x4ace13['as'],'attributes':_0x4ace13[_0x492d('0x1b')],'include':_0x4ace13[_0x492d('0x1e')]?_['map'](_0x4ace13[_0x492d('0x1e')],function(_0x57f4db){return{'model':db[_0x57f4db[_0x492d('0x1f')]],'as':_0x57f4db['as'],'attributes':_0x57f4db[_0x492d('0x1b')],'include':_0x57f4db[_0x492d('0x1e')]?_[_0x492d('0x1d')](_0x57f4db[_0x492d('0x1e')],function(_0x565ec7){return{'model':db[_0x565ec7[_0x492d('0x1f')]],'as':_0x565ec7['as'],'attributes':_0x565ec7['attributes']};}):[]};}):[]};}):[]:[]})[_0x492d('0xb')](function(_0x422149){logger['info'](_0x492d('0x22'),_0x1a86fd);logger[_0x492d('0x21')]('ShowZendeskAccount',_0x1a86fd,JSON[_0x492d('0xf')](_0x422149));_0x4df3bd(_0x422149);})[_0x492d('0x15')](function(_0x4a5a7a){logger[_0x492d('0x10')](_0x492d('0x22'),_0x4a5a7a[_0x492d('0x13')],_0x1a86fd);_0x453349(_0x3fb517['error'](0x1f4,_0x4a5a7a[_0x492d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 2da58de..2e0218e 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 _0x5eb8=['getTags','post','/:id/tags','setTags','put','update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x41c758,_0x204c4b){var _0x13796c=function(_0x31f7ee){while(--_0x31f7ee){_0x41c758['push'](_0x41c758['shift']());}};_0x13796c(++_0x204c4b);}(_0x5eb8,0xb0));var _0x85eb=function(_0x510c60,_0x50247e){_0x510c60=_0x510c60-0x0;var _0x49c4aa=_0x5eb8[_0x510c60];return _0x49c4aa;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['get'](_0x85eb('0xe'),auth['isAuthenticated'](),controller[_0x85eb('0xf')]);router[_0x85eb('0x9')](_0x85eb('0x10'),auth[_0x85eb('0xa')](),controller[_0x85eb('0x11')]);router[_0x85eb('0x9')](_0x85eb('0x12'),auth['isAuthenticated'](),controller[_0x85eb('0x13')]);router[_0x85eb('0x9')]('/:id/tags',auth[_0x85eb('0xa')](),controller[_0x85eb('0x14')]);router[_0x85eb('0x15')]('/',auth[_0x85eb('0xa')](),controller['create']);router['post'](_0x85eb('0x16'),auth['isAuthenticated'](),controller[_0x85eb('0x17')]);router[_0x85eb('0x18')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0x19')]);router['delete'](_0x85eb('0xc'),auth['isAuthenticated'](),controller[_0x85eb('0x1a')]);module[_0x85eb('0x1b')]=router; \ No newline at end of file +var _0x5c00=['path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','getFields','/:id/subjects','getSubjects','/:id/tags','post','create','setTags','put','/:id','delete','destroy','exports','multer','util'];(function(_0x20128f,_0x16db36){var _0x1bba56=function(_0x26015b){while(--_0x26015b){_0x20128f['push'](_0x20128f['shift']());}};_0x1bba56(++_0x16db36);}(_0x5c00,0x17e));var _0x05c0=function(_0x3e86e2,_0xbdc053){_0x3e86e2=_0x3e86e2-0x0;var _0x3ff730=_0x5c00[_0x3e86e2];return _0x3ff730;};'use strict';var multer=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var path=require(_0x05c0('0x2'));var timeout=require('connect-timeout');var express=require(_0x05c0('0x3'));var router=express['Router']();var fs_extra=require(_0x05c0('0x4'));var auth=require(_0x05c0('0x5'));var interaction=require(_0x05c0('0x6'));var config=require(_0x05c0('0x7'));var controller=require('./intZendeskConfiguration.controller');router[_0x05c0('0x8')]('/',auth[_0x05c0('0x9')](),controller[_0x05c0('0xa')]);router[_0x05c0('0x8')]('/:id',auth[_0x05c0('0x9')](),controller[_0x05c0('0xb')]);router[_0x05c0('0x8')]('/:id/fields',auth[_0x05c0('0x9')](),controller[_0x05c0('0xc')]);router[_0x05c0('0x8')](_0x05c0('0xd'),auth[_0x05c0('0x9')](),controller[_0x05c0('0xe')]);router['get']('/:id/descriptions',auth[_0x05c0('0x9')](),controller['getDescriptions']);router[_0x05c0('0x8')](_0x05c0('0xf'),auth[_0x05c0('0x9')](),controller['getTags']);router[_0x05c0('0x10')]('/',auth['isAuthenticated'](),controller[_0x05c0('0x11')]);router[_0x05c0('0x10')](_0x05c0('0xf'),auth[_0x05c0('0x9')](),controller[_0x05c0('0x12')]);router[_0x05c0('0x13')](_0x05c0('0x14'),auth[_0x05c0('0x9')](),controller['update']);router[_0x05c0('0x15')](_0x05c0('0x14'),auth[_0x05c0('0x9')](),controller[_0x05c0('0x16')]);module[_0x05c0('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 6f50eec..02881d9 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 _0x342e=['STRING','sequelize','exports'];(function(_0x133d4e,_0xacffb4){var _0x46f144=function(_0x19e364){while(--_0x19e364){_0x133d4e['push'](_0x133d4e['shift']());}};_0x46f144(++_0xacffb4);}(_0x342e,0x1a8));var _0xe342=function(_0x5a7f64,_0x347d57){_0x5a7f64=_0x5a7f64-0x0;var _0x3d30f1=_0x342e[_0x5a7f64];return _0x3d30f1;};'use strict';var Sequelize=require(_0xe342('0x0'));module[_0xe342('0x1')]={'name':{'type':Sequelize[_0xe342('0x2')]},'description':{'type':Sequelize[_0xe342('0x2')]}}; \ No newline at end of file +var _0xf155=['exports','STRING','sequelize'];(function(_0x4dab0f,_0x4652d6){var _0x485102=function(_0x1a1f8e){while(--_0x1a1f8e){_0x4dab0f['push'](_0x4dab0f['shift']());}};_0x485102(++_0x4652d6);}(_0xf155,0xa1));var _0x5f15=function(_0x1ca890,_0x21d0d3){_0x1ca890=_0x1ca890-0x0;var _0x3f8e01=_0xf155[_0x1ca890];return _0x3f8e01;};'use strict';var Sequelize=require(_0x5f15('0x0'));module[_0x5f15('0x1')]={'name':{'type':Sequelize[_0x5f15('0x2')]},'description':{'type':Sequelize[_0x5f15('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index d599115..7bc32aa 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 _0x66b5=['attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','create','body','getFields','findOne','ZendeskField','getSubjects','getDescriptions','Tag','getTags','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','status','sendStatus','stack','name','send','ZendeskConfiguration','rawAttributes','fieldName','type','model','map','query','filters','intersection','fields'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x66b5,0x6f));var _0x566b=function(_0x4b1f14,_0x3e6c4c){_0x4b1f14=_0x4b1f14-0x0;var _0x2953fe=_0x66b5[_0x4b1f14];return _0x2953fe;};'use strict';var emlformat=require(_0x566b('0x0'));var rimraf=require(_0x566b('0x1'));var zipdir=require(_0x566b('0x2'));var jsonpatch=require(_0x566b('0x3'));var rp=require(_0x566b('0x4'));var moment=require(_0x566b('0x5'));var BPromise=require(_0x566b('0x6'));var Mustache=require('mustache');var util=require(_0x566b('0x7'));var path=require(_0x566b('0x8'));var sox=require(_0x566b('0x9'));var csv=require(_0x566b('0xa'));var ejs=require(_0x566b('0xb'));var fs=require('fs');var fs_extra=require(_0x566b('0xc'));var _=require(_0x566b('0xd'));var squel=require(_0x566b('0xe'));var crypto=require('crypto');var jsforce=require(_0x566b('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x566b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x566b('0x10'));var as=require(_0x566b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x566b('0x12'))(_0x566b('0x13'));var utils=require(_0x566b('0x14'));var config=require(_0x566b('0x15'));var licenseUtil=require(_0x566b('0x16'));var db=require(_0x566b('0x17'))['db'];function respondWithStatusCode(_0x3d4906,_0x2c8570){_0x2c8570=_0x2c8570||0xcc;return function(_0xab76a2){if(_0xab76a2){return _0x3d4906['sendStatus'](_0x2c8570);}return _0x3d4906['status'](_0x2c8570)[_0x566b('0x18')]();};}function respondWithResult(_0x1824ad,_0x468148){_0x468148=_0x468148||0xc8;return function(_0x41fbc0){if(_0x41fbc0){return _0x1824ad['status'](_0x468148)[_0x566b('0x19')](_0x41fbc0);}};}function respondWithFilteredResult(_0xabd225,_0x411ee3){return function(_0xded281){if(_0xded281){var _0x494ece=typeof _0x411ee3[_0x566b('0x1a')]===_0x566b('0x1b')&&typeof _0x411ee3[_0x566b('0x1c')]==='undefined';var _0x8139d1=_0xded281[_0x566b('0x1d')];var _0x2f7635=_0x494ece?0x0:_0x411ee3[_0x566b('0x1a')];var _0xa0f23f=_0x494ece?_0xded281[_0x566b('0x1d')]:_0x411ee3[_0x566b('0x1a')]+_0x411ee3[_0x566b('0x1c')];var _0x519237;if(_0xa0f23f>=_0x8139d1){_0xa0f23f=_0x8139d1;_0x519237=0xc8;}else{_0x519237=0xce;}_0xabd225['status'](_0x519237);return _0xabd225[_0x566b('0x1e')](_0x566b('0x1f'),_0x2f7635+'-'+_0xa0f23f+'/'+_0x8139d1)[_0x566b('0x19')](_0xded281);}return null;};}function patchUpdates(_0x40b39f){return function(_0x9d5f3){try{jsonpatch[_0x566b('0x20')](_0x9d5f3,_0x40b39f,!![]);}catch(_0x1b4a2b){return BPromise[_0x566b('0x21')](_0x1b4a2b);}return _0x9d5f3[_0x566b('0x22')]();};}function saveUpdates(_0xa27c45,_0x2cff38){return function(_0x295058){if(_0x295058){return _0x295058[_0x566b('0x23')](_0xa27c45)[_0x566b('0x24')](function(_0x5b6b12){return _0x5b6b12;});}return null;};}function removeEntity(_0x54ea45,_0x1d90eb){return function(_0x7b24d7){if(_0x7b24d7){return _0x7b24d7[_0x566b('0x25')]()[_0x566b('0x24')](function(){_0x54ea45[_0x566b('0x26')](0xcc)[_0x566b('0x18')]();});}};}function handleEntityNotFound(_0x259521,_0x16da21){return function(_0x1a4765){if(!_0x1a4765){_0x259521[_0x566b('0x27')](0x194);}return _0x1a4765;};}function handleError(_0x4be421,_0x3d38b0){_0x3d38b0=_0x3d38b0||0x1f4;return function(_0x1cfe84){logger['error'](_0x1cfe84[_0x566b('0x28')]);if(_0x1cfe84['name']){delete _0x1cfe84[_0x566b('0x29')];}_0x4be421[_0x566b('0x26')](_0x3d38b0)[_0x566b('0x2a')](_0x1cfe84);};}exports['index']=function(_0x2e83d0,_0x2e3a99){var _0x231638={},_0x1f25f7={},_0x5c9e24={'count':0x0,'rows':[]};var _0x4bc5f4=_['map'](db[_0x566b('0x2b')][_0x566b('0x2c')],function(_0x5defaf){return{'name':_0x5defaf[_0x566b('0x2d')],'type':_0x5defaf[_0x566b('0x2e')]['key']};});_0x1f25f7[_0x566b('0x2f')]=_[_0x566b('0x30')](_0x4bc5f4,_0x566b('0x29'));_0x1f25f7[_0x566b('0x31')]=_['keys'](_0x2e83d0['query']);_0x1f25f7[_0x566b('0x32')]=_[_0x566b('0x33')](_0x1f25f7[_0x566b('0x2f')],_0x1f25f7[_0x566b('0x31')]);_0x231638['attributes']=_[_0x566b('0x33')](_0x1f25f7[_0x566b('0x2f')],qs[_0x566b('0x34')](_0x2e83d0['query'][_0x566b('0x34')]));_0x231638[_0x566b('0x35')]=_0x231638[_0x566b('0x35')][_0x566b('0x36')]?_0x231638[_0x566b('0x35')]:_0x1f25f7[_0x566b('0x2f')];if(!_0x2e83d0[_0x566b('0x31')][_0x566b('0x37')](_0x566b('0x38'))){_0x231638['limit']=qs[_0x566b('0x1c')](_0x2e83d0[_0x566b('0x31')]['limit']);_0x231638[_0x566b('0x1a')]=qs[_0x566b('0x1a')](_0x2e83d0[_0x566b('0x31')][_0x566b('0x1a')]);}_0x231638[_0x566b('0x39')]=qs[_0x566b('0x3a')](_0x2e83d0[_0x566b('0x31')][_0x566b('0x3a')]);_0x231638[_0x566b('0x3b')]=qs[_0x566b('0x32')](_[_0x566b('0x3c')](_0x2e83d0[_0x566b('0x31')],_0x1f25f7['filters']),_0x4bc5f4);if(_0x2e83d0['query'][_0x566b('0x3d')]){_0x231638[_0x566b('0x3b')]=_[_0x566b('0x3e')](_0x231638['where'],{'$or':_['map'](_0x4bc5f4,function(_0xb67c82){if(_0xb67c82[_0x566b('0x2e')]!==_0x566b('0x3f')){var _0x1dc96d={};_0x1dc96d[_0xb67c82['name']]={'$like':'%'+_0x2e83d0['query'][_0x566b('0x3d')]+'%'};return _0x1dc96d;}})});}_0x231638=_[_0x566b('0x3e')]({},_0x231638,_0x2e83d0[_0x566b('0x40')]);var _0x4133b3={'where':_0x231638[_0x566b('0x3b')]};return db[_0x566b('0x2b')][_0x566b('0x1d')](_0x4133b3)[_0x566b('0x24')](function(_0x15111b){_0x5c9e24[_0x566b('0x1d')]=_0x15111b;if(_0x2e83d0[_0x566b('0x31')][_0x566b('0x41')]){_0x231638[_0x566b('0x42')]=[{'all':!![]}];}return db[_0x566b('0x2b')][_0x566b('0x43')](_0x231638);})['then'](function(_0x2d1072){_0x5c9e24[_0x566b('0x44')]=_0x2d1072;return _0x5c9e24;})[_0x566b('0x24')](respondWithFilteredResult(_0x2e3a99,_0x231638))[_0x566b('0x45')](handleError(_0x2e3a99,null));};exports['show']=function(_0x1a9658,_0x4b790c){var _0x30022b={'raw':![],'where':{'id':_0x1a9658[_0x566b('0x46')]['id']}},_0x3e85dc={};_0x3e85dc['model']=_[_0x566b('0x47')](db[_0x566b('0x2b')][_0x566b('0x2c')]);_0x3e85dc['query']=_[_0x566b('0x47')](_0x1a9658[_0x566b('0x31')]);_0x3e85dc[_0x566b('0x32')]=_['intersection'](_0x3e85dc[_0x566b('0x2f')],_0x3e85dc[_0x566b('0x31')]);_0x30022b[_0x566b('0x35')]=_['intersection'](_0x3e85dc[_0x566b('0x2f')],qs['fields'](_0x1a9658['query'][_0x566b('0x34')]));_0x30022b[_0x566b('0x35')]=_0x30022b[_0x566b('0x35')][_0x566b('0x36')]?_0x30022b['attributes']:_0x3e85dc[_0x566b('0x2f')];if(_0x1a9658[_0x566b('0x31')][_0x566b('0x41')]){_0x30022b[_0x566b('0x42')]=[{'all':!![]}];}_0x30022b=_[_0x566b('0x3e')]({},_0x30022b,_0x1a9658[_0x566b('0x40')]);return db[_0x566b('0x2b')]['find'](_0x30022b)[_0x566b('0x24')](handleEntityNotFound(_0x4b790c,null))[_0x566b('0x24')](respondWithResult(_0x4b790c,null))[_0x566b('0x45')](handleError(_0x4b790c,null));};exports[_0x566b('0x48')]=function(_0xa90a13,_0x593099){return db[_0x566b('0x2b')][_0x566b('0x48')](_0xa90a13['body'],{})[_0x566b('0x24')](respondWithResult(_0x593099,0xc9))[_0x566b('0x45')](handleError(_0x593099,null));};exports['update']=function(_0x4126b,_0xaa328){if(_0x4126b[_0x566b('0x49')]['id']){delete _0x4126b[_0x566b('0x49')]['id'];}return db[_0x566b('0x2b')]['find']({'where':{'id':_0x4126b[_0x566b('0x46')]['id']}})[_0x566b('0x24')](handleEntityNotFound(_0xaa328,null))[_0x566b('0x24')](saveUpdates(_0x4126b['body'],null))['then'](respondWithResult(_0xaa328,null))['catch'](handleError(_0xaa328,null));};exports[_0x566b('0x25')]=function(_0x59d4fb,_0x4b1275){return db[_0x566b('0x2b')]['find']({'where':{'id':_0x59d4fb[_0x566b('0x46')]['id']}})[_0x566b('0x24')](handleEntityNotFound(_0x4b1275,null))['then'](removeEntity(_0x4b1275,null))[_0x566b('0x45')](handleError(_0x4b1275,null));};exports[_0x566b('0x4a')]=function(_0x588152,_0x2df8ca,_0x249b8c){var _0x1248bf={};var _0x5f1740={};var _0x59841d;var _0x3fa6b5;return db[_0x566b('0x2b')][_0x566b('0x4b')]({'where':{'id':_0x588152[_0x566b('0x46')]['id']}})['then'](handleEntityNotFound(_0x2df8ca,null))['then'](function(_0x82f94e){if(_0x82f94e){_0x59841d=_0x82f94e;_0x5f1740['model']=_[_0x566b('0x47')](db[_0x566b('0x4c')]['rawAttributes']);_0x5f1740[_0x566b('0x31')]=_[_0x566b('0x47')](_0x588152[_0x566b('0x31')]);_0x5f1740[_0x566b('0x32')]=_[_0x566b('0x33')](_0x5f1740[_0x566b('0x2f')],_0x5f1740['query']);_0x1248bf['attributes']=_[_0x566b('0x33')](_0x5f1740[_0x566b('0x2f')],qs[_0x566b('0x34')](_0x588152[_0x566b('0x31')][_0x566b('0x34')]));_0x1248bf[_0x566b('0x35')]=_0x1248bf[_0x566b('0x35')][_0x566b('0x36')]?_0x1248bf[_0x566b('0x35')]:_0x5f1740[_0x566b('0x2f')];_0x1248bf[_0x566b('0x39')]=qs['sort'](_0x588152[_0x566b('0x31')][_0x566b('0x3a')]);_0x1248bf[_0x566b('0x3b')]=qs[_0x566b('0x32')](_[_0x566b('0x3c')](_0x588152[_0x566b('0x31')],_0x5f1740['filters']));if(_0x588152[_0x566b('0x31')][_0x566b('0x3d')]){_0x1248bf['where']=_[_0x566b('0x3e')](_0x1248bf[_0x566b('0x3b')],{'$or':_[_0x566b('0x30')](_0x1248bf['attributes'],function(_0x53f128){var _0x1267fb={};_0x1267fb[_0x53f128]={'$like':'%'+_0x588152[_0x566b('0x31')]['filter']+'%'};return _0x1267fb;})});}_0x1248bf=_[_0x566b('0x3e')]({},_0x1248bf,_0x588152[_0x566b('0x40')]);return _0x59841d[_0x566b('0x4a')](_0x1248bf);}})[_0x566b('0x24')](function(_0x4ef6b7){if(_0x4ef6b7){_0x3fa6b5=_0x4ef6b7[_0x566b('0x36')];if(!_0x588152['query'][_0x566b('0x37')](_0x566b('0x38'))){_0x1248bf[_0x566b('0x1c')]=qs[_0x566b('0x1c')](_0x588152[_0x566b('0x31')][_0x566b('0x1c')]);_0x1248bf[_0x566b('0x1a')]=qs['offset'](_0x588152[_0x566b('0x31')][_0x566b('0x1a')]);}return _0x59841d[_0x566b('0x4a')](_0x1248bf);}})[_0x566b('0x24')](function(_0xf85a10){if(_0xf85a10){return _0xf85a10?{'count':_0x3fa6b5,'rows':_0xf85a10}:null;}})[_0x566b('0x24')](respondWithResult(_0x2df8ca,null))['catch'](handleError(_0x2df8ca,null));};exports['getSubjects']=function(_0xd3b9ef,_0x350d27,_0x898523){var _0x1be1cf={};var _0x549873={};var _0x5abcde;var _0x3847d5;return db['ZendeskConfiguration'][_0x566b('0x4b')]({'where':{'id':_0xd3b9ef[_0x566b('0x46')]['id']}})[_0x566b('0x24')](handleEntityNotFound(_0x350d27,null))[_0x566b('0x24')](function(_0x11e383){if(_0x11e383){_0x5abcde=_0x11e383;_0x549873[_0x566b('0x2f')]=_[_0x566b('0x47')](db[_0x566b('0x4c')]['rawAttributes']);_0x549873[_0x566b('0x31')]=_[_0x566b('0x47')](_0xd3b9ef[_0x566b('0x31')]);_0x549873[_0x566b('0x32')]=_[_0x566b('0x33')](_0x549873[_0x566b('0x2f')],_0x549873['query']);_0x1be1cf['attributes']=_['intersection'](_0x549873[_0x566b('0x2f')],qs['fields'](_0xd3b9ef[_0x566b('0x31')][_0x566b('0x34')]));_0x1be1cf[_0x566b('0x35')]=_0x1be1cf[_0x566b('0x35')]['length']?_0x1be1cf[_0x566b('0x35')]:_0x549873[_0x566b('0x2f')];_0x1be1cf[_0x566b('0x39')]=qs[_0x566b('0x3a')](_0xd3b9ef['query'][_0x566b('0x3a')]);_0x1be1cf[_0x566b('0x3b')]=qs[_0x566b('0x32')](_[_0x566b('0x3c')](_0xd3b9ef[_0x566b('0x31')],_0x549873[_0x566b('0x32')]));if(_0xd3b9ef[_0x566b('0x31')][_0x566b('0x3d')]){_0x1be1cf[_0x566b('0x3b')]=_[_0x566b('0x3e')](_0x1be1cf[_0x566b('0x3b')],{'$or':_[_0x566b('0x30')](_0x1be1cf[_0x566b('0x35')],function(_0x46b030){var _0x136965={};_0x136965[_0x46b030]={'$like':'%'+_0xd3b9ef[_0x566b('0x31')]['filter']+'%'};return _0x136965;})});}_0x1be1cf=_[_0x566b('0x3e')]({},_0x1be1cf,_0xd3b9ef[_0x566b('0x40')]);return _0x5abcde[_0x566b('0x4d')](_0x1be1cf);}})[_0x566b('0x24')](function(_0x4b2260){if(_0x4b2260){_0x3847d5=_0x4b2260['length'];if(!_0xd3b9ef[_0x566b('0x31')]['hasOwnProperty'](_0x566b('0x38'))){_0x1be1cf[_0x566b('0x1c')]=qs[_0x566b('0x1c')](_0xd3b9ef[_0x566b('0x31')]['limit']);_0x1be1cf[_0x566b('0x1a')]=qs[_0x566b('0x1a')](_0xd3b9ef[_0x566b('0x31')][_0x566b('0x1a')]);}return _0x5abcde['getSubjects'](_0x1be1cf);}})['then'](function(_0xa6a8f6){if(_0xa6a8f6){return _0xa6a8f6?{'count':_0x3847d5,'rows':_0xa6a8f6}:null;}})['then'](respondWithResult(_0x350d27,null))['catch'](handleError(_0x350d27,null));};exports[_0x566b('0x4e')]=function(_0x1ef632,_0x594087,_0x557f98){var _0x84833f={};var _0x33f573={};var _0x327103;var _0x59b7ab;return db[_0x566b('0x2b')][_0x566b('0x4b')]({'where':{'id':_0x1ef632[_0x566b('0x46')]['id']}})['then'](handleEntityNotFound(_0x594087,null))[_0x566b('0x24')](function(_0x9f0423){if(_0x9f0423){_0x327103=_0x9f0423;_0x33f573[_0x566b('0x2f')]=_['keys'](db[_0x566b('0x4c')]['rawAttributes']);_0x33f573[_0x566b('0x31')]=_[_0x566b('0x47')](_0x1ef632[_0x566b('0x31')]);_0x33f573[_0x566b('0x32')]=_['intersection'](_0x33f573['model'],_0x33f573[_0x566b('0x31')]);_0x84833f[_0x566b('0x35')]=_[_0x566b('0x33')](_0x33f573['model'],qs['fields'](_0x1ef632['query'][_0x566b('0x34')]));_0x84833f[_0x566b('0x35')]=_0x84833f[_0x566b('0x35')][_0x566b('0x36')]?_0x84833f[_0x566b('0x35')]:_0x33f573[_0x566b('0x2f')];_0x84833f[_0x566b('0x39')]=qs[_0x566b('0x3a')](_0x1ef632[_0x566b('0x31')][_0x566b('0x3a')]);_0x84833f[_0x566b('0x3b')]=qs[_0x566b('0x32')](_[_0x566b('0x3c')](_0x1ef632[_0x566b('0x31')],_0x33f573[_0x566b('0x32')]));if(_0x1ef632[_0x566b('0x31')]['filter']){_0x84833f[_0x566b('0x3b')]=_[_0x566b('0x3e')](_0x84833f[_0x566b('0x3b')],{'$or':_[_0x566b('0x30')](_0x84833f[_0x566b('0x35')],function(_0x322397){var _0x5d9021={};_0x5d9021[_0x322397]={'$like':'%'+_0x1ef632[_0x566b('0x31')][_0x566b('0x3d')]+'%'};return _0x5d9021;})});}_0x84833f=_[_0x566b('0x3e')]({},_0x84833f,_0x1ef632[_0x566b('0x40')]);return _0x327103[_0x566b('0x4e')](_0x84833f);}})[_0x566b('0x24')](function(_0x5acbac){if(_0x5acbac){_0x59b7ab=_0x5acbac[_0x566b('0x36')];if(!_0x1ef632[_0x566b('0x31')][_0x566b('0x37')](_0x566b('0x38'))){_0x84833f[_0x566b('0x1c')]=qs['limit'](_0x1ef632[_0x566b('0x31')][_0x566b('0x1c')]);_0x84833f[_0x566b('0x1a')]=qs['offset'](_0x1ef632[_0x566b('0x31')][_0x566b('0x1a')]);}return _0x327103['getDescriptions'](_0x84833f);}})[_0x566b('0x24')](function(_0x17a355){if(_0x17a355){return _0x17a355?{'count':_0x59b7ab,'rows':_0x17a355}:null;}})['then'](respondWithResult(_0x594087,null))[_0x566b('0x45')](handleError(_0x594087,null));};exports['getTags']=function(_0x26ca69,_0x2f4d4e,_0x4cefca){var _0x3d3abe={};var _0x45885a={};var _0x22be99;var _0x3cf5c5;return db['ZendeskConfiguration'][_0x566b('0x4b')]({'where':{'id':_0x26ca69[_0x566b('0x46')]['id']}})[_0x566b('0x24')](handleEntityNotFound(_0x2f4d4e,null))['then'](function(_0xef6f8d){if(_0xef6f8d){_0x22be99=_0xef6f8d;_0x45885a[_0x566b('0x2f')]=_[_0x566b('0x47')](db[_0x566b('0x4f')]['rawAttributes']);_0x45885a[_0x566b('0x31')]=_[_0x566b('0x47')](_0x26ca69[_0x566b('0x31')]);_0x45885a[_0x566b('0x32')]=_['intersection'](_0x45885a['model'],_0x45885a[_0x566b('0x31')]);_0x3d3abe[_0x566b('0x35')]=_[_0x566b('0x33')](_0x45885a['model'],qs[_0x566b('0x34')](_0x26ca69[_0x566b('0x31')][_0x566b('0x34')]));_0x3d3abe['attributes']=_0x3d3abe[_0x566b('0x35')][_0x566b('0x36')]?_0x3d3abe[_0x566b('0x35')]:_0x45885a['model'];_0x3d3abe[_0x566b('0x39')]=qs['sort'](_0x26ca69[_0x566b('0x31')][_0x566b('0x3a')]);_0x3d3abe[_0x566b('0x3b')]=qs[_0x566b('0x32')](_[_0x566b('0x3c')](_0x26ca69[_0x566b('0x31')],_0x45885a[_0x566b('0x32')]));if(_0x26ca69[_0x566b('0x31')][_0x566b('0x3d')]){_0x3d3abe['where']=_[_0x566b('0x3e')](_0x3d3abe[_0x566b('0x3b')],{'$or':_[_0x566b('0x30')](_0x3d3abe['attributes'],function(_0x27aa4a){var _0x19bae6={};_0x19bae6[_0x27aa4a]={'$like':'%'+_0x26ca69[_0x566b('0x31')][_0x566b('0x3d')]+'%'};return _0x19bae6;})});}_0x3d3abe=_['merge']({},_0x3d3abe,_0x26ca69[_0x566b('0x40')]);return _0x22be99[_0x566b('0x50')](_0x3d3abe);}})[_0x566b('0x24')](function(_0x1f965a){if(_0x1f965a){_0x3cf5c5=_0x1f965a[_0x566b('0x36')];if(!_0x26ca69[_0x566b('0x31')][_0x566b('0x37')](_0x566b('0x38'))){_0x3d3abe[_0x566b('0x1c')]=qs[_0x566b('0x1c')](_0x26ca69['query'][_0x566b('0x1c')]);_0x3d3abe[_0x566b('0x1a')]=qs[_0x566b('0x1a')](_0x26ca69[_0x566b('0x31')][_0x566b('0x1a')]);}return _0x22be99[_0x566b('0x50')](_0x3d3abe);}})[_0x566b('0x24')](function(_0x19e2b8){if(_0x19e2b8){return _0x19e2b8?{'count':_0x3cf5c5,'rows':_0x19e2b8}:null;}})[_0x566b('0x24')](respondWithResult(_0x2f4d4e,null))[_0x566b('0x45')](handleError(_0x2f4d4e,null));};exports['setTags']=function(_0x5f3f1f,_0x10c5e3,_0x14a0c3){if(_0x5f3f1f[_0x566b('0x49')]['id']){delete _0x5f3f1f[_0x566b('0x49')]['id'];}return db['ZendeskConfiguration'][_0x566b('0x4b')]({'where':{'id':_0x5f3f1f['params']['id']}})['then'](handleEntityNotFound(_0x10c5e3,null))['then'](function(_0x19a636){if(_0x19a636){return _0x19a636[_0x566b('0x51')](_0x5f3f1f[_0x566b('0x49')]['ids']||[]);}return null;})[_0x566b('0x24')](respondWithResult(_0x10c5e3,null))['catch'](handleError(_0x10c5e3,null));}; \ No newline at end of file +var _0xbad8=['count','offset','limit','status','set','Content-Range','save','then','destroy','sendStatus','stack','send','ZendeskConfiguration','fieldName','type','model','map','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','params','rawAttributes','length','include','find','create','catch','update','body','getFields','findOne','ZendeskField','nolimit','getDescriptions','getTags','setTags','ids','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','json','undefined'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0xbad8,0x7f));var _0x8bad=function(_0x3f0c06,_0x3d0ecf){_0x3f0c06=_0x3f0c06-0x0;var _0x507d9f=_0xbad8[_0x3f0c06];return _0x507d9f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8bad('0x0'));var jsonpatch=require(_0x8bad('0x1'));var rp=require('request-promise');var moment=require(_0x8bad('0x2'));var BPromise=require(_0x8bad('0x3'));var Mustache=require(_0x8bad('0x4'));var util=require(_0x8bad('0x5'));var path=require('path');var sox=require(_0x8bad('0x6'));var csv=require('to-csv');var ejs=require(_0x8bad('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x8bad('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x8bad('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8bad('0xa'));var Redis=require(_0x8bad('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x8bad('0xc'));var as=require(_0x8bad('0xd'));var hardwareService=require(_0x8bad('0xe'));var logger=require(_0x8bad('0xf'))(_0x8bad('0x10'));var utils=require(_0x8bad('0x11'));var config=require(_0x8bad('0x12'));var licenseUtil=require(_0x8bad('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f503f,_0x104d58){_0x104d58=_0x104d58||0xcc;return function(_0x184b81){if(_0x184b81){return _0x2f503f['sendStatus'](_0x104d58);}return _0x2f503f['status'](_0x104d58)[_0x8bad('0x14')]();};}function respondWithResult(_0x1dce2b,_0x2ddf62){_0x2ddf62=_0x2ddf62||0xc8;return function(_0x80d968){if(_0x80d968){return _0x1dce2b['status'](_0x2ddf62)[_0x8bad('0x15')](_0x80d968);}};}function respondWithFilteredResult(_0x5a6652,_0x422464){return function(_0x5533b2){if(_0x5533b2){var _0x19c540=typeof _0x422464['offset']===_0x8bad('0x16')&&typeof _0x422464['limit']===_0x8bad('0x16');var _0x47cecb=_0x5533b2[_0x8bad('0x17')];var _0x13bc1f=_0x19c540?0x0:_0x422464[_0x8bad('0x18')];var _0x5b73ec=_0x19c540?_0x5533b2[_0x8bad('0x17')]:_0x422464[_0x8bad('0x18')]+_0x422464[_0x8bad('0x19')];var _0x1e004d;if(_0x5b73ec>=_0x47cecb){_0x5b73ec=_0x47cecb;_0x1e004d=0xc8;}else{_0x1e004d=0xce;}_0x5a6652[_0x8bad('0x1a')](_0x1e004d);return _0x5a6652[_0x8bad('0x1b')](_0x8bad('0x1c'),_0x13bc1f+'-'+_0x5b73ec+'/'+_0x47cecb)[_0x8bad('0x15')](_0x5533b2);}return null;};}function patchUpdates(_0x599d8b){return function(_0x1df582){try{jsonpatch['apply'](_0x1df582,_0x599d8b,!![]);}catch(_0xf86520){return BPromise['reject'](_0xf86520);}return _0x1df582[_0x8bad('0x1d')]();};}function saveUpdates(_0x394665,_0x1e2d83){return function(_0x4b47ce){if(_0x4b47ce){return _0x4b47ce['update'](_0x394665)[_0x8bad('0x1e')](function(_0x5aa5e2){return _0x5aa5e2;});}return null;};}function removeEntity(_0x241722,_0x6bbb83){return function(_0x109a1c){if(_0x109a1c){return _0x109a1c[_0x8bad('0x1f')]()[_0x8bad('0x1e')](function(){_0x241722[_0x8bad('0x1a')](0xcc)[_0x8bad('0x14')]();});}};}function handleEntityNotFound(_0x56408f,_0x446476){return function(_0x34ed5b){if(!_0x34ed5b){_0x56408f[_0x8bad('0x20')](0x194);}return _0x34ed5b;};}function handleError(_0x3110af,_0x4b0075){_0x4b0075=_0x4b0075||0x1f4;return function(_0x538ee3){logger['error'](_0x538ee3[_0x8bad('0x21')]);if(_0x538ee3['name']){delete _0x538ee3['name'];}_0x3110af[_0x8bad('0x1a')](_0x4b0075)[_0x8bad('0x22')](_0x538ee3);};}exports['index']=function(_0x291205,_0x4af402){var _0x155788={},_0x23b831={},_0x58df7b={'count':0x0,'rows':[]};var _0x174626=_['map'](db[_0x8bad('0x23')]['rawAttributes'],function(_0x214e11){return{'name':_0x214e11[_0x8bad('0x24')],'type':_0x214e11[_0x8bad('0x25')]['key']};});_0x23b831[_0x8bad('0x26')]=_[_0x8bad('0x27')](_0x174626,_0x8bad('0x28'));_0x23b831[_0x8bad('0x29')]=_[_0x8bad('0x2a')](_0x291205['query']);_0x23b831[_0x8bad('0x2b')]=_[_0x8bad('0x2c')](_0x23b831[_0x8bad('0x26')],_0x23b831[_0x8bad('0x29')]);_0x155788[_0x8bad('0x2d')]=_['intersection'](_0x23b831['model'],qs[_0x8bad('0x2e')](_0x291205['query'][_0x8bad('0x2e')]));_0x155788[_0x8bad('0x2d')]=_0x155788[_0x8bad('0x2d')]['length']?_0x155788[_0x8bad('0x2d')]:_0x23b831['model'];if(!_0x291205[_0x8bad('0x29')][_0x8bad('0x2f')]('nolimit')){_0x155788['limit']=qs[_0x8bad('0x19')](_0x291205['query']['limit']);_0x155788[_0x8bad('0x18')]=qs[_0x8bad('0x18')](_0x291205['query'][_0x8bad('0x18')]);}_0x155788[_0x8bad('0x30')]=qs[_0x8bad('0x31')](_0x291205['query'][_0x8bad('0x31')]);_0x155788[_0x8bad('0x32')]=qs[_0x8bad('0x2b')](_[_0x8bad('0x33')](_0x291205['query'],_0x23b831[_0x8bad('0x2b')]),_0x174626);if(_0x291205[_0x8bad('0x29')][_0x8bad('0x34')]){_0x155788[_0x8bad('0x32')]=_[_0x8bad('0x35')](_0x155788['where'],{'$or':_['map'](_0x174626,function(_0x596e45){if(_0x596e45[_0x8bad('0x25')]!=='VIRTUAL'){var _0x108da0={};_0x108da0[_0x596e45[_0x8bad('0x28')]]={'$like':'%'+_0x291205[_0x8bad('0x29')]['filter']+'%'};return _0x108da0;}})});}_0x155788=_[_0x8bad('0x35')]({},_0x155788,_0x291205[_0x8bad('0x36')]);var _0x27c57f={'where':_0x155788['where']};return db[_0x8bad('0x23')][_0x8bad('0x17')](_0x27c57f)[_0x8bad('0x1e')](function(_0x47ca01){_0x58df7b['count']=_0x47ca01;if(_0x291205[_0x8bad('0x29')][_0x8bad('0x37')]){_0x155788['include']=[{'all':!![]}];}return db[_0x8bad('0x23')][_0x8bad('0x38')](_0x155788);})[_0x8bad('0x1e')](function(_0x4b5d6a){_0x58df7b[_0x8bad('0x39')]=_0x4b5d6a;return _0x58df7b;})[_0x8bad('0x1e')](respondWithFilteredResult(_0x4af402,_0x155788))['catch'](handleError(_0x4af402,null));};exports['show']=function(_0x286f14,_0x15bc6b){var _0x366260={'raw':![],'where':{'id':_0x286f14[_0x8bad('0x3a')]['id']}},_0x206b23={};_0x206b23[_0x8bad('0x26')]=_[_0x8bad('0x2a')](db[_0x8bad('0x23')][_0x8bad('0x3b')]);_0x206b23[_0x8bad('0x29')]=_['keys'](_0x286f14[_0x8bad('0x29')]);_0x206b23[_0x8bad('0x2b')]=_['intersection'](_0x206b23['model'],_0x206b23[_0x8bad('0x29')]);_0x366260['attributes']=_['intersection'](_0x206b23[_0x8bad('0x26')],qs[_0x8bad('0x2e')](_0x286f14[_0x8bad('0x29')][_0x8bad('0x2e')]));_0x366260['attributes']=_0x366260[_0x8bad('0x2d')][_0x8bad('0x3c')]?_0x366260[_0x8bad('0x2d')]:_0x206b23['model'];if(_0x286f14[_0x8bad('0x29')][_0x8bad('0x37')]){_0x366260[_0x8bad('0x3d')]=[{'all':!![]}];}_0x366260=_[_0x8bad('0x35')]({},_0x366260,_0x286f14['options']);return db[_0x8bad('0x23')][_0x8bad('0x3e')](_0x366260)[_0x8bad('0x1e')](handleEntityNotFound(_0x15bc6b,null))['then'](respondWithResult(_0x15bc6b,null))['catch'](handleError(_0x15bc6b,null));};exports[_0x8bad('0x3f')]=function(_0x34f8d5,_0x5f2162){return db['ZendeskConfiguration']['create'](_0x34f8d5['body'],{})[_0x8bad('0x1e')](respondWithResult(_0x5f2162,0xc9))[_0x8bad('0x40')](handleError(_0x5f2162,null));};exports[_0x8bad('0x41')]=function(_0x52a8f4,_0x1ae40d){if(_0x52a8f4[_0x8bad('0x42')]['id']){delete _0x52a8f4[_0x8bad('0x42')]['id'];}return db[_0x8bad('0x23')][_0x8bad('0x3e')]({'where':{'id':_0x52a8f4[_0x8bad('0x3a')]['id']}})['then'](handleEntityNotFound(_0x1ae40d,null))[_0x8bad('0x1e')](saveUpdates(_0x52a8f4['body'],null))[_0x8bad('0x1e')](respondWithResult(_0x1ae40d,null))[_0x8bad('0x40')](handleError(_0x1ae40d,null));};exports[_0x8bad('0x1f')]=function(_0x38ea97,_0x8e9463){return db[_0x8bad('0x23')][_0x8bad('0x3e')]({'where':{'id':_0x38ea97['params']['id']}})[_0x8bad('0x1e')](handleEntityNotFound(_0x8e9463,null))[_0x8bad('0x1e')](removeEntity(_0x8e9463,null))[_0x8bad('0x40')](handleError(_0x8e9463,null));};exports[_0x8bad('0x43')]=function(_0x5c565b,_0xa5851d,_0x169276){var _0x2ebf01={};var _0x3b1ba5={};var _0x2f7355;var _0x2c2b45;return db[_0x8bad('0x23')][_0x8bad('0x44')]({'where':{'id':_0x5c565b['params']['id']}})[_0x8bad('0x1e')](handleEntityNotFound(_0xa5851d,null))['then'](function(_0x2f5838){if(_0x2f5838){_0x2f7355=_0x2f5838;_0x3b1ba5['model']=_[_0x8bad('0x2a')](db[_0x8bad('0x45')][_0x8bad('0x3b')]);_0x3b1ba5['query']=_[_0x8bad('0x2a')](_0x5c565b[_0x8bad('0x29')]);_0x3b1ba5[_0x8bad('0x2b')]=_[_0x8bad('0x2c')](_0x3b1ba5[_0x8bad('0x26')],_0x3b1ba5[_0x8bad('0x29')]);_0x2ebf01[_0x8bad('0x2d')]=_[_0x8bad('0x2c')](_0x3b1ba5['model'],qs[_0x8bad('0x2e')](_0x5c565b[_0x8bad('0x29')][_0x8bad('0x2e')]));_0x2ebf01[_0x8bad('0x2d')]=_0x2ebf01[_0x8bad('0x2d')][_0x8bad('0x3c')]?_0x2ebf01[_0x8bad('0x2d')]:_0x3b1ba5['model'];_0x2ebf01[_0x8bad('0x30')]=qs[_0x8bad('0x31')](_0x5c565b[_0x8bad('0x29')]['sort']);_0x2ebf01[_0x8bad('0x32')]=qs[_0x8bad('0x2b')](_[_0x8bad('0x33')](_0x5c565b[_0x8bad('0x29')],_0x3b1ba5[_0x8bad('0x2b')]));if(_0x5c565b[_0x8bad('0x29')]['filter']){_0x2ebf01['where']=_[_0x8bad('0x35')](_0x2ebf01[_0x8bad('0x32')],{'$or':_[_0x8bad('0x27')](_0x2ebf01[_0x8bad('0x2d')],function(_0x426e85){var _0x539315={};_0x539315[_0x426e85]={'$like':'%'+_0x5c565b[_0x8bad('0x29')][_0x8bad('0x34')]+'%'};return _0x539315;})});}_0x2ebf01=_['merge']({},_0x2ebf01,_0x5c565b[_0x8bad('0x36')]);return _0x2f7355[_0x8bad('0x43')](_0x2ebf01);}})[_0x8bad('0x1e')](function(_0xd2da27){if(_0xd2da27){_0x2c2b45=_0xd2da27[_0x8bad('0x3c')];if(!_0x5c565b[_0x8bad('0x29')][_0x8bad('0x2f')](_0x8bad('0x46'))){_0x2ebf01[_0x8bad('0x19')]=qs[_0x8bad('0x19')](_0x5c565b['query'][_0x8bad('0x19')]);_0x2ebf01[_0x8bad('0x18')]=qs['offset'](_0x5c565b[_0x8bad('0x29')]['offset']);}return _0x2f7355['getFields'](_0x2ebf01);}})['then'](function(_0x5e1f01){if(_0x5e1f01){return _0x5e1f01?{'count':_0x2c2b45,'rows':_0x5e1f01}:null;}})['then'](respondWithResult(_0xa5851d,null))[_0x8bad('0x40')](handleError(_0xa5851d,null));};exports['getSubjects']=function(_0x2119a0,_0x2e6444,_0x29f327){var _0x320b2a={};var _0x775fc1={};var _0x3869ae;var _0x1fa31a;return db[_0x8bad('0x23')][_0x8bad('0x44')]({'where':{'id':_0x2119a0['params']['id']}})[_0x8bad('0x1e')](handleEntityNotFound(_0x2e6444,null))[_0x8bad('0x1e')](function(_0x558725){if(_0x558725){_0x3869ae=_0x558725;_0x775fc1['model']=_[_0x8bad('0x2a')](db[_0x8bad('0x45')][_0x8bad('0x3b')]);_0x775fc1['query']=_['keys'](_0x2119a0[_0x8bad('0x29')]);_0x775fc1['filters']=_[_0x8bad('0x2c')](_0x775fc1['model'],_0x775fc1[_0x8bad('0x29')]);_0x320b2a['attributes']=_['intersection'](_0x775fc1['model'],qs[_0x8bad('0x2e')](_0x2119a0[_0x8bad('0x29')][_0x8bad('0x2e')]));_0x320b2a[_0x8bad('0x2d')]=_0x320b2a['attributes'][_0x8bad('0x3c')]?_0x320b2a[_0x8bad('0x2d')]:_0x775fc1['model'];_0x320b2a[_0x8bad('0x30')]=qs['sort'](_0x2119a0['query'][_0x8bad('0x31')]);_0x320b2a[_0x8bad('0x32')]=qs[_0x8bad('0x2b')](_['pick'](_0x2119a0[_0x8bad('0x29')],_0x775fc1[_0x8bad('0x2b')]));if(_0x2119a0[_0x8bad('0x29')]['filter']){_0x320b2a[_0x8bad('0x32')]=_[_0x8bad('0x35')](_0x320b2a[_0x8bad('0x32')],{'$or':_[_0x8bad('0x27')](_0x320b2a[_0x8bad('0x2d')],function(_0x4ae469){var _0xd78db1={};_0xd78db1[_0x4ae469]={'$like':'%'+_0x2119a0[_0x8bad('0x29')]['filter']+'%'};return _0xd78db1;})});}_0x320b2a=_[_0x8bad('0x35')]({},_0x320b2a,_0x2119a0[_0x8bad('0x36')]);return _0x3869ae['getSubjects'](_0x320b2a);}})[_0x8bad('0x1e')](function(_0x12224f){if(_0x12224f){_0x1fa31a=_0x12224f['length'];if(!_0x2119a0[_0x8bad('0x29')]['hasOwnProperty']('nolimit')){_0x320b2a[_0x8bad('0x19')]=qs[_0x8bad('0x19')](_0x2119a0['query']['limit']);_0x320b2a[_0x8bad('0x18')]=qs['offset'](_0x2119a0['query'][_0x8bad('0x18')]);}return _0x3869ae['getSubjects'](_0x320b2a);}})['then'](function(_0x14f932){if(_0x14f932){return _0x14f932?{'count':_0x1fa31a,'rows':_0x14f932}:null;}})[_0x8bad('0x1e')](respondWithResult(_0x2e6444,null))[_0x8bad('0x40')](handleError(_0x2e6444,null));};exports[_0x8bad('0x47')]=function(_0x4210fb,_0x1962a6,_0x458473){var _0x3a6816={};var _0x36ea79={};var _0x4d5d25;var _0x3c7a73;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x4210fb['params']['id']}})[_0x8bad('0x1e')](handleEntityNotFound(_0x1962a6,null))[_0x8bad('0x1e')](function(_0x34dd2f){if(_0x34dd2f){_0x4d5d25=_0x34dd2f;_0x36ea79[_0x8bad('0x26')]=_[_0x8bad('0x2a')](db[_0x8bad('0x45')]['rawAttributes']);_0x36ea79[_0x8bad('0x29')]=_['keys'](_0x4210fb[_0x8bad('0x29')]);_0x36ea79[_0x8bad('0x2b')]=_[_0x8bad('0x2c')](_0x36ea79[_0x8bad('0x26')],_0x36ea79[_0x8bad('0x29')]);_0x3a6816[_0x8bad('0x2d')]=_[_0x8bad('0x2c')](_0x36ea79['model'],qs[_0x8bad('0x2e')](_0x4210fb['query'][_0x8bad('0x2e')]));_0x3a6816[_0x8bad('0x2d')]=_0x3a6816[_0x8bad('0x2d')][_0x8bad('0x3c')]?_0x3a6816['attributes']:_0x36ea79[_0x8bad('0x26')];_0x3a6816[_0x8bad('0x30')]=qs[_0x8bad('0x31')](_0x4210fb[_0x8bad('0x29')][_0x8bad('0x31')]);_0x3a6816[_0x8bad('0x32')]=qs[_0x8bad('0x2b')](_[_0x8bad('0x33')](_0x4210fb[_0x8bad('0x29')],_0x36ea79[_0x8bad('0x2b')]));if(_0x4210fb[_0x8bad('0x29')][_0x8bad('0x34')]){_0x3a6816[_0x8bad('0x32')]=_[_0x8bad('0x35')](_0x3a6816[_0x8bad('0x32')],{'$or':_[_0x8bad('0x27')](_0x3a6816['attributes'],function(_0x1c0304){var _0x3986d6={};_0x3986d6[_0x1c0304]={'$like':'%'+_0x4210fb[_0x8bad('0x29')][_0x8bad('0x34')]+'%'};return _0x3986d6;})});}_0x3a6816=_[_0x8bad('0x35')]({},_0x3a6816,_0x4210fb[_0x8bad('0x36')]);return _0x4d5d25[_0x8bad('0x47')](_0x3a6816);}})[_0x8bad('0x1e')](function(_0xafeaaf){if(_0xafeaaf){_0x3c7a73=_0xafeaaf[_0x8bad('0x3c')];if(!_0x4210fb['query']['hasOwnProperty']('nolimit')){_0x3a6816[_0x8bad('0x19')]=qs[_0x8bad('0x19')](_0x4210fb[_0x8bad('0x29')][_0x8bad('0x19')]);_0x3a6816[_0x8bad('0x18')]=qs[_0x8bad('0x18')](_0x4210fb[_0x8bad('0x29')][_0x8bad('0x18')]);}return _0x4d5d25[_0x8bad('0x47')](_0x3a6816);}})['then'](function(_0x225a77){if(_0x225a77){return _0x225a77?{'count':_0x3c7a73,'rows':_0x225a77}:null;}})['then'](respondWithResult(_0x1962a6,null))[_0x8bad('0x40')](handleError(_0x1962a6,null));};exports[_0x8bad('0x48')]=function(_0x5eba5f,_0x2aae64,_0x17436a){var _0x1e2db1={};var _0x23df57={};var _0x226177;var _0x465060;return db[_0x8bad('0x23')][_0x8bad('0x44')]({'where':{'id':_0x5eba5f[_0x8bad('0x3a')]['id']}})[_0x8bad('0x1e')](handleEntityNotFound(_0x2aae64,null))['then'](function(_0x112540){if(_0x112540){_0x226177=_0x112540;_0x23df57[_0x8bad('0x26')]=_[_0x8bad('0x2a')](db['Tag'][_0x8bad('0x3b')]);_0x23df57[_0x8bad('0x29')]=_['keys'](_0x5eba5f[_0x8bad('0x29')]);_0x23df57[_0x8bad('0x2b')]=_['intersection'](_0x23df57['model'],_0x23df57[_0x8bad('0x29')]);_0x1e2db1[_0x8bad('0x2d')]=_[_0x8bad('0x2c')](_0x23df57['model'],qs[_0x8bad('0x2e')](_0x5eba5f[_0x8bad('0x29')]['fields']));_0x1e2db1[_0x8bad('0x2d')]=_0x1e2db1['attributes']['length']?_0x1e2db1[_0x8bad('0x2d')]:_0x23df57[_0x8bad('0x26')];_0x1e2db1[_0x8bad('0x30')]=qs['sort'](_0x5eba5f[_0x8bad('0x29')]['sort']);_0x1e2db1[_0x8bad('0x32')]=qs[_0x8bad('0x2b')](_[_0x8bad('0x33')](_0x5eba5f['query'],_0x23df57[_0x8bad('0x2b')]));if(_0x5eba5f[_0x8bad('0x29')]['filter']){_0x1e2db1[_0x8bad('0x32')]=_['merge'](_0x1e2db1[_0x8bad('0x32')],{'$or':_[_0x8bad('0x27')](_0x1e2db1['attributes'],function(_0x387bcf){var _0x104a19={};_0x104a19[_0x387bcf]={'$like':'%'+_0x5eba5f[_0x8bad('0x29')][_0x8bad('0x34')]+'%'};return _0x104a19;})});}_0x1e2db1=_[_0x8bad('0x35')]({},_0x1e2db1,_0x5eba5f[_0x8bad('0x36')]);return _0x226177['getTags'](_0x1e2db1);}})[_0x8bad('0x1e')](function(_0xd2a9c8){if(_0xd2a9c8){_0x465060=_0xd2a9c8[_0x8bad('0x3c')];if(!_0x5eba5f[_0x8bad('0x29')][_0x8bad('0x2f')](_0x8bad('0x46'))){_0x1e2db1['limit']=qs[_0x8bad('0x19')](_0x5eba5f[_0x8bad('0x29')][_0x8bad('0x19')]);_0x1e2db1[_0x8bad('0x18')]=qs[_0x8bad('0x18')](_0x5eba5f[_0x8bad('0x29')][_0x8bad('0x18')]);}return _0x226177[_0x8bad('0x48')](_0x1e2db1);}})['then'](function(_0x2f70c1){if(_0x2f70c1){return _0x2f70c1?{'count':_0x465060,'rows':_0x2f70c1}:null;}})[_0x8bad('0x1e')](respondWithResult(_0x2aae64,null))['catch'](handleError(_0x2aae64,null));};exports[_0x8bad('0x49')]=function(_0x2132ea,_0x48cd5e,_0x147b9a){if(_0x2132ea[_0x8bad('0x42')]['id']){delete _0x2132ea[_0x8bad('0x42')]['id'];}return db[_0x8bad('0x23')][_0x8bad('0x44')]({'where':{'id':_0x2132ea['params']['id']}})['then'](handleEntityNotFound(_0x48cd5e,null))[_0x8bad('0x1e')](function(_0x3d57ae){if(_0x3d57ae){return _0x3d57ae[_0x8bad('0x49')](_0x2132ea[_0x8bad('0x42')][_0x8bad('0x4a')]||[]);}return null;})[_0x8bad('0x1e')](respondWithResult(_0x48cd5e,null))[_0x8bad('0x40')](handleError(_0x48cd5e,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 764a454..b661e9c 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 _0x757a=['define','int_zendesk_configurations','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports'];(function(_0x201d98,_0x56fd1f){var _0x1ae057=function(_0xb7eeab){while(--_0xb7eeab){_0x201d98['push'](_0x201d98['shift']());}};_0x1ae057(++_0x56fd1f);}(_0x757a,0xde));var _0xa757=function(_0x3ac4fa,_0x3b01ae){_0x3ac4fa=_0x3ac4fa-0x0;var _0x466999=_0x757a[_0x3ac4fa];return _0x466999;};'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'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ZendeskConfiguration',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c00=['path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','moment','bluebird'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x9c00,0x1a0));var _0x09c0=function(_0x3e19fb,_0x3258e2){_0x3e19fb=_0x3e19fb-0x0;var _0x5b19bd=_0x9c00[_0x3e19fb];return _0x5b19bd;};'use strict';var _=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x09c0('0x2'));var BPromise=require(_0x09c0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x09c0('0x4'));var rimraf=require(_0x09c0('0x5'));var config=require(_0x09c0('0x6'));var attributes=require(_0x09c0('0x7'));module[_0x09c0('0x8')]=function(_0x5914eb,_0x4d5fc3){return _0x5914eb[_0x09c0('0x9')](_0x09c0('0xa'),attributes,{'tableName':_0x09c0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 45b20d0..e43ce9e 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 _0xe73a=['info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4556bb,_0x34f1e5){var _0x31427d=function(_0x557fd1){while(--_0x557fd1){_0x4556bb['push'](_0x4556bb['shift']());}};_0x31427d(++_0x34f1e5);}(_0xe73a,0x1a1));var _0xae73=function(_0x37b1d8,_0x614312){_0x37b1d8=_0x37b1d8-0x0;var _0x3739e7=_0xe73a[_0x37b1d8];return _0x3739e7;};'use strict';var _=require('lodash');var util=require(_0xae73('0x0'));var moment=require('moment');var BPromise=require(_0xae73('0x1'));var rs=require(_0xae73('0x2'));var fs=require('fs');var Redis=require(_0xae73('0x3'));var db=require(_0xae73('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xae73('0x5'))(_0xae73('0x6'));var config=require(_0xae73('0x7'));var jayson=require(_0xae73('0x8'));var client=jayson[_0xae73('0x9')][_0xae73('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55bb33,_0xac507b,_0x2bd5aa){return new BPromise(function(_0x313cba,_0xfed63b){return client[_0xae73('0xb')](_0x55bb33,_0x2bd5aa)['then'](function(_0x2ae5e8){logger['info'](_0xae73('0xc'),_0xac507b,_0xae73('0xd'));logger[_0xae73('0xe')](_0xae73('0xf'),_0xac507b,_0xae73('0xd'),JSON[_0xae73('0x10')](_0x2ae5e8));if(_0x2ae5e8[_0xae73('0x11')]){if(_0x2ae5e8[_0xae73('0x11')][_0xae73('0x12')]===0x1f4){logger[_0xae73('0x11')](_0xae73('0xc'),_0xac507b,_0x2ae5e8[_0xae73('0x11')][_0xae73('0x13')]);return _0xfed63b(_0x2ae5e8['error'][_0xae73('0x13')]);}logger[_0xae73('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0xac507b,_0x2ae5e8[_0xae73('0x11')]['message']);return _0x313cba(_0x2ae5e8['error']['message']);}else{logger[_0xae73('0x14')](_0xae73('0xc'),_0xac507b,_0xae73('0xd'));_0x313cba(_0x2ae5e8[_0xae73('0x15')]['message']);}})[_0xae73('0x16')](function(_0x385449){logger[_0xae73('0x11')](_0xae73('0xc'),_0xac507b,_0x385449);_0xfed63b(_0x385449);});});} \ No newline at end of file +var _0x09bb=['client','http','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise'];(function(_0x34827d,_0x216e99){var _0x7a060a=function(_0x5b466a){while(--_0x5b466a){_0x34827d['push'](_0x34827d['shift']());}};_0x7a060a(++_0x216e99);}(_0x09bb,0x1cc));var _0xb09b=function(_0x587859,_0x2286f9){_0x587859=_0x587859-0x0;var _0x223351=_0x09bb[_0x587859];return _0x223351;};'use strict';var _=require(_0xb09b('0x0'));var util=require(_0xb09b('0x1'));var moment=require(_0xb09b('0x2'));var BPromise=require(_0xb09b('0x3'));var rs=require(_0xb09b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb09b('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb09b('0x6'));var config=require('../../config/environment');var jayson=require(_0xb09b('0x7'));var client=jayson[_0xb09b('0x8')][_0xb09b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5bc907,_0x573cca,_0x3cde06){return new BPromise(function(_0xc0290c,_0x10dd38){return client['request'](_0x5bc907,_0x3cde06)[_0xb09b('0xa')](function(_0x4851c2){logger['info'](_0xb09b('0xb'),_0x573cca,_0xb09b('0xc'));logger['debug'](_0xb09b('0xd'),_0x573cca,_0xb09b('0xc'),JSON[_0xb09b('0xe')](_0x4851c2));if(_0x4851c2[_0xb09b('0xf')]){if(_0x4851c2[_0xb09b('0xf')]['code']===0x1f4){logger['error'](_0xb09b('0xb'),_0x573cca,_0x4851c2[_0xb09b('0xf')]['message']);return _0x10dd38(_0x4851c2[_0xb09b('0xf')][_0xb09b('0x10')]);}logger[_0xb09b('0xf')](_0xb09b('0xb'),_0x573cca,_0x4851c2[_0xb09b('0xf')][_0xb09b('0x10')]);return _0xc0290c(_0x4851c2[_0xb09b('0xf')][_0xb09b('0x10')]);}else{logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x573cca,'request\x20sent');_0xc0290c(_0x4851c2[_0xb09b('0x11')][_0xb09b('0x10')]);}})['catch'](function(_0x190e5){logger[_0xb09b('0xf')](_0xb09b('0xb'),_0x573cca,_0x190e5);_0x10dd38(_0x190e5);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index aae6f3d..f921489 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 _0x8d45=['put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','get','isAuthenticated','/:id','show','post'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x8d45,0x74));var _0x58d4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x8d45[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x58d4('0x0'));var util=require(_0x58d4('0x1'));var path=require(_0x58d4('0x2'));var timeout=require(_0x58d4('0x3'));var express=require(_0x58d4('0x4'));var router=express['Router']();var fs_extra=require(_0x58d4('0x5'));var auth=require(_0x58d4('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZendeskField.controller');router[_0x58d4('0x7')]('/',auth[_0x58d4('0x8')](),controller['index']);router[_0x58d4('0x7')](_0x58d4('0x9'),auth[_0x58d4('0x8')](),controller[_0x58d4('0xa')]);router[_0x58d4('0xb')]('/',auth[_0x58d4('0x8')](),controller['create']);router[_0x58d4('0xc')]('/:id',auth[_0x58d4('0x8')](),controller[_0x58d4('0xd')]);router['delete']('/:id',auth[_0x58d4('0x8')](),controller[_0x58d4('0xe')]);module[_0x58d4('0xf')]=router; \ No newline at end of file +var _0x8e16=['destroy','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','create','update','delete'];(function(_0x5ae8f7,_0x330d91){var _0x54c636=function(_0x173188){while(--_0x173188){_0x5ae8f7['push'](_0x5ae8f7['shift']());}};_0x54c636(++_0x330d91);}(_0x8e16,0x14b));var _0x68e1=function(_0x41ed8d,_0x5bb41b){_0x41ed8d=_0x41ed8d-0x0;var _0x2848de=_0x8e16[_0x41ed8d];return _0x2848de;};'use strict';var multer=require(_0x68e1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x68e1('0x1'));var express=require(_0x68e1('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x68e1('0x3'));var interaction=require(_0x68e1('0x4'));var config=require(_0x68e1('0x5'));var controller=require(_0x68e1('0x6'));router[_0x68e1('0x7')]('/',auth[_0x68e1('0x8')](),controller[_0x68e1('0x9')]);router[_0x68e1('0x7')](_0x68e1('0xa'),auth[_0x68e1('0x8')](),controller['show']);router['post']('/',auth[_0x68e1('0x8')](),controller[_0x68e1('0xb')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x68e1('0xc')]);router[_0x68e1('0xd')](_0x68e1('0xa'),auth[_0x68e1('0x8')](),controller[_0x68e1('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 4063839..9a6a617 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 _0x44f8=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x44f8,0x104));var _0x844f=function(_0x1ed28f,_0x476606){_0x1ed28f=_0x1ed28f-0x0;var _0x96c524=_0x44f8[_0x1ed28f];return _0x96c524;};'use strict';var Sequelize=require(_0x844f('0x0'));module['exports']={'type':{'type':Sequelize[_0x844f('0x1')](_0x844f('0x2'),_0x844f('0x3'),_0x844f('0x4'),_0x844f('0x5'),_0x844f('0x6')),'defaultValue':_0x844f('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x844f('0x7')]},'keyType':{'type':Sequelize[_0x844f('0x1')](_0x844f('0x2'),'variable',_0x844f('0x4'))},'keyContent':{'type':Sequelize[_0x844f('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x844f('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x844f('0x7')]}}; \ No newline at end of file +var _0x5a64=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','exports'];(function(_0x40f71c,_0x225c3e){var _0xa82b40=function(_0x6683fb){while(--_0x6683fb){_0x40f71c['push'](_0x40f71c['shift']());}};_0xa82b40(++_0x225c3e);}(_0x5a64,0x14c));var _0x45a6=function(_0x4414dd,_0x5f585a){_0x4414dd=_0x4414dd-0x0;var _0x92afac=_0x5a64[_0x4414dd];return _0x92afac;};'use strict';var Sequelize=require('sequelize');module[_0x45a6('0x0')]={'type':{'type':Sequelize[_0x45a6('0x1')](_0x45a6('0x2'),_0x45a6('0x3'),_0x45a6('0x4'),_0x45a6('0x5'),_0x45a6('0x6')),'defaultValue':_0x45a6('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x45a6('0x7')]},'keyType':{'type':Sequelize[_0x45a6('0x1')](_0x45a6('0x2'),_0x45a6('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x45a6('0x7')]},'customField':{'type':Sequelize[_0x45a6('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index bbe1d16..6ac7545 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 _0x2deb=['../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','destroy','end','stack','name','index','map','ZendeskField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','sort','filter','where','merge','options','include','show','length','includeAll','find','catch','create','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','ejs','squel','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x2deb,0xf2));var _0xb2de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2deb[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xb2de('0x0'));var rimraf=require(_0xb2de('0x1'));var zipdir=require(_0xb2de('0x2'));var jsonpatch=require(_0xb2de('0x3'));var rp=require('request-promise');var moment=require(_0xb2de('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb2de('0x5'));var util=require('util');var path=require(_0xb2de('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb2de('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb2de('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb2de('0x9'));var toCsv=require(_0xb2de('0xa'));var querystring=require(_0xb2de('0xb'));var Papa=require(_0xb2de('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb2de('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb2de('0xe'));var logger=require('../../config/logger')(_0xb2de('0xf'));var utils=require(_0xb2de('0x10'));var config=require(_0xb2de('0x11'));var licenseUtil=require(_0xb2de('0x12'));var db=require(_0xb2de('0x13'))['db'];function respondWithStatusCode(_0x1ffa80,_0x173f4c){_0x173f4c=_0x173f4c||0xcc;return function(_0xfdbada){if(_0xfdbada){return _0x1ffa80[_0xb2de('0x14')](_0x173f4c);}return _0x1ffa80[_0xb2de('0x15')](_0x173f4c)['end']();};}function respondWithResult(_0x438edb,_0x565039){_0x565039=_0x565039||0xc8;return function(_0x513f31){if(_0x513f31){return _0x438edb['status'](_0x565039)['json'](_0x513f31);}};}function respondWithFilteredResult(_0x3625f8,_0x537fbb){return function(_0x9dda28){if(_0x9dda28){var _0x4e0aa4=typeof _0x537fbb[_0xb2de('0x16')]===_0xb2de('0x17')&&typeof _0x537fbb[_0xb2de('0x18')]===_0xb2de('0x17');var _0x2373da=_0x9dda28[_0xb2de('0x19')];var _0x4b3ea9=_0x4e0aa4?0x0:_0x537fbb[_0xb2de('0x16')];var _0x4b2ae6=_0x4e0aa4?_0x9dda28[_0xb2de('0x19')]:_0x537fbb[_0xb2de('0x16')]+_0x537fbb['limit'];var _0x1583e7;if(_0x4b2ae6>=_0x2373da){_0x4b2ae6=_0x2373da;_0x1583e7=0xc8;}else{_0x1583e7=0xce;}_0x3625f8[_0xb2de('0x15')](_0x1583e7);return _0x3625f8[_0xb2de('0x1a')](_0xb2de('0x1b'),_0x4b3ea9+'-'+_0x4b2ae6+'/'+_0x2373da)[_0xb2de('0x1c')](_0x9dda28);}return null;};}function patchUpdates(_0x5c5b74){return function(_0x1ceb03){try{jsonpatch[_0xb2de('0x1d')](_0x1ceb03,_0x5c5b74,!![]);}catch(_0x1b8e02){return BPromise['reject'](_0x1b8e02);}return _0x1ceb03[_0xb2de('0x1e')]();};}function saveUpdates(_0x52ec4a,_0x2fd12c){return function(_0x4ab50c){if(_0x4ab50c){return _0x4ab50c['update'](_0x52ec4a)[_0xb2de('0x1f')](function(_0x5e9b45){return _0x5e9b45;});}return null;};}function removeEntity(_0x3bf291,_0x578e90){return function(_0x1e812f){if(_0x1e812f){return _0x1e812f[_0xb2de('0x20')]()[_0xb2de('0x1f')](function(){_0x3bf291['status'](0xcc)[_0xb2de('0x21')]();});}};}function handleEntityNotFound(_0x438f6a,_0x2a884d){return function(_0x172b2a){if(!_0x172b2a){_0x438f6a[_0xb2de('0x14')](0x194);}return _0x172b2a;};}function handleError(_0x5cdb65,_0x53204e){_0x53204e=_0x53204e||0x1f4;return function(_0x467ff0){logger['error'](_0x467ff0[_0xb2de('0x22')]);if(_0x467ff0[_0xb2de('0x23')]){delete _0x467ff0['name'];}_0x5cdb65['status'](_0x53204e)['send'](_0x467ff0);};}exports[_0xb2de('0x24')]=function(_0x41f938,_0x5b8d58){var _0x3a508d={},_0x115978={},_0x761edf={'count':0x0,'rows':[]};var _0x17e520=_[_0xb2de('0x25')](db[_0xb2de('0x26')][_0xb2de('0x27')],function(_0x5ea1bb){return{'name':_0x5ea1bb[_0xb2de('0x28')],'type':_0x5ea1bb['type'][_0xb2de('0x29')]};});_0x115978[_0xb2de('0x2a')]=_[_0xb2de('0x25')](_0x17e520,_0xb2de('0x23'));_0x115978[_0xb2de('0x2b')]=_[_0xb2de('0x2c')](_0x41f938[_0xb2de('0x2b')]);_0x115978[_0xb2de('0x2d')]=_[_0xb2de('0x2e')](_0x115978['model'],_0x115978[_0xb2de('0x2b')]);_0x3a508d['attributes']=_[_0xb2de('0x2e')](_0x115978[_0xb2de('0x2a')],qs['fields'](_0x41f938[_0xb2de('0x2b')]['fields']));_0x3a508d['attributes']=_0x3a508d[_0xb2de('0x2f')]['length']?_0x3a508d['attributes']:_0x115978[_0xb2de('0x2a')];if(!_0x41f938[_0xb2de('0x2b')][_0xb2de('0x30')](_0xb2de('0x31'))){_0x3a508d[_0xb2de('0x18')]=qs[_0xb2de('0x18')](_0x41f938[_0xb2de('0x2b')][_0xb2de('0x18')]);_0x3a508d[_0xb2de('0x16')]=qs[_0xb2de('0x16')](_0x41f938[_0xb2de('0x2b')]['offset']);}_0x3a508d['order']=qs[_0xb2de('0x32')](_0x41f938[_0xb2de('0x2b')]['sort']);_0x3a508d['where']=qs[_0xb2de('0x2d')](_['pick'](_0x41f938[_0xb2de('0x2b')],_0x115978['filters']),_0x17e520);if(_0x41f938[_0xb2de('0x2b')][_0xb2de('0x33')]){_0x3a508d[_0xb2de('0x34')]=_[_0xb2de('0x35')](_0x3a508d['where'],{'$or':_[_0xb2de('0x25')](_0x17e520,function(_0x3ec24e){if(_0x3ec24e['type']!=='VIRTUAL'){var _0xb0ae7b={};_0xb0ae7b[_0x3ec24e[_0xb2de('0x23')]]={'$like':'%'+_0x41f938[_0xb2de('0x2b')]['filter']+'%'};return _0xb0ae7b;}})});}_0x3a508d=_[_0xb2de('0x35')]({},_0x3a508d,_0x41f938[_0xb2de('0x36')]);var _0x295a6d={'where':_0x3a508d['where']};return db['ZendeskField']['count'](_0x295a6d)['then'](function(_0x508c07){_0x761edf[_0xb2de('0x19')]=_0x508c07;if(_0x41f938['query']['includeAll']){_0x3a508d[_0xb2de('0x37')]=[{'all':!![]}];}return db['ZendeskField']['findAll'](_0x3a508d);})[_0xb2de('0x1f')](function(_0x2a37ab){_0x761edf['rows']=_0x2a37ab;return _0x761edf;})[_0xb2de('0x1f')](respondWithFilteredResult(_0x5b8d58,_0x3a508d))['catch'](handleError(_0x5b8d58,null));};exports[_0xb2de('0x38')]=function(_0x57e268,_0x2f85f5){var _0x1a364c={'raw':!![],'where':{'id':_0x57e268['params']['id']}},_0x178e82={};_0x178e82[_0xb2de('0x2a')]=_['keys'](db[_0xb2de('0x26')][_0xb2de('0x27')]);_0x178e82[_0xb2de('0x2b')]=_[_0xb2de('0x2c')](_0x57e268[_0xb2de('0x2b')]);_0x178e82['filters']=_[_0xb2de('0x2e')](_0x178e82[_0xb2de('0x2a')],_0x178e82[_0xb2de('0x2b')]);_0x1a364c[_0xb2de('0x2f')]=_[_0xb2de('0x2e')](_0x178e82[_0xb2de('0x2a')],qs['fields'](_0x57e268[_0xb2de('0x2b')]['fields']));_0x1a364c[_0xb2de('0x2f')]=_0x1a364c[_0xb2de('0x2f')][_0xb2de('0x39')]?_0x1a364c['attributes']:_0x178e82[_0xb2de('0x2a')];if(_0x57e268['query'][_0xb2de('0x3a')]){_0x1a364c[_0xb2de('0x37')]=[{'all':!![]}];}_0x1a364c=_[_0xb2de('0x35')]({},_0x1a364c,_0x57e268[_0xb2de('0x36')]);return db[_0xb2de('0x26')][_0xb2de('0x3b')](_0x1a364c)['then'](handleEntityNotFound(_0x2f85f5,null))[_0xb2de('0x1f')](respondWithResult(_0x2f85f5,null))[_0xb2de('0x3c')](handleError(_0x2f85f5,null));};exports[_0xb2de('0x3d')]=function(_0x5f9144,_0x159485){return db[_0xb2de('0x26')]['create'](_0x5f9144[_0xb2de('0x3e')],{})[_0xb2de('0x1f')](respondWithResult(_0x159485,0xc9))['catch'](handleError(_0x159485,null));};exports[_0xb2de('0x3f')]=function(_0x2d5dfb,_0x29d7d6){if(_0x2d5dfb[_0xb2de('0x3e')]['id']){delete _0x2d5dfb[_0xb2de('0x3e')]['id'];}return db['ZendeskField'][_0xb2de('0x3b')]({'where':{'id':_0x2d5dfb[_0xb2de('0x40')]['id']}})['then'](handleEntityNotFound(_0x29d7d6,null))[_0xb2de('0x1f')](saveUpdates(_0x2d5dfb[_0xb2de('0x3e')],null))[_0xb2de('0x1f')](respondWithResult(_0x29d7d6,null))[_0xb2de('0x3c')](handleError(_0x29d7d6,null));};exports[_0xb2de('0x20')]=function(_0x33e1b7,_0x1befd6){return db['ZendeskField'][_0xb2de('0x3b')]({'where':{'id':_0x33e1b7[_0xb2de('0x40')]['id']}})[_0xb2de('0x1f')](handleEntityNotFound(_0x1befd6,null))[_0xb2de('0x1f')](removeEntity(_0x1befd6,null))[_0xb2de('0x3c')](handleError(_0x1befd6,null));}; \ No newline at end of file +var _0x969d=['offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','index','map','ZendeskField','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x5a6a1c,_0xb802eb){var _0x132a0e=function(_0x4c3280){while(--_0x4c3280){_0x5a6a1c['push'](_0x5a6a1c['shift']());}};_0x132a0e(++_0xb802eb);}(_0x969d,0x76));var _0xd969=function(_0x3a2c95,_0x5a72fd){_0x3a2c95=_0x3a2c95-0x0;var _0x46b46d=_0x969d[_0x3a2c95];return _0x46b46d;};'use strict';var emlformat=require(_0xd969('0x0'));var rimraf=require(_0xd969('0x1'));var zipdir=require(_0xd969('0x2'));var jsonpatch=require(_0xd969('0x3'));var rp=require(_0xd969('0x4'));var moment=require(_0xd969('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd969('0x6'));var util=require(_0xd969('0x7'));var path=require('path');var sox=require(_0xd969('0x8'));var csv=require(_0xd969('0x9'));var ejs=require(_0xd969('0xa'));var fs=require('fs');var fs_extra=require(_0xd969('0xb'));var _=require(_0xd969('0xc'));var squel=require(_0xd969('0xd'));var crypto=require(_0xd969('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd969('0x9'));var querystring=require(_0xd969('0xf'));var Papa=require('papaparse');var Redis=require(_0xd969('0x10'));var authService=require(_0xd969('0x11'));var qs=require(_0xd969('0x12'));var as=require(_0xd969('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd969('0x14'));var utils=require(_0xd969('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd969('0x16'));var db=require(_0xd969('0x17'))['db'];function respondWithStatusCode(_0x2c8dd1,_0x5d1be3){_0x5d1be3=_0x5d1be3||0xcc;return function(_0x3b2c74){if(_0x3b2c74){return _0x2c8dd1[_0xd969('0x18')](_0x5d1be3);}return _0x2c8dd1[_0xd969('0x19')](_0x5d1be3)[_0xd969('0x1a')]();};}function respondWithResult(_0x34884f,_0x285915){_0x285915=_0x285915||0xc8;return function(_0x2dd616){if(_0x2dd616){return _0x34884f[_0xd969('0x19')](_0x285915)[_0xd969('0x1b')](_0x2dd616);}};}function respondWithFilteredResult(_0x1086e7,_0x3a1856){return function(_0x1034ff){if(_0x1034ff){var _0x25412c=typeof _0x3a1856[_0xd969('0x1c')]===_0xd969('0x1d')&&typeof _0x3a1856[_0xd969('0x1e')]===_0xd969('0x1d');var _0x4de49a=_0x1034ff[_0xd969('0x1f')];var _0x31e23c=_0x25412c?0x0:_0x3a1856['offset'];var _0x4e47a2=_0x25412c?_0x1034ff[_0xd969('0x1f')]:_0x3a1856[_0xd969('0x1c')]+_0x3a1856[_0xd969('0x1e')];var _0x134df0;if(_0x4e47a2>=_0x4de49a){_0x4e47a2=_0x4de49a;_0x134df0=0xc8;}else{_0x134df0=0xce;}_0x1086e7['status'](_0x134df0);return _0x1086e7[_0xd969('0x20')](_0xd969('0x21'),_0x31e23c+'-'+_0x4e47a2+'/'+_0x4de49a)[_0xd969('0x1b')](_0x1034ff);}return null;};}function patchUpdates(_0x22cafb){return function(_0x3f3d51){try{jsonpatch[_0xd969('0x22')](_0x3f3d51,_0x22cafb,!![]);}catch(_0x543b7b){return BPromise[_0xd969('0x23')](_0x543b7b);}return _0x3f3d51['save']();};}function saveUpdates(_0x456b83,_0x347c7d){return function(_0x15f671){if(_0x15f671){return _0x15f671['update'](_0x456b83)[_0xd969('0x24')](function(_0x358b71){return _0x358b71;});}return null;};}function removeEntity(_0x1d7242,_0x558f2b){return function(_0x569c1f){if(_0x569c1f){return _0x569c1f[_0xd969('0x25')]()[_0xd969('0x24')](function(){_0x1d7242['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ff51a,_0x7da9cd){return function(_0x2b2c4d){if(!_0x2b2c4d){_0x3ff51a[_0xd969('0x18')](0x194);}return _0x2b2c4d;};}function handleError(_0x218476,_0x540cfd){_0x540cfd=_0x540cfd||0x1f4;return function(_0x2879a5){logger[_0xd969('0x26')](_0x2879a5[_0xd969('0x27')]);if(_0x2879a5[_0xd969('0x28')]){delete _0x2879a5[_0xd969('0x28')];}_0x218476[_0xd969('0x19')](_0x540cfd)['send'](_0x2879a5);};}exports[_0xd969('0x29')]=function(_0x637086,_0x3e5785){var _0x58cda0={},_0x4d4aef={},_0x19e930={'count':0x0,'rows':[]};var _0x34b4ad=_[_0xd969('0x2a')](db[_0xd969('0x2b')]['rawAttributes'],function(_0x2c82b3){return{'name':_0x2c82b3['fieldName'],'type':_0x2c82b3[_0xd969('0x2c')][_0xd969('0x2d')]};});_0x4d4aef[_0xd969('0x2e')]=_[_0xd969('0x2a')](_0x34b4ad,_0xd969('0x28'));_0x4d4aef['query']=_[_0xd969('0x2f')](_0x637086[_0xd969('0x30')]);_0x4d4aef[_0xd969('0x31')]=_[_0xd969('0x32')](_0x4d4aef[_0xd969('0x2e')],_0x4d4aef[_0xd969('0x30')]);_0x58cda0[_0xd969('0x33')]=_['intersection'](_0x4d4aef['model'],qs[_0xd969('0x34')](_0x637086[_0xd969('0x30')][_0xd969('0x34')]));_0x58cda0[_0xd969('0x33')]=_0x58cda0[_0xd969('0x33')]['length']?_0x58cda0[_0xd969('0x33')]:_0x4d4aef[_0xd969('0x2e')];if(!_0x637086[_0xd969('0x30')][_0xd969('0x35')](_0xd969('0x36'))){_0x58cda0[_0xd969('0x1e')]=qs[_0xd969('0x1e')](_0x637086[_0xd969('0x30')][_0xd969('0x1e')]);_0x58cda0['offset']=qs[_0xd969('0x1c')](_0x637086['query'][_0xd969('0x1c')]);}_0x58cda0['order']=qs['sort'](_0x637086[_0xd969('0x30')][_0xd969('0x37')]);_0x58cda0[_0xd969('0x38')]=qs['filters'](_[_0xd969('0x39')](_0x637086['query'],_0x4d4aef[_0xd969('0x31')]),_0x34b4ad);if(_0x637086['query']['filter']){_0x58cda0[_0xd969('0x38')]=_[_0xd969('0x3a')](_0x58cda0[_0xd969('0x38')],{'$or':_[_0xd969('0x2a')](_0x34b4ad,function(_0x3c6eee){if(_0x3c6eee[_0xd969('0x2c')]!==_0xd969('0x3b')){var _0x2a33e0={};_0x2a33e0[_0x3c6eee['name']]={'$like':'%'+_0x637086[_0xd969('0x30')][_0xd969('0x3c')]+'%'};return _0x2a33e0;}})});}_0x58cda0=_['merge']({},_0x58cda0,_0x637086[_0xd969('0x3d')]);var _0x388bbb={'where':_0x58cda0[_0xd969('0x38')]};return db['ZendeskField'][_0xd969('0x1f')](_0x388bbb)[_0xd969('0x24')](function(_0x328be8){_0x19e930[_0xd969('0x1f')]=_0x328be8;if(_0x637086['query'][_0xd969('0x3e')]){_0x58cda0[_0xd969('0x3f')]=[{'all':!![]}];}return db['ZendeskField'][_0xd969('0x40')](_0x58cda0);})['then'](function(_0x3b7b87){_0x19e930['rows']=_0x3b7b87;return _0x19e930;})[_0xd969('0x24')](respondWithFilteredResult(_0x3e5785,_0x58cda0))[_0xd969('0x41')](handleError(_0x3e5785,null));};exports[_0xd969('0x42')]=function(_0x11a6e6,_0x2705dc){var _0x5aaea6={'raw':!![],'where':{'id':_0x11a6e6[_0xd969('0x43')]['id']}},_0x2b940e={};_0x2b940e[_0xd969('0x2e')]=_[_0xd969('0x2f')](db['ZendeskField'][_0xd969('0x44')]);_0x2b940e[_0xd969('0x30')]=_[_0xd969('0x2f')](_0x11a6e6[_0xd969('0x30')]);_0x2b940e[_0xd969('0x31')]=_[_0xd969('0x32')](_0x2b940e['model'],_0x2b940e[_0xd969('0x30')]);_0x5aaea6[_0xd969('0x33')]=_[_0xd969('0x32')](_0x2b940e['model'],qs[_0xd969('0x34')](_0x11a6e6[_0xd969('0x30')][_0xd969('0x34')]));_0x5aaea6[_0xd969('0x33')]=_0x5aaea6[_0xd969('0x33')]['length']?_0x5aaea6['attributes']:_0x2b940e[_0xd969('0x2e')];if(_0x11a6e6[_0xd969('0x30')][_0xd969('0x3e')]){_0x5aaea6['include']=[{'all':!![]}];}_0x5aaea6=_[_0xd969('0x3a')]({},_0x5aaea6,_0x11a6e6[_0xd969('0x3d')]);return db['ZendeskField'][_0xd969('0x45')](_0x5aaea6)[_0xd969('0x24')](handleEntityNotFound(_0x2705dc,null))[_0xd969('0x24')](respondWithResult(_0x2705dc,null))[_0xd969('0x41')](handleError(_0x2705dc,null));};exports['create']=function(_0x4a3488,_0x368dc5){return db[_0xd969('0x2b')][_0xd969('0x46')](_0x4a3488[_0xd969('0x47')],{})['then'](respondWithResult(_0x368dc5,0xc9))['catch'](handleError(_0x368dc5,null));};exports[_0xd969('0x48')]=function(_0x22c5e4,_0x56ba6e){if(_0x22c5e4[_0xd969('0x47')]['id']){delete _0x22c5e4['body']['id'];}return db[_0xd969('0x2b')][_0xd969('0x45')]({'where':{'id':_0x22c5e4[_0xd969('0x43')]['id']}})[_0xd969('0x24')](handleEntityNotFound(_0x56ba6e,null))[_0xd969('0x24')](saveUpdates(_0x22c5e4['body'],null))['then'](respondWithResult(_0x56ba6e,null))[_0xd969('0x41')](handleError(_0x56ba6e,null));};exports['destroy']=function(_0x32eb2f,_0x3bed93){return db['ZendeskField'][_0xd969('0x45')]({'where':{'id':_0x32eb2f[_0xd969('0x43')]['id']}})[_0xd969('0x24')](handleEntityNotFound(_0x3bed93,null))[_0xd969('0x24')](removeEntity(_0x3bed93,null))[_0xd969('0x41')](handleError(_0x3bed93,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 3a18c30..93e973a 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 _0x57ab=['path','rimraf','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x30213a,_0x2160e3){var _0x1beae9=function(_0x4bd53d){while(--_0x4bd53d){_0x30213a['push'](_0x30213a['shift']());}};_0x1beae9(++_0x2160e3);}(_0x57ab,0xae));var _0xb57a=function(_0x344eb8,_0x12a8a5){_0x344eb8=_0x344eb8-0x0;var _0x3f197c=_0x57ab[_0x344eb8];return _0x3f197c;};'use strict';var _=require(_0xb57a('0x0'));var util=require(_0xb57a('0x1'));var logger=require(_0xb57a('0x2'))(_0xb57a('0x3'));var moment=require('moment');var BPromise=require(_0xb57a('0x4'));var rp=require(_0xb57a('0x5'));var fs=require('fs');var path=require(_0xb57a('0x6'));var rimraf=require(_0xb57a('0x7'));var config=require('../../config/environment');var attributes=require(_0xb57a('0x8'));module[_0xb57a('0x9')]=function(_0x3323cd,_0x549619){return _0x3323cd[_0xb57a('0xa')](_0xb57a('0xb'),attributes,{'tableName':_0xb57a('0xc'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xb57a('0xd'),_0xb57a('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa170=['exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes'];(function(_0x393abb,_0x2467a2){var _0x2309e6=function(_0x44c6db){while(--_0x44c6db){_0x393abb['push'](_0x393abb['shift']());}};_0x2309e6(++_0x2467a2);}(_0xa170,0x149));var _0x0a17=function(_0x1d7e81,_0x113110){_0x1d7e81=_0x1d7e81-0x0;var _0x16479b=_0xa170[_0x1d7e81];return _0x16479b;};'use strict';var _=require(_0x0a17('0x0'));var util=require(_0x0a17('0x1'));var logger=require(_0x0a17('0x2'))(_0x0a17('0x3'));var moment=require(_0x0a17('0x4'));var BPromise=require(_0x0a17('0x5'));var rp=require(_0x0a17('0x6'));var fs=require('fs');var path=require(_0x0a17('0x7'));var rimraf=require(_0x0a17('0x8'));var config=require(_0x0a17('0x9'));var attributes=require(_0x0a17('0xa'));module[_0x0a17('0xb')]=function(_0x4b916a,_0x1c43f1){return _0x4b916a[_0x0a17('0xc')](_0x0a17('0xd'),attributes,{'tableName':_0x0a17('0xe'),'paranoid':![],'indexes':[{'name':_0x0a17('0xf'),'fields':[_0x0a17('0x10'),'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 e6c9210..42766af 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 _0xcc36=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x1bb6ce,_0x42997b){var _0x28514a=function(_0xb6353){while(--_0xb6353){_0x1bb6ce['push'](_0x1bb6ce['shift']());}};_0x28514a(++_0x42997b);}(_0xcc36,0x1a2));var _0x6cc3=function(_0x45c072,_0x21bb48){_0x45c072=_0x45c072-0x0;var _0x465404=_0xcc36[_0x45c072];return _0x465404;};'use strict';var _=require(_0x6cc3('0x0'));var util=require(_0x6cc3('0x1'));var moment=require(_0x6cc3('0x2'));var BPromise=require(_0x6cc3('0x3'));var rs=require(_0x6cc3('0x4'));var fs=require('fs');var Redis=require(_0x6cc3('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6cc3('0x6'));var logger=require(_0x6cc3('0x7'))(_0x6cc3('0x8'));var config=require(_0x6cc3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6cc3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35eae1,_0x11c189,_0x50306a){return new BPromise(function(_0x31bf86,_0x4b8f4a){return client[_0x6cc3('0xb')](_0x35eae1,_0x50306a)[_0x6cc3('0xc')](function(_0x38ef3f){logger['info'](_0x6cc3('0xd'),_0x11c189,_0x6cc3('0xe'));logger[_0x6cc3('0xf')](_0x6cc3('0x10'),_0x11c189,'request\x20sent',JSON[_0x6cc3('0x11')](_0x38ef3f));if(_0x38ef3f['error']){if(_0x38ef3f[_0x6cc3('0x12')][_0x6cc3('0x13')]===0x1f4){logger['error']('ZendeskField,\x20%s,\x20%s',_0x11c189,_0x38ef3f[_0x6cc3('0x12')][_0x6cc3('0x14')]);return _0x4b8f4a(_0x38ef3f[_0x6cc3('0x12')][_0x6cc3('0x14')]);}logger[_0x6cc3('0x12')]('ZendeskField,\x20%s,\x20%s',_0x11c189,_0x38ef3f[_0x6cc3('0x12')]['message']);return _0x31bf86(_0x38ef3f['error'][_0x6cc3('0x14')]);}else{logger[_0x6cc3('0x15')](_0x6cc3('0xd'),_0x11c189,_0x6cc3('0xe'));_0x31bf86(_0x38ef3f['result'][_0x6cc3('0x14')]);}})['catch'](function(_0x31f4e1){logger['error'](_0x6cc3('0xd'),_0x11c189,_0x31f4e1);_0x4b8f4a(_0x31f4e1);});});} \ No newline at end of file +var _0x41d2=['client','http','then','ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0x4845bc,_0x25e144){var _0x82713d=function(_0x4ec9b4){while(--_0x4ec9b4){_0x4845bc['push'](_0x4845bc['shift']());}};_0x82713d(++_0x25e144);}(_0x41d2,0xdc));var _0x241d=function(_0x484c03,_0x13c1d2){_0x484c03=_0x484c03-0x0;var _0x294127=_0x41d2[_0x484c03];return _0x294127;};'use strict';var _=require(_0x241d('0x0'));var util=require(_0x241d('0x1'));var moment=require(_0x241d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x241d('0x3'));var db=require(_0x241d('0x4'))['db'];var utils=require(_0x241d('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x241d('0x6'));var jayson=require(_0x241d('0x7'));var client=jayson[_0x241d('0x8')][_0x241d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x354f01,_0x279edc,_0x20bc57){return new BPromise(function(_0x4b19da,_0x8968a3){return client['request'](_0x354f01,_0x20bc57)[_0x241d('0xa')](function(_0x13b7b2){logger['info'](_0x241d('0xb'),_0x279edc,_0x241d('0xc'));logger['debug'](_0x241d('0xd'),_0x279edc,_0x241d('0xc'),JSON[_0x241d('0xe')](_0x13b7b2));if(_0x13b7b2['error']){if(_0x13b7b2['error'][_0x241d('0xf')]===0x1f4){logger[_0x241d('0x10')](_0x241d('0xb'),_0x279edc,_0x13b7b2[_0x241d('0x10')]['message']);return _0x8968a3(_0x13b7b2['error'][_0x241d('0x11')]);}logger['error'](_0x241d('0xb'),_0x279edc,_0x13b7b2[_0x241d('0x10')][_0x241d('0x11')]);return _0x4b19da(_0x13b7b2[_0x241d('0x10')]['message']);}else{logger['info'](_0x241d('0xb'),_0x279edc,'request\x20sent');_0x4b19da(_0x13b7b2['result']['message']);}})[_0x241d('0x12')](function(_0x475396){logger['error']('ZendeskField,\x20%s,\x20%s',_0x279edc,_0x475396);_0x8968a3(_0x475396);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index fbf31f9..b87cd22 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 _0xe77a=['update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./intZohoAccount.controller','get','index','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','post','addConfiguration','put'];(function(_0x161468,_0x59f664){var _0x1fc29f=function(_0x36ede2){while(--_0x36ede2){_0x161468['push'](_0x161468['shift']());}};_0x1fc29f(++_0x59f664);}(_0xe77a,0x1d1));var _0xae77=function(_0x5c663a,_0x7424){_0x5c663a=_0x5c663a-0x0;var _0x3309ec=_0xe77a[_0x5c663a];return _0x3309ec;};'use strict';var multer=require(_0xae77('0x0'));var util=require(_0xae77('0x1'));var path=require(_0xae77('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xae77('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xae77('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xae77('0x5'));var controller=require(_0xae77('0x6'));router[_0xae77('0x7')]('/',auth['isAuthenticated'](),controller[_0xae77('0x8')]);router['get'](_0xae77('0x9'),auth['isAuthenticated'](),controller[_0xae77('0xa')]);router[_0xae77('0x7')](_0xae77('0xb'),auth[_0xae77('0xc')](),controller[_0xae77('0xd')]);router[_0xae77('0x7')](_0xae77('0xe'),auth[_0xae77('0xc')](),controller[_0xae77('0xf')]);router['post']('/',auth[_0xae77('0xc')](),controller['create']);router[_0xae77('0x10')](_0xae77('0xb'),auth[_0xae77('0xc')](),controller[_0xae77('0x11')]);router[_0xae77('0x12')](_0xae77('0x9'),auth['isAuthenticated'](),controller[_0xae77('0x13')]);router['delete'](_0xae77('0x9'),auth[_0xae77('0xc')](),controller[_0xae77('0x14')]);module[_0xae77('0x15')]=router; \ No newline at end of file +var _0x0819=['get','isAuthenticated','index','/:id','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x453f62,_0x20e2a7){var _0x50fcc2=function(_0x1aba5c){while(--_0x1aba5c){_0x453f62['push'](_0x453f62['shift']());}};_0x50fcc2(++_0x20e2a7);}(_0x0819,0x13a));var _0x9081=function(_0x563ddb,_0x38319a){_0x563ddb=_0x563ddb-0x0;var _0x17177d=_0x0819[_0x563ddb];return _0x17177d;};'use strict';var multer=require(_0x9081('0x0'));var util=require(_0x9081('0x1'));var path=require('path');var timeout=require(_0x9081('0x2'));var express=require('express');var router=express[_0x9081('0x3')]();var fs_extra=require(_0x9081('0x4'));var auth=require(_0x9081('0x5'));var interaction=require(_0x9081('0x6'));var config=require(_0x9081('0x7'));var controller=require('./intZohoAccount.controller');router[_0x9081('0x8')]('/',auth[_0x9081('0x9')](),controller[_0x9081('0xa')]);router['get'](_0x9081('0xb'),auth[_0x9081('0x9')](),controller['show']);router[_0x9081('0x8')]('/:id/configurations',auth[_0x9081('0x9')](),controller[_0x9081('0xc')]);router[_0x9081('0x8')](_0x9081('0xd'),auth['isAuthenticated'](),controller[_0x9081('0xe')]);router[_0x9081('0xf')]('/',auth['isAuthenticated'](),controller[_0x9081('0x10')]);router['post'](_0x9081('0x11'),auth[_0x9081('0x9')](),controller[_0x9081('0x12')]);router['put'](_0x9081('0xb'),auth['isAuthenticated'](),controller[_0x9081('0x13')]);router[_0x9081('0x14')](_0x9081('0xb'),auth[_0x9081('0x9')](),controller[_0x9081('0x15')]);module[_0x9081('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 07f30d3..b11a412 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 _0xf109=['exports','STRING','sequelize'];(function(_0x431550,_0x50da74){var _0x33dcd8=function(_0x3ef39c){while(--_0x3ef39c){_0x431550['push'](_0x431550['shift']());}};_0x33dcd8(++_0x50da74);}(_0xf109,0xce));var _0x9f10=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xf109[_0x35885a];return _0xe86249;};'use strict';var Sequelize=require(_0x9f10('0x0'));module[_0x9f10('0x1')]={'name':{'type':Sequelize[_0x9f10('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x9f10('0x2')]},'clientSecret':{'type':Sequelize[_0x9f10('0x2')]},'serverUrl':{'type':Sequelize[_0x9f10('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x9f10('0x2')]},'refreshToken':{'type':Sequelize[_0x9f10('0x2')]}}; \ No newline at end of file +var _0xa8a8=['exports','STRING','sequelize'];(function(_0xc414aa,_0x1f31cb){var _0x322352=function(_0x19150e){while(--_0x19150e){_0xc414aa['push'](_0xc414aa['shift']());}};_0x322352(++_0x1f31cb);}(_0xa8a8,0xec));var _0x8a8a=function(_0xbd6c2a,_0x560bba){_0xbd6c2a=_0xbd6c2a-0x0;var _0x3192ec=_0xa8a8[_0xbd6c2a];return _0x3192ec;};'use strict';var Sequelize=require(_0x8a8a('0x0'));module[_0x8a8a('0x1')]={'name':{'type':Sequelize[_0x8a8a('0x2')]},'description':{'type':Sequelize[_0x8a8a('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x8a8a('0x2')]},'clientId':{'type':Sequelize[_0x8a8a('0x2')]},'clientSecret':{'type':Sequelize[_0x8a8a('0x2')]},'serverUrl':{'type':Sequelize[_0x8a8a('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x8a8a('0x2')]},'refreshToken':{'type':Sequelize[_0x8a8a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 26c5143..d109b87 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 _0xb72f=['sox','to-csv','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../components/integrations/configuration','status','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','ZohoAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','find','catch','create','body','getConfigurations','findOne','addConfiguration','AccountId','getSubjects','channel','Descriptions','ZohoConfiguration','ZohoField','Subjects','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Start_Time','Call_Type','includes','api_name','system_mandatory','display_label','data_type','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path'];(function(_0x21c068,_0x369d6a){var _0x5cf199=function(_0x2c0159){while(--_0x2c0159){_0x21c068['push'](_0x21c068['shift']());}};_0x5cf199(++_0x369d6a);}(_0xb72f,0x161));var _0xfb72=function(_0x258919,_0x1754e6){_0x258919=_0x258919-0x0;var _0xfbd68b=_0xb72f[_0x258919];return _0xfbd68b;};'use strict';var emlformat=require(_0xfb72('0x0'));var rimraf=require(_0xfb72('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfb72('0x2'));var rp=require(_0xfb72('0x3'));var moment=require(_0xfb72('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfb72('0x5'));var path=require(_0xfb72('0x6'));var sox=require(_0xfb72('0x7'));var csv=require(_0xfb72('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfb72('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfb72('0xa'));var deskjs=require(_0xfb72('0xb'));var toCsv=require(_0xfb72('0x8'));var querystring=require('querystring');var Papa=require(_0xfb72('0xc'));var Redis=require(_0xfb72('0xd'));var authService=require(_0xfb72('0xe'));var qs=require(_0xfb72('0xf'));var as=require(_0xfb72('0x10'));var hardwareService=require(_0xfb72('0x11'));var logger=require(_0xfb72('0x12'))('api');var utils=require(_0xfb72('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xfb72('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0xfb72('0x15'));function respondWithStatusCode(_0x2b19d5,_0x4e34ef){_0x4e34ef=_0x4e34ef||0xcc;return function(_0x2ace1a){if(_0x2ace1a){return _0x2b19d5['sendStatus'](_0x4e34ef);}return _0x2b19d5['status'](_0x4e34ef)['end']();};}function respondWithResult(_0x522847,_0x4344df){_0x4344df=_0x4344df||0xc8;return function(_0x2f2b9f){if(_0x2f2b9f){return _0x522847[_0xfb72('0x16')](_0x4344df)['json'](_0x2f2b9f);}};}function respondWithFilteredResult(_0x505feb,_0xdd755e){return function(_0x5ddf92){if(_0x5ddf92){var _0x5e53e5=typeof _0xdd755e[_0xfb72('0x17')]==='undefined'&&typeof _0xdd755e[_0xfb72('0x18')]==='undefined';var _0xc4a8f7=_0x5ddf92['count'];var _0x159be0=_0x5e53e5?0x0:_0xdd755e[_0xfb72('0x17')];var _0x41d331=_0x5e53e5?_0x5ddf92[_0xfb72('0x19')]:_0xdd755e[_0xfb72('0x17')]+_0xdd755e[_0xfb72('0x18')];var _0x4aacc2;if(_0x41d331>=_0xc4a8f7){_0x41d331=_0xc4a8f7;_0x4aacc2=0xc8;}else{_0x4aacc2=0xce;}_0x505feb['status'](_0x4aacc2);return _0x505feb[_0xfb72('0x1a')](_0xfb72('0x1b'),_0x159be0+'-'+_0x41d331+'/'+_0xc4a8f7)['json'](_0x5ddf92);}return null;};}function patchUpdates(_0x2a8aab){return function(_0x3f79f7){try{jsonpatch[_0xfb72('0x1c')](_0x3f79f7,_0x2a8aab,!![]);}catch(_0x1f3428){return BPromise[_0xfb72('0x1d')](_0x1f3428);}return _0x3f79f7[_0xfb72('0x1e')]();};}function saveUpdates(_0x351e16,_0xc99554){return function(_0xd7968a){if(_0xd7968a){return _0xd7968a[_0xfb72('0x1f')](_0x351e16)[_0xfb72('0x20')](function(_0x132efc){return _0x132efc;});}return null;};}function removeEntity(_0x76f72c,_0x85146f){return function(_0x2d85bd){if(_0x2d85bd){return _0x2d85bd[_0xfb72('0x21')]()[_0xfb72('0x20')](function(){_0x76f72c[_0xfb72('0x16')](0xcc)[_0xfb72('0x22')]();});}};}function handleEntityNotFound(_0x184737,_0x544b44){return function(_0x400c0e){if(!_0x400c0e){_0x184737['sendStatus'](0x194);}return _0x400c0e;};}function handleError(_0x478fb7,_0x5a8bcc){_0x5a8bcc=_0x5a8bcc||0x1f4;return function(_0x3efe56){logger[_0xfb72('0x23')](_0x3efe56[_0xfb72('0x24')]);if(_0x3efe56[_0xfb72('0x25')]){delete _0x3efe56[_0xfb72('0x25')];}_0x478fb7[_0xfb72('0x16')](_0x5a8bcc)[_0xfb72('0x26')](_0x3efe56);};}exports['index']=function(_0x529430,_0x9b9a4b){var _0x1085f0={},_0x4cb2d={},_0x190a74={'count':0x0,'rows':[]};var _0x4ad94c=_[_0xfb72('0x27')](db[_0xfb72('0x28')][_0xfb72('0x29')],function(_0x4fd837){return{'name':_0x4fd837[_0xfb72('0x2a')],'type':_0x4fd837[_0xfb72('0x2b')][_0xfb72('0x2c')]};});_0x4cb2d[_0xfb72('0x2d')]=_[_0xfb72('0x27')](_0x4ad94c,'name');_0x4cb2d[_0xfb72('0x2e')]=_[_0xfb72('0x2f')](_0x529430[_0xfb72('0x2e')]);_0x4cb2d['filters']=_[_0xfb72('0x30')](_0x4cb2d[_0xfb72('0x2d')],_0x4cb2d[_0xfb72('0x2e')]);_0x1085f0[_0xfb72('0x31')]=_[_0xfb72('0x30')](_0x4cb2d['model'],qs[_0xfb72('0x32')](_0x529430['query']['fields']));_0x1085f0['attributes']=_0x1085f0[_0xfb72('0x31')][_0xfb72('0x33')]?_0x1085f0[_0xfb72('0x31')]:_0x4cb2d['model'];if(!_0x529430[_0xfb72('0x2e')][_0xfb72('0x34')]('nolimit')){_0x1085f0[_0xfb72('0x18')]=qs[_0xfb72('0x18')](_0x529430[_0xfb72('0x2e')][_0xfb72('0x18')]);_0x1085f0[_0xfb72('0x17')]=qs['offset'](_0x529430['query'][_0xfb72('0x17')]);}_0x1085f0[_0xfb72('0x35')]=qs['sort'](_0x529430[_0xfb72('0x2e')][_0xfb72('0x36')]);_0x1085f0[_0xfb72('0x37')]=qs[_0xfb72('0x38')](_[_0xfb72('0x39')](_0x529430[_0xfb72('0x2e')],_0x4cb2d[_0xfb72('0x38')]),_0x4ad94c);if(_0x529430['query']['filter']){_0x1085f0[_0xfb72('0x37')]=_[_0xfb72('0x3a')](_0x1085f0[_0xfb72('0x37')],{'$or':_[_0xfb72('0x27')](_0x4ad94c,function(_0x4f45ad){if(_0x4f45ad[_0xfb72('0x2b')]!==_0xfb72('0x3b')){var _0x37840f={};_0x37840f[_0x4f45ad[_0xfb72('0x25')]]={'$like':'%'+_0x529430['query']['filter']+'%'};return _0x37840f;}})});}_0x1085f0=_[_0xfb72('0x3a')]({},_0x1085f0,_0x529430[_0xfb72('0x3c')]);var _0x17efbe={'where':_0x1085f0[_0xfb72('0x37')]};return db[_0xfb72('0x28')][_0xfb72('0x19')](_0x17efbe)[_0xfb72('0x20')](function(_0x293cfc){_0x190a74[_0xfb72('0x19')]=_0x293cfc;if(_0x529430['query'][_0xfb72('0x3d')]){_0x1085f0['include']=[{'all':!![]}];}return db['ZohoAccount'][_0xfb72('0x3e')](_0x1085f0);})[_0xfb72('0x20')](function(_0x4b740f){_0x190a74[_0xfb72('0x3f')]=_0x4b740f;return _0x190a74;})[_0xfb72('0x20')](respondWithFilteredResult(_0x9b9a4b,_0x1085f0))['catch'](handleError(_0x9b9a4b,null));};exports[_0xfb72('0x40')]=function(_0x56e9ff,_0x2223c8){var _0x28ce77={'raw':![],'where':{'id':_0x56e9ff[_0xfb72('0x41')]['id']}},_0x121d2c={};_0x121d2c[_0xfb72('0x2d')]=_[_0xfb72('0x2f')](db[_0xfb72('0x28')][_0xfb72('0x29')]);_0x121d2c['query']=_[_0xfb72('0x2f')](_0x56e9ff[_0xfb72('0x2e')]);_0x121d2c[_0xfb72('0x38')]=_['intersection'](_0x121d2c[_0xfb72('0x2d')],_0x121d2c['query']);_0x28ce77[_0xfb72('0x31')]=_[_0xfb72('0x30')](_0x121d2c[_0xfb72('0x2d')],qs['fields'](_0x56e9ff[_0xfb72('0x2e')][_0xfb72('0x32')]));_0x28ce77['attributes']=_0x28ce77[_0xfb72('0x31')][_0xfb72('0x33')]?_0x28ce77[_0xfb72('0x31')]:_0x121d2c[_0xfb72('0x2d')];if(_0x56e9ff['query']['includeAll']){_0x28ce77['include']=[{'all':!![]}];}_0x28ce77=_[_0xfb72('0x3a')]({},_0x28ce77,_0x56e9ff[_0xfb72('0x3c')]);return db[_0xfb72('0x28')][_0xfb72('0x42')](_0x28ce77)[_0xfb72('0x20')](handleEntityNotFound(_0x2223c8,null))['then'](respondWithResult(_0x2223c8,null))[_0xfb72('0x43')](handleError(_0x2223c8,null));};exports['create']=function(_0x2609b3,_0x30ef66){return db[_0xfb72('0x28')][_0xfb72('0x44')](_0x2609b3[_0xfb72('0x45')],{})['then'](respondWithResult(_0x30ef66,0xc9))[_0xfb72('0x43')](handleError(_0x30ef66,null));};exports['update']=function(_0x5c22c0,_0x15b3c6){if(_0x5c22c0['body']['id']){delete _0x5c22c0['body']['id'];}return db[_0xfb72('0x28')][_0xfb72('0x42')]({'where':{'id':_0x5c22c0[_0xfb72('0x41')]['id']}})[_0xfb72('0x20')](handleEntityNotFound(_0x15b3c6,null))[_0xfb72('0x20')](saveUpdates(_0x5c22c0[_0xfb72('0x45')],null))[_0xfb72('0x20')](respondWithResult(_0x15b3c6,null))['catch'](handleError(_0x15b3c6,null));};exports[_0xfb72('0x21')]=function(_0x596bf0,_0x12de4e){return db['ZohoAccount'][_0xfb72('0x42')]({'where':{'id':_0x596bf0[_0xfb72('0x41')]['id']}})[_0xfb72('0x20')](handleEntityNotFound(_0x12de4e,null))[_0xfb72('0x20')](removeEntity(_0x12de4e,null))[_0xfb72('0x43')](handleError(_0x12de4e,null));};exports[_0xfb72('0x46')]=function(_0x41a698,_0x12fd1a,_0x47a154){var _0x57dee8={};var _0x3b3aee={};var _0x451b6d;var _0x1e4a3a;return db['ZohoAccount'][_0xfb72('0x47')]({'where':{'id':_0x41a698['params']['id']}})[_0xfb72('0x20')](handleEntityNotFound(_0x12fd1a,null))[_0xfb72('0x20')](function(_0x5eddb1){if(_0x5eddb1){_0x451b6d=_0x5eddb1;_0x3b3aee['model']=_[_0xfb72('0x2f')](db['ZohoConfiguration'][_0xfb72('0x29')]);_0x3b3aee[_0xfb72('0x2e')]=_[_0xfb72('0x2f')](_0x41a698[_0xfb72('0x2e')]);_0x3b3aee[_0xfb72('0x38')]=_[_0xfb72('0x30')](_0x3b3aee[_0xfb72('0x2d')],_0x3b3aee[_0xfb72('0x2e')]);_0x57dee8[_0xfb72('0x31')]=_[_0xfb72('0x30')](_0x3b3aee[_0xfb72('0x2d')],qs[_0xfb72('0x32')](_0x41a698['query']['fields']));_0x57dee8['attributes']=_0x57dee8[_0xfb72('0x31')][_0xfb72('0x33')]?_0x57dee8[_0xfb72('0x31')]:_0x3b3aee['model'];_0x57dee8[_0xfb72('0x35')]=qs[_0xfb72('0x36')](_0x41a698[_0xfb72('0x2e')][_0xfb72('0x36')]);_0x57dee8[_0xfb72('0x37')]=qs[_0xfb72('0x38')](_[_0xfb72('0x39')](_0x41a698['query'],_0x3b3aee[_0xfb72('0x38')]));if(_0x41a698['query']['filter']){_0x57dee8['where']=_['merge'](_0x57dee8[_0xfb72('0x37')],{'$or':_[_0xfb72('0x27')](_0x57dee8[_0xfb72('0x31')],function(_0x184c83){var _0x4cb311={};_0x4cb311[_0x184c83]={'$like':'%'+_0x41a698[_0xfb72('0x2e')]['filter']+'%'};return _0x4cb311;})});}_0x57dee8=_[_0xfb72('0x3a')]({},_0x57dee8,_0x41a698[_0xfb72('0x3c')]);return _0x451b6d['getConfigurations'](_0x57dee8);}})[_0xfb72('0x20')](function(_0x4514fe){if(_0x4514fe){_0x1e4a3a=_0x4514fe[_0xfb72('0x33')];if(!_0x41a698[_0xfb72('0x2e')][_0xfb72('0x34')]('nolimit')){_0x57dee8[_0xfb72('0x18')]=qs['limit'](_0x41a698[_0xfb72('0x2e')]['limit']);_0x57dee8['offset']=qs[_0xfb72('0x17')](_0x41a698[_0xfb72('0x2e')][_0xfb72('0x17')]);}return _0x451b6d['getConfigurations'](_0x57dee8);}})[_0xfb72('0x20')](function(_0x183d44){if(_0x183d44){return _0x183d44?{'count':_0x1e4a3a,'rows':_0x183d44}:null;}})[_0xfb72('0x20')](respondWithResult(_0x12fd1a,null))['catch'](handleError(_0x12fd1a,null));};exports[_0xfb72('0x48')]=function(_0x7d7656,_0x13d1f8,_0x528a6b){if(_0x7d7656[_0xfb72('0x45')]['id']){delete _0x7d7656[_0xfb72('0x45')]['id'];}return db['ZohoAccount']['findOne']({'where':{'id':_0x7d7656['params']['id']}})[_0xfb72('0x20')](handleEntityNotFound(_0x13d1f8,null))[_0xfb72('0x20')](function(_0x4871d7){if(_0x4871d7){_0x7d7656[_0xfb72('0x45')][_0xfb72('0x49')]=_0x4871d7['id'];_0x7d7656['body']['Subjects']=integrations[_0xfb72('0x4a')](_0x7d7656['body'][_0xfb72('0x4b')],_0x7d7656[_0xfb72('0x45')][_0xfb72('0x2b')]);_0x7d7656[_0xfb72('0x45')][_0xfb72('0x4c')]=integrations['getDescriptions'](_0x7d7656[_0xfb72('0x45')]['channel'],_0x7d7656['body'][_0xfb72('0x2b')]);return db[_0xfb72('0x4d')]['create'](_0x7d7656[_0xfb72('0x45')],{'include':[{'model':db[_0xfb72('0x4e')],'as':_0xfb72('0x4f')},{'model':db[_0xfb72('0x4e')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x13d1f8,null))[_0xfb72('0x43')](handleError(_0x13d1f8,null));};function getAccessToken(_0x996d58){return new Promise(function(_0x419286,_0x42e011){var _0x37ab22;switch(_0x996d58['zone']){case'US':_0x37ab22=_0xfb72('0x50');break;case'AU':_0x37ab22=_0xfb72('0x51');break;case'EU':_0x37ab22=_0xfb72('0x52');break;case'IN':_0x37ab22=_0xfb72('0x53');break;case'CN':_0x37ab22='https://accounts.zoho.com.cn';break;default:_0x37ab22='https://accounts.zoho.eu';break;}var _0x3dc4f8={'method':_0xfb72('0x54'),'uri':_0x37ab22+'/oauth/v2/token','qs':{'refresh_token':_0x996d58['refreshToken'],'client_id':_0x996d58[_0xfb72('0x55')],'client_secret':_0x996d58[_0xfb72('0x56')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x3dc4f8)[_0xfb72('0x20')](function(_0x4a1c71){if(_0x4a1c71[_0xfb72('0x57')]){_0x419286(_0x4a1c71[_0xfb72('0x57')]);}else{_0x42e011(_0xfb72('0x58'));}})[_0xfb72('0x43')](function(_0x1a4969){_0x42e011(_0x1a4969);});});}exports[_0xfb72('0x59')]=function(_0x5a88a9,_0x57abb4,_0x280567){var _0x3d1082,_0x1032ff,_0x47879b,_0x5f0e00,_0x5bd8f2;return db[_0xfb72('0x28')][_0xfb72('0x47')]({'where':{'id':_0x5a88a9[_0xfb72('0x41')]['id']},'attributes':['id',_0xfb72('0x5a'),'zone',_0xfb72('0x55'),_0xfb72('0x56'),_0xfb72('0x5b'),_0xfb72('0x5c'),'refreshToken']})['then'](handleEntityNotFound(_0x57abb4,null))['then'](function(_0x25dad8){_0x5bd8f2=_0x25dad8;_0x3d1082=_0x5bd8f2['host'];_0x1032ff=_0x3d1082===_0xfb72('0x5d')?'eu':_0xfb72('0x5e');_0x47879b=_0x5bd8f2['serverUrl'];var _0x1d9f68=_0x47879b[_0xfb72('0x5f')](-0x1);if(_0x1d9f68==='/'||_0x1d9f68==='\x5c'||_0x1d9f68===':'){_0x47879b=_0x47879b[_0xfb72('0x60')](0x0,_0x47879b[_0xfb72('0x61')](_0x1d9f68));}if(!_0x5bd8f2['refreshToken']){throw new Error(_0xfb72('0x62'));}return getAccessToken(_0x5bd8f2);})[_0xfb72('0x20')](function(_0x486939){if(_0x486939){return rp({'method':'GET','uri':util[_0xfb72('0x63')](_0xfb72('0x64'),_0x1032ff),'qs':{'module':'Calls'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x486939},'json':!![]});}})[_0xfb72('0x20')](function(_0x3d58dc){if(_0x3d58dc){if(_0x3d58dc[_0xfb72('0x65')]&&_0x3d58dc[_0xfb72('0x65')]['error']){throw new Error(_0x3d58dc[_0xfb72('0x65')][_0xfb72('0x23')][_0xfb72('0x66')]);}var _0xff53f1=[];var _0x534685=[];var _0x12aa0c=[_0xfb72('0x67'),_0xfb72('0x68'),_0xfb72('0x69'),_0xfb72('0x6a'),_0xfb72('0x6b'),'Call_Result',_0xfb72('0x6c'),_0xfb72('0x6d')];_0x534685=_['remove'](_0x3d58dc[_0xfb72('0x32')],function(_0x24d349){return _0x12aa0c[_0xfb72('0x6e')](_0x24d349[_0xfb72('0x6f')]);});for(var _0x50679c=0x0;_0x50679c<_0x534685[_0xfb72('0x33')];_0x50679c++){if(_0x534685[_0x50679c][_0xfb72('0x70')]===![]){_0xff53f1['push']({'id':_0x534685[_0x50679c]['id'],'name':_0x534685[_0x50679c][_0xfb72('0x71')],'custom':_0x534685[_0x50679c]['custom_field'],'options':_0x534685[_0x50679c][_0xfb72('0x72')]==='picklist'&&_0x534685[_0x50679c][_0xfb72('0x73')][_0xfb72('0x33')]>-0x1?_['map'](_0x534685[_0x50679c][_0xfb72('0x73')],function(_0x35f2e2){return{'name':_0x35f2e2,'value':_0x35f2e2};}):[]});}}return{'count':_0xff53f1[_0xfb72('0x33')],'rows':_0xff53f1};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x57abb4,null))[_0xfb72('0x43')](function(_0x5d4cb1){var _0x40e2f7=_0x5a88a9[_0xfb72('0x2e')][_0xfb72('0x74')]?0x1f4:_0x5d4cb1[_0xfb72('0x75')]||0x1f4;logger[_0xfb72('0x23')](_0xfb72('0x76'),_0xfb72('0x59'),_0x40e2f7,JSON['stringify'](_0x5d4cb1));delete _0x5d4cb1[_0xfb72('0x25')];if(_0x40e2f7===0x191){_0x40e2f7=0x190;}_0x57abb4[_0xfb72('0x16')](_0x40e2f7)[_0xfb72('0x26')](_0x5a88a9[_0xfb72('0x2e')]['test']?{'message':_0xfb72('0x77'),'statusCode':_0x5d4cb1[_0xfb72('0x75')]}:_0x5d4cb1);});}; \ No newline at end of file +var _0x9ae5=['refresh_token','access_token','host','serverUrl','slice','substring','lastIndexOf','refreshToken','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','error','message','Owner','Subject','WhoId','Call_Duration','Call_Result','Call_Type','remove','includes','api_name','custom_field','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','rimraf','fast-json-patch','moment','mustache','util','path','to-csv','ejs','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','destroy','then','end','name','send','index','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filters','pick','filter','where','VIRTUAL','ZohoAccount','includeAll','include','rows','catch','show','params','rawAttributes','length','merge','options','find','create','body','getConfigurations','findOne','ZohoConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','clientId','clientSecret'];(function(_0x1f4325,_0x38bce9){var _0x16a6d1=function(_0x29a77a){while(--_0x29a77a){_0x1f4325['push'](_0x1f4325['shift']());}};_0x16a6d1(++_0x38bce9);}(_0x9ae5,0x96));var _0x59ae=function(_0x28e3b4,_0x363dcc){_0x28e3b4=_0x28e3b4-0x0;var _0x3181e0=_0x9ae5[_0x28e3b4];return _0x3181e0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x59ae('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x59ae('0x1'));var rp=require('request-promise');var moment=require(_0x59ae('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x59ae('0x3'));var util=require(_0x59ae('0x4'));var path=require(_0x59ae('0x5'));var sox=require('sox');var csv=require(_0x59ae('0x6'));var ejs=require(_0x59ae('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x59ae('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x59ae('0x9'));var toCsv=require(_0x59ae('0x6'));var querystring=require(_0x59ae('0xa'));var Papa=require('papaparse');var Redis=require(_0x59ae('0xb'));var authService=require(_0x59ae('0xc'));var qs=require(_0x59ae('0xd'));var as=require(_0x59ae('0xe'));var hardwareService=require(_0x59ae('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x59ae('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x59ae('0x11'))['db'];var integrations=require(_0x59ae('0x12'));function respondWithStatusCode(_0x15dac7,_0x3edaa9){_0x3edaa9=_0x3edaa9||0xcc;return function(_0x37dcc6){if(_0x37dcc6){return _0x15dac7[_0x59ae('0x13')](_0x3edaa9);}return _0x15dac7['status'](_0x3edaa9)['end']();};}function respondWithResult(_0x909834,_0x3d4f39){_0x3d4f39=_0x3d4f39||0xc8;return function(_0x45e5f0){if(_0x45e5f0){return _0x909834[_0x59ae('0x14')](_0x3d4f39)[_0x59ae('0x15')](_0x45e5f0);}};}function respondWithFilteredResult(_0x27f714,_0x569d03){return function(_0x371bad){if(_0x371bad){var _0x28c162=typeof _0x569d03[_0x59ae('0x16')]===_0x59ae('0x17')&&typeof _0x569d03[_0x59ae('0x18')]===_0x59ae('0x17');var _0x1848bd=_0x371bad[_0x59ae('0x19')];var _0x4f8033=_0x28c162?0x0:_0x569d03[_0x59ae('0x16')];var _0x127e08=_0x28c162?_0x371bad[_0x59ae('0x19')]:_0x569d03[_0x59ae('0x16')]+_0x569d03[_0x59ae('0x18')];var _0x174e35;if(_0x127e08>=_0x1848bd){_0x127e08=_0x1848bd;_0x174e35=0xc8;}else{_0x174e35=0xce;}_0x27f714[_0x59ae('0x14')](_0x174e35);return _0x27f714[_0x59ae('0x1a')]('Content-Range',_0x4f8033+'-'+_0x127e08+'/'+_0x1848bd)[_0x59ae('0x15')](_0x371bad);}return null;};}function patchUpdates(_0x30dabd){return function(_0x58b8b8){try{jsonpatch[_0x59ae('0x1b')](_0x58b8b8,_0x30dabd,!![]);}catch(_0x11c994){return BPromise[_0x59ae('0x1c')](_0x11c994);}return _0x58b8b8['save']();};}function saveUpdates(_0x17ee8c,_0x2413e4){return function(_0x27553d){if(_0x27553d){return _0x27553d[_0x59ae('0x1d')](_0x17ee8c)['then'](function(_0xb7b4e8){return _0xb7b4e8;});}return null;};}function removeEntity(_0x43eb74,_0x4b66e9){return function(_0x28640f){if(_0x28640f){return _0x28640f[_0x59ae('0x1e')]()[_0x59ae('0x1f')](function(){_0x43eb74[_0x59ae('0x14')](0xcc)[_0x59ae('0x20')]();});}};}function handleEntityNotFound(_0x33358b,_0x46092b){return function(_0x59475d){if(!_0x59475d){_0x33358b[_0x59ae('0x13')](0x194);}return _0x59475d;};}function handleError(_0x54a3a4,_0xd5f43f){_0xd5f43f=_0xd5f43f||0x1f4;return function(_0x2f002e){logger['error'](_0x2f002e['stack']);if(_0x2f002e[_0x59ae('0x21')]){delete _0x2f002e[_0x59ae('0x21')];}_0x54a3a4[_0x59ae('0x14')](_0xd5f43f)[_0x59ae('0x22')](_0x2f002e);};}exports[_0x59ae('0x23')]=function(_0x22470c,_0x104c13){var _0x54dddf={},_0x2c05bd={},_0x39ac66={'count':0x0,'rows':[]};var _0xd94294=_[_0x59ae('0x24')](db['ZohoAccount']['rawAttributes'],function(_0x49a5e2){return{'name':_0x49a5e2[_0x59ae('0x25')],'type':_0x49a5e2[_0x59ae('0x26')][_0x59ae('0x27')]};});_0x2c05bd[_0x59ae('0x28')]=_['map'](_0xd94294,_0x59ae('0x21'));_0x2c05bd[_0x59ae('0x29')]=_[_0x59ae('0x2a')](_0x22470c[_0x59ae('0x29')]);_0x2c05bd['filters']=_[_0x59ae('0x2b')](_0x2c05bd[_0x59ae('0x28')],_0x2c05bd['query']);_0x54dddf[_0x59ae('0x2c')]=_['intersection'](_0x2c05bd['model'],qs[_0x59ae('0x2d')](_0x22470c[_0x59ae('0x29')][_0x59ae('0x2d')]));_0x54dddf['attributes']=_0x54dddf[_0x59ae('0x2c')]['length']?_0x54dddf[_0x59ae('0x2c')]:_0x2c05bd[_0x59ae('0x28')];if(!_0x22470c[_0x59ae('0x29')][_0x59ae('0x2e')](_0x59ae('0x2f'))){_0x54dddf['limit']=qs[_0x59ae('0x18')](_0x22470c[_0x59ae('0x29')]['limit']);_0x54dddf[_0x59ae('0x16')]=qs[_0x59ae('0x16')](_0x22470c[_0x59ae('0x29')][_0x59ae('0x16')]);}_0x54dddf['order']=qs[_0x59ae('0x30')](_0x22470c[_0x59ae('0x29')][_0x59ae('0x30')]);_0x54dddf['where']=qs[_0x59ae('0x31')](_[_0x59ae('0x32')](_0x22470c['query'],_0x2c05bd[_0x59ae('0x31')]),_0xd94294);if(_0x22470c[_0x59ae('0x29')][_0x59ae('0x33')]){_0x54dddf['where']=_['merge'](_0x54dddf[_0x59ae('0x34')],{'$or':_[_0x59ae('0x24')](_0xd94294,function(_0x4b67ec){if(_0x4b67ec[_0x59ae('0x26')]!==_0x59ae('0x35')){var _0x529f2b={};_0x529f2b[_0x4b67ec[_0x59ae('0x21')]]={'$like':'%'+_0x22470c[_0x59ae('0x29')]['filter']+'%'};return _0x529f2b;}})});}_0x54dddf=_['merge']({},_0x54dddf,_0x22470c['options']);var _0x2354bd={'where':_0x54dddf[_0x59ae('0x34')]};return db[_0x59ae('0x36')]['count'](_0x2354bd)[_0x59ae('0x1f')](function(_0x497af9){_0x39ac66['count']=_0x497af9;if(_0x22470c[_0x59ae('0x29')][_0x59ae('0x37')]){_0x54dddf[_0x59ae('0x38')]=[{'all':!![]}];}return db[_0x59ae('0x36')]['findAll'](_0x54dddf);})[_0x59ae('0x1f')](function(_0x43707c){_0x39ac66[_0x59ae('0x39')]=_0x43707c;return _0x39ac66;})[_0x59ae('0x1f')](respondWithFilteredResult(_0x104c13,_0x54dddf))[_0x59ae('0x3a')](handleError(_0x104c13,null));};exports[_0x59ae('0x3b')]=function(_0x54c857,_0x3e19ba){var _0x20ba7f={'raw':![],'where':{'id':_0x54c857[_0x59ae('0x3c')]['id']}},_0xf2892d={};_0xf2892d[_0x59ae('0x28')]=_[_0x59ae('0x2a')](db[_0x59ae('0x36')][_0x59ae('0x3d')]);_0xf2892d[_0x59ae('0x29')]=_[_0x59ae('0x2a')](_0x54c857[_0x59ae('0x29')]);_0xf2892d[_0x59ae('0x31')]=_[_0x59ae('0x2b')](_0xf2892d[_0x59ae('0x28')],_0xf2892d[_0x59ae('0x29')]);_0x20ba7f['attributes']=_[_0x59ae('0x2b')](_0xf2892d[_0x59ae('0x28')],qs[_0x59ae('0x2d')](_0x54c857[_0x59ae('0x29')][_0x59ae('0x2d')]));_0x20ba7f[_0x59ae('0x2c')]=_0x20ba7f[_0x59ae('0x2c')][_0x59ae('0x3e')]?_0x20ba7f[_0x59ae('0x2c')]:_0xf2892d[_0x59ae('0x28')];if(_0x54c857['query']['includeAll']){_0x20ba7f['include']=[{'all':!![]}];}_0x20ba7f=_[_0x59ae('0x3f')]({},_0x20ba7f,_0x54c857[_0x59ae('0x40')]);return db['ZohoAccount'][_0x59ae('0x41')](_0x20ba7f)[_0x59ae('0x1f')](handleEntityNotFound(_0x3e19ba,null))[_0x59ae('0x1f')](respondWithResult(_0x3e19ba,null))[_0x59ae('0x3a')](handleError(_0x3e19ba,null));};exports['create']=function(_0xfaedea,_0x49a259){return db[_0x59ae('0x36')][_0x59ae('0x42')](_0xfaedea[_0x59ae('0x43')],{})['then'](respondWithResult(_0x49a259,0xc9))[_0x59ae('0x3a')](handleError(_0x49a259,null));};exports[_0x59ae('0x1d')]=function(_0x180662,_0xbe5d55){if(_0x180662['body']['id']){delete _0x180662['body']['id'];}return db[_0x59ae('0x36')]['find']({'where':{'id':_0x180662[_0x59ae('0x3c')]['id']}})['then'](handleEntityNotFound(_0xbe5d55,null))[_0x59ae('0x1f')](saveUpdates(_0x180662['body'],null))[_0x59ae('0x1f')](respondWithResult(_0xbe5d55,null))[_0x59ae('0x3a')](handleError(_0xbe5d55,null));};exports[_0x59ae('0x1e')]=function(_0x136e80,_0x26752d){return db[_0x59ae('0x36')][_0x59ae('0x41')]({'where':{'id':_0x136e80[_0x59ae('0x3c')]['id']}})['then'](handleEntityNotFound(_0x26752d,null))[_0x59ae('0x1f')](removeEntity(_0x26752d,null))[_0x59ae('0x3a')](handleError(_0x26752d,null));};exports[_0x59ae('0x44')]=function(_0x5f2122,_0x398866,_0x4afa77){var _0x504e9f={};var _0x134d5e={};var _0x18e5eb;var _0xc3f391;return db[_0x59ae('0x36')][_0x59ae('0x45')]({'where':{'id':_0x5f2122[_0x59ae('0x3c')]['id']}})[_0x59ae('0x1f')](handleEntityNotFound(_0x398866,null))[_0x59ae('0x1f')](function(_0x180c31){if(_0x180c31){_0x18e5eb=_0x180c31;_0x134d5e['model']=_[_0x59ae('0x2a')](db[_0x59ae('0x46')][_0x59ae('0x3d')]);_0x134d5e['query']=_[_0x59ae('0x2a')](_0x5f2122[_0x59ae('0x29')]);_0x134d5e[_0x59ae('0x31')]=_[_0x59ae('0x2b')](_0x134d5e[_0x59ae('0x28')],_0x134d5e[_0x59ae('0x29')]);_0x504e9f[_0x59ae('0x2c')]=_[_0x59ae('0x2b')](_0x134d5e['model'],qs[_0x59ae('0x2d')](_0x5f2122[_0x59ae('0x29')]['fields']));_0x504e9f[_0x59ae('0x2c')]=_0x504e9f[_0x59ae('0x2c')][_0x59ae('0x3e')]?_0x504e9f[_0x59ae('0x2c')]:_0x134d5e[_0x59ae('0x28')];_0x504e9f['order']=qs['sort'](_0x5f2122[_0x59ae('0x29')]['sort']);_0x504e9f[_0x59ae('0x34')]=qs[_0x59ae('0x31')](_[_0x59ae('0x32')](_0x5f2122[_0x59ae('0x29')],_0x134d5e[_0x59ae('0x31')]));if(_0x5f2122[_0x59ae('0x29')]['filter']){_0x504e9f[_0x59ae('0x34')]=_[_0x59ae('0x3f')](_0x504e9f[_0x59ae('0x34')],{'$or':_[_0x59ae('0x24')](_0x504e9f[_0x59ae('0x2c')],function(_0x5468f8){var _0x2f51d0={};_0x2f51d0[_0x5468f8]={'$like':'%'+_0x5f2122[_0x59ae('0x29')][_0x59ae('0x33')]+'%'};return _0x2f51d0;})});}_0x504e9f=_[_0x59ae('0x3f')]({},_0x504e9f,_0x5f2122['options']);return _0x18e5eb[_0x59ae('0x44')](_0x504e9f);}})[_0x59ae('0x1f')](function(_0x51b031){if(_0x51b031){_0xc3f391=_0x51b031['length'];if(!_0x5f2122[_0x59ae('0x29')][_0x59ae('0x2e')](_0x59ae('0x2f'))){_0x504e9f[_0x59ae('0x18')]=qs[_0x59ae('0x18')](_0x5f2122[_0x59ae('0x29')][_0x59ae('0x18')]);_0x504e9f[_0x59ae('0x16')]=qs[_0x59ae('0x16')](_0x5f2122['query'][_0x59ae('0x16')]);}return _0x18e5eb[_0x59ae('0x44')](_0x504e9f);}})[_0x59ae('0x1f')](function(_0x466b2f){if(_0x466b2f){return _0x466b2f?{'count':_0xc3f391,'rows':_0x466b2f}:null;}})[_0x59ae('0x1f')](respondWithResult(_0x398866,null))[_0x59ae('0x3a')](handleError(_0x398866,null));};exports[_0x59ae('0x47')]=function(_0x1bfeea,_0x10f948,_0x2a5559){if(_0x1bfeea[_0x59ae('0x43')]['id']){delete _0x1bfeea[_0x59ae('0x43')]['id'];}return db[_0x59ae('0x36')][_0x59ae('0x45')]({'where':{'id':_0x1bfeea['params']['id']}})['then'](handleEntityNotFound(_0x10f948,null))[_0x59ae('0x1f')](function(_0x5943ef){if(_0x5943ef){_0x1bfeea[_0x59ae('0x43')][_0x59ae('0x48')]=_0x5943ef['id'];_0x1bfeea['body'][_0x59ae('0x49')]=integrations[_0x59ae('0x4a')](_0x1bfeea[_0x59ae('0x43')][_0x59ae('0x4b')],_0x1bfeea['body']['type']);_0x1bfeea[_0x59ae('0x43')][_0x59ae('0x4c')]=integrations[_0x59ae('0x4d')](_0x1bfeea[_0x59ae('0x43')][_0x59ae('0x4b')],_0x1bfeea['body'][_0x59ae('0x26')]);return db[_0x59ae('0x46')][_0x59ae('0x42')](_0x1bfeea[_0x59ae('0x43')],{'include':[{'model':db[_0x59ae('0x4e')],'as':_0x59ae('0x49')},{'model':db[_0x59ae('0x4e')],'as':_0x59ae('0x4c')}]});}return null;})['then'](respondWithResult(_0x10f948,null))[_0x59ae('0x3a')](handleError(_0x10f948,null));};function getAccessToken(_0x1481cb){return new Promise(function(_0x4ae3fa,_0x59f538){var _0x19949e;switch(_0x1481cb['zone']){case'US':_0x19949e=_0x59ae('0x4f');break;case'AU':_0x19949e=_0x59ae('0x50');break;case'EU':_0x19949e=_0x59ae('0x51');break;case'IN':_0x19949e=_0x59ae('0x52');break;case'CN':_0x19949e=_0x59ae('0x53');break;default:_0x19949e=_0x59ae('0x51');break;}var _0x4328dc={'method':'POST','uri':_0x19949e+'/oauth/v2/token','qs':{'refresh_token':_0x1481cb['refreshToken'],'client_id':_0x1481cb[_0x59ae('0x54')],'client_secret':_0x1481cb[_0x59ae('0x55')],'grant_type':_0x59ae('0x56')},'json':!![]};return rp(_0x4328dc)[_0x59ae('0x1f')](function(_0x1a9e98){if(_0x1a9e98[_0x59ae('0x57')]){_0x4ae3fa(_0x1a9e98[_0x59ae('0x57')]);}else{_0x59f538('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x59ae('0x3a')](function(_0x296bd4){_0x59f538(_0x296bd4);});});}exports['getFields']=function(_0x8f9c9e,_0x82a774,_0x1e16df){var _0x53b1eb,_0x46878b,_0x9a0bec,_0x441bad,_0x2a9b3e;return db[_0x59ae('0x36')][_0x59ae('0x45')]({'where':{'id':_0x8f9c9e[_0x59ae('0x3c')]['id']},'attributes':['id',_0x59ae('0x58'),'zone',_0x59ae('0x54'),_0x59ae('0x55'),_0x59ae('0x59'),'code','refreshToken']})['then'](handleEntityNotFound(_0x82a774,null))[_0x59ae('0x1f')](function(_0x48f4b8){_0x2a9b3e=_0x48f4b8;_0x53b1eb=_0x2a9b3e[_0x59ae('0x58')];_0x46878b=_0x53b1eb==='zoho.eu'?'eu':'com';_0x9a0bec=_0x2a9b3e[_0x59ae('0x59')];var _0x11f9d5=_0x9a0bec[_0x59ae('0x5a')](-0x1);if(_0x11f9d5==='/'||_0x11f9d5==='\x5c'||_0x11f9d5===':'){_0x9a0bec=_0x9a0bec[_0x59ae('0x5b')](0x0,_0x9a0bec[_0x59ae('0x5c')](_0x11f9d5));}if(!_0x2a9b3e[_0x59ae('0x5d')]){throw new Error(_0x59ae('0x5e'));}return getAccessToken(_0x2a9b3e);})[_0x59ae('0x1f')](function(_0x25df65){if(_0x25df65){return rp({'method':'GET','uri':util[_0x59ae('0x5f')](_0x59ae('0x60'),_0x46878b),'qs':{'module':_0x59ae('0x61')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x25df65},'json':!![]});}})['then'](function(_0x23f5d4){if(_0x23f5d4){if(_0x23f5d4[_0x59ae('0x62')]&&_0x23f5d4[_0x59ae('0x62')][_0x59ae('0x63')]){throw new Error(_0x23f5d4['response'][_0x59ae('0x63')][_0x59ae('0x64')]);}var _0x1c9db6=[];var _0x27c759=[];var _0x5ef3b3=[_0x59ae('0x65'),_0x59ae('0x66'),'Description',_0x59ae('0x67'),_0x59ae('0x68'),_0x59ae('0x69'),'Call_Start_Time',_0x59ae('0x6a')];_0x27c759=_[_0x59ae('0x6b')](_0x23f5d4[_0x59ae('0x2d')],function(_0x2c9262){return _0x5ef3b3[_0x59ae('0x6c')](_0x2c9262[_0x59ae('0x6d')]);});for(var _0x34f533=0x0;_0x34f533<_0x27c759[_0x59ae('0x3e')];_0x34f533++){if(_0x27c759[_0x34f533]['system_mandatory']===![]){_0x1c9db6['push']({'id':_0x27c759[_0x34f533]['id'],'name':_0x27c759[_0x34f533]['display_label'],'custom':_0x27c759[_0x34f533][_0x59ae('0x6e')],'options':_0x27c759[_0x34f533]['data_type']===_0x59ae('0x6f')&&_0x27c759[_0x34f533][_0x59ae('0x70')]['length']>-0x1?_[_0x59ae('0x24')](_0x27c759[_0x34f533]['pick_list_values'],function(_0x16b692){return{'name':_0x16b692,'value':_0x16b692};}):[]});}}return{'count':_0x1c9db6[_0x59ae('0x3e')],'rows':_0x1c9db6};}else{return{'count':0x0,'rows':[]};}})[_0x59ae('0x1f')](respondWithResult(_0x82a774,null))[_0x59ae('0x3a')](function(_0x9222b){var _0x23d6f0=_0x8f9c9e[_0x59ae('0x29')][_0x59ae('0x71')]?0x1f4:_0x9222b[_0x59ae('0x72')]||0x1f4;logger[_0x59ae('0x63')](_0x59ae('0x73'),_0x59ae('0x74'),_0x23d6f0,JSON[_0x59ae('0x75')](_0x9222b));delete _0x9222b['name'];if(_0x23d6f0===0x191){_0x23d6f0=0x190;}_0x82a774[_0x59ae('0x14')](_0x23d6f0)[_0x59ae('0x22')](_0x8f9c9e[_0x59ae('0x29')][_0x59ae('0x71')]?{'message':'Wrong\x20credentials','statusCode':_0x9222b[_0x59ae('0x72')]}:_0x9222b);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 68a1e0d..20cca45 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 _0x1dfa=['clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','info','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','POST','refreshToken','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','exports','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId'];(function(_0x5ee7d1,_0x56c4d8){var _0x403db0=function(_0xc65250){while(--_0xc65250){_0x5ee7d1['push'](_0x5ee7d1['shift']());}};_0x403db0(++_0x56c4d8);}(_0x1dfa,0xc6));var _0xa1df=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x1dfa[_0x2ec461];return _0x28603d;};'use strict';var _=require('lodash');var util=require(_0xa1df('0x0'));var logger=require(_0xa1df('0x1'))(_0xa1df('0x2'));var moment=require(_0xa1df('0x3'));var BPromise=require(_0xa1df('0x4'));var rp=require(_0xa1df('0x5'));var fs=require('fs');var path=require(_0xa1df('0x6'));var rimraf=require(_0xa1df('0x7'));var config=require(_0xa1df('0x8'));var attributes=require(_0xa1df('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xa1df('0xa')]=function(_0x3049ce,_0x372a47){return _0x3049ce['define'](_0xa1df('0xb'),attributes,{'tableName':_0xa1df('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x53633e,_0x391eb8,_0x38d1b4){if(_0x53633e[_0xa1df('0xd')](_0xa1df('0xe'))||_0x53633e[_0xa1df('0xd')](_0xa1df('0xf'))||_0x53633e[_0xa1df('0xd')](_0xa1df('0x10'))||_0x53633e[_0xa1df('0xd')](_0xa1df('0x11'))||_0x53633e[_0xa1df('0xd')](_0xa1df('0x12'))||_0x53633e['changed'](_0xa1df('0x13'))){var _0x5df813,_0x5a5857;_0x5df813=_0x53633e['serverUrl'];var _0x332e27=_0x5df813[_0xa1df('0x14')](-0x1);if(_0x332e27==='/'||_0x332e27==='\x5c'||_0x332e27===':'){_0x5df813=_0x5df813[_0xa1df('0x15')](0x0,_0x5df813[_0xa1df('0x16')](_0x332e27));}switch(_0x53633e[_0xa1df('0xe')]){case'US':_0x5a5857='https://accounts.zoho.com';break;case'AU':_0x5a5857=_0xa1df('0x17');break;case'IN':_0x5a5857=_0xa1df('0x18');break;case'CN':_0x5a5857=_0xa1df('0x19');break;default:_0x5a5857=_0xa1df('0x1a');break;}var _0x3919ac={'method':'POST','uri':_0x5a5857+_0xa1df('0x1b'),'form':{'grant_type':_0xa1df('0x1c'),'client_id':_0x53633e['clientId'],'client_secret':_0x53633e[_0xa1df('0x11')],'redirect_uri':_0x53633e[_0xa1df('0xf')],'code':_0x53633e['code']},'headers':{'Content-Type':_0xa1df('0x1d')}};return rp(_0x3919ac)[_0xa1df('0x1e')](function(_0x28e37c){var _0x121cbb=JSON[_0xa1df('0x1f')](_0x28e37c);if(_0x121cbb[_0xa1df('0x20')]){_0x53633e['refreshToken']=_0x121cbb[_0xa1df('0x20')];logger[_0xa1df('0x21')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x53633e['name'],_0x53633e['id']));}else{logger[_0xa1df('0x22')](util[_0xa1df('0x23')](_0xa1df('0x24'),_0x53633e['name'],_0x53633e['id']),util[_0xa1df('0x25')](_0x121cbb,{'showHidden':![],'depth':null}));}return _0x38d1b4(null,_0x391eb8);})[_0xa1df('0x26')](function(_0x34feaa){logger[_0xa1df('0x22')](util[_0xa1df('0x23')](_0xa1df('0x24'),_0x53633e['name'],_0x53633e['id']),util[_0xa1df('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x38d1b4(_0x34feaa);});}else{return _0x38d1b4(null,_0x391eb8);}},'beforeUpdate':function(_0x532629,_0x4087aa,_0xdf44c0){if(_0x532629[_0xa1df('0xd')]('zone')||_0x532629[_0xa1df('0xd')]('serverUrl')||_0x532629[_0xa1df('0xd')](_0xa1df('0x10'))||_0x532629['changed']('clientSecret')||_0x532629[_0xa1df('0xd')]('code')||_0x532629[_0xa1df('0xd')](_0xa1df('0x13'))){var _0x1d89e0,_0x228f7a;_0x1d89e0=_0x532629[_0xa1df('0xf')];var _0x1c8572=_0x1d89e0[_0xa1df('0x14')](-0x1);if(_0x1c8572==='/'||_0x1c8572==='\x5c'||_0x1c8572===':'){_0x1d89e0=_0x1d89e0[_0xa1df('0x15')](0x0,_0x1d89e0[_0xa1df('0x16')](_0x1c8572));}switch(_0x532629[_0xa1df('0xe')]){case'US':_0x228f7a='https://accounts.zoho.com';break;case'AU':_0x228f7a=_0xa1df('0x17');break;case'IN':_0x228f7a=_0xa1df('0x18');break;case'CN':_0x228f7a=_0xa1df('0x19');break;default:_0x228f7a=_0xa1df('0x1a');break;}var _0x450255={'method':_0xa1df('0x27'),'uri':_0x228f7a+_0xa1df('0x1b'),'form':{'grant_type':_0xa1df('0x1c'),'client_id':_0x532629[_0xa1df('0x10')],'client_secret':_0x532629[_0xa1df('0x11')],'redirect_uri':_0x532629['serverUrl'],'code':_0x532629[_0xa1df('0x12')]},'headers':{'Content-Type':_0xa1df('0x1d')}};return rp(_0x450255)[_0xa1df('0x1e')](function(_0x13f721){var _0x215a05=JSON[_0xa1df('0x1f')](_0x13f721);if(_0x215a05['refresh_token']){_0x532629[_0xa1df('0x28')]=_0x215a05[_0xa1df('0x20')];logger['info'](util[_0xa1df('0x23')](_0xa1df('0x29'),_0x532629[_0xa1df('0x2a')],_0x532629['id']));}else{logger['error'](util[_0xa1df('0x23')](_0xa1df('0x24'),_0x532629[_0xa1df('0x2a')],_0x532629['id']),util['inspect'](_0x215a05,{'showHidden':![],'depth':null}));}return _0xdf44c0(null,_0x4087aa);})[_0xa1df('0x26')](function(_0x13c0d0){logger[_0xa1df('0x22')](util['format'](_0xa1df('0x24'),_0x532629[_0xa1df('0x2a')],_0x532629['id']),util[_0xa1df('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0xdf44c0(_0x13c0d0);});}else{return _0xdf44c0(null,_0x4087aa);}}}});}; \ No newline at end of file +var _0x2193=['int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','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','error','host','slice','/oauth/v2/token','lodash','util','api','moment','request-promise','path','../../config/environment','./intZohoAccount.attributes','exports','define','ZohoAccount'];(function(_0x1dcea1,_0x57d28c){var _0x189301=function(_0x2125fe){while(--_0x2125fe){_0x1dcea1['push'](_0x1dcea1['shift']());}};_0x189301(++_0x57d28c);}(_0x2193,0x1a3));var _0x3219=function(_0x5bcdba,_0x2cf1d8){_0x5bcdba=_0x5bcdba-0x0;var _0x40f17c=_0x2193[_0x5bcdba];return _0x40f17c;};'use strict';var _=require(_0x3219('0x0'));var util=require(_0x3219('0x1'));var logger=require('../../config/logger')(_0x3219('0x2'));var moment=require(_0x3219('0x3'));var BPromise=require('bluebird');var rp=require(_0x3219('0x4'));var fs=require('fs');var path=require(_0x3219('0x5'));var rimraf=require('rimraf');var config=require(_0x3219('0x6'));var attributes=require(_0x3219('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x3219('0x8')]=function(_0x9471fd,_0x280704){return _0x9471fd[_0x3219('0x9')](_0x3219('0xa'),attributes,{'tableName':_0x3219('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x54bb5f,_0x590f9f,_0x548cb3){if(_0x54bb5f[_0x3219('0xc')](_0x3219('0xd'))||_0x54bb5f[_0x3219('0xc')](_0x3219('0xe'))||_0x54bb5f[_0x3219('0xc')](_0x3219('0xf'))||_0x54bb5f[_0x3219('0xc')](_0x3219('0x10'))||_0x54bb5f[_0x3219('0xc')](_0x3219('0x11'))||_0x54bb5f[_0x3219('0xc')]('host')){var _0x3278ba,_0x282dac;_0x3278ba=_0x54bb5f[_0x3219('0xe')];var _0xfa6188=_0x3278ba['slice'](-0x1);if(_0xfa6188==='/'||_0xfa6188==='\x5c'||_0xfa6188===':'){_0x3278ba=_0x3278ba[_0x3219('0x12')](0x0,_0x3278ba[_0x3219('0x13')](_0xfa6188));}switch(_0x54bb5f[_0x3219('0xd')]){case'US':_0x282dac=_0x3219('0x14');break;case'AU':_0x282dac=_0x3219('0x15');break;case'IN':_0x282dac=_0x3219('0x16');break;case'CN':_0x282dac=_0x3219('0x17');break;default:_0x282dac=_0x3219('0x18');break;}var _0x2a4581={'method':_0x3219('0x19'),'uri':_0x282dac+'/oauth/v2/token','form':{'grant_type':_0x3219('0x1a'),'client_id':_0x54bb5f[_0x3219('0xf')],'client_secret':_0x54bb5f[_0x3219('0x10')],'redirect_uri':_0x54bb5f['serverUrl'],'code':_0x54bb5f[_0x3219('0x11')]},'headers':{'Content-Type':_0x3219('0x1b')}};return rp(_0x2a4581)[_0x3219('0x1c')](function(_0x43991e){var _0x5f1b7d=JSON[_0x3219('0x1d')](_0x43991e);if(_0x5f1b7d[_0x3219('0x1e')]){_0x54bb5f[_0x3219('0x1f')]=_0x5f1b7d[_0x3219('0x1e')];logger[_0x3219('0x20')](util[_0x3219('0x21')](_0x3219('0x22'),_0x54bb5f[_0x3219('0x23')],_0x54bb5f['id']));}else{logger['error'](util['format'](_0x3219('0x24'),_0x54bb5f[_0x3219('0x23')],_0x54bb5f['id']),util[_0x3219('0x25')](_0x5f1b7d,{'showHidden':![],'depth':null}));}return _0x548cb3(null,_0x590f9f);})[_0x3219('0x26')](function(_0x2c7cc3){logger[_0x3219('0x27')](util[_0x3219('0x21')](_0x3219('0x24'),_0x54bb5f[_0x3219('0x23')],_0x54bb5f['id']),util[_0x3219('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x548cb3(_0x2c7cc3);});}else{return _0x548cb3(null,_0x590f9f);}},'beforeUpdate':function(_0xbcfa39,_0x498d5c,_0x1c5ef1){if(_0xbcfa39['changed'](_0x3219('0xd'))||_0xbcfa39['changed'](_0x3219('0xe'))||_0xbcfa39[_0x3219('0xc')](_0x3219('0xf'))||_0xbcfa39[_0x3219('0xc')](_0x3219('0x10'))||_0xbcfa39[_0x3219('0xc')](_0x3219('0x11'))||_0xbcfa39[_0x3219('0xc')](_0x3219('0x28'))){var _0x28c35f,_0x24f88d;_0x28c35f=_0xbcfa39[_0x3219('0xe')];var _0x10d7a4=_0x28c35f[_0x3219('0x29')](-0x1);if(_0x10d7a4==='/'||_0x10d7a4==='\x5c'||_0x10d7a4===':'){_0x28c35f=_0x28c35f['substring'](0x0,_0x28c35f['lastIndexOf'](_0x10d7a4));}switch(_0xbcfa39[_0x3219('0xd')]){case'US':_0x24f88d='https://accounts.zoho.com';break;case'AU':_0x24f88d=_0x3219('0x15');break;case'IN':_0x24f88d=_0x3219('0x16');break;case'CN':_0x24f88d=_0x3219('0x17');break;default:_0x24f88d=_0x3219('0x18');break;}var _0x4b43ee={'method':_0x3219('0x19'),'uri':_0x24f88d+_0x3219('0x2a'),'form':{'grant_type':_0x3219('0x1a'),'client_id':_0xbcfa39['clientId'],'client_secret':_0xbcfa39['clientSecret'],'redirect_uri':_0xbcfa39[_0x3219('0xe')],'code':_0xbcfa39[_0x3219('0x11')]},'headers':{'Content-Type':_0x3219('0x1b')}};return rp(_0x4b43ee)[_0x3219('0x1c')](function(_0x24bad4){var _0x4dc593=JSON[_0x3219('0x1d')](_0x24bad4);if(_0x4dc593[_0x3219('0x1e')]){_0xbcfa39[_0x3219('0x1f')]=_0x4dc593['refresh_token'];logger['info'](util[_0x3219('0x21')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0xbcfa39[_0x3219('0x23')],_0xbcfa39['id']));}else{logger[_0x3219('0x27')](util[_0x3219('0x21')](_0x3219('0x24'),_0xbcfa39[_0x3219('0x23')],_0xbcfa39['id']),util[_0x3219('0x25')](_0x4dc593,{'showHidden':![],'depth':null}));}return _0x1c5ef1(null,_0x498d5c);})[_0x3219('0x26')](function(_0x47abbe){logger['error'](util[_0x3219('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0xbcfa39[_0x3219('0x23')],_0xbcfa39['id']),util[_0x3219('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x1c5ef1(_0x47abbe);});}else{return _0x1c5ef1(null,_0x498d5c);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 57dc331..ee03736 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 _0xd386=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','limit','include','attributes','map','model','ShowZohoAccount','find','then','lodash','util','moment','randomstring'];(function(_0x275caa,_0x166d5e){var _0x28d670=function(_0x2a20e1){while(--_0x2a20e1){_0x275caa['push'](_0x275caa['shift']());}};_0x28d670(++_0x166d5e);}(_0xd386,0x10c));var _0x6d38=function(_0x1e0d54,_0x46fbec){_0x1e0d54=_0x1e0d54-0x0;var _0x244204=_0xd386[_0x1e0d54];return _0x244204;};'use strict';var _=require(_0x6d38('0x0'));var util=require(_0x6d38('0x1'));var moment=require(_0x6d38('0x2'));var BPromise=require('bluebird');var rs=require(_0x6d38('0x3'));var fs=require('fs');var Redis=require(_0x6d38('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6d38('0x5'));var logger=require(_0x6d38('0x6'))(_0x6d38('0x7'));var config=require(_0x6d38('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6d38('0x9')][_0x6d38('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b2038,_0x83823e,_0x2b742c){return new BPromise(function(_0x44ef4e,_0x49d71a){return client[_0x6d38('0xb')](_0x1b2038,_0x2b742c)['then'](function(_0x274898){logger['info'](_0x6d38('0xc'),_0x83823e,_0x6d38('0xd'));logger[_0x6d38('0xe')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x83823e,_0x6d38('0xd'),JSON[_0x6d38('0xf')](_0x274898));if(_0x274898[_0x6d38('0x10')]){if(_0x274898['error']['code']===0x1f4){logger['error'](_0x6d38('0xc'),_0x83823e,_0x274898[_0x6d38('0x10')][_0x6d38('0x11')]);return _0x49d71a(_0x274898[_0x6d38('0x10')][_0x6d38('0x11')]);}logger['error'](_0x6d38('0xc'),_0x83823e,_0x274898[_0x6d38('0x10')][_0x6d38('0x11')]);return _0x44ef4e(_0x274898[_0x6d38('0x10')][_0x6d38('0x11')]);}else{logger[_0x6d38('0x12')](_0x6d38('0xc'),_0x83823e,'request\x20sent');_0x44ef4e(_0x274898['result']['message']);}})[_0x6d38('0x13')](function(_0x46e7d7){logger[_0x6d38('0x10')](_0x6d38('0xc'),_0x83823e,_0x46e7d7);_0x49d71a(_0x46e7d7);});});}exports[_0x6d38('0x14')]=function(_0x11298c){var _0x5dcd45=this;return new Promise(function(_0x278829,_0xffcf23){return db[_0x6d38('0x15')][_0x6d38('0x16')]({'raw':_0x11298c[_0x6d38('0x17')]?_0x11298c[_0x6d38('0x17')][_0x6d38('0x18')]===undefined?!![]:![]:!![],'where':_0x11298c[_0x6d38('0x17')]?_0x11298c['options'][_0x6d38('0x19')]||null:null,'attributes':_0x11298c[_0x6d38('0x17')]?_0x11298c['options']['attributes']||null:null,'limit':_0x11298c[_0x6d38('0x17')]?_0x11298c[_0x6d38('0x17')][_0x6d38('0x1a')]||null:null,'include':_0x11298c[_0x6d38('0x17')]?_0x11298c['options'][_0x6d38('0x1b')]?_['map'](_0x11298c[_0x6d38('0x17')]['include'],function(_0x473895){return{'model':db[_0x473895['model']],'as':_0x473895['as'],'attributes':_0x473895[_0x6d38('0x1c')],'include':_0x473895[_0x6d38('0x1b')]?_[_0x6d38('0x1d')](_0x473895[_0x6d38('0x1b')],function(_0x3c777a){return{'model':db[_0x3c777a['model']],'as':_0x3c777a['as'],'attributes':_0x3c777a['attributes'],'include':_0x3c777a[_0x6d38('0x1b')]?_[_0x6d38('0x1d')](_0x3c777a['include'],function(_0x4f2769){return{'model':db[_0x4f2769[_0x6d38('0x1e')]],'as':_0x4f2769['as'],'attributes':_0x4f2769['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a41f8){logger[_0x6d38('0x12')](_0x6d38('0x14'),_0x11298c);logger[_0x6d38('0xe')](_0x6d38('0x14'),_0x11298c,JSON[_0x6d38('0xf')](_0x3a41f8));_0x278829(_0x3a41f8);})['catch'](function(_0x3e62cf){logger['error'](_0x6d38('0x14'),_0x3e62cf['message'],_0x11298c);_0xffcf23(_0x5dcd45[_0x6d38('0x10')](0x1f4,_0x3e62cf['message']));});});};exports[_0x6d38('0x1f')]=function(_0x471f08){var _0x503658=this;return new Promise(function(_0x4863b1,_0x1824f4){return db[_0x6d38('0x15')][_0x6d38('0x20')]({'raw':_0x471f08[_0x6d38('0x17')]?_0x471f08[_0x6d38('0x17')][_0x6d38('0x18')]===undefined?!![]:![]:!![],'where':_0x471f08['options']?_0x471f08['options'][_0x6d38('0x19')]||null:null,'attributes':_0x471f08['options']?_0x471f08[_0x6d38('0x17')]['attributes']||null:null,'include':_0x471f08[_0x6d38('0x17')]?_0x471f08[_0x6d38('0x17')][_0x6d38('0x1b')]?_['map'](_0x471f08[_0x6d38('0x17')][_0x6d38('0x1b')],function(_0xfc85c3){return{'model':db[_0xfc85c3[_0x6d38('0x1e')]],'as':_0xfc85c3['as'],'attributes':_0xfc85c3[_0x6d38('0x1c')],'include':_0xfc85c3[_0x6d38('0x1b')]?_[_0x6d38('0x1d')](_0xfc85c3[_0x6d38('0x1b')],function(_0x197b3f){return{'model':db[_0x197b3f['model']],'as':_0x197b3f['as'],'attributes':_0x197b3f[_0x6d38('0x1c')],'include':_0x197b3f[_0x6d38('0x1b')]?_[_0x6d38('0x1d')](_0x197b3f['include'],function(_0x4f5350){return{'model':db[_0x4f5350[_0x6d38('0x1e')]],'as':_0x4f5350['as'],'attributes':_0x4f5350['attributes']};}):[]};}):[]};}):[]:[]})[_0x6d38('0x21')](function(_0x41cb07){logger[_0x6d38('0x12')](_0x6d38('0x1f'),_0x471f08);logger['debug'](_0x6d38('0x1f'),_0x471f08,JSON['stringify'](_0x41cb07));_0x4863b1(_0x41cb07);})['catch'](function(_0x3fefe3){logger[_0x6d38('0x10')]('ShowZohoAccount',_0x3fefe3['message'],_0x471f08);_0x1824f4(_0x503658[_0x6d38('0x10')](0x1f4,_0x3fefe3[_0x6d38('0x11')]));});});}; \ No newline at end of file +var _0x8ed7=['ShowZohoAccount','ZohoAccount','find','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetZohoAccount','options','raw','where','attributes','map','include','model','debug','stringify'];(function(_0x5a711b,_0xef17a8){var _0x252ccb=function(_0x4f217f){while(--_0x4f217f){_0x5a711b['push'](_0x5a711b['shift']());}};_0x252ccb(++_0xef17a8);}(_0x8ed7,0x8b));var _0x78ed=function(_0x351ec1,_0x502504){_0x351ec1=_0x351ec1-0x0;var _0x386a89=_0x8ed7[_0x351ec1];return _0x386a89;};'use strict';var _=require('lodash');var util=require(_0x78ed('0x0'));var moment=require(_0x78ed('0x1'));var BPromise=require(_0x78ed('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x78ed('0x3'))['db'];var utils=require(_0x78ed('0x4'));var logger=require(_0x78ed('0x5'))(_0x78ed('0x6'));var config=require(_0x78ed('0x7'));var jayson=require(_0x78ed('0x8'));var client=jayson[_0x78ed('0x9')][_0x78ed('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1fc5e7,_0x54c783,_0x232d7b){return new BPromise(function(_0x5197a3,_0x1c0ec8){return client['request'](_0x1fc5e7,_0x232d7b)[_0x78ed('0xb')](function(_0x550763){logger['info'](_0x78ed('0xc'),_0x54c783,_0x78ed('0xd'));logger['debug'](_0x78ed('0xe'),_0x54c783,_0x78ed('0xd'),JSON['stringify'](_0x550763));if(_0x550763[_0x78ed('0xf')]){if(_0x550763['error'][_0x78ed('0x10')]===0x1f4){logger[_0x78ed('0xf')](_0x78ed('0xc'),_0x54c783,_0x550763[_0x78ed('0xf')][_0x78ed('0x11')]);return _0x1c0ec8(_0x550763[_0x78ed('0xf')]['message']);}logger[_0x78ed('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x54c783,_0x550763['error']['message']);return _0x5197a3(_0x550763['error']['message']);}else{logger[_0x78ed('0x12')](_0x78ed('0xc'),_0x54c783,_0x78ed('0xd'));_0x5197a3(_0x550763[_0x78ed('0x13')][_0x78ed('0x11')]);}})[_0x78ed('0x14')](function(_0x336ae1){logger[_0x78ed('0xf')](_0x78ed('0xc'),_0x54c783,_0x336ae1);_0x1c0ec8(_0x336ae1);});});}exports[_0x78ed('0x15')]=function(_0x2dd98c){var _0x4b9797=this;return new Promise(function(_0x2f442b,_0xb8b1f4){return db['ZohoAccount']['findAll']({'raw':_0x2dd98c[_0x78ed('0x16')]?_0x2dd98c[_0x78ed('0x16')][_0x78ed('0x17')]===undefined?!![]:![]:!![],'where':_0x2dd98c[_0x78ed('0x16')]?_0x2dd98c[_0x78ed('0x16')][_0x78ed('0x18')]||null:null,'attributes':_0x2dd98c[_0x78ed('0x16')]?_0x2dd98c[_0x78ed('0x16')][_0x78ed('0x19')]||null:null,'limit':_0x2dd98c[_0x78ed('0x16')]?_0x2dd98c[_0x78ed('0x16')]['limit']||null:null,'include':_0x2dd98c['options']?_0x2dd98c[_0x78ed('0x16')]['include']?_[_0x78ed('0x1a')](_0x2dd98c['options'][_0x78ed('0x1b')],function(_0x590d90){return{'model':db[_0x590d90[_0x78ed('0x1c')]],'as':_0x590d90['as'],'attributes':_0x590d90[_0x78ed('0x19')],'include':_0x590d90[_0x78ed('0x1b')]?_['map'](_0x590d90[_0x78ed('0x1b')],function(_0x5a8b87){return{'model':db[_0x5a8b87[_0x78ed('0x1c')]],'as':_0x5a8b87['as'],'attributes':_0x5a8b87[_0x78ed('0x19')],'include':_0x5a8b87[_0x78ed('0x1b')]?_['map'](_0x5a8b87['include'],function(_0x464050){return{'model':db[_0x464050['model']],'as':_0x464050['as'],'attributes':_0x464050[_0x78ed('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x12d5e1){logger[_0x78ed('0x12')](_0x78ed('0x15'),_0x2dd98c);logger[_0x78ed('0x1d')](_0x78ed('0x15'),_0x2dd98c,JSON[_0x78ed('0x1e')](_0x12d5e1));_0x2f442b(_0x12d5e1);})[_0x78ed('0x14')](function(_0x312801){logger[_0x78ed('0xf')]('GetZohoAccount',_0x312801[_0x78ed('0x11')],_0x2dd98c);_0xb8b1f4(_0x4b9797[_0x78ed('0xf')](0x1f4,_0x312801[_0x78ed('0x11')]));});});};exports[_0x78ed('0x1f')]=function(_0x4af685){var _0x4a8a5e=this;return new Promise(function(_0x5da4d0,_0x5e7234){return db[_0x78ed('0x20')][_0x78ed('0x21')]({'raw':_0x4af685[_0x78ed('0x16')]?_0x4af685[_0x78ed('0x16')][_0x78ed('0x17')]===undefined?!![]:![]:!![],'where':_0x4af685[_0x78ed('0x16')]?_0x4af685[_0x78ed('0x16')]['where']||null:null,'attributes':_0x4af685[_0x78ed('0x16')]?_0x4af685['options'][_0x78ed('0x19')]||null:null,'include':_0x4af685[_0x78ed('0x16')]?_0x4af685['options'][_0x78ed('0x1b')]?_[_0x78ed('0x1a')](_0x4af685[_0x78ed('0x16')][_0x78ed('0x1b')],function(_0x2f66e6){return{'model':db[_0x2f66e6[_0x78ed('0x1c')]],'as':_0x2f66e6['as'],'attributes':_0x2f66e6[_0x78ed('0x19')],'include':_0x2f66e6[_0x78ed('0x1b')]?_['map'](_0x2f66e6[_0x78ed('0x1b')],function(_0x4dc127){return{'model':db[_0x4dc127[_0x78ed('0x1c')]],'as':_0x4dc127['as'],'attributes':_0x4dc127[_0x78ed('0x19')],'include':_0x4dc127[_0x78ed('0x1b')]?_[_0x78ed('0x1a')](_0x4dc127[_0x78ed('0x1b')],function(_0x1aec84){return{'model':db[_0x1aec84[_0x78ed('0x1c')]],'as':_0x1aec84['as'],'attributes':_0x1aec84['attributes']};}):[]};}):[]};}):[]:[]})[_0x78ed('0xb')](function(_0x477e80){logger[_0x78ed('0x12')](_0x78ed('0x1f'),_0x4af685);logger[_0x78ed('0x1d')](_0x78ed('0x1f'),_0x4af685,JSON[_0x78ed('0x1e')](_0x477e80));_0x5da4d0(_0x477e80);})[_0x78ed('0x14')](function(_0x3ba9e8){logger[_0x78ed('0xf')](_0x78ed('0x1f'),_0x3ba9e8['message'],_0x4af685);_0x5e7234(_0x4a8a5e['error'](0x1f4,_0x3ba9e8[_0x78ed('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 685790d..e049caf 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 _0x542b=['express','Router','./intZohoConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x1c4a07,_0x49e503){var _0x5c2740=function(_0x56b839){while(--_0x56b839){_0x1c4a07['push'](_0x1c4a07['shift']());}};_0x5c2740(++_0x49e503);}(_0x542b,0xd8));var _0xb542=function(_0x2becba,_0x4ea656){_0x2becba=_0x2becba-0x0;var _0x90b5dd=_0x542b[_0x2becba];return _0x90b5dd;};'use strict';var multer=require(_0xb542('0x0'));var util=require(_0xb542('0x1'));var path=require(_0xb542('0x2'));var timeout=require(_0xb542('0x3'));var express=require(_0xb542('0x4'));var router=express[_0xb542('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb542('0x6'));router[_0xb542('0x7')]('/',auth[_0xb542('0x8')](),controller['index']);router[_0xb542('0x7')](_0xb542('0x9'),auth[_0xb542('0x8')](),controller[_0xb542('0xa')]);router[_0xb542('0x7')](_0xb542('0xb'),auth[_0xb542('0x8')](),controller[_0xb542('0xc')]);router[_0xb542('0x7')](_0xb542('0xd'),auth[_0xb542('0x8')](),controller[_0xb542('0xe')]);router[_0xb542('0x7')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xb542('0xf')]);router[_0xb542('0x10')]('/',auth[_0xb542('0x8')](),controller['create']);router['put'](_0xb542('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xb542('0x11')]('/:id',auth[_0xb542('0x8')](),controller[_0xb542('0x12')]);module[_0xb542('0x13')]=router; \ No newline at end of file +var _0x7fa3=['isAuthenticated','index','/:id','getFields','getDescriptions','post','put','update','destroy','path','Router','fs-extra','../../config/environment','./intZohoConfiguration.controller','get'];(function(_0xd299c3,_0x4ba0f1){var _0x376574=function(_0xc585f){while(--_0xc585f){_0xd299c3['push'](_0xd299c3['shift']());}};_0x376574(++_0x4ba0f1);}(_0x7fa3,0xf9));var _0x37fa=function(_0x393eac,_0x4505f3){_0x393eac=_0x393eac-0x0;var _0x37a891=_0x7fa3[_0x393eac];return _0x37a891;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x37fa('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x37fa('0x1')]();var fs_extra=require(_0x37fa('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x37fa('0x3'));var controller=require(_0x37fa('0x4'));router[_0x37fa('0x5')]('/',auth[_0x37fa('0x6')](),controller[_0x37fa('0x7')]);router['get'](_0x37fa('0x8'),auth[_0x37fa('0x6')](),controller['show']);router['get']('/:id/fields',auth[_0x37fa('0x6')](),controller[_0x37fa('0x9')]);router[_0x37fa('0x5')]('/:id/subjects',auth[_0x37fa('0x6')](),controller['getSubjects']);router[_0x37fa('0x5')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x37fa('0xa')]);router[_0x37fa('0xb')]('/',auth[_0x37fa('0x6')](),controller['create']);router[_0x37fa('0xc')](_0x37fa('0x8'),auth['isAuthenticated'](),controller[_0x37fa('0xd')]);router['delete'](_0x37fa('0x8'),auth[_0x37fa('0x6')](),controller[_0x37fa('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index f65caba..4162612 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 _0x2777=['ENUM','lead','contact','nothing','sequelize','STRING'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x2777,0x130));var _0x7277=function(_0x4b5b77,_0x4872f5){_0x4b5b77=_0x4b5b77-0x0;var _0x1b08f6=_0x2777[_0x4b5b77];return _0x1b08f6;};'use strict';var Sequelize=require(_0x7277('0x0'));module['exports']={'name':{'type':Sequelize[_0x7277('0x1')]},'moduleCreate':{'type':Sequelize[_0x7277('0x2')](_0x7277('0x3'),_0x7277('0x4'),_0x7277('0x5')),'defaultValue':_0x7277('0x3')},'moduleSearch':{'type':Sequelize[_0x7277('0x2')]('contact_lead','contact',_0x7277('0x3')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x7277('0x1')]}}; \ No newline at end of file +var _0xa306=['exports','STRING','lead','nothing','ENUM','contact_lead','contact','sequelize'];(function(_0x530d95,_0x3a41d7){var _0x27e413=function(_0xe9cd98){while(--_0xe9cd98){_0x530d95['push'](_0x530d95['shift']());}};_0x27e413(++_0x3a41d7);}(_0xa306,0x1cf));var _0x6a30=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xa306[_0x36884e];return _0x1cc367;};'use strict';var Sequelize=require(_0x6a30('0x0'));module[_0x6a30('0x1')]={'name':{'type':Sequelize[_0x6a30('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x6a30('0x3'),'contact',_0x6a30('0x4')),'defaultValue':_0x6a30('0x3')},'moduleSearch':{'type':Sequelize[_0x6a30('0x5')](_0x6a30('0x6'),_0x6a30('0x7'),_0x6a30('0x3')),'defaultValue':_0x6a30('0x6')},'description':{'type':Sequelize[_0x6a30('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 738ddd5..8b33806 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 _0x82bf=['rawAttributes','options','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','ZohoConfiguration','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','filter','getSubjects','findOne','ZohoField'];(function(_0xdbf211,_0x52aeb2){var _0xd3e054=function(_0x594bd2){while(--_0x594bd2){_0xdbf211['push'](_0xdbf211['shift']());}};_0xd3e054(++_0x52aeb2);}(_0x82bf,0x15b));var _0xf82b=function(_0x7bb4e,_0x4f9a3e){_0x7bb4e=_0x7bb4e-0x0;var _0x1f2978=_0x82bf[_0x7bb4e];return _0x1f2978;};'use strict';var emlformat=require(_0xf82b('0x0'));var rimraf=require(_0xf82b('0x1'));var zipdir=require(_0xf82b('0x2'));var jsonpatch=require(_0xf82b('0x3'));var rp=require(_0xf82b('0x4'));var moment=require(_0xf82b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf82b('0x6'));var util=require('util');var path=require(_0xf82b('0x7'));var sox=require(_0xf82b('0x8'));var csv=require(_0xf82b('0x9'));var ejs=require(_0xf82b('0xa'));var fs=require('fs');var fs_extra=require(_0xf82b('0xb'));var _=require(_0xf82b('0xc'));var squel=require(_0xf82b('0xd'));var crypto=require(_0xf82b('0xe'));var jsforce=require(_0xf82b('0xf'));var deskjs=require(_0xf82b('0x10'));var toCsv=require(_0xf82b('0x9'));var querystring=require(_0xf82b('0x11'));var Papa=require('papaparse');var Redis=require(_0xf82b('0x12'));var authService=require(_0xf82b('0x13'));var qs=require(_0xf82b('0x14'));var as=require(_0xf82b('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf82b('0x16'))(_0xf82b('0x17'));var utils=require(_0xf82b('0x18'));var config=require(_0xf82b('0x19'));var licenseUtil=require(_0xf82b('0x1a'));var db=require(_0xf82b('0x1b'))['db'];function respondWithStatusCode(_0x3be44f,_0x24bb9f){_0x24bb9f=_0x24bb9f||0xcc;return function(_0x5cf4e6){if(_0x5cf4e6){return _0x3be44f[_0xf82b('0x1c')](_0x24bb9f);}return _0x3be44f[_0xf82b('0x1d')](_0x24bb9f)[_0xf82b('0x1e')]();};}function respondWithResult(_0x385f3b,_0x4b44b3){_0x4b44b3=_0x4b44b3||0xc8;return function(_0x49a91e){if(_0x49a91e){return _0x385f3b[_0xf82b('0x1d')](_0x4b44b3)[_0xf82b('0x1f')](_0x49a91e);}};}function respondWithFilteredResult(_0x3ec897,_0x8e62e7){return function(_0x85da18){if(_0x85da18){var _0x993c0e=typeof _0x8e62e7['offset']==='undefined'&&typeof _0x8e62e7[_0xf82b('0x20')]===_0xf82b('0x21');var _0x51f79c=_0x85da18[_0xf82b('0x22')];var _0x19266c=_0x993c0e?0x0:_0x8e62e7[_0xf82b('0x23')];var _0x1e4e44=_0x993c0e?_0x85da18[_0xf82b('0x22')]:_0x8e62e7['offset']+_0x8e62e7[_0xf82b('0x20')];var _0x2bb2b6;if(_0x1e4e44>=_0x51f79c){_0x1e4e44=_0x51f79c;_0x2bb2b6=0xc8;}else{_0x2bb2b6=0xce;}_0x3ec897[_0xf82b('0x1d')](_0x2bb2b6);return _0x3ec897['set'](_0xf82b('0x24'),_0x19266c+'-'+_0x1e4e44+'/'+_0x51f79c)[_0xf82b('0x1f')](_0x85da18);}return null;};}function patchUpdates(_0x214d5b){return function(_0x1617d3){try{jsonpatch[_0xf82b('0x25')](_0x1617d3,_0x214d5b,!![]);}catch(_0x3153f6){return BPromise[_0xf82b('0x26')](_0x3153f6);}return _0x1617d3[_0xf82b('0x27')]();};}function saveUpdates(_0x149b1d,_0x45f601){return function(_0x1a9554){if(_0x1a9554){return _0x1a9554[_0xf82b('0x28')](_0x149b1d)['then'](function(_0x2c1c71){return _0x2c1c71;});}return null;};}function removeEntity(_0x87bd56,_0x41c5db){return function(_0x7d14f9){if(_0x7d14f9){return _0x7d14f9[_0xf82b('0x29')]()[_0xf82b('0x2a')](function(){_0x87bd56[_0xf82b('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44e4a5,_0x3b05e3){return function(_0x159637){if(!_0x159637){_0x44e4a5[_0xf82b('0x1c')](0x194);}return _0x159637;};}function handleError(_0x4258a0,_0x44186b){_0x44186b=_0x44186b||0x1f4;return function(_0x3e0da0){logger['error'](_0x3e0da0[_0xf82b('0x2b')]);if(_0x3e0da0[_0xf82b('0x2c')]){delete _0x3e0da0['name'];}_0x4258a0['status'](_0x44186b)[_0xf82b('0x2d')](_0x3e0da0);};}exports[_0xf82b('0x2e')]=function(_0x183d75,_0x4cc6ef){var _0x35f6c8={},_0x60843c={},_0x1e02dd={'count':0x0,'rows':[]};var _0x3b0b70=_[_0xf82b('0x2f')](db['ZohoConfiguration']['rawAttributes'],function(_0x14f9ad){return{'name':_0x14f9ad[_0xf82b('0x30')],'type':_0x14f9ad[_0xf82b('0x31')][_0xf82b('0x32')]};});_0x60843c[_0xf82b('0x33')]=_[_0xf82b('0x2f')](_0x3b0b70,_0xf82b('0x2c'));_0x60843c[_0xf82b('0x34')]=_[_0xf82b('0x35')](_0x183d75[_0xf82b('0x34')]);_0x60843c['filters']=_[_0xf82b('0x36')](_0x60843c[_0xf82b('0x33')],_0x60843c['query']);_0x35f6c8[_0xf82b('0x37')]=_[_0xf82b('0x36')](_0x60843c['model'],qs['fields'](_0x183d75[_0xf82b('0x34')][_0xf82b('0x38')]));_0x35f6c8[_0xf82b('0x37')]=_0x35f6c8['attributes'][_0xf82b('0x39')]?_0x35f6c8[_0xf82b('0x37')]:_0x60843c[_0xf82b('0x33')];if(!_0x183d75[_0xf82b('0x34')][_0xf82b('0x3a')](_0xf82b('0x3b'))){_0x35f6c8[_0xf82b('0x20')]=qs[_0xf82b('0x20')](_0x183d75[_0xf82b('0x34')][_0xf82b('0x20')]);_0x35f6c8[_0xf82b('0x23')]=qs[_0xf82b('0x23')](_0x183d75[_0xf82b('0x34')][_0xf82b('0x23')]);}_0x35f6c8[_0xf82b('0x3c')]=qs[_0xf82b('0x3d')](_0x183d75[_0xf82b('0x34')][_0xf82b('0x3d')]);_0x35f6c8[_0xf82b('0x3e')]=qs[_0xf82b('0x3f')](_[_0xf82b('0x40')](_0x183d75['query'],_0x60843c[_0xf82b('0x3f')]),_0x3b0b70);if(_0x183d75[_0xf82b('0x34')]['filter']){_0x35f6c8[_0xf82b('0x3e')]=_[_0xf82b('0x41')](_0x35f6c8['where'],{'$or':_[_0xf82b('0x2f')](_0x3b0b70,function(_0x45887d){if(_0x45887d['type']!==_0xf82b('0x42')){var _0x3093ec={};_0x3093ec[_0x45887d[_0xf82b('0x2c')]]={'$like':'%'+_0x183d75[_0xf82b('0x34')]['filter']+'%'};return _0x3093ec;}})});}_0x35f6c8=_['merge']({},_0x35f6c8,_0x183d75['options']);var _0x1428a4={'where':_0x35f6c8[_0xf82b('0x3e')]};return db[_0xf82b('0x43')][_0xf82b('0x22')](_0x1428a4)['then'](function(_0x13a83f){_0x1e02dd[_0xf82b('0x22')]=_0x13a83f;if(_0x183d75[_0xf82b('0x34')][_0xf82b('0x44')]){_0x35f6c8[_0xf82b('0x45')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0xf82b('0x46')](_0x35f6c8);})[_0xf82b('0x2a')](function(_0x12a5ee){_0x1e02dd[_0xf82b('0x47')]=_0x12a5ee;return _0x1e02dd;})['then'](respondWithFilteredResult(_0x4cc6ef,_0x35f6c8))[_0xf82b('0x48')](handleError(_0x4cc6ef,null));};exports[_0xf82b('0x49')]=function(_0x2783be,_0x3e507a){var _0x4d2e6f={'raw':![],'where':{'id':_0x2783be[_0xf82b('0x4a')]['id']}},_0x2a8f9a={};_0x2a8f9a[_0xf82b('0x33')]=_[_0xf82b('0x35')](db['ZohoConfiguration']['rawAttributes']);_0x2a8f9a['query']=_[_0xf82b('0x35')](_0x2783be[_0xf82b('0x34')]);_0x2a8f9a[_0xf82b('0x3f')]=_['intersection'](_0x2a8f9a[_0xf82b('0x33')],_0x2a8f9a[_0xf82b('0x34')]);_0x4d2e6f[_0xf82b('0x37')]=_[_0xf82b('0x36')](_0x2a8f9a[_0xf82b('0x33')],qs[_0xf82b('0x38')](_0x2783be[_0xf82b('0x34')]['fields']));_0x4d2e6f[_0xf82b('0x37')]=_0x4d2e6f[_0xf82b('0x37')][_0xf82b('0x39')]?_0x4d2e6f[_0xf82b('0x37')]:_0x2a8f9a[_0xf82b('0x33')];if(_0x2783be[_0xf82b('0x34')][_0xf82b('0x44')]){_0x4d2e6f['include']=[{'all':!![]}];}_0x4d2e6f=_['merge']({},_0x4d2e6f,_0x2783be['options']);return db['ZohoConfiguration'][_0xf82b('0x4b')](_0x4d2e6f)[_0xf82b('0x2a')](handleEntityNotFound(_0x3e507a,null))['then'](respondWithResult(_0x3e507a,null))[_0xf82b('0x48')](handleError(_0x3e507a,null));};exports[_0xf82b('0x4c')]=function(_0x2ba987,_0x251b04){return db[_0xf82b('0x43')][_0xf82b('0x4c')](_0x2ba987['body'],{})['then'](respondWithResult(_0x251b04,0xc9))['catch'](handleError(_0x251b04,null));};exports['update']=function(_0x881ff,_0x16275c){if(_0x881ff['body']['id']){delete _0x881ff[_0xf82b('0x4d')]['id'];}return db[_0xf82b('0x43')][_0xf82b('0x4b')]({'where':{'id':_0x881ff[_0xf82b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x16275c,null))[_0xf82b('0x2a')](saveUpdates(_0x881ff[_0xf82b('0x4d')],null))[_0xf82b('0x2a')](respondWithResult(_0x16275c,null))[_0xf82b('0x48')](handleError(_0x16275c,null));};exports[_0xf82b('0x29')]=function(_0x12ac60,_0x45d06a){return db[_0xf82b('0x43')][_0xf82b('0x4b')]({'where':{'id':_0x12ac60[_0xf82b('0x4a')]['id']}})[_0xf82b('0x2a')](handleEntityNotFound(_0x45d06a,null))['then'](removeEntity(_0x45d06a,null))[_0xf82b('0x48')](handleError(_0x45d06a,null));};exports[_0xf82b('0x4e')]=function(_0x25c0dc,_0x380bf2,_0x5aadaf){var _0x4362cd={};var _0x102904={};var _0xa56b77;var _0x2faaac;return db[_0xf82b('0x43')]['findOne']({'where':{'id':_0x25c0dc[_0xf82b('0x4a')]['id']}})[_0xf82b('0x2a')](handleEntityNotFound(_0x380bf2,null))[_0xf82b('0x2a')](function(_0x32aee0){if(_0x32aee0){_0xa56b77=_0x32aee0;_0x102904['model']=_[_0xf82b('0x35')](db['ZohoField']['rawAttributes']);_0x102904['query']=_[_0xf82b('0x35')](_0x25c0dc['query']);_0x102904[_0xf82b('0x3f')]=_['intersection'](_0x102904['model'],_0x102904[_0xf82b('0x34')]);_0x4362cd[_0xf82b('0x37')]=_[_0xf82b('0x36')](_0x102904[_0xf82b('0x33')],qs[_0xf82b('0x38')](_0x25c0dc[_0xf82b('0x34')][_0xf82b('0x38')]));_0x4362cd[_0xf82b('0x37')]=_0x4362cd[_0xf82b('0x37')][_0xf82b('0x39')]?_0x4362cd['attributes']:_0x102904[_0xf82b('0x33')];_0x4362cd['order']=qs[_0xf82b('0x3d')](_0x25c0dc['query']['sort']);_0x4362cd[_0xf82b('0x3e')]=qs[_0xf82b('0x3f')](_[_0xf82b('0x40')](_0x25c0dc[_0xf82b('0x34')],_0x102904[_0xf82b('0x3f')]));if(_0x25c0dc[_0xf82b('0x34')][_0xf82b('0x4f')]){_0x4362cd['where']=_['merge'](_0x4362cd[_0xf82b('0x3e')],{'$or':_[_0xf82b('0x2f')](_0x4362cd[_0xf82b('0x37')],function(_0x109198){var _0x38bc31={};_0x38bc31[_0x109198]={'$like':'%'+_0x25c0dc[_0xf82b('0x34')][_0xf82b('0x4f')]+'%'};return _0x38bc31;})});}_0x4362cd=_['merge']({},_0x4362cd,_0x25c0dc['options']);return _0xa56b77[_0xf82b('0x4e')](_0x4362cd);}})['then'](function(_0x3f89a0){if(_0x3f89a0){_0x2faaac=_0x3f89a0[_0xf82b('0x39')];if(!_0x25c0dc['query'][_0xf82b('0x3a')]('nolimit')){_0x4362cd[_0xf82b('0x20')]=qs[_0xf82b('0x20')](_0x25c0dc[_0xf82b('0x34')][_0xf82b('0x20')]);_0x4362cd[_0xf82b('0x23')]=qs[_0xf82b('0x23')](_0x25c0dc['query']['offset']);}return _0xa56b77[_0xf82b('0x4e')](_0x4362cd);}})[_0xf82b('0x2a')](function(_0x451f49){if(_0x451f49){return _0x451f49?{'count':_0x2faaac,'rows':_0x451f49}:null;}})['then'](respondWithResult(_0x380bf2,null))[_0xf82b('0x48')](handleError(_0x380bf2,null));};exports[_0xf82b('0x50')]=function(_0x3fced6,_0x11fa4f,_0x1d60b2){var _0x4470e1={};var _0x1eb6da={};var _0x109c7f;var _0x7ecf03;return db[_0xf82b('0x43')][_0xf82b('0x51')]({'where':{'id':_0x3fced6[_0xf82b('0x4a')]['id']}})[_0xf82b('0x2a')](handleEntityNotFound(_0x11fa4f,null))[_0xf82b('0x2a')](function(_0x4c42fe){if(_0x4c42fe){_0x109c7f=_0x4c42fe;_0x1eb6da[_0xf82b('0x33')]=_[_0xf82b('0x35')](db[_0xf82b('0x52')][_0xf82b('0x53')]);_0x1eb6da[_0xf82b('0x34')]=_[_0xf82b('0x35')](_0x3fced6[_0xf82b('0x34')]);_0x1eb6da['filters']=_['intersection'](_0x1eb6da[_0xf82b('0x33')],_0x1eb6da[_0xf82b('0x34')]);_0x4470e1['attributes']=_['intersection'](_0x1eb6da[_0xf82b('0x33')],qs[_0xf82b('0x38')](_0x3fced6['query'][_0xf82b('0x38')]));_0x4470e1['attributes']=_0x4470e1[_0xf82b('0x37')][_0xf82b('0x39')]?_0x4470e1[_0xf82b('0x37')]:_0x1eb6da[_0xf82b('0x33')];_0x4470e1[_0xf82b('0x3c')]=qs[_0xf82b('0x3d')](_0x3fced6[_0xf82b('0x34')][_0xf82b('0x3d')]);_0x4470e1[_0xf82b('0x3e')]=qs[_0xf82b('0x3f')](_[_0xf82b('0x40')](_0x3fced6[_0xf82b('0x34')],_0x1eb6da['filters']));if(_0x3fced6['query'][_0xf82b('0x4f')]){_0x4470e1[_0xf82b('0x3e')]=_['merge'](_0x4470e1[_0xf82b('0x3e')],{'$or':_[_0xf82b('0x2f')](_0x4470e1[_0xf82b('0x37')],function(_0x3ccc89){var _0x4c2410={};_0x4c2410[_0x3ccc89]={'$like':'%'+_0x3fced6[_0xf82b('0x34')][_0xf82b('0x4f')]+'%'};return _0x4c2410;})});}_0x4470e1=_[_0xf82b('0x41')]({},_0x4470e1,_0x3fced6[_0xf82b('0x54')]);return _0x109c7f['getSubjects'](_0x4470e1);}})['then'](function(_0x361d36){if(_0x361d36){_0x7ecf03=_0x361d36[_0xf82b('0x39')];if(!_0x3fced6[_0xf82b('0x34')]['hasOwnProperty']('nolimit')){_0x4470e1[_0xf82b('0x20')]=qs[_0xf82b('0x20')](_0x3fced6[_0xf82b('0x34')]['limit']);_0x4470e1[_0xf82b('0x23')]=qs[_0xf82b('0x23')](_0x3fced6[_0xf82b('0x34')][_0xf82b('0x23')]);}return _0x109c7f[_0xf82b('0x50')](_0x4470e1);}})[_0xf82b('0x2a')](function(_0x4576e7){if(_0x4576e7){return _0x4576e7?{'count':_0x7ecf03,'rows':_0x4576e7}:null;}})[_0xf82b('0x2a')](respondWithResult(_0x11fa4f,null))[_0xf82b('0x48')](handleError(_0x11fa4f,null));};exports[_0xf82b('0x55')]=function(_0x1ec30a,_0x2400c9,_0x5b5144){var _0xa6de12={};var _0x5c0e80={};var _0x44b448;var _0x25b28e;return db[_0xf82b('0x43')][_0xf82b('0x51')]({'where':{'id':_0x1ec30a[_0xf82b('0x4a')]['id']}})[_0xf82b('0x2a')](handleEntityNotFound(_0x2400c9,null))[_0xf82b('0x2a')](function(_0x36c439){if(_0x36c439){_0x44b448=_0x36c439;_0x5c0e80[_0xf82b('0x33')]=_['keys'](db[_0xf82b('0x52')][_0xf82b('0x53')]);_0x5c0e80['query']=_[_0xf82b('0x35')](_0x1ec30a[_0xf82b('0x34')]);_0x5c0e80[_0xf82b('0x3f')]=_[_0xf82b('0x36')](_0x5c0e80[_0xf82b('0x33')],_0x5c0e80['query']);_0xa6de12[_0xf82b('0x37')]=_[_0xf82b('0x36')](_0x5c0e80['model'],qs[_0xf82b('0x38')](_0x1ec30a['query'][_0xf82b('0x38')]));_0xa6de12[_0xf82b('0x37')]=_0xa6de12['attributes'][_0xf82b('0x39')]?_0xa6de12[_0xf82b('0x37')]:_0x5c0e80[_0xf82b('0x33')];_0xa6de12[_0xf82b('0x3c')]=qs[_0xf82b('0x3d')](_0x1ec30a[_0xf82b('0x34')]['sort']);_0xa6de12[_0xf82b('0x3e')]=qs[_0xf82b('0x3f')](_[_0xf82b('0x40')](_0x1ec30a[_0xf82b('0x34')],_0x5c0e80[_0xf82b('0x3f')]));if(_0x1ec30a['query'][_0xf82b('0x4f')]){_0xa6de12[_0xf82b('0x3e')]=_[_0xf82b('0x41')](_0xa6de12[_0xf82b('0x3e')],{'$or':_[_0xf82b('0x2f')](_0xa6de12[_0xf82b('0x37')],function(_0x58a86c){var _0x5104cd={};_0x5104cd[_0x58a86c]={'$like':'%'+_0x1ec30a[_0xf82b('0x34')]['filter']+'%'};return _0x5104cd;})});}_0xa6de12=_[_0xf82b('0x41')]({},_0xa6de12,_0x1ec30a[_0xf82b('0x54')]);return _0x44b448[_0xf82b('0x55')](_0xa6de12);}})[_0xf82b('0x2a')](function(_0x241119){if(_0x241119){_0x25b28e=_0x241119[_0xf82b('0x39')];if(!_0x1ec30a['query'][_0xf82b('0x3a')](_0xf82b('0x3b'))){_0xa6de12['limit']=qs[_0xf82b('0x20')](_0x1ec30a['query'][_0xf82b('0x20')]);_0xa6de12['offset']=qs['offset'](_0x1ec30a[_0xf82b('0x34')][_0xf82b('0x23')]);}return _0x44b448[_0xf82b('0x55')](_0xa6de12);}})[_0xf82b('0x2a')](function(_0x58ae1d){if(_0x58ae1d){return _0x58ae1d?{'count':_0x25b28e,'rows':_0x58ae1d}:null;}})[_0xf82b('0x2a')](respondWithResult(_0x2400c9,null))[_0xf82b('0x48')](handleError(_0x2400c9,null));}; \ No newline at end of file +var _0x221f=['sort','where','merge','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','body','destroy','getFields','findOne','order','pick','filter','hasOwnProperty','getSubjects','getDescriptions','ZohoField','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','set','apply','reject','save','update','then','error','name','send','map','ZohoConfiguration','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit'];(function(_0x16af8a,_0x46a2d4){var _0x2bdb81=function(_0x139ff9){while(--_0x139ff9){_0x16af8a['push'](_0x16af8a['shift']());}};_0x2bdb81(++_0x46a2d4);}(_0x221f,0x1f2));var _0xf221=function(_0x3cc6b4,_0x58b1aa){_0x3cc6b4=_0x3cc6b4-0x0;var _0x1c07b8=_0x221f[_0x3cc6b4];return _0x1c07b8;};'use strict';var emlformat=require(_0xf221('0x0'));var rimraf=require(_0xf221('0x1'));var zipdir=require(_0xf221('0x2'));var jsonpatch=require(_0xf221('0x3'));var rp=require(_0xf221('0x4'));var moment=require(_0xf221('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf221('0x6'));var util=require('util');var path=require('path');var sox=require(_0xf221('0x7'));var csv=require('to-csv');var ejs=require(_0xf221('0x8'));var fs=require('fs');var fs_extra=require(_0xf221('0x9'));var _=require(_0xf221('0xa'));var squel=require(_0xf221('0xb'));var crypto=require(_0xf221('0xc'));var jsforce=require(_0xf221('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf221('0xe'));var querystring=require(_0xf221('0xf'));var Papa=require(_0xf221('0x10'));var Redis=require(_0xf221('0x11'));var authService=require(_0xf221('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf221('0x13'));var hardwareService=require(_0xf221('0x14'));var logger=require('../../config/logger')(_0xf221('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf221('0x16'));var db=require(_0xf221('0x17'))['db'];function respondWithStatusCode(_0x127290,_0x243a39){_0x243a39=_0x243a39||0xcc;return function(_0x2ea533){if(_0x2ea533){return _0x127290[_0xf221('0x18')](_0x243a39);}return _0x127290['status'](_0x243a39)[_0xf221('0x19')]();};}function respondWithResult(_0x349783,_0x2409c6){_0x2409c6=_0x2409c6||0xc8;return function(_0x1e66c9){if(_0x1e66c9){return _0x349783[_0xf221('0x1a')](_0x2409c6)[_0xf221('0x1b')](_0x1e66c9);}};}function respondWithFilteredResult(_0x1db108,_0x510a02){return function(_0x5563f4){if(_0x5563f4){var _0x16e8ae=typeof _0x510a02['offset']==='undefined'&&typeof _0x510a02[_0xf221('0x1c')]===_0xf221('0x1d');var _0x3ea743=_0x5563f4[_0xf221('0x1e')];var _0x1dd526=_0x16e8ae?0x0:_0x510a02[_0xf221('0x1f')];var _0x2d60a8=_0x16e8ae?_0x5563f4[_0xf221('0x1e')]:_0x510a02[_0xf221('0x1f')]+_0x510a02[_0xf221('0x1c')];var _0x4cf0a7;if(_0x2d60a8>=_0x3ea743){_0x2d60a8=_0x3ea743;_0x4cf0a7=0xc8;}else{_0x4cf0a7=0xce;}_0x1db108[_0xf221('0x1a')](_0x4cf0a7);return _0x1db108[_0xf221('0x20')]('Content-Range',_0x1dd526+'-'+_0x2d60a8+'/'+_0x3ea743)[_0xf221('0x1b')](_0x5563f4);}return null;};}function patchUpdates(_0x548a86){return function(_0x3b25aa){try{jsonpatch[_0xf221('0x21')](_0x3b25aa,_0x548a86,!![]);}catch(_0x569aae){return BPromise[_0xf221('0x22')](_0x569aae);}return _0x3b25aa[_0xf221('0x23')]();};}function saveUpdates(_0x16778b,_0x5bb6fe){return function(_0x3acfe6){if(_0x3acfe6){return _0x3acfe6[_0xf221('0x24')](_0x16778b)[_0xf221('0x25')](function(_0x5286b7){return _0x5286b7;});}return null;};}function removeEntity(_0x7986b3,_0x5630a4){return function(_0x3cf72c){if(_0x3cf72c){return _0x3cf72c['destroy']()[_0xf221('0x25')](function(){_0x7986b3[_0xf221('0x1a')](0xcc)[_0xf221('0x19')]();});}};}function handleEntityNotFound(_0x55e053,_0x37b5f0){return function(_0x24bc1c){if(!_0x24bc1c){_0x55e053[_0xf221('0x18')](0x194);}return _0x24bc1c;};}function handleError(_0x277e34,_0x2b27f8){_0x2b27f8=_0x2b27f8||0x1f4;return function(_0x5e458f){logger[_0xf221('0x26')](_0x5e458f['stack']);if(_0x5e458f[_0xf221('0x27')]){delete _0x5e458f[_0xf221('0x27')];}_0x277e34[_0xf221('0x1a')](_0x2b27f8)[_0xf221('0x28')](_0x5e458f);};}exports['index']=function(_0x343116,_0x3ebd75){var _0x138a22={},_0x2fcfe5={},_0x34fbb8={'count':0x0,'rows':[]};var _0x261037=_[_0xf221('0x29')](db[_0xf221('0x2a')][_0xf221('0x2b')],function(_0x5a6a93){return{'name':_0x5a6a93['fieldName'],'type':_0x5a6a93[_0xf221('0x2c')][_0xf221('0x2d')]};});_0x2fcfe5[_0xf221('0x2e')]=_[_0xf221('0x29')](_0x261037,_0xf221('0x27'));_0x2fcfe5['query']=_[_0xf221('0x2f')](_0x343116[_0xf221('0x30')]);_0x2fcfe5[_0xf221('0x31')]=_[_0xf221('0x32')](_0x2fcfe5['model'],_0x2fcfe5[_0xf221('0x30')]);_0x138a22[_0xf221('0x33')]=_[_0xf221('0x32')](_0x2fcfe5[_0xf221('0x2e')],qs[_0xf221('0x34')](_0x343116[_0xf221('0x30')][_0xf221('0x34')]));_0x138a22[_0xf221('0x33')]=_0x138a22['attributes'][_0xf221('0x35')]?_0x138a22['attributes']:_0x2fcfe5['model'];if(!_0x343116[_0xf221('0x30')]['hasOwnProperty'](_0xf221('0x36'))){_0x138a22[_0xf221('0x1c')]=qs[_0xf221('0x1c')](_0x343116[_0xf221('0x30')][_0xf221('0x1c')]);_0x138a22[_0xf221('0x1f')]=qs[_0xf221('0x1f')](_0x343116[_0xf221('0x30')]['offset']);}_0x138a22['order']=qs[_0xf221('0x37')](_0x343116['query']['sort']);_0x138a22[_0xf221('0x38')]=qs[_0xf221('0x31')](_['pick'](_0x343116['query'],_0x2fcfe5[_0xf221('0x31')]),_0x261037);if(_0x343116[_0xf221('0x30')]['filter']){_0x138a22[_0xf221('0x38')]=_[_0xf221('0x39')](_0x138a22['where'],{'$or':_['map'](_0x261037,function(_0x1e7ef9){if(_0x1e7ef9[_0xf221('0x2c')]!==_0xf221('0x3a')){var _0x1e0f52={};_0x1e0f52[_0x1e7ef9[_0xf221('0x27')]]={'$like':'%'+_0x343116[_0xf221('0x30')]['filter']+'%'};return _0x1e0f52;}})});}_0x138a22=_[_0xf221('0x39')]({},_0x138a22,_0x343116[_0xf221('0x3b')]);var _0x515adc={'where':_0x138a22[_0xf221('0x38')]};return db['ZohoConfiguration'][_0xf221('0x1e')](_0x515adc)[_0xf221('0x25')](function(_0x53727e){_0x34fbb8[_0xf221('0x1e')]=_0x53727e;if(_0x343116[_0xf221('0x30')]['includeAll']){_0x138a22[_0xf221('0x3c')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0xf221('0x3d')](_0x138a22);})[_0xf221('0x25')](function(_0x4b1f81){_0x34fbb8['rows']=_0x4b1f81;return _0x34fbb8;})[_0xf221('0x25')](respondWithFilteredResult(_0x3ebd75,_0x138a22))[_0xf221('0x3e')](handleError(_0x3ebd75,null));};exports[_0xf221('0x3f')]=function(_0x49d78d,_0x4df871){var _0x7bc3d1={'raw':![],'where':{'id':_0x49d78d[_0xf221('0x40')]['id']}},_0x3c4b50={};_0x3c4b50['model']=_['keys'](db[_0xf221('0x2a')][_0xf221('0x2b')]);_0x3c4b50['query']=_[_0xf221('0x2f')](_0x49d78d[_0xf221('0x30')]);_0x3c4b50['filters']=_[_0xf221('0x32')](_0x3c4b50[_0xf221('0x2e')],_0x3c4b50['query']);_0x7bc3d1[_0xf221('0x33')]=_['intersection'](_0x3c4b50[_0xf221('0x2e')],qs[_0xf221('0x34')](_0x49d78d['query'][_0xf221('0x34')]));_0x7bc3d1[_0xf221('0x33')]=_0x7bc3d1[_0xf221('0x33')][_0xf221('0x35')]?_0x7bc3d1['attributes']:_0x3c4b50[_0xf221('0x2e')];if(_0x49d78d['query'][_0xf221('0x41')]){_0x7bc3d1['include']=[{'all':!![]}];}_0x7bc3d1=_[_0xf221('0x39')]({},_0x7bc3d1,_0x49d78d[_0xf221('0x3b')]);return db[_0xf221('0x2a')][_0xf221('0x42')](_0x7bc3d1)[_0xf221('0x25')](handleEntityNotFound(_0x4df871,null))['then'](respondWithResult(_0x4df871,null))['catch'](handleError(_0x4df871,null));};exports[_0xf221('0x43')]=function(_0x5eacb8,_0x5915a6){return db[_0xf221('0x2a')][_0xf221('0x43')](_0x5eacb8['body'],{})[_0xf221('0x25')](respondWithResult(_0x5915a6,0xc9))[_0xf221('0x3e')](handleError(_0x5915a6,null));};exports[_0xf221('0x24')]=function(_0x106ac8,_0xbd2091){if(_0x106ac8[_0xf221('0x44')]['id']){delete _0x106ac8[_0xf221('0x44')]['id'];}return db[_0xf221('0x2a')]['find']({'where':{'id':_0x106ac8['params']['id']}})[_0xf221('0x25')](handleEntityNotFound(_0xbd2091,null))[_0xf221('0x25')](saveUpdates(_0x106ac8[_0xf221('0x44')],null))[_0xf221('0x25')](respondWithResult(_0xbd2091,null))[_0xf221('0x3e')](handleError(_0xbd2091,null));};exports[_0xf221('0x45')]=function(_0x17f1a2,_0x4a46ed){return db['ZohoConfiguration'][_0xf221('0x42')]({'where':{'id':_0x17f1a2[_0xf221('0x40')]['id']}})[_0xf221('0x25')](handleEntityNotFound(_0x4a46ed,null))[_0xf221('0x25')](removeEntity(_0x4a46ed,null))['catch'](handleError(_0x4a46ed,null));};exports[_0xf221('0x46')]=function(_0xaba453,_0x547a70,_0x49fbfa){var _0x1eef8a={};var _0x3f5111={};var _0x56935f;var _0x48b727;return db[_0xf221('0x2a')][_0xf221('0x47')]({'where':{'id':_0xaba453['params']['id']}})['then'](handleEntityNotFound(_0x547a70,null))['then'](function(_0x55ed3e){if(_0x55ed3e){_0x56935f=_0x55ed3e;_0x3f5111[_0xf221('0x2e')]=_[_0xf221('0x2f')](db['ZohoField'][_0xf221('0x2b')]);_0x3f5111[_0xf221('0x30')]=_['keys'](_0xaba453[_0xf221('0x30')]);_0x3f5111[_0xf221('0x31')]=_[_0xf221('0x32')](_0x3f5111['model'],_0x3f5111[_0xf221('0x30')]);_0x1eef8a[_0xf221('0x33')]=_['intersection'](_0x3f5111[_0xf221('0x2e')],qs[_0xf221('0x34')](_0xaba453[_0xf221('0x30')][_0xf221('0x34')]));_0x1eef8a[_0xf221('0x33')]=_0x1eef8a[_0xf221('0x33')][_0xf221('0x35')]?_0x1eef8a[_0xf221('0x33')]:_0x3f5111['model'];_0x1eef8a[_0xf221('0x48')]=qs['sort'](_0xaba453[_0xf221('0x30')][_0xf221('0x37')]);_0x1eef8a[_0xf221('0x38')]=qs[_0xf221('0x31')](_[_0xf221('0x49')](_0xaba453['query'],_0x3f5111['filters']));if(_0xaba453['query']['filter']){_0x1eef8a['where']=_[_0xf221('0x39')](_0x1eef8a[_0xf221('0x38')],{'$or':_['map'](_0x1eef8a['attributes'],function(_0x30804c){var _0x18edb9={};_0x18edb9[_0x30804c]={'$like':'%'+_0xaba453[_0xf221('0x30')][_0xf221('0x4a')]+'%'};return _0x18edb9;})});}_0x1eef8a=_[_0xf221('0x39')]({},_0x1eef8a,_0xaba453[_0xf221('0x3b')]);return _0x56935f[_0xf221('0x46')](_0x1eef8a);}})['then'](function(_0x3fcb21){if(_0x3fcb21){_0x48b727=_0x3fcb21[_0xf221('0x35')];if(!_0xaba453[_0xf221('0x30')][_0xf221('0x4b')](_0xf221('0x36'))){_0x1eef8a[_0xf221('0x1c')]=qs[_0xf221('0x1c')](_0xaba453['query'][_0xf221('0x1c')]);_0x1eef8a[_0xf221('0x1f')]=qs[_0xf221('0x1f')](_0xaba453[_0xf221('0x30')]['offset']);}return _0x56935f[_0xf221('0x46')](_0x1eef8a);}})['then'](function(_0xfbc731){if(_0xfbc731){return _0xfbc731?{'count':_0x48b727,'rows':_0xfbc731}:null;}})[_0xf221('0x25')](respondWithResult(_0x547a70,null))[_0xf221('0x3e')](handleError(_0x547a70,null));};exports[_0xf221('0x4c')]=function(_0x400339,_0x310855,_0x1d0b00){var _0x5af13e={};var _0x1a2093={};var _0x322f23;var _0x183999;return db[_0xf221('0x2a')]['findOne']({'where':{'id':_0x400339[_0xf221('0x40')]['id']}})[_0xf221('0x25')](handleEntityNotFound(_0x310855,null))['then'](function(_0x4d7d42){if(_0x4d7d42){_0x322f23=_0x4d7d42;_0x1a2093[_0xf221('0x2e')]=_[_0xf221('0x2f')](db['ZohoField'][_0xf221('0x2b')]);_0x1a2093[_0xf221('0x30')]=_['keys'](_0x400339[_0xf221('0x30')]);_0x1a2093[_0xf221('0x31')]=_[_0xf221('0x32')](_0x1a2093[_0xf221('0x2e')],_0x1a2093[_0xf221('0x30')]);_0x5af13e[_0xf221('0x33')]=_[_0xf221('0x32')](_0x1a2093['model'],qs[_0xf221('0x34')](_0x400339['query'][_0xf221('0x34')]));_0x5af13e['attributes']=_0x5af13e[_0xf221('0x33')]['length']?_0x5af13e['attributes']:_0x1a2093[_0xf221('0x2e')];_0x5af13e[_0xf221('0x48')]=qs[_0xf221('0x37')](_0x400339[_0xf221('0x30')][_0xf221('0x37')]);_0x5af13e['where']=qs[_0xf221('0x31')](_['pick'](_0x400339[_0xf221('0x30')],_0x1a2093[_0xf221('0x31')]));if(_0x400339[_0xf221('0x30')][_0xf221('0x4a')]){_0x5af13e[_0xf221('0x38')]=_['merge'](_0x5af13e[_0xf221('0x38')],{'$or':_['map'](_0x5af13e[_0xf221('0x33')],function(_0x301845){var _0x2fc3a8={};_0x2fc3a8[_0x301845]={'$like':'%'+_0x400339[_0xf221('0x30')][_0xf221('0x4a')]+'%'};return _0x2fc3a8;})});}_0x5af13e=_[_0xf221('0x39')]({},_0x5af13e,_0x400339['options']);return _0x322f23[_0xf221('0x4c')](_0x5af13e);}})['then'](function(_0xd60510){if(_0xd60510){_0x183999=_0xd60510[_0xf221('0x35')];if(!_0x400339[_0xf221('0x30')][_0xf221('0x4b')](_0xf221('0x36'))){_0x5af13e[_0xf221('0x1c')]=qs[_0xf221('0x1c')](_0x400339[_0xf221('0x30')][_0xf221('0x1c')]);_0x5af13e['offset']=qs[_0xf221('0x1f')](_0x400339[_0xf221('0x30')][_0xf221('0x1f')]);}return _0x322f23[_0xf221('0x4c')](_0x5af13e);}})[_0xf221('0x25')](function(_0xf5dc2d){if(_0xf5dc2d){return _0xf5dc2d?{'count':_0x183999,'rows':_0xf5dc2d}:null;}})[_0xf221('0x25')](respondWithResult(_0x310855,null))[_0xf221('0x3e')](handleError(_0x310855,null));};exports[_0xf221('0x4d')]=function(_0x2de81a,_0xa99aea,_0x4267da){var _0x371046={};var _0x4c71eb={};var _0x4c0854;var _0x3a564c;return db[_0xf221('0x2a')]['findOne']({'where':{'id':_0x2de81a[_0xf221('0x40')]['id']}})['then'](handleEntityNotFound(_0xa99aea,null))[_0xf221('0x25')](function(_0x4b3992){if(_0x4b3992){_0x4c0854=_0x4b3992;_0x4c71eb[_0xf221('0x2e')]=_[_0xf221('0x2f')](db[_0xf221('0x4e')][_0xf221('0x2b')]);_0x4c71eb[_0xf221('0x30')]=_[_0xf221('0x2f')](_0x2de81a[_0xf221('0x30')]);_0x4c71eb[_0xf221('0x31')]=_[_0xf221('0x32')](_0x4c71eb[_0xf221('0x2e')],_0x4c71eb[_0xf221('0x30')]);_0x371046[_0xf221('0x33')]=_['intersection'](_0x4c71eb['model'],qs[_0xf221('0x34')](_0x2de81a['query'][_0xf221('0x34')]));_0x371046[_0xf221('0x33')]=_0x371046['attributes'][_0xf221('0x35')]?_0x371046[_0xf221('0x33')]:_0x4c71eb[_0xf221('0x2e')];_0x371046[_0xf221('0x48')]=qs['sort'](_0x2de81a[_0xf221('0x30')][_0xf221('0x37')]);_0x371046['where']=qs[_0xf221('0x31')](_[_0xf221('0x49')](_0x2de81a['query'],_0x4c71eb[_0xf221('0x31')]));if(_0x2de81a['query']['filter']){_0x371046[_0xf221('0x38')]=_['merge'](_0x371046[_0xf221('0x38')],{'$or':_[_0xf221('0x29')](_0x371046['attributes'],function(_0x3e1c03){var _0x4aa62a={};_0x4aa62a[_0x3e1c03]={'$like':'%'+_0x2de81a[_0xf221('0x30')]['filter']+'%'};return _0x4aa62a;})});}_0x371046=_['merge']({},_0x371046,_0x2de81a[_0xf221('0x3b')]);return _0x4c0854[_0xf221('0x4d')](_0x371046);}})['then'](function(_0x4bce93){if(_0x4bce93){_0x3a564c=_0x4bce93['length'];if(!_0x2de81a['query']['hasOwnProperty'](_0xf221('0x36'))){_0x371046[_0xf221('0x1c')]=qs['limit'](_0x2de81a[_0xf221('0x30')][_0xf221('0x1c')]);_0x371046[_0xf221('0x1f')]=qs[_0xf221('0x1f')](_0x2de81a[_0xf221('0x30')]['offset']);}return _0x4c0854[_0xf221('0x4d')](_0x371046);}})[_0xf221('0x25')](function(_0x4ad922){if(_0x4ad922){return _0x4ad922?{'count':_0x3a564c,'rows':_0x4ad922}:null;}})[_0xf221('0x25')](respondWithResult(_0xa99aea,null))[_0xf221('0x3e')](handleError(_0xa99aea,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 4c2db74..6e943c6 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 _0x6093=['./intZohoConfiguration.attributes','define','int_zoho_configurations','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x6093,0x1ed));var _0x3609=function(_0x40121f,_0x15dd3d){_0x40121f=_0x40121f-0x0;var _0x52a02b=_0x6093[_0x40121f];return _0x52a02b;};'use strict';var _=require(_0x3609('0x0'));var util=require(_0x3609('0x1'));var logger=require(_0x3609('0x2'))(_0x3609('0x3'));var moment=require('moment');var BPromise=require(_0x3609('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3609('0x5'));var rimraf=require(_0x3609('0x6'));var config=require('../../config/environment');var attributes=require(_0x3609('0x7'));module['exports']=function(_0x4f5517,_0x7652a8){return _0x4f5517[_0x3609('0x8')]('ZohoConfiguration',attributes,{'tableName':_0x3609('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x089f=['exports','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment'];(function(_0x16dfee,_0x1dba0b){var _0x3ced82=function(_0x1fac3f){while(--_0x1fac3f){_0x16dfee['push'](_0x16dfee['shift']());}};_0x3ced82(++_0x1dba0b);}(_0x089f,0x125));var _0xf089=function(_0x5db336,_0x554ee1){_0x5db336=_0x5db336-0x0;var _0xb4863b=_0x089f[_0x5db336];return _0xb4863b;};'use strict';var _=require(_0xf089('0x0'));var util=require(_0xf089('0x1'));var logger=require(_0xf089('0x2'))(_0xf089('0x3'));var moment=require('moment');var BPromise=require(_0xf089('0x4'));var rp=require(_0xf089('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf089('0x6'));var attributes=require('./intZohoConfiguration.attributes');module[_0xf089('0x7')]=function(_0xa202e5,_0x1d2d50){return _0xa202e5['define'](_0xf089('0x8'),attributes,{'tableName':_0xf089('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index f04208e..898a0cf 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 _0x559d=['ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x559d,0x147));var _0xd559=function(_0x2301c1,_0x3c5a47){_0x2301c1=_0x2301c1-0x0;var _0x28f1eb=_0x559d[_0x2301c1];return _0x28f1eb;};'use strict';var _=require(_0xd559('0x0'));var util=require(_0xd559('0x1'));var moment=require(_0xd559('0x2'));var BPromise=require(_0xd559('0x3'));var rs=require(_0xd559('0x4'));var fs=require('fs');var Redis=require(_0xd559('0x5'));var db=require(_0xd559('0x6'))['db'];var utils=require(_0xd559('0x7'));var logger=require(_0xd559('0x8'))(_0xd559('0x9'));var config=require('../../config/environment');var jayson=require(_0xd559('0xa'));var client=jayson[_0xd559('0xb')][_0xd559('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4eaa23,_0x17da0c,_0x52cbd9){return new BPromise(function(_0x1838d4,_0x3cd012){return client[_0xd559('0xd')](_0x4eaa23,_0x52cbd9)['then'](function(_0x5d622f){logger[_0xd559('0xe')](_0xd559('0xf'),_0x17da0c,_0xd559('0x10'));logger[_0xd559('0x11')](_0xd559('0x12'),_0x17da0c,_0xd559('0x10'),JSON[_0xd559('0x13')](_0x5d622f));if(_0x5d622f[_0xd559('0x14')]){if(_0x5d622f[_0xd559('0x14')]['code']===0x1f4){logger[_0xd559('0x14')](_0xd559('0xf'),_0x17da0c,_0x5d622f[_0xd559('0x14')][_0xd559('0x15')]);return _0x3cd012(_0x5d622f[_0xd559('0x14')][_0xd559('0x15')]);}logger[_0xd559('0x14')]('ZohoConfiguration,\x20%s,\x20%s',_0x17da0c,_0x5d622f[_0xd559('0x14')][_0xd559('0x15')]);return _0x1838d4(_0x5d622f[_0xd559('0x14')][_0xd559('0x15')]);}else{logger[_0xd559('0xe')](_0xd559('0xf'),_0x17da0c,_0xd559('0x10'));_0x1838d4(_0x5d622f['result'][_0xd559('0x15')]);}})[_0xd559('0x16')](function(_0x19bcfd){logger[_0xd559('0x14')](_0xd559('0xf'),_0x17da0c,_0x19bcfd);_0x3cd012(_0x19bcfd);});});} \ No newline at end of file +var _0x8a91=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8a91,0x11c));var _0x18a9=function(_0x54e563,_0x3a7876){_0x54e563=_0x54e563-0x0;var _0x1a1520=_0x8a91[_0x54e563];return _0x1a1520;};'use strict';var _=require(_0x18a9('0x0'));var util=require('util');var moment=require(_0x18a9('0x1'));var BPromise=require(_0x18a9('0x2'));var rs=require(_0x18a9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x18a9('0x4'))['db'];var utils=require(_0x18a9('0x5'));var logger=require(_0x18a9('0x6'))('rpc');var config=require(_0x18a9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x18a9('0x8')][_0x18a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1aef11,_0x5723c4,_0xee1e86){return new BPromise(function(_0x1241ed,_0x158c1e){return client[_0x18a9('0xa')](_0x1aef11,_0xee1e86)[_0x18a9('0xb')](function(_0x52e293){logger['info'](_0x18a9('0xc'),_0x5723c4,_0x18a9('0xd'));logger[_0x18a9('0xe')](_0x18a9('0xf'),_0x5723c4,'request\x20sent',JSON[_0x18a9('0x10')](_0x52e293));if(_0x52e293[_0x18a9('0x11')]){if(_0x52e293['error']['code']===0x1f4){logger[_0x18a9('0x11')](_0x18a9('0xc'),_0x5723c4,_0x52e293['error'][_0x18a9('0x12')]);return _0x158c1e(_0x52e293[_0x18a9('0x11')][_0x18a9('0x12')]);}logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x5723c4,_0x52e293[_0x18a9('0x11')][_0x18a9('0x12')]);return _0x1241ed(_0x52e293[_0x18a9('0x11')][_0x18a9('0x12')]);}else{logger[_0x18a9('0x13')](_0x18a9('0xc'),_0x5723c4,_0x18a9('0xd'));_0x1241ed(_0x52e293[_0x18a9('0x14')][_0x18a9('0x12')]);}})[_0x18a9('0x15')](function(_0x3faa74){logger[_0x18a9('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x5723c4,_0x3faa74);_0x158c1e(_0x3faa74);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 4a9dc10..5ca48c0 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 _0xaf26=['put','update','delete','path','express','Router','fs-extra','../../components/interaction/service','./intZohoField.controller','get','isAuthenticated','/:id','show','create'];(function(_0x1d558c,_0x1e497c){var _0x15767d=function(_0x26326d){while(--_0x26326d){_0x1d558c['push'](_0x1d558c['shift']());}};_0x15767d(++_0x1e497c);}(_0xaf26,0x81));var _0x6af2=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0xaf26[_0x4bb66f];return _0xf2772f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6af2('0x0'));var timeout=require('connect-timeout');var express=require(_0x6af2('0x1'));var router=express[_0x6af2('0x2')]();var fs_extra=require(_0x6af2('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x6af2('0x4'));var config=require('../../config/environment');var controller=require(_0x6af2('0x5'));router[_0x6af2('0x6')]('/',auth[_0x6af2('0x7')](),controller['index']);router[_0x6af2('0x6')](_0x6af2('0x8'),auth['isAuthenticated'](),controller[_0x6af2('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6af2('0xa')]);router[_0x6af2('0xb')](_0x6af2('0x8'),auth[_0x6af2('0x7')](),controller[_0x6af2('0xc')]);router[_0x6af2('0xd')](_0x6af2('0x8'),auth[_0x6af2('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8475=['put','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../config/environment','./intZohoField.controller','isAuthenticated','index','get','/:id','post','create'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x8475,0x147));var _0x5847=function(_0xb6ab42,_0x57f039){_0xb6ab42=_0xb6ab42-0x0;var _0x14ed73=_0x8475[_0xb6ab42];return _0x14ed73;};'use strict';var multer=require('multer');var util=require(_0x5847('0x0'));var path=require(_0x5847('0x1'));var timeout=require(_0x5847('0x2'));var express=require(_0x5847('0x3'));var router=express['Router']();var fs_extra=require(_0x5847('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5847('0x5'));var controller=require(_0x5847('0x6'));router['get']('/',auth[_0x5847('0x7')](),controller[_0x5847('0x8')]);router[_0x5847('0x9')](_0x5847('0xa'),auth[_0x5847('0x7')](),controller['show']);router[_0x5847('0xb')]('/',auth['isAuthenticated'](),controller[_0x5847('0xc')]);router[_0x5847('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x5847('0xe')]('/:id',auth[_0x5847('0x7')](),controller[_0x5847('0xf')]);module[_0x5847('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 5e2a5aa..9279af4 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 _0xd01d=['exports','ENUM','string','customVariable','picklist','STRING','variable','BOOLEAN','sequelize'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd01d,0xe0));var _0xdd01=function(_0x1302f8,_0x3a1bc1){_0x1302f8=_0x1302f8-0x0;var _0x1a310f=_0xd01d[_0x1302f8];return _0x1a310f;};'use strict';var Sequelize=require(_0xdd01('0x0'));module[_0xdd01('0x1')]={'type':{'type':Sequelize[_0xdd01('0x2')](_0xdd01('0x3'),'variable',_0xdd01('0x4'),'keyValue',_0xdd01('0x5')),'defaultValue':_0xdd01('0x3')},'content':{'type':Sequelize[_0xdd01('0x6')]},'key':{'type':Sequelize[_0xdd01('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xdd01('0x3'),_0xdd01('0x7'),_0xdd01('0x4'))},'keyContent':{'type':Sequelize[_0xdd01('0x6')]},'idField':{'type':Sequelize[_0xdd01('0x6')]},'nameField':{'type':Sequelize[_0xdd01('0x6')]},'customField':{'type':Sequelize[_0xdd01('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdd01('0x6')]}}; \ No newline at end of file +var _0x4e1c=['customVariable','keyValue','picklist','string','STRING','variable','sequelize','exports','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4e1c,0xd5));var _0xc4e1=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x4e1c[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0xc4e1('0x0'));module[_0xc4e1('0x1')]={'type':{'type':Sequelize[_0xc4e1('0x2')]('string','variable',_0xc4e1('0x3'),_0xc4e1('0x4'),_0xc4e1('0x5')),'defaultValue':_0xc4e1('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc4e1('0x7')]},'keyType':{'type':Sequelize[_0xc4e1('0x2')]('string',_0xc4e1('0x8'),_0xc4e1('0x3'))},'keyContent':{'type':Sequelize[_0xc4e1('0x7')]},'idField':{'type':Sequelize[_0xc4e1('0x7')]},'nameField':{'type':Sequelize[_0xc4e1('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc4e1('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 6b1c148..2ba55e0 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 _0xa081=['querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','offset','count','limit','Content-Range','apply','then','destroy','name','send','index','map','ZohoField','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','options','includeAll','rows','catch','show','merge','create','body','update','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa081,0x7c));var _0x1a08=function(_0x47d406,_0x3e9707){_0x47d406=_0x47d406-0x0;var _0x3e643f=_0xa081[_0x47d406];return _0x3e643f;};'use strict';var emlformat=require(_0x1a08('0x0'));var rimraf=require(_0x1a08('0x1'));var zipdir=require(_0x1a08('0x2'));var jsonpatch=require(_0x1a08('0x3'));var rp=require(_0x1a08('0x4'));var moment=require('moment');var BPromise=require(_0x1a08('0x5'));var Mustache=require(_0x1a08('0x6'));var util=require('util');var path=require(_0x1a08('0x7'));var sox=require('sox');var csv=require(_0x1a08('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1a08('0x9'));var _=require(_0x1a08('0xa'));var squel=require(_0x1a08('0xb'));var crypto=require(_0x1a08('0xc'));var jsforce=require(_0x1a08('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1a08('0x8'));var querystring=require(_0x1a08('0xe'));var Papa=require(_0x1a08('0xf'));var Redis=require(_0x1a08('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1a08('0x11'));var hardwareService=require(_0x1a08('0x12'));var logger=require(_0x1a08('0x13'))(_0x1a08('0x14'));var utils=require('../../config/utils');var config=require(_0x1a08('0x15'));var licenseUtil=require(_0x1a08('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a12a0,_0x1c9f3d){_0x1c9f3d=_0x1c9f3d||0xcc;return function(_0x5ac9b5){if(_0x5ac9b5){return _0x2a12a0[_0x1a08('0x17')](_0x1c9f3d);}return _0x2a12a0['status'](_0x1c9f3d)[_0x1a08('0x18')]();};}function respondWithResult(_0x4dad1a,_0x671f33){_0x671f33=_0x671f33||0xc8;return function(_0x2b1722){if(_0x2b1722){return _0x4dad1a[_0x1a08('0x19')](_0x671f33)[_0x1a08('0x1a')](_0x2b1722);}};}function respondWithFilteredResult(_0x52f8a5,_0x1f8b20){return function(_0x2e69e6){if(_0x2e69e6){var _0x382284=typeof _0x1f8b20['offset']===_0x1a08('0x1b')&&typeof _0x1f8b20['limit']==='undefined';var _0x19215f=_0x2e69e6['count'];var _0x2a01b5=_0x382284?0x0:_0x1f8b20[_0x1a08('0x1c')];var _0xb5d896=_0x382284?_0x2e69e6[_0x1a08('0x1d')]:_0x1f8b20[_0x1a08('0x1c')]+_0x1f8b20[_0x1a08('0x1e')];var _0x31caf7;if(_0xb5d896>=_0x19215f){_0xb5d896=_0x19215f;_0x31caf7=0xc8;}else{_0x31caf7=0xce;}_0x52f8a5[_0x1a08('0x19')](_0x31caf7);return _0x52f8a5['set'](_0x1a08('0x1f'),_0x2a01b5+'-'+_0xb5d896+'/'+_0x19215f)[_0x1a08('0x1a')](_0x2e69e6);}return null;};}function patchUpdates(_0x2ec106){return function(_0x43fe86){try{jsonpatch[_0x1a08('0x20')](_0x43fe86,_0x2ec106,!![]);}catch(_0x569388){return BPromise['reject'](_0x569388);}return _0x43fe86['save']();};}function saveUpdates(_0x527447,_0x3709fb){return function(_0x246295){if(_0x246295){return _0x246295['update'](_0x527447)[_0x1a08('0x21')](function(_0x5e29ba){return _0x5e29ba;});}return null;};}function removeEntity(_0xe3d5df,_0x5985ef){return function(_0x36804b){if(_0x36804b){return _0x36804b[_0x1a08('0x22')]()['then'](function(){_0xe3d5df[_0x1a08('0x19')](0xcc)[_0x1a08('0x18')]();});}};}function handleEntityNotFound(_0x5955b6,_0x2b6bb6){return function(_0x4a53d8){if(!_0x4a53d8){_0x5955b6['sendStatus'](0x194);}return _0x4a53d8;};}function handleError(_0x357323,_0x1057c5){_0x1057c5=_0x1057c5||0x1f4;return function(_0x4f5529){logger['error'](_0x4f5529['stack']);if(_0x4f5529['name']){delete _0x4f5529[_0x1a08('0x23')];}_0x357323[_0x1a08('0x19')](_0x1057c5)[_0x1a08('0x24')](_0x4f5529);};}exports[_0x1a08('0x25')]=function(_0x505e5f,_0x13b3a4){var _0x28efdd={},_0x2ded56={},_0x421c6b={'count':0x0,'rows':[]};var _0x312f3c=_[_0x1a08('0x26')](db[_0x1a08('0x27')][_0x1a08('0x28')],function(_0x19d793){return{'name':_0x19d793['fieldName'],'type':_0x19d793[_0x1a08('0x29')][_0x1a08('0x2a')]};});_0x2ded56[_0x1a08('0x2b')]=_[_0x1a08('0x26')](_0x312f3c,_0x1a08('0x23'));_0x2ded56['query']=_[_0x1a08('0x2c')](_0x505e5f[_0x1a08('0x2d')]);_0x2ded56[_0x1a08('0x2e')]=_[_0x1a08('0x2f')](_0x2ded56['model'],_0x2ded56[_0x1a08('0x2d')]);_0x28efdd[_0x1a08('0x30')]=_['intersection'](_0x2ded56[_0x1a08('0x2b')],qs[_0x1a08('0x31')](_0x505e5f[_0x1a08('0x2d')][_0x1a08('0x31')]));_0x28efdd[_0x1a08('0x30')]=_0x28efdd['attributes'][_0x1a08('0x32')]?_0x28efdd[_0x1a08('0x30')]:_0x2ded56[_0x1a08('0x2b')];if(!_0x505e5f[_0x1a08('0x2d')][_0x1a08('0x33')]('nolimit')){_0x28efdd[_0x1a08('0x1e')]=qs['limit'](_0x505e5f[_0x1a08('0x2d')][_0x1a08('0x1e')]);_0x28efdd[_0x1a08('0x1c')]=qs[_0x1a08('0x1c')](_0x505e5f[_0x1a08('0x2d')][_0x1a08('0x1c')]);}_0x28efdd[_0x1a08('0x34')]=qs[_0x1a08('0x35')](_0x505e5f[_0x1a08('0x2d')][_0x1a08('0x35')]);_0x28efdd['where']=qs[_0x1a08('0x2e')](_[_0x1a08('0x36')](_0x505e5f[_0x1a08('0x2d')],_0x2ded56[_0x1a08('0x2e')]),_0x312f3c);if(_0x505e5f[_0x1a08('0x2d')][_0x1a08('0x37')]){_0x28efdd[_0x1a08('0x38')]=_['merge'](_0x28efdd[_0x1a08('0x38')],{'$or':_[_0x1a08('0x26')](_0x312f3c,function(_0x27ddba){if(_0x27ddba['type']!==_0x1a08('0x39')){var _0x23e29f={};_0x23e29f[_0x27ddba[_0x1a08('0x23')]]={'$like':'%'+_0x505e5f['query']['filter']+'%'};return _0x23e29f;}})});}_0x28efdd=_['merge']({},_0x28efdd,_0x505e5f[_0x1a08('0x3a')]);var _0x1c97b2={'where':_0x28efdd[_0x1a08('0x38')]};return db[_0x1a08('0x27')][_0x1a08('0x1d')](_0x1c97b2)[_0x1a08('0x21')](function(_0x556025){_0x421c6b[_0x1a08('0x1d')]=_0x556025;if(_0x505e5f['query'][_0x1a08('0x3b')]){_0x28efdd['include']=[{'all':!![]}];}return db[_0x1a08('0x27')]['findAll'](_0x28efdd);})[_0x1a08('0x21')](function(_0x2c0e0c){_0x421c6b[_0x1a08('0x3c')]=_0x2c0e0c;return _0x421c6b;})[_0x1a08('0x21')](respondWithFilteredResult(_0x13b3a4,_0x28efdd))[_0x1a08('0x3d')](handleError(_0x13b3a4,null));};exports[_0x1a08('0x3e')]=function(_0xc91ce1,_0x4e96c4){var _0x577509={'raw':!![],'where':{'id':_0xc91ce1['params']['id']}},_0x85a472={};_0x85a472['model']=_[_0x1a08('0x2c')](db[_0x1a08('0x27')][_0x1a08('0x28')]);_0x85a472[_0x1a08('0x2d')]=_[_0x1a08('0x2c')](_0xc91ce1[_0x1a08('0x2d')]);_0x85a472['filters']=_[_0x1a08('0x2f')](_0x85a472['model'],_0x85a472['query']);_0x577509[_0x1a08('0x30')]=_[_0x1a08('0x2f')](_0x85a472[_0x1a08('0x2b')],qs[_0x1a08('0x31')](_0xc91ce1[_0x1a08('0x2d')][_0x1a08('0x31')]));_0x577509[_0x1a08('0x30')]=_0x577509[_0x1a08('0x30')]['length']?_0x577509[_0x1a08('0x30')]:_0x85a472[_0x1a08('0x2b')];if(_0xc91ce1[_0x1a08('0x2d')][_0x1a08('0x3b')]){_0x577509['include']=[{'all':!![]}];}_0x577509=_[_0x1a08('0x3f')]({},_0x577509,_0xc91ce1[_0x1a08('0x3a')]);return db['ZohoField']['find'](_0x577509)['then'](handleEntityNotFound(_0x4e96c4,null))[_0x1a08('0x21')](respondWithResult(_0x4e96c4,null))[_0x1a08('0x3d')](handleError(_0x4e96c4,null));};exports[_0x1a08('0x40')]=function(_0x1f7a0a,_0x5805ed){return db['ZohoField'][_0x1a08('0x40')](_0x1f7a0a[_0x1a08('0x41')],{})[_0x1a08('0x21')](respondWithResult(_0x5805ed,0xc9))[_0x1a08('0x3d')](handleError(_0x5805ed,null));};exports[_0x1a08('0x42')]=function(_0x295a1f,_0x3316d1){if(_0x295a1f[_0x1a08('0x41')]['id']){delete _0x295a1f[_0x1a08('0x41')]['id'];}return db[_0x1a08('0x27')][_0x1a08('0x43')]({'where':{'id':_0x295a1f[_0x1a08('0x44')]['id']}})[_0x1a08('0x21')](handleEntityNotFound(_0x3316d1,null))[_0x1a08('0x21')](saveUpdates(_0x295a1f['body'],null))['then'](respondWithResult(_0x3316d1,null))[_0x1a08('0x3d')](handleError(_0x3316d1,null));};exports[_0x1a08('0x22')]=function(_0x5a1fe,_0x5ea6f7){return db[_0x1a08('0x27')]['find']({'where':{'id':_0x5a1fe[_0x1a08('0x44')]['id']}})['then'](handleEntityNotFound(_0x5ea6f7,null))['then'](removeEntity(_0x5ea6f7,null))['catch'](handleError(_0x5ea6f7,null));}; \ No newline at end of file +var _0xd844=['destroy','end','error','stack','name','index','ZohoField','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','type','filter','options','includeAll','include','findAll','catch','show','params','rawAttributes','length','find','create','body','update','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','ejs','squel','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','json','offset','undefined','count','limit','Content-Range','apply','save','then'];(function(_0xd21a3,_0x2430ac){var _0x17cb03=function(_0x5cd75b){while(--_0x5cd75b){_0xd21a3['push'](_0xd21a3['shift']());}};_0x17cb03(++_0x2430ac);}(_0xd844,0x6d));var _0x4d84=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xd844[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0x4d84('0x0'));var rimraf=require(_0x4d84('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d84('0x2'));var rp=require(_0x4d84('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4d84('0x4'));var util=require(_0x4d84('0x5'));var path=require(_0x4d84('0x6'));var sox=require(_0x4d84('0x7'));var csv=require('to-csv');var ejs=require(_0x4d84('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4d84('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4d84('0xa'));var toCsv=require(_0x4d84('0xb'));var querystring=require('querystring');var Papa=require(_0x4d84('0xc'));var Redis=require('ioredis');var authService=require(_0x4d84('0xd'));var qs=require(_0x4d84('0xe'));var as=require(_0x4d84('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4d84('0x10'))(_0x4d84('0x11'));var utils=require(_0x4d84('0x12'));var config=require(_0x4d84('0x13'));var licenseUtil=require(_0x4d84('0x14'));var db=require(_0x4d84('0x15'))['db'];function respondWithStatusCode(_0x406715,_0x3d744a){_0x3d744a=_0x3d744a||0xcc;return function(_0x12dad2){if(_0x12dad2){return _0x406715[_0x4d84('0x16')](_0x3d744a);}return _0x406715[_0x4d84('0x17')](_0x3d744a)['end']();};}function respondWithResult(_0x2634fa,_0x50f820){_0x50f820=_0x50f820||0xc8;return function(_0x34765d){if(_0x34765d){return _0x2634fa[_0x4d84('0x17')](_0x50f820)[_0x4d84('0x18')](_0x34765d);}};}function respondWithFilteredResult(_0x286f9f,_0x5d499c){return function(_0x1df099){if(_0x1df099){var _0x4ee2fe=typeof _0x5d499c[_0x4d84('0x19')]===_0x4d84('0x1a')&&typeof _0x5d499c['limit']==='undefined';var _0x47076e=_0x1df099['count'];var _0x4128d1=_0x4ee2fe?0x0:_0x5d499c[_0x4d84('0x19')];var _0x12349a=_0x4ee2fe?_0x1df099[_0x4d84('0x1b')]:_0x5d499c['offset']+_0x5d499c[_0x4d84('0x1c')];var _0x304346;if(_0x12349a>=_0x47076e){_0x12349a=_0x47076e;_0x304346=0xc8;}else{_0x304346=0xce;}_0x286f9f[_0x4d84('0x17')](_0x304346);return _0x286f9f['set'](_0x4d84('0x1d'),_0x4128d1+'-'+_0x12349a+'/'+_0x47076e)[_0x4d84('0x18')](_0x1df099);}return null;};}function patchUpdates(_0x53639b){return function(_0x27fdf2){try{jsonpatch[_0x4d84('0x1e')](_0x27fdf2,_0x53639b,!![]);}catch(_0x3de4df){return BPromise['reject'](_0x3de4df);}return _0x27fdf2[_0x4d84('0x1f')]();};}function saveUpdates(_0x1b2507,_0x29928e){return function(_0x2fc7dd){if(_0x2fc7dd){return _0x2fc7dd['update'](_0x1b2507)[_0x4d84('0x20')](function(_0x4cdba6){return _0x4cdba6;});}return null;};}function removeEntity(_0x229c8d,_0x5ebe25){return function(_0x48794f){if(_0x48794f){return _0x48794f[_0x4d84('0x21')]()[_0x4d84('0x20')](function(){_0x229c8d[_0x4d84('0x17')](0xcc)[_0x4d84('0x22')]();});}};}function handleEntityNotFound(_0xbd7401,_0x49f921){return function(_0x41a802){if(!_0x41a802){_0xbd7401['sendStatus'](0x194);}return _0x41a802;};}function handleError(_0x2eef79,_0x35276a){_0x35276a=_0x35276a||0x1f4;return function(_0x55c3b4){logger[_0x4d84('0x23')](_0x55c3b4[_0x4d84('0x24')]);if(_0x55c3b4[_0x4d84('0x25')]){delete _0x55c3b4[_0x4d84('0x25')];}_0x2eef79[_0x4d84('0x17')](_0x35276a)['send'](_0x55c3b4);};}exports[_0x4d84('0x26')]=function(_0x2014a6,_0x353bf2){var _0x539e8c={},_0x5ec750={},_0x73212a={'count':0x0,'rows':[]};var _0x1735ac=_['map'](db[_0x4d84('0x27')]['rawAttributes'],function(_0x492e61){return{'name':_0x492e61[_0x4d84('0x28')],'type':_0x492e61['type'][_0x4d84('0x29')]};});_0x5ec750[_0x4d84('0x2a')]=_[_0x4d84('0x2b')](_0x1735ac,'name');_0x5ec750[_0x4d84('0x2c')]=_[_0x4d84('0x2d')](_0x2014a6[_0x4d84('0x2c')]);_0x5ec750[_0x4d84('0x2e')]=_[_0x4d84('0x2f')](_0x5ec750['model'],_0x5ec750[_0x4d84('0x2c')]);_0x539e8c[_0x4d84('0x30')]=_[_0x4d84('0x2f')](_0x5ec750[_0x4d84('0x2a')],qs[_0x4d84('0x31')](_0x2014a6['query']['fields']));_0x539e8c['attributes']=_0x539e8c['attributes']['length']?_0x539e8c['attributes']:_0x5ec750[_0x4d84('0x2a')];if(!_0x2014a6['query'][_0x4d84('0x32')](_0x4d84('0x33'))){_0x539e8c['limit']=qs[_0x4d84('0x1c')](_0x2014a6['query']['limit']);_0x539e8c[_0x4d84('0x19')]=qs[_0x4d84('0x19')](_0x2014a6['query'][_0x4d84('0x19')]);}_0x539e8c[_0x4d84('0x34')]=qs[_0x4d84('0x35')](_0x2014a6[_0x4d84('0x2c')][_0x4d84('0x35')]);_0x539e8c[_0x4d84('0x36')]=qs[_0x4d84('0x2e')](_['pick'](_0x2014a6[_0x4d84('0x2c')],_0x5ec750[_0x4d84('0x2e')]),_0x1735ac);if(_0x2014a6[_0x4d84('0x2c')]['filter']){_0x539e8c[_0x4d84('0x36')]=_[_0x4d84('0x37')](_0x539e8c['where'],{'$or':_[_0x4d84('0x2b')](_0x1735ac,function(_0x522c6a){if(_0x522c6a[_0x4d84('0x38')]!=='VIRTUAL'){var _0x310ab4={};_0x310ab4[_0x522c6a[_0x4d84('0x25')]]={'$like':'%'+_0x2014a6[_0x4d84('0x2c')][_0x4d84('0x39')]+'%'};return _0x310ab4;}})});}_0x539e8c=_[_0x4d84('0x37')]({},_0x539e8c,_0x2014a6[_0x4d84('0x3a')]);var _0x4eadfb={'where':_0x539e8c[_0x4d84('0x36')]};return db[_0x4d84('0x27')][_0x4d84('0x1b')](_0x4eadfb)['then'](function(_0x378383){_0x73212a[_0x4d84('0x1b')]=_0x378383;if(_0x2014a6['query'][_0x4d84('0x3b')]){_0x539e8c[_0x4d84('0x3c')]=[{'all':!![]}];}return db[_0x4d84('0x27')][_0x4d84('0x3d')](_0x539e8c);})[_0x4d84('0x20')](function(_0x710612){_0x73212a['rows']=_0x710612;return _0x73212a;})[_0x4d84('0x20')](respondWithFilteredResult(_0x353bf2,_0x539e8c))[_0x4d84('0x3e')](handleError(_0x353bf2,null));};exports[_0x4d84('0x3f')]=function(_0x13aadc,_0x3b7738){var _0x4affef={'raw':!![],'where':{'id':_0x13aadc[_0x4d84('0x40')]['id']}},_0xbf42c1={};_0xbf42c1[_0x4d84('0x2a')]=_['keys'](db[_0x4d84('0x27')][_0x4d84('0x41')]);_0xbf42c1[_0x4d84('0x2c')]=_['keys'](_0x13aadc[_0x4d84('0x2c')]);_0xbf42c1['filters']=_[_0x4d84('0x2f')](_0xbf42c1[_0x4d84('0x2a')],_0xbf42c1[_0x4d84('0x2c')]);_0x4affef['attributes']=_['intersection'](_0xbf42c1[_0x4d84('0x2a')],qs[_0x4d84('0x31')](_0x13aadc[_0x4d84('0x2c')][_0x4d84('0x31')]));_0x4affef[_0x4d84('0x30')]=_0x4affef['attributes'][_0x4d84('0x42')]?_0x4affef[_0x4d84('0x30')]:_0xbf42c1[_0x4d84('0x2a')];if(_0x13aadc[_0x4d84('0x2c')][_0x4d84('0x3b')]){_0x4affef[_0x4d84('0x3c')]=[{'all':!![]}];}_0x4affef=_[_0x4d84('0x37')]({},_0x4affef,_0x13aadc[_0x4d84('0x3a')]);return db[_0x4d84('0x27')][_0x4d84('0x43')](_0x4affef)[_0x4d84('0x20')](handleEntityNotFound(_0x3b7738,null))[_0x4d84('0x20')](respondWithResult(_0x3b7738,null))['catch'](handleError(_0x3b7738,null));};exports[_0x4d84('0x44')]=function(_0x1295f7,_0x36e59d){return db[_0x4d84('0x27')]['create'](_0x1295f7[_0x4d84('0x45')],{})['then'](respondWithResult(_0x36e59d,0xc9))[_0x4d84('0x3e')](handleError(_0x36e59d,null));};exports[_0x4d84('0x46')]=function(_0x3e0989,_0x58e2d5){if(_0x3e0989[_0x4d84('0x45')]['id']){delete _0x3e0989[_0x4d84('0x45')]['id'];}return db[_0x4d84('0x27')][_0x4d84('0x43')]({'where':{'id':_0x3e0989[_0x4d84('0x40')]['id']}})[_0x4d84('0x20')](handleEntityNotFound(_0x58e2d5,null))[_0x4d84('0x20')](saveUpdates(_0x3e0989[_0x4d84('0x45')],null))[_0x4d84('0x20')](respondWithResult(_0x58e2d5,null))[_0x4d84('0x3e')](handleError(_0x58e2d5,null));};exports[_0x4d84('0x21')]=function(_0x314116,_0x10861f){return db[_0x4d84('0x27')]['find']({'where':{'id':_0x314116['params']['id']}})['then'](handleEntityNotFound(_0x10861f,null))[_0x4d84('0x20')](removeEntity(_0x10861f,null))[_0x4d84('0x3e')](handleError(_0x10861f,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 21b5c98..2683350 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 _0x9f0e=['../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','path','rimraf'];(function(_0x30ccd9,_0x147ce5){var _0x1ea5df=function(_0x14ef96){while(--_0x14ef96){_0x30ccd9['push'](_0x30ccd9['shift']());}};_0x1ea5df(++_0x147ce5);}(_0x9f0e,0x116));var _0xe9f0=function(_0x529dd7,_0x4b560c){_0x529dd7=_0x529dd7-0x0;var _0x5ca730=_0x9f0e[_0x529dd7];return _0x5ca730;};'use strict';var _=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var logger=require(_0xe9f0('0x2'))(_0xe9f0('0x3'));var moment=require(_0xe9f0('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe9f0('0x5'));var rimraf=require(_0xe9f0('0x6'));var config=require(_0xe9f0('0x7'));var attributes=require(_0xe9f0('0x8'));module[_0xe9f0('0x9')]=function(_0x50313d,_0x5b87c1){return _0x50313d[_0xe9f0('0xa')](_0xe9f0('0xb'),attributes,{'tableName':_0xe9f0('0xc'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0xe9f0('0xd'),_0xe9f0('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe5af=['zoho_unique_index','idField','util','../../config/logger','moment','bluebird','request-promise','rimraf','exports','ZohoField','int_zoho_fields'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe5af,0x9c));var _0xfe5a=function(_0x2e98d5,_0x1665f4){_0x2e98d5=_0x2e98d5-0x0;var _0x3f8ee4=_0xe5af[_0x2e98d5];return _0x3f8ee4;};'use strict';var _=require('lodash');var util=require(_0xfe5a('0x0'));var logger=require(_0xfe5a('0x1'))('api');var moment=require(_0xfe5a('0x2'));var BPromise=require(_0xfe5a('0x3'));var rp=require(_0xfe5a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfe5a('0x5'));var config=require('../../config/environment');var attributes=require('./intZohoField.attributes');module[_0xfe5a('0x6')]=function(_0x2039cd,_0x4e418f){return _0x2039cd['define'](_0xfe5a('0x7'),attributes,{'tableName':_0xfe5a('0x8'),'paranoid':![],'indexes':[{'name':_0xfe5a('0x9'),'fields':[_0xfe5a('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 470039c..3471feb 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 _0x9a0b=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xaad7b0,_0x50c457){var _0x2235ac=function(_0x11b2f3){while(--_0x11b2f3){_0xaad7b0['push'](_0xaad7b0['shift']());}};_0x2235ac(++_0x50c457);}(_0x9a0b,0x1dd));var _0xb9a0=function(_0x277633,_0x19d3e0){_0x277633=_0x277633-0x0;var _0x3e9d83=_0x9a0b[_0x277633];return _0x3e9d83;};'use strict';var _=require('lodash');var util=require(_0xb9a0('0x0'));var moment=require(_0xb9a0('0x1'));var BPromise=require(_0xb9a0('0x2'));var rs=require(_0xb9a0('0x3'));var fs=require('fs');var Redis=require(_0xb9a0('0x4'));var db=require(_0xb9a0('0x5'))['db'];var utils=require(_0xb9a0('0x6'));var logger=require(_0xb9a0('0x7'))(_0xb9a0('0x8'));var config=require(_0xb9a0('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb9a0('0xa')][_0xb9a0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bdbc3,_0x5607a8,_0xe0b3b0){return new BPromise(function(_0x1cb482,_0x1b5266){return client['request'](_0x3bdbc3,_0xe0b3b0)[_0xb9a0('0xc')](function(_0x2fb8c0){logger[_0xb9a0('0xd')](_0xb9a0('0xe'),_0x5607a8,_0xb9a0('0xf'));logger[_0xb9a0('0x10')](_0xb9a0('0x11'),_0x5607a8,_0xb9a0('0xf'),JSON['stringify'](_0x2fb8c0));if(_0x2fb8c0['error']){if(_0x2fb8c0[_0xb9a0('0x12')][_0xb9a0('0x13')]===0x1f4){logger['error'](_0xb9a0('0xe'),_0x5607a8,_0x2fb8c0[_0xb9a0('0x12')][_0xb9a0('0x14')]);return _0x1b5266(_0x2fb8c0[_0xb9a0('0x12')][_0xb9a0('0x14')]);}logger['error'](_0xb9a0('0xe'),_0x5607a8,_0x2fb8c0[_0xb9a0('0x12')]['message']);return _0x1cb482(_0x2fb8c0['error']['message']);}else{logger['info'](_0xb9a0('0xe'),_0x5607a8,_0xb9a0('0xf'));_0x1cb482(_0x2fb8c0[_0xb9a0('0x15')][_0xb9a0('0x14')]);}})[_0xb9a0('0x16')](function(_0x51124){logger[_0xb9a0('0x12')]('ZohoField,\x20%s,\x20%s',_0x5607a8,_0x51124);_0x1b5266(_0x51124);});});} \ No newline at end of file +var _0x444d=['rpc','jayson/promise','client','http','request','then','info','debug','request\x20sent','error','code','ZohoField,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x444d,0xb6));var _0xd444=function(_0x56b8d4,_0x192bed){_0x56b8d4=_0x56b8d4-0x0;var _0x35486d=_0x444d[_0x56b8d4];return _0x35486d;};'use strict';var _=require(_0xd444('0x0'));var util=require(_0xd444('0x1'));var moment=require('moment');var BPromise=require(_0xd444('0x2'));var rs=require(_0xd444('0x3'));var fs=require('fs');var Redis=require(_0xd444('0x4'));var db=require(_0xd444('0x5'))['db'];var utils=require(_0xd444('0x6'));var logger=require('../../config/logger')(_0xd444('0x7'));var config=require('../../config/environment');var jayson=require(_0xd444('0x8'));var client=jayson[_0xd444('0x9')][_0xd444('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5caa9b,_0x3fc4ef,_0x327250){return new BPromise(function(_0x293882,_0x20331c){return client[_0xd444('0xb')](_0x5caa9b,_0x327250)[_0xd444('0xc')](function(_0x581e04){logger[_0xd444('0xd')]('ZohoField,\x20%s,\x20%s',_0x3fc4ef,'request\x20sent');logger[_0xd444('0xe')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x3fc4ef,_0xd444('0xf'),JSON['stringify'](_0x581e04));if(_0x581e04[_0xd444('0x10')]){if(_0x581e04[_0xd444('0x10')][_0xd444('0x11')]===0x1f4){logger[_0xd444('0x10')](_0xd444('0x12'),_0x3fc4ef,_0x581e04[_0xd444('0x10')][_0xd444('0x13')]);return _0x20331c(_0x581e04[_0xd444('0x10')][_0xd444('0x13')]);}logger[_0xd444('0x10')](_0xd444('0x12'),_0x3fc4ef,_0x581e04['error'][_0xd444('0x13')]);return _0x293882(_0x581e04[_0xd444('0x10')][_0xd444('0x13')]);}else{logger[_0xd444('0xd')](_0xd444('0x12'),_0x3fc4ef,_0xd444('0xf'));_0x293882(_0x581e04[_0xd444('0x14')][_0xd444('0x13')]);}})['catch'](function(_0x2d7642){logger[_0xd444('0x10')](_0xd444('0x12'),_0x3fc4ef,_0x2d7642);_0x20331c(_0x2d7642);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 3b9c2b8..1390d27 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x1e2f70,_0x54faaa){var _0x33ba65=function(_0xb92080){while(--_0xb92080){_0x1e2f70['push'](_0x1e2f70['shift']());}};_0x33ba65(++_0x54faaa);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5678b5,_0x1c4aa8){_0x5678b5=_0x5678b5-0x0;var _0x4c09a5=_0xcb91[_0x5678b5];return _0x4c09a5;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0xd60ec9,_0x4c62fd){var _0x4a6c4b=function(_0x3d27cd){while(--_0x3d27cd){_0xd60ec9['push'](_0xd60ec9['shift']());}};_0x4a6c4b(++_0x4c62fd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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 2accf7a..569f088 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 _0x3039=['exports','STRING','unique_name_and_version','BOOLEAN','state'];(function(_0x3733b7,_0x41a06a){var _0x177d12=function(_0x12782e){while(--_0x12782e){_0x3733b7['push'](_0x3733b7['shift']());}};_0x177d12(++_0x41a06a);}(_0x3039,0x18b));var _0x9303=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x3039[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require('sequelize');module[_0x9303('0x0')]={'name':{'type':Sequelize[_0x9303('0x1')],'allowNull':![],'unique':_0x9303('0x2')},'version':{'type':Sequelize[_0x9303('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x9303('0x1')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x9303('0x1')]},'path':{'type':Sequelize[_0x9303('0x1')]},'type':{'type':Sequelize[_0x9303('0x1')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x9303('0x3')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x9303('0x1')]},'state':{'type':Sequelize[_0x9303('0x1')],'unique':_0x9303('0x4')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x9303('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x9303('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0xe5c7=['sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','state'];(function(_0x30f004,_0x247904){var _0x402172=function(_0x4cb976){while(--_0x4cb976){_0x30f004['push'](_0x30f004['shift']());}};_0x402172(++_0x247904);}(_0xe5c7,0x1d8));var _0x7e5c=function(_0x3c973b,_0xe8f3bb){_0x3c973b=_0x3c973b-0x0;var _0x3ebcb9=_0xe5c7[_0x3c973b];return _0x3ebcb9;};'use strict';var Sequelize=require(_0x7e5c('0x0'));module[_0x7e5c('0x1')]={'name':{'type':Sequelize[_0x7e5c('0x2')],'allowNull':![],'unique':_0x7e5c('0x3')},'version':{'type':Sequelize[_0x7e5c('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x7e5c('0x2')],'defaultValue':_0x7e5c('0x4')},'filename':{'type':Sequelize[_0x7e5c('0x2')]},'path':{'type':Sequelize[_0x7e5c('0x2')]},'type':{'type':Sequelize[_0x7e5c('0x2')]},'size':{'type':Sequelize[_0x7e5c('0x5')]},'active':{'type':Sequelize[_0x7e5c('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x7e5c('0x2')]},'logo':{'type':Sequelize[_0x7e5c('0x2')]},'state':{'type':Sequelize[_0x7e5c('0x2')],'unique':_0x7e5c('0x7')},'description':{'type':Sequelize[_0x7e5c('0x2')]},'title':{'type':Sequelize[_0x7e5c('0x2')]},'remoteUri':{'type':Sequelize[_0x7e5c('0x2')]},'link':{'type':Sequelize[_0x7e5c('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 5da4c73..ec9aa9e 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 _0xba34=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','Integration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x360bfd,_0x20924f){var _0x1f7c6b=function(_0x2613b0){while(--_0x2613b0){_0x360bfd['push'](_0x360bfd['shift']());}};_0x1f7c6b(++_0x20924f);}(_0xba34,0x119));var _0x4ba3=function(_0x5d1f83,_0x55c907){_0x5d1f83=_0x5d1f83-0x0;var _0x200e17=_0xba34[_0x5d1f83];return _0x200e17;};'use strict';var emlformat=require(_0x4ba3('0x0'));var rimraf=require(_0x4ba3('0x1'));var zipdir=require(_0x4ba3('0x2'));var jsonpatch=require(_0x4ba3('0x3'));var rp=require(_0x4ba3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ba3('0x5'));var path=require(_0x4ba3('0x6'));var sox=require(_0x4ba3('0x7'));var csv=require(_0x4ba3('0x8'));var ejs=require(_0x4ba3('0x9'));var fs=require('fs');var fs_extra=require(_0x4ba3('0xa'));var _=require(_0x4ba3('0xb'));var squel=require('squel');var crypto=require(_0x4ba3('0xc'));var jsforce=require(_0x4ba3('0xd'));var deskjs=require(_0x4ba3('0xe'));var toCsv=require(_0x4ba3('0x8'));var querystring=require(_0x4ba3('0xf'));var Papa=require(_0x4ba3('0x10'));var Redis=require(_0x4ba3('0x11'));var authService=require(_0x4ba3('0x12'));var qs=require(_0x4ba3('0x13'));var as=require(_0x4ba3('0x14'));var hardwareService=require(_0x4ba3('0x15'));var logger=require('../../config/logger')(_0x4ba3('0x16'));var utils=require(_0x4ba3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1073d4,_0x52f55c){_0x52f55c=_0x52f55c||0xcc;return function(_0x256f02){if(_0x256f02){return _0x1073d4[_0x4ba3('0x19')](_0x52f55c);}return _0x1073d4[_0x4ba3('0x1a')](_0x52f55c)[_0x4ba3('0x1b')]();};}function respondWithResult(_0x2bc796,_0x3d2ace){_0x3d2ace=_0x3d2ace||0xc8;return function(_0x3a74f7){if(_0x3a74f7){return _0x2bc796[_0x4ba3('0x1a')](_0x3d2ace)[_0x4ba3('0x1c')](_0x3a74f7);}};}function respondWithFilteredResult(_0x401366,_0x36638b){return function(_0x301359){if(_0x301359){var _0x29a9d1=typeof _0x36638b[_0x4ba3('0x1d')]===_0x4ba3('0x1e')&&typeof _0x36638b[_0x4ba3('0x1f')]==='undefined';var _0x382fd0=_0x301359[_0x4ba3('0x20')];var _0x5ff7ce=_0x29a9d1?0x0:_0x36638b[_0x4ba3('0x1d')];var _0x556290=_0x29a9d1?_0x301359[_0x4ba3('0x20')]:_0x36638b[_0x4ba3('0x1d')]+_0x36638b[_0x4ba3('0x1f')];var _0x1e2ce5;if(_0x556290>=_0x382fd0){_0x556290=_0x382fd0;_0x1e2ce5=0xc8;}else{_0x1e2ce5=0xce;}_0x401366[_0x4ba3('0x1a')](_0x1e2ce5);return _0x401366[_0x4ba3('0x21')]('Content-Range',_0x5ff7ce+'-'+_0x556290+'/'+_0x382fd0)['json'](_0x301359);}return null;};}function patchUpdates(_0x2278b0){return function(_0x579d9f){try{jsonpatch[_0x4ba3('0x22')](_0x579d9f,_0x2278b0,!![]);}catch(_0x163967){return BPromise[_0x4ba3('0x23')](_0x163967);}return _0x579d9f[_0x4ba3('0x24')]();};}function saveUpdates(_0x46f1f5,_0x278a23){return function(_0x4a0823){if(_0x4a0823){return _0x4a0823[_0x4ba3('0x25')](_0x46f1f5)[_0x4ba3('0x26')](function(_0x5c28f9){return _0x5c28f9;});}return null;};}function removeEntity(_0x28bb3d,_0x4ffe39){return function(_0x1ae4de){if(_0x1ae4de){return _0x1ae4de[_0x4ba3('0x27')]()[_0x4ba3('0x26')](function(){_0x28bb3d[_0x4ba3('0x1a')](0xcc)[_0x4ba3('0x1b')]();});}};}function handleEntityNotFound(_0xe29a49,_0x159596){return function(_0xe1f7d2){if(!_0xe1f7d2){_0xe29a49[_0x4ba3('0x19')](0x194);}return _0xe1f7d2;};}function handleError(_0x2e67a0,_0x50c729){_0x50c729=_0x50c729||0x1f4;return function(_0x252f37){logger[_0x4ba3('0x28')](_0x252f37[_0x4ba3('0x29')]);if(_0x252f37['name']){delete _0x252f37[_0x4ba3('0x2a')];}_0x2e67a0[_0x4ba3('0x1a')](_0x50c729)[_0x4ba3('0x2b')](_0x252f37);};}exports['index']=function(_0x10cae6,_0x843276){var _0x34ecb4={},_0x22394d={},_0x4a339e={'count':0x0,'rows':[]};var _0x590108=_[_0x4ba3('0x2c')](db[_0x4ba3('0x2d')][_0x4ba3('0x2e')],function(_0x19f039){return{'name':_0x19f039[_0x4ba3('0x2f')],'type':_0x19f039[_0x4ba3('0x30')]['key']};});_0x22394d[_0x4ba3('0x31')]=_[_0x4ba3('0x2c')](_0x590108,_0x4ba3('0x2a'));_0x22394d[_0x4ba3('0x32')]=_[_0x4ba3('0x33')](_0x10cae6[_0x4ba3('0x32')]);_0x22394d[_0x4ba3('0x34')]=_[_0x4ba3('0x35')](_0x22394d[_0x4ba3('0x31')],_0x22394d[_0x4ba3('0x32')]);_0x34ecb4['attributes']=_['intersection'](_0x22394d['model'],qs[_0x4ba3('0x36')](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x36')]));_0x34ecb4[_0x4ba3('0x37')]=_0x34ecb4[_0x4ba3('0x37')][_0x4ba3('0x38')]?_0x34ecb4[_0x4ba3('0x37')]:_0x22394d[_0x4ba3('0x31')];if(!_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x39')](_0x4ba3('0x3a'))){_0x34ecb4[_0x4ba3('0x1f')]=qs['limit'](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x1f')]);_0x34ecb4[_0x4ba3('0x1d')]=qs['offset'](_0x10cae6[_0x4ba3('0x32')]['offset']);}_0x34ecb4[_0x4ba3('0x3b')]=qs[_0x4ba3('0x3c')](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x3c')]);_0x34ecb4[_0x4ba3('0x3d')]=qs[_0x4ba3('0x34')](_['pick'](_0x10cae6[_0x4ba3('0x32')],_0x22394d[_0x4ba3('0x34')]),_0x590108);if(_0x10cae6[_0x4ba3('0x32')]['filter']){_0x34ecb4[_0x4ba3('0x3d')]=_[_0x4ba3('0x3e')](_0x34ecb4['where'],{'$or':_[_0x4ba3('0x2c')](_0x590108,function(_0x503777){if(_0x503777['type']!==_0x4ba3('0x3f')){var _0x1acc74={};_0x1acc74[_0x503777[_0x4ba3('0x2a')]]={'$like':'%'+_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x40')]+'%'};return _0x1acc74;}})});}_0x34ecb4=_['merge']({},_0x34ecb4,_0x10cae6[_0x4ba3('0x41')]);var _0x10e4b5={'where':_0x34ecb4[_0x4ba3('0x3d')]};return db[_0x4ba3('0x2d')][_0x4ba3('0x20')](_0x10e4b5)[_0x4ba3('0x26')](function(_0x349af4){_0x4a339e[_0x4ba3('0x20')]=_0x349af4;if(_0x10cae6['query'][_0x4ba3('0x42')]){_0x34ecb4[_0x4ba3('0x43')]=[{'all':!![]}];}return db[_0x4ba3('0x2d')][_0x4ba3('0x44')](_0x34ecb4);})[_0x4ba3('0x26')](function(_0x25b2c9){_0x4a339e[_0x4ba3('0x45')]=_0x25b2c9;return _0x4a339e;})[_0x4ba3('0x26')](respondWithFilteredResult(_0x843276,_0x34ecb4))[_0x4ba3('0x46')](handleError(_0x843276,null));};exports[_0x4ba3('0x47')]=function(_0x3b9a0a,_0x1c58d2){var _0x1d031b={'raw':![],'where':{'id':_0x3b9a0a['params']['id']}},_0x28b649={};_0x28b649['model']=_['keys'](db['Integration']['rawAttributes']);_0x28b649[_0x4ba3('0x32')]=_['keys'](_0x3b9a0a[_0x4ba3('0x32')]);_0x28b649['filters']=_[_0x4ba3('0x35')](_0x28b649[_0x4ba3('0x31')],_0x28b649[_0x4ba3('0x32')]);_0x1d031b[_0x4ba3('0x37')]=_[_0x4ba3('0x35')](_0x28b649['model'],qs[_0x4ba3('0x36')](_0x3b9a0a['query'][_0x4ba3('0x36')]));_0x1d031b['attributes']=_0x1d031b[_0x4ba3('0x37')][_0x4ba3('0x38')]?_0x1d031b[_0x4ba3('0x37')]:_0x28b649[_0x4ba3('0x31')];if(_0x3b9a0a[_0x4ba3('0x32')][_0x4ba3('0x42')]){_0x1d031b[_0x4ba3('0x43')]=[{'all':!![]}];}_0x1d031b=_['merge']({},_0x1d031b,_0x3b9a0a[_0x4ba3('0x41')]);return db[_0x4ba3('0x2d')][_0x4ba3('0x48')](_0x1d031b)[_0x4ba3('0x26')](handleEntityNotFound(_0x1c58d2,null))[_0x4ba3('0x26')](respondWithResult(_0x1c58d2,null))['catch'](handleError(_0x1c58d2,null));};exports['create']=function(_0xa4bbb2,_0x1fe115){return db[_0x4ba3('0x2d')]['create'](_0xa4bbb2[_0x4ba3('0x49')],{})[_0x4ba3('0x26')](respondWithResult(_0x1fe115,0xc9))[_0x4ba3('0x46')](handleError(_0x1fe115,null));};exports['update']=function(_0x47f588,_0x34dc04){if(_0x47f588['body']['id']){delete _0x47f588[_0x4ba3('0x49')]['id'];}return db[_0x4ba3('0x2d')][_0x4ba3('0x48')]({'where':{'id':_0x47f588[_0x4ba3('0x4a')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x34dc04,null))[_0x4ba3('0x26')](saveUpdates(_0x47f588['body'],null))[_0x4ba3('0x26')](respondWithResult(_0x34dc04,null))[_0x4ba3('0x46')](handleError(_0x34dc04,null));};exports['destroy']=function(_0x325475,_0x12ae6f){return db[_0x4ba3('0x2d')][_0x4ba3('0x48')]({'where':{'id':_0x325475[_0x4ba3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x12ae6f,null))[_0x4ba3('0x26')](removeEntity(_0x12ae6f,null))[_0x4ba3('0x46')](handleError(_0x12ae6f,null));}; \ No newline at end of file +var _0xc6ac=['type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','includeAll','include','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','Integration','rawAttributes','fieldName'];(function(_0x2bd88d,_0x2d5dc3){var _0x5516d4=function(_0x1272c8){while(--_0x1272c8){_0x2bd88d['push'](_0x2bd88d['shift']());}};_0x5516d4(++_0x2d5dc3);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x197569,_0x3fc2b4){_0x197569=_0x197569-0x0;var _0x47f40b=_0xc6ac[_0x197569];return _0x47f40b;};'use strict';var emlformat=require(_0xcc6a('0x0'));var rimraf=require(_0xcc6a('0x1'));var zipdir=require(_0xcc6a('0x2'));var jsonpatch=require(_0xcc6a('0x3'));var rp=require(_0xcc6a('0x4'));var moment=require(_0xcc6a('0x5'));var BPromise=require(_0xcc6a('0x6'));var Mustache=require(_0xcc6a('0x7'));var util=require(_0xcc6a('0x8'));var path=require(_0xcc6a('0x9'));var sox=require(_0xcc6a('0xa'));var csv=require(_0xcc6a('0xb'));var ejs=require(_0xcc6a('0xc'));var fs=require('fs');var fs_extra=require(_0xcc6a('0xd'));var _=require('lodash');var squel=require(_0xcc6a('0xe'));var crypto=require(_0xcc6a('0xf'));var jsforce=require(_0xcc6a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xcc6a('0xb'));var querystring=require(_0xcc6a('0x11'));var Papa=require(_0xcc6a('0x12'));var Redis=require(_0xcc6a('0x13'));var authService=require(_0xcc6a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcc6a('0x15'));var hardwareService=require(_0xcc6a('0x16'));var logger=require(_0xcc6a('0x17'))('api');var utils=require(_0xcc6a('0x18'));var config=require(_0xcc6a('0x19'));var licenseUtil=require(_0xcc6a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59ce6d,_0xf0f6d5){_0xf0f6d5=_0xf0f6d5||0xcc;return function(_0x211444){if(_0x211444){return _0x59ce6d[_0xcc6a('0x1b')](_0xf0f6d5);}return _0x59ce6d['status'](_0xf0f6d5)['end']();};}function respondWithResult(_0x369dc1,_0xcb9e2e){_0xcb9e2e=_0xcb9e2e||0xc8;return function(_0x43710d){if(_0x43710d){return _0x369dc1[_0xcc6a('0x1c')](_0xcb9e2e)[_0xcc6a('0x1d')](_0x43710d);}};}function respondWithFilteredResult(_0x337ec5,_0x4133fa){return function(_0x403b18){if(_0x403b18){var _0x56ffb0=typeof _0x4133fa['offset']==='undefined'&&typeof _0x4133fa[_0xcc6a('0x1e')]===_0xcc6a('0x1f');var _0x307f2a=_0x403b18[_0xcc6a('0x20')];var _0x33079c=_0x56ffb0?0x0:_0x4133fa[_0xcc6a('0x21')];var _0x2d9585=_0x56ffb0?_0x403b18[_0xcc6a('0x20')]:_0x4133fa[_0xcc6a('0x21')]+_0x4133fa[_0xcc6a('0x1e')];var _0x1d20a3;if(_0x2d9585>=_0x307f2a){_0x2d9585=_0x307f2a;_0x1d20a3=0xc8;}else{_0x1d20a3=0xce;}_0x337ec5['status'](_0x1d20a3);return _0x337ec5[_0xcc6a('0x22')](_0xcc6a('0x23'),_0x33079c+'-'+_0x2d9585+'/'+_0x307f2a)[_0xcc6a('0x1d')](_0x403b18);}return null;};}function patchUpdates(_0x368a6e){return function(_0x1495d8){try{jsonpatch[_0xcc6a('0x24')](_0x1495d8,_0x368a6e,!![]);}catch(_0x36c80f){return BPromise[_0xcc6a('0x25')](_0x36c80f);}return _0x1495d8[_0xcc6a('0x26')]();};}function saveUpdates(_0x19d32c,_0x329d17){return function(_0x845088){if(_0x845088){return _0x845088['update'](_0x19d32c)[_0xcc6a('0x27')](function(_0x3a081e){return _0x3a081e;});}return null;};}function removeEntity(_0x38f812,_0x581aae){return function(_0x10016a){if(_0x10016a){return _0x10016a[_0xcc6a('0x28')]()[_0xcc6a('0x27')](function(){_0x38f812[_0xcc6a('0x1c')](0xcc)[_0xcc6a('0x29')]();});}};}function handleEntityNotFound(_0x5fc697,_0x50abc1){return function(_0x26def8){if(!_0x26def8){_0x5fc697[_0xcc6a('0x1b')](0x194);}return _0x26def8;};}function handleError(_0x3514f3,_0x5f27e5){_0x5f27e5=_0x5f27e5||0x1f4;return function(_0x3afb3a){logger[_0xcc6a('0x2a')](_0x3afb3a['stack']);if(_0x3afb3a[_0xcc6a('0x2b')]){delete _0x3afb3a[_0xcc6a('0x2b')];}_0x3514f3[_0xcc6a('0x1c')](_0x5f27e5)[_0xcc6a('0x2c')](_0x3afb3a);};}exports['index']=function(_0x194aab,_0x3cf14c){var _0x2c6d88={},_0x4f176b={},_0x2590a2={'count':0x0,'rows':[]};var _0x5308d4=_['map'](db[_0xcc6a('0x2d')][_0xcc6a('0x2e')],function(_0x3aa315){return{'name':_0x3aa315[_0xcc6a('0x2f')],'type':_0x3aa315[_0xcc6a('0x30')][_0xcc6a('0x31')]};});_0x4f176b['model']=_[_0xcc6a('0x32')](_0x5308d4,_0xcc6a('0x2b'));_0x4f176b[_0xcc6a('0x33')]=_[_0xcc6a('0x34')](_0x194aab[_0xcc6a('0x33')]);_0x4f176b[_0xcc6a('0x35')]=_[_0xcc6a('0x36')](_0x4f176b[_0xcc6a('0x37')],_0x4f176b['query']);_0x2c6d88[_0xcc6a('0x38')]=_[_0xcc6a('0x36')](_0x4f176b[_0xcc6a('0x37')],qs[_0xcc6a('0x39')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x39')]));_0x2c6d88[_0xcc6a('0x38')]=_0x2c6d88['attributes'][_0xcc6a('0x3a')]?_0x2c6d88['attributes']:_0x4f176b['model'];if(!_0x194aab['query'][_0xcc6a('0x3b')](_0xcc6a('0x3c'))){_0x2c6d88[_0xcc6a('0x1e')]=qs[_0xcc6a('0x1e')](_0x194aab[_0xcc6a('0x33')]['limit']);_0x2c6d88['offset']=qs[_0xcc6a('0x21')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x21')]);}_0x2c6d88['order']=qs[_0xcc6a('0x3d')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x3d')]);_0x2c6d88[_0xcc6a('0x3e')]=qs[_0xcc6a('0x35')](_[_0xcc6a('0x3f')](_0x194aab[_0xcc6a('0x33')],_0x4f176b[_0xcc6a('0x35')]),_0x5308d4);if(_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x40')]){_0x2c6d88[_0xcc6a('0x3e')]=_[_0xcc6a('0x41')](_0x2c6d88[_0xcc6a('0x3e')],{'$or':_[_0xcc6a('0x32')](_0x5308d4,function(_0x262a1e){if(_0x262a1e[_0xcc6a('0x30')]!==_0xcc6a('0x42')){var _0x386cbc={};_0x386cbc[_0x262a1e['name']]={'$like':'%'+_0x194aab['query'][_0xcc6a('0x40')]+'%'};return _0x386cbc;}})});}_0x2c6d88=_[_0xcc6a('0x41')]({},_0x2c6d88,_0x194aab[_0xcc6a('0x43')]);var _0x1fd8e1={'where':_0x2c6d88[_0xcc6a('0x3e')]};return db[_0xcc6a('0x2d')][_0xcc6a('0x20')](_0x1fd8e1)[_0xcc6a('0x27')](function(_0x49b65c){_0x2590a2['count']=_0x49b65c;if(_0x194aab[_0xcc6a('0x33')]['includeAll']){_0x2c6d88['include']=[{'all':!![]}];}return db['Integration'][_0xcc6a('0x44')](_0x2c6d88);})[_0xcc6a('0x27')](function(_0xb42897){_0x2590a2[_0xcc6a('0x45')]=_0xb42897;return _0x2590a2;})[_0xcc6a('0x27')](respondWithFilteredResult(_0x3cf14c,_0x2c6d88))['catch'](handleError(_0x3cf14c,null));};exports[_0xcc6a('0x46')]=function(_0xfbb079,_0x17e5a0){var _0x2f966f={'raw':![],'where':{'id':_0xfbb079[_0xcc6a('0x47')]['id']}},_0x14ca90={};_0x14ca90['model']=_[_0xcc6a('0x34')](db[_0xcc6a('0x2d')][_0xcc6a('0x2e')]);_0x14ca90[_0xcc6a('0x33')]=_['keys'](_0xfbb079[_0xcc6a('0x33')]);_0x14ca90['filters']=_[_0xcc6a('0x36')](_0x14ca90[_0xcc6a('0x37')],_0x14ca90[_0xcc6a('0x33')]);_0x2f966f['attributes']=_[_0xcc6a('0x36')](_0x14ca90[_0xcc6a('0x37')],qs[_0xcc6a('0x39')](_0xfbb079['query']['fields']));_0x2f966f[_0xcc6a('0x38')]=_0x2f966f[_0xcc6a('0x38')][_0xcc6a('0x3a')]?_0x2f966f[_0xcc6a('0x38')]:_0x14ca90[_0xcc6a('0x37')];if(_0xfbb079['query'][_0xcc6a('0x48')]){_0x2f966f[_0xcc6a('0x49')]=[{'all':!![]}];}_0x2f966f=_['merge']({},_0x2f966f,_0xfbb079[_0xcc6a('0x43')]);return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')](_0x2f966f)[_0xcc6a('0x27')](handleEntityNotFound(_0x17e5a0,null))[_0xcc6a('0x27')](respondWithResult(_0x17e5a0,null))[_0xcc6a('0x4b')](handleError(_0x17e5a0,null));};exports['create']=function(_0x4e1a0b,_0x47c999){return db[_0xcc6a('0x2d')][_0xcc6a('0x4c')](_0x4e1a0b[_0xcc6a('0x4d')],{})[_0xcc6a('0x27')](respondWithResult(_0x47c999,0xc9))['catch'](handleError(_0x47c999,null));};exports[_0xcc6a('0x4e')]=function(_0x5e7bab,_0x3aa7dd){if(_0x5e7bab[_0xcc6a('0x4d')]['id']){delete _0x5e7bab[_0xcc6a('0x4d')]['id'];}return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')]({'where':{'id':_0x5e7bab[_0xcc6a('0x47')]['id']}})['then'](handleEntityNotFound(_0x3aa7dd,null))[_0xcc6a('0x27')](saveUpdates(_0x5e7bab[_0xcc6a('0x4d')],null))[_0xcc6a('0x27')](respondWithResult(_0x3aa7dd,null))[_0xcc6a('0x4b')](handleError(_0x3aa7dd,null));};exports[_0xcc6a('0x28')]=function(_0x362bf6,_0x431684){return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')]({'where':{'id':_0x362bf6[_0xcc6a('0x47')]['id']}})['then'](handleEntityNotFound(_0x431684,null))[_0xcc6a('0x27')](removeEntity(_0x431684,null))[_0xcc6a('0x4b')](handleError(_0x431684,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 9292652..8ea43dc 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 _0x55c4=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define','Integration','integrations'];(function(_0x404767,_0x318248){var _0x14ad1b=function(_0x641ec3){while(--_0x641ec3){_0x404767['push'](_0x404767['shift']());}};_0x14ad1b(++_0x318248);}(_0x55c4,0x129));var _0x455c=function(_0xb8c8bc,_0x446785){_0xb8c8bc=_0xb8c8bc-0x0;var _0x1e663e=_0x55c4[_0xb8c8bc];return _0x1e663e;};'use strict';var _=require(_0x455c('0x0'));var util=require('util');var logger=require(_0x455c('0x1'))(_0x455c('0x2'));var moment=require(_0x455c('0x3'));var BPromise=require(_0x455c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x455c('0x5'));var rimraf=require(_0x455c('0x6'));var config=require(_0x455c('0x7'));var attributes=require('./integration.attributes');module['exports']=function(_0x54b5d0,_0x19178e){return _0x54b5d0[_0x455c('0x8')](_0x455c('0x9'),attributes,{'tableName':_0x455c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcad5=['rimraf','../../config/environment','./integration.attributes','exports','Integration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcad5,0x109));var _0x5cad=function(_0x4b9183,_0x518b69){_0x4b9183=_0x4b9183-0x0;var _0x575f89=_0xcad5[_0x4b9183];return _0x575f89;};'use strict';var _=require(_0x5cad('0x0'));var util=require(_0x5cad('0x1'));var logger=require(_0x5cad('0x2'))(_0x5cad('0x3'));var moment=require(_0x5cad('0x4'));var BPromise=require(_0x5cad('0x5'));var rp=require(_0x5cad('0x6'));var fs=require('fs');var path=require(_0x5cad('0x7'));var rimraf=require(_0x5cad('0x8'));var config=require(_0x5cad('0x9'));var attributes=require(_0x5cad('0xa'));module[_0x5cad('0xb')]=function(_0x2f3ad8,_0x29f753){return _0x2f3ad8['define'](_0x5cad('0xc'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 83180e3..e5f99e1 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 _0x0295=['client','http','then','info','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','Integration,\x20%s,\x20%s','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x10c39a,_0x186512){var _0x23deea=function(_0x3581b3){while(--_0x3581b3){_0x10c39a['push'](_0x10c39a['shift']());}};_0x23deea(++_0x186512);}(_0x0295,0x1f0));var _0x5029=function(_0x1fc84d,_0x3f469d){_0x1fc84d=_0x1fc84d-0x0;var _0x2658fa=_0x0295[_0x1fc84d];return _0x2658fa;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('Integration,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});} \ No newline at end of file +var _0x7880=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4ebec1,_0x47ae0b){var _0x4667ec=function(_0x312c1b){while(--_0x312c1b){_0x4ebec1['push'](_0x4ebec1['shift']());}};_0x4667ec(++_0x47ae0b);}(_0x7880,0x1f4));var _0x0788=function(_0x4be79b,_0x21e987){_0x4be79b=_0x4be79b-0x0;var _0x14d71e=_0x7880[_0x4be79b];return _0x14d71e;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));var moment=require(_0x0788('0x1'));var BPromise=require(_0x0788('0x2'));var rs=require(_0x0788('0x3'));var fs=require('fs');var Redis=require(_0x0788('0x4'));var db=require(_0x0788('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0788('0x6'))(_0x0788('0x7'));var config=require(_0x0788('0x8'));var jayson=require(_0x0788('0x9'));var client=jayson[_0x0788('0xa')][_0x0788('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f9cb8,_0x44bbb5,_0x3c29f3){return new BPromise(function(_0x422f8b,_0x55e48a){return client[_0x0788('0xc')](_0x3f9cb8,_0x3c29f3)['then'](function(_0xabaf81){logger['info'](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));logger[_0x0788('0xf')](_0x0788('0x10'),_0x44bbb5,_0x0788('0xe'),JSON['stringify'](_0xabaf81));if(_0xabaf81[_0x0788('0x11')]){if(_0xabaf81[_0x0788('0x11')][_0x0788('0x12')]===0x1f4){logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')][_0x0788('0x13')]);return _0x55e48a(_0xabaf81['error'][_0x0788('0x13')]);}logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')]['message']);return _0x422f8b(_0xabaf81[_0x0788('0x11')]['message']);}else{logger[_0x0788('0x14')](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));_0x422f8b(_0xabaf81[_0x0788('0x15')][_0x0788('0x13')]);}})[_0x0788('0x16')](function(_0x5e1a29){logger['error'](_0x0788('0xd'),_0x44bbb5,_0x5e1a29);_0x55e48a(_0x5e1a29);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 5d5d9ba..8a6df8e 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 _0x4137=['show','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','/:id'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x4137,0xf8));var _0x7413=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4137[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var path=require(_0x7413('0x2'));var timeout=require(_0x7413('0x3'));var express=require(_0x7413('0x4'));var router=express[_0x7413('0x5')]();var fs_extra=require(_0x7413('0x6'));var auth=require(_0x7413('0x7'));var interaction=require(_0x7413('0x8'));var config=require(_0x7413('0x9'));var controller=require(_0x7413('0xa'));router[_0x7413('0xb')]('/',auth['isAuthenticated'](),controller[_0x7413('0xc')]);router[_0x7413('0xb')](_0x7413('0xd'),auth[_0x7413('0xe')](),controller['describe']);router[_0x7413('0xb')](_0x7413('0xf'),auth['isAuthenticated'](),controller[_0x7413('0x10')]);router[_0x7413('0x11')]('/',auth['isAuthenticated'](),controller[_0x7413('0x12')]);router[_0x7413('0x13')](_0x7413('0xf'),auth[_0x7413('0xe')](),controller[_0x7413('0x14')]);router['delete'](_0x7413('0xf'),auth[_0x7413('0xe')](),controller['destroy']);module[_0x7413('0x15')]=router; \ No newline at end of file +var _0x896e=['show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x896e,0x1e9));var _0xe896=function(_0x551c86,_0x483de0){_0x551c86=_0x551c86-0x0;var _0x4c05e7=_0x896e[_0x551c86];return _0x4c05e7;};'use strict';var multer=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var path=require(_0xe896('0x2'));var timeout=require(_0xe896('0x3'));var express=require(_0xe896('0x4'));var router=express[_0xe896('0x5')]();var fs_extra=require(_0xe896('0x6'));var auth=require(_0xe896('0x7'));var interaction=require(_0xe896('0x8'));var config=require(_0xe896('0x9'));var controller=require(_0xe896('0xa'));router[_0xe896('0xb')]('/',auth['isAuthenticated'](),controller[_0xe896('0xc')]);router[_0xe896('0xb')](_0xe896('0xd'),auth[_0xe896('0xe')](),controller[_0xe896('0xf')]);router['get'](_0xe896('0x10'),auth[_0xe896('0xe')](),controller[_0xe896('0x11')]);router['post']('/',auth[_0xe896('0xe')](),controller['create']);router[_0xe896('0x12')]('/:id',auth[_0xe896('0xe')](),controller[_0xe896('0x13')]);router[_0xe896('0x14')]('/:id',auth[_0xe896('0xe')](),controller[_0xe896('0x15')]);module[_0xe896('0x16')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 7cc1ab1..9b77bf2 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 _0x7417=['FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENDING'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x7417,0x79));var _0x7741=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x7417[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0x7741('0x0'));module[_0x7741('0x1')]={'integration':{'type':Sequelize[_0x7741('0x2')]},'eventChannel':{'type':Sequelize[_0x7741('0x2')]},'exitStatus':{'type':Sequelize[_0x7741('0x2')]},'ticketId':{'type':Sequelize[_0x7741('0x2')]},'integrationId':{'type':Sequelize[_0x7741('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x7741('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x7741('0x2')]},'interface':{'type':Sequelize[_0x7741('0x2')]},'membername':{'type':Sequelize[_0x7741('0x2')]},'agentcalledAt':{'type':Sequelize[_0x7741('0x4')]},'agentconnectAt':{'type':Sequelize[_0x7741('0x4')]},'holdtime':{'type':Sequelize[_0x7741('0x3')]},'agentcomplete':{'type':Sequelize[_0x7741('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x7741('0x4')]},'talktime':{'type':Sequelize[_0x7741('0x3')]},'agentacw':{'type':Sequelize[_0x7741('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x7741('0x3')]},'reason':{'type':Sequelize[_0x7741('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x7741('0x4')]},'agentdump':{'type':Sequelize[_0x7741('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x7741('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x7741('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x7741('0x2')]},'connectedlinename':{'type':Sequelize[_0x7741('0x2')]},'language':{'type':Sequelize[_0x7741('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x7741('0x2')]},'priority':{'type':Sequelize[_0x7741('0x2')]},'destchannel':{'type':Sequelize[_0x7741('0x2')]},'destchannelstate':{'type':Sequelize[_0x7741('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x7741('0x2')]},'destcalleridnum':{'type':Sequelize[_0x7741('0x2')]},'destcalleridname':{'type':Sequelize[_0x7741('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x7741('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x7741('0x2')]},'destlanguage':{'type':Sequelize[_0x7741('0x2')]},'destaccountcode':{'type':Sequelize[_0x7741('0x2')]},'destcontext':{'type':Sequelize[_0x7741('0x2')]},'destexten':{'type':Sequelize[_0x7741('0x2')]},'destpriority':{'type':Sequelize[_0x7741('0x2')]},'destuniqueid':{'type':Sequelize[_0x7741('0x2')]},'messageId':{'type':Sequelize[_0x7741('0x2')]},'inReplyTo':{'type':Sequelize[_0x7741('0x2')]},'subject':{'type':Sequelize[_0x7741('0x2')]},'from':{'type':Sequelize[_0x7741('0x2')]},'to':{'type':Sequelize[_0x7741('0x2')]},'cc':{'type':Sequelize[_0x7741('0x2')]},'attachment':{'type':Sequelize[_0x7741('0x6')]},'html':{'type':Sequelize[_0x7741('0x6')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x7741('0x7')]('SENT',_0x7741('0x8'),'RECEIVED',_0x7741('0x9'))},'url':{'type':Sequelize[_0x7741('0x2')]},'app':{'type':Sequelize[_0x7741('0x2')]},'appdata':{'type':Sequelize[_0x7741('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xfe75=['RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING'];(function(_0x47a12a,_0x70f591){var _0x30cd40=function(_0x46b68f){while(--_0x46b68f){_0x47a12a['push'](_0x47a12a['shift']());}};_0x30cd40(++_0x70f591);}(_0xfe75,0x10a));var _0x5fe7=function(_0xae044f,_0x2d3f4a){_0xae044f=_0xae044f-0x0;var _0x5de886=_0xfe75[_0xae044f];return _0x5de886;};'use strict';var Sequelize=require(_0x5fe7('0x0'));module[_0x5fe7('0x1')]={'integration':{'type':Sequelize[_0x5fe7('0x2')]},'eventChannel':{'type':Sequelize[_0x5fe7('0x2')]},'exitStatus':{'type':Sequelize[_0x5fe7('0x2')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x5fe7('0x3')]},'contacts':{'type':Sequelize[_0x5fe7('0x2')]},'uniqueid':{'type':Sequelize[_0x5fe7('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5fe7('0x2')]},'queue':{'type':Sequelize[_0x5fe7('0x2')]},'interface':{'type':Sequelize[_0x5fe7('0x2')]},'membername':{'type':Sequelize[_0x5fe7('0x2')]},'agentcalledAt':{'type':Sequelize[_0x5fe7('0x4')]},'agentconnectAt':{'type':Sequelize[_0x5fe7('0x4')]},'holdtime':{'type':Sequelize[_0x5fe7('0x3')]},'agentcomplete':{'type':Sequelize[_0x5fe7('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x5fe7('0x3')]},'agentacw':{'type':Sequelize[_0x5fe7('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x5fe7('0x3')]},'reason':{'type':Sequelize[_0x5fe7('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x5fe7('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x5fe7('0x4')]},'agentdump':{'type':Sequelize[_0x5fe7('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x5fe7('0x4')]},'lastevent':{'type':Sequelize[_0x5fe7('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x5fe7('0x2')]},'connectedlinenum':{'type':Sequelize[_0x5fe7('0x2')]},'connectedlinename':{'type':Sequelize[_0x5fe7('0x2')]},'language':{'type':Sequelize[_0x5fe7('0x2')]},'accountcode':{'type':Sequelize[_0x5fe7('0x2')]},'context':{'type':Sequelize[_0x5fe7('0x2')]},'exten':{'type':Sequelize[_0x5fe7('0x2')]},'priority':{'type':Sequelize[_0x5fe7('0x2')]},'destchannel':{'type':Sequelize[_0x5fe7('0x2')]},'destchannelstate':{'type':Sequelize[_0x5fe7('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x5fe7('0x2')]},'destcalleridnum':{'type':Sequelize[_0x5fe7('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x5fe7('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x5fe7('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x5fe7('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x5fe7('0x2')]},'destpriority':{'type':Sequelize[_0x5fe7('0x2')]},'destuniqueid':{'type':Sequelize[_0x5fe7('0x2')]},'messageId':{'type':Sequelize[_0x5fe7('0x2')]},'inReplyTo':{'type':Sequelize[_0x5fe7('0x2')]},'subject':{'type':Sequelize[_0x5fe7('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x5fe7('0x2')]},'cc':{'type':Sequelize[_0x5fe7('0x2')]},'attachment':{'type':Sequelize[_0x5fe7('0x6')]},'html':{'type':Sequelize[_0x5fe7('0x6')]},'text':{'type':Sequelize[_0x5fe7('0x6')]},'status':{'type':Sequelize[_0x5fe7('0x7')](_0x5fe7('0x8'),_0x5fe7('0x9'),_0x5fe7('0xa'),_0x5fe7('0xb'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x5fe7('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x5fe7('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index c3fbb41..76bd086 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 _0xa849=['sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','IntegrationReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0xa849,0xd0));var _0x9a84=function(_0xa3e26d,_0x55bc26){_0xa3e26d=_0xa3e26d-0x0;var _0xe26930=_0xa849[_0xa3e26d];return _0xe26930;};'use strict';var emlformat=require(_0x9a84('0x0'));var rimraf=require(_0x9a84('0x1'));var zipdir=require(_0x9a84('0x2'));var jsonpatch=require(_0x9a84('0x3'));var rp=require(_0x9a84('0x4'));var moment=require(_0x9a84('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9a84('0x6'));var util=require('util');var path=require(_0x9a84('0x7'));var sox=require(_0x9a84('0x8'));var csv=require(_0x9a84('0x9'));var ejs=require(_0x9a84('0xa'));var fs=require('fs');var fs_extra=require(_0x9a84('0xb'));var _=require(_0x9a84('0xc'));var squel=require(_0x9a84('0xd'));var crypto=require(_0x9a84('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9a84('0xf'));var toCsv=require(_0x9a84('0x9'));var querystring=require(_0x9a84('0x10'));var Papa=require(_0x9a84('0x11'));var Redis=require(_0x9a84('0x12'));var authService=require(_0x9a84('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9a84('0x14'));var logger=require('../../config/logger')(_0x9a84('0x15'));var utils=require(_0x9a84('0x16'));var config=require(_0x9a84('0x17'));var licenseUtil=require(_0x9a84('0x18'));var db=require(_0x9a84('0x19'))['db'];function respondWithStatusCode(_0x63d184,_0x17e8d1){_0x17e8d1=_0x17e8d1||0xcc;return function(_0x51b597){if(_0x51b597){return _0x63d184[_0x9a84('0x1a')](_0x17e8d1);}return _0x63d184[_0x9a84('0x1b')](_0x17e8d1)['end']();};}function respondWithResult(_0x54138a,_0x312015){_0x312015=_0x312015||0xc8;return function(_0x12272e){if(_0x12272e){return _0x54138a['status'](_0x312015)[_0x9a84('0x1c')](_0x12272e);}};}function respondWithFilteredResult(_0x44ac3f,_0x1fc68d){return function(_0x4b1569){if(_0x4b1569){var _0x3240a2=typeof _0x1fc68d[_0x9a84('0x1d')]==='undefined'&&typeof _0x1fc68d[_0x9a84('0x1e')]===_0x9a84('0x1f');var _0x58d599=_0x4b1569['count'];var _0x5698be=_0x3240a2?0x0:_0x1fc68d['offset'];var _0x21d090=_0x3240a2?_0x4b1569[_0x9a84('0x20')]:_0x1fc68d['offset']+_0x1fc68d['limit'];var _0x5e638b;if(_0x21d090>=_0x58d599){_0x21d090=_0x58d599;_0x5e638b=0xc8;}else{_0x5e638b=0xce;}_0x44ac3f[_0x9a84('0x1b')](_0x5e638b);return _0x44ac3f['set'](_0x9a84('0x21'),_0x5698be+'-'+_0x21d090+'/'+_0x58d599)['json'](_0x4b1569);}return null;};}function patchUpdates(_0x36568a){return function(_0x557fb1){try{jsonpatch[_0x9a84('0x22')](_0x557fb1,_0x36568a,!![]);}catch(_0x144db3){return BPromise[_0x9a84('0x23')](_0x144db3);}return _0x557fb1[_0x9a84('0x24')]();};}function saveUpdates(_0x3524bb,_0x5ca971){return function(_0x4b5514){if(_0x4b5514){return _0x4b5514[_0x9a84('0x25')](_0x3524bb)[_0x9a84('0x26')](function(_0xcbdc27){return _0xcbdc27;});}return null;};}function removeEntity(_0x54eb6e,_0x535158){return function(_0x3713f9){if(_0x3713f9){return _0x3713f9[_0x9a84('0x27')]()[_0x9a84('0x26')](function(){_0x54eb6e[_0x9a84('0x1b')](0xcc)[_0x9a84('0x28')]();});}};}function handleEntityNotFound(_0x35105c,_0x4d3b15){return function(_0xa0e02e){if(!_0xa0e02e){_0x35105c[_0x9a84('0x1a')](0x194);}return _0xa0e02e;};}function handleError(_0x2e0403,_0x508573){_0x508573=_0x508573||0x1f4;return function(_0x3a9cd8){logger[_0x9a84('0x29')](_0x3a9cd8[_0x9a84('0x2a')]);if(_0x3a9cd8[_0x9a84('0x2b')]){delete _0x3a9cd8[_0x9a84('0x2b')];}_0x2e0403[_0x9a84('0x1b')](_0x508573)[_0x9a84('0x2c')](_0x3a9cd8);};}exports[_0x9a84('0x2d')]=function(_0x1ef278,_0x203131){var _0x306ee3={},_0x563cfb={},_0x599615={'count':0x0,'rows':[]};var _0x43a335=_[_0x9a84('0x2e')](db[_0x9a84('0x2f')]['rawAttributes'],function(_0x3a23ac){return{'name':_0x3a23ac[_0x9a84('0x30')],'type':_0x3a23ac[_0x9a84('0x31')][_0x9a84('0x32')]};});_0x563cfb[_0x9a84('0x33')]=_[_0x9a84('0x2e')](_0x43a335,_0x9a84('0x2b'));_0x563cfb[_0x9a84('0x34')]=_[_0x9a84('0x35')](_0x1ef278[_0x9a84('0x34')]);_0x563cfb[_0x9a84('0x36')]=_[_0x9a84('0x37')](_0x563cfb[_0x9a84('0x33')],_0x563cfb[_0x9a84('0x34')]);_0x306ee3[_0x9a84('0x38')]=_[_0x9a84('0x37')](_0x563cfb[_0x9a84('0x33')],qs[_0x9a84('0x39')](_0x1ef278[_0x9a84('0x34')]['fields']));_0x306ee3[_0x9a84('0x38')]=_0x306ee3[_0x9a84('0x38')][_0x9a84('0x3a')]?_0x306ee3[_0x9a84('0x38')]:_0x563cfb[_0x9a84('0x33')];if(!_0x1ef278['query'][_0x9a84('0x3b')](_0x9a84('0x3c'))){_0x306ee3['limit']=qs[_0x9a84('0x1e')](_0x1ef278['query'][_0x9a84('0x1e')]);_0x306ee3['offset']=qs[_0x9a84('0x1d')](_0x1ef278[_0x9a84('0x34')][_0x9a84('0x1d')]);}_0x306ee3[_0x9a84('0x3d')]=qs['sort'](_0x1ef278[_0x9a84('0x34')][_0x9a84('0x3e')]);_0x306ee3[_0x9a84('0x3f')]=qs[_0x9a84('0x36')](_[_0x9a84('0x40')](_0x1ef278[_0x9a84('0x34')],_0x563cfb[_0x9a84('0x36')]),_0x43a335);if(_0x1ef278[_0x9a84('0x34')]['filter']){_0x306ee3['where']=_[_0x9a84('0x41')](_0x306ee3[_0x9a84('0x3f')],{'$or':_[_0x9a84('0x2e')](_0x43a335,function(_0x204192){if(_0x204192[_0x9a84('0x31')]!==_0x9a84('0x42')){var _0x3112c5={};_0x3112c5[_0x204192[_0x9a84('0x2b')]]={'$like':'%'+_0x1ef278[_0x9a84('0x34')][_0x9a84('0x43')]+'%'};return _0x3112c5;}})});}_0x306ee3=_[_0x9a84('0x41')]({},_0x306ee3,_0x1ef278[_0x9a84('0x44')]);var _0x49066a={'where':_0x306ee3[_0x9a84('0x3f')]};return db[_0x9a84('0x2f')][_0x9a84('0x20')](_0x49066a)[_0x9a84('0x26')](function(_0x1f2056){_0x599615[_0x9a84('0x20')]=_0x1f2056;if(_0x1ef278[_0x9a84('0x34')][_0x9a84('0x45')]){_0x306ee3[_0x9a84('0x46')]=[{'all':!![]}];}return db['IntegrationReport']['findAll'](_0x306ee3);})[_0x9a84('0x26')](function(_0x420d37){_0x599615[_0x9a84('0x47')]=_0x420d37;return _0x599615;})[_0x9a84('0x26')](respondWithFilteredResult(_0x203131,_0x306ee3))[_0x9a84('0x48')](handleError(_0x203131,null));};exports[_0x9a84('0x49')]=function(_0x520940,_0xb1d12a){var _0x41f444={'raw':![],'where':{'id':_0x520940[_0x9a84('0x4a')]['id']}},_0x18be3c={};_0x18be3c[_0x9a84('0x33')]=_[_0x9a84('0x35')](db[_0x9a84('0x2f')]['rawAttributes']);_0x18be3c[_0x9a84('0x34')]=_['keys'](_0x520940[_0x9a84('0x34')]);_0x18be3c[_0x9a84('0x36')]=_[_0x9a84('0x37')](_0x18be3c[_0x9a84('0x33')],_0x18be3c[_0x9a84('0x34')]);_0x41f444[_0x9a84('0x38')]=_[_0x9a84('0x37')](_0x18be3c[_0x9a84('0x33')],qs[_0x9a84('0x39')](_0x520940[_0x9a84('0x34')][_0x9a84('0x39')]));_0x41f444[_0x9a84('0x38')]=_0x41f444[_0x9a84('0x38')][_0x9a84('0x3a')]?_0x41f444[_0x9a84('0x38')]:_0x18be3c[_0x9a84('0x33')];if(_0x520940[_0x9a84('0x34')][_0x9a84('0x45')]){_0x41f444[_0x9a84('0x46')]=[{'all':!![]}];}_0x41f444=_['merge']({},_0x41f444,_0x520940[_0x9a84('0x44')]);return db['IntegrationReport']['find'](_0x41f444)['then'](handleEntityNotFound(_0xb1d12a,null))[_0x9a84('0x26')](respondWithResult(_0xb1d12a,null))[_0x9a84('0x48')](handleError(_0xb1d12a,null));};exports['create']=function(_0x7c2f,_0x5c8ee4){return db['IntegrationReport']['create'](_0x7c2f[_0x9a84('0x4b')],{})[_0x9a84('0x26')](respondWithResult(_0x5c8ee4,0xc9))[_0x9a84('0x48')](handleError(_0x5c8ee4,null));};exports['update']=function(_0x4100c6,_0x4789fc){if(_0x4100c6[_0x9a84('0x4b')]['id']){delete _0x4100c6[_0x9a84('0x4b')]['id'];}return db['IntegrationReport'][_0x9a84('0x4c')]({'where':{'id':_0x4100c6[_0x9a84('0x4a')]['id']}})[_0x9a84('0x26')](handleEntityNotFound(_0x4789fc,null))[_0x9a84('0x26')](saveUpdates(_0x4100c6[_0x9a84('0x4b')],null))[_0x9a84('0x26')](respondWithResult(_0x4789fc,null))['catch'](handleError(_0x4789fc,null));};exports[_0x9a84('0x27')]=function(_0x49d57f,_0x173774){return db[_0x9a84('0x2f')][_0x9a84('0x4c')]({'where':{'id':_0x49d57f['params']['id']}})[_0x9a84('0x26')](handleEntityNotFound(_0x173774,null))[_0x9a84('0x26')](removeEntity(_0x173774,null))['catch'](handleError(_0x173774,null));};exports[_0x9a84('0x4d')]=function(_0x501c9b,_0x26e05f){return db['IntegrationReport']['describe']()['then'](respondWithResult(_0x26e05f,null))[_0x9a84('0x48')](handleError(_0x26e05f,null));}; \ No newline at end of file +var _0xd787=['status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','error','name','send','index','map','IntegrationReport','rawAttributes','type','key','query','keys','filters','intersection','attributes','model','fields','length','order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end'];(function(_0x31ebff,_0x4ffb7c){var _0x28a52a=function(_0x43fd33){while(--_0x43fd33){_0x31ebff['push'](_0x31ebff['shift']());}};_0x28a52a(++_0x4ffb7c);}(_0xd787,0x1dd));var _0x7d78=function(_0x563107,_0x29cd4a){_0x563107=_0x563107-0x0;var _0x4a47ef=_0xd787[_0x563107];return _0x4a47ef;};'use strict';var emlformat=require(_0x7d78('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7d78('0x1'));var jsonpatch=require(_0x7d78('0x2'));var rp=require(_0x7d78('0x3'));var moment=require('moment');var BPromise=require(_0x7d78('0x4'));var Mustache=require(_0x7d78('0x5'));var util=require(_0x7d78('0x6'));var path=require(_0x7d78('0x7'));var sox=require('sox');var csv=require(_0x7d78('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7d78('0x9'));var _=require(_0x7d78('0xa'));var squel=require(_0x7d78('0xb'));var crypto=require(_0x7d78('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7d78('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7d78('0xe'));var Redis=require(_0x7d78('0xf'));var authService=require(_0x7d78('0x10'));var qs=require(_0x7d78('0x11'));var as=require(_0x7d78('0x12'));var hardwareService=require(_0x7d78('0x13'));var logger=require(_0x7d78('0x14'))('api');var utils=require(_0x7d78('0x15'));var config=require(_0x7d78('0x16'));var licenseUtil=require(_0x7d78('0x17'));var db=require(_0x7d78('0x18'))['db'];function respondWithStatusCode(_0x50bddd,_0x20d35d){_0x20d35d=_0x20d35d||0xcc;return function(_0x15cabc){if(_0x15cabc){return _0x50bddd[_0x7d78('0x19')](_0x20d35d);}return _0x50bddd['status'](_0x20d35d)[_0x7d78('0x1a')]();};}function respondWithResult(_0x1b55c8,_0x250e2d){_0x250e2d=_0x250e2d||0xc8;return function(_0x3bcc9b){if(_0x3bcc9b){return _0x1b55c8[_0x7d78('0x1b')](_0x250e2d)[_0x7d78('0x1c')](_0x3bcc9b);}};}function respondWithFilteredResult(_0x19a10f,_0x154df5){return function(_0x34bc12){if(_0x34bc12){var _0x95be88=typeof _0x154df5[_0x7d78('0x1d')]===_0x7d78('0x1e')&&typeof _0x154df5['limit']==='undefined';var _0x5bffcf=_0x34bc12['count'];var _0x1dd513=_0x95be88?0x0:_0x154df5[_0x7d78('0x1d')];var _0x1269b1=_0x95be88?_0x34bc12[_0x7d78('0x1f')]:_0x154df5[_0x7d78('0x1d')]+_0x154df5[_0x7d78('0x20')];var _0x18ad85;if(_0x1269b1>=_0x5bffcf){_0x1269b1=_0x5bffcf;_0x18ad85=0xc8;}else{_0x18ad85=0xce;}_0x19a10f[_0x7d78('0x1b')](_0x18ad85);return _0x19a10f[_0x7d78('0x21')](_0x7d78('0x22'),_0x1dd513+'-'+_0x1269b1+'/'+_0x5bffcf)[_0x7d78('0x1c')](_0x34bc12);}return null;};}function patchUpdates(_0x18195f){return function(_0xecf300){try{jsonpatch['apply'](_0xecf300,_0x18195f,!![]);}catch(_0x4da273){return BPromise[_0x7d78('0x23')](_0x4da273);}return _0xecf300[_0x7d78('0x24')]();};}function saveUpdates(_0x2fbca9,_0x199e82){return function(_0x30a7ff){if(_0x30a7ff){return _0x30a7ff[_0x7d78('0x25')](_0x2fbca9)[_0x7d78('0x26')](function(_0x41a246){return _0x41a246;});}return null;};}function removeEntity(_0x2020e7,_0x19f981){return function(_0x56fd98){if(_0x56fd98){return _0x56fd98['destroy']()['then'](function(){_0x2020e7[_0x7d78('0x1b')](0xcc)[_0x7d78('0x1a')]();});}};}function handleEntityNotFound(_0x52e658,_0x1e3558){return function(_0x348bf2){if(!_0x348bf2){_0x52e658['sendStatus'](0x194);}return _0x348bf2;};}function handleError(_0x1e004e,_0x4dfffb){_0x4dfffb=_0x4dfffb||0x1f4;return function(_0x1870d5){logger[_0x7d78('0x27')](_0x1870d5['stack']);if(_0x1870d5[_0x7d78('0x28')]){delete _0x1870d5[_0x7d78('0x28')];}_0x1e004e[_0x7d78('0x1b')](_0x4dfffb)[_0x7d78('0x29')](_0x1870d5);};}exports[_0x7d78('0x2a')]=function(_0x5aa753,_0x557792){var _0x3fd469={},_0x22871d={},_0x111091={'count':0x0,'rows':[]};var _0x3c8a5e=_[_0x7d78('0x2b')](db[_0x7d78('0x2c')][_0x7d78('0x2d')],function(_0x3b627c){return{'name':_0x3b627c['fieldName'],'type':_0x3b627c[_0x7d78('0x2e')][_0x7d78('0x2f')]};});_0x22871d['model']=_[_0x7d78('0x2b')](_0x3c8a5e,'name');_0x22871d[_0x7d78('0x30')]=_[_0x7d78('0x31')](_0x5aa753['query']);_0x22871d[_0x7d78('0x32')]=_[_0x7d78('0x33')](_0x22871d['model'],_0x22871d[_0x7d78('0x30')]);_0x3fd469[_0x7d78('0x34')]=_[_0x7d78('0x33')](_0x22871d[_0x7d78('0x35')],qs[_0x7d78('0x36')](_0x5aa753['query'][_0x7d78('0x36')]));_0x3fd469['attributes']=_0x3fd469[_0x7d78('0x34')][_0x7d78('0x37')]?_0x3fd469['attributes']:_0x22871d['model'];if(!_0x5aa753['query']['hasOwnProperty']('nolimit')){_0x3fd469[_0x7d78('0x20')]=qs[_0x7d78('0x20')](_0x5aa753['query']['limit']);_0x3fd469['offset']=qs[_0x7d78('0x1d')](_0x5aa753[_0x7d78('0x30')][_0x7d78('0x1d')]);}_0x3fd469[_0x7d78('0x38')]=qs[_0x7d78('0x39')](_0x5aa753[_0x7d78('0x30')][_0x7d78('0x39')]);_0x3fd469[_0x7d78('0x3a')]=qs[_0x7d78('0x32')](_['pick'](_0x5aa753[_0x7d78('0x30')],_0x22871d[_0x7d78('0x32')]),_0x3c8a5e);if(_0x5aa753[_0x7d78('0x30')]['filter']){_0x3fd469[_0x7d78('0x3a')]=_[_0x7d78('0x3b')](_0x3fd469[_0x7d78('0x3a')],{'$or':_[_0x7d78('0x2b')](_0x3c8a5e,function(_0x6cd181){if(_0x6cd181[_0x7d78('0x2e')]!==_0x7d78('0x3c')){var _0x3bcf6d={};_0x3bcf6d[_0x6cd181['name']]={'$like':'%'+_0x5aa753[_0x7d78('0x30')]['filter']+'%'};return _0x3bcf6d;}})});}_0x3fd469=_['merge']({},_0x3fd469,_0x5aa753[_0x7d78('0x3d')]);var _0x980dc7={'where':_0x3fd469[_0x7d78('0x3a')]};return db[_0x7d78('0x2c')][_0x7d78('0x1f')](_0x980dc7)[_0x7d78('0x26')](function(_0x5abc0c){_0x111091[_0x7d78('0x1f')]=_0x5abc0c;if(_0x5aa753['query'][_0x7d78('0x3e')]){_0x3fd469[_0x7d78('0x3f')]=[{'all':!![]}];}return db[_0x7d78('0x2c')][_0x7d78('0x40')](_0x3fd469);})['then'](function(_0x350de5){_0x111091['rows']=_0x350de5;return _0x111091;})[_0x7d78('0x26')](respondWithFilteredResult(_0x557792,_0x3fd469))[_0x7d78('0x41')](handleError(_0x557792,null));};exports[_0x7d78('0x42')]=function(_0x4d6661,_0xf8e2ee){var _0x3e0781={'raw':![],'where':{'id':_0x4d6661[_0x7d78('0x43')]['id']}},_0x37b53f={};_0x37b53f[_0x7d78('0x35')]=_['keys'](db[_0x7d78('0x2c')]['rawAttributes']);_0x37b53f[_0x7d78('0x30')]=_[_0x7d78('0x31')](_0x4d6661[_0x7d78('0x30')]);_0x37b53f['filters']=_[_0x7d78('0x33')](_0x37b53f[_0x7d78('0x35')],_0x37b53f[_0x7d78('0x30')]);_0x3e0781[_0x7d78('0x34')]=_[_0x7d78('0x33')](_0x37b53f['model'],qs[_0x7d78('0x36')](_0x4d6661[_0x7d78('0x30')]['fields']));_0x3e0781['attributes']=_0x3e0781['attributes'][_0x7d78('0x37')]?_0x3e0781['attributes']:_0x37b53f[_0x7d78('0x35')];if(_0x4d6661[_0x7d78('0x30')][_0x7d78('0x3e')]){_0x3e0781[_0x7d78('0x3f')]=[{'all':!![]}];}_0x3e0781=_[_0x7d78('0x3b')]({},_0x3e0781,_0x4d6661[_0x7d78('0x3d')]);return db[_0x7d78('0x2c')]['find'](_0x3e0781)[_0x7d78('0x26')](handleEntityNotFound(_0xf8e2ee,null))[_0x7d78('0x26')](respondWithResult(_0xf8e2ee,null))[_0x7d78('0x41')](handleError(_0xf8e2ee,null));};exports[_0x7d78('0x44')]=function(_0x14cba6,_0x54338d){return db[_0x7d78('0x2c')]['create'](_0x14cba6['body'],{})[_0x7d78('0x26')](respondWithResult(_0x54338d,0xc9))[_0x7d78('0x41')](handleError(_0x54338d,null));};exports[_0x7d78('0x25')]=function(_0x466db6,_0x341b28){if(_0x466db6['body']['id']){delete _0x466db6[_0x7d78('0x45')]['id'];}return db[_0x7d78('0x2c')]['find']({'where':{'id':_0x466db6[_0x7d78('0x43')]['id']}})[_0x7d78('0x26')](handleEntityNotFound(_0x341b28,null))[_0x7d78('0x26')](saveUpdates(_0x466db6['body'],null))[_0x7d78('0x26')](respondWithResult(_0x341b28,null))['catch'](handleError(_0x341b28,null));};exports['destroy']=function(_0x13ff5c,_0x471d06){return db[_0x7d78('0x2c')][_0x7d78('0x46')]({'where':{'id':_0x13ff5c[_0x7d78('0x43')]['id']}})[_0x7d78('0x26')](handleEntityNotFound(_0x471d06,null))['then'](removeEntity(_0x471d06,null))['catch'](handleError(_0x471d06,null));};exports[_0x7d78('0x47')]=function(_0x3559ac,_0x52cddc){return db[_0x7d78('0x2c')]['describe']()['then'](respondWithResult(_0x52cddc,null))['catch'](handleError(_0x52cddc,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 859ee17..1f03f08 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 _0x5f41=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash'];(function(_0x3a1256,_0x1fe2db){var _0x1bd352=function(_0x509c54){while(--_0x509c54){_0x3a1256['push'](_0x3a1256['shift']());}};_0x1bd352(++_0x1fe2db);}(_0x5f41,0x167));var _0x15f4=function(_0x2f257b,_0x3530a0){_0x2f257b=_0x2f257b-0x0;var _0x5bb972=_0x5f41[_0x2f257b];return _0x5bb972;};'use strict';var _=require(_0x15f4('0x0'));var util=require('util');var logger=require(_0x15f4('0x1'))(_0x15f4('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x15f4('0x3'));var fs=require('fs');var path=require(_0x15f4('0x4'));var rimraf=require(_0x15f4('0x5'));var config=require(_0x15f4('0x6'));var attributes=require(_0x15f4('0x7'));module[_0x15f4('0x8')]=function(_0x37de7e,_0x168fd8){return _0x37de7e[_0x15f4('0x9')](_0x15f4('0xa'),attributes,{'tableName':_0x15f4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x84c3=['path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','util','../../config/logger','api','moment','request-promise'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x84c3,0x174));var _0x384c=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0x84c3[_0x34bc30];return _0x5706de;};'use strict';var _=require('lodash');var util=require(_0x384c('0x0'));var logger=require(_0x384c('0x1'))(_0x384c('0x2'));var moment=require(_0x384c('0x3'));var BPromise=require('bluebird');var rp=require(_0x384c('0x4'));var fs=require('fs');var path=require(_0x384c('0x5'));var rimraf=require(_0x384c('0x6'));var config=require(_0x384c('0x7'));var attributes=require(_0x384c('0x8'));module[_0x384c('0x9')]=function(_0x2a93ad,_0x131bc8){return _0x2a93ad[_0x384c('0xa')](_0x384c('0xb'),attributes,{'tableName':_0x384c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 89012d8..58efd14 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 _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x4975,0x86));var _0x5497=function(_0x292bcd,_0x71c1ba){_0x292bcd=_0x292bcd-0x0;var _0x15e34a=_0x4975[_0x292bcd];return _0x15e34a;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file +var _0x187d=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x478422,_0x5143c0){var _0x36a229=function(_0x1a6522){while(--_0x1a6522){_0x478422['push'](_0x478422['shift']());}};_0x36a229(++_0x5143c0);}(_0x187d,0x93));var _0xd187=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x187d[_0x32d457];return _0x338386;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var moment=require(_0xd187('0x1'));var BPromise=require(_0xd187('0x2'));var rs=require(_0xd187('0x3'));var fs=require('fs');var Redis=require(_0xd187('0x4'));var db=require(_0xd187('0x5'))['db'];var utils=require(_0xd187('0x6'));var logger=require('../../config/logger')(_0xd187('0x7'));var config=require(_0xd187('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd187('0x9')][_0xd187('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x444a60,_0x1d3fe4,_0x28ce2f){return new BPromise(function(_0x2d6992,_0x358c45){return client[_0xd187('0xb')](_0x444a60,_0x28ce2f)['then'](function(_0x342539){logger[_0xd187('0xc')](_0xd187('0xd'),_0x1d3fe4,_0xd187('0xe'));logger[_0xd187('0xf')](_0xd187('0x10'),_0x1d3fe4,'request\x20sent',JSON[_0xd187('0x11')](_0x342539));if(_0x342539[_0xd187('0x12')]){if(_0x342539[_0xd187('0x12')]['code']===0x1f4){logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539[_0xd187('0x12')]['message']);return _0x358c45(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539['error'][_0xd187('0x13')]);return _0x2d6992(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}else{logger[_0xd187('0xc')]('IntegrationReport,\x20%s,\x20%s',_0x1d3fe4,_0xd187('0xe'));_0x2d6992(_0x342539['result']['message']);}})[_0xd187('0x14')](function(_0x5a4986){logger['error'](_0xd187('0xd'),_0x1d3fe4,_0x5a4986);_0x358c45(_0x5a4986);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index fe72204..d5be455 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 _0x8169=['destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','./interval.controller','get','index','/:id','isAuthenticated','/:id/sub_intervals','getIntervals','create','post','addInterval','/:id/sub_intervals/create_many','addIntervals','update','delete'];(function(_0xa844e4,_0x46039b){var _0x4d4496=function(_0x3c1195){while(--_0x3c1195){_0xa844e4['push'](_0xa844e4['shift']());}};_0x4d4496(++_0x46039b);}(_0x8169,0xd4));var _0x9816=function(_0x2bf996,_0x25ffb2){_0x2bf996=_0x2bf996-0x0;var _0x573bef=_0x8169[_0x2bf996];return _0x573bef;};'use strict';var multer=require(_0x9816('0x0'));var util=require('util');var path=require(_0x9816('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9816('0x2')]();var fs_extra=require(_0x9816('0x3'));var auth=require(_0x9816('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9816('0x5'));router[_0x9816('0x6')]('/',auth['isAuthenticated'](),controller[_0x9816('0x7')]);router[_0x9816('0x6')](_0x9816('0x8'),auth[_0x9816('0x9')](),controller['show']);router['get'](_0x9816('0xa'),auth['isAuthenticated'](),controller[_0x9816('0xb')]);router['post']('/',auth[_0x9816('0x9')](),controller[_0x9816('0xc')]);router[_0x9816('0xd')](_0x9816('0xa'),auth[_0x9816('0x9')](),controller[_0x9816('0xe')]);router[_0x9816('0xd')](_0x9816('0xf'),auth[_0x9816('0x9')](),controller[_0x9816('0x10')]);router['put'](_0x9816('0x8'),auth[_0x9816('0x9')](),controller[_0x9816('0x11')]);router[_0x9816('0x12')]('/:id',auth[_0x9816('0x9')](),controller[_0x9816('0x13')]);module[_0x9816('0x14')]=router; \ No newline at end of file +var _0x7d9a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','create','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy','exports','multer','util','connect-timeout','fs-extra'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x7d9a,0x1be));var _0xa7d9=function(_0x27a406,_0x49ec0f){_0x27a406=_0x27a406-0x0;var _0x465e3d=_0x7d9a[_0x27a406];return _0x465e3d;};'use strict';var multer=require(_0xa7d9('0x0'));var util=require(_0xa7d9('0x1'));var path=require('path');var timeout=require(_0xa7d9('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa7d9('0x3'));var auth=require(_0xa7d9('0x4'));var interaction=require(_0xa7d9('0x5'));var config=require(_0xa7d9('0x6'));var controller=require(_0xa7d9('0x7'));router[_0xa7d9('0x8')]('/',auth[_0xa7d9('0x9')](),controller[_0xa7d9('0xa')]);router[_0xa7d9('0x8')](_0xa7d9('0xb'),auth[_0xa7d9('0x9')](),controller[_0xa7d9('0xc')]);router[_0xa7d9('0x8')](_0xa7d9('0xd'),auth[_0xa7d9('0x9')](),controller[_0xa7d9('0xe')]);router['post']('/',auth[_0xa7d9('0x9')](),controller[_0xa7d9('0xf')]);router[_0xa7d9('0x10')](_0xa7d9('0xd'),auth[_0xa7d9('0x9')](),controller[_0xa7d9('0x11')]);router[_0xa7d9('0x10')](_0xa7d9('0x12'),auth[_0xa7d9('0x9')](),controller[_0xa7d9('0x13')]);router[_0xa7d9('0x14')](_0xa7d9('0xb'),auth[_0xa7d9('0x9')](),controller[_0xa7d9('0x15')]);router[_0xa7d9('0x16')](_0xa7d9('0xb'),auth[_0xa7d9('0x9')](),controller[_0xa7d9('0x17')]);module[_0xa7d9('0x18')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index d738c9c..0c3e5e4 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 _0x6aca=['exports','STRING','sequelize'];(function(_0x2335bd,_0x54e892){var _0x2aac2c=function(_0x3194dc){while(--_0x3194dc){_0x2335bd['push'](_0x2335bd['shift']());}};_0x2aac2c(++_0x54e892);}(_0x6aca,0x1dc));var _0xa6ac=function(_0x33bc64,_0x4d1e92){_0x33bc64=_0x33bc64-0x0;var _0x3fdd34=_0x6aca[_0x33bc64];return _0x3fdd34;};'use strict';var Sequelize=require(_0xa6ac('0x0'));module[_0xa6ac('0x1')]={'name':{'type':Sequelize[_0xa6ac('0x2')]},'description':{'type':Sequelize[_0xa6ac('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x045c=['exports','STRING','sequelize'];(function(_0x201642,_0x53f113){var _0x1feba7=function(_0x27672e){while(--_0x27672e){_0x201642['push'](_0x201642['shift']());}};_0x1feba7(++_0x53f113);}(_0x045c,0xe0));var _0xc045=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x045c[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0xc045('0x0'));module[_0xc045('0x1')]={'name':{'type':Sequelize[_0xc045('0x2')]},'description':{'type':Sequelize[_0xc045('0x2')]},'interval':{'type':Sequelize[_0xc045('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 6785b4d..d346e4e 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 _0xd62d=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','Content-Range','reject','update','then','UserProfileResource','destroy','stack','send','Interval','rawAttributes','type','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','count','findAll','catch','params','includeAll','include','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Intervals','find','userProfileId','autoAssociation','addInterval','findOne','getIntervals','addIntervals','sequelize','transaction','IntervalId','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x5bdccf,_0x2bbf15){var _0x3c4c74=function(_0x17d0c4){while(--_0x17d0c4){_0x5bdccf['push'](_0x5bdccf['shift']());}};_0x3c4c74(++_0x2bbf15);}(_0xd62d,0x199));var _0xdd62=function(_0x2d4ae0,_0x12b9cf){_0x2d4ae0=_0x2d4ae0-0x0;var _0x3453f6=_0xd62d[_0x2d4ae0];return _0x3453f6;};'use strict';var emlformat=require(_0xdd62('0x0'));var rimraf=require(_0xdd62('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdd62('0x2'));var rp=require(_0xdd62('0x3'));var moment=require(_0xdd62('0x4'));var BPromise=require(_0xdd62('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdd62('0x6'));var sox=require(_0xdd62('0x7'));var csv=require(_0xdd62('0x8'));var ejs=require(_0xdd62('0x9'));var fs=require('fs');var fs_extra=require(_0xdd62('0xa'));var _=require(_0xdd62('0xb'));var squel=require(_0xdd62('0xc'));var crypto=require(_0xdd62('0xd'));var jsforce=require(_0xdd62('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xdd62('0x8'));var querystring=require(_0xdd62('0xf'));var Papa=require('papaparse');var Redis=require(_0xdd62('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xdd62('0x11'));var as=require(_0xdd62('0x12'));var hardwareService=require(_0xdd62('0x13'));var logger=require(_0xdd62('0x14'))(_0xdd62('0x15'));var utils=require(_0xdd62('0x16'));var config=require(_0xdd62('0x17'));var licenseUtil=require(_0xdd62('0x18'));var db=require(_0xdd62('0x19'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x6e178c,_0x5a7cce){_0x5a7cce=_0x5a7cce||0xcc;return function(_0x364437){if(_0x364437){return _0x6e178c['sendStatus'](_0x5a7cce);}return _0x6e178c['status'](_0x5a7cce)[_0xdd62('0x1a')]();};}function respondWithResult(_0x25ef61,_0x2da80e){_0x2da80e=_0x2da80e||0xc8;return function(_0x1659e8){if(_0x1659e8){return _0x25ef61[_0xdd62('0x1b')](_0x2da80e)[_0xdd62('0x1c')](_0x1659e8);}};}function respondWithFilteredResult(_0x4e7897,_0x325e06){return function(_0x3bbae9){if(_0x3bbae9){var _0xb31df7=typeof _0x325e06[_0xdd62('0x1d')]===_0xdd62('0x1e')&&typeof _0x325e06['limit']===_0xdd62('0x1e');var _0x114dc9=_0x3bbae9['count'];var _0x110b5e=_0xb31df7?0x0:_0x325e06[_0xdd62('0x1d')];var _0x5bf54b=_0xb31df7?_0x3bbae9['count']:_0x325e06['offset']+_0x325e06['limit'];var _0x5d768f;if(_0x5bf54b>=_0x114dc9){_0x5bf54b=_0x114dc9;_0x5d768f=0xc8;}else{_0x5d768f=0xce;}_0x4e7897[_0xdd62('0x1b')](_0x5d768f);return _0x4e7897['set'](_0xdd62('0x1f'),_0x110b5e+'-'+_0x5bf54b+'/'+_0x114dc9)['json'](_0x3bbae9);}return null;};}function patchUpdates(_0xffde39){return function(_0xfec7d7){try{jsonpatch['apply'](_0xfec7d7,_0xffde39,!![]);}catch(_0x3dcb50){return BPromise[_0xdd62('0x20')](_0x3dcb50);}return _0xfec7d7['save']();};}function saveUpdates(_0x2fcb04,_0x296f14){return function(_0x286a94){if(_0x286a94){return _0x286a94[_0xdd62('0x21')](_0x2fcb04)[_0xdd62('0x22')](function(_0x285c13){return _0x285c13;});}return null;};}function removeEntity(_0x75454d,_0x5807ba){return function(_0x39c5a2){if(_0x39c5a2){return _0x39c5a2['destroy']()['then'](function(){var _0x372bdf=_0x39c5a2['get']({'plain':!![]});var _0x5dce56='Intervals';return db[_0xdd62('0x23')][_0xdd62('0x24')]({'where':{'type':_0x5dce56,'resourceId':_0x372bdf['id']}})['then'](function(){return _0x39c5a2;});})[_0xdd62('0x22')](function(){_0x75454d[_0xdd62('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x576d88,_0xb8d393){return function(_0x4409ee){if(!_0x4409ee){_0x576d88['sendStatus'](0x194);}return _0x4409ee;};}function handleError(_0x126b38,_0x16bf34){_0x16bf34=_0x16bf34||0x1f4;return function(_0xac7b4f){logger['error'](_0xac7b4f[_0xdd62('0x25')]);if(_0xac7b4f['name']){delete _0xac7b4f['name'];}_0x126b38[_0xdd62('0x1b')](_0x16bf34)[_0xdd62('0x26')](_0xac7b4f);};}exports['index']=function(_0x15200b,_0x3cb6bb){var _0x54da97={},_0x2c8176={},_0x1279fc={'count':0x0,'rows':[]};var _0x4ae23c=_['map'](db[_0xdd62('0x27')][_0xdd62('0x28')],function(_0x4f4b24){return{'name':_0x4f4b24['fieldName'],'type':_0x4f4b24[_0xdd62('0x29')][_0xdd62('0x2a')]};});_0x2c8176[_0xdd62('0x2b')]=_[_0xdd62('0x2c')](_0x4ae23c,_0xdd62('0x2d'));_0x2c8176[_0xdd62('0x2e')]=_[_0xdd62('0x2f')](_0x15200b[_0xdd62('0x2e')]);_0x2c8176[_0xdd62('0x30')]=_[_0xdd62('0x31')](_0x2c8176['model'],_0x2c8176[_0xdd62('0x2e')]);_0x54da97[_0xdd62('0x32')]=_[_0xdd62('0x31')](_0x2c8176[_0xdd62('0x2b')],qs[_0xdd62('0x33')](_0x15200b[_0xdd62('0x2e')][_0xdd62('0x33')]));_0x54da97['attributes']=_0x54da97[_0xdd62('0x32')][_0xdd62('0x34')]?_0x54da97['attributes']:_0x2c8176['model'];if(!_0x15200b[_0xdd62('0x2e')]['hasOwnProperty'](_0xdd62('0x35'))){_0x54da97['limit']=qs['limit'](_0x15200b['query'][_0xdd62('0x36')]);_0x54da97[_0xdd62('0x1d')]=qs[_0xdd62('0x1d')](_0x15200b[_0xdd62('0x2e')][_0xdd62('0x1d')]);}_0x54da97[_0xdd62('0x37')]=qs['sort'](_0x15200b[_0xdd62('0x2e')][_0xdd62('0x38')]);_0x54da97[_0xdd62('0x39')]=qs[_0xdd62('0x30')](_[_0xdd62('0x3a')](_0x15200b[_0xdd62('0x2e')],_0x2c8176[_0xdd62('0x30')]),_0x4ae23c);if(_0x15200b[_0xdd62('0x2e')][_0xdd62('0x3b')]){_0x54da97['where']=_['merge'](_0x54da97[_0xdd62('0x39')],{'$or':_['map'](_0x4ae23c,function(_0x46fe33){if(_0x46fe33['type']!==_0xdd62('0x3c')){var _0x54b043={};_0x54b043[_0x46fe33['name']]={'$like':'%'+_0x15200b['query'][_0xdd62('0x3b')]+'%'};return _0x54b043;}})});}_0x54da97=_[_0xdd62('0x3d')]({},_0x54da97,_0x15200b['options']);var _0x46ea35={'where':_0x54da97[_0xdd62('0x39')]};return db[_0xdd62('0x27')][_0xdd62('0x3e')](_0x46ea35)['then'](function(_0x1786fb){_0x1279fc[_0xdd62('0x3e')]=_0x1786fb;if(_0x15200b[_0xdd62('0x2e')]['includeAll']){_0x54da97['include']=[{'all':!![]}];}return db[_0xdd62('0x27')][_0xdd62('0x3f')](_0x54da97);})['then'](function(_0x43a44c){_0x1279fc['rows']=_0x43a44c;return _0x1279fc;})[_0xdd62('0x22')](respondWithFilteredResult(_0x3cb6bb,_0x54da97))[_0xdd62('0x40')](handleError(_0x3cb6bb,null));};exports['show']=function(_0x5a5456,_0x30a2f1){var _0x565116={'raw':!![],'where':{'id':_0x5a5456[_0xdd62('0x41')]['id']}},_0x269ac0={};_0x269ac0[_0xdd62('0x2b')]=_[_0xdd62('0x2f')](db[_0xdd62('0x27')][_0xdd62('0x28')]);_0x269ac0[_0xdd62('0x2e')]=_['keys'](_0x5a5456['query']);_0x269ac0[_0xdd62('0x30')]=_['intersection'](_0x269ac0[_0xdd62('0x2b')],_0x269ac0['query']);_0x565116[_0xdd62('0x32')]=_[_0xdd62('0x31')](_0x269ac0['model'],qs['fields'](_0x5a5456[_0xdd62('0x2e')][_0xdd62('0x33')]));_0x565116[_0xdd62('0x32')]=_0x565116['attributes'][_0xdd62('0x34')]?_0x565116['attributes']:_0x269ac0[_0xdd62('0x2b')];if(_0x5a5456['query'][_0xdd62('0x42')]){_0x565116[_0xdd62('0x43')]=[{'all':!![]}];}_0x565116=_['merge']({},_0x565116,_0x5a5456[_0xdd62('0x44')]);return db['Interval']['find'](_0x565116)[_0xdd62('0x22')](handleEntityNotFound(_0x30a2f1,null))[_0xdd62('0x22')](respondWithResult(_0x30a2f1,null))[_0xdd62('0x40')](handleError(_0x30a2f1,null));};exports['create']=function(_0x7c7bf9,_0x206171){return db['Interval'][_0xdd62('0x45')](_0x7c7bf9[_0xdd62('0x46')],{})[_0xdd62('0x22')](function(_0x2bd7f0){var _0x5cee82=_0x7c7bf9[_0xdd62('0x47')][_0xdd62('0x48')]({'plain':!![]});if(!_0x5cee82)throw new Error(_0xdd62('0x49'));if(_0x5cee82[_0xdd62('0x4a')]===_0xdd62('0x47')){var _0x16d23a=_0x2bd7f0['get']({'plain':!![]});var _0x50b720=_0xdd62('0x4b');return db['UserProfileSection'][_0xdd62('0x4c')]({'where':{'name':_0x50b720,'userProfileId':_0x5cee82[_0xdd62('0x4d')]},'raw':!![]})[_0xdd62('0x22')](function(_0x52039b){if(_0x52039b&&_0x52039b[_0xdd62('0x4e')]===0x0){return db['UserProfileResource'][_0xdd62('0x45')]({'name':_0x16d23a[_0xdd62('0x2d')],'resourceId':_0x16d23a['id'],'type':_0x52039b[_0xdd62('0x2d')],'sectionId':_0x52039b['id']},{})[_0xdd62('0x22')](function(){return _0x2bd7f0;});}else{return _0x2bd7f0;}})['catch'](function(_0x744e66){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x744e66);throw _0x744e66;});}return _0x2bd7f0;})[_0xdd62('0x22')](respondWithResult(_0x206171,0xc9))[_0xdd62('0x40')](handleError(_0x206171,null));};exports[_0xdd62('0x21')]=function(_0x22246f,_0x4c859e){if(_0x22246f[_0xdd62('0x46')]['id']){delete _0x22246f[_0xdd62('0x46')]['id'];}return db[_0xdd62('0x27')]['find']({'where':{'id':_0x22246f[_0xdd62('0x41')]['id']}})[_0xdd62('0x22')](handleEntityNotFound(_0x4c859e,null))[_0xdd62('0x22')](saveUpdates(_0x22246f['body'],null))[_0xdd62('0x22')](respondWithResult(_0x4c859e,null))['catch'](handleError(_0x4c859e,null));};exports['destroy']=function(_0x4d6e4b,_0x46e391){return db['Interval']['find']({'where':{'id':_0x4d6e4b[_0xdd62('0x41')]['id']}})[_0xdd62('0x22')](handleEntityNotFound(_0x46e391,null))[_0xdd62('0x22')](removeEntity(_0x46e391,null))[_0xdd62('0x40')](handleError(_0x46e391,null));};exports[_0xdd62('0x4f')]=function(_0x520a38,_0x5d9515,_0x57ee37){if(_0x520a38['body']['id']){delete _0x520a38['body']['id'];}return db[_0xdd62('0x27')][_0xdd62('0x4c')]({'where':{'id':_0x520a38[_0xdd62('0x41')]['id']}})[_0xdd62('0x22')](handleEntityNotFound(_0x5d9515,null))['then'](function(_0x1e7667){if(_0x1e7667){_0x520a38[_0xdd62('0x46')]['IntervalId']=_0x1e7667['id'];return db[_0xdd62('0x27')][_0xdd62('0x45')](_0x520a38[_0xdd62('0x46')]);}})[_0xdd62('0x22')](respondWithResult(_0x5d9515,null))[_0xdd62('0x40')](handleError(_0x5d9515,null));};exports['getIntervals']=function(_0x6f816f,_0x21454c,_0x1c84bb){var _0x185d93={};var _0x59c658={};var _0x393c11;var _0x47afbd;return db[_0xdd62('0x27')][_0xdd62('0x50')]({'where':{'id':_0x6f816f[_0xdd62('0x41')]['id']}})['then'](handleEntityNotFound(_0x21454c,null))[_0xdd62('0x22')](function(_0x442a50){if(_0x442a50){_0x393c11=_0x442a50;_0x59c658[_0xdd62('0x2b')]=_[_0xdd62('0x2f')](db[_0xdd62('0x27')]['rawAttributes']);_0x59c658[_0xdd62('0x2e')]=_[_0xdd62('0x2f')](_0x6f816f[_0xdd62('0x2e')]);_0x59c658['filters']=_['intersection'](_0x59c658[_0xdd62('0x2b')],_0x59c658['query']);_0x185d93[_0xdd62('0x32')]=_[_0xdd62('0x31')](_0x59c658[_0xdd62('0x2b')],qs[_0xdd62('0x33')](_0x6f816f[_0xdd62('0x2e')]['fields']));_0x185d93[_0xdd62('0x32')]=_0x185d93[_0xdd62('0x32')][_0xdd62('0x34')]?_0x185d93[_0xdd62('0x32')]:_0x59c658[_0xdd62('0x2b')];_0x185d93['order']=qs[_0xdd62('0x38')](_0x6f816f[_0xdd62('0x2e')][_0xdd62('0x38')]);_0x185d93['where']=qs['filters'](_['pick'](_0x6f816f[_0xdd62('0x2e')],_0x59c658[_0xdd62('0x30')]));if(_0x6f816f[_0xdd62('0x2e')]['filter']){_0x185d93['where']=_[_0xdd62('0x3d')](_0x185d93['where'],{'$or':_['map'](_0x185d93[_0xdd62('0x32')],function(_0x36b410){var _0x2b2ddc={};_0x2b2ddc[_0x36b410]={'$like':'%'+_0x6f816f['query'][_0xdd62('0x3b')]+'%'};return _0x2b2ddc;})});}_0x185d93=_['merge']({},_0x185d93,_0x6f816f[_0xdd62('0x44')]);return _0x393c11['getIntervals'](_0x185d93);}})[_0xdd62('0x22')](function(_0x17c43a){if(_0x17c43a){_0x47afbd=_0x17c43a[_0xdd62('0x34')];if(!_0x6f816f[_0xdd62('0x2e')]['hasOwnProperty']('nolimit')){_0x185d93[_0xdd62('0x36')]=qs[_0xdd62('0x36')](_0x6f816f[_0xdd62('0x2e')]['limit']);_0x185d93[_0xdd62('0x1d')]=qs[_0xdd62('0x1d')](_0x6f816f[_0xdd62('0x2e')][_0xdd62('0x1d')]);}return _0x393c11[_0xdd62('0x51')](_0x185d93);}})['then'](function(_0x125fca){if(_0x125fca){return _0x125fca?{'count':_0x47afbd,'rows':_0x125fca}:null;}})['then'](respondWithResult(_0x21454c,null))[_0xdd62('0x40')](handleError(_0x21454c,null));};exports[_0xdd62('0x52')]=function(_0x1073b8,_0x1768c6,_0x3a5569){return db[_0xdd62('0x27')]['findOne']({'where':{'id':_0x1073b8['params']['id']}})[_0xdd62('0x22')](handleEntityNotFound(_0x1768c6,null))[_0xdd62('0x22')](function(_0x3aad52){if(_0x3aad52){return db[_0xdd62('0x53')][_0xdd62('0x54')](function(_0x5e8906){return db[_0xdd62('0x27')]['destroy']({'where':{'IntervalId':_0x1073b8[_0xdd62('0x41')]['id']},'transaction':_0x5e8906})[_0xdd62('0x22')](function(_0x3e2be0){var _0x3087e5=_[_0xdd62('0x2c')](_0x1073b8[_0xdd62('0x46')],function(_0x567f1b){delete _0x567f1b['id'];_0x567f1b[_0xdd62('0x55')]=_0x1073b8[_0xdd62('0x41')]['id'];return _0x567f1b;});return db[_0xdd62('0x27')]['bulkCreate'](_0x3087e5,{'transaction':_0x5e8906});});})[_0xdd62('0x22')](function(){return db[_0xdd62('0x27')]['findAll']({'where':{'IntervalId':_0x1073b8[_0xdd62('0x41')]['id']}});});}})[_0xdd62('0x22')](respondWithResult(_0x1768c6,null))[_0xdd62('0x40')](handleError(_0x1768c6,null));}; \ No newline at end of file +var _0xc32f=['UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','IntervalId','getIntervals','findOne','nolimit','addIntervals','sequelize','transaction','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','error','stack','name','index','map','Interval','rawAttributes','fieldName','type','key','keys','query','intersection','fields','attributes','length','model','hasOwnProperty','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','include','findAll','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user'];(function(_0x39ecca,_0x44fb81){var _0x3f7261=function(_0x48da8d){while(--_0x48da8d){_0x39ecca['push'](_0x39ecca['shift']());}};_0x3f7261(++_0x44fb81);}(_0xc32f,0xc2));var _0xfc32=function(_0x35864e,_0x250350){_0x35864e=_0x35864e-0x0;var _0x5c579f=_0xc32f[_0x35864e];return _0x5c579f;};'use strict';var emlformat=require(_0xfc32('0x0'));var rimraf=require(_0xfc32('0x1'));var zipdir=require(_0xfc32('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfc32('0x3'));var BPromise=require(_0xfc32('0x4'));var Mustache=require(_0xfc32('0x5'));var util=require(_0xfc32('0x6'));var path=require('path');var sox=require(_0xfc32('0x7'));var csv=require(_0xfc32('0x8'));var ejs=require(_0xfc32('0x9'));var fs=require('fs');var fs_extra=require(_0xfc32('0xa'));var _=require(_0xfc32('0xb'));var squel=require(_0xfc32('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfc32('0xd'));var toCsv=require(_0xfc32('0x8'));var querystring=require('querystring');var Papa=require(_0xfc32('0xe'));var Redis=require(_0xfc32('0xf'));var authService=require(_0xfc32('0x10'));var qs=require(_0xfc32('0x11'));var as=require(_0xfc32('0x12'));var hardwareService=require(_0xfc32('0x13'));var logger=require(_0xfc32('0x14'))(_0xfc32('0x15'));var utils=require(_0xfc32('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xfc32('0x17'))['db'];var extensions=require(_0xfc32('0x18'));function respondWithStatusCode(_0x541338,_0x5b1368){_0x5b1368=_0x5b1368||0xcc;return function(_0x9d4f05){if(_0x9d4f05){return _0x541338[_0xfc32('0x19')](_0x5b1368);}return _0x541338[_0xfc32('0x1a')](_0x5b1368)[_0xfc32('0x1b')]();};}function respondWithResult(_0x18394e,_0x5576f3){_0x5576f3=_0x5576f3||0xc8;return function(_0x4d5b4f){if(_0x4d5b4f){return _0x18394e['status'](_0x5576f3)[_0xfc32('0x1c')](_0x4d5b4f);}};}function respondWithFilteredResult(_0x3cf965,_0x504a53){return function(_0x6df7c7){if(_0x6df7c7){var _0x131227=typeof _0x504a53[_0xfc32('0x1d')]===_0xfc32('0x1e')&&typeof _0x504a53[_0xfc32('0x1f')]===_0xfc32('0x1e');var _0x314337=_0x6df7c7[_0xfc32('0x20')];var _0x5a5b87=_0x131227?0x0:_0x504a53[_0xfc32('0x1d')];var _0x1c02ef=_0x131227?_0x6df7c7['count']:_0x504a53['offset']+_0x504a53[_0xfc32('0x1f')];var _0x569359;if(_0x1c02ef>=_0x314337){_0x1c02ef=_0x314337;_0x569359=0xc8;}else{_0x569359=0xce;}_0x3cf965[_0xfc32('0x1a')](_0x569359);return _0x3cf965['set'](_0xfc32('0x21'),_0x5a5b87+'-'+_0x1c02ef+'/'+_0x314337)[_0xfc32('0x1c')](_0x6df7c7);}return null;};}function patchUpdates(_0x47d297){return function(_0x36eedf){try{jsonpatch[_0xfc32('0x22')](_0x36eedf,_0x47d297,!![]);}catch(_0x3801b8){return BPromise[_0xfc32('0x23')](_0x3801b8);}return _0x36eedf[_0xfc32('0x24')]();};}function saveUpdates(_0x4fc917,_0x1e604b){return function(_0x291612){if(_0x291612){return _0x291612[_0xfc32('0x25')](_0x4fc917)[_0xfc32('0x26')](function(_0x2ea6c0){return _0x2ea6c0;});}return null;};}function removeEntity(_0x2c7175,_0x283b84){return function(_0x29e0e3){if(_0x29e0e3){return _0x29e0e3[_0xfc32('0x27')]()['then'](function(){var _0x2a8bae=_0x29e0e3[_0xfc32('0x28')]({'plain':!![]});var _0x44cf4='Intervals';return db['UserProfileResource'][_0xfc32('0x27')]({'where':{'type':_0x44cf4,'resourceId':_0x2a8bae['id']}})[_0xfc32('0x26')](function(){return _0x29e0e3;});})['then'](function(){_0x2c7175[_0xfc32('0x1a')](0xcc)[_0xfc32('0x1b')]();});}};}function handleEntityNotFound(_0x11fe9b,_0x10a527){return function(_0x26079f){if(!_0x26079f){_0x11fe9b['sendStatus'](0x194);}return _0x26079f;};}function handleError(_0xd840ea,_0x45b021){_0x45b021=_0x45b021||0x1f4;return function(_0x51b059){logger[_0xfc32('0x29')](_0x51b059[_0xfc32('0x2a')]);if(_0x51b059[_0xfc32('0x2b')]){delete _0x51b059[_0xfc32('0x2b')];}_0xd840ea[_0xfc32('0x1a')](_0x45b021)['send'](_0x51b059);};}exports[_0xfc32('0x2c')]=function(_0x4a154f,_0x2dfa85){var _0x481dcf={},_0x40a8ca={},_0x5f5c55={'count':0x0,'rows':[]};var _0x4e067a=_[_0xfc32('0x2d')](db[_0xfc32('0x2e')][_0xfc32('0x2f')],function(_0x128d43){return{'name':_0x128d43[_0xfc32('0x30')],'type':_0x128d43[_0xfc32('0x31')][_0xfc32('0x32')]};});_0x40a8ca['model']=_[_0xfc32('0x2d')](_0x4e067a,_0xfc32('0x2b'));_0x40a8ca['query']=_[_0xfc32('0x33')](_0x4a154f[_0xfc32('0x34')]);_0x40a8ca['filters']=_['intersection'](_0x40a8ca['model'],_0x40a8ca[_0xfc32('0x34')]);_0x481dcf['attributes']=_[_0xfc32('0x35')](_0x40a8ca['model'],qs[_0xfc32('0x36')](_0x4a154f['query']['fields']));_0x481dcf[_0xfc32('0x37')]=_0x481dcf[_0xfc32('0x37')][_0xfc32('0x38')]?_0x481dcf[_0xfc32('0x37')]:_0x40a8ca[_0xfc32('0x39')];if(!_0x4a154f[_0xfc32('0x34')][_0xfc32('0x3a')]('nolimit')){_0x481dcf[_0xfc32('0x1f')]=qs['limit'](_0x4a154f['query'][_0xfc32('0x1f')]);_0x481dcf[_0xfc32('0x1d')]=qs[_0xfc32('0x1d')](_0x4a154f[_0xfc32('0x34')][_0xfc32('0x1d')]);}_0x481dcf[_0xfc32('0x3b')]=qs[_0xfc32('0x3c')](_0x4a154f['query'][_0xfc32('0x3c')]);_0x481dcf['where']=qs[_0xfc32('0x3d')](_[_0xfc32('0x3e')](_0x4a154f[_0xfc32('0x34')],_0x40a8ca['filters']),_0x4e067a);if(_0x4a154f[_0xfc32('0x34')][_0xfc32('0x3f')]){_0x481dcf['where']=_['merge'](_0x481dcf[_0xfc32('0x40')],{'$or':_[_0xfc32('0x2d')](_0x4e067a,function(_0x3587dc){if(_0x3587dc[_0xfc32('0x31')]!==_0xfc32('0x41')){var _0x166c1a={};_0x166c1a[_0x3587dc['name']]={'$like':'%'+_0x4a154f[_0xfc32('0x34')][_0xfc32('0x3f')]+'%'};return _0x166c1a;}})});}_0x481dcf=_[_0xfc32('0x42')]({},_0x481dcf,_0x4a154f[_0xfc32('0x43')]);var _0x45017b={'where':_0x481dcf[_0xfc32('0x40')]};return db['Interval'][_0xfc32('0x20')](_0x45017b)['then'](function(_0x443bd7){_0x5f5c55[_0xfc32('0x20')]=_0x443bd7;if(_0x4a154f[_0xfc32('0x34')]['includeAll']){_0x481dcf[_0xfc32('0x44')]=[{'all':!![]}];}return db[_0xfc32('0x2e')][_0xfc32('0x45')](_0x481dcf);})[_0xfc32('0x26')](function(_0x3a1112){_0x5f5c55['rows']=_0x3a1112;return _0x5f5c55;})[_0xfc32('0x26')](respondWithFilteredResult(_0x2dfa85,_0x481dcf))[_0xfc32('0x46')](handleError(_0x2dfa85,null));};exports[_0xfc32('0x47')]=function(_0x201f65,_0x13465c){var _0x381ea7={'raw':!![],'where':{'id':_0x201f65[_0xfc32('0x48')]['id']}},_0x51dfd5={};_0x51dfd5[_0xfc32('0x39')]=_[_0xfc32('0x33')](db[_0xfc32('0x2e')]['rawAttributes']);_0x51dfd5[_0xfc32('0x34')]=_['keys'](_0x201f65[_0xfc32('0x34')]);_0x51dfd5['filters']=_[_0xfc32('0x35')](_0x51dfd5[_0xfc32('0x39')],_0x51dfd5[_0xfc32('0x34')]);_0x381ea7['attributes']=_[_0xfc32('0x35')](_0x51dfd5[_0xfc32('0x39')],qs['fields'](_0x201f65['query'][_0xfc32('0x36')]));_0x381ea7['attributes']=_0x381ea7[_0xfc32('0x37')]['length']?_0x381ea7['attributes']:_0x51dfd5[_0xfc32('0x39')];if(_0x201f65[_0xfc32('0x34')]['includeAll']){_0x381ea7[_0xfc32('0x44')]=[{'all':!![]}];}_0x381ea7=_[_0xfc32('0x42')]({},_0x381ea7,_0x201f65[_0xfc32('0x43')]);return db['Interval'][_0xfc32('0x49')](_0x381ea7)[_0xfc32('0x26')](handleEntityNotFound(_0x13465c,null))[_0xfc32('0x26')](respondWithResult(_0x13465c,null))['catch'](handleError(_0x13465c,null));};exports[_0xfc32('0x4a')]=function(_0x4277a0,_0x518412){return db[_0xfc32('0x2e')][_0xfc32('0x4a')](_0x4277a0[_0xfc32('0x4b')],{})[_0xfc32('0x26')](function(_0x2b2abc){var _0x116731=_0x4277a0['user'][_0xfc32('0x28')]({'plain':!![]});if(!_0x116731)throw new Error(_0xfc32('0x4c'));if(_0x116731[_0xfc32('0x4d')]===_0xfc32('0x4e')){var _0x3c1b02=_0x2b2abc[_0xfc32('0x28')]({'plain':!![]});var _0x31c04f='Intervals';return db[_0xfc32('0x4f')]['find']({'where':{'name':_0x31c04f,'userProfileId':_0x116731[_0xfc32('0x50')]},'raw':!![]})['then'](function(_0xa5e3a2){if(_0xa5e3a2&&_0xa5e3a2[_0xfc32('0x51')]===0x0){return db[_0xfc32('0x52')]['create']({'name':_0x3c1b02[_0xfc32('0x2b')],'resourceId':_0x3c1b02['id'],'type':_0xa5e3a2['name'],'sectionId':_0xa5e3a2['id']},{})[_0xfc32('0x26')](function(){return _0x2b2abc;});}else{return _0x2b2abc;}})[_0xfc32('0x46')](function(_0x5ed87a){logger['error'](_0xfc32('0x53'),_0x5ed87a);throw _0x5ed87a;});}return _0x2b2abc;})[_0xfc32('0x26')](respondWithResult(_0x518412,0xc9))['catch'](handleError(_0x518412,null));};exports['update']=function(_0x5d002f,_0x507c4d){if(_0x5d002f[_0xfc32('0x4b')]['id']){delete _0x5d002f[_0xfc32('0x4b')]['id'];}return db[_0xfc32('0x2e')][_0xfc32('0x49')]({'where':{'id':_0x5d002f[_0xfc32('0x48')]['id']}})[_0xfc32('0x26')](handleEntityNotFound(_0x507c4d,null))['then'](saveUpdates(_0x5d002f[_0xfc32('0x4b')],null))[_0xfc32('0x26')](respondWithResult(_0x507c4d,null))[_0xfc32('0x46')](handleError(_0x507c4d,null));};exports[_0xfc32('0x27')]=function(_0x588512,_0x1f82ca){return db[_0xfc32('0x2e')][_0xfc32('0x49')]({'where':{'id':_0x588512[_0xfc32('0x48')]['id']}})[_0xfc32('0x26')](handleEntityNotFound(_0x1f82ca,null))[_0xfc32('0x26')](removeEntity(_0x1f82ca,null))[_0xfc32('0x46')](handleError(_0x1f82ca,null));};exports['addInterval']=function(_0x56e2eb,_0x3a410c,_0x16c66f){if(_0x56e2eb[_0xfc32('0x4b')]['id']){delete _0x56e2eb[_0xfc32('0x4b')]['id'];}return db[_0xfc32('0x2e')][_0xfc32('0x49')]({'where':{'id':_0x56e2eb[_0xfc32('0x48')]['id']}})['then'](handleEntityNotFound(_0x3a410c,null))['then'](function(_0x450280){if(_0x450280){_0x56e2eb[_0xfc32('0x4b')][_0xfc32('0x54')]=_0x450280['id'];return db[_0xfc32('0x2e')][_0xfc32('0x4a')](_0x56e2eb[_0xfc32('0x4b')]);}})['then'](respondWithResult(_0x3a410c,null))[_0xfc32('0x46')](handleError(_0x3a410c,null));};exports[_0xfc32('0x55')]=function(_0x47c99b,_0x2aec94,_0x381add){var _0x549ac9={};var _0x504c9a={};var _0x217ab8;var _0x108161;return db[_0xfc32('0x2e')][_0xfc32('0x56')]({'where':{'id':_0x47c99b[_0xfc32('0x48')]['id']}})[_0xfc32('0x26')](handleEntityNotFound(_0x2aec94,null))[_0xfc32('0x26')](function(_0x55734c){if(_0x55734c){_0x217ab8=_0x55734c;_0x504c9a['model']=_[_0xfc32('0x33')](db[_0xfc32('0x2e')]['rawAttributes']);_0x504c9a[_0xfc32('0x34')]=_[_0xfc32('0x33')](_0x47c99b[_0xfc32('0x34')]);_0x504c9a['filters']=_[_0xfc32('0x35')](_0x504c9a[_0xfc32('0x39')],_0x504c9a[_0xfc32('0x34')]);_0x549ac9[_0xfc32('0x37')]=_[_0xfc32('0x35')](_0x504c9a[_0xfc32('0x39')],qs[_0xfc32('0x36')](_0x47c99b[_0xfc32('0x34')][_0xfc32('0x36')]));_0x549ac9[_0xfc32('0x37')]=_0x549ac9[_0xfc32('0x37')][_0xfc32('0x38')]?_0x549ac9[_0xfc32('0x37')]:_0x504c9a[_0xfc32('0x39')];_0x549ac9[_0xfc32('0x3b')]=qs[_0xfc32('0x3c')](_0x47c99b[_0xfc32('0x34')][_0xfc32('0x3c')]);_0x549ac9['where']=qs[_0xfc32('0x3d')](_['pick'](_0x47c99b[_0xfc32('0x34')],_0x504c9a[_0xfc32('0x3d')]));if(_0x47c99b['query'][_0xfc32('0x3f')]){_0x549ac9[_0xfc32('0x40')]=_['merge'](_0x549ac9[_0xfc32('0x40')],{'$or':_[_0xfc32('0x2d')](_0x549ac9[_0xfc32('0x37')],function(_0x57d9da){var _0x3323f6={};_0x3323f6[_0x57d9da]={'$like':'%'+_0x47c99b[_0xfc32('0x34')][_0xfc32('0x3f')]+'%'};return _0x3323f6;})});}_0x549ac9=_[_0xfc32('0x42')]({},_0x549ac9,_0x47c99b[_0xfc32('0x43')]);return _0x217ab8[_0xfc32('0x55')](_0x549ac9);}})['then'](function(_0x2cfd19){if(_0x2cfd19){_0x108161=_0x2cfd19['length'];if(!_0x47c99b['query']['hasOwnProperty'](_0xfc32('0x57'))){_0x549ac9[_0xfc32('0x1f')]=qs['limit'](_0x47c99b[_0xfc32('0x34')][_0xfc32('0x1f')]);_0x549ac9['offset']=qs[_0xfc32('0x1d')](_0x47c99b['query'][_0xfc32('0x1d')]);}return _0x217ab8[_0xfc32('0x55')](_0x549ac9);}})[_0xfc32('0x26')](function(_0x4f30d1){if(_0x4f30d1){return _0x4f30d1?{'count':_0x108161,'rows':_0x4f30d1}:null;}})[_0xfc32('0x26')](respondWithResult(_0x2aec94,null))[_0xfc32('0x46')](handleError(_0x2aec94,null));};exports[_0xfc32('0x58')]=function(_0x5608db,_0x3bf4d8,_0x23ca0b){return db[_0xfc32('0x2e')][_0xfc32('0x56')]({'where':{'id':_0x5608db['params']['id']}})[_0xfc32('0x26')](handleEntityNotFound(_0x3bf4d8,null))['then'](function(_0x2cd4e5){if(_0x2cd4e5){return db[_0xfc32('0x59')][_0xfc32('0x5a')](function(_0x1385ec){return db[_0xfc32('0x2e')][_0xfc32('0x27')]({'where':{'IntervalId':_0x5608db[_0xfc32('0x48')]['id']},'transaction':_0x1385ec})[_0xfc32('0x26')](function(_0x482536){var _0x4dcd04=_[_0xfc32('0x2d')](_0x5608db['body'],function(_0x3ad614){delete _0x3ad614['id'];_0x3ad614[_0xfc32('0x54')]=_0x5608db['params']['id'];return _0x3ad614;});return db[_0xfc32('0x2e')]['bulkCreate'](_0x4dcd04,{'transaction':_0x1385ec});});})['then'](function(){return db['Interval'][_0xfc32('0x45')]({'where':{'IntervalId':_0x5608db[_0xfc32('0x48')]['id']}});});}})['then'](respondWithResult(_0x3bf4d8,null))['catch'](handleError(_0x3bf4d8,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 07d2f39..03d6bf1 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 _0xfdb5=['bluebird','request-promise','path','rimraf','../../config/environment','../../components/extensions/rewrite','define','Interval','rewrite','lodash','../../config/logger','api','moment'];(function(_0x3ba2a3,_0x34d0ba){var _0x2d0e38=function(_0x12ee87){while(--_0x12ee87){_0x3ba2a3['push'](_0x3ba2a3['shift']());}};_0x2d0e38(++_0x34d0ba);}(_0xfdb5,0x18f));var _0x5fdb=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0xfdb5[_0x725b8e];return _0x43ac45;};'use strict';var _=require(_0x5fdb('0x0'));var util=require('util');var logger=require(_0x5fdb('0x1'))(_0x5fdb('0x2'));var moment=require(_0x5fdb('0x3'));var BPromise=require(_0x5fdb('0x4'));var rp=require(_0x5fdb('0x5'));var fs=require('fs');var path=require(_0x5fdb('0x6'));var rimraf=require(_0x5fdb('0x7'));var config=require(_0x5fdb('0x8'));var attributes=require('./interval.attributes');var extensions=require(_0x5fdb('0x9'));module['exports']=function(_0x8195ae,_0x378c45){return _0x8195ae[_0x5fdb('0xa')](_0x5fdb('0xb'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xb82680,_0x53cef8){extensions[_0x5fdb('0xc')](_0x8195ae,_0xb82680);},'afterBulkCreate':function(_0x1cd059,_0xf41999,_0x5b3f2c){_0x5b3f2c();extensions[_0x5fdb('0xc')](_0x8195ae,_0x1cd059[0x0]);},'afterUpdate':function(_0x22af00,_0xcbaeb6){extensions['rewrite'](_0x8195ae,_0x22af00);},'afterDestroy':function(_0x553c7d,_0x223f2f){extensions[_0x5fdb('0xc')](_0x8195ae,_0x553c7d);}}});}; \ No newline at end of file +var _0xd478=['request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','rewrite','util','bluebird'];(function(_0x296123,_0x229b72){var _0x4754f2=function(_0x1dfa00){while(--_0x1dfa00){_0x296123['push'](_0x296123['shift']());}};_0x4754f2(++_0x229b72);}(_0xd478,0x196));var _0x8d47=function(_0x1b68ff,_0x5e68a2){_0x1b68ff=_0x1b68ff-0x0;var _0x4b3b07=_0xd478[_0x1b68ff];return _0x4b3b07;};'use strict';var _=require('lodash');var util=require(_0x8d47('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x8d47('0x1'));var rp=require(_0x8d47('0x2'));var fs=require('fs');var path=require(_0x8d47('0x3'));var rimraf=require(_0x8d47('0x4'));var config=require(_0x8d47('0x5'));var attributes=require(_0x8d47('0x6'));var extensions=require(_0x8d47('0x7'));module[_0x8d47('0x8')]=function(_0x97b928,_0x3c4551){return _0x97b928[_0x8d47('0x9')](_0x8d47('0xa'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x56cc9c,_0x5b764a){extensions[_0x8d47('0xb')](_0x97b928,_0x56cc9c);},'afterBulkCreate':function(_0x42454f,_0x4df6cd,_0x19d4ff){_0x19d4ff();extensions[_0x8d47('0xb')](_0x97b928,_0x42454f[0x0]);},'afterUpdate':function(_0x5d65e3,_0x1a534e){extensions[_0x8d47('0xb')](_0x97b928,_0x5d65e3);},'afterDestroy':function(_0x45fbf8,_0x11801e){extensions['rewrite'](_0x97b928,_0x45fbf8);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 105d780..506a822 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(_0x16337a,_0x4789a1){var _0x422365=function(_0x34f039){while(--_0x34f039){_0x16337a['push'](_0x16337a['shift']());}};_0x422365(++_0x4789a1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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(_0x5280f4,_0x3c36d0){var _0xba93e7=function(_0x14d63a){while(--_0x14d63a){_0x5280f4['push'](_0x5280f4['shift']());}};_0xba93e7(++_0x3c36d0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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 28c4781..e64c92a 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(_0x29d1fe,_0x336115){var _0x16ad13=function(_0x472433){while(--_0x472433){_0x29d1fe['push'](_0x29d1fe['shift']());}};_0x16ad13(++_0x336115);}(_0x2032,0xd9));var _0x2203=function(_0x4f6f46,_0xcc2755){_0x4f6f46=_0x4f6f46-0x0;var _0x31aa54=_0x2032[_0x4f6f46];return _0x31aa54;};'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 _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x473789,_0x48adfd){var _0x57a943=function(_0x54d828){while(--_0x54d828){_0x473789['push'](_0x473789['shift']());}};_0x57a943(++_0x48adfd);}(_0x2ef3,0xba));var _0x32ef=function(_0x477991,_0x50e547){_0x477991=_0x477991-0x0;var _0x323ab0=_0x2ef3[_0x477991];return _0x323ab0;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 25ac9e5..2994e5a 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 _0x9291=['setEncoding','utf8','status','statusCode','parse','error','json','api.jira','write','openIssue','send','body','headers','socket','connection','remoteAddress','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','MOTGUI','Report','\x20from\x20','description','stringify','Bug','fields','customfield_11500','email','customfield_11501','newToken','customfield_11503','name','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','toString'];(function(_0x34eda1,_0x308387){var _0x58ffa0=function(_0x5708f2){while(--_0x5708f2){_0x34eda1['push'](_0x34eda1['shift']());}};_0x58ffa0(++_0x308387);}(_0x9291,0x1f0));var _0x1929=function(_0x1bc225,_0x32985d){_0x1bc225=_0x1bc225-0x0;var _0x4e8cdd=_0x9291[_0x1bc225];return _0x4e8cdd;};'use strict';var BPromise=require(_0x1929('0x0'));var https=require(_0x1929('0x1'));var logger=require(_0x1929('0x2'))(_0x1929('0x3'));var USERNAME=_0x1929('0x4');var PASSWORD=_0x1929('0x5');function openIssue(_0x392227,_0x56b7d2){var _0x3fe3cf={'fields':{'project':{'key':_0x392227['key']||_0x1929('0x6')},'summary':(_0x392227['summary']||_0x1929('0x7'))+_0x1929('0x8')+_0x392227['ip'],'description':_0x392227[_0x1929('0x9')]||JSON[_0x1929('0xa')](_0x392227),'issuetype':{'name':_0x392227['issuetype']||_0x1929('0xb')}}};_0x3fe3cf[_0x1929('0xc')][_0x1929('0xd')]=_0x392227[_0x1929('0xe')];_0x3fe3cf['fields'][_0x1929('0xf')]=_0x392227['oldToken'];_0x3fe3cf['fields']['customfield_11502']=_0x392227[_0x1929('0x10')];_0x3fe3cf['fields'][_0x1929('0x11')]=_0x392227[_0x1929('0x12')];_0x3fe3cf['fields']['customfield_11504']=_0x392227[_0x1929('0x13')];_0x3fe3cf[_0x1929('0xc')][_0x1929('0x14')]=_0x392227['ip'];var _0x3b9512={'host':_0x1929('0x15'),'port':0x1bb,'path':_0x1929('0x16'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x1929('0x17')]('base64')}};var _0x1ee4ba=JSON['stringify'](_0x3fe3cf);var _0x217ed8=https['request'](_0x3b9512,function(_0x5977e4){_0x5977e4[_0x1929('0x18')](_0x1929('0x19'));var _0xece020='';_0x5977e4['on']('data',function(_0x592a0b){_0xece020+=_0x592a0b;});_0x5977e4['on']('end',function(){if(_0x56b7d2){return _0x56b7d2[_0x1929('0x1a')](_0x5977e4[_0x1929('0x1b')])['json'](JSON[_0x1929('0x1c')](_0xece020));}});});_0x217ed8['on'](_0x1929('0x1d'),function(_0x5bef24){if(_0x56b7d2){return _0x56b7d2[_0x1929('0x1a')](0x1f4)[_0x1929('0x1e')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x1929('0x1f')}]});}});_0x217ed8[_0x1929('0x20')](_0x1ee4ba);_0x217ed8['end']();}exports[_0x1929('0x21')]=openIssue;exports[_0x1929('0x22')]=function(_0x304c5a,_0x510952){_0x304c5a[_0x1929('0x23')]['ip']=_0x304c5a[_0x1929('0x24')]['x-forwarded-for']||_0x304c5a['connection']['remoteAddress']||_0x304c5a[_0x1929('0x25')]['remoteAddress']||_0x304c5a[_0x1929('0x26')][_0x1929('0x25')][_0x1929('0x27')];return openIssue(_0x304c5a[_0x1929('0x23')],_0x510952);}; \ No newline at end of file +var _0x717c=['setEncoding','data','status','statusCode','json','parse','error','api.jira','write','end','send','body','headers','connection','remoteAddress','socket','https','../../config/logger','api','3eAmWpBVP0','key','MOTGUI','summary','\x20from\x20','description','stringify','issuetype','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x717c,0x1e6));var _0xc717=function(_0x5a11d8,_0xc945e1){_0x5a11d8=_0x5a11d8-0x0;var _0x58c134=_0x717c[_0x5a11d8];return _0x58c134;};'use strict';var BPromise=require('bluebird');var https=require(_0xc717('0x0'));var logger=require(_0xc717('0x1'))(_0xc717('0x2'));var USERNAME='support';var PASSWORD=_0xc717('0x3');function openIssue(_0x5c6ace,_0x11f137){var _0x35efd8={'fields':{'project':{'key':_0x5c6ace[_0xc717('0x4')]||_0xc717('0x5')},'summary':(_0x5c6ace[_0xc717('0x6')]||'Report')+_0xc717('0x7')+_0x5c6ace['ip'],'description':_0x5c6ace[_0xc717('0x8')]||JSON[_0xc717('0x9')](_0x5c6ace),'issuetype':{'name':_0x5c6ace[_0xc717('0xa')]||'Bug'}}};_0x35efd8[_0xc717('0xb')][_0xc717('0xc')]=_0x5c6ace[_0xc717('0xd')];_0x35efd8[_0xc717('0xb')][_0xc717('0xe')]=_0x5c6ace[_0xc717('0xf')];_0x35efd8[_0xc717('0xb')][_0xc717('0x10')]=_0x5c6ace[_0xc717('0x11')];_0x35efd8[_0xc717('0xb')][_0xc717('0x12')]=_0x5c6ace[_0xc717('0x13')];_0x35efd8[_0xc717('0xb')][_0xc717('0x14')]=_0x5c6ace[_0xc717('0x15')];_0x35efd8[_0xc717('0xb')][_0xc717('0x16')]=_0x5c6ace['ip'];var _0x263874={'host':_0xc717('0x17'),'port':0x1bb,'path':_0xc717('0x18'),'method':_0xc717('0x19'),'timeout':0x4e20,'headers':{'Content-Type':_0xc717('0x1a'),'Authorization':_0xc717('0x1b')+new Buffer(USERNAME+':'+PASSWORD)[_0xc717('0x1c')](_0xc717('0x1d'))}};var _0x47c8ef=JSON[_0xc717('0x9')](_0x35efd8);var _0x5dafbd=https[_0xc717('0x1e')](_0x263874,function(_0xa1af78){_0xa1af78[_0xc717('0x1f')]('utf8');var _0x39e603='';_0xa1af78['on'](_0xc717('0x20'),function(_0x8ec892){_0x39e603+=_0x8ec892;});_0xa1af78['on']('end',function(){if(_0x11f137){return _0x11f137[_0xc717('0x21')](_0xa1af78[_0xc717('0x22')])[_0xc717('0x23')](JSON[_0xc717('0x24')](_0x39e603));}});});_0x5dafbd['on'](_0xc717('0x25'),function(_0x1c5637){if(_0x11f137){return _0x11f137[_0xc717('0x21')](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0xc717('0x26')}]});}});_0x5dafbd[_0xc717('0x27')](_0x47c8ef);_0x5dafbd[_0xc717('0x28')]();}exports['openIssue']=openIssue;exports[_0xc717('0x29')]=function(_0x3c5273,_0x5eac84){_0x3c5273[_0xc717('0x2a')]['ip']=_0x3c5273[_0xc717('0x2b')]['x-forwarded-for']||_0x3c5273[_0xc717('0x2c')][_0xc717('0x2d')]||_0x3c5273[_0xc717('0x2e')]['remoteAddress']||_0x3c5273[_0xc717('0x2c')][_0xc717('0x2e')][_0xc717('0x2d')];return openIssue(_0x3c5273[_0xc717('0x2a')],_0x5eac84);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 1118a33..ff28ffa 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 _0x4483=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete'];(function(_0x470b0a,_0x2889d6){var _0x4463f6=function(_0x2b5f0e){while(--_0x2b5f0e){_0x470b0a['push'](_0x470b0a['shift']());}};_0x4463f6(++_0x2889d6);}(_0x4483,0x1a3));var _0x3448=function(_0x5c7b1a,_0x4dcb4a){_0x5c7b1a=_0x5c7b1a-0x0;var _0x50a3b0=_0x4483[_0x5c7b1a];return _0x50a3b0;};'use strict';var multer=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var path=require(_0x3448('0x2'));var timeout=require('connect-timeout');var express=require(_0x3448('0x3'));var router=express[_0x3448('0x4')]();var fs_extra=require(_0x3448('0x5'));var auth=require(_0x3448('0x6'));var interaction=require(_0x3448('0x7'));var config=require('../../config/environment');var controller=require(_0x3448('0x8'));router[_0x3448('0x9')]('/',auth[_0x3448('0xa')](),controller[_0x3448('0xb')]);router[_0x3448('0x9')](_0x3448('0xc'),auth[_0x3448('0xa')](),controller[_0x3448('0xd')]);router['get']('/:id',auth[_0x3448('0xa')](),controller[_0x3448('0xe')]);router[_0x3448('0xf')]('/',auth[_0x3448('0xa')](),controller[_0x3448('0x10')]);router[_0x3448('0x11')](_0x3448('0x12'),auth[_0x3448('0xa')](),controller[_0x3448('0x13')]);router[_0x3448('0x14')](_0x3448('0x12'),auth['isAuthenticated'](),controller['destroy']);module[_0x3448('0x15')]=router; \ No newline at end of file +var _0xf3cd=['delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update'];(function(_0xf20f14,_0x522f27){var _0x496de3=function(_0x245053){while(--_0x245053){_0xf20f14['push'](_0xf20f14['shift']());}};_0x496de3(++_0x522f27);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x5a4b16,_0x294bb1){_0x5a4b16=_0x5a4b16-0x0;var _0x5236dc=_0xf3cd[_0x5a4b16];return _0x5236dc;};'use strict';var multer=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var path=require(_0xdf3c('0x2'));var timeout=require(_0xdf3c('0x3'));var express=require(_0xdf3c('0x4'));var router=express[_0xdf3c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xdf3c('0x6'));var interaction=require(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var controller=require('./jscriptyAnswerReport.controller');router[_0xdf3c('0x9')]('/',auth[_0xdf3c('0xa')](),controller[_0xdf3c('0xb')]);router[_0xdf3c('0x9')](_0xdf3c('0xc'),auth[_0xdf3c('0xa')](),controller['describe']);router[_0xdf3c('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xdf3c('0xd')]);router[_0xdf3c('0xe')]('/',auth['isAuthenticated'](),controller[_0xdf3c('0xf')]);router[_0xdf3c('0x10')](_0xdf3c('0x11'),auth[_0xdf3c('0xa')](),controller[_0xdf3c('0x12')]);router[_0xdf3c('0x13')](_0xdf3c('0x11'),auth[_0xdf3c('0xa')](),controller['destroy']);module[_0xdf3c('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index c1db25f..37a3a50 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(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x7a54,0x106));var _0x47a5=function(_0x39aa9d,_0x400290){_0x39aa9d=_0x39aa9d-0x0;var _0x5c8009=_0x7a54[_0x39aa9d];return _0x5c8009;};'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(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7a54,0x106));var _0x47a5=function(_0x3b0314,_0x2cc7da){_0x3b0314=_0x3b0314-0x0;var _0x564e06=_0x7a54[_0x3b0314];return _0x564e06;};'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 5b4c847..682806d 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 _0xe574=['hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','keys','options','find','create','body','update','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','JscriptyAnswerReport','rawAttributes','fieldName','key','model','map','query','filters','intersection','fields','attributes','length'];(function(_0x1a7912,_0x48a13d){var _0x321211=function(_0x5507b2){while(--_0x5507b2){_0x1a7912['push'](_0x1a7912['shift']());}};_0x321211(++_0x48a13d);}(_0xe574,0x100));var _0x4e57=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe574[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x4e57('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4e57('0x1'));var jsonpatch=require(_0x4e57('0x2'));var rp=require(_0x4e57('0x3'));var moment=require(_0x4e57('0x4'));var BPromise=require(_0x4e57('0x5'));var Mustache=require(_0x4e57('0x6'));var util=require(_0x4e57('0x7'));var path=require(_0x4e57('0x8'));var sox=require(_0x4e57('0x9'));var csv=require(_0x4e57('0xa'));var ejs=require(_0x4e57('0xb'));var fs=require('fs');var fs_extra=require(_0x4e57('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4e57('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4e57('0xa'));var querystring=require(_0x4e57('0xe'));var Papa=require(_0x4e57('0xf'));var Redis=require(_0x4e57('0x10'));var authService=require(_0x4e57('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4e57('0x12'));var hardwareService=require(_0x4e57('0x13'));var logger=require(_0x4e57('0x14'))(_0x4e57('0x15'));var utils=require(_0x4e57('0x16'));var config=require(_0x4e57('0x17'));var licenseUtil=require(_0x4e57('0x18'));var db=require(_0x4e57('0x19'))['db'];function respondWithStatusCode(_0xed8cbc,_0x40c8c8){_0x40c8c8=_0x40c8c8||0xcc;return function(_0x330868){if(_0x330868){return _0xed8cbc[_0x4e57('0x1a')](_0x40c8c8);}return _0xed8cbc[_0x4e57('0x1b')](_0x40c8c8)[_0x4e57('0x1c')]();};}function respondWithResult(_0x28f876,_0x2e9fa8){_0x2e9fa8=_0x2e9fa8||0xc8;return function(_0x4f088a){if(_0x4f088a){return _0x28f876[_0x4e57('0x1b')](_0x2e9fa8)['json'](_0x4f088a);}};}function respondWithFilteredResult(_0x254285,_0x4af0a6){return function(_0x3401c4){if(_0x3401c4){var _0x214957=typeof _0x4af0a6['offset']===_0x4e57('0x1d')&&typeof _0x4af0a6[_0x4e57('0x1e')]===_0x4e57('0x1d');var _0xb06d8=_0x3401c4['count'];var _0x2ed980=_0x214957?0x0:_0x4af0a6[_0x4e57('0x1f')];var _0x3c2978=_0x214957?_0x3401c4[_0x4e57('0x20')]:_0x4af0a6[_0x4e57('0x1f')]+_0x4af0a6['limit'];var _0x182286;if(_0x3c2978>=_0xb06d8){_0x3c2978=_0xb06d8;_0x182286=0xc8;}else{_0x182286=0xce;}_0x254285[_0x4e57('0x1b')](_0x182286);return _0x254285[_0x4e57('0x21')](_0x4e57('0x22'),_0x2ed980+'-'+_0x3c2978+'/'+_0xb06d8)['json'](_0x3401c4);}return null;};}function patchUpdates(_0x372295){return function(_0x59df7a){try{jsonpatch[_0x4e57('0x23')](_0x59df7a,_0x372295,!![]);}catch(_0x5b6127){return BPromise[_0x4e57('0x24')](_0x5b6127);}return _0x59df7a[_0x4e57('0x25')]();};}function saveUpdates(_0x427c6b,_0x43c9a7){return function(_0x45f9cd){if(_0x45f9cd){return _0x45f9cd['update'](_0x427c6b)['then'](function(_0x17e309){return _0x17e309;});}return null;};}function removeEntity(_0x58d6ea,_0x315f7c){return function(_0x4cfa0e){if(_0x4cfa0e){return _0x4cfa0e[_0x4e57('0x26')]()[_0x4e57('0x27')](function(){_0x58d6ea[_0x4e57('0x1b')](0xcc)[_0x4e57('0x1c')]();});}};}function handleEntityNotFound(_0x29df93,_0xc75cb3){return function(_0x4fb5db){if(!_0x4fb5db){_0x29df93[_0x4e57('0x1a')](0x194);}return _0x4fb5db;};}function handleError(_0x316988,_0x503eaa){_0x503eaa=_0x503eaa||0x1f4;return function(_0x36b415){logger[_0x4e57('0x28')](_0x36b415[_0x4e57('0x29')]);if(_0x36b415[_0x4e57('0x2a')]){delete _0x36b415[_0x4e57('0x2a')];}_0x316988[_0x4e57('0x1b')](_0x503eaa)[_0x4e57('0x2b')](_0x36b415);};}exports['index']=function(_0x1a26f6,_0x431794){var _0x1da085={},_0x197bc1={},_0x27a22f={'count':0x0,'rows':[]};var _0x5d55b9=_['map'](db[_0x4e57('0x2c')][_0x4e57('0x2d')],function(_0x3ce391){return{'name':_0x3ce391[_0x4e57('0x2e')],'type':_0x3ce391['type'][_0x4e57('0x2f')]};});_0x197bc1[_0x4e57('0x30')]=_[_0x4e57('0x31')](_0x5d55b9,_0x4e57('0x2a'));_0x197bc1[_0x4e57('0x32')]=_['keys'](_0x1a26f6[_0x4e57('0x32')]);_0x197bc1[_0x4e57('0x33')]=_['intersection'](_0x197bc1[_0x4e57('0x30')],_0x197bc1['query']);_0x1da085['attributes']=_[_0x4e57('0x34')](_0x197bc1[_0x4e57('0x30')],qs[_0x4e57('0x35')](_0x1a26f6['query'][_0x4e57('0x35')]));_0x1da085['attributes']=_0x1da085[_0x4e57('0x36')][_0x4e57('0x37')]?_0x1da085[_0x4e57('0x36')]:_0x197bc1['model'];if(!_0x1a26f6[_0x4e57('0x32')][_0x4e57('0x38')](_0x4e57('0x39'))){_0x1da085[_0x4e57('0x1e')]=qs[_0x4e57('0x1e')](_0x1a26f6[_0x4e57('0x32')][_0x4e57('0x1e')]);_0x1da085[_0x4e57('0x1f')]=qs[_0x4e57('0x1f')](_0x1a26f6[_0x4e57('0x32')][_0x4e57('0x1f')]);}_0x1da085['order']=qs[_0x4e57('0x3a')](_0x1a26f6['query'][_0x4e57('0x3a')]);_0x1da085[_0x4e57('0x3b')]=qs[_0x4e57('0x33')](_[_0x4e57('0x3c')](_0x1a26f6['query'],_0x197bc1['filters']),_0x5d55b9);if(_0x1a26f6[_0x4e57('0x32')][_0x4e57('0x3d')]){_0x1da085[_0x4e57('0x3b')]=_[_0x4e57('0x3e')](_0x1da085[_0x4e57('0x3b')],{'$or':_[_0x4e57('0x31')](_0x5d55b9,function(_0x1ab62){if(_0x1ab62[_0x4e57('0x3f')]!==_0x4e57('0x40')){var _0x4ac448={};_0x4ac448[_0x1ab62[_0x4e57('0x2a')]]={'$like':'%'+_0x1a26f6['query'][_0x4e57('0x3d')]+'%'};return _0x4ac448;}})});}_0x1da085=_[_0x4e57('0x3e')]({},_0x1da085,_0x1a26f6['options']);var _0x1ff9e7={'where':_0x1da085[_0x4e57('0x3b')]};return db[_0x4e57('0x2c')][_0x4e57('0x20')](_0x1ff9e7)[_0x4e57('0x27')](function(_0x386d3a){_0x27a22f[_0x4e57('0x20')]=_0x386d3a;if(_0x1a26f6['query'][_0x4e57('0x41')]){_0x1da085[_0x4e57('0x42')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x4e57('0x43')](_0x1da085);})[_0x4e57('0x27')](function(_0x2ef995){_0x27a22f[_0x4e57('0x44')]=_0x2ef995;return _0x27a22f;})[_0x4e57('0x27')](respondWithFilteredResult(_0x431794,_0x1da085))[_0x4e57('0x45')](handleError(_0x431794,null));};exports['show']=function(_0x2e5e62,_0x3fd1b0){var _0x271551={'raw':!![],'where':{'id':_0x2e5e62[_0x4e57('0x46')]['id']}},_0x330da6={};_0x330da6[_0x4e57('0x30')]=_[_0x4e57('0x47')](db['JscriptyAnswerReport'][_0x4e57('0x2d')]);_0x330da6[_0x4e57('0x32')]=_[_0x4e57('0x47')](_0x2e5e62[_0x4e57('0x32')]);_0x330da6[_0x4e57('0x33')]=_['intersection'](_0x330da6[_0x4e57('0x30')],_0x330da6[_0x4e57('0x32')]);_0x271551[_0x4e57('0x36')]=_[_0x4e57('0x34')](_0x330da6[_0x4e57('0x30')],qs[_0x4e57('0x35')](_0x2e5e62[_0x4e57('0x32')][_0x4e57('0x35')]));_0x271551[_0x4e57('0x36')]=_0x271551[_0x4e57('0x36')]['length']?_0x271551['attributes']:_0x330da6['model'];if(_0x2e5e62[_0x4e57('0x32')][_0x4e57('0x41')]){_0x271551[_0x4e57('0x42')]=[{'all':!![]}];}_0x271551=_[_0x4e57('0x3e')]({},_0x271551,_0x2e5e62[_0x4e57('0x48')]);return db[_0x4e57('0x2c')][_0x4e57('0x49')](_0x271551)[_0x4e57('0x27')](handleEntityNotFound(_0x3fd1b0,null))[_0x4e57('0x27')](respondWithResult(_0x3fd1b0,null))[_0x4e57('0x45')](handleError(_0x3fd1b0,null));};exports[_0x4e57('0x4a')]=function(_0xe5c591,_0x423986){return db['JscriptyAnswerReport'][_0x4e57('0x4a')](_0xe5c591[_0x4e57('0x4b')],{})[_0x4e57('0x27')](respondWithResult(_0x423986,0xc9))[_0x4e57('0x45')](handleError(_0x423986,null));};exports[_0x4e57('0x4c')]=function(_0x41d476,_0x48869d){if(_0x41d476[_0x4e57('0x4b')]['id']){delete _0x41d476[_0x4e57('0x4b')]['id'];}return db[_0x4e57('0x2c')][_0x4e57('0x49')]({'where':{'id':_0x41d476[_0x4e57('0x46')]['id']}})[_0x4e57('0x27')](handleEntityNotFound(_0x48869d,null))[_0x4e57('0x27')](saveUpdates(_0x41d476[_0x4e57('0x4b')],null))['then'](respondWithResult(_0x48869d,null))[_0x4e57('0x45')](handleError(_0x48869d,null));};exports['destroy']=function(_0x3deb47,_0x328c2c){return db[_0x4e57('0x2c')]['find']({'where':{'id':_0x3deb47[_0x4e57('0x46')]['id']}})['then'](handleEntityNotFound(_0x328c2c,null))[_0x4e57('0x27')](removeEntity(_0x328c2c,null))[_0x4e57('0x45')](handleError(_0x328c2c,null));};exports[_0x4e57('0x4d')]=function(_0x139891,_0x12e2df){return db[_0x4e57('0x2c')][_0x4e57('0x4d')]()['then'](respondWithResult(_0x12e2df,null))['catch'](handleError(_0x12e2df,null));}; \ No newline at end of file +var _0xa6bb=['nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','findAll','rows','catch','params','keys','include','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','Content-Range','apply','reject','update','then','error','stack','name','index','JscriptyAnswerReport','type','model','map','query','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x412e27,_0x20a978){var _0x53da42=function(_0x43cae5){while(--_0x43cae5){_0x412e27['push'](_0x412e27['shift']());}};_0x53da42(++_0x20a978);}(_0xa6bb,0x12c));var _0xba6b=function(_0x2114a4,_0x415fb9){_0x2114a4=_0x2114a4-0x0;var _0x2c159f=_0xa6bb[_0x2114a4];return _0x2c159f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xba6b('0x0'));var zipdir=require(_0xba6b('0x1'));var jsonpatch=require(_0xba6b('0x2'));var rp=require(_0xba6b('0x3'));var moment=require(_0xba6b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xba6b('0x5'));var path=require(_0xba6b('0x6'));var sox=require(_0xba6b('0x7'));var csv=require(_0xba6b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xba6b('0x9'));var squel=require(_0xba6b('0xa'));var crypto=require(_0xba6b('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xba6b('0x8'));var querystring=require(_0xba6b('0xc'));var Papa=require(_0xba6b('0xd'));var Redis=require(_0xba6b('0xe'));var authService=require(_0xba6b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xba6b('0x10'));var hardwareService=require(_0xba6b('0x11'));var logger=require(_0xba6b('0x12'))('api');var utils=require(_0xba6b('0x13'));var config=require(_0xba6b('0x14'));var licenseUtil=require(_0xba6b('0x15'));var db=require(_0xba6b('0x16'))['db'];function respondWithStatusCode(_0x55b6ab,_0x1e8473){_0x1e8473=_0x1e8473||0xcc;return function(_0x5b1d28){if(_0x5b1d28){return _0x55b6ab[_0xba6b('0x17')](_0x1e8473);}return _0x55b6ab[_0xba6b('0x18')](_0x1e8473)[_0xba6b('0x19')]();};}function respondWithResult(_0x15d4e2,_0x32144e){_0x32144e=_0x32144e||0xc8;return function(_0x53ec00){if(_0x53ec00){return _0x15d4e2[_0xba6b('0x18')](_0x32144e)[_0xba6b('0x1a')](_0x53ec00);}};}function respondWithFilteredResult(_0x50b58a,_0x16c3d0){return function(_0x1d280e){if(_0x1d280e){var _0x52b2ff=typeof _0x16c3d0['offset']===_0xba6b('0x1b')&&typeof _0x16c3d0['limit']==='undefined';var _0x5a553c=_0x1d280e['count'];var _0x4be059=_0x52b2ff?0x0:_0x16c3d0[_0xba6b('0x1c')];var _0x34aa97=_0x52b2ff?_0x1d280e[_0xba6b('0x1d')]:_0x16c3d0[_0xba6b('0x1c')]+_0x16c3d0[_0xba6b('0x1e')];var _0x15d1d2;if(_0x34aa97>=_0x5a553c){_0x34aa97=_0x5a553c;_0x15d1d2=0xc8;}else{_0x15d1d2=0xce;}_0x50b58a[_0xba6b('0x18')](_0x15d1d2);return _0x50b58a['set'](_0xba6b('0x1f'),_0x4be059+'-'+_0x34aa97+'/'+_0x5a553c)['json'](_0x1d280e);}return null;};}function patchUpdates(_0x54a392){return function(_0x13beca){try{jsonpatch[_0xba6b('0x20')](_0x13beca,_0x54a392,!![]);}catch(_0x3905ae){return BPromise[_0xba6b('0x21')](_0x3905ae);}return _0x13beca['save']();};}function saveUpdates(_0xa632cb,_0x436623){return function(_0x548c1b){if(_0x548c1b){return _0x548c1b[_0xba6b('0x22')](_0xa632cb)[_0xba6b('0x23')](function(_0x82b68f){return _0x82b68f;});}return null;};}function removeEntity(_0x12e4e6,_0x426641){return function(_0x5c2845){if(_0x5c2845){return _0x5c2845['destroy']()['then'](function(){_0x12e4e6['status'](0xcc)[_0xba6b('0x19')]();});}};}function handleEntityNotFound(_0x2525f8,_0x2f5343){return function(_0x39f052){if(!_0x39f052){_0x2525f8[_0xba6b('0x17')](0x194);}return _0x39f052;};}function handleError(_0x32375c,_0x591102){_0x591102=_0x591102||0x1f4;return function(_0x876e58){logger[_0xba6b('0x24')](_0x876e58[_0xba6b('0x25')]);if(_0x876e58['name']){delete _0x876e58[_0xba6b('0x26')];}_0x32375c[_0xba6b('0x18')](_0x591102)['send'](_0x876e58);};}exports[_0xba6b('0x27')]=function(_0x25d5e6,_0xea9fbc){var _0x41a0e0={},_0x506f14={},_0x506447={'count':0x0,'rows':[]};var _0x18a4c1=_['map'](db[_0xba6b('0x28')]['rawAttributes'],function(_0x1a6b93){return{'name':_0x1a6b93['fieldName'],'type':_0x1a6b93[_0xba6b('0x29')]['key']};});_0x506f14[_0xba6b('0x2a')]=_[_0xba6b('0x2b')](_0x18a4c1,_0xba6b('0x26'));_0x506f14[_0xba6b('0x2c')]=_['keys'](_0x25d5e6[_0xba6b('0x2c')]);_0x506f14['filters']=_['intersection'](_0x506f14[_0xba6b('0x2a')],_0x506f14[_0xba6b('0x2c')]);_0x41a0e0['attributes']=_[_0xba6b('0x2d')](_0x506f14['model'],qs['fields'](_0x25d5e6[_0xba6b('0x2c')][_0xba6b('0x2e')]));_0x41a0e0[_0xba6b('0x2f')]=_0x41a0e0[_0xba6b('0x2f')][_0xba6b('0x30')]?_0x41a0e0['attributes']:_0x506f14[_0xba6b('0x2a')];if(!_0x25d5e6[_0xba6b('0x2c')][_0xba6b('0x31')](_0xba6b('0x32'))){_0x41a0e0[_0xba6b('0x1e')]=qs[_0xba6b('0x1e')](_0x25d5e6[_0xba6b('0x2c')][_0xba6b('0x1e')]);_0x41a0e0[_0xba6b('0x1c')]=qs['offset'](_0x25d5e6[_0xba6b('0x2c')][_0xba6b('0x1c')]);}_0x41a0e0[_0xba6b('0x33')]=qs[_0xba6b('0x34')](_0x25d5e6['query']['sort']);_0x41a0e0[_0xba6b('0x35')]=qs[_0xba6b('0x36')](_[_0xba6b('0x37')](_0x25d5e6[_0xba6b('0x2c')],_0x506f14['filters']),_0x18a4c1);if(_0x25d5e6[_0xba6b('0x2c')][_0xba6b('0x38')]){_0x41a0e0['where']=_[_0xba6b('0x39')](_0x41a0e0['where'],{'$or':_[_0xba6b('0x2b')](_0x18a4c1,function(_0x36df21){if(_0x36df21[_0xba6b('0x29')]!=='VIRTUAL'){var _0x26c479={};_0x26c479[_0x36df21[_0xba6b('0x26')]]={'$like':'%'+_0x25d5e6['query'][_0xba6b('0x38')]+'%'};return _0x26c479;}})});}_0x41a0e0=_['merge']({},_0x41a0e0,_0x25d5e6[_0xba6b('0x3a')]);var _0x5cc07e={'where':_0x41a0e0[_0xba6b('0x35')]};return db['JscriptyAnswerReport'][_0xba6b('0x1d')](_0x5cc07e)['then'](function(_0x37dcb6){_0x506447[_0xba6b('0x1d')]=_0x37dcb6;if(_0x25d5e6[_0xba6b('0x2c')][_0xba6b('0x3b')]){_0x41a0e0['include']=[{'all':!![]}];}return db[_0xba6b('0x28')][_0xba6b('0x3c')](_0x41a0e0);})[_0xba6b('0x23')](function(_0x31fe5a){_0x506447[_0xba6b('0x3d')]=_0x31fe5a;return _0x506447;})['then'](respondWithFilteredResult(_0xea9fbc,_0x41a0e0))[_0xba6b('0x3e')](handleError(_0xea9fbc,null));};exports['show']=function(_0x1f229b,_0x7cb298){var _0x5b710a={'raw':!![],'where':{'id':_0x1f229b[_0xba6b('0x3f')]['id']}},_0x57e9b5={};_0x57e9b5[_0xba6b('0x2a')]=_[_0xba6b('0x40')](db[_0xba6b('0x28')]['rawAttributes']);_0x57e9b5[_0xba6b('0x2c')]=_[_0xba6b('0x40')](_0x1f229b[_0xba6b('0x2c')]);_0x57e9b5[_0xba6b('0x36')]=_['intersection'](_0x57e9b5[_0xba6b('0x2a')],_0x57e9b5[_0xba6b('0x2c')]);_0x5b710a[_0xba6b('0x2f')]=_[_0xba6b('0x2d')](_0x57e9b5[_0xba6b('0x2a')],qs[_0xba6b('0x2e')](_0x1f229b['query'][_0xba6b('0x2e')]));_0x5b710a[_0xba6b('0x2f')]=_0x5b710a[_0xba6b('0x2f')]['length']?_0x5b710a[_0xba6b('0x2f')]:_0x57e9b5[_0xba6b('0x2a')];if(_0x1f229b[_0xba6b('0x2c')][_0xba6b('0x3b')]){_0x5b710a[_0xba6b('0x41')]=[{'all':!![]}];}_0x5b710a=_[_0xba6b('0x39')]({},_0x5b710a,_0x1f229b[_0xba6b('0x3a')]);return db[_0xba6b('0x28')]['find'](_0x5b710a)[_0xba6b('0x23')](handleEntityNotFound(_0x7cb298,null))[_0xba6b('0x23')](respondWithResult(_0x7cb298,null))[_0xba6b('0x3e')](handleError(_0x7cb298,null));};exports['create']=function(_0x2d231e,_0x37172b){return db[_0xba6b('0x28')][_0xba6b('0x42')](_0x2d231e[_0xba6b('0x43')],{})[_0xba6b('0x23')](respondWithResult(_0x37172b,0xc9))[_0xba6b('0x3e')](handleError(_0x37172b,null));};exports[_0xba6b('0x22')]=function(_0x2dea62,_0x5035b3){if(_0x2dea62[_0xba6b('0x43')]['id']){delete _0x2dea62[_0xba6b('0x43')]['id'];}return db[_0xba6b('0x28')][_0xba6b('0x44')]({'where':{'id':_0x2dea62[_0xba6b('0x3f')]['id']}})[_0xba6b('0x23')](handleEntityNotFound(_0x5035b3,null))[_0xba6b('0x23')](saveUpdates(_0x2dea62[_0xba6b('0x43')],null))[_0xba6b('0x23')](respondWithResult(_0x5035b3,null))[_0xba6b('0x3e')](handleError(_0x5035b3,null));};exports['destroy']=function(_0x40c0ea,_0x36d3db){return db['JscriptyAnswerReport'][_0xba6b('0x44')]({'where':{'id':_0x40c0ea[_0xba6b('0x3f')]['id']}})[_0xba6b('0x23')](handleEntityNotFound(_0x36d3db,null))['then'](removeEntity(_0x36d3db,null))[_0xba6b('0x3e')](handleError(_0x36d3db,null));};exports[_0xba6b('0x45')]=function(_0x2a44de,_0x586255){return db[_0xba6b('0x28')]['describe']()['then'](respondWithResult(_0x586255,null))['catch'](handleError(_0x586255,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index dc2cd8d..6b766e9 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 _0x5567=['define','report_jscripty_answers','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x55481b,_0x4097df){var _0x50c3b9=function(_0x52644f){while(--_0x52644f){_0x55481b['push'](_0x55481b['shift']());}};_0x50c3b9(++_0x4097df);}(_0x5567,0x66));var _0x7556=function(_0x43c1a4,_0x2af0f9){_0x43c1a4=_0x43c1a4-0x0;var _0x2e2cef=_0x5567[_0x43c1a4];return _0x2e2cef;};'use strict';var _=require(_0x7556('0x0'));var util=require(_0x7556('0x1'));var logger=require(_0x7556('0x2'))(_0x7556('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7556('0x4'));var fs=require('fs');var path=require(_0x7556('0x5'));var rimraf=require(_0x7556('0x6'));var config=require(_0x7556('0x7'));var attributes=require('./jscriptyAnswerReport.attributes');module['exports']=function(_0x47674b,_0x4d7e87){return _0x47674b[_0x7556('0x8')]('JscriptyAnswerReport',attributes,{'tableName':_0x7556('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcfa6=['JscriptyAnswerReport','report_jscripty_answers','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x43576f,_0x1356ed){var _0x4d2466=function(_0x865deb){while(--_0x865deb){_0x43576f['push'](_0x43576f['shift']());}};_0x4d2466(++_0x1356ed);}(_0xcfa6,0xdf));var _0x6cfa=function(_0x560ed4,_0x42e65c){_0x560ed4=_0x560ed4-0x0;var _0x12ad88=_0xcfa6[_0x560ed4];return _0x12ad88;};'use strict';var _=require(_0x6cfa('0x0'));var util=require('util');var logger=require(_0x6cfa('0x1'))(_0x6cfa('0x2'));var moment=require(_0x6cfa('0x3'));var BPromise=require(_0x6cfa('0x4'));var rp=require(_0x6cfa('0x5'));var fs=require('fs');var path=require(_0x6cfa('0x6'));var rimraf=require(_0x6cfa('0x7'));var config=require(_0x6cfa('0x8'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x6cfa('0x9')]=function(_0x24c3d,_0xf2b828){return _0x24c3d[_0x6cfa('0xa')](_0x6cfa('0xb'),attributes,{'tableName':_0x6cfa('0xc'),'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 1a1b206..df5f6b2 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 _0x38d0=['info','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','then'];(function(_0xe65ac8,_0x2691be){var _0x202ba1=function(_0x4af6ff){while(--_0x4af6ff){_0xe65ac8['push'](_0xe65ac8['shift']());}};_0x202ba1(++_0x2691be);}(_0x38d0,0x1ee));var _0x038d=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x38d0[_0x3b0731];return _0x4204d7;};'use strict';var _=require(_0x038d('0x0'));var util=require(_0x038d('0x1'));var moment=require(_0x038d('0x2'));var BPromise=require(_0x038d('0x3'));var rs=require(_0x038d('0x4'));var fs=require('fs');var Redis=require(_0x038d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x038d('0x6'));var logger=require(_0x038d('0x7'))('rpc');var config=require(_0x038d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x038d('0x9')][_0x038d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2887bd,_0x3c1b16,_0xa76b33){return new BPromise(function(_0x3d69b8,_0x50da04){return client['request'](_0x2887bd,_0xa76b33)[_0x038d('0xb')](function(_0x36776b){logger[_0x038d('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x3c1b16,_0x038d('0xd'));logger[_0x038d('0xe')](_0x038d('0xf'),_0x3c1b16,_0x038d('0xd'),JSON[_0x038d('0x10')](_0x36776b));if(_0x36776b['error']){if(_0x36776b[_0x038d('0x11')][_0x038d('0x12')]===0x1f4){logger[_0x038d('0x11')](_0x038d('0x13'),_0x3c1b16,_0x36776b[_0x038d('0x11')][_0x038d('0x14')]);return _0x50da04(_0x36776b[_0x038d('0x11')]['message']);}logger[_0x038d('0x11')](_0x038d('0x13'),_0x3c1b16,_0x36776b[_0x038d('0x11')][_0x038d('0x14')]);return _0x3d69b8(_0x36776b[_0x038d('0x11')]['message']);}else{logger[_0x038d('0xc')](_0x038d('0x13'),_0x3c1b16,_0x038d('0xd'));_0x3d69b8(_0x36776b[_0x038d('0x15')][_0x038d('0x14')]);}})[_0x038d('0x16')](function(_0x3a1a51){logger[_0x038d('0x11')](_0x038d('0x13'),_0x3c1b16,_0x3a1a51);_0x50da04(_0x3a1a51);});});} \ No newline at end of file +var _0x85da=['ioredis','../../config/utils','../../config/logger','client','http','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring'];(function(_0x241cd6,_0x5d5a73){var _0x2fbcf2=function(_0x54d12e){while(--_0x54d12e){_0x241cd6['push'](_0x241cd6['shift']());}};_0x2fbcf2(++_0x5d5a73);}(_0x85da,0xd4));var _0xa85d=function(_0x14d896,_0x53578b){_0x14d896=_0x14d896-0x0;var _0x28679a=_0x85da[_0x14d896];return _0x28679a;};'use strict';var _=require(_0xa85d('0x0'));var util=require('util');var moment=require(_0xa85d('0x1'));var BPromise=require(_0xa85d('0x2'));var rs=require(_0xa85d('0x3'));var fs=require('fs');var Redis=require(_0xa85d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa85d('0x5'));var logger=require(_0xa85d('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa85d('0x7')][_0xa85d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2986e4,_0x4a7369,_0x1811d4){return new BPromise(function(_0x1afbbf,_0x20cdb2){return client['request'](_0x2986e4,_0x1811d4)[_0xa85d('0x9')](function(_0x3c777c){logger[_0xa85d('0xa')](_0xa85d('0xb'),_0x4a7369,_0xa85d('0xc'));logger['debug']('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x4a7369,_0xa85d('0xc'),JSON[_0xa85d('0xd')](_0x3c777c));if(_0x3c777c[_0xa85d('0xe')]){if(_0x3c777c[_0xa85d('0xe')][_0xa85d('0xf')]===0x1f4){logger[_0xa85d('0xe')](_0xa85d('0xb'),_0x4a7369,_0x3c777c[_0xa85d('0xe')][_0xa85d('0x10')]);return _0x20cdb2(_0x3c777c[_0xa85d('0xe')][_0xa85d('0x10')]);}logger[_0xa85d('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4a7369,_0x3c777c[_0xa85d('0xe')][_0xa85d('0x10')]);return _0x1afbbf(_0x3c777c[_0xa85d('0xe')][_0xa85d('0x10')]);}else{logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x4a7369,_0xa85d('0xc'));_0x1afbbf(_0x3c777c['result']['message']);}})[_0xa85d('0x11')](function(_0x5e2040){logger[_0xa85d('0xe')](_0xa85d('0xb'),_0x4a7369,_0x5e2040);_0x20cdb2(_0x5e2040);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index ecb2530..6cd7148 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 _0x4da0=['exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','/:id/sessions','getSessions','/:id/answers','getAnswers','30s','getSummary','post','create','/:id/clone','clone','put','delete','destroy'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x4da0,0x1d5));var _0x04da=function(_0x2cabd5,_0x31dbd){_0x2cabd5=_0x2cabd5-0x0;var _0x4c02d7=_0x4da0[_0x2cabd5];return _0x4c02d7;};'use strict';var multer=require('multer');var util=require(_0x04da('0x0'));var path=require(_0x04da('0x1'));var timeout=require(_0x04da('0x2'));var express=require(_0x04da('0x3'));var router=express['Router']();var fs_extra=require(_0x04da('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x04da('0x5'));var config=require(_0x04da('0x6'));var controller=require(_0x04da('0x7'));router[_0x04da('0x8')]('/',auth[_0x04da('0x9')](),controller[_0x04da('0xa')]);router[_0x04da('0x8')](_0x04da('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x04da('0x8')](_0x04da('0xc'),auth['isAuthenticated'](),controller[_0x04da('0xd')]);router[_0x04da('0x8')](_0x04da('0xe'),auth[_0x04da('0x9')](),controller[_0x04da('0xf')]);router['get']('/:id/summary',auth['isAuthenticated'](),timeout(_0x04da('0x10')),controller[_0x04da('0x11')]);router[_0x04da('0x12')]('/',auth[_0x04da('0x9')](),controller[_0x04da('0x13')]);router[_0x04da('0x12')](_0x04da('0x14'),auth[_0x04da('0x9')](),controller[_0x04da('0x15')]);router[_0x04da('0x16')](_0x04da('0xb'),auth[_0x04da('0x9')](),controller['update']);router[_0x04da('0x17')](_0x04da('0xb'),auth['isAuthenticated'](),controller[_0x04da('0x18')]);module[_0x04da('0x19')]=router; \ No newline at end of file +var _0xa5ba=['put','update','delete','destroy','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','/:id/sessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','clone'];(function(_0x28b705,_0x2e9cfd){var _0x26b0e2=function(_0x20d1ef){while(--_0x20d1ef){_0x28b705['push'](_0x28b705['shift']());}};_0x26b0e2(++_0x2e9cfd);}(_0xa5ba,0x10c));var _0xaa5b=function(_0x527076,_0x176405){_0x527076=_0x527076-0x0;var _0x2403c9=_0xa5ba[_0x527076];return _0x2403c9;};'use strict';var multer=require('multer');var util=require(_0xaa5b('0x0'));var path=require(_0xaa5b('0x1'));var timeout=require(_0xaa5b('0x2'));var express=require('express');var router=express[_0xaa5b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xaa5b('0x4'));var interaction=require(_0xaa5b('0x5'));var config=require(_0xaa5b('0x6'));var controller=require(_0xaa5b('0x7'));router[_0xaa5b('0x8')]('/',auth[_0xaa5b('0x9')](),controller[_0xaa5b('0xa')]);router[_0xaa5b('0x8')](_0xaa5b('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xaa5b('0x8')](_0xaa5b('0xc'),auth[_0xaa5b('0x9')](),controller['getSessions']);router[_0xaa5b('0x8')](_0xaa5b('0xd'),auth[_0xaa5b('0x9')](),controller[_0xaa5b('0xe')]);router[_0xaa5b('0x8')](_0xaa5b('0xf'),auth[_0xaa5b('0x9')](),timeout(_0xaa5b('0x10')),controller[_0xaa5b('0x11')]);router[_0xaa5b('0x12')]('/',auth[_0xaa5b('0x9')](),controller['create']);router[_0xaa5b('0x12')]('/:id/clone',auth[_0xaa5b('0x9')](),controller[_0xaa5b('0x13')]);router[_0xaa5b('0x14')](_0xaa5b('0xb'),auth[_0xaa5b('0x9')](),controller[_0xaa5b('0x15')]);router[_0xaa5b('0x16')](_0xaa5b('0xb'),auth['isAuthenticated'](),controller[_0xaa5b('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index ddaf6c8..f21de2d 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 _0x7f0b=['util','exports','STRING','name','TEXT','long','isObjectLike','stringify','isString','formData','setDataValue','format','getDataValue','description','BOOLEAN','sequelize','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7f0b,0xdb));var _0xb7f0=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x7f0b[_0x4c12ec];return _0x3ae42c;};'use strict';var Sequelize=require(_0xb7f0('0x0'));var _=require(_0xb7f0('0x1'));var util=require(_0xb7f0('0x2'));module[_0xb7f0('0x3')]={'name':{'type':Sequelize[_0xb7f0('0x4')],'unique':_0xb7f0('0x5')},'description':{'type':Sequelize[_0xb7f0('0x4')]},'formData':{'type':Sequelize[_0xb7f0('0x6')](_0xb7f0('0x7')),'set':function(_0x51cce1){if(_[_0xb7f0('0x8')](_0x51cce1)){this['setDataValue']('formData',JSON[_0xb7f0('0x9')](_0x51cce1));}else if(_[_0xb7f0('0xa')](_0x51cce1)){this['setDataValue'](_0xb7f0('0xb'),_0x51cce1);}else{this[_0xb7f0('0xc')](_0xb7f0('0xb'),util[_0xb7f0('0xd')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0xb7f0('0xe')](_0xb7f0('0x5'))||'',this[_0xb7f0('0xe')](_0xb7f0('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xb7f0('0x10')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xb7f0('0x10')],'defaultValue':![]}}; \ No newline at end of file +var _0x69c0=['setDataValue','formData','isString','format','getDataValue','description','BOOLEAN','sequelize','util','exports','STRING','name','TEXT','long'];(function(_0x442c77,_0x364010){var _0x2ddc1c=function(_0x2d998e){while(--_0x2d998e){_0x442c77['push'](_0x442c77['shift']());}};_0x2ddc1c(++_0x364010);}(_0x69c0,0x1d5));var _0x069c=function(_0x44b346,_0xeb097d){_0x44b346=_0x44b346-0x0;var _0x1c2f2b=_0x69c0[_0x44b346];return _0x1c2f2b;};'use strict';var Sequelize=require(_0x069c('0x0'));var _=require('lodash');var util=require(_0x069c('0x1'));module[_0x069c('0x2')]={'name':{'type':Sequelize[_0x069c('0x3')],'unique':_0x069c('0x4')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x069c('0x5')](_0x069c('0x6')),'set':function(_0x39f6cc){if(_['isObjectLike'](_0x39f6cc)){this[_0x069c('0x7')](_0x069c('0x8'),JSON['stringify'](_0x39f6cc));}else if(_[_0x069c('0x9')](_0x39f6cc)){this[_0x069c('0x7')](_0x069c('0x8'),_0x39f6cc);}else{this['setDataValue'](_0x069c('0x8'),util[_0x069c('0xa')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this['getDataValue'](_0x069c('0x4'))||'',this[_0x069c('0xb')](_0x069c('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x069c('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x069c('0xd')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 2ca8c00..ba8ea85 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 _0xea5b=['bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Projects','end','error','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','include','findAll','rows','show','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','createdAt','role','getSessions','findOne','JscriptySessionReport','order','getAnswers','JscriptyAnswerReport','ProjectId','toString','indexOf','startTime','parse','-createdAt','questionId','question','starttime','format','SessionId','answer','push','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','download','eml-format','rimraf','zip-dir','moment'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xea5b,0x152));var _0xbea5=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xea5b[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0xbea5('0x0'));var rimraf=require(_0xbea5('0x1'));var zipdir=require(_0xbea5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbea5('0x3'));var BPromise=require(_0xbea5('0x4'));var Mustache=require(_0xbea5('0x5'));var util=require(_0xbea5('0x6'));var path=require('path');var sox=require(_0xbea5('0x7'));var csv=require('to-csv');var ejs=require(_0xbea5('0x8'));var fs=require('fs');var fs_extra=require(_0xbea5('0x9'));var _=require(_0xbea5('0xa'));var squel=require(_0xbea5('0xb'));var crypto=require(_0xbea5('0xc'));var jsforce=require(_0xbea5('0xd'));var deskjs=require(_0xbea5('0xe'));var toCsv=require(_0xbea5('0xf'));var querystring=require(_0xbea5('0x10'));var Papa=require(_0xbea5('0x11'));var Redis=require(_0xbea5('0x12'));var authService=require(_0xbea5('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbea5('0x14'));var logger=require(_0xbea5('0x15'))(_0xbea5('0x16'));var utils=require('../../config/utils');var config=require(_0xbea5('0x17'));var licenseUtil=require(_0xbea5('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2eb9c0,_0xa02bd){_0xa02bd=_0xa02bd||0xcc;return function(_0x1026ab){if(_0x1026ab){return _0x2eb9c0[_0xbea5('0x19')](_0xa02bd);}return _0x2eb9c0['status'](_0xa02bd)['end']();};}function respondWithResult(_0x33fb68,_0x491f82){_0x491f82=_0x491f82||0xc8;return function(_0x5d4b86){if(_0x5d4b86){return _0x33fb68[_0xbea5('0x1a')](_0x491f82)[_0xbea5('0x1b')](_0x5d4b86);}};}function respondWithFilteredResult(_0x54a04d,_0x3a453b){return function(_0x3cc4a3){if(_0x3cc4a3){var _0x3889fa=typeof _0x3a453b[_0xbea5('0x1c')]===_0xbea5('0x1d')&&typeof _0x3a453b[_0xbea5('0x1e')]==='undefined';var _0x9f7a0c=_0x3cc4a3[_0xbea5('0x1f')];var _0x3d8c76=_0x3889fa?0x0:_0x3a453b['offset'];var _0xb0b015=_0x3889fa?_0x3cc4a3[_0xbea5('0x1f')]:_0x3a453b[_0xbea5('0x1c')]+_0x3a453b[_0xbea5('0x1e')];var _0x2955cd;if(_0xb0b015>=_0x9f7a0c){_0xb0b015=_0x9f7a0c;_0x2955cd=0xc8;}else{_0x2955cd=0xce;}_0x54a04d['status'](_0x2955cd);return _0x54a04d[_0xbea5('0x20')](_0xbea5('0x21'),_0x3d8c76+'-'+_0xb0b015+'/'+_0x9f7a0c)['json'](_0x3cc4a3);}return null;};}function patchUpdates(_0x122e07){return function(_0xf38123){try{jsonpatch[_0xbea5('0x22')](_0xf38123,_0x122e07,!![]);}catch(_0x3f09cb){return BPromise[_0xbea5('0x23')](_0x3f09cb);}return _0xf38123[_0xbea5('0x24')]();};}function saveUpdates(_0x33a68e,_0x89e334){return function(_0x59a3db){if(_0x59a3db){return _0x59a3db[_0xbea5('0x25')](_0x33a68e)[_0xbea5('0x26')](function(_0x45ab10){return _0x45ab10;});}return null;};}function removeEntity(_0xec4d42,_0x44bf41){return function(_0x6fb47f){if(_0x6fb47f){return _0x6fb47f[_0xbea5('0x27')]()[_0xbea5('0x26')](function(){var _0x185ed3=_0x6fb47f[_0xbea5('0x28')]({'plain':!![]});var _0x24a5b8=_0xbea5('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x24a5b8,'resourceId':_0x185ed3['id']}})[_0xbea5('0x26')](function(){return _0x6fb47f;});})[_0xbea5('0x26')](function(){_0xec4d42[_0xbea5('0x1a')](0xcc)[_0xbea5('0x2a')]();});}};}function handleEntityNotFound(_0x1020b9,_0x2cad52){return function(_0x4476eb){if(!_0x4476eb){_0x1020b9[_0xbea5('0x19')](0x194);}return _0x4476eb;};}function handleError(_0x211bde,_0x120110){_0x120110=_0x120110||0x1f4;return function(_0x1f1918){logger[_0xbea5('0x2b')](_0x1f1918['stack']);if(_0x1f1918[_0xbea5('0x2c')]){delete _0x1f1918[_0xbea5('0x2c')];}_0x211bde[_0xbea5('0x1a')](_0x120110)[_0xbea5('0x2d')](_0x1f1918);};}exports[_0xbea5('0x2e')]=function(_0x21aeb3,_0x314dca){var _0x259559={},_0x2e138b={},_0x28c1={'count':0x0,'rows':[]};var _0x306af8=_[_0xbea5('0x2f')](db[_0xbea5('0x30')][_0xbea5('0x31')],function(_0x592f65){return{'name':_0x592f65[_0xbea5('0x32')],'type':_0x592f65[_0xbea5('0x33')]['key']};});_0x2e138b[_0xbea5('0x34')]=_['map'](_0x306af8,_0xbea5('0x2c'));_0x2e138b[_0xbea5('0x35')]=_[_0xbea5('0x36')](_0x21aeb3[_0xbea5('0x35')]);_0x2e138b['filters']=_[_0xbea5('0x37')](_0x2e138b[_0xbea5('0x34')],_0x2e138b['query']);_0x259559[_0xbea5('0x38')]=_['intersection'](_0x2e138b[_0xbea5('0x34')],qs[_0xbea5('0x39')](_0x21aeb3[_0xbea5('0x35')][_0xbea5('0x39')]));_0x259559[_0xbea5('0x38')]=_0x259559[_0xbea5('0x38')][_0xbea5('0x3a')]?_0x259559[_0xbea5('0x38')]:_0x2e138b[_0xbea5('0x34')];if(!_0x21aeb3[_0xbea5('0x35')][_0xbea5('0x3b')](_0xbea5('0x3c'))){_0x259559[_0xbea5('0x1e')]=qs[_0xbea5('0x1e')](_0x21aeb3[_0xbea5('0x35')][_0xbea5('0x1e')]);_0x259559[_0xbea5('0x1c')]=qs[_0xbea5('0x1c')](_0x21aeb3[_0xbea5('0x35')][_0xbea5('0x1c')]);}_0x259559['order']=qs['sort'](_0x21aeb3['query'][_0xbea5('0x3d')]);_0x259559[_0xbea5('0x3e')]=qs[_0xbea5('0x3f')](_[_0xbea5('0x40')](_0x21aeb3[_0xbea5('0x35')],_0x2e138b[_0xbea5('0x3f')]),_0x306af8);if(_0x21aeb3['query'][_0xbea5('0x41')]){_0x259559['where']=_[_0xbea5('0x42')](_0x259559[_0xbea5('0x3e')],{'$or':_[_0xbea5('0x2f')](_0x306af8,function(_0x2c0efe){if(_0x2c0efe[_0xbea5('0x33')]!=='VIRTUAL'){var _0x11a3c2={};_0x11a3c2[_0x2c0efe['name']]={'$like':'%'+_0x21aeb3[_0xbea5('0x35')]['filter']+'%'};return _0x11a3c2;}})});}_0x259559=_['merge']({},_0x259559,_0x21aeb3['options']);var _0x3c0d06={'where':_0x259559[_0xbea5('0x3e')]};return db[_0xbea5('0x30')][_0xbea5('0x1f')](_0x3c0d06)[_0xbea5('0x26')](function(_0x4e85a5){_0x28c1[_0xbea5('0x1f')]=_0x4e85a5;if(_0x21aeb3[_0xbea5('0x35')]['includeAll']){_0x259559[_0xbea5('0x43')]=[{'all':!![]}];}return db[_0xbea5('0x30')][_0xbea5('0x44')](_0x259559);})['then'](function(_0x3ac392){_0x28c1[_0xbea5('0x45')]=_0x3ac392;return _0x28c1;})[_0xbea5('0x26')](respondWithFilteredResult(_0x314dca,_0x259559))['catch'](handleError(_0x314dca,null));};exports[_0xbea5('0x46')]=function(_0x5dfe08,_0x49da27){var _0x21f60c={'raw':![],'where':{'id':_0x5dfe08[_0xbea5('0x47')]['id']}},_0x105870={};_0x105870['model']=_['keys'](db[_0xbea5('0x30')][_0xbea5('0x31')]);_0x105870['query']=_[_0xbea5('0x36')](_0x5dfe08[_0xbea5('0x35')]);_0x105870[_0xbea5('0x3f')]=_['intersection'](_0x105870[_0xbea5('0x34')],_0x105870[_0xbea5('0x35')]);_0x21f60c[_0xbea5('0x38')]=_[_0xbea5('0x37')](_0x105870[_0xbea5('0x34')],qs[_0xbea5('0x39')](_0x5dfe08[_0xbea5('0x35')][_0xbea5('0x39')]));_0x21f60c[_0xbea5('0x38')]=_0x21f60c[_0xbea5('0x38')][_0xbea5('0x3a')]?_0x21f60c['attributes']:_0x105870['model'];if(_0x5dfe08[_0xbea5('0x35')][_0xbea5('0x48')]){_0x21f60c[_0xbea5('0x43')]=[{'all':!![]}];}_0x21f60c=_['merge']({},_0x21f60c,_0x5dfe08[_0xbea5('0x49')]);return db[_0xbea5('0x30')][_0xbea5('0x4a')](_0x21f60c)[_0xbea5('0x26')](handleEntityNotFound(_0x49da27,null))[_0xbea5('0x26')](respondWithResult(_0x49da27,null))['catch'](handleError(_0x49da27,null));};exports[_0xbea5('0x4b')]=function(_0x27002d,_0x37f725){return db['JscriptyProject'][_0xbea5('0x4b')](_0x27002d[_0xbea5('0x4c')],{})[_0xbea5('0x26')](function(_0x2e39bf){var _0x4e3b75=_0x27002d[_0xbea5('0x4d')][_0xbea5('0x28')]({'plain':!![]});if(!_0x4e3b75)throw new Error(_0xbea5('0x4e'));if(_0x4e3b75['role']===_0xbea5('0x4d')){var _0x446a63=_0x2e39bf[_0xbea5('0x28')]({'plain':!![]});var _0x2f650a='Projects';return db[_0xbea5('0x4f')][_0xbea5('0x4a')]({'where':{'name':_0x2f650a,'userProfileId':_0x4e3b75[_0xbea5('0x50')]},'raw':!![]})[_0xbea5('0x26')](function(_0x4cbdd4){if(_0x4cbdd4&&_0x4cbdd4[_0xbea5('0x51')]===0x0){return db[_0xbea5('0x52')][_0xbea5('0x4b')]({'name':_0x446a63[_0xbea5('0x2c')],'resourceId':_0x446a63['id'],'type':_0x4cbdd4[_0xbea5('0x2c')],'sectionId':_0x4cbdd4['id']},{})['then'](function(){return _0x2e39bf;});}else{return _0x2e39bf;}})[_0xbea5('0x53')](function(_0x5ef7a7){logger['error'](_0xbea5('0x54'),_0x5ef7a7);throw _0x5ef7a7;});}return _0x2e39bf;})[_0xbea5('0x26')](respondWithResult(_0x37f725,0xc9))[_0xbea5('0x53')](handleError(_0x37f725,null));};exports['clone']=function(_0x3b2cc1,_0x465808){var _0x575a60={'where':{'id':_0x3b2cc1[_0xbea5('0x47')]['id']}},_0x227f1c={};_0x227f1c['model']=_[_0xbea5('0x36')](db[_0xbea5('0x30')][_0xbea5('0x31')]);_0x575a60[_0xbea5('0x38')]=_[_0xbea5('0x37')](_0x227f1c['model'],qs[_0xbea5('0x39')](_0x3b2cc1[_0xbea5('0x35')][_0xbea5('0x39')]));_0x575a60[_0xbea5('0x38')]=_0x575a60['attributes']['length']?_0x575a60['attributes']:_0x227f1c[_0xbea5('0x34')];if(_0x3b2cc1['query']['includeAll']){_0x575a60['include']=[{'all':!![]}];}_0x575a60=_[_0xbea5('0x42')]({},_0x575a60,_0x3b2cc1[_0xbea5('0x49')]);return db[_0xbea5('0x30')][_0xbea5('0x4a')](_0x575a60)[_0xbea5('0x26')](handleEntityNotFound(_0x465808,null))['then'](function(_0x5805cc){if(_0x5805cc){var _0x4e23d7=_0x5805cc[_0xbea5('0x28')]({'plain':!![]});_0x4e23d7=qs[_0xbea5('0x55')](_0x4e23d7,['id','createdAt',_0xbea5('0x56')]);_0x3b2cc1[_0xbea5('0x4c')]=_[_0xbea5('0x55')](_0x3b2cc1[_0xbea5('0x4c')],['id',_0xbea5('0x57'),_0xbea5('0x56')]);return db[_0xbea5('0x30')][_0xbea5('0x4b')](_[_0xbea5('0x42')](_0x4e23d7,_0x3b2cc1[_0xbea5('0x4c')]),{'include':_0x3b2cc1[_0xbea5('0x35')][_0xbea5('0x48')]?[{'all':!![]}]:undefined})[_0xbea5('0x26')](function(_0x578ad2){var _0x5413ef=_0x3b2cc1[_0xbea5('0x4d')][_0xbea5('0x28')]({'plain':!![]});if(!_0x5413ef)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5413ef[_0xbea5('0x58')]==='user'){var _0x5868ad=_0x578ad2['get']({'plain':!![]});var _0x44ec36=_0xbea5('0x29');return db['UserProfileSection']['find']({'where':{'name':_0x44ec36,'userProfileId':_0x5413ef[_0xbea5('0x50')]},'raw':!![]})[_0xbea5('0x26')](function(_0x4b5e84){if(_0x4b5e84&&_0x4b5e84[_0xbea5('0x51')]===0x0){return db[_0xbea5('0x52')][_0xbea5('0x4b')]({'name':_0x5868ad[_0xbea5('0x2c')],'resourceId':_0x5868ad['id'],'type':_0x4b5e84[_0xbea5('0x2c')],'sectionId':_0x4b5e84['id']},{})[_0xbea5('0x26')](function(){return _0x578ad2;});}else{return _0x578ad2;}})[_0xbea5('0x53')](function(_0x1fde75){logger[_0xbea5('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1fde75);throw _0x1fde75;});}return _0x578ad2;});}})[_0xbea5('0x26')](respondWithResult(_0x465808,0xc9))['catch'](handleError(_0x465808,null));};exports['update']=function(_0x4d9440,_0x10e78c){if(_0x4d9440[_0xbea5('0x4c')]['id']){delete _0x4d9440[_0xbea5('0x4c')]['id'];}return db[_0xbea5('0x30')][_0xbea5('0x4a')]({'where':{'id':_0x4d9440[_0xbea5('0x47')]['id']}})[_0xbea5('0x26')](handleEntityNotFound(_0x10e78c,null))[_0xbea5('0x26')](saveUpdates(_0x4d9440[_0xbea5('0x4c')],null))[_0xbea5('0x26')](respondWithResult(_0x10e78c,null))[_0xbea5('0x53')](handleError(_0x10e78c,null));};exports[_0xbea5('0x27')]=function(_0x30379b,_0x3e7b8d){return db[_0xbea5('0x30')][_0xbea5('0x4a')]({'where':{'id':_0x30379b[_0xbea5('0x47')]['id']}})[_0xbea5('0x26')](handleEntityNotFound(_0x3e7b8d,null))[_0xbea5('0x26')](removeEntity(_0x3e7b8d,null))['catch'](handleError(_0x3e7b8d,null));};exports[_0xbea5('0x59')]=function(_0x37912f,_0x1c9d74,_0x509280){var _0x4d182f={'raw':!![],'where':{}};var _0xb706a2={};var _0x57d772={'count':0x0,'rows':[]};return db[_0xbea5('0x30')][_0xbea5('0x5a')]({'where':{'id':_0x37912f[_0xbea5('0x47')]['id']}})[_0xbea5('0x26')](handleEntityNotFound(_0x1c9d74,null))[_0xbea5('0x26')](function(_0xdb85c4){if(_0xdb85c4){_0xb706a2['model']=_[_0xbea5('0x36')](db[_0xbea5('0x5b')][_0xbea5('0x31')]);_0xb706a2['query']=_[_0xbea5('0x36')](_0x37912f['query']);_0xb706a2[_0xbea5('0x3f')]=_['intersection'](_0xb706a2[_0xbea5('0x34')],_0xb706a2['query']);_0x4d182f[_0xbea5('0x38')]=_[_0xbea5('0x37')](_0xb706a2[_0xbea5('0x34')],qs[_0xbea5('0x39')](_0x37912f[_0xbea5('0x35')][_0xbea5('0x39')]));_0x4d182f[_0xbea5('0x38')]=_0x4d182f[_0xbea5('0x38')][_0xbea5('0x3a')]?_0x4d182f[_0xbea5('0x38')]:_0xb706a2['model'];if(!_0x37912f[_0xbea5('0x35')][_0xbea5('0x3b')](_0xbea5('0x3c'))){_0x4d182f[_0xbea5('0x1e')]=qs[_0xbea5('0x1e')](_0x37912f[_0xbea5('0x35')][_0xbea5('0x1e')]);_0x4d182f[_0xbea5('0x1c')]=qs['offset'](_0x37912f[_0xbea5('0x35')][_0xbea5('0x1c')]);}_0x4d182f[_0xbea5('0x5c')]=qs[_0xbea5('0x3d')](_0x37912f['query'][_0xbea5('0x3d')]);_0x4d182f[_0xbea5('0x3e')]=qs[_0xbea5('0x3f')](_['pick'](_0x37912f['query'],_0xb706a2[_0xbea5('0x3f')]));_0x4d182f[_0xbea5('0x3e')]['ProjectId']=_0xdb85c4['id'];if(_0x37912f[_0xbea5('0x35')][_0xbea5('0x41')]){_0x4d182f[_0xbea5('0x3e')]=_['merge'](_0x4d182f[_0xbea5('0x3e')],{'$or':_[_0xbea5('0x2f')](_0x4d182f['attributes'],function(_0x215816){var _0xdaa8eb={};_0xdaa8eb[_0x215816]={'$like':'%'+_0x37912f[_0xbea5('0x35')][_0xbea5('0x41')]+'%'};return _0xdaa8eb;})});}_0x4d182f=_[_0xbea5('0x42')]({},_0x4d182f,_0x37912f[_0xbea5('0x49')]);return db[_0xbea5('0x5b')][_0xbea5('0x1f')]({'where':_0x4d182f[_0xbea5('0x3e')]})['then'](function(_0x4fb2d9){_0x57d772[_0xbea5('0x1f')]=_0x4fb2d9;if(_0x37912f[_0xbea5('0x35')][_0xbea5('0x48')]){_0x4d182f[_0xbea5('0x43')]=[{'all':!![]}];}return db[_0xbea5('0x5b')][_0xbea5('0x44')](_0x4d182f);})[_0xbea5('0x26')](function(_0x33adaa){_0x57d772[_0xbea5('0x45')]=_0x33adaa;return _0x57d772;});}})['then'](respondWithFilteredResult(_0x1c9d74,_0x4d182f))['catch'](handleError(_0x1c9d74,null));};exports[_0xbea5('0x5d')]=function(_0x2cc671,_0x34b8ff,_0x1a91e2){var _0x261615={'raw':!![],'where':{}};var _0x24968a={};var _0x4a5588={'count':0x0,'rows':[]};return db[_0xbea5('0x30')]['findOne']({'where':{'id':_0x2cc671[_0xbea5('0x47')]['id']}})[_0xbea5('0x26')](handleEntityNotFound(_0x34b8ff,null))[_0xbea5('0x26')](function(_0x51a354){if(_0x51a354){_0x24968a['model']=_[_0xbea5('0x36')](db[_0xbea5('0x5e')]['rawAttributes']);_0x24968a['query']=_[_0xbea5('0x36')](_0x2cc671['query']);_0x24968a['filters']=_[_0xbea5('0x37')](_0x24968a[_0xbea5('0x34')],_0x24968a['query']);_0x261615[_0xbea5('0x38')]=_[_0xbea5('0x37')](_0x24968a[_0xbea5('0x34')],qs[_0xbea5('0x39')](_0x2cc671[_0xbea5('0x35')]['fields']));_0x261615[_0xbea5('0x38')]=_0x261615[_0xbea5('0x38')][_0xbea5('0x3a')]?_0x261615[_0xbea5('0x38')]:_0x24968a['model'];if(!_0x2cc671['query'][_0xbea5('0x3b')](_0xbea5('0x3c'))){_0x261615[_0xbea5('0x1e')]=qs[_0xbea5('0x1e')](_0x2cc671[_0xbea5('0x35')][_0xbea5('0x1e')]);_0x261615['offset']=qs[_0xbea5('0x1c')](_0x2cc671[_0xbea5('0x35')][_0xbea5('0x1c')]);}_0x261615[_0xbea5('0x5c')]=qs['sort'](_0x2cc671[_0xbea5('0x35')][_0xbea5('0x3d')]);_0x261615['where']=qs[_0xbea5('0x3f')](_[_0xbea5('0x40')](_0x2cc671[_0xbea5('0x35')],_0x24968a[_0xbea5('0x3f')]));_0x261615[_0xbea5('0x3e')][_0xbea5('0x5f')]=_0x51a354['id'];if(_0x2cc671[_0xbea5('0x35')][_0xbea5('0x41')]){_0x261615[_0xbea5('0x3e')]=_['merge'](_0x261615[_0xbea5('0x3e')],{'$or':_[_0xbea5('0x2f')](_0x261615[_0xbea5('0x38')],function(_0x2eec4d){var _0x4e4b1f={};_0x4e4b1f[_0x2eec4d]={'$like':'%'+_0x2cc671['query'][_0xbea5('0x41')]+'%'};return _0x4e4b1f;})});}_0x261615=_[_0xbea5('0x42')]({},_0x261615,_0x2cc671[_0xbea5('0x49')]);return db['JscriptyAnswerReport'][_0xbea5('0x1f')]({'where':_0x261615[_0xbea5('0x3e')]})['then'](function(_0x58f75b){_0x4a5588[_0xbea5('0x1f')]=_0x58f75b;if(_0x2cc671[_0xbea5('0x35')][_0xbea5('0x48')]){_0x261615['include']=[{'all':!![]}];}return db[_0xbea5('0x5e')]['findAll'](_0x261615);})[_0xbea5('0x26')](function(_0x358b74){_0x4a5588['rows']=_0x358b74;return _0x4a5588;});}})[_0xbea5('0x26')](respondWithFilteredResult(_0x34b8ff,_0x261615))['catch'](handleError(_0x34b8ff,null));};function char(_0x18c929){return'number'===typeof _0x18c929?String['fromCharCode'][_0xbea5('0x22')](null,arguments):_0x18c929;}function needsEncapsulation(_0x542a7a){return!!_0x542a7a&&(_0x542a7a[_0xbea5('0x60')]()[_0xbea5('0x61')](char(0xd))>=0x0||_0x542a7a['toString']()[_0xbea5('0x61')](char(0xa))>=0x0||_0x542a7a[_0xbea5('0x60')]()[_0xbea5('0x61')](char(0x2c))>=0x0||_0x542a7a[_0xbea5('0x60')]()[_0xbea5('0x61')](char(0x22))>=0x0);}function encapsulate(_0x2ee560){var _0x46406e=char(0x22),_0x4fa3bf='\x5c'+char(0x22),_0xf490b=_0x2ee560[_0xbea5('0x60')]()['replace'](new RegExp(_0x46406e,'g'),_0x4fa3bf);return _0x46406e+_0xf490b+_0x46406e;}exports['getSummary']=function(_0x47385a,_0x4245d8,_0x3bd2b8){var _0x42436d,_0x243651;var _0x44de8d={'where':{'ProjectId':_0x47385a['params']['id']}};if(_0x47385a['query'][_0xbea5('0x62')]){_0x44de8d[_0xbea5('0x3e')]['starttime']=JSON[_0xbea5('0x63')](_0x47385a[_0xbea5('0x35')][_0xbea5('0x62')]);}return db[_0xbea5('0x5b')][_0xbea5('0x44')](_0x44de8d)[_0xbea5('0x26')](handleEntityNotFound(_0x4245d8,null))['then'](function(_0x3215){if(_0x3215){_0x42436d=_0x3215;return db['JscriptyQuestionReport'][_0xbea5('0x44')]({'where':{'SessionId':{'$in':_[_0xbea5('0x2f')](_0x42436d,'id')},'ProjectId':_0x47385a['params']['id']},'order':_0xbea5('0x64')});}})[_0xbea5('0x26')](handleEntityNotFound(_0x4245d8,null))[_0xbea5('0x26')](function(_0x2dec81){if(_0x2dec81){_0x243651=_0x2dec81;var _0x33c1a3={};for(var _0x3c2828=0x0,_0x45cbaa=_0x243651[_0xbea5('0x3a')];_0x3c2828<_0x45cbaa;_0x3c2828++){if(!_0x33c1a3[_0xbea5('0x3b')](_0x243651[_0x3c2828][_0xbea5('0x65')])){_0x33c1a3[_0x243651[_0x3c2828][_0xbea5('0x65')]]=needsEncapsulation(_0x243651[_0x3c2828][_0xbea5('0x66')])?encapsulate(_0x243651[_0x3c2828][_0xbea5('0x66')]):_0x243651[_0x3c2828][_0xbea5('0x66')];}}var _0x4dc6fb=[],_0x8a1d55={};for(var _0x3c1cdc=0x0,_0x2164ee=_0x42436d[_0xbea5('0x3a')];_0x3c1cdc<_0x2164ee;_0x3c1cdc++){_0x8a1d55={'ProjectId':_0x47385a[_0xbea5('0x47')]['id'],'SessionId':_0x42436d[_0x3c1cdc]['id'],'StartTime':moment(_0x42436d[_0x3c1cdc][_0xbea5('0x67')])[_0xbea5('0x68')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x48b20d=0x0,_0x22fff1=_0x243651[_0xbea5('0x3a')];_0x48b20d<_0x22fff1;_0x48b20d++){if(_0x243651[_0x48b20d][_0xbea5('0x69')]==_0x42436d[_0x3c1cdc]['id']&&_0x33c1a3[_0xbea5('0x3b')](_0x243651[_0x48b20d][_0xbea5('0x65')])){_0x8a1d55[_0x33c1a3[_0x243651[_0x48b20d][_0xbea5('0x65')]]]=_0x243651[_0x48b20d][_0xbea5('0x6a')];}}for(var _0xe94f4c in _0x33c1a3){if(!_0x8a1d55[_0xbea5('0x3b')](_0x33c1a3[_0xe94f4c])){_0x8a1d55[_0x33c1a3[_0xe94f4c]]=null;}}_0x4dc6fb[_0xbea5('0x6b')](_0x8a1d55);}return _0x4dc6fb;}})[_0xbea5('0x26')](function(_0x57e28c){if(!_['isEmpty'](_0x57e28c)){var _0x48a6cc=toCsv(_0x57e28c);var _0x2bc5ee=Date['now']();fs['writeFileSync'](util[_0xbea5('0x68')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x47385a[_0xbea5('0x47')]['id'],_0x2bc5ee),_0x48a6cc);_0x4245d8['setHeader'](_0xbea5('0x6c'),_0xbea5('0x6d')+util[_0xbea5('0x68')](_0xbea5('0x6e'),_0x47385a[_0xbea5('0x47')]['id'],_0x2bc5ee));_0x4245d8[_0xbea5('0x6f')](_0xbea5('0x70'),'text/csv');return _0x4245d8[_0xbea5('0x71')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x47385a['params']['id'],_0x2bc5ee));}else{return _0x4245d8[_0xbea5('0x19')](0xcc);}})[_0xbea5('0x53')](handleError(_0x4245d8,null));}; \ No newline at end of file +var _0x237d=['fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','get','Projects','UserProfileResource','error','stack','name','send','map','JscriptyProject','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','body','autoAssociation','getSessions','findOne','JscriptySessionReport','findAll','JscriptyAnswerReport','ProjectId','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','answer','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','setHeader','download','eml-format','rimraf','zip-dir'];(function(_0x2edf08,_0xcf9435){var _0x16f273=function(_0x12b339){while(--_0x12b339){_0x2edf08['push'](_0x2edf08['shift']());}};_0x16f273(++_0xcf9435);}(_0x237d,0x1d9));var _0xd237=function(_0x56fe80,_0x57535b){_0x56fe80=_0x56fe80-0x0;var _0x36714a=_0x237d[_0x56fe80];return _0x36714a;};'use strict';var emlformat=require(_0xd237('0x0'));var rimraf=require(_0xd237('0x1'));var zipdir=require(_0xd237('0x2'));var jsonpatch=require(_0xd237('0x3'));var rp=require('request-promise');var moment=require(_0xd237('0x4'));var BPromise=require(_0xd237('0x5'));var Mustache=require(_0xd237('0x6'));var util=require(_0xd237('0x7'));var path=require(_0xd237('0x8'));var sox=require(_0xd237('0x9'));var csv=require('to-csv');var ejs=require(_0xd237('0xa'));var fs=require('fs');var fs_extra=require(_0xd237('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd237('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd237('0xd'));var querystring=require(_0xd237('0xe'));var Papa=require('papaparse');var Redis=require(_0xd237('0xf'));var authService=require(_0xd237('0x10'));var qs=require(_0xd237('0x11'));var as=require(_0xd237('0x12'));var hardwareService=require(_0xd237('0x13'));var logger=require(_0xd237('0x14'))(_0xd237('0x15'));var utils=require(_0xd237('0x16'));var config=require(_0xd237('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd237('0x18'))['db'];function respondWithStatusCode(_0x241635,_0x23bb35){_0x23bb35=_0x23bb35||0xcc;return function(_0x2a694c){if(_0x2a694c){return _0x241635['sendStatus'](_0x23bb35);}return _0x241635[_0xd237('0x19')](_0x23bb35)[_0xd237('0x1a')]();};}function respondWithResult(_0x280aa2,_0x32c5fe){_0x32c5fe=_0x32c5fe||0xc8;return function(_0x176b4c){if(_0x176b4c){return _0x280aa2[_0xd237('0x19')](_0x32c5fe)[_0xd237('0x1b')](_0x176b4c);}};}function respondWithFilteredResult(_0x1d8eb2,_0x2b606f){return function(_0x219017){if(_0x219017){var _0x408719=typeof _0x2b606f[_0xd237('0x1c')]===_0xd237('0x1d')&&typeof _0x2b606f['limit']===_0xd237('0x1d');var _0x29c5a0=_0x219017[_0xd237('0x1e')];var _0x38ff01=_0x408719?0x0:_0x2b606f[_0xd237('0x1c')];var _0x44f847=_0x408719?_0x219017[_0xd237('0x1e')]:_0x2b606f[_0xd237('0x1c')]+_0x2b606f['limit'];var _0x38ac7a;if(_0x44f847>=_0x29c5a0){_0x44f847=_0x29c5a0;_0x38ac7a=0xc8;}else{_0x38ac7a=0xce;}_0x1d8eb2[_0xd237('0x19')](_0x38ac7a);return _0x1d8eb2[_0xd237('0x1f')](_0xd237('0x20'),_0x38ff01+'-'+_0x44f847+'/'+_0x29c5a0)[_0xd237('0x1b')](_0x219017);}return null;};}function patchUpdates(_0x19bfb8){return function(_0x65942){try{jsonpatch[_0xd237('0x21')](_0x65942,_0x19bfb8,!![]);}catch(_0x44fbae){return BPromise[_0xd237('0x22')](_0x44fbae);}return _0x65942[_0xd237('0x23')]();};}function saveUpdates(_0xdb4f3f,_0x10d937){return function(_0x343ea1){if(_0x343ea1){return _0x343ea1[_0xd237('0x24')](_0xdb4f3f)['then'](function(_0x13cbda){return _0x13cbda;});}return null;};}function removeEntity(_0x58167a,_0x1b4730){return function(_0x187459){if(_0x187459){return _0x187459[_0xd237('0x25')]()[_0xd237('0x26')](function(){var _0x502ba1=_0x187459[_0xd237('0x27')]({'plain':!![]});var _0x592ef7=_0xd237('0x28');return db[_0xd237('0x29')]['destroy']({'where':{'type':_0x592ef7,'resourceId':_0x502ba1['id']}})[_0xd237('0x26')](function(){return _0x187459;});})[_0xd237('0x26')](function(){_0x58167a['status'](0xcc)[_0xd237('0x1a')]();});}};}function handleEntityNotFound(_0x9f826e,_0x574a23){return function(_0x3190e8){if(!_0x3190e8){_0x9f826e['sendStatus'](0x194);}return _0x3190e8;};}function handleError(_0x4cc361,_0x59133d){_0x59133d=_0x59133d||0x1f4;return function(_0x376d32){logger[_0xd237('0x2a')](_0x376d32[_0xd237('0x2b')]);if(_0x376d32[_0xd237('0x2c')]){delete _0x376d32['name'];}_0x4cc361[_0xd237('0x19')](_0x59133d)[_0xd237('0x2d')](_0x376d32);};}exports['index']=function(_0x126beb,_0x301b7c){var _0x198a9e={},_0x167d57={},_0x3630a7={'count':0x0,'rows':[]};var _0x5e6a63=_[_0xd237('0x2e')](db[_0xd237('0x2f')][_0xd237('0x30')],function(_0x2e3c70){return{'name':_0x2e3c70[_0xd237('0x31')],'type':_0x2e3c70[_0xd237('0x32')]['key']};});_0x167d57[_0xd237('0x33')]=_['map'](_0x5e6a63,_0xd237('0x2c'));_0x167d57['query']=_[_0xd237('0x34')](_0x126beb[_0xd237('0x35')]);_0x167d57[_0xd237('0x36')]=_['intersection'](_0x167d57['model'],_0x167d57['query']);_0x198a9e[_0xd237('0x37')]=_[_0xd237('0x38')](_0x167d57[_0xd237('0x33')],qs['fields'](_0x126beb['query'][_0xd237('0x39')]));_0x198a9e[_0xd237('0x37')]=_0x198a9e[_0xd237('0x37')][_0xd237('0x3a')]?_0x198a9e[_0xd237('0x37')]:_0x167d57[_0xd237('0x33')];if(!_0x126beb[_0xd237('0x35')][_0xd237('0x3b')](_0xd237('0x3c'))){_0x198a9e[_0xd237('0x3d')]=qs['limit'](_0x126beb[_0xd237('0x35')][_0xd237('0x3d')]);_0x198a9e['offset']=qs[_0xd237('0x1c')](_0x126beb[_0xd237('0x35')][_0xd237('0x1c')]);}_0x198a9e[_0xd237('0x3e')]=qs[_0xd237('0x3f')](_0x126beb[_0xd237('0x35')][_0xd237('0x3f')]);_0x198a9e['where']=qs['filters'](_[_0xd237('0x40')](_0x126beb[_0xd237('0x35')],_0x167d57['filters']),_0x5e6a63);if(_0x126beb[_0xd237('0x35')][_0xd237('0x41')]){_0x198a9e[_0xd237('0x42')]=_[_0xd237('0x43')](_0x198a9e['where'],{'$or':_['map'](_0x5e6a63,function(_0x432878){if(_0x432878[_0xd237('0x32')]!==_0xd237('0x44')){var _0x15cbfa={};_0x15cbfa[_0x432878[_0xd237('0x2c')]]={'$like':'%'+_0x126beb[_0xd237('0x35')]['filter']+'%'};return _0x15cbfa;}})});}_0x198a9e=_[_0xd237('0x43')]({},_0x198a9e,_0x126beb['options']);var _0x414622={'where':_0x198a9e[_0xd237('0x42')]};return db[_0xd237('0x2f')][_0xd237('0x1e')](_0x414622)[_0xd237('0x26')](function(_0x3420dc){_0x3630a7[_0xd237('0x1e')]=_0x3420dc;if(_0x126beb[_0xd237('0x35')][_0xd237('0x45')]){_0x198a9e[_0xd237('0x46')]=[{'all':!![]}];}return db['JscriptyProject']['findAll'](_0x198a9e);})[_0xd237('0x26')](function(_0x22c579){_0x3630a7[_0xd237('0x47')]=_0x22c579;return _0x3630a7;})[_0xd237('0x26')](respondWithFilteredResult(_0x301b7c,_0x198a9e))[_0xd237('0x48')](handleError(_0x301b7c,null));};exports[_0xd237('0x49')]=function(_0x7e8f21,_0xe12ae6){var _0x4a885e={'raw':![],'where':{'id':_0x7e8f21[_0xd237('0x4a')]['id']}},_0x68717b={};_0x68717b[_0xd237('0x33')]=_[_0xd237('0x34')](db['JscriptyProject'][_0xd237('0x30')]);_0x68717b[_0xd237('0x35')]=_['keys'](_0x7e8f21[_0xd237('0x35')]);_0x68717b['filters']=_[_0xd237('0x38')](_0x68717b['model'],_0x68717b['query']);_0x4a885e[_0xd237('0x37')]=_[_0xd237('0x38')](_0x68717b['model'],qs[_0xd237('0x39')](_0x7e8f21[_0xd237('0x35')][_0xd237('0x39')]));_0x4a885e[_0xd237('0x37')]=_0x4a885e['attributes'][_0xd237('0x3a')]?_0x4a885e['attributes']:_0x68717b[_0xd237('0x33')];if(_0x7e8f21[_0xd237('0x35')][_0xd237('0x45')]){_0x4a885e['include']=[{'all':!![]}];}_0x4a885e=_[_0xd237('0x43')]({},_0x4a885e,_0x7e8f21[_0xd237('0x4b')]);return db[_0xd237('0x2f')]['find'](_0x4a885e)['then'](handleEntityNotFound(_0xe12ae6,null))[_0xd237('0x26')](respondWithResult(_0xe12ae6,null))[_0xd237('0x48')](handleError(_0xe12ae6,null));};exports[_0xd237('0x4c')]=function(_0x3d8040,_0x348e06){return db[_0xd237('0x2f')]['create'](_0x3d8040['body'],{})[_0xd237('0x26')](function(_0xdfa3b3){var _0xe92e67=_0x3d8040[_0xd237('0x4d')]['get']({'plain':!![]});if(!_0xe92e67)throw new Error(_0xd237('0x4e'));if(_0xe92e67[_0xd237('0x4f')]==='user'){var _0x16ea49=_0xdfa3b3[_0xd237('0x27')]({'plain':!![]});var _0x84028e=_0xd237('0x28');return db[_0xd237('0x50')][_0xd237('0x51')]({'where':{'name':_0x84028e,'userProfileId':_0xe92e67[_0xd237('0x52')]},'raw':!![]})[_0xd237('0x26')](function(_0x581e5d){if(_0x581e5d&&_0x581e5d['autoAssociation']===0x0){return db['UserProfileResource'][_0xd237('0x4c')]({'name':_0x16ea49[_0xd237('0x2c')],'resourceId':_0x16ea49['id'],'type':_0x581e5d['name'],'sectionId':_0x581e5d['id']},{})['then'](function(){return _0xdfa3b3;});}else{return _0xdfa3b3;}})['catch'](function(_0x22d89d){logger[_0xd237('0x2a')](_0xd237('0x53'),_0x22d89d);throw _0x22d89d;});}return _0xdfa3b3;})[_0xd237('0x26')](respondWithResult(_0x348e06,0xc9))['catch'](handleError(_0x348e06,null));};exports[_0xd237('0x54')]=function(_0x172365,_0x4314de){var _0xd7d910={'where':{'id':_0x172365['params']['id']}},_0xd39172={};_0xd39172[_0xd237('0x33')]=_[_0xd237('0x34')](db[_0xd237('0x2f')][_0xd237('0x30')]);_0xd7d910[_0xd237('0x37')]=_[_0xd237('0x38')](_0xd39172[_0xd237('0x33')],qs[_0xd237('0x39')](_0x172365['query'][_0xd237('0x39')]));_0xd7d910[_0xd237('0x37')]=_0xd7d910[_0xd237('0x37')][_0xd237('0x3a')]?_0xd7d910[_0xd237('0x37')]:_0xd39172[_0xd237('0x33')];if(_0x172365[_0xd237('0x35')]['includeAll']){_0xd7d910[_0xd237('0x46')]=[{'all':!![]}];}_0xd7d910=_['merge']({},_0xd7d910,_0x172365['options']);return db['JscriptyProject'][_0xd237('0x51')](_0xd7d910)['then'](handleEntityNotFound(_0x4314de,null))[_0xd237('0x26')](function(_0x5977f7){if(_0x5977f7){var _0x50752b=_0x5977f7['get']({'plain':!![]});_0x50752b=qs[_0xd237('0x55')](_0x50752b,['id','createdAt',_0xd237('0x56')]);_0x172365[_0xd237('0x57')]=_[_0xd237('0x55')](_0x172365['body'],['id','createdAt',_0xd237('0x56')]);return db[_0xd237('0x2f')][_0xd237('0x4c')](_[_0xd237('0x43')](_0x50752b,_0x172365[_0xd237('0x57')]),{'include':_0x172365[_0xd237('0x35')][_0xd237('0x45')]?[{'all':!![]}]:undefined})[_0xd237('0x26')](function(_0x58bd59){var _0x1eafe4=_0x172365['user']['get']({'plain':!![]});if(!_0x1eafe4)throw new Error(_0xd237('0x4e'));if(_0x1eafe4['role']===_0xd237('0x4d')){var _0x5076dc=_0x58bd59[_0xd237('0x27')]({'plain':!![]});var _0x33ff24=_0xd237('0x28');return db[_0xd237('0x50')][_0xd237('0x51')]({'where':{'name':_0x33ff24,'userProfileId':_0x1eafe4['userProfileId']},'raw':!![]})[_0xd237('0x26')](function(_0x8c409a){if(_0x8c409a&&_0x8c409a[_0xd237('0x58')]===0x0){return db[_0xd237('0x29')][_0xd237('0x4c')]({'name':_0x5076dc[_0xd237('0x2c')],'resourceId':_0x5076dc['id'],'type':_0x8c409a[_0xd237('0x2c')],'sectionId':_0x8c409a['id']},{})[_0xd237('0x26')](function(){return _0x58bd59;});}else{return _0x58bd59;}})[_0xd237('0x48')](function(_0x4239ec){logger[_0xd237('0x2a')](_0xd237('0x53'),_0x4239ec);throw _0x4239ec;});}return _0x58bd59;});}})[_0xd237('0x26')](respondWithResult(_0x4314de,0xc9))[_0xd237('0x48')](handleError(_0x4314de,null));};exports[_0xd237('0x24')]=function(_0x23e2da,_0x339244){if(_0x23e2da['body']['id']){delete _0x23e2da[_0xd237('0x57')]['id'];}return db[_0xd237('0x2f')][_0xd237('0x51')]({'where':{'id':_0x23e2da[_0xd237('0x4a')]['id']}})[_0xd237('0x26')](handleEntityNotFound(_0x339244,null))[_0xd237('0x26')](saveUpdates(_0x23e2da[_0xd237('0x57')],null))[_0xd237('0x26')](respondWithResult(_0x339244,null))[_0xd237('0x48')](handleError(_0x339244,null));};exports['destroy']=function(_0x19646b,_0x2e7a81){return db[_0xd237('0x2f')][_0xd237('0x51')]({'where':{'id':_0x19646b['params']['id']}})['then'](handleEntityNotFound(_0x2e7a81,null))[_0xd237('0x26')](removeEntity(_0x2e7a81,null))[_0xd237('0x48')](handleError(_0x2e7a81,null));};exports[_0xd237('0x59')]=function(_0x1f4782,_0x3f7d17,_0xd28a2f){var _0x2f24d5={'raw':!![],'where':{}};var _0x246c84={};var _0x24b4a0={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xd237('0x5a')]({'where':{'id':_0x1f4782[_0xd237('0x4a')]['id']}})[_0xd237('0x26')](handleEntityNotFound(_0x3f7d17,null))[_0xd237('0x26')](function(_0x4742cb){if(_0x4742cb){_0x246c84[_0xd237('0x33')]=_['keys'](db[_0xd237('0x5b')][_0xd237('0x30')]);_0x246c84[_0xd237('0x35')]=_[_0xd237('0x34')](_0x1f4782[_0xd237('0x35')]);_0x246c84['filters']=_[_0xd237('0x38')](_0x246c84[_0xd237('0x33')],_0x246c84['query']);_0x2f24d5[_0xd237('0x37')]=_[_0xd237('0x38')](_0x246c84[_0xd237('0x33')],qs['fields'](_0x1f4782[_0xd237('0x35')][_0xd237('0x39')]));_0x2f24d5[_0xd237('0x37')]=_0x2f24d5[_0xd237('0x37')][_0xd237('0x3a')]?_0x2f24d5[_0xd237('0x37')]:_0x246c84[_0xd237('0x33')];if(!_0x1f4782[_0xd237('0x35')][_0xd237('0x3b')](_0xd237('0x3c'))){_0x2f24d5[_0xd237('0x3d')]=qs[_0xd237('0x3d')](_0x1f4782[_0xd237('0x35')]['limit']);_0x2f24d5[_0xd237('0x1c')]=qs[_0xd237('0x1c')](_0x1f4782[_0xd237('0x35')][_0xd237('0x1c')]);}_0x2f24d5[_0xd237('0x3e')]=qs[_0xd237('0x3f')](_0x1f4782[_0xd237('0x35')]['sort']);_0x2f24d5[_0xd237('0x42')]=qs['filters'](_[_0xd237('0x40')](_0x1f4782[_0xd237('0x35')],_0x246c84[_0xd237('0x36')]));_0x2f24d5[_0xd237('0x42')]['ProjectId']=_0x4742cb['id'];if(_0x1f4782[_0xd237('0x35')][_0xd237('0x41')]){_0x2f24d5['where']=_['merge'](_0x2f24d5[_0xd237('0x42')],{'$or':_['map'](_0x2f24d5[_0xd237('0x37')],function(_0x5d4123){var _0x5b3ad6={};_0x5b3ad6[_0x5d4123]={'$like':'%'+_0x1f4782[_0xd237('0x35')]['filter']+'%'};return _0x5b3ad6;})});}_0x2f24d5=_[_0xd237('0x43')]({},_0x2f24d5,_0x1f4782[_0xd237('0x4b')]);return db[_0xd237('0x5b')][_0xd237('0x1e')]({'where':_0x2f24d5['where']})[_0xd237('0x26')](function(_0x38963d){_0x24b4a0[_0xd237('0x1e')]=_0x38963d;if(_0x1f4782[_0xd237('0x35')][_0xd237('0x45')]){_0x2f24d5['include']=[{'all':!![]}];}return db[_0xd237('0x5b')][_0xd237('0x5c')](_0x2f24d5);})[_0xd237('0x26')](function(_0x1b4b65){_0x24b4a0[_0xd237('0x47')]=_0x1b4b65;return _0x24b4a0;});}})[_0xd237('0x26')](respondWithFilteredResult(_0x3f7d17,_0x2f24d5))[_0xd237('0x48')](handleError(_0x3f7d17,null));};exports['getAnswers']=function(_0x3d9149,_0x7ec40b,_0x21f9d7){var _0x962cb0={'raw':!![],'where':{}};var _0x2bbb2b={};var _0x408de8={'count':0x0,'rows':[]};return db[_0xd237('0x2f')][_0xd237('0x5a')]({'where':{'id':_0x3d9149[_0xd237('0x4a')]['id']}})[_0xd237('0x26')](handleEntityNotFound(_0x7ec40b,null))[_0xd237('0x26')](function(_0xe5c243){if(_0xe5c243){_0x2bbb2b[_0xd237('0x33')]=_['keys'](db[_0xd237('0x5d')]['rawAttributes']);_0x2bbb2b[_0xd237('0x35')]=_[_0xd237('0x34')](_0x3d9149['query']);_0x2bbb2b[_0xd237('0x36')]=_[_0xd237('0x38')](_0x2bbb2b[_0xd237('0x33')],_0x2bbb2b[_0xd237('0x35')]);_0x962cb0[_0xd237('0x37')]=_[_0xd237('0x38')](_0x2bbb2b[_0xd237('0x33')],qs['fields'](_0x3d9149[_0xd237('0x35')][_0xd237('0x39')]));_0x962cb0[_0xd237('0x37')]=_0x962cb0[_0xd237('0x37')][_0xd237('0x3a')]?_0x962cb0[_0xd237('0x37')]:_0x2bbb2b[_0xd237('0x33')];if(!_0x3d9149[_0xd237('0x35')]['hasOwnProperty']('nolimit')){_0x962cb0[_0xd237('0x3d')]=qs[_0xd237('0x3d')](_0x3d9149[_0xd237('0x35')]['limit']);_0x962cb0[_0xd237('0x1c')]=qs[_0xd237('0x1c')](_0x3d9149[_0xd237('0x35')][_0xd237('0x1c')]);}_0x962cb0[_0xd237('0x3e')]=qs[_0xd237('0x3f')](_0x3d9149[_0xd237('0x35')][_0xd237('0x3f')]);_0x962cb0[_0xd237('0x42')]=qs[_0xd237('0x36')](_['pick'](_0x3d9149[_0xd237('0x35')],_0x2bbb2b[_0xd237('0x36')]));_0x962cb0[_0xd237('0x42')][_0xd237('0x5e')]=_0xe5c243['id'];if(_0x3d9149[_0xd237('0x35')][_0xd237('0x41')]){_0x962cb0[_0xd237('0x42')]=_[_0xd237('0x43')](_0x962cb0[_0xd237('0x42')],{'$or':_['map'](_0x962cb0[_0xd237('0x37')],function(_0xdedc63){var _0x480378={};_0x480378[_0xdedc63]={'$like':'%'+_0x3d9149[_0xd237('0x35')]['filter']+'%'};return _0x480378;})});}_0x962cb0=_[_0xd237('0x43')]({},_0x962cb0,_0x3d9149[_0xd237('0x4b')]);return db['JscriptyAnswerReport'][_0xd237('0x1e')]({'where':_0x962cb0['where']})[_0xd237('0x26')](function(_0x317cc4){_0x408de8[_0xd237('0x1e')]=_0x317cc4;if(_0x3d9149[_0xd237('0x35')][_0xd237('0x45')]){_0x962cb0[_0xd237('0x46')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xd237('0x5c')](_0x962cb0);})['then'](function(_0x1053b7){_0x408de8[_0xd237('0x47')]=_0x1053b7;return _0x408de8;});}})[_0xd237('0x26')](respondWithFilteredResult(_0x7ec40b,_0x962cb0))[_0xd237('0x48')](handleError(_0x7ec40b,null));};function char(_0x3a7f4d){return _0xd237('0x5f')===typeof _0x3a7f4d?String[_0xd237('0x60')]['apply'](null,arguments):_0x3a7f4d;}function needsEncapsulation(_0x887291){return!!_0x887291&&(_0x887291[_0xd237('0x61')]()[_0xd237('0x62')](char(0xd))>=0x0||_0x887291[_0xd237('0x61')]()[_0xd237('0x62')](char(0xa))>=0x0||_0x887291[_0xd237('0x61')]()[_0xd237('0x62')](char(0x2c))>=0x0||_0x887291['toString']()[_0xd237('0x62')](char(0x22))>=0x0);}function encapsulate(_0x303d95){var _0x4af2a9=char(0x22),_0x24498c='\x5c'+char(0x22),_0x18ef54=_0x303d95[_0xd237('0x61')]()[_0xd237('0x63')](new RegExp(_0x4af2a9,'g'),_0x24498c);return _0x4af2a9+_0x18ef54+_0x4af2a9;}exports[_0xd237('0x64')]=function(_0x291531,_0x5363c8,_0x5cda99){var _0x38b861,_0xcf530a;var _0x271b5d={'where':{'ProjectId':_0x291531[_0xd237('0x4a')]['id']}};if(_0x291531[_0xd237('0x35')][_0xd237('0x65')]){_0x271b5d[_0xd237('0x42')][_0xd237('0x66')]=JSON[_0xd237('0x67')](_0x291531[_0xd237('0x35')][_0xd237('0x65')]);}return db['JscriptySessionReport']['findAll'](_0x271b5d)[_0xd237('0x26')](handleEntityNotFound(_0x5363c8,null))[_0xd237('0x26')](function(_0x19f7db){if(_0x19f7db){_0x38b861=_0x19f7db;return db[_0xd237('0x68')][_0xd237('0x5c')]({'where':{'SessionId':{'$in':_[_0xd237('0x2e')](_0x38b861,'id')},'ProjectId':_0x291531[_0xd237('0x4a')]['id']},'order':_0xd237('0x69')});}})[_0xd237('0x26')](handleEntityNotFound(_0x5363c8,null))[_0xd237('0x26')](function(_0x38f023){if(_0x38f023){_0xcf530a=_0x38f023;var _0x213199={};for(var _0x120a22=0x0,_0x38c912=_0xcf530a[_0xd237('0x3a')];_0x120a22<_0x38c912;_0x120a22++){if(!_0x213199[_0xd237('0x3b')](_0xcf530a[_0x120a22][_0xd237('0x6a')])){_0x213199[_0xcf530a[_0x120a22][_0xd237('0x6a')]]=needsEncapsulation(_0xcf530a[_0x120a22][_0xd237('0x6b')])?encapsulate(_0xcf530a[_0x120a22][_0xd237('0x6b')]):_0xcf530a[_0x120a22][_0xd237('0x6b')];}}var _0x58d7e8=[],_0x34590={};for(var _0x31274d=0x0,_0xff830c=_0x38b861['length'];_0x31274d<_0xff830c;_0x31274d++){_0x34590={'ProjectId':_0x291531[_0xd237('0x4a')]['id'],'SessionId':_0x38b861[_0x31274d]['id'],'StartTime':moment(_0x38b861[_0x31274d][_0xd237('0x66')])[_0xd237('0x6c')](_0xd237('0x6d'))};for(var _0x198d50=0x0,_0x13571f=_0xcf530a[_0xd237('0x3a')];_0x198d50<_0x13571f;_0x198d50++){if(_0xcf530a[_0x198d50]['SessionId']==_0x38b861[_0x31274d]['id']&&_0x213199[_0xd237('0x3b')](_0xcf530a[_0x198d50][_0xd237('0x6a')])){_0x34590[_0x213199[_0xcf530a[_0x198d50][_0xd237('0x6a')]]]=_0xcf530a[_0x198d50][_0xd237('0x6e')];}}for(var _0x58e3ba in _0x213199){if(!_0x34590['hasOwnProperty'](_0x213199[_0x58e3ba])){_0x34590[_0x213199[_0x58e3ba]]=null;}}_0x58d7e8['push'](_0x34590);}return _0x58d7e8;}})['then'](function(_0x1ef589){if(!_[_0xd237('0x6f')](_0x1ef589)){var _0x1c465c=toCsv(_0x1ef589);var _0x4e47c1=Date[_0xd237('0x70')]();fs['writeFileSync'](util['format'](_0xd237('0x71'),_0x291531['params']['id'],_0x4e47c1),_0x1c465c);_0x5363c8['setHeader'](_0xd237('0x72'),_0xd237('0x73')+util[_0xd237('0x6c')](_0xd237('0x74'),_0x291531[_0xd237('0x4a')]['id'],_0x4e47c1));_0x5363c8[_0xd237('0x75')]('Content-type','text/csv');return _0x5363c8[_0xd237('0x76')](util[_0xd237('0x6c')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x291531[_0xd237('0x4a')]['id'],_0x4e47c1));}else{return _0x5363c8['sendStatus'](0xcc);}})['catch'](handleError(_0x5363c8,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index dbee4c8..65f7e57 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 _0xed1f=['jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject'];(function(_0x2070f1,_0x20607c){var _0x5de924=function(_0x216acf){while(--_0x216acf){_0x2070f1['push'](_0x2070f1['shift']());}};_0x5de924(++_0x20607c);}(_0xed1f,0x6a));var _0xfed1=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0xed1f[_0x8a969d];return _0x1d8dc7;};'use strict';var _=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var logger=require(_0xfed1('0x2'))(_0xfed1('0x3'));var moment=require(_0xfed1('0x4'));var BPromise=require(_0xfed1('0x5'));var rp=require(_0xfed1('0x6'));var fs=require('fs');var path=require(_0xfed1('0x7'));var rimraf=require(_0xfed1('0x8'));var config=require(_0xfed1('0x9'));var attributes=require(_0xfed1('0xa'));module[_0xfed1('0xb')]=function(_0x3d6706,_0x42751d){return _0x3d6706[_0xfed1('0xc')](_0xfed1('0xd'),attributes,{'tableName':_0xfed1('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c1f=['moment','request-promise','path','rimraf','./jscriptyProject.attributes','exports','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api'];(function(_0xfb0cfd,_0x500179){var _0x2fd8aa=function(_0xccb501){while(--_0xccb501){_0xfb0cfd['push'](_0xfb0cfd['shift']());}};_0x2fd8aa(++_0x500179);}(_0x7c1f,0x194));var _0xf7c1=function(_0x2df604,_0x331ab0){_0x2df604=_0x2df604-0x0;var _0xc052f8=_0x7c1f[_0x2df604];return _0xc052f8;};'use strict';var _=require(_0xf7c1('0x0'));var util=require(_0xf7c1('0x1'));var logger=require(_0xf7c1('0x2'))(_0xf7c1('0x3'));var moment=require(_0xf7c1('0x4'));var BPromise=require('bluebird');var rp=require(_0xf7c1('0x5'));var fs=require('fs');var path=require(_0xf7c1('0x6'));var rimraf=require(_0xf7c1('0x7'));var config=require('../../config/environment');var attributes=require(_0xf7c1('0x8'));module[_0xf7c1('0x9')]=function(_0x3c21cf,_0x136e1e){return _0x3c21cf['define'](_0xf7c1('0xa'),attributes,{'tableName':_0xf7c1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 8f770fb..17beb54 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(_0x2eebaa,_0xbf19b6){var _0xaedd4d=function(_0x5a8656){while(--_0x5a8656){_0x2eebaa['push'](_0x2eebaa['shift']());}};_0xaedd4d(++_0xbf19b6);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x11e03f,_0x20b967){_0x11e03f=_0x11e03f-0x0;var _0x5666fe=_0xcb91[_0x11e03f];return _0x5666fe;};'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 _0xe706=['http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\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(_0x489127,_0xa68053){var _0x1a2c54=function(_0x5d4569){while(--_0x5d4569){_0x489127['push'](_0x489127['shift']());}};_0x1a2c54(++_0xa68053);}(_0xe706,0xa3));var _0x6e70=function(_0x50d326,_0x1fc7e2){_0x50d326=_0x50d326-0x0;var _0x10f473=_0xe706[_0x50d326];return _0x10f473;};'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']('JscriptyProject,\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']('JscriptyProject,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 4833c1b..4af5d97 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 _0x3227=['Router','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','delete','/:id','destroy','exports','multer','path'];(function(_0x273f88,_0x5d4150){var _0x177ca1=function(_0xf46ec4){while(--_0xf46ec4){_0x273f88['push'](_0x273f88['shift']());}};_0x177ca1(++_0x5d4150);}(_0x3227,0xf5));var _0x7322=function(_0x315dda,_0x3d982e){_0x315dda=_0x315dda-0x0;var _0x1672e3=_0x3227[_0x315dda];return _0x1672e3;};'use strict';var multer=require(_0x7322('0x0'));var util=require('util');var path=require(_0x7322('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7322('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x7322('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7322('0x4'));var controller=require(_0x7322('0x5'));router[_0x7322('0x6')]('/',auth[_0x7322('0x7')](),controller[_0x7322('0x8')]);router[_0x7322('0x6')](_0x7322('0x9'),auth[_0x7322('0x7')](),controller[_0x7322('0xa')]);router['get']('/:id',auth[_0x7322('0x7')](),controller[_0x7322('0xb')]);router[_0x7322('0xc')]('/',auth[_0x7322('0x7')](),controller[_0x7322('0xd')]);router[_0x7322('0xe')]('/:id',auth[_0x7322('0x7')](),controller['update']);router[_0x7322('0xf')](_0x7322('0x10'),auth[_0x7322('0x7')](),controller[_0x7322('0x11')]);module[_0x7322('0x12')]=router; \ No newline at end of file +var _0xaafe=['../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x35336d,_0x59385d){var _0x430da7=function(_0xc11f96){while(--_0xc11f96){_0x35336d['push'](_0x35336d['shift']());}};_0x430da7(++_0x59385d);}(_0xaafe,0xde));var _0xeaaf=function(_0x37a110,_0x3f4a75){_0x37a110=_0x37a110-0x0;var _0x46fb8f=_0xaafe[_0x37a110];return _0x46fb8f;};'use strict';var multer=require(_0xeaaf('0x0'));var util=require(_0xeaaf('0x1'));var path=require(_0xeaaf('0x2'));var timeout=require(_0xeaaf('0x3'));var express=require(_0xeaaf('0x4'));var router=express[_0xeaaf('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xeaaf('0x6'));var interaction=require(_0xeaaf('0x7'));var config=require(_0xeaaf('0x8'));var controller=require(_0xeaaf('0x9'));router[_0xeaaf('0xa')]('/',auth[_0xeaaf('0xb')](),controller[_0xeaaf('0xc')]);router['get'](_0xeaaf('0xd'),auth[_0xeaaf('0xb')](),controller[_0xeaaf('0xe')]);router[_0xeaaf('0xa')](_0xeaaf('0xf'),auth[_0xeaaf('0xb')](),controller[_0xeaaf('0x10')]);router[_0xeaaf('0x11')]('/',auth[_0xeaaf('0xb')](),controller[_0xeaaf('0x12')]);router[_0xeaaf('0x13')](_0xeaaf('0xf'),auth[_0xeaaf('0xb')](),controller['update']);router[_0xeaaf('0x14')](_0xeaaf('0xf'),auth[_0xeaaf('0xb')](),controller[_0xeaaf('0x15')]);module[_0xeaaf('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 0e7416e..63cfb23 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(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x7a54,0x106));var _0x47a5=function(_0x1a6c6f,_0x30b417){_0x1a6c6f=_0x1a6c6f-0x0;var _0x29efca=_0x7a54[_0x1a6c6f];return _0x29efca;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x7a54,0x106));var _0x47a5=function(_0x5dc6ce,_0x5d34c5){_0x5dc6ce=_0x5dc6ce-0x0;var _0x5f15d7=_0x7a54[_0x5dc6ce];return _0x5f15d7;};'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 cc2628d..98ee8e9 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 _0x0946=['show','params','include','options','find','catch','create','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','findAll','rows'];(function(_0x248abf,_0x3cb253){var _0x8e4424=function(_0x48b8d0){while(--_0x48b8d0){_0x248abf['push'](_0x248abf['shift']());}};_0x8e4424(++_0x3cb253);}(_0x0946,0x12c));var _0x6094=function(_0x1c4409,_0x3b2e8f){_0x1c4409=_0x1c4409-0x0;var _0x356d8f=_0x0946[_0x1c4409];return _0x356d8f;};'use strict';var emlformat=require(_0x6094('0x0'));var rimraf=require(_0x6094('0x1'));var zipdir=require(_0x6094('0x2'));var jsonpatch=require(_0x6094('0x3'));var rp=require(_0x6094('0x4'));var moment=require(_0x6094('0x5'));var BPromise=require(_0x6094('0x6'));var Mustache=require(_0x6094('0x7'));var util=require('util');var path=require('path');var sox=require(_0x6094('0x8'));var csv=require(_0x6094('0x9'));var ejs=require(_0x6094('0xa'));var fs=require('fs');var fs_extra=require(_0x6094('0xb'));var _=require('lodash');var squel=require(_0x6094('0xc'));var crypto=require(_0x6094('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6094('0x9'));var querystring=require(_0x6094('0xe'));var Papa=require(_0x6094('0xf'));var Redis=require(_0x6094('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6094('0x11'));var hardwareService=require(_0x6094('0x12'));var logger=require('../../config/logger')(_0x6094('0x13'));var utils=require(_0x6094('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6094('0x15'))['db'];function respondWithStatusCode(_0x359777,_0x5a00ef){_0x5a00ef=_0x5a00ef||0xcc;return function(_0x11e7e2){if(_0x11e7e2){return _0x359777[_0x6094('0x16')](_0x5a00ef);}return _0x359777[_0x6094('0x17')](_0x5a00ef)[_0x6094('0x18')]();};}function respondWithResult(_0x509d4a,_0x2a5967){_0x2a5967=_0x2a5967||0xc8;return function(_0x2aada0){if(_0x2aada0){return _0x509d4a['status'](_0x2a5967)['json'](_0x2aada0);}};}function respondWithFilteredResult(_0x369fef,_0x26da0e){return function(_0x5a27ea){if(_0x5a27ea){var _0x1f5c60=typeof _0x26da0e['offset']==='undefined'&&typeof _0x26da0e[_0x6094('0x19')]===_0x6094('0x1a');var _0x14560a=_0x5a27ea[_0x6094('0x1b')];var _0x5a5780=_0x1f5c60?0x0:_0x26da0e[_0x6094('0x1c')];var _0x1b87bf=_0x1f5c60?_0x5a27ea[_0x6094('0x1b')]:_0x26da0e[_0x6094('0x1c')]+_0x26da0e[_0x6094('0x19')];var _0xb62363;if(_0x1b87bf>=_0x14560a){_0x1b87bf=_0x14560a;_0xb62363=0xc8;}else{_0xb62363=0xce;}_0x369fef['status'](_0xb62363);return _0x369fef[_0x6094('0x1d')](_0x6094('0x1e'),_0x5a5780+'-'+_0x1b87bf+'/'+_0x14560a)['json'](_0x5a27ea);}return null;};}function patchUpdates(_0x1c62c8){return function(_0x14232d){try{jsonpatch[_0x6094('0x1f')](_0x14232d,_0x1c62c8,!![]);}catch(_0x1613fe){return BPromise['reject'](_0x1613fe);}return _0x14232d['save']();};}function saveUpdates(_0x2ab102,_0x1a1005){return function(_0x363c9e){if(_0x363c9e){return _0x363c9e[_0x6094('0x20')](_0x2ab102)[_0x6094('0x21')](function(_0xef5c40){return _0xef5c40;});}return null;};}function removeEntity(_0x5b4c4f,_0x3a664a){return function(_0x432af3){if(_0x432af3){return _0x432af3[_0x6094('0x22')]()['then'](function(){_0x5b4c4f[_0x6094('0x17')](0xcc)[_0x6094('0x18')]();});}};}function handleEntityNotFound(_0x3fdc0f,_0x17a324){return function(_0x58a18e){if(!_0x58a18e){_0x3fdc0f[_0x6094('0x16')](0x194);}return _0x58a18e;};}function handleError(_0x23c7d7,_0x48c152){_0x48c152=_0x48c152||0x1f4;return function(_0x5eed74){logger[_0x6094('0x23')](_0x5eed74[_0x6094('0x24')]);if(_0x5eed74[_0x6094('0x25')]){delete _0x5eed74[_0x6094('0x25')];}_0x23c7d7['status'](_0x48c152)[_0x6094('0x26')](_0x5eed74);};}exports[_0x6094('0x27')]=function(_0x55f0d6,_0x2281e9){var _0x17bf36={},_0x2d81f9={},_0x197fff={'count':0x0,'rows':[]};var _0x45d31d=_[_0x6094('0x28')](db[_0x6094('0x29')][_0x6094('0x2a')],function(_0x4429e3){return{'name':_0x4429e3[_0x6094('0x2b')],'type':_0x4429e3['type'][_0x6094('0x2c')]};});_0x2d81f9['model']=_[_0x6094('0x28')](_0x45d31d,'name');_0x2d81f9[_0x6094('0x2d')]=_[_0x6094('0x2e')](_0x55f0d6[_0x6094('0x2d')]);_0x2d81f9[_0x6094('0x2f')]=_[_0x6094('0x30')](_0x2d81f9[_0x6094('0x31')],_0x2d81f9['query']);_0x17bf36[_0x6094('0x32')]=_[_0x6094('0x30')](_0x2d81f9['model'],qs[_0x6094('0x33')](_0x55f0d6[_0x6094('0x2d')][_0x6094('0x33')]));_0x17bf36[_0x6094('0x32')]=_0x17bf36['attributes'][_0x6094('0x34')]?_0x17bf36[_0x6094('0x32')]:_0x2d81f9[_0x6094('0x31')];if(!_0x55f0d6[_0x6094('0x2d')]['hasOwnProperty'](_0x6094('0x35'))){_0x17bf36['limit']=qs[_0x6094('0x19')](_0x55f0d6[_0x6094('0x2d')][_0x6094('0x19')]);_0x17bf36[_0x6094('0x1c')]=qs[_0x6094('0x1c')](_0x55f0d6['query']['offset']);}_0x17bf36[_0x6094('0x36')]=qs['sort'](_0x55f0d6[_0x6094('0x2d')][_0x6094('0x37')]);_0x17bf36[_0x6094('0x38')]=qs[_0x6094('0x2f')](_[_0x6094('0x39')](_0x55f0d6[_0x6094('0x2d')],_0x2d81f9[_0x6094('0x2f')]),_0x45d31d);if(_0x55f0d6[_0x6094('0x2d')][_0x6094('0x3a')]){_0x17bf36[_0x6094('0x38')]=_['merge'](_0x17bf36[_0x6094('0x38')],{'$or':_[_0x6094('0x28')](_0x45d31d,function(_0x2bb0cc){if(_0x2bb0cc[_0x6094('0x3b')]!==_0x6094('0x3c')){var _0x315e59={};_0x315e59[_0x2bb0cc[_0x6094('0x25')]]={'$like':'%'+_0x55f0d6[_0x6094('0x2d')][_0x6094('0x3a')]+'%'};return _0x315e59;}})});}_0x17bf36=_[_0x6094('0x3d')]({},_0x17bf36,_0x55f0d6['options']);var _0x5760c8={'where':_0x17bf36[_0x6094('0x38')]};return db[_0x6094('0x29')][_0x6094('0x1b')](_0x5760c8)['then'](function(_0x293aea){_0x197fff[_0x6094('0x1b')]=_0x293aea;if(_0x55f0d6['query'][_0x6094('0x3e')]){_0x17bf36['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x6094('0x3f')](_0x17bf36);})[_0x6094('0x21')](function(_0x192d56){_0x197fff[_0x6094('0x40')]=_0x192d56;return _0x197fff;})[_0x6094('0x21')](respondWithFilteredResult(_0x2281e9,_0x17bf36))['catch'](handleError(_0x2281e9,null));};exports[_0x6094('0x41')]=function(_0x36b6b2,_0x13851c){var _0x4bd3a7={'raw':!![],'where':{'id':_0x36b6b2[_0x6094('0x42')]['id']}},_0xac88e5={};_0xac88e5[_0x6094('0x31')]=_[_0x6094('0x2e')](db['JscriptyQuestionReport'][_0x6094('0x2a')]);_0xac88e5[_0x6094('0x2d')]=_[_0x6094('0x2e')](_0x36b6b2[_0x6094('0x2d')]);_0xac88e5[_0x6094('0x2f')]=_['intersection'](_0xac88e5[_0x6094('0x31')],_0xac88e5[_0x6094('0x2d')]);_0x4bd3a7['attributes']=_[_0x6094('0x30')](_0xac88e5[_0x6094('0x31')],qs[_0x6094('0x33')](_0x36b6b2[_0x6094('0x2d')]['fields']));_0x4bd3a7[_0x6094('0x32')]=_0x4bd3a7[_0x6094('0x32')]['length']?_0x4bd3a7[_0x6094('0x32')]:_0xac88e5[_0x6094('0x31')];if(_0x36b6b2[_0x6094('0x2d')]['includeAll']){_0x4bd3a7[_0x6094('0x43')]=[{'all':!![]}];}_0x4bd3a7=_['merge']({},_0x4bd3a7,_0x36b6b2[_0x6094('0x44')]);return db[_0x6094('0x29')][_0x6094('0x45')](_0x4bd3a7)[_0x6094('0x21')](handleEntityNotFound(_0x13851c,null))[_0x6094('0x21')](respondWithResult(_0x13851c,null))[_0x6094('0x46')](handleError(_0x13851c,null));};exports[_0x6094('0x47')]=function(_0x3750f7,_0x3b0e21){return db['JscriptyQuestionReport'][_0x6094('0x47')](_0x3750f7['body'],{})[_0x6094('0x21')](respondWithResult(_0x3b0e21,0xc9))[_0x6094('0x46')](handleError(_0x3b0e21,null));};exports[_0x6094('0x20')]=function(_0x510fd1,_0x1c2176){if(_0x510fd1['body']['id']){delete _0x510fd1['body']['id'];}return db[_0x6094('0x29')][_0x6094('0x45')]({'where':{'id':_0x510fd1[_0x6094('0x42')]['id']}})['then'](handleEntityNotFound(_0x1c2176,null))[_0x6094('0x21')](saveUpdates(_0x510fd1['body'],null))[_0x6094('0x21')](respondWithResult(_0x1c2176,null))[_0x6094('0x46')](handleError(_0x1c2176,null));};exports[_0x6094('0x22')]=function(_0x5865a4,_0x39b5fa){return db[_0x6094('0x29')]['find']({'where':{'id':_0x5865a4[_0x6094('0x42')]['id']}})[_0x6094('0x21')](handleEntityNotFound(_0x39b5fa,null))[_0x6094('0x21')](removeEntity(_0x39b5fa,null))['catch'](handleError(_0x39b5fa,null));};exports['describe']=function(_0xcefe29,_0x422822){return db['JscriptyQuestionReport'][_0x6094('0x48')]()[_0x6094('0x21')](respondWithResult(_0x422822,null))[_0x6094('0x46')](handleError(_0x422822,null));}; \ No newline at end of file +var _0x0caa=['../../config/environment','status','offset','undefined','limit','count','set','apply','save','update','then','destroy','sendStatus','error','name','index','map','rawAttributes','fieldName','model','query','intersection','fields','hasOwnProperty','nolimit','order','sort','filters','pick','merge','type','filter','options','where','JscriptyQuestionReport','includeAll','include','findAll','rows','show','params','keys','attributes','length','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x3b36b1,_0x304a6a){var _0x47d127=function(_0x9829d4){while(--_0x9829d4){_0x3b36b1['push'](_0x3b36b1['shift']());}};_0x47d127(++_0x304a6a);}(_0x0caa,0x7d));var _0xa0ca=function(_0x672fb0,_0x20d6f2){_0x672fb0=_0x672fb0-0x0;var _0x25c562=_0x0caa[_0x672fb0];return _0x25c562;};'use strict';var emlformat=require(_0xa0ca('0x0'));var rimraf=require(_0xa0ca('0x1'));var zipdir=require(_0xa0ca('0x2'));var jsonpatch=require(_0xa0ca('0x3'));var rp=require(_0xa0ca('0x4'));var moment=require(_0xa0ca('0x5'));var BPromise=require(_0xa0ca('0x6'));var Mustache=require(_0xa0ca('0x7'));var util=require('util');var path=require(_0xa0ca('0x8'));var sox=require(_0xa0ca('0x9'));var csv=require(_0xa0ca('0xa'));var ejs=require(_0xa0ca('0xb'));var fs=require('fs');var fs_extra=require(_0xa0ca('0xc'));var _=require(_0xa0ca('0xd'));var squel=require(_0xa0ca('0xe'));var crypto=require(_0xa0ca('0xf'));var jsforce=require(_0xa0ca('0x10'));var deskjs=require(_0xa0ca('0x11'));var toCsv=require(_0xa0ca('0xa'));var querystring=require(_0xa0ca('0x12'));var Papa=require(_0xa0ca('0x13'));var Redis=require(_0xa0ca('0x14'));var authService=require(_0xa0ca('0x15'));var qs=require(_0xa0ca('0x16'));var as=require(_0xa0ca('0x17'));var hardwareService=require(_0xa0ca('0x18'));var logger=require(_0xa0ca('0x19'))(_0xa0ca('0x1a'));var utils=require('../../config/utils');var config=require(_0xa0ca('0x1b'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xac13cd,_0x45a393){_0x45a393=_0x45a393||0xcc;return function(_0x2c9ce6){if(_0x2c9ce6){return _0xac13cd['sendStatus'](_0x45a393);}return _0xac13cd[_0xa0ca('0x1c')](_0x45a393)['end']();};}function respondWithResult(_0x2c6546,_0x3347dc){_0x3347dc=_0x3347dc||0xc8;return function(_0x380224){if(_0x380224){return _0x2c6546['status'](_0x3347dc)['json'](_0x380224);}};}function respondWithFilteredResult(_0x343629,_0x4860b3){return function(_0x37aa27){if(_0x37aa27){var _0x1b6df5=typeof _0x4860b3[_0xa0ca('0x1d')]===_0xa0ca('0x1e')&&typeof _0x4860b3[_0xa0ca('0x1f')]==='undefined';var _0x153cba=_0x37aa27[_0xa0ca('0x20')];var _0x25a13b=_0x1b6df5?0x0:_0x4860b3[_0xa0ca('0x1d')];var _0xcbc2d2=_0x1b6df5?_0x37aa27[_0xa0ca('0x20')]:_0x4860b3[_0xa0ca('0x1d')]+_0x4860b3['limit'];var _0x5afa5a;if(_0xcbc2d2>=_0x153cba){_0xcbc2d2=_0x153cba;_0x5afa5a=0xc8;}else{_0x5afa5a=0xce;}_0x343629[_0xa0ca('0x1c')](_0x5afa5a);return _0x343629[_0xa0ca('0x21')]('Content-Range',_0x25a13b+'-'+_0xcbc2d2+'/'+_0x153cba)['json'](_0x37aa27);}return null;};}function patchUpdates(_0x4a78bc){return function(_0x5ceb0d){try{jsonpatch[_0xa0ca('0x22')](_0x5ceb0d,_0x4a78bc,!![]);}catch(_0x39842d){return BPromise['reject'](_0x39842d);}return _0x5ceb0d[_0xa0ca('0x23')]();};}function saveUpdates(_0xf4acae,_0x53aac0){return function(_0x166ccd){if(_0x166ccd){return _0x166ccd[_0xa0ca('0x24')](_0xf4acae)[_0xa0ca('0x25')](function(_0x50140d){return _0x50140d;});}return null;};}function removeEntity(_0x3155d5,_0x10516a){return function(_0x5b7153){if(_0x5b7153){return _0x5b7153[_0xa0ca('0x26')]()[_0xa0ca('0x25')](function(){_0x3155d5[_0xa0ca('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1366b6,_0x2e7b5f){return function(_0x8cf189){if(!_0x8cf189){_0x1366b6[_0xa0ca('0x27')](0x194);}return _0x8cf189;};}function handleError(_0x21d298,_0x3ab156){_0x3ab156=_0x3ab156||0x1f4;return function(_0x2be97b){logger[_0xa0ca('0x28')](_0x2be97b['stack']);if(_0x2be97b[_0xa0ca('0x29')]){delete _0x2be97b[_0xa0ca('0x29')];}_0x21d298[_0xa0ca('0x1c')](_0x3ab156)['send'](_0x2be97b);};}exports[_0xa0ca('0x2a')]=function(_0x12d190,_0xd831a2){var _0x34c8e4={},_0xdfb241={},_0x405d6c={'count':0x0,'rows':[]};var _0x3584bf=_[_0xa0ca('0x2b')](db['JscriptyQuestionReport'][_0xa0ca('0x2c')],function(_0xa86cd4){return{'name':_0xa86cd4[_0xa0ca('0x2d')],'type':_0xa86cd4['type']['key']};});_0xdfb241[_0xa0ca('0x2e')]=_[_0xa0ca('0x2b')](_0x3584bf,_0xa0ca('0x29'));_0xdfb241[_0xa0ca('0x2f')]=_['keys'](_0x12d190[_0xa0ca('0x2f')]);_0xdfb241['filters']=_[_0xa0ca('0x30')](_0xdfb241[_0xa0ca('0x2e')],_0xdfb241['query']);_0x34c8e4['attributes']=_[_0xa0ca('0x30')](_0xdfb241[_0xa0ca('0x2e')],qs[_0xa0ca('0x31')](_0x12d190[_0xa0ca('0x2f')][_0xa0ca('0x31')]));_0x34c8e4['attributes']=_0x34c8e4['attributes']['length']?_0x34c8e4['attributes']:_0xdfb241[_0xa0ca('0x2e')];if(!_0x12d190[_0xa0ca('0x2f')][_0xa0ca('0x32')](_0xa0ca('0x33'))){_0x34c8e4[_0xa0ca('0x1f')]=qs[_0xa0ca('0x1f')](_0x12d190[_0xa0ca('0x2f')]['limit']);_0x34c8e4[_0xa0ca('0x1d')]=qs[_0xa0ca('0x1d')](_0x12d190[_0xa0ca('0x2f')][_0xa0ca('0x1d')]);}_0x34c8e4[_0xa0ca('0x34')]=qs[_0xa0ca('0x35')](_0x12d190['query'][_0xa0ca('0x35')]);_0x34c8e4['where']=qs[_0xa0ca('0x36')](_[_0xa0ca('0x37')](_0x12d190[_0xa0ca('0x2f')],_0xdfb241[_0xa0ca('0x36')]),_0x3584bf);if(_0x12d190[_0xa0ca('0x2f')]['filter']){_0x34c8e4['where']=_[_0xa0ca('0x38')](_0x34c8e4['where'],{'$or':_['map'](_0x3584bf,function(_0x26109b){if(_0x26109b[_0xa0ca('0x39')]!=='VIRTUAL'){var _0x4b94d9={};_0x4b94d9[_0x26109b['name']]={'$like':'%'+_0x12d190[_0xa0ca('0x2f')][_0xa0ca('0x3a')]+'%'};return _0x4b94d9;}})});}_0x34c8e4=_[_0xa0ca('0x38')]({},_0x34c8e4,_0x12d190[_0xa0ca('0x3b')]);var _0x2f27b5={'where':_0x34c8e4[_0xa0ca('0x3c')]};return db[_0xa0ca('0x3d')][_0xa0ca('0x20')](_0x2f27b5)[_0xa0ca('0x25')](function(_0x264162){_0x405d6c[_0xa0ca('0x20')]=_0x264162;if(_0x12d190[_0xa0ca('0x2f')][_0xa0ca('0x3e')]){_0x34c8e4[_0xa0ca('0x3f')]=[{'all':!![]}];}return db[_0xa0ca('0x3d')][_0xa0ca('0x40')](_0x34c8e4);})[_0xa0ca('0x25')](function(_0x57ae6f){_0x405d6c[_0xa0ca('0x41')]=_0x57ae6f;return _0x405d6c;})[_0xa0ca('0x25')](respondWithFilteredResult(_0xd831a2,_0x34c8e4))['catch'](handleError(_0xd831a2,null));};exports[_0xa0ca('0x42')]=function(_0x2fabcc,_0x1a459c){var _0x11fb9c={'raw':!![],'where':{'id':_0x2fabcc[_0xa0ca('0x43')]['id']}},_0x39c1f8={};_0x39c1f8[_0xa0ca('0x2e')]=_[_0xa0ca('0x44')](db[_0xa0ca('0x3d')][_0xa0ca('0x2c')]);_0x39c1f8[_0xa0ca('0x2f')]=_['keys'](_0x2fabcc[_0xa0ca('0x2f')]);_0x39c1f8[_0xa0ca('0x36')]=_[_0xa0ca('0x30')](_0x39c1f8[_0xa0ca('0x2e')],_0x39c1f8[_0xa0ca('0x2f')]);_0x11fb9c[_0xa0ca('0x45')]=_[_0xa0ca('0x30')](_0x39c1f8[_0xa0ca('0x2e')],qs['fields'](_0x2fabcc[_0xa0ca('0x2f')][_0xa0ca('0x31')]));_0x11fb9c[_0xa0ca('0x45')]=_0x11fb9c['attributes'][_0xa0ca('0x46')]?_0x11fb9c[_0xa0ca('0x45')]:_0x39c1f8[_0xa0ca('0x2e')];if(_0x2fabcc['query'][_0xa0ca('0x3e')]){_0x11fb9c[_0xa0ca('0x3f')]=[{'all':!![]}];}_0x11fb9c=_[_0xa0ca('0x38')]({},_0x11fb9c,_0x2fabcc[_0xa0ca('0x3b')]);return db['JscriptyQuestionReport']['find'](_0x11fb9c)[_0xa0ca('0x25')](handleEntityNotFound(_0x1a459c,null))[_0xa0ca('0x25')](respondWithResult(_0x1a459c,null))[_0xa0ca('0x47')](handleError(_0x1a459c,null));};exports[_0xa0ca('0x48')]=function(_0x227521,_0x5269b3){return db[_0xa0ca('0x3d')][_0xa0ca('0x48')](_0x227521[_0xa0ca('0x49')],{})[_0xa0ca('0x25')](respondWithResult(_0x5269b3,0xc9))[_0xa0ca('0x47')](handleError(_0x5269b3,null));};exports[_0xa0ca('0x24')]=function(_0x332259,_0x2c34e1){if(_0x332259[_0xa0ca('0x49')]['id']){delete _0x332259[_0xa0ca('0x49')]['id'];}return db[_0xa0ca('0x3d')][_0xa0ca('0x4a')]({'where':{'id':_0x332259[_0xa0ca('0x43')]['id']}})[_0xa0ca('0x25')](handleEntityNotFound(_0x2c34e1,null))[_0xa0ca('0x25')](saveUpdates(_0x332259[_0xa0ca('0x49')],null))[_0xa0ca('0x25')](respondWithResult(_0x2c34e1,null))[_0xa0ca('0x47')](handleError(_0x2c34e1,null));};exports[_0xa0ca('0x26')]=function(_0x733f83,_0x3829be){return db['JscriptyQuestionReport'][_0xa0ca('0x4a')]({'where':{'id':_0x733f83[_0xa0ca('0x43')]['id']}})[_0xa0ca('0x25')](handleEntityNotFound(_0x3829be,null))[_0xa0ca('0x25')](removeEntity(_0x3829be,null))[_0xa0ca('0x47')](handleError(_0x3829be,null));};exports[_0xa0ca('0x4b')]=function(_0x1b95d6,_0x311f3c){return db['JscriptyQuestionReport'][_0xa0ca('0x4b')]()[_0xa0ca('0x25')](respondWithResult(_0x311f3c,null))[_0xa0ca('0x47')](handleError(_0x311f3c,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 4ba452a..634d694 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 _0xc25f=['../../config/logger','bluebird','request-promise','rimraf','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util'];(function(_0x4da356,_0x5235e1){var _0x321b07=function(_0x2bc6f4){while(--_0x2bc6f4){_0x4da356['push'](_0x4da356['shift']());}};_0x321b07(++_0x5235e1);}(_0xc25f,0x153));var _0xfc25=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc25f[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xfc25('0x0'));var util=require(_0xfc25('0x1'));var logger=require(_0xfc25('0x2'))('api');var moment=require('moment');var BPromise=require(_0xfc25('0x3'));var rp=require(_0xfc25('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfc25('0x5'));var config=require('../../config/environment');var attributes=require(_0xfc25('0x6'));module[_0xfc25('0x7')]=function(_0x3c6227,_0x11744c){return _0x3c6227[_0xfc25('0x8')](_0xfc25('0x9'),attributes,{'tableName':_0xfc25('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e75=['api','moment','request-promise','./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger'];(function(_0x410f6f,_0x271920){var _0x1da600=function(_0x459bbb){while(--_0x459bbb){_0x410f6f['push'](_0x410f6f['shift']());}};_0x1da600(++_0x271920);}(_0x7e75,0x1c9));var _0x57e7=function(_0x4cb58a,_0x2a62e0){_0x4cb58a=_0x4cb58a-0x0;var _0x592f29=_0x7e75[_0x4cb58a];return _0x592f29;};'use strict';var _=require(_0x57e7('0x0'));var util=require(_0x57e7('0x1'));var logger=require(_0x57e7('0x2'))(_0x57e7('0x3'));var moment=require(_0x57e7('0x4'));var BPromise=require('bluebird');var rp=require(_0x57e7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x57e7('0x6'));module[_0x57e7('0x7')]=function(_0x521dda,_0xaedf18){return _0x521dda['define'](_0x57e7('0x8'),attributes,{'tableName':_0x57e7('0x9'),'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 682ae95..5b7adc4 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 _0x0ac7=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','stringify','error','message','JscriptyQuestionReport,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird'];(function(_0x4e87ba,_0x2d95f9){var _0x212b08=function(_0x763e51){while(--_0x763e51){_0x4e87ba['push'](_0x4e87ba['shift']());}};_0x212b08(++_0x2d95f9);}(_0x0ac7,0x172));var _0x70ac=function(_0x3df378,_0x8edffb){_0x3df378=_0x3df378-0x0;var _0x4e1b85=_0x0ac7[_0x3df378];return _0x4e1b85;};'use strict';var _=require(_0x70ac('0x0'));var util=require(_0x70ac('0x1'));var moment=require(_0x70ac('0x2'));var BPromise=require(_0x70ac('0x3'));var rs=require(_0x70ac('0x4'));var fs=require('fs');var Redis=require(_0x70ac('0x5'));var db=require(_0x70ac('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x70ac('0x7'))(_0x70ac('0x8'));var config=require(_0x70ac('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x70ac('0xa')][_0x70ac('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4645ad,_0x2c10a0,_0x5c6138){return new BPromise(function(_0x3efeef,_0x1dc929){return client['request'](_0x4645ad,_0x5c6138)[_0x70ac('0xc')](function(_0xe7efcb){logger[_0x70ac('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2c10a0,_0x70ac('0xe'));logger[_0x70ac('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x2c10a0,'request\x20sent',JSON[_0x70ac('0x10')](_0xe7efcb));if(_0xe7efcb[_0x70ac('0x11')]){if(_0xe7efcb[_0x70ac('0x11')]['code']===0x1f4){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x2c10a0,_0xe7efcb[_0x70ac('0x11')][_0x70ac('0x12')]);return _0x1dc929(_0xe7efcb['error'][_0x70ac('0x12')]);}logger[_0x70ac('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2c10a0,_0xe7efcb[_0x70ac('0x11')][_0x70ac('0x12')]);return _0x3efeef(_0xe7efcb[_0x70ac('0x11')]['message']);}else{logger[_0x70ac('0xd')](_0x70ac('0x13'),_0x2c10a0,_0x70ac('0xe'));_0x3efeef(_0xe7efcb[_0x70ac('0x14')]['message']);}})[_0x70ac('0x15')](function(_0x3909fb){logger[_0x70ac('0x11')](_0x70ac('0x13'),_0x2c10a0,_0x3909fb);_0x1dc929(_0x3909fb);});});} \ No newline at end of file +var _0x82e3=['info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x1fa4b0,_0x3ec8c4){var _0x16dfb3=function(_0x55cb93){while(--_0x55cb93){_0x1fa4b0['push'](_0x1fa4b0['shift']());}};_0x16dfb3(++_0x3ec8c4);}(_0x82e3,0x11e));var _0x382e=function(_0x5e8282,_0x1f2962){_0x5e8282=_0x5e8282-0x0;var _0x5cd37d=_0x82e3[_0x5e8282];return _0x5cd37d;};'use strict';var _=require(_0x382e('0x0'));var util=require(_0x382e('0x1'));var moment=require(_0x382e('0x2'));var BPromise=require('bluebird');var rs=require(_0x382e('0x3'));var fs=require('fs');var Redis=require(_0x382e('0x4'));var db=require(_0x382e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x382e('0x6'))(_0x382e('0x7'));var config=require(_0x382e('0x8'));var jayson=require(_0x382e('0x9'));var client=jayson[_0x382e('0xa')][_0x382e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bf6c1,_0xcf7d50,_0x535d4a){return new BPromise(function(_0x4efcb5,_0x1f3ada){return client['request'](_0x3bf6c1,_0x535d4a)[_0x382e('0xc')](function(_0x2a01d9){logger[_0x382e('0xd')](_0x382e('0xe'),_0xcf7d50,_0x382e('0xf'));logger['debug'](_0x382e('0x10'),_0xcf7d50,_0x382e('0xf'),JSON[_0x382e('0x11')](_0x2a01d9));if(_0x2a01d9[_0x382e('0x12')]){if(_0x2a01d9[_0x382e('0x12')][_0x382e('0x13')]===0x1f4){logger[_0x382e('0x12')](_0x382e('0xe'),_0xcf7d50,_0x2a01d9[_0x382e('0x12')][_0x382e('0x14')]);return _0x1f3ada(_0x2a01d9['error'][_0x382e('0x14')]);}logger[_0x382e('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0xcf7d50,_0x2a01d9[_0x382e('0x12')][_0x382e('0x14')]);return _0x4efcb5(_0x2a01d9[_0x382e('0x12')][_0x382e('0x14')]);}else{logger[_0x382e('0xd')](_0x382e('0xe'),_0xcf7d50,'request\x20sent');_0x4efcb5(_0x2a01d9[_0x382e('0x15')][_0x382e('0x14')]);}})[_0x382e('0x16')](function(_0x246a9d){logger[_0x382e('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0xcf7d50,_0x246a9d);_0x1f3ada(_0x246a9d);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 2d9a26d..f748fe3 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 _0x59f2=['show','/:id/questions','getQuestions','create','put','update','destroy','exports','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/describe','describe','get','/:id'];(function(_0x2bebd3,_0x1f154b){var _0x2018b3=function(_0x141935){while(--_0x141935){_0x2bebd3['push'](_0x2bebd3['shift']());}};_0x2018b3(++_0x1f154b);}(_0x59f2,0x138));var _0x259f=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x59f2[_0x122096];return _0x3d1966;};'use strict';var multer=require('multer');var util=require(_0x259f('0x0'));var path=require('path');var timeout=require(_0x259f('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x259f('0x2'));var auth=require(_0x259f('0x3'));var interaction=require(_0x259f('0x4'));var config=require('../../config/environment');var controller=require('./jscriptySessionReport.controller');router['get']('/',auth[_0x259f('0x5')](),controller[_0x259f('0x6')]);router['get'](_0x259f('0x7'),auth[_0x259f('0x5')](),controller[_0x259f('0x8')]);router[_0x259f('0x9')](_0x259f('0xa'),auth[_0x259f('0x5')](),controller[_0x259f('0xb')]);router['get'](_0x259f('0xc'),auth[_0x259f('0x5')](),controller[_0x259f('0xd')]);router['post']('/',auth[_0x259f('0x5')](),controller[_0x259f('0xe')]);router[_0x259f('0xf')](_0x259f('0xa'),auth[_0x259f('0x5')](),controller[_0x259f('0x10')]);router['delete'](_0x259f('0xa'),auth[_0x259f('0x5')](),controller[_0x259f('0x11')]);module[_0x259f('0x12')]=router; \ No newline at end of file +var _0x6b52=['post','create','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','describe','/:id','/:id/questions','getQuestions'];(function(_0x6455f4,_0x487e9c){var _0x3c4016=function(_0x2ac63c){while(--_0x2ac63c){_0x6455f4['push'](_0x6455f4['shift']());}};_0x3c4016(++_0x487e9c);}(_0x6b52,0x14f));var _0x26b5=function(_0x237340,_0x39b15d){_0x237340=_0x237340-0x0;var _0x5542c8=_0x6b52[_0x237340];return _0x5542c8;};'use strict';var multer=require(_0x26b5('0x0'));var util=require(_0x26b5('0x1'));var path=require(_0x26b5('0x2'));var timeout=require(_0x26b5('0x3'));var express=require(_0x26b5('0x4'));var router=express['Router']();var fs_extra=require(_0x26b5('0x5'));var auth=require(_0x26b5('0x6'));var interaction=require(_0x26b5('0x7'));var config=require(_0x26b5('0x8'));var controller=require(_0x26b5('0x9'));router[_0x26b5('0xa')]('/',auth[_0x26b5('0xb')](),controller[_0x26b5('0xc')]);router['get']('/describe',auth[_0x26b5('0xb')](),controller[_0x26b5('0xd')]);router['get'](_0x26b5('0xe'),auth[_0x26b5('0xb')](),controller['show']);router[_0x26b5('0xa')](_0x26b5('0xf'),auth[_0x26b5('0xb')](),controller[_0x26b5('0x10')]);router[_0x26b5('0x11')]('/',auth[_0x26b5('0xb')](),controller[_0x26b5('0x12')]);router['put'](_0x26b5('0xe'),auth[_0x26b5('0xb')](),controller[_0x26b5('0x13')]);router['delete'](_0x26b5('0xe'),auth['isAuthenticated'](),controller[_0x26b5('0x14')]);module[_0x26b5('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 004a6ce..e090851 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 _0xf4de=['setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','DATE'];(function(_0x4f70f1,_0xae02d3){var _0x427899=function(_0x376f1d){while(--_0x376f1d){_0x4f70f1['push'](_0x4f70f1['shift']());}};_0x427899(++_0xae02d3);}(_0xf4de,0xdf));var _0xef4d=function(_0x42d5be,_0x18af0a){_0x42d5be=_0x42d5be-0x0;var _0x3b9c89=_0xf4de[_0x42d5be];return _0x3b9c89;};'use strict';var moment=require(_0xef4d('0x0'));var Sequelize=require('sequelize');module['exports']={'starttime':{'type':Sequelize[_0xef4d('0x1')],'set':function(_0xe2eedc){this[_0xef4d('0x2')](_0xef4d('0x3'),_0xe2eedc);this[_0xef4d('0x2')](_0xef4d('0x4'),moment()[_0xef4d('0x5')](_0xef4d('0x6')));}},'endtime':{'type':Sequelize[_0xef4d('0x1')]},'membername':{'type':Sequelize[_0xef4d('0x7')]},'projectname':{'type':Sequelize[_0xef4d('0x7')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xef4d('0x7')]},'calleridname':{'type':Sequelize[_0xef4d('0x7')]},'calleridnum':{'type':Sequelize[_0xef4d('0x7')]},'completed':{'type':Sequelize[_0xef4d('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x657b=['setDataValue','STRING','moment','sequelize','exports','DATE'];(function(_0x246f0c,_0x39f734){var _0x30fe50=function(_0x9a975c){while(--_0x9a975c){_0x246f0c['push'](_0x246f0c['shift']());}};_0x30fe50(++_0x39f734);}(_0x657b,0x98));var _0xb657=function(_0x4e659c,_0x26e3bf){_0x4e659c=_0x4e659c-0x0;var _0x34d772=_0x657b[_0x4e659c];return _0x34d772;};'use strict';var moment=require(_0xb657('0x0'));var Sequelize=require(_0xb657('0x1'));module[_0xb657('0x2')]={'starttime':{'type':Sequelize[_0xb657('0x3')],'set':function(_0x2483bf){this[_0xb657('0x4')]('starttime',_0x2483bf);this['setDataValue']('endtime',moment()['format']('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xb657('0x5')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xb657('0x5')]},'uniqueid':{'type':Sequelize[_0xb657('0x5')]},'calleridname':{'type':Sequelize[_0xb657('0x5')]},'calleridnum':{'type':Sequelize['STRING']},'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 e3b7529..5dde32e 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 _0xd5cc=['undefined','count','offset','Content-Range','json','reject','save','update','then','destroy','error','stack','name','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','findOne','JscriptyQuestionReport','SessionId','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','limit'];(function(_0x1b7c0b,_0x1e9a6c){var _0x466423=function(_0xf43f57){while(--_0xf43f57){_0x1b7c0b['push'](_0x1b7c0b['shift']());}};_0x466423(++_0x1e9a6c);}(_0xd5cc,0x121));var _0xcd5c=function(_0x34b28a,_0x229607){_0x34b28a=_0x34b28a-0x0;var _0xbbe2aa=_0xd5cc[_0x34b28a];return _0xbbe2aa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcd5c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcd5c('0x1'));var rp=require('request-promise');var moment=require(_0xcd5c('0x2'));var BPromise=require(_0xcd5c('0x3'));var Mustache=require('mustache');var util=require(_0xcd5c('0x4'));var path=require(_0xcd5c('0x5'));var sox=require(_0xcd5c('0x6'));var csv=require(_0xcd5c('0x7'));var ejs=require(_0xcd5c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcd5c('0x9'));var squel=require(_0xcd5c('0xa'));var crypto=require(_0xcd5c('0xb'));var jsforce=require(_0xcd5c('0xc'));var deskjs=require(_0xcd5c('0xd'));var toCsv=require(_0xcd5c('0x7'));var querystring=require(_0xcd5c('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xcd5c('0xf'));var qs=require(_0xcd5c('0x10'));var as=require(_0xcd5c('0x11'));var hardwareService=require(_0xcd5c('0x12'));var logger=require(_0xcd5c('0x13'))(_0xcd5c('0x14'));var utils=require('../../config/utils');var config=require(_0xcd5c('0x15'));var licenseUtil=require(_0xcd5c('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b698d,_0x2896af){_0x2896af=_0x2896af||0xcc;return function(_0x43f76a){if(_0x43f76a){return _0x5b698d[_0xcd5c('0x17')](_0x2896af);}return _0x5b698d[_0xcd5c('0x18')](_0x2896af)[_0xcd5c('0x19')]();};}function respondWithResult(_0x3c7a06,_0x48458c){_0x48458c=_0x48458c||0xc8;return function(_0x56d523){if(_0x56d523){return _0x3c7a06[_0xcd5c('0x18')](_0x48458c)['json'](_0x56d523);}};}function respondWithFilteredResult(_0x220c4b,_0xbc2296){return function(_0x47a885){if(_0x47a885){var _0x4c10f6=typeof _0xbc2296['offset']==='undefined'&&typeof _0xbc2296[_0xcd5c('0x1a')]===_0xcd5c('0x1b');var _0x25ec69=_0x47a885[_0xcd5c('0x1c')];var _0x530d40=_0x4c10f6?0x0:_0xbc2296[_0xcd5c('0x1d')];var _0x14d8cc=_0x4c10f6?_0x47a885[_0xcd5c('0x1c')]:_0xbc2296[_0xcd5c('0x1d')]+_0xbc2296[_0xcd5c('0x1a')];var _0x143360;if(_0x14d8cc>=_0x25ec69){_0x14d8cc=_0x25ec69;_0x143360=0xc8;}else{_0x143360=0xce;}_0x220c4b[_0xcd5c('0x18')](_0x143360);return _0x220c4b['set'](_0xcd5c('0x1e'),_0x530d40+'-'+_0x14d8cc+'/'+_0x25ec69)[_0xcd5c('0x1f')](_0x47a885);}return null;};}function patchUpdates(_0x11d4e9){return function(_0x38d04c){try{jsonpatch['apply'](_0x38d04c,_0x11d4e9,!![]);}catch(_0x4e99eb){return BPromise[_0xcd5c('0x20')](_0x4e99eb);}return _0x38d04c[_0xcd5c('0x21')]();};}function saveUpdates(_0x29a9f8,_0x34fef1){return function(_0x3ac527){if(_0x3ac527){return _0x3ac527[_0xcd5c('0x22')](_0x29a9f8)[_0xcd5c('0x23')](function(_0x2737bd){return _0x2737bd;});}return null;};}function removeEntity(_0x1b21e5,_0x52eafc){return function(_0x340bb5){if(_0x340bb5){return _0x340bb5[_0xcd5c('0x24')]()['then'](function(){_0x1b21e5[_0xcd5c('0x18')](0xcc)[_0xcd5c('0x19')]();});}};}function handleEntityNotFound(_0x7af4f5,_0x5dde93){return function(_0xa848da){if(!_0xa848da){_0x7af4f5[_0xcd5c('0x17')](0x194);}return _0xa848da;};}function handleError(_0x327f71,_0x172dc0){_0x172dc0=_0x172dc0||0x1f4;return function(_0xfec92e){logger[_0xcd5c('0x25')](_0xfec92e[_0xcd5c('0x26')]);if(_0xfec92e[_0xcd5c('0x27')]){delete _0xfec92e[_0xcd5c('0x27')];}_0x327f71[_0xcd5c('0x18')](_0x172dc0)['send'](_0xfec92e);};}exports[_0xcd5c('0x28')]=function(_0x59cd2d,_0x2daaa2){var _0x851647={},_0x33d563={},_0x33276f={'count':0x0,'rows':[]};var _0xd66da9=_[_0xcd5c('0x29')](db[_0xcd5c('0x2a')][_0xcd5c('0x2b')],function(_0x1df0e0){return{'name':_0x1df0e0[_0xcd5c('0x2c')],'type':_0x1df0e0[_0xcd5c('0x2d')][_0xcd5c('0x2e')]};});_0x33d563[_0xcd5c('0x2f')]=_['map'](_0xd66da9,_0xcd5c('0x27'));_0x33d563[_0xcd5c('0x30')]=_[_0xcd5c('0x31')](_0x59cd2d[_0xcd5c('0x30')]);_0x33d563[_0xcd5c('0x32')]=_[_0xcd5c('0x33')](_0x33d563['model'],_0x33d563[_0xcd5c('0x30')]);_0x851647[_0xcd5c('0x34')]=_[_0xcd5c('0x33')](_0x33d563['model'],qs[_0xcd5c('0x35')](_0x59cd2d['query'][_0xcd5c('0x35')]));_0x851647[_0xcd5c('0x34')]=_0x851647[_0xcd5c('0x34')][_0xcd5c('0x36')]?_0x851647[_0xcd5c('0x34')]:_0x33d563['model'];if(!_0x59cd2d[_0xcd5c('0x30')][_0xcd5c('0x37')](_0xcd5c('0x38'))){_0x851647[_0xcd5c('0x1a')]=qs['limit'](_0x59cd2d['query'][_0xcd5c('0x1a')]);_0x851647[_0xcd5c('0x1d')]=qs[_0xcd5c('0x1d')](_0x59cd2d[_0xcd5c('0x30')][_0xcd5c('0x1d')]);}_0x851647[_0xcd5c('0x39')]=qs[_0xcd5c('0x3a')](_0x59cd2d[_0xcd5c('0x30')][_0xcd5c('0x3a')]);_0x851647[_0xcd5c('0x3b')]=qs['filters'](_[_0xcd5c('0x3c')](_0x59cd2d[_0xcd5c('0x30')],_0x33d563[_0xcd5c('0x32')]),_0xd66da9);if(_0x59cd2d[_0xcd5c('0x30')][_0xcd5c('0x3d')]){_0x851647[_0xcd5c('0x3b')]=_[_0xcd5c('0x3e')](_0x851647[_0xcd5c('0x3b')],{'$or':_[_0xcd5c('0x29')](_0xd66da9,function(_0x3ddd5b){if(_0x3ddd5b[_0xcd5c('0x2d')]!==_0xcd5c('0x3f')){var _0x4c4e0b={};_0x4c4e0b[_0x3ddd5b[_0xcd5c('0x27')]]={'$like':'%'+_0x59cd2d['query'][_0xcd5c('0x3d')]+'%'};return _0x4c4e0b;}})});}_0x851647=_[_0xcd5c('0x3e')]({},_0x851647,_0x59cd2d[_0xcd5c('0x40')]);var _0x392c86={'where':_0x851647[_0xcd5c('0x3b')]};return db[_0xcd5c('0x2a')][_0xcd5c('0x1c')](_0x392c86)[_0xcd5c('0x23')](function(_0x52e44f){_0x33276f[_0xcd5c('0x1c')]=_0x52e44f;if(_0x59cd2d[_0xcd5c('0x30')][_0xcd5c('0x41')]){_0x851647[_0xcd5c('0x42')]=[{'all':!![]}];}return db[_0xcd5c('0x2a')][_0xcd5c('0x43')](_0x851647);})[_0xcd5c('0x23')](function(_0x30a3ba){_0x33276f[_0xcd5c('0x44')]=_0x30a3ba;return _0x33276f;})[_0xcd5c('0x23')](respondWithFilteredResult(_0x2daaa2,_0x851647))[_0xcd5c('0x45')](handleError(_0x2daaa2,null));};exports[_0xcd5c('0x46')]=function(_0x10363b,_0xd158a2){var _0x4e3e31={'raw':!![],'where':{'id':_0x10363b[_0xcd5c('0x47')]['id']}},_0x98f3ae={};_0x98f3ae[_0xcd5c('0x2f')]=_['keys'](db[_0xcd5c('0x2a')][_0xcd5c('0x2b')]);_0x98f3ae[_0xcd5c('0x30')]=_['keys'](_0x10363b[_0xcd5c('0x30')]);_0x98f3ae[_0xcd5c('0x32')]=_[_0xcd5c('0x33')](_0x98f3ae[_0xcd5c('0x2f')],_0x98f3ae[_0xcd5c('0x30')]);_0x4e3e31['attributes']=_[_0xcd5c('0x33')](_0x98f3ae[_0xcd5c('0x2f')],qs[_0xcd5c('0x35')](_0x10363b[_0xcd5c('0x30')][_0xcd5c('0x35')]));_0x4e3e31[_0xcd5c('0x34')]=_0x4e3e31[_0xcd5c('0x34')][_0xcd5c('0x36')]?_0x4e3e31['attributes']:_0x98f3ae['model'];if(_0x10363b['query']['includeAll']){_0x4e3e31['include']=[{'all':!![]}];}_0x4e3e31=_[_0xcd5c('0x3e')]({},_0x4e3e31,_0x10363b[_0xcd5c('0x40')]);return db[_0xcd5c('0x2a')][_0xcd5c('0x48')](_0x4e3e31)[_0xcd5c('0x23')](handleEntityNotFound(_0xd158a2,null))[_0xcd5c('0x23')](respondWithResult(_0xd158a2,null))[_0xcd5c('0x45')](handleError(_0xd158a2,null));};exports[_0xcd5c('0x49')]=function(_0x5bfaca,_0x3e29a0){return db[_0xcd5c('0x2a')]['create'](_0x5bfaca[_0xcd5c('0x4a')],{})[_0xcd5c('0x23')](respondWithResult(_0x3e29a0,0xc9))[_0xcd5c('0x45')](handleError(_0x3e29a0,null));};exports[_0xcd5c('0x22')]=function(_0x5b4b5f,_0x2eb78c){if(_0x5b4b5f['body']['id']){delete _0x5b4b5f[_0xcd5c('0x4a')]['id'];}return db[_0xcd5c('0x2a')][_0xcd5c('0x48')]({'where':{'id':_0x5b4b5f[_0xcd5c('0x47')]['id']}})[_0xcd5c('0x23')](handleEntityNotFound(_0x2eb78c,null))[_0xcd5c('0x23')](saveUpdates(_0x5b4b5f[_0xcd5c('0x4a')],null))[_0xcd5c('0x23')](respondWithResult(_0x2eb78c,null))[_0xcd5c('0x45')](handleError(_0x2eb78c,null));};exports['destroy']=function(_0x50fae2,_0x4d061e){return db[_0xcd5c('0x2a')][_0xcd5c('0x48')]({'where':{'id':_0x50fae2[_0xcd5c('0x47')]['id']}})[_0xcd5c('0x23')](handleEntityNotFound(_0x4d061e,null))[_0xcd5c('0x23')](removeEntity(_0x4d061e,null))[_0xcd5c('0x45')](handleError(_0x4d061e,null));};exports[_0xcd5c('0x4b')]=function(_0x98d08f,_0x297569){return db['JscriptySessionReport'][_0xcd5c('0x4b')]()[_0xcd5c('0x23')](respondWithResult(_0x297569,null))[_0xcd5c('0x45')](handleError(_0x297569,null));};exports['getQuestions']=function(_0x4d0e52,_0x5d0d3e,_0xf7e33b){var _0x3f9c66={'raw':!![],'where':{}};var _0xd82ec8={};var _0x47bea0={'count':0x0,'rows':[]};return db[_0xcd5c('0x2a')][_0xcd5c('0x4c')]({'where':{'id':_0x4d0e52['params']['id']}})[_0xcd5c('0x23')](handleEntityNotFound(_0x5d0d3e,null))[_0xcd5c('0x23')](function(_0x4c23c4){if(_0x4c23c4){_0xd82ec8[_0xcd5c('0x2f')]=_[_0xcd5c('0x31')](db[_0xcd5c('0x4d')][_0xcd5c('0x2b')]);_0xd82ec8['query']=_[_0xcd5c('0x31')](_0x4d0e52[_0xcd5c('0x30')]);_0xd82ec8[_0xcd5c('0x32')]=_[_0xcd5c('0x33')](_0xd82ec8[_0xcd5c('0x2f')],_0xd82ec8['query']);_0x3f9c66[_0xcd5c('0x34')]=_[_0xcd5c('0x33')](_0xd82ec8['model'],qs[_0xcd5c('0x35')](_0x4d0e52[_0xcd5c('0x30')][_0xcd5c('0x35')]));_0x3f9c66[_0xcd5c('0x34')]=_0x3f9c66['attributes'][_0xcd5c('0x36')]?_0x3f9c66[_0xcd5c('0x34')]:_0xd82ec8[_0xcd5c('0x2f')];if(!_0x4d0e52['query'][_0xcd5c('0x37')](_0xcd5c('0x38'))){_0x3f9c66[_0xcd5c('0x1a')]=qs[_0xcd5c('0x1a')](_0x4d0e52[_0xcd5c('0x30')][_0xcd5c('0x1a')]);_0x3f9c66[_0xcd5c('0x1d')]=qs[_0xcd5c('0x1d')](_0x4d0e52['query']['offset']);}_0x3f9c66[_0xcd5c('0x39')]=qs[_0xcd5c('0x3a')](_0x4d0e52[_0xcd5c('0x30')][_0xcd5c('0x3a')]);_0x3f9c66[_0xcd5c('0x3b')]=qs[_0xcd5c('0x32')](_['pick'](_0x4d0e52[_0xcd5c('0x30')],_0xd82ec8[_0xcd5c('0x32')]));_0x3f9c66['where'][_0xcd5c('0x4e')]=_0x4c23c4['id'];if(_0x4d0e52['query'][_0xcd5c('0x3d')]){_0x3f9c66['where']=_[_0xcd5c('0x3e')](_0x3f9c66[_0xcd5c('0x3b')],{'$or':_['map'](_0x3f9c66[_0xcd5c('0x34')],function(_0xc37b49){var _0x20dd2c={};_0x20dd2c[_0xc37b49]={'$like':'%'+_0x4d0e52[_0xcd5c('0x30')]['filter']+'%'};return _0x20dd2c;})});}_0x3f9c66=_['merge']({},_0x3f9c66,_0x4d0e52[_0xcd5c('0x40')]);return db[_0xcd5c('0x4d')][_0xcd5c('0x1c')]({'where':_0x3f9c66[_0xcd5c('0x3b')]})[_0xcd5c('0x23')](function(_0xdef80e){_0x47bea0[_0xcd5c('0x1c')]=_0xdef80e;if(_0x4d0e52[_0xcd5c('0x30')][_0xcd5c('0x41')]){_0x3f9c66['include']=[{'all':!![]}];}return db[_0xcd5c('0x4d')][_0xcd5c('0x43')](_0x3f9c66);})['then'](function(_0x304e6e){_0x47bea0[_0xcd5c('0x44')]=_0x304e6e;return _0x47bea0;});}})[_0xcd5c('0x23')](respondWithFilteredResult(_0x5d0d3e,_0x3f9c66))[_0xcd5c('0x45')](handleError(_0x5d0d3e,null));}; \ No newline at end of file +var _0xf319=['include','rows','catch','params','length','includeAll','create','body','find','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','findAll','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','then','end','stack','name','map','JscriptySessionReport','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options'];(function(_0x1e249d,_0x10929a){var _0x17d07c=function(_0x43a765){while(--_0x43a765){_0x1e249d['push'](_0x1e249d['shift']());}};_0x17d07c(++_0x10929a);}(_0xf319,0x143));var _0x9f31=function(_0x455756,_0x4ba008){_0x455756=_0x455756-0x0;var _0x4f1a9b=_0xf319[_0x455756];return _0x4f1a9b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9f31('0x0'));var zipdir=require(_0x9f31('0x1'));var jsonpatch=require(_0x9f31('0x2'));var rp=require(_0x9f31('0x3'));var moment=require(_0x9f31('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9f31('0x5'));var util=require(_0x9f31('0x6'));var path=require('path');var sox=require(_0x9f31('0x7'));var csv=require(_0x9f31('0x8'));var ejs=require(_0x9f31('0x9'));var fs=require('fs');var fs_extra=require(_0x9f31('0xa'));var _=require(_0x9f31('0xb'));var squel=require('squel');var crypto=require(_0x9f31('0xc'));var jsforce=require(_0x9f31('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9f31('0xe'));var Papa=require(_0x9f31('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9f31('0x10'));var as=require(_0x9f31('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9f31('0x12'))(_0x9f31('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9f31('0x14'));var db=require(_0x9f31('0x15'))['db'];function respondWithStatusCode(_0x5309bb,_0x796958){_0x796958=_0x796958||0xcc;return function(_0x343797){if(_0x343797){return _0x5309bb[_0x9f31('0x16')](_0x796958);}return _0x5309bb[_0x9f31('0x17')](_0x796958)['end']();};}function respondWithResult(_0x5d88a7,_0x48b15d){_0x48b15d=_0x48b15d||0xc8;return function(_0x27faa3){if(_0x27faa3){return _0x5d88a7[_0x9f31('0x17')](_0x48b15d)[_0x9f31('0x18')](_0x27faa3);}};}function respondWithFilteredResult(_0x3b12d9,_0x141863){return function(_0x4bc633){if(_0x4bc633){var _0x3770f2=typeof _0x141863['offset']===_0x9f31('0x19')&&typeof _0x141863[_0x9f31('0x1a')]==='undefined';var _0x2a7993=_0x4bc633[_0x9f31('0x1b')];var _0x183888=_0x3770f2?0x0:_0x141863[_0x9f31('0x1c')];var _0x1c705e=_0x3770f2?_0x4bc633[_0x9f31('0x1b')]:_0x141863[_0x9f31('0x1c')]+_0x141863['limit'];var _0x5efc50;if(_0x1c705e>=_0x2a7993){_0x1c705e=_0x2a7993;_0x5efc50=0xc8;}else{_0x5efc50=0xce;}_0x3b12d9[_0x9f31('0x17')](_0x5efc50);return _0x3b12d9[_0x9f31('0x1d')](_0x9f31('0x1e'),_0x183888+'-'+_0x1c705e+'/'+_0x2a7993)[_0x9f31('0x18')](_0x4bc633);}return null;};}function patchUpdates(_0x3ed32a){return function(_0x4b7eb6){try{jsonpatch[_0x9f31('0x1f')](_0x4b7eb6,_0x3ed32a,!![]);}catch(_0x549763){return BPromise['reject'](_0x549763);}return _0x4b7eb6[_0x9f31('0x20')]();};}function saveUpdates(_0x5689d4,_0xb0a1f){return function(_0x393c30){if(_0x393c30){return _0x393c30[_0x9f31('0x21')](_0x5689d4)['then'](function(_0x2a0c6f){return _0x2a0c6f;});}return null;};}function removeEntity(_0x5807da,_0xd593c4){return function(_0x5488c4){if(_0x5488c4){return _0x5488c4[_0x9f31('0x22')]()[_0x9f31('0x23')](function(){_0x5807da['status'](0xcc)[_0x9f31('0x24')]();});}};}function handleEntityNotFound(_0x161731,_0x4c77ff){return function(_0x1827ef){if(!_0x1827ef){_0x161731[_0x9f31('0x16')](0x194);}return _0x1827ef;};}function handleError(_0x5530b5,_0x358656){_0x358656=_0x358656||0x1f4;return function(_0x1d21c4){logger['error'](_0x1d21c4[_0x9f31('0x25')]);if(_0x1d21c4[_0x9f31('0x26')]){delete _0x1d21c4[_0x9f31('0x26')];}_0x5530b5[_0x9f31('0x17')](_0x358656)['send'](_0x1d21c4);};}exports['index']=function(_0x470227,_0x4deea5){var _0xe3a714={},_0x38c41c={},_0x12bcf4={'count':0x0,'rows':[]};var _0x4e094f=_[_0x9f31('0x27')](db[_0x9f31('0x28')][_0x9f31('0x29')],function(_0x3d6546){return{'name':_0x3d6546[_0x9f31('0x2a')],'type':_0x3d6546['type'][_0x9f31('0x2b')]};});_0x38c41c['model']=_['map'](_0x4e094f,_0x9f31('0x26'));_0x38c41c[_0x9f31('0x2c')]=_[_0x9f31('0x2d')](_0x470227['query']);_0x38c41c[_0x9f31('0x2e')]=_['intersection'](_0x38c41c[_0x9f31('0x2f')],_0x38c41c[_0x9f31('0x2c')]);_0xe3a714[_0x9f31('0x30')]=_[_0x9f31('0x31')](_0x38c41c[_0x9f31('0x2f')],qs[_0x9f31('0x32')](_0x470227['query'][_0x9f31('0x32')]));_0xe3a714['attributes']=_0xe3a714[_0x9f31('0x30')]['length']?_0xe3a714[_0x9f31('0x30')]:_0x38c41c[_0x9f31('0x2f')];if(!_0x470227['query'][_0x9f31('0x33')](_0x9f31('0x34'))){_0xe3a714[_0x9f31('0x1a')]=qs['limit'](_0x470227['query'][_0x9f31('0x1a')]);_0xe3a714[_0x9f31('0x1c')]=qs[_0x9f31('0x1c')](_0x470227[_0x9f31('0x2c')][_0x9f31('0x1c')]);}_0xe3a714[_0x9f31('0x35')]=qs[_0x9f31('0x36')](_0x470227[_0x9f31('0x2c')]['sort']);_0xe3a714[_0x9f31('0x37')]=qs[_0x9f31('0x2e')](_[_0x9f31('0x38')](_0x470227[_0x9f31('0x2c')],_0x38c41c['filters']),_0x4e094f);if(_0x470227['query']['filter']){_0xe3a714[_0x9f31('0x37')]=_[_0x9f31('0x39')](_0xe3a714['where'],{'$or':_[_0x9f31('0x27')](_0x4e094f,function(_0x18faca){if(_0x18faca[_0x9f31('0x3a')]!==_0x9f31('0x3b')){var _0x57b418={};_0x57b418[_0x18faca['name']]={'$like':'%'+_0x470227['query'][_0x9f31('0x3c')]+'%'};return _0x57b418;}})});}_0xe3a714=_[_0x9f31('0x39')]({},_0xe3a714,_0x470227[_0x9f31('0x3d')]);var _0xa85041={'where':_0xe3a714[_0x9f31('0x37')]};return db[_0x9f31('0x28')][_0x9f31('0x1b')](_0xa85041)[_0x9f31('0x23')](function(_0x5da0c){_0x12bcf4['count']=_0x5da0c;if(_0x470227[_0x9f31('0x2c')]['includeAll']){_0xe3a714[_0x9f31('0x3e')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0xe3a714);})[_0x9f31('0x23')](function(_0x541667){_0x12bcf4[_0x9f31('0x3f')]=_0x541667;return _0x12bcf4;})['then'](respondWithFilteredResult(_0x4deea5,_0xe3a714))[_0x9f31('0x40')](handleError(_0x4deea5,null));};exports['show']=function(_0x5977ae,_0x27a133){var _0x2303e0={'raw':!![],'where':{'id':_0x5977ae[_0x9f31('0x41')]['id']}},_0x21be88={};_0x21be88[_0x9f31('0x2f')]=_[_0x9f31('0x2d')](db[_0x9f31('0x28')][_0x9f31('0x29')]);_0x21be88[_0x9f31('0x2c')]=_[_0x9f31('0x2d')](_0x5977ae[_0x9f31('0x2c')]);_0x21be88[_0x9f31('0x2e')]=_[_0x9f31('0x31')](_0x21be88[_0x9f31('0x2f')],_0x21be88[_0x9f31('0x2c')]);_0x2303e0[_0x9f31('0x30')]=_['intersection'](_0x21be88['model'],qs['fields'](_0x5977ae[_0x9f31('0x2c')][_0x9f31('0x32')]));_0x2303e0[_0x9f31('0x30')]=_0x2303e0[_0x9f31('0x30')][_0x9f31('0x42')]?_0x2303e0[_0x9f31('0x30')]:_0x21be88[_0x9f31('0x2f')];if(_0x5977ae[_0x9f31('0x2c')][_0x9f31('0x43')]){_0x2303e0['include']=[{'all':!![]}];}_0x2303e0=_[_0x9f31('0x39')]({},_0x2303e0,_0x5977ae['options']);return db[_0x9f31('0x28')]['find'](_0x2303e0)['then'](handleEntityNotFound(_0x27a133,null))[_0x9f31('0x23')](respondWithResult(_0x27a133,null))['catch'](handleError(_0x27a133,null));};exports[_0x9f31('0x44')]=function(_0x744fbe,_0x2d1287){return db[_0x9f31('0x28')][_0x9f31('0x44')](_0x744fbe[_0x9f31('0x45')],{})[_0x9f31('0x23')](respondWithResult(_0x2d1287,0xc9))[_0x9f31('0x40')](handleError(_0x2d1287,null));};exports[_0x9f31('0x21')]=function(_0x35ff62,_0x34034c){if(_0x35ff62[_0x9f31('0x45')]['id']){delete _0x35ff62[_0x9f31('0x45')]['id'];}return db['JscriptySessionReport'][_0x9f31('0x46')]({'where':{'id':_0x35ff62[_0x9f31('0x41')]['id']}})[_0x9f31('0x23')](handleEntityNotFound(_0x34034c,null))[_0x9f31('0x23')](saveUpdates(_0x35ff62[_0x9f31('0x45')],null))['then'](respondWithResult(_0x34034c,null))[_0x9f31('0x40')](handleError(_0x34034c,null));};exports[_0x9f31('0x22')]=function(_0x3bbb44,_0x54adb5){return db['JscriptySessionReport'][_0x9f31('0x46')]({'where':{'id':_0x3bbb44[_0x9f31('0x41')]['id']}})[_0x9f31('0x23')](handleEntityNotFound(_0x54adb5,null))['then'](removeEntity(_0x54adb5,null))[_0x9f31('0x40')](handleError(_0x54adb5,null));};exports[_0x9f31('0x47')]=function(_0x1d62a2,_0x5a73bd){return db[_0x9f31('0x28')][_0x9f31('0x47')]()['then'](respondWithResult(_0x5a73bd,null))[_0x9f31('0x40')](handleError(_0x5a73bd,null));};exports[_0x9f31('0x48')]=function(_0x2c9e59,_0x47e930,_0x155ed1){var _0x172642={'raw':!![],'where':{}};var _0x1aa413={};var _0x1635e9={'count':0x0,'rows':[]};return db[_0x9f31('0x28')][_0x9f31('0x49')]({'where':{'id':_0x2c9e59['params']['id']}})[_0x9f31('0x23')](handleEntityNotFound(_0x47e930,null))[_0x9f31('0x23')](function(_0x6b6b18){if(_0x6b6b18){_0x1aa413[_0x9f31('0x2f')]=_[_0x9f31('0x2d')](db[_0x9f31('0x4a')]['rawAttributes']);_0x1aa413[_0x9f31('0x2c')]=_[_0x9f31('0x2d')](_0x2c9e59['query']);_0x1aa413[_0x9f31('0x2e')]=_[_0x9f31('0x31')](_0x1aa413[_0x9f31('0x2f')],_0x1aa413[_0x9f31('0x2c')]);_0x172642[_0x9f31('0x30')]=_[_0x9f31('0x31')](_0x1aa413[_0x9f31('0x2f')],qs[_0x9f31('0x32')](_0x2c9e59['query'][_0x9f31('0x32')]));_0x172642['attributes']=_0x172642['attributes']['length']?_0x172642['attributes']:_0x1aa413[_0x9f31('0x2f')];if(!_0x2c9e59[_0x9f31('0x2c')][_0x9f31('0x33')](_0x9f31('0x34'))){_0x172642['limit']=qs[_0x9f31('0x1a')](_0x2c9e59['query'][_0x9f31('0x1a')]);_0x172642[_0x9f31('0x1c')]=qs[_0x9f31('0x1c')](_0x2c9e59[_0x9f31('0x2c')][_0x9f31('0x1c')]);}_0x172642[_0x9f31('0x35')]=qs[_0x9f31('0x36')](_0x2c9e59[_0x9f31('0x2c')][_0x9f31('0x36')]);_0x172642[_0x9f31('0x37')]=qs[_0x9f31('0x2e')](_[_0x9f31('0x38')](_0x2c9e59['query'],_0x1aa413[_0x9f31('0x2e')]));_0x172642[_0x9f31('0x37')][_0x9f31('0x4b')]=_0x6b6b18['id'];if(_0x2c9e59[_0x9f31('0x2c')][_0x9f31('0x3c')]){_0x172642['where']=_[_0x9f31('0x39')](_0x172642['where'],{'$or':_[_0x9f31('0x27')](_0x172642[_0x9f31('0x30')],function(_0x1ca9e2){var _0x4b0562={};_0x4b0562[_0x1ca9e2]={'$like':'%'+_0x2c9e59[_0x9f31('0x2c')][_0x9f31('0x3c')]+'%'};return _0x4b0562;})});}_0x172642=_[_0x9f31('0x39')]({},_0x172642,_0x2c9e59['options']);return db[_0x9f31('0x4a')][_0x9f31('0x1b')]({'where':_0x172642[_0x9f31('0x37')]})[_0x9f31('0x23')](function(_0x407da9){_0x1635e9['count']=_0x407da9;if(_0x2c9e59['query']['includeAll']){_0x172642[_0x9f31('0x3e')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x9f31('0x4c')](_0x172642);})[_0x9f31('0x23')](function(_0x361aea){_0x1635e9[_0x9f31('0x3f')]=_0x361aea;return _0x1635e9;});}})[_0x9f31('0x23')](respondWithFilteredResult(_0x47e930,_0x172642))[_0x9f31('0x40')](handleError(_0x47e930,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 2d9a084..76a434d 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 _0xe0ae=['api','bluebird','path','rimraf','./jscriptySessionReport.attributes','define','JscriptySessionReport','report_jscripty_sessions','../../config/logger'];(function(_0x5af982,_0x941927){var _0x2738b4=function(_0x39396c){while(--_0x39396c){_0x5af982['push'](_0x5af982['shift']());}};_0x2738b4(++_0x941927);}(_0xe0ae,0xa1));var _0xee0a=function(_0x1fc18b,_0x13d27d){_0x1fc18b=_0x1fc18b-0x0;var _0x16a351=_0xe0ae[_0x1fc18b];return _0x16a351;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xee0a('0x0'))(_0xee0a('0x1'));var moment=require('moment');var BPromise=require(_0xee0a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xee0a('0x3'));var rimraf=require(_0xee0a('0x4'));var config=require('../../config/environment');var attributes=require(_0xee0a('0x5'));module['exports']=function(_0x5bef07,_0x39a302){return _0x5bef07[_0xee0a('0x6')](_0xee0a('0x7'),attributes,{'tableName':_0xee0a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b8f=['exports','define','JscriptySessionReport','report_jscripty_sessions','util','api','request-promise','path','../../config/environment','./jscriptySessionReport.attributes'];(function(_0x238837,_0x6f2b36){var _0x4ed0f0=function(_0x4bb758){while(--_0x4bb758){_0x238837['push'](_0x238837['shift']());}};_0x4ed0f0(++_0x6f2b36);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x4bf2b5,_0x4a82ae){_0x4bf2b5=_0x4bf2b5-0x0;var _0x2fb53b=_0x6b8f[_0x4bf2b5];return _0x2fb53b;};'use strict';var _=require('lodash');var util=require(_0xf6b8('0x0'));var logger=require('../../config/logger')(_0xf6b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf6b8('0x2'));var fs=require('fs');var path=require(_0xf6b8('0x3'));var rimraf=require('rimraf');var config=require(_0xf6b8('0x4'));var attributes=require(_0xf6b8('0x5'));module[_0xf6b8('0x6')]=function(_0x549eac,_0x2d035e){return _0x549eac[_0xf6b8('0x7')](_0xf6b8('0x8'),attributes,{'tableName':_0xf6b8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 126786c..8df3b01 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 _0x2da6=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x2da6,0x1dd));var _0x62da=function(_0x2e1583,_0x3d13e9){_0x2e1583=_0x2e1583-0x0;var _0x15a4df=_0x2da6[_0x2e1583];return _0x15a4df;};'use strict';var _=require(_0x62da('0x0'));var util=require(_0x62da('0x1'));var moment=require(_0x62da('0x2'));var BPromise=require(_0x62da('0x3'));var rs=require(_0x62da('0x4'));var fs=require('fs');var Redis=require(_0x62da('0x5'));var db=require(_0x62da('0x6'))['db'];var utils=require(_0x62da('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x62da('0x8'));var jayson=require(_0x62da('0x9'));var client=jayson[_0x62da('0xa')][_0x62da('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x100e73,_0x9d9139,_0x310c15){return new BPromise(function(_0x16f919,_0xbfd2b0){return client['request'](_0x100e73,_0x310c15)[_0x62da('0xc')](function(_0x2a3937){logger[_0x62da('0xd')](_0x62da('0xe'),_0x9d9139,'request\x20sent');logger[_0x62da('0xf')](_0x62da('0x10'),_0x9d9139,_0x62da('0x11'),JSON[_0x62da('0x12')](_0x2a3937));if(_0x2a3937[_0x62da('0x13')]){if(_0x2a3937['error'][_0x62da('0x14')]===0x1f4){logger[_0x62da('0x13')](_0x62da('0xe'),_0x9d9139,_0x2a3937[_0x62da('0x13')][_0x62da('0x15')]);return _0xbfd2b0(_0x2a3937['error']['message']);}logger[_0x62da('0x13')](_0x62da('0xe'),_0x9d9139,_0x2a3937[_0x62da('0x13')][_0x62da('0x15')]);return _0x16f919(_0x2a3937[_0x62da('0x13')][_0x62da('0x15')]);}else{logger[_0x62da('0xd')](_0x62da('0xe'),_0x9d9139,_0x62da('0x11'));_0x16f919(_0x2a3937[_0x62da('0x16')][_0x62da('0x15')]);}})[_0x62da('0x17')](function(_0x1f6bc8){logger[_0x62da('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x9d9139,_0x1f6bc8);_0xbfd2b0(_0x1f6bc8);});});} \ No newline at end of file +var _0x896e=['JscriptySessionReport,\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(_0x5651f4,_0x221396){var _0x4156c6=function(_0x4def51){while(--_0x4def51){_0x5651f4['push'](_0x5651f4['shift']());}};_0x4156c6(++_0x221396);}(_0x896e,0x1e9));var _0xe896=function(_0x4d8903,_0x2d5d6a){_0x4d8903=_0x4d8903-0x0;var _0x532b76=_0x896e[_0x4d8903];return _0x532b76;};'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')]('JscriptySessionReport,\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')]('JscriptySessionReport,\x20%s,\x20%s',_0x3b902c,_0x57f04b);_0x5a1909(_0x57f04b);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index a318a96..984bd1b 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 _0xe733=['../../components/auth/service','./license.controller','get','put','/:id','isAuthenticated','/download_log_file','downloadLogFile','multer','util','express','Router','fs-extra'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xe733,0x14d));var _0x3e73=function(_0x320401,_0x4ab57f){_0x320401=_0x320401-0x0;var _0x28922d=_0xe733[_0x320401];return _0x28922d;};'use strict';var multer=require(_0x3e73('0x0'));var util=require(_0x3e73('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3e73('0x2'));var router=express[_0x3e73('0x3')]();var fs_extra=require(_0x3e73('0x4'));var auth=require(_0x3e73('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3e73('0x6'));router[_0x3e73('0x7')]('/',controller['index']);router[_0x3e73('0x8')](_0x3e73('0x9'),auth[_0x3e73('0xa')](),controller['update']);router[_0x3e73('0x7')](_0x3e73('0xb'),auth[_0x3e73('0xa')](),controller[_0x3e73('0xc')]);module['exports']=router; \ No newline at end of file +var _0x845b=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','put','/:id','isAuthenticated','update','exports','multer'];(function(_0x419022,_0x2c7924){var _0xb676f0=function(_0x111e5b){while(--_0x111e5b){_0x419022['push'](_0x419022['shift']());}};_0xb676f0(++_0x2c7924);}(_0x845b,0xaf));var _0xb845=function(_0x279c42,_0x33614d){_0x279c42=_0x279c42-0x0;var _0x52eecf=_0x845b[_0x279c42];return _0x52eecf;};'use strict';var multer=require(_0xb845('0x0'));var util=require(_0xb845('0x1'));var path=require(_0xb845('0x2'));var timeout=require(_0xb845('0x3'));var express=require(_0xb845('0x4'));var router=express[_0xb845('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb845('0x6'));var interaction=require(_0xb845('0x7'));var config=require(_0xb845('0x8'));var controller=require(_0xb845('0x9'));router[_0xb845('0xa')]('/',controller['index']);router[_0xb845('0xb')](_0xb845('0xc'),auth[_0xb845('0xd')](),controller[_0xb845('0xe')]);router[_0xb845('0xa')]('/download_log_file',auth[_0xb845('0xd')](),controller['downloadLogFile']);module[_0xb845('0xf')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 33b51a7..c2a4a1a 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 _0x76c1=['INTEGER','sequelize','exports','TEXT','STRING'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x76c1,0x141));var _0x176c=function(_0x12d951,_0x249808){_0x12d951=_0x12d951-0x0;var _0x44de17=_0x76c1[_0x12d951];return _0x44de17;};'use strict';var Sequelize=require(_0x176c('0x0'));module[_0x176c('0x1')]={'license':{'type':Sequelize[_0x176c('0x2')]},'data1':{'type':Sequelize[_0x176c('0x3')]},'data2':{'type':Sequelize[_0x176c('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x176c('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0ff3=['STRING','INTEGER','sequelize','TEXT'];(function(_0x26d118,_0x56bbf3){var _0x952574=function(_0x31aba6){while(--_0x31aba6){_0x26d118['push'](_0x26d118['shift']());}};_0x952574(++_0x56bbf3);}(_0x0ff3,0x1c6));var _0x30ff=function(_0x39a7bb,_0x3616b6){_0x39a7bb=_0x39a7bb-0x0;var _0x2e1027=_0x0ff3[_0x39a7bb];return _0x2e1027;};'use strict';var Sequelize=require(_0x30ff('0x0'));module['exports']={'license':{'type':Sequelize[_0x30ff('0x1')]},'data1':{'type':Sequelize[_0x30ff('0x2')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x30ff('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 758c594..48d6a40 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 _0x2b11=['setHeader','attachment;\x20filename=','Content-Type','text/plain','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','save','then','end','error','stack','name','index','model','keys','License','rawAttributes','attributes','fields','query','length','merge','options','catch','update','body','find','params','checkLicense','key','demo','downloadLogFile','license-info.log','join','log','xcally'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x2b11,0xc1));var _0x12b1=function(_0x12c280,_0x51dd07){_0x12c280=_0x12c280-0x0;var _0x3638d3=_0x2b11[_0x12c280];return _0x3638d3;};'use strict';var emlformat=require(_0x12b1('0x0'));var rimraf=require(_0x12b1('0x1'));var zipdir=require(_0x12b1('0x2'));var jsonpatch=require(_0x12b1('0x3'));var rp=require('request-promise');var moment=require(_0x12b1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x12b1('0x5'));var util=require(_0x12b1('0x6'));var path=require(_0x12b1('0x7'));var sox=require(_0x12b1('0x8'));var csv=require(_0x12b1('0x9'));var ejs=require(_0x12b1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x12b1('0xb'));var crypto=require('crypto');var jsforce=require(_0x12b1('0xc'));var deskjs=require(_0x12b1('0xd'));var toCsv=require(_0x12b1('0x9'));var querystring=require('querystring');var Papa=require(_0x12b1('0xe'));var Redis=require(_0x12b1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x12b1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x12b1('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x12b1('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x12b1('0x13'))['db'];function respondWithStatusCode(_0x509654,_0x453f0a){_0x453f0a=_0x453f0a||0xcc;return function(_0x1ad8ac){if(_0x1ad8ac){return _0x509654[_0x12b1('0x14')](_0x453f0a);}return _0x509654['status'](_0x453f0a)['end']();};}function respondWithResult(_0x5aeef8,_0x306865){_0x306865=_0x306865||0xc8;return function(_0x2d5025){if(_0x2d5025){return _0x5aeef8[_0x12b1('0x15')](_0x306865)[_0x12b1('0x16')](_0x2d5025);}};}function respondWithFilteredResult(_0x3ba2d5,_0x155eb9){return function(_0x400393){if(_0x400393){var _0x9220f3=typeof _0x155eb9[_0x12b1('0x17')]==='undefined'&&typeof _0x155eb9[_0x12b1('0x18')]===_0x12b1('0x19');var _0x34052c=_0x400393[_0x12b1('0x1a')];var _0x31b121=_0x9220f3?0x0:_0x155eb9[_0x12b1('0x17')];var _0x496a5e=_0x9220f3?_0x400393['count']:_0x155eb9['offset']+_0x155eb9[_0x12b1('0x18')];var _0x348024;if(_0x496a5e>=_0x34052c){_0x496a5e=_0x34052c;_0x348024=0xc8;}else{_0x348024=0xce;}_0x3ba2d5['status'](_0x348024);return _0x3ba2d5[_0x12b1('0x1b')](_0x12b1('0x1c'),_0x31b121+'-'+_0x496a5e+'/'+_0x34052c)['json'](_0x400393);}return null;};}function patchUpdates(_0x59e60e){return function(_0x1e3ea9){try{jsonpatch['apply'](_0x1e3ea9,_0x59e60e,!![]);}catch(_0x4474d3){return BPromise['reject'](_0x4474d3);}return _0x1e3ea9[_0x12b1('0x1d')]();};}function saveUpdates(_0x88f34f,_0x3f73b6){return function(_0x3935c6){if(_0x3935c6){return _0x3935c6['update'](_0x88f34f)[_0x12b1('0x1e')](function(_0x4bdc1c){return _0x4bdc1c;});}return null;};}function removeEntity(_0x1d8948,_0x15f75c){return function(_0x4181de){if(_0x4181de){return _0x4181de['destroy']()[_0x12b1('0x1e')](function(){_0x1d8948[_0x12b1('0x15')](0xcc)[_0x12b1('0x1f')]();});}};}function handleEntityNotFound(_0x49e7a2,_0x2a0fab){return function(_0x1056bd){if(!_0x1056bd){_0x49e7a2[_0x12b1('0x14')](0x194);}return _0x1056bd;};}function handleError(_0x38be02,_0xafe541){_0xafe541=_0xafe541||0x1f4;return function(_0x4b7745){logger[_0x12b1('0x20')](_0x4b7745[_0x12b1('0x21')]);if(_0x4b7745[_0x12b1('0x22')]){delete _0x4b7745[_0x12b1('0x22')];}_0x38be02[_0x12b1('0x15')](_0xafe541)['send'](_0x4b7745);};}var utilLicense=require('../../config/license/util');exports[_0x12b1('0x23')]=function(_0x4480c6,_0x3a2879){var _0x1c0d07={'raw':!![],'where':{'id':0x1}},_0x42eb49={};_0x42eb49[_0x12b1('0x24')]=_[_0x12b1('0x25')](db[_0x12b1('0x26')][_0x12b1('0x27')]);_0x42eb49['query']=_['keys'](_0x4480c6['query']);_0x42eb49['filters']=_['intersection'](_0x42eb49[_0x12b1('0x24')],_0x42eb49['query']);_0x1c0d07[_0x12b1('0x28')]=_['intersection'](_0x42eb49[_0x12b1('0x24')],qs[_0x12b1('0x29')](_0x4480c6[_0x12b1('0x2a')][_0x12b1('0x29')]));_0x1c0d07[_0x12b1('0x28')]=_0x1c0d07[_0x12b1('0x28')][_0x12b1('0x2b')]?_0x1c0d07['attributes']:_0x42eb49[_0x12b1('0x24')];_0x1c0d07=_[_0x12b1('0x2c')]({},_0x1c0d07,_0x4480c6[_0x12b1('0x2d')]);return utilLicense['getLicense'](_0x1c0d07)['then'](respondWithResult(_0x3a2879,null))[_0x12b1('0x2e')](handleError(_0x3a2879,null));};exports[_0x12b1('0x2f')]=function(_0x39d4bb,_0x579042){if(_0x39d4bb[_0x12b1('0x30')]['id']){delete _0x39d4bb[_0x12b1('0x30')]['id'];}return db[_0x12b1('0x26')][_0x12b1('0x31')]({'where':{'id':_0x39d4bb[_0x12b1('0x32')]['id']}})[_0x12b1('0x1e')](handleEntityNotFound(_0x579042,null))[_0x12b1('0x1e')](function(_0x1a6cb7){var _0x5e7640=_0x1a6cb7['get']({'plain':!![]});return utilLicense[_0x12b1('0x33')](_0x5e7640,_0x39d4bb[_0x12b1('0x30')][_0x12b1('0x34')]);})['then'](function(_0x898559){if(!_0x898559[_0x12b1('0x35')]){return saveUpdates(_0x39d4bb[_0x12b1('0x30')],null);}return _0x898559;})[_0x12b1('0x1e')](respondWithResult(_0x579042,null))[_0x12b1('0x2e')](handleError(_0x579042,null));};exports[_0x12b1('0x36')]=function(_0x1db7d6,_0x344e71){var _0xb922ca=_0x12b1('0x37');var _0x303ee3=path[_0x12b1('0x38')]('/var',_0x12b1('0x39'),_0x12b1('0x3a'),_0xb922ca);_0x344e71[_0x12b1('0x3b')]('Content-disposition',_0x12b1('0x3c')+_0xb922ca);_0x344e71['set'](_0x12b1('0x3d'),_0x12b1('0x3e'));_0x344e71['download'](_0x303ee3);}; \ No newline at end of file +var _0xd1a2=['save','update','then','destroy','stack','name','send','../../config/license/util','index','keys','rawAttributes','query','model','fields','attributes','options','getLicense','catch','body','License','params','get','key','demo','downloadLogFile','license-info.log','join','/var','log','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd1a2,0x177));var _0x2d1a=function(_0x14868a,_0x34d94c){_0x14868a=_0x14868a-0x0;var _0x37256c=_0xd1a2[_0x14868a];return _0x37256c;};'use strict';var emlformat=require(_0x2d1a('0x0'));var rimraf=require(_0x2d1a('0x1'));var zipdir=require(_0x2d1a('0x2'));var jsonpatch=require(_0x2d1a('0x3'));var rp=require('request-promise');var moment=require(_0x2d1a('0x4'));var BPromise=require(_0x2d1a('0x5'));var Mustache=require(_0x2d1a('0x6'));var util=require(_0x2d1a('0x7'));var path=require('path');var sox=require(_0x2d1a('0x8'));var csv=require(_0x2d1a('0x9'));var ejs=require(_0x2d1a('0xa'));var fs=require('fs');var fs_extra=require(_0x2d1a('0xb'));var _=require('lodash');var squel=require(_0x2d1a('0xc'));var crypto=require('crypto');var jsforce=require(_0x2d1a('0xd'));var deskjs=require(_0x2d1a('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2d1a('0xf'));var Papa=require(_0x2d1a('0x10'));var Redis=require('ioredis');var authService=require(_0x2d1a('0x11'));var qs=require(_0x2d1a('0x12'));var as=require(_0x2d1a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2d1a('0x14'))(_0x2d1a('0x15'));var utils=require(_0x2d1a('0x16'));var config=require(_0x2d1a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x2d1a('0x18'))['db'];function respondWithStatusCode(_0x46bb87,_0x54d50a){_0x54d50a=_0x54d50a||0xcc;return function(_0x5d11cd){if(_0x5d11cd){return _0x46bb87[_0x2d1a('0x19')](_0x54d50a);}return _0x46bb87[_0x2d1a('0x1a')](_0x54d50a)[_0x2d1a('0x1b')]();};}function respondWithResult(_0x48c119,_0x6124d9){_0x6124d9=_0x6124d9||0xc8;return function(_0x424b0b){if(_0x424b0b){return _0x48c119[_0x2d1a('0x1a')](_0x6124d9)[_0x2d1a('0x1c')](_0x424b0b);}};}function respondWithFilteredResult(_0x3a10a7,_0x502f59){return function(_0x42120e){if(_0x42120e){var _0x1d9dd2=typeof _0x502f59['offset']===_0x2d1a('0x1d')&&typeof _0x502f59[_0x2d1a('0x1e')]==='undefined';var _0x1268ba=_0x42120e[_0x2d1a('0x1f')];var _0x31c22c=_0x1d9dd2?0x0:_0x502f59['offset'];var _0x5760df=_0x1d9dd2?_0x42120e['count']:_0x502f59[_0x2d1a('0x20')]+_0x502f59[_0x2d1a('0x1e')];var _0x21a6f9;if(_0x5760df>=_0x1268ba){_0x5760df=_0x1268ba;_0x21a6f9=0xc8;}else{_0x21a6f9=0xce;}_0x3a10a7[_0x2d1a('0x1a')](_0x21a6f9);return _0x3a10a7['set']('Content-Range',_0x31c22c+'-'+_0x5760df+'/'+_0x1268ba)[_0x2d1a('0x1c')](_0x42120e);}return null;};}function patchUpdates(_0x3ae12d){return function(_0x1dfaa8){try{jsonpatch['apply'](_0x1dfaa8,_0x3ae12d,!![]);}catch(_0x4f85cc){return BPromise['reject'](_0x4f85cc);}return _0x1dfaa8[_0x2d1a('0x21')]();};}function saveUpdates(_0x20edad,_0x1bf1bb){return function(_0x2c8398){if(_0x2c8398){return _0x2c8398[_0x2d1a('0x22')](_0x20edad)[_0x2d1a('0x23')](function(_0xf7bd2b){return _0xf7bd2b;});}return null;};}function removeEntity(_0x32a055,_0x27f530){return function(_0x61f0c4){if(_0x61f0c4){return _0x61f0c4[_0x2d1a('0x24')]()[_0x2d1a('0x23')](function(){_0x32a055[_0x2d1a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29e9e2,_0x51bed6){return function(_0x8ff6a0){if(!_0x8ff6a0){_0x29e9e2[_0x2d1a('0x19')](0x194);}return _0x8ff6a0;};}function handleError(_0x56e650,_0x48a6d9){_0x48a6d9=_0x48a6d9||0x1f4;return function(_0x2a3da3){logger['error'](_0x2a3da3[_0x2d1a('0x25')]);if(_0x2a3da3[_0x2d1a('0x26')]){delete _0x2a3da3['name'];}_0x56e650[_0x2d1a('0x1a')](_0x48a6d9)[_0x2d1a('0x27')](_0x2a3da3);};}var utilLicense=require(_0x2d1a('0x28'));exports[_0x2d1a('0x29')]=function(_0x5b69c1,_0x58851e){var _0x3a1344={'raw':!![],'where':{'id':0x1}},_0x1e9b3d={};_0x1e9b3d['model']=_[_0x2d1a('0x2a')](db['License'][_0x2d1a('0x2b')]);_0x1e9b3d[_0x2d1a('0x2c')]=_[_0x2d1a('0x2a')](_0x5b69c1[_0x2d1a('0x2c')]);_0x1e9b3d['filters']=_['intersection'](_0x1e9b3d[_0x2d1a('0x2d')],_0x1e9b3d[_0x2d1a('0x2c')]);_0x3a1344['attributes']=_['intersection'](_0x1e9b3d[_0x2d1a('0x2d')],qs[_0x2d1a('0x2e')](_0x5b69c1['query'][_0x2d1a('0x2e')]));_0x3a1344[_0x2d1a('0x2f')]=_0x3a1344[_0x2d1a('0x2f')]['length']?_0x3a1344[_0x2d1a('0x2f')]:_0x1e9b3d[_0x2d1a('0x2d')];_0x3a1344=_['merge']({},_0x3a1344,_0x5b69c1[_0x2d1a('0x30')]);return utilLicense[_0x2d1a('0x31')](_0x3a1344)[_0x2d1a('0x23')](respondWithResult(_0x58851e,null))[_0x2d1a('0x32')](handleError(_0x58851e,null));};exports[_0x2d1a('0x22')]=function(_0x320f4d,_0x22d92d){if(_0x320f4d[_0x2d1a('0x33')]['id']){delete _0x320f4d[_0x2d1a('0x33')]['id'];}return db[_0x2d1a('0x34')]['find']({'where':{'id':_0x320f4d[_0x2d1a('0x35')]['id']}})[_0x2d1a('0x23')](handleEntityNotFound(_0x22d92d,null))['then'](function(_0x290279){var _0x23bf32=_0x290279[_0x2d1a('0x36')]({'plain':!![]});return utilLicense['checkLicense'](_0x23bf32,_0x320f4d[_0x2d1a('0x33')][_0x2d1a('0x37')]);})[_0x2d1a('0x23')](function(_0x5d442a){if(!_0x5d442a[_0x2d1a('0x38')]){return saveUpdates(_0x320f4d[_0x2d1a('0x33')],null);}return _0x5d442a;})['then'](respondWithResult(_0x22d92d,null))[_0x2d1a('0x32')](handleError(_0x22d92d,null));};exports[_0x2d1a('0x39')]=function(_0x428972,_0x250ebe){var _0x2fba7a=_0x2d1a('0x3a');var _0x5c2145=path[_0x2d1a('0x3b')](_0x2d1a('0x3c'),_0x2d1a('0x3d'),'xcally',_0x2fba7a);_0x250ebe[_0x2d1a('0x3e')](_0x2d1a('0x3f'),_0x2d1a('0x40')+_0x2fba7a);_0x250ebe['set'](_0x2d1a('0x41'),_0x2d1a('0x42'));_0x250ebe[_0x2d1a('0x43')](_0x5c2145);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index dd1e7f2..73c02c6 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 _0x7acc=['../../config/logger','request-promise','path','rimraf','../../config/environment','define','License','license','lodash','util'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7acc,0xda));var _0xc7ac=function(_0x407601,_0xa2f26f){_0x407601=_0x407601-0x0;var _0x2d911e=_0x7acc[_0x407601];return _0x2d911e;};'use strict';var _=require(_0xc7ac('0x0'));var util=require(_0xc7ac('0x1'));var logger=require(_0xc7ac('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc7ac('0x3'));var fs=require('fs');var path=require(_0xc7ac('0x4'));var rimraf=require(_0xc7ac('0x5'));var config=require(_0xc7ac('0x6'));var attributes=require('./license.attributes');module['exports']=function(_0x20189b,_0x2a6cda){return _0x20189b[_0xc7ac('0x7')](_0xc7ac('0x8'),attributes,{'tableName':_0xc7ac('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c1b=['util','../../config/logger','bluebird','request-promise','path','./license.attributes','exports','define','License','license','lodash'];(function(_0x42ff0e,_0x181912){var _0x458c37=function(_0x428837){while(--_0x428837){_0x42ff0e['push'](_0x42ff0e['shift']());}};_0x458c37(++_0x181912);}(_0x4c1b,0xfc));var _0xb4c1=function(_0x42aacf,_0x437d60){_0x42aacf=_0x42aacf-0x0;var _0x36cfd0=_0x4c1b[_0x42aacf];return _0x36cfd0;};'use strict';var _=require(_0xb4c1('0x0'));var util=require(_0xb4c1('0x1'));var logger=require(_0xb4c1('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb4c1('0x3'));var rp=require(_0xb4c1('0x4'));var fs=require('fs');var path=require(_0xb4c1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb4c1('0x6'));module[_0xb4c1('0x7')]=function(_0x3f626c,_0x1902dc){return _0x3f626c[_0xb4c1('0x8')](_0xb4c1('0x9'),attributes,{'tableName':_0xb4c1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 1bd0b7d..16b79b5 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 _0xdbee=['debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','License,\x20%s,\x20%s'];(function(_0x3f9154,_0x1536e2){var _0x1a50d0=function(_0x2e1cd8){while(--_0x2e1cd8){_0x3f9154['push'](_0x3f9154['shift']());}};_0x1a50d0(++_0x1536e2);}(_0xdbee,0x92));var _0xedbe=function(_0x32ded2,_0x1ee8cd){_0x32ded2=_0x32ded2-0x0;var _0x47cc21=_0xdbee[_0x32ded2];return _0x47cc21;};'use strict';var _=require(_0xedbe('0x0'));var util=require(_0xedbe('0x1'));var moment=require(_0xedbe('0x2'));var BPromise=require(_0xedbe('0x3'));var rs=require(_0xedbe('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xedbe('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xedbe('0x6'))(_0xedbe('0x7'));var config=require(_0xedbe('0x8'));var jayson=require(_0xedbe('0x9'));var client=jayson[_0xedbe('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x261191,_0x283d23,_0x244fc6){return new BPromise(function(_0x4d2b3a,_0x3f602e){return client[_0xedbe('0xb')](_0x261191,_0x244fc6)[_0xedbe('0xc')](function(_0x28443e){logger[_0xedbe('0xd')](_0xedbe('0xe'),_0x283d23,'request\x20sent');logger[_0xedbe('0xf')](_0xedbe('0x10'),_0x283d23,_0xedbe('0x11'),JSON['stringify'](_0x28443e));if(_0x28443e[_0xedbe('0x12')]){if(_0x28443e[_0xedbe('0x12')][_0xedbe('0x13')]===0x1f4){logger['error'](_0xedbe('0xe'),_0x283d23,_0x28443e['error'][_0xedbe('0x14')]);return _0x3f602e(_0x28443e[_0xedbe('0x12')][_0xedbe('0x14')]);}logger[_0xedbe('0x12')]('License,\x20%s,\x20%s',_0x283d23,_0x28443e[_0xedbe('0x12')][_0xedbe('0x14')]);return _0x4d2b3a(_0x28443e[_0xedbe('0x12')]['message']);}else{logger[_0xedbe('0xd')](_0xedbe('0xe'),_0x283d23,'request\x20sent');_0x4d2b3a(_0x28443e[_0xedbe('0x15')]['message']);}})[_0xedbe('0x16')](function(_0x3956aa){logger['error'](_0xedbe('0xe'),_0x283d23,_0x3956aa);_0x3f602e(_0x3956aa);});});} \ No newline at end of file +var _0x5b18=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','License,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util','bluebird','randomstring'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5b18,0x106));var _0x85b1=function(_0x5645ad,_0x580ea3){_0x5645ad=_0x5645ad-0x0;var _0x17d292=_0x5b18[_0x5645ad];return _0x17d292;};'use strict';var _=require(_0x85b1('0x0'));var util=require(_0x85b1('0x1'));var moment=require('moment');var BPromise=require(_0x85b1('0x2'));var rs=require(_0x85b1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x85b1('0x4'))['db'];var utils=require(_0x85b1('0x5'));var logger=require(_0x85b1('0x6'))('rpc');var config=require(_0x85b1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x85b1('0x8')][_0x85b1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x43aba7,_0x59e3b9,_0xf75494){return new BPromise(function(_0x431d32,_0x5eec5a){return client[_0x85b1('0xa')](_0x43aba7,_0xf75494)[_0x85b1('0xb')](function(_0x53b462){logger['info'](_0x85b1('0xc'),_0x59e3b9,_0x85b1('0xd'));logger[_0x85b1('0xe')]('License,\x20%s,\x20%s,\x20%s',_0x59e3b9,_0x85b1('0xd'),JSON[_0x85b1('0xf')](_0x53b462));if(_0x53b462[_0x85b1('0x10')]){if(_0x53b462[_0x85b1('0x10')]['code']===0x1f4){logger[_0x85b1('0x10')](_0x85b1('0xc'),_0x59e3b9,_0x53b462[_0x85b1('0x10')][_0x85b1('0x11')]);return _0x5eec5a(_0x53b462[_0x85b1('0x10')][_0x85b1('0x11')]);}logger[_0x85b1('0x10')](_0x85b1('0xc'),_0x59e3b9,_0x53b462[_0x85b1('0x10')][_0x85b1('0x11')]);return _0x431d32(_0x53b462[_0x85b1('0x10')][_0x85b1('0x11')]);}else{logger['info'](_0x85b1('0xc'),_0x59e3b9,_0x85b1('0xd'));_0x431d32(_0x53b462[_0x85b1('0x12')]['message']);}})['catch'](function(_0x4d2946){logger[_0x85b1('0x10')]('License,\x20%s,\x20%s',_0x59e3b9,_0x4d2946);_0x5eec5a(_0x4d2946);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 92fb82c..8163721 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 _0xfd77=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','getAnswers','/:id/in_servers','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','create','addImap','addSmtp','addApplications','send','put','update','removeDispositions','delete','removeAnswers','removeSmtp','destroy','removeAgents','exports'];(function(_0x4d1818,_0xcfe402){var _0x239c17=function(_0x1f0830){while(--_0x1f0830){_0x4d1818['push'](_0x4d1818['shift']());}};_0x239c17(++_0xcfe402);}(_0xfd77,0x93));var _0x7fd7=function(_0x19518f,_0x33ff90){_0x19518f=_0x19518f-0x0;var _0x1d0094=_0xfd77[_0x19518f];return _0x1d0094;};'use strict';var multer=require(_0x7fd7('0x0'));var util=require(_0x7fd7('0x1'));var path=require(_0x7fd7('0x2'));var timeout=require(_0x7fd7('0x3'));var express=require(_0x7fd7('0x4'));var router=express[_0x7fd7('0x5')]();var fs_extra=require(_0x7fd7('0x6'));var auth=require(_0x7fd7('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x7fd7('0x8'));var controller=require(_0x7fd7('0x9'));router[_0x7fd7('0xa')]('/',auth[_0x7fd7('0xb')](),controller[_0x7fd7('0xc')]);router['get'](_0x7fd7('0xd'),auth['isAuthenticated'](),controller[_0x7fd7('0xe')]);router[_0x7fd7('0xa')](_0x7fd7('0xf'),auth[_0x7fd7('0xb')](),controller['show']);router[_0x7fd7('0xa')](_0x7fd7('0x10'),auth[_0x7fd7('0xb')](),controller[_0x7fd7('0x11')]);router['get']('/:id/canned_answers',auth[_0x7fd7('0xb')](),controller[_0x7fd7('0x12')]);router[_0x7fd7('0xa')](_0x7fd7('0x13'),auth[_0x7fd7('0xb')](),controller['getImap']);router[_0x7fd7('0xa')](_0x7fd7('0x14'),auth[_0x7fd7('0xb')](),controller[_0x7fd7('0x15')]);router[_0x7fd7('0xa')](_0x7fd7('0x16'),auth[_0x7fd7('0xb')](),controller[_0x7fd7('0x17')]);router[_0x7fd7('0xa')](_0x7fd7('0x18'),auth[_0x7fd7('0xb')](),controller[_0x7fd7('0x19')]);router[_0x7fd7('0xa')]('/:id/messages',auth[_0x7fd7('0xb')](),controller[_0x7fd7('0x1a')]);router[_0x7fd7('0xa')](_0x7fd7('0x1b'),auth[_0x7fd7('0xb')](),controller[_0x7fd7('0x1c')]);router[_0x7fd7('0xa')](_0x7fd7('0x1d'),auth['isAuthenticated'](),controller[_0x7fd7('0x1e')]);router[_0x7fd7('0x1f')](_0x7fd7('0x10'),auth[_0x7fd7('0xb')](),controller[_0x7fd7('0x20')]);router[_0x7fd7('0x1f')](_0x7fd7('0x21'),auth['isAuthenticated'](),controller[_0x7fd7('0x22')]);router[_0x7fd7('0x1f')]('/',auth[_0x7fd7('0xb')](),controller[_0x7fd7('0x23')]);router[_0x7fd7('0x1f')](_0x7fd7('0x13'),auth[_0x7fd7('0xb')](),controller[_0x7fd7('0x24')]);router[_0x7fd7('0x1f')](_0x7fd7('0x14'),auth[_0x7fd7('0xb')](),controller[_0x7fd7('0x25')]);router[_0x7fd7('0x1f')](_0x7fd7('0x16'),auth[_0x7fd7('0xb')](),controller['addInteraction']);router[_0x7fd7('0x1f')]('/:id/applications',auth[_0x7fd7('0xb')](),controller[_0x7fd7('0x26')]);router['post']('/:id/send',auth[_0x7fd7('0xb')](),controller[_0x7fd7('0x27')]);router[_0x7fd7('0x1f')]('/:id/users',auth[_0x7fd7('0xb')](),controller['addAgents']);router[_0x7fd7('0x28')](_0x7fd7('0xf'),auth[_0x7fd7('0xb')](),controller[_0x7fd7('0x29')]);router['delete']('/:id/dispositions',auth[_0x7fd7('0xb')](),controller[_0x7fd7('0x2a')]);router[_0x7fd7('0x2b')]('/:id/canned_answers',auth[_0x7fd7('0xb')](),controller[_0x7fd7('0x2c')]);router[_0x7fd7('0x2b')](_0x7fd7('0x13'),auth[_0x7fd7('0xb')](),controller['removeImap']);router[_0x7fd7('0x2b')](_0x7fd7('0x14'),auth[_0x7fd7('0xb')](),controller[_0x7fd7('0x2d')]);router[_0x7fd7('0x2b')]('/:id',auth['isAuthenticated'](),controller[_0x7fd7('0x2e')]);router[_0x7fd7('0x2b')](_0x7fd7('0x1d'),auth[_0x7fd7('0xb')](),controller[_0x7fd7('0x2f')]);module[_0x7fd7('0x30')]=router; \ No newline at end of file +var _0x6569=['removeDispositions','removeImap','removeSmtp','destroy','removeAgents','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','index','describe','/:id','isAuthenticated','/:id/dispositions','/:id/in_servers','/:id/out_servers','/:id/interactions','/:id/applications','getApplications','getMessages','/:id/users','addDisposition','post','/:id/canned_answers','create','addSmtp','addInteraction','addAgents','delete'];(function(_0x4215e0,_0x1fd9a6){var _0x5de034=function(_0x69f91){while(--_0x69f91){_0x4215e0['push'](_0x4215e0['shift']());}};_0x5de034(++_0x1fd9a6);}(_0x6569,0x1f0));var _0x9656=function(_0x2b9850,_0x160dd3){_0x2b9850=_0x2b9850-0x0;var _0x6a8dcb=_0x6569[_0x2b9850];return _0x6a8dcb;};'use strict';var multer=require('multer');var util=require(_0x9656('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9656('0x1'));var router=express[_0x9656('0x2')]();var fs_extra=require(_0x9656('0x3'));var auth=require(_0x9656('0x4'));var interaction=require(_0x9656('0x5'));var config=require(_0x9656('0x6'));var controller=require(_0x9656('0x7'));router[_0x9656('0x8')]('/',auth['isAuthenticated'](),controller[_0x9656('0x9')]);router[_0x9656('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x9656('0xa')]);router[_0x9656('0x8')](_0x9656('0xb'),auth[_0x9656('0xc')](),controller['show']);router[_0x9656('0x8')](_0x9656('0xd'),auth[_0x9656('0xc')](),controller['getDispositions']);router[_0x9656('0x8')]('/:id/canned_answers',auth[_0x9656('0xc')](),controller['getAnswers']);router[_0x9656('0x8')](_0x9656('0xe'),auth[_0x9656('0xc')](),controller['getImap']);router['get'](_0x9656('0xf'),auth['isAuthenticated'](),controller['getSmtp']);router['get'](_0x9656('0x10'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x9656('0x8')](_0x9656('0x11'),auth[_0x9656('0xc')](),controller[_0x9656('0x12')]);router[_0x9656('0x8')]('/:id/messages',auth[_0x9656('0xc')](),controller[_0x9656('0x13')]);router[_0x9656('0x8')]('/:id/verify',auth[_0x9656('0xc')](),controller['verifySmtp']);router[_0x9656('0x8')](_0x9656('0x14'),auth[_0x9656('0xc')](),controller['getAgents']);router['post'](_0x9656('0xd'),auth['isAuthenticated'](),controller[_0x9656('0x15')]);router[_0x9656('0x16')](_0x9656('0x17'),auth[_0x9656('0xc')](),controller['addAnswer']);router['post']('/',auth[_0x9656('0xc')](),controller[_0x9656('0x18')]);router[_0x9656('0x16')](_0x9656('0xe'),auth[_0x9656('0xc')](),controller['addImap']);router[_0x9656('0x16')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0x9656('0x19')]);router['post'](_0x9656('0x10'),auth[_0x9656('0xc')](),controller[_0x9656('0x1a')]);router[_0x9656('0x16')](_0x9656('0x11'),auth[_0x9656('0xc')](),controller['addApplications']);router[_0x9656('0x16')]('/:id/send',auth[_0x9656('0xc')](),controller['send']);router[_0x9656('0x16')]('/:id/users',auth[_0x9656('0xc')](),controller[_0x9656('0x1b')]);router['put']('/:id',auth[_0x9656('0xc')](),controller['update']);router[_0x9656('0x1c')](_0x9656('0xd'),auth[_0x9656('0xc')](),controller[_0x9656('0x1d')]);router['delete'](_0x9656('0x17'),auth[_0x9656('0xc')](),controller['removeAnswers']);router[_0x9656('0x1c')](_0x9656('0xe'),auth[_0x9656('0xc')](),controller[_0x9656('0x1e')]);router[_0x9656('0x1c')](_0x9656('0xf'),auth['isAuthenticated'](),controller[_0x9656('0x1f')]);router[_0x9656('0x1c')](_0x9656('0xb'),auth[_0x9656('0xc')](),controller[_0x9656('0x20')]);router[_0x9656('0x1c')](_0x9656('0x14'),auth[_0x9656('0xc')](),controller[_0x9656('0x21')]);module[_0x9656('0x22')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 907282f..f3068e2 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 _0xae6d=['Arial,Helvetica,sans-serif','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','ENUM','gmail','hotmail','outlook365','provider','custom','getDataValue','exports','STRING','BOOLEAN','TEXT'];(function(_0x1a3add,_0x2bdb48){var _0x3ad5a8=function(_0x35edec){while(--_0x35edec){_0x1a3add['push'](_0x1a3add['shift']());}};_0x3ad5a8(++_0x2bdb48);}(_0xae6d,0xea));var _0xdae6=function(_0x49d77e,_0x47b0ca){_0x49d77e=_0x49d77e-0x0;var _0x37895e=_0xae6d[_0x49d77e];return _0x37895e;};'use strict';var Sequelize=require('sequelize');module[_0xdae6('0x0')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xdae6('0x1')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xdae6('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0xdae6('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0xdae6('0x3')]},'markAsUnread':{'type':Sequelize[_0xdae6('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xdae6('0x1')],'allowNull':![],'defaultValue':_0xdae6('0x4')},'fontSize':{'type':Sequelize[_0xdae6('0x5')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xdae6('0x3')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0xdae6('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xdae6('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xdae6('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdae6('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdae6('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdae6('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdae6('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0xdae6('0x6')},'mandatoryDisposition':{'type':Sequelize[_0xdae6('0x2')],'defaultValue':![],'comment':_0xdae6('0x7'),'set':function(_0x9b4b01){if(!_0x9b4b01)this[_0xdae6('0x8')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0xdae6('0x9'),_0x9b4b01);}},'provider':{'type':Sequelize[_0xdae6('0xa')](_0xdae6('0xb'),_0xdae6('0xc'),'yahoo',_0xdae6('0xd')),'defaultValue':null,'get':function(){if(!this['getDataValue'](_0xdae6('0xe')))return _0xdae6('0xf');return this[_0xdae6('0x10')](_0xdae6('0xe'));},'set':function(_0x3ab3f5){if(_0x3ab3f5===_0xdae6('0xf'))_0x3ab3f5=null;return this['setDataValue']('provider',_0x3ab3f5);}}}; \ No newline at end of file +var _0x5d1c=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','gmail','hotmail','yahoo','provider','custom','getDataValue','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif','UNSIGNED','TEXT'];(function(_0x58947f,_0x4d5302){var _0x463e2e=function(_0x321e06){while(--_0x321e06){_0x58947f['push'](_0x58947f['shift']());}};_0x463e2e(++_0x4d5302);}(_0x5d1c,0x1aa));var _0xc5d1=function(_0x3f7356,_0x1ecfd3){_0x3f7356=_0x3f7356-0x0;var _0x325457=_0x5d1c[_0x3f7356];return _0x325457;};'use strict';var Sequelize=require('sequelize');module[_0xc5d1('0x0')]={'description':{'type':Sequelize[_0xc5d1('0x1')]},'name':{'type':Sequelize[_0xc5d1('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0xc5d1('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xc5d1('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xc5d1('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0xc5d1('0x1')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0xc5d1('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xc5d1('0x1')],'allowNull':![],'defaultValue':_0xc5d1('0x3')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0xc5d1('0x4')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xc5d1('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0xc5d1('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc5d1('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc5d1('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc5d1('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc5d1('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc5d1('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xc5d1('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xc5d1('0x2')],'defaultValue':![],'comment':_0xc5d1('0x8'),'set':function(_0x41bd1f){if(!_0x41bd1f)this[_0xc5d1('0x9')](_0xc5d1('0xa'),null);this[_0xc5d1('0x9')](_0xc5d1('0xb'),_0x41bd1f);}},'provider':{'type':Sequelize['ENUM'](_0xc5d1('0xc'),_0xc5d1('0xd'),_0xc5d1('0xe'),'outlook365'),'defaultValue':null,'get':function(){if(!this['getDataValue'](_0xc5d1('0xf')))return _0xc5d1('0x10');return this[_0xc5d1('0x11')](_0xc5d1('0xf'));},'set':function(_0xfbd3cd){if(_0xfbd3cd===_0xc5d1('0x10'))_0xfbd3cd=null;return this[_0xc5d1('0x9')]('provider',_0xfbd3cd);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 8d73484..697cbc4 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 _0x6806=['color','tag','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','split','CmList','List','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','isNil','from','attachments','root','server/files/attachments','basename','getSmtpOptions','List\x20not\x20found','Contacts','messageId','attach','out','Interaction','Messages','VerifySmtp','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','emit','userMailAccount:remove','getAgents','bluebird','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','undefined','count','set','Content-Range','update','destroy','MailAccounts','UserProfileResource','end','sendStatus','name','send','gmail','imap.gmail.com','yahoo','imap-mail.outlook.com','outlook365','outlook.office365.com','smtp.mail.yahoo.com','hotmail','smtp-mail.outlook.com','smtp.office365.com','Unknown\x20email\x20service\x20provider','user','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','username','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','map','MailAccount','rawAttributes','type','key','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','mandatoryDispositionPause','keys','find','body','provider','custom','params','Pause','describe','addDisposition','MailAccountId','Disposition','order','rows','removeDispositions','ids','addAnswer','CannedAnswer','create','getAnswers','findOne','removeAnswers','email','ListId','active','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','addSmtp','removeSmtp','MailInteraction','addInteraction','getInteractions','CmContact','User','Owner','fullname','internal','Tag'];(function(_0x15b33f,_0x49451c){var _0x27d7b5=function(_0x313758){while(--_0x313758){_0x15b33f['push'](_0x15b33f['shift']());}};_0x27d7b5(++_0x49451c);}(_0x6806,0xf5));var _0x6680=function(_0x156630,_0x3e0787){_0x156630=_0x156630-0x0;var _0xc5a4f0=_0x6806[_0x156630];return _0xc5a4f0;};'use strict';var moment=require('moment');var BPromise=require(_0x6680('0x0'));var util=require('util');var path=require(_0x6680('0x1'));var _=require(_0x6680('0x2'));var juice=require(_0x6680('0x3'));var Redis=require(_0x6680('0x4'));var qs=require(_0x6680('0x5'));var logger=require(_0x6680('0x6'))(_0x6680('0x7'));var config=require('../../config/environment');var db=require(_0x6680('0x8'))['db'];config[_0x6680('0x9')]=_[_0x6680('0xa')](config[_0x6680('0x9')],{'host':_0x6680('0xb'),'port':0x18eb});var socket=require(_0x6680('0xc'))(new Redis(config[_0x6680('0x9')]));require('./mailAccount.socket')[_0x6680('0xd')](socket);var jayson=require(_0x6680('0xe'));var client=jayson[_0x6680('0xf')]['http']({'port':0x232b});function respondWithRpcPromise(_0x55a85c,_0x3dc4a8,_0xd0deba,_0x5b82b9){return new BPromise(function(_0x3e215c,_0x520d2c){var _0x491fb6=_0x5b82b9||client;return _0x491fb6[_0x6680('0x10')](_0x55a85c,_0xd0deba)[_0x6680('0x11')](function(_0x132fcf){logger[_0x6680('0x12')](_0x6680('0x13'),_0x3dc4a8,_0x6680('0x14'));logger[_0x6680('0x15')](_0x6680('0x16'),_0x3dc4a8,'request\x20sent',JSON[_0x6680('0x17')](_0x132fcf));if(_0x132fcf[_0x6680('0x18')]){if(_0x132fcf[_0x6680('0x18')][_0x6680('0x19')]===0x1f4){logger[_0x6680('0x18')]('MailAccount,\x20%s,\x20%s',_0x3dc4a8,_0x132fcf['error']['message']);return _0x520d2c(_0x132fcf[_0x6680('0x18')][_0x6680('0x1a')]);}logger[_0x6680('0x18')]('MailAccount,\x20%s,\x20%s',_0x3dc4a8,_0x132fcf[_0x6680('0x18')][_0x6680('0x1a')]);return _0x3e215c(_0x132fcf[_0x6680('0x18')]['message']);}else{logger[_0x6680('0x12')](_0x6680('0x13'),_0x3dc4a8,_0x6680('0x14'));_0x3e215c(_0x132fcf[_0x6680('0x1b')]['message']);}})[_0x6680('0x1c')](function(_0xcbdd12){logger['error'](_0x6680('0x13'),_0x3dc4a8,_0xcbdd12);_0x520d2c(_0xcbdd12);});});}function respondWithStatusCode(_0x50b086,_0x52b622){_0x52b622=_0x52b622||0xcc;return function(_0x19f5de){if(_0x19f5de){return _0x50b086['sendStatus'](_0x52b622);}return _0x50b086[_0x6680('0x1d')](_0x52b622)['end']();};}function respondWithResult(_0x1b28d1,_0xcf8706){_0xcf8706=_0xcf8706||0xc8;return function(_0x484552){if(_0x484552){return _0x1b28d1[_0x6680('0x1d')](_0xcf8706)[_0x6680('0x1e')](_0x484552);}};}function respondWithFilteredResult(_0x3887cd,_0x472792){return function(_0x55e2fb){if(_0x55e2fb){var _0x3711e0=typeof _0x472792[_0x6680('0x1f')]===_0x6680('0x20')&&typeof _0x472792['limit']===_0x6680('0x20');var _0x104a15=_0x55e2fb['count'];var _0x15a6ff=_0x3711e0?0x0:_0x472792[_0x6680('0x1f')];var _0x2148c6=_0x3711e0?_0x55e2fb[_0x6680('0x21')]:_0x472792[_0x6680('0x1f')]+_0x472792['limit'];var _0x3a4dfc;if(_0x2148c6>=_0x104a15){_0x2148c6=_0x104a15;_0x3a4dfc=0xc8;}else{_0x3a4dfc=0xce;}_0x3887cd['status'](_0x3a4dfc);return _0x3887cd[_0x6680('0x22')](_0x6680('0x23'),_0x15a6ff+'-'+_0x2148c6+'/'+_0x104a15)[_0x6680('0x1e')](_0x55e2fb);}return null;};}function saveUpdates(_0x541a97){return function(_0x5c7402){if(_0x5c7402){return _0x5c7402[_0x6680('0x24')](_0x541a97)[_0x6680('0x11')](function(_0x218036){return _0x218036;});}return null;};}function removeEntity(_0x36f594){return function(_0x339a99){if(_0x339a99){return _0x339a99[_0x6680('0x25')]()[_0x6680('0x11')](function(){var _0x2f7da5=_0x339a99['get']({'plain':!![]});var _0x1775d6=_0x6680('0x26');return db[_0x6680('0x27')][_0x6680('0x25')]({'where':{'type':_0x1775d6,'resourceId':_0x2f7da5['id']}})['then'](function(){return _0x339a99;});})[_0x6680('0x11')](function(){_0x36f594[_0x6680('0x1d')](0xcc)[_0x6680('0x28')]();});}};}function handleEntityNotFound(_0x411bcf){return function(_0x2e9033){if(!_0x2e9033){_0x411bcf[_0x6680('0x29')](0x194);}return _0x2e9033;};}function handleError(_0x5cb6aa,_0x58cd17){_0x58cd17=_0x58cd17||0x1f4;return function(_0x16bedf){logger[_0x6680('0x18')](_0x16bedf['stack']);if(_0x16bedf[_0x6680('0x2a')]){delete _0x16bedf['name'];}_0x5cb6aa[_0x6680('0x1d')](_0x58cd17)[_0x6680('0x2b')](_0x16bedf);};}function getImapHost(_0x5bb0bf){switch(_0x5bb0bf){case _0x6680('0x2c'):return _0x6680('0x2d');case _0x6680('0x2e'):return'imap.mail.yahoo.com';case'hotmail':return _0x6680('0x2f');case _0x6680('0x30'):return _0x6680('0x31');}throw new Error('Unknown\x20email\x20service\x20provider',_0x5bb0bf);}function getSmtpHost(_0x44b3a7){switch(_0x44b3a7){case _0x6680('0x2c'):return'smtp.gmail.com';case _0x6680('0x2e'):return _0x6680('0x32');case _0x6680('0x33'):return _0x6680('0x34');case _0x6680('0x30'):return _0x6680('0x35');}throw new Error(_0x6680('0x36'),_0x44b3a7);}function getAuthenticationOptions(_0x1bf98b,_0x3c287f){var _0x2f187c={};var _0x539c71={};if(_0x1bf98b){_0x2f187c[_0x6680('0x37')]=_0x539c71[_0x6680('0x37')]=_0x3c287f['username'];_0x2f187c[_0x6680('0x38')]=_0x539c71[_0x6680('0x39')]=_0x3c287f['password'];if(_0x3c287f[_0x6680('0x3a')]){_0x2f187c[_0x6680('0x3a')]=_0x539c71[_0x6680('0x3a')]=!![];_0x2f187c['CloudProviderId']=_0x539c71[_0x6680('0x3b')]=_0x3c287f[_0x6680('0x3b')];_0x2f187c['password']=_0x539c71['pass']=null;}else{_0x2f187c[_0x6680('0x3b')]=_0x539c71[_0x6680('0x3b')]=null;}_0x2f187c[_0x6680('0x3c')]=getImapHost(_0x1bf98b);_0x2f187c[_0x6680('0x3d')]=0x3e1;_0x539c71[_0x6680('0x3c')]=getSmtpHost(_0x1bf98b);_0x539c71['port']=0x24b;_0x539c71[_0x6680('0x3e')]=![];_0x2f187c[_0x6680('0x3f')]=_0x539c71[_0x6680('0x3f')]=null;}else{if(_0x3c287f['authentication']){_0x2f187c['user']=_0x539c71[_0x6680('0x37')]=_0x3c287f[_0x6680('0x40')];_0x2f187c[_0x6680('0x38')]=_0x539c71[_0x6680('0x39')]=_0x3c287f[_0x6680('0x38')];}else{_0x2f187c['authentication']=_0x539c71[_0x6680('0x41')]=![];_0x2f187c['user']=_0x539c71[_0x6680('0x37')]=null;_0x2f187c['password']=_0x539c71[_0x6680('0x39')]=null;}_0x2f187c['host']=_0x3c287f[_0x6680('0x42')][_0x6680('0x3c')];_0x2f187c[_0x6680('0x3d')]=_0x3c287f[_0x6680('0x42')]['port'];_0x539c71[_0x6680('0x3c')]=_0x3c287f[_0x6680('0x43')][_0x6680('0x3c')];_0x539c71[_0x6680('0x3d')]=_0x3c287f[_0x6680('0x43')][_0x6680('0x3d')];}return{'Imap':_0x2f187c,'Smtp':_0x539c71};}exports[_0x6680('0x44')]=function(_0x5a3051,_0x54b94d){var _0x3706ff={'include':[{'model':db[_0x6680('0x45')],'as':_0x6680('0x42')},{'model':db[_0x6680('0x46')],'as':'Smtp'},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x3cf244={},_0x550df8={'count':0x0,'rows':[]};var _0x377299=_[_0x6680('0x47')](db[_0x6680('0x48')][_0x6680('0x49')],function(_0x54b842){return{'name':_0x54b842['fieldName'],'type':_0x54b842[_0x6680('0x4a')][_0x6680('0x4b')]};});_0x3cf244['model']=_[_0x6680('0x47')](_0x377299,_0x6680('0x2a'));_0x3cf244[_0x6680('0x4c')]=_['keys'](_0x5a3051[_0x6680('0x4c')]);_0x3cf244[_0x6680('0x4d')]=_['intersection'](_0x3cf244[_0x6680('0x4e')],_0x3cf244[_0x6680('0x4c')]);_0x3706ff['attributes']=_[_0x6680('0x4f')](_0x3cf244[_0x6680('0x4e')],qs[_0x6680('0x50')](_0x5a3051[_0x6680('0x4c')]['fields']));_0x3706ff['attributes']=_0x3706ff[_0x6680('0x51')][_0x6680('0x52')]?_0x3706ff[_0x6680('0x51')]:_0x3cf244[_0x6680('0x4e')];if(!_0x5a3051[_0x6680('0x4c')][_0x6680('0x53')](_0x6680('0x54'))){_0x3706ff[_0x6680('0x55')]=qs['limit'](_0x5a3051[_0x6680('0x4c')][_0x6680('0x55')]);_0x3706ff[_0x6680('0x1f')]=qs[_0x6680('0x1f')](_0x5a3051['query'][_0x6680('0x1f')]);}_0x3706ff['order']=qs[_0x6680('0x56')](_0x5a3051['query'][_0x6680('0x56')]);_0x3706ff[_0x6680('0x57')]=qs[_0x6680('0x4d')](_[_0x6680('0x58')](_0x5a3051['query'],_0x3cf244[_0x6680('0x4d')]),_0x377299);if(_0x5a3051[_0x6680('0x4c')][_0x6680('0x59')]){_0x3706ff[_0x6680('0x57')]=_[_0x6680('0x5a')](_0x3706ff['where'],{'$or':_[_0x6680('0x47')](_0x377299,function(_0x2979c4){if(_0x2979c4[_0x6680('0x4a')]!==_0x6680('0x5b')){var _0x3495d7={};_0x3495d7[_0x2979c4[_0x6680('0x2a')]]={'$like':'%'+_0x5a3051[_0x6680('0x4c')][_0x6680('0x59')]+'%'};return _0x3495d7;}})});}_0x3706ff=_[_0x6680('0x5a')]({},_0x3706ff,_0x5a3051[_0x6680('0x5c')]);var _0x3e9acd={'where':_0x3706ff['where']};return db[_0x6680('0x48')]['count'](_0x3e9acd)[_0x6680('0x11')](function(_0x393d4e){_0x550df8['count']=_0x393d4e;if(_0x5a3051[_0x6680('0x4c')][_0x6680('0x5d')]){_0x3706ff[_0x6680('0x5e')]=[{'all':!![]}];}return db[_0x6680('0x48')][_0x6680('0x5f')](_0x3706ff);})['then'](function(_0x384c74){_0x550df8['rows']=_0x384c74;return _0x550df8;})['then'](respondWithFilteredResult(_0x54b94d,_0x3706ff))[_0x6680('0x1c')](handleError(_0x54b94d,null));};exports[_0x6680('0x60')]=function(_0x58c55c,_0x2e9fc2){var _0x409d45={'raw':![],'where':{'id':_0x58c55c['params']['id']},'include':[{'model':db[_0x6680('0x45')],'as':_0x6680('0x42')},{'model':db[_0x6680('0x46')],'as':_0x6680('0x43')},{'model':db['Pause'],'as':_0x6680('0x61')}]},_0x3766bd={};_0x3766bd[_0x6680('0x4e')]=_[_0x6680('0x62')](db[_0x6680('0x48')][_0x6680('0x49')]);_0x3766bd['query']=_['keys'](_0x58c55c['query']);_0x3766bd[_0x6680('0x4d')]=_[_0x6680('0x4f')](_0x3766bd[_0x6680('0x4e')],_0x3766bd[_0x6680('0x4c')]);_0x409d45[_0x6680('0x51')]=_[_0x6680('0x4f')](_0x3766bd[_0x6680('0x4e')],qs[_0x6680('0x50')](_0x58c55c[_0x6680('0x4c')][_0x6680('0x50')]));_0x409d45[_0x6680('0x51')]=_0x409d45[_0x6680('0x51')][_0x6680('0x52')]?_0x409d45[_0x6680('0x51')]:_0x3766bd['model'];if(_0x58c55c['query'][_0x6680('0x5d')]){_0x409d45[_0x6680('0x5e')]=[{'all':!![]}];}_0x409d45=_['merge']({},_0x409d45,_0x58c55c['options']);return db[_0x6680('0x48')][_0x6680('0x63')](_0x409d45)[_0x6680('0x11')](handleEntityNotFound(_0x2e9fc2,null))['then'](respondWithResult(_0x2e9fc2,null))[_0x6680('0x1c')](handleError(_0x2e9fc2,null));};exports[_0x6680('0x24')]=function(_0x4bd56a,_0x18b5b6){if(_0x4bd56a[_0x6680('0x64')]['id']){delete _0x4bd56a[_0x6680('0x64')]['id'];}var _0x3e84be=_0x4bd56a[_0x6680('0x64')][_0x6680('0x65')]===_0x6680('0x66')?null:_0x4bd56a[_0x6680('0x64')]['provider'];var _0x2f4c3f=_0x4bd56a[_0x6680('0x64')][_0x6680('0x42')]||{};var _0x426786=_0x4bd56a[_0x6680('0x64')][_0x6680('0x43')]||{};if(_0x3e84be){_0x2f4c3f[_0x6680('0x3c')]=getImapHost(_0x3e84be);_0x2f4c3f[_0x6680('0x3d')]=0x3e1;_0x426786['host']=getSmtpHost(_0x3e84be);_0x426786[_0x6680('0x3d')]=0x24b;_0x426786[_0x6680('0x3e')]=![];}if(_0x426786[_0x6680('0x3a')]){_0x426786['secure']=![];}else{_0x426786['CloudProviderId']=null;}if(!_0x2f4c3f[_0x6680('0x3a')])_0x2f4c3f['CloudProviderId']=null;_0x4bd56a[_0x6680('0x64')][_0x6680('0x42')]=_0x2f4c3f;_0x4bd56a['body']['Smtp']=_0x426786;return db[_0x6680('0x48')][_0x6680('0x63')]({'where':{'id':_0x4bd56a[_0x6680('0x67')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x6680('0x42')},{'model':db[_0x6680('0x46')],'as':_0x6680('0x43')},{'model':db[_0x6680('0x68')],'as':_0x6680('0x61')}]})['then'](handleEntityNotFound(_0x18b5b6,null))['then'](function(_0x334559){if(!_0x334559)throw new Error('Mail\x20Account\x20not\x20found');if(_0x334559[_0x6680('0x3f')])delete _0x4bd56a[_0x6680('0x64')][_0x6680('0x42')];return _0x334559;})[_0x6680('0x11')](saveUpdates(_0x4bd56a[_0x6680('0x64')],null))['then'](function(_0x37f82b){if(!_0x4bd56a['body'][_0x6680('0x42')])return _0x37f82b;return db[_0x6680('0x45')][_0x6680('0x24')](_0x4bd56a['body'][_0x6680('0x42')],{'where':{'MailAccountId':_0x37f82b['id']}})[_0x6680('0x11')](function(){return _0x37f82b;});})[_0x6680('0x11')](function(_0x6362e){if(!_0x4bd56a[_0x6680('0x64')][_0x6680('0x43')])return _0x6362e;return db[_0x6680('0x46')]['update'](_0x4bd56a[_0x6680('0x64')][_0x6680('0x43')],{'where':{'MailAccountId':_0x6362e['id']}})[_0x6680('0x11')](function(){return _0x6362e;});})[_0x6680('0x11')](respondWithResult(_0x18b5b6,null))[_0x6680('0x1c')](handleError(_0x18b5b6,null));};exports[_0x6680('0x69')]=function(_0xc37c86,_0x5606dd){return db['MailAccount'][_0x6680('0x69')]()['then'](respondWithResult(_0x5606dd,null))[_0x6680('0x1c')](handleError(_0x5606dd,null));};exports[_0x6680('0x6a')]=function(_0xf2a1c0,_0x380317){if(_0xf2a1c0[_0x6680('0x64')]['id']){delete _0xf2a1c0['body']['id'];}return db[_0x6680('0x48')][_0x6680('0x63')]({'where':{'id':_0xf2a1c0[_0x6680('0x67')]['id']}})['then'](handleEntityNotFound(_0x380317,null))[_0x6680('0x11')](function(_0x4b0c0a){if(_0x4b0c0a){_0xf2a1c0[_0x6680('0x64')][_0x6680('0x6b')]=_0x4b0c0a['id'];return db[_0x6680('0x6c')]['create'](_0xf2a1c0[_0x6680('0x64')]);}})[_0x6680('0x11')](respondWithResult(_0x380317,null))[_0x6680('0x1c')](handleError(_0x380317,null));};exports['getDispositions']=function(_0x4fac5d,_0x801557){var _0x428f2b={'raw':![],'where':{}};var _0x5cc735={};var _0x2de33d={'count':0x0,'rows':[]};return db[_0x6680('0x48')]['findOne']({'where':{'id':_0x4fac5d[_0x6680('0x67')]['id']}})[_0x6680('0x11')](handleEntityNotFound(_0x801557,null))[_0x6680('0x11')](function(_0x52a6b9){if(_0x52a6b9){_0x5cc735[_0x6680('0x4e')]=_['keys'](db[_0x6680('0x6c')][_0x6680('0x49')]);_0x5cc735[_0x6680('0x4c')]=_['keys'](_0x4fac5d[_0x6680('0x4c')]);_0x5cc735['filters']=_[_0x6680('0x4f')](_0x5cc735[_0x6680('0x4e')],_0x5cc735[_0x6680('0x4c')]);_0x428f2b[_0x6680('0x51')]=_[_0x6680('0x4f')](_0x5cc735[_0x6680('0x4e')],qs['fields'](_0x4fac5d['query'][_0x6680('0x50')]));_0x428f2b[_0x6680('0x51')]=_0x428f2b[_0x6680('0x51')][_0x6680('0x52')]?_0x428f2b[_0x6680('0x51')]:_0x5cc735[_0x6680('0x4e')];if(!_0x4fac5d['query']['hasOwnProperty'](_0x6680('0x54'))){_0x428f2b[_0x6680('0x55')]=qs[_0x6680('0x55')](_0x4fac5d['query'][_0x6680('0x55')]);_0x428f2b[_0x6680('0x1f')]=qs[_0x6680('0x1f')](_0x4fac5d[_0x6680('0x4c')]['offset']);}_0x428f2b[_0x6680('0x6d')]=qs['sort'](_0x4fac5d['query'][_0x6680('0x56')]);_0x428f2b[_0x6680('0x57')]=qs[_0x6680('0x4d')](_[_0x6680('0x58')](_0x4fac5d[_0x6680('0x4c')],_0x5cc735[_0x6680('0x4d')]));_0x428f2b['where'][_0x6680('0x6b')]=_0x52a6b9['id'];if(_0x4fac5d[_0x6680('0x4c')][_0x6680('0x59')]){_0x428f2b[_0x6680('0x57')]=_['merge'](_0x428f2b['where'],{'$or':_[_0x6680('0x47')](_0x428f2b[_0x6680('0x51')],function(_0x421735){var _0x20560b={};_0x20560b[_0x421735]={'$like':'%'+_0x4fac5d[_0x6680('0x4c')][_0x6680('0x59')]+'%'};return _0x20560b;})});}_0x428f2b=_[_0x6680('0x5a')]({},_0x428f2b,_0x4fac5d[_0x6680('0x5c')]);return db[_0x6680('0x6c')][_0x6680('0x21')]({'where':_0x428f2b[_0x6680('0x57')]})[_0x6680('0x11')](function(_0x1c3633){_0x2de33d[_0x6680('0x21')]=_0x1c3633;if(_0x4fac5d['query'][_0x6680('0x5d')]){_0x428f2b[_0x6680('0x5e')]=[{'all':!![]}];}return db[_0x6680('0x6c')][_0x6680('0x5f')](_0x428f2b);})['then'](function(_0x5565e6){_0x2de33d[_0x6680('0x6e')]=_0x5565e6;return _0x2de33d;});}})[_0x6680('0x11')](respondWithFilteredResult(_0x801557,_0x428f2b))['catch'](handleError(_0x801557,null));};exports[_0x6680('0x6f')]=function(_0x53df2e,_0x48f38a){return db[_0x6680('0x48')][_0x6680('0x63')]({'where':{'id':_0x53df2e[_0x6680('0x67')]['id']}})[_0x6680('0x11')](handleEntityNotFound(_0x48f38a,null))['then'](function(_0x2096ea){if(_0x2096ea){return _0x2096ea[_0x6680('0x6f')](_0x53df2e[_0x6680('0x4c')][_0x6680('0x70')]);}})[_0x6680('0x11')](respondWithStatusCode(_0x48f38a,null))['catch'](handleError(_0x48f38a,null));};exports[_0x6680('0x71')]=function(_0x180392,_0x3f3cdb){if(_0x180392[_0x6680('0x64')]['id']){delete _0x180392[_0x6680('0x64')]['id'];}return db[_0x6680('0x48')][_0x6680('0x63')]({'where':{'id':_0x180392[_0x6680('0x67')]['id']}})[_0x6680('0x11')](handleEntityNotFound(_0x3f3cdb,null))[_0x6680('0x11')](function(_0x4fc3b9){if(_0x4fc3b9){_0x180392['body']['MailAccountId']=_0x4fc3b9['id'];return db[_0x6680('0x72')][_0x6680('0x73')](_0x180392['body']);}})[_0x6680('0x11')](respondWithResult(_0x3f3cdb,null))['catch'](handleError(_0x3f3cdb,null));};exports[_0x6680('0x74')]=function(_0x3367e3,_0x34720c){var _0x4eeccd={'raw':![],'where':{}};var _0x75197d={};var _0x1602e={'count':0x0,'rows':[]};return db['MailAccount'][_0x6680('0x75')]({'where':{'id':_0x3367e3[_0x6680('0x67')]['id']}})[_0x6680('0x11')](handleEntityNotFound(_0x34720c,null))['then'](function(_0x2064d8){if(_0x2064d8){_0x75197d['model']=_[_0x6680('0x62')](db[_0x6680('0x72')][_0x6680('0x49')]);_0x75197d[_0x6680('0x4c')]=_['keys'](_0x3367e3[_0x6680('0x4c')]);_0x75197d[_0x6680('0x4d')]=_[_0x6680('0x4f')](_0x75197d[_0x6680('0x4e')],_0x75197d[_0x6680('0x4c')]);_0x4eeccd[_0x6680('0x51')]=_['intersection'](_0x75197d[_0x6680('0x4e')],qs[_0x6680('0x50')](_0x3367e3[_0x6680('0x4c')][_0x6680('0x50')]));_0x4eeccd[_0x6680('0x51')]=_0x4eeccd[_0x6680('0x51')][_0x6680('0x52')]?_0x4eeccd[_0x6680('0x51')]:_0x75197d['model'];if(!_0x3367e3[_0x6680('0x4c')][_0x6680('0x53')]('nolimit')){_0x4eeccd[_0x6680('0x55')]=qs[_0x6680('0x55')](_0x3367e3[_0x6680('0x4c')][_0x6680('0x55')]);_0x4eeccd[_0x6680('0x1f')]=qs[_0x6680('0x1f')](_0x3367e3['query'][_0x6680('0x1f')]);}_0x4eeccd['order']=qs[_0x6680('0x56')](_0x3367e3[_0x6680('0x4c')][_0x6680('0x56')]);_0x4eeccd['where']=qs[_0x6680('0x4d')](_[_0x6680('0x58')](_0x3367e3['query'],_0x75197d[_0x6680('0x4d')]));_0x4eeccd[_0x6680('0x57')][_0x6680('0x6b')]=_0x2064d8['id'];if(_0x3367e3['query'][_0x6680('0x59')]){_0x4eeccd[_0x6680('0x57')]=_[_0x6680('0x5a')](_0x4eeccd[_0x6680('0x57')],{'$or':_[_0x6680('0x47')](_0x4eeccd[_0x6680('0x51')],function(_0x47ca8b){var _0x7f099d={};_0x7f099d[_0x47ca8b]={'$like':'%'+_0x3367e3[_0x6680('0x4c')][_0x6680('0x59')]+'%'};return _0x7f099d;})});}_0x4eeccd=_[_0x6680('0x5a')]({},_0x4eeccd,_0x3367e3[_0x6680('0x5c')]);return db['CannedAnswer'][_0x6680('0x21')]({'where':_0x4eeccd[_0x6680('0x57')]})[_0x6680('0x11')](function(_0x2abc3d){_0x1602e[_0x6680('0x21')]=_0x2abc3d;if(_0x3367e3[_0x6680('0x4c')]['includeAll']){_0x4eeccd[_0x6680('0x5e')]=[{'all':!![]}];}return db['CannedAnswer'][_0x6680('0x5f')](_0x4eeccd);})[_0x6680('0x11')](function(_0x3f10a2){_0x1602e[_0x6680('0x6e')]=_0x3f10a2;return _0x1602e;});}})[_0x6680('0x11')](respondWithFilteredResult(_0x34720c,_0x4eeccd))[_0x6680('0x1c')](handleError(_0x34720c,null));};exports[_0x6680('0x76')]=function(_0x3bed89,_0x31b53e){return db[_0x6680('0x48')][_0x6680('0x63')]({'where':{'id':_0x3bed89[_0x6680('0x67')]['id']}})[_0x6680('0x11')](handleEntityNotFound(_0x31b53e,null))[_0x6680('0x11')](function(_0x12f3cb){if(_0x12f3cb){return _0x12f3cb['removeAnswers'](_0x3bed89[_0x6680('0x4c')][_0x6680('0x70')]);}})[_0x6680('0x11')](respondWithStatusCode(_0x31b53e,null))[_0x6680('0x1c')](handleError(_0x31b53e,null));};exports[_0x6680('0x73')]=function(_0x46608f,_0x565905){var _0x163412={'name':_0x46608f[_0x6680('0x64')][_0x6680('0x2a')],'key':_0x46608f[_0x6680('0x64')][_0x6680('0x4b')],'provider':_0x46608f[_0x6680('0x64')]['provider']==='custom'?null:_0x46608f[_0x6680('0x64')][_0x6680('0x65')],'email':_0x46608f[_0x6680('0x64')][_0x6680('0x77')],'ListId':_0x46608f[_0x6680('0x64')][_0x6680('0x78')],'active':!_['isNil'](_0x46608f[_0x6680('0x64')][_0x6680('0x79')])?_0x46608f[_0x6680('0x64')][_0x6680('0x79')]:!![],'description':_0x46608f[_0x6680('0x64')]['description']||null};var _0x1e5726=getAuthenticationOptions(_0x163412[_0x6680('0x65')],_0x46608f[_0x6680('0x64')]);_0x163412[_0x6680('0x42')]=_0x1e5726[_0x6680('0x42')];_0x163412[_0x6680('0x43')]=_0x1e5726[_0x6680('0x43')];return db[_0x6680('0x48')]['create'](_0x163412,{'include':[{'model':db['MailServerOut'],'as':_0x6680('0x43')},{'model':db[_0x6680('0x45')],'as':_0x6680('0x42')}]})[_0x6680('0x11')](function(_0x4164c3){var _0x4aace2=_0x46608f['user'][_0x6680('0x7a')]({'plain':!![]});if(!_0x4aace2)throw new Error(_0x6680('0x7b'));if(_0x4aace2[_0x6680('0x7c')]==='user'){var _0x5a97a1=_0x4164c3['get']({'plain':!![]});return db[_0x6680('0x7d')]['find']({'where':{'name':'MailAccounts','userProfileId':_0x4aace2[_0x6680('0x7e')]},'raw':!![]})[_0x6680('0x11')](function(_0x2f9800){if(_0x2f9800&&_0x2f9800['autoAssociation']===0x0){return db[_0x6680('0x27')][_0x6680('0x73')]({'name':_0x5a97a1['name'],'resourceId':_0x5a97a1['id'],'type':_0x2f9800['name'],'sectionId':_0x2f9800['id']},{})[_0x6680('0x11')](function(){return _0x4164c3;});}else{return _0x4164c3;}})[_0x6680('0x1c')](function(_0x42ba29){logger[_0x6680('0x18')](_0x6680('0x7f'),_0x42ba29);throw _0x42ba29;});}return _0x4164c3;})[_0x6680('0x11')](respondWithResult(_0x565905,0xc9))[_0x6680('0x1c')](handleError(_0x565905,null));};exports[_0x6680('0x80')]=function(_0x430b52,_0x3d03a5){return db[_0x6680('0x48')]['findOne']({'where':{'id':_0x430b52[_0x6680('0x67')]['id']}})[_0x6680('0x11')](handleEntityNotFound(_0x3d03a5,null))[_0x6680('0x11')](function(_0x2a9aeb){if(_0x2a9aeb){return _0x2a9aeb[_0x6680('0x80')]();}return null;})[_0x6680('0x11')](respondWithResult(_0x3d03a5,null))['catch'](handleError(_0x3d03a5,null));};exports[_0x6680('0x81')]=function(_0x3a2ed3,_0x319cc4){if(_0x3a2ed3[_0x6680('0x64')]['id']){delete _0x3a2ed3[_0x6680('0x64')]['id'];}return db[_0x6680('0x48')][_0x6680('0x63')]({'where':{'id':_0x3a2ed3[_0x6680('0x67')]['id']}})[_0x6680('0x11')](handleEntityNotFound(_0x319cc4,null))[_0x6680('0x11')](function(_0xb4bb11){if(_0xb4bb11){_0x3a2ed3[_0x6680('0x64')]['MailAccountId']=_0xb4bb11['id'];return db['MailServerIn'][_0x6680('0x73')](_0x3a2ed3[_0x6680('0x64')]);}})[_0x6680('0x11')](respondWithResult(_0x319cc4,null))[_0x6680('0x1c')](handleError(_0x319cc4,null));};exports[_0x6680('0x82')]=function(_0x1a2a89,_0x19b824){return db[_0x6680('0x48')]['findOne']({'where':{'id':_0x1a2a89[_0x6680('0x67')]['id']}})['then'](handleEntityNotFound(_0x19b824,null))['then'](function(_0x4e1995){if(_0x4e1995){return _0x4e1995[_0x6680('0x83')](null);}return null;})[_0x6680('0x11')](respondWithStatusCode(_0x19b824,null))[_0x6680('0x1c')](handleError(_0x19b824,null));};exports['getSmtp']=function(_0x4358cc,_0x40c3ec){return db[_0x6680('0x48')]['findOne']({'where':{'id':_0x4358cc[_0x6680('0x67')]['id']}})[_0x6680('0x11')](handleEntityNotFound(_0x40c3ec,null))[_0x6680('0x11')](function(_0x24aa29){if(_0x24aa29){return _0x24aa29['getSmtp']();}return null;})['then'](respondWithResult(_0x40c3ec,null))[_0x6680('0x1c')](handleError(_0x40c3ec,null));};exports[_0x6680('0x84')]=function(_0x2d213f,_0x46d096){if(_0x2d213f[_0x6680('0x64')]['id']){delete _0x2d213f[_0x6680('0x64')]['id'];}return db['MailAccount'][_0x6680('0x63')]({'where':{'id':_0x2d213f[_0x6680('0x67')]['id']}})[_0x6680('0x11')](handleEntityNotFound(_0x46d096,null))[_0x6680('0x11')](function(_0x54f96c){if(_0x54f96c){_0x2d213f[_0x6680('0x64')][_0x6680('0x6b')]=_0x54f96c['id'];return db[_0x6680('0x46')][_0x6680('0x73')](_0x2d213f[_0x6680('0x64')]);}})[_0x6680('0x11')](respondWithResult(_0x46d096,null))[_0x6680('0x1c')](handleError(_0x46d096,null));};exports[_0x6680('0x85')]=function(_0x2068c1,_0x1c3157){return db['MailAccount'][_0x6680('0x75')]({'where':{'id':_0x2068c1[_0x6680('0x67')]['id']}})[_0x6680('0x11')](handleEntityNotFound(_0x1c3157,null))[_0x6680('0x11')](function(_0x283c25){if(_0x283c25){return _0x283c25['setSmtp'](null);}return null;})['then'](respondWithStatusCode(_0x1c3157,null))[_0x6680('0x1c')](handleError(_0x1c3157,null));};exports['addInteraction']=function(_0x35b89a,_0x2c36c0){return db[_0x6680('0x86')][_0x6680('0x63')]({'where':{'id':_0x35b89a['params']['id']}})['then'](handleEntityNotFound(_0x2c36c0,null))[_0x6680('0x11')](function(_0x4ed291){if(_0x4ed291){return _0x4ed291[_0x6680('0x87')](_0x35b89a[_0x6680('0x64')]['ids'],_['omit'](_0x35b89a[_0x6680('0x64')],['ids','id'])||{});}})[_0x6680('0x11')](respondWithResult(_0x2c36c0,null))[_0x6680('0x1c')](handleError(_0x2c36c0,null));};exports[_0x6680('0x88')]=function(_0x27e318,_0x42b77b){var _0x38752a={'raw':![],'where':{}};var _0x560880={};var _0x94cd6d={'count':0x0,'rows':[]};return db[_0x6680('0x48')][_0x6680('0x75')]({'where':{'id':_0x27e318['params']['id']}})[_0x6680('0x11')](handleEntityNotFound(_0x42b77b,null))['then'](function(_0x521076){if(_0x521076){_0x560880[_0x6680('0x4e')]=_[_0x6680('0x62')](db['MailInteraction'][_0x6680('0x49')]);_0x560880[_0x6680('0x4c')]=_[_0x6680('0x62')](_0x27e318[_0x6680('0x4c')]);_0x560880[_0x6680('0x4d')]=_[_0x6680('0x4f')](_0x560880['model'],_0x560880[_0x6680('0x4c')]);_0x38752a[_0x6680('0x51')]=_[_0x6680('0x4f')](_0x560880['model'],qs['fields'](_0x27e318[_0x6680('0x4c')][_0x6680('0x50')]));_0x38752a['attributes']=_0x38752a[_0x6680('0x51')]['length']?_0x38752a['attributes']:_0x560880[_0x6680('0x4e')];if(!_0x27e318[_0x6680('0x4c')]['hasOwnProperty']('nolimit')){_0x38752a[_0x6680('0x55')]=qs[_0x6680('0x55')](_0x27e318[_0x6680('0x4c')][_0x6680('0x55')]);_0x38752a[_0x6680('0x1f')]=qs['offset'](_0x27e318[_0x6680('0x4c')][_0x6680('0x1f')]);}_0x38752a['order']=qs[_0x6680('0x56')](_0x27e318['query'][_0x6680('0x56')]);_0x38752a[_0x6680('0x57')]=qs[_0x6680('0x4d')](_[_0x6680('0x58')](_0x27e318[_0x6680('0x4c')],_0x560880[_0x6680('0x4d')]));_0x38752a[_0x6680('0x57')][_0x6680('0x6b')]=_0x521076['id'];if(_0x27e318[_0x6680('0x4c')][_0x6680('0x59')]){_0x38752a[_0x6680('0x57')]=_[_0x6680('0x5a')](_0x38752a[_0x6680('0x57')],{'$or':_[_0x6680('0x47')](_0x38752a[_0x6680('0x51')],function(_0x407547){var _0x172265={};_0x172265[_0x407547]={'$like':'%'+_0x27e318[_0x6680('0x4c')][_0x6680('0x59')]+'%'};return _0x172265;})});}_0x38752a=_[_0x6680('0x5a')]({},_0x38752a,_0x27e318[_0x6680('0x5c')]);return db[_0x6680('0x86')]['count']({'where':_0x38752a['where']})[_0x6680('0x11')](function(_0x214bd4){_0x94cd6d[_0x6680('0x21')]=_0x214bd4;if(_0x27e318[_0x6680('0x4c')][_0x6680('0x5d')]){_0x38752a[_0x6680('0x5e')]=[{'model':db[_0x6680('0x89')],'as':'Contact','required':![]},{'model':db[_0x6680('0x8a')],'as':_0x6680('0x8b'),'attributes':[_0x6680('0x2a'),_0x6680('0x8c'),_0x6680('0x8d')],'required':![]},{'model':db[_0x6680('0x8e')],'as':'Tags','attributes':['id',_0x6680('0x2a'),_0x6680('0x8f')],'where':_0x27e318[_0x6680('0x4c')][_0x6680('0x90')]?{'id':_0x27e318[_0x6680('0x4c')][_0x6680('0x90')]}:undefined,'required':_0x27e318[_0x6680('0x4c')][_0x6680('0x90')]?!![]:![]}];}return db[_0x6680('0x86')][_0x6680('0x5f')](_0x38752a);})[_0x6680('0x11')](function(_0x101209){_0x94cd6d[_0x6680('0x6e')]=_0x101209;return _0x94cd6d;});}})[_0x6680('0x11')](respondWithFilteredResult(_0x42b77b,_0x38752a))[_0x6680('0x1c')](handleError(_0x42b77b,null));};exports[_0x6680('0x91')]=function addApplications(_0x276281,_0xc84a55){var _0x3d9ad6=_0x276281[_0x6680('0x67')]['id'];var _0x428cc7=_0x276281[_0x6680('0x64')];var _0x924c3e=0xc8;var _0xd3edda=null;return db['sequelize'][_0x6680('0x92')]({'isolationLevel':db[_0x6680('0x93')][_0x6680('0x94')][_0x6680('0x95')]['READ_COMMITTED']},function(_0x458d6a){return db['MailAccount'][_0x6680('0x75')]({'where':{'id':_0x3d9ad6},'transaction':_0x458d6a})[_0x6680('0x11')](function(_0x394c82){if(_0x394c82){return db[_0x6680('0x96')]['destroy']({'where':{'MailAccountId':_0x3d9ad6},'transaction':_0x458d6a})[_0x6680('0x11')](function(){var _0xafbd6e=_['map'](_0x428cc7,function(_0x474c24){_0x474c24['MailAccountId']=_0x3d9ad6;return _0x474c24;});return db['MailApplication'][_0x6680('0x97')](_0xafbd6e,{'transaction':_0x458d6a});});}else{_0x924c3e=0x194;_0xd3edda=[];}});})[_0x6680('0x11')](function(){if(_0x924c3e!==0x194){return db['MailApplication'][_0x6680('0x98')]({'where':{'MailAccountId':_0x3d9ad6},'order':_0x6680('0x99')})[_0x6680('0x11')](function(_0x15672d){_0xd3edda=_0x15672d;});}})[_0x6680('0x1c')](function(_0xf39cad){_0x924c3e=0x1f4;logger[_0x6680('0x18')](_0xf39cad['stack']);if(_0xf39cad[_0x6680('0x2a')]){delete _0xf39cad[_0x6680('0x2a')];}_0xd3edda=_0xf39cad;})['finally'](function(){if(_0xd3edda===null){_0xc84a55['sendStatus'](_0x924c3e);}else{if(_0x924c3e===0x1f4){_0xc84a55['status'](_0x924c3e)['send'](_0xd3edda);}else{_0xc84a55[_0x6680('0x1d')](_0x924c3e)[_0x6680('0x1e')](_0xd3edda);}}});};exports[_0x6680('0x9a')]=function(_0xe9bde9,_0xf98dc3){var _0x38a985={};var _0x5cd600={};var _0xfeec3b;var _0x4fbbf8;return db[_0x6680('0x48')][_0x6680('0x75')]({'where':{'id':_0xe9bde9['params']['id']}})[_0x6680('0x11')](handleEntityNotFound(_0xf98dc3,null))[_0x6680('0x11')](function(_0x13bf27){if(_0x13bf27){_0xfeec3b=_0x13bf27;_0x5cd600['model']=_[_0x6680('0x62')](db[_0x6680('0x96')][_0x6680('0x49')]);_0x5cd600[_0x6680('0x4c')]=_[_0x6680('0x62')](_0xe9bde9['query']);_0x5cd600['filters']=_[_0x6680('0x4f')](_0x5cd600[_0x6680('0x4e')],_0x5cd600[_0x6680('0x4c')]);_0x38a985[_0x6680('0x51')]=_[_0x6680('0x4f')](_0x5cd600[_0x6680('0x4e')],qs[_0x6680('0x50')](_0xe9bde9[_0x6680('0x4c')][_0x6680('0x50')]));_0x38a985['attributes']=_0x38a985[_0x6680('0x51')][_0x6680('0x52')]?_0x38a985['attributes']:_0x5cd600[_0x6680('0x4e')];_0x38a985[_0x6680('0x6d')]=qs[_0x6680('0x56')](_0xe9bde9[_0x6680('0x4c')][_0x6680('0x56')]);_0x38a985[_0x6680('0x57')]=qs[_0x6680('0x4d')](_[_0x6680('0x58')](_0xe9bde9[_0x6680('0x4c')],_0x5cd600[_0x6680('0x4d')]));if(_0xe9bde9[_0x6680('0x4c')]['filter']){_0x38a985['where']=_[_0x6680('0x5a')](_0x38a985[_0x6680('0x57')],{'$or':_[_0x6680('0x47')](_0x38a985[_0x6680('0x51')],function(_0x2729e0){var _0x277be9={};_0x277be9[_0x2729e0]={'$like':'%'+_0xe9bde9['query'][_0x6680('0x59')]+'%'};return _0x277be9;})});}_0x38a985=_[_0x6680('0x5a')]({},_0x38a985,_0xe9bde9[_0x6680('0x5c')]);return _0xfeec3b['getApplications'](_0x38a985);}})[_0x6680('0x11')](function(_0x2e479a){if(_0x2e479a){_0x4fbbf8=_0x2e479a[_0x6680('0x52')];if(!_0xe9bde9[_0x6680('0x4c')][_0x6680('0x53')](_0x6680('0x54'))){_0x38a985[_0x6680('0x55')]=qs[_0x6680('0x55')](_0xe9bde9[_0x6680('0x4c')][_0x6680('0x55')]);_0x38a985['offset']=qs[_0x6680('0x1f')](_0xe9bde9[_0x6680('0x4c')][_0x6680('0x1f')]);}return _0xfeec3b[_0x6680('0x9a')](_0x38a985);}})[_0x6680('0x11')](function(_0xf3cbc7){if(_0xf3cbc7){return _0xf3cbc7?{'count':_0x4fbbf8,'rows':_0xf3cbc7}:null;}})['then'](respondWithResult(_0xf98dc3,null))[_0x6680('0x1c')](handleError(_0xf98dc3,null));};exports[_0x6680('0x9b')]=function(_0x4aa80f,_0x1ffa98){var _0x2c16dd={'raw':!![],'where':{}};var _0x50cd64={};var _0x206bc4={'count':0x0,'rows':[]};return db['MailAccount'][_0x6680('0x75')]({'where':{'id':_0x4aa80f[_0x6680('0x67')]['id']}})[_0x6680('0x11')](handleEntityNotFound(_0x1ffa98,null))[_0x6680('0x11')](function(_0x3d5a63){if(_0x3d5a63){_0x50cd64[_0x6680('0x4e')]=_[_0x6680('0x62')](db[_0x6680('0x9c')][_0x6680('0x49')]);_0x50cd64['query']=_[_0x6680('0x62')](_0x4aa80f[_0x6680('0x4c')]);_0x50cd64[_0x6680('0x4d')]=_[_0x6680('0x4f')](_0x50cd64[_0x6680('0x4e')],_0x50cd64[_0x6680('0x4c')]);_0x2c16dd['attributes']=_['intersection'](_0x50cd64[_0x6680('0x4e')],qs['fields'](_0x4aa80f[_0x6680('0x4c')]['fields']));_0x2c16dd[_0x6680('0x51')]=_0x2c16dd[_0x6680('0x51')][_0x6680('0x52')]?_0x2c16dd['attributes']:_0x50cd64[_0x6680('0x4e')];if(!_0x4aa80f['query'][_0x6680('0x53')]('nolimit')){_0x2c16dd[_0x6680('0x55')]=qs[_0x6680('0x55')](_0x4aa80f[_0x6680('0x4c')][_0x6680('0x55')]);_0x2c16dd['offset']=qs[_0x6680('0x1f')](_0x4aa80f[_0x6680('0x4c')][_0x6680('0x1f')]);}_0x2c16dd[_0x6680('0x6d')]=qs[_0x6680('0x56')](_0x4aa80f[_0x6680('0x4c')][_0x6680('0x56')]);_0x2c16dd[_0x6680('0x57')]=qs[_0x6680('0x4d')](_[_0x6680('0x58')](_0x4aa80f['query'],_0x50cd64['filters']));_0x2c16dd[_0x6680('0x57')][_0x6680('0x6b')]=_0x3d5a63['id'];if(_0x4aa80f[_0x6680('0x4c')][_0x6680('0x59')]){_0x2c16dd['where']=_['merge'](_0x2c16dd[_0x6680('0x57')],{'$or':_[_0x6680('0x47')](_0x2c16dd[_0x6680('0x51')],function(_0x58b3f2){var _0x43e98a={};_0x43e98a[_0x58b3f2]={'$like':'%'+_0x4aa80f['query'][_0x6680('0x59')]+'%'};return _0x43e98a;})});}if(_0x4aa80f[_0x6680('0x4c')]['$gte']){var _0x4ae49c=_0x4aa80f['query'][_0x6680('0x9d')]['split'](',');var _0x4b794f={};_0x4b794f[_0x4ae49c[0x0]]={'$gte':moment(_0x4ae49c[0x1])[_0x6680('0x9e')](_0x6680('0x9f'))};_0x2c16dd['where']=_[_0x6680('0x5a')](_0x2c16dd['where'],_0x4b794f);}_0x2c16dd=_[_0x6680('0x5a')]({},_0x2c16dd,_0x4aa80f[_0x6680('0x5c')]);return db['MailMessage'][_0x6680('0x21')]({'where':_0x2c16dd['where']})['then'](function(_0x264636){_0x206bc4['count']=_0x264636;if(_0x4aa80f[_0x6680('0x4c')][_0x6680('0x5d')]){_0x2c16dd[_0x6680('0x5e')]=[{'all':!![]}];}return db['MailMessage'][_0x6680('0x5f')](_0x2c16dd);})[_0x6680('0x11')](function(_0x11a633){if(_0x4aa80f[_0x6680('0x4c')][_0x6680('0xa0')]===_0x6680('0xa1')){for(var _0x2f2380=0x0;_0x2f2380<_0x11a633[_0x6680('0x52')];_0x2f2380++){_0x11a633[_0x2f2380]['body']=juice(_0x11a633[_0x2f2380][_0x6680('0x64')]);}}_0x206bc4['rows']=_0x11a633;return _0x206bc4;});}})['then'](respondWithFilteredResult(_0x1ffa98,_0x2c16dd))['catch'](handleError(_0x1ffa98,null));};exports[_0x6680('0x2b')]=function(_0x101f26,_0x3fa835){var _0x43c669,_0x24cc88={},_0x50a0e6;if(_0x101f26[_0x6680('0x64')]['to']){_0x50a0e6=_0x101f26['body']['to'][_0x6680('0xa2')](',')[0x0];}return db[_0x6680('0x48')][_0x6680('0x63')]({'where':{'id':_0x101f26['params']['id']},'include':[{'model':db[_0x6680('0xa3')],'as':_0x6680('0xa4'),'include':[{'model':db[_0x6680('0x89')],'as':'Contacts','where':{'email':_0x50a0e6},'limit':0x1,'order':[[_0x6680('0xa5'),_0x6680('0xa6')]]}]},{'model':db[_0x6680('0x46')],'as':_0x6680('0x43'),'raw':!![],'include':[{'model':db[_0x6680('0xa7')],'as':'CloudProvider','raw':!![]}]}]})[_0x6680('0x11')](handleEntityNotFound(_0x3fa835,null))['then'](function(_0x303b1b){if(!_0x303b1b)return;_0x43c669=_0x303b1b;if(!_0x303b1b[_0x6680('0x43')])throw new Error(_0x6680('0xa8'));if(_[_0x6680('0xa9')](_0x101f26[_0x6680('0x64')][_0x6680('0xaa')])){_0x101f26[_0x6680('0x64')][_0x6680('0xaa')]=util[_0x6680('0x9e')]('%s\x20<%s>',_0x303b1b[_0x6680('0x2a')],_0x303b1b[_0x6680('0x77')]||_0x303b1b['Smtp'][_0x6680('0x37')]);}if(_0x101f26['body'][_0x6680('0xab')]&&_0x101f26[_0x6680('0x64')][_0x6680('0xab')][_0x6680('0x52')]){for(var _0x1c8ba8=0x0;_0x1c8ba8<_0x101f26[_0x6680('0x64')][_0x6680('0xab')][_0x6680('0x52')];_0x1c8ba8+=0x1){_0x101f26['body'][_0x6680('0xab')][_0x1c8ba8]={'filename':_0x101f26[_0x6680('0x64')][_0x6680('0xab')][_0x1c8ba8][_0x6680('0x2a')],'path':path['join'](config[_0x6680('0xac')],_0x6680('0xad'),_0x101f26['body'][_0x6680('0xab')][_0x1c8ba8][_0x6680('0xae')])};}}var _0xb9fab9=_0x303b1b[_0x6680('0xaf')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0xb9fab9,'message':_0x101f26[_0x6680('0x64')]});})[_0x6680('0x11')](function(_0x1a943f){if(!_0x1a943f)return;_0x24cc88=_0x1a943f;if(!_0x43c669[_0x6680('0xa4')])throw new Error(_0x6680('0xb0'));if(_0x43c669[_0x6680('0xa4')][_0x6680('0xb1')][_0x6680('0x52')])return _0x43c669[_0x6680('0xa4')][_0x6680('0xb1')][0x0];return db[_0x6680('0x89')][_0x6680('0x73')](_[_0x6680('0xa')](_0x101f26[_0x6680('0x64')],{'firstName':_0x101f26[_0x6680('0x64')]['to'],'email':_0x101f26['body']['to'],'phone':_0x101f26[_0x6680('0x64')]['to'],'ListId':_0x43c669[_0x6680('0x78')]}));})[_0x6680('0x11')](function(_0x56a490){if(!_0x56a490)return;var _0x52ac97={'UserId':_0x101f26[_0x6680('0x37')]['id'],'ContactId':_0x56a490['id'],'MailAccountId':_0x43c669['id'],'inReplyTo':_0x24cc88[_0x6680('0xb2')],'to':_0x101f26[_0x6680('0x64')][_0x6680('0xaa')],'cc':_0x101f26['body']['cc'],'subject':_0x101f26['body']['subject'],'attach':_0x101f26['body'][_0x6680('0xb3')],'firstMsgDirection':_0x6680('0xb4'),'lastMsgAt':moment()[_0x6680('0x9e')](_0x6680('0x9f')),'lastMsgDirection':_0x6680('0xb4'),'Messages':[_[_0x6680('0x5a')](_0x101f26['body'],{'messageId':_0x24cc88['messageId'],'sentAt':moment()['format'](_0x6680('0x9f')),'read':!![],'MailAccountId':_0x43c669['id'],'UserId':_0x101f26[_0x6680('0x37')]['id'],'ContactId':_0x56a490['id']})]};if(_0x101f26['body'][_0x6680('0xb5')]){_0x52ac97=_[_0x6680('0x5a')](_0x52ac97,_0x101f26[_0x6680('0x64')][_0x6680('0xb5')]);}return db[_0x6680('0x86')]['create'](_0x52ac97,{'include':[{'model':db['MailMessage'],'as':_0x6680('0xb6')}]});})[_0x6680('0x11')](respondWithResult(_0x3fa835,null))[_0x6680('0x1c')](handleError(_0x3fa835,null));};exports['verifySmtp']=function(_0x56fac6,_0x5502db){return db[_0x6680('0x48')][_0x6680('0x63')]({'where':{'id':_0x56fac6[_0x6680('0x67')]['id']},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0x6680('0x11')](handleEntityNotFound(_0x5502db,null))['then'](function(_0x2a3a95){if(!_0x2a3a95[_0x6680('0x43')])return;var _0x1204d2=_0x2a3a95[_0x6680('0xaf')]();return respondWithRpcPromise(_0x6680('0xb7'),_0x6680('0xb8'),{'account':_0x1204d2});})[_0x6680('0x11')](respondWithResult(_0x5502db,null))[_0x6680('0x1c')](handleError(_0x5502db,null));};exports[_0x6680('0x25')]=function(_0x5e02d4,_0xa3cd73){return db[_0x6680('0x48')][_0x6680('0x63')]({'where':{'id':_0x5e02d4[_0x6680('0x67')]['id']}})[_0x6680('0x11')](handleEntityNotFound(_0xa3cd73,null))[_0x6680('0x11')](function(_0x1b92e4){if(_0x1b92e4&&_0x1b92e4[_0x6680('0x3f')]){throw new db[(_0x6680('0xb9'))][(_0x6680('0xba'))](_0x6680('0xbb'));}return _0x1b92e4;})[_0x6680('0x11')](removeEntity(_0xa3cd73,null))[_0x6680('0x1c')](handleError(_0xa3cd73,null));};exports[_0x6680('0xbc')]=function(_0x2a96e3,_0x1e7fc9){return db[_0x6680('0x48')]['find']({'where':{'id':_0x2a96e3[_0x6680('0x67')]['id']}})['then'](handleEntityNotFound(_0x1e7fc9,null))[_0x6680('0x11')](function(_0x59d5a0){if(_0x59d5a0){return _0x59d5a0[_0x6680('0xbc')](_0x2a96e3[_0x6680('0x64')]['ids'],_[_0x6680('0xbd')](_0x2a96e3[_0x6680('0x64')],[_0x6680('0x70'),'id'])||{})[_0x6680('0xbe')](function(_0x116acd){for(var _0x48efdf=0x0;_0x48efdf<_0x2a96e3[_0x6680('0x64')]['ids'][_0x6680('0x52')];_0x48efdf+=0x1){socket[_0x6680('0xbf')]('userMailAccount:save',{'UserId':Number(_0x2a96e3['body'][_0x6680('0x70')][_0x48efdf]),'MailAccountId':Number(_0x2a96e3[_0x6680('0x67')]['id'])});}return _0x116acd;});}})[_0x6680('0x11')](respondWithResult(_0x1e7fc9,null))[_0x6680('0x1c')](handleError(_0x1e7fc9,null));};exports['removeAgents']=function(_0x3ec24e,_0x5b7c5d){return db[_0x6680('0x48')][_0x6680('0x63')]({'where':{'id':_0x3ec24e[_0x6680('0x67')]['id']}})[_0x6680('0x11')](handleEntityNotFound(_0x5b7c5d,null))[_0x6680('0x11')](function(_0x39ceaf){if(_0x39ceaf){return _0x39ceaf['removeAgents'](_0x3ec24e[_0x6680('0x4c')][_0x6680('0x70')])['then'](function(){if(_['isArray'](_0x3ec24e[_0x6680('0x4c')]['ids'])){for(var _0x299cdd=0x0;_0x299cdd<_0x3ec24e[_0x6680('0x4c')][_0x6680('0x70')]['length'];_0x299cdd+=0x1){socket[_0x6680('0xbf')](_0x6680('0xc0'),{'UserId':Number(_0x3ec24e['query']['ids'][_0x299cdd]),'MailAccountId':Number(_0x3ec24e[_0x6680('0x67')]['id'])});}}else{socket['emit'](_0x6680('0xc0'),{'UserId':Number(_0x3ec24e[_0x6680('0x4c')][_0x6680('0x70')]),'MailAccountId':Number(_0x3ec24e[_0x6680('0x67')]['id'])});}});}})['then'](respondWithStatusCode(_0x5b7c5d,null))[_0x6680('0x1c')](handleError(_0x5b7c5d,null));};exports[_0x6680('0xc1')]=function(_0x21237e,_0x174e59){var _0x1c3262={};var _0x13235c={};var _0x4311ae;var _0x1ec049;return db[_0x6680('0x48')][_0x6680('0x75')]({'where':{'id':_0x21237e[_0x6680('0x67')]['id']}})['then'](handleEntityNotFound(_0x174e59,null))[_0x6680('0x11')](function(_0x4e4527){if(_0x4e4527){_0x4311ae=_0x4e4527;_0x13235c['model']=_[_0x6680('0x62')](db[_0x6680('0x8a')][_0x6680('0x49')]);_0x13235c[_0x6680('0x4c')]=_['keys'](_0x21237e[_0x6680('0x4c')]);_0x13235c[_0x6680('0x4d')]=_['intersection'](_0x13235c[_0x6680('0x4e')],_0x13235c[_0x6680('0x4c')]);_0x1c3262[_0x6680('0x51')]=_['intersection'](_0x13235c[_0x6680('0x4e')],qs['fields'](_0x21237e[_0x6680('0x4c')][_0x6680('0x50')]));_0x1c3262[_0x6680('0x51')]=_0x1c3262[_0x6680('0x51')][_0x6680('0x52')]?_0x1c3262[_0x6680('0x51')]:_0x13235c[_0x6680('0x4e')];_0x1c3262[_0x6680('0x6d')]=qs[_0x6680('0x56')](_0x21237e[_0x6680('0x4c')]['sort']);_0x1c3262[_0x6680('0x57')]=qs[_0x6680('0x4d')](_['pick'](_0x21237e[_0x6680('0x4c')],_0x13235c['filters']));if(_0x21237e[_0x6680('0x4c')][_0x6680('0x59')]){_0x1c3262[_0x6680('0x57')]=_[_0x6680('0x5a')](_0x1c3262['where'],{'$or':_[_0x6680('0x47')](_0x1c3262['attributes'],function(_0x23d2ad){var _0x1bf750={};_0x1bf750[_0x23d2ad]={'$like':'%'+_0x21237e[_0x6680('0x4c')][_0x6680('0x59')]+'%'};return _0x1bf750;})});}_0x1c3262=_['merge']({},_0x1c3262,_0x21237e[_0x6680('0x5c')]);return _0x4311ae[_0x6680('0xc1')](_0x1c3262);}})[_0x6680('0x11')](function(_0x2c22c6){if(_0x2c22c6){_0x1ec049=_0x2c22c6[_0x6680('0x52')];if(!_0x21237e[_0x6680('0x4c')][_0x6680('0x53')](_0x6680('0x54'))){_0x1c3262[_0x6680('0x55')]=qs[_0x6680('0x55')](_0x21237e[_0x6680('0x4c')][_0x6680('0x55')]);_0x1c3262['offset']=qs[_0x6680('0x1f')](_0x21237e[_0x6680('0x4c')][_0x6680('0x1f')]);}return _0x4311ae[_0x6680('0xc1')](_0x1c3262);}})[_0x6680('0x11')](function(_0x1e99ef){if(_0x1e99ef){return _0x1e99ef?{'count':_0x1ec049,'rows':_0x1e99ef}:null;}})[_0x6680('0x11')](respondWithResult(_0x174e59,null))[_0x6680('0x1c')](handleError(_0x174e59,null));}; \ No newline at end of file +var _0xa4c1=['Interaction','verifySmtp','VerifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','removeAgents','isArray','emit','userMailAccount:remove','getAgents','moment','util','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','destroy','get','MailAccounts','UserProfileResource','stack','name','send','imap.gmail.com','yahoo','imap.mail.yahoo.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','gmail','smtp.gmail.com','smtp.mail.yahoo.com','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','service','authentication','Imap','Smtp','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','rows','show','params','include','find','body','provider','secure','Mail\x20Account\x20not\x20found','addDisposition','MailAccountId','create','getDispositions','Disposition','order','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','getSmtp','addSmtp','removeSmtp','addInteraction','omit','MailInteraction','CmContact','User','Owner','Tag','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','MailApplication','findAndCountAll','finally','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','Contacts','CloudProvider','from','%s\x20<%s>','attachments','join','root','server/files/attachments','getSmtpOptions','List','List\x20not\x20found','defaults','messageId','attach'];(function(_0x48cea7,_0x18615a){var _0x19483d=function(_0x54dad7){while(--_0x54dad7){_0x48cea7['push'](_0x48cea7['shift']());}};_0x19483d(++_0x18615a);}(_0xa4c1,0xc2));var _0x1a4c=function(_0x5e77db,_0x356d1c){_0x5e77db=_0x5e77db-0x0;var _0x34b675=_0xa4c1[_0x5e77db];return _0x34b675;};'use strict';var moment=require(_0x1a4c('0x0'));var BPromise=require('bluebird');var util=require(_0x1a4c('0x1'));var path=require('path');var _=require('lodash');var juice=require('juice');var Redis=require(_0x1a4c('0x2'));var qs=require(_0x1a4c('0x3'));var logger=require('../../config/logger')(_0x1a4c('0x4'));var config=require(_0x1a4c('0x5'));var db=require(_0x1a4c('0x6'))['db'];config[_0x1a4c('0x7')]=_['defaults'](config[_0x1a4c('0x7')],{'host':_0x1a4c('0x8'),'port':0x18eb});var socket=require(_0x1a4c('0x9'))(new Redis(config[_0x1a4c('0x7')]));require(_0x1a4c('0xa'))[_0x1a4c('0xb')](socket);var jayson=require(_0x1a4c('0xc'));var client=jayson[_0x1a4c('0xd')][_0x1a4c('0xe')]({'port':0x232b});function respondWithRpcPromise(_0x5a5326,_0x34eb96,_0x6bafa1,_0x992697){return new BPromise(function(_0x1b3ed1,_0xe764d8){var _0x56b48c=_0x992697||client;return _0x56b48c['request'](_0x5a5326,_0x6bafa1)[_0x1a4c('0xf')](function(_0x12d3cf){logger[_0x1a4c('0x10')](_0x1a4c('0x11'),_0x34eb96,'request\x20sent');logger[_0x1a4c('0x12')](_0x1a4c('0x13'),_0x34eb96,'request\x20sent',JSON[_0x1a4c('0x14')](_0x12d3cf));if(_0x12d3cf[_0x1a4c('0x15')]){if(_0x12d3cf[_0x1a4c('0x15')][_0x1a4c('0x16')]===0x1f4){logger[_0x1a4c('0x15')](_0x1a4c('0x11'),_0x34eb96,_0x12d3cf[_0x1a4c('0x15')][_0x1a4c('0x17')]);return _0xe764d8(_0x12d3cf[_0x1a4c('0x15')][_0x1a4c('0x17')]);}logger[_0x1a4c('0x15')](_0x1a4c('0x11'),_0x34eb96,_0x12d3cf[_0x1a4c('0x15')][_0x1a4c('0x17')]);return _0x1b3ed1(_0x12d3cf[_0x1a4c('0x15')][_0x1a4c('0x17')]);}else{logger[_0x1a4c('0x10')]('MailAccount,\x20%s,\x20%s',_0x34eb96,_0x1a4c('0x18'));_0x1b3ed1(_0x12d3cf[_0x1a4c('0x19')][_0x1a4c('0x17')]);}})[_0x1a4c('0x1a')](function(_0x553781){logger[_0x1a4c('0x15')]('MailAccount,\x20%s,\x20%s',_0x34eb96,_0x553781);_0xe764d8(_0x553781);});});}function respondWithStatusCode(_0x43871c,_0x5f4b59){_0x5f4b59=_0x5f4b59||0xcc;return function(_0x138790){if(_0x138790){return _0x43871c[_0x1a4c('0x1b')](_0x5f4b59);}return _0x43871c[_0x1a4c('0x1c')](_0x5f4b59)[_0x1a4c('0x1d')]();};}function respondWithResult(_0x1182dd,_0x3eb476){_0x3eb476=_0x3eb476||0xc8;return function(_0x278834){if(_0x278834){return _0x1182dd[_0x1a4c('0x1c')](_0x3eb476)[_0x1a4c('0x1e')](_0x278834);}};}function respondWithFilteredResult(_0x4d7102,_0x2738fd){return function(_0x25a25d){if(_0x25a25d){var _0xe9095e=typeof _0x2738fd['offset']===_0x1a4c('0x1f')&&typeof _0x2738fd[_0x1a4c('0x20')]===_0x1a4c('0x1f');var _0x230041=_0x25a25d[_0x1a4c('0x21')];var _0x1aad3b=_0xe9095e?0x0:_0x2738fd['offset'];var _0x1e3841=_0xe9095e?_0x25a25d[_0x1a4c('0x21')]:_0x2738fd[_0x1a4c('0x22')]+_0x2738fd[_0x1a4c('0x20')];var _0x23509f;if(_0x1e3841>=_0x230041){_0x1e3841=_0x230041;_0x23509f=0xc8;}else{_0x23509f=0xce;}_0x4d7102[_0x1a4c('0x1c')](_0x23509f);return _0x4d7102[_0x1a4c('0x23')](_0x1a4c('0x24'),_0x1aad3b+'-'+_0x1e3841+'/'+_0x230041)[_0x1a4c('0x1e')](_0x25a25d);}return null;};}function saveUpdates(_0x3f7fe8){return function(_0x54cea9){if(_0x54cea9){return _0x54cea9[_0x1a4c('0x25')](_0x3f7fe8)[_0x1a4c('0xf')](function(_0x5f12d1){return _0x5f12d1;});}return null;};}function removeEntity(_0x108b87){return function(_0x5d8a53){if(_0x5d8a53){return _0x5d8a53[_0x1a4c('0x26')]()[_0x1a4c('0xf')](function(){var _0x5b3bd4=_0x5d8a53[_0x1a4c('0x27')]({'plain':!![]});var _0x4ea2ba=_0x1a4c('0x28');return db[_0x1a4c('0x29')][_0x1a4c('0x26')]({'where':{'type':_0x4ea2ba,'resourceId':_0x5b3bd4['id']}})[_0x1a4c('0xf')](function(){return _0x5d8a53;});})[_0x1a4c('0xf')](function(){_0x108b87[_0x1a4c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x197665){return function(_0x3a067d){if(!_0x3a067d){_0x197665[_0x1a4c('0x1b')](0x194);}return _0x3a067d;};}function handleError(_0x302ccb,_0x53323f){_0x53323f=_0x53323f||0x1f4;return function(_0x51e2cd){logger[_0x1a4c('0x15')](_0x51e2cd[_0x1a4c('0x2a')]);if(_0x51e2cd[_0x1a4c('0x2b')]){delete _0x51e2cd[_0x1a4c('0x2b')];}_0x302ccb[_0x1a4c('0x1c')](_0x53323f)[_0x1a4c('0x2c')](_0x51e2cd);};}function getImapHost(_0x43016a){switch(_0x43016a){case'gmail':return _0x1a4c('0x2d');case _0x1a4c('0x2e'):return _0x1a4c('0x2f');case'hotmail':return'imap-mail.outlook.com';case _0x1a4c('0x30'):return _0x1a4c('0x31');}throw new Error(_0x1a4c('0x32'),_0x43016a);}function getSmtpHost(_0x3e39b7){switch(_0x3e39b7){case _0x1a4c('0x33'):return _0x1a4c('0x34');case _0x1a4c('0x2e'):return _0x1a4c('0x35');case'hotmail':return'smtp-mail.outlook.com';case _0x1a4c('0x30'):return _0x1a4c('0x36');}throw new Error(_0x1a4c('0x32'),_0x3e39b7);}function getAuthenticationOptions(_0x1cedd7,_0x328e5f){var _0x291c5a={};var _0x8a240b={};if(_0x1cedd7){_0x291c5a[_0x1a4c('0x37')]=_0x8a240b['user']=_0x328e5f[_0x1a4c('0x38')];_0x291c5a[_0x1a4c('0x39')]=_0x8a240b[_0x1a4c('0x3a')]=_0x328e5f[_0x1a4c('0x39')];if(_0x328e5f[_0x1a4c('0x3b')]){_0x291c5a[_0x1a4c('0x3b')]=_0x8a240b[_0x1a4c('0x3b')]=!![];_0x291c5a[_0x1a4c('0x3c')]=_0x8a240b[_0x1a4c('0x3c')]=_0x328e5f[_0x1a4c('0x3c')];_0x291c5a[_0x1a4c('0x39')]=_0x8a240b[_0x1a4c('0x3a')]=null;}else{_0x291c5a[_0x1a4c('0x3c')]=_0x8a240b[_0x1a4c('0x3c')]=null;}_0x291c5a[_0x1a4c('0x3d')]=getImapHost(_0x1cedd7);_0x291c5a[_0x1a4c('0x3e')]=0x3e1;_0x8a240b[_0x1a4c('0x3d')]=getSmtpHost(_0x1cedd7);_0x8a240b[_0x1a4c('0x3e')]=0x24b;_0x8a240b['secure']=![];_0x291c5a[_0x1a4c('0x3f')]=_0x8a240b[_0x1a4c('0x3f')]=null;}else{if(_0x328e5f['authentication']){_0x291c5a[_0x1a4c('0x37')]=_0x8a240b['user']=_0x328e5f[_0x1a4c('0x38')];_0x291c5a[_0x1a4c('0x39')]=_0x8a240b['pass']=_0x328e5f[_0x1a4c('0x39')];}else{_0x291c5a[_0x1a4c('0x40')]=_0x8a240b['authentication']=![];_0x291c5a[_0x1a4c('0x37')]=_0x8a240b[_0x1a4c('0x37')]=null;_0x291c5a[_0x1a4c('0x39')]=_0x8a240b[_0x1a4c('0x3a')]=null;}_0x291c5a[_0x1a4c('0x3d')]=_0x328e5f['Imap'][_0x1a4c('0x3d')];_0x291c5a[_0x1a4c('0x3e')]=_0x328e5f[_0x1a4c('0x41')][_0x1a4c('0x3e')];_0x8a240b[_0x1a4c('0x3d')]=_0x328e5f[_0x1a4c('0x42')]['host'];_0x8a240b[_0x1a4c('0x3e')]=_0x328e5f[_0x1a4c('0x42')][_0x1a4c('0x3e')];}return{'Imap':_0x291c5a,'Smtp':_0x8a240b};}exports['index']=function(_0x3459be,_0x33ddb3){var _0x16fe2a={'include':[{'model':db[_0x1a4c('0x43')],'as':_0x1a4c('0x41')},{'model':db[_0x1a4c('0x44')],'as':_0x1a4c('0x42')},{'model':db[_0x1a4c('0x45')],'as':_0x1a4c('0x46')}]},_0xf24dd7={},_0x5beefc={'count':0x0,'rows':[]};var _0x32f030=_[_0x1a4c('0x47')](db[_0x1a4c('0x48')][_0x1a4c('0x49')],function(_0x2e09da){return{'name':_0x2e09da['fieldName'],'type':_0x2e09da['type'][_0x1a4c('0x4a')]};});_0xf24dd7[_0x1a4c('0x4b')]=_[_0x1a4c('0x47')](_0x32f030,'name');_0xf24dd7['query']=_[_0x1a4c('0x4c')](_0x3459be[_0x1a4c('0x4d')]);_0xf24dd7['filters']=_[_0x1a4c('0x4e')](_0xf24dd7[_0x1a4c('0x4b')],_0xf24dd7[_0x1a4c('0x4d')]);_0x16fe2a['attributes']=_[_0x1a4c('0x4e')](_0xf24dd7[_0x1a4c('0x4b')],qs[_0x1a4c('0x4f')](_0x3459be['query'][_0x1a4c('0x4f')]));_0x16fe2a[_0x1a4c('0x50')]=_0x16fe2a[_0x1a4c('0x50')][_0x1a4c('0x51')]?_0x16fe2a[_0x1a4c('0x50')]:_0xf24dd7[_0x1a4c('0x4b')];if(!_0x3459be[_0x1a4c('0x4d')][_0x1a4c('0x52')](_0x1a4c('0x53'))){_0x16fe2a[_0x1a4c('0x20')]=qs[_0x1a4c('0x20')](_0x3459be[_0x1a4c('0x4d')][_0x1a4c('0x20')]);_0x16fe2a[_0x1a4c('0x22')]=qs[_0x1a4c('0x22')](_0x3459be['query']['offset']);}_0x16fe2a['order']=qs[_0x1a4c('0x54')](_0x3459be[_0x1a4c('0x4d')][_0x1a4c('0x54')]);_0x16fe2a['where']=qs[_0x1a4c('0x55')](_[_0x1a4c('0x56')](_0x3459be['query'],_0xf24dd7[_0x1a4c('0x55')]),_0x32f030);if(_0x3459be[_0x1a4c('0x4d')][_0x1a4c('0x57')]){_0x16fe2a[_0x1a4c('0x58')]=_[_0x1a4c('0x59')](_0x16fe2a[_0x1a4c('0x58')],{'$or':_[_0x1a4c('0x47')](_0x32f030,function(_0x1df894){if(_0x1df894['type']!==_0x1a4c('0x5a')){var _0xd84295={};_0xd84295[_0x1df894[_0x1a4c('0x2b')]]={'$like':'%'+_0x3459be[_0x1a4c('0x4d')][_0x1a4c('0x57')]+'%'};return _0xd84295;}})});}_0x16fe2a=_[_0x1a4c('0x59')]({},_0x16fe2a,_0x3459be[_0x1a4c('0x5b')]);var _0x5c1b77={'where':_0x16fe2a[_0x1a4c('0x58')]};return db[_0x1a4c('0x48')][_0x1a4c('0x21')](_0x5c1b77)[_0x1a4c('0xf')](function(_0x2508a7){_0x5beefc[_0x1a4c('0x21')]=_0x2508a7;if(_0x3459be[_0x1a4c('0x4d')][_0x1a4c('0x5c')]){_0x16fe2a['include']=[{'all':!![]}];}return db[_0x1a4c('0x48')]['findAll'](_0x16fe2a);})[_0x1a4c('0xf')](function(_0x1c3dcc){_0x5beefc[_0x1a4c('0x5d')]=_0x1c3dcc;return _0x5beefc;})[_0x1a4c('0xf')](respondWithFilteredResult(_0x33ddb3,_0x16fe2a))['catch'](handleError(_0x33ddb3,null));};exports[_0x1a4c('0x5e')]=function(_0xffca89,_0x30e18d){var _0x11a62c={'raw':![],'where':{'id':_0xffca89[_0x1a4c('0x5f')]['id']},'include':[{'model':db[_0x1a4c('0x43')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0x1a4c('0x42')},{'model':db[_0x1a4c('0x45')],'as':'mandatoryDispositionPause'}]},_0x5a74c3={};_0x5a74c3[_0x1a4c('0x4b')]=_[_0x1a4c('0x4c')](db[_0x1a4c('0x48')]['rawAttributes']);_0x5a74c3[_0x1a4c('0x4d')]=_[_0x1a4c('0x4c')](_0xffca89[_0x1a4c('0x4d')]);_0x5a74c3['filters']=_['intersection'](_0x5a74c3['model'],_0x5a74c3[_0x1a4c('0x4d')]);_0x11a62c['attributes']=_[_0x1a4c('0x4e')](_0x5a74c3[_0x1a4c('0x4b')],qs['fields'](_0xffca89[_0x1a4c('0x4d')][_0x1a4c('0x4f')]));_0x11a62c[_0x1a4c('0x50')]=_0x11a62c['attributes'][_0x1a4c('0x51')]?_0x11a62c[_0x1a4c('0x50')]:_0x5a74c3[_0x1a4c('0x4b')];if(_0xffca89[_0x1a4c('0x4d')][_0x1a4c('0x5c')]){_0x11a62c[_0x1a4c('0x60')]=[{'all':!![]}];}_0x11a62c=_[_0x1a4c('0x59')]({},_0x11a62c,_0xffca89[_0x1a4c('0x5b')]);return db[_0x1a4c('0x48')][_0x1a4c('0x61')](_0x11a62c)['then'](handleEntityNotFound(_0x30e18d,null))[_0x1a4c('0xf')](respondWithResult(_0x30e18d,null))[_0x1a4c('0x1a')](handleError(_0x30e18d,null));};exports[_0x1a4c('0x25')]=function(_0x15b349,_0x1bc870){if(_0x15b349[_0x1a4c('0x62')]['id']){delete _0x15b349[_0x1a4c('0x62')]['id'];}var _0xc07017=_0x15b349[_0x1a4c('0x62')][_0x1a4c('0x63')]==='custom'?null:_0x15b349['body']['provider'];var _0x272abb=_0x15b349[_0x1a4c('0x62')][_0x1a4c('0x41')]||{};var _0x4e3386=_0x15b349[_0x1a4c('0x62')][_0x1a4c('0x42')]||{};if(_0xc07017){_0x272abb[_0x1a4c('0x3d')]=getImapHost(_0xc07017);_0x272abb[_0x1a4c('0x3e')]=0x3e1;_0x4e3386[_0x1a4c('0x3d')]=getSmtpHost(_0xc07017);_0x4e3386[_0x1a4c('0x3e')]=0x24b;_0x4e3386[_0x1a4c('0x64')]=![];}if(_0x4e3386['modernAuthentication']){_0x4e3386[_0x1a4c('0x64')]=![];}else{_0x4e3386[_0x1a4c('0x3c')]=null;}if(!_0x272abb[_0x1a4c('0x3b')])_0x272abb[_0x1a4c('0x3c')]=null;_0x15b349[_0x1a4c('0x62')]['Imap']=_0x272abb;_0x15b349['body'][_0x1a4c('0x42')]=_0x4e3386;return db['MailAccount'][_0x1a4c('0x61')]({'where':{'id':_0x15b349[_0x1a4c('0x5f')]['id']},'include':[{'model':db[_0x1a4c('0x43')],'as':_0x1a4c('0x41')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x1a4c('0x45')],'as':_0x1a4c('0x46')}]})[_0x1a4c('0xf')](handleEntityNotFound(_0x1bc870,null))['then'](function(_0x176064){if(!_0x176064)throw new Error(_0x1a4c('0x65'));if(_0x176064['service'])delete _0x15b349[_0x1a4c('0x62')][_0x1a4c('0x41')];return _0x176064;})['then'](saveUpdates(_0x15b349[_0x1a4c('0x62')],null))[_0x1a4c('0xf')](function(_0x1e2448){if(!_0x15b349['body']['Imap'])return _0x1e2448;return db['MailServerIn'][_0x1a4c('0x25')](_0x15b349[_0x1a4c('0x62')][_0x1a4c('0x41')],{'where':{'MailAccountId':_0x1e2448['id']}})['then'](function(){return _0x1e2448;});})[_0x1a4c('0xf')](function(_0x4a7f0d){if(!_0x15b349[_0x1a4c('0x62')][_0x1a4c('0x42')])return _0x4a7f0d;return db[_0x1a4c('0x44')][_0x1a4c('0x25')](_0x15b349[_0x1a4c('0x62')][_0x1a4c('0x42')],{'where':{'MailAccountId':_0x4a7f0d['id']}})[_0x1a4c('0xf')](function(){return _0x4a7f0d;});})[_0x1a4c('0xf')](respondWithResult(_0x1bc870,null))['catch'](handleError(_0x1bc870,null));};exports['describe']=function(_0x5a4ef6,_0x342973){return db[_0x1a4c('0x48')]['describe']()[_0x1a4c('0xf')](respondWithResult(_0x342973,null))['catch'](handleError(_0x342973,null));};exports[_0x1a4c('0x66')]=function(_0x25798b,_0x34e541){if(_0x25798b['body']['id']){delete _0x25798b[_0x1a4c('0x62')]['id'];}return db['MailAccount'][_0x1a4c('0x61')]({'where':{'id':_0x25798b[_0x1a4c('0x5f')]['id']}})[_0x1a4c('0xf')](handleEntityNotFound(_0x34e541,null))[_0x1a4c('0xf')](function(_0x51e815){if(_0x51e815){_0x25798b[_0x1a4c('0x62')][_0x1a4c('0x67')]=_0x51e815['id'];return db['Disposition'][_0x1a4c('0x68')](_0x25798b[_0x1a4c('0x62')]);}})[_0x1a4c('0xf')](respondWithResult(_0x34e541,null))[_0x1a4c('0x1a')](handleError(_0x34e541,null));};exports[_0x1a4c('0x69')]=function(_0x255f70,_0x484217){var _0x344a59={'raw':![],'where':{}};var _0x4bee35={};var _0x27e26b={'count':0x0,'rows':[]};return db[_0x1a4c('0x48')]['findOne']({'where':{'id':_0x255f70[_0x1a4c('0x5f')]['id']}})['then'](handleEntityNotFound(_0x484217,null))['then'](function(_0x636153){if(_0x636153){_0x4bee35['model']=_[_0x1a4c('0x4c')](db[_0x1a4c('0x6a')][_0x1a4c('0x49')]);_0x4bee35[_0x1a4c('0x4d')]=_[_0x1a4c('0x4c')](_0x255f70[_0x1a4c('0x4d')]);_0x4bee35[_0x1a4c('0x55')]=_[_0x1a4c('0x4e')](_0x4bee35['model'],_0x4bee35[_0x1a4c('0x4d')]);_0x344a59[_0x1a4c('0x50')]=_[_0x1a4c('0x4e')](_0x4bee35['model'],qs[_0x1a4c('0x4f')](_0x255f70['query']['fields']));_0x344a59[_0x1a4c('0x50')]=_0x344a59[_0x1a4c('0x50')]['length']?_0x344a59[_0x1a4c('0x50')]:_0x4bee35[_0x1a4c('0x4b')];if(!_0x255f70['query'][_0x1a4c('0x52')]('nolimit')){_0x344a59[_0x1a4c('0x20')]=qs[_0x1a4c('0x20')](_0x255f70[_0x1a4c('0x4d')]['limit']);_0x344a59[_0x1a4c('0x22')]=qs[_0x1a4c('0x22')](_0x255f70[_0x1a4c('0x4d')][_0x1a4c('0x22')]);}_0x344a59[_0x1a4c('0x6b')]=qs[_0x1a4c('0x54')](_0x255f70[_0x1a4c('0x4d')][_0x1a4c('0x54')]);_0x344a59[_0x1a4c('0x58')]=qs[_0x1a4c('0x55')](_[_0x1a4c('0x56')](_0x255f70[_0x1a4c('0x4d')],_0x4bee35['filters']));_0x344a59[_0x1a4c('0x58')]['MailAccountId']=_0x636153['id'];if(_0x255f70[_0x1a4c('0x4d')]['filter']){_0x344a59[_0x1a4c('0x58')]=_[_0x1a4c('0x59')](_0x344a59['where'],{'$or':_[_0x1a4c('0x47')](_0x344a59[_0x1a4c('0x50')],function(_0xf6cff9){var _0x22f24d={};_0x22f24d[_0xf6cff9]={'$like':'%'+_0x255f70[_0x1a4c('0x4d')][_0x1a4c('0x57')]+'%'};return _0x22f24d;})});}_0x344a59=_[_0x1a4c('0x59')]({},_0x344a59,_0x255f70['options']);return db[_0x1a4c('0x6a')][_0x1a4c('0x21')]({'where':_0x344a59['where']})[_0x1a4c('0xf')](function(_0x55060f){_0x27e26b[_0x1a4c('0x21')]=_0x55060f;if(_0x255f70[_0x1a4c('0x4d')]['includeAll']){_0x344a59[_0x1a4c('0x60')]=[{'all':!![]}];}return db['Disposition'][_0x1a4c('0x6c')](_0x344a59);})['then'](function(_0x4e8e20){_0x27e26b['rows']=_0x4e8e20;return _0x27e26b;});}})[_0x1a4c('0xf')](respondWithFilteredResult(_0x484217,_0x344a59))['catch'](handleError(_0x484217,null));};exports[_0x1a4c('0x6d')]=function(_0x5981e9,_0x348f0d){return db[_0x1a4c('0x48')][_0x1a4c('0x61')]({'where':{'id':_0x5981e9[_0x1a4c('0x5f')]['id']}})[_0x1a4c('0xf')](handleEntityNotFound(_0x348f0d,null))['then'](function(_0xace298){if(_0xace298){return _0xace298[_0x1a4c('0x6d')](_0x5981e9[_0x1a4c('0x4d')][_0x1a4c('0x6e')]);}})[_0x1a4c('0xf')](respondWithStatusCode(_0x348f0d,null))[_0x1a4c('0x1a')](handleError(_0x348f0d,null));};exports[_0x1a4c('0x6f')]=function(_0x3c9b17,_0x19ab7e){if(_0x3c9b17['body']['id']){delete _0x3c9b17[_0x1a4c('0x62')]['id'];}return db[_0x1a4c('0x48')][_0x1a4c('0x61')]({'where':{'id':_0x3c9b17[_0x1a4c('0x5f')]['id']}})[_0x1a4c('0xf')](handleEntityNotFound(_0x19ab7e,null))[_0x1a4c('0xf')](function(_0x2e225d){if(_0x2e225d){_0x3c9b17[_0x1a4c('0x62')][_0x1a4c('0x67')]=_0x2e225d['id'];return db[_0x1a4c('0x70')][_0x1a4c('0x68')](_0x3c9b17[_0x1a4c('0x62')]);}})[_0x1a4c('0xf')](respondWithResult(_0x19ab7e,null))[_0x1a4c('0x1a')](handleError(_0x19ab7e,null));};exports[_0x1a4c('0x71')]=function(_0x2878f0,_0x3db5bb){var _0x13fa50={'raw':![],'where':{}};var _0x37fcab={};var _0x3b69e7={'count':0x0,'rows':[]};return db[_0x1a4c('0x48')][_0x1a4c('0x72')]({'where':{'id':_0x2878f0[_0x1a4c('0x5f')]['id']}})['then'](handleEntityNotFound(_0x3db5bb,null))['then'](function(_0x32ac0f){if(_0x32ac0f){_0x37fcab['model']=_[_0x1a4c('0x4c')](db['CannedAnswer'][_0x1a4c('0x49')]);_0x37fcab['query']=_[_0x1a4c('0x4c')](_0x2878f0[_0x1a4c('0x4d')]);_0x37fcab[_0x1a4c('0x55')]=_[_0x1a4c('0x4e')](_0x37fcab[_0x1a4c('0x4b')],_0x37fcab[_0x1a4c('0x4d')]);_0x13fa50[_0x1a4c('0x50')]=_[_0x1a4c('0x4e')](_0x37fcab[_0x1a4c('0x4b')],qs['fields'](_0x2878f0['query'][_0x1a4c('0x4f')]));_0x13fa50[_0x1a4c('0x50')]=_0x13fa50['attributes']['length']?_0x13fa50[_0x1a4c('0x50')]:_0x37fcab['model'];if(!_0x2878f0['query'][_0x1a4c('0x52')](_0x1a4c('0x53'))){_0x13fa50[_0x1a4c('0x20')]=qs[_0x1a4c('0x20')](_0x2878f0[_0x1a4c('0x4d')][_0x1a4c('0x20')]);_0x13fa50[_0x1a4c('0x22')]=qs[_0x1a4c('0x22')](_0x2878f0[_0x1a4c('0x4d')][_0x1a4c('0x22')]);}_0x13fa50[_0x1a4c('0x6b')]=qs[_0x1a4c('0x54')](_0x2878f0[_0x1a4c('0x4d')]['sort']);_0x13fa50[_0x1a4c('0x58')]=qs[_0x1a4c('0x55')](_[_0x1a4c('0x56')](_0x2878f0[_0x1a4c('0x4d')],_0x37fcab[_0x1a4c('0x55')]));_0x13fa50['where'][_0x1a4c('0x67')]=_0x32ac0f['id'];if(_0x2878f0[_0x1a4c('0x4d')][_0x1a4c('0x57')]){_0x13fa50[_0x1a4c('0x58')]=_['merge'](_0x13fa50[_0x1a4c('0x58')],{'$or':_['map'](_0x13fa50[_0x1a4c('0x50')],function(_0x157516){var _0x4cb253={};_0x4cb253[_0x157516]={'$like':'%'+_0x2878f0[_0x1a4c('0x4d')][_0x1a4c('0x57')]+'%'};return _0x4cb253;})});}_0x13fa50=_['merge']({},_0x13fa50,_0x2878f0[_0x1a4c('0x5b')]);return db[_0x1a4c('0x70')]['count']({'where':_0x13fa50[_0x1a4c('0x58')]})[_0x1a4c('0xf')](function(_0x2d0913){_0x3b69e7[_0x1a4c('0x21')]=_0x2d0913;if(_0x2878f0['query']['includeAll']){_0x13fa50[_0x1a4c('0x60')]=[{'all':!![]}];}return db[_0x1a4c('0x70')][_0x1a4c('0x6c')](_0x13fa50);})[_0x1a4c('0xf')](function(_0x424b8e){_0x3b69e7['rows']=_0x424b8e;return _0x3b69e7;});}})['then'](respondWithFilteredResult(_0x3db5bb,_0x13fa50))[_0x1a4c('0x1a')](handleError(_0x3db5bb,null));};exports[_0x1a4c('0x73')]=function(_0x1e117,_0x22f3d9){return db[_0x1a4c('0x48')]['find']({'where':{'id':_0x1e117[_0x1a4c('0x5f')]['id']}})[_0x1a4c('0xf')](handleEntityNotFound(_0x22f3d9,null))[_0x1a4c('0xf')](function(_0x953e5d){if(_0x953e5d){return _0x953e5d[_0x1a4c('0x73')](_0x1e117[_0x1a4c('0x4d')]['ids']);}})[_0x1a4c('0xf')](respondWithStatusCode(_0x22f3d9,null))['catch'](handleError(_0x22f3d9,null));};exports[_0x1a4c('0x68')]=function(_0x314f21,_0x448819){var _0xe35904={'name':_0x314f21[_0x1a4c('0x62')]['name'],'key':_0x314f21['body']['key'],'provider':_0x314f21['body'][_0x1a4c('0x63')]==='custom'?null:_0x314f21[_0x1a4c('0x62')][_0x1a4c('0x63')],'email':_0x314f21[_0x1a4c('0x62')][_0x1a4c('0x74')],'ListId':_0x314f21[_0x1a4c('0x62')][_0x1a4c('0x75')],'active':!_[_0x1a4c('0x76')](_0x314f21[_0x1a4c('0x62')][_0x1a4c('0x77')])?_0x314f21[_0x1a4c('0x62')]['active']:!![],'description':_0x314f21[_0x1a4c('0x62')][_0x1a4c('0x78')]||null};var _0x127c10=getAuthenticationOptions(_0xe35904['provider'],_0x314f21[_0x1a4c('0x62')]);_0xe35904[_0x1a4c('0x41')]=_0x127c10[_0x1a4c('0x41')];_0xe35904[_0x1a4c('0x42')]=_0x127c10['Smtp'];return db[_0x1a4c('0x48')][_0x1a4c('0x68')](_0xe35904,{'include':[{'model':db['MailServerOut'],'as':_0x1a4c('0x42')},{'model':db['MailServerIn'],'as':_0x1a4c('0x41')}]})[_0x1a4c('0xf')](function(_0xc69c50){var _0x25fd80=_0x314f21['user']['get']({'plain':!![]});if(!_0x25fd80)throw new Error(_0x1a4c('0x79'));if(_0x25fd80['role']===_0x1a4c('0x37')){var _0x213332=_0xc69c50[_0x1a4c('0x27')]({'plain':!![]});return db[_0x1a4c('0x7a')][_0x1a4c('0x61')]({'where':{'name':_0x1a4c('0x28'),'userProfileId':_0x25fd80[_0x1a4c('0x7b')]},'raw':!![]})[_0x1a4c('0xf')](function(_0x27c0f2){if(_0x27c0f2&&_0x27c0f2['autoAssociation']===0x0){return db['UserProfileResource'][_0x1a4c('0x68')]({'name':_0x213332[_0x1a4c('0x2b')],'resourceId':_0x213332['id'],'type':_0x27c0f2['name'],'sectionId':_0x27c0f2['id']},{})[_0x1a4c('0xf')](function(){return _0xc69c50;});}else{return _0xc69c50;}})[_0x1a4c('0x1a')](function(_0x330b80){logger[_0x1a4c('0x15')](_0x1a4c('0x7c'),_0x330b80);throw _0x330b80;});}return _0xc69c50;})[_0x1a4c('0xf')](respondWithResult(_0x448819,0xc9))['catch'](handleError(_0x448819,null));};exports[_0x1a4c('0x7d')]=function(_0x8ae4e9,_0xaa51d7){return db['MailAccount'][_0x1a4c('0x72')]({'where':{'id':_0x8ae4e9[_0x1a4c('0x5f')]['id']}})[_0x1a4c('0xf')](handleEntityNotFound(_0xaa51d7,null))[_0x1a4c('0xf')](function(_0x4cf749){if(_0x4cf749){return _0x4cf749['getImap']();}return null;})['then'](respondWithResult(_0xaa51d7,null))[_0x1a4c('0x1a')](handleError(_0xaa51d7,null));};exports[_0x1a4c('0x7e')]=function(_0x412d48,_0x1c714b){if(_0x412d48[_0x1a4c('0x62')]['id']){delete _0x412d48[_0x1a4c('0x62')]['id'];}return db[_0x1a4c('0x48')]['find']({'where':{'id':_0x412d48[_0x1a4c('0x5f')]['id']}})['then'](handleEntityNotFound(_0x1c714b,null))[_0x1a4c('0xf')](function(_0x1a3d26){if(_0x1a3d26){_0x412d48[_0x1a4c('0x62')]['MailAccountId']=_0x1a3d26['id'];return db[_0x1a4c('0x43')][_0x1a4c('0x68')](_0x412d48[_0x1a4c('0x62')]);}})['then'](respondWithResult(_0x1c714b,null))[_0x1a4c('0x1a')](handleError(_0x1c714b,null));};exports[_0x1a4c('0x7f')]=function(_0x2ee187,_0x1b158b){return db['MailAccount']['findOne']({'where':{'id':_0x2ee187['params']['id']}})['then'](handleEntityNotFound(_0x1b158b,null))[_0x1a4c('0xf')](function(_0x157409){if(_0x157409){return _0x157409['setImap'](null);}return null;})[_0x1a4c('0xf')](respondWithStatusCode(_0x1b158b,null))[_0x1a4c('0x1a')](handleError(_0x1b158b,null));};exports[_0x1a4c('0x80')]=function(_0x4abc3f,_0x720a14){return db['MailAccount'][_0x1a4c('0x72')]({'where':{'id':_0x4abc3f[_0x1a4c('0x5f')]['id']}})[_0x1a4c('0xf')](handleEntityNotFound(_0x720a14,null))[_0x1a4c('0xf')](function(_0x3b0829){if(_0x3b0829){return _0x3b0829[_0x1a4c('0x80')]();}return null;})['then'](respondWithResult(_0x720a14,null))[_0x1a4c('0x1a')](handleError(_0x720a14,null));};exports[_0x1a4c('0x81')]=function(_0x4d3530,_0x4517e6){if(_0x4d3530[_0x1a4c('0x62')]['id']){delete _0x4d3530[_0x1a4c('0x62')]['id'];}return db[_0x1a4c('0x48')][_0x1a4c('0x61')]({'where':{'id':_0x4d3530['params']['id']}})[_0x1a4c('0xf')](handleEntityNotFound(_0x4517e6,null))[_0x1a4c('0xf')](function(_0x2bb31e){if(_0x2bb31e){_0x4d3530[_0x1a4c('0x62')][_0x1a4c('0x67')]=_0x2bb31e['id'];return db[_0x1a4c('0x44')][_0x1a4c('0x68')](_0x4d3530[_0x1a4c('0x62')]);}})['then'](respondWithResult(_0x4517e6,null))[_0x1a4c('0x1a')](handleError(_0x4517e6,null));};exports[_0x1a4c('0x82')]=function(_0x198ea3,_0x1763bc){return db[_0x1a4c('0x48')]['findOne']({'where':{'id':_0x198ea3[_0x1a4c('0x5f')]['id']}})[_0x1a4c('0xf')](handleEntityNotFound(_0x1763bc,null))[_0x1a4c('0xf')](function(_0x433b83){if(_0x433b83){return _0x433b83['setSmtp'](null);}return null;})['then'](respondWithStatusCode(_0x1763bc,null))[_0x1a4c('0x1a')](handleError(_0x1763bc,null));};exports[_0x1a4c('0x83')]=function(_0x7abbda,_0x363977){return db['MailInteraction'][_0x1a4c('0x61')]({'where':{'id':_0x7abbda[_0x1a4c('0x5f')]['id']}})[_0x1a4c('0xf')](handleEntityNotFound(_0x363977,null))[_0x1a4c('0xf')](function(_0x530cc0){if(_0x530cc0){return _0x530cc0[_0x1a4c('0x83')](_0x7abbda[_0x1a4c('0x62')][_0x1a4c('0x6e')],_[_0x1a4c('0x84')](_0x7abbda[_0x1a4c('0x62')],[_0x1a4c('0x6e'),'id'])||{});}})[_0x1a4c('0xf')](respondWithResult(_0x363977,null))[_0x1a4c('0x1a')](handleError(_0x363977,null));};exports['getInteractions']=function(_0x4e0b66,_0x5b50fc){var _0x536ec4={'raw':![],'where':{}};var _0x36aba7={};var _0x1ac93e={'count':0x0,'rows':[]};return db[_0x1a4c('0x48')]['findOne']({'where':{'id':_0x4e0b66[_0x1a4c('0x5f')]['id']}})[_0x1a4c('0xf')](handleEntityNotFound(_0x5b50fc,null))[_0x1a4c('0xf')](function(_0x1f79be){if(_0x1f79be){_0x36aba7[_0x1a4c('0x4b')]=_[_0x1a4c('0x4c')](db['MailInteraction'][_0x1a4c('0x49')]);_0x36aba7[_0x1a4c('0x4d')]=_[_0x1a4c('0x4c')](_0x4e0b66[_0x1a4c('0x4d')]);_0x36aba7[_0x1a4c('0x55')]=_['intersection'](_0x36aba7[_0x1a4c('0x4b')],_0x36aba7[_0x1a4c('0x4d')]);_0x536ec4[_0x1a4c('0x50')]=_[_0x1a4c('0x4e')](_0x36aba7[_0x1a4c('0x4b')],qs['fields'](_0x4e0b66[_0x1a4c('0x4d')]['fields']));_0x536ec4['attributes']=_0x536ec4[_0x1a4c('0x50')][_0x1a4c('0x51')]?_0x536ec4[_0x1a4c('0x50')]:_0x36aba7[_0x1a4c('0x4b')];if(!_0x4e0b66[_0x1a4c('0x4d')][_0x1a4c('0x52')](_0x1a4c('0x53'))){_0x536ec4['limit']=qs[_0x1a4c('0x20')](_0x4e0b66[_0x1a4c('0x4d')][_0x1a4c('0x20')]);_0x536ec4[_0x1a4c('0x22')]=qs[_0x1a4c('0x22')](_0x4e0b66[_0x1a4c('0x4d')][_0x1a4c('0x22')]);}_0x536ec4[_0x1a4c('0x6b')]=qs[_0x1a4c('0x54')](_0x4e0b66[_0x1a4c('0x4d')][_0x1a4c('0x54')]);_0x536ec4[_0x1a4c('0x58')]=qs[_0x1a4c('0x55')](_[_0x1a4c('0x56')](_0x4e0b66['query'],_0x36aba7[_0x1a4c('0x55')]));_0x536ec4['where'][_0x1a4c('0x67')]=_0x1f79be['id'];if(_0x4e0b66['query']['filter']){_0x536ec4[_0x1a4c('0x58')]=_['merge'](_0x536ec4['where'],{'$or':_['map'](_0x536ec4[_0x1a4c('0x50')],function(_0x1782f4){var _0x528a4e={};_0x528a4e[_0x1782f4]={'$like':'%'+_0x4e0b66[_0x1a4c('0x4d')]['filter']+'%'};return _0x528a4e;})});}_0x536ec4=_[_0x1a4c('0x59')]({},_0x536ec4,_0x4e0b66['options']);return db[_0x1a4c('0x85')]['count']({'where':_0x536ec4['where']})['then'](function(_0x4fefb9){_0x1ac93e[_0x1a4c('0x21')]=_0x4fefb9;if(_0x4e0b66[_0x1a4c('0x4d')][_0x1a4c('0x5c')]){_0x536ec4['include']=[{'model':db[_0x1a4c('0x86')],'as':'Contact','required':![]},{'model':db[_0x1a4c('0x87')],'as':_0x1a4c('0x88'),'attributes':[_0x1a4c('0x2b'),'fullname','internal'],'required':![]},{'model':db[_0x1a4c('0x89')],'as':'Tags','attributes':['id',_0x1a4c('0x2b'),_0x1a4c('0x8a')],'where':_0x4e0b66['query'][_0x1a4c('0x8b')]?{'id':_0x4e0b66[_0x1a4c('0x4d')][_0x1a4c('0x8b')]}:undefined,'required':_0x4e0b66[_0x1a4c('0x4d')][_0x1a4c('0x8b')]?!![]:![]}];}return db[_0x1a4c('0x85')][_0x1a4c('0x6c')](_0x536ec4);})[_0x1a4c('0xf')](function(_0x260f20){_0x1ac93e[_0x1a4c('0x5d')]=_0x260f20;return _0x1ac93e;});}})[_0x1a4c('0xf')](respondWithFilteredResult(_0x5b50fc,_0x536ec4))[_0x1a4c('0x1a')](handleError(_0x5b50fc,null));};exports[_0x1a4c('0x8c')]=function addApplications(_0x17fe36,_0x2080ba){var _0x2d90df=_0x17fe36[_0x1a4c('0x5f')]['id'];var _0x314c8e=_0x17fe36[_0x1a4c('0x62')];var _0x4f765e=0xc8;var _0x436b04=null;return db[_0x1a4c('0x8d')]['transaction']({'isolationLevel':db['sequelize'][_0x1a4c('0x8e')][_0x1a4c('0x8f')][_0x1a4c('0x90')]},function(_0x4d6b44){return db[_0x1a4c('0x48')][_0x1a4c('0x72')]({'where':{'id':_0x2d90df},'transaction':_0x4d6b44})[_0x1a4c('0xf')](function(_0x20aad3){if(_0x20aad3){return db['MailApplication'][_0x1a4c('0x26')]({'where':{'MailAccountId':_0x2d90df},'transaction':_0x4d6b44})['then'](function(){var _0x3fda0e=_[_0x1a4c('0x47')](_0x314c8e,function(_0x5e2ace){_0x5e2ace['MailAccountId']=_0x2d90df;return _0x5e2ace;});return db['MailApplication'][_0x1a4c('0x91')](_0x3fda0e,{'transaction':_0x4d6b44});});}else{_0x4f765e=0x194;_0x436b04=[];}});})[_0x1a4c('0xf')](function(){if(_0x4f765e!==0x194){return db[_0x1a4c('0x92')][_0x1a4c('0x93')]({'where':{'MailAccountId':_0x2d90df},'order':'priority'})['then'](function(_0x22ddc6){_0x436b04=_0x22ddc6;});}})[_0x1a4c('0x1a')](function(_0x2ff034){_0x4f765e=0x1f4;logger[_0x1a4c('0x15')](_0x2ff034['stack']);if(_0x2ff034['name']){delete _0x2ff034[_0x1a4c('0x2b')];}_0x436b04=_0x2ff034;})[_0x1a4c('0x94')](function(){if(_0x436b04===null){_0x2080ba['sendStatus'](_0x4f765e);}else{if(_0x4f765e===0x1f4){_0x2080ba[_0x1a4c('0x1c')](_0x4f765e)[_0x1a4c('0x2c')](_0x436b04);}else{_0x2080ba['status'](_0x4f765e)[_0x1a4c('0x1e')](_0x436b04);}}});};exports[_0x1a4c('0x95')]=function(_0x40031a,_0x1b2a98){var _0x49bbf2={};var _0xa08f83={};var _0xd1e8a0;var _0x5c90e4;return db[_0x1a4c('0x48')][_0x1a4c('0x72')]({'where':{'id':_0x40031a[_0x1a4c('0x5f')]['id']}})[_0x1a4c('0xf')](handleEntityNotFound(_0x1b2a98,null))[_0x1a4c('0xf')](function(_0x3de711){if(_0x3de711){_0xd1e8a0=_0x3de711;_0xa08f83[_0x1a4c('0x4b')]=_['keys'](db[_0x1a4c('0x92')][_0x1a4c('0x49')]);_0xa08f83[_0x1a4c('0x4d')]=_[_0x1a4c('0x4c')](_0x40031a[_0x1a4c('0x4d')]);_0xa08f83[_0x1a4c('0x55')]=_[_0x1a4c('0x4e')](_0xa08f83[_0x1a4c('0x4b')],_0xa08f83[_0x1a4c('0x4d')]);_0x49bbf2[_0x1a4c('0x50')]=_[_0x1a4c('0x4e')](_0xa08f83[_0x1a4c('0x4b')],qs[_0x1a4c('0x4f')](_0x40031a[_0x1a4c('0x4d')][_0x1a4c('0x4f')]));_0x49bbf2['attributes']=_0x49bbf2[_0x1a4c('0x50')][_0x1a4c('0x51')]?_0x49bbf2[_0x1a4c('0x50')]:_0xa08f83[_0x1a4c('0x4b')];_0x49bbf2[_0x1a4c('0x6b')]=qs['sort'](_0x40031a[_0x1a4c('0x4d')]['sort']);_0x49bbf2[_0x1a4c('0x58')]=qs[_0x1a4c('0x55')](_[_0x1a4c('0x56')](_0x40031a[_0x1a4c('0x4d')],_0xa08f83[_0x1a4c('0x55')]));if(_0x40031a['query'][_0x1a4c('0x57')]){_0x49bbf2[_0x1a4c('0x58')]=_[_0x1a4c('0x59')](_0x49bbf2['where'],{'$or':_[_0x1a4c('0x47')](_0x49bbf2[_0x1a4c('0x50')],function(_0x5d2107){var _0x12846b={};_0x12846b[_0x5d2107]={'$like':'%'+_0x40031a[_0x1a4c('0x4d')][_0x1a4c('0x57')]+'%'};return _0x12846b;})});}_0x49bbf2=_[_0x1a4c('0x59')]({},_0x49bbf2,_0x40031a[_0x1a4c('0x5b')]);return _0xd1e8a0['getApplications'](_0x49bbf2);}})[_0x1a4c('0xf')](function(_0x3dc204){if(_0x3dc204){_0x5c90e4=_0x3dc204[_0x1a4c('0x51')];if(!_0x40031a[_0x1a4c('0x4d')]['hasOwnProperty'](_0x1a4c('0x53'))){_0x49bbf2[_0x1a4c('0x20')]=qs['limit'](_0x40031a[_0x1a4c('0x4d')][_0x1a4c('0x20')]);_0x49bbf2[_0x1a4c('0x22')]=qs[_0x1a4c('0x22')](_0x40031a[_0x1a4c('0x4d')][_0x1a4c('0x22')]);}return _0xd1e8a0['getApplications'](_0x49bbf2);}})['then'](function(_0x1f8141){if(_0x1f8141){return _0x1f8141?{'count':_0x5c90e4,'rows':_0x1f8141}:null;}})[_0x1a4c('0xf')](respondWithResult(_0x1b2a98,null))[_0x1a4c('0x1a')](handleError(_0x1b2a98,null));};exports[_0x1a4c('0x96')]=function(_0x2cb59a,_0x4c9cae){var _0x1511d={'raw':!![],'where':{}};var _0x544cf2={};var _0x486d48={'count':0x0,'rows':[]};return db[_0x1a4c('0x48')][_0x1a4c('0x72')]({'where':{'id':_0x2cb59a[_0x1a4c('0x5f')]['id']}})[_0x1a4c('0xf')](handleEntityNotFound(_0x4c9cae,null))[_0x1a4c('0xf')](function(_0x4c5237){if(_0x4c5237){_0x544cf2[_0x1a4c('0x4b')]=_[_0x1a4c('0x4c')](db[_0x1a4c('0x97')][_0x1a4c('0x49')]);_0x544cf2[_0x1a4c('0x4d')]=_[_0x1a4c('0x4c')](_0x2cb59a['query']);_0x544cf2[_0x1a4c('0x55')]=_[_0x1a4c('0x4e')](_0x544cf2[_0x1a4c('0x4b')],_0x544cf2[_0x1a4c('0x4d')]);_0x1511d[_0x1a4c('0x50')]=_['intersection'](_0x544cf2[_0x1a4c('0x4b')],qs[_0x1a4c('0x4f')](_0x2cb59a[_0x1a4c('0x4d')][_0x1a4c('0x4f')]));_0x1511d[_0x1a4c('0x50')]=_0x1511d[_0x1a4c('0x50')][_0x1a4c('0x51')]?_0x1511d[_0x1a4c('0x50')]:_0x544cf2[_0x1a4c('0x4b')];if(!_0x2cb59a['query'][_0x1a4c('0x52')](_0x1a4c('0x53'))){_0x1511d[_0x1a4c('0x20')]=qs['limit'](_0x2cb59a[_0x1a4c('0x4d')][_0x1a4c('0x20')]);_0x1511d[_0x1a4c('0x22')]=qs[_0x1a4c('0x22')](_0x2cb59a[_0x1a4c('0x4d')]['offset']);}_0x1511d[_0x1a4c('0x6b')]=qs[_0x1a4c('0x54')](_0x2cb59a[_0x1a4c('0x4d')][_0x1a4c('0x54')]);_0x1511d[_0x1a4c('0x58')]=qs['filters'](_['pick'](_0x2cb59a[_0x1a4c('0x4d')],_0x544cf2['filters']));_0x1511d[_0x1a4c('0x58')][_0x1a4c('0x67')]=_0x4c5237['id'];if(_0x2cb59a[_0x1a4c('0x4d')][_0x1a4c('0x57')]){_0x1511d[_0x1a4c('0x58')]=_[_0x1a4c('0x59')](_0x1511d[_0x1a4c('0x58')],{'$or':_['map'](_0x1511d['attributes'],function(_0x50f45d){var _0x7018ae={};_0x7018ae[_0x50f45d]={'$like':'%'+_0x2cb59a['query'][_0x1a4c('0x57')]+'%'};return _0x7018ae;})});}if(_0x2cb59a[_0x1a4c('0x4d')][_0x1a4c('0x98')]){var _0x4da6bd=_0x2cb59a[_0x1a4c('0x4d')][_0x1a4c('0x98')][_0x1a4c('0x99')](',');var _0x3f0403={};_0x3f0403[_0x4da6bd[0x0]]={'$gte':moment(_0x4da6bd[0x1])[_0x1a4c('0x9a')](_0x1a4c('0x9b'))};_0x1511d[_0x1a4c('0x58')]=_[_0x1a4c('0x59')](_0x1511d[_0x1a4c('0x58')],_0x3f0403);}_0x1511d=_[_0x1a4c('0x59')]({},_0x1511d,_0x2cb59a['options']);return db[_0x1a4c('0x97')][_0x1a4c('0x21')]({'where':_0x1511d['where']})[_0x1a4c('0xf')](function(_0x2cc41d){_0x486d48[_0x1a4c('0x21')]=_0x2cc41d;if(_0x2cb59a['query'][_0x1a4c('0x5c')]){_0x1511d['include']=[{'all':!![]}];}return db[_0x1a4c('0x97')]['findAll'](_0x1511d);})[_0x1a4c('0xf')](function(_0xb8f0e2){if(_0x2cb59a['query'][_0x1a4c('0x9c')]===_0x1a4c('0x9d')){for(var _0x2e00db=0x0;_0x2e00db<_0xb8f0e2[_0x1a4c('0x51')];_0x2e00db++){_0xb8f0e2[_0x2e00db][_0x1a4c('0x62')]=juice(_0xb8f0e2[_0x2e00db][_0x1a4c('0x62')]);}}_0x486d48[_0x1a4c('0x5d')]=_0xb8f0e2;return _0x486d48;});}})[_0x1a4c('0xf')](respondWithFilteredResult(_0x4c9cae,_0x1511d))[_0x1a4c('0x1a')](handleError(_0x4c9cae,null));};exports[_0x1a4c('0x2c')]=function(_0x381356,_0x415acd){var _0x54c574,_0x2bc8f7={},_0x1a86cf;if(_0x381356[_0x1a4c('0x62')]['to']){_0x1a86cf=_0x381356['body']['to'][_0x1a4c('0x99')](',')[0x0];}return db[_0x1a4c('0x48')]['find']({'where':{'id':_0x381356[_0x1a4c('0x5f')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x1a4c('0x86')],'as':_0x1a4c('0x9e'),'where':{'email':_0x1a86cf},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x1a4c('0x44')],'as':_0x1a4c('0x42'),'raw':!![],'include':[{'model':db[_0x1a4c('0x9f')],'as':_0x1a4c('0x9f'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x415acd,null))['then'](function(_0x1a8756){if(!_0x1a8756)return;_0x54c574=_0x1a8756;if(!_0x1a8756[_0x1a4c('0x42')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0x1a4c('0x76')](_0x381356[_0x1a4c('0x62')][_0x1a4c('0xa0')])){_0x381356[_0x1a4c('0x62')]['from']=util[_0x1a4c('0x9a')](_0x1a4c('0xa1'),_0x1a8756['name'],_0x1a8756[_0x1a4c('0x74')]||_0x1a8756[_0x1a4c('0x42')]['user']);}if(_0x381356[_0x1a4c('0x62')][_0x1a4c('0xa2')]&&_0x381356['body'][_0x1a4c('0xa2')][_0x1a4c('0x51')]){for(var _0x173756=0x0;_0x173756<_0x381356[_0x1a4c('0x62')][_0x1a4c('0xa2')]['length'];_0x173756+=0x1){_0x381356[_0x1a4c('0x62')][_0x1a4c('0xa2')][_0x173756]={'filename':_0x381356[_0x1a4c('0x62')][_0x1a4c('0xa2')][_0x173756]['name'],'path':path[_0x1a4c('0xa3')](config[_0x1a4c('0xa4')],_0x1a4c('0xa5'),_0x381356[_0x1a4c('0x62')]['attachments'][_0x173756]['basename'])};}}var _0x206598=_0x1a8756[_0x1a4c('0xa6')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x206598,'message':_0x381356['body']});})[_0x1a4c('0xf')](function(_0x496f1a){if(!_0x496f1a)return;_0x2bc8f7=_0x496f1a;if(!_0x54c574[_0x1a4c('0xa7')])throw new Error(_0x1a4c('0xa8'));if(_0x54c574['List'][_0x1a4c('0x9e')][_0x1a4c('0x51')])return _0x54c574[_0x1a4c('0xa7')][_0x1a4c('0x9e')][0x0];return db['CmContact'][_0x1a4c('0x68')](_[_0x1a4c('0xa9')](_0x381356[_0x1a4c('0x62')],{'firstName':_0x381356[_0x1a4c('0x62')]['to'],'email':_0x381356[_0x1a4c('0x62')]['to'],'phone':_0x381356[_0x1a4c('0x62')]['to'],'ListId':_0x54c574[_0x1a4c('0x75')]}));})['then'](function(_0x4deb38){if(!_0x4deb38)return;var _0x35a4e7={'UserId':_0x381356['user']['id'],'ContactId':_0x4deb38['id'],'MailAccountId':_0x54c574['id'],'inReplyTo':_0x2bc8f7[_0x1a4c('0xaa')],'to':_0x381356[_0x1a4c('0x62')][_0x1a4c('0xa0')],'cc':_0x381356[_0x1a4c('0x62')]['cc'],'subject':_0x381356[_0x1a4c('0x62')]['subject'],'attach':_0x381356[_0x1a4c('0x62')][_0x1a4c('0xab')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x1a4c('0x9a')](_0x1a4c('0x9b')),'lastMsgDirection':'out','Messages':[_[_0x1a4c('0x59')](_0x381356[_0x1a4c('0x62')],{'messageId':_0x2bc8f7[_0x1a4c('0xaa')],'sentAt':moment()[_0x1a4c('0x9a')](_0x1a4c('0x9b')),'read':!![],'MailAccountId':_0x54c574['id'],'UserId':_0x381356[_0x1a4c('0x37')]['id'],'ContactId':_0x4deb38['id']})]};if(_0x381356['body'][_0x1a4c('0xac')]){_0x35a4e7=_[_0x1a4c('0x59')](_0x35a4e7,_0x381356[_0x1a4c('0x62')][_0x1a4c('0xac')]);}return db[_0x1a4c('0x85')][_0x1a4c('0x68')](_0x35a4e7,{'include':[{'model':db[_0x1a4c('0x97')],'as':'Messages'}]});})[_0x1a4c('0xf')](respondWithResult(_0x415acd,null))[_0x1a4c('0x1a')](handleError(_0x415acd,null));};exports[_0x1a4c('0xad')]=function(_0x4ee04f,_0x30f234){return db[_0x1a4c('0x48')]['find']({'where':{'id':_0x4ee04f[_0x1a4c('0x5f')]['id']},'include':[{'model':db[_0x1a4c('0x44')],'as':_0x1a4c('0x42'),'raw':!![],'include':[{'model':db[_0x1a4c('0x9f')],'as':_0x1a4c('0x9f'),'raw':!![]}]}]})[_0x1a4c('0xf')](handleEntityNotFound(_0x30f234,null))[_0x1a4c('0xf')](function(_0x363ecf){if(!_0x363ecf[_0x1a4c('0x42')])return;var _0x54df0c=_0x363ecf['getSmtpOptions']();return respondWithRpcPromise(_0x1a4c('0xae'),_0x1a4c('0xad'),{'account':_0x54df0c});})[_0x1a4c('0xf')](respondWithResult(_0x30f234,null))[_0x1a4c('0x1a')](handleError(_0x30f234,null));};exports[_0x1a4c('0x26')]=function(_0x4971e1,_0x323259){return db[_0x1a4c('0x48')][_0x1a4c('0x61')]({'where':{'id':_0x4971e1[_0x1a4c('0x5f')]['id']}})[_0x1a4c('0xf')](handleEntityNotFound(_0x323259,null))['then'](function(_0x424a84){if(_0x424a84&&_0x424a84[_0x1a4c('0x3f')]){throw new db['Sequelize']['ValidationError'](_0x1a4c('0xaf'));}return _0x424a84;})['then'](removeEntity(_0x323259,null))[_0x1a4c('0x1a')](handleError(_0x323259,null));};exports['addAgents']=function(_0x1cf6df,_0x380e55){return db['MailAccount'][_0x1a4c('0x61')]({'where':{'id':_0x1cf6df[_0x1a4c('0x5f')]['id']}})[_0x1a4c('0xf')](handleEntityNotFound(_0x380e55,null))[_0x1a4c('0xf')](function(_0x1a584a){if(_0x1a584a){return _0x1a584a[_0x1a4c('0xb0')](_0x1cf6df['body'][_0x1a4c('0x6e')],_['omit'](_0x1cf6df['body'],[_0x1a4c('0x6e'),'id'])||{})[_0x1a4c('0xb1')](function(_0x24ad04){for(var _0x175107=0x0;_0x175107<_0x1cf6df[_0x1a4c('0x62')][_0x1a4c('0x6e')]['length'];_0x175107+=0x1){socket['emit']('userMailAccount:save',{'UserId':Number(_0x1cf6df['body'][_0x1a4c('0x6e')][_0x175107]),'MailAccountId':Number(_0x1cf6df[_0x1a4c('0x5f')]['id'])});}return _0x24ad04;});}})['then'](respondWithResult(_0x380e55,null))[_0x1a4c('0x1a')](handleError(_0x380e55,null));};exports[_0x1a4c('0xb2')]=function(_0x5f5172,_0x338e21){return db[_0x1a4c('0x48')][_0x1a4c('0x61')]({'where':{'id':_0x5f5172[_0x1a4c('0x5f')]['id']}})['then'](handleEntityNotFound(_0x338e21,null))[_0x1a4c('0xf')](function(_0x505623){if(_0x505623){return _0x505623['removeAgents'](_0x5f5172[_0x1a4c('0x4d')][_0x1a4c('0x6e')])[_0x1a4c('0xf')](function(){if(_[_0x1a4c('0xb3')](_0x5f5172[_0x1a4c('0x4d')]['ids'])){for(var _0x153876=0x0;_0x153876<_0x5f5172[_0x1a4c('0x4d')][_0x1a4c('0x6e')][_0x1a4c('0x51')];_0x153876+=0x1){socket[_0x1a4c('0xb4')](_0x1a4c('0xb5'),{'UserId':Number(_0x5f5172[_0x1a4c('0x4d')][_0x1a4c('0x6e')][_0x153876]),'MailAccountId':Number(_0x5f5172[_0x1a4c('0x5f')]['id'])});}}else{socket[_0x1a4c('0xb4')](_0x1a4c('0xb5'),{'UserId':Number(_0x5f5172[_0x1a4c('0x4d')][_0x1a4c('0x6e')]),'MailAccountId':Number(_0x5f5172['params']['id'])});}});}})['then'](respondWithStatusCode(_0x338e21,null))['catch'](handleError(_0x338e21,null));};exports[_0x1a4c('0xb6')]=function(_0x1d9513,_0x3ce7c2){var _0x334cb3={};var _0x19d1dd={};var _0x56e618;var _0x5bacf1;return db[_0x1a4c('0x48')]['findOne']({'where':{'id':_0x1d9513[_0x1a4c('0x5f')]['id']}})['then'](handleEntityNotFound(_0x3ce7c2,null))[_0x1a4c('0xf')](function(_0x2fd329){if(_0x2fd329){_0x56e618=_0x2fd329;_0x19d1dd['model']=_[_0x1a4c('0x4c')](db['User'][_0x1a4c('0x49')]);_0x19d1dd[_0x1a4c('0x4d')]=_[_0x1a4c('0x4c')](_0x1d9513['query']);_0x19d1dd['filters']=_[_0x1a4c('0x4e')](_0x19d1dd[_0x1a4c('0x4b')],_0x19d1dd[_0x1a4c('0x4d')]);_0x334cb3['attributes']=_[_0x1a4c('0x4e')](_0x19d1dd['model'],qs[_0x1a4c('0x4f')](_0x1d9513[_0x1a4c('0x4d')][_0x1a4c('0x4f')]));_0x334cb3[_0x1a4c('0x50')]=_0x334cb3[_0x1a4c('0x50')]['length']?_0x334cb3[_0x1a4c('0x50')]:_0x19d1dd[_0x1a4c('0x4b')];_0x334cb3[_0x1a4c('0x6b')]=qs[_0x1a4c('0x54')](_0x1d9513['query'][_0x1a4c('0x54')]);_0x334cb3[_0x1a4c('0x58')]=qs[_0x1a4c('0x55')](_[_0x1a4c('0x56')](_0x1d9513[_0x1a4c('0x4d')],_0x19d1dd[_0x1a4c('0x55')]));if(_0x1d9513['query'][_0x1a4c('0x57')]){_0x334cb3[_0x1a4c('0x58')]=_['merge'](_0x334cb3['where'],{'$or':_[_0x1a4c('0x47')](_0x334cb3['attributes'],function(_0xdb3b2f){var _0xcdee00={};_0xcdee00[_0xdb3b2f]={'$like':'%'+_0x1d9513[_0x1a4c('0x4d')][_0x1a4c('0x57')]+'%'};return _0xcdee00;})});}_0x334cb3=_[_0x1a4c('0x59')]({},_0x334cb3,_0x1d9513[_0x1a4c('0x5b')]);return _0x56e618[_0x1a4c('0xb6')](_0x334cb3);}})[_0x1a4c('0xf')](function(_0x2d463e){if(_0x2d463e){_0x5bacf1=_0x2d463e['length'];if(!_0x1d9513[_0x1a4c('0x4d')][_0x1a4c('0x52')]('nolimit')){_0x334cb3[_0x1a4c('0x20')]=qs[_0x1a4c('0x20')](_0x1d9513['query'][_0x1a4c('0x20')]);_0x334cb3[_0x1a4c('0x22')]=qs[_0x1a4c('0x22')](_0x1d9513[_0x1a4c('0x4d')][_0x1a4c('0x22')]);}return _0x56e618[_0x1a4c('0xb6')](_0x334cb3);}})[_0x1a4c('0xf')](function(_0x358fe3){if(_0x358fe3){return _0x358fe3?{'count':_0x5bacf1,'rows':_0x358fe3}:null;}})[_0x1a4c('0xf')](respondWithResult(_0x3ce7c2,null))[_0x1a4c('0x1a')](handleError(_0x3ce7c2,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 8250452..6e9a9ad 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 _0x1893=['MailAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x256d6a,_0x2f002f){var _0x460058=function(_0x195be7){while(--_0x195be7){_0x256d6a['push'](_0x256d6a['shift']());}};_0x460058(++_0x2f002f);}(_0x1893,0xa2));var _0x3189=function(_0x512550,_0x6a8b6f){_0x512550=_0x512550-0x0;var _0x19f661=_0x1893[_0x512550];return _0x19f661;};'use strict';var EventEmitter=require('events');var MailAccount=require('../../mysqldb')['db'][_0x3189('0x0')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x3189('0x1')](0x0);var events={'afterCreate':_0x3189('0x2'),'afterUpdate':_0x3189('0x3'),'afterDestroy':_0x3189('0x4')};function emitEvent(_0x36a7b0){return function(_0x3953a2,_0x5371db,_0x27445){MailAccountEvents[_0x3189('0x5')](_0x36a7b0+':'+_0x3953a2['id'],_0x3953a2);MailAccountEvents[_0x3189('0x5')](_0x36a7b0,_0x3953a2);_0x27445(null);};}for(var e in events){if(events[_0x3189('0x6')](e)){var event=events[e];MailAccount[_0x3189('0x7')](e,emitEvent(event));}}module[_0x3189('0x8')]=MailAccountEvents; \ No newline at end of file +var _0xd7c3=['remove','hook','exports','events','../../mysqldb','MailAccount','setMaxListeners','save','update'];(function(_0x500438,_0x3a05ec){var _0x14155a=function(_0x4680c9){while(--_0x4680c9){_0x500438['push'](_0x500438['shift']());}};_0x14155a(++_0x3a05ec);}(_0xd7c3,0x1c5));var _0x3d7c=function(_0x1ae53a,_0xbb127){_0x1ae53a=_0x1ae53a-0x0;var _0x15bd6c=_0xd7c3[_0x1ae53a];return _0x15bd6c;};'use strict';var EventEmitter=require(_0x3d7c('0x0'));var MailAccount=require(_0x3d7c('0x1'))['db'][_0x3d7c('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x3d7c('0x3')](0x0);var events={'afterCreate':_0x3d7c('0x4'),'afterUpdate':_0x3d7c('0x5'),'afterDestroy':_0x3d7c('0x6')};function emitEvent(_0x17c96a){return function(_0x22396c,_0x538ca7,_0x2da8b6){MailAccountEvents['emit'](_0x17c96a+':'+_0x22396c['id'],_0x22396c);MailAccountEvents['emit'](_0x17c96a,_0x22396c);_0x2da8b6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x3d7c('0x7')](e,emitEvent(event));}}module[_0x3d7c('0x8')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 3cd4d27..36f6af4 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 _0x98ec=['CloudProvider','auth','OAuth2','user','data5','pass','./mailAccount.attributes','exports','define','mail_accounts','provider','service','host','Smtp','secure','authentication'];(function(_0x1e4c18,_0x320687){var _0x3e969f=function(_0x51d805){while(--_0x51d805){_0x1e4c18['push'](_0x1e4c18['shift']());}};_0x3e969f(++_0x320687);}(_0x98ec,0x1a6));var _0xc98e=function(_0x4d1536,_0x146875){_0x4d1536=_0x4d1536-0x0;var _0x17ce2c=_0x98ec[_0x4d1536];return _0x17ce2c;};'use strict';var attributes=require(_0xc98e('0x0'));module[_0xc98e('0x1')]=function(_0x40e204){return _0x40e204[_0xc98e('0x2')]('MailAccount',attributes,{'tableName':_0xc98e('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x225c88=this;var _0x2d94bc={'id':_0x225c88['id'],'tls':{'rejectUnauthorized':![]}};if(_0x225c88[_0xc98e('0x4')]!=='custom'){_0x2d94bc[_0xc98e('0x5')]=_0x225c88[_0xc98e('0x4')];}else{_0x2d94bc[_0xc98e('0x6')]=_0x225c88[_0xc98e('0x7')][_0xc98e('0x6')];_0x2d94bc['port']=_0x225c88[_0xc98e('0x7')]['port'];_0x2d94bc['secure']=_0x225c88[_0xc98e('0x7')][_0xc98e('0x8')];}if(_0x225c88[_0xc98e('0x7')][_0xc98e('0x9')]){if(_0x225c88['Smtp']['modernAuthentication']){if(!_0x225c88[_0xc98e('0x7')][_0xc98e('0xa')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x2d94bc[_0xc98e('0xb')]={'type':_0xc98e('0xc'),'user':_0x225c88[_0xc98e('0x7')][_0xc98e('0xd')],'accessToken':_0x225c88['Smtp'][_0xc98e('0xa')][_0xc98e('0xe')]};}else{_0x2d94bc[_0xc98e('0xb')]={'user':_0x225c88[_0xc98e('0x7')][_0xc98e('0xd')],'pass':_0x225c88['Smtp'][_0xc98e('0xf')]};}}return _0x2d94bc;}}});}; \ No newline at end of file +var _0x9676=['OAuth2','user','data5','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','provider','custom','service','Smtp','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth'];(function(_0x5212a6,_0x292b5f){var _0x4c2f45=function(_0x552ff6){while(--_0x552ff6){_0x5212a6['push'](_0x5212a6['shift']());}};_0x4c2f45(++_0x292b5f);}(_0x9676,0x1c5));var _0x6967=function(_0x3e04c4,_0x48101b){_0x3e04c4=_0x3e04c4-0x0;var _0x543e0f=_0x9676[_0x3e04c4];return _0x543e0f;};'use strict';var attributes=require(_0x6967('0x0'));module[_0x6967('0x1')]=function(_0x2afd41){return _0x2afd41[_0x6967('0x2')](_0x6967('0x3'),attributes,{'tableName':_0x6967('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x33d0b2=this;var _0x27ea0b={'id':_0x33d0b2['id'],'tls':{'rejectUnauthorized':![]}};if(_0x33d0b2[_0x6967('0x5')]!==_0x6967('0x6')){_0x27ea0b[_0x6967('0x7')]=_0x33d0b2[_0x6967('0x5')];}else{_0x27ea0b['host']=_0x33d0b2[_0x6967('0x8')]['host'];_0x27ea0b['port']=_0x33d0b2[_0x6967('0x8')]['port'];_0x27ea0b[_0x6967('0x9')]=_0x33d0b2['Smtp'][_0x6967('0x9')];}if(_0x33d0b2[_0x6967('0x8')][_0x6967('0xa')]){if(_0x33d0b2['Smtp'][_0x6967('0xb')]){if(!_0x33d0b2[_0x6967('0x8')][_0x6967('0xc')])throw new Error(_0x6967('0xd'));_0x27ea0b[_0x6967('0xe')]={'type':_0x6967('0xf'),'user':_0x33d0b2[_0x6967('0x8')][_0x6967('0x10')],'accessToken':_0x33d0b2[_0x6967('0x8')][_0x6967('0xc')][_0x6967('0x11')]};}else{_0x27ea0b[_0x6967('0xe')]={'user':_0x33d0b2[_0x6967('0x8')][_0x6967('0x10')],'pass':_0x33d0b2[_0x6967('0x8')]['pass']};}}return _0x27ea0b;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 74150e6..684dff5 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 _0x7880=['info','ShowMailAccount','find','where','smtp','smtpOptions','NotifyMailAccount','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','body','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','from','account','CmList','List','DESC','MailApplication','Applications','Smtp','CloudProvider','get','getSmtpOptions','applications','list','priority','asc','autoclose','push','length','close','*,*,*,*','Contacts','ListId','contact','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','inReplyTo','create','Contact\x20not\x20found','update','format','interaction','created','attachments','originTo','originCc','bcc','originChannel','Attachment','Attachments','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','options','raw','attributes','include','map','model'];(function(_0xe96487,_0x36c816){var _0x500779=function(_0x97b53f){while(--_0x97b53f){_0xe96487['push'](_0xe96487['shift']());}};_0x500779(++_0x36c816);}(_0x7880,0x1f4));var _0x0788=function(_0x50ffbb,_0x21a925){_0x50ffbb=_0x50ffbb-0x0;var _0x576a1c=_0x7880[_0x50ffbb];return _0x576a1c;};'use strict';var _=require('lodash');var moment=require(_0x0788('0x0'));var BPromise=require(_0x0788('0x1'));var rs=require(_0x0788('0x2'));var Redis=require(_0x0788('0x3'));var db=require(_0x0788('0x4'))['db'];var logger=require(_0x0788('0x5'))('rpc');var config=require(_0x0788('0x6'));var jayson=require(_0x0788('0x7'));var client=jayson[_0x0788('0x8')][_0x0788('0x9')]({'port':0x232c});config[_0x0788('0xa')]=_[_0x0788('0xb')](config[_0x0788('0xa')],{'host':_0x0788('0xc'),'port':0x18eb});var socket=require(_0x0788('0xd'))(new Redis(config[_0x0788('0xa')]));require('./mailAccount.socket')[_0x0788('0xe')](socket);function respondWithRpcPromise(_0x49f53b,_0xabaf81,_0x53b2f2){return new BPromise(function(_0x433c26,_0x3c6d18){return client[_0x0788('0xf')](_0x49f53b,_0x53b2f2)[_0x0788('0x10')](function(_0x469ebe){logger['info'](_0x0788('0x11'),_0xabaf81,_0x0788('0x12'));logger[_0x0788('0x13')](_0x0788('0x14'),_0xabaf81,_0x0788('0x12'),JSON[_0x0788('0x15')](_0x469ebe));if(_0x469ebe[_0x0788('0x16')]){if(_0x469ebe['error'][_0x0788('0x17')]===0x1f4){logger[_0x0788('0x16')](_0x0788('0x11'),_0xabaf81,_0x469ebe[_0x0788('0x16')]['message']);return _0x3c6d18(_0x469ebe[_0x0788('0x16')]['message']);}logger[_0x0788('0x16')](_0x0788('0x11'),_0xabaf81,_0x469ebe[_0x0788('0x16')][_0x0788('0x18')]);return _0x433c26(_0x469ebe[_0x0788('0x16')][_0x0788('0x18')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0xabaf81,_0x0788('0x12'));_0x433c26(_0x469ebe[_0x0788('0x19')]['message']);}})[_0x0788('0x1a')](function(_0x415f19){logger[_0x0788('0x16')]('MailAccount,\x20%s,\x20%s',_0xabaf81,_0x415f19);_0x3c6d18(_0x415f19);});});}exports[_0x0788('0x1b')]=function(_0x3fb723){var _0x492c2c=this;return new Promise(function(_0x11ea01,_0x5173d6){return db[_0x0788('0x1c')]['findAll']({'raw':_0x3fb723[_0x0788('0x1d')]?_0x3fb723[_0x0788('0x1d')][_0x0788('0x1e')]===undefined?!![]:![]:!![],'where':_0x3fb723[_0x0788('0x1d')]?_0x3fb723[_0x0788('0x1d')]['where']||null:null,'attributes':_0x3fb723['options']?_0x3fb723[_0x0788('0x1d')][_0x0788('0x1f')]||null:null,'limit':_0x3fb723[_0x0788('0x1d')]?_0x3fb723[_0x0788('0x1d')]['limit']||null:null,'include':_0x3fb723['options']?_0x3fb723[_0x0788('0x1d')][_0x0788('0x20')]?_[_0x0788('0x21')](_0x3fb723['options']['include'],function(_0x240459){return{'model':db[_0x240459[_0x0788('0x22')]],'as':_0x240459['as'],'attributes':_0x240459['attributes'],'include':_0x240459['include']?_[_0x0788('0x21')](_0x240459[_0x0788('0x20')],function(_0x57fda1){return{'model':db[_0x57fda1[_0x0788('0x22')]],'as':_0x57fda1['as'],'attributes':_0x57fda1[_0x0788('0x1f')],'include':_0x57fda1[_0x0788('0x20')]?_[_0x0788('0x21')](_0x57fda1[_0x0788('0x20')],function(_0xb2f4a5){return{'model':db[_0xb2f4a5[_0x0788('0x22')]],'as':_0xb2f4a5['as'],'attributes':_0xb2f4a5[_0x0788('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a5178){logger[_0x0788('0x23')](_0x0788('0x1b'),_0x3fb723);logger['debug']('GetMailAccount',_0x3fb723,JSON[_0x0788('0x15')](_0x5a5178));_0x11ea01(_0x5a5178);})[_0x0788('0x1a')](function(_0x20fcd8){logger[_0x0788('0x16')](_0x0788('0x1b'),_0x20fcd8[_0x0788('0x18')],_0x3fb723);_0x5173d6(_0x492c2c[_0x0788('0x16')](0x1f4,_0x20fcd8[_0x0788('0x18')]));});});};exports[_0x0788('0x24')]=function(_0x85e579){var _0x5ec0ed=this;return new Promise(function(_0x2a08b7,_0x1aab6a){return db[_0x0788('0x1c')][_0x0788('0x25')]({'raw':_0x85e579[_0x0788('0x1d')]?_0x85e579[_0x0788('0x1d')][_0x0788('0x1e')]===undefined?!![]:![]:!![],'where':_0x85e579[_0x0788('0x1d')]?_0x85e579[_0x0788('0x1d')][_0x0788('0x26')]||null:null,'attributes':_0x85e579['options']?_0x85e579['options']['attributes']||null:null,'include':_0x85e579['options']?_0x85e579['options']['include']?_[_0x0788('0x21')](_0x85e579[_0x0788('0x1d')][_0x0788('0x20')],function(_0x574576){return{'model':db[_0x574576[_0x0788('0x22')]],'as':_0x574576['as'],'attributes':_0x574576[_0x0788('0x1f')],'include':_0x574576[_0x0788('0x20')]?_[_0x0788('0x21')](_0x574576['include'],function(_0x2ed940){return{'model':db[_0x2ed940['model']],'as':_0x2ed940['as'],'attributes':_0x2ed940[_0x0788('0x1f')],'include':_0x2ed940['include']?_[_0x0788('0x21')](_0x2ed940[_0x0788('0x20')],function(_0x498e16){return{'model':db[_0x498e16[_0x0788('0x22')]],'as':_0x498e16['as'],'attributes':_0x498e16[_0x0788('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x17240e){if(_0x85e579['options'][_0x0788('0x27')]===!![])_0x17240e['setDataValue'](_0x0788('0x28'),_0x17240e['getSmtpOptions']());logger[_0x0788('0x23')]('ShowMailAccount',_0x85e579);logger['debug'](_0x0788('0x24'),_0x85e579,JSON[_0x0788('0x15')](_0x17240e));_0x2a08b7(_0x17240e);})[_0x0788('0x1a')](function(_0x2d17b0){logger[_0x0788('0x16')]('ShowMailAccount',_0x2d17b0['message'],_0x85e579);_0x1aab6a(_0x5ec0ed['error'](0x1f4,_0x2d17b0['message']));});});};exports[_0x0788('0x29')]=function(_0x1202c4){var _0x45b247=this;return new Promise(function(_0x358a22,_0x362c49){var _0x5993ad={'body':_0x1202c4['body'],'channel':_0x0788('0x2a')};var _0x6770a8=_[_0x0788('0x2b')](_[_0x0788('0x2c')](db[_0x0788('0x2d')][_0x0788('0x2e')]),[_0x0788('0x2f'),_0x0788('0x30'),_0x0788('0x31'),'ListId']);var _0x5581e6=![];if(_0x1202c4[_0x0788('0x32')]['id']){delete _0x1202c4[_0x0788('0x32')]['id'];}if(_[_0x0788('0x33')](_0x1202c4['body']['from'])){return _0x362c49(_0x45b247['error'](0x1f4,_0x0788('0x34')));}if(_[_0x0788('0x33')](_0x1202c4[_0x0788('0x32')][_0x0788('0x32')])||_0x1202c4[_0x0788('0x32')][_0x0788('0x32')]===''){return _0x362c49(_0x45b247[_0x0788('0x16')](0x1f4,_0x0788('0x35')));}if(_['isNil'](_0x1202c4[_0x0788('0x32')][_0x0788('0x36')])){return _0x362c49(_0x45b247[_0x0788('0x16')](0x1f4,_0x0788('0x37')+_0x6770a8));}if(!_['includes'](_0x6770a8,_0x1202c4[_0x0788('0x32')][_0x0788('0x36')])){return _0x362c49(_0x45b247['error'](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x6770a8));}var _0x524b43={};_0x524b43[_0x1202c4[_0x0788('0x32')]['mapKey']]=_0x1202c4[_0x0788('0x32')][_0x0788('0x38')];return db[_0x0788('0x1c')][_0x0788('0x25')]({'where':{'id':_0x1202c4[_0x0788('0x39')]['id']},'include':[{'model':db[_0x0788('0x3a')],'as':_0x0788('0x3b'),'include':[{'model':db[_0x0788('0x2d')],'as':'Contacts','where':_0x524b43,'limit':0x1,'order':[['updatedAt',_0x0788('0x3c')]]}]},{'model':db[_0x0788('0x3d')],'as':_0x0788('0x3e')},{'model':db['MailServerOut'],'as':_0x0788('0x3f'),'include':[{'model':db[_0x0788('0x40')],'as':_0x0788('0x40')}]}]})[_0x0788('0x10')](function(_0x2395ad){if(_0x2395ad&&_0x2395ad['List']){var _0x5c436a=_0x2395ad[_0x0788('0x41')]({'plain':!![]});_0x5993ad[_0x0788('0x39')]=_['omit'](_0x5c436a,[_0x0788('0x3e'),'List']);_0x5993ad[_0x0788('0x39')][_0x0788('0x28')]=_0x2395ad[_0x0788('0x42')]();_0x5993ad[_0x0788('0x43')]=_0x5c436a[_0x0788('0x3e')];_0x5993ad[_0x0788('0x44')]=_0x5c436a[_0x0788('0x3b')];_0x5993ad[_0x0788('0x43')]=_['orderBy'](_0x5993ad[_0x0788('0x43')],[_0x0788('0x45')],[_0x0788('0x46')]);if(_0x5993ad['account']&&_0x5993ad[_0x0788('0x39')][_0x0788('0x47')]){_0x5993ad['applications'][_0x0788('0x48')]({'id':0x0,'priority':_0x5993ad[_0x0788('0x43')][_0x0788('0x49')]+0x1,'app':_0x0788('0x4a'),'appdata':_0x0788('0x47'),'interval':_0x0788('0x4b')});}if(_0x5993ad['account']['Applications']){delete _0x5993ad[_0x0788('0x39')][_0x0788('0x3e')];}if(_0x5993ad['account'][_0x0788('0x3b')]){delete _0x5993ad[_0x0788('0x39')][_0x0788('0x3b')];}if(_0x5c436a[_0x0788('0x3b')][_0x0788('0x4c')][_0x0788('0x49')]){return _0x5c436a[_0x0788('0x3b')][_0x0788('0x4c')][0x0];}var _0x35f290=_[_0x0788('0xb')](_0x1202c4[_0x0788('0x32')],{'firstName':_0x1202c4[_0x0788('0x32')]['from'],'ListId':_0x5c436a[_0x0788('0x4d')]});_0x35f290[_0x1202c4[_0x0788('0x32')][_0x0788('0x36')]]=_0x1202c4['body'][_0x0788('0x38')];return db[_0x0788('0x2d')]['create'](_0x35f290);}else{throw new Error('List\x20not\x20found');}})[_0x0788('0x10')](function(_0x26826a){_0x5993ad[_0x0788('0x4e')]=_0x26826a;if(_0x26826a){if(!_0x1202c4[_0x0788('0x32')][_0x0788('0x18')][_0x0788('0x4f')]){_0x1202c4['body'][_0x0788('0x18')][_0x0788('0x4f')]=rs[_0x0788('0x50')]()+'\x20'+_0x1202c4['body']['message'][_0x0788('0x38')];}var _0x5419d9={'ContactId':_0x26826a['id'],'MailAccountId':_0x1202c4[_0x0788('0x39')]['id'],'inReplyTo':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')][_0x0788('0x4f')],'to':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')][_0x0788('0x38')],'cc':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')]['cc'],'subject':_0x1202c4[_0x0788('0x32')]['message'][_0x0788('0x51')],'attach':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')][_0x0788('0x52')],'lastMsgAt':moment()['format'](_0x0788('0x53')),'lastMsgDirection':'in'};return db[_0x0788('0x54')][_0x0788('0x25')]({'where':{'closed':![],'MailAccountId':_0x1202c4[_0x0788('0x39')]['id']},'include':[{'model':db[_0x0788('0x55')],'as':'Messages','attributes':[_0x0788('0x4f')],'where':{'messageId':_0x1202c4['body'][_0x0788('0x18')][_0x0788('0x56')]}}]})[_0x0788('0x10')](function(_0x47f22c){if(_0x47f22c){return[_0x47f22c,![]];}return db[_0x0788('0x54')][_0x0788('0x57')](_0x5419d9)[_0x0788('0x10')](function(_0x150403){return[_0x150403,!![]];});});}else{throw new Error(_0x0788('0x58'));}})['spread'](function(_0x25201f,_0x2dea6c){if(_0x25201f){_0x5581e6=_0x2dea6c;if(!_0x2dea6c){return _0x25201f[_0x0788('0x59')]({'inReplyTo':_0x1202c4['body']['message'][_0x0788('0x4f')],'to':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')]['from'],'cc':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')]['cc'],'subject':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')]['subject'],'attach':_0x25201f['attach']?_0x25201f['attach']:_0x1202c4[_0x0788('0x32')][_0x0788('0x18')][_0x0788('0x52')],'substatus':null,'substatusAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x0788('0x5a')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x25201f;}}})[_0x0788('0x10')](function(_0x3d1181){_0x5993ad[_0x0788('0x5b')]=_0x3d1181[_0x0788('0x41')]({'plain':!![]});_0x5993ad[_0x0788('0x5b')][_0x0788('0x5c')]=_0x5581e6;return db[_0x0788('0x55')][_0x0788('0x57')]({'body':_0x1202c4[_0x0788('0x32')][_0x0788('0x32')],'MailAccountId':_0x1202c4['account']['id'],'MailInteractionId':_0x3d1181['id'],'direction':'in','ContactId':_0x5993ad[_0x0788('0x4e')]['id'],'messageId':_0x1202c4[_0x0788('0x32')]['message']['messageId'],'from':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')][_0x0788('0x38')],'to':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')]['to'],'cc':_0x1202c4[_0x0788('0x32')]['message']['cc'],'subject':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')][_0x0788('0x51')],'attach':_0x1202c4[_0x0788('0x32')]['message'][_0x0788('0x52')],'Attachments':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')][_0x0788('0x5d')],'originTo':_0x1202c4['body']['message'][_0x0788('0x5e')],'originCc':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')][_0x0788('0x5f')],'bcc':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')][_0x0788('0x60')],'ChatWebsiteId':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')]['ChatWebsiteId']||null,'originChannel':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')][_0x0788('0x61')]||'Email','ChatOfflineMessageId':_0x1202c4['body'][_0x0788('0x18')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x0788('0x62')],'as':_0x0788('0x63')}]});})[_0x0788('0x10')](function(_0xa4b3f8){_0x5993ad[_0x0788('0x18')]=_0xa4b3f8;if(_0x5993ad[_0x0788('0x5b')][_0x0788('0x64')]){return db[_0x0788('0x65')][_0x0788('0x25')]({'attributes':['id','name'],'where':{'id':_0x5993ad[_0x0788('0x5b')][_0x0788('0x64')]}})[_0x0788('0x10')](function(_0x54fd89){if(_0x54fd89){_0x5993ad[_0x0788('0x43')][_0x0788('0x66')]({'id':0x0,'priority':0x0,'app':_0x0788('0x67'),'appdata':_0x54fd89['name']+','+(_0x5993ad[_0x0788('0x39')][_0x0788('0x68')]||0xa),'interval':_0x0788('0x4b')});}return respondWithRpcPromise(_0x0788('0x69'),_0x0788('0x6a'),_0x5993ad);});}return respondWithRpcPromise(_0x0788('0x69'),_0x0788('0x6a'),_0x5993ad);})[_0x0788('0x10')](function(_0x25058b){_0x358a22(_0x25058b);})['catch'](function(_0x471b3a){_0x362c49(_0x45b247[_0x0788('0x16')](0x1f4,_0x471b3a[_0x0788('0x18')]));});});}; \ No newline at end of file +var _0x57ca=['setDataValue','getSmtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact','createdAt','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','account','CmList','Contacts','updatedAt','DESC','MailApplication','Applications','List','omit','applications','list','orderBy','asc','push','length','close','*,*,*,*','ListId','contact','messageId','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','inReplyTo','MailInteraction','create','Contact\x20not\x20found','spread','update','interaction','get','created','originCc','bcc','Email','Attachment','Attachments','UserId','User','unshift','name','waitForTheAssignedAgent','startRouting','Start','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','then','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailAccount','findAll','options','raw','where','attributes','limit','include','map','model','info','ShowMailAccount','MailAccount','find'];(function(_0x79944f,_0x5e5e9c){var _0x51cb5b=function(_0x231e37){while(--_0x231e37){_0x79944f['push'](_0x79944f['shift']());}};_0x51cb5b(++_0x5e5e9c);}(_0x57ca,0x108));var _0xa57c=function(_0x7792b0,_0x454b78){_0x7792b0=_0x7792b0-0x0;var _0x34c9a8=_0x57ca[_0x7792b0];return _0x34c9a8;};'use strict';var _=require('lodash');var moment=require(_0xa57c('0x0'));var BPromise=require(_0xa57c('0x1'));var rs=require('randomstring');var Redis=require(_0xa57c('0x2'));var db=require(_0xa57c('0x3'))['db'];var logger=require(_0xa57c('0x4'))(_0xa57c('0x5'));var config=require(_0xa57c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa57c('0x7')][_0xa57c('0x8')]({'port':0x232c});config[_0xa57c('0x9')]=_[_0xa57c('0xa')](config[_0xa57c('0x9')],{'host':_0xa57c('0xb'),'port':0x18eb});var socket=require(_0xa57c('0xc'))(new Redis(config[_0xa57c('0x9')]));require('./mailAccount.socket')[_0xa57c('0xd')](socket);function respondWithRpcPromise(_0x4b51d8,_0x46ba92,_0x932dcc){return new BPromise(function(_0x4fa5ed,_0x156bca){return client['request'](_0x4b51d8,_0x932dcc)[_0xa57c('0xe')](function(_0x44b221){logger['info'](_0xa57c('0xf'),_0x46ba92,'request\x20sent');logger[_0xa57c('0x10')](_0xa57c('0x11'),_0x46ba92,_0xa57c('0x12'),JSON[_0xa57c('0x13')](_0x44b221));if(_0x44b221[_0xa57c('0x14')]){if(_0x44b221['error'][_0xa57c('0x15')]===0x1f4){logger['error'](_0xa57c('0xf'),_0x46ba92,_0x44b221[_0xa57c('0x14')][_0xa57c('0x16')]);return _0x156bca(_0x44b221[_0xa57c('0x14')][_0xa57c('0x16')]);}logger[_0xa57c('0x14')](_0xa57c('0xf'),_0x46ba92,_0x44b221['error'][_0xa57c('0x16')]);return _0x4fa5ed(_0x44b221[_0xa57c('0x14')][_0xa57c('0x16')]);}else{logger['info'](_0xa57c('0xf'),_0x46ba92,'request\x20sent');_0x4fa5ed(_0x44b221[_0xa57c('0x17')][_0xa57c('0x16')]);}})[_0xa57c('0x18')](function(_0xe3d505){logger[_0xa57c('0x14')](_0xa57c('0xf'),_0x46ba92,_0xe3d505);_0x156bca(_0xe3d505);});});}exports[_0xa57c('0x19')]=function(_0x595c7a){var _0x4e4399=this;return new Promise(function(_0x8a8856,_0x4a53ab){return db['MailAccount'][_0xa57c('0x1a')]({'raw':_0x595c7a[_0xa57c('0x1b')]?_0x595c7a[_0xa57c('0x1b')][_0xa57c('0x1c')]===undefined?!![]:![]:!![],'where':_0x595c7a['options']?_0x595c7a[_0xa57c('0x1b')][_0xa57c('0x1d')]||null:null,'attributes':_0x595c7a[_0xa57c('0x1b')]?_0x595c7a[_0xa57c('0x1b')][_0xa57c('0x1e')]||null:null,'limit':_0x595c7a[_0xa57c('0x1b')]?_0x595c7a[_0xa57c('0x1b')][_0xa57c('0x1f')]||null:null,'include':_0x595c7a[_0xa57c('0x1b')]?_0x595c7a[_0xa57c('0x1b')][_0xa57c('0x20')]?_[_0xa57c('0x21')](_0x595c7a[_0xa57c('0x1b')][_0xa57c('0x20')],function(_0x431bec){return{'model':db[_0x431bec['model']],'as':_0x431bec['as'],'attributes':_0x431bec[_0xa57c('0x1e')],'include':_0x431bec[_0xa57c('0x20')]?_[_0xa57c('0x21')](_0x431bec[_0xa57c('0x20')],function(_0x315ad7){return{'model':db[_0x315ad7[_0xa57c('0x22')]],'as':_0x315ad7['as'],'attributes':_0x315ad7[_0xa57c('0x1e')],'include':_0x315ad7[_0xa57c('0x20')]?_[_0xa57c('0x21')](_0x315ad7[_0xa57c('0x20')],function(_0x57ebe0){return{'model':db[_0x57ebe0[_0xa57c('0x22')]],'as':_0x57ebe0['as'],'attributes':_0x57ebe0['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x257661){logger[_0xa57c('0x23')]('GetMailAccount',_0x595c7a);logger[_0xa57c('0x10')](_0xa57c('0x19'),_0x595c7a,JSON[_0xa57c('0x13')](_0x257661));_0x8a8856(_0x257661);})['catch'](function(_0xd779f1){logger['error'](_0xa57c('0x19'),_0xd779f1['message'],_0x595c7a);_0x4a53ab(_0x4e4399[_0xa57c('0x14')](0x1f4,_0xd779f1['message']));});});};exports[_0xa57c('0x24')]=function(_0x532164){var _0x9e02bb=this;return new Promise(function(_0x1d82d9,_0x43c8f3){return db[_0xa57c('0x25')][_0xa57c('0x26')]({'raw':_0x532164[_0xa57c('0x1b')]?_0x532164[_0xa57c('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x532164[_0xa57c('0x1b')]?_0x532164['options'][_0xa57c('0x1d')]||null:null,'attributes':_0x532164[_0xa57c('0x1b')]?_0x532164[_0xa57c('0x1b')]['attributes']||null:null,'include':_0x532164[_0xa57c('0x1b')]?_0x532164['options'][_0xa57c('0x20')]?_['map'](_0x532164[_0xa57c('0x1b')]['include'],function(_0x433116){return{'model':db[_0x433116[_0xa57c('0x22')]],'as':_0x433116['as'],'attributes':_0x433116['attributes'],'include':_0x433116[_0xa57c('0x20')]?_['map'](_0x433116[_0xa57c('0x20')],function(_0x5c56d3){return{'model':db[_0x5c56d3[_0xa57c('0x22')]],'as':_0x5c56d3['as'],'attributes':_0x5c56d3[_0xa57c('0x1e')],'include':_0x5c56d3[_0xa57c('0x20')]?_[_0xa57c('0x21')](_0x5c56d3[_0xa57c('0x20')],function(_0x44350f){return{'model':db[_0x44350f['model']],'as':_0x44350f['as'],'attributes':_0x44350f['attributes']};}):[]};}):[]};}):[]:[]})[_0xa57c('0xe')](function(_0x13e390){if(_0x532164[_0xa57c('0x1b')]['smtp']===!![])_0x13e390[_0xa57c('0x27')]('smtpOptions',_0x13e390[_0xa57c('0x28')]());logger[_0xa57c('0x23')]('ShowMailAccount',_0x532164);logger['debug']('ShowMailAccount',_0x532164,JSON[_0xa57c('0x13')](_0x13e390));_0x1d82d9(_0x13e390);})[_0xa57c('0x18')](function(_0x269a19){logger[_0xa57c('0x14')](_0xa57c('0x24'),_0x269a19[_0xa57c('0x16')],_0x532164);_0x43c8f3(_0x9e02bb['error'](0x1f4,_0x269a19[_0xa57c('0x16')]));});});};exports[_0xa57c('0x29')]=function(_0x5a5490){var _0x5ed42d=this;return new Promise(function(_0x5e10b,_0x203375){var _0x5af5e9={'body':_0x5a5490[_0xa57c('0x2a')],'channel':_0xa57c('0x2b')};var _0x2112b7=_[_0xa57c('0x2c')](_[_0xa57c('0x2d')](db[_0xa57c('0x2e')]['rawAttributes']),[_0xa57c('0x2f'),'updatedAt','CompanyId','ListId']);var _0x520383=![];if(_0x5a5490['body']['id']){delete _0x5a5490[_0xa57c('0x2a')]['id'];}if(_[_0xa57c('0x30')](_0x5a5490[_0xa57c('0x2a')]['from'])){return _0x203375(_0x5ed42d['error'](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xa57c('0x30')](_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x2a')])||_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x2a')]===''){return _0x203375(_0x5ed42d[_0xa57c('0x14')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xa57c('0x30')](_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x31')])){return _0x203375(_0x5ed42d[_0xa57c('0x14')](0x1f4,_0xa57c('0x32')+_0x2112b7));}if(!_[_0xa57c('0x33')](_0x2112b7,_0x5a5490['body'][_0xa57c('0x31')])){return _0x203375(_0x5ed42d[_0xa57c('0x14')](0x1f4,_0xa57c('0x34')+_0x2112b7));}var _0x14e943={};_0x14e943[_0x5a5490[_0xa57c('0x2a')]['mapKey']]=_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x35')];return db[_0xa57c('0x25')][_0xa57c('0x26')]({'where':{'id':_0x5a5490[_0xa57c('0x36')]['id']},'include':[{'model':db[_0xa57c('0x37')],'as':'List','include':[{'model':db[_0xa57c('0x2e')],'as':_0xa57c('0x38'),'where':_0x14e943,'limit':0x1,'order':[[_0xa57c('0x39'),_0xa57c('0x3a')]]}]},{'model':db[_0xa57c('0x3b')],'as':_0xa57c('0x3c')},{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]})[_0xa57c('0xe')](function(_0x49492f){if(_0x49492f&&_0x49492f[_0xa57c('0x3d')]){var _0xae87=_0x49492f['get']({'plain':!![]});_0x5af5e9[_0xa57c('0x36')]=_[_0xa57c('0x3e')](_0xae87,[_0xa57c('0x3c'),_0xa57c('0x3d')]);_0x5af5e9[_0xa57c('0x36')]['smtpOptions']=_0x49492f[_0xa57c('0x28')]();_0x5af5e9[_0xa57c('0x3f')]=_0xae87[_0xa57c('0x3c')];_0x5af5e9[_0xa57c('0x40')]=_0xae87[_0xa57c('0x3d')];_0x5af5e9['applications']=_[_0xa57c('0x41')](_0x5af5e9['applications'],['priority'],[_0xa57c('0x42')]);if(_0x5af5e9[_0xa57c('0x36')]&&_0x5af5e9[_0xa57c('0x36')]['autoclose']){_0x5af5e9['applications'][_0xa57c('0x43')]({'id':0x0,'priority':_0x5af5e9[_0xa57c('0x3f')][_0xa57c('0x44')]+0x1,'app':_0xa57c('0x45'),'appdata':'autoclose','interval':_0xa57c('0x46')});}if(_0x5af5e9[_0xa57c('0x36')][_0xa57c('0x3c')]){delete _0x5af5e9['account']['Applications'];}if(_0x5af5e9[_0xa57c('0x36')][_0xa57c('0x3d')]){delete _0x5af5e9['account'][_0xa57c('0x3d')];}if(_0xae87[_0xa57c('0x3d')][_0xa57c('0x38')][_0xa57c('0x44')]){return _0xae87[_0xa57c('0x3d')][_0xa57c('0x38')][0x0];}var _0x4fc413=_['defaults'](_0x5a5490['body'],{'firstName':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x35')],'ListId':_0xae87[_0xa57c('0x47')]});_0x4fc413[_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x31')]]=_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x35')];return db[_0xa57c('0x2e')]['create'](_0x4fc413);}else{throw new Error('List\x20not\x20found');}})[_0xa57c('0xe')](function(_0x4e18ad){_0x5af5e9[_0xa57c('0x48')]=_0x4e18ad;if(_0x4e18ad){if(!_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')]['messageId']){_0x5a5490[_0xa57c('0x2a')]['message'][_0xa57c('0x49')]=rs['generate']()+'\x20'+_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x35')];}var _0x26a8e1={'ContactId':_0x4e18ad['id'],'MailAccountId':_0x5a5490['account']['id'],'inReplyTo':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x49')],'to':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')]['from'],'cc':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')]['cc'],'subject':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x4a')],'attach':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x4b')],'lastMsgAt':moment()[_0xa57c('0x4c')](_0xa57c('0x4d')),'lastMsgDirection':'in'};return db['MailInteraction'][_0xa57c('0x26')]({'where':{'closed':![],'MailAccountId':_0x5a5490[_0xa57c('0x36')]['id']},'include':[{'model':db[_0xa57c('0x4e')],'as':_0xa57c('0x4f'),'attributes':[_0xa57c('0x49')],'where':{'messageId':_0x5a5490[_0xa57c('0x2a')]['message'][_0xa57c('0x50')]}}]})[_0xa57c('0xe')](function(_0x521acc){if(_0x521acc){return[_0x521acc,![]];}return db[_0xa57c('0x51')][_0xa57c('0x52')](_0x26a8e1)[_0xa57c('0xe')](function(_0xa78a75){return[_0xa78a75,!![]];});});}else{throw new Error(_0xa57c('0x53'));}})[_0xa57c('0x54')](function(_0x24efa0,_0x5e1103){if(_0x24efa0){_0x520383=_0x5e1103;if(!_0x5e1103){return _0x24efa0[_0xa57c('0x55')]({'inReplyTo':_0x5a5490['body'][_0xa57c('0x16')]['messageId'],'to':_0x5a5490[_0xa57c('0x2a')]['message'][_0xa57c('0x35')],'cc':_0x5a5490[_0xa57c('0x2a')]['message']['cc'],'subject':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x4a')],'attach':_0x24efa0[_0xa57c('0x4b')]?_0x24efa0['attach']:_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x4b')],'substatus':null,'substatusAt':moment()[_0xa57c('0x4c')](_0xa57c('0x4d')),'lastMsgAt':moment()[_0xa57c('0x4c')](_0xa57c('0x4d')),'lastMsgDirection':'in'});}else{return _0x24efa0;}}})[_0xa57c('0xe')](function(_0x11c13e){_0x5af5e9[_0xa57c('0x56')]=_0x11c13e[_0xa57c('0x57')]({'plain':!![]});_0x5af5e9[_0xa57c('0x56')][_0xa57c('0x58')]=_0x520383;return db[_0xa57c('0x4e')][_0xa57c('0x52')]({'body':_0x5a5490[_0xa57c('0x2a')]['body'],'MailAccountId':_0x5a5490[_0xa57c('0x36')]['id'],'MailInteractionId':_0x11c13e['id'],'direction':'in','ContactId':_0x5af5e9['contact']['id'],'messageId':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x49')],'from':_0x5a5490['body'][_0xa57c('0x16')][_0xa57c('0x35')],'to':_0x5a5490[_0xa57c('0x2a')]['message']['to'],'cc':_0x5a5490['body'][_0xa57c('0x16')]['cc'],'subject':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x4a')],'attach':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x4b')],'Attachments':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')]['attachments'],'originTo':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')]['originTo'],'originCc':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x59')],'bcc':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x5a')],'ChatWebsiteId':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')]['ChatWebsiteId']||null,'originChannel':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')]['originChannel']||_0xa57c('0x5b'),'ChatOfflineMessageId':_0x5a5490[_0xa57c('0x2a')]['message']['ChatOfflineMessageId']||null},{'include':[{'model':db[_0xa57c('0x5c')],'as':_0xa57c('0x5d')}]});})[_0xa57c('0xe')](function(_0x1604d6){_0x5af5e9[_0xa57c('0x16')]=_0x1604d6;if(_0x5af5e9['interaction'][_0xa57c('0x5e')]){return db[_0xa57c('0x5f')][_0xa57c('0x26')]({'attributes':['id','name'],'where':{'id':_0x5af5e9[_0xa57c('0x56')]['UserId']}})[_0xa57c('0xe')](function(_0x2963cb){if(_0x2963cb){_0x5af5e9[_0xa57c('0x3f')][_0xa57c('0x60')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2963cb[_0xa57c('0x61')]+','+(_0x5af5e9[_0xa57c('0x36')][_0xa57c('0x62')]||0xa),'interval':_0xa57c('0x46')});}return respondWithRpcPromise('Start',_0xa57c('0x63'),_0x5af5e9);});}return respondWithRpcPromise(_0xa57c('0x64'),_0xa57c('0x63'),_0x5af5e9);})['then'](function(_0x3da413){_0x5e10b(_0x3da413);})[_0xa57c('0x18')](function(_0x2ed4f4){_0x203375(_0x5ed42d['error'](0x1f4,_0x2ed4f4[_0xa57c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index b9f7a58..47642d4 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 _0x5b2e=['save','remove','update','emit','register','length','mailAccount:','./mailAccount.events'];(function(_0xcde2c5,_0x5aedf2){var _0x112d16=function(_0x51f4b0){while(--_0x51f4b0){_0xcde2c5['push'](_0xcde2c5['shift']());}};_0x112d16(++_0x5aedf2);}(_0x5b2e,0x147));var _0xe5b2=function(_0x4fcedb,_0x185e42){_0x4fcedb=_0x4fcedb-0x0;var _0x5e9792=_0x5b2e[_0x4fcedb];return _0x5e9792;};'use strict';var MailAccountEvents=require(_0xe5b2('0x0'));var events=[_0xe5b2('0x1'),_0xe5b2('0x2'),_0xe5b2('0x3')];function createListener(_0x34a7a5,_0x20185e){return function(_0xe6967b){_0x20185e[_0xe5b2('0x4')](_0x34a7a5,_0xe6967b);};}function removeListener(_0x3ee3f8,_0x21b852){return function(){MailAccountEvents['removeListener'](_0x3ee3f8,_0x21b852);};}exports[_0xe5b2('0x5')]=function(_0x2d672e){for(var _0x3fa66f=0x0,_0x4af632=events[_0xe5b2('0x6')];_0x3fa66f<_0x4af632;_0x3fa66f++){var _0x257ad2=events[_0x3fa66f];var _0x12c0e6=createListener(_0xe5b2('0x7')+_0x257ad2,_0x2d672e);MailAccountEvents['on'](_0x257ad2,_0x12c0e6);}}; \ No newline at end of file +var _0x7edd=['register','length','./mailAccount.events','save','remove','update','emit','removeListener'];(function(_0x52099a,_0x126895){var _0xa7ccf2=function(_0xb08139){while(--_0xb08139){_0x52099a['push'](_0x52099a['shift']());}};_0xa7ccf2(++_0x126895);}(_0x7edd,0x72));var _0xd7ed=function(_0x5749d0,_0x39b8b2){_0x5749d0=_0x5749d0-0x0;var _0x4bab8b=_0x7edd[_0x5749d0];return _0x4bab8b;};'use strict';var MailAccountEvents=require(_0xd7ed('0x0'));var events=[_0xd7ed('0x1'),_0xd7ed('0x2'),_0xd7ed('0x3')];function createListener(_0x44fb3f,_0x58f4aa){return function(_0x336c33){_0x58f4aa[_0xd7ed('0x4')](_0x44fb3f,_0x336c33);};}function removeListener(_0x572df8,_0xd5a634){return function(){MailAccountEvents[_0xd7ed('0x5')](_0x572df8,_0xd5a634);};}exports[_0xd7ed('0x6')]=function(_0xf559e5){for(var _0x493b98=0x0,_0x33fd6b=events[_0xd7ed('0x7')];_0x493b98<_0x33fd6b;_0x493b98++){var _0x100fd0=events[_0x493b98];var _0x558e9f=createListener('mailAccount:'+_0x100fd0,_0xf559e5);MailAccountEvents['on'](_0x100fd0,_0x558e9f);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 9b23e9e..17087f1 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 _0xd15c=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','/:id','isAuthenticated','show','put','delete','destroy','exports','util','path','connect-timeout','Router'];(function(_0x3ca6f6,_0x3e9153){var _0x5e24d6=function(_0x45078d){while(--_0x45078d){_0x3ca6f6['push'](_0x3ca6f6['shift']());}};_0x5e24d6(++_0x3e9153);}(_0xd15c,0x1ac));var _0xcd15=function(_0x596b17,_0x35bfb2){_0x596b17=_0x596b17-0x0;var _0x2640f4=_0xd15c[_0x596b17];return _0x2640f4;};'use strict';var multer=require('multer');var util=require(_0xcd15('0x0'));var path=require(_0xcd15('0x1'));var timeout=require(_0xcd15('0x2'));var express=require('express');var router=express[_0xcd15('0x3')]();var fs_extra=require(_0xcd15('0x4'));var auth=require(_0xcd15('0x5'));var interaction=require(_0xcd15('0x6'));var config=require(_0xcd15('0x7'));var controller=require(_0xcd15('0x8'));router['get'](_0xcd15('0x9'),auth[_0xcd15('0xa')](),controller[_0xcd15('0xb')]);router[_0xcd15('0xc')]('/:id',auth[_0xcd15('0xa')](),controller['update']);router[_0xcd15('0xd')](_0xcd15('0x9'),auth['isAuthenticated'](),controller[_0xcd15('0xe')]);module[_0xcd15('0xf')]=router; \ No newline at end of file +var _0x9e74=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','put','/:id','update','delete'];(function(_0x127b40,_0x493b52){var _0x2547b1=function(_0x453b73){while(--_0x453b73){_0x127b40['push'](_0x127b40['shift']());}};_0x2547b1(++_0x493b52);}(_0x9e74,0x150));var _0x49e7=function(_0x5832dc,_0x3b48e9){_0x5832dc=_0x5832dc-0x0;var _0x16f6fb=_0x9e74[_0x5832dc];return _0x16f6fb;};'use strict';var multer=require(_0x49e7('0x0'));var util=require(_0x49e7('0x1'));var path=require(_0x49e7('0x2'));var timeout=require(_0x49e7('0x3'));var express=require('express');var router=express[_0x49e7('0x4')]();var fs_extra=require(_0x49e7('0x5'));var auth=require(_0x49e7('0x6'));var interaction=require(_0x49e7('0x7'));var config=require(_0x49e7('0x8'));var controller=require('./mailApplication.controller');router['get']('/:id',auth[_0x49e7('0x9')](),controller['show']);router[_0x49e7('0xa')](_0x49e7('0xb'),auth['isAuthenticated'](),controller[_0x49e7('0xc')]);router[_0x49e7('0xd')](_0x49e7('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 8817740..dd144cd 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 _0xe8a2=['INTEGER','STRING','*,*,*,*','sequelize','exports'];(function(_0x2c8dcd,_0x221b7e){var _0x3c7109=function(_0x2ce421){while(--_0x2ce421){_0x2c8dcd['push'](_0x2c8dcd['shift']());}};_0x3c7109(++_0x221b7e);}(_0xe8a2,0x85));var _0x2e8a=function(_0x4118f6,_0x37bd1c){_0x4118f6=_0x4118f6-0x0;var _0x5df6ae=_0xe8a2[_0x4118f6];return _0x5df6ae;};'use strict';var Sequelize=require(_0x2e8a('0x0'));module[_0x2e8a('0x1')]={'priority':{'type':Sequelize[_0x2e8a('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x2e8a('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x2e8a('0x3')]},'interval':{'type':Sequelize[_0x2e8a('0x3')],'defaultValue':_0x2e8a('0x4')}}; \ No newline at end of file +var _0x2b39=['TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER','noop'];(function(_0x1750a7,_0x20ee14){var _0x463385=function(_0x564ea5){while(--_0x564ea5){_0x1750a7['push'](_0x1750a7['shift']());}};_0x463385(++_0x20ee14);}(_0x2b39,0xe3));var _0x92b3=function(_0x10346c,_0x183ce6){_0x10346c=_0x10346c-0x0;var _0x262bd4=_0x2b39[_0x10346c];return _0x262bd4;};'use strict';var Sequelize=require(_0x92b3('0x0'));module[_0x92b3('0x1')]={'priority':{'type':Sequelize[_0x92b3('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x92b3('0x3')},'appdata':{'type':Sequelize[_0x92b3('0x4')]()},'description':{'type':Sequelize[_0x92b3('0x5')]},'interval':{'type':Sequelize[_0x92b3('0x5')],'defaultValue':_0x92b3('0x6')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 4b15d53..c875d7c 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 _0x54ef=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','name','show','params','model','rawAttributes','query','keys','filters','intersection','attributes','fields','length','merge','options','MailApplication','find','body','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x22082f,_0x1a819a){var _0x281f68=function(_0x148125){while(--_0x148125){_0x22082f['push'](_0x22082f['shift']());}};_0x281f68(++_0x1a819a);}(_0x54ef,0x112));var _0xf54e=function(_0x1ca325,_0x19de9e){_0x1ca325=_0x1ca325-0x0;var _0xc9f793=_0x54ef[_0x1ca325];return _0xc9f793;};'use strict';var emlformat=require(_0xf54e('0x0'));var rimraf=require(_0xf54e('0x1'));var zipdir=require(_0xf54e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf54e('0x3'));var moment=require(_0xf54e('0x4'));var BPromise=require(_0xf54e('0x5'));var Mustache=require(_0xf54e('0x6'));var util=require(_0xf54e('0x7'));var path=require(_0xf54e('0x8'));var sox=require(_0xf54e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf54e('0xa'));var _=require(_0xf54e('0xb'));var squel=require(_0xf54e('0xc'));var crypto=require('crypto');var jsforce=require(_0xf54e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf54e('0xe'));var querystring=require(_0xf54e('0xf'));var Papa=require('papaparse');var Redis=require(_0xf54e('0x10'));var authService=require(_0xf54e('0x11'));var qs=require(_0xf54e('0x12'));var as=require(_0xf54e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf54e('0x14'))(_0xf54e('0x15'));var utils=require(_0xf54e('0x16'));var config=require(_0xf54e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf54e('0x18'))['db'];function respondWithStatusCode(_0x4b0ee1,_0x4bd828){_0x4bd828=_0x4bd828||0xcc;return function(_0x15a9d4){if(_0x15a9d4){return _0x4b0ee1[_0xf54e('0x19')](_0x4bd828);}return _0x4b0ee1[_0xf54e('0x1a')](_0x4bd828)[_0xf54e('0x1b')]();};}function respondWithResult(_0x5644aa,_0x331732){_0x331732=_0x331732||0xc8;return function(_0x1bbeaa){if(_0x1bbeaa){return _0x5644aa[_0xf54e('0x1a')](_0x331732)[_0xf54e('0x1c')](_0x1bbeaa);}};}function respondWithFilteredResult(_0x56828e,_0x2366ee){return function(_0x389abc){if(_0x389abc){var _0x3eb415=typeof _0x2366ee['offset']==='undefined'&&typeof _0x2366ee[_0xf54e('0x1d')]===_0xf54e('0x1e');var _0x1c02e7=_0x389abc[_0xf54e('0x1f')];var _0x15cc48=_0x3eb415?0x0:_0x2366ee[_0xf54e('0x20')];var _0x2e27b6=_0x3eb415?_0x389abc[_0xf54e('0x1f')]:_0x2366ee[_0xf54e('0x20')]+_0x2366ee[_0xf54e('0x1d')];var _0x226c96;if(_0x2e27b6>=_0x1c02e7){_0x2e27b6=_0x1c02e7;_0x226c96=0xc8;}else{_0x226c96=0xce;}_0x56828e['status'](_0x226c96);return _0x56828e['set'](_0xf54e('0x21'),_0x15cc48+'-'+_0x2e27b6+'/'+_0x1c02e7)['json'](_0x389abc);}return null;};}function patchUpdates(_0x3e1556){return function(_0x1bfe99){try{jsonpatch[_0xf54e('0x22')](_0x1bfe99,_0x3e1556,!![]);}catch(_0x9903fc){return BPromise[_0xf54e('0x23')](_0x9903fc);}return _0x1bfe99[_0xf54e('0x24')]();};}function saveUpdates(_0x388aa0,_0x11985e){return function(_0x3c0169){if(_0x3c0169){return _0x3c0169[_0xf54e('0x25')](_0x388aa0)[_0xf54e('0x26')](function(_0x5b83df){return _0x5b83df;});}return null;};}function removeEntity(_0x6f6d29,_0x54f914){return function(_0x264a8f){if(_0x264a8f){return _0x264a8f[_0xf54e('0x27')]()[_0xf54e('0x26')](function(){_0x6f6d29[_0xf54e('0x1a')](0xcc)[_0xf54e('0x1b')]();});}};}function handleEntityNotFound(_0x160160,_0x1e08d1){return function(_0x43488d){if(!_0x43488d){_0x160160[_0xf54e('0x19')](0x194);}return _0x43488d;};}function handleError(_0x33457f,_0xf6cdd7){_0xf6cdd7=_0xf6cdd7||0x1f4;return function(_0x39c0ae){logger[_0xf54e('0x28')](_0x39c0ae['stack']);if(_0x39c0ae[_0xf54e('0x29')]){delete _0x39c0ae['name'];}_0x33457f[_0xf54e('0x1a')](_0xf6cdd7)['send'](_0x39c0ae);};}exports[_0xf54e('0x2a')]=function(_0x269f47,_0x21ba00){var _0xa13cd0={'raw':!![],'where':{'id':_0x269f47[_0xf54e('0x2b')]['id']}},_0x25b643={};_0x25b643[_0xf54e('0x2c')]=_['keys'](db['MailApplication'][_0xf54e('0x2d')]);_0x25b643[_0xf54e('0x2e')]=_[_0xf54e('0x2f')](_0x269f47[_0xf54e('0x2e')]);_0x25b643[_0xf54e('0x30')]=_[_0xf54e('0x31')](_0x25b643[_0xf54e('0x2c')],_0x25b643[_0xf54e('0x2e')]);_0xa13cd0[_0xf54e('0x32')]=_[_0xf54e('0x31')](_0x25b643['model'],qs['fields'](_0x269f47[_0xf54e('0x2e')][_0xf54e('0x33')]));_0xa13cd0['attributes']=_0xa13cd0[_0xf54e('0x32')][_0xf54e('0x34')]?_0xa13cd0[_0xf54e('0x32')]:_0x25b643[_0xf54e('0x2c')];if(_0x269f47['query']['includeAll']){_0xa13cd0['include']=[{'all':!![]}];}_0xa13cd0=_[_0xf54e('0x35')]({},_0xa13cd0,_0x269f47[_0xf54e('0x36')]);return db[_0xf54e('0x37')][_0xf54e('0x38')](_0xa13cd0)[_0xf54e('0x26')](handleEntityNotFound(_0x21ba00,null))[_0xf54e('0x26')](respondWithResult(_0x21ba00,null))['catch'](handleError(_0x21ba00,null));};exports['update']=function(_0x530cee,_0xc04e04){if(_0x530cee[_0xf54e('0x39')]['id']){delete _0x530cee['body']['id'];}return db['MailApplication'][_0xf54e('0x38')]({'where':{'id':_0x530cee[_0xf54e('0x2b')]['id']}})[_0xf54e('0x26')](handleEntityNotFound(_0xc04e04,null))['then'](saveUpdates(_0x530cee[_0xf54e('0x39')],null))[_0xf54e('0x26')](respondWithResult(_0xc04e04,null))['catch'](handleError(_0xc04e04,null));};exports[_0xf54e('0x27')]=function(_0x6e5bdf,_0x5af03){return db[_0xf54e('0x37')][_0xf54e('0x38')]({'where':{'id':_0x6e5bdf[_0xf54e('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5af03,null))['then'](removeEntity(_0x5af03,null))[_0xf54e('0x3a')](handleError(_0x5af03,null));}; \ No newline at end of file +var _0xb43b=['name','status','send','show','params','keys','MailApplication','rawAttributes','query','intersection','model','fields','attributes','length','includeAll','merge','options','find','then','catch','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','sendStatus'];(function(_0x4e8d02,_0x38d988){var _0x10b8b6=function(_0xb7c399){while(--_0xb7c399){_0x4e8d02['push'](_0x4e8d02['shift']());}};_0x10b8b6(++_0x38d988);}(_0xb43b,0x1b2));var _0xbb43=function(_0x3a1367,_0xea7d8d){_0x3a1367=_0x3a1367-0x0;var _0x81a9d8=_0xb43b[_0x3a1367];return _0x81a9d8;};'use strict';var emlformat=require(_0xbb43('0x0'));var rimraf=require(_0xbb43('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb43('0x2'));var rp=require(_0xbb43('0x3'));var moment=require(_0xbb43('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbb43('0x5'));var util=require(_0xbb43('0x6'));var path=require(_0xbb43('0x7'));var sox=require(_0xbb43('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb43('0x9'));var _=require('lodash');var squel=require(_0xbb43('0xa'));var crypto=require(_0xbb43('0xb'));var jsforce=require(_0xbb43('0xc'));var deskjs=require(_0xbb43('0xd'));var toCsv=require(_0xbb43('0xe'));var querystring=require('querystring');var Papa=require(_0xbb43('0xf'));var Redis=require(_0xbb43('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbb43('0x11'));var as=require(_0xbb43('0x12'));var hardwareService=require(_0xbb43('0x13'));var logger=require(_0xbb43('0x14'))(_0xbb43('0x15'));var utils=require(_0xbb43('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbb43('0x17'));var db=require(_0xbb43('0x18'))['db'];function respondWithStatusCode(_0x50e2c0,_0x578392){_0x578392=_0x578392||0xcc;return function(_0x41e7e5){if(_0x41e7e5){return _0x50e2c0['sendStatus'](_0x578392);}return _0x50e2c0['status'](_0x578392)[_0xbb43('0x19')]();};}function respondWithResult(_0x5a509f,_0x68d45d){_0x68d45d=_0x68d45d||0xc8;return function(_0x43021d){if(_0x43021d){return _0x5a509f['status'](_0x68d45d)['json'](_0x43021d);}};}function respondWithFilteredResult(_0x4d5bcf,_0x338120){return function(_0x2abce0){if(_0x2abce0){var _0x57bd1d=typeof _0x338120['offset']===_0xbb43('0x1a')&&typeof _0x338120['limit']==='undefined';var _0x2b0797=_0x2abce0[_0xbb43('0x1b')];var _0x2e3b43=_0x57bd1d?0x0:_0x338120['offset'];var _0x1c16d7=_0x57bd1d?_0x2abce0['count']:_0x338120[_0xbb43('0x1c')]+_0x338120[_0xbb43('0x1d')];var _0x4dfc54;if(_0x1c16d7>=_0x2b0797){_0x1c16d7=_0x2b0797;_0x4dfc54=0xc8;}else{_0x4dfc54=0xce;}_0x4d5bcf['status'](_0x4dfc54);return _0x4d5bcf[_0xbb43('0x1e')](_0xbb43('0x1f'),_0x2e3b43+'-'+_0x1c16d7+'/'+_0x2b0797)[_0xbb43('0x20')](_0x2abce0);}return null;};}function patchUpdates(_0x2bf2d4){return function(_0x5bcce7){try{jsonpatch[_0xbb43('0x21')](_0x5bcce7,_0x2bf2d4,!![]);}catch(_0x5f4416){return BPromise[_0xbb43('0x22')](_0x5f4416);}return _0x5bcce7['save']();};}function saveUpdates(_0x2f5e31,_0x565256){return function(_0x3f323e){if(_0x3f323e){return _0x3f323e[_0xbb43('0x23')](_0x2f5e31)['then'](function(_0x1d0768){return _0x1d0768;});}return null;};}function removeEntity(_0x4dfb7f,_0xf24e60){return function(_0x298ce2){if(_0x298ce2){return _0x298ce2[_0xbb43('0x24')]()['then'](function(){_0x4dfb7f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x269ca5,_0x32d7f0){return function(_0x5d8310){if(!_0x5d8310){_0x269ca5[_0xbb43('0x25')](0x194);}return _0x5d8310;};}function handleError(_0x2da653,_0x226827){_0x226827=_0x226827||0x1f4;return function(_0x3874fb){logger['error'](_0x3874fb['stack']);if(_0x3874fb[_0xbb43('0x26')]){delete _0x3874fb[_0xbb43('0x26')];}_0x2da653[_0xbb43('0x27')](_0x226827)[_0xbb43('0x28')](_0x3874fb);};}exports[_0xbb43('0x29')]=function(_0x40b04b,_0x21d386){var _0x473828={'raw':!![],'where':{'id':_0x40b04b[_0xbb43('0x2a')]['id']}},_0x539730={};_0x539730['model']=_[_0xbb43('0x2b')](db[_0xbb43('0x2c')][_0xbb43('0x2d')]);_0x539730[_0xbb43('0x2e')]=_['keys'](_0x40b04b[_0xbb43('0x2e')]);_0x539730['filters']=_['intersection'](_0x539730['model'],_0x539730[_0xbb43('0x2e')]);_0x473828['attributes']=_[_0xbb43('0x2f')](_0x539730[_0xbb43('0x30')],qs[_0xbb43('0x31')](_0x40b04b['query'][_0xbb43('0x31')]));_0x473828[_0xbb43('0x32')]=_0x473828[_0xbb43('0x32')][_0xbb43('0x33')]?_0x473828[_0xbb43('0x32')]:_0x539730[_0xbb43('0x30')];if(_0x40b04b[_0xbb43('0x2e')][_0xbb43('0x34')]){_0x473828['include']=[{'all':!![]}];}_0x473828=_[_0xbb43('0x35')]({},_0x473828,_0x40b04b[_0xbb43('0x36')]);return db[_0xbb43('0x2c')][_0xbb43('0x37')](_0x473828)[_0xbb43('0x38')](handleEntityNotFound(_0x21d386,null))[_0xbb43('0x38')](respondWithResult(_0x21d386,null))[_0xbb43('0x39')](handleError(_0x21d386,null));};exports[_0xbb43('0x23')]=function(_0x349a83,_0x57105c){if(_0x349a83[_0xbb43('0x3a')]['id']){delete _0x349a83[_0xbb43('0x3a')]['id'];}return db[_0xbb43('0x2c')][_0xbb43('0x37')]({'where':{'id':_0x349a83[_0xbb43('0x2a')]['id']}})[_0xbb43('0x38')](handleEntityNotFound(_0x57105c,null))['then'](saveUpdates(_0x349a83[_0xbb43('0x3a')],null))[_0xbb43('0x38')](respondWithResult(_0x57105c,null))['catch'](handleError(_0x57105c,null));};exports[_0xbb43('0x24')]=function(_0x2c9a7c,_0x11d384){return db['MailApplication']['find']({'where':{'id':_0x2c9a7c['params']['id']}})[_0xbb43('0x38')](handleEntityNotFound(_0x11d384,null))[_0xbb43('0x38')](removeEntity(_0x11d384,null))['catch'](handleError(_0x11d384,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index ed2a049..34be1bb 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 _0x47a7=['moment','bluebird','path','rimraf','../../config/environment','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x7183aa,_0x3ae37){var _0x34eef5=function(_0x36fba0){while(--_0x36fba0){_0x7183aa['push'](_0x7183aa['shift']());}};_0x34eef5(++_0x3ae37);}(_0x47a7,0x97));var _0x747a=function(_0x12c66e,_0xea7b4){_0x12c66e=_0x12c66e-0x0;var _0x19481a=_0x47a7[_0x12c66e];return _0x19481a;};'use strict';var _=require(_0x747a('0x0'));var util=require(_0x747a('0x1'));var logger=require(_0x747a('0x2'))('api');var moment=require(_0x747a('0x3'));var BPromise=require(_0x747a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x747a('0x5'));var rimraf=require(_0x747a('0x6'));var config=require(_0x747a('0x7'));var attributes=require('./mailApplication.attributes');module[_0x747a('0x8')]=function(_0x3984e2,_0x123cac){return _0x3984e2[_0x747a('0x9')](_0x747a('0xa'),attributes,{'tableName':_0x747a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x747a('0xc'),'collate':_0x747a('0xd')});}; \ No newline at end of file +var _0xb9f8=['utf8mb4_unicode_ci','util','api','moment','bluebird','rimraf','../../config/environment','exports','MailApplication','mail_applications','utf8mb4'];(function(_0x24d8d1,_0x10ce38){var _0x48e491=function(_0x5d98f1){while(--_0x5d98f1){_0x24d8d1['push'](_0x24d8d1['shift']());}};_0x48e491(++_0x10ce38);}(_0xb9f8,0x14b));var _0x8b9f=function(_0x5c7fd,_0x5b34ce){_0x5c7fd=_0x5c7fd-0x0;var _0x42924d=_0xb9f8[_0x5c7fd];return _0x42924d;};'use strict';var _=require('lodash');var util=require(_0x8b9f('0x0'));var logger=require('../../config/logger')(_0x8b9f('0x1'));var moment=require(_0x8b9f('0x2'));var BPromise=require(_0x8b9f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8b9f('0x4'));var config=require(_0x8b9f('0x5'));var attributes=require('./mailApplication.attributes');module[_0x8b9f('0x6')]=function(_0x2fb48e,_0x1e17e3){return _0x2fb48e['define'](_0x8b9f('0x7'),attributes,{'tableName':_0x8b9f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8b9f('0x9'),'collate':_0x8b9f('0xa')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 57929d9..c6655cc 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 _0xa186=['attributes','limit','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','UpdateMailApplication','MailApplication','options','raw','where'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xa186,0x8c));var _0x6a18=function(_0x294d23,_0x3e9002){_0x294d23=_0x294d23-0x0;var _0x466b4a=_0xa186[_0x294d23];return _0x466b4a;};'use strict';var _=require(_0x6a18('0x0'));var util=require(_0x6a18('0x1'));var moment=require(_0x6a18('0x2'));var BPromise=require(_0x6a18('0x3'));var rs=require(_0x6a18('0x4'));var fs=require('fs');var Redis=require(_0x6a18('0x5'));var db=require(_0x6a18('0x6'))['db'];var utils=require(_0x6a18('0x7'));var logger=require(_0x6a18('0x8'))(_0x6a18('0x9'));var config=require(_0x6a18('0xa'));var jayson=require(_0x6a18('0xb'));var client=jayson[_0x6a18('0xc')][_0x6a18('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4496db,_0x3612f5,_0x5aafcd){return new BPromise(function(_0x223669,_0x4f89a8){return client[_0x6a18('0xe')](_0x4496db,_0x5aafcd)[_0x6a18('0xf')](function(_0x3acbe0){logger[_0x6a18('0x10')](_0x6a18('0x11'),_0x3612f5,_0x6a18('0x12'));logger[_0x6a18('0x13')](_0x6a18('0x14'),_0x3612f5,'request\x20sent',JSON['stringify'](_0x3acbe0));if(_0x3acbe0[_0x6a18('0x15')]){if(_0x3acbe0[_0x6a18('0x15')][_0x6a18('0x16')]===0x1f4){logger[_0x6a18('0x15')](_0x6a18('0x11'),_0x3612f5,_0x3acbe0[_0x6a18('0x15')]['message']);return _0x4f89a8(_0x3acbe0[_0x6a18('0x15')][_0x6a18('0x17')]);}logger['error']('MailApplication,\x20%s,\x20%s',_0x3612f5,_0x3acbe0[_0x6a18('0x15')][_0x6a18('0x17')]);return _0x223669(_0x3acbe0['error'][_0x6a18('0x17')]);}else{logger['info']('MailApplication,\x20%s,\x20%s',_0x3612f5,_0x6a18('0x12'));_0x223669(_0x3acbe0[_0x6a18('0x18')][_0x6a18('0x17')]);}})['catch'](function(_0x533bfb){logger['error'](_0x6a18('0x11'),_0x3612f5,_0x533bfb);_0x4f89a8(_0x533bfb);});});}exports[_0x6a18('0x19')]=function(_0x1adf3){var _0x25501f=this;return new Promise(function(_0x41522b,_0x30ac1d){return db[_0x6a18('0x1a')]['update'](_0x1adf3['body'],{'raw':_0x1adf3[_0x6a18('0x1b')]?_0x1adf3[_0x6a18('0x1b')][_0x6a18('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1adf3[_0x6a18('0x1b')]?_0x1adf3[_0x6a18('0x1b')][_0x6a18('0x1d')]||null:null,'attributes':_0x1adf3[_0x6a18('0x1b')]?_0x1adf3[_0x6a18('0x1b')][_0x6a18('0x1e')]||null:null,'limit':_0x1adf3[_0x6a18('0x1b')]?_0x1adf3[_0x6a18('0x1b')][_0x6a18('0x1f')]||null:null})[_0x6a18('0xf')](function(_0x2dfe5a){logger[_0x6a18('0x10')](_0x6a18('0x19'),_0x1adf3);logger[_0x6a18('0x13')](_0x6a18('0x19'),_0x1adf3,JSON[_0x6a18('0x20')](_0x2dfe5a));_0x41522b(_0x2dfe5a);})[_0x6a18('0x21')](function(_0x5b7b7a){logger[_0x6a18('0x15')](_0x6a18('0x19'),_0x5b7b7a['message'],_0x1adf3);_0x30ac1d(_0x25501f[_0x6a18('0x15')](0x1f4,_0x5b7b7a[_0x6a18('0x17')]));});});}; \ No newline at end of file +var _0x486d=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','MailApplication','update','body','raw','where','options','attributes','limit','UpdateMailApplication','lodash','util','moment'];(function(_0x13fdb1,_0x1c6fba){var _0x55f710=function(_0x3b0f2b){while(--_0x3b0f2b){_0x13fdb1['push'](_0x13fdb1['shift']());}};_0x55f710(++_0x1c6fba);}(_0x486d,0x79));var _0xd486=function(_0x359dfe,_0x14d930){_0x359dfe=_0x359dfe-0x0;var _0x310a5e=_0x486d[_0x359dfe];return _0x310a5e;};'use strict';var _=require(_0xd486('0x0'));var util=require(_0xd486('0x1'));var moment=require(_0xd486('0x2'));var BPromise=require(_0xd486('0x3'));var rs=require(_0xd486('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd486('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd486('0x6'))(_0xd486('0x7'));var config=require('../../config/environment');var jayson=require(_0xd486('0x8'));var client=jayson[_0xd486('0x9')][_0xd486('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b33c1,_0x7372c9,_0x2bf591){return new BPromise(function(_0xdf60f8,_0xa08af7){return client[_0xd486('0xb')](_0x5b33c1,_0x2bf591)[_0xd486('0xc')](function(_0x4d4a60){logger[_0xd486('0xd')](_0xd486('0xe'),_0x7372c9,'request\x20sent');logger[_0xd486('0xf')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x7372c9,_0xd486('0x10'),JSON[_0xd486('0x11')](_0x4d4a60));if(_0x4d4a60['error']){if(_0x4d4a60[_0xd486('0x12')][_0xd486('0x13')]===0x1f4){logger[_0xd486('0x12')](_0xd486('0xe'),_0x7372c9,_0x4d4a60[_0xd486('0x12')][_0xd486('0x14')]);return _0xa08af7(_0x4d4a60[_0xd486('0x12')][_0xd486('0x14')]);}logger['error'](_0xd486('0xe'),_0x7372c9,_0x4d4a60[_0xd486('0x12')][_0xd486('0x14')]);return _0xdf60f8(_0x4d4a60[_0xd486('0x12')][_0xd486('0x14')]);}else{logger[_0xd486('0xd')](_0xd486('0xe'),_0x7372c9,_0xd486('0x10'));_0xdf60f8(_0x4d4a60['result']['message']);}})[_0xd486('0x15')](function(_0x208da1){logger[_0xd486('0x12')](_0xd486('0xe'),_0x7372c9,_0x208da1);_0xa08af7(_0x208da1);});});}exports['UpdateMailApplication']=function(_0x5dd375){var _0x343ed5=this;return new Promise(function(_0x3bced0,_0x182cf7){return db[_0xd486('0x16')][_0xd486('0x17')](_0x5dd375[_0xd486('0x18')],{'raw':_0x5dd375['options']?_0x5dd375['options'][_0xd486('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5dd375['options']?_0x5dd375['options'][_0xd486('0x1a')]||null:null,'attributes':_0x5dd375['options']?_0x5dd375[_0xd486('0x1b')][_0xd486('0x1c')]||null:null,'limit':_0x5dd375[_0xd486('0x1b')]?_0x5dd375[_0xd486('0x1b')][_0xd486('0x1d')]||null:null})['then'](function(_0xed1ba9){logger[_0xd486('0xd')](_0xd486('0x1e'),_0x5dd375);logger['debug'](_0xd486('0x1e'),_0x5dd375,JSON[_0xd486('0x11')](_0xed1ba9));_0x3bced0(_0xed1ba9);})[_0xd486('0x15')](function(_0x143e4d){logger[_0xd486('0x12')](_0xd486('0x1e'),_0x143e4d[_0xd486('0x14')],_0x5dd375);_0x182cf7(_0x343ed5['error'](0x1f4,_0x143e4d[_0xd486('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index d1f1e2b..6992029 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 _0x9635=['/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','delete','destroy','express','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/:id','show'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9635,0x1a0));var _0x5963=function(_0x4ce505,_0xdbfb64){_0x4ce505=_0x4ce505-0x0;var _0x445ea6=_0x9635[_0x4ce505];return _0x445ea6;};'use strict';var express=require(_0x5963('0x0'));var router=express['Router']();var auth=require(_0x5963('0x1'));var interaction=require(_0x5963('0x2'));var controller=require(_0x5963('0x3'));router[_0x5963('0x4')]('/',auth[_0x5963('0x5')](),controller[_0x5963('0x6')]);router[_0x5963('0x4')]('/describe',auth[_0x5963('0x5')](),controller['describe']);router['get'](_0x5963('0x7'),auth[_0x5963('0x5')](),controller[_0x5963('0x8')]);router[_0x5963('0x4')](_0x5963('0x9'),auth[_0x5963('0x5')](),controller[_0x5963('0xa')]);router[_0x5963('0x4')](_0x5963('0xb'),auth[_0x5963('0x5')](),controller[_0x5963('0xc')]);router['post']('/',auth[_0x5963('0x5')](),controller[_0x5963('0xd')]);router[_0x5963('0xe')](_0x5963('0x9'),auth[_0x5963('0x5')](),controller[_0x5963('0xf')]);router['post'](_0x5963('0x10'),auth[_0x5963('0x5')](),interaction[_0x5963('0x11')](_0x5963('0x12'),_0x5963('0x13')),controller[_0x5963('0x14')]);router[_0x5963('0x15')]('/:id',auth[_0x5963('0x5')](),interaction[_0x5963('0x11')](_0x5963('0x12'),_0x5963('0x16')),controller['update']);router[_0x5963('0x17')]('/:id',auth[_0x5963('0x5')](),interaction[_0x5963('0x11')](_0x5963('0x12'),'mailinteraction:destroy'),controller[_0x5963('0x18')]);router[_0x5963('0x17')]('/:id/tags',auth[_0x5963('0x5')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x02d6=['getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','mail','addTags','put','mailinteraction:update','update','delete','destroy','exports','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/describe','describe','get','/:id','/:id/messages'];(function(_0x549d2b,_0x2acfaa){var _0x2f7f64=function(_0x25cdc5){while(--_0x25cdc5){_0x549d2b['push'](_0x549d2b['shift']());}};_0x2f7f64(++_0x2acfaa);}(_0x02d6,0x139));var _0x602d=function(_0x2e56c9,_0x4ee16e){_0x2e56c9=_0x2e56c9-0x0;var _0x343792=_0x02d6[_0x2e56c9];return _0x343792;};'use strict';var express=require(_0x602d('0x0'));var router=express[_0x602d('0x1')]();var auth=require(_0x602d('0x2'));var interaction=require(_0x602d('0x3'));var controller=require('./mailInteraction.controller');router['get']('/',auth[_0x602d('0x4')](),controller[_0x602d('0x5')]);router['get'](_0x602d('0x6'),auth[_0x602d('0x4')](),controller[_0x602d('0x7')]);router[_0x602d('0x8')](_0x602d('0x9'),auth[_0x602d('0x4')](),controller['show']);router[_0x602d('0x8')](_0x602d('0xa'),auth[_0x602d('0x4')](),controller[_0x602d('0xb')]);router[_0x602d('0x8')](_0x602d('0xc'),auth['isAuthenticated'](),controller[_0x602d('0xd')]);router[_0x602d('0xe')]('/',auth['isAuthenticated'](),controller[_0x602d('0xf')]);router[_0x602d('0xe')](_0x602d('0xa'),auth[_0x602d('0x4')](),controller[_0x602d('0x10')]);router['post'](_0x602d('0x11'),auth['isAuthenticated'](),interaction[_0x602d('0x12')](_0x602d('0x13'),'mailinteraction:addtags'),controller[_0x602d('0x14')]);router[_0x602d('0x15')]('/:id',auth[_0x602d('0x4')](),interaction['tracked'](_0x602d('0x13'),_0x602d('0x16')),controller[_0x602d('0x17')]);router[_0x602d('0x18')](_0x602d('0x9'),auth[_0x602d('0x4')](),interaction[_0x602d('0x12')]('mail','mailinteraction:destroy'),controller[_0x602d('0x19')]);router[_0x602d('0x18')](_0x602d('0x11'),auth[_0x602d('0x4')](),controller['removeTags']);module[_0x602d('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 f1c5198..7d5a219 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 _0x5e11=['out','sequelize','exports','BOOLEAN','DATE','STRING','TEXT','long','ENUM'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x5e11,0x1c3));var _0x15e1=function(_0x251e8c,_0x277c33){_0x251e8c=_0x251e8c-0x0;var _0x1e0c1d=_0x5e11[_0x251e8c];return _0x1e0c1d;};'use strict';var Sequelize=require(_0x15e1('0x0'));var iconv=require('iconv');module[_0x15e1('0x1')]={'closed':{'type':Sequelize[_0x15e1('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x15e1('0x3')]},'disposition':{'type':Sequelize[_0x15e1('0x4')]},'secondDisposition':{'type':Sequelize[_0x15e1('0x4')]},'thirdDisposition':{'type':Sequelize[_0x15e1('0x4')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x15e1('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x15e1('0x5')](_0x15e1('0x6'))},'subject':{'type':Sequelize[_0x15e1('0x5')]()},'attach':{'type':Sequelize[_0x15e1('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x15e1('0x3')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x15e1('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x15e1('0x7')]('in',_0x15e1('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x15e1('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x15e1('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x15e1('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xb56a=['iconv','exports','BOOLEAN','DATE','STRING','long','TEXT','ENUM','out'];(function(_0x611b57,_0x3cfdcf){var _0xef8d40=function(_0x1c183b){while(--_0x1c183b){_0x611b57['push'](_0x611b57['shift']());}};_0xef8d40(++_0x3cfdcf);}(_0xb56a,0xab));var _0xab56=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0xb56a[_0x1b6186];return _0x186121;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0xab56('0x0'));module[_0xab56('0x1')]={'closed':{'type':Sequelize[_0xab56('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xab56('0x3')]},'disposition':{'type':Sequelize[_0xab56('0x4')]},'secondDisposition':{'type':Sequelize[_0xab56('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xab56('0x4')]},'inReplyTo':{'type':Sequelize[_0xab56('0x4')](0x1fe)},'to':{'type':Sequelize[_0xab56('0x4')]},'cc':{'type':Sequelize['TEXT'](_0xab56('0x5'))},'subject':{'type':Sequelize[_0xab56('0x6')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xab56('0x3')]},'substatus':{'type':Sequelize[_0xab56('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xab56('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xab56('0x7')]('in',_0xab56('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xab56('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xab56('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xab56('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 01714eb..68bd7e2 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 _0xce3f=['download','unix','toString','join','root','server','files','tmp','attachments','Attachments','from','subject','createdAt','Messages','get','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','bcc','basename','existsSync','push','readFileSync','build','message%d.eml','unlinkSync','eml-format','rimraf','moment','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','html-entities','defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','end','name','send','index','map','fieldName','key','findAll','mail','user','catch','show','params','model','keys','MailInteraction','rawAttributes','query','filters','intersection','attributes','fields','length','include','options','find','create','body','describe','addMessage','MailMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','MailInteractionId','filter','merge','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','inlineCss','true','rows','addTags','setTags','spread','Tag','color','emit','mailInteractionTags:save','removeTags'];(function(_0x27c28c,_0x49ba23){var _0x1f5669=function(_0x257683){while(--_0x257683){_0x27c28c['push'](_0x27c28c['shift']());}};_0x1f5669(++_0x49ba23);}(_0xce3f,0x90));var _0xfce3=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xce3f[_0x2b10c6];return _0x3789d2;};'use strict';var emlformat=require(_0xfce3('0x0'));var rimraf=require(_0xfce3('0x1'));var zipdir=require('zip-dir');var moment=require(_0xfce3('0x2'));var BPromise=require('bluebird');var util=require(_0xfce3('0x3'));var path=require(_0xfce3('0x4'));var fs=require('fs');var _=require(_0xfce3('0x5'));var juice=require('juice');var Redis=require(_0xfce3('0x6'));var interaction=require(_0xfce3('0x7'));var qs=require(_0xfce3('0x8'));var logger=require('../../config/logger')(_0xfce3('0x9'));var config=require(_0xfce3('0xa'));var db=require(_0xfce3('0xb'))['db'];var htmlEntities=require(_0xfce3('0xc'));config['redis']=_[_0xfce3('0xd')](config[_0xfce3('0xe')],{'host':_0xfce3('0xf'),'port':0x18eb});var socket=require(_0xfce3('0x10'))(new Redis(config[_0xfce3('0xe')]));require(_0xfce3('0x11'))[_0xfce3('0x12')](socket);function respondWithStatusCode(_0x2e85bf,_0x5ce34b){_0x5ce34b=_0x5ce34b||0xcc;return function(_0x38ac03){if(_0x38ac03){return _0x2e85bf[_0xfce3('0x13')](_0x5ce34b);}return _0x2e85bf[_0xfce3('0x14')](_0x5ce34b)['end']();};}function respondWithResult(_0x39d3ee,_0x1146fa){_0x1146fa=_0x1146fa||0xc8;return function(_0x3d8adc){if(_0x3d8adc){return _0x39d3ee[_0xfce3('0x14')](_0x1146fa)[_0xfce3('0x15')](_0x3d8adc);}};}function respondWithFilteredResult(_0x141d29,_0x2e6583){return function(_0x40553c){if(_0x40553c){var _0x4cf4ea=typeof _0x2e6583[_0xfce3('0x16')]===_0xfce3('0x17')&&typeof _0x2e6583[_0xfce3('0x18')]===_0xfce3('0x17');var _0x37f3e2=_0x40553c[_0xfce3('0x19')];var _0x364315=_0x4cf4ea?0x0:_0x2e6583[_0xfce3('0x16')];var _0x27cac7=_0x4cf4ea?_0x40553c[_0xfce3('0x19')]:_0x2e6583['offset']+_0x2e6583[_0xfce3('0x18')];var _0x2598b9;if(_0x27cac7>=_0x37f3e2){_0x27cac7=_0x37f3e2;_0x2598b9=0xc8;}else{_0x2598b9=0xce;}_0x141d29['status'](_0x2598b9);return _0x141d29['set'](_0xfce3('0x1a'),_0x364315+'-'+_0x27cac7+'/'+_0x37f3e2)[_0xfce3('0x15')](_0x40553c);}return null;};}function saveUpdates(_0x1fca5d){return function(_0xd2696e){if(_0xd2696e){return _0xd2696e[_0xfce3('0x1b')](_0x1fca5d)[_0xfce3('0x1c')](function(_0x3d4c48){return _0x3d4c48;});}return null;};}function removeEntity(_0x12e3b5){return function(_0x340645){if(_0x340645){return _0x340645[_0xfce3('0x1d')]()[_0xfce3('0x1c')](function(){_0x12e3b5['status'](0xcc)[_0xfce3('0x1e')]();});}};}function handleEntityNotFound(_0x3dcc31){return function(_0x422a7a){if(!_0x422a7a){_0x3dcc31[_0xfce3('0x13')](0x194);}return _0x422a7a;};}function handleError(_0x53044d,_0x51d020){_0x51d020=_0x51d020||0x1f4;return function(_0x2ab570){logger['error'](_0x2ab570['stack']);if(_0x2ab570[_0xfce3('0x1f')]){delete _0x2ab570[_0xfce3('0x1f')];}_0x53044d[_0xfce3('0x14')](_0x51d020)[_0xfce3('0x20')](_0x2ab570);};}exports[_0xfce3('0x21')]=function(_0x27c48b,_0x529850){var _0x585daf={};var _0x59554b=_[_0xfce3('0x22')](db['MailInteraction']['rawAttributes'],function(_0x409b29){return{'name':_0x409b29[_0xfce3('0x23')],'type':_0x409b29['type'][_0xfce3('0x24')]};});_0x585daf=qs['getOptions'](_0x59554b,_0x27c48b);return interaction[_0xfce3('0x25')](_0xfce3('0x26'),_0x27c48b['query'],_0x27c48b[_0xfce3('0x27')],_0x585daf,_0x59554b)['then'](respondWithFilteredResult(_0x529850,_0x585daf))[_0xfce3('0x28')](handleError(_0x529850,null));};exports[_0xfce3('0x29')]=function(_0xf67a0a,_0x31cfa2){var _0x552015={'raw':![],'where':{'id':_0xf67a0a[_0xfce3('0x2a')]['id']}},_0xaca2ac={};_0xaca2ac[_0xfce3('0x2b')]=_[_0xfce3('0x2c')](db[_0xfce3('0x2d')][_0xfce3('0x2e')]);_0xaca2ac[_0xfce3('0x2f')]=_[_0xfce3('0x2c')](_0xf67a0a[_0xfce3('0x2f')]);_0xaca2ac[_0xfce3('0x30')]=_[_0xfce3('0x31')](_0xaca2ac[_0xfce3('0x2b')],_0xaca2ac[_0xfce3('0x2f')]);_0x552015[_0xfce3('0x32')]=_[_0xfce3('0x31')](_0xaca2ac[_0xfce3('0x2b')],qs[_0xfce3('0x33')](_0xf67a0a[_0xfce3('0x2f')][_0xfce3('0x33')]));_0x552015[_0xfce3('0x32')]=_0x552015[_0xfce3('0x32')][_0xfce3('0x34')]?_0x552015[_0xfce3('0x32')]:_0xaca2ac[_0xfce3('0x2b')];if(_0xf67a0a[_0xfce3('0x2f')]['includeAll']){_0x552015[_0xfce3('0x35')]=[{'all':!![]}];}_0x552015=_['merge']({},_0x552015,_0xf67a0a[_0xfce3('0x36')]);return db[_0xfce3('0x2d')][_0xfce3('0x37')](_0x552015)['then'](handleEntityNotFound(_0x31cfa2,null))[_0xfce3('0x1c')](respondWithResult(_0x31cfa2,null))['catch'](handleError(_0x31cfa2,null));};exports[_0xfce3('0x38')]=function(_0x3df8ac,_0x52dee3){return db[_0xfce3('0x2d')][_0xfce3('0x38')](_0x3df8ac[_0xfce3('0x39')],{})[_0xfce3('0x1c')](respondWithResult(_0x52dee3,0xc9))[_0xfce3('0x28')](handleError(_0x52dee3,null));};exports[_0xfce3('0x1b')]=function(_0x8e85e2,_0x534523){if(_0x8e85e2['body']['id']){delete _0x8e85e2[_0xfce3('0x39')]['id'];}return db[_0xfce3('0x2d')][_0xfce3('0x37')]({'where':{'id':_0x8e85e2[_0xfce3('0x2a')]['id']}})[_0xfce3('0x1c')](handleEntityNotFound(_0x534523,null))[_0xfce3('0x1c')](saveUpdates(_0x8e85e2[_0xfce3('0x39')],null))[_0xfce3('0x1c')](respondWithResult(_0x534523,null))[_0xfce3('0x28')](handleError(_0x534523,null));};exports['destroy']=function(_0x48e2ff,_0x116273){return db['MailInteraction'][_0xfce3('0x37')]({'where':{'id':_0x48e2ff[_0xfce3('0x2a')]['id']}})[_0xfce3('0x1c')](handleEntityNotFound(_0x116273,null))[_0xfce3('0x1c')](removeEntity(_0x116273,null))[_0xfce3('0x28')](handleError(_0x116273,null));};exports[_0xfce3('0x3a')]=function(_0x453b4a,_0x4f7aba){return db[_0xfce3('0x2d')]['describe']()[_0xfce3('0x1c')](respondWithResult(_0x4f7aba,null))[_0xfce3('0x28')](handleError(_0x4f7aba,null));};exports[_0xfce3('0x3b')]=function(_0x4285fc,_0x5aab32){return db[_0xfce3('0x3c')][_0xfce3('0x37')]({'where':{'id':_0x4285fc['params']['id']}})[_0xfce3('0x1c')](handleEntityNotFound(_0x5aab32,null))[_0xfce3('0x1c')](function(_0x5e94fe){if(_0x5e94fe){return _0x5e94fe['addMessage'](_0x4285fc[_0xfce3('0x39')][_0xfce3('0x3d')],_[_0xfce3('0x3e')](_0x4285fc['body'],[_0xfce3('0x3d'),'id'])||{});}})[_0xfce3('0x1c')](respondWithResult(_0x5aab32,null))['catch'](handleError(_0x5aab32,null));};exports[_0xfce3('0x3f')]=function(_0x1b7747,_0x3ce55d){var _0x409789={'raw':![],'where':{}};var _0x2c647e={};var _0x4c5238={'count':0x0,'rows':[]};return db[_0xfce3('0x2d')][_0xfce3('0x40')]({'where':{'id':_0x1b7747[_0xfce3('0x2a')]['id']}})[_0xfce3('0x1c')](handleEntityNotFound(_0x3ce55d,null))[_0xfce3('0x1c')](function(_0x650c06){if(_0x650c06){_0x2c647e[_0xfce3('0x2b')]=_[_0xfce3('0x2c')](db[_0xfce3('0x3c')][_0xfce3('0x2e')]);_0x2c647e[_0xfce3('0x2f')]=_[_0xfce3('0x2c')](_0x1b7747[_0xfce3('0x2f')]);_0x2c647e[_0xfce3('0x30')]=_['intersection'](_0x2c647e[_0xfce3('0x2b')],_0x2c647e[_0xfce3('0x2f')]);_0x409789['attributes']=_['intersection'](_0x2c647e[_0xfce3('0x2b')],qs[_0xfce3('0x33')](_0x1b7747[_0xfce3('0x2f')]['fields']));_0x409789['attributes']=_0x409789['attributes']['length']?_0x409789[_0xfce3('0x32')]:_0x2c647e[_0xfce3('0x2b')];if(!_0x1b7747['query'][_0xfce3('0x41')](_0xfce3('0x42'))){_0x409789[_0xfce3('0x18')]=qs[_0xfce3('0x18')](_0x1b7747[_0xfce3('0x2f')][_0xfce3('0x18')]);_0x409789[_0xfce3('0x16')]=qs[_0xfce3('0x16')](_0x1b7747[_0xfce3('0x2f')][_0xfce3('0x16')]);}_0x409789[_0xfce3('0x43')]=qs[_0xfce3('0x44')](_0x1b7747[_0xfce3('0x2f')][_0xfce3('0x44')]);_0x409789[_0xfce3('0x45')]=qs[_0xfce3('0x30')](_['pick'](_0x1b7747[_0xfce3('0x2f')],_0x2c647e['filters']));_0x409789[_0xfce3('0x45')][_0xfce3('0x46')]=_0x650c06['id'];if(_0x1b7747[_0xfce3('0x2f')][_0xfce3('0x47')]){_0x409789[_0xfce3('0x45')]=_[_0xfce3('0x48')](_0x409789[_0xfce3('0x45')],{'$or':_['map'](_0x409789[_0xfce3('0x32')],function(_0x27caf2){var _0x1f2ac6={};_0x1f2ac6[_0x27caf2]={'$like':'%'+_0x1b7747[_0xfce3('0x2f')]['filter']+'%'};return _0x1f2ac6;})});}if(_0x1b7747['query']['$gte']){var _0x13240a=_0x1b7747[_0xfce3('0x2f')][_0xfce3('0x49')]['split'](',');var _0x270c1f={};_0x270c1f[_0x13240a[0x0]]={'$gte':moment(_0x13240a[0x1])[_0xfce3('0x4a')](_0xfce3('0x4b'))};_0x409789[_0xfce3('0x45')]=_[_0xfce3('0x48')](_0x409789[_0xfce3('0x45')],_0x270c1f);}_0x409789=_['merge']({},_0x409789,_0x1b7747[_0xfce3('0x36')]);return db['MailMessage'][_0xfce3('0x19')]({'where':_0x409789['where']})[_0xfce3('0x1c')](function(_0x37168){_0x4c5238[_0xfce3('0x19')]=_0x37168;if(_0x1b7747[_0xfce3('0x2f')][_0xfce3('0x4c')]){_0x409789[_0xfce3('0x35')]=[{'all':!![]}];}return db[_0xfce3('0x3c')][_0xfce3('0x25')](_0x409789);})['then'](function(_0xd1a4a2){if(_0x1b7747[_0xfce3('0x2f')][_0xfce3('0x4d')]===_0xfce3('0x4e')){for(var _0x1429cd=0x0;_0x1429cd<_0xd1a4a2[_0xfce3('0x34')];_0x1429cd++){_0xd1a4a2[_0x1429cd]['body']=juice(_0xd1a4a2[_0x1429cd]['body']);}}_0x4c5238[_0xfce3('0x4f')]=_0xd1a4a2;return _0x4c5238;});}})['then'](respondWithFilteredResult(_0x3ce55d,_0x409789))[_0xfce3('0x28')](handleError(_0x3ce55d,null));};exports[_0xfce3('0x50')]=function(_0x2ef9d1,_0x43c9bd){return db[_0xfce3('0x2d')][_0xfce3('0x37')]({'where':{'id':_0x2ef9d1[_0xfce3('0x2a')]['id']}})[_0xfce3('0x1c')](handleEntityNotFound(_0x43c9bd,null))[_0xfce3('0x1c')](function(_0xfcf9c5){if(_0xfcf9c5){return _0xfcf9c5[_0xfce3('0x51')](_0x2ef9d1['body'][_0xfce3('0x3d')],_[_0xfce3('0x3e')](_0x2ef9d1[_0xfce3('0x39')],['ids','id'])||{})[_0xfce3('0x52')](function(){return db[_0xfce3('0x53')]['findAll']({'attributes':['id',_0xfce3('0x1f'),_0xfce3('0x54')],'where':{'id':_0x2ef9d1[_0xfce3('0x39')][_0xfce3('0x3d')]}});})[_0xfce3('0x1c')](function(_0x2a71c8){socket[_0xfce3('0x55')](_0xfce3('0x56'),{'id':Number(_0x2ef9d1[_0xfce3('0x2a')]['id']),'tags':_0x2a71c8||[]});return{'id':Number(_0x2ef9d1['params']['id']),'tags':_0x2a71c8||[]};});}})['then'](respondWithResult(_0x43c9bd,null))['catch'](handleError(_0x43c9bd,null));};exports[_0xfce3('0x57')]=function(_0x6a6c24,_0x3f6a7d){return db[_0xfce3('0x2d')][_0xfce3('0x37')]({'where':{'id':_0x6a6c24['params']['id']}})[_0xfce3('0x1c')](handleEntityNotFound(_0x3f6a7d,null))['then'](function(_0x2bbe39){if(_0x2bbe39){return _0x2bbe39[_0xfce3('0x57')](_0x6a6c24['query']['ids']);}})[_0xfce3('0x1c')](respondWithStatusCode(_0x3f6a7d,null))[_0xfce3('0x28')](handleError(_0x3f6a7d,null));};exports[_0xfce3('0x58')]=function(_0x1ff7ec,_0x793d2e){var _0x9cbc6d=moment()[_0xfce3('0x59')]()[_0xfce3('0x5a')]();var _0x333ce9=path[_0xfce3('0x5b')](config[_0xfce3('0x5c')],_0xfce3('0x5d'),_0xfce3('0x5e'),_0xfce3('0x5f'));var _0x51385d=path['join'](config[_0xfce3('0x5c')],_0xfce3('0x5d'),_0xfce3('0x5e'),'attachments');var _0x198f47=path[_0xfce3('0x5b')](_0x333ce9,_0x9cbc6d);var _0x43551e=util[_0xfce3('0x4a')]('transcript-%d-%s.zip',_0x1ff7ec[_0xfce3('0x2a')]['id'],_0x9cbc6d);var _0x4d647e=path[_0xfce3('0x5b')](_0x333ce9,_0x43551e);var _0x4e30af=[];if(_0x1ff7ec[_0xfce3('0x2f')][_0xfce3('0x60')]){_0x4e30af['push']({'model':db['Attachment'],'as':_0xfce3('0x61'),'raw':!![]});}var _0x376681=[{'model':db[_0xfce3('0x3c')],'as':'Messages','attributes':['id','body',_0xfce3('0x62'),'to','cc','bcc',_0xfce3('0x63'),_0xfce3('0x64')],'where':{'secret':![]},'order':qs[_0xfce3('0x44')]('id'),'include':_0x4e30af}];return db[_0xfce3('0x2d')]['find']({'where':{'id':_0x1ff7ec[_0xfce3('0x2a')]['id']},'include':_0x376681})[_0xfce3('0x1c')](handleEntityNotFound(_0x793d2e,null))[_0xfce3('0x1c')](function(_0x132290){if(_0x132290&&_0x132290[_0xfce3('0x65')]){var _0x540882=_0x132290[_0xfce3('0x66')]({'plain':!![]});fs['mkdirSync'](_0x198f47);return BPromise[_0xfce3('0x67')](_0x540882[_0xfce3('0x65')],function(_0xe55b69,_0x2b2d5c){var _0xdc2cb2={'from':_0xe55b69['from'],'to':_0xe55b69['to']||'missing.recipient@your.company.com','subject':_0xe55b69[_0xfce3('0x63')],'html':htmlEntities[_0xfce3('0x68')](_0xe55b69[_0xfce3('0x39')]),'headers':{'Date':moment(_0xe55b69[_0xfce3('0x64')])[_0xfce3('0x4a')](_0xfce3('0x69'))},'attachments':[]};if(_0xe55b69['cc']){_0xdc2cb2[_0xfce3('0x6a')]['Cc']=_0xe55b69['cc'];}if(_0xe55b69['bcc']){_0xdc2cb2[_0xfce3('0x6a')][_0xfce3('0x6b')]=_0xe55b69[_0xfce3('0x6c')];}return new BPromise(function(_0x299be0,_0x5978f9){if(_0xe55b69['Attachments']){for(var _0x20eefc=0x0;_0x20eefc<_0xe55b69[_0xfce3('0x61')][_0xfce3('0x34')];_0x20eefc++){var _0x147f1b=_0xe55b69['Attachments'][_0x20eefc];var _0x2f1dfe=path[_0xfce3('0x5b')](_0x51385d,_0x147f1b[_0xfce3('0x6d')]);if(fs[_0xfce3('0x6e')](_0x2f1dfe)){_0xdc2cb2[_0xfce3('0x60')][_0xfce3('0x6f')]({'name':_0x147f1b[_0xfce3('0x1f')],'contentType':_0x147f1b['type'],'data':fs[_0xfce3('0x70')](_0x2f1dfe)});}}}emlformat[_0xfce3('0x71')](_0xdc2cb2,function(_0x412c86,_0x5bfdeb){if(_0x412c86)return _0x5978f9(_0x412c86);fs['writeFileSync'](path[_0xfce3('0x5b')](_0x198f47,util[_0xfce3('0x4a')](_0xfce3('0x72'),_0x2b2d5c)),_0x5bfdeb);return _0x299be0(_0x5bfdeb);});});})[_0xfce3('0x1c')](function(){return new BPromise(function(_0x4303a5,_0x346e4a){zipdir(_0x198f47,{'saveTo':_0x4d647e},function(_0x7f49e4,_0x903d19){if(_0x7f49e4)return _0x346e4a(_0x7f49e4);return _0x4303a5(_0x903d19);});})[_0xfce3('0x1c')](function(){return new BPromise(function(_0x564895,_0x2733d8){rimraf(_0x198f47,function(_0x5e31bb){if(_0x5e31bb)_0x2733d8(_0x5e31bb);return _0x564895();});});})[_0xfce3('0x1c')](function(){return _0x793d2e['download'](_0x4d647e,_0x43551e,function(_0x5baccc){if(!_0x5baccc)fs[_0xfce3('0x73')](_0x4d647e);});});});}else{return _0x793d2e['sendStatus'](0xc8);}})[_0xfce3('0x28')](handleError(_0x793d2e,null));}; \ No newline at end of file +var _0x2f58=['addMessage','MailMessage','ids','omit','getMessages','sort','pick','MailInteractionId','where','filter','$gte','split','format','inlineCss','true','rows','addTags','setTags','spread','Tag','name','color','mailInteractionTags:save','removeTags','download','unix','toString','join','server','files','attachments','transcript-%d-%s.zip','push','Attachment','Attachments','Messages','from','bcc','subject','get','mkdirSync','each','missing.recipient@your.company.com','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','type','readFileSync','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','util','path','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','html-entities','redis','socket.io-emitter','./mailInteraction.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','update','then','error','send','index','map','MailInteraction','fieldName','getOptions','findAll','mail','query','user','catch','show','params','model','keys','rawAttributes','filters','intersection','attributes','fields','length','include','merge','options','find','create','body','destroy','describe'];(function(_0x32d7bb,_0x584089){var _0x4306c4=function(_0x5e820d){while(--_0x5e820d){_0x32d7bb['push'](_0x32d7bb['shift']());}};_0x4306c4(++_0x584089);}(_0x2f58,0x18c));var _0x82f5=function(_0x4337c6,_0x15a2bc){_0x4337c6=_0x4337c6-0x0;var _0x141f76=_0x2f58[_0x4337c6];return _0x141f76;};'use strict';var emlformat=require(_0x82f5('0x0'));var rimraf=require(_0x82f5('0x1'));var zipdir=require(_0x82f5('0x2'));var moment=require(_0x82f5('0x3'));var BPromise=require(_0x82f5('0x4'));var util=require(_0x82f5('0x5'));var path=require(_0x82f5('0x6'));var fs=require('fs');var _=require('lodash');var juice=require(_0x82f5('0x7'));var Redis=require(_0x82f5('0x8'));var interaction=require(_0x82f5('0x9'));var qs=require(_0x82f5('0xa'));var logger=require(_0x82f5('0xb'))('api');var config=require(_0x82f5('0xc'));var db=require(_0x82f5('0xd'))['db'];var htmlEntities=require(_0x82f5('0xe'));config[_0x82f5('0xf')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x82f5('0x10'))(new Redis(config['redis']));require(_0x82f5('0x11'))[_0x82f5('0x12')](socket);function respondWithStatusCode(_0x4dcff8,_0x40623c){_0x40623c=_0x40623c||0xcc;return function(_0x4b3510){if(_0x4b3510){return _0x4dcff8[_0x82f5('0x13')](_0x40623c);}return _0x4dcff8['status'](_0x40623c)[_0x82f5('0x14')]();};}function respondWithResult(_0x1e1d53,_0x3b84f3){_0x3b84f3=_0x3b84f3||0xc8;return function(_0x446e0b){if(_0x446e0b){return _0x1e1d53[_0x82f5('0x15')](_0x3b84f3)[_0x82f5('0x16')](_0x446e0b);}};}function respondWithFilteredResult(_0x495e53,_0xc43af4){return function(_0x2a3f55){if(_0x2a3f55){var _0x3bb823=typeof _0xc43af4[_0x82f5('0x17')]==='undefined'&&typeof _0xc43af4['limit']===_0x82f5('0x18');var _0x1f72ac=_0x2a3f55[_0x82f5('0x19')];var _0x23091f=_0x3bb823?0x0:_0xc43af4[_0x82f5('0x17')];var _0x393902=_0x3bb823?_0x2a3f55[_0x82f5('0x19')]:_0xc43af4[_0x82f5('0x17')]+_0xc43af4[_0x82f5('0x1a')];var _0x172c12;if(_0x393902>=_0x1f72ac){_0x393902=_0x1f72ac;_0x172c12=0xc8;}else{_0x172c12=0xce;}_0x495e53[_0x82f5('0x15')](_0x172c12);return _0x495e53['set'](_0x82f5('0x1b'),_0x23091f+'-'+_0x393902+'/'+_0x1f72ac)['json'](_0x2a3f55);}return null;};}function saveUpdates(_0x3a2fa7){return function(_0x5b7cf3){if(_0x5b7cf3){return _0x5b7cf3[_0x82f5('0x1c')](_0x3a2fa7)[_0x82f5('0x1d')](function(_0x12ff9d){return _0x12ff9d;});}return null;};}function removeEntity(_0x57ecfd){return function(_0x33167b){if(_0x33167b){return _0x33167b['destroy']()['then'](function(){_0x57ecfd['status'](0xcc)[_0x82f5('0x14')]();});}};}function handleEntityNotFound(_0x4707b3){return function(_0x5a312b){if(!_0x5a312b){_0x4707b3[_0x82f5('0x13')](0x194);}return _0x5a312b;};}function handleError(_0x136bcb,_0x3dd3e7){_0x3dd3e7=_0x3dd3e7||0x1f4;return function(_0x1f6da8){logger[_0x82f5('0x1e')](_0x1f6da8['stack']);if(_0x1f6da8['name']){delete _0x1f6da8['name'];}_0x136bcb[_0x82f5('0x15')](_0x3dd3e7)[_0x82f5('0x1f')](_0x1f6da8);};}exports[_0x82f5('0x20')]=function(_0x2cfc32,_0x6c365e){var _0x148947={};var _0x3a9cd1=_[_0x82f5('0x21')](db[_0x82f5('0x22')]['rawAttributes'],function(_0x945a77){return{'name':_0x945a77[_0x82f5('0x23')],'type':_0x945a77['type']['key']};});_0x148947=qs[_0x82f5('0x24')](_0x3a9cd1,_0x2cfc32);return interaction[_0x82f5('0x25')](_0x82f5('0x26'),_0x2cfc32[_0x82f5('0x27')],_0x2cfc32[_0x82f5('0x28')],_0x148947,_0x3a9cd1)[_0x82f5('0x1d')](respondWithFilteredResult(_0x6c365e,_0x148947))[_0x82f5('0x29')](handleError(_0x6c365e,null));};exports[_0x82f5('0x2a')]=function(_0x3b4a9e,_0x41c2f0){var _0x2e0d75={'raw':![],'where':{'id':_0x3b4a9e[_0x82f5('0x2b')]['id']}},_0x1d5da2={};_0x1d5da2[_0x82f5('0x2c')]=_[_0x82f5('0x2d')](db[_0x82f5('0x22')][_0x82f5('0x2e')]);_0x1d5da2[_0x82f5('0x27')]=_[_0x82f5('0x2d')](_0x3b4a9e[_0x82f5('0x27')]);_0x1d5da2[_0x82f5('0x2f')]=_[_0x82f5('0x30')](_0x1d5da2['model'],_0x1d5da2[_0x82f5('0x27')]);_0x2e0d75[_0x82f5('0x31')]=_[_0x82f5('0x30')](_0x1d5da2[_0x82f5('0x2c')],qs[_0x82f5('0x32')](_0x3b4a9e[_0x82f5('0x27')]['fields']));_0x2e0d75['attributes']=_0x2e0d75[_0x82f5('0x31')][_0x82f5('0x33')]?_0x2e0d75[_0x82f5('0x31')]:_0x1d5da2[_0x82f5('0x2c')];if(_0x3b4a9e[_0x82f5('0x27')]['includeAll']){_0x2e0d75[_0x82f5('0x34')]=[{'all':!![]}];}_0x2e0d75=_[_0x82f5('0x35')]({},_0x2e0d75,_0x3b4a9e[_0x82f5('0x36')]);return db[_0x82f5('0x22')][_0x82f5('0x37')](_0x2e0d75)[_0x82f5('0x1d')](handleEntityNotFound(_0x41c2f0,null))[_0x82f5('0x1d')](respondWithResult(_0x41c2f0,null))[_0x82f5('0x29')](handleError(_0x41c2f0,null));};exports[_0x82f5('0x38')]=function(_0xb90d07,_0x10ab8c){return db['MailInteraction']['create'](_0xb90d07[_0x82f5('0x39')],{})['then'](respondWithResult(_0x10ab8c,0xc9))['catch'](handleError(_0x10ab8c,null));};exports['update']=function(_0x513040,_0x15f62f){if(_0x513040['body']['id']){delete _0x513040[_0x82f5('0x39')]['id'];}return db[_0x82f5('0x22')][_0x82f5('0x37')]({'where':{'id':_0x513040[_0x82f5('0x2b')]['id']}})['then'](handleEntityNotFound(_0x15f62f,null))[_0x82f5('0x1d')](saveUpdates(_0x513040['body'],null))['then'](respondWithResult(_0x15f62f,null))[_0x82f5('0x29')](handleError(_0x15f62f,null));};exports[_0x82f5('0x3a')]=function(_0x3b0d2f,_0x5048e3){return db[_0x82f5('0x22')][_0x82f5('0x37')]({'where':{'id':_0x3b0d2f[_0x82f5('0x2b')]['id']}})[_0x82f5('0x1d')](handleEntityNotFound(_0x5048e3,null))[_0x82f5('0x1d')](removeEntity(_0x5048e3,null))[_0x82f5('0x29')](handleError(_0x5048e3,null));};exports['describe']=function(_0xaffba9,_0xf99d8a){return db['MailInteraction'][_0x82f5('0x3b')]()[_0x82f5('0x1d')](respondWithResult(_0xf99d8a,null))[_0x82f5('0x29')](handleError(_0xf99d8a,null));};exports[_0x82f5('0x3c')]=function(_0x2ef2c8,_0x12abc7){return db[_0x82f5('0x3d')][_0x82f5('0x37')]({'where':{'id':_0x2ef2c8[_0x82f5('0x2b')]['id']}})[_0x82f5('0x1d')](handleEntityNotFound(_0x12abc7,null))[_0x82f5('0x1d')](function(_0x243ab1){if(_0x243ab1){return _0x243ab1['addMessage'](_0x2ef2c8[_0x82f5('0x39')][_0x82f5('0x3e')],_[_0x82f5('0x3f')](_0x2ef2c8[_0x82f5('0x39')],[_0x82f5('0x3e'),'id'])||{});}})[_0x82f5('0x1d')](respondWithResult(_0x12abc7,null))[_0x82f5('0x29')](handleError(_0x12abc7,null));};exports[_0x82f5('0x40')]=function(_0x5433b8,_0xaea0a2){var _0x2c3628={'raw':![],'where':{}};var _0x3710c8={};var _0x3c114a={'count':0x0,'rows':[]};return db[_0x82f5('0x22')]['findOne']({'where':{'id':_0x5433b8[_0x82f5('0x2b')]['id']}})[_0x82f5('0x1d')](handleEntityNotFound(_0xaea0a2,null))[_0x82f5('0x1d')](function(_0x5cf2b6){if(_0x5cf2b6){_0x3710c8['model']=_['keys'](db['MailMessage']['rawAttributes']);_0x3710c8[_0x82f5('0x27')]=_[_0x82f5('0x2d')](_0x5433b8[_0x82f5('0x27')]);_0x3710c8[_0x82f5('0x2f')]=_[_0x82f5('0x30')](_0x3710c8['model'],_0x3710c8[_0x82f5('0x27')]);_0x2c3628[_0x82f5('0x31')]=_[_0x82f5('0x30')](_0x3710c8[_0x82f5('0x2c')],qs[_0x82f5('0x32')](_0x5433b8['query'][_0x82f5('0x32')]));_0x2c3628[_0x82f5('0x31')]=_0x2c3628[_0x82f5('0x31')][_0x82f5('0x33')]?_0x2c3628[_0x82f5('0x31')]:_0x3710c8[_0x82f5('0x2c')];if(!_0x5433b8[_0x82f5('0x27')]['hasOwnProperty']('nolimit')){_0x2c3628[_0x82f5('0x1a')]=qs[_0x82f5('0x1a')](_0x5433b8[_0x82f5('0x27')][_0x82f5('0x1a')]);_0x2c3628['offset']=qs[_0x82f5('0x17')](_0x5433b8['query'][_0x82f5('0x17')]);}_0x2c3628['order']=qs[_0x82f5('0x41')](_0x5433b8['query'][_0x82f5('0x41')]);_0x2c3628['where']=qs[_0x82f5('0x2f')](_[_0x82f5('0x42')](_0x5433b8[_0x82f5('0x27')],_0x3710c8['filters']));_0x2c3628['where'][_0x82f5('0x43')]=_0x5cf2b6['id'];if(_0x5433b8[_0x82f5('0x27')]['filter']){_0x2c3628[_0x82f5('0x44')]=_['merge'](_0x2c3628[_0x82f5('0x44')],{'$or':_[_0x82f5('0x21')](_0x2c3628[_0x82f5('0x31')],function(_0x244f9a){var _0x5848c3={};_0x5848c3[_0x244f9a]={'$like':'%'+_0x5433b8[_0x82f5('0x27')][_0x82f5('0x45')]+'%'};return _0x5848c3;})});}if(_0x5433b8[_0x82f5('0x27')]['$gte']){var _0x474160=_0x5433b8[_0x82f5('0x27')][_0x82f5('0x46')][_0x82f5('0x47')](',');var _0x2791d3={};_0x2791d3[_0x474160[0x0]]={'$gte':moment(_0x474160[0x1])[_0x82f5('0x48')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2c3628[_0x82f5('0x44')]=_[_0x82f5('0x35')](_0x2c3628['where'],_0x2791d3);}_0x2c3628=_[_0x82f5('0x35')]({},_0x2c3628,_0x5433b8[_0x82f5('0x36')]);return db['MailMessage']['count']({'where':_0x2c3628[_0x82f5('0x44')]})[_0x82f5('0x1d')](function(_0x4855a8){_0x3c114a[_0x82f5('0x19')]=_0x4855a8;if(_0x5433b8['query']['includeAll']){_0x2c3628[_0x82f5('0x34')]=[{'all':!![]}];}return db[_0x82f5('0x3d')][_0x82f5('0x25')](_0x2c3628);})[_0x82f5('0x1d')](function(_0x2956db){if(_0x5433b8[_0x82f5('0x27')][_0x82f5('0x49')]===_0x82f5('0x4a')){for(var _0x511b5f=0x0;_0x511b5f<_0x2956db[_0x82f5('0x33')];_0x511b5f++){_0x2956db[_0x511b5f][_0x82f5('0x39')]=juice(_0x2956db[_0x511b5f][_0x82f5('0x39')]);}}_0x3c114a[_0x82f5('0x4b')]=_0x2956db;return _0x3c114a;});}})[_0x82f5('0x1d')](respondWithFilteredResult(_0xaea0a2,_0x2c3628))[_0x82f5('0x29')](handleError(_0xaea0a2,null));};exports[_0x82f5('0x4c')]=function(_0x30d62c,_0x2e4654){return db[_0x82f5('0x22')][_0x82f5('0x37')]({'where':{'id':_0x30d62c[_0x82f5('0x2b')]['id']}})['then'](handleEntityNotFound(_0x2e4654,null))['then'](function(_0x3dade2){if(_0x3dade2){return _0x3dade2[_0x82f5('0x4d')](_0x30d62c[_0x82f5('0x39')][_0x82f5('0x3e')],_['omit'](_0x30d62c['body'],[_0x82f5('0x3e'),'id'])||{})[_0x82f5('0x4e')](function(){return db[_0x82f5('0x4f')][_0x82f5('0x25')]({'attributes':['id',_0x82f5('0x50'),_0x82f5('0x51')],'where':{'id':_0x30d62c[_0x82f5('0x39')][_0x82f5('0x3e')]}});})[_0x82f5('0x1d')](function(_0x208a55){socket['emit'](_0x82f5('0x52'),{'id':Number(_0x30d62c[_0x82f5('0x2b')]['id']),'tags':_0x208a55||[]});return{'id':Number(_0x30d62c['params']['id']),'tags':_0x208a55||[]};});}})[_0x82f5('0x1d')](respondWithResult(_0x2e4654,null))[_0x82f5('0x29')](handleError(_0x2e4654,null));};exports[_0x82f5('0x53')]=function(_0x46e8c8,_0x2b3719){return db['MailInteraction']['find']({'where':{'id':_0x46e8c8[_0x82f5('0x2b')]['id']}})[_0x82f5('0x1d')](handleEntityNotFound(_0x2b3719,null))[_0x82f5('0x1d')](function(_0x4ecbf1){if(_0x4ecbf1){return _0x4ecbf1[_0x82f5('0x53')](_0x46e8c8['query'][_0x82f5('0x3e')]);}})[_0x82f5('0x1d')](respondWithStatusCode(_0x2b3719,null))[_0x82f5('0x29')](handleError(_0x2b3719,null));};exports[_0x82f5('0x54')]=function(_0x11da0f,_0x2222e2){var _0xf0e8f1=moment()[_0x82f5('0x55')]()[_0x82f5('0x56')]();var _0x236a5f=path[_0x82f5('0x57')](config['root'],_0x82f5('0x58'),'files','tmp');var _0x58710c=path[_0x82f5('0x57')](config['root'],'server',_0x82f5('0x59'),_0x82f5('0x5a'));var _0x4ca563=path[_0x82f5('0x57')](_0x236a5f,_0xf0e8f1);var _0x2ba2de=util['format'](_0x82f5('0x5b'),_0x11da0f[_0x82f5('0x2b')]['id'],_0xf0e8f1);var _0xb160a6=path[_0x82f5('0x57')](_0x236a5f,_0x2ba2de);var _0x127829=[];if(_0x11da0f[_0x82f5('0x27')][_0x82f5('0x5a')]){_0x127829[_0x82f5('0x5c')]({'model':db[_0x82f5('0x5d')],'as':_0x82f5('0x5e'),'raw':!![]});}var _0x1df348=[{'model':db['MailMessage'],'as':_0x82f5('0x5f'),'attributes':['id','body',_0x82f5('0x60'),'to','cc',_0x82f5('0x61'),_0x82f5('0x62'),'createdAt'],'where':{'secret':![]},'order':qs[_0x82f5('0x41')]('id'),'include':_0x127829}];return db['MailInteraction'][_0x82f5('0x37')]({'where':{'id':_0x11da0f[_0x82f5('0x2b')]['id']},'include':_0x1df348})[_0x82f5('0x1d')](handleEntityNotFound(_0x2222e2,null))['then'](function(_0x567a71){if(_0x567a71&&_0x567a71['Messages']){var _0x159516=_0x567a71[_0x82f5('0x63')]({'plain':!![]});fs[_0x82f5('0x64')](_0x4ca563);return BPromise[_0x82f5('0x65')](_0x159516['Messages'],function(_0xbd4f9a,_0x5cb638){var _0x5bd744={'from':_0xbd4f9a[_0x82f5('0x60')],'to':_0xbd4f9a['to']||_0x82f5('0x66'),'subject':_0xbd4f9a[_0x82f5('0x62')],'html':htmlEntities['decode'](_0xbd4f9a[_0x82f5('0x39')]),'headers':{'Date':moment(_0xbd4f9a[_0x82f5('0x67')])[_0x82f5('0x48')](_0x82f5('0x68'))},'attachments':[]};if(_0xbd4f9a['cc']){_0x5bd744['headers']['Cc']=_0xbd4f9a['cc'];}if(_0xbd4f9a[_0x82f5('0x61')]){_0x5bd744[_0x82f5('0x69')][_0x82f5('0x6a')]=_0xbd4f9a['bcc'];}return new BPromise(function(_0x506f86,_0x1d75bb){if(_0xbd4f9a[_0x82f5('0x5e')]){for(var _0x282afa=0x0;_0x282afa<_0xbd4f9a[_0x82f5('0x5e')][_0x82f5('0x33')];_0x282afa++){var _0x39ec13=_0xbd4f9a[_0x82f5('0x5e')][_0x282afa];var _0x17bde9=path['join'](_0x58710c,_0x39ec13[_0x82f5('0x6b')]);if(fs[_0x82f5('0x6c')](_0x17bde9)){_0x5bd744[_0x82f5('0x5a')][_0x82f5('0x5c')]({'name':_0x39ec13['name'],'contentType':_0x39ec13[_0x82f5('0x6d')],'data':fs[_0x82f5('0x6e')](_0x17bde9)});}}}emlformat['build'](_0x5bd744,function(_0x45369d,_0x37bc1d){if(_0x45369d)return _0x1d75bb(_0x45369d);fs[_0x82f5('0x6f')](path[_0x82f5('0x57')](_0x4ca563,util[_0x82f5('0x48')](_0x82f5('0x70'),_0x5cb638)),_0x37bc1d);return _0x506f86(_0x37bc1d);});});})['then'](function(){return new BPromise(function(_0x7a0678,_0x258585){zipdir(_0x4ca563,{'saveTo':_0xb160a6},function(_0x446abb,_0x4f25ee){if(_0x446abb)return _0x258585(_0x446abb);return _0x7a0678(_0x4f25ee);});})[_0x82f5('0x1d')](function(){return new BPromise(function(_0x5d30a2,_0x2a482b){rimraf(_0x4ca563,function(_0x1000d2){if(_0x1000d2)_0x2a482b(_0x1000d2);return _0x5d30a2();});});})[_0x82f5('0x1d')](function(){return _0x2222e2[_0x82f5('0x54')](_0xb160a6,_0x2ba2de,function(_0x4a74a7){if(!_0x4a74a7)fs[_0x82f5('0x71')](_0xb160a6);});});});}else{return _0x2222e2['sendStatus'](0xc8);}})[_0x82f5('0x29')](handleError(_0x2222e2,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 575dd78..8878636 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 _0xf30a=['remove','getUsers','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','events','../../mysqldb','MailInteraction','MailMessage','save','update'];(function(_0x15e2b1,_0x52e621){var _0x4bc8a9=function(_0x22a5f1){while(--_0x22a5f1){_0x15e2b1['push'](_0x15e2b1['shift']());}};_0x4bc8a9(++_0x52e621);}(_0xf30a,0xca));var _0xaf30=function(_0x395b82,_0x4056e7){_0x395b82=_0x395b82-0x0;var _0x287641=_0xf30a[_0x395b82];return _0x287641;};'use strict';var EventEmitter=require(_0xaf30('0x0'));var MailInteraction=require(_0xaf30('0x1'))['db'][_0xaf30('0x2')];var MailMessage=require('../../mysqldb')['db'][_0xaf30('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xaf30('0x4'),'afterUpdate':_0xaf30('0x5'),'afterDestroy':_0xaf30('0x6')};function emitEvent(_0x4b5912){return function(_0x3886a7,_0x727497,_0x3e2ea8){_0x3886a7[_0xaf30('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x29a905){_0x3886a7[_0xaf30('0x8')](_0xaf30('0x9'),_0x29a905[_0xaf30('0xa')](function(_0x26d1e2){return{'id':_0x26d1e2['id']};}));return MailMessage[_0xaf30('0xb')]({'where':{'MailInteractionId':_0x3886a7['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x54f294){_0x3886a7[_0xaf30('0x8')](_0xaf30('0xc'),_0x54f294['length']);MailInteractionEvents[_0xaf30('0xd')](_0x4b5912+':'+_0x3886a7['id'],_0x3886a7);MailInteractionEvents['emit'](_0x4b5912,_0x3886a7);_0x3e2ea8(null);})[_0xaf30('0xe')](_0x3e2ea8(null));};}for(var e in events){if(events[_0xaf30('0xf')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0x00b7=['save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners'];(function(_0x24b54d,_0x2a8f0a){var _0x154920=function(_0x4b5691){while(--_0x4b5691){_0x24b54d['push'](_0x24b54d['shift']());}};_0x154920(++_0x2a8f0a);}(_0x00b7,0x160));var _0x700b=function(_0xf2cb98,_0x357688){_0xf2cb98=_0xf2cb98-0x0;var _0x5f0875=_0x00b7[_0xf2cb98];return _0x5f0875;};'use strict';var EventEmitter=require(_0x700b('0x0'));var MailInteraction=require(_0x700b('0x1'))['db'][_0x700b('0x2')];var MailMessage=require(_0x700b('0x1'))['db'][_0x700b('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x700b('0x4')](0x0);var events={'afterCreate':_0x700b('0x5'),'afterUpdate':_0x700b('0x6'),'afterDestroy':_0x700b('0x7')};function emitEvent(_0x2ee4cc){return function(_0x5687eb,_0x584021,_0x42c8b6){_0x5687eb[_0x700b('0x8')]({'attributes':['id'],'raw':!![]})[_0x700b('0x9')](function(_0x18312e){_0x5687eb[_0x700b('0xa')](_0x700b('0xb'),_0x18312e[_0x700b('0xc')](function(_0x43ec7d){return{'id':_0x43ec7d['id']};}));return MailMessage[_0x700b('0xd')]({'where':{'MailInteractionId':_0x5687eb['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2cf4e7){_0x5687eb[_0x700b('0xa')](_0x700b('0xe'),_0x2cf4e7[_0x700b('0xf')]);MailInteractionEvents[_0x700b('0x10')](_0x2ee4cc+':'+_0x5687eb['id'],_0x5687eb);MailInteractionEvents[_0x700b('0x10')](_0x2ee4cc,_0x5687eb);_0x42c8b6(null);})[_0x700b('0x11')](_0x42c8b6(null));};}for(var e in events){if(events[_0x700b('0x12')](e)){var event=events[e];MailInteraction[_0x700b('0x13')](e,emitEvent(event));}}module[_0x700b('0x14')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 5277e18..c48e491 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 _0x13fc=['models','get','MailMessage','update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatus'];(function(_0x424fad,_0x5c9338){var _0x2bf231=function(_0x2f3456){while(--_0x2f3456){_0x424fad['push'](_0x424fad['shift']());}};_0x2bf231(++_0x5c9338);}(_0x13fc,0x1e3));var _0xc13f=function(_0x580bc2,_0x57ce46){_0x580bc2=_0x580bc2-0x0;var _0x2f3a80=_0x13fc[_0x580bc2];return _0x2f3a80;};'use strict';var _=require(_0xc13f('0x0'));var util=require('util');var logger=require(_0xc13f('0x1'))(_0xc13f('0x2'));var moment=require(_0xc13f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc13f('0x4'));var config=require(_0xc13f('0x5'));var attributes=require(_0xc13f('0x6'));module[_0xc13f('0x7')]=function(_0x1ea3b8,_0x339ec2){return _0x1ea3b8[_0xc13f('0x8')](_0xc13f('0x9'),attributes,{'tableName':_0xc13f('0xa'),'paranoid':![],'indexes':[{'name':_0xc13f('0xb'),'fields':[_0xc13f('0xc'),'to'],'type':_0xc13f('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4d8449,_0x2f6bc2,_0x46ee18){if(_0x4d8449['substatus']){_0x4d8449[_0xc13f('0xe')]=moment()[_0xc13f('0xf')](_0xc13f('0x10'));}if(_0x4d8449[_0xc13f('0x11')]){_0x4d8449[_0xc13f('0x12')]=moment()[_0xc13f('0xf')](_0xc13f('0x10'));}_0x46ee18(null,_0x2f6bc2);},'beforeUpdate':function(_0x50e715,_0x7651ed,_0x1bb817){if(_0x50e715[_0xc13f('0x13')](_0xc13f('0x14'))){_0x50e715[_0xc13f('0xe')]=_0x50e715['substatus']?moment()['format'](_0xc13f('0x10')):null;}if(_0x50e715[_0xc13f('0x13')]('closed')){_0x50e715[_0xc13f('0x12')]=moment()[_0xc13f('0xf')](_0xc13f('0x10'));_0x50e715['substatus']=null;_0x50e715[_0xc13f('0xe')]=null;}_0x1bb817(null,_0x50e715);},'afterUpdate':function(_0x32be8f,_0x3f53f5,_0x124e3c){var _0x29497b=_0x1ea3b8[_0xc13f('0x15')];var _0x2e556e=_0x32be8f[_0xc13f('0x16')]({'plain':!![]});if(_0x2e556e[_0xc13f('0x11')]){return _0x29497b[_0xc13f('0x17')][_0xc13f('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x2e556e['id']}})['then'](function(){_0x124e3c();})[_0xc13f('0x19')](function(_0x1d15f3){_0x124e3c(_0x1d15f3);});}else{_0x124e3c();}}},'charset':_0xc13f('0x1a'),'collate':_0xc13f('0x1b')});}; \ No newline at end of file +var _0x1bb5=['format','closedAt','models','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','rimraf','../../config/environment','exports','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','YYYY-MM-DD\x20HH:mm:ss','closed','changed','substatusAt'];(function(_0xb55242,_0x5c0921){var _0x12bee3=function(_0x536757){while(--_0x536757){_0xb55242['push'](_0xb55242['shift']());}};_0x12bee3(++_0x5c0921);}(_0x1bb5,0x1d5));var _0x51bb=function(_0x14ea32,_0x262909){_0x14ea32=_0x14ea32-0x0;var _0x137bbb=_0x1bb5[_0x14ea32];return _0x137bbb;};'use strict';var _=require(_0x51bb('0x0'));var util=require(_0x51bb('0x1'));var logger=require(_0x51bb('0x2'))('api');var moment=require(_0x51bb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x51bb('0x4'));var config=require(_0x51bb('0x5'));var attributes=require('./mailInteraction.attributes');module[_0x51bb('0x6')]=function(_0xe4e14d,_0x576798){return _0xe4e14d['define'](_0x51bb('0x7'),attributes,{'tableName':_0x51bb('0x8'),'paranoid':![],'indexes':[{'name':_0x51bb('0x9'),'fields':[_0x51bb('0xa'),'to'],'type':_0x51bb('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2c8646,_0x4413f5,_0x4aa4b4){if(_0x2c8646[_0x51bb('0xc')]){_0x2c8646['substatusAt']=moment()['format'](_0x51bb('0xd'));}if(_0x2c8646[_0x51bb('0xe')]){_0x2c8646['closedAt']=moment()['format'](_0x51bb('0xd'));}_0x4aa4b4(null,_0x4413f5);},'beforeUpdate':function(_0xe51f11,_0x19f6b0,_0x246b61){if(_0xe51f11[_0x51bb('0xf')](_0x51bb('0xc'))){_0xe51f11[_0x51bb('0x10')]=_0xe51f11['substatus']?moment()[_0x51bb('0x11')](_0x51bb('0xd')):null;}if(_0xe51f11[_0x51bb('0xf')](_0x51bb('0xe'))){_0xe51f11[_0x51bb('0x12')]=moment()[_0x51bb('0x11')](_0x51bb('0xd'));_0xe51f11[_0x51bb('0xc')]=null;_0xe51f11[_0x51bb('0x10')]=null;}_0x246b61(null,_0xe51f11);},'afterUpdate':function(_0x6330e6,_0x3cd0e5,_0x108c68){var _0x61d415=_0xe4e14d[_0x51bb('0x13')];var _0x4345d4=_0x6330e6[_0x51bb('0x14')]({'plain':!![]});if(_0x4345d4[_0x51bb('0xe')]){return _0x61d415[_0x51bb('0x15')][_0x51bb('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x4345d4['id']}})[_0x51bb('0x17')](function(){_0x108c68();})[_0x51bb('0x18')](function(_0x13fc96){_0x108c68(_0x13fc96);});}else{_0x108c68();}}},'charset':_0x51bb('0x19'),'collate':_0x51bb('0x1a')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index d781209..e34df35 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 _0xa017=['omit','ids','AddTags','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','register','request','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','then','AddTagsToMailInteraction','find'];(function(_0x8dedf5,_0x185328){var _0x241a31=function(_0x58e7ee){while(--_0x58e7ee){_0x8dedf5['push'](_0x8dedf5['shift']());}};_0x241a31(++_0x185328);}(_0xa017,0x1f1));var _0x7a01=function(_0x440a1a,_0x13da9b){_0x440a1a=_0x440a1a-0x0;var _0x48e99c=_0xa017[_0x440a1a];return _0x48e99c;};'use strict';var _=require(_0x7a01('0x0'));var util=require(_0x7a01('0x1'));var moment=require(_0x7a01('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a01('0x3'));var db=require(_0x7a01('0x4'))['db'];var utils=require(_0x7a01('0x5'));var logger=require(_0x7a01('0x6'))(_0x7a01('0x7'));var config=require(_0x7a01('0x8'));var jayson=require(_0x7a01('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x7a01('0xa')]=_[_0x7a01('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7a01('0xa')]));require('./mailInteraction.socket')[_0x7a01('0xc')](socket);function respondWithRpcPromise(_0x36e3f5,_0x639e05,_0x355d50){return new BPromise(function(_0x1cedf4,_0x32a982){return client[_0x7a01('0xd')](_0x36e3f5,_0x355d50)['then'](function(_0x124e89){logger['info'](_0x7a01('0xe'),_0x639e05,_0x7a01('0xf'));logger[_0x7a01('0x10')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x639e05,_0x7a01('0xf'),JSON[_0x7a01('0x11')](_0x124e89));if(_0x124e89[_0x7a01('0x12')]){if(_0x124e89[_0x7a01('0x12')][_0x7a01('0x13')]===0x1f4){logger[_0x7a01('0x12')](_0x7a01('0xe'),_0x639e05,_0x124e89[_0x7a01('0x12')][_0x7a01('0x14')]);return _0x32a982(_0x124e89[_0x7a01('0x12')][_0x7a01('0x14')]);}logger[_0x7a01('0x12')]('MailInteraction,\x20%s,\x20%s',_0x639e05,_0x124e89['error']['message']);return _0x1cedf4(_0x124e89[_0x7a01('0x12')]['message']);}else{logger[_0x7a01('0x15')](_0x7a01('0xe'),_0x639e05,_0x7a01('0xf'));_0x1cedf4(_0x124e89['result'][_0x7a01('0x14')]);}})[_0x7a01('0x16')](function(_0x1f013c){logger['error'](_0x7a01('0xe'),_0x639e05,_0x1f013c);_0x32a982(_0x1f013c);});});}exports[_0x7a01('0x17')]=function(_0x3e1842){var _0x16a940=this;return new Promise(function(_0x16238f,_0xba4c92){return db[_0x7a01('0x18')][_0x7a01('0x19')](_0x3e1842[_0x7a01('0x1a')],{'raw':_0x3e1842[_0x7a01('0x1b')]?_0x3e1842[_0x7a01('0x1b')][_0x7a01('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e1842[_0x7a01('0x1b')]?_0x3e1842[_0x7a01('0x1b')][_0x7a01('0x1d')]||null:null,'attributes':_0x3e1842[_0x7a01('0x1b')]?_0x3e1842['options'][_0x7a01('0x1e')]||null:null,'limit':_0x3e1842['options']?_0x3e1842[_0x7a01('0x1b')][_0x7a01('0x1f')]||null:null})[_0x7a01('0x20')](function(_0x436087){logger['info'](_0x7a01('0x17'),_0x3e1842);logger[_0x7a01('0x10')](_0x7a01('0x17'),_0x3e1842,JSON[_0x7a01('0x11')](_0x436087));_0x16238f(_0x436087);})[_0x7a01('0x16')](function(_0xaef2d2){logger[_0x7a01('0x12')](_0x7a01('0x17'),_0xaef2d2[_0x7a01('0x14')],_0x3e1842);_0xba4c92(_0x16a940['error'](0x1f4,_0xaef2d2['message']));});});};exports[_0x7a01('0x21')]=function(_0x27f09b){return new Promise(function(_0x41ac3d,_0x3ba629){return db['MailInteraction'][_0x7a01('0x22')]({'where':_0x27f09b[_0x7a01('0x1b')]?_0x27f09b[_0x7a01('0x1b')][_0x7a01('0x1d')]||null:null})[_0x7a01('0x20')](function(_0x1f5767){if(_0x1f5767){return _0x1f5767['addTags'](_0x27f09b[_0x7a01('0x1a')]['ids'],_[_0x7a01('0x23')](_0x27f09b['body'],[_0x7a01('0x24'),'id'])||{});}})['spread'](function(_0x46c159){logger['info'](_0x7a01('0x25'),_0x27f09b);logger['debug']('AddTags',_0x27f09b,JSON[_0x7a01('0x11')](_0x46c159));_0x41ac3d(_0x46c159);})[_0x7a01('0x16')](function(_0x43652d){logger[_0x7a01('0x12')]('AddTags',_0x43652d[_0x7a01('0x14')],_0x27f09b);_0x3ba629(_this[_0x7a01('0x12')](0x1f4,_0x43652d[_0x7a01('0x14')]));});});}; \ No newline at end of file +var _0xa4f1=['UpdateMailInteraction','MailInteraction','body','options','raw','where','limit','stringify','AddTagsToMailInteraction','find','addTags','ids','omit','spread','AddTags','catch','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','MailInteraction,\x20%s,\x20%s','message','result'];(function(_0x3a85ab,_0x1f3525){var _0x32d91a=function(_0x216ab1){while(--_0x216ab1){_0x3a85ab['push'](_0x3a85ab['shift']());}};_0x32d91a(++_0x1f3525);}(_0xa4f1,0xe2));var _0x1a4f=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xa4f1[_0x1cc8fe];return _0x230054;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1a4f('0x0'));var BPromise=require(_0x1a4f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a4f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x1a4f('0x3'));var logger=require(_0x1a4f('0x4'))(_0x1a4f('0x5'));var config=require(_0x1a4f('0x6'));var jayson=require(_0x1a4f('0x7'));var client=jayson[_0x1a4f('0x8')][_0x1a4f('0x9')]({'port':0x232a});config[_0x1a4f('0xa')]=_[_0x1a4f('0xb')](config[_0x1a4f('0xa')],{'host':_0x1a4f('0xc'),'port':0x18eb});var socket=require(_0x1a4f('0xd'))(new Redis(config[_0x1a4f('0xa')]));require(_0x1a4f('0xe'))[_0x1a4f('0xf')](socket);function respondWithRpcPromise(_0x19e14c,_0x5bb4c8,_0x13eefc){return new BPromise(function(_0x14ebf7,_0x20c269){return client[_0x1a4f('0x10')](_0x19e14c,_0x13eefc)[_0x1a4f('0x11')](function(_0x4903f5){logger[_0x1a4f('0x12')]('MailInteraction,\x20%s,\x20%s',_0x5bb4c8,_0x1a4f('0x13'));logger[_0x1a4f('0x14')](_0x1a4f('0x15'),_0x5bb4c8,_0x1a4f('0x13'),JSON['stringify'](_0x4903f5));if(_0x4903f5[_0x1a4f('0x16')]){if(_0x4903f5['error']['code']===0x1f4){logger[_0x1a4f('0x16')](_0x1a4f('0x17'),_0x5bb4c8,_0x4903f5['error'][_0x1a4f('0x18')]);return _0x20c269(_0x4903f5[_0x1a4f('0x16')]['message']);}logger[_0x1a4f('0x16')]('MailInteraction,\x20%s,\x20%s',_0x5bb4c8,_0x4903f5[_0x1a4f('0x16')][_0x1a4f('0x18')]);return _0x14ebf7(_0x4903f5['error'][_0x1a4f('0x18')]);}else{logger[_0x1a4f('0x12')](_0x1a4f('0x17'),_0x5bb4c8,_0x1a4f('0x13'));_0x14ebf7(_0x4903f5[_0x1a4f('0x19')][_0x1a4f('0x18')]);}})['catch'](function(_0x3c1a37){logger[_0x1a4f('0x16')](_0x1a4f('0x17'),_0x5bb4c8,_0x3c1a37);_0x20c269(_0x3c1a37);});});}exports[_0x1a4f('0x1a')]=function(_0x5d56d9){var _0x157331=this;return new Promise(function(_0x49ede7,_0x5139f8){return db[_0x1a4f('0x1b')]['update'](_0x5d56d9[_0x1a4f('0x1c')],{'raw':_0x5d56d9['options']?_0x5d56d9[_0x1a4f('0x1d')][_0x1a4f('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d56d9[_0x1a4f('0x1d')]?_0x5d56d9[_0x1a4f('0x1d')][_0x1a4f('0x1f')]||null:null,'attributes':_0x5d56d9[_0x1a4f('0x1d')]?_0x5d56d9[_0x1a4f('0x1d')]['attributes']||null:null,'limit':_0x5d56d9[_0x1a4f('0x1d')]?_0x5d56d9['options'][_0x1a4f('0x20')]||null:null})[_0x1a4f('0x11')](function(_0x5dd6ea){logger[_0x1a4f('0x12')](_0x1a4f('0x1a'),_0x5d56d9);logger[_0x1a4f('0x14')](_0x1a4f('0x1a'),_0x5d56d9,JSON[_0x1a4f('0x21')](_0x5dd6ea));_0x49ede7(_0x5dd6ea);})['catch'](function(_0xa87574){logger['error'](_0x1a4f('0x1a'),_0xa87574[_0x1a4f('0x18')],_0x5d56d9);_0x5139f8(_0x157331[_0x1a4f('0x16')](0x1f4,_0xa87574[_0x1a4f('0x18')]));});});};exports[_0x1a4f('0x22')]=function(_0x5cad18){return new Promise(function(_0x3c5d7e,_0x134b6d){return db[_0x1a4f('0x1b')][_0x1a4f('0x23')]({'where':_0x5cad18[_0x1a4f('0x1d')]?_0x5cad18['options'][_0x1a4f('0x1f')]||null:null})[_0x1a4f('0x11')](function(_0x1df284){if(_0x1df284){return _0x1df284[_0x1a4f('0x24')](_0x5cad18[_0x1a4f('0x1c')][_0x1a4f('0x25')],_[_0x1a4f('0x26')](_0x5cad18['body'],[_0x1a4f('0x25'),'id'])||{});}})[_0x1a4f('0x27')](function(_0x1d4322){logger['info'](_0x1a4f('0x28'),_0x5cad18);logger[_0x1a4f('0x14')](_0x1a4f('0x28'),_0x5cad18,JSON[_0x1a4f('0x21')](_0x1d4322));_0x3c5d7e(_0x1d4322);})[_0x1a4f('0x29')](function(_0xc677f7){logger['error'](_0x1a4f('0x28'),_0xc677f7[_0x1a4f('0x18')],_0x5cad18);_0x134b6d(_this[_0x1a4f('0x16')](0x1f4,_0xc677f7[_0x1a4f('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 1c5a3f4..1452fc3 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 _0x62b6=['mailInteraction:','./mailInteraction.events','save','remove','update','emit','removeListener','length'];(function(_0x661ef6,_0x446ff1){var _0x296630=function(_0x164c8a){while(--_0x164c8a){_0x661ef6['push'](_0x661ef6['shift']());}};_0x296630(++_0x446ff1);}(_0x62b6,0x101));var _0x662b=function(_0x2f99ba,_0xd36c30){_0x2f99ba=_0x2f99ba-0x0;var _0x2a1feb=_0x62b6[_0x2f99ba];return _0x2a1feb;};'use strict';var MailInteractionEvents=require(_0x662b('0x0'));var events=[_0x662b('0x1'),_0x662b('0x2'),_0x662b('0x3')];function createListener(_0x89b06d,_0x406902){return function(_0x24c9f2){_0x406902[_0x662b('0x4')](_0x89b06d,_0x24c9f2);};}function removeListener(_0x43cca2,_0x4b3f5e){return function(){MailInteractionEvents[_0x662b('0x5')](_0x43cca2,_0x4b3f5e);};}exports['register']=function(_0x46a3e9){for(var _0x64a677=0x0,_0x5c7272=events[_0x662b('0x6')];_0x64a677<_0x5c7272;_0x64a677++){var _0x2e01c8=events[_0x64a677];var _0xdd0e79=createListener(_0x662b('0x7')+_0x2e01c8,_0x46a3e9);MailInteractionEvents['on'](_0x2e01c8,_0xdd0e79);}}; \ No newline at end of file +var _0xebba=['emit','removeListener','register','save','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xebba,0xb2));var _0xaebb=function(_0x502fa2,_0x14eac7){_0x502fa2=_0x502fa2-0x0;var _0x1e6d3c=_0xebba[_0x502fa2];return _0x1e6d3c;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0xaebb('0x0'),'remove',_0xaebb('0x1')];function createListener(_0xb94386,_0x36b6cd){return function(_0x5838e4){_0x36b6cd[_0xaebb('0x2')](_0xb94386,_0x5838e4);};}function removeListener(_0x64de9a,_0x54e457){return function(){MailInteractionEvents[_0xaebb('0x3')](_0x64de9a,_0x54e457);};}exports[_0xaebb('0x4')]=function(_0x53b9e8){for(var _0x4142df=0x0,_0x439cfb=events['length'];_0x4142df<_0x439cfb;_0x4142df++){var _0x592737=events[_0x4142df];var _0x502736=createListener('mailInteraction:'+_0x592737,_0x53b9e8);MailInteractionEvents['on'](_0x592737,_0x502736);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 949df7b..38c4b1b 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 _0xc94f=['put','accept','/:id/reject','delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','/describe','describe','/:id','isAuthenticated','show','download','post','tracked','mail','mailmessage:create','update'];(function(_0x38ba16,_0x287888){var _0x4afc59=function(_0x1a6663){while(--_0x1a6663){_0x38ba16['push'](_0x38ba16['shift']());}};_0x4afc59(++_0x287888);}(_0xc94f,0xcd));var _0xfc94=function(_0x392e94,_0x38d1bb){_0x392e94=_0x392e94-0x0;var _0x156f8d=_0xc94f[_0x392e94];return _0x156f8d;};'use strict';var multer=require(_0xfc94('0x0'));var util=require('util');var path=require(_0xfc94('0x1'));var timeout=require(_0xfc94('0x2'));var express=require('express');var router=express[_0xfc94('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xfc94('0x4'));var interaction=require(_0xfc94('0x5'));var config=require(_0xfc94('0x6'));var controller=require(_0xfc94('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xfc94('0x8')](_0xfc94('0x9'),auth['isAuthenticated'](),controller[_0xfc94('0xa')]);router['get'](_0xfc94('0xb'),auth[_0xfc94('0xc')](),controller[_0xfc94('0xd')]);router[_0xfc94('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0xfc94('0xe')]);router[_0xfc94('0xf')]('/',auth[_0xfc94('0xc')](),interaction[_0xfc94('0x10')](_0xfc94('0x11'),_0xfc94('0x12')),controller['create']);router['put'](_0xfc94('0xb'),auth[_0xfc94('0xc')](),controller[_0xfc94('0x13')]);router[_0xfc94('0x14')]('/:id/accept',auth[_0xfc94('0xc')](),controller[_0xfc94('0x15')]);router[_0xfc94('0x14')](_0xfc94('0x16'),auth[_0xfc94('0xc')](),controller['reject']);router[_0xfc94('0x17')]('/:id',auth[_0xfc94('0xc')](),controller['destroy']);module[_0xfc94('0x18')]=router; \ No newline at end of file +var _0x336d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','index','get','/describe','describe','/:id','isAuthenticated','show','/:id/download','download','post','mail','mailmessage:create','create','put','update','/:id/accept','reject','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x457200,_0x25a3bb){var _0x137bce=function(_0x1891d0){while(--_0x1891d0){_0x457200['push'](_0x457200['shift']());}};_0x137bce(++_0x25a3bb);}(_0x336d,0xae));var _0xd336=function(_0x215d65,_0x164493){_0x215d65=_0x215d65-0x0;var _0x17c2c4=_0x336d[_0x215d65];return _0x17c2c4;};'use strict';var multer=require('multer');var util=require(_0xd336('0x0'));var path=require(_0xd336('0x1'));var timeout=require(_0xd336('0x2'));var express=require(_0xd336('0x3'));var router=express[_0xd336('0x4')]();var fs_extra=require(_0xd336('0x5'));var auth=require(_0xd336('0x6'));var interaction=require(_0xd336('0x7'));var config=require(_0xd336('0x8'));var controller=require(_0xd336('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xd336('0xa')]);router[_0xd336('0xb')](_0xd336('0xc'),auth['isAuthenticated'](),controller[_0xd336('0xd')]);router[_0xd336('0xb')](_0xd336('0xe'),auth[_0xd336('0xf')](),controller[_0xd336('0x10')]);router[_0xd336('0xb')](_0xd336('0x11'),auth[_0xd336('0xf')](),controller[_0xd336('0x12')]);router[_0xd336('0x13')]('/',auth['isAuthenticated'](),interaction['tracked'](_0xd336('0x14'),_0xd336('0x15')),controller[_0xd336('0x16')]);router[_0xd336('0x17')](_0xd336('0xe'),auth[_0xd336('0xf')](),controller[_0xd336('0x18')]);router[_0xd336('0x17')](_0xd336('0x19'),auth[_0xd336('0xf')](),controller['accept']);router[_0xd336('0x17')]('/:id/reject',auth[_0xd336('0xf')](),controller[_0xd336('0x1a')]);router[_0xd336('0x1b')](_0xd336('0xe'),auth[_0xd336('0xf')](),controller[_0xd336('0x1c')]);module[_0xd336('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 6901dbf..90c826d 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 _0xfda2=['ENUM','out','STRING','DATE','INTEGER','Email','Chat','sequelize','lodash','TEXT','long','medium','BOOLEAN'];(function(_0x19c14b,_0x86c434){var _0x26f08b=function(_0xa5b40c){while(--_0xa5b40c){_0x19c14b['push'](_0x19c14b['shift']());}};_0x26f08b(++_0x86c434);}(_0xfda2,0x1ce));var _0x2fda=function(_0x3099a9,_0x36b45e){_0x3099a9=_0x3099a9-0x0;var _0x1f07c4=_0xfda2[_0x3099a9];return _0x1f07c4;};'use strict';var Sequelize=require(_0x2fda('0x0'));var _=require(_0x2fda('0x1'));module['exports']={'body':{'type':Sequelize[_0x2fda('0x2')](_0x2fda('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x2fda('0x4'))},'read':{'type':Sequelize[_0x2fda('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2fda('0x6')]('in',_0x2fda('0x7')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x2fda('0x8')](0x1fe)},'from':{'type':Sequelize[_0x2fda('0x8')]},'to':{'type':Sequelize['TEXT']('long')},'cc':{'type':Sequelize[_0x2fda('0x2')](_0x2fda('0x3'))},'bcc':{'type':Sequelize[_0x2fda('0x2')](_0x2fda('0x3'))},'subject':{'type':Sequelize[_0x2fda('0x2')]},'sentAt':{'type':Sequelize[_0x2fda('0x9')]},'attach':{'type':Sequelize[_0x2fda('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x2fda('0x9')]},'originTo':{'type':Sequelize['TEXT']('long')},'originCc':{'type':Sequelize[_0x2fda('0x2')](_0x2fda('0x3'))},'originChannel':{'type':Sequelize['ENUM'](_0x2fda('0xb'),_0x2fda('0xc')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0x2a5c=['DATE','ENUM','Email','Chat','sequelize','exports','long','medium','BOOLEAN','out','TEXT'];(function(_0x4767fb,_0x3842f7){var _0x3f9248=function(_0xb57694){while(--_0xb57694){_0x4767fb['push'](_0x4767fb['shift']());}};_0x3f9248(++_0x3842f7);}(_0x2a5c,0x16f));var _0xc2a5=function(_0x206b2c,_0xa4bcf9){_0x206b2c=_0x206b2c-0x0;var _0x239c40=_0x2a5c[_0x206b2c];return _0x239c40;};'use strict';var Sequelize=require(_0xc2a5('0x0'));var _=require('lodash');module[_0xc2a5('0x1')]={'body':{'type':Sequelize['TEXT'](_0xc2a5('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0xc2a5('0x3'))},'read':{'type':Sequelize[_0xc2a5('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xc2a5('0x5')),'defaultValue':_0xc2a5('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xc2a5('0x6')](_0xc2a5('0x2'))},'cc':{'type':Sequelize[_0xc2a5('0x6')](_0xc2a5('0x2'))},'bcc':{'type':Sequelize[_0xc2a5('0x6')](_0xc2a5('0x2'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0xc2a5('0x7')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xc2a5('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0xc2a5('0x6')]('long')},'originCc':{'type':Sequelize[_0xc2a5('0x6')]('long')},'originChannel':{'type':Sequelize[_0xc2a5('0x8')](_0xc2a5('0x9'),_0xc2a5('0xa')),'defaultValue':_0xc2a5('0x9'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 094ed98..e8b871a 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 _0x837e=['defaults','ListId','List\x20not\x20found','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','user','agent','UserId','get','MailInteraction','isNil','read1stAt','interaction','info','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','manual','channel','motionChannel','fromString','EventManager','acceptmessage','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','email','internal','interface','event','reject','rejectmessage','toString','files','tmp','server','message-%s.eml','from','subject','createdAt','Attachment','Attachments','decode','headers','Bcc','push','readFileSync','build','writeFileSync','download','eml-format','moment','bluebird','util','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','localhost','register','jayson/promise','client','http','request','then','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','stack','name','send','index','map','MailMessage','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','show','params','rawAttributes','find','body','describe','direction','out','secret','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','create'];(function(_0xd9e175,_0x3ef2b5){var _0x1d8db4=function(_0x12f07d){while(--_0x12f07d){_0xd9e175['push'](_0xd9e175['shift']());}};_0x1d8db4(++_0x3ef2b5);}(_0x837e,0xe6));var _0xe837=function(_0x468e26,_0x2a7b4c){_0x468e26=_0x468e26-0x0;var _0x364518=_0x837e[_0x468e26];return _0x364518;};'use strict';var emlformat=require(_0xe837('0x0'));var moment=require(_0xe837('0x1'));var BPromise=require(_0xe837('0x2'));var util=require(_0xe837('0x3'));var path=require('path');var fs=require('fs');var _=require(_0xe837('0x4'));var Redis=require(_0xe837('0x5'));var htmlToText=require(_0xe837('0x6'));var qs=require(_0xe837('0x7'));var logger=require(_0xe837('0x8'))(_0xe837('0x9'));var interaction_log=require(_0xe837('0x8'))(_0xe837('0xa'));var config=require(_0xe837('0xb'));var db=require(_0xe837('0xc'))['db'];config['redis']=_['defaults'](config[_0xe837('0xd')],{'host':_0xe837('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe837('0xd')]));var htmlEntities=require('html-entities');require('./mailMessage.socket')[_0xe837('0xf')](socket);var jayson=require(_0xe837('0x10'));var client=jayson[_0xe837('0x11')][_0xe837('0x12')]({'port':0x232c});var client9003=jayson['client']['http']({'port':0x232b});var client9002=jayson[_0xe837('0x11')][_0xe837('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x355ad7,_0x1aa39d,_0x5dc607,_0x4cc7a1){return new BPromise(function(_0x287973,_0x3ab03c){var _0x52536b=_0x4cc7a1||client;return _0x52536b[_0xe837('0x13')](_0x355ad7,_0x5dc607)[_0xe837('0x14')](function(_0x6793e1){logger['info']('MailMessage,\x20%s,\x20%s',_0x1aa39d,_0xe837('0x15'));logger[_0xe837('0x16')](_0xe837('0x17'),_0x1aa39d,_0xe837('0x15'),JSON[_0xe837('0x18')](_0x6793e1));if(_0x6793e1[_0xe837('0x19')]){if(_0x6793e1[_0xe837('0x19')][_0xe837('0x1a')]===0x1f4){logger['error'](_0xe837('0x1b'),_0x1aa39d,_0x6793e1[_0xe837('0x19')][_0xe837('0x1c')]);return _0x3ab03c(_0x6793e1[_0xe837('0x19')]['message']);}logger[_0xe837('0x19')](_0xe837('0x1b'),_0x1aa39d,_0x6793e1[_0xe837('0x19')][_0xe837('0x1c')]);return _0x287973(_0x6793e1['error'][_0xe837('0x1c')]);}else{logger['info'](_0xe837('0x1b'),_0x1aa39d,_0xe837('0x15'));_0x287973(_0x6793e1[_0xe837('0x1d')][_0xe837('0x1c')]);}})[_0xe837('0x1e')](function(_0x5a4a69){logger[_0xe837('0x19')]('MailMessage,\x20%s,\x20%s',_0x1aa39d,_0x5a4a69);_0x3ab03c(_0x5a4a69);});});}function respondWithResult(_0x509890,_0x5de255){_0x5de255=_0x5de255||0xc8;return function(_0x5d70e7){if(_0x5d70e7){return _0x509890[_0xe837('0x1f')](_0x5de255)[_0xe837('0x20')](_0x5d70e7);}};}function respondWithFilteredResult(_0xee1a2e,_0x29d37){return function(_0xe31b02){if(_0xe31b02){var _0x5d59f9=typeof _0x29d37[_0xe837('0x21')]===_0xe837('0x22')&&typeof _0x29d37[_0xe837('0x23')]===_0xe837('0x22');var _0x1b46c1=_0xe31b02[_0xe837('0x24')];var _0x31d35e=_0x5d59f9?0x0:_0x29d37[_0xe837('0x21')];var _0x240c20=_0x5d59f9?_0xe31b02['count']:_0x29d37[_0xe837('0x21')]+_0x29d37['limit'];var _0x3e6586;if(_0x240c20>=_0x1b46c1){_0x240c20=_0x1b46c1;_0x3e6586=0xc8;}else{_0x3e6586=0xce;}_0xee1a2e[_0xe837('0x1f')](_0x3e6586);return _0xee1a2e[_0xe837('0x25')](_0xe837('0x26'),_0x31d35e+'-'+_0x240c20+'/'+_0x1b46c1)[_0xe837('0x20')](_0xe31b02);}return null;};}function saveUpdates(_0x3a8460){return function(_0x590614){if(_0x590614){return _0x590614[_0xe837('0x27')](_0x3a8460)[_0xe837('0x14')](function(_0x21eb44){return _0x21eb44;});}return null;};}function removeEntity(_0x18c8bc){return function(_0x3ff3c7){if(_0x3ff3c7){return _0x3ff3c7[_0xe837('0x28')]()['then'](function(){_0x18c8bc[_0xe837('0x1f')](0xcc)[_0xe837('0x29')]();});}};}function handleEntityNotFound(_0x5bd981){return function(_0x2e9258){if(!_0x2e9258){_0x5bd981['sendStatus'](0x194);}return _0x2e9258;};}function handleError(_0x2ee89b,_0x4a9024){_0x4a9024=_0x4a9024||0x1f4;return function(_0x5e889e){logger[_0xe837('0x19')](_0x5e889e[_0xe837('0x2a')]);if(_0x5e889e[_0xe837('0x2b')]){delete _0x5e889e[_0xe837('0x2b')];}_0x2ee89b[_0xe837('0x1f')](_0x4a9024)[_0xe837('0x2c')](_0x5e889e);};}exports[_0xe837('0x2d')]=function(_0x1fa3b8,_0x54f7c7){var _0x2dff52={},_0x4b6733={},_0x568030={'count':0x0,'rows':[]};var _0x516538=_[_0xe837('0x2e')](db[_0xe837('0x2f')]['rawAttributes'],function(_0x4c3a23){return{'name':_0x4c3a23[_0xe837('0x30')],'type':_0x4c3a23['type'][_0xe837('0x31')]};});_0x4b6733[_0xe837('0x32')]=_[_0xe837('0x2e')](_0x516538,_0xe837('0x2b'));_0x4b6733[_0xe837('0x33')]=_[_0xe837('0x34')](_0x1fa3b8[_0xe837('0x33')]);_0x4b6733[_0xe837('0x35')]=_['intersection'](_0x4b6733[_0xe837('0x32')],_0x4b6733[_0xe837('0x33')]);_0x2dff52[_0xe837('0x36')]=_[_0xe837('0x37')](_0x4b6733['model'],qs[_0xe837('0x38')](_0x1fa3b8[_0xe837('0x33')][_0xe837('0x38')]));_0x2dff52['attributes']=_0x2dff52['attributes'][_0xe837('0x39')]?_0x2dff52[_0xe837('0x36')]:_0x4b6733['model'];if(!_0x1fa3b8[_0xe837('0x33')]['hasOwnProperty'](_0xe837('0x3a'))){_0x2dff52[_0xe837('0x23')]=qs[_0xe837('0x23')](_0x1fa3b8[_0xe837('0x33')][_0xe837('0x23')]);_0x2dff52[_0xe837('0x21')]=qs['offset'](_0x1fa3b8[_0xe837('0x33')]['offset']);}_0x2dff52[_0xe837('0x3b')]=qs[_0xe837('0x3c')](_0x1fa3b8[_0xe837('0x33')][_0xe837('0x3c')]);_0x2dff52[_0xe837('0x3d')]=qs[_0xe837('0x35')](_[_0xe837('0x3e')](_0x1fa3b8['query'],_0x4b6733[_0xe837('0x35')]),_0x516538);if(_0x1fa3b8[_0xe837('0x33')]['filter']){_0x2dff52[_0xe837('0x3d')]=_[_0xe837('0x3f')](_0x2dff52[_0xe837('0x3d')],{'$or':_['map'](_0x516538,function(_0x10bbe0){if(_0x10bbe0[_0xe837('0x40')]!==_0xe837('0x41')){var _0x514215={};_0x514215[_0x10bbe0[_0xe837('0x2b')]]={'$like':'%'+_0x1fa3b8[_0xe837('0x33')][_0xe837('0x42')]+'%'};return _0x514215;}})});}_0x2dff52=_[_0xe837('0x3f')]({},_0x2dff52,_0x1fa3b8[_0xe837('0x43')]);var _0x10bf31={'where':_0x2dff52[_0xe837('0x3d')]};return db['MailMessage'][_0xe837('0x24')](_0x10bf31)[_0xe837('0x14')](function(_0x4e62e7){_0x568030[_0xe837('0x24')]=_0x4e62e7;if(_0x1fa3b8['query'][_0xe837('0x44')]){_0x2dff52[_0xe837('0x45')]=[{'all':!![]}];}return db[_0xe837('0x2f')][_0xe837('0x46')](_0x2dff52);})[_0xe837('0x14')](function(_0x3d03e8){_0x568030['rows']=_0x3d03e8;return _0x568030;})['then'](respondWithFilteredResult(_0x54f7c7,_0x2dff52))[_0xe837('0x1e')](handleError(_0x54f7c7,null));};exports[_0xe837('0x47')]=function(_0x4e1798,_0x506935){var _0x62c147={'raw':!![],'where':{'id':_0x4e1798[_0xe837('0x48')]['id']}},_0x1c2ca2={};_0x1c2ca2[_0xe837('0x32')]=_[_0xe837('0x34')](db[_0xe837('0x2f')][_0xe837('0x49')]);_0x1c2ca2[_0xe837('0x33')]=_[_0xe837('0x34')](_0x4e1798[_0xe837('0x33')]);_0x1c2ca2[_0xe837('0x35')]=_[_0xe837('0x37')](_0x1c2ca2[_0xe837('0x32')],_0x1c2ca2[_0xe837('0x33')]);_0x62c147['attributes']=_[_0xe837('0x37')](_0x1c2ca2[_0xe837('0x32')],qs['fields'](_0x4e1798[_0xe837('0x33')]['fields']));_0x62c147[_0xe837('0x36')]=_0x62c147['attributes'][_0xe837('0x39')]?_0x62c147[_0xe837('0x36')]:_0x1c2ca2[_0xe837('0x32')];if(_0x4e1798[_0xe837('0x33')][_0xe837('0x44')]){_0x62c147[_0xe837('0x45')]=[{'all':!![]}];}_0x62c147=_[_0xe837('0x3f')]({},_0x62c147,_0x4e1798[_0xe837('0x43')]);return db[_0xe837('0x2f')][_0xe837('0x4a')](_0x62c147)[_0xe837('0x14')](handleEntityNotFound(_0x506935,null))[_0xe837('0x14')](respondWithResult(_0x506935,null))['catch'](handleError(_0x506935,null));};exports[_0xe837('0x27')]=function(_0x60df1e,_0x52d75b){if(_0x60df1e['body']['id']){delete _0x60df1e['body']['id'];}return db['MailMessage']['find']({'where':{'id':_0x60df1e['params']['id']}})['then'](handleEntityNotFound(_0x52d75b,null))[_0xe837('0x14')](saveUpdates(_0x60df1e[_0xe837('0x4b')],null))[_0xe837('0x14')](respondWithResult(_0x52d75b,null))['catch'](handleError(_0x52d75b,null));};exports[_0xe837('0x28')]=function(_0x182231,_0x24ae43){return db[_0xe837('0x2f')][_0xe837('0x4a')]({'where':{'id':_0x182231[_0xe837('0x48')]['id']}})[_0xe837('0x14')](handleEntityNotFound(_0x24ae43,null))[_0xe837('0x14')](removeEntity(_0x24ae43,null))[_0xe837('0x1e')](handleError(_0x24ae43,null));};exports['describe']=function(_0x48951f,_0x5c81b4){return db[_0xe837('0x2f')][_0xe837('0x4c')]()[_0xe837('0x14')](respondWithResult(_0x5c81b4,null))[_0xe837('0x1e')](handleError(_0x5c81b4,null));};exports['create']=function(_0x5c1e5b,_0x16544d){return db[_0xe837('0x2f')]['create'](_0x5c1e5b['body'])['then'](function(_0xeaa6c8){if(_0xeaa6c8){if(_0xeaa6c8[_0xe837('0x4d')]===_0xe837('0x4e')&&!_0xeaa6c8[_0xe837('0x4f')]){var _0x35f19c,_0x37f9e3,_0x55ecaa;if(_0x5c1e5b['body']['to']){_0x37f9e3=_0x5c1e5b[_0xe837('0x4b')]['to']['split'](',')[0x0];}return db[_0xe837('0x50')][_0xe837('0x51')]({'where':{'id':_0xeaa6c8[_0xe837('0x52')]},'include':[{'model':db[_0xe837('0x53')],'as':_0xe837('0x54'),'include':[{'model':db[_0xe837('0x55')],'as':_0xe837('0x56'),'where':{'email':_0x37f9e3},'limit':0x1,'order':[[_0xe837('0x57'),'DESC']]}]},{'model':db[_0xe837('0x58')],'as':_0xe837('0x59'),'raw':!![],'include':[{'model':db[_0xe837('0x5a')],'as':_0xe837('0x5a'),'raw':!![]}]}]})['then'](function(_0x2ea74c){_0x35f19c=_0x2ea74c;if(!_0x35f19c||!_0x35f19c['Smtp'])return;var _0x218d27=_0x35f19c[_0xe837('0x5b')]();if(_0x5c1e5b['body'][_0xe837('0x5c')]&&_0x5c1e5b[_0xe837('0x4b')]['attachments'][_0xe837('0x39')]){for(var _0x1595c0=0x0;_0x1595c0<_0x5c1e5b[_0xe837('0x4b')][_0xe837('0x5c')]['length'];_0x1595c0+=0x1){_0x5c1e5b[_0xe837('0x4b')]['attachments'][_0x1595c0]={'filename':_0x5c1e5b[_0xe837('0x4b')][_0xe837('0x5c')][_0x1595c0][_0xe837('0x2b')],'path':path[_0xe837('0x5d')](config[_0xe837('0x5e')],_0xe837('0x5f'),_0x5c1e5b[_0xe837('0x4b')][_0xe837('0x5c')][_0x1595c0][_0xe837('0x60')])};}}_0x55ecaa={'account':_0x218d27,'message':_0x5c1e5b['body']};return;})[_0xe837('0x14')](function(){if(_0x35f19c[_0xe837('0x54')]){if(_0x35f19c[_0xe837('0x54')][_0xe837('0x56')]['length']){return _0x35f19c['List']['Contacts'][0x0];}else{return db[_0xe837('0x55')][_0xe837('0x61')](_[_0xe837('0x62')](_0x5c1e5b[_0xe837('0x4b')],{'firstName':_0x5c1e5b[_0xe837('0x4b')]['to'],'email':_0x5c1e5b[_0xe837('0x4b')]['to'],'phone':_0x5c1e5b[_0xe837('0x4b')]['to'],'ListId':_0x35f19c[_0xe837('0x63')]}));}}else{throw new Error(_0xe837('0x64'));}})[_0xe837('0x14')](function(){if(_0x55ecaa){return respondWithRpcPromise('SendMail',_0xe837('0x65'),_0x55ecaa,client9003)['then'](function(_0x4ffe8c){return _0xeaa6c8[_0xe837('0x27')]({'read':!![],'messageId':_0x4ffe8c[_0xe837('0x66')],'sentAt':moment()[_0xe837('0x67')](_0xe837('0x68'))});})[_0xe837('0x1e')](function(_0x190031){logger[_0xe837('0x19')]('%s',JSON[_0xe837('0x18')](_0x190031));return _0xeaa6c8;});}return _0xeaa6c8;});}return _0xeaa6c8;}})[_0xe837('0x14')](respondWithResult(_0x16544d,0xc9))[_0xe837('0x1e')](handleError(_0x16544d,null));};exports[_0xe837('0x69')]=function(_0x501962,_0x58c717){var _0x440c43={'agent':{},'channel':_0xe837('0x6a')};if(_0x501962['body']['id']){delete _0x501962['body']['id'];}_0x501962[_0xe837('0x4b')][_0xe837('0x6b')]=!![];_0x501962[_0xe837('0x4b')][_0xe837('0x6c')]=moment()[_0xe837('0x67')](_0xe837('0x68'));_0x501962[_0xe837('0x4b')]['UserId']=_0x501962[_0xe837('0x4b')]['UserId']||_0x501962[_0xe837('0x6d')]['id'];_0x440c43[_0xe837('0x6e')]['id']=_0x501962[_0xe837('0x4b')][_0xe837('0x6f')];return db['MailMessage'][_0xe837('0x4a')]({'where':{'id':_0x501962[_0xe837('0x48')]['id'],'UserId':null}})[_0xe837('0x14')](handleEntityNotFound(_0x58c717,null))[_0xe837('0x14')](saveUpdates(_0x501962[_0xe837('0x4b')],null))[_0xe837('0x14')](function(_0x4280d2){if(_0x4280d2){_0x440c43['message']=_0x4280d2[_0xe837('0x70')]({'plain':!![]});return db[_0xe837('0x71')]['find']({'where':{'id':_0x4280d2['MailInteractionId']}});}return null;})[_0xe837('0x14')](handleEntityNotFound(_0x58c717,null))[_0xe837('0x14')](function(_0x584c14){if(_0x584c14){return _0x584c14[_0xe837('0x27')]({'UserId':_0x501962[_0xe837('0x4b')]['UserId'],'read1stAt':_[_0xe837('0x72')](_0x584c14[_0xe837('0x73')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xe837('0x14')](function(_0x84fe14){if(_0x84fe14){_0x440c43[_0xe837('0x74')]=_0x84fe14[_0xe837('0x70')]({'plain':!![]});interaction_log[_0xe837('0x75')](_0xe837('0x76'),_0x501962[_0xe837('0x6d')]['id'],_0x501962[_0xe837('0x6d')][_0xe837('0x2b')],_0x501962[_0xe837('0x6d')][_0xe837('0x77')],_0x440c43[_0xe837('0x74')]['id'],_0x501962[_0xe837('0x4b')]?JSON['stringify'](_0x501962[_0xe837('0x4b')]):_0xe837('0x78'));return respondWithRpcPromise(_0xe837('0x79'),_0xe837('0x7a'),_0x440c43);}return null;})[_0xe837('0x14')](function(_0xa1c671){var _0x5751d0=_0xe837('0x7b')+_0xa1c671[_0xe837('0x1c')][_0xe837('0x7c')];return db[_0xe837('0x7d')][_0xe837('0x33')](_0x5751d0,{'type':db[_0xe837('0x7e')][_0xe837('0x7f')][_0xe837('0x80')],'raw':!![]})[_0xe837('0x14')](function(_0x5d675e){return _0x5d675e;});})[_0xe837('0x14')](function(_0x48f098){if(_0x48f098){_0x440c43[_0xe837('0x1c')][_0xe837('0x81')]=_0x48f098[0x0];if(!_0x501962[_0xe837('0x4b')]['UserId'])return;return db[_0xe837('0x82')][_0xe837('0x4a')]({'where':{'id':_0x501962[_0xe837('0x4b')]['UserId'],'role':'agent'},'attributes':['id',_0xe837('0x2b'),_0xe837('0x83'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x3fd948){if(!_0x3fd948)return null;_0x440c43[_0xe837('0x1c')][_0xe837('0x6e')]=_0x3fd948;return _0x440c43;})['then'](function(_0x1445ef){if(_0x1445ef){if(_0x501962[_0xe837('0x4b')][_0xe837('0x84')]){_0x440c43[_0xe837('0x1c')]['interface']=util[_0xe837('0x67')]('SIP/%s',_0x501962[_0xe837('0x6d')]['name']);_0x440c43['message'][_0xe837('0x85')]=_0x440c43[_0xe837('0x85')];_0x440c43[_0xe837('0x1c')][_0xe837('0x86')]=_0x440c43[_0xe837('0x85')];_0x440c43[_0xe837('0x1c')]['event']=_0xe837('0x69');_0x440c43['message'][_0xe837('0x4b')]=htmlToText[_0xe837('0x87')](_0x440c43[_0xe837('0x1c')][_0xe837('0x4b')]);return respondWithRpcPromise('EventManager',_0xe837('0x88'),{'event':_0xe837('0x89'),'message':_0x440c43[_0xe837('0x1c')]},client9002)['then'](function(){return _0x440c43;});}return _0x440c43;}return null;})[_0xe837('0x14')](respondWithResult(_0x58c717,null))[_0xe837('0x1e')](handleError(_0x58c717,null));};exports['reject']=function(_0x1c4b7e,_0x50e6d8){var _0xffea14={'agent':{},'channel':_0xe837('0x6a')};if(_0x1c4b7e[_0xe837('0x4b')]['id']){delete _0x1c4b7e[_0xe837('0x4b')]['id'];}_0x1c4b7e[_0xe837('0x4b')]['UserId']=_0x1c4b7e[_0xe837('0x4b')][_0xe837('0x6f')]||_0x1c4b7e[_0xe837('0x6d')]['id'];_0xffea14['agent']['id']=_0x1c4b7e[_0xe837('0x4b')][_0xe837('0x6f')];return db['MailMessage'][_0xe837('0x4a')]({'where':{'id':_0x1c4b7e[_0xe837('0x48')]['id'],'UserId':null}})[_0xe837('0x14')](handleEntityNotFound(_0x50e6d8,null))[_0xe837('0x14')](function(_0xf4347b){if(_0xf4347b){_0xffea14[_0xe837('0x1c')]=_0xf4347b[_0xe837('0x70')]({'plain':!![]});return db['MailInteraction'][_0xe837('0x4a')]({'where':{'id':_0xf4347b['MailInteractionId']}});}return null;})[_0xe837('0x14')](handleEntityNotFound(_0x50e6d8,null))[_0xe837('0x14')](function(_0x58d598){if(_0x58d598){_0xffea14[_0xe837('0x74')]=_0x58d598[_0xe837('0x70')]({'plain':!![]});interaction_log[_0xe837('0x75')](_0xe837('0x8a'),_0x1c4b7e[_0xe837('0x6d')]['id'],_0x1c4b7e[_0xe837('0x6d')][_0xe837('0x2b')],_0x1c4b7e[_0xe837('0x6d')]['role'],_0xffea14[_0xe837('0x74')]['id'],_0x1c4b7e[_0xe837('0x4b')]?JSON['stringify'](_0x1c4b7e[_0xe837('0x4b')]):_0xe837('0x78'));return respondWithRpcPromise('RejectMessage',_0xe837('0x8b'),_0xffea14);}return null;})['then'](function(_0x22f70f){var _0x119d96=_0xe837('0x7b')+_0x22f70f[_0xe837('0x1c')][_0xe837('0x7c')];return db[_0xe837('0x7d')][_0xe837('0x33')](_0x119d96,{'type':db[_0xe837('0x7e')]['QueryTypes'][_0xe837('0x80')],'raw':!![]})['then'](function(_0xf6e909){return _0xf6e909;});})[_0xe837('0x14')](function(_0x55bbbb){if(_0x55bbbb){_0xffea14[_0xe837('0x1c')][_0xe837('0x81')]=_0x55bbbb[0x0];if(!_0x1c4b7e['body'][_0xe837('0x6f')])return;return db[_0xe837('0x82')][_0xe837('0x4a')]({'where':{'id':_0x1c4b7e[_0xe837('0x4b')][_0xe837('0x6f')],'role':_0xe837('0x6e')},'attributes':['id',_0xe837('0x2b'),_0xe837('0x83'),_0xe837('0x8c'),_0xe837('0x8d')],'raw':!![]});}return null;})[_0xe837('0x14')](function(_0x393f06){if(!_0x393f06)return null;_0xffea14[_0xe837('0x1c')]['agent']=_0x393f06;return _0xffea14;})['then'](function(_0x1d554c){if(_0x1d554c){_0x1d554c[_0xe837('0x1c')][_0xe837('0x8e')]=util['format']('SIP/%s',_0x1c4b7e[_0xe837('0x6d')][_0xe837('0x2b')]);_0x1d554c[_0xe837('0x1c')][_0xe837('0x85')]=_0xffea14[_0xe837('0x85')];_0x1d554c[_0xe837('0x1c')][_0xe837('0x86')]=_0xffea14[_0xe837('0x85')];_0x1d554c[_0xe837('0x1c')][_0xe837('0x8f')]=_0xe837('0x90');_0x1d554c[_0xe837('0x1c')]['body']=htmlToText[_0xe837('0x87')](_0xffea14[_0xe837('0x1c')][_0xe837('0x4b')]);respondWithRpcPromise(_0xe837('0x88'),_0xe837('0x88'),{'event':_0xe837('0x91'),'message':_0x1d554c[_0xe837('0x1c')]},client9002);return _0xffea14;}return null;})[_0xe837('0x14')](respondWithResult(_0x50e6d8,null))[_0xe837('0x1e')](handleError(_0x50e6d8,null));};exports['download']=function(_0x17e222,_0xd7f719){var _0x16693b=moment()['unix']()[_0xe837('0x92')]();var _0x382602=path['join'](config[_0xe837('0x5e')],'server',_0xe837('0x93'),_0xe837('0x94'));var _0x1ae96e=path[_0xe837('0x5d')](config[_0xe837('0x5e')],_0xe837('0x95'),_0xe837('0x93'),_0xe837('0x5c'));var _0x1478d5=util[_0xe837('0x67')](_0xe837('0x96'),_0x16693b);return db['MailMessage'][_0xe837('0x4a')]({'where':{'id':_0x17e222[_0xe837('0x48')]['id']},'attributes':['id',_0xe837('0x4b'),_0xe837('0x97'),'to','cc','bcc',_0xe837('0x98'),_0xe837('0x99')],'include':_0x17e222['query'][_0xe837('0x5c')]?[{'model':db[_0xe837('0x9a')],'as':_0xe837('0x9b')}]:undefined})['then'](handleEntityNotFound(_0xd7f719,null))[_0xe837('0x14')](function(_0x508d7e){if(_0x508d7e){var _0x2317e5=_0x508d7e;var _0xeb7c61={'from':_0x2317e5[_0xe837('0x97')],'to':_0x2317e5['to'],'subject':_0x2317e5[_0xe837('0x98')],'html':htmlEntities[_0xe837('0x9c')](_0x2317e5[_0xe837('0x4b')]),'headers':{'Date':moment(_0x2317e5[_0xe837('0x99')])[_0xe837('0x67')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x508d7e['cc']){_0xeb7c61[_0xe837('0x9d')]['Cc']=_0x508d7e['cc'];}if(_0x508d7e['bcc']){_0xeb7c61[_0xe837('0x9d')][_0xe837('0x9e')]=_0x508d7e['bcc'];}return new BPromise(function(_0x3b53b3,_0x55f940){if(_0x508d7e[_0xe837('0x9b')]){for(var _0x457458=0x0;_0x457458<_0x508d7e[_0xe837('0x9b')]['length'];_0x457458++){var _0x537eb0=_0x508d7e[_0xe837('0x9b')][_0x457458];var _0x55c7bd=path[_0xe837('0x5d')](_0x1ae96e,_0x537eb0[_0xe837('0x60')]);if(fs['existsSync'](_0x55c7bd)){_0xeb7c61[_0xe837('0x5c')][_0xe837('0x9f')]({'name':_0x537eb0[_0xe837('0x2b')],'contentType':_0x537eb0[_0xe837('0x40')],'data':fs[_0xe837('0xa0')](_0x55c7bd)});}}}emlformat[_0xe837('0xa1')](_0xeb7c61,function(_0x3ab54a,_0x251358){if(_0x3ab54a)return _0x55f940(_0x3ab54a);fs[_0xe837('0xa2')](path[_0xe837('0x5d')](_0x382602,_0x1478d5),_0x251358);return _0x3b53b3(_0x251358);});});}})[_0xe837('0x14')](function(_0x4e5c42){if(_0x4e5c42){return _0xd7f719[_0xe837('0xa3')](path[_0xe837('0x5d')](_0x382602,_0x1478d5),_0x1478d5,function(_0xe143a9){if(!_0xe143a9)fs['unlinkSync'](path[_0xe837('0x5d')](_0x382602,_0x1478d5));});}})[_0xe837('0x1e')](handleError(_0xd7f719,null));}; \ No newline at end of file +var _0xd086=['unlinkSync','eml-format','moment','bluebird','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','redis','defaults','socket.io-emitter','html-entities','./mailMessage.socket','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','undefined','count','offset','limit','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','map','MailMessage','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','find','body','params','describe','create','direction','secret','split','MailAccount','findOne','MailAccountId','CmList','List','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','attachments','join','root','server/files/attachments','CmContact','ListId','SendMail','sendMail','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','user','get','MailInteraction','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','interface','format','SIP/%s','channel','motionChannel','event','fromString','EventManager','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','fullname','email','internal','reject','rejectmessage','download','unix','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','push','readFileSync','build','writeFileSync'];(function(_0x239e70,_0x57d6e5){var _0x217678=function(_0x1de468){while(--_0x1de468){_0x239e70['push'](_0x239e70['shift']());}};_0x217678(++_0x57d6e5);}(_0xd086,0x141));var _0x6d08=function(_0x151bf4,_0x3276d5){_0x151bf4=_0x151bf4-0x0;var _0x26330e=_0xd086[_0x151bf4];return _0x26330e;};'use strict';var emlformat=require(_0x6d08('0x0'));var moment=require(_0x6d08('0x1'));var BPromise=require(_0x6d08('0x2'));var util=require('util');var path=require(_0x6d08('0x3'));var fs=require('fs');var _=require(_0x6d08('0x4'));var Redis=require(_0x6d08('0x5'));var htmlToText=require('html-to-text');var qs=require(_0x6d08('0x6'));var logger=require(_0x6d08('0x7'))(_0x6d08('0x8'));var interaction_log=require(_0x6d08('0x7'))(_0x6d08('0x9'));var config=require(_0x6d08('0xa'));var db=require('../../mysqldb')['db'];config[_0x6d08('0xb')]=_[_0x6d08('0xc')](config[_0x6d08('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x6d08('0xd'))(new Redis(config['redis']));var htmlEntities=require(_0x6d08('0xe'));require(_0x6d08('0xf'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x6d08('0x10')][_0x6d08('0x11')]({'port':0x232c});var client9003=jayson[_0x6d08('0x10')][_0x6d08('0x11')]({'port':0x232b});var client9002=jayson[_0x6d08('0x10')][_0x6d08('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x72091c,_0xdead75,_0x2c3b47,_0x406066){return new BPromise(function(_0xcb5f62,_0x23bd8d){var _0x2be52d=_0x406066||client;return _0x2be52d[_0x6d08('0x12')](_0x72091c,_0x2c3b47)[_0x6d08('0x13')](function(_0x4c10e4){logger[_0x6d08('0x14')](_0x6d08('0x15'),_0xdead75,_0x6d08('0x16'));logger['debug'](_0x6d08('0x17'),_0xdead75,'request\x20sent',JSON[_0x6d08('0x18')](_0x4c10e4));if(_0x4c10e4[_0x6d08('0x19')]){if(_0x4c10e4['error'][_0x6d08('0x1a')]===0x1f4){logger['error'](_0x6d08('0x15'),_0xdead75,_0x4c10e4[_0x6d08('0x19')][_0x6d08('0x1b')]);return _0x23bd8d(_0x4c10e4[_0x6d08('0x19')][_0x6d08('0x1b')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0xdead75,_0x4c10e4[_0x6d08('0x19')]['message']);return _0xcb5f62(_0x4c10e4[_0x6d08('0x19')]['message']);}else{logger[_0x6d08('0x14')](_0x6d08('0x15'),_0xdead75,_0x6d08('0x16'));_0xcb5f62(_0x4c10e4[_0x6d08('0x1c')][_0x6d08('0x1b')]);}})['catch'](function(_0xf1c5d5){logger[_0x6d08('0x19')](_0x6d08('0x15'),_0xdead75,_0xf1c5d5);_0x23bd8d(_0xf1c5d5);});});}function respondWithResult(_0x1fbec9,_0x5c5ace){_0x5c5ace=_0x5c5ace||0xc8;return function(_0x4dfdd0){if(_0x4dfdd0){return _0x1fbec9[_0x6d08('0x1d')](_0x5c5ace)['json'](_0x4dfdd0);}};}function respondWithFilteredResult(_0x4c76f5,_0x45dfa6){return function(_0x2cf638){if(_0x2cf638){var _0x27b2d3=typeof _0x45dfa6['offset']===_0x6d08('0x1e')&&typeof _0x45dfa6['limit']===_0x6d08('0x1e');var _0x3a6129=_0x2cf638[_0x6d08('0x1f')];var _0x49009e=_0x27b2d3?0x0:_0x45dfa6[_0x6d08('0x20')];var _0x232ec3=_0x27b2d3?_0x2cf638[_0x6d08('0x1f')]:_0x45dfa6[_0x6d08('0x20')]+_0x45dfa6[_0x6d08('0x21')];var _0x37011b;if(_0x232ec3>=_0x3a6129){_0x232ec3=_0x3a6129;_0x37011b=0xc8;}else{_0x37011b=0xce;}_0x4c76f5['status'](_0x37011b);return _0x4c76f5[_0x6d08('0x22')](_0x6d08('0x23'),_0x49009e+'-'+_0x232ec3+'/'+_0x3a6129)['json'](_0x2cf638);}return null;};}function saveUpdates(_0x20f3b0){return function(_0x3700cc){if(_0x3700cc){return _0x3700cc[_0x6d08('0x24')](_0x20f3b0)[_0x6d08('0x13')](function(_0x32835b){return _0x32835b;});}return null;};}function removeEntity(_0x593624){return function(_0x2b3831){if(_0x2b3831){return _0x2b3831[_0x6d08('0x25')]()[_0x6d08('0x13')](function(){_0x593624[_0x6d08('0x1d')](0xcc)[_0x6d08('0x26')]();});}};}function handleEntityNotFound(_0x25abd8){return function(_0x16bda9){if(!_0x16bda9){_0x25abd8[_0x6d08('0x27')](0x194);}return _0x16bda9;};}function handleError(_0x13f367,_0x1252d0){_0x1252d0=_0x1252d0||0x1f4;return function(_0x50c2f8){logger[_0x6d08('0x19')](_0x50c2f8[_0x6d08('0x28')]);if(_0x50c2f8[_0x6d08('0x29')]){delete _0x50c2f8[_0x6d08('0x29')];}_0x13f367['status'](_0x1252d0)[_0x6d08('0x2a')](_0x50c2f8);};}exports[_0x6d08('0x2b')]=function(_0x580a8c,_0x308802){var _0x67c6b5={},_0x5c8d5a={},_0x4498d0={'count':0x0,'rows':[]};var _0x18e96c=_[_0x6d08('0x2c')](db[_0x6d08('0x2d')][_0x6d08('0x2e')],function(_0x49f9da){return{'name':_0x49f9da['fieldName'],'type':_0x49f9da[_0x6d08('0x2f')][_0x6d08('0x30')]};});_0x5c8d5a[_0x6d08('0x31')]=_['map'](_0x18e96c,_0x6d08('0x29'));_0x5c8d5a['query']=_[_0x6d08('0x32')](_0x580a8c[_0x6d08('0x33')]);_0x5c8d5a[_0x6d08('0x34')]=_['intersection'](_0x5c8d5a[_0x6d08('0x31')],_0x5c8d5a['query']);_0x67c6b5['attributes']=_[_0x6d08('0x35')](_0x5c8d5a['model'],qs[_0x6d08('0x36')](_0x580a8c['query'][_0x6d08('0x36')]));_0x67c6b5[_0x6d08('0x37')]=_0x67c6b5[_0x6d08('0x37')][_0x6d08('0x38')]?_0x67c6b5[_0x6d08('0x37')]:_0x5c8d5a[_0x6d08('0x31')];if(!_0x580a8c[_0x6d08('0x33')][_0x6d08('0x39')]('nolimit')){_0x67c6b5[_0x6d08('0x21')]=qs[_0x6d08('0x21')](_0x580a8c['query'][_0x6d08('0x21')]);_0x67c6b5[_0x6d08('0x20')]=qs[_0x6d08('0x20')](_0x580a8c[_0x6d08('0x33')][_0x6d08('0x20')]);}_0x67c6b5[_0x6d08('0x3a')]=qs['sort'](_0x580a8c[_0x6d08('0x33')][_0x6d08('0x3b')]);_0x67c6b5['where']=qs[_0x6d08('0x34')](_[_0x6d08('0x3c')](_0x580a8c[_0x6d08('0x33')],_0x5c8d5a[_0x6d08('0x34')]),_0x18e96c);if(_0x580a8c[_0x6d08('0x33')][_0x6d08('0x3d')]){_0x67c6b5[_0x6d08('0x3e')]=_[_0x6d08('0x3f')](_0x67c6b5[_0x6d08('0x3e')],{'$or':_['map'](_0x18e96c,function(_0x3b8c37){if(_0x3b8c37[_0x6d08('0x2f')]!==_0x6d08('0x40')){var _0x3f8bf3={};_0x3f8bf3[_0x3b8c37[_0x6d08('0x29')]]={'$like':'%'+_0x580a8c['query'][_0x6d08('0x3d')]+'%'};return _0x3f8bf3;}})});}_0x67c6b5=_[_0x6d08('0x3f')]({},_0x67c6b5,_0x580a8c[_0x6d08('0x41')]);var _0x2cfc8f={'where':_0x67c6b5[_0x6d08('0x3e')]};return db['MailMessage'][_0x6d08('0x1f')](_0x2cfc8f)['then'](function(_0x340f76){_0x4498d0[_0x6d08('0x1f')]=_0x340f76;if(_0x580a8c[_0x6d08('0x33')][_0x6d08('0x42')]){_0x67c6b5[_0x6d08('0x43')]=[{'all':!![]}];}return db[_0x6d08('0x2d')]['findAll'](_0x67c6b5);})[_0x6d08('0x13')](function(_0x9ff095){_0x4498d0[_0x6d08('0x44')]=_0x9ff095;return _0x4498d0;})[_0x6d08('0x13')](respondWithFilteredResult(_0x308802,_0x67c6b5))[_0x6d08('0x45')](handleError(_0x308802,null));};exports[_0x6d08('0x46')]=function(_0x2f71ec,_0x4945b7){var _0x3475dd={'raw':!![],'where':{'id':_0x2f71ec['params']['id']}},_0x1144d4={};_0x1144d4[_0x6d08('0x31')]=_[_0x6d08('0x32')](db[_0x6d08('0x2d')][_0x6d08('0x2e')]);_0x1144d4[_0x6d08('0x33')]=_[_0x6d08('0x32')](_0x2f71ec[_0x6d08('0x33')]);_0x1144d4[_0x6d08('0x34')]=_[_0x6d08('0x35')](_0x1144d4[_0x6d08('0x31')],_0x1144d4[_0x6d08('0x33')]);_0x3475dd['attributes']=_[_0x6d08('0x35')](_0x1144d4[_0x6d08('0x31')],qs[_0x6d08('0x36')](_0x2f71ec[_0x6d08('0x33')][_0x6d08('0x36')]));_0x3475dd[_0x6d08('0x37')]=_0x3475dd['attributes'][_0x6d08('0x38')]?_0x3475dd[_0x6d08('0x37')]:_0x1144d4[_0x6d08('0x31')];if(_0x2f71ec[_0x6d08('0x33')][_0x6d08('0x42')]){_0x3475dd[_0x6d08('0x43')]=[{'all':!![]}];}_0x3475dd=_[_0x6d08('0x3f')]({},_0x3475dd,_0x2f71ec[_0x6d08('0x41')]);return db[_0x6d08('0x2d')][_0x6d08('0x47')](_0x3475dd)[_0x6d08('0x13')](handleEntityNotFound(_0x4945b7,null))[_0x6d08('0x13')](respondWithResult(_0x4945b7,null))['catch'](handleError(_0x4945b7,null));};exports['update']=function(_0x41abcd,_0x354e94){if(_0x41abcd[_0x6d08('0x48')]['id']){delete _0x41abcd[_0x6d08('0x48')]['id'];}return db[_0x6d08('0x2d')][_0x6d08('0x47')]({'where':{'id':_0x41abcd[_0x6d08('0x49')]['id']}})[_0x6d08('0x13')](handleEntityNotFound(_0x354e94,null))[_0x6d08('0x13')](saveUpdates(_0x41abcd[_0x6d08('0x48')],null))['then'](respondWithResult(_0x354e94,null))[_0x6d08('0x45')](handleError(_0x354e94,null));};exports['destroy']=function(_0x374fb8,_0x2e21ef){return db[_0x6d08('0x2d')][_0x6d08('0x47')]({'where':{'id':_0x374fb8[_0x6d08('0x49')]['id']}})[_0x6d08('0x13')](handleEntityNotFound(_0x2e21ef,null))[_0x6d08('0x13')](removeEntity(_0x2e21ef,null))[_0x6d08('0x45')](handleError(_0x2e21ef,null));};exports[_0x6d08('0x4a')]=function(_0x47c087,_0x217d83){return db[_0x6d08('0x2d')]['describe']()[_0x6d08('0x13')](respondWithResult(_0x217d83,null))[_0x6d08('0x45')](handleError(_0x217d83,null));};exports['create']=function(_0x39f7f0,_0x3ed620){return db[_0x6d08('0x2d')][_0x6d08('0x4b')](_0x39f7f0[_0x6d08('0x48')])[_0x6d08('0x13')](function(_0x222e9f){if(_0x222e9f){if(_0x222e9f[_0x6d08('0x4c')]==='out'&&!_0x222e9f[_0x6d08('0x4d')]){var _0x62b6f5,_0x42c57d,_0x45394c;if(_0x39f7f0[_0x6d08('0x48')]['to']){_0x42c57d=_0x39f7f0['body']['to'][_0x6d08('0x4e')](',')[0x0];}return db[_0x6d08('0x4f')][_0x6d08('0x50')]({'where':{'id':_0x222e9f[_0x6d08('0x51')]},'include':[{'model':db[_0x6d08('0x52')],'as':_0x6d08('0x53'),'include':[{'model':db['CmContact'],'as':_0x6d08('0x54'),'where':{'email':_0x42c57d},'limit':0x1,'order':[[_0x6d08('0x55'),_0x6d08('0x56')]]}]},{'model':db[_0x6d08('0x57')],'as':_0x6d08('0x58'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x6d08('0x59'),'raw':!![]}]}]})[_0x6d08('0x13')](function(_0x564938){_0x62b6f5=_0x564938;if(!_0x62b6f5||!_0x62b6f5[_0x6d08('0x58')])return;var _0x362465=_0x62b6f5['getSmtpOptions']();if(_0x39f7f0[_0x6d08('0x48')][_0x6d08('0x5a')]&&_0x39f7f0[_0x6d08('0x48')][_0x6d08('0x5a')]['length']){for(var _0x3c95a5=0x0;_0x3c95a5<_0x39f7f0['body']['attachments'][_0x6d08('0x38')];_0x3c95a5+=0x1){_0x39f7f0['body'][_0x6d08('0x5a')][_0x3c95a5]={'filename':_0x39f7f0[_0x6d08('0x48')][_0x6d08('0x5a')][_0x3c95a5][_0x6d08('0x29')],'path':path[_0x6d08('0x5b')](config[_0x6d08('0x5c')],_0x6d08('0x5d'),_0x39f7f0[_0x6d08('0x48')]['attachments'][_0x3c95a5]['basename'])};}}_0x45394c={'account':_0x362465,'message':_0x39f7f0[_0x6d08('0x48')]};return;})[_0x6d08('0x13')](function(){if(_0x62b6f5['List']){if(_0x62b6f5[_0x6d08('0x53')][_0x6d08('0x54')][_0x6d08('0x38')]){return _0x62b6f5[_0x6d08('0x53')][_0x6d08('0x54')][0x0];}else{return db[_0x6d08('0x5e')][_0x6d08('0x4b')](_[_0x6d08('0xc')](_0x39f7f0['body'],{'firstName':_0x39f7f0[_0x6d08('0x48')]['to'],'email':_0x39f7f0[_0x6d08('0x48')]['to'],'phone':_0x39f7f0[_0x6d08('0x48')]['to'],'ListId':_0x62b6f5[_0x6d08('0x5f')]}));}}else{throw new Error('List\x20not\x20found');}})['then'](function(){if(_0x45394c){return respondWithRpcPromise(_0x6d08('0x60'),_0x6d08('0x61'),_0x45394c,client9003)['then'](function(_0x2da110){return _0x222e9f['update']({'read':!![],'messageId':_0x2da110['messageId'],'sentAt':moment()['format'](_0x6d08('0x62'))});})[_0x6d08('0x45')](function(_0x4d64e0){logger[_0x6d08('0x19')]('%s',JSON[_0x6d08('0x18')](_0x4d64e0));return _0x222e9f;});}return _0x222e9f;});}return _0x222e9f;}})[_0x6d08('0x13')](respondWithResult(_0x3ed620,0xc9))[_0x6d08('0x45')](handleError(_0x3ed620,null));};exports[_0x6d08('0x63')]=function(_0xfbc005,_0x503124){var _0x1d99b9={'agent':{},'channel':_0x6d08('0x64')};if(_0xfbc005[_0x6d08('0x48')]['id']){delete _0xfbc005[_0x6d08('0x48')]['id'];}_0xfbc005[_0x6d08('0x48')][_0x6d08('0x65')]=!![];_0xfbc005[_0x6d08('0x48')][_0x6d08('0x66')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xfbc005[_0x6d08('0x48')]['UserId']=_0xfbc005[_0x6d08('0x48')][_0x6d08('0x67')]||_0xfbc005[_0x6d08('0x68')]['id'];_0x1d99b9['agent']['id']=_0xfbc005[_0x6d08('0x48')][_0x6d08('0x67')];return db[_0x6d08('0x2d')][_0x6d08('0x47')]({'where':{'id':_0xfbc005['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x503124,null))[_0x6d08('0x13')](saveUpdates(_0xfbc005[_0x6d08('0x48')],null))['then'](function(_0x403d00){if(_0x403d00){_0x1d99b9[_0x6d08('0x1b')]=_0x403d00[_0x6d08('0x69')]({'plain':!![]});return db[_0x6d08('0x6a')][_0x6d08('0x47')]({'where':{'id':_0x403d00['MailInteractionId']}});}return null;})[_0x6d08('0x13')](handleEntityNotFound(_0x503124,null))[_0x6d08('0x13')](function(_0x2da799){if(_0x2da799){return _0x2da799['update']({'UserId':_0xfbc005[_0x6d08('0x48')][_0x6d08('0x67')],'read1stAt':_[_0x6d08('0x6b')](_0x2da799[_0x6d08('0x6c')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x6d08('0x13')](function(_0x1f7c55){if(_0x1f7c55){_0x1d99b9[_0x6d08('0x6d')]=_0x1f7c55[_0x6d08('0x69')]({'plain':!![]});interaction_log[_0x6d08('0x14')](_0x6d08('0x6e'),_0xfbc005[_0x6d08('0x68')]['id'],_0xfbc005[_0x6d08('0x68')][_0x6d08('0x29')],_0xfbc005['user'][_0x6d08('0x6f')],_0x1d99b9[_0x6d08('0x6d')]['id'],_0xfbc005['body']?JSON['stringify'](_0xfbc005[_0x6d08('0x48')]):'null');return respondWithRpcPromise(_0x6d08('0x70'),_0x6d08('0x71'),_0x1d99b9);}return null;})[_0x6d08('0x13')](function(_0x3720b9){var _0x499a74='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3720b9[_0x6d08('0x1b')][_0x6d08('0x72')];return db[_0x6d08('0x73')][_0x6d08('0x33')](_0x499a74,{'type':db[_0x6d08('0x74')][_0x6d08('0x75')][_0x6d08('0x76')],'raw':!![]})[_0x6d08('0x13')](function(_0x160c08){return _0x160c08;});})[_0x6d08('0x13')](function(_0x3b1913){if(_0x3b1913){_0x1d99b9[_0x6d08('0x1b')][_0x6d08('0x77')]=_0x3b1913[0x0];if(!_0xfbc005['body']['UserId'])return;return db[_0x6d08('0x78')][_0x6d08('0x47')]({'where':{'id':_0xfbc005[_0x6d08('0x48')]['UserId'],'role':_0x6d08('0x79')},'attributes':['id',_0x6d08('0x29'),'fullname','email','internal'],'raw':!![]});}return null;})[_0x6d08('0x13')](function(_0x70f4c4){if(!_0x70f4c4)return null;_0x1d99b9[_0x6d08('0x1b')][_0x6d08('0x79')]=_0x70f4c4;return _0x1d99b9;})[_0x6d08('0x13')](function(_0x1a3a82){if(_0x1a3a82){if(_0xfbc005['body']['manual']){_0x1d99b9[_0x6d08('0x1b')][_0x6d08('0x7a')]=util[_0x6d08('0x7b')](_0x6d08('0x7c'),_0xfbc005[_0x6d08('0x68')][_0x6d08('0x29')]);_0x1d99b9[_0x6d08('0x1b')]['channel']=_0x1d99b9[_0x6d08('0x7d')];_0x1d99b9[_0x6d08('0x1b')][_0x6d08('0x7e')]=_0x1d99b9['channel'];_0x1d99b9['message'][_0x6d08('0x7f')]=_0x6d08('0x63');_0x1d99b9['message']['body']=htmlToText[_0x6d08('0x80')](_0x1d99b9[_0x6d08('0x1b')][_0x6d08('0x48')]);return respondWithRpcPromise('EventManager',_0x6d08('0x81'),{'event':'acceptmessage','message':_0x1d99b9[_0x6d08('0x1b')]},client9002)['then'](function(){return _0x1d99b9;});}return _0x1d99b9;}return null;})[_0x6d08('0x13')](respondWithResult(_0x503124,null))['catch'](handleError(_0x503124,null));};exports['reject']=function(_0x2a28ab,_0x35a645){var _0x3c971e={'agent':{},'channel':_0x6d08('0x64')};if(_0x2a28ab[_0x6d08('0x48')]['id']){delete _0x2a28ab[_0x6d08('0x48')]['id'];}_0x2a28ab[_0x6d08('0x48')][_0x6d08('0x67')]=_0x2a28ab[_0x6d08('0x48')][_0x6d08('0x67')]||_0x2a28ab[_0x6d08('0x68')]['id'];_0x3c971e[_0x6d08('0x79')]['id']=_0x2a28ab[_0x6d08('0x48')][_0x6d08('0x67')];return db[_0x6d08('0x2d')]['find']({'where':{'id':_0x2a28ab['params']['id'],'UserId':null}})[_0x6d08('0x13')](handleEntityNotFound(_0x35a645,null))[_0x6d08('0x13')](function(_0x57bcdd){if(_0x57bcdd){_0x3c971e[_0x6d08('0x1b')]=_0x57bcdd[_0x6d08('0x69')]({'plain':!![]});return db[_0x6d08('0x6a')][_0x6d08('0x47')]({'where':{'id':_0x57bcdd[_0x6d08('0x82')]}});}return null;})[_0x6d08('0x13')](handleEntityNotFound(_0x35a645,null))[_0x6d08('0x13')](function(_0x500523){if(_0x500523){_0x3c971e[_0x6d08('0x6d')]=_0x500523['get']({'plain':!![]});interaction_log[_0x6d08('0x14')](_0x6d08('0x83'),_0x2a28ab[_0x6d08('0x68')]['id'],_0x2a28ab['user'][_0x6d08('0x29')],_0x2a28ab[_0x6d08('0x68')]['role'],_0x3c971e[_0x6d08('0x6d')]['id'],_0x2a28ab[_0x6d08('0x48')]?JSON[_0x6d08('0x18')](_0x2a28ab[_0x6d08('0x48')]):'null');return respondWithRpcPromise('RejectMessage',_0x6d08('0x84'),_0x3c971e);}return null;})['then'](function(_0x4cc8ad){var _0xe81ee='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4cc8ad[_0x6d08('0x1b')]['ContactId'];return db['sequelize']['query'](_0xe81ee,{'type':db[_0x6d08('0x74')][_0x6d08('0x75')][_0x6d08('0x76')],'raw':!![]})[_0x6d08('0x13')](function(_0x45c445){return _0x45c445;});})['then'](function(_0x4abecc){if(_0x4abecc){_0x3c971e[_0x6d08('0x1b')][_0x6d08('0x77')]=_0x4abecc[0x0];if(!_0x2a28ab[_0x6d08('0x48')][_0x6d08('0x67')])return;return db[_0x6d08('0x78')]['find']({'where':{'id':_0x2a28ab[_0x6d08('0x48')]['UserId'],'role':_0x6d08('0x79')},'attributes':['id',_0x6d08('0x29'),_0x6d08('0x85'),_0x6d08('0x86'),_0x6d08('0x87')],'raw':!![]});}return null;})[_0x6d08('0x13')](function(_0x131733){if(!_0x131733)return null;_0x3c971e[_0x6d08('0x1b')][_0x6d08('0x79')]=_0x131733;return _0x3c971e;})['then'](function(_0x19e382){if(_0x19e382){_0x19e382['message'][_0x6d08('0x7a')]=util['format'](_0x6d08('0x7c'),_0x2a28ab['user'][_0x6d08('0x29')]);_0x19e382['message'][_0x6d08('0x7d')]=_0x3c971e[_0x6d08('0x7d')];_0x19e382[_0x6d08('0x1b')][_0x6d08('0x7e')]=_0x3c971e[_0x6d08('0x7d')];_0x19e382[_0x6d08('0x1b')][_0x6d08('0x7f')]=_0x6d08('0x88');_0x19e382['message'][_0x6d08('0x48')]=htmlToText['fromString'](_0x3c971e[_0x6d08('0x1b')][_0x6d08('0x48')]);respondWithRpcPromise(_0x6d08('0x81'),'EventManager',{'event':_0x6d08('0x89'),'message':_0x19e382[_0x6d08('0x1b')]},client9002);return _0x3c971e;}return null;})[_0x6d08('0x13')](respondWithResult(_0x35a645,null))[_0x6d08('0x45')](handleError(_0x35a645,null));};exports[_0x6d08('0x8a')]=function(_0x3025e1,_0x26bef3){var _0x4e8201=moment()[_0x6d08('0x8b')]()['toString']();var _0x58f541=path[_0x6d08('0x5b')](config[_0x6d08('0x5c')],_0x6d08('0x8c'),_0x6d08('0x8d'),_0x6d08('0x8e'));var _0x4f89e0=path[_0x6d08('0x5b')](config['root'],'server','files','attachments');var _0x70971a=util[_0x6d08('0x7b')](_0x6d08('0x8f'),_0x4e8201);return db[_0x6d08('0x2d')][_0x6d08('0x47')]({'where':{'id':_0x3025e1[_0x6d08('0x49')]['id']},'attributes':['id',_0x6d08('0x48'),_0x6d08('0x90'),'to','cc',_0x6d08('0x91'),_0x6d08('0x92'),_0x6d08('0x93')],'include':_0x3025e1[_0x6d08('0x33')]['attachments']?[{'model':db['Attachment'],'as':_0x6d08('0x94')}]:undefined})[_0x6d08('0x13')](handleEntityNotFound(_0x26bef3,null))['then'](function(_0x158852){if(_0x158852){var _0x4ed1a8=_0x158852;var _0x5cad70={'from':_0x4ed1a8[_0x6d08('0x90')],'to':_0x4ed1a8['to'],'subject':_0x4ed1a8[_0x6d08('0x92')],'html':htmlEntities[_0x6d08('0x95')](_0x4ed1a8[_0x6d08('0x48')]),'headers':{'Date':moment(_0x4ed1a8[_0x6d08('0x93')])[_0x6d08('0x7b')](_0x6d08('0x96'))},'attachments':[]};if(_0x158852['cc']){_0x5cad70['headers']['Cc']=_0x158852['cc'];}if(_0x158852['bcc']){_0x5cad70[_0x6d08('0x97')][_0x6d08('0x98')]=_0x158852['bcc'];}return new BPromise(function(_0x30474d,_0x632b2c){if(_0x158852[_0x6d08('0x94')]){for(var _0x665df7=0x0;_0x665df7<_0x158852['Attachments'][_0x6d08('0x38')];_0x665df7++){var _0x1f9653=_0x158852[_0x6d08('0x94')][_0x665df7];var _0x3e0e97=path[_0x6d08('0x5b')](_0x4f89e0,_0x1f9653[_0x6d08('0x99')]);if(fs[_0x6d08('0x9a')](_0x3e0e97)){_0x5cad70['attachments'][_0x6d08('0x9b')]({'name':_0x1f9653[_0x6d08('0x29')],'contentType':_0x1f9653['type'],'data':fs[_0x6d08('0x9c')](_0x3e0e97)});}}}emlformat[_0x6d08('0x9d')](_0x5cad70,function(_0x31a435,_0x151268){if(_0x31a435)return _0x632b2c(_0x31a435);fs[_0x6d08('0x9e')](path[_0x6d08('0x5b')](_0x58f541,_0x70971a),_0x151268);return _0x30474d(_0x151268);});});}})[_0x6d08('0x13')](function(_0x2f2c75){if(_0x2f2c75){return _0x26bef3[_0x6d08('0x8a')](path[_0x6d08('0x5b')](_0x58f541,_0x70971a),_0x70971a,function(_0x2c9994){if(!_0x2c9994)fs[_0x6d08('0x9f')](path['join'](_0x58f541,_0x70971a));});}})['catch'](handleError(_0x26bef3,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 307b5ca..cbdc2ef 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 _0x9587=['hook','../../mysqldb','setMaxListeners','save','emit'];(function(_0x48deac,_0x4d8ab8){var _0x3b5eaa=function(_0x91c61e){while(--_0x91c61e){_0x48deac['push'](_0x48deac['shift']());}};_0x3b5eaa(++_0x4d8ab8);}(_0x9587,0x18c));var _0x7958=function(_0x2f9eeb,_0x53b0b6){_0x2f9eeb=_0x2f9eeb-0x0;var _0xcf83bc=_0x9587[_0x2f9eeb];return _0xcf83bc;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x7958('0x0'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x7958('0x1')](0x0);var events={'afterCreate':_0x7958('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5ac2a7){return function(_0x39976d,_0x149d6e,_0x5080f4){MailMessageEvents[_0x7958('0x3')](_0x5ac2a7+':'+_0x39976d['id'],_0x39976d);MailMessageEvents['emit'](_0x5ac2a7,_0x39976d);_0x5080f4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x7958('0x4')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0xc165=['hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','emit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc165,0x84));var _0x5c16=function(_0x1ffff7,_0x2f9ff6){_0x1ffff7=_0x1ffff7-0x0;var _0x49d017=_0xc165[_0x1ffff7];return _0x49d017;};'use strict';var EventEmitter=require(_0x5c16('0x0'));var MailMessage=require(_0x5c16('0x1'))['db'][_0x5c16('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x5c16('0x3')](0x0);var events={'afterCreate':_0x5c16('0x4'),'afterUpdate':_0x5c16('0x5'),'afterDestroy':_0x5c16('0x6')};function emitEvent(_0x4b573d){return function(_0x58ae34,_0x16b755,_0x42cc4d){MailMessageEvents[_0x5c16('0x7')](_0x4b573d+':'+_0x58ae34['id'],_0x58ae34);MailMessageEvents['emit'](_0x4b573d,_0x58ae34);_0x42cc4d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x5c16('0x8')](e,emitEvent(event));}}module[_0x5c16('0x9')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index ce45f5d..023f274 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 _0x0028=['update','createdAt','toLowerCase','catch','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailMessage.attributes','MailMessage','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','fromString','body','models','get','direction','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId'];(function(_0x5489de,_0x276788){var _0x5aa0ef=function(_0x50bc54){while(--_0x50bc54){_0x5489de['push'](_0x5489de['shift']());}};_0x5aa0ef(++_0x276788);}(_0x0028,0x85));var _0x8002=function(_0x390b37,_0x23ed18){_0x390b37=_0x390b37-0x0;var _0x265e6e=_0x0028[_0x390b37];return _0x265e6e;};'use strict';var _=require('lodash');var util=require(_0x8002('0x0'));var logger=require('../../config/logger')(_0x8002('0x1'));var moment=require(_0x8002('0x2'));var BPromise=require(_0x8002('0x3'));var rp=require(_0x8002('0x4'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x8002('0x5'));var rimraf=require(_0x8002('0x6'));var config=require(_0x8002('0x7'));var attributes=require(_0x8002('0x8'));module['exports']=function(_0x44c20a,_0x152e56){return _0x44c20a['define'](_0x8002('0x9'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x8002('0xa')]},{'name':_0x8002('0xb'),'fields':[_0x8002('0xc'),_0x8002('0xd')],'type':_0x8002('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x58b011,_0x3679aa,_0x56ca98){if(_0x58b011['body']){_0x58b011[_0x8002('0xc')]=htmlToText[_0x8002('0xf')](_0x58b011[_0x8002('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x56ca98(null,_0x3679aa);},'afterCreate':function(_0x37d873,_0x4980be,_0x181303){var _0x32c6a0=_0x44c20a[_0x8002('0x11')];var _0x3782cd=_0x37d873[_0x8002('0x12')]({'plain':!![]});if(_0x3782cd[_0x8002('0x13')]['toLowerCase']()==='in'||_0x3782cd[_0x8002('0x13')]['toLowerCase']()===_0x8002('0x14')&&!_0x3782cd[_0x8002('0x15')]&&!_[_0x8002('0x16')](_0x3782cd[_0x8002('0x17')])){_0x32c6a0[_0x8002('0x18')][_0x8002('0x19')]({'where':{'id':_0x3782cd[_0x8002('0x1a')]}})['then'](function(_0x5650c3){if(_0x5650c3){_0x5650c3[_0x8002('0x1b')]({'lastMsgAt':_0x3782cd[_0x8002('0x1c')],'lastMsgDirection':_0x3782cd[_0x8002('0x13')][_0x8002('0x1d')]()});}})[_0x8002('0x1e')](function(_0x2714f1){console['error'](_0x2714f1);});}_0x181303();}},'charset':'utf8mb4','collate':_0x8002('0x1f')});}; \ No newline at end of file +var _0x2e25=['./mailMessage.attributes','exports','define','MailMessage','mail_messages','fti_mail_messages','plainBody','FULLTEXT','fromString','body','models','get','toLowerCase','direction','isNil','UserId','findOne','MailInteractionId','then','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment'];(function(_0x1e57fc,_0x2e010a){var _0x16b6a9=function(_0x3a5e88){while(--_0x3a5e88){_0x1e57fc['push'](_0x1e57fc['shift']());}};_0x16b6a9(++_0x2e010a);}(_0x2e25,0xf6));var _0x52e2=function(_0x3bf5f6,_0xab63f0){_0x3bf5f6=_0x3bf5f6-0x0;var _0x475678=_0x2e25[_0x3bf5f6];return _0x475678;};'use strict';var _=require(_0x52e2('0x0'));var util=require(_0x52e2('0x1'));var logger=require(_0x52e2('0x2'))(_0x52e2('0x3'));var moment=require('moment');var BPromise=require(_0x52e2('0x4'));var rp=require(_0x52e2('0x5'));var htmlToText=require(_0x52e2('0x6'));var fs=require('fs');var path=require(_0x52e2('0x7'));var rimraf=require(_0x52e2('0x8'));var config=require(_0x52e2('0x9'));var attributes=require(_0x52e2('0xa'));module[_0x52e2('0xb')]=function(_0x1c3987,_0x34c23e){return _0x1c3987[_0x52e2('0xc')](_0x52e2('0xd'),attributes,{'tableName':_0x52e2('0xe'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0x52e2('0xf'),'fields':[_0x52e2('0x10'),'subject'],'type':_0x52e2('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x437c40,_0x1d7c52,_0xf1e9ea){if(_0x437c40['body']){_0x437c40[_0x52e2('0x10')]=htmlToText[_0x52e2('0x12')](_0x437c40[_0x52e2('0x13')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0xf1e9ea(null,_0x1d7c52);},'afterCreate':function(_0x4c70ab,_0x67280f,_0x2af7e8){var _0x3e7555=_0x1c3987[_0x52e2('0x14')];var _0x13d2c2=_0x4c70ab[_0x52e2('0x15')]({'plain':!![]});if(_0x13d2c2['direction'][_0x52e2('0x16')]()==='in'||_0x13d2c2[_0x52e2('0x17')]['toLowerCase']()==='out'&&!_0x13d2c2['secret']&&!_[_0x52e2('0x18')](_0x13d2c2[_0x52e2('0x19')])){_0x3e7555['MailInteraction'][_0x52e2('0x1a')]({'where':{'id':_0x13d2c2[_0x52e2('0x1b')]}})[_0x52e2('0x1c')](function(_0xa2b414){if(_0xa2b414){_0xa2b414['update']({'lastMsgAt':_0x13d2c2['createdAt'],'lastMsgDirection':_0x13d2c2[_0x52e2('0x17')][_0x52e2('0x16')]()});}})[_0x52e2('0x1d')](function(_0xe53479){console[_0x52e2('0x1e')](_0xe53479);});}_0x2af7e8();}},'charset':'utf8mb4','collate':_0x52e2('0x1f')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 0ec1341..695a80e 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 _0x93e9=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailMessage.socket','register','request','info','request\x20sent','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','CreateMailMessage','MailMessage','create','options','raw','then','debug'];(function(_0x23c193,_0x273229){var _0x186326=function(_0xbf9a67){while(--_0xbf9a67){_0x23c193['push'](_0x23c193['shift']());}};_0x186326(++_0x273229);}(_0x93e9,0xcc));var _0x993e=function(_0x38a359,_0x49d7c7){_0x38a359=_0x38a359-0x0;var _0x50e820=_0x93e9[_0x38a359];return _0x50e820;};'use strict';var _=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var moment=require(_0x993e('0x2'));var BPromise=require(_0x993e('0x3'));var rs=require(_0x993e('0x4'));var fs=require('fs');var Redis=require(_0x993e('0x5'));var db=require(_0x993e('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x993e('0x7'));var config=require(_0x993e('0x8'));var jayson=require(_0x993e('0x9'));var client=jayson[_0x993e('0xa')][_0x993e('0xb')]({'port':0x232a});config[_0x993e('0xc')]=_[_0x993e('0xd')](config[_0x993e('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x993e('0xe'))(new Redis(config[_0x993e('0xc')]));require(_0x993e('0xf'))[_0x993e('0x10')](socket);function respondWithRpcPromise(_0x2cd389,_0x27a28f,_0x1c2324){return new BPromise(function(_0x48291a,_0x196f6d){return client[_0x993e('0x11')](_0x2cd389,_0x1c2324)['then'](function(_0x5ebc8c){logger[_0x993e('0x12')]('MailMessage,\x20%s,\x20%s',_0x27a28f,_0x993e('0x13'));logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x27a28f,_0x993e('0x13'),JSON[_0x993e('0x14')](_0x5ebc8c));if(_0x5ebc8c[_0x993e('0x15')]){if(_0x5ebc8c[_0x993e('0x15')][_0x993e('0x16')]===0x1f4){logger[_0x993e('0x15')](_0x993e('0x17'),_0x27a28f,_0x5ebc8c[_0x993e('0x15')][_0x993e('0x18')]);return _0x196f6d(_0x5ebc8c[_0x993e('0x15')][_0x993e('0x18')]);}logger[_0x993e('0x15')](_0x993e('0x17'),_0x27a28f,_0x5ebc8c[_0x993e('0x15')][_0x993e('0x18')]);return _0x48291a(_0x5ebc8c[_0x993e('0x15')][_0x993e('0x18')]);}else{logger['info'](_0x993e('0x17'),_0x27a28f,_0x993e('0x13'));_0x48291a(_0x5ebc8c[_0x993e('0x19')][_0x993e('0x18')]);}})[_0x993e('0x1a')](function(_0x3eda77){logger['error'](_0x993e('0x17'),_0x27a28f,_0x3eda77);_0x196f6d(_0x3eda77);});});}exports[_0x993e('0x1b')]=function(_0x1eaf57){var _0x22390e=this;return new Promise(function(_0x130a8a,_0x425ab4){return db[_0x993e('0x1c')][_0x993e('0x1d')](_0x1eaf57['body'],{'raw':_0x1eaf57[_0x993e('0x1e')]?_0x1eaf57['options'][_0x993e('0x1f')]===undefined?!![]:![]:!![]})[_0x993e('0x20')](function(_0x32b09e){logger['info'](_0x993e('0x1b'),_0x1eaf57);logger[_0x993e('0x21')](_0x993e('0x1b'),_0x1eaf57,JSON[_0x993e('0x14')](_0x32b09e));_0x130a8a(_0x32b09e);})[_0x993e('0x1a')](function(_0x328d22){logger[_0x993e('0x15')](_0x993e('0x1b'),_0x328d22[_0x993e('0x18')],_0x1eaf57);_0x425ab4(_0x22390e[_0x993e('0x15')](0x1f4,_0x328d22[_0x993e('0x18')]));});});}; \ No newline at end of file +var _0x6a95=['MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailMessage','create','body','options','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','MailMessage,\x20%s,\x20%s','debug'];(function(_0x351717,_0x4ff9ad){var _0x378d2d=function(_0x49f570){while(--_0x49f570){_0x351717['push'](_0x351717['shift']());}};_0x378d2d(++_0x4ff9ad);}(_0x6a95,0x1db));var _0x56a9=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0x6a95[_0x2576d7];return _0x16a08c;};'use strict';var _=require(_0x56a9('0x0'));var util=require(_0x56a9('0x1'));var moment=require(_0x56a9('0x2'));var BPromise=require(_0x56a9('0x3'));var rs=require(_0x56a9('0x4'));var fs=require('fs');var Redis=require(_0x56a9('0x5'));var db=require(_0x56a9('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x56a9('0x7'));var config=require(_0x56a9('0x8'));var jayson=require(_0x56a9('0x9'));var client=jayson[_0x56a9('0xa')][_0x56a9('0xb')]({'port':0x232a});config[_0x56a9('0xc')]=_[_0x56a9('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x56a9('0xe'))(new Redis(config[_0x56a9('0xc')]));require('./mailMessage.socket')[_0x56a9('0xf')](socket);function respondWithRpcPromise(_0x1eddfd,_0x2d590d,_0xcf7c){return new BPromise(function(_0x3c1506,_0x319ff3){return client[_0x56a9('0x10')](_0x1eddfd,_0xcf7c)[_0x56a9('0x11')](function(_0x9ab10c){logger['info'](_0x56a9('0x12'),_0x2d590d,'request\x20sent');logger[_0x56a9('0x13')](_0x56a9('0x14'),_0x2d590d,_0x56a9('0x15'),JSON[_0x56a9('0x16')](_0x9ab10c));if(_0x9ab10c[_0x56a9('0x17')]){if(_0x9ab10c[_0x56a9('0x17')][_0x56a9('0x18')]===0x1f4){logger[_0x56a9('0x17')](_0x56a9('0x12'),_0x2d590d,_0x9ab10c['error']['message']);return _0x319ff3(_0x9ab10c[_0x56a9('0x17')][_0x56a9('0x19')]);}logger[_0x56a9('0x17')](_0x56a9('0x12'),_0x2d590d,_0x9ab10c['error'][_0x56a9('0x19')]);return _0x3c1506(_0x9ab10c['error']['message']);}else{logger['info'](_0x56a9('0x12'),_0x2d590d,_0x56a9('0x15'));_0x3c1506(_0x9ab10c[_0x56a9('0x1a')][_0x56a9('0x19')]);}})[_0x56a9('0x1b')](function(_0x429e24){logger[_0x56a9('0x17')](_0x56a9('0x12'),_0x2d590d,_0x429e24);_0x319ff3(_0x429e24);});});}exports[_0x56a9('0x1c')]=function(_0x335cc3){var _0x2ff2ca=this;return new Promise(function(_0x62f79f,_0x5f145f){return db['MailMessage'][_0x56a9('0x1d')](_0x335cc3[_0x56a9('0x1e')],{'raw':_0x335cc3[_0x56a9('0x1f')]?_0x335cc3[_0x56a9('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x56a9('0x11')](function(_0x3355c4){logger[_0x56a9('0x20')](_0x56a9('0x1c'),_0x335cc3);logger['debug'](_0x56a9('0x1c'),_0x335cc3,JSON[_0x56a9('0x16')](_0x3355c4));_0x62f79f(_0x3355c4);})[_0x56a9('0x1b')](function(_0xd029f7){logger[_0x56a9('0x17')]('CreateMailMessage',_0xd029f7[_0x56a9('0x19')],_0x335cc3);_0x5f145f(_0x2ff2ca[_0x56a9('0x17')](0x1f4,_0xd029f7[_0x56a9('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 3afd14d..52c688f 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 _0xef1c=['removeListener','register','mailMessage:','./mailMessage.events','save','update','emit'];(function(_0x2d5403,_0x5735b3){var _0xa580cb=function(_0x10f897){while(--_0x10f897){_0x2d5403['push'](_0x2d5403['shift']());}};_0xa580cb(++_0x5735b3);}(_0xef1c,0x176));var _0xcef1=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xef1c[_0xbca1b1];return _0x4e1686;};'use strict';var MailMessageEvents=require(_0xcef1('0x0'));var events=[_0xcef1('0x1'),'remove',_0xcef1('0x2')];function createListener(_0x234381,_0x149809){return function(_0x13b976){_0x149809[_0xcef1('0x3')](_0x234381,_0x13b976);};}function removeListener(_0x3872e2,_0x58f00c){return function(){MailMessageEvents[_0xcef1('0x4')](_0x3872e2,_0x58f00c);};}exports[_0xcef1('0x5')]=function(_0x24638a){for(var _0x484051=0x0,_0x6aca0e=events['length'];_0x484051<_0x6aca0e;_0x484051++){var _0x510da9=events[_0x484051];var _0x20b5e1=createListener(_0xcef1('0x6')+_0x510da9,_0x24638a);MailMessageEvents['on'](_0x510da9,_0x20b5e1);}}; \ No newline at end of file +var _0x6fad=['length','./mailMessage.events','save','remove','update','emit','removeListener'];(function(_0x446301,_0x15b238){var _0x268e22=function(_0x29a525){while(--_0x29a525){_0x446301['push'](_0x446301['shift']());}};_0x268e22(++_0x15b238);}(_0x6fad,0x174));var _0xd6fa=function(_0x56899b,_0x80fce){_0x56899b=_0x56899b-0x0;var _0x47d591=_0x6fad[_0x56899b];return _0x47d591;};'use strict';var MailMessageEvents=require(_0xd6fa('0x0'));var events=[_0xd6fa('0x1'),_0xd6fa('0x2'),_0xd6fa('0x3')];function createListener(_0x4f8a1c,_0x2f5f9b){return function(_0x4ae415){_0x2f5f9b[_0xd6fa('0x4')](_0x4f8a1c,_0x4ae415);};}function removeListener(_0x48f433,_0x3e76d0){return function(){MailMessageEvents[_0xd6fa('0x5')](_0x48f433,_0x3e76d0);};}exports['register']=function(_0x45dad4){for(var _0x329390=0x0,_0x291bd5=events[_0xd6fa('0x6')];_0x329390<_0x291bd5;_0x329390++){var _0x5a1bf0=events[_0x329390];var _0x1d2aaa=createListener('mailMessage:'+_0x5a1bf0,_0x45dad4);MailMessageEvents['on'](_0x5a1bf0,_0x1d2aaa);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 093210c..b66132b 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 _0xb763=['update','delete','destroy','removeTeams','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','post','create','addAgents'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb763,0xa7));var _0x3b76=function(_0x5c9421,_0x2a4f82){_0x5c9421=_0x5c9421-0x0;var _0x436842=_0xb763[_0x5c9421];return _0x436842;};'use strict';var multer=require(_0x3b76('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3b76('0x1'));var express=require(_0x3b76('0x2'));var router=express[_0x3b76('0x3')]();var fs_extra=require(_0x3b76('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3b76('0x5'));var config=require(_0x3b76('0x6'));var controller=require(_0x3b76('0x7'));router[_0x3b76('0x8')]('/',auth[_0x3b76('0x9')](),controller[_0x3b76('0xa')]);router[_0x3b76('0x8')](_0x3b76('0xb'),auth[_0x3b76('0x9')](),controller[_0x3b76('0xc')]);router[_0x3b76('0x8')](_0x3b76('0xd'),auth[_0x3b76('0x9')](),controller[_0x3b76('0xe')]);router[_0x3b76('0x8')]('/:id/members',auth[_0x3b76('0x9')](),controller[_0x3b76('0xf')]);router['get'](_0x3b76('0x10'),auth[_0x3b76('0x9')](),controller[_0x3b76('0x11')]);router[_0x3b76('0x8')](_0x3b76('0x12'),auth['isAuthenticated'](),controller['getAgents']);router[_0x3b76('0x13')]('/',auth['isAuthenticated'](),controller[_0x3b76('0x14')]);router[_0x3b76('0x13')](_0x3b76('0x10'),auth[_0x3b76('0x9')](),controller['addTeams']);router['post'](_0x3b76('0x12'),auth[_0x3b76('0x9')](),controller[_0x3b76('0x15')]);router['put'](_0x3b76('0xd'),auth[_0x3b76('0x9')](),controller[_0x3b76('0x16')]);router[_0x3b76('0x17')](_0x3b76('0xd'),auth[_0x3b76('0x9')](),controller[_0x3b76('0x18')]);router[_0x3b76('0x17')](_0x3b76('0x10'),auth[_0x3b76('0x9')](),controller[_0x3b76('0x19')]);router[_0x3b76('0x17')](_0x3b76('0x12'),auth[_0x3b76('0x9')](),controller['removeAgents']);module[_0x3b76('0x1a')]=router; \ No newline at end of file +var _0x115c=['delete','destroy','/:id/teams','removeTeams','removeAgents','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','getAgents','addTeams','post','/:id/users','addAgents','put'];(function(_0x35f18a,_0x4e66d3){var _0x52d4e0=function(_0x267f42){while(--_0x267f42){_0x35f18a['push'](_0x35f18a['shift']());}};_0x52d4e0(++_0x4e66d3);}(_0x115c,0xd8));var _0xc115=function(_0x38b7f1,_0x591b2b){_0x38b7f1=_0x38b7f1-0x0;var _0x388944=_0x115c[_0x38b7f1];return _0x388944;};'use strict';var multer=require('multer');var util=require(_0xc115('0x0'));var path=require(_0xc115('0x1'));var timeout=require('connect-timeout');var express=require(_0xc115('0x2'));var router=express[_0xc115('0x3')]();var fs_extra=require(_0xc115('0x4'));var auth=require(_0xc115('0x5'));var interaction=require(_0xc115('0x6'));var config=require(_0xc115('0x7'));var controller=require(_0xc115('0x8'));router[_0xc115('0x9')]('/',auth[_0xc115('0xa')](),controller['index']);router[_0xc115('0x9')](_0xc115('0xb'),auth[_0xc115('0xa')](),controller[_0xc115('0xc')]);router[_0xc115('0x9')](_0xc115('0xd'),auth[_0xc115('0xa')](),controller[_0xc115('0xe')]);router['get'](_0xc115('0xf'),auth[_0xc115('0xa')](),controller[_0xc115('0x10')]);router[_0xc115('0x9')]('/:id/teams',auth[_0xc115('0xa')](),controller[_0xc115('0x11')]);router[_0xc115('0x9')]('/:id/users',auth[_0xc115('0xa')](),controller[_0xc115('0x12')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/teams',auth[_0xc115('0xa')](),controller[_0xc115('0x13')]);router[_0xc115('0x14')](_0xc115('0x15'),auth[_0xc115('0xa')](),controller[_0xc115('0x16')]);router[_0xc115('0x17')](_0xc115('0xd'),auth[_0xc115('0xa')](),controller['update']);router[_0xc115('0x18')](_0xc115('0xd'),auth[_0xc115('0xa')](),controller[_0xc115('0x19')]);router[_0xc115('0x18')](_0xc115('0x1a'),auth[_0xc115('0xa')](),controller[_0xc115('0x1b')]);router[_0xc115('0x18')](_0xc115('0x15'),auth[_0xc115('0xa')](),controller[_0xc115('0x1c')]);module[_0xc115('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 4cf867c..d085372 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 _0xe395=['STRING','INTEGER','rrmemory','beepall'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xe395,0xc0));var _0x5e39=function(_0x3a097a,_0x49c63c){_0x3a097a=_0x3a097a-0x0;var _0x759bc6=_0xe395[_0x3a097a];return _0x759bc6;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x5e39('0x0')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5e39('0x0')]},'timeout':{'type':Sequelize[_0x5e39('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x5e39('0x2'),_0x5e39('0x3'),'roundrobin')}}; \ No newline at end of file +var _0x1fc4=['STRING','name','ENUM','rrmemory','roundrobin','sequelize'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x1fc4,0x1c7));var _0x41fc=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x1fc4[_0x2d7f0e];return _0x110b07;};'use strict';var Sequelize=require(_0x41fc('0x0'));module['exports']={'name':{'type':Sequelize[_0x41fc('0x1')],'unique':_0x41fc('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x41fc('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x41fc('0x3')](_0x41fc('0x4'),'beepall',_0x41fc('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 828f6dd..b607fcb 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 _0x53a6=['set','Content-Range','apply','reject','save','update','destroy','then','MailQueues','UserProfileResource','status','error','name','send','index','map','rawAttributes','type','key','model','keys','filters','query','intersection','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','MailQueue','includeAll','include','findAll','rows','catch','body','user','get','role','UserProfileSection','find','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','UserMailQueue','hasOwnProperty','MailQueueId','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','SIP','getTeams','Team','addTeams','ids','Agents','online','interface','flatMap','transaction','forEach','emit','userMailQueue:save','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','every','TeamId','all','union','compact','value','removeTeams','isEmpty','userMailQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','findOne','eml-format','zip-dir','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','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','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','end','json','offset','undefined','count'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0x53a6,0x18f));var _0x653a=function(_0x2cd368,_0x4a8c24){_0x2cd368=_0x2cd368-0x0;var _0x363036=_0x53a6[_0x2cd368];return _0x363036;};'use strict';var emlformat=require(_0x653a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x653a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x653a('0x2'));var moment=require(_0x653a('0x3'));var BPromise=require(_0x653a('0x4'));var Mustache=require('mustache');var util=require(_0x653a('0x5'));var path=require(_0x653a('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x653a('0x7'));var fs=require('fs');var fs_extra=require(_0x653a('0x8'));var _=require(_0x653a('0x9'));var squel=require(_0x653a('0xa'));var crypto=require(_0x653a('0xb'));var jsforce=require(_0x653a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x653a('0xd'));var querystring=require(_0x653a('0xe'));var Papa=require(_0x653a('0xf'));var Redis=require(_0x653a('0x10'));var authService=require(_0x653a('0x11'));var qs=require(_0x653a('0x12'));var as=require(_0x653a('0x13'));var hardwareService=require(_0x653a('0x14'));var logger=require(_0x653a('0x15'))(_0x653a('0x16'));var utils=require(_0x653a('0x17'));var config=require(_0x653a('0x18'));var licenseUtil=require(_0x653a('0x19'));var db=require(_0x653a('0x1a'))['db'];config[_0x653a('0x1b')]=_[_0x653a('0x1c')](config[_0x653a('0x1b')],{'host':_0x653a('0x1d'),'port':0x18eb});var socket=require(_0x653a('0x1e'))(new Redis(config[_0x653a('0x1b')]));require(_0x653a('0x1f'))[_0x653a('0x20')](socket);function respondWithStatusCode(_0x47f0a6,_0x3bc7d9){_0x3bc7d9=_0x3bc7d9||0xcc;return function(_0x2dbf5f){if(_0x2dbf5f){return _0x47f0a6[_0x653a('0x21')](_0x3bc7d9);}return _0x47f0a6['status'](_0x3bc7d9)[_0x653a('0x22')]();};}function respondWithResult(_0x569d8f,_0x144bca){_0x144bca=_0x144bca||0xc8;return function(_0x25c2b6){if(_0x25c2b6){return _0x569d8f['status'](_0x144bca)[_0x653a('0x23')](_0x25c2b6);}};}function respondWithFilteredResult(_0x4215cf,_0x386f14){return function(_0x1b2301){if(_0x1b2301){var _0x4c60a7=typeof _0x386f14[_0x653a('0x24')]===_0x653a('0x25')&&typeof _0x386f14['limit']==='undefined';var _0xf8e18b=_0x1b2301[_0x653a('0x26')];var _0x220f36=_0x4c60a7?0x0:_0x386f14[_0x653a('0x24')];var _0x37c63d=_0x4c60a7?_0x1b2301[_0x653a('0x26')]:_0x386f14[_0x653a('0x24')]+_0x386f14['limit'];var _0xfb537c;if(_0x37c63d>=_0xf8e18b){_0x37c63d=_0xf8e18b;_0xfb537c=0xc8;}else{_0xfb537c=0xce;}_0x4215cf['status'](_0xfb537c);return _0x4215cf[_0x653a('0x27')](_0x653a('0x28'),_0x220f36+'-'+_0x37c63d+'/'+_0xf8e18b)[_0x653a('0x23')](_0x1b2301);}return null;};}function patchUpdates(_0x3949e0){return function(_0x15fb0e){try{jsonpatch[_0x653a('0x29')](_0x15fb0e,_0x3949e0,!![]);}catch(_0x417d5d){return BPromise[_0x653a('0x2a')](_0x417d5d);}return _0x15fb0e[_0x653a('0x2b')]();};}function saveUpdates(_0x3f4dbd,_0x7d5997){return function(_0x18af6a){if(_0x18af6a){return _0x18af6a[_0x653a('0x2c')](_0x3f4dbd)['then'](function(_0x436f59){return _0x436f59;});}return null;};}function removeEntity(_0x768d7f,_0x32a67d){return function(_0x546351){if(_0x546351){return _0x546351[_0x653a('0x2d')]()[_0x653a('0x2e')](function(){var _0x1fb035=_0x546351['get']({'plain':!![]});var _0x27e22a=_0x653a('0x2f');return db[_0x653a('0x30')][_0x653a('0x2d')]({'where':{'type':_0x27e22a,'resourceId':_0x1fb035['id']}})['then'](function(){return _0x546351;});})[_0x653a('0x2e')](function(){_0x768d7f[_0x653a('0x31')](0xcc)[_0x653a('0x22')]();});}};}function handleEntityNotFound(_0x1d95b9,_0x2a4eab){return function(_0x377103){if(!_0x377103){_0x1d95b9[_0x653a('0x21')](0x194);}return _0x377103;};}function handleError(_0x48388d,_0x153293){_0x153293=_0x153293||0x1f4;return function(_0x1f3f35){logger[_0x653a('0x32')](_0x1f3f35['stack']);if(_0x1f3f35['name']){delete _0x1f3f35[_0x653a('0x33')];}_0x48388d[_0x653a('0x31')](_0x153293)[_0x653a('0x34')](_0x1f3f35);};}exports[_0x653a('0x35')]=function(_0x3554c0,_0x3da28d){var _0x70a407={},_0x4fc056={},_0x207680={'count':0x0,'rows':[]};var _0x32e0ff=_[_0x653a('0x36')](db['MailQueue'][_0x653a('0x37')],function(_0x1a3e2a){return{'name':_0x1a3e2a['fieldName'],'type':_0x1a3e2a[_0x653a('0x38')][_0x653a('0x39')]};});_0x4fc056[_0x653a('0x3a')]=_[_0x653a('0x36')](_0x32e0ff,_0x653a('0x33'));_0x4fc056['query']=_[_0x653a('0x3b')](_0x3554c0['query']);_0x4fc056[_0x653a('0x3c')]=_['intersection'](_0x4fc056[_0x653a('0x3a')],_0x4fc056[_0x653a('0x3d')]);_0x70a407['attributes']=_[_0x653a('0x3e')](_0x4fc056[_0x653a('0x3a')],qs['fields'](_0x3554c0[_0x653a('0x3d')][_0x653a('0x3f')]));_0x70a407[_0x653a('0x40')]=_0x70a407[_0x653a('0x40')][_0x653a('0x41')]?_0x70a407['attributes']:_0x4fc056['model'];if(!_0x3554c0[_0x653a('0x3d')]['hasOwnProperty'](_0x653a('0x42'))){_0x70a407[_0x653a('0x43')]=qs['limit'](_0x3554c0[_0x653a('0x3d')][_0x653a('0x43')]);_0x70a407[_0x653a('0x24')]=qs[_0x653a('0x24')](_0x3554c0['query'][_0x653a('0x24')]);}_0x70a407[_0x653a('0x44')]=qs[_0x653a('0x45')](_0x3554c0[_0x653a('0x3d')][_0x653a('0x45')]);_0x70a407[_0x653a('0x46')]=qs['filters'](_[_0x653a('0x47')](_0x3554c0[_0x653a('0x3d')],_0x4fc056[_0x653a('0x3c')]),_0x32e0ff);if(_0x3554c0[_0x653a('0x3d')][_0x653a('0x48')]){_0x70a407[_0x653a('0x46')]=_[_0x653a('0x49')](_0x70a407[_0x653a('0x46')],{'$or':_[_0x653a('0x36')](_0x32e0ff,function(_0xc0427e){if(_0xc0427e[_0x653a('0x38')]!==_0x653a('0x4a')){var _0x547640={};_0x547640[_0xc0427e['name']]={'$like':'%'+_0x3554c0[_0x653a('0x3d')][_0x653a('0x48')]+'%'};return _0x547640;}})});}_0x70a407=_[_0x653a('0x49')]({},_0x70a407,_0x3554c0[_0x653a('0x4b')]);var _0x39097d={'where':_0x70a407[_0x653a('0x46')]};return db[_0x653a('0x4c')][_0x653a('0x26')](_0x39097d)['then'](function(_0x2596d7){_0x207680[_0x653a('0x26')]=_0x2596d7;if(_0x3554c0[_0x653a('0x3d')][_0x653a('0x4d')]){_0x70a407[_0x653a('0x4e')]=[{'all':!![]}];}return db[_0x653a('0x4c')][_0x653a('0x4f')](_0x70a407);})[_0x653a('0x2e')](function(_0x5b2324){_0x207680[_0x653a('0x50')]=_0x5b2324;return _0x207680;})[_0x653a('0x2e')](respondWithFilteredResult(_0x3da28d,_0x70a407))[_0x653a('0x51')](handleError(_0x3da28d,null));};exports['show']=function(_0x564a02,_0x415e37){var _0xa26e69={'raw':!![],'where':{'id':_0x564a02['params']['id']}},_0x3a2a98={};_0x3a2a98[_0x653a('0x3a')]=_['keys'](db['MailQueue']['rawAttributes']);_0x3a2a98[_0x653a('0x3d')]=_[_0x653a('0x3b')](_0x564a02['query']);_0x3a2a98[_0x653a('0x3c')]=_[_0x653a('0x3e')](_0x3a2a98[_0x653a('0x3a')],_0x3a2a98[_0x653a('0x3d')]);_0xa26e69[_0x653a('0x40')]=_[_0x653a('0x3e')](_0x3a2a98[_0x653a('0x3a')],qs[_0x653a('0x3f')](_0x564a02[_0x653a('0x3d')][_0x653a('0x3f')]));_0xa26e69['attributes']=_0xa26e69['attributes']['length']?_0xa26e69['attributes']:_0x3a2a98[_0x653a('0x3a')];if(_0x564a02[_0x653a('0x3d')]['includeAll']){_0xa26e69['include']=[{'all':!![]}];}_0xa26e69=_[_0x653a('0x49')]({},_0xa26e69,_0x564a02[_0x653a('0x4b')]);return db[_0x653a('0x4c')]['find'](_0xa26e69)[_0x653a('0x2e')](handleEntityNotFound(_0x415e37,null))[_0x653a('0x2e')](respondWithResult(_0x415e37,null))['catch'](handleError(_0x415e37,null));};exports['create']=function(_0x1d918b,_0x3b0deb){return db['MailQueue']['create'](_0x1d918b[_0x653a('0x52')],{})[_0x653a('0x2e')](function(_0x24b894){var _0x4fbf48=_0x1d918b[_0x653a('0x53')][_0x653a('0x54')]({'plain':!![]});if(!_0x4fbf48)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4fbf48[_0x653a('0x55')]===_0x653a('0x53')){var _0xef38f1=_0x24b894[_0x653a('0x54')]({'plain':!![]});var _0x54b548='MailQueues';return db[_0x653a('0x56')][_0x653a('0x57')]({'where':{'name':_0x54b548,'userProfileId':_0x4fbf48[_0x653a('0x58')]},'raw':!![]})[_0x653a('0x2e')](function(_0x19ddab){if(_0x19ddab&&_0x19ddab['autoAssociation']===0x0){return db['UserProfileResource'][_0x653a('0x59')]({'name':_0xef38f1[_0x653a('0x33')],'resourceId':_0xef38f1['id'],'type':_0x19ddab[_0x653a('0x33')],'sectionId':_0x19ddab['id']},{})[_0x653a('0x2e')](function(){return _0x24b894;});}else{return _0x24b894;}})['catch'](function(_0x59247b){logger['error'](_0x653a('0x5a'),_0x59247b);throw _0x59247b;});}return _0x24b894;})['then'](respondWithResult(_0x3b0deb,0xc9))[_0x653a('0x51')](handleError(_0x3b0deb,null));};exports[_0x653a('0x2c')]=function(_0x5c35ef,_0x5cef0c){if(_0x5c35ef[_0x653a('0x52')]['id']){delete _0x5c35ef[_0x653a('0x52')]['id'];}return db[_0x653a('0x4c')][_0x653a('0x57')]({'where':{'id':_0x5c35ef[_0x653a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5cef0c,null))[_0x653a('0x2e')](saveUpdates(_0x5c35ef[_0x653a('0x52')],null))[_0x653a('0x2e')](respondWithResult(_0x5cef0c,null))[_0x653a('0x51')](handleError(_0x5cef0c,null));};exports[_0x653a('0x2d')]=function(_0x4e96bf,_0x9c5989){return db['MailQueue'][_0x653a('0x57')]({'where':{'id':_0x4e96bf[_0x653a('0x5b')]['id']}})[_0x653a('0x2e')](handleEntityNotFound(_0x9c5989,null))['then'](removeEntity(_0x9c5989,null))[_0x653a('0x51')](handleError(_0x9c5989,null));};exports['describe']=function(_0x45aedf,_0x2b3ee2){return db[_0x653a('0x4c')][_0x653a('0x5c')]()[_0x653a('0x2e')](respondWithResult(_0x2b3ee2,null))[_0x653a('0x51')](handleError(_0x2b3ee2,null));};exports['getMembers']=function(_0x1fb386,_0xc31096,_0x4568c7){var _0x3d77e8={'raw':!![],'where':{}},_0x1f150c={},_0x1c2635;return db[_0x653a('0x4c')]['findOne']({'where':{'id':_0x1fb386[_0x653a('0x5b')]['id']}})['then'](handleEntityNotFound(_0xc31096,null))[_0x653a('0x2e')](function(_0x5caba5){if(_0x5caba5){_0x1c2635=_0x5caba5[_0x653a('0x54')]({'plain':!![]});_0x1f150c[_0x653a('0x3a')]=_[_0x653a('0x3b')](db[_0x653a('0x5d')][_0x653a('0x37')]);_0x1f150c[_0x653a('0x3d')]=_[_0x653a('0x3b')](_0x1fb386['query']);_0x1f150c[_0x653a('0x3c')]=_[_0x653a('0x3e')](_0x1f150c[_0x653a('0x3a')],_0x1f150c['query']);_0x3d77e8[_0x653a('0x40')]=_[_0x653a('0x3e')](_0x1f150c[_0x653a('0x3a')],qs[_0x653a('0x3f')](_0x1fb386[_0x653a('0x3d')]['fields']));_0x3d77e8[_0x653a('0x40')]=_0x3d77e8['attributes'][_0x653a('0x41')]?_0x3d77e8['attributes']:_0x1f150c[_0x653a('0x3a')];if(!_0x1fb386[_0x653a('0x3d')][_0x653a('0x5e')]('nolimit')){_0x3d77e8[_0x653a('0x43')]=qs[_0x653a('0x43')](_0x1fb386[_0x653a('0x3d')][_0x653a('0x43')]);_0x3d77e8[_0x653a('0x24')]=qs[_0x653a('0x24')](_0x1fb386[_0x653a('0x3d')][_0x653a('0x24')]);}_0x3d77e8[_0x653a('0x44')]=qs[_0x653a('0x45')](_0x1fb386[_0x653a('0x3d')][_0x653a('0x45')]);_0x3d77e8['where']=qs[_0x653a('0x3c')](_[_0x653a('0x47')](_0x1fb386[_0x653a('0x3d')],_0x1f150c[_0x653a('0x3c')]));_0x3d77e8[_0x653a('0x46')][_0x653a('0x5f')]=_0x5caba5['id'];if(_0x1fb386[_0x653a('0x3d')][_0x653a('0x48')]){_0x3d77e8[_0x653a('0x46')]=_[_0x653a('0x49')](_0x3d77e8['where'],{'$or':_['map'](_0x3d77e8[_0x653a('0x40')],function(_0x3b998c){var _0x3e83b4={};_0x3e83b4[_0x3b998c]={'$like':'%'+_0x1fb386[_0x653a('0x3d')][_0x653a('0x48')]+'%'};return _0x3e83b4;})});}_0x3d77e8=_[_0x653a('0x49')]({},_0x3d77e8,_0x1fb386[_0x653a('0x4b')]);return db[_0x653a('0x5d')]['findAll'](_0x3d77e8);}})[_0x653a('0x2e')](function(_0x25d991){if(_0x25d991){return db[_0x653a('0x60')][_0x653a('0x61')]({'where':{'id':_[_0x653a('0x36')](_0x25d991,_0x653a('0x62')),'role':_0x653a('0x63')},'attributes':['id',_0x653a('0x33'),_0x653a('0x64'),_0x653a('0x65'),_0x653a('0x66')]});}})[_0x653a('0x2e')](function(_0x50df0e){if(_0x50df0e){return{'count':_0x50df0e[_0x653a('0x26')],'rows':_[_0x653a('0x36')](_0x50df0e[_0x653a('0x50')],function(_0x13048c){return{'membername':_0x13048c[_0x653a('0x33')],'UserId':_0x13048c['id'],'queue_name':_0x1c2635[_0x653a('0x33')],'MailQueueId':_0x1c2635['id'],'interface':util[_0x653a('0x67')]('%s/%s',_0x653a('0x68'),_0x13048c['name']),'penalty':0x0,'paused':_0x13048c['mailPause'],'createdAt':_0x13048c[_0x653a('0x66')],'updatedAt':_0x13048c['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x653a('0x2e')](respondWithFilteredResult(_0xc31096,_0x3d77e8))[_0x653a('0x51')](handleError(_0xc31096,null));};exports[_0x653a('0x69')]=function(_0x2ddc2a,_0x298bfa,_0x341328){var _0xbda8fc={};var _0x159426={};var _0x31e4e4;var _0x32d334;return db[_0x653a('0x4c')]['findOne']({'where':{'id':_0x2ddc2a['params']['id']}})[_0x653a('0x2e')](handleEntityNotFound(_0x298bfa,null))[_0x653a('0x2e')](function(_0x4c178d){if(_0x4c178d){_0x31e4e4=_0x4c178d;_0x159426[_0x653a('0x3a')]=_[_0x653a('0x3b')](db[_0x653a('0x6a')]['rawAttributes']);_0x159426[_0x653a('0x3d')]=_[_0x653a('0x3b')](_0x2ddc2a[_0x653a('0x3d')]);_0x159426[_0x653a('0x3c')]=_[_0x653a('0x3e')](_0x159426['model'],_0x159426['query']);_0xbda8fc['attributes']=_['intersection'](_0x159426['model'],qs['fields'](_0x2ddc2a['query']['fields']));_0xbda8fc[_0x653a('0x40')]=_0xbda8fc['attributes'][_0x653a('0x41')]?_0xbda8fc[_0x653a('0x40')]:_0x159426[_0x653a('0x3a')];_0xbda8fc['order']=qs['sort'](_0x2ddc2a[_0x653a('0x3d')][_0x653a('0x45')]);_0xbda8fc[_0x653a('0x46')]=qs[_0x653a('0x3c')](_[_0x653a('0x47')](_0x2ddc2a[_0x653a('0x3d')],_0x159426[_0x653a('0x3c')]));if(_0x2ddc2a[_0x653a('0x3d')][_0x653a('0x48')]){_0xbda8fc[_0x653a('0x46')]=_[_0x653a('0x49')](_0xbda8fc[_0x653a('0x46')],{'$or':_[_0x653a('0x36')](_0xbda8fc[_0x653a('0x40')],function(_0x19231b){var _0x580acf={};_0x580acf[_0x19231b]={'$like':'%'+_0x2ddc2a[_0x653a('0x3d')][_0x653a('0x48')]+'%'};return _0x580acf;})});}_0xbda8fc=_[_0x653a('0x49')]({},_0xbda8fc,_0x2ddc2a[_0x653a('0x4b')]);return _0x31e4e4['getTeams'](_0xbda8fc);}})[_0x653a('0x2e')](function(_0x496a98){if(_0x496a98){_0x32d334=_0x496a98[_0x653a('0x41')];if(!_0x2ddc2a[_0x653a('0x3d')][_0x653a('0x5e')](_0x653a('0x42'))){_0xbda8fc['limit']=qs[_0x653a('0x43')](_0x2ddc2a[_0x653a('0x3d')][_0x653a('0x43')]);_0xbda8fc[_0x653a('0x24')]=qs[_0x653a('0x24')](_0x2ddc2a[_0x653a('0x3d')][_0x653a('0x24')]);}return _0x31e4e4[_0x653a('0x69')](_0xbda8fc);}})[_0x653a('0x2e')](function(_0x12e6bf){if(_0x12e6bf){return _0x12e6bf?{'count':_0x32d334,'rows':_0x12e6bf}:null;}})[_0x653a('0x2e')](respondWithResult(_0x298bfa,null))[_0x653a('0x51')](handleError(_0x298bfa,null));};exports[_0x653a('0x6b')]=function(_0x958a6d,_0x3d3931,_0x29aa37){var _0x45e673=_0x958a6d[_0x653a('0x52')][_0x653a('0x6c')];return db[_0x653a('0x6a')][_0x653a('0x4f')]({'where':{'id':_0x45e673},'attributes':['id'],'include':[{'model':db[_0x653a('0x60')],'as':_0x653a('0x6d'),'attributes':['id',_0x653a('0x33'),_0x653a('0x6e'),'voicePause',_0x653a('0x6f')],'raw':!![]}]})[_0x653a('0x2e')](function(_0x2e103d){if(_0x2e103d){var _0xd496af=_[_0x653a('0x70')](_0x2e103d,function(_0x560422){var _0x4ccc02=_0x560422['get']({'plain':!![]});return _0x4ccc02[_0x653a('0x6d')];});return db[_0x653a('0x4c')]['find']({'where':{'id':_0x958a6d[_0x653a('0x5b')]['id']}})[_0x653a('0x2e')](function(_0x5e7f79){return db['sequelize'][_0x653a('0x71')](function(_0x2110fa){return _0x5e7f79[_0x653a('0x6b')](_0x45e673,{'transaction':_0x2110fa})[_0x653a('0x2e')](function(){return BPromise['each'](_0xd496af,function(_0x347a7f){return db['UserMailQueue']['findOrCreate']({'where':{'UserId':_0x347a7f['id'],'MailQueueId':_0x958a6d[_0x653a('0x5b')]['id']},'transaction':_0x2110fa});});})[_0x653a('0x2e')](function(){_0xd496af[_0x653a('0x72')](function(_0x13a22f){socket[_0x653a('0x73')](_0x653a('0x74'),{'UserId':_0x13a22f['id'],'MailQueueId':_0x5e7f79['id']});});});});});}})['then'](respondWithStatusCode(_0x3d3931,null))[_0x653a('0x51')](handleError(_0x3d3931,null));};exports['removeTeams']=function(_0x1e75f4,_0x5933e2,_0x29221c){return db[_0x653a('0x6a')][_0x653a('0x4f')]({'where':{'id':_0x1e75f4[_0x653a('0x3d')][_0x653a('0x6c')]},'attributes':['id'],'include':[{'model':db[_0x653a('0x60')],'as':_0x653a('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x653a('0x2e')](handleEntityNotFound(_0x5933e2,null))[_0x653a('0x2e')](function(_0x299843){var _0x322c4d=_[_0x653a('0x36')](_0x299843,'id');var _0x275ba4=[];var _0x85ef1f=[];var _0x5c10d4=squel[_0x653a('0x75')]();_0x5c10d4[_0x653a('0x76')]('tq.TeamId')[_0x653a('0x77')]('team_has_mail_queues','tq')[_0x653a('0x78')](_0x653a('0x79'),'ut',_0x653a('0x7a'))[_0x653a('0x46')]('MailQueueId\x20=\x20?',_0x1e75f4[_0x653a('0x5b')]['id']);for(var _0x3f0223=0x0;_0x3f0223<_0x299843[_0x653a('0x41')];_0x3f0223+=0x1){let _0x587b47=_0x299843[_0x3f0223];for(var _0x59bc97=0x0;_0x59bc97<_0x587b47[_0x653a('0x6d')]['length'];_0x59bc97+=0x1){let _0x704d=_0x587b47[_0x653a('0x6d')][_0x59bc97];var _0x5a896b=_0x5c10d4[_0x653a('0x7b')]();_0x5a896b[_0x653a('0x46')](_0x653a('0x7c'),_0x704d['id']);_0x85ef1f[_0x653a('0x7d')](db['sequelize'][_0x653a('0x3d')](_0x5a896b[_0x653a('0x7e')](),{'type':db[_0x653a('0x7f')][_0x653a('0x80')][_0x653a('0x81')]})['then'](function(_0x1c6340){if(_0x1c6340[_0x653a('0x41')]===0x1){return _0x704d['id'];}else{var _0x564491=_[_0x653a('0x82')](_[_0x653a('0x36')](_0x1c6340,_0x653a('0x83')),function(_0x4e0079){return _['includes'](_0x322c4d,_0x4e0079);});if(_0x564491){return _0x704d['id'];}}}));}}return BPromise[_0x653a('0x84')](_0x85ef1f)[_0x653a('0x2e')](function(_0x31421b){_0x275ba4=_(_0x275ba4)[_0x653a('0x85')](_0x31421b)[_0x653a('0x86')]()[_0x653a('0x87')]();return db['MailQueue'][_0x653a('0x57')]({'where':{'id':_0x1e75f4[_0x653a('0x5b')]['id']}})['then'](function(_0x49db98){return db[_0x653a('0x7f')][_0x653a('0x71')](function(_0x336369){return _0x49db98[_0x653a('0x88')](_0x1e75f4['query'][_0x653a('0x6c')],{'transaction':_0x336369})[_0x653a('0x2e')](function(){if(!_[_0x653a('0x89')](_0x275ba4)){return _0x49db98['removeAgents'](_0x275ba4,{'transaction':_0x336369});}})['then'](function(){_0x275ba4['forEach'](function(_0x61a0e1){socket[_0x653a('0x73')](_0x653a('0x8a'),{'UserId':_0x61a0e1,'MailQueueId':_0x49db98['id']});});});});});});})['then'](respondWithStatusCode(_0x5933e2,null))[_0x653a('0x51')](handleError(_0x5933e2,null));};exports[_0x653a('0x8b')]=function(_0x288bf6,_0x30392d,_0x4ec6e3){return db[_0x653a('0x4c')][_0x653a('0x57')]({'where':{'id':_0x288bf6['params']['id']}})['then'](handleEntityNotFound(_0x30392d,null))[_0x653a('0x2e')](function(_0x1c0d22){if(_0x1c0d22){return _0x1c0d22['addAgents'](_0x288bf6[_0x653a('0x52')]['ids'],_[_0x653a('0x8c')](_0x288bf6[_0x653a('0x52')],[_0x653a('0x6c'),'id'])||{})[_0x653a('0x8d')](function(_0x52e31d){for(var _0x210f94=0x0;_0x210f94<_0x288bf6[_0x653a('0x52')][_0x653a('0x6c')][_0x653a('0x41')];_0x210f94+=0x1){socket[_0x653a('0x73')](_0x653a('0x74'),{'UserId':Number(_0x288bf6[_0x653a('0x52')][_0x653a('0x6c')][_0x210f94]),'MailQueueId':Number(_0x288bf6[_0x653a('0x5b')]['id'])});}return _0x52e31d;});}})[_0x653a('0x2e')](respondWithResult(_0x30392d,null))['catch'](handleError(_0x30392d,null));};exports[_0x653a('0x8e')]=function(_0x4e3b04,_0x545276,_0x30e0d8){return db[_0x653a('0x4c')]['find']({'where':{'id':_0x4e3b04[_0x653a('0x5b')]['id']}})[_0x653a('0x2e')](handleEntityNotFound(_0x545276,null))[_0x653a('0x2e')](function(_0x37b982){if(_0x37b982){return _0x37b982[_0x653a('0x8e')](_0x4e3b04['query'][_0x653a('0x6c')])[_0x653a('0x2e')](function(){if(_[_0x653a('0x8f')](_0x4e3b04['query']['ids'])){for(var _0x5cd05b=0x0;_0x5cd05b<_0x4e3b04[_0x653a('0x3d')][_0x653a('0x6c')][_0x653a('0x41')];_0x5cd05b+=0x1){socket[_0x653a('0x73')](_0x653a('0x8a'),{'UserId':Number(_0x4e3b04['query'][_0x653a('0x6c')][_0x5cd05b]),'MailQueueId':Number(_0x4e3b04[_0x653a('0x5b')]['id'])});}}else{socket['emit'](_0x653a('0x8a'),{'UserId':Number(_0x4e3b04[_0x653a('0x3d')][_0x653a('0x6c')]),'MailQueueId':Number(_0x4e3b04['params']['id'])});}});}})[_0x653a('0x2e')](respondWithStatusCode(_0x545276,null))[_0x653a('0x51')](handleError(_0x545276,null));};exports[_0x653a('0x90')]=function(_0x4daa6a,_0x4b038c,_0x519709){var _0x40e03a={};var _0x480d76={};var _0x1b933d;var _0x14cd1b;return db[_0x653a('0x4c')][_0x653a('0x91')]({'where':{'id':_0x4daa6a[_0x653a('0x5b')]['id']}})[_0x653a('0x2e')](handleEntityNotFound(_0x4b038c,null))['then'](function(_0x3d0714){if(_0x3d0714){_0x1b933d=_0x3d0714;_0x480d76[_0x653a('0x3a')]=_[_0x653a('0x3b')](db['User'][_0x653a('0x37')]);_0x480d76[_0x653a('0x3d')]=_[_0x653a('0x3b')](_0x4daa6a['query']);_0x480d76[_0x653a('0x3c')]=_[_0x653a('0x3e')](_0x480d76[_0x653a('0x3a')],_0x480d76[_0x653a('0x3d')]);_0x40e03a[_0x653a('0x40')]=_[_0x653a('0x3e')](_0x480d76[_0x653a('0x3a')],qs['fields'](_0x4daa6a['query']['fields']));_0x40e03a['attributes']=_0x40e03a[_0x653a('0x40')][_0x653a('0x41')]?_0x40e03a[_0x653a('0x40')]:_0x480d76[_0x653a('0x3a')];_0x40e03a['order']=qs[_0x653a('0x45')](_0x4daa6a[_0x653a('0x3d')][_0x653a('0x45')]);_0x40e03a[_0x653a('0x46')]=qs['filters'](_[_0x653a('0x47')](_0x4daa6a[_0x653a('0x3d')],_0x480d76[_0x653a('0x3c')]));if(_0x4daa6a['query'][_0x653a('0x48')]){_0x40e03a[_0x653a('0x46')]=_[_0x653a('0x49')](_0x40e03a[_0x653a('0x46')],{'$or':_[_0x653a('0x36')](_0x40e03a[_0x653a('0x40')],function(_0x38f167){var _0x3c2310={};_0x3c2310[_0x38f167]={'$like':'%'+_0x4daa6a[_0x653a('0x3d')][_0x653a('0x48')]+'%'};return _0x3c2310;})});}_0x40e03a=_[_0x653a('0x49')]({},_0x40e03a,_0x4daa6a[_0x653a('0x4b')]);return _0x1b933d['getAgents'](_0x40e03a);}})['then'](function(_0x17ff56){if(_0x17ff56){_0x14cd1b=_0x17ff56[_0x653a('0x41')];if(!_0x4daa6a[_0x653a('0x3d')]['hasOwnProperty'](_0x653a('0x42'))){_0x40e03a['limit']=qs[_0x653a('0x43')](_0x4daa6a[_0x653a('0x3d')][_0x653a('0x43')]);_0x40e03a[_0x653a('0x24')]=qs[_0x653a('0x24')](_0x4daa6a[_0x653a('0x3d')][_0x653a('0x24')]);}return _0x1b933d[_0x653a('0x90')](_0x40e03a);}})[_0x653a('0x2e')](function(_0x374374){if(_0x374374){return _0x374374?{'count':_0x14cd1b,'rows':_0x374374}:null;}})['then'](respondWithResult(_0x4b038c,null))[_0x653a('0x51')](handleError(_0x4b038c,null));}; \ No newline at end of file +var _0x5d4d=['sequelize','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','field','tq.TeamId','team_has_mail_queues','join','user_has_teams','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','transaction','isEmpty','userMailQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','get','MailQueues','UserProfileResource','error','name','send','index','type','model','map','query','keys','filters','attributes','intersection','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','MailQueue','includeAll','findAll','rows','show','params','rawAttributes','fields','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','catch','describe','getMembers','UserMailQueue','nolimit','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','findOne','Team','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap'];(function(_0x590e1c,_0x5e39a7){var _0xcb4779=function(_0x4ce181){while(--_0x4ce181){_0x590e1c['push'](_0x590e1c['shift']());}};_0xcb4779(++_0x5e39a7);}(_0x5d4d,0xb4));var _0xd5d4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d4d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xd5d4('0x0'));var rimraf=require(_0xd5d4('0x1'));var zipdir=require(_0xd5d4('0x2'));var jsonpatch=require(_0xd5d4('0x3'));var rp=require(_0xd5d4('0x4'));var moment=require(_0xd5d4('0x5'));var BPromise=require(_0xd5d4('0x6'));var Mustache=require(_0xd5d4('0x7'));var util=require(_0xd5d4('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xd5d4('0x9'));var ejs=require(_0xd5d4('0xa'));var fs=require('fs');var fs_extra=require(_0xd5d4('0xb'));var _=require('lodash');var squel=require(_0xd5d4('0xc'));var crypto=require(_0xd5d4('0xd'));var jsforce=require(_0xd5d4('0xe'));var deskjs=require(_0xd5d4('0xf'));var toCsv=require(_0xd5d4('0x9'));var querystring=require(_0xd5d4('0x10'));var Papa=require(_0xd5d4('0x11'));var Redis=require(_0xd5d4('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd5d4('0x13'));var as=require(_0xd5d4('0x14'));var hardwareService=require(_0xd5d4('0x15'));var logger=require('../../config/logger')(_0xd5d4('0x16'));var utils=require(_0xd5d4('0x17'));var config=require(_0xd5d4('0x18'));var licenseUtil=require(_0xd5d4('0x19'));var db=require(_0xd5d4('0x1a'))['db'];config[_0xd5d4('0x1b')]=_[_0xd5d4('0x1c')](config[_0xd5d4('0x1b')],{'host':_0xd5d4('0x1d'),'port':0x18eb});var socket=require(_0xd5d4('0x1e'))(new Redis(config[_0xd5d4('0x1b')]));require('./mailQueue.socket')[_0xd5d4('0x1f')](socket);function respondWithStatusCode(_0x13acea,_0x36a47a){_0x36a47a=_0x36a47a||0xcc;return function(_0x1d711d){if(_0x1d711d){return _0x13acea[_0xd5d4('0x20')](_0x36a47a);}return _0x13acea[_0xd5d4('0x21')](_0x36a47a)[_0xd5d4('0x22')]();};}function respondWithResult(_0x4044c9,_0x3cafac){_0x3cafac=_0x3cafac||0xc8;return function(_0xba251e){if(_0xba251e){return _0x4044c9[_0xd5d4('0x21')](_0x3cafac)[_0xd5d4('0x23')](_0xba251e);}};}function respondWithFilteredResult(_0x5c9611,_0x4a1dab){return function(_0x3b4fbc){if(_0x3b4fbc){var _0x176e03=typeof _0x4a1dab[_0xd5d4('0x24')]===_0xd5d4('0x25')&&typeof _0x4a1dab[_0xd5d4('0x26')]===_0xd5d4('0x25');var _0x572e7a=_0x3b4fbc[_0xd5d4('0x27')];var _0x5b9ee5=_0x176e03?0x0:_0x4a1dab[_0xd5d4('0x24')];var _0x15c600=_0x176e03?_0x3b4fbc[_0xd5d4('0x27')]:_0x4a1dab['offset']+_0x4a1dab[_0xd5d4('0x26')];var _0x3622e2;if(_0x15c600>=_0x572e7a){_0x15c600=_0x572e7a;_0x3622e2=0xc8;}else{_0x3622e2=0xce;}_0x5c9611['status'](_0x3622e2);return _0x5c9611['set'](_0xd5d4('0x28'),_0x5b9ee5+'-'+_0x15c600+'/'+_0x572e7a)[_0xd5d4('0x23')](_0x3b4fbc);}return null;};}function patchUpdates(_0x5d0f03){return function(_0x556964){try{jsonpatch[_0xd5d4('0x29')](_0x556964,_0x5d0f03,!![]);}catch(_0x4817ef){return BPromise['reject'](_0x4817ef);}return _0x556964[_0xd5d4('0x2a')]();};}function saveUpdates(_0x224bfe,_0x2a9f88){return function(_0x2f96d8){if(_0x2f96d8){return _0x2f96d8[_0xd5d4('0x2b')](_0x224bfe)[_0xd5d4('0x2c')](function(_0x4d9219){return _0x4d9219;});}return null;};}function removeEntity(_0x49b223,_0x4bb6f2){return function(_0x4cceb8){if(_0x4cceb8){return _0x4cceb8[_0xd5d4('0x2d')]()[_0xd5d4('0x2c')](function(){var _0x340dcb=_0x4cceb8[_0xd5d4('0x2e')]({'plain':!![]});var _0x27aaf9=_0xd5d4('0x2f');return db[_0xd5d4('0x30')][_0xd5d4('0x2d')]({'where':{'type':_0x27aaf9,'resourceId':_0x340dcb['id']}})[_0xd5d4('0x2c')](function(){return _0x4cceb8;});})[_0xd5d4('0x2c')](function(){_0x49b223[_0xd5d4('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22d2c1,_0x363e62){return function(_0x3f9e5a){if(!_0x3f9e5a){_0x22d2c1[_0xd5d4('0x20')](0x194);}return _0x3f9e5a;};}function handleError(_0xc17564,_0x3439e3){_0x3439e3=_0x3439e3||0x1f4;return function(_0x55a8e0){logger[_0xd5d4('0x31')](_0x55a8e0['stack']);if(_0x55a8e0[_0xd5d4('0x32')]){delete _0x55a8e0[_0xd5d4('0x32')];}_0xc17564['status'](_0x3439e3)[_0xd5d4('0x33')](_0x55a8e0);};}exports[_0xd5d4('0x34')]=function(_0x20e702,_0x10f2b2){var _0x42b4a8={},_0x3ec76a={},_0x359e6a={'count':0x0,'rows':[]};var _0xe0b8fd=_['map'](db['MailQueue']['rawAttributes'],function(_0x18d7bb){return{'name':_0x18d7bb['fieldName'],'type':_0x18d7bb[_0xd5d4('0x35')]['key']};});_0x3ec76a[_0xd5d4('0x36')]=_[_0xd5d4('0x37')](_0xe0b8fd,_0xd5d4('0x32'));_0x3ec76a[_0xd5d4('0x38')]=_[_0xd5d4('0x39')](_0x20e702[_0xd5d4('0x38')]);_0x3ec76a[_0xd5d4('0x3a')]=_['intersection'](_0x3ec76a[_0xd5d4('0x36')],_0x3ec76a[_0xd5d4('0x38')]);_0x42b4a8[_0xd5d4('0x3b')]=_[_0xd5d4('0x3c')](_0x3ec76a[_0xd5d4('0x36')],qs['fields'](_0x20e702[_0xd5d4('0x38')]['fields']));_0x42b4a8[_0xd5d4('0x3b')]=_0x42b4a8[_0xd5d4('0x3b')][_0xd5d4('0x3d')]?_0x42b4a8[_0xd5d4('0x3b')]:_0x3ec76a[_0xd5d4('0x36')];if(!_0x20e702['query'][_0xd5d4('0x3e')]('nolimit')){_0x42b4a8[_0xd5d4('0x26')]=qs[_0xd5d4('0x26')](_0x20e702['query']['limit']);_0x42b4a8[_0xd5d4('0x24')]=qs[_0xd5d4('0x24')](_0x20e702[_0xd5d4('0x38')][_0xd5d4('0x24')]);}_0x42b4a8[_0xd5d4('0x3f')]=qs[_0xd5d4('0x40')](_0x20e702[_0xd5d4('0x38')][_0xd5d4('0x40')]);_0x42b4a8[_0xd5d4('0x41')]=qs[_0xd5d4('0x3a')](_[_0xd5d4('0x42')](_0x20e702[_0xd5d4('0x38')],_0x3ec76a[_0xd5d4('0x3a')]),_0xe0b8fd);if(_0x20e702[_0xd5d4('0x38')][_0xd5d4('0x43')]){_0x42b4a8[_0xd5d4('0x41')]=_['merge'](_0x42b4a8[_0xd5d4('0x41')],{'$or':_[_0xd5d4('0x37')](_0xe0b8fd,function(_0x9e95f4){if(_0x9e95f4[_0xd5d4('0x35')]!==_0xd5d4('0x44')){var _0x45f717={};_0x45f717[_0x9e95f4['name']]={'$like':'%'+_0x20e702['query'][_0xd5d4('0x43')]+'%'};return _0x45f717;}})});}_0x42b4a8=_[_0xd5d4('0x45')]({},_0x42b4a8,_0x20e702[_0xd5d4('0x46')]);var _0x530e22={'where':_0x42b4a8[_0xd5d4('0x41')]};return db[_0xd5d4('0x47')][_0xd5d4('0x27')](_0x530e22)[_0xd5d4('0x2c')](function(_0x3229e7){_0x359e6a[_0xd5d4('0x27')]=_0x3229e7;if(_0x20e702['query'][_0xd5d4('0x48')]){_0x42b4a8['include']=[{'all':!![]}];}return db[_0xd5d4('0x47')][_0xd5d4('0x49')](_0x42b4a8);})[_0xd5d4('0x2c')](function(_0xd705a9){_0x359e6a[_0xd5d4('0x4a')]=_0xd705a9;return _0x359e6a;})[_0xd5d4('0x2c')](respondWithFilteredResult(_0x10f2b2,_0x42b4a8))['catch'](handleError(_0x10f2b2,null));};exports[_0xd5d4('0x4b')]=function(_0x11ab2e,_0x57bc92){var _0x45c798={'raw':!![],'where':{'id':_0x11ab2e[_0xd5d4('0x4c')]['id']}},_0x256d77={};_0x256d77['model']=_[_0xd5d4('0x39')](db['MailQueue'][_0xd5d4('0x4d')]);_0x256d77[_0xd5d4('0x38')]=_[_0xd5d4('0x39')](_0x11ab2e[_0xd5d4('0x38')]);_0x256d77[_0xd5d4('0x3a')]=_[_0xd5d4('0x3c')](_0x256d77[_0xd5d4('0x36')],_0x256d77[_0xd5d4('0x38')]);_0x45c798[_0xd5d4('0x3b')]=_[_0xd5d4('0x3c')](_0x256d77[_0xd5d4('0x36')],qs[_0xd5d4('0x4e')](_0x11ab2e[_0xd5d4('0x38')][_0xd5d4('0x4e')]));_0x45c798[_0xd5d4('0x3b')]=_0x45c798[_0xd5d4('0x3b')]['length']?_0x45c798[_0xd5d4('0x3b')]:_0x256d77['model'];if(_0x11ab2e[_0xd5d4('0x38')][_0xd5d4('0x48')]){_0x45c798['include']=[{'all':!![]}];}_0x45c798=_['merge']({},_0x45c798,_0x11ab2e[_0xd5d4('0x46')]);return db[_0xd5d4('0x47')]['find'](_0x45c798)['then'](handleEntityNotFound(_0x57bc92,null))['then'](respondWithResult(_0x57bc92,null))['catch'](handleError(_0x57bc92,null));};exports[_0xd5d4('0x4f')]=function(_0x4091bf,_0x87ab10){return db['MailQueue'][_0xd5d4('0x4f')](_0x4091bf[_0xd5d4('0x50')],{})[_0xd5d4('0x2c')](function(_0x1523b8){var _0x158ee5=_0x4091bf[_0xd5d4('0x51')]['get']({'plain':!![]});if(!_0x158ee5)throw new Error(_0xd5d4('0x52'));if(_0x158ee5[_0xd5d4('0x53')]==='user'){var _0x5c56d6=_0x1523b8['get']({'plain':!![]});var _0x210178='MailQueues';return db[_0xd5d4('0x54')][_0xd5d4('0x55')]({'where':{'name':_0x210178,'userProfileId':_0x158ee5['userProfileId']},'raw':!![]})[_0xd5d4('0x2c')](function(_0x476f5f){if(_0x476f5f&&_0x476f5f[_0xd5d4('0x56')]===0x0){return db[_0xd5d4('0x30')]['create']({'name':_0x5c56d6[_0xd5d4('0x32')],'resourceId':_0x5c56d6['id'],'type':_0x476f5f['name'],'sectionId':_0x476f5f['id']},{})[_0xd5d4('0x2c')](function(){return _0x1523b8;});}else{return _0x1523b8;}})[_0xd5d4('0x57')](function(_0x2b6f04){logger[_0xd5d4('0x31')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b6f04);throw _0x2b6f04;});}return _0x1523b8;})[_0xd5d4('0x2c')](respondWithResult(_0x87ab10,0xc9))['catch'](handleError(_0x87ab10,null));};exports[_0xd5d4('0x2b')]=function(_0x4e0f57,_0x38ae8f){if(_0x4e0f57[_0xd5d4('0x50')]['id']){delete _0x4e0f57['body']['id'];}return db[_0xd5d4('0x47')][_0xd5d4('0x55')]({'where':{'id':_0x4e0f57[_0xd5d4('0x4c')]['id']}})['then'](handleEntityNotFound(_0x38ae8f,null))[_0xd5d4('0x2c')](saveUpdates(_0x4e0f57[_0xd5d4('0x50')],null))[_0xd5d4('0x2c')](respondWithResult(_0x38ae8f,null))[_0xd5d4('0x57')](handleError(_0x38ae8f,null));};exports[_0xd5d4('0x2d')]=function(_0x229259,_0x242d6e){return db[_0xd5d4('0x47')][_0xd5d4('0x55')]({'where':{'id':_0x229259[_0xd5d4('0x4c')]['id']}})[_0xd5d4('0x2c')](handleEntityNotFound(_0x242d6e,null))[_0xd5d4('0x2c')](removeEntity(_0x242d6e,null))[_0xd5d4('0x57')](handleError(_0x242d6e,null));};exports[_0xd5d4('0x58')]=function(_0x18a33c,_0x3e2d72){return db[_0xd5d4('0x47')][_0xd5d4('0x58')]()[_0xd5d4('0x2c')](respondWithResult(_0x3e2d72,null))[_0xd5d4('0x57')](handleError(_0x3e2d72,null));};exports[_0xd5d4('0x59')]=function(_0x4e02ef,_0x377382,_0x454f6c){var _0x1d5b93={'raw':!![],'where':{}},_0x2a02bf={},_0x225b6a;return db[_0xd5d4('0x47')]['findOne']({'where':{'id':_0x4e02ef['params']['id']}})['then'](handleEntityNotFound(_0x377382,null))[_0xd5d4('0x2c')](function(_0x3350f5){if(_0x3350f5){_0x225b6a=_0x3350f5[_0xd5d4('0x2e')]({'plain':!![]});_0x2a02bf[_0xd5d4('0x36')]=_['keys'](db[_0xd5d4('0x5a')][_0xd5d4('0x4d')]);_0x2a02bf[_0xd5d4('0x38')]=_[_0xd5d4('0x39')](_0x4e02ef['query']);_0x2a02bf['filters']=_[_0xd5d4('0x3c')](_0x2a02bf[_0xd5d4('0x36')],_0x2a02bf['query']);_0x1d5b93['attributes']=_[_0xd5d4('0x3c')](_0x2a02bf['model'],qs[_0xd5d4('0x4e')](_0x4e02ef['query']['fields']));_0x1d5b93[_0xd5d4('0x3b')]=_0x1d5b93[_0xd5d4('0x3b')][_0xd5d4('0x3d')]?_0x1d5b93['attributes']:_0x2a02bf[_0xd5d4('0x36')];if(!_0x4e02ef['query'][_0xd5d4('0x3e')](_0xd5d4('0x5b'))){_0x1d5b93[_0xd5d4('0x26')]=qs['limit'](_0x4e02ef[_0xd5d4('0x38')][_0xd5d4('0x26')]);_0x1d5b93['offset']=qs[_0xd5d4('0x24')](_0x4e02ef[_0xd5d4('0x38')][_0xd5d4('0x24')]);}_0x1d5b93[_0xd5d4('0x3f')]=qs[_0xd5d4('0x40')](_0x4e02ef[_0xd5d4('0x38')][_0xd5d4('0x40')]);_0x1d5b93[_0xd5d4('0x41')]=qs[_0xd5d4('0x3a')](_[_0xd5d4('0x42')](_0x4e02ef[_0xd5d4('0x38')],_0x2a02bf[_0xd5d4('0x3a')]));_0x1d5b93[_0xd5d4('0x41')]['MailQueueId']=_0x3350f5['id'];if(_0x4e02ef[_0xd5d4('0x38')]['filter']){_0x1d5b93[_0xd5d4('0x41')]=_[_0xd5d4('0x45')](_0x1d5b93[_0xd5d4('0x41')],{'$or':_[_0xd5d4('0x37')](_0x1d5b93[_0xd5d4('0x3b')],function(_0x4a5fe2){var _0x413467={};_0x413467[_0x4a5fe2]={'$like':'%'+_0x4e02ef[_0xd5d4('0x38')][_0xd5d4('0x43')]+'%'};return _0x413467;})});}_0x1d5b93=_[_0xd5d4('0x45')]({},_0x1d5b93,_0x4e02ef[_0xd5d4('0x46')]);return db[_0xd5d4('0x5a')][_0xd5d4('0x49')](_0x1d5b93);}})[_0xd5d4('0x2c')](function(_0x14d918){if(_0x14d918){return db[_0xd5d4('0x5c')][_0xd5d4('0x5d')]({'where':{'id':_[_0xd5d4('0x37')](_0x14d918,_0xd5d4('0x5e')),'role':_0xd5d4('0x5f')},'attributes':['id',_0xd5d4('0x32'),_0xd5d4('0x60'),_0xd5d4('0x61'),_0xd5d4('0x62')]});}})[_0xd5d4('0x2c')](function(_0x34ce22){if(_0x34ce22){return{'count':_0x34ce22[_0xd5d4('0x27')],'rows':_[_0xd5d4('0x37')](_0x34ce22[_0xd5d4('0x4a')],function(_0x24e63a){return{'membername':_0x24e63a[_0xd5d4('0x32')],'UserId':_0x24e63a['id'],'queue_name':_0x225b6a[_0xd5d4('0x32')],'MailQueueId':_0x225b6a['id'],'interface':util[_0xd5d4('0x63')](_0xd5d4('0x64'),_0xd5d4('0x65'),_0x24e63a[_0xd5d4('0x32')]),'penalty':0x0,'paused':_0x24e63a[_0xd5d4('0x60')],'createdAt':_0x24e63a[_0xd5d4('0x62')],'updatedAt':_0x24e63a[_0xd5d4('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd5d4('0x2c')](respondWithFilteredResult(_0x377382,_0x1d5b93))[_0xd5d4('0x57')](handleError(_0x377382,null));};exports['getTeams']=function(_0x582639,_0x2d85d5,_0x3461a7){var _0x10b033={};var _0x82773={};var _0x4822df;var _0x44ce3d;return db[_0xd5d4('0x47')][_0xd5d4('0x66')]({'where':{'id':_0x582639[_0xd5d4('0x4c')]['id']}})[_0xd5d4('0x2c')](handleEntityNotFound(_0x2d85d5,null))['then'](function(_0x186575){if(_0x186575){_0x4822df=_0x186575;_0x82773[_0xd5d4('0x36')]=_[_0xd5d4('0x39')](db[_0xd5d4('0x67')][_0xd5d4('0x4d')]);_0x82773[_0xd5d4('0x38')]=_[_0xd5d4('0x39')](_0x582639[_0xd5d4('0x38')]);_0x82773['filters']=_[_0xd5d4('0x3c')](_0x82773[_0xd5d4('0x36')],_0x82773[_0xd5d4('0x38')]);_0x10b033[_0xd5d4('0x3b')]=_[_0xd5d4('0x3c')](_0x82773['model'],qs[_0xd5d4('0x4e')](_0x582639[_0xd5d4('0x38')]['fields']));_0x10b033[_0xd5d4('0x3b')]=_0x10b033[_0xd5d4('0x3b')][_0xd5d4('0x3d')]?_0x10b033['attributes']:_0x82773['model'];_0x10b033[_0xd5d4('0x3f')]=qs[_0xd5d4('0x40')](_0x582639[_0xd5d4('0x38')]['sort']);_0x10b033[_0xd5d4('0x41')]=qs[_0xd5d4('0x3a')](_[_0xd5d4('0x42')](_0x582639[_0xd5d4('0x38')],_0x82773['filters']));if(_0x582639[_0xd5d4('0x38')][_0xd5d4('0x43')]){_0x10b033['where']=_[_0xd5d4('0x45')](_0x10b033[_0xd5d4('0x41')],{'$or':_[_0xd5d4('0x37')](_0x10b033['attributes'],function(_0x2b16fa){var _0x208e5d={};_0x208e5d[_0x2b16fa]={'$like':'%'+_0x582639[_0xd5d4('0x38')][_0xd5d4('0x43')]+'%'};return _0x208e5d;})});}_0x10b033=_['merge']({},_0x10b033,_0x582639[_0xd5d4('0x46')]);return _0x4822df[_0xd5d4('0x68')](_0x10b033);}})[_0xd5d4('0x2c')](function(_0x47f04d){if(_0x47f04d){_0x44ce3d=_0x47f04d[_0xd5d4('0x3d')];if(!_0x582639['query'][_0xd5d4('0x3e')](_0xd5d4('0x5b'))){_0x10b033[_0xd5d4('0x26')]=qs[_0xd5d4('0x26')](_0x582639[_0xd5d4('0x38')][_0xd5d4('0x26')]);_0x10b033['offset']=qs[_0xd5d4('0x24')](_0x582639[_0xd5d4('0x38')][_0xd5d4('0x24')]);}return _0x4822df[_0xd5d4('0x68')](_0x10b033);}})[_0xd5d4('0x2c')](function(_0x4317b9){if(_0x4317b9){return _0x4317b9?{'count':_0x44ce3d,'rows':_0x4317b9}:null;}})[_0xd5d4('0x2c')](respondWithResult(_0x2d85d5,null))[_0xd5d4('0x57')](handleError(_0x2d85d5,null));};exports[_0xd5d4('0x69')]=function(_0x38edc5,_0x274ed0,_0x551e15){var _0xb52f56=_0x38edc5['body'][_0xd5d4('0x6a')];return db[_0xd5d4('0x67')][_0xd5d4('0x49')]({'where':{'id':_0xb52f56},'attributes':['id'],'include':[{'model':db[_0xd5d4('0x5c')],'as':_0xd5d4('0x6b'),'attributes':['id',_0xd5d4('0x32'),_0xd5d4('0x6c'),_0xd5d4('0x6d'),_0xd5d4('0x6e')],'raw':!![]}]})[_0xd5d4('0x2c')](function(_0x32f44f){if(_0x32f44f){var _0x1a08b1=_[_0xd5d4('0x6f')](_0x32f44f,function(_0x5d5a02){var _0x3a65ee=_0x5d5a02[_0xd5d4('0x2e')]({'plain':!![]});return _0x3a65ee[_0xd5d4('0x6b')];});return db[_0xd5d4('0x47')][_0xd5d4('0x55')]({'where':{'id':_0x38edc5[_0xd5d4('0x4c')]['id']}})['then'](function(_0x400e38){return db[_0xd5d4('0x70')]['transaction'](function(_0x8ba5eb){return _0x400e38['addTeams'](_0xb52f56,{'transaction':_0x8ba5eb})['then'](function(){return BPromise[_0xd5d4('0x71')](_0x1a08b1,function(_0x404e28){return db[_0xd5d4('0x5a')][_0xd5d4('0x72')]({'where':{'UserId':_0x404e28['id'],'MailQueueId':_0x38edc5[_0xd5d4('0x4c')]['id']},'transaction':_0x8ba5eb});});})['then'](function(){_0x1a08b1[_0xd5d4('0x73')](function(_0x228d8f){socket[_0xd5d4('0x74')](_0xd5d4('0x75'),{'UserId':_0x228d8f['id'],'MailQueueId':_0x400e38['id']});});});});});}})['then'](respondWithStatusCode(_0x274ed0,null))['catch'](handleError(_0x274ed0,null));};exports[_0xd5d4('0x76')]=function(_0x5dc071,_0x55eaa2,_0x5724d6){return db[_0xd5d4('0x67')][_0xd5d4('0x49')]({'where':{'id':_0x5dc071[_0xd5d4('0x38')]['ids']},'attributes':['id'],'include':[{'model':db[_0xd5d4('0x5c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xd5d4('0x2c')](handleEntityNotFound(_0x55eaa2,null))[_0xd5d4('0x2c')](function(_0x4f98a1){var _0x56b00d=_['map'](_0x4f98a1,'id');var _0x5d6bfb=[];var _0x3e77ee=[];var _0x2255ff=squel[_0xd5d4('0x77')]();_0x2255ff[_0xd5d4('0x78')](_0xd5d4('0x79'))['from'](_0xd5d4('0x7a'),'tq')[_0xd5d4('0x7b')](_0xd5d4('0x7c'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xd5d4('0x41')](_0xd5d4('0x7d'),_0x5dc071[_0xd5d4('0x4c')]['id']);for(var _0x5f2ce6=0x0;_0x5f2ce6<_0x4f98a1[_0xd5d4('0x3d')];_0x5f2ce6+=0x1){let _0x4ba335=_0x4f98a1[_0x5f2ce6];for(var _0x16c6a7=0x0;_0x16c6a7<_0x4ba335['Agents'][_0xd5d4('0x3d')];_0x16c6a7+=0x1){let _0x3f958d=_0x4ba335['Agents'][_0x16c6a7];var _0x40c3a8=_0x2255ff[_0xd5d4('0x7e')]();_0x40c3a8[_0xd5d4('0x41')](_0xd5d4('0x7f'),_0x3f958d['id']);_0x3e77ee['push'](db[_0xd5d4('0x70')][_0xd5d4('0x38')](_0x40c3a8['toString'](),{'type':db[_0xd5d4('0x70')][_0xd5d4('0x80')][_0xd5d4('0x81')]})[_0xd5d4('0x2c')](function(_0x4ce6f0){if(_0x4ce6f0[_0xd5d4('0x3d')]===0x1){return _0x3f958d['id'];}else{var _0x4d295a=_[_0xd5d4('0x82')](_[_0xd5d4('0x37')](_0x4ce6f0,_0xd5d4('0x83')),function(_0x3d29a0){return _[_0xd5d4('0x84')](_0x56b00d,_0x3d29a0);});if(_0x4d295a){return _0x3f958d['id'];}}}));}}return BPromise[_0xd5d4('0x85')](_0x3e77ee)['then'](function(_0x5018da){_0x5d6bfb=_(_0x5d6bfb)[_0xd5d4('0x86')](_0x5018da)[_0xd5d4('0x87')]()[_0xd5d4('0x88')]();return db[_0xd5d4('0x47')][_0xd5d4('0x55')]({'where':{'id':_0x5dc071['params']['id']}})['then'](function(_0x5db3f1){return db[_0xd5d4('0x70')][_0xd5d4('0x89')](function(_0x226a5a){return _0x5db3f1[_0xd5d4('0x76')](_0x5dc071[_0xd5d4('0x38')][_0xd5d4('0x6a')],{'transaction':_0x226a5a})['then'](function(){if(!_[_0xd5d4('0x8a')](_0x5d6bfb)){return _0x5db3f1['removeAgents'](_0x5d6bfb,{'transaction':_0x226a5a});}})[_0xd5d4('0x2c')](function(){_0x5d6bfb[_0xd5d4('0x73')](function(_0x499c06){socket[_0xd5d4('0x74')](_0xd5d4('0x8b'),{'UserId':_0x499c06,'MailQueueId':_0x5db3f1['id']});});});});});});})[_0xd5d4('0x2c')](respondWithStatusCode(_0x55eaa2,null))[_0xd5d4('0x57')](handleError(_0x55eaa2,null));};exports[_0xd5d4('0x8c')]=function(_0x105514,_0x5cbfe2,_0x45fec8){return db[_0xd5d4('0x47')][_0xd5d4('0x55')]({'where':{'id':_0x105514['params']['id']}})['then'](handleEntityNotFound(_0x5cbfe2,null))['then'](function(_0x16b50a){if(_0x16b50a){return _0x16b50a[_0xd5d4('0x8c')](_0x105514[_0xd5d4('0x50')][_0xd5d4('0x6a')],_[_0xd5d4('0x8d')](_0x105514[_0xd5d4('0x50')],[_0xd5d4('0x6a'),'id'])||{})[_0xd5d4('0x8e')](function(_0x9890db){for(var _0x85075=0x0;_0x85075<_0x105514[_0xd5d4('0x50')][_0xd5d4('0x6a')][_0xd5d4('0x3d')];_0x85075+=0x1){socket[_0xd5d4('0x74')](_0xd5d4('0x75'),{'UserId':Number(_0x105514[_0xd5d4('0x50')][_0xd5d4('0x6a')][_0x85075]),'MailQueueId':Number(_0x105514['params']['id'])});}return _0x9890db;});}})[_0xd5d4('0x2c')](respondWithResult(_0x5cbfe2,null))['catch'](handleError(_0x5cbfe2,null));};exports[_0xd5d4('0x8f')]=function(_0x117648,_0x3f4f84,_0x1eef41){return db['MailQueue'][_0xd5d4('0x55')]({'where':{'id':_0x117648[_0xd5d4('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3f4f84,null))[_0xd5d4('0x2c')](function(_0x4e9708){if(_0x4e9708){return _0x4e9708[_0xd5d4('0x8f')](_0x117648['query'][_0xd5d4('0x6a')])['then'](function(){if(_[_0xd5d4('0x90')](_0x117648[_0xd5d4('0x38')][_0xd5d4('0x6a')])){for(var _0x209baa=0x0;_0x209baa<_0x117648[_0xd5d4('0x38')]['ids'][_0xd5d4('0x3d')];_0x209baa+=0x1){socket[_0xd5d4('0x74')]('userMailQueue:remove',{'UserId':Number(_0x117648[_0xd5d4('0x38')]['ids'][_0x209baa]),'MailQueueId':Number(_0x117648[_0xd5d4('0x4c')]['id'])});}}else{socket[_0xd5d4('0x74')]('userMailQueue:remove',{'UserId':Number(_0x117648[_0xd5d4('0x38')][_0xd5d4('0x6a')]),'MailQueueId':Number(_0x117648[_0xd5d4('0x4c')]['id'])});}});}})[_0xd5d4('0x2c')](respondWithStatusCode(_0x3f4f84,null))['catch'](handleError(_0x3f4f84,null));};exports[_0xd5d4('0x91')]=function(_0x5e3021,_0x4670cd,_0x180b51){var _0x47265e={};var _0x5ee0aa={};var _0x595990;var _0x38e4f2;return db[_0xd5d4('0x47')][_0xd5d4('0x66')]({'where':{'id':_0x5e3021[_0xd5d4('0x4c')]['id']}})[_0xd5d4('0x2c')](handleEntityNotFound(_0x4670cd,null))[_0xd5d4('0x2c')](function(_0x2fc6bf){if(_0x2fc6bf){_0x595990=_0x2fc6bf;_0x5ee0aa[_0xd5d4('0x36')]=_[_0xd5d4('0x39')](db[_0xd5d4('0x5c')][_0xd5d4('0x4d')]);_0x5ee0aa[_0xd5d4('0x38')]=_[_0xd5d4('0x39')](_0x5e3021[_0xd5d4('0x38')]);_0x5ee0aa['filters']=_[_0xd5d4('0x3c')](_0x5ee0aa[_0xd5d4('0x36')],_0x5ee0aa[_0xd5d4('0x38')]);_0x47265e[_0xd5d4('0x3b')]=_['intersection'](_0x5ee0aa['model'],qs[_0xd5d4('0x4e')](_0x5e3021[_0xd5d4('0x38')][_0xd5d4('0x4e')]));_0x47265e[_0xd5d4('0x3b')]=_0x47265e['attributes'][_0xd5d4('0x3d')]?_0x47265e[_0xd5d4('0x3b')]:_0x5ee0aa['model'];_0x47265e['order']=qs[_0xd5d4('0x40')](_0x5e3021[_0xd5d4('0x38')][_0xd5d4('0x40')]);_0x47265e['where']=qs[_0xd5d4('0x3a')](_[_0xd5d4('0x42')](_0x5e3021[_0xd5d4('0x38')],_0x5ee0aa[_0xd5d4('0x3a')]));if(_0x5e3021[_0xd5d4('0x38')][_0xd5d4('0x43')]){_0x47265e[_0xd5d4('0x41')]=_['merge'](_0x47265e[_0xd5d4('0x41')],{'$or':_[_0xd5d4('0x37')](_0x47265e['attributes'],function(_0x133c22){var _0x4b970c={};_0x4b970c[_0x133c22]={'$like':'%'+_0x5e3021['query'][_0xd5d4('0x43')]+'%'};return _0x4b970c;})});}_0x47265e=_['merge']({},_0x47265e,_0x5e3021['options']);return _0x595990[_0xd5d4('0x91')](_0x47265e);}})[_0xd5d4('0x2c')](function(_0xf72151){if(_0xf72151){_0x38e4f2=_0xf72151[_0xd5d4('0x3d')];if(!_0x5e3021[_0xd5d4('0x38')]['hasOwnProperty'](_0xd5d4('0x5b'))){_0x47265e['limit']=qs[_0xd5d4('0x26')](_0x5e3021['query'][_0xd5d4('0x26')]);_0x47265e['offset']=qs[_0xd5d4('0x24')](_0x5e3021[_0xd5d4('0x38')][_0xd5d4('0x24')]);}return _0x595990[_0xd5d4('0x91')](_0x47265e);}})[_0xd5d4('0x2c')](function(_0x1e5906){if(_0x1e5906){return _0x1e5906?{'count':_0x38e4f2,'rows':_0x1e5906}:null;}})[_0xd5d4('0x2c')](respondWithResult(_0x4670cd,null))[_0xd5d4('0x57')](handleError(_0x4670cd,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index c09649d..89346d6 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 _0x1cf3=['remove','emit','exports','events','setMaxListeners','save','update'];(function(_0x455b1a,_0x1bbbfb){var _0x392d69=function(_0x3bee33){while(--_0x3bee33){_0x455b1a['push'](_0x455b1a['shift']());}};_0x392d69(++_0x1bbbfb);}(_0x1cf3,0x1bc));var _0x31cf=function(_0x4a5a3c,_0x2a514c){_0x4a5a3c=_0x4a5a3c-0x0;var _0x1abb46=_0x1cf3[_0x4a5a3c];return _0x1abb46;};'use strict';var EventEmitter=require(_0x31cf('0x0'));var MailQueue=require('../../mysqldb')['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x31cf('0x1')](0x0);var events={'afterCreate':_0x31cf('0x2'),'afterUpdate':_0x31cf('0x3'),'afterDestroy':_0x31cf('0x4')};function emitEvent(_0x3fb00d){return function(_0x1e3417,_0x1b7289,_0x3f3e4d){MailQueueEvents[_0x31cf('0x5')](_0x3fb00d+':'+_0x1e3417['id'],_0x1e3417);MailQueueEvents['emit'](_0x3fb00d,_0x1e3417);_0x3f3e4d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x31cf('0x6')]=MailQueueEvents; \ No newline at end of file +var _0x77b9=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailQueue'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x77b9,0x101));var _0x977b=function(_0x550e8e,_0x5c6870){_0x550e8e=_0x550e8e-0x0;var _0x2c21a5=_0x77b9[_0x550e8e];return _0x2c21a5;};'use strict';var EventEmitter=require(_0x977b('0x0'));var MailQueue=require(_0x977b('0x1'))['db'][_0x977b('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x977b('0x3')](0x0);var events={'afterCreate':_0x977b('0x4'),'afterUpdate':'update','afterDestroy':_0x977b('0x5')};function emitEvent(_0x51c41f){return function(_0x5e8b51,_0x533e51,_0x44d1b6){MailQueueEvents['emit'](_0x51c41f+':'+_0x5e8b51['id'],_0x5e8b51);MailQueueEvents[_0x977b('0x6')](_0x51c41f,_0x5e8b51);_0x44d1b6(null);};}for(var e in events){if(events[_0x977b('0x7')](e)){var event=events[e];MailQueue[_0x977b('0x8')](e,emitEvent(event));}}module[_0x977b('0x9')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 48d07f5..2ed6ab7 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 _0xea1e=['./mailQueue.attributes','exports','define','mail_queues','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xea1e,0x190));var _0xeea1=function(_0x2bea00,_0x348b0a){_0x2bea00=_0x2bea00-0x0;var _0x112d51=_0xea1e[_0x2bea00];return _0x112d51;};'use strict';var _=require(_0xeea1('0x0'));var util=require('util');var logger=require(_0xeea1('0x1'))(_0xeea1('0x2'));var moment=require('moment');var BPromise=require(_0xeea1('0x3'));var rp=require(_0xeea1('0x4'));var fs=require('fs');var path=require(_0xeea1('0x5'));var rimraf=require('rimraf');var config=require(_0xeea1('0x6'));var attributes=require(_0xeea1('0x7'));module[_0xeea1('0x8')]=function(_0x28c062,_0x1bee60){return _0x28c062[_0xeea1('0x9')]('MailQueue',attributes,{'tableName':_0xeea1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0dc8=['../../config/environment','MailQueue','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x270427,_0x5d40d8){var _0x5d2357=function(_0x4c5131){while(--_0x4c5131){_0x270427['push'](_0x270427['shift']());}};_0x5d2357(++_0x5d40d8);}(_0x0dc8,0x89));var _0x80dc=function(_0x21b0ef,_0x2bec64){_0x21b0ef=_0x21b0ef-0x0;var _0x135500=_0x0dc8[_0x21b0ef];return _0x135500;};'use strict';var _=require(_0x80dc('0x0'));var util=require(_0x80dc('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x80dc('0x2'));var BPromise=require(_0x80dc('0x3'));var rp=require(_0x80dc('0x4'));var fs=require('fs');var path=require(_0x80dc('0x5'));var rimraf=require(_0x80dc('0x6'));var config=require(_0x80dc('0x7'));var attributes=require('./mailQueue.attributes');module['exports']=function(_0x588c23,_0x3705f3){return _0x588c23['define'](_0x80dc('0x8'),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 58fcaf6..63e449b 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 _0xda3d=['socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','GetMailQueue','findAll','options','raw','where','attributes','limit','map','include','model','MailQueue','find','ShowMailQueue','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','defaults','redis','localhost'];(function(_0x13de83,_0x55946f){var _0x28ffac=function(_0x1f863e){while(--_0x1f863e){_0x13de83['push'](_0x13de83['shift']());}};_0x28ffac(++_0x55946f);}(_0xda3d,0x1d7));var _0xdda3=function(_0xbc6eeb,_0x218549){_0xbc6eeb=_0xbc6eeb-0x0;var _0x261dad=_0xda3d[_0xbc6eeb];return _0x261dad;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdda3('0x0'));var BPromise=require('bluebird');var rs=require(_0xdda3('0x1'));var fs=require('fs');var Redis=require(_0xdda3('0x2'));var db=require(_0xdda3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xdda3('0x4'))('rpc');var config=require(_0xdda3('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xdda3('0x6')]['http']({'port':0x232a});config['redis']=_[_0xdda3('0x7')](config[_0xdda3('0x8')],{'host':_0xdda3('0x9'),'port':0x18eb});var socket=require(_0xdda3('0xa'))(new Redis(config[_0xdda3('0x8')]));require(_0xdda3('0xb'))[_0xdda3('0xc')](socket);function respondWithRpcPromise(_0xa4b4c2,_0x40dcac,_0x4788b1){return new BPromise(function(_0x28e180,_0x2bcbe1){return client[_0xdda3('0xd')](_0xa4b4c2,_0x4788b1)[_0xdda3('0xe')](function(_0x3077fb){logger[_0xdda3('0xf')](_0xdda3('0x10'),_0x40dcac,'request\x20sent');logger[_0xdda3('0x11')](_0xdda3('0x12'),_0x40dcac,_0xdda3('0x13'),JSON[_0xdda3('0x14')](_0x3077fb));if(_0x3077fb[_0xdda3('0x15')]){if(_0x3077fb[_0xdda3('0x15')]['code']===0x1f4){logger['error']('MailQueue,\x20%s,\x20%s',_0x40dcac,_0x3077fb[_0xdda3('0x15')]['message']);return _0x2bcbe1(_0x3077fb[_0xdda3('0x15')][_0xdda3('0x16')]);}logger[_0xdda3('0x15')](_0xdda3('0x10'),_0x40dcac,_0x3077fb['error']['message']);return _0x28e180(_0x3077fb[_0xdda3('0x15')][_0xdda3('0x16')]);}else{logger[_0xdda3('0xf')](_0xdda3('0x10'),_0x40dcac,_0xdda3('0x13'));_0x28e180(_0x3077fb['result'][_0xdda3('0x16')]);}})[_0xdda3('0x17')](function(_0xda5838){logger['error'](_0xdda3('0x10'),_0x40dcac,_0xda5838);_0x2bcbe1(_0xda5838);});});}exports[_0xdda3('0x18')]=function(_0xf11fdf){var _0x1b7074=this;return new Promise(function(_0x1e546e,_0x344c83){return db['MailQueue'][_0xdda3('0x19')]({'raw':_0xf11fdf[_0xdda3('0x1a')]?_0xf11fdf['options'][_0xdda3('0x1b')]===undefined?!![]:![]:!![],'where':_0xf11fdf[_0xdda3('0x1a')]?_0xf11fdf[_0xdda3('0x1a')][_0xdda3('0x1c')]||null:null,'attributes':_0xf11fdf[_0xdda3('0x1a')]?_0xf11fdf[_0xdda3('0x1a')][_0xdda3('0x1d')]||null:null,'limit':_0xf11fdf[_0xdda3('0x1a')]?_0xf11fdf['options'][_0xdda3('0x1e')]||null:null,'include':_0xf11fdf[_0xdda3('0x1a')]?_0xf11fdf['options']['include']?_[_0xdda3('0x1f')](_0xf11fdf[_0xdda3('0x1a')][_0xdda3('0x20')],function(_0x2cc584){return{'model':db[_0x2cc584['model']],'as':_0x2cc584['as'],'attributes':_0x2cc584[_0xdda3('0x1d')],'include':_0x2cc584[_0xdda3('0x20')]?_[_0xdda3('0x1f')](_0x2cc584[_0xdda3('0x20')],function(_0x51dd46){return{'model':db[_0x51dd46[_0xdda3('0x21')]],'as':_0x51dd46['as'],'attributes':_0x51dd46[_0xdda3('0x1d')],'include':_0x51dd46[_0xdda3('0x20')]?_[_0xdda3('0x1f')](_0x51dd46[_0xdda3('0x20')],function(_0x3cbc6a){return{'model':db[_0x3cbc6a[_0xdda3('0x21')]],'as':_0x3cbc6a['as'],'attributes':_0x3cbc6a['attributes']};}):[]};}):[]};}):[]:[]})[_0xdda3('0xe')](function(_0x3a0f90){logger[_0xdda3('0xf')](_0xdda3('0x18'),_0xf11fdf);logger['debug']('GetMailQueue',_0xf11fdf,JSON['stringify'](_0x3a0f90));_0x1e546e(_0x3a0f90);})[_0xdda3('0x17')](function(_0x36dbdb){logger['error']('GetMailQueue',_0x36dbdb[_0xdda3('0x16')],_0xf11fdf);_0x344c83(_0x1b7074[_0xdda3('0x15')](0x1f4,_0x36dbdb[_0xdda3('0x16')]));});});};exports['ShowMailQueue']=function(_0x4302de){var _0x6d0cba=this;return new Promise(function(_0x1b5bbb,_0x1ea317){return db[_0xdda3('0x22')][_0xdda3('0x23')]({'raw':_0x4302de[_0xdda3('0x1a')]?_0x4302de[_0xdda3('0x1a')][_0xdda3('0x1b')]===undefined?!![]:![]:!![],'where':_0x4302de['options']?_0x4302de['options'][_0xdda3('0x1c')]||null:null,'attributes':_0x4302de[_0xdda3('0x1a')]?_0x4302de[_0xdda3('0x1a')][_0xdda3('0x1d')]||null:null,'include':_0x4302de[_0xdda3('0x1a')]?_0x4302de[_0xdda3('0x1a')][_0xdda3('0x20')]?_[_0xdda3('0x1f')](_0x4302de[_0xdda3('0x1a')]['include'],function(_0x688570){return{'model':db[_0x688570[_0xdda3('0x21')]],'as':_0x688570['as'],'attributes':_0x688570[_0xdda3('0x1d')],'include':_0x688570[_0xdda3('0x20')]?_[_0xdda3('0x1f')](_0x688570[_0xdda3('0x20')],function(_0x1542db){return{'model':db[_0x1542db['model']],'as':_0x1542db['as'],'attributes':_0x1542db[_0xdda3('0x1d')],'include':_0x1542db[_0xdda3('0x20')]?_[_0xdda3('0x1f')](_0x1542db[_0xdda3('0x20')],function(_0x2aad4a){return{'model':db[_0x2aad4a[_0xdda3('0x21')]],'as':_0x2aad4a['as'],'attributes':_0x2aad4a[_0xdda3('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xdda3('0xe')](function(_0x31c2af){logger['info'](_0xdda3('0x24'),_0x4302de);logger[_0xdda3('0x11')](_0xdda3('0x24'),_0x4302de,JSON[_0xdda3('0x14')](_0x31c2af));_0x1b5bbb(_0x31c2af);})[_0xdda3('0x17')](function(_0x51e533){logger[_0xdda3('0x15')](_0xdda3('0x24'),_0x51e533[_0xdda3('0x16')],_0x4302de);_0x1ea317(_0x6d0cba[_0xdda3('0x15')](0x1f4,_0x51e533[_0xdda3('0x16')]));});});}; \ No newline at end of file +var _0xa0de=['map','model','attributes','ShowMailQueue','find','raw','where','lodash','bluebird','../../mysqldb','rpc','../../config/environment','client','redis','defaults','localhost','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailQueue','MailQueue','findAll','options','limit','include'];(function(_0x59c6a0,_0x427363){var _0x4d5d30=function(_0x1cb2c2){while(--_0x1cb2c2){_0x59c6a0['push'](_0x59c6a0['shift']());}};_0x4d5d30(++_0x427363);}(_0xa0de,0x1c3));var _0xea0d=function(_0x41017c,_0x385442){_0x41017c=_0x41017c-0x0;var _0x4d53d5=_0xa0de[_0x41017c];return _0x4d53d5;};'use strict';var _=require(_0xea0d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xea0d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xea0d('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xea0d('0x3'));var config=require(_0xea0d('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xea0d('0x5')]['http']({'port':0x232a});config[_0xea0d('0x6')]=_[_0xea0d('0x7')](config['redis'],{'host':_0xea0d('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xea0d('0x6')]));require(_0xea0d('0x9'))[_0xea0d('0xa')](socket);function respondWithRpcPromise(_0x2da359,_0xdb3c8e,_0x4d70b2){return new BPromise(function(_0x2c2fa2,_0x418043){return client[_0xea0d('0xb')](_0x2da359,_0x4d70b2)[_0xea0d('0xc')](function(_0xb226b7){logger[_0xea0d('0xd')](_0xea0d('0xe'),_0xdb3c8e,_0xea0d('0xf'));logger[_0xea0d('0x10')](_0xea0d('0x11'),_0xdb3c8e,'request\x20sent',JSON[_0xea0d('0x12')](_0xb226b7));if(_0xb226b7[_0xea0d('0x13')]){if(_0xb226b7[_0xea0d('0x13')][_0xea0d('0x14')]===0x1f4){logger[_0xea0d('0x13')](_0xea0d('0xe'),_0xdb3c8e,_0xb226b7[_0xea0d('0x13')][_0xea0d('0x15')]);return _0x418043(_0xb226b7[_0xea0d('0x13')][_0xea0d('0x15')]);}logger[_0xea0d('0x13')](_0xea0d('0xe'),_0xdb3c8e,_0xb226b7[_0xea0d('0x13')][_0xea0d('0x15')]);return _0x2c2fa2(_0xb226b7[_0xea0d('0x13')]['message']);}else{logger[_0xea0d('0xd')](_0xea0d('0xe'),_0xdb3c8e,'request\x20sent');_0x2c2fa2(_0xb226b7[_0xea0d('0x16')][_0xea0d('0x15')]);}})[_0xea0d('0x17')](function(_0x4acdb8){logger[_0xea0d('0x13')]('MailQueue,\x20%s,\x20%s',_0xdb3c8e,_0x4acdb8);_0x418043(_0x4acdb8);});});}exports[_0xea0d('0x18')]=function(_0x29b597){var _0x1f0bed=this;return new Promise(function(_0x5b4703,_0x4fd821){return db[_0xea0d('0x19')][_0xea0d('0x1a')]({'raw':_0x29b597[_0xea0d('0x1b')]?_0x29b597[_0xea0d('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x29b597['options']?_0x29b597[_0xea0d('0x1b')]['where']||null:null,'attributes':_0x29b597[_0xea0d('0x1b')]?_0x29b597[_0xea0d('0x1b')]['attributes']||null:null,'limit':_0x29b597[_0xea0d('0x1b')]?_0x29b597[_0xea0d('0x1b')][_0xea0d('0x1c')]||null:null,'include':_0x29b597['options']?_0x29b597[_0xea0d('0x1b')][_0xea0d('0x1d')]?_[_0xea0d('0x1e')](_0x29b597[_0xea0d('0x1b')][_0xea0d('0x1d')],function(_0x237048){return{'model':db[_0x237048[_0xea0d('0x1f')]],'as':_0x237048['as'],'attributes':_0x237048[_0xea0d('0x20')],'include':_0x237048[_0xea0d('0x1d')]?_[_0xea0d('0x1e')](_0x237048['include'],function(_0x293664){return{'model':db[_0x293664[_0xea0d('0x1f')]],'as':_0x293664['as'],'attributes':_0x293664[_0xea0d('0x20')],'include':_0x293664[_0xea0d('0x1d')]?_[_0xea0d('0x1e')](_0x293664[_0xea0d('0x1d')],function(_0x249212){return{'model':db[_0x249212['model']],'as':_0x249212['as'],'attributes':_0x249212[_0xea0d('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b9d3c){logger['info'](_0xea0d('0x18'),_0x29b597);logger['debug'](_0xea0d('0x18'),_0x29b597,JSON['stringify'](_0x3b9d3c));_0x5b4703(_0x3b9d3c);})['catch'](function(_0x5c1e4c){logger[_0xea0d('0x13')](_0xea0d('0x18'),_0x5c1e4c[_0xea0d('0x15')],_0x29b597);_0x4fd821(_0x1f0bed[_0xea0d('0x13')](0x1f4,_0x5c1e4c[_0xea0d('0x15')]));});});};exports[_0xea0d('0x21')]=function(_0x324c53){var _0x102880=this;return new Promise(function(_0x313685,_0x53c236){return db[_0xea0d('0x19')][_0xea0d('0x22')]({'raw':_0x324c53['options']?_0x324c53[_0xea0d('0x1b')][_0xea0d('0x23')]===undefined?!![]:![]:!![],'where':_0x324c53[_0xea0d('0x1b')]?_0x324c53[_0xea0d('0x1b')][_0xea0d('0x24')]||null:null,'attributes':_0x324c53[_0xea0d('0x1b')]?_0x324c53[_0xea0d('0x1b')][_0xea0d('0x20')]||null:null,'include':_0x324c53[_0xea0d('0x1b')]?_0x324c53[_0xea0d('0x1b')][_0xea0d('0x1d')]?_[_0xea0d('0x1e')](_0x324c53[_0xea0d('0x1b')]['include'],function(_0x483bb0){return{'model':db[_0x483bb0[_0xea0d('0x1f')]],'as':_0x483bb0['as'],'attributes':_0x483bb0[_0xea0d('0x20')],'include':_0x483bb0[_0xea0d('0x1d')]?_[_0xea0d('0x1e')](_0x483bb0[_0xea0d('0x1d')],function(_0x6ecf81){return{'model':db[_0x6ecf81[_0xea0d('0x1f')]],'as':_0x6ecf81['as'],'attributes':_0x6ecf81[_0xea0d('0x20')],'include':_0x6ecf81[_0xea0d('0x1d')]?_[_0xea0d('0x1e')](_0x6ecf81['include'],function(_0x1cd122){return{'model':db[_0x1cd122[_0xea0d('0x1f')]],'as':_0x1cd122['as'],'attributes':_0x1cd122[_0xea0d('0x20')]};}):[]};}):[]};}):[]:[]})[_0xea0d('0xc')](function(_0x24ba63){logger[_0xea0d('0xd')](_0xea0d('0x21'),_0x324c53);logger[_0xea0d('0x10')]('ShowMailQueue',_0x324c53,JSON[_0xea0d('0x12')](_0x24ba63));_0x313685(_0x24ba63);})['catch'](function(_0x45df99){logger[_0xea0d('0x13')](_0xea0d('0x21'),_0x45df99['message'],_0x324c53);_0x53c236(_0x102880[_0xea0d('0x13')](0x1f4,_0x45df99[_0xea0d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 7e097c9..cdaf32b 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 _0x48ae=['length','mailQueue:','./mailQueue.events','emit','register'];(function(_0x3bce1d,_0x811da){var _0x54520c=function(_0x52becd){while(--_0x52becd){_0x3bce1d['push'](_0x3bce1d['shift']());}};_0x54520c(++_0x811da);}(_0x48ae,0x142));var _0xe48a=function(_0x3dd588,_0x1123d1){_0x3dd588=_0x3dd588-0x0;var _0x1fe2dc=_0x48ae[_0x3dd588];return _0x1fe2dc;};'use strict';var MailQueueEvents=require(_0xe48a('0x0'));var events=['save','remove','update'];function createListener(_0x3ad5b,_0x483680){return function(_0x204122){_0x483680[_0xe48a('0x1')](_0x3ad5b,_0x204122);};}function removeListener(_0x5a0e7e,_0x4eb603){return function(){MailQueueEvents['removeListener'](_0x5a0e7e,_0x4eb603);};}exports[_0xe48a('0x2')]=function(_0x568219){for(var _0x45b6b7=0x0,_0x286193=events[_0xe48a('0x3')];_0x45b6b7<_0x286193;_0x45b6b7++){var _0x5ac7ef=events[_0x45b6b7];var _0xcb9cb0=createListener(_0xe48a('0x4')+_0x5ac7ef,_0x568219);MailQueueEvents['on'](_0x5ac7ef,_0xcb9cb0);}}; \ No newline at end of file +var _0xe3fc=['register','length','mailQueue:','save','update','emit'];(function(_0x29afa7,_0x513e32){var _0x6a10f3=function(_0x329c62){while(--_0x329c62){_0x29afa7['push'](_0x29afa7['shift']());}};_0x6a10f3(++_0x513e32);}(_0xe3fc,0x111));var _0xce3f=function(_0xee37f1,_0x189f43){_0xee37f1=_0xee37f1-0x0;var _0x37fd54=_0xe3fc[_0xee37f1];return _0x37fd54;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0xce3f('0x0'),'remove',_0xce3f('0x1')];function createListener(_0x3b20ef,_0x2a5273){return function(_0x2244b2){_0x2a5273[_0xce3f('0x2')](_0x3b20ef,_0x2244b2);};}function removeListener(_0x2add59,_0x15d76d){return function(){MailQueueEvents['removeListener'](_0x2add59,_0x15d76d);};}exports[_0xce3f('0x3')]=function(_0x23c9d0){for(var _0x3d56dd=0x0,_0x37291e=events[_0xce3f('0x4')];_0x3d56dd<_0x37291e;_0x3d56dd++){var _0x175152=events[_0x3d56dd];var _0x31c121=createListener(_0xce3f('0x5')+_0x175152,_0x23c9d0);MailQueueEvents['on'](_0x175152,_0x31c121);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 41916cd..3f576dc 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 _0xee85=['delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','show','post','create'];(function(_0x5f522f,_0x2765be){var _0x344635=function(_0x57cd9){while(--_0x57cd9){_0x5f522f['push'](_0x5f522f['shift']());}};_0x344635(++_0x2765be);}(_0xee85,0x113));var _0x5ee8=function(_0x5216e0,_0x4f8cb9){_0x5216e0=_0x5216e0-0x0;var _0x5b3f40=_0xee85[_0x5216e0];return _0x5b3f40;};'use strict';var multer=require(_0x5ee8('0x0'));var util=require(_0x5ee8('0x1'));var path=require(_0x5ee8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5ee8('0x3')]();var fs_extra=require(_0x5ee8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5ee8('0x5'));var config=require('../../config/environment');var controller=require('./mailQueueReport.controller');router[_0x5ee8('0x6')]('/',auth[_0x5ee8('0x7')](),controller[_0x5ee8('0x8')]);router[_0x5ee8('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x5ee8('0x9')]);router[_0x5ee8('0x6')](_0x5ee8('0xa'),auth[_0x5ee8('0x7')](),controller[_0x5ee8('0xb')]);router[_0x5ee8('0xc')]('/',auth[_0x5ee8('0x7')](),controller[_0x5ee8('0xd')]);router['put'](_0x5ee8('0xa'),auth[_0x5ee8('0x7')](),controller['update']);router[_0x5ee8('0xe')](_0x5ee8('0xa'),auth[_0x5ee8('0x7')](),controller[_0x5ee8('0xf')]);module[_0x5ee8('0x10')]=router; \ No newline at end of file +var _0x7223=['show','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','index','isAuthenticated','/:id'];(function(_0x163513,_0x500220){var _0x1439c7=function(_0x13d48a){while(--_0x13d48a){_0x163513['push'](_0x163513['shift']());}};_0x1439c7(++_0x500220);}(_0x7223,0x1e6));var _0x3722=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x7223[_0x1a36a5];return _0x746243;};'use strict';var multer=require(_0x3722('0x0'));var util=require(_0x3722('0x1'));var path=require(_0x3722('0x2'));var timeout=require(_0x3722('0x3'));var express=require(_0x3722('0x4'));var router=express[_0x3722('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3722('0x6'));var interaction=require(_0x3722('0x7'));var config=require(_0x3722('0x8'));var controller=require(_0x3722('0x9'));router[_0x3722('0xa')]('/',auth['isAuthenticated'](),controller[_0x3722('0xb')]);router['get']('/describe',auth[_0x3722('0xc')](),controller['describe']);router['get'](_0x3722('0xd'),auth['isAuthenticated'](),controller[_0x3722('0xe')]);router['post']('/',auth[_0x3722('0xc')](),controller[_0x3722('0xf')]);router[_0x3722('0x10')](_0x3722('0xd'),auth[_0x3722('0xc')](),controller['update']);router[_0x3722('0x11')](_0x3722('0xd'),auth[_0x3722('0xc')](),controller[_0x3722('0x12')]);module[_0x3722('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 987d1fb..d422fe0 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 _0x46b5=['exports','STRING','DATE'];(function(_0x5b34c0,_0x3ad403){var _0x242bd3=function(_0x51d0ce){while(--_0x51d0ce){_0x5b34c0['push'](_0x5b34c0['shift']());}};_0x242bd3(++_0x3ad403);}(_0x46b5,0x168));var _0x546b=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x46b5[_0x21a9d9];return _0x46adce;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x546b('0x0')]={'uniqueid':{'type':Sequelize[_0x546b('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x546b('0x1')]},'joinAt':{'type':Sequelize[_0x546b('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x546b('0x2')]},'exitAt':{'type':Sequelize[_0x546b('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcc8b=['moment','STRING','DATE'];(function(_0x4af3eb,_0x48cca9){var _0x96ebba=function(_0x23e683){while(--_0x23e683){_0x4af3eb['push'](_0x4af3eb['shift']());}};_0x96ebba(++_0x48cca9);}(_0xcc8b,0x171));var _0xbcc8=function(_0x3a811b,_0x163836){_0x3a811b=_0x3a811b-0x0;var _0x3549f7=_0xcc8b[_0x3a811b];return _0x3549f7;};'use strict';var moment=require(_0xbcc8('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xbcc8('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xbcc8('0x1')]},'joinAt':{'type':Sequelize[_0xbcc8('0x2')]},'leaveAt':{'type':Sequelize[_0xbcc8('0x2')]},'acceptAt':{'type':Sequelize[_0xbcc8('0x2')]},'exitAt':{'type':Sequelize[_0xbcc8('0x2')]},'reason':{'type':Sequelize[_0xbcc8('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 4ac898f..d27b365 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 _0x1a37=['index','map','MailQueueReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1a37,0xb4));var _0x71a3=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0x1a37[_0x20589d];return _0x422de9;};'use strict';var emlformat=require(_0x71a3('0x0'));var rimraf=require(_0x71a3('0x1'));var zipdir=require(_0x71a3('0x2'));var jsonpatch=require(_0x71a3('0x3'));var rp=require(_0x71a3('0x4'));var moment=require(_0x71a3('0x5'));var BPromise=require(_0x71a3('0x6'));var Mustache=require(_0x71a3('0x7'));var util=require(_0x71a3('0x8'));var path=require(_0x71a3('0x9'));var sox=require('sox');var csv=require(_0x71a3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x71a3('0xb'));var _=require(_0x71a3('0xc'));var squel=require(_0x71a3('0xd'));var crypto=require(_0x71a3('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x71a3('0xf'));var Redis=require(_0x71a3('0x10'));var authService=require(_0x71a3('0x11'));var qs=require(_0x71a3('0x12'));var as=require(_0x71a3('0x13'));var hardwareService=require(_0x71a3('0x14'));var logger=require(_0x71a3('0x15'))(_0x71a3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x71a3('0x17'))['db'];function respondWithStatusCode(_0x3830cb,_0x27e46d){_0x27e46d=_0x27e46d||0xcc;return function(_0x229134){if(_0x229134){return _0x3830cb[_0x71a3('0x18')](_0x27e46d);}return _0x3830cb[_0x71a3('0x19')](_0x27e46d)[_0x71a3('0x1a')]();};}function respondWithResult(_0x3b256c,_0x4dc4ed){_0x4dc4ed=_0x4dc4ed||0xc8;return function(_0x203ee1){if(_0x203ee1){return _0x3b256c[_0x71a3('0x19')](_0x4dc4ed)['json'](_0x203ee1);}};}function respondWithFilteredResult(_0x1743d7,_0x32591a){return function(_0x59021f){if(_0x59021f){var _0x4aa918=typeof _0x32591a[_0x71a3('0x1b')]===_0x71a3('0x1c')&&typeof _0x32591a[_0x71a3('0x1d')]===_0x71a3('0x1c');var _0x1af1bc=_0x59021f[_0x71a3('0x1e')];var _0x5d4dee=_0x4aa918?0x0:_0x32591a[_0x71a3('0x1b')];var _0x27bfb4=_0x4aa918?_0x59021f['count']:_0x32591a['offset']+_0x32591a[_0x71a3('0x1d')];var _0x250db3;if(_0x27bfb4>=_0x1af1bc){_0x27bfb4=_0x1af1bc;_0x250db3=0xc8;}else{_0x250db3=0xce;}_0x1743d7[_0x71a3('0x19')](_0x250db3);return _0x1743d7[_0x71a3('0x1f')](_0x71a3('0x20'),_0x5d4dee+'-'+_0x27bfb4+'/'+_0x1af1bc)['json'](_0x59021f);}return null;};}function patchUpdates(_0x1ab947){return function(_0x4156e1){try{jsonpatch[_0x71a3('0x21')](_0x4156e1,_0x1ab947,!![]);}catch(_0x3ea036){return BPromise[_0x71a3('0x22')](_0x3ea036);}return _0x4156e1['save']();};}function saveUpdates(_0x1af24b,_0x5bbaee){return function(_0x3bf78e){if(_0x3bf78e){return _0x3bf78e[_0x71a3('0x23')](_0x1af24b)[_0x71a3('0x24')](function(_0x21899d){return _0x21899d;});}return null;};}function removeEntity(_0x452bc4,_0x2847b4){return function(_0x5f33c5){if(_0x5f33c5){return _0x5f33c5[_0x71a3('0x25')]()[_0x71a3('0x24')](function(){_0x452bc4[_0x71a3('0x19')](0xcc)[_0x71a3('0x1a')]();});}};}function handleEntityNotFound(_0xb0f3aa,_0x4fd214){return function(_0x107fbd){if(!_0x107fbd){_0xb0f3aa[_0x71a3('0x18')](0x194);}return _0x107fbd;};}function handleError(_0x4c1a3d,_0x412746){_0x412746=_0x412746||0x1f4;return function(_0x515519){logger[_0x71a3('0x26')](_0x515519[_0x71a3('0x27')]);if(_0x515519[_0x71a3('0x28')]){delete _0x515519[_0x71a3('0x28')];}_0x4c1a3d[_0x71a3('0x19')](_0x412746)[_0x71a3('0x29')](_0x515519);};}exports[_0x71a3('0x2a')]=function(_0x242b85,_0x305eb1){var _0x3fc578={},_0x3ea7aa={},_0x228afa={'count':0x0,'rows':[]};var _0x51cde3=_[_0x71a3('0x2b')](db[_0x71a3('0x2c')][_0x71a3('0x2d')],function(_0x23ae85){return{'name':_0x23ae85['fieldName'],'type':_0x23ae85[_0x71a3('0x2e')][_0x71a3('0x2f')]};});_0x3ea7aa[_0x71a3('0x30')]=_[_0x71a3('0x2b')](_0x51cde3,_0x71a3('0x28'));_0x3ea7aa[_0x71a3('0x31')]=_[_0x71a3('0x32')](_0x242b85['query']);_0x3ea7aa[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x3ea7aa[_0x71a3('0x30')],_0x3ea7aa[_0x71a3('0x31')]);_0x3fc578[_0x71a3('0x35')]=_[_0x71a3('0x34')](_0x3ea7aa[_0x71a3('0x30')],qs[_0x71a3('0x36')](_0x242b85[_0x71a3('0x31')][_0x71a3('0x36')]));_0x3fc578[_0x71a3('0x35')]=_0x3fc578[_0x71a3('0x35')][_0x71a3('0x37')]?_0x3fc578['attributes']:_0x3ea7aa['model'];if(!_0x242b85[_0x71a3('0x31')][_0x71a3('0x38')]('nolimit')){_0x3fc578[_0x71a3('0x1d')]=qs[_0x71a3('0x1d')](_0x242b85['query'][_0x71a3('0x1d')]);_0x3fc578[_0x71a3('0x1b')]=qs[_0x71a3('0x1b')](_0x242b85[_0x71a3('0x31')][_0x71a3('0x1b')]);}_0x3fc578[_0x71a3('0x39')]=qs[_0x71a3('0x3a')](_0x242b85['query'][_0x71a3('0x3a')]);_0x3fc578[_0x71a3('0x3b')]=qs[_0x71a3('0x33')](_['pick'](_0x242b85[_0x71a3('0x31')],_0x3ea7aa[_0x71a3('0x33')]),_0x51cde3);if(_0x242b85[_0x71a3('0x31')][_0x71a3('0x3c')]){_0x3fc578[_0x71a3('0x3b')]=_['merge'](_0x3fc578['where'],{'$or':_[_0x71a3('0x2b')](_0x51cde3,function(_0x2b3197){if(_0x2b3197[_0x71a3('0x2e')]!==_0x71a3('0x3d')){var _0x36ed2e={};_0x36ed2e[_0x2b3197['name']]={'$like':'%'+_0x242b85[_0x71a3('0x31')][_0x71a3('0x3c')]+'%'};return _0x36ed2e;}})});}_0x3fc578=_[_0x71a3('0x3e')]({},_0x3fc578,_0x242b85['options']);var _0x17c467={'where':_0x3fc578['where']};return db[_0x71a3('0x2c')][_0x71a3('0x1e')](_0x17c467)[_0x71a3('0x24')](function(_0x43c6d1){_0x228afa[_0x71a3('0x1e')]=_0x43c6d1;if(_0x242b85[_0x71a3('0x31')][_0x71a3('0x3f')]){_0x3fc578[_0x71a3('0x40')]=[{'all':!![]}];}return db[_0x71a3('0x2c')][_0x71a3('0x41')](_0x3fc578);})['then'](function(_0xa49846){_0x228afa['rows']=_0xa49846;return _0x228afa;})[_0x71a3('0x24')](respondWithFilteredResult(_0x305eb1,_0x3fc578))[_0x71a3('0x42')](handleError(_0x305eb1,null));};exports[_0x71a3('0x43')]=function(_0x18974c,_0x59c7c9){var _0x412bce={'raw':!![],'where':{'id':_0x18974c['params']['id']}},_0x4b4fde={};_0x4b4fde[_0x71a3('0x30')]=_[_0x71a3('0x32')](db[_0x71a3('0x2c')][_0x71a3('0x2d')]);_0x4b4fde['query']=_[_0x71a3('0x32')](_0x18974c[_0x71a3('0x31')]);_0x4b4fde[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x4b4fde[_0x71a3('0x30')],_0x4b4fde[_0x71a3('0x31')]);_0x412bce[_0x71a3('0x35')]=_[_0x71a3('0x34')](_0x4b4fde[_0x71a3('0x30')],qs[_0x71a3('0x36')](_0x18974c[_0x71a3('0x31')][_0x71a3('0x36')]));_0x412bce[_0x71a3('0x35')]=_0x412bce[_0x71a3('0x35')][_0x71a3('0x37')]?_0x412bce[_0x71a3('0x35')]:_0x4b4fde['model'];if(_0x18974c[_0x71a3('0x31')][_0x71a3('0x3f')]){_0x412bce['include']=[{'all':!![]}];}_0x412bce=_[_0x71a3('0x3e')]({},_0x412bce,_0x18974c[_0x71a3('0x44')]);return db[_0x71a3('0x2c')][_0x71a3('0x45')](_0x412bce)[_0x71a3('0x24')](handleEntityNotFound(_0x59c7c9,null))['then'](respondWithResult(_0x59c7c9,null))['catch'](handleError(_0x59c7c9,null));};exports[_0x71a3('0x46')]=function(_0x4305ee,_0x51d20d){return db[_0x71a3('0x2c')][_0x71a3('0x46')](_0x4305ee[_0x71a3('0x47')],{})[_0x71a3('0x24')](respondWithResult(_0x51d20d,0xc9))[_0x71a3('0x42')](handleError(_0x51d20d,null));};exports[_0x71a3('0x23')]=function(_0x501a62,_0x1c9ba6){if(_0x501a62['body']['id']){delete _0x501a62[_0x71a3('0x47')]['id'];}return db[_0x71a3('0x2c')][_0x71a3('0x45')]({'where':{'id':_0x501a62[_0x71a3('0x48')]['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x1c9ba6,null))['then'](saveUpdates(_0x501a62[_0x71a3('0x47')],null))[_0x71a3('0x24')](respondWithResult(_0x1c9ba6,null))[_0x71a3('0x42')](handleError(_0x1c9ba6,null));};exports['destroy']=function(_0x6c34,_0x4e6423){return db[_0x71a3('0x2c')][_0x71a3('0x45')]({'where':{'id':_0x6c34['params']['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x4e6423,null))[_0x71a3('0x24')](removeEntity(_0x4e6423,null))[_0x71a3('0x42')](handleError(_0x4e6423,null));};exports[_0x71a3('0x49')]=function(_0x11391d,_0x3952c0){return db[_0x71a3('0x2c')]['describe']()[_0x71a3('0x24')](respondWithResult(_0x3952c0,null))['catch'](handleError(_0x3952c0,null));}; \ No newline at end of file +var _0x160f=['sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','rawAttributes','type','key','map','intersection','model','query','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','MailQueueReport','include','findAll','rows','show','params','keys','fields','includeAll','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x154977,_0x4f2341){var _0x54cc50=function(_0x3ebafb){while(--_0x3ebafb){_0x154977['push'](_0x154977['shift']());}};_0x54cc50(++_0x4f2341);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xf160('0x0'));var rimraf=require(_0xf160('0x1'));var zipdir=require(_0xf160('0x2'));var jsonpatch=require(_0xf160('0x3'));var rp=require('request-promise');var moment=require(_0xf160('0x4'));var BPromise=require(_0xf160('0x5'));var Mustache=require(_0xf160('0x6'));var util=require(_0xf160('0x7'));var path=require(_0xf160('0x8'));var sox=require(_0xf160('0x9'));var csv=require('to-csv');var ejs=require(_0xf160('0xa'));var fs=require('fs');var fs_extra=require(_0xf160('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf160('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf160('0xd'));var Papa=require(_0xf160('0xe'));var Redis=require(_0xf160('0xf'));var authService=require(_0xf160('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf160('0x11'));var logger=require(_0xf160('0x12'))(_0xf160('0x13'));var utils=require('../../config/utils');var config=require(_0xf160('0x14'));var licenseUtil=require(_0xf160('0x15'));var db=require(_0xf160('0x16'))['db'];function respondWithStatusCode(_0x3b09ea,_0x2d8854){_0x2d8854=_0x2d8854||0xcc;return function(_0x523af5){if(_0x523af5){return _0x3b09ea[_0xf160('0x17')](_0x2d8854);}return _0x3b09ea['status'](_0x2d8854)[_0xf160('0x18')]();};}function respondWithResult(_0x26951a,_0x12549a){_0x12549a=_0x12549a||0xc8;return function(_0x2bb6c7){if(_0x2bb6c7){return _0x26951a[_0xf160('0x19')](_0x12549a)[_0xf160('0x1a')](_0x2bb6c7);}};}function respondWithFilteredResult(_0x2643ba,_0x172337){return function(_0x1396ba){if(_0x1396ba){var _0x59ac02=typeof _0x172337[_0xf160('0x1b')]===_0xf160('0x1c')&&typeof _0x172337[_0xf160('0x1d')]===_0xf160('0x1c');var _0x51824b=_0x1396ba[_0xf160('0x1e')];var _0x4b8185=_0x59ac02?0x0:_0x172337[_0xf160('0x1b')];var _0x1cf6ba=_0x59ac02?_0x1396ba[_0xf160('0x1e')]:_0x172337[_0xf160('0x1b')]+_0x172337[_0xf160('0x1d')];var _0x205afa;if(_0x1cf6ba>=_0x51824b){_0x1cf6ba=_0x51824b;_0x205afa=0xc8;}else{_0x205afa=0xce;}_0x2643ba[_0xf160('0x19')](_0x205afa);return _0x2643ba[_0xf160('0x1f')](_0xf160('0x20'),_0x4b8185+'-'+_0x1cf6ba+'/'+_0x51824b)['json'](_0x1396ba);}return null;};}function patchUpdates(_0x40ccf0){return function(_0xa20d5a){try{jsonpatch[_0xf160('0x21')](_0xa20d5a,_0x40ccf0,!![]);}catch(_0x5ad173){return BPromise[_0xf160('0x22')](_0x5ad173);}return _0xa20d5a[_0xf160('0x23')]();};}function saveUpdates(_0x454e63,_0x36d0cb){return function(_0x2e03c8){if(_0x2e03c8){return _0x2e03c8[_0xf160('0x24')](_0x454e63)[_0xf160('0x25')](function(_0x5a72d1){return _0x5a72d1;});}return null;};}function removeEntity(_0x3d1f6c,_0x28bf27){return function(_0x305f6a){if(_0x305f6a){return _0x305f6a[_0xf160('0x26')]()['then'](function(){_0x3d1f6c[_0xf160('0x19')](0xcc)[_0xf160('0x18')]();});}};}function handleEntityNotFound(_0x4a8003,_0x487c0c){return function(_0x168a09){if(!_0x168a09){_0x4a8003[_0xf160('0x17')](0x194);}return _0x168a09;};}function handleError(_0x39c0e3,_0x4c0c51){_0x4c0c51=_0x4c0c51||0x1f4;return function(_0xcfa9bd){logger[_0xf160('0x27')](_0xcfa9bd[_0xf160('0x28')]);if(_0xcfa9bd[_0xf160('0x29')]){delete _0xcfa9bd[_0xf160('0x29')];}_0x39c0e3[_0xf160('0x19')](_0x4c0c51)['send'](_0xcfa9bd);};}exports['index']=function(_0x48145e,_0x26e7b9){var _0x16a5fa={},_0xcaab39={},_0x26e06b={'count':0x0,'rows':[]};var _0x399cce=_['map'](db['MailQueueReport'][_0xf160('0x2a')],function(_0x558596){return{'name':_0x558596['fieldName'],'type':_0x558596[_0xf160('0x2b')][_0xf160('0x2c')]};});_0xcaab39['model']=_[_0xf160('0x2d')](_0x399cce,_0xf160('0x29'));_0xcaab39['query']=_['keys'](_0x48145e['query']);_0xcaab39['filters']=_[_0xf160('0x2e')](_0xcaab39[_0xf160('0x2f')],_0xcaab39[_0xf160('0x30')]);_0x16a5fa[_0xf160('0x31')]=_[_0xf160('0x2e')](_0xcaab39[_0xf160('0x2f')],qs['fields'](_0x48145e['query']['fields']));_0x16a5fa[_0xf160('0x31')]=_0x16a5fa['attributes']['length']?_0x16a5fa[_0xf160('0x31')]:_0xcaab39[_0xf160('0x2f')];if(!_0x48145e['query'][_0xf160('0x32')](_0xf160('0x33'))){_0x16a5fa[_0xf160('0x1d')]=qs[_0xf160('0x1d')](_0x48145e[_0xf160('0x30')]['limit']);_0x16a5fa[_0xf160('0x1b')]=qs[_0xf160('0x1b')](_0x48145e[_0xf160('0x30')]['offset']);}_0x16a5fa[_0xf160('0x34')]=qs[_0xf160('0x35')](_0x48145e[_0xf160('0x30')][_0xf160('0x35')]);_0x16a5fa[_0xf160('0x36')]=qs[_0xf160('0x37')](_['pick'](_0x48145e['query'],_0xcaab39[_0xf160('0x37')]),_0x399cce);if(_0x48145e[_0xf160('0x30')][_0xf160('0x38')]){_0x16a5fa[_0xf160('0x36')]=_[_0xf160('0x39')](_0x16a5fa[_0xf160('0x36')],{'$or':_[_0xf160('0x2d')](_0x399cce,function(_0x38a33e){if(_0x38a33e[_0xf160('0x2b')]!==_0xf160('0x3a')){var _0x1e65d4={};_0x1e65d4[_0x38a33e[_0xf160('0x29')]]={'$like':'%'+_0x48145e[_0xf160('0x30')][_0xf160('0x38')]+'%'};return _0x1e65d4;}})});}_0x16a5fa=_[_0xf160('0x39')]({},_0x16a5fa,_0x48145e[_0xf160('0x3b')]);var _0x161f06={'where':_0x16a5fa[_0xf160('0x36')]};return db[_0xf160('0x3c')][_0xf160('0x1e')](_0x161f06)[_0xf160('0x25')](function(_0x8fe1de){_0x26e06b[_0xf160('0x1e')]=_0x8fe1de;if(_0x48145e[_0xf160('0x30')]['includeAll']){_0x16a5fa[_0xf160('0x3d')]=[{'all':!![]}];}return db[_0xf160('0x3c')][_0xf160('0x3e')](_0x16a5fa);})[_0xf160('0x25')](function(_0x3d273d){_0x26e06b[_0xf160('0x3f')]=_0x3d273d;return _0x26e06b;})[_0xf160('0x25')](respondWithFilteredResult(_0x26e7b9,_0x16a5fa))['catch'](handleError(_0x26e7b9,null));};exports[_0xf160('0x40')]=function(_0x5be7ce,_0xa80a5f){var _0x477ded={'raw':!![],'where':{'id':_0x5be7ce[_0xf160('0x41')]['id']}},_0x530fc5={};_0x530fc5[_0xf160('0x2f')]=_[_0xf160('0x42')](db[_0xf160('0x3c')][_0xf160('0x2a')]);_0x530fc5[_0xf160('0x30')]=_[_0xf160('0x42')](_0x5be7ce['query']);_0x530fc5[_0xf160('0x37')]=_[_0xf160('0x2e')](_0x530fc5[_0xf160('0x2f')],_0x530fc5[_0xf160('0x30')]);_0x477ded[_0xf160('0x31')]=_[_0xf160('0x2e')](_0x530fc5[_0xf160('0x2f')],qs[_0xf160('0x43')](_0x5be7ce[_0xf160('0x30')][_0xf160('0x43')]));_0x477ded[_0xf160('0x31')]=_0x477ded['attributes']['length']?_0x477ded[_0xf160('0x31')]:_0x530fc5[_0xf160('0x2f')];if(_0x5be7ce[_0xf160('0x30')][_0xf160('0x44')]){_0x477ded[_0xf160('0x3d')]=[{'all':!![]}];}_0x477ded=_[_0xf160('0x39')]({},_0x477ded,_0x5be7ce['options']);return db[_0xf160('0x3c')]['find'](_0x477ded)['then'](handleEntityNotFound(_0xa80a5f,null))[_0xf160('0x25')](respondWithResult(_0xa80a5f,null))[_0xf160('0x45')](handleError(_0xa80a5f,null));};exports['create']=function(_0x5ea49d,_0x2f1648){return db[_0xf160('0x3c')][_0xf160('0x46')](_0x5ea49d[_0xf160('0x47')],{})['then'](respondWithResult(_0x2f1648,0xc9))['catch'](handleError(_0x2f1648,null));};exports['update']=function(_0x50a97d,_0x406494){if(_0x50a97d['body']['id']){delete _0x50a97d[_0xf160('0x47')]['id'];}return db[_0xf160('0x3c')][_0xf160('0x48')]({'where':{'id':_0x50a97d[_0xf160('0x41')]['id']}})['then'](handleEntityNotFound(_0x406494,null))[_0xf160('0x25')](saveUpdates(_0x50a97d[_0xf160('0x47')],null))[_0xf160('0x25')](respondWithResult(_0x406494,null))['catch'](handleError(_0x406494,null));};exports[_0xf160('0x26')]=function(_0x40f855,_0x87ad7e){return db['MailQueueReport'][_0xf160('0x48')]({'where':{'id':_0x40f855[_0xf160('0x41')]['id']}})[_0xf160('0x25')](handleEntityNotFound(_0x87ad7e,null))[_0xf160('0x25')](removeEntity(_0x87ad7e,null))[_0xf160('0x45')](handleError(_0x87ad7e,null));};exports['describe']=function(_0x4c90ab,_0x3c8765){return db['MailQueueReport'][_0xf160('0x49')]()[_0xf160('0x25')](respondWithResult(_0x3c8765,null))['catch'](handleError(_0x3c8765,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index fee2d52..40b575e 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 _0x6189=['bluebird','request-promise','path','../../config/environment','./mailQueueReport.attributes','exports','report_mail_queue','uniqueid','lodash','util','../../config/logger','api'];(function(_0xd966be,_0x4f86fc){var _0x21e859=function(_0x4a9786){while(--_0x4a9786){_0xd966be['push'](_0xd966be['shift']());}};_0x21e859(++_0x4f86fc);}(_0x6189,0x98));var _0x9618=function(_0x4e326a,_0x1dfbc5){_0x4e326a=_0x4e326a-0x0;var _0x46fbe7=_0x6189[_0x4e326a];return _0x46fbe7;};'use strict';var _=require(_0x9618('0x0'));var util=require(_0x9618('0x1'));var logger=require(_0x9618('0x2'))(_0x9618('0x3'));var moment=require('moment');var BPromise=require(_0x9618('0x4'));var rp=require(_0x9618('0x5'));var fs=require('fs');var path=require(_0x9618('0x6'));var rimraf=require('rimraf');var config=require(_0x9618('0x7'));var attributes=require(_0x9618('0x8'));module[_0x9618('0x9')]=function(_0x5d9e56,_0x4789cb){return _0x5d9e56['define']('MailQueueReport',attributes,{'tableName':_0x9618('0xa'),'paranoid':![],'indexes':[{'name':_0x9618('0xb'),'fields':[_0x9618('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd124=['./mailQueueReport.attributes','define','MailQueueReport','uniqueid','lodash','../../config/logger','api','moment','rimraf','../../config/environment'];(function(_0x419308,_0x2328ef){var _0x2c6cc1=function(_0x17bc70){while(--_0x17bc70){_0x419308['push'](_0x419308['shift']());}};_0x2c6cc1(++_0x2328ef);}(_0xd124,0x1ee));var _0x4d12=function(_0x147342,_0x361c70){_0x147342=_0x147342-0x0;var _0x5d859c=_0xd124[_0x147342];return _0x5d859c;};'use strict';var _=require(_0x4d12('0x0'));var util=require('util');var logger=require(_0x4d12('0x1'))(_0x4d12('0x2'));var moment=require(_0x4d12('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4d12('0x4'));var config=require(_0x4d12('0x5'));var attributes=require(_0x4d12('0x6'));module['exports']=function(_0x11f585,_0x1f86fd){return _0x11f585[_0x4d12('0x7')](_0x4d12('0x8'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x4d12('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index bed13e4..d3916bb 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 _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0x191154,_0x56f74c){var _0x3dcd73=function(_0x51c321){while(--_0x51c321){_0x191154['push'](_0x191154['shift']());}};_0x3dcd73(++_0x56f74c);}(_0xdb28,0x106));var _0x8db2=function(_0x490a41,_0x446733){_0x490a41=_0x490a41-0x0;var _0x4d30fd=_0xdb28[_0x490a41];return _0x4d30fd;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['message']));});});}; \ No newline at end of file +var _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0x3f5a14,_0x53ab4b){var _0x275c88=function(_0x1f202c){while(--_0x1f202c){_0x3f5a14['push'](_0x3f5a14['shift']());}};_0x275c88(++_0x53ab4b);}(_0x7a54,0x106));var _0x47a5=function(_0x3a030f,_0x1fabcc){_0x3a030f=_0x3a030f-0x0;var _0x4b60d4=_0x7a54[_0x3a030f];return _0x4b60d4;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateMailQueueReport']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateMailQueueReport',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index fcb7128..70b298e 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1c4cd9,_0x59e716){var _0x3ea30e=function(_0x46bfc2){while(--_0x46bfc2){_0x1c4cd9['push'](_0x1c4cd9['shift']());}};_0x3ea30e(++_0x59e716);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x10d479,_0x84ea59){var _0x1fec1f=function(_0x3a5016){while(--_0x3a5016){_0x10d479['push'](_0x10d479['shift']());}};_0x1fec1f(++_0x84ea59);}(_0x9c44,0x178));var _0x49c4=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x9c44[_0x50a0c2];return _0x5ebadd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index a99a3c2..816189f 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 _0x7324=['INBOX','INTEGER','exports','STRING','BOOLEAN'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x7324,0x1a1));var _0x4732=function(_0x1ecc3f,_0x4c78e3){_0x1ecc3f=_0x1ecc3f-0x0;var _0x1a7a84=_0x7324[_0x1ecc3f];return _0x1a7a84;};'use strict';var Sequelize=require('sequelize');module[_0x4732('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x4732('0x1')]},'authentication':{'type':Sequelize[_0x4732('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x4732('0x1')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x4732('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x4732('0x1')],'defaultValue':_0x4732('0x3')},'connTimeout':{'type':Sequelize[_0x4732('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x4732('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x4732('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x3ff6=['exports','STRING','BOOLEAN','INBOX','INTEGER','sequelize'];(function(_0x115833,_0x3e8497){var _0x3129f6=function(_0x581c1d){while(--_0x581c1d){_0x115833['push'](_0x115833['shift']());}};_0x3129f6(++_0x3e8497);}(_0x3ff6,0x1a3));var _0x63ff=function(_0x55a27e,_0x17ba49){_0x55a27e=_0x55a27e-0x0;var _0x47564e=_0x3ff6[_0x55a27e];return _0x47564e;};'use strict';var Sequelize=require(_0x63ff('0x0'));module[_0x63ff('0x1')]={'description':{'type':Sequelize[_0x63ff('0x2')]},'host':{'type':Sequelize[_0x63ff('0x2')]},'authentication':{'type':Sequelize[_0x63ff('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x63ff('0x2')]},'password':{'type':Sequelize[_0x63ff('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x63ff('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x63ff('0x2')],'defaultValue':_0x63ff('0x4')},'connTimeout':{'type':Sequelize[_0x63ff('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x63ff('0x5')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x63ff('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 4701c9a..82f2b1a 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 _0x4583=['../../config/environment','./mailServerIn.attributes','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','bluebird','request-promise','rimraf'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x4583,0x123));var _0x3458=function(_0x38277f,_0x934e9){_0x38277f=_0x38277f-0x0;var _0x558060=_0x4583[_0x38277f];return _0x558060;};'use strict';var _=require(_0x3458('0x0'));var util=require(_0x3458('0x1'));var logger=require(_0x3458('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3458('0x3'));var rp=require(_0x3458('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3458('0x5'));var config=require(_0x3458('0x6'));var attributes=require(_0x3458('0x7'));module['exports']=function(_0x41f7e5,_0x70d351){return _0x41f7e5[_0x3458('0x8')](_0x3458('0x9'),attributes,{'tableName':_0x3458('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5925=['moment','bluebird','request-promise','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','mail_servers_in','lodash','util','../../config/logger'];(function(_0x16550e,_0x3fbe68){var _0x34fe7c=function(_0x2d9d05){while(--_0x2d9d05){_0x16550e['push'](_0x16550e['shift']());}};_0x34fe7c(++_0x3fbe68);}(_0x5925,0xe1));var _0x5592=function(_0x9a3e0f,_0x2f796d){_0x9a3e0f=_0x9a3e0f-0x0;var _0x3d2a9a=_0x5925[_0x9a3e0f];return _0x3d2a9a;};'use strict';var _=require(_0x5592('0x0'));var util=require(_0x5592('0x1'));var logger=require(_0x5592('0x2'))('api');var moment=require(_0x5592('0x3'));var BPromise=require(_0x5592('0x4'));var rp=require(_0x5592('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5592('0x6'));var config=require(_0x5592('0x7'));var attributes=require(_0x5592('0x8'));module[_0x5592('0x9')]=function(_0x4ac9dc,_0x531c9b){return _0x4ac9dc[_0x5592('0xa')]('MailServerIn',attributes,{'tableName':_0x5592('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 5e206f6..d0c6a22 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 _0x4c76=['include','map','model','GetMailServerIn','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailServerIn','findAll','options','raw','where','attributes','limit'];(function(_0x449720,_0x484b17){var _0x420ec9=function(_0x6e9bbc){while(--_0x6e9bbc){_0x449720['push'](_0x449720['shift']());}};_0x420ec9(++_0x484b17);}(_0x4c76,0x84));var _0x64c7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4c76[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x64c7('0x0'));var moment=require('moment');var BPromise=require(_0x64c7('0x1'));var rs=require(_0x64c7('0x2'));var fs=require('fs');var Redis=require(_0x64c7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x64c7('0x4'));var logger=require(_0x64c7('0x5'))(_0x64c7('0x6'));var config=require(_0x64c7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x64c7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x377eab,_0x2104f3,_0x5b12dc){return new BPromise(function(_0x4a3f45,_0x5964b9){return client['request'](_0x377eab,_0x5b12dc)[_0x64c7('0x9')](function(_0x21ef38){logger[_0x64c7('0xa')](_0x64c7('0xb'),_0x2104f3,_0x64c7('0xc'));logger[_0x64c7('0xd')](_0x64c7('0xe'),_0x2104f3,_0x64c7('0xc'),JSON[_0x64c7('0xf')](_0x21ef38));if(_0x21ef38[_0x64c7('0x10')]){if(_0x21ef38['error'][_0x64c7('0x11')]===0x1f4){logger[_0x64c7('0x10')](_0x64c7('0xb'),_0x2104f3,_0x21ef38[_0x64c7('0x10')][_0x64c7('0x12')]);return _0x5964b9(_0x21ef38['error'][_0x64c7('0x12')]);}logger[_0x64c7('0x10')](_0x64c7('0xb'),_0x2104f3,_0x21ef38[_0x64c7('0x10')][_0x64c7('0x12')]);return _0x4a3f45(_0x21ef38[_0x64c7('0x10')]['message']);}else{logger[_0x64c7('0xa')](_0x64c7('0xb'),_0x2104f3,_0x64c7('0xc'));_0x4a3f45(_0x21ef38[_0x64c7('0x13')][_0x64c7('0x12')]);}})[_0x64c7('0x14')](function(_0x55720b){logger[_0x64c7('0x10')](_0x64c7('0xb'),_0x2104f3,_0x55720b);_0x5964b9(_0x55720b);});});}exports['GetMailServerIn']=function(_0x3aa509){var _0x28a7a4=this;return new Promise(function(_0x320387,_0x91e8d1){return db[_0x64c7('0x15')][_0x64c7('0x16')]({'raw':_0x3aa509[_0x64c7('0x17')]?_0x3aa509[_0x64c7('0x17')][_0x64c7('0x18')]===undefined?!![]:![]:!![],'where':_0x3aa509[_0x64c7('0x17')]?_0x3aa509[_0x64c7('0x17')][_0x64c7('0x19')]||null:null,'attributes':_0x3aa509[_0x64c7('0x17')]?_0x3aa509[_0x64c7('0x17')][_0x64c7('0x1a')]||null:null,'limit':_0x3aa509[_0x64c7('0x17')]?_0x3aa509['options'][_0x64c7('0x1b')]||null:null,'include':_0x3aa509[_0x64c7('0x17')]?_0x3aa509['options'][_0x64c7('0x1c')]?_[_0x64c7('0x1d')](_0x3aa509[_0x64c7('0x17')][_0x64c7('0x1c')],function(_0x404e2c){return{'model':db[_0x404e2c['model']],'as':_0x404e2c['as'],'attributes':_0x404e2c[_0x64c7('0x1a')],'include':_0x404e2c['include']?_[_0x64c7('0x1d')](_0x404e2c[_0x64c7('0x1c')],function(_0x87bd46){return{'model':db[_0x87bd46[_0x64c7('0x1e')]],'as':_0x87bd46['as'],'attributes':_0x87bd46['attributes'],'include':_0x87bd46[_0x64c7('0x1c')]?_[_0x64c7('0x1d')](_0x87bd46[_0x64c7('0x1c')],function(_0x4be7d6){return{'model':db[_0x4be7d6[_0x64c7('0x1e')]],'as':_0x4be7d6['as'],'attributes':_0x4be7d6[_0x64c7('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x64c7('0x9')](function(_0x139ef3){logger[_0x64c7('0xa')](_0x64c7('0x1f'),_0x3aa509);logger[_0x64c7('0xd')](_0x64c7('0x1f'),_0x3aa509,JSON[_0x64c7('0xf')](_0x139ef3));_0x320387(_0x139ef3);})[_0x64c7('0x14')](function(_0x457ff4){logger[_0x64c7('0x10')](_0x64c7('0x1f'),_0x457ff4[_0x64c7('0x12')],_0x3aa509);_0x91e8d1(_0x28a7a4[_0x64c7('0x10')](0x1f4,_0x457ff4['message']));});});}; \ No newline at end of file +var _0x51a1=['client','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','code','error','message','result','GetMailServerIn','MailServerIn','findAll','options','where','limit','include','map','model','attributes','debug','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x582727,_0x163af4){var _0x26c5bb=function(_0x450cf6){while(--_0x450cf6){_0x582727['push'](_0x582727['shift']());}};_0x26c5bb(++_0x163af4);}(_0x51a1,0x1b7));var _0x151a=function(_0x49cd75,_0x1ed7a2){_0x49cd75=_0x49cd75-0x0;var _0x4d454d=_0x51a1[_0x49cd75];return _0x4d454d;};'use strict';var _=require(_0x151a('0x0'));var util=require(_0x151a('0x1'));var moment=require('moment');var BPromise=require(_0x151a('0x2'));var rs=require(_0x151a('0x3'));var fs=require('fs');var Redis=require(_0x151a('0x4'));var db=require(_0x151a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x151a('0x6'))(_0x151a('0x7'));var config=require(_0x151a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x151a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a4c1d,_0x1fec5a,_0x19eda0){return new BPromise(function(_0x1ee8a9,_0x32c652){return client[_0x151a('0xa')](_0x4a4c1d,_0x19eda0)[_0x151a('0xb')](function(_0x1ae016){logger[_0x151a('0xc')](_0x151a('0xd'),_0x1fec5a,_0x151a('0xe'));logger['debug'](_0x151a('0xf'),_0x1fec5a,_0x151a('0xe'),JSON['stringify'](_0x1ae016));if(_0x1ae016['error']){if(_0x1ae016['error'][_0x151a('0x10')]===0x1f4){logger['error']('MailServerIn,\x20%s,\x20%s',_0x1fec5a,_0x1ae016[_0x151a('0x11')][_0x151a('0x12')]);return _0x32c652(_0x1ae016[_0x151a('0x11')][_0x151a('0x12')]);}logger[_0x151a('0x11')]('MailServerIn,\x20%s,\x20%s',_0x1fec5a,_0x1ae016[_0x151a('0x11')]['message']);return _0x1ee8a9(_0x1ae016[_0x151a('0x11')]['message']);}else{logger[_0x151a('0xc')](_0x151a('0xd'),_0x1fec5a,'request\x20sent');_0x1ee8a9(_0x1ae016[_0x151a('0x13')][_0x151a('0x12')]);}})['catch'](function(_0x537078){logger['error']('MailServerIn,\x20%s,\x20%s',_0x1fec5a,_0x537078);_0x32c652(_0x537078);});});}exports[_0x151a('0x14')]=function(_0x3c26cc){var _0x3ff58b=this;return new Promise(function(_0x428c7a,_0x1ec3c8){return db[_0x151a('0x15')][_0x151a('0x16')]({'raw':_0x3c26cc[_0x151a('0x17')]?_0x3c26cc['options']['raw']===undefined?!![]:![]:!![],'where':_0x3c26cc[_0x151a('0x17')]?_0x3c26cc[_0x151a('0x17')][_0x151a('0x18')]||null:null,'attributes':_0x3c26cc[_0x151a('0x17')]?_0x3c26cc[_0x151a('0x17')]['attributes']||null:null,'limit':_0x3c26cc['options']?_0x3c26cc[_0x151a('0x17')][_0x151a('0x19')]||null:null,'include':_0x3c26cc[_0x151a('0x17')]?_0x3c26cc[_0x151a('0x17')][_0x151a('0x1a')]?_[_0x151a('0x1b')](_0x3c26cc[_0x151a('0x17')][_0x151a('0x1a')],function(_0x101526){return{'model':db[_0x101526[_0x151a('0x1c')]],'as':_0x101526['as'],'attributes':_0x101526[_0x151a('0x1d')],'include':_0x101526[_0x151a('0x1a')]?_['map'](_0x101526[_0x151a('0x1a')],function(_0xd506f3){return{'model':db[_0xd506f3[_0x151a('0x1c')]],'as':_0xd506f3['as'],'attributes':_0xd506f3['attributes'],'include':_0xd506f3['include']?_[_0x151a('0x1b')](_0xd506f3[_0x151a('0x1a')],function(_0x447651){return{'model':db[_0x447651[_0x151a('0x1c')]],'as':_0x447651['as'],'attributes':_0x447651[_0x151a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x151a('0xb')](function(_0x5dee33){logger[_0x151a('0xc')]('GetMailServerIn',_0x3c26cc);logger[_0x151a('0x1e')](_0x151a('0x14'),_0x3c26cc,JSON[_0x151a('0x1f')](_0x5dee33));_0x428c7a(_0x5dee33);})['catch'](function(_0x3c3143){logger['error'](_0x151a('0x14'),_0x3c3143[_0x151a('0x12')],_0x3c26cc);_0x1ec3c8(_0x3ff58b[_0x151a('0x11')](0x1f4,_0x3c3143['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index fee3edf..fc17b27 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 235a3a7..99b8079 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 _0x5ec6=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x1cc961,_0x2c42ee){var _0x471d86=function(_0x44e422){while(--_0x44e422){_0x1cc961['push'](_0x1cc961['shift']());}};_0x471d86(++_0x2c42ee);}(_0x5ec6,0x7f));var _0x65ec=function(_0x19c6e0,_0x4cd3de){_0x19c6e0=_0x19c6e0-0x0;var _0xc1ca62=_0x5ec6[_0x19c6e0];return _0xc1ca62;};'use strict';var Sequelize=require(_0x65ec('0x0'));module[_0x65ec('0x1')]={'description':{'type':Sequelize[_0x65ec('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x65ec('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x65ec('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x65ec('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x65ec('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xae60=['sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x599cd6,_0x383636){var _0x572d24=function(_0x407983){while(--_0x407983){_0x599cd6['push'](_0x599cd6['shift']());}};_0x572d24(++_0x383636);}(_0xae60,0x1c7));var _0x0ae6=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xae60[_0x344a3f];return _0x264712;};'use strict';var Sequelize=require(_0x0ae6('0x0'));module[_0x0ae6('0x1')]={'description':{'type':Sequelize[_0x0ae6('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x0ae6('0x2')]},'pass':{'type':Sequelize[_0x0ae6('0x2')]},'port':{'type':Sequelize[_0x0ae6('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x0ae6('0x2')]},'authentication':{'type':Sequelize[_0x0ae6('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index ad16fa4..b2d7b1e 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 _0x2b20=['rawAttributes','type','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','rows','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','reject','save','update','then','destroy','error','stack','name','send','index','map','MailServerOut'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x2b20,0xe3));var _0x02b2=function(_0x1f7343,_0x589739){_0x1f7343=_0x1f7343-0x0;var _0x36ab39=_0x2b20[_0x1f7343];return _0x36ab39;};'use strict';var emlformat=require(_0x02b2('0x0'));var rimraf=require(_0x02b2('0x1'));var zipdir=require(_0x02b2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x02b2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x02b2('0x4'));var util=require('util');var path=require(_0x02b2('0x5'));var sox=require('sox');var csv=require(_0x02b2('0x6'));var ejs=require(_0x02b2('0x7'));var fs=require('fs');var fs_extra=require(_0x02b2('0x8'));var _=require(_0x02b2('0x9'));var squel=require(_0x02b2('0xa'));var crypto=require(_0x02b2('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x02b2('0xc'));var toCsv=require(_0x02b2('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x02b2('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x02b2('0xe'));var hardwareService=require(_0x02b2('0xf'));var logger=require(_0x02b2('0x10'))(_0x02b2('0x11'));var utils=require(_0x02b2('0x12'));var config=require(_0x02b2('0x13'));var licenseUtil=require(_0x02b2('0x14'));var db=require(_0x02b2('0x15'))['db'];function respondWithStatusCode(_0x27010d,_0x2a595a){_0x2a595a=_0x2a595a||0xcc;return function(_0x1a411b){if(_0x1a411b){return _0x27010d[_0x02b2('0x16')](_0x2a595a);}return _0x27010d[_0x02b2('0x17')](_0x2a595a)['end']();};}function respondWithResult(_0x21bf6e,_0x1875fb){_0x1875fb=_0x1875fb||0xc8;return function(_0x12572e){if(_0x12572e){return _0x21bf6e[_0x02b2('0x17')](_0x1875fb)[_0x02b2('0x18')](_0x12572e);}};}function respondWithFilteredResult(_0x348612,_0x159424){return function(_0x6c0239){if(_0x6c0239){var _0x3eaac3=typeof _0x159424[_0x02b2('0x19')]===_0x02b2('0x1a')&&typeof _0x159424[_0x02b2('0x1b')]===_0x02b2('0x1a');var _0x3d0d44=_0x6c0239[_0x02b2('0x1c')];var _0xa5271e=_0x3eaac3?0x0:_0x159424[_0x02b2('0x19')];var _0x204c63=_0x3eaac3?_0x6c0239['count']:_0x159424['offset']+_0x159424[_0x02b2('0x1b')];var _0x35afad;if(_0x204c63>=_0x3d0d44){_0x204c63=_0x3d0d44;_0x35afad=0xc8;}else{_0x35afad=0xce;}_0x348612['status'](_0x35afad);return _0x348612['set']('Content-Range',_0xa5271e+'-'+_0x204c63+'/'+_0x3d0d44)[_0x02b2('0x18')](_0x6c0239);}return null;};}function patchUpdates(_0x400f3b){return function(_0x4c8001){try{jsonpatch['apply'](_0x4c8001,_0x400f3b,!![]);}catch(_0x5a156c){return BPromise[_0x02b2('0x1d')](_0x5a156c);}return _0x4c8001[_0x02b2('0x1e')]();};}function saveUpdates(_0x15a3b1,_0x156585){return function(_0x8e2d59){if(_0x8e2d59){return _0x8e2d59[_0x02b2('0x1f')](_0x15a3b1)[_0x02b2('0x20')](function(_0x5e2226){return _0x5e2226;});}return null;};}function removeEntity(_0x1f66e0,_0x5125c7){return function(_0x3dab1c){if(_0x3dab1c){return _0x3dab1c[_0x02b2('0x21')]()[_0x02b2('0x20')](function(){_0x1f66e0[_0x02b2('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x285937,_0x5d1c63){return function(_0x1f89ff){if(!_0x1f89ff){_0x285937[_0x02b2('0x16')](0x194);}return _0x1f89ff;};}function handleError(_0xabb63d,_0x2286de){_0x2286de=_0x2286de||0x1f4;return function(_0x2a638a){logger[_0x02b2('0x22')](_0x2a638a[_0x02b2('0x23')]);if(_0x2a638a[_0x02b2('0x24')]){delete _0x2a638a[_0x02b2('0x24')];}_0xabb63d[_0x02b2('0x17')](_0x2286de)[_0x02b2('0x25')](_0x2a638a);};}exports[_0x02b2('0x26')]=function(_0x109774,_0x119ff0){var _0x337d9c={},_0x5ab5d4={},_0x8856d4={'count':0x0,'rows':[]};var _0x2db665=_[_0x02b2('0x27')](db[_0x02b2('0x28')][_0x02b2('0x29')],function(_0x2855d7){return{'name':_0x2855d7['fieldName'],'type':_0x2855d7[_0x02b2('0x2a')]['key']};});_0x5ab5d4[_0x02b2('0x2b')]=_[_0x02b2('0x27')](_0x2db665,_0x02b2('0x24'));_0x5ab5d4[_0x02b2('0x2c')]=_[_0x02b2('0x2d')](_0x109774[_0x02b2('0x2c')]);_0x5ab5d4['filters']=_[_0x02b2('0x2e')](_0x5ab5d4[_0x02b2('0x2b')],_0x5ab5d4[_0x02b2('0x2c')]);_0x337d9c[_0x02b2('0x2f')]=_[_0x02b2('0x2e')](_0x5ab5d4[_0x02b2('0x2b')],qs[_0x02b2('0x30')](_0x109774[_0x02b2('0x2c')][_0x02b2('0x30')]));_0x337d9c[_0x02b2('0x2f')]=_0x337d9c['attributes'][_0x02b2('0x31')]?_0x337d9c['attributes']:_0x5ab5d4['model'];if(!_0x109774[_0x02b2('0x2c')]['hasOwnProperty'](_0x02b2('0x32'))){_0x337d9c[_0x02b2('0x1b')]=qs[_0x02b2('0x1b')](_0x109774[_0x02b2('0x2c')][_0x02b2('0x1b')]);_0x337d9c[_0x02b2('0x19')]=qs[_0x02b2('0x19')](_0x109774[_0x02b2('0x2c')][_0x02b2('0x19')]);}_0x337d9c[_0x02b2('0x33')]=qs[_0x02b2('0x34')](_0x109774[_0x02b2('0x2c')][_0x02b2('0x34')]);_0x337d9c[_0x02b2('0x35')]=qs[_0x02b2('0x36')](_['pick'](_0x109774[_0x02b2('0x2c')],_0x5ab5d4[_0x02b2('0x36')]),_0x2db665);if(_0x109774[_0x02b2('0x2c')][_0x02b2('0x37')]){_0x337d9c[_0x02b2('0x35')]=_[_0x02b2('0x38')](_0x337d9c[_0x02b2('0x35')],{'$or':_['map'](_0x2db665,function(_0x48c121){if(_0x48c121[_0x02b2('0x2a')]!=='VIRTUAL'){var _0x539321={};_0x539321[_0x48c121[_0x02b2('0x24')]]={'$like':'%'+_0x109774[_0x02b2('0x2c')][_0x02b2('0x37')]+'%'};return _0x539321;}})});}_0x337d9c=_[_0x02b2('0x38')]({},_0x337d9c,_0x109774[_0x02b2('0x39')]);var _0x153c56={'where':_0x337d9c[_0x02b2('0x35')]};return db[_0x02b2('0x28')][_0x02b2('0x1c')](_0x153c56)[_0x02b2('0x20')](function(_0x30d2c9){_0x8856d4['count']=_0x30d2c9;if(_0x109774[_0x02b2('0x2c')][_0x02b2('0x3a')]){_0x337d9c[_0x02b2('0x3b')]=[{'all':!![]}];}return db['MailServerOut']['findAll'](_0x337d9c);})[_0x02b2('0x20')](function(_0x4b506a){_0x8856d4[_0x02b2('0x3c')]=_0x4b506a;return _0x8856d4;})[_0x02b2('0x20')](respondWithFilteredResult(_0x119ff0,_0x337d9c))[_0x02b2('0x3d')](handleError(_0x119ff0,null));};exports[_0x02b2('0x3e')]=function(_0x3eaccc,_0x5706bc){var _0x395d4a={'raw':!![],'where':{'id':_0x3eaccc[_0x02b2('0x3f')]['id']}},_0x429c20={};_0x429c20['model']=_[_0x02b2('0x2d')](db[_0x02b2('0x28')][_0x02b2('0x29')]);_0x429c20['query']=_[_0x02b2('0x2d')](_0x3eaccc[_0x02b2('0x2c')]);_0x429c20[_0x02b2('0x36')]=_[_0x02b2('0x2e')](_0x429c20[_0x02b2('0x2b')],_0x429c20[_0x02b2('0x2c')]);_0x395d4a[_0x02b2('0x2f')]=_['intersection'](_0x429c20['model'],qs[_0x02b2('0x30')](_0x3eaccc[_0x02b2('0x2c')]['fields']));_0x395d4a['attributes']=_0x395d4a[_0x02b2('0x2f')][_0x02b2('0x31')]?_0x395d4a['attributes']:_0x429c20[_0x02b2('0x2b')];if(_0x3eaccc[_0x02b2('0x2c')][_0x02b2('0x3a')]){_0x395d4a[_0x02b2('0x3b')]=[{'all':!![]}];}_0x395d4a=_['merge']({},_0x395d4a,_0x3eaccc[_0x02b2('0x39')]);return db[_0x02b2('0x28')]['find'](_0x395d4a)['then'](handleEntityNotFound(_0x5706bc,null))[_0x02b2('0x20')](respondWithResult(_0x5706bc,null))[_0x02b2('0x3d')](handleError(_0x5706bc,null));};exports['create']=function(_0x44177c,_0x1331b3){return db[_0x02b2('0x28')][_0x02b2('0x40')](_0x44177c[_0x02b2('0x41')],{})[_0x02b2('0x20')](respondWithResult(_0x1331b3,0xc9))[_0x02b2('0x3d')](handleError(_0x1331b3,null));};exports['update']=function(_0x219850,_0x7eace2){if(_0x219850[_0x02b2('0x41')]['id']){delete _0x219850[_0x02b2('0x41')]['id'];}return db[_0x02b2('0x28')][_0x02b2('0x42')]({'where':{'id':_0x219850[_0x02b2('0x3f')]['id']}})['then'](handleEntityNotFound(_0x7eace2,null))['then'](saveUpdates(_0x219850[_0x02b2('0x41')],null))[_0x02b2('0x20')](respondWithResult(_0x7eace2,null))['catch'](handleError(_0x7eace2,null));};exports[_0x02b2('0x21')]=function(_0x17ee42,_0x4a2501){return db[_0x02b2('0x28')]['find']({'where':{'id':_0x17ee42[_0x02b2('0x3f')]['id']}})[_0x02b2('0x20')](handleEntityNotFound(_0x4a2501,null))[_0x02b2('0x20')](removeEntity(_0x4a2501,null))[_0x02b2('0x3d')](handleError(_0x4a2501,null));}; \ No newline at end of file +var _0x2806=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','index','rawAttributes','fieldName','type','key','map','query','filters','attributes','intersection','model','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','MailServerOut','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x2806,0x79));var _0x6280=function(_0x120ca5,_0x17ab66){_0x120ca5=_0x120ca5-0x0;var _0x336a4f=_0x2806[_0x120ca5];return _0x336a4f;};'use strict';var emlformat=require(_0x6280('0x0'));var rimraf=require(_0x6280('0x1'));var zipdir=require(_0x6280('0x2'));var jsonpatch=require(_0x6280('0x3'));var rp=require('request-promise');var moment=require(_0x6280('0x4'));var BPromise=require(_0x6280('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6280('0x6'));var sox=require(_0x6280('0x7'));var csv=require('to-csv');var ejs=require(_0x6280('0x8'));var fs=require('fs');var fs_extra=require(_0x6280('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6280('0xa'));var jsforce=require(_0x6280('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6280('0xc'));var querystring=require('querystring');var Papa=require(_0x6280('0xd'));var Redis=require(_0x6280('0xe'));var authService=require(_0x6280('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x6280('0x10'));var hardwareService=require(_0x6280('0x11'));var logger=require(_0x6280('0x12'))(_0x6280('0x13'));var utils=require(_0x6280('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6280('0x15'));var db=require(_0x6280('0x16'))['db'];function respondWithStatusCode(_0x5a6284,_0x2bac88){_0x2bac88=_0x2bac88||0xcc;return function(_0x5cb649){if(_0x5cb649){return _0x5a6284[_0x6280('0x17')](_0x2bac88);}return _0x5a6284[_0x6280('0x18')](_0x2bac88)[_0x6280('0x19')]();};}function respondWithResult(_0x4ed9e7,_0x16b4d1){_0x16b4d1=_0x16b4d1||0xc8;return function(_0x1c820d){if(_0x1c820d){return _0x4ed9e7[_0x6280('0x18')](_0x16b4d1)[_0x6280('0x1a')](_0x1c820d);}};}function respondWithFilteredResult(_0x1f99eb,_0x2fb3e5){return function(_0x1eed1a){if(_0x1eed1a){var _0x4f099f=typeof _0x2fb3e5[_0x6280('0x1b')]===_0x6280('0x1c')&&typeof _0x2fb3e5[_0x6280('0x1d')]==='undefined';var _0x395634=_0x1eed1a[_0x6280('0x1e')];var _0x1fb241=_0x4f099f?0x0:_0x2fb3e5[_0x6280('0x1b')];var _0x217e3b=_0x4f099f?_0x1eed1a[_0x6280('0x1e')]:_0x2fb3e5[_0x6280('0x1b')]+_0x2fb3e5[_0x6280('0x1d')];var _0x320764;if(_0x217e3b>=_0x395634){_0x217e3b=_0x395634;_0x320764=0xc8;}else{_0x320764=0xce;}_0x1f99eb[_0x6280('0x18')](_0x320764);return _0x1f99eb[_0x6280('0x1f')](_0x6280('0x20'),_0x1fb241+'-'+_0x217e3b+'/'+_0x395634)[_0x6280('0x1a')](_0x1eed1a);}return null;};}function patchUpdates(_0x5b0384){return function(_0x420f39){try{jsonpatch[_0x6280('0x21')](_0x420f39,_0x5b0384,!![]);}catch(_0x314e26){return BPromise[_0x6280('0x22')](_0x314e26);}return _0x420f39[_0x6280('0x23')]();};}function saveUpdates(_0x5935f4,_0x3aa390){return function(_0x38c91f){if(_0x38c91f){return _0x38c91f[_0x6280('0x24')](_0x5935f4)[_0x6280('0x25')](function(_0x2fb2b9){return _0x2fb2b9;});}return null;};}function removeEntity(_0x53cb59,_0x49536b){return function(_0x3373b4){if(_0x3373b4){return _0x3373b4['destroy']()[_0x6280('0x25')](function(){_0x53cb59[_0x6280('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d1efd,_0x4f9bed){return function(_0x2c9b1e){if(!_0x2c9b1e){_0x1d1efd[_0x6280('0x17')](0x194);}return _0x2c9b1e;};}function handleError(_0x1bf338,_0x13bee2){_0x13bee2=_0x13bee2||0x1f4;return function(_0x3e9db4){logger[_0x6280('0x26')](_0x3e9db4['stack']);if(_0x3e9db4[_0x6280('0x27')]){delete _0x3e9db4[_0x6280('0x27')];}_0x1bf338[_0x6280('0x18')](_0x13bee2)['send'](_0x3e9db4);};}exports[_0x6280('0x28')]=function(_0x1db64d,_0x367b49){var _0x557c1e={},_0x215071={},_0x54f9ba={'count':0x0,'rows':[]};var _0x5b1c02=_['map'](db['MailServerOut'][_0x6280('0x29')],function(_0x4a2106){return{'name':_0x4a2106[_0x6280('0x2a')],'type':_0x4a2106[_0x6280('0x2b')][_0x6280('0x2c')]};});_0x215071['model']=_[_0x6280('0x2d')](_0x5b1c02,_0x6280('0x27'));_0x215071[_0x6280('0x2e')]=_['keys'](_0x1db64d[_0x6280('0x2e')]);_0x215071[_0x6280('0x2f')]=_['intersection'](_0x215071['model'],_0x215071[_0x6280('0x2e')]);_0x557c1e[_0x6280('0x30')]=_[_0x6280('0x31')](_0x215071[_0x6280('0x32')],qs['fields'](_0x1db64d[_0x6280('0x2e')][_0x6280('0x33')]));_0x557c1e[_0x6280('0x30')]=_0x557c1e['attributes'][_0x6280('0x34')]?_0x557c1e[_0x6280('0x30')]:_0x215071['model'];if(!_0x1db64d[_0x6280('0x2e')]['hasOwnProperty'](_0x6280('0x35'))){_0x557c1e[_0x6280('0x1d')]=qs[_0x6280('0x1d')](_0x1db64d['query'][_0x6280('0x1d')]);_0x557c1e[_0x6280('0x1b')]=qs['offset'](_0x1db64d[_0x6280('0x2e')][_0x6280('0x1b')]);}_0x557c1e['order']=qs[_0x6280('0x36')](_0x1db64d['query'][_0x6280('0x36')]);_0x557c1e[_0x6280('0x37')]=qs[_0x6280('0x2f')](_['pick'](_0x1db64d['query'],_0x215071[_0x6280('0x2f')]),_0x5b1c02);if(_0x1db64d['query'][_0x6280('0x38')]){_0x557c1e['where']=_[_0x6280('0x39')](_0x557c1e[_0x6280('0x37')],{'$or':_['map'](_0x5b1c02,function(_0x539a87){if(_0x539a87[_0x6280('0x2b')]!==_0x6280('0x3a')){var _0x2700f2={};_0x2700f2[_0x539a87[_0x6280('0x27')]]={'$like':'%'+_0x1db64d[_0x6280('0x2e')][_0x6280('0x38')]+'%'};return _0x2700f2;}})});}_0x557c1e=_[_0x6280('0x39')]({},_0x557c1e,_0x1db64d[_0x6280('0x3b')]);var _0xab4636={'where':_0x557c1e['where']};return db['MailServerOut']['count'](_0xab4636)[_0x6280('0x25')](function(_0x2ab9b8){_0x54f9ba[_0x6280('0x1e')]=_0x2ab9b8;if(_0x1db64d[_0x6280('0x2e')]['includeAll']){_0x557c1e[_0x6280('0x3c')]=[{'all':!![]}];}return db['MailServerOut'][_0x6280('0x3d')](_0x557c1e);})[_0x6280('0x25')](function(_0x208af7){_0x54f9ba[_0x6280('0x3e')]=_0x208af7;return _0x54f9ba;})[_0x6280('0x25')](respondWithFilteredResult(_0x367b49,_0x557c1e))[_0x6280('0x3f')](handleError(_0x367b49,null));};exports[_0x6280('0x40')]=function(_0x530227,_0x57649b){var _0x184b05={'raw':!![],'where':{'id':_0x530227[_0x6280('0x41')]['id']}},_0x3a1347={};_0x3a1347[_0x6280('0x32')]=_[_0x6280('0x42')](db[_0x6280('0x43')][_0x6280('0x29')]);_0x3a1347['query']=_[_0x6280('0x42')](_0x530227[_0x6280('0x2e')]);_0x3a1347[_0x6280('0x2f')]=_[_0x6280('0x31')](_0x3a1347[_0x6280('0x32')],_0x3a1347['query']);_0x184b05[_0x6280('0x30')]=_[_0x6280('0x31')](_0x3a1347[_0x6280('0x32')],qs[_0x6280('0x33')](_0x530227[_0x6280('0x2e')][_0x6280('0x33')]));_0x184b05[_0x6280('0x30')]=_0x184b05[_0x6280('0x30')]['length']?_0x184b05['attributes']:_0x3a1347['model'];if(_0x530227[_0x6280('0x2e')]['includeAll']){_0x184b05[_0x6280('0x3c')]=[{'all':!![]}];}_0x184b05=_[_0x6280('0x39')]({},_0x184b05,_0x530227[_0x6280('0x3b')]);return db[_0x6280('0x43')][_0x6280('0x44')](_0x184b05)[_0x6280('0x25')](handleEntityNotFound(_0x57649b,null))[_0x6280('0x25')](respondWithResult(_0x57649b,null))[_0x6280('0x3f')](handleError(_0x57649b,null));};exports['create']=function(_0x3fd6dc,_0xf8ab9c){return db[_0x6280('0x43')][_0x6280('0x45')](_0x3fd6dc[_0x6280('0x46')],{})[_0x6280('0x25')](respondWithResult(_0xf8ab9c,0xc9))[_0x6280('0x3f')](handleError(_0xf8ab9c,null));};exports[_0x6280('0x24')]=function(_0x4bed5f,_0x29cf19){if(_0x4bed5f[_0x6280('0x46')]['id']){delete _0x4bed5f[_0x6280('0x46')]['id'];}return db[_0x6280('0x43')][_0x6280('0x44')]({'where':{'id':_0x4bed5f[_0x6280('0x41')]['id']}})[_0x6280('0x25')](handleEntityNotFound(_0x29cf19,null))[_0x6280('0x25')](saveUpdates(_0x4bed5f[_0x6280('0x46')],null))['then'](respondWithResult(_0x29cf19,null))[_0x6280('0x3f')](handleError(_0x29cf19,null));};exports[_0x6280('0x47')]=function(_0x2f9602,_0x1a065b){return db[_0x6280('0x43')][_0x6280('0x44')]({'where':{'id':_0x2f9602[_0x6280('0x41')]['id']}})[_0x6280('0x25')](handleEntityNotFound(_0x1a065b,null))[_0x6280('0x25')](removeEntity(_0x1a065b,null))['catch'](handleError(_0x1a065b,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 7ac10d7..732fef5 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 _0x3e5a=['define','mail_servers_out','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailServerOut.attributes','exports'];(function(_0x4d0419,_0x1a99b3){var _0xc93a0e=function(_0x3f1544){while(--_0x3f1544){_0x4d0419['push'](_0x4d0419['shift']());}};_0xc93a0e(++_0x1a99b3);}(_0x3e5a,0x77));var _0xa3e5=function(_0x401a60,_0x233e06){_0x401a60=_0x401a60-0x0;var _0x4160dc=_0x3e5a[_0x401a60];return _0x4160dc;};'use strict';var _=require(_0xa3e5('0x0'));var util=require(_0xa3e5('0x1'));var logger=require(_0xa3e5('0x2'))(_0xa3e5('0x3'));var moment=require(_0xa3e5('0x4'));var BPromise=require(_0xa3e5('0x5'));var rp=require(_0xa3e5('0x6'));var fs=require('fs');var path=require(_0xa3e5('0x7'));var rimraf=require(_0xa3e5('0x8'));var config=require('../../config/environment');var attributes=require(_0xa3e5('0x9'));module[_0xa3e5('0xa')]=function(_0x4984a9,_0x5c15e4){return _0x4984a9[_0xa3e5('0xb')]('MailServerOut',attributes,{'tableName':_0xa3e5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0554=['rimraf','exports','MailServerOut','mail_servers_out','lodash','util','api','bluebird','request-promise','path'];(function(_0x1d2181,_0x11571c){var _0x23230e=function(_0x2c1460){while(--_0x2c1460){_0x1d2181['push'](_0x1d2181['shift']());}};_0x23230e(++_0x11571c);}(_0x0554,0x176));var _0x4055=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x0554[_0x1cfa0d];return _0xe33279;};'use strict';var _=require(_0x4055('0x0'));var util=require(_0x4055('0x1'));var logger=require('../../config/logger')(_0x4055('0x2'));var moment=require('moment');var BPromise=require(_0x4055('0x3'));var rp=require(_0x4055('0x4'));var fs=require('fs');var path=require(_0x4055('0x5'));var rimraf=require(_0x4055('0x6'));var config=require('../../config/environment');var attributes=require('./mailServerOut.attributes');module[_0x4055('0x7')]=function(_0x1a3f72,_0x53db98){return _0x1a3f72['define'](_0x4055('0x8'),attributes,{'tableName':_0x4055('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 54af97b..4a7b2e1 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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x30732c,_0x458d86){var _0x38c0e0=function(_0xd00f4a){while(--_0xd00f4a){_0x30732c['push'](_0x30732c['shift']());}};_0x38c0e0(++_0x458d86);}(_0xdb28,0x106));var _0x8db2=function(_0x2a420d,_0x1f097e){_0x2a420d=_0x2a420d-0x0;var _0x1fe5de=_0xdb28[_0x2a420d];return _0x1fe5de;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x4f7615,_0x16b357){var _0x184c1a=function(_0x6fc47c){while(--_0x6fc47c){_0x4f7615['push'](_0x4f7615['shift']());}};_0x184c1a(++_0x16b357);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xc4aa[_0x4d613c];return _0x301fe3;};'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')]('MailServerOut,\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/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index a3f4063..d4cc41f 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 _0xbc5b=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','destroy','multer','util','path','connect-timeout'];(function(_0x56f986,_0x2f70f9){var _0x988957=function(_0x3b3183){while(--_0x3b3183){_0x56f986['push'](_0x56f986['shift']());}};_0x988957(++_0x2f70f9);}(_0xbc5b,0x1a0));var _0xbbc5=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xbc5b[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0xbbc5('0x0'));var util=require(_0xbbc5('0x1'));var path=require(_0xbbc5('0x2'));var timeout=require(_0xbbc5('0x3'));var express=require(_0xbbc5('0x4'));var router=express[_0xbbc5('0x5')]();var fs_extra=require(_0xbbc5('0x6'));var auth=require(_0xbbc5('0x7'));var interaction=require(_0xbbc5('0x8'));var config=require('../../config/environment');var controller=require(_0xbbc5('0x9'));router[_0xbbc5('0xa')]('/',auth[_0xbbc5('0xb')](),controller[_0xbbc5('0xc')]);router[_0xbbc5('0xa')](_0xbbc5('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0xbbc5('0xa')](_0xbbc5('0xe'),auth[_0xbbc5('0xb')](),controller[_0xbbc5('0xf')]);router[_0xbbc5('0x10')]('/',auth[_0xbbc5('0xb')](),controller[_0xbbc5('0x11')]);router[_0xbbc5('0x12')](_0xbbc5('0xe'),auth['isAuthenticated'](),controller[_0xbbc5('0x13')]);router['delete'](_0xbbc5('0xe'),auth['isAuthenticated'](),controller[_0xbbc5('0x14')]);module['exports']=router; \ No newline at end of file +var _0x035e=['show','post','put','update','delete','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','/describe','/:id'];(function(_0x4b4f24,_0x5654a8){var _0x1c13d4=function(_0x4940bf){while(--_0x4940bf){_0x4b4f24['push'](_0x4b4f24['shift']());}};_0x1c13d4(++_0x5654a8);}(_0x035e,0x16e));var _0xe035=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x035e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xe035('0x0'));var util=require(_0xe035('0x1'));var path=require('path');var timeout=require(_0xe035('0x2'));var express=require('express');var router=express[_0xe035('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe035('0x4'));var interaction=require(_0xe035('0x5'));var config=require(_0xe035('0x6'));var controller=require(_0xe035('0x7'));router[_0xe035('0x8')]('/',auth[_0xe035('0x9')](),controller['index']);router[_0xe035('0x8')](_0xe035('0xa'),auth[_0xe035('0x9')](),controller['describe']);router[_0xe035('0x8')](_0xe035('0xb'),auth['isAuthenticated'](),controller[_0xe035('0xc')]);router[_0xe035('0xd')]('/',auth[_0xe035('0x9')](),controller['create']);router[_0xe035('0xe')](_0xe035('0xb'),auth[_0xe035('0x9')](),controller[_0xe035('0xf')]);router[_0xe035('0x10')]('/:id',auth[_0xe035('0x9')](),controller[_0xe035('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 4184173..21edb01 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 _0x90ec=['sequelize','exports','name','STRING'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x90ec,0x1d4));var _0xc90e=function(_0x516224,_0x23bca8){_0x516224=_0x516224-0x0;var _0x28ca54=_0x90ec[_0x516224];return _0x28ca54;};'use strict';var Sequelize=require(_0xc90e('0x0'));module[_0xc90e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xc90e('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc90e('0x3')]}}; \ No newline at end of file +var _0xeda8=['sequelize','exports','name','STRING'];(function(_0x3fd42e,_0xf3fa18){var _0x365d7c=function(_0x23dd54){while(--_0x23dd54){_0x3fd42e['push'](_0x3fd42e['shift']());}};_0x365d7c(++_0xf3fa18);}(_0xeda8,0x104));var _0x8eda=function(_0x28adee,_0xf80459){_0x28adee=_0x28adee-0x0;var _0x1244a5=_0xeda8[_0x28adee];return _0x1244a5;};'use strict';var Sequelize=require(_0x8eda('0x0'));module[_0x8eda('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x8eda('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8eda('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 22838f8..74d7d66 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 _0xecff=['index','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','MailSubstatus','params','includeAll','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','end','stack','name'];(function(_0x4b1b8e,_0x1c4422){var _0x569e9c=function(_0x2db9bf){while(--_0x2db9bf){_0x4b1b8e['push'](_0x4b1b8e['shift']());}};_0x569e9c(++_0x1c4422);}(_0xecff,0x1bc));var _0xfecf=function(_0x2b3aaa,_0x1af597){_0x2b3aaa=_0x2b3aaa-0x0;var _0xbc3f50=_0xecff[_0x2b3aaa];return _0xbc3f50;};'use strict';var emlformat=require(_0xfecf('0x0'));var rimraf=require(_0xfecf('0x1'));var zipdir=require(_0xfecf('0x2'));var jsonpatch=require(_0xfecf('0x3'));var rp=require(_0xfecf('0x4'));var moment=require(_0xfecf('0x5'));var BPromise=require(_0xfecf('0x6'));var Mustache=require('mustache');var util=require(_0xfecf('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xfecf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfecf('0x9'));var squel=require(_0xfecf('0xa'));var crypto=require(_0xfecf('0xb'));var jsforce=require(_0xfecf('0xc'));var deskjs=require(_0xfecf('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfecf('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xfecf('0xf'));var as=require(_0xfecf('0x10'));var hardwareService=require(_0xfecf('0x11'));var logger=require(_0xfecf('0x12'))(_0xfecf('0x13'));var utils=require(_0xfecf('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xfecf('0x15'));var db=require(_0xfecf('0x16'))['db'];function respondWithStatusCode(_0x7c76a3,_0xb0d9dd){_0xb0d9dd=_0xb0d9dd||0xcc;return function(_0x1149b1){if(_0x1149b1){return _0x7c76a3[_0xfecf('0x17')](_0xb0d9dd);}return _0x7c76a3[_0xfecf('0x18')](_0xb0d9dd)['end']();};}function respondWithResult(_0x3411be,_0x3e6065){_0x3e6065=_0x3e6065||0xc8;return function(_0x286456){if(_0x286456){return _0x3411be[_0xfecf('0x18')](_0x3e6065)[_0xfecf('0x19')](_0x286456);}};}function respondWithFilteredResult(_0xc93e9a,_0x2282bd){return function(_0x3f0d94){if(_0x3f0d94){var _0xe9892c=typeof _0x2282bd[_0xfecf('0x1a')]===_0xfecf('0x1b')&&typeof _0x2282bd[_0xfecf('0x1c')]==='undefined';var _0x3d2e2a=_0x3f0d94[_0xfecf('0x1d')];var _0x5bc363=_0xe9892c?0x0:_0x2282bd['offset'];var _0x4cccfa=_0xe9892c?_0x3f0d94[_0xfecf('0x1d')]:_0x2282bd[_0xfecf('0x1a')]+_0x2282bd[_0xfecf('0x1c')];var _0x1fae90;if(_0x4cccfa>=_0x3d2e2a){_0x4cccfa=_0x3d2e2a;_0x1fae90=0xc8;}else{_0x1fae90=0xce;}_0xc93e9a[_0xfecf('0x18')](_0x1fae90);return _0xc93e9a[_0xfecf('0x1e')](_0xfecf('0x1f'),_0x5bc363+'-'+_0x4cccfa+'/'+_0x3d2e2a)['json'](_0x3f0d94);}return null;};}function patchUpdates(_0x208bf2){return function(_0x3f7115){try{jsonpatch[_0xfecf('0x20')](_0x3f7115,_0x208bf2,!![]);}catch(_0x17cb21){return BPromise['reject'](_0x17cb21);}return _0x3f7115['save']();};}function saveUpdates(_0x2bdec9,_0x2bd618){return function(_0x2d77ae){if(_0x2d77ae){return _0x2d77ae[_0xfecf('0x21')](_0x2bdec9)[_0xfecf('0x22')](function(_0x5464a8){return _0x5464a8;});}return null;};}function removeEntity(_0x2d8a7a,_0x2ed15c){return function(_0x509c36){if(_0x509c36){return _0x509c36[_0xfecf('0x23')]()[_0xfecf('0x22')](function(){_0x2d8a7a[_0xfecf('0x18')](0xcc)[_0xfecf('0x24')]();});}};}function handleEntityNotFound(_0x38cc90,_0x19ef53){return function(_0x4c5ccc){if(!_0x4c5ccc){_0x38cc90[_0xfecf('0x17')](0x194);}return _0x4c5ccc;};}function handleError(_0x550572,_0x55ce20){_0x55ce20=_0x55ce20||0x1f4;return function(_0x27dc97){logger['error'](_0x27dc97[_0xfecf('0x25')]);if(_0x27dc97[_0xfecf('0x26')]){delete _0x27dc97[_0xfecf('0x26')];}_0x550572[_0xfecf('0x18')](_0x55ce20)['send'](_0x27dc97);};}exports[_0xfecf('0x27')]=function(_0x3e9f2c,_0x20b080){var _0x210255={},_0xd308e5={},_0x381d3e={'count':0x0,'rows':[]};var _0x175723=_[_0xfecf('0x28')](db['MailSubstatus']['rawAttributes'],function(_0x2e3e0f){return{'name':_0x2e3e0f[_0xfecf('0x29')],'type':_0x2e3e0f[_0xfecf('0x2a')][_0xfecf('0x2b')]};});_0xd308e5[_0xfecf('0x2c')]=_[_0xfecf('0x28')](_0x175723,_0xfecf('0x26'));_0xd308e5[_0xfecf('0x2d')]=_[_0xfecf('0x2e')](_0x3e9f2c['query']);_0xd308e5[_0xfecf('0x2f')]=_['intersection'](_0xd308e5['model'],_0xd308e5['query']);_0x210255['attributes']=_[_0xfecf('0x30')](_0xd308e5[_0xfecf('0x2c')],qs['fields'](_0x3e9f2c['query'][_0xfecf('0x31')]));_0x210255[_0xfecf('0x32')]=_0x210255[_0xfecf('0x32')][_0xfecf('0x33')]?_0x210255[_0xfecf('0x32')]:_0xd308e5[_0xfecf('0x2c')];if(!_0x3e9f2c['query'][_0xfecf('0x34')](_0xfecf('0x35'))){_0x210255[_0xfecf('0x1c')]=qs[_0xfecf('0x1c')](_0x3e9f2c[_0xfecf('0x2d')][_0xfecf('0x1c')]);_0x210255['offset']=qs['offset'](_0x3e9f2c[_0xfecf('0x2d')][_0xfecf('0x1a')]);}_0x210255['order']=qs[_0xfecf('0x36')](_0x3e9f2c[_0xfecf('0x2d')][_0xfecf('0x36')]);_0x210255[_0xfecf('0x37')]=qs[_0xfecf('0x2f')](_[_0xfecf('0x38')](_0x3e9f2c[_0xfecf('0x2d')],_0xd308e5[_0xfecf('0x2f')]),_0x175723);if(_0x3e9f2c[_0xfecf('0x2d')][_0xfecf('0x39')]){_0x210255[_0xfecf('0x37')]=_[_0xfecf('0x3a')](_0x210255[_0xfecf('0x37')],{'$or':_['map'](_0x175723,function(_0x4ac7d0){if(_0x4ac7d0[_0xfecf('0x2a')]!=='VIRTUAL'){var _0x134018={};_0x134018[_0x4ac7d0[_0xfecf('0x26')]]={'$like':'%'+_0x3e9f2c[_0xfecf('0x2d')][_0xfecf('0x39')]+'%'};return _0x134018;}})});}_0x210255=_[_0xfecf('0x3a')]({},_0x210255,_0x3e9f2c[_0xfecf('0x3b')]);var _0x353747={'where':_0x210255[_0xfecf('0x37')]};return db['MailSubstatus'][_0xfecf('0x1d')](_0x353747)[_0xfecf('0x22')](function(_0xf59d34){_0x381d3e[_0xfecf('0x1d')]=_0xf59d34;if(_0x3e9f2c['query']['includeAll']){_0x210255[_0xfecf('0x3c')]=[{'all':!![]}];}return db[_0xfecf('0x3d')]['findAll'](_0x210255);})[_0xfecf('0x22')](function(_0x3472d7){_0x381d3e['rows']=_0x3472d7;return _0x381d3e;})[_0xfecf('0x22')](respondWithFilteredResult(_0x20b080,_0x210255))['catch'](handleError(_0x20b080,null));};exports['show']=function(_0x48aa2c,_0x1bfcfe){var _0x29550e={'raw':!![],'where':{'id':_0x48aa2c[_0xfecf('0x3e')]['id']}},_0x3561d6={};_0x3561d6[_0xfecf('0x2c')]=_['keys'](db[_0xfecf('0x3d')]['rawAttributes']);_0x3561d6['query']=_[_0xfecf('0x2e')](_0x48aa2c[_0xfecf('0x2d')]);_0x3561d6[_0xfecf('0x2f')]=_[_0xfecf('0x30')](_0x3561d6[_0xfecf('0x2c')],_0x3561d6[_0xfecf('0x2d')]);_0x29550e[_0xfecf('0x32')]=_['intersection'](_0x3561d6[_0xfecf('0x2c')],qs[_0xfecf('0x31')](_0x48aa2c['query'][_0xfecf('0x31')]));_0x29550e['attributes']=_0x29550e['attributes'][_0xfecf('0x33')]?_0x29550e[_0xfecf('0x32')]:_0x3561d6[_0xfecf('0x2c')];if(_0x48aa2c[_0xfecf('0x2d')][_0xfecf('0x3f')]){_0x29550e[_0xfecf('0x3c')]=[{'all':!![]}];}_0x29550e=_['merge']({},_0x29550e,_0x48aa2c[_0xfecf('0x3b')]);return db['MailSubstatus'][_0xfecf('0x40')](_0x29550e)[_0xfecf('0x22')](handleEntityNotFound(_0x1bfcfe,null))[_0xfecf('0x22')](respondWithResult(_0x1bfcfe,null))[_0xfecf('0x41')](handleError(_0x1bfcfe,null));};exports[_0xfecf('0x42')]=function(_0x2665d9,_0x1e1988){return db[_0xfecf('0x3d')][_0xfecf('0x42')](_0x2665d9[_0xfecf('0x43')],{})[_0xfecf('0x22')](respondWithResult(_0x1e1988,0xc9))[_0xfecf('0x41')](handleError(_0x1e1988,null));};exports[_0xfecf('0x21')]=function(_0x242219,_0x699494){if(_0x242219[_0xfecf('0x43')]['id']){delete _0x242219[_0xfecf('0x43')]['id'];}return db[_0xfecf('0x3d')][_0xfecf('0x40')]({'where':{'id':_0x242219[_0xfecf('0x3e')]['id']}})[_0xfecf('0x22')](handleEntityNotFound(_0x699494,null))['then'](saveUpdates(_0x242219[_0xfecf('0x43')],null))[_0xfecf('0x22')](respondWithResult(_0x699494,null))[_0xfecf('0x41')](handleError(_0x699494,null));};exports[_0xfecf('0x23')]=function(_0x2b0a58,_0x12f824){return db[_0xfecf('0x3d')]['find']({'where':{'id':_0x2b0a58[_0xfecf('0x3e')]['id']}})[_0xfecf('0x22')](handleEntityNotFound(_0x12f824,null))[_0xfecf('0x22')](removeEntity(_0x12f824,null))[_0xfecf('0x41')](handleError(_0x12f824,null));};exports[_0xfecf('0x44')]=function(_0x59f686,_0x3c05c4){return db[_0xfecf('0x3d')][_0xfecf('0x44')]()[_0xfecf('0x22')](respondWithResult(_0x3c05c4,null))[_0xfecf('0x41')](handleError(_0x3c05c4,null));}; \ No newline at end of file +var _0x03fb=['to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','set','Content-Range','json','save','update','destroy','then','end','error','stack','name','send','map','MailSubstatus','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','params','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x03fb,0xdf));var _0xb03f=function(_0x29e3aa,_0x908ad7){_0x29e3aa=_0x29e3aa-0x0;var _0x12f1e4=_0x03fb[_0x29e3aa];return _0x12f1e4;};'use strict';var emlformat=require(_0xb03f('0x0'));var rimraf=require(_0xb03f('0x1'));var zipdir=require(_0xb03f('0x2'));var jsonpatch=require(_0xb03f('0x3'));var rp=require(_0xb03f('0x4'));var moment=require(_0xb03f('0x5'));var BPromise=require(_0xb03f('0x6'));var Mustache=require(_0xb03f('0x7'));var util=require(_0xb03f('0x8'));var path=require(_0xb03f('0x9'));var sox=require(_0xb03f('0xa'));var csv=require(_0xb03f('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb03f('0xc'));var _=require(_0xb03f('0xd'));var squel=require(_0xb03f('0xe'));var crypto=require(_0xb03f('0xf'));var jsforce=require(_0xb03f('0x10'));var deskjs=require(_0xb03f('0x11'));var toCsv=require('to-csv');var querystring=require(_0xb03f('0x12'));var Papa=require(_0xb03f('0x13'));var Redis=require(_0xb03f('0x14'));var authService=require(_0xb03f('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xb03f('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb03f('0x17'));var utils=require(_0xb03f('0x18'));var config=require(_0xb03f('0x19'));var licenseUtil=require(_0xb03f('0x1a'));var db=require(_0xb03f('0x1b'))['db'];function respondWithStatusCode(_0x2e4ea1,_0x1c7659){_0x1c7659=_0x1c7659||0xcc;return function(_0x47fbdf){if(_0x47fbdf){return _0x2e4ea1[_0xb03f('0x1c')](_0x1c7659);}return _0x2e4ea1[_0xb03f('0x1d')](_0x1c7659)['end']();};}function respondWithResult(_0x36fdb0,_0x50ea2e){_0x50ea2e=_0x50ea2e||0xc8;return function(_0x721e1d){if(_0x721e1d){return _0x36fdb0[_0xb03f('0x1d')](_0x50ea2e)['json'](_0x721e1d);}};}function respondWithFilteredResult(_0x269cbc,_0x21a0ea){return function(_0x5f3780){if(_0x5f3780){var _0x27939a=typeof _0x21a0ea[_0xb03f('0x1e')]===_0xb03f('0x1f')&&typeof _0x21a0ea[_0xb03f('0x20')]===_0xb03f('0x1f');var _0x4022ed=_0x5f3780['count'];var _0x197e30=_0x27939a?0x0:_0x21a0ea[_0xb03f('0x1e')];var _0x21a9d3=_0x27939a?_0x5f3780['count']:_0x21a0ea[_0xb03f('0x1e')]+_0x21a0ea[_0xb03f('0x20')];var _0x2ce2b0;if(_0x21a9d3>=_0x4022ed){_0x21a9d3=_0x4022ed;_0x2ce2b0=0xc8;}else{_0x2ce2b0=0xce;}_0x269cbc['status'](_0x2ce2b0);return _0x269cbc[_0xb03f('0x21')](_0xb03f('0x22'),_0x197e30+'-'+_0x21a9d3+'/'+_0x4022ed)[_0xb03f('0x23')](_0x5f3780);}return null;};}function patchUpdates(_0x6e12f6){return function(_0x2648e0){try{jsonpatch['apply'](_0x2648e0,_0x6e12f6,!![]);}catch(_0x491c09){return BPromise['reject'](_0x491c09);}return _0x2648e0[_0xb03f('0x24')]();};}function saveUpdates(_0x5e3f83,_0x12b0f5){return function(_0x4443f1){if(_0x4443f1){return _0x4443f1[_0xb03f('0x25')](_0x5e3f83)['then'](function(_0x4b361c){return _0x4b361c;});}return null;};}function removeEntity(_0x41332c,_0x19e3a9){return function(_0x43f88f){if(_0x43f88f){return _0x43f88f[_0xb03f('0x26')]()[_0xb03f('0x27')](function(){_0x41332c[_0xb03f('0x1d')](0xcc)[_0xb03f('0x28')]();});}};}function handleEntityNotFound(_0x3ea998,_0x3c9df4){return function(_0x55181c){if(!_0x55181c){_0x3ea998[_0xb03f('0x1c')](0x194);}return _0x55181c;};}function handleError(_0x793774,_0x31b1bb){_0x31b1bb=_0x31b1bb||0x1f4;return function(_0x175ab5){logger[_0xb03f('0x29')](_0x175ab5[_0xb03f('0x2a')]);if(_0x175ab5['name']){delete _0x175ab5[_0xb03f('0x2b')];}_0x793774[_0xb03f('0x1d')](_0x31b1bb)[_0xb03f('0x2c')](_0x175ab5);};}exports['index']=function(_0x3468ec,_0x14d494){var _0x192dc2={},_0xdebf99={},_0xc06f65={'count':0x0,'rows':[]};var _0x431c04=_[_0xb03f('0x2d')](db[_0xb03f('0x2e')][_0xb03f('0x2f')],function(_0x39e854){return{'name':_0x39e854['fieldName'],'type':_0x39e854[_0xb03f('0x30')][_0xb03f('0x31')]};});_0xdebf99[_0xb03f('0x32')]=_[_0xb03f('0x2d')](_0x431c04,'name');_0xdebf99[_0xb03f('0x33')]=_[_0xb03f('0x34')](_0x3468ec[_0xb03f('0x33')]);_0xdebf99[_0xb03f('0x35')]=_[_0xb03f('0x36')](_0xdebf99[_0xb03f('0x32')],_0xdebf99[_0xb03f('0x33')]);_0x192dc2[_0xb03f('0x37')]=_[_0xb03f('0x36')](_0xdebf99[_0xb03f('0x32')],qs[_0xb03f('0x38')](_0x3468ec['query'][_0xb03f('0x38')]));_0x192dc2[_0xb03f('0x37')]=_0x192dc2[_0xb03f('0x37')][_0xb03f('0x39')]?_0x192dc2[_0xb03f('0x37')]:_0xdebf99[_0xb03f('0x32')];if(!_0x3468ec['query'][_0xb03f('0x3a')](_0xb03f('0x3b'))){_0x192dc2[_0xb03f('0x20')]=qs[_0xb03f('0x20')](_0x3468ec['query']['limit']);_0x192dc2[_0xb03f('0x1e')]=qs[_0xb03f('0x1e')](_0x3468ec[_0xb03f('0x33')]['offset']);}_0x192dc2['order']=qs[_0xb03f('0x3c')](_0x3468ec[_0xb03f('0x33')][_0xb03f('0x3c')]);_0x192dc2['where']=qs[_0xb03f('0x35')](_[_0xb03f('0x3d')](_0x3468ec[_0xb03f('0x33')],_0xdebf99['filters']),_0x431c04);if(_0x3468ec['query'][_0xb03f('0x3e')]){_0x192dc2[_0xb03f('0x3f')]=_[_0xb03f('0x40')](_0x192dc2['where'],{'$or':_[_0xb03f('0x2d')](_0x431c04,function(_0x59beee){if(_0x59beee[_0xb03f('0x30')]!==_0xb03f('0x41')){var _0x46db2c={};_0x46db2c[_0x59beee[_0xb03f('0x2b')]]={'$like':'%'+_0x3468ec[_0xb03f('0x33')][_0xb03f('0x3e')]+'%'};return _0x46db2c;}})});}_0x192dc2=_['merge']({},_0x192dc2,_0x3468ec['options']);var _0x2e3007={'where':_0x192dc2[_0xb03f('0x3f')]};return db[_0xb03f('0x2e')][_0xb03f('0x42')](_0x2e3007)['then'](function(_0x4a16a6){_0xc06f65[_0xb03f('0x42')]=_0x4a16a6;if(_0x3468ec[_0xb03f('0x33')][_0xb03f('0x43')]){_0x192dc2[_0xb03f('0x44')]=[{'all':!![]}];}return db['MailSubstatus'][_0xb03f('0x45')](_0x192dc2);})[_0xb03f('0x27')](function(_0x3e2dfc){_0xc06f65[_0xb03f('0x46')]=_0x3e2dfc;return _0xc06f65;})[_0xb03f('0x27')](respondWithFilteredResult(_0x14d494,_0x192dc2))[_0xb03f('0x47')](handleError(_0x14d494,null));};exports['show']=function(_0x57a7cc,_0x42566b){var _0x357fd1={'raw':!![],'where':{'id':_0x57a7cc[_0xb03f('0x48')]['id']}},_0x3170d1={};_0x3170d1[_0xb03f('0x32')]=_[_0xb03f('0x34')](db[_0xb03f('0x2e')][_0xb03f('0x2f')]);_0x3170d1[_0xb03f('0x33')]=_[_0xb03f('0x34')](_0x57a7cc[_0xb03f('0x33')]);_0x3170d1['filters']=_[_0xb03f('0x36')](_0x3170d1['model'],_0x3170d1[_0xb03f('0x33')]);_0x357fd1[_0xb03f('0x37')]=_[_0xb03f('0x36')](_0x3170d1[_0xb03f('0x32')],qs[_0xb03f('0x38')](_0x57a7cc[_0xb03f('0x33')][_0xb03f('0x38')]));_0x357fd1['attributes']=_0x357fd1[_0xb03f('0x37')][_0xb03f('0x39')]?_0x357fd1[_0xb03f('0x37')]:_0x3170d1[_0xb03f('0x32')];if(_0x57a7cc[_0xb03f('0x33')][_0xb03f('0x43')]){_0x357fd1[_0xb03f('0x44')]=[{'all':!![]}];}_0x357fd1=_[_0xb03f('0x40')]({},_0x357fd1,_0x57a7cc[_0xb03f('0x49')]);return db[_0xb03f('0x2e')][_0xb03f('0x4a')](_0x357fd1)[_0xb03f('0x27')](handleEntityNotFound(_0x42566b,null))[_0xb03f('0x27')](respondWithResult(_0x42566b,null))[_0xb03f('0x47')](handleError(_0x42566b,null));};exports[_0xb03f('0x4b')]=function(_0x1b35b7,_0x5d5f79){return db['MailSubstatus'][_0xb03f('0x4b')](_0x1b35b7[_0xb03f('0x4c')],{})[_0xb03f('0x27')](respondWithResult(_0x5d5f79,0xc9))[_0xb03f('0x47')](handleError(_0x5d5f79,null));};exports['update']=function(_0x4240d9,_0x278063){if(_0x4240d9[_0xb03f('0x4c')]['id']){delete _0x4240d9['body']['id'];}return db[_0xb03f('0x2e')][_0xb03f('0x4a')]({'where':{'id':_0x4240d9['params']['id']}})[_0xb03f('0x27')](handleEntityNotFound(_0x278063,null))[_0xb03f('0x27')](saveUpdates(_0x4240d9['body'],null))[_0xb03f('0x27')](respondWithResult(_0x278063,null))[_0xb03f('0x47')](handleError(_0x278063,null));};exports[_0xb03f('0x26')]=function(_0x180be9,_0x34dbd1){return db[_0xb03f('0x2e')][_0xb03f('0x4a')]({'where':{'id':_0x180be9[_0xb03f('0x48')]['id']}})['then'](handleEntityNotFound(_0x34dbd1,null))['then'](removeEntity(_0x34dbd1,null))['catch'](handleError(_0x34dbd1,null));};exports[_0xb03f('0x4d')]=function(_0x58702e,_0x510980){return db[_0xb03f('0x2e')][_0xb03f('0x4d')]()[_0xb03f('0x27')](respondWithResult(_0x510980,null))['catch'](handleError(_0x510980,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 1f0f141..8b0f471 100644 --- a/server/api/mailSubstatus/mailSubstatus.events.js +++ b/server/api/mailSubstatus/mailSubstatus.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4403=['../../mysqldb','MailSubstatus','setMaxListeners','update','emit','events'];(function(_0x43241c,_0xad3f71){var _0x43b112=function(_0x4800e5){while(--_0x4800e5){_0x43241c['push'](_0x43241c['shift']());}};_0x43b112(++_0xad3f71);}(_0x4403,0x125));var _0x3440=function(_0xa82344,_0x16064c){_0xa82344=_0xa82344-0x0;var _0x2823d0=_0x4403[_0xa82344];return _0x2823d0;};'use strict';var EventEmitter=require(_0x3440('0x0'));var MailSubstatus=require(_0x3440('0x1'))['db'][_0x3440('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x3440('0x3')](0x0);var events={'afterUpdate':_0x3440('0x4')};function emitEvent(_0x2e141d){return function(_0x2e4319,_0x59b305,_0x4873d2){MailSubstatusEvents['emit'](_0x2e141d+':'+_0x2e4319['id'],_0x2e4319);MailSubstatusEvents[_0x3440('0x5')](_0x2e141d,_0x2e4319);_0x4873d2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file +var _0x9cd5=['hasOwnProperty','exports','events','MailSubstatus','setMaxListeners','update','emit'];(function(_0x5e3f94,_0x104676){var _0x1976c2=function(_0x5e542d){while(--_0x5e542d){_0x5e3f94['push'](_0x5e3f94['shift']());}};_0x1976c2(++_0x104676);}(_0x9cd5,0x9c));var _0x59cd=function(_0x2269f3,_0x37c675){_0x2269f3=_0x2269f3-0x0;var _0x7b54c5=_0x9cd5[_0x2269f3];return _0x7b54c5;};'use strict';var EventEmitter=require(_0x59cd('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0x59cd('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x59cd('0x2')](0x0);var events={'afterUpdate':_0x59cd('0x3')};function emitEvent(_0x19a049){return function(_0x4e89ca,_0xdf56ba,_0x154e89){MailSubstatusEvents[_0x59cd('0x4')](_0x19a049+':'+_0x4e89ca['id'],_0x4e89ca);MailSubstatusEvents['emit'](_0x19a049,_0x4e89ca);_0x154e89(null);};}for(var e in events){if(events[_0x59cd('0x5')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0x59cd('0x6')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index c133932..45ece4e 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 _0xbb65=['mailSubstatus','_previousDataValues','name','then','catch','./mailSubstatus.attributes','models','MailSubstatus','mail_substatuses','Condition','update'];(function(_0x2ea9e7,_0x32865b){var _0x23b632=function(_0x455d29){while(--_0x455d29){_0x2ea9e7['push'](_0x2ea9e7['shift']());}};_0x23b632(++_0x32865b);}(_0xbb65,0x118));var _0x5bb6=function(_0x4e3c69,_0x2e0b38){_0x4e3c69=_0x4e3c69-0x0;var _0x3b85ca=_0xbb65[_0x4e3c69];return _0x3b85ca;};'use strict';var attributes=require(_0x5bb6('0x0'));module['exports']=function(_0x454eb9){var _0xf25e65=_0x454eb9[_0x5bb6('0x1')];return _0x454eb9['define'](_0x5bb6('0x2'),attributes,{'tableName':_0x5bb6('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x165129,_0x26e34e,_0x243fe4){return _0xf25e65[_0x5bb6('0x4')][_0x5bb6('0x5')]({'value':_0x165129['name']},{'where':{'field':_0x5bb6('0x6'),'value':_0x165129[_0x5bb6('0x7')][_0x5bb6('0x8')]}})[_0x5bb6('0x9')](function(){_0x243fe4();})[_0x5bb6('0xa')](function(_0x4f68ed){_0x243fe4(_0x4f68ed);});}}});}; \ No newline at end of file +var _0xb5d1=['Condition','mailSubstatus','_previousDataValues','name','then','exports','MailSubstatus'];(function(_0x2c20fb,_0x4ccd56){var _0x429d94=function(_0x47d60f){while(--_0x47d60f){_0x2c20fb['push'](_0x2c20fb['shift']());}};_0x429d94(++_0x4ccd56);}(_0xb5d1,0x147));var _0x1b5d=function(_0x4388b6,_0x4193a3){_0x4388b6=_0x4388b6-0x0;var _0x3227f5=_0xb5d1[_0x4388b6];return _0x3227f5;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x1b5d('0x0')]=function(_0x3f1a6c){var _0x172d5f=_0x3f1a6c['models'];return _0x3f1a6c['define'](_0x1b5d('0x1'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x5c97c8,_0x148556,_0x17a7b0){return _0x172d5f[_0x1b5d('0x2')]['update']({'value':_0x5c97c8['name']},{'where':{'field':_0x1b5d('0x3'),'value':_0x5c97c8[_0x1b5d('0x4')][_0x1b5d('0x5')]}})[_0x1b5d('0x6')](function(){_0x17a7b0();})['catch'](function(_0x5d79ad){_0x17a7b0(_0x5d79ad);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 27e39a4..c085f54 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 _0x6594=['../../config/logger','../../config/environment','http','request','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x53e5b2,_0x222c2b){var _0x31ad54=function(_0x26dafa){while(--_0x26dafa){_0x53e5b2['push'](_0x53e5b2['shift']());}};_0x31ad54(++_0x222c2b);}(_0x6594,0x13e));var _0x4659=function(_0x4295fd,_0x1f2573){_0x4295fd=_0x4295fd-0x0;var _0x96f34e=_0x6594[_0x4295fd];return _0x96f34e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4659('0x0'));var BPromise=require('bluebird');var rs=require(_0x4659('0x1'));var fs=require('fs');var Redis=require(_0x4659('0x2'));var db=require(_0x4659('0x3'))['db'];var utils=require(_0x4659('0x4'));var logger=require(_0x4659('0x5'))('rpc');var config=require(_0x4659('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4659('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4ff88e,_0xbcee33,_0x122f34){return new BPromise(function(_0x5b2333,_0x1fb2f2){return client[_0x4659('0x8')](_0x4ff88e,_0x122f34)[_0x4659('0x9')](function(_0x3443da){logger['info'](_0x4659('0xa'),_0xbcee33,_0x4659('0xb'));logger[_0x4659('0xc')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0xbcee33,_0x4659('0xb'),JSON['stringify'](_0x3443da));if(_0x3443da[_0x4659('0xd')]){if(_0x3443da['error'][_0x4659('0xe')]===0x1f4){logger['error'](_0x4659('0xa'),_0xbcee33,_0x3443da[_0x4659('0xd')][_0x4659('0xf')]);return _0x1fb2f2(_0x3443da[_0x4659('0xd')][_0x4659('0xf')]);}logger[_0x4659('0xd')]('MailSubstatus,\x20%s,\x20%s',_0xbcee33,_0x3443da[_0x4659('0xd')][_0x4659('0xf')]);return _0x5b2333(_0x3443da[_0x4659('0xd')][_0x4659('0xf')]);}else{logger[_0x4659('0x10')](_0x4659('0xa'),_0xbcee33,'request\x20sent');_0x5b2333(_0x3443da['result']['message']);}})['catch'](function(_0x4fa9f1){logger[_0x4659('0xd')](_0x4659('0xa'),_0xbcee33,_0x4fa9f1);_0x1fb2f2(_0x4fa9f1);});});} \ No newline at end of file +var _0x4c0a=['info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x2b23f9,_0x4f1b07){var _0xe63bdf=function(_0x3c1096){while(--_0x3c1096){_0x2b23f9['push'](_0x2b23f9['shift']());}};_0xe63bdf(++_0x4f1b07);}(_0x4c0a,0xce));var _0xa4c0=function(_0x3e8889,_0x347fc3){_0x3e8889=_0x3e8889-0x0;var _0x21f2d5=_0x4c0a[_0x3e8889];return _0x21f2d5;};'use strict';var _=require('lodash');var util=require(_0xa4c0('0x0'));var moment=require(_0xa4c0('0x1'));var BPromise=require(_0xa4c0('0x2'));var rs=require(_0xa4c0('0x3'));var fs=require('fs');var Redis=require(_0xa4c0('0x4'));var db=require(_0xa4c0('0x5'))['db'];var utils=require(_0xa4c0('0x6'));var logger=require(_0xa4c0('0x7'))(_0xa4c0('0x8'));var config=require('../../config/environment');var jayson=require(_0xa4c0('0x9'));var client=jayson[_0xa4c0('0xa')][_0xa4c0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2ab6f1,_0x18400e,_0x20db3b){return new BPromise(function(_0x37d99b,_0x2db807){return client[_0xa4c0('0xc')](_0x2ab6f1,_0x20db3b)[_0xa4c0('0xd')](function(_0x414e1a){logger[_0xa4c0('0xe')](_0xa4c0('0xf'),_0x18400e,'request\x20sent');logger[_0xa4c0('0x10')](_0xa4c0('0x11'),_0x18400e,'request\x20sent',JSON['stringify'](_0x414e1a));if(_0x414e1a[_0xa4c0('0x12')]){if(_0x414e1a[_0xa4c0('0x12')][_0xa4c0('0x13')]===0x1f4){logger[_0xa4c0('0x12')]('MailSubstatus,\x20%s,\x20%s',_0x18400e,_0x414e1a[_0xa4c0('0x12')]['message']);return _0x2db807(_0x414e1a['error']['message']);}logger[_0xa4c0('0x12')](_0xa4c0('0xf'),_0x18400e,_0x414e1a['error'][_0xa4c0('0x14')]);return _0x37d99b(_0x414e1a['error'][_0xa4c0('0x14')]);}else{logger[_0xa4c0('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x18400e,'request\x20sent');_0x37d99b(_0x414e1a['result'][_0xa4c0('0x14')]);}})[_0xa4c0('0x15')](function(_0x5cbdaf){logger[_0xa4c0('0x12')](_0xa4c0('0xf'),_0x18400e,_0x5cbdaf);_0x2db807(_0x5cbdaf);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index cae9e32..83686e8 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 _0xa6df=['post','create','update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','describe','/:id','show'];(function(_0x4ac066,_0x383221){var _0x1b5d9a=function(_0x4d1880){while(--_0x4d1880){_0x4ac066['push'](_0x4ac066['shift']());}};_0x1b5d9a(++_0x383221);}(_0xa6df,0xdc));var _0xfa6d=function(_0x296991,_0x152607){_0x296991=_0x296991-0x0;var _0x25fe97=_0xa6df[_0x296991];return _0x25fe97;};'use strict';var multer=require('multer');var util=require(_0xfa6d('0x0'));var path=require(_0xfa6d('0x1'));var timeout=require(_0xfa6d('0x2'));var express=require(_0xfa6d('0x3'));var router=express[_0xfa6d('0x4')]();var fs_extra=require(_0xfa6d('0x5'));var auth=require(_0xfa6d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfa6d('0x7'));var controller=require(_0xfa6d('0x8'));router[_0xfa6d('0x9')]('/',auth[_0xfa6d('0xa')](),controller['index']);router[_0xfa6d('0x9')]('/describe',auth[_0xfa6d('0xa')](),controller[_0xfa6d('0xb')]);router['get'](_0xfa6d('0xc'),auth['isAuthenticated'](),controller[_0xfa6d('0xd')]);router[_0xfa6d('0xe')]('/',auth[_0xfa6d('0xa')](),controller[_0xfa6d('0xf')]);router['put'](_0xfa6d('0xc'),auth[_0xfa6d('0xa')](),controller[_0xfa6d('0x10')]);router['delete'](_0xfa6d('0xc'),auth[_0xfa6d('0xa')](),controller['destroy']);module[_0xfa6d('0x11')]=router; \ No newline at end of file +var _0x71af=['../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','create','put','update','delete','/:id','destroy','exports','multer','path','express'];(function(_0x336030,_0x4086ea){var _0x2b203b=function(_0x10b0ad){while(--_0x10b0ad){_0x336030['push'](_0x336030['shift']());}};_0x2b203b(++_0x4086ea);}(_0x71af,0xa8));var _0xf71a=function(_0x2e8cab,_0x6aac76){_0x2e8cab=_0x2e8cab-0x0;var _0x321625=_0x71af[_0x2e8cab];return _0x321625;};'use strict';var multer=require(_0xf71a('0x0'));var util=require('util');var path=require(_0xf71a('0x1'));var timeout=require('connect-timeout');var express=require(_0xf71a('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf71a('0x3'));var interaction=require(_0xf71a('0x4'));var config=require('../../config/environment');var controller=require(_0xf71a('0x5'));router[_0xf71a('0x6')]('/',auth[_0xf71a('0x7')](),controller[_0xf71a('0x8')]);router['get'](_0xf71a('0x9'),auth['isAuthenticated'](),controller[_0xf71a('0xa')]);router[_0xf71a('0x6')]('/:id',auth[_0xf71a('0x7')](),controller[_0xf71a('0xb')]);router['post']('/',auth[_0xf71a('0x7')](),controller[_0xf71a('0xc')]);router[_0xf71a('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xf71a('0xe')]);router[_0xf71a('0xf')](_0xf71a('0x10'),auth['isAuthenticated'](),controller[_0xf71a('0x11')]);module[_0xf71a('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 6f6edac..854899f 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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x454fba,_0x28e464){var _0x2f5f07=function(_0x281869){while(--_0x281869){_0x454fba['push'](_0x454fba['shift']());}};_0x2f5f07(++_0x28e464);}(_0xaa88,0x137));var _0x8aa8=function(_0x4687df,_0x12099c){_0x4687df=_0x4687df-0x0;var _0x32eaef=_0xaa88[_0x4687df];return _0x32eaef;};'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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x326eef,_0x34ace9){var _0x5f5d99=function(_0x47fa18){while(--_0x47fa18){_0x326eef['push'](_0x326eef['shift']());}};_0x5f5d99(++_0x34ace9);}(_0x70e0,0x17b));var _0x070e=function(_0x596f43,_0x126538){_0x596f43=_0x596f43-0x0;var _0x3bad27=_0x70e0[_0x596f43];return _0x3bad27;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index ae25214..1cdf0c8 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 _0x62cc=['fields','attributes','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','MailTransferReport','includeAll','findAll','rows','rawAttributes','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','limit','undefined','count','Content-Range','json','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','type','model','query','keys','filters','intersection'];(function(_0x437abe,_0x3e33a8){var _0x51189b=function(_0x325a20){while(--_0x325a20){_0x437abe['push'](_0x437abe['shift']());}};_0x51189b(++_0x3e33a8);}(_0x62cc,0x12d));var _0xc62c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x62cc[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc62c('0x0'));var rimraf=require(_0xc62c('0x1'));var zipdir=require(_0xc62c('0x2'));var jsonpatch=require(_0xc62c('0x3'));var rp=require(_0xc62c('0x4'));var moment=require(_0xc62c('0x5'));var BPromise=require(_0xc62c('0x6'));var Mustache=require(_0xc62c('0x7'));var util=require(_0xc62c('0x8'));var path=require(_0xc62c('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc62c('0xa'));var fs=require('fs');var fs_extra=require(_0xc62c('0xb'));var _=require('lodash');var squel=require(_0xc62c('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc62c('0xd'));var toCsv=require(_0xc62c('0xe'));var querystring=require(_0xc62c('0xf'));var Papa=require('papaparse');var Redis=require(_0xc62c('0x10'));var authService=require(_0xc62c('0x11'));var qs=require(_0xc62c('0x12'));var as=require(_0xc62c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc62c('0x14'))('api');var utils=require(_0xc62c('0x15'));var config=require(_0xc62c('0x16'));var licenseUtil=require(_0xc62c('0x17'));var db=require(_0xc62c('0x18'))['db'];function respondWithStatusCode(_0x4c2a9f,_0x4042ce){_0x4042ce=_0x4042ce||0xcc;return function(_0x3087f5){if(_0x3087f5){return _0x4c2a9f['sendStatus'](_0x4042ce);}return _0x4c2a9f[_0xc62c('0x19')](_0x4042ce)['end']();};}function respondWithResult(_0x181351,_0x2c7e0c){_0x2c7e0c=_0x2c7e0c||0xc8;return function(_0x131361){if(_0x131361){return _0x181351['status'](_0x2c7e0c)['json'](_0x131361);}};}function respondWithFilteredResult(_0x55126c,_0x3b71e2){return function(_0x393a80){if(_0x393a80){var _0x5ee079=typeof _0x3b71e2[_0xc62c('0x1a')]==='undefined'&&typeof _0x3b71e2[_0xc62c('0x1b')]===_0xc62c('0x1c');var _0x1e38f9=_0x393a80['count'];var _0xa35e05=_0x5ee079?0x0:_0x3b71e2[_0xc62c('0x1a')];var _0x4b6e55=_0x5ee079?_0x393a80[_0xc62c('0x1d')]:_0x3b71e2[_0xc62c('0x1a')]+_0x3b71e2[_0xc62c('0x1b')];var _0x3eedcf;if(_0x4b6e55>=_0x1e38f9){_0x4b6e55=_0x1e38f9;_0x3eedcf=0xc8;}else{_0x3eedcf=0xce;}_0x55126c[_0xc62c('0x19')](_0x3eedcf);return _0x55126c['set'](_0xc62c('0x1e'),_0xa35e05+'-'+_0x4b6e55+'/'+_0x1e38f9)[_0xc62c('0x1f')](_0x393a80);}return null;};}function patchUpdates(_0x553488){return function(_0x496768){try{jsonpatch['apply'](_0x496768,_0x553488,!![]);}catch(_0x244347){return BPromise['reject'](_0x244347);}return _0x496768['save']();};}function saveUpdates(_0x3455f8,_0x37bd64){return function(_0xd6a45f){if(_0xd6a45f){return _0xd6a45f[_0xc62c('0x20')](_0x3455f8)[_0xc62c('0x21')](function(_0xd99aed){return _0xd99aed;});}return null;};}function removeEntity(_0x168620,_0x49e567){return function(_0x2b3dd1){if(_0x2b3dd1){return _0x2b3dd1[_0xc62c('0x22')]()[_0xc62c('0x21')](function(){_0x168620[_0xc62c('0x19')](0xcc)[_0xc62c('0x23')]();});}};}function handleEntityNotFound(_0x3d4a9f,_0x50402e){return function(_0x41db57){if(!_0x41db57){_0x3d4a9f[_0xc62c('0x24')](0x194);}return _0x41db57;};}function handleError(_0x225172,_0x39bad3){_0x39bad3=_0x39bad3||0x1f4;return function(_0x19cf78){logger[_0xc62c('0x25')](_0x19cf78[_0xc62c('0x26')]);if(_0x19cf78[_0xc62c('0x27')]){delete _0x19cf78[_0xc62c('0x27')];}_0x225172[_0xc62c('0x19')](_0x39bad3)[_0xc62c('0x28')](_0x19cf78);};}exports[_0xc62c('0x29')]=function(_0x1cb208,_0x2810bc){var _0x2171b4={},_0x409002={},_0x2ef88={'count':0x0,'rows':[]};var _0x2360c7=_[_0xc62c('0x2a')](db['MailTransferReport']['rawAttributes'],function(_0x24561a){return{'name':_0x24561a['fieldName'],'type':_0x24561a[_0xc62c('0x2b')]['key']};});_0x409002[_0xc62c('0x2c')]=_[_0xc62c('0x2a')](_0x2360c7,_0xc62c('0x27'));_0x409002[_0xc62c('0x2d')]=_[_0xc62c('0x2e')](_0x1cb208[_0xc62c('0x2d')]);_0x409002[_0xc62c('0x2f')]=_[_0xc62c('0x30')](_0x409002[_0xc62c('0x2c')],_0x409002[_0xc62c('0x2d')]);_0x2171b4['attributes']=_[_0xc62c('0x30')](_0x409002[_0xc62c('0x2c')],qs[_0xc62c('0x31')](_0x1cb208['query'][_0xc62c('0x31')]));_0x2171b4[_0xc62c('0x32')]=_0x2171b4[_0xc62c('0x32')]['length']?_0x2171b4['attributes']:_0x409002[_0xc62c('0x2c')];if(!_0x1cb208['query'][_0xc62c('0x33')](_0xc62c('0x34'))){_0x2171b4['limit']=qs[_0xc62c('0x1b')](_0x1cb208[_0xc62c('0x2d')][_0xc62c('0x1b')]);_0x2171b4[_0xc62c('0x1a')]=qs['offset'](_0x1cb208[_0xc62c('0x2d')][_0xc62c('0x1a')]);}_0x2171b4['order']=qs[_0xc62c('0x35')](_0x1cb208[_0xc62c('0x2d')][_0xc62c('0x35')]);_0x2171b4[_0xc62c('0x36')]=qs[_0xc62c('0x2f')](_[_0xc62c('0x37')](_0x1cb208[_0xc62c('0x2d')],_0x409002[_0xc62c('0x2f')]),_0x2360c7);if(_0x1cb208[_0xc62c('0x2d')]['filter']){_0x2171b4[_0xc62c('0x36')]=_[_0xc62c('0x38')](_0x2171b4['where'],{'$or':_[_0xc62c('0x2a')](_0x2360c7,function(_0x28414d){if(_0x28414d['type']!==_0xc62c('0x39')){var _0x35fbc0={};_0x35fbc0[_0x28414d[_0xc62c('0x27')]]={'$like':'%'+_0x1cb208[_0xc62c('0x2d')]['filter']+'%'};return _0x35fbc0;}})});}_0x2171b4=_[_0xc62c('0x38')]({},_0x2171b4,_0x1cb208[_0xc62c('0x3a')]);var _0xe2797c={'where':_0x2171b4[_0xc62c('0x36')]};return db[_0xc62c('0x3b')][_0xc62c('0x1d')](_0xe2797c)['then'](function(_0x3947d5){_0x2ef88[_0xc62c('0x1d')]=_0x3947d5;if(_0x1cb208[_0xc62c('0x2d')][_0xc62c('0x3c')]){_0x2171b4['include']=[{'all':!![]}];}return db[_0xc62c('0x3b')][_0xc62c('0x3d')](_0x2171b4);})['then'](function(_0x2b024b){_0x2ef88[_0xc62c('0x3e')]=_0x2b024b;return _0x2ef88;})[_0xc62c('0x21')](respondWithFilteredResult(_0x2810bc,_0x2171b4))['catch'](handleError(_0x2810bc,null));};exports['show']=function(_0xe87edd,_0x31f8d4){var _0x178228={'raw':!![],'where':{'id':_0xe87edd['params']['id']}},_0x478a17={};_0x478a17[_0xc62c('0x2c')]=_[_0xc62c('0x2e')](db['MailTransferReport'][_0xc62c('0x3f')]);_0x478a17['query']=_[_0xc62c('0x2e')](_0xe87edd['query']);_0x478a17[_0xc62c('0x2f')]=_['intersection'](_0x478a17[_0xc62c('0x2c')],_0x478a17['query']);_0x178228[_0xc62c('0x32')]=_['intersection'](_0x478a17[_0xc62c('0x2c')],qs[_0xc62c('0x31')](_0xe87edd['query'][_0xc62c('0x31')]));_0x178228['attributes']=_0x178228[_0xc62c('0x32')]['length']?_0x178228[_0xc62c('0x32')]:_0x478a17['model'];if(_0xe87edd[_0xc62c('0x2d')]['includeAll']){_0x178228['include']=[{'all':!![]}];}_0x178228=_[_0xc62c('0x38')]({},_0x178228,_0xe87edd[_0xc62c('0x3a')]);return db[_0xc62c('0x3b')][_0xc62c('0x40')](_0x178228)[_0xc62c('0x21')](handleEntityNotFound(_0x31f8d4,null))[_0xc62c('0x21')](respondWithResult(_0x31f8d4,null))[_0xc62c('0x41')](handleError(_0x31f8d4,null));};exports[_0xc62c('0x42')]=function(_0x1d6098,_0x371273){return db[_0xc62c('0x3b')][_0xc62c('0x42')](_0x1d6098[_0xc62c('0x43')],{})[_0xc62c('0x21')](respondWithResult(_0x371273,0xc9))[_0xc62c('0x41')](handleError(_0x371273,null));};exports['update']=function(_0x6eb05d,_0x5da286){if(_0x6eb05d[_0xc62c('0x43')]['id']){delete _0x6eb05d[_0xc62c('0x43')]['id'];}return db[_0xc62c('0x3b')]['find']({'where':{'id':_0x6eb05d[_0xc62c('0x44')]['id']}})[_0xc62c('0x21')](handleEntityNotFound(_0x5da286,null))['then'](saveUpdates(_0x6eb05d['body'],null))[_0xc62c('0x21')](respondWithResult(_0x5da286,null))[_0xc62c('0x41')](handleError(_0x5da286,null));};exports['destroy']=function(_0x2f0380,_0x3d1907){return db[_0xc62c('0x3b')][_0xc62c('0x40')]({'where':{'id':_0x2f0380[_0xc62c('0x44')]['id']}})['then'](handleEntityNotFound(_0x3d1907,null))['then'](removeEntity(_0x3d1907,null))[_0xc62c('0x41')](handleError(_0x3d1907,null));};exports[_0xc62c('0x45')]=function(_0x280b8d,_0x2ebea4){return db[_0xc62c('0x3b')][_0xc62c('0x45')]()[_0xc62c('0x21')](respondWithResult(_0x2ebea4,null))['catch'](handleError(_0x2ebea4,null));}; \ No newline at end of file +var _0x9186=['to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../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','apply','reject','save','then','name','map','MailTransferReport','rawAttributes','type','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','pick','merge','where','VIRTUAL','filter','options','includeAll','include','rows','catch','show','find','create','body','destroy','describe','eml-format','fast-json-patch','moment','bluebird','path','sox'];(function(_0x1bae8b,_0x87c842){var _0x33d115=function(_0x4dea4f){while(--_0x4dea4f){_0x1bae8b['push'](_0x1bae8b['shift']());}};_0x33d115(++_0x87c842);}(_0x9186,0x1d6));var _0x6918=function(_0x19159a,_0x1cb5c3){_0x19159a=_0x19159a-0x0;var _0xa677f4=_0x9186[_0x19159a];return _0xa677f4;};'use strict';var emlformat=require(_0x6918('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6918('0x1'));var rp=require('request-promise');var moment=require(_0x6918('0x2'));var BPromise=require(_0x6918('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6918('0x4'));var sox=require(_0x6918('0x5'));var csv=require(_0x6918('0x6'));var ejs=require(_0x6918('0x7'));var fs=require('fs');var fs_extra=require(_0x6918('0x8'));var _=require('lodash');var squel=require(_0x6918('0x9'));var crypto=require(_0x6918('0xa'));var jsforce=require(_0x6918('0xb'));var deskjs=require(_0x6918('0xc'));var toCsv=require(_0x6918('0x6'));var querystring=require(_0x6918('0xd'));var Papa=require(_0x6918('0xe'));var Redis=require(_0x6918('0xf'));var authService=require(_0x6918('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6918('0x11'));var hardwareService=require(_0x6918('0x12'));var logger=require(_0x6918('0x13'))('api');var utils=require(_0x6918('0x14'));var config=require(_0x6918('0x15'));var licenseUtil=require(_0x6918('0x16'));var db=require(_0x6918('0x17'))['db'];function respondWithStatusCode(_0x517676,_0x232ad2){_0x232ad2=_0x232ad2||0xcc;return function(_0x43291f){if(_0x43291f){return _0x517676[_0x6918('0x18')](_0x232ad2);}return _0x517676[_0x6918('0x19')](_0x232ad2)[_0x6918('0x1a')]();};}function respondWithResult(_0x20d350,_0x5cd055){_0x5cd055=_0x5cd055||0xc8;return function(_0x4e3301){if(_0x4e3301){return _0x20d350['status'](_0x5cd055)[_0x6918('0x1b')](_0x4e3301);}};}function respondWithFilteredResult(_0x404a0e,_0x32d4d2){return function(_0x526dfb){if(_0x526dfb){var _0xbdcf42=typeof _0x32d4d2[_0x6918('0x1c')]===_0x6918('0x1d')&&typeof _0x32d4d2['limit']===_0x6918('0x1d');var _0x31566b=_0x526dfb[_0x6918('0x1e')];var _0x14242a=_0xbdcf42?0x0:_0x32d4d2[_0x6918('0x1c')];var _0x1726eb=_0xbdcf42?_0x526dfb['count']:_0x32d4d2[_0x6918('0x1c')]+_0x32d4d2[_0x6918('0x1f')];var _0xc71dd0;if(_0x1726eb>=_0x31566b){_0x1726eb=_0x31566b;_0xc71dd0=0xc8;}else{_0xc71dd0=0xce;}_0x404a0e[_0x6918('0x19')](_0xc71dd0);return _0x404a0e[_0x6918('0x20')]('Content-Range',_0x14242a+'-'+_0x1726eb+'/'+_0x31566b)[_0x6918('0x1b')](_0x526dfb);}return null;};}function patchUpdates(_0x33c272){return function(_0xf4652b){try{jsonpatch[_0x6918('0x21')](_0xf4652b,_0x33c272,!![]);}catch(_0x266784){return BPromise[_0x6918('0x22')](_0x266784);}return _0xf4652b[_0x6918('0x23')]();};}function saveUpdates(_0x4fcfde,_0x5e39df){return function(_0x5eb219){if(_0x5eb219){return _0x5eb219['update'](_0x4fcfde)[_0x6918('0x24')](function(_0x595cb8){return _0x595cb8;});}return null;};}function removeEntity(_0x59703e,_0xdda59e){return function(_0xaafb29){if(_0xaafb29){return _0xaafb29['destroy']()['then'](function(){_0x59703e[_0x6918('0x19')](0xcc)[_0x6918('0x1a')]();});}};}function handleEntityNotFound(_0x6f9a35,_0x5a9a80){return function(_0x5608bd){if(!_0x5608bd){_0x6f9a35['sendStatus'](0x194);}return _0x5608bd;};}function handleError(_0xb0c048,_0x382077){_0x382077=_0x382077||0x1f4;return function(_0x3683b2){logger['error'](_0x3683b2['stack']);if(_0x3683b2[_0x6918('0x25')]){delete _0x3683b2[_0x6918('0x25')];}_0xb0c048['status'](_0x382077)['send'](_0x3683b2);};}exports['index']=function(_0x4e9b4d,_0x7eccd4){var _0x523481={},_0x35fd28={},_0x1083cb={'count':0x0,'rows':[]};var _0x51039c=_[_0x6918('0x26')](db[_0x6918('0x27')][_0x6918('0x28')],function(_0x339f73){return{'name':_0x339f73['fieldName'],'type':_0x339f73[_0x6918('0x29')]['key']};});_0x35fd28[_0x6918('0x2a')]=_[_0x6918('0x26')](_0x51039c,_0x6918('0x25'));_0x35fd28['query']=_[_0x6918('0x2b')](_0x4e9b4d[_0x6918('0x2c')]);_0x35fd28[_0x6918('0x2d')]=_[_0x6918('0x2e')](_0x35fd28['model'],_0x35fd28['query']);_0x523481['attributes']=_['intersection'](_0x35fd28[_0x6918('0x2a')],qs[_0x6918('0x2f')](_0x4e9b4d['query']['fields']));_0x523481['attributes']=_0x523481[_0x6918('0x30')]['length']?_0x523481[_0x6918('0x30')]:_0x35fd28[_0x6918('0x2a')];if(!_0x4e9b4d[_0x6918('0x2c')][_0x6918('0x31')]('nolimit')){_0x523481[_0x6918('0x1f')]=qs[_0x6918('0x1f')](_0x4e9b4d[_0x6918('0x2c')][_0x6918('0x1f')]);_0x523481[_0x6918('0x1c')]=qs[_0x6918('0x1c')](_0x4e9b4d[_0x6918('0x2c')][_0x6918('0x1c')]);}_0x523481[_0x6918('0x32')]=qs[_0x6918('0x33')](_0x4e9b4d[_0x6918('0x2c')]['sort']);_0x523481['where']=qs['filters'](_[_0x6918('0x34')](_0x4e9b4d[_0x6918('0x2c')],_0x35fd28[_0x6918('0x2d')]),_0x51039c);if(_0x4e9b4d[_0x6918('0x2c')]['filter']){_0x523481['where']=_[_0x6918('0x35')](_0x523481[_0x6918('0x36')],{'$or':_[_0x6918('0x26')](_0x51039c,function(_0x333fe4){if(_0x333fe4[_0x6918('0x29')]!==_0x6918('0x37')){var _0x369ca7={};_0x369ca7[_0x333fe4['name']]={'$like':'%'+_0x4e9b4d['query'][_0x6918('0x38')]+'%'};return _0x369ca7;}})});}_0x523481=_[_0x6918('0x35')]({},_0x523481,_0x4e9b4d[_0x6918('0x39')]);var _0x239cd2={'where':_0x523481[_0x6918('0x36')]};return db[_0x6918('0x27')][_0x6918('0x1e')](_0x239cd2)[_0x6918('0x24')](function(_0x1449b9){_0x1083cb['count']=_0x1449b9;if(_0x4e9b4d[_0x6918('0x2c')][_0x6918('0x3a')]){_0x523481[_0x6918('0x3b')]=[{'all':!![]}];}return db[_0x6918('0x27')]['findAll'](_0x523481);})[_0x6918('0x24')](function(_0xb1fec){_0x1083cb[_0x6918('0x3c')]=_0xb1fec;return _0x1083cb;})['then'](respondWithFilteredResult(_0x7eccd4,_0x523481))[_0x6918('0x3d')](handleError(_0x7eccd4,null));};exports[_0x6918('0x3e')]=function(_0x1b3d90,_0x5817a8){var _0x58a4ba={'raw':!![],'where':{'id':_0x1b3d90['params']['id']}},_0x1aeb30={};_0x1aeb30[_0x6918('0x2a')]=_[_0x6918('0x2b')](db[_0x6918('0x27')][_0x6918('0x28')]);_0x1aeb30['query']=_[_0x6918('0x2b')](_0x1b3d90['query']);_0x1aeb30[_0x6918('0x2d')]=_[_0x6918('0x2e')](_0x1aeb30['model'],_0x1aeb30['query']);_0x58a4ba['attributes']=_[_0x6918('0x2e')](_0x1aeb30[_0x6918('0x2a')],qs['fields'](_0x1b3d90[_0x6918('0x2c')][_0x6918('0x2f')]));_0x58a4ba[_0x6918('0x30')]=_0x58a4ba[_0x6918('0x30')]['length']?_0x58a4ba[_0x6918('0x30')]:_0x1aeb30[_0x6918('0x2a')];if(_0x1b3d90['query'][_0x6918('0x3a')]){_0x58a4ba[_0x6918('0x3b')]=[{'all':!![]}];}_0x58a4ba=_[_0x6918('0x35')]({},_0x58a4ba,_0x1b3d90[_0x6918('0x39')]);return db['MailTransferReport'][_0x6918('0x3f')](_0x58a4ba)[_0x6918('0x24')](handleEntityNotFound(_0x5817a8,null))['then'](respondWithResult(_0x5817a8,null))['catch'](handleError(_0x5817a8,null));};exports[_0x6918('0x40')]=function(_0xb739a0,_0x454bca){return db[_0x6918('0x27')]['create'](_0xb739a0[_0x6918('0x41')],{})[_0x6918('0x24')](respondWithResult(_0x454bca,0xc9))['catch'](handleError(_0x454bca,null));};exports['update']=function(_0x45fece,_0x101a27){if(_0x45fece[_0x6918('0x41')]['id']){delete _0x45fece[_0x6918('0x41')]['id'];}return db[_0x6918('0x27')]['find']({'where':{'id':_0x45fece['params']['id']}})[_0x6918('0x24')](handleEntityNotFound(_0x101a27,null))['then'](saveUpdates(_0x45fece['body'],null))[_0x6918('0x24')](respondWithResult(_0x101a27,null))[_0x6918('0x3d')](handleError(_0x101a27,null));};exports[_0x6918('0x42')]=function(_0x43efb5,_0x5ea587){return db['MailTransferReport']['find']({'where':{'id':_0x43efb5['params']['id']}})[_0x6918('0x24')](handleEntityNotFound(_0x5ea587,null))['then'](removeEntity(_0x5ea587,null))[_0x6918('0x3d')](handleError(_0x5ea587,null));};exports[_0x6918('0x43')]=function(_0x48a56e,_0x1e6625){return db[_0x6918('0x27')][_0x6918('0x43')]()[_0x6918('0x24')](respondWithResult(_0x1e6625,null))[_0x6918('0x3d')](handleError(_0x1e6625,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index a55a935..77c14e5 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 _0x61a5=['../../config/environment','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x41e81d,_0x2be61e){var _0x40292d=function(_0xbef560){while(--_0xbef560){_0x41e81d['push'](_0x41e81d['shift']());}};_0x40292d(++_0x2be61e);}(_0x61a5,0xf0));var _0x561a=function(_0x1f5a63,_0x511504){_0x1f5a63=_0x1f5a63-0x0;var _0x30bb7a=_0x61a5[_0x1f5a63];return _0x30bb7a;};'use strict';var _=require(_0x561a('0x0'));var util=require('util');var logger=require(_0x561a('0x1'))(_0x561a('0x2'));var moment=require(_0x561a('0x3'));var BPromise=require(_0x561a('0x4'));var rp=require(_0x561a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x561a('0x6'));var config=require(_0x561a('0x7'));var attributes=require('./mailTransferReport.attributes');module[_0x561a('0x8')]=function(_0x31f762,_0x24c89a){return _0x31f762[_0x561a('0x9')](_0x561a('0xa'),attributes,{'tableName':_0x561a('0xb'),'paranoid':![],'indexes':[{'name':_0x561a('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3eea=['exports','MailTransferReport','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes'];(function(_0x297c55,_0x34fa75){var _0x120389=function(_0x595108){while(--_0x595108){_0x297c55['push'](_0x297c55['shift']());}};_0x120389(++_0x34fa75);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x76d4a3,_0x4b5fca){_0x76d4a3=_0x76d4a3-0x0;var _0x2152fe=_0x3eea[_0x76d4a3];return _0x2152fe;};'use strict';var _=require(_0xa3ee('0x0'));var util=require('util');var logger=require(_0xa3ee('0x1'))(_0xa3ee('0x2'));var moment=require(_0xa3ee('0x3'));var BPromise=require(_0xa3ee('0x4'));var rp=require(_0xa3ee('0x5'));var fs=require('fs');var path=require(_0xa3ee('0x6'));var rimraf=require(_0xa3ee('0x7'));var config=require(_0xa3ee('0x8'));var attributes=require(_0xa3ee('0x9'));module[_0xa3ee('0xa')]=function(_0xb93cdb,_0x5776bb){return _0xb93cdb['define'](_0xa3ee('0xb'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0xa3ee('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 14ce9a4..84fcf8d 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 _0xe091=['MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe091,0x10f));var _0x1e09=function(_0x10f7f2,_0x48b0b7){_0x10f7f2=_0x10f7f2-0x0;var _0x3e1aba=_0xe091[_0x10f7f2];return _0x3e1aba;};'use strict';var _=require('lodash');var util=require(_0x1e09('0x0'));var moment=require(_0x1e09('0x1'));var BPromise=require(_0x1e09('0x2'));var rs=require(_0x1e09('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1e09('0x4'))['db'];var utils=require(_0x1e09('0x5'));var logger=require(_0x1e09('0x6'))(_0x1e09('0x7'));var config=require(_0x1e09('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1e09('0x9')][_0x1e09('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a62e5,_0x1a4ba5,_0x57d4b6){return new BPromise(function(_0x2657ae,_0x4ef355){return client[_0x1e09('0xb')](_0x4a62e5,_0x57d4b6)['then'](function(_0x5a6efd){logger['info'](_0x1e09('0xc'),_0x1a4ba5,_0x1e09('0xd'));logger[_0x1e09('0xe')](_0x1e09('0xf'),_0x1a4ba5,_0x1e09('0xd'),JSON[_0x1e09('0x10')](_0x5a6efd));if(_0x5a6efd['error']){if(_0x5a6efd[_0x1e09('0x11')][_0x1e09('0x12')]===0x1f4){logger[_0x1e09('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x1a4ba5,_0x5a6efd[_0x1e09('0x11')]['message']);return _0x4ef355(_0x5a6efd[_0x1e09('0x11')][_0x1e09('0x13')]);}logger[_0x1e09('0x11')](_0x1e09('0xc'),_0x1a4ba5,_0x5a6efd[_0x1e09('0x11')][_0x1e09('0x13')]);return _0x2657ae(_0x5a6efd[_0x1e09('0x11')][_0x1e09('0x13')]);}else{logger['info']('MailTransferReport,\x20%s,\x20%s',_0x1a4ba5,_0x1e09('0xd'));_0x2657ae(_0x5a6efd[_0x1e09('0x14')][_0x1e09('0x13')]);}})[_0x1e09('0x15')](function(_0x51b504){logger[_0x1e09('0x11')](_0x1e09('0xc'),_0x1a4ba5,_0x51b504);_0x4ef355(_0x51b504);});});} \ No newline at end of file +var _0xd54d=['message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x16e734,_0x46281a){var _0x45f4c3=function(_0x289d23){while(--_0x289d23){_0x16e734['push'](_0x16e734['shift']());}};_0x45f4c3(++_0x46281a);}(_0xd54d,0x8d));var _0xdd54=function(_0x2ac58d,_0x17e5b4){_0x2ac58d=_0x2ac58d-0x0;var _0x457c15=_0xd54d[_0x2ac58d];return _0x457c15;};'use strict';var _=require('lodash');var util=require(_0xdd54('0x0'));var moment=require('moment');var BPromise=require(_0xdd54('0x1'));var rs=require(_0xdd54('0x2'));var fs=require('fs');var Redis=require(_0xdd54('0x3'));var db=require(_0xdd54('0x4'))['db'];var utils=require(_0xdd54('0x5'));var logger=require('../../config/logger')(_0xdd54('0x6'));var config=require(_0xdd54('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdd54('0x8')][_0xdd54('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x42c6aa,_0x22df48,_0x582c42){return new BPromise(function(_0xaef657,_0x50adb6){return client[_0xdd54('0xa')](_0x42c6aa,_0x582c42)[_0xdd54('0xb')](function(_0x49ef52){logger[_0xdd54('0xc')](_0xdd54('0xd'),_0x22df48,_0xdd54('0xe'));logger[_0xdd54('0xf')](_0xdd54('0x10'),_0x22df48,_0xdd54('0xe'),JSON[_0xdd54('0x11')](_0x49ef52));if(_0x49ef52[_0xdd54('0x12')]){if(_0x49ef52[_0xdd54('0x12')][_0xdd54('0x13')]===0x1f4){logger[_0xdd54('0x12')](_0xdd54('0xd'),_0x22df48,_0x49ef52['error']['message']);return _0x50adb6(_0x49ef52[_0xdd54('0x12')]['message']);}logger[_0xdd54('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x22df48,_0x49ef52[_0xdd54('0x12')]['message']);return _0xaef657(_0x49ef52[_0xdd54('0x12')][_0xdd54('0x14')]);}else{logger['info']('MailTransferReport,\x20%s,\x20%s',_0x22df48,'request\x20sent');_0xaef657(_0x49ef52[_0xdd54('0x15')][_0xdd54('0x14')]);}})[_0xdd54('0x16')](function(_0x5ac8c3){logger[_0xdd54('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x22df48,_0x5ac8c3);_0x50adb6(_0x5ac8c3);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index f47bd00..4e38113 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 _0x25c7=['update','delete','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./memberReport.controller','get','isAuthenticated','index','/describe','show','post','put','/:id'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x25c7,0xfa));var _0x725c=function(_0x87411a,_0x3abc8d){_0x87411a=_0x87411a-0x0;var _0x3fa7c6=_0x25c7[_0x87411a];return _0x3fa7c6;};'use strict';var multer=require(_0x725c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x725c('0x1'));var express=require(_0x725c('0x2'));var router=express[_0x725c('0x3')]();var fs_extra=require(_0x725c('0x4'));var auth=require(_0x725c('0x5'));var interaction=require(_0x725c('0x6'));var config=require('../../config/environment');var controller=require(_0x725c('0x7'));router[_0x725c('0x8')]('/',auth[_0x725c('0x9')](),controller[_0x725c('0xa')]);router[_0x725c('0x8')](_0x725c('0xb'),auth[_0x725c('0x9')](),controller['describe']);router[_0x725c('0x8')]('/:id',auth[_0x725c('0x9')](),controller[_0x725c('0xc')]);router[_0x725c('0xd')]('/',auth[_0x725c('0x9')](),controller['create']);router[_0x725c('0xe')](_0x725c('0xf'),auth[_0x725c('0x9')](),controller[_0x725c('0x10')]);router[_0x725c('0x11')](_0x725c('0xf'),auth[_0x725c('0x9')](),controller['destroy']);module[_0x725c('0x12')]=router; \ No newline at end of file +var _0x720f=['/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','index','/describe','isAuthenticated'];(function(_0x24fa1a,_0x16d9c2){var _0xc5621f=function(_0x5616ac){while(--_0x5616ac){_0x24fa1a['push'](_0x24fa1a['shift']());}};_0xc5621f(++_0x16d9c2);}(_0x720f,0xfa));var _0xf720=function(_0x368bba,_0x1f625b){_0x368bba=_0x368bba-0x0;var _0x409f8f=_0x720f[_0x368bba];return _0x409f8f;};'use strict';var multer=require(_0xf720('0x0'));var util=require(_0xf720('0x1'));var path=require(_0xf720('0x2'));var timeout=require(_0xf720('0x3'));var express=require(_0xf720('0x4'));var router=express['Router']();var fs_extra=require(_0xf720('0x5'));var auth=require(_0xf720('0x6'));var interaction=require(_0xf720('0x7'));var config=require(_0xf720('0x8'));var controller=require(_0xf720('0x9'));router[_0xf720('0xa')]('/',auth['isAuthenticated'](),controller[_0xf720('0xb')]);router['get'](_0xf720('0xc'),auth[_0xf720('0xd')](),controller['describe']);router[_0xf720('0xa')](_0xf720('0xe'),auth[_0xf720('0xd')](),controller['show']);router[_0xf720('0xf')]('/',auth[_0xf720('0xd')](),controller[_0xf720('0x10')]);router[_0xf720('0x11')](_0xf720('0xe'),auth[_0xf720('0xd')](),controller[_0xf720('0x12')]);router[_0xf720('0x13')](_0xf720('0xe'),auth['isAuthenticated'](),controller[_0xf720('0x14')]);module[_0xf720('0x15')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 872dcf0..e4395b2 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 _0x2317=['talk:[start]','talk:[dial\x20string]','talk:[queue]','sequelize','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2317,0x69));var _0x7231=function(_0x415534,_0x35d4bc){_0x415534=_0x415534-0x0;var _0x473026=_0x2317[_0x415534];return _0x473026;};'use strict';var Sequelize=require(_0x7231('0x0'));var moment=require('moment');module[_0x7231('0x1')]={'channel':{'type':Sequelize[_0x7231('0x2')]},'membername':{'type':Sequelize[_0x7231('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7231('0x2')],'defaultValue':_0x7231('0x3'),'comment':_0x7231('0x4')},'duration':{'type':Sequelize[_0x7231('0x5')]},'enterAt':{'type':Sequelize[_0x7231('0x6')]},'exitAt':{'type':Sequelize[_0x7231('0x6')],'set':function(_0x2441ec){var _0x1543bd=moment(_0x2441ec);var _0x4cea5e=moment(this[_0x7231('0x7')](_0x7231('0x8')));var _0x29b926=_0x1543bd[_0x7231('0x9')](_0x4cea5e,_0x7231('0xa'));this[_0x7231('0xb')](_0x7231('0xc'),_0x2441ec);this[_0x7231('0xb')](_0x7231('0xd'),_0x29b926>=0x0?_0x29b926:null);}},'data1':{'type':Sequelize[_0x7231('0x2')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x7231('0x2')],'comment':_0x7231('0xe')},'data3':{'type':Sequelize[_0x7231('0x2')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0x7231('0x2')],'comment':_0x7231('0xf')},'data5':{'type':Sequelize[_0x7231('0x2')],'comment':_0x7231('0x10')},'role':{'type':Sequelize[_0x7231('0x2')]},'internal':{'type':Sequelize[_0x7231('0x5')]},'uniqueid':{'type':Sequelize[_0x7231('0x2')]}}; \ No newline at end of file +var _0x287f=['DATE','getDataValue','enterAt','diff','seconds','setDataValue','talk:[start]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','INTEGER'];(function(_0x383356,_0x33d2f5){var _0x32ee5a=function(_0x2741db){while(--_0x2741db){_0x383356['push'](_0x383356['shift']());}};_0x32ee5a(++_0x33d2f5);}(_0x287f,0x175));var _0xf287=function(_0x3bf7c8,_0x25a3f1){_0x3bf7c8=_0x3bf7c8-0x0;var _0x3867e4=_0x287f[_0x3bf7c8];return _0x3867e4;};'use strict';var Sequelize=require(_0xf287('0x0'));var moment=require(_0xf287('0x1'));module[_0xf287('0x2')]={'channel':{'type':Sequelize[_0xf287('0x3')]},'membername':{'type':Sequelize[_0xf287('0x3')]},'interface':{'type':Sequelize[_0xf287('0x3')]},'type':{'type':Sequelize[_0xf287('0x3')],'defaultValue':'DEFAULT\x20PAUSE','comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0xf287('0x4')]},'enterAt':{'type':Sequelize[_0xf287('0x5')]},'exitAt':{'type':Sequelize[_0xf287('0x5')],'set':function(_0x7356b8){var _0x12342e=moment(_0x7356b8);var _0x1dd74f=moment(this[_0xf287('0x6')](_0xf287('0x7')));var _0x66f830=_0x12342e[_0xf287('0x8')](_0x1dd74f,_0xf287('0x9'));this['setDataValue']('exitAt',_0x7356b8);this[_0xf287('0xa')]('duration',_0x66f830>=0x0?_0x66f830:null);}},'data1':{'type':Sequelize[_0xf287('0x3')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0xf287('0x3')],'comment':_0xf287('0xb')},'data3':{'type':Sequelize[_0xf287('0x3')],'comment':'talk:[destination]'},'data4':{'type':Sequelize['STRING'],'comment':_0xf287('0xc')},'data5':{'type':Sequelize[_0xf287('0x3')],'comment':_0xf287('0xd')},'role':{'type':Sequelize[_0xf287('0x3')]},'internal':{'type':Sequelize[_0xf287('0x4')]},'uniqueid':{'type':Sequelize[_0xf287('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 226388f..6dc09a0 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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x55ca,0x126));var _0xa55c=function(_0x557f5f,_0x31d8e7){_0x557f5f=_0x557f5f-0x0;var _0x196eba=_0x55ca[_0x557f5f];return _0x196eba;};'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 _0x34e8=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','MemberReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x2d61b2,_0x142947){var _0x12df89=function(_0x31c717){while(--_0x31c717){_0x2d61b2['push'](_0x2d61b2['shift']());}};_0x12df89(++_0x142947);}(_0x34e8,0x12c));var _0x834e=function(_0x501f9e,_0x10b3db){_0x501f9e=_0x501f9e-0x0;var _0x5af79b=_0x34e8[_0x501f9e];return _0x5af79b;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(!_0x5e1cc5){_0x24fcf7['sendStatus'](0x194);}return _0x5e1cc5;};}function handleError(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0x1f4;return function(_0x2826ec){logger[_0x834e('0x2c')](_0x2826ec[_0x834e('0x2d')]);if(_0x2826ec[_0x834e('0x2e')]){delete _0x2826ec[_0x834e('0x2e')];}_0x1e713a[_0x834e('0x1d')](_0x508a1d)['send'](_0x2826ec);};}exports['index']=function(_0x4dc64a,_0x58c1d7){var _0x2c7a8d={},_0x567cea={},_0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x32')],'type':_0x1e026a[_0x834e('0x33')][_0x834e('0x34')]};});_0x567cea[_0x834e('0x35')]=_[_0x834e('0x2f')](_0x5dacc1,'name');_0x567cea[_0x834e('0x36')]=_['keys'](_0x4dc64a[_0x834e('0x36')]);_0x567cea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],_0x567cea[_0x834e('0x36')]);_0x2c7a8d[_0x834e('0x39')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x4dc64a[_0x834e('0x36')]['fields']));_0x2c7a8d[_0x834e('0x39')]=_0x2c7a8d[_0x834e('0x39')][_0x834e('0x3b')]?_0x2c7a8d[_0x834e('0x39')]:_0x567cea['model'];if(!_0x4dc64a[_0x834e('0x36')][_0x834e('0x3c')]('nolimit')){_0x2c7a8d['limit']=qs['limit'](_0x4dc64a[_0x834e('0x36')][_0x834e('0x20')]);_0x2c7a8d[_0x834e('0x22')]=qs[_0x834e('0x22')](_0x4dc64a[_0x834e('0x36')][_0x834e('0x22')]);}_0x2c7a8d['order']=qs[_0x834e('0x3d')](_0x4dc64a['query'][_0x834e('0x3d')]);_0x2c7a8d[_0x834e('0x3e')]=qs['filters'](_[_0x834e('0x3f')](_0x4dc64a[_0x834e('0x36')],_0x567cea['filters']),_0x5dacc1);if(_0x4dc64a['query'][_0x834e('0x40')]){_0x2c7a8d[_0x834e('0x3e')]=_[_0x834e('0x41')](_0x2c7a8d[_0x834e('0x3e')],{'$or':_[_0x834e('0x2f')](_0x5dacc1,function(_0x4ca43c){if(_0x4ca43c[_0x834e('0x33')]!=='VIRTUAL'){var _0x50c243={};_0x50c243[_0x4ca43c[_0x834e('0x2e')]]={'$like':'%'+_0x4dc64a['query'][_0x834e('0x40')]+'%'};return _0x50c243;}})});}_0x2c7a8d=_[_0x834e('0x41')]({},_0x2c7a8d,_0x4dc64a[_0x834e('0x42')]);var _0x3c59af={'where':_0x2c7a8d[_0x834e('0x3e')]};return db['MemberReport'][_0x834e('0x21')](_0x3c59af)[_0x834e('0x2a')](function(_0x38f266){_0x106d6a['count']=_0x38f266;if(_0x4dc64a[_0x834e('0x36')][_0x834e('0x43')]){_0x2c7a8d['include']=[{'all':!![]}];}return db[_0x834e('0x30')]['findAll'](_0x2c7a8d);})[_0x834e('0x2a')](function(_0x585335){_0x106d6a['rows']=_0x585335;return _0x106d6a;})['then'](respondWithFilteredResult(_0x58c1d7,_0x2c7a8d))[_0x834e('0x44')](handleError(_0x58c1d7,null));};exports[_0x834e('0x45')]=function(_0x3bcbf4,_0xbc1571){var _0x8ad264={'raw':!![],'where':{'id':_0x3bcbf4[_0x834e('0x46')]['id']}},_0x23feea={};_0x23feea['model']=_[_0x834e('0x47')](db['MemberReport'][_0x834e('0x31')]);_0x23feea['query']=_[_0x834e('0x47')](_0x3bcbf4['query']);_0x23feea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x23feea['model'],_0x23feea[_0x834e('0x36')]);_0x8ad264[_0x834e('0x39')]=_[_0x834e('0x38')](_0x23feea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x3bcbf4[_0x834e('0x36')][_0x834e('0x3a')]));_0x8ad264[_0x834e('0x39')]=_0x8ad264[_0x834e('0x39')][_0x834e('0x3b')]?_0x8ad264['attributes']:_0x23feea[_0x834e('0x35')];if(_0x3bcbf4[_0x834e('0x36')]['includeAll']){_0x8ad264[_0x834e('0x48')]=[{'all':!![]}];}_0x8ad264=_[_0x834e('0x41')]({},_0x8ad264,_0x3bcbf4[_0x834e('0x42')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x8ad264)[_0x834e('0x2a')](handleEntityNotFound(_0xbc1571,null))['then'](respondWithResult(_0xbc1571,null))['catch'](handleError(_0xbc1571,null));};exports[_0x834e('0x4a')]=function(_0x1a5444,_0x30568e){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x1a5444[_0x834e('0x4b')],{})[_0x834e('0x2a')](respondWithResult(_0x30568e,0xc9))[_0x834e('0x44')](handleError(_0x30568e,null));};exports[_0x834e('0x29')]=function(_0x390c45,_0xf02f0d){if(_0x390c45[_0x834e('0x4b')]['id']){delete _0x390c45[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x390c45[_0x834e('0x46')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0xf02f0d,null))[_0x834e('0x2a')](saveUpdates(_0x390c45[_0x834e('0x4b')],null))[_0x834e('0x2a')](respondWithResult(_0xf02f0d,null))['catch'](handleError(_0xf02f0d,null));};exports[_0x834e('0x2b')]=function(_0x1f08b9,_0x4e73e0){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1f08b9['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4e73e0,null))[_0x834e('0x2a')](removeEntity(_0x4e73e0,null))[_0x834e('0x44')](handleError(_0x4e73e0,null));};exports[_0x834e('0x4c')]=function(_0x4288e4,_0xb77aab){return db[_0x834e('0x30')]['describe']()[_0x834e('0x2a')](respondWithResult(_0xb77aab,null))[_0x834e('0x44')](handleError(_0xb77aab,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 3da4546..1749a8a 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 _0xafd1=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./memberReport.attributes','exports','MemberReport','membername_interface','membername','interface'];(function(_0x24c405,_0x56d6fb){var _0x383aef=function(_0x20da69){while(--_0x20da69){_0x24c405['push'](_0x24c405['shift']());}};_0x383aef(++_0x56d6fb);}(_0xafd1,0x1c2));var _0x1afd=function(_0x4953da,_0x5adaca){_0x4953da=_0x4953da-0x0;var _0x2d3780=_0xafd1[_0x4953da];return _0x2d3780;};'use strict';var _=require(_0x1afd('0x0'));var util=require(_0x1afd('0x1'));var logger=require(_0x1afd('0x2'))(_0x1afd('0x3'));var moment=require(_0x1afd('0x4'));var BPromise=require(_0x1afd('0x5'));var rp=require(_0x1afd('0x6'));var fs=require('fs');var path=require(_0x1afd('0x7'));var rimraf=require('rimraf');var config=require(_0x1afd('0x8'));var attributes=require(_0x1afd('0x9'));module[_0x1afd('0xa')]=function(_0x212313,_0x105f27){return _0x212313['define'](_0x1afd('0xb'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x1afd('0xc'),'fields':[_0x1afd('0xd'),_0x1afd('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf18c=['./memberReport.attributes','exports','define','MemberReport','report_member','membername','interface','lodash','util','api','moment','bluebird','path'];(function(_0x39d980,_0x15c127){var _0x33fcbc=function(_0x32548a){while(--_0x32548a){_0x39d980['push'](_0x39d980['shift']());}};_0x33fcbc(++_0x15c127);}(_0xf18c,0x1a7));var _0xcf18=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xf18c[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0xcf18('0x0'));var util=require(_0xcf18('0x1'));var logger=require('../../config/logger')(_0xcf18('0x2'));var moment=require(_0xcf18('0x3'));var BPromise=require(_0xcf18('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcf18('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcf18('0x6'));module[_0xcf18('0x7')]=function(_0x36ee59,_0xee957e){return _0x36ee59[_0xcf18('0x8')](_0xcf18('0x9'),attributes,{'tableName':_0xcf18('0xa'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0xcf18('0xb'),_0xcf18('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index ebba083..3e9684f 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 _0x04f9=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetMemberReport','raw','options','where','limit','include','map','model','attributes','catch','MemberReport','body','CreateMemberReport','UpdateMemberReport','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x55629e,_0x1a5e57){var _0x30f8c6=function(_0x25970b){while(--_0x25970b){_0x55629e['push'](_0x55629e['shift']());}};_0x30f8c6(++_0x1a5e57);}(_0x04f9,0xb3));var _0x904f=function(_0x2663cb,_0x1676c7){_0x2663cb=_0x2663cb-0x0;var _0x5702f0=_0x04f9[_0x2663cb];return _0x5702f0;};'use strict';var _=require('lodash');var util=require(_0x904f('0x0'));var moment=require(_0x904f('0x1'));var BPromise=require(_0x904f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x904f('0x3'));var db=require(_0x904f('0x4'))['db'];var utils=require(_0x904f('0x5'));var logger=require(_0x904f('0x6'))(_0x904f('0x7'));var config=require(_0x904f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x904f('0x9')][_0x904f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x175c38,_0x21dce4,_0x34cbd7){return new BPromise(function(_0x506239,_0xa90c3f){return client[_0x904f('0xb')](_0x175c38,_0x34cbd7)[_0x904f('0xc')](function(_0x4f8d32){logger[_0x904f('0xd')](_0x904f('0xe'),_0x21dce4,_0x904f('0xf'));logger[_0x904f('0x10')](_0x904f('0x11'),_0x21dce4,_0x904f('0xf'),JSON[_0x904f('0x12')](_0x4f8d32));if(_0x4f8d32[_0x904f('0x13')]){if(_0x4f8d32[_0x904f('0x13')][_0x904f('0x14')]===0x1f4){logger[_0x904f('0x13')](_0x904f('0xe'),_0x21dce4,_0x4f8d32[_0x904f('0x13')][_0x904f('0x15')]);return _0xa90c3f(_0x4f8d32[_0x904f('0x13')][_0x904f('0x15')]);}logger[_0x904f('0x13')](_0x904f('0xe'),_0x21dce4,_0x4f8d32[_0x904f('0x13')][_0x904f('0x15')]);return _0x506239(_0x4f8d32[_0x904f('0x13')][_0x904f('0x15')]);}else{logger[_0x904f('0xd')]('MemberReport,\x20%s,\x20%s',_0x21dce4,'request\x20sent');_0x506239(_0x4f8d32[_0x904f('0x16')][_0x904f('0x15')]);}})['catch'](function(_0x58c4d6){logger['error'](_0x904f('0xe'),_0x21dce4,_0x58c4d6);_0xa90c3f(_0x58c4d6);});});}exports[_0x904f('0x17')]=function(_0x4eb784){var _0x43cf3e=this;return new Promise(function(_0x502f80,_0x5327b5){return db['MemberReport']['findAll']({'raw':_0x4eb784['options']?_0x4eb784['options'][_0x904f('0x18')]===undefined?!![]:![]:!![],'where':_0x4eb784[_0x904f('0x19')]?_0x4eb784['options'][_0x904f('0x1a')]||null:null,'attributes':_0x4eb784[_0x904f('0x19')]?_0x4eb784[_0x904f('0x19')]['attributes']||null:null,'limit':_0x4eb784[_0x904f('0x19')]?_0x4eb784[_0x904f('0x19')][_0x904f('0x1b')]||null:null,'include':_0x4eb784[_0x904f('0x19')]?_0x4eb784[_0x904f('0x19')][_0x904f('0x1c')]?_[_0x904f('0x1d')](_0x4eb784[_0x904f('0x19')][_0x904f('0x1c')],function(_0x1f3c74){return{'model':db[_0x1f3c74[_0x904f('0x1e')]],'as':_0x1f3c74['as'],'attributes':_0x1f3c74[_0x904f('0x1f')],'include':_0x1f3c74[_0x904f('0x1c')]?_[_0x904f('0x1d')](_0x1f3c74[_0x904f('0x1c')],function(_0x57dbcc){return{'model':db[_0x57dbcc['model']],'as':_0x57dbcc['as'],'attributes':_0x57dbcc[_0x904f('0x1f')],'include':_0x57dbcc[_0x904f('0x1c')]?_['map'](_0x57dbcc[_0x904f('0x1c')],function(_0x1b8f20){return{'model':db[_0x1b8f20['model']],'as':_0x1b8f20['as'],'attributes':_0x1b8f20[_0x904f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x904f('0xc')](function(_0x3fcb62){logger[_0x904f('0xd')](_0x904f('0x17'),_0x4eb784);logger[_0x904f('0x10')](_0x904f('0x17'),_0x4eb784,JSON[_0x904f('0x12')](_0x3fcb62));_0x502f80(_0x3fcb62);})[_0x904f('0x20')](function(_0x3aa868){logger['error'](_0x904f('0x17'),_0x3aa868['message'],_0x4eb784);_0x5327b5(_0x43cf3e[_0x904f('0x13')](0x1f4,_0x3aa868[_0x904f('0x15')]));});});};exports['CreateMemberReport']=function(_0x56ac39){var _0x39fd1d=this;return new Promise(function(_0x5353d5,_0x7d6015){return db[_0x904f('0x21')]['create'](_0x56ac39[_0x904f('0x22')],{'raw':_0x56ac39['options']?_0x56ac39[_0x904f('0x19')][_0x904f('0x18')]===undefined?!![]:![]:!![]})[_0x904f('0xc')](function(_0x7bebf3){logger[_0x904f('0xd')](_0x904f('0x23'),_0x56ac39);logger['debug']('CreateMemberReport',_0x56ac39,JSON[_0x904f('0x12')](_0x7bebf3));_0x5353d5(_0x7bebf3);})[_0x904f('0x20')](function(_0x524b46){logger[_0x904f('0x13')](_0x904f('0x23'),_0x524b46[_0x904f('0x15')],_0x56ac39);_0x7d6015(_0x39fd1d[_0x904f('0x13')](0x1f4,_0x524b46[_0x904f('0x15')]));});});};exports[_0x904f('0x24')]=function(_0x54ae61){var _0x2bf4ab=this;return new Promise(function(_0x3d1edd,_0x184b51){return db[_0x904f('0x21')]['update'](_0x54ae61[_0x904f('0x22')],{'raw':_0x54ae61[_0x904f('0x19')]?_0x54ae61[_0x904f('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54ae61[_0x904f('0x19')]?_0x54ae61[_0x904f('0x19')][_0x904f('0x1a')]||null:null,'attributes':_0x54ae61[_0x904f('0x19')]?_0x54ae61[_0x904f('0x19')][_0x904f('0x1f')]||null:null,'limit':_0x54ae61[_0x904f('0x19')]?_0x54ae61[_0x904f('0x19')][_0x904f('0x1b')]||null:null})['then'](function(_0x3cb9e9){logger[_0x904f('0xd')](_0x904f('0x24'),_0x54ae61);logger[_0x904f('0x10')]('UpdateMemberReport',_0x54ae61,JSON['stringify'](_0x3cb9e9));_0x3d1edd(_0x3cb9e9);})['catch'](function(_0x1089e4){logger[_0x904f('0x13')](_0x904f('0x24'),_0x1089e4[_0x904f('0x15')],_0x54ae61);_0x184b51(_0x2bf4ab[_0x904f('0x13')](0x1f4,_0x1089e4[_0x904f('0x15')]));});});}; \ No newline at end of file +var _0x1bb4=['limit','include','map','model','info','stringify','CreateMemberReport','MemberReport','create','body','UpdateMemberReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetMemberReport','options','raw','where','attributes'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x1bb4,0x1c7));var _0x41bb=function(_0x2737b0,_0x86f1b0){_0x2737b0=_0x2737b0-0x0;var _0x543d07=_0x1bb4[_0x2737b0];return _0x543d07;};'use strict';var _=require(_0x41bb('0x0'));var util=require(_0x41bb('0x1'));var moment=require(_0x41bb('0x2'));var BPromise=require(_0x41bb('0x3'));var rs=require(_0x41bb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x41bb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x41bb('0x6'))('rpc');var config=require(_0x41bb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x41bb('0x8')][_0x41bb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a2bfc,_0x492edd,_0xbaf7dc){return new BPromise(function(_0x3dc644,_0x4af8b1){return client[_0x41bb('0xa')](_0x1a2bfc,_0xbaf7dc)[_0x41bb('0xb')](function(_0x2ee5b8){logger['info'](_0x41bb('0xc'),_0x492edd,_0x41bb('0xd'));logger[_0x41bb('0xe')](_0x41bb('0xf'),_0x492edd,_0x41bb('0xd'),JSON['stringify'](_0x2ee5b8));if(_0x2ee5b8[_0x41bb('0x10')]){if(_0x2ee5b8[_0x41bb('0x10')][_0x41bb('0x11')]===0x1f4){logger[_0x41bb('0x10')](_0x41bb('0xc'),_0x492edd,_0x2ee5b8[_0x41bb('0x10')][_0x41bb('0x12')]);return _0x4af8b1(_0x2ee5b8[_0x41bb('0x10')]['message']);}logger['error']('MemberReport,\x20%s,\x20%s',_0x492edd,_0x2ee5b8[_0x41bb('0x10')][_0x41bb('0x12')]);return _0x3dc644(_0x2ee5b8[_0x41bb('0x10')]['message']);}else{logger['info'](_0x41bb('0xc'),_0x492edd,_0x41bb('0xd'));_0x3dc644(_0x2ee5b8[_0x41bb('0x13')][_0x41bb('0x12')]);}})[_0x41bb('0x14')](function(_0x4a1687){logger[_0x41bb('0x10')]('MemberReport,\x20%s,\x20%s',_0x492edd,_0x4a1687);_0x4af8b1(_0x4a1687);});});}exports[_0x41bb('0x15')]=function(_0x3fa4a4){var _0x569bce=this;return new Promise(function(_0xc202d0,_0x4163ad){return db['MemberReport']['findAll']({'raw':_0x3fa4a4[_0x41bb('0x16')]?_0x3fa4a4['options'][_0x41bb('0x17')]===undefined?!![]:![]:!![],'where':_0x3fa4a4[_0x41bb('0x16')]?_0x3fa4a4[_0x41bb('0x16')][_0x41bb('0x18')]||null:null,'attributes':_0x3fa4a4[_0x41bb('0x16')]?_0x3fa4a4[_0x41bb('0x16')][_0x41bb('0x19')]||null:null,'limit':_0x3fa4a4[_0x41bb('0x16')]?_0x3fa4a4[_0x41bb('0x16')][_0x41bb('0x1a')]||null:null,'include':_0x3fa4a4['options']?_0x3fa4a4[_0x41bb('0x16')][_0x41bb('0x1b')]?_[_0x41bb('0x1c')](_0x3fa4a4[_0x41bb('0x16')]['include'],function(_0x4d065e){return{'model':db[_0x4d065e[_0x41bb('0x1d')]],'as':_0x4d065e['as'],'attributes':_0x4d065e[_0x41bb('0x19')],'include':_0x4d065e[_0x41bb('0x1b')]?_['map'](_0x4d065e[_0x41bb('0x1b')],function(_0x19bd28){return{'model':db[_0x19bd28['model']],'as':_0x19bd28['as'],'attributes':_0x19bd28[_0x41bb('0x19')],'include':_0x19bd28[_0x41bb('0x1b')]?_[_0x41bb('0x1c')](_0x19bd28[_0x41bb('0x1b')],function(_0x440d33){return{'model':db[_0x440d33[_0x41bb('0x1d')]],'as':_0x440d33['as'],'attributes':_0x440d33[_0x41bb('0x19')]};}):[]};}):[]};}):[]:[]})[_0x41bb('0xb')](function(_0x27ebe8){logger[_0x41bb('0x1e')](_0x41bb('0x15'),_0x3fa4a4);logger[_0x41bb('0xe')](_0x41bb('0x15'),_0x3fa4a4,JSON[_0x41bb('0x1f')](_0x27ebe8));_0xc202d0(_0x27ebe8);})[_0x41bb('0x14')](function(_0x4645c8){logger['error'](_0x41bb('0x15'),_0x4645c8[_0x41bb('0x12')],_0x3fa4a4);_0x4163ad(_0x569bce[_0x41bb('0x10')](0x1f4,_0x4645c8[_0x41bb('0x12')]));});});};exports[_0x41bb('0x20')]=function(_0x126444){var _0x31aa42=this;return new Promise(function(_0x39539a,_0x3590d6){return db[_0x41bb('0x21')][_0x41bb('0x22')](_0x126444[_0x41bb('0x23')],{'raw':_0x126444[_0x41bb('0x16')]?_0x126444[_0x41bb('0x16')][_0x41bb('0x17')]===undefined?!![]:![]:!![]})[_0x41bb('0xb')](function(_0x58eb96){logger[_0x41bb('0x1e')](_0x41bb('0x20'),_0x126444);logger[_0x41bb('0xe')](_0x41bb('0x20'),_0x126444,JSON[_0x41bb('0x1f')](_0x58eb96));_0x39539a(_0x58eb96);})[_0x41bb('0x14')](function(_0x131ce3){logger['error']('CreateMemberReport',_0x131ce3[_0x41bb('0x12')],_0x126444);_0x3590d6(_0x31aa42[_0x41bb('0x10')](0x1f4,_0x131ce3[_0x41bb('0x12')]));});});};exports[_0x41bb('0x24')]=function(_0x37764d){var _0x11f3c9=this;return new Promise(function(_0x346cbc,_0x333738){return db['MemberReport']['update'](_0x37764d['body'],{'raw':_0x37764d[_0x41bb('0x16')]?_0x37764d[_0x41bb('0x16')][_0x41bb('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37764d[_0x41bb('0x16')]?_0x37764d[_0x41bb('0x16')]['where']||null:null,'attributes':_0x37764d[_0x41bb('0x16')]?_0x37764d[_0x41bb('0x16')][_0x41bb('0x19')]||null:null,'limit':_0x37764d[_0x41bb('0x16')]?_0x37764d[_0x41bb('0x16')][_0x41bb('0x1a')]||null:null})[_0x41bb('0xb')](function(_0x3ecb67){logger[_0x41bb('0x1e')](_0x41bb('0x24'),_0x37764d);logger['debug']('UpdateMemberReport',_0x37764d,JSON['stringify'](_0x3ecb67));_0x346cbc(_0x3ecb67);})[_0x41bb('0x14')](function(_0x43a7b5){logger[_0x41bb('0x10')](_0x41bb('0x24'),_0x43a7b5['message'],_0x37764d);_0x333738(_0x11f3c9[_0x41bb('0x10')](0x1f4,_0x43a7b5[_0x41bb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index f1fd1c3..22502da 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 _0x220a=['./migration.controller','index','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4c00a3,_0x2d23e2){var _0x893854=function(_0x6f552c){while(--_0x6f552c){_0x4c00a3['push'](_0x4c00a3['shift']());}};_0x893854(++_0x2d23e2);}(_0x220a,0x13b));var _0xa220=function(_0xa5307a,_0x1a4d5b){_0xa5307a=_0xa5307a-0x0;var _0x6f31ee=_0x220a[_0xa5307a];return _0x6f31ee;};'use strict';var multer=require(_0xa220('0x0'));var util=require(_0xa220('0x1'));var path=require(_0xa220('0x2'));var timeout=require(_0xa220('0x3'));var express=require(_0xa220('0x4'));var router=express['Router']();var fs_extra=require(_0xa220('0x5'));var auth=require(_0xa220('0x6'));var interaction=require(_0xa220('0x7'));var config=require(_0xa220('0x8'));var controller=require(_0xa220('0x9'));router['get']('/',controller[_0xa220('0xa')]);module[_0xa220('0xb')]=router; \ No newline at end of file +var _0x4658=['../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','exports','multer','util','path','express','fs-extra'];(function(_0x3b563b,_0x445233){var _0x2ba209=function(_0x3e93ba){while(--_0x3e93ba){_0x3b563b['push'](_0x3b563b['shift']());}};_0x2ba209(++_0x445233);}(_0x4658,0x145));var _0x8465=function(_0x32f4d5,_0x13c1c6){_0x32f4d5=_0x32f4d5-0x0;var _0x1fc57d=_0x4658[_0x32f4d5];return _0x1fc57d;};'use strict';var multer=require(_0x8465('0x0'));var util=require(_0x8465('0x1'));var path=require(_0x8465('0x2'));var timeout=require('connect-timeout');var express=require(_0x8465('0x3'));var router=express['Router']();var fs_extra=require(_0x8465('0x4'));var auth=require(_0x8465('0x5'));var interaction=require(_0x8465('0x6'));var config=require(_0x8465('0x7'));var controller=require(_0x8465('0x8'));router[_0x8465('0x9')]('/',controller['index']);module[_0x8465('0xa')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 80e6c45..521dc81 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 _0xd001=['sequelize','version'];(function(_0x59c7e5,_0x41c52f){var _0x1a353d=function(_0x35345c){while(--_0x35345c){_0x59c7e5['push'](_0x59c7e5['shift']());}};_0x1a353d(++_0x41c52f);}(_0xd001,0x130));var _0x1d00=function(_0x22840f,_0x4e7902){_0x22840f=_0x22840f-0x0;var _0x1c29e3=_0xd001[_0x22840f];return _0x1c29e3;};'use strict';var Sequelize=require(_0x1d00('0x0'));module['exports']={'version':{'type':Sequelize['STRING'],'unique':_0x1d00('0x1')}}; \ No newline at end of file +var _0xebbd=['version','sequelize','exports','STRING'];(function(_0x3a60fb,_0x4003cd){var _0x37c1fb=function(_0x17fdf2){while(--_0x17fdf2){_0x3a60fb['push'](_0x3a60fb['shift']());}};_0x37c1fb(++_0x4003cd);}(_0xebbd,0x11d));var _0xdebb=function(_0xde4f09,_0x3f451e){_0xde4f09=_0xde4f09-0x0;var _0xcbdfb3=_0xebbd[_0xde4f09];return _0xcbdfb3;};'use strict';var Sequelize=require(_0xdebb('0x0'));module[_0xdebb('0x1')]={'version':{'type':Sequelize[_0xdebb('0x2')],'unique':_0xdebb('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 27c3896..2bc1810 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 _0x98b9=['type','query','keys','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','map','VIRTUAL','options','includeAll','Migration','rows','catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','sendStatus','error','name','index','rawAttributes','fieldName'];(function(_0x348c0f,_0x196872){var _0x462ede=function(_0x22bfde){while(--_0x22bfde){_0x348c0f['push'](_0x348c0f['shift']());}};_0x462ede(++_0x196872);}(_0x98b9,0xd1));var _0x998b=function(_0x46acc0,_0xcf2f9d){_0x46acc0=_0x46acc0-0x0;var _0xbe272a=_0x98b9[_0x46acc0];return _0xbe272a;};'use strict';var emlformat=require(_0x998b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x998b('0x1'));var jsonpatch=require(_0x998b('0x2'));var rp=require(_0x998b('0x3'));var moment=require(_0x998b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x998b('0x5'));var util=require('util');var path=require(_0x998b('0x6'));var sox=require(_0x998b('0x7'));var csv=require(_0x998b('0x8'));var ejs=require(_0x998b('0x9'));var fs=require('fs');var fs_extra=require(_0x998b('0xa'));var _=require(_0x998b('0xb'));var squel=require(_0x998b('0xc'));var crypto=require(_0x998b('0xd'));var jsforce=require(_0x998b('0xe'));var deskjs=require(_0x998b('0xf'));var toCsv=require(_0x998b('0x8'));var querystring=require('querystring');var Papa=require(_0x998b('0x10'));var Redis=require(_0x998b('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x998b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x998b('0x13'))(_0x998b('0x14'));var utils=require('../../config/utils');var config=require(_0x998b('0x15'));var licenseUtil=require(_0x998b('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c20f3,_0x2299da){_0x2299da=_0x2299da||0xcc;return function(_0x2d3ccd){if(_0x2d3ccd){return _0x3c20f3['sendStatus'](_0x2299da);}return _0x3c20f3[_0x998b('0x17')](_0x2299da)['end']();};}function respondWithResult(_0x47f1e9,_0x301acc){_0x301acc=_0x301acc||0xc8;return function(_0x2d9d95){if(_0x2d9d95){return _0x47f1e9[_0x998b('0x17')](_0x301acc)[_0x998b('0x18')](_0x2d9d95);}};}function respondWithFilteredResult(_0x16a3d6,_0x2d5962){return function(_0x177538){if(_0x177538){var _0x294736=typeof _0x2d5962[_0x998b('0x19')]===_0x998b('0x1a')&&typeof _0x2d5962[_0x998b('0x1b')]==='undefined';var _0x59aa79=_0x177538[_0x998b('0x1c')];var _0x3a7188=_0x294736?0x0:_0x2d5962[_0x998b('0x19')];var _0x3848c0=_0x294736?_0x177538[_0x998b('0x1c')]:_0x2d5962['offset']+_0x2d5962[_0x998b('0x1b')];var _0x3d4c17;if(_0x3848c0>=_0x59aa79){_0x3848c0=_0x59aa79;_0x3d4c17=0xc8;}else{_0x3d4c17=0xce;}_0x16a3d6[_0x998b('0x17')](_0x3d4c17);return _0x16a3d6[_0x998b('0x1d')](_0x998b('0x1e'),_0x3a7188+'-'+_0x3848c0+'/'+_0x59aa79)['json'](_0x177538);}return null;};}function patchUpdates(_0x3b61ef){return function(_0x2e0023){try{jsonpatch['apply'](_0x2e0023,_0x3b61ef,!![]);}catch(_0x7c38d0){return BPromise[_0x998b('0x1f')](_0x7c38d0);}return _0x2e0023[_0x998b('0x20')]();};}function saveUpdates(_0x9aedc0,_0x29ca2b){return function(_0x19af6b){if(_0x19af6b){return _0x19af6b[_0x998b('0x21')](_0x9aedc0)[_0x998b('0x22')](function(_0x49b23d){return _0x49b23d;});}return null;};}function removeEntity(_0x113a3f,_0x5d92f6){return function(_0x15734e){if(_0x15734e){return _0x15734e[_0x998b('0x23')]()['then'](function(){_0x113a3f['status'](0xcc)[_0x998b('0x24')]();});}};}function handleEntityNotFound(_0xb10be9,_0x42841d){return function(_0x194418){if(!_0x194418){_0xb10be9[_0x998b('0x25')](0x194);}return _0x194418;};}function handleError(_0x294fe8,_0x30036b){_0x30036b=_0x30036b||0x1f4;return function(_0x5175e6){logger[_0x998b('0x26')](_0x5175e6['stack']);if(_0x5175e6[_0x998b('0x27')]){delete _0x5175e6[_0x998b('0x27')];}_0x294fe8[_0x998b('0x17')](_0x30036b)['send'](_0x5175e6);};}exports[_0x998b('0x28')]=function(_0x2e9a46,_0x53fe8b){var _0x1def21={},_0x8447c9={},_0x427d55={'count':0x0,'rows':[]};var _0x232f7f=_['map'](db['Migration'][_0x998b('0x29')],function(_0xfb6f01){return{'name':_0xfb6f01[_0x998b('0x2a')],'type':_0xfb6f01[_0x998b('0x2b')]['key']};});_0x8447c9['model']=_['map'](_0x232f7f,_0x998b('0x27'));_0x8447c9[_0x998b('0x2c')]=_[_0x998b('0x2d')](_0x2e9a46[_0x998b('0x2c')]);_0x8447c9[_0x998b('0x2e')]=_['intersection'](_0x8447c9[_0x998b('0x2f')],_0x8447c9[_0x998b('0x2c')]);_0x1def21[_0x998b('0x30')]=_['intersection'](_0x8447c9[_0x998b('0x2f')],qs['fields'](_0x2e9a46['query'][_0x998b('0x31')]));_0x1def21[_0x998b('0x30')]=_0x1def21[_0x998b('0x30')]['length']?_0x1def21[_0x998b('0x30')]:_0x8447c9['model'];if(!_0x2e9a46['query'][_0x998b('0x32')](_0x998b('0x33'))){_0x1def21[_0x998b('0x1b')]=qs[_0x998b('0x1b')](_0x2e9a46[_0x998b('0x2c')]['limit']);_0x1def21[_0x998b('0x19')]=qs[_0x998b('0x19')](_0x2e9a46[_0x998b('0x2c')]['offset']);}_0x1def21[_0x998b('0x34')]=qs[_0x998b('0x35')](_0x2e9a46['query'][_0x998b('0x35')]);_0x1def21[_0x998b('0x36')]=qs['filters'](_[_0x998b('0x37')](_0x2e9a46['query'],_0x8447c9[_0x998b('0x2e')]),_0x232f7f);if(_0x2e9a46[_0x998b('0x2c')]['filter']){_0x1def21[_0x998b('0x36')]=_['merge'](_0x1def21['where'],{'$or':_[_0x998b('0x38')](_0x232f7f,function(_0x542d50){if(_0x542d50['type']!==_0x998b('0x39')){var _0x508916={};_0x508916[_0x542d50['name']]={'$like':'%'+_0x2e9a46[_0x998b('0x2c')]['filter']+'%'};return _0x508916;}})});}_0x1def21=_['merge']({},_0x1def21,_0x2e9a46[_0x998b('0x3a')]);var _0xa46de3={'where':_0x1def21['where']};return db['Migration'][_0x998b('0x1c')](_0xa46de3)[_0x998b('0x22')](function(_0x17e4e8){_0x427d55[_0x998b('0x1c')]=_0x17e4e8;if(_0x2e9a46[_0x998b('0x2c')][_0x998b('0x3b')]){_0x1def21['include']=[{'all':!![]}];}return db[_0x998b('0x3c')]['findAll'](_0x1def21);})[_0x998b('0x22')](function(_0x315da6){_0x427d55[_0x998b('0x3d')]=_0x315da6;return _0x427d55;})[_0x998b('0x22')](respondWithFilteredResult(_0x53fe8b,_0x1def21))[_0x998b('0x3e')](handleError(_0x53fe8b,null));}; \ No newline at end of file +var _0x2595=['json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','Migration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','nolimit','order','sort','pick','where','merge','filter','options','includeAll','include','findAll','rows','catch','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/license/util','sendStatus','status','end'];(function(_0x49caa9,_0x52f77d){var _0x5d3270=function(_0x1af9d3){while(--_0x1af9d3){_0x49caa9['push'](_0x49caa9['shift']());}};_0x5d3270(++_0x52f77d);}(_0x2595,0xaf));var _0x5259=function(_0x50c492,_0x5c1e67){_0x50c492=_0x50c492-0x0;var _0x3505a8=_0x2595[_0x50c492];return _0x3505a8;};'use strict';var emlformat=require(_0x5259('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5259('0x1'));var jsonpatch=require(_0x5259('0x2'));var rp=require('request-promise');var moment=require(_0x5259('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5259('0x4'));var util=require(_0x5259('0x5'));var path=require(_0x5259('0x6'));var sox=require('sox');var csv=require(_0x5259('0x7'));var ejs=require(_0x5259('0x8'));var fs=require('fs');var fs_extra=require(_0x5259('0x9'));var _=require('lodash');var squel=require(_0x5259('0xa'));var crypto=require(_0x5259('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5259('0xc'));var toCsv=require(_0x5259('0x7'));var querystring=require('querystring');var Papa=require(_0x5259('0xd'));var Redis=require(_0x5259('0xe'));var authService=require(_0x5259('0xf'));var qs=require(_0x5259('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5259('0x11'));var utils=require(_0x5259('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x5259('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ed5fa,_0x3c7d49){_0x3c7d49=_0x3c7d49||0xcc;return function(_0x17c812){if(_0x17c812){return _0x2ed5fa[_0x5259('0x14')](_0x3c7d49);}return _0x2ed5fa[_0x5259('0x15')](_0x3c7d49)[_0x5259('0x16')]();};}function respondWithResult(_0x24ec74,_0x3049b5){_0x3049b5=_0x3049b5||0xc8;return function(_0x11f2cb){if(_0x11f2cb){return _0x24ec74[_0x5259('0x15')](_0x3049b5)[_0x5259('0x17')](_0x11f2cb);}};}function respondWithFilteredResult(_0x2c55b5,_0x14950c){return function(_0x4cfbf2){if(_0x4cfbf2){var _0x2d9ce7=typeof _0x14950c[_0x5259('0x18')]===_0x5259('0x19')&&typeof _0x14950c['limit']===_0x5259('0x19');var _0x3ab616=_0x4cfbf2[_0x5259('0x1a')];var _0x35fb51=_0x2d9ce7?0x0:_0x14950c['offset'];var _0x2fc344=_0x2d9ce7?_0x4cfbf2[_0x5259('0x1a')]:_0x14950c[_0x5259('0x18')]+_0x14950c[_0x5259('0x1b')];var _0x4b2c6b;if(_0x2fc344>=_0x3ab616){_0x2fc344=_0x3ab616;_0x4b2c6b=0xc8;}else{_0x4b2c6b=0xce;}_0x2c55b5['status'](_0x4b2c6b);return _0x2c55b5[_0x5259('0x1c')](_0x5259('0x1d'),_0x35fb51+'-'+_0x2fc344+'/'+_0x3ab616)['json'](_0x4cfbf2);}return null;};}function patchUpdates(_0x54d426){return function(_0x48f76e){try{jsonpatch['apply'](_0x48f76e,_0x54d426,!![]);}catch(_0x37c5ad){return BPromise[_0x5259('0x1e')](_0x37c5ad);}return _0x48f76e[_0x5259('0x1f')]();};}function saveUpdates(_0x1e613c,_0x3f5b28){return function(_0x3c5324){if(_0x3c5324){return _0x3c5324[_0x5259('0x20')](_0x1e613c)['then'](function(_0x1350e1){return _0x1350e1;});}return null;};}function removeEntity(_0x2a2eff,_0x1ccfdc){return function(_0x20bc63){if(_0x20bc63){return _0x20bc63[_0x5259('0x21')]()[_0x5259('0x22')](function(){_0x2a2eff[_0x5259('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25430e,_0x33a238){return function(_0x5952b0){if(!_0x5952b0){_0x25430e[_0x5259('0x14')](0x194);}return _0x5952b0;};}function handleError(_0x504fdb,_0x49a05f){_0x49a05f=_0x49a05f||0x1f4;return function(_0x531505){logger[_0x5259('0x23')](_0x531505[_0x5259('0x24')]);if(_0x531505[_0x5259('0x25')]){delete _0x531505['name'];}_0x504fdb['status'](_0x49a05f)[_0x5259('0x26')](_0x531505);};}exports[_0x5259('0x27')]=function(_0x378758,_0x5a0545){var _0x58b5e0={},_0x929fce={},_0x1df53d={'count':0x0,'rows':[]};var _0x4d151d=_[_0x5259('0x28')](db[_0x5259('0x29')][_0x5259('0x2a')],function(_0x57ae22){return{'name':_0x57ae22[_0x5259('0x2b')],'type':_0x57ae22[_0x5259('0x2c')][_0x5259('0x2d')]};});_0x929fce[_0x5259('0x2e')]=_['map'](_0x4d151d,'name');_0x929fce[_0x5259('0x2f')]=_[_0x5259('0x30')](_0x378758[_0x5259('0x2f')]);_0x929fce[_0x5259('0x31')]=_['intersection'](_0x929fce[_0x5259('0x2e')],_0x929fce[_0x5259('0x2f')]);_0x58b5e0[_0x5259('0x32')]=_['intersection'](_0x929fce['model'],qs[_0x5259('0x33')](_0x378758[_0x5259('0x2f')][_0x5259('0x33')]));_0x58b5e0[_0x5259('0x32')]=_0x58b5e0[_0x5259('0x32')][_0x5259('0x34')]?_0x58b5e0[_0x5259('0x32')]:_0x929fce['model'];if(!_0x378758[_0x5259('0x2f')]['hasOwnProperty'](_0x5259('0x35'))){_0x58b5e0['limit']=qs[_0x5259('0x1b')](_0x378758[_0x5259('0x2f')]['limit']);_0x58b5e0[_0x5259('0x18')]=qs[_0x5259('0x18')](_0x378758['query'][_0x5259('0x18')]);}_0x58b5e0[_0x5259('0x36')]=qs[_0x5259('0x37')](_0x378758[_0x5259('0x2f')][_0x5259('0x37')]);_0x58b5e0['where']=qs[_0x5259('0x31')](_[_0x5259('0x38')](_0x378758['query'],_0x929fce['filters']),_0x4d151d);if(_0x378758['query']['filter']){_0x58b5e0[_0x5259('0x39')]=_[_0x5259('0x3a')](_0x58b5e0['where'],{'$or':_['map'](_0x4d151d,function(_0x12748c){if(_0x12748c[_0x5259('0x2c')]!=='VIRTUAL'){var _0xbd0405={};_0xbd0405[_0x12748c[_0x5259('0x25')]]={'$like':'%'+_0x378758[_0x5259('0x2f')][_0x5259('0x3b')]+'%'};return _0xbd0405;}})});}_0x58b5e0=_[_0x5259('0x3a')]({},_0x58b5e0,_0x378758[_0x5259('0x3c')]);var _0x41780e={'where':_0x58b5e0[_0x5259('0x39')]};return db[_0x5259('0x29')]['count'](_0x41780e)[_0x5259('0x22')](function(_0x4bc081){_0x1df53d[_0x5259('0x1a')]=_0x4bc081;if(_0x378758['query'][_0x5259('0x3d')]){_0x58b5e0[_0x5259('0x3e')]=[{'all':!![]}];}return db[_0x5259('0x29')][_0x5259('0x3f')](_0x58b5e0);})['then'](function(_0x532e24){_0x1df53d[_0x5259('0x40')]=_0x532e24;return _0x1df53d;})[_0x5259('0x22')](respondWithFilteredResult(_0x5a0545,_0x58b5e0))[_0x5259('0x41')](handleError(_0x5a0545,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 52bbd82..2d1ee74 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 _0xe699=['Migration','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./migration.attributes','define'];(function(_0x15a356,_0x4fd5f2){var _0x912328=function(_0x21c0e1){while(--_0x21c0e1){_0x15a356['push'](_0x15a356['shift']());}};_0x912328(++_0x4fd5f2);}(_0xe699,0x145));var _0x9e69=function(_0x50524a,_0x279176){_0x50524a=_0x50524a-0x0;var _0x25eeba=_0xe699[_0x50524a];return _0x25eeba;};'use strict';var _=require('lodash');var util=require(_0x9e69('0x0'));var logger=require(_0x9e69('0x1'))(_0x9e69('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9e69('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9e69('0x4'));var config=require(_0x9e69('0x5'));var attributes=require(_0x9e69('0x6'));module['exports']=function(_0x1f3b08,_0x41b2a5){return _0x1f3b08[_0x9e69('0x7')](_0x9e69('0x8'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x48ee=['migrations','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./migration.attributes','define','Migration'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x48ee,0x140));var _0xe48e=function(_0x1b351b,_0x40f973){_0x1b351b=_0x1b351b-0x0;var _0x1b0a59=_0x48ee[_0x1b351b];return _0x1b0a59;};'use strict';var _=require('lodash');var util=require(_0xe48e('0x0'));var logger=require(_0xe48e('0x1'))(_0xe48e('0x2'));var moment=require(_0xe48e('0x3'));var BPromise=require('bluebird');var rp=require(_0xe48e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe48e('0x5'));var config=require(_0xe48e('0x6'));var attributes=require(_0xe48e('0x7'));module['exports']=function(_0x187709,_0x10b179){return _0x187709[_0xe48e('0x8')](_0xe48e('0x9'),attributes,{'tableName':_0xe48e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 5fc1c49..1c2902f 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 _0x115a=['request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s'];(function(_0x24dbad,_0x38302c){var _0x8624ac=function(_0x532198){while(--_0x532198){_0x24dbad['push'](_0x24dbad['shift']());}};_0x8624ac(++_0x38302c);}(_0x115a,0x91));var _0xa115=function(_0x9d96f8,_0x22319b){_0x9d96f8=_0x9d96f8-0x0;var _0x4c0718=_0x115a[_0x9d96f8];return _0x4c0718;};'use strict';var _=require(_0xa115('0x0'));var util=require(_0xa115('0x1'));var moment=require(_0xa115('0x2'));var BPromise=require(_0xa115('0x3'));var rs=require(_0xa115('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa115('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa115('0x6'))(_0xa115('0x7'));var config=require(_0xa115('0x8'));var jayson=require(_0xa115('0x9'));var client=jayson[_0xa115('0xa')][_0xa115('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x567cb3,_0x2499eb,_0x149d01){return new BPromise(function(_0x291bec,_0x2a7527){return client[_0xa115('0xc')](_0x567cb3,_0x149d01)[_0xa115('0xd')](function(_0xd6f607){logger[_0xa115('0xe')](_0xa115('0xf'),_0x2499eb,_0xa115('0x10'));logger[_0xa115('0x11')]('Migration,\x20%s,\x20%s,\x20%s',_0x2499eb,_0xa115('0x10'),JSON[_0xa115('0x12')](_0xd6f607));if(_0xd6f607[_0xa115('0x13')]){if(_0xd6f607[_0xa115('0x13')]['code']===0x1f4){logger[_0xa115('0x13')](_0xa115('0xf'),_0x2499eb,_0xd6f607[_0xa115('0x13')][_0xa115('0x14')]);return _0x2a7527(_0xd6f607[_0xa115('0x13')][_0xa115('0x14')]);}logger[_0xa115('0x13')]('Migration,\x20%s,\x20%s',_0x2499eb,_0xd6f607[_0xa115('0x13')][_0xa115('0x14')]);return _0x291bec(_0xd6f607[_0xa115('0x13')][_0xa115('0x14')]);}else{logger[_0xa115('0xe')](_0xa115('0xf'),_0x2499eb,_0xa115('0x10'));_0x291bec(_0xd6f607[_0xa115('0x15')][_0xa115('0x14')]);}})[_0xa115('0x16')](function(_0x30c06b){logger[_0xa115('0x13')](_0xa115('0xf'),_0x2499eb,_0x30c06b);_0x2a7527(_0x30c06b);});});} \ No newline at end of file +var _0xc901=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','lodash'];(function(_0x421e4e,_0x41b11d){var _0x287010=function(_0x4ecd84){while(--_0x4ecd84){_0x421e4e['push'](_0x421e4e['shift']());}};_0x287010(++_0x41b11d);}(_0xc901,0x142));var _0x1c90=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xc901[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x1c90('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1c90('0x1'));var db=require(_0x1c90('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x1c90('0x3'))(_0x1c90('0x4'));var config=require(_0x1c90('0x5'));var jayson=require(_0x1c90('0x6'));var client=jayson[_0x1c90('0x7')][_0x1c90('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x912860,_0x12c07d,_0x423cfb){return new BPromise(function(_0x19196f,_0x514386){return client[_0x1c90('0x9')](_0x912860,_0x423cfb)[_0x1c90('0xa')](function(_0x38cd18){logger[_0x1c90('0xb')](_0x1c90('0xc'),_0x12c07d,_0x1c90('0xd'));logger[_0x1c90('0xe')](_0x1c90('0xf'),_0x12c07d,'request\x20sent',JSON['stringify'](_0x38cd18));if(_0x38cd18[_0x1c90('0x10')]){if(_0x38cd18[_0x1c90('0x10')][_0x1c90('0x11')]===0x1f4){logger['error']('Migration,\x20%s,\x20%s',_0x12c07d,_0x38cd18[_0x1c90('0x10')][_0x1c90('0x12')]);return _0x514386(_0x38cd18['error'][_0x1c90('0x12')]);}logger[_0x1c90('0x10')](_0x1c90('0xc'),_0x12c07d,_0x38cd18['error'][_0x1c90('0x12')]);return _0x19196f(_0x38cd18['error'][_0x1c90('0x12')]);}else{logger[_0x1c90('0xb')](_0x1c90('0xc'),_0x12c07d,_0x1c90('0xd'));_0x19196f(_0x38cd18['result'][_0x1c90('0x12')]);}})['catch'](function(_0x2d3c90){logger[_0x1c90('0x10')]('Migration,\x20%s,\x20%s',_0x12c07d,_0x2d3c90);_0x514386(_0x2d3c90);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 9eaf244..b410743 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 _0xe5a6=['../../components/auth/service','../../components/interaction/service','./network.controller','get','isAuthenticated','index','/:id','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x474964,_0x58ccca){var _0x583258=function(_0x354a61){while(--_0x354a61){_0x474964['push'](_0x474964['shift']());}};_0x583258(++_0x58ccca);}(_0xe5a6,0x104));var _0x6e5a=function(_0x3b5049,_0x495a94){_0x3b5049=_0x3b5049-0x0;var _0x12454e=_0xe5a6[_0x3b5049];return _0x12454e;};'use strict';var multer=require(_0x6e5a('0x0'));var util=require(_0x6e5a('0x1'));var path=require(_0x6e5a('0x2'));var timeout=require(_0x6e5a('0x3'));var express=require(_0x6e5a('0x4'));var router=express[_0x6e5a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6e5a('0x6'));var interaction=require(_0x6e5a('0x7'));var config=require('../../config/environment');var controller=require(_0x6e5a('0x8'));router[_0x6e5a('0x9')]('/',auth[_0x6e5a('0xa')](),controller[_0x6e5a('0xb')]);router[_0x6e5a('0x9')](_0x6e5a('0xc'),auth[_0x6e5a('0xa')](),controller[_0x6e5a('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x6e5a('0xe')]('/:id',auth[_0x6e5a('0xa')](),controller[_0x6e5a('0xf')]);router[_0x6e5a('0x10')](_0x6e5a('0xc'),auth['isAuthenticated'](),controller[_0x6e5a('0x11')]);module[_0x6e5a('0x12')]=router; \ No newline at end of file +var _0x4e47=['get','isAuthenticated','/:id','show','post','create','put','update','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4e47,0x17f));var _0x74e4=function(_0xab35c5,_0x564565){_0xab35c5=_0xab35c5-0x0;var _0x391434=_0x4e47[_0xab35c5];return _0x391434;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x74e4('0x0'));var timeout=require(_0x74e4('0x1'));var express=require(_0x74e4('0x2'));var router=express[_0x74e4('0x3')]();var fs_extra=require(_0x74e4('0x4'));var auth=require(_0x74e4('0x5'));var interaction=require(_0x74e4('0x6'));var config=require(_0x74e4('0x7'));var controller=require('./network.controller');router[_0x74e4('0x8')]('/',auth[_0x74e4('0x9')](),controller['index']);router[_0x74e4('0x8')](_0x74e4('0xa'),auth[_0x74e4('0x9')](),controller[_0x74e4('0xb')]);router[_0x74e4('0xc')]('/',auth['isAuthenticated'](),controller[_0x74e4('0xd')]);router[_0x74e4('0xe')](_0x74e4('0xa'),auth[_0x74e4('0x9')](),controller[_0x74e4('0xf')]);router['delete'](_0x74e4('0xa'),auth[_0x74e4('0x9')](),controller['destroy']);module[_0x74e4('0x10')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 17c7e03..db5b510 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 _0x4d28=['externip','stun','turn','STRING','exports','ENUM','localnet'];(function(_0x4b3ff6,_0x161f5c){var _0x38a2c3=function(_0x4328b6){while(--_0x4328b6){_0x4b3ff6['push'](_0x4b3ff6['shift']());}};_0x38a2c3(++_0x161f5c);}(_0x4d28,0xac));var _0x84d2=function(_0x193109,_0x50a9ca){_0x193109=_0x193109-0x0;var _0x4af109=_0x4d28[_0x193109];return _0x4af109;};'use strict';var Sequelize=require('sequelize');module[_0x84d2('0x0')]={'type':{'type':Sequelize[_0x84d2('0x1')](_0x84d2('0x2'),_0x84d2('0x3'),_0x84d2('0x4'),_0x84d2('0x5'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x84d2('0x6')]},'password':{'type':Sequelize[_0x84d2('0x6')]}}; \ No newline at end of file +var _0xd81a=['exports','localnet','externip','stun','turn','STRING','sequelize'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xd81a,0xa0));var _0xad81=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xd81a[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require(_0xad81('0x0'));module[_0xad81('0x1')]={'type':{'type':Sequelize['ENUM'](_0xad81('0x2'),_0xad81('0x3'),_0xad81('0x4'),_0xad81('0x5'))},'value':{'type':Sequelize[_0xad81('0x6')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index ea0518b..73d337f 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 _0x2045=['includeAll','findAll','show','rawAttributes','include','options','find','create','toUpperCase','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/network.ejs','body','chan_sip.so','update','STUN','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','util','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','request','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','undefined','Content-Range','then','destroy','end','sendStatus','name','send','index','map','Network','fieldName','key','model','keys','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','count'];(function(_0xcd7ba5,_0x2585c7){var _0x554497=function(_0x422d8a){while(--_0x422d8a){_0xcd7ba5['push'](_0xcd7ba5['shift']());}};_0x554497(++_0x2585c7);}(_0x2045,0x11f));var _0x5204=function(_0x29db14,_0x4fcd9f){_0x29db14=_0x29db14-0x0;var _0x5cfc55=_0x2045[_0x29db14];return _0x5cfc55;};'use strict';var util=require(_0x5204('0x0'));var path=require('path');var ejs=require(_0x5204('0x1'));var fs=require('fs');var _=require(_0x5204('0x2'));var qs=require(_0x5204('0x3'));var logger=require(_0x5204('0x4'))(_0x5204('0x5'));var config=require(_0x5204('0x6'));var db=require(_0x5204('0x7'))['db'];var jayson=require(_0x5204('0x8'));var client=jayson[_0x5204('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f8f2e,_0x11f419,_0x2557e5,_0x2d7c34){return new Promise(function(_0x53dcc1,_0x2f9aa4){var _0x2ad612=_0x2d7c34||client;return _0x2ad612[_0x5204('0xa')](_0x2f8f2e,_0x2557e5)['then'](function(_0x2c574b){logger[_0x5204('0xb')](_0x5204('0xc'),_0x11f419,_0x5204('0xd'));logger['debug'](_0x5204('0xe'),_0x11f419,_0x5204('0xd'),JSON[_0x5204('0xf')](_0x2c574b));if(_0x2c574b['error']){if(_0x2c574b[_0x5204('0x10')][_0x5204('0x11')]===0x1f4){logger[_0x5204('0x10')](_0x5204('0xc'),_0x11f419,_0x2c574b[_0x5204('0x10')]['message']);return _0x2f9aa4(_0x2c574b[_0x5204('0x10')][_0x5204('0x12')]);}logger['error']('Network,\x20%s,\x20%s',_0x11f419,_0x2c574b['error'][_0x5204('0x12')]);return _0x53dcc1(_0x2c574b[_0x5204('0x10')]['message']);}else{logger['info']('Network,\x20%s,\x20%s',_0x11f419,_0x5204('0xd'));_0x53dcc1(_0x2c574b[_0x5204('0x13')]['message']);}})[_0x5204('0x14')](function(_0x13a0c1){logger[_0x5204('0x10')](_0x5204('0xc'),_0x11f419,_0x13a0c1);_0x2f9aa4(_0x13a0c1);});});}function respondWithResult(_0x45c2d1,_0x3973e4){_0x3973e4=_0x3973e4||0xc8;return function(_0x3e8edc){if(_0x3e8edc){return _0x45c2d1[_0x5204('0x15')](_0x3973e4)[_0x5204('0x16')](_0x3e8edc);}};}function respondWithFilteredResult(_0xeca540,_0x1fe8fb){return function(_0x2da5e1){if(_0x2da5e1){var _0xa25efa=typeof _0x1fe8fb[_0x5204('0x17')]===_0x5204('0x18')&&typeof _0x1fe8fb['limit']==='undefined';var _0x379a60=_0x2da5e1['count'];var _0x18aa06=_0xa25efa?0x0:_0x1fe8fb[_0x5204('0x17')];var _0x1928e4=_0xa25efa?_0x2da5e1['count']:_0x1fe8fb[_0x5204('0x17')]+_0x1fe8fb['limit'];var _0x289941;if(_0x1928e4>=_0x379a60){_0x1928e4=_0x379a60;_0x289941=0xc8;}else{_0x289941=0xce;}_0xeca540[_0x5204('0x15')](_0x289941);return _0xeca540['set'](_0x5204('0x19'),_0x18aa06+'-'+_0x1928e4+'/'+_0x379a60)[_0x5204('0x16')](_0x2da5e1);}return null;};}function saveUpdates(_0x156659){return function(_0x3e034d){if(_0x3e034d){return _0x3e034d['update'](_0x156659)[_0x5204('0x1a')](function(_0x1152bf){return _0x1152bf;});}return null;};}function removeEntity(_0x189e6b){return function(_0x2a0978){if(_0x2a0978){return _0x2a0978[_0x5204('0x1b')]()['then'](function(){_0x189e6b[_0x5204('0x15')](0xcc)[_0x5204('0x1c')]();});}};}function handleEntityNotFound(_0x3da43f){return function(_0x103513){if(!_0x103513){_0x3da43f[_0x5204('0x1d')](0x194);}return _0x103513;};}function handleError(_0x1b9fe9,_0x12ef3c){_0x12ef3c=_0x12ef3c||0x1f4;return function(_0x160f59){logger['error'](_0x160f59['stack']);if(_0x160f59[_0x5204('0x1e')]){delete _0x160f59[_0x5204('0x1e')];}_0x1b9fe9[_0x5204('0x15')](_0x12ef3c)[_0x5204('0x1f')](_0x160f59);};}exports[_0x5204('0x20')]=function(_0x23df2b,_0x2b0c94){var _0x65c50d={},_0x393484={},_0x27fa9b={'count':0x0,'rows':[]};var _0x2fff9c=_[_0x5204('0x21')](db[_0x5204('0x22')]['rawAttributes'],function(_0x45a1fd){return{'name':_0x45a1fd[_0x5204('0x23')],'type':_0x45a1fd['type'][_0x5204('0x24')]};});_0x393484[_0x5204('0x25')]=_[_0x5204('0x21')](_0x2fff9c,'name');_0x393484['query']=_[_0x5204('0x26')](_0x23df2b['query']);_0x393484['filters']=_[_0x5204('0x27')](_0x393484[_0x5204('0x25')],_0x393484['query']);_0x65c50d[_0x5204('0x28')]=_[_0x5204('0x27')](_0x393484[_0x5204('0x25')],qs[_0x5204('0x29')](_0x23df2b[_0x5204('0x2a')][_0x5204('0x29')]));_0x65c50d[_0x5204('0x28')]=_0x65c50d['attributes'][_0x5204('0x2b')]?_0x65c50d[_0x5204('0x28')]:_0x393484['model'];if(!_0x23df2b[_0x5204('0x2a')][_0x5204('0x2c')](_0x5204('0x2d'))){_0x65c50d[_0x5204('0x2e')]=qs[_0x5204('0x2e')](_0x23df2b[_0x5204('0x2a')][_0x5204('0x2e')]);_0x65c50d[_0x5204('0x17')]=qs[_0x5204('0x17')](_0x23df2b[_0x5204('0x2a')]['offset']);}_0x65c50d[_0x5204('0x2f')]=qs[_0x5204('0x30')](_0x23df2b[_0x5204('0x2a')][_0x5204('0x30')]);_0x65c50d[_0x5204('0x31')]=qs['filters'](_[_0x5204('0x32')](_0x23df2b[_0x5204('0x2a')],_0x393484[_0x5204('0x33')]),_0x2fff9c);if(_0x23df2b[_0x5204('0x2a')][_0x5204('0x34')]){_0x65c50d['where']=_[_0x5204('0x35')](_0x65c50d[_0x5204('0x31')],{'$or':_[_0x5204('0x21')](_0x2fff9c,function(_0x4c7cff){if(_0x4c7cff[_0x5204('0x36')]!==_0x5204('0x37')){var _0x3c23d2={};_0x3c23d2[_0x4c7cff[_0x5204('0x1e')]]={'$like':'%'+_0x23df2b[_0x5204('0x2a')][_0x5204('0x34')]+'%'};return _0x3c23d2;}})});}_0x65c50d=_[_0x5204('0x35')]({},_0x65c50d,_0x23df2b['options']);var _0xefef00={'where':_0x65c50d[_0x5204('0x31')]};return db[_0x5204('0x22')][_0x5204('0x38')](_0xefef00)[_0x5204('0x1a')](function(_0x5edbd5){_0x27fa9b['count']=_0x5edbd5;if(_0x23df2b[_0x5204('0x2a')][_0x5204('0x39')]){_0x65c50d['include']=[{'all':!![]}];}return db[_0x5204('0x22')][_0x5204('0x3a')](_0x65c50d);})[_0x5204('0x1a')](function(_0xac6b0b){_0x27fa9b['rows']=_0xac6b0b;return _0x27fa9b;})[_0x5204('0x1a')](respondWithFilteredResult(_0x2b0c94,_0x65c50d))['catch'](handleError(_0x2b0c94,null));};exports[_0x5204('0x3b')]=function(_0x323001,_0x4f3522){var _0x3a60f9={'raw':!![],'where':{'id':_0x323001['params']['id']}},_0x48c502={};_0x48c502[_0x5204('0x25')]=_[_0x5204('0x26')](db['Network'][_0x5204('0x3c')]);_0x48c502['query']=_[_0x5204('0x26')](_0x323001[_0x5204('0x2a')]);_0x48c502[_0x5204('0x33')]=_['intersection'](_0x48c502[_0x5204('0x25')],_0x48c502['query']);_0x3a60f9['attributes']=_['intersection'](_0x48c502['model'],qs[_0x5204('0x29')](_0x323001[_0x5204('0x2a')][_0x5204('0x29')]));_0x3a60f9[_0x5204('0x28')]=_0x3a60f9[_0x5204('0x28')][_0x5204('0x2b')]?_0x3a60f9['attributes']:_0x48c502[_0x5204('0x25')];if(_0x323001[_0x5204('0x2a')][_0x5204('0x39')]){_0x3a60f9[_0x5204('0x3d')]=[{'all':!![]}];}_0x3a60f9=_[_0x5204('0x35')]({},_0x3a60f9,_0x323001[_0x5204('0x3e')]);return db[_0x5204('0x22')][_0x5204('0x3f')](_0x3a60f9)['then'](handleEntityNotFound(_0x4f3522,null))[_0x5204('0x1a')](respondWithResult(_0x4f3522,null))[_0x5204('0x14')](handleError(_0x4f3522,null));};exports[_0x5204('0x40')]=function(_0x56e799,_0x540f88){var _0x36b142;return db[_0x5204('0x22')][_0x5204('0x40')](_0x56e799['body'],{'raw':!![]})['then'](function(_0xf7d7bd){_0x36b142=_0xf7d7bd;return db[_0x5204('0x22')][_0x5204('0x3a')]({'where':{'type':_0x56e799['body'][_0x5204('0x36')]},'raw':!![]});})[_0x5204('0x1a')](function(_0x35e953){if(_0x36b142[_0x5204('0x36')][_0x5204('0x41')]()=='STUN'){var _0x3c2287=fs[_0x5204('0x42')](path[_0x5204('0x43')](config[_0x5204('0x44')],_0x5204('0x45')),_0x5204('0x46'));var _0xcd0c87=ejs[_0x5204('0x47')](_0x3c2287,{'networks':_0x35e953||[]});fs[_0x5204('0x48')](_0x5204('0x49'),_0xcd0c87);return respondWithRpcPromise(_0x5204('0x4a'),_0x5204('0x40'),{'module':_0x5204('0x4b')});}else if(_0x36b142[_0x5204('0x36')][_0x5204('0x41')]()==_0x5204('0x4c')){var _0x20d954=fs[_0x5204('0x42')](path[_0x5204('0x43')](config['root'],'server/files/templates/turn_multiple.ejs'),_0x5204('0x46'));var _0xee39e=ejs[_0x5204('0x47')](_0x20d954,{'networks':_0x35e953||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0xee39e);return respondWithRpcPromise(_0x5204('0x4a'),'create',{'module':_0x5204('0x4b')});}else{var _0x36e7b0=fs[_0x5204('0x42')](path['join'](config['root'],_0x5204('0x4d')),_0x5204('0x46'));var _0x42f1fc=ejs[_0x5204('0x47')](_0x36e7b0,{'networks':_0x35e953||[]});fs['writeFileSync'](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x56e799[_0x5204('0x4e')][_0x5204('0x36')]['toLowerCase']()),_0x42f1fc);return respondWithRpcPromise(_0x5204('0x4a'),'create',{'module':_0x5204('0x4f')});}})[_0x5204('0x1a')](function(){return _0x36b142;})[_0x5204('0x1a')](respondWithResult(_0x540f88,0xc9))[_0x5204('0x14')](handleError(_0x540f88,null));};exports[_0x5204('0x50')]=function(_0x349c43,_0x5a8a9a){var _0x2e7b47;return db['Network']['find']({'where':{'id':_0x349c43['params']['id']}})[_0x5204('0x1a')](handleEntityNotFound(_0x5a8a9a,null))['then'](saveUpdates(_0x349c43[_0x5204('0x4e')],null))[_0x5204('0x1a')](function(_0x4660f6){if(_0x4660f6){_0x2e7b47=_0x4660f6;return db[_0x5204('0x22')]['findAll']({'where':{'type':_0x2e7b47['type']},'raw':!![]});}return null;})[_0x5204('0x1a')](function(_0x4f9ffc){if(_0x2e7b47[_0x5204('0x36')][_0x5204('0x41')]()==_0x5204('0x51')){var _0x50df32=fs['readFileSync'](path[_0x5204('0x43')](config[_0x5204('0x44')],'server/files/templates/stun_multiple.ejs'),_0x5204('0x46'));var _0x4dcb32=ejs['render'](_0x50df32,{'networks':_0x4f9ffc||[]});fs[_0x5204('0x48')](_0x5204('0x49'),_0x4dcb32);return respondWithRpcPromise(_0x5204('0x4a'),_0x5204('0x50'),{'module':'res_stun_monitor.so'});}else if(_0x2e7b47[_0x5204('0x36')][_0x5204('0x41')]()==_0x5204('0x4c')){var _0x26b625=fs[_0x5204('0x42')](path[_0x5204('0x43')](config[_0x5204('0x44')],'server/files/templates/turn_multiple.ejs'),_0x5204('0x46'));var _0x5aab2a=ejs[_0x5204('0x47')](_0x26b625,{'networks':_0x4f9ffc||[]});fs[_0x5204('0x48')]('/etc/asterisk/turn_xcally.conf',_0x5aab2a);return respondWithRpcPromise(_0x5204('0x4a'),_0x5204('0x50'),{'module':_0x5204('0x4b')});}else{var _0xe7f7b7=fs['readFileSync'](path[_0x5204('0x43')](config[_0x5204('0x44')],_0x5204('0x4d')),_0x5204('0x46'));var _0x14d6b2=ejs[_0x5204('0x47')](_0xe7f7b7,{'networks':_0x4f9ffc||[]});fs[_0x5204('0x48')](util['format'](_0x5204('0x52'),_0x349c43[_0x5204('0x4e')][_0x5204('0x36')][_0x5204('0x53')]()),_0x14d6b2);return respondWithRpcPromise(_0x5204('0x4a'),'update',{'module':'chan_sip.so'});}})[_0x5204('0x1a')](function(_0x4ded0e){if(_0x4ded0e){return _0x2e7b47;}return null;})[_0x5204('0x1a')](respondWithResult(_0x5a8a9a,null))[_0x5204('0x14')](handleError(_0x5a8a9a,null));};exports[_0x5204('0x1b')]=function(_0x496cd3,_0x2d8f7e){var _0x337b7a;return db[_0x5204('0x22')][_0x5204('0x3f')]({'where':{'id':_0x496cd3['params']['id']}})[_0x5204('0x1a')](function(_0x26d5d5){_0x337b7a=_0x26d5d5;return _0x26d5d5;})[_0x5204('0x1a')](handleEntityNotFound(_0x2d8f7e,null))['then'](removeEntity(_0x2d8f7e,null))['then'](function(){if(_0x337b7a){return db[_0x5204('0x22')][_0x5204('0x3a')]({'where':{'type':_0x337b7a[_0x5204('0x36')]},'raw':!![]});}})[_0x5204('0x1a')](function(_0x227cde){if(_0x337b7a['type'][_0x5204('0x41')]()=='STUN'){var _0x35f878=fs[_0x5204('0x42')](path[_0x5204('0x43')](config['root'],_0x5204('0x45')),_0x5204('0x46'));var _0x3ac657=ejs[_0x5204('0x47')](_0x35f878,{'networks':_0x227cde||[]});fs[_0x5204('0x48')]('/etc/asterisk/stun_xcally.conf',_0x3ac657);return respondWithRpcPromise(_0x5204('0x4a'),_0x5204('0x1b'),{'module':_0x5204('0x4b')});}else if(_0x337b7a[_0x5204('0x36')][_0x5204('0x41')]()==_0x5204('0x4c')){var _0x36e71f=fs[_0x5204('0x42')](path[_0x5204('0x43')](config[_0x5204('0x44')],_0x5204('0x54')),'utf8');var _0xe21dcb=ejs[_0x5204('0x47')](_0x36e71f,{'networks':_0x227cde||[]});fs[_0x5204('0x48')](_0x5204('0x55'),_0xe21dcb);return respondWithRpcPromise(_0x5204('0x4a'),_0x5204('0x1b'),{'module':_0x5204('0x4b')});}else{var _0xcedd54=fs[_0x5204('0x42')](path[_0x5204('0x43')](config[_0x5204('0x44')],_0x5204('0x4d')),_0x5204('0x46'));var _0x35d878=ejs[_0x5204('0x47')](_0xcedd54,{'networks':_0x227cde||[]});fs[_0x5204('0x48')](util['format'](_0x5204('0x52'),_0x337b7a[_0x5204('0x36')][_0x5204('0x53')]()),_0x35d878);return respondWithRpcPromise(_0x5204('0x4a'),_0x5204('0x1b'),{'module':'chan_sip.so'});}})[_0x5204('0x14')](handleError(_0x2d8f7e,null));}; \ No newline at end of file +var _0x224b=['code','message','result','catch','status','json','undefined','limit','count','offset','set','update','destroy','end','sendStatus','stack','rawAttributes','fieldName','type','key','map','name','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','Network','includeAll','include','findAll','rows','find','create','body','toUpperCase','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','join','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','params','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','jayson/promise','client','request','then','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0xec7da0,_0x1a590b){var _0x304bc1=function(_0xa2bb4f){while(--_0xa2bb4f){_0xec7da0['push'](_0xec7da0['shift']());}};_0x304bc1(++_0x1a590b);}(_0x224b,0x146));var _0xb224=function(_0x2b3625,_0x1cedec){_0x2b3625=_0x2b3625-0x0;var _0x17d169=_0x224b[_0x2b3625];return _0x17d169;};'use strict';var util=require('util');var path=require(_0xb224('0x0'));var ejs=require(_0xb224('0x1'));var fs=require('fs');var _=require(_0xb224('0x2'));var qs=require(_0xb224('0x3'));var logger=require(_0xb224('0x4'))(_0xb224('0x5'));var config=require(_0xb224('0x6'));var db=require('../../mysqldb')['db'];var jayson=require(_0xb224('0x7'));var client=jayson[_0xb224('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25d1e3,_0x521fe6,_0x1ae4fa,_0x4f487e){return new Promise(function(_0x42f654,_0x1ff95b){var _0x2dba77=_0x4f487e||client;return _0x2dba77[_0xb224('0x9')](_0x25d1e3,_0x1ae4fa)[_0xb224('0xa')](function(_0x570a16){logger[_0xb224('0xb')](_0xb224('0xc'),_0x521fe6,'request\x20sent');logger[_0xb224('0xd')](_0xb224('0xe'),_0x521fe6,_0xb224('0xf'),JSON[_0xb224('0x10')](_0x570a16));if(_0x570a16[_0xb224('0x11')]){if(_0x570a16['error'][_0xb224('0x12')]===0x1f4){logger[_0xb224('0x11')](_0xb224('0xc'),_0x521fe6,_0x570a16[_0xb224('0x11')][_0xb224('0x13')]);return _0x1ff95b(_0x570a16[_0xb224('0x11')]['message']);}logger[_0xb224('0x11')]('Network,\x20%s,\x20%s',_0x521fe6,_0x570a16[_0xb224('0x11')][_0xb224('0x13')]);return _0x42f654(_0x570a16[_0xb224('0x11')][_0xb224('0x13')]);}else{logger[_0xb224('0xb')](_0xb224('0xc'),_0x521fe6,_0xb224('0xf'));_0x42f654(_0x570a16[_0xb224('0x14')]['message']);}})[_0xb224('0x15')](function(_0x2e11b5){logger[_0xb224('0x11')](_0xb224('0xc'),_0x521fe6,_0x2e11b5);_0x1ff95b(_0x2e11b5);});});}function respondWithResult(_0xfd8335,_0x5cda68){_0x5cda68=_0x5cda68||0xc8;return function(_0x210bf8){if(_0x210bf8){return _0xfd8335[_0xb224('0x16')](_0x5cda68)[_0xb224('0x17')](_0x210bf8);}};}function respondWithFilteredResult(_0x564cf7,_0x3c23f1){return function(_0x4e3101){if(_0x4e3101){var _0x5c6ba3=typeof _0x3c23f1['offset']===_0xb224('0x18')&&typeof _0x3c23f1[_0xb224('0x19')]==='undefined';var _0x8f9bb4=_0x4e3101[_0xb224('0x1a')];var _0x34680c=_0x5c6ba3?0x0:_0x3c23f1['offset'];var _0x4c2465=_0x5c6ba3?_0x4e3101[_0xb224('0x1a')]:_0x3c23f1[_0xb224('0x1b')]+_0x3c23f1[_0xb224('0x19')];var _0x5cfc1a;if(_0x4c2465>=_0x8f9bb4){_0x4c2465=_0x8f9bb4;_0x5cfc1a=0xc8;}else{_0x5cfc1a=0xce;}_0x564cf7[_0xb224('0x16')](_0x5cfc1a);return _0x564cf7[_0xb224('0x1c')]('Content-Range',_0x34680c+'-'+_0x4c2465+'/'+_0x8f9bb4)['json'](_0x4e3101);}return null;};}function saveUpdates(_0x1aca9b){return function(_0x5b43db){if(_0x5b43db){return _0x5b43db[_0xb224('0x1d')](_0x1aca9b)[_0xb224('0xa')](function(_0xdaf681){return _0xdaf681;});}return null;};}function removeEntity(_0x3fd347){return function(_0x53b2f2){if(_0x53b2f2){return _0x53b2f2[_0xb224('0x1e')]()[_0xb224('0xa')](function(){_0x3fd347[_0xb224('0x16')](0xcc)[_0xb224('0x1f')]();});}};}function handleEntityNotFound(_0xc0d76f){return function(_0x1dcef9){if(!_0x1dcef9){_0xc0d76f[_0xb224('0x20')](0x194);}return _0x1dcef9;};}function handleError(_0x103644,_0x35fa93){_0x35fa93=_0x35fa93||0x1f4;return function(_0x184f32){logger['error'](_0x184f32[_0xb224('0x21')]);if(_0x184f32['name']){delete _0x184f32['name'];}_0x103644[_0xb224('0x16')](_0x35fa93)['send'](_0x184f32);};}exports['index']=function(_0x11a8d0,_0x1697b2){var _0x233721={},_0x562949={},_0x5a23fe={'count':0x0,'rows':[]};var _0x2c7d60=_['map'](db['Network'][_0xb224('0x22')],function(_0x5c9746){return{'name':_0x5c9746[_0xb224('0x23')],'type':_0x5c9746[_0xb224('0x24')][_0xb224('0x25')]};});_0x562949['model']=_[_0xb224('0x26')](_0x2c7d60,_0xb224('0x27'));_0x562949[_0xb224('0x28')]=_[_0xb224('0x29')](_0x11a8d0[_0xb224('0x28')]);_0x562949['filters']=_[_0xb224('0x2a')](_0x562949[_0xb224('0x2b')],_0x562949[_0xb224('0x28')]);_0x233721[_0xb224('0x2c')]=_[_0xb224('0x2a')](_0x562949['model'],qs[_0xb224('0x2d')](_0x11a8d0[_0xb224('0x28')][_0xb224('0x2d')]));_0x233721['attributes']=_0x233721[_0xb224('0x2c')][_0xb224('0x2e')]?_0x233721[_0xb224('0x2c')]:_0x562949[_0xb224('0x2b')];if(!_0x11a8d0[_0xb224('0x28')]['hasOwnProperty'](_0xb224('0x2f'))){_0x233721['limit']=qs[_0xb224('0x19')](_0x11a8d0[_0xb224('0x28')][_0xb224('0x19')]);_0x233721['offset']=qs[_0xb224('0x1b')](_0x11a8d0[_0xb224('0x28')][_0xb224('0x1b')]);}_0x233721[_0xb224('0x30')]=qs['sort'](_0x11a8d0[_0xb224('0x28')][_0xb224('0x31')]);_0x233721[_0xb224('0x32')]=qs[_0xb224('0x33')](_[_0xb224('0x34')](_0x11a8d0[_0xb224('0x28')],_0x562949[_0xb224('0x33')]),_0x2c7d60);if(_0x11a8d0[_0xb224('0x28')][_0xb224('0x35')]){_0x233721[_0xb224('0x32')]=_[_0xb224('0x36')](_0x233721[_0xb224('0x32')],{'$or':_[_0xb224('0x26')](_0x2c7d60,function(_0x47125b){if(_0x47125b[_0xb224('0x24')]!==_0xb224('0x37')){var _0x5ec880={};_0x5ec880[_0x47125b[_0xb224('0x27')]]={'$like':'%'+_0x11a8d0[_0xb224('0x28')][_0xb224('0x35')]+'%'};return _0x5ec880;}})});}_0x233721=_['merge']({},_0x233721,_0x11a8d0[_0xb224('0x38')]);var _0x3ffa1f={'where':_0x233721[_0xb224('0x32')]};return db[_0xb224('0x39')][_0xb224('0x1a')](_0x3ffa1f)[_0xb224('0xa')](function(_0x2311e1){_0x5a23fe[_0xb224('0x1a')]=_0x2311e1;if(_0x11a8d0[_0xb224('0x28')][_0xb224('0x3a')]){_0x233721[_0xb224('0x3b')]=[{'all':!![]}];}return db['Network'][_0xb224('0x3c')](_0x233721);})[_0xb224('0xa')](function(_0x3c115b){_0x5a23fe[_0xb224('0x3d')]=_0x3c115b;return _0x5a23fe;})[_0xb224('0xa')](respondWithFilteredResult(_0x1697b2,_0x233721))[_0xb224('0x15')](handleError(_0x1697b2,null));};exports['show']=function(_0x350473,_0xd7dcc2){var _0x3f7bb0={'raw':!![],'where':{'id':_0x350473['params']['id']}},_0xde78f5={};_0xde78f5[_0xb224('0x2b')]=_[_0xb224('0x29')](db[_0xb224('0x39')]['rawAttributes']);_0xde78f5['query']=_[_0xb224('0x29')](_0x350473[_0xb224('0x28')]);_0xde78f5[_0xb224('0x33')]=_[_0xb224('0x2a')](_0xde78f5[_0xb224('0x2b')],_0xde78f5[_0xb224('0x28')]);_0x3f7bb0[_0xb224('0x2c')]=_[_0xb224('0x2a')](_0xde78f5[_0xb224('0x2b')],qs[_0xb224('0x2d')](_0x350473[_0xb224('0x28')][_0xb224('0x2d')]));_0x3f7bb0[_0xb224('0x2c')]=_0x3f7bb0['attributes'][_0xb224('0x2e')]?_0x3f7bb0[_0xb224('0x2c')]:_0xde78f5[_0xb224('0x2b')];if(_0x350473[_0xb224('0x28')]['includeAll']){_0x3f7bb0[_0xb224('0x3b')]=[{'all':!![]}];}_0x3f7bb0=_[_0xb224('0x36')]({},_0x3f7bb0,_0x350473[_0xb224('0x38')]);return db[_0xb224('0x39')][_0xb224('0x3e')](_0x3f7bb0)['then'](handleEntityNotFound(_0xd7dcc2,null))[_0xb224('0xa')](respondWithResult(_0xd7dcc2,null))[_0xb224('0x15')](handleError(_0xd7dcc2,null));};exports[_0xb224('0x3f')]=function(_0x4cbe95,_0x519e8e){var _0x244266;return db['Network'][_0xb224('0x3f')](_0x4cbe95[_0xb224('0x40')],{'raw':!![]})[_0xb224('0xa')](function(_0x5acfbe){_0x244266=_0x5acfbe;return db[_0xb224('0x39')][_0xb224('0x3c')]({'where':{'type':_0x4cbe95[_0xb224('0x40')][_0xb224('0x24')]},'raw':!![]});})['then'](function(_0x48afe4){if(_0x244266[_0xb224('0x24')][_0xb224('0x41')]()==_0xb224('0x42')){var _0x460ed8=fs[_0xb224('0x43')](path['join'](config[_0xb224('0x44')],_0xb224('0x45')),_0xb224('0x46'));var _0xacb390=ejs[_0xb224('0x47')](_0x460ed8,{'networks':_0x48afe4||[]});fs[_0xb224('0x48')](_0xb224('0x49'),_0xacb390);return respondWithRpcPromise(_0xb224('0x4a'),_0xb224('0x3f'),{'module':_0xb224('0x4b')});}else if(_0x244266[_0xb224('0x24')][_0xb224('0x41')]()==_0xb224('0x4c')){var _0xa46fdc=fs['readFileSync'](path[_0xb224('0x4d')](config[_0xb224('0x44')],_0xb224('0x4e')),_0xb224('0x46'));var _0x18c2f5=ejs['render'](_0xa46fdc,{'networks':_0x48afe4||[]});fs[_0xb224('0x48')](_0xb224('0x4f'),_0x18c2f5);return respondWithRpcPromise(_0xb224('0x4a'),_0xb224('0x3f'),{'module':_0xb224('0x4b')});}else{var _0x27b0bd=fs['readFileSync'](path[_0xb224('0x4d')](config[_0xb224('0x44')],_0xb224('0x50')),_0xb224('0x46'));var _0x4bb9ed=ejs[_0xb224('0x47')](_0x27b0bd,{'networks':_0x48afe4||[]});fs[_0xb224('0x48')](util[_0xb224('0x51')](_0xb224('0x52'),_0x4cbe95[_0xb224('0x40')][_0xb224('0x24')][_0xb224('0x53')]()),_0x4bb9ed);return respondWithRpcPromise(_0xb224('0x4a'),'create',{'module':_0xb224('0x54')});}})[_0xb224('0xa')](function(){return _0x244266;})['then'](respondWithResult(_0x519e8e,0xc9))[_0xb224('0x15')](handleError(_0x519e8e,null));};exports[_0xb224('0x1d')]=function(_0xb35309,_0x27f243){var _0x48fb86;return db[_0xb224('0x39')][_0xb224('0x3e')]({'where':{'id':_0xb35309[_0xb224('0x55')]['id']}})[_0xb224('0xa')](handleEntityNotFound(_0x27f243,null))[_0xb224('0xa')](saveUpdates(_0xb35309[_0xb224('0x40')],null))[_0xb224('0xa')](function(_0x270b6f){if(_0x270b6f){_0x48fb86=_0x270b6f;return db['Network'][_0xb224('0x3c')]({'where':{'type':_0x48fb86[_0xb224('0x24')]},'raw':!![]});}return null;})['then'](function(_0x3136dd){if(_0x48fb86['type'][_0xb224('0x41')]()==_0xb224('0x42')){var _0x46fc1f=fs[_0xb224('0x43')](path[_0xb224('0x4d')](config['root'],'server/files/templates/stun_multiple.ejs'),_0xb224('0x46'));var _0x5a45a4=ejs[_0xb224('0x47')](_0x46fc1f,{'networks':_0x3136dd||[]});fs[_0xb224('0x48')](_0xb224('0x49'),_0x5a45a4);return respondWithRpcPromise(_0xb224('0x4a'),'update',{'module':'res_stun_monitor.so'});}else if(_0x48fb86[_0xb224('0x24')][_0xb224('0x41')]()==_0xb224('0x4c')){var _0x3f25d9=fs[_0xb224('0x43')](path[_0xb224('0x4d')](config[_0xb224('0x44')],_0xb224('0x4e')),'utf8');var _0x398b31=ejs[_0xb224('0x47')](_0x3f25d9,{'networks':_0x3136dd||[]});fs[_0xb224('0x48')](_0xb224('0x4f'),_0x398b31);return respondWithRpcPromise(_0xb224('0x4a'),_0xb224('0x1d'),{'module':_0xb224('0x4b')});}else{var _0x174707=fs['readFileSync'](path[_0xb224('0x4d')](config['root'],'server/files/templates/network.ejs'),_0xb224('0x46'));var _0x2ebd00=ejs[_0xb224('0x47')](_0x174707,{'networks':_0x3136dd||[]});fs['writeFileSync'](util['format'](_0xb224('0x52'),_0xb35309[_0xb224('0x40')][_0xb224('0x24')][_0xb224('0x53')]()),_0x2ebd00);return respondWithRpcPromise(_0xb224('0x4a'),'update',{'module':_0xb224('0x54')});}})[_0xb224('0xa')](function(_0xcbbaee){if(_0xcbbaee){return _0x48fb86;}return null;})[_0xb224('0xa')](respondWithResult(_0x27f243,null))[_0xb224('0x15')](handleError(_0x27f243,null));};exports[_0xb224('0x1e')]=function(_0x26e9c5,_0x16e6ea){var _0x5995a8;return db['Network'][_0xb224('0x3e')]({'where':{'id':_0x26e9c5[_0xb224('0x55')]['id']}})[_0xb224('0xa')](function(_0x1a4fe3){_0x5995a8=_0x1a4fe3;return _0x1a4fe3;})[_0xb224('0xa')](handleEntityNotFound(_0x16e6ea,null))[_0xb224('0xa')](removeEntity(_0x16e6ea,null))['then'](function(){if(_0x5995a8){return db[_0xb224('0x39')][_0xb224('0x3c')]({'where':{'type':_0x5995a8[_0xb224('0x24')]},'raw':!![]});}})[_0xb224('0xa')](function(_0x10138c){if(_0x5995a8[_0xb224('0x24')]['toUpperCase']()==_0xb224('0x42')){var _0x42e627=fs['readFileSync'](path[_0xb224('0x4d')](config[_0xb224('0x44')],_0xb224('0x45')),_0xb224('0x46'));var _0x3d5490=ejs[_0xb224('0x47')](_0x42e627,{'networks':_0x10138c||[]});fs[_0xb224('0x48')]('/etc/asterisk/stun_xcally.conf',_0x3d5490);return respondWithRpcPromise(_0xb224('0x4a'),'destroy',{'module':_0xb224('0x4b')});}else if(_0x5995a8[_0xb224('0x24')][_0xb224('0x41')]()==_0xb224('0x4c')){var _0x2eecd0=fs[_0xb224('0x43')](path[_0xb224('0x4d')](config[_0xb224('0x44')],_0xb224('0x4e')),_0xb224('0x46'));var _0x4ce18b=ejs[_0xb224('0x47')](_0x2eecd0,{'networks':_0x10138c||[]});fs['writeFileSync'](_0xb224('0x4f'),_0x4ce18b);return respondWithRpcPromise('Reload',_0xb224('0x1e'),{'module':'res_stun_monitor.so'});}else{var _0x294a76=fs[_0xb224('0x43')](path[_0xb224('0x4d')](config[_0xb224('0x44')],_0xb224('0x50')),'utf8');var _0x4792f0=ejs['render'](_0x294a76,{'networks':_0x10138c||[]});fs[_0xb224('0x48')](util[_0xb224('0x51')](_0xb224('0x52'),_0x5995a8[_0xb224('0x24')][_0xb224('0x53')]()),_0x4792f0);return respondWithRpcPromise(_0xb224('0x4a'),_0xb224('0x1e'),{'module':_0xb224('0x54')});}})[_0xb224('0x15')](handleError(_0x16e6ea,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 82eb357..456056a 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 _0xe3d4=['api','bluebird','request-promise','rimraf','./network.attributes','exports','define','network','util','../../config/logger'];(function(_0x340959,_0x125e55){var _0x51fda7=function(_0x5817b4){while(--_0x5817b4){_0x340959['push'](_0x340959['shift']());}};_0x51fda7(++_0x125e55);}(_0xe3d4,0xc6));var _0x4e3d=function(_0x1e3671,_0x9ae4fc){_0x1e3671=_0x1e3671-0x0;var _0x48d5f5=_0xe3d4[_0x1e3671];return _0x48d5f5;};'use strict';var _=require('lodash');var util=require(_0x4e3d('0x0'));var logger=require(_0x4e3d('0x1'))(_0x4e3d('0x2'));var moment=require('moment');var BPromise=require(_0x4e3d('0x3'));var rp=require(_0x4e3d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4e3d('0x5'));var config=require('../../config/environment');var attributes=require(_0x4e3d('0x6'));module[_0x4e3d('0x7')]=function(_0x4fd5ff,_0x3eaf60){return _0x4fd5ff[_0x4e3d('0x8')]('Network',attributes,{'tableName':_0x4e3d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbec5=['request-promise','path','../../config/environment','./network.attributes','exports','define','Network','network','lodash','util','api','moment','bluebird'];(function(_0xb9580d,_0x477d1d){var _0x2c411b=function(_0x38da69){while(--_0x38da69){_0xb9580d['push'](_0xb9580d['shift']());}};_0x2c411b(++_0x477d1d);}(_0xbec5,0xe5));var _0x5bec=function(_0x44f974,_0x4db616){_0x44f974=_0x44f974-0x0;var _0x805dbd=_0xbec5[_0x44f974];return _0x805dbd;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var logger=require('../../config/logger')(_0x5bec('0x2'));var moment=require(_0x5bec('0x3'));var BPromise=require(_0x5bec('0x4'));var rp=require(_0x5bec('0x5'));var fs=require('fs');var path=require(_0x5bec('0x6'));var rimraf=require('rimraf');var config=require(_0x5bec('0x7'));var attributes=require(_0x5bec('0x8'));module[_0x5bec('0x9')]=function(_0x4aaac6,_0x3ed67a){return _0x4aaac6[_0x5bec('0xa')](_0x5bec('0xb'),attributes,{'tableName':_0x5bec('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index a94f084..282f994 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x19c5c8,_0xc79167){var _0x2140e6=function(_0x11d748){while(--_0x11d748){_0x19c5c8['push'](_0x19c5c8['shift']());}};_0x2140e6(++_0xc79167);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x9ddfbe,_0x558097){var _0x1c2f6a=function(_0x3f3675){while(--_0x3f3675){_0x9ddfbe['push'](_0x9ddfbe['shift']());}};_0x1c2f6a(++_0x558097);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'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 b08ec53..93a2075 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 _0x37d2=['express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','/:id/notify','notify','/:id/send','send','put','delete','/:id','destroy','removeDispositions','removeAgents','connect-timeout'];(function(_0x1f48e6,_0x4512e9){var _0x4c5025=function(_0x22594a){while(--_0x22594a){_0x1f48e6['push'](_0x1f48e6['shift']());}};_0x4c5025(++_0x4512e9);}(_0x37d2,0x107));var _0x237d=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x37d2[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x237d('0x0'));var express=require(_0x237d('0x1'));var router=express['Router']();var fs_extra=require(_0x237d('0x2'));var auth=require(_0x237d('0x3'));var interaction=require(_0x237d('0x4'));var config=require('../../config/environment');var controller=require('./openchannelAccount.controller');router['get']('/',auth[_0x237d('0x5')](),controller['index']);router[_0x237d('0x6')](_0x237d('0x7'),auth['isAuthenticated'](),controller[_0x237d('0x8')]);router[_0x237d('0x6')]('/:id',auth[_0x237d('0x5')](),controller[_0x237d('0x9')]);router[_0x237d('0x6')](_0x237d('0xa'),auth[_0x237d('0x5')](),controller[_0x237d('0xb')]);router['get'](_0x237d('0xc'),auth[_0x237d('0x5')](),controller[_0x237d('0xd')]);router['get'](_0x237d('0xe'),auth['isAuthenticated'](),controller[_0x237d('0xf')]);router['get'](_0x237d('0x10'),auth[_0x237d('0x5')](),controller[_0x237d('0x11')]);router[_0x237d('0x6')](_0x237d('0x12'),auth[_0x237d('0x5')](),controller[_0x237d('0x13')]);router[_0x237d('0x14')]('/',auth['isAuthenticated'](),controller[_0x237d('0x15')]);router['post'](_0x237d('0xa'),auth[_0x237d('0x5')](),controller[_0x237d('0x16')]);router[_0x237d('0x14')](_0x237d('0xc'),auth[_0x237d('0x5')](),controller['addAnswer']);router[_0x237d('0x14')](_0x237d('0x17'),controller[_0x237d('0x18')]);router[_0x237d('0x14')](_0x237d('0xe'),auth[_0x237d('0x5')](),controller['addApplications']);router[_0x237d('0x14')](_0x237d('0x12'),auth[_0x237d('0x5')](),controller['addAgents']);router[_0x237d('0x14')](_0x237d('0x19'),auth[_0x237d('0x5')](),controller[_0x237d('0x1a')]);router[_0x237d('0x1b')]('/:id',auth[_0x237d('0x5')](),controller['update']);router[_0x237d('0x1c')](_0x237d('0x1d'),auth['isAuthenticated'](),controller[_0x237d('0x1e')]);router[_0x237d('0x1c')](_0x237d('0xa'),auth[_0x237d('0x5')](),controller[_0x237d('0x1f')]);router[_0x237d('0x1c')](_0x237d('0xc'),auth[_0x237d('0x5')](),controller['removeAnswers']);router[_0x237d('0x1c')](_0x237d('0x12'),auth[_0x237d('0x5')](),controller[_0x237d('0x20')]);module['exports']=router; \ No newline at end of file +var _0x6566=['removeAnswers','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','create','/:id/dispositions','addDisposition','post','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','send','put','update','delete','removeDispositions'];(function(_0x392c2e,_0xf95947){var _0x145eeb=function(_0x2294c1){while(--_0x2294c1){_0x392c2e['push'](_0x392c2e['shift']());}};_0x145eeb(++_0xf95947);}(_0x6566,0x9d));var _0x6656=function(_0x3474ac,_0x22d0f7){_0x3474ac=_0x3474ac-0x0;var _0x5345ec=_0x6566[_0x3474ac];return _0x5345ec;};'use strict';var multer=require(_0x6656('0x0'));var util=require(_0x6656('0x1'));var path=require('path');var timeout=require(_0x6656('0x2'));var express=require(_0x6656('0x3'));var router=express[_0x6656('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6656('0x5'));var interaction=require(_0x6656('0x6'));var config=require(_0x6656('0x7'));var controller=require(_0x6656('0x8'));router[_0x6656('0x9')]('/',auth[_0x6656('0xa')](),controller[_0x6656('0xb')]);router[_0x6656('0x9')]('/describe',auth[_0x6656('0xa')](),controller[_0x6656('0xc')]);router[_0x6656('0x9')](_0x6656('0xd'),auth['isAuthenticated'](),controller[_0x6656('0xe')]);router[_0x6656('0x9')]('/:id/dispositions',auth[_0x6656('0xa')](),controller[_0x6656('0xf')]);router['get'](_0x6656('0x10'),auth[_0x6656('0xa')](),controller[_0x6656('0x11')]);router[_0x6656('0x9')](_0x6656('0x12'),auth['isAuthenticated'](),controller[_0x6656('0x13')]);router[_0x6656('0x9')](_0x6656('0x14'),auth[_0x6656('0xa')](),controller[_0x6656('0x15')]);router[_0x6656('0x9')](_0x6656('0x16'),auth[_0x6656('0xa')](),controller['getAgents']);router['post']('/',auth[_0x6656('0xa')](),controller[_0x6656('0x17')]);router['post'](_0x6656('0x18'),auth['isAuthenticated'](),controller[_0x6656('0x19')]);router[_0x6656('0x1a')](_0x6656('0x10'),auth[_0x6656('0xa')](),controller[_0x6656('0x1b')]);router[_0x6656('0x1a')](_0x6656('0x1c'),controller[_0x6656('0x1d')]);router['post'](_0x6656('0x12'),auth[_0x6656('0xa')](),controller[_0x6656('0x1e')]);router[_0x6656('0x1a')](_0x6656('0x16'),auth[_0x6656('0xa')](),controller[_0x6656('0x1f')]);router[_0x6656('0x1a')](_0x6656('0x20'),auth[_0x6656('0xa')](),controller[_0x6656('0x21')]);router[_0x6656('0x22')](_0x6656('0xd'),auth[_0x6656('0xa')](),controller[_0x6656('0x23')]);router[_0x6656('0x24')](_0x6656('0xd'),auth[_0x6656('0xa')](),controller['destroy']);router[_0x6656('0x24')](_0x6656('0x18'),auth[_0x6656('0xa')](),controller[_0x6656('0x25')]);router['delete']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x6656('0x26')]);router[_0x6656('0x24')](_0x6656('0x16'),auth[_0x6656('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 740f91e..bb3159a 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 _0xd06e=['sequelize','exports','STRING','name','generate','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition'];(function(_0x24e930,_0x55422a){var _0xd73f6c=function(_0x5c1cf2){while(--_0x5c1cf2){_0x24e930['push'](_0x24e930['shift']());}};_0xd73f6c(++_0x55422a);}(_0xd06e,0x113));var _0xed06=function(_0x591666,_0x3bea64){_0x591666=_0x591666-0x0;var _0x26168a=_0xd06e[_0x591666];return _0x26168a;};'use strict';var Sequelize=require(_0xed06('0x0'));var rs=require('randomstring');module[_0xed06('0x1')]={'name':{'type':Sequelize[_0xed06('0x2')],'unique':_0xed06('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xed06('0x2')]},'token':{'type':Sequelize[_0xed06('0x2')],'defaultValue':function(){return rs[_0xed06('0x4')]();}},'replyUri':{'type':Sequelize[_0xed06('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xed06('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xed06('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xed06('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xed06('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xed06('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xed06('0x2')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xed06('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xed06('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xed06('0x6')],'defaultValue':![],'comment':_0xed06('0x8'),'set':function(_0x288358){if(!_0x288358)this[_0xed06('0x9')]('mandatoryDispositionPauseId',null);this[_0xed06('0x9')](_0xed06('0xa'),_0x288358);}}}; \ No newline at end of file +var _0x6434=['INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x434804,_0x415f68){var _0x573fc8=function(_0x3ce265){while(--_0x3ce265){_0x434804['push'](_0x434804['shift']());}};_0x573fc8(++_0x415f68);}(_0x6434,0x171));var _0x4643=function(_0x5e6814,_0x5e5185){_0x5e6814=_0x5e6814-0x0;var _0x4d49ac=_0x6434[_0x5e6814];return _0x4d49ac;};'use strict';var Sequelize=require(_0x4643('0x0'));var rs=require(_0x4643('0x1'));module[_0x4643('0x2')]={'name':{'type':Sequelize[_0x4643('0x3')],'unique':_0x4643('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x4643('0x3')]},'token':{'type':Sequelize[_0x4643('0x3')],'defaultValue':function(){return rs[_0x4643('0x5')]();}},'replyUri':{'type':Sequelize[_0x4643('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x4643('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x4643('0x6');}},'notificationSound':{'type':Sequelize[_0x4643('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4643('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4643('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x4643('0x3')]},'queueTransfer':{'type':Sequelize[_0x4643('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4643('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4643('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4643('0x8')],'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['BOOLEAN'],'defaultValue':![],'comment':_0x4643('0x9'),'set':function(_0x237cb0){if(!_0x237cb0)this[_0x4643('0xa')](_0x4643('0xb'),null);this[_0x4643('0xa')](_0x4643('0xc'),_0x237cb0);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index a1b5748..23c3a1f 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 _0x7868=['lastName','threadId','OpenchannelInteraction','ContactId','spread','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','ids','omit','emit','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','client','http','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','save','get','OpenchannelAccounts','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','merge','options','include','rows','show','params','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','findAll','removeDispositions','addAnswer','CannedAnswer','removeAnswers','notify','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','OpenchannelApplication','List','account','applications','list','priority','asc','Applications','contact','firstName'];(function(_0x3b4b18,_0x1eca03){var _0x114a22=function(_0x497725){while(--_0x497725){_0x3b4b18['push'](_0x3b4b18['shift']());}};_0x114a22(++_0x1eca03);}(_0x7868,0x1c0));var _0x8786=function(_0xdb4da9,_0xcbb3ad){_0xdb4da9=_0xdb4da9-0x0;var _0x355195=_0x7868[_0xdb4da9];return _0x355195;};'use strict';var emlformat=require(_0x8786('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8786('0x1'));var jsonpatch=require(_0x8786('0x2'));var rp=require(_0x8786('0x3'));var moment=require(_0x8786('0x4'));var BPromise=require(_0x8786('0x5'));var Mustache=require('mustache');var util=require(_0x8786('0x6'));var path=require(_0x8786('0x7'));var sox=require(_0x8786('0x8'));var csv=require(_0x8786('0x9'));var ejs=require(_0x8786('0xa'));var fs=require('fs');var fs_extra=require(_0x8786('0xb'));var _=require(_0x8786('0xc'));var squel=require(_0x8786('0xd'));var crypto=require(_0x8786('0xe'));var jsforce=require(_0x8786('0xf'));var deskjs=require(_0x8786('0x10'));var toCsv=require(_0x8786('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8786('0x11'));var authService=require(_0x8786('0x12'));var qs=require(_0x8786('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8786('0x14'))('api');var utils=require(_0x8786('0x15'));var config=require(_0x8786('0x16'));var licenseUtil=require(_0x8786('0x17'));var db=require(_0x8786('0x18'))['db'];config[_0x8786('0x19')]=_[_0x8786('0x1a')](config['redis'],{'host':_0x8786('0x1b'),'port':0x18eb});var socket=require(_0x8786('0x1c'))(new Redis(config['redis']));require(_0x8786('0x1d'))[_0x8786('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x8786('0x1f')][_0x8786('0x20')]({'port':0x232c});var client9002=jayson[_0x8786('0x1f')][_0x8786('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x5975bf,_0x54d9f6,_0x4f599e,_0x3ea445){return new BPromise(function(_0x450606,_0x3c99ca){var _0x280979=_0x3ea445||client;return _0x280979['request'](_0x5975bf,_0x4f599e)[_0x8786('0x21')](function(_0x3b9ff1){logger[_0x8786('0x22')](_0x8786('0x23'),_0x54d9f6,_0x8786('0x24'));logger[_0x8786('0x25')](_0x8786('0x26'),_0x54d9f6,_0x8786('0x24'),JSON[_0x8786('0x27')](_0x3b9ff1));if(_0x3b9ff1['error']){if(_0x3b9ff1[_0x8786('0x28')][_0x8786('0x29')]===0x1f4){logger[_0x8786('0x28')](_0x8786('0x23'),_0x54d9f6,_0x3b9ff1[_0x8786('0x28')]['message']);return _0x3c99ca(_0x3b9ff1[_0x8786('0x28')][_0x8786('0x2a')]);}logger['error'](_0x8786('0x23'),_0x54d9f6,_0x3b9ff1[_0x8786('0x28')][_0x8786('0x2a')]);return _0x450606(_0x3b9ff1['error']['message']);}else{logger['info'](_0x8786('0x23'),_0x54d9f6,_0x8786('0x24'));_0x450606(_0x3b9ff1[_0x8786('0x2b')]['message']);}})[_0x8786('0x2c')](function(_0x42555b){logger[_0x8786('0x28')](_0x8786('0x23'),_0x54d9f6,_0x42555b);_0x3c99ca(_0x42555b);});});}function respondWithStatusCode(_0x9f348e,_0x53c1a9){_0x53c1a9=_0x53c1a9||0xcc;return function(_0x4a17f3){if(_0x4a17f3){return _0x9f348e[_0x8786('0x2d')](_0x53c1a9);}return _0x9f348e[_0x8786('0x2e')](_0x53c1a9)[_0x8786('0x2f')]();};}function respondWithResult(_0x91ee61,_0x15bc46){_0x15bc46=_0x15bc46||0xc8;return function(_0x11ea8b){if(_0x11ea8b){return _0x91ee61[_0x8786('0x2e')](_0x15bc46)[_0x8786('0x30')](_0x11ea8b);}};}function respondWithFilteredResult(_0x322a04,_0xd796e7){return function(_0x49ab14){if(_0x49ab14){var _0x5b5af0=typeof _0xd796e7['offset']===_0x8786('0x31')&&typeof _0xd796e7['limit']===_0x8786('0x31');var _0xdf4c00=_0x49ab14['count'];var _0x3dc758=_0x5b5af0?0x0:_0xd796e7['offset'];var _0x1cc114=_0x5b5af0?_0x49ab14[_0x8786('0x32')]:_0xd796e7[_0x8786('0x33')]+_0xd796e7['limit'];var _0x4818f9;if(_0x1cc114>=_0xdf4c00){_0x1cc114=_0xdf4c00;_0x4818f9=0xc8;}else{_0x4818f9=0xce;}_0x322a04[_0x8786('0x2e')](_0x4818f9);return _0x322a04[_0x8786('0x34')](_0x8786('0x35'),_0x3dc758+'-'+_0x1cc114+'/'+_0xdf4c00)[_0x8786('0x30')](_0x49ab14);}return null;};}function patchUpdates(_0x55ece4){return function(_0x28c862){try{jsonpatch[_0x8786('0x36')](_0x28c862,_0x55ece4,!![]);}catch(_0x48e235){return BPromise['reject'](_0x48e235);}return _0x28c862[_0x8786('0x37')]();};}function saveUpdates(_0xdd59b,_0x39270c){return function(_0x2328e1){if(_0x2328e1){return _0x2328e1['update'](_0xdd59b)[_0x8786('0x21')](function(_0x199aad){return _0x199aad;});}return null;};}function removeEntity(_0x57b4b2,_0x3d38bd){return function(_0x4d960d){if(_0x4d960d){return _0x4d960d['destroy']()[_0x8786('0x21')](function(){var _0x3c44af=_0x4d960d[_0x8786('0x38')]({'plain':!![]});var _0x5abda6=_0x8786('0x39');return db[_0x8786('0x3a')][_0x8786('0x3b')]({'where':{'type':_0x5abda6,'resourceId':_0x3c44af['id']}})[_0x8786('0x21')](function(){return _0x4d960d;});})['then'](function(){_0x57b4b2['status'](0xcc)[_0x8786('0x2f')]();});}};}function handleEntityNotFound(_0x1788cd,_0x1a1f36){return function(_0x454b0a){if(!_0x454b0a){_0x1788cd[_0x8786('0x2d')](0x194);}return _0x454b0a;};}function handleError(_0x34b2ec,_0x58b552){_0x58b552=_0x58b552||0x1f4;return function(_0xa93fd9){logger[_0x8786('0x28')](_0xa93fd9[_0x8786('0x3c')]);if(_0xa93fd9[_0x8786('0x3d')]){delete _0xa93fd9[_0x8786('0x3d')];}_0x34b2ec[_0x8786('0x2e')](_0x58b552)[_0x8786('0x3e')](_0xa93fd9);};}exports[_0x8786('0x3f')]=function(_0xb2bca9,_0x2d7421){var _0x231e45={'include':[{'model':db[_0x8786('0x40')],'as':_0x8786('0x41')}]},_0x2e59e2={},_0x4870fd={'count':0x0,'rows':[]};var _0x2bd8a1=_[_0x8786('0x42')](db[_0x8786('0x43')][_0x8786('0x44')],function(_0x577597){return{'name':_0x577597[_0x8786('0x45')],'type':_0x577597[_0x8786('0x46')]['key']};});_0x2e59e2[_0x8786('0x47')]=_[_0x8786('0x42')](_0x2bd8a1,_0x8786('0x3d'));_0x2e59e2[_0x8786('0x48')]=_[_0x8786('0x49')](_0xb2bca9[_0x8786('0x48')]);_0x2e59e2[_0x8786('0x4a')]=_[_0x8786('0x4b')](_0x2e59e2['model'],_0x2e59e2['query']);_0x231e45[_0x8786('0x4c')]=_[_0x8786('0x4b')](_0x2e59e2[_0x8786('0x47')],qs[_0x8786('0x4d')](_0xb2bca9[_0x8786('0x48')][_0x8786('0x4d')]));_0x231e45['attributes']=_0x231e45[_0x8786('0x4c')]['length']?_0x231e45['attributes']:_0x2e59e2[_0x8786('0x47')];if(!_0xb2bca9['query'][_0x8786('0x4e')](_0x8786('0x4f'))){_0x231e45[_0x8786('0x50')]=qs[_0x8786('0x50')](_0xb2bca9[_0x8786('0x48')][_0x8786('0x50')]);_0x231e45[_0x8786('0x33')]=qs[_0x8786('0x33')](_0xb2bca9[_0x8786('0x48')]['offset']);}_0x231e45[_0x8786('0x51')]=qs[_0x8786('0x52')](_0xb2bca9[_0x8786('0x48')]['sort']);_0x231e45['where']=qs[_0x8786('0x4a')](_[_0x8786('0x53')](_0xb2bca9['query'],_0x2e59e2[_0x8786('0x4a')]),_0x2bd8a1);if(_0xb2bca9['query'][_0x8786('0x54')]){_0x231e45[_0x8786('0x55')]=_['merge'](_0x231e45[_0x8786('0x55')],{'$or':_[_0x8786('0x42')](_0x2bd8a1,function(_0x592e83){if(_0x592e83['type']!==_0x8786('0x56')){var _0x1b495f={};_0x1b495f[_0x592e83['name']]={'$like':'%'+_0xb2bca9[_0x8786('0x48')]['filter']+'%'};return _0x1b495f;}})});}_0x231e45=_[_0x8786('0x57')]({},_0x231e45,_0xb2bca9[_0x8786('0x58')]);var _0x12dfbc={'where':_0x231e45['where']};return db[_0x8786('0x43')][_0x8786('0x32')](_0x12dfbc)[_0x8786('0x21')](function(_0x3e0e18){_0x4870fd[_0x8786('0x32')]=_0x3e0e18;if(_0xb2bca9[_0x8786('0x48')]['includeAll']){_0x231e45[_0x8786('0x59')]=[{'all':!![]}];}return db[_0x8786('0x43')]['findAll'](_0x231e45);})['then'](function(_0x4646ca){_0x4870fd[_0x8786('0x5a')]=_0x4646ca;return _0x4870fd;})[_0x8786('0x21')](respondWithFilteredResult(_0x2d7421,_0x231e45))[_0x8786('0x2c')](handleError(_0x2d7421,null));};exports[_0x8786('0x5b')]=function(_0x2561cc,_0x435732){var _0x72abff={'raw':![],'where':{'id':_0x2561cc[_0x8786('0x5c')]['id']},'include':[{'model':db['Pause'],'as':_0x8786('0x41')}]},_0x3a01bd={};_0x3a01bd[_0x8786('0x47')]=_[_0x8786('0x49')](db[_0x8786('0x43')]['rawAttributes']);_0x3a01bd[_0x8786('0x48')]=_[_0x8786('0x49')](_0x2561cc['query']);_0x3a01bd[_0x8786('0x4a')]=_['intersection'](_0x3a01bd[_0x8786('0x47')],_0x3a01bd[_0x8786('0x48')]);_0x72abff[_0x8786('0x4c')]=_[_0x8786('0x4b')](_0x3a01bd['model'],qs[_0x8786('0x4d')](_0x2561cc['query'][_0x8786('0x4d')]));_0x72abff[_0x8786('0x4c')]=_0x72abff[_0x8786('0x4c')][_0x8786('0x5d')]?_0x72abff[_0x8786('0x4c')]:_0x3a01bd[_0x8786('0x47')];if(_0x2561cc[_0x8786('0x48')][_0x8786('0x5e')]){_0x72abff[_0x8786('0x59')]=[{'all':!![]}];}_0x72abff=_[_0x8786('0x57')]({},_0x72abff,_0x2561cc[_0x8786('0x58')]);return db[_0x8786('0x43')][_0x8786('0x5f')](_0x72abff)[_0x8786('0x21')](handleEntityNotFound(_0x435732,null))[_0x8786('0x21')](respondWithResult(_0x435732,null))[_0x8786('0x2c')](handleError(_0x435732,null));};exports[_0x8786('0x60')]=function(_0x242a83,_0x2ed949){return db[_0x8786('0x43')][_0x8786('0x60')](_0x242a83[_0x8786('0x61')],{})[_0x8786('0x21')](function(_0x1f0f6b){var _0x16178d=_0x242a83[_0x8786('0x62')][_0x8786('0x38')]({'plain':!![]});if(!_0x16178d)throw new Error(_0x8786('0x63'));if(_0x16178d['role']===_0x8786('0x62')){var _0x493dc9=_0x1f0f6b['get']({'plain':!![]});var _0x2b241f='OpenchannelAccounts';return db[_0x8786('0x64')][_0x8786('0x5f')]({'where':{'name':_0x2b241f,'userProfileId':_0x16178d[_0x8786('0x65')]},'raw':!![]})[_0x8786('0x21')](function(_0x269f27){if(_0x269f27&&_0x269f27[_0x8786('0x66')]===0x0){return db[_0x8786('0x3a')][_0x8786('0x60')]({'name':_0x493dc9[_0x8786('0x3d')],'resourceId':_0x493dc9['id'],'type':_0x269f27['name'],'sectionId':_0x269f27['id']},{})['then'](function(){return _0x1f0f6b;});}else{return _0x1f0f6b;}})['catch'](function(_0x54f4b8){logger[_0x8786('0x28')](_0x8786('0x67'),_0x54f4b8);throw _0x54f4b8;});}return _0x1f0f6b;})[_0x8786('0x21')](respondWithResult(_0x2ed949,0xc9))[_0x8786('0x2c')](handleError(_0x2ed949,null));};exports[_0x8786('0x68')]=function(_0x17c856,_0x515d6d){if(_0x17c856[_0x8786('0x61')]['id']){delete _0x17c856[_0x8786('0x61')]['id'];}return db[_0x8786('0x43')][_0x8786('0x5f')]({'where':{'id':_0x17c856['params']['id']},'include':[{'model':db[_0x8786('0x40')],'as':_0x8786('0x41')}]})[_0x8786('0x21')](handleEntityNotFound(_0x515d6d,null))[_0x8786('0x21')](saveUpdates(_0x17c856['body'],null))[_0x8786('0x21')](respondWithResult(_0x515d6d,null))[_0x8786('0x2c')](handleError(_0x515d6d,null));};exports[_0x8786('0x3b')]=function(_0x1f8a58,_0x3e4685){return db[_0x8786('0x43')][_0x8786('0x5f')]({'where':{'id':_0x1f8a58[_0x8786('0x5c')]['id']}})[_0x8786('0x21')](handleEntityNotFound(_0x3e4685,null))[_0x8786('0x21')](removeEntity(_0x3e4685,null))[_0x8786('0x2c')](handleError(_0x3e4685,null));};exports[_0x8786('0x69')]=function(_0x208a86,_0x29ca80){return db[_0x8786('0x43')][_0x8786('0x69')]()[_0x8786('0x21')](respondWithResult(_0x29ca80,null))[_0x8786('0x2c')](handleError(_0x29ca80,null));};exports[_0x8786('0x6a')]=function(_0x3f65c5,_0x4a3fc1,_0x426c94){if(_0x3f65c5[_0x8786('0x61')]['id']){delete _0x3f65c5[_0x8786('0x61')]['id'];}return db[_0x8786('0x43')][_0x8786('0x5f')]({'where':{'id':_0x3f65c5[_0x8786('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4a3fc1,null))[_0x8786('0x21')](function(_0x3c72fd){if(_0x3c72fd){_0x3f65c5[_0x8786('0x61')][_0x8786('0x6b')]=_0x3c72fd['id'];return db[_0x8786('0x6c')]['create'](_0x3f65c5[_0x8786('0x61')]);}})['then'](respondWithResult(_0x4a3fc1,null))[_0x8786('0x2c')](handleError(_0x4a3fc1,null));};exports[_0x8786('0x6d')]=function(_0x3de8cd,_0xc80d4d,_0x59a9c0){var _0x54a9f9={'raw':![],'where':{}};var _0x3f3e3f={};var _0x2e5724={'count':0x0,'rows':[]};return db[_0x8786('0x43')][_0x8786('0x6e')]({'where':{'id':_0x3de8cd[_0x8786('0x5c')]['id']}})[_0x8786('0x21')](handleEntityNotFound(_0xc80d4d,null))[_0x8786('0x21')](function(_0x5b12bf){if(_0x5b12bf){_0x3f3e3f[_0x8786('0x47')]=_[_0x8786('0x49')](db[_0x8786('0x6c')][_0x8786('0x44')]);_0x3f3e3f[_0x8786('0x48')]=_[_0x8786('0x49')](_0x3de8cd['query']);_0x3f3e3f[_0x8786('0x4a')]=_[_0x8786('0x4b')](_0x3f3e3f[_0x8786('0x47')],_0x3f3e3f['query']);_0x54a9f9[_0x8786('0x4c')]=_[_0x8786('0x4b')](_0x3f3e3f[_0x8786('0x47')],qs['fields'](_0x3de8cd['query'][_0x8786('0x4d')]));_0x54a9f9[_0x8786('0x4c')]=_0x54a9f9[_0x8786('0x4c')][_0x8786('0x5d')]?_0x54a9f9[_0x8786('0x4c')]:_0x3f3e3f[_0x8786('0x47')];if(!_0x3de8cd[_0x8786('0x48')]['hasOwnProperty'](_0x8786('0x4f'))){_0x54a9f9[_0x8786('0x50')]=qs[_0x8786('0x50')](_0x3de8cd[_0x8786('0x48')][_0x8786('0x50')]);_0x54a9f9[_0x8786('0x33')]=qs[_0x8786('0x33')](_0x3de8cd[_0x8786('0x48')][_0x8786('0x33')]);}_0x54a9f9[_0x8786('0x51')]=qs[_0x8786('0x52')](_0x3de8cd[_0x8786('0x48')][_0x8786('0x52')]);_0x54a9f9['where']=qs[_0x8786('0x4a')](_[_0x8786('0x53')](_0x3de8cd['query'],_0x3f3e3f[_0x8786('0x4a')]));_0x54a9f9['where'][_0x8786('0x6b')]=_0x5b12bf['id'];if(_0x3de8cd['query'][_0x8786('0x54')]){_0x54a9f9['where']=_['merge'](_0x54a9f9['where'],{'$or':_[_0x8786('0x42')](_0x54a9f9[_0x8786('0x4c')],function(_0x4d03be){var _0x4cb54e={};_0x4cb54e[_0x4d03be]={'$like':'%'+_0x3de8cd[_0x8786('0x48')][_0x8786('0x54')]+'%'};return _0x4cb54e;})});}_0x54a9f9=_[_0x8786('0x57')]({},_0x54a9f9,_0x3de8cd[_0x8786('0x58')]);return db['Disposition']['count']({'where':_0x54a9f9[_0x8786('0x55')]})[_0x8786('0x21')](function(_0x23253d){_0x2e5724[_0x8786('0x32')]=_0x23253d;if(_0x3de8cd['query'][_0x8786('0x5e')]){_0x54a9f9[_0x8786('0x59')]=[{'all':!![]}];}return db['Disposition'][_0x8786('0x6f')](_0x54a9f9);})['then'](function(_0x1c68d2){_0x2e5724['rows']=_0x1c68d2;return _0x2e5724;});}})[_0x8786('0x21')](respondWithFilteredResult(_0xc80d4d,_0x54a9f9))['catch'](handleError(_0xc80d4d,null));};exports['removeDispositions']=function(_0x1a72d0,_0xdc78b2,_0x524be5){return db['OpenchannelAccount'][_0x8786('0x5f')]({'where':{'id':_0x1a72d0[_0x8786('0x5c')]['id']}})[_0x8786('0x21')](handleEntityNotFound(_0xdc78b2,null))['then'](function(_0x47ca3a){if(_0x47ca3a){return _0x47ca3a[_0x8786('0x70')](_0x1a72d0[_0x8786('0x48')]['ids']);}})[_0x8786('0x21')](respondWithStatusCode(_0xdc78b2,null))['catch'](handleError(_0xdc78b2,null));};exports[_0x8786('0x71')]=function(_0x595932,_0x2edaec,_0x13270e){if(_0x595932[_0x8786('0x61')]['id']){delete _0x595932[_0x8786('0x61')]['id'];}return db[_0x8786('0x43')][_0x8786('0x5f')]({'where':{'id':_0x595932[_0x8786('0x5c')]['id']}})[_0x8786('0x21')](handleEntityNotFound(_0x2edaec,null))[_0x8786('0x21')](function(_0x15828c){if(_0x15828c){_0x595932[_0x8786('0x61')]['OpenchannelAccountId']=_0x15828c['id'];return db[_0x8786('0x72')][_0x8786('0x60')](_0x595932[_0x8786('0x61')]);}})[_0x8786('0x21')](respondWithResult(_0x2edaec,null))['catch'](handleError(_0x2edaec,null));};exports['getAnswers']=function(_0x3a081d,_0x24776d,_0x5c8890){var _0x199783={'raw':![],'where':{}};var _0x454839={};var _0x418d48={'count':0x0,'rows':[]};return db[_0x8786('0x43')]['findOne']({'where':{'id':_0x3a081d[_0x8786('0x5c')]['id']}})[_0x8786('0x21')](handleEntityNotFound(_0x24776d,null))[_0x8786('0x21')](function(_0xd15705){if(_0xd15705){_0x454839[_0x8786('0x47')]=_[_0x8786('0x49')](db['CannedAnswer'][_0x8786('0x44')]);_0x454839[_0x8786('0x48')]=_[_0x8786('0x49')](_0x3a081d['query']);_0x454839[_0x8786('0x4a')]=_[_0x8786('0x4b')](_0x454839['model'],_0x454839[_0x8786('0x48')]);_0x199783[_0x8786('0x4c')]=_[_0x8786('0x4b')](_0x454839[_0x8786('0x47')],qs[_0x8786('0x4d')](_0x3a081d[_0x8786('0x48')][_0x8786('0x4d')]));_0x199783[_0x8786('0x4c')]=_0x199783['attributes'][_0x8786('0x5d')]?_0x199783['attributes']:_0x454839[_0x8786('0x47')];if(!_0x3a081d['query'][_0x8786('0x4e')](_0x8786('0x4f'))){_0x199783['limit']=qs[_0x8786('0x50')](_0x3a081d[_0x8786('0x48')]['limit']);_0x199783['offset']=qs[_0x8786('0x33')](_0x3a081d[_0x8786('0x48')][_0x8786('0x33')]);}_0x199783[_0x8786('0x51')]=qs[_0x8786('0x52')](_0x3a081d[_0x8786('0x48')][_0x8786('0x52')]);_0x199783[_0x8786('0x55')]=qs['filters'](_['pick'](_0x3a081d[_0x8786('0x48')],_0x454839[_0x8786('0x4a')]));_0x199783[_0x8786('0x55')][_0x8786('0x6b')]=_0xd15705['id'];if(_0x3a081d[_0x8786('0x48')][_0x8786('0x54')]){_0x199783[_0x8786('0x55')]=_[_0x8786('0x57')](_0x199783[_0x8786('0x55')],{'$or':_[_0x8786('0x42')](_0x199783[_0x8786('0x4c')],function(_0x1fb634){var _0xf8466d={};_0xf8466d[_0x1fb634]={'$like':'%'+_0x3a081d[_0x8786('0x48')][_0x8786('0x54')]+'%'};return _0xf8466d;})});}_0x199783=_[_0x8786('0x57')]({},_0x199783,_0x3a081d['options']);return db['CannedAnswer'][_0x8786('0x32')]({'where':_0x199783['where']})['then'](function(_0x20d8b0){_0x418d48[_0x8786('0x32')]=_0x20d8b0;if(_0x3a081d[_0x8786('0x48')][_0x8786('0x5e')]){_0x199783[_0x8786('0x59')]=[{'all':!![]}];}return db[_0x8786('0x72')]['findAll'](_0x199783);})[_0x8786('0x21')](function(_0x49178e){_0x418d48[_0x8786('0x5a')]=_0x49178e;return _0x418d48;});}})[_0x8786('0x21')](respondWithFilteredResult(_0x24776d,_0x199783))[_0x8786('0x2c')](handleError(_0x24776d,null));};exports[_0x8786('0x73')]=function(_0x4517ad,_0x3ebd63,_0x5ec7d9){return db['OpenchannelAccount'][_0x8786('0x5f')]({'where':{'id':_0x4517ad[_0x8786('0x5c')]['id']}})[_0x8786('0x21')](handleEntityNotFound(_0x3ebd63,null))['then'](function(_0x39f81e){if(_0x39f81e){return _0x39f81e[_0x8786('0x73')](_0x4517ad[_0x8786('0x48')]['ids']);}})[_0x8786('0x21')](respondWithStatusCode(_0x3ebd63,null))[_0x8786('0x2c')](handleError(_0x3ebd63,null));};exports[_0x8786('0x74')]=function(_0x375f6f,_0x5eefbf,_0x11ff5e){var _0x518edd={'body':_0x375f6f['body'],'channel':'openchannel'};var _0x5b4ccf=[];var _0x250c6f=[];var _0x2db2b9={};var _0x169a43=![];return db[_0x8786('0x75')]['describe']()[_0x8786('0x21')](function(_0x3ee7e2){if(!_0x3ee7e2){throw new db[(_0x8786('0x76'))][(_0x8786('0x77'))](_0x8786('0x78'));}_0x5b4ccf=_[_0x8786('0x79')](_[_0x8786('0x49')](_0x3ee7e2),[_0x8786('0x7a'),_0x8786('0x7b')]);_0x250c6f=_[_0x8786('0x79')](_[_0x8786('0x49')](_0x3ee7e2),['createdAt','updatedAt',_0x8786('0x7c'),_0x8786('0x7d')]);if(_0x375f6f[_0x8786('0x61')]['id']){delete _0x375f6f[_0x8786('0x61')]['id'];}if(_[_0x8786('0x7e')](_0x375f6f[_0x8786('0x61')][_0x8786('0x7f')])){throw new db['Sequelize'][(_0x8786('0x77'))]('from\x20is\x20mandatory');}if(_[_0x8786('0x7e')](_0x375f6f[_0x8786('0x61')][_0x8786('0x61')])||_0x375f6f['body'][_0x8786('0x61')]===''){throw new db['Sequelize'][(_0x8786('0x77'))](_0x8786('0x80'));}if(_[_0x8786('0x7e')](_0x375f6f[_0x8786('0x61')][_0x8786('0x81')])){throw new db[(_0x8786('0x76'))][(_0x8786('0x77'))](_0x8786('0x82')+_0x250c6f);}if(!_[_0x8786('0x83')](_0x250c6f,_0x375f6f[_0x8786('0x61')]['mapKey'])){throw new db[(_0x8786('0x76'))][(_0x8786('0x77'))](_0x8786('0x84')+_0x250c6f);}_0x2db2b9[_0x375f6f[_0x8786('0x61')][_0x8786('0x81')]]=_0x375f6f[_0x8786('0x61')]['from'];})[_0x8786('0x21')](function(){return db['OpenchannelAccount'][_0x8786('0x5f')]({'where':{'id':_0x375f6f[_0x8786('0x5c')]['id']},'include':[{'model':db[_0x8786('0x85')],'as':'List','include':[{'model':db['CmContact'],'as':_0x8786('0x86'),'where':_0x2db2b9,'limit':0x1,'order':[[_0x8786('0x7b'),_0x8786('0x87')]]}]},{'model':db[_0x8786('0x88')],'as':'Applications'}]});})['then'](handleEntityNotFound(_0x5eefbf,null))['then'](function(_0x42ad9f){if(_0x42ad9f&&_0x42ad9f[_0x8786('0x89')]){_0x518edd[_0x8786('0x8a')]=_0x42ad9f;_0x518edd[_0x8786('0x8b')]=_0x42ad9f['Applications'];_0x518edd[_0x8786('0x8c')]=_0x42ad9f[_0x8786('0x89')];_0x518edd[_0x8786('0x8b')]=_['orderBy'](_0x518edd[_0x8786('0x8b')],[_0x8786('0x8d')],[_0x8786('0x8e')]);if(_0x518edd[_0x8786('0x8a')]['Applications']){delete _0x518edd['account'][_0x8786('0x8f')];}if(_0x518edd[_0x8786('0x8a')][_0x8786('0x89')]&&_0x518edd[_0x8786('0x8a')][_0x8786('0x89')][_0x8786('0x86')][_0x8786('0x5d')]){return _0x518edd[_0x8786('0x8a')][_0x8786('0x89')]['Contacts'][0x0];}var _0xc4316=_[_0x8786('0x1a')](_0x375f6f[_0x8786('0x61')],{'firstName':_0x375f6f[_0x8786('0x61')][_0x8786('0x7f')],'ListId':_0x42ad9f[_0x8786('0x7d')]});_0xc4316[_0x375f6f['body'][_0x8786('0x81')]]=_0x375f6f[_0x8786('0x61')][_0x8786('0x7f')];return db[_0x8786('0x75')][_0x8786('0x60')](_0xc4316,{'fields':_0x5b4ccf,'raw':!![]});}})[_0x8786('0x21')](handleEntityNotFound(_0x5eefbf,null))[_0x8786('0x21')](function(_0x218cab){_0x518edd[_0x8786('0x90')]=_0x218cab;if(_0x218cab){var _0x1e4494={'ContactId':_0x218cab['id'],'OpenchannelAccountId':_0x375f6f[_0x8786('0x5c')]['id'],'from':(_0x218cab[_0x8786('0x91')]||'')+'\x20'+(_0x218cab[_0x8786('0x92')]||'')};var _0x501286={'OpenchannelAccountId':_0x375f6f[_0x8786('0x5c')]['id'],'closed':![]};if(_0x375f6f[_0x8786('0x61')][_0x8786('0x93')]){_0x501286[_0x8786('0x93')]=_0x375f6f[_0x8786('0x61')][_0x8786('0x93')];return db[_0x8786('0x94')][_0x8786('0x5f')]({'where':_0x501286})[_0x8786('0x21')](function(_0x507af0){if(_0x507af0){return[_0x507af0,![]];}_0x1e4494[_0x8786('0x93')]=_0x375f6f['body']['threadId'];_0x1e4494['externalUrl']=_0x375f6f['body']['externalUrl'];return db['OpenchannelInteraction'][_0x8786('0x60')](_0x1e4494)[_0x8786('0x21')](function(_0x44c388){return[_0x44c388,!![]];});});}else{_0x501286[_0x8786('0x93')]=null;}_0x501286[_0x8786('0x95')]=_0x218cab['id'];return db[_0x8786('0x94')]['find']({'where':_0x501286})[_0x8786('0x21')](function(_0x26c5ee){if(_0x26c5ee){return[_0x26c5ee,![]];}return db[_0x8786('0x94')][_0x8786('0x60')](_0x1e4494)[_0x8786('0x21')](function(_0x2a9704){return[_0x2a9704,!![]];});});}})[_0x8786('0x96')](function(_0xa9b6e2,_0x5ef861){if(_0xa9b6e2){_0x169a43=_0x5ef861;if(!_0x5ef861){var _0x50c230={'from':(_0x518edd['contact'][_0x8786('0x91')]||'')+'\x20'+(_0x518edd[_0x8786('0x90')][_0x8786('0x92')]||'')};if(_0x375f6f[_0x8786('0x61')][_0x8786('0x93')]&&_0x375f6f[_0x8786('0x61')][_0x8786('0x97')]&&_0x375f6f[_0x8786('0x61')]['threadId']!=_0x375f6f[_0x8786('0x61')][_0x8786('0x97')]){_0x50c230[_0x8786('0x93')]=_0x375f6f[_0x8786('0x61')][_0x8786('0x97')];}return _0xa9b6e2[_0x8786('0x68')](_0x50c230);}else{return _0xa9b6e2;}}})[_0x8786('0x21')](function(_0x5f7aa1){_0x518edd['interaction']=_0x5f7aa1[_0x8786('0x38')]({'plain':!![]});_0x518edd[_0x8786('0x98')][_0x8786('0x99')]=_0x169a43;if(_0x518edd['interaction']['created']){if(_0x518edd['account'][_0x8786('0x9a')]){_0x518edd[_0x8786('0x8b')][_0x8786('0x9b')]({'id':0x0,'priority':_0x518edd['applications']['length']+0x1,'app':_0x8786('0x9c'),'appdata':_0x8786('0x9d'),'interval':_0x8786('0x9e')});}}return db[_0x8786('0x9f')][_0x8786('0x60')]({'body':_0x375f6f[_0x8786('0x61')][_0x8786('0x61')],'OpenchannelAccountId':_0x375f6f['params']['id'],'OpenchannelInteractionId':_0x5f7aa1['id'],'direction':'in','ContactId':_0x518edd[_0x8786('0x90')]['id'],'AttachmentId':_0x375f6f[_0x8786('0x61')][_0x8786('0xa0')]});})['then'](function(_0x1ade2f){_0x518edd[_0x8786('0x2a')]=_0x1ade2f;if(_0x518edd[_0x8786('0x98')][_0x8786('0xa1')]){return db[_0x8786('0xa2')]['find']({'attributes':['id',_0x8786('0x3d')],'where':{'id':_0x518edd['interaction'][_0x8786('0xa1')]}})[_0x8786('0x21')](function(_0x88084b){if(_0x88084b){_0x518edd[_0x8786('0x8b')]['unshift']({'id':0x0,'priority':0x0,'app':_0x8786('0xa3'),'appdata':_0x88084b['name']+','+(_0x518edd['account'][_0x8786('0xa4')]||0xa),'interval':'*,*,*,*'});_0x518edd[_0x8786('0xa5')]=![];}return respondWithRpcPromise(_0x8786('0xa6'),_0x8786('0xa7'),_0x518edd);});}return respondWithRpcPromise('Start',_0x8786('0xa7'),_0x518edd);})[_0x8786('0x21')](function(_0x2ed333){respondWithRpcPromise(_0x8786('0xa8'),_0x8786('0xa8'),{'event':_0x8786('0x74'),'message':_0x2ed333},client9002);return _0x2ed333;})[_0x8786('0x21')](respondWithResult(_0x5eefbf,null))[_0x8786('0x2c')](handleError(_0x5eefbf,null));};exports[_0x8786('0xa9')]=function(_0x3a7406,_0x14b0c3){var _0x65ee24=_0x3a7406[_0x8786('0x5c')]['id'];var _0x3e95c7=_0x3a7406[_0x8786('0x61')];var _0x1044eb=0xc8;var _0x20fcec=null;return db[_0x8786('0xaa')][_0x8786('0xab')]({'isolationLevel':db[_0x8786('0xaa')][_0x8786('0xac')][_0x8786('0xad')][_0x8786('0xae')]},function(_0x1929b8){return db['OpenchannelAccount'][_0x8786('0x6e')]({'where':{'id':_0x65ee24},'transaction':_0x1929b8})['then'](function(_0x4c1fcf){if(_0x4c1fcf){return db[_0x8786('0x88')][_0x8786('0x3b')]({'where':{'OpenchannelAccountId':_0x65ee24},'transaction':_0x1929b8})[_0x8786('0x21')](function(){var _0x1c6faf=_['map'](_0x3e95c7,function(_0x4bb02e){_0x4bb02e[_0x8786('0x6b')]=_0x65ee24;return _0x4bb02e;});return db[_0x8786('0x88')][_0x8786('0xaf')](_0x1c6faf,{'transaction':_0x1929b8});});}else{_0x1044eb=0x194;_0x20fcec=[];}});})[_0x8786('0x21')](function(){if(_0x1044eb!==0x194){return db[_0x8786('0x88')][_0x8786('0xb0')]({'where':{'OpenchannelAccountId':_0x65ee24},'order':_0x8786('0x8d')})[_0x8786('0x21')](function(_0x501b2e){_0x20fcec=_0x501b2e;});}})[_0x8786('0x2c')](function(_0x5d4e7a){_0x1044eb=0x1f4;logger[_0x8786('0x28')](_0x5d4e7a[_0x8786('0x3c')]);if(_0x5d4e7a[_0x8786('0x3d')]){delete _0x5d4e7a[_0x8786('0x3d')];}_0x20fcec=_0x5d4e7a;})[_0x8786('0xb1')](function(){if(_0x20fcec===null){_0x14b0c3[_0x8786('0x2d')](_0x1044eb);}else{if(_0x1044eb===0x1f4){_0x14b0c3[_0x8786('0x2e')](_0x1044eb)[_0x8786('0x3e')](_0x20fcec);}else{_0x14b0c3['status'](_0x1044eb)[_0x8786('0x30')](_0x20fcec);}}});};exports[_0x8786('0xb2')]=function(_0x3810ec,_0x5dd3e0,_0xc920aa){var _0x3956b3={};var _0x46e67a={};var _0x3f1248;var _0x137fac;return db[_0x8786('0x43')][_0x8786('0x6e')]({'where':{'id':_0x3810ec[_0x8786('0x5c')]['id']}})[_0x8786('0x21')](handleEntityNotFound(_0x5dd3e0,null))[_0x8786('0x21')](function(_0x1cb744){if(_0x1cb744){_0x3f1248=_0x1cb744;_0x46e67a[_0x8786('0x47')]=_[_0x8786('0x49')](db[_0x8786('0x88')][_0x8786('0x44')]);_0x46e67a[_0x8786('0x48')]=_[_0x8786('0x49')](_0x3810ec['query']);_0x46e67a[_0x8786('0x4a')]=_[_0x8786('0x4b')](_0x46e67a['model'],_0x46e67a[_0x8786('0x48')]);_0x3956b3[_0x8786('0x4c')]=_[_0x8786('0x4b')](_0x46e67a[_0x8786('0x47')],qs[_0x8786('0x4d')](_0x3810ec['query']['fields']));_0x3956b3[_0x8786('0x4c')]=_0x3956b3[_0x8786('0x4c')][_0x8786('0x5d')]?_0x3956b3['attributes']:_0x46e67a[_0x8786('0x47')];_0x3956b3['order']=qs[_0x8786('0x52')](_0x3810ec[_0x8786('0x48')][_0x8786('0x52')]);_0x3956b3[_0x8786('0x55')]=qs['filters'](_['pick'](_0x3810ec[_0x8786('0x48')],_0x46e67a['filters']));if(_0x3810ec['query'][_0x8786('0x54')]){_0x3956b3['where']=_[_0x8786('0x57')](_0x3956b3[_0x8786('0x55')],{'$or':_[_0x8786('0x42')](_0x3956b3[_0x8786('0x4c')],function(_0x506df4){var _0x32c3cf={};_0x32c3cf[_0x506df4]={'$like':'%'+_0x3810ec[_0x8786('0x48')][_0x8786('0x54')]+'%'};return _0x32c3cf;})});}_0x3956b3=_[_0x8786('0x57')]({},_0x3956b3,_0x3810ec[_0x8786('0x58')]);return _0x3f1248[_0x8786('0xb2')](_0x3956b3);}})[_0x8786('0x21')](function(_0x5e09b7){if(_0x5e09b7){_0x137fac=_0x5e09b7['length'];if(!_0x3810ec[_0x8786('0x48')]['hasOwnProperty'](_0x8786('0x4f'))){_0x3956b3['limit']=qs[_0x8786('0x50')](_0x3810ec['query'][_0x8786('0x50')]);_0x3956b3['offset']=qs[_0x8786('0x33')](_0x3810ec[_0x8786('0x48')][_0x8786('0x33')]);}return _0x3f1248[_0x8786('0xb2')](_0x3956b3);}})[_0x8786('0x21')](function(_0x39b8a2){if(_0x39b8a2){return _0x39b8a2?{'count':_0x137fac,'rows':_0x39b8a2}:null;}})[_0x8786('0x21')](respondWithResult(_0x5dd3e0,null))[_0x8786('0x2c')](handleError(_0x5dd3e0,null));};exports[_0x8786('0xb3')]=function(_0x151739,_0x193b39,_0x4c7861){var _0x1ad3ea={'raw':![],'where':{}};var _0x232433={};var _0xd65f29={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x151739['params']['id']}})[_0x8786('0x21')](handleEntityNotFound(_0x193b39,null))[_0x8786('0x21')](function(_0x4322f2){if(_0x4322f2){_0x232433[_0x8786('0x47')]=_[_0x8786('0x49')](db[_0x8786('0x94')][_0x8786('0x44')]);_0x232433[_0x8786('0x48')]=_[_0x8786('0x49')](_0x151739['query']);_0x232433[_0x8786('0x4a')]=_[_0x8786('0x4b')](_0x232433[_0x8786('0x47')],_0x232433[_0x8786('0x48')]);_0x1ad3ea['attributes']=_['intersection'](_0x232433['model'],qs[_0x8786('0x4d')](_0x151739[_0x8786('0x48')][_0x8786('0x4d')]));_0x1ad3ea['attributes']=_0x1ad3ea[_0x8786('0x4c')][_0x8786('0x5d')]?_0x1ad3ea[_0x8786('0x4c')]:_0x232433[_0x8786('0x47')];if(!_0x151739[_0x8786('0x48')][_0x8786('0x4e')](_0x8786('0x4f'))){_0x1ad3ea[_0x8786('0x50')]=qs[_0x8786('0x50')](_0x151739[_0x8786('0x48')][_0x8786('0x50')]);_0x1ad3ea['offset']=qs[_0x8786('0x33')](_0x151739['query'][_0x8786('0x33')]);}_0x1ad3ea[_0x8786('0x51')]=qs[_0x8786('0x52')](_0x151739[_0x8786('0x48')]['sort']);_0x1ad3ea['where']=qs[_0x8786('0x4a')](_[_0x8786('0x53')](_0x151739[_0x8786('0x48')],_0x232433['filters']));_0x1ad3ea[_0x8786('0x55')]['OpenchannelAccountId']=_0x4322f2['id'];if(_0x151739[_0x8786('0x48')][_0x8786('0x54')]){_0x1ad3ea[_0x8786('0x55')]=_['merge'](_0x1ad3ea[_0x8786('0x55')],{'$or':_[_0x8786('0x42')](_0x1ad3ea[_0x8786('0x4c')],function(_0x26ade1){var _0x5912ce={};_0x5912ce[_0x26ade1]={'$like':'%'+_0x151739[_0x8786('0x48')][_0x8786('0x54')]+'%'};return _0x5912ce;})});}_0x1ad3ea=_['merge']({},_0x1ad3ea,_0x151739[_0x8786('0x58')]);return db['OpenchannelInteraction'][_0x8786('0x32')]({'where':_0x1ad3ea[_0x8786('0x55')]})[_0x8786('0x21')](function(_0x3eb1ed){_0xd65f29['count']=_0x3eb1ed;if(_0x151739[_0x8786('0x48')]['includeAll']){_0x1ad3ea[_0x8786('0x59')]=[{'model':db['CmContact'],'as':_0x8786('0xb4'),'required':![]},{'model':db['User'],'as':_0x8786('0xb5'),'attributes':[_0x8786('0x3d'),_0x8786('0xb6'),_0x8786('0xb7')],'required':![]},{'model':db[_0x8786('0xb8')],'as':_0x8786('0xb9'),'attributes':['id',_0x8786('0x3d'),_0x8786('0xba')],'where':_0x151739['query'][_0x8786('0xbb')]?{'id':_0x151739[_0x8786('0x48')][_0x8786('0xbb')]}:undefined,'required':_0x151739[_0x8786('0x48')]['tag']?!![]:![]}];}return db['OpenchannelInteraction']['findAll'](_0x1ad3ea);})[_0x8786('0x21')](function(_0x58e557){_0xd65f29[_0x8786('0x5a')]=_0x58e557;return _0xd65f29;});}})[_0x8786('0x21')](respondWithFilteredResult(_0x193b39,_0x1ad3ea))[_0x8786('0x2c')](handleError(_0x193b39,null));};exports[_0x8786('0xbc')]=function(_0x31a3da,_0x4120e3,_0x4775ba){return db[_0x8786('0x43')][_0x8786('0x5f')]({'where':{'id':_0x31a3da[_0x8786('0x5c')]['id']}})[_0x8786('0x21')](handleEntityNotFound(_0x4120e3,null))[_0x8786('0x21')](function(_0x4b70e9){if(_0x4b70e9){return _0x4b70e9[_0x8786('0xbc')](_0x31a3da[_0x8786('0x61')][_0x8786('0xbd')],_[_0x8786('0xbe')](_0x31a3da[_0x8786('0x61')],[_0x8786('0xbd'),'id'])||{})[_0x8786('0x96')](function(_0x5909eb){for(var _0x208f81=0x0;_0x208f81<_0x31a3da[_0x8786('0x61')]['ids']['length'];_0x208f81+=0x1){socket[_0x8786('0xbf')]('userOpenchannelAccount:save',{'UserId':Number(_0x31a3da[_0x8786('0x61')][_0x8786('0xbd')][_0x208f81]),'OpenchannelAccountId':Number(_0x31a3da[_0x8786('0x5c')]['id'])});}return _0x5909eb;});}})['then'](respondWithResult(_0x4120e3,null))['catch'](handleError(_0x4120e3,null));};exports['removeAgents']=function(_0x158172,_0x9d34b5,_0x33fbcb){return db[_0x8786('0x43')][_0x8786('0x5f')]({'where':{'id':_0x158172['params']['id']}})[_0x8786('0x21')](handleEntityNotFound(_0x9d34b5,null))[_0x8786('0x21')](function(_0x4dc060){if(_0x4dc060){return _0x4dc060['removeAgents'](_0x158172[_0x8786('0x48')][_0x8786('0xbd')])[_0x8786('0x21')](function(){if(_[_0x8786('0xc0')](_0x158172[_0x8786('0x48')]['ids'])){for(var _0x4e45e3=0x0;_0x4e45e3<_0x158172[_0x8786('0x48')][_0x8786('0xbd')][_0x8786('0x5d')];_0x4e45e3+=0x1){socket['emit'](_0x8786('0xc1'),{'UserId':Number(_0x158172['query']['ids'][_0x4e45e3]),'OpenchannelAccountId':Number(_0x158172['params']['id'])});}}else{socket[_0x8786('0xbf')](_0x8786('0xc1'),{'UserId':Number(_0x158172[_0x8786('0x48')]['ids']),'OpenchannelAccountId':Number(_0x158172[_0x8786('0x5c')]['id'])});}});}})[_0x8786('0x21')](respondWithStatusCode(_0x9d34b5,null))['catch'](handleError(_0x9d34b5,null));};exports[_0x8786('0xc2')]=function(_0x5e4d4f,_0x2a17cf,_0x50b07c){var _0x9225fa={};var _0x15df2c={};var _0x327fff;var _0x4c8184;return db[_0x8786('0x43')][_0x8786('0x6e')]({'where':{'id':_0x5e4d4f[_0x8786('0x5c')]['id']}})[_0x8786('0x21')](handleEntityNotFound(_0x2a17cf,null))[_0x8786('0x21')](function(_0x30d9f){if(_0x30d9f){_0x327fff=_0x30d9f;_0x15df2c[_0x8786('0x47')]=_[_0x8786('0x49')](db[_0x8786('0xa2')][_0x8786('0x44')]);_0x15df2c[_0x8786('0x48')]=_[_0x8786('0x49')](_0x5e4d4f[_0x8786('0x48')]);_0x15df2c['filters']=_[_0x8786('0x4b')](_0x15df2c[_0x8786('0x47')],_0x15df2c[_0x8786('0x48')]);_0x9225fa['attributes']=_['intersection'](_0x15df2c['model'],qs[_0x8786('0x4d')](_0x5e4d4f[_0x8786('0x48')][_0x8786('0x4d')]));_0x9225fa['attributes']=_0x9225fa[_0x8786('0x4c')]['length']?_0x9225fa[_0x8786('0x4c')]:_0x15df2c[_0x8786('0x47')];_0x9225fa[_0x8786('0x51')]=qs[_0x8786('0x52')](_0x5e4d4f[_0x8786('0x48')]['sort']);_0x9225fa['where']=qs[_0x8786('0x4a')](_[_0x8786('0x53')](_0x5e4d4f[_0x8786('0x48')],_0x15df2c[_0x8786('0x4a')]));if(_0x5e4d4f[_0x8786('0x48')][_0x8786('0x54')]){_0x9225fa[_0x8786('0x55')]=_[_0x8786('0x57')](_0x9225fa[_0x8786('0x55')],{'$or':_[_0x8786('0x42')](_0x9225fa[_0x8786('0x4c')],function(_0x37fb1f){var _0x349804={};_0x349804[_0x37fb1f]={'$like':'%'+_0x5e4d4f['query'][_0x8786('0x54')]+'%'};return _0x349804;})});}_0x9225fa=_[_0x8786('0x57')]({},_0x9225fa,_0x5e4d4f[_0x8786('0x58')]);return _0x327fff[_0x8786('0xc2')](_0x9225fa);}})[_0x8786('0x21')](function(_0x5c114f){if(_0x5c114f){_0x4c8184=_0x5c114f[_0x8786('0x5d')];if(!_0x5e4d4f['query']['hasOwnProperty'](_0x8786('0x4f'))){_0x9225fa[_0x8786('0x50')]=qs[_0x8786('0x50')](_0x5e4d4f[_0x8786('0x48')][_0x8786('0x50')]);_0x9225fa[_0x8786('0x33')]=qs[_0x8786('0x33')](_0x5e4d4f[_0x8786('0x48')][_0x8786('0x33')]);}return _0x327fff[_0x8786('0xc2')](_0x9225fa);}})[_0x8786('0x21')](function(_0x522ecd){if(_0x522ecd){return _0x522ecd?{'count':_0x4c8184,'rows':_0x522ecd}:null;}})['then'](respondWithResult(_0x2a17cf,null))['catch'](handleError(_0x2a17cf,null));};exports[_0x8786('0x3e')]=function(_0x9097c9,_0x185f08,_0x53f17b){var _0x3612df,_0x175a2c,_0x40ad32;if(_[_0x8786('0x7e')](_0x9097c9[_0x8786('0x61')][_0x8786('0x61')])||_0x9097c9[_0x8786('0x61')][_0x8786('0x61')]===''){throw new db[(_0x8786('0x76'))][(_0x8786('0x77'))](_0x8786('0x80'));}if(_[_0x8786('0x7e')](_0x9097c9[_0x8786('0x61')]['to'])){}_0x3612df=_0x9097c9[_0x8786('0x61')]['to'];return db[_0x8786('0x43')]['findOne']({'where':{'id':_0x9097c9[_0x8786('0x5c')]['id']}})['then'](handleEntityNotFound(_0x185f08,null))[_0x8786('0x21')](function(_0x9433a2){if(_0x9433a2){return db[_0x8786('0x43')][_0x8786('0x5f')]({'where':{'id':_0x9433a2['id']},'include':[{'model':db[_0x8786('0x85')],'as':_0x8786('0x89'),'include':[{'model':db['CmContact'],'as':_0x8786('0x86'),'where':{[_0x9433a2[_0x8786('0x81')]]:_0x3612df},'limit':0x1,'order':[[_0x8786('0x7b'),_0x8786('0x87')]]}]}]})['then'](handleEntityNotFound(_0x185f08,null))[_0x8786('0x21')](function(_0x27864c){if(_0x27864c&&_0x27864c['List']){_0x175a2c=_0x27864c[_0x8786('0x38')]({'plain':!![]});if(_0x175a2c[_0x8786('0x89')]&&_0x175a2c['List'][_0x8786('0x86')][_0x8786('0x5d')]){return _0x175a2c[_0x8786('0x89')]['Contacts'][0x0];}return db['CmContact']['create'](_[_0x8786('0x1a')](_0x9097c9[_0x8786('0x61')],{'firstName':_0x3612df,[_0x27864c[_0x8786('0x81')]]:_0x3612df,'phone':_0x3612df,'ListId':_0x175a2c[_0x8786('0x7d')]}));}})['then'](handleEntityNotFound(_0x185f08,null))[_0x8786('0x21')](function(_0x18b1d8){if(_0x18b1d8){_0x40ad32=_0x18b1d8;return db[_0x8786('0x94')][_0x8786('0x5f')]({'where':{'ContactId':_0x40ad32['id'],'closed':![],'OpenchannelAccountId':_0x175a2c['id']}})[_0x8786('0x21')](function(_0xca271b){if(_0xca271b){return[_0xca271b,![]];}return db[_0x8786('0x94')][_0x8786('0x60')]({'UserId':_0x9097c9[_0x8786('0x62')]['id'],'ContactId':_0x40ad32['id'],'OpenchannelAccountId':_0x175a2c['id'],'lastMsgDirection':_0x8786('0xc3'),'firstMsgDirection':_0x8786('0xc3'),'Messages':[_[_0x8786('0x57')](_0x9097c9['body'],{'read':![],'body':_0x9097c9[_0x8786('0x61')][_0x8786('0x61')],'OpenchannelAccountId':_0x175a2c['id'],'UserId':_0x9097c9[_0x8786('0x62')]['id'],'ContactId':_0x40ad32['id']})]},{'include':[{'model':db[_0x8786('0x9f')],'as':_0x8786('0xc4')}]})[_0x8786('0x21')](function(_0xd5ee4c){return[_0xd5ee4c,!![]];});});}})['spread'](function(_0x301d82,_0x33deda){if(_0x33deda){return _0x301d82;}return db[_0x8786('0x9f')][_0x8786('0x60')](_[_0x8786('0x57')](_0x9097c9['body'],{'read':![],'body':_0x9097c9[_0x8786('0x61')][_0x8786('0x61')],'OpenchannelAccountId':_0x175a2c['id'],'OpenchannelInteractionId':_0x301d82['id'],'UserId':_0x9097c9['user']['id'],'ContactId':_0x40ad32['id']}))['then'](function(_0x3b11c0){_0x301d82['dataValues'][_0x8786('0xc4')]=[];_0x301d82[_0x8786('0xc5')]['Messages'][_0x8786('0x9b')](_0x3b11c0[_0x8786('0xc5')]);return _0x301d82;});});}})[_0x8786('0x21')](respondWithResult(_0x185f08,null))[_0x8786('0x2c')](handleError(_0x185f08,null));}; \ No newline at end of file +var _0xb258=['UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','hasOwnProperty','order','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','notify','openchannel','CmContact','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','asc','Contacts','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','messageId','interaction','created','autoclose','push','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','priority','finally','getApplications','getInteractions','Contact','User','Owner','fullname','internal','Tag','color','tag','addAgents','omit','spread','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','get','OpenchannelAccounts','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','fieldName','type','query','keys','intersection','model','fields','attributes','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','length','create','body','user','role'];(function(_0x5bd0eb,_0x186079){var _0x5b3fc9=function(_0x3255ec){while(--_0x3255ec){_0x5bd0eb['push'](_0x5bd0eb['shift']());}};_0x5b3fc9(++_0x186079);}(_0xb258,0x12b));var _0x8b25=function(_0x4f2bc0,_0x1a63dc){_0x4f2bc0=_0x4f2bc0-0x0;var _0x1c7559=_0xb258[_0x4f2bc0];return _0x1c7559;};'use strict';var emlformat=require(_0x8b25('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8b25('0x1'));var jsonpatch=require(_0x8b25('0x2'));var rp=require('request-promise');var moment=require(_0x8b25('0x3'));var BPromise=require(_0x8b25('0x4'));var Mustache=require(_0x8b25('0x5'));var util=require(_0x8b25('0x6'));var path=require(_0x8b25('0x7'));var sox=require(_0x8b25('0x8'));var csv=require('to-csv');var ejs=require(_0x8b25('0x9'));var fs=require('fs');var fs_extra=require(_0x8b25('0xa'));var _=require(_0x8b25('0xb'));var squel=require(_0x8b25('0xc'));var crypto=require('crypto');var jsforce=require(_0x8b25('0xd'));var deskjs=require(_0x8b25('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8b25('0xf'));var Papa=require(_0x8b25('0x10'));var Redis=require(_0x8b25('0x11'));var authService=require(_0x8b25('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8b25('0x13'));var hardwareService=require(_0x8b25('0x14'));var logger=require(_0x8b25('0x15'))(_0x8b25('0x16'));var utils=require('../../config/utils');var config=require(_0x8b25('0x17'));var licenseUtil=require(_0x8b25('0x18'));var db=require(_0x8b25('0x19'))['db'];config['redis']=_[_0x8b25('0x1a')](config[_0x8b25('0x1b')],{'host':_0x8b25('0x1c'),'port':0x18eb});var socket=require(_0x8b25('0x1d'))(new Redis(config['redis']));require(_0x8b25('0x1e'))['register'](socket);var jayson=require(_0x8b25('0x1f'));var client=jayson[_0x8b25('0x20')][_0x8b25('0x21')]({'port':0x232c});var client9002=jayson[_0x8b25('0x20')][_0x8b25('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x44387a,_0x377870,_0x42fe6a,_0x184db6){return new BPromise(function(_0xd30465,_0x1b04f6){var _0x1aa09b=_0x184db6||client;return _0x1aa09b[_0x8b25('0x22')](_0x44387a,_0x42fe6a)[_0x8b25('0x23')](function(_0x56dcf0){logger[_0x8b25('0x24')](_0x8b25('0x25'),_0x377870,_0x8b25('0x26'));logger[_0x8b25('0x27')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x377870,'request\x20sent',JSON['stringify'](_0x56dcf0));if(_0x56dcf0[_0x8b25('0x28')]){if(_0x56dcf0['error'][_0x8b25('0x29')]===0x1f4){logger[_0x8b25('0x28')](_0x8b25('0x25'),_0x377870,_0x56dcf0[_0x8b25('0x28')][_0x8b25('0x2a')]);return _0x1b04f6(_0x56dcf0[_0x8b25('0x28')]['message']);}logger[_0x8b25('0x28')](_0x8b25('0x25'),_0x377870,_0x56dcf0[_0x8b25('0x28')][_0x8b25('0x2a')]);return _0xd30465(_0x56dcf0[_0x8b25('0x28')][_0x8b25('0x2a')]);}else{logger[_0x8b25('0x24')](_0x8b25('0x25'),_0x377870,'request\x20sent');_0xd30465(_0x56dcf0[_0x8b25('0x2b')][_0x8b25('0x2a')]);}})[_0x8b25('0x2c')](function(_0x3924ef){logger[_0x8b25('0x28')](_0x8b25('0x25'),_0x377870,_0x3924ef);_0x1b04f6(_0x3924ef);});});}function respondWithStatusCode(_0x368c8f,_0xcfa647){_0xcfa647=_0xcfa647||0xcc;return function(_0x319f87){if(_0x319f87){return _0x368c8f[_0x8b25('0x2d')](_0xcfa647);}return _0x368c8f[_0x8b25('0x2e')](_0xcfa647)[_0x8b25('0x2f')]();};}function respondWithResult(_0x4b4afe,_0xb9f98e){_0xb9f98e=_0xb9f98e||0xc8;return function(_0x2b511c){if(_0x2b511c){return _0x4b4afe[_0x8b25('0x2e')](_0xb9f98e)[_0x8b25('0x30')](_0x2b511c);}};}function respondWithFilteredResult(_0x32b048,_0x35c573){return function(_0x3c53a8){if(_0x3c53a8){var _0x2f4a66=typeof _0x35c573['offset']===_0x8b25('0x31')&&typeof _0x35c573['limit']===_0x8b25('0x31');var _0x37b035=_0x3c53a8[_0x8b25('0x32')];var _0x6651d7=_0x2f4a66?0x0:_0x35c573[_0x8b25('0x33')];var _0x5dc1ce=_0x2f4a66?_0x3c53a8['count']:_0x35c573[_0x8b25('0x33')]+_0x35c573[_0x8b25('0x34')];var _0x3d775d;if(_0x5dc1ce>=_0x37b035){_0x5dc1ce=_0x37b035;_0x3d775d=0xc8;}else{_0x3d775d=0xce;}_0x32b048[_0x8b25('0x2e')](_0x3d775d);return _0x32b048[_0x8b25('0x35')](_0x8b25('0x36'),_0x6651d7+'-'+_0x5dc1ce+'/'+_0x37b035)[_0x8b25('0x30')](_0x3c53a8);}return null;};}function patchUpdates(_0x3291ba){return function(_0x68e18b){try{jsonpatch[_0x8b25('0x37')](_0x68e18b,_0x3291ba,!![]);}catch(_0x5d74e5){return BPromise['reject'](_0x5d74e5);}return _0x68e18b[_0x8b25('0x38')]();};}function saveUpdates(_0x2867f8,_0x420a11){return function(_0x169e05){if(_0x169e05){return _0x169e05[_0x8b25('0x39')](_0x2867f8)[_0x8b25('0x23')](function(_0x308dc2){return _0x308dc2;});}return null;};}function removeEntity(_0x371aa7,_0x3d573d){return function(_0x36b2da){if(_0x36b2da){return _0x36b2da['destroy']()[_0x8b25('0x23')](function(){var _0x2e7446=_0x36b2da[_0x8b25('0x3a')]({'plain':!![]});var _0x14c695=_0x8b25('0x3b');return db[_0x8b25('0x3c')][_0x8b25('0x3d')]({'where':{'type':_0x14c695,'resourceId':_0x2e7446['id']}})[_0x8b25('0x23')](function(){return _0x36b2da;});})[_0x8b25('0x23')](function(){_0x371aa7[_0x8b25('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b071f,_0x490025){return function(_0x213ace){if(!_0x213ace){_0x2b071f['sendStatus'](0x194);}return _0x213ace;};}function handleError(_0x51b565,_0x29d017){_0x29d017=_0x29d017||0x1f4;return function(_0x2769e6){logger['error'](_0x2769e6[_0x8b25('0x3e')]);if(_0x2769e6[_0x8b25('0x3f')]){delete _0x2769e6['name'];}_0x51b565[_0x8b25('0x2e')](_0x29d017)[_0x8b25('0x40')](_0x2769e6);};}exports[_0x8b25('0x41')]=function(_0x168ca4,_0x3b5fd6){var _0x1a6dc0={'include':[{'model':db[_0x8b25('0x42')],'as':_0x8b25('0x43')}]},_0x40286c={},_0xbd7ea3={'count':0x0,'rows':[]};var _0x124e61=_[_0x8b25('0x44')](db[_0x8b25('0x45')]['rawAttributes'],function(_0x3c97ae){return{'name':_0x3c97ae[_0x8b25('0x46')],'type':_0x3c97ae[_0x8b25('0x47')]['key']};});_0x40286c['model']=_[_0x8b25('0x44')](_0x124e61,_0x8b25('0x3f'));_0x40286c[_0x8b25('0x48')]=_[_0x8b25('0x49')](_0x168ca4['query']);_0x40286c['filters']=_[_0x8b25('0x4a')](_0x40286c[_0x8b25('0x4b')],_0x40286c[_0x8b25('0x48')]);_0x1a6dc0['attributes']=_[_0x8b25('0x4a')](_0x40286c[_0x8b25('0x4b')],qs[_0x8b25('0x4c')](_0x168ca4[_0x8b25('0x48')][_0x8b25('0x4c')]));_0x1a6dc0['attributes']=_0x1a6dc0[_0x8b25('0x4d')]['length']?_0x1a6dc0[_0x8b25('0x4d')]:_0x40286c[_0x8b25('0x4b')];if(!_0x168ca4[_0x8b25('0x48')]['hasOwnProperty'](_0x8b25('0x4e'))){_0x1a6dc0[_0x8b25('0x34')]=qs['limit'](_0x168ca4['query']['limit']);_0x1a6dc0[_0x8b25('0x33')]=qs[_0x8b25('0x33')](_0x168ca4[_0x8b25('0x48')][_0x8b25('0x33')]);}_0x1a6dc0['order']=qs[_0x8b25('0x4f')](_0x168ca4[_0x8b25('0x48')][_0x8b25('0x4f')]);_0x1a6dc0[_0x8b25('0x50')]=qs['filters'](_[_0x8b25('0x51')](_0x168ca4[_0x8b25('0x48')],_0x40286c[_0x8b25('0x52')]),_0x124e61);if(_0x168ca4[_0x8b25('0x48')][_0x8b25('0x53')]){_0x1a6dc0['where']=_[_0x8b25('0x54')](_0x1a6dc0[_0x8b25('0x50')],{'$or':_['map'](_0x124e61,function(_0x83354f){if(_0x83354f[_0x8b25('0x47')]!==_0x8b25('0x55')){var _0x234854={};_0x234854[_0x83354f[_0x8b25('0x3f')]]={'$like':'%'+_0x168ca4[_0x8b25('0x48')][_0x8b25('0x53')]+'%'};return _0x234854;}})});}_0x1a6dc0=_[_0x8b25('0x54')]({},_0x1a6dc0,_0x168ca4[_0x8b25('0x56')]);var _0x44b205={'where':_0x1a6dc0[_0x8b25('0x50')]};return db[_0x8b25('0x45')]['count'](_0x44b205)[_0x8b25('0x23')](function(_0x1a0966){_0xbd7ea3[_0x8b25('0x32')]=_0x1a0966;if(_0x168ca4[_0x8b25('0x48')][_0x8b25('0x57')]){_0x1a6dc0[_0x8b25('0x58')]=[{'all':!![]}];}return db[_0x8b25('0x45')][_0x8b25('0x59')](_0x1a6dc0);})[_0x8b25('0x23')](function(_0x1d842d){_0xbd7ea3[_0x8b25('0x5a')]=_0x1d842d;return _0xbd7ea3;})[_0x8b25('0x23')](respondWithFilteredResult(_0x3b5fd6,_0x1a6dc0))['catch'](handleError(_0x3b5fd6,null));};exports[_0x8b25('0x5b')]=function(_0x5ab92a,_0x5452d2){var _0x465be5={'raw':![],'where':{'id':_0x5ab92a[_0x8b25('0x5c')]['id']},'include':[{'model':db[_0x8b25('0x42')],'as':_0x8b25('0x43')}]},_0x17e306={};_0x17e306[_0x8b25('0x4b')]=_['keys'](db['OpenchannelAccount'][_0x8b25('0x5d')]);_0x17e306[_0x8b25('0x48')]=_[_0x8b25('0x49')](_0x5ab92a[_0x8b25('0x48')]);_0x17e306[_0x8b25('0x52')]=_[_0x8b25('0x4a')](_0x17e306[_0x8b25('0x4b')],_0x17e306[_0x8b25('0x48')]);_0x465be5['attributes']=_[_0x8b25('0x4a')](_0x17e306[_0x8b25('0x4b')],qs[_0x8b25('0x4c')](_0x5ab92a[_0x8b25('0x48')][_0x8b25('0x4c')]));_0x465be5[_0x8b25('0x4d')]=_0x465be5[_0x8b25('0x4d')][_0x8b25('0x5e')]?_0x465be5[_0x8b25('0x4d')]:_0x17e306[_0x8b25('0x4b')];if(_0x5ab92a[_0x8b25('0x48')][_0x8b25('0x57')]){_0x465be5[_0x8b25('0x58')]=[{'all':!![]}];}_0x465be5=_[_0x8b25('0x54')]({},_0x465be5,_0x5ab92a[_0x8b25('0x56')]);return db['OpenchannelAccount']['find'](_0x465be5)['then'](handleEntityNotFound(_0x5452d2,null))['then'](respondWithResult(_0x5452d2,null))[_0x8b25('0x2c')](handleError(_0x5452d2,null));};exports[_0x8b25('0x5f')]=function(_0x55cf30,_0x297e2b){return db[_0x8b25('0x45')][_0x8b25('0x5f')](_0x55cf30[_0x8b25('0x60')],{})[_0x8b25('0x23')](function(_0x13a1cf){var _0x12eec0=_0x55cf30[_0x8b25('0x61')][_0x8b25('0x3a')]({'plain':!![]});if(!_0x12eec0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x12eec0[_0x8b25('0x62')]===_0x8b25('0x61')){var _0x284896=_0x13a1cf['get']({'plain':!![]});var _0x214101=_0x8b25('0x3b');return db[_0x8b25('0x63')][_0x8b25('0x64')]({'where':{'name':_0x214101,'userProfileId':_0x12eec0['userProfileId']},'raw':!![]})['then'](function(_0x5bc586){if(_0x5bc586&&_0x5bc586['autoAssociation']===0x0){return db[_0x8b25('0x3c')][_0x8b25('0x5f')]({'name':_0x284896[_0x8b25('0x3f')],'resourceId':_0x284896['id'],'type':_0x5bc586[_0x8b25('0x3f')],'sectionId':_0x5bc586['id']},{})[_0x8b25('0x23')](function(){return _0x13a1cf;});}else{return _0x13a1cf;}})[_0x8b25('0x2c')](function(_0x51722c){logger['error'](_0x8b25('0x65'),_0x51722c);throw _0x51722c;});}return _0x13a1cf;})[_0x8b25('0x23')](respondWithResult(_0x297e2b,0xc9))['catch'](handleError(_0x297e2b,null));};exports[_0x8b25('0x39')]=function(_0x5d304e,_0x166684){if(_0x5d304e['body']['id']){delete _0x5d304e['body']['id'];}return db['OpenchannelAccount'][_0x8b25('0x64')]({'where':{'id':_0x5d304e['params']['id']},'include':[{'model':db[_0x8b25('0x42')],'as':_0x8b25('0x43')}]})[_0x8b25('0x23')](handleEntityNotFound(_0x166684,null))[_0x8b25('0x23')](saveUpdates(_0x5d304e['body'],null))[_0x8b25('0x23')](respondWithResult(_0x166684,null))[_0x8b25('0x2c')](handleError(_0x166684,null));};exports['destroy']=function(_0x21d8c9,_0x124bf9){return db[_0x8b25('0x45')][_0x8b25('0x64')]({'where':{'id':_0x21d8c9['params']['id']}})[_0x8b25('0x23')](handleEntityNotFound(_0x124bf9,null))[_0x8b25('0x23')](removeEntity(_0x124bf9,null))[_0x8b25('0x2c')](handleError(_0x124bf9,null));};exports['describe']=function(_0x3d942f,_0x26a331){return db[_0x8b25('0x45')][_0x8b25('0x66')]()['then'](respondWithResult(_0x26a331,null))[_0x8b25('0x2c')](handleError(_0x26a331,null));};exports[_0x8b25('0x67')]=function(_0x444b7b,_0x291c82,_0x20be53){if(_0x444b7b[_0x8b25('0x60')]['id']){delete _0x444b7b[_0x8b25('0x60')]['id'];}return db[_0x8b25('0x45')][_0x8b25('0x64')]({'where':{'id':_0x444b7b[_0x8b25('0x5c')]['id']}})[_0x8b25('0x23')](handleEntityNotFound(_0x291c82,null))['then'](function(_0x241643){if(_0x241643){_0x444b7b[_0x8b25('0x60')][_0x8b25('0x68')]=_0x241643['id'];return db[_0x8b25('0x69')]['create'](_0x444b7b[_0x8b25('0x60')]);}})[_0x8b25('0x23')](respondWithResult(_0x291c82,null))[_0x8b25('0x2c')](handleError(_0x291c82,null));};exports[_0x8b25('0x6a')]=function(_0x2b93d5,_0x3313ca,_0x3a338a){var _0x2ff201={'raw':![],'where':{}};var _0x39a246={};var _0x598f5d={'count':0x0,'rows':[]};return db[_0x8b25('0x45')]['findOne']({'where':{'id':_0x2b93d5[_0x8b25('0x5c')]['id']}})[_0x8b25('0x23')](handleEntityNotFound(_0x3313ca,null))['then'](function(_0x4ecbe0){if(_0x4ecbe0){_0x39a246[_0x8b25('0x4b')]=_[_0x8b25('0x49')](db['Disposition']['rawAttributes']);_0x39a246[_0x8b25('0x48')]=_[_0x8b25('0x49')](_0x2b93d5[_0x8b25('0x48')]);_0x39a246[_0x8b25('0x52')]=_[_0x8b25('0x4a')](_0x39a246[_0x8b25('0x4b')],_0x39a246[_0x8b25('0x48')]);_0x2ff201[_0x8b25('0x4d')]=_[_0x8b25('0x4a')](_0x39a246[_0x8b25('0x4b')],qs[_0x8b25('0x4c')](_0x2b93d5[_0x8b25('0x48')][_0x8b25('0x4c')]));_0x2ff201[_0x8b25('0x4d')]=_0x2ff201[_0x8b25('0x4d')][_0x8b25('0x5e')]?_0x2ff201[_0x8b25('0x4d')]:_0x39a246[_0x8b25('0x4b')];if(!_0x2b93d5[_0x8b25('0x48')][_0x8b25('0x6b')](_0x8b25('0x4e'))){_0x2ff201[_0x8b25('0x34')]=qs[_0x8b25('0x34')](_0x2b93d5[_0x8b25('0x48')]['limit']);_0x2ff201[_0x8b25('0x33')]=qs[_0x8b25('0x33')](_0x2b93d5['query'][_0x8b25('0x33')]);}_0x2ff201[_0x8b25('0x6c')]=qs['sort'](_0x2b93d5[_0x8b25('0x48')][_0x8b25('0x4f')]);_0x2ff201[_0x8b25('0x50')]=qs[_0x8b25('0x52')](_[_0x8b25('0x51')](_0x2b93d5['query'],_0x39a246[_0x8b25('0x52')]));_0x2ff201[_0x8b25('0x50')][_0x8b25('0x68')]=_0x4ecbe0['id'];if(_0x2b93d5[_0x8b25('0x48')][_0x8b25('0x53')]){_0x2ff201[_0x8b25('0x50')]=_[_0x8b25('0x54')](_0x2ff201[_0x8b25('0x50')],{'$or':_[_0x8b25('0x44')](_0x2ff201[_0x8b25('0x4d')],function(_0x5ce7fd){var _0xfd7fb2={};_0xfd7fb2[_0x5ce7fd]={'$like':'%'+_0x2b93d5[_0x8b25('0x48')][_0x8b25('0x53')]+'%'};return _0xfd7fb2;})});}_0x2ff201=_[_0x8b25('0x54')]({},_0x2ff201,_0x2b93d5[_0x8b25('0x56')]);return db[_0x8b25('0x69')]['count']({'where':_0x2ff201['where']})[_0x8b25('0x23')](function(_0x1a00c8){_0x598f5d[_0x8b25('0x32')]=_0x1a00c8;if(_0x2b93d5[_0x8b25('0x48')][_0x8b25('0x57')]){_0x2ff201[_0x8b25('0x58')]=[{'all':!![]}];}return db[_0x8b25('0x69')][_0x8b25('0x59')](_0x2ff201);})[_0x8b25('0x23')](function(_0x3753a5){_0x598f5d['rows']=_0x3753a5;return _0x598f5d;});}})[_0x8b25('0x23')](respondWithFilteredResult(_0x3313ca,_0x2ff201))[_0x8b25('0x2c')](handleError(_0x3313ca,null));};exports['removeDispositions']=function(_0x4f3d02,_0x89eebf,_0x512f4c){return db['OpenchannelAccount']['find']({'where':{'id':_0x4f3d02[_0x8b25('0x5c')]['id']}})['then'](handleEntityNotFound(_0x89eebf,null))[_0x8b25('0x23')](function(_0x254b15){if(_0x254b15){return _0x254b15[_0x8b25('0x6d')](_0x4f3d02[_0x8b25('0x48')][_0x8b25('0x6e')]);}})['then'](respondWithStatusCode(_0x89eebf,null))[_0x8b25('0x2c')](handleError(_0x89eebf,null));};exports[_0x8b25('0x6f')]=function(_0x27368f,_0x3a7db4,_0x427499){if(_0x27368f[_0x8b25('0x60')]['id']){delete _0x27368f[_0x8b25('0x60')]['id'];}return db['OpenchannelAccount'][_0x8b25('0x64')]({'where':{'id':_0x27368f['params']['id']}})['then'](handleEntityNotFound(_0x3a7db4,null))[_0x8b25('0x23')](function(_0x368671){if(_0x368671){_0x27368f['body'][_0x8b25('0x68')]=_0x368671['id'];return db[_0x8b25('0x70')][_0x8b25('0x5f')](_0x27368f[_0x8b25('0x60')]);}})[_0x8b25('0x23')](respondWithResult(_0x3a7db4,null))[_0x8b25('0x2c')](handleError(_0x3a7db4,null));};exports[_0x8b25('0x71')]=function(_0x2b0468,_0x561c3b,_0x2d6836){var _0x39b073={'raw':![],'where':{}};var _0x4c994d={};var _0x1e29dd={'count':0x0,'rows':[]};return db[_0x8b25('0x45')][_0x8b25('0x72')]({'where':{'id':_0x2b0468[_0x8b25('0x5c')]['id']}})['then'](handleEntityNotFound(_0x561c3b,null))[_0x8b25('0x23')](function(_0x19fa6a){if(_0x19fa6a){_0x4c994d[_0x8b25('0x4b')]=_[_0x8b25('0x49')](db[_0x8b25('0x70')][_0x8b25('0x5d')]);_0x4c994d['query']=_[_0x8b25('0x49')](_0x2b0468[_0x8b25('0x48')]);_0x4c994d[_0x8b25('0x52')]=_[_0x8b25('0x4a')](_0x4c994d[_0x8b25('0x4b')],_0x4c994d['query']);_0x39b073['attributes']=_[_0x8b25('0x4a')](_0x4c994d[_0x8b25('0x4b')],qs[_0x8b25('0x4c')](_0x2b0468[_0x8b25('0x48')]['fields']));_0x39b073[_0x8b25('0x4d')]=_0x39b073['attributes'][_0x8b25('0x5e')]?_0x39b073[_0x8b25('0x4d')]:_0x4c994d[_0x8b25('0x4b')];if(!_0x2b0468[_0x8b25('0x48')][_0x8b25('0x6b')](_0x8b25('0x4e'))){_0x39b073[_0x8b25('0x34')]=qs[_0x8b25('0x34')](_0x2b0468[_0x8b25('0x48')]['limit']);_0x39b073['offset']=qs[_0x8b25('0x33')](_0x2b0468['query'][_0x8b25('0x33')]);}_0x39b073[_0x8b25('0x6c')]=qs[_0x8b25('0x4f')](_0x2b0468[_0x8b25('0x48')]['sort']);_0x39b073['where']=qs[_0x8b25('0x52')](_[_0x8b25('0x51')](_0x2b0468[_0x8b25('0x48')],_0x4c994d['filters']));_0x39b073['where'][_0x8b25('0x68')]=_0x19fa6a['id'];if(_0x2b0468[_0x8b25('0x48')][_0x8b25('0x53')]){_0x39b073[_0x8b25('0x50')]=_[_0x8b25('0x54')](_0x39b073[_0x8b25('0x50')],{'$or':_[_0x8b25('0x44')](_0x39b073['attributes'],function(_0x45c644){var _0x5a4c24={};_0x5a4c24[_0x45c644]={'$like':'%'+_0x2b0468[_0x8b25('0x48')][_0x8b25('0x53')]+'%'};return _0x5a4c24;})});}_0x39b073=_['merge']({},_0x39b073,_0x2b0468[_0x8b25('0x56')]);return db[_0x8b25('0x70')][_0x8b25('0x32')]({'where':_0x39b073[_0x8b25('0x50')]})[_0x8b25('0x23')](function(_0x1d967e){_0x1e29dd[_0x8b25('0x32')]=_0x1d967e;if(_0x2b0468[_0x8b25('0x48')][_0x8b25('0x57')]){_0x39b073[_0x8b25('0x58')]=[{'all':!![]}];}return db[_0x8b25('0x70')][_0x8b25('0x59')](_0x39b073);})[_0x8b25('0x23')](function(_0x595bb0){_0x1e29dd[_0x8b25('0x5a')]=_0x595bb0;return _0x1e29dd;});}})[_0x8b25('0x23')](respondWithFilteredResult(_0x561c3b,_0x39b073))[_0x8b25('0x2c')](handleError(_0x561c3b,null));};exports[_0x8b25('0x73')]=function(_0xaecde2,_0x1df8a6,_0x49011b){return db[_0x8b25('0x45')][_0x8b25('0x64')]({'where':{'id':_0xaecde2['params']['id']}})[_0x8b25('0x23')](handleEntityNotFound(_0x1df8a6,null))['then'](function(_0x1cb8cb){if(_0x1cb8cb){return _0x1cb8cb['removeAnswers'](_0xaecde2[_0x8b25('0x48')][_0x8b25('0x6e')]);}})['then'](respondWithStatusCode(_0x1df8a6,null))[_0x8b25('0x2c')](handleError(_0x1df8a6,null));};exports[_0x8b25('0x74')]=function(_0x147c51,_0x242f78,_0x3823e0){var _0x7d81cb={'body':_0x147c51[_0x8b25('0x60')],'channel':_0x8b25('0x75')};var _0x1ef08f=[];var _0x1394e0=[];var _0x132ce9={};var _0x35e154=![];return db[_0x8b25('0x76')][_0x8b25('0x66')]()['then'](function(_0x1d641e){if(!_0x1d641e){throw new db[(_0x8b25('0x77'))]['ValidationError'](_0x8b25('0x78'));}_0x1ef08f=_['difference'](_['keys'](_0x1d641e),[_0x8b25('0x79'),_0x8b25('0x7a')]);_0x1394e0=_[_0x8b25('0x7b')](_[_0x8b25('0x49')](_0x1d641e),['createdAt',_0x8b25('0x7a'),_0x8b25('0x7c'),_0x8b25('0x7d')]);if(_0x147c51[_0x8b25('0x60')]['id']){delete _0x147c51[_0x8b25('0x60')]['id'];}if(_[_0x8b25('0x7e')](_0x147c51[_0x8b25('0x60')]['from'])){throw new db[(_0x8b25('0x77'))][(_0x8b25('0x7f'))](_0x8b25('0x80'));}if(_['isNil'](_0x147c51['body']['body'])||_0x147c51[_0x8b25('0x60')][_0x8b25('0x60')]===''){throw new db['Sequelize']['ValidationError'](_0x8b25('0x81'));}if(_[_0x8b25('0x7e')](_0x147c51['body'][_0x8b25('0x82')])){throw new db[(_0x8b25('0x77'))]['ValidationError'](_0x8b25('0x83')+_0x1394e0);}if(!_['includes'](_0x1394e0,_0x147c51[_0x8b25('0x60')][_0x8b25('0x82')])){throw new db[(_0x8b25('0x77'))][(_0x8b25('0x7f'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1394e0);}_0x132ce9[_0x147c51[_0x8b25('0x60')][_0x8b25('0x82')]]=_0x147c51[_0x8b25('0x60')][_0x8b25('0x84')];})[_0x8b25('0x23')](function(){return db[_0x8b25('0x45')][_0x8b25('0x64')]({'where':{'id':_0x147c51[_0x8b25('0x5c')]['id']},'include':[{'model':db[_0x8b25('0x85')],'as':_0x8b25('0x86'),'include':[{'model':db[_0x8b25('0x76')],'as':'Contacts','where':_0x132ce9,'limit':0x1,'order':[[_0x8b25('0x7a'),_0x8b25('0x87')]]}]},{'model':db[_0x8b25('0x88')],'as':_0x8b25('0x89')}]});})[_0x8b25('0x23')](handleEntityNotFound(_0x242f78,null))['then'](function(_0x4ff37e){if(_0x4ff37e&&_0x4ff37e[_0x8b25('0x86')]){_0x7d81cb[_0x8b25('0x8a')]=_0x4ff37e;_0x7d81cb[_0x8b25('0x8b')]=_0x4ff37e['Applications'];_0x7d81cb[_0x8b25('0x8c')]=_0x4ff37e[_0x8b25('0x86')];_0x7d81cb[_0x8b25('0x8b')]=_[_0x8b25('0x8d')](_0x7d81cb[_0x8b25('0x8b')],['priority'],[_0x8b25('0x8e')]);if(_0x7d81cb[_0x8b25('0x8a')]['Applications']){delete _0x7d81cb['account'][_0x8b25('0x89')];}if(_0x7d81cb['account'][_0x8b25('0x86')]&&_0x7d81cb[_0x8b25('0x8a')]['List']['Contacts'][_0x8b25('0x5e')]){return _0x7d81cb[_0x8b25('0x8a')][_0x8b25('0x86')][_0x8b25('0x8f')][0x0];}var _0x2bf785=_[_0x8b25('0x1a')](_0x147c51[_0x8b25('0x60')],{'firstName':_0x147c51['body']['from'],'ListId':_0x4ff37e[_0x8b25('0x7d')]});_0x2bf785[_0x147c51[_0x8b25('0x60')][_0x8b25('0x82')]]=_0x147c51[_0x8b25('0x60')][_0x8b25('0x84')];return db['CmContact'][_0x8b25('0x5f')](_0x2bf785,{'fields':_0x1ef08f,'raw':!![]});}})[_0x8b25('0x23')](handleEntityNotFound(_0x242f78,null))[_0x8b25('0x23')](function(_0x454a62){_0x7d81cb[_0x8b25('0x90')]=_0x454a62;if(_0x454a62){var _0x24c1d8={'ContactId':_0x454a62['id'],'OpenchannelAccountId':_0x147c51['params']['id'],'from':(_0x454a62[_0x8b25('0x91')]||'')+'\x20'+(_0x454a62[_0x8b25('0x92')]||'')};var _0x40bda4={'OpenchannelAccountId':_0x147c51[_0x8b25('0x5c')]['id'],'closed':![]};if(_0x147c51[_0x8b25('0x60')][_0x8b25('0x93')]){_0x40bda4[_0x8b25('0x93')]=_0x147c51['body'][_0x8b25('0x93')];return db[_0x8b25('0x94')][_0x8b25('0x64')]({'where':_0x40bda4})[_0x8b25('0x23')](function(_0xf75b36){if(_0xf75b36){return[_0xf75b36,![]];}_0x24c1d8['threadId']=_0x147c51[_0x8b25('0x60')][_0x8b25('0x93')];_0x24c1d8[_0x8b25('0x95')]=_0x147c51[_0x8b25('0x60')]['externalUrl'];return db['OpenchannelInteraction']['create'](_0x24c1d8)[_0x8b25('0x23')](function(_0x2a762c){return[_0x2a762c,!![]];});});}else{_0x40bda4['threadId']=null;}_0x40bda4[_0x8b25('0x96')]=_0x454a62['id'];return db['OpenchannelInteraction']['find']({'where':_0x40bda4})[_0x8b25('0x23')](function(_0x4a1986){if(_0x4a1986){return[_0x4a1986,![]];}return db['OpenchannelInteraction'][_0x8b25('0x5f')](_0x24c1d8)[_0x8b25('0x23')](function(_0x34cf9c){return[_0x34cf9c,!![]];});});}})['spread'](function(_0x2f8834,_0x335aee){if(_0x2f8834){_0x35e154=_0x335aee;if(!_0x335aee){var _0x234c84={'from':(_0x7d81cb['contact']['firstName']||'')+'\x20'+(_0x7d81cb[_0x8b25('0x90')]['lastName']||'')};if(_0x147c51[_0x8b25('0x60')][_0x8b25('0x93')]&&_0x147c51[_0x8b25('0x60')][_0x8b25('0x97')]&&_0x147c51['body'][_0x8b25('0x93')]!=_0x147c51['body'][_0x8b25('0x97')]){_0x234c84['threadId']=_0x147c51[_0x8b25('0x60')][_0x8b25('0x97')];}return _0x2f8834[_0x8b25('0x39')](_0x234c84);}else{return _0x2f8834;}}})[_0x8b25('0x23')](function(_0x49cc71){_0x7d81cb[_0x8b25('0x98')]=_0x49cc71[_0x8b25('0x3a')]({'plain':!![]});_0x7d81cb[_0x8b25('0x98')][_0x8b25('0x99')]=_0x35e154;if(_0x7d81cb[_0x8b25('0x98')][_0x8b25('0x99')]){if(_0x7d81cb[_0x8b25('0x8a')][_0x8b25('0x9a')]){_0x7d81cb['applications'][_0x8b25('0x9b')]({'id':0x0,'priority':_0x7d81cb['applications'][_0x8b25('0x5e')]+0x1,'app':'close','appdata':_0x8b25('0x9c'),'interval':_0x8b25('0x9d')});}}return db[_0x8b25('0x9e')][_0x8b25('0x5f')]({'body':_0x147c51[_0x8b25('0x60')][_0x8b25('0x60')],'OpenchannelAccountId':_0x147c51[_0x8b25('0x5c')]['id'],'OpenchannelInteractionId':_0x49cc71['id'],'direction':'in','ContactId':_0x7d81cb[_0x8b25('0x90')]['id'],'AttachmentId':_0x147c51[_0x8b25('0x60')][_0x8b25('0x9f')]});})['then'](function(_0x1f7da3){_0x7d81cb[_0x8b25('0x2a')]=_0x1f7da3;if(_0x7d81cb[_0x8b25('0x98')][_0x8b25('0xa0')]){return db['User'][_0x8b25('0x64')]({'attributes':['id',_0x8b25('0x3f')],'where':{'id':_0x7d81cb['interaction'][_0x8b25('0xa0')]}})[_0x8b25('0x23')](function(_0x77b89f){if(_0x77b89f){_0x7d81cb[_0x8b25('0x8b')][_0x8b25('0xa1')]({'id':0x0,'priority':0x0,'app':_0x8b25('0xa2'),'appdata':_0x77b89f['name']+','+(_0x7d81cb[_0x8b25('0x8a')][_0x8b25('0xa3')]||0xa),'interval':'*,*,*,*'});_0x7d81cb[_0x8b25('0xa4')]=![];}return respondWithRpcPromise(_0x8b25('0xa5'),'startRouting',_0x7d81cb);});}return respondWithRpcPromise('Start',_0x8b25('0xa6'),_0x7d81cb);})[_0x8b25('0x23')](function(_0x1e9a94){respondWithRpcPromise(_0x8b25('0xa7'),_0x8b25('0xa7'),{'event':_0x8b25('0x74'),'message':_0x1e9a94},client9002);return _0x1e9a94;})[_0x8b25('0x23')](respondWithResult(_0x242f78,null))['catch'](handleError(_0x242f78,null));};exports[_0x8b25('0xa8')]=function(_0x45bf56,_0x49edde){var _0x54bf6d=_0x45bf56[_0x8b25('0x5c')]['id'];var _0x424bbf=_0x45bf56['body'];var _0x3450d4=0xc8;var _0x44ea41=null;return db[_0x8b25('0xa9')][_0x8b25('0xaa')]({'isolationLevel':db['sequelize'][_0x8b25('0xab')][_0x8b25('0xac')][_0x8b25('0xad')]},function(_0x5a6231){return db['OpenchannelAccount']['findOne']({'where':{'id':_0x54bf6d},'transaction':_0x5a6231})[_0x8b25('0x23')](function(_0x113e32){if(_0x113e32){return db[_0x8b25('0x88')][_0x8b25('0x3d')]({'where':{'OpenchannelAccountId':_0x54bf6d},'transaction':_0x5a6231})['then'](function(){var _0x12064f=_[_0x8b25('0x44')](_0x424bbf,function(_0x401225){_0x401225[_0x8b25('0x68')]=_0x54bf6d;return _0x401225;});return db[_0x8b25('0x88')][_0x8b25('0xae')](_0x12064f,{'transaction':_0x5a6231});});}else{_0x3450d4=0x194;_0x44ea41=[];}});})[_0x8b25('0x23')](function(){if(_0x3450d4!==0x194){return db[_0x8b25('0x88')][_0x8b25('0xaf')]({'where':{'OpenchannelAccountId':_0x54bf6d},'order':_0x8b25('0xb0')})[_0x8b25('0x23')](function(_0x29223f){_0x44ea41=_0x29223f;});}})['catch'](function(_0x1073da){_0x3450d4=0x1f4;logger[_0x8b25('0x28')](_0x1073da['stack']);if(_0x1073da[_0x8b25('0x3f')]){delete _0x1073da[_0x8b25('0x3f')];}_0x44ea41=_0x1073da;})[_0x8b25('0xb1')](function(){if(_0x44ea41===null){_0x49edde[_0x8b25('0x2d')](_0x3450d4);}else{if(_0x3450d4===0x1f4){_0x49edde[_0x8b25('0x2e')](_0x3450d4)[_0x8b25('0x40')](_0x44ea41);}else{_0x49edde['status'](_0x3450d4)[_0x8b25('0x30')](_0x44ea41);}}});};exports[_0x8b25('0xb2')]=function(_0x60237f,_0x211ba1,_0x4a0f0e){var _0xbe0ad9={};var _0x1f49c2={};var _0x365cdd;var _0x3fa51d;return db[_0x8b25('0x45')][_0x8b25('0x72')]({'where':{'id':_0x60237f[_0x8b25('0x5c')]['id']}})[_0x8b25('0x23')](handleEntityNotFound(_0x211ba1,null))[_0x8b25('0x23')](function(_0x5aed5e){if(_0x5aed5e){_0x365cdd=_0x5aed5e;_0x1f49c2[_0x8b25('0x4b')]=_[_0x8b25('0x49')](db['OpenchannelApplication'][_0x8b25('0x5d')]);_0x1f49c2[_0x8b25('0x48')]=_[_0x8b25('0x49')](_0x60237f['query']);_0x1f49c2['filters']=_[_0x8b25('0x4a')](_0x1f49c2[_0x8b25('0x4b')],_0x1f49c2[_0x8b25('0x48')]);_0xbe0ad9[_0x8b25('0x4d')]=_['intersection'](_0x1f49c2[_0x8b25('0x4b')],qs[_0x8b25('0x4c')](_0x60237f[_0x8b25('0x48')]['fields']));_0xbe0ad9['attributes']=_0xbe0ad9['attributes']['length']?_0xbe0ad9[_0x8b25('0x4d')]:_0x1f49c2[_0x8b25('0x4b')];_0xbe0ad9[_0x8b25('0x6c')]=qs[_0x8b25('0x4f')](_0x60237f[_0x8b25('0x48')][_0x8b25('0x4f')]);_0xbe0ad9[_0x8b25('0x50')]=qs['filters'](_[_0x8b25('0x51')](_0x60237f[_0x8b25('0x48')],_0x1f49c2['filters']));if(_0x60237f[_0x8b25('0x48')][_0x8b25('0x53')]){_0xbe0ad9[_0x8b25('0x50')]=_[_0x8b25('0x54')](_0xbe0ad9[_0x8b25('0x50')],{'$or':_['map'](_0xbe0ad9[_0x8b25('0x4d')],function(_0x38c05b){var _0x365a33={};_0x365a33[_0x38c05b]={'$like':'%'+_0x60237f['query']['filter']+'%'};return _0x365a33;})});}_0xbe0ad9=_['merge']({},_0xbe0ad9,_0x60237f[_0x8b25('0x56')]);return _0x365cdd[_0x8b25('0xb2')](_0xbe0ad9);}})[_0x8b25('0x23')](function(_0xa1b4e7){if(_0xa1b4e7){_0x3fa51d=_0xa1b4e7[_0x8b25('0x5e')];if(!_0x60237f[_0x8b25('0x48')]['hasOwnProperty'](_0x8b25('0x4e'))){_0xbe0ad9[_0x8b25('0x34')]=qs[_0x8b25('0x34')](_0x60237f['query'][_0x8b25('0x34')]);_0xbe0ad9['offset']=qs[_0x8b25('0x33')](_0x60237f[_0x8b25('0x48')][_0x8b25('0x33')]);}return _0x365cdd['getApplications'](_0xbe0ad9);}})[_0x8b25('0x23')](function(_0x20c02a){if(_0x20c02a){return _0x20c02a?{'count':_0x3fa51d,'rows':_0x20c02a}:null;}})[_0x8b25('0x23')](respondWithResult(_0x211ba1,null))[_0x8b25('0x2c')](handleError(_0x211ba1,null));};exports[_0x8b25('0xb3')]=function(_0x1d6024,_0x5d58b6,_0x34ffda){var _0x28c7e3={'raw':![],'where':{}};var _0xd729cf={};var _0x34caf9={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x1d6024[_0x8b25('0x5c')]['id']}})[_0x8b25('0x23')](handleEntityNotFound(_0x5d58b6,null))[_0x8b25('0x23')](function(_0x588efa){if(_0x588efa){_0xd729cf[_0x8b25('0x4b')]=_[_0x8b25('0x49')](db[_0x8b25('0x94')][_0x8b25('0x5d')]);_0xd729cf[_0x8b25('0x48')]=_[_0x8b25('0x49')](_0x1d6024[_0x8b25('0x48')]);_0xd729cf[_0x8b25('0x52')]=_[_0x8b25('0x4a')](_0xd729cf[_0x8b25('0x4b')],_0xd729cf[_0x8b25('0x48')]);_0x28c7e3[_0x8b25('0x4d')]=_[_0x8b25('0x4a')](_0xd729cf[_0x8b25('0x4b')],qs[_0x8b25('0x4c')](_0x1d6024[_0x8b25('0x48')][_0x8b25('0x4c')]));_0x28c7e3[_0x8b25('0x4d')]=_0x28c7e3[_0x8b25('0x4d')][_0x8b25('0x5e')]?_0x28c7e3['attributes']:_0xd729cf[_0x8b25('0x4b')];if(!_0x1d6024['query'][_0x8b25('0x6b')](_0x8b25('0x4e'))){_0x28c7e3[_0x8b25('0x34')]=qs[_0x8b25('0x34')](_0x1d6024[_0x8b25('0x48')][_0x8b25('0x34')]);_0x28c7e3[_0x8b25('0x33')]=qs[_0x8b25('0x33')](_0x1d6024['query'][_0x8b25('0x33')]);}_0x28c7e3[_0x8b25('0x6c')]=qs[_0x8b25('0x4f')](_0x1d6024['query'][_0x8b25('0x4f')]);_0x28c7e3[_0x8b25('0x50')]=qs[_0x8b25('0x52')](_[_0x8b25('0x51')](_0x1d6024[_0x8b25('0x48')],_0xd729cf['filters']));_0x28c7e3[_0x8b25('0x50')]['OpenchannelAccountId']=_0x588efa['id'];if(_0x1d6024[_0x8b25('0x48')]['filter']){_0x28c7e3[_0x8b25('0x50')]=_[_0x8b25('0x54')](_0x28c7e3[_0x8b25('0x50')],{'$or':_[_0x8b25('0x44')](_0x28c7e3[_0x8b25('0x4d')],function(_0x5ab938){var _0x22998b={};_0x22998b[_0x5ab938]={'$like':'%'+_0x1d6024['query']['filter']+'%'};return _0x22998b;})});}_0x28c7e3=_['merge']({},_0x28c7e3,_0x1d6024[_0x8b25('0x56')]);return db['OpenchannelInteraction'][_0x8b25('0x32')]({'where':_0x28c7e3[_0x8b25('0x50')]})[_0x8b25('0x23')](function(_0x35e741){_0x34caf9[_0x8b25('0x32')]=_0x35e741;if(_0x1d6024[_0x8b25('0x48')]['includeAll']){_0x28c7e3[_0x8b25('0x58')]=[{'model':db['CmContact'],'as':_0x8b25('0xb4'),'required':![]},{'model':db[_0x8b25('0xb5')],'as':_0x8b25('0xb6'),'attributes':[_0x8b25('0x3f'),_0x8b25('0xb7'),_0x8b25('0xb8')],'required':![]},{'model':db[_0x8b25('0xb9')],'as':'Tags','attributes':['id',_0x8b25('0x3f'),_0x8b25('0xba')],'where':_0x1d6024[_0x8b25('0x48')]['tag']?{'id':_0x1d6024[_0x8b25('0x48')][_0x8b25('0xbb')]}:undefined,'required':_0x1d6024[_0x8b25('0x48')][_0x8b25('0xbb')]?!![]:![]}];}return db[_0x8b25('0x94')]['findAll'](_0x28c7e3);})[_0x8b25('0x23')](function(_0x412535){_0x34caf9[_0x8b25('0x5a')]=_0x412535;return _0x34caf9;});}})[_0x8b25('0x23')](respondWithFilteredResult(_0x5d58b6,_0x28c7e3))[_0x8b25('0x2c')](handleError(_0x5d58b6,null));};exports[_0x8b25('0xbc')]=function(_0x49cb97,_0x2360ce,_0x44d7d5){return db[_0x8b25('0x45')][_0x8b25('0x64')]({'where':{'id':_0x49cb97['params']['id']}})[_0x8b25('0x23')](handleEntityNotFound(_0x2360ce,null))[_0x8b25('0x23')](function(_0x256806){if(_0x256806){return _0x256806[_0x8b25('0xbc')](_0x49cb97['body'][_0x8b25('0x6e')],_[_0x8b25('0xbd')](_0x49cb97['body'],[_0x8b25('0x6e'),'id'])||{})[_0x8b25('0xbe')](function(_0x29f108){for(var _0x22d49a=0x0;_0x22d49a<_0x49cb97[_0x8b25('0x60')][_0x8b25('0x6e')][_0x8b25('0x5e')];_0x22d49a+=0x1){socket[_0x8b25('0xbf')](_0x8b25('0xc0'),{'UserId':Number(_0x49cb97[_0x8b25('0x60')][_0x8b25('0x6e')][_0x22d49a]),'OpenchannelAccountId':Number(_0x49cb97[_0x8b25('0x5c')]['id'])});}return _0x29f108;});}})['then'](respondWithResult(_0x2360ce,null))['catch'](handleError(_0x2360ce,null));};exports[_0x8b25('0xc1')]=function(_0x56ba86,_0x1f2059,_0x2fd78a){return db['OpenchannelAccount']['find']({'where':{'id':_0x56ba86[_0x8b25('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1f2059,null))[_0x8b25('0x23')](function(_0x429207){if(_0x429207){return _0x429207['removeAgents'](_0x56ba86[_0x8b25('0x48')][_0x8b25('0x6e')])[_0x8b25('0x23')](function(){if(_['isArray'](_0x56ba86[_0x8b25('0x48')][_0x8b25('0x6e')])){for(var _0x587394=0x0;_0x587394<_0x56ba86[_0x8b25('0x48')]['ids'][_0x8b25('0x5e')];_0x587394+=0x1){socket[_0x8b25('0xbf')](_0x8b25('0xc2'),{'UserId':Number(_0x56ba86[_0x8b25('0x48')][_0x8b25('0x6e')][_0x587394]),'OpenchannelAccountId':Number(_0x56ba86['params']['id'])});}}else{socket[_0x8b25('0xbf')](_0x8b25('0xc2'),{'UserId':Number(_0x56ba86[_0x8b25('0x48')][_0x8b25('0x6e')]),'OpenchannelAccountId':Number(_0x56ba86[_0x8b25('0x5c')]['id'])});}});}})['then'](respondWithStatusCode(_0x1f2059,null))[_0x8b25('0x2c')](handleError(_0x1f2059,null));};exports[_0x8b25('0xc3')]=function(_0x27eda1,_0x19a808,_0x26f43a){var _0x4cdc50={};var _0xbc6d18={};var _0x43cec1;var _0x229303;return db[_0x8b25('0x45')][_0x8b25('0x72')]({'where':{'id':_0x27eda1[_0x8b25('0x5c')]['id']}})[_0x8b25('0x23')](handleEntityNotFound(_0x19a808,null))[_0x8b25('0x23')](function(_0x48d423){if(_0x48d423){_0x43cec1=_0x48d423;_0xbc6d18[_0x8b25('0x4b')]=_[_0x8b25('0x49')](db[_0x8b25('0xb5')]['rawAttributes']);_0xbc6d18[_0x8b25('0x48')]=_[_0x8b25('0x49')](_0x27eda1[_0x8b25('0x48')]);_0xbc6d18[_0x8b25('0x52')]=_['intersection'](_0xbc6d18['model'],_0xbc6d18[_0x8b25('0x48')]);_0x4cdc50[_0x8b25('0x4d')]=_['intersection'](_0xbc6d18[_0x8b25('0x4b')],qs[_0x8b25('0x4c')](_0x27eda1[_0x8b25('0x48')][_0x8b25('0x4c')]));_0x4cdc50[_0x8b25('0x4d')]=_0x4cdc50[_0x8b25('0x4d')][_0x8b25('0x5e')]?_0x4cdc50[_0x8b25('0x4d')]:_0xbc6d18[_0x8b25('0x4b')];_0x4cdc50[_0x8b25('0x6c')]=qs[_0x8b25('0x4f')](_0x27eda1[_0x8b25('0x48')]['sort']);_0x4cdc50[_0x8b25('0x50')]=qs[_0x8b25('0x52')](_['pick'](_0x27eda1[_0x8b25('0x48')],_0xbc6d18[_0x8b25('0x52')]));if(_0x27eda1['query'][_0x8b25('0x53')]){_0x4cdc50[_0x8b25('0x50')]=_[_0x8b25('0x54')](_0x4cdc50[_0x8b25('0x50')],{'$or':_['map'](_0x4cdc50[_0x8b25('0x4d')],function(_0x361360){var _0x4bfa33={};_0x4bfa33[_0x361360]={'$like':'%'+_0x27eda1['query'][_0x8b25('0x53')]+'%'};return _0x4bfa33;})});}_0x4cdc50=_[_0x8b25('0x54')]({},_0x4cdc50,_0x27eda1[_0x8b25('0x56')]);return _0x43cec1[_0x8b25('0xc3')](_0x4cdc50);}})['then'](function(_0x31f044){if(_0x31f044){_0x229303=_0x31f044[_0x8b25('0x5e')];if(!_0x27eda1[_0x8b25('0x48')][_0x8b25('0x6b')](_0x8b25('0x4e'))){_0x4cdc50[_0x8b25('0x34')]=qs[_0x8b25('0x34')](_0x27eda1[_0x8b25('0x48')][_0x8b25('0x34')]);_0x4cdc50['offset']=qs['offset'](_0x27eda1['query'][_0x8b25('0x33')]);}return _0x43cec1[_0x8b25('0xc3')](_0x4cdc50);}})['then'](function(_0x3899dc){if(_0x3899dc){return _0x3899dc?{'count':_0x229303,'rows':_0x3899dc}:null;}})[_0x8b25('0x23')](respondWithResult(_0x19a808,null))[_0x8b25('0x2c')](handleError(_0x19a808,null));};exports[_0x8b25('0x40')]=function(_0x5cdcd2,_0x55cdd7,_0x19516e){var _0x3b7e05,_0x399ce8,_0x516bca;if(_[_0x8b25('0x7e')](_0x5cdcd2[_0x8b25('0x60')][_0x8b25('0x60')])||_0x5cdcd2[_0x8b25('0x60')]['body']===''){throw new db[(_0x8b25('0x77'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x5cdcd2[_0x8b25('0x60')]['to'])){}_0x3b7e05=_0x5cdcd2[_0x8b25('0x60')]['to'];return db['OpenchannelAccount'][_0x8b25('0x72')]({'where':{'id':_0x5cdcd2[_0x8b25('0x5c')]['id']}})[_0x8b25('0x23')](handleEntityNotFound(_0x55cdd7,null))[_0x8b25('0x23')](function(_0x3bad6c){if(_0x3bad6c){return db['OpenchannelAccount'][_0x8b25('0x64')]({'where':{'id':_0x3bad6c['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0x8b25('0x8f'),'where':{[_0x3bad6c[_0x8b25('0x82')]]:_0x3b7e05},'limit':0x1,'order':[[_0x8b25('0x7a'),_0x8b25('0x87')]]}]}]})['then'](handleEntityNotFound(_0x55cdd7,null))['then'](function(_0x42a7fe){if(_0x42a7fe&&_0x42a7fe[_0x8b25('0x86')]){_0x399ce8=_0x42a7fe[_0x8b25('0x3a')]({'plain':!![]});if(_0x399ce8[_0x8b25('0x86')]&&_0x399ce8[_0x8b25('0x86')][_0x8b25('0x8f')][_0x8b25('0x5e')]){return _0x399ce8[_0x8b25('0x86')]['Contacts'][0x0];}return db['CmContact'][_0x8b25('0x5f')](_[_0x8b25('0x1a')](_0x5cdcd2[_0x8b25('0x60')],{'firstName':_0x3b7e05,[_0x42a7fe[_0x8b25('0x82')]]:_0x3b7e05,'phone':_0x3b7e05,'ListId':_0x399ce8[_0x8b25('0x7d')]}));}})[_0x8b25('0x23')](handleEntityNotFound(_0x55cdd7,null))[_0x8b25('0x23')](function(_0x104a59){if(_0x104a59){_0x516bca=_0x104a59;return db['OpenchannelInteraction']['find']({'where':{'ContactId':_0x516bca['id'],'closed':![],'OpenchannelAccountId':_0x399ce8['id']}})[_0x8b25('0x23')](function(_0x258c92){if(_0x258c92){return[_0x258c92,![]];}return db['OpenchannelInteraction'][_0x8b25('0x5f')]({'UserId':_0x5cdcd2[_0x8b25('0x61')]['id'],'ContactId':_0x516bca['id'],'OpenchannelAccountId':_0x399ce8['id'],'lastMsgDirection':_0x8b25('0xc4'),'firstMsgDirection':_0x8b25('0xc4'),'Messages':[_[_0x8b25('0x54')](_0x5cdcd2[_0x8b25('0x60')],{'read':![],'body':_0x5cdcd2['body'][_0x8b25('0x60')],'OpenchannelAccountId':_0x399ce8['id'],'UserId':_0x5cdcd2[_0x8b25('0x61')]['id'],'ContactId':_0x516bca['id']})]},{'include':[{'model':db[_0x8b25('0x9e')],'as':_0x8b25('0xc5')}]})[_0x8b25('0x23')](function(_0x5bbdac){return[_0x5bbdac,!![]];});});}})['spread'](function(_0x51d693,_0x227ef6){if(_0x227ef6){return _0x51d693;}return db['OpenchannelMessage'][_0x8b25('0x5f')](_[_0x8b25('0x54')](_0x5cdcd2[_0x8b25('0x60')],{'read':![],'body':_0x5cdcd2['body'][_0x8b25('0x60')],'OpenchannelAccountId':_0x399ce8['id'],'OpenchannelInteractionId':_0x51d693['id'],'UserId':_0x5cdcd2[_0x8b25('0x61')]['id'],'ContactId':_0x516bca['id']}))[_0x8b25('0x23')](function(_0x5c4b35){_0x51d693['dataValues'][_0x8b25('0xc5')]=[];_0x51d693[_0x8b25('0xc6')][_0x8b25('0xc5')][_0x8b25('0x9b')](_0x5c4b35[_0x8b25('0xc6')]);return _0x51d693;});});}})[_0x8b25('0x23')](respondWithResult(_0x55cdd7,null))[_0x8b25('0x2c')](handleError(_0x55cdd7,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 21d884f..4ff9f54 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 _0xb903=['setMaxListeners','update','remove','emit','hasOwnProperty','events','../../mysqldb','OpenchannelAccount'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xb903,0x185));var _0x3b90=function(_0x3bd727,_0x471a99){_0x3bd727=_0x3bd727-0x0;var _0x252d50=_0xb903[_0x3bd727];return _0x252d50;};'use strict';var EventEmitter=require(_0x3b90('0x0'));var OpenchannelAccount=require(_0x3b90('0x1'))['db'][_0x3b90('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x3b90('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3b90('0x4'),'afterDestroy':_0x3b90('0x5')};function emitEvent(_0x3b024a){return function(_0x1cd5d8,_0x30d8db,_0x40f726){OpenchannelAccountEvents[_0x3b90('0x6')](_0x3b024a+':'+_0x1cd5d8['id'],_0x1cd5d8);OpenchannelAccountEvents['emit'](_0x3b024a,_0x1cd5d8);_0x40f726(null);};}for(var e in events){if(events[_0x3b90('0x7')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x5ff3=['emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners','update','remove'];(function(_0x39c229,_0x54d228){var _0x4e2a2c=function(_0x114535){while(--_0x114535){_0x39c229['push'](_0x39c229['shift']());}};_0x4e2a2c(++_0x54d228);}(_0x5ff3,0x17d));var _0x35ff=function(_0x3253fa,_0x1391fb){_0x3253fa=_0x3253fa-0x0;var _0x2f747f=_0x5ff3[_0x3253fa];return _0x2f747f;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x35ff('0x0'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x35ff('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x35ff('0x2'),'afterDestroy':_0x35ff('0x3')};function emitEvent(_0x3bd66a){return function(_0xd0846d,_0x551514,_0x2fcb74){OpenchannelAccountEvents[_0x35ff('0x4')](_0x3bd66a+':'+_0xd0846d['id'],_0xd0846d);OpenchannelAccountEvents[_0x35ff('0x4')](_0x3bd66a,_0xd0846d);_0x2fcb74(null);};}for(var e in events){if(events[_0x35ff('0x5')](e)){var event=events[e];OpenchannelAccount[_0x35ff('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index c19711b..78c31fc 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(_0xaec9f0,_0x25f525){var _0x452a47=function(_0x3e192a){while(--_0x3e192a){_0xaec9f0['push'](_0xaec9f0['shift']());}};_0x452a47(++_0x25f525);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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(_0x4b7334,_0x45fbcc){var _0x1c83be=function(_0x12c9f6){while(--_0x12c9f6){_0x4b7334['push'](_0x4b7334['shift']());}};_0x1c83be(++_0x45fbcc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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 906b147..ac4e875 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 _0x6324=['bluebird','ioredis','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','catch','lodash','util','moment'];(function(_0x545e41,_0x55830d){var _0x20ee17=function(_0xac9b17){while(--_0xac9b17){_0x545e41['push'](_0x545e41['shift']());}};_0x20ee17(++_0x55830d);}(_0x6324,0x142));var _0x4632=function(_0x1a4528,_0x54d423){_0x1a4528=_0x1a4528-0x0;var _0x368a2c=_0x6324[_0x1a4528];return _0x368a2c;};'use strict';var _=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var moment=require(_0x4632('0x2'));var BPromise=require(_0x4632('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4632('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4632('0x5'));var logger=require('../../config/logger')(_0x4632('0x6'));var config=require('../../config/environment');var jayson=require(_0x4632('0x7'));var client=jayson[_0x4632('0x8')][_0x4632('0x9')]({'port':0x232a});config[_0x4632('0xa')]=_['defaults'](config[_0x4632('0xa')],{'host':_0x4632('0xb'),'port':0x18eb});var socket=require(_0x4632('0xc'))(new Redis(config['redis']));require(_0x4632('0xd'))[_0x4632('0xe')](socket);function respondWithRpcPromise(_0x47a518,_0x556bbc,_0xcdefa2){return new BPromise(function(_0x21999d,_0x30a7cf){return client[_0x4632('0xf')](_0x47a518,_0xcdefa2)[_0x4632('0x10')](function(_0xe28f38){logger[_0x4632('0x11')](_0x4632('0x12'),_0x556bbc,'request\x20sent');logger[_0x4632('0x13')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x556bbc,_0x4632('0x14'),JSON[_0x4632('0x15')](_0xe28f38));if(_0xe28f38[_0x4632('0x16')]){if(_0xe28f38[_0x4632('0x16')]['code']===0x1f4){logger[_0x4632('0x16')](_0x4632('0x12'),_0x556bbc,_0xe28f38[_0x4632('0x16')][_0x4632('0x17')]);return _0x30a7cf(_0xe28f38[_0x4632('0x16')]['message']);}logger['error'](_0x4632('0x12'),_0x556bbc,_0xe28f38[_0x4632('0x16')][_0x4632('0x17')]);return _0x21999d(_0xe28f38[_0x4632('0x16')]['message']);}else{logger[_0x4632('0x11')](_0x4632('0x12'),_0x556bbc,_0x4632('0x14'));_0x21999d(_0xe28f38['result'][_0x4632('0x17')]);}})[_0x4632('0x18')](function(_0x58e193){logger['error'](_0x4632('0x12'),_0x556bbc,_0x58e193);_0x30a7cf(_0x58e193);});});} \ No newline at end of file +var _0x4058=['request','then','debug','code','error','message','OpenchannelAccount,\x20%s,\x20%s','info','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','defaults','socket.io-emitter','./openchannelAccount.socket'];(function(_0x1e0b9c,_0x45232f){var _0x284604=function(_0x7a0ca1){while(--_0x7a0ca1){_0x1e0b9c['push'](_0x1e0b9c['shift']());}};_0x284604(++_0x45232f);}(_0x4058,0x129));var _0x8405=function(_0x261752,_0x44338c){_0x261752=_0x261752-0x0;var _0x206f7c=_0x4058[_0x261752];return _0x206f7c;};'use strict';var _=require(_0x8405('0x0'));var util=require(_0x8405('0x1'));var moment=require(_0x8405('0x2'));var BPromise=require(_0x8405('0x3'));var rs=require(_0x8405('0x4'));var fs=require('fs');var Redis=require(_0x8405('0x5'));var db=require(_0x8405('0x6'))['db'];var utils=require(_0x8405('0x7'));var logger=require(_0x8405('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8405('0x9')][_0x8405('0xa')]({'port':0x232a});config[_0x8405('0xb')]=_[_0x8405('0xc')](config[_0x8405('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x8405('0xd'))(new Redis(config[_0x8405('0xb')]));require(_0x8405('0xe'))['register'](socket);function respondWithRpcPromise(_0x30705f,_0x5e132b,_0x6979fd){return new BPromise(function(_0xb442,_0x50344e){return client[_0x8405('0xf')](_0x30705f,_0x6979fd)[_0x8405('0x10')](function(_0x5b94d5){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x5e132b,'request\x20sent');logger[_0x8405('0x11')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x5e132b,'request\x20sent',JSON['stringify'](_0x5b94d5));if(_0x5b94d5['error']){if(_0x5b94d5['error'][_0x8405('0x12')]===0x1f4){logger[_0x8405('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x5e132b,_0x5b94d5[_0x8405('0x13')][_0x8405('0x14')]);return _0x50344e(_0x5b94d5[_0x8405('0x13')][_0x8405('0x14')]);}logger['error'](_0x8405('0x15'),_0x5e132b,_0x5b94d5[_0x8405('0x13')][_0x8405('0x14')]);return _0xb442(_0x5b94d5[_0x8405('0x13')][_0x8405('0x14')]);}else{logger[_0x8405('0x16')](_0x8405('0x15'),_0x5e132b,_0x8405('0x17'));_0xb442(_0x5b94d5[_0x8405('0x18')][_0x8405('0x14')]);}})[_0x8405('0x19')](function(_0x21376d){logger[_0x8405('0x13')](_0x8405('0x15'),_0x5e132b,_0x21376d);_0x50344e(_0x21376d);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 74ced20..51e86a8 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 _0x6ddd=['remove','update','emit','register','length','openchannelAccount:'];(function(_0x2f62aa,_0x108e95){var _0x1a341f=function(_0x3aedcf){while(--_0x3aedcf){_0x2f62aa['push'](_0x2f62aa['shift']());}};_0x1a341f(++_0x108e95);}(_0x6ddd,0xae));var _0xd6dd=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x6ddd[_0x2f5ac5];return _0x37c9a8;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save',_0xd6dd('0x0'),_0xd6dd('0x1')];function createListener(_0x3cc790,_0x250900){return function(_0x5283c5){_0x250900[_0xd6dd('0x2')](_0x3cc790,_0x5283c5);};}function removeListener(_0x5aebd8,_0x1ab3df){return function(){OpenchannelAccountEvents['removeListener'](_0x5aebd8,_0x1ab3df);};}exports[_0xd6dd('0x3')]=function(_0x27439a){for(var _0x47005f=0x0,_0x49d412=events[_0xd6dd('0x4')];_0x47005f<_0x49d412;_0x47005f++){var _0x1f0c46=events[_0x47005f];var _0x12f605=createListener(_0xd6dd('0x5')+_0x1f0c46,_0x27439a);OpenchannelAccountEvents['on'](_0x1f0c46,_0x12f605);}}; \ No newline at end of file +var _0x6898=['register','length','openchannelAccount:','./openchannelAccount.events','remove','update','emit','removeListener'];(function(_0x4b3198,_0x2b8480){var _0x289b42=function(_0x4a01f1){while(--_0x4a01f1){_0x4b3198['push'](_0x4b3198['shift']());}};_0x289b42(++_0x2b8480);}(_0x6898,0x11b));var _0x8689=function(_0x31d199,_0x1c6c99){_0x31d199=_0x31d199-0x0;var _0x535332=_0x6898[_0x31d199];return _0x535332;};'use strict';var OpenchannelAccountEvents=require(_0x8689('0x0'));var events=['save',_0x8689('0x1'),_0x8689('0x2')];function createListener(_0x472b9d,_0x13fbdb){return function(_0x3ae917){_0x13fbdb[_0x8689('0x3')](_0x472b9d,_0x3ae917);};}function removeListener(_0x524f81,_0x5038aa){return function(){OpenchannelAccountEvents[_0x8689('0x4')](_0x524f81,_0x5038aa);};}exports[_0x8689('0x5')]=function(_0x2c723e){for(var _0x4e776d=0x0,_0xbc1b52=events[_0x8689('0x6')];_0x4e776d<_0xbc1b52;_0x4e776d++){var _0x9ab197=events[_0x4e776d];var _0x4e5261=createListener(_0x8689('0x7')+_0x9ab197,_0x2c723e);OpenchannelAccountEvents['on'](_0x9ab197,_0x4e5261);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 2ad10b2..797e37f 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 _0xdf29=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelApplication.controller','isAuthenticated','/:id','show','create','put','update','delete'];(function(_0x3e6e2d,_0x252c8a){var _0x376187=function(_0x59ab2f){while(--_0x59ab2f){_0x3e6e2d['push'](_0x3e6e2d['shift']());}};_0x376187(++_0x252c8a);}(_0xdf29,0xec));var _0x9df2=function(_0x444d9e,_0x267d5e){_0x444d9e=_0x444d9e-0x0;var _0x34d154=_0xdf29[_0x444d9e];return _0x34d154;};'use strict';var multer=require(_0x9df2('0x0'));var util=require(_0x9df2('0x1'));var path=require(_0x9df2('0x2'));var timeout=require(_0x9df2('0x3'));var express=require(_0x9df2('0x4'));var router=express[_0x9df2('0x5')]();var fs_extra=require(_0x9df2('0x6'));var auth=require(_0x9df2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9df2('0x8'));router['get']('/',auth[_0x9df2('0x9')](),controller['index']);router['get'](_0x9df2('0xa'),auth[_0x9df2('0x9')](),controller[_0x9df2('0xb')]);router['post']('/',auth[_0x9df2('0x9')](),controller[_0x9df2('0xc')]);router[_0x9df2('0xd')](_0x9df2('0xa'),auth[_0x9df2('0x9')](),controller[_0x9df2('0xe')]);router[_0x9df2('0xf')](_0x9df2('0xa'),auth[_0x9df2('0x9')](),controller[_0x9df2('0x10')]);module[_0x9df2('0x11')]=router; \ No newline at end of file +var _0x0669=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','index','isAuthenticated','post','create','put','/:id','delete','destroy','exports','multer','util'];(function(_0x5b681c,_0xcaed9a){var _0x2e8b28=function(_0x137174){while(--_0x137174){_0x5b681c['push'](_0x5b681c['shift']());}};_0x2e8b28(++_0xcaed9a);}(_0x0669,0x18e));var _0x9066=function(_0x3b8774,_0x301a46){_0x3b8774=_0x3b8774-0x0;var _0x5bcfcc=_0x0669[_0x3b8774];return _0x5bcfcc;};'use strict';var multer=require(_0x9066('0x0'));var util=require(_0x9066('0x1'));var path=require('path');var timeout=require(_0x9066('0x2'));var express=require(_0x9066('0x3'));var router=express[_0x9066('0x4')]();var fs_extra=require(_0x9066('0x5'));var auth=require(_0x9066('0x6'));var interaction=require(_0x9066('0x7'));var config=require(_0x9066('0x8'));var controller=require(_0x9066('0x9'));router[_0x9066('0xa')]('/',auth['isAuthenticated'](),controller[_0x9066('0xb')]);router['get']('/:id',auth[_0x9066('0xc')](),controller['show']);router[_0x9066('0xd')]('/',auth[_0x9066('0xc')](),controller[_0x9066('0xe')]);router[_0x9066('0xf')](_0x9066('0x10'),auth[_0x9066('0xc')](),controller['update']);router[_0x9066('0x11')]('/:id',auth[_0x9066('0xc')](),controller[_0x9066('0x12')]);module[_0x9066('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 13e3c5b..51cf37f 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 _0xadf3=['TEXT','STRING','exports'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xadf3,0x1f1));var _0x3adf=function(_0x129a8a,_0x1a8d68){_0x129a8a=_0x129a8a-0x0;var _0x559820=_0xadf3[_0x129a8a];return _0x559820;};'use strict';var Sequelize=require('sequelize');module[_0x3adf('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x3adf('0x1')]()},'description':{'type':Sequelize[_0x3adf('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xbaa6=['TEXT','*,*,*,*','sequelize','exports','STRING'];(function(_0x4a0066,_0x16fb7e){var _0x611761=function(_0x4c040d){while(--_0x4c040d){_0x4a0066['push'](_0x4a0066['shift']());}};_0x611761(++_0x16fb7e);}(_0xbaa6,0x156));var _0x6baa=function(_0x2656a4,_0x28dd1b){_0x2656a4=_0x2656a4-0x0;var _0x48ce85=_0xbaa6[_0x2656a4];return _0x48ce85;};'use strict';var Sequelize=require(_0x6baa('0x0'));module[_0x6baa('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x6baa('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x6baa('0x3')]()},'description':{'type':Sequelize[_0x6baa('0x2')]},'interval':{'type':Sequelize[_0x6baa('0x2')],'defaultValue':_0x6baa('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 45480ff..bc4e290 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 _0xccf8=['order','sort','filter','where','merge','map','options','includeAll','findAll','rows','catch','show','params','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x56ba92,_0xb3c986){var _0x8fe94d=function(_0x23b21c){while(--_0x23b21c){_0x56ba92['push'](_0x56ba92['shift']());}};_0x8fe94d(++_0xb3c986);}(_0xccf8,0xa8));var _0x8ccf=function(_0x51ab67,_0x56ac03){_0x51ab67=_0x51ab67-0x0;var _0x384759=_0xccf8[_0x51ab67];return _0x384759;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8ccf('0x0'));var zipdir=require(_0x8ccf('0x1'));var jsonpatch=require(_0x8ccf('0x2'));var rp=require(_0x8ccf('0x3'));var moment=require(_0x8ccf('0x4'));var BPromise=require(_0x8ccf('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8ccf('0x6'));var sox=require(_0x8ccf('0x7'));var csv=require(_0x8ccf('0x8'));var ejs=require(_0x8ccf('0x9'));var fs=require('fs');var fs_extra=require(_0x8ccf('0xa'));var _=require('lodash');var squel=require(_0x8ccf('0xb'));var crypto=require('crypto');var jsforce=require(_0x8ccf('0xc'));var deskjs=require(_0x8ccf('0xd'));var toCsv=require(_0x8ccf('0x8'));var querystring=require(_0x8ccf('0xe'));var Papa=require(_0x8ccf('0xf'));var Redis=require(_0x8ccf('0x10'));var authService=require(_0x8ccf('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8ccf('0x12'));var hardwareService=require(_0x8ccf('0x13'));var logger=require('../../config/logger')(_0x8ccf('0x14'));var utils=require(_0x8ccf('0x15'));var config=require(_0x8ccf('0x16'));var licenseUtil=require(_0x8ccf('0x17'));var db=require(_0x8ccf('0x18'))['db'];function respondWithStatusCode(_0x46f844,_0x22844d){_0x22844d=_0x22844d||0xcc;return function(_0x13f59d){if(_0x13f59d){return _0x46f844['sendStatus'](_0x22844d);}return _0x46f844[_0x8ccf('0x19')](_0x22844d)[_0x8ccf('0x1a')]();};}function respondWithResult(_0x5aae9f,_0x40013f){_0x40013f=_0x40013f||0xc8;return function(_0x31c927){if(_0x31c927){return _0x5aae9f[_0x8ccf('0x19')](_0x40013f)[_0x8ccf('0x1b')](_0x31c927);}};}function respondWithFilteredResult(_0x5d77a8,_0x1b4477){return function(_0x5b19e2){if(_0x5b19e2){var _0x348e27=typeof _0x1b4477['offset']===_0x8ccf('0x1c')&&typeof _0x1b4477['limit']===_0x8ccf('0x1c');var _0x244870=_0x5b19e2['count'];var _0x43c283=_0x348e27?0x0:_0x1b4477[_0x8ccf('0x1d')];var _0x156517=_0x348e27?_0x5b19e2[_0x8ccf('0x1e')]:_0x1b4477[_0x8ccf('0x1d')]+_0x1b4477[_0x8ccf('0x1f')];var _0x4f0053;if(_0x156517>=_0x244870){_0x156517=_0x244870;_0x4f0053=0xc8;}else{_0x4f0053=0xce;}_0x5d77a8['status'](_0x4f0053);return _0x5d77a8[_0x8ccf('0x20')](_0x8ccf('0x21'),_0x43c283+'-'+_0x156517+'/'+_0x244870)[_0x8ccf('0x1b')](_0x5b19e2);}return null;};}function patchUpdates(_0x1fb84a){return function(_0x283c31){try{jsonpatch[_0x8ccf('0x22')](_0x283c31,_0x1fb84a,!![]);}catch(_0x13d995){return BPromise[_0x8ccf('0x23')](_0x13d995);}return _0x283c31[_0x8ccf('0x24')]();};}function saveUpdates(_0x37b7d3,_0x5ecbc1){return function(_0x38030a){if(_0x38030a){return _0x38030a[_0x8ccf('0x25')](_0x37b7d3)[_0x8ccf('0x26')](function(_0x534d9c){return _0x534d9c;});}return null;};}function removeEntity(_0x2ab1e6,_0x4c8ca9){return function(_0x270560){if(_0x270560){return _0x270560[_0x8ccf('0x27')]()[_0x8ccf('0x26')](function(){_0x2ab1e6['status'](0xcc)[_0x8ccf('0x1a')]();});}};}function handleEntityNotFound(_0x4236f6,_0x4c7b77){return function(_0x4786c6){if(!_0x4786c6){_0x4236f6[_0x8ccf('0x28')](0x194);}return _0x4786c6;};}function handleError(_0x2ab694,_0x4a55c3){_0x4a55c3=_0x4a55c3||0x1f4;return function(_0x647971){logger[_0x8ccf('0x29')](_0x647971[_0x8ccf('0x2a')]);if(_0x647971[_0x8ccf('0x2b')]){delete _0x647971[_0x8ccf('0x2b')];}_0x2ab694[_0x8ccf('0x19')](_0x4a55c3)[_0x8ccf('0x2c')](_0x647971);};}exports[_0x8ccf('0x2d')]=function(_0x4189bc,_0x272fda){var _0x2c93d6={},_0x117c5e={},_0x50ff3a={'count':0x0,'rows':[]};var _0x5953ec=_['map'](db[_0x8ccf('0x2e')][_0x8ccf('0x2f')],function(_0x425163){return{'name':_0x425163[_0x8ccf('0x30')],'type':_0x425163[_0x8ccf('0x31')][_0x8ccf('0x32')]};});_0x117c5e[_0x8ccf('0x33')]=_['map'](_0x5953ec,_0x8ccf('0x2b'));_0x117c5e[_0x8ccf('0x34')]=_[_0x8ccf('0x35')](_0x4189bc[_0x8ccf('0x34')]);_0x117c5e[_0x8ccf('0x36')]=_[_0x8ccf('0x37')](_0x117c5e[_0x8ccf('0x33')],_0x117c5e[_0x8ccf('0x34')]);_0x2c93d6[_0x8ccf('0x38')]=_[_0x8ccf('0x37')](_0x117c5e[_0x8ccf('0x33')],qs['fields'](_0x4189bc[_0x8ccf('0x34')][_0x8ccf('0x39')]));_0x2c93d6[_0x8ccf('0x38')]=_0x2c93d6[_0x8ccf('0x38')][_0x8ccf('0x3a')]?_0x2c93d6[_0x8ccf('0x38')]:_0x117c5e[_0x8ccf('0x33')];if(!_0x4189bc[_0x8ccf('0x34')][_0x8ccf('0x3b')]('nolimit')){_0x2c93d6[_0x8ccf('0x1f')]=qs[_0x8ccf('0x1f')](_0x4189bc[_0x8ccf('0x34')][_0x8ccf('0x1f')]);_0x2c93d6[_0x8ccf('0x1d')]=qs[_0x8ccf('0x1d')](_0x4189bc['query'][_0x8ccf('0x1d')]);}_0x2c93d6[_0x8ccf('0x3c')]=qs[_0x8ccf('0x3d')](_0x4189bc[_0x8ccf('0x34')][_0x8ccf('0x3d')]);_0x2c93d6['where']=qs[_0x8ccf('0x36')](_['pick'](_0x4189bc[_0x8ccf('0x34')],_0x117c5e[_0x8ccf('0x36')]),_0x5953ec);if(_0x4189bc[_0x8ccf('0x34')][_0x8ccf('0x3e')]){_0x2c93d6[_0x8ccf('0x3f')]=_[_0x8ccf('0x40')](_0x2c93d6[_0x8ccf('0x3f')],{'$or':_[_0x8ccf('0x41')](_0x5953ec,function(_0x5d8fe8){if(_0x5d8fe8['type']!=='VIRTUAL'){var _0x5065f8={};_0x5065f8[_0x5d8fe8[_0x8ccf('0x2b')]]={'$like':'%'+_0x4189bc[_0x8ccf('0x34')][_0x8ccf('0x3e')]+'%'};return _0x5065f8;}})});}_0x2c93d6=_[_0x8ccf('0x40')]({},_0x2c93d6,_0x4189bc[_0x8ccf('0x42')]);var _0x13f7e3={'where':_0x2c93d6[_0x8ccf('0x3f')]};return db['OpenchannelApplication'][_0x8ccf('0x1e')](_0x13f7e3)['then'](function(_0x5eb610){_0x50ff3a[_0x8ccf('0x1e')]=_0x5eb610;if(_0x4189bc[_0x8ccf('0x34')][_0x8ccf('0x43')]){_0x2c93d6['include']=[{'all':!![]}];}return db[_0x8ccf('0x2e')][_0x8ccf('0x44')](_0x2c93d6);})['then'](function(_0x1953d5){_0x50ff3a[_0x8ccf('0x45')]=_0x1953d5;return _0x50ff3a;})[_0x8ccf('0x26')](respondWithFilteredResult(_0x272fda,_0x2c93d6))[_0x8ccf('0x46')](handleError(_0x272fda,null));};exports[_0x8ccf('0x47')]=function(_0x2f23ff,_0x15e8af){var _0x2805e9={'raw':!![],'where':{'id':_0x2f23ff[_0x8ccf('0x48')]['id']}},_0x8182e3={};_0x8182e3[_0x8ccf('0x33')]=_['keys'](db[_0x8ccf('0x2e')]['rawAttributes']);_0x8182e3[_0x8ccf('0x34')]=_[_0x8ccf('0x35')](_0x2f23ff[_0x8ccf('0x34')]);_0x8182e3[_0x8ccf('0x36')]=_[_0x8ccf('0x37')](_0x8182e3['model'],_0x8182e3[_0x8ccf('0x34')]);_0x2805e9[_0x8ccf('0x38')]=_[_0x8ccf('0x37')](_0x8182e3[_0x8ccf('0x33')],qs[_0x8ccf('0x39')](_0x2f23ff[_0x8ccf('0x34')]['fields']));_0x2805e9[_0x8ccf('0x38')]=_0x2805e9['attributes']['length']?_0x2805e9[_0x8ccf('0x38')]:_0x8182e3[_0x8ccf('0x33')];if(_0x2f23ff[_0x8ccf('0x34')]['includeAll']){_0x2805e9['include']=[{'all':!![]}];}_0x2805e9=_[_0x8ccf('0x40')]({},_0x2805e9,_0x2f23ff[_0x8ccf('0x42')]);return db[_0x8ccf('0x2e')][_0x8ccf('0x49')](_0x2805e9)[_0x8ccf('0x26')](handleEntityNotFound(_0x15e8af,null))['then'](respondWithResult(_0x15e8af,null))['catch'](handleError(_0x15e8af,null));};exports[_0x8ccf('0x4a')]=function(_0xa33e87,_0x5c0042){return db[_0x8ccf('0x2e')][_0x8ccf('0x4a')](_0xa33e87[_0x8ccf('0x4b')],{})[_0x8ccf('0x26')](respondWithResult(_0x5c0042,0xc9))[_0x8ccf('0x46')](handleError(_0x5c0042,null));};exports[_0x8ccf('0x25')]=function(_0x13aa86,_0x19234b){if(_0x13aa86[_0x8ccf('0x4b')]['id']){delete _0x13aa86[_0x8ccf('0x4b')]['id'];}return db[_0x8ccf('0x2e')][_0x8ccf('0x49')]({'where':{'id':_0x13aa86[_0x8ccf('0x48')]['id']}})['then'](handleEntityNotFound(_0x19234b,null))['then'](saveUpdates(_0x13aa86['body'],null))[_0x8ccf('0x26')](respondWithResult(_0x19234b,null))[_0x8ccf('0x46')](handleError(_0x19234b,null));};exports['destroy']=function(_0xf76d0c,_0x4f2462){return db[_0x8ccf('0x2e')][_0x8ccf('0x49')]({'where':{'id':_0xf76d0c[_0x8ccf('0x48')]['id']}})['then'](handleEntityNotFound(_0x4f2462,null))[_0x8ccf('0x26')](removeEntity(_0x4f2462,null))['catch'](handleError(_0x4f2462,null));}; \ No newline at end of file +var _0xa4a5=['includeAll','include','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','apply','save','update','destroy','then','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x14a513,_0x3239f){var _0x47236c=function(_0x394191){while(--_0x394191){_0x14a513['push'](_0x14a513['shift']());}};_0x47236c(++_0x3239f);}(_0xa4a5,0x1b8));var _0x5a4a=function(_0x2e682a,_0x562a1c){_0x2e682a=_0x2e682a-0x0;var _0x156848=_0xa4a5[_0x2e682a];return _0x156848;};'use strict';var emlformat=require(_0x5a4a('0x0'));var rimraf=require(_0x5a4a('0x1'));var zipdir=require(_0x5a4a('0x2'));var jsonpatch=require(_0x5a4a('0x3'));var rp=require(_0x5a4a('0x4'));var moment=require(_0x5a4a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5a4a('0x6'));var util=require(_0x5a4a('0x7'));var path=require(_0x5a4a('0x8'));var sox=require(_0x5a4a('0x9'));var csv=require('to-csv');var ejs=require(_0x5a4a('0xa'));var fs=require('fs');var fs_extra=require(_0x5a4a('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5a4a('0xc'));var jsforce=require(_0x5a4a('0xd'));var deskjs=require(_0x5a4a('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5a4a('0xf'));var Papa=require('papaparse');var Redis=require(_0x5a4a('0x10'));var authService=require(_0x5a4a('0x11'));var qs=require(_0x5a4a('0x12'));var as=require(_0x5a4a('0x13'));var hardwareService=require(_0x5a4a('0x14'));var logger=require(_0x5a4a('0x15'))(_0x5a4a('0x16'));var utils=require(_0x5a4a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x5a4a('0x18'));var db=require(_0x5a4a('0x19'))['db'];function respondWithStatusCode(_0x1cbf6a,_0xb87dd3){_0xb87dd3=_0xb87dd3||0xcc;return function(_0x377295){if(_0x377295){return _0x1cbf6a['sendStatus'](_0xb87dd3);}return _0x1cbf6a[_0x5a4a('0x1a')](_0xb87dd3)['end']();};}function respondWithResult(_0x1cef14,_0x4d3038){_0x4d3038=_0x4d3038||0xc8;return function(_0x4dad5c){if(_0x4dad5c){return _0x1cef14[_0x5a4a('0x1a')](_0x4d3038)[_0x5a4a('0x1b')](_0x4dad5c);}};}function respondWithFilteredResult(_0x1f26ba,_0xa668b){return function(_0x356168){if(_0x356168){var _0x313dda=typeof _0xa668b[_0x5a4a('0x1c')]==='undefined'&&typeof _0xa668b[_0x5a4a('0x1d')]===_0x5a4a('0x1e');var _0x5353ee=_0x356168[_0x5a4a('0x1f')];var _0x39dbcc=_0x313dda?0x0:_0xa668b[_0x5a4a('0x1c')];var _0x21ce01=_0x313dda?_0x356168[_0x5a4a('0x1f')]:_0xa668b[_0x5a4a('0x1c')]+_0xa668b[_0x5a4a('0x1d')];var _0x237dcf;if(_0x21ce01>=_0x5353ee){_0x21ce01=_0x5353ee;_0x237dcf=0xc8;}else{_0x237dcf=0xce;}_0x1f26ba[_0x5a4a('0x1a')](_0x237dcf);return _0x1f26ba[_0x5a4a('0x20')]('Content-Range',_0x39dbcc+'-'+_0x21ce01+'/'+_0x5353ee)['json'](_0x356168);}return null;};}function patchUpdates(_0x39cc00){return function(_0x3ab856){try{jsonpatch[_0x5a4a('0x21')](_0x3ab856,_0x39cc00,!![]);}catch(_0x4e3337){return BPromise['reject'](_0x4e3337);}return _0x3ab856[_0x5a4a('0x22')]();};}function saveUpdates(_0x3c8020,_0x54229c){return function(_0xbe2572){if(_0xbe2572){return _0xbe2572[_0x5a4a('0x23')](_0x3c8020)['then'](function(_0x4346a7){return _0x4346a7;});}return null;};}function removeEntity(_0x37f8f2,_0x127150){return function(_0x11dd43){if(_0x11dd43){return _0x11dd43[_0x5a4a('0x24')]()[_0x5a4a('0x25')](function(){_0x37f8f2[_0x5a4a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x167ef1,_0x1c3922){return function(_0xa60e7e){if(!_0xa60e7e){_0x167ef1['sendStatus'](0x194);}return _0xa60e7e;};}function handleError(_0x2ad387,_0x2dcb96){_0x2dcb96=_0x2dcb96||0x1f4;return function(_0x556400){logger[_0x5a4a('0x26')](_0x556400[_0x5a4a('0x27')]);if(_0x556400['name']){delete _0x556400[_0x5a4a('0x28')];}_0x2ad387[_0x5a4a('0x1a')](_0x2dcb96)[_0x5a4a('0x29')](_0x556400);};}exports[_0x5a4a('0x2a')]=function(_0x18ffa0,_0x405f02){var _0x5d7cd4={},_0x560238={},_0x514820={'count':0x0,'rows':[]};var _0xff1420=_[_0x5a4a('0x2b')](db[_0x5a4a('0x2c')][_0x5a4a('0x2d')],function(_0x9d80f3){return{'name':_0x9d80f3[_0x5a4a('0x2e')],'type':_0x9d80f3['type']['key']};});_0x560238[_0x5a4a('0x2f')]=_[_0x5a4a('0x2b')](_0xff1420,_0x5a4a('0x28'));_0x560238['query']=_[_0x5a4a('0x30')](_0x18ffa0[_0x5a4a('0x31')]);_0x560238[_0x5a4a('0x32')]=_[_0x5a4a('0x33')](_0x560238[_0x5a4a('0x2f')],_0x560238[_0x5a4a('0x31')]);_0x5d7cd4[_0x5a4a('0x34')]=_[_0x5a4a('0x33')](_0x560238[_0x5a4a('0x2f')],qs[_0x5a4a('0x35')](_0x18ffa0[_0x5a4a('0x31')][_0x5a4a('0x35')]));_0x5d7cd4[_0x5a4a('0x34')]=_0x5d7cd4[_0x5a4a('0x34')][_0x5a4a('0x36')]?_0x5d7cd4[_0x5a4a('0x34')]:_0x560238['model'];if(!_0x18ffa0[_0x5a4a('0x31')][_0x5a4a('0x37')](_0x5a4a('0x38'))){_0x5d7cd4[_0x5a4a('0x1d')]=qs[_0x5a4a('0x1d')](_0x18ffa0[_0x5a4a('0x31')][_0x5a4a('0x1d')]);_0x5d7cd4[_0x5a4a('0x1c')]=qs[_0x5a4a('0x1c')](_0x18ffa0['query'][_0x5a4a('0x1c')]);}_0x5d7cd4['order']=qs[_0x5a4a('0x39')](_0x18ffa0[_0x5a4a('0x31')]['sort']);_0x5d7cd4[_0x5a4a('0x3a')]=qs[_0x5a4a('0x32')](_[_0x5a4a('0x3b')](_0x18ffa0[_0x5a4a('0x31')],_0x560238[_0x5a4a('0x32')]),_0xff1420);if(_0x18ffa0['query'][_0x5a4a('0x3c')]){_0x5d7cd4[_0x5a4a('0x3a')]=_[_0x5a4a('0x3d')](_0x5d7cd4[_0x5a4a('0x3a')],{'$or':_[_0x5a4a('0x2b')](_0xff1420,function(_0x41bdfa){if(_0x41bdfa['type']!==_0x5a4a('0x3e')){var _0x56d9ab={};_0x56d9ab[_0x41bdfa[_0x5a4a('0x28')]]={'$like':'%'+_0x18ffa0['query']['filter']+'%'};return _0x56d9ab;}})});}_0x5d7cd4=_[_0x5a4a('0x3d')]({},_0x5d7cd4,_0x18ffa0[_0x5a4a('0x3f')]);var _0xf5c8e6={'where':_0x5d7cd4[_0x5a4a('0x3a')]};return db['OpenchannelApplication'][_0x5a4a('0x1f')](_0xf5c8e6)[_0x5a4a('0x25')](function(_0x127ef2){_0x514820['count']=_0x127ef2;if(_0x18ffa0[_0x5a4a('0x31')][_0x5a4a('0x40')]){_0x5d7cd4[_0x5a4a('0x41')]=[{'all':!![]}];}return db[_0x5a4a('0x2c')]['findAll'](_0x5d7cd4);})[_0x5a4a('0x25')](function(_0x251efd){_0x514820['rows']=_0x251efd;return _0x514820;})[_0x5a4a('0x25')](respondWithFilteredResult(_0x405f02,_0x5d7cd4))[_0x5a4a('0x42')](handleError(_0x405f02,null));};exports[_0x5a4a('0x43')]=function(_0x3892c8,_0x4c0b45){var _0x1d3218={'raw':!![],'where':{'id':_0x3892c8[_0x5a4a('0x44')]['id']}},_0x2523d6={};_0x2523d6[_0x5a4a('0x2f')]=_['keys'](db[_0x5a4a('0x2c')][_0x5a4a('0x2d')]);_0x2523d6[_0x5a4a('0x31')]=_['keys'](_0x3892c8['query']);_0x2523d6[_0x5a4a('0x32')]=_[_0x5a4a('0x33')](_0x2523d6[_0x5a4a('0x2f')],_0x2523d6[_0x5a4a('0x31')]);_0x1d3218['attributes']=_[_0x5a4a('0x33')](_0x2523d6[_0x5a4a('0x2f')],qs[_0x5a4a('0x35')](_0x3892c8[_0x5a4a('0x31')]['fields']));_0x1d3218[_0x5a4a('0x34')]=_0x1d3218['attributes'][_0x5a4a('0x36')]?_0x1d3218[_0x5a4a('0x34')]:_0x2523d6[_0x5a4a('0x2f')];if(_0x3892c8[_0x5a4a('0x31')]['includeAll']){_0x1d3218[_0x5a4a('0x41')]=[{'all':!![]}];}_0x1d3218=_[_0x5a4a('0x3d')]({},_0x1d3218,_0x3892c8[_0x5a4a('0x3f')]);return db[_0x5a4a('0x2c')]['find'](_0x1d3218)[_0x5a4a('0x25')](handleEntityNotFound(_0x4c0b45,null))['then'](respondWithResult(_0x4c0b45,null))[_0x5a4a('0x42')](handleError(_0x4c0b45,null));};exports[_0x5a4a('0x45')]=function(_0x125f94,_0x22d42e){return db[_0x5a4a('0x2c')][_0x5a4a('0x45')](_0x125f94['body'],{})[_0x5a4a('0x25')](respondWithResult(_0x22d42e,0xc9))[_0x5a4a('0x42')](handleError(_0x22d42e,null));};exports['update']=function(_0x3876a0,_0x4b75c8){if(_0x3876a0['body']['id']){delete _0x3876a0[_0x5a4a('0x46')]['id'];}return db['OpenchannelApplication']['find']({'where':{'id':_0x3876a0[_0x5a4a('0x44')]['id']}})[_0x5a4a('0x25')](handleEntityNotFound(_0x4b75c8,null))['then'](saveUpdates(_0x3876a0['body'],null))[_0x5a4a('0x25')](respondWithResult(_0x4b75c8,null))[_0x5a4a('0x42')](handleError(_0x4b75c8,null));};exports[_0x5a4a('0x24')]=function(_0x1ad8ca,_0x536b31){return db[_0x5a4a('0x2c')][_0x5a4a('0x47')]({'where':{'id':_0x1ad8ca[_0x5a4a('0x44')]['id']}})[_0x5a4a('0x25')](handleEntityNotFound(_0x536b31,null))['then'](removeEntity(_0x536b31,null))[_0x5a4a('0x42')](handleError(_0x536b31,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 8abf2d8..ccaa418 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 _0xd425=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelApplication.attributes','exports','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd425,0xef));var _0x5d42=function(_0x5c094f,_0x5e752b){_0x5c094f=_0x5c094f-0x0;var _0x37b476=_0xd425[_0x5c094f];return _0x37b476;};'use strict';var _=require('lodash');var util=require(_0x5d42('0x0'));var logger=require('../../config/logger')(_0x5d42('0x1'));var moment=require(_0x5d42('0x2'));var BPromise=require(_0x5d42('0x3'));var rp=require(_0x5d42('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5d42('0x5'));var config=require(_0x5d42('0x6'));var attributes=require(_0x5d42('0x7'));module[_0x5d42('0x8')]=function(_0x15d226,_0x38e6c2){return _0x15d226['define']('OpenchannelApplication',attributes,{'tableName':_0x5d42('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5d42('0xa'),'collate':_0x5d42('0xb')});}; \ No newline at end of file +var _0x965c=['../../config/environment','./openchannelApplication.attributes','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','api','moment','bluebird','request-promise','path'];(function(_0x167832,_0x5e8201){var _0x2ef6bc=function(_0x29a935){while(--_0x29a935){_0x167832['push'](_0x167832['shift']());}};_0x2ef6bc(++_0x5e8201);}(_0x965c,0x14b));var _0xc965=function(_0xef9f7f,_0x259a17){_0xef9f7f=_0xef9f7f-0x0;var _0x6ca606=_0x965c[_0xef9f7f];return _0x6ca606;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xc965('0x0'));var moment=require(_0xc965('0x1'));var BPromise=require(_0xc965('0x2'));var rp=require(_0xc965('0x3'));var fs=require('fs');var path=require(_0xc965('0x4'));var rimraf=require('rimraf');var config=require(_0xc965('0x5'));var attributes=require(_0xc965('0x6'));module['exports']=function(_0x668dfa,_0x27164d){return _0x668dfa[_0xc965('0x7')](_0xc965('0x8'),attributes,{'tableName':_0xc965('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc965('0xa'),'collate':_0xc965('0xb')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index ba38ff0..6d59911 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 _0x2fa0=['jayson/promise','client','request','info','request\x20sent','debug','stringify','error','code','OpenchannelApplication,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','options','where','attributes','limit','then','lodash','util','moment','randomstring','ioredis','rpc','../../config/environment'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x2fa0,0xd9));var _0x02fa=function(_0xceaad8,_0x513144){_0xceaad8=_0xceaad8-0x0;var _0x253827=_0x2fa0[_0xceaad8];return _0x253827;};'use strict';var _=require(_0x02fa('0x0'));var util=require(_0x02fa('0x1'));var moment=require(_0x02fa('0x2'));var BPromise=require('bluebird');var rs=require(_0x02fa('0x3'));var fs=require('fs');var Redis=require(_0x02fa('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x02fa('0x5'));var config=require(_0x02fa('0x6'));var jayson=require(_0x02fa('0x7'));var client=jayson[_0x02fa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x359b77,_0x392fe3,_0x10f80f){return new BPromise(function(_0x424bc9,_0x40d193){return client[_0x02fa('0x9')](_0x359b77,_0x10f80f)['then'](function(_0x2c9f11){logger[_0x02fa('0xa')]('OpenchannelApplication,\x20%s,\x20%s',_0x392fe3,_0x02fa('0xb'));logger[_0x02fa('0xc')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x392fe3,'request\x20sent',JSON[_0x02fa('0xd')](_0x2c9f11));if(_0x2c9f11[_0x02fa('0xe')]){if(_0x2c9f11['error'][_0x02fa('0xf')]===0x1f4){logger['error'](_0x02fa('0x10'),_0x392fe3,_0x2c9f11['error']['message']);return _0x40d193(_0x2c9f11[_0x02fa('0xe')]['message']);}logger[_0x02fa('0xe')](_0x02fa('0x10'),_0x392fe3,_0x2c9f11[_0x02fa('0xe')][_0x02fa('0x11')]);return _0x424bc9(_0x2c9f11[_0x02fa('0xe')]['message']);}else{logger['info'](_0x02fa('0x10'),_0x392fe3,_0x02fa('0xb'));_0x424bc9(_0x2c9f11[_0x02fa('0x12')][_0x02fa('0x11')]);}})[_0x02fa('0x13')](function(_0xe23a89){logger[_0x02fa('0xe')](_0x02fa('0x10'),_0x392fe3,_0xe23a89);_0x40d193(_0xe23a89);});});}exports[_0x02fa('0x14')]=function(_0x4d2602){var _0x2bd25f=this;return new Promise(function(_0x501c1a,_0x572fbd){return db[_0x02fa('0x15')][_0x02fa('0x16')](_0x4d2602['body'],{'raw':_0x4d2602[_0x02fa('0x17')]?_0x4d2602[_0x02fa('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d2602[_0x02fa('0x17')]?_0x4d2602['options'][_0x02fa('0x18')]||null:null,'attributes':_0x4d2602['options']?_0x4d2602[_0x02fa('0x17')][_0x02fa('0x19')]||null:null,'limit':_0x4d2602[_0x02fa('0x17')]?_0x4d2602['options'][_0x02fa('0x1a')]||null:null})[_0x02fa('0x1b')](function(_0x597837){logger[_0x02fa('0xa')](_0x02fa('0x14'),_0x4d2602);logger[_0x02fa('0xc')](_0x02fa('0x14'),_0x4d2602,JSON[_0x02fa('0xd')](_0x597837));_0x501c1a(_0x597837);})[_0x02fa('0x13')](function(_0x23a2cd){logger[_0x02fa('0xe')]('UpdateOpenchannelApplication',_0x23a2cd[_0x02fa('0x11')],_0x4d2602);_0x572fbd(_0x2bd25f[_0x02fa('0xe')](0x1f4,_0x23a2cd[_0x02fa('0x11')]));});});}; \ No newline at end of file +var _0xb502=['message','OpenchannelApplication,\x20%s,\x20%s','result','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','where','then','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','info','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4b943f,_0x152a5f){var _0x108c00=function(_0x3e00e7){while(--_0x3e00e7){_0x4b943f['push'](_0x4b943f['shift']());}};_0x108c00(++_0x152a5f);}(_0xb502,0x1eb));var _0x2b50=function(_0x5cbeb0,_0x1fec37){_0x5cbeb0=_0x5cbeb0-0x0;var _0x2d4048=_0xb502[_0x5cbeb0];return _0x2d4048;};'use strict';var _=require(_0x2b50('0x0'));var util=require(_0x2b50('0x1'));var moment=require(_0x2b50('0x2'));var BPromise=require(_0x2b50('0x3'));var rs=require(_0x2b50('0x4'));var fs=require('fs');var Redis=require(_0x2b50('0x5'));var db=require(_0x2b50('0x6'))['db'];var utils=require(_0x2b50('0x7'));var logger=require(_0x2b50('0x8'))('rpc');var config=require(_0x2b50('0x9'));var jayson=require(_0x2b50('0xa'));var client=jayson['client'][_0x2b50('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36f034,_0x57be1f,_0x31c542){return new BPromise(function(_0x2b0216,_0x5cda3b){return client['request'](_0x36f034,_0x31c542)['then'](function(_0x429c6b){logger[_0x2b50('0xc')]('OpenchannelApplication,\x20%s,\x20%s',_0x57be1f,_0x2b50('0xd'));logger[_0x2b50('0xe')](_0x2b50('0xf'),_0x57be1f,_0x2b50('0xd'),JSON[_0x2b50('0x10')](_0x429c6b));if(_0x429c6b[_0x2b50('0x11')]){if(_0x429c6b['error'][_0x2b50('0x12')]===0x1f4){logger[_0x2b50('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x57be1f,_0x429c6b[_0x2b50('0x11')][_0x2b50('0x13')]);return _0x5cda3b(_0x429c6b[_0x2b50('0x11')][_0x2b50('0x13')]);}logger[_0x2b50('0x11')](_0x2b50('0x14'),_0x57be1f,_0x429c6b[_0x2b50('0x11')][_0x2b50('0x13')]);return _0x2b0216(_0x429c6b[_0x2b50('0x11')]['message']);}else{logger[_0x2b50('0xc')](_0x2b50('0x14'),_0x57be1f,_0x2b50('0xd'));_0x2b0216(_0x429c6b[_0x2b50('0x15')][_0x2b50('0x13')]);}})['catch'](function(_0x225910){logger[_0x2b50('0x11')](_0x2b50('0x14'),_0x57be1f,_0x225910);_0x5cda3b(_0x225910);});});}exports[_0x2b50('0x16')]=function(_0x4bf00e){var _0x2a04d2=this;return new Promise(function(_0x4c6e8e,_0x54dd7c){return db[_0x2b50('0x17')][_0x2b50('0x18')](_0x4bf00e[_0x2b50('0x19')],{'raw':_0x4bf00e[_0x2b50('0x1a')]?_0x4bf00e[_0x2b50('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4bf00e[_0x2b50('0x1a')]?_0x4bf00e[_0x2b50('0x1a')][_0x2b50('0x1b')]||null:null,'attributes':_0x4bf00e[_0x2b50('0x1a')]?_0x4bf00e[_0x2b50('0x1a')]['attributes']||null:null,'limit':_0x4bf00e[_0x2b50('0x1a')]?_0x4bf00e[_0x2b50('0x1a')]['limit']||null:null})[_0x2b50('0x1c')](function(_0x34bc1d){logger[_0x2b50('0xc')]('UpdateOpenchannelApplication',_0x4bf00e);logger[_0x2b50('0xe')](_0x2b50('0x16'),_0x4bf00e,JSON['stringify'](_0x34bc1d));_0x4c6e8e(_0x34bc1d);})[_0x2b50('0x1d')](function(_0x493e4c){logger['error'](_0x2b50('0x16'),_0x493e4c[_0x2b50('0x13')],_0x4bf00e);_0x54dd7c(_0x2a04d2[_0x2b50('0x11')](0x1f4,_0x493e4c[_0x2b50('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 5e5ec5f..f43ee58 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 _0x5303=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','create','post','/:id/tags','tracked','addTags','put','openchannel','openchannelinteraction:update','update','delete','destroy','removeTags','exports','multer','util','path'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0x5303,0xd6));var _0x3530=function(_0xd8cd30,_0x44ec43){_0xd8cd30=_0xd8cd30-0x0;var _0x254f3d=_0x5303[_0xd8cd30];return _0x254f3d;};'use strict';var multer=require(_0x3530('0x0'));var util=require(_0x3530('0x1'));var path=require(_0x3530('0x2'));var timeout=require(_0x3530('0x3'));var express=require(_0x3530('0x4'));var router=express[_0x3530('0x5')]();var fs_extra=require(_0x3530('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x3530('0x7'));var config=require('../../config/environment');var controller=require('./openchannelInteraction.controller');router[_0x3530('0x8')]('/',auth[_0x3530('0x9')](),controller[_0x3530('0xa')]);router[_0x3530('0x8')](_0x3530('0xb'),auth['isAuthenticated'](),controller[_0x3530('0xc')]);router[_0x3530('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x3530('0xd')]);router[_0x3530('0x8')](_0x3530('0xe'),auth[_0x3530('0x9')](),controller[_0x3530('0xf')]);router[_0x3530('0x8')](_0x3530('0x10'),auth[_0x3530('0x9')](),controller[_0x3530('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3530('0x12')]);router[_0x3530('0x13')](_0x3530('0xe'),auth[_0x3530('0x9')](),controller['addMessage']);router[_0x3530('0x13')](_0x3530('0x14'),auth[_0x3530('0x9')](),interaction[_0x3530('0x15')]('openchannel','openchannelinteraction:addtags'),controller[_0x3530('0x16')]);router[_0x3530('0x17')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x3530('0x18'),_0x3530('0x19')),controller[_0x3530('0x1a')]);router[_0x3530('0x1b')]('/:id',auth[_0x3530('0x9')](),interaction[_0x3530('0x15')](_0x3530('0x18'),'openchannelinteraction:destroy'),controller[_0x3530('0x1c')]);router[_0x3530('0x1b')](_0x3530('0x14'),auth[_0x3530('0x9')](),controller[_0x3530('0x1d')]);module[_0x3530('0x1e')]=router; \ No newline at end of file +var _0xf779=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','getMessages','download','post','addMessage','/:id/tags','tracked','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','delete','openchannel','destroy','removeTags','exports','multer'];(function(_0x96fb1f,_0x57d870){var _0x44ff95=function(_0x421707){while(--_0x421707){_0x96fb1f['push'](_0x96fb1f['shift']());}};_0x44ff95(++_0x57d870);}(_0xf779,0xa4));var _0x9f77=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf779[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9f77('0x0'));var util=require(_0x9f77('0x1'));var path=require(_0x9f77('0x2'));var timeout=require(_0x9f77('0x3'));var express=require(_0x9f77('0x4'));var router=express[_0x9f77('0x5')]();var fs_extra=require(_0x9f77('0x6'));var auth=require(_0x9f77('0x7'));var interaction=require(_0x9f77('0x8'));var config=require(_0x9f77('0x9'));var controller=require(_0x9f77('0xa'));router[_0x9f77('0xb')]('/',auth[_0x9f77('0xc')](),controller['index']);router[_0x9f77('0xb')](_0x9f77('0xd'),auth[_0x9f77('0xc')](),controller[_0x9f77('0xe')]);router[_0x9f77('0xb')](_0x9f77('0xf'),auth[_0x9f77('0xc')](),controller[_0x9f77('0x10')]);router[_0x9f77('0xb')]('/:id/messages',auth[_0x9f77('0xc')](),controller[_0x9f77('0x11')]);router[_0x9f77('0xb')]('/:id/download',auth[_0x9f77('0xc')](),controller[_0x9f77('0x12')]);router[_0x9f77('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9f77('0x13')]('/:id/messages',auth[_0x9f77('0xc')](),controller[_0x9f77('0x14')]);router[_0x9f77('0x13')](_0x9f77('0x15'),auth[_0x9f77('0xc')](),interaction[_0x9f77('0x16')]('openchannel',_0x9f77('0x17')),controller[_0x9f77('0x18')]);router[_0x9f77('0x19')](_0x9f77('0xf'),auth[_0x9f77('0xc')](),interaction[_0x9f77('0x16')]('openchannel',_0x9f77('0x1a')),controller[_0x9f77('0x1b')]);router[_0x9f77('0x1c')](_0x9f77('0xf'),auth[_0x9f77('0xc')](),interaction[_0x9f77('0x16')](_0x9f77('0x1d'),'openchannelinteraction:destroy'),controller[_0x9f77('0x1e')]);router[_0x9f77('0x1c')](_0x9f77('0x15'),auth[_0x9f77('0xc')](),controller[_0x9f77('0x1f')]);module[_0x9f77('0x20')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 70a32f9..759475f 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 _0x97d5=['STRING','ENUM','out','sequelize','exports','BOOLEAN','DATE'];(function(_0x23c31a,_0xdc4107){var _0x4d5585=function(_0x1b5d46){while(--_0x1b5d46){_0x23c31a['push'](_0x23c31a['shift']());}};_0x4d5585(++_0xdc4107);}(_0x97d5,0x199));var _0x597d=function(_0x2d9fec,_0x5a756b){_0x2d9fec=_0x2d9fec-0x0;var _0x6c9177=_0x97d5[_0x2d9fec];return _0x6c9177;};'use strict';var Sequelize=require(_0x597d('0x0'));module[_0x597d('0x1')]={'closed':{'type':Sequelize[_0x597d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x597d('0x3')]},'disposition':{'type':Sequelize[_0x597d('0x4')]},'secondDisposition':{'type':Sequelize[_0x597d('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x597d('0x4')]},'read1stAt':{'type':Sequelize[_0x597d('0x3')]},'threadId':{'type':Sequelize[_0x597d('0x4')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x597d('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x597d('0x5')]('in',_0x597d('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x597d('0x5')]('in',_0x597d('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x597d('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x597d('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xacfe=['STRING','ENUM','out','BOOLEAN','DATE'];(function(_0xba4220,_0x5217a7){var _0x4cdb9d=function(_0x32cae1){while(--_0x32cae1){_0xba4220['push'](_0xba4220['shift']());}};_0x4cdb9d(++_0x5217a7);}(_0xacfe,0xfd));var _0xeacf=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xacfe[_0x618414];return _0x21c19a;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0xeacf('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xeacf('0x1')]},'disposition':{'type':Sequelize[_0xeacf('0x2')]},'secondDisposition':{'type':Sequelize[_0xeacf('0x2')]},'thirdDisposition':{'type':Sequelize[_0xeacf('0x2')]},'note':{'type':Sequelize[_0xeacf('0x2')]},'read1stAt':{'type':Sequelize[_0xeacf('0x1')]},'threadId':{'type':Sequelize[_0xeacf('0x2')]},'externalUrl':{'type':Sequelize[_0xeacf('0x2')]},'lastMsgAt':{'type':Sequelize[_0xeacf('0x1')]},'firstMsgDirection':{'type':Sequelize[_0xeacf('0x3')]('in',_0xeacf('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xeacf('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xeacf('0x2')]},'autoreplyExecuted':{'type':Sequelize[_0xeacf('0x0')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index d8d31ce..6c29156 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 _0x87b5=['transcript-','.pdf','Openchannel','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','sendStatus','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','end','status','json','undefined','limit','count','offset','set','then','destroy','stack','name','send','index','map','rawAttributes','type','getOptions','findAll','openchannel','query','user','catch','show','params','model','keys','intersection','attributes','fields','length','includeAll','include','options','OpenchannelInteraction','find','create','update','body','describe','OpenchannelMessage','addMessage','ids','omit','getMessages','hasOwnProperty','order','sort','pick','filters','where','merge','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','spread','emit','openchannelInteractionTags:save','removeTags','download','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','Attachment','createdAt','direction','read','OpenchannelAccount','Account','Owner','get','mkdirSync','N.A.','toString','closed','closedAt','disposition','Public','Private','existsSync','pipe','createWriteStream','out','System','firstName','lastName','basename','renderFile','views'];(function(_0x4af6eb,_0x459294){var _0x2aaacb=function(_0x507142){while(--_0x507142){_0x4af6eb['push'](_0x4af6eb['shift']());}};_0x2aaacb(++_0x459294);}(_0x87b5,0x181));var _0x587b=function(_0x2f32db,_0x5728da){_0x2f32db=_0x2f32db-0x0;var _0xe2f34f=_0x87b5[_0x2f32db];return _0xe2f34f;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0x587b('0x0'));var util=require(_0x587b('0x1'));var path=require(_0x587b('0x2'));var ejs=require(_0x587b('0x3'));var fs=require('fs');var _=require(_0x587b('0x4'));var Redis=require(_0x587b('0x5'));var interaction=require(_0x587b('0x6'));var qs=require(_0x587b('0x7'));var pdf=require(_0x587b('0x8'));var logger=require(_0x587b('0x9'))(_0x587b('0xa'));var config=require(_0x587b('0xb'));var db=require('../../mysqldb')['db'];config[_0x587b('0xc')]=_[_0x587b('0xd')](config[_0x587b('0xc')],{'host':_0x587b('0xe'),'port':0x18eb});var socket=require(_0x587b('0xf'))(new Redis(config[_0x587b('0xc')]));require('./openchannelInteraction.socket')[_0x587b('0x10')](socket);function respondWithStatusCode(_0xfe97d1,_0x295910){_0x295910=_0x295910||0xcc;return function(_0x334e1b){if(_0x334e1b){return _0xfe97d1['sendStatus'](_0x295910);}return _0xfe97d1['status'](_0x295910)[_0x587b('0x11')]();};}function respondWithResult(_0x1e516e,_0x597bd4){_0x597bd4=_0x597bd4||0xc8;return function(_0x45f7b6){if(_0x45f7b6){return _0x1e516e[_0x587b('0x12')](_0x597bd4)[_0x587b('0x13')](_0x45f7b6);}};}function respondWithFilteredResult(_0x5d7c03,_0x28140f){return function(_0x5e4269){if(_0x5e4269){var _0x21b035=typeof _0x28140f['offset']===_0x587b('0x14')&&typeof _0x28140f[_0x587b('0x15')]===_0x587b('0x14');var _0x4eacb7=_0x5e4269[_0x587b('0x16')];var _0xf7c2b9=_0x21b035?0x0:_0x28140f[_0x587b('0x17')];var _0x3fbb22=_0x21b035?_0x5e4269['count']:_0x28140f[_0x587b('0x17')]+_0x28140f[_0x587b('0x15')];var _0x140586;if(_0x3fbb22>=_0x4eacb7){_0x3fbb22=_0x4eacb7;_0x140586=0xc8;}else{_0x140586=0xce;}_0x5d7c03[_0x587b('0x12')](_0x140586);return _0x5d7c03[_0x587b('0x18')]('Content-Range',_0xf7c2b9+'-'+_0x3fbb22+'/'+_0x4eacb7)[_0x587b('0x13')](_0x5e4269);}return null;};}function saveUpdates(_0x1ea7c8){return function(_0x434ee7){if(_0x434ee7){return _0x434ee7['update'](_0x1ea7c8)[_0x587b('0x19')](function(_0x4c0abd){return _0x4c0abd;});}return null;};}function removeEntity(_0x472398){return function(_0x5085ab){if(_0x5085ab){return _0x5085ab[_0x587b('0x1a')]()[_0x587b('0x19')](function(){_0x472398['status'](0xcc)[_0x587b('0x11')]();});}};}function handleEntityNotFound(_0x3396f9){return function(_0x604e54){if(!_0x604e54){_0x3396f9['sendStatus'](0x194);}return _0x604e54;};}function handleError(_0x10f33c,_0x33429e){_0x33429e=_0x33429e||0x1f4;return function(_0x59c9f7){logger['error'](_0x59c9f7[_0x587b('0x1b')]);if(_0x59c9f7[_0x587b('0x1c')]){delete _0x59c9f7[_0x587b('0x1c')];}_0x10f33c[_0x587b('0x12')](_0x33429e)[_0x587b('0x1d')](_0x59c9f7);};}exports[_0x587b('0x1e')]=function(_0x4dc2c0,_0x57a0e1){var _0x1f72a6={};var _0x1e7b65=_[_0x587b('0x1f')](db['OpenchannelInteraction'][_0x587b('0x20')],function(_0x595e4e){return{'name':_0x595e4e['fieldName'],'type':_0x595e4e[_0x587b('0x21')]['key']};});_0x1f72a6=qs[_0x587b('0x22')](_0x1e7b65,_0x4dc2c0);return interaction[_0x587b('0x23')](_0x587b('0x24'),_0x4dc2c0[_0x587b('0x25')],_0x4dc2c0[_0x587b('0x26')],_0x1f72a6,_0x1e7b65)[_0x587b('0x19')](respondWithFilteredResult(_0x57a0e1,_0x1f72a6))[_0x587b('0x27')](handleError(_0x57a0e1,null));};exports[_0x587b('0x28')]=function(_0x346f87,_0x9db497){var _0x45e5da={};if(_0x346f87[_0x587b('0x25')][_0x587b('0x21')]&&_0x346f87['query'][_0x587b('0x21')]==='from'){_0x45e5da['from']=_0x346f87[_0x587b('0x29')]['id'];}else{_0x45e5da['id']=_0x346f87[_0x587b('0x29')]['id'];}var _0x144645={'raw':![],'where':_0x45e5da},_0x4a4c5f={};_0x4a4c5f[_0x587b('0x2a')]=_[_0x587b('0x2b')](db['OpenchannelInteraction'][_0x587b('0x20')]);_0x4a4c5f[_0x587b('0x25')]=_[_0x587b('0x2b')](_0x346f87[_0x587b('0x25')]);_0x4a4c5f['filters']=_[_0x587b('0x2c')](_0x4a4c5f[_0x587b('0x2a')],_0x4a4c5f[_0x587b('0x25')]);_0x144645[_0x587b('0x2d')]=_[_0x587b('0x2c')](_0x4a4c5f['model'],qs[_0x587b('0x2e')](_0x346f87[_0x587b('0x25')][_0x587b('0x2e')]));_0x144645[_0x587b('0x2d')]=_0x144645[_0x587b('0x2d')][_0x587b('0x2f')]?_0x144645[_0x587b('0x2d')]:_0x4a4c5f[_0x587b('0x2a')];if(_0x346f87[_0x587b('0x25')][_0x587b('0x30')]){_0x144645[_0x587b('0x31')]=[{'all':!![]}];}_0x144645=_['merge']({},_0x144645,_0x346f87[_0x587b('0x32')]);return db[_0x587b('0x33')][_0x587b('0x34')](_0x144645)[_0x587b('0x19')](handleEntityNotFound(_0x9db497,null))[_0x587b('0x19')](respondWithResult(_0x9db497,null))[_0x587b('0x27')](handleError(_0x9db497,null));};exports[_0x587b('0x35')]=function(_0x44fc89,_0x5a125f){return db['OpenchannelInteraction'][_0x587b('0x35')](_0x44fc89['body'],{})[_0x587b('0x19')](respondWithResult(_0x5a125f,0xc9))['catch'](handleError(_0x5a125f,null));};exports[_0x587b('0x36')]=function(_0x4f938c,_0x31ca9d){if(_0x4f938c[_0x587b('0x37')]['id']){delete _0x4f938c['body']['id'];}return db[_0x587b('0x33')]['find']({'where':{'id':_0x4f938c[_0x587b('0x29')]['id']}})[_0x587b('0x19')](handleEntityNotFound(_0x31ca9d,null))[_0x587b('0x19')](saveUpdates(_0x4f938c[_0x587b('0x37')],null))['then'](respondWithResult(_0x31ca9d,null))['catch'](handleError(_0x31ca9d,null));};exports[_0x587b('0x1a')]=function(_0x96ee4a,_0x119be9){return db[_0x587b('0x33')][_0x587b('0x34')]({'where':{'id':_0x96ee4a[_0x587b('0x29')]['id']}})[_0x587b('0x19')](handleEntityNotFound(_0x119be9,null))[_0x587b('0x19')](removeEntity(_0x119be9,null))[_0x587b('0x27')](handleError(_0x119be9,null));};exports[_0x587b('0x38')]=function(_0x16964a,_0x2dd194){return db[_0x587b('0x33')][_0x587b('0x38')]()[_0x587b('0x19')](respondWithResult(_0x2dd194,null))[_0x587b('0x27')](handleError(_0x2dd194,null));};exports['addMessage']=function(_0x36c3f5,_0xc73dd){return db[_0x587b('0x39')]['find']({'where':{'id':_0x36c3f5['params']['id']}})[_0x587b('0x19')](handleEntityNotFound(_0xc73dd,null))[_0x587b('0x19')](function(_0x25cf9c){if(_0x25cf9c){return _0x25cf9c[_0x587b('0x3a')](_0x36c3f5[_0x587b('0x37')][_0x587b('0x3b')],_[_0x587b('0x3c')](_0x36c3f5[_0x587b('0x37')],[_0x587b('0x3b'),'id'])||{});}})[_0x587b('0x19')](respondWithResult(_0xc73dd,null))['catch'](handleError(_0xc73dd,null));};exports[_0x587b('0x3d')]=function(_0x1b1e7b,_0x4c6344){var _0x364a2={'raw':![],'where':{}};var _0x124ac3={};var _0x33c921={'count':0x0,'rows':[]};return db['OpenchannelInteraction']['findOne']({'where':{'id':_0x1b1e7b[_0x587b('0x29')]['id']}})['then'](handleEntityNotFound(_0x4c6344,null))[_0x587b('0x19')](function(_0x33fd18){if(_0x33fd18){_0x124ac3[_0x587b('0x2a')]=_[_0x587b('0x2b')](db[_0x587b('0x39')]['rawAttributes']);_0x124ac3['query']=_[_0x587b('0x2b')](_0x1b1e7b[_0x587b('0x25')]);_0x124ac3['filters']=_[_0x587b('0x2c')](_0x124ac3[_0x587b('0x2a')],_0x124ac3['query']);_0x364a2['attributes']=_[_0x587b('0x2c')](_0x124ac3[_0x587b('0x2a')],qs[_0x587b('0x2e')](_0x1b1e7b[_0x587b('0x25')][_0x587b('0x2e')]));_0x364a2[_0x587b('0x2d')]=_0x364a2[_0x587b('0x2d')][_0x587b('0x2f')]?_0x364a2[_0x587b('0x2d')]:_0x124ac3['model'];if(!_0x1b1e7b[_0x587b('0x25')][_0x587b('0x3e')]('nolimit')){_0x364a2[_0x587b('0x15')]=qs[_0x587b('0x15')](_0x1b1e7b[_0x587b('0x25')][_0x587b('0x15')]);_0x364a2['offset']=qs[_0x587b('0x17')](_0x1b1e7b[_0x587b('0x25')][_0x587b('0x17')]);}_0x364a2[_0x587b('0x3f')]=qs[_0x587b('0x40')](_0x1b1e7b['query'][_0x587b('0x40')]);_0x364a2['where']=qs['filters'](_[_0x587b('0x41')](_0x1b1e7b['query'],_0x124ac3[_0x587b('0x42')]));_0x364a2[_0x587b('0x43')]['OpenchannelInteractionId']=_0x33fd18['id'];if(_0x1b1e7b[_0x587b('0x25')]['filter']){_0x364a2[_0x587b('0x43')]=_[_0x587b('0x44')](_0x364a2[_0x587b('0x43')],{'$or':_[_0x587b('0x1f')](_0x364a2[_0x587b('0x2d')],function(_0xda6ed9){var _0x2e124e={};_0x2e124e[_0xda6ed9]={'$like':'%'+_0x1b1e7b[_0x587b('0x25')][_0x587b('0x45')]+'%'};return _0x2e124e;})});}if(_0x1b1e7b[_0x587b('0x25')]['$gte']){var _0x372d64=_0x1b1e7b[_0x587b('0x25')][_0x587b('0x46')][_0x587b('0x47')](',');var _0x3a9617={};_0x3a9617[_0x372d64[0x0]]={'$gte':moment(_0x372d64[0x1])[_0x587b('0x48')](_0x587b('0x49'))};_0x364a2[_0x587b('0x43')]=_[_0x587b('0x44')](_0x364a2['where'],_0x3a9617);}_0x364a2=_[_0x587b('0x44')]({},_0x364a2,_0x1b1e7b[_0x587b('0x32')]);return db[_0x587b('0x39')]['count']({'where':_0x364a2['where']})[_0x587b('0x19')](function(_0x740457){_0x33c921[_0x587b('0x16')]=_0x740457;if(_0x1b1e7b['query']['includeAll']){_0x364a2[_0x587b('0x31')]=[{'all':!![]}];}return db[_0x587b('0x39')]['findAll'](_0x364a2);})[_0x587b('0x19')](function(_0x458fb8){_0x33c921[_0x587b('0x4a')]=_0x458fb8;return _0x33c921;});}})['then'](respondWithFilteredResult(_0x4c6344,_0x364a2))[_0x587b('0x27')](handleError(_0x4c6344,null));};exports[_0x587b('0x4b')]=function(_0x57e376,_0xf4a0be){return db[_0x587b('0x33')][_0x587b('0x34')]({'where':{'id':_0x57e376[_0x587b('0x29')]['id']}})[_0x587b('0x19')](handleEntityNotFound(_0xf4a0be,null))[_0x587b('0x19')](function(_0x5c8fba){if(_0x5c8fba){return _0x5c8fba['setTags'](_0x57e376[_0x587b('0x37')][_0x587b('0x3b')],_['omit'](_0x57e376[_0x587b('0x37')],[_0x587b('0x3b'),'id'])||{})[_0x587b('0x4c')](function(){return db['Tag'][_0x587b('0x23')]({'attributes':['id',_0x587b('0x1c'),'color'],'where':{'id':_0x57e376['body'][_0x587b('0x3b')]}});})[_0x587b('0x19')](function(_0x4483c0){socket[_0x587b('0x4d')](_0x587b('0x4e'),{'id':Number(_0x57e376['params']['id']),'tags':_0x4483c0||[]});return{'id':Number(_0x57e376[_0x587b('0x29')]['id']),'tags':_0x4483c0||[]};});}})[_0x587b('0x19')](respondWithResult(_0xf4a0be,null))['catch'](handleError(_0xf4a0be,null));};exports[_0x587b('0x4f')]=function(_0x6b0c43,_0x16550f){return db[_0x587b('0x33')][_0x587b('0x34')]({'where':{'id':_0x6b0c43['params']['id']}})[_0x587b('0x19')](handleEntityNotFound(_0x16550f,null))['then'](function(_0xf83d20){if(_0xf83d20){return _0xf83d20[_0x587b('0x4f')](_0x6b0c43['query'][_0x587b('0x3b')]);}})['then'](respondWithStatusCode(_0x16550f,null))['catch'](handleError(_0x16550f,null));};exports[_0x587b('0x50')]=function(_0x27da88,_0x59c01b){var _0x1750e7=moment()['unix']()['toString']();var _0xe8db88=path[_0x587b('0x51')](config[_0x587b('0x52')],_0x587b('0x53'),'files',_0x587b('0x54'));var _0x5052fe=path['join'](config[_0x587b('0x52')],_0x587b('0x53'),_0x587b('0x55'),_0x587b('0x56'));var _0x4e9c3c=path[_0x587b('0x51')](_0xe8db88,_0x1750e7);var _0x5ce36e=util['format'](_0x587b('0x57'),_0x27da88[_0x587b('0x29')]['id'],_0x1750e7);var _0x1d5e8e=path['join'](_0xe8db88,_0x5ce36e);var _0x4733b5=[];_0x4733b5[_0x587b('0x58')]({'model':db[_0x587b('0x59')],'as':_0x587b('0x59'),'attributes':['id',_0x587b('0x5a')],'raw':!![]});_0x4733b5['push']({'model':db[_0x587b('0x5b')],'as':_0x587b('0x5c'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x27da88[_0x587b('0x25')][_0x587b('0x56')]){_0x4733b5[_0x587b('0x58')]({'model':db[_0x587b('0x5d')],'as':'Attachment','raw':!![]});}var _0xb75bc8=[{'model':db[_0x587b('0x39')],'as':'Messages','attributes':['id',_0x587b('0x37'),_0x587b('0x5e'),_0x587b('0x5f'),'secret',_0x587b('0x60')],'include':_0x4733b5}];_0xb75bc8[_0x587b('0x58')]({'model':db[_0x587b('0x61')],'as':_0x587b('0x62'),'attributes':['id',_0x587b('0x1c')]});_0xb75bc8[_0x587b('0x58')]({'model':db[_0x587b('0x59')],'as':_0x587b('0x63'),'attributes':['id','fullname']});return db[_0x587b('0x33')][_0x587b('0x34')]({'where':{'id':_0x27da88['params']['id']},'include':_0xb75bc8})[_0x587b('0x19')](handleEntityNotFound(_0x59c01b,null))[_0x587b('0x19')](function(_0x34f862){if(_0x34f862){var _0x5e9c55=_0x34f862[_0x587b('0x64')]({'plain':!![]});fs[_0x587b('0x65')](_0x4e9c3c);var _0x2da054={'channel':'Openchannel','account':_0x5e9c55[_0x587b('0x62')]['name'],'agent':_0x5e9c55[_0x587b('0x63')]?_0x5e9c55[_0x587b('0x63')]['fullname']:_0x587b('0x66'),'createdAt':moment(_0x5e9c55[_0x587b('0x5e')])[_0x587b('0x48')](_0x587b('0x49'))[_0x587b('0x67')](),'closedAt':_0x5e9c55[_0x587b('0x68')]?moment(_0x5e9c55[_0x587b('0x69')])[_0x587b('0x48')](_0x587b('0x49'))[_0x587b('0x67')]():'','disposition':_0x5e9c55[_0x587b('0x6a')],'visibility':_0x5e9c55['threadId']?_0x587b('0x6b'):_0x587b('0x6c'),'messages':_(_0x5e9c55['Messages'])['filter']({'secret':![]})[_0x587b('0x1f')](function(_0x6f46cb){if(_0x6f46cb[_0x587b('0x5d')]){var _0x3cf50f=path[_0x587b('0x51')](_0x5052fe,_0x6f46cb['Attachment']['basename']);if(fs[_0x587b('0x6d')](_0x3cf50f)){fs['createReadStream'](_0x3cf50f)[_0x587b('0x6e')](fs[_0x587b('0x6f')](path['join'](_0x4e9c3c,_0x6f46cb['Attachment']['basename'])));}}return{'date':moment(_0x6f46cb['createdAt'])[_0x587b('0x48')](_0x587b('0x49'))[_0x587b('0x67')](),'sender':_0x6f46cb['direction']===_0x587b('0x70')?_0x6f46cb[_0x587b('0x59')]?_0x6f46cb[_0x587b('0x59')][_0x587b('0x5a')]:_0x587b('0x71'):_0x6f46cb[_0x587b('0x5c')][_0x587b('0x72')]+(_0x6f46cb[_0x587b('0x5c')][_0x587b('0x73')]?'\x20'+_0x6f46cb['Contact'][_0x587b('0x73')]:''),'body':_0x6f46cb[_0x587b('0x5d')]?_0x6f46cb[_0x587b('0x5d')][_0x587b('0x74')]:_0x6f46cb['body'],'direction':_0x6f46cb[_0x587b('0x5f')]===_0x587b('0x70')?'A':'C','secret':_0x6f46cb['secret'],'read':_0x6f46cb[_0x587b('0x60')],'attachment':_0x6f46cb['Attachment']};})['value']()};return ejs[_0x587b('0x75')](path['join'](config[_0x587b('0x52')],'server',_0x587b('0x76'),'downloadInteraction.ejs'),{'interaction':_0x2da054})[_0x587b('0x19')](function(_0x25a8e2){var _0x59fc02=path[_0x587b('0x51')](_0x4e9c3c,_0x587b('0x77')+_0x5e9c55['id']+'-'+_0x1750e7+_0x587b('0x78'));var _0x32f5a2={'path':_0x59fc02,'channel':_0x587b('0x79'),'interactionId':_0x5e9c55['id']};return pdf[_0x587b('0x7a')](_0x25a8e2,_0x32f5a2);})['then'](function(){return new Promise(function(_0x3c0eaf,_0x3e0475){zipdir(_0x4e9c3c,{'saveTo':_0x1d5e8e},function(_0x80958c,_0x370413){if(_0x80958c)return _0x3e0475(_0x80958c);return _0x3c0eaf(_0x370413);});})[_0x587b('0x19')](function(){return new Promise(function(_0x6b77f5,_0x5de5ae){rimraf(_0x4e9c3c,function(_0x34fec7){if(_0x34fec7)_0x5de5ae(_0x34fec7);return _0x6b77f5();});});})[_0x587b('0x19')](function(){return _0x59c01b[_0x587b('0x50')](_0x1d5e8e,_0x5ce36e,function(_0x12e75f){if(_0x12e75f){logger['error'](_0x587b('0x7b'),_0x12e75f);}else{fs[_0x587b('0x7c')](_0x1d5e8e);}});});});}else{return _0x59c01b[_0x587b('0x7d')](0xc8);}})[_0x587b('0x27')](handleError(_0x59c01b,null));}; \ No newline at end of file +var _0xa664=['lastName','basename','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Openchannel','createPdfFromHTML','error','Unable\x20to\x20delete\x20zip\x20file','rimraf','zip-dir','moment','util','path','ejs','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','update','then','destroy','stack','name','send','OpenchannelInteraction','fieldName','type','key','getOptions','findAll','openchannel','query','catch','show','from','params','keys','filters','model','fields','attributes','length','includeAll','include','options','find','create','body','describe','addMessage','OpenchannelMessage','omit','ids','getMessages','findOne','rawAttributes','hasOwnProperty','nolimit','order','sort','pick','OpenchannelInteractionId','where','merge','map','$gte','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','spread','Tag','color','emit','removeTags','download','toString','join','root','server','tmp','files','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','Attachment','Messages','direction','secret','read','OpenchannelAccount','Owner','get','mkdirSync','Account','closed','closedAt','disposition','threadId','Public','filter','existsSync','createReadStream','pipe','createWriteStream','createdAt','out','System','firstName'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xa664,0x92));var _0x4a66=function(_0x27c0cd,_0x3152aa){_0x27c0cd=_0x27c0cd-0x0;var _0x4fd44c=_0xa664[_0x27c0cd];return _0x4fd44c;};'use strict';var rimraf=require(_0x4a66('0x0'));var zipdir=require(_0x4a66('0x1'));var moment=require(_0x4a66('0x2'));var util=require(_0x4a66('0x3'));var path=require(_0x4a66('0x4'));var ejs=require(_0x4a66('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x4a66('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0x4a66('0x7'));var pdf=require(_0x4a66('0x8'));var logger=require(_0x4a66('0x9'))(_0x4a66('0xa'));var config=require(_0x4a66('0xb'));var db=require(_0x4a66('0xc'))['db'];config[_0x4a66('0xd')]=_[_0x4a66('0xe')](config[_0x4a66('0xd')],{'host':_0x4a66('0xf'),'port':0x18eb});var socket=require(_0x4a66('0x10'))(new Redis(config[_0x4a66('0xd')]));require(_0x4a66('0x11'))[_0x4a66('0x12')](socket);function respondWithStatusCode(_0x595792,_0x55fc8d){_0x55fc8d=_0x55fc8d||0xcc;return function(_0x2b5f95){if(_0x2b5f95){return _0x595792[_0x4a66('0x13')](_0x55fc8d);}return _0x595792['status'](_0x55fc8d)[_0x4a66('0x14')]();};}function respondWithResult(_0xf6f4ce,_0x41850c){_0x41850c=_0x41850c||0xc8;return function(_0x4c712b){if(_0x4c712b){return _0xf6f4ce[_0x4a66('0x15')](_0x41850c)[_0x4a66('0x16')](_0x4c712b);}};}function respondWithFilteredResult(_0x9ba2f6,_0x218f5b){return function(_0xda6cbe){if(_0xda6cbe){var _0x3a69ee=typeof _0x218f5b['offset']===_0x4a66('0x17')&&typeof _0x218f5b[_0x4a66('0x18')]===_0x4a66('0x17');var _0x41253d=_0xda6cbe[_0x4a66('0x19')];var _0x2a3065=_0x3a69ee?0x0:_0x218f5b[_0x4a66('0x1a')];var _0x339137=_0x3a69ee?_0xda6cbe[_0x4a66('0x19')]:_0x218f5b['offset']+_0x218f5b[_0x4a66('0x18')];var _0x3c1735;if(_0x339137>=_0x41253d){_0x339137=_0x41253d;_0x3c1735=0xc8;}else{_0x3c1735=0xce;}_0x9ba2f6[_0x4a66('0x15')](_0x3c1735);return _0x9ba2f6['set'](_0x4a66('0x1b'),_0x2a3065+'-'+_0x339137+'/'+_0x41253d)[_0x4a66('0x16')](_0xda6cbe);}return null;};}function saveUpdates(_0x344501){return function(_0x2f57e1){if(_0x2f57e1){return _0x2f57e1[_0x4a66('0x1c')](_0x344501)[_0x4a66('0x1d')](function(_0x1c2e34){return _0x1c2e34;});}return null;};}function removeEntity(_0x26c5da){return function(_0x53da7f){if(_0x53da7f){return _0x53da7f[_0x4a66('0x1e')]()[_0x4a66('0x1d')](function(){_0x26c5da[_0x4a66('0x15')](0xcc)[_0x4a66('0x14')]();});}};}function handleEntityNotFound(_0x478036){return function(_0x2cf0cb){if(!_0x2cf0cb){_0x478036[_0x4a66('0x13')](0x194);}return _0x2cf0cb;};}function handleError(_0x2197ce,_0x27270d){_0x27270d=_0x27270d||0x1f4;return function(_0x1218f9){logger['error'](_0x1218f9[_0x4a66('0x1f')]);if(_0x1218f9[_0x4a66('0x20')]){delete _0x1218f9[_0x4a66('0x20')];}_0x2197ce[_0x4a66('0x15')](_0x27270d)[_0x4a66('0x21')](_0x1218f9);};}exports['index']=function(_0x3737f9,_0x4463dc){var _0x493fef={};var _0x38777d=_['map'](db[_0x4a66('0x22')]['rawAttributes'],function(_0xefd556){return{'name':_0xefd556[_0x4a66('0x23')],'type':_0xefd556[_0x4a66('0x24')][_0x4a66('0x25')]};});_0x493fef=qs[_0x4a66('0x26')](_0x38777d,_0x3737f9);return interaction[_0x4a66('0x27')](_0x4a66('0x28'),_0x3737f9[_0x4a66('0x29')],_0x3737f9['user'],_0x493fef,_0x38777d)[_0x4a66('0x1d')](respondWithFilteredResult(_0x4463dc,_0x493fef))[_0x4a66('0x2a')](handleError(_0x4463dc,null));};exports[_0x4a66('0x2b')]=function(_0x9b0951,_0x19094c){var _0x352220={};if(_0x9b0951[_0x4a66('0x29')][_0x4a66('0x24')]&&_0x9b0951[_0x4a66('0x29')][_0x4a66('0x24')]===_0x4a66('0x2c')){_0x352220[_0x4a66('0x2c')]=_0x9b0951[_0x4a66('0x2d')]['id'];}else{_0x352220['id']=_0x9b0951['params']['id'];}var _0x46001f={'raw':![],'where':_0x352220},_0x29330c={};_0x29330c['model']=_[_0x4a66('0x2e')](db[_0x4a66('0x22')]['rawAttributes']);_0x29330c[_0x4a66('0x29')]=_[_0x4a66('0x2e')](_0x9b0951[_0x4a66('0x29')]);_0x29330c[_0x4a66('0x2f')]=_['intersection'](_0x29330c[_0x4a66('0x30')],_0x29330c[_0x4a66('0x29')]);_0x46001f['attributes']=_['intersection'](_0x29330c[_0x4a66('0x30')],qs[_0x4a66('0x31')](_0x9b0951[_0x4a66('0x29')]['fields']));_0x46001f[_0x4a66('0x32')]=_0x46001f[_0x4a66('0x32')][_0x4a66('0x33')]?_0x46001f['attributes']:_0x29330c['model'];if(_0x9b0951['query'][_0x4a66('0x34')]){_0x46001f[_0x4a66('0x35')]=[{'all':!![]}];}_0x46001f=_['merge']({},_0x46001f,_0x9b0951[_0x4a66('0x36')]);return db[_0x4a66('0x22')][_0x4a66('0x37')](_0x46001f)[_0x4a66('0x1d')](handleEntityNotFound(_0x19094c,null))[_0x4a66('0x1d')](respondWithResult(_0x19094c,null))[_0x4a66('0x2a')](handleError(_0x19094c,null));};exports[_0x4a66('0x38')]=function(_0x1f9893,_0x2faaf8){return db[_0x4a66('0x22')][_0x4a66('0x38')](_0x1f9893[_0x4a66('0x39')],{})['then'](respondWithResult(_0x2faaf8,0xc9))['catch'](handleError(_0x2faaf8,null));};exports['update']=function(_0x48fbe0,_0x54ba17){if(_0x48fbe0['body']['id']){delete _0x48fbe0[_0x4a66('0x39')]['id'];}return db[_0x4a66('0x22')][_0x4a66('0x37')]({'where':{'id':_0x48fbe0['params']['id']}})['then'](handleEntityNotFound(_0x54ba17,null))[_0x4a66('0x1d')](saveUpdates(_0x48fbe0[_0x4a66('0x39')],null))[_0x4a66('0x1d')](respondWithResult(_0x54ba17,null))[_0x4a66('0x2a')](handleError(_0x54ba17,null));};exports[_0x4a66('0x1e')]=function(_0x7c02e6,_0x3fe7fd){return db[_0x4a66('0x22')][_0x4a66('0x37')]({'where':{'id':_0x7c02e6['params']['id']}})[_0x4a66('0x1d')](handleEntityNotFound(_0x3fe7fd,null))['then'](removeEntity(_0x3fe7fd,null))['catch'](handleError(_0x3fe7fd,null));};exports['describe']=function(_0x19e108,_0x36c8ba){return db[_0x4a66('0x22')][_0x4a66('0x3a')]()[_0x4a66('0x1d')](respondWithResult(_0x36c8ba,null))[_0x4a66('0x2a')](handleError(_0x36c8ba,null));};exports[_0x4a66('0x3b')]=function(_0x2f57e2,_0x2c89bd){return db[_0x4a66('0x3c')][_0x4a66('0x37')]({'where':{'id':_0x2f57e2[_0x4a66('0x2d')]['id']}})[_0x4a66('0x1d')](handleEntityNotFound(_0x2c89bd,null))[_0x4a66('0x1d')](function(_0x348f1a){if(_0x348f1a){return _0x348f1a[_0x4a66('0x3b')](_0x2f57e2['body']['ids'],_[_0x4a66('0x3d')](_0x2f57e2['body'],[_0x4a66('0x3e'),'id'])||{});}})[_0x4a66('0x1d')](respondWithResult(_0x2c89bd,null))['catch'](handleError(_0x2c89bd,null));};exports[_0x4a66('0x3f')]=function(_0x18adfb,_0x5ae8eb){var _0x548868={'raw':![],'where':{}};var _0x15ec7d={};var _0x36f9c3={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x4a66('0x40')]({'where':{'id':_0x18adfb[_0x4a66('0x2d')]['id']}})[_0x4a66('0x1d')](handleEntityNotFound(_0x5ae8eb,null))[_0x4a66('0x1d')](function(_0x884ae4){if(_0x884ae4){_0x15ec7d[_0x4a66('0x30')]=_[_0x4a66('0x2e')](db[_0x4a66('0x3c')][_0x4a66('0x41')]);_0x15ec7d[_0x4a66('0x29')]=_['keys'](_0x18adfb[_0x4a66('0x29')]);_0x15ec7d[_0x4a66('0x2f')]=_['intersection'](_0x15ec7d[_0x4a66('0x30')],_0x15ec7d[_0x4a66('0x29')]);_0x548868['attributes']=_['intersection'](_0x15ec7d['model'],qs[_0x4a66('0x31')](_0x18adfb[_0x4a66('0x29')]['fields']));_0x548868[_0x4a66('0x32')]=_0x548868['attributes'][_0x4a66('0x33')]?_0x548868[_0x4a66('0x32')]:_0x15ec7d[_0x4a66('0x30')];if(!_0x18adfb[_0x4a66('0x29')][_0x4a66('0x42')](_0x4a66('0x43'))){_0x548868[_0x4a66('0x18')]=qs[_0x4a66('0x18')](_0x18adfb[_0x4a66('0x29')][_0x4a66('0x18')]);_0x548868['offset']=qs[_0x4a66('0x1a')](_0x18adfb[_0x4a66('0x29')][_0x4a66('0x1a')]);}_0x548868[_0x4a66('0x44')]=qs[_0x4a66('0x45')](_0x18adfb[_0x4a66('0x29')][_0x4a66('0x45')]);_0x548868['where']=qs[_0x4a66('0x2f')](_[_0x4a66('0x46')](_0x18adfb[_0x4a66('0x29')],_0x15ec7d[_0x4a66('0x2f')]));_0x548868['where'][_0x4a66('0x47')]=_0x884ae4['id'];if(_0x18adfb['query']['filter']){_0x548868[_0x4a66('0x48')]=_[_0x4a66('0x49')](_0x548868[_0x4a66('0x48')],{'$or':_[_0x4a66('0x4a')](_0x548868[_0x4a66('0x32')],function(_0xd3210){var _0x3bc73b={};_0x3bc73b[_0xd3210]={'$like':'%'+_0x18adfb[_0x4a66('0x29')]['filter']+'%'};return _0x3bc73b;})});}if(_0x18adfb['query'][_0x4a66('0x4b')]){var _0x474564=_0x18adfb[_0x4a66('0x29')][_0x4a66('0x4b')]['split'](',');var _0x2293c0={};_0x2293c0[_0x474564[0x0]]={'$gte':moment(_0x474564[0x1])[_0x4a66('0x4c')](_0x4a66('0x4d'))};_0x548868[_0x4a66('0x48')]=_[_0x4a66('0x49')](_0x548868['where'],_0x2293c0);}_0x548868=_['merge']({},_0x548868,_0x18adfb['options']);return db['OpenchannelMessage'][_0x4a66('0x19')]({'where':_0x548868[_0x4a66('0x48')]})[_0x4a66('0x1d')](function(_0x35f290){_0x36f9c3[_0x4a66('0x19')]=_0x35f290;if(_0x18adfb['query'][_0x4a66('0x34')]){_0x548868[_0x4a66('0x35')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x4a66('0x27')](_0x548868);})['then'](function(_0x85c7ad){_0x36f9c3[_0x4a66('0x4e')]=_0x85c7ad;return _0x36f9c3;});}})[_0x4a66('0x1d')](respondWithFilteredResult(_0x5ae8eb,_0x548868))[_0x4a66('0x2a')](handleError(_0x5ae8eb,null));};exports[_0x4a66('0x4f')]=function(_0x2e5dc7,_0xcd7ce1){return db[_0x4a66('0x22')][_0x4a66('0x37')]({'where':{'id':_0x2e5dc7[_0x4a66('0x2d')]['id']}})[_0x4a66('0x1d')](handleEntityNotFound(_0xcd7ce1,null))[_0x4a66('0x1d')](function(_0x33df1a){if(_0x33df1a){return _0x33df1a['setTags'](_0x2e5dc7['body'][_0x4a66('0x3e')],_['omit'](_0x2e5dc7[_0x4a66('0x39')],[_0x4a66('0x3e'),'id'])||{})[_0x4a66('0x50')](function(){return db[_0x4a66('0x51')][_0x4a66('0x27')]({'attributes':['id',_0x4a66('0x20'),_0x4a66('0x52')],'where':{'id':_0x2e5dc7[_0x4a66('0x39')][_0x4a66('0x3e')]}});})[_0x4a66('0x1d')](function(_0x1acfe7){socket[_0x4a66('0x53')]('openchannelInteractionTags:save',{'id':Number(_0x2e5dc7[_0x4a66('0x2d')]['id']),'tags':_0x1acfe7||[]});return{'id':Number(_0x2e5dc7[_0x4a66('0x2d')]['id']),'tags':_0x1acfe7||[]};});}})[_0x4a66('0x1d')](respondWithResult(_0xcd7ce1,null))[_0x4a66('0x2a')](handleError(_0xcd7ce1,null));};exports['removeTags']=function(_0x573da0,_0x1b66c9){return db[_0x4a66('0x22')][_0x4a66('0x37')]({'where':{'id':_0x573da0[_0x4a66('0x2d')]['id']}})[_0x4a66('0x1d')](handleEntityNotFound(_0x1b66c9,null))[_0x4a66('0x1d')](function(_0x4f2c00){if(_0x4f2c00){return _0x4f2c00[_0x4a66('0x54')](_0x573da0['query'][_0x4a66('0x3e')]);}})[_0x4a66('0x1d')](respondWithStatusCode(_0x1b66c9,null))['catch'](handleError(_0x1b66c9,null));};exports[_0x4a66('0x55')]=function(_0x3dcc0c,_0x161aaa){var _0x59a78b=moment()['unix']()[_0x4a66('0x56')]();var _0x23f0a0=path[_0x4a66('0x57')](config[_0x4a66('0x58')],_0x4a66('0x59'),'files',_0x4a66('0x5a'));var _0x27773f=path[_0x4a66('0x57')](config[_0x4a66('0x58')],_0x4a66('0x59'),_0x4a66('0x5b'),'attachments');var _0x21b312=path[_0x4a66('0x57')](_0x23f0a0,_0x59a78b);var _0x11c7d0=util[_0x4a66('0x4c')](_0x4a66('0x5c'),_0x3dcc0c['params']['id'],_0x59a78b);var _0x7ac37a=path['join'](_0x23f0a0,_0x11c7d0);var _0x49bc97=[];_0x49bc97[_0x4a66('0x5d')]({'model':db[_0x4a66('0x5e')],'as':_0x4a66('0x5e'),'attributes':['id',_0x4a66('0x5f')],'raw':!![]});_0x49bc97[_0x4a66('0x5d')]({'model':db[_0x4a66('0x60')],'as':_0x4a66('0x61'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x3dcc0c[_0x4a66('0x29')]['attachments']){_0x49bc97[_0x4a66('0x5d')]({'model':db['Attachment'],'as':_0x4a66('0x62'),'raw':!![]});}var _0x3eb234=[{'model':db[_0x4a66('0x3c')],'as':_0x4a66('0x63'),'attributes':['id',_0x4a66('0x39'),'createdAt',_0x4a66('0x64'),_0x4a66('0x65'),_0x4a66('0x66')],'include':_0x49bc97}];_0x3eb234['push']({'model':db[_0x4a66('0x67')],'as':'Account','attributes':['id','name']});_0x3eb234[_0x4a66('0x5d')]({'model':db[_0x4a66('0x5e')],'as':_0x4a66('0x68'),'attributes':['id',_0x4a66('0x5f')]});return db[_0x4a66('0x22')][_0x4a66('0x37')]({'where':{'id':_0x3dcc0c[_0x4a66('0x2d')]['id']},'include':_0x3eb234})[_0x4a66('0x1d')](handleEntityNotFound(_0x161aaa,null))[_0x4a66('0x1d')](function(_0x52bc46){if(_0x52bc46){var _0x5a7d08=_0x52bc46[_0x4a66('0x69')]({'plain':!![]});fs[_0x4a66('0x6a')](_0x21b312);var _0x5bc29f={'channel':'Openchannel','account':_0x5a7d08[_0x4a66('0x6b')][_0x4a66('0x20')],'agent':_0x5a7d08['Owner']?_0x5a7d08['Owner'][_0x4a66('0x5f')]:'N.A.','createdAt':moment(_0x5a7d08['createdAt'])['format'](_0x4a66('0x4d'))[_0x4a66('0x56')](),'closedAt':_0x5a7d08[_0x4a66('0x6c')]?moment(_0x5a7d08[_0x4a66('0x6d')])[_0x4a66('0x4c')](_0x4a66('0x4d'))[_0x4a66('0x56')]():'','disposition':_0x5a7d08[_0x4a66('0x6e')],'visibility':_0x5a7d08[_0x4a66('0x6f')]?_0x4a66('0x70'):'Private','messages':_(_0x5a7d08[_0x4a66('0x63')])[_0x4a66('0x71')]({'secret':![]})['map'](function(_0x14cd0e){if(_0x14cd0e[_0x4a66('0x62')]){var _0x15574e=path[_0x4a66('0x57')](_0x27773f,_0x14cd0e[_0x4a66('0x62')]['basename']);if(fs[_0x4a66('0x72')](_0x15574e)){fs[_0x4a66('0x73')](_0x15574e)[_0x4a66('0x74')](fs[_0x4a66('0x75')](path[_0x4a66('0x57')](_0x21b312,_0x14cd0e[_0x4a66('0x62')]['basename'])));}}return{'date':moment(_0x14cd0e[_0x4a66('0x76')])['format'](_0x4a66('0x4d'))[_0x4a66('0x56')](),'sender':_0x14cd0e[_0x4a66('0x64')]===_0x4a66('0x77')?_0x14cd0e[_0x4a66('0x5e')]?_0x14cd0e[_0x4a66('0x5e')][_0x4a66('0x5f')]:_0x4a66('0x78'):_0x14cd0e[_0x4a66('0x61')][_0x4a66('0x79')]+(_0x14cd0e[_0x4a66('0x61')][_0x4a66('0x7a')]?'\x20'+_0x14cd0e[_0x4a66('0x61')][_0x4a66('0x7a')]:''),'body':_0x14cd0e[_0x4a66('0x62')]?_0x14cd0e['Attachment'][_0x4a66('0x7b')]:_0x14cd0e[_0x4a66('0x39')],'direction':_0x14cd0e[_0x4a66('0x64')]===_0x4a66('0x77')?'A':'C','secret':_0x14cd0e[_0x4a66('0x65')],'read':_0x14cd0e['read'],'attachment':_0x14cd0e[_0x4a66('0x62')]};})[_0x4a66('0x7c')]()};return ejs[_0x4a66('0x7d')](path['join'](config['root'],_0x4a66('0x59'),_0x4a66('0x7e'),_0x4a66('0x7f')),{'interaction':_0x5bc29f})[_0x4a66('0x1d')](function(_0x13815d){var _0x573120=path[_0x4a66('0x57')](_0x21b312,_0x4a66('0x80')+_0x5a7d08['id']+'-'+_0x59a78b+_0x4a66('0x81'));var _0x59c1cd={'path':_0x573120,'channel':_0x4a66('0x82'),'interactionId':_0x5a7d08['id']};return pdf[_0x4a66('0x83')](_0x13815d,_0x59c1cd);})['then'](function(){return new Promise(function(_0x2a27df,_0x3648f8){zipdir(_0x21b312,{'saveTo':_0x7ac37a},function(_0x2fc5ca,_0x834fc){if(_0x2fc5ca)return _0x3648f8(_0x2fc5ca);return _0x2a27df(_0x834fc);});})[_0x4a66('0x1d')](function(){return new Promise(function(_0xc20e82,_0x4348d5){rimraf(_0x21b312,function(_0x19e3b1){if(_0x19e3b1)_0x4348d5(_0x19e3b1);return _0xc20e82();});});})[_0x4a66('0x1d')](function(){return _0x161aaa[_0x4a66('0x55')](_0x7ac37a,_0x11c7d0,function(_0x462ef6){if(_0x462ef6){logger[_0x4a66('0x84')](_0x4a66('0x85'),_0x462ef6);}else{fs['unlinkSync'](_0x7ac37a);}});});});}else{return _0x161aaa[_0x4a66('0x13')](0xc8);}})[_0x4a66('0x2a')](handleError(_0x161aaa,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index f5063d0..5153dc9 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 _0x8d0a=['hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','remove','then','setDataValue','map','findAll','unreadMessages','emit','catch','hasOwnProperty'];(function(_0x2b4a7d,_0xa488aa){var _0x50d85e=function(_0x5382a7){while(--_0x5382a7){_0x2b4a7d['push'](_0x2b4a7d['shift']());}};_0x50d85e(++_0xa488aa);}(_0x8d0a,0xf2));var _0xa8d0=function(_0x18282d,_0x15307a){_0x18282d=_0x18282d-0x0;var _0x5eef98=_0x8d0a[_0x18282d];return _0x5eef98;};'use strict';var EventEmitter=require(_0xa8d0('0x0'));var OpenchannelInteraction=require(_0xa8d0('0x1'))['db'][_0xa8d0('0x2')];var OpenchannelMessage=require(_0xa8d0('0x1'))['db'][_0xa8d0('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xa8d0('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xa8d0('0x5')};function emitEvent(_0x1600d1){return function(_0x2c23c2,_0xbdbd1f,_0x18461e){_0x2c23c2['getUsers']({'attributes':['id'],'raw':!![]})[_0xa8d0('0x6')](function(_0xd34162){_0x2c23c2[_0xa8d0('0x7')]('Users',_0xd34162[_0xa8d0('0x8')](function(_0x5a0af4){return{'id':_0x5a0af4['id']};}));return OpenchannelMessage[_0xa8d0('0x9')]({'where':{'OpenchannelInteractionId':_0x2c23c2['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x1afda6){_0x2c23c2[_0xa8d0('0x7')](_0xa8d0('0xa'),_0x1afda6['length']);OpenchannelInteractionEvents[_0xa8d0('0xb')](_0x1600d1+':'+_0x2c23c2['id'],_0x2c23c2);OpenchannelInteractionEvents[_0xa8d0('0xb')](_0x1600d1,_0x2c23c2);_0x18461e(null);})[_0xa8d0('0xc')](_0x18461e(null));};}for(var e in events){if(events[_0xa8d0('0xd')](e)){var event=events[e];OpenchannelInteraction[_0xa8d0('0xe')](e,emitEvent(event));}}module[_0xa8d0('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x299a=['save','update','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','OpenchannelInteraction','setMaxListeners'];(function(_0x5c9081,_0x4f572a){var _0x306c41=function(_0x20afe1){while(--_0x20afe1){_0x5c9081['push'](_0x5c9081['shift']());}};_0x306c41(++_0x4f572a);}(_0x299a,0x96));var _0xa299=function(_0x50435d,_0x2ffc5c){_0x50435d=_0x50435d-0x0;var _0x27e7ad=_0x299a[_0x50435d];return _0x27e7ad;};'use strict';var EventEmitter=require(_0xa299('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0xa299('0x1')];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xa299('0x2')](0x0);var events={'afterCreate':_0xa299('0x3'),'afterUpdate':_0xa299('0x4'),'afterDestroy':'remove'};function emitEvent(_0x159ec1){return function(_0x411511,_0x2d2314,_0x3a64cf){_0x411511['getUsers']({'attributes':['id'],'raw':!![]})[_0xa299('0x5')](function(_0x49252e){_0x411511[_0xa299('0x6')](_0xa299('0x7'),_0x49252e[_0xa299('0x8')](function(_0x3ceee3){return{'id':_0x3ceee3['id']};}));return OpenchannelMessage[_0xa299('0x9')]({'where':{'OpenchannelInteractionId':_0x411511['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa299('0x5')](function(_0xeab7b8){_0x411511[_0xa299('0x6')](_0xa299('0xa'),_0xeab7b8[_0xa299('0xb')]);OpenchannelInteractionEvents[_0xa299('0xc')](_0x159ec1+':'+_0x411511['id'],_0x411511);OpenchannelInteractionEvents[_0xa299('0xc')](_0x159ec1,_0x411511);_0x3a64cf(null);})[_0xa299('0xd')](_0x3a64cf(null));};}for(var e in events){if(events[_0xa299('0xe')](e)){var event=events[e];OpenchannelInteraction[_0xa299('0xf')](e,emitEvent(event));}}module[_0xa299('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 902a2db..2adc61d 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 _0xec32=['api','moment','bluebird','path','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','utf8mb4','utf8mb4_unicode_ci','closed','closedAt','format','lodash','util','../../config/logger'];(function(_0x146ad2,_0x11d2fc){var _0x56b9fa=function(_0xf7695a){while(--_0xf7695a){_0x146ad2['push'](_0x146ad2['shift']());}};_0x56b9fa(++_0x11d2fc);}(_0xec32,0xb8));var _0x2ec3=function(_0x2b3186,_0x3e47aa){_0x2b3186=_0x2b3186-0x0;var _0x1df28c=_0xec32[_0x2b3186];return _0x1df28c;};'use strict';var _=require(_0x2ec3('0x0'));var util=require(_0x2ec3('0x1'));var logger=require(_0x2ec3('0x2'))(_0x2ec3('0x3'));var moment=require(_0x2ec3('0x4'));var BPromise=require(_0x2ec3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ec3('0x6'));var rimraf=require('rimraf');var config=require(_0x2ec3('0x7'));var attributes=require(_0x2ec3('0x8'));module[_0x2ec3('0x9')]=function(_0x2c395e,_0x55f312){return _0x2c395e[_0x2ec3('0xa')](_0x2ec3('0xb'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2ec3('0xc'),'collate':_0x2ec3('0xd'),'hooks':{'beforeUpdate':function(_0x3889f0,_0x4cc7ee,_0x1b525f){if(_0x3889f0['changed'](_0x2ec3('0xe'))){_0x3889f0[_0x2ec3('0xf')]=moment()[_0x2ec3('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1b525f(null,_0x3889f0);}}});}; \ No newline at end of file +var _0xda3a=['changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','OpenchannelInteraction','utf8mb4'];(function(_0xd43094,_0x334620){var _0x3c1eec=function(_0x277223){while(--_0x277223){_0xd43094['push'](_0xd43094['shift']());}};_0x3c1eec(++_0x334620);}(_0xda3a,0xba));var _0xada3=function(_0x26d313,_0x4df468){_0x26d313=_0x26d313-0x0;var _0x4d6f6b=_0xda3a[_0x26d313];return _0x4d6f6b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xada3('0x0'));var rp=require(_0xada3('0x1'));var fs=require('fs');var path=require(_0xada3('0x2'));var rimraf=require(_0xada3('0x3'));var config=require(_0xada3('0x4'));var attributes=require(_0xada3('0x5'));module[_0xada3('0x6')]=function(_0x5db5f7,_0x1e8908){return _0x5db5f7['define'](_0xada3('0x7'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xada3('0x8'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x19ce20,_0x577503,_0x266f09){if(_0x19ce20[_0xada3('0x9')](_0xada3('0xa'))){_0x19ce20[_0xada3('0xb')]=moment()['format'](_0xada3('0xc'));}_0x266f09(null,_0x19ce20);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 895cf5d..9fc237f 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 _0xf730=['result','catch','UpdateOpenchannelInteraction','update','body','options','raw','where','attributes','limit','find','addTags','ids','omit','spread','AddTags','lodash','util','ioredis','../../mysqldb','../../config/environment','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1d8991,_0x4a5217){var _0x13cdb6=function(_0x388506){while(--_0x388506){_0x1d8991['push'](_0x1d8991['shift']());}};_0x13cdb6(++_0x4a5217);}(_0xf730,0x166));var _0x0f73=function(_0xa650d8,_0x6d01ef){_0xa650d8=_0xa650d8-0x0;var _0x79ce97=_0xf730[_0xa650d8];return _0x79ce97;};'use strict';var _=require(_0x0f73('0x0'));var util=require(_0x0f73('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f73('0x2'));var db=require(_0x0f73('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x0f73('0x4'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x0f73('0x5')](config[_0x0f73('0x6')],{'host':_0x0f73('0x7'),'port':0x18eb});var socket=require(_0x0f73('0x8'))(new Redis(config[_0x0f73('0x6')]));require(_0x0f73('0x9'))[_0x0f73('0xa')](socket);function respondWithRpcPromise(_0x6859c3,_0x436847,_0x5047fa){return new BPromise(function(_0x360beb,_0x30542f){return client[_0x0f73('0xb')](_0x6859c3,_0x5047fa)[_0x0f73('0xc')](function(_0x26956d){logger[_0x0f73('0xd')](_0x0f73('0xe'),_0x436847,_0x0f73('0xf'));logger[_0x0f73('0x10')](_0x0f73('0x11'),_0x436847,_0x0f73('0xf'),JSON[_0x0f73('0x12')](_0x26956d));if(_0x26956d[_0x0f73('0x13')]){if(_0x26956d[_0x0f73('0x13')][_0x0f73('0x14')]===0x1f4){logger['error'](_0x0f73('0xe'),_0x436847,_0x26956d[_0x0f73('0x13')][_0x0f73('0x15')]);return _0x30542f(_0x26956d[_0x0f73('0x13')][_0x0f73('0x15')]);}logger[_0x0f73('0x13')](_0x0f73('0xe'),_0x436847,_0x26956d['error'][_0x0f73('0x15')]);return _0x360beb(_0x26956d[_0x0f73('0x13')][_0x0f73('0x15')]);}else{logger['info'](_0x0f73('0xe'),_0x436847,_0x0f73('0xf'));_0x360beb(_0x26956d[_0x0f73('0x16')]['message']);}})[_0x0f73('0x17')](function(_0x5939d8){logger[_0x0f73('0x13')](_0x0f73('0xe'),_0x436847,_0x5939d8);_0x30542f(_0x5939d8);});});}exports[_0x0f73('0x18')]=function(_0x526040){var _0x5e72f4=this;return new Promise(function(_0x1b9678,_0x1fe234){return db['OpenchannelInteraction'][_0x0f73('0x19')](_0x526040[_0x0f73('0x1a')],{'raw':_0x526040[_0x0f73('0x1b')]?_0x526040[_0x0f73('0x1b')][_0x0f73('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x526040[_0x0f73('0x1b')]?_0x526040[_0x0f73('0x1b')][_0x0f73('0x1d')]||null:null,'attributes':_0x526040[_0x0f73('0x1b')]?_0x526040[_0x0f73('0x1b')][_0x0f73('0x1e')]||null:null,'limit':_0x526040['options']?_0x526040[_0x0f73('0x1b')][_0x0f73('0x1f')]||null:null})[_0x0f73('0xc')](function(_0x15fcb8){logger[_0x0f73('0xd')](_0x0f73('0x18'),_0x526040);logger[_0x0f73('0x10')](_0x0f73('0x18'),_0x526040,JSON['stringify'](_0x15fcb8));_0x1b9678(_0x15fcb8);})[_0x0f73('0x17')](function(_0x14c3d9){logger['error'](_0x0f73('0x18'),_0x14c3d9[_0x0f73('0x15')],_0x526040);_0x1fe234(_0x5e72f4[_0x0f73('0x13')](0x1f4,_0x14c3d9[_0x0f73('0x15')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x29df8b){return new Promise(function(_0x2177a0,_0x579833){return db['OpenchannelInteraction'][_0x0f73('0x20')]({'where':_0x29df8b[_0x0f73('0x1b')]?_0x29df8b['options'][_0x0f73('0x1d')]||null:null})[_0x0f73('0xc')](function(_0x22ba8b){if(_0x22ba8b){return _0x22ba8b[_0x0f73('0x21')](_0x29df8b[_0x0f73('0x1a')][_0x0f73('0x22')],_[_0x0f73('0x23')](_0x29df8b['body'],[_0x0f73('0x22'),'id'])||{});}})[_0x0f73('0x24')](function(_0x40219f){logger[_0x0f73('0xd')](_0x0f73('0x25'),_0x29df8b);logger[_0x0f73('0x10')](_0x0f73('0x25'),_0x29df8b,JSON[_0x0f73('0x12')](_0x40219f));_0x2177a0(_0x40219f);})[_0x0f73('0x17')](function(_0x2c83de){logger['error'](_0x0f73('0x25'),_0x2c83de['message'],_0x29df8b);_0x579833(_this[_0x0f73('0x13')](0x1f4,_0x2c83de[_0x0f73('0x15')]));});});}; \ No newline at end of file +var _0x27ce=['message','info','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','attributes','then','stringify','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','AddTags','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','http','redis','defaults','localhost','request','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','OpenchannelInteraction,\x20%s,\x20%s'];(function(_0x3a0c4f,_0x5dd1a3){var _0x247049=function(_0x144695){while(--_0x144695){_0x3a0c4f['push'](_0x3a0c4f['shift']());}};_0x247049(++_0x5dd1a3);}(_0x27ce,0x12b));var _0xe27c=function(_0x46aee9,_0x40e901){_0x46aee9=_0x46aee9-0x0;var _0xf2ba2=_0x27ce[_0x46aee9];return _0xf2ba2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe27c('0x0'));var BPromise=require('bluebird');var rs=require(_0xe27c('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe27c('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xe27c('0x3'))('rpc');var config=require(_0xe27c('0x4'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe27c('0x5')]({'port':0x232a});config[_0xe27c('0x6')]=_[_0xe27c('0x7')](config[_0xe27c('0x6')],{'host':_0xe27c('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe27c('0x6')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x3d8533,_0x271204,_0x2a262c){return new BPromise(function(_0x23fa44,_0x37a812){return client[_0xe27c('0x9')](_0x3d8533,_0x2a262c)['then'](function(_0x153e6b){logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x271204,'request\x20sent');logger[_0xe27c('0xa')](_0xe27c('0xb'),_0x271204,_0xe27c('0xc'),JSON['stringify'](_0x153e6b));if(_0x153e6b['error']){if(_0x153e6b[_0xe27c('0xd')][_0xe27c('0xe')]===0x1f4){logger[_0xe27c('0xd')](_0xe27c('0xf'),_0x271204,_0x153e6b['error'][_0xe27c('0x10')]);return _0x37a812(_0x153e6b[_0xe27c('0xd')]['message']);}logger['error'](_0xe27c('0xf'),_0x271204,_0x153e6b['error']['message']);return _0x23fa44(_0x153e6b[_0xe27c('0xd')][_0xe27c('0x10')]);}else{logger[_0xe27c('0x11')](_0xe27c('0xf'),_0x271204,_0xe27c('0xc'));_0x23fa44(_0x153e6b['result']['message']);}})[_0xe27c('0x12')](function(_0x3376ec){logger[_0xe27c('0xd')](_0xe27c('0xf'),_0x271204,_0x3376ec);_0x37a812(_0x3376ec);});});}exports[_0xe27c('0x13')]=function(_0x4871b0){var _0x42b96a=this;return new Promise(function(_0x31d870,_0x1458b6){return db[_0xe27c('0x14')][_0xe27c('0x15')](_0x4871b0[_0xe27c('0x16')],{'raw':_0x4871b0[_0xe27c('0x17')]?_0x4871b0[_0xe27c('0x17')][_0xe27c('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4871b0[_0xe27c('0x17')]?_0x4871b0[_0xe27c('0x17')][_0xe27c('0x19')]||null:null,'attributes':_0x4871b0[_0xe27c('0x17')]?_0x4871b0[_0xe27c('0x17')][_0xe27c('0x1a')]||null:null,'limit':_0x4871b0[_0xe27c('0x17')]?_0x4871b0[_0xe27c('0x17')]['limit']||null:null})[_0xe27c('0x1b')](function(_0x3695a4){logger[_0xe27c('0x11')]('UpdateOpenchannelInteraction',_0x4871b0);logger[_0xe27c('0xa')](_0xe27c('0x13'),_0x4871b0,JSON[_0xe27c('0x1c')](_0x3695a4));_0x31d870(_0x3695a4);})[_0xe27c('0x12')](function(_0x20f42c){logger[_0xe27c('0xd')](_0xe27c('0x13'),_0x20f42c[_0xe27c('0x10')],_0x4871b0);_0x1458b6(_0x42b96a[_0xe27c('0xd')](0x1f4,_0x20f42c[_0xe27c('0x10')]));});});};exports[_0xe27c('0x1d')]=function(_0x5bbfc9){return new Promise(function(_0xae6e45,_0x49e418){return db[_0xe27c('0x14')][_0xe27c('0x1e')]({'where':_0x5bbfc9[_0xe27c('0x17')]?_0x5bbfc9[_0xe27c('0x17')][_0xe27c('0x19')]||null:null})['then'](function(_0xc580be){if(_0xc580be){return _0xc580be[_0xe27c('0x1f')](_0x5bbfc9[_0xe27c('0x16')][_0xe27c('0x20')],_[_0xe27c('0x21')](_0x5bbfc9[_0xe27c('0x16')],['ids','id'])||{});}})['spread'](function(_0x3f79ae){logger[_0xe27c('0x11')]('AddTags',_0x5bbfc9);logger[_0xe27c('0xa')]('AddTags',_0x5bbfc9,JSON[_0xe27c('0x1c')](_0x3f79ae));_0xae6e45(_0x3f79ae);})['catch'](function(_0x22b9e9){logger[_0xe27c('0xd')](_0xe27c('0x22'),_0x22b9e9[_0xe27c('0x10')],_0x5bbfc9);_0x49e418(_this['error'](0x1f4,_0x22b9e9[_0xe27c('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index ecd7d53..ffe32b7 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 _0x1c9c=['remove','update','emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events'];(function(_0x177dee,_0x582a0d){var _0x40c71c=function(_0x1d3499){while(--_0x1d3499){_0x177dee['push'](_0x177dee['shift']());}};_0x40c71c(++_0x582a0d);}(_0x1c9c,0x107));var _0xc1c9=function(_0x5ef905,_0x564b87){_0x5ef905=_0x5ef905-0x0;var _0x367808=_0x1c9c[_0x5ef905];return _0x367808;};'use strict';var OpenchannelInteractionEvents=require(_0xc1c9('0x0'));var events=['save',_0xc1c9('0x1'),_0xc1c9('0x2')];function createListener(_0x5175c1,_0x4ece69){return function(_0x438866){_0x4ece69[_0xc1c9('0x3')](_0x5175c1,_0x438866);};}function removeListener(_0x302cab,_0x485b5a){return function(){OpenchannelInteractionEvents[_0xc1c9('0x4')](_0x302cab,_0x485b5a);};}exports[_0xc1c9('0x5')]=function(_0x319402){for(var _0x5b1aae=0x0,_0x462bf7=events[_0xc1c9('0x6')];_0x5b1aae<_0x462bf7;_0x5b1aae++){var _0x238e04=events[_0x5b1aae];var _0xa3ddf5=createListener(_0xc1c9('0x7')+_0x238e04,_0x319402);OpenchannelInteractionEvents['on'](_0x238e04,_0xa3ddf5);}}; \ No newline at end of file +var _0xe3cf=['length','openchannelInteraction:','./openchannelInteraction.events','remove','update','removeListener','register'];(function(_0x394efb,_0x4949e2){var _0x143908=function(_0x4b912b){while(--_0x4b912b){_0x394efb['push'](_0x394efb['shift']());}};_0x143908(++_0x4949e2);}(_0xe3cf,0x8e));var _0xfe3c=function(_0x10900b,_0x58d2b2){_0x10900b=_0x10900b-0x0;var _0x4df5db=_0xe3cf[_0x10900b];return _0x4df5db;};'use strict';var OpenchannelInteractionEvents=require(_0xfe3c('0x0'));var events=['save',_0xfe3c('0x1'),_0xfe3c('0x2')];function createListener(_0x4b5483,_0x21f732){return function(_0x573bab){_0x21f732['emit'](_0x4b5483,_0x573bab);};}function removeListener(_0x2f3a86,_0x11919f){return function(){OpenchannelInteractionEvents[_0xfe3c('0x3')](_0x2f3a86,_0x11919f);};}exports[_0xfe3c('0x4')]=function(_0x4465ef){for(var _0x161f1e=0x0,_0x5112fd=events[_0xfe3c('0x5')];_0x161f1e<_0x5112fd;_0x161f1e++){var _0x427bee=events[_0x161f1e];var _0x4baac8=createListener(_0xfe3c('0x6')+_0x427bee,_0x4465ef);OpenchannelInteractionEvents['on'](_0x427bee,_0x4baac8);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 03df1ef..b0a5cf1 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x5a9426,_0x4867fe){var _0x4100af=function(_0x42ad90){while(--_0x42ad90){_0x5a9426['push'](_0x5a9426['shift']());}};_0x4100af(++_0x4867fe);}(_0xedd9,0xfc));var _0x9edd=function(_0x574e68,_0x34e011){_0x574e68=_0x574e68-0x0;var _0x4dd26d=_0xedd9[_0x574e68];return _0x4dd26d;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['show']);router[_0x9edd('0xf')]('/',auth['isAuthenticated'](),interaction[_0x9edd('0x10')](_0x9edd('0x11'),'openchannelmessage:create'),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')](_0x9edd('0x15'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x16')]);router[_0x9edd('0x13')](_0x9edd('0x17'),auth['isAuthenticated'](),controller[_0x9edd('0x18')]);router[_0x9edd('0x19')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x1a')]);module[_0x9edd('0x1b')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x53f04f,_0x419aa8){var _0x16a824=function(_0x5712c9){while(--_0x5712c9){_0x53f04f['push'](_0x53f04f['shift']());}};_0x16a824(++_0x419aa8);}(_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('./openchannelMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index f7def97..9d95545 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 _0xefe2=['TEXT','sequelize','exports','medium','BOOLEAN','ENUM','out','DATE','STRING'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0xefe2,0xd9));var _0x2efe=function(_0xf27b60,_0x2055bf){_0xf27b60=_0xf27b60-0x0;var _0x5ab8bd=_0xefe2[_0xf27b60];return _0x5ab8bd;};'use strict';var Sequelize=require(_0x2efe('0x0'));module[_0x2efe('0x1')]={'body':{'type':Sequelize['TEXT'](_0x2efe('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x2efe('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x2efe('0x4')]('in','out'),'defaultValue':_0x2efe('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x2efe('0x6')]},'providerName':{'type':Sequelize[_0x2efe('0x7')]},'providerResponse':{'type':Sequelize[_0x2efe('0x8')]}}; \ No newline at end of file +var _0xb01a=['out','DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x2da7c2,_0x1c01b3){var _0x51e224=function(_0x14eb4a){while(--_0x14eb4a){_0x2da7c2['push'](_0x2da7c2['shift']());}};_0x51e224(++_0x1c01b3);}(_0xb01a,0x1a1));var _0xab01=function(_0x42184d,_0x264f92){_0x42184d=_0x42184d-0x0;var _0x144722=_0xb01a[_0x42184d];return _0x144722;};'use strict';var Sequelize=require(_0xab01('0x0'));module[_0xab01('0x1')]={'body':{'type':Sequelize[_0xab01('0x2')](_0xab01('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xab01('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xab01('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xab01('0x5')]('in',_0xab01('0x6')),'defaultValue':_0xab01('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xab01('0x7')]},'providerName':{'type':Sequelize[_0xab01('0x8')]},'providerResponse':{'type':Sequelize[_0xab01('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index fa5de2d..49044c3 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 _0x1477=['reject','save','destroy','name','index','map','OpenchannelMessage','fieldName','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','merge','type','filter','then','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','options','create','body','update','find','describe','accept','openchannel','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','ContactId','sequelize','Sequelize','QueryTypes','User','fullname','email','internal','manual','interface','channel','motionChannel','EventManager','openchannel-interactions','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','SELECT','contact','rejectmessage','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','http','request','info','OpenchannelMessage,\x20%s,\x20%s','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply'];(function(_0x2b9cf5,_0x2a7804){var _0xd0cf15=function(_0x92a896){while(--_0x92a896){_0x2b9cf5['push'](_0x2b9cf5['shift']());}};_0xd0cf15(++_0x2a7804);}(_0x1477,0x14e));var _0x7147=function(_0x2f0ac4,_0x34cf06){_0x2f0ac4=_0x2f0ac4-0x0;var _0x1d7888=_0x1477[_0x2f0ac4];return _0x1d7888;};'use strict';var emlformat=require(_0x7147('0x0'));var rimraf=require(_0x7147('0x1'));var zipdir=require(_0x7147('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7147('0x3'));var moment=require(_0x7147('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7147('0x5'));var util=require(_0x7147('0x6'));var path=require(_0x7147('0x7'));var sox=require(_0x7147('0x8'));var csv=require(_0x7147('0x9'));var ejs=require(_0x7147('0xa'));var fs=require('fs');var fs_extra=require(_0x7147('0xb'));var _=require(_0x7147('0xc'));var squel=require(_0x7147('0xd'));var crypto=require('crypto');var jsforce=require(_0x7147('0xe'));var deskjs=require(_0x7147('0xf'));var toCsv=require(_0x7147('0x9'));var querystring=require(_0x7147('0x10'));var Papa=require('papaparse');var Redis=require(_0x7147('0x11'));var authService=require(_0x7147('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7147('0x13'));var logger=require(_0x7147('0x14'))(_0x7147('0x15'));var utils=require(_0x7147('0x16'));var config=require(_0x7147('0x17'));var licenseUtil=require(_0x7147('0x18'));var db=require(_0x7147('0x19'))['db'];config[_0x7147('0x1a')]=_[_0x7147('0x1b')](config[_0x7147('0x1a')],{'host':_0x7147('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7147('0x1a')]));require('./openchannelMessage.socket')[_0x7147('0x1d')](socket);var jayson=require(_0x7147('0x1e'));var client=jayson[_0x7147('0x1f')][_0x7147('0x20')]({'port':0x232c});var client9002=jayson[_0x7147('0x1f')][_0x7147('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x3de41f,_0x32b9f8,_0x585882,_0x82dc43){return new BPromise(function(_0xa9c033,_0x5a9a8a){var _0x2f3d1d=_0x82dc43||client;return _0x2f3d1d[_0x7147('0x21')](_0x3de41f,_0x585882)['then'](function(_0xbcad86){logger[_0x7147('0x22')](_0x7147('0x23'),_0x32b9f8,'request\x20sent');logger[_0x7147('0x24')](_0x7147('0x25'),_0x32b9f8,'request\x20sent',JSON[_0x7147('0x26')](_0xbcad86));if(_0xbcad86[_0x7147('0x27')]){if(_0xbcad86[_0x7147('0x27')]['code']===0x1f4){logger[_0x7147('0x27')](_0x7147('0x23'),_0x32b9f8,_0xbcad86['error'][_0x7147('0x28')]);return _0x5a9a8a(_0xbcad86[_0x7147('0x27')][_0x7147('0x28')]);}logger[_0x7147('0x27')](_0x7147('0x23'),_0x32b9f8,_0xbcad86[_0x7147('0x27')][_0x7147('0x28')]);return _0xa9c033(_0xbcad86[_0x7147('0x27')][_0x7147('0x28')]);}else{logger[_0x7147('0x22')](_0x7147('0x23'),_0x32b9f8,_0x7147('0x29'));_0xa9c033(_0xbcad86[_0x7147('0x2a')][_0x7147('0x28')]);}})['catch'](function(_0x50258a){logger[_0x7147('0x27')]('OpenchannelMessage,\x20%s,\x20%s',_0x32b9f8,_0x50258a);_0x5a9a8a(_0x50258a);});});}function respondWithStatusCode(_0xc35425,_0x158922){_0x158922=_0x158922||0xcc;return function(_0x49b681){if(_0x49b681){return _0xc35425[_0x7147('0x2b')](_0x158922);}return _0xc35425[_0x7147('0x2c')](_0x158922)[_0x7147('0x2d')]();};}function respondWithResult(_0x3b8113,_0x46cbb7){_0x46cbb7=_0x46cbb7||0xc8;return function(_0x1f48c5){if(_0x1f48c5){return _0x3b8113[_0x7147('0x2c')](_0x46cbb7)[_0x7147('0x2e')](_0x1f48c5);}};}function respondWithFilteredResult(_0x47283e,_0xd53c1){return function(_0x3ed3d6){if(_0x3ed3d6){var _0x173e21=typeof _0xd53c1[_0x7147('0x2f')]==='undefined'&&typeof _0xd53c1[_0x7147('0x30')]===_0x7147('0x31');var _0xc7710c=_0x3ed3d6[_0x7147('0x32')];var _0x3e9fcd=_0x173e21?0x0:_0xd53c1[_0x7147('0x2f')];var _0x55b766=_0x173e21?_0x3ed3d6[_0x7147('0x32')]:_0xd53c1[_0x7147('0x2f')]+_0xd53c1[_0x7147('0x30')];var _0x37555f;if(_0x55b766>=_0xc7710c){_0x55b766=_0xc7710c;_0x37555f=0xc8;}else{_0x37555f=0xce;}_0x47283e[_0x7147('0x2c')](_0x37555f);return _0x47283e['set'](_0x7147('0x33'),_0x3e9fcd+'-'+_0x55b766+'/'+_0xc7710c)[_0x7147('0x2e')](_0x3ed3d6);}return null;};}function patchUpdates(_0xff1514){return function(_0x353064){try{jsonpatch[_0x7147('0x34')](_0x353064,_0xff1514,!![]);}catch(_0x48b689){return BPromise[_0x7147('0x35')](_0x48b689);}return _0x353064[_0x7147('0x36')]();};}function saveUpdates(_0x1b6a9f,_0x4dcc39){return function(_0x465fdb){if(_0x465fdb){return _0x465fdb['update'](_0x1b6a9f)['then'](function(_0x171392){return _0x171392;});}return null;};}function removeEntity(_0x593d37,_0x12e9ed){return function(_0x250944){if(_0x250944){return _0x250944[_0x7147('0x37')]()['then'](function(){_0x593d37[_0x7147('0x2c')](0xcc)[_0x7147('0x2d')]();});}};}function handleEntityNotFound(_0x23e9c6,_0x15fd94){return function(_0x2e2555){if(!_0x2e2555){_0x23e9c6[_0x7147('0x2b')](0x194);}return _0x2e2555;};}function handleError(_0x118fb1,_0xcab2b4){_0xcab2b4=_0xcab2b4||0x1f4;return function(_0x41810a){logger['error'](_0x41810a['stack']);if(_0x41810a['name']){delete _0x41810a[_0x7147('0x38')];}_0x118fb1[_0x7147('0x2c')](_0xcab2b4)['send'](_0x41810a);};}exports[_0x7147('0x39')]=function(_0x229b22,_0x1af452){var _0x501f2e={},_0x11c1d2={},_0x3d4291={'count':0x0,'rows':[]};var _0x498212=_[_0x7147('0x3a')](db[_0x7147('0x3b')]['rawAttributes'],function(_0x2a1310){return{'name':_0x2a1310[_0x7147('0x3c')],'type':_0x2a1310['type']['key']};});_0x11c1d2[_0x7147('0x3d')]=_[_0x7147('0x3a')](_0x498212,_0x7147('0x38'));_0x11c1d2[_0x7147('0x3e')]=_[_0x7147('0x3f')](_0x229b22['query']);_0x11c1d2[_0x7147('0x40')]=_['intersection'](_0x11c1d2[_0x7147('0x3d')],_0x11c1d2['query']);_0x501f2e[_0x7147('0x41')]=_[_0x7147('0x42')](_0x11c1d2['model'],qs[_0x7147('0x43')](_0x229b22[_0x7147('0x3e')][_0x7147('0x43')]));_0x501f2e['attributes']=_0x501f2e['attributes']['length']?_0x501f2e[_0x7147('0x41')]:_0x11c1d2[_0x7147('0x3d')];if(!_0x229b22[_0x7147('0x3e')][_0x7147('0x44')](_0x7147('0x45'))){_0x501f2e[_0x7147('0x30')]=qs['limit'](_0x229b22[_0x7147('0x3e')][_0x7147('0x30')]);_0x501f2e[_0x7147('0x2f')]=qs[_0x7147('0x2f')](_0x229b22[_0x7147('0x3e')]['offset']);}_0x501f2e[_0x7147('0x46')]=qs['sort'](_0x229b22[_0x7147('0x3e')][_0x7147('0x47')]);_0x501f2e[_0x7147('0x48')]=qs['filters'](_['pick'](_0x229b22[_0x7147('0x3e')],_0x11c1d2[_0x7147('0x40')]),_0x498212);if(_0x229b22[_0x7147('0x3e')]['filter']){_0x501f2e[_0x7147('0x48')]=_[_0x7147('0x49')](_0x501f2e['where'],{'$or':_[_0x7147('0x3a')](_0x498212,function(_0x36e6cd){if(_0x36e6cd[_0x7147('0x4a')]!=='VIRTUAL'){var _0x51f67d={};_0x51f67d[_0x36e6cd[_0x7147('0x38')]]={'$like':'%'+_0x229b22[_0x7147('0x3e')][_0x7147('0x4b')]+'%'};return _0x51f67d;}})});}_0x501f2e=_[_0x7147('0x49')]({},_0x501f2e,_0x229b22['options']);var _0x479aa6={'where':_0x501f2e[_0x7147('0x48')]};return db['OpenchannelMessage']['count'](_0x479aa6)[_0x7147('0x4c')](function(_0x3abe60){_0x3d4291[_0x7147('0x32')]=_0x3abe60;if(_0x229b22[_0x7147('0x3e')][_0x7147('0x4d')]){_0x501f2e[_0x7147('0x4e')]=[{'all':!![]}];}return db[_0x7147('0x3b')][_0x7147('0x4f')](_0x501f2e);})[_0x7147('0x4c')](function(_0x3bcfe0){_0x3d4291[_0x7147('0x50')]=_0x3bcfe0;return _0x3d4291;})[_0x7147('0x4c')](respondWithFilteredResult(_0x1af452,_0x501f2e))[_0x7147('0x51')](handleError(_0x1af452,null));};exports[_0x7147('0x52')]=function(_0x204a6c,_0x29fbaf){var _0x3d95b1={'raw':!![],'where':{'id':_0x204a6c[_0x7147('0x53')]['id']}},_0x131c9d={};_0x131c9d[_0x7147('0x3d')]=_[_0x7147('0x3f')](db['OpenchannelMessage'][_0x7147('0x54')]);_0x131c9d['query']=_[_0x7147('0x3f')](_0x204a6c[_0x7147('0x3e')]);_0x131c9d[_0x7147('0x40')]=_[_0x7147('0x42')](_0x131c9d[_0x7147('0x3d')],_0x131c9d['query']);_0x3d95b1['attributes']=_[_0x7147('0x42')](_0x131c9d[_0x7147('0x3d')],qs[_0x7147('0x43')](_0x204a6c[_0x7147('0x3e')][_0x7147('0x43')]));_0x3d95b1[_0x7147('0x41')]=_0x3d95b1[_0x7147('0x41')][_0x7147('0x55')]?_0x3d95b1[_0x7147('0x41')]:_0x131c9d[_0x7147('0x3d')];if(_0x204a6c[_0x7147('0x3e')][_0x7147('0x4d')]){_0x3d95b1[_0x7147('0x4e')]=[{'all':!![]}];}_0x3d95b1=_['merge']({},_0x3d95b1,_0x204a6c[_0x7147('0x56')]);return db[_0x7147('0x3b')]['find'](_0x3d95b1)[_0x7147('0x4c')](handleEntityNotFound(_0x29fbaf,null))[_0x7147('0x4c')](respondWithResult(_0x29fbaf,null))[_0x7147('0x51')](handleError(_0x29fbaf,null));};exports[_0x7147('0x57')]=function(_0x3f5324,_0x2e499f){return db[_0x7147('0x3b')][_0x7147('0x57')](_0x3f5324[_0x7147('0x58')],{})[_0x7147('0x4c')](respondWithResult(_0x2e499f,0xc9))[_0x7147('0x51')](handleError(_0x2e499f,null));};exports[_0x7147('0x59')]=function(_0x3ca6c1,_0xed111c){if(_0x3ca6c1[_0x7147('0x58')]['id']){delete _0x3ca6c1[_0x7147('0x58')]['id'];}return db[_0x7147('0x3b')]['find']({'where':{'id':_0x3ca6c1[_0x7147('0x53')]['id']}})[_0x7147('0x4c')](handleEntityNotFound(_0xed111c,null))[_0x7147('0x4c')](saveUpdates(_0x3ca6c1[_0x7147('0x58')],null))[_0x7147('0x4c')](respondWithResult(_0xed111c,null))[_0x7147('0x51')](handleError(_0xed111c,null));};exports[_0x7147('0x37')]=function(_0x34bbc3,_0x4c78ae){return db[_0x7147('0x3b')][_0x7147('0x5a')]({'where':{'id':_0x34bbc3['params']['id']}})[_0x7147('0x4c')](handleEntityNotFound(_0x4c78ae,null))['then'](removeEntity(_0x4c78ae,null))['catch'](handleError(_0x4c78ae,null));};exports['describe']=function(_0x283a65,_0x130f2d){return db['OpenchannelMessage'][_0x7147('0x5b')]()[_0x7147('0x4c')](respondWithResult(_0x130f2d,null))['catch'](handleError(_0x130f2d,null));};var interaction_log=require(_0x7147('0x14'))('openchannel-interactions');exports[_0x7147('0x5c')]=function(_0x36f0ec,_0xe370ba,_0x16b3f6){var _0x55381b={'agent':{},'channel':_0x7147('0x5d')};if(_0x36f0ec[_0x7147('0x58')]['id']){delete _0x36f0ec[_0x7147('0x58')]['id'];}_0x36f0ec[_0x7147('0x58')]['read']=!![];_0x36f0ec['body']['readAt']=moment()[_0x7147('0x5e')](_0x7147('0x5f'));_0x36f0ec[_0x7147('0x58')][_0x7147('0x60')]=_0x36f0ec[_0x7147('0x58')]['UserId']||_0x36f0ec[_0x7147('0x61')]['id'];_0x55381b[_0x7147('0x62')]['id']=_0x36f0ec['body'][_0x7147('0x60')];return db[_0x7147('0x3b')][_0x7147('0x5a')]({'where':{'id':_0x36f0ec[_0x7147('0x53')]['id'],'UserId':null}})[_0x7147('0x4c')](handleEntityNotFound(_0xe370ba,null))['then'](saveUpdates(_0x36f0ec[_0x7147('0x58')],null))[_0x7147('0x4c')](function(_0x204505){if(_0x204505){_0x55381b[_0x7147('0x28')]=_0x204505[_0x7147('0x63')]({'plain':!![]});return db[_0x7147('0x64')][_0x7147('0x5a')]({'where':{'id':_0x204505['OpenchannelInteractionId']}});}return null;})[_0x7147('0x4c')](handleEntityNotFound(_0xe370ba,null))[_0x7147('0x4c')](function(_0xc756fe){if(_0xc756fe){return _0xc756fe[_0x7147('0x59')]({'UserId':_0x36f0ec[_0x7147('0x58')]['UserId'],'read1stAt':_[_0x7147('0x65')](_0xc756fe[_0x7147('0x66')])?moment()['format'](_0x7147('0x5f')):undefined});}return null;})[_0x7147('0x4c')](function(_0x33f135){if(_0x33f135){_0x55381b[_0x7147('0x67')]=_0x33f135[_0x7147('0x63')]({'plain':!![]});interaction_log['info'](_0x7147('0x68'),_0x36f0ec[_0x7147('0x61')]['id'],_0x36f0ec['user'][_0x7147('0x38')],_0x36f0ec['user'][_0x7147('0x69')],_0x55381b[_0x7147('0x67')]['id'],_0x36f0ec[_0x7147('0x58')]?JSON[_0x7147('0x26')](_0x36f0ec[_0x7147('0x58')]):'null');return respondWithRpcPromise(_0x7147('0x6a'),'acceptMessage',_0x55381b);}return null;})[_0x7147('0x4c')](function(_0x4bbbad){var _0x3d1ba4='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4bbbad[_0x7147('0x28')][_0x7147('0x6b')];return db[_0x7147('0x6c')][_0x7147('0x3e')](_0x3d1ba4,{'type':db[_0x7147('0x6d')][_0x7147('0x6e')]['SELECT'],'raw':!![]})[_0x7147('0x4c')](function(_0x54458a){return _0x54458a;});})[_0x7147('0x4c')](function(_0x44b551){if(_0x44b551){_0x55381b['message']['contact']=_0x44b551[0x0];if(!_0x36f0ec[_0x7147('0x58')][_0x7147('0x60')])return;return db[_0x7147('0x6f')]['find']({'where':{'id':_0x36f0ec[_0x7147('0x58')][_0x7147('0x60')],'role':'agent'},'attributes':['id','name',_0x7147('0x70'),_0x7147('0x71'),_0x7147('0x72')],'raw':!![]});}return null;})['then'](function(_0x25d85f){if(!_0x25d85f)return null;_0x55381b[_0x7147('0x28')][_0x7147('0x62')]=_0x25d85f;return _0x55381b;})[_0x7147('0x4c')](function(_0x3f4078){if(_0x3f4078){if(_0x36f0ec[_0x7147('0x58')][_0x7147('0x73')]){_0x55381b['message'][_0x7147('0x74')]=util[_0x7147('0x5e')]('SIP/%s',_0x36f0ec[_0x7147('0x61')][_0x7147('0x38')]);_0x55381b[_0x7147('0x28')][_0x7147('0x75')]=_0x55381b['channel'];_0x55381b[_0x7147('0x28')][_0x7147('0x76')]=_0x55381b[_0x7147('0x75')];_0x55381b['message']['event']='accept';return respondWithRpcPromise(_0x7147('0x77'),_0x7147('0x77'),{'event':'acceptmessage','message':_0x55381b[_0x7147('0x28')]},client9002)['then'](function(){return _0x55381b;});}return _0x55381b;}return null;})[_0x7147('0x4c')](respondWithResult(_0xe370ba,null))[_0x7147('0x51')](handleError(_0xe370ba,null));};var interaction_log=require(_0x7147('0x14'))(_0x7147('0x78'));exports[_0x7147('0x35')]=function(_0x1b15c9,_0x23df04,_0x17a390){var _0x104cd1={'agent':{},'channel':_0x7147('0x5d')};if(_0x1b15c9[_0x7147('0x58')]['id']){delete _0x1b15c9['body']['id'];}_0x1b15c9[_0x7147('0x58')][_0x7147('0x60')]=_0x1b15c9[_0x7147('0x58')][_0x7147('0x60')]||_0x1b15c9[_0x7147('0x61')]['id'];_0x104cd1[_0x7147('0x62')]['id']=_0x1b15c9['body'][_0x7147('0x60')];return db[_0x7147('0x3b')][_0x7147('0x5a')]({'where':{'id':_0x1b15c9['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x23df04,null))[_0x7147('0x4c')](function(_0x5e74be){if(_0x5e74be){_0x104cd1[_0x7147('0x28')]=_0x5e74be['get']({'plain':!![]});return db[_0x7147('0x64')][_0x7147('0x5a')]({'where':{'id':_0x5e74be['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x23df04,null))[_0x7147('0x4c')](function(_0x565051){if(_0x565051){_0x104cd1[_0x7147('0x67')]=_0x565051['get']({'plain':!![]});interaction_log[_0x7147('0x22')](_0x7147('0x79'),_0x1b15c9[_0x7147('0x61')]['id'],_0x1b15c9[_0x7147('0x61')]['name'],_0x1b15c9[_0x7147('0x61')][_0x7147('0x69')],_0x104cd1[_0x7147('0x67')]['id'],_0x1b15c9['body']?JSON['stringify'](_0x1b15c9[_0x7147('0x58')]):_0x7147('0x7a'));return respondWithRpcPromise(_0x7147('0x7b'),_0x7147('0x7c'),_0x104cd1);}return null;})[_0x7147('0x4c')](function(_0x28666c){var _0x54c680=_0x7147('0x7d')+_0x28666c[_0x7147('0x28')][_0x7147('0x6b')];return db['sequelize'][_0x7147('0x3e')](_0x54c680,{'type':db['Sequelize']['QueryTypes'][_0x7147('0x7e')],'raw':!![]})['then'](function(_0x44ad00){return _0x44ad00;});})[_0x7147('0x4c')](function(_0x376760){if(_0x376760){_0x104cd1[_0x7147('0x28')][_0x7147('0x7f')]=_0x376760[0x0];if(!_0x1b15c9['body'][_0x7147('0x60')])return;return db[_0x7147('0x6f')][_0x7147('0x5a')]({'where':{'id':_0x1b15c9[_0x7147('0x58')][_0x7147('0x60')],'role':'agent'},'attributes':['id',_0x7147('0x38'),_0x7147('0x70'),_0x7147('0x71'),_0x7147('0x72')],'raw':!![]});}return null;})[_0x7147('0x4c')](function(_0x5c6ec1){if(!_0x5c6ec1)return null;_0x104cd1[_0x7147('0x28')][_0x7147('0x62')]=_0x5c6ec1;return _0x104cd1;})[_0x7147('0x4c')](function(_0x2dbb1d){if(_0x2dbb1d){_0x2dbb1d[_0x7147('0x28')][_0x7147('0x74')]=util[_0x7147('0x5e')]('SIP/%s',_0x1b15c9[_0x7147('0x61')]['name']);_0x2dbb1d[_0x7147('0x28')]['channel']=_0x104cd1['channel'];_0x2dbb1d[_0x7147('0x28')][_0x7147('0x76')]=_0x104cd1['channel'];_0x2dbb1d[_0x7147('0x28')]['event']='reject';respondWithRpcPromise('EventManager',_0x7147('0x77'),{'event':_0x7147('0x80'),'message':_0x2dbb1d[_0x7147('0x28')]},client9002);return _0x104cd1;}return null;})[_0x7147('0x4c')](respondWithResult(_0x23df04,null))[_0x7147('0x51')](handleError(_0x23df04,null));}; \ No newline at end of file +var _0x9fe9=['fullname','motionChannel','event','rejectmessage','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client','request','then','info','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','destroy','stack','send','fieldName','type','key','model','map','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','OpenchannelMessage','includeAll','findAll','rows','show','params','include','options','create','body','find','describe','openchannel-interactions','accept','openchannel','read','readAt','format','UserId','user','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','contact','User','email','internal','agent','manual','interface','SIP/%s','channel','EventManager','get','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','ContactId','Sequelize'];(function(_0x3c22e0,_0x1dc6ea){var _0x215811=function(_0x1b453c){while(--_0x1b453c){_0x3c22e0['push'](_0x3c22e0['shift']());}};_0x215811(++_0x1dc6ea);}(_0x9fe9,0x184));var _0x99fe=function(_0x5a43b7,_0x11614c){_0x5a43b7=_0x5a43b7-0x0;var _0x1f0941=_0x9fe9[_0x5a43b7];return _0x1f0941;};'use strict';var emlformat=require(_0x99fe('0x0'));var rimraf=require(_0x99fe('0x1'));var zipdir=require(_0x99fe('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99fe('0x3'));var moment=require(_0x99fe('0x4'));var BPromise=require(_0x99fe('0x5'));var Mustache=require(_0x99fe('0x6'));var util=require(_0x99fe('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x99fe('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x99fe('0x9'));var _=require('lodash');var squel=require(_0x99fe('0xa'));var crypto=require('crypto');var jsforce=require(_0x99fe('0xb'));var deskjs=require(_0x99fe('0xc'));var toCsv=require(_0x99fe('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x99fe('0xd'));var authService=require(_0x99fe('0xe'));var qs=require(_0x99fe('0xf'));var as=require(_0x99fe('0x10'));var hardwareService=require(_0x99fe('0x11'));var logger=require(_0x99fe('0x12'))(_0x99fe('0x13'));var utils=require('../../config/utils');var config=require(_0x99fe('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x99fe('0x15'))['db'];config[_0x99fe('0x16')]=_[_0x99fe('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x99fe('0x18'))(new Redis(config[_0x99fe('0x16')]));require(_0x99fe('0x19'))['register'](socket);var jayson=require(_0x99fe('0x1a'));var client=jayson[_0x99fe('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0x99fe('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x278f5a,_0x826faf,_0x1ac581,_0x2aa7b5){return new BPromise(function(_0x3f86c8,_0x2808e2){var _0x5997ae=_0x2aa7b5||client;return _0x5997ae[_0x99fe('0x1c')](_0x278f5a,_0x1ac581)[_0x99fe('0x1d')](function(_0x2c878b){logger[_0x99fe('0x1e')]('OpenchannelMessage,\x20%s,\x20%s',_0x826faf,_0x99fe('0x1f'));logger['debug'](_0x99fe('0x20'),_0x826faf,_0x99fe('0x1f'),JSON['stringify'](_0x2c878b));if(_0x2c878b[_0x99fe('0x21')]){if(_0x2c878b[_0x99fe('0x21')]['code']===0x1f4){logger[_0x99fe('0x21')](_0x99fe('0x22'),_0x826faf,_0x2c878b[_0x99fe('0x21')][_0x99fe('0x23')]);return _0x2808e2(_0x2c878b[_0x99fe('0x21')][_0x99fe('0x23')]);}logger['error'](_0x99fe('0x22'),_0x826faf,_0x2c878b['error'][_0x99fe('0x23')]);return _0x3f86c8(_0x2c878b['error'][_0x99fe('0x23')]);}else{logger[_0x99fe('0x1e')]('OpenchannelMessage,\x20%s,\x20%s',_0x826faf,_0x99fe('0x1f'));_0x3f86c8(_0x2c878b[_0x99fe('0x24')]['message']);}})[_0x99fe('0x25')](function(_0x2ef31b){logger[_0x99fe('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0x826faf,_0x2ef31b);_0x2808e2(_0x2ef31b);});});}function respondWithStatusCode(_0xe777e3,_0x34e01f){_0x34e01f=_0x34e01f||0xcc;return function(_0x36ae6d){if(_0x36ae6d){return _0xe777e3[_0x99fe('0x26')](_0x34e01f);}return _0xe777e3[_0x99fe('0x27')](_0x34e01f)[_0x99fe('0x28')]();};}function respondWithResult(_0x39337,_0x2de3db){_0x2de3db=_0x2de3db||0xc8;return function(_0xab7ad0){if(_0xab7ad0){return _0x39337[_0x99fe('0x27')](_0x2de3db)[_0x99fe('0x29')](_0xab7ad0);}};}function respondWithFilteredResult(_0x559998,_0x2d20fa){return function(_0x42873e){if(_0x42873e){var _0x33a344=typeof _0x2d20fa[_0x99fe('0x2a')]==='undefined'&&typeof _0x2d20fa[_0x99fe('0x2b')]==='undefined';var _0x4f84f7=_0x42873e[_0x99fe('0x2c')];var _0x3e58bc=_0x33a344?0x0:_0x2d20fa['offset'];var _0xc446b=_0x33a344?_0x42873e[_0x99fe('0x2c')]:_0x2d20fa['offset']+_0x2d20fa[_0x99fe('0x2b')];var _0x16e2bd;if(_0xc446b>=_0x4f84f7){_0xc446b=_0x4f84f7;_0x16e2bd=0xc8;}else{_0x16e2bd=0xce;}_0x559998['status'](_0x16e2bd);return _0x559998[_0x99fe('0x2d')](_0x99fe('0x2e'),_0x3e58bc+'-'+_0xc446b+'/'+_0x4f84f7)[_0x99fe('0x29')](_0x42873e);}return null;};}function patchUpdates(_0x43d77a){return function(_0x6b45ad){try{jsonpatch['apply'](_0x6b45ad,_0x43d77a,!![]);}catch(_0x49020b){return BPromise[_0x99fe('0x2f')](_0x49020b);}return _0x6b45ad[_0x99fe('0x30')]();};}function saveUpdates(_0xa2d92b,_0x47a0b3){return function(_0x1ac934){if(_0x1ac934){return _0x1ac934[_0x99fe('0x31')](_0xa2d92b)[_0x99fe('0x1d')](function(_0xf4cc66){return _0xf4cc66;});}return null;};}function removeEntity(_0x2a31da,_0x21f5ad){return function(_0x1cd717){if(_0x1cd717){return _0x1cd717[_0x99fe('0x32')]()[_0x99fe('0x1d')](function(){_0x2a31da[_0x99fe('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b615b,_0x3d1876){return function(_0x5d47f7){if(!_0x5d47f7){_0x1b615b[_0x99fe('0x26')](0x194);}return _0x5d47f7;};}function handleError(_0x5f1eef,_0x31957f){_0x31957f=_0x31957f||0x1f4;return function(_0x2647d6){logger[_0x99fe('0x21')](_0x2647d6[_0x99fe('0x33')]);if(_0x2647d6['name']){delete _0x2647d6['name'];}_0x5f1eef['status'](_0x31957f)[_0x99fe('0x34')](_0x2647d6);};}exports['index']=function(_0x21e4a7,_0x513582){var _0x13af65={},_0x4cf21f={},_0x20ad6f={'count':0x0,'rows':[]};var _0x801ddf=_['map'](db['OpenchannelMessage']['rawAttributes'],function(_0x45e557){return{'name':_0x45e557[_0x99fe('0x35')],'type':_0x45e557[_0x99fe('0x36')][_0x99fe('0x37')]};});_0x4cf21f[_0x99fe('0x38')]=_[_0x99fe('0x39')](_0x801ddf,_0x99fe('0x3a'));_0x4cf21f['query']=_[_0x99fe('0x3b')](_0x21e4a7[_0x99fe('0x3c')]);_0x4cf21f[_0x99fe('0x3d')]=_[_0x99fe('0x3e')](_0x4cf21f[_0x99fe('0x38')],_0x4cf21f[_0x99fe('0x3c')]);_0x13af65[_0x99fe('0x3f')]=_[_0x99fe('0x3e')](_0x4cf21f[_0x99fe('0x38')],qs[_0x99fe('0x40')](_0x21e4a7[_0x99fe('0x3c')][_0x99fe('0x40')]));_0x13af65[_0x99fe('0x3f')]=_0x13af65[_0x99fe('0x3f')][_0x99fe('0x41')]?_0x13af65['attributes']:_0x4cf21f[_0x99fe('0x38')];if(!_0x21e4a7['query'][_0x99fe('0x42')]('nolimit')){_0x13af65['limit']=qs[_0x99fe('0x2b')](_0x21e4a7['query'][_0x99fe('0x2b')]);_0x13af65[_0x99fe('0x2a')]=qs[_0x99fe('0x2a')](_0x21e4a7[_0x99fe('0x3c')][_0x99fe('0x2a')]);}_0x13af65[_0x99fe('0x43')]=qs[_0x99fe('0x44')](_0x21e4a7[_0x99fe('0x3c')][_0x99fe('0x44')]);_0x13af65['where']=qs[_0x99fe('0x3d')](_[_0x99fe('0x45')](_0x21e4a7[_0x99fe('0x3c')],_0x4cf21f[_0x99fe('0x3d')]),_0x801ddf);if(_0x21e4a7[_0x99fe('0x3c')][_0x99fe('0x46')]){_0x13af65[_0x99fe('0x47')]=_['merge'](_0x13af65[_0x99fe('0x47')],{'$or':_[_0x99fe('0x39')](_0x801ddf,function(_0x3ee3ed){if(_0x3ee3ed[_0x99fe('0x36')]!=='VIRTUAL'){var _0x2c6e54={};_0x2c6e54[_0x3ee3ed[_0x99fe('0x3a')]]={'$like':'%'+_0x21e4a7[_0x99fe('0x3c')][_0x99fe('0x46')]+'%'};return _0x2c6e54;}})});}_0x13af65=_[_0x99fe('0x48')]({},_0x13af65,_0x21e4a7['options']);var _0x2fda00={'where':_0x13af65[_0x99fe('0x47')]};return db[_0x99fe('0x49')][_0x99fe('0x2c')](_0x2fda00)[_0x99fe('0x1d')](function(_0x1ed5dc){_0x20ad6f['count']=_0x1ed5dc;if(_0x21e4a7[_0x99fe('0x3c')][_0x99fe('0x4a')]){_0x13af65['include']=[{'all':!![]}];}return db[_0x99fe('0x49')][_0x99fe('0x4b')](_0x13af65);})[_0x99fe('0x1d')](function(_0x1817b3){_0x20ad6f[_0x99fe('0x4c')]=_0x1817b3;return _0x20ad6f;})['then'](respondWithFilteredResult(_0x513582,_0x13af65))['catch'](handleError(_0x513582,null));};exports[_0x99fe('0x4d')]=function(_0x50e855,_0x2f1908){var _0x24a080={'raw':!![],'where':{'id':_0x50e855[_0x99fe('0x4e')]['id']}},_0x58d330={};_0x58d330[_0x99fe('0x38')]=_[_0x99fe('0x3b')](db[_0x99fe('0x49')]['rawAttributes']);_0x58d330[_0x99fe('0x3c')]=_['keys'](_0x50e855['query']);_0x58d330[_0x99fe('0x3d')]=_['intersection'](_0x58d330[_0x99fe('0x38')],_0x58d330[_0x99fe('0x3c')]);_0x24a080['attributes']=_[_0x99fe('0x3e')](_0x58d330[_0x99fe('0x38')],qs[_0x99fe('0x40')](_0x50e855[_0x99fe('0x3c')][_0x99fe('0x40')]));_0x24a080[_0x99fe('0x3f')]=_0x24a080[_0x99fe('0x3f')]['length']?_0x24a080[_0x99fe('0x3f')]:_0x58d330[_0x99fe('0x38')];if(_0x50e855[_0x99fe('0x3c')][_0x99fe('0x4a')]){_0x24a080[_0x99fe('0x4f')]=[{'all':!![]}];}_0x24a080=_[_0x99fe('0x48')]({},_0x24a080,_0x50e855[_0x99fe('0x50')]);return db['OpenchannelMessage']['find'](_0x24a080)['then'](handleEntityNotFound(_0x2f1908,null))[_0x99fe('0x1d')](respondWithResult(_0x2f1908,null))[_0x99fe('0x25')](handleError(_0x2f1908,null));};exports[_0x99fe('0x51')]=function(_0x1e532d,_0x443e5d){return db[_0x99fe('0x49')][_0x99fe('0x51')](_0x1e532d['body'],{})[_0x99fe('0x1d')](respondWithResult(_0x443e5d,0xc9))[_0x99fe('0x25')](handleError(_0x443e5d,null));};exports['update']=function(_0x3a9d5e,_0x2cf76b){if(_0x3a9d5e[_0x99fe('0x52')]['id']){delete _0x3a9d5e[_0x99fe('0x52')]['id'];}return db[_0x99fe('0x49')][_0x99fe('0x53')]({'where':{'id':_0x3a9d5e[_0x99fe('0x4e')]['id']}})[_0x99fe('0x1d')](handleEntityNotFound(_0x2cf76b,null))[_0x99fe('0x1d')](saveUpdates(_0x3a9d5e['body'],null))[_0x99fe('0x1d')](respondWithResult(_0x2cf76b,null))[_0x99fe('0x25')](handleError(_0x2cf76b,null));};exports[_0x99fe('0x32')]=function(_0x4c8f0a,_0x1d29bb){return db[_0x99fe('0x49')][_0x99fe('0x53')]({'where':{'id':_0x4c8f0a[_0x99fe('0x4e')]['id']}})[_0x99fe('0x1d')](handleEntityNotFound(_0x1d29bb,null))[_0x99fe('0x1d')](removeEntity(_0x1d29bb,null))[_0x99fe('0x25')](handleError(_0x1d29bb,null));};exports[_0x99fe('0x54')]=function(_0x5d8589,_0x3d03b3){return db[_0x99fe('0x49')]['describe']()[_0x99fe('0x1d')](respondWithResult(_0x3d03b3,null))['catch'](handleError(_0x3d03b3,null));};var interaction_log=require(_0x99fe('0x12'))(_0x99fe('0x55'));exports[_0x99fe('0x56')]=function(_0x1cd76d,_0x4f2e88,_0x5f05d1){var _0x31ab00={'agent':{},'channel':_0x99fe('0x57')};if(_0x1cd76d[_0x99fe('0x52')]['id']){delete _0x1cd76d[_0x99fe('0x52')]['id'];}_0x1cd76d[_0x99fe('0x52')][_0x99fe('0x58')]=!![];_0x1cd76d[_0x99fe('0x52')][_0x99fe('0x59')]=moment()[_0x99fe('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');_0x1cd76d[_0x99fe('0x52')]['UserId']=_0x1cd76d[_0x99fe('0x52')][_0x99fe('0x5b')]||_0x1cd76d[_0x99fe('0x5c')]['id'];_0x31ab00['agent']['id']=_0x1cd76d[_0x99fe('0x52')][_0x99fe('0x5b')];return db['OpenchannelMessage'][_0x99fe('0x53')]({'where':{'id':_0x1cd76d[_0x99fe('0x4e')]['id'],'UserId':null}})[_0x99fe('0x1d')](handleEntityNotFound(_0x4f2e88,null))[_0x99fe('0x1d')](saveUpdates(_0x1cd76d[_0x99fe('0x52')],null))[_0x99fe('0x1d')](function(_0x4636f9){if(_0x4636f9){_0x31ab00[_0x99fe('0x23')]=_0x4636f9['get']({'plain':!![]});return db[_0x99fe('0x5d')][_0x99fe('0x53')]({'where':{'id':_0x4636f9[_0x99fe('0x5e')]}});}return null;})['then'](handleEntityNotFound(_0x4f2e88,null))[_0x99fe('0x1d')](function(_0x217e64){if(_0x217e64){return _0x217e64[_0x99fe('0x31')]({'UserId':_0x1cd76d[_0x99fe('0x52')]['UserId'],'read1stAt':_[_0x99fe('0x5f')](_0x217e64[_0x99fe('0x60')])?moment()['format'](_0x99fe('0x61')):undefined});}return null;})[_0x99fe('0x1d')](function(_0x50dd3f){if(_0x50dd3f){_0x31ab00[_0x99fe('0x62')]=_0x50dd3f['get']({'plain':!![]});interaction_log[_0x99fe('0x1e')](_0x99fe('0x63'),_0x1cd76d['user']['id'],_0x1cd76d[_0x99fe('0x5c')]['name'],_0x1cd76d[_0x99fe('0x5c')][_0x99fe('0x64')],_0x31ab00[_0x99fe('0x62')]['id'],_0x1cd76d[_0x99fe('0x52')]?JSON[_0x99fe('0x65')](_0x1cd76d[_0x99fe('0x52')]):'null');return respondWithRpcPromise(_0x99fe('0x66'),'acceptMessage',_0x31ab00);}return null;})['then'](function(_0x59a970){var _0x2022bc=_0x99fe('0x67')+_0x59a970[_0x99fe('0x23')]['ContactId'];return db[_0x99fe('0x68')][_0x99fe('0x3c')](_0x2022bc,{'type':db['Sequelize'][_0x99fe('0x69')][_0x99fe('0x6a')],'raw':!![]})[_0x99fe('0x1d')](function(_0x7ddd13){return _0x7ddd13;});})[_0x99fe('0x1d')](function(_0x14390a){if(_0x14390a){_0x31ab00[_0x99fe('0x23')][_0x99fe('0x6b')]=_0x14390a[0x0];if(!_0x1cd76d[_0x99fe('0x52')][_0x99fe('0x5b')])return;return db[_0x99fe('0x6c')][_0x99fe('0x53')]({'where':{'id':_0x1cd76d[_0x99fe('0x52')]['UserId'],'role':'agent'},'attributes':['id',_0x99fe('0x3a'),'fullname',_0x99fe('0x6d'),_0x99fe('0x6e')],'raw':!![]});}return null;})[_0x99fe('0x1d')](function(_0x8bfcac){if(!_0x8bfcac)return null;_0x31ab00[_0x99fe('0x23')][_0x99fe('0x6f')]=_0x8bfcac;return _0x31ab00;})[_0x99fe('0x1d')](function(_0x2e1eed){if(_0x2e1eed){if(_0x1cd76d[_0x99fe('0x52')][_0x99fe('0x70')]){_0x31ab00['message'][_0x99fe('0x71')]=util[_0x99fe('0x5a')](_0x99fe('0x72'),_0x1cd76d[_0x99fe('0x5c')][_0x99fe('0x3a')]);_0x31ab00[_0x99fe('0x23')][_0x99fe('0x73')]=_0x31ab00[_0x99fe('0x73')];_0x31ab00[_0x99fe('0x23')]['motionChannel']=_0x31ab00[_0x99fe('0x73')];_0x31ab00[_0x99fe('0x23')]['event']=_0x99fe('0x56');return respondWithRpcPromise(_0x99fe('0x74'),'EventManager',{'event':'acceptmessage','message':_0x31ab00['message']},client9002)[_0x99fe('0x1d')](function(){return _0x31ab00;});}return _0x31ab00;}return null;})[_0x99fe('0x1d')](respondWithResult(_0x4f2e88,null))['catch'](handleError(_0x4f2e88,null));};var interaction_log=require(_0x99fe('0x12'))(_0x99fe('0x55'));exports[_0x99fe('0x2f')]=function(_0x5563bf,_0x154e34,_0x43bb9a){var _0x39fb4d={'agent':{},'channel':_0x99fe('0x57')};if(_0x5563bf[_0x99fe('0x52')]['id']){delete _0x5563bf[_0x99fe('0x52')]['id'];}_0x5563bf[_0x99fe('0x52')][_0x99fe('0x5b')]=_0x5563bf[_0x99fe('0x52')][_0x99fe('0x5b')]||_0x5563bf[_0x99fe('0x5c')]['id'];_0x39fb4d[_0x99fe('0x6f')]['id']=_0x5563bf[_0x99fe('0x52')][_0x99fe('0x5b')];return db[_0x99fe('0x49')][_0x99fe('0x53')]({'where':{'id':_0x5563bf[_0x99fe('0x4e')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x154e34,null))[_0x99fe('0x1d')](function(_0x28ffa1){if(_0x28ffa1){_0x39fb4d['message']=_0x28ffa1[_0x99fe('0x75')]({'plain':!![]});return db[_0x99fe('0x5d')]['find']({'where':{'id':_0x28ffa1[_0x99fe('0x5e')]}});}return null;})[_0x99fe('0x1d')](handleEntityNotFound(_0x154e34,null))['then'](function(_0x53ddf5){if(_0x53ddf5){_0x39fb4d[_0x99fe('0x62')]=_0x53ddf5['get']({'plain':!![]});interaction_log['info'](_0x99fe('0x76'),_0x5563bf['user']['id'],_0x5563bf['user']['name'],_0x5563bf[_0x99fe('0x5c')][_0x99fe('0x64')],_0x39fb4d[_0x99fe('0x62')]['id'],_0x5563bf[_0x99fe('0x52')]?JSON[_0x99fe('0x65')](_0x5563bf[_0x99fe('0x52')]):_0x99fe('0x77'));return respondWithRpcPromise(_0x99fe('0x78'),_0x99fe('0x79'),_0x39fb4d);}return null;})['then'](function(_0x2b68e1){var _0x4f08ad=_0x99fe('0x67')+_0x2b68e1[_0x99fe('0x23')][_0x99fe('0x7a')];return db[_0x99fe('0x68')][_0x99fe('0x3c')](_0x4f08ad,{'type':db[_0x99fe('0x7b')][_0x99fe('0x69')]['SELECT'],'raw':!![]})[_0x99fe('0x1d')](function(_0x1f548f){return _0x1f548f;});})[_0x99fe('0x1d')](function(_0x2bdfa3){if(_0x2bdfa3){_0x39fb4d[_0x99fe('0x23')][_0x99fe('0x6b')]=_0x2bdfa3[0x0];if(!_0x5563bf[_0x99fe('0x52')][_0x99fe('0x5b')])return;return db[_0x99fe('0x6c')][_0x99fe('0x53')]({'where':{'id':_0x5563bf[_0x99fe('0x52')][_0x99fe('0x5b')],'role':_0x99fe('0x6f')},'attributes':['id','name',_0x99fe('0x7c'),_0x99fe('0x6d'),_0x99fe('0x6e')],'raw':!![]});}return null;})['then'](function(_0x46b5af){if(!_0x46b5af)return null;_0x39fb4d[_0x99fe('0x23')][_0x99fe('0x6f')]=_0x46b5af;return _0x39fb4d;})['then'](function(_0x318695){if(_0x318695){_0x318695[_0x99fe('0x23')][_0x99fe('0x71')]=util[_0x99fe('0x5a')](_0x99fe('0x72'),_0x5563bf[_0x99fe('0x5c')]['name']);_0x318695[_0x99fe('0x23')][_0x99fe('0x73')]=_0x39fb4d[_0x99fe('0x73')];_0x318695[_0x99fe('0x23')][_0x99fe('0x7d')]=_0x39fb4d[_0x99fe('0x73')];_0x318695[_0x99fe('0x23')][_0x99fe('0x7e')]=_0x99fe('0x2f');respondWithRpcPromise(_0x99fe('0x74'),'EventManager',{'event':_0x99fe('0x7f'),'message':_0x318695[_0x99fe('0x23')]},client9002);return _0x39fb4d;}return null;})[_0x99fe('0x1d')](respondWithResult(_0x154e34,null))[_0x99fe('0x25')](handleError(_0x154e34,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 49286ab..c6e3506 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 _0x05b1=['remove','emit','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save'];(function(_0x482346,_0x5e784f){var _0x20e74d=function(_0x1f7f5a){while(--_0x1f7f5a){_0x482346['push'](_0x482346['shift']());}};_0x20e74d(++_0x5e784f);}(_0x05b1,0x1bd));var _0x105b=function(_0x553d6e,_0x3bf509){_0x553d6e=_0x553d6e-0x0;var _0x114958=_0x05b1[_0x553d6e];return _0x114958;};'use strict';var EventEmitter=require(_0x105b('0x0'));var OpenchannelMessage=require(_0x105b('0x1'))['db'][_0x105b('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x105b('0x3')](0x0);var events={'afterCreate':_0x105b('0x4'),'afterUpdate':'update','afterDestroy':_0x105b('0x5')};function emitEvent(_0x5a2251){return function(_0x56f861,_0x1f6669,_0x356ab2){OpenchannelMessageEvents[_0x105b('0x6')](_0x5a2251+':'+_0x56f861['id'],_0x56f861);OpenchannelMessageEvents[_0x105b('0x6')](_0x5a2251,_0x56f861);_0x356ab2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x105b('0x7')](e,emitEvent(event));}}module[_0x105b('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xaa32=['emit','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove'];(function(_0x43f298,_0x344aed){var _0x203671=function(_0x139be2){while(--_0x139be2){_0x43f298['push'](_0x43f298['shift']());}};_0x203671(++_0x344aed);}(_0xaa32,0x81));var _0x2aa3=function(_0x10d0f0,_0x1eba3d){_0x10d0f0=_0x10d0f0-0x0;var _0x93e308=_0xaa32[_0x10d0f0];return _0x93e308;};'use strict';var EventEmitter=require(_0x2aa3('0x0'));var OpenchannelMessage=require(_0x2aa3('0x1'))['db'][_0x2aa3('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x2aa3('0x3')](0x0);var events={'afterCreate':_0x2aa3('0x4'),'afterUpdate':_0x2aa3('0x5'),'afterDestroy':_0x2aa3('0x6')};function emitEvent(_0x8d15f8){return function(_0x5598bb,_0x38f56b,_0x5c2c2a){OpenchannelMessageEvents[_0x2aa3('0x7')](_0x8d15f8+':'+_0x5598bb['id'],_0x5598bb);OpenchannelMessageEvents[_0x2aa3('0x7')](_0x8d15f8,_0x5598bb);_0x5c2c2a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage['hook'](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 f4f371e..dc43378 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 _0x73fe=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','out','UserId','findOne','then','toLowerCase','catch','secret','CmContact','describe','find','OpenchannelInteraction','OpenchannelInteractionId','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','Interaction','omit','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x286847,_0x2c4bc8){var _0x57a7bd=function(_0x39a2d0){while(--_0x39a2d0){_0x286847['push'](_0x286847['shift']());}};_0x57a7bd(++_0x2c4bc8);}(_0x73fe,0x1b7));var _0xe73f=function(_0x193652,_0x3e142a){_0x193652=_0x193652-0x0;var _0x4bcb4f=_0x73fe[_0x193652];return _0x4bcb4f;};'use strict';var _=require(_0xe73f('0x0'));var util=require(_0xe73f('0x1'));var logger=require(_0xe73f('0x2'))('api');var moment=require(_0xe73f('0x3'));var BPromise=require(_0xe73f('0x4'));var rp=require(_0xe73f('0x5'));var fs=require('fs');var path=require(_0xe73f('0x6'));var rimraf=require(_0xe73f('0x7'));var config=require(_0xe73f('0x8'));var attributes=require(_0xe73f('0x9'));module['exports']=function(_0x56e5b5,_0x19b136){return _0x56e5b5['define'](_0xe73f('0xa'),attributes,{'tableName':_0xe73f('0xb'),'paranoid':![],'indexes':[{'name':_0xe73f('0xc'),'fields':[_0xe73f('0xd')],'type':_0xe73f('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x348aa4,_0x55ca91,_0x108ee3){var _0xf40b15=_0x56e5b5[_0xe73f('0xf')];var _0x27e618=_0x348aa4[_0xe73f('0x10')]({'plain':!![]});if(_0x27e618[_0xe73f('0x11')]['toLowerCase']()==='in'||_0x27e618['direction']['toLowerCase']()===_0xe73f('0x12')&&!_0x27e618['secret']&&!_['isNil'](_0x27e618[_0xe73f('0x13')])){_0xf40b15['OpenchannelInteraction'][_0xe73f('0x14')]({'where':{'id':_0x27e618['OpenchannelInteractionId']}})[_0xe73f('0x15')](function(_0x2a157e){if(_0x2a157e){_0x2a157e['update']({'lastMsgAt':_0x27e618['createdAt'],'lastMsgDirection':_0x27e618[_0xe73f('0x11')][_0xe73f('0x16')]()});}})[_0xe73f('0x17')](function(_0x9bda4b){console['error'](_0x9bda4b);});}if(_0x27e618[_0xe73f('0x11')]===_0xe73f('0x12')&&!_0x27e618[_0xe73f('0x18')]){var _0x595fdd;_0xf40b15[_0xe73f('0x19')][_0xe73f('0x1a')]()[_0xe73f('0x15')](function(_0x247a19){return _0xf40b15['OpenchannelAccount'][_0xe73f('0x1b')]({'where':{'id':_0x27e618['OpenchannelAccountId']},'include':[{'model':_0xf40b15[_0xe73f('0x1c')],'as':'Interactions','where':{'id':_0x27e618[_0xe73f('0x1d')]},'limit':0x1,'include':[{'model':_0xf40b15[_0xe73f('0x19')],'as':_0xe73f('0x1e'),'attributes':_[_0xe73f('0x1f')](_0x247a19)}]}]});})[_0xe73f('0x15')](function(_0xfa0444){_0x595fdd=_0xfa0444['get']({'plain':!![]});if(_0x595fdd&&_0x595fdd[_0xe73f('0x20')]){logger[_0xe73f('0x21')](_0xe73f('0x22'),'afterCreate',util[_0xe73f('0x23')](_0xe73f('0x24'),_0x27e618['id'],_0x595fdd[_0xe73f('0x20')]));if(_0x595fdd[_0xe73f('0x25')]&&_0x595fdd[_0xe73f('0x25')][_0xe73f('0x26')]){_0x27e618[_0xe73f('0x27')]=_[_0xe73f('0x28')](_0x595fdd['Interactions'][0x0],_0xe73f('0x1e'));_0x27e618['Contact']=_0x595fdd[_0xe73f('0x25')][0x0][_0xe73f('0x1e')];}var _0x55ca91={'method':'POST','uri':encodeURI(_0x595fdd['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x55ca91['method']){case _0xe73f('0x29'):_0x55ca91['qs']=_0x27e618;break;case'POST':_0x55ca91['body']=_0x27e618;break;}return rp(_0x55ca91)[_0xe73f('0x15')](function(_0x161510){logger['info'](_0xe73f('0x22'),'afterCreate',util['format'](_0xe73f('0x2a'),_0x27e618['id'],_0x595fdd[_0xe73f('0x20')]));if(_0x161510['body'][_0xe73f('0x2b')]&&_0x161510[_0xe73f('0xd')][_0xe73f('0x2b')]!=_0x27e618[_0xe73f('0x27')][_0xe73f('0x2b')]){return _0xf40b15['OpenchannelInteraction'][_0xe73f('0x2c')]({'threadId':_0x161510['body'][_0xe73f('0x2b')]},{'where':{'id':_0x27e618[_0xe73f('0x27')]['id']}});}else{return;}})[_0xe73f('0x15')](function(){return _0x348aa4[_0xe73f('0x2c')]({'read':!![]});})['catch'](function(_0x31768f){logger['error'](_0xe73f('0x22'),'afterCreate',util[_0xe73f('0x2d')](_0x31768f,{'showHidden':![],'depth':null}));_0x108ee3();});}else{_0x108ee3();}})[_0xe73f('0x2e')](function(){_0x108ee3();});}else{_0x108ee3();}}},'charset':_0xe73f('0x2f'),'collate':_0xe73f('0x30')});}; \ No newline at end of file +var _0x69d1=['findOne','OpenchannelInteractionId','then','update','createdAt','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','info','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','Contact','POST','method','GET','body','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','catch','finally','utf8mb4_unicode_ci','lodash','../../config/logger','api','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','fti_openchannel_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','OpenchannelInteraction'];(function(_0x3ba2a3,_0x34d0ba){var _0x2d0e38=function(_0x12ee87){while(--_0x12ee87){_0x3ba2a3['push'](_0x3ba2a3['shift']());}};_0x2d0e38(++_0x34d0ba);}(_0x69d1,0x143));var _0x169d=function(_0x6b8a5,_0x2448d7){_0x6b8a5=_0x6b8a5-0x0;var _0x3965cf=_0x69d1[_0x6b8a5];return _0x3965cf;};'use strict';var _=require(_0x169d('0x0'));var util=require('util');var logger=require(_0x169d('0x1'))(_0x169d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x169d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x169d('0x4'));var config=require(_0x169d('0x5'));var attributes=require(_0x169d('0x6'));module[_0x169d('0x7')]=function(_0x193a88,_0x45c311){return _0x193a88[_0x169d('0x8')](_0x169d('0x9'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x169d('0xa'),'fields':['body'],'type':_0x169d('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x17e6bb,_0x1886be,_0x975243){var _0x46d9e0=_0x193a88[_0x169d('0xc')];var _0x40395e=_0x17e6bb[_0x169d('0xd')]({'plain':!![]});if(_0x40395e[_0x169d('0xe')][_0x169d('0xf')]()==='in'||_0x40395e[_0x169d('0xe')][_0x169d('0xf')]()===_0x169d('0x10')&&!_0x40395e[_0x169d('0x11')]&&!_['isNil'](_0x40395e[_0x169d('0x12')])){_0x46d9e0[_0x169d('0x13')][_0x169d('0x14')]({'where':{'id':_0x40395e[_0x169d('0x15')]}})[_0x169d('0x16')](function(_0x34de3){if(_0x34de3){_0x34de3[_0x169d('0x17')]({'lastMsgAt':_0x40395e[_0x169d('0x18')],'lastMsgDirection':_0x40395e[_0x169d('0xe')][_0x169d('0xf')]()});}})['catch'](function(_0x6e0e22){console['error'](_0x6e0e22);});}if(_0x40395e[_0x169d('0xe')]===_0x169d('0x10')&&!_0x40395e[_0x169d('0x11')]){var _0x5dbb12;_0x46d9e0[_0x169d('0x19')][_0x169d('0x1a')]()['then'](function(_0x4f4d10){return _0x46d9e0[_0x169d('0x1b')][_0x169d('0x1c')]({'where':{'id':_0x40395e[_0x169d('0x1d')]},'include':[{'model':_0x46d9e0[_0x169d('0x13')],'as':_0x169d('0x1e'),'where':{'id':_0x40395e['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x46d9e0['CmContact'],'as':'Contact','attributes':_['keys'](_0x4f4d10)}]}]});})[_0x169d('0x16')](function(_0x60235a){_0x5dbb12=_0x60235a[_0x169d('0xd')]({'plain':!![]});if(_0x5dbb12&&_0x5dbb12['replyUri']){logger[_0x169d('0x1f')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0x169d('0x20')](_0x169d('0x21'),_0x40395e['id'],_0x5dbb12[_0x169d('0x22')]));if(_0x5dbb12[_0x169d('0x1e')]&&_0x5dbb12[_0x169d('0x1e')][_0x169d('0x23')]){_0x40395e[_0x169d('0x24')]=_['omit'](_0x5dbb12['Interactions'][0x0],_0x169d('0x25'));_0x40395e[_0x169d('0x25')]=_0x5dbb12['Interactions'][0x0][_0x169d('0x25')];}var _0x1886be={'method':_0x169d('0x26'),'uri':encodeURI(_0x5dbb12['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1886be[_0x169d('0x27')]){case _0x169d('0x28'):_0x1886be['qs']=_0x40395e;break;case'POST':_0x1886be[_0x169d('0x29')]=_0x40395e;break;}return rp(_0x1886be)[_0x169d('0x16')](function(_0x14845b){logger[_0x169d('0x1f')](_0x169d('0x2a'),_0x169d('0x2b'),util[_0x169d('0x20')](_0x169d('0x2c'),_0x40395e['id'],_0x5dbb12['replyUri']));if(_0x14845b['body']['threadId']&&_0x14845b[_0x169d('0x29')][_0x169d('0x2d')]!=_0x40395e['Interaction'][_0x169d('0x2d')]){return _0x46d9e0[_0x169d('0x13')]['update']({'threadId':_0x14845b['body']['threadId']},{'where':{'id':_0x40395e['Interaction']['id']}});}else{return;}})[_0x169d('0x16')](function(){return _0x17e6bb[_0x169d('0x17')]({'read':!![]});})[_0x169d('0x2e')](function(_0x4112a6){logger['error'](_0x169d('0x2a'),'afterCreate',util['inspect'](_0x4112a6,{'showHidden':![],'depth':null}));_0x975243();});}else{_0x975243();}})[_0x169d('0x2f')](function(){_0x975243();});}else{_0x975243();}}},'charset':'utf8mb4','collate':_0x169d('0x30')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 86a9a88..146b728 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(_0x3448ed,_0x34fde9){var _0x29bff0=function(_0x56b5d4){while(--_0x56b5d4){_0x3448ed['push'](_0x3448ed['shift']());}};_0x29bff0(++_0x34fde9);}(_0xadb5,0xad));var _0x5adb=function(_0x313342,_0x4fbf22){_0x313342=_0x313342-0x0;var _0x1ed4ad=_0xadb5[_0x313342];return _0x1ed4ad;};'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 _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x3a5f39,_0x34a675){var _0x4ec6e2=function(_0x2fd516){while(--_0x2fd516){_0x3a5f39['push'](_0x3a5f39['shift']());}};_0x4ec6e2(++_0x34a675);}(_0x7a54,0x106));var _0x47a5=function(_0x255b1f,_0x53733b){_0x255b1f=_0x255b1f-0x0;var _0x546918=_0x7a54[_0x255b1f];return _0x546918;};'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});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index f4b17c4..98d302b 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 _0xc506=['length','./openchannelMessage.events','save','remove','update','emit','register'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xc506,0x86));var _0x6c50=function(_0x4f8f52,_0x139a03){_0x4f8f52=_0x4f8f52-0x0;var _0x16c1d4=_0xc506[_0x4f8f52];return _0x16c1d4;};'use strict';var OpenchannelMessageEvents=require(_0x6c50('0x0'));var events=[_0x6c50('0x1'),_0x6c50('0x2'),_0x6c50('0x3')];function createListener(_0x2e254f,_0x3382d7){return function(_0xc68619){_0x3382d7[_0x6c50('0x4')](_0x2e254f,_0xc68619);};}function removeListener(_0x306ea5,_0x47b9df){return function(){OpenchannelMessageEvents['removeListener'](_0x306ea5,_0x47b9df);};}exports[_0x6c50('0x5')]=function(_0x557a8f){for(var _0x25743b=0x0,_0x6e7bc1=events[_0x6c50('0x6')];_0x25743b<_0x6e7bc1;_0x25743b++){var _0xc55ea9=events[_0x25743b];var _0x495120=createListener('openchannelMessage:'+_0xc55ea9,_0x557a8f);OpenchannelMessageEvents['on'](_0xc55ea9,_0x495120);}}; \ No newline at end of file +var _0x0618=['save','update','emit','removeListener','register','length','./openchannelMessage.events'];(function(_0x8e85da,_0x123600){var _0x419c05=function(_0x36d5ab){while(--_0x36d5ab){_0x8e85da['push'](_0x8e85da['shift']());}};_0x419c05(++_0x123600);}(_0x0618,0x1c6));var _0x8061=function(_0x304411,_0x1c8764){_0x304411=_0x304411-0x0;var _0x5c3bad=_0x0618[_0x304411];return _0x5c3bad;};'use strict';var OpenchannelMessageEvents=require(_0x8061('0x0'));var events=[_0x8061('0x1'),'remove',_0x8061('0x2')];function createListener(_0x29979d,_0x5b434b){return function(_0x57f7ae){_0x5b434b[_0x8061('0x3')](_0x29979d,_0x57f7ae);};}function removeListener(_0x6aff35,_0x382b13){return function(){OpenchannelMessageEvents[_0x8061('0x4')](_0x6aff35,_0x382b13);};}exports[_0x8061('0x5')]=function(_0x2c47b6){for(var _0x1cca7f=0x0,_0x9c161b=events[_0x8061('0x6')];_0x1cca7f<_0x9c161b;_0x1cca7f++){var _0x3bb894=events[_0x1cca7f];var _0x7bfd18=createListener('openchannelMessage:'+_0x3bb894,_0x2c47b6);OpenchannelMessageEvents['on'](_0x3bb894,_0x7bfd18);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 124d5bd..26646b8 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 _0xe3b0=['post','addTeams','addAgents','put','/:id','destroy','delete','removeTeams','removeAgents','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueue.controller','get','index','isAuthenticated','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe3b0,0x1b9));var _0x0e3b=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xe3b0[_0x39096d];return _0x13da4f;};'use strict';var multer=require(_0x0e3b('0x0'));var util=require(_0x0e3b('0x1'));var path=require('path');var timeout=require(_0x0e3b('0x2'));var express=require(_0x0e3b('0x3'));var router=express['Router']();var fs_extra=require(_0x0e3b('0x4'));var auth=require(_0x0e3b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0e3b('0x6'));var controller=require(_0x0e3b('0x7'));router[_0x0e3b('0x8')]('/',auth['isAuthenticated'](),controller[_0x0e3b('0x9')]);router['get']('/describe',auth[_0x0e3b('0xa')](),controller['describe']);router['get']('/:id',auth[_0x0e3b('0xa')](),controller[_0x0e3b('0xb')]);router[_0x0e3b('0x8')](_0x0e3b('0xc'),auth[_0x0e3b('0xa')](),controller['getMembers']);router[_0x0e3b('0x8')](_0x0e3b('0xd'),auth[_0x0e3b('0xa')](),controller[_0x0e3b('0xe')]);router[_0x0e3b('0x8')](_0x0e3b('0xf'),auth[_0x0e3b('0xa')](),controller[_0x0e3b('0x10')]);router['post']('/',auth[_0x0e3b('0xa')](),controller[_0x0e3b('0x11')]);router[_0x0e3b('0x12')](_0x0e3b('0xd'),auth['isAuthenticated'](),controller[_0x0e3b('0x13')]);router[_0x0e3b('0x12')](_0x0e3b('0xf'),auth[_0x0e3b('0xa')](),controller[_0x0e3b('0x14')]);router[_0x0e3b('0x15')](_0x0e3b('0x16'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x0e3b('0x16'),auth[_0x0e3b('0xa')](),controller[_0x0e3b('0x17')]);router[_0x0e3b('0x18')](_0x0e3b('0xd'),auth[_0x0e3b('0xa')](),controller[_0x0e3b('0x19')]);router[_0x0e3b('0x18')](_0x0e3b('0xf'),auth[_0x0e3b('0xa')](),controller[_0x0e3b('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xdc99=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','create','post','put','update','delete','destroy','removeTeams','removeAgents','exports','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueue.controller'];(function(_0x204e6c,_0x3abcf1){var _0x460a43=function(_0x8eebd3){while(--_0x8eebd3){_0x204e6c['push'](_0x204e6c['shift']());}};_0x460a43(++_0x3abcf1);}(_0xdc99,0x12d));var _0x9dc9=function(_0x5cc8,_0x1faa02){_0x5cc8=_0x5cc8-0x0;var _0x450661=_0xdc99[_0x5cc8];return _0x450661;};'use strict';var multer=require('multer');var util=require(_0x9dc9('0x0'));var path=require('path');var timeout=require(_0x9dc9('0x1'));var express=require(_0x9dc9('0x2'));var router=express['Router']();var fs_extra=require(_0x9dc9('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9dc9('0x4'));var config=require(_0x9dc9('0x5'));var controller=require(_0x9dc9('0x6'));router[_0x9dc9('0x7')]('/',auth[_0x9dc9('0x8')](),controller[_0x9dc9('0x9')]);router[_0x9dc9('0x7')](_0x9dc9('0xa'),auth['isAuthenticated'](),controller[_0x9dc9('0xb')]);router[_0x9dc9('0x7')](_0x9dc9('0xc'),auth[_0x9dc9('0x8')](),controller[_0x9dc9('0xd')]);router[_0x9dc9('0x7')](_0x9dc9('0xe'),auth[_0x9dc9('0x8')](),controller['getMembers']);router[_0x9dc9('0x7')](_0x9dc9('0xf'),auth[_0x9dc9('0x8')](),controller[_0x9dc9('0x10')]);router['get'](_0x9dc9('0x11'),auth[_0x9dc9('0x8')](),controller[_0x9dc9('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9dc9('0x13')]);router[_0x9dc9('0x14')]('/:id/teams',auth[_0x9dc9('0x8')](),controller['addTeams']);router[_0x9dc9('0x14')]('/:id/users',auth[_0x9dc9('0x8')](),controller['addAgents']);router[_0x9dc9('0x15')](_0x9dc9('0xc'),auth['isAuthenticated'](),controller[_0x9dc9('0x16')]);router[_0x9dc9('0x17')](_0x9dc9('0xc'),auth[_0x9dc9('0x8')](),controller[_0x9dc9('0x18')]);router[_0x9dc9('0x17')](_0x9dc9('0xf'),auth[_0x9dc9('0x8')](),controller[_0x9dc9('0x19')]);router['delete'](_0x9dc9('0x11'),auth[_0x9dc9('0x8')](),controller[_0x9dc9('0x1a')]);module[_0x9dc9('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 67ad2d8..ade076b 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 _0x6928=['rrmemory','beepall','sequelize','exports','STRING','name'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x6928,0x116));var _0x8692=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x6928[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0x8692('0x0'));module[_0x8692('0x1')]={'name':{'type':Sequelize[_0x8692('0x2')],'unique':_0x8692('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8692('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x8692('0x4'),_0x8692('0x5'),'roundrobin')}}; \ No newline at end of file +var _0xa0ee=['STRING','rrmemory','beepall','sequelize','exports','name'];(function(_0x385305,_0xa436d){var _0x6218ec=function(_0x359765){while(--_0x359765){_0x385305['push'](_0x385305['shift']());}};_0x6218ec(++_0xa436d);}(_0xa0ee,0xed));var _0xea0e=function(_0x54f060,_0x1de751){_0x54f060=_0x54f060-0x0;var _0xb2b587=_0xa0ee[_0x54f060];return _0xb2b587;};'use strict';var Sequelize=require(_0xea0e('0x0'));module[_0xea0e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xea0e('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xea0e('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xea0e('0x4'),_0xea0e('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index b52be3e..af973a6 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 _0xff24=['user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','toString','SELECT','every','TeamId','includes','all','union','compact','value','removeAgents','userOpenchannelQueue:remove','addAgents','spread','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','redis','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','include','OpenchannelQueue','findAll','rows','catch','show','params','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','describe','findOne','UserOpenchannelQueue','OpenchannelQueueId','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','SIP','Team','getTeams','addTeams','ids','User','online','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','removeTeams','Agents','field','tq.TeamId','team_has_openchannel_queues'];(function(_0x293488,_0x29e64d){var _0x5b33c4=function(_0x23a740){while(--_0x23a740){_0x293488['push'](_0x293488['shift']());}};_0x5b33c4(++_0x29e64d);}(_0xff24,0x1b6));var _0x4ff2=function(_0x5373aa,_0x4cf9e5){_0x5373aa=_0x5373aa-0x0;var _0x2171e1=_0xff24[_0x5373aa];return _0x2171e1;};'use strict';var emlformat=require(_0x4ff2('0x0'));var rimraf=require(_0x4ff2('0x1'));var zipdir=require(_0x4ff2('0x2'));var jsonpatch=require(_0x4ff2('0x3'));var rp=require(_0x4ff2('0x4'));var moment=require('moment');var BPromise=require(_0x4ff2('0x5'));var Mustache=require(_0x4ff2('0x6'));var util=require(_0x4ff2('0x7'));var path=require(_0x4ff2('0x8'));var sox=require(_0x4ff2('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4ff2('0xa'));var _=require(_0x4ff2('0xb'));var squel=require(_0x4ff2('0xc'));var crypto=require('crypto');var jsforce=require(_0x4ff2('0xd'));var deskjs=require(_0x4ff2('0xe'));var toCsv=require(_0x4ff2('0xf'));var querystring=require(_0x4ff2('0x10'));var Papa=require(_0x4ff2('0x11'));var Redis=require('ioredis');var authService=require(_0x4ff2('0x12'));var qs=require(_0x4ff2('0x13'));var as=require(_0x4ff2('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4ff2('0x15'));var utils=require(_0x4ff2('0x16'));var config=require(_0x4ff2('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x4ff2('0x18')]=_['defaults'](config[_0x4ff2('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x4ff2('0x19'))(new Redis(config[_0x4ff2('0x18')]));require(_0x4ff2('0x1a'))[_0x4ff2('0x1b')](socket);function respondWithStatusCode(_0x375b6a,_0x220456){_0x220456=_0x220456||0xcc;return function(_0x2ce371){if(_0x2ce371){return _0x375b6a[_0x4ff2('0x1c')](_0x220456);}return _0x375b6a[_0x4ff2('0x1d')](_0x220456)[_0x4ff2('0x1e')]();};}function respondWithResult(_0x520584,_0x10e7fc){_0x10e7fc=_0x10e7fc||0xc8;return function(_0x29bdc0){if(_0x29bdc0){return _0x520584[_0x4ff2('0x1d')](_0x10e7fc)[_0x4ff2('0x1f')](_0x29bdc0);}};}function respondWithFilteredResult(_0x14852f,_0xf85e56){return function(_0xba7de4){if(_0xba7de4){var _0x1112fe=typeof _0xf85e56[_0x4ff2('0x20')]===_0x4ff2('0x21')&&typeof _0xf85e56[_0x4ff2('0x22')]==='undefined';var _0x2a708d=_0xba7de4[_0x4ff2('0x23')];var _0x3f5577=_0x1112fe?0x0:_0xf85e56['offset'];var _0x50d2ed=_0x1112fe?_0xba7de4[_0x4ff2('0x23')]:_0xf85e56['offset']+_0xf85e56[_0x4ff2('0x22')];var _0x1ea771;if(_0x50d2ed>=_0x2a708d){_0x50d2ed=_0x2a708d;_0x1ea771=0xc8;}else{_0x1ea771=0xce;}_0x14852f['status'](_0x1ea771);return _0x14852f[_0x4ff2('0x24')](_0x4ff2('0x25'),_0x3f5577+'-'+_0x50d2ed+'/'+_0x2a708d)[_0x4ff2('0x1f')](_0xba7de4);}return null;};}function patchUpdates(_0x59bcb8){return function(_0x384f18){try{jsonpatch[_0x4ff2('0x26')](_0x384f18,_0x59bcb8,!![]);}catch(_0x2196d9){return BPromise[_0x4ff2('0x27')](_0x2196d9);}return _0x384f18[_0x4ff2('0x28')]();};}function saveUpdates(_0x2fe3b4,_0x47f819){return function(_0x663ca8){if(_0x663ca8){return _0x663ca8[_0x4ff2('0x29')](_0x2fe3b4)[_0x4ff2('0x2a')](function(_0x37364a){return _0x37364a;});}return null;};}function removeEntity(_0x18e501,_0x1b2399){return function(_0x289e3f){if(_0x289e3f){return _0x289e3f[_0x4ff2('0x2b')]()[_0x4ff2('0x2a')](function(){var _0x5c4df7=_0x289e3f[_0x4ff2('0x2c')]({'plain':!![]});var _0x1e2e88=_0x4ff2('0x2d');return db[_0x4ff2('0x2e')][_0x4ff2('0x2b')]({'where':{'type':_0x1e2e88,'resourceId':_0x5c4df7['id']}})[_0x4ff2('0x2a')](function(){return _0x289e3f;});})[_0x4ff2('0x2a')](function(){_0x18e501[_0x4ff2('0x1d')](0xcc)[_0x4ff2('0x1e')]();});}};}function handleEntityNotFound(_0x5220ff,_0x6fc8fc){return function(_0x397fdc){if(!_0x397fdc){_0x5220ff[_0x4ff2('0x1c')](0x194);}return _0x397fdc;};}function handleError(_0x50d1e1,_0x2c5afd){_0x2c5afd=_0x2c5afd||0x1f4;return function(_0x3f6438){logger[_0x4ff2('0x2f')](_0x3f6438[_0x4ff2('0x30')]);if(_0x3f6438['name']){delete _0x3f6438[_0x4ff2('0x31')];}_0x50d1e1['status'](_0x2c5afd)[_0x4ff2('0x32')](_0x3f6438);};}exports[_0x4ff2('0x33')]=function(_0x23c203,_0x56470e){var _0x99479f={},_0x3682c1={},_0x1f2d47={'count':0x0,'rows':[]};var _0xbcfbf=_['map'](db['OpenchannelQueue']['rawAttributes'],function(_0x126356){return{'name':_0x126356[_0x4ff2('0x34')],'type':_0x126356['type'][_0x4ff2('0x35')]};});_0x3682c1[_0x4ff2('0x36')]=_[_0x4ff2('0x37')](_0xbcfbf,_0x4ff2('0x31'));_0x3682c1[_0x4ff2('0x38')]=_[_0x4ff2('0x39')](_0x23c203[_0x4ff2('0x38')]);_0x3682c1[_0x4ff2('0x3a')]=_[_0x4ff2('0x3b')](_0x3682c1[_0x4ff2('0x36')],_0x3682c1['query']);_0x99479f['attributes']=_[_0x4ff2('0x3b')](_0x3682c1[_0x4ff2('0x36')],qs[_0x4ff2('0x3c')](_0x23c203['query'][_0x4ff2('0x3c')]));_0x99479f[_0x4ff2('0x3d')]=_0x99479f[_0x4ff2('0x3d')][_0x4ff2('0x3e')]?_0x99479f[_0x4ff2('0x3d')]:_0x3682c1[_0x4ff2('0x36')];if(!_0x23c203['query'][_0x4ff2('0x3f')](_0x4ff2('0x40'))){_0x99479f['limit']=qs['limit'](_0x23c203['query'][_0x4ff2('0x22')]);_0x99479f[_0x4ff2('0x20')]=qs[_0x4ff2('0x20')](_0x23c203[_0x4ff2('0x38')][_0x4ff2('0x20')]);}_0x99479f[_0x4ff2('0x41')]=qs[_0x4ff2('0x42')](_0x23c203[_0x4ff2('0x38')][_0x4ff2('0x42')]);_0x99479f[_0x4ff2('0x43')]=qs['filters'](_[_0x4ff2('0x44')](_0x23c203[_0x4ff2('0x38')],_0x3682c1['filters']),_0xbcfbf);if(_0x23c203[_0x4ff2('0x38')][_0x4ff2('0x45')]){_0x99479f[_0x4ff2('0x43')]=_['merge'](_0x99479f[_0x4ff2('0x43')],{'$or':_[_0x4ff2('0x37')](_0xbcfbf,function(_0x4f71e1){if(_0x4f71e1[_0x4ff2('0x46')]!==_0x4ff2('0x47')){var _0x37394b={};_0x37394b[_0x4f71e1[_0x4ff2('0x31')]]={'$like':'%'+_0x23c203[_0x4ff2('0x38')]['filter']+'%'};return _0x37394b;}})});}_0x99479f=_[_0x4ff2('0x48')]({},_0x99479f,_0x23c203[_0x4ff2('0x49')]);var _0x3d5f25={'where':_0x99479f[_0x4ff2('0x43')]};return db['OpenchannelQueue'][_0x4ff2('0x23')](_0x3d5f25)[_0x4ff2('0x2a')](function(_0x4b6629){_0x1f2d47[_0x4ff2('0x23')]=_0x4b6629;if(_0x23c203[_0x4ff2('0x38')]['includeAll']){_0x99479f[_0x4ff2('0x4a')]=[{'all':!![]}];}return db[_0x4ff2('0x4b')][_0x4ff2('0x4c')](_0x99479f);})[_0x4ff2('0x2a')](function(_0x209f90){_0x1f2d47[_0x4ff2('0x4d')]=_0x209f90;return _0x1f2d47;})[_0x4ff2('0x2a')](respondWithFilteredResult(_0x56470e,_0x99479f))[_0x4ff2('0x4e')](handleError(_0x56470e,null));};exports[_0x4ff2('0x4f')]=function(_0x268fab,_0x56d0d2){var _0x5929de={'raw':!![],'where':{'id':_0x268fab[_0x4ff2('0x50')]['id']}},_0x37c335={};_0x37c335[_0x4ff2('0x36')]=_[_0x4ff2('0x39')](db[_0x4ff2('0x4b')][_0x4ff2('0x51')]);_0x37c335[_0x4ff2('0x38')]=_[_0x4ff2('0x39')](_0x268fab[_0x4ff2('0x38')]);_0x37c335[_0x4ff2('0x3a')]=_[_0x4ff2('0x3b')](_0x37c335['model'],_0x37c335[_0x4ff2('0x38')]);_0x5929de[_0x4ff2('0x3d')]=_[_0x4ff2('0x3b')](_0x37c335[_0x4ff2('0x36')],qs[_0x4ff2('0x3c')](_0x268fab[_0x4ff2('0x38')][_0x4ff2('0x3c')]));_0x5929de[_0x4ff2('0x3d')]=_0x5929de[_0x4ff2('0x3d')][_0x4ff2('0x3e')]?_0x5929de['attributes']:_0x37c335[_0x4ff2('0x36')];if(_0x268fab[_0x4ff2('0x38')]['includeAll']){_0x5929de[_0x4ff2('0x4a')]=[{'all':!![]}];}_0x5929de=_[_0x4ff2('0x48')]({},_0x5929de,_0x268fab[_0x4ff2('0x49')]);return db['OpenchannelQueue'][_0x4ff2('0x52')](_0x5929de)['then'](handleEntityNotFound(_0x56d0d2,null))[_0x4ff2('0x2a')](respondWithResult(_0x56d0d2,null))['catch'](handleError(_0x56d0d2,null));};exports[_0x4ff2('0x53')]=function(_0x360b69,_0x30aff2){return db['OpenchannelQueue'][_0x4ff2('0x53')](_0x360b69[_0x4ff2('0x54')],{})['then'](function(_0x10d2f8){var _0x2da3af=_0x360b69[_0x4ff2('0x55')][_0x4ff2('0x2c')]({'plain':!![]});if(!_0x2da3af)throw new Error(_0x4ff2('0x56'));if(_0x2da3af[_0x4ff2('0x57')]===_0x4ff2('0x55')){var _0x5399e1=_0x10d2f8[_0x4ff2('0x2c')]({'plain':!![]});var _0x582570=_0x4ff2('0x2d');return db[_0x4ff2('0x58')][_0x4ff2('0x52')]({'where':{'name':_0x582570,'userProfileId':_0x2da3af[_0x4ff2('0x59')]},'raw':!![]})[_0x4ff2('0x2a')](function(_0x2db751){if(_0x2db751&&_0x2db751[_0x4ff2('0x5a')]===0x0){return db[_0x4ff2('0x2e')]['create']({'name':_0x5399e1[_0x4ff2('0x31')],'resourceId':_0x5399e1['id'],'type':_0x2db751[_0x4ff2('0x31')],'sectionId':_0x2db751['id']},{})[_0x4ff2('0x2a')](function(){return _0x10d2f8;});}else{return _0x10d2f8;}})[_0x4ff2('0x4e')](function(_0x17dc58){logger[_0x4ff2('0x2f')](_0x4ff2('0x5b'),_0x17dc58);throw _0x17dc58;});}return _0x10d2f8;})[_0x4ff2('0x2a')](respondWithResult(_0x30aff2,0xc9))[_0x4ff2('0x4e')](handleError(_0x30aff2,null));};exports[_0x4ff2('0x29')]=function(_0x3331d7,_0x5ebca2){if(_0x3331d7[_0x4ff2('0x54')]['id']){delete _0x3331d7[_0x4ff2('0x54')]['id'];}return db[_0x4ff2('0x4b')][_0x4ff2('0x52')]({'where':{'id':_0x3331d7[_0x4ff2('0x50')]['id']}})['then'](handleEntityNotFound(_0x5ebca2,null))['then'](saveUpdates(_0x3331d7[_0x4ff2('0x54')],null))[_0x4ff2('0x2a')](respondWithResult(_0x5ebca2,null))[_0x4ff2('0x4e')](handleError(_0x5ebca2,null));};exports[_0x4ff2('0x2b')]=function(_0x2afbb9,_0xc40375){return db[_0x4ff2('0x4b')][_0x4ff2('0x52')]({'where':{'id':_0x2afbb9[_0x4ff2('0x50')]['id']}})[_0x4ff2('0x2a')](handleEntityNotFound(_0xc40375,null))['then'](removeEntity(_0xc40375,null))[_0x4ff2('0x4e')](handleError(_0xc40375,null));};exports[_0x4ff2('0x5c')]=function(_0x361668,_0x1b74eb){return db[_0x4ff2('0x4b')][_0x4ff2('0x5c')]()[_0x4ff2('0x2a')](respondWithResult(_0x1b74eb,null))[_0x4ff2('0x4e')](handleError(_0x1b74eb,null));};exports['getMembers']=function(_0x38a132,_0x3e176d,_0x407083){var _0x9be318={'raw':!![],'where':{}},_0x4adb37={},_0x2abd89;return db[_0x4ff2('0x4b')][_0x4ff2('0x5d')]({'where':{'id':_0x38a132[_0x4ff2('0x50')]['id']}})[_0x4ff2('0x2a')](handleEntityNotFound(_0x3e176d,null))['then'](function(_0x25ba03){if(_0x25ba03){_0x2abd89=_0x25ba03[_0x4ff2('0x2c')]({'plain':!![]});_0x4adb37[_0x4ff2('0x36')]=_[_0x4ff2('0x39')](db[_0x4ff2('0x5e')][_0x4ff2('0x51')]);_0x4adb37[_0x4ff2('0x38')]=_[_0x4ff2('0x39')](_0x38a132[_0x4ff2('0x38')]);_0x4adb37[_0x4ff2('0x3a')]=_[_0x4ff2('0x3b')](_0x4adb37[_0x4ff2('0x36')],_0x4adb37[_0x4ff2('0x38')]);_0x9be318[_0x4ff2('0x3d')]=_[_0x4ff2('0x3b')](_0x4adb37[_0x4ff2('0x36')],qs[_0x4ff2('0x3c')](_0x38a132['query'][_0x4ff2('0x3c')]));_0x9be318['attributes']=_0x9be318[_0x4ff2('0x3d')][_0x4ff2('0x3e')]?_0x9be318[_0x4ff2('0x3d')]:_0x4adb37[_0x4ff2('0x36')];if(!_0x38a132[_0x4ff2('0x38')][_0x4ff2('0x3f')](_0x4ff2('0x40'))){_0x9be318[_0x4ff2('0x22')]=qs[_0x4ff2('0x22')](_0x38a132[_0x4ff2('0x38')][_0x4ff2('0x22')]);_0x9be318[_0x4ff2('0x20')]=qs[_0x4ff2('0x20')](_0x38a132[_0x4ff2('0x38')]['offset']);}_0x9be318[_0x4ff2('0x41')]=qs[_0x4ff2('0x42')](_0x38a132[_0x4ff2('0x38')][_0x4ff2('0x42')]);_0x9be318[_0x4ff2('0x43')]=qs[_0x4ff2('0x3a')](_[_0x4ff2('0x44')](_0x38a132['query'],_0x4adb37['filters']));_0x9be318['where'][_0x4ff2('0x5f')]=_0x25ba03['id'];if(_0x38a132[_0x4ff2('0x38')][_0x4ff2('0x45')]){_0x9be318[_0x4ff2('0x43')]=_[_0x4ff2('0x48')](_0x9be318['where'],{'$or':_['map'](_0x9be318[_0x4ff2('0x3d')],function(_0x48d290){var _0x401ed6={};_0x401ed6[_0x48d290]={'$like':'%'+_0x38a132['query'][_0x4ff2('0x45')]+'%'};return _0x401ed6;})});}_0x9be318=_[_0x4ff2('0x48')]({},_0x9be318,_0x38a132[_0x4ff2('0x49')]);return db[_0x4ff2('0x5e')][_0x4ff2('0x4c')](_0x9be318);}})[_0x4ff2('0x2a')](function(_0x1bc0a6){if(_0x1bc0a6){return db['User'][_0x4ff2('0x60')]({'where':{'id':_[_0x4ff2('0x37')](_0x1bc0a6,_0x4ff2('0x61')),'role':_0x4ff2('0x62')},'attributes':['id','name',_0x4ff2('0x63'),_0x4ff2('0x64'),_0x4ff2('0x65')]});}})['then'](function(_0x52bacd){if(_0x52bacd){return{'count':_0x52bacd['count'],'rows':_[_0x4ff2('0x37')](_0x52bacd[_0x4ff2('0x4d')],function(_0x3ce0c2){return{'membername':_0x3ce0c2[_0x4ff2('0x31')],'UserId':_0x3ce0c2['id'],'queue_name':_0x2abd89[_0x4ff2('0x31')],'OpenchannelQueueId':_0x2abd89['id'],'interface':util[_0x4ff2('0x66')]('%s/%s',_0x4ff2('0x67'),_0x3ce0c2[_0x4ff2('0x31')]),'penalty':0x0,'paused':_0x3ce0c2[_0x4ff2('0x63')],'createdAt':_0x3ce0c2[_0x4ff2('0x65')],'updatedAt':_0x3ce0c2[_0x4ff2('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4ff2('0x2a')](respondWithFilteredResult(_0x3e176d,_0x9be318))[_0x4ff2('0x4e')](handleError(_0x3e176d,null));};exports['getTeams']=function(_0x2bf4dc,_0x409b57,_0x2eb20e){var _0x36152f={};var _0x4b1f9d={};var _0x16f461;var _0x3bd5d1;return db[_0x4ff2('0x4b')][_0x4ff2('0x5d')]({'where':{'id':_0x2bf4dc[_0x4ff2('0x50')]['id']}})[_0x4ff2('0x2a')](handleEntityNotFound(_0x409b57,null))[_0x4ff2('0x2a')](function(_0x2927ac){if(_0x2927ac){_0x16f461=_0x2927ac;_0x4b1f9d[_0x4ff2('0x36')]=_['keys'](db[_0x4ff2('0x68')][_0x4ff2('0x51')]);_0x4b1f9d[_0x4ff2('0x38')]=_[_0x4ff2('0x39')](_0x2bf4dc[_0x4ff2('0x38')]);_0x4b1f9d[_0x4ff2('0x3a')]=_[_0x4ff2('0x3b')](_0x4b1f9d[_0x4ff2('0x36')],_0x4b1f9d[_0x4ff2('0x38')]);_0x36152f[_0x4ff2('0x3d')]=_[_0x4ff2('0x3b')](_0x4b1f9d[_0x4ff2('0x36')],qs[_0x4ff2('0x3c')](_0x2bf4dc[_0x4ff2('0x38')][_0x4ff2('0x3c')]));_0x36152f[_0x4ff2('0x3d')]=_0x36152f[_0x4ff2('0x3d')][_0x4ff2('0x3e')]?_0x36152f[_0x4ff2('0x3d')]:_0x4b1f9d['model'];_0x36152f[_0x4ff2('0x41')]=qs[_0x4ff2('0x42')](_0x2bf4dc[_0x4ff2('0x38')][_0x4ff2('0x42')]);_0x36152f[_0x4ff2('0x43')]=qs[_0x4ff2('0x3a')](_['pick'](_0x2bf4dc[_0x4ff2('0x38')],_0x4b1f9d['filters']));if(_0x2bf4dc['query']['filter']){_0x36152f[_0x4ff2('0x43')]=_[_0x4ff2('0x48')](_0x36152f[_0x4ff2('0x43')],{'$or':_[_0x4ff2('0x37')](_0x36152f['attributes'],function(_0x426cb0){var _0x5a7e0b={};_0x5a7e0b[_0x426cb0]={'$like':'%'+_0x2bf4dc['query'][_0x4ff2('0x45')]+'%'};return _0x5a7e0b;})});}_0x36152f=_[_0x4ff2('0x48')]({},_0x36152f,_0x2bf4dc[_0x4ff2('0x49')]);return _0x16f461['getTeams'](_0x36152f);}})[_0x4ff2('0x2a')](function(_0x436877){if(_0x436877){_0x3bd5d1=_0x436877[_0x4ff2('0x3e')];if(!_0x2bf4dc[_0x4ff2('0x38')][_0x4ff2('0x3f')](_0x4ff2('0x40'))){_0x36152f['limit']=qs[_0x4ff2('0x22')](_0x2bf4dc[_0x4ff2('0x38')][_0x4ff2('0x22')]);_0x36152f[_0x4ff2('0x20')]=qs['offset'](_0x2bf4dc[_0x4ff2('0x38')][_0x4ff2('0x20')]);}return _0x16f461[_0x4ff2('0x69')](_0x36152f);}})[_0x4ff2('0x2a')](function(_0x4fcc52){if(_0x4fcc52){return _0x4fcc52?{'count':_0x3bd5d1,'rows':_0x4fcc52}:null;}})[_0x4ff2('0x2a')](respondWithResult(_0x409b57,null))[_0x4ff2('0x4e')](handleError(_0x409b57,null));};exports[_0x4ff2('0x6a')]=function(_0x5ce1f0,_0x4d55f7,_0x528580){var _0x3acbee=_0x5ce1f0[_0x4ff2('0x54')][_0x4ff2('0x6b')];return db[_0x4ff2('0x68')][_0x4ff2('0x4c')]({'where':{'id':_0x3acbee},'attributes':['id'],'include':[{'model':db[_0x4ff2('0x6c')],'as':'Agents','attributes':['id',_0x4ff2('0x31'),_0x4ff2('0x6d'),'voicePause',_0x4ff2('0x6e')],'raw':!![]}]})[_0x4ff2('0x2a')](function(_0x4c80a7){if(_0x4c80a7){var _0x540c16=_[_0x4ff2('0x6f')](_0x4c80a7,function(_0x3fc43d){var _0xd70150=_0x3fc43d[_0x4ff2('0x2c')]({'plain':!![]});return _0xd70150['Agents'];});return db[_0x4ff2('0x4b')][_0x4ff2('0x52')]({'where':{'id':_0x5ce1f0[_0x4ff2('0x50')]['id']}})[_0x4ff2('0x2a')](function(_0x4e4e3e){return db[_0x4ff2('0x70')][_0x4ff2('0x71')](function(_0x232eb3){return _0x4e4e3e[_0x4ff2('0x6a')](_0x3acbee,{'transaction':_0x232eb3})[_0x4ff2('0x2a')](function(){return BPromise['each'](_0x540c16,function(_0x516e47){return db[_0x4ff2('0x5e')][_0x4ff2('0x72')]({'where':{'UserId':_0x516e47['id'],'OpenchannelQueueId':_0x5ce1f0[_0x4ff2('0x50')]['id']},'transaction':_0x232eb3});});})[_0x4ff2('0x2a')](function(){_0x540c16[_0x4ff2('0x73')](function(_0x911376){socket[_0x4ff2('0x74')]('userOpenchannelQueue:save',{'UserId':_0x911376['id'],'OpenchannelQueueId':_0x4e4e3e['id']});});});});});}})['then'](respondWithStatusCode(_0x4d55f7,null))[_0x4ff2('0x4e')](handleError(_0x4d55f7,null));};exports[_0x4ff2('0x75')]=function(_0x9e1e81,_0x2c18fd,_0x125817){return db[_0x4ff2('0x68')][_0x4ff2('0x4c')]({'where':{'id':_0x9e1e81[_0x4ff2('0x38')][_0x4ff2('0x6b')]},'attributes':['id'],'include':[{'model':db[_0x4ff2('0x6c')],'as':_0x4ff2('0x76'),'attributes':['id'],'raw':!![]}]})[_0x4ff2('0x2a')](handleEntityNotFound(_0x2c18fd,null))['then'](function(_0x448de9){var _0x4d7ab9=_[_0x4ff2('0x37')](_0x448de9,'id');var _0x3ef5af=[];var _0x58f868=[];var _0x13eda7=squel['select']();_0x13eda7[_0x4ff2('0x77')](_0x4ff2('0x78'))['from'](_0x4ff2('0x79'),'tq')['join'](_0x4ff2('0x7a'),'ut',_0x4ff2('0x7b'))[_0x4ff2('0x43')](_0x4ff2('0x7c'),_0x9e1e81[_0x4ff2('0x50')]['id']);for(var _0x5777ad=0x0;_0x5777ad<_0x448de9[_0x4ff2('0x3e')];_0x5777ad+=0x1){let _0x543d30=_0x448de9[_0x5777ad];for(var _0x3bc89c=0x0;_0x3bc89c<_0x543d30[_0x4ff2('0x76')]['length'];_0x3bc89c+=0x1){let _0x426674=_0x543d30[_0x4ff2('0x76')][_0x3bc89c];var _0x40ddc1=_0x13eda7[_0x4ff2('0x7d')]();_0x40ddc1['where']('ut.UserId\x20=\x20?',_0x426674['id']);_0x58f868['push'](db[_0x4ff2('0x70')][_0x4ff2('0x38')](_0x40ddc1[_0x4ff2('0x7e')](),{'type':db[_0x4ff2('0x70')]['QueryTypes'][_0x4ff2('0x7f')]})[_0x4ff2('0x2a')](function(_0x2d03e0){if(_0x2d03e0[_0x4ff2('0x3e')]===0x1){return _0x426674['id'];}else{var _0x1693d9=_[_0x4ff2('0x80')](_[_0x4ff2('0x37')](_0x2d03e0,_0x4ff2('0x81')),function(_0x3df05d){return _[_0x4ff2('0x82')](_0x4d7ab9,_0x3df05d);});if(_0x1693d9){return _0x426674['id'];}}}));}}return BPromise[_0x4ff2('0x83')](_0x58f868)[_0x4ff2('0x2a')](function(_0x3d46f2){_0x3ef5af=_(_0x3ef5af)[_0x4ff2('0x84')](_0x3d46f2)[_0x4ff2('0x85')]()[_0x4ff2('0x86')]();return db['OpenchannelQueue'][_0x4ff2('0x52')]({'where':{'id':_0x9e1e81[_0x4ff2('0x50')]['id']}})[_0x4ff2('0x2a')](function(_0x2d949d){return db['sequelize'][_0x4ff2('0x71')](function(_0x75e346){return _0x2d949d[_0x4ff2('0x75')](_0x9e1e81[_0x4ff2('0x38')]['ids'],{'transaction':_0x75e346})[_0x4ff2('0x2a')](function(){if(!_['isEmpty'](_0x3ef5af)){return _0x2d949d[_0x4ff2('0x87')](_0x3ef5af,{'transaction':_0x75e346});}})[_0x4ff2('0x2a')](function(){_0x3ef5af[_0x4ff2('0x73')](function(_0x55105d){socket['emit'](_0x4ff2('0x88'),{'UserId':_0x55105d,'OpenchannelQueueId':_0x2d949d['id']});});});});});});})[_0x4ff2('0x2a')](respondWithStatusCode(_0x2c18fd,null))[_0x4ff2('0x4e')](handleError(_0x2c18fd,null));};exports[_0x4ff2('0x89')]=function(_0x24e269,_0x356e14,_0x3f3f9a){return db['OpenchannelQueue']['find']({'where':{'id':_0x24e269[_0x4ff2('0x50')]['id']}})[_0x4ff2('0x2a')](handleEntityNotFound(_0x356e14,null))[_0x4ff2('0x2a')](function(_0x1b8e36){if(_0x1b8e36){return _0x1b8e36[_0x4ff2('0x89')](_0x24e269['body'][_0x4ff2('0x6b')],_['omit'](_0x24e269[_0x4ff2('0x54')],[_0x4ff2('0x6b'),'id'])||{})[_0x4ff2('0x8a')](function(_0x4037c9){for(var _0x3e9b2c=0x0;_0x3e9b2c<_0x24e269[_0x4ff2('0x54')][_0x4ff2('0x6b')][_0x4ff2('0x3e')];_0x3e9b2c+=0x1){socket[_0x4ff2('0x74')]('userOpenchannelQueue:save',{'UserId':Number(_0x24e269[_0x4ff2('0x54')]['ids'][_0x3e9b2c]),'OpenchannelQueueId':Number(_0x24e269['params']['id'])});}return _0x4037c9;});}})[_0x4ff2('0x2a')](respondWithResult(_0x356e14,null))[_0x4ff2('0x4e')](handleError(_0x356e14,null));};exports[_0x4ff2('0x87')]=function(_0x337793,_0x258121,_0x4e4463){return db[_0x4ff2('0x4b')][_0x4ff2('0x52')]({'where':{'id':_0x337793['params']['id']}})[_0x4ff2('0x2a')](handleEntityNotFound(_0x258121,null))['then'](function(_0xaba3ce){if(_0xaba3ce){return _0xaba3ce[_0x4ff2('0x87')](_0x337793[_0x4ff2('0x38')]['ids'])[_0x4ff2('0x2a')](function(){if(_['isArray'](_0x337793[_0x4ff2('0x38')][_0x4ff2('0x6b')])){for(var _0x27f70b=0x0;_0x27f70b<_0x337793['query']['ids'][_0x4ff2('0x3e')];_0x27f70b+=0x1){socket[_0x4ff2('0x74')]('userOpenchannelQueue:remove',{'UserId':Number(_0x337793['query'][_0x4ff2('0x6b')][_0x27f70b]),'OpenchannelQueueId':Number(_0x337793[_0x4ff2('0x50')]['id'])});}}else{socket[_0x4ff2('0x74')](_0x4ff2('0x88'),{'UserId':Number(_0x337793[_0x4ff2('0x38')][_0x4ff2('0x6b')]),'OpenchannelQueueId':Number(_0x337793[_0x4ff2('0x50')]['id'])});}});}})['then'](respondWithStatusCode(_0x258121,null))[_0x4ff2('0x4e')](handleError(_0x258121,null));};exports[_0x4ff2('0x8b')]=function(_0x561396,_0x972163,_0xd77dca){var _0x579707={};var _0x22f53f={};var _0x44662b;var _0x5dadc2;return db[_0x4ff2('0x4b')][_0x4ff2('0x5d')]({'where':{'id':_0x561396[_0x4ff2('0x50')]['id']}})[_0x4ff2('0x2a')](handleEntityNotFound(_0x972163,null))[_0x4ff2('0x2a')](function(_0x34d0b5){if(_0x34d0b5){_0x44662b=_0x34d0b5;_0x22f53f[_0x4ff2('0x36')]=_[_0x4ff2('0x39')](db[_0x4ff2('0x6c')]['rawAttributes']);_0x22f53f[_0x4ff2('0x38')]=_[_0x4ff2('0x39')](_0x561396[_0x4ff2('0x38')]);_0x22f53f[_0x4ff2('0x3a')]=_[_0x4ff2('0x3b')](_0x22f53f[_0x4ff2('0x36')],_0x22f53f[_0x4ff2('0x38')]);_0x579707[_0x4ff2('0x3d')]=_['intersection'](_0x22f53f['model'],qs[_0x4ff2('0x3c')](_0x561396[_0x4ff2('0x38')][_0x4ff2('0x3c')]));_0x579707[_0x4ff2('0x3d')]=_0x579707[_0x4ff2('0x3d')][_0x4ff2('0x3e')]?_0x579707[_0x4ff2('0x3d')]:_0x22f53f['model'];_0x579707['order']=qs[_0x4ff2('0x42')](_0x561396[_0x4ff2('0x38')][_0x4ff2('0x42')]);_0x579707['where']=qs[_0x4ff2('0x3a')](_[_0x4ff2('0x44')](_0x561396[_0x4ff2('0x38')],_0x22f53f[_0x4ff2('0x3a')]));if(_0x561396[_0x4ff2('0x38')][_0x4ff2('0x45')]){_0x579707[_0x4ff2('0x43')]=_[_0x4ff2('0x48')](_0x579707[_0x4ff2('0x43')],{'$or':_[_0x4ff2('0x37')](_0x579707['attributes'],function(_0x3104c5){var _0x59c2d6={};_0x59c2d6[_0x3104c5]={'$like':'%'+_0x561396[_0x4ff2('0x38')][_0x4ff2('0x45')]+'%'};return _0x59c2d6;})});}_0x579707=_[_0x4ff2('0x48')]({},_0x579707,_0x561396['options']);return _0x44662b[_0x4ff2('0x8b')](_0x579707);}})[_0x4ff2('0x2a')](function(_0x42b71c){if(_0x42b71c){_0x5dadc2=_0x42b71c[_0x4ff2('0x3e')];if(!_0x561396['query']['hasOwnProperty'](_0x4ff2('0x40'))){_0x579707['limit']=qs[_0x4ff2('0x22')](_0x561396[_0x4ff2('0x38')][_0x4ff2('0x22')]);_0x579707[_0x4ff2('0x20')]=qs[_0x4ff2('0x20')](_0x561396[_0x4ff2('0x38')]['offset']);}return _0x44662b[_0x4ff2('0x8b')](_0x579707);}})[_0x4ff2('0x2a')](function(_0x18a40b){if(_0x18a40b){return _0x18a40b?{'count':_0x5dadc2,'rows':_0x18a40b}:null;}})[_0x4ff2('0x2a')](respondWithResult(_0x972163,null))[_0x4ff2('0x4e')](handleError(_0x972163,null));}; \ No newline at end of file +var _0x9830=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','end','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','OpenchannelQueue','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','user','OpenchannelQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserOpenchannelQueue','nolimit','User','UserId','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','forEach','emit','userOpenchannelQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','request-promise','moment','mustache','util','path'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x9830,0x8c));var _0x0983=function(_0x1286d5,_0x5c2870){_0x1286d5=_0x1286d5-0x0;var _0x1e06b0=_0x9830[_0x1286d5];return _0x1e06b0;};'use strict';var emlformat=require(_0x0983('0x0'));var rimraf=require(_0x0983('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0983('0x2'));var moment=require(_0x0983('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0983('0x4'));var util=require(_0x0983('0x5'));var path=require(_0x0983('0x6'));var sox=require(_0x0983('0x7'));var csv=require(_0x0983('0x8'));var ejs=require(_0x0983('0x9'));var fs=require('fs');var fs_extra=require(_0x0983('0xa'));var _=require(_0x0983('0xb'));var squel=require(_0x0983('0xc'));var crypto=require(_0x0983('0xd'));var jsforce=require(_0x0983('0xe'));var deskjs=require(_0x0983('0xf'));var toCsv=require(_0x0983('0x8'));var querystring=require(_0x0983('0x10'));var Papa=require(_0x0983('0x11'));var Redis=require(_0x0983('0x12'));var authService=require(_0x0983('0x13'));var qs=require(_0x0983('0x14'));var as=require(_0x0983('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0983('0x16'));var utils=require(_0x0983('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x0983('0x18'));var db=require(_0x0983('0x19'))['db'];config[_0x0983('0x1a')]=_[_0x0983('0x1b')](config[_0x0983('0x1a')],{'host':_0x0983('0x1c'),'port':0x18eb});var socket=require(_0x0983('0x1d'))(new Redis(config[_0x0983('0x1a')]));require('./openchannelQueue.socket')['register'](socket);function respondWithStatusCode(_0x1cc81b,_0x13640f){_0x13640f=_0x13640f||0xcc;return function(_0x26f4f5){if(_0x26f4f5){return _0x1cc81b[_0x0983('0x1e')](_0x13640f);}return _0x1cc81b[_0x0983('0x1f')](_0x13640f)['end']();};}function respondWithResult(_0xb287c5,_0x1d7183){_0x1d7183=_0x1d7183||0xc8;return function(_0x5e78db){if(_0x5e78db){return _0xb287c5[_0x0983('0x1f')](_0x1d7183)[_0x0983('0x20')](_0x5e78db);}};}function respondWithFilteredResult(_0x14f389,_0x1720d4){return function(_0xa79475){if(_0xa79475){var _0x10e754=typeof _0x1720d4[_0x0983('0x21')]==='undefined'&&typeof _0x1720d4[_0x0983('0x22')]===_0x0983('0x23');var _0x23e8bd=_0xa79475[_0x0983('0x24')];var _0xc95411=_0x10e754?0x0:_0x1720d4['offset'];var _0x3da478=_0x10e754?_0xa79475[_0x0983('0x24')]:_0x1720d4[_0x0983('0x21')]+_0x1720d4[_0x0983('0x22')];var _0x40a86e;if(_0x3da478>=_0x23e8bd){_0x3da478=_0x23e8bd;_0x40a86e=0xc8;}else{_0x40a86e=0xce;}_0x14f389[_0x0983('0x1f')](_0x40a86e);return _0x14f389['set'](_0x0983('0x25'),_0xc95411+'-'+_0x3da478+'/'+_0x23e8bd)[_0x0983('0x20')](_0xa79475);}return null;};}function patchUpdates(_0x425de4){return function(_0x1915cb){try{jsonpatch[_0x0983('0x26')](_0x1915cb,_0x425de4,!![]);}catch(_0x40d067){return BPromise[_0x0983('0x27')](_0x40d067);}return _0x1915cb[_0x0983('0x28')]();};}function saveUpdates(_0x2d5368,_0x295c2b){return function(_0x175b62){if(_0x175b62){return _0x175b62[_0x0983('0x29')](_0x2d5368)['then'](function(_0x10e7cb){return _0x10e7cb;});}return null;};}function removeEntity(_0x2b1b36,_0x2c4780){return function(_0x495c26){if(_0x495c26){return _0x495c26['destroy']()[_0x0983('0x2a')](function(){var _0x42369e=_0x495c26[_0x0983('0x2b')]({'plain':!![]});var _0x270450='OpenchannelQueues';return db[_0x0983('0x2c')][_0x0983('0x2d')]({'where':{'type':_0x270450,'resourceId':_0x42369e['id']}})[_0x0983('0x2a')](function(){return _0x495c26;});})[_0x0983('0x2a')](function(){_0x2b1b36[_0x0983('0x1f')](0xcc)[_0x0983('0x2e')]();});}};}function handleEntityNotFound(_0x22bf21,_0x57f751){return function(_0x359f0c){if(!_0x359f0c){_0x22bf21['sendStatus'](0x194);}return _0x359f0c;};}function handleError(_0x2cd375,_0x3d4f87){_0x3d4f87=_0x3d4f87||0x1f4;return function(_0x3716b1){logger['error'](_0x3716b1[_0x0983('0x2f')]);if(_0x3716b1[_0x0983('0x30')]){delete _0x3716b1['name'];}_0x2cd375[_0x0983('0x1f')](_0x3d4f87)[_0x0983('0x31')](_0x3716b1);};}exports[_0x0983('0x32')]=function(_0x5051a1,_0xb50541){var _0x9aeb12={},_0xcc953={},_0x36471b={'count':0x0,'rows':[]};var _0x38cc10=_['map'](db['OpenchannelQueue'][_0x0983('0x33')],function(_0x53e47f){return{'name':_0x53e47f[_0x0983('0x34')],'type':_0x53e47f[_0x0983('0x35')]['key']};});_0xcc953[_0x0983('0x36')]=_[_0x0983('0x37')](_0x38cc10,_0x0983('0x30'));_0xcc953[_0x0983('0x38')]=_['keys'](_0x5051a1[_0x0983('0x38')]);_0xcc953[_0x0983('0x39')]=_[_0x0983('0x3a')](_0xcc953[_0x0983('0x36')],_0xcc953[_0x0983('0x38')]);_0x9aeb12[_0x0983('0x3b')]=_[_0x0983('0x3a')](_0xcc953[_0x0983('0x36')],qs[_0x0983('0x3c')](_0x5051a1[_0x0983('0x38')][_0x0983('0x3c')]));_0x9aeb12['attributes']=_0x9aeb12[_0x0983('0x3b')][_0x0983('0x3d')]?_0x9aeb12[_0x0983('0x3b')]:_0xcc953[_0x0983('0x36')];if(!_0x5051a1[_0x0983('0x38')][_0x0983('0x3e')]('nolimit')){_0x9aeb12[_0x0983('0x22')]=qs['limit'](_0x5051a1[_0x0983('0x38')][_0x0983('0x22')]);_0x9aeb12[_0x0983('0x21')]=qs[_0x0983('0x21')](_0x5051a1['query'][_0x0983('0x21')]);}_0x9aeb12[_0x0983('0x3f')]=qs[_0x0983('0x40')](_0x5051a1[_0x0983('0x38')][_0x0983('0x40')]);_0x9aeb12[_0x0983('0x41')]=qs[_0x0983('0x39')](_[_0x0983('0x42')](_0x5051a1[_0x0983('0x38')],_0xcc953[_0x0983('0x39')]),_0x38cc10);if(_0x5051a1[_0x0983('0x38')][_0x0983('0x43')]){_0x9aeb12[_0x0983('0x41')]=_[_0x0983('0x44')](_0x9aeb12[_0x0983('0x41')],{'$or':_[_0x0983('0x37')](_0x38cc10,function(_0x40d482){if(_0x40d482[_0x0983('0x35')]!==_0x0983('0x45')){var _0x446c96={};_0x446c96[_0x40d482[_0x0983('0x30')]]={'$like':'%'+_0x5051a1['query'][_0x0983('0x43')]+'%'};return _0x446c96;}})});}_0x9aeb12=_['merge']({},_0x9aeb12,_0x5051a1[_0x0983('0x46')]);var _0x4a94d3={'where':_0x9aeb12['where']};return db[_0x0983('0x47')][_0x0983('0x24')](_0x4a94d3)['then'](function(_0x54b9b8){_0x36471b[_0x0983('0x24')]=_0x54b9b8;if(_0x5051a1['query'][_0x0983('0x48')]){_0x9aeb12['include']=[{'all':!![]}];}return db[_0x0983('0x47')][_0x0983('0x49')](_0x9aeb12);})['then'](function(_0x17da70){_0x36471b[_0x0983('0x4a')]=_0x17da70;return _0x36471b;})[_0x0983('0x2a')](respondWithFilteredResult(_0xb50541,_0x9aeb12))[_0x0983('0x4b')](handleError(_0xb50541,null));};exports[_0x0983('0x4c')]=function(_0x1e5a4e,_0x52c66e){var _0x3084a0={'raw':!![],'where':{'id':_0x1e5a4e[_0x0983('0x4d')]['id']}},_0x4b4588={};_0x4b4588[_0x0983('0x36')]=_[_0x0983('0x4e')](db[_0x0983('0x47')][_0x0983('0x33')]);_0x4b4588['query']=_['keys'](_0x1e5a4e[_0x0983('0x38')]);_0x4b4588[_0x0983('0x39')]=_[_0x0983('0x3a')](_0x4b4588[_0x0983('0x36')],_0x4b4588[_0x0983('0x38')]);_0x3084a0[_0x0983('0x3b')]=_[_0x0983('0x3a')](_0x4b4588[_0x0983('0x36')],qs[_0x0983('0x3c')](_0x1e5a4e[_0x0983('0x38')][_0x0983('0x3c')]));_0x3084a0[_0x0983('0x3b')]=_0x3084a0[_0x0983('0x3b')][_0x0983('0x3d')]?_0x3084a0[_0x0983('0x3b')]:_0x4b4588['model'];if(_0x1e5a4e[_0x0983('0x38')][_0x0983('0x48')]){_0x3084a0[_0x0983('0x4f')]=[{'all':!![]}];}_0x3084a0=_['merge']({},_0x3084a0,_0x1e5a4e['options']);return db['OpenchannelQueue'][_0x0983('0x50')](_0x3084a0)[_0x0983('0x2a')](handleEntityNotFound(_0x52c66e,null))[_0x0983('0x2a')](respondWithResult(_0x52c66e,null))['catch'](handleError(_0x52c66e,null));};exports[_0x0983('0x51')]=function(_0x3adb58,_0x53d8d6){return db[_0x0983('0x47')]['create'](_0x3adb58[_0x0983('0x52')],{})[_0x0983('0x2a')](function(_0x3ff9fa){var _0x3a2f9a=_0x3adb58[_0x0983('0x53')][_0x0983('0x2b')]({'plain':!![]});if(!_0x3a2f9a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a2f9a['role']==='user'){var _0x34596a=_0x3ff9fa[_0x0983('0x2b')]({'plain':!![]});var _0x4d8a99=_0x0983('0x54');return db[_0x0983('0x55')][_0x0983('0x50')]({'where':{'name':_0x4d8a99,'userProfileId':_0x3a2f9a[_0x0983('0x56')]},'raw':!![]})[_0x0983('0x2a')](function(_0x3f1260){if(_0x3f1260&&_0x3f1260[_0x0983('0x57')]===0x0){return db[_0x0983('0x2c')][_0x0983('0x51')]({'name':_0x34596a[_0x0983('0x30')],'resourceId':_0x34596a['id'],'type':_0x3f1260[_0x0983('0x30')],'sectionId':_0x3f1260['id']},{})[_0x0983('0x2a')](function(){return _0x3ff9fa;});}else{return _0x3ff9fa;}})[_0x0983('0x4b')](function(_0x10648b){logger['error'](_0x0983('0x58'),_0x10648b);throw _0x10648b;});}return _0x3ff9fa;})[_0x0983('0x2a')](respondWithResult(_0x53d8d6,0xc9))[_0x0983('0x4b')](handleError(_0x53d8d6,null));};exports[_0x0983('0x29')]=function(_0x1bf3b0,_0x14156){if(_0x1bf3b0[_0x0983('0x52')]['id']){delete _0x1bf3b0[_0x0983('0x52')]['id'];}return db['OpenchannelQueue']['find']({'where':{'id':_0x1bf3b0[_0x0983('0x4d')]['id']}})['then'](handleEntityNotFound(_0x14156,null))['then'](saveUpdates(_0x1bf3b0[_0x0983('0x52')],null))[_0x0983('0x2a')](respondWithResult(_0x14156,null))['catch'](handleError(_0x14156,null));};exports['destroy']=function(_0x4bf4d4,_0x2f2a92){return db[_0x0983('0x47')]['find']({'where':{'id':_0x4bf4d4[_0x0983('0x4d')]['id']}})[_0x0983('0x2a')](handleEntityNotFound(_0x2f2a92,null))['then'](removeEntity(_0x2f2a92,null))[_0x0983('0x4b')](handleError(_0x2f2a92,null));};exports[_0x0983('0x59')]=function(_0x35065b,_0x429190){return db[_0x0983('0x47')][_0x0983('0x59')]()[_0x0983('0x2a')](respondWithResult(_0x429190,null))[_0x0983('0x4b')](handleError(_0x429190,null));};exports[_0x0983('0x5a')]=function(_0x3f5b10,_0x3e63ac,_0x2be495){var _0x1a23c0={'raw':!![],'where':{}},_0x41b044={},_0x4ee138;return db[_0x0983('0x47')]['findOne']({'where':{'id':_0x3f5b10[_0x0983('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3e63ac,null))[_0x0983('0x2a')](function(_0x19fb77){if(_0x19fb77){_0x4ee138=_0x19fb77[_0x0983('0x2b')]({'plain':!![]});_0x41b044['model']=_[_0x0983('0x4e')](db[_0x0983('0x5b')][_0x0983('0x33')]);_0x41b044[_0x0983('0x38')]=_[_0x0983('0x4e')](_0x3f5b10['query']);_0x41b044[_0x0983('0x39')]=_['intersection'](_0x41b044[_0x0983('0x36')],_0x41b044[_0x0983('0x38')]);_0x1a23c0['attributes']=_[_0x0983('0x3a')](_0x41b044[_0x0983('0x36')],qs[_0x0983('0x3c')](_0x3f5b10[_0x0983('0x38')][_0x0983('0x3c')]));_0x1a23c0[_0x0983('0x3b')]=_0x1a23c0[_0x0983('0x3b')][_0x0983('0x3d')]?_0x1a23c0[_0x0983('0x3b')]:_0x41b044[_0x0983('0x36')];if(!_0x3f5b10[_0x0983('0x38')][_0x0983('0x3e')](_0x0983('0x5c'))){_0x1a23c0[_0x0983('0x22')]=qs[_0x0983('0x22')](_0x3f5b10[_0x0983('0x38')][_0x0983('0x22')]);_0x1a23c0['offset']=qs[_0x0983('0x21')](_0x3f5b10['query'][_0x0983('0x21')]);}_0x1a23c0['order']=qs[_0x0983('0x40')](_0x3f5b10['query'][_0x0983('0x40')]);_0x1a23c0['where']=qs[_0x0983('0x39')](_[_0x0983('0x42')](_0x3f5b10[_0x0983('0x38')],_0x41b044[_0x0983('0x39')]));_0x1a23c0[_0x0983('0x41')]['OpenchannelQueueId']=_0x19fb77['id'];if(_0x3f5b10[_0x0983('0x38')][_0x0983('0x43')]){_0x1a23c0[_0x0983('0x41')]=_['merge'](_0x1a23c0[_0x0983('0x41')],{'$or':_[_0x0983('0x37')](_0x1a23c0['attributes'],function(_0x436805){var _0x498d20={};_0x498d20[_0x436805]={'$like':'%'+_0x3f5b10[_0x0983('0x38')][_0x0983('0x43')]+'%'};return _0x498d20;})});}_0x1a23c0=_[_0x0983('0x44')]({},_0x1a23c0,_0x3f5b10[_0x0983('0x46')]);return db[_0x0983('0x5b')][_0x0983('0x49')](_0x1a23c0);}})[_0x0983('0x2a')](function(_0x221df5){if(_0x221df5){return db[_0x0983('0x5d')]['findAndCountAll']({'where':{'id':_['map'](_0x221df5,_0x0983('0x5e')),'role':'agent'},'attributes':['id',_0x0983('0x30'),_0x0983('0x5f'),_0x0983('0x60'),_0x0983('0x61')]});}})[_0x0983('0x2a')](function(_0x43ad5f){if(_0x43ad5f){return{'count':_0x43ad5f['count'],'rows':_[_0x0983('0x37')](_0x43ad5f[_0x0983('0x4a')],function(_0xd9f17d){return{'membername':_0xd9f17d[_0x0983('0x30')],'UserId':_0xd9f17d['id'],'queue_name':_0x4ee138[_0x0983('0x30')],'OpenchannelQueueId':_0x4ee138['id'],'interface':util[_0x0983('0x62')](_0x0983('0x63'),_0x0983('0x64'),_0xd9f17d[_0x0983('0x30')]),'penalty':0x0,'paused':_0xd9f17d[_0x0983('0x5f')],'createdAt':_0xd9f17d[_0x0983('0x61')],'updatedAt':_0xd9f17d[_0x0983('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0983('0x2a')](respondWithFilteredResult(_0x3e63ac,_0x1a23c0))['catch'](handleError(_0x3e63ac,null));};exports[_0x0983('0x65')]=function(_0x338b4b,_0x8851d1,_0x46451b){var _0x1827a8={};var _0x4950a1={};var _0xff1a1e;var _0x3b64d8;return db[_0x0983('0x47')][_0x0983('0x66')]({'where':{'id':_0x338b4b[_0x0983('0x4d')]['id']}})[_0x0983('0x2a')](handleEntityNotFound(_0x8851d1,null))[_0x0983('0x2a')](function(_0x629aa9){if(_0x629aa9){_0xff1a1e=_0x629aa9;_0x4950a1[_0x0983('0x36')]=_['keys'](db[_0x0983('0x67')][_0x0983('0x33')]);_0x4950a1[_0x0983('0x38')]=_[_0x0983('0x4e')](_0x338b4b[_0x0983('0x38')]);_0x4950a1[_0x0983('0x39')]=_[_0x0983('0x3a')](_0x4950a1[_0x0983('0x36')],_0x4950a1[_0x0983('0x38')]);_0x1827a8[_0x0983('0x3b')]=_[_0x0983('0x3a')](_0x4950a1[_0x0983('0x36')],qs[_0x0983('0x3c')](_0x338b4b[_0x0983('0x38')][_0x0983('0x3c')]));_0x1827a8[_0x0983('0x3b')]=_0x1827a8['attributes']['length']?_0x1827a8[_0x0983('0x3b')]:_0x4950a1[_0x0983('0x36')];_0x1827a8[_0x0983('0x3f')]=qs[_0x0983('0x40')](_0x338b4b['query'][_0x0983('0x40')]);_0x1827a8[_0x0983('0x41')]=qs['filters'](_['pick'](_0x338b4b[_0x0983('0x38')],_0x4950a1[_0x0983('0x39')]));if(_0x338b4b[_0x0983('0x38')][_0x0983('0x43')]){_0x1827a8['where']=_[_0x0983('0x44')](_0x1827a8[_0x0983('0x41')],{'$or':_[_0x0983('0x37')](_0x1827a8[_0x0983('0x3b')],function(_0x4b8414){var _0x18f0f5={};_0x18f0f5[_0x4b8414]={'$like':'%'+_0x338b4b[_0x0983('0x38')]['filter']+'%'};return _0x18f0f5;})});}_0x1827a8=_[_0x0983('0x44')]({},_0x1827a8,_0x338b4b[_0x0983('0x46')]);return _0xff1a1e[_0x0983('0x65')](_0x1827a8);}})['then'](function(_0x30d01a){if(_0x30d01a){_0x3b64d8=_0x30d01a['length'];if(!_0x338b4b[_0x0983('0x38')][_0x0983('0x3e')]('nolimit')){_0x1827a8[_0x0983('0x22')]=qs['limit'](_0x338b4b[_0x0983('0x38')][_0x0983('0x22')]);_0x1827a8[_0x0983('0x21')]=qs[_0x0983('0x21')](_0x338b4b['query']['offset']);}return _0xff1a1e[_0x0983('0x65')](_0x1827a8);}})['then'](function(_0x25d126){if(_0x25d126){return _0x25d126?{'count':_0x3b64d8,'rows':_0x25d126}:null;}})['then'](respondWithResult(_0x8851d1,null))[_0x0983('0x4b')](handleError(_0x8851d1,null));};exports[_0x0983('0x68')]=function(_0x139356,_0x28f934,_0x5b3106){var _0x326dd8=_0x139356[_0x0983('0x52')]['ids'];return db[_0x0983('0x67')][_0x0983('0x49')]({'where':{'id':_0x326dd8},'attributes':['id'],'include':[{'model':db[_0x0983('0x5d')],'as':_0x0983('0x69'),'attributes':['id',_0x0983('0x30'),_0x0983('0x6a'),_0x0983('0x6b'),_0x0983('0x6c')],'raw':!![]}]})[_0x0983('0x2a')](function(_0x49166a){if(_0x49166a){var _0x5f1a4d=_[_0x0983('0x6d')](_0x49166a,function(_0x1f7291){var _0x1c1d90=_0x1f7291[_0x0983('0x2b')]({'plain':!![]});return _0x1c1d90['Agents'];});return db[_0x0983('0x47')][_0x0983('0x50')]({'where':{'id':_0x139356[_0x0983('0x4d')]['id']}})[_0x0983('0x2a')](function(_0x10b8cd){return db[_0x0983('0x6e')][_0x0983('0x6f')](function(_0xe220b3){return _0x10b8cd['addTeams'](_0x326dd8,{'transaction':_0xe220b3})['then'](function(){return BPromise[_0x0983('0x70')](_0x5f1a4d,function(_0x344f7b){return db[_0x0983('0x5b')]['findOrCreate']({'where':{'UserId':_0x344f7b['id'],'OpenchannelQueueId':_0x139356[_0x0983('0x4d')]['id']},'transaction':_0xe220b3});});})[_0x0983('0x2a')](function(){_0x5f1a4d[_0x0983('0x71')](function(_0xa23d82){socket[_0x0983('0x72')](_0x0983('0x73'),{'UserId':_0xa23d82['id'],'OpenchannelQueueId':_0x10b8cd['id']});});});});});}})['then'](respondWithStatusCode(_0x28f934,null))[_0x0983('0x4b')](handleError(_0x28f934,null));};exports[_0x0983('0x74')]=function(_0x59e355,_0x594238,_0x19fb4a){return db[_0x0983('0x67')]['findAll']({'where':{'id':_0x59e355[_0x0983('0x38')][_0x0983('0x75')]},'attributes':['id'],'include':[{'model':db[_0x0983('0x5d')],'as':_0x0983('0x69'),'attributes':['id'],'raw':!![]}]})[_0x0983('0x2a')](handleEntityNotFound(_0x594238,null))[_0x0983('0x2a')](function(_0x2918dd){var _0x1c658f=_[_0x0983('0x37')](_0x2918dd,'id');var _0x40e644=[];var _0x311aa7=[];var _0x1d13d0=squel[_0x0983('0x76')]();_0x1d13d0[_0x0983('0x77')](_0x0983('0x78'))[_0x0983('0x79')](_0x0983('0x7a'),'tq')[_0x0983('0x7b')](_0x0983('0x7c'),'ut',_0x0983('0x7d'))[_0x0983('0x41')](_0x0983('0x7e'),_0x59e355[_0x0983('0x4d')]['id']);for(var _0x4210b2=0x0;_0x4210b2<_0x2918dd[_0x0983('0x3d')];_0x4210b2+=0x1){let _0x2c4a68=_0x2918dd[_0x4210b2];for(var _0x46dc58=0x0;_0x46dc58<_0x2c4a68[_0x0983('0x69')][_0x0983('0x3d')];_0x46dc58+=0x1){let _0x3f945f=_0x2c4a68[_0x0983('0x69')][_0x46dc58];var _0x451ebe=_0x1d13d0[_0x0983('0x7f')]();_0x451ebe['where'](_0x0983('0x80'),_0x3f945f['id']);_0x311aa7[_0x0983('0x81')](db[_0x0983('0x6e')][_0x0983('0x38')](_0x451ebe[_0x0983('0x82')](),{'type':db[_0x0983('0x6e')][_0x0983('0x83')][_0x0983('0x84')]})['then'](function(_0x5c5a23){if(_0x5c5a23[_0x0983('0x3d')]===0x1){return _0x3f945f['id'];}else{var _0x4ac494=_['every'](_[_0x0983('0x37')](_0x5c5a23,_0x0983('0x85')),function(_0x7459ed){return _[_0x0983('0x86')](_0x1c658f,_0x7459ed);});if(_0x4ac494){return _0x3f945f['id'];}}}));}}return BPromise[_0x0983('0x87')](_0x311aa7)['then'](function(_0x4a4d7c){_0x40e644=_(_0x40e644)[_0x0983('0x88')](_0x4a4d7c)[_0x0983('0x89')]()[_0x0983('0x8a')]();return db[_0x0983('0x47')][_0x0983('0x50')]({'where':{'id':_0x59e355[_0x0983('0x4d')]['id']}})[_0x0983('0x2a')](function(_0x3590a9){return db[_0x0983('0x6e')]['transaction'](function(_0x47b207){return _0x3590a9[_0x0983('0x74')](_0x59e355[_0x0983('0x38')]['ids'],{'transaction':_0x47b207})['then'](function(){if(!_[_0x0983('0x8b')](_0x40e644)){return _0x3590a9[_0x0983('0x8c')](_0x40e644,{'transaction':_0x47b207});}})[_0x0983('0x2a')](function(){_0x40e644[_0x0983('0x71')](function(_0x1e90bd){socket['emit'](_0x0983('0x8d'),{'UserId':_0x1e90bd,'OpenchannelQueueId':_0x3590a9['id']});});});});});});})[_0x0983('0x2a')](respondWithStatusCode(_0x594238,null))['catch'](handleError(_0x594238,null));};exports[_0x0983('0x8e')]=function(_0x31c174,_0x2281ce,_0x4e0206){return db['OpenchannelQueue'][_0x0983('0x50')]({'where':{'id':_0x31c174[_0x0983('0x4d')]['id']}})[_0x0983('0x2a')](handleEntityNotFound(_0x2281ce,null))[_0x0983('0x2a')](function(_0x290834){if(_0x290834){return _0x290834[_0x0983('0x8e')](_0x31c174[_0x0983('0x52')][_0x0983('0x75')],_[_0x0983('0x8f')](_0x31c174[_0x0983('0x52')],[_0x0983('0x75'),'id'])||{})[_0x0983('0x90')](function(_0xe7ca2a){for(var _0x35f1e5=0x0;_0x35f1e5<_0x31c174['body'][_0x0983('0x75')][_0x0983('0x3d')];_0x35f1e5+=0x1){socket[_0x0983('0x72')](_0x0983('0x73'),{'UserId':Number(_0x31c174[_0x0983('0x52')][_0x0983('0x75')][_0x35f1e5]),'OpenchannelQueueId':Number(_0x31c174['params']['id'])});}return _0xe7ca2a;});}})['then'](respondWithResult(_0x2281ce,null))[_0x0983('0x4b')](handleError(_0x2281ce,null));};exports['removeAgents']=function(_0x277afd,_0x88e61f,_0x25c685){return db[_0x0983('0x47')]['find']({'where':{'id':_0x277afd['params']['id']}})[_0x0983('0x2a')](handleEntityNotFound(_0x88e61f,null))[_0x0983('0x2a')](function(_0x39c9c9){if(_0x39c9c9){return _0x39c9c9[_0x0983('0x8c')](_0x277afd[_0x0983('0x38')][_0x0983('0x75')])[_0x0983('0x2a')](function(){if(_[_0x0983('0x91')](_0x277afd[_0x0983('0x38')]['ids'])){for(var _0x2dd623=0x0;_0x2dd623<_0x277afd[_0x0983('0x38')][_0x0983('0x75')][_0x0983('0x3d')];_0x2dd623+=0x1){socket[_0x0983('0x72')](_0x0983('0x8d'),{'UserId':Number(_0x277afd[_0x0983('0x38')][_0x0983('0x75')][_0x2dd623]),'OpenchannelQueueId':Number(_0x277afd[_0x0983('0x4d')]['id'])});}}else{socket['emit'](_0x0983('0x8d'),{'UserId':Number(_0x277afd[_0x0983('0x38')][_0x0983('0x75')]),'OpenchannelQueueId':Number(_0x277afd['params']['id'])});}});}})[_0x0983('0x2a')](respondWithStatusCode(_0x88e61f,null))[_0x0983('0x4b')](handleError(_0x88e61f,null));};exports[_0x0983('0x92')]=function(_0x520aa9,_0x44bd3e,_0x496845){var _0x3517fa={};var _0x3740db={};var _0x942d9a;var _0x2e583c;return db['OpenchannelQueue'][_0x0983('0x66')]({'where':{'id':_0x520aa9[_0x0983('0x4d')]['id']}})[_0x0983('0x2a')](handleEntityNotFound(_0x44bd3e,null))['then'](function(_0x502432){if(_0x502432){_0x942d9a=_0x502432;_0x3740db['model']=_[_0x0983('0x4e')](db['User'][_0x0983('0x33')]);_0x3740db['query']=_[_0x0983('0x4e')](_0x520aa9[_0x0983('0x38')]);_0x3740db['filters']=_[_0x0983('0x3a')](_0x3740db[_0x0983('0x36')],_0x3740db['query']);_0x3517fa['attributes']=_['intersection'](_0x3740db[_0x0983('0x36')],qs[_0x0983('0x3c')](_0x520aa9[_0x0983('0x38')][_0x0983('0x3c')]));_0x3517fa[_0x0983('0x3b')]=_0x3517fa['attributes'][_0x0983('0x3d')]?_0x3517fa['attributes']:_0x3740db[_0x0983('0x36')];_0x3517fa[_0x0983('0x3f')]=qs['sort'](_0x520aa9[_0x0983('0x38')]['sort']);_0x3517fa[_0x0983('0x41')]=qs[_0x0983('0x39')](_[_0x0983('0x42')](_0x520aa9['query'],_0x3740db[_0x0983('0x39')]));if(_0x520aa9[_0x0983('0x38')][_0x0983('0x43')]){_0x3517fa[_0x0983('0x41')]=_[_0x0983('0x44')](_0x3517fa[_0x0983('0x41')],{'$or':_['map'](_0x3517fa[_0x0983('0x3b')],function(_0x10f269){var _0x222ec7={};_0x222ec7[_0x10f269]={'$like':'%'+_0x520aa9[_0x0983('0x38')]['filter']+'%'};return _0x222ec7;})});}_0x3517fa=_[_0x0983('0x44')]({},_0x3517fa,_0x520aa9[_0x0983('0x46')]);return _0x942d9a[_0x0983('0x92')](_0x3517fa);}})[_0x0983('0x2a')](function(_0x51c4cb){if(_0x51c4cb){_0x2e583c=_0x51c4cb[_0x0983('0x3d')];if(!_0x520aa9['query'][_0x0983('0x3e')](_0x0983('0x5c'))){_0x3517fa[_0x0983('0x22')]=qs[_0x0983('0x22')](_0x520aa9[_0x0983('0x38')][_0x0983('0x22')]);_0x3517fa[_0x0983('0x21')]=qs[_0x0983('0x21')](_0x520aa9['query'][_0x0983('0x21')]);}return _0x942d9a[_0x0983('0x92')](_0x3517fa);}})[_0x0983('0x2a')](function(_0x304cd3){if(_0x304cd3){return _0x304cd3?{'count':_0x2e583c,'rows':_0x304cd3}:null;}})[_0x0983('0x2a')](respondWithResult(_0x44bd3e,null))['catch'](handleError(_0x44bd3e,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 20c6ccc..2f2b3bf 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 _0x788c=['exports','events','setMaxListeners','save','emit','hook'];(function(_0x511b76,_0x4727fa){var _0x5424ff=function(_0x24b7c0){while(--_0x24b7c0){_0x511b76['push'](_0x511b76['shift']());}};_0x5424ff(++_0x4727fa);}(_0x788c,0xc1));var _0xc788=function(_0x5dfb67,_0x293d5f){_0x5dfb67=_0x5dfb67-0x0;var _0x1d1416=_0x788c[_0x5dfb67];return _0x1d1416;};'use strict';var EventEmitter=require(_0xc788('0x0'));var OpenchannelQueue=require('../../mysqldb')['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xc788('0x1')](0x0);var events={'afterCreate':_0xc788('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x28ee23){return function(_0x310727,_0x3550bc,_0x24a89d){OpenchannelQueueEvents['emit'](_0x28ee23+':'+_0x310727['id'],_0x310727);OpenchannelQueueEvents[_0xc788('0x3')](_0x28ee23,_0x310727);_0x24a89d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0xc788('0x4')](e,emitEvent(event));}}module[_0xc788('0x5')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x9c9c=['hasOwnProperty','exports','events','setMaxListeners','save','remove','emit'];(function(_0x3dd92b,_0x4d1139){var _0x5e1d23=function(_0x5d866f){while(--_0x5d866f){_0x3dd92b['push'](_0x3dd92b['shift']());}};_0x5e1d23(++_0x4d1139);}(_0x9c9c,0x1ad));var _0xc9c9=function(_0x2e655a,_0x6d5799){_0x2e655a=_0x2e655a-0x0;var _0x26f13b=_0x9c9c[_0x2e655a];return _0x26f13b;};'use strict';var EventEmitter=require(_0xc9c9('0x0'));var OpenchannelQueue=require('../../mysqldb')['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xc9c9('0x1')](0x0);var events={'afterCreate':_0xc9c9('0x2'),'afterUpdate':'update','afterDestroy':_0xc9c9('0x3')};function emitEvent(_0x557e19){return function(_0x56b483,_0x74e1a9,_0x2d59c7){OpenchannelQueueEvents['emit'](_0x557e19+':'+_0x56b483['id'],_0x56b483);OpenchannelQueueEvents[_0xc9c9('0x4')](_0x557e19,_0x56b483);_0x2d59c7(null);};}for(var e in events){if(events[_0xc9c9('0x5')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0xc9c9('0x6')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 1999800..b40394f 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 _0x8492=['util','api','bluebird','path','OpenchannelQueue','lodash'];(function(_0x1415e2,_0x4c577d){var _0x41350d=function(_0x29e6de){while(--_0x29e6de){_0x1415e2['push'](_0x1415e2['shift']());}};_0x41350d(++_0x4c577d);}(_0x8492,0xd7));var _0x2849=function(_0x53a809,_0x24a014){_0x53a809=_0x53a809-0x0;var _0x43b0b8=_0x8492[_0x53a809];return _0x43b0b8;};'use strict';var _=require(_0x2849('0x0'));var util=require(_0x2849('0x1'));var logger=require('../../config/logger')(_0x2849('0x2'));var moment=require('moment');var BPromise=require(_0x2849('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2849('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./openchannelQueue.attributes');module['exports']=function(_0x591b82,_0x4f74bd){return _0x591b82['define'](_0x2849('0x5'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd60=['define','OpenchannelQueue','openchannel_queues','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports'];(function(_0x2248ad,_0x1e5d0a){var _0x1f8139=function(_0x28d737){while(--_0x28d737){_0x2248ad['push'](_0x2248ad['shift']());}};_0x1f8139(++_0x1e5d0a);}(_0xbd60,0x9d));var _0x0bd6=function(_0x47df54,_0x1aeb61){_0x47df54=_0x47df54-0x0;var _0x261b87=_0xbd60[_0x47df54];return _0x261b87;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x0bd6('0x0'));var moment=require(_0x0bd6('0x1'));var BPromise=require(_0x0bd6('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0bd6('0x3'));var rimraf=require(_0x0bd6('0x4'));var config=require(_0x0bd6('0x5'));var attributes=require(_0x0bd6('0x6'));module[_0x0bd6('0x7')]=function(_0x2bf88,_0x1d7eae){return _0x2bf88[_0x0bd6('0x8')](_0x0bd6('0x9'),attributes,{'tableName':_0x0bd6('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 41ae491..9edeb4d 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 _0xe7a7=['stringify','error','code','message','result','catch','OpenchannelQueue','findAll','options','raw','attributes','limit','map','include','model','GetOpenchannelQueue','ShowOpenchannelQueue','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s'];(function(_0x101fdf,_0x3ac78a){var _0xe63f2a=function(_0x461269){while(--_0x461269){_0x101fdf['push'](_0x101fdf['shift']());}};_0xe63f2a(++_0x3ac78a);}(_0xe7a7,0x18b));var _0x7e7a=function(_0x44b841,_0x3880e3){_0x44b841=_0x44b841-0x0;var _0x3cee16=_0xe7a7[_0x44b841];return _0x3cee16;};'use strict';var _=require(_0x7e7a('0x0'));var util=require(_0x7e7a('0x1'));var moment=require(_0x7e7a('0x2'));var BPromise=require(_0x7e7a('0x3'));var rs=require(_0x7e7a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7e7a('0x5'))['db'];var utils=require(_0x7e7a('0x6'));var logger=require(_0x7e7a('0x7'))(_0x7e7a('0x8'));var config=require(_0x7e7a('0x9'));var jayson=require(_0x7e7a('0xa'));var client=jayson[_0x7e7a('0xb')][_0x7e7a('0xc')]({'port':0x232a});config['redis']=_[_0x7e7a('0xd')](config[_0x7e7a('0xe')],{'host':_0x7e7a('0xf'),'port':0x18eb});var socket=require(_0x7e7a('0x10'))(new Redis(config[_0x7e7a('0xe')]));require('./openchannelQueue.socket')[_0x7e7a('0x11')](socket);function respondWithRpcPromise(_0x338c64,_0x584074,_0x6174d3){return new BPromise(function(_0x197512,_0x3f6cfd){return client[_0x7e7a('0x12')](_0x338c64,_0x6174d3)[_0x7e7a('0x13')](function(_0x5f3a26){logger[_0x7e7a('0x14')](_0x7e7a('0x15'),_0x584074,_0x7e7a('0x16'));logger[_0x7e7a('0x17')](_0x7e7a('0x18'),_0x584074,'request\x20sent',JSON[_0x7e7a('0x19')](_0x5f3a26));if(_0x5f3a26[_0x7e7a('0x1a')]){if(_0x5f3a26[_0x7e7a('0x1a')][_0x7e7a('0x1b')]===0x1f4){logger[_0x7e7a('0x1a')](_0x7e7a('0x15'),_0x584074,_0x5f3a26[_0x7e7a('0x1a')][_0x7e7a('0x1c')]);return _0x3f6cfd(_0x5f3a26[_0x7e7a('0x1a')]['message']);}logger['error'](_0x7e7a('0x15'),_0x584074,_0x5f3a26['error']['message']);return _0x197512(_0x5f3a26[_0x7e7a('0x1a')][_0x7e7a('0x1c')]);}else{logger[_0x7e7a('0x14')](_0x7e7a('0x15'),_0x584074,_0x7e7a('0x16'));_0x197512(_0x5f3a26[_0x7e7a('0x1d')][_0x7e7a('0x1c')]);}})[_0x7e7a('0x1e')](function(_0x46532c){logger[_0x7e7a('0x1a')]('OpenchannelQueue,\x20%s,\x20%s',_0x584074,_0x46532c);_0x3f6cfd(_0x46532c);});});}exports['GetOpenchannelQueue']=function(_0x3e5a85){var _0x19738a=this;return new Promise(function(_0x598ac4,_0x1b8e0f){return db[_0x7e7a('0x1f')][_0x7e7a('0x20')]({'raw':_0x3e5a85[_0x7e7a('0x21')]?_0x3e5a85[_0x7e7a('0x21')][_0x7e7a('0x22')]===undefined?!![]:![]:!![],'where':_0x3e5a85[_0x7e7a('0x21')]?_0x3e5a85['options']['where']||null:null,'attributes':_0x3e5a85['options']?_0x3e5a85[_0x7e7a('0x21')][_0x7e7a('0x23')]||null:null,'limit':_0x3e5a85['options']?_0x3e5a85[_0x7e7a('0x21')][_0x7e7a('0x24')]||null:null,'include':_0x3e5a85['options']?_0x3e5a85[_0x7e7a('0x21')]['include']?_[_0x7e7a('0x25')](_0x3e5a85[_0x7e7a('0x21')]['include'],function(_0x2ba312){return{'model':db[_0x2ba312['model']],'as':_0x2ba312['as'],'attributes':_0x2ba312[_0x7e7a('0x23')],'include':_0x2ba312[_0x7e7a('0x26')]?_[_0x7e7a('0x25')](_0x2ba312['include'],function(_0x4fa37b){return{'model':db[_0x4fa37b[_0x7e7a('0x27')]],'as':_0x4fa37b['as'],'attributes':_0x4fa37b['attributes'],'include':_0x4fa37b[_0x7e7a('0x26')]?_[_0x7e7a('0x25')](_0x4fa37b[_0x7e7a('0x26')],function(_0x1ccf5e){return{'model':db[_0x1ccf5e[_0x7e7a('0x27')]],'as':_0x1ccf5e['as'],'attributes':_0x1ccf5e['attributes']};}):[]};}):[]};}):[]:[]})[_0x7e7a('0x13')](function(_0x537ccd){logger[_0x7e7a('0x14')](_0x7e7a('0x28'),_0x3e5a85);logger[_0x7e7a('0x17')](_0x7e7a('0x28'),_0x3e5a85,JSON['stringify'](_0x537ccd));_0x598ac4(_0x537ccd);})[_0x7e7a('0x1e')](function(_0x42546a){logger[_0x7e7a('0x1a')](_0x7e7a('0x28'),_0x42546a[_0x7e7a('0x1c')],_0x3e5a85);_0x1b8e0f(_0x19738a[_0x7e7a('0x1a')](0x1f4,_0x42546a[_0x7e7a('0x1c')]));});});};exports[_0x7e7a('0x29')]=function(_0x23b123){var _0xe2b538=this;return new Promise(function(_0x2e3aa0,_0x4bcd17){return db[_0x7e7a('0x1f')]['find']({'raw':_0x23b123['options']?_0x23b123['options'][_0x7e7a('0x22')]===undefined?!![]:![]:!![],'where':_0x23b123[_0x7e7a('0x21')]?_0x23b123['options']['where']||null:null,'attributes':_0x23b123[_0x7e7a('0x21')]?_0x23b123[_0x7e7a('0x21')][_0x7e7a('0x23')]||null:null,'include':_0x23b123[_0x7e7a('0x21')]?_0x23b123[_0x7e7a('0x21')][_0x7e7a('0x26')]?_[_0x7e7a('0x25')](_0x23b123[_0x7e7a('0x21')][_0x7e7a('0x26')],function(_0x2a0791){return{'model':db[_0x2a0791[_0x7e7a('0x27')]],'as':_0x2a0791['as'],'attributes':_0x2a0791[_0x7e7a('0x23')],'include':_0x2a0791[_0x7e7a('0x26')]?_['map'](_0x2a0791[_0x7e7a('0x26')],function(_0x339759){return{'model':db[_0x339759[_0x7e7a('0x27')]],'as':_0x339759['as'],'attributes':_0x339759[_0x7e7a('0x23')],'include':_0x339759[_0x7e7a('0x26')]?_[_0x7e7a('0x25')](_0x339759['include'],function(_0x1ef76d){return{'model':db[_0x1ef76d['model']],'as':_0x1ef76d['as'],'attributes':_0x1ef76d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x970704){logger['info'](_0x7e7a('0x29'),_0x23b123);logger[_0x7e7a('0x17')](_0x7e7a('0x29'),_0x23b123,JSON[_0x7e7a('0x19')](_0x970704));_0x2e3aa0(_0x970704);})[_0x7e7a('0x1e')](function(_0x15d40a){logger[_0x7e7a('0x1a')](_0x7e7a('0x29'),_0x15d40a['message'],_0x23b123);_0x4bcd17(_0xe2b538[_0x7e7a('0x1a')](0x1f4,_0x15d40a['message']));});});}; \ No newline at end of file +var _0x421c=['../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','OpenchannelQueue','findAll','options','raw','where','limit','include','map','model','attributes','then','GetOpenchannelQueue','catch','find','ShowOpenchannelQueue','lodash','util','moment','randomstring','../../mysqldb'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x421c,0x163));var _0xc421=function(_0x5d6ac2,_0x104654){_0x5d6ac2=_0x5d6ac2-0x0;var _0x269665=_0x421c[_0x5d6ac2];return _0x269665;};'use strict';var _=require(_0xc421('0x0'));var util=require(_0xc421('0x1'));var moment=require(_0xc421('0x2'));var BPromise=require('bluebird');var rs=require(_0xc421('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc421('0x4'))['db'];var utils=require(_0xc421('0x5'));var logger=require(_0xc421('0x6'))(_0xc421('0x7'));var config=require('../../config/environment');var jayson=require(_0xc421('0x8'));var client=jayson[_0xc421('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xc421('0xa')],{'host':_0xc421('0xb'),'port':0x18eb});var socket=require(_0xc421('0xc'))(new Redis(config[_0xc421('0xa')]));require(_0xc421('0xd'))[_0xc421('0xe')](socket);function respondWithRpcPromise(_0x81a56d,_0x400a86,_0x21157e){return new BPromise(function(_0x304aa4,_0x3454db){return client[_0xc421('0xf')](_0x81a56d,_0x21157e)['then'](function(_0x5ce10a){logger['info'](_0xc421('0x10'),_0x400a86,_0xc421('0x11'));logger[_0xc421('0x12')](_0xc421('0x13'),_0x400a86,'request\x20sent',JSON[_0xc421('0x14')](_0x5ce10a));if(_0x5ce10a['error']){if(_0x5ce10a[_0xc421('0x15')][_0xc421('0x16')]===0x1f4){logger[_0xc421('0x15')](_0xc421('0x10'),_0x400a86,_0x5ce10a[_0xc421('0x15')]['message']);return _0x3454db(_0x5ce10a[_0xc421('0x15')][_0xc421('0x17')]);}logger[_0xc421('0x15')](_0xc421('0x10'),_0x400a86,_0x5ce10a[_0xc421('0x15')][_0xc421('0x17')]);return _0x304aa4(_0x5ce10a[_0xc421('0x15')]['message']);}else{logger[_0xc421('0x18')](_0xc421('0x10'),_0x400a86,_0xc421('0x11'));_0x304aa4(_0x5ce10a['result'][_0xc421('0x17')]);}})['catch'](function(_0x3eaa75){logger[_0xc421('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x400a86,_0x3eaa75);_0x3454db(_0x3eaa75);});});}exports['GetOpenchannelQueue']=function(_0x200df1){var _0x3b32dd=this;return new Promise(function(_0x1893ce,_0x37e325){return db[_0xc421('0x19')][_0xc421('0x1a')]({'raw':_0x200df1[_0xc421('0x1b')]?_0x200df1[_0xc421('0x1b')][_0xc421('0x1c')]===undefined?!![]:![]:!![],'where':_0x200df1[_0xc421('0x1b')]?_0x200df1['options'][_0xc421('0x1d')]||null:null,'attributes':_0x200df1[_0xc421('0x1b')]?_0x200df1[_0xc421('0x1b')]['attributes']||null:null,'limit':_0x200df1['options']?_0x200df1['options'][_0xc421('0x1e')]||null:null,'include':_0x200df1[_0xc421('0x1b')]?_0x200df1[_0xc421('0x1b')][_0xc421('0x1f')]?_[_0xc421('0x20')](_0x200df1[_0xc421('0x1b')][_0xc421('0x1f')],function(_0x1bdc27){return{'model':db[_0x1bdc27[_0xc421('0x21')]],'as':_0x1bdc27['as'],'attributes':_0x1bdc27[_0xc421('0x22')],'include':_0x1bdc27[_0xc421('0x1f')]?_[_0xc421('0x20')](_0x1bdc27[_0xc421('0x1f')],function(_0x492da5){return{'model':db[_0x492da5[_0xc421('0x21')]],'as':_0x492da5['as'],'attributes':_0x492da5[_0xc421('0x22')],'include':_0x492da5[_0xc421('0x1f')]?_['map'](_0x492da5['include'],function(_0x21dce6){return{'model':db[_0x21dce6[_0xc421('0x21')]],'as':_0x21dce6['as'],'attributes':_0x21dce6[_0xc421('0x22')]};}):[]};}):[]};}):[]:[]})[_0xc421('0x23')](function(_0xaf0284){logger['info'](_0xc421('0x24'),_0x200df1);logger['debug'](_0xc421('0x24'),_0x200df1,JSON[_0xc421('0x14')](_0xaf0284));_0x1893ce(_0xaf0284);})[_0xc421('0x25')](function(_0x55f165){logger['error'](_0xc421('0x24'),_0x55f165['message'],_0x200df1);_0x37e325(_0x3b32dd['error'](0x1f4,_0x55f165[_0xc421('0x17')]));});});};exports['ShowOpenchannelQueue']=function(_0x4e5f55){var _0x373bf4=this;return new Promise(function(_0x18f7a4,_0x30fb9b){return db[_0xc421('0x19')][_0xc421('0x26')]({'raw':_0x4e5f55[_0xc421('0x1b')]?_0x4e5f55['options'][_0xc421('0x1c')]===undefined?!![]:![]:!![],'where':_0x4e5f55['options']?_0x4e5f55[_0xc421('0x1b')][_0xc421('0x1d')]||null:null,'attributes':_0x4e5f55[_0xc421('0x1b')]?_0x4e5f55[_0xc421('0x1b')][_0xc421('0x22')]||null:null,'include':_0x4e5f55[_0xc421('0x1b')]?_0x4e5f55[_0xc421('0x1b')][_0xc421('0x1f')]?_[_0xc421('0x20')](_0x4e5f55[_0xc421('0x1b')][_0xc421('0x1f')],function(_0x5d1492){return{'model':db[_0x5d1492[_0xc421('0x21')]],'as':_0x5d1492['as'],'attributes':_0x5d1492[_0xc421('0x22')],'include':_0x5d1492[_0xc421('0x1f')]?_[_0xc421('0x20')](_0x5d1492[_0xc421('0x1f')],function(_0x168529){return{'model':db[_0x168529[_0xc421('0x21')]],'as':_0x168529['as'],'attributes':_0x168529[_0xc421('0x22')],'include':_0x168529[_0xc421('0x1f')]?_[_0xc421('0x20')](_0x168529['include'],function(_0x32569c){return{'model':db[_0x32569c['model']],'as':_0x32569c['as'],'attributes':_0x32569c['attributes']};}):[]};}):[]};}):[]:[]})[_0xc421('0x23')](function(_0x41617e){logger[_0xc421('0x18')](_0xc421('0x27'),_0x4e5f55);logger['debug'](_0xc421('0x27'),_0x4e5f55,JSON[_0xc421('0x14')](_0x41617e));_0x18f7a4(_0x41617e);})[_0xc421('0x25')](function(_0x3da49a){logger[_0xc421('0x15')](_0xc421('0x27'),_0x3da49a[_0xc421('0x17')],_0x4e5f55);_0x30fb9b(_0x373bf4[_0xc421('0x15')](0x1f4,_0x3da49a[_0xc421('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index cf653fd..8a54252 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 _0xa720=['removeListener','register','length','./openchannelQueue.events','save','update','emit'];(function(_0x99868f,_0xbdb8e7){var _0x27a71b=function(_0x41feca){while(--_0x41feca){_0x99868f['push'](_0x99868f['shift']());}};_0x27a71b(++_0xbdb8e7);}(_0xa720,0x1a0));var _0x0a72=function(_0x5f0489,_0x2eed24){_0x5f0489=_0x5f0489-0x0;var _0x3736a4=_0xa720[_0x5f0489];return _0x3736a4;};'use strict';var OpenchannelQueueEvents=require(_0x0a72('0x0'));var events=[_0x0a72('0x1'),'remove',_0x0a72('0x2')];function createListener(_0x4643e4,_0x34d205){return function(_0x10e450){_0x34d205[_0x0a72('0x3')](_0x4643e4,_0x10e450);};}function removeListener(_0x488f3e,_0x2f51fd){return function(){OpenchannelQueueEvents[_0x0a72('0x4')](_0x488f3e,_0x2f51fd);};}exports[_0x0a72('0x5')]=function(_0x342438){for(var _0x1364f1=0x0,_0x3c7b4f=events[_0x0a72('0x6')];_0x1364f1<_0x3c7b4f;_0x1364f1++){var _0x16d989=events[_0x1364f1];var _0x4aa648=createListener('openchannelQueue:'+_0x16d989,_0x342438);OpenchannelQueueEvents['on'](_0x16d989,_0x4aa648);}}; \ No newline at end of file +var _0x17ec=['./openchannelQueue.events','save','remove','length','openchannelQueue:'];(function(_0x152520,_0x104a89){var _0xac706a=function(_0x3154e5){while(--_0x3154e5){_0x152520['push'](_0x152520['shift']());}};_0xac706a(++_0x104a89);}(_0x17ec,0x1db));var _0xc17e=function(_0x33c26b,_0x285446){_0x33c26b=_0x33c26b-0x0;var _0x1b5529=_0x17ec[_0x33c26b];return _0x1b5529;};'use strict';var OpenchannelQueueEvents=require(_0xc17e('0x0'));var events=[_0xc17e('0x1'),_0xc17e('0x2'),'update'];function createListener(_0x10c309,_0x3cf4e6){return function(_0x5dea9c){_0x3cf4e6['emit'](_0x10c309,_0x5dea9c);};}function removeListener(_0x2ab0df,_0x461b9f){return function(){OpenchannelQueueEvents['removeListener'](_0x2ab0df,_0x461b9f);};}exports['register']=function(_0x15e96c){for(var _0x308333=0x0,_0x321621=events[_0xc17e('0x3')];_0x308333<_0x321621;_0x308333++){var _0x15b7cd=events[_0x308333];var _0x88f1b8=createListener(_0xc17e('0x4')+_0x15b7cd,_0x15e96c);OpenchannelQueueEvents['on'](_0x15b7cd,_0x88f1b8);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 5b34829..4767572 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 _0xd031=['multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','update','delete','destroy','exports'];(function(_0x1a2395,_0x13fe8a){var _0x2b83d7=function(_0x36669d){while(--_0x36669d){_0x1a2395['push'](_0x1a2395['shift']());}};_0x2b83d7(++_0x13fe8a);}(_0xd031,0x130));var _0x1d03=function(_0x2aab82,_0x44a3de){_0x2aab82=_0x2aab82-0x0;var _0x11e394=_0xd031[_0x2aab82];return _0x11e394;};'use strict';var multer=require(_0x1d03('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1d03('0x1'));var express=require(_0x1d03('0x2'));var router=express[_0x1d03('0x3')]();var fs_extra=require(_0x1d03('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1d03('0x5'));var config=require(_0x1d03('0x6'));var controller=require(_0x1d03('0x7'));router[_0x1d03('0x8')]('/',auth[_0x1d03('0x9')](),controller[_0x1d03('0xa')]);router[_0x1d03('0x8')](_0x1d03('0xb'),auth[_0x1d03('0x9')](),controller['describe']);router[_0x1d03('0x8')](_0x1d03('0xc'),auth[_0x1d03('0x9')](),controller[_0x1d03('0xd')]);router['post']('/',auth[_0x1d03('0x9')](),controller[_0x1d03('0xe')]);router['put'](_0x1d03('0xc'),auth[_0x1d03('0x9')](),controller[_0x1d03('0xf')]);router[_0x1d03('0x10')](_0x1d03('0xc'),auth[_0x1d03('0x9')](),controller[_0x1d03('0x11')]);module[_0x1d03('0x12')]=router; \ No newline at end of file +var _0x304b=['put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','index','get','/describe','/:id','show','post','create'];(function(_0xe2d80a,_0x998b0a){var _0x11c58a=function(_0x108873){while(--_0x108873){_0xe2d80a['push'](_0xe2d80a['shift']());}};_0x11c58a(++_0x998b0a);}(_0x304b,0x153));var _0xb304=function(_0x4ff4d3,_0x4e91f0){_0x4ff4d3=_0x4ff4d3-0x0;var _0x537520=_0x304b[_0x4ff4d3];return _0x537520;};'use strict';var multer=require(_0xb304('0x0'));var util=require(_0xb304('0x1'));var path=require(_0xb304('0x2'));var timeout=require(_0xb304('0x3'));var express=require(_0xb304('0x4'));var router=express[_0xb304('0x5')]();var fs_extra=require(_0xb304('0x6'));var auth=require(_0xb304('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xb304('0x8'));var controller=require(_0xb304('0x9'));router['get']('/',auth[_0xb304('0xa')](),controller[_0xb304('0xb')]);router[_0xb304('0xc')](_0xb304('0xd'),auth[_0xb304('0xa')](),controller['describe']);router[_0xb304('0xc')](_0xb304('0xe'),auth[_0xb304('0xa')](),controller[_0xb304('0xf')]);router[_0xb304('0x10')]('/',auth[_0xb304('0xa')](),controller[_0xb304('0x11')]);router[_0xb304('0x12')](_0xb304('0xe'),auth[_0xb304('0xa')](),controller[_0xb304('0x13')]);router['delete']('/:id',auth[_0xb304('0xa')](),controller['destroy']);module[_0xb304('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 4b6b84b..06074cc 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 _0x03c6=['STRING','DATE','moment','sequelize','exports'];(function(_0x2787a6,_0x1f88e8){var _0x5a8b3f=function(_0x50c0fe){while(--_0x50c0fe){_0x2787a6['push'](_0x2787a6['shift']());}};_0x5a8b3f(++_0x1f88e8);}(_0x03c6,0xb1));var _0x603c=function(_0x21872e,_0x182251){_0x21872e=_0x21872e-0x0;var _0x124588=_0x03c6[_0x21872e];return _0x124588;};'use strict';var moment=require(_0x603c('0x0'));var Sequelize=require(_0x603c('0x1'));module[_0x603c('0x2')]={'uniqueid':{'type':Sequelize[_0x603c('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x603c('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x603c('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x603c('0x3')]}}; \ No newline at end of file +var _0x4e3e=['DATE','moment','exports','STRING'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x4e3e,0x139));var _0xe4e3=function(_0x14eb15,_0x5df0a8){_0x14eb15=_0x14eb15-0x0;var _0x460dab=_0x4e3e[_0x14eb15];return _0x460dab;};'use strict';var moment=require(_0xe4e3('0x0'));var Sequelize=require('sequelize');module[_0xe4e3('0x1')]={'uniqueid':{'type':Sequelize[_0xe4e3('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xe4e3('0x2')]},'joinAt':{'type':Sequelize[_0xe4e3('0x3')]},'leaveAt':{'type':Sequelize[_0xe4e3('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xe4e3('0x3')]},'reason':{'type':Sequelize[_0xe4e3('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 49cbc1f..d7c613d 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 _0x494d=['api','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','OpenchannelQueueReport','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','catch','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x3a634e,_0x273db2){var _0x2ecddb=function(_0x3a9d2d){while(--_0x3a9d2d){_0x3a634e['push'](_0x3a634e['shift']());}};_0x2ecddb(++_0x273db2);}(_0x494d,0x110));var _0xd494=function(_0x3b2929,_0x4d8824){_0x3b2929=_0x3b2929-0x0;var _0x41ccd1=_0x494d[_0x3b2929];return _0x41ccd1;};'use strict';var emlformat=require(_0xd494('0x0'));var rimraf=require(_0xd494('0x1'));var zipdir=require(_0xd494('0x2'));var jsonpatch=require(_0xd494('0x3'));var rp=require(_0xd494('0x4'));var moment=require(_0xd494('0x5'));var BPromise=require(_0xd494('0x6'));var Mustache=require(_0xd494('0x7'));var util=require(_0xd494('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xd494('0x9'));var ejs=require(_0xd494('0xa'));var fs=require('fs');var fs_extra=require(_0xd494('0xb'));var _=require('lodash');var squel=require(_0xd494('0xc'));var crypto=require(_0xd494('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd494('0xe'));var toCsv=require(_0xd494('0x9'));var querystring=require('querystring');var Papa=require(_0xd494('0xf'));var Redis=require('ioredis');var authService=require(_0xd494('0x10'));var qs=require(_0xd494('0x11'));var as=require(_0xd494('0x12'));var hardwareService=require(_0xd494('0x13'));var logger=require('../../config/logger')(_0xd494('0x14'));var utils=require('../../config/utils');var config=require(_0xd494('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x365a36,_0x4d6806){_0x4d6806=_0x4d6806||0xcc;return function(_0x5df04b){if(_0x5df04b){return _0x365a36[_0xd494('0x16')](_0x4d6806);}return _0x365a36[_0xd494('0x17')](_0x4d6806)[_0xd494('0x18')]();};}function respondWithResult(_0x2beaaf,_0x25a564){_0x25a564=_0x25a564||0xc8;return function(_0x1110bf){if(_0x1110bf){return _0x2beaaf[_0xd494('0x17')](_0x25a564)[_0xd494('0x19')](_0x1110bf);}};}function respondWithFilteredResult(_0x265788,_0x488e28){return function(_0x374d53){if(_0x374d53){var _0x506ee4=typeof _0x488e28[_0xd494('0x1a')]==='undefined'&&typeof _0x488e28['limit']===_0xd494('0x1b');var _0x2b9932=_0x374d53[_0xd494('0x1c')];var _0x340b01=_0x506ee4?0x0:_0x488e28['offset'];var _0x4a5ded=_0x506ee4?_0x374d53[_0xd494('0x1c')]:_0x488e28[_0xd494('0x1a')]+_0x488e28[_0xd494('0x1d')];var _0x4a46bf;if(_0x4a5ded>=_0x2b9932){_0x4a5ded=_0x2b9932;_0x4a46bf=0xc8;}else{_0x4a46bf=0xce;}_0x265788[_0xd494('0x17')](_0x4a46bf);return _0x265788[_0xd494('0x1e')](_0xd494('0x1f'),_0x340b01+'-'+_0x4a5ded+'/'+_0x2b9932)[_0xd494('0x19')](_0x374d53);}return null;};}function patchUpdates(_0x64c2ce){return function(_0x4833ee){try{jsonpatch[_0xd494('0x20')](_0x4833ee,_0x64c2ce,!![]);}catch(_0x371fce){return BPromise[_0xd494('0x21')](_0x371fce);}return _0x4833ee[_0xd494('0x22')]();};}function saveUpdates(_0x1d30a8,_0x1121b6){return function(_0x7800a1){if(_0x7800a1){return _0x7800a1[_0xd494('0x23')](_0x1d30a8)[_0xd494('0x24')](function(_0x191247){return _0x191247;});}return null;};}function removeEntity(_0xbdd1ac,_0x298047){return function(_0x2e905f){if(_0x2e905f){return _0x2e905f[_0xd494('0x25')]()[_0xd494('0x24')](function(){_0xbdd1ac['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x56fcc0,_0x2177fc){return function(_0x5b38d6){if(!_0x5b38d6){_0x56fcc0['sendStatus'](0x194);}return _0x5b38d6;};}function handleError(_0x350ca6,_0x543e82){_0x543e82=_0x543e82||0x1f4;return function(_0x332bcd){logger[_0xd494('0x26')](_0x332bcd[_0xd494('0x27')]);if(_0x332bcd[_0xd494('0x28')]){delete _0x332bcd[_0xd494('0x28')];}_0x350ca6['status'](_0x543e82)[_0xd494('0x29')](_0x332bcd);};}exports['index']=function(_0x3424af,_0x593201){var _0x422c13={},_0x58126c={},_0x2ac141={'count':0x0,'rows':[]};var _0xb269a2=_[_0xd494('0x2a')](db[_0xd494('0x2b')]['rawAttributes'],function(_0x393e57){return{'name':_0x393e57['fieldName'],'type':_0x393e57[_0xd494('0x2c')][_0xd494('0x2d')]};});_0x58126c[_0xd494('0x2e')]=_[_0xd494('0x2a')](_0xb269a2,_0xd494('0x28'));_0x58126c['query']=_[_0xd494('0x2f')](_0x3424af[_0xd494('0x30')]);_0x58126c[_0xd494('0x31')]=_[_0xd494('0x32')](_0x58126c[_0xd494('0x2e')],_0x58126c[_0xd494('0x30')]);_0x422c13[_0xd494('0x33')]=_['intersection'](_0x58126c[_0xd494('0x2e')],qs[_0xd494('0x34')](_0x3424af[_0xd494('0x30')][_0xd494('0x34')]));_0x422c13[_0xd494('0x33')]=_0x422c13[_0xd494('0x33')][_0xd494('0x35')]?_0x422c13[_0xd494('0x33')]:_0x58126c[_0xd494('0x2e')];if(!_0x3424af[_0xd494('0x30')]['hasOwnProperty'](_0xd494('0x36'))){_0x422c13['limit']=qs[_0xd494('0x1d')](_0x3424af[_0xd494('0x30')]['limit']);_0x422c13[_0xd494('0x1a')]=qs['offset'](_0x3424af[_0xd494('0x30')][_0xd494('0x1a')]);}_0x422c13[_0xd494('0x37')]=qs[_0xd494('0x38')](_0x3424af[_0xd494('0x30')][_0xd494('0x38')]);_0x422c13[_0xd494('0x39')]=qs[_0xd494('0x31')](_[_0xd494('0x3a')](_0x3424af['query'],_0x58126c[_0xd494('0x31')]),_0xb269a2);if(_0x3424af[_0xd494('0x30')][_0xd494('0x3b')]){_0x422c13['where']=_[_0xd494('0x3c')](_0x422c13[_0xd494('0x39')],{'$or':_[_0xd494('0x2a')](_0xb269a2,function(_0x21cd4b){if(_0x21cd4b[_0xd494('0x2c')]!==_0xd494('0x3d')){var _0x389aa2={};_0x389aa2[_0x21cd4b[_0xd494('0x28')]]={'$like':'%'+_0x3424af[_0xd494('0x30')]['filter']+'%'};return _0x389aa2;}})});}_0x422c13=_['merge']({},_0x422c13,_0x3424af['options']);var _0x1cc1d9={'where':_0x422c13[_0xd494('0x39')]};return db[_0xd494('0x2b')][_0xd494('0x1c')](_0x1cc1d9)[_0xd494('0x24')](function(_0x56364b){_0x2ac141[_0xd494('0x1c')]=_0x56364b;if(_0x3424af[_0xd494('0x30')][_0xd494('0x3e')]){_0x422c13[_0xd494('0x3f')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0xd494('0x40')](_0x422c13);})['then'](function(_0x34af66){_0x2ac141[_0xd494('0x41')]=_0x34af66;return _0x2ac141;})[_0xd494('0x24')](respondWithFilteredResult(_0x593201,_0x422c13))['catch'](handleError(_0x593201,null));};exports[_0xd494('0x42')]=function(_0x1aa0b3,_0x51f8f7){var _0xf0e973={'raw':!![],'where':{'id':_0x1aa0b3[_0xd494('0x43')]['id']}},_0x386d3b={};_0x386d3b[_0xd494('0x2e')]=_[_0xd494('0x2f')](db['OpenchannelQueueReport']['rawAttributes']);_0x386d3b['query']=_[_0xd494('0x2f')](_0x1aa0b3[_0xd494('0x30')]);_0x386d3b[_0xd494('0x31')]=_[_0xd494('0x32')](_0x386d3b[_0xd494('0x2e')],_0x386d3b['query']);_0xf0e973['attributes']=_['intersection'](_0x386d3b['model'],qs['fields'](_0x1aa0b3['query'][_0xd494('0x34')]));_0xf0e973[_0xd494('0x33')]=_0xf0e973[_0xd494('0x33')][_0xd494('0x35')]?_0xf0e973[_0xd494('0x33')]:_0x386d3b[_0xd494('0x2e')];if(_0x1aa0b3[_0xd494('0x30')][_0xd494('0x3e')]){_0xf0e973[_0xd494('0x3f')]=[{'all':!![]}];}_0xf0e973=_['merge']({},_0xf0e973,_0x1aa0b3[_0xd494('0x44')]);return db[_0xd494('0x2b')][_0xd494('0x45')](_0xf0e973)[_0xd494('0x24')](handleEntityNotFound(_0x51f8f7,null))[_0xd494('0x24')](respondWithResult(_0x51f8f7,null))[_0xd494('0x46')](handleError(_0x51f8f7,null));};exports['create']=function(_0x4b7f63,_0x2e617c){return db[_0xd494('0x2b')]['create'](_0x4b7f63[_0xd494('0x47')],{})[_0xd494('0x24')](respondWithResult(_0x2e617c,0xc9))[_0xd494('0x46')](handleError(_0x2e617c,null));};exports[_0xd494('0x23')]=function(_0x3e4870,_0x51e383){if(_0x3e4870['body']['id']){delete _0x3e4870['body']['id'];}return db[_0xd494('0x2b')][_0xd494('0x45')]({'where':{'id':_0x3e4870['params']['id']}})[_0xd494('0x24')](handleEntityNotFound(_0x51e383,null))[_0xd494('0x24')](saveUpdates(_0x3e4870['body'],null))['then'](respondWithResult(_0x51e383,null))['catch'](handleError(_0x51e383,null));};exports[_0xd494('0x25')]=function(_0x13cc09,_0x48d1e0){return db[_0xd494('0x2b')]['find']({'where':{'id':_0x13cc09[_0xd494('0x43')]['id']}})[_0xd494('0x24')](handleEntityNotFound(_0x48d1e0,null))[_0xd494('0x24')](removeEntity(_0x48d1e0,null))['catch'](handleError(_0x48d1e0,null));};exports[_0xd494('0x48')]=function(_0x2f9c6b,_0x21bae1){return db[_0xd494('0x2b')]['describe']()[_0xd494('0x24')](respondWithResult(_0x21bae1,null))[_0xd494('0x46')](handleError(_0x21bae1,null));}; \ No newline at end of file +var _0xbc0f=['save','update','then','sendStatus','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','nolimit','order','where','pick','filter','merge','VIRTUAL','options','include','rows','show','keys','includeAll','find','catch','create','params','body','destroy','describe','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','reject'];(function(_0x3ce2c4,_0x4544c1){var _0x4047c1=function(_0x3fece6){while(--_0x3fece6){_0x3ce2c4['push'](_0x3ce2c4['shift']());}};_0x4047c1(++_0x4544c1);}(_0xbc0f,0x1cd));var _0xfbc0=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xbc0f[_0xfae23b];return _0x200640;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfbc0('0x0'));var zipdir=require(_0xfbc0('0x1'));var jsonpatch=require(_0xfbc0('0x2'));var rp=require('request-promise');var moment=require(_0xfbc0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfbc0('0x4'));var util=require(_0xfbc0('0x5'));var path=require(_0xfbc0('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfbc0('0x7'));var _=require(_0xfbc0('0x8'));var squel=require('squel');var crypto=require(_0xfbc0('0x9'));var jsforce=require(_0xfbc0('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfbc0('0xb'));var Redis=require(_0xfbc0('0xc'));var authService=require(_0xfbc0('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xfbc0('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfbc0('0xf'))(_0xfbc0('0x10'));var utils=require(_0xfbc0('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xfbc0('0x12'));var db=require(_0xfbc0('0x13'))['db'];function respondWithStatusCode(_0x3ea830,_0x2d077c){_0x2d077c=_0x2d077c||0xcc;return function(_0x284ee7){if(_0x284ee7){return _0x3ea830['sendStatus'](_0x2d077c);}return _0x3ea830[_0xfbc0('0x14')](_0x2d077c)[_0xfbc0('0x15')]();};}function respondWithResult(_0xd95dab,_0x35a90d){_0x35a90d=_0x35a90d||0xc8;return function(_0x18f18a){if(_0x18f18a){return _0xd95dab[_0xfbc0('0x14')](_0x35a90d)[_0xfbc0('0x16')](_0x18f18a);}};}function respondWithFilteredResult(_0x3deb7c,_0x420b68){return function(_0x599383){if(_0x599383){var _0x31d515=typeof _0x420b68[_0xfbc0('0x17')]===_0xfbc0('0x18')&&typeof _0x420b68[_0xfbc0('0x19')]==='undefined';var _0x59f62c=_0x599383['count'];var _0x11b3d6=_0x31d515?0x0:_0x420b68[_0xfbc0('0x17')];var _0x506604=_0x31d515?_0x599383[_0xfbc0('0x1a')]:_0x420b68[_0xfbc0('0x17')]+_0x420b68[_0xfbc0('0x19')];var _0x57a990;if(_0x506604>=_0x59f62c){_0x506604=_0x59f62c;_0x57a990=0xc8;}else{_0x57a990=0xce;}_0x3deb7c[_0xfbc0('0x14')](_0x57a990);return _0x3deb7c[_0xfbc0('0x1b')]('Content-Range',_0x11b3d6+'-'+_0x506604+'/'+_0x59f62c)[_0xfbc0('0x16')](_0x599383);}return null;};}function patchUpdates(_0xb86f3){return function(_0x549050){try{jsonpatch['apply'](_0x549050,_0xb86f3,!![]);}catch(_0x50eb93){return BPromise[_0xfbc0('0x1c')](_0x50eb93);}return _0x549050[_0xfbc0('0x1d')]();};}function saveUpdates(_0x1caa37,_0x123ef8){return function(_0x1d9d93){if(_0x1d9d93){return _0x1d9d93[_0xfbc0('0x1e')](_0x1caa37)['then'](function(_0x497609){return _0x497609;});}return null;};}function removeEntity(_0x3e0bc5,_0x310ce1){return function(_0x54cd8a){if(_0x54cd8a){return _0x54cd8a['destroy']()[_0xfbc0('0x1f')](function(){_0x3e0bc5[_0xfbc0('0x14')](0xcc)[_0xfbc0('0x15')]();});}};}function handleEntityNotFound(_0x59312b,_0x70dbf1){return function(_0x35409e){if(!_0x35409e){_0x59312b[_0xfbc0('0x20')](0x194);}return _0x35409e;};}function handleError(_0x3bf2ba,_0x3a74cc){_0x3a74cc=_0x3a74cc||0x1f4;return function(_0x4d6492){logger['error'](_0x4d6492[_0xfbc0('0x21')]);if(_0x4d6492[_0xfbc0('0x22')]){delete _0x4d6492[_0xfbc0('0x22')];}_0x3bf2ba[_0xfbc0('0x14')](_0x3a74cc)[_0xfbc0('0x23')](_0x4d6492);};}exports[_0xfbc0('0x24')]=function(_0x198577,_0x107571){var _0x2a9655={},_0x1bb436={},_0x5bc166={'count':0x0,'rows':[]};var _0x1ff8e0=_[_0xfbc0('0x25')](db[_0xfbc0('0x26')][_0xfbc0('0x27')],function(_0x82eff6){return{'name':_0x82eff6[_0xfbc0('0x28')],'type':_0x82eff6[_0xfbc0('0x29')][_0xfbc0('0x2a')]};});_0x1bb436[_0xfbc0('0x2b')]=_[_0xfbc0('0x25')](_0x1ff8e0,_0xfbc0('0x22'));_0x1bb436['query']=_['keys'](_0x198577['query']);_0x1bb436[_0xfbc0('0x2c')]=_[_0xfbc0('0x2d')](_0x1bb436[_0xfbc0('0x2b')],_0x1bb436[_0xfbc0('0x2e')]);_0x2a9655[_0xfbc0('0x2f')]=_['intersection'](_0x1bb436[_0xfbc0('0x2b')],qs[_0xfbc0('0x30')](_0x198577[_0xfbc0('0x2e')]['fields']));_0x2a9655[_0xfbc0('0x2f')]=_0x2a9655[_0xfbc0('0x2f')][_0xfbc0('0x31')]?_0x2a9655['attributes']:_0x1bb436[_0xfbc0('0x2b')];if(!_0x198577['query']['hasOwnProperty'](_0xfbc0('0x32'))){_0x2a9655['limit']=qs[_0xfbc0('0x19')](_0x198577[_0xfbc0('0x2e')][_0xfbc0('0x19')]);_0x2a9655[_0xfbc0('0x17')]=qs[_0xfbc0('0x17')](_0x198577['query'][_0xfbc0('0x17')]);}_0x2a9655[_0xfbc0('0x33')]=qs['sort'](_0x198577[_0xfbc0('0x2e')]['sort']);_0x2a9655[_0xfbc0('0x34')]=qs[_0xfbc0('0x2c')](_[_0xfbc0('0x35')](_0x198577[_0xfbc0('0x2e')],_0x1bb436[_0xfbc0('0x2c')]),_0x1ff8e0);if(_0x198577['query'][_0xfbc0('0x36')]){_0x2a9655[_0xfbc0('0x34')]=_[_0xfbc0('0x37')](_0x2a9655['where'],{'$or':_[_0xfbc0('0x25')](_0x1ff8e0,function(_0x37dddf){if(_0x37dddf[_0xfbc0('0x29')]!==_0xfbc0('0x38')){var _0x15798a={};_0x15798a[_0x37dddf[_0xfbc0('0x22')]]={'$like':'%'+_0x198577[_0xfbc0('0x2e')][_0xfbc0('0x36')]+'%'};return _0x15798a;}})});}_0x2a9655=_[_0xfbc0('0x37')]({},_0x2a9655,_0x198577[_0xfbc0('0x39')]);var _0x4ab446={'where':_0x2a9655[_0xfbc0('0x34')]};return db[_0xfbc0('0x26')][_0xfbc0('0x1a')](_0x4ab446)[_0xfbc0('0x1f')](function(_0x536c8f){_0x5bc166[_0xfbc0('0x1a')]=_0x536c8f;if(_0x198577[_0xfbc0('0x2e')]['includeAll']){_0x2a9655[_0xfbc0('0x3a')]=[{'all':!![]}];}return db[_0xfbc0('0x26')]['findAll'](_0x2a9655);})[_0xfbc0('0x1f')](function(_0xaa335d){_0x5bc166[_0xfbc0('0x3b')]=_0xaa335d;return _0x5bc166;})[_0xfbc0('0x1f')](respondWithFilteredResult(_0x107571,_0x2a9655))['catch'](handleError(_0x107571,null));};exports[_0xfbc0('0x3c')]=function(_0x20be4d,_0x3314fb){var _0x2cdcf7={'raw':!![],'where':{'id':_0x20be4d['params']['id']}},_0x2563b6={};_0x2563b6['model']=_[_0xfbc0('0x3d')](db[_0xfbc0('0x26')]['rawAttributes']);_0x2563b6['query']=_[_0xfbc0('0x3d')](_0x20be4d[_0xfbc0('0x2e')]);_0x2563b6[_0xfbc0('0x2c')]=_[_0xfbc0('0x2d')](_0x2563b6['model'],_0x2563b6[_0xfbc0('0x2e')]);_0x2cdcf7['attributes']=_['intersection'](_0x2563b6[_0xfbc0('0x2b')],qs[_0xfbc0('0x30')](_0x20be4d[_0xfbc0('0x2e')][_0xfbc0('0x30')]));_0x2cdcf7[_0xfbc0('0x2f')]=_0x2cdcf7[_0xfbc0('0x2f')][_0xfbc0('0x31')]?_0x2cdcf7[_0xfbc0('0x2f')]:_0x2563b6['model'];if(_0x20be4d[_0xfbc0('0x2e')][_0xfbc0('0x3e')]){_0x2cdcf7[_0xfbc0('0x3a')]=[{'all':!![]}];}_0x2cdcf7=_[_0xfbc0('0x37')]({},_0x2cdcf7,_0x20be4d[_0xfbc0('0x39')]);return db[_0xfbc0('0x26')][_0xfbc0('0x3f')](_0x2cdcf7)[_0xfbc0('0x1f')](handleEntityNotFound(_0x3314fb,null))[_0xfbc0('0x1f')](respondWithResult(_0x3314fb,null))[_0xfbc0('0x40')](handleError(_0x3314fb,null));};exports['create']=function(_0x32ceae,_0x203c87){return db[_0xfbc0('0x26')][_0xfbc0('0x41')](_0x32ceae['body'],{})[_0xfbc0('0x1f')](respondWithResult(_0x203c87,0xc9))['catch'](handleError(_0x203c87,null));};exports['update']=function(_0x3647b0,_0x24a03b){if(_0x3647b0['body']['id']){delete _0x3647b0['body']['id'];}return db['OpenchannelQueueReport'][_0xfbc0('0x3f')]({'where':{'id':_0x3647b0[_0xfbc0('0x42')]['id']}})['then'](handleEntityNotFound(_0x24a03b,null))[_0xfbc0('0x1f')](saveUpdates(_0x3647b0[_0xfbc0('0x43')],null))['then'](respondWithResult(_0x24a03b,null))[_0xfbc0('0x40')](handleError(_0x24a03b,null));};exports[_0xfbc0('0x44')]=function(_0x417d65,_0xebbcf){return db['OpenchannelQueueReport']['find']({'where':{'id':_0x417d65[_0xfbc0('0x42')]['id']}})[_0xfbc0('0x1f')](handleEntityNotFound(_0xebbcf,null))[_0xfbc0('0x1f')](removeEntity(_0xebbcf,null))[_0xfbc0('0x40')](handleError(_0xebbcf,null));};exports[_0xfbc0('0x45')]=function(_0x2deb8f,_0x519cbf){return db['OpenchannelQueueReport'][_0xfbc0('0x45')]()['then'](respondWithResult(_0x519cbf,null))['catch'](handleError(_0x519cbf,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index c90534c..b3d152c 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 _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0x323d5d,_0x1e637b){var _0x343d46=function(_0x5f3e8c){while(--_0x5f3e8c){_0x323d5d['push'](_0x323d5d['shift']());}};_0x343d46(++_0x1e637b);}(_0xc4aa,0x1b7));var _0xac4a=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xc4aa[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0xa04e9a,_0x7f2b18){var _0xe370c1=function(_0x514796){while(--_0x514796){_0xa04e9a['push'](_0xa04e9a['shift']());}};_0xe370c1(++_0x7f2b18);}(_0x326f,0xd1));var _0xf326=function(_0x171c5c,_0x10faf2){_0x171c5c=_0x171c5c-0x0;var _0x4098f2=_0x326f[_0x171c5c];return _0x4098f2;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index c87389a..012ff14 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 _0x34b7=['create','body','options','raw','then','UpdateOpenchannelQueueReport','update','where','attributes','limit','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport'];(function(_0x3139e7,_0x3814ce){var _0x2a1d5d=function(_0x21c66d){while(--_0x21c66d){_0x3139e7['push'](_0x3139e7['shift']());}};_0x2a1d5d(++_0x3814ce);}(_0x34b7,0x196));var _0x734b=function(_0x13a08a,_0x52da1c){_0x13a08a=_0x13a08a-0x0;var _0x152014=_0x34b7[_0x13a08a];return _0x152014;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x734b('0x0'));var BPromise=require(_0x734b('0x1'));var rs=require(_0x734b('0x2'));var fs=require('fs');var Redis=require(_0x734b('0x3'));var db=require(_0x734b('0x4'))['db'];var utils=require(_0x734b('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x734b('0x6'));var jayson=require(_0x734b('0x7'));var client=jayson[_0x734b('0x8')][_0x734b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28918a,_0x35d685,_0x58e2f1){return new BPromise(function(_0x1eb803,_0x2e7932){return client['request'](_0x28918a,_0x58e2f1)['then'](function(_0x5f4b3a){logger[_0x734b('0xa')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x35d685,_0x734b('0xb'));logger[_0x734b('0xc')](_0x734b('0xd'),_0x35d685,_0x734b('0xb'),JSON[_0x734b('0xe')](_0x5f4b3a));if(_0x5f4b3a[_0x734b('0xf')]){if(_0x5f4b3a[_0x734b('0xf')][_0x734b('0x10')]===0x1f4){logger[_0x734b('0xf')](_0x734b('0x11'),_0x35d685,_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);return _0x2e7932(_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);}logger['error'](_0x734b('0x11'),_0x35d685,_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);return _0x1eb803(_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);}else{logger[_0x734b('0xa')](_0x734b('0x11'),_0x35d685,_0x734b('0xb'));_0x1eb803(_0x5f4b3a[_0x734b('0x13')][_0x734b('0x12')]);}})[_0x734b('0x14')](function(_0x4d2d23){logger[_0x734b('0xf')](_0x734b('0x11'),_0x35d685,_0x4d2d23);_0x2e7932(_0x4d2d23);});});}exports[_0x734b('0x15')]=function(_0x5edbe9){var _0x4d3b9c=this;return new Promise(function(_0x56a95c,_0xcd12a1){return db[_0x734b('0x16')][_0x734b('0x17')](_0x5edbe9[_0x734b('0x18')],{'raw':_0x5edbe9[_0x734b('0x19')]?_0x5edbe9[_0x734b('0x19')][_0x734b('0x1a')]===undefined?!![]:![]:!![]})[_0x734b('0x1b')](function(_0x67eed){logger[_0x734b('0xa')](_0x734b('0x15'),_0x5edbe9);logger[_0x734b('0xc')](_0x734b('0x15'),_0x5edbe9,JSON[_0x734b('0xe')](_0x67eed));_0x56a95c(_0x67eed);})['catch'](function(_0x1e4dcc){logger[_0x734b('0xf')]('CreateOpenchannelQueueReport',_0x1e4dcc[_0x734b('0x12')],_0x5edbe9);_0xcd12a1(_0x4d3b9c[_0x734b('0xf')](0x1f4,_0x1e4dcc[_0x734b('0x12')]));});});};exports[_0x734b('0x1c')]=function(_0x46d432){var _0x26d118=this;return new Promise(function(_0x26eccf,_0x104fff){return db[_0x734b('0x16')][_0x734b('0x1d')](_0x46d432[_0x734b('0x18')],{'raw':_0x46d432[_0x734b('0x19')]?_0x46d432[_0x734b('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46d432['options']?_0x46d432[_0x734b('0x19')][_0x734b('0x1e')]||null:null,'attributes':_0x46d432['options']?_0x46d432[_0x734b('0x19')][_0x734b('0x1f')]||null:null,'limit':_0x46d432[_0x734b('0x19')]?_0x46d432[_0x734b('0x19')][_0x734b('0x20')]||null:null})[_0x734b('0x1b')](function(_0x3ba39c){logger['info'](_0x734b('0x1c'),_0x46d432);logger[_0x734b('0xc')](_0x734b('0x1c'),_0x46d432,JSON[_0x734b('0xe')](_0x3ba39c));_0x26eccf(_0x3ba39c);})[_0x734b('0x14')](function(_0x427c36){logger[_0x734b('0xf')](_0x734b('0x1c'),_0x427c36[_0x734b('0x12')],_0x46d432);_0x104fff(_0x26d118[_0x734b('0xf')](0x1f4,_0x427c36['message']));});});}; \ No newline at end of file +var _0xcae2=['where','attributes','UpdateOpenchannelQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','options','raw','then','stringify','update','body'];(function(_0x46d2c7,_0x1221bd){var _0x27dd7d=function(_0x4d6509){while(--_0x4d6509){_0x46d2c7['push'](_0x46d2c7['shift']());}};_0x27dd7d(++_0x1221bd);}(_0xcae2,0x143));var _0x2cae=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcae2[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x2cae('0x0'));var util=require(_0x2cae('0x1'));var moment=require(_0x2cae('0x2'));var BPromise=require(_0x2cae('0x3'));var rs=require(_0x2cae('0x4'));var fs=require('fs');var Redis=require(_0x2cae('0x5'));var db=require(_0x2cae('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2cae('0x7'))(_0x2cae('0x8'));var config=require(_0x2cae('0x9'));var jayson=require(_0x2cae('0xa'));var client=jayson['client'][_0x2cae('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1feff6,_0x1e1a3d,_0x25b6a2){return new BPromise(function(_0x2e7498,_0x49e1d1){return client['request'](_0x1feff6,_0x25b6a2)['then'](function(_0x49f0d3){logger[_0x2cae('0xc')](_0x2cae('0xd'),_0x1e1a3d,_0x2cae('0xe'));logger[_0x2cae('0xf')](_0x2cae('0x10'),_0x1e1a3d,_0x2cae('0xe'),JSON['stringify'](_0x49f0d3));if(_0x49f0d3[_0x2cae('0x11')]){if(_0x49f0d3['error'][_0x2cae('0x12')]===0x1f4){logger[_0x2cae('0x11')](_0x2cae('0xd'),_0x1e1a3d,_0x49f0d3[_0x2cae('0x11')][_0x2cae('0x13')]);return _0x49e1d1(_0x49f0d3[_0x2cae('0x11')]['message']);}logger[_0x2cae('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x1e1a3d,_0x49f0d3[_0x2cae('0x11')][_0x2cae('0x13')]);return _0x2e7498(_0x49f0d3['error'][_0x2cae('0x13')]);}else{logger[_0x2cae('0xc')](_0x2cae('0xd'),_0x1e1a3d,_0x2cae('0xe'));_0x2e7498(_0x49f0d3['result'][_0x2cae('0x13')]);}})[_0x2cae('0x14')](function(_0x4a89e1){logger[_0x2cae('0x11')](_0x2cae('0xd'),_0x1e1a3d,_0x4a89e1);_0x49e1d1(_0x4a89e1);});});}exports[_0x2cae('0x15')]=function(_0xe6314f){var _0x2813b1=this;return new Promise(function(_0x164aee,_0x398290){return db[_0x2cae('0x16')]['create'](_0xe6314f['body'],{'raw':_0xe6314f[_0x2cae('0x17')]?_0xe6314f[_0x2cae('0x17')][_0x2cae('0x18')]===undefined?!![]:![]:!![]})[_0x2cae('0x19')](function(_0x2f4f5c){logger[_0x2cae('0xc')](_0x2cae('0x15'),_0xe6314f);logger['debug']('CreateOpenchannelQueueReport',_0xe6314f,JSON[_0x2cae('0x1a')](_0x2f4f5c));_0x164aee(_0x2f4f5c);})[_0x2cae('0x14')](function(_0x5d800e){logger['error']('CreateOpenchannelQueueReport',_0x5d800e[_0x2cae('0x13')],_0xe6314f);_0x398290(_0x2813b1[_0x2cae('0x11')](0x1f4,_0x5d800e['message']));});});};exports['UpdateOpenchannelQueueReport']=function(_0x309ae3){var _0x1c8063=this;return new Promise(function(_0x407324,_0x2fdc92){return db[_0x2cae('0x16')][_0x2cae('0x1b')](_0x309ae3[_0x2cae('0x1c')],{'raw':_0x309ae3[_0x2cae('0x17')]?_0x309ae3[_0x2cae('0x17')][_0x2cae('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x309ae3[_0x2cae('0x17')]?_0x309ae3[_0x2cae('0x17')][_0x2cae('0x1d')]||null:null,'attributes':_0x309ae3[_0x2cae('0x17')]?_0x309ae3[_0x2cae('0x17')][_0x2cae('0x1e')]||null:null,'limit':_0x309ae3['options']?_0x309ae3['options']['limit']||null:null})['then'](function(_0x7d5421){logger[_0x2cae('0xc')](_0x2cae('0x1f'),_0x309ae3);logger[_0x2cae('0xf')]('UpdateOpenchannelQueueReport',_0x309ae3,JSON[_0x2cae('0x1a')](_0x7d5421));_0x407324(_0x7d5421);})[_0x2cae('0x14')](function(_0xd53da6){logger['error'](_0x2cae('0x1f'),_0xd53da6['message'],_0x309ae3);_0x2fdc92(_0x1c8063[_0x2cae('0x11')](0x1f4,_0xd53da6['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 5bd5a4a..7a7b40b 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 _0xe3f9=['util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','/:id','post','create','put','delete','exports'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xe3f9,0xcc));var _0x9e3f=function(_0x5ab232,_0x570056){_0x5ab232=_0x5ab232-0x0;var _0x457b86=_0xe3f9[_0x5ab232];return _0x457b86;};'use strict';var multer=require('multer');var util=require(_0x9e3f('0x0'));var path=require(_0x9e3f('0x1'));var timeout=require(_0x9e3f('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9e3f('0x3'));var auth=require(_0x9e3f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9e3f('0x5'));var controller=require(_0x9e3f('0x6'));router[_0x9e3f('0x7')]('/',auth[_0x9e3f('0x8')](),controller[_0x9e3f('0x9')]);router[_0x9e3f('0x7')](_0x9e3f('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x9e3f('0x7')](_0x9e3f('0xb'),auth[_0x9e3f('0x8')](),controller['show']);router[_0x9e3f('0xc')]('/',auth[_0x9e3f('0x8')](),controller[_0x9e3f('0xd')]);router[_0x9e3f('0xe')](_0x9e3f('0xb'),auth[_0x9e3f('0x8')](),controller['update']);router[_0x9e3f('0xf')](_0x9e3f('0xb'),auth[_0x9e3f('0x8')](),controller['destroy']);module[_0x9e3f('0x10')]=router; \ No newline at end of file +var _0x1f9b=['/describe','describe','/:id','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./openchannelTransferReport.controller','get','isAuthenticated','index'];(function(_0x18bf17,_0x32626e){var _0x7c4e02=function(_0x4afbbe){while(--_0x4afbbe){_0x18bf17['push'](_0x18bf17['shift']());}};_0x7c4e02(++_0x32626e);}(_0x1f9b,0x15d));var _0xb1f9=function(_0x58ae23,_0x529357){_0x58ae23=_0x58ae23-0x0;var _0x148de4=_0x1f9b[_0x58ae23];return _0x148de4;};'use strict';var multer=require(_0xb1f9('0x0'));var util=require(_0xb1f9('0x1'));var path=require(_0xb1f9('0x2'));var timeout=require(_0xb1f9('0x3'));var express=require(_0xb1f9('0x4'));var router=express['Router']();var fs_extra=require(_0xb1f9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb1f9('0x6'));var config=require('../../config/environment');var controller=require(_0xb1f9('0x7'));router[_0xb1f9('0x8')]('/',auth[_0xb1f9('0x9')](),controller[_0xb1f9('0xa')]);router[_0xb1f9('0x8')](_0xb1f9('0xb'),auth['isAuthenticated'](),controller[_0xb1f9('0xc')]);router[_0xb1f9('0x8')](_0xb1f9('0xd'),auth[_0xb1f9('0x9')](),controller['show']);router[_0xb1f9('0xe')]('/',auth[_0xb1f9('0x9')](),controller[_0xb1f9('0xf')]);router[_0xb1f9('0x10')](_0xb1f9('0xd'),auth[_0xb1f9('0x9')](),controller[_0xb1f9('0x11')]);router[_0xb1f9('0x12')](_0xb1f9('0xd'),auth[_0xb1f9('0x9')](),controller['destroy']);module[_0xb1f9('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 05b7008..233a972 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x38f70,_0x47a0f6){var _0x81fa37=function(_0x340f57){while(--_0x340f57){_0x38f70['push'](_0x38f70['shift']());}};_0x81fa37(++_0x47a0f6);}(_0x34e8,0x12c));var _0x834e=function(_0x154069,_0x3c5aa9){_0x154069=_0x154069-0x0;var _0x51dfd7=_0x34e8[_0x154069];return _0x51dfd7;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x80d32f,_0x3dc3a0){var _0x9b142b=function(_0x2468b0){while(--_0x2468b0){_0x80d32f['push'](_0x80d32f['shift']());}};_0x9b142b(++_0x3dc3a0);}(_0xedd9,0xfc));var _0x9edd=function(_0x51746b,_0x410210){_0x51746b=_0x51746b-0x0;var _0xdd3da8=_0xedd9[_0x51746b];return _0xdd3da8;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 42f635e..1075e67 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 _0x5f4a=['util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','update','then','destroy','sendStatus','error','name','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','where','pick','filter','VIRTUAL','merge','options','OpenchannelTransferReport','includeAll','include','findAll','rows','catch','show','find','create','params','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x13ccdf,_0x5e1d0b){var _0xb21bbd=function(_0x69f266){while(--_0x69f266){_0x13ccdf['push'](_0x13ccdf['shift']());}};_0xb21bbd(++_0x5e1d0b);}(_0x5f4a,0xdc));var _0xa5f4=function(_0x5b443a,_0x2a05d3){_0x5b443a=_0x5b443a-0x0;var _0x48c3a5=_0x5f4a[_0x5b443a];return _0x48c3a5;};'use strict';var emlformat=require(_0xa5f4('0x0'));var rimraf=require(_0xa5f4('0x1'));var zipdir=require(_0xa5f4('0x2'));var jsonpatch=require(_0xa5f4('0x3'));var rp=require(_0xa5f4('0x4'));var moment=require(_0xa5f4('0x5'));var BPromise=require(_0xa5f4('0x6'));var Mustache=require(_0xa5f4('0x7'));var util=require(_0xa5f4('0x8'));var path=require(_0xa5f4('0x9'));var sox=require(_0xa5f4('0xa'));var csv=require(_0xa5f4('0xb'));var ejs=require(_0xa5f4('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa5f4('0xd'));var squel=require(_0xa5f4('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa5f4('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa5f4('0x10'));var Papa=require('papaparse');var Redis=require(_0xa5f4('0x11'));var authService=require(_0xa5f4('0x12'));var qs=require(_0xa5f4('0x13'));var as=require(_0xa5f4('0x14'));var hardwareService=require(_0xa5f4('0x15'));var logger=require(_0xa5f4('0x16'))(_0xa5f4('0x17'));var utils=require(_0xa5f4('0x18'));var config=require(_0xa5f4('0x19'));var licenseUtil=require(_0xa5f4('0x1a'));var db=require(_0xa5f4('0x1b'))['db'];function respondWithStatusCode(_0x448706,_0x1ceae0){_0x1ceae0=_0x1ceae0||0xcc;return function(_0x500a8c){if(_0x500a8c){return _0x448706['sendStatus'](_0x1ceae0);}return _0x448706[_0xa5f4('0x1c')](_0x1ceae0)[_0xa5f4('0x1d')]();};}function respondWithResult(_0x529a9b,_0x23f25e){_0x23f25e=_0x23f25e||0xc8;return function(_0x30abb2){if(_0x30abb2){return _0x529a9b['status'](_0x23f25e)[_0xa5f4('0x1e')](_0x30abb2);}};}function respondWithFilteredResult(_0x3cbd09,_0x48922e){return function(_0x2577f8){if(_0x2577f8){var _0x3d4a97=typeof _0x48922e[_0xa5f4('0x1f')]===_0xa5f4('0x20')&&typeof _0x48922e['limit']===_0xa5f4('0x20');var _0x3035bd=_0x2577f8[_0xa5f4('0x21')];var _0x1c74ac=_0x3d4a97?0x0:_0x48922e[_0xa5f4('0x1f')];var _0x3c4254=_0x3d4a97?_0x2577f8['count']:_0x48922e[_0xa5f4('0x1f')]+_0x48922e[_0xa5f4('0x22')];var _0x254387;if(_0x3c4254>=_0x3035bd){_0x3c4254=_0x3035bd;_0x254387=0xc8;}else{_0x254387=0xce;}_0x3cbd09[_0xa5f4('0x1c')](_0x254387);return _0x3cbd09[_0xa5f4('0x23')]('Content-Range',_0x1c74ac+'-'+_0x3c4254+'/'+_0x3035bd)[_0xa5f4('0x1e')](_0x2577f8);}return null;};}function patchUpdates(_0xe75a7){return function(_0x200537){try{jsonpatch[_0xa5f4('0x24')](_0x200537,_0xe75a7,!![]);}catch(_0x1f1309){return BPromise['reject'](_0x1f1309);}return _0x200537['save']();};}function saveUpdates(_0x2326e7,_0x5d3cc2){return function(_0x4a2bbc){if(_0x4a2bbc){return _0x4a2bbc[_0xa5f4('0x25')](_0x2326e7)[_0xa5f4('0x26')](function(_0x547e85){return _0x547e85;});}return null;};}function removeEntity(_0x39e5ce,_0x12478d){return function(_0x3eecee){if(_0x3eecee){return _0x3eecee[_0xa5f4('0x27')]()[_0xa5f4('0x26')](function(){_0x39e5ce['status'](0xcc)[_0xa5f4('0x1d')]();});}};}function handleEntityNotFound(_0x3a8b26,_0xb79465){return function(_0x58b9ed){if(!_0x58b9ed){_0x3a8b26[_0xa5f4('0x28')](0x194);}return _0x58b9ed;};}function handleError(_0x450b14,_0x1dddf5){_0x1dddf5=_0x1dddf5||0x1f4;return function(_0x5218ad){logger[_0xa5f4('0x29')](_0x5218ad['stack']);if(_0x5218ad['name']){delete _0x5218ad[_0xa5f4('0x2a')];}_0x450b14['status'](_0x1dddf5)['send'](_0x5218ad);};}exports[_0xa5f4('0x2b')]=function(_0x18ba6a,_0x476bdf){var _0x18fdec={},_0x308969={},_0x437b34={'count':0x0,'rows':[]};var _0x2097b1=_[_0xa5f4('0x2c')](db['OpenchannelTransferReport'][_0xa5f4('0x2d')],function(_0x1f3c3d){return{'name':_0x1f3c3d['fieldName'],'type':_0x1f3c3d[_0xa5f4('0x2e')][_0xa5f4('0x2f')]};});_0x308969[_0xa5f4('0x30')]=_['map'](_0x2097b1,'name');_0x308969[_0xa5f4('0x31')]=_[_0xa5f4('0x32')](_0x18ba6a[_0xa5f4('0x31')]);_0x308969[_0xa5f4('0x33')]=_[_0xa5f4('0x34')](_0x308969[_0xa5f4('0x30')],_0x308969[_0xa5f4('0x31')]);_0x18fdec[_0xa5f4('0x35')]=_[_0xa5f4('0x34')](_0x308969[_0xa5f4('0x30')],qs['fields'](_0x18ba6a[_0xa5f4('0x31')][_0xa5f4('0x36')]));_0x18fdec[_0xa5f4('0x35')]=_0x18fdec[_0xa5f4('0x35')][_0xa5f4('0x37')]?_0x18fdec['attributes']:_0x308969[_0xa5f4('0x30')];if(!_0x18ba6a[_0xa5f4('0x31')]['hasOwnProperty'](_0xa5f4('0x38'))){_0x18fdec[_0xa5f4('0x22')]=qs[_0xa5f4('0x22')](_0x18ba6a[_0xa5f4('0x31')]['limit']);_0x18fdec[_0xa5f4('0x1f')]=qs[_0xa5f4('0x1f')](_0x18ba6a[_0xa5f4('0x31')][_0xa5f4('0x1f')]);}_0x18fdec[_0xa5f4('0x39')]=qs['sort'](_0x18ba6a[_0xa5f4('0x31')]['sort']);_0x18fdec[_0xa5f4('0x3a')]=qs['filters'](_[_0xa5f4('0x3b')](_0x18ba6a[_0xa5f4('0x31')],_0x308969[_0xa5f4('0x33')]),_0x2097b1);if(_0x18ba6a[_0xa5f4('0x31')][_0xa5f4('0x3c')]){_0x18fdec['where']=_['merge'](_0x18fdec[_0xa5f4('0x3a')],{'$or':_[_0xa5f4('0x2c')](_0x2097b1,function(_0x695afb){if(_0x695afb['type']!==_0xa5f4('0x3d')){var _0x580772={};_0x580772[_0x695afb[_0xa5f4('0x2a')]]={'$like':'%'+_0x18ba6a[_0xa5f4('0x31')][_0xa5f4('0x3c')]+'%'};return _0x580772;}})});}_0x18fdec=_[_0xa5f4('0x3e')]({},_0x18fdec,_0x18ba6a[_0xa5f4('0x3f')]);var _0x2f7861={'where':_0x18fdec[_0xa5f4('0x3a')]};return db[_0xa5f4('0x40')][_0xa5f4('0x21')](_0x2f7861)[_0xa5f4('0x26')](function(_0x16881e){_0x437b34[_0xa5f4('0x21')]=_0x16881e;if(_0x18ba6a[_0xa5f4('0x31')][_0xa5f4('0x41')]){_0x18fdec[_0xa5f4('0x42')]=[{'all':!![]}];}return db[_0xa5f4('0x40')][_0xa5f4('0x43')](_0x18fdec);})[_0xa5f4('0x26')](function(_0x29b159){_0x437b34[_0xa5f4('0x44')]=_0x29b159;return _0x437b34;})[_0xa5f4('0x26')](respondWithFilteredResult(_0x476bdf,_0x18fdec))[_0xa5f4('0x45')](handleError(_0x476bdf,null));};exports[_0xa5f4('0x46')]=function(_0x1df73a,_0x31b6fa){var _0x37a092={'raw':!![],'where':{'id':_0x1df73a['params']['id']}},_0x14a6da={};_0x14a6da['model']=_[_0xa5f4('0x32')](db['OpenchannelTransferReport'][_0xa5f4('0x2d')]);_0x14a6da[_0xa5f4('0x31')]=_[_0xa5f4('0x32')](_0x1df73a[_0xa5f4('0x31')]);_0x14a6da[_0xa5f4('0x33')]=_['intersection'](_0x14a6da[_0xa5f4('0x30')],_0x14a6da['query']);_0x37a092['attributes']=_['intersection'](_0x14a6da['model'],qs[_0xa5f4('0x36')](_0x1df73a[_0xa5f4('0x31')]['fields']));_0x37a092[_0xa5f4('0x35')]=_0x37a092[_0xa5f4('0x35')][_0xa5f4('0x37')]?_0x37a092[_0xa5f4('0x35')]:_0x14a6da['model'];if(_0x1df73a[_0xa5f4('0x31')][_0xa5f4('0x41')]){_0x37a092[_0xa5f4('0x42')]=[{'all':!![]}];}_0x37a092=_['merge']({},_0x37a092,_0x1df73a[_0xa5f4('0x3f')]);return db[_0xa5f4('0x40')][_0xa5f4('0x47')](_0x37a092)[_0xa5f4('0x26')](handleEntityNotFound(_0x31b6fa,null))[_0xa5f4('0x26')](respondWithResult(_0x31b6fa,null))[_0xa5f4('0x45')](handleError(_0x31b6fa,null));};exports[_0xa5f4('0x48')]=function(_0x3fb948,_0x368240){return db['OpenchannelTransferReport'][_0xa5f4('0x48')](_0x3fb948['body'],{})[_0xa5f4('0x26')](respondWithResult(_0x368240,0xc9))[_0xa5f4('0x45')](handleError(_0x368240,null));};exports[_0xa5f4('0x25')]=function(_0x2f985f,_0x2556dc){if(_0x2f985f['body']['id']){delete _0x2f985f['body']['id'];}return db[_0xa5f4('0x40')]['find']({'where':{'id':_0x2f985f[_0xa5f4('0x49')]['id']}})[_0xa5f4('0x26')](handleEntityNotFound(_0x2556dc,null))[_0xa5f4('0x26')](saveUpdates(_0x2f985f[_0xa5f4('0x4a')],null))[_0xa5f4('0x26')](respondWithResult(_0x2556dc,null))[_0xa5f4('0x45')](handleError(_0x2556dc,null));};exports[_0xa5f4('0x27')]=function(_0x120959,_0x30cb87){return db[_0xa5f4('0x40')]['find']({'where':{'id':_0x120959['params']['id']}})[_0xa5f4('0x26')](handleEntityNotFound(_0x30cb87,null))['then'](removeEntity(_0x30cb87,null))[_0xa5f4('0x45')](handleError(_0x30cb87,null));};exports[_0xa5f4('0x4b')]=function(_0x5431e2,_0x52ba00){return db['OpenchannelTransferReport'][_0xa5f4('0x4b')]()['then'](respondWithResult(_0x52ba00,null))['catch'](handleError(_0x52ba00,null));}; \ No newline at end of file +var _0xe07f=['find','create','body','update','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','save','then','destroy','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','options','include','findAll','rows','catch','show','keys','length','includeAll','merge'];(function(_0x325f77,_0x5cd6d6){var _0x10670d=function(_0x3d4a3f){while(--_0x3d4a3f){_0x325f77['push'](_0x325f77['shift']());}};_0x10670d(++_0x5cd6d6);}(_0xe07f,0x9e));var _0xfe07=function(_0x167718,_0x31786c){_0x167718=_0x167718-0x0;var _0x4ecee8=_0xe07f[_0x167718];return _0x4ecee8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfe07('0x0'));var zipdir=require(_0xfe07('0x1'));var jsonpatch=require(_0xfe07('0x2'));var rp=require(_0xfe07('0x3'));var moment=require('moment');var BPromise=require(_0xfe07('0x4'));var Mustache=require(_0xfe07('0x5'));var util=require(_0xfe07('0x6'));var path=require(_0xfe07('0x7'));var sox=require(_0xfe07('0x8'));var csv=require('to-csv');var ejs=require(_0xfe07('0x9'));var fs=require('fs');var fs_extra=require(_0xfe07('0xa'));var _=require(_0xfe07('0xb'));var squel=require(_0xfe07('0xc'));var crypto=require('crypto');var jsforce=require(_0xfe07('0xd'));var deskjs=require(_0xfe07('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfe07('0xf'));var Redis=require('ioredis');var authService=require(_0xfe07('0x10'));var qs=require(_0xfe07('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfe07('0x12'))(_0xfe07('0x13'));var utils=require('../../config/utils');var config=require(_0xfe07('0x14'));var licenseUtil=require(_0xfe07('0x15'));var db=require(_0xfe07('0x16'))['db'];function respondWithStatusCode(_0x398951,_0x5826fd){_0x5826fd=_0x5826fd||0xcc;return function(_0x5584a4){if(_0x5584a4){return _0x398951[_0xfe07('0x17')](_0x5826fd);}return _0x398951[_0xfe07('0x18')](_0x5826fd)[_0xfe07('0x19')]();};}function respondWithResult(_0x1dbb71,_0x3c1be3){_0x3c1be3=_0x3c1be3||0xc8;return function(_0xc02e8a){if(_0xc02e8a){return _0x1dbb71['status'](_0x3c1be3)[_0xfe07('0x1a')](_0xc02e8a);}};}function respondWithFilteredResult(_0x1217ac,_0xa2e5e2){return function(_0x59c871){if(_0x59c871){var _0x5815c7=typeof _0xa2e5e2['offset']==='undefined'&&typeof _0xa2e5e2[_0xfe07('0x1b')]===_0xfe07('0x1c');var _0x28d312=_0x59c871[_0xfe07('0x1d')];var _0x23c060=_0x5815c7?0x0:_0xa2e5e2[_0xfe07('0x1e')];var _0x732382=_0x5815c7?_0x59c871[_0xfe07('0x1d')]:_0xa2e5e2[_0xfe07('0x1e')]+_0xa2e5e2[_0xfe07('0x1b')];var _0x277a52;if(_0x732382>=_0x28d312){_0x732382=_0x28d312;_0x277a52=0xc8;}else{_0x277a52=0xce;}_0x1217ac[_0xfe07('0x18')](_0x277a52);return _0x1217ac[_0xfe07('0x1f')]('Content-Range',_0x23c060+'-'+_0x732382+'/'+_0x28d312)[_0xfe07('0x1a')](_0x59c871);}return null;};}function patchUpdates(_0x58462f){return function(_0x293db6){try{jsonpatch[_0xfe07('0x20')](_0x293db6,_0x58462f,!![]);}catch(_0x55312b){return BPromise['reject'](_0x55312b);}return _0x293db6[_0xfe07('0x21')]();};}function saveUpdates(_0x22c090,_0x28f5f2){return function(_0x4b507f){if(_0x4b507f){return _0x4b507f['update'](_0x22c090)[_0xfe07('0x22')](function(_0x270479){return _0x270479;});}return null;};}function removeEntity(_0x1aebb4,_0x48cda9){return function(_0x255592){if(_0x255592){return _0x255592[_0xfe07('0x23')]()[_0xfe07('0x22')](function(){_0x1aebb4['status'](0xcc)[_0xfe07('0x19')]();});}};}function handleEntityNotFound(_0x4e2d25,_0x14da4e){return function(_0x51dcc7){if(!_0x51dcc7){_0x4e2d25[_0xfe07('0x17')](0x194);}return _0x51dcc7;};}function handleError(_0x9e9049,_0x1e363f){_0x1e363f=_0x1e363f||0x1f4;return function(_0x42492d){logger[_0xfe07('0x24')](_0x42492d[_0xfe07('0x25')]);if(_0x42492d[_0xfe07('0x26')]){delete _0x42492d[_0xfe07('0x26')];}_0x9e9049[_0xfe07('0x18')](_0x1e363f)[_0xfe07('0x27')](_0x42492d);};}exports[_0xfe07('0x28')]=function(_0x57a94c,_0x37abf1){var _0x56088e={},_0x3e867b={},_0x402444={'count':0x0,'rows':[]};var _0x4db60d=_[_0xfe07('0x29')](db[_0xfe07('0x2a')][_0xfe07('0x2b')],function(_0x403af9){return{'name':_0x403af9[_0xfe07('0x2c')],'type':_0x403af9[_0xfe07('0x2d')][_0xfe07('0x2e')]};});_0x3e867b[_0xfe07('0x2f')]=_[_0xfe07('0x29')](_0x4db60d,_0xfe07('0x26'));_0x3e867b[_0xfe07('0x30')]=_['keys'](_0x57a94c[_0xfe07('0x30')]);_0x3e867b[_0xfe07('0x31')]=_[_0xfe07('0x32')](_0x3e867b[_0xfe07('0x2f')],_0x3e867b[_0xfe07('0x30')]);_0x56088e[_0xfe07('0x33')]=_[_0xfe07('0x32')](_0x3e867b[_0xfe07('0x2f')],qs[_0xfe07('0x34')](_0x57a94c['query'][_0xfe07('0x34')]));_0x56088e[_0xfe07('0x33')]=_0x56088e[_0xfe07('0x33')]['length']?_0x56088e[_0xfe07('0x33')]:_0x3e867b[_0xfe07('0x2f')];if(!_0x57a94c[_0xfe07('0x30')][_0xfe07('0x35')](_0xfe07('0x36'))){_0x56088e[_0xfe07('0x1b')]=qs['limit'](_0x57a94c[_0xfe07('0x30')]['limit']);_0x56088e[_0xfe07('0x1e')]=qs[_0xfe07('0x1e')](_0x57a94c[_0xfe07('0x30')][_0xfe07('0x1e')]);}_0x56088e['order']=qs[_0xfe07('0x37')](_0x57a94c['query']['sort']);_0x56088e[_0xfe07('0x38')]=qs[_0xfe07('0x31')](_[_0xfe07('0x39')](_0x57a94c[_0xfe07('0x30')],_0x3e867b[_0xfe07('0x31')]),_0x4db60d);if(_0x57a94c['query']['filter']){_0x56088e[_0xfe07('0x38')]=_['merge'](_0x56088e['where'],{'$or':_[_0xfe07('0x29')](_0x4db60d,function(_0x5e8eab){if(_0x5e8eab[_0xfe07('0x2d')]!==_0xfe07('0x3a')){var _0x6853a1={};_0x6853a1[_0x5e8eab[_0xfe07('0x26')]]={'$like':'%'+_0x57a94c[_0xfe07('0x30')][_0xfe07('0x3b')]+'%'};return _0x6853a1;}})});}_0x56088e=_['merge']({},_0x56088e,_0x57a94c[_0xfe07('0x3c')]);var _0x76fa69={'where':_0x56088e[_0xfe07('0x38')]};return db['OpenchannelTransferReport'][_0xfe07('0x1d')](_0x76fa69)[_0xfe07('0x22')](function(_0x394de4){_0x402444['count']=_0x394de4;if(_0x57a94c[_0xfe07('0x30')]['includeAll']){_0x56088e[_0xfe07('0x3d')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0xfe07('0x3e')](_0x56088e);})['then'](function(_0xfa9cbc){_0x402444[_0xfe07('0x3f')]=_0xfa9cbc;return _0x402444;})[_0xfe07('0x22')](respondWithFilteredResult(_0x37abf1,_0x56088e))[_0xfe07('0x40')](handleError(_0x37abf1,null));};exports[_0xfe07('0x41')]=function(_0x5e489a,_0x5950c6){var _0x34b241={'raw':!![],'where':{'id':_0x5e489a['params']['id']}},_0x3aa2c9={};_0x3aa2c9[_0xfe07('0x2f')]=_['keys'](db[_0xfe07('0x2a')][_0xfe07('0x2b')]);_0x3aa2c9[_0xfe07('0x30')]=_[_0xfe07('0x42')](_0x5e489a['query']);_0x3aa2c9[_0xfe07('0x31')]=_[_0xfe07('0x32')](_0x3aa2c9[_0xfe07('0x2f')],_0x3aa2c9[_0xfe07('0x30')]);_0x34b241[_0xfe07('0x33')]=_[_0xfe07('0x32')](_0x3aa2c9[_0xfe07('0x2f')],qs[_0xfe07('0x34')](_0x5e489a[_0xfe07('0x30')]['fields']));_0x34b241[_0xfe07('0x33')]=_0x34b241['attributes'][_0xfe07('0x43')]?_0x34b241[_0xfe07('0x33')]:_0x3aa2c9['model'];if(_0x5e489a[_0xfe07('0x30')][_0xfe07('0x44')]){_0x34b241[_0xfe07('0x3d')]=[{'all':!![]}];}_0x34b241=_[_0xfe07('0x45')]({},_0x34b241,_0x5e489a[_0xfe07('0x3c')]);return db[_0xfe07('0x2a')][_0xfe07('0x46')](_0x34b241)[_0xfe07('0x22')](handleEntityNotFound(_0x5950c6,null))[_0xfe07('0x22')](respondWithResult(_0x5950c6,null))[_0xfe07('0x40')](handleError(_0x5950c6,null));};exports[_0xfe07('0x47')]=function(_0x314dc1,_0x590405){return db[_0xfe07('0x2a')][_0xfe07('0x47')](_0x314dc1[_0xfe07('0x48')],{})[_0xfe07('0x22')](respondWithResult(_0x590405,0xc9))['catch'](handleError(_0x590405,null));};exports[_0xfe07('0x49')]=function(_0x1bdcea,_0x50bf40){if(_0x1bdcea[_0xfe07('0x48')]['id']){delete _0x1bdcea[_0xfe07('0x48')]['id'];}return db[_0xfe07('0x2a')][_0xfe07('0x46')]({'where':{'id':_0x1bdcea[_0xfe07('0x4a')]['id']}})[_0xfe07('0x22')](handleEntityNotFound(_0x50bf40,null))[_0xfe07('0x22')](saveUpdates(_0x1bdcea[_0xfe07('0x48')],null))[_0xfe07('0x22')](respondWithResult(_0x50bf40,null))[_0xfe07('0x40')](handleError(_0x50bf40,null));};exports[_0xfe07('0x23')]=function(_0x3c7c7e,_0x35f247){return db[_0xfe07('0x2a')][_0xfe07('0x46')]({'where':{'id':_0x3c7c7e['params']['id']}})['then'](handleEntityNotFound(_0x35f247,null))[_0xfe07('0x22')](removeEntity(_0x35f247,null))[_0xfe07('0x40')](handleError(_0x35f247,null));};exports[_0xfe07('0x4b')]=function(_0xfa1537,_0x380681){return db['OpenchannelTransferReport'][_0xfe07('0x4b')]()[_0xfe07('0x22')](respondWithResult(_0x380681,null))[_0xfe07('0x40')](handleError(_0x380681,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 8521e6d..2d7595a 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 _0xff0e=['exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./openchannelTransferReport.attributes'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xff0e,0x83));var _0xeff0=function(_0x4df977,_0x4a6323){_0x4df977=_0x4df977-0x0;var _0x4d29b2=_0xff0e[_0x4df977];return _0x4d29b2;};'use strict';var _=require(_0xeff0('0x0'));var util=require(_0xeff0('0x1'));var logger=require(_0xeff0('0x2'))(_0xeff0('0x3'));var moment=require(_0xeff0('0x4'));var BPromise=require('bluebird');var rp=require(_0xeff0('0x5'));var fs=require('fs');var path=require(_0xeff0('0x6'));var rimraf=require(_0xeff0('0x7'));var config=require('../../config/environment');var attributes=require(_0xeff0('0x8'));module[_0xeff0('0x9')]=function(_0x52d93f,_0x337b48){return _0x52d93f[_0xeff0('0xa')](_0xeff0('0xb'),attributes,{'tableName':_0xeff0('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xeff0('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2eb0=['request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','OpenchannelTransferReport','uniqueid','lodash','util','api','moment','bluebird'];(function(_0x15aa14,_0x3dba61){var _0x5a8557=function(_0x1fcae6){while(--_0x1fcae6){_0x15aa14['push'](_0x15aa14['shift']());}};_0x5a8557(++_0x3dba61);}(_0x2eb0,0x19b));var _0x02eb=function(_0x33a04b,_0x3facd7){_0x33a04b=_0x33a04b-0x0;var _0x45351c=_0x2eb0[_0x33a04b];return _0x45351c;};'use strict';var _=require(_0x02eb('0x0'));var util=require(_0x02eb('0x1'));var logger=require('../../config/logger')(_0x02eb('0x2'));var moment=require(_0x02eb('0x3'));var BPromise=require(_0x02eb('0x4'));var rp=require(_0x02eb('0x5'));var fs=require('fs');var path=require(_0x02eb('0x6'));var rimraf=require(_0x02eb('0x7'));var config=require(_0x02eb('0x8'));var attributes=require(_0x02eb('0x9'));module[_0x02eb('0xa')]=function(_0x365e33,_0x1ff26d){return _0x365e33['define'](_0x02eb('0xb'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x02eb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 7c0ca72..e30051a 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 _0xa6bb=['util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch'];(function(_0x508786,_0x316536){var _0x2adda2=function(_0x311474){while(--_0x311474){_0x508786['push'](_0x508786['shift']());}};_0x2adda2(++_0x316536);}(_0xa6bb,0x12c));var _0xba6b=function(_0x537c35,_0x3a03f8){_0x537c35=_0x537c35-0x0;var _0xc11ee1=_0xa6bb[_0x537c35];return _0xc11ee1;};'use strict';var _=require('lodash');var util=require(_0xba6b('0x0'));var moment=require(_0xba6b('0x1'));var BPromise=require(_0xba6b('0x2'));var rs=require(_0xba6b('0x3'));var fs=require('fs');var Redis=require(_0xba6b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xba6b('0x5'))(_0xba6b('0x6'));var config=require(_0xba6b('0x7'));var jayson=require(_0xba6b('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2a00d6,_0x4f6c6c,_0x2f305e){return new BPromise(function(_0x5506d6,_0x55f5c3){return client[_0xba6b('0x9')](_0x2a00d6,_0x2f305e)[_0xba6b('0xa')](function(_0x2cab30){logger[_0xba6b('0xb')](_0xba6b('0xc'),_0x4f6c6c,'request\x20sent');logger[_0xba6b('0xd')](_0xba6b('0xe'),_0x4f6c6c,_0xba6b('0xf'),JSON['stringify'](_0x2cab30));if(_0x2cab30[_0xba6b('0x10')]){if(_0x2cab30[_0xba6b('0x10')][_0xba6b('0x11')]===0x1f4){logger[_0xba6b('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4f6c6c,_0x2cab30[_0xba6b('0x10')]['message']);return _0x55f5c3(_0x2cab30[_0xba6b('0x10')][_0xba6b('0x12')]);}logger[_0xba6b('0x10')](_0xba6b('0xc'),_0x4f6c6c,_0x2cab30[_0xba6b('0x10')]['message']);return _0x5506d6(_0x2cab30[_0xba6b('0x10')][_0xba6b('0x12')]);}else{logger['info'](_0xba6b('0xc'),_0x4f6c6c,_0xba6b('0xf'));_0x5506d6(_0x2cab30['result']['message']);}})[_0xba6b('0x13')](function(_0x5b32cd){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x4f6c6c,_0x5b32cd);_0x55f5c3(_0x5b32cd);});});} \ No newline at end of file +var _0x56e7=['client','http','request','then','info','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4d2938,_0x332d65){var _0x5e7d9b=function(_0x135e24){while(--_0x135e24){_0x4d2938['push'](_0x4d2938['shift']());}};_0x5e7d9b(++_0x332d65);}(_0x56e7,0x7b));var _0x756e=function(_0x1f9f5b,_0x90f0f5){_0x1f9f5b=_0x1f9f5b-0x0;var _0x128a57=_0x56e7[_0x1f9f5b];return _0x128a57;};'use strict';var _=require('lodash');var util=require(_0x756e('0x0'));var moment=require(_0x756e('0x1'));var BPromise=require('bluebird');var rs=require(_0x756e('0x2'));var fs=require('fs');var Redis=require(_0x756e('0x3'));var db=require(_0x756e('0x4'))['db'];var utils=require(_0x756e('0x5'));var logger=require(_0x756e('0x6'))(_0x756e('0x7'));var config=require(_0x756e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x756e('0x9')][_0x756e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26519d,_0xcf58ec,_0x5c8589){return new BPromise(function(_0x1c6a22,_0x5c2db4){return client[_0x756e('0xb')](_0x26519d,_0x5c8589)[_0x756e('0xc')](function(_0x313d92){logger[_0x756e('0xd')]('OpenchannelTransferReport,\x20%s,\x20%s',_0xcf58ec,'request\x20sent');logger[_0x756e('0xe')](_0x756e('0xf'),_0xcf58ec,_0x756e('0x10'),JSON['stringify'](_0x313d92));if(_0x313d92[_0x756e('0x11')]){if(_0x313d92[_0x756e('0x11')]['code']===0x1f4){logger['error'](_0x756e('0x12'),_0xcf58ec,_0x313d92['error'][_0x756e('0x13')]);return _0x5c2db4(_0x313d92[_0x756e('0x11')][_0x756e('0x13')]);}logger[_0x756e('0x11')](_0x756e('0x12'),_0xcf58ec,_0x313d92['error']['message']);return _0x1c6a22(_0x313d92[_0x756e('0x11')][_0x756e('0x13')]);}else{logger[_0x756e('0xd')]('OpenchannelTransferReport,\x20%s,\x20%s',_0xcf58ec,'request\x20sent');_0x1c6a22(_0x313d92[_0x756e('0x14')][_0x756e('0x13')]);}})[_0x756e('0x15')](function(_0x296b14){logger[_0x756e('0x11')](_0x756e('0x12'),_0xcf58ec,_0x296b14);_0x5c2db4(_0x296b14);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 22efaa3..e728d29 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 _0xb2d8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','post','put','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x26bccc,_0x41c890){var _0x52321e=function(_0x508b79){while(--_0x508b79){_0x26bccc['push'](_0x26bccc['shift']());}};_0x52321e(++_0x41c890);}(_0xb2d8,0x80));var _0x8b2d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb2d8[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8b2d('0x0'));var util=require(_0x8b2d('0x1'));var path=require('path');var timeout=require(_0x8b2d('0x2'));var express=require(_0x8b2d('0x3'));var router=express[_0x8b2d('0x4')]();var fs_extra=require(_0x8b2d('0x5'));var auth=require(_0x8b2d('0x6'));var interaction=require(_0x8b2d('0x7'));var config=require(_0x8b2d('0x8'));var controller=require(_0x8b2d('0x9'));router[_0x8b2d('0xa')]('/',auth[_0x8b2d('0xb')](),controller[_0x8b2d('0xc')]);router[_0x8b2d('0xa')](_0x8b2d('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x8b2d('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8b2d('0xf')]('/:id',auth[_0x8b2d('0xb')](),controller['update']);router[_0x8b2d('0x10')](_0x8b2d('0xd'),auth[_0x8b2d('0xb')](),controller[_0x8b2d('0x11')]);module[_0x8b2d('0x12')]=router; \ No newline at end of file +var _0xb789=['./pause.controller','index','get','/:id','show','isAuthenticated','put','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x525d35,_0xe67489){var _0x4813d2=function(_0x4a6dc8){while(--_0x4a6dc8){_0x525d35['push'](_0x525d35['shift']());}};_0x4813d2(++_0xe67489);}(_0xb789,0xc7));var _0x9b78=function(_0x5b58e7,_0xb6f5fa){_0x5b58e7=_0x5b58e7-0x0;var _0x165e65=_0xb789[_0x5b58e7];return _0x165e65;};'use strict';var multer=require('multer');var util=require(_0x9b78('0x0'));var path=require(_0x9b78('0x1'));var timeout=require(_0x9b78('0x2'));var express=require(_0x9b78('0x3'));var router=express[_0x9b78('0x4')]();var fs_extra=require(_0x9b78('0x5'));var auth=require(_0x9b78('0x6'));var interaction=require(_0x9b78('0x7'));var config=require(_0x9b78('0x8'));var controller=require(_0x9b78('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x9b78('0xa')]);router[_0x9b78('0xb')](_0x9b78('0xc'),auth['isAuthenticated'](),controller[_0x9b78('0xd')]);router['post']('/',auth[_0x9b78('0xe')](),controller['create']);router[_0x9b78('0xf')](_0x9b78('0xc'),auth[_0x9b78('0xe')](),controller['update']);router['delete'](_0x9b78('0xc'),auth[_0x9b78('0xe')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index bf34cdd..fddf9e3 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 _0x4f83=['STRING','sequelize','exports'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x4f83,0x17b));var _0x34f8=function(_0x1f47c2,_0x1f8d9b){_0x1f47c2=_0x1f47c2-0x0;var _0x4e9108=_0x4f83[_0x1f47c2];return _0x4e9108;};'use strict';var Sequelize=require(_0x34f8('0x0'));module[_0x34f8('0x1')]={'name':{'type':Sequelize[_0x34f8('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x34f8('0x2')]}}; \ No newline at end of file +var _0xc432=['exports','name','sequelize'];(function(_0x466e4e,_0x1064a8){var _0x36d32b=function(_0x2687e7){while(--_0x2687e7){_0x466e4e['push'](_0x466e4e['shift']());}};_0x36d32b(++_0x1064a8);}(_0xc432,0xfe));var _0x2c43=function(_0x1a03c3,_0x1ff815){_0x1a03c3=_0x1a03c3-0x0;var _0x130bcb=_0xc432[_0x1a03c3];return _0x130bcb;};'use strict';var Sequelize=require(_0x2c43('0x0'));module[_0x2c43('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2c43('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 9639197..ff0515f 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 _0x297f=['user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','reject','update','then','destroy','get','Pauses','UserProfileResource','error','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','options','include','show','params','length','includeAll','merge','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x1dde0d,_0x51f536){var _0x35fda6=function(_0x10eebc){while(--_0x10eebc){_0x1dde0d['push'](_0x1dde0d['shift']());}};_0x35fda6(++_0x51f536);}(_0x297f,0x195));var _0xf297=function(_0x2a49e9,_0x5e9a57){_0x2a49e9=_0x2a49e9-0x0;var _0x24e043=_0x297f[_0x2a49e9];return _0x24e043;};'use strict';var emlformat=require(_0xf297('0x0'));var rimraf=require(_0xf297('0x1'));var zipdir=require(_0xf297('0x2'));var jsonpatch=require(_0xf297('0x3'));var rp=require(_0xf297('0x4'));var moment=require(_0xf297('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xf297('0x6'));var csv=require(_0xf297('0x7'));var ejs=require(_0xf297('0x8'));var fs=require('fs');var fs_extra=require(_0xf297('0x9'));var _=require('lodash');var squel=require(_0xf297('0xa'));var crypto=require('crypto');var jsforce=require(_0xf297('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf297('0x7'));var querystring=require(_0xf297('0xc'));var Papa=require(_0xf297('0xd'));var Redis=require(_0xf297('0xe'));var authService=require(_0xf297('0xf'));var qs=require(_0xf297('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf297('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xf297('0x12'));var config=require(_0xf297('0x13'));var licenseUtil=require(_0xf297('0x14'));var db=require(_0xf297('0x15'))['db'];function respondWithStatusCode(_0x4a31b4,_0x5298be){_0x5298be=_0x5298be||0xcc;return function(_0x5e2fe8){if(_0x5e2fe8){return _0x4a31b4[_0xf297('0x16')](_0x5298be);}return _0x4a31b4[_0xf297('0x17')](_0x5298be)[_0xf297('0x18')]();};}function respondWithResult(_0x4bf0b5,_0x5383d9){_0x5383d9=_0x5383d9||0xc8;return function(_0x10a613){if(_0x10a613){return _0x4bf0b5[_0xf297('0x17')](_0x5383d9)[_0xf297('0x19')](_0x10a613);}};}function respondWithFilteredResult(_0x345d22,_0x417f3b){return function(_0x28f240){if(_0x28f240){var _0x5e35af=typeof _0x417f3b['offset']===_0xf297('0x1a')&&typeof _0x417f3b['limit']===_0xf297('0x1a');var _0x5edfb0=_0x28f240[_0xf297('0x1b')];var _0x23b812=_0x5e35af?0x0:_0x417f3b['offset'];var _0x579a0c=_0x5e35af?_0x28f240['count']:_0x417f3b[_0xf297('0x1c')]+_0x417f3b['limit'];var _0x1527dd;if(_0x579a0c>=_0x5edfb0){_0x579a0c=_0x5edfb0;_0x1527dd=0xc8;}else{_0x1527dd=0xce;}_0x345d22['status'](_0x1527dd);return _0x345d22[_0xf297('0x1d')](_0xf297('0x1e'),_0x23b812+'-'+_0x579a0c+'/'+_0x5edfb0)['json'](_0x28f240);}return null;};}function patchUpdates(_0x4a6ef3){return function(_0x2f7cf1){try{jsonpatch['apply'](_0x2f7cf1,_0x4a6ef3,!![]);}catch(_0x156fad){return BPromise[_0xf297('0x1f')](_0x156fad);}return _0x2f7cf1['save']();};}function saveUpdates(_0x17e36e,_0x235ce4){return function(_0x4eb8f2){if(_0x4eb8f2){return _0x4eb8f2[_0xf297('0x20')](_0x17e36e)[_0xf297('0x21')](function(_0x56ce75){return _0x56ce75;});}return null;};}function removeEntity(_0x175368,_0x1b500d){return function(_0x72401f){if(_0x72401f){return _0x72401f[_0xf297('0x22')]()[_0xf297('0x21')](function(){var _0xb88927=_0x72401f[_0xf297('0x23')]({'plain':!![]});var _0x27f111=_0xf297('0x24');return db[_0xf297('0x25')][_0xf297('0x22')]({'where':{'type':_0x27f111,'resourceId':_0xb88927['id']}})[_0xf297('0x21')](function(){return _0x72401f;});})[_0xf297('0x21')](function(){_0x175368[_0xf297('0x17')](0xcc)[_0xf297('0x18')]();});}};}function handleEntityNotFound(_0x26ae48,_0xb3c025){return function(_0x38d4c7){if(!_0x38d4c7){_0x26ae48[_0xf297('0x16')](0x194);}return _0x38d4c7;};}function handleError(_0x5101e3,_0x4998f0){_0x4998f0=_0x4998f0||0x1f4;return function(_0x5b1344){logger[_0xf297('0x26')](_0x5b1344[_0xf297('0x27')]);if(_0x5b1344[_0xf297('0x28')]){delete _0x5b1344[_0xf297('0x28')];}_0x5101e3['status'](_0x4998f0)[_0xf297('0x29')](_0x5b1344);};}exports[_0xf297('0x2a')]=function(_0x53cf2d,_0x34aa4b){var _0x1aecdf={},_0x22882e={},_0x32835e={'count':0x0,'rows':[]};var _0x1ad99b=_[_0xf297('0x2b')](db[_0xf297('0x2c')][_0xf297('0x2d')],function(_0x55e6b2){return{'name':_0x55e6b2[_0xf297('0x2e')],'type':_0x55e6b2[_0xf297('0x2f')]['key']};});_0x22882e[_0xf297('0x30')]=_[_0xf297('0x2b')](_0x1ad99b,_0xf297('0x28'));_0x22882e['query']=_[_0xf297('0x31')](_0x53cf2d[_0xf297('0x32')]);_0x22882e[_0xf297('0x33')]=_[_0xf297('0x34')](_0x22882e[_0xf297('0x30')],_0x22882e[_0xf297('0x32')]);_0x1aecdf[_0xf297('0x35')]=_[_0xf297('0x34')](_0x22882e[_0xf297('0x30')],qs['fields'](_0x53cf2d['query'][_0xf297('0x36')]));_0x1aecdf[_0xf297('0x35')]=_0x1aecdf['attributes']['length']?_0x1aecdf[_0xf297('0x35')]:_0x22882e[_0xf297('0x30')];if(!_0x53cf2d[_0xf297('0x32')][_0xf297('0x37')]('nolimit')){_0x1aecdf[_0xf297('0x38')]=qs[_0xf297('0x38')](_0x53cf2d[_0xf297('0x32')][_0xf297('0x38')]);_0x1aecdf[_0xf297('0x1c')]=qs[_0xf297('0x1c')](_0x53cf2d[_0xf297('0x32')][_0xf297('0x1c')]);}_0x1aecdf[_0xf297('0x39')]=qs[_0xf297('0x3a')](_0x53cf2d[_0xf297('0x32')]['sort']);_0x1aecdf[_0xf297('0x3b')]=qs[_0xf297('0x33')](_[_0xf297('0x3c')](_0x53cf2d[_0xf297('0x32')],_0x22882e['filters']),_0x1ad99b);if(_0x53cf2d[_0xf297('0x32')][_0xf297('0x3d')]){_0x1aecdf['where']=_['merge'](_0x1aecdf['where'],{'$or':_[_0xf297('0x2b')](_0x1ad99b,function(_0x45f9cb){if(_0x45f9cb['type']!==_0xf297('0x3e')){var _0x32bcd8={};_0x32bcd8[_0x45f9cb[_0xf297('0x28')]]={'$like':'%'+_0x53cf2d['query'][_0xf297('0x3d')]+'%'};return _0x32bcd8;}})});}_0x1aecdf=_['merge']({},_0x1aecdf,_0x53cf2d[_0xf297('0x3f')]);var _0x4611a8={'where':_0x1aecdf[_0xf297('0x3b')]};return db[_0xf297('0x2c')][_0xf297('0x1b')](_0x4611a8)[_0xf297('0x21')](function(_0x2818d4){_0x32835e[_0xf297('0x1b')]=_0x2818d4;if(_0x53cf2d[_0xf297('0x32')]['includeAll']){_0x1aecdf[_0xf297('0x40')]=[{'all':!![]}];}return db[_0xf297('0x2c')]['findAll'](_0x1aecdf);})[_0xf297('0x21')](function(_0x23bc10){_0x32835e['rows']=_0x23bc10;return _0x32835e;})[_0xf297('0x21')](respondWithFilteredResult(_0x34aa4b,_0x1aecdf))['catch'](handleError(_0x34aa4b,null));};exports[_0xf297('0x41')]=function(_0x46d261,_0x6cce70){var _0x1065eb={'raw':!![],'where':{'id':_0x46d261[_0xf297('0x42')]['id']}},_0x534fd9={};_0x534fd9[_0xf297('0x30')]=_[_0xf297('0x31')](db[_0xf297('0x2c')][_0xf297('0x2d')]);_0x534fd9[_0xf297('0x32')]=_['keys'](_0x46d261[_0xf297('0x32')]);_0x534fd9[_0xf297('0x33')]=_['intersection'](_0x534fd9[_0xf297('0x30')],_0x534fd9[_0xf297('0x32')]);_0x1065eb[_0xf297('0x35')]=_['intersection'](_0x534fd9[_0xf297('0x30')],qs[_0xf297('0x36')](_0x46d261[_0xf297('0x32')]['fields']));_0x1065eb['attributes']=_0x1065eb[_0xf297('0x35')][_0xf297('0x43')]?_0x1065eb['attributes']:_0x534fd9[_0xf297('0x30')];if(_0x46d261[_0xf297('0x32')][_0xf297('0x44')]){_0x1065eb[_0xf297('0x40')]=[{'all':!![]}];}_0x1065eb=_[_0xf297('0x45')]({},_0x1065eb,_0x46d261[_0xf297('0x3f')]);return db['Pause'][_0xf297('0x46')](_0x1065eb)[_0xf297('0x21')](handleEntityNotFound(_0x6cce70,null))['then'](respondWithResult(_0x6cce70,null))[_0xf297('0x47')](handleError(_0x6cce70,null));};exports[_0xf297('0x48')]=function(_0x11b862,_0x362141){return db[_0xf297('0x2c')][_0xf297('0x48')](_0x11b862[_0xf297('0x49')],{})[_0xf297('0x21')](function(_0xa5789e){var _0x189332=_0x11b862['user']['get']({'plain':!![]});if(!_0x189332)throw new Error(_0xf297('0x4a'));if(_0x189332['role']===_0xf297('0x4b')){var _0x56bfbf=_0xa5789e[_0xf297('0x23')]({'plain':!![]});var _0x9f9399=_0xf297('0x24');return db[_0xf297('0x4c')][_0xf297('0x46')]({'where':{'name':_0x9f9399,'userProfileId':_0x189332[_0xf297('0x4d')]},'raw':!![]})[_0xf297('0x21')](function(_0x3930b6){if(_0x3930b6&&_0x3930b6[_0xf297('0x4e')]===0x0){return db[_0xf297('0x25')][_0xf297('0x48')]({'name':_0x56bfbf[_0xf297('0x28')],'resourceId':_0x56bfbf['id'],'type':_0x3930b6[_0xf297('0x28')],'sectionId':_0x3930b6['id']},{})[_0xf297('0x21')](function(){return _0xa5789e;});}else{return _0xa5789e;}})[_0xf297('0x47')](function(_0x4e956e){logger['error'](_0xf297('0x4f'),_0x4e956e);throw _0x4e956e;});}return _0xa5789e;})[_0xf297('0x21')](respondWithResult(_0x362141,0xc9))[_0xf297('0x47')](handleError(_0x362141,null));};exports[_0xf297('0x20')]=function(_0x3bed7f,_0xf95898){if(_0x3bed7f[_0xf297('0x49')]['id']){delete _0x3bed7f[_0xf297('0x49')]['id'];}return db[_0xf297('0x2c')][_0xf297('0x46')]({'where':{'id':_0x3bed7f[_0xf297('0x42')]['id']}})[_0xf297('0x21')](handleEntityNotFound(_0xf95898,null))[_0xf297('0x21')](saveUpdates(_0x3bed7f[_0xf297('0x49')],null))[_0xf297('0x21')](respondWithResult(_0xf95898,null))['catch'](handleError(_0xf95898,null));};exports['destroy']=function(_0xe4c954,_0x2d1315){return db[_0xf297('0x2c')][_0xf297('0x46')]({'where':{'id':_0xe4c954['params']['id']}})[_0xf297('0x21')](handleEntityNotFound(_0x2d1315,null))[_0xf297('0x21')](removeEntity(_0x2d1315,null))[_0xf297('0x47')](handleError(_0x2d1315,null));}; \ No newline at end of file +var _0x6b7e=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','end','sendStatus','error','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','fields','length','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Pauses','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x48bee1,_0x29f43d){var _0x582372=function(_0x1cfb3f){while(--_0x1cfb3f){_0x48bee1['push'](_0x48bee1['shift']());}};_0x582372(++_0x29f43d);}(_0x6b7e,0x1a3));var _0xe6b7=function(_0x3a498a,_0x5e47f8){_0x3a498a=_0x3a498a-0x0;var _0x7943c4=_0x6b7e[_0x3a498a];return _0x7943c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe6b7('0x0'));var zipdir=require(_0xe6b7('0x1'));var jsonpatch=require(_0xe6b7('0x2'));var rp=require(_0xe6b7('0x3'));var moment=require('moment');var BPromise=require(_0xe6b7('0x4'));var Mustache=require(_0xe6b7('0x5'));var util=require(_0xe6b7('0x6'));var path=require(_0xe6b7('0x7'));var sox=require('sox');var csv=require(_0xe6b7('0x8'));var ejs=require(_0xe6b7('0x9'));var fs=require('fs');var fs_extra=require(_0xe6b7('0xa'));var _=require(_0xe6b7('0xb'));var squel=require(_0xe6b7('0xc'));var crypto=require(_0xe6b7('0xd'));var jsforce=require(_0xe6b7('0xe'));var deskjs=require(_0xe6b7('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe6b7('0x10'));var Papa=require(_0xe6b7('0x11'));var Redis=require(_0xe6b7('0x12'));var authService=require(_0xe6b7('0x13'));var qs=require(_0xe6b7('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe6b7('0x15'));var logger=require(_0xe6b7('0x16'))(_0xe6b7('0x17'));var utils=require(_0xe6b7('0x18'));var config=require(_0xe6b7('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xe6b7('0x1a'))['db'];function respondWithStatusCode(_0xd1c23e,_0x234926){_0x234926=_0x234926||0xcc;return function(_0x3b53b5){if(_0x3b53b5){return _0xd1c23e['sendStatus'](_0x234926);}return _0xd1c23e[_0xe6b7('0x1b')](_0x234926)['end']();};}function respondWithResult(_0x46bf52,_0x3c10a7){_0x3c10a7=_0x3c10a7||0xc8;return function(_0x5f2475){if(_0x5f2475){return _0x46bf52[_0xe6b7('0x1b')](_0x3c10a7)[_0xe6b7('0x1c')](_0x5f2475);}};}function respondWithFilteredResult(_0x2f73fd,_0x2e02b3){return function(_0x11eee3){if(_0x11eee3){var _0x1e9bc8=typeof _0x2e02b3['offset']===_0xe6b7('0x1d')&&typeof _0x2e02b3[_0xe6b7('0x1e')]==='undefined';var _0x27c0e4=_0x11eee3[_0xe6b7('0x1f')];var _0x1de6df=_0x1e9bc8?0x0:_0x2e02b3['offset'];var _0x451e47=_0x1e9bc8?_0x11eee3['count']:_0x2e02b3['offset']+_0x2e02b3['limit'];var _0x4cdb03;if(_0x451e47>=_0x27c0e4){_0x451e47=_0x27c0e4;_0x4cdb03=0xc8;}else{_0x4cdb03=0xce;}_0x2f73fd['status'](_0x4cdb03);return _0x2f73fd[_0xe6b7('0x20')](_0xe6b7('0x21'),_0x1de6df+'-'+_0x451e47+'/'+_0x27c0e4)['json'](_0x11eee3);}return null;};}function patchUpdates(_0x388fab){return function(_0x245c48){try{jsonpatch['apply'](_0x245c48,_0x388fab,!![]);}catch(_0x3c7a11){return BPromise[_0xe6b7('0x22')](_0x3c7a11);}return _0x245c48[_0xe6b7('0x23')]();};}function saveUpdates(_0x47ee2a,_0xe620d7){return function(_0x47acee){if(_0x47acee){return _0x47acee[_0xe6b7('0x24')](_0x47ee2a)[_0xe6b7('0x25')](function(_0xe6a2be){return _0xe6a2be;});}return null;};}function removeEntity(_0x5a040b,_0x317585){return function(_0x541699){if(_0x541699){return _0x541699[_0xe6b7('0x26')]()['then'](function(){var _0x5bd94c=_0x541699[_0xe6b7('0x27')]({'plain':!![]});var _0x43d0c8='Pauses';return db[_0xe6b7('0x28')][_0xe6b7('0x26')]({'where':{'type':_0x43d0c8,'resourceId':_0x5bd94c['id']}})[_0xe6b7('0x25')](function(){return _0x541699;});})[_0xe6b7('0x25')](function(){_0x5a040b['status'](0xcc)[_0xe6b7('0x29')]();});}};}function handleEntityNotFound(_0x3231fa,_0x147083){return function(_0x5397e7){if(!_0x5397e7){_0x3231fa[_0xe6b7('0x2a')](0x194);}return _0x5397e7;};}function handleError(_0x15a98e,_0x112377){_0x112377=_0x112377||0x1f4;return function(_0x6e9f0f){logger[_0xe6b7('0x2b')](_0x6e9f0f['stack']);if(_0x6e9f0f[_0xe6b7('0x2c')]){delete _0x6e9f0f[_0xe6b7('0x2c')];}_0x15a98e[_0xe6b7('0x1b')](_0x112377)[_0xe6b7('0x2d')](_0x6e9f0f);};}exports[_0xe6b7('0x2e')]=function(_0x42a712,_0x2b77b7){var _0x18ae25={},_0x322964={},_0x1544be={'count':0x0,'rows':[]};var _0x439cfe=_[_0xe6b7('0x2f')](db[_0xe6b7('0x30')][_0xe6b7('0x31')],function(_0x1d4543){return{'name':_0x1d4543[_0xe6b7('0x32')],'type':_0x1d4543[_0xe6b7('0x33')][_0xe6b7('0x34')]};});_0x322964[_0xe6b7('0x35')]=_[_0xe6b7('0x2f')](_0x439cfe,_0xe6b7('0x2c'));_0x322964[_0xe6b7('0x36')]=_[_0xe6b7('0x37')](_0x42a712[_0xe6b7('0x36')]);_0x322964[_0xe6b7('0x38')]=_['intersection'](_0x322964[_0xe6b7('0x35')],_0x322964[_0xe6b7('0x36')]);_0x18ae25['attributes']=_[_0xe6b7('0x39')](_0x322964[_0xe6b7('0x35')],qs['fields'](_0x42a712['query']['fields']));_0x18ae25[_0xe6b7('0x3a')]=_0x18ae25[_0xe6b7('0x3a')]['length']?_0x18ae25[_0xe6b7('0x3a')]:_0x322964[_0xe6b7('0x35')];if(!_0x42a712[_0xe6b7('0x36')][_0xe6b7('0x3b')](_0xe6b7('0x3c'))){_0x18ae25[_0xe6b7('0x1e')]=qs['limit'](_0x42a712[_0xe6b7('0x36')][_0xe6b7('0x1e')]);_0x18ae25[_0xe6b7('0x3d')]=qs['offset'](_0x42a712['query'][_0xe6b7('0x3d')]);}_0x18ae25[_0xe6b7('0x3e')]=qs[_0xe6b7('0x3f')](_0x42a712[_0xe6b7('0x36')][_0xe6b7('0x3f')]);_0x18ae25[_0xe6b7('0x40')]=qs['filters'](_[_0xe6b7('0x41')](_0x42a712[_0xe6b7('0x36')],_0x322964[_0xe6b7('0x38')]),_0x439cfe);if(_0x42a712[_0xe6b7('0x36')][_0xe6b7('0x42')]){_0x18ae25[_0xe6b7('0x40')]=_[_0xe6b7('0x43')](_0x18ae25[_0xe6b7('0x40')],{'$or':_[_0xe6b7('0x2f')](_0x439cfe,function(_0x300df7){if(_0x300df7[_0xe6b7('0x33')]!==_0xe6b7('0x44')){var _0x1604bb={};_0x1604bb[_0x300df7[_0xe6b7('0x2c')]]={'$like':'%'+_0x42a712['query'][_0xe6b7('0x42')]+'%'};return _0x1604bb;}})});}_0x18ae25=_[_0xe6b7('0x43')]({},_0x18ae25,_0x42a712[_0xe6b7('0x45')]);var _0x4f24c1={'where':_0x18ae25[_0xe6b7('0x40')]};return db[_0xe6b7('0x30')][_0xe6b7('0x1f')](_0x4f24c1)[_0xe6b7('0x25')](function(_0x1527aa){_0x1544be['count']=_0x1527aa;if(_0x42a712[_0xe6b7('0x36')]['includeAll']){_0x18ae25[_0xe6b7('0x46')]=[{'all':!![]}];}return db['Pause'][_0xe6b7('0x47')](_0x18ae25);})[_0xe6b7('0x25')](function(_0x2c826f){_0x1544be[_0xe6b7('0x48')]=_0x2c826f;return _0x1544be;})[_0xe6b7('0x25')](respondWithFilteredResult(_0x2b77b7,_0x18ae25))[_0xe6b7('0x49')](handleError(_0x2b77b7,null));};exports[_0xe6b7('0x4a')]=function(_0x377e57,_0x4af8fa){var _0x50906e={'raw':!![],'where':{'id':_0x377e57['params']['id']}},_0x5e9043={};_0x5e9043[_0xe6b7('0x35')]=_[_0xe6b7('0x37')](db[_0xe6b7('0x30')][_0xe6b7('0x31')]);_0x5e9043[_0xe6b7('0x36')]=_[_0xe6b7('0x37')](_0x377e57[_0xe6b7('0x36')]);_0x5e9043[_0xe6b7('0x38')]=_[_0xe6b7('0x39')](_0x5e9043['model'],_0x5e9043[_0xe6b7('0x36')]);_0x50906e[_0xe6b7('0x3a')]=_[_0xe6b7('0x39')](_0x5e9043[_0xe6b7('0x35')],qs[_0xe6b7('0x4b')](_0x377e57[_0xe6b7('0x36')][_0xe6b7('0x4b')]));_0x50906e[_0xe6b7('0x3a')]=_0x50906e['attributes'][_0xe6b7('0x4c')]?_0x50906e['attributes']:_0x5e9043[_0xe6b7('0x35')];if(_0x377e57[_0xe6b7('0x36')][_0xe6b7('0x4d')]){_0x50906e[_0xe6b7('0x46')]=[{'all':!![]}];}_0x50906e=_[_0xe6b7('0x43')]({},_0x50906e,_0x377e57[_0xe6b7('0x45')]);return db[_0xe6b7('0x30')][_0xe6b7('0x4e')](_0x50906e)[_0xe6b7('0x25')](handleEntityNotFound(_0x4af8fa,null))['then'](respondWithResult(_0x4af8fa,null))[_0xe6b7('0x49')](handleError(_0x4af8fa,null));};exports[_0xe6b7('0x4f')]=function(_0x27d941,_0x35c097){return db['Pause'][_0xe6b7('0x4f')](_0x27d941['body'],{})[_0xe6b7('0x25')](function(_0x53a0ad){var _0x268a5a=_0x27d941[_0xe6b7('0x50')][_0xe6b7('0x27')]({'plain':!![]});if(!_0x268a5a)throw new Error(_0xe6b7('0x51'));if(_0x268a5a[_0xe6b7('0x52')]===_0xe6b7('0x50')){var _0x45b710=_0x53a0ad[_0xe6b7('0x27')]({'plain':!![]});var _0x2e90b3=_0xe6b7('0x53');return db['UserProfileSection'][_0xe6b7('0x4e')]({'where':{'name':_0x2e90b3,'userProfileId':_0x268a5a['userProfileId']},'raw':!![]})[_0xe6b7('0x25')](function(_0x3ccf36){if(_0x3ccf36&&_0x3ccf36['autoAssociation']===0x0){return db[_0xe6b7('0x28')][_0xe6b7('0x4f')]({'name':_0x45b710['name'],'resourceId':_0x45b710['id'],'type':_0x3ccf36[_0xe6b7('0x2c')],'sectionId':_0x3ccf36['id']},{})[_0xe6b7('0x25')](function(){return _0x53a0ad;});}else{return _0x53a0ad;}})['catch'](function(_0x5d5d67){logger[_0xe6b7('0x2b')](_0xe6b7('0x54'),_0x5d5d67);throw _0x5d5d67;});}return _0x53a0ad;})[_0xe6b7('0x25')](respondWithResult(_0x35c097,0xc9))[_0xe6b7('0x49')](handleError(_0x35c097,null));};exports[_0xe6b7('0x24')]=function(_0x36f006,_0x1f9b4f){if(_0x36f006[_0xe6b7('0x55')]['id']){delete _0x36f006[_0xe6b7('0x55')]['id'];}return db[_0xe6b7('0x30')][_0xe6b7('0x4e')]({'where':{'id':_0x36f006[_0xe6b7('0x56')]['id']}})[_0xe6b7('0x25')](handleEntityNotFound(_0x1f9b4f,null))['then'](saveUpdates(_0x36f006[_0xe6b7('0x55')],null))['then'](respondWithResult(_0x1f9b4f,null))[_0xe6b7('0x49')](handleError(_0x1f9b4f,null));};exports[_0xe6b7('0x26')]=function(_0x42beb1,_0xd2e838){return db[_0xe6b7('0x30')]['find']({'where':{'id':_0x42beb1['params']['id']}})[_0xe6b7('0x25')](handleEntityNotFound(_0xd2e838,null))[_0xe6b7('0x25')](removeEntity(_0xd2e838,null))['catch'](handleError(_0xd2e838,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 89ceed2..5f45f0a 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 _0x53ec=['bluebird','path','../../config/environment','./pause.attributes','define','Pause','lodash','util','../../config/logger','api','moment'];(function(_0x4be629,_0x4e3da9){var _0x468647=function(_0x1f0353){while(--_0x1f0353){_0x4be629['push'](_0x4be629['shift']());}};_0x468647(++_0x4e3da9);}(_0x53ec,0x192));var _0xc53e=function(_0x5b955c,_0x1b03c0){_0x5b955c=_0x5b955c-0x0;var _0x28028a=_0x53ec[_0x5b955c];return _0x28028a;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['define','Pause','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./pause.attributes','exports'];(function(_0x38fefe,_0x1236e3){var _0x1601d0=function(_0x1d4c4b){while(--_0x1d4c4b){_0x38fefe['push'](_0x38fefe['shift']());}};_0x1601d0(++_0x1236e3);}(_0x814b,0x1a2));var _0xb814=function(_0x2d3a4d,_0x47561e){_0x2d3a4d=_0x2d3a4d-0x0;var _0x3a94a3=_0x814b[_0x2d3a4d];return _0x3a94a3;};'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 diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 28a1ef4..10df484 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(_0x2c249a,_0x1b1165){var _0x52545b=function(_0x4d89d7){while(--_0x4d89d7){_0x2c249a['push'](_0x2c249a['shift']());}};_0x52545b(++_0x1b1165);}(_0xb10b,0x12a));var _0xbb10=function(_0x1c7502,_0x5d2c70){_0x1c7502=_0x1c7502-0x0;var _0x2165fa=_0xb10b[_0x1c7502];return _0x2165fa;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x10d63c,_0x560fd8){var _0x105b2d=function(_0x32a803){while(--_0x32a803){_0x10d63c['push'](_0x10d63c['shift']());}};_0x105b2d(++_0x560fd8);}(_0xb10b,0x12a));var _0xbb10=function(_0x5954d2,_0x15db93){_0x5954d2=_0x5954d2-0x0;var _0x316928=_0xb10b[_0x5954d2];return _0x316928;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 2ba9c40..6fd94a4 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 _0x8d0e=['basename','extname','now','post','file','upload','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','index','get','/webhook','webhookGet','/:id','isAuthenticated','show','/:id/download','download','join','root','server/files/plugins','originalname','replace'];(function(_0x565207,_0x31210d){var _0x366a1f=function(_0x4ed2c4){while(--_0x4ed2c4){_0x565207['push'](_0x565207['shift']());}};_0x366a1f(++_0x31210d);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x2ec0d4,_0xec39db){_0x2ec0d4=_0x2ec0d4-0x0;var _0x26c5ee=_0x8d0e[_0x2ec0d4];return _0x26c5ee;};'use strict';var multer=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var path=require(_0xe8d0('0x2'));var timeout=require(_0xe8d0('0x3'));var express=require(_0xe8d0('0x4'));var router=express[_0xe8d0('0x5')]();var fs_extra=require(_0xe8d0('0x6'));var auth=require(_0xe8d0('0x7'));var interaction=require(_0xe8d0('0x8'));var config=require('../../config/environment');var controller=require(_0xe8d0('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xe8d0('0xa')]);router[_0xe8d0('0xb')](_0xe8d0('0xc'),controller[_0xe8d0('0xd')]);router[_0xe8d0('0xb')](_0xe8d0('0xe'),auth[_0xe8d0('0xf')](),controller[_0xe8d0('0x10')]);router['get'](_0xe8d0('0x11'),auth[_0xe8d0('0xf')](),controller[_0xe8d0('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x580aab,_0x42e0c2,_0x25e6b8){_0x25e6b8(null,path[_0xe8d0('0x13')](config[_0xe8d0('0x14')],_0xe8d0('0x15')));},'filename':function(_0x41de69,_0x5934b2,_0x38fac0){_0x5934b2[_0xe8d0('0x16')]=_0x5934b2['originalname'][_0xe8d0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x38fac0(null,util['format']('%s-%s%s',path[_0xe8d0('0x18')](_0x5934b2[_0xe8d0('0x16')],path[_0xe8d0('0x19')](_0x5934b2[_0xe8d0('0x16')])),Date[_0xe8d0('0x1a')](),path[_0xe8d0('0x19')](_0x5934b2['originalname'])));}})});router[_0xe8d0('0x1b')]('/',upload['single'](_0xe8d0('0x1c')),controller[_0xe8d0('0x1d')]);router[_0xe8d0('0x1b')]('/webhook',controller['webhookPost']);router['put'](_0xe8d0('0xe'),auth[_0xe8d0('0xf')](),controller[_0xe8d0('0x1e')]);router[_0xe8d0('0x1f')](_0xe8d0('0xe'),auth['isAuthenticated'](),controller[_0xe8d0('0x1f')]);module[_0xe8d0('0x20')]=router; \ No newline at end of file +var _0xe13a=['./plugin.controller','get','isAuthenticated','index','webhookGet','/:id','show','/:id/download','download','join','root','server/files/plugins','originalname','extname','now','single','upload','post','/webhook','webhookPost','put','update','delete','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x23ab19,_0x3194f6){var _0xb74c86=function(_0x2f319e){while(--_0x2f319e){_0x23ab19['push'](_0x23ab19['shift']());}};_0xb74c86(++_0x3194f6);}(_0xe13a,0x178));var _0xae13=function(_0x214b61,_0x5b5472){_0x214b61=_0x214b61-0x0;var _0x3f1504=_0xe13a[_0x214b61];return _0x3f1504;};'use strict';var multer=require('multer');var util=require(_0xae13('0x0'));var path=require(_0xae13('0x1'));var timeout=require(_0xae13('0x2'));var express=require(_0xae13('0x3'));var router=express['Router']();var fs_extra=require(_0xae13('0x4'));var auth=require(_0xae13('0x5'));var interaction=require(_0xae13('0x6'));var config=require(_0xae13('0x7'));var controller=require(_0xae13('0x8'));router[_0xae13('0x9')]('/',auth[_0xae13('0xa')](),controller[_0xae13('0xb')]);router[_0xae13('0x9')]('/webhook',controller[_0xae13('0xc')]);router[_0xae13('0x9')](_0xae13('0xd'),auth[_0xae13('0xa')](),controller[_0xae13('0xe')]);router[_0xae13('0x9')](_0xae13('0xf'),auth[_0xae13('0xa')](),controller[_0xae13('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x404b0e,_0x83de98,_0x3d6a85){_0x3d6a85(null,path[_0xae13('0x11')](config[_0xae13('0x12')],_0xae13('0x13')));},'filename':function(_0x1505c5,_0x4dd599,_0x42d869){_0x4dd599[_0xae13('0x14')]=_0x4dd599['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x42d869(null,util['format']('%s-%s%s',path['basename'](_0x4dd599[_0xae13('0x14')],path[_0xae13('0x15')](_0x4dd599[_0xae13('0x14')])),Date[_0xae13('0x16')](),path[_0xae13('0x15')](_0x4dd599[_0xae13('0x14')])));}})});router['post']('/',upload[_0xae13('0x17')]('file'),controller[_0xae13('0x18')]);router[_0xae13('0x19')](_0xae13('0x1a'),controller[_0xae13('0x1b')]);router[_0xae13('0x1c')](_0xae13('0xd'),auth[_0xae13('0xa')](),controller[_0xae13('0x1d')]);router[_0xae13('0x1e')]('/:id',auth[_0xae13('0xa')](),controller['delete']);module[_0xae13('0x1f')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 75c6b1a..889f922 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 _0xa11e=['STRING','html','script','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM','adminOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize'];(function(_0x2163b2,_0x190845){var _0x5efd94=function(_0x2da4d9){while(--_0x2da4d9){_0x2163b2['push'](_0x2163b2['shift']());}};_0x5efd94(++_0x190845);}(_0xa11e,0x1c2));var _0xea11=function(_0xa18f9b,_0x197053){_0xa18f9b=_0xa18f9b-0x0;var _0x2d2afa=_0xa11e[_0xa18f9b];return _0x2d2afa;};'use strict';var Sequelize=require(_0xea11('0x0'));module['exports']={'name':{'type':Sequelize[_0xea11('0x1')]},'type':{'type':Sequelize['ENUM'](_0xea11('0x2'),_0xea11('0x3'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0xea11('0x1')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0xea11('0x4')],'defaultValue':0x0,'comment':_0xea11('0x5')},'sidebar':{'type':Sequelize[_0xea11('0x6')](_0xea11('0x7'),'agentOnly',_0xea11('0x8'),_0xea11('0x9')),'defaultValue':'always','comment':_0xea11('0xa')},'icon':{'type':Sequelize[_0xea11('0x1')]},'adminUrl':{'type':Sequelize[_0xea11('0x1')]},'agentUrl':{'type':Sequelize[_0xea11('0x1')]},'scriptName':{'type':Sequelize[_0xea11('0x1')]},'scriptPath':{'type':Sequelize[_0xea11('0x1')]}}; \ No newline at end of file +var _0x8057=['TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','script'];(function(_0x274362,_0x3321f9){var _0x24549c=function(_0x9bf7fc){while(--_0x9bf7fc){_0x274362['push'](_0x274362['shift']());}};_0x24549c(++_0x3321f9);}(_0x8057,0x166));var _0x7805=function(_0x3a8939,_0x838b67){_0x3a8939=_0x3a8939-0x0;var _0x3ef0e3=_0x8057[_0x3a8939];return _0x3ef0e3;};'use strict';var Sequelize=require(_0x7805('0x0'));module[_0x7805('0x1')]={'name':{'type':Sequelize[_0x7805('0x2')]},'type':{'type':Sequelize[_0x7805('0x3')](_0x7805('0x4'),_0x7805('0x5'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x7805('0x6')]},'path':{'type':Sequelize[_0x7805('0x2')],'comment':_0x7805('0x7')},'active':{'type':Sequelize[_0x7805('0x8')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x7805('0x3')](_0x7805('0x9'),_0x7805('0xa'),_0x7805('0xb'),'never'),'defaultValue':'always','comment':_0x7805('0xc')},'icon':{'type':Sequelize[_0x7805('0x2')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x7805('0x2')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 5eaaf05..687582b 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 _0xdcd2=['Error','pipe','glob','**/*','join','root','dirname','node_modules/**/*','finalize','close','Plugin\x20not\x20found','download','format','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','extname','filename','server/files/plugins','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','type','html','views','agent','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','script','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','headers','content-length','content-type','endsWith','statusCode','webhookPost','%s%s','rimraf','fast-json-patch','bluebird','util','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Plugins','end','error','stack','name','send','index','Plugin','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','filter','merge','options','includeAll','include','findAll','rows','catch','find','params','path','%s.zip','basename','createWriteStream','warning','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive'];(function(_0x5accb7,_0x462c4c){var _0x5152dd=function(_0x979c60){while(--_0x979c60){_0x5accb7['push'](_0x5accb7['shift']());}};_0x5152dd(++_0x462c4c);}(_0xdcd2,0xfa));var _0x2dcd=function(_0x49b937,_0x9c050){_0x49b937=_0x49b937-0x0;var _0x31da1b=_0xdcd2[_0x49b937];return _0x31da1b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2dcd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2dcd('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2dcd('0x2'));var Mustache=require('mustache');var util=require(_0x2dcd('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0x2dcd('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2dcd('0x5'));var squel=require(_0x2dcd('0x6'));var crypto=require(_0x2dcd('0x7'));var jsforce=require(_0x2dcd('0x8'));var deskjs=require(_0x2dcd('0x9'));var toCsv=require(_0x2dcd('0x4'));var querystring=require(_0x2dcd('0xa'));var Papa=require(_0x2dcd('0xb'));var extract=require(_0x2dcd('0xc'));var rimraf=require(_0x2dcd('0x0'));var archiver=require(_0x2dcd('0xd'));var Redis=require(_0x2dcd('0xe'));var authService=require(_0x2dcd('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2dcd('0x10'));var hardwareService=require(_0x2dcd('0x11'));var logger=require(_0x2dcd('0x12'))(_0x2dcd('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2dcd('0x14'))['db'];config[_0x2dcd('0x15')]=_[_0x2dcd('0x16')](config[_0x2dcd('0x15')],{'host':_0x2dcd('0x17'),'port':0x18eb});var socket=require(_0x2dcd('0x18'))(new Redis(config['redis']));require(_0x2dcd('0x19'))[_0x2dcd('0x1a')](socket);function respondWithStatusCode(_0x50a0c2,_0x48e070){_0x48e070=_0x48e070||0xcc;return function(_0x3a7de9){if(_0x3a7de9){return _0x50a0c2[_0x2dcd('0x1b')](_0x48e070);}return _0x50a0c2[_0x2dcd('0x1c')](_0x48e070)['end']();};}function respondWithResult(_0x1f98a5,_0x23d9e9){_0x23d9e9=_0x23d9e9||0xc8;return function(_0x5424ea){if(_0x5424ea){return _0x1f98a5[_0x2dcd('0x1c')](_0x23d9e9)[_0x2dcd('0x1d')](_0x5424ea);}};}function respondWithFilteredResult(_0x1a4b37,_0x1ea3d3){return function(_0x4ca2ee){if(_0x4ca2ee){var _0x6ac708=typeof _0x1ea3d3[_0x2dcd('0x1e')]===_0x2dcd('0x1f')&&typeof _0x1ea3d3[_0x2dcd('0x20')]==='undefined';var _0x36826a=_0x4ca2ee['count'];var _0x5e1d04=_0x6ac708?0x0:_0x1ea3d3[_0x2dcd('0x1e')];var _0x61c7b1=_0x6ac708?_0x4ca2ee[_0x2dcd('0x21')]:_0x1ea3d3[_0x2dcd('0x1e')]+_0x1ea3d3[_0x2dcd('0x20')];var _0x8a767e;if(_0x61c7b1>=_0x36826a){_0x61c7b1=_0x36826a;_0x8a767e=0xc8;}else{_0x8a767e=0xce;}_0x1a4b37[_0x2dcd('0x1c')](_0x8a767e);return _0x1a4b37[_0x2dcd('0x22')](_0x2dcd('0x23'),_0x5e1d04+'-'+_0x61c7b1+'/'+_0x36826a)[_0x2dcd('0x1d')](_0x4ca2ee);}return null;};}function patchUpdates(_0x1213d2){return function(_0x4213ad){try{jsonpatch[_0x2dcd('0x24')](_0x4213ad,_0x1213d2,!![]);}catch(_0x266636){return BPromise[_0x2dcd('0x25')](_0x266636);}return _0x4213ad[_0x2dcd('0x26')]();};}function saveUpdates(_0x2c22f7,_0x397837){return function(_0x276f2e){if(_0x276f2e){return _0x276f2e[_0x2dcd('0x27')](_0x2c22f7)[_0x2dcd('0x28')](function(_0x8bc17b){return _0x8bc17b;});}return null;};}function removeEntity(_0x520277,_0x3cc154){return function(_0x48e1b6){if(_0x48e1b6){return _0x48e1b6[_0x2dcd('0x29')]()[_0x2dcd('0x28')](function(){var _0x332be0=_0x48e1b6[_0x2dcd('0x2a')]({'plain':!![]});var _0x7c65a7=_0x2dcd('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0x7c65a7,'resourceId':_0x332be0['id']}})[_0x2dcd('0x28')](function(){return _0x48e1b6;});})[_0x2dcd('0x28')](function(){_0x520277[_0x2dcd('0x1c')](0xcc)[_0x2dcd('0x2c')]();});}};}function handleEntityNotFound(_0x1890bd,_0x5cd8a9){return function(_0x544ec7){if(!_0x544ec7){_0x1890bd['sendStatus'](0x194);}return _0x544ec7;};}function handleError(_0x57af5e,_0x38fcc3){_0x38fcc3=_0x38fcc3||0x1f4;return function(_0x225ec5){logger[_0x2dcd('0x2d')](_0x225ec5[_0x2dcd('0x2e')]);if(_0x225ec5['name']){delete _0x225ec5[_0x2dcd('0x2f')];}_0x57af5e[_0x2dcd('0x1c')](_0x38fcc3)[_0x2dcd('0x30')](_0x225ec5);};}exports[_0x2dcd('0x31')]=function(_0x27c45c,_0x5b510c){var _0x2c16e7={},_0x376459={},_0x5a5168={'count':0x0,'rows':[]};var _0x1fd27c=_['map'](db[_0x2dcd('0x32')][_0x2dcd('0x33')],function(_0x4cf482){return{'name':_0x4cf482[_0x2dcd('0x34')],'type':_0x4cf482['type'][_0x2dcd('0x35')]};});_0x376459[_0x2dcd('0x36')]=_[_0x2dcd('0x37')](_0x1fd27c,_0x2dcd('0x2f'));_0x376459[_0x2dcd('0x38')]=_[_0x2dcd('0x39')](_0x27c45c[_0x2dcd('0x38')]);_0x376459['filters']=_[_0x2dcd('0x3a')](_0x376459['model'],_0x376459[_0x2dcd('0x38')]);_0x2c16e7[_0x2dcd('0x3b')]=_[_0x2dcd('0x3a')](_0x376459[_0x2dcd('0x36')],qs[_0x2dcd('0x3c')](_0x27c45c[_0x2dcd('0x38')][_0x2dcd('0x3c')]));_0x2c16e7[_0x2dcd('0x3b')]=_0x2c16e7[_0x2dcd('0x3b')][_0x2dcd('0x3d')]?_0x2c16e7['attributes']:_0x376459[_0x2dcd('0x36')];if(!_0x27c45c['query'][_0x2dcd('0x3e')](_0x2dcd('0x3f'))){_0x2c16e7[_0x2dcd('0x20')]=qs[_0x2dcd('0x20')](_0x27c45c[_0x2dcd('0x38')][_0x2dcd('0x20')]);_0x2c16e7[_0x2dcd('0x1e')]=qs[_0x2dcd('0x1e')](_0x27c45c[_0x2dcd('0x38')][_0x2dcd('0x1e')]);}_0x2c16e7[_0x2dcd('0x40')]=qs[_0x2dcd('0x41')](_0x27c45c[_0x2dcd('0x38')][_0x2dcd('0x41')]);_0x2c16e7['where']=qs[_0x2dcd('0x42')](_[_0x2dcd('0x43')](_0x27c45c[_0x2dcd('0x38')],_0x376459['filters']),_0x1fd27c);if(_0x27c45c[_0x2dcd('0x38')]['filter']){_0x2c16e7[_0x2dcd('0x44')]=_['merge'](_0x2c16e7[_0x2dcd('0x44')],{'$or':_['map'](_0x1fd27c,function(_0x593755){if(_0x593755['type']!=='VIRTUAL'){var _0x730f78={};_0x730f78[_0x593755[_0x2dcd('0x2f')]]={'$like':'%'+_0x27c45c[_0x2dcd('0x38')][_0x2dcd('0x45')]+'%'};return _0x730f78;}})});}_0x2c16e7=_[_0x2dcd('0x46')]({},_0x2c16e7,_0x27c45c[_0x2dcd('0x47')]);var _0x3986c8={'where':_0x2c16e7['where']};return db[_0x2dcd('0x32')][_0x2dcd('0x21')](_0x3986c8)[_0x2dcd('0x28')](function(_0x4d4989){_0x5a5168[_0x2dcd('0x21')]=_0x4d4989;if(_0x27c45c[_0x2dcd('0x38')][_0x2dcd('0x48')]){_0x2c16e7[_0x2dcd('0x49')]=[{'all':!![]}];}return db['Plugin'][_0x2dcd('0x4a')](_0x2c16e7);})[_0x2dcd('0x28')](function(_0x2a3347){_0x5a5168[_0x2dcd('0x4b')]=_0x2a3347;return _0x5a5168;})['then'](respondWithFilteredResult(_0x5b510c,_0x2c16e7))[_0x2dcd('0x4c')](handleError(_0x5b510c,null));};exports['show']=function(_0x2b2e35,_0x82c242){var _0x373cc7={'raw':!![],'where':{'id':_0x2b2e35['params']['id']}},_0xc357a8={};_0xc357a8[_0x2dcd('0x36')]=_[_0x2dcd('0x39')](db[_0x2dcd('0x32')]['rawAttributes']);_0xc357a8['query']=_[_0x2dcd('0x39')](_0x2b2e35['query']);_0xc357a8['filters']=_[_0x2dcd('0x3a')](_0xc357a8[_0x2dcd('0x36')],_0xc357a8[_0x2dcd('0x38')]);_0x373cc7[_0x2dcd('0x3b')]=_[_0x2dcd('0x3a')](_0xc357a8[_0x2dcd('0x36')],qs['fields'](_0x2b2e35[_0x2dcd('0x38')][_0x2dcd('0x3c')]));_0x373cc7[_0x2dcd('0x3b')]=_0x373cc7[_0x2dcd('0x3b')][_0x2dcd('0x3d')]?_0x373cc7[_0x2dcd('0x3b')]:_0xc357a8[_0x2dcd('0x36')];if(_0x2b2e35[_0x2dcd('0x38')][_0x2dcd('0x48')]){_0x373cc7[_0x2dcd('0x49')]=[{'all':!![]}];}_0x373cc7=_['merge']({},_0x373cc7,_0x2b2e35['options']);return db[_0x2dcd('0x32')]['find'](_0x373cc7)[_0x2dcd('0x28')](handleEntityNotFound(_0x82c242,null))[_0x2dcd('0x28')](respondWithResult(_0x82c242,null))[_0x2dcd('0x4c')](handleError(_0x82c242,null));};exports['download']=function(_0x453c35,_0x5dd8a6,_0x8631e1){return db[_0x2dcd('0x32')][_0x2dcd('0x4d')]({'where':{'id':_0x453c35[_0x2dcd('0x4e')]['id']},'attributes':[_0x2dcd('0x2f'),_0x2dcd('0x4f')],'raw':!![]})[_0x2dcd('0x28')](handleEntityNotFound(_0x5dd8a6,null))[_0x2dcd('0x28')](function(_0xea0e9f){if(_0xea0e9f){var _0x3bd175=path['join'](config['root'],'server/files/plugins',util['format'](_0x2dcd('0x50'),path[_0x2dcd('0x51')](_0xea0e9f[_0x2dcd('0x4f')])));var _0x2d7ac7=fs[_0x2dcd('0x52')](_0x3bd175);var _0x1c786e=archiver('zip',{'zlib':{'level':0x9}});_0x1c786e['on'](_0x2dcd('0x53'),function(_0x4ae381){if(_0x4ae381[_0x2dcd('0x54')]===_0x2dcd('0x55')){logger[_0x2dcd('0x2d')](_0x4ae381);}else{throw new db[(_0x2dcd('0x56'))]['Error'](_0x2dcd('0x57'));}});_0x1c786e['on'](_0x2dcd('0x2d'),function(_0x38052e){throw new db[(_0x2dcd('0x56'))][(_0x2dcd('0x58'))](_0x2dcd('0x57'));});_0x1c786e[_0x2dcd('0x59')](_0x2d7ac7);_0x1c786e[_0x2dcd('0x5a')](_0x2dcd('0x5b'),{'cwd':path[_0x2dcd('0x5c')](config[_0x2dcd('0x5d')],'server/files/plugins',path[_0x2dcd('0x5e')](_0xea0e9f[_0x2dcd('0x4f')])),'ignore':[path[_0x2dcd('0x5c')](path[_0x2dcd('0x51')](_0xea0e9f[_0x2dcd('0x4f')]),_0x2dcd('0x5f')),path['join'](path[_0x2dcd('0x51')](_0xea0e9f['path']),'attachments/**/*')],'nodir':!![]})[_0x2dcd('0x60')]();_0x2d7ac7['on'](_0x2dcd('0x61'),function(){if(!fs['existsSync'](_0x3bd175)){throw new db[(_0x2dcd('0x56'))][(_0x2dcd('0x58'))](_0x2dcd('0x62'));}return _0x5dd8a6[_0x2dcd('0x63')](_0x3bd175,util[_0x2dcd('0x64')](_0x2dcd('0x50'),path[_0x2dcd('0x51')](_0xea0e9f['path'])),function(_0x18eac0){if(_0x18eac0){throw new db[(_0x2dcd('0x56'))]['Error']('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x2dcd('0x65')](_0x3bd175);logger[_0x2dcd('0x66')](_0x2dcd('0x67'));logger['info'](_0x2dcd('0x68'));});});}return null;})[_0x2dcd('0x4c')](handleError(_0x5dd8a6,null));};exports[_0x2dcd('0x69')]=function(_0x9590bc,_0x5dd813,_0x5dab60){var _0x226686=path['basename'](_0x9590bc[_0x2dcd('0x6a')]['filename'],path[_0x2dcd('0x6b')](_0x9590bc['file']['filename']));var _0x50e6d3=path[_0x2dcd('0x5c')](config[_0x2dcd('0x5d')],'server/files/plugins',_0x9590bc['file'][_0x2dcd('0x6c')]);var _0x564c58=path[_0x2dcd('0x5c')](config['root'],_0x2dcd('0x6d'),_0x226686);logger[_0x2dcd('0x66')](_0x2dcd('0x6e'),_0x50e6d3);logger['info']('Plugin\x20upload\x20destination:\x20%s',_0x564c58);try{fs[_0x2dcd('0x6f')](_0x50e6d3,parseInt(_0x2dcd('0x70'),0x8));extract(_0x50e6d3,{'dir':_0x564c58},function(_0x4c5d93){if(_0x4c5d93){logger[_0x2dcd('0x2d')](_0x4c5d93);handleError(_0x4c5d93,!![]);};var _0x229966=fs[_0x2dcd('0x71')](_0x564c58);if(_0x229966[_0x2dcd('0x3d')]>0x1){removeReferences(_0x50e6d3,_0x564c58);logger[_0x2dcd('0x2d')](_0x2dcd('0x72'));return _0x5dab60(new Error(_0x2dcd('0x72')));}var _0x5f5879=fs['lstatSync'](path[_0x2dcd('0x5c')](_0x564c58,_0x229966[0x0]));if(_0x5f5879[_0x2dcd('0x73')]()){removeReferences(_0x50e6d3,_0x564c58);logger[_0x2dcd('0x2d')](_0x2dcd('0x72'));return _0x5dab60(new Error(_0x2dcd('0x72')));}if(_0x5f5879[_0x2dcd('0x74')]()){var _0xe30d85=fs[_0x2dcd('0x71')](path[_0x2dcd('0x5c')](_0x564c58,_0x229966[0x0]));if(_0xe30d85[_0x2dcd('0x3d')]===0x0){removeReferences(_0x50e6d3,_0x564c58);logger[_0x2dcd('0x2d')](_0x2dcd('0x72'));return _0x5dab60(new Error(_0x2dcd('0x72')));}var _0x22514c=_0xe30d85[_0x2dcd('0x75')](function(_0x5df61d){return _0x5df61d===_0x2dcd('0x76');});if(!_0x22514c){return _0x5dab60(new Error(_0x2dcd('0x77')));}var _0x2214ea=fs['readFileSync'](path['join'](_0x564c58,_0x229966[0x0],'manifest.json'));var _0x1a87fd=JSON['parse'](_0x2214ea);if(_0x2dcd('0x1f')==typeof _0x1a87fd[_0x2dcd('0x2f')]){return _0x5dab60(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x2dcd('0x1f')==typeof _0x1a87fd['type']){return _0x5dab60(new Error(_0x2dcd('0x78')));}if(_0x2dcd('0x1f')==typeof _0x1a87fd[_0x2dcd('0x79')]){return _0x5dab60(new Error(_0x2dcd('0x7a')));}if(_0x2dcd('0x1f')==typeof _0x1a87fd[_0x2dcd('0x7b')]){return _0x5dab60(new Error(_0x2dcd('0x7c')));}if(_0x1a87fd[_0x2dcd('0x7d')]===_0x2dcd('0x7e')){if('undefined'==typeof _0x1a87fd[_0x2dcd('0x7b')][_0x2dcd('0x7f')]){return _0x5dab60(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x2dcd('0x1f')==typeof _0x1a87fd['parameters'][_0x2dcd('0x7f')]['admin']&&_0x2dcd('0x1f')==typeof _0x1a87fd['parameters']['views'][_0x2dcd('0x80')]){return _0x5dab60(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x1a87fd[_0x2dcd('0x7d')]==='script'){if(_0x2dcd('0x1f')==typeof _0x1a87fd[_0x2dcd('0x7b')][_0x2dcd('0x81')]){return _0x5dab60(new Error(_0x2dcd('0x82')));}if(_0x2dcd('0x1f')==typeof _0x1a87fd['parameters'][_0x2dcd('0x83')]){return _0x5dab60(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x5dab60(new Error(_0x2dcd('0x84')));}var _0x559e8e=_0x1a87fd[_0x2dcd('0x2f')];var _0xf75d06=_0x1a87fd['description'];var _0x3362d9=_0x1a87fd[_0x2dcd('0x7d')];var _0x316e31=_0x1a87fd[_0x2dcd('0x85')]?_0x1a87fd[_0x2dcd('0x85')]:_0x2dcd('0x86');var _0x53908d=_0x1a87fd[_0x2dcd('0x87')]?_0x1a87fd[_0x2dcd('0x87')]:_0x2dcd('0x88');var _0x1b72c9='';var _0x297927='';var _0x592e9d='';var _0xcff5d='';var _0x44226b=_0x1a87fd['version'];if(_0x3362d9===_0x2dcd('0x7e')){if(_0x2dcd('0x1f')!=typeof _0x1a87fd[_0x2dcd('0x7b')]['views']['admin']){var _0x29c78b=_0x1a87fd[_0x2dcd('0x7b')][_0x2dcd('0x7f')][_0x2dcd('0x89')];if(!/^(f|ht)tps?:\/\//i[_0x2dcd('0x8a')](_0x29c78b)){_0x1b72c9=path[_0x2dcd('0x5c')](_0x2dcd('0x8b'),_0x226686,_0x229966[0x0],_0x29c78b);}else{_0x1b72c9=_0x29c78b;}}else{logger[_0x2dcd('0x66')](_0x2dcd('0x8c'));}if(_0x2dcd('0x1f')!=typeof _0x1a87fd[_0x2dcd('0x7b')][_0x2dcd('0x7f')][_0x2dcd('0x80')]){var _0x86a26c=_0x1a87fd[_0x2dcd('0x7b')]['views'][_0x2dcd('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x2dcd('0x8a')](_0x86a26c)){_0x297927=path[_0x2dcd('0x5c')](_0x2dcd('0x8b'),_0x226686,_0x229966[0x0],_0x86a26c);}else{_0x297927=_0x86a26c;}}else{logger[_0x2dcd('0x66')](_0x2dcd('0x8d'));}}else if(_0x3362d9===_0x2dcd('0x8e')){_0x592e9d=_0x1a87fd[_0x2dcd('0x7b')][_0x2dcd('0x81')];_0xcff5d=_0x1a87fd['parameters'][_0x2dcd('0x83')];if(_0x2dcd('0x1f')!=typeof _0x1a87fd[_0x2dcd('0x7b')][_0x2dcd('0x7f')]){if(_0x2dcd('0x1f')!=typeof _0x1a87fd[_0x2dcd('0x7b')]['views'][_0x2dcd('0x89')]){var _0x29c78b=_0x1a87fd[_0x2dcd('0x7b')][_0x2dcd('0x7f')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x29c78b)){_0x1b72c9=path[_0x2dcd('0x5c')](_0x2dcd('0x8b'),_0x226686,_0x229966[0x0],_0x29c78b);}else{_0x1b72c9=_0x29c78b;}}if(_0x2dcd('0x1f')!=typeof _0x1a87fd[_0x2dcd('0x7b')][_0x2dcd('0x7f')]['agent']){var _0x86a26c=_0x1a87fd[_0x2dcd('0x7b')][_0x2dcd('0x7f')][_0x2dcd('0x80')];if(!/^(f|ht)tps?:\/\//i['test'](_0x86a26c)){_0x297927=path[_0x2dcd('0x5c')](_0x2dcd('0x8b'),_0x226686,_0x229966[0x0],_0x86a26c);}else{_0x297927=_0x86a26c;}}}}var _0x2b38cf={'name':_0x559e8e,'description':_0xf75d06,'path':path[_0x2dcd('0x5c')](_0x226686,_0x229966[0x0]),'type':_0x3362d9,'sidebar':_0x316e31,'icon':_0x53908d,'adminUrl':_0x1b72c9,'agentUrl':_0x297927,'scriptName':_0x592e9d,'scriptPath':_0xcff5d,'version':_0x44226b};removeReferences(_0x50e6d3,null);return db[_0x2dcd('0x32')][_0x2dcd('0x8f')](_0x2b38cf)[_0x2dcd('0x28')](function(_0x3be897){var _0x15e09d={'role':_0x9590bc[_0x2dcd('0x90')][_0x2dcd('0x91')],'userProfileId':_0x9590bc[_0x2dcd('0x90')][_0x2dcd('0x92')]};if(!_0x15e09d)throw new Error(_0x2dcd('0x93'));if(_0x15e09d[_0x2dcd('0x91')]==='user'){var _0x2d2438=_0x3be897[_0x2dcd('0x2a')]({'plain':!![]});return db[_0x2dcd('0x94')][_0x2dcd('0x4d')]({'where':{'name':'Plugins','userProfileId':_0x15e09d[_0x2dcd('0x92')]},'raw':!![]})[_0x2dcd('0x28')](function(_0x499fdc){if(_0x499fdc&&_0x499fdc[_0x2dcd('0x95')]===0x0){return db[_0x2dcd('0x96')]['create']({'name':_0x2d2438[_0x2dcd('0x2f')],'resourceId':_0x2d2438['id'],'type':_0x499fdc['name'],'sectionId':_0x499fdc['id']},{})[_0x2dcd('0x28')](function(){return _0x3be897;});}else{return _0x3be897;}})[_0x2dcd('0x4c')](function(_0x26e892){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x26e892);throw _0x26e892;});}return _0x3be897;})[_0x2dcd('0x28')](respondWithResult(_0x5dd813,null))[_0x2dcd('0x4c')](handleError(_0x5dd813,null));}});}catch(_0xd5b887){_0x5dd813[_0x2dcd('0x1c')](0x1f4)[_0x2dcd('0x30')](_0xd5b887);}};function removeReferences(_0x5880f3,_0x1ccd72){try{if(_0x5880f3){fs[_0x2dcd('0x65')](_0x5880f3);logger[_0x2dcd('0x66')](_0x2dcd('0x97'));}if(_0x1ccd72){rimraf(_0x1ccd72,function(){});logger[_0x2dcd('0x66')](_0x2dcd('0x98'));}}catch(_0x3aa581){logger[_0x2dcd('0x2d')](_0x3aa581);}}exports[_0x2dcd('0x27')]=function(_0x11964a,_0x34b5ff,_0xae9a3c){return db['Plugin'][_0x2dcd('0x4d')]({'where':{'id':_0x11964a[_0x2dcd('0x4e')]['id']}})['then'](handleEntityNotFound(_0x34b5ff,null))[_0x2dcd('0x28')](saveUpdates(_0x11964a[_0x2dcd('0x90')],null))[_0x2dcd('0x28')](respondWithResult(_0x34b5ff,null))[_0x2dcd('0x4c')](handleError(_0x34b5ff,null));};exports['delete']=function(_0x1914c8,_0x33a554,_0x456162){return db[_0x2dcd('0x32')][_0x2dcd('0x4d')]({'where':{'id':_0x1914c8[_0x2dcd('0x4e')]['id']}})[_0x2dcd('0x28')](function(_0xe0d90d){if(_0xe0d90d){return _0xe0d90d[_0x2dcd('0x29')]();}})[_0x2dcd('0x28')](function(_0x37b2c1){rimraf(path[_0x2dcd('0x5c')](config[_0x2dcd('0x5d')],_0x2dcd('0x6d'),path[_0x2dcd('0x5e')](_0x37b2c1['path'])),function(){});return _0x37b2c1;})['then'](handleEntityNotFound(_0x33a554,null))['then'](respondWithStatusCode(_0x33a554,null))[_0x2dcd('0x4c')](handleError(_0x33a554,null));};exports[_0x2dcd('0x99')]=function(_0x1c0dd7,_0x4171b0,_0x2d2ce9){return BPromise[_0x2dcd('0x9a')]()[_0x2dcd('0x28')](function(){if(!_0x1c0dd7[_0x2dcd('0x38')][_0x2dcd('0x4f')]){throw new Error(_0x2dcd('0x9b'));}if(!_0x1c0dd7[_0x2dcd('0x38')]['port']){throw new Error(_0x2dcd('0x9c'));}var _0x34b62f=_0x1c0dd7[_0x2dcd('0x38')][_0x2dcd('0x9d')]?_0x1c0dd7[_0x2dcd('0x38')][_0x2dcd('0x9d')]+':'+_0x1c0dd7[_0x2dcd('0x38')][_0x2dcd('0x9e')]:_0x2dcd('0x9f')+_0x1c0dd7[_0x2dcd('0x38')][_0x2dcd('0x9e')];var _0x3725e1=_0x1c0dd7[_0x2dcd('0x38')]['json']?_0x1c0dd7[_0x2dcd('0x38')][_0x2dcd('0x1d')]:!![];var _0x2239dc=_0x1c0dd7[_0x2dcd('0x38')][_0x2dcd('0xa0')]?_0x1c0dd7[_0x2dcd('0x38')][_0x2dcd('0xa0')]:null;var _0x5c1dc4={'method':_0x1c0dd7[_0x2dcd('0xa1')],'uri':util[_0x2dcd('0x64')]('%s%s',_0x34b62f,_0x1c0dd7['query'][_0x2dcd('0x4f')]),'json':_0x3725e1,'resolveWithFullResponse':!![],'encoding':_0x2239dc,'qs':_0x1c0dd7[_0x2dcd('0x38')]};if(_0x1c0dd7[_0x2dcd('0xa2')]){_0x5c1dc4[_0x2dcd('0xa2')]=_0x1c0dd7['headers'];if(_0x5c1dc4[_0x2dcd('0xa2')][_0x2dcd('0xa3')]){delete _0x5c1dc4[_0x2dcd('0xa2')][_0x2dcd('0xa3')];}}if(_0x5c1dc4['headers'][_0x2dcd('0xa4')]){delete _0x5c1dc4[_0x2dcd('0xa2')][_0x2dcd('0xa4')];}return rp(_0x5c1dc4);})[_0x2dcd('0x28')](function(_0x5ec70c){if(_0x5ec70c){_0x4171b0[_0x2dcd('0x22')](_0x5ec70c[_0x2dcd('0xa2')]);logger['info'](_0x5ec70c[_0x2dcd('0x90')]);if(_[_0x2dcd('0xa5')](_0x1c0dd7[_0x2dcd('0x38')][_0x2dcd('0x4f')],_0x2dcd('0x63'))&&_0x5ec70c[_0x2dcd('0xa6')]==0x1f4){return _0x4171b0[_0x2dcd('0x1b')](_0x5ec70c[_0x2dcd('0xa6')]);}else{return _0x4171b0[_0x2dcd('0x1c')](_0x5ec70c[_0x2dcd('0xa6')])[_0x2dcd('0x30')](_0x5ec70c[_0x2dcd('0x90')]);}}else{return _0x4171b0[_0x2dcd('0x1b')](0xc8);}})['catch'](handleError(_0x4171b0,null));};exports[_0x2dcd('0xa7')]=function(_0x40084d,_0x38b551,_0x5177a2){return BPromise[_0x2dcd('0x9a')]()[_0x2dcd('0x28')](function(){if(!_0x40084d['query'][_0x2dcd('0x4f')]){throw new Error(_0x2dcd('0x9b'));}if(!_0x40084d[_0x2dcd('0x38')]['port']){throw new Error(_0x2dcd('0x9c'));}var _0x1443a3=_0x40084d['query'][_0x2dcd('0x9d')]?_0x40084d[_0x2dcd('0x38')][_0x2dcd('0x9d')]+':'+_0x40084d['query'][_0x2dcd('0x9e')]:_0x2dcd('0x9f')+_0x40084d['query'][_0x2dcd('0x9e')];var _0x3d9eaf=_0x40084d[_0x2dcd('0x38')]['json']?_0x40084d[_0x2dcd('0x38')]['json']:!![];var _0x224c34=_0x40084d[_0x2dcd('0x38')][_0x2dcd('0xa0')]?_0x40084d[_0x2dcd('0x38')][_0x2dcd('0xa0')]:null;var _0x102ef8={'method':_0x40084d[_0x2dcd('0xa1')],'uri':util[_0x2dcd('0x64')](_0x2dcd('0xa8'),_0x1443a3,_0x40084d[_0x2dcd('0x38')][_0x2dcd('0x4f')]),'json':_0x3d9eaf,'resolveWithFullResponse':!![],'encoding':_0x224c34,'body':_0x40084d[_0x2dcd('0x90')]};if(_0x40084d['headers']){_0x102ef8[_0x2dcd('0xa2')]=_0x40084d[_0x2dcd('0xa2')];if(_0x102ef8[_0x2dcd('0xa2')][_0x2dcd('0xa3')]){delete _0x102ef8[_0x2dcd('0xa2')][_0x2dcd('0xa3')];}}if(_0x102ef8[_0x2dcd('0xa2')][_0x2dcd('0xa4')]){delete _0x102ef8['headers'][_0x2dcd('0xa4')];}return rp(_0x102ef8);})[_0x2dcd('0x28')](function(_0x1e2fc6){if(_0x1e2fc6){_0x38b551[_0x2dcd('0x22')](_0x1e2fc6[_0x2dcd('0xa2')]);logger['info'](_0x1e2fc6['body']);return _0x38b551[_0x2dcd('0x1c')](_0x1e2fc6[_0x2dcd('0xa6')])[_0x2dcd('0x30')](_0x1e2fc6[_0x2dcd('0x90')]);}else{return _0x38b551['sendStatus'](0xc8);}})[_0x2dcd('0x4c')](handleError(_0x38b551,null));}; \ No newline at end of file +var _0xeeb5=['webhookPost','hostname','content-type','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','extract-zip','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','map','Plugin','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','path','join','root','server/files/plugins','format','basename','createWriteStream','zip','warning','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','dirname','node_modules/**/*','finalize','close','Plugin\x20not\x20found','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','upload','extname','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','some','manifest.json','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','sidebar','always','icon','icon-apps','version','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Plugins','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','http://localhost:','encoding','method','%s%s','headers','content-length','download','statusCode'];(function(_0x501fd1,_0x437b43){var _0x33f81e=function(_0x4e660f){while(--_0x4e660f){_0x501fd1['push'](_0x501fd1['shift']());}};_0x33f81e(++_0x437b43);}(_0xeeb5,0xaf));var _0x5eeb=function(_0xb6c185,_0x1fba89){_0xb6c185=_0xb6c185-0x0;var _0x18717b=_0xeeb5[_0xb6c185];return _0x18717b;};'use strict';var emlformat=require(_0x5eeb('0x0'));var rimraf=require(_0x5eeb('0x1'));var zipdir=require(_0x5eeb('0x2'));var jsonpatch=require(_0x5eeb('0x3'));var rp=require('request-promise');var moment=require(_0x5eeb('0x4'));var BPromise=require(_0x5eeb('0x5'));var Mustache=require(_0x5eeb('0x6'));var util=require(_0x5eeb('0x7'));var path=require('path');var sox=require(_0x5eeb('0x8'));var csv=require(_0x5eeb('0x9'));var ejs=require(_0x5eeb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5eeb('0xb'));var crypto=require(_0x5eeb('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5eeb('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5eeb('0xe'));var Papa=require('papaparse');var extract=require(_0x5eeb('0xf'));var rimraf=require(_0x5eeb('0x1'));var archiver=require('archiver');var Redis=require(_0x5eeb('0x10'));var authService=require(_0x5eeb('0x11'));var qs=require(_0x5eeb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5eeb('0x13'));var logger=require(_0x5eeb('0x14'))(_0x5eeb('0x15'));var utils=require(_0x5eeb('0x16'));var config=require(_0x5eeb('0x17'));var licenseUtil=require(_0x5eeb('0x18'));var db=require(_0x5eeb('0x19'))['db'];config[_0x5eeb('0x1a')]=_[_0x5eeb('0x1b')](config[_0x5eeb('0x1a')],{'host':_0x5eeb('0x1c'),'port':0x18eb});var socket=require(_0x5eeb('0x1d'))(new Redis(config[_0x5eeb('0x1a')]));require(_0x5eeb('0x1e'))[_0x5eeb('0x1f')](socket);function respondWithStatusCode(_0x2a8463,_0xf81037){_0xf81037=_0xf81037||0xcc;return function(_0x575f24){if(_0x575f24){return _0x2a8463[_0x5eeb('0x20')](_0xf81037);}return _0x2a8463[_0x5eeb('0x21')](_0xf81037)[_0x5eeb('0x22')]();};}function respondWithResult(_0x10d7c7,_0x38aa94){_0x38aa94=_0x38aa94||0xc8;return function(_0x172442){if(_0x172442){return _0x10d7c7[_0x5eeb('0x21')](_0x38aa94)[_0x5eeb('0x23')](_0x172442);}};}function respondWithFilteredResult(_0x485fec,_0x1ef789){return function(_0x5a2ddc){if(_0x5a2ddc){var _0x504178=typeof _0x1ef789[_0x5eeb('0x24')]===_0x5eeb('0x25')&&typeof _0x1ef789[_0x5eeb('0x26')]===_0x5eeb('0x25');var _0x6a7ca8=_0x5a2ddc[_0x5eeb('0x27')];var _0x405aed=_0x504178?0x0:_0x1ef789['offset'];var _0x5319ea=_0x504178?_0x5a2ddc['count']:_0x1ef789['offset']+_0x1ef789[_0x5eeb('0x26')];var _0x28bc16;if(_0x5319ea>=_0x6a7ca8){_0x5319ea=_0x6a7ca8;_0x28bc16=0xc8;}else{_0x28bc16=0xce;}_0x485fec['status'](_0x28bc16);return _0x485fec[_0x5eeb('0x28')](_0x5eeb('0x29'),_0x405aed+'-'+_0x5319ea+'/'+_0x6a7ca8)[_0x5eeb('0x23')](_0x5a2ddc);}return null;};}function patchUpdates(_0x336460){return function(_0x2bf708){try{jsonpatch[_0x5eeb('0x2a')](_0x2bf708,_0x336460,!![]);}catch(_0x42e14b){return BPromise[_0x5eeb('0x2b')](_0x42e14b);}return _0x2bf708[_0x5eeb('0x2c')]();};}function saveUpdates(_0x4ed848,_0x25ae4b){return function(_0x37f73a){if(_0x37f73a){return _0x37f73a[_0x5eeb('0x2d')](_0x4ed848)[_0x5eeb('0x2e')](function(_0x4c23ce){return _0x4c23ce;});}return null;};}function removeEntity(_0x887756,_0x3926e5){return function(_0x4940ca){if(_0x4940ca){return _0x4940ca[_0x5eeb('0x2f')]()[_0x5eeb('0x2e')](function(){var _0x46d645=_0x4940ca[_0x5eeb('0x30')]({'plain':!![]});var _0x453199='Plugins';return db[_0x5eeb('0x31')][_0x5eeb('0x2f')]({'where':{'type':_0x453199,'resourceId':_0x46d645['id']}})['then'](function(){return _0x4940ca;});})['then'](function(){_0x887756[_0x5eeb('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x227e4b,_0x2b36e8){return function(_0x485c21){if(!_0x485c21){_0x227e4b['sendStatus'](0x194);}return _0x485c21;};}function handleError(_0x417eca,_0x47affb){_0x47affb=_0x47affb||0x1f4;return function(_0x397539){logger[_0x5eeb('0x32')](_0x397539[_0x5eeb('0x33')]);if(_0x397539['name']){delete _0x397539[_0x5eeb('0x34')];}_0x417eca[_0x5eeb('0x21')](_0x47affb)['send'](_0x397539);};}exports['index']=function(_0xd3bfb2,_0x4e4a4e){var _0x554d3e={},_0x52fc22={},_0x4e3968={'count':0x0,'rows':[]};var _0x3ef12b=_[_0x5eeb('0x35')](db[_0x5eeb('0x36')][_0x5eeb('0x37')],function(_0x5659cd){return{'name':_0x5659cd[_0x5eeb('0x38')],'type':_0x5659cd['type']['key']};});_0x52fc22[_0x5eeb('0x39')]=_[_0x5eeb('0x35')](_0x3ef12b,_0x5eeb('0x34'));_0x52fc22[_0x5eeb('0x3a')]=_[_0x5eeb('0x3b')](_0xd3bfb2[_0x5eeb('0x3a')]);_0x52fc22[_0x5eeb('0x3c')]=_[_0x5eeb('0x3d')](_0x52fc22[_0x5eeb('0x39')],_0x52fc22['query']);_0x554d3e[_0x5eeb('0x3e')]=_[_0x5eeb('0x3d')](_0x52fc22[_0x5eeb('0x39')],qs[_0x5eeb('0x3f')](_0xd3bfb2[_0x5eeb('0x3a')][_0x5eeb('0x3f')]));_0x554d3e[_0x5eeb('0x3e')]=_0x554d3e[_0x5eeb('0x3e')][_0x5eeb('0x40')]?_0x554d3e[_0x5eeb('0x3e')]:_0x52fc22['model'];if(!_0xd3bfb2[_0x5eeb('0x3a')]['hasOwnProperty'](_0x5eeb('0x41'))){_0x554d3e[_0x5eeb('0x26')]=qs[_0x5eeb('0x26')](_0xd3bfb2[_0x5eeb('0x3a')][_0x5eeb('0x26')]);_0x554d3e[_0x5eeb('0x24')]=qs[_0x5eeb('0x24')](_0xd3bfb2[_0x5eeb('0x3a')][_0x5eeb('0x24')]);}_0x554d3e[_0x5eeb('0x42')]=qs[_0x5eeb('0x43')](_0xd3bfb2[_0x5eeb('0x3a')]['sort']);_0x554d3e[_0x5eeb('0x44')]=qs[_0x5eeb('0x3c')](_[_0x5eeb('0x45')](_0xd3bfb2[_0x5eeb('0x3a')],_0x52fc22[_0x5eeb('0x3c')]),_0x3ef12b);if(_0xd3bfb2[_0x5eeb('0x3a')][_0x5eeb('0x46')]){_0x554d3e['where']=_[_0x5eeb('0x47')](_0x554d3e['where'],{'$or':_[_0x5eeb('0x35')](_0x3ef12b,function(_0x19073c){if(_0x19073c[_0x5eeb('0x48')]!==_0x5eeb('0x49')){var _0x464083={};_0x464083[_0x19073c[_0x5eeb('0x34')]]={'$like':'%'+_0xd3bfb2[_0x5eeb('0x3a')][_0x5eeb('0x46')]+'%'};return _0x464083;}})});}_0x554d3e=_[_0x5eeb('0x47')]({},_0x554d3e,_0xd3bfb2[_0x5eeb('0x4a')]);var _0x285a3b={'where':_0x554d3e[_0x5eeb('0x44')]};return db[_0x5eeb('0x36')]['count'](_0x285a3b)[_0x5eeb('0x2e')](function(_0xcd3535){_0x4e3968[_0x5eeb('0x27')]=_0xcd3535;if(_0xd3bfb2[_0x5eeb('0x3a')][_0x5eeb('0x4b')]){_0x554d3e[_0x5eeb('0x4c')]=[{'all':!![]}];}return db[_0x5eeb('0x36')][_0x5eeb('0x4d')](_0x554d3e);})['then'](function(_0x1ca9c5){_0x4e3968[_0x5eeb('0x4e')]=_0x1ca9c5;return _0x4e3968;})[_0x5eeb('0x2e')](respondWithFilteredResult(_0x4e4a4e,_0x554d3e))[_0x5eeb('0x4f')](handleError(_0x4e4a4e,null));};exports['show']=function(_0x19b8f4,_0x122b4e){var _0x39db51={'raw':!![],'where':{'id':_0x19b8f4[_0x5eeb('0x50')]['id']}},_0x19e69e={};_0x19e69e['model']=_[_0x5eeb('0x3b')](db[_0x5eeb('0x36')]['rawAttributes']);_0x19e69e[_0x5eeb('0x3a')]=_[_0x5eeb('0x3b')](_0x19b8f4[_0x5eeb('0x3a')]);_0x19e69e[_0x5eeb('0x3c')]=_[_0x5eeb('0x3d')](_0x19e69e[_0x5eeb('0x39')],_0x19e69e[_0x5eeb('0x3a')]);_0x39db51['attributes']=_['intersection'](_0x19e69e[_0x5eeb('0x39')],qs[_0x5eeb('0x3f')](_0x19b8f4[_0x5eeb('0x3a')][_0x5eeb('0x3f')]));_0x39db51[_0x5eeb('0x3e')]=_0x39db51[_0x5eeb('0x3e')][_0x5eeb('0x40')]?_0x39db51[_0x5eeb('0x3e')]:_0x19e69e[_0x5eeb('0x39')];if(_0x19b8f4[_0x5eeb('0x3a')][_0x5eeb('0x4b')]){_0x39db51['include']=[{'all':!![]}];}_0x39db51=_['merge']({},_0x39db51,_0x19b8f4['options']);return db[_0x5eeb('0x36')][_0x5eeb('0x51')](_0x39db51)[_0x5eeb('0x2e')](handleEntityNotFound(_0x122b4e,null))['then'](respondWithResult(_0x122b4e,null))[_0x5eeb('0x4f')](handleError(_0x122b4e,null));};exports['download']=function(_0x4961e5,_0x292bec,_0x1cc4a1){return db[_0x5eeb('0x36')][_0x5eeb('0x51')]({'where':{'id':_0x4961e5['params']['id']},'attributes':[_0x5eeb('0x34'),_0x5eeb('0x52')],'raw':!![]})[_0x5eeb('0x2e')](handleEntityNotFound(_0x292bec,null))[_0x5eeb('0x2e')](function(_0x14eb56){if(_0x14eb56){var _0x5dc0bb=path[_0x5eeb('0x53')](config[_0x5eeb('0x54')],_0x5eeb('0x55'),util[_0x5eeb('0x56')]('%s.zip',path[_0x5eeb('0x57')](_0x14eb56[_0x5eeb('0x52')])));var _0x412075=fs[_0x5eeb('0x58')](_0x5dc0bb);var _0x424966=archiver(_0x5eeb('0x59'),{'zlib':{'level':0x9}});_0x424966['on'](_0x5eeb('0x5a'),function(_0x20563d){if(_0x20563d['code']===_0x5eeb('0x5b')){logger[_0x5eeb('0x32')](_0x20563d);}else{throw new db[(_0x5eeb('0x5c'))][(_0x5eeb('0x5d'))](_0x5eeb('0x5e'));}});_0x424966['on']('error',function(_0x17e235){throw new db[(_0x5eeb('0x5c'))][(_0x5eeb('0x5d'))](_0x5eeb('0x5e'));});_0x424966['pipe'](_0x412075);_0x424966[_0x5eeb('0x5f')](_0x5eeb('0x60'),{'cwd':path[_0x5eeb('0x53')](config['root'],'server/files/plugins',path[_0x5eeb('0x61')](_0x14eb56[_0x5eeb('0x52')])),'ignore':[path[_0x5eeb('0x53')](path[_0x5eeb('0x57')](_0x14eb56['path']),_0x5eeb('0x62')),path[_0x5eeb('0x53')](path['basename'](_0x14eb56[_0x5eeb('0x52')]),'attachments/**/*')],'nodir':!![]})[_0x5eeb('0x63')]();_0x412075['on'](_0x5eeb('0x64'),function(){if(!fs['existsSync'](_0x5dc0bb)){throw new db[(_0x5eeb('0x5c'))][(_0x5eeb('0x5d'))](_0x5eeb('0x65'));}return _0x292bec['download'](_0x5dc0bb,util[_0x5eeb('0x56')](_0x5eeb('0x66'),path[_0x5eeb('0x57')](_0x14eb56[_0x5eeb('0x52')])),function(_0x1b4958){if(_0x1b4958){throw new db[(_0x5eeb('0x5c'))][(_0x5eeb('0x5d'))](_0x5eeb('0x67'));}fs[_0x5eeb('0x68')](_0x5dc0bb);logger['info'](_0x5eeb('0x69'));logger[_0x5eeb('0x6a')](_0x5eeb('0x6b'));});});}return null;})[_0x5eeb('0x4f')](handleError(_0x292bec,null));};exports[_0x5eeb('0x6c')]=function(_0x226f1e,_0x495ec6,_0x4d2c5c){var _0x35f5e6=path[_0x5eeb('0x57')](_0x226f1e['file']['filename'],path[_0x5eeb('0x6d')](_0x226f1e[_0x5eeb('0x6e')][_0x5eeb('0x6f')]));var _0x4011a6=path['join'](config[_0x5eeb('0x54')],_0x5eeb('0x55'),_0x226f1e[_0x5eeb('0x6e')][_0x5eeb('0x6f')]);var _0x521a72=path[_0x5eeb('0x53')](config[_0x5eeb('0x54')],_0x5eeb('0x55'),_0x35f5e6);logger[_0x5eeb('0x6a')](_0x5eeb('0x70'),_0x4011a6);logger[_0x5eeb('0x6a')](_0x5eeb('0x71'),_0x521a72);try{fs[_0x5eeb('0x72')](_0x4011a6,parseInt(_0x5eeb('0x73'),0x8));extract(_0x4011a6,{'dir':_0x521a72},function(_0x5d58fe){if(_0x5d58fe){logger[_0x5eeb('0x32')](_0x5d58fe);handleError(_0x5d58fe,!![]);};var _0x46d0e4=fs[_0x5eeb('0x74')](_0x521a72);if(_0x46d0e4[_0x5eeb('0x40')]>0x1){removeReferences(_0x4011a6,_0x521a72);logger['error']('Invalid\x20plugin\x20structure');return _0x4d2c5c(new Error(_0x5eeb('0x75')));}var _0x267d92=fs[_0x5eeb('0x76')](path[_0x5eeb('0x53')](_0x521a72,_0x46d0e4[0x0]));if(_0x267d92['isFile']()){removeReferences(_0x4011a6,_0x521a72);logger[_0x5eeb('0x32')]('Invalid\x20plugin\x20structure');return _0x4d2c5c(new Error(_0x5eeb('0x75')));}if(_0x267d92[_0x5eeb('0x77')]()){var _0x5bc320=fs[_0x5eeb('0x74')](path[_0x5eeb('0x53')](_0x521a72,_0x46d0e4[0x0]));if(_0x5bc320[_0x5eeb('0x40')]===0x0){removeReferences(_0x4011a6,_0x521a72);logger[_0x5eeb('0x32')](_0x5eeb('0x75'));return _0x4d2c5c(new Error(_0x5eeb('0x75')));}var _0x31f2fc=_0x5bc320[_0x5eeb('0x78')](function(_0x2ff5b0){return _0x2ff5b0===_0x5eeb('0x79');});if(!_0x31f2fc){return _0x4d2c5c(new Error('Plugin\x20manifest\x20missing'));}var _0x5983bf=fs['readFileSync'](path[_0x5eeb('0x53')](_0x521a72,_0x46d0e4[0x0],_0x5eeb('0x79')));var _0x58780c=JSON['parse'](_0x5983bf);if(_0x5eeb('0x25')==typeof _0x58780c[_0x5eeb('0x34')]){return _0x4d2c5c(new Error(_0x5eeb('0x7a')));}if(_0x5eeb('0x25')==typeof _0x58780c[_0x5eeb('0x48')]){return _0x4d2c5c(new Error(_0x5eeb('0x7b')));}if(_0x5eeb('0x25')==typeof _0x58780c['version']){return _0x4d2c5c(new Error(_0x5eeb('0x7c')));}if(_0x5eeb('0x25')==typeof _0x58780c[_0x5eeb('0x7d')]){return _0x4d2c5c(new Error(_0x5eeb('0x7e')));}if(_0x58780c['type']===_0x5eeb('0x7f')){if('undefined'==typeof _0x58780c[_0x5eeb('0x7d')][_0x5eeb('0x80')]){return _0x4d2c5c(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x5eeb('0x25')==typeof _0x58780c['parameters'][_0x5eeb('0x80')][_0x5eeb('0x81')]&&_0x5eeb('0x25')==typeof _0x58780c['parameters']['views'][_0x5eeb('0x82')]){return _0x4d2c5c(new Error(_0x5eeb('0x83')));}}else if(_0x58780c[_0x5eeb('0x48')]===_0x5eeb('0x84')){if(_0x5eeb('0x25')==typeof _0x58780c[_0x5eeb('0x7d')]['scriptName']){return _0x4d2c5c(new Error(_0x5eeb('0x85')));}if(_0x5eeb('0x25')==typeof _0x58780c['parameters'][_0x5eeb('0x86')]){return _0x4d2c5c(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x4d2c5c(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x548c13=_0x58780c[_0x5eeb('0x34')];var _0x5c7b4e=_0x58780c['description'];var _0x26b091=_0x58780c['type'];var _0x5c843e=_0x58780c['sidebar']?_0x58780c[_0x5eeb('0x87')]:_0x5eeb('0x88');var _0x2c61b4=_0x58780c[_0x5eeb('0x89')]?_0x58780c[_0x5eeb('0x89')]:_0x5eeb('0x8a');var _0x435de6='';var _0x5e0a7f='';var _0x17d2db='';var _0x5c34c3='';var _0xb5bb7f=_0x58780c[_0x5eeb('0x8b')];if(_0x26b091===_0x5eeb('0x7f')){if(_0x5eeb('0x25')!=typeof _0x58780c[_0x5eeb('0x7d')][_0x5eeb('0x80')][_0x5eeb('0x81')]){var _0xff1f78=_0x58780c['parameters'][_0x5eeb('0x80')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x5eeb('0x8c')](_0xff1f78)){_0x435de6=path['join'](_0x5eeb('0x8d'),_0x35f5e6,_0x46d0e4[0x0],_0xff1f78);}else{_0x435de6=_0xff1f78;}}else{logger[_0x5eeb('0x6a')](_0x5eeb('0x8e'));}if('undefined'!=typeof _0x58780c[_0x5eeb('0x7d')][_0x5eeb('0x80')][_0x5eeb('0x82')]){var _0x2360df=_0x58780c[_0x5eeb('0x7d')]['views'][_0x5eeb('0x82')];if(!/^(f|ht)tps?:\/\//i[_0x5eeb('0x8c')](_0x2360df)){_0x5e0a7f=path[_0x5eeb('0x53')](_0x5eeb('0x8d'),_0x35f5e6,_0x46d0e4[0x0],_0x2360df);}else{_0x5e0a7f=_0x2360df;}}else{logger[_0x5eeb('0x6a')](_0x5eeb('0x8f'));}}else if(_0x26b091===_0x5eeb('0x84')){_0x17d2db=_0x58780c[_0x5eeb('0x7d')]['scriptName'];_0x5c34c3=_0x58780c['parameters'][_0x5eeb('0x86')];if(_0x5eeb('0x25')!=typeof _0x58780c['parameters'][_0x5eeb('0x80')]){if(_0x5eeb('0x25')!=typeof _0x58780c[_0x5eeb('0x7d')][_0x5eeb('0x80')][_0x5eeb('0x81')]){var _0xff1f78=_0x58780c[_0x5eeb('0x7d')][_0x5eeb('0x80')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0xff1f78)){_0x435de6=path['join'](_0x5eeb('0x8d'),_0x35f5e6,_0x46d0e4[0x0],_0xff1f78);}else{_0x435de6=_0xff1f78;}}if('undefined'!=typeof _0x58780c[_0x5eeb('0x7d')]['views'][_0x5eeb('0x82')]){var _0x2360df=_0x58780c[_0x5eeb('0x7d')][_0x5eeb('0x80')][_0x5eeb('0x82')];if(!/^(f|ht)tps?:\/\//i[_0x5eeb('0x8c')](_0x2360df)){_0x5e0a7f=path[_0x5eeb('0x53')](_0x5eeb('0x8d'),_0x35f5e6,_0x46d0e4[0x0],_0x2360df);}else{_0x5e0a7f=_0x2360df;}}}}var _0x30985a={'name':_0x548c13,'description':_0x5c7b4e,'path':path[_0x5eeb('0x53')](_0x35f5e6,_0x46d0e4[0x0]),'type':_0x26b091,'sidebar':_0x5c843e,'icon':_0x2c61b4,'adminUrl':_0x435de6,'agentUrl':_0x5e0a7f,'scriptName':_0x17d2db,'scriptPath':_0x5c34c3,'version':_0xb5bb7f};removeReferences(_0x4011a6,null);return db[_0x5eeb('0x36')][_0x5eeb('0x90')](_0x30985a)[_0x5eeb('0x2e')](function(_0x5de410){var _0x26e9f1={'role':_0x226f1e[_0x5eeb('0x91')][_0x5eeb('0x92')],'userProfileId':_0x226f1e['body'][_0x5eeb('0x93')]};if(!_0x26e9f1)throw new Error(_0x5eeb('0x94'));if(_0x26e9f1[_0x5eeb('0x92')]===_0x5eeb('0x95')){var _0xb08cee=_0x5de410[_0x5eeb('0x30')]({'plain':!![]});return db[_0x5eeb('0x96')]['find']({'where':{'name':_0x5eeb('0x97'),'userProfileId':_0x26e9f1[_0x5eeb('0x93')]},'raw':!![]})['then'](function(_0x2e2c1e){if(_0x2e2c1e&&_0x2e2c1e['autoAssociation']===0x0){return db[_0x5eeb('0x31')][_0x5eeb('0x90')]({'name':_0xb08cee['name'],'resourceId':_0xb08cee['id'],'type':_0x2e2c1e[_0x5eeb('0x34')],'sectionId':_0x2e2c1e['id']},{})['then'](function(){return _0x5de410;});}else{return _0x5de410;}})[_0x5eeb('0x4f')](function(_0x49ea07){logger[_0x5eeb('0x32')](_0x5eeb('0x98'),_0x49ea07);throw _0x49ea07;});}return _0x5de410;})['then'](respondWithResult(_0x495ec6,null))[_0x5eeb('0x4f')](handleError(_0x495ec6,null));}});}catch(_0x2cb722){_0x495ec6[_0x5eeb('0x21')](0x1f4)[_0x5eeb('0x99')](_0x2cb722);}};function removeReferences(_0x18e652,_0x59b14d){try{if(_0x18e652){fs[_0x5eeb('0x68')](_0x18e652);logger[_0x5eeb('0x6a')](_0x5eeb('0x9a'));}if(_0x59b14d){rimraf(_0x59b14d,function(){});logger[_0x5eeb('0x6a')](_0x5eeb('0x9b'));}}catch(_0x525a17){logger[_0x5eeb('0x32')](_0x525a17);}}exports[_0x5eeb('0x2d')]=function(_0x2c4df3,_0x4188ad,_0xd99634){return db[_0x5eeb('0x36')][_0x5eeb('0x51')]({'where':{'id':_0x2c4df3['params']['id']}})['then'](handleEntityNotFound(_0x4188ad,null))[_0x5eeb('0x2e')](saveUpdates(_0x2c4df3['body'],null))[_0x5eeb('0x2e')](respondWithResult(_0x4188ad,null))[_0x5eeb('0x4f')](handleError(_0x4188ad,null));};exports[_0x5eeb('0x9c')]=function(_0x205138,_0x1458e9,_0x5ae895){return db[_0x5eeb('0x36')][_0x5eeb('0x51')]({'where':{'id':_0x205138[_0x5eeb('0x50')]['id']}})[_0x5eeb('0x2e')](function(_0x42a3fb){if(_0x42a3fb){return _0x42a3fb[_0x5eeb('0x2f')]();}})[_0x5eeb('0x2e')](function(_0x15b89a){rimraf(path[_0x5eeb('0x53')](config[_0x5eeb('0x54')],_0x5eeb('0x55'),path[_0x5eeb('0x61')](_0x15b89a[_0x5eeb('0x52')])),function(){});return _0x15b89a;})[_0x5eeb('0x2e')](handleEntityNotFound(_0x1458e9,null))[_0x5eeb('0x2e')](respondWithStatusCode(_0x1458e9,null))[_0x5eeb('0x4f')](handleError(_0x1458e9,null));};exports[_0x5eeb('0x9d')]=function(_0x3aa68c,_0x3e0d33,_0x316dc5){return BPromise['resolve']()[_0x5eeb('0x2e')](function(){if(!_0x3aa68c[_0x5eeb('0x3a')][_0x5eeb('0x52')]){throw new Error(_0x5eeb('0x9e'));}if(!_0x3aa68c[_0x5eeb('0x3a')][_0x5eeb('0x9f')]){throw new Error(_0x5eeb('0xa0'));}var _0xb230a8=_0x3aa68c[_0x5eeb('0x3a')]['hostname']?_0x3aa68c[_0x5eeb('0x3a')]['hostname']+':'+_0x3aa68c[_0x5eeb('0x3a')]['port']:_0x5eeb('0xa1')+_0x3aa68c['query'][_0x5eeb('0x9f')];var _0x176e66=_0x3aa68c[_0x5eeb('0x3a')][_0x5eeb('0x23')]?_0x3aa68c[_0x5eeb('0x3a')][_0x5eeb('0x23')]:!![];var _0x215da9=_0x3aa68c[_0x5eeb('0x3a')][_0x5eeb('0xa2')]?_0x3aa68c['query']['encoding']:null;var _0x1baf30={'method':_0x3aa68c[_0x5eeb('0xa3')],'uri':util[_0x5eeb('0x56')](_0x5eeb('0xa4'),_0xb230a8,_0x3aa68c[_0x5eeb('0x3a')][_0x5eeb('0x52')]),'json':_0x176e66,'resolveWithFullResponse':!![],'encoding':_0x215da9,'qs':_0x3aa68c['query']};if(_0x3aa68c['headers']){_0x1baf30[_0x5eeb('0xa5')]=_0x3aa68c[_0x5eeb('0xa5')];if(_0x1baf30[_0x5eeb('0xa5')]['content-length']){delete _0x1baf30[_0x5eeb('0xa5')][_0x5eeb('0xa6')];}}if(_0x1baf30[_0x5eeb('0xa5')]['content-type']){delete _0x1baf30[_0x5eeb('0xa5')]['content-type'];}return rp(_0x1baf30);})['then'](function(_0x1b4802){if(_0x1b4802){_0x3e0d33[_0x5eeb('0x28')](_0x1b4802[_0x5eeb('0xa5')]);logger[_0x5eeb('0x6a')](_0x1b4802[_0x5eeb('0x91')]);if(_['endsWith'](_0x3aa68c['query'][_0x5eeb('0x52')],_0x5eeb('0xa7'))&&_0x1b4802[_0x5eeb('0xa8')]==0x1f4){return _0x3e0d33[_0x5eeb('0x20')](_0x1b4802[_0x5eeb('0xa8')]);}else{return _0x3e0d33[_0x5eeb('0x21')](_0x1b4802[_0x5eeb('0xa8')])['send'](_0x1b4802[_0x5eeb('0x91')]);}}else{return _0x3e0d33['sendStatus'](0xc8);}})[_0x5eeb('0x4f')](handleError(_0x3e0d33,null));};exports[_0x5eeb('0xa9')]=function(_0x1bb53b,_0x3d37da,_0x16ab1f){return BPromise['resolve']()['then'](function(){if(!_0x1bb53b[_0x5eeb('0x3a')][_0x5eeb('0x52')]){throw new Error(_0x5eeb('0x9e'));}if(!_0x1bb53b[_0x5eeb('0x3a')][_0x5eeb('0x9f')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x2489ac=_0x1bb53b[_0x5eeb('0x3a')][_0x5eeb('0xaa')]?_0x1bb53b[_0x5eeb('0x3a')][_0x5eeb('0xaa')]+':'+_0x1bb53b[_0x5eeb('0x3a')][_0x5eeb('0x9f')]:'http://localhost:'+_0x1bb53b['query'][_0x5eeb('0x9f')];var _0x3b4d98=_0x1bb53b[_0x5eeb('0x3a')][_0x5eeb('0x23')]?_0x1bb53b['query'][_0x5eeb('0x23')]:!![];var _0x58abf6=_0x1bb53b['query']['encoding']?_0x1bb53b[_0x5eeb('0x3a')][_0x5eeb('0xa2')]:null;var _0x172460={'method':_0x1bb53b[_0x5eeb('0xa3')],'uri':util[_0x5eeb('0x56')]('%s%s',_0x2489ac,_0x1bb53b[_0x5eeb('0x3a')][_0x5eeb('0x52')]),'json':_0x3b4d98,'resolveWithFullResponse':!![],'encoding':_0x58abf6,'body':_0x1bb53b[_0x5eeb('0x91')]};if(_0x1bb53b['headers']){_0x172460[_0x5eeb('0xa5')]=_0x1bb53b[_0x5eeb('0xa5')];if(_0x172460['headers'][_0x5eeb('0xa6')]){delete _0x172460['headers']['content-length'];}}if(_0x172460['headers']['content-type']){delete _0x172460[_0x5eeb('0xa5')][_0x5eeb('0xab')];}return rp(_0x172460);})['then'](function(_0x5f1649){if(_0x5f1649){_0x3d37da[_0x5eeb('0x28')](_0x5f1649[_0x5eeb('0xa5')]);logger[_0x5eeb('0x6a')](_0x5f1649[_0x5eeb('0x91')]);return _0x3d37da[_0x5eeb('0x21')](_0x5f1649[_0x5eeb('0xa8')])[_0x5eeb('0x99')](_0x5f1649[_0x5eeb('0x91')]);}else{return _0x3d37da['sendStatus'](0xc8);}})['catch'](handleError(_0x3d37da,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 2d370f3..f1ccfda 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 _0xad68=['remove','emit','hook','exports','Plugin','setMaxListeners'];(function(_0x26a906,_0x3d135c){var _0x495575=function(_0x2365af){while(--_0x2365af){_0x26a906['push'](_0x26a906['shift']());}};_0x495575(++_0x3d135c);}(_0xad68,0x100));var _0x8ad6=function(_0x37d3e0,_0x51d1f4){_0x37d3e0=_0x37d3e0-0x0;var _0x5512a3=_0xad68[_0x37d3e0];return _0x5512a3;};'use strict';var EventEmitter=require('events');var Plugin=require('../../mysqldb')['db'][_0x8ad6('0x0')];var PluginEvents=new EventEmitter();PluginEvents[_0x8ad6('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x8ad6('0x2')};function emitEvent(_0x2b533e){return function(_0x186cec,_0x1aec69,_0x11451d){PluginEvents[_0x8ad6('0x3')](_0x2b533e+':'+_0x186cec['id'],_0x186cec);PluginEvents[_0x8ad6('0x3')](_0x2b533e,_0x186cec);_0x11451d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x8ad6('0x4')](e,emitEvent(event));}}module[_0x8ad6('0x5')]=PluginEvents; \ No newline at end of file +var _0x00cd=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','update','remove'];(function(_0x5cfdc1,_0x151a46){var _0x2bf101=function(_0x3a8123){while(--_0x3a8123){_0x5cfdc1['push'](_0x5cfdc1['shift']());}};_0x2bf101(++_0x151a46);}(_0x00cd,0xee));var _0xd00c=function(_0x2272b5,_0x362458){_0x2272b5=_0x2272b5-0x0;var _0x110156=_0x00cd[_0x2272b5];return _0x110156;};'use strict';var EventEmitter=require(_0xd00c('0x0'));var Plugin=require(_0xd00c('0x1'))['db'][_0xd00c('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xd00c('0x3'),'afterDestroy':_0xd00c('0x4')};function emitEvent(_0x3057b7){return function(_0x2291b2,_0x2187fa,_0x5ab1ad){PluginEvents[_0xd00c('0x5')](_0x3057b7+':'+_0x2291b2['id'],_0x2291b2);PluginEvents[_0xd00c('0x5')](_0x3057b7,_0x2291b2);_0x5ab1ad(null);};}for(var e in events){if(events[_0xd00c('0x6')](e)){var event=events[e];Plugin[_0xd00c('0x7')](e,emitEvent(event));}}module[_0xd00c('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 72184f6..0fc9b2f 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 _0x50ec=['Plugin','plugins','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./plugin.attributes','exports','define'];(function(_0x40194b,_0x6b191b){var _0x3f9cdf=function(_0x4ce91e){while(--_0x4ce91e){_0x40194b['push'](_0x40194b['shift']());}};_0x3f9cdf(++_0x6b191b);}(_0x50ec,0xc5));var _0xc50e=function(_0x311925,_0x310c2c){_0x311925=_0x311925-0x0;var _0x1efd4b=_0x50ec[_0x311925];return _0x1efd4b;};'use strict';var _=require(_0xc50e('0x0'));var util=require(_0xc50e('0x1'));var logger=require('../../config/logger')(_0xc50e('0x2'));var moment=require(_0xc50e('0x3'));var BPromise=require(_0xc50e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc50e('0x5'));var rimraf=require(_0xc50e('0x6'));var config=require(_0xc50e('0x7'));var attributes=require(_0xc50e('0x8'));module[_0xc50e('0x9')]=function(_0x44609c,_0x197a81){return _0x44609c[_0xc50e('0xa')](_0xc50e('0xb'),attributes,{'tableName':_0xc50e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcfdc=['./plugin.attributes','exports','define','Plugin','plugins','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0xdeb405,_0x241bbf){var _0x1e92b2=function(_0x4c9f26){while(--_0x4c9f26){_0xdeb405['push'](_0xdeb405['shift']());}};_0x1e92b2(++_0x241bbf);}(_0xcfdc,0x14a));var _0xccfd=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xcfdc[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0xccfd('0x0'));var util=require(_0xccfd('0x1'));var logger=require(_0xccfd('0x2'))('api');var moment=require(_0xccfd('0x3'));var BPromise=require(_0xccfd('0x4'));var rp=require(_0xccfd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xccfd('0x6'));var config=require(_0xccfd('0x7'));var attributes=require(_0xccfd('0x8'));module[_0xccfd('0x9')]=function(_0x88be3e,_0x552147){return _0x88be3e[_0xccfd('0xa')](_0xccfd('0xb'),attributes,{'tableName':_0xccfd('0xc'),'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 5ef6b6e..725c037 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 _0x1655=['CreatePlugin','create','body','options','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','error','code','message','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1655,0x17c));var _0x5165=function(_0x268d05,_0x3d4735){_0x268d05=_0x268d05-0x0;var _0xf210c9=_0x1655[_0x268d05];return _0xf210c9;};'use strict';var _=require(_0x5165('0x0'));var util=require(_0x5165('0x1'));var moment=require(_0x5165('0x2'));var BPromise=require(_0x5165('0x3'));var rs=require(_0x5165('0x4'));var fs=require('fs');var Redis=require(_0x5165('0x5'));var db=require(_0x5165('0x6'))['db'];var utils=require(_0x5165('0x7'));var logger=require(_0x5165('0x8'))(_0x5165('0x9'));var config=require(_0x5165('0xa'));var jayson=require(_0x5165('0xb'));var client=jayson[_0x5165('0xc')][_0x5165('0xd')]({'port':0x232a});config[_0x5165('0xe')]=_[_0x5165('0xf')](config[_0x5165('0xe')],{'host':_0x5165('0x10'),'port':0x18eb});var socket=require(_0x5165('0x11'))(new Redis(config['redis']));require('./plugin.socket')[_0x5165('0x12')](socket);function respondWithRpcPromise(_0x3f15df,_0x2514cf,_0x3401e7){return new BPromise(function(_0x20ac7c,_0x37969c){return client['request'](_0x3f15df,_0x3401e7)[_0x5165('0x13')](function(_0x2354ef){logger[_0x5165('0x14')](_0x5165('0x15'),_0x2514cf,_0x5165('0x16'));logger['debug'](_0x5165('0x17'),_0x2514cf,_0x5165('0x16'),JSON['stringify'](_0x2354ef));if(_0x2354ef['error']){if(_0x2354ef[_0x5165('0x18')][_0x5165('0x19')]===0x1f4){logger[_0x5165('0x18')](_0x5165('0x15'),_0x2514cf,_0x2354ef['error'][_0x5165('0x1a')]);return _0x37969c(_0x2354ef[_0x5165('0x18')]['message']);}logger['error'](_0x5165('0x15'),_0x2514cf,_0x2354ef[_0x5165('0x18')][_0x5165('0x1a')]);return _0x20ac7c(_0x2354ef[_0x5165('0x18')][_0x5165('0x1a')]);}else{logger[_0x5165('0x14')](_0x5165('0x15'),_0x2514cf,_0x5165('0x16'));_0x20ac7c(_0x2354ef['result'][_0x5165('0x1a')]);}})[_0x5165('0x1b')](function(_0x52f855){logger[_0x5165('0x18')](_0x5165('0x15'),_0x2514cf,_0x52f855);_0x37969c(_0x52f855);});});}exports[_0x5165('0x1c')]=function(_0x1faf29){var _0x506e3e=this;return new Promise(function(_0xf8a29b,_0x6ac41a){return db['Plugin'][_0x5165('0x1d')](_0x1faf29[_0x5165('0x1e')],{'raw':_0x1faf29[_0x5165('0x1f')]?_0x1faf29[_0x5165('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x5165('0x13')](function(_0x30bde9){logger[_0x5165('0x14')](_0x5165('0x1c'),_0x1faf29);logger[_0x5165('0x20')](_0x5165('0x1c'),_0x1faf29,JSON[_0x5165('0x21')](_0x30bde9));_0xf8a29b(_0x30bde9);})['catch'](function(_0x2c8293){logger[_0x5165('0x18')](_0x5165('0x1c'),_0x2c8293['message'],_0x1faf29);_0x6ac41a(_0x506e3e[_0x5165('0x18')](0x1f4,_0x2c8293[_0x5165('0x1a')]));});});}; \ No newline at end of file +var _0x0341=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./plugin.socket','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreatePlugin','Plugin','options','raw','lodash'];(function(_0x438685,_0x4ec0c0){var _0x41cca2=function(_0x532003){while(--_0x532003){_0x438685['push'](_0x438685['shift']());}};_0x41cca2(++_0x4ec0c0);}(_0x0341,0x7f));var _0x1034=function(_0x369374,_0x596c96){_0x369374=_0x369374-0x0;var _0x2f71d1=_0x0341[_0x369374];return _0x2f71d1;};'use strict';var _=require(_0x1034('0x0'));var util=require(_0x1034('0x1'));var moment=require(_0x1034('0x2'));var BPromise=require(_0x1034('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1034('0x4'));var db=require(_0x1034('0x5'))['db'];var utils=require(_0x1034('0x6'));var logger=require(_0x1034('0x7'))(_0x1034('0x8'));var config=require(_0x1034('0x9'));var jayson=require(_0x1034('0xa'));var client=jayson[_0x1034('0xb')][_0x1034('0xc')]({'port':0x232a});config[_0x1034('0xd')]=_[_0x1034('0xe')](config[_0x1034('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1034('0xf'))['register'](socket);function respondWithRpcPromise(_0x4bb8df,_0x6e3bd8,_0x13685b){return new BPromise(function(_0x386d43,_0x3c66ba){return client[_0x1034('0x10')](_0x4bb8df,_0x13685b)[_0x1034('0x11')](function(_0x2c3a73){logger[_0x1034('0x12')](_0x1034('0x13'),_0x6e3bd8,_0x1034('0x14'));logger[_0x1034('0x15')](_0x1034('0x16'),_0x6e3bd8,'request\x20sent',JSON[_0x1034('0x17')](_0x2c3a73));if(_0x2c3a73[_0x1034('0x18')]){if(_0x2c3a73['error'][_0x1034('0x19')]===0x1f4){logger[_0x1034('0x18')](_0x1034('0x13'),_0x6e3bd8,_0x2c3a73[_0x1034('0x18')]['message']);return _0x3c66ba(_0x2c3a73[_0x1034('0x18')]['message']);}logger['error'](_0x1034('0x13'),_0x6e3bd8,_0x2c3a73[_0x1034('0x18')][_0x1034('0x1a')]);return _0x386d43(_0x2c3a73[_0x1034('0x18')]['message']);}else{logger[_0x1034('0x12')](_0x1034('0x13'),_0x6e3bd8,_0x1034('0x14'));_0x386d43(_0x2c3a73['result'][_0x1034('0x1a')]);}})[_0x1034('0x1b')](function(_0x11ec14){logger[_0x1034('0x18')]('Plugin,\x20%s,\x20%s',_0x6e3bd8,_0x11ec14);_0x3c66ba(_0x11ec14);});});}exports[_0x1034('0x1c')]=function(_0x41ba4f){var _0xaff0ca=this;return new Promise(function(_0x6fdf54,_0x4fddec){return db[_0x1034('0x1d')]['create'](_0x41ba4f['body'],{'raw':_0x41ba4f['options']?_0x41ba4f[_0x1034('0x1e')][_0x1034('0x1f')]===undefined?!![]:![]:!![]})[_0x1034('0x11')](function(_0x29f0a5){logger[_0x1034('0x12')]('CreatePlugin',_0x41ba4f);logger[_0x1034('0x15')](_0x1034('0x1c'),_0x41ba4f,JSON[_0x1034('0x17')](_0x29f0a5));_0x6fdf54(_0x29f0a5);})['catch'](function(_0x24b54f){logger[_0x1034('0x18')](_0x1034('0x1c'),_0x24b54f[_0x1034('0x1a')],_0x41ba4f);_0x4fddec(_0xaff0ca[_0x1034('0x18')](0x1f4,_0x24b54f['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index a611da1..d84f7e0 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 _0xf2fb=['emit','removeListener','register','length','plugin:','remove','update'];(function(_0x11896d,_0x5800d9){var _0x2ee999=function(_0x259753){while(--_0x259753){_0x11896d['push'](_0x11896d['shift']());}};_0x2ee999(++_0x5800d9);}(_0xf2fb,0x101));var _0xbf2f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xf2fb[_0x122ef9];return _0x42fba0;};'use strict';var PluginEvents=require('./plugin.events');var events=['save',_0xbf2f('0x0'),_0xbf2f('0x1')];function createListener(_0x3cb61e,_0x2f9dbf){return function(_0x3291ff){_0x2f9dbf[_0xbf2f('0x2')](_0x3cb61e,_0x3291ff);};}function removeListener(_0xc21f67,_0x19049d){return function(){PluginEvents[_0xbf2f('0x3')](_0xc21f67,_0x19049d);};}exports[_0xbf2f('0x4')]=function(_0xb37346){for(var _0x3b789a=0x0,_0x13f6af=events[_0xbf2f('0x5')];_0x3b789a<_0x13f6af;_0x3b789a++){var _0xfa1ded=events[_0x3b789a];var _0x2736f5=createListener(_0xbf2f('0x6')+_0xfa1ded,_0xb37346);PluginEvents['on'](_0xfa1ded,_0x2736f5);}}; \ No newline at end of file +var _0x55d3=['removeListener','length','remove','update','emit'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x55d3,0x124));var _0x355d=function(_0x98c822,_0x3ac327){_0x98c822=_0x98c822-0x0;var _0xbd1886=_0x55d3[_0x98c822];return _0xbd1886;};'use strict';var PluginEvents=require('./plugin.events');var events=['save',_0x355d('0x0'),_0x355d('0x1')];function createListener(_0x4a157c,_0x895094){return function(_0x520393){_0x895094[_0x355d('0x2')](_0x4a157c,_0x520393);};}function removeListener(_0x4e1df0,_0x555653){return function(){PluginEvents[_0x355d('0x3')](_0x4e1df0,_0x555653);};}exports['register']=function(_0x5bdca2){for(var _0x5c03c7=0x0,_0x1cedd3=events[_0x355d('0x4')];_0x5c03c7<_0x1cedd3;_0x5c03c7++){var _0x319356=events[_0x5c03c7];var _0x2e1e64=createListener('plugin:'+_0x319356,_0x5bdca2);PluginEvents['on'](_0x319356,_0x2e1e64);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 1bc7ae3..8bc889e 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(_0xcd658f,_0x371639){var _0x5e892b=function(_0x315cbe){while(--_0x315cbe){_0xcd658f['push'](_0xcd658f['shift']());}};_0x5e892b(++_0x371639);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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(_0x1edf33,_0x38d4f7){var _0x11b801=function(_0x4afd14){while(--_0x4afd14){_0x1edf33['push'](_0x1edf33['shift']());}};_0x11b801(++_0x38d4f7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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 0f8fec8..5f8b372 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 _0xb43b=['stack','name','send','npm\x20install','info','index','list','express','then','describe','catch','create','body','script','join','chdir','dirname','start','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','params','Unknown\x20status','Unknown\x20id','lodash','../../config/pm2','api','path','child_process','bluebird','status','json'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xb43b,0x1b2));var _0xbb43=function(_0x1594dc,_0x5bda31){_0x1594dc=_0x1594dc-0x0;var _0x65220d=_0xb43b[_0x1594dc];return _0x65220d;};'use strict';var _=require(_0xbb43('0x0'));var pm2=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var path=require(_0xbb43('0x3'));var exec=require(_0xbb43('0x4'))['exec'];var BPromise=require(_0xbb43('0x5'));function handleEntityNotFound(_0x41aff6,_0x351254){return function(_0x16432a){if(!_0x16432a){_0x41aff6['sendStatus'](0x194);;}return _0x16432a;};}function respondWithResult(_0x491fb9,_0x378df5){_0x378df5=_0x378df5||0xc8;return function(_0x553520){if(_0x553520){return _0x491fb9[_0xbb43('0x6')](_0x378df5)[_0xbb43('0x7')](_0x553520);}return null;};}function handleError(_0x2a2f11,_0x29ae1a){_0x29ae1a=_0x29ae1a||0x1f4;return function(_0x364718){logger['error'](_0x364718[_0xbb43('0x8')]);if(_0x364718[_0xbb43('0x9')]){delete _0x364718['name'];}_0x2a2f11[_0xbb43('0x6')](_0x29ae1a)[_0xbb43('0xa')](_0x364718);};}function execChildProcess(){return new BPromise(function(_0xd37cdf,_0x5e3611){exec(_0xbb43('0xb'),function(_0x2bef86,_0x480cc2,_0x36a473){logger[_0xbb43('0xc')](_0x480cc2);logger['info'](_0x36a473);if(_0x2bef86){logger['error'](_0x2bef86);return _0x5e3611(_0x2bef86);}return _0xd37cdf(_0x480cc2);});});}exports[_0xbb43('0xd')]=function(_0x4a3714,_0x593d0b){return pm2[_0xbb43('0xe')]()['then'](function(_0x68d45d){if(_0x68d45d){var _0x43021d=_['reject'](_0x68d45d,function(_0x4a6e18){return _0x4a6e18['name']===_0xbb43('0xf')||_0x4a6e18[_0xbb43('0x9')]==='motion2';});return{'rows':_0x43021d,'count':_0x43021d['length']};}return null;})[_0xbb43('0x10')](respondWithResult(_0x593d0b,null))['catch'](handleError(_0x593d0b,null));};exports['show']=function(_0x2b0797,_0x8242ab){return pm2[_0xbb43('0x11')](_0x2b0797['params']['id'])[_0xbb43('0x10')](respondWithResult(_0x8242ab,null))['then'](handleEntityNotFound(_0x8242ab,null))[_0xbb43('0x12')](handleError(_0x8242ab,null));};exports[_0xbb43('0x13')]=function(_0x4dfc54,_0x5d765b){if(_0x4dfc54[_0xbb43('0x14')][_0xbb43('0x9')]&&_0x4dfc54[_0xbb43('0x14')][_0xbb43('0x15')]){var _0x5bcce7=path[_0xbb43('0x16')](__dirname,'../../files/plugins',_0x4dfc54[_0xbb43('0x14')]['script']);var _0x2f5e31=process['cwd']();process[_0xbb43('0x17')](path[_0xbb43('0x18')](_0x5bcce7));return execChildProcess()['then'](function(_0x1d0768){process['chdir'](_0x2f5e31);return pm2[_0xbb43('0x19')]({'name':_0x4dfc54[_0xbb43('0x14')][_0xbb43('0x9')],'script':_0x5bcce7});})['then'](function(_0x53f0d5){pm2['dump']();return _0x53f0d5[0x0];})[_0xbb43('0x10')](respondWithResult(_0x5d765b,0xc9))[_0xbb43('0x12')](handleError(_0x5d765b,null));}else{return _0x5d765b['status'](0x1f4)[_0xbb43('0xa')]({'message':_0xbb43('0x1a')});}};exports[_0xbb43('0x1b')]=function(_0x3874fb,_0x4ed43f){if(_0x3874fb['body']['id']){delete _0x3874fb[_0xbb43('0x14')]['id'];}var _0x42800f={'online':_0xbb43('0x1c'),'stopped':_0xbb43('0x1d')};if(_0x42800f[_0xbb43('0x1e')](_0x3874fb[_0xbb43('0x14')][_0xbb43('0x6')])){return pm2[_0x42800f[_0x3874fb[_0xbb43('0x14')]['status']]](_0x3874fb[_0xbb43('0x1f')]['id'])['then'](respondWithResult(_0x4ed43f,0xc8))[_0xbb43('0x12')](handleError(_0x4ed43f,null));}else{return _0x4ed43f[_0xbb43('0x6')](0x1f4)[_0xbb43('0xa')]({'message':_0xbb43('0x20')});}};exports['destroy']=function(_0x157d62,_0x547a6f){if(_0x157d62['body']['id']){delete _0x157d62['body']['id'];}if(_0x157d62[_0xbb43('0x1f')]['id']){return pm2['delete'](_0x157d62[_0xbb43('0x1f')]['id'])[_0xbb43('0x10')](function(_0xc577ac){pm2['dump']();return _0xc577ac[0x0];})[_0xbb43('0x10')](respondWithResult(_0x547a6f,null))[_0xbb43('0x12')](handleError(_0x547a6f,null));}else{return _0x547a6f[_0xbb43('0x6')](0x1f4)[_0xbb43('0xa')]({'message':_0xbb43('0x21')});}}; \ No newline at end of file +var _0x5b02=['../../files/plugins','cwd','dirname','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','Unknown\x20status','destroy','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','exec','sendStatus','status','error','stack','name','send','npm\x20install','info','index','list','then','reject','motion2','catch','show','describe','params','create','body','script','join'];(function(_0x31172e,_0xa59e5){var _0x414ada=function(_0x37ede4){while(--_0x37ede4){_0x31172e['push'](_0x31172e['shift']());}};_0x414ada(++_0xa59e5);}(_0x5b02,0xe9));var _0x25b0=function(_0x3a009d,_0x85a4c8){_0x3a009d=_0x3a009d-0x0;var _0x62c1a6=_0x5b02[_0x3a009d];return _0x62c1a6;};'use strict';var _=require(_0x25b0('0x0'));var pm2=require(_0x25b0('0x1'));var logger=require(_0x25b0('0x2'))(_0x25b0('0x3'));var path=require('path');var exec=require('child_process')[_0x25b0('0x4')];var BPromise=require('bluebird');function handleEntityNotFound(_0x3e1d20,_0x31c9c2){return function(_0x38dc14){if(!_0x38dc14){_0x3e1d20[_0x25b0('0x5')](0x194);;}return _0x38dc14;};}function respondWithResult(_0x2d84a9,_0x4eea55){_0x4eea55=_0x4eea55||0xc8;return function(_0x1d82c6){if(_0x1d82c6){return _0x2d84a9[_0x25b0('0x6')](_0x4eea55)['json'](_0x1d82c6);}return null;};}function handleError(_0x412954,_0x4d3e71){_0x4d3e71=_0x4d3e71||0x1f4;return function(_0x56feca){logger[_0x25b0('0x7')](_0x56feca[_0x25b0('0x8')]);if(_0x56feca[_0x25b0('0x9')]){delete _0x56feca['name'];}_0x412954[_0x25b0('0x6')](_0x4d3e71)[_0x25b0('0xa')](_0x56feca);};}function execChildProcess(){return new BPromise(function(_0x135afb,_0x250d31){exec(_0x25b0('0xb'),function(_0x2f57af,_0x44afbc,_0x10c3fb){logger[_0x25b0('0xc')](_0x44afbc);logger[_0x25b0('0xc')](_0x10c3fb);if(_0x2f57af){logger[_0x25b0('0x7')](_0x2f57af);return _0x250d31(_0x2f57af);}return _0x135afb(_0x44afbc);});});}exports[_0x25b0('0xd')]=function(_0x2048dc,_0x3655c2){return pm2[_0x25b0('0xe')]()[_0x25b0('0xf')](function(_0x293203){if(_0x293203){var _0x211658=_[_0x25b0('0x10')](_0x293203,function(_0x3b89e7){return _0x3b89e7[_0x25b0('0x9')]==='express'||_0x3b89e7['name']===_0x25b0('0x11');});return{'rows':_0x211658,'count':_0x211658['length']};}return null;})[_0x25b0('0xf')](respondWithResult(_0x3655c2,null))[_0x25b0('0x12')](handleError(_0x3655c2,null));};exports[_0x25b0('0x13')]=function(_0x3267b9,_0x5e3a3a){return pm2[_0x25b0('0x14')](_0x3267b9[_0x25b0('0x15')]['id'])[_0x25b0('0xf')](respondWithResult(_0x5e3a3a,null))[_0x25b0('0xf')](handleEntityNotFound(_0x5e3a3a,null))[_0x25b0('0x12')](handleError(_0x5e3a3a,null));};exports[_0x25b0('0x16')]=function(_0x54f458,_0x348d36){if(_0x54f458[_0x25b0('0x17')][_0x25b0('0x9')]&&_0x54f458[_0x25b0('0x17')][_0x25b0('0x18')]){var _0xea4162=path[_0x25b0('0x19')](__dirname,_0x25b0('0x1a'),_0x54f458[_0x25b0('0x17')][_0x25b0('0x18')]);var _0x2b2eda=process[_0x25b0('0x1b')]();process['chdir'](path[_0x25b0('0x1c')](_0xea4162));return execChildProcess()[_0x25b0('0xf')](function(_0x517ec5){process[_0x25b0('0x1d')](_0x2b2eda);return pm2[_0x25b0('0x1e')]({'name':_0x54f458[_0x25b0('0x17')]['name'],'script':_0xea4162});})['then'](function(_0x50089e){pm2[_0x25b0('0x1f')]();return _0x50089e[0x0];})[_0x25b0('0xf')](respondWithResult(_0x348d36,0xc9))[_0x25b0('0x12')](handleError(_0x348d36,null));}else{return _0x348d36[_0x25b0('0x6')](0x1f4)[_0x25b0('0xa')]({'message':_0x25b0('0x20')});}};exports[_0x25b0('0x21')]=function(_0x75ce7a,_0x22e024){if(_0x75ce7a['body']['id']){delete _0x75ce7a[_0x25b0('0x17')]['id'];}var _0xbfba84={'online':'restart','stopped':'stop'};if(_0xbfba84['hasOwnProperty'](_0x75ce7a[_0x25b0('0x17')][_0x25b0('0x6')])){return pm2[_0xbfba84[_0x75ce7a[_0x25b0('0x17')][_0x25b0('0x6')]]](_0x75ce7a[_0x25b0('0x15')]['id'])[_0x25b0('0xf')](respondWithResult(_0x22e024,0xc8))[_0x25b0('0x12')](handleError(_0x22e024,null));}else{return _0x22e024[_0x25b0('0x6')](0x1f4)[_0x25b0('0xa')]({'message':_0x25b0('0x22')});}};exports[_0x25b0('0x23')]=function(_0x3161c1,_0x1ea374){if(_0x3161c1['body']['id']){delete _0x3161c1['body']['id'];}if(_0x3161c1[_0x25b0('0x15')]['id']){return pm2['delete'](_0x3161c1['params']['id'])[_0x25b0('0xf')](function(_0x419975){pm2[_0x25b0('0x1f')]();return _0x419975[0x0];})[_0x25b0('0xf')](respondWithResult(_0x1ea374,null))[_0x25b0('0x12')](handleError(_0x1ea374,null));}else{return _0x1ea374['status'](0x1f4)[_0x25b0('0xa')]({'message':_0x25b0('0x24')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 9829688..167b0d3 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 _0xd4ec=['./realtime.controller','get','/agents','isAuthenticated','getAgents','/queues','getQueues','exports','express','Router','../../components/auth/service'];(function(_0x7a5984,_0x1d2f93){var _0x4c234b=function(_0x4e3d53){while(--_0x4e3d53){_0x7a5984['push'](_0x7a5984['shift']());}};_0x4c234b(++_0x1d2f93);}(_0xd4ec,0xfa));var _0xcd4e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd4ec[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0xcd4e('0x0'));var router=express[_0xcd4e('0x1')]();var auth=require(_0xcd4e('0x2'));var controller=require(_0xcd4e('0x3'));router[_0xcd4e('0x4')](_0xcd4e('0x5'),auth[_0xcd4e('0x6')](),controller[_0xcd4e('0x7')]);router[_0xcd4e('0x4')](_0xcd4e('0x8'),auth[_0xcd4e('0x6')](),controller[_0xcd4e('0x9')]);module[_0xcd4e('0xa')]=router; \ No newline at end of file +var _0x1538=['./realtime.controller','get','/agents','isAuthenticated','getAgents','/queues','getQueues','express','Router','../../components/auth/service'];(function(_0x297fe8,_0x2c9c7e){var _0x337023=function(_0x17eda0){while(--_0x17eda0){_0x297fe8['push'](_0x297fe8['shift']());}};_0x337023(++_0x2c9c7e);}(_0x1538,0x11f));var _0x8153=function(_0x67f95e,_0x3ca797){_0x67f95e=_0x67f95e-0x0;var _0x538f5a=_0x1538[_0x67f95e];return _0x538f5a;};'use strict';var express=require(_0x8153('0x0'));var router=express[_0x8153('0x1')]();var auth=require(_0x8153('0x2'));var controller=require(_0x8153('0x3'));router[_0x8153('0x4')](_0x8153('0x5'),auth[_0x8153('0x6')](),controller[_0x8153('0x7')]);router[_0x8153('0x4')](_0x8153('0x8'),auth['isAuthenticated'](),controller[_0x8153('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index abda1c1..4ec345f 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 _0xa3fe=['QueueId','includes','Invalid\x20channel','toLowerCase','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','*pause','resolve','channel','sort','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','order','getAgentIdsByQueues','getRealtimeAgents','getAgentIdsByStatus','User','fieldName','type','key','role','agent','getOptions','raw','sequelize','literal','FIELD(id,','forEach','where','user','userProfileId','extraQueryConditions','assign','UserProfile','getResources','findAndCountAll','rows','filterAgentAttributes','getAgentStatus','sortAgentsByStatus','catch','getQueues','rawAttributes','QueueCampaigns','Queues','all','util','lodash','jayson/promise','../../components/realtime/agents','../../components/parsers/qs','../../config/utils','../../config/logger','api','../../mysqldb','client','http','offset','undefined','count','limit','set','Content-Range','json','error','stack','name','status','send','startCase','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','request','VoiceQueuesChannels','then','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','waiting','talking','paused','voice','push','originated','message','dialActive','dialMethod','Trunk','startProgressive','erlangCalls','erlangCallToSecond','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','get','loggedInDb','outbound','pTalking','merge','pick','filter','queue','length','connectedlinenum','internal','toString','busy','getMembers','find','UserId','accountcode','online','voiceStatus','agents','Queue','Pause','findAll'];(function(_0x9b2bb0,_0x3965b1){var _0x2cdb3b=function(_0x177d75){while(--_0x177d75){_0x9b2bb0['push'](_0x9b2bb0['shift']());}};_0x2cdb3b(++_0x3965b1);}(_0xa3fe,0x1bc));var _0xea3f=function(_0x523420,_0x55233d){_0x523420=_0x523420-0x0;var _0x415271=_0xa3fe[_0x523420];return _0x415271;};'use strict';var util=require(_0xea3f('0x0'));var _=require(_0xea3f('0x1'));var jayson=require(_0xea3f('0x2'));var rta=require(_0xea3f('0x3'));var qs=require(_0xea3f('0x4'));var utils=require(_0xea3f('0x5'));var logger=require(_0xea3f('0x6'))(_0xea3f('0x7'));var db=require(_0xea3f('0x8'))['db'];var amiClient=jayson[_0xea3f('0x9')]['http']({'port':0x232a});var routingClient=jayson['client'][_0xea3f('0xa')]({'port':0x232c});function respondWithFilteredResult(_0x5f23ab,_0x18eeff){return function(_0x4075dd){if(_0x4075dd){var _0x4473b2=typeof _0x18eeff[_0xea3f('0xb')]===_0xea3f('0xc')&&typeof _0x18eeff['limit']===_0xea3f('0xc');var _0x4bd959=_0x4075dd['count'];var _0xb35d47=_0x4473b2?0x0:_0x18eeff[_0xea3f('0xb')];var _0x357f86=_0x4473b2?_0x4075dd[_0xea3f('0xd')]:_0x18eeff[_0xea3f('0xb')]+_0x18eeff[_0xea3f('0xe')];var _0x4b4021;if(_0x357f86>=_0x4bd959){_0x357f86=_0x4bd959;_0x4b4021=0xc8;}else{_0x4b4021=0xce;}_0x5f23ab['status'](_0x4b4021);return _0x5f23ab[_0xea3f('0xf')](_0xea3f('0x10'),_0xb35d47+'-'+_0x357f86+'/'+_0x4bd959)[_0xea3f('0x11')](_0x4075dd);}return null;};}function handleError(_0x74f51d,_0x5641dd){_0x5641dd=_0x5641dd||0x1f4;return function(_0x1cfaad){logger[_0xea3f('0x12')](_0x1cfaad[_0xea3f('0x13')]);if(_0x1cfaad[_0xea3f('0x14')]){delete _0x1cfaad[_0xea3f('0x14')];}_0x74f51d[_0xea3f('0x15')](_0x5641dd)[_0xea3f('0x16')](_0x1cfaad);};}function getRealtimeQueues(_0x161371,_0x1995aa){return new Promise(function(_0x116328,_0x2f6872){var _0x2420fb=_0x1995aa==='voice'?amiClient:routingClient;return _0x2420fb['request'](_[_0xea3f('0x17')](_0x1995aa)+'Queues',_0x161371)['then'](function(_0xfc3244){if(_0xfc3244[_0xea3f('0x12')])throw new Error(util[_0xea3f('0x18')](_0xea3f('0x19'),_0x1995aa));return _0x116328(_0xfc3244[_0xea3f('0x1a')]);})['catch'](function(_0x254d1e){_0x2f6872(_0x254d1e);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x330e1a,_0x28de37){return amiClient[_0xea3f('0x1b')](_0xea3f('0x1c'),{})[_0xea3f('0x1d')](function(_0x4a00ec){if(_0x4a00ec[_0xea3f('0x12')])throw new Error(_0xea3f('0x1e'));return _0x330e1a(_0x4a00ec[_0xea3f('0x1a')]);})['catch'](function(_0x5a6a73){_0x28de37(_0x5a6a73);});});}function initializeQueues(_0x3a02bc,_0x52074c,_0x47661e,_0x4d670d){var _0x304537=[_0xea3f('0x1f'),_0xea3f('0x20'),_0xea3f('0x21'),_0xea3f('0x22'),_0xea3f('0x23')];if(_0x47661e===_0xea3f('0x24')&&_0x4d670d==='outbound'){_0x304537[_0xea3f('0x25')]('pTalking',_0xea3f('0x26'),_0xea3f('0x27'),_0xea3f('0x28'),_0xea3f('0x29'),_0xea3f('0x2a'),'startPredictive',_0xea3f('0x2b'),_0xea3f('0x2c'),_0xea3f('0x2d'),'erlangAbandonmentRate','erlangBusyFactor',_0xea3f('0x2e'),_0xea3f('0x2f'),_0xea3f('0x30'),_0xea3f('0x31'),_0xea3f('0x32'),_0xea3f('0x33'),_0xea3f('0x34'),_0xea3f('0x35'),_0xea3f('0x36'),_0xea3f('0x37'));}return _0x3a02bc[_0xea3f('0x38')](function(_0x49dc61){var _0x59557d=_0x49dc61[_0xea3f('0x39')]({'plain':!![]});_0x59557d['agents']=[];_0x59557d[_0xea3f('0x23')]=0x0;_0x59557d[_0xea3f('0x3a')]=0x0;_0x59557d[_0xea3f('0x1f')]=0x0;_0x59557d[_0xea3f('0x20')]=0x0;_0x59557d[_0xea3f('0x21')]=0x0;if(_0x47661e===_0xea3f('0x24')){_0x59557d[_0xea3f('0x22')]=0x0;_0x59557d['busy']=0x0;if(_0x4d670d===_0xea3f('0x3b')){_0x59557d[_0xea3f('0x3c')]=0x0;_0x59557d[_0xea3f('0x26')]=0x0;}}var _0xa07d93=_['find'](_0x52074c,['id',_0x59557d['id']]);if(_0xa07d93)_[_0xea3f('0x3d')](_0x59557d,_[_0xea3f('0x3e')](_0xa07d93,_0x304537));return _0x59557d;});}function updateAgentVoiceStatus(_0x583bf2,_0x52fdd7,_0xea0e38){var _0x1924c8=_[_0xea3f('0x3f')](_0xea0e38,[_0xea3f('0x40'),_0x52fdd7['name']]);if(_0x1924c8[_0xea3f('0x41')]===0x0)return _0x583bf2['busy']=!![];if(_['some'](_0x1924c8,[_0xea3f('0x42'),_0x583bf2[_0xea3f('0x43')][_0xea3f('0x44')]()]))return _0x583bf2[_0xea3f('0x22')]=!![];if(!_0x583bf2[_0xea3f('0x22')])return _0x583bf2[_0xea3f('0x45')]=!![];}function getVoiceQueueAgents(_0x4456a2,_0x48b147,_0x5eab8a,_0x30bba9){var _0x1cdb3d=_['find'](_0x48b147,['id',_0x4456a2['id']]);if(!_0x1cdb3d)return _0x4456a2;return _0x1cdb3d[_0xea3f('0x46')]({'raw':!![]})[_0xea3f('0x1d')](function(_0x3cbc4a){for(var _0xba32c5=0x0;_0xba32c5<_0x3cbc4a[_0xea3f('0x41')];_0xba32c5++){var _0x3ddfe0=_[_0xea3f('0x47')](_0x5eab8a,['id',_0x3cbc4a[_0xba32c5]['UserId']]);if(!_0x3ddfe0){_0x3ddfe0={'id':_0x3cbc4a[_0xba32c5][_0xea3f('0x48')],'name':_0x3cbc4a[_0xba32c5][_0xea3f('0x48')],'accountcode':'','online':![]};}var _0x42daef={'id':_0x3ddfe0['id'],'name':_0x3ddfe0[_0xea3f('0x14')],'internal':_0x3ddfe0[_0xea3f('0x49')],'online':Boolean(_0x3ddfe0[_0xea3f('0x4a')]),'paused':Boolean(_0x3cbc4a[_0xba32c5][_0xea3f('0x23')])};if(_0x3ddfe0[_0xea3f('0x4b')]==='talking')updateAgentVoiceStatus(_0x42daef,_0x4456a2,_0x30bba9);if(_0x42daef[_0xea3f('0x4a')])_0x4456a2[_0xea3f('0x3a')]++;if(_0x42daef[_0xea3f('0x45')])_0x4456a2['busy']++;if(_0x42daef[_0xea3f('0x23')]&&!_0x42daef[_0xea3f('0x45')]&&!_0x42daef[_0xea3f('0x22')])_0x4456a2[_0xea3f('0x23')]++;_0x4456a2[_0xea3f('0x4c')][_0xea3f('0x25')](_0x42daef);}return _0x4456a2;});}function getQueueAgents(_0x5c6a32,_0x315f83,_0x2ca0cf){var _0x8fca18='User'+_['startCase'](_0x2ca0cf)+_0xea3f('0x4d');var _0x98cbb6=_0x2ca0cf+_0xea3f('0x4e');return db[_0x8fca18][_0xea3f('0x4f')]({'where':{[_[_0xea3f('0x17')](_0x2ca0cf)+_0xea3f('0x50')]:_0x5c6a32['id']},'raw':!![]})['then'](function(_0xf58759){for(var _0x1fabcf=0x0;_0x1fabcf<_0xf58759[_0xea3f('0x41')];_0x1fabcf++){var _0x579d38=_['find'](_0x315f83,['id',_0xf58759[_0x1fabcf][_0xea3f('0x48')]]);if(!_0x579d38){_0x579d38={'id':_0xf58759[_0x1fabcf][_0xea3f('0x48')],'name':_0xf58759[_0x1fabcf][_0xea3f('0x48')],'online':![],['pauseField']:![]};}var _0x484513={'id':_0x579d38['id'],'name':_0x579d38[_0xea3f('0x14')],'online':Boolean(_0x579d38[_0xea3f('0x4a')]),'paused':Boolean(_0x579d38[_0x98cbb6])};if(_0x484513[_0xea3f('0x4a')])_0x5c6a32['loggedInDb']++;_0x5c6a32['agents']['push'](_0x484513);}return _0x5c6a32;});}function validateChannel(_0x3160ee){var _0x1a39c5=utils['getChannels']();if(!_[_0xea3f('0x51')](_0x1a39c5,_0x3160ee['toLowerCase']()))throw new Error(_0xea3f('0x52'));return _0x3160ee[_0xea3f('0x53')]();}exports['getAgents']=function(_0x345a25,_0x4dd931){var _0x2669bc={'count':0x0,'rows':[]};var _0x44120f={};var _0x4bda40;var _0x458fec;var _0x108563;var _0x584e40;var _0x460cd0=utils['getChannels']();var _0x575788=_0x345a25[_0xea3f('0x54')][_0xea3f('0x55')];var _0x3c2b4f=_0x345a25[_0xea3f('0x54')][_0xea3f('0x56')];var _0x2568ca=_0x345a25[_0xea3f('0x54')][_0xea3f('0x57')];var _0x44dd72=_0x3c2b4f===_0xea3f('0x58')||_0x3c2b4f===_0xea3f('0x59')?!![]:![];var _0x27cc61=[];var _0x116baa;Promise[_0xea3f('0x5a')]()[_0xea3f('0x1d')](function(){if(_0x345a25['query'][_0xea3f('0x5b')]){_0x4bda40=validateChannel(_0x345a25[_0xea3f('0x54')]['channel']);}if(!_0x345a25[_0xea3f('0x54')]['sort']||!_0x345a25[_0xea3f('0x54')][_0xea3f('0x5c')][_0xea3f('0x51')](_0xea3f('0x5d'))){_0x345a25[_0xea3f('0x54')][_0xea3f('0x5c')]=rta[_0xea3f('0x5e')](_0x345a25[_0xea3f('0x54')][_0xea3f('0x5c')]);return;}var _0x4a76aa=rta[_0xea3f('0x5f')](_0x345a25[_0xea3f('0x54')]['sort']);_0x345a25[_0xea3f('0x54')][_0xea3f('0x5c')]=_0x4a76aa[_0xea3f('0x60')]['join'](',');_0x458fec=_0x4a76aa[_0xea3f('0x61')];})[_0xea3f('0x1d')](function(){if(!_0x575788){return[];}return rta[_0xea3f('0x62')](_0x575788,_0x4bda40);})[_0xea3f('0x1d')](function(_0x569df1){_0x27cc61=_0x569df1;return rta[_0xea3f('0x63')]();})['then'](function(_0x45b335){_0x584e40=_0x45b335['rows'];if((!_0x3c2b4f||_0x44dd72)&&!_0x458fec){return _0x27cc61;}if(_0x458fec&&!_0x3c2b4f){return rta['getSortedAgentsIdsByStatus'](_0x584e40,_0x27cc61,_0x458fec);}else{return rta[_0xea3f('0x64')](_0x584e40,_0x27cc61,_0x3c2b4f);}})[_0xea3f('0x1d')](function(_0xbf575d){_0x27cc61=_0xbf575d;var _0x315a28=![];if(_0x27cc61[_0xea3f('0x41')]===0x0){if(_0x575788||_0x3c2b4f){_0x315a28=!![];}if(_0x44dd72){_0x315a28=![];}}if(_0x315a28){return _0x2669bc;}var _0x181bef=_['map'](db[_0xea3f('0x65')]['rawAttributes'],function(_0x36746b){return{'name':_0x36746b[_0xea3f('0x66')],'type':_0x36746b[_0xea3f('0x67')][_0xea3f('0x68')]};});_0x345a25[_0xea3f('0x54')][_0xea3f('0x69')]=_0xea3f('0x6a');_0x345a25[_0xea3f('0x54')][_0xea3f('0x4a')]=!![];_0x44120f=qs[_0xea3f('0x6b')](_0x181bef,_0x345a25);_0x44120f[_0xea3f('0x6c')]=!![];var _0x25c696=[];if(_0x27cc61[_0xea3f('0x41')]>0x0){_0x25c696['push']({'id':{'$in':_0x27cc61}});if(_0x458fec&&!_0x3c2b4f){_0x116baa=[db[_0xea3f('0x6d')][_0xea3f('0x6e')](_0xea3f('0x6f')+_0x27cc61+')')];_0x44120f[_0xea3f('0x61')]=_0x116baa;}}if(_0x44dd72){_0x460cd0[_0xea3f('0x70')](function(_0x37b63f){var _0x1688a0=!![];if(_0x3c2b4f==='*pause'&&_0x4bda40!==_0x37b63f){_0x1688a0=![];}_0x25c696[_0xea3f('0x25')]({[_0x37b63f+_0xea3f('0x4e')]:_0x1688a0});});if(_0x2568ca){_0x25c696[_0xea3f('0x25')]({'pauseType':_0x2568ca});}}else if(_0x3c2b4f){_0x460cd0[_0xea3f('0x70')](function(_0x4e3491){_0x25c696['push']({[_0x4e3491+_0xea3f('0x4e')]:![]});});}_0x44120f[_0xea3f('0x71')]=_[_0xea3f('0x3d')](_0x44120f[_0xea3f('0x71')],{'$and':_0x25c696});if(_0x345a25[_0xea3f('0x72')][_0xea3f('0x69')]===_0xea3f('0x72')){var _0x574dbe={'params':{'id':_0x345a25['user'][_0xea3f('0x73')]},'query':{'section':'Agents','role':_0xea3f('0x6a'),'online':!![],'raw':!![],'ids':_0x27cc61,'customSorting':_0x116baa}};if(_0x44dd72){_0x574dbe['query'][_0xea3f('0x74')]=_0x25c696;}_0x574dbe[_0xea3f('0x54')]=Object[_0xea3f('0x75')](_0x574dbe[_0xea3f('0x54')],_0x345a25[_0xea3f('0x54')]);delete _0x574dbe[_0xea3f('0x54')]['id'];return db[_0xea3f('0x76')][_0xea3f('0x77')](_0x574dbe);}return db[_0xea3f('0x65')][_0xea3f('0x78')](_0x44120f);})['then'](function(_0x104a2f){_0x2669bc['count']=_0x104a2f['count'];_0x108563=_0x104a2f[_0xea3f('0x79')];return _0x108563['map'](function(_0x1e7c47){var _0x176e84=_['find'](_0x584e40,['id',_0x1e7c47['id']]);if(_0x176e84){var _0x2302df=rta[_0xea3f('0x7a')](_0x176e84);_[_0xea3f('0x3d')](_0x1e7c47,_0x2302df);}_0x1e7c47[_0xea3f('0x5d')]=rta[_0xea3f('0x7b')](_0x1e7c47);if(_0x1e7c47[_0xea3f('0x5d')][_0xea3f('0x51')](_0xea3f('0x58'))){_0x460cd0['forEach'](function(_0x552ab3){if(_0x1e7c47[_0x552ab3+_0xea3f('0x4e')]){_0x1e7c47[_0x552ab3+'Status']=_0xea3f('0x58');}});}return _0x1e7c47;});})[_0xea3f('0x1d')](function(_0x24a313){if(!_0x458fec||_0x116baa){return _0x24a313;}return rta[_0xea3f('0x7c')](_0x24a313,_0x458fec);})[_0xea3f('0x1d')](function(_0xefcee9){_0x2669bc['rows']=_0xefcee9;return _0x2669bc;})[_0xea3f('0x1d')](respondWithFilteredResult(_0x4dd931,_0x44120f))[_0xea3f('0x7d')](handleError(_0x4dd931,null));};exports[_0xea3f('0x7e')]=function(_0x24b6fc,_0x332f47){var _0x383ab1={'count':0x0,'rows':[]},_0x1b440d={},_0x1d37b2,_0x9f9f8e,_0x158614,_0x24220a,_0x477dc7;Promise['resolve']()[_0xea3f('0x1d')](function(){if(_0x24b6fc[_0xea3f('0x54')][_0xea3f('0x5b')])_0x1d37b2=validateChannel(_0x24b6fc[_0xea3f('0x54')][_0xea3f('0x5b')]);var _0x1b38b5=_[_0xea3f('0x17')](_0x1d37b2)+_0xea3f('0x4d');var _0x6f6abc=_[_0xea3f('0x38')](db[_0x1b38b5][_0xea3f('0x7f')],function(_0x1a8c49){return{'name':_0x1a8c49[_0xea3f('0x66')],'type':_0x1a8c49['type']['key']};});_0x1b440d=qs[_0xea3f('0x6b')](_0x6f6abc,_0x24b6fc);if(_0x24b6fc[_0xea3f('0x72')][_0xea3f('0x69')]===_0xea3f('0x72')){var _0x2936e6={'params':{'id':_0x24b6fc[_0xea3f('0x72')][_0xea3f('0x73')]},'query':{'section':_0x1d37b2===_0xea3f('0x24')&&_0x24b6fc[_0xea3f('0x54')][_0xea3f('0x67')]===_0xea3f('0x3b')?_0xea3f('0x80'):_[_0xea3f('0x17')](_0x1d37b2)+_0xea3f('0x81'),'type':_0x24b6fc[_0xea3f('0x54')]['type'],'nolimit':!![],'sort':_0xea3f('0x14'),'filter':_0x24b6fc[_0xea3f('0x54')]['filter']}};return db[_0xea3f('0x76')][_0xea3f('0x77')](_0x2936e6);}return db[_0x1b38b5][_0xea3f('0x78')](_0x1b440d);})[_0xea3f('0x1d')](function(_0x3539c1){_0x383ab1[_0xea3f('0xd')]=_0x3539c1['count'];_0x9f9f8e=_0x3539c1[_0xea3f('0x79')];return getRealtimeQueues(_0x24b6fc,_0x1d37b2);})[_0xea3f('0x1d')](function(_0x5dd320){_0x24220a=_0x5dd320['rows'];return rta[_0xea3f('0x63')]();})[_0xea3f('0x1d')](function(_0x4fa895){_0x158614=_0x4fa895['rows'];if(_0x1d37b2!=_0xea3f('0x24'))return;return getRealtimeVoiceQueueChannels();})['then'](function(_0xeb7673){_0x477dc7=_0xeb7673?_0xeb7673[_0xea3f('0x79')]:[];return initializeQueues(_0x9f9f8e,_0x24220a,_0x1d37b2,_0x24b6fc['query'][_0xea3f('0x67')]);})[_0xea3f('0x1d')](function(_0x12f3e4){var _0x168151=_0x12f3e4[_0xea3f('0x38')](function(_0x16342f){if(_0x1d37b2==='voice')return getVoiceQueueAgents(_0x16342f,_0x9f9f8e,_0x158614,_0x477dc7);else return getQueueAgents(_0x16342f,_0x158614,_0x1d37b2);});return Promise[_0xea3f('0x82')](_0x168151);})[_0xea3f('0x1d')](function(_0x8e8a58){_0x383ab1[_0xea3f('0x79')]=_0x8e8a58;return _0x383ab1;})[_0xea3f('0x1d')](respondWithFilteredResult(_0x332f47,_0x1b440d))[_0xea3f('0x7d')](handleError(_0x332f47,null));}; \ No newline at end of file +var _0x1013=['filterAgentAttributes','Status','rows','getQueues','Queue','type','userProfileId','Queues','all','lodash','jayson/promise','../../components/realtime/agents','../../components/parsers/qs','../../config/utils','../../config/logger','api','client','http','undefined','limit','count','status','set','Content-Range','json','error','stack','name','send','voice','request','startCase','then','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','VoiceQueuesChannels','loggedIn','available','waiting','talking','outbound','push','pTalking','originated','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','agents','paused','loggedInDb','busy','find','pick','filter','queue','some','connectedlinenum','length','UserId','accountcode','online','voiceStatus','User','Pause','findAll','getChannels','includes','toLowerCase','Invalid\x20channel','getAgents','globalQueueFilter','query','pause','resolve','channel','sort','globalStatus','validateSortParameter','fields','join','order','getRealtimeAgents','getAgentIdsByStatus','rawAttributes','key','role','agent','raw','sequelize','literal','FIELD(id,','forEach','merge','where','user','Agents','extraQueryConditions','UserProfile','getResources','findAndCountAll'];(function(_0x3c6319,_0x350bfe){var _0x2c91e2=function(_0x545cd7){while(--_0x545cd7){_0x3c6319['push'](_0x3c6319['shift']());}};_0x2c91e2(++_0x350bfe);}(_0x1013,0x1d1));var _0x3101=function(_0x5b0f2f,_0x51a23c){_0x5b0f2f=_0x5b0f2f-0x0;var _0x98a25b=_0x1013[_0x5b0f2f];return _0x98a25b;};'use strict';var util=require('util');var _=require(_0x3101('0x0'));var jayson=require(_0x3101('0x1'));var rta=require(_0x3101('0x2'));var qs=require(_0x3101('0x3'));var utils=require(_0x3101('0x4'));var logger=require(_0x3101('0x5'))(_0x3101('0x6'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0x3101('0x7')][_0x3101('0x8')]({'port':0x232a});var routingClient=jayson[_0x3101('0x7')]['http']({'port':0x232c});function respondWithFilteredResult(_0x977d07,_0x39535e){return function(_0x585b3a){if(_0x585b3a){var _0x198540=typeof _0x39535e['offset']===_0x3101('0x9')&&typeof _0x39535e[_0x3101('0xa')]===_0x3101('0x9');var _0x406a11=_0x585b3a[_0x3101('0xb')];var _0x3150db=_0x198540?0x0:_0x39535e['offset'];var _0x1ceafe=_0x198540?_0x585b3a[_0x3101('0xb')]:_0x39535e['offset']+_0x39535e[_0x3101('0xa')];var _0x11406f;if(_0x1ceafe>=_0x406a11){_0x1ceafe=_0x406a11;_0x11406f=0xc8;}else{_0x11406f=0xce;}_0x977d07[_0x3101('0xc')](_0x11406f);return _0x977d07[_0x3101('0xd')](_0x3101('0xe'),_0x3150db+'-'+_0x1ceafe+'/'+_0x406a11)[_0x3101('0xf')](_0x585b3a);}return null;};}function handleError(_0x226bca,_0x77284d){_0x77284d=_0x77284d||0x1f4;return function(_0x5e810f){logger[_0x3101('0x10')](_0x5e810f[_0x3101('0x11')]);if(_0x5e810f[_0x3101('0x12')]){delete _0x5e810f[_0x3101('0x12')];}_0x226bca[_0x3101('0xc')](_0x77284d)[_0x3101('0x13')](_0x5e810f);};}function getRealtimeQueues(_0x2189a7,_0xd4010){return new Promise(function(_0x3b0e1f,_0x4b4d44){var _0x4a9fda=_0xd4010===_0x3101('0x14')?amiClient:routingClient;return _0x4a9fda[_0x3101('0x15')](_[_0x3101('0x16')](_0xd4010)+'Queues',_0x2189a7)[_0x3101('0x17')](function(_0x27cb0b){if(_0x27cb0b[_0x3101('0x10')])throw new Error(util['format'](_0x3101('0x18'),_0xd4010));return _0x3b0e1f(_0x27cb0b[_0x3101('0x19')]);})[_0x3101('0x1a')](function(_0x7dc16a){_0x4b4d44(_0x7dc16a);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x304605,_0x484956){return amiClient[_0x3101('0x15')](_0x3101('0x1b'),{})['then'](function(_0x592e6b){if(_0x592e6b[_0x3101('0x10')])throw new Error('Unable\x20to\x20retrieve\x20voice\x20queues\x20channels');return _0x304605(_0x592e6b['result']);})[_0x3101('0x1a')](function(_0x54c55d){_0x484956(_0x54c55d);});});}function initializeQueues(_0x27bf38,_0x2ecc9b,_0x48360b,_0x8b7b30){var _0x45c22b=[_0x3101('0x1c'),_0x3101('0x1d'),_0x3101('0x1e'),_0x3101('0x1f'),'paused'];if(_0x48360b===_0x3101('0x14')&&_0x8b7b30===_0x3101('0x20')){_0x45c22b[_0x3101('0x21')](_0x3101('0x22'),_0x3101('0x23'),'message',_0x3101('0x24'),_0x3101('0x25'),_0x3101('0x26'),_0x3101('0x27'),_0x3101('0x28'),'erlangCalls',_0x3101('0x29'),_0x3101('0x2a'),_0x3101('0x2b'),_0x3101('0x2c'),'dialPredictiveIntervalMaxThreshold',_0x3101('0x2d'),_0x3101('0x2e'),_0x3101('0x2f'),'predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout',_0x3101('0x30'),_0x3101('0x31'),_0x3101('0x32'));}return _0x27bf38[_0x3101('0x33')](function(_0x14d40e){var _0x50e083=_0x14d40e['get']({'plain':!![]});_0x50e083[_0x3101('0x34')]=[];_0x50e083[_0x3101('0x35')]=0x0;_0x50e083[_0x3101('0x36')]=0x0;_0x50e083[_0x3101('0x1c')]=0x0;_0x50e083[_0x3101('0x1d')]=0x0;_0x50e083[_0x3101('0x1e')]=0x0;if(_0x48360b===_0x3101('0x14')){_0x50e083[_0x3101('0x1f')]=0x0;_0x50e083[_0x3101('0x37')]=0x0;if(_0x8b7b30===_0x3101('0x20')){_0x50e083['pTalking']=0x0;_0x50e083[_0x3101('0x23')]=0x0;}}var _0x3bfe70=_[_0x3101('0x38')](_0x2ecc9b,['id',_0x50e083['id']]);if(_0x3bfe70)_['merge'](_0x50e083,_[_0x3101('0x39')](_0x3bfe70,_0x45c22b));return _0x50e083;});}function updateAgentVoiceStatus(_0x526828,_0x5a9c95,_0x42567f){var _0x58db2a=_[_0x3101('0x3a')](_0x42567f,[_0x3101('0x3b'),_0x5a9c95[_0x3101('0x12')]]);if(_0x58db2a['length']===0x0)return _0x526828[_0x3101('0x37')]=!![];if(_[_0x3101('0x3c')](_0x58db2a,[_0x3101('0x3d'),_0x526828['internal']['toString']()]))return _0x526828[_0x3101('0x1f')]=!![];if(!_0x526828[_0x3101('0x1f')])return _0x526828[_0x3101('0x37')]=!![];}function getVoiceQueueAgents(_0x237d86,_0x51c22b,_0x207000,_0x176978){var _0xcadf90=_[_0x3101('0x38')](_0x51c22b,['id',_0x237d86['id']]);if(!_0xcadf90)return _0x237d86;return _0xcadf90['getMembers']({'raw':!![]})[_0x3101('0x17')](function(_0x4edc1a){for(var _0x3e25bc=0x0;_0x3e25bc<_0x4edc1a[_0x3101('0x3e')];_0x3e25bc++){var _0xb786ac=_[_0x3101('0x38')](_0x207000,['id',_0x4edc1a[_0x3e25bc][_0x3101('0x3f')]]);if(!_0xb786ac){_0xb786ac={'id':_0x4edc1a[_0x3e25bc][_0x3101('0x3f')],'name':_0x4edc1a[_0x3e25bc]['UserId'],'accountcode':'','online':![]};}var _0x4121aa={'id':_0xb786ac['id'],'name':_0xb786ac[_0x3101('0x12')],'internal':_0xb786ac[_0x3101('0x40')],'online':Boolean(_0xb786ac[_0x3101('0x41')]),'paused':Boolean(_0x4edc1a[_0x3e25bc][_0x3101('0x35')])};if(_0xb786ac[_0x3101('0x42')]==='talking')updateAgentVoiceStatus(_0x4121aa,_0x237d86,_0x176978);if(_0x4121aa[_0x3101('0x41')])_0x237d86[_0x3101('0x36')]++;if(_0x4121aa['busy'])_0x237d86['busy']++;if(_0x4121aa[_0x3101('0x35')]&&!_0x4121aa[_0x3101('0x37')]&&!_0x4121aa[_0x3101('0x1f')])_0x237d86[_0x3101('0x35')]++;_0x237d86['agents']['push'](_0x4121aa);}return _0x237d86;});}function getQueueAgents(_0x274a8e,_0x39e06c,_0x444861){var _0x2d5940=_0x3101('0x43')+_['startCase'](_0x444861)+'Queue';var _0x4172d0=_0x444861+_0x3101('0x44');return db[_0x2d5940][_0x3101('0x45')]({'where':{[_[_0x3101('0x16')](_0x444861)+'QueueId']:_0x274a8e['id']},'raw':!![]})[_0x3101('0x17')](function(_0x568e31){for(var _0x167d2d=0x0;_0x167d2d<_0x568e31[_0x3101('0x3e')];_0x167d2d++){var _0x4a990e=_[_0x3101('0x38')](_0x39e06c,['id',_0x568e31[_0x167d2d]['UserId']]);if(!_0x4a990e){_0x4a990e={'id':_0x568e31[_0x167d2d]['UserId'],'name':_0x568e31[_0x167d2d][_0x3101('0x3f')],'online':![],['pauseField']:![]};}var _0x36751b={'id':_0x4a990e['id'],'name':_0x4a990e['name'],'online':Boolean(_0x4a990e['online']),'paused':Boolean(_0x4a990e[_0x4172d0])};if(_0x36751b[_0x3101('0x41')])_0x274a8e[_0x3101('0x36')]++;_0x274a8e[_0x3101('0x34')][_0x3101('0x21')](_0x36751b);}return _0x274a8e;});}function validateChannel(_0xeda388){var _0x175be3=utils[_0x3101('0x46')]();if(!_[_0x3101('0x47')](_0x175be3,_0xeda388[_0x3101('0x48')]()))throw new Error(_0x3101('0x49'));return _0xeda388[_0x3101('0x48')]();}exports[_0x3101('0x4a')]=function(_0x589c8f,_0x2f26bb){var _0x402d6b={'count':0x0,'rows':[]};var _0x5a539d={};var _0x45775f;var _0x2ddba0;var _0x4ca0ae;var _0x1392f1;var _0x32ded9=utils[_0x3101('0x46')]();var _0x2cd6f2=_0x589c8f['query'][_0x3101('0x4b')];var _0x1a3843=_0x589c8f[_0x3101('0x4c')]['globalStatusFilter'];var _0x489f89=_0x589c8f[_0x3101('0x4c')]['pauseTypeFilter'];var _0x32b373=_0x1a3843===_0x3101('0x4d')||_0x1a3843==='*pause'?!![]:![];var _0x429b6a=[];var _0x56b64c;Promise[_0x3101('0x4e')]()[_0x3101('0x17')](function(){if(_0x589c8f[_0x3101('0x4c')][_0x3101('0x4f')]){_0x45775f=validateChannel(_0x589c8f['query'][_0x3101('0x4f')]);}if(!_0x589c8f[_0x3101('0x4c')][_0x3101('0x50')]||!_0x589c8f[_0x3101('0x4c')]['sort'][_0x3101('0x47')](_0x3101('0x51'))){_0x589c8f[_0x3101('0x4c')][_0x3101('0x50')]=rta[_0x3101('0x52')](_0x589c8f[_0x3101('0x4c')][_0x3101('0x50')]);return;}var _0x22f019=rta['getUpdatedSortOptions'](_0x589c8f[_0x3101('0x4c')][_0x3101('0x50')]);_0x589c8f[_0x3101('0x4c')][_0x3101('0x50')]=_0x22f019[_0x3101('0x53')][_0x3101('0x54')](',');_0x2ddba0=_0x22f019[_0x3101('0x55')];})[_0x3101('0x17')](function(){if(!_0x2cd6f2){return[];}return rta['getAgentIdsByQueues'](_0x2cd6f2,_0x45775f);})[_0x3101('0x17')](function(_0x2be187){_0x429b6a=_0x2be187;return rta[_0x3101('0x56')]();})[_0x3101('0x17')](function(_0x2c48b5){_0x1392f1=_0x2c48b5['rows'];if((!_0x1a3843||_0x32b373)&&!_0x2ddba0){return _0x429b6a;}if(_0x2ddba0&&!_0x1a3843){return rta['getSortedAgentsIdsByStatus'](_0x1392f1,_0x429b6a,_0x2ddba0);}else{return rta[_0x3101('0x57')](_0x1392f1,_0x429b6a,_0x1a3843);}})['then'](function(_0x5dfed2){_0x429b6a=_0x5dfed2;var _0x283347=![];if(_0x429b6a[_0x3101('0x3e')]===0x0){if(_0x2cd6f2||_0x1a3843){_0x283347=!![];}if(_0x32b373){_0x283347=![];}}if(_0x283347){return _0x402d6b;}var _0x33ace5=_[_0x3101('0x33')](db[_0x3101('0x43')][_0x3101('0x58')],function(_0xfbd3a2){return{'name':_0xfbd3a2['fieldName'],'type':_0xfbd3a2['type'][_0x3101('0x59')]};});_0x589c8f['query'][_0x3101('0x5a')]=_0x3101('0x5b');_0x589c8f['query']['online']=!![];_0x5a539d=qs['getOptions'](_0x33ace5,_0x589c8f);_0x5a539d[_0x3101('0x5c')]=!![];var _0x1f8a97=[];if(_0x429b6a[_0x3101('0x3e')]>0x0){_0x1f8a97[_0x3101('0x21')]({'id':{'$in':_0x429b6a}});if(_0x2ddba0&&!_0x1a3843){_0x56b64c=[db[_0x3101('0x5d')][_0x3101('0x5e')](_0x3101('0x5f')+_0x429b6a+')')];_0x5a539d[_0x3101('0x55')]=_0x56b64c;}}if(_0x32b373){_0x32ded9[_0x3101('0x60')](function(_0x56b7f1){var _0x3ce4c3=!![];if(_0x1a3843==='*pause'&&_0x45775f!==_0x56b7f1){_0x3ce4c3=![];}_0x1f8a97['push']({[_0x56b7f1+_0x3101('0x44')]:_0x3ce4c3});});if(_0x489f89){_0x1f8a97['push']({'pauseType':_0x489f89});}}else if(_0x1a3843){_0x32ded9[_0x3101('0x60')](function(_0x2674ef){_0x1f8a97[_0x3101('0x21')]({[_0x2674ef+_0x3101('0x44')]:![]});});}_0x5a539d['where']=_[_0x3101('0x61')](_0x5a539d[_0x3101('0x62')],{'$and':_0x1f8a97});if(_0x589c8f[_0x3101('0x63')][_0x3101('0x5a')]===_0x3101('0x63')){var _0x2b2c67={'params':{'id':_0x589c8f[_0x3101('0x63')]['userProfileId']},'query':{'section':_0x3101('0x64'),'role':_0x3101('0x5b'),'online':!![],'raw':!![],'ids':_0x429b6a,'customSorting':_0x56b64c}};if(_0x32b373){_0x2b2c67[_0x3101('0x4c')][_0x3101('0x65')]=_0x1f8a97;}_0x2b2c67[_0x3101('0x4c')]=Object['assign'](_0x2b2c67[_0x3101('0x4c')],_0x589c8f[_0x3101('0x4c')]);delete _0x2b2c67[_0x3101('0x4c')]['id'];return db[_0x3101('0x66')][_0x3101('0x67')](_0x2b2c67);}return db[_0x3101('0x43')][_0x3101('0x68')](_0x5a539d);})[_0x3101('0x17')](function(_0x1517e0){_0x402d6b[_0x3101('0xb')]=_0x1517e0[_0x3101('0xb')];_0x4ca0ae=_0x1517e0['rows'];return _0x4ca0ae['map'](function(_0x5213a3){var _0x46c6ee=_[_0x3101('0x38')](_0x1392f1,['id',_0x5213a3['id']]);if(_0x46c6ee){var _0x372428=rta[_0x3101('0x69')](_0x46c6ee);_[_0x3101('0x61')](_0x5213a3,_0x372428);}_0x5213a3['globalStatus']=rta['getAgentStatus'](_0x5213a3);if(_0x5213a3[_0x3101('0x51')][_0x3101('0x47')](_0x3101('0x4d'))){_0x32ded9[_0x3101('0x60')](function(_0x5b9dbb){if(_0x5213a3[_0x5b9dbb+_0x3101('0x44')]){_0x5213a3[_0x5b9dbb+_0x3101('0x6a')]=_0x3101('0x4d');}});}return _0x5213a3;});})[_0x3101('0x17')](function(_0x4ee692){if(!_0x2ddba0||_0x56b64c){return _0x4ee692;}return rta['sortAgentsByStatus'](_0x4ee692,_0x2ddba0);})[_0x3101('0x17')](function(_0x7ef856){_0x402d6b[_0x3101('0x6b')]=_0x7ef856;return _0x402d6b;})[_0x3101('0x17')](respondWithFilteredResult(_0x2f26bb,_0x5a539d))[_0x3101('0x1a')](handleError(_0x2f26bb,null));};exports[_0x3101('0x6c')]=function(_0x18b8bf,_0x1afa2d){var _0x24cd53={'count':0x0,'rows':[]},_0x4ef6a1={},_0x32b157,_0x268f35,_0x12e44a,_0x42fa29,_0x562b9e;Promise[_0x3101('0x4e')]()[_0x3101('0x17')](function(){if(_0x18b8bf[_0x3101('0x4c')][_0x3101('0x4f')])_0x32b157=validateChannel(_0x18b8bf[_0x3101('0x4c')][_0x3101('0x4f')]);var _0x3cae22=_['startCase'](_0x32b157)+_0x3101('0x6d');var _0xa03275=_[_0x3101('0x33')](db[_0x3cae22][_0x3101('0x58')],function(_0x177adc){return{'name':_0x177adc['fieldName'],'type':_0x177adc[_0x3101('0x6e')]['key']};});_0x4ef6a1=qs['getOptions'](_0xa03275,_0x18b8bf);if(_0x18b8bf[_0x3101('0x63')]['role']==='user'){var _0x217e38={'params':{'id':_0x18b8bf['user'][_0x3101('0x6f')]},'query':{'section':_0x32b157===_0x3101('0x14')&&_0x18b8bf[_0x3101('0x4c')][_0x3101('0x6e')]===_0x3101('0x20')?'QueueCampaigns':_[_0x3101('0x16')](_0x32b157)+_0x3101('0x70'),'type':_0x18b8bf[_0x3101('0x4c')][_0x3101('0x6e')],'nolimit':!![],'sort':_0x3101('0x12'),'filter':_0x18b8bf['query'][_0x3101('0x3a')]}};return db[_0x3101('0x66')]['getResources'](_0x217e38);}return db[_0x3cae22]['findAndCountAll'](_0x4ef6a1);})[_0x3101('0x17')](function(_0x14c06f){_0x24cd53['count']=_0x14c06f[_0x3101('0xb')];_0x268f35=_0x14c06f[_0x3101('0x6b')];return getRealtimeQueues(_0x18b8bf,_0x32b157);})[_0x3101('0x17')](function(_0x129e89){_0x42fa29=_0x129e89[_0x3101('0x6b')];return rta[_0x3101('0x56')]();})[_0x3101('0x17')](function(_0x5829bf){_0x12e44a=_0x5829bf[_0x3101('0x6b')];if(_0x32b157!=_0x3101('0x14'))return;return getRealtimeVoiceQueueChannels();})['then'](function(_0x2a35e0){_0x562b9e=_0x2a35e0?_0x2a35e0[_0x3101('0x6b')]:[];return initializeQueues(_0x268f35,_0x42fa29,_0x32b157,_0x18b8bf[_0x3101('0x4c')][_0x3101('0x6e')]);})[_0x3101('0x17')](function(_0x3e4ee1){var _0x349e39=_0x3e4ee1[_0x3101('0x33')](function(_0x53dda5){if(_0x32b157===_0x3101('0x14'))return getVoiceQueueAgents(_0x53dda5,_0x268f35,_0x12e44a,_0x562b9e);else return getQueueAgents(_0x53dda5,_0x12e44a,_0x32b157);});return Promise[_0x3101('0x71')](_0x349e39);})['then'](function(_0x28b155){_0x24cd53['rows']=_0x28b155;return _0x24cd53;})[_0x3101('0x17')](respondWithFilteredResult(_0x1afa2d,_0x4ef6a1))[_0x3101('0x1a')](handleError(_0x1afa2d,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 325262f..ab60aa0 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x3e2789,_0x6d23c6){var _0x4371ba=function(_0x4d5af7){while(--_0x4d5af7){_0x3e2789['push'](_0x3e2789['shift']());}};_0x4371ba(++_0x6d23c6);}(_0x9c44,0x178));var _0x49c4=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x9c44[_0x279d37];return _0x530173;};'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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x1d646a,_0x270393){var _0x1e29bb=function(_0x3540e4){while(--_0x3540e4){_0x1d646a['push'](_0x1d646a['shift']());}};_0x1e29bb(++_0x270393);}(_0xedd9,0xfc));var _0x9edd=function(_0x2bda45,_0x3e42e5){_0x2bda45=_0x2bda45-0x0;var _0x2a268b=_0xedd9[_0x2bda45];return _0x2a268b;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index cef53a3..42fe59e 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 _0xc949=['DATE','sequelize','INTEGER','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc949,0x181));var _0x9c94=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xc949[_0x2763f2];return _0x3ef471;};'use strict';var Sequelize=require(_0x9c94('0x0'));module['exports']={'state':{'type':Sequelize[_0x9c94('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x9c94('0x2')]},'scheduledat':{'type':Sequelize[_0x9c94('0x3')]},'uniqueid':{'type':Sequelize[_0x9c94('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x9c94('0x3')]},'ringtime':{'type':Sequelize[_0x9c94('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x9c94('0x2')]},'membername':{'type':Sequelize[_0x9c94('0x2')]}}; \ No newline at end of file +var _0xc73a=['STRING','DATE','exports','INTEGER'];(function(_0x5c54a8,_0x5273ff){var _0x4a159a=function(_0x480421){while(--_0x480421){_0x5c54a8['push'](_0x5c54a8['shift']());}};_0x4a159a(++_0x5273ff);}(_0xc73a,0x72));var _0xac73=function(_0x3c9bfa,_0x4ca0a8){_0x3c9bfa=_0x3c9bfa-0x0;var _0x2eee69=_0xc73a[_0x3c9bfa];return _0x2eee69;};'use strict';var Sequelize=require('sequelize');module[_0xac73('0x0')]={'state':{'type':Sequelize[_0xac73('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xac73('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xac73('0x3')]},'responsetime':{'type':Sequelize[_0xac73('0x3')]},'ringtime':{'type':Sequelize[_0xac73('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xac73('0x2')]},'membername':{'type':Sequelize[_0xac73('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index f4c46d1..530adf2 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 _0x9def=['../../config/logger','api','bluebird','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','lodash','util'];(function(_0x681d76,_0xca39a2){var _0x5cf416=function(_0x79b885){while(--_0x79b885){_0x681d76['push'](_0x681d76['shift']());}};_0x5cf416(++_0xca39a2);}(_0x9def,0x85));var _0xf9de=function(_0x491225,_0x3c1bb3){_0x491225=_0x491225-0x0;var _0x2553e4=_0x9def[_0x491225];return _0x2553e4;};'use strict';var _=require(_0xf9de('0x0'));var util=require(_0xf9de('0x1'));var logger=require(_0xf9de('0x2'))(_0xf9de('0x3'));var moment=require('moment');var BPromise=require(_0xf9de('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf9de('0x5'));var config=require(_0xf9de('0x6'));var attributes=require(_0xf9de('0x7'));module[_0xf9de('0x8')]=function(_0x3713c4,_0x5895bb){return _0x3713c4['define']('ReportAgentPreview',attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd34a=['api','moment','bluebird','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','report_agent_preview','lodash','util','../../config/logger'];(function(_0x17bafe,_0x461a5c){var _0x210924=function(_0x1f6c27){while(--_0x1f6c27){_0x17bafe['push'](_0x17bafe['shift']());}};_0x210924(++_0x461a5c);}(_0xd34a,0xb3));var _0xad34=function(_0x480018,_0x43bc88){_0x480018=_0x480018-0x0;var _0x1aad71=_0xd34a[_0x480018];return _0x1aad71;};'use strict';var _=require(_0xad34('0x0'));var util=require(_0xad34('0x1'));var logger=require(_0xad34('0x2'))(_0xad34('0x3'));var moment=require(_0xad34('0x4'));var BPromise=require(_0xad34('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xad34('0x6'));var rimraf=require(_0xad34('0x7'));var config=require(_0xad34('0x8'));var attributes=require(_0xad34('0x9'));module[_0xad34('0xa')]=function(_0x453ec2,_0x2c951e){return _0x453ec2[_0xad34('0xb')]('ReportAgentPreview',attributes,{'tableName':_0xad34('0xc'),'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 1c022ad..be7fcc4 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 _0x99b1=['raw','then','info','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options'];(function(_0x23be51,_0xc02a1b){var _0x47a26d=function(_0xa92395){while(--_0xa92395){_0x23be51['push'](_0x23be51['shift']());}};_0x47a26d(++_0xc02a1b);}(_0x99b1,0x1a7));var _0x199b=function(_0x7b4322,_0xc3663e){_0x7b4322=_0x7b4322-0x0;var _0x28cfa8=_0x99b1[_0x7b4322];return _0x28cfa8;};'use strict';var _=require(_0x199b('0x0'));var util=require('util');var moment=require(_0x199b('0x1'));var BPromise=require(_0x199b('0x2'));var rs=require(_0x199b('0x3'));var fs=require('fs');var Redis=require(_0x199b('0x4'));var db=require(_0x199b('0x5'))['db'];var utils=require(_0x199b('0x6'));var logger=require(_0x199b('0x7'))(_0x199b('0x8'));var config=require(_0x199b('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x199b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c278c,_0x37dc77,_0x206aea){return new BPromise(function(_0x1edc1c,_0x16bad9){return client[_0x199b('0xb')](_0x3c278c,_0x206aea)['then'](function(_0x3dcb25){logger['info'](_0x199b('0xc'),_0x37dc77,'request\x20sent');logger[_0x199b('0xd')](_0x199b('0xe'),_0x37dc77,_0x199b('0xf'),JSON[_0x199b('0x10')](_0x3dcb25));if(_0x3dcb25[_0x199b('0x11')]){if(_0x3dcb25[_0x199b('0x11')][_0x199b('0x12')]===0x1f4){logger[_0x199b('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x37dc77,_0x3dcb25[_0x199b('0x11')]['message']);return _0x16bad9(_0x3dcb25['error'][_0x199b('0x13')]);}logger[_0x199b('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x37dc77,_0x3dcb25[_0x199b('0x11')][_0x199b('0x13')]);return _0x1edc1c(_0x3dcb25[_0x199b('0x11')][_0x199b('0x13')]);}else{logger['info'](_0x199b('0xc'),_0x37dc77,_0x199b('0xf'));_0x1edc1c(_0x3dcb25[_0x199b('0x14')][_0x199b('0x13')]);}})[_0x199b('0x15')](function(_0x1c25d4){logger['error'](_0x199b('0xc'),_0x37dc77,_0x1c25d4);_0x16bad9(_0x1c25d4);});});}exports[_0x199b('0x16')]=function(_0x3b1fd1){var _0x2a246a=this;return new Promise(function(_0xd1cb2c,_0x1a288f){return db[_0x199b('0x17')][_0x199b('0x18')](_0x3b1fd1[_0x199b('0x19')],{'raw':_0x3b1fd1[_0x199b('0x1a')]?_0x3b1fd1[_0x199b('0x1a')][_0x199b('0x1b')]===undefined?!![]:![]:!![]})[_0x199b('0x1c')](function(_0x1b7283){logger[_0x199b('0x1d')](_0x199b('0x16'),_0x3b1fd1);logger[_0x199b('0xd')](_0x199b('0x16'),_0x3b1fd1,JSON[_0x199b('0x10')](_0x1b7283));_0xd1cb2c(_0x1b7283);})[_0x199b('0x15')](function(_0x41de3f){logger[_0x199b('0x11')](_0x199b('0x16'),_0x41de3f['message'],_0x3b1fd1);_0x1a288f(_0x2a246a[_0x199b('0x11')](0x1f4,_0x41de3f['message']));});});}; \ No newline at end of file +var _0x096a=['raw','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','ReportAgentPreview,\x20%s,\x20%s','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options'];(function(_0x1a4a06,_0x36a5c2){var _0x49ec08=function(_0x497f24){while(--_0x497f24){_0x1a4a06['push'](_0x1a4a06['shift']());}};_0x49ec08(++_0x36a5c2);}(_0x096a,0x17a));var _0xa096=function(_0x171e0c,_0x424bdc){_0x171e0c=_0x171e0c-0x0;var _0x48d91d=_0x096a[_0x171e0c];return _0x48d91d;};'use strict';var _=require('lodash');var util=require(_0xa096('0x0'));var moment=require('moment');var BPromise=require(_0xa096('0x1'));var rs=require(_0xa096('0x2'));var fs=require('fs');var Redis=require(_0xa096('0x3'));var db=require(_0xa096('0x4'))['db'];var utils=require(_0xa096('0x5'));var logger=require(_0xa096('0x6'))(_0xa096('0x7'));var config=require('../../config/environment');var jayson=require(_0xa096('0x8'));var client=jayson[_0xa096('0x9')][_0xa096('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x439ea1,_0xf0c866,_0x2c7e91){return new BPromise(function(_0x222a7c,_0x5d4113){return client[_0xa096('0xb')](_0x439ea1,_0x2c7e91)[_0xa096('0xc')](function(_0x2a01a6){logger[_0xa096('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0xf0c866,_0xa096('0xe'));logger[_0xa096('0xf')](_0xa096('0x10'),_0xf0c866,_0xa096('0xe'),JSON[_0xa096('0x11')](_0x2a01a6));if(_0x2a01a6[_0xa096('0x12')]){if(_0x2a01a6[_0xa096('0x12')]['code']===0x1f4){logger['error'](_0xa096('0x13'),_0xf0c866,_0x2a01a6[_0xa096('0x12')][_0xa096('0x14')]);return _0x5d4113(_0x2a01a6['error'][_0xa096('0x14')]);}logger[_0xa096('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0xf0c866,_0x2a01a6[_0xa096('0x12')][_0xa096('0x14')]);return _0x222a7c(_0x2a01a6[_0xa096('0x12')][_0xa096('0x14')]);}else{logger[_0xa096('0xd')](_0xa096('0x13'),_0xf0c866,_0xa096('0xe'));_0x222a7c(_0x2a01a6[_0xa096('0x15')]['message']);}})[_0xa096('0x16')](function(_0x572906){logger[_0xa096('0x12')](_0xa096('0x13'),_0xf0c866,_0x572906);_0x5d4113(_0x572906);});});}exports[_0xa096('0x17')]=function(_0x45b360){var _0x20d3da=this;return new Promise(function(_0x36f179,_0x1a6253){return db[_0xa096('0x18')][_0xa096('0x19')](_0x45b360[_0xa096('0x1a')],{'raw':_0x45b360['options']?_0x45b360[_0xa096('0x1b')][_0xa096('0x1c')]===undefined?!![]:![]:!![]})[_0xa096('0xc')](function(_0x45d1f3){logger[_0xa096('0xd')](_0xa096('0x17'),_0x45b360);logger[_0xa096('0xf')](_0xa096('0x17'),_0x45b360,JSON['stringify'](_0x45d1f3));_0x36f179(_0x45d1f3);})[_0xa096('0x16')](function(_0x55b12b){logger[_0xa096('0x12')](_0xa096('0x17'),_0x55b12b[_0xa096('0x14')],_0x45b360);_0x1a6253(_0x20d3da[_0xa096('0x12')](0x1f4,_0x55b12b[_0xa096('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 6637bc8..aac7db0 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 _0x6f36=['/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/:id','put','updateVoiceQueue','/outbound','/outbound/channels','outboundChannels','/agents','agents','agentCapacity','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','mail','showMailQueues','post','/chat/queues/:id/notify','chat','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','path','express','Router','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','/chat/queues','chatQueues','mailQueues'];(function(_0x40e4a1,_0x1bb88b){var _0x284d37=function(_0x120d00){while(--_0x120d00){_0x40e4a1['push'](_0x40e4a1['shift']());}};_0x284d37(++_0x1bb88b);}(_0x6f36,0x8e));var _0x66f3=function(_0x157ecc,_0x359b87){_0x157ecc=_0x157ecc-0x0;var _0x1b42a0=_0x6f36[_0x157ecc];return _0x1b42a0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x66f3('0x0'));var express=require(_0x66f3('0x1'));var router=express[_0x66f3('0x2')]();var auth=require(_0x66f3('0x3'));var controller=require(_0x66f3('0x4'));router[_0x66f3('0x5')]('/voice/channels',auth[_0x66f3('0x6')](),controller[_0x66f3('0x7')]);router[_0x66f3('0x5')]('/voice/channels/:uniqueid/mixmonitor',auth['isAuthenticated'](),controller[_0x66f3('0x8')]);router[_0x66f3('0x5')](_0x66f3('0x9'),auth[_0x66f3('0x6')](),controller['voiceChannelStopMixMonitor']);router[_0x66f3('0x5')](_0x66f3('0xa'),auth[_0x66f3('0x6')](),controller['voiceQueues']);router[_0x66f3('0x5')](_0x66f3('0xb'),auth[_0x66f3('0x6')](),controller[_0x66f3('0xc')]);router[_0x66f3('0x5')]('/mail/queues',auth['isAuthenticated'](),controller[_0x66f3('0xd')]);router[_0x66f3('0x5')](_0x66f3('0xe'),auth['isAuthenticated'](),controller[_0x66f3('0xf')]);router['get'](_0x66f3('0x10'),auth[_0x66f3('0x6')](),controller[_0x66f3('0x11')]);router[_0x66f3('0x5')](_0x66f3('0x12'),auth[_0x66f3('0x6')](),controller[_0x66f3('0x13')]);router[_0x66f3('0x5')](_0x66f3('0x14'),auth[_0x66f3('0x6')](),controller[_0x66f3('0x15')]);router[_0x66f3('0x5')](_0x66f3('0x16'),auth[_0x66f3('0x6')](),controller[_0x66f3('0x17')]);router['get'](_0x66f3('0x18'),auth[_0x66f3('0x6')](),controller[_0x66f3('0x19')]);router[_0x66f3('0x5')](_0x66f3('0x1a'),auth['isAuthenticated'](),controller[_0x66f3('0x1b')]);router[_0x66f3('0x5')](_0x66f3('0x1c'),auth[_0x66f3('0x6')](),controller[_0x66f3('0x1d')]);router[_0x66f3('0x5')](_0x66f3('0x1e'),auth[_0x66f3('0x6')](),controller[_0x66f3('0x1f')]);router[_0x66f3('0x5')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x66f3('0x6')](),controller['voiceQueuesChannelRedirect']);router[_0x66f3('0x5')](_0x66f3('0x20'),auth[_0x66f3('0x6')](),controller['showVoiceQueues']);router[_0x66f3('0x21')](_0x66f3('0x20'),auth[_0x66f3('0x6')](),controller[_0x66f3('0x22')]);router[_0x66f3('0x5')](_0x66f3('0x23'),auth[_0x66f3('0x6')](),controller['outbound']);router[_0x66f3('0x5')](_0x66f3('0x24'),auth[_0x66f3('0x6')](),controller[_0x66f3('0x25')]);router[_0x66f3('0x5')](_0x66f3('0x26'),auth['isAuthenticated'](),controller[_0x66f3('0x27')]);router[_0x66f3('0x21')]('/agents/:id/capacity',auth[_0x66f3('0x6')](),controller[_0x66f3('0x28')]);router[_0x66f3('0x5')]('/telephones',auth[_0x66f3('0x6')](),controller[_0x66f3('0x29')]);router['get'](_0x66f3('0x2a'),auth['isAuthenticated'](),controller[_0x66f3('0x2b')]);router[_0x66f3('0x5')](_0x66f3('0x2c'),auth['isAuthenticated'](),controller[_0x66f3('0x2d')]);router[_0x66f3('0x5')](_0x66f3('0x2e'),auth[_0x66f3('0x6')](),controller['faxAccounts']);router['get'](_0x66f3('0x2f'),auth['isAuthenticated'](),controller[_0x66f3('0x30')]);router[_0x66f3('0x5')](_0x66f3('0x31'),auth[_0x66f3('0x6')](),controller[_0x66f3('0x32')]);router[_0x66f3('0x5')](_0x66f3('0x33'),auth['isAuthenticated'](),controller[_0x66f3('0x34')]);router['get'](_0x66f3('0x35'),auth['isAuthenticated'](),controller[_0x66f3('0x36')]);router[_0x66f3('0x5')](_0x66f3('0x37'),auth[_0x66f3('0x6')](),controller['smsQueuesWaitingInteractions']);router[_0x66f3('0x5')]('/whatsapp/queues/waitinginteractions',auth[_0x66f3('0x6')](),controller[_0x66f3('0x38')]);router[_0x66f3('0x5')]('/fax/queues/waitinginteractions',auth[_0x66f3('0x6')](),controller[_0x66f3('0x39')]);router['post']('/mail/queues/:id/notify',auth[_0x66f3('0x6')](),controller[_0x66f3('0x3a')](_0x66f3('0x3b')));router[_0x66f3('0x5')]('/mail/queues/:id',auth[_0x66f3('0x6')](),controller[_0x66f3('0x3c')]);router[_0x66f3('0x3d')](_0x66f3('0x3e'),auth[_0x66f3('0x6')](),controller[_0x66f3('0x3a')](_0x66f3('0x3f')));router[_0x66f3('0x5')]('/chat/queues/:id',auth['isAuthenticated'](),controller[_0x66f3('0x40')]);router[_0x66f3('0x3d')](_0x66f3('0x41'),auth['isAuthenticated'](),controller[_0x66f3('0x3a')]('fax'));router[_0x66f3('0x5')](_0x66f3('0x42'),auth[_0x66f3('0x6')](),controller[_0x66f3('0x43')]);router[_0x66f3('0x3d')](_0x66f3('0x44'),auth[_0x66f3('0x6')](),controller['queueNotify'](_0x66f3('0x45')));router['get']('/openchannel/queues/:id',auth[_0x66f3('0x6')](),controller[_0x66f3('0x46')]);router['post']('/sms/queues/:id/notify',auth['isAuthenticated'](),controller[_0x66f3('0x3a')]('sms'));router['post'](_0x66f3('0x47'),auth[_0x66f3('0x6')](),controller[_0x66f3('0x3a')](_0x66f3('0x48')));router[_0x66f3('0x5')](_0x66f3('0x49'),auth[_0x66f3('0x6')](),controller[_0x66f3('0x4a')]);router[_0x66f3('0x5')](_0x66f3('0x4b'),auth[_0x66f3('0x6')](),controller['showWhatsappQueues']);router[_0x66f3('0x3d')](_0x66f3('0x4c'),auth['isAuthenticated'](),controller[_0x66f3('0x4d')]);module['exports']=router; \ No newline at end of file +var _0xa109=['isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','mailQueues','mailAccounts','openchannelQueues','/sms/queues','/whatsapp/queues','whatsappQueues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','/outbound','outbound','/outbound/channels','outboundChannels','/agents','/agents/:id/capacity','agentCapacity','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','mail','showMailQueues','post','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','queueNotify','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','multer','path','express','Router','./rpc.controller','get','/voice/channels'];(function(_0x5bce1a,_0x4e5f10){var _0x2c58e6=function(_0x1004e9){while(--_0x1004e9){_0x5bce1a['push'](_0x5bce1a['shift']());}};_0x2c58e6(++_0x4e5f10);}(_0xa109,0xf2));var _0x9a10=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xa109[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x9a10('0x0'));var util=require('util');var path=require(_0x9a10('0x1'));var express=require(_0x9a10('0x2'));var router=express[_0x9a10('0x3')]();var auth=require('../../components/auth/service');var controller=require(_0x9a10('0x4'));router[_0x9a10('0x5')](_0x9a10('0x6'),auth[_0x9a10('0x7')](),controller[_0x9a10('0x8')]);router[_0x9a10('0x5')](_0x9a10('0x9'),auth[_0x9a10('0x7')](),controller[_0x9a10('0xa')]);router[_0x9a10('0x5')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x9a10('0x7')](),controller[_0x9a10('0xb')]);router[_0x9a10('0x5')](_0x9a10('0xc'),auth[_0x9a10('0x7')](),controller[_0x9a10('0xd')]);router[_0x9a10('0x5')](_0x9a10('0xe'),auth[_0x9a10('0x7')](),controller['chatQueues']);router[_0x9a10('0x5')](_0x9a10('0xf'),auth[_0x9a10('0x7')](),controller[_0x9a10('0x10')]);router[_0x9a10('0x5')]('/mail/accounts',auth[_0x9a10('0x7')](),controller[_0x9a10('0x11')]);router['get']('/openchannel/queues',auth['isAuthenticated'](),controller[_0x9a10('0x12')]);router[_0x9a10('0x5')](_0x9a10('0x13'),auth[_0x9a10('0x7')](),controller['smsQueues']);router[_0x9a10('0x5')](_0x9a10('0x14'),auth[_0x9a10('0x7')](),controller[_0x9a10('0x15')]);router[_0x9a10('0x5')](_0x9a10('0x16'),auth[_0x9a10('0x7')](),controller['faxQueues']);router[_0x9a10('0x5')](_0x9a10('0x17'),auth['isAuthenticated'](),controller[_0x9a10('0x18')]);router['get'](_0x9a10('0x19'),auth[_0x9a10('0x7')](),controller['voiceQueuesChannels']);router[_0x9a10('0x5')](_0x9a10('0x1a'),auth[_0x9a10('0x7')](),controller[_0x9a10('0x1b')]);router[_0x9a10('0x5')](_0x9a10('0x1c'),auth[_0x9a10('0x7')](),controller[_0x9a10('0x1d')]);router[_0x9a10('0x5')](_0x9a10('0x1e'),auth['isAuthenticated'](),controller[_0x9a10('0x1f')]);router[_0x9a10('0x5')](_0x9a10('0x20'),auth[_0x9a10('0x7')](),controller[_0x9a10('0x21')]);router[_0x9a10('0x22')](_0x9a10('0x20'),auth[_0x9a10('0x7')](),controller['updateVoiceQueue']);router['get'](_0x9a10('0x23'),auth[_0x9a10('0x7')](),controller[_0x9a10('0x24')]);router['get'](_0x9a10('0x25'),auth[_0x9a10('0x7')](),controller[_0x9a10('0x26')]);router[_0x9a10('0x5')](_0x9a10('0x27'),auth[_0x9a10('0x7')](),controller['agents']);router[_0x9a10('0x22')](_0x9a10('0x28'),auth[_0x9a10('0x7')](),controller[_0x9a10('0x29')]);router[_0x9a10('0x5')]('/telephones',auth['isAuthenticated'](),controller[_0x9a10('0x2a')]);router[_0x9a10('0x5')](_0x9a10('0x2b'),auth[_0x9a10('0x7')](),controller[_0x9a10('0x2c')]);router[_0x9a10('0x5')](_0x9a10('0x2d'),auth[_0x9a10('0x7')](),controller[_0x9a10('0x2e')]);router[_0x9a10('0x5')](_0x9a10('0x2f'),auth[_0x9a10('0x7')](),controller[_0x9a10('0x30')]);router[_0x9a10('0x5')](_0x9a10('0x31'),auth[_0x9a10('0x7')](),controller[_0x9a10('0x32')]);router[_0x9a10('0x5')](_0x9a10('0x33'),auth[_0x9a10('0x7')](),controller[_0x9a10('0x34')]);router[_0x9a10('0x5')](_0x9a10('0x35'),auth[_0x9a10('0x7')](),controller[_0x9a10('0x36')]);router[_0x9a10('0x5')]('/openchannel/queues/:id/waitinginteractions',auth['isAuthenticated'](),controller[_0x9a10('0x37')]);router[_0x9a10('0x5')](_0x9a10('0x38'),auth[_0x9a10('0x7')](),controller[_0x9a10('0x39')]);router['get'](_0x9a10('0x3a'),auth[_0x9a10('0x7')](),controller[_0x9a10('0x3b')]);router[_0x9a10('0x5')](_0x9a10('0x3c'),auth[_0x9a10('0x7')](),controller[_0x9a10('0x3d')]);router['post'](_0x9a10('0x3e'),auth[_0x9a10('0x7')](),controller['queueNotify'](_0x9a10('0x3f')));router['get']('/mail/queues/:id',auth[_0x9a10('0x7')](),controller[_0x9a10('0x40')]);router[_0x9a10('0x41')](_0x9a10('0x42'),auth[_0x9a10('0x7')](),controller['queueNotify'](_0x9a10('0x43')));router['get'](_0x9a10('0x44'),auth['isAuthenticated'](),controller[_0x9a10('0x45')]);router[_0x9a10('0x41')]('/fax/queues/:id/notify',auth[_0x9a10('0x7')](),controller[_0x9a10('0x46')](_0x9a10('0x47')));router[_0x9a10('0x5')]('/fax/queues/:id',auth[_0x9a10('0x7')](),controller[_0x9a10('0x48')]);router[_0x9a10('0x41')](_0x9a10('0x49'),auth[_0x9a10('0x7')](),controller[_0x9a10('0x46')](_0x9a10('0x4a')));router[_0x9a10('0x5')](_0x9a10('0x4b'),auth[_0x9a10('0x7')](),controller['showOpenchannelQueues']);router[_0x9a10('0x41')](_0x9a10('0x4c'),auth[_0x9a10('0x7')](),controller[_0x9a10('0x46')](_0x9a10('0x4d')));router['post'](_0x9a10('0x4e'),auth[_0x9a10('0x7')](),controller[_0x9a10('0x46')]('whatsapp'));router[_0x9a10('0x5')]('/sms/queues/:id',auth[_0x9a10('0x7')](),controller['showSmsQueues']);router[_0x9a10('0x5')](_0x9a10('0x4f'),auth[_0x9a10('0x7')](),controller[_0x9a10('0x50')]);router[_0x9a10('0x41')]('/agents/:id/notify',auth[_0x9a10('0x7')](),controller[_0x9a10('0x51')]);module[_0x9a10('0x52')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index a76889e..e6d3b21 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 _0x9957=['queueNotify','capitalize','chat','Website','Account','findOne','Message','messageId','Interaction','\x20Message\x20not\x20found','MessageId','InteractionId','QueueId','TransferReport','Start','queue','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','agent','Agent\x20not\x20found','From','create','bluebird','moment','lodash','util','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','catch','status','json','stack','name','send','isNil','rows','find','merge','query','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','findOrCreate','format','interface','internal','AgentCapacity','telephones','Telephones','trunks','chatQueues','ChatQueues','showChatQueues','MailQueues','showMailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','FaxQueues','showFaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions'];(function(_0x20c3ba,_0x3935fb){var _0x49406d=function(_0x2d550b){while(--_0x2d550b){_0x20c3ba['push'](_0x20c3ba['shift']());}};_0x49406d(++_0x3935fb);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var BPromise=require(_0x7995('0x0'));var moment=require(_0x7995('0x1'));var _=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x7995('0x4'))(_0x7995('0x5'));var jayson=require(_0x7995('0x6'));var amiClient=jayson[_0x7995('0x7')]['http']({'port':0x232a});var mailClient=jayson[_0x7995('0x7')][_0x7995('0x8')]({'port':0x232b});var routingClient=jayson[_0x7995('0x7')][_0x7995('0x8')]({'port':0x232c});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){var _0x4a64f7=_0x4996ca?_0x4996ca:amiClient;return _0x4a64f7[_0x7995('0x9')](_0xbda126,_0x326741)[_0x7995('0xa')](function(_0x18c8a3){if(_0x18c8a3[_0x7995('0xb')]){if(_0x18c8a3[_0x7995('0xb')][_0x7995('0xc')]===0x1f4){return _0x1cad37(_0x18c8a3[_0x7995('0xb')]['message']);}return _0x465276(_0x18c8a3[_0x7995('0xb')][_0x7995('0xd')]);}else{_0x465276(_0x18c8a3['result']);}})[_0x7995('0xe')](function(_0x2cb37a){_0x1cad37(_0x2cb37a);});});}function respondWithResult(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xc8;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0xf')](_0x385f00)[_0x7995('0x10')](_0x281576);}return _0x19a27e['sendStatus'](0x194);};}function handleError(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0x1f4;return function(_0x2233dd){logger[_0x7995('0xb')](_0x2233dd[_0x7995('0x11')]);if(_0x2233dd[_0x7995('0x12')]){delete _0x2233dd[_0x7995('0x12')];}_0x58f5ad[_0x7995('0xf')](_0x2b4e94)[_0x7995('0x13')](_0x2233dd);};}function findById(_0x5377e5){return function(_0x2eeacc){if(!_['isNil'](_0x5377e5)&&!_[_0x7995('0x14')](_0x2eeacc)&&!_[_0x7995('0x14')](_0x2eeacc[_0x7995('0x15')])){return _[_0x7995('0x16')](_0x2eeacc[_0x7995('0x15')],function(_0x37a7d4){return _0x37a7d4['id']==_0x5377e5;});}return null;};}exports['voiceChannels']=function(_0x54c9ae,_0x2536c8){return respondWithRpcPromise('VoiceChannels',_0x54c9ae['query'])[_0x7995('0xa')](respondWithResult(_0x2536c8,null))[_0x7995('0xe')](handleError(_0x2536c8,null));};exports['voiceChannelMixMonitor']=function(_0x3a9b54,_0x51f276){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x7995('0x17')](_0x3a9b54[_0x7995('0x18')],_0x3a9b54[_0x7995('0x19')]))[_0x7995('0xa')](respondWithResult(_0x51f276,null))[_0x7995('0xe')](handleError(_0x51f276,null));};exports[_0x7995('0x1a')]=function(_0x5d40ae,_0x32a09a){return respondWithRpcPromise(_0x7995('0x1b'),_[_0x7995('0x17')](_0x5d40ae[_0x7995('0x18')],_0x5d40ae[_0x7995('0x19')]))[_0x7995('0xa')](respondWithResult(_0x32a09a,null))[_0x7995('0xe')](handleError(_0x32a09a,null));};exports[_0x7995('0x1c')]=function(_0x59405a,_0x39df42){return respondWithRpcPromise(_0x7995('0x1d'),_0x59405a[_0x7995('0x18')])[_0x7995('0xa')](respondWithResult(_0x39df42,null))[_0x7995('0xe')](handleError(_0x39df42,null));};exports[_0x7995('0x1e')]=function(_0x56691a,_0x47625f){return respondWithRpcPromise('VoiceQueues',_0x56691a[_0x7995('0x18')])[_0x7995('0xa')](findById(_0x56691a[_0x7995('0x19')]['id']))[_0x7995('0xa')](respondWithResult(_0x47625f,null))[_0x7995('0xe')](handleError(_0x47625f,null));};exports['updateVoiceQueue']=function(_0x9b2a15,_0x514445){return respondWithRpcPromise(_0x7995('0x1f'),_[_0x7995('0x17')](_0x9b2a15[_0x7995('0x20')],_0x9b2a15['params']))['then'](respondWithResult(_0x514445,null))['catch'](handleError(_0x514445,null));};exports[_0x7995('0x21')]=function(_0xe6b0b3,_0x327a81){return respondWithRpcPromise(_0x7995('0x22'),_[_0x7995('0x17')](_0xe6b0b3[_0x7995('0x18')],_0xe6b0b3['params']))['then'](respondWithResult(_0x327a81,null))[_0x7995('0xe')](handleError(_0x327a81,null));};exports['voiceQueuesChannels']=function(_0x553671,_0x3eb566){return respondWithRpcPromise(_0x7995('0x23'),_0x553671[_0x7995('0x18')])[_0x7995('0xa')](respondWithResult(_0x3eb566,null))['catch'](handleError(_0x3eb566,null));};exports[_0x7995('0x24')]=function(_0x33e24e,_0x5dd802){return respondWithRpcPromise('VoiceQueuesChannel',_['merge'](_0x33e24e[_0x7995('0x18')],_0x33e24e[_0x7995('0x19')]))['then'](respondWithResult(_0x5dd802,null))[_0x7995('0xe')](handleError(_0x5dd802,null));};exports['voiceQueuesChannelHangup']=function(_0x37917b,_0x1cb058){return respondWithRpcPromise(_0x7995('0x25'),_['merge'](_0x37917b['query'],_0x37917b[_0x7995('0x19')]))['then'](respondWithResult(_0x1cb058,null))['catch'](handleError(_0x1cb058,null));};exports[_0x7995('0x26')]=function(_0xe328b1,_0x5212ff){return respondWithRpcPromise(_0x7995('0x27'),_[_0x7995('0x17')](_0xe328b1[_0x7995('0x18')],_0xe328b1[_0x7995('0x19')]))[_0x7995('0xa')](respondWithResult(_0x5212ff,null))['catch'](handleError(_0x5212ff,null));};exports[_0x7995('0x28')]=function(_0x242713,_0xf612e6){return respondWithRpcPromise(_0x7995('0x29'),_0x242713['query'])[_0x7995('0xa')](respondWithResult(_0xf612e6,null))[_0x7995('0xe')](handleError(_0xf612e6,null));};exports[_0x7995('0x2a')]=function(_0xe5ea43,_0x1f5bee){return respondWithRpcPromise(_0x7995('0x2b'),_0xe5ea43['query'])[_0x7995('0xa')](respondWithResult(_0x1f5bee,null))[_0x7995('0xe')](handleError(_0x1f5bee,null));};exports[_0x7995('0x2c')]=function(_0x2ea47f,_0x2e04cd){var _0x298fc2;return respondWithRpcPromise(_0x7995('0x2d'),_0x2ea47f[_0x7995('0x18')])[_0x7995('0xa')](function(_0x447981){_0x298fc2=_0x447981;return respondWithRpcPromise(_0x7995('0x2d'),_0x2ea47f[_0x7995('0x18')],routingClient);})[_0x7995('0xa')](function(_0x53cda2){return _['merge']({},_0x53cda2,_0x298fc2);})[_0x7995('0xa')](respondWithResult(_0x2e04cd,null))[_0x7995('0xe')](handleError(_0x2e04cd,null));};exports['agentCapacity']=function(_0x4b0855,_0x3f8522){if(_0x4b0855['body']&&_0x4b0855['body'][_0x7995('0x2e')]&&_0x4b0855[_0x7995('0x2f')]&&_0x4b0855[_0x7995('0x2f')]['name']){for(var _0x46ac4f in _0x4b0855['body'][_0x7995('0x2e')]){if(_0x4b0855['body']['interaction'][_0x7995('0x30')](_0x46ac4f)){db[_0x7995('0x31')][_0x7995('0x32')]({'where':{'channel':_0x46ac4f,'membername':_0x4b0855[_0x7995('0x2f')]['name'],'type':_0x7995('0x33'),'exitAt':null,'uniqueid':_0x4b0855[_0x7995('0x20')][_0x7995('0x2e')][_0x46ac4f]&&_0x4b0855[_0x7995('0x20')]['interaction'][_0x46ac4f]['length']?{'$notIn':_0x4b0855[_0x7995('0x20')]['interaction'][_0x46ac4f]}:{'$ne':null}}})[_0x7995('0xa')](function(_0x59c153){var _0x2f435e=moment()['format'](_0x7995('0x34'));for(var _0x1b0373=0x0,_0x4d9245=_0x59c153[_0x7995('0x35')];_0x1b0373<_0x4d9245;_0x1b0373+=0x1){_0x59c153[_0x1b0373][_0x7995('0x36')]({'exitAt':_0x2f435e});}});for(var _0x314145=0x0;_0x314145<_0x4b0855[_0x7995('0x20')]['interaction'][_0x46ac4f][_0x7995('0x35')];_0x314145+=0x1){db[_0x7995('0x31')][_0x7995('0x37')]({'where':{'channel':_0x46ac4f,'membername':_0x4b0855['user'][_0x7995('0x12')],'type':_0x7995('0x33'),'uniqueid':_0x4b0855[_0x7995('0x20')][_0x7995('0x2e')][_0x46ac4f][_0x314145],'exitAt':null},'defaults':{'channel':_0x46ac4f,'membername':_0x4b0855[_0x7995('0x2f')]['name'],'interface':_[_0x7995('0x14')](_0x4b0855[_0x7995('0x2f')]['interface'])?util[_0x7995('0x38')]('SIP/%s',_0x4b0855[_0x7995('0x2f')][_0x7995('0x12')]):_0x4b0855[_0x7995('0x2f')][_0x7995('0x39')],'type':_0x7995('0x33'),'enterAt':moment()[_0x7995('0x38')](_0x7995('0x34')),'role':'agent','internal':_0x4b0855[_0x7995('0x2f')][_0x7995('0x3a')],'uniqueid':_0x4b0855[_0x7995('0x20')]['interaction'][_0x46ac4f][_0x314145]}});}}}}return respondWithRpcPromise(_0x7995('0x3b'),{'id':_0x4b0855[_0x7995('0x19')]['id'],'capacity':_0x4b0855[_0x7995('0x20')]['capacity']},routingClient)['then'](respondWithResult(_0x3f8522,null))['catch'](handleError(_0x3f8522,null));};exports[_0x7995('0x3c')]=function(_0x1fd1ca,_0x4cf5db){return respondWithRpcPromise(_0x7995('0x3d'),_0x1fd1ca[_0x7995('0x18')])[_0x7995('0xa')](respondWithResult(_0x4cf5db,null))[_0x7995('0xe')](handleError(_0x4cf5db,null));};exports[_0x7995('0x3e')]=function(_0x528c8e,_0x29ee32){return respondWithRpcPromise('Trunks',_0x528c8e[_0x7995('0x18')])[_0x7995('0xa')](respondWithResult(_0x29ee32,null))[_0x7995('0xe')](handleError(_0x29ee32,null));};exports['campaigns']=function(_0x5e1f34,_0x54e2b1){return respondWithRpcPromise('Campaigns',_0x5e1f34[_0x7995('0x18')])[_0x7995('0xa')](respondWithResult(_0x54e2b1,null))[_0x7995('0xe')](handleError(_0x54e2b1,null));};exports[_0x7995('0x3f')]=function(_0x1d957e,_0x357e60){return respondWithRpcPromise(_0x7995('0x40'),_0x1d957e[_0x7995('0x18')],routingClient)[_0x7995('0xa')](respondWithResult(_0x357e60,null))[_0x7995('0xe')](handleError(_0x357e60,null));};exports[_0x7995('0x41')]=function(_0x133c63,_0x3da72b){return respondWithRpcPromise(_0x7995('0x40'),_0x133c63[_0x7995('0x18')],routingClient)[_0x7995('0xa')](findById(_0x133c63[_0x7995('0x19')]['id']))[_0x7995('0xa')](respondWithResult(_0x3da72b,null))[_0x7995('0xe')](handleError(_0x3da72b,null));};exports['mailQueues']=function(_0x56a374,_0x630737){return respondWithRpcPromise(_0x7995('0x42'),_0x56a374[_0x7995('0x18')],routingClient)['then'](respondWithResult(_0x630737,null))['catch'](handleError(_0x630737,null));};exports[_0x7995('0x43')]=function(_0x197b52,_0x5b9467){return respondWithRpcPromise(_0x7995('0x42'),_0x197b52['query'],routingClient)[_0x7995('0xa')](findById(_0x197b52[_0x7995('0x19')]['id']))[_0x7995('0xa')](respondWithResult(_0x5b9467,null))[_0x7995('0xe')](handleError(_0x5b9467,null));};exports['mailAccounts']=function(_0x5e2d97,_0x40e5fc){return respondWithRpcPromise(_0x7995('0x44'),_0x5e2d97[_0x7995('0x18')],mailClient)[_0x7995('0xa')](respondWithResult(_0x40e5fc,null))[_0x7995('0xe')](handleError(_0x40e5fc,null));};exports[_0x7995('0x45')]=function(_0x1d4689,_0x1e2206){return respondWithRpcPromise(_0x7995('0x46'),_0x1d4689['query'],routingClient)[_0x7995('0xa')](respondWithResult(_0x1e2206,null))[_0x7995('0xe')](handleError(_0x1e2206,null));};exports[_0x7995('0x47')]=function(_0x1ecfdb,_0x59c5aa){return respondWithRpcPromise('OpenchannelQueues',_0x1ecfdb[_0x7995('0x18')],routingClient)[_0x7995('0xa')](findById(_0x1ecfdb['params']['id']))[_0x7995('0xa')](respondWithResult(_0x59c5aa,null))[_0x7995('0xe')](handleError(_0x59c5aa,null));};exports[_0x7995('0x48')]=function(_0x57727e,_0x32cb04){return respondWithRpcPromise('SmsQueues',_0x57727e[_0x7995('0x18')],routingClient)['then'](respondWithResult(_0x32cb04,null))[_0x7995('0xe')](handleError(_0x32cb04,null));};exports[_0x7995('0x49')]=function(_0x1722e2,_0x25b534){return respondWithRpcPromise(_0x7995('0x4a'),_0x1722e2[_0x7995('0x18')],routingClient)[_0x7995('0xa')](findById(_0x1722e2[_0x7995('0x19')]['id']))[_0x7995('0xa')](respondWithResult(_0x25b534,null))[_0x7995('0xe')](handleError(_0x25b534,null));};exports[_0x7995('0x4b')]=function(_0x234d8d,_0x56eb85){return respondWithRpcPromise(_0x7995('0x4c'),_0x234d8d[_0x7995('0x18')],routingClient)[_0x7995('0xa')](respondWithResult(_0x56eb85,null))[_0x7995('0xe')](handleError(_0x56eb85,null));};exports[_0x7995('0x4d')]=function(_0x54a2e0,_0x4b54f2){return respondWithRpcPromise(_0x7995('0x4c'),_0x54a2e0[_0x7995('0x18')],routingClient)[_0x7995('0xa')](findById(_0x54a2e0[_0x7995('0x19')]['id']))['then'](respondWithResult(_0x4b54f2,null))[_0x7995('0xe')](handleError(_0x4b54f2,null));};exports['faxQueues']=function(_0x5df621,_0xca8238){return respondWithRpcPromise(_0x7995('0x4e'),_0x5df621[_0x7995('0x18')],routingClient)[_0x7995('0xa')](respondWithResult(_0xca8238,null))[_0x7995('0xe')](handleError(_0xca8238,null));};exports[_0x7995('0x4f')]=function(_0x32a52f,_0x13dc73){return respondWithRpcPromise(_0x7995('0x4e'),_0x32a52f[_0x7995('0x18')],routingClient)['then'](findById(_0x32a52f[_0x7995('0x19')]['id']))[_0x7995('0xa')](respondWithResult(_0x13dc73,null))[_0x7995('0xe')](handleError(_0x13dc73,null));};exports['faxAccounts']=function(_0x1fe1cb,_0x1d2f9d){return respondWithRpcPromise(_0x7995('0x50'),_0x1fe1cb[_0x7995('0x18')])[_0x7995('0xa')](respondWithResult(_0x1d2f9d,null))[_0x7995('0xe')](handleError(_0x1d2f9d,null));};exports[_0x7995('0x51')]=function(_0x3adfd2,_0x2f94c4){return respondWithRpcPromise(_0x7995('0x52'),_0x3adfd2[_0x7995('0x18')],routingClient)['then'](respondWithResult(_0x2f94c4,null))['catch'](handleError(_0x2f94c4,null));};exports[_0x7995('0x53')]=function(_0xfe1105,_0x39ebb6){return respondWithRpcPromise(_0x7995('0x54'),_0xfe1105['query'],routingClient)[_0x7995('0xa')](respondWithResult(_0x39ebb6,null))[_0x7995('0xe')](handleError(_0x39ebb6,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x480fdb,_0x3253b5){return respondWithRpcPromise(_0x7995('0x55'),_0x480fdb['query'],routingClient)[_0x7995('0xa')](respondWithResult(_0x3253b5,null))['catch'](handleError(_0x3253b5,null));};exports[_0x7995('0x56')]=function(_0xea9aba,_0x4ff9ff){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0xea9aba[_0x7995('0x18')],routingClient)['then'](function(_0x31b9e6){if(_0xea9aba[_0x7995('0x18')][_0x7995('0x57')]!==undefined){var _0x45bd8a=_(_0x31b9e6[_0x7995('0x15')])[_0x7995('0x58')]([_0xea9aba[_0x7995('0x18')][_0x7995('0x57')],_0xea9aba[_0x7995('0x19')]['id']])[_0x7995('0x59')](_0x7995('0x5a'))[_0x7995('0x5b')]()[_0x7995('0x5c')]();return _0x31b9e6[_0x7995('0x15')][_0x7995('0x58')](function(_0x3773de){return _0x45bd8a[_0x7995('0x5d')](_0x3773de[_0x7995('0x5a')])>-0x1;});}else{return _0x31b9e6[_0x7995('0x15')][_0x7995('0x58')](function(_0x306fa9){return _0x306fa9[_0x7995('0x5a')]===parseInt(_0xea9aba[_0x7995('0x19')]['id']);});}})[_0x7995('0xa')](respondWithResult(_0x4ff9ff,null))[_0x7995('0xe')](handleError(_0x4ff9ff,null));};exports[_0x7995('0x5e')]=function(_0x2f7f51,_0x34724d){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2f7f51[_0x7995('0x18')],routingClient)[_0x7995('0xa')](respondWithResult(_0x34724d,null))['catch'](handleError(_0x34724d,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x15e8d1,_0x3fe8fc){return respondWithRpcPromise(_0x7995('0x5f'),_0x15e8d1[_0x7995('0x18')],routingClient)[_0x7995('0xa')](respondWithResult(_0x3fe8fc,null))[_0x7995('0xe')](handleError(_0x3fe8fc,null));};exports['faxQueuesWaitingInteractions']=function(_0x2f8a2d,_0xb68962){return respondWithRpcPromise(_0x7995('0x60'),_0x2f8a2d[_0x7995('0x18')],routingClient)[_0x7995('0xa')](respondWithResult(_0xb68962,null))[_0x7995('0xe')](handleError(_0xb68962,null));};exports[_0x7995('0x61')]=function(_0xc93dcb){return function(_0x560095,_0x1c8e7d){var _0x2b8217,_0x5c04c9;var _0x479271=_[_0x7995('0x62')](_0xc93dcb);var _0xf8c2ed=_0xc93dcb===_0x7995('0x63')?_0x7995('0x64'):_0x7995('0x65');return db[_0x479271+'Queue'][_0x7995('0x66')]({'raw':!![],'where':{'id':_0x560095[_0x7995('0x19')]['id']}})['then'](function(_0x209977){if(_[_0x7995('0x14')](_0x209977)){throw new Error(_0x479271+'\x20Queue\x20not\x20found');}_0x2b8217=_0x209977;return db[_0x479271+_0x7995('0x67')]['findOne']({'where':{'id':_0x560095[_0x7995('0x20')][_0x7995('0x68')]},'include':[{'model':db[_0x479271+_0x7995('0x69')],'as':_0x7995('0x69')},{'model':db[_0x479271+_0xf8c2ed],'as':_0x7995('0x65')}]});})['then'](function(_0x1f0506){if(_[_0x7995('0x14')](_0x1f0506)){throw new Error(_0x479271+_0x7995('0x6a'));}_0x5c04c9=_0x1f0506;return _0x1f0506['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x7995('0xa')](function(){var _0x3f3434={'uniqueid':_0xc93dcb+'.'+_0x5c04c9['id']+'.'+_0x5c04c9[_0x7995('0x69')]['id'],'FromUserId':_0x560095[_0x7995('0x2f')]['id'],'type':'queue'};_0x3f3434[_0x479271+_0x7995('0x6b')]=_0x5c04c9['id'];_0x3f3434[_0x479271+_0x7995('0x6c')]=_0x5c04c9[_0x7995('0x69')]['id'];_0x3f3434['From'+_0x479271+_0xf8c2ed+'Id']=_0x5c04c9['Account']['id'];_0x3f3434['To'+_0x479271+_0x7995('0x6d')]=_0x2b8217['id'];return db[_0x479271+_0x7995('0x6e')]['create'](_0x3f3434);})['then'](function(){return respondWithRpcPromise(_0x7995('0x6f'),{'channel':_0xc93dcb,'interaction':_0x5c04c9[_0x7995('0x69')],'message':_0x5c04c9,'account':_0x5c04c9[_0x7995('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0x7995('0x70'),'appdata':_0x2b8217[_0x7995('0x12')]+','+(_0x5c04c9['Account']['queueTransferTimeout']||0x12c),'interval':_0x7995('0x71')}]},routingClient);})['then'](respondWithResult(_0x1c8e7d,null))['catch'](handleError(_0x1c8e7d,null));};};exports[_0x7995('0x72')]=function(_0x3b731e,_0x3192b8){var _0x5eb360,_0x3b1309;if(_[_0x7995('0x14')](_0x3b731e[_0x7995('0x20')][_0x7995('0x73')])){throw new Error(_0x7995('0x74'));}var _0x5799d1=_0x3b731e[_0x7995('0x20')][_0x7995('0x73')];var _0x1a2d6a=_[_0x7995('0x62')](_0x5799d1);var _0x50bf9a=_0x5799d1===_0x7995('0x63')?_0x7995('0x64'):'Account';return db[_0x7995('0x75')][_0x7995('0x66')]({'raw':!![],'where':{'id':_0x3b731e['params']['id'],'role':_0x7995('0x76')}})['then'](function(_0x1b4b34){if(_['isNil'](_0x1b4b34)){throw new Error(_0x7995('0x77'));}_0x5eb360=_0x1b4b34;return db[_0x1a2d6a+'Message'][_0x7995('0x66')]({'where':{'id':_0x3b731e[_0x7995('0x20')]['messageId']},'include':[{'model':db[_0x1a2d6a+_0x7995('0x69')],'as':'Interaction'},{'model':db[_0x1a2d6a+_0x50bf9a],'as':'Account'}]});})[_0x7995('0xa')](function(_0x14812d){if(_[_0x7995('0x14')](_0x14812d)){throw new Error(_0x1a2d6a+_0x7995('0x6a'));}_0x3b1309=_0x14812d;return _0x14812d['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x7995('0xa')](function(){var _0x35044a={'uniqueid':_0x5799d1+'.'+_0x3b1309['id']+'.'+_0x3b1309['Interaction']['id'],'FromUserId':_0x3b731e['user']['id'],'type':_0x7995('0x70'),'ToUserId':_0x5eb360['id']};_0x35044a[_0x1a2d6a+'MessageId']=_0x3b1309['id'];_0x35044a[_0x1a2d6a+_0x7995('0x6c')]=_0x3b1309[_0x7995('0x69')]['id'];_0x35044a[_0x7995('0x78')+_0x1a2d6a+_0x50bf9a+'Id']=_0x3b1309['Account']['id'];return db[_0x1a2d6a+'TransferReport'][_0x7995('0x79')](_0x35044a);})['then'](function(){return respondWithRpcPromise(_0x7995('0x6f'),{'channel':_0x5799d1,'interaction':_0x3b1309[_0x7995('0x69')],'message':_0x3b1309,'account':_0x3b1309[_0x7995('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0x7995('0x76'),'appdata':_0x5eb360['name']+','+(_0x3b1309['Account']['agentTransferTimeout']||0x12c),'interval':_0x7995('0x71')}]},routingClient);})[_0x7995('0xa')](respondWithResult(_0x3192b8,null))[_0x7995('0xe')](handleError(_0x3192b8,null));}; \ No newline at end of file +var _0x2bd8=['SmsQueues','showSmsQueues','showWhatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','map','queue_id','uniq','filter','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','chat','Website','Queue','findOne','\x20Queue\x20not\x20found','Message','Interaction','Account','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','User','Agent\x20not\x20found','\x20Message\x20not\x20found','update','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','error','message','result','status','json','sendStatus','name','send','isNil','rows','find','voiceChannels','then','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','Outbound','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','MemberReport','findAll','INTERACTION','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','findOrCreate','interface','SIP/%s','format','agent','internal','telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','OpenchannelQueues','smsQueues'];(function(_0x5b440a,_0x42aabf){var _0xf09b78=function(_0x28554f){while(--_0x28554f){_0x5b440a['push'](_0x5b440a['shift']());}};_0xf09b78(++_0x42aabf);}(_0x2bd8,0x130));var _0x82bd=function(_0x5a02ad,_0x1fd139){_0x5a02ad=_0x5a02ad-0x0;var _0x3636ec=_0x2bd8[_0x5a02ad];return _0x3636ec;};'use strict';var BPromise=require(_0x82bd('0x0'));var moment=require('moment');var _=require(_0x82bd('0x1'));var util=require(_0x82bd('0x2'));var db=require(_0x82bd('0x3'))['db'];var logger=require(_0x82bd('0x4'))(_0x82bd('0x5'));var jayson=require(_0x82bd('0x6'));var amiClient=jayson[_0x82bd('0x7')]['http']({'port':0x232a});var mailClient=jayson[_0x82bd('0x7')][_0x82bd('0x8')]({'port':0x232b});var routingClient=jayson[_0x82bd('0x7')]['http']({'port':0x232c});function respondWithRpcPromise(_0x19dbb1,_0x77d7a9,_0x226f60){return new BPromise(function(_0x1f7463,_0x4dc3a6){var _0x1666cf=_0x226f60?_0x226f60:amiClient;return _0x1666cf['request'](_0x19dbb1,_0x77d7a9)['then'](function(_0x51c6ea){if(_0x51c6ea[_0x82bd('0x9')]){if(_0x51c6ea['error']['code']===0x1f4){return _0x4dc3a6(_0x51c6ea[_0x82bd('0x9')]['message']);}return _0x1f7463(_0x51c6ea['error'][_0x82bd('0xa')]);}else{_0x1f7463(_0x51c6ea[_0x82bd('0xb')]);}})['catch'](function(_0x140ad6){_0x4dc3a6(_0x140ad6);});});}function respondWithResult(_0x5f1ab9,_0xfaccf7){_0xfaccf7=_0xfaccf7||0xc8;return function(_0x51e17e){if(_0x51e17e){return _0x5f1ab9[_0x82bd('0xc')](_0xfaccf7)[_0x82bd('0xd')](_0x51e17e);}return _0x5f1ab9[_0x82bd('0xe')](0x194);};}function handleError(_0x2ca530,_0x58d82b){_0x58d82b=_0x58d82b||0x1f4;return function(_0x446ffc){logger[_0x82bd('0x9')](_0x446ffc['stack']);if(_0x446ffc[_0x82bd('0xf')]){delete _0x446ffc['name'];}_0x2ca530[_0x82bd('0xc')](_0x58d82b)[_0x82bd('0x10')](_0x446ffc);};}function findById(_0x2c5155){return function(_0x300982){if(!_[_0x82bd('0x11')](_0x2c5155)&&!_[_0x82bd('0x11')](_0x300982)&&!_[_0x82bd('0x11')](_0x300982[_0x82bd('0x12')])){return _[_0x82bd('0x13')](_0x300982[_0x82bd('0x12')],function(_0x390107){return _0x390107['id']==_0x2c5155;});}return null;};}exports[_0x82bd('0x14')]=function(_0x1c3779,_0x253741){return respondWithRpcPromise('VoiceChannels',_0x1c3779['query'])[_0x82bd('0x15')](respondWithResult(_0x253741,null))[_0x82bd('0x16')](handleError(_0x253741,null));};exports[_0x82bd('0x17')]=function(_0xc9fcdf,_0x34899b){return respondWithRpcPromise(_0x82bd('0x18'),_[_0x82bd('0x19')](_0xc9fcdf[_0x82bd('0x1a')],_0xc9fcdf[_0x82bd('0x1b')]))[_0x82bd('0x15')](respondWithResult(_0x34899b,null))[_0x82bd('0x16')](handleError(_0x34899b,null));};exports[_0x82bd('0x1c')]=function(_0x1ca91f,_0x3260c4){return respondWithRpcPromise(_0x82bd('0x1d'),_[_0x82bd('0x19')](_0x1ca91f[_0x82bd('0x1a')],_0x1ca91f[_0x82bd('0x1b')]))[_0x82bd('0x15')](respondWithResult(_0x3260c4,null))['catch'](handleError(_0x3260c4,null));};exports['voiceQueues']=function(_0x4248be,_0x436ecd){return respondWithRpcPromise(_0x82bd('0x1e'),_0x4248be[_0x82bd('0x1a')])[_0x82bd('0x15')](respondWithResult(_0x436ecd,null))[_0x82bd('0x16')](handleError(_0x436ecd,null));};exports[_0x82bd('0x1f')]=function(_0xbef23b,_0x2f0bb6){return respondWithRpcPromise(_0x82bd('0x1e'),_0xbef23b['query'])['then'](findById(_0xbef23b['params']['id']))['then'](respondWithResult(_0x2f0bb6,null))[_0x82bd('0x16')](handleError(_0x2f0bb6,null));};exports[_0x82bd('0x20')]=function(_0x351d3d,_0x190bca){return respondWithRpcPromise(_0x82bd('0x21'),_['merge'](_0x351d3d['body'],_0x351d3d['params']))[_0x82bd('0x15')](respondWithResult(_0x190bca,null))[_0x82bd('0x16')](handleError(_0x190bca,null));};exports[_0x82bd('0x22')]=function(_0x580ba8,_0x166c46){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x82bd('0x19')](_0x580ba8[_0x82bd('0x1a')],_0x580ba8[_0x82bd('0x1b')]))[_0x82bd('0x15')](respondWithResult(_0x166c46,null))[_0x82bd('0x16')](handleError(_0x166c46,null));};exports[_0x82bd('0x23')]=function(_0x5ca7fc,_0x591b38){return respondWithRpcPromise(_0x82bd('0x24'),_0x5ca7fc[_0x82bd('0x1a')])['then'](respondWithResult(_0x591b38,null))[_0x82bd('0x16')](handleError(_0x591b38,null));};exports['voiceQueuesChannel']=function(_0x578e6e,_0x3b8015){return respondWithRpcPromise(_0x82bd('0x25'),_[_0x82bd('0x19')](_0x578e6e[_0x82bd('0x1a')],_0x578e6e[_0x82bd('0x1b')]))[_0x82bd('0x15')](respondWithResult(_0x3b8015,null))[_0x82bd('0x16')](handleError(_0x3b8015,null));};exports[_0x82bd('0x26')]=function(_0x42dc7f,_0xefc6e4){return respondWithRpcPromise(_0x82bd('0x27'),_[_0x82bd('0x19')](_0x42dc7f[_0x82bd('0x1a')],_0x42dc7f[_0x82bd('0x1b')]))[_0x82bd('0x15')](respondWithResult(_0xefc6e4,null))[_0x82bd('0x16')](handleError(_0xefc6e4,null));};exports[_0x82bd('0x28')]=function(_0x4bdcae,_0x59b7ca){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x82bd('0x19')](_0x4bdcae[_0x82bd('0x1a')],_0x4bdcae['params']))[_0x82bd('0x15')](respondWithResult(_0x59b7ca,null))['catch'](handleError(_0x59b7ca,null));};exports['outbound']=function(_0x4c5f8d,_0x2b7675){return respondWithRpcPromise(_0x82bd('0x29'),_0x4c5f8d[_0x82bd('0x1a')])[_0x82bd('0x15')](respondWithResult(_0x2b7675,null))[_0x82bd('0x16')](handleError(_0x2b7675,null));};exports['outboundChannels']=function(_0x54e33f,_0x575c14){return respondWithRpcPromise(_0x82bd('0x2a'),_0x54e33f['query'])['then'](respondWithResult(_0x575c14,null))[_0x82bd('0x16')](handleError(_0x575c14,null));};exports[_0x82bd('0x2b')]=function(_0x3192e2,_0x2c5e7d){var _0x3ff054;return respondWithRpcPromise(_0x82bd('0x2c'),_0x3192e2[_0x82bd('0x1a')])[_0x82bd('0x15')](function(_0x18752a){_0x3ff054=_0x18752a;return respondWithRpcPromise('Agents',_0x3192e2['query'],routingClient);})[_0x82bd('0x15')](function(_0x689b3c){return _['merge']({},_0x689b3c,_0x3ff054);})['then'](respondWithResult(_0x2c5e7d,null))[_0x82bd('0x16')](handleError(_0x2c5e7d,null));};exports[_0x82bd('0x2d')]=function(_0x4d310b,_0x121f1f){if(_0x4d310b[_0x82bd('0x2e')]&&_0x4d310b[_0x82bd('0x2e')][_0x82bd('0x2f')]&&_0x4d310b[_0x82bd('0x30')]&&_0x4d310b[_0x82bd('0x30')][_0x82bd('0xf')]){for(var _0x2c429d in _0x4d310b[_0x82bd('0x2e')][_0x82bd('0x2f')]){if(_0x4d310b[_0x82bd('0x2e')][_0x82bd('0x2f')]['hasOwnProperty'](_0x2c429d)){db[_0x82bd('0x31')][_0x82bd('0x32')]({'where':{'channel':_0x2c429d,'membername':_0x4d310b['user']['name'],'type':_0x82bd('0x33'),'exitAt':null,'uniqueid':_0x4d310b[_0x82bd('0x2e')][_0x82bd('0x2f')][_0x2c429d]&&_0x4d310b[_0x82bd('0x2e')][_0x82bd('0x2f')][_0x2c429d]['length']?{'$notIn':_0x4d310b['body'][_0x82bd('0x2f')][_0x2c429d]}:{'$ne':null}}})[_0x82bd('0x15')](function(_0x4b2fb8){var _0x158957=moment()['format'](_0x82bd('0x34'));for(var _0x6d65c6=0x0,_0x587aec=_0x4b2fb8[_0x82bd('0x35')];_0x6d65c6<_0x587aec;_0x6d65c6+=0x1){_0x4b2fb8[_0x6d65c6][_0x82bd('0x36')]({'exitAt':_0x158957});}});for(var _0x54d12e=0x0;_0x54d12e<_0x4d310b['body'][_0x82bd('0x2f')][_0x2c429d]['length'];_0x54d12e+=0x1){db[_0x82bd('0x31')][_0x82bd('0x37')]({'where':{'channel':_0x2c429d,'membername':_0x4d310b[_0x82bd('0x30')][_0x82bd('0xf')],'type':'INTERACTION','uniqueid':_0x4d310b['body'][_0x82bd('0x2f')][_0x2c429d][_0x54d12e],'exitAt':null},'defaults':{'channel':_0x2c429d,'membername':_0x4d310b[_0x82bd('0x30')]['name'],'interface':_[_0x82bd('0x11')](_0x4d310b[_0x82bd('0x30')][_0x82bd('0x38')])?util['format'](_0x82bd('0x39'),_0x4d310b[_0x82bd('0x30')][_0x82bd('0xf')]):_0x4d310b[_0x82bd('0x30')][_0x82bd('0x38')],'type':_0x82bd('0x33'),'enterAt':moment()[_0x82bd('0x3a')](_0x82bd('0x34')),'role':_0x82bd('0x3b'),'internal':_0x4d310b[_0x82bd('0x30')][_0x82bd('0x3c')],'uniqueid':_0x4d310b[_0x82bd('0x2e')][_0x82bd('0x2f')][_0x2c429d][_0x54d12e]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x4d310b[_0x82bd('0x1b')]['id'],'capacity':_0x4d310b[_0x82bd('0x2e')]['capacity']},routingClient)[_0x82bd('0x15')](respondWithResult(_0x121f1f,null))[_0x82bd('0x16')](handleError(_0x121f1f,null));};exports[_0x82bd('0x3d')]=function(_0x4237ef,_0x55a2e6){return respondWithRpcPromise('Telephones',_0x4237ef[_0x82bd('0x1a')])['then'](respondWithResult(_0x55a2e6,null))['catch'](handleError(_0x55a2e6,null));};exports[_0x82bd('0x3e')]=function(_0x4c35dd,_0x523cbe){return respondWithRpcPromise(_0x82bd('0x3f'),_0x4c35dd[_0x82bd('0x1a')])[_0x82bd('0x15')](respondWithResult(_0x523cbe,null))[_0x82bd('0x16')](handleError(_0x523cbe,null));};exports[_0x82bd('0x40')]=function(_0x1a7402,_0x417c29){return respondWithRpcPromise(_0x82bd('0x41'),_0x1a7402[_0x82bd('0x1a')])[_0x82bd('0x15')](respondWithResult(_0x417c29,null))[_0x82bd('0x16')](handleError(_0x417c29,null));};exports[_0x82bd('0x42')]=function(_0x153fad,_0x1a1cdc){return respondWithRpcPromise(_0x82bd('0x43'),_0x153fad['query'],routingClient)[_0x82bd('0x15')](respondWithResult(_0x1a1cdc,null))[_0x82bd('0x16')](handleError(_0x1a1cdc,null));};exports[_0x82bd('0x44')]=function(_0x354581,_0x9bf8fa){return respondWithRpcPromise('ChatQueues',_0x354581['query'],routingClient)['then'](findById(_0x354581['params']['id']))[_0x82bd('0x15')](respondWithResult(_0x9bf8fa,null))[_0x82bd('0x16')](handleError(_0x9bf8fa,null));};exports[_0x82bd('0x45')]=function(_0x127f8f,_0x568fc3){return respondWithRpcPromise('MailQueues',_0x127f8f[_0x82bd('0x1a')],routingClient)[_0x82bd('0x15')](respondWithResult(_0x568fc3,null))[_0x82bd('0x16')](handleError(_0x568fc3,null));};exports['showMailQueues']=function(_0x2657bc,_0x2252ef){return respondWithRpcPromise(_0x82bd('0x46'),_0x2657bc[_0x82bd('0x1a')],routingClient)[_0x82bd('0x15')](findById(_0x2657bc[_0x82bd('0x1b')]['id']))[_0x82bd('0x15')](respondWithResult(_0x2252ef,null))[_0x82bd('0x16')](handleError(_0x2252ef,null));};exports[_0x82bd('0x47')]=function(_0x20b636,_0x3ae44e){return respondWithRpcPromise(_0x82bd('0x48'),_0x20b636[_0x82bd('0x1a')],mailClient)[_0x82bd('0x15')](respondWithResult(_0x3ae44e,null))[_0x82bd('0x16')](handleError(_0x3ae44e,null));};exports[_0x82bd('0x49')]=function(_0x124ca4,_0x1fa71d){return respondWithRpcPromise('OpenchannelQueues',_0x124ca4[_0x82bd('0x1a')],routingClient)['then'](respondWithResult(_0x1fa71d,null))['catch'](handleError(_0x1fa71d,null));};exports[_0x82bd('0x4a')]=function(_0x4d2305,_0x306247){return respondWithRpcPromise(_0x82bd('0x4b'),_0x4d2305[_0x82bd('0x1a')],routingClient)[_0x82bd('0x15')](findById(_0x4d2305[_0x82bd('0x1b')]['id']))[_0x82bd('0x15')](respondWithResult(_0x306247,null))[_0x82bd('0x16')](handleError(_0x306247,null));};exports[_0x82bd('0x4c')]=function(_0x40d6cf,_0x37ede1){return respondWithRpcPromise(_0x82bd('0x4d'),_0x40d6cf['query'],routingClient)['then'](respondWithResult(_0x37ede1,null))[_0x82bd('0x16')](handleError(_0x37ede1,null));};exports[_0x82bd('0x4e')]=function(_0x513e1d,_0x47d136){return respondWithRpcPromise(_0x82bd('0x4d'),_0x513e1d[_0x82bd('0x1a')],routingClient)[_0x82bd('0x15')](findById(_0x513e1d[_0x82bd('0x1b')]['id']))['then'](respondWithResult(_0x47d136,null))[_0x82bd('0x16')](handleError(_0x47d136,null));};exports['whatsappQueues']=function(_0x1a16c1,_0x6ff77c){return respondWithRpcPromise('WhatsappQueues',_0x1a16c1[_0x82bd('0x1a')],routingClient)[_0x82bd('0x15')](respondWithResult(_0x6ff77c,null))[_0x82bd('0x16')](handleError(_0x6ff77c,null));};exports[_0x82bd('0x4f')]=function(_0x5a5d66,_0x1b5b39){return respondWithRpcPromise(_0x82bd('0x50'),_0x5a5d66[_0x82bd('0x1a')],routingClient)[_0x82bd('0x15')](findById(_0x5a5d66[_0x82bd('0x1b')]['id']))[_0x82bd('0x15')](respondWithResult(_0x1b5b39,null))[_0x82bd('0x16')](handleError(_0x1b5b39,null));};exports[_0x82bd('0x51')]=function(_0x1384b0,_0x544f10){return respondWithRpcPromise(_0x82bd('0x52'),_0x1384b0['query'],routingClient)['then'](respondWithResult(_0x544f10,null))[_0x82bd('0x16')](handleError(_0x544f10,null));};exports[_0x82bd('0x53')]=function(_0x529cb2,_0x2d2a7e){return respondWithRpcPromise('FaxQueues',_0x529cb2[_0x82bd('0x1a')],routingClient)[_0x82bd('0x15')](findById(_0x529cb2['params']['id']))[_0x82bd('0x15')](respondWithResult(_0x2d2a7e,null))[_0x82bd('0x16')](handleError(_0x2d2a7e,null));};exports['faxAccounts']=function(_0x505032,_0x5bd3ae){return respondWithRpcPromise(_0x82bd('0x54'),_0x505032[_0x82bd('0x1a')])['then'](respondWithResult(_0x5bd3ae,null))[_0x82bd('0x16')](handleError(_0x5bd3ae,null));};exports[_0x82bd('0x55')]=function(_0x52b73f,_0x5591af){return respondWithRpcPromise(_0x82bd('0x56'),_0x52b73f['query'],routingClient)['then'](respondWithResult(_0x5591af,null))[_0x82bd('0x16')](handleError(_0x5591af,null));};exports[_0x82bd('0x57')]=function(_0x988094,_0x3d1f0d){return respondWithRpcPromise(_0x82bd('0x58'),_0x988094['query'],routingClient)[_0x82bd('0x15')](respondWithResult(_0x3d1f0d,null))['catch'](handleError(_0x3d1f0d,null));};exports[_0x82bd('0x59')]=function(_0x5e25c3,_0x2fbf08){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x5e25c3['query'],routingClient)[_0x82bd('0x15')](respondWithResult(_0x2fbf08,null))[_0x82bd('0x16')](handleError(_0x2fbf08,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x282263,_0x15a849){return respondWithRpcPromise(_0x82bd('0x5a'),_0x282263['query'],routingClient)['then'](function(_0x197368){if(_0x282263[_0x82bd('0x1a')]['type']!==undefined){var _0x222f9d=_(_0x197368[_0x82bd('0x12')])['filter']([_0x282263[_0x82bd('0x1a')][_0x82bd('0x5b')],_0x282263[_0x82bd('0x1b')]['id']])[_0x82bd('0x5c')](_0x82bd('0x5d'))[_0x82bd('0x5e')]()['value']();return _0x197368[_0x82bd('0x12')][_0x82bd('0x5f')](function(_0x12bc87){return _0x222f9d['indexOf'](_0x12bc87[_0x82bd('0x5d')])>-0x1;});}else{return _0x197368['rows'][_0x82bd('0x5f')](function(_0x2d9bc0){return _0x2d9bc0[_0x82bd('0x5d')]===parseInt(_0x282263[_0x82bd('0x1b')]['id']);});}})[_0x82bd('0x15')](respondWithResult(_0x15a849,null))['catch'](handleError(_0x15a849,null));};exports[_0x82bd('0x60')]=function(_0x39b9d5,_0x54e547){return respondWithRpcPromise(_0x82bd('0x61'),_0x39b9d5[_0x82bd('0x1a')],routingClient)['then'](respondWithResult(_0x54e547,null))[_0x82bd('0x16')](handleError(_0x54e547,null));};exports[_0x82bd('0x62')]=function(_0x42d4c9,_0x55fe38){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x42d4c9[_0x82bd('0x1a')],routingClient)[_0x82bd('0x15')](respondWithResult(_0x55fe38,null))[_0x82bd('0x16')](handleError(_0x55fe38,null));};exports['faxQueuesWaitingInteractions']=function(_0x465979,_0x4721c3){return respondWithRpcPromise(_0x82bd('0x63'),_0x465979['query'],routingClient)['then'](respondWithResult(_0x4721c3,null))['catch'](handleError(_0x4721c3,null));};exports['queueNotify']=function(_0x437463){return function(_0x45bbf7,_0x4b5bf4){var _0x35d111,_0x546106;var _0x1da93f=_['capitalize'](_0x437463);var _0x43d8a2=_0x437463===_0x82bd('0x64')?_0x82bd('0x65'):'Account';return db[_0x1da93f+_0x82bd('0x66')][_0x82bd('0x67')]({'raw':!![],'where':{'id':_0x45bbf7[_0x82bd('0x1b')]['id']}})[_0x82bd('0x15')](function(_0xbe937d){if(_['isNil'](_0xbe937d)){throw new Error(_0x1da93f+_0x82bd('0x68'));}_0x35d111=_0xbe937d;return db[_0x1da93f+_0x82bd('0x69')][_0x82bd('0x67')]({'where':{'id':_0x45bbf7['body']['messageId']},'include':[{'model':db[_0x1da93f+'Interaction'],'as':_0x82bd('0x6a')},{'model':db[_0x1da93f+_0x43d8a2],'as':_0x82bd('0x6b')}]});})[_0x82bd('0x15')](function(_0x1a7f98){if(_[_0x82bd('0x11')](_0x1a7f98)){throw new Error(_0x1da93f+'\x20Message\x20not\x20found');}_0x546106=_0x1a7f98;return _0x1a7f98['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x5a8e7f={'uniqueid':_0x437463+'.'+_0x546106['id']+'.'+_0x546106[_0x82bd('0x6a')]['id'],'FromUserId':_0x45bbf7[_0x82bd('0x30')]['id'],'type':_0x82bd('0x6c')};_0x5a8e7f[_0x1da93f+_0x82bd('0x6d')]=_0x546106['id'];_0x5a8e7f[_0x1da93f+_0x82bd('0x6e')]=_0x546106[_0x82bd('0x6a')]['id'];_0x5a8e7f[_0x82bd('0x6f')+_0x1da93f+_0x43d8a2+'Id']=_0x546106['Account']['id'];_0x5a8e7f['To'+_0x1da93f+_0x82bd('0x70')]=_0x35d111['id'];return db[_0x1da93f+_0x82bd('0x71')][_0x82bd('0x72')](_0x5a8e7f);})[_0x82bd('0x15')](function(){return respondWithRpcPromise(_0x82bd('0x73'),{'channel':_0x437463,'interaction':_0x546106[_0x82bd('0x6a')],'message':_0x546106,'account':_0x546106[_0x82bd('0x6b')],'applications':[{'id':0x0,'priority':0x1,'app':_0x82bd('0x6c'),'appdata':_0x35d111[_0x82bd('0xf')]+','+(_0x546106[_0x82bd('0x6b')][_0x82bd('0x74')]||0x12c),'interval':_0x82bd('0x75')}]},routingClient);})[_0x82bd('0x15')](respondWithResult(_0x4b5bf4,null))['catch'](handleError(_0x4b5bf4,null));};};exports[_0x82bd('0x76')]=function(_0x3d14c7,_0x57c71c){var _0x588d7f,_0x5ca4b5;if(_['isNil'](_0x3d14c7[_0x82bd('0x2e')][_0x82bd('0x77')])){throw new Error(_0x82bd('0x78'));}var _0x2eda47=_0x3d14c7[_0x82bd('0x2e')][_0x82bd('0x77')];var _0x17f2aa=_[_0x82bd('0x79')](_0x2eda47);var _0x534fee=_0x2eda47===_0x82bd('0x64')?'Website':_0x82bd('0x6b');return db[_0x82bd('0x7a')][_0x82bd('0x67')]({'raw':!![],'where':{'id':_0x3d14c7[_0x82bd('0x1b')]['id'],'role':'agent'}})[_0x82bd('0x15')](function(_0x2c92d8){if(_[_0x82bd('0x11')](_0x2c92d8)){throw new Error(_0x82bd('0x7b'));}_0x588d7f=_0x2c92d8;return db[_0x17f2aa+'Message'][_0x82bd('0x67')]({'where':{'id':_0x3d14c7[_0x82bd('0x2e')]['messageId']},'include':[{'model':db[_0x17f2aa+'Interaction'],'as':'Interaction'},{'model':db[_0x17f2aa+_0x534fee],'as':_0x82bd('0x6b')}]});})[_0x82bd('0x15')](function(_0x291587){if(_[_0x82bd('0x11')](_0x291587)){throw new Error(_0x17f2aa+_0x82bd('0x7c'));}_0x5ca4b5=_0x291587;return _0x291587[_0x82bd('0x7d')]({'read':0x0,'readAt':null,'UserId':null});})[_0x82bd('0x15')](function(){var _0x8f45e2={'uniqueid':_0x2eda47+'.'+_0x5ca4b5['id']+'.'+_0x5ca4b5[_0x82bd('0x6a')]['id'],'FromUserId':_0x3d14c7[_0x82bd('0x30')]['id'],'type':_0x82bd('0x6c'),'ToUserId':_0x588d7f['id']};_0x8f45e2[_0x17f2aa+_0x82bd('0x6d')]=_0x5ca4b5['id'];_0x8f45e2[_0x17f2aa+_0x82bd('0x6e')]=_0x5ca4b5[_0x82bd('0x6a')]['id'];_0x8f45e2[_0x82bd('0x6f')+_0x17f2aa+_0x534fee+'Id']=_0x5ca4b5[_0x82bd('0x6b')]['id'];return db[_0x17f2aa+_0x82bd('0x71')][_0x82bd('0x72')](_0x8f45e2);})[_0x82bd('0x15')](function(){return respondWithRpcPromise(_0x82bd('0x73'),{'channel':_0x2eda47,'interaction':_0x5ca4b5[_0x82bd('0x6a')],'message':_0x5ca4b5,'account':_0x5ca4b5['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x588d7f[_0x82bd('0xf')]+','+(_0x5ca4b5[_0x82bd('0x6b')][_0x82bd('0x7e')]||0x12c),'interval':_0x82bd('0x75')}]},routingClient);})['then'](respondWithResult(_0x57c71c,null))['catch'](handleError(_0x57c71c,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index c98feb5..5d4ecde 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 _0x7607=['../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','index','/:id','show','get','/:id/run','run','post','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x403115,_0x2d6d03){var _0x596ef3=function(_0x145d97){while(--_0x145d97){_0x403115['push'](_0x403115['shift']());}};_0x596ef3(++_0x2d6d03);}(_0x7607,0x7e));var _0x7760=function(_0x5642c2,_0x178606){_0x5642c2=_0x5642c2-0x0;var _0x3e6e7f=_0x7607[_0x5642c2];return _0x3e6e7f;};'use strict';var multer=require(_0x7760('0x0'));var util=require(_0x7760('0x1'));var path=require('path');var timeout=require(_0x7760('0x2'));var express=require(_0x7760('0x3'));var router=express[_0x7760('0x4')]();var fs_extra=require(_0x7760('0x5'));var auth=require(_0x7760('0x6'));var interaction=require(_0x7760('0x7'));var config=require(_0x7760('0x8'));var controller=require(_0x7760('0x9'));router['get']('/',auth[_0x7760('0xa')](),controller[_0x7760('0xb')]);router['get'](_0x7760('0xc'),auth[_0x7760('0xa')](),controller[_0x7760('0xd')]);router[_0x7760('0xe')](_0x7760('0xf'),auth[_0x7760('0xa')](),controller[_0x7760('0x10')]);router[_0x7760('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7760('0x12')](_0x7760('0xc'),auth[_0x7760('0xa')](),controller[_0x7760('0x13')]);router['delete']('/:id',auth[_0x7760('0xa')](),controller[_0x7760('0x14')]);module[_0x7760('0x15')]=router; \ No newline at end of file +var _0x3a27=['update','delete','/:id','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./schedule.controller','index','get','isAuthenticated','/:id/run','run','post','put'];(function(_0x16629d,_0x492375){var _0x56ccee=function(_0xa982b7){while(--_0xa982b7){_0x16629d['push'](_0x16629d['shift']());}};_0x56ccee(++_0x492375);}(_0x3a27,0x16b));var _0x73a2=function(_0x1e93ae,_0x2cd0a1){_0x1e93ae=_0x1e93ae-0x0;var _0xf65cb=_0x3a27[_0x1e93ae];return _0xf65cb;};'use strict';var multer=require(_0x73a2('0x0'));var util=require(_0x73a2('0x1'));var path=require(_0x73a2('0x2'));var timeout=require('connect-timeout');var express=require(_0x73a2('0x3'));var router=express['Router']();var fs_extra=require(_0x73a2('0x4'));var auth=require(_0x73a2('0x5'));var interaction=require(_0x73a2('0x6'));var config=require('../../config/environment');var controller=require(_0x73a2('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x73a2('0x8')]);router[_0x73a2('0x9')]('/:id',auth[_0x73a2('0xa')](),controller['show']);router[_0x73a2('0x9')](_0x73a2('0xb'),auth[_0x73a2('0xa')](),controller[_0x73a2('0xc')]);router[_0x73a2('0xd')]('/',auth[_0x73a2('0xa')](),controller['create']);router[_0x73a2('0xe')]('/:id',auth[_0x73a2('0xa')](),controller[_0x73a2('0xf')]);router[_0x73a2('0x10')](_0x73a2('0x11'),auth[_0x73a2('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 9edaf6b..4f6bc8f 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 _0xc454=['csv','custom','BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','years','quarters','weeks','days','hours','minutes','ENUM','pdf'];(function(_0x5b0a7c,_0xa37489){var _0x1cd0c0=function(_0x1a4d75){while(--_0x1a4d75){_0x5b0a7c['push'](_0x5b0a7c['shift']());}};_0x1cd0c0(++_0xa37489);}(_0xc454,0xbf));var _0x4c45=function(_0x539b64,_0x3d4e40){_0x539b64=_0x539b64-0x0;var _0x7ef6fd=_0xc454[_0x539b64];return _0x7ef6fd;};'use strict';var Sequelize=require(_0x4c45('0x0'));module[_0x4c45('0x1')]={'name':{'type':Sequelize[_0x4c45('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x4c45('0x2')],'allowNull':![],'defaultValue':_0x4c45('0x3')},'startAt':{'type':Sequelize[_0x4c45('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x4c45('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x4c45('0x5'),_0x4c45('0x6'),'months',_0x4c45('0x7'),_0x4c45('0x8'),_0x4c45('0x9'),_0x4c45('0xa')),'allowNull':![],'defaultValue':_0x4c45('0x8')},'output':{'type':Sequelize[_0x4c45('0xb')]('csv',_0x4c45('0xc'),'xlsx'),'allowNull':![],'defaultValue':_0x4c45('0xd')},'type':{'type':Sequelize[_0x4c45('0xb')](_0x4c45('0xe'),'default'),'allowNull':![],'defaultValue':_0x4c45('0xe')},'sendMail':{'type':Sequelize[_0x4c45('0xf')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x4c45('0x10')]},'bcc':{'type':Sequelize[_0x4c45('0x10')]},'sendIfEmpty':{'type':Sequelize[_0x4c45('0xf')],'defaultValue':!![]}}; \ No newline at end of file +var _0xd989=['months','weeks','days','hours','minutes','ENUM','csv','pdf','custom','default','TEXT','sequelize','STRING','BOOLEAN','DATE','INTEGER','quarters'];(function(_0x5198d3,_0x28f2ce){var _0xb145dd=function(_0x88d32f){while(--_0x88d32f){_0x5198d3['push'](_0x5198d3['shift']());}};_0xb145dd(++_0x28f2ce);}(_0xd989,0x71));var _0x9d98=function(_0x2b9af6,_0x475a9b){_0x2b9af6=_0x2b9af6-0x0;var _0x20ed39=_0xd989[_0x2b9af6];return _0x20ed39;};'use strict';var Sequelize=require(_0x9d98('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x9d98('0x1')]},'active':{'type':Sequelize[_0x9d98('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x9d98('0x1')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x9d98('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0x9d98('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x9d98('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM']('years',_0x9d98('0x5'),_0x9d98('0x6'),_0x9d98('0x7'),_0x9d98('0x8'),_0x9d98('0x9'),_0x9d98('0xa')),'allowNull':![],'defaultValue':_0x9d98('0x8')},'output':{'type':Sequelize[_0x9d98('0xb')](_0x9d98('0xc'),_0x9d98('0xd'),'xlsx'),'allowNull':![],'defaultValue':_0x9d98('0xc')},'type':{'type':Sequelize['ENUM'](_0x9d98('0xe'),_0x9d98('0xf')),'allowNull':![],'defaultValue':_0x9d98('0xe')},'sendMail':{'type':Sequelize[_0x9d98('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x9d98('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x9d98('0x10')]},'sendIfEmpty':{'type':Sequelize[_0x9d98('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 5f9f95d..aa42cad 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 _0x82d2=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','Scheduler','UserProfileResource','sendStatus','error','stack','name','map','Schedule','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','findAll','catch','show','params','include','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation'];(function(_0xafd810,_0xabc1cf){var _0xa3960a=function(_0x4d6ff9){while(--_0x4d6ff9){_0xafd810['push'](_0xafd810['shift']());}};_0xa3960a(++_0xabc1cf);}(_0x82d2,0x1d0));var _0x282d=function(_0x348224,_0x37b6a1){_0x348224=_0x348224-0x0;var _0x36ea70=_0x82d2[_0x348224];return _0x36ea70;};'use strict';var emlformat=require(_0x282d('0x0'));var rimraf=require(_0x282d('0x1'));var zipdir=require(_0x282d('0x2'));var jsonpatch=require(_0x282d('0x3'));var rp=require('request-promise');var moment=require(_0x282d('0x4'));var BPromise=require(_0x282d('0x5'));var Mustache=require('mustache');var util=require(_0x282d('0x6'));var path=require(_0x282d('0x7'));var sox=require('sox');var csv=require(_0x282d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x282d('0x9'));var _=require(_0x282d('0xa'));var squel=require(_0x282d('0xb'));var crypto=require(_0x282d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x282d('0xd'));var toCsv=require(_0x282d('0x8'));var querystring=require(_0x282d('0xe'));var Papa=require(_0x282d('0xf'));var Redis=require('ioredis');var authService=require(_0x282d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x282d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x282d('0x12'));var utils=require(_0x282d('0x13'));var config=require(_0x282d('0x14'));var licenseUtil=require(_0x282d('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47793c,_0x3f23be){_0x3f23be=_0x3f23be||0xcc;return function(_0x972cc0){if(_0x972cc0){return _0x47793c['sendStatus'](_0x3f23be);}return _0x47793c[_0x282d('0x16')](_0x3f23be)[_0x282d('0x17')]();};}function respondWithResult(_0x3844aa,_0x5dd3ee){_0x5dd3ee=_0x5dd3ee||0xc8;return function(_0x22297b){if(_0x22297b){return _0x3844aa[_0x282d('0x16')](_0x5dd3ee)[_0x282d('0x18')](_0x22297b);}};}function respondWithFilteredResult(_0x1b8dde,_0xc7debd){return function(_0x1be2e3){if(_0x1be2e3){var _0x377c5e=typeof _0xc7debd['offset']===_0x282d('0x19')&&typeof _0xc7debd[_0x282d('0x1a')]===_0x282d('0x19');var _0x2f2732=_0x1be2e3[_0x282d('0x1b')];var _0xebfbd4=_0x377c5e?0x0:_0xc7debd[_0x282d('0x1c')];var _0xe05cca=_0x377c5e?_0x1be2e3[_0x282d('0x1b')]:_0xc7debd['offset']+_0xc7debd[_0x282d('0x1a')];var _0xd9569c;if(_0xe05cca>=_0x2f2732){_0xe05cca=_0x2f2732;_0xd9569c=0xc8;}else{_0xd9569c=0xce;}_0x1b8dde[_0x282d('0x16')](_0xd9569c);return _0x1b8dde[_0x282d('0x1d')](_0x282d('0x1e'),_0xebfbd4+'-'+_0xe05cca+'/'+_0x2f2732)[_0x282d('0x18')](_0x1be2e3);}return null;};}function patchUpdates(_0x595210){return function(_0x629d11){try{jsonpatch[_0x282d('0x1f')](_0x629d11,_0x595210,!![]);}catch(_0x54aba3){return BPromise[_0x282d('0x20')](_0x54aba3);}return _0x629d11[_0x282d('0x21')]();};}function saveUpdates(_0x52a116,_0x2ae35d){return function(_0x3a00a6){if(_0x3a00a6){return _0x3a00a6['update'](_0x52a116)[_0x282d('0x22')](function(_0x519d2c){return _0x519d2c;});}return null;};}function removeEntity(_0x49f36c,_0x5a61d1){return function(_0x285f8b){if(_0x285f8b){return _0x285f8b[_0x282d('0x23')]()[_0x282d('0x22')](function(){var _0x534c5b=_0x285f8b[_0x282d('0x24')]({'plain':!![]});var _0xfb24ab=_0x282d('0x25');return db[_0x282d('0x26')][_0x282d('0x23')]({'where':{'type':_0xfb24ab,'resourceId':_0x534c5b['id']}})[_0x282d('0x22')](function(){return _0x285f8b;});})[_0x282d('0x22')](function(){_0x49f36c[_0x282d('0x16')](0xcc)[_0x282d('0x17')]();});}};}function handleEntityNotFound(_0x21589d,_0x10cd88){return function(_0x1f2896){if(!_0x1f2896){_0x21589d[_0x282d('0x27')](0x194);}return _0x1f2896;};}function handleError(_0x429161,_0x4b1bf2){_0x4b1bf2=_0x4b1bf2||0x1f4;return function(_0x24229e){logger[_0x282d('0x28')](_0x24229e[_0x282d('0x29')]);if(_0x24229e[_0x282d('0x2a')]){delete _0x24229e[_0x282d('0x2a')];}_0x429161['status'](_0x4b1bf2)['send'](_0x24229e);};}exports['index']=function(_0x3d4495,_0x5719c7){var _0x1a6b42={},_0x1c480f={},_0x2d1cd4={'count':0x0,'rows':[]};var _0x39c216=_[_0x282d('0x2b')](db[_0x282d('0x2c')][_0x282d('0x2d')],function(_0x1ced1c){return{'name':_0x1ced1c[_0x282d('0x2e')],'type':_0x1ced1c[_0x282d('0x2f')]['key']};});_0x1c480f[_0x282d('0x30')]=_[_0x282d('0x2b')](_0x39c216,'name');_0x1c480f[_0x282d('0x31')]=_[_0x282d('0x32')](_0x3d4495[_0x282d('0x31')]);_0x1c480f[_0x282d('0x33')]=_['intersection'](_0x1c480f['model'],_0x1c480f[_0x282d('0x31')]);_0x1a6b42['attributes']=_[_0x282d('0x34')](_0x1c480f[_0x282d('0x30')],qs['fields'](_0x3d4495['query'][_0x282d('0x35')]));_0x1a6b42[_0x282d('0x36')]=_0x1a6b42[_0x282d('0x36')][_0x282d('0x37')]?_0x1a6b42[_0x282d('0x36')]:_0x1c480f[_0x282d('0x30')];if(!_0x3d4495[_0x282d('0x31')][_0x282d('0x38')](_0x282d('0x39'))){_0x1a6b42[_0x282d('0x1a')]=qs[_0x282d('0x1a')](_0x3d4495[_0x282d('0x31')]['limit']);_0x1a6b42[_0x282d('0x1c')]=qs['offset'](_0x3d4495[_0x282d('0x31')][_0x282d('0x1c')]);}_0x1a6b42['order']=qs['sort'](_0x3d4495[_0x282d('0x31')][_0x282d('0x3a')]);_0x1a6b42[_0x282d('0x3b')]=qs[_0x282d('0x33')](_[_0x282d('0x3c')](_0x3d4495[_0x282d('0x31')],_0x1c480f[_0x282d('0x33')]),_0x39c216);if(_0x3d4495['query'][_0x282d('0x3d')]){_0x1a6b42[_0x282d('0x3b')]=_['merge'](_0x1a6b42[_0x282d('0x3b')],{'$or':_[_0x282d('0x2b')](_0x39c216,function(_0xa49505){if(_0xa49505[_0x282d('0x2f')]!=='VIRTUAL'){var _0x578055={};_0x578055[_0xa49505[_0x282d('0x2a')]]={'$like':'%'+_0x3d4495['query']['filter']+'%'};return _0x578055;}})});}_0x1a6b42=_['merge']({},_0x1a6b42,_0x3d4495['options']);var _0x455188={'where':_0x1a6b42[_0x282d('0x3b')]};return db[_0x282d('0x2c')][_0x282d('0x1b')](_0x455188)[_0x282d('0x22')](function(_0x46a63c){_0x2d1cd4[_0x282d('0x1b')]=_0x46a63c;if(_0x3d4495['query']['includeAll']){_0x1a6b42['include']=[{'all':!![]}];}return db['Schedule'][_0x282d('0x3e')](_0x1a6b42);})[_0x282d('0x22')](function(_0x3baebf){_0x2d1cd4['rows']=_0x3baebf;return _0x2d1cd4;})[_0x282d('0x22')](respondWithFilteredResult(_0x5719c7,_0x1a6b42))[_0x282d('0x3f')](handleError(_0x5719c7,null));};exports[_0x282d('0x40')]=function(_0x147508,_0x30386f){var _0x3f5baf={'raw':![],'where':{'id':_0x147508[_0x282d('0x41')]['id']}},_0xb65fe9={};_0xb65fe9[_0x282d('0x30')]=_['keys'](db[_0x282d('0x2c')][_0x282d('0x2d')]);_0xb65fe9['query']=_[_0x282d('0x32')](_0x147508[_0x282d('0x31')]);_0xb65fe9['filters']=_[_0x282d('0x34')](_0xb65fe9[_0x282d('0x30')],_0xb65fe9['query']);_0x3f5baf['attributes']=_[_0x282d('0x34')](_0xb65fe9['model'],qs[_0x282d('0x35')](_0x147508[_0x282d('0x31')]['fields']));_0x3f5baf[_0x282d('0x36')]=_0x3f5baf[_0x282d('0x36')][_0x282d('0x37')]?_0x3f5baf['attributes']:_0xb65fe9[_0x282d('0x30')];if(_0x147508[_0x282d('0x31')]['includeAll']){_0x3f5baf[_0x282d('0x42')]=[{'all':!![]}];}_0x3f5baf=_['merge']({},_0x3f5baf,_0x147508['options']);return db[_0x282d('0x2c')][_0x282d('0x43')](_0x3f5baf)['then'](handleEntityNotFound(_0x30386f,null))[_0x282d('0x22')](respondWithResult(_0x30386f,null))[_0x282d('0x3f')](handleError(_0x30386f,null));};exports['create']=function(_0x1ff546,_0x53d7dc){return db[_0x282d('0x2c')][_0x282d('0x44')](_0x1ff546[_0x282d('0x45')],{})[_0x282d('0x22')](function(_0x373051){var _0x41dd3d=_0x1ff546[_0x282d('0x46')][_0x282d('0x24')]({'plain':!![]});if(!_0x41dd3d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x41dd3d[_0x282d('0x47')]===_0x282d('0x46')){var _0x25db07=_0x373051[_0x282d('0x24')]({'plain':!![]});var _0x27331b=_0x282d('0x25');return db[_0x282d('0x48')][_0x282d('0x43')]({'where':{'name':_0x27331b,'userProfileId':_0x41dd3d[_0x282d('0x49')]},'raw':!![]})[_0x282d('0x22')](function(_0x2bda23){if(_0x2bda23&&_0x2bda23[_0x282d('0x4a')]===0x0){return db[_0x282d('0x26')][_0x282d('0x44')]({'name':_0x25db07[_0x282d('0x2a')],'resourceId':_0x25db07['id'],'type':_0x2bda23[_0x282d('0x2a')],'sectionId':_0x2bda23['id']},{})[_0x282d('0x22')](function(){return _0x373051;});}else{return _0x373051;}})[_0x282d('0x3f')](function(_0x4ab0dd){logger[_0x282d('0x28')](_0x282d('0x4b'),_0x4ab0dd);throw _0x4ab0dd;});}return _0x373051;})['then'](respondWithResult(_0x53d7dc,0xc9))['catch'](handleError(_0x53d7dc,null));};exports['update']=function(_0x59782d,_0xba1335){if(_0x59782d[_0x282d('0x45')]['id']){delete _0x59782d[_0x282d('0x45')]['id'];}return db[_0x282d('0x2c')][_0x282d('0x43')]({'where':{'id':_0x59782d['params']['id']}})[_0x282d('0x22')](handleEntityNotFound(_0xba1335,null))[_0x282d('0x22')](saveUpdates(_0x59782d[_0x282d('0x45')],null))[_0x282d('0x22')](respondWithResult(_0xba1335,null))['catch'](handleError(_0xba1335,null));};exports[_0x282d('0x23')]=function(_0x416b5e,_0x1fc8f0){return db['Schedule'][_0x282d('0x43')]({'where':{'id':_0x416b5e['params']['id']}})[_0x282d('0x22')](handleEntityNotFound(_0x1fc8f0,null))[_0x282d('0x22')](removeEntity(_0x1fc8f0,null))[_0x282d('0x3f')](handleError(_0x1fc8f0,null));};exports[_0x282d('0x4c')]=function(_0x5c2934,_0x2c7fa5,_0x22eba3){var _0x2f6d96=require('../../config/schedule');return db[_0x282d('0x2c')][_0x282d('0x43')]({'where':{'id':_0x5c2934[_0x282d('0x41')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2c7fa5,null))[_0x282d('0x22')](function(){_0x2f6d96[_0x282d('0x4c')](_0x5c2934['params']['id']);})[_0x282d('0x22')](respondWithStatusCode(_0x2c7fa5,null))[_0x282d('0x3f')](handleError(_0x2c7fa5,null));}; \ No newline at end of file +var _0xb47f=['where','VIRTUAL','filter','options','count','include','findAll','rows','catch','show','merge','find','create','body','user','Scheduler','UserProfileSection','userProfileId','autoAssociation','params','run','../../config/schedule','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','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','set','json','apply','reject','save','update','destroy','get','UserProfileResource','then','end','sendStatus','error','name','send','index','map','Schedule','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick'];(function(_0x4b174b,_0x501b2b){var _0x39c9f7=function(_0x43cbbf){while(--_0x43cbbf){_0x4b174b['push'](_0x4b174b['shift']());}};_0x39c9f7(++_0x501b2b);}(_0xb47f,0x1d3));var _0xfb47=function(_0x3bf725,_0x5883d5){_0x3bf725=_0x3bf725-0x0;var _0x29a976=_0xb47f[_0x3bf725];return _0x29a976;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfb47('0x0'));var zipdir=require(_0xfb47('0x1'));var jsonpatch=require(_0xfb47('0x2'));var rp=require(_0xfb47('0x3'));var moment=require(_0xfb47('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfb47('0x5'));var util=require(_0xfb47('0x6'));var path=require(_0xfb47('0x7'));var sox=require(_0xfb47('0x8'));var csv=require(_0xfb47('0x9'));var ejs=require(_0xfb47('0xa'));var fs=require('fs');var fs_extra=require(_0xfb47('0xb'));var _=require(_0xfb47('0xc'));var squel=require(_0xfb47('0xd'));var crypto=require(_0xfb47('0xe'));var jsforce=require(_0xfb47('0xf'));var deskjs=require(_0xfb47('0x10'));var toCsv=require('to-csv');var querystring=require(_0xfb47('0x11'));var Papa=require(_0xfb47('0x12'));var Redis=require('ioredis');var authService=require(_0xfb47('0x13'));var qs=require(_0xfb47('0x14'));var as=require(_0xfb47('0x15'));var hardwareService=require(_0xfb47('0x16'));var logger=require(_0xfb47('0x17'))(_0xfb47('0x18'));var utils=require(_0xfb47('0x19'));var config=require(_0xfb47('0x1a'));var licenseUtil=require(_0xfb47('0x1b'));var db=require(_0xfb47('0x1c'))['db'];function respondWithStatusCode(_0x1d530a,_0xe62760){_0xe62760=_0xe62760||0xcc;return function(_0x39a781){if(_0x39a781){return _0x1d530a['sendStatus'](_0xe62760);}return _0x1d530a[_0xfb47('0x1d')](_0xe62760)['end']();};}function respondWithResult(_0x1b094e,_0x398a61){_0x398a61=_0x398a61||0xc8;return function(_0x4b8b3f){if(_0x4b8b3f){return _0x1b094e[_0xfb47('0x1d')](_0x398a61)['json'](_0x4b8b3f);}};}function respondWithFilteredResult(_0x122ec6,_0x233e19){return function(_0x3599b1){if(_0x3599b1){var _0x501870=typeof _0x233e19[_0xfb47('0x1e')]==='undefined'&&typeof _0x233e19['limit']===_0xfb47('0x1f');var _0x291f2d=_0x3599b1['count'];var _0x188bd0=_0x501870?0x0:_0x233e19['offset'];var _0x270a11=_0x501870?_0x3599b1['count']:_0x233e19[_0xfb47('0x1e')]+_0x233e19[_0xfb47('0x20')];var _0x499a79;if(_0x270a11>=_0x291f2d){_0x270a11=_0x291f2d;_0x499a79=0xc8;}else{_0x499a79=0xce;}_0x122ec6[_0xfb47('0x1d')](_0x499a79);return _0x122ec6[_0xfb47('0x21')]('Content-Range',_0x188bd0+'-'+_0x270a11+'/'+_0x291f2d)[_0xfb47('0x22')](_0x3599b1);}return null;};}function patchUpdates(_0x15a736){return function(_0x4999b7){try{jsonpatch[_0xfb47('0x23')](_0x4999b7,_0x15a736,!![]);}catch(_0x3116ab){return BPromise[_0xfb47('0x24')](_0x3116ab);}return _0x4999b7[_0xfb47('0x25')]();};}function saveUpdates(_0x4c9fc1,_0x5309dc){return function(_0x3b60e9){if(_0x3b60e9){return _0x3b60e9[_0xfb47('0x26')](_0x4c9fc1)['then'](function(_0x130b7a){return _0x130b7a;});}return null;};}function removeEntity(_0x3dce38,_0xdba1ed){return function(_0x33e2ab){if(_0x33e2ab){return _0x33e2ab[_0xfb47('0x27')]()['then'](function(){var _0x4a1916=_0x33e2ab[_0xfb47('0x28')]({'plain':!![]});var _0x253476='Scheduler';return db[_0xfb47('0x29')]['destroy']({'where':{'type':_0x253476,'resourceId':_0x4a1916['id']}})[_0xfb47('0x2a')](function(){return _0x33e2ab;});})['then'](function(){_0x3dce38[_0xfb47('0x1d')](0xcc)[_0xfb47('0x2b')]();});}};}function handleEntityNotFound(_0x119290,_0x4410c1){return function(_0x5c7174){if(!_0x5c7174){_0x119290[_0xfb47('0x2c')](0x194);}return _0x5c7174;};}function handleError(_0x47c63d,_0x4c43b3){_0x4c43b3=_0x4c43b3||0x1f4;return function(_0x3e47dd){logger[_0xfb47('0x2d')](_0x3e47dd['stack']);if(_0x3e47dd['name']){delete _0x3e47dd[_0xfb47('0x2e')];}_0x47c63d[_0xfb47('0x1d')](_0x4c43b3)[_0xfb47('0x2f')](_0x3e47dd);};}exports[_0xfb47('0x30')]=function(_0x102212,_0x2cc6b2){var _0x42c7ee={},_0x5dde3a={},_0x5c303c={'count':0x0,'rows':[]};var _0x3f81fc=_[_0xfb47('0x31')](db[_0xfb47('0x32')]['rawAttributes'],function(_0x4ab4b7){return{'name':_0x4ab4b7[_0xfb47('0x33')],'type':_0x4ab4b7[_0xfb47('0x34')][_0xfb47('0x35')]};});_0x5dde3a[_0xfb47('0x36')]=_[_0xfb47('0x31')](_0x3f81fc,'name');_0x5dde3a[_0xfb47('0x37')]=_[_0xfb47('0x38')](_0x102212['query']);_0x5dde3a[_0xfb47('0x39')]=_[_0xfb47('0x3a')](_0x5dde3a[_0xfb47('0x36')],_0x5dde3a['query']);_0x42c7ee[_0xfb47('0x3b')]=_[_0xfb47('0x3a')](_0x5dde3a['model'],qs['fields'](_0x102212[_0xfb47('0x37')][_0xfb47('0x3c')]));_0x42c7ee[_0xfb47('0x3b')]=_0x42c7ee[_0xfb47('0x3b')][_0xfb47('0x3d')]?_0x42c7ee[_0xfb47('0x3b')]:_0x5dde3a[_0xfb47('0x36')];if(!_0x102212[_0xfb47('0x37')][_0xfb47('0x3e')](_0xfb47('0x3f'))){_0x42c7ee[_0xfb47('0x20')]=qs[_0xfb47('0x20')](_0x102212[_0xfb47('0x37')][_0xfb47('0x20')]);_0x42c7ee[_0xfb47('0x1e')]=qs['offset'](_0x102212[_0xfb47('0x37')][_0xfb47('0x1e')]);}_0x42c7ee[_0xfb47('0x40')]=qs[_0xfb47('0x41')](_0x102212['query'][_0xfb47('0x41')]);_0x42c7ee['where']=qs['filters'](_[_0xfb47('0x42')](_0x102212[_0xfb47('0x37')],_0x5dde3a[_0xfb47('0x39')]),_0x3f81fc);if(_0x102212[_0xfb47('0x37')]['filter']){_0x42c7ee['where']=_['merge'](_0x42c7ee[_0xfb47('0x43')],{'$or':_[_0xfb47('0x31')](_0x3f81fc,function(_0x5b6043){if(_0x5b6043['type']!==_0xfb47('0x44')){var _0x22c595={};_0x22c595[_0x5b6043[_0xfb47('0x2e')]]={'$like':'%'+_0x102212[_0xfb47('0x37')][_0xfb47('0x45')]+'%'};return _0x22c595;}})});}_0x42c7ee=_['merge']({},_0x42c7ee,_0x102212[_0xfb47('0x46')]);var _0x50758e={'where':_0x42c7ee[_0xfb47('0x43')]};return db['Schedule'][_0xfb47('0x47')](_0x50758e)[_0xfb47('0x2a')](function(_0x3ceb23){_0x5c303c[_0xfb47('0x47')]=_0x3ceb23;if(_0x102212[_0xfb47('0x37')]['includeAll']){_0x42c7ee[_0xfb47('0x48')]=[{'all':!![]}];}return db['Schedule'][_0xfb47('0x49')](_0x42c7ee);})[_0xfb47('0x2a')](function(_0x100861){_0x5c303c[_0xfb47('0x4a')]=_0x100861;return _0x5c303c;})[_0xfb47('0x2a')](respondWithFilteredResult(_0x2cc6b2,_0x42c7ee))[_0xfb47('0x4b')](handleError(_0x2cc6b2,null));};exports[_0xfb47('0x4c')]=function(_0x27b62e,_0x5f0a02){var _0x2fc595={'raw':![],'where':{'id':_0x27b62e['params']['id']}},_0x236bb2={};_0x236bb2[_0xfb47('0x36')]=_[_0xfb47('0x38')](db[_0xfb47('0x32')]['rawAttributes']);_0x236bb2[_0xfb47('0x37')]=_[_0xfb47('0x38')](_0x27b62e[_0xfb47('0x37')]);_0x236bb2[_0xfb47('0x39')]=_['intersection'](_0x236bb2[_0xfb47('0x36')],_0x236bb2[_0xfb47('0x37')]);_0x2fc595[_0xfb47('0x3b')]=_[_0xfb47('0x3a')](_0x236bb2['model'],qs[_0xfb47('0x3c')](_0x27b62e[_0xfb47('0x37')]['fields']));_0x2fc595[_0xfb47('0x3b')]=_0x2fc595['attributes'][_0xfb47('0x3d')]?_0x2fc595[_0xfb47('0x3b')]:_0x236bb2[_0xfb47('0x36')];if(_0x27b62e['query']['includeAll']){_0x2fc595[_0xfb47('0x48')]=[{'all':!![]}];}_0x2fc595=_[_0xfb47('0x4d')]({},_0x2fc595,_0x27b62e[_0xfb47('0x46')]);return db[_0xfb47('0x32')][_0xfb47('0x4e')](_0x2fc595)[_0xfb47('0x2a')](handleEntityNotFound(_0x5f0a02,null))[_0xfb47('0x2a')](respondWithResult(_0x5f0a02,null))[_0xfb47('0x4b')](handleError(_0x5f0a02,null));};exports[_0xfb47('0x4f')]=function(_0x485a5f,_0x5e27da){return db[_0xfb47('0x32')][_0xfb47('0x4f')](_0x485a5f[_0xfb47('0x50')],{})[_0xfb47('0x2a')](function(_0x1b982a){var _0x3f43b7=_0x485a5f[_0xfb47('0x51')][_0xfb47('0x28')]({'plain':!![]});if(!_0x3f43b7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f43b7['role']===_0xfb47('0x51')){var _0x5a26c5=_0x1b982a[_0xfb47('0x28')]({'plain':!![]});var _0x5e0f0c=_0xfb47('0x52');return db[_0xfb47('0x53')][_0xfb47('0x4e')]({'where':{'name':_0x5e0f0c,'userProfileId':_0x3f43b7[_0xfb47('0x54')]},'raw':!![]})[_0xfb47('0x2a')](function(_0x27c191){if(_0x27c191&&_0x27c191[_0xfb47('0x55')]===0x0){return db[_0xfb47('0x29')][_0xfb47('0x4f')]({'name':_0x5a26c5[_0xfb47('0x2e')],'resourceId':_0x5a26c5['id'],'type':_0x27c191['name'],'sectionId':_0x27c191['id']},{})[_0xfb47('0x2a')](function(){return _0x1b982a;});}else{return _0x1b982a;}})[_0xfb47('0x4b')](function(_0x220b52){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x220b52);throw _0x220b52;});}return _0x1b982a;})[_0xfb47('0x2a')](respondWithResult(_0x5e27da,0xc9))[_0xfb47('0x4b')](handleError(_0x5e27da,null));};exports[_0xfb47('0x26')]=function(_0x3e2b0a,_0x50e1f1){if(_0x3e2b0a[_0xfb47('0x50')]['id']){delete _0x3e2b0a['body']['id'];}return db['Schedule'][_0xfb47('0x4e')]({'where':{'id':_0x3e2b0a[_0xfb47('0x56')]['id']}})['then'](handleEntityNotFound(_0x50e1f1,null))['then'](saveUpdates(_0x3e2b0a[_0xfb47('0x50')],null))['then'](respondWithResult(_0x50e1f1,null))[_0xfb47('0x4b')](handleError(_0x50e1f1,null));};exports[_0xfb47('0x27')]=function(_0x1dbdb1,_0x52c89b){return db['Schedule']['find']({'where':{'id':_0x1dbdb1['params']['id']}})[_0xfb47('0x2a')](handleEntityNotFound(_0x52c89b,null))[_0xfb47('0x2a')](removeEntity(_0x52c89b,null))['catch'](handleError(_0x52c89b,null));};exports[_0xfb47('0x57')]=function(_0x1350ca,_0x2fd8f3,_0x5d2f2c){var _0x2bbde5=require(_0xfb47('0x58'));return db[_0xfb47('0x32')][_0xfb47('0x4e')]({'where':{'id':_0x1350ca[_0xfb47('0x56')]['id']},'raw':!![]})[_0xfb47('0x2a')](handleEntityNotFound(_0x2fd8f3,null))[_0xfb47('0x2a')](function(){_0x2bbde5['run'](_0x1350ca[_0xfb47('0x56')]['id']);})[_0xfb47('0x2a')](respondWithStatusCode(_0x2fd8f3,null))[_0xfb47('0x4b')](handleError(_0x2fd8f3,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index f402fb1..9f930a0 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 _0x28df=['./schedule.attributes','define','Schedule','tools_schedules','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x5e70f7,_0x344ec4){var _0x51aa64=function(_0x424e7d){while(--_0x424e7d){_0x5e70f7['push'](_0x5e70f7['shift']());}};_0x51aa64(++_0x344ec4);}(_0x28df,0x1d0));var _0xf28d=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x28df[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0xf28d('0x0'));var logger=require(_0xf28d('0x1'))(_0xf28d('0x2'));var moment=require('moment');var BPromise=require(_0xf28d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf28d('0x4'));var rimraf=require(_0xf28d('0x5'));var config=require('../../config/environment');var attributes=require(_0xf28d('0x6'));module['exports']=function(_0x3e60f0,_0x592843){return _0x3e60f0[_0xf28d('0x7')](_0xf28d('0x8'),attributes,{'tableName':_0xf28d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ec4=['define','Schedule','tools_schedules','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports'];(function(_0x36726c,_0x219bbe){var _0x44910e=function(_0x1956d0){while(--_0x1956d0){_0x36726c['push'](_0x36726c['shift']());}};_0x44910e(++_0x219bbe);}(_0x7ec4,0x16f));var _0x47ec=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x7ec4[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x47ec('0x0'));var util=require(_0x47ec('0x1'));var logger=require(_0x47ec('0x2'))('api');var moment=require(_0x47ec('0x3'));var BPromise=require(_0x47ec('0x4'));var rp=require(_0x47ec('0x5'));var fs=require('fs');var path=require(_0x47ec('0x6'));var rimraf=require(_0x47ec('0x7'));var config=require(_0x47ec('0x8'));var attributes=require(_0x47ec('0x9'));module[_0x47ec('0xa')]=function(_0x59b5f7,_0x1a6a38){return _0x59b5f7[_0x47ec('0xb')](_0x47ec('0xc'),attributes,{'tableName':_0x47ec('0xd'),'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 c7a1b36..1cd6ac9 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 _0xa5e6=['Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','Schedule,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x21cb7f,_0x48cd16){var _0x5a079a=function(_0x569a4f){while(--_0x569a4f){_0x21cb7f['push'](_0x21cb7f['shift']());}};_0x5a079a(++_0x48cd16);}(_0xa5e6,0xb6));var _0x6a5e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa5e6[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x6a5e('0x0'));var util=require(_0x6a5e('0x1'));var moment=require(_0x6a5e('0x2'));var BPromise=require(_0x6a5e('0x3'));var rs=require(_0x6a5e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6a5e('0x5'))['db'];var utils=require(_0x6a5e('0x6'));var logger=require('../../config/logger')(_0x6a5e('0x7'));var config=require(_0x6a5e('0x8'));var jayson=require(_0x6a5e('0x9'));var client=jayson[_0x6a5e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x57c721,_0x230732,_0x5393c7){return new BPromise(function(_0x32d67f,_0x4288be){return client[_0x6a5e('0xb')](_0x57c721,_0x5393c7)[_0x6a5e('0xc')](function(_0x49b2c0){logger['info'](_0x6a5e('0xd'),_0x230732,_0x6a5e('0xe'));logger[_0x6a5e('0xf')](_0x6a5e('0x10'),_0x230732,_0x6a5e('0xe'),JSON[_0x6a5e('0x11')](_0x49b2c0));if(_0x49b2c0[_0x6a5e('0x12')]){if(_0x49b2c0['error'][_0x6a5e('0x13')]===0x1f4){logger[_0x6a5e('0x12')]('Schedule,\x20%s,\x20%s',_0x230732,_0x49b2c0[_0x6a5e('0x12')]['message']);return _0x4288be(_0x49b2c0['error'][_0x6a5e('0x14')]);}logger['error'](_0x6a5e('0xd'),_0x230732,_0x49b2c0[_0x6a5e('0x12')][_0x6a5e('0x14')]);return _0x32d67f(_0x49b2c0['error'][_0x6a5e('0x14')]);}else{logger['info']('Schedule,\x20%s,\x20%s',_0x230732,_0x6a5e('0xe'));_0x32d67f(_0x49b2c0[_0x6a5e('0x15')][_0x6a5e('0x14')]);}})['catch'](function(_0x2ba651){logger[_0x6a5e('0x12')](_0x6a5e('0xd'),_0x230732,_0x2ba651);_0x4288be(_0x2ba651);});});} \ No newline at end of file +var _0x2288=['request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x57835d,_0x599c7d){var _0x4f53bc=function(_0x4dfaad){while(--_0x4dfaad){_0x57835d['push'](_0x57835d['shift']());}};_0x4f53bc(++_0x599c7d);}(_0x2288,0x1f0));var _0x8228=function(_0x3968a3,_0xd285c1){_0x3968a3=_0x3968a3-0x0;var _0x48b5a4=_0x2288[_0x3968a3];return _0x48b5a4;};'use strict';var _=require(_0x8228('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8228('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8228('0x2'));var db=require(_0x8228('0x3'))['db'];var utils=require(_0x8228('0x4'));var logger=require(_0x8228('0x5'))(_0x8228('0x6'));var config=require(_0x8228('0x7'));var jayson=require(_0x8228('0x8'));var client=jayson[_0x8228('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1aa961,_0x57c5f0,_0x37a2ea){return new BPromise(function(_0xa85677,_0x45c39e){return client[_0x8228('0xa')](_0x1aa961,_0x37a2ea)[_0x8228('0xb')](function(_0x387ba5){logger[_0x8228('0xc')](_0x8228('0xd'),_0x57c5f0,_0x8228('0xe'));logger[_0x8228('0xf')](_0x8228('0x10'),_0x57c5f0,_0x8228('0xe'),JSON[_0x8228('0x11')](_0x387ba5));if(_0x387ba5[_0x8228('0x12')]){if(_0x387ba5[_0x8228('0x12')][_0x8228('0x13')]===0x1f4){logger[_0x8228('0x12')](_0x8228('0xd'),_0x57c5f0,_0x387ba5[_0x8228('0x12')][_0x8228('0x14')]);return _0x45c39e(_0x387ba5['error']['message']);}logger[_0x8228('0x12')](_0x8228('0xd'),_0x57c5f0,_0x387ba5['error'][_0x8228('0x14')]);return _0xa85677(_0x387ba5[_0x8228('0x12')]['message']);}else{logger[_0x8228('0xc')](_0x8228('0xd'),_0x57c5f0,_0x8228('0xe'));_0xa85677(_0x387ba5[_0x8228('0x15')][_0x8228('0x14')]);}})[_0x8228('0x16')](function(_0x3a0b7b){logger[_0x8228('0x12')](_0x8228('0xd'),_0x57c5f0,_0x3a0b7b);_0x45c39e(_0x3a0b7b);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 4d836f6..474d9aa 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 _0xd5ab=['post','create','put','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','download'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xd5ab,0x89));var _0xbd5a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd5ab[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xbd5a('0x0'));var util=require(_0xbd5a('0x1'));var path=require(_0xbd5a('0x2'));var timeout=require(_0xbd5a('0x3'));var express=require('express');var router=express[_0xbd5a('0x4')]();var fs_extra=require(_0xbd5a('0x5'));var auth=require(_0xbd5a('0x6'));var interaction=require(_0xbd5a('0x7'));var config=require('../../config/environment');var controller=require(_0xbd5a('0x8'));router[_0xbd5a('0x9')]('/',auth[_0xbd5a('0xa')](),controller[_0xbd5a('0xb')]);router[_0xbd5a('0x9')](_0xbd5a('0xc'),auth['isAuthenticated'](),controller[_0xbd5a('0xd')]);router[_0xbd5a('0x9')](_0xbd5a('0xe'),auth[_0xbd5a('0xa')](),controller[_0xbd5a('0xf')]);router[_0xbd5a('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0xbd5a('0x10')]);router[_0xbd5a('0x11')]('/',auth[_0xbd5a('0xa')](),controller[_0xbd5a('0x12')]);router[_0xbd5a('0x13')](_0xbd5a('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xbd5a('0xe'),auth[_0xbd5a('0xa')](),controller[_0xbd5a('0x14')]);module[_0xbd5a('0x15')]=router; \ No newline at end of file +var _0xa0bc=['exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','create','put','update','delete'];(function(_0xcd38d3,_0x3731b4){var _0x42d5b1=function(_0x480260){while(--_0x480260){_0xcd38d3['push'](_0xcd38d3['shift']());}};_0x42d5b1(++_0x3731b4);}(_0xa0bc,0x17b));var _0xca0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0bc[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xca0b('0x0'));var util=require('util');var path=require(_0xca0b('0x1'));var timeout=require(_0xca0b('0x2'));var express=require('express');var router=express[_0xca0b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xca0b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xca0b('0x5'));var controller=require('./screenRecording.controller');router[_0xca0b('0x6')]('/',auth[_0xca0b('0x7')](),controller[_0xca0b('0x8')]);router[_0xca0b('0x6')](_0xca0b('0x9'),auth['isAuthenticated'](),controller[_0xca0b('0xa')]);router[_0xca0b('0x6')](_0xca0b('0xb'),auth[_0xca0b('0x7')](),controller[_0xca0b('0xc')]);router[_0xca0b('0x6')](_0xca0b('0xd'),auth['isAuthenticated'](),controller[_0xca0b('0xe')]);router[_0xca0b('0xf')]('/',auth[_0xca0b('0x7')](),controller[_0xca0b('0x10')]);router[_0xca0b('0x11')](_0xca0b('0xb'),auth[_0xca0b('0x7')](),controller[_0xca0b('0x12')]);router[_0xca0b('0x13')](_0xca0b('0xb'),auth[_0xca0b('0x7')](),controller['destroy']);module[_0xca0b('0x14')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 4af30eb..0e24a26 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 _0x6ca3=['DATE','format','toString','MM-DD-YYYY\x20HH:mm','createdAt','updatedAt','path','../../config/environment','VIRTUAL','getDataValue','extname','STRING','setDataValue','value','startedAt','subtract','closedAt','duration'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x6ca3,0xba));var _0x36ca=function(_0x2b7dcf,_0x4f9a4f){_0x2b7dcf=_0x2b7dcf-0x0;var _0x448baf=_0x6ca3[_0x2b7dcf];return _0x448baf;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var path=require(_0x36ca('0x0'));var config=require(_0x36ca('0x1'));module['exports']={'format':{'type':Sequelize[_0x36ca('0x2')],'get':function(){return this[_0x36ca('0x3')]('value')?path[_0x36ca('0x4')](this['getDataValue']('value')):undefined;}},'interactionid':{'type':Sequelize[_0x36ca('0x5')]},'channel':{'type':Sequelize[_0x36ca('0x5')]},'value':{'type':Sequelize[_0x36ca('0x5')],'set':function(_0x4453c2){var _0x5996df=_0x4453c2['replace'](/\\/g,'/');this[_0x36ca('0x6')](_0x36ca('0x7'),_0x5996df);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x14e486){this[_0x36ca('0x6')](_0x36ca('0x8'),moment()[_0x36ca('0x9')](_0x14e486,'ms'));this['setDataValue'](_0x36ca('0xa'),moment());this['setDataValue'](_0x36ca('0xb'),_0x14e486);}},'startedAt':{'type':Sequelize[_0x36ca('0xc')],'get':function(){return moment(this[_0x36ca('0x3')](_0x36ca('0x8')))[_0x36ca('0xd')]('MM-DD-YYYY\x20HH:mm')[_0x36ca('0xe')]();}},'closedAt':{'type':Sequelize[_0x36ca('0xc')],'get':function(){return moment(this[_0x36ca('0x3')]('closedAt'))[_0x36ca('0xd')](_0x36ca('0xf'))[_0x36ca('0xe')]();}},'createdAt':{'type':Sequelize[_0x36ca('0xc')],'get':function(){return moment(this[_0x36ca('0x3')](_0x36ca('0x10')))[_0x36ca('0xd')](_0x36ca('0xf'))[_0x36ca('0xe')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x36ca('0x3')](_0x36ca('0x11')))[_0x36ca('0xd')](_0x36ca('0xf'))[_0x36ca('0xe')]();}}}; \ No newline at end of file +var _0x68fd=['subtract','closedAt','duration','DATE','startedAt','format','toString','createdAt','MM-DD-YYYY\x20HH:mm','sequelize','path','../../config/environment','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER'];(function(_0x1c68d9,_0x1591f1){var _0x5a47f8=function(_0x5e8160){while(--_0x5e8160){_0x1c68d9['push'](_0x1c68d9['shift']());}};_0x5a47f8(++_0x1591f1);}(_0x68fd,0x1e9));var _0xd68f=function(_0x3a340f,_0x5a0b68){_0x3a340f=_0x3a340f-0x0;var _0x55389a=_0x68fd[_0x3a340f];return _0x55389a;};'use strict';var Sequelize=require(_0xd68f('0x0'));var moment=require('moment');var path=require(_0xd68f('0x1'));var config=require(_0xd68f('0x2'));module['exports']={'format':{'type':Sequelize[_0xd68f('0x3')],'get':function(){return this[_0xd68f('0x4')](_0xd68f('0x5'))?path[_0xd68f('0x6')](this[_0xd68f('0x4')](_0xd68f('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0xd68f('0x7')]},'channel':{'type':Sequelize[_0xd68f('0x7')]},'value':{'type':Sequelize[_0xd68f('0x7')],'set':function(_0x4e59f5){var _0xb3cb35=_0x4e59f5[_0xd68f('0x8')](/\\/g,'/');this[_0xd68f('0x9')](_0xd68f('0x5'),_0xb3cb35);}},'rating':{'type':Sequelize[_0xd68f('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xd68f('0xa')],'set':function(_0x18438e){this['setDataValue']('startedAt',moment()[_0xd68f('0xb')](_0x18438e,'ms'));this['setDataValue'](_0xd68f('0xc'),moment());this[_0xd68f('0x9')](_0xd68f('0xd'),_0x18438e);}},'startedAt':{'type':Sequelize[_0xd68f('0xe')],'get':function(){return moment(this[_0xd68f('0x4')](_0xd68f('0xf')))[_0xd68f('0x10')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0xd68f('0xc')))[_0xd68f('0x10')]('MM-DD-YYYY\x20HH:mm')[_0xd68f('0x11')]();}},'createdAt':{'type':Sequelize[_0xd68f('0xe')],'get':function(){return moment(this[_0xd68f('0x4')](_0xd68f('0x12')))[_0xd68f('0x10')](_0xd68f('0x13'))[_0xd68f('0x11')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xd68f('0x4')]('updatedAt'))['format'](_0xd68f('0x13'))[_0xd68f('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 8fd985e..e8b74b8 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 _0x46ed=['intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','show','keys','include','options','find','create','body','createdAt','closedAt','describe','download','../../components/encryptor','uniqueid','params','value','join','root','server/files/screen_recordings','%s.cypher','decryptFile','secrets','recording','existsSync','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','end','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','sendStatus','status','offset','limit','undefined','set','Content-Range','json','apply','reject','update','then','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','format','query','filters'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x46ed,0x168));var _0xd46e=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x46ed[_0x57b54c];return _0x59cc19;};'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'];function respondWithStatusCode(_0x5bc1da,_0x48550b){_0x48550b=_0x48550b||0xcc;return function(_0xf3048c){if(_0xf3048c){return _0x5bc1da[_0xd46e('0x1a')](_0x48550b);}return _0x5bc1da['status'](_0x48550b)['end']();};}function respondWithResult(_0xacd799,_0x4688ae){_0x4688ae=_0x4688ae||0xc8;return function(_0x1e9aae){if(_0x1e9aae){return _0xacd799[_0xd46e('0x1b')](_0x4688ae)['json'](_0x1e9aae);}};}function respondWithFilteredResult(_0x3b6d25,_0x44a620){return function(_0x417402){if(_0x417402){var _0x3d72ce=typeof _0x44a620[_0xd46e('0x1c')]==='undefined'&&typeof _0x44a620[_0xd46e('0x1d')]===_0xd46e('0x1e');var _0x3583a5=_0x417402['count'];var _0x5ddd04=_0x3d72ce?0x0:_0x44a620[_0xd46e('0x1c')];var _0x1bd574=_0x3d72ce?_0x417402['count']:_0x44a620['offset']+_0x44a620[_0xd46e('0x1d')];var _0x2f2571;if(_0x1bd574>=_0x3583a5){_0x1bd574=_0x3583a5;_0x2f2571=0xc8;}else{_0x2f2571=0xce;}_0x3b6d25[_0xd46e('0x1b')](_0x2f2571);return _0x3b6d25[_0xd46e('0x1f')](_0xd46e('0x20'),_0x5ddd04+'-'+_0x1bd574+'/'+_0x3583a5)[_0xd46e('0x21')](_0x417402);}return null;};}function patchUpdates(_0x3b5fa4){return function(_0x327b7e){try{jsonpatch[_0xd46e('0x22')](_0x327b7e,_0x3b5fa4,!![]);}catch(_0x3c7e91){return BPromise[_0xd46e('0x23')](_0x3c7e91);}return _0x327b7e['save']();};}function saveUpdates(_0x259072,_0x1c83fa){return function(_0x79aa51){if(_0x79aa51){return _0x79aa51[_0xd46e('0x24')](_0x259072)[_0xd46e('0x25')](function(_0xc1af7f){return _0xc1af7f;});}return null;};}function removeEntity(_0x33c2e0,_0x8a1be){return function(_0x62dea5){if(_0x62dea5){return _0x62dea5['destroy']()[_0xd46e('0x25')](function(){_0x33c2e0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x371054,_0x2a5271){return function(_0x21135f){if(!_0x21135f){_0x371054[_0xd46e('0x1a')](0x194);}return _0x21135f;};}function handleError(_0x247b9f,_0x180851){_0x180851=_0x180851||0x1f4;return function(_0x1740d1){logger['error'](_0x1740d1[_0xd46e('0x26')]);if(_0x1740d1[_0xd46e('0x27')]){delete _0x1740d1[_0xd46e('0x27')];}_0x247b9f[_0xd46e('0x1b')](_0x180851)[_0xd46e('0x28')](_0x1740d1);};}exports[_0xd46e('0x29')]=function(_0x58aeef,_0x465d54){var _0x3a1ced={},_0x2d1afe={},_0xa716ce={'count':0x0,'rows':[]};var _0x106edc=_[_0xd46e('0x2a')](db[_0xd46e('0x2b')][_0xd46e('0x2c')],function(_0x18f060){return{'name':_0x18f060[_0xd46e('0x2d')],'type':_0x18f060[_0xd46e('0x2e')][_0xd46e('0x2f')]};});_0x2d1afe[_0xd46e('0x30')]=_['differenceBy'](_[_0xd46e('0x2a')](_0x106edc,_0xd46e('0x27')),[_0xd46e('0x31')]);_0x2d1afe[_0xd46e('0x32')]=_['keys'](_0x58aeef[_0xd46e('0x32')]);_0x2d1afe[_0xd46e('0x33')]=_['intersection'](_0x2d1afe[_0xd46e('0x30')],_0x2d1afe[_0xd46e('0x32')]);_0x3a1ced['attributes']=_[_0xd46e('0x34')](_0x2d1afe[_0xd46e('0x30')],qs[_0xd46e('0x35')](_0x58aeef['query']['fields']));_0x3a1ced[_0xd46e('0x36')]=_0x3a1ced[_0xd46e('0x36')][_0xd46e('0x37')]?_0x3a1ced[_0xd46e('0x36')]:_0x2d1afe[_0xd46e('0x30')];if(!_0x58aeef[_0xd46e('0x32')][_0xd46e('0x38')](_0xd46e('0x39'))){_0x3a1ced['limit']=qs[_0xd46e('0x1d')](_0x58aeef[_0xd46e('0x32')][_0xd46e('0x1d')]);_0x3a1ced[_0xd46e('0x1c')]=qs[_0xd46e('0x1c')](_0x58aeef[_0xd46e('0x32')][_0xd46e('0x1c')]);}_0x3a1ced['order']=qs[_0xd46e('0x3a')](_0x58aeef[_0xd46e('0x32')]['sort']);_0x3a1ced[_0xd46e('0x3b')]=qs[_0xd46e('0x33')](_[_0xd46e('0x3c')](_0x58aeef[_0xd46e('0x32')],_0x2d1afe['filters']),_0x106edc);if(_0x58aeef[_0xd46e('0x32')][_0xd46e('0x3d')]){_0x3a1ced[_0xd46e('0x3b')]=_[_0xd46e('0x3e')](_0x3a1ced[_0xd46e('0x3b')],{'$or':_[_0xd46e('0x2a')](_0x106edc,function(_0x220c57){if(_0x220c57[_0xd46e('0x2e')]!=='VIRTUAL'){var _0x232e6f={};_0x232e6f[_0x220c57[_0xd46e('0x27')]]={'$like':'%'+_0x58aeef[_0xd46e('0x32')][_0xd46e('0x3d')]+'%'};return _0x232e6f;}})});}_0x3a1ced=_[_0xd46e('0x3e')]({},_0x3a1ced,_0x58aeef['options']);var _0x964c66={'where':_0x3a1ced['where']};return db['ScreenRecording']['count'](_0x964c66)['then'](function(_0x17c3d9){_0xa716ce['count']=_0x17c3d9;if(_0x58aeef[_0xd46e('0x32')][_0xd46e('0x3f')]){_0x3a1ced['include']=[{'all':!![]}];}return db[_0xd46e('0x2b')][_0xd46e('0x40')](_0x3a1ced);})[_0xd46e('0x25')](function(_0x31ba12){_0xa716ce[_0xd46e('0x41')]=_0x31ba12;return _0xa716ce;})[_0xd46e('0x25')](respondWithFilteredResult(_0x465d54,_0x3a1ced))[_0xd46e('0x42')](handleError(_0x465d54,null));};exports[_0xd46e('0x43')]=function(_0x3a98e4,_0xec367d){var _0x259e2={'raw':![],'where':{'id':_0x3a98e4['params']['id']}},_0x5ea048={};_0x5ea048['model']=_[_0xd46e('0x44')](db['ScreenRecording'][_0xd46e('0x2c')]);_0x5ea048[_0xd46e('0x32')]=_[_0xd46e('0x44')](_0x3a98e4[_0xd46e('0x32')]);_0x5ea048[_0xd46e('0x33')]=_[_0xd46e('0x34')](_0x5ea048[_0xd46e('0x30')],_0x5ea048[_0xd46e('0x32')]);_0x259e2['attributes']=_[_0xd46e('0x34')](_0x5ea048['model'],qs[_0xd46e('0x35')](_0x3a98e4[_0xd46e('0x32')][_0xd46e('0x35')]));_0x259e2[_0xd46e('0x36')]=_0x259e2[_0xd46e('0x36')]['length']?_0x259e2[_0xd46e('0x36')]:_0x5ea048[_0xd46e('0x30')];if(_0x3a98e4[_0xd46e('0x32')][_0xd46e('0x3f')]){_0x259e2[_0xd46e('0x45')]=[{'all':!![]}];}_0x259e2=_['merge']({},_0x259e2,_0x3a98e4[_0xd46e('0x46')]);return db[_0xd46e('0x2b')][_0xd46e('0x47')](_0x259e2)[_0xd46e('0x25')](handleEntityNotFound(_0xec367d,null))[_0xd46e('0x25')](respondWithResult(_0xec367d,null))['catch'](handleError(_0xec367d,null));};exports[_0xd46e('0x48')]=function(_0x3ea9e6,_0x45baf1){return db[_0xd46e('0x2b')][_0xd46e('0x48')](_0x3ea9e6[_0xd46e('0x49')],{})[_0xd46e('0x25')](respondWithResult(_0x45baf1,0xc9))[_0xd46e('0x42')](handleError(_0x45baf1,null));};exports['update']=function(_0xf9dab,_0x71a8dc){if(_0xf9dab[_0xd46e('0x49')]['id']){delete _0xf9dab[_0xd46e('0x49')]['id'];}delete _0xf9dab[_0xd46e('0x49')]['duration'];delete _0xf9dab['body'][_0xd46e('0x4a')];delete _0xf9dab[_0xd46e('0x49')][_0xd46e('0x4b')];delete _0xf9dab['body']['value'];return db[_0xd46e('0x2b')][_0xd46e('0x47')]({'where':{'id':_0xf9dab['params']['id']}})[_0xd46e('0x25')](handleEntityNotFound(_0x71a8dc,null))[_0xd46e('0x25')](saveUpdates(_0xf9dab[_0xd46e('0x49')],null))[_0xd46e('0x25')](respondWithResult(_0x71a8dc,null))[_0xd46e('0x42')](handleError(_0x71a8dc,null));};exports[_0xd46e('0x4c')]=function(_0x80ed51,_0x16ca0e){return db['ScreenRecording'][_0xd46e('0x4c')]()[_0xd46e('0x25')](respondWithResult(_0x16ca0e,null))[_0xd46e('0x42')](handleError(_0x16ca0e,null));};exports[_0xd46e('0x4d')]=function(_0x4ec295,_0x56dd9a,_0xced102){var _0x5a4a44=require(_0xd46e('0x4e'));var _0x2af20b=![];var _0x393cb9={};if(_0x4ec295[_0xd46e('0x32')][_0xd46e('0x2e')]&&_0x4ec295[_0xd46e('0x32')]['type']===_0xd46e('0x4f')){_0x393cb9[_0xd46e('0x4f')]=_0x4ec295[_0xd46e('0x50')]['id'];}else{_0x393cb9['id']=_0x4ec295['params']['id'];}return db[_0xd46e('0x2b')][_0xd46e('0x47')]({'where':_0x393cb9,'attributes':['id',_0xd46e('0x51')],'raw':!![]})[_0xd46e('0x25')](handleEntityNotFound(_0x56dd9a,null))[_0xd46e('0x25')](function(_0x2cc676){if(_0x2cc676){var _0x2760ef=path[_0xd46e('0x52')](config[_0xd46e('0x53')],_0xd46e('0x54'),_0x2cc676[_0xd46e('0x51')]);var _0x411b19=util[_0xd46e('0x31')](_0xd46e('0x55'),_0x2760ef);if(fs['existsSync'](_0x411b19)){_0x2af20b=!![];return _0x5a4a44[_0xd46e('0x56')](_0x411b19,_0x2760ef,config[_0xd46e('0x57')][_0xd46e('0x58')])[_0xd46e('0x25')](function(){return _0x2cc676;});}return _0x2cc676;}})['then'](function(_0x636f15){if(_0x636f15){var _0x36e18a=path[_0xd46e('0x52')](config[_0xd46e('0x53')],'server/files/screen_recordings',_0x636f15[_0xd46e('0x51')]);if(!fs[_0xd46e('0x59')](_0x36e18a)){throw new db['Sequelize']['ValidationError'](_0xd46e('0x5a'));}if(_0x636f15[_0xd46e('0x5b')]){return _0x56dd9a[_0xd46e('0x4d')](_0x36e18a,_0x636f15['filename']+path['extname'](_0x36e18a),function(){if(_0x2af20b){fs[_0xd46e('0x5c')](_0x36e18a);}});}else{return _0x56dd9a[_0xd46e('0x4d')](_0x36e18a,function(_0x1f310d){if(_0x2af20b){fs[_0xd46e('0x5c')](_0x36e18a);}});}}})[_0xd46e('0x42')](function(_0x2f9fcb){if(_0x2f9fcb[_0xd46e('0x5d')]===_0xd46e('0x5a')){_0x56dd9a[_0xd46e('0x1b')](0x194)[_0xd46e('0x28')](_0xd46e('0x5e'));}else{return handleError(_0x56dd9a,null);}});};exports[_0xd46e('0x5f')]=function(_0x272514,_0x329204){return db[_0xd46e('0x2b')][_0xd46e('0x47')]({'where':{'id':_0x272514['params']['id']}})[_0xd46e('0x25')](function(_0x1a3771){if(_[_0xd46e('0x60')](_0x1a3771)){throw new ReferenceError('Entity\x20not\x20found');}return _0x1a3771;})[_0xd46e('0x25')](function(_0x313c7e){var _0x4dec29=path[_0xd46e('0x52')](config[_0xd46e('0x53')],_0xd46e('0x54'),_0x313c7e['value']);logger[_0xd46e('0x61')](_0xd46e('0x62'),_0x4dec29);if(!_[_0xd46e('0x60')](_0x313c7e['value'])&&fs[_0xd46e('0x59')](_0x4dec29)){logger['info'](_0xd46e('0x63')+_0x4dec29+_0xd46e('0x64'));fs[_0xd46e('0x65')](_0x4dec29);}_0x4dec29=_0x4dec29+'.cypher';if(!_[_0xd46e('0x60')](_0x313c7e[_0xd46e('0x51')])&&fs[_0xd46e('0x59')](_0x4dec29)){logger[_0xd46e('0x61')](_0xd46e('0x63')+_0x4dec29+_0xd46e('0x64'));fs[_0xd46e('0x65')](_0x4dec29);}return _0x313c7e;})[_0xd46e('0x25')](function(_0x300ee9){if(!_0x300ee9)throw new InternalError();return _0x300ee9[_0xd46e('0x5f')]();})[_0xd46e('0x25')](function(){_0x329204[_0xd46e('0x1b')](0xcc)[_0xd46e('0x66')]();})[_0xd46e('0x42')](handleError(_0x329204,null));}; \ No newline at end of file +var _0x038b=['offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','error','name','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','rows','catch','params','find','create','body','duration','createdAt','closedAt','value','describe','../../components/encryptor','uniqueid','root','%s.cypher','decryptFile','secrets','recording','join','server/files/screen_recordings','existsSync','ValidationError','ScreenRecording\x20not\x20found','filename','download','unlink','message','send','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','lodash','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x1112af,_0x3f69df){var _0xb9c5=function(_0x248911){while(--_0x248911){_0x1112af['push'](_0x1112af['shift']());}};_0xb9c5(++_0x3f69df);}(_0x038b,0x114));var _0xb038=function(_0x3a6b9c,_0x45937e){_0x3a6b9c=_0x3a6b9c-0x0;var _0x37edb1=_0x038b[_0x3a6b9c];return _0x37edb1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb038('0x0'));var zipdir=require(_0xb038('0x1'));var jsonpatch=require(_0xb038('0x2'));var rp=require('request-promise');var moment=require(_0xb038('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb038('0x4'));var util=require(_0xb038('0x5'));var path=require('path');var sox=require(_0xb038('0x6'));var csv=require(_0xb038('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb038('0x8'));var squel=require(_0xb038('0x9'));var crypto=require(_0xb038('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb038('0x7'));var querystring=require(_0xb038('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb038('0xc'));var qs=require(_0xb038('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb038('0xe'));var logger=require(_0xb038('0xf'))(_0xb038('0x10'));var utils=require(_0xb038('0x11'));var config=require(_0xb038('0x12'));var licenseUtil=require(_0xb038('0x13'));var db=require(_0xb038('0x14'))['db'];function respondWithStatusCode(_0x439751,_0x16e4a3){_0x16e4a3=_0x16e4a3||0xcc;return function(_0x57acd8){if(_0x57acd8){return _0x439751[_0xb038('0x15')](_0x16e4a3);}return _0x439751[_0xb038('0x16')](_0x16e4a3)[_0xb038('0x17')]();};}function respondWithResult(_0x3cc717,_0x3a71a6){_0x3a71a6=_0x3a71a6||0xc8;return function(_0x13acc7){if(_0x13acc7){return _0x3cc717[_0xb038('0x16')](_0x3a71a6)['json'](_0x13acc7);}};}function respondWithFilteredResult(_0xe8aa7c,_0x26e4f2){return function(_0x183141){if(_0x183141){var _0x39323e=typeof _0x26e4f2[_0xb038('0x18')]===_0xb038('0x19')&&typeof _0x26e4f2['limit']===_0xb038('0x19');var _0x3039b0=_0x183141[_0xb038('0x1a')];var _0x3b095a=_0x39323e?0x0:_0x26e4f2['offset'];var _0x49b237=_0x39323e?_0x183141[_0xb038('0x1a')]:_0x26e4f2[_0xb038('0x18')]+_0x26e4f2[_0xb038('0x1b')];var _0x31c348;if(_0x49b237>=_0x3039b0){_0x49b237=_0x3039b0;_0x31c348=0xc8;}else{_0x31c348=0xce;}_0xe8aa7c['status'](_0x31c348);return _0xe8aa7c[_0xb038('0x1c')](_0xb038('0x1d'),_0x3b095a+'-'+_0x49b237+'/'+_0x3039b0)[_0xb038('0x1e')](_0x183141);}return null;};}function patchUpdates(_0x33a377){return function(_0xc6cd61){try{jsonpatch['apply'](_0xc6cd61,_0x33a377,!![]);}catch(_0x2e0369){return BPromise[_0xb038('0x1f')](_0x2e0369);}return _0xc6cd61[_0xb038('0x20')]();};}function saveUpdates(_0x87b899,_0x5f123d){return function(_0x2812c9){if(_0x2812c9){return _0x2812c9[_0xb038('0x21')](_0x87b899)['then'](function(_0x1eb9cd){return _0x1eb9cd;});}return null;};}function removeEntity(_0x43d403,_0x573f93){return function(_0x241329){if(_0x241329){return _0x241329['destroy']()[_0xb038('0x22')](function(){_0x43d403[_0xb038('0x16')](0xcc)[_0xb038('0x17')]();});}};}function handleEntityNotFound(_0x1df7c4,_0x5d4343){return function(_0xe4ceda){if(!_0xe4ceda){_0x1df7c4[_0xb038('0x15')](0x194);}return _0xe4ceda;};}function handleError(_0x576be5,_0xb6d93f){_0xb6d93f=_0xb6d93f||0x1f4;return function(_0x33cf3c){logger[_0xb038('0x23')](_0x33cf3c['stack']);if(_0x33cf3c[_0xb038('0x24')]){delete _0x33cf3c[_0xb038('0x24')];}_0x576be5[_0xb038('0x16')](_0xb6d93f)['send'](_0x33cf3c);};}exports[_0xb038('0x25')]=function(_0x2855a6,_0x28a6a9){var _0x12b3b6={},_0xc387d={},_0x551b55={'count':0x0,'rows':[]};var _0x1783d4=_[_0xb038('0x26')](db[_0xb038('0x27')][_0xb038('0x28')],function(_0x1abe23){return{'name':_0x1abe23[_0xb038('0x29')],'type':_0x1abe23[_0xb038('0x2a')][_0xb038('0x2b')]};});_0xc387d[_0xb038('0x2c')]=_[_0xb038('0x2d')](_[_0xb038('0x26')](_0x1783d4,_0xb038('0x24')),[_0xb038('0x2e')]);_0xc387d['query']=_[_0xb038('0x2f')](_0x2855a6['query']);_0xc387d[_0xb038('0x30')]=_[_0xb038('0x31')](_0xc387d[_0xb038('0x2c')],_0xc387d[_0xb038('0x32')]);_0x12b3b6[_0xb038('0x33')]=_[_0xb038('0x31')](_0xc387d[_0xb038('0x2c')],qs[_0xb038('0x34')](_0x2855a6[_0xb038('0x32')][_0xb038('0x34')]));_0x12b3b6['attributes']=_0x12b3b6[_0xb038('0x33')][_0xb038('0x35')]?_0x12b3b6[_0xb038('0x33')]:_0xc387d['model'];if(!_0x2855a6['query']['hasOwnProperty'](_0xb038('0x36'))){_0x12b3b6[_0xb038('0x1b')]=qs[_0xb038('0x1b')](_0x2855a6[_0xb038('0x32')][_0xb038('0x1b')]);_0x12b3b6[_0xb038('0x18')]=qs['offset'](_0x2855a6[_0xb038('0x32')][_0xb038('0x18')]);}_0x12b3b6[_0xb038('0x37')]=qs[_0xb038('0x38')](_0x2855a6['query'][_0xb038('0x38')]);_0x12b3b6[_0xb038('0x39')]=qs['filters'](_['pick'](_0x2855a6[_0xb038('0x32')],_0xc387d[_0xb038('0x30')]),_0x1783d4);if(_0x2855a6[_0xb038('0x32')][_0xb038('0x3a')]){_0x12b3b6[_0xb038('0x39')]=_['merge'](_0x12b3b6[_0xb038('0x39')],{'$or':_[_0xb038('0x26')](_0x1783d4,function(_0x26d48c){if(_0x26d48c[_0xb038('0x2a')]!=='VIRTUAL'){var _0x793da9={};_0x793da9[_0x26d48c[_0xb038('0x24')]]={'$like':'%'+_0x2855a6[_0xb038('0x32')]['filter']+'%'};return _0x793da9;}})});}_0x12b3b6=_[_0xb038('0x3b')]({},_0x12b3b6,_0x2855a6['options']);var _0x36f281={'where':_0x12b3b6[_0xb038('0x39')]};return db[_0xb038('0x27')]['count'](_0x36f281)[_0xb038('0x22')](function(_0x357c78){_0x551b55[_0xb038('0x1a')]=_0x357c78;if(_0x2855a6['query'][_0xb038('0x3c')]){_0x12b3b6[_0xb038('0x3d')]=[{'all':!![]}];}return db[_0xb038('0x27')][_0xb038('0x3e')](_0x12b3b6);})['then'](function(_0x28b922){_0x551b55[_0xb038('0x3f')]=_0x28b922;return _0x551b55;})[_0xb038('0x22')](respondWithFilteredResult(_0x28a6a9,_0x12b3b6))[_0xb038('0x40')](handleError(_0x28a6a9,null));};exports['show']=function(_0x19dc7b,_0x269c7d){var _0x57816c={'raw':![],'where':{'id':_0x19dc7b[_0xb038('0x41')]['id']}},_0x207fb5={};_0x207fb5[_0xb038('0x2c')]=_['keys'](db[_0xb038('0x27')][_0xb038('0x28')]);_0x207fb5['query']=_['keys'](_0x19dc7b[_0xb038('0x32')]);_0x207fb5[_0xb038('0x30')]=_[_0xb038('0x31')](_0x207fb5[_0xb038('0x2c')],_0x207fb5[_0xb038('0x32')]);_0x57816c[_0xb038('0x33')]=_[_0xb038('0x31')](_0x207fb5[_0xb038('0x2c')],qs['fields'](_0x19dc7b['query']['fields']));_0x57816c[_0xb038('0x33')]=_0x57816c[_0xb038('0x33')]['length']?_0x57816c[_0xb038('0x33')]:_0x207fb5[_0xb038('0x2c')];if(_0x19dc7b[_0xb038('0x32')]['includeAll']){_0x57816c[_0xb038('0x3d')]=[{'all':!![]}];}_0x57816c=_['merge']({},_0x57816c,_0x19dc7b['options']);return db[_0xb038('0x27')][_0xb038('0x42')](_0x57816c)[_0xb038('0x22')](handleEntityNotFound(_0x269c7d,null))[_0xb038('0x22')](respondWithResult(_0x269c7d,null))[_0xb038('0x40')](handleError(_0x269c7d,null));};exports[_0xb038('0x43')]=function(_0x2f053a,_0x473aae){return db[_0xb038('0x27')][_0xb038('0x43')](_0x2f053a['body'],{})[_0xb038('0x22')](respondWithResult(_0x473aae,0xc9))[_0xb038('0x40')](handleError(_0x473aae,null));};exports['update']=function(_0x906c9c,_0x19ab72){if(_0x906c9c['body']['id']){delete _0x906c9c[_0xb038('0x44')]['id'];}delete _0x906c9c[_0xb038('0x44')][_0xb038('0x45')];delete _0x906c9c[_0xb038('0x44')][_0xb038('0x46')];delete _0x906c9c[_0xb038('0x44')][_0xb038('0x47')];delete _0x906c9c[_0xb038('0x44')][_0xb038('0x48')];return db['ScreenRecording'][_0xb038('0x42')]({'where':{'id':_0x906c9c[_0xb038('0x41')]['id']}})[_0xb038('0x22')](handleEntityNotFound(_0x19ab72,null))[_0xb038('0x22')](saveUpdates(_0x906c9c[_0xb038('0x44')],null))[_0xb038('0x22')](respondWithResult(_0x19ab72,null))['catch'](handleError(_0x19ab72,null));};exports[_0xb038('0x49')]=function(_0x2f3622,_0x2b2b4d){return db[_0xb038('0x27')][_0xb038('0x49')]()[_0xb038('0x22')](respondWithResult(_0x2b2b4d,null))[_0xb038('0x40')](handleError(_0x2b2b4d,null));};exports['download']=function(_0x3abe7a,_0x5c4a79,_0x77f211){var _0x1ea8ad=require(_0xb038('0x4a'));var _0x998fe3=![];var _0x1518c4={};if(_0x3abe7a['query']['type']&&_0x3abe7a['query'][_0xb038('0x2a')]===_0xb038('0x4b')){_0x1518c4[_0xb038('0x4b')]=_0x3abe7a[_0xb038('0x41')]['id'];}else{_0x1518c4['id']=_0x3abe7a[_0xb038('0x41')]['id'];}return db[_0xb038('0x27')]['find']({'where':_0x1518c4,'attributes':['id',_0xb038('0x48')],'raw':!![]})[_0xb038('0x22')](handleEntityNotFound(_0x5c4a79,null))['then'](function(_0x5b27d3){if(_0x5b27d3){var _0xf2907b=path['join'](config[_0xb038('0x4c')],'server/files/screen_recordings',_0x5b27d3[_0xb038('0x48')]);var _0x4677b8=util[_0xb038('0x2e')](_0xb038('0x4d'),_0xf2907b);if(fs['existsSync'](_0x4677b8)){_0x998fe3=!![];return _0x1ea8ad[_0xb038('0x4e')](_0x4677b8,_0xf2907b,config[_0xb038('0x4f')][_0xb038('0x50')])[_0xb038('0x22')](function(){return _0x5b27d3;});}return _0x5b27d3;}})[_0xb038('0x22')](function(_0x1246c8){if(_0x1246c8){var _0x14a553=path[_0xb038('0x51')](config[_0xb038('0x4c')],_0xb038('0x52'),_0x1246c8[_0xb038('0x48')]);if(!fs[_0xb038('0x53')](_0x14a553)){throw new db['Sequelize'][(_0xb038('0x54'))](_0xb038('0x55'));}if(_0x1246c8[_0xb038('0x56')]){return _0x5c4a79[_0xb038('0x57')](_0x14a553,_0x1246c8[_0xb038('0x56')]+path['extname'](_0x14a553),function(){if(_0x998fe3){fs[_0xb038('0x58')](_0x14a553);}});}else{return _0x5c4a79['download'](_0x14a553,function(_0xfb3ce6){if(_0x998fe3){fs[_0xb038('0x58')](_0x14a553);}});}}})['catch'](function(_0x15d61c){if(_0x15d61c[_0xb038('0x59')]===_0xb038('0x55')){_0x5c4a79[_0xb038('0x16')](0x194)[_0xb038('0x5a')](_0xb038('0x5b'));}else{return handleError(_0x5c4a79,null);}});};exports[_0xb038('0x5c')]=function(_0xe275b8,_0x769f1e){return db[_0xb038('0x27')]['find']({'where':{'id':_0xe275b8[_0xb038('0x41')]['id']}})['then'](function(_0x189894){if(_[_0xb038('0x5d')](_0x189894)){throw new ReferenceError(_0xb038('0x5e'));}return _0x189894;})[_0xb038('0x22')](function(_0x1f5f3f){var _0x23fb92=path[_0xb038('0x51')](config['root'],'server/files/screen_recordings',_0x1f5f3f[_0xb038('0x48')]);logger[_0xb038('0x5f')](_0xb038('0x60'),_0x23fb92);if(!_['isNil'](_0x1f5f3f['value'])&&fs[_0xb038('0x53')](_0x23fb92)){logger['info'](_0xb038('0x61')+_0x23fb92+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xb038('0x62')](_0x23fb92);}_0x23fb92=_0x23fb92+'.cypher';if(!_[_0xb038('0x5d')](_0x1f5f3f[_0xb038('0x48')])&&fs[_0xb038('0x53')](_0x23fb92)){logger[_0xb038('0x5f')](_0xb038('0x61')+_0x23fb92+_0xb038('0x63'));fs['unlinkSync'](_0x23fb92);}return _0x1f5f3f;})['then'](function(_0x45e628){if(!_0x45e628)throw new InternalError();return _0x45e628['destroy']();})[_0xb038('0x22')](function(){_0x769f1e[_0xb038('0x16')](0xcc)[_0xb038('0x17')]();})['catch'](handleError(_0x769f1e,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 01bacec..05e78c0 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 _0x35ea=['bluebird','path','rimraf','../../config/environment','./screenRecording.attributes','define','ScreenRecording','interactionid','lodash','util','../../config/logger'];(function(_0x5dc416,_0x4ea45f){var _0x158702=function(_0x417f78){while(--_0x417f78){_0x5dc416['push'](_0x5dc416['shift']());}};_0x158702(++_0x4ea45f);}(_0x35ea,0x131));var _0xa35e=function(_0x1275e8,_0x40ab85){_0x1275e8=_0x1275e8-0x0;var _0x2bfdbd=_0x35ea[_0x1275e8];return _0x2bfdbd;};'use strict';var _=require(_0xa35e('0x0'));var util=require(_0xa35e('0x1'));var logger=require(_0xa35e('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa35e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa35e('0x4'));var rimraf=require(_0xa35e('0x5'));var config=require(_0xa35e('0x6'));var attributes=require(_0xa35e('0x7'));module['exports']=function(_0x506716,_0x46e12a){return _0x506716[_0xa35e('0x8')](_0xa35e('0x9'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xa35e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfcf9=['define','interactionid','lodash','util','../../config/logger','bluebird','path','../../config/environment','exports'];(function(_0x1a4763,_0x2695b5){var _0x5242e3=function(_0xa25c00){while(--_0xa25c00){_0x1a4763['push'](_0x1a4763['shift']());}};_0x5242e3(++_0x2695b5);}(_0xfcf9,0x1a9));var _0x9fcf=function(_0x5c6f8e,_0x451868){_0x5c6f8e=_0x5c6f8e-0x0;var _0x249f1b=_0xfcf9[_0x5c6f8e];return _0x249f1b;};'use strict';var _=require(_0x9fcf('0x0'));var util=require(_0x9fcf('0x1'));var logger=require(_0x9fcf('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9fcf('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9fcf('0x4'));var rimraf=require('rimraf');var config=require(_0x9fcf('0x5'));var attributes=require('./screenRecording.attributes');module[_0x9fcf('0x6')]=function(_0x3f6e38,_0x102070){return _0x3f6e38[_0x9fcf('0x7')]('ScreenRecording',attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x9fcf('0x8'),'fields':[_0x9fcf('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 707ea1f..0cd2363 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 _0x1c31=['ScreenRecording,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x26574c,_0x839654){var _0xa3bfe8=function(_0x52e15e){while(--_0x52e15e){_0x26574c['push'](_0x26574c['shift']());}};_0xa3bfe8(++_0x839654);}(_0x1c31,0x116));var _0x11c3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1c31[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x11c3('0x0'));var util=require(_0x11c3('0x1'));var moment=require(_0x11c3('0x2'));var BPromise=require('bluebird');var rs=require(_0x11c3('0x3'));var fs=require('fs');var Redis=require(_0x11c3('0x4'));var db=require(_0x11c3('0x5'))['db'];var utils=require(_0x11c3('0x6'));var logger=require(_0x11c3('0x7'))(_0x11c3('0x8'));var config=require(_0x11c3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x11c3('0xa')][_0x11c3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd00b33,_0x3623f3,_0x37896d){return new BPromise(function(_0x55581c,_0x42ca5e){return client[_0x11c3('0xc')](_0xd00b33,_0x37896d)[_0x11c3('0xd')](function(_0x3b998a){logger[_0x11c3('0xe')]('ScreenRecording,\x20%s,\x20%s',_0x3623f3,_0x11c3('0xf'));logger[_0x11c3('0x10')](_0x11c3('0x11'),_0x3623f3,_0x11c3('0xf'),JSON[_0x11c3('0x12')](_0x3b998a));if(_0x3b998a[_0x11c3('0x13')]){if(_0x3b998a[_0x11c3('0x13')][_0x11c3('0x14')]===0x1f4){logger[_0x11c3('0x13')]('ScreenRecording,\x20%s,\x20%s',_0x3623f3,_0x3b998a[_0x11c3('0x13')][_0x11c3('0x15')]);return _0x42ca5e(_0x3b998a[_0x11c3('0x13')][_0x11c3('0x15')]);}logger[_0x11c3('0x13')]('ScreenRecording,\x20%s,\x20%s',_0x3623f3,_0x3b998a[_0x11c3('0x13')][_0x11c3('0x15')]);return _0x55581c(_0x3b998a[_0x11c3('0x13')]['message']);}else{logger[_0x11c3('0xe')](_0x11c3('0x16'),_0x3623f3,_0x11c3('0xf'));_0x55581c(_0x3b998a[_0x11c3('0x17')][_0x11c3('0x15')]);}})[_0x11c3('0x18')](function(_0x1c0635){logger[_0x11c3('0x13')](_0x11c3('0x16'),_0x3623f3,_0x1c0635);_0x42ca5e(_0x1c0635);});});} \ No newline at end of file +var _0x9b3f=['client','http','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x528b92,_0x2a3971){var _0x171eba=function(_0x28e199){while(--_0x28e199){_0x528b92['push'](_0x528b92['shift']());}};_0x171eba(++_0x2a3971);}(_0x9b3f,0x13b));var _0xf9b3=function(_0x4f82b0,_0x52dc80){_0x4f82b0=_0x4f82b0-0x0;var _0x316a28=_0x9b3f[_0x4f82b0];return _0x316a28;};'use strict';var _=require(_0xf9b3('0x0'));var util=require(_0xf9b3('0x1'));var moment=require('moment');var BPromise=require(_0xf9b3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf9b3('0x3'));var db=require(_0xf9b3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf9b3('0x5'))(_0xf9b3('0x6'));var config=require('../../config/environment');var jayson=require(_0xf9b3('0x7'));var client=jayson[_0xf9b3('0x8')][_0xf9b3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32908d,_0x1a2f93,_0xe4addb){return new BPromise(function(_0x4310f2,_0x4e4c40){return client['request'](_0x32908d,_0xe4addb)[_0xf9b3('0xa')](function(_0x16e1f6){logger[_0xf9b3('0xb')](_0xf9b3('0xc'),_0x1a2f93,_0xf9b3('0xd'));logger['debug'](_0xf9b3('0xe'),_0x1a2f93,_0xf9b3('0xd'),JSON[_0xf9b3('0xf')](_0x16e1f6));if(_0x16e1f6[_0xf9b3('0x10')]){if(_0x16e1f6[_0xf9b3('0x10')]['code']===0x1f4){logger[_0xf9b3('0x10')](_0xf9b3('0xc'),_0x1a2f93,_0x16e1f6[_0xf9b3('0x10')][_0xf9b3('0x11')]);return _0x4e4c40(_0x16e1f6[_0xf9b3('0x10')]['message']);}logger['error'](_0xf9b3('0xc'),_0x1a2f93,_0x16e1f6[_0xf9b3('0x10')][_0xf9b3('0x11')]);return _0x4310f2(_0x16e1f6[_0xf9b3('0x10')][_0xf9b3('0x11')]);}else{logger[_0xf9b3('0xb')](_0xf9b3('0xc'),_0x1a2f93,_0xf9b3('0xd'));_0x4310f2(_0x16e1f6['result'][_0xf9b3('0x11')]);}})[_0xf9b3('0x12')](function(_0x468561){logger[_0xf9b3('0x10')]('ScreenRecording,\x20%s,\x20%s',_0x1a2f93,_0x468561);_0x4e4c40(_0x468561);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 6338a55..bffab47 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 _0xf590=['server/files/images/logos/','preferred','extname','addPreferred','favicon','addFavicon','put','isAuthenticated','update','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','index','/now','/:id','/:id/logo','getLogo','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','join','root','%s%s','logo','originalname','post','single','addLogo','diskStorage','format','logologin','/:id/logo_login','file'];(function(_0xc956f0,_0x4ecd7a){var _0x32106f=function(_0x55059c){while(--_0x55059c){_0xc956f0['push'](_0xc956f0['shift']());}};_0x32106f(++_0x4ecd7a);}(_0xf590,0x1e2));var _0x0f59=function(_0x1dc78e,_0x3eb207){_0x1dc78e=_0x1dc78e-0x0;var _0x26b975=_0xf590[_0x1dc78e];return _0x26b975;};'use strict';var multer=require(_0x0f59('0x0'));var util=require('util');var path=require(_0x0f59('0x1'));var timeout=require('connect-timeout');var express=require(_0x0f59('0x2'));var router=express[_0x0f59('0x3')]();var fs_extra=require(_0x0f59('0x4'));var auth=require(_0x0f59('0x5'));var interaction=require(_0x0f59('0x6'));var config=require(_0x0f59('0x7'));var controller=require(_0x0f59('0x8'));router[_0x0f59('0x9')]('/',auth['isAuthenticated'](),controller[_0x0f59('0xa')]);router[_0x0f59('0x9')](_0x0f59('0xb'),controller['getDate']);router[_0x0f59('0x9')](_0x0f59('0xc'),controller['show']);router[_0x0f59('0x9')](_0x0f59('0xd'),controller[_0x0f59('0xe')]);router[_0x0f59('0x9')]('/:id/logo_login',controller[_0x0f59('0xf')]);router[_0x0f59('0x9')](_0x0f59('0x10'),controller['gdpr']);router['get'](_0x0f59('0x11'),controller[_0x0f59('0x12')]);router[_0x0f59('0x9')](_0x0f59('0x13'),controller[_0x0f59('0x14')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4c1f86,_0x5e1a21,_0xea1c99){_0xea1c99(null,path[_0x0f59('0x15')](config[_0x0f59('0x16')],'server/files/images/logos/'));},'filename':function(_0x2b8f42,_0x4bad2c,_0x1b144e){_0x1b144e(null,util['format'](_0x0f59('0x17'),_0x0f59('0x18'),path['extname'](_0x4bad2c[_0x0f59('0x19')])));}})});router[_0x0f59('0x1a')](_0x0f59('0xd'),upload[_0x0f59('0x1b')]('file'),controller[_0x0f59('0x1c')]);var upload=multer({'storage':multer[_0x0f59('0x1d')]({'destination':function(_0x3fe737,_0x4eab06,_0x572bcb){_0x572bcb(null,path[_0x0f59('0x15')](config[_0x0f59('0x16')],'server/files/images/logos/'));},'filename':function(_0x5910ef,_0x442a26,_0x231af6){_0x231af6(null,util[_0x0f59('0x1e')](_0x0f59('0x17'),_0x0f59('0x1f'),path['extname'](_0x442a26['originalname'])));}})});router['post'](_0x0f59('0x20'),upload['single'](_0x0f59('0x21')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x0f59('0x1d')]({'destination':function(_0x343597,_0x55db9f,_0x3754a3){_0x3754a3(null,path['join'](config[_0x0f59('0x16')],_0x0f59('0x22')));},'filename':function(_0xfc2ca9,_0x2ebc1d,_0x93d02b){_0x93d02b(null,util[_0x0f59('0x1e')](_0x0f59('0x17'),_0x0f59('0x23'),path[_0x0f59('0x24')](_0x2ebc1d[_0x0f59('0x19')])));}})});router['post']('/:id/preferred',upload[_0x0f59('0x1b')]('file'),controller[_0x0f59('0x25')]);var upload=multer({'storage':multer[_0x0f59('0x1d')]({'destination':function(_0x92a83f,_0x5e5dcc,_0x9368b9){_0x9368b9(null,path[_0x0f59('0x15')](config[_0x0f59('0x16')],'server/files/images/logos/'));},'filename':function(_0x22e264,_0x43677b,_0x58123d){_0x58123d(null,util[_0x0f59('0x1e')](_0x0f59('0x17'),_0x0f59('0x26'),path[_0x0f59('0x24')](_0x43677b[_0x0f59('0x19')])));}})});router[_0x0f59('0x1a')](_0x0f59('0x13'),upload[_0x0f59('0x1b')]('file'),controller[_0x0f59('0x27')]);router[_0x0f59('0x28')](_0x0f59('0xc'),auth[_0x0f59('0x29')](),controller[_0x0f59('0x2a')]);module['exports']=router; \ No newline at end of file +var _0x7982=['addLogo','extname','addLogoLogin','file','addPreferred','favicon','addFavicon','put','update','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','isAuthenticated','index','get','/:id','show','/:id/logo','/:id/logo_login','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','originalname','post','single'];(function(_0x45226b,_0x1c6979){var _0x544197=function(_0x29c99e){while(--_0x29c99e){_0x45226b['push'](_0x45226b['shift']());}};_0x544197(++_0x1c6979);}(_0x7982,0x152));var _0x2798=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x7982[_0x422905];return _0x33dc6c;};'use strict';var multer=require('multer');var util=require(_0x2798('0x0'));var path=require(_0x2798('0x1'));var timeout=require(_0x2798('0x2'));var express=require(_0x2798('0x3'));var router=express['Router']();var fs_extra=require(_0x2798('0x4'));var auth=require(_0x2798('0x5'));var interaction=require(_0x2798('0x6'));var config=require(_0x2798('0x7'));var controller=require(_0x2798('0x8'));router['get']('/',auth[_0x2798('0x9')](),controller[_0x2798('0xa')]);router[_0x2798('0xb')]('/now',controller['getDate']);router[_0x2798('0xb')](_0x2798('0xc'),controller[_0x2798('0xd')]);router['get'](_0x2798('0xe'),controller['getLogo']);router[_0x2798('0xb')](_0x2798('0xf'),controller['getLogoLogin']);router[_0x2798('0xb')]('/:id/gdpr',controller[_0x2798('0x10')]);router[_0x2798('0xb')](_0x2798('0x11'),controller[_0x2798('0x12')]);router[_0x2798('0xb')](_0x2798('0x13'),controller[_0x2798('0x14')]);var upload=multer({'storage':multer[_0x2798('0x15')]({'destination':function(_0x1539c5,_0x3d9ccd,_0x5d8edc){_0x5d8edc(null,path[_0x2798('0x16')](config[_0x2798('0x17')],_0x2798('0x18')));},'filename':function(_0x1e9173,_0x17dae8,_0xadcf1){_0xadcf1(null,util[_0x2798('0x19')](_0x2798('0x1a'),_0x2798('0x1b'),path['extname'](_0x17dae8[_0x2798('0x1c')])));}})});router[_0x2798('0x1d')](_0x2798('0xe'),upload[_0x2798('0x1e')]('file'),controller[_0x2798('0x1f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2191ed,_0x566f0a,_0x4b5635){_0x4b5635(null,path[_0x2798('0x16')](config[_0x2798('0x17')],'server/files/images/logos/'));},'filename':function(_0x105c43,_0x2add25,_0x48462b){_0x48462b(null,util[_0x2798('0x19')](_0x2798('0x1a'),'logologin',path[_0x2798('0x20')](_0x2add25[_0x2798('0x1c')])));}})});router[_0x2798('0x1d')](_0x2798('0xf'),upload[_0x2798('0x1e')]('file'),controller[_0x2798('0x21')]);var upload=multer({'storage':multer[_0x2798('0x15')]({'destination':function(_0x4a9d62,_0x3e4bfe,_0x156a3e){_0x156a3e(null,path[_0x2798('0x16')](config[_0x2798('0x17')],'server/files/images/logos/'));},'filename':function(_0x2afc70,_0x4de4a1,_0x1e41f1){_0x1e41f1(null,util[_0x2798('0x19')](_0x2798('0x1a'),'preferred',path[_0x2798('0x20')](_0x4de4a1['originalname'])));}})});router['post'](_0x2798('0x11'),upload['single'](_0x2798('0x22')),controller[_0x2798('0x23')]);var upload=multer({'storage':multer[_0x2798('0x15')]({'destination':function(_0x181e7e,_0x37e0e9,_0x55e907){_0x55e907(null,path[_0x2798('0x16')](config[_0x2798('0x17')],_0x2798('0x18')));},'filename':function(_0x113b23,_0x3e6d30,_0x5a3a07){_0x5a3a07(null,util['format'](_0x2798('0x1a'),_0x2798('0x24'),path[_0x2798('0x20')](_0x3e6d30[_0x2798('0x1c')])));}})});router[_0x2798('0x1d')](_0x2798('0x13'),upload[_0x2798('0x1e')](_0x2798('0x22')),controller[_0x2798('0x25')]);router[_0x2798('0x26')](_0x2798('0xc'),auth[_0x2798('0x9')](),controller[_0x2798('0x27')]);module[_0x2798('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 03bd61a..042e1ee 100644 --- a/server/api/setting/setting.attributes.js +++ b/server/api/setting/setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x419d88,_0x3a03da){var _0x3dbbaf=function(_0x5a77d9){while(--_0x5a77d9){_0x419d88['push'](_0x419d88['shift']());}};_0x3dbbaf(++_0x3a03da);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x3347d3,_0x5800a9){var _0x40eda6=function(_0x4287c5){while(--_0x4287c5){_0x3347d3['push'](_0x3347d3['shift']());}};_0x40eda6(++_0x5800a9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 9498e34..54043ee 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 _0x8507=['send','map','Setting','fieldName','type','key','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','filters','pick','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','length','find','body','addLogo','file','logo','addLogoLogin','loginLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultPreferred','defaultFavicon','join','root','toLower','default_logo.svg','default','upperFirst','\x20not\x20found','download','../../config/license/util','defaultLoginLogo','default_loginLogo.svg','existsSync','Sequelize','ValidationError','gdpr','securePassword','addPreferred','filename','getPreferred','default_preferred.png','custom','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/environment','jayson/promise','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','stack','name'];(function(_0x39dd4b,_0xfc41fe){var _0x4c6a7d=function(_0x1584b3){while(--_0x1584b3){_0x39dd4b['push'](_0x39dd4b['shift']());}};_0x4c6a7d(++_0xfc41fe);}(_0x8507,0xc0));var _0x7850=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8507[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x7850('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7850('0x1'));var jsonpatch=require(_0x7850('0x2'));var rp=require(_0x7850('0x3'));var moment=require(_0x7850('0x4'));var BPromise=require(_0x7850('0x5'));var Mustache=require(_0x7850('0x6'));var util=require(_0x7850('0x7'));var path=require(_0x7850('0x8'));var sox=require(_0x7850('0x9'));var csv=require(_0x7850('0xa'));var ejs=require(_0x7850('0xb'));var fs=require('fs');var fs_extra=require(_0x7850('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7850('0xd'));var jsforce=require(_0x7850('0xe'));var deskjs=require(_0x7850('0xf'));var toCsv=require(_0x7850('0xa'));var querystring=require(_0x7850('0x10'));var Papa=require(_0x7850('0x11'));var Redis=require(_0x7850('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7850('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7850('0x14'));var utils=require('../../config/utils');var config=require(_0x7850('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x7850('0x16'));var client=jayson['client'][_0x7850('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x5090a0,_0x44bddd,_0x2b38be,_0x6ca139){return new BPromise(function(_0x440194,_0x5b0aff){var _0x4e5d84=_0x6ca139||client;return _0x4e5d84[_0x7850('0x18')](_0x5090a0,_0x2b38be)['then'](function(_0x123691){logger[_0x7850('0x19')](_0x7850('0x1a'),_0x44bddd,_0x7850('0x1b'));logger['debug'](_0x7850('0x1c'),_0x44bddd,_0x7850('0x1b'),JSON[_0x7850('0x1d')](_0x123691));if(_0x123691[_0x7850('0x1e')]){if(_0x123691['error'][_0x7850('0x1f')]===0x1f4){logger[_0x7850('0x1e')](_0x7850('0x1a'),_0x44bddd,_0x123691[_0x7850('0x1e')][_0x7850('0x20')]);return _0x5b0aff(_0x123691[_0x7850('0x1e')][_0x7850('0x20')]);}logger[_0x7850('0x1e')]('Setting,\x20%s,\x20%s',_0x44bddd,_0x123691[_0x7850('0x1e')]['message']);return _0x440194(_0x123691[_0x7850('0x1e')][_0x7850('0x20')]);}else{logger[_0x7850('0x19')](_0x7850('0x1a'),_0x44bddd,'request\x20sent');_0x440194(_0x123691[_0x7850('0x21')][_0x7850('0x20')]);}})[_0x7850('0x22')](function(_0xcb3c72){logger['error'](_0x7850('0x1a'),_0x44bddd,_0xcb3c72);_0x5b0aff(_0xcb3c72);});});}function respondWithStatusCode(_0x27bfcd,_0x4521fe){_0x4521fe=_0x4521fe||0xcc;return function(_0x4e340f){if(_0x4e340f){return _0x27bfcd[_0x7850('0x23')](_0x4521fe);}return _0x27bfcd[_0x7850('0x24')](_0x4521fe)[_0x7850('0x25')]();};}function respondWithResult(_0x5b2089,_0xd302f6){_0xd302f6=_0xd302f6||0xc8;return function(_0x36758e){if(_0x36758e){return _0x5b2089[_0x7850('0x24')](_0xd302f6)['json'](_0x36758e);}};}function respondWithFilteredResult(_0x5335b0,_0x53c03d){return function(_0x6bbd60){if(_0x6bbd60){var _0x4d165c=typeof _0x53c03d['offset']===_0x7850('0x26')&&typeof _0x53c03d[_0x7850('0x27')]===_0x7850('0x26');var _0x40bc6c=_0x6bbd60[_0x7850('0x28')];var _0x4e90c6=_0x4d165c?0x0:_0x53c03d[_0x7850('0x29')];var _0x139e9a=_0x4d165c?_0x6bbd60[_0x7850('0x28')]:_0x53c03d['offset']+_0x53c03d[_0x7850('0x27')];var _0x25ee3b;if(_0x139e9a>=_0x40bc6c){_0x139e9a=_0x40bc6c;_0x25ee3b=0xc8;}else{_0x25ee3b=0xce;}_0x5335b0[_0x7850('0x24')](_0x25ee3b);return _0x5335b0['set'](_0x7850('0x2a'),_0x4e90c6+'-'+_0x139e9a+'/'+_0x40bc6c)[_0x7850('0x2b')](_0x6bbd60);}return null;};}function patchUpdates(_0x480247){return function(_0x1682a4){try{jsonpatch[_0x7850('0x2c')](_0x1682a4,_0x480247,!![]);}catch(_0x50a61e){return BPromise[_0x7850('0x2d')](_0x50a61e);}return _0x1682a4[_0x7850('0x2e')]();};}function saveUpdates(_0x35ebeb,_0x522982){return function(_0x55d57b){if(_0x55d57b){return _0x55d57b[_0x7850('0x2f')](_0x35ebeb)[_0x7850('0x30')](function(_0x400a01){return _0x400a01;});}return null;};}function removeEntity(_0x25897d,_0x5a28a8){return function(_0x1a4650){if(_0x1a4650){return _0x1a4650[_0x7850('0x31')]()['then'](function(){_0x25897d[_0x7850('0x24')](0xcc)[_0x7850('0x25')]();});}};}function handleEntityNotFound(_0x125a41,_0x4aa6e0){return function(_0x44cf54){if(!_0x44cf54){_0x125a41['sendStatus'](0x194);}return _0x44cf54;};}function handleError(_0x420043,_0x3a17dd){_0x3a17dd=_0x3a17dd||0x1f4;return function(_0x4679b7){logger['error'](_0x4679b7[_0x7850('0x32')]);if(_0x4679b7[_0x7850('0x33')]){delete _0x4679b7[_0x7850('0x33')];}_0x420043['status'](_0x3a17dd)[_0x7850('0x34')](_0x4679b7);};}exports['index']=function(_0x2451f0,_0x136bde){var _0x4282b0={},_0x6b0705={},_0xa5983={'count':0x0,'rows':[]};var _0x3b31dd=_[_0x7850('0x35')](db[_0x7850('0x36')]['rawAttributes'],function(_0x20b201){return{'name':_0x20b201[_0x7850('0x37')],'type':_0x20b201[_0x7850('0x38')][_0x7850('0x39')]};});_0x6b0705[_0x7850('0x3a')]=_[_0x7850('0x35')](_0x3b31dd,_0x7850('0x33'));_0x6b0705['query']=_[_0x7850('0x3b')](_0x2451f0[_0x7850('0x3c')]);_0x6b0705['filters']=_[_0x7850('0x3d')](_0x6b0705[_0x7850('0x3a')],_0x6b0705[_0x7850('0x3c')]);_0x4282b0['attributes']=_[_0x7850('0x3d')](_0x6b0705['model'],qs['fields'](_0x2451f0['query'][_0x7850('0x3e')]));_0x4282b0[_0x7850('0x3f')]=_0x4282b0[_0x7850('0x3f')]['length']?_0x4282b0[_0x7850('0x3f')]:_0x6b0705['model'];if(!_0x2451f0[_0x7850('0x3c')][_0x7850('0x40')](_0x7850('0x41'))){_0x4282b0[_0x7850('0x27')]=qs[_0x7850('0x27')](_0x2451f0[_0x7850('0x3c')][_0x7850('0x27')]);_0x4282b0[_0x7850('0x29')]=qs['offset'](_0x2451f0[_0x7850('0x3c')]['offset']);}_0x4282b0[_0x7850('0x42')]=qs['sort'](_0x2451f0[_0x7850('0x3c')]['sort']);_0x4282b0[_0x7850('0x43')]=qs[_0x7850('0x44')](_[_0x7850('0x45')](_0x2451f0['query'],_0x6b0705['filters']),_0x3b31dd);if(_0x2451f0[_0x7850('0x3c')][_0x7850('0x46')]){_0x4282b0[_0x7850('0x43')]=_['merge'](_0x4282b0[_0x7850('0x43')],{'$or':_['map'](_0x3b31dd,function(_0x32fd91){if(_0x32fd91['type']!=='VIRTUAL'){var _0x47c3e6={};_0x47c3e6[_0x32fd91[_0x7850('0x33')]]={'$like':'%'+_0x2451f0[_0x7850('0x3c')][_0x7850('0x46')]+'%'};return _0x47c3e6;}})});}_0x4282b0=_['merge']({},_0x4282b0,_0x2451f0[_0x7850('0x47')]);var _0x5e10c5={'where':_0x4282b0['where']};return db[_0x7850('0x36')][_0x7850('0x28')](_0x5e10c5)[_0x7850('0x30')](function(_0x199054){_0xa5983[_0x7850('0x28')]=_0x199054;if(_0x2451f0[_0x7850('0x3c')][_0x7850('0x48')]){_0x4282b0[_0x7850('0x49')]=[{'all':!![]}];}return db[_0x7850('0x36')][_0x7850('0x4a')](_0x4282b0);})[_0x7850('0x30')](function(_0x592d49){_0xa5983[_0x7850('0x4b')]=_0x592d49;return _0xa5983;})[_0x7850('0x30')](respondWithFilteredResult(_0x136bde,_0x4282b0))[_0x7850('0x22')](handleError(_0x136bde,null));};exports[_0x7850('0x4c')]=function(_0x1c868f,_0x5a83a1){var _0x1acabb={'raw':![],'where':{'id':_0x1c868f[_0x7850('0x4d')]['id']}},_0x141f80={};_0x141f80[_0x7850('0x3a')]=_['keys'](db[_0x7850('0x36')][_0x7850('0x4e')]);_0x141f80[_0x7850('0x3c')]=_[_0x7850('0x3b')](_0x1c868f[_0x7850('0x3c')]);_0x141f80[_0x7850('0x44')]=_['intersection'](_0x141f80[_0x7850('0x3a')],_0x141f80[_0x7850('0x3c')]);_0x1acabb[_0x7850('0x3f')]=_[_0x7850('0x3d')](_0x141f80['model'],qs['fields'](_0x1c868f['query'][_0x7850('0x3e')]));_0x1acabb['attributes']=_0x1acabb[_0x7850('0x3f')][_0x7850('0x4f')]?_0x1acabb[_0x7850('0x3f')]:_0x141f80[_0x7850('0x3a')];if(_0x1c868f[_0x7850('0x3c')][_0x7850('0x48')]){_0x1acabb['include']=[{'all':!![]}];}_0x1acabb=_['merge']({},_0x1acabb,_0x1c868f[_0x7850('0x47')]);return db[_0x7850('0x36')][_0x7850('0x50')](_0x1acabb)[_0x7850('0x30')](handleEntityNotFound(_0x5a83a1,null))[_0x7850('0x30')](respondWithResult(_0x5a83a1,null))[_0x7850('0x22')](handleError(_0x5a83a1,null));};exports[_0x7850('0x2f')]=function(_0x2db772,_0x2ee9d8){if(_0x2db772[_0x7850('0x51')]['id']){delete _0x2db772['body']['id'];}return db[_0x7850('0x36')][_0x7850('0x50')]({'where':{'id':_0x2db772[_0x7850('0x4d')]['id']}})[_0x7850('0x30')](handleEntityNotFound(_0x2ee9d8,null))[_0x7850('0x30')](saveUpdates(_0x2db772[_0x7850('0x51')],null))[_0x7850('0x30')](respondWithResult(_0x2ee9d8,null))[_0x7850('0x22')](handleError(_0x2ee9d8,null));};exports[_0x7850('0x52')]=function(_0x5b6a28,_0x12bd4d,_0x1b38c5){if(_0x5b6a28['file']&&_0x5b6a28[_0x7850('0x53')]['filename']){_0x5b6a28[_0x7850('0x51')][_0x7850('0x54')]=_0x5b6a28[_0x7850('0x53')]['filename'];}return db['Setting'][_0x7850('0x50')]({'where':{'id':_0x5b6a28['params']['id']}})[_0x7850('0x30')](handleEntityNotFound(_0x12bd4d,null))[_0x7850('0x30')](saveUpdates(_0x5b6a28[_0x7850('0x51')],null))[_0x7850('0x30')](respondWithResult(_0x12bd4d,null))[_0x7850('0x22')](handleError(_0x12bd4d,null));};exports[_0x7850('0x55')]=function(_0x272211,_0x386713,_0x4a0c9b){if(_0x272211['file']&&_0x272211[_0x7850('0x53')]['filename']){_0x272211['body'][_0x7850('0x56')]=_0x272211['file']['filename'];}return db[_0x7850('0x36')]['find']({'where':{'id':_0x272211[_0x7850('0x4d')]['id']}})[_0x7850('0x30')](handleEntityNotFound(_0x386713,null))[_0x7850('0x30')](saveUpdates(_0x272211['body'],null))['then'](respondWithResult(_0x386713,null))[_0x7850('0x22')](handleError(_0x386713,null));};var utilLicense=require('../../config/license/util');exports['getLogo']=function(_0x4e1bd5,_0x455087,_0x338e3b){var _0x467c9b=_0x7850('0x57');var _0x3fe65f={'custom':![]};return utilLicense[_0x7850('0x58')]()[_0x7850('0x30')](function(_0x4555f2){if(_0x4555f2){_0x3fe65f=_0x4555f2;}return db[_0x7850('0x36')]['find']({'where':{'id':_0x4e1bd5['params']['id']},'attributes':[_0x7850('0x54'),_0x7850('0x56'),_0x7850('0x59'),_0x7850('0x5a'),_0x7850('0x5b'),'defaultLoginLogo',_0x7850('0x5c'),_0x7850('0x5d')],'raw':!![]});})['then'](handleEntityNotFound(_0x455087,null))[_0x7850('0x30')](function(_0x914337){if(_0x914337){var _0x2a26d6=_0x914337[_0x7850('0x54')]&&fs['existsSync'](path[_0x7850('0x5e')](config[_0x7850('0x5f')],_0x467c9b,_[_0x7850('0x60')](_0x914337[_0x7850('0x54')])))?path[_0x7850('0x5e')](config['root'],_0x467c9b,_[_0x7850('0x60')](_0x914337[_0x7850('0x54')])):path[_0x7850('0x5e')](config[_0x7850('0x5f')],_0x467c9b,_['toLower'](_0x7850('0x61')));var _0x16e881=_0x7850('0x62')+_[_0x7850('0x63')](_0x7850('0x54'));if(_0x914337[_0x16e881]||!_0x3fe65f['custom']){_0x2a26d6=path[_0x7850('0x5e')](config[_0x7850('0x5f')],_0x467c9b,_[_0x7850('0x60')](_0x7850('0x61')));}if(!fs['existsSync'](_0x2a26d6)){throw new db['Sequelize']['ValidationError'](_[_0x7850('0x63')](_0x7850('0x54'))+_0x7850('0x64'));}return _0x455087[_0x7850('0x65')](_0x2a26d6);}})[_0x7850('0x22')](handleError(_0x455087,null));};var utilLicense=require(_0x7850('0x66'));exports['getLogoLogin']=function(_0x5700ed,_0x3caf73,_0x1294f4){var _0x219101=_0x7850('0x57');var _0x3791a0={'custom':![]};return utilLicense[_0x7850('0x58')]()[_0x7850('0x30')](function(_0x564a0b){if(_0x564a0b){_0x3791a0=_0x564a0b;}return db[_0x7850('0x36')][_0x7850('0x50')]({'where':{'id':_0x5700ed['params']['id']},'attributes':[_0x7850('0x54'),'loginLogo',_0x7850('0x59'),_0x7850('0x5a'),_0x7850('0x5b'),_0x7850('0x67'),_0x7850('0x5c'),_0x7850('0x5d')],'raw':!![]});})[_0x7850('0x30')](handleEntityNotFound(_0x3caf73,null))['then'](function(_0x83c5ef){if(_0x83c5ef){var _0x20ccb3=_0x83c5ef[_0x7850('0x56')]&&fs['existsSync'](path[_0x7850('0x5e')](config[_0x7850('0x5f')],_0x219101,_[_0x7850('0x60')](_0x83c5ef[_0x7850('0x56')])))?path[_0x7850('0x5e')](config[_0x7850('0x5f')],_0x219101,_[_0x7850('0x60')](_0x83c5ef[_0x7850('0x56')])):path[_0x7850('0x5e')](config[_0x7850('0x5f')],_0x219101,_['toLower']('default_loginLogo.svg'));var _0x5193b8=_0x7850('0x62')+_[_0x7850('0x63')]('loginLogo');if(_0x83c5ef[_0x5193b8]||!_0x3791a0['custom']){_0x20ccb3=path[_0x7850('0x5e')](config[_0x7850('0x5f')],_0x219101,_[_0x7850('0x60')](_0x7850('0x68')));}if(!fs[_0x7850('0x69')](_0x20ccb3)){throw new db[(_0x7850('0x6a'))][(_0x7850('0x6b'))](_[_0x7850('0x63')](_0x7850('0x56'))+'\x20not\x20found');}return _0x3caf73[_0x7850('0x65')](_0x20ccb3);}})[_0x7850('0x22')](handleError(_0x3caf73,null));};exports[_0x7850('0x6c')]=function(_0x4a8101,_0x5f48ee){return db['Setting'][_0x7850('0x50')]({'where':{'id':_0x4a8101[_0x7850('0x4d')]['id']},'attributes':[_0x7850('0x6d')]})[_0x7850('0x30')](respondWithResult(_0x5f48ee,null))[_0x7850('0x22')](handleError(_0x5f48ee,null));};exports[_0x7850('0x6e')]=function(_0x367cad,_0x2a8dbe,_0x1eaf5b){if(_0x367cad[_0x7850('0x53')]&&_0x367cad['file']['filename']){_0x367cad[_0x7850('0x51')]['preferred']=_0x367cad['file'][_0x7850('0x6f')];}return db[_0x7850('0x36')][_0x7850('0x50')]({'where':{'id':_0x367cad[_0x7850('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2a8dbe,null))[_0x7850('0x30')](saveUpdates(_0x367cad['body'],null))[_0x7850('0x30')](respondWithResult(_0x2a8dbe,null))[_0x7850('0x22')](handleError(_0x2a8dbe,null));};var utilLicense=require('../../config/license/util');exports[_0x7850('0x70')]=function(_0x42a847,_0x31dd13,_0x312742){var _0x11d4bb=_0x7850('0x57');var _0x618a64={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x2acb28){if(_0x2acb28){_0x618a64=_0x2acb28;}return db['Setting'][_0x7850('0x50')]({'where':{'id':_0x42a847[_0x7850('0x4d')]['id']},'attributes':[_0x7850('0x54'),_0x7850('0x56'),'preferred',_0x7850('0x5a'),_0x7850('0x5b'),_0x7850('0x67'),_0x7850('0x5c'),_0x7850('0x5d')],'raw':!![]});})[_0x7850('0x30')](handleEntityNotFound(_0x31dd13,null))[_0x7850('0x30')](function(_0x1c6f35){if(_0x1c6f35){var _0x47c152=_0x1c6f35[_0x7850('0x59')]&&fs['existsSync'](path[_0x7850('0x5e')](config[_0x7850('0x5f')],_0x11d4bb,_[_0x7850('0x60')](_0x1c6f35[_0x7850('0x59')])))?path[_0x7850('0x5e')](config[_0x7850('0x5f')],_0x11d4bb,_[_0x7850('0x60')](_0x1c6f35['preferred'])):path[_0x7850('0x5e')](config['root'],_0x11d4bb,_['toLower'](_0x7850('0x71')));var _0x49e15f=_0x7850('0x62')+_[_0x7850('0x63')]('preferred');if(_0x1c6f35[_0x49e15f]||!_0x618a64[_0x7850('0x72')]||!_0x618a64[_0x7850('0x59')]){_0x47c152=path[_0x7850('0x5e')](config[_0x7850('0x5f')],_0x11d4bb,_['toLower'](_0x7850('0x71')));}if(!fs['existsSync'](_0x47c152)){throw new db[(_0x7850('0x6a'))][(_0x7850('0x6b'))](_[_0x7850('0x63')]('preferred')+'\x20not\x20found');}return _0x31dd13[_0x7850('0x65')](_0x47c152);}})[_0x7850('0x22')](handleError(_0x31dd13,null));};exports[_0x7850('0x73')]=function(_0x10a2ec,_0x4f2f22,_0x3646f6){if(_0x10a2ec[_0x7850('0x53')]&&_0x10a2ec[_0x7850('0x53')][_0x7850('0x6f')]){_0x10a2ec[_0x7850('0x51')][_0x7850('0x5a')]=_0x10a2ec[_0x7850('0x53')][_0x7850('0x6f')];}return db[_0x7850('0x36')][_0x7850('0x50')]({'where':{'id':_0x10a2ec[_0x7850('0x4d')]['id']}})[_0x7850('0x30')](handleEntityNotFound(_0x4f2f22,null))[_0x7850('0x30')](saveUpdates(_0x10a2ec['body'],null))[_0x7850('0x30')](respondWithResult(_0x4f2f22,null))[_0x7850('0x22')](handleError(_0x4f2f22,null));};var utilLicense=require(_0x7850('0x66'));exports[_0x7850('0x74')]=function(_0x33861f,_0x2fa180,_0xee0d77){var _0x1ad09f='server/files/images/logos';var _0x9aa6af={'custom':![]};return utilLicense[_0x7850('0x58')]()[_0x7850('0x30')](function(_0x62b5ba){if(_0x62b5ba){_0x9aa6af=_0x62b5ba;}return db[_0x7850('0x36')]['find']({'where':{'id':_0x33861f[_0x7850('0x4d')]['id']},'attributes':[_0x7850('0x54'),_0x7850('0x56'),_0x7850('0x59'),_0x7850('0x5a'),_0x7850('0x5b'),_0x7850('0x67'),_0x7850('0x5c'),_0x7850('0x5d')],'raw':!![]});})['then'](handleEntityNotFound(_0x2fa180,null))[_0x7850('0x30')](function(_0x319635){if(_0x319635){var _0x39cf64=_0x319635[_0x7850('0x5a')]&&fs[_0x7850('0x69')](path[_0x7850('0x5e')](config[_0x7850('0x5f')],_0x1ad09f,_[_0x7850('0x60')](_0x319635[_0x7850('0x5a')])))?path[_0x7850('0x5e')](config['root'],_0x1ad09f,_[_0x7850('0x60')](_0x319635[_0x7850('0x5a')])):path[_0x7850('0x5e')](config['root'],_0x1ad09f,_[_0x7850('0x60')]('default_favicon.ico'));var _0x8ad56b=_0x7850('0x62')+_[_0x7850('0x63')](_0x7850('0x5a'));if(_0x319635[_0x8ad56b]||!_0x9aa6af['custom']){_0x39cf64=path[_0x7850('0x5e')](config[_0x7850('0x5f')],_0x1ad09f,_[_0x7850('0x60')](_0x7850('0x75')));}if(!fs[_0x7850('0x69')](_0x39cf64)){throw new db[(_0x7850('0x6a'))][(_0x7850('0x6b'))](_[_0x7850('0x63')]('favicon')+_0x7850('0x64'));}return _0x2fa180[_0x7850('0x65')](_0x39cf64);}})[_0x7850('0x22')](handleError(_0x2fa180,null));};exports[_0x7850('0x76')]=function(_0xd9bddf,_0x47bc90){var _0x8167c9={'offset':moment()[_0x7850('0x77')]()};_0x8167c9[_0x7850('0x78')]=moment()['utcOffset'](_0x8167c9[_0x7850('0x29')])[_0x7850('0x79')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x47bc90[_0x7850('0x24')](0xc8)[_0x7850('0x34')](_0x8167c9);}; \ No newline at end of file +var _0x6460=['../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','map','Setting','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','show','intersection','find','body','addLogo','file','filename','logo','params','addLogoLogin','loginLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','root','toLower','join','default_logo.svg','upperFirst','custom','Sequelize','\x20not\x20found','defaultLogo','default_loginLogo.svg','ValidationError','download','gdpr','securePassword','addPreferred','default','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','utcOffset','format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x5ba8b6,_0x5eec74){var _0x5959cc=function(_0x197e0d){while(--_0x197e0d){_0x5ba8b6['push'](_0x5ba8b6['shift']());}};_0x5959cc(++_0x5eec74);}(_0x6460,0x158));var _0x0646=function(_0x4c620e,_0x48e7c8){_0x4c620e=_0x4c620e-0x0;var _0x5bf399=_0x6460[_0x4c620e];return _0x5bf399;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0646('0x0'));var zipdir=require(_0x0646('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0646('0x2'));var moment=require('moment');var BPromise=require(_0x0646('0x3'));var Mustache=require(_0x0646('0x4'));var util=require('util');var path=require(_0x0646('0x5'));var sox=require(_0x0646('0x6'));var csv=require(_0x0646('0x7'));var ejs=require(_0x0646('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0646('0x9'));var squel=require(_0x0646('0xa'));var crypto=require(_0x0646('0xb'));var jsforce=require(_0x0646('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0646('0x7'));var querystring=require(_0x0646('0xd'));var Papa=require('papaparse');var Redis=require(_0x0646('0xe'));var authService=require(_0x0646('0xf'));var qs=require(_0x0646('0x10'));var as=require(_0x0646('0x11'));var hardwareService=require(_0x0646('0x12'));var logger=require('../../config/logger')(_0x0646('0x13'));var utils=require(_0x0646('0x14'));var config=require(_0x0646('0x15'));var licenseUtil=require(_0x0646('0x16'));var db=require(_0x0646('0x17'))['db'];var jayson=require(_0x0646('0x18'));var client=jayson[_0x0646('0x19')][_0x0646('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x1bab26,_0x49e838,_0x89cdc2,_0x440ad7){return new BPromise(function(_0x736b5d,_0xe54fc9){var _0xa86337=_0x440ad7||client;return _0xa86337[_0x0646('0x1b')](_0x1bab26,_0x89cdc2)[_0x0646('0x1c')](function(_0x59df1e){logger[_0x0646('0x1d')](_0x0646('0x1e'),_0x49e838,_0x0646('0x1f'));logger[_0x0646('0x20')]('Setting,\x20%s,\x20%s,\x20%s',_0x49e838,_0x0646('0x1f'),JSON[_0x0646('0x21')](_0x59df1e));if(_0x59df1e[_0x0646('0x22')]){if(_0x59df1e[_0x0646('0x22')]['code']===0x1f4){logger[_0x0646('0x22')](_0x0646('0x1e'),_0x49e838,_0x59df1e[_0x0646('0x22')][_0x0646('0x23')]);return _0xe54fc9(_0x59df1e['error'][_0x0646('0x23')]);}logger[_0x0646('0x22')](_0x0646('0x1e'),_0x49e838,_0x59df1e[_0x0646('0x22')][_0x0646('0x23')]);return _0x736b5d(_0x59df1e[_0x0646('0x22')][_0x0646('0x23')]);}else{logger[_0x0646('0x1d')](_0x0646('0x1e'),_0x49e838,_0x0646('0x1f'));_0x736b5d(_0x59df1e[_0x0646('0x24')]['message']);}})[_0x0646('0x25')](function(_0x41fbaa){logger[_0x0646('0x22')]('Setting,\x20%s,\x20%s',_0x49e838,_0x41fbaa);_0xe54fc9(_0x41fbaa);});});}function respondWithStatusCode(_0x49fe65,_0x37f247){_0x37f247=_0x37f247||0xcc;return function(_0x13a2b3){if(_0x13a2b3){return _0x49fe65[_0x0646('0x26')](_0x37f247);}return _0x49fe65[_0x0646('0x27')](_0x37f247)[_0x0646('0x28')]();};}function respondWithResult(_0x4224fd,_0x56e971){_0x56e971=_0x56e971||0xc8;return function(_0x75691b){if(_0x75691b){return _0x4224fd[_0x0646('0x27')](_0x56e971)['json'](_0x75691b);}};}function respondWithFilteredResult(_0x56f7f8,_0x16e2dc){return function(_0x5d5e20){if(_0x5d5e20){var _0x21411f=typeof _0x16e2dc['offset']===_0x0646('0x29')&&typeof _0x16e2dc[_0x0646('0x2a')]==='undefined';var _0x4387fd=_0x5d5e20[_0x0646('0x2b')];var _0x45fe2d=_0x21411f?0x0:_0x16e2dc[_0x0646('0x2c')];var _0x47ec1f=_0x21411f?_0x5d5e20[_0x0646('0x2b')]:_0x16e2dc[_0x0646('0x2c')]+_0x16e2dc[_0x0646('0x2a')];var _0x4263f6;if(_0x47ec1f>=_0x4387fd){_0x47ec1f=_0x4387fd;_0x4263f6=0xc8;}else{_0x4263f6=0xce;}_0x56f7f8[_0x0646('0x27')](_0x4263f6);return _0x56f7f8[_0x0646('0x2d')](_0x0646('0x2e'),_0x45fe2d+'-'+_0x47ec1f+'/'+_0x4387fd)[_0x0646('0x2f')](_0x5d5e20);}return null;};}function patchUpdates(_0x51dec6){return function(_0x22366b){try{jsonpatch[_0x0646('0x30')](_0x22366b,_0x51dec6,!![]);}catch(_0x569412){return BPromise[_0x0646('0x31')](_0x569412);}return _0x22366b[_0x0646('0x32')]();};}function saveUpdates(_0x3d03bd,_0x64df15){return function(_0xa882ea){if(_0xa882ea){return _0xa882ea[_0x0646('0x33')](_0x3d03bd)[_0x0646('0x1c')](function(_0x305ff2){return _0x305ff2;});}return null;};}function removeEntity(_0x249104,_0x587786){return function(_0x3e9e33){if(_0x3e9e33){return _0x3e9e33[_0x0646('0x34')]()[_0x0646('0x1c')](function(){_0x249104[_0x0646('0x27')](0xcc)[_0x0646('0x28')]();});}};}function handleEntityNotFound(_0xa71508,_0x22ed27){return function(_0x32ec22){if(!_0x32ec22){_0xa71508[_0x0646('0x26')](0x194);}return _0x32ec22;};}function handleError(_0x363633,_0x48c55c){_0x48c55c=_0x48c55c||0x1f4;return function(_0x315bb7){logger[_0x0646('0x22')](_0x315bb7[_0x0646('0x35')]);if(_0x315bb7[_0x0646('0x36')]){delete _0x315bb7[_0x0646('0x36')];}_0x363633['status'](_0x48c55c)[_0x0646('0x37')](_0x315bb7);};}exports['index']=function(_0x363592,_0x5437f0){var _0xdfc790={},_0x5d2af9={},_0x29d4d0={'count':0x0,'rows':[]};var _0x46d313=_[_0x0646('0x38')](db[_0x0646('0x39')][_0x0646('0x3a')],function(_0x1c361c){return{'name':_0x1c361c[_0x0646('0x3b')],'type':_0x1c361c[_0x0646('0x3c')][_0x0646('0x3d')]};});_0x5d2af9['model']=_[_0x0646('0x38')](_0x46d313,'name');_0x5d2af9['query']=_[_0x0646('0x3e')](_0x363592[_0x0646('0x3f')]);_0x5d2af9[_0x0646('0x40')]=_['intersection'](_0x5d2af9[_0x0646('0x41')],_0x5d2af9[_0x0646('0x3f')]);_0xdfc790[_0x0646('0x42')]=_['intersection'](_0x5d2af9[_0x0646('0x41')],qs[_0x0646('0x43')](_0x363592['query'][_0x0646('0x43')]));_0xdfc790[_0x0646('0x42')]=_0xdfc790[_0x0646('0x42')][_0x0646('0x44')]?_0xdfc790[_0x0646('0x42')]:_0x5d2af9[_0x0646('0x41')];if(!_0x363592['query'][_0x0646('0x45')](_0x0646('0x46'))){_0xdfc790[_0x0646('0x2a')]=qs['limit'](_0x363592[_0x0646('0x3f')][_0x0646('0x2a')]);_0xdfc790[_0x0646('0x2c')]=qs[_0x0646('0x2c')](_0x363592['query'][_0x0646('0x2c')]);}_0xdfc790[_0x0646('0x47')]=qs[_0x0646('0x48')](_0x363592['query'][_0x0646('0x48')]);_0xdfc790[_0x0646('0x49')]=qs[_0x0646('0x40')](_['pick'](_0x363592[_0x0646('0x3f')],_0x5d2af9[_0x0646('0x40')]),_0x46d313);if(_0x363592[_0x0646('0x3f')][_0x0646('0x4a')]){_0xdfc790[_0x0646('0x49')]=_[_0x0646('0x4b')](_0xdfc790[_0x0646('0x49')],{'$or':_[_0x0646('0x38')](_0x46d313,function(_0x597c6f){if(_0x597c6f[_0x0646('0x3c')]!==_0x0646('0x4c')){var _0x1b41f5={};_0x1b41f5[_0x597c6f[_0x0646('0x36')]]={'$like':'%'+_0x363592['query'][_0x0646('0x4a')]+'%'};return _0x1b41f5;}})});}_0xdfc790=_[_0x0646('0x4b')]({},_0xdfc790,_0x363592[_0x0646('0x4d')]);var _0x592217={'where':_0xdfc790[_0x0646('0x49')]};return db[_0x0646('0x39')][_0x0646('0x2b')](_0x592217)['then'](function(_0x7d0620){_0x29d4d0[_0x0646('0x2b')]=_0x7d0620;if(_0x363592[_0x0646('0x3f')][_0x0646('0x4e')]){_0xdfc790[_0x0646('0x4f')]=[{'all':!![]}];}return db[_0x0646('0x39')]['findAll'](_0xdfc790);})[_0x0646('0x1c')](function(_0x3a97f1){_0x29d4d0[_0x0646('0x50')]=_0x3a97f1;return _0x29d4d0;})[_0x0646('0x1c')](respondWithFilteredResult(_0x5437f0,_0xdfc790))['catch'](handleError(_0x5437f0,null));};exports[_0x0646('0x51')]=function(_0x34b0af,_0x18730c){var _0x110a29={'raw':![],'where':{'id':_0x34b0af['params']['id']}},_0x19bd7d={};_0x19bd7d['model']=_[_0x0646('0x3e')](db['Setting'][_0x0646('0x3a')]);_0x19bd7d[_0x0646('0x3f')]=_[_0x0646('0x3e')](_0x34b0af[_0x0646('0x3f')]);_0x19bd7d[_0x0646('0x40')]=_[_0x0646('0x52')](_0x19bd7d[_0x0646('0x41')],_0x19bd7d[_0x0646('0x3f')]);_0x110a29[_0x0646('0x42')]=_[_0x0646('0x52')](_0x19bd7d[_0x0646('0x41')],qs[_0x0646('0x43')](_0x34b0af[_0x0646('0x3f')][_0x0646('0x43')]));_0x110a29[_0x0646('0x42')]=_0x110a29[_0x0646('0x42')]['length']?_0x110a29[_0x0646('0x42')]:_0x19bd7d[_0x0646('0x41')];if(_0x34b0af[_0x0646('0x3f')][_0x0646('0x4e')]){_0x110a29['include']=[{'all':!![]}];}_0x110a29=_['merge']({},_0x110a29,_0x34b0af['options']);return db[_0x0646('0x39')][_0x0646('0x53')](_0x110a29)[_0x0646('0x1c')](handleEntityNotFound(_0x18730c,null))[_0x0646('0x1c')](respondWithResult(_0x18730c,null))['catch'](handleError(_0x18730c,null));};exports['update']=function(_0xdf8d7f,_0x1f0a42){if(_0xdf8d7f[_0x0646('0x54')]['id']){delete _0xdf8d7f[_0x0646('0x54')]['id'];}return db[_0x0646('0x39')]['find']({'where':{'id':_0xdf8d7f['params']['id']}})[_0x0646('0x1c')](handleEntityNotFound(_0x1f0a42,null))[_0x0646('0x1c')](saveUpdates(_0xdf8d7f[_0x0646('0x54')],null))['then'](respondWithResult(_0x1f0a42,null))['catch'](handleError(_0x1f0a42,null));};exports[_0x0646('0x55')]=function(_0x3f3ef6,_0x1d90e6,_0x34b424){if(_0x3f3ef6[_0x0646('0x56')]&&_0x3f3ef6['file'][_0x0646('0x57')]){_0x3f3ef6[_0x0646('0x54')][_0x0646('0x58')]=_0x3f3ef6['file']['filename'];}return db['Setting']['find']({'where':{'id':_0x3f3ef6[_0x0646('0x59')]['id']}})[_0x0646('0x1c')](handleEntityNotFound(_0x1d90e6,null))[_0x0646('0x1c')](saveUpdates(_0x3f3ef6['body'],null))[_0x0646('0x1c')](respondWithResult(_0x1d90e6,null))[_0x0646('0x25')](handleError(_0x1d90e6,null));};exports[_0x0646('0x5a')]=function(_0x583f51,_0x4a7777,_0x46d728){if(_0x583f51[_0x0646('0x56')]&&_0x583f51[_0x0646('0x56')][_0x0646('0x57')]){_0x583f51[_0x0646('0x54')][_0x0646('0x5b')]=_0x583f51[_0x0646('0x56')][_0x0646('0x57')];}return db['Setting']['find']({'where':{'id':_0x583f51['params']['id']}})[_0x0646('0x1c')](handleEntityNotFound(_0x4a7777,null))[_0x0646('0x1c')](saveUpdates(_0x583f51[_0x0646('0x54')],null))[_0x0646('0x1c')](respondWithResult(_0x4a7777,null))[_0x0646('0x25')](handleError(_0x4a7777,null));};var utilLicense=require(_0x0646('0x16'));exports['getLogo']=function(_0x1c7149,_0x2e43c4,_0xc9a781){var _0x46a511=_0x0646('0x5c');var _0xf9611b={'custom':![]};return utilLicense[_0x0646('0x5d')]()[_0x0646('0x1c')](function(_0x30dcbe){if(_0x30dcbe){_0xf9611b=_0x30dcbe;}return db[_0x0646('0x39')]['find']({'where':{'id':_0x1c7149[_0x0646('0x59')]['id']},'attributes':[_0x0646('0x58'),_0x0646('0x5b'),_0x0646('0x5e'),_0x0646('0x5f'),'defaultLogo',_0x0646('0x60'),_0x0646('0x61'),_0x0646('0x62')],'raw':!![]});})[_0x0646('0x1c')](handleEntityNotFound(_0x2e43c4,null))['then'](function(_0x5ba167){if(_0x5ba167){var _0x438f28=_0x5ba167['logo']&&fs[_0x0646('0x63')](path['join'](config[_0x0646('0x64')],_0x46a511,_[_0x0646('0x65')](_0x5ba167[_0x0646('0x58')])))?path[_0x0646('0x66')](config[_0x0646('0x64')],_0x46a511,_['toLower'](_0x5ba167['logo'])):path[_0x0646('0x66')](config[_0x0646('0x64')],_0x46a511,_[_0x0646('0x65')](_0x0646('0x67')));var _0x20c472='default'+_[_0x0646('0x68')](_0x0646('0x58'));if(_0x5ba167[_0x20c472]||!_0xf9611b[_0x0646('0x69')]){_0x438f28=path[_0x0646('0x66')](config[_0x0646('0x64')],_0x46a511,_[_0x0646('0x65')]('default_logo.svg'));}if(!fs[_0x0646('0x63')](_0x438f28)){throw new db[(_0x0646('0x6a'))]['ValidationError'](_[_0x0646('0x68')]('logo')+_0x0646('0x6b'));}return _0x2e43c4['download'](_0x438f28);}})[_0x0646('0x25')](handleError(_0x2e43c4,null));};var utilLicense=require(_0x0646('0x16'));exports['getLogoLogin']=function(_0x327786,_0x45cebe,_0x1d2c27){var _0x16604e='server/files/images/logos';var _0x150310={'custom':![]};return utilLicense[_0x0646('0x5d')]()['then'](function(_0x826a34){if(_0x826a34){_0x150310=_0x826a34;}return db[_0x0646('0x39')][_0x0646('0x53')]({'where':{'id':_0x327786[_0x0646('0x59')]['id']},'attributes':['logo',_0x0646('0x5b'),_0x0646('0x5e'),'favicon',_0x0646('0x6c'),'defaultLoginLogo','defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x0646('0x1c')](handleEntityNotFound(_0x45cebe,null))['then'](function(_0x57768e){if(_0x57768e){var _0x2d04d0=_0x57768e['loginLogo']&&fs[_0x0646('0x63')](path[_0x0646('0x66')](config['root'],_0x16604e,_[_0x0646('0x65')](_0x57768e[_0x0646('0x5b')])))?path[_0x0646('0x66')](config[_0x0646('0x64')],_0x16604e,_['toLower'](_0x57768e[_0x0646('0x5b')])):path['join'](config[_0x0646('0x64')],_0x16604e,_[_0x0646('0x65')](_0x0646('0x6d')));var _0xb0da59='default'+_[_0x0646('0x68')](_0x0646('0x5b'));if(_0x57768e[_0xb0da59]||!_0x150310[_0x0646('0x69')]){_0x2d04d0=path[_0x0646('0x66')](config[_0x0646('0x64')],_0x16604e,_['toLower'](_0x0646('0x6d')));}if(!fs['existsSync'](_0x2d04d0)){throw new db[(_0x0646('0x6a'))][(_0x0646('0x6e'))](_['upperFirst'](_0x0646('0x5b'))+_0x0646('0x6b'));}return _0x45cebe[_0x0646('0x6f')](_0x2d04d0);}})[_0x0646('0x25')](handleError(_0x45cebe,null));};exports[_0x0646('0x70')]=function(_0x441fb0,_0x5dc744){return db[_0x0646('0x39')][_0x0646('0x53')]({'where':{'id':_0x441fb0[_0x0646('0x59')]['id']},'attributes':[_0x0646('0x71')]})['then'](respondWithResult(_0x5dc744,null))[_0x0646('0x25')](handleError(_0x5dc744,null));};exports[_0x0646('0x72')]=function(_0x3f6f4a,_0x5a79df,_0x4047b3){if(_0x3f6f4a['file']&&_0x3f6f4a[_0x0646('0x56')][_0x0646('0x57')]){_0x3f6f4a[_0x0646('0x54')][_0x0646('0x5e')]=_0x3f6f4a['file'][_0x0646('0x57')];}return db[_0x0646('0x39')][_0x0646('0x53')]({'where':{'id':_0x3f6f4a[_0x0646('0x59')]['id']}})[_0x0646('0x1c')](handleEntityNotFound(_0x5a79df,null))[_0x0646('0x1c')](saveUpdates(_0x3f6f4a[_0x0646('0x54')],null))[_0x0646('0x1c')](respondWithResult(_0x5a79df,null))[_0x0646('0x25')](handleError(_0x5a79df,null));};var utilLicense=require(_0x0646('0x16'));exports['getPreferred']=function(_0x5ed96d,_0x347f2e,_0xd4b61a){var _0x48ed03='server/files/images/logos';var _0x47274b={'custom':![]};return utilLicense[_0x0646('0x5d')]()[_0x0646('0x1c')](function(_0x51c453){if(_0x51c453){_0x47274b=_0x51c453;}return db['Setting'][_0x0646('0x53')]({'where':{'id':_0x5ed96d[_0x0646('0x59')]['id']},'attributes':['logo',_0x0646('0x5b'),_0x0646('0x5e'),_0x0646('0x5f'),'defaultLogo',_0x0646('0x60'),_0x0646('0x61'),_0x0646('0x62')],'raw':!![]});})['then'](handleEntityNotFound(_0x347f2e,null))[_0x0646('0x1c')](function(_0x2b5358){if(_0x2b5358){var _0x2903c5=_0x2b5358[_0x0646('0x5e')]&&fs['existsSync'](path['join'](config[_0x0646('0x64')],_0x48ed03,_['toLower'](_0x2b5358[_0x0646('0x5e')])))?path[_0x0646('0x66')](config[_0x0646('0x64')],_0x48ed03,_[_0x0646('0x65')](_0x2b5358[_0x0646('0x5e')])):path[_0x0646('0x66')](config['root'],_0x48ed03,_['toLower']('default_preferred.png'));var _0x57449a=_0x0646('0x73')+_['upperFirst'](_0x0646('0x5e'));if(_0x2b5358[_0x57449a]||!_0x47274b[_0x0646('0x69')]||!_0x47274b[_0x0646('0x5e')]){_0x2903c5=path[_0x0646('0x66')](config['root'],_0x48ed03,_[_0x0646('0x65')](_0x0646('0x74')));}if(!fs[_0x0646('0x63')](_0x2903c5)){throw new db[(_0x0646('0x6a'))][(_0x0646('0x6e'))](_['upperFirst'](_0x0646('0x5e'))+_0x0646('0x6b'));}return _0x347f2e[_0x0646('0x6f')](_0x2903c5);}})[_0x0646('0x25')](handleError(_0x347f2e,null));};exports[_0x0646('0x75')]=function(_0x48d8a6,_0x587fe5,_0x14bd9b){if(_0x48d8a6[_0x0646('0x56')]&&_0x48d8a6[_0x0646('0x56')][_0x0646('0x57')]){_0x48d8a6[_0x0646('0x54')][_0x0646('0x5f')]=_0x48d8a6[_0x0646('0x56')][_0x0646('0x57')];}return db['Setting'][_0x0646('0x53')]({'where':{'id':_0x48d8a6['params']['id']}})['then'](handleEntityNotFound(_0x587fe5,null))[_0x0646('0x1c')](saveUpdates(_0x48d8a6[_0x0646('0x54')],null))['then'](respondWithResult(_0x587fe5,null))[_0x0646('0x25')](handleError(_0x587fe5,null));};var utilLicense=require('../../config/license/util');exports[_0x0646('0x76')]=function(_0x3f825e,_0x56a27c,_0x32fb08){var _0x45aac0=_0x0646('0x5c');var _0x1a3079={'custom':![]};return utilLicense[_0x0646('0x5d')]()[_0x0646('0x1c')](function(_0x535200){if(_0x535200){_0x1a3079=_0x535200;}return db[_0x0646('0x39')][_0x0646('0x53')]({'where':{'id':_0x3f825e[_0x0646('0x59')]['id']},'attributes':[_0x0646('0x58'),_0x0646('0x5b'),_0x0646('0x5e'),_0x0646('0x5f'),'defaultLogo','defaultLoginLogo',_0x0646('0x61'),'defaultFavicon'],'raw':!![]});})[_0x0646('0x1c')](handleEntityNotFound(_0x56a27c,null))[_0x0646('0x1c')](function(_0x196b4b){if(_0x196b4b){var _0x3c3120=_0x196b4b[_0x0646('0x5f')]&&fs['existsSync'](path[_0x0646('0x66')](config['root'],_0x45aac0,_[_0x0646('0x65')](_0x196b4b[_0x0646('0x5f')])))?path[_0x0646('0x66')](config[_0x0646('0x64')],_0x45aac0,_[_0x0646('0x65')](_0x196b4b[_0x0646('0x5f')])):path['join'](config[_0x0646('0x64')],_0x45aac0,_['toLower'](_0x0646('0x77')));var _0x3aca72=_0x0646('0x73')+_[_0x0646('0x68')](_0x0646('0x5f'));if(_0x196b4b[_0x3aca72]||!_0x1a3079[_0x0646('0x69')]){_0x3c3120=path[_0x0646('0x66')](config['root'],_0x45aac0,_[_0x0646('0x65')]('default_favicon.ico'));}if(!fs['existsSync'](_0x3c3120)){throw new db[(_0x0646('0x6a'))][(_0x0646('0x6e'))](_[_0x0646('0x68')](_0x0646('0x5f'))+'\x20not\x20found');}return _0x56a27c[_0x0646('0x6f')](_0x3c3120);}})[_0x0646('0x25')](handleError(_0x56a27c,null));};exports['getDate']=function(_0x515156,_0x50eab6){var _0x1893ea={'offset':moment()[_0x0646('0x78')]()};_0x1893ea['now']=moment()[_0x0646('0x78')](_0x1893ea[_0x0646('0x2c')])[_0x0646('0x79')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x50eab6['status'](0xc8)[_0x0646('0x37')](_0x1893ea);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index e64015c..6ddc973 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 _0xe14b=['bluebird','path','./setting.attributes','exports','define','Setting','settings','lodash','util','moment'];(function(_0x336d6f,_0x5549b6){var _0xa654d2=function(_0x477267){while(--_0x477267){_0x336d6f['push'](_0x336d6f['shift']());}};_0xa654d2(++_0x5549b6);}(_0xe14b,0x93));var _0xbe14=function(_0x41cea3,_0x586b82){_0x41cea3=_0x41cea3-0x0;var _0x3cb477=_0xe14b[_0x41cea3];return _0x3cb477;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 453309b..7cd54aa 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 _0xedd7=['catch','ShowSetting','options','raw','where','include','model','map','attributes','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x219fb5,_0x10562f){var _0x17c103=function(_0x3fd6c4){while(--_0x3fd6c4){_0x219fb5['push'](_0x219fb5['shift']());}};_0x17c103(++_0x10562f);}(_0xedd7,0x117));var _0x7edd=function(_0x443547,_0x21d7a8){_0x443547=_0x443547-0x0;var _0x1423a8=_0xedd7[_0x443547];return _0x1423a8;};'use strict';var _=require(_0x7edd('0x0'));var util=require(_0x7edd('0x1'));var moment=require('moment');var BPromise=require(_0x7edd('0x2'));var rs=require(_0x7edd('0x3'));var fs=require('fs');var Redis=require(_0x7edd('0x4'));var db=require(_0x7edd('0x5'))['db'];var utils=require(_0x7edd('0x6'));var logger=require('../../config/logger')(_0x7edd('0x7'));var config=require(_0x7edd('0x8'));var jayson=require(_0x7edd('0x9'));var client=jayson['client'][_0x7edd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3bbd58,_0x31ffde,_0x9154d1){return new BPromise(function(_0x318f16,_0x1d4982){return client[_0x7edd('0xb')](_0x3bbd58,_0x9154d1)['then'](function(_0x16dc62){logger[_0x7edd('0xc')](_0x7edd('0xd'),_0x31ffde,_0x7edd('0xe'));logger[_0x7edd('0xf')]('Setting,\x20%s,\x20%s,\x20%s',_0x31ffde,_0x7edd('0xe'),JSON[_0x7edd('0x10')](_0x16dc62));if(_0x16dc62[_0x7edd('0x11')]){if(_0x16dc62[_0x7edd('0x11')][_0x7edd('0x12')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x31ffde,_0x16dc62['error'][_0x7edd('0x13')]);return _0x1d4982(_0x16dc62['error'][_0x7edd('0x13')]);}logger[_0x7edd('0x11')](_0x7edd('0xd'),_0x31ffde,_0x16dc62[_0x7edd('0x11')][_0x7edd('0x13')]);return _0x318f16(_0x16dc62[_0x7edd('0x11')]['message']);}else{logger['info'](_0x7edd('0xd'),_0x31ffde,_0x7edd('0xe'));_0x318f16(_0x16dc62[_0x7edd('0x14')][_0x7edd('0x13')]);}})[_0x7edd('0x15')](function(_0x20256a){logger[_0x7edd('0x11')](_0x7edd('0xd'),_0x31ffde,_0x20256a);_0x1d4982(_0x20256a);});});}exports[_0x7edd('0x16')]=function(_0xc399c9){var _0x510582=this;return new Promise(function(_0x1fb706,_0x20f802){return db['Setting']['find']({'raw':_0xc399c9[_0x7edd('0x17')]?_0xc399c9['options'][_0x7edd('0x18')]===undefined?!![]:![]:!![],'where':_0xc399c9[_0x7edd('0x17')]?_0xc399c9['options'][_0x7edd('0x19')]||null:null,'attributes':_0xc399c9['options']?_0xc399c9[_0x7edd('0x17')]['attributes']||null:null,'include':_0xc399c9[_0x7edd('0x17')]?_0xc399c9[_0x7edd('0x17')][_0x7edd('0x1a')]?_['map'](_0xc399c9[_0x7edd('0x17')][_0x7edd('0x1a')],function(_0x24d559){return{'model':db[_0x24d559[_0x7edd('0x1b')]],'as':_0x24d559['as'],'attributes':_0x24d559['attributes'],'include':_0x24d559[_0x7edd('0x1a')]?_[_0x7edd('0x1c')](_0x24d559[_0x7edd('0x1a')],function(_0x413d61){return{'model':db[_0x413d61[_0x7edd('0x1b')]],'as':_0x413d61['as'],'attributes':_0x413d61[_0x7edd('0x1d')],'include':_0x413d61['include']?_[_0x7edd('0x1c')](_0x413d61['include'],function(_0x3226d9){return{'model':db[_0x3226d9[_0x7edd('0x1b')]],'as':_0x3226d9['as'],'attributes':_0x3226d9['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b242a){logger[_0x7edd('0xc')]('ShowSetting',_0xc399c9);logger[_0x7edd('0xf')]('ShowSetting',_0xc399c9,JSON[_0x7edd('0x10')](_0x3b242a));_0x1fb706(_0x3b242a);})[_0x7edd('0x15')](function(_0x1151cc){logger[_0x7edd('0x11')](_0x7edd('0x16'),_0x1151cc[_0x7edd('0x13')],_0xc399c9);_0x20f802(_0x510582[_0x7edd('0x11')](0x1f4,_0x1151cc[_0x7edd('0x13')]));});});}; \ No newline at end of file +var _0xb3e5=['http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSetting','Setting','options','raw','where','attributes','map','include','model','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x51a91a,_0x4765d5){var _0x46b23b=function(_0x577e5b){while(--_0x577e5b){_0x51a91a['push'](_0x51a91a['shift']());}};_0x46b23b(++_0x4765d5);}(_0xb3e5,0x149));var _0x5b3e=function(_0x5631b7,_0x1ef746){_0x5631b7=_0x5631b7-0x0;var _0x580117=_0xb3e5[_0x5631b7];return _0x580117;};'use strict';var _=require(_0x5b3e('0x0'));var util=require(_0x5b3e('0x1'));var moment=require(_0x5b3e('0x2'));var BPromise=require(_0x5b3e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5b3e('0x4'));var db=require(_0x5b3e('0x5'))['db'];var utils=require(_0x5b3e('0x6'));var logger=require(_0x5b3e('0x7'))(_0x5b3e('0x8'));var config=require('../../config/environment');var jayson=require(_0x5b3e('0x9'));var client=jayson[_0x5b3e('0xa')][_0x5b3e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21f35f,_0x17977e,_0x343383){return new BPromise(function(_0x4ca6b2,_0x1ea203){return client[_0x5b3e('0xc')](_0x21f35f,_0x343383)[_0x5b3e('0xd')](function(_0x2502c0){logger[_0x5b3e('0xe')](_0x5b3e('0xf'),_0x17977e,_0x5b3e('0x10'));logger[_0x5b3e('0x11')](_0x5b3e('0x12'),_0x17977e,_0x5b3e('0x10'),JSON['stringify'](_0x2502c0));if(_0x2502c0['error']){if(_0x2502c0[_0x5b3e('0x13')][_0x5b3e('0x14')]===0x1f4){logger['error'](_0x5b3e('0xf'),_0x17977e,_0x2502c0[_0x5b3e('0x13')]['message']);return _0x1ea203(_0x2502c0['error'][_0x5b3e('0x15')]);}logger[_0x5b3e('0x13')](_0x5b3e('0xf'),_0x17977e,_0x2502c0[_0x5b3e('0x13')][_0x5b3e('0x15')]);return _0x4ca6b2(_0x2502c0[_0x5b3e('0x13')][_0x5b3e('0x15')]);}else{logger[_0x5b3e('0xe')](_0x5b3e('0xf'),_0x17977e,_0x5b3e('0x10'));_0x4ca6b2(_0x2502c0[_0x5b3e('0x16')][_0x5b3e('0x15')]);}})[_0x5b3e('0x17')](function(_0x162f57){logger[_0x5b3e('0x13')](_0x5b3e('0xf'),_0x17977e,_0x162f57);_0x1ea203(_0x162f57);});});}exports[_0x5b3e('0x18')]=function(_0xfedaa2){var _0xbeb891=this;return new Promise(function(_0x3edab4,_0x2bc1a7){return db[_0x5b3e('0x19')]['find']({'raw':_0xfedaa2[_0x5b3e('0x1a')]?_0xfedaa2[_0x5b3e('0x1a')][_0x5b3e('0x1b')]===undefined?!![]:![]:!![],'where':_0xfedaa2[_0x5b3e('0x1a')]?_0xfedaa2[_0x5b3e('0x1a')][_0x5b3e('0x1c')]||null:null,'attributes':_0xfedaa2[_0x5b3e('0x1a')]?_0xfedaa2[_0x5b3e('0x1a')][_0x5b3e('0x1d')]||null:null,'include':_0xfedaa2['options']?_0xfedaa2[_0x5b3e('0x1a')]['include']?_[_0x5b3e('0x1e')](_0xfedaa2[_0x5b3e('0x1a')][_0x5b3e('0x1f')],function(_0x1d4c52){return{'model':db[_0x1d4c52[_0x5b3e('0x20')]],'as':_0x1d4c52['as'],'attributes':_0x1d4c52[_0x5b3e('0x1d')],'include':_0x1d4c52[_0x5b3e('0x1f')]?_[_0x5b3e('0x1e')](_0x1d4c52[_0x5b3e('0x1f')],function(_0x4f20fe){return{'model':db[_0x4f20fe[_0x5b3e('0x20')]],'as':_0x4f20fe['as'],'attributes':_0x4f20fe[_0x5b3e('0x1d')],'include':_0x4f20fe['include']?_[_0x5b3e('0x1e')](_0x4f20fe['include'],function(_0x41fb2c){return{'model':db[_0x41fb2c['model']],'as':_0x41fb2c['as'],'attributes':_0x41fb2c[_0x5b3e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5b3e('0xd')](function(_0x4a708b){logger[_0x5b3e('0xe')]('ShowSetting',_0xfedaa2);logger[_0x5b3e('0x11')](_0x5b3e('0x18'),_0xfedaa2,JSON[_0x5b3e('0x21')](_0x4a708b));_0x3edab4(_0x4a708b);})[_0x5b3e('0x17')](function(_0x546fe9){logger[_0x5b3e('0x13')]('ShowSetting',_0x546fe9[_0x5b3e('0x15')],_0xfedaa2);_0x2bc1a7(_0xbeb891['error'](0x1f4,_0x546fe9[_0x5b3e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index ce689c3..87efdf6 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 _0x814b=['/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/send','status','addAgents','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated'];(function(_0x5e068e,_0x28ff2e){var _0x329514=function(_0x1c9815){while(--_0x1c9815){_0x5e068e['push'](_0x5e068e['shift']());}};_0x329514(++_0x28ff2e);}(_0x814b,0x1a2));var _0xb814=function(_0x44c325,_0x19c625){_0x44c325=_0x44c325-0x0;var _0x55f09e=_0x814b[_0x44c325];return _0x55f09e;};'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('0xa')](_0xb814('0x16'),auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0xa')](_0xb814('0x18'),controller[_0xb814('0x19')]);router[_0xb814('0xa')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router[_0xb814('0x1c')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x1e')]);router['post'](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x1f')]);router[_0xb814('0x1c')]('/:id/notify',controller['notify']);router['post'](_0xb814('0x14'),auth['isAuthenticated'](),controller['addApplications']);router[_0xb814('0x1c')](_0xb814('0x20'),auth[_0xb814('0xb')](),controller['send']);router[_0xb814('0x1c')]('/:id/status',controller[_0xb814('0x21')]);router[_0xb814('0x1c')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x22')]);router[_0xb814('0x23')](_0xb814('0xe'),auth['isAuthenticated'](),controller[_0xb814('0x24')]);router['delete'](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x25')]);router[_0xb814('0x26')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x27')]);router['delete'](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x28')]);router[_0xb814('0x26')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x29')]);module[_0xb814('0x2a')]=router; \ No newline at end of file +var _0x7fbe=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','post','create','/:id/notify','notify','put','delete','removeAnswers','path','connect-timeout','express'];(function(_0x20c69e,_0x16ca84){var _0x555777=function(_0x18937f){while(--_0x18937f){_0x20c69e['push'](_0x20c69e['shift']());}};_0x555777(++_0x16ca84);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x3a0aef,_0x4815f2){_0x3a0aef=_0x3a0aef-0x0;var _0x837448=_0x7fbe[_0x3a0aef];return _0x837448;};'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['get'](_0xe7fb('0xf'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x10')]);router[_0xe7fb('0x9')](_0xe7fb('0x11'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x12')]);router[_0xe7fb('0x9')](_0xe7fb('0x13'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x14')]);router[_0xe7fb('0x9')](_0xe7fb('0x15'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x16')]);router['get'](_0xe7fb('0x17'),controller[_0xe7fb('0x18')]);router['get'](_0xe7fb('0x19'),auth[_0xe7fb('0xa')](),controller['getAgents']);router[_0xe7fb('0x1a')]('/',auth['isAuthenticated'](),controller[_0xe7fb('0x1b')]);router[_0xe7fb('0x1a')](_0xe7fb('0xf'),auth[_0xe7fb('0xa')](),controller['addDisposition']);router[_0xe7fb('0x1a')]('/:id/canned_answers',auth[_0xe7fb('0xa')](),controller['addAnswer']);router[_0xe7fb('0x1a')](_0xe7fb('0x1c'),controller[_0xe7fb('0x1d')]);router[_0xe7fb('0x1a')]('/:id/applications',auth[_0xe7fb('0xa')](),controller['addApplications']);router[_0xe7fb('0x1a')]('/:id/send',auth[_0xe7fb('0xa')](),controller['send']);router[_0xe7fb('0x1a')](_0xe7fb('0x17'),controller['status']);router[_0xe7fb('0x1a')](_0xe7fb('0x19'),auth[_0xe7fb('0xa')](),controller['addAgents']);router[_0xe7fb('0x1e')](_0xe7fb('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xe7fb('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0xe7fb('0x1f')](_0xe7fb('0xf'),auth[_0xe7fb('0xa')](),controller['removeDispositions']);router[_0xe7fb('0x1f')](_0xe7fb('0x11'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x20')]);router[_0xe7fb('0x1f')](_0xe7fb('0x19'),auth[_0xe7fb('0xa')](),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 8a9258c..a40a6c0 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 _0xbc9a=['STRING','name','generate','skebby','connectel','clicksend','plivo','clickatell','bandwidth','csc','infobip','ENUM','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','exports'];(function(_0x3bb0b8,_0x2af7f9){var _0x52b34a=function(_0x909bfa){while(--_0x909bfa){_0x3bb0b8['push'](_0x3bb0b8['shift']());}};_0x52b34a(++_0x2af7f9);}(_0xbc9a,0x18f));var _0xabc9=function(_0x5c846d,_0x5c02ce){_0x5c846d=_0x5c846d-0x0;var _0xd064e4=_0xbc9a[_0x5c846d];return _0xd064e4;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xabc9('0x0')]={'name':{'type':Sequelize[_0xabc9('0x1')],'unique':_0xabc9('0x2'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xabc9('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0xabc9('0x1')],'defaultValue':function(){return rs[_0xabc9('0x3')]();}},'phone':{'type':Sequelize[_0xabc9('0x1')]},'type':{'type':Sequelize['ENUM']('twilio',_0xabc9('0x4'),_0xabc9('0x5'),_0xabc9('0x6'),_0xabc9('0x7'),_0xabc9('0x8'),_0xabc9('0x9'),_0xabc9('0xa'),_0xabc9('0xb'),'intelepeer')},'accountSid':{'type':Sequelize[_0xabc9('0x1')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xabc9('0x1')]},'smsMethod':{'type':Sequelize[_0xabc9('0xc')]('SI','TI','GP')},'username':{'type':Sequelize[_0xabc9('0x1')]},'password':{'type':Sequelize[_0xabc9('0x1')]},'apiKey':{'type':Sequelize[_0xabc9('0x1')]},'applicationId':{'type':Sequelize[_0xabc9('0x1')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xabc9('0x1')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xabc9('0x1')]},'notificationTemplate':{'type':Sequelize[_0xabc9('0xd')],'defaultValue':function(){return _0xabc9('0xe');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xabc9('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xabc9('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xabc9('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xabc9('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xabc9('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xabc9('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xabc9('0xf')],'comment':_0xabc9('0x11')},'mandatoryDisposition':{'type':Sequelize[_0xabc9('0x10')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3d4f50){if(!_0x3d4f50)this[_0xabc9('0x12')](_0xabc9('0x13'),null);this['setDataValue']('mandatoryDisposition',_0x3d4f50);}}}; \ No newline at end of file +var _0x073c=['mandatoryDisposition','sequelize','STRING','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','csc','infobip','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue'];(function(_0x26e660,_0x1998b7){var _0x52ce28=function(_0x527020){while(--_0x527020){_0x26e660['push'](_0x26e660['shift']());}};_0x52ce28(++_0x1998b7);}(_0x073c,0x190));var _0xc073=function(_0x496525,_0x42f07f){_0x496525=_0x496525-0x0;var _0x51a07c=_0x073c[_0x496525];return _0x51a07c;};'use strict';var Sequelize=require(_0xc073('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xc073('0x1')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xc073('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0xc073('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0xc073('0x1')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xc073('0x1')]},'type':{'type':Sequelize[_0xc073('0x2')](_0xc073('0x3'),_0xc073('0x4'),_0xc073('0x5'),_0xc073('0x6'),_0xc073('0x7'),_0xc073('0x8'),'bandwidth',_0xc073('0x9'),_0xc073('0xa'),'intelepeer')},'accountSid':{'type':Sequelize[_0xc073('0x1')]},'authId':{'type':Sequelize[_0xc073('0x1')]},'authToken':{'type':Sequelize[_0xc073('0x1')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0xc073('0x1')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0xc073('0x1')]},'applicationId':{'type':Sequelize[_0xc073('0x1')]},'accountId':{'type':Sequelize[_0xc073('0x1')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0xc073('0xb')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xc073('0xc')],'defaultValue':function(){return _0xc073('0xd');}},'notificationSound':{'type':Sequelize[_0xc073('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc073('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc073('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc073('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc073('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xc073('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc073('0xe')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xc073('0xf'),'set':function(_0x136153){if(!_0x136153)this['setDataValue'](_0xc073('0x10'),null);this[_0xc073('0x11')](_0xc073('0x12'),_0x136153);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 91595cb..826b040 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 _0xb16e=['client','http','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','get','SmsAccounts','UserProfileResource','destroy','stack','name','send','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','keys','includeAll','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','findOne','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','Applications','account','applications','orderBy','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','MessageSid','sender','text','connectel','clicksend','message_id','plivo','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','CmContact','Contacts','SmsInteraction','interaction','created','autoclose','push','close','unmanaged','SmsMessage','ContactId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','\x0a','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','SmsApplication','bulkCreate','findAndCountAll','priority','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','to\x20is\x20mandatory','List','DESC','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','requestid','statusInt','status_code','groupName','redif','error_code','DELIVERED','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','ACCEPTD','statusGet','message-id','state','addAgents','omit','spread','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./smsAccount.socket','register'];(function(_0x16cf22,_0x504218){var _0x113c09=function(_0x34df3f){while(--_0x34df3f){_0x16cf22['push'](_0x16cf22['shift']());}};_0x113c09(++_0x504218);}(_0xb16e,0x1b4));var _0xeb16=function(_0x77773a,_0x5a7026){_0x77773a=_0x77773a-0x0;var _0x1091a2=_0xb16e[_0x77773a];return _0x1091a2;};'use strict';var emlformat=require(_0xeb16('0x0'));var rimraf=require(_0xeb16('0x1'));var zipdir=require(_0xeb16('0x2'));var jsonpatch=require(_0xeb16('0x3'));var rp=require(_0xeb16('0x4'));var moment=require('moment');var BPromise=require(_0xeb16('0x5'));var Mustache=require(_0xeb16('0x6'));var util=require(_0xeb16('0x7'));var path=require(_0xeb16('0x8'));var sox=require(_0xeb16('0x9'));var csv=require('to-csv');var ejs=require(_0xeb16('0xa'));var fs=require('fs');var fs_extra=require(_0xeb16('0xb'));var _=require(_0xeb16('0xc'));var squel=require(_0xeb16('0xd'));var crypto=require(_0xeb16('0xe'));var jsforce=require(_0xeb16('0xf'));var deskjs=require(_0xeb16('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xeb16('0x11'));var Redis=require(_0xeb16('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xeb16('0x13'));var as=require(_0xeb16('0x14'));var hardwareService=require(_0xeb16('0x15'));var logger=require(_0xeb16('0x16'))('api');var utils=require(_0xeb16('0x17'));var config=require(_0xeb16('0x18'));var licenseUtil=require(_0xeb16('0x19'));var db=require('../../mysqldb')['db'];config[_0xeb16('0x1a')]=_['defaults'](config[_0xeb16('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xeb16('0x1b'))(new Redis(config[_0xeb16('0x1a')]));require(_0xeb16('0x1c'))[_0xeb16('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0xeb16('0x1e')][_0xeb16('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x463d05,_0x22c8c8,_0x2129b5,_0x582241){return new BPromise(function(_0x4f5e67,_0x2ffdd9){var _0x3ac0b7=_0x582241||client;return _0x3ac0b7['request'](_0x463d05,_0x2129b5)['then'](function(_0x1ace77){logger[_0xeb16('0x20')](_0xeb16('0x21'),_0x22c8c8,_0xeb16('0x22'));logger[_0xeb16('0x23')](_0xeb16('0x24'),_0x22c8c8,'request\x20sent',JSON[_0xeb16('0x25')](_0x1ace77));if(_0x1ace77[_0xeb16('0x26')]){if(_0x1ace77['error'][_0xeb16('0x27')]===0x1f4){logger[_0xeb16('0x26')](_0xeb16('0x21'),_0x22c8c8,_0x1ace77[_0xeb16('0x26')][_0xeb16('0x28')]);return _0x2ffdd9(_0x1ace77['error'][_0xeb16('0x28')]);}logger[_0xeb16('0x26')]('SmsAccount,\x20%s,\x20%s',_0x22c8c8,_0x1ace77[_0xeb16('0x26')][_0xeb16('0x28')]);return _0x4f5e67(_0x1ace77[_0xeb16('0x26')][_0xeb16('0x28')]);}else{logger['info'](_0xeb16('0x21'),_0x22c8c8,_0xeb16('0x22'));_0x4f5e67(_0x1ace77[_0xeb16('0x29')][_0xeb16('0x28')]);}})[_0xeb16('0x2a')](function(_0x179b72){logger[_0xeb16('0x26')](_0xeb16('0x21'),_0x22c8c8,_0x179b72);_0x2ffdd9(_0x179b72);});});}function respondWithStatusCode(_0x547914,_0x2b6e86){_0x2b6e86=_0x2b6e86||0xcc;return function(_0x49a531){if(_0x49a531){return _0x547914[_0xeb16('0x2b')](_0x2b6e86);}return _0x547914[_0xeb16('0x2c')](_0x2b6e86)[_0xeb16('0x2d')]();};}function respondWithResult(_0x257855,_0x65c620){_0x65c620=_0x65c620||0xc8;return function(_0x467c85){if(_0x467c85){return _0x257855[_0xeb16('0x2c')](_0x65c620)[_0xeb16('0x2e')](_0x467c85);}};}function respondWithFilteredResult(_0x3523f9,_0x124ddb){return function(_0x1f0612){if(_0x1f0612){var _0x1d9da1=typeof _0x124ddb[_0xeb16('0x2f')]===_0xeb16('0x30')&&typeof _0x124ddb[_0xeb16('0x31')]==='undefined';var _0x5cc601=_0x1f0612[_0xeb16('0x32')];var _0x3ece7a=_0x1d9da1?0x0:_0x124ddb[_0xeb16('0x2f')];var _0x3c0338=_0x1d9da1?_0x1f0612[_0xeb16('0x32')]:_0x124ddb[_0xeb16('0x2f')]+_0x124ddb['limit'];var _0x169ae1;if(_0x3c0338>=_0x5cc601){_0x3c0338=_0x5cc601;_0x169ae1=0xc8;}else{_0x169ae1=0xce;}_0x3523f9['status'](_0x169ae1);return _0x3523f9['set'](_0xeb16('0x33'),_0x3ece7a+'-'+_0x3c0338+'/'+_0x5cc601)[_0xeb16('0x2e')](_0x1f0612);}return null;};}function patchUpdates(_0x3cb190){return function(_0x183af3){try{jsonpatch[_0xeb16('0x34')](_0x183af3,_0x3cb190,!![]);}catch(_0x48efc6){return BPromise[_0xeb16('0x35')](_0x48efc6);}return _0x183af3[_0xeb16('0x36')]();};}function saveUpdates(_0x23801a,_0x243b6a){return function(_0x58e4ef){if(_0x58e4ef){return _0x58e4ef[_0xeb16('0x37')](_0x23801a)[_0xeb16('0x38')](function(_0x1ce8d2){return _0x1ce8d2;});}return null;};}function removeEntity(_0x511623,_0x3fe854){return function(_0x4a92ca){if(_0x4a92ca){return _0x4a92ca['destroy']()[_0xeb16('0x38')](function(){var _0x78b540=_0x4a92ca[_0xeb16('0x39')]({'plain':!![]});var _0x32baad=_0xeb16('0x3a');return db[_0xeb16('0x3b')][_0xeb16('0x3c')]({'where':{'type':_0x32baad,'resourceId':_0x78b540['id']}})[_0xeb16('0x38')](function(){return _0x4a92ca;});})[_0xeb16('0x38')](function(){_0x511623[_0xeb16('0x2c')](0xcc)[_0xeb16('0x2d')]();});}};}function handleEntityNotFound(_0x46c5dc,_0x1a3fe2){return function(_0x2d0d86){if(!_0x2d0d86){_0x46c5dc[_0xeb16('0x2b')](0x194);}return _0x2d0d86;};}function handleError(_0x33be76,_0x220665){_0x220665=_0x220665||0x1f4;return function(_0x572690){logger[_0xeb16('0x26')](_0x572690[_0xeb16('0x3d')]);if(_0x572690[_0xeb16('0x3e')]){delete _0x572690[_0xeb16('0x3e')];}_0x33be76[_0xeb16('0x2c')](_0x220665)[_0xeb16('0x3f')](_0x572690);};}exports['index']=function(_0x37a0ce,_0x24cfb7){var _0x3f11b3={'include':[{'model':db[_0xeb16('0x40')],'as':_0xeb16('0x41')}]},_0x552f6e={},_0x2a1f9c={'count':0x0,'rows':[]};var _0x462f15=_['map'](db[_0xeb16('0x42')][_0xeb16('0x43')],function(_0x431551){return{'name':_0x431551[_0xeb16('0x44')],'type':_0x431551[_0xeb16('0x45')]['key']};});_0x552f6e['model']=_[_0xeb16('0x46')](_0x462f15,_0xeb16('0x3e'));_0x552f6e[_0xeb16('0x47')]=_['keys'](_0x37a0ce[_0xeb16('0x47')]);_0x552f6e[_0xeb16('0x48')]=_[_0xeb16('0x49')](_0x552f6e[_0xeb16('0x4a')],_0x552f6e['query']);_0x3f11b3[_0xeb16('0x4b')]=_[_0xeb16('0x49')](_0x552f6e[_0xeb16('0x4a')],qs['fields'](_0x37a0ce[_0xeb16('0x47')][_0xeb16('0x4c')]));_0x3f11b3[_0xeb16('0x4b')]=_0x3f11b3['attributes'][_0xeb16('0x4d')]?_0x3f11b3[_0xeb16('0x4b')]:_0x552f6e[_0xeb16('0x4a')];if(!_0x37a0ce[_0xeb16('0x47')][_0xeb16('0x4e')](_0xeb16('0x4f'))){_0x3f11b3[_0xeb16('0x31')]=qs['limit'](_0x37a0ce[_0xeb16('0x47')][_0xeb16('0x31')]);_0x3f11b3['offset']=qs['offset'](_0x37a0ce[_0xeb16('0x47')][_0xeb16('0x2f')]);}_0x3f11b3[_0xeb16('0x50')]=qs['sort'](_0x37a0ce['query'][_0xeb16('0x51')]);_0x3f11b3[_0xeb16('0x52')]=qs[_0xeb16('0x48')](_[_0xeb16('0x53')](_0x37a0ce[_0xeb16('0x47')],_0x552f6e[_0xeb16('0x48')]),_0x462f15);if(_0x37a0ce[_0xeb16('0x47')][_0xeb16('0x54')]){_0x3f11b3[_0xeb16('0x52')]=_[_0xeb16('0x55')](_0x3f11b3[_0xeb16('0x52')],{'$or':_[_0xeb16('0x46')](_0x462f15,function(_0x2a591f){if(_0x2a591f['type']!==_0xeb16('0x56')){var _0x29dd06={};_0x29dd06[_0x2a591f[_0xeb16('0x3e')]]={'$like':'%'+_0x37a0ce[_0xeb16('0x47')][_0xeb16('0x54')]+'%'};return _0x29dd06;}})});}_0x3f11b3=_[_0xeb16('0x55')]({},_0x3f11b3,_0x37a0ce[_0xeb16('0x57')]);var _0x148975={'where':_0x3f11b3['where']};return db[_0xeb16('0x42')][_0xeb16('0x32')](_0x148975)['then'](function(_0xb6aa7d){_0x2a1f9c[_0xeb16('0x32')]=_0xb6aa7d;if(_0x37a0ce[_0xeb16('0x47')]['includeAll']){_0x3f11b3[_0xeb16('0x58')]=[{'all':!![]}];}return db[_0xeb16('0x42')][_0xeb16('0x59')](_0x3f11b3);})['then'](function(_0x48aa0a){_0x2a1f9c[_0xeb16('0x5a')]=_0x48aa0a;return _0x2a1f9c;})[_0xeb16('0x38')](respondWithFilteredResult(_0x24cfb7,_0x3f11b3))[_0xeb16('0x2a')](handleError(_0x24cfb7,null));};exports[_0xeb16('0x5b')]=function(_0xe584e4,_0x57334f){var _0x36be3d={'raw':![],'where':{'id':_0xe584e4[_0xeb16('0x5c')]['id']},'include':[{'model':db[_0xeb16('0x40')],'as':'mandatoryDispositionPause'}]},_0x1844b6={};_0x1844b6[_0xeb16('0x4a')]=_[_0xeb16('0x5d')](db[_0xeb16('0x42')][_0xeb16('0x43')]);_0x1844b6[_0xeb16('0x47')]=_[_0xeb16('0x5d')](_0xe584e4[_0xeb16('0x47')]);_0x1844b6[_0xeb16('0x48')]=_[_0xeb16('0x49')](_0x1844b6[_0xeb16('0x4a')],_0x1844b6[_0xeb16('0x47')]);_0x36be3d['attributes']=_[_0xeb16('0x49')](_0x1844b6[_0xeb16('0x4a')],qs[_0xeb16('0x4c')](_0xe584e4[_0xeb16('0x47')][_0xeb16('0x4c')]));_0x36be3d[_0xeb16('0x4b')]=_0x36be3d[_0xeb16('0x4b')]['length']?_0x36be3d[_0xeb16('0x4b')]:_0x1844b6[_0xeb16('0x4a')];if(_0xe584e4[_0xeb16('0x47')][_0xeb16('0x5e')]){_0x36be3d[_0xeb16('0x58')]=[{'all':!![]}];}_0x36be3d=_['merge']({},_0x36be3d,_0xe584e4[_0xeb16('0x57')]);return db[_0xeb16('0x42')][_0xeb16('0x5f')](_0x36be3d)[_0xeb16('0x38')](handleEntityNotFound(_0x57334f,null))['then'](respondWithResult(_0x57334f,null))[_0xeb16('0x2a')](handleError(_0x57334f,null));};exports[_0xeb16('0x60')]=function(_0x19852c,_0x17fd86){return db[_0xeb16('0x42')]['create'](_0x19852c[_0xeb16('0x61')],{})[_0xeb16('0x38')](function(_0x4c7e12){var _0x24d1ef=_0x19852c[_0xeb16('0x62')]['get']({'plain':!![]});if(!_0x24d1ef)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x24d1ef[_0xeb16('0x63')]===_0xeb16('0x62')){var _0x532164=_0x4c7e12['get']({'plain':!![]});var _0x4de8d3=_0xeb16('0x3a');return db[_0xeb16('0x64')][_0xeb16('0x5f')]({'where':{'name':_0x4de8d3,'userProfileId':_0x24d1ef[_0xeb16('0x65')]},'raw':!![]})['then'](function(_0xcb2db8){if(_0xcb2db8&&_0xcb2db8[_0xeb16('0x66')]===0x0){return db[_0xeb16('0x3b')][_0xeb16('0x60')]({'name':_0x532164[_0xeb16('0x3e')],'resourceId':_0x532164['id'],'type':_0xcb2db8['name'],'sectionId':_0xcb2db8['id']},{})[_0xeb16('0x38')](function(){return _0x4c7e12;});}else{return _0x4c7e12;}})[_0xeb16('0x2a')](function(_0x4bbfa4){logger[_0xeb16('0x26')](_0xeb16('0x67'),_0x4bbfa4);throw _0x4bbfa4;});}return _0x4c7e12;})[_0xeb16('0x38')](respondWithResult(_0x17fd86,0xc9))['catch'](handleError(_0x17fd86,null));};exports[_0xeb16('0x37')]=function(_0x50dc7f,_0x354970){if(_0x50dc7f[_0xeb16('0x61')]['id']){delete _0x50dc7f[_0xeb16('0x61')]['id'];}return db[_0xeb16('0x42')][_0xeb16('0x5f')]({'where':{'id':_0x50dc7f[_0xeb16('0x5c')]['id']},'include':[{'model':db[_0xeb16('0x40')],'as':_0xeb16('0x41')}]})[_0xeb16('0x38')](handleEntityNotFound(_0x354970,null))['then'](saveUpdates(_0x50dc7f[_0xeb16('0x61')],null))[_0xeb16('0x38')](respondWithResult(_0x354970,null))[_0xeb16('0x2a')](handleError(_0x354970,null));};exports[_0xeb16('0x3c')]=function(_0x23612c,_0x15fbcb){return db[_0xeb16('0x42')][_0xeb16('0x5f')]({'where':{'id':_0x23612c['params']['id']}})[_0xeb16('0x38')](handleEntityNotFound(_0x15fbcb,null))[_0xeb16('0x38')](removeEntity(_0x15fbcb,null))[_0xeb16('0x2a')](handleError(_0x15fbcb,null));};exports[_0xeb16('0x68')]=function(_0x573bf0,_0x3e107e){return db[_0xeb16('0x42')][_0xeb16('0x68')]()['then'](respondWithResult(_0x3e107e,null))[_0xeb16('0x2a')](handleError(_0x3e107e,null));};exports[_0xeb16('0x69')]=function(_0x57a06c,_0x58ee4d,_0x4daa0e){if(_0x57a06c[_0xeb16('0x61')]['id']){delete _0x57a06c[_0xeb16('0x61')]['id'];}return db[_0xeb16('0x42')]['find']({'where':{'id':_0x57a06c[_0xeb16('0x5c')]['id']}})[_0xeb16('0x38')](handleEntityNotFound(_0x58ee4d,null))[_0xeb16('0x38')](function(_0xa41498){if(_0xa41498){_0x57a06c[_0xeb16('0x61')][_0xeb16('0x6a')]=_0xa41498['id'];return db['Disposition'][_0xeb16('0x60')](_0x57a06c[_0xeb16('0x61')]);}})[_0xeb16('0x38')](respondWithResult(_0x58ee4d,null))[_0xeb16('0x2a')](handleError(_0x58ee4d,null));};exports['getDispositions']=function(_0x27f693,_0x4d97b9,_0x56cb57){var _0x20e962={'raw':![],'where':{}};var _0x1b5792={};var _0x27a079={'count':0x0,'rows':[]};return db[_0xeb16('0x42')][_0xeb16('0x6b')]({'where':{'id':_0x27f693[_0xeb16('0x5c')]['id']}})[_0xeb16('0x38')](handleEntityNotFound(_0x4d97b9,null))[_0xeb16('0x38')](function(_0x1f7efe){if(_0x1f7efe){_0x1b5792['model']=_[_0xeb16('0x5d')](db[_0xeb16('0x6c')][_0xeb16('0x43')]);_0x1b5792[_0xeb16('0x47')]=_[_0xeb16('0x5d')](_0x27f693[_0xeb16('0x47')]);_0x1b5792[_0xeb16('0x48')]=_[_0xeb16('0x49')](_0x1b5792['model'],_0x1b5792['query']);_0x20e962[_0xeb16('0x4b')]=_[_0xeb16('0x49')](_0x1b5792[_0xeb16('0x4a')],qs[_0xeb16('0x4c')](_0x27f693[_0xeb16('0x47')][_0xeb16('0x4c')]));_0x20e962[_0xeb16('0x4b')]=_0x20e962[_0xeb16('0x4b')]['length']?_0x20e962['attributes']:_0x1b5792['model'];if(!_0x27f693[_0xeb16('0x47')]['hasOwnProperty']('nolimit')){_0x20e962[_0xeb16('0x31')]=qs[_0xeb16('0x31')](_0x27f693[_0xeb16('0x47')][_0xeb16('0x31')]);_0x20e962[_0xeb16('0x2f')]=qs[_0xeb16('0x2f')](_0x27f693['query']['offset']);}_0x20e962[_0xeb16('0x50')]=qs[_0xeb16('0x51')](_0x27f693['query'][_0xeb16('0x51')]);_0x20e962[_0xeb16('0x52')]=qs[_0xeb16('0x48')](_[_0xeb16('0x53')](_0x27f693[_0xeb16('0x47')],_0x1b5792['filters']));_0x20e962['where']['SmsAccountId']=_0x1f7efe['id'];if(_0x27f693['query'][_0xeb16('0x54')]){_0x20e962['where']=_[_0xeb16('0x55')](_0x20e962[_0xeb16('0x52')],{'$or':_[_0xeb16('0x46')](_0x20e962[_0xeb16('0x4b')],function(_0x56400f){var _0x2e0bdc={};_0x2e0bdc[_0x56400f]={'$like':'%'+_0x27f693[_0xeb16('0x47')][_0xeb16('0x54')]+'%'};return _0x2e0bdc;})});}_0x20e962=_[_0xeb16('0x55')]({},_0x20e962,_0x27f693[_0xeb16('0x57')]);return db[_0xeb16('0x6c')][_0xeb16('0x32')]({'where':_0x20e962[_0xeb16('0x52')]})[_0xeb16('0x38')](function(_0x8558a2){_0x27a079['count']=_0x8558a2;if(_0x27f693['query'][_0xeb16('0x5e')]){_0x20e962[_0xeb16('0x58')]=[{'all':!![]}];}return db[_0xeb16('0x6c')][_0xeb16('0x59')](_0x20e962);})[_0xeb16('0x38')](function(_0x54b2e1){_0x27a079['rows']=_0x54b2e1;return _0x27a079;});}})[_0xeb16('0x38')](respondWithFilteredResult(_0x4d97b9,_0x20e962))[_0xeb16('0x2a')](handleError(_0x4d97b9,null));};exports[_0xeb16('0x6d')]=function(_0x43f77f,_0x3660fe,_0x569b0f){return db[_0xeb16('0x42')][_0xeb16('0x5f')]({'where':{'id':_0x43f77f['params']['id']}})[_0xeb16('0x38')](handleEntityNotFound(_0x3660fe,null))['then'](function(_0x33cbd6){if(_0x33cbd6){return _0x33cbd6[_0xeb16('0x6d')](_0x43f77f[_0xeb16('0x47')][_0xeb16('0x6e')]);}})[_0xeb16('0x38')](respondWithStatusCode(_0x3660fe,null))['catch'](handleError(_0x3660fe,null));};exports[_0xeb16('0x6f')]=function(_0x2d2790,_0x4a7713,_0x44a5c8){if(_0x2d2790[_0xeb16('0x61')]['id']){delete _0x2d2790[_0xeb16('0x61')]['id'];}return db[_0xeb16('0x42')][_0xeb16('0x5f')]({'where':{'id':_0x2d2790['params']['id']}})[_0xeb16('0x38')](handleEntityNotFound(_0x4a7713,null))['then'](function(_0x4d73c7){if(_0x4d73c7){_0x2d2790[_0xeb16('0x61')][_0xeb16('0x6a')]=_0x4d73c7['id'];return db[_0xeb16('0x70')][_0xeb16('0x60')](_0x2d2790[_0xeb16('0x61')]);}})[_0xeb16('0x38')](respondWithResult(_0x4a7713,null))[_0xeb16('0x2a')](handleError(_0x4a7713,null));};exports[_0xeb16('0x71')]=function(_0x399358,_0xc49fcc,_0x15deb4){var _0x28aa98={'raw':![],'where':{}};var _0x2ab386={};var _0x35c9a8={'count':0x0,'rows':[]};return db[_0xeb16('0x42')][_0xeb16('0x6b')]({'where':{'id':_0x399358[_0xeb16('0x5c')]['id']}})[_0xeb16('0x38')](handleEntityNotFound(_0xc49fcc,null))['then'](function(_0x5bf569){if(_0x5bf569){_0x2ab386[_0xeb16('0x4a')]=_[_0xeb16('0x5d')](db['CannedAnswer'][_0xeb16('0x43')]);_0x2ab386[_0xeb16('0x47')]=_[_0xeb16('0x5d')](_0x399358[_0xeb16('0x47')]);_0x2ab386[_0xeb16('0x48')]=_[_0xeb16('0x49')](_0x2ab386[_0xeb16('0x4a')],_0x2ab386[_0xeb16('0x47')]);_0x28aa98[_0xeb16('0x4b')]=_[_0xeb16('0x49')](_0x2ab386['model'],qs[_0xeb16('0x4c')](_0x399358['query'][_0xeb16('0x4c')]));_0x28aa98[_0xeb16('0x4b')]=_0x28aa98[_0xeb16('0x4b')]['length']?_0x28aa98[_0xeb16('0x4b')]:_0x2ab386[_0xeb16('0x4a')];if(!_0x399358[_0xeb16('0x47')][_0xeb16('0x4e')](_0xeb16('0x4f'))){_0x28aa98[_0xeb16('0x31')]=qs[_0xeb16('0x31')](_0x399358[_0xeb16('0x47')][_0xeb16('0x31')]);_0x28aa98['offset']=qs[_0xeb16('0x2f')](_0x399358[_0xeb16('0x47')][_0xeb16('0x2f')]);}_0x28aa98['order']=qs[_0xeb16('0x51')](_0x399358[_0xeb16('0x47')][_0xeb16('0x51')]);_0x28aa98['where']=qs[_0xeb16('0x48')](_[_0xeb16('0x53')](_0x399358[_0xeb16('0x47')],_0x2ab386[_0xeb16('0x48')]));_0x28aa98[_0xeb16('0x52')]['SmsAccountId']=_0x5bf569['id'];if(_0x399358[_0xeb16('0x47')]['filter']){_0x28aa98[_0xeb16('0x52')]=_[_0xeb16('0x55')](_0x28aa98[_0xeb16('0x52')],{'$or':_['map'](_0x28aa98[_0xeb16('0x4b')],function(_0x2eaa5e){var _0x595d31={};_0x595d31[_0x2eaa5e]={'$like':'%'+_0x399358[_0xeb16('0x47')][_0xeb16('0x54')]+'%'};return _0x595d31;})});}_0x28aa98=_[_0xeb16('0x55')]({},_0x28aa98,_0x399358[_0xeb16('0x57')]);return db[_0xeb16('0x70')][_0xeb16('0x32')]({'where':_0x28aa98[_0xeb16('0x52')]})[_0xeb16('0x38')](function(_0x192094){_0x35c9a8[_0xeb16('0x32')]=_0x192094;if(_0x399358['query'][_0xeb16('0x5e')]){_0x28aa98[_0xeb16('0x58')]=[{'all':!![]}];}return db[_0xeb16('0x70')]['findAll'](_0x28aa98);})[_0xeb16('0x38')](function(_0xab3406){_0x35c9a8['rows']=_0xab3406;return _0x35c9a8;});}})[_0xeb16('0x38')](respondWithFilteredResult(_0xc49fcc,_0x28aa98))['catch'](handleError(_0xc49fcc,null));};exports[_0xeb16('0x72')]=function(_0x57b401,_0x3df8aa,_0x33dbfd){return db[_0xeb16('0x42')][_0xeb16('0x5f')]({'where':{'id':_0x57b401[_0xeb16('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3df8aa,null))[_0xeb16('0x38')](function(_0x55a16a){if(_0x55a16a){return _0x55a16a[_0xeb16('0x72')](_0x57b401['query'][_0xeb16('0x6e')]);}})[_0xeb16('0x38')](respondWithStatusCode(_0x3df8aa,null))[_0xeb16('0x2a')](handleError(_0x3df8aa,null));};exports[_0xeb16('0x73')]=function(_0x3631fd,_0xe1bf6c,_0x13e023){var _0x4d7824={'channel':_0xeb16('0x74')};var _0x1f6fbf=[];var _0x143974=[];var _0x47ae98={};return db['SmsAccount']['find']({'where':{'id':_0x3631fd[_0xeb16('0x5c')]['id']},'include':[{'model':db['SmsApplication'],'as':_0xeb16('0x75')}]})['then'](handleEntityNotFound(_0xe1bf6c,null))['then'](function(_0x4ec1d9){_0x4d7824[_0xeb16('0x76')]=_0x4ec1d9;_0x4d7824[_0xeb16('0x77')]=_[_0xeb16('0x78')](_0x4ec1d9[_0xeb16('0x75')],['priority'],['asc']);if(_0x4d7824[_0xeb16('0x76')]['Applications']){delete _0x4d7824['account'][_0xeb16('0x75')];}return db['CmContact']['describe']();})[_0xeb16('0x38')](function(_0x46ebc2){if(!_0x46ebc2){throw new db[(_0xeb16('0x79'))][(_0xeb16('0x7a'))](_0xeb16('0x7b'));}_0x1f6fbf=_['difference'](_[_0xeb16('0x5d')](_0x46ebc2),[_0xeb16('0x7c'),_0xeb16('0x7d')]);_0x143974=_[_0xeb16('0x7e')](_[_0xeb16('0x5d')](_0x46ebc2),[_0xeb16('0x7c'),_0xeb16('0x7d'),_0xeb16('0x7f'),_0xeb16('0x80')]);_0x4d7824[_0xeb16('0x61')]={'mapKey':_0xeb16('0x81')};if(_0x4d7824[_0xeb16('0x76')][_0xeb16('0x45')]){switch(_0x4d7824[_0xeb16('0x76')][_0xeb16('0x45')]){case _0xeb16('0x82'):_0x4d7824['body'][_0xeb16('0x83')]=_0x3631fd['body'][_0xeb16('0x84')];_0x4d7824[_0xeb16('0x61')][_0xeb16('0x61')]=_0x3631fd['body'][_0xeb16('0x85')];_0x4d7824[_0xeb16('0x61')][_0xeb16('0x86')]=_0x3631fd[_0xeb16('0x61')][_0xeb16('0x87')];break;case'skebby':_0x4d7824[_0xeb16('0x61')][_0xeb16('0x83')]='+'+_0x3631fd['body'][_0xeb16('0x88')];_0x4d7824[_0xeb16('0x61')][_0xeb16('0x61')]=_0x3631fd[_0xeb16('0x61')][_0xeb16('0x89')];break;case _0xeb16('0x8a'):_0x4d7824['body'][_0xeb16('0x83')]=_0x3631fd[_0xeb16('0x61')][_0xeb16('0x83')];_0x4d7824['body'][_0xeb16('0x61')]=_0x3631fd[_0xeb16('0x61')][_0xeb16('0x28')];break;case _0xeb16('0x8b'):_0x4d7824[_0xeb16('0x61')][_0xeb16('0x83')]=_0x3631fd['body']['from'];_0x4d7824[_0xeb16('0x61')][_0xeb16('0x61')]=_0x3631fd[_0xeb16('0x61')][_0xeb16('0x61')];_0x4d7824['body']['messageId']=_0x3631fd[_0xeb16('0x61')][_0xeb16('0x8c')];break;case _0xeb16('0x8d'):_0x4d7824[_0xeb16('0x61')]['from']=_0x3631fd[_0xeb16('0x61')]['From'];_0x4d7824[_0xeb16('0x61')][_0xeb16('0x61')]=_0x3631fd['body']['Text'];_0x4d7824[_0xeb16('0x61')]['messageId']=_0x3631fd[_0xeb16('0x61')][_0xeb16('0x8e')];break;case _0xeb16('0x8f'):_0x4d7824[_0xeb16('0x61')][_0xeb16('0x83')]='+'+_0x3631fd[_0xeb16('0x61')][_0xeb16('0x90')][0x0][_0xeb16('0x83')];_0x4d7824['body'][_0xeb16('0x61')]=_0x3631fd[_0xeb16('0x61')][_0xeb16('0x90')][0x0]['text'];_0x4d7824['body']['messageId']=_0x3631fd['body']['results'][0x0][_0xeb16('0x86')];break;case _0xeb16('0x91'):_0x4d7824[_0xeb16('0x61')][_0xeb16('0x83')]=_0x3631fd[_0xeb16('0x61')][_0xeb16('0x92')];_0x4d7824['body'][_0xeb16('0x61')]=_0x3631fd['body'][_0xeb16('0x93')]['message'];break;case _0xeb16('0x94'):_0x4d7824[_0xeb16('0x61')]['from']=_0x3631fd[_0xeb16('0x61')][_0xeb16('0x95')];_0x4d7824[_0xeb16('0x61')]['body']=_0x3631fd[_0xeb16('0x61')]['text'];_0x4d7824['body'][_0xeb16('0x86')]=_0x3631fd[_0xeb16('0x61')]['replyMessageId'];break;case _0xeb16('0x96'):_0x4d7824['body'][_0xeb16('0x86')]=_0x3631fd[_0xeb16('0x61')][0x0][_0xeb16('0x28')]['id'];_0x4d7824[_0xeb16('0x61')][_0xeb16('0x83')]=_0x3631fd[_0xeb16('0x61')][0x0][_0xeb16('0x28')][_0xeb16('0x83')];_0x4d7824['body'][_0xeb16('0x61')]=_0x3631fd[_0xeb16('0x61')][0x0]['message'][_0xeb16('0x89')];break;case _0xeb16('0x97'):_0x4d7824[_0xeb16('0x61')]['from']=_0x3631fd['body'][_0xeb16('0x83')];_0x4d7824[_0xeb16('0x61')][_0xeb16('0x61')]=_0x3631fd[_0xeb16('0x61')][_0xeb16('0x28')];_0x4d7824['body'][_0xeb16('0x86')]=_0x3631fd['body'][_0xeb16('0x98')];break;}}if(_0x4d7824[_0xeb16('0x61')]['id']){delete _0x4d7824[_0xeb16('0x61')]['id'];}if(_[_0xeb16('0x99')](_0x4d7824['body']['from'])){throw new db[(_0xeb16('0x79'))][(_0xeb16('0x7a'))](_0xeb16('0x9a'));}if(_[_0xeb16('0x99')](_0x4d7824[_0xeb16('0x61')][_0xeb16('0x61')])||_0x4d7824[_0xeb16('0x61')][_0xeb16('0x61')]===''){throw new db[(_0xeb16('0x79'))][(_0xeb16('0x7a'))](_0xeb16('0x9b'));}if(_[_0xeb16('0x99')](_0x4d7824[_0xeb16('0x61')][_0xeb16('0x9c')])){throw new db[(_0xeb16('0x79'))][(_0xeb16('0x7a'))](_0xeb16('0x9d')+_0x143974);}if(!_[_0xeb16('0x9e')](_0x143974,_0x4d7824[_0xeb16('0x61')]['mapKey'])){throw new db[(_0xeb16('0x79'))][(_0xeb16('0x7a'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x143974);}_0x47ae98[_0x4d7824[_0xeb16('0x61')][_0xeb16('0x9c')]]=_0x4d7824[_0xeb16('0x61')][_0xeb16('0x83')];return db[_0xeb16('0x9f')][_0xeb16('0x5f')]({'where':{'id':_0x4d7824[_0xeb16('0x76')][_0xeb16('0x80')]},'include':[{'model':db[_0xeb16('0xa0')],'as':_0xeb16('0xa1'),'where':_0x47ae98,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0xeb16('0x38')](handleEntityNotFound(_0xe1bf6c,null))[_0xeb16('0x38')](function(_0x4337e1){if(_0x4337e1){_0x4d7824['list']=_['omit'](_0x4337e1,[_0xeb16('0xa1')]);if(_0x4337e1[_0xeb16('0xa1')][_0xeb16('0x4d')]){return _0x4337e1[_0xeb16('0xa1')][0x0];}var _0x51b4ea=_['defaults'](_0x4d7824[_0xeb16('0x61')],{'firstName':_0x4d7824[_0xeb16('0x61')]['from'],'ListId':_0x4337e1['id']});_0x51b4ea[_0x4d7824[_0xeb16('0x61')][_0xeb16('0x9c')]]=_0x4d7824[_0xeb16('0x61')][_0xeb16('0x83')];return db[_0xeb16('0xa0')][_0xeb16('0x60')](_0x51b4ea,{'fields':_0x1f6fbf,'raw':!![]});}})['then'](handleEntityNotFound(_0xe1bf6c,null))['then'](function(_0x506906){if(_0x506906){_0x4d7824['contact']=_0x506906;var _0x223797={'ContactId':_0x506906['id'],'phone':_0x4d7824[_0xeb16('0x61')][_0xeb16('0x83')],'SmsAccountId':_0x3631fd[_0xeb16('0x5c')]['id']};var _0x38b9d3={'ContactId':_0x506906['id'],'SmsAccountId':_0x3631fd['params']['id'],'closed':![]};return db['SmsInteraction'][_0xeb16('0x5f')]({'where':_0x38b9d3})[_0xeb16('0x38')](function(_0xfe93d4){if(_0xfe93d4){return[_0xfe93d4,![]];}return db[_0xeb16('0xa2')][_0xeb16('0x60')](_0x223797)['then'](function(_0x1a5bb4){return[_0x1a5bb4,!![]];});});}})['spread'](function(_0x4f39fb,_0x4b2aeb){_0x4d7824[_0xeb16('0xa3')]=_0x4f39fb[_0xeb16('0x39')]({'plain':!![]});_0x4d7824['interaction'][_0xeb16('0xa4')]=![];if(_0x4b2aeb){if(_0x4d7824[_0xeb16('0x76')][_0xeb16('0xa5')]){_0x4d7824[_0xeb16('0x77')][_0xeb16('0xa6')]({'id':0x0,'priority':_0x4d7824[_0xeb16('0x77')][_0xeb16('0x4d')]+0x1,'app':_0xeb16('0xa7'),'appdata':_0xeb16('0xa8'),'interval':'*,*,*,*'});}_0x4d7824[_0xeb16('0xa3')][_0xeb16('0xa4')]=!![];}return db[_0xeb16('0xa9')][_0xeb16('0x60')]({'phone':_0x4d7824['body'][_0xeb16('0x83')],'messageId':_0x4d7824[_0xeb16('0x61')][_0xeb16('0x86')],'body':_0x4d7824['body']['body'],'SmsAccountId':_0x3631fd['params']['id'],'SmsInteractionId':_0x4f39fb['id'],'direction':'in','ContactId':_0x4f39fb[_0xeb16('0xaa')],'AttachmentId':_0x4d7824[_0xeb16('0x61')]['AttachmentId']});})[_0xeb16('0x38')](function(_0xdcfcfc){_0x4d7824['message']=_0xdcfcfc;if(_0x4d7824[_0xeb16('0xa3')][_0xeb16('0xab')]){return db[_0xeb16('0xac')][_0xeb16('0x5f')]({'attributes':['id',_0xeb16('0x3e')],'where':{'id':_0x4d7824[_0xeb16('0xa3')][_0xeb16('0xab')]}})[_0xeb16('0x38')](function(_0x216b34){if(_0x216b34){_0x4d7824[_0xeb16('0x77')][_0xeb16('0xad')]({'id':0x0,'priority':0x0,'app':_0xeb16('0xae'),'appdata':_0x216b34[_0xeb16('0x3e')]+','+(_0x4d7824[_0xeb16('0x76')][_0xeb16('0xaf')]||0xa),'interval':_0xeb16('0xb0')});}return respondWithRpcPromise(_0xeb16('0xb1'),_0xeb16('0xb2'),_0x4d7824);});}return respondWithRpcPromise(_0xeb16('0xb1'),_0xeb16('0xb2'),_0x4d7824);})[_0xeb16('0x38')](function(_0x40db30){if(_0x40db30){var _0x23b15a=0xc8;var _0x187487='receiveMessage';logger['info'](_0xeb16('0x24'),_0x187487,_0x23b15a,'entity\x20found');logger['debug'](_0xeb16('0xb3'),_0x187487,_0x23b15a,'entity\x20found',JSON[_0xeb16('0x25')](_0x40db30));if(_0x4d7824[_0xeb16('0x76')][_0xeb16('0x45')]==='twilio'){return _0xe1bf6c[_0xeb16('0x2c')](_0x23b15a)['set'](_0xeb16('0xb4'),'text/xml')[_0xeb16('0x3f')](_0xeb16('0xb5'));}else{return _0xe1bf6c[_0xeb16('0x2c')](_0x23b15a)[_0xeb16('0x2e')](_0x40db30);}}})[_0xeb16('0x2a')](handleError(_0xe1bf6c,null));};exports[_0xeb16('0xb6')]=function(_0x714e4,_0x218d14){var _0x103286=_0x714e4[_0xeb16('0x5c')]['id'];var _0x5f3f9a=_0x714e4[_0xeb16('0x61')];var _0x5b658b=0xc8;var _0xa86c9c=null;return db[_0xeb16('0xb7')][_0xeb16('0xb8')]({'isolationLevel':db[_0xeb16('0xb7')][_0xeb16('0xb9')][_0xeb16('0xba')]['READ_COMMITTED']},function(_0x3f3467){return db[_0xeb16('0x42')]['findOne']({'where':{'id':_0x103286},'transaction':_0x3f3467})[_0xeb16('0x38')](function(_0x55f0a6){if(_0x55f0a6){return db[_0xeb16('0xbb')]['destroy']({'where':{'SmsAccountId':_0x103286},'transaction':_0x3f3467})[_0xeb16('0x38')](function(){var _0xa854a8=_['map'](_0x5f3f9a,function(_0x5855c0){_0x5855c0[_0xeb16('0x6a')]=_0x103286;return _0x5855c0;});return db[_0xeb16('0xbb')][_0xeb16('0xbc')](_0xa854a8,{'transaction':_0x3f3467});});}else{_0x5b658b=0x194;_0xa86c9c=[];}});})['then'](function(){if(_0x5b658b!==0x194){return db[_0xeb16('0xbb')][_0xeb16('0xbd')]({'where':{'SmsAccountId':_0x103286},'order':_0xeb16('0xbe')})[_0xeb16('0x38')](function(_0x5b7e83){_0xa86c9c=_0x5b7e83;});}})[_0xeb16('0x2a')](function(_0xdf458c){_0x5b658b=0x1f4;logger[_0xeb16('0x26')](_0xdf458c[_0xeb16('0x3d')]);if(_0xdf458c[_0xeb16('0x3e')]){delete _0xdf458c[_0xeb16('0x3e')];}_0xa86c9c=_0xdf458c;})['finally'](function(){if(_0xa86c9c===null){_0x218d14[_0xeb16('0x2b')](_0x5b658b);}else{if(_0x5b658b===0x1f4){_0x218d14[_0xeb16('0x2c')](_0x5b658b)['send'](_0xa86c9c);}else{_0x218d14[_0xeb16('0x2c')](_0x5b658b)[_0xeb16('0x2e')](_0xa86c9c);}}});};exports[_0xeb16('0xbf')]=function(_0x55cd88,_0x2ecf69,_0x3b7279){var _0x39cf1e={};var _0x289c03={};var _0x37b02c;var _0x51f83b;return db[_0xeb16('0x42')][_0xeb16('0x6b')]({'where':{'id':_0x55cd88[_0xeb16('0x5c')]['id']}})[_0xeb16('0x38')](handleEntityNotFound(_0x2ecf69,null))[_0xeb16('0x38')](function(_0x42b20e){if(_0x42b20e){_0x37b02c=_0x42b20e;_0x289c03['model']=_[_0xeb16('0x5d')](db[_0xeb16('0xbb')]['rawAttributes']);_0x289c03[_0xeb16('0x47')]=_[_0xeb16('0x5d')](_0x55cd88['query']);_0x289c03['filters']=_['intersection'](_0x289c03[_0xeb16('0x4a')],_0x289c03[_0xeb16('0x47')]);_0x39cf1e['attributes']=_['intersection'](_0x289c03[_0xeb16('0x4a')],qs[_0xeb16('0x4c')](_0x55cd88[_0xeb16('0x47')][_0xeb16('0x4c')]));_0x39cf1e[_0xeb16('0x4b')]=_0x39cf1e['attributes'][_0xeb16('0x4d')]?_0x39cf1e[_0xeb16('0x4b')]:_0x289c03[_0xeb16('0x4a')];_0x39cf1e['order']=qs[_0xeb16('0x51')](_0x55cd88[_0xeb16('0x47')][_0xeb16('0x51')]);_0x39cf1e[_0xeb16('0x52')]=qs[_0xeb16('0x48')](_[_0xeb16('0x53')](_0x55cd88[_0xeb16('0x47')],_0x289c03[_0xeb16('0x48')]));if(_0x55cd88[_0xeb16('0x47')][_0xeb16('0x54')]){_0x39cf1e[_0xeb16('0x52')]=_[_0xeb16('0x55')](_0x39cf1e[_0xeb16('0x52')],{'$or':_[_0xeb16('0x46')](_0x39cf1e[_0xeb16('0x4b')],function(_0x495649){var _0x585c13={};_0x585c13[_0x495649]={'$like':'%'+_0x55cd88[_0xeb16('0x47')][_0xeb16('0x54')]+'%'};return _0x585c13;})});}_0x39cf1e=_[_0xeb16('0x55')]({},_0x39cf1e,_0x55cd88[_0xeb16('0x57')]);return _0x37b02c[_0xeb16('0xbf')](_0x39cf1e);}})[_0xeb16('0x38')](function(_0x10bf55){if(_0x10bf55){_0x51f83b=_0x10bf55['length'];if(!_0x55cd88[_0xeb16('0x47')][_0xeb16('0x4e')](_0xeb16('0x4f'))){_0x39cf1e[_0xeb16('0x31')]=qs[_0xeb16('0x31')](_0x55cd88[_0xeb16('0x47')][_0xeb16('0x31')]);_0x39cf1e[_0xeb16('0x2f')]=qs[_0xeb16('0x2f')](_0x55cd88[_0xeb16('0x47')][_0xeb16('0x2f')]);}return _0x37b02c['getApplications'](_0x39cf1e);}})[_0xeb16('0x38')](function(_0x2c254a){if(_0x2c254a){return _0x2c254a?{'count':_0x51f83b,'rows':_0x2c254a}:null;}})[_0xeb16('0x38')](respondWithResult(_0x2ecf69,null))['catch'](handleError(_0x2ecf69,null));};exports[_0xeb16('0xc0')]=function(_0x15bfbc,_0x50bc77,_0x10bd4a){var _0x361489={'raw':![],'where':{}};var _0x5ab03a={};var _0x4dffe8={'count':0x0,'rows':[]};return db[_0xeb16('0x42')][_0xeb16('0x6b')]({'where':{'id':_0x15bfbc['params']['id']}})[_0xeb16('0x38')](handleEntityNotFound(_0x50bc77,null))[_0xeb16('0x38')](function(_0x306ab9){if(_0x306ab9){_0x5ab03a[_0xeb16('0x4a')]=_[_0xeb16('0x5d')](db[_0xeb16('0xa2')][_0xeb16('0x43')]);_0x5ab03a[_0xeb16('0x47')]=_['keys'](_0x15bfbc[_0xeb16('0x47')]);_0x5ab03a[_0xeb16('0x48')]=_[_0xeb16('0x49')](_0x5ab03a['model'],_0x5ab03a['query']);_0x361489[_0xeb16('0x4b')]=_[_0xeb16('0x49')](_0x5ab03a[_0xeb16('0x4a')],qs[_0xeb16('0x4c')](_0x15bfbc[_0xeb16('0x47')]['fields']));_0x361489[_0xeb16('0x4b')]=_0x361489[_0xeb16('0x4b')][_0xeb16('0x4d')]?_0x361489[_0xeb16('0x4b')]:_0x5ab03a[_0xeb16('0x4a')];if(!_0x15bfbc[_0xeb16('0x47')][_0xeb16('0x4e')](_0xeb16('0x4f'))){_0x361489[_0xeb16('0x31')]=qs['limit'](_0x15bfbc[_0xeb16('0x47')][_0xeb16('0x31')]);_0x361489[_0xeb16('0x2f')]=qs[_0xeb16('0x2f')](_0x15bfbc[_0xeb16('0x47')][_0xeb16('0x2f')]);}_0x361489[_0xeb16('0x50')]=qs[_0xeb16('0x51')](_0x15bfbc[_0xeb16('0x47')][_0xeb16('0x51')]);_0x361489['where']=qs[_0xeb16('0x48')](_[_0xeb16('0x53')](_0x15bfbc[_0xeb16('0x47')],_0x5ab03a[_0xeb16('0x48')]));_0x361489[_0xeb16('0x52')][_0xeb16('0x6a')]=_0x306ab9['id'];if(_0x15bfbc['query'][_0xeb16('0x54')]){_0x361489[_0xeb16('0x52')]=_[_0xeb16('0x55')](_0x361489[_0xeb16('0x52')],{'$or':_['map'](_0x361489[_0xeb16('0x4b')],function(_0x51f0d2){var _0x53db4e={};_0x53db4e[_0x51f0d2]={'$like':'%'+_0x15bfbc[_0xeb16('0x47')][_0xeb16('0x54')]+'%'};return _0x53db4e;})});}_0x361489=_[_0xeb16('0x55')]({},_0x361489,_0x15bfbc[_0xeb16('0x57')]);return db[_0xeb16('0xa2')][_0xeb16('0x32')]({'where':_0x361489[_0xeb16('0x52')]})[_0xeb16('0x38')](function(_0x48b9d2){_0x4dffe8[_0xeb16('0x32')]=_0x48b9d2;if(_0x15bfbc['query'][_0xeb16('0x5e')]){_0x361489[_0xeb16('0x58')]=[{'model':db['CmContact'],'as':_0xeb16('0xc1'),'required':![]},{'model':db[_0xeb16('0xac')],'as':_0xeb16('0xc2'),'attributes':[_0xeb16('0x3e'),_0xeb16('0xc3'),_0xeb16('0xc4')],'required':![]},{'model':db[_0xeb16('0xc5')],'as':_0xeb16('0xc6'),'attributes':['id',_0xeb16('0x3e'),'color'],'where':_0x15bfbc[_0xeb16('0x47')][_0xeb16('0xc7')]?{'id':_0x15bfbc['query'][_0xeb16('0xc7')]}:undefined,'required':_0x15bfbc[_0xeb16('0x47')]['tag']?!![]:![]}];}return db[_0xeb16('0xa2')]['findAll'](_0x361489);})['then'](function(_0x42feeb){_0x4dffe8[_0xeb16('0x5a')]=_0x42feeb;return _0x4dffe8;});}})[_0xeb16('0x38')](respondWithFilteredResult(_0x50bc77,_0x361489))[_0xeb16('0x2a')](handleError(_0x50bc77,null));};exports[_0xeb16('0x3f')]=function(_0x35caeb,_0x1755ee,_0xa5580c){var _0x2885f0,_0x13d80b,_0x5954ba;if(_[_0xeb16('0x99')](_0x35caeb[_0xeb16('0x61')][_0xeb16('0x61')])||_0x35caeb['body'][_0xeb16('0x61')]===''){throw new db[(_0xeb16('0x79'))]['ValidationError'](_0xeb16('0x9b'));}if(_[_0xeb16('0x99')](_0x35caeb[_0xeb16('0x61')]['to'])){throw new db[(_0xeb16('0x79'))][(_0xeb16('0x7a'))](_0xeb16('0xc8'));}_0x2885f0=_0x35caeb[_0xeb16('0x61')]['to'];return db[_0xeb16('0x42')][_0xeb16('0x5f')]({'where':{'id':_0x35caeb[_0xeb16('0x5c')]['id']},'include':[{'model':db[_0xeb16('0x9f')],'as':_0xeb16('0xc9'),'include':[{'model':db[_0xeb16('0xa0')],'as':'Contacts','where':{'mobile':_0x2885f0},'limit':0x1,'order':[[_0xeb16('0x7d'),_0xeb16('0xca')]]}]}]})[_0xeb16('0x38')](handleEntityNotFound(_0x1755ee,null))[_0xeb16('0x38')](function(_0x5dc0a4){if(_0x5dc0a4&&_0x5dc0a4[_0xeb16('0xc9')]){_0x13d80b=_0x5dc0a4['get']({'plain':!![]});if(_0x13d80b[_0xeb16('0xc9')]&&_0x13d80b[_0xeb16('0xc9')][_0xeb16('0xa1')][_0xeb16('0x4d')]){return _0x13d80b['List'][_0xeb16('0xa1')][0x0];}return db[_0xeb16('0xa0')][_0xeb16('0x60')](_['defaults'](_0x35caeb[_0xeb16('0x61')],{'firstName':_0x2885f0,'mobile':_0x2885f0,'phone':_0x2885f0,'ListId':_0x13d80b['ListId']}));}})[_0xeb16('0x38')](handleEntityNotFound(_0x1755ee,null))[_0xeb16('0x38')](function(_0x2f99b7){if(_0x2f99b7){_0x5954ba=_0x2f99b7;return db['SmsInteraction'][_0xeb16('0x5f')]({'where':{'ContactId':_0x5954ba['id'],'closed':![],'SmsAccountId':_0x13d80b['id']}})[_0xeb16('0x38')](function(_0x43ca6b){if(_0x43ca6b){return[_0x43ca6b,![]];}return db[_0xeb16('0xa2')][_0xeb16('0x60')]({'UserId':_0x35caeb[_0xeb16('0x62')]['id'],'ContactId':_0x5954ba['id'],'SmsAccountId':_0x13d80b['id'],'phone':_0x2885f0,'firstMsgDirection':_0xeb16('0xcb'),'Messages':[_[_0xeb16('0x55')](_0x35caeb['body'],{'read':![],'body':_0x35caeb[_0xeb16('0x61')][_0xeb16('0x61')],'phone':_0x2885f0,'SmsAccountId':_0x13d80b['id'],'UserId':_0x35caeb[_0xeb16('0x62')]['id'],'ContactId':_0x5954ba['id']})]},{'include':[{'model':db[_0xeb16('0xa9')],'as':_0xeb16('0xcc')}]})[_0xeb16('0x38')](function(_0x151756){return[_0x151756,!![]];});});}})['spread'](function(_0x4c8abf,_0x6da026){if(_0x6da026){return _0x4c8abf;}return db[_0xeb16('0xa9')][_0xeb16('0x60')](_[_0xeb16('0x55')](_0x35caeb[_0xeb16('0x61')],{'read':![],'body':_0x35caeb[_0xeb16('0x61')][_0xeb16('0x61')],'phone':_0x2885f0,'SmsAccountId':_0x13d80b['id'],'SmsInteractionId':_0x4c8abf['id'],'UserId':_0x35caeb[_0xeb16('0x62')]['id'],'ContactId':_0x5954ba['id']}))['then'](function(_0x49a334){_0x4c8abf[_0xeb16('0xcd')][_0xeb16('0xcc')]=[];_0x4c8abf[_0xeb16('0xcd')]['Messages'][_0xeb16('0xa6')](_0x49a334[_0xeb16('0xcd')]);return _0x4c8abf;});})['then'](respondWithResult(_0x1755ee,null))['catch'](handleError(_0x1755ee,null));};exports[_0xeb16('0x2c')]=function(_0x221069,_0x5e5c1c,_0x206332){if(_0x221069[_0xeb16('0x61')]['id']){delete _0x221069[_0xeb16('0x61')]['id'];}var _0x4ea0e7,_0x43e9b6,_0x150604;return db[_0xeb16('0x42')]['find']({'where':{'id':_0x221069[_0xeb16('0x5c')]['id']}})[_0xeb16('0x38')](handleEntityNotFound(_0x5e5c1c,null))[_0xeb16('0x38')](function(_0x44a58f){if(_0x44a58f){_0x150604=_0x44a58f;logger[_0xeb16('0x23')](_0xeb16('0x24'),_0xeb16('0x2c'),_0xeb16('0xce'),_0x44a58f['type'],util[_0xeb16('0xcf')](_0x221069['body'],{'showHidden':![],'depth':null}));switch(_0x44a58f[_0xeb16('0x45')]){case _0xeb16('0xd0'):if(_0x221069[_0xeb16('0x61')][_0xeb16('0xd1')]&&_0x221069['body'][_0xeb16('0x2c')]){_0x43e9b6=_0x221069['body'][_0xeb16('0x2c')];return db[_0xeb16('0xa9')][_0xeb16('0x5f')]({'where':{'messageId':_0x221069[_0xeb16('0x61')][_0xeb16('0xd1')]}});}break;case'connectel':if(_0x221069[_0xeb16('0x61')][_0xeb16('0xd2')]&&_0x221069[_0xeb16('0x61')][_0xeb16('0xd3')]){_0x43e9b6=_0x221069[_0xeb16('0x61')]['statusInt'];return db[_0xeb16('0xa9')][_0xeb16('0x5f')]({'where':{'messageId':_0x221069[_0xeb16('0x61')][_0xeb16('0xd2')]}});}break;case _0xeb16('0x8b'):if(_0x221069[_0xeb16('0x61')][_0xeb16('0x8c')]&&_0x221069[_0xeb16('0x61')][_0xeb16('0xd4')]){_0x43e9b6=_0x221069['body'][_0xeb16('0xd4')];return db[_0xeb16('0xa9')][_0xeb16('0x5f')]({'where':{'messageId':_0x221069[_0xeb16('0x61')][_0xeb16('0x8c')]}});}break;case'infobip':var _0x18fc14=_0x221069[_0xeb16('0x61')]['results'][0x0];if(_0x18fc14[_0xeb16('0x86')]&&_0x18fc14['status'][_0xeb16('0xd5')]==='DELIVERED'){_0x43e9b6=_0x18fc14[_0xeb16('0x2c')]['groupName'];return db[_0xeb16('0xa9')][_0xeb16('0x5f')]({'where':{'messageId':_0x18fc14[_0xeb16('0x86')]}});}break;case _0xeb16('0x94'):if(_0x221069['body'][_0xeb16('0x86')]&&_0x221069[_0xeb16('0x61')][_0xeb16('0x2c')]){_0x43e9b6=_0x221069[_0xeb16('0x61')][_0xeb16('0x2c')];return db[_0xeb16('0xa9')][_0xeb16('0x5f')]({'where':{'messageId':_0x221069[_0xeb16('0x61')][_0xeb16('0x86')]}});}break;case _0xeb16('0x96'):if(_0x221069['body'][0x0][_0xeb16('0x28')]['id']){_0x43e9b6=_0x221069[_0xeb16('0x61')][0x0]['type'];return db[_0xeb16('0xa9')][_0xeb16('0x5f')]({'where':{'messageId':_0x221069[_0xeb16('0x61')][0x0][_0xeb16('0x28')]['id']}});}break;case _0xeb16('0x97'):if(_0x221069[_0xeb16('0x61')][_0xeb16('0xd6')]&&_0x221069[_0xeb16('0x61')][_0xeb16('0x2c')]){_0x43e9b6=_0x221069[_0xeb16('0x61')]['status'];return db[_0xeb16('0xa9')][_0xeb16('0x5f')]({'where':{'messageId':_0x221069[_0xeb16('0x61')][_0xeb16('0xd6')]}});}break;}}})['then'](handleEntityNotFound(_0x5e5c1c,null))['then'](function(_0x4261a0){if(_0x4261a0){_0x4ea0e7=_0x4261a0;switch(_0x150604[_0xeb16('0x45')]){case'skebby':if(_0x43e9b6==='DELIVERED'){return _0x4ea0e7['update']({'read':!![]});}else{logger[_0xeb16('0x26')](_0xeb16('0x24'),'status',_0xeb16('0xd0'),util[_0xeb16('0xcf')](_0x221069[_0xeb16('0x61')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x43e9b6==='1'){return _0x4ea0e7[_0xeb16('0x37')]({'read':!![]});}else{logger[_0xeb16('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xeb16('0x2c'),_0xeb16('0xd0'),util[_0xeb16('0xcf')](_0x221069[_0xeb16('0x61')],{'showHidden':![],'depth':null}));}break;case _0xeb16('0x8b'):if(!_0x221069[_0xeb16('0x61')][_0xeb16('0xd7')]&&_0x43e9b6>=0xc8&&_0x43e9b6<=0xce){return _0x4ea0e7[_0xeb16('0x37')]({'read':!![]});}else{logger[_0xeb16('0x26')](_0xeb16('0x24'),_0xeb16('0x2c'),'clicksend',util[_0xeb16('0xcf')](_0x221069[_0xeb16('0x61')],{'showHidden':![],'depth':null}));}break;case _0xeb16('0x8f'):var _0x53c1ff=_0x221069[_0xeb16('0x61')][_0xeb16('0x90')][0x0];if(_0x53c1ff[_0xeb16('0x2c')]['groupName']===_0xeb16('0xd8')){return _0x4ea0e7[_0xeb16('0x37')]({'read':!![]});}else{logger[_0xeb16('0x26')](_0xeb16('0x24'),_0xeb16('0x2c'),_0xeb16('0x8f'),util[_0xeb16('0xcf')](_0x221069['body'],{'showHidden':![],'depth':null}));}break;case _0xeb16('0x94'):if(_0x43e9b6==_0xeb16('0xd9')||_0x43e9b6==_0xeb16('0xda')){return _0x4ea0e7[_0xeb16('0x37')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xeb16('0x2c'),_0xeb16('0x94'),util['inspect'](_0x221069[_0xeb16('0x61')],{'showHidden':![],'depth':null}));}break;case _0xeb16('0x96'):if(_0x43e9b6==_0xeb16('0xdb')){return _0x4ea0e7['update']({'read':!![]});}else{logger[_0xeb16('0x26')](_0xeb16('0x24'),_0xeb16('0x2c'),_0xeb16('0x96'),util[_0xeb16('0xcf')](_0x221069[_0xeb16('0x61')],{'showHidden':![],'depth':null}));}break;case _0xeb16('0x97'):if(_0x43e9b6==='DELIVRD'||_0x43e9b6===_0xeb16('0xdc')){return _0x4ea0e7[_0xeb16('0x37')]({'read':!![]});}else{logger[_0xeb16('0x26')](_0xeb16('0x24'),_0xeb16('0x2c'),'intelepeer',util[_0xeb16('0xcf')](_0x221069['body'],{'showHidden':![],'depth':null}));}break;}return _0x4ea0e7;}})[_0xeb16('0x38')](respondWithResult(_0x5e5c1c,null))[_0xeb16('0x2a')](handleError(_0x5e5c1c,null));};exports[_0xeb16('0xdd')]=function(_0x27c2f1,_0x140c6c,_0x4b9b70){var _0x5ed8be,_0xfc282,_0x4a2aac;return db[_0xeb16('0x42')]['find']({'where':{'id':_0x27c2f1['params']['id']}})[_0xeb16('0x38')](handleEntityNotFound(_0x140c6c,null))['then'](function(_0x5e46b7){if(_0x5e46b7){_0x4a2aac=_0x5e46b7;logger[_0xeb16('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xeb16('0x2c'),_0xeb16('0xce'),_0x5e46b7[_0xeb16('0x45')],util[_0xeb16('0xcf')](_0x27c2f1[_0xeb16('0x47')],{'showHidden':![],'depth':null}));switch(_0x5e46b7[_0xeb16('0x45')]){case'csc':if(_0x27c2f1[_0xeb16('0x47')][_0xeb16('0xde')]&&_0x27c2f1[_0xeb16('0x47')][_0xeb16('0xdf')]){_0xfc282=_0x27c2f1[_0xeb16('0x47')]['state'];return db['SmsMessage'][_0xeb16('0x5f')]({'where':{'messageId':_0x27c2f1[_0xeb16('0x47')][_0xeb16('0xde')]}});}break;}}})['then'](handleEntityNotFound(_0x140c6c,null))['then'](function(_0x59bf75){if(_0x59bf75){_0x5ed8be=_0x59bf75;switch(_0x4a2aac['type']){case _0xeb16('0x91'):if(_0xfc282==='2'||_0xfc282==='6'){return _0x5ed8be[_0xeb16('0x37')]({'read':!![]});}else{logger[_0xeb16('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xeb16('0x2c'),_0xeb16('0x91'),util[_0xeb16('0xcf')](_0x27c2f1['query'],{'showHidden':![],'depth':null}));};break;}return _0x5ed8be;}})[_0xeb16('0x38')](respondWithResult(_0x140c6c,null))['catch'](handleError(_0x140c6c,null));};exports[_0xeb16('0xe0')]=function(_0x3a3991,_0x2c3257,_0x517b43){return db['SmsAccount'][_0xeb16('0x5f')]({'where':{'id':_0x3a3991['params']['id']}})[_0xeb16('0x38')](handleEntityNotFound(_0x2c3257,null))['then'](function(_0x1b69b6){if(_0x1b69b6){return _0x1b69b6['addAgents'](_0x3a3991[_0xeb16('0x61')][_0xeb16('0x6e')],_[_0xeb16('0xe1')](_0x3a3991[_0xeb16('0x61')],['ids','id'])||{})[_0xeb16('0xe2')](function(_0x13fee6){for(var _0x341142=0x0;_0x341142<_0x3a3991[_0xeb16('0x61')][_0xeb16('0x6e')][_0xeb16('0x4d')];_0x341142+=0x1){socket['emit'](_0xeb16('0xe3'),{'UserId':Number(_0x3a3991['body'][_0xeb16('0x6e')][_0x341142]),'SmsAccountId':Number(_0x3a3991[_0xeb16('0x5c')]['id'])});}return _0x13fee6;});}})[_0xeb16('0x38')](respondWithResult(_0x2c3257,null))[_0xeb16('0x2a')](handleError(_0x2c3257,null));};exports[_0xeb16('0xe4')]=function(_0x7897db,_0x19984a,_0x4c7dbe){return db[_0xeb16('0x42')][_0xeb16('0x5f')]({'where':{'id':_0x7897db[_0xeb16('0x5c')]['id']}})[_0xeb16('0x38')](handleEntityNotFound(_0x19984a,null))[_0xeb16('0x38')](function(_0x45b807){if(_0x45b807){return _0x45b807[_0xeb16('0xe4')](_0x7897db['query'][_0xeb16('0x6e')])['then'](function(){if(_[_0xeb16('0xe5')](_0x7897db['query'][_0xeb16('0x6e')])){for(var _0x249b9c=0x0;_0x249b9c<_0x7897db[_0xeb16('0x47')][_0xeb16('0x6e')][_0xeb16('0x4d')];_0x249b9c+=0x1){socket[_0xeb16('0xe6')]('userSmsAccount:remove',{'UserId':Number(_0x7897db['query']['ids'][_0x249b9c]),'SmsAccountId':Number(_0x7897db[_0xeb16('0x5c')]['id'])});}}else{socket['emit'](_0xeb16('0xe7'),{'UserId':Number(_0x7897db['query'][_0xeb16('0x6e')]),'SmsAccountId':Number(_0x7897db['params']['id'])});}});}})['then'](respondWithStatusCode(_0x19984a,null))[_0xeb16('0x2a')](handleError(_0x19984a,null));};exports[_0xeb16('0xe8')]=function(_0x2cd377,_0x49b103,_0x4aa131){var _0x4f87cf={};var _0x5e6283={};var _0x1ad140;var _0x4fb530;return db[_0xeb16('0x42')]['findOne']({'where':{'id':_0x2cd377[_0xeb16('0x5c')]['id']}})[_0xeb16('0x38')](handleEntityNotFound(_0x49b103,null))['then'](function(_0x34a82b){if(_0x34a82b){_0x1ad140=_0x34a82b;_0x5e6283[_0xeb16('0x4a')]=_[_0xeb16('0x5d')](db['User'][_0xeb16('0x43')]);_0x5e6283[_0xeb16('0x47')]=_['keys'](_0x2cd377['query']);_0x5e6283[_0xeb16('0x48')]=_[_0xeb16('0x49')](_0x5e6283[_0xeb16('0x4a')],_0x5e6283['query']);_0x4f87cf[_0xeb16('0x4b')]=_[_0xeb16('0x49')](_0x5e6283[_0xeb16('0x4a')],qs[_0xeb16('0x4c')](_0x2cd377['query'][_0xeb16('0x4c')]));_0x4f87cf['attributes']=_0x4f87cf[_0xeb16('0x4b')]['length']?_0x4f87cf[_0xeb16('0x4b')]:_0x5e6283[_0xeb16('0x4a')];_0x4f87cf[_0xeb16('0x50')]=qs[_0xeb16('0x51')](_0x2cd377[_0xeb16('0x47')][_0xeb16('0x51')]);_0x4f87cf['where']=qs['filters'](_[_0xeb16('0x53')](_0x2cd377[_0xeb16('0x47')],_0x5e6283['filters']));if(_0x2cd377[_0xeb16('0x47')]['filter']){_0x4f87cf['where']=_[_0xeb16('0x55')](_0x4f87cf[_0xeb16('0x52')],{'$or':_[_0xeb16('0x46')](_0x4f87cf['attributes'],function(_0x76faaa){var _0x8e94be={};_0x8e94be[_0x76faaa]={'$like':'%'+_0x2cd377[_0xeb16('0x47')][_0xeb16('0x54')]+'%'};return _0x8e94be;})});}_0x4f87cf=_[_0xeb16('0x55')]({},_0x4f87cf,_0x2cd377[_0xeb16('0x57')]);return _0x1ad140[_0xeb16('0xe8')](_0x4f87cf);}})[_0xeb16('0x38')](function(_0x3d2409){if(_0x3d2409){_0x4fb530=_0x3d2409[_0xeb16('0x4d')];if(!_0x2cd377[_0xeb16('0x47')][_0xeb16('0x4e')](_0xeb16('0x4f'))){_0x4f87cf[_0xeb16('0x31')]=qs[_0xeb16('0x31')](_0x2cd377[_0xeb16('0x47')][_0xeb16('0x31')]);_0x4f87cf['offset']=qs[_0xeb16('0x2f')](_0x2cd377[_0xeb16('0x47')]['offset']);}return _0x1ad140[_0xeb16('0xe8')](_0x4f87cf);}})[_0xeb16('0x38')](function(_0x7baab1){if(_0x7baab1){return _0x7baab1?{'count':_0x4fb530,'rows':_0x7baab1}:null;}})[_0xeb16('0x38')](respondWithResult(_0x49b103,null))[_0xeb16('0x2a')](handleError(_0x49b103,null));}; \ No newline at end of file +var _0x4995=['ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','fullname','Tags','color','tag','to\x20is\x20mandatory','List','out','dataValues','SmsAccount,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','redif','connectel','error_code','clickatell','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','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','redis','./smsAccount.socket','register','jayson/promise','request','then','info','request\x20sent','debug','stringify','code','error','SmsAccount,\x20%s,\x20%s','message','result','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','SmsAccounts','UserProfileResource','name','send','index','mandatoryDispositionPause','SmsAccount','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','count','include','findAll','Pause','keys','find','catch','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','Disposition','create','getDispositions','findOne','rawAttributes','SmsAccountId','map','includeAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','removeAnswers','SmsApplication','Applications','account','applications','priority','asc','CmContact','difference','createdAt','updatedAt','CompanyId','ListId','mobile','From','Body','MessageSid','skebby','from','sender','text','clicksend','messageId','message_id','MessageUUID','infobip','results','csc','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','Sequelize','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','omit','Contacts','defaults','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','Start','entity\x20found','twilio','Content-Type','\x0a','sequelize','transaction','Transaction'];(function(_0x1e9fa4,_0x1e010c){var _0x24eb6d=function(_0x4b4717){while(--_0x4b4717){_0x1e9fa4['push'](_0x1e9fa4['shift']());}};_0x24eb6d(++_0x1e010c);}(_0x4995,0x10e));var _0x5499=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4995[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x5499('0x0'));var rimraf=require(_0x5499('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5499('0x2'));var moment=require(_0x5499('0x3'));var BPromise=require(_0x5499('0x4'));var Mustache=require(_0x5499('0x5'));var util=require('util');var path=require(_0x5499('0x6'));var sox=require(_0x5499('0x7'));var csv=require(_0x5499('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5499('0x9'));var _=require(_0x5499('0xa'));var squel=require(_0x5499('0xb'));var crypto=require('crypto');var jsforce=require(_0x5499('0xc'));var deskjs=require(_0x5499('0xd'));var toCsv=require(_0x5499('0x8'));var querystring=require(_0x5499('0xe'));var Papa=require(_0x5499('0xf'));var Redis=require('ioredis');var authService=require(_0x5499('0x10'));var qs=require(_0x5499('0x11'));var as=require(_0x5499('0x12'));var hardwareService=require(_0x5499('0x13'));var logger=require(_0x5499('0x14'))('api');var utils=require(_0x5499('0x15'));var config=require(_0x5499('0x16'));var licenseUtil=require(_0x5499('0x17'));var db=require(_0x5499('0x18'))['db'];config['redis']=_['defaults'](config[_0x5499('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5499('0x19')]));require(_0x5499('0x1a'))[_0x5499('0x1b')](socket);var jayson=require(_0x5499('0x1c'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x55bb63,_0x48afa5,_0x469329,_0x4d70b0){return new BPromise(function(_0x4ad52c,_0x150820){var _0x3fe896=_0x4d70b0||client;return _0x3fe896[_0x5499('0x1d')](_0x55bb63,_0x469329)[_0x5499('0x1e')](function(_0x5de2d3){logger[_0x5499('0x1f')]('SmsAccount,\x20%s,\x20%s',_0x48afa5,_0x5499('0x20'));logger[_0x5499('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x48afa5,'request\x20sent',JSON[_0x5499('0x22')](_0x5de2d3));if(_0x5de2d3['error']){if(_0x5de2d3['error'][_0x5499('0x23')]===0x1f4){logger[_0x5499('0x24')](_0x5499('0x25'),_0x48afa5,_0x5de2d3[_0x5499('0x24')][_0x5499('0x26')]);return _0x150820(_0x5de2d3['error'][_0x5499('0x26')]);}logger['error'](_0x5499('0x25'),_0x48afa5,_0x5de2d3[_0x5499('0x24')]['message']);return _0x4ad52c(_0x5de2d3['error'][_0x5499('0x26')]);}else{logger['info'](_0x5499('0x25'),_0x48afa5,'request\x20sent');_0x4ad52c(_0x5de2d3[_0x5499('0x27')][_0x5499('0x26')]);}})['catch'](function(_0x537783){logger[_0x5499('0x24')](_0x5499('0x25'),_0x48afa5,_0x537783);_0x150820(_0x537783);});});}function respondWithStatusCode(_0x18d83e,_0x4fd192){_0x4fd192=_0x4fd192||0xcc;return function(_0x385167){if(_0x385167){return _0x18d83e[_0x5499('0x28')](_0x4fd192);}return _0x18d83e['status'](_0x4fd192)[_0x5499('0x29')]();};}function respondWithResult(_0xb0797a,_0x16fac0){_0x16fac0=_0x16fac0||0xc8;return function(_0xccbf54){if(_0xccbf54){return _0xb0797a[_0x5499('0x2a')](_0x16fac0)[_0x5499('0x2b')](_0xccbf54);}};}function respondWithFilteredResult(_0x32df19,_0x25d7c2){return function(_0xf7b8be){if(_0xf7b8be){var _0x5dce7a=typeof _0x25d7c2[_0x5499('0x2c')]===_0x5499('0x2d')&&typeof _0x25d7c2['limit']===_0x5499('0x2d');var _0x16ed80=_0xf7b8be['count'];var _0x1a5d91=_0x5dce7a?0x0:_0x25d7c2[_0x5499('0x2c')];var _0x37ad8e=_0x5dce7a?_0xf7b8be['count']:_0x25d7c2[_0x5499('0x2c')]+_0x25d7c2[_0x5499('0x2e')];var _0x209cbf;if(_0x37ad8e>=_0x16ed80){_0x37ad8e=_0x16ed80;_0x209cbf=0xc8;}else{_0x209cbf=0xce;}_0x32df19['status'](_0x209cbf);return _0x32df19[_0x5499('0x2f')](_0x5499('0x30'),_0x1a5d91+'-'+_0x37ad8e+'/'+_0x16ed80)[_0x5499('0x2b')](_0xf7b8be);}return null;};}function patchUpdates(_0x29cd51){return function(_0x46aa03){try{jsonpatch[_0x5499('0x31')](_0x46aa03,_0x29cd51,!![]);}catch(_0x4d85df){return BPromise[_0x5499('0x32')](_0x4d85df);}return _0x46aa03[_0x5499('0x33')]();};}function saveUpdates(_0xfa286a,_0x2a78f1){return function(_0x4d51be){if(_0x4d51be){return _0x4d51be[_0x5499('0x34')](_0xfa286a)['then'](function(_0x2b6057){return _0x2b6057;});}return null;};}function removeEntity(_0x16964e,_0x2d1bed){return function(_0x1f5d31){if(_0x1f5d31){return _0x1f5d31[_0x5499('0x35')]()[_0x5499('0x1e')](function(){var _0x38d03e=_0x1f5d31['get']({'plain':!![]});var _0x35cfd4=_0x5499('0x36');return db[_0x5499('0x37')][_0x5499('0x35')]({'where':{'type':_0x35cfd4,'resourceId':_0x38d03e['id']}})['then'](function(){return _0x1f5d31;});})[_0x5499('0x1e')](function(){_0x16964e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x43a6c5,_0x46f0ec){return function(_0x4f55b6){if(!_0x4f55b6){_0x43a6c5[_0x5499('0x28')](0x194);}return _0x4f55b6;};}function handleError(_0x48637d,_0x9d624d){_0x9d624d=_0x9d624d||0x1f4;return function(_0x5a75fd){logger['error'](_0x5a75fd['stack']);if(_0x5a75fd[_0x5499('0x38')]){delete _0x5a75fd['name'];}_0x48637d[_0x5499('0x2a')](_0x9d624d)[_0x5499('0x39')](_0x5a75fd);};}exports[_0x5499('0x3a')]=function(_0x55bd60,_0x103293){var _0x449519={'include':[{'model':db['Pause'],'as':_0x5499('0x3b')}]},_0x26fdce={},_0x56599b={'count':0x0,'rows':[]};var _0x37bd0a=_['map'](db[_0x5499('0x3c')]['rawAttributes'],function(_0x3375fc){return{'name':_0x3375fc['fieldName'],'type':_0x3375fc[_0x5499('0x3d')][_0x5499('0x3e')]};});_0x26fdce[_0x5499('0x3f')]=_['map'](_0x37bd0a,_0x5499('0x38'));_0x26fdce[_0x5499('0x40')]=_['keys'](_0x55bd60[_0x5499('0x40')]);_0x26fdce['filters']=_[_0x5499('0x41')](_0x26fdce['model'],_0x26fdce[_0x5499('0x40')]);_0x449519['attributes']=_[_0x5499('0x41')](_0x26fdce[_0x5499('0x3f')],qs[_0x5499('0x42')](_0x55bd60[_0x5499('0x40')][_0x5499('0x42')]));_0x449519[_0x5499('0x43')]=_0x449519['attributes'][_0x5499('0x44')]?_0x449519[_0x5499('0x43')]:_0x26fdce[_0x5499('0x3f')];if(!_0x55bd60[_0x5499('0x40')]['hasOwnProperty'](_0x5499('0x45'))){_0x449519[_0x5499('0x2e')]=qs['limit'](_0x55bd60[_0x5499('0x40')][_0x5499('0x2e')]);_0x449519[_0x5499('0x2c')]=qs[_0x5499('0x2c')](_0x55bd60[_0x5499('0x40')]['offset']);}_0x449519[_0x5499('0x46')]=qs[_0x5499('0x47')](_0x55bd60[_0x5499('0x40')]['sort']);_0x449519['where']=qs[_0x5499('0x48')](_[_0x5499('0x49')](_0x55bd60[_0x5499('0x40')],_0x26fdce[_0x5499('0x48')]),_0x37bd0a);if(_0x55bd60[_0x5499('0x40')][_0x5499('0x4a')]){_0x449519[_0x5499('0x4b')]=_[_0x5499('0x4c')](_0x449519[_0x5499('0x4b')],{'$or':_['map'](_0x37bd0a,function(_0x1a451d){if(_0x1a451d[_0x5499('0x3d')]!==_0x5499('0x4d')){var _0x1c9776={};_0x1c9776[_0x1a451d[_0x5499('0x38')]]={'$like':'%'+_0x55bd60[_0x5499('0x40')][_0x5499('0x4a')]+'%'};return _0x1c9776;}})});}_0x449519=_['merge']({},_0x449519,_0x55bd60[_0x5499('0x4e')]);var _0x4899a8={'where':_0x449519[_0x5499('0x4b')]};return db[_0x5499('0x3c')]['count'](_0x4899a8)['then'](function(_0x37301b){_0x56599b[_0x5499('0x4f')]=_0x37301b;if(_0x55bd60[_0x5499('0x40')]['includeAll']){_0x449519[_0x5499('0x50')]=[{'all':!![]}];}return db[_0x5499('0x3c')][_0x5499('0x51')](_0x449519);})['then'](function(_0x1638cc){_0x56599b['rows']=_0x1638cc;return _0x56599b;})[_0x5499('0x1e')](respondWithFilteredResult(_0x103293,_0x449519))['catch'](handleError(_0x103293,null));};exports['show']=function(_0x1e926b,_0x599ff4){var _0x99f479={'raw':![],'where':{'id':_0x1e926b['params']['id']},'include':[{'model':db[_0x5499('0x52')],'as':_0x5499('0x3b')}]},_0x3af1bf={};_0x3af1bf['model']=_[_0x5499('0x53')](db[_0x5499('0x3c')]['rawAttributes']);_0x3af1bf[_0x5499('0x40')]=_['keys'](_0x1e926b[_0x5499('0x40')]);_0x3af1bf[_0x5499('0x48')]=_['intersection'](_0x3af1bf[_0x5499('0x3f')],_0x3af1bf[_0x5499('0x40')]);_0x99f479['attributes']=_['intersection'](_0x3af1bf['model'],qs[_0x5499('0x42')](_0x1e926b[_0x5499('0x40')][_0x5499('0x42')]));_0x99f479[_0x5499('0x43')]=_0x99f479[_0x5499('0x43')][_0x5499('0x44')]?_0x99f479['attributes']:_0x3af1bf['model'];if(_0x1e926b[_0x5499('0x40')]['includeAll']){_0x99f479[_0x5499('0x50')]=[{'all':!![]}];}_0x99f479=_['merge']({},_0x99f479,_0x1e926b[_0x5499('0x4e')]);return db[_0x5499('0x3c')][_0x5499('0x54')](_0x99f479)[_0x5499('0x1e')](handleEntityNotFound(_0x599ff4,null))[_0x5499('0x1e')](respondWithResult(_0x599ff4,null))[_0x5499('0x55')](handleError(_0x599ff4,null));};exports['create']=function(_0x120b44,_0x5b5389){return db[_0x5499('0x3c')]['create'](_0x120b44['body'],{})[_0x5499('0x1e')](function(_0x302a42){var _0x35211d=_0x120b44['user']['get']({'plain':!![]});if(!_0x35211d)throw new Error(_0x5499('0x56'));if(_0x35211d[_0x5499('0x57')]===_0x5499('0x58')){var _0x5dd039=_0x302a42[_0x5499('0x59')]({'plain':!![]});var _0x272362=_0x5499('0x36');return db[_0x5499('0x5a')][_0x5499('0x54')]({'where':{'name':_0x272362,'userProfileId':_0x35211d['userProfileId']},'raw':!![]})[_0x5499('0x1e')](function(_0x15ba02){if(_0x15ba02&&_0x15ba02['autoAssociation']===0x0){return db[_0x5499('0x37')]['create']({'name':_0x5dd039[_0x5499('0x38')],'resourceId':_0x5dd039['id'],'type':_0x15ba02[_0x5499('0x38')],'sectionId':_0x15ba02['id']},{})['then'](function(){return _0x302a42;});}else{return _0x302a42;}})[_0x5499('0x55')](function(_0x2f38b4){logger['error'](_0x5499('0x5b'),_0x2f38b4);throw _0x2f38b4;});}return _0x302a42;})[_0x5499('0x1e')](respondWithResult(_0x5b5389,0xc9))[_0x5499('0x55')](handleError(_0x5b5389,null));};exports['update']=function(_0x3599fb,_0x2de600){if(_0x3599fb[_0x5499('0x5c')]['id']){delete _0x3599fb[_0x5499('0x5c')]['id'];}return db[_0x5499('0x3c')][_0x5499('0x54')]({'where':{'id':_0x3599fb[_0x5499('0x5d')]['id']},'include':[{'model':db[_0x5499('0x52')],'as':_0x5499('0x3b')}]})[_0x5499('0x1e')](handleEntityNotFound(_0x2de600,null))[_0x5499('0x1e')](saveUpdates(_0x3599fb[_0x5499('0x5c')],null))['then'](respondWithResult(_0x2de600,null))[_0x5499('0x55')](handleError(_0x2de600,null));};exports[_0x5499('0x35')]=function(_0x1e9a21,_0x34e76a){return db[_0x5499('0x3c')][_0x5499('0x54')]({'where':{'id':_0x1e9a21['params']['id']}})[_0x5499('0x1e')](handleEntityNotFound(_0x34e76a,null))[_0x5499('0x1e')](removeEntity(_0x34e76a,null))[_0x5499('0x55')](handleError(_0x34e76a,null));};exports[_0x5499('0x5e')]=function(_0x1707a1,_0x12ca25){return db[_0x5499('0x3c')][_0x5499('0x5e')]()[_0x5499('0x1e')](respondWithResult(_0x12ca25,null))[_0x5499('0x55')](handleError(_0x12ca25,null));};exports[_0x5499('0x5f')]=function(_0x2aa715,_0x547f60,_0x4b33db){if(_0x2aa715[_0x5499('0x5c')]['id']){delete _0x2aa715[_0x5499('0x5c')]['id'];}return db[_0x5499('0x3c')][_0x5499('0x54')]({'where':{'id':_0x2aa715[_0x5499('0x5d')]['id']}})[_0x5499('0x1e')](handleEntityNotFound(_0x547f60,null))[_0x5499('0x1e')](function(_0xa35370){if(_0xa35370){_0x2aa715[_0x5499('0x5c')]['SmsAccountId']=_0xa35370['id'];return db[_0x5499('0x60')][_0x5499('0x61')](_0x2aa715[_0x5499('0x5c')]);}})[_0x5499('0x1e')](respondWithResult(_0x547f60,null))[_0x5499('0x55')](handleError(_0x547f60,null));};exports[_0x5499('0x62')]=function(_0x3d090e,_0x4d12d1,_0x19e73b){var _0x4ac8c2={'raw':![],'where':{}};var _0x8255a9={};var _0x2c2274={'count':0x0,'rows':[]};return db[_0x5499('0x3c')][_0x5499('0x63')]({'where':{'id':_0x3d090e[_0x5499('0x5d')]['id']}})[_0x5499('0x1e')](handleEntityNotFound(_0x4d12d1,null))['then'](function(_0x179b38){if(_0x179b38){_0x8255a9[_0x5499('0x3f')]=_[_0x5499('0x53')](db[_0x5499('0x60')][_0x5499('0x64')]);_0x8255a9[_0x5499('0x40')]=_[_0x5499('0x53')](_0x3d090e[_0x5499('0x40')]);_0x8255a9[_0x5499('0x48')]=_[_0x5499('0x41')](_0x8255a9[_0x5499('0x3f')],_0x8255a9[_0x5499('0x40')]);_0x4ac8c2[_0x5499('0x43')]=_[_0x5499('0x41')](_0x8255a9[_0x5499('0x3f')],qs[_0x5499('0x42')](_0x3d090e['query'][_0x5499('0x42')]));_0x4ac8c2['attributes']=_0x4ac8c2['attributes'][_0x5499('0x44')]?_0x4ac8c2[_0x5499('0x43')]:_0x8255a9[_0x5499('0x3f')];if(!_0x3d090e['query']['hasOwnProperty'](_0x5499('0x45'))){_0x4ac8c2[_0x5499('0x2e')]=qs[_0x5499('0x2e')](_0x3d090e[_0x5499('0x40')]['limit']);_0x4ac8c2[_0x5499('0x2c')]=qs[_0x5499('0x2c')](_0x3d090e[_0x5499('0x40')]['offset']);}_0x4ac8c2[_0x5499('0x46')]=qs['sort'](_0x3d090e[_0x5499('0x40')][_0x5499('0x47')]);_0x4ac8c2['where']=qs[_0x5499('0x48')](_[_0x5499('0x49')](_0x3d090e[_0x5499('0x40')],_0x8255a9[_0x5499('0x48')]));_0x4ac8c2[_0x5499('0x4b')][_0x5499('0x65')]=_0x179b38['id'];if(_0x3d090e[_0x5499('0x40')][_0x5499('0x4a')]){_0x4ac8c2[_0x5499('0x4b')]=_[_0x5499('0x4c')](_0x4ac8c2[_0x5499('0x4b')],{'$or':_[_0x5499('0x66')](_0x4ac8c2[_0x5499('0x43')],function(_0xe8dd97){var _0x34f693={};_0x34f693[_0xe8dd97]={'$like':'%'+_0x3d090e[_0x5499('0x40')]['filter']+'%'};return _0x34f693;})});}_0x4ac8c2=_['merge']({},_0x4ac8c2,_0x3d090e['options']);return db[_0x5499('0x60')][_0x5499('0x4f')]({'where':_0x4ac8c2[_0x5499('0x4b')]})[_0x5499('0x1e')](function(_0xa1ed4d){_0x2c2274[_0x5499('0x4f')]=_0xa1ed4d;if(_0x3d090e[_0x5499('0x40')][_0x5499('0x67')]){_0x4ac8c2[_0x5499('0x50')]=[{'all':!![]}];}return db['Disposition'][_0x5499('0x51')](_0x4ac8c2);})['then'](function(_0x24ff1e){_0x2c2274[_0x5499('0x68')]=_0x24ff1e;return _0x2c2274;});}})[_0x5499('0x1e')](respondWithFilteredResult(_0x4d12d1,_0x4ac8c2))['catch'](handleError(_0x4d12d1,null));};exports[_0x5499('0x69')]=function(_0x5b440a,_0x4157af,_0x2df82e){return db[_0x5499('0x3c')][_0x5499('0x54')]({'where':{'id':_0x5b440a[_0x5499('0x5d')]['id']}})[_0x5499('0x1e')](handleEntityNotFound(_0x4157af,null))[_0x5499('0x1e')](function(_0x329be8){if(_0x329be8){return _0x329be8['removeDispositions'](_0x5b440a[_0x5499('0x40')][_0x5499('0x6a')]);}})[_0x5499('0x1e')](respondWithStatusCode(_0x4157af,null))[_0x5499('0x55')](handleError(_0x4157af,null));};exports[_0x5499('0x6b')]=function(_0xc34e52,_0x5d79c9,_0x42bba7){if(_0xc34e52[_0x5499('0x5c')]['id']){delete _0xc34e52[_0x5499('0x5c')]['id'];}return db[_0x5499('0x3c')]['find']({'where':{'id':_0xc34e52[_0x5499('0x5d')]['id']}})[_0x5499('0x1e')](handleEntityNotFound(_0x5d79c9,null))[_0x5499('0x1e')](function(_0x5c928c){if(_0x5c928c){_0xc34e52['body'][_0x5499('0x65')]=_0x5c928c['id'];return db[_0x5499('0x6c')][_0x5499('0x61')](_0xc34e52[_0x5499('0x5c')]);}})[_0x5499('0x1e')](respondWithResult(_0x5d79c9,null))[_0x5499('0x55')](handleError(_0x5d79c9,null));};exports[_0x5499('0x6d')]=function(_0x3253bd,_0x3dbe6d,_0x55323c){var _0x557b6a={'raw':![],'where':{}};var _0x257e97={};var _0x368871={'count':0x0,'rows':[]};return db[_0x5499('0x3c')][_0x5499('0x63')]({'where':{'id':_0x3253bd[_0x5499('0x5d')]['id']}})[_0x5499('0x1e')](handleEntityNotFound(_0x3dbe6d,null))[_0x5499('0x1e')](function(_0x359bd5){if(_0x359bd5){_0x257e97[_0x5499('0x3f')]=_[_0x5499('0x53')](db[_0x5499('0x6c')][_0x5499('0x64')]);_0x257e97[_0x5499('0x40')]=_[_0x5499('0x53')](_0x3253bd[_0x5499('0x40')]);_0x257e97[_0x5499('0x48')]=_[_0x5499('0x41')](_0x257e97['model'],_0x257e97[_0x5499('0x40')]);_0x557b6a[_0x5499('0x43')]=_[_0x5499('0x41')](_0x257e97['model'],qs['fields'](_0x3253bd[_0x5499('0x40')][_0x5499('0x42')]));_0x557b6a[_0x5499('0x43')]=_0x557b6a[_0x5499('0x43')]['length']?_0x557b6a[_0x5499('0x43')]:_0x257e97[_0x5499('0x3f')];if(!_0x3253bd['query'][_0x5499('0x6e')](_0x5499('0x45'))){_0x557b6a['limit']=qs['limit'](_0x3253bd['query'][_0x5499('0x2e')]);_0x557b6a[_0x5499('0x2c')]=qs[_0x5499('0x2c')](_0x3253bd['query'][_0x5499('0x2c')]);}_0x557b6a[_0x5499('0x46')]=qs[_0x5499('0x47')](_0x3253bd['query'][_0x5499('0x47')]);_0x557b6a[_0x5499('0x4b')]=qs[_0x5499('0x48')](_['pick'](_0x3253bd[_0x5499('0x40')],_0x257e97[_0x5499('0x48')]));_0x557b6a[_0x5499('0x4b')][_0x5499('0x65')]=_0x359bd5['id'];if(_0x3253bd[_0x5499('0x40')][_0x5499('0x4a')]){_0x557b6a['where']=_[_0x5499('0x4c')](_0x557b6a[_0x5499('0x4b')],{'$or':_[_0x5499('0x66')](_0x557b6a['attributes'],function(_0x50a683){var _0xc6ccc8={};_0xc6ccc8[_0x50a683]={'$like':'%'+_0x3253bd[_0x5499('0x40')][_0x5499('0x4a')]+'%'};return _0xc6ccc8;})});}_0x557b6a=_['merge']({},_0x557b6a,_0x3253bd[_0x5499('0x4e')]);return db[_0x5499('0x6c')][_0x5499('0x4f')]({'where':_0x557b6a[_0x5499('0x4b')]})[_0x5499('0x1e')](function(_0x5b7d75){_0x368871[_0x5499('0x4f')]=_0x5b7d75;if(_0x3253bd[_0x5499('0x40')][_0x5499('0x67')]){_0x557b6a[_0x5499('0x50')]=[{'all':!![]}];}return db['CannedAnswer'][_0x5499('0x51')](_0x557b6a);})['then'](function(_0x121203){_0x368871[_0x5499('0x68')]=_0x121203;return _0x368871;});}})[_0x5499('0x1e')](respondWithFilteredResult(_0x3dbe6d,_0x557b6a))['catch'](handleError(_0x3dbe6d,null));};exports[_0x5499('0x6f')]=function(_0x4c44d0,_0x3a39c3,_0x824a9c){return db[_0x5499('0x3c')][_0x5499('0x54')]({'where':{'id':_0x4c44d0[_0x5499('0x5d')]['id']}})['then'](handleEntityNotFound(_0x3a39c3,null))[_0x5499('0x1e')](function(_0x17fad8){if(_0x17fad8){return _0x17fad8[_0x5499('0x6f')](_0x4c44d0['query'][_0x5499('0x6a')]);}})[_0x5499('0x1e')](respondWithStatusCode(_0x3a39c3,null))[_0x5499('0x55')](handleError(_0x3a39c3,null));};exports['notify']=function(_0x2d7d56,_0x2baf9f,_0x5bda9f){var _0x3daa9b={'channel':'sms'};var _0x13c5bf=[];var _0x68db02=[];var _0x29a776={};return db[_0x5499('0x3c')][_0x5499('0x54')]({'where':{'id':_0x2d7d56[_0x5499('0x5d')]['id']},'include':[{'model':db[_0x5499('0x70')],'as':_0x5499('0x71')}]})[_0x5499('0x1e')](handleEntityNotFound(_0x2baf9f,null))[_0x5499('0x1e')](function(_0x23f60f){_0x3daa9b[_0x5499('0x72')]=_0x23f60f;_0x3daa9b[_0x5499('0x73')]=_['orderBy'](_0x23f60f[_0x5499('0x71')],[_0x5499('0x74')],[_0x5499('0x75')]);if(_0x3daa9b[_0x5499('0x72')][_0x5499('0x71')]){delete _0x3daa9b['account'][_0x5499('0x71')];}return db[_0x5499('0x76')][_0x5499('0x5e')]();})[_0x5499('0x1e')](function(_0x5232d3){if(!_0x5232d3){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x13c5bf=_[_0x5499('0x77')](_[_0x5499('0x53')](_0x5232d3),[_0x5499('0x78'),_0x5499('0x79')]);_0x68db02=_[_0x5499('0x77')](_[_0x5499('0x53')](_0x5232d3),[_0x5499('0x78'),'updatedAt',_0x5499('0x7a'),_0x5499('0x7b')]);_0x3daa9b[_0x5499('0x5c')]={'mapKey':_0x5499('0x7c')};if(_0x3daa9b[_0x5499('0x72')][_0x5499('0x3d')]){switch(_0x3daa9b['account'][_0x5499('0x3d')]){case'twilio':_0x3daa9b[_0x5499('0x5c')]['from']=_0x2d7d56['body'][_0x5499('0x7d')];_0x3daa9b[_0x5499('0x5c')][_0x5499('0x5c')]=_0x2d7d56['body'][_0x5499('0x7e')];_0x3daa9b['body']['messageId']=_0x2d7d56[_0x5499('0x5c')][_0x5499('0x7f')];break;case _0x5499('0x80'):_0x3daa9b[_0x5499('0x5c')][_0x5499('0x81')]='+'+_0x2d7d56['body'][_0x5499('0x82')];_0x3daa9b[_0x5499('0x5c')][_0x5499('0x5c')]=_0x2d7d56[_0x5499('0x5c')][_0x5499('0x83')];break;case'connectel':_0x3daa9b['body'][_0x5499('0x81')]=_0x2d7d56[_0x5499('0x5c')][_0x5499('0x81')];_0x3daa9b[_0x5499('0x5c')]['body']=_0x2d7d56[_0x5499('0x5c')][_0x5499('0x26')];break;case _0x5499('0x84'):_0x3daa9b[_0x5499('0x5c')]['from']=_0x2d7d56['body']['from'];_0x3daa9b[_0x5499('0x5c')][_0x5499('0x5c')]=_0x2d7d56[_0x5499('0x5c')][_0x5499('0x5c')];_0x3daa9b[_0x5499('0x5c')][_0x5499('0x85')]=_0x2d7d56['body'][_0x5499('0x86')];break;case'plivo':_0x3daa9b[_0x5499('0x5c')][_0x5499('0x81')]=_0x2d7d56[_0x5499('0x5c')][_0x5499('0x7d')];_0x3daa9b['body'][_0x5499('0x5c')]=_0x2d7d56[_0x5499('0x5c')]['Text'];_0x3daa9b[_0x5499('0x5c')]['messageId']=_0x2d7d56[_0x5499('0x5c')][_0x5499('0x87')];break;case _0x5499('0x88'):_0x3daa9b[_0x5499('0x5c')][_0x5499('0x81')]='+'+_0x2d7d56['body'][_0x5499('0x89')][0x0]['from'];_0x3daa9b['body'][_0x5499('0x5c')]=_0x2d7d56[_0x5499('0x5c')][_0x5499('0x89')][0x0]['text'];_0x3daa9b['body'][_0x5499('0x85')]=_0x2d7d56[_0x5499('0x5c')][_0x5499('0x89')][0x0][_0x5499('0x85')];break;case _0x5499('0x8a'):_0x3daa9b[_0x5499('0x5c')][_0x5499('0x81')]=_0x2d7d56['body']['originatingAddress'];_0x3daa9b[_0x5499('0x5c')][_0x5499('0x5c')]=_0x2d7d56[_0x5499('0x5c')]['segmentedMessage'][_0x5499('0x26')];break;case'clickatell':_0x3daa9b['body'][_0x5499('0x81')]=_0x2d7d56[_0x5499('0x5c')][_0x5499('0x8b')];_0x3daa9b[_0x5499('0x5c')][_0x5499('0x5c')]=_0x2d7d56[_0x5499('0x5c')][_0x5499('0x83')];_0x3daa9b[_0x5499('0x5c')]['messageId']=_0x2d7d56[_0x5499('0x5c')][_0x5499('0x8c')];break;case _0x5499('0x8d'):_0x3daa9b[_0x5499('0x5c')]['messageId']=_0x2d7d56[_0x5499('0x5c')][0x0][_0x5499('0x26')]['id'];_0x3daa9b['body'][_0x5499('0x81')]=_0x2d7d56['body'][0x0][_0x5499('0x26')][_0x5499('0x81')];_0x3daa9b[_0x5499('0x5c')][_0x5499('0x5c')]=_0x2d7d56[_0x5499('0x5c')][0x0][_0x5499('0x26')][_0x5499('0x83')];break;case _0x5499('0x8e'):_0x3daa9b[_0x5499('0x5c')][_0x5499('0x81')]=_0x2d7d56[_0x5499('0x5c')]['from'];_0x3daa9b[_0x5499('0x5c')][_0x5499('0x5c')]=_0x2d7d56['body'][_0x5499('0x26')];_0x3daa9b[_0x5499('0x5c')][_0x5499('0x85')]=_0x2d7d56[_0x5499('0x5c')][_0x5499('0x8f')];break;}}if(_0x3daa9b[_0x5499('0x5c')]['id']){delete _0x3daa9b['body']['id'];}if(_[_0x5499('0x90')](_0x3daa9b[_0x5499('0x5c')][_0x5499('0x81')])){throw new db['Sequelize']['ValidationError']('from\x20is\x20mandatory');}if(_[_0x5499('0x90')](_0x3daa9b[_0x5499('0x5c')][_0x5499('0x5c')])||_0x3daa9b[_0x5499('0x5c')][_0x5499('0x5c')]===''){throw new db[(_0x5499('0x91'))][(_0x5499('0x92'))](_0x5499('0x93'));}if(_[_0x5499('0x90')](_0x3daa9b[_0x5499('0x5c')][_0x5499('0x94')])){throw new db[(_0x5499('0x91'))][(_0x5499('0x92'))](_0x5499('0x95')+_0x68db02);}if(!_['includes'](_0x68db02,_0x3daa9b['body'][_0x5499('0x94')])){throw new db['Sequelize'][(_0x5499('0x92'))](_0x5499('0x96')+_0x68db02);}_0x29a776[_0x3daa9b[_0x5499('0x5c')][_0x5499('0x94')]]=_0x3daa9b['body']['from'];return db[_0x5499('0x97')][_0x5499('0x54')]({'where':{'id':_0x3daa9b[_0x5499('0x72')][_0x5499('0x7b')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x29a776,'limit':0x1,'order':[[_0x5499('0x79'),_0x5499('0x98')]]}]});})['then'](handleEntityNotFound(_0x2baf9f,null))['then'](function(_0x338469){if(_0x338469){_0x3daa9b[_0x5499('0x99')]=_[_0x5499('0x9a')](_0x338469,['Contacts']);if(_0x338469[_0x5499('0x9b')][_0x5499('0x44')]){return _0x338469[_0x5499('0x9b')][0x0];}var _0x38998b=_[_0x5499('0x9c')](_0x3daa9b['body'],{'firstName':_0x3daa9b[_0x5499('0x5c')][_0x5499('0x81')],'ListId':_0x338469['id']});_0x38998b[_0x3daa9b[_0x5499('0x5c')][_0x5499('0x94')]]=_0x3daa9b[_0x5499('0x5c')][_0x5499('0x81')];return db[_0x5499('0x76')]['create'](_0x38998b,{'fields':_0x13c5bf,'raw':!![]});}})[_0x5499('0x1e')](handleEntityNotFound(_0x2baf9f,null))[_0x5499('0x1e')](function(_0x3029e7){if(_0x3029e7){_0x3daa9b[_0x5499('0x9d')]=_0x3029e7;var _0x13a580={'ContactId':_0x3029e7['id'],'phone':_0x3daa9b[_0x5499('0x5c')][_0x5499('0x81')],'SmsAccountId':_0x2d7d56['params']['id']};var _0x2e8e4a={'ContactId':_0x3029e7['id'],'SmsAccountId':_0x2d7d56[_0x5499('0x5d')]['id'],'closed':![]};return db[_0x5499('0x9e')][_0x5499('0x54')]({'where':_0x2e8e4a})[_0x5499('0x1e')](function(_0x55edf9){if(_0x55edf9){return[_0x55edf9,![]];}return db[_0x5499('0x9e')][_0x5499('0x61')](_0x13a580)[_0x5499('0x1e')](function(_0x9005a8){return[_0x9005a8,!![]];});});}})[_0x5499('0x9f')](function(_0x546f86,_0x20029f){_0x3daa9b[_0x5499('0xa0')]=_0x546f86[_0x5499('0x59')]({'plain':!![]});_0x3daa9b[_0x5499('0xa0')][_0x5499('0xa1')]=![];if(_0x20029f){if(_0x3daa9b[_0x5499('0x72')][_0x5499('0xa2')]){_0x3daa9b['applications'][_0x5499('0xa3')]({'id':0x0,'priority':_0x3daa9b['applications'][_0x5499('0x44')]+0x1,'app':_0x5499('0xa4'),'appdata':_0x5499('0xa5'),'interval':_0x5499('0xa6')});}_0x3daa9b[_0x5499('0xa0')][_0x5499('0xa1')]=!![];}return db[_0x5499('0xa7')]['create']({'phone':_0x3daa9b['body'][_0x5499('0x81')],'messageId':_0x3daa9b[_0x5499('0x5c')][_0x5499('0x85')],'body':_0x3daa9b['body']['body'],'SmsAccountId':_0x2d7d56[_0x5499('0x5d')]['id'],'SmsInteractionId':_0x546f86['id'],'direction':'in','ContactId':_0x546f86[_0x5499('0xa8')],'AttachmentId':_0x3daa9b[_0x5499('0x5c')][_0x5499('0xa9')]});})[_0x5499('0x1e')](function(_0x2afbcf){_0x3daa9b[_0x5499('0x26')]=_0x2afbcf;if(_0x3daa9b['interaction'][_0x5499('0xaa')]){return db[_0x5499('0xab')][_0x5499('0x54')]({'attributes':['id',_0x5499('0x38')],'where':{'id':_0x3daa9b['interaction'][_0x5499('0xaa')]}})['then'](function(_0x329fe9){if(_0x329fe9){_0x3daa9b[_0x5499('0x73')][_0x5499('0xac')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x329fe9[_0x5499('0x38')]+','+(_0x3daa9b[_0x5499('0x72')][_0x5499('0xad')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x5499('0xae'),'startRouting',_0x3daa9b);});}return respondWithRpcPromise(_0x5499('0xae'),'startRouting',_0x3daa9b);})['then'](function(_0x5b108f){if(_0x5b108f){var _0x49fbcf=0xc8;var _0x98d31a='receiveMessage';logger[_0x5499('0x1f')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x98d31a,_0x49fbcf,_0x5499('0xaf'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x98d31a,_0x49fbcf,'entity\x20found',JSON[_0x5499('0x22')](_0x5b108f));if(_0x3daa9b['account'][_0x5499('0x3d')]===_0x5499('0xb0')){return _0x2baf9f[_0x5499('0x2a')](_0x49fbcf)[_0x5499('0x2f')](_0x5499('0xb1'),'text/xml')[_0x5499('0x39')](_0x5499('0xb2'));}else{return _0x2baf9f[_0x5499('0x2a')](_0x49fbcf)[_0x5499('0x2b')](_0x5b108f);}}})[_0x5499('0x55')](handleError(_0x2baf9f,null));};exports['addApplications']=function(_0x5b55db,_0x5776ab){var _0x5d4532=_0x5b55db[_0x5499('0x5d')]['id'];var _0x8543a=_0x5b55db[_0x5499('0x5c')];var _0x90bb7b=0xc8;var _0x592dfc=null;return db[_0x5499('0xb3')][_0x5499('0xb4')]({'isolationLevel':db[_0x5499('0xb3')][_0x5499('0xb5')][_0x5499('0xb6')][_0x5499('0xb7')]},function(_0x4f14d8){return db[_0x5499('0x3c')][_0x5499('0x63')]({'where':{'id':_0x5d4532},'transaction':_0x4f14d8})['then'](function(_0x57cc2c){if(_0x57cc2c){return db[_0x5499('0x70')][_0x5499('0x35')]({'where':{'SmsAccountId':_0x5d4532},'transaction':_0x4f14d8})[_0x5499('0x1e')](function(){var _0x585e35=_['map'](_0x8543a,function(_0x4439f7){_0x4439f7[_0x5499('0x65')]=_0x5d4532;return _0x4439f7;});return db['SmsApplication'][_0x5499('0xb8')](_0x585e35,{'transaction':_0x4f14d8});});}else{_0x90bb7b=0x194;_0x592dfc=[];}});})[_0x5499('0x1e')](function(){if(_0x90bb7b!==0x194){return db['SmsApplication'][_0x5499('0xb9')]({'where':{'SmsAccountId':_0x5d4532},'order':_0x5499('0x74')})[_0x5499('0x1e')](function(_0x520569){_0x592dfc=_0x520569;});}})[_0x5499('0x55')](function(_0x56a796){_0x90bb7b=0x1f4;logger[_0x5499('0x24')](_0x56a796['stack']);if(_0x56a796[_0x5499('0x38')]){delete _0x56a796[_0x5499('0x38')];}_0x592dfc=_0x56a796;})[_0x5499('0xba')](function(){if(_0x592dfc===null){_0x5776ab[_0x5499('0x28')](_0x90bb7b);}else{if(_0x90bb7b===0x1f4){_0x5776ab[_0x5499('0x2a')](_0x90bb7b)[_0x5499('0x39')](_0x592dfc);}else{_0x5776ab[_0x5499('0x2a')](_0x90bb7b)['json'](_0x592dfc);}}});};exports['getApplications']=function(_0x567c92,_0x42b7f5,_0x21140c){var _0x27697e={};var _0x3ecc9d={};var _0x56629f;var _0x27adb0;return db[_0x5499('0x3c')][_0x5499('0x63')]({'where':{'id':_0x567c92[_0x5499('0x5d')]['id']}})[_0x5499('0x1e')](handleEntityNotFound(_0x42b7f5,null))[_0x5499('0x1e')](function(_0x5a85b6){if(_0x5a85b6){_0x56629f=_0x5a85b6;_0x3ecc9d['model']=_[_0x5499('0x53')](db[_0x5499('0x70')]['rawAttributes']);_0x3ecc9d[_0x5499('0x40')]=_['keys'](_0x567c92[_0x5499('0x40')]);_0x3ecc9d['filters']=_[_0x5499('0x41')](_0x3ecc9d[_0x5499('0x3f')],_0x3ecc9d[_0x5499('0x40')]);_0x27697e[_0x5499('0x43')]=_['intersection'](_0x3ecc9d[_0x5499('0x3f')],qs['fields'](_0x567c92['query'][_0x5499('0x42')]));_0x27697e[_0x5499('0x43')]=_0x27697e[_0x5499('0x43')][_0x5499('0x44')]?_0x27697e[_0x5499('0x43')]:_0x3ecc9d[_0x5499('0x3f')];_0x27697e['order']=qs[_0x5499('0x47')](_0x567c92[_0x5499('0x40')][_0x5499('0x47')]);_0x27697e[_0x5499('0x4b')]=qs[_0x5499('0x48')](_[_0x5499('0x49')](_0x567c92[_0x5499('0x40')],_0x3ecc9d[_0x5499('0x48')]));if(_0x567c92[_0x5499('0x40')][_0x5499('0x4a')]){_0x27697e['where']=_[_0x5499('0x4c')](_0x27697e[_0x5499('0x4b')],{'$or':_[_0x5499('0x66')](_0x27697e[_0x5499('0x43')],function(_0x134a07){var _0x533305={};_0x533305[_0x134a07]={'$like':'%'+_0x567c92[_0x5499('0x40')][_0x5499('0x4a')]+'%'};return _0x533305;})});}_0x27697e=_[_0x5499('0x4c')]({},_0x27697e,_0x567c92[_0x5499('0x4e')]);return _0x56629f[_0x5499('0xbb')](_0x27697e);}})[_0x5499('0x1e')](function(_0x5962de){if(_0x5962de){_0x27adb0=_0x5962de['length'];if(!_0x567c92[_0x5499('0x40')][_0x5499('0x6e')](_0x5499('0x45'))){_0x27697e[_0x5499('0x2e')]=qs['limit'](_0x567c92['query'][_0x5499('0x2e')]);_0x27697e[_0x5499('0x2c')]=qs[_0x5499('0x2c')](_0x567c92['query'][_0x5499('0x2c')]);}return _0x56629f[_0x5499('0xbb')](_0x27697e);}})['then'](function(_0x111a16){if(_0x111a16){return _0x111a16?{'count':_0x27adb0,'rows':_0x111a16}:null;}})['then'](respondWithResult(_0x42b7f5,null))['catch'](handleError(_0x42b7f5,null));};exports[_0x5499('0xbc')]=function(_0x2ef1c5,_0x1439fa,_0x3e36a8){var _0x5d7a91={'raw':![],'where':{}};var _0x8bd52e={};var _0x34c9aa={'count':0x0,'rows':[]};return db[_0x5499('0x3c')][_0x5499('0x63')]({'where':{'id':_0x2ef1c5[_0x5499('0x5d')]['id']}})[_0x5499('0x1e')](handleEntityNotFound(_0x1439fa,null))['then'](function(_0x5bd5f4){if(_0x5bd5f4){_0x8bd52e['model']=_[_0x5499('0x53')](db[_0x5499('0x9e')][_0x5499('0x64')]);_0x8bd52e['query']=_[_0x5499('0x53')](_0x2ef1c5['query']);_0x8bd52e[_0x5499('0x48')]=_[_0x5499('0x41')](_0x8bd52e['model'],_0x8bd52e[_0x5499('0x40')]);_0x5d7a91['attributes']=_['intersection'](_0x8bd52e['model'],qs['fields'](_0x2ef1c5[_0x5499('0x40')]['fields']));_0x5d7a91[_0x5499('0x43')]=_0x5d7a91['attributes'][_0x5499('0x44')]?_0x5d7a91[_0x5499('0x43')]:_0x8bd52e[_0x5499('0x3f')];if(!_0x2ef1c5[_0x5499('0x40')][_0x5499('0x6e')](_0x5499('0x45'))){_0x5d7a91[_0x5499('0x2e')]=qs[_0x5499('0x2e')](_0x2ef1c5[_0x5499('0x40')]['limit']);_0x5d7a91[_0x5499('0x2c')]=qs[_0x5499('0x2c')](_0x2ef1c5[_0x5499('0x40')][_0x5499('0x2c')]);}_0x5d7a91[_0x5499('0x46')]=qs['sort'](_0x2ef1c5[_0x5499('0x40')][_0x5499('0x47')]);_0x5d7a91[_0x5499('0x4b')]=qs[_0x5499('0x48')](_[_0x5499('0x49')](_0x2ef1c5[_0x5499('0x40')],_0x8bd52e[_0x5499('0x48')]));_0x5d7a91[_0x5499('0x4b')]['SmsAccountId']=_0x5bd5f4['id'];if(_0x2ef1c5['query'][_0x5499('0x4a')]){_0x5d7a91['where']=_[_0x5499('0x4c')](_0x5d7a91['where'],{'$or':_['map'](_0x5d7a91[_0x5499('0x43')],function(_0x3c3f74){var _0x3b93aa={};_0x3b93aa[_0x3c3f74]={'$like':'%'+_0x2ef1c5['query']['filter']+'%'};return _0x3b93aa;})});}_0x5d7a91=_[_0x5499('0x4c')]({},_0x5d7a91,_0x2ef1c5[_0x5499('0x4e')]);return db[_0x5499('0x9e')][_0x5499('0x4f')]({'where':_0x5d7a91[_0x5499('0x4b')]})[_0x5499('0x1e')](function(_0x5bb608){_0x34c9aa[_0x5499('0x4f')]=_0x5bb608;if(_0x2ef1c5[_0x5499('0x40')][_0x5499('0x67')]){_0x5d7a91[_0x5499('0x50')]=[{'model':db[_0x5499('0x76')],'as':_0x5499('0xbd'),'required':![]},{'model':db[_0x5499('0xab')],'as':_0x5499('0xbe'),'attributes':[_0x5499('0x38'),_0x5499('0xbf'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x5499('0xc0'),'attributes':['id',_0x5499('0x38'),_0x5499('0xc1')],'where':_0x2ef1c5[_0x5499('0x40')]['tag']?{'id':_0x2ef1c5[_0x5499('0x40')][_0x5499('0xc2')]}:undefined,'required':_0x2ef1c5[_0x5499('0x40')][_0x5499('0xc2')]?!![]:![]}];}return db[_0x5499('0x9e')][_0x5499('0x51')](_0x5d7a91);})[_0x5499('0x1e')](function(_0x20ec3d){_0x34c9aa[_0x5499('0x68')]=_0x20ec3d;return _0x34c9aa;});}})[_0x5499('0x1e')](respondWithFilteredResult(_0x1439fa,_0x5d7a91))[_0x5499('0x55')](handleError(_0x1439fa,null));};exports[_0x5499('0x39')]=function(_0x228f44,_0x1a623e,_0x3a7d75){var _0x460d6e,_0x52bf8c,_0x203a67;if(_[_0x5499('0x90')](_0x228f44[_0x5499('0x5c')][_0x5499('0x5c')])||_0x228f44['body'][_0x5499('0x5c')]===''){throw new db[(_0x5499('0x91'))][(_0x5499('0x92'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x5499('0x90')](_0x228f44[_0x5499('0x5c')]['to'])){throw new db['Sequelize'][(_0x5499('0x92'))](_0x5499('0xc3'));}_0x460d6e=_0x228f44[_0x5499('0x5c')]['to'];return db[_0x5499('0x3c')]['find']({'where':{'id':_0x228f44[_0x5499('0x5d')]['id']},'include':[{'model':db[_0x5499('0x97')],'as':_0x5499('0xc4'),'include':[{'model':db[_0x5499('0x76')],'as':_0x5499('0x9b'),'where':{'mobile':_0x460d6e},'limit':0x1,'order':[[_0x5499('0x79'),_0x5499('0x98')]]}]}]})[_0x5499('0x1e')](handleEntityNotFound(_0x1a623e,null))[_0x5499('0x1e')](function(_0x31fad8){if(_0x31fad8&&_0x31fad8[_0x5499('0xc4')]){_0x52bf8c=_0x31fad8[_0x5499('0x59')]({'plain':!![]});if(_0x52bf8c[_0x5499('0xc4')]&&_0x52bf8c['List'][_0x5499('0x9b')][_0x5499('0x44')]){return _0x52bf8c[_0x5499('0xc4')][_0x5499('0x9b')][0x0];}return db[_0x5499('0x76')][_0x5499('0x61')](_[_0x5499('0x9c')](_0x228f44['body'],{'firstName':_0x460d6e,'mobile':_0x460d6e,'phone':_0x460d6e,'ListId':_0x52bf8c[_0x5499('0x7b')]}));}})[_0x5499('0x1e')](handleEntityNotFound(_0x1a623e,null))['then'](function(_0x20b8b5){if(_0x20b8b5){_0x203a67=_0x20b8b5;return db[_0x5499('0x9e')]['find']({'where':{'ContactId':_0x203a67['id'],'closed':![],'SmsAccountId':_0x52bf8c['id']}})[_0x5499('0x1e')](function(_0x175c39){if(_0x175c39){return[_0x175c39,![]];}return db[_0x5499('0x9e')]['create']({'UserId':_0x228f44[_0x5499('0x58')]['id'],'ContactId':_0x203a67['id'],'SmsAccountId':_0x52bf8c['id'],'phone':_0x460d6e,'firstMsgDirection':_0x5499('0xc5'),'Messages':[_[_0x5499('0x4c')](_0x228f44['body'],{'read':![],'body':_0x228f44[_0x5499('0x5c')]['body'],'phone':_0x460d6e,'SmsAccountId':_0x52bf8c['id'],'UserId':_0x228f44[_0x5499('0x58')]['id'],'ContactId':_0x203a67['id']})]},{'include':[{'model':db[_0x5499('0xa7')],'as':'Messages'}]})[_0x5499('0x1e')](function(_0x1d3e27){return[_0x1d3e27,!![]];});});}})[_0x5499('0x9f')](function(_0x1e7934,_0x4b2149){if(_0x4b2149){return _0x1e7934;}return db[_0x5499('0xa7')][_0x5499('0x61')](_[_0x5499('0x4c')](_0x228f44['body'],{'read':![],'body':_0x228f44['body'][_0x5499('0x5c')],'phone':_0x460d6e,'SmsAccountId':_0x52bf8c['id'],'SmsInteractionId':_0x1e7934['id'],'UserId':_0x228f44[_0x5499('0x58')]['id'],'ContactId':_0x203a67['id']}))[_0x5499('0x1e')](function(_0xb0f344){_0x1e7934['dataValues']['Messages']=[];_0x1e7934['dataValues']['Messages'][_0x5499('0xa3')](_0xb0f344[_0x5499('0xc6')]);return _0x1e7934;});})['then'](respondWithResult(_0x1a623e,null))['catch'](handleError(_0x1a623e,null));};exports[_0x5499('0x2a')]=function(_0x3c2bfe,_0x26ecec,_0x483caf){if(_0x3c2bfe['body']['id']){delete _0x3c2bfe[_0x5499('0x5c')]['id'];}var _0x25b2ea,_0x1fb738,_0x25404e;return db[_0x5499('0x3c')][_0x5499('0x54')]({'where':{'id':_0x3c2bfe[_0x5499('0x5d')]['id']}})['then'](handleEntityNotFound(_0x26ecec,null))['then'](function(_0x11a3bc){if(_0x11a3bc){_0x25404e=_0x11a3bc;logger['debug'](_0x5499('0xc7'),_0x5499('0x2a'),_0x5499('0xc8'),_0x11a3bc['type'],util[_0x5499('0xc9')](_0x3c2bfe['body'],{'showHidden':![],'depth':null}));switch(_0x11a3bc['type']){case _0x5499('0x80'):if(_0x3c2bfe[_0x5499('0x5c')]['skebby_dispatch_id']&&_0x3c2bfe['body'][_0x5499('0x2a')]){_0x1fb738=_0x3c2bfe[_0x5499('0x5c')]['status'];return db['SmsMessage'][_0x5499('0x54')]({'where':{'messageId':_0x3c2bfe['body'][_0x5499('0xca')]}});}break;case'connectel':if(_0x3c2bfe['body'][_0x5499('0xcb')]&&_0x3c2bfe[_0x5499('0x5c')][_0x5499('0xcc')]){_0x1fb738=_0x3c2bfe[_0x5499('0x5c')]['statusInt'];return db[_0x5499('0xa7')]['find']({'where':{'messageId':_0x3c2bfe[_0x5499('0x5c')][_0x5499('0xcb')]}});}break;case'clicksend':if(_0x3c2bfe['body']['message_id']&&_0x3c2bfe[_0x5499('0x5c')][_0x5499('0xcd')]){_0x1fb738=_0x3c2bfe[_0x5499('0x5c')][_0x5499('0xcd')];return db[_0x5499('0xa7')][_0x5499('0x54')]({'where':{'messageId':_0x3c2bfe[_0x5499('0x5c')]['message_id']}});}break;case'infobip':var _0x4ed67b=_0x3c2bfe['body'][_0x5499('0x89')][0x0];if(_0x4ed67b['messageId']&&_0x4ed67b[_0x5499('0x2a')][_0x5499('0xce')]===_0x5499('0xcf')){_0x1fb738=_0x4ed67b[_0x5499('0x2a')][_0x5499('0xce')];return db['SmsMessage'][_0x5499('0x54')]({'where':{'messageId':_0x4ed67b[_0x5499('0x85')]}});}break;case'clickatell':if(_0x3c2bfe[_0x5499('0x5c')][_0x5499('0x85')]&&_0x3c2bfe[_0x5499('0x5c')][_0x5499('0x2a')]){_0x1fb738=_0x3c2bfe[_0x5499('0x5c')][_0x5499('0x2a')];return db[_0x5499('0xa7')][_0x5499('0x54')]({'where':{'messageId':_0x3c2bfe[_0x5499('0x5c')][_0x5499('0x85')]}});}break;case'bandwidth':if(_0x3c2bfe[_0x5499('0x5c')][0x0][_0x5499('0x26')]['id']){_0x1fb738=_0x3c2bfe[_0x5499('0x5c')][0x0][_0x5499('0x3d')];return db['SmsMessage'][_0x5499('0x54')]({'where':{'messageId':_0x3c2bfe[_0x5499('0x5c')][0x0]['message']['id']}});}break;case _0x5499('0x8e'):if(_0x3c2bfe['body'][_0x5499('0xd0')]&&_0x3c2bfe[_0x5499('0x5c')][_0x5499('0x2a')]){_0x1fb738=_0x3c2bfe['body'][_0x5499('0x2a')];return db[_0x5499('0xa7')][_0x5499('0x54')]({'where':{'messageId':_0x3c2bfe[_0x5499('0x5c')][_0x5499('0xd0')]}});}break;}}})['then'](handleEntityNotFound(_0x26ecec,null))[_0x5499('0x1e')](function(_0x246983){if(_0x246983){_0x25b2ea=_0x246983;switch(_0x25404e[_0x5499('0x3d')]){case _0x5499('0x80'):if(_0x1fb738===_0x5499('0xcf')){return _0x25b2ea[_0x5499('0x34')]({'read':!![]});}else{logger['error'](_0x5499('0xc7'),_0x5499('0x2a'),'skebby',util[_0x5499('0xc9')](_0x3c2bfe[_0x5499('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x5499('0xd1'):if(_0x1fb738==='1'){return _0x25b2ea[_0x5499('0x34')]({'read':!![]});}else{logger[_0x5499('0x24')](_0x5499('0xc7'),'status',_0x5499('0x80'),util[_0x5499('0xc9')](_0x3c2bfe['body'],{'showHidden':![],'depth':null}));}break;case _0x5499('0x84'):if(!_0x3c2bfe[_0x5499('0x5c')][_0x5499('0xd2')]&&_0x1fb738>=0xc8&&_0x1fb738<=0xce){return _0x25b2ea[_0x5499('0x34')]({'read':!![]});}else{logger['error'](_0x5499('0xc7'),'status',_0x5499('0x84'),util[_0x5499('0xc9')](_0x3c2bfe['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0xeaaf9c=_0x3c2bfe[_0x5499('0x5c')][_0x5499('0x89')][0x0];if(_0xeaaf9c[_0x5499('0x2a')]['groupName']==='DELIVERED'){return _0x25b2ea[_0x5499('0x34')]({'read':!![]});}else{logger[_0x5499('0x24')](_0x5499('0xc7'),_0x5499('0x2a'),_0x5499('0x88'),util[_0x5499('0xc9')](_0x3c2bfe[_0x5499('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x5499('0xd3'):if(_0x1fb738==_0x5499('0xd4')||_0x1fb738=='RECEIVED_BY_RECIPIENT'){return _0x25b2ea[_0x5499('0x34')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5499('0x2a'),_0x5499('0xd3'),util['inspect'](_0x3c2bfe[_0x5499('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x5499('0x8d'):if(_0x1fb738==_0x5499('0xd5')){return _0x25b2ea[_0x5499('0x34')]({'read':!![]});}else{logger[_0x5499('0x24')](_0x5499('0xc7'),_0x5499('0x2a'),_0x5499('0x8d'),util[_0x5499('0xc9')](_0x3c2bfe[_0x5499('0x5c')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x1fb738===_0x5499('0xd6')||_0x1fb738===_0x5499('0xd7')){return _0x25b2ea['update']({'read':!![]});}else{logger[_0x5499('0x24')](_0x5499('0xc7'),_0x5499('0x2a'),_0x5499('0x8e'),util[_0x5499('0xc9')](_0x3c2bfe[_0x5499('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x25b2ea;}})[_0x5499('0x1e')](respondWithResult(_0x26ecec,null))[_0x5499('0x55')](handleError(_0x26ecec,null));};exports[_0x5499('0xd8')]=function(_0x33f043,_0x5880aa,_0x4840f4){var _0x386f14,_0x40e678,_0x2f9551;return db[_0x5499('0x3c')][_0x5499('0x54')]({'where':{'id':_0x33f043[_0x5499('0x5d')]['id']}})['then'](handleEntityNotFound(_0x5880aa,null))['then'](function(_0x4b5630){if(_0x4b5630){_0x2f9551=_0x4b5630;logger[_0x5499('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5499('0x2a'),'received\x20delivery\x20report\x20from',_0x4b5630[_0x5499('0x3d')],util['inspect'](_0x33f043[_0x5499('0x40')],{'showHidden':![],'depth':null}));switch(_0x4b5630['type']){case'csc':if(_0x33f043[_0x5499('0x40')][_0x5499('0xd9')]&&_0x33f043['query']['state']){_0x40e678=_0x33f043[_0x5499('0x40')][_0x5499('0xda')];return db[_0x5499('0xa7')][_0x5499('0x54')]({'where':{'messageId':_0x33f043[_0x5499('0x40')][_0x5499('0xd9')]}});}break;}}})[_0x5499('0x1e')](handleEntityNotFound(_0x5880aa,null))[_0x5499('0x1e')](function(_0x3ed422){if(_0x3ed422){_0x386f14=_0x3ed422;switch(_0x2f9551[_0x5499('0x3d')]){case _0x5499('0x8a'):if(_0x40e678==='2'||_0x40e678==='6'){return _0x386f14[_0x5499('0x34')]({'read':!![]});}else{logger[_0x5499('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x5499('0x8a'),util[_0x5499('0xc9')](_0x33f043[_0x5499('0x40')],{'showHidden':![],'depth':null}));};break;}return _0x386f14;}})[_0x5499('0x1e')](respondWithResult(_0x5880aa,null))[_0x5499('0x55')](handleError(_0x5880aa,null));};exports[_0x5499('0xdb')]=function(_0x3f2faa,_0x17ce24,_0x4af16e){return db[_0x5499('0x3c')][_0x5499('0x54')]({'where':{'id':_0x3f2faa[_0x5499('0x5d')]['id']}})[_0x5499('0x1e')](handleEntityNotFound(_0x17ce24,null))[_0x5499('0x1e')](function(_0x248c2c){if(_0x248c2c){return _0x248c2c['addAgents'](_0x3f2faa[_0x5499('0x5c')][_0x5499('0x6a')],_['omit'](_0x3f2faa[_0x5499('0x5c')],[_0x5499('0x6a'),'id'])||{})[_0x5499('0x9f')](function(_0x54de36){for(var _0x898b93=0x0;_0x898b93<_0x3f2faa['body'][_0x5499('0x6a')][_0x5499('0x44')];_0x898b93+=0x1){socket['emit'](_0x5499('0xdc'),{'UserId':Number(_0x3f2faa[_0x5499('0x5c')][_0x5499('0x6a')][_0x898b93]),'SmsAccountId':Number(_0x3f2faa[_0x5499('0x5d')]['id'])});}return _0x54de36;});}})[_0x5499('0x1e')](respondWithResult(_0x17ce24,null))[_0x5499('0x55')](handleError(_0x17ce24,null));};exports[_0x5499('0xdd')]=function(_0x18433d,_0x3f44bf,_0x36c0ba){return db[_0x5499('0x3c')]['find']({'where':{'id':_0x18433d[_0x5499('0x5d')]['id']}})[_0x5499('0x1e')](handleEntityNotFound(_0x3f44bf,null))[_0x5499('0x1e')](function(_0x280e02){if(_0x280e02){return _0x280e02[_0x5499('0xdd')](_0x18433d['query'][_0x5499('0x6a')])[_0x5499('0x1e')](function(){if(_[_0x5499('0xde')](_0x18433d[_0x5499('0x40')][_0x5499('0x6a')])){for(var _0x13c651=0x0;_0x13c651<_0x18433d[_0x5499('0x40')][_0x5499('0x6a')][_0x5499('0x44')];_0x13c651+=0x1){socket[_0x5499('0xdf')]('userSmsAccount:remove',{'UserId':Number(_0x18433d[_0x5499('0x40')][_0x5499('0x6a')][_0x13c651]),'SmsAccountId':Number(_0x18433d[_0x5499('0x5d')]['id'])});}}else{socket[_0x5499('0xdf')](_0x5499('0xe0'),{'UserId':Number(_0x18433d[_0x5499('0x40')]['ids']),'SmsAccountId':Number(_0x18433d[_0x5499('0x5d')]['id'])});}});}})[_0x5499('0x1e')](respondWithStatusCode(_0x3f44bf,null))[_0x5499('0x55')](handleError(_0x3f44bf,null));};exports['getAgents']=function(_0x54aaf8,_0x55d5e1,_0x4d2fe){var _0x2fe96f={};var _0x3ecdb2={};var _0x30c0f3;var _0x66088;return db[_0x5499('0x3c')][_0x5499('0x63')]({'where':{'id':_0x54aaf8[_0x5499('0x5d')]['id']}})[_0x5499('0x1e')](handleEntityNotFound(_0x55d5e1,null))['then'](function(_0x466a41){if(_0x466a41){_0x30c0f3=_0x466a41;_0x3ecdb2[_0x5499('0x3f')]=_['keys'](db[_0x5499('0xab')][_0x5499('0x64')]);_0x3ecdb2[_0x5499('0x40')]=_[_0x5499('0x53')](_0x54aaf8[_0x5499('0x40')]);_0x3ecdb2[_0x5499('0x48')]=_[_0x5499('0x41')](_0x3ecdb2['model'],_0x3ecdb2['query']);_0x2fe96f['attributes']=_[_0x5499('0x41')](_0x3ecdb2[_0x5499('0x3f')],qs[_0x5499('0x42')](_0x54aaf8['query']['fields']));_0x2fe96f[_0x5499('0x43')]=_0x2fe96f[_0x5499('0x43')][_0x5499('0x44')]?_0x2fe96f[_0x5499('0x43')]:_0x3ecdb2[_0x5499('0x3f')];_0x2fe96f[_0x5499('0x46')]=qs['sort'](_0x54aaf8[_0x5499('0x40')][_0x5499('0x47')]);_0x2fe96f[_0x5499('0x4b')]=qs[_0x5499('0x48')](_[_0x5499('0x49')](_0x54aaf8['query'],_0x3ecdb2[_0x5499('0x48')]));if(_0x54aaf8[_0x5499('0x40')]['filter']){_0x2fe96f[_0x5499('0x4b')]=_[_0x5499('0x4c')](_0x2fe96f['where'],{'$or':_[_0x5499('0x66')](_0x2fe96f['attributes'],function(_0x30657d){var _0x4af818={};_0x4af818[_0x30657d]={'$like':'%'+_0x54aaf8[_0x5499('0x40')][_0x5499('0x4a')]+'%'};return _0x4af818;})});}_0x2fe96f=_['merge']({},_0x2fe96f,_0x54aaf8['options']);return _0x30c0f3[_0x5499('0xe1')](_0x2fe96f);}})[_0x5499('0x1e')](function(_0x1dc224){if(_0x1dc224){_0x66088=_0x1dc224[_0x5499('0x44')];if(!_0x54aaf8['query'][_0x5499('0x6e')](_0x5499('0x45'))){_0x2fe96f['limit']=qs[_0x5499('0x2e')](_0x54aaf8[_0x5499('0x40')][_0x5499('0x2e')]);_0x2fe96f[_0x5499('0x2c')]=qs[_0x5499('0x2c')](_0x54aaf8[_0x5499('0x40')]['offset']);}return _0x30c0f3[_0x5499('0xe1')](_0x2fe96f);}})[_0x5499('0x1e')](function(_0x5356ca){if(_0x5356ca){return _0x5356ca?{'count':_0x66088,'rows':_0x5356ca}:null;}})['then'](respondWithResult(_0x55d5e1,null))[_0x5499('0x55')](handleError(_0x55d5e1,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 9c4946c..e8aee51 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 _0x9f6c=['hook','exports','events','../../mysqldb','SmsAccount','setMaxListeners','update','remove','emit'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9f6c,0x92));var _0xc9f6=function(_0x5b1a2e,_0x20794e){_0x5b1a2e=_0x5b1a2e-0x0;var _0xe82d69=_0x9f6c[_0x5b1a2e];return _0xe82d69;};'use strict';var EventEmitter=require(_0xc9f6('0x0'));var SmsAccount=require(_0xc9f6('0x1'))['db'][_0xc9f6('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xc9f6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc9f6('0x4'),'afterDestroy':_0xc9f6('0x5')};function emitEvent(_0x446a8d){return function(_0x1ab6f1,_0x11acdc,_0x44ec3b){SmsAccountEvents[_0xc9f6('0x6')](_0x446a8d+':'+_0x1ab6f1['id'],_0x1ab6f1);SmsAccountEvents[_0xc9f6('0x6')](_0x446a8d,_0x1ab6f1);_0x44ec3b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0xc9f6('0x7')](e,emitEvent(event));}}module[_0xc9f6('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0x003b=['../../mysqldb','SmsAccount','setMaxListeners','remove','emit','hook','exports'];(function(_0x23cb70,_0x411d8e){var _0x3f3875=function(_0x3f6504){while(--_0x3f6504){_0x23cb70['push'](_0x23cb70['shift']());}};_0x3f3875(++_0x411d8e);}(_0x003b,0x149));var _0xb003=function(_0x58033d,_0x3f47e5){_0x58033d=_0x58033d-0x0;var _0xb1fdd0=_0x003b[_0x58033d];return _0xb1fdd0;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0xb003('0x0'))['db'][_0xb003('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xb003('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xb003('0x3')};function emitEvent(_0x3b24d2){return function(_0x2524dd,_0x235016,_0x52cc77){SmsAccountEvents[_0xb003('0x4')](_0x3b24d2+':'+_0x2524dd['id'],_0x2524dd);SmsAccountEvents[_0xb003('0x4')](_0x3b24d2,_0x2524dd);_0x52cc77(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0xb003('0x5')](e,emitEvent(event));}}module[_0xb003('0x6')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index b2cdf1c..b7781bd 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 _0xa57e=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','util'];(function(_0x409deb,_0x2b731){var _0x15a4f7=function(_0x556510){while(--_0x556510){_0x409deb['push'](_0x409deb['shift']());}};_0x15a4f7(++_0x2b731);}(_0xa57e,0x67));var _0xea57=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa57e[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xea57('0x0'));var util=require(_0xea57('0x1'));var logger=require(_0xea57('0x2'))(_0xea57('0x3'));var moment=require(_0xea57('0x4'));var BPromise=require(_0xea57('0x5'));var rp=require(_0xea57('0x6'));var fs=require('fs');var path=require(_0xea57('0x7'));var rimraf=require(_0xea57('0x8'));var config=require(_0xea57('0x9'));var attributes=require(_0xea57('0xa'));module[_0xea57('0xb')]=function(_0x3352a0,_0x4be48f){return _0x3352a0[_0xea57('0xc')](_0xea57('0xd'),attributes,{'tableName':_0xea57('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa28e=['../../config/environment','SmsAccount','sms_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x221cf2,_0x269b6a){var _0x1b8121=function(_0xcd7a04){while(--_0xcd7a04){_0x221cf2['push'](_0x221cf2['shift']());}};_0x1b8121(++_0x269b6a);}(_0xa28e,0x16e));var _0xea28=function(_0x26544f,_0x79f614){_0x26544f=_0x26544f-0x0;var _0x2fff64=_0xa28e[_0x26544f];return _0x2fff64;};'use strict';var _=require(_0xea28('0x0'));var util=require(_0xea28('0x1'));var logger=require(_0xea28('0x2'))('api');var moment=require(_0xea28('0x3'));var BPromise=require(_0xea28('0x4'));var rp=require(_0xea28('0x5'));var fs=require('fs');var path=require(_0xea28('0x6'));var rimraf=require(_0xea28('0x7'));var config=require(_0xea28('0x8'));var attributes=require('./smsAccount.attributes');module['exports']=function(_0x43b68b,_0x350a0e){return _0x43b68b['define'](_0xea28('0x9'),attributes,{'tableName':_0xea28('0xa'),'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 872cea2..e889dd8 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 _0x7c10=['ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','debug','request\x20sent','stringify','error','code','message','SmsAccount,\x20%s,\x20%s','result','catch'];(function(_0x132d9e,_0x4a0839){var _0x40b733=function(_0x30c113){while(--_0x30c113){_0x132d9e['push'](_0x132d9e['shift']());}};_0x40b733(++_0x4a0839);}(_0x7c10,0x129));var _0x07c1=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x7c10[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x07c1('0x0'));var util=require(_0x07c1('0x1'));var moment=require('moment');var BPromise=require(_0x07c1('0x2'));var rs=require(_0x07c1('0x3'));var fs=require('fs');var Redis=require(_0x07c1('0x4'));var db=require(_0x07c1('0x5'))['db'];var utils=require(_0x07c1('0x6'));var logger=require(_0x07c1('0x7'))(_0x07c1('0x8'));var config=require(_0x07c1('0x9'));var jayson=require(_0x07c1('0xa'));var client=jayson[_0x07c1('0xb')][_0x07c1('0xc')]({'port':0x232a});config[_0x07c1('0xd')]=_[_0x07c1('0xe')](config[_0x07c1('0xd')],{'host':_0x07c1('0xf'),'port':0x18eb});var socket=require(_0x07c1('0x10'))(new Redis(config[_0x07c1('0xd')]));require(_0x07c1('0x11'))[_0x07c1('0x12')](socket);function respondWithRpcPromise(_0x2ec447,_0x5949df,_0x122477){return new BPromise(function(_0x633947,_0x5d2c30){return client[_0x07c1('0x13')](_0x2ec447,_0x122477)[_0x07c1('0x14')](function(_0x3f2e75){logger[_0x07c1('0x15')]('SmsAccount,\x20%s,\x20%s',_0x5949df,'request\x20sent');logger[_0x07c1('0x16')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5949df,_0x07c1('0x17'),JSON[_0x07c1('0x18')](_0x3f2e75));if(_0x3f2e75[_0x07c1('0x19')]){if(_0x3f2e75['error'][_0x07c1('0x1a')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x5949df,_0x3f2e75[_0x07c1('0x19')]['message']);return _0x5d2c30(_0x3f2e75[_0x07c1('0x19')][_0x07c1('0x1b')]);}logger[_0x07c1('0x19')]('SmsAccount,\x20%s,\x20%s',_0x5949df,_0x3f2e75['error']['message']);return _0x633947(_0x3f2e75[_0x07c1('0x19')][_0x07c1('0x1b')]);}else{logger['info'](_0x07c1('0x1c'),_0x5949df,_0x07c1('0x17'));_0x633947(_0x3f2e75[_0x07c1('0x1d')][_0x07c1('0x1b')]);}})[_0x07c1('0x1e')](function(_0x330480){logger[_0x07c1('0x19')](_0x07c1('0x1c'),_0x5949df,_0x330480);_0x5d2c30(_0x330480);});});}exports[_0x07c1('0x1f')]=function(_0x2a851e){var _0x21e5ae=this;return new Promise(function(_0x55c333,_0x48188a){return db[_0x07c1('0x20')][_0x07c1('0x21')]({'raw':_0x2a851e[_0x07c1('0x22')]?_0x2a851e[_0x07c1('0x22')][_0x07c1('0x23')]===undefined?!![]:![]:!![],'where':_0x2a851e[_0x07c1('0x22')]?_0x2a851e[_0x07c1('0x22')][_0x07c1('0x24')]||null:null,'attributes':_0x2a851e[_0x07c1('0x22')]?_0x2a851e['options'][_0x07c1('0x25')]||null:null,'include':_0x2a851e[_0x07c1('0x22')]?_0x2a851e[_0x07c1('0x22')][_0x07c1('0x26')]?_[_0x07c1('0x27')](_0x2a851e['options'][_0x07c1('0x26')],function(_0x3d854d){return{'model':db[_0x3d854d[_0x07c1('0x28')]],'as':_0x3d854d['as'],'attributes':_0x3d854d[_0x07c1('0x25')],'include':_0x3d854d['include']?_[_0x07c1('0x27')](_0x3d854d[_0x07c1('0x26')],function(_0x4e4189){return{'model':db[_0x4e4189['model']],'as':_0x4e4189['as'],'attributes':_0x4e4189[_0x07c1('0x25')],'include':_0x4e4189[_0x07c1('0x26')]?_[_0x07c1('0x27')](_0x4e4189[_0x07c1('0x26')],function(_0x2d1512){return{'model':db[_0x2d1512[_0x07c1('0x28')]],'as':_0x2d1512['as'],'attributes':_0x2d1512[_0x07c1('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b608e){logger[_0x07c1('0x15')](_0x07c1('0x1f'),_0x2a851e);logger[_0x07c1('0x16')](_0x07c1('0x1f'),_0x2a851e,JSON[_0x07c1('0x18')](_0x4b608e));_0x55c333(_0x4b608e);})[_0x07c1('0x1e')](function(_0x445f1d){logger[_0x07c1('0x19')](_0x07c1('0x1f'),_0x445f1d['message'],_0x2a851e);_0x48188a(_0x21e5ae[_0x07c1('0x19')](0x1f4,_0x445f1d['message']));});});}; \ No newline at end of file +var _0x34c8=['info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSmsAccount','find','options','attributes','include','map','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./smsAccount.socket','request','then'];(function(_0x240261,_0x4fe66c){var _0x45c332=function(_0x4f367a){while(--_0x4f367a){_0x240261['push'](_0x240261['shift']());}};_0x45c332(++_0x4fe66c);}(_0x34c8,0xe4));var _0x834c=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x34c8[_0x11005e];return _0x29338f;};'use strict';var _=require('lodash');var util=require(_0x834c('0x0'));var moment=require(_0x834c('0x1'));var BPromise=require(_0x834c('0x2'));var rs=require(_0x834c('0x3'));var fs=require('fs');var Redis=require(_0x834c('0x4'));var db=require(_0x834c('0x5'))['db'];var utils=require(_0x834c('0x6'));var logger=require('../../config/logger')(_0x834c('0x7'));var config=require(_0x834c('0x8'));var jayson=require(_0x834c('0x9'));var client=jayson[_0x834c('0xa')]['http']({'port':0x232a});config['redis']=_[_0x834c('0xb')](config[_0x834c('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x834c('0xd'))(new Redis(config[_0x834c('0xc')]));require(_0x834c('0xe'))['register'](socket);function respondWithRpcPromise(_0x4939eb,_0x34984f,_0x3bb8fd){return new BPromise(function(_0x385698,_0x351bd6){return client[_0x834c('0xf')](_0x4939eb,_0x3bb8fd)[_0x834c('0x10')](function(_0x502006){logger[_0x834c('0x11')](_0x834c('0x12'),_0x34984f,_0x834c('0x13'));logger[_0x834c('0x14')](_0x834c('0x15'),_0x34984f,'request\x20sent',JSON[_0x834c('0x16')](_0x502006));if(_0x502006['error']){if(_0x502006[_0x834c('0x17')][_0x834c('0x18')]===0x1f4){logger['error'](_0x834c('0x12'),_0x34984f,_0x502006[_0x834c('0x17')][_0x834c('0x19')]);return _0x351bd6(_0x502006['error'][_0x834c('0x19')]);}logger['error'](_0x834c('0x12'),_0x34984f,_0x502006[_0x834c('0x17')]['message']);return _0x385698(_0x502006[_0x834c('0x17')][_0x834c('0x19')]);}else{logger['info'](_0x834c('0x12'),_0x34984f,_0x834c('0x13'));_0x385698(_0x502006[_0x834c('0x1a')][_0x834c('0x19')]);}})[_0x834c('0x1b')](function(_0x9174c2){logger['error']('SmsAccount,\x20%s,\x20%s',_0x34984f,_0x9174c2);_0x351bd6(_0x9174c2);});});}exports[_0x834c('0x1c')]=function(_0x5c43a9){var _0x50c6ae=this;return new Promise(function(_0x1813c7,_0x3b8e4c){return db['SmsAccount'][_0x834c('0x1d')]({'raw':_0x5c43a9[_0x834c('0x1e')]?_0x5c43a9['options']['raw']===undefined?!![]:![]:!![],'where':_0x5c43a9[_0x834c('0x1e')]?_0x5c43a9[_0x834c('0x1e')]['where']||null:null,'attributes':_0x5c43a9[_0x834c('0x1e')]?_0x5c43a9[_0x834c('0x1e')][_0x834c('0x1f')]||null:null,'include':_0x5c43a9['options']?_0x5c43a9[_0x834c('0x1e')][_0x834c('0x20')]?_[_0x834c('0x21')](_0x5c43a9[_0x834c('0x1e')][_0x834c('0x20')],function(_0x538713){return{'model':db[_0x538713['model']],'as':_0x538713['as'],'attributes':_0x538713['attributes'],'include':_0x538713[_0x834c('0x20')]?_[_0x834c('0x21')](_0x538713[_0x834c('0x20')],function(_0x549ea8){return{'model':db[_0x549ea8['model']],'as':_0x549ea8['as'],'attributes':_0x549ea8[_0x834c('0x1f')],'include':_0x549ea8['include']?_[_0x834c('0x21')](_0x549ea8[_0x834c('0x20')],function(_0x12aac1){return{'model':db[_0x12aac1[_0x834c('0x22')]],'as':_0x12aac1['as'],'attributes':_0x12aac1[_0x834c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x834c('0x10')](function(_0xe8418d){logger[_0x834c('0x11')](_0x834c('0x1c'),_0x5c43a9);logger[_0x834c('0x14')]('ShowSmsAccount',_0x5c43a9,JSON[_0x834c('0x16')](_0xe8418d));_0x1813c7(_0xe8418d);})['catch'](function(_0x1e2aa7){logger[_0x834c('0x17')]('ShowSmsAccount',_0x1e2aa7['message'],_0x5c43a9);_0x3b8e4c(_0x50c6ae[_0x834c('0x17')](0x1f4,_0x1e2aa7[_0x834c('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index dd351ef..a350ba6 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(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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 85bfaf5..b431b7c 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 _0xedd9=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x2ac8ca,_0x3bc825){var _0x3332fb=function(_0xe9ae5f){while(--_0xe9ae5f){_0x2ac8ca['push'](_0x2ac8ca['shift']());}};_0x3332fb(++_0x3bc825);}(_0xedd9,0xfc));var _0x9edd=function(_0x422f87,_0x19163f){_0x422f87=_0x422f87-0x0;var _0x546c34=_0xedd9[_0x422f87];return _0x546c34;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file +var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x4e9274,_0x49576e){var _0x8b474c=function(_0x204cca){while(--_0x204cca){_0x4e9274['push'](_0x4e9274['shift']());}};_0x8b474c(++_0x49576e);}(_0x3e74,0x175));var _0x43e7=function(_0x465a75,_0x385864){_0x465a75=_0x465a75-0x0;var _0x438937=_0x3e74[_0x465a75];return _0x438937;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index eeac70a..b32c7eb 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 _0x26bc=['exports','STRING','noop','TEXT','sequelize'];(function(_0x3d7299,_0x320a15){var _0x411151=function(_0xa2eb90){while(--_0xa2eb90){_0x3d7299['push'](_0x3d7299['shift']());}};_0x411151(++_0x320a15);}(_0x26bc,0xd1));var _0xc26b=function(_0xa4c156,_0x16b559){_0xa4c156=_0xa4c156-0x0;var _0x851387=_0x26bc[_0xa4c156];return _0x851387;};'use strict';var Sequelize=require(_0xc26b('0x0'));module[_0xc26b('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xc26b('0x2')],'allowNull':![],'defaultValue':_0xc26b('0x3')},'appdata':{'type':Sequelize[_0xc26b('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xc26b('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xafd3=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x2deee4,_0x40f129){var _0x1245d3=function(_0x292b79){while(--_0x292b79){_0x2deee4['push'](_0x2deee4['shift']());}};_0x1245d3(++_0x40f129);}(_0xafd3,0x1a7));var _0x3afd=function(_0xb8cfbe,_0x2e81b6){_0xb8cfbe=_0xb8cfbe-0x0;var _0x227d51=_0xafd3[_0xb8cfbe];return _0x227d51;};'use strict';var Sequelize=require(_0x3afd('0x0'));module[_0x3afd('0x1')]={'priority':{'type':Sequelize[_0x3afd('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x3afd('0x3')],'allowNull':![],'defaultValue':_0x3afd('0x4')},'appdata':{'type':Sequelize[_0x3afd('0x5')]()},'description':{'type':Sequelize[_0x3afd('0x3')]},'interval':{'type':Sequelize[_0x3afd('0x3')],'defaultValue':_0x3afd('0x6')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 2e2271e..8c0936f 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 _0xb52c=['reject','save','update','then','stack','name','index','map','SmsApplication','fieldName','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','options','includeAll','findAll','rows','show','rawAttributes','include','find','catch','create','body','params','destroy','eml-format','fast-json-patch','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x1c6f10,_0x5eed05){var _0x5a9683=function(_0x1ea102){while(--_0x1ea102){_0x1c6f10['push'](_0x1c6f10['shift']());}};_0x5a9683(++_0x5eed05);}(_0xb52c,0xbc));var _0xcb52=function(_0x1b4f43,_0x1e5dd1){_0x1b4f43=_0x1b4f43-0x0;var _0x305413=_0xb52c[_0x1b4f43];return _0x305413;};'use strict';var emlformat=require(_0xcb52('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcb52('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcb52('0x2'));var util=require(_0xcb52('0x3'));var path=require('path');var sox=require(_0xcb52('0x4'));var csv=require('to-csv');var ejs=require(_0xcb52('0x5'));var fs=require('fs');var fs_extra=require(_0xcb52('0x6'));var _=require(_0xcb52('0x7'));var squel=require(_0xcb52('0x8'));var crypto=require('crypto');var jsforce=require(_0xcb52('0x9'));var deskjs=require(_0xcb52('0xa'));var toCsv=require(_0xcb52('0xb'));var querystring=require(_0xcb52('0xc'));var Papa=require(_0xcb52('0xd'));var Redis=require(_0xcb52('0xe'));var authService=require(_0xcb52('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xcb52('0x10'));var hardwareService=require(_0xcb52('0x11'));var logger=require(_0xcb52('0x12'))(_0xcb52('0x13'));var utils=require('../../config/utils');var config=require(_0xcb52('0x14'));var licenseUtil=require(_0xcb52('0x15'));var db=require(_0xcb52('0x16'))['db'];function respondWithStatusCode(_0x2aaaa0,_0x56eebc){_0x56eebc=_0x56eebc||0xcc;return function(_0x2a1dfc){if(_0x2a1dfc){return _0x2aaaa0[_0xcb52('0x17')](_0x56eebc);}return _0x2aaaa0[_0xcb52('0x18')](_0x56eebc)[_0xcb52('0x19')]();};}function respondWithResult(_0x349fbe,_0x39ce32){_0x39ce32=_0x39ce32||0xc8;return function(_0x205606){if(_0x205606){return _0x349fbe[_0xcb52('0x18')](_0x39ce32)[_0xcb52('0x1a')](_0x205606);}};}function respondWithFilteredResult(_0x91fe77,_0x2bf5c0){return function(_0x2e1138){if(_0x2e1138){var _0x44f585=typeof _0x2bf5c0[_0xcb52('0x1b')]===_0xcb52('0x1c')&&typeof _0x2bf5c0[_0xcb52('0x1d')]===_0xcb52('0x1c');var _0x5a86ed=_0x2e1138['count'];var _0x1e5e72=_0x44f585?0x0:_0x2bf5c0[_0xcb52('0x1b')];var _0x3e7941=_0x44f585?_0x2e1138[_0xcb52('0x1e')]:_0x2bf5c0['offset']+_0x2bf5c0[_0xcb52('0x1d')];var _0x49b823;if(_0x3e7941>=_0x5a86ed){_0x3e7941=_0x5a86ed;_0x49b823=0xc8;}else{_0x49b823=0xce;}_0x91fe77[_0xcb52('0x18')](_0x49b823);return _0x91fe77[_0xcb52('0x1f')](_0xcb52('0x20'),_0x1e5e72+'-'+_0x3e7941+'/'+_0x5a86ed)[_0xcb52('0x1a')](_0x2e1138);}return null;};}function patchUpdates(_0x53fda8){return function(_0x1154a2){try{jsonpatch[_0xcb52('0x21')](_0x1154a2,_0x53fda8,!![]);}catch(_0x46b339){return BPromise[_0xcb52('0x22')](_0x46b339);}return _0x1154a2[_0xcb52('0x23')]();};}function saveUpdates(_0x1d129e,_0x9aafb6){return function(_0x5ab996){if(_0x5ab996){return _0x5ab996[_0xcb52('0x24')](_0x1d129e)['then'](function(_0x4dd369){return _0x4dd369;});}return null;};}function removeEntity(_0x1c07f1,_0x43ff9e){return function(_0x26ded9){if(_0x26ded9){return _0x26ded9['destroy']()[_0xcb52('0x25')](function(){_0x1c07f1['status'](0xcc)[_0xcb52('0x19')]();});}};}function handleEntityNotFound(_0x3e86f5,_0x26e357){return function(_0x3b1b55){if(!_0x3b1b55){_0x3e86f5[_0xcb52('0x17')](0x194);}return _0x3b1b55;};}function handleError(_0x5300b8,_0x356fa1){_0x356fa1=_0x356fa1||0x1f4;return function(_0x4cdb30){logger['error'](_0x4cdb30[_0xcb52('0x26')]);if(_0x4cdb30[_0xcb52('0x27')]){delete _0x4cdb30[_0xcb52('0x27')];}_0x5300b8['status'](_0x356fa1)['send'](_0x4cdb30);};}exports[_0xcb52('0x28')]=function(_0x33fcf7,_0x41712e){var _0x501c28={},_0xb6dbac={},_0x24495f={'count':0x0,'rows':[]};var _0x13430b=_[_0xcb52('0x29')](db[_0xcb52('0x2a')]['rawAttributes'],function(_0x35e540){return{'name':_0x35e540[_0xcb52('0x2b')],'type':_0x35e540['type']['key']};});_0xb6dbac['model']=_[_0xcb52('0x29')](_0x13430b,_0xcb52('0x27'));_0xb6dbac['query']=_[_0xcb52('0x2c')](_0x33fcf7[_0xcb52('0x2d')]);_0xb6dbac['filters']=_[_0xcb52('0x2e')](_0xb6dbac[_0xcb52('0x2f')],_0xb6dbac[_0xcb52('0x2d')]);_0x501c28[_0xcb52('0x30')]=_[_0xcb52('0x2e')](_0xb6dbac[_0xcb52('0x2f')],qs[_0xcb52('0x31')](_0x33fcf7[_0xcb52('0x2d')][_0xcb52('0x31')]));_0x501c28['attributes']=_0x501c28[_0xcb52('0x30')][_0xcb52('0x32')]?_0x501c28[_0xcb52('0x30')]:_0xb6dbac[_0xcb52('0x2f')];if(!_0x33fcf7[_0xcb52('0x2d')][_0xcb52('0x33')](_0xcb52('0x34'))){_0x501c28[_0xcb52('0x1d')]=qs[_0xcb52('0x1d')](_0x33fcf7['query'][_0xcb52('0x1d')]);_0x501c28['offset']=qs['offset'](_0x33fcf7[_0xcb52('0x2d')][_0xcb52('0x1b')]);}_0x501c28[_0xcb52('0x35')]=qs['sort'](_0x33fcf7[_0xcb52('0x2d')][_0xcb52('0x36')]);_0x501c28[_0xcb52('0x37')]=qs[_0xcb52('0x38')](_[_0xcb52('0x39')](_0x33fcf7['query'],_0xb6dbac[_0xcb52('0x38')]),_0x13430b);if(_0x33fcf7[_0xcb52('0x2d')][_0xcb52('0x3a')]){_0x501c28['where']=_[_0xcb52('0x3b')](_0x501c28['where'],{'$or':_['map'](_0x13430b,function(_0x31b9e5){if(_0x31b9e5[_0xcb52('0x3c')]!=='VIRTUAL'){var _0x270807={};_0x270807[_0x31b9e5[_0xcb52('0x27')]]={'$like':'%'+_0x33fcf7[_0xcb52('0x2d')][_0xcb52('0x3a')]+'%'};return _0x270807;}})});}_0x501c28=_[_0xcb52('0x3b')]({},_0x501c28,_0x33fcf7[_0xcb52('0x3d')]);var _0x45adf1={'where':_0x501c28['where']};return db[_0xcb52('0x2a')][_0xcb52('0x1e')](_0x45adf1)[_0xcb52('0x25')](function(_0x227f96){_0x24495f[_0xcb52('0x1e')]=_0x227f96;if(_0x33fcf7[_0xcb52('0x2d')][_0xcb52('0x3e')]){_0x501c28['include']=[{'all':!![]}];}return db['SmsApplication'][_0xcb52('0x3f')](_0x501c28);})[_0xcb52('0x25')](function(_0x9ffeab){_0x24495f[_0xcb52('0x40')]=_0x9ffeab;return _0x24495f;})[_0xcb52('0x25')](respondWithFilteredResult(_0x41712e,_0x501c28))['catch'](handleError(_0x41712e,null));};exports[_0xcb52('0x41')]=function(_0x433af2,_0x3fc3b6){var _0x4cc62f={'raw':!![],'where':{'id':_0x433af2['params']['id']}},_0xdbcee9={};_0xdbcee9[_0xcb52('0x2f')]=_['keys'](db[_0xcb52('0x2a')][_0xcb52('0x42')]);_0xdbcee9[_0xcb52('0x2d')]=_['keys'](_0x433af2[_0xcb52('0x2d')]);_0xdbcee9[_0xcb52('0x38')]=_['intersection'](_0xdbcee9['model'],_0xdbcee9['query']);_0x4cc62f[_0xcb52('0x30')]=_[_0xcb52('0x2e')](_0xdbcee9[_0xcb52('0x2f')],qs[_0xcb52('0x31')](_0x433af2[_0xcb52('0x2d')][_0xcb52('0x31')]));_0x4cc62f['attributes']=_0x4cc62f[_0xcb52('0x30')][_0xcb52('0x32')]?_0x4cc62f[_0xcb52('0x30')]:_0xdbcee9[_0xcb52('0x2f')];if(_0x433af2[_0xcb52('0x2d')][_0xcb52('0x3e')]){_0x4cc62f[_0xcb52('0x43')]=[{'all':!![]}];}_0x4cc62f=_['merge']({},_0x4cc62f,_0x433af2[_0xcb52('0x3d')]);return db[_0xcb52('0x2a')][_0xcb52('0x44')](_0x4cc62f)[_0xcb52('0x25')](handleEntityNotFound(_0x3fc3b6,null))[_0xcb52('0x25')](respondWithResult(_0x3fc3b6,null))[_0xcb52('0x45')](handleError(_0x3fc3b6,null));};exports[_0xcb52('0x46')]=function(_0x521bae,_0x274064){return db[_0xcb52('0x2a')][_0xcb52('0x46')](_0x521bae[_0xcb52('0x47')],{})[_0xcb52('0x25')](respondWithResult(_0x274064,0xc9))['catch'](handleError(_0x274064,null));};exports[_0xcb52('0x24')]=function(_0x2edc54,_0x3ab79e){if(_0x2edc54[_0xcb52('0x47')]['id']){delete _0x2edc54[_0xcb52('0x47')]['id'];}return db[_0xcb52('0x2a')]['find']({'where':{'id':_0x2edc54[_0xcb52('0x48')]['id']}})[_0xcb52('0x25')](handleEntityNotFound(_0x3ab79e,null))['then'](saveUpdates(_0x2edc54[_0xcb52('0x47')],null))['then'](respondWithResult(_0x3ab79e,null))[_0xcb52('0x45')](handleError(_0x3ab79e,null));};exports[_0xcb52('0x49')]=function(_0x4a07c9,_0x55aa48){return db[_0xcb52('0x2a')][_0xcb52('0x44')]({'where':{'id':_0x4a07c9['params']['id']}})[_0xcb52('0x25')](handleEntityNotFound(_0x55aa48,null))[_0xcb52('0x25')](removeEntity(_0x55aa48,null))[_0xcb52('0x45')](handleError(_0x55aa48,null));}; \ No newline at end of file +var _0xaf2d=['jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','end','stack','name','send','index','SmsApplication','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','params','rawAttributes','find','catch','create','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x7682d,_0x5aff4f){var _0x413658=function(_0x55c112){while(--_0x55c112){_0x7682d['push'](_0x7682d['shift']());}};_0x413658(++_0x5aff4f);}(_0xaf2d,0x116));var _0xdaf2=function(_0x7a6d9c,_0x53f8b3){_0x7a6d9c=_0x7a6d9c-0x0;var _0x20c845=_0xaf2d[_0x7a6d9c];return _0x20c845;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xdaf2('0x0'));var jsonpatch=require(_0xdaf2('0x1'));var rp=require(_0xdaf2('0x2'));var moment=require(_0xdaf2('0x3'));var BPromise=require(_0xdaf2('0x4'));var Mustache=require(_0xdaf2('0x5'));var util=require(_0xdaf2('0x6'));var path=require(_0xdaf2('0x7'));var sox=require('sox');var csv=require(_0xdaf2('0x8'));var ejs=require(_0xdaf2('0x9'));var fs=require('fs');var fs_extra=require(_0xdaf2('0xa'));var _=require(_0xdaf2('0xb'));var squel=require(_0xdaf2('0xc'));var crypto=require(_0xdaf2('0xd'));var jsforce=require(_0xdaf2('0xe'));var deskjs=require(_0xdaf2('0xf'));var toCsv=require(_0xdaf2('0x8'));var querystring=require(_0xdaf2('0x10'));var Papa=require('papaparse');var Redis=require(_0xdaf2('0x11'));var authService=require(_0xdaf2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xdaf2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdaf2('0x14'))(_0xdaf2('0x15'));var utils=require(_0xdaf2('0x16'));var config=require(_0xdaf2('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xdaf2('0x18'))['db'];function respondWithStatusCode(_0x1f4dcf,_0x47705f){_0x47705f=_0x47705f||0xcc;return function(_0x357298){if(_0x357298){return _0x1f4dcf[_0xdaf2('0x19')](_0x47705f);}return _0x1f4dcf[_0xdaf2('0x1a')](_0x47705f)['end']();};}function respondWithResult(_0x53bab7,_0x26c869){_0x26c869=_0x26c869||0xc8;return function(_0xbe5376){if(_0xbe5376){return _0x53bab7[_0xdaf2('0x1a')](_0x26c869)[_0xdaf2('0x1b')](_0xbe5376);}};}function respondWithFilteredResult(_0x4272c6,_0x1472f9){return function(_0x3645a9){if(_0x3645a9){var _0x57e676=typeof _0x1472f9[_0xdaf2('0x1c')]===_0xdaf2('0x1d')&&typeof _0x1472f9[_0xdaf2('0x1e')]===_0xdaf2('0x1d');var _0x3946e4=_0x3645a9[_0xdaf2('0x1f')];var _0xa4d1c8=_0x57e676?0x0:_0x1472f9[_0xdaf2('0x1c')];var _0x26ed61=_0x57e676?_0x3645a9[_0xdaf2('0x1f')]:_0x1472f9[_0xdaf2('0x1c')]+_0x1472f9[_0xdaf2('0x1e')];var _0xb26674;if(_0x26ed61>=_0x3946e4){_0x26ed61=_0x3946e4;_0xb26674=0xc8;}else{_0xb26674=0xce;}_0x4272c6['status'](_0xb26674);return _0x4272c6[_0xdaf2('0x20')]('Content-Range',_0xa4d1c8+'-'+_0x26ed61+'/'+_0x3946e4)[_0xdaf2('0x1b')](_0x3645a9);}return null;};}function patchUpdates(_0x4dbf09){return function(_0x3edcb1){try{jsonpatch[_0xdaf2('0x21')](_0x3edcb1,_0x4dbf09,!![]);}catch(_0x3b7b62){return BPromise[_0xdaf2('0x22')](_0x3b7b62);}return _0x3edcb1['save']();};}function saveUpdates(_0x3c878e,_0x5b5c05){return function(_0x54b358){if(_0x54b358){return _0x54b358[_0xdaf2('0x23')](_0x3c878e)[_0xdaf2('0x24')](function(_0x34119b){return _0x34119b;});}return null;};}function removeEntity(_0x4e5693,_0x161e14){return function(_0xad7145){if(_0xad7145){return _0xad7145[_0xdaf2('0x25')]()[_0xdaf2('0x24')](function(){_0x4e5693[_0xdaf2('0x1a')](0xcc)[_0xdaf2('0x26')]();});}};}function handleEntityNotFound(_0xe1229f,_0x13039e){return function(_0x2db469){if(!_0x2db469){_0xe1229f['sendStatus'](0x194);}return _0x2db469;};}function handleError(_0x151729,_0x7bc03a){_0x7bc03a=_0x7bc03a||0x1f4;return function(_0x279c8c){logger['error'](_0x279c8c[_0xdaf2('0x27')]);if(_0x279c8c[_0xdaf2('0x28')]){delete _0x279c8c[_0xdaf2('0x28')];}_0x151729['status'](_0x7bc03a)[_0xdaf2('0x29')](_0x279c8c);};}exports[_0xdaf2('0x2a')]=function(_0x1df3b5,_0x75cc8){var _0x5bf127={},_0x1d02bf={},_0x29f240={'count':0x0,'rows':[]};var _0x3210c2=_['map'](db[_0xdaf2('0x2b')]['rawAttributes'],function(_0x423962){return{'name':_0x423962['fieldName'],'type':_0x423962[_0xdaf2('0x2c')][_0xdaf2('0x2d')]};});_0x1d02bf[_0xdaf2('0x2e')]=_[_0xdaf2('0x2f')](_0x3210c2,_0xdaf2('0x28'));_0x1d02bf[_0xdaf2('0x30')]=_[_0xdaf2('0x31')](_0x1df3b5['query']);_0x1d02bf['filters']=_[_0xdaf2('0x32')](_0x1d02bf[_0xdaf2('0x2e')],_0x1d02bf['query']);_0x5bf127[_0xdaf2('0x33')]=_[_0xdaf2('0x32')](_0x1d02bf[_0xdaf2('0x2e')],qs[_0xdaf2('0x34')](_0x1df3b5[_0xdaf2('0x30')][_0xdaf2('0x34')]));_0x5bf127[_0xdaf2('0x33')]=_0x5bf127[_0xdaf2('0x33')][_0xdaf2('0x35')]?_0x5bf127[_0xdaf2('0x33')]:_0x1d02bf['model'];if(!_0x1df3b5[_0xdaf2('0x30')][_0xdaf2('0x36')](_0xdaf2('0x37'))){_0x5bf127[_0xdaf2('0x1e')]=qs[_0xdaf2('0x1e')](_0x1df3b5[_0xdaf2('0x30')][_0xdaf2('0x1e')]);_0x5bf127[_0xdaf2('0x1c')]=qs['offset'](_0x1df3b5[_0xdaf2('0x30')][_0xdaf2('0x1c')]);}_0x5bf127[_0xdaf2('0x38')]=qs[_0xdaf2('0x39')](_0x1df3b5[_0xdaf2('0x30')][_0xdaf2('0x39')]);_0x5bf127['where']=qs[_0xdaf2('0x3a')](_[_0xdaf2('0x3b')](_0x1df3b5[_0xdaf2('0x30')],_0x1d02bf[_0xdaf2('0x3a')]),_0x3210c2);if(_0x1df3b5[_0xdaf2('0x30')][_0xdaf2('0x3c')]){_0x5bf127[_0xdaf2('0x3d')]=_[_0xdaf2('0x3e')](_0x5bf127[_0xdaf2('0x3d')],{'$or':_['map'](_0x3210c2,function(_0x308d9b){if(_0x308d9b[_0xdaf2('0x2c')]!==_0xdaf2('0x3f')){var _0x531b88={};_0x531b88[_0x308d9b[_0xdaf2('0x28')]]={'$like':'%'+_0x1df3b5[_0xdaf2('0x30')][_0xdaf2('0x3c')]+'%'};return _0x531b88;}})});}_0x5bf127=_[_0xdaf2('0x3e')]({},_0x5bf127,_0x1df3b5[_0xdaf2('0x40')]);var _0x465e86={'where':_0x5bf127[_0xdaf2('0x3d')]};return db['SmsApplication']['count'](_0x465e86)[_0xdaf2('0x24')](function(_0x338756){_0x29f240[_0xdaf2('0x1f')]=_0x338756;if(_0x1df3b5[_0xdaf2('0x30')][_0xdaf2('0x41')]){_0x5bf127[_0xdaf2('0x42')]=[{'all':!![]}];}return db[_0xdaf2('0x2b')]['findAll'](_0x5bf127);})[_0xdaf2('0x24')](function(_0xc9e41e){_0x29f240['rows']=_0xc9e41e;return _0x29f240;})['then'](respondWithFilteredResult(_0x75cc8,_0x5bf127))['catch'](handleError(_0x75cc8,null));};exports['show']=function(_0x26fd2f,_0xe91663){var _0x139b96={'raw':!![],'where':{'id':_0x26fd2f[_0xdaf2('0x43')]['id']}},_0x57793c={};_0x57793c[_0xdaf2('0x2e')]=_[_0xdaf2('0x31')](db[_0xdaf2('0x2b')][_0xdaf2('0x44')]);_0x57793c['query']=_[_0xdaf2('0x31')](_0x26fd2f['query']);_0x57793c['filters']=_[_0xdaf2('0x32')](_0x57793c[_0xdaf2('0x2e')],_0x57793c[_0xdaf2('0x30')]);_0x139b96[_0xdaf2('0x33')]=_[_0xdaf2('0x32')](_0x57793c[_0xdaf2('0x2e')],qs[_0xdaf2('0x34')](_0x26fd2f[_0xdaf2('0x30')][_0xdaf2('0x34')]));_0x139b96['attributes']=_0x139b96[_0xdaf2('0x33')][_0xdaf2('0x35')]?_0x139b96['attributes']:_0x57793c['model'];if(_0x26fd2f[_0xdaf2('0x30')][_0xdaf2('0x41')]){_0x139b96[_0xdaf2('0x42')]=[{'all':!![]}];}_0x139b96=_[_0xdaf2('0x3e')]({},_0x139b96,_0x26fd2f['options']);return db[_0xdaf2('0x2b')][_0xdaf2('0x45')](_0x139b96)['then'](handleEntityNotFound(_0xe91663,null))[_0xdaf2('0x24')](respondWithResult(_0xe91663,null))[_0xdaf2('0x46')](handleError(_0xe91663,null));};exports[_0xdaf2('0x47')]=function(_0x20a618,_0x2cb7ff){return db[_0xdaf2('0x2b')]['create'](_0x20a618[_0xdaf2('0x48')],{})[_0xdaf2('0x24')](respondWithResult(_0x2cb7ff,0xc9))[_0xdaf2('0x46')](handleError(_0x2cb7ff,null));};exports['update']=function(_0x886e5b,_0x5f467e){if(_0x886e5b['body']['id']){delete _0x886e5b[_0xdaf2('0x48')]['id'];}return db[_0xdaf2('0x2b')]['find']({'where':{'id':_0x886e5b[_0xdaf2('0x43')]['id']}})['then'](handleEntityNotFound(_0x5f467e,null))[_0xdaf2('0x24')](saveUpdates(_0x886e5b[_0xdaf2('0x48')],null))['then'](respondWithResult(_0x5f467e,null))[_0xdaf2('0x46')](handleError(_0x5f467e,null));};exports[_0xdaf2('0x25')]=function(_0x21534e,_0x2fe475){return db[_0xdaf2('0x2b')][_0xdaf2('0x45')]({'where':{'id':_0x21534e[_0xdaf2('0x43')]['id']}})[_0xdaf2('0x24')](handleEntityNotFound(_0x2fe475,null))[_0xdaf2('0x24')](removeEntity(_0x2fe475,null))[_0xdaf2('0x46')](handleError(_0x2fe475,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 88850de..f3df7c1 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 _0xa6b3=['./smsApplication.attributes','exports','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','util','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xa6b3,0x72));var _0x3a6b=function(_0x5a374b,_0x4571bc){_0x5a374b=_0x5a374b-0x0;var _0x4124ae=_0xa6b3[_0x5a374b];return _0x4124ae;};'use strict';var _=require('lodash');var util=require(_0x3a6b('0x0'));var logger=require('../../config/logger')(_0x3a6b('0x1'));var moment=require('moment');var BPromise=require(_0x3a6b('0x2'));var rp=require(_0x3a6b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3a6b('0x4'));var config=require(_0x3a6b('0x5'));var attributes=require(_0x3a6b('0x6'));module[_0x3a6b('0x7')]=function(_0x425173,_0x1aa276){return _0x425173['define'](_0x3a6b('0x8'),attributes,{'tableName':_0x3a6b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3a6b('0xa'),'collate':_0x3a6b('0xb')});}; \ No newline at end of file +var _0x35cf=['path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x58217c,_0x2aea63){var _0x4de8d6=function(_0x578024){while(--_0x578024){_0x58217c['push'](_0x58217c['shift']());}};_0x4de8d6(++_0x2aea63);}(_0x35cf,0xbf));var _0xf35c=function(_0x5796cb,_0x15b2e1){_0x5796cb=_0x5796cb-0x0;var _0x126d5e=_0x35cf[_0x5796cb];return _0x126d5e;};'use strict';var _=require(_0xf35c('0x0'));var util=require(_0xf35c('0x1'));var logger=require(_0xf35c('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf35c('0x3'));var rp=require(_0xf35c('0x4'));var fs=require('fs');var path=require(_0xf35c('0x5'));var rimraf=require(_0xf35c('0x6'));var config=require(_0xf35c('0x7'));var attributes=require(_0xf35c('0x8'));module[_0xf35c('0x9')]=function(_0x1bd1ad,_0x5795e3){return _0x1bd1ad[_0xf35c('0xa')](_0xf35c('0xb'),attributes,{'tableName':_0xf35c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf35c('0xd')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index c359f89..4c12cd7 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 _0xacc6=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsApplication,\x20%s,\x20%s','message','result','catch'];(function(_0x4fbbea,_0x6ff10f){var _0x1faebf=function(_0xdfc63e){while(--_0xdfc63e){_0x4fbbea['push'](_0x4fbbea['shift']());}};_0x1faebf(++_0x6ff10f);}(_0xacc6,0x150));var _0x6acc=function(_0x1b5aea,_0x1afe6f){_0x1b5aea=_0x1b5aea-0x0;var _0x51cae9=_0xacc6[_0x1b5aea];return _0x51cae9;};'use strict';var _=require(_0x6acc('0x0'));var util=require(_0x6acc('0x1'));var moment=require(_0x6acc('0x2'));var BPromise=require(_0x6acc('0x3'));var rs=require(_0x6acc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6acc('0x5'))['db'];var utils=require(_0x6acc('0x6'));var logger=require(_0x6acc('0x7'))('rpc');var config=require(_0x6acc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6acc('0x9')][_0x6acc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e7f3a,_0x41edfd,_0x48b1a8){return new BPromise(function(_0x1f95e8,_0x538730){return client[_0x6acc('0xb')](_0x5e7f3a,_0x48b1a8)[_0x6acc('0xc')](function(_0x4d6b7f){logger[_0x6acc('0xd')]('SmsApplication,\x20%s,\x20%s',_0x41edfd,_0x6acc('0xe'));logger[_0x6acc('0xf')](_0x6acc('0x10'),_0x41edfd,_0x6acc('0xe'),JSON[_0x6acc('0x11')](_0x4d6b7f));if(_0x4d6b7f[_0x6acc('0x12')]){if(_0x4d6b7f['error'][_0x6acc('0x13')]===0x1f4){logger[_0x6acc('0x12')](_0x6acc('0x14'),_0x41edfd,_0x4d6b7f[_0x6acc('0x12')][_0x6acc('0x15')]);return _0x538730(_0x4d6b7f['error']['message']);}logger[_0x6acc('0x12')](_0x6acc('0x14'),_0x41edfd,_0x4d6b7f[_0x6acc('0x12')][_0x6acc('0x15')]);return _0x1f95e8(_0x4d6b7f[_0x6acc('0x12')][_0x6acc('0x15')]);}else{logger[_0x6acc('0xd')](_0x6acc('0x14'),_0x41edfd,_0x6acc('0xe'));_0x1f95e8(_0x4d6b7f[_0x6acc('0x16')][_0x6acc('0x15')]);}})[_0x6acc('0x17')](function(_0x31c4c2){logger[_0x6acc('0x12')](_0x6acc('0x14'),_0x41edfd,_0x31c4c2);_0x538730(_0x31c4c2);});});} \ No newline at end of file +var _0x61f1=['jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x28495c,_0x3297b1){var _0x48bf4e=function(_0x1fe8ea){while(--_0x1fe8ea){_0x28495c['push'](_0x28495c['shift']());}};_0x48bf4e(++_0x3297b1);}(_0x61f1,0x18a));var _0x161f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x61f1[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x161f('0x0'));var moment=require('moment');var BPromise=require(_0x161f('0x1'));var rs=require(_0x161f('0x2'));var fs=require('fs');var Redis=require(_0x161f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x161f('0x4'))(_0x161f('0x5'));var config=require('../../config/environment');var jayson=require(_0x161f('0x6'));var client=jayson[_0x161f('0x7')][_0x161f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xf8174c,_0xd1ad5d,_0x4ff5e1){return new BPromise(function(_0x910af4,_0x31f44e){return client[_0x161f('0x9')](_0xf8174c,_0x4ff5e1)[_0x161f('0xa')](function(_0x24bc8a){logger[_0x161f('0xb')](_0x161f('0xc'),_0xd1ad5d,_0x161f('0xd'));logger[_0x161f('0xe')](_0x161f('0xf'),_0xd1ad5d,_0x161f('0xd'),JSON['stringify'](_0x24bc8a));if(_0x24bc8a[_0x161f('0x10')]){if(_0x24bc8a[_0x161f('0x10')][_0x161f('0x11')]===0x1f4){logger[_0x161f('0x10')](_0x161f('0xc'),_0xd1ad5d,_0x24bc8a['error'][_0x161f('0x12')]);return _0x31f44e(_0x24bc8a[_0x161f('0x10')][_0x161f('0x12')]);}logger[_0x161f('0x10')]('SmsApplication,\x20%s,\x20%s',_0xd1ad5d,_0x24bc8a[_0x161f('0x10')][_0x161f('0x12')]);return _0x910af4(_0x24bc8a[_0x161f('0x10')][_0x161f('0x12')]);}else{logger[_0x161f('0xb')](_0x161f('0xc'),_0xd1ad5d,'request\x20sent');_0x910af4(_0x24bc8a['result'][_0x161f('0x12')]);}})[_0x161f('0x13')](function(_0x189a95){logger['error'](_0x161f('0xc'),_0xd1ad5d,_0x189a95);_0x31f44e(_0x189a95);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 777874f..40c5919 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 _0x80ed=['delete','smsinteraction:destroy','destroy','/:id/tags','removeTags','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','/:id/download','download','post','create','tracked','sms','smsinteraction:addtags','addTags','smsinteraction:update','update'];(function(_0x1a7e4b,_0x2fbd40){var _0x37a8fd=function(_0x4eaa73){while(--_0x4eaa73){_0x1a7e4b['push'](_0x1a7e4b['shift']());}};_0x37a8fd(++_0x2fbd40);}(_0x80ed,0x11c));var _0xd80e=function(_0x2be710,_0x25901d){_0x2be710=_0x2be710-0x0;var _0x54f3fb=_0x80ed[_0x2be710];return _0x54f3fb;};'use strict';var multer=require(_0xd80e('0x0'));var util=require('util');var path=require(_0xd80e('0x1'));var timeout=require(_0xd80e('0x2'));var express=require(_0xd80e('0x3'));var router=express['Router']();var fs_extra=require(_0xd80e('0x4'));var auth=require(_0xd80e('0x5'));var interaction=require(_0xd80e('0x6'));var config=require(_0xd80e('0x7'));var controller=require('./smsInteraction.controller');router[_0xd80e('0x8')]('/',auth[_0xd80e('0x9')](),controller[_0xd80e('0xa')]);router['get'](_0xd80e('0xb'),auth[_0xd80e('0x9')](),controller[_0xd80e('0xc')]);router[_0xd80e('0x8')](_0xd80e('0xd'),auth[_0xd80e('0x9')](),controller[_0xd80e('0xe')]);router[_0xd80e('0x8')](_0xd80e('0xf'),auth[_0xd80e('0x9')](),controller['getMessages']);router[_0xd80e('0x8')](_0xd80e('0x10'),auth[_0xd80e('0x9')](),controller[_0xd80e('0x11')]);router[_0xd80e('0x12')]('/',auth[_0xd80e('0x9')](),controller[_0xd80e('0x13')]);router[_0xd80e('0x12')](_0xd80e('0xf'),auth['isAuthenticated'](),controller['addMessage']);router['post']('/:id/tags',auth[_0xd80e('0x9')](),interaction[_0xd80e('0x14')](_0xd80e('0x15'),_0xd80e('0x16')),controller[_0xd80e('0x17')]);router['put'](_0xd80e('0xd'),auth[_0xd80e('0x9')](),interaction[_0xd80e('0x14')](_0xd80e('0x15'),_0xd80e('0x18')),controller[_0xd80e('0x19')]);router[_0xd80e('0x1a')](_0xd80e('0xd'),auth['isAuthenticated'](),interaction[_0xd80e('0x14')](_0xd80e('0x15'),_0xd80e('0x1b')),controller[_0xd80e('0x1c')]);router['delete'](_0xd80e('0x1d'),auth[_0xd80e('0x9')](),controller[_0xd80e('0x1e')]);module['exports']=router; \ No newline at end of file +var _0xe511=['addTags','put','update','smsinteraction:destroy','destroy','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','describe','show','/:id/messages','isAuthenticated','getMessages','download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0xe511,0x16f));var _0x1e51=function(_0x16af15,_0x55bc76){_0x16af15=_0x16af15-0x0;var _0xfeda8a=_0xe511[_0x16af15];return _0xfeda8a;};'use strict';var multer=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var path=require('path');var timeout=require(_0x1e51('0x2'));var express=require('express');var router=express[_0x1e51('0x3')]();var fs_extra=require(_0x1e51('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1e51('0x5'));var config=require(_0x1e51('0x6'));var controller=require(_0x1e51('0x7'));router[_0x1e51('0x8')]('/',auth['isAuthenticated'](),controller[_0x1e51('0x9')]);router[_0x1e51('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x1e51('0xa')]);router[_0x1e51('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x1e51('0xb')]);router[_0x1e51('0x8')](_0x1e51('0xc'),auth[_0x1e51('0xd')](),controller[_0x1e51('0xe')]);router[_0x1e51('0x8')]('/:id/download',auth[_0x1e51('0xd')](),controller[_0x1e51('0xf')]);router[_0x1e51('0x10')]('/',auth[_0x1e51('0xd')](),controller[_0x1e51('0x11')]);router[_0x1e51('0x10')]('/:id/messages',auth[_0x1e51('0xd')](),controller[_0x1e51('0x12')]);router[_0x1e51('0x10')](_0x1e51('0x13'),auth[_0x1e51('0xd')](),interaction[_0x1e51('0x14')](_0x1e51('0x15'),_0x1e51('0x16')),controller[_0x1e51('0x17')]);router[_0x1e51('0x18')]('/:id',auth[_0x1e51('0xd')](),interaction[_0x1e51('0x14')](_0x1e51('0x15'),'smsinteraction:update'),controller[_0x1e51('0x19')]);router['delete']('/:id',auth[_0x1e51('0xd')](),interaction[_0x1e51('0x14')](_0x1e51('0x15'),_0x1e51('0x1a')),controller[_0x1e51('0x1b')]);router[_0x1e51('0x1c')]('/:id/tags',auth[_0x1e51('0xd')](),controller['removeTags']);module[_0x1e51('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index a7dcd47..1b3e69e 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 _0xd8fb=['out','sequelize','moment','exports','BOOLEAN','STRING','DATE','ENUM'];(function(_0x2aa921,_0x4d3cb9){var _0x4c894f=function(_0x5c3e54){while(--_0x5c3e54){_0x2aa921['push'](_0x2aa921['shift']());}};_0x4c894f(++_0x4d3cb9);}(_0xd8fb,0x99));var _0xbd8f=function(_0x413df2,_0x2121a3){_0x413df2=_0x413df2-0x0;var _0x6b780a=_0xd8fb[_0x413df2];return _0x6b780a;};'use strict';var Sequelize=require(_0xbd8f('0x0'));var moment=require(_0xbd8f('0x1'));module[_0xbd8f('0x2')]={'closed':{'type':Sequelize[_0xbd8f('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xbd8f('0x4')]},'note':{'type':Sequelize[_0xbd8f('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xbd8f('0x5')]},'firstMsgDirection':{'type':Sequelize[_0xbd8f('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xbd8f('0x5')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xbd8f('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xf2e0=['STRING','ENUM','out','sequelize','moment','BOOLEAN','DATE'];(function(_0x534e78,_0x2ca971){var _0x74e9be=function(_0x2ad1f0){while(--_0x2ad1f0){_0x534e78['push'](_0x534e78['shift']());}};_0x74e9be(++_0x2ca971);}(_0xf2e0,0xc7));var _0x0f2e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xf2e0[_0x4243a3];return _0x1b2a33;};'use strict';var Sequelize=require(_0x0f2e('0x0'));var moment=require(_0x0f2e('0x1'));module['exports']={'closed':{'type':Sequelize[_0x0f2e('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0f2e('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x0f2e('0x4')]},'thirdDisposition':{'type':Sequelize[_0x0f2e('0x4')]},'note':{'type':Sequelize[_0x0f2e('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x0f2e('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x0f2e('0x5')]('in',_0x0f2e('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x0f2e('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index a500888..f8d0f48 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 _0xf6c3=['root','server','files','tmp','format','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','secret','read','Account','Owner','mkdirSync','Sms','N.A.','toString','closed','closedAt','disposition','createdAt','direction','out','System','lastName','value','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','rimraf','zip-dir','moment','bluebird','util','path','ejs','../../components/interaction/service','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','name','send','map','SmsInteraction','rawAttributes','fieldName','type','key','findAll','sms','query','user','catch','params','model','keys','filters','intersection','attributes','fields','include','find','create','body','describe','addMessage','SmsMessage','ids','getMessages','findOne','length','hasOwnProperty','nolimit','order','sort','where','pick','SmsInteractionId','$gte','split','YYYY-MM-DD\x20HH:mm:ss','merge','rows','addTags','setTags','omit','spread','color','emit','smsInteractionTags:save','removeTags','download','unix','join'];(function(_0x5313aa,_0x5c3a1c){var _0x3186af=function(_0x121f29){while(--_0x121f29){_0x5313aa['push'](_0x5313aa['shift']());}};_0x3186af(++_0x5c3a1c);}(_0xf6c3,0x9a));var _0x3f6c=function(_0x1d1ac3,_0x51c305){_0x1d1ac3=_0x1d1ac3-0x0;var _0x5a63ec=_0xf6c3[_0x1d1ac3];return _0x5a63ec;};'use strict';var rimraf=require(_0x3f6c('0x0'));var zipdir=require(_0x3f6c('0x1'));var moment=require(_0x3f6c('0x2'));var BPromise=require(_0x3f6c('0x3'));var util=require(_0x3f6c('0x4'));var path=require(_0x3f6c('0x5'));var ejs=require(_0x3f6c('0x6'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0x3f6c('0x7'));var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0x3f6c('0x8'))(_0x3f6c('0x9'));var config=require(_0x3f6c('0xa'));var db=require('../../mysqldb')['db'];config[_0x3f6c('0xb')]=_[_0x3f6c('0xc')](config[_0x3f6c('0xb')],{'host':_0x3f6c('0xd'),'port':0x18eb});var socket=require(_0x3f6c('0xe'))(new Redis(config['redis']));require('./smsInteraction.socket')[_0x3f6c('0xf')](socket);function respondWithStatusCode(_0x10a723,_0x1e27f8){_0x1e27f8=_0x1e27f8||0xcc;return function(_0x11c4f8){if(_0x11c4f8){return _0x10a723[_0x3f6c('0x10')](_0x1e27f8);}return _0x10a723['status'](_0x1e27f8)[_0x3f6c('0x11')]();};}function respondWithResult(_0x5ea4a2,_0x212c63){_0x212c63=_0x212c63||0xc8;return function(_0x5c6875){if(_0x5c6875){return _0x5ea4a2[_0x3f6c('0x12')](_0x212c63)[_0x3f6c('0x13')](_0x5c6875);}};}function respondWithFilteredResult(_0x251a41,_0x1cc1e7){return function(_0xea8b92){if(_0xea8b92){var _0x9af308=typeof _0x1cc1e7[_0x3f6c('0x14')]===_0x3f6c('0x15')&&typeof _0x1cc1e7[_0x3f6c('0x16')]===_0x3f6c('0x15');var _0x529161=_0xea8b92[_0x3f6c('0x17')];var _0x267de8=_0x9af308?0x0:_0x1cc1e7[_0x3f6c('0x14')];var _0x38ac55=_0x9af308?_0xea8b92[_0x3f6c('0x17')]:_0x1cc1e7['offset']+_0x1cc1e7[_0x3f6c('0x16')];var _0x14b37e;if(_0x38ac55>=_0x529161){_0x38ac55=_0x529161;_0x14b37e=0xc8;}else{_0x14b37e=0xce;}_0x251a41['status'](_0x14b37e);return _0x251a41[_0x3f6c('0x18')](_0x3f6c('0x19'),_0x267de8+'-'+_0x38ac55+'/'+_0x529161)[_0x3f6c('0x13')](_0xea8b92);}return null;};}function saveUpdates(_0x3fd187){return function(_0x31ceb5){if(_0x31ceb5){return _0x31ceb5[_0x3f6c('0x1a')](_0x3fd187)[_0x3f6c('0x1b')](function(_0x1fae76){return _0x1fae76;});}return null;};}function removeEntity(_0x570023){return function(_0x521898){if(_0x521898){return _0x521898[_0x3f6c('0x1c')]()[_0x3f6c('0x1b')](function(){_0x570023[_0x3f6c('0x12')](0xcc)[_0x3f6c('0x11')]();});}};}function handleEntityNotFound(_0x3d06e2){return function(_0x46ada7){if(!_0x46ada7){_0x3d06e2[_0x3f6c('0x10')](0x194);}return _0x46ada7;};}function handleError(_0x572aa7,_0x47ea4f){_0x47ea4f=_0x47ea4f||0x1f4;return function(_0x3ed993){logger[_0x3f6c('0x1d')](_0x3ed993['stack']);if(_0x3ed993[_0x3f6c('0x1e')]){delete _0x3ed993[_0x3f6c('0x1e')];}_0x572aa7['status'](_0x47ea4f)[_0x3f6c('0x1f')](_0x3ed993);};}exports['index']=function(_0x354954,_0x5019ee){var _0x204944={};var _0x51d921=_[_0x3f6c('0x20')](db[_0x3f6c('0x21')][_0x3f6c('0x22')],function(_0x812f98){return{'name':_0x812f98[_0x3f6c('0x23')],'type':_0x812f98[_0x3f6c('0x24')][_0x3f6c('0x25')]};});_0x204944=qs['getOptions'](_0x51d921,_0x354954);return interaction[_0x3f6c('0x26')](_0x3f6c('0x27'),_0x354954[_0x3f6c('0x28')],_0x354954[_0x3f6c('0x29')],_0x204944,_0x51d921)[_0x3f6c('0x1b')](respondWithFilteredResult(_0x5019ee,_0x204944))[_0x3f6c('0x2a')](handleError(_0x5019ee,null));};exports['show']=function(_0x511fd7,_0x47804d){var _0x5cc3a8={'raw':![],'where':{'id':_0x511fd7[_0x3f6c('0x2b')]['id']}},_0x545d06={};_0x545d06[_0x3f6c('0x2c')]=_['keys'](db[_0x3f6c('0x21')]['rawAttributes']);_0x545d06[_0x3f6c('0x28')]=_[_0x3f6c('0x2d')](_0x511fd7[_0x3f6c('0x28')]);_0x545d06[_0x3f6c('0x2e')]=_[_0x3f6c('0x2f')](_0x545d06['model'],_0x545d06['query']);_0x5cc3a8[_0x3f6c('0x30')]=_[_0x3f6c('0x2f')](_0x545d06[_0x3f6c('0x2c')],qs[_0x3f6c('0x31')](_0x511fd7[_0x3f6c('0x28')][_0x3f6c('0x31')]));_0x5cc3a8['attributes']=_0x5cc3a8[_0x3f6c('0x30')]['length']?_0x5cc3a8[_0x3f6c('0x30')]:_0x545d06[_0x3f6c('0x2c')];if(_0x511fd7[_0x3f6c('0x28')]['includeAll']){_0x5cc3a8[_0x3f6c('0x32')]=[{'all':!![]}];}_0x5cc3a8=_['merge']({},_0x5cc3a8,_0x511fd7['options']);return db[_0x3f6c('0x21')][_0x3f6c('0x33')](_0x5cc3a8)[_0x3f6c('0x1b')](handleEntityNotFound(_0x47804d,null))['then'](respondWithResult(_0x47804d,null))[_0x3f6c('0x2a')](handleError(_0x47804d,null));};exports['create']=function(_0x2123b2,_0x4a9886){return db[_0x3f6c('0x21')][_0x3f6c('0x34')](_0x2123b2['body'],{})[_0x3f6c('0x1b')](respondWithResult(_0x4a9886,0xc9))['catch'](handleError(_0x4a9886,null));};exports[_0x3f6c('0x1a')]=function(_0x3cf153,_0x221656){if(_0x3cf153['body']['id']){delete _0x3cf153['body']['id'];}return db['SmsInteraction'][_0x3f6c('0x33')]({'where':{'id':_0x3cf153[_0x3f6c('0x2b')]['id']}})[_0x3f6c('0x1b')](handleEntityNotFound(_0x221656,null))[_0x3f6c('0x1b')](saveUpdates(_0x3cf153[_0x3f6c('0x35')],null))[_0x3f6c('0x1b')](respondWithResult(_0x221656,null))[_0x3f6c('0x2a')](handleError(_0x221656,null));};exports[_0x3f6c('0x1c')]=function(_0x56420c,_0x506ad7){return db[_0x3f6c('0x21')][_0x3f6c('0x33')]({'where':{'id':_0x56420c['params']['id']}})[_0x3f6c('0x1b')](handleEntityNotFound(_0x506ad7,null))[_0x3f6c('0x1b')](removeEntity(_0x506ad7,null))[_0x3f6c('0x2a')](handleError(_0x506ad7,null));};exports[_0x3f6c('0x36')]=function(_0x2d0137,_0x37eb6e){return db[_0x3f6c('0x21')]['describe']()[_0x3f6c('0x1b')](respondWithResult(_0x37eb6e,null))[_0x3f6c('0x2a')](handleError(_0x37eb6e,null));};exports[_0x3f6c('0x37')]=function(_0x3e6373,_0x116826){return db[_0x3f6c('0x38')][_0x3f6c('0x33')]({'where':{'id':_0x3e6373[_0x3f6c('0x2b')]['id']}})['then'](handleEntityNotFound(_0x116826,null))['then'](function(_0xa79669){if(_0xa79669){return _0xa79669['addMessage'](_0x3e6373[_0x3f6c('0x35')]['ids'],_['omit'](_0x3e6373[_0x3f6c('0x35')],[_0x3f6c('0x39'),'id'])||{});}})[_0x3f6c('0x1b')](respondWithResult(_0x116826,null))[_0x3f6c('0x2a')](handleError(_0x116826,null));};exports[_0x3f6c('0x3a')]=function(_0x5f0800,_0x28059a){var _0x5d759c={'raw':![],'where':{}};var _0x1d0b4f={};var _0x28ddd3={'count':0x0,'rows':[]};return db[_0x3f6c('0x21')][_0x3f6c('0x3b')]({'where':{'id':_0x5f0800['params']['id']}})['then'](handleEntityNotFound(_0x28059a,null))[_0x3f6c('0x1b')](function(_0x3246ab){if(_0x3246ab){_0x1d0b4f[_0x3f6c('0x2c')]=_[_0x3f6c('0x2d')](db[_0x3f6c('0x38')]['rawAttributes']);_0x1d0b4f[_0x3f6c('0x28')]=_[_0x3f6c('0x2d')](_0x5f0800[_0x3f6c('0x28')]);_0x1d0b4f[_0x3f6c('0x2e')]=_[_0x3f6c('0x2f')](_0x1d0b4f[_0x3f6c('0x2c')],_0x1d0b4f[_0x3f6c('0x28')]);_0x5d759c['attributes']=_['intersection'](_0x1d0b4f[_0x3f6c('0x2c')],qs[_0x3f6c('0x31')](_0x5f0800[_0x3f6c('0x28')][_0x3f6c('0x31')]));_0x5d759c[_0x3f6c('0x30')]=_0x5d759c[_0x3f6c('0x30')][_0x3f6c('0x3c')]?_0x5d759c[_0x3f6c('0x30')]:_0x1d0b4f[_0x3f6c('0x2c')];if(!_0x5f0800[_0x3f6c('0x28')][_0x3f6c('0x3d')](_0x3f6c('0x3e'))){_0x5d759c['limit']=qs['limit'](_0x5f0800[_0x3f6c('0x28')][_0x3f6c('0x16')]);_0x5d759c[_0x3f6c('0x14')]=qs[_0x3f6c('0x14')](_0x5f0800[_0x3f6c('0x28')][_0x3f6c('0x14')]);}_0x5d759c[_0x3f6c('0x3f')]=qs[_0x3f6c('0x40')](_0x5f0800['query']['sort']);_0x5d759c[_0x3f6c('0x41')]=qs[_0x3f6c('0x2e')](_[_0x3f6c('0x42')](_0x5f0800[_0x3f6c('0x28')],_0x1d0b4f[_0x3f6c('0x2e')]));_0x5d759c[_0x3f6c('0x41')][_0x3f6c('0x43')]=_0x3246ab['id'];if(_0x5f0800[_0x3f6c('0x28')]['filter']){_0x5d759c[_0x3f6c('0x41')]=_['merge'](_0x5d759c[_0x3f6c('0x41')],{'$or':_[_0x3f6c('0x20')](_0x5d759c[_0x3f6c('0x30')],function(_0x41d882){var _0x3c1463={};_0x3c1463[_0x41d882]={'$like':'%'+_0x5f0800[_0x3f6c('0x28')]['filter']+'%'};return _0x3c1463;})});}if(_0x5f0800[_0x3f6c('0x28')]['$gte']){var _0xb6d9f5=_0x5f0800[_0x3f6c('0x28')][_0x3f6c('0x44')][_0x3f6c('0x45')](',');var _0x147150={};_0x147150[_0xb6d9f5[0x0]]={'$gte':moment(_0xb6d9f5[0x1])['format'](_0x3f6c('0x46'))};_0x5d759c[_0x3f6c('0x41')]=_[_0x3f6c('0x47')](_0x5d759c['where'],_0x147150);}_0x5d759c=_[_0x3f6c('0x47')]({},_0x5d759c,_0x5f0800['options']);return db[_0x3f6c('0x38')][_0x3f6c('0x17')]({'where':_0x5d759c['where']})['then'](function(_0x23f981){_0x28ddd3[_0x3f6c('0x17')]=_0x23f981;if(_0x5f0800[_0x3f6c('0x28')]['includeAll']){_0x5d759c[_0x3f6c('0x32')]=[{'all':!![]}];}return db[_0x3f6c('0x38')][_0x3f6c('0x26')](_0x5d759c);})[_0x3f6c('0x1b')](function(_0xae4259){_0x28ddd3[_0x3f6c('0x48')]=_0xae4259;return _0x28ddd3;});}})[_0x3f6c('0x1b')](respondWithFilteredResult(_0x28059a,_0x5d759c))[_0x3f6c('0x2a')](handleError(_0x28059a,null));};exports[_0x3f6c('0x49')]=function(_0x4d8704,_0x8c55d){return db[_0x3f6c('0x21')][_0x3f6c('0x33')]({'where':{'id':_0x4d8704['params']['id']}})[_0x3f6c('0x1b')](handleEntityNotFound(_0x8c55d,null))['then'](function(_0x2921db){if(_0x2921db){return _0x2921db[_0x3f6c('0x4a')](_0x4d8704['body'][_0x3f6c('0x39')],_[_0x3f6c('0x4b')](_0x4d8704[_0x3f6c('0x35')],[_0x3f6c('0x39'),'id'])||{})[_0x3f6c('0x4c')](function(){return db['Tag'][_0x3f6c('0x26')]({'attributes':['id',_0x3f6c('0x1e'),_0x3f6c('0x4d')],'where':{'id':_0x4d8704[_0x3f6c('0x35')][_0x3f6c('0x39')]}});})[_0x3f6c('0x1b')](function(_0x5c6f13){socket[_0x3f6c('0x4e')](_0x3f6c('0x4f'),{'id':Number(_0x4d8704[_0x3f6c('0x2b')]['id']),'tags':_0x5c6f13||[]});return{'id':Number(_0x4d8704[_0x3f6c('0x2b')]['id']),'tags':_0x5c6f13||[]};});}})['then'](respondWithResult(_0x8c55d,null))[_0x3f6c('0x2a')](handleError(_0x8c55d,null));};exports[_0x3f6c('0x50')]=function(_0x2002bc,_0x4fae4f){return db[_0x3f6c('0x21')][_0x3f6c('0x33')]({'where':{'id':_0x2002bc[_0x3f6c('0x2b')]['id']}})['then'](handleEntityNotFound(_0x4fae4f,null))[_0x3f6c('0x1b')](function(_0x2997c5){if(_0x2997c5){return _0x2997c5[_0x3f6c('0x50')](_0x2002bc['query'][_0x3f6c('0x39')]);}})[_0x3f6c('0x1b')](respondWithStatusCode(_0x4fae4f,null))[_0x3f6c('0x2a')](handleError(_0x4fae4f,null));};exports[_0x3f6c('0x51')]=function(_0x2f43a8,_0x2f96f2){var _0x55be66=moment()[_0x3f6c('0x52')]()['toString']();var _0xe1a2e2=path[_0x3f6c('0x53')](config[_0x3f6c('0x54')],_0x3f6c('0x55'),_0x3f6c('0x56'),_0x3f6c('0x57'));var _0x52cc50=path[_0x3f6c('0x53')](_0xe1a2e2,_0x55be66);var _0xc61563=util[_0x3f6c('0x58')](_0x3f6c('0x59'),_0x2f43a8[_0x3f6c('0x2b')]['id'],_0x55be66);var _0x5b7e51=path[_0x3f6c('0x53')](_0xe1a2e2,_0xc61563);var _0x4eb696=[];_0x4eb696[_0x3f6c('0x5a')]({'model':db[_0x3f6c('0x5b')],'as':_0x3f6c('0x5b'),'attributes':['id',_0x3f6c('0x5c')],'raw':!![]});_0x4eb696[_0x3f6c('0x5a')]({'model':db[_0x3f6c('0x5d')],'as':_0x3f6c('0x5e'),'attributes':['id',_0x3f6c('0x5f'),'lastName'],'raw':!![]});var _0x46cd32=[{'model':db[_0x3f6c('0x38')],'as':'Messages','attributes':['id',_0x3f6c('0x35'),'createdAt','direction',_0x3f6c('0x60'),_0x3f6c('0x61')],'include':_0x4eb696}];_0x46cd32[_0x3f6c('0x5a')]({'model':db['SmsAccount'],'as':_0x3f6c('0x62'),'attributes':['id',_0x3f6c('0x1e')]});_0x46cd32['push']({'model':db[_0x3f6c('0x5b')],'as':_0x3f6c('0x63'),'attributes':['id',_0x3f6c('0x5c')]});return db[_0x3f6c('0x21')][_0x3f6c('0x33')]({'where':{'id':_0x2f43a8[_0x3f6c('0x2b')]['id']},'include':_0x46cd32})['then'](handleEntityNotFound(_0x2f96f2,null))[_0x3f6c('0x1b')](function(_0x5d51ff){if(_0x5d51ff){var _0x3c3a4a=_0x5d51ff['get']({'plain':!![]});fs[_0x3f6c('0x64')](_0x52cc50);var _0x287be2={'channel':_0x3f6c('0x65'),'account':_0x3c3a4a['Account'][_0x3f6c('0x1e')],'agent':_0x3c3a4a['Owner']?_0x3c3a4a['Owner'][_0x3f6c('0x5c')]:_0x3f6c('0x66'),'createdAt':moment(_0x3c3a4a['createdAt'])[_0x3f6c('0x58')](_0x3f6c('0x46'))[_0x3f6c('0x67')](),'closedAt':_0x3c3a4a[_0x3f6c('0x68')]?moment(_0x3c3a4a[_0x3f6c('0x69')])[_0x3f6c('0x58')](_0x3f6c('0x46'))[_0x3f6c('0x67')]():'','disposition':_0x3c3a4a[_0x3f6c('0x6a')],'messages':_(_0x3c3a4a['Messages'])['filter']({'secret':![]})['map'](function(_0x220e3d){return{'date':moment(_0x220e3d[_0x3f6c('0x6b')])[_0x3f6c('0x58')](_0x3f6c('0x46'))[_0x3f6c('0x67')](),'sender':_0x220e3d[_0x3f6c('0x6c')]===_0x3f6c('0x6d')?_0x220e3d[_0x3f6c('0x5b')]?_0x220e3d[_0x3f6c('0x5b')][_0x3f6c('0x5c')]:_0x3f6c('0x6e'):_0x220e3d[_0x3f6c('0x5e')][_0x3f6c('0x5f')]+(_0x220e3d[_0x3f6c('0x5e')][_0x3f6c('0x6f')]?'\x20'+_0x220e3d['Contact']['lastName']:''),'body':_0x220e3d['body'],'direction':_0x220e3d[_0x3f6c('0x6c')]===_0x3f6c('0x6d')?'A':'C','secret':_0x220e3d['secret'],'read':_0x220e3d['read']};})[_0x3f6c('0x70')]()};return ejs['renderFile'](path[_0x3f6c('0x53')](config['root'],_0x3f6c('0x55'),'views',_0x3f6c('0x71')),{'interaction':_0x287be2})[_0x3f6c('0x1b')](function(_0x49dff8){var _0x35bbd2=path['join'](_0x52cc50,_0x3f6c('0x72')+_0x3c3a4a['id']+'-'+_0x55be66+_0x3f6c('0x73'));var _0x2964b2={'path':_0x35bbd2,'channel':_0x3f6c('0x65'),'interactionId':_0x3c3a4a['id']};return pdf[_0x3f6c('0x74')](_0x49dff8,_0x2964b2);})[_0x3f6c('0x1b')](function(){return new BPromise(function(_0x4f206c,_0x1e72a7){zipdir(_0x52cc50,{'saveTo':_0x5b7e51},function(_0x33a450,_0x489990){if(_0x33a450)return _0x1e72a7(_0x33a450);return _0x4f206c(_0x489990);});})['then'](function(){return new BPromise(function(_0x581d1b,_0x2cca75){rimraf(_0x52cc50,function(_0x49d778){if(_0x49d778)_0x2cca75(_0x49d778);return _0x581d1b();});});})[_0x3f6c('0x1b')](function(){return _0x2f96f2[_0x3f6c('0x51')](_0x5b7e51,_0xc61563,function(_0x1781bc){if(_0x1781bc){console[_0x3f6c('0x75')](_0x3f6c('0x76'),_0x1781bc);}else{fs['unlinkSync'](_0x5b7e51);}});});});}else{return _0x2f96f2[_0x3f6c('0x10')](0xc8);}})[_0x3f6c('0x2a')](handleError(_0x2f96f2,null));}; \ No newline at end of file +var _0x9240=['includeAll','options','find','create','body','params','describe','addMessage','SmsMessage','omit','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','SmsInteractionId','merge','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','spread','color','smsInteractionTags:save','removeTags','download','toString','join','root','files','tmp','format','push','User','fullname','CmContact','firstName','Messages','createdAt','direction','secret','read','Account','Owner','get','mkdirSync','N.A.','closedAt','disposition','out','System','Contact','lastName','value','renderFile','server','views','downloadInteraction.ejs','transcript-','.pdf','Sms','log','unlinkSync','zip-dir','moment','bluebird','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','update','destroy','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','getOptions','sms','query','user','catch','show','keys','SmsInteraction','filters','model','attributes','intersection','fields','length'];(function(_0x55ee1e,_0x526d70){var _0xb2fe79=function(_0x41d034){while(--_0x41d034){_0x55ee1e['push'](_0x55ee1e['shift']());}};_0xb2fe79(++_0x526d70);}(_0x9240,0x13b));var _0x0924=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0x9240[_0x46d0c9];return _0x174506;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x0924('0x0'));var moment=require(_0x0924('0x1'));var BPromise=require(_0x0924('0x2'));var util=require('util');var path=require(_0x0924('0x3'));var ejs=require(_0x0924('0x4'));var fs=require('fs');var _=require(_0x0924('0x5'));var Redis=require(_0x0924('0x6'));var interaction=require(_0x0924('0x7'));var qs=require(_0x0924('0x8'));var pdf=require(_0x0924('0x9'));var logger=require(_0x0924('0xa'))(_0x0924('0xb'));var config=require(_0x0924('0xc'));var db=require(_0x0924('0xd'))['db'];config[_0x0924('0xe')]=_[_0x0924('0xf')](config[_0x0924('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x0924('0x10'))(new Redis(config[_0x0924('0xe')]));require('./smsInteraction.socket')[_0x0924('0x11')](socket);function respondWithStatusCode(_0x195adf,_0xba4ddf){_0xba4ddf=_0xba4ddf||0xcc;return function(_0x352349){if(_0x352349){return _0x195adf[_0x0924('0x12')](_0xba4ddf);}return _0x195adf[_0x0924('0x13')](_0xba4ddf)['end']();};}function respondWithResult(_0x10d4eb,_0x40291e){_0x40291e=_0x40291e||0xc8;return function(_0x3a3647){if(_0x3a3647){return _0x10d4eb['status'](_0x40291e)['json'](_0x3a3647);}};}function respondWithFilteredResult(_0x25248d,_0xbf72de){return function(_0x4b0f19){if(_0x4b0f19){var _0x696803=typeof _0xbf72de[_0x0924('0x14')]===_0x0924('0x15')&&typeof _0xbf72de[_0x0924('0x16')]===_0x0924('0x15');var _0x587c2f=_0x4b0f19[_0x0924('0x17')];var _0x29da1a=_0x696803?0x0:_0xbf72de['offset'];var _0x12d263=_0x696803?_0x4b0f19[_0x0924('0x17')]:_0xbf72de[_0x0924('0x14')]+_0xbf72de[_0x0924('0x16')];var _0x57f86e;if(_0x12d263>=_0x587c2f){_0x12d263=_0x587c2f;_0x57f86e=0xc8;}else{_0x57f86e=0xce;}_0x25248d[_0x0924('0x13')](_0x57f86e);return _0x25248d[_0x0924('0x18')](_0x0924('0x19'),_0x29da1a+'-'+_0x12d263+'/'+_0x587c2f)[_0x0924('0x1a')](_0x4b0f19);}return null;};}function saveUpdates(_0x51800f){return function(_0x2a8606){if(_0x2a8606){return _0x2a8606[_0x0924('0x1b')](_0x51800f)['then'](function(_0xd69832){return _0xd69832;});}return null;};}function removeEntity(_0x273107){return function(_0x10acc2){if(_0x10acc2){return _0x10acc2[_0x0924('0x1c')]()[_0x0924('0x1d')](function(){_0x273107[_0x0924('0x13')](0xcc)[_0x0924('0x1e')]();});}};}function handleEntityNotFound(_0x4f685a){return function(_0x41964b){if(!_0x41964b){_0x4f685a[_0x0924('0x12')](0x194);}return _0x41964b;};}function handleError(_0xbe1596,_0x589b54){_0x589b54=_0x589b54||0x1f4;return function(_0x5285aa){logger[_0x0924('0x1f')](_0x5285aa[_0x0924('0x20')]);if(_0x5285aa['name']){delete _0x5285aa[_0x0924('0x21')];}_0xbe1596[_0x0924('0x13')](_0x589b54)[_0x0924('0x22')](_0x5285aa);};}exports[_0x0924('0x23')]=function(_0x363697,_0xb5c9a0){var _0x423e15={};var _0x39feeb=_[_0x0924('0x24')](db['SmsInteraction'][_0x0924('0x25')],function(_0x329168){return{'name':_0x329168[_0x0924('0x26')],'type':_0x329168[_0x0924('0x27')]['key']};});_0x423e15=qs[_0x0924('0x28')](_0x39feeb,_0x363697);return interaction['findAll'](_0x0924('0x29'),_0x363697[_0x0924('0x2a')],_0x363697[_0x0924('0x2b')],_0x423e15,_0x39feeb)['then'](respondWithFilteredResult(_0xb5c9a0,_0x423e15))[_0x0924('0x2c')](handleError(_0xb5c9a0,null));};exports[_0x0924('0x2d')]=function(_0x253b36,_0x5d2ba6){var _0x11e98b={'raw':![],'where':{'id':_0x253b36['params']['id']}},_0x53b154={};_0x53b154['model']=_[_0x0924('0x2e')](db[_0x0924('0x2f')]['rawAttributes']);_0x53b154[_0x0924('0x2a')]=_['keys'](_0x253b36[_0x0924('0x2a')]);_0x53b154[_0x0924('0x30')]=_['intersection'](_0x53b154[_0x0924('0x31')],_0x53b154[_0x0924('0x2a')]);_0x11e98b[_0x0924('0x32')]=_[_0x0924('0x33')](_0x53b154['model'],qs[_0x0924('0x34')](_0x253b36[_0x0924('0x2a')][_0x0924('0x34')]));_0x11e98b['attributes']=_0x11e98b[_0x0924('0x32')][_0x0924('0x35')]?_0x11e98b[_0x0924('0x32')]:_0x53b154[_0x0924('0x31')];if(_0x253b36[_0x0924('0x2a')][_0x0924('0x36')]){_0x11e98b['include']=[{'all':!![]}];}_0x11e98b=_['merge']({},_0x11e98b,_0x253b36[_0x0924('0x37')]);return db['SmsInteraction'][_0x0924('0x38')](_0x11e98b)[_0x0924('0x1d')](handleEntityNotFound(_0x5d2ba6,null))['then'](respondWithResult(_0x5d2ba6,null))[_0x0924('0x2c')](handleError(_0x5d2ba6,null));};exports[_0x0924('0x39')]=function(_0x5ba873,_0x41ede9){return db[_0x0924('0x2f')][_0x0924('0x39')](_0x5ba873[_0x0924('0x3a')],{})[_0x0924('0x1d')](respondWithResult(_0x41ede9,0xc9))[_0x0924('0x2c')](handleError(_0x41ede9,null));};exports['update']=function(_0x36ccb7,_0x48fe53){if(_0x36ccb7[_0x0924('0x3a')]['id']){delete _0x36ccb7[_0x0924('0x3a')]['id'];}return db[_0x0924('0x2f')][_0x0924('0x38')]({'where':{'id':_0x36ccb7[_0x0924('0x3b')]['id']}})[_0x0924('0x1d')](handleEntityNotFound(_0x48fe53,null))['then'](saveUpdates(_0x36ccb7['body'],null))[_0x0924('0x1d')](respondWithResult(_0x48fe53,null))[_0x0924('0x2c')](handleError(_0x48fe53,null));};exports['destroy']=function(_0x1b731f,_0x1ee7cc){return db[_0x0924('0x2f')][_0x0924('0x38')]({'where':{'id':_0x1b731f[_0x0924('0x3b')]['id']}})[_0x0924('0x1d')](handleEntityNotFound(_0x1ee7cc,null))[_0x0924('0x1d')](removeEntity(_0x1ee7cc,null))['catch'](handleError(_0x1ee7cc,null));};exports[_0x0924('0x3c')]=function(_0x510d26,_0x4f4973){return db[_0x0924('0x2f')][_0x0924('0x3c')]()[_0x0924('0x1d')](respondWithResult(_0x4f4973,null))[_0x0924('0x2c')](handleError(_0x4f4973,null));};exports[_0x0924('0x3d')]=function(_0x4ba5da,_0x4f1676){return db[_0x0924('0x3e')][_0x0924('0x38')]({'where':{'id':_0x4ba5da[_0x0924('0x3b')]['id']}})['then'](handleEntityNotFound(_0x4f1676,null))['then'](function(_0x364980){if(_0x364980){return _0x364980[_0x0924('0x3d')](_0x4ba5da[_0x0924('0x3a')]['ids'],_[_0x0924('0x3f')](_0x4ba5da[_0x0924('0x3a')],[_0x0924('0x40'),'id'])||{});}})[_0x0924('0x1d')](respondWithResult(_0x4f1676,null))[_0x0924('0x2c')](handleError(_0x4f1676,null));};exports[_0x0924('0x41')]=function(_0x51050d,_0x229fbc){var _0x3ee807={'raw':![],'where':{}};var _0x469151={};var _0x5f2d2d={'count':0x0,'rows':[]};return db[_0x0924('0x2f')][_0x0924('0x42')]({'where':{'id':_0x51050d[_0x0924('0x3b')]['id']}})[_0x0924('0x1d')](handleEntityNotFound(_0x229fbc,null))['then'](function(_0x59139b){if(_0x59139b){_0x469151[_0x0924('0x31')]=_[_0x0924('0x2e')](db[_0x0924('0x3e')]['rawAttributes']);_0x469151[_0x0924('0x2a')]=_['keys'](_0x51050d['query']);_0x469151[_0x0924('0x30')]=_[_0x0924('0x33')](_0x469151[_0x0924('0x31')],_0x469151[_0x0924('0x2a')]);_0x3ee807[_0x0924('0x32')]=_[_0x0924('0x33')](_0x469151['model'],qs[_0x0924('0x34')](_0x51050d[_0x0924('0x2a')]['fields']));_0x3ee807[_0x0924('0x32')]=_0x3ee807[_0x0924('0x32')][_0x0924('0x35')]?_0x3ee807[_0x0924('0x32')]:_0x469151[_0x0924('0x31')];if(!_0x51050d[_0x0924('0x2a')][_0x0924('0x43')](_0x0924('0x44'))){_0x3ee807[_0x0924('0x16')]=qs['limit'](_0x51050d[_0x0924('0x2a')][_0x0924('0x16')]);_0x3ee807[_0x0924('0x14')]=qs[_0x0924('0x14')](_0x51050d[_0x0924('0x2a')][_0x0924('0x14')]);}_0x3ee807[_0x0924('0x45')]=qs[_0x0924('0x46')](_0x51050d[_0x0924('0x2a')][_0x0924('0x46')]);_0x3ee807[_0x0924('0x47')]=qs[_0x0924('0x30')](_[_0x0924('0x48')](_0x51050d[_0x0924('0x2a')],_0x469151['filters']));_0x3ee807[_0x0924('0x47')][_0x0924('0x49')]=_0x59139b['id'];if(_0x51050d[_0x0924('0x2a')]['filter']){_0x3ee807[_0x0924('0x47')]=_[_0x0924('0x4a')](_0x3ee807['where'],{'$or':_['map'](_0x3ee807['attributes'],function(_0x1be99d){var _0x55438a={};_0x55438a[_0x1be99d]={'$like':'%'+_0x51050d[_0x0924('0x2a')][_0x0924('0x4b')]+'%'};return _0x55438a;})});}if(_0x51050d[_0x0924('0x2a')][_0x0924('0x4c')]){var _0x1c149a=_0x51050d[_0x0924('0x2a')]['$gte'][_0x0924('0x4d')](',');var _0xe614eb={};_0xe614eb[_0x1c149a[0x0]]={'$gte':moment(_0x1c149a[0x1])['format'](_0x0924('0x4e'))};_0x3ee807[_0x0924('0x47')]=_[_0x0924('0x4a')](_0x3ee807['where'],_0xe614eb);}_0x3ee807=_['merge']({},_0x3ee807,_0x51050d['options']);return db[_0x0924('0x3e')][_0x0924('0x17')]({'where':_0x3ee807[_0x0924('0x47')]})['then'](function(_0x5b83a9){_0x5f2d2d[_0x0924('0x17')]=_0x5b83a9;if(_0x51050d['query']['includeAll']){_0x3ee807['include']=[{'all':!![]}];}return db[_0x0924('0x3e')][_0x0924('0x4f')](_0x3ee807);})['then'](function(_0x289377){_0x5f2d2d['rows']=_0x289377;return _0x5f2d2d;});}})[_0x0924('0x1d')](respondWithFilteredResult(_0x229fbc,_0x3ee807))['catch'](handleError(_0x229fbc,null));};exports[_0x0924('0x50')]=function(_0x3b6b3d,_0xf8b82a){return db[_0x0924('0x2f')]['find']({'where':{'id':_0x3b6b3d[_0x0924('0x3b')]['id']}})['then'](handleEntityNotFound(_0xf8b82a,null))[_0x0924('0x1d')](function(_0x39f376){if(_0x39f376){return _0x39f376['setTags'](_0x3b6b3d[_0x0924('0x3a')][_0x0924('0x40')],_[_0x0924('0x3f')](_0x3b6b3d[_0x0924('0x3a')],[_0x0924('0x40'),'id'])||{})[_0x0924('0x51')](function(){return db['Tag'][_0x0924('0x4f')]({'attributes':['id',_0x0924('0x21'),_0x0924('0x52')],'where':{'id':_0x3b6b3d[_0x0924('0x3a')][_0x0924('0x40')]}});})[_0x0924('0x1d')](function(_0x2a642b){socket['emit'](_0x0924('0x53'),{'id':Number(_0x3b6b3d['params']['id']),'tags':_0x2a642b||[]});return{'id':Number(_0x3b6b3d[_0x0924('0x3b')]['id']),'tags':_0x2a642b||[]};});}})[_0x0924('0x1d')](respondWithResult(_0xf8b82a,null))['catch'](handleError(_0xf8b82a,null));};exports[_0x0924('0x54')]=function(_0x1d1025,_0x473b8a){return db['SmsInteraction'][_0x0924('0x38')]({'where':{'id':_0x1d1025[_0x0924('0x3b')]['id']}})[_0x0924('0x1d')](handleEntityNotFound(_0x473b8a,null))['then'](function(_0x59a490){if(_0x59a490){return _0x59a490['removeTags'](_0x1d1025[_0x0924('0x2a')][_0x0924('0x40')]);}})[_0x0924('0x1d')](respondWithStatusCode(_0x473b8a,null))[_0x0924('0x2c')](handleError(_0x473b8a,null));};exports[_0x0924('0x55')]=function(_0x11a23e,_0x13f242){var _0x37fc4e=moment()['unix']()[_0x0924('0x56')]();var _0x4797ae=path[_0x0924('0x57')](config[_0x0924('0x58')],'server',_0x0924('0x59'),_0x0924('0x5a'));var _0x58da1b=path['join'](_0x4797ae,_0x37fc4e);var _0x252b7c=util[_0x0924('0x5b')]('transcript-%d-%s.zip',_0x11a23e['params']['id'],_0x37fc4e);var _0xf4e7a9=path[_0x0924('0x57')](_0x4797ae,_0x252b7c);var _0x5e072c=[];_0x5e072c[_0x0924('0x5c')]({'model':db['User'],'as':_0x0924('0x5d'),'attributes':['id',_0x0924('0x5e')],'raw':!![]});_0x5e072c[_0x0924('0x5c')]({'model':db[_0x0924('0x5f')],'as':'Contact','attributes':['id',_0x0924('0x60'),'lastName'],'raw':!![]});var _0x53a362=[{'model':db[_0x0924('0x3e')],'as':_0x0924('0x61'),'attributes':['id',_0x0924('0x3a'),_0x0924('0x62'),_0x0924('0x63'),_0x0924('0x64'),_0x0924('0x65')],'include':_0x5e072c}];_0x53a362[_0x0924('0x5c')]({'model':db['SmsAccount'],'as':_0x0924('0x66'),'attributes':['id',_0x0924('0x21')]});_0x53a362[_0x0924('0x5c')]({'model':db[_0x0924('0x5d')],'as':_0x0924('0x67'),'attributes':['id','fullname']});return db[_0x0924('0x2f')][_0x0924('0x38')]({'where':{'id':_0x11a23e[_0x0924('0x3b')]['id']},'include':_0x53a362})[_0x0924('0x1d')](handleEntityNotFound(_0x13f242,null))['then'](function(_0x3d62ad){if(_0x3d62ad){var _0x578d05=_0x3d62ad[_0x0924('0x68')]({'plain':!![]});fs[_0x0924('0x69')](_0x58da1b);var _0x4babb2={'channel':'Sms','account':_0x578d05['Account'][_0x0924('0x21')],'agent':_0x578d05[_0x0924('0x67')]?_0x578d05[_0x0924('0x67')][_0x0924('0x5e')]:_0x0924('0x6a'),'createdAt':moment(_0x578d05[_0x0924('0x62')])['format'](_0x0924('0x4e'))[_0x0924('0x56')](),'closedAt':_0x578d05['closed']?moment(_0x578d05[_0x0924('0x6b')])['format'](_0x0924('0x4e'))[_0x0924('0x56')]():'','disposition':_0x578d05[_0x0924('0x6c')],'messages':_(_0x578d05['Messages'])[_0x0924('0x4b')]({'secret':![]})[_0x0924('0x24')](function(_0x2ad18a){return{'date':moment(_0x2ad18a[_0x0924('0x62')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x0924('0x56')](),'sender':_0x2ad18a[_0x0924('0x63')]===_0x0924('0x6d')?_0x2ad18a[_0x0924('0x5d')]?_0x2ad18a[_0x0924('0x5d')][_0x0924('0x5e')]:_0x0924('0x6e'):_0x2ad18a[_0x0924('0x6f')][_0x0924('0x60')]+(_0x2ad18a[_0x0924('0x6f')][_0x0924('0x70')]?'\x20'+_0x2ad18a[_0x0924('0x6f')][_0x0924('0x70')]:''),'body':_0x2ad18a[_0x0924('0x3a')],'direction':_0x2ad18a[_0x0924('0x63')]===_0x0924('0x6d')?'A':'C','secret':_0x2ad18a[_0x0924('0x64')],'read':_0x2ad18a['read']};})[_0x0924('0x71')]()};return ejs[_0x0924('0x72')](path[_0x0924('0x57')](config[_0x0924('0x58')],_0x0924('0x73'),_0x0924('0x74'),_0x0924('0x75')),{'interaction':_0x4babb2})[_0x0924('0x1d')](function(_0x367eeb){var _0x5891dd=path[_0x0924('0x57')](_0x58da1b,_0x0924('0x76')+_0x578d05['id']+'-'+_0x37fc4e+_0x0924('0x77'));var _0x4e3670={'path':_0x5891dd,'channel':_0x0924('0x78'),'interactionId':_0x578d05['id']};return pdf['createPdfFromHTML'](_0x367eeb,_0x4e3670);})['then'](function(){return new BPromise(function(_0x59b6bd,_0x5dd540){zipdir(_0x58da1b,{'saveTo':_0xf4e7a9},function(_0x32d161,_0x367984){if(_0x32d161)return _0x5dd540(_0x32d161);return _0x59b6bd(_0x367984);});})[_0x0924('0x1d')](function(){return new BPromise(function(_0x27f503,_0x2a1cbd){rimraf(_0x58da1b,function(_0x3cf14b){if(_0x3cf14b)_0x2a1cbd(_0x3cf14b);return _0x27f503();});});})['then'](function(){return _0x13f242[_0x0924('0x55')](_0xf4e7a9,_0x252b7c,function(_0x43db7a){if(_0x43db7a){console[_0x0924('0x79')]('err',_0x43db7a);}else{fs[_0x0924('0x7a')](_0xf4e7a9);}});});});}else{return _0x13f242[_0x0924('0x12')](0xc8);}})[_0x0924('0x2c')](handleError(_0x13f242,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index cfec088..1f18573 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 _0x1893=['SmsInteraction','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0x4eda0a,_0x8b44fc){var _0x14e5d4=function(_0x21bdba){while(--_0x21bdba){_0x4eda0a['push'](_0x4eda0a['shift']());}};_0x14e5d4(++_0x8b44fc);}(_0x1893,0xa2));var _0x3189=function(_0x294f3d,_0x1b0f82){_0x294f3d=_0x294f3d-0x0;var _0x2c8f6c=_0x1893[_0x294f3d];return _0x2c8f6c;};'use strict';var EventEmitter=require('events');var SmsInteraction=require('../../mysqldb')['db'][_0x3189('0x0')];var SmsMessage=require(_0x3189('0x1'))['db'][_0x3189('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x3189('0x3')](0x0);var events={'afterCreate':_0x3189('0x4'),'afterUpdate':_0x3189('0x5'),'afterDestroy':_0x3189('0x6')};function emitEvent(_0x5371db){return function(_0x27445,_0x4faebf,_0x2333e6){_0x27445[_0x3189('0x7')]({'attributes':['id'],'raw':!![]})[_0x3189('0x8')](function(_0x118970){_0x27445[_0x3189('0x9')](_0x3189('0xa'),_0x118970['map'](function(_0x1d5f6a){return{'id':_0x1d5f6a['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x27445['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3189('0x8')](function(_0x4ac683){_0x27445[_0x3189('0x9')](_0x3189('0xb'),_0x4ac683[_0x3189('0xc')]);SmsInteractionEvents[_0x3189('0xd')](_0x5371db+':'+_0x27445['id'],_0x27445);SmsInteractionEvents['emit'](_0x5371db,_0x27445);_0x2333e6(null);})[_0x3189('0xe')](_0x2333e6(null));};}for(var e in events){if(events[_0x3189('0xf')](e)){var event=events[e];SmsInteraction[_0x3189('0x10')](e,emitEvent(event));}}module[_0x3189('0x11')]=SmsInteractionEvents; \ No newline at end of file +var _0x1c9a=['then','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','SmsInteraction','SmsMessage','setMaxListeners','save','remove','getUsers','setDataValue','Users','findAll'];(function(_0x1530bf,_0x14bd16){var _0x1da684=function(_0x380f93){while(--_0x380f93){_0x1530bf['push'](_0x1530bf['shift']());}};_0x1da684(++_0x14bd16);}(_0x1c9a,0x98));var _0xa1c9=function(_0x59a685,_0x502ae0){_0x59a685=_0x59a685-0x0;var _0x3b6c71=_0x1c9a[_0x59a685];return _0x3b6c71;};'use strict';var EventEmitter=require(_0xa1c9('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0xa1c9('0x1')];var SmsMessage=require('../../mysqldb')['db'][_0xa1c9('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xa1c9('0x3')](0x0);var events={'afterCreate':_0xa1c9('0x4'),'afterUpdate':'update','afterDestroy':_0xa1c9('0x5')};function emitEvent(_0x45d1f7){return function(_0x20f0bf,_0x3a4387,_0x572229){_0x20f0bf[_0xa1c9('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x222624){_0x20f0bf[_0xa1c9('0x7')](_0xa1c9('0x8'),_0x222624['map'](function(_0x2dfa54){return{'id':_0x2dfa54['id']};}));return SmsMessage[_0xa1c9('0x9')]({'where':{'SmsInteractionId':_0x20f0bf['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa1c9('0xa')](function(_0x1efbab){_0x20f0bf['setDataValue'](_0xa1c9('0xb'),_0x1efbab[_0xa1c9('0xc')]);SmsInteractionEvents[_0xa1c9('0xd')](_0x45d1f7+':'+_0x20f0bf['id'],_0x20f0bf);SmsInteractionEvents[_0xa1c9('0xd')](_0x45d1f7,_0x20f0bf);_0x572229(null);})[_0xa1c9('0xe')](_0x572229(null));};}for(var e in events){if(events[_0xa1c9('0xf')](e)){var event=events[e];SmsInteraction[_0xa1c9('0x10')](e,emitEvent(event));}}module[_0xa1c9('0x11')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 2188555..48e68f9 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 _0xae5b=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsInteraction.attributes','define','SmsInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger'];(function(_0x21b675,_0x12c1c0){var _0x1c4103=function(_0x49b667){while(--_0x49b667){_0x21b675['push'](_0x21b675['shift']());}};_0x1c4103(++_0x12c1c0);}(_0xae5b,0x173));var _0xbae5=function(_0x2eda0c,_0x43673f){_0x2eda0c=_0x2eda0c-0x0;var _0x4e9663=_0xae5b[_0x2eda0c];return _0x4e9663;};'use strict';var _=require(_0xbae5('0x0'));var util=require(_0xbae5('0x1'));var logger=require(_0xbae5('0x2'))(_0xbae5('0x3'));var moment=require(_0xbae5('0x4'));var BPromise=require(_0xbae5('0x5'));var rp=require(_0xbae5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbae5('0x7'));var config=require(_0xbae5('0x8'));var attributes=require(_0xbae5('0x9'));module['exports']=function(_0x594d6c,_0x1ff6ab){return _0x594d6c[_0xbae5('0xa')](_0xbae5('0xb'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x532579,_0x1545a5,_0x3b1da1){if(_0x532579[_0xbae5('0xc')](_0xbae5('0xd'))){_0x532579[_0xbae5('0xe')]=moment()[_0xbae5('0xf')](_0xbae5('0x10'));}_0x3b1da1(null,_0x532579);}}});}; \ No newline at end of file +var _0x3362=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','sms_interactions','changed','closed','closedAt','format'];(function(_0x298863,_0x57b3cc){var _0xb4d1e8=function(_0x6097b3){while(--_0x6097b3){_0x298863['push'](_0x298863['shift']());}};_0xb4d1e8(++_0x57b3cc);}(_0x3362,0x96));var _0x2336=function(_0x36b6d8,_0x24d3f3){_0x36b6d8=_0x36b6d8-0x0;var _0x5b5de3=_0x3362[_0x36b6d8];return _0x5b5de3;};'use strict';var _=require(_0x2336('0x0'));var util=require(_0x2336('0x1'));var logger=require(_0x2336('0x2'))(_0x2336('0x3'));var moment=require(_0x2336('0x4'));var BPromise=require('bluebird');var rp=require(_0x2336('0x5'));var fs=require('fs');var path=require(_0x2336('0x6'));var rimraf=require(_0x2336('0x7'));var config=require(_0x2336('0x8'));var attributes=require('./smsInteraction.attributes');module[_0x2336('0x9')]=function(_0x283a46,_0x4a7fbc){return _0x283a46['define']('SmsInteraction',attributes,{'tableName':_0x2336('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1ecca3,_0x725afe,_0x4bcf37){if(_0x1ecca3[_0x2336('0xb')](_0x2336('0xc'))){_0x1ecca3[_0x2336('0xd')]=moment()[_0x2336('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4bcf37(null,_0x1ecca3);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index a04e5d8..01f817e 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 _0xd83f=['update','body','options','raw','where','attributes','AddTagsToSmsInteraction','find','addTags','omit','ids','AddTags','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','UpdateSmsInteraction','SmsInteraction'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xd83f,0x1ec));var _0xfd83=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xd83f[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xfd83('0x0'));var util=require(_0xfd83('0x1'));var moment=require('moment');var BPromise=require(_0xfd83('0x2'));var rs=require(_0xfd83('0x3'));var fs=require('fs');var Redis=require(_0xfd83('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfd83('0x5'));var logger=require(_0xfd83('0x6'))('rpc');var config=require(_0xfd83('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfd83('0x8')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xfd83('0x9')],{'host':_0xfd83('0xa'),'port':0x18eb});var socket=require(_0xfd83('0xb'))(new Redis(config[_0xfd83('0x9')]));require(_0xfd83('0xc'))[_0xfd83('0xd')](socket);function respondWithRpcPromise(_0x1d6ccc,_0x298a6b,_0x965f73){return new BPromise(function(_0x3ffa30,_0x13730c){return client[_0xfd83('0xe')](_0x1d6ccc,_0x965f73)[_0xfd83('0xf')](function(_0x9a11d9){logger['info'](_0xfd83('0x10'),_0x298a6b,_0xfd83('0x11'));logger[_0xfd83('0x12')](_0xfd83('0x13'),_0x298a6b,_0xfd83('0x11'),JSON[_0xfd83('0x14')](_0x9a11d9));if(_0x9a11d9[_0xfd83('0x15')]){if(_0x9a11d9[_0xfd83('0x15')][_0xfd83('0x16')]===0x1f4){logger[_0xfd83('0x15')](_0xfd83('0x10'),_0x298a6b,_0x9a11d9['error']['message']);return _0x13730c(_0x9a11d9['error'][_0xfd83('0x17')]);}logger['error'](_0xfd83('0x10'),_0x298a6b,_0x9a11d9[_0xfd83('0x15')][_0xfd83('0x17')]);return _0x3ffa30(_0x9a11d9['error'][_0xfd83('0x17')]);}else{logger[_0xfd83('0x18')]('SmsInteraction,\x20%s,\x20%s',_0x298a6b,'request\x20sent');_0x3ffa30(_0x9a11d9['result'][_0xfd83('0x17')]);}})[_0xfd83('0x19')](function(_0x21fffc){logger['error'](_0xfd83('0x10'),_0x298a6b,_0x21fffc);_0x13730c(_0x21fffc);});});}exports[_0xfd83('0x1a')]=function(_0x415ac9){var _0x39c0a0=this;return new Promise(function(_0x3b2af8,_0x2a243a){return db[_0xfd83('0x1b')][_0xfd83('0x1c')](_0x415ac9[_0xfd83('0x1d')],{'raw':_0x415ac9['options']?_0x415ac9[_0xfd83('0x1e')][_0xfd83('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x415ac9['options']?_0x415ac9['options'][_0xfd83('0x20')]||null:null,'attributes':_0x415ac9[_0xfd83('0x1e')]?_0x415ac9[_0xfd83('0x1e')][_0xfd83('0x21')]||null:null,'limit':_0x415ac9[_0xfd83('0x1e')]?_0x415ac9[_0xfd83('0x1e')]['limit']||null:null})[_0xfd83('0xf')](function(_0x331bb8){logger['info'](_0xfd83('0x1a'),_0x415ac9);logger[_0xfd83('0x12')]('UpdateSmsInteraction',_0x415ac9,JSON[_0xfd83('0x14')](_0x331bb8));_0x3b2af8(_0x331bb8);})[_0xfd83('0x19')](function(_0x4b4de8){logger[_0xfd83('0x15')](_0xfd83('0x1a'),_0x4b4de8[_0xfd83('0x17')],_0x415ac9);_0x2a243a(_0x39c0a0['error'](0x1f4,_0x4b4de8[_0xfd83('0x17')]));});});};exports[_0xfd83('0x22')]=function(_0x5809e8){return new Promise(function(_0x515184,_0x7e3080){return db['SmsInteraction'][_0xfd83('0x23')]({'where':_0x5809e8[_0xfd83('0x1e')]?_0x5809e8[_0xfd83('0x1e')][_0xfd83('0x20')]||null:null})[_0xfd83('0xf')](function(_0x2834e8){if(_0x2834e8){return _0x2834e8[_0xfd83('0x24')](_0x5809e8[_0xfd83('0x1d')]['ids'],_[_0xfd83('0x25')](_0x5809e8[_0xfd83('0x1d')],[_0xfd83('0x26'),'id'])||{});}})['spread'](function(_0x10d135){logger['info'](_0xfd83('0x27'),_0x5809e8);logger[_0xfd83('0x12')](_0xfd83('0x27'),_0x5809e8,JSON[_0xfd83('0x14')](_0x10d135));_0x515184(_0x10d135);})[_0xfd83('0x19')](function(_0x29ab51){logger[_0xfd83('0x15')](_0xfd83('0x27'),_0x29ab51[_0xfd83('0x17')],_0x5809e8);_0x7e3080(_this[_0xfd83('0x15')](0x1f4,_0x29ab51[_0xfd83('0x17')]));});});}; \ No newline at end of file +var _0x7c21=['limit','UpdateSmsInteraction','AddTagsToSmsInteraction','find','where','addTags','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','jayson/promise','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','SmsInteraction,\x20%s,\x20%s','message','result','catch','SmsInteraction','update','body','options','raw','attributes'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7c21,0xff));var _0x17c2=function(_0x3b84d1,_0x153717){_0x3b84d1=_0x3b84d1-0x0;var _0x80aab8=_0x7c21[_0x3b84d1];return _0x80aab8;};'use strict';var _=require(_0x17c2('0x0'));var util=require(_0x17c2('0x1'));var moment=require(_0x17c2('0x2'));var BPromise=require('bluebird');var rs=require(_0x17c2('0x3'));var fs=require('fs');var Redis=require(_0x17c2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x17c2('0x5'));var logger=require('../../config/logger')(_0x17c2('0x6'));var config=require('../../config/environment');var jayson=require(_0x17c2('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x17c2('0x8')]=_[_0x17c2('0x9')](config[_0x17c2('0x8')],{'host':_0x17c2('0xa'),'port':0x18eb});var socket=require(_0x17c2('0xb'))(new Redis(config['redis']));require(_0x17c2('0xc'))[_0x17c2('0xd')](socket);function respondWithRpcPromise(_0x100177,_0x409a62,_0x22390e){return new BPromise(function(_0x2e8e16,_0x5b05d9){return client[_0x17c2('0xe')](_0x100177,_0x22390e)[_0x17c2('0xf')](function(_0x2bf824){logger[_0x17c2('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x409a62,_0x17c2('0x11'));logger[_0x17c2('0x12')](_0x17c2('0x13'),_0x409a62,_0x17c2('0x11'),JSON[_0x17c2('0x14')](_0x2bf824));if(_0x2bf824[_0x17c2('0x15')]){if(_0x2bf824[_0x17c2('0x15')]['code']===0x1f4){logger['error'](_0x17c2('0x16'),_0x409a62,_0x2bf824[_0x17c2('0x15')][_0x17c2('0x17')]);return _0x5b05d9(_0x2bf824[_0x17c2('0x15')][_0x17c2('0x17')]);}logger['error']('SmsInteraction,\x20%s,\x20%s',_0x409a62,_0x2bf824[_0x17c2('0x15')][_0x17c2('0x17')]);return _0x2e8e16(_0x2bf824[_0x17c2('0x15')][_0x17c2('0x17')]);}else{logger['info'](_0x17c2('0x16'),_0x409a62,_0x17c2('0x11'));_0x2e8e16(_0x2bf824[_0x17c2('0x18')][_0x17c2('0x17')]);}})[_0x17c2('0x19')](function(_0xcd8fd7){logger[_0x17c2('0x15')](_0x17c2('0x16'),_0x409a62,_0xcd8fd7);_0x5b05d9(_0xcd8fd7);});});}exports['UpdateSmsInteraction']=function(_0x732ade){var _0x38a23c=this;return new Promise(function(_0x436e4a,_0xcf5121){return db[_0x17c2('0x1a')][_0x17c2('0x1b')](_0x732ade[_0x17c2('0x1c')],{'raw':_0x732ade[_0x17c2('0x1d')]?_0x732ade[_0x17c2('0x1d')][_0x17c2('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x732ade[_0x17c2('0x1d')]?_0x732ade[_0x17c2('0x1d')]['where']||null:null,'attributes':_0x732ade[_0x17c2('0x1d')]?_0x732ade['options'][_0x17c2('0x1f')]||null:null,'limit':_0x732ade[_0x17c2('0x1d')]?_0x732ade['options'][_0x17c2('0x20')]||null:null})[_0x17c2('0xf')](function(_0x7ab28d){logger[_0x17c2('0x10')](_0x17c2('0x21'),_0x732ade);logger[_0x17c2('0x12')]('UpdateSmsInteraction',_0x732ade,JSON['stringify'](_0x7ab28d));_0x436e4a(_0x7ab28d);})[_0x17c2('0x19')](function(_0x2a4858){logger['error'](_0x17c2('0x21'),_0x2a4858[_0x17c2('0x17')],_0x732ade);_0xcf5121(_0x38a23c[_0x17c2('0x15')](0x1f4,_0x2a4858[_0x17c2('0x17')]));});});};exports[_0x17c2('0x22')]=function(_0x12732d){return new Promise(function(_0x5c6720,_0x2263c2){return db[_0x17c2('0x1a')][_0x17c2('0x23')]({'where':_0x12732d[_0x17c2('0x1d')]?_0x12732d['options'][_0x17c2('0x24')]||null:null})[_0x17c2('0xf')](function(_0x58bdd7){if(_0x58bdd7){return _0x58bdd7[_0x17c2('0x25')](_0x12732d[_0x17c2('0x1c')][_0x17c2('0x26')],_['omit'](_0x12732d[_0x17c2('0x1c')],[_0x17c2('0x26'),'id'])||{});}})[_0x17c2('0x27')](function(_0x554888){logger['info']('AddTags',_0x12732d);logger[_0x17c2('0x12')](_0x17c2('0x28'),_0x12732d,JSON['stringify'](_0x554888));_0x5c6720(_0x554888);})[_0x17c2('0x19')](function(_0x1fb211){logger[_0x17c2('0x15')](_0x17c2('0x28'),_0x1fb211[_0x17c2('0x17')],_0x12732d);_0x2263c2(_this['error'](0x1f4,_0x1fb211[_0x17c2('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index b348e5f..0378088 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 _0x3ac9=['./smsInteraction.events','save','remove','update','emit','removeListener','register','length','smsInteraction:'];(function(_0x5e81ea,_0x2c6893){var _0x4c19ed=function(_0x21ee0f){while(--_0x21ee0f){_0x5e81ea['push'](_0x5e81ea['shift']());}};_0x4c19ed(++_0x2c6893);}(_0x3ac9,0x19e));var _0x93ac=function(_0x56aa66,_0x1ddf52){_0x56aa66=_0x56aa66-0x0;var _0xeba9ff=_0x3ac9[_0x56aa66];return _0xeba9ff;};'use strict';var SmsInteractionEvents=require(_0x93ac('0x0'));var events=[_0x93ac('0x1'),_0x93ac('0x2'),_0x93ac('0x3')];function createListener(_0x188917,_0x1ebfd0){return function(_0x41de2c){_0x1ebfd0[_0x93ac('0x4')](_0x188917,_0x41de2c);};}function removeListener(_0x597a53,_0x544c20){return function(){SmsInteractionEvents[_0x93ac('0x5')](_0x597a53,_0x544c20);};}exports[_0x93ac('0x6')]=function(_0x1d4a36){for(var _0x279da1=0x0,_0x429e1e=events[_0x93ac('0x7')];_0x279da1<_0x429e1e;_0x279da1++){var _0x32bff1=events[_0x279da1];var _0x38c787=createListener(_0x93ac('0x8')+_0x32bff1,_0x1d4a36);SmsInteractionEvents['on'](_0x32bff1,_0x38c787);}}; \ No newline at end of file +var _0x17b1=['removeListener','register','length','./smsInteraction.events','update','emit'];(function(_0x27ec97,_0x8808ee){var _0x2241ba=function(_0x111fda){while(--_0x111fda){_0x27ec97['push'](_0x27ec97['shift']());}};_0x2241ba(++_0x8808ee);}(_0x17b1,0x141));var _0x117b=function(_0x1ccbcc,_0x5c948b){_0x1ccbcc=_0x1ccbcc-0x0;var _0x1e873f=_0x17b1[_0x1ccbcc];return _0x1e873f;};'use strict';var SmsInteractionEvents=require(_0x117b('0x0'));var events=['save','remove',_0x117b('0x1')];function createListener(_0x472010,_0xfa425d){return function(_0x43435f){_0xfa425d[_0x117b('0x2')](_0x472010,_0x43435f);};}function removeListener(_0x3d97e2,_0x586451){return function(){SmsInteractionEvents[_0x117b('0x3')](_0x3d97e2,_0x586451);};}exports[_0x117b('0x4')]=function(_0x193394){for(var _0x46d6fa=0x0,_0x3c4b48=events[_0x117b('0x5')];_0x46d6fa<_0x3c4b48;_0x46d6fa++){var _0x3dc35d=events[_0x46d6fa];var _0x2d1a08=createListener('smsInteraction:'+_0x3dc35d,_0x193394);SmsInteractionEvents['on'](_0x3dc35d,_0x2d1a08);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index b3cf50e..f93fd1c 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 _0xa9a9=['describe','/:id','show','post','tracked','sms','create','status','put','/:id/accept','/:id/reject','reject','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe'];(function(_0x1b2993,_0x1df687){var _0x3bff1f=function(_0x3e6440){while(--_0x3e6440){_0x1b2993['push'](_0x1b2993['shift']());}};_0x3bff1f(++_0x1df687);}(_0xa9a9,0x12c));var _0x9a9a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa9a9[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x9a9a('0x0'));var util=require('util');var path=require(_0x9a9a('0x1'));var timeout=require(_0x9a9a('0x2'));var express=require(_0x9a9a('0x3'));var router=express['Router']();var fs_extra=require(_0x9a9a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9a9a('0x5'));var config=require(_0x9a9a('0x6'));var controller=require(_0x9a9a('0x7'));router[_0x9a9a('0x8')]('/',auth[_0x9a9a('0x9')](),controller[_0x9a9a('0xa')]);router['get'](_0x9a9a('0xb'),auth[_0x9a9a('0x9')](),controller[_0x9a9a('0xc')]);router[_0x9a9a('0x8')](_0x9a9a('0xd'),auth['isAuthenticated'](),controller[_0x9a9a('0xe')]);router[_0x9a9a('0xf')]('/',auth['isAuthenticated'](),interaction[_0x9a9a('0x10')](_0x9a9a('0x11'),'smsmessage:create'),controller[_0x9a9a('0x12')]);router['post']('/:id/status',controller[_0x9a9a('0x13')]);router[_0x9a9a('0x14')](_0x9a9a('0xd'),auth[_0x9a9a('0x9')](),controller['update']);router[_0x9a9a('0x14')](_0x9a9a('0x15'),auth['isAuthenticated'](),controller['accept']);router[_0x9a9a('0x14')](_0x9a9a('0x16'),auth['isAuthenticated'](),controller[_0x9a9a('0x17')]);router[_0x9a9a('0x18')]('/:id',auth[_0x9a9a('0x9')](),controller['destroy']);module[_0x9a9a('0x19')]=router; \ No newline at end of file +var _0x254f=['index','/describe','describe','/:id','show','post','sms','create','status','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','get','isAuthenticated'];(function(_0x8b1b6d,_0x3e7828){var _0x2ed4fe=function(_0x1678a9){while(--_0x1678a9){_0x8b1b6d['push'](_0x8b1b6d['shift']());}};_0x2ed4fe(++_0x3e7828);}(_0x254f,0x8d));var _0xf254=function(_0x23befa,_0x24391d){_0x23befa=_0x23befa-0x0;var _0x51ab46=_0x254f[_0x23befa];return _0x51ab46;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf254('0x0'));var timeout=require('connect-timeout');var express=require(_0xf254('0x1'));var router=express[_0xf254('0x2')]();var fs_extra=require(_0xf254('0x3'));var auth=require(_0xf254('0x4'));var interaction=require(_0xf254('0x5'));var config=require('../../config/environment');var controller=require(_0xf254('0x6'));router[_0xf254('0x7')]('/',auth[_0xf254('0x8')](),controller[_0xf254('0x9')]);router[_0xf254('0x7')](_0xf254('0xa'),auth['isAuthenticated'](),controller[_0xf254('0xb')]);router[_0xf254('0x7')](_0xf254('0xc'),auth['isAuthenticated'](),controller[_0xf254('0xd')]);router[_0xf254('0xe')]('/',auth['isAuthenticated'](),interaction['tracked'](_0xf254('0xf'),'smsmessage:create'),controller[_0xf254('0x10')]);router[_0xf254('0xe')]('/:id/status',controller[_0xf254('0x11')]);router[_0xf254('0x12')]('/:id',auth[_0xf254('0x8')](),controller['update']);router[_0xf254('0x12')](_0xf254('0x13'),auth[_0xf254('0x8')](),controller[_0xf254('0x14')]);router[_0xf254('0x12')](_0xf254('0x15'),auth['isAuthenticated'](),controller[_0xf254('0x16')]);router[_0xf254('0x17')](_0xf254('0xc'),auth[_0xf254('0x8')](),controller[_0xf254('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 2c2611c..c74bb24 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 _0xeecc=['medium','ENUM','STRING','DATE','BOOLEAN','sequelize','exports','TEXT'];(function(_0x50161d,_0x472443){var _0x1c5af8=function(_0x42e72d){while(--_0x42e72d){_0x50161d['push'](_0x50161d['shift']());}};_0x1c5af8(++_0x472443);}(_0xeecc,0x12d));var _0xceec=function(_0x4f6d61,_0x24a8a0){_0x4f6d61=_0x4f6d61-0x0;var _0x371356=_0xeecc[_0x4f6d61];return _0x371356;};'use strict';var Sequelize=require(_0xceec('0x0'));module[_0xceec('0x1')]={'body':{'type':Sequelize[_0xceec('0x2')](_0xceec('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xceec('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xceec('0x5')]},'readAt':{'type':Sequelize[_0xceec('0x6')]},'secret':{'type':Sequelize[_0xceec('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xceec('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x4ff3=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x35f3b7,_0x590f3b){var _0x4a72c0=function(_0x447339){while(--_0x447339){_0x35f3b7['push'](_0x35f3b7['shift']());}};_0x4a72c0(++_0x590f3b);}(_0x4ff3,0x80));var _0x34ff=function(_0x4b7adf,_0x4705ca){_0x4b7adf=_0x4b7adf-0x0;var _0x1e3013=_0x4ff3[_0x4b7adf];return _0x1e3013;};'use strict';var Sequelize=require('sequelize');module[_0x34ff('0x0')]={'body':{'type':Sequelize[_0x34ff('0x1')](_0x34ff('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x34ff('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x34ff('0x4')]('in','out'),'defaultValue':_0x34ff('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x34ff('0x6')](0xbe)},'phone':{'type':Sequelize[_0x34ff('0x6')]},'readAt':{'type':Sequelize[_0x34ff('0x7')]},'secret':{'type':Sequelize[_0x34ff('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x34ff('0x6')]},'providerResponse':{'type':Sequelize[_0x34ff('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 6a7b8f2..57cfcca 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 _0x9782=['set','Content-Range','save','update','destroy','sendStatus','stack','name','send','map','SmsMessage','fieldName','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','includeAll','findAll','show','params','rawAttributes','intersection','include','find','create','body','describe','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','SmsInteraction','SmsInteractionId','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','SELECT','contact','User','agent','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','reject','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','email','event','rejectmessage','SmsAccountId','received\x20delivery\x20report\x20from','type','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','results','groupName','DELIVERED','infobip','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsMessage,\x20%s,\x20%s','result','catch','status','end','json','offset','undefined','limit','count'];(function(_0x2a1bc2,_0x4ad4b9){var _0x2ca785=function(_0x481a6a){while(--_0x481a6a){_0x2a1bc2['push'](_0x2a1bc2['shift']());}};_0x2ca785(++_0x4ad4b9);}(_0x9782,0xf6));var _0x2978=function(_0x2e11d3,_0x26a29a){_0x2e11d3=_0x2e11d3-0x0;var _0x3f7f7f=_0x9782[_0x2e11d3];return _0x3f7f7f;};'use strict';var emlformat=require(_0x2978('0x0'));var rimraf=require(_0x2978('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2978('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2978('0x3'));var Mustache=require(_0x2978('0x4'));var util=require(_0x2978('0x5'));var path=require(_0x2978('0x6'));var sox=require(_0x2978('0x7'));var csv=require(_0x2978('0x8'));var ejs=require(_0x2978('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2978('0xa'));var squel=require('squel');var crypto=require(_0x2978('0xb'));var jsforce=require(_0x2978('0xc'));var deskjs=require(_0x2978('0xd'));var toCsv=require(_0x2978('0x8'));var querystring=require(_0x2978('0xe'));var Papa=require(_0x2978('0xf'));var Redis=require(_0x2978('0x10'));var authService=require(_0x2978('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2978('0x12'));var hardwareService=require(_0x2978('0x13'));var logger=require(_0x2978('0x14'))(_0x2978('0x15'));var utils=require(_0x2978('0x16'));var config=require(_0x2978('0x17'));var licenseUtil=require(_0x2978('0x18'));var db=require(_0x2978('0x19'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2978('0x1a')]));require(_0x2978('0x1b'))[_0x2978('0x1c')](socket);var jayson=require(_0x2978('0x1d'));var client=jayson[_0x2978('0x1e')][_0x2978('0x1f')]({'port':0x232c});var client9002=jayson[_0x2978('0x1e')][_0x2978('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x1b7e53,_0x5a3947,_0x3cdf8c,_0x431055){return new BPromise(function(_0x177081,_0x5ede11){var _0x3db1c6=_0x431055||client;return _0x3db1c6[_0x2978('0x20')](_0x1b7e53,_0x3cdf8c)[_0x2978('0x21')](function(_0x18cf58){logger[_0x2978('0x22')]('SmsMessage,\x20%s,\x20%s',_0x5a3947,_0x2978('0x23'));logger[_0x2978('0x24')](_0x2978('0x25'),_0x5a3947,_0x2978('0x23'),JSON[_0x2978('0x26')](_0x18cf58));if(_0x18cf58[_0x2978('0x27')]){if(_0x18cf58['error'][_0x2978('0x28')]===0x1f4){logger[_0x2978('0x27')]('SmsMessage,\x20%s,\x20%s',_0x5a3947,_0x18cf58[_0x2978('0x27')]['message']);return _0x5ede11(_0x18cf58[_0x2978('0x27')]['message']);}logger[_0x2978('0x27')]('SmsMessage,\x20%s,\x20%s',_0x5a3947,_0x18cf58['error']['message']);return _0x177081(_0x18cf58[_0x2978('0x27')][_0x2978('0x29')]);}else{logger['info'](_0x2978('0x2a'),_0x5a3947,_0x2978('0x23'));_0x177081(_0x18cf58[_0x2978('0x2b')][_0x2978('0x29')]);}})[_0x2978('0x2c')](function(_0x3faaad){logger[_0x2978('0x27')](_0x2978('0x2a'),_0x5a3947,_0x3faaad);_0x5ede11(_0x3faaad);});});}function respondWithStatusCode(_0x593027,_0x4995fb){_0x4995fb=_0x4995fb||0xcc;return function(_0x37cb52){if(_0x37cb52){return _0x593027['sendStatus'](_0x4995fb);}return _0x593027[_0x2978('0x2d')](_0x4995fb)[_0x2978('0x2e')]();};}function respondWithResult(_0x125fbc,_0x2658c1){_0x2658c1=_0x2658c1||0xc8;return function(_0x40b5fe){if(_0x40b5fe){return _0x125fbc[_0x2978('0x2d')](_0x2658c1)[_0x2978('0x2f')](_0x40b5fe);}};}function respondWithFilteredResult(_0x1e2d06,_0x9d3489){return function(_0x31e276){if(_0x31e276){var _0x500958=typeof _0x9d3489[_0x2978('0x30')]===_0x2978('0x31')&&typeof _0x9d3489[_0x2978('0x32')]===_0x2978('0x31');var _0x56eab0=_0x31e276[_0x2978('0x33')];var _0x30c939=_0x500958?0x0:_0x9d3489['offset'];var _0x6348a5=_0x500958?_0x31e276[_0x2978('0x33')]:_0x9d3489[_0x2978('0x30')]+_0x9d3489[_0x2978('0x32')];var _0x1fb3c0;if(_0x6348a5>=_0x56eab0){_0x6348a5=_0x56eab0;_0x1fb3c0=0xc8;}else{_0x1fb3c0=0xce;}_0x1e2d06[_0x2978('0x2d')](_0x1fb3c0);return _0x1e2d06[_0x2978('0x34')](_0x2978('0x35'),_0x30c939+'-'+_0x6348a5+'/'+_0x56eab0)[_0x2978('0x2f')](_0x31e276);}return null;};}function patchUpdates(_0x1c46cb){return function(_0x471a4b){try{jsonpatch['apply'](_0x471a4b,_0x1c46cb,!![]);}catch(_0x5c98cf){return BPromise['reject'](_0x5c98cf);}return _0x471a4b[_0x2978('0x36')]();};}function saveUpdates(_0x1c16fc,_0x5083f3){return function(_0x3b88fd){if(_0x3b88fd){return _0x3b88fd[_0x2978('0x37')](_0x1c16fc)[_0x2978('0x21')](function(_0x3caa64){return _0x3caa64;});}return null;};}function removeEntity(_0x5ec98a,_0x12a4dc){return function(_0x3e2792){if(_0x3e2792){return _0x3e2792[_0x2978('0x38')]()[_0x2978('0x21')](function(){_0x5ec98a['status'](0xcc)[_0x2978('0x2e')]();});}};}function handleEntityNotFound(_0x2f8751,_0x10e2c1){return function(_0x553c54){if(!_0x553c54){_0x2f8751[_0x2978('0x39')](0x194);}return _0x553c54;};}function handleError(_0x49e599,_0x4a55cd){_0x4a55cd=_0x4a55cd||0x1f4;return function(_0x212bdc){logger['error'](_0x212bdc[_0x2978('0x3a')]);if(_0x212bdc[_0x2978('0x3b')]){delete _0x212bdc[_0x2978('0x3b')];}_0x49e599[_0x2978('0x2d')](_0x4a55cd)[_0x2978('0x3c')](_0x212bdc);};}exports['index']=function(_0x29e9ab,_0x307d36){var _0x4adcd8={},_0x2ff3da={},_0xd484c7={'count':0x0,'rows':[]};var _0x8c1455=_[_0x2978('0x3d')](db[_0x2978('0x3e')]['rawAttributes'],function(_0x5093ee){return{'name':_0x5093ee[_0x2978('0x3f')],'type':_0x5093ee['type'][_0x2978('0x40')]};});_0x2ff3da[_0x2978('0x41')]=_['map'](_0x8c1455,'name');_0x2ff3da[_0x2978('0x42')]=_[_0x2978('0x43')](_0x29e9ab['query']);_0x2ff3da[_0x2978('0x44')]=_['intersection'](_0x2ff3da[_0x2978('0x41')],_0x2ff3da['query']);_0x4adcd8[_0x2978('0x45')]=_['intersection'](_0x2ff3da['model'],qs['fields'](_0x29e9ab[_0x2978('0x42')][_0x2978('0x46')]));_0x4adcd8[_0x2978('0x45')]=_0x4adcd8[_0x2978('0x45')][_0x2978('0x47')]?_0x4adcd8['attributes']:_0x2ff3da[_0x2978('0x41')];if(!_0x29e9ab[_0x2978('0x42')][_0x2978('0x48')](_0x2978('0x49'))){_0x4adcd8[_0x2978('0x32')]=qs['limit'](_0x29e9ab[_0x2978('0x42')][_0x2978('0x32')]);_0x4adcd8['offset']=qs['offset'](_0x29e9ab['query'][_0x2978('0x30')]);}_0x4adcd8['order']=qs[_0x2978('0x4a')](_0x29e9ab['query'][_0x2978('0x4a')]);_0x4adcd8['where']=qs[_0x2978('0x44')](_[_0x2978('0x4b')](_0x29e9ab['query'],_0x2ff3da[_0x2978('0x44')]),_0x8c1455);if(_0x29e9ab[_0x2978('0x42')][_0x2978('0x4c')]){_0x4adcd8[_0x2978('0x4d')]=_['merge'](_0x4adcd8['where'],{'$or':_[_0x2978('0x3d')](_0x8c1455,function(_0x23a5de){if(_0x23a5de['type']!=='VIRTUAL'){var _0x3d6850={};_0x3d6850[_0x23a5de[_0x2978('0x3b')]]={'$like':'%'+_0x29e9ab[_0x2978('0x42')][_0x2978('0x4c')]+'%'};return _0x3d6850;}})});}_0x4adcd8=_[_0x2978('0x4e')]({},_0x4adcd8,_0x29e9ab[_0x2978('0x4f')]);var _0x306d55={'where':_0x4adcd8[_0x2978('0x4d')]};return db[_0x2978('0x3e')]['count'](_0x306d55)[_0x2978('0x21')](function(_0x28ef21){_0xd484c7[_0x2978('0x33')]=_0x28ef21;if(_0x29e9ab[_0x2978('0x42')][_0x2978('0x50')]){_0x4adcd8['include']=[{'all':!![]}];}return db[_0x2978('0x3e')][_0x2978('0x51')](_0x4adcd8);})[_0x2978('0x21')](function(_0x203070){_0xd484c7['rows']=_0x203070;return _0xd484c7;})[_0x2978('0x21')](respondWithFilteredResult(_0x307d36,_0x4adcd8))[_0x2978('0x2c')](handleError(_0x307d36,null));};exports[_0x2978('0x52')]=function(_0x146c88,_0x49ca6b){var _0x2f3674={'raw':!![],'where':{'id':_0x146c88[_0x2978('0x53')]['id']}},_0x27821b={};_0x27821b['model']=_[_0x2978('0x43')](db['SmsMessage'][_0x2978('0x54')]);_0x27821b[_0x2978('0x42')]=_[_0x2978('0x43')](_0x146c88[_0x2978('0x42')]);_0x27821b['filters']=_[_0x2978('0x55')](_0x27821b[_0x2978('0x41')],_0x27821b[_0x2978('0x42')]);_0x2f3674[_0x2978('0x45')]=_[_0x2978('0x55')](_0x27821b[_0x2978('0x41')],qs[_0x2978('0x46')](_0x146c88[_0x2978('0x42')][_0x2978('0x46')]));_0x2f3674[_0x2978('0x45')]=_0x2f3674[_0x2978('0x45')][_0x2978('0x47')]?_0x2f3674[_0x2978('0x45')]:_0x27821b[_0x2978('0x41')];if(_0x146c88[_0x2978('0x42')][_0x2978('0x50')]){_0x2f3674[_0x2978('0x56')]=[{'all':!![]}];}_0x2f3674=_[_0x2978('0x4e')]({},_0x2f3674,_0x146c88[_0x2978('0x4f')]);return db[_0x2978('0x3e')][_0x2978('0x57')](_0x2f3674)[_0x2978('0x21')](handleEntityNotFound(_0x49ca6b,null))[_0x2978('0x21')](respondWithResult(_0x49ca6b,null))[_0x2978('0x2c')](handleError(_0x49ca6b,null));};exports[_0x2978('0x58')]=function(_0x113139,_0x520708){return db[_0x2978('0x3e')][_0x2978('0x58')](_0x113139[_0x2978('0x59')],{})[_0x2978('0x21')](respondWithResult(_0x520708,0xc9))[_0x2978('0x2c')](handleError(_0x520708,null));};exports[_0x2978('0x37')]=function(_0x33a8fa,_0x1f31d2){if(_0x33a8fa[_0x2978('0x59')]['id']){delete _0x33a8fa[_0x2978('0x59')]['id'];}return db[_0x2978('0x3e')][_0x2978('0x57')]({'where':{'id':_0x33a8fa[_0x2978('0x53')]['id']}})[_0x2978('0x21')](handleEntityNotFound(_0x1f31d2,null))[_0x2978('0x21')](saveUpdates(_0x33a8fa['body'],null))['then'](respondWithResult(_0x1f31d2,null))[_0x2978('0x2c')](handleError(_0x1f31d2,null));};exports[_0x2978('0x38')]=function(_0x51c03b,_0x28baf7){return db[_0x2978('0x3e')][_0x2978('0x57')]({'where':{'id':_0x51c03b[_0x2978('0x53')]['id']}})['then'](handleEntityNotFound(_0x28baf7,null))['then'](removeEntity(_0x28baf7,null))[_0x2978('0x2c')](handleError(_0x28baf7,null));};exports[_0x2978('0x5a')]=function(_0x334b03,_0x4a347a){return db[_0x2978('0x3e')][_0x2978('0x5a')]()[_0x2978('0x21')](respondWithResult(_0x4a347a,null))[_0x2978('0x2c')](handleError(_0x4a347a,null));};var interaction_log=require(_0x2978('0x14'))(_0x2978('0x5b'));exports[_0x2978('0x5c')]=function(_0x15cbfb,_0x204dc2,_0x12f9d8){var _0x119318={'agent':{},'channel':_0x2978('0x5d')};if(_0x15cbfb[_0x2978('0x59')]['id']){delete _0x15cbfb[_0x2978('0x59')]['id'];}_0x15cbfb['body'][_0x2978('0x5e')]=!![];_0x15cbfb['body'][_0x2978('0x5f')]=moment()[_0x2978('0x60')](_0x2978('0x61'));_0x15cbfb[_0x2978('0x59')]['UserId']=_0x15cbfb[_0x2978('0x59')]['UserId']||_0x15cbfb['user']['id'];_0x119318['agent']['id']=_0x15cbfb['body'][_0x2978('0x62')];return db[_0x2978('0x3e')]['find']({'where':{'id':_0x15cbfb[_0x2978('0x53')]['id'],'UserId':null}})[_0x2978('0x21')](handleEntityNotFound(_0x204dc2,null))[_0x2978('0x21')](saveUpdates(_0x15cbfb['body'],null))['then'](function(_0x11ac0b){if(_0x11ac0b){_0x119318[_0x2978('0x29')]=_0x11ac0b['get']({'plain':!![]});return db[_0x2978('0x63')]['find']({'where':{'id':_0x11ac0b[_0x2978('0x64')]}});}return null;})[_0x2978('0x21')](handleEntityNotFound(_0x204dc2,null))[_0x2978('0x21')](function(_0x1c4109){if(_0x1c4109){return _0x1c4109['update']({'UserId':_0x15cbfb[_0x2978('0x59')][_0x2978('0x62')],'read1stAt':_['isNil'](_0x1c4109['read1stAt'])?moment()[_0x2978('0x60')](_0x2978('0x61')):undefined});}return null;})[_0x2978('0x21')](function(_0x2cf33f){if(_0x2cf33f){_0x119318['interaction']=_0x2cf33f[_0x2978('0x65')]({'plain':!![]});interaction_log[_0x2978('0x22')](_0x2978('0x66'),_0x15cbfb['user']['id'],_0x15cbfb[_0x2978('0x67')]['name'],_0x15cbfb['user'][_0x2978('0x68')],_0x119318[_0x2978('0x69')]['id'],_0x15cbfb['body']?JSON[_0x2978('0x26')](_0x15cbfb['body']):_0x2978('0x6a'));return respondWithRpcPromise('AcceptMessage',_0x2978('0x6b'),_0x119318);}return null;})[_0x2978('0x21')](function(_0x322435){var _0x3b43f8=_0x2978('0x6c')+_0x322435[_0x2978('0x29')]['ContactId'];return db[_0x2978('0x6d')]['query'](_0x3b43f8,{'type':db['Sequelize']['QueryTypes'][_0x2978('0x6e')],'raw':!![]})['then'](function(_0x3ab8ab){return _0x3ab8ab;});})[_0x2978('0x21')](function(_0x117a83){if(_0x117a83){_0x119318[_0x2978('0x29')][_0x2978('0x6f')]=_0x117a83[0x0];if(!_0x15cbfb[_0x2978('0x59')][_0x2978('0x62')])return;return db[_0x2978('0x70')][_0x2978('0x57')]({'where':{'id':_0x15cbfb[_0x2978('0x59')][_0x2978('0x62')],'role':_0x2978('0x71')},'attributes':['id',_0x2978('0x3b'),_0x2978('0x72'),'email',_0x2978('0x73')],'raw':!![]});}return null;})[_0x2978('0x21')](function(_0x3c2230){if(!_0x3c2230)return null;_0x119318[_0x2978('0x29')][_0x2978('0x71')]=_0x3c2230;return _0x119318;})[_0x2978('0x21')](function(_0x46a2f3){if(_0x46a2f3){if(_0x15cbfb[_0x2978('0x59')][_0x2978('0x74')]){_0x119318['message'][_0x2978('0x75')]=util[_0x2978('0x60')](_0x2978('0x76'),_0x15cbfb['user'][_0x2978('0x3b')]);_0x119318[_0x2978('0x29')][_0x2978('0x77')]=_0x119318[_0x2978('0x77')];_0x119318['message'][_0x2978('0x78')]=_0x119318['channel'];_0x119318[_0x2978('0x29')]['event']=_0x2978('0x5c');return respondWithRpcPromise(_0x2978('0x79'),'EventManager',{'event':_0x2978('0x7a'),'message':_0x119318['message']},client9002)[_0x2978('0x21')](function(){return _0x119318;});}return _0x119318;}return null;})[_0x2978('0x21')](respondWithResult(_0x204dc2,null))[_0x2978('0x2c')](handleError(_0x204dc2,null));};var interaction_log=require(_0x2978('0x14'))(_0x2978('0x5b'));exports[_0x2978('0x7b')]=function(_0x4c2e4f,_0x14e14b,_0x3f14a9){var _0x310e8f={'agent':{},'channel':_0x2978('0x5d')};if(_0x4c2e4f['body']['id']){delete _0x4c2e4f['body']['id'];}_0x4c2e4f[_0x2978('0x59')]['UserId']=_0x4c2e4f[_0x2978('0x59')][_0x2978('0x62')]||_0x4c2e4f[_0x2978('0x67')]['id'];_0x310e8f[_0x2978('0x71')]['id']=_0x4c2e4f[_0x2978('0x59')]['UserId'];return db['SmsMessage'][_0x2978('0x57')]({'where':{'id':_0x4c2e4f[_0x2978('0x53')]['id'],'UserId':null}})[_0x2978('0x21')](handleEntityNotFound(_0x14e14b,null))[_0x2978('0x21')](function(_0xb21d6b){if(_0xb21d6b){_0x310e8f['message']=_0xb21d6b[_0x2978('0x65')]({'plain':!![]});return db[_0x2978('0x63')][_0x2978('0x57')]({'where':{'id':_0xb21d6b[_0x2978('0x64')]}});}return null;})[_0x2978('0x21')](handleEntityNotFound(_0x14e14b,null))['then'](function(_0x4f281d){if(_0x4f281d){_0x310e8f['interaction']=_0x4f281d[_0x2978('0x65')]({'plain':!![]});interaction_log[_0x2978('0x22')](_0x2978('0x7c'),_0x4c2e4f[_0x2978('0x67')]['id'],_0x4c2e4f[_0x2978('0x67')]['name'],_0x4c2e4f['user']['role'],_0x310e8f[_0x2978('0x69')]['id'],_0x4c2e4f[_0x2978('0x59')]?JSON[_0x2978('0x26')](_0x4c2e4f[_0x2978('0x59')]):_0x2978('0x6a'));return respondWithRpcPromise(_0x2978('0x7d'),_0x2978('0x7e'),_0x310e8f);}return null;})[_0x2978('0x21')](function(_0x1c7d16){var _0x347d98=_0x2978('0x6c')+_0x1c7d16['message']['ContactId'];return db[_0x2978('0x6d')][_0x2978('0x42')](_0x347d98,{'type':db[_0x2978('0x7f')]['QueryTypes'][_0x2978('0x6e')],'raw':!![]})['then'](function(_0x48f0f7){return _0x48f0f7;});})[_0x2978('0x21')](function(_0xdbb527){if(_0xdbb527){_0x310e8f[_0x2978('0x29')][_0x2978('0x6f')]=_0xdbb527[0x0];if(!_0x4c2e4f[_0x2978('0x59')]['UserId'])return;return db['User'][_0x2978('0x57')]({'where':{'id':_0x4c2e4f[_0x2978('0x59')][_0x2978('0x62')],'role':'agent'},'attributes':['id','name','fullname',_0x2978('0x80'),_0x2978('0x73')],'raw':!![]});}return null;})[_0x2978('0x21')](function(_0x4bc467){if(!_0x4bc467)return null;_0x310e8f[_0x2978('0x29')][_0x2978('0x71')]=_0x4bc467;return _0x310e8f;})[_0x2978('0x21')](function(_0x22e0f4){if(_0x22e0f4){_0x22e0f4[_0x2978('0x29')][_0x2978('0x75')]=util[_0x2978('0x60')](_0x2978('0x76'),_0x4c2e4f[_0x2978('0x67')][_0x2978('0x3b')]);_0x22e0f4[_0x2978('0x29')]['channel']=_0x310e8f[_0x2978('0x77')];_0x22e0f4[_0x2978('0x29')][_0x2978('0x78')]=_0x310e8f['channel'];_0x22e0f4[_0x2978('0x29')][_0x2978('0x81')]=_0x2978('0x7b');respondWithRpcPromise(_0x2978('0x79'),_0x2978('0x79'),{'event':_0x2978('0x82'),'message':_0x22e0f4[_0x2978('0x29')]},client9002);return _0x310e8f;}return null;})[_0x2978('0x21')](respondWithResult(_0x14e14b,null))[_0x2978('0x2c')](handleError(_0x14e14b,null));};exports[_0x2978('0x2d')]=function(_0x1d6957,_0x2ddcc2,_0x204daa){if(_0x1d6957[_0x2978('0x59')]['id']){delete _0x1d6957[_0x2978('0x59')]['id'];}var _0x3f41e1;return db[_0x2978('0x3e')][_0x2978('0x57')]({'where':{'id':_0x1d6957[_0x2978('0x53')]['id']}})[_0x2978('0x21')](handleEntityNotFound(_0x2ddcc2,null))[_0x2978('0x21')](function(_0x29b39e){if(_0x29b39e){_0x3f41e1=_0x29b39e;return db['SmsAccount'][_0x2978('0x57')]({'where':{'id':_0x29b39e[_0x2978('0x83')]}});}})[_0x2978('0x21')](handleEntityNotFound(_0x2ddcc2,null))[_0x2978('0x21')](function(_0x529e81){if(_0x529e81){logger[_0x2978('0x24')](_0x2978('0x25'),'status',_0x2978('0x84'),_0x529e81[_0x2978('0x85')],util[_0x2978('0x86')](_0x1d6957[_0x2978('0x59')],{'showHidden':![],'depth':null}));switch(_0x529e81['type']){case'twilio':if(_0x1d6957[_0x2978('0x59')][_0x2978('0x87')]&&_0x1d6957[_0x2978('0x59')]['MessageSid']===_0x3f41e1[_0x2978('0x88')]){return _0x3f41e1['update']({'read':!![]});}else{logger[_0x2978('0x27')](_0x2978('0x89'),_0x2978('0x2d'),'twilio',util['inspect'](_0x1d6957[_0x2978('0x59')],{'showHidden':![],'depth':null}));}break;case _0x2978('0x8a'):if(_0x1d6957[_0x2978('0x59')][_0x2978('0x8b')]&&_0x1d6957['body']['MessageUUID']===_0x3f41e1[_0x2978('0x88')]&&_[_0x2978('0x8c')]([_0x2978('0x8d'),_0x2978('0x8e')],_0x1d6957[_0x2978('0x59')][_0x2978('0x8f')])>=0x0){return _0x3f41e1[_0x2978('0x37')]({'read':!![]});}else{logger[_0x2978('0x27')](_0x2978('0x89'),'status',_0x2978('0x90'),util[_0x2978('0x86')](_0x1d6957[_0x2978('0x59')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x2bee10=_0x1d6957[_0x2978('0x59')][_0x2978('0x91')][0x0];if(_0x2bee10[_0x2978('0x2d')][_0x2978('0x92')]===_0x2978('0x93')){return _0x3f41e1[_0x2978('0x37')]({'read':!![]});}else{logger[_0x2978('0x27')](_0x2978('0x89'),_0x2978('0x2d'),_0x2978('0x94'),util[_0x2978('0x86')](_0x1d6957[_0x2978('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x3f41e1;}})[_0x2978('0x21')](respondWithResult(_0x2ddcc2,null))[_0x2978('0x2c')](handleError(_0x2ddcc2,null));}; \ No newline at end of file +var _0x94d4=['event','EventManager','acceptmessage','RejectMessage','rejectMessage','SIP/%s','motionChannel','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','messageId','MessageUUID','sent','delivered','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','DELIVERED','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','sendStatus','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','SmsMessage','includeAll','findAll','rows','show','params','keys','length','include','find','create','body','destroy','describe','sms-interactions','accept','sms','read','readAt','format','UserId','user','get','SmsInteraction','SmsInteractionId','isNil','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','manual','interface','channel'];(function(_0x4fc421,_0x94e88){var _0x8c6d63=function(_0x5b8b42){while(--_0x5b8b42){_0x4fc421['push'](_0x4fc421['shift']());}};_0x8c6d63(++_0x94e88);}(_0x94d4,0xa5));var _0x494d=function(_0x1abd02,_0x112cf4){_0x1abd02=_0x1abd02-0x0;var _0x247865=_0x94d4[_0x1abd02];return _0x247865;};'use strict';var emlformat=require(_0x494d('0x0'));var rimraf=require(_0x494d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x494d('0x2'));var rp=require(_0x494d('0x3'));var moment=require(_0x494d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x494d('0x5'));var util=require(_0x494d('0x6'));var path=require(_0x494d('0x7'));var sox=require(_0x494d('0x8'));var csv=require(_0x494d('0x9'));var ejs=require(_0x494d('0xa'));var fs=require('fs');var fs_extra=require(_0x494d('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x494d('0xc'));var deskjs=require(_0x494d('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x494d('0xe'));var Redis=require(_0x494d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x494d('0x10'));var as=require(_0x494d('0x11'));var hardwareService=require(_0x494d('0x12'));var logger=require(_0x494d('0x13'))('api');var utils=require(_0x494d('0x14'));var config=require(_0x494d('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x494d('0x16')](config[_0x494d('0x17')],{'host':_0x494d('0x18'),'port':0x18eb});var socket=require(_0x494d('0x19'))(new Redis(config[_0x494d('0x17')]));require(_0x494d('0x1a'))[_0x494d('0x1b')](socket);var jayson=require(_0x494d('0x1c'));var client=jayson[_0x494d('0x1d')][_0x494d('0x1e')]({'port':0x232c});var client9002=jayson[_0x494d('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22f04f,_0x215a65,_0x2a2917,_0x3012e3){return new BPromise(function(_0x120488,_0x1680a3){var _0x15c2d9=_0x3012e3||client;return _0x15c2d9[_0x494d('0x1f')](_0x22f04f,_0x2a2917)[_0x494d('0x20')](function(_0x1552bb){logger[_0x494d('0x21')](_0x494d('0x22'),_0x215a65,_0x494d('0x23'));logger[_0x494d('0x24')](_0x494d('0x25'),_0x215a65,_0x494d('0x23'),JSON[_0x494d('0x26')](_0x1552bb));if(_0x1552bb['error']){if(_0x1552bb[_0x494d('0x27')][_0x494d('0x28')]===0x1f4){logger[_0x494d('0x27')](_0x494d('0x22'),_0x215a65,_0x1552bb['error']['message']);return _0x1680a3(_0x1552bb[_0x494d('0x27')][_0x494d('0x29')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x215a65,_0x1552bb[_0x494d('0x27')]['message']);return _0x120488(_0x1552bb[_0x494d('0x27')]['message']);}else{logger[_0x494d('0x21')](_0x494d('0x22'),_0x215a65,'request\x20sent');_0x120488(_0x1552bb[_0x494d('0x2a')][_0x494d('0x29')]);}})[_0x494d('0x2b')](function(_0x2ab88b){logger[_0x494d('0x27')]('SmsMessage,\x20%s,\x20%s',_0x215a65,_0x2ab88b);_0x1680a3(_0x2ab88b);});});}function respondWithStatusCode(_0x17d65a,_0x178444){_0x178444=_0x178444||0xcc;return function(_0x4a8356){if(_0x4a8356){return _0x17d65a['sendStatus'](_0x178444);}return _0x17d65a[_0x494d('0x2c')](_0x178444)[_0x494d('0x2d')]();};}function respondWithResult(_0x37253a,_0x2c025d){_0x2c025d=_0x2c025d||0xc8;return function(_0xf466f){if(_0xf466f){return _0x37253a[_0x494d('0x2c')](_0x2c025d)[_0x494d('0x2e')](_0xf466f);}};}function respondWithFilteredResult(_0x347c58,_0x213939){return function(_0x2d9615){if(_0x2d9615){var _0x1a8d4b=typeof _0x213939[_0x494d('0x2f')]===_0x494d('0x30')&&typeof _0x213939['limit']===_0x494d('0x30');var _0xa78384=_0x2d9615[_0x494d('0x31')];var _0x18dfae=_0x1a8d4b?0x0:_0x213939[_0x494d('0x2f')];var _0x25328a=_0x1a8d4b?_0x2d9615[_0x494d('0x31')]:_0x213939[_0x494d('0x2f')]+_0x213939[_0x494d('0x32')];var _0x22e06c;if(_0x25328a>=_0xa78384){_0x25328a=_0xa78384;_0x22e06c=0xc8;}else{_0x22e06c=0xce;}_0x347c58['status'](_0x22e06c);return _0x347c58[_0x494d('0x33')](_0x494d('0x34'),_0x18dfae+'-'+_0x25328a+'/'+_0xa78384)['json'](_0x2d9615);}return null;};}function patchUpdates(_0x3bd0fe){return function(_0x4a8ed1){try{jsonpatch['apply'](_0x4a8ed1,_0x3bd0fe,!![]);}catch(_0x499e9f){return BPromise[_0x494d('0x35')](_0x499e9f);}return _0x4a8ed1['save']();};}function saveUpdates(_0x2b26ec,_0x424b58){return function(_0x4464ed){if(_0x4464ed){return _0x4464ed[_0x494d('0x36')](_0x2b26ec)['then'](function(_0x57d2b4){return _0x57d2b4;});}return null;};}function removeEntity(_0x398a45,_0x146c62){return function(_0x3781c7){if(_0x3781c7){return _0x3781c7['destroy']()['then'](function(){_0x398a45[_0x494d('0x2c')](0xcc)[_0x494d('0x2d')]();});}};}function handleEntityNotFound(_0x563ca3,_0x23633b){return function(_0x2b0185){if(!_0x2b0185){_0x563ca3[_0x494d('0x37')](0x194);}return _0x2b0185;};}function handleError(_0x5ca302,_0x571e87){_0x571e87=_0x571e87||0x1f4;return function(_0x4fc8d0){logger[_0x494d('0x27')](_0x4fc8d0['stack']);if(_0x4fc8d0['name']){delete _0x4fc8d0[_0x494d('0x38')];}_0x5ca302[_0x494d('0x2c')](_0x571e87)[_0x494d('0x39')](_0x4fc8d0);};}exports[_0x494d('0x3a')]=function(_0x2080ef,_0x5c20b1){var _0x25aa0b={},_0x46630c={},_0x29439f={'count':0x0,'rows':[]};var _0x13b6b1=_[_0x494d('0x3b')](db['SmsMessage'][_0x494d('0x3c')],function(_0x339cdd){return{'name':_0x339cdd['fieldName'],'type':_0x339cdd[_0x494d('0x3d')][_0x494d('0x3e')]};});_0x46630c[_0x494d('0x3f')]=_['map'](_0x13b6b1,_0x494d('0x38'));_0x46630c[_0x494d('0x40')]=_['keys'](_0x2080ef[_0x494d('0x40')]);_0x46630c[_0x494d('0x41')]=_[_0x494d('0x42')](_0x46630c['model'],_0x46630c['query']);_0x25aa0b[_0x494d('0x43')]=_['intersection'](_0x46630c[_0x494d('0x3f')],qs[_0x494d('0x44')](_0x2080ef[_0x494d('0x40')]['fields']));_0x25aa0b[_0x494d('0x43')]=_0x25aa0b[_0x494d('0x43')]['length']?_0x25aa0b[_0x494d('0x43')]:_0x46630c[_0x494d('0x3f')];if(!_0x2080ef['query'][_0x494d('0x45')](_0x494d('0x46'))){_0x25aa0b['limit']=qs[_0x494d('0x32')](_0x2080ef[_0x494d('0x40')][_0x494d('0x32')]);_0x25aa0b[_0x494d('0x2f')]=qs['offset'](_0x2080ef[_0x494d('0x40')][_0x494d('0x2f')]);}_0x25aa0b[_0x494d('0x47')]=qs[_0x494d('0x48')](_0x2080ef['query']['sort']);_0x25aa0b[_0x494d('0x49')]=qs[_0x494d('0x41')](_['pick'](_0x2080ef[_0x494d('0x40')],_0x46630c[_0x494d('0x41')]),_0x13b6b1);if(_0x2080ef[_0x494d('0x40')]['filter']){_0x25aa0b['where']=_[_0x494d('0x4a')](_0x25aa0b[_0x494d('0x49')],{'$or':_[_0x494d('0x3b')](_0x13b6b1,function(_0x2a480b){if(_0x2a480b[_0x494d('0x3d')]!==_0x494d('0x4b')){var _0x298344={};_0x298344[_0x2a480b[_0x494d('0x38')]]={'$like':'%'+_0x2080ef[_0x494d('0x40')][_0x494d('0x4c')]+'%'};return _0x298344;}})});}_0x25aa0b=_[_0x494d('0x4a')]({},_0x25aa0b,_0x2080ef[_0x494d('0x4d')]);var _0x53a97b={'where':_0x25aa0b[_0x494d('0x49')]};return db[_0x494d('0x4e')][_0x494d('0x31')](_0x53a97b)[_0x494d('0x20')](function(_0x19583e){_0x29439f[_0x494d('0x31')]=_0x19583e;if(_0x2080ef[_0x494d('0x40')][_0x494d('0x4f')]){_0x25aa0b['include']=[{'all':!![]}];}return db[_0x494d('0x4e')][_0x494d('0x50')](_0x25aa0b);})[_0x494d('0x20')](function(_0x34d027){_0x29439f[_0x494d('0x51')]=_0x34d027;return _0x29439f;})['then'](respondWithFilteredResult(_0x5c20b1,_0x25aa0b))['catch'](handleError(_0x5c20b1,null));};exports[_0x494d('0x52')]=function(_0x57f392,_0x3d7bf3){var _0x44b2ea={'raw':!![],'where':{'id':_0x57f392[_0x494d('0x53')]['id']}},_0x287209={};_0x287209['model']=_[_0x494d('0x54')](db[_0x494d('0x4e')]['rawAttributes']);_0x287209[_0x494d('0x40')]=_[_0x494d('0x54')](_0x57f392[_0x494d('0x40')]);_0x287209[_0x494d('0x41')]=_[_0x494d('0x42')](_0x287209[_0x494d('0x3f')],_0x287209[_0x494d('0x40')]);_0x44b2ea[_0x494d('0x43')]=_['intersection'](_0x287209['model'],qs[_0x494d('0x44')](_0x57f392['query']['fields']));_0x44b2ea[_0x494d('0x43')]=_0x44b2ea[_0x494d('0x43')][_0x494d('0x55')]?_0x44b2ea[_0x494d('0x43')]:_0x287209[_0x494d('0x3f')];if(_0x57f392[_0x494d('0x40')]['includeAll']){_0x44b2ea[_0x494d('0x56')]=[{'all':!![]}];}_0x44b2ea=_[_0x494d('0x4a')]({},_0x44b2ea,_0x57f392[_0x494d('0x4d')]);return db['SmsMessage'][_0x494d('0x57')](_0x44b2ea)[_0x494d('0x20')](handleEntityNotFound(_0x3d7bf3,null))['then'](respondWithResult(_0x3d7bf3,null))[_0x494d('0x2b')](handleError(_0x3d7bf3,null));};exports[_0x494d('0x58')]=function(_0x34ec72,_0x46d84d){return db['SmsMessage']['create'](_0x34ec72[_0x494d('0x59')],{})[_0x494d('0x20')](respondWithResult(_0x46d84d,0xc9))[_0x494d('0x2b')](handleError(_0x46d84d,null));};exports[_0x494d('0x36')]=function(_0x538f07,_0x10d748){if(_0x538f07[_0x494d('0x59')]['id']){delete _0x538f07[_0x494d('0x59')]['id'];}return db['SmsMessage'][_0x494d('0x57')]({'where':{'id':_0x538f07['params']['id']}})[_0x494d('0x20')](handleEntityNotFound(_0x10d748,null))[_0x494d('0x20')](saveUpdates(_0x538f07['body'],null))[_0x494d('0x20')](respondWithResult(_0x10d748,null))[_0x494d('0x2b')](handleError(_0x10d748,null));};exports[_0x494d('0x5a')]=function(_0x4659ed,_0x4ce59d){return db[_0x494d('0x4e')][_0x494d('0x57')]({'where':{'id':_0x4659ed[_0x494d('0x53')]['id']}})[_0x494d('0x20')](handleEntityNotFound(_0x4ce59d,null))[_0x494d('0x20')](removeEntity(_0x4ce59d,null))['catch'](handleError(_0x4ce59d,null));};exports[_0x494d('0x5b')]=function(_0x8304b5,_0x3c9edf){return db[_0x494d('0x4e')][_0x494d('0x5b')]()[_0x494d('0x20')](respondWithResult(_0x3c9edf,null))[_0x494d('0x2b')](handleError(_0x3c9edf,null));};var interaction_log=require(_0x494d('0x13'))(_0x494d('0x5c'));exports[_0x494d('0x5d')]=function(_0x459f56,_0x17c800,_0x285b2d){var _0x30f2a0={'agent':{},'channel':_0x494d('0x5e')};if(_0x459f56[_0x494d('0x59')]['id']){delete _0x459f56['body']['id'];}_0x459f56[_0x494d('0x59')][_0x494d('0x5f')]=!![];_0x459f56[_0x494d('0x59')][_0x494d('0x60')]=moment()[_0x494d('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x459f56['body'][_0x494d('0x62')]=_0x459f56[_0x494d('0x59')]['UserId']||_0x459f56[_0x494d('0x63')]['id'];_0x30f2a0['agent']['id']=_0x459f56['body'][_0x494d('0x62')];return db[_0x494d('0x4e')][_0x494d('0x57')]({'where':{'id':_0x459f56[_0x494d('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x17c800,null))['then'](saveUpdates(_0x459f56['body'],null))['then'](function(_0x8d2c15){if(_0x8d2c15){_0x30f2a0['message']=_0x8d2c15[_0x494d('0x64')]({'plain':!![]});return db[_0x494d('0x65')][_0x494d('0x57')]({'where':{'id':_0x8d2c15[_0x494d('0x66')]}});}return null;})[_0x494d('0x20')](handleEntityNotFound(_0x17c800,null))['then'](function(_0x27e5d6){if(_0x27e5d6){return _0x27e5d6[_0x494d('0x36')]({'UserId':_0x459f56[_0x494d('0x59')]['UserId'],'read1stAt':_[_0x494d('0x67')](_0x27e5d6['read1stAt'])?moment()[_0x494d('0x61')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x494d('0x20')](function(_0x57d5ac){if(_0x57d5ac){_0x30f2a0[_0x494d('0x68')]=_0x57d5ac[_0x494d('0x64')]({'plain':!![]});interaction_log[_0x494d('0x21')](_0x494d('0x69'),_0x459f56[_0x494d('0x63')]['id'],_0x459f56[_0x494d('0x63')][_0x494d('0x38')],_0x459f56[_0x494d('0x63')]['role'],_0x30f2a0['interaction']['id'],_0x459f56[_0x494d('0x59')]?JSON[_0x494d('0x26')](_0x459f56[_0x494d('0x59')]):_0x494d('0x6a'));return respondWithRpcPromise(_0x494d('0x6b'),'acceptMessage',_0x30f2a0);}return null;})['then'](function(_0x203a55){var _0x5d3955='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x203a55['message'][_0x494d('0x6c')];return db[_0x494d('0x6d')][_0x494d('0x40')](_0x5d3955,{'type':db[_0x494d('0x6e')][_0x494d('0x6f')][_0x494d('0x70')],'raw':!![]})[_0x494d('0x20')](function(_0x21bfe3){return _0x21bfe3;});})[_0x494d('0x20')](function(_0x456c9f){if(_0x456c9f){_0x30f2a0[_0x494d('0x29')][_0x494d('0x71')]=_0x456c9f[0x0];if(!_0x459f56[_0x494d('0x59')][_0x494d('0x62')])return;return db[_0x494d('0x72')]['find']({'where':{'id':_0x459f56[_0x494d('0x59')][_0x494d('0x62')],'role':_0x494d('0x73')},'attributes':['id','name',_0x494d('0x74'),_0x494d('0x75'),'internal'],'raw':!![]});}return null;})[_0x494d('0x20')](function(_0x423852){if(!_0x423852)return null;_0x30f2a0[_0x494d('0x29')][_0x494d('0x73')]=_0x423852;return _0x30f2a0;})[_0x494d('0x20')](function(_0x4ac9c6){if(_0x4ac9c6){if(_0x459f56['body'][_0x494d('0x76')]){_0x30f2a0[_0x494d('0x29')][_0x494d('0x77')]=util[_0x494d('0x61')]('SIP/%s',_0x459f56['user'][_0x494d('0x38')]);_0x30f2a0[_0x494d('0x29')][_0x494d('0x78')]=_0x30f2a0[_0x494d('0x78')];_0x30f2a0[_0x494d('0x29')]['motionChannel']=_0x30f2a0[_0x494d('0x78')];_0x30f2a0['message'][_0x494d('0x79')]=_0x494d('0x5d');return respondWithRpcPromise(_0x494d('0x7a'),'EventManager',{'event':_0x494d('0x7b'),'message':_0x30f2a0[_0x494d('0x29')]},client9002)[_0x494d('0x20')](function(){return _0x30f2a0;});}return _0x30f2a0;}return null;})['then'](respondWithResult(_0x17c800,null))[_0x494d('0x2b')](handleError(_0x17c800,null));};var interaction_log=require('../../config/logger')(_0x494d('0x5c'));exports['reject']=function(_0x3809fc,_0x23cd83,_0xf2ad4b){var _0x344243={'agent':{},'channel':_0x494d('0x5e')};if(_0x3809fc[_0x494d('0x59')]['id']){delete _0x3809fc['body']['id'];}_0x3809fc[_0x494d('0x59')][_0x494d('0x62')]=_0x3809fc[_0x494d('0x59')][_0x494d('0x62')]||_0x3809fc[_0x494d('0x63')]['id'];_0x344243['agent']['id']=_0x3809fc[_0x494d('0x59')][_0x494d('0x62')];return db[_0x494d('0x4e')][_0x494d('0x57')]({'where':{'id':_0x3809fc[_0x494d('0x53')]['id'],'UserId':null}})[_0x494d('0x20')](handleEntityNotFound(_0x23cd83,null))[_0x494d('0x20')](function(_0x1001f8){if(_0x1001f8){_0x344243[_0x494d('0x29')]=_0x1001f8[_0x494d('0x64')]({'plain':!![]});return db[_0x494d('0x65')][_0x494d('0x57')]({'where':{'id':_0x1001f8[_0x494d('0x66')]}});}return null;})[_0x494d('0x20')](handleEntityNotFound(_0x23cd83,null))[_0x494d('0x20')](function(_0x704f6f){if(_0x704f6f){_0x344243['interaction']=_0x704f6f['get']({'plain':!![]});interaction_log[_0x494d('0x21')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3809fc[_0x494d('0x63')]['id'],_0x3809fc[_0x494d('0x63')]['name'],_0x3809fc[_0x494d('0x63')]['role'],_0x344243[_0x494d('0x68')]['id'],_0x3809fc[_0x494d('0x59')]?JSON[_0x494d('0x26')](_0x3809fc[_0x494d('0x59')]):_0x494d('0x6a'));return respondWithRpcPromise(_0x494d('0x7c'),_0x494d('0x7d'),_0x344243);}return null;})[_0x494d('0x20')](function(_0x454910){var _0x5ad445='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x454910[_0x494d('0x29')][_0x494d('0x6c')];return db['sequelize'][_0x494d('0x40')](_0x5ad445,{'type':db[_0x494d('0x6e')][_0x494d('0x6f')][_0x494d('0x70')],'raw':!![]})[_0x494d('0x20')](function(_0x306abb){return _0x306abb;});})['then'](function(_0x217d4a){if(_0x217d4a){_0x344243[_0x494d('0x29')][_0x494d('0x71')]=_0x217d4a[0x0];if(!_0x3809fc[_0x494d('0x59')][_0x494d('0x62')])return;return db[_0x494d('0x72')]['find']({'where':{'id':_0x3809fc[_0x494d('0x59')][_0x494d('0x62')],'role':_0x494d('0x73')},'attributes':['id',_0x494d('0x38'),_0x494d('0x74'),_0x494d('0x75'),'internal'],'raw':!![]});}return null;})[_0x494d('0x20')](function(_0x21f539){if(!_0x21f539)return null;_0x344243[_0x494d('0x29')][_0x494d('0x73')]=_0x21f539;return _0x344243;})[_0x494d('0x20')](function(_0x5cdefc){if(_0x5cdefc){_0x5cdefc[_0x494d('0x29')][_0x494d('0x77')]=util[_0x494d('0x61')](_0x494d('0x7e'),_0x3809fc['user'][_0x494d('0x38')]);_0x5cdefc['message'][_0x494d('0x78')]=_0x344243['channel'];_0x5cdefc['message'][_0x494d('0x7f')]=_0x344243['channel'];_0x5cdefc[_0x494d('0x29')]['event']='reject';respondWithRpcPromise(_0x494d('0x7a'),_0x494d('0x7a'),{'event':_0x494d('0x80'),'message':_0x5cdefc[_0x494d('0x29')]},client9002);return _0x344243;}return null;})[_0x494d('0x20')](respondWithResult(_0x23cd83,null))[_0x494d('0x2b')](handleError(_0x23cd83,null));};exports[_0x494d('0x2c')]=function(_0x4b0a36,_0x514b2f,_0x56043b){if(_0x4b0a36[_0x494d('0x59')]['id']){delete _0x4b0a36[_0x494d('0x59')]['id'];}var _0x12dc28;return db[_0x494d('0x4e')][_0x494d('0x57')]({'where':{'id':_0x4b0a36[_0x494d('0x53')]['id']}})[_0x494d('0x20')](handleEntityNotFound(_0x514b2f,null))[_0x494d('0x20')](function(_0x3a4091){if(_0x3a4091){_0x12dc28=_0x3a4091;return db[_0x494d('0x81')][_0x494d('0x57')]({'where':{'id':_0x3a4091[_0x494d('0x82')]}});}})[_0x494d('0x20')](handleEntityNotFound(_0x514b2f,null))[_0x494d('0x20')](function(_0x1d7980){if(_0x1d7980){logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x494d('0x2c'),_0x494d('0x83'),_0x1d7980[_0x494d('0x3d')],util[_0x494d('0x84')](_0x4b0a36[_0x494d('0x59')],{'showHidden':![],'depth':null}));switch(_0x1d7980[_0x494d('0x3d')]){case _0x494d('0x85'):if(_0x4b0a36[_0x494d('0x59')]['MessageSid']&&_0x4b0a36[_0x494d('0x59')]['MessageSid']===_0x12dc28[_0x494d('0x86')]){return _0x12dc28[_0x494d('0x36')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x494d('0x2c'),_0x494d('0x85'),util[_0x494d('0x84')](_0x4b0a36['body'],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x4b0a36['body'][_0x494d('0x87')]&&_0x4b0a36['body']['MessageUUID']===_0x12dc28[_0x494d('0x86')]&&_['indexOf']([_0x494d('0x88'),_0x494d('0x89')],_0x4b0a36[_0x494d('0x59')]['Status'])>=0x0){return _0x12dc28[_0x494d('0x36')]({'read':!![]});}else{logger[_0x494d('0x27')](_0x494d('0x8a'),_0x494d('0x2c'),_0x494d('0x8b'),util[_0x494d('0x84')](_0x4b0a36['body'],{'showHidden':![],'depth':null}));}break;case _0x494d('0x8c'):var _0x11b2f1=_0x4b0a36[_0x494d('0x59')][_0x494d('0x8d')][0x0];if(_0x11b2f1[_0x494d('0x2c')]['groupName']===_0x494d('0x8e')){return _0x12dc28[_0x494d('0x36')]({'read':!![]});}else{logger[_0x494d('0x27')](_0x494d('0x8a'),_0x494d('0x2c'),_0x494d('0x8c'),util[_0x494d('0x84')](_0x4b0a36[_0x494d('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x12dc28;}})['then'](respondWithResult(_0x514b2f,null))[_0x494d('0x2b')](handleError(_0x514b2f,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 10569a7..8705e83 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 _0x76d7=['save','update','remove','emit','hasOwnProperty','hook','exports','SmsMessage','setMaxListeners'];(function(_0x1738d3,_0x37b65a){var _0x1f7cab=function(_0x38eb67){while(--_0x38eb67){_0x1738d3['push'](_0x1738d3['shift']());}};_0x1f7cab(++_0x37b65a);}(_0x76d7,0x11e));var _0x776d=function(_0xfb1864,_0x1cc767){_0xfb1864=_0xfb1864-0x0;var _0x4767e7=_0x76d7[_0xfb1864];return _0x4767e7;};'use strict';var EventEmitter=require('events');var SmsMessage=require('../../mysqldb')['db'][_0x776d('0x0')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x776d('0x1')](0x0);var events={'afterCreate':_0x776d('0x2'),'afterUpdate':_0x776d('0x3'),'afterDestroy':_0x776d('0x4')};function emitEvent(_0x138b70){return function(_0x5e5582,_0x32f4ad,_0x4e4935){SmsMessageEvents[_0x776d('0x5')](_0x138b70+':'+_0x5e5582['id'],_0x5e5582);SmsMessageEvents[_0x776d('0x5')](_0x138b70,_0x5e5582);_0x4e4935(null);};}for(var e in events){if(events[_0x776d('0x6')](e)){var event=events[e];SmsMessage[_0x776d('0x7')](e,emitEvent(event));}}module[_0x776d('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0xd40f=['remove','emit','events','../../mysqldb','SmsMessage','setMaxListeners','save','update'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xd40f,0x1d2));var _0xfd40=function(_0x1abbd1,_0x26581f){_0x1abbd1=_0x1abbd1-0x0;var _0x41a7f2=_0xd40f[_0x1abbd1];return _0x41a7f2;};'use strict';var EventEmitter=require(_0xfd40('0x0'));var SmsMessage=require(_0xfd40('0x1'))['db'][_0xfd40('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xfd40('0x3')](0x0);var events={'afterCreate':_0xfd40('0x4'),'afterUpdate':_0xfd40('0x5'),'afterDestroy':_0xfd40('0x6')};function emitEvent(_0x3b57f0){return function(_0x5e9e37,_0x57efdc,_0x5bf643){SmsMessageEvents[_0xfd40('0x7')](_0x3b57f0+':'+_0x5e9e37['id'],_0x5e9e37);SmsMessageEvents[_0xfd40('0x7')](_0x3b57f0,_0x5e9e37);_0x5bf643(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index fc1225a..753e921 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 _0xc853=['exports','define','SmsMessage','sms_messages','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','phone','accountSid','authToken','messages','create','remote','/api/sms/messages/','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','&password=','GET','split','sms','POST','user_key','session_key','deliveryReport','Missing\x20parameters:\x20username,\x20password','connectel','https://smsapi.connectel.se/api/v2/send/','requestid','read','clicksend','xCALLY\x20Motion','senderString','format','Basic\x20%s','toString','base64','http_code','data','head','clickSend','plivo','/status?token=','%s:%s','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','timestamp','keys','sort','length','createHash','md5','digest','hex','signature=','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x19486d,_0xbb7e60){var _0x4f2ba1=function(_0x14cf17){while(--_0x14cf17){_0x19486d['push'](_0x19486d['shift']());}};_0x4f2ba1(++_0xbb7e60);}(_0xc853,0xf5));var _0x3c85=function(_0x2e42e7,_0x26bba7){_0x2e42e7=_0x2e42e7-0x0;var _0x2e377e=_0xc853[_0x2e42e7];return _0x2e377e;};'use strict';var _=require(_0x3c85('0x0'));var util=require(_0x3c85('0x1'));var logger=require(_0x3c85('0x2'))(_0x3c85('0x3'));var moment=require(_0x3c85('0x4'));var BPromise=require('bluebird');var rp=require(_0x3c85('0x5'));var fs=require('fs');var path=require(_0x3c85('0x6'));var rimraf=require(_0x3c85('0x7'));var config=require(_0x3c85('0x8'));var attributes=require('./smsMessage.attributes');module[_0x3c85('0x9')]=function(_0x84ed43,_0x52d2d9){return _0x84ed43[_0x3c85('0xa')](_0x3c85('0xb'),attributes,{'tableName':_0x3c85('0xc'),'paranoid':![],'indexes':[{'name':_0x3c85('0xd'),'fields':[_0x3c85('0xd')]},{'name':_0x3c85('0xe'),'fields':[_0x3c85('0xf')],'type':_0x3c85('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x178736,_0x27d33a,_0x4911e4){var _0x14244d=_0x84ed43[_0x3c85('0x11')];var _0x226002=_0x178736[_0x3c85('0x12')]({'plain':!![]});if(_0x226002['direction'][_0x3c85('0x13')]()==='in'||_0x226002[_0x3c85('0x14')][_0x3c85('0x13')]()===_0x3c85('0x15')&&!_0x226002[_0x3c85('0x16')]&&!_[_0x3c85('0x17')](_0x226002[_0x3c85('0x18')])&&!_[_0x3c85('0x17')](_0x226002['SmsInteractionId'])){_0x14244d[_0x3c85('0x19')]['findOne']({'where':{'id':_0x226002['SmsInteractionId']}})[_0x3c85('0x1a')](function(_0x3bb3c5){if(_0x3bb3c5){_0x3bb3c5[_0x3c85('0x1b')]({'lastMsgAt':_0x226002[_0x3c85('0x1c')],'lastMsgDirection':_0x226002[_0x3c85('0x14')][_0x3c85('0x13')]()});}})[_0x3c85('0x1d')](function(_0x4912dd){console[_0x3c85('0x1e')](_0x4912dd);});}if(_0x226002[_0x3c85('0x14')]==='out'&&!_0x226002[_0x3c85('0x16')]){var _0x2a0b00;_0x14244d[_0x3c85('0x1f')][_0x3c85('0x20')]({'where':{'id':_0x226002[_0x3c85('0x21')]},'raw':!![]})['then'](function(_0x4cfcf7){_0x2a0b00=_0x4cfcf7;if(_0x2a0b00&&_0x2a0b00['type']){switch(_0x2a0b00[_0x3c85('0x22')]){case'twilio':var _0x2c0e4e=require(_0x3c85('0x23'));if(_0x2a0b00['accountSid']&&_0x2a0b00['authToken']&&_0x2a0b00[_0x3c85('0x24')]){var _0x359592=new _0x2c0e4e(_0x2a0b00[_0x3c85('0x25')],_0x2a0b00[_0x3c85('0x26')]);_0x359592[_0x3c85('0x27')][_0x3c85('0x28')]({'body':_0x226002[_0x3c85('0xf')],'to':_0x226002[_0x3c85('0x24')],'from':_0x2a0b00[_0x3c85('0x24')],'statusCallback':_0x2a0b00[_0x3c85('0x29')]+_0x3c85('0x2a')+_0x226002['id']+'/status?token='+_0x2a0b00[_0x3c85('0x2b')]})[_0x3c85('0x1a')](function(_0x7af748){if(_0x7af748[_0x3c85('0x2c')]){return _0x178736['update']({'messageId':_0x7af748['sid']});}})[_0x3c85('0x1d')](function(_0x28c89e){logger[_0x3c85('0x1e')](_0x3c85('0x2d'),_0x3c85('0x2e'),_0x3c85('0x23'),util[_0x3c85('0x2f')](_0x28c89e,{'showHidden':![],'depth':null}));});}else{logger[_0x3c85('0x1e')](_0x3c85('0x2d'),_0x3c85('0x2e'),'twilio',_0x3c85('0x30'));}break;case _0x3c85('0x31'):var _0x50e5a3=_0x3c85('0x32');if(_0x2a0b00[_0x3c85('0x33')]&&_0x2a0b00[_0x3c85('0x34')]){var _0x5a25ff={'recipient':[_0x226002[_0x3c85('0x24')]],'message':_0x226002[_0x3c85('0xf')],'message_type':_0x2a0b00[_0x3c85('0x35')]};if(_0x2a0b00[_0x3c85('0x35')]&&_0x2a0b00['smsMethod']!=='SI'){_0x5a25ff[_0x3c85('0x36')]=_0x2a0b00[_0x3c85('0x24')];}var _0x2aee94={'url':_0x50e5a3+'login?username='+_0x2a0b00[_0x3c85('0x33')]+_0x3c85('0x37')+_0x2a0b00[_0x3c85('0x34')],'method':_0x3c85('0x38')};rp(_0x2aee94)['then'](function(_0x1d0ee1){var _0x495d9c=_0x1d0ee1[_0x3c85('0x39')](';');var _0x4792a6={'user_key':_0x495d9c[0x0],'session_key':_0x495d9c[0x1]};_0x2aee94={'url':_0x50e5a3+_0x3c85('0x3a'),'method':_0x3c85('0x3b'),'headers':{'user_key':_0x4792a6[_0x3c85('0x3c')],'Session_key':_0x4792a6[_0x3c85('0x3d')]},'json':!![],'body':_0x5a25ff};return rp(_0x2aee94);})[_0x3c85('0x1a')](function(_0xfd0339){if(_0xfd0339['total_sent']>=0x1){var _0x361249={'messageId':_0xfd0339['internal_order_id']};if(_0x2a0b00[_0x3c85('0x35')]!=='GP'||!_0x2a0b00[_0x3c85('0x3e')]){_0x361249['read']=!![];}return _0x178736['update'](_0x361249);}else{return logger[_0x3c85('0x1e')](_0x3c85('0x2d'),_0x3c85('0x2e'),_0x3c85('0x31'),util['inspect'](_0xfd0339,{'showHidden':![],'depth':null}));}})[_0x3c85('0x1d')](function(_0x2105a4){return logger[_0x3c85('0x1e')](_0x3c85('0x2d'),'afterCreate',_0x3c85('0x31'),util[_0x3c85('0x2f')](_0x2105a4,{'showHidden':![],'depth':null}));});}else{logger[_0x3c85('0x1e')](_0x3c85('0x2d'),_0x3c85('0x2e'),_0x3c85('0x31'),_0x3c85('0x3f'));}break;case _0x3c85('0x40'):if(_0x2a0b00[_0x3c85('0x26')]){var _0x4e541b={'recipient':_0x226002['phone'],'message':_0x226002[_0x3c85('0xf')],'sender':_0x2a0b00['senderString']||_0x2a0b00[_0x3c85('0x24')],'authorization':_0x2a0b00['authToken']};var _0x27d33a={'method':_0x3c85('0x3b'),'uri':_0x3c85('0x41'),'body':_0x4e541b,'json':!![]};rp(_0x27d33a)[_0x3c85('0x1a')](function(_0x5c8168){var _0x30abf6={'messageId':_0x5c8168[_0x3c85('0x42')]};if(!_0x2a0b00['deliveryReport']){_0x30abf6[_0x3c85('0x43')]=!![];}return _0x178736['update'](_0x30abf6);})[_0x3c85('0x1d')](function(_0x42fca8){logger['error'](_0x3c85('0x2d'),'afterCreate',_0x3c85('0x40'),util[_0x3c85('0x2f')](_0x42fca8,{'showHidden':![],'depth':null}));});}else{logger[_0x3c85('0x1e')](_0x3c85('0x2d'),_0x3c85('0x2e'),'connectel','Missing\x20parameters:\x20authToken');}break;case _0x3c85('0x44'):if(_0x2a0b00['username']&&_0x2a0b00[_0x3c85('0x34')]){var _0x4e541b={'messages':[{'source':_0x3c85('0x45'),'to':_0x226002[_0x3c85('0x24')],'body':_0x226002[_0x3c85('0xf')],'from':_0x2a0b00[_0x3c85('0x46')]||_0x2a0b00['phone']}]};var _0x15a703=util[_0x3c85('0x47')]('%s:%s',_0x2a0b00[_0x3c85('0x33')],_0x2a0b00['password']);var _0x27d33a={'method':_0x3c85('0x3b'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x4e541b,'headers':{'Authorization':util[_0x3c85('0x47')](_0x3c85('0x48'),new Buffer(_0x15a703)[_0x3c85('0x49')](_0x3c85('0x4a')))},'json':!![]};rp(_0x27d33a)['then'](function(_0x5c3ca7){if(_0x5c3ca7[_0x3c85('0x4b')]>=0xc8&&_0x5c3ca7[_0x3c85('0x4b')]<=0xce){if(_0x5c3ca7['data']&&_0x5c3ca7[_0x3c85('0x4c')]['queued_count']>0x0){var _0x1f2833=_[_0x3c85('0x4d')](_0x5c3ca7[_0x3c85('0x4c')]['messages']);var _0x4c0031={'messageId':_0x1f2833['message_id']};if(!_0x2a0b00[_0x3c85('0x3e')]){_0x4c0031[_0x3c85('0x43')]=!![];}return _0x178736['update'](_0x4c0031);}else{logger[_0x3c85('0x1e')](_0x3c85('0x2d'),_0x3c85('0x2e'),_0x3c85('0x4e'),util[_0x3c85('0x2f')](_0x5c3ca7,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x3c85('0x2d'),_0x3c85('0x2e'),_0x3c85('0x4e'),util[_0x3c85('0x2f')](_0x5c3ca7,{'showHidden':![],'depth':null}));}})[_0x3c85('0x1d')](function(_0x60ba11){logger[_0x3c85('0x1e')](_0x3c85('0x2d'),_0x3c85('0x2e'),_0x3c85('0x4e'),util[_0x3c85('0x2f')](_0x60ba11,{'showHidden':![],'depth':null}));});}else{logger[_0x3c85('0x1e')](_0x3c85('0x2d'),'afterCreate','clickSend',_0x3c85('0x3f'));}break;case _0x3c85('0x4f'):if(_0x2a0b00['authId']&&_0x2a0b00[_0x3c85('0x26')]){var _0x4e541b={'dst':_0x226002['phone'],'text':_0x226002['body'],'src':_0x2a0b00[_0x3c85('0x46')]||_0x2a0b00['phone'],'url':_0x2a0b00['remote']+_0x3c85('0x2a')+_0x226002['id']+_0x3c85('0x50')+_0x2a0b00['token']};var _0x15a703=util[_0x3c85('0x47')](_0x3c85('0x51'),_0x2a0b00[_0x3c85('0x52')],_0x2a0b00[_0x3c85('0x26')]);var _0x27d33a={'method':_0x3c85('0x3b'),'uri':util[_0x3c85('0x47')](_0x3c85('0x53'),_0x2a0b00[_0x3c85('0x52')]),'body':_0x4e541b,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x15a703)[_0x3c85('0x49')]('base64'))},'json':!![]};rp(_0x27d33a)[_0x3c85('0x1a')](function(_0x47c4ae){var _0x5f094f={'messageId':_0x47c4ae[_0x3c85('0x54')][0x0]};return _0x178736['update'](_0x5f094f);})['catch'](function(_0x54aaaa){logger[_0x3c85('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3c85('0x2e'),'plivo',util[_0x3c85('0x2f')](_0x54aaaa,{'showHidden':![],'depth':null}));});}else{logger[_0x3c85('0x1e')](_0x3c85('0x2d'),_0x3c85('0x2e'),_0x3c85('0x4f'),_0x3c85('0x55'));}break;case _0x3c85('0x56'):if(_0x2a0b00['username']&&_0x2a0b00[_0x3c85('0x34')]){if(_0x2a0b00['baseUrl']){var _0xd30429={'method':'POST','uri':_0x2a0b00[_0x3c85('0x57')]+_0x3c85('0x58'),'body':{'username':_0x2a0b00[_0x3c85('0x33')],'password':_0x2a0b00[_0x3c85('0x34')]},'json':!![]};return rp(_0xd30429)[_0x3c85('0x1a')](function(_0x37e753){var _0x2d28d5={'method':_0x3c85('0x3b'),'uri':_0x2a0b00[_0x3c85('0x57')]+_0x3c85('0x59'),'body':{'messages':[{'from':_0x2a0b00[_0x3c85('0x24')],'destinations':[{'to':_0x226002['phone']}],'text':_0x226002[_0x3c85('0xf')],'notifyUrl':_0x2a0b00['remote']+_0x3c85('0x2a')+_0x226002['id']+_0x3c85('0x50')+_0x2a0b00[_0x3c85('0x2b')],'notifyContentType':_0x3c85('0x5a'),'callbackData':_0x2a0b00[_0x3c85('0x24')]+';'+_0x226002[_0x3c85('0xf')]}]},'headers':{'Authorization':_0x3c85('0x5b')+_0x37e753[_0x3c85('0x2b')]},'json':!![]};return rp(_0x2d28d5)[_0x3c85('0x1a')](function(_0x40b8a7){if(_0x40b8a7['messages']){var _0x4f24c8={'messageId':_0x40b8a7[_0x3c85('0x27')][0x0][_0x3c85('0xd')]};if(!_0x2a0b00['deliveryReport']){_0x4f24c8[_0x3c85('0x43')]=!![];}return _0x178736[_0x3c85('0x1b')](_0x4f24c8);}else{return logger['error'](_0x3c85('0x2d'),_0x3c85('0x2e'),_0x3c85('0x56'),util['inspect'](_0x40b8a7,{'showHidden':![],'depth':null}));}});})[_0x3c85('0x1d')](function(_0x2b3fe9){return logger['error'](_0x3c85('0x2d'),'afterCreate',_0x3c85('0x56'),util[_0x3c85('0x2f')](_0x2b3fe9,{'showHidden':![],'depth':null}));});}else{logger[_0x3c85('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3c85('0x2e'),'infobip',_0x3c85('0x5c'));}}else{logger[_0x3c85('0x1e')](_0x3c85('0x2d'),_0x3c85('0x2e'),_0x3c85('0x56'),_0x3c85('0x3f'));}break;case _0x3c85('0x5d'):var _0x28dad3=require(_0x3c85('0x5e'));if(_0x2a0b00[_0x3c85('0x5f')]){var _0x40cd19={};_0x40cd19[_0x3c85('0x60')]=_0x2a0b00[_0x3c85('0x33')];_0x40cd19[_0x3c85('0x24')]=_0x226002[_0x3c85('0x24')];_0x40cd19[_0x3c85('0x36')]=_0x2a0b00[_0x3c85('0x24')];_0x40cd19['text']=_0x226002[_0x3c85('0xf')];_0x40cd19[_0x3c85('0x61')]=+new Date();var _0x11f174='';var _0x3e866f='';var _0x115585=Object[_0x3c85('0x62')](_0x40cd19);_0x115585[_0x3c85('0x63')]();for(var _0x5635f0=0x0;_0x5635f0<_0x115585[_0x3c85('0x64')];_0x5635f0++){if(_0x11f174!=''){_0x11f174+='&';}_0x11f174+=_0x115585[_0x5635f0]+'='+encodeURIComponent(_0x40cd19[_0x115585[_0x5635f0]]);_0x3e866f+=_0x40cd19[_0x115585[_0x5635f0]];}_0x3e866f+=_0x2a0b00[_0x3c85('0x5f')];_0x3e866f=_0x28dad3[_0x3c85('0x65')](_0x3c85('0x66'))[_0x3c85('0x1b')](_0x3e866f)[_0x3c85('0x67')](_0x3c85('0x68'));if(_0x11f174!==''){_0x11f174+='&';}_0x11f174+=_0x3c85('0x69')+_0x3e866f;var _0x2aee94={'method':_0x3c85('0x38'),'uri':_0x2a0b00[_0x3c85('0x57')]+'/external/get/send.php?'+_0x11f174,'json':!![]};return rp(_0x2aee94)[_0x3c85('0x1a')](function(_0x53ed17){var _0x480f04=Object[_0x3c85('0x62')](_0x53ed17);if(_0x53ed17[_0x480f04[0x0]][_0x3c85('0x1e')]&&parseInt(_0x53ed17[_0x480f04[0x0]][_0x3c85('0x1e')])===0x0){var _0x2c5550={'messageId':_0x53ed17[_0x480f04[0x0]]['id_sms']};if(!_0x2a0b00['deliveryReport']){_0x2c5550[_0x3c85('0x43')]=!![];}return _0x178736[_0x3c85('0x1b')](_0x2c5550);}else{return logger[_0x3c85('0x1e')](_0x3c85('0x2d'),'afterCreate','csc',util[_0x3c85('0x2f')](_0x53ed17['error'],{'showHidden':![],'depth':null}));}})[_0x3c85('0x1d')](function(_0x23db97){return logger[_0x3c85('0x1e')](_0x3c85('0x2d'),_0x3c85('0x2e'),_0x3c85('0x5d'),util['inspect'](_0x23db97,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3c85('0x2e'),_0x3c85('0x5d'),_0x3c85('0x6a'));}break;case _0x3c85('0x6b'):if(_0x2a0b00[_0x3c85('0x5f')]){var _0x5b027a={'method':_0x3c85('0x3b'),'uri':_0x3c85('0x6c'),'headers':{'Authorization':_0x2a0b00['apiKey']},'body':{'content':_0x226002['body'],'to':[_0x226002['phone']],'from':_0x2a0b00[_0x3c85('0x24')],'binary':![],'clientMessageId':_0x3c85('0x6d'),'charset':_0x3c85('0x6e')},'json':!![]};rp(_0x5b027a)[_0x3c85('0x1a')](function(_0x52622d){if(!_0x52622d[_0x3c85('0x1e')]){var _0x336c2a={'messageId':_0x52622d[_0x3c85('0x27')][0x0][_0x3c85('0x6f')]};if(!_0x2a0b00['deliveryReport']){_0x336c2a[_0x3c85('0x43')]=!![];}return _0x178736[_0x3c85('0x1b')](_0x336c2a);}else{return logger[_0x3c85('0x1e')](_0x3c85('0x2d'),'afterCreate',_0x3c85('0x6b'),util[_0x3c85('0x2f')](_0x52622d[_0x3c85('0x1e')],{'showHidden':![],'depth':null}));}})[_0x3c85('0x1d')](function(_0x2b7bf8){return logger[_0x3c85('0x1e')](_0x3c85('0x2d'),_0x3c85('0x2e'),_0x3c85('0x6b'),util[_0x3c85('0x2f')](_0x2b7bf8,{'showHidden':![],'depth':null}));});}else{logger[_0x3c85('0x1e')](_0x3c85('0x2d'),_0x3c85('0x2e'),_0x3c85('0x6b'),_0x3c85('0x6a'));}break;case'bandwidth':if(_0x2a0b00[_0x3c85('0x33')]&&_0x2a0b00['password']){var _0x15a703=util['format'](_0x3c85('0x51'),_0x2a0b00[_0x3c85('0x33')],_0x2a0b00['password']);var _0x27d33a={'method':_0x3c85('0x3b'),'uri':_0x3c85('0x70')+_0x2a0b00['accountId']+_0x3c85('0x71'),'body':{'to':[_0x226002[_0x3c85('0x24')]],'text':_0x226002[_0x3c85('0xf')],'from':_0x2a0b00[_0x3c85('0x24')],'applicationId':_0x2a0b00[_0x3c85('0x72')]},'headers':{'Authorization':util[_0x3c85('0x47')]('Basic\x20%s',new Buffer(_0x15a703)[_0x3c85('0x49')](_0x3c85('0x4a')))},'json':!![]};rp(_0x27d33a)[_0x3c85('0x1a')](function(_0x298288){if(_0x298288['id']){var _0x3f96c9={'messageId':_0x298288['id']};return _0x178736[_0x3c85('0x1b')](_0x3f96c9);}else{logger['error'](_0x3c85('0x2d'),'afterCreate','bandwidth',util[_0x3c85('0x2f')](_0x298288,{'showHidden':![],'depth':null}));}})['catch'](function(_0x17b347){logger[_0x3c85('0x1e')](_0x3c85('0x2d'),'afterCreate','bandwidth',util[_0x3c85('0x2f')](_0x17b347,{'showHidden':![],'depth':null}));});}else{logger[_0x3c85('0x1e')](_0x3c85('0x2d'),_0x3c85('0x2e'),_0x3c85('0x73'),_0x3c85('0x3f'));}break;case _0x3c85('0x74'):if(_0x2a0b00[_0x3c85('0x5f')]){var _0x13014d={};var _0x2aee94={'method':'POST','uri':_0x3c85('0x75'),'headers':{'Authorization':_0x3c85('0x76')+_0x2a0b00[_0x3c85('0x5f')],'Content-Type':_0x3c85('0x5a')},'body':{'from':_0x2a0b00[_0x3c85('0x24')],'to':_0x226002[_0x3c85('0x24')],'text':_0x226002[_0x3c85('0xf')]},'json':!![]};return rp(_0x2aee94)['then'](function(_0x4552bc){if(_0x4552bc['code']==0xca){_0x13014d[_0x3c85('0x77')]=_0x4552bc;var _0x2735b6={'method':_0x3c85('0x3b'),'uri':_0x3c85('0x78'),'headers':{'Authorization':_0x3c85('0x76')+_0x2a0b00[_0x3c85('0x5f')],'Content-Type':_0x3c85('0x5a')},'body':{'refid':_0x13014d[_0x3c85('0x77')][_0x3c85('0x79')]},'json':!![]};return rp(_0x2735b6)['then'](function(_0xe241a1){_0x13014d[_0x3c85('0x7a')]=_0xe241a1;var _0x3a9fdd={'messageId':_0x13014d[_0x3c85('0x77')][_0x3c85('0x79')],'read':!![]};return _0x178736[_0x3c85('0x1b')](_0x3a9fdd);});}else{return logger[_0x3c85('0x1e')](_0x3c85('0x2d'),'afterCreate','intelepeer',util[_0x3c85('0x2f')](_0x4552bc,{'showHidden':![],'depth':null}));}})['catch'](function(_0x12244f){return logger['error'](_0x3c85('0x2d'),_0x3c85('0x2e'),'intelepeer',util[_0x3c85('0x2f')](_0x12244f,{'showHidden':![],'depth':null}));});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3c85('0x2e'),_0x3c85('0x74'),_0x3c85('0x7b'));}break;}}})[_0x3c85('0x7c')](function(){_0x4911e4();});}else{_0x4911e4();}}},'charset':_0x3c85('0x7d'),'collate':_0x3c85('0x7e')});}; \ No newline at end of file +var _0x96b6=['requestid','deliveryReport','clicksend','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','queued_count','head','data','message_id','clickSend','plivo','authId','token','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','sender','text','timestamp','keys','sort','length','createHash','md5','hex','id_sms','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','clickatell','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','message','Bearer\x20','refid','status','intelepeer','finally','utf8mb4_unicode_ci','lodash','util','moment','request-promise','path','rimraf','./smsMessage.attributes','exports','sms_messages','messageId','FULLTEXT','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','findOne','then','update','error','SmsAccount','find','SmsAccountId','type','twilio','authToken','phone','accountSid','messages','create','body','remote','/api/sms/messages/','/status?token=','sid','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','login?username=','&password=','GET','split','POST','user_key','session_key','total_sent','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/'];(function(_0x1188a4,_0x42c6aa){var _0x50a640=function(_0x314316){while(--_0x314316){_0x1188a4['push'](_0x1188a4['shift']());}};_0x50a640(++_0x42c6aa);}(_0x96b6,0x129));var _0x696b=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x96b6[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x696b('0x0'));var util=require(_0x696b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x696b('0x2'));var BPromise=require('bluebird');var rp=require(_0x696b('0x3'));var fs=require('fs');var path=require(_0x696b('0x4'));var rimraf=require(_0x696b('0x5'));var config=require('../../config/environment');var attributes=require(_0x696b('0x6'));module[_0x696b('0x7')]=function(_0x45d00f,_0x2e1ed0){return _0x45d00f['define']('SmsMessage',attributes,{'tableName':_0x696b('0x8'),'paranoid':![],'indexes':[{'name':_0x696b('0x9'),'fields':['messageId']},{'name':'fti_sms_messages','fields':['body'],'type':_0x696b('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x572549,_0x44d6e5,_0x1703cb){var _0x393e19=_0x45d00f['models'];var _0x2d4694=_0x572549['get']({'plain':!![]});if(_0x2d4694[_0x696b('0xb')][_0x696b('0xc')]()==='in'||_0x2d4694[_0x696b('0xb')][_0x696b('0xc')]()===_0x696b('0xd')&&!_0x2d4694[_0x696b('0xe')]&&!_[_0x696b('0xf')](_0x2d4694[_0x696b('0x10')])&&!_[_0x696b('0xf')](_0x2d4694['SmsInteractionId'])){_0x393e19[_0x696b('0x11')][_0x696b('0x12')]({'where':{'id':_0x2d4694['SmsInteractionId']}})[_0x696b('0x13')](function(_0x24f3e3){if(_0x24f3e3){_0x24f3e3[_0x696b('0x14')]({'lastMsgAt':_0x2d4694['createdAt'],'lastMsgDirection':_0x2d4694[_0x696b('0xb')][_0x696b('0xc')]()});}})['catch'](function(_0x50419d){console[_0x696b('0x15')](_0x50419d);});}if(_0x2d4694['direction']===_0x696b('0xd')&&!_0x2d4694[_0x696b('0xe')]){var _0x49a0d6;_0x393e19[_0x696b('0x16')][_0x696b('0x17')]({'where':{'id':_0x2d4694[_0x696b('0x18')]},'raw':!![]})['then'](function(_0x1aa074){_0x49a0d6=_0x1aa074;if(_0x49a0d6&&_0x49a0d6['type']){switch(_0x49a0d6[_0x696b('0x19')]){case _0x696b('0x1a'):var _0x34a1ad=require(_0x696b('0x1a'));if(_0x49a0d6['accountSid']&&_0x49a0d6[_0x696b('0x1b')]&&_0x49a0d6[_0x696b('0x1c')]){var _0x2eb07b=new _0x34a1ad(_0x49a0d6[_0x696b('0x1d')],_0x49a0d6[_0x696b('0x1b')]);_0x2eb07b[_0x696b('0x1e')][_0x696b('0x1f')]({'body':_0x2d4694[_0x696b('0x20')],'to':_0x2d4694[_0x696b('0x1c')],'from':_0x49a0d6[_0x696b('0x1c')],'statusCallback':_0x49a0d6[_0x696b('0x21')]+_0x696b('0x22')+_0x2d4694['id']+_0x696b('0x23')+_0x49a0d6['token']})[_0x696b('0x13')](function(_0x1695c3){if(_0x1695c3['sid']){return _0x572549[_0x696b('0x14')]({'messageId':_0x1695c3[_0x696b('0x24')]});}})[_0x696b('0x25')](function(_0x478525){logger['error'](_0x696b('0x26'),_0x696b('0x27'),'twilio',util[_0x696b('0x28')](_0x478525,{'showHidden':![],'depth':null}));});}else{logger[_0x696b('0x15')](_0x696b('0x26'),_0x696b('0x27'),'twilio',_0x696b('0x29'));}break;case _0x696b('0x2a'):var _0x467f5e=_0x696b('0x2b');if(_0x49a0d6[_0x696b('0x2c')]&&_0x49a0d6[_0x696b('0x2d')]){var _0x5bacb0={'recipient':[_0x2d4694[_0x696b('0x1c')]],'message':_0x2d4694[_0x696b('0x20')],'message_type':_0x49a0d6[_0x696b('0x2e')]};if(_0x49a0d6[_0x696b('0x2e')]&&_0x49a0d6[_0x696b('0x2e')]!=='SI'){_0x5bacb0['sender']=_0x49a0d6[_0x696b('0x1c')];}var _0x10c48f={'url':_0x467f5e+_0x696b('0x2f')+_0x49a0d6[_0x696b('0x2c')]+_0x696b('0x30')+_0x49a0d6[_0x696b('0x2d')],'method':_0x696b('0x31')};rp(_0x10c48f)[_0x696b('0x13')](function(_0x46bd36){var _0x48b11e=_0x46bd36[_0x696b('0x32')](';');var _0xc0fc51={'user_key':_0x48b11e[0x0],'session_key':_0x48b11e[0x1]};_0x10c48f={'url':_0x467f5e+'sms','method':_0x696b('0x33'),'headers':{'user_key':_0xc0fc51[_0x696b('0x34')],'Session_key':_0xc0fc51[_0x696b('0x35')]},'json':!![],'body':_0x5bacb0};return rp(_0x10c48f);})['then'](function(_0x3e7a28){if(_0x3e7a28[_0x696b('0x36')]>=0x1){var _0x541b92={'messageId':_0x3e7a28['internal_order_id']};if(_0x49a0d6['smsMethod']!=='GP'||!_0x49a0d6['deliveryReport']){_0x541b92[_0x696b('0x37')]=!![];}return _0x572549['update'](_0x541b92);}else{return logger[_0x696b('0x15')](_0x696b('0x26'),_0x696b('0x27'),_0x696b('0x2a'),util[_0x696b('0x28')](_0x3e7a28,{'showHidden':![],'depth':null}));}})['catch'](function(_0x32c3fc){return logger[_0x696b('0x15')](_0x696b('0x26'),'afterCreate','skebby',util['inspect'](_0x32c3fc,{'showHidden':![],'depth':null}));});}else{logger[_0x696b('0x15')](_0x696b('0x26'),_0x696b('0x27'),_0x696b('0x2a'),_0x696b('0x38'));}break;case _0x696b('0x39'):if(_0x49a0d6['authToken']){var _0x1b08fe={'recipient':_0x2d4694[_0x696b('0x1c')],'message':_0x2d4694['body'],'sender':_0x49a0d6[_0x696b('0x3a')]||_0x49a0d6[_0x696b('0x1c')],'authorization':_0x49a0d6[_0x696b('0x1b')]};var _0x44d6e5={'method':_0x696b('0x33'),'uri':_0x696b('0x3b'),'body':_0x1b08fe,'json':!![]};rp(_0x44d6e5)['then'](function(_0x310b63){var _0x4e6ca6={'messageId':_0x310b63[_0x696b('0x3c')]};if(!_0x49a0d6[_0x696b('0x3d')]){_0x4e6ca6[_0x696b('0x37')]=!![];}return _0x572549[_0x696b('0x14')](_0x4e6ca6);})['catch'](function(_0x273993){logger[_0x696b('0x15')](_0x696b('0x26'),_0x696b('0x27'),_0x696b('0x39'),util[_0x696b('0x28')](_0x273993,{'showHidden':![],'depth':null}));});}else{logger[_0x696b('0x15')](_0x696b('0x26'),_0x696b('0x27'),_0x696b('0x39'),'Missing\x20parameters:\x20authToken');}break;case _0x696b('0x3e'):if(_0x49a0d6['username']&&_0x49a0d6[_0x696b('0x2d')]){var _0x1b08fe={'messages':[{'source':'xCALLY\x20Motion','to':_0x2d4694[_0x696b('0x1c')],'body':_0x2d4694['body'],'from':_0x49a0d6[_0x696b('0x3a')]||_0x49a0d6[_0x696b('0x1c')]}]};var _0x540f5c=util[_0x696b('0x3f')](_0x696b('0x40'),_0x49a0d6[_0x696b('0x2c')],_0x49a0d6[_0x696b('0x2d')]);var _0x44d6e5={'method':'POST','uri':_0x696b('0x41'),'body':_0x1b08fe,'headers':{'Authorization':util[_0x696b('0x3f')](_0x696b('0x42'),new Buffer(_0x540f5c)[_0x696b('0x43')](_0x696b('0x44')))},'json':!![]};rp(_0x44d6e5)[_0x696b('0x13')](function(_0x53a2bd){if(_0x53a2bd[_0x696b('0x45')]>=0xc8&&_0x53a2bd['http_code']<=0xce){if(_0x53a2bd['data']&&_0x53a2bd['data'][_0x696b('0x46')]>0x0){var _0x4b9695=_[_0x696b('0x47')](_0x53a2bd[_0x696b('0x48')]['messages']);var _0x825d6a={'messageId':_0x4b9695[_0x696b('0x49')]};if(!_0x49a0d6['deliveryReport']){_0x825d6a[_0x696b('0x37')]=!![];}return _0x572549[_0x696b('0x14')](_0x825d6a);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x696b('0x27'),_0x696b('0x4a'),util['inspect'](_0x53a2bd,{'showHidden':![],'depth':null}));}}else{logger[_0x696b('0x15')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x696b('0x27'),_0x696b('0x4a'),util[_0x696b('0x28')](_0x53a2bd,{'showHidden':![],'depth':null}));}})[_0x696b('0x25')](function(_0x763693){logger[_0x696b('0x15')](_0x696b('0x26'),_0x696b('0x27'),_0x696b('0x4a'),util['inspect'](_0x763693,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x696b('0x26'),'afterCreate','clickSend','Missing\x20parameters:\x20username,\x20password');}break;case _0x696b('0x4b'):if(_0x49a0d6[_0x696b('0x4c')]&&_0x49a0d6[_0x696b('0x1b')]){var _0x1b08fe={'dst':_0x2d4694[_0x696b('0x1c')],'text':_0x2d4694[_0x696b('0x20')],'src':_0x49a0d6['senderString']||_0x49a0d6[_0x696b('0x1c')],'url':_0x49a0d6[_0x696b('0x21')]+_0x696b('0x22')+_0x2d4694['id']+_0x696b('0x23')+_0x49a0d6[_0x696b('0x4d')]};var _0x540f5c=util[_0x696b('0x3f')](_0x696b('0x40'),_0x49a0d6['authId'],_0x49a0d6['authToken']);var _0x44d6e5={'method':_0x696b('0x33'),'uri':util[_0x696b('0x3f')](_0x696b('0x4e'),_0x49a0d6[_0x696b('0x4c')]),'body':_0x1b08fe,'headers':{'Authorization':util[_0x696b('0x3f')](_0x696b('0x42'),new Buffer(_0x540f5c)[_0x696b('0x43')](_0x696b('0x44')))},'json':!![]};rp(_0x44d6e5)[_0x696b('0x13')](function(_0x4ded02){var _0x15d6ff={'messageId':_0x4ded02[_0x696b('0x4f')][0x0]};return _0x572549['update'](_0x15d6ff);})[_0x696b('0x25')](function(_0x3f7d69){logger['error'](_0x696b('0x26'),_0x696b('0x27'),_0x696b('0x4b'),util['inspect'](_0x3f7d69,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x696b('0x26'),_0x696b('0x27'),_0x696b('0x4b'),_0x696b('0x50'));}break;case'infobip':if(_0x49a0d6[_0x696b('0x2c')]&&_0x49a0d6[_0x696b('0x2d')]){if(_0x49a0d6[_0x696b('0x51')]){var _0x5d72c4={'method':_0x696b('0x33'),'uri':_0x49a0d6[_0x696b('0x51')]+'/auth/1/session','body':{'username':_0x49a0d6['username'],'password':_0x49a0d6[_0x696b('0x2d')]},'json':!![]};return rp(_0x5d72c4)[_0x696b('0x13')](function(_0x3a236c){var _0x2ed6de={'method':_0x696b('0x33'),'uri':_0x49a0d6['baseUrl']+_0x696b('0x52'),'body':{'messages':[{'from':_0x49a0d6[_0x696b('0x1c')],'destinations':[{'to':_0x2d4694[_0x696b('0x1c')]}],'text':_0x2d4694[_0x696b('0x20')],'notifyUrl':_0x49a0d6[_0x696b('0x21')]+'/api/sms/messages/'+_0x2d4694['id']+_0x696b('0x23')+_0x49a0d6[_0x696b('0x4d')],'notifyContentType':_0x696b('0x53'),'callbackData':_0x49a0d6[_0x696b('0x1c')]+';'+_0x2d4694[_0x696b('0x20')]}]},'headers':{'Authorization':_0x696b('0x54')+_0x3a236c[_0x696b('0x4d')]},'json':!![]};return rp(_0x2ed6de)[_0x696b('0x13')](function(_0xb43db4){if(_0xb43db4[_0x696b('0x1e')]){var _0x164b09={'messageId':_0xb43db4[_0x696b('0x1e')][0x0][_0x696b('0x9')]};if(!_0x49a0d6[_0x696b('0x3d')]){_0x164b09[_0x696b('0x37')]=!![];}return _0x572549[_0x696b('0x14')](_0x164b09);}else{return logger[_0x696b('0x15')](_0x696b('0x26'),'afterCreate','infobip',util[_0x696b('0x28')](_0xb43db4,{'showHidden':![],'depth':null}));}});})[_0x696b('0x25')](function(_0x46cf52){return logger[_0x696b('0x15')](_0x696b('0x26'),'afterCreate',_0x696b('0x55'),util[_0x696b('0x28')](_0x46cf52,{'showHidden':![],'depth':null}));});}else{logger[_0x696b('0x15')](_0x696b('0x26'),_0x696b('0x27'),'infobip',_0x696b('0x56'));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','infobip',_0x696b('0x38'));}break;case _0x696b('0x57'):var _0x478e70=require(_0x696b('0x58'));if(_0x49a0d6[_0x696b('0x59')]){var _0x53a87f={};_0x53a87f[_0x696b('0x5a')]=_0x49a0d6[_0x696b('0x2c')];_0x53a87f[_0x696b('0x1c')]=_0x2d4694[_0x696b('0x1c')];_0x53a87f[_0x696b('0x5b')]=_0x49a0d6['phone'];_0x53a87f[_0x696b('0x5c')]=_0x2d4694[_0x696b('0x20')];_0x53a87f[_0x696b('0x5d')]=+new Date();var _0x201498='';var _0x2f2352='';var _0x9d208=Object[_0x696b('0x5e')](_0x53a87f);_0x9d208[_0x696b('0x5f')]();for(var _0x228953=0x0;_0x228953<_0x9d208[_0x696b('0x60')];_0x228953++){if(_0x201498!=''){_0x201498+='&';}_0x201498+=_0x9d208[_0x228953]+'='+encodeURIComponent(_0x53a87f[_0x9d208[_0x228953]]);_0x2f2352+=_0x53a87f[_0x9d208[_0x228953]];}_0x2f2352+=_0x49a0d6[_0x696b('0x59')];_0x2f2352=_0x478e70[_0x696b('0x61')](_0x696b('0x62'))[_0x696b('0x14')](_0x2f2352)['digest'](_0x696b('0x63'));if(_0x201498!==''){_0x201498+='&';}_0x201498+='signature='+_0x2f2352;var _0x10c48f={'method':_0x696b('0x31'),'uri':_0x49a0d6[_0x696b('0x51')]+'/external/get/send.php?'+_0x201498,'json':!![]};return rp(_0x10c48f)[_0x696b('0x13')](function(_0x27c9d8){var _0x25cb3c=Object['keys'](_0x27c9d8);if(_0x27c9d8[_0x25cb3c[0x0]][_0x696b('0x15')]&&parseInt(_0x27c9d8[_0x25cb3c[0x0]][_0x696b('0x15')])===0x0){var _0x2fd023={'messageId':_0x27c9d8[_0x25cb3c[0x0]][_0x696b('0x64')]};if(!_0x49a0d6[_0x696b('0x3d')]){_0x2fd023['read']=!![];}return _0x572549[_0x696b('0x14')](_0x2fd023);}else{return logger[_0x696b('0x15')](_0x696b('0x26'),_0x696b('0x27'),_0x696b('0x57'),util[_0x696b('0x28')](_0x27c9d8[_0x696b('0x15')],{'showHidden':![],'depth':null}));}})[_0x696b('0x25')](function(_0x3fbfc0){return logger[_0x696b('0x15')](_0x696b('0x26'),_0x696b('0x27'),_0x696b('0x57'),util[_0x696b('0x28')](_0x3fbfc0,{'showHidden':![],'depth':null}));});}else{logger[_0x696b('0x15')](_0x696b('0x26'),_0x696b('0x27'),'csc',_0x696b('0x65'));}break;case'clickatell':if(_0x49a0d6[_0x696b('0x59')]){var _0x521e26={'method':_0x696b('0x33'),'uri':_0x696b('0x66'),'headers':{'Authorization':_0x49a0d6['apiKey']},'body':{'content':_0x2d4694[_0x696b('0x20')],'to':[_0x2d4694[_0x696b('0x1c')]],'from':_0x49a0d6[_0x696b('0x1c')],'binary':![],'clientMessageId':_0x696b('0x67'),'charset':_0x696b('0x68')},'json':!![]};rp(_0x521e26)[_0x696b('0x13')](function(_0x3f8093){if(!_0x3f8093[_0x696b('0x15')]){var _0x34df9d={'messageId':_0x3f8093[_0x696b('0x1e')][0x0][_0x696b('0x69')]};if(!_0x49a0d6[_0x696b('0x3d')]){_0x34df9d[_0x696b('0x37')]=!![];}return _0x572549[_0x696b('0x14')](_0x34df9d);}else{return logger[_0x696b('0x15')](_0x696b('0x26'),'afterCreate',_0x696b('0x6a'),util[_0x696b('0x28')](_0x3f8093[_0x696b('0x15')],{'showHidden':![],'depth':null}));}})[_0x696b('0x25')](function(_0x517917){return logger[_0x696b('0x15')](_0x696b('0x26'),'afterCreate',_0x696b('0x6a'),util[_0x696b('0x28')](_0x517917,{'showHidden':![],'depth':null}));});}else{logger[_0x696b('0x15')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x696b('0x27'),_0x696b('0x6a'),'Missing\x20parameters:\x20apiKey');}break;case _0x696b('0x6b'):if(_0x49a0d6[_0x696b('0x2c')]&&_0x49a0d6['password']){var _0x540f5c=util[_0x696b('0x3f')]('%s:%s',_0x49a0d6[_0x696b('0x2c')],_0x49a0d6[_0x696b('0x2d')]);var _0x44d6e5={'method':_0x696b('0x33'),'uri':_0x696b('0x6c')+_0x49a0d6[_0x696b('0x6d')]+_0x696b('0x6e'),'body':{'to':[_0x2d4694[_0x696b('0x1c')]],'text':_0x2d4694[_0x696b('0x20')],'from':_0x49a0d6[_0x696b('0x1c')],'applicationId':_0x49a0d6[_0x696b('0x6f')]},'headers':{'Authorization':util[_0x696b('0x3f')](_0x696b('0x42'),new Buffer(_0x540f5c)[_0x696b('0x43')](_0x696b('0x44')))},'json':!![]};rp(_0x44d6e5)['then'](function(_0x54b33c){if(_0x54b33c['id']){var _0x2e9f2f={'messageId':_0x54b33c['id']};return _0x572549[_0x696b('0x14')](_0x2e9f2f);}else{logger[_0x696b('0x15')](_0x696b('0x26'),'afterCreate',_0x696b('0x6b'),util[_0x696b('0x28')](_0x54b33c,{'showHidden':![],'depth':null}));}})[_0x696b('0x25')](function(_0x4ff21e){logger[_0x696b('0x15')](_0x696b('0x26'),_0x696b('0x27'),'bandwidth',util[_0x696b('0x28')](_0x4ff21e,{'showHidden':![],'depth':null}));});}else{logger[_0x696b('0x15')](_0x696b('0x26'),'afterCreate',_0x696b('0x6b'),_0x696b('0x38'));}break;case'intelepeer':if(_0x49a0d6[_0x696b('0x59')]){var _0x1f5330={};var _0x10c48f={'method':_0x696b('0x33'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':'Bearer\x20'+_0x49a0d6[_0x696b('0x59')],'Content-Type':_0x696b('0x53')},'body':{'from':_0x49a0d6[_0x696b('0x1c')],'to':_0x2d4694[_0x696b('0x1c')],'text':_0x2d4694['body']},'json':!![]};return rp(_0x10c48f)['then'](function(_0x402943){if(_0x402943['code']==0xca){_0x1f5330[_0x696b('0x70')]=_0x402943;var _0x296854={'method':_0x696b('0x33'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x696b('0x71')+_0x49a0d6[_0x696b('0x59')],'Content-Type':_0x696b('0x53')},'body':{'refid':_0x1f5330[_0x696b('0x70')][_0x696b('0x72')]},'json':!![]};return rp(_0x296854)[_0x696b('0x13')](function(_0x4db1bc){_0x1f5330[_0x696b('0x73')]=_0x4db1bc;var _0x41ce59={'messageId':_0x1f5330[_0x696b('0x70')][_0x696b('0x72')],'read':!![]};return _0x572549[_0x696b('0x14')](_0x41ce59);});}else{return logger[_0x696b('0x15')](_0x696b('0x26'),'afterCreate','intelepeer',util[_0x696b('0x28')](_0x402943,{'showHidden':![],'depth':null}));}})[_0x696b('0x25')](function(_0x30265d){return logger[_0x696b('0x15')](_0x696b('0x26'),_0x696b('0x27'),_0x696b('0x74'),util[_0x696b('0x28')](_0x30265d,{'showHidden':![],'depth':null}));});}else{return logger[_0x696b('0x15')](_0x696b('0x26'),_0x696b('0x27'),_0x696b('0x74'),'Token\x20not\x20received');}break;}}})[_0x696b('0x75')](function(){_0x1703cb();});}else{_0x1703cb();}}},'charset':'utf8mb4','collate':_0x696b('0x76')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 213fde2..552ddb4 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 _0xecca=['CreateSmsMessage','SmsMessage','create','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','request','then','info','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SmsMessage,\x20%s,\x20%s','catch'];(function(_0x297d70,_0x39c7a6){var _0x5ada9e=function(_0x23b8c0){while(--_0x23b8c0){_0x297d70['push'](_0x297d70['shift']());}};_0x5ada9e(++_0x39c7a6);}(_0xecca,0x6f));var _0xaecc=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xecca[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xaecc('0x0'));var util=require('util');var moment=require(_0xaecc('0x1'));var BPromise=require(_0xaecc('0x2'));var rs=require(_0xaecc('0x3'));var fs=require('fs');var Redis=require(_0xaecc('0x4'));var db=require(_0xaecc('0x5'))['db'];var utils=require(_0xaecc('0x6'));var logger=require('../../config/logger')(_0xaecc('0x7'));var config=require(_0xaecc('0x8'));var jayson=require(_0xaecc('0x9'));var client=jayson[_0xaecc('0xa')][_0xaecc('0xb')]({'port':0x232a});config[_0xaecc('0xc')]=_[_0xaecc('0xd')](config['redis'],{'host':_0xaecc('0xe'),'port':0x18eb});var socket=require(_0xaecc('0xf'))(new Redis(config['redis']));require(_0xaecc('0x10'))['register'](socket);function respondWithRpcPromise(_0x3925a4,_0x169817,_0x3cf2a5){return new BPromise(function(_0x2c7ab3,_0x278f86){return client[_0xaecc('0x11')](_0x3925a4,_0x3cf2a5)[_0xaecc('0x12')](function(_0x44fe54){logger[_0xaecc('0x13')]('SmsMessage,\x20%s,\x20%s',_0x169817,'request\x20sent');logger[_0xaecc('0x14')](_0xaecc('0x15'),_0x169817,_0xaecc('0x16'),JSON[_0xaecc('0x17')](_0x44fe54));if(_0x44fe54['error']){if(_0x44fe54[_0xaecc('0x18')][_0xaecc('0x19')]===0x1f4){logger[_0xaecc('0x18')]('SmsMessage,\x20%s,\x20%s',_0x169817,_0x44fe54[_0xaecc('0x18')][_0xaecc('0x1a')]);return _0x278f86(_0x44fe54[_0xaecc('0x18')]['message']);}logger[_0xaecc('0x18')](_0xaecc('0x1b'),_0x169817,_0x44fe54['error'][_0xaecc('0x1a')]);return _0x2c7ab3(_0x44fe54['error'][_0xaecc('0x1a')]);}else{logger['info'](_0xaecc('0x1b'),_0x169817,_0xaecc('0x16'));_0x2c7ab3(_0x44fe54['result'][_0xaecc('0x1a')]);}})[_0xaecc('0x1c')](function(_0x3cda48){logger[_0xaecc('0x18')](_0xaecc('0x1b'),_0x169817,_0x3cda48);_0x278f86(_0x3cda48);});});}exports[_0xaecc('0x1d')]=function(_0x4545ee){var _0x3834d5=this;return new Promise(function(_0x2d8c39,_0x27026d){return db[_0xaecc('0x1e')][_0xaecc('0x1f')](_0x4545ee[_0xaecc('0x20')],{'raw':_0x4545ee[_0xaecc('0x21')]?_0x4545ee[_0xaecc('0x21')][_0xaecc('0x22')]===undefined?!![]:![]:!![]})[_0xaecc('0x12')](function(_0x6cb742){logger['info']('CreateSmsMessage',_0x4545ee);logger[_0xaecc('0x14')](_0xaecc('0x1d'),_0x4545ee,JSON['stringify'](_0x6cb742));_0x2d8c39(_0x6cb742);})['catch'](function(_0x15a906){logger[_0xaecc('0x18')](_0xaecc('0x1d'),_0x15a906[_0xaecc('0x1a')],_0x4545ee);_0x27026d(_0x3834d5['error'](0x1f4,_0x15a906[_0xaecc('0x1a')]));});});}; \ No newline at end of file +var _0x3fd7=['catch','SmsMessage','body','options','raw','CreateSmsMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','./smsMessage.socket','register','request','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3fd7,0x6c));var _0x73fd=function(_0x54f36e,_0x4e2f98){_0x54f36e=_0x54f36e-0x0;var _0x4c1d8e=_0x3fd7[_0x54f36e];return _0x4c1d8e;};'use strict';var _=require(_0x73fd('0x0'));var util=require(_0x73fd('0x1'));var moment=require(_0x73fd('0x2'));var BPromise=require(_0x73fd('0x3'));var rs=require(_0x73fd('0x4'));var fs=require('fs');var Redis=require(_0x73fd('0x5'));var db=require(_0x73fd('0x6'))['db'];var utils=require(_0x73fd('0x7'));var logger=require(_0x73fd('0x8'))(_0x73fd('0x9'));var config=require(_0x73fd('0xa'));var jayson=require(_0x73fd('0xb'));var client=jayson['client']['http']({'port':0x232a});config[_0x73fd('0xc')]=_[_0x73fd('0xd')](config[_0x73fd('0xc')],{'host':_0x73fd('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x73fd('0xf'))[_0x73fd('0x10')](socket);function respondWithRpcPromise(_0x2b1948,_0x2cc1ee,_0x4b1a85){return new BPromise(function(_0x512d91,_0x2c1471){return client[_0x73fd('0x11')](_0x2b1948,_0x4b1a85)[_0x73fd('0x12')](function(_0x592ef1){logger[_0x73fd('0x13')]('SmsMessage,\x20%s,\x20%s',_0x2cc1ee,_0x73fd('0x14'));logger[_0x73fd('0x15')](_0x73fd('0x16'),_0x2cc1ee,_0x73fd('0x14'),JSON[_0x73fd('0x17')](_0x592ef1));if(_0x592ef1[_0x73fd('0x18')]){if(_0x592ef1[_0x73fd('0x18')][_0x73fd('0x19')]===0x1f4){logger[_0x73fd('0x18')](_0x73fd('0x1a'),_0x2cc1ee,_0x592ef1[_0x73fd('0x18')][_0x73fd('0x1b')]);return _0x2c1471(_0x592ef1[_0x73fd('0x18')][_0x73fd('0x1b')]);}logger[_0x73fd('0x18')](_0x73fd('0x1a'),_0x2cc1ee,_0x592ef1[_0x73fd('0x18')][_0x73fd('0x1b')]);return _0x512d91(_0x592ef1[_0x73fd('0x18')][_0x73fd('0x1b')]);}else{logger['info'](_0x73fd('0x1a'),_0x2cc1ee,'request\x20sent');_0x512d91(_0x592ef1['result'][_0x73fd('0x1b')]);}})[_0x73fd('0x1c')](function(_0x4185e2){logger[_0x73fd('0x18')](_0x73fd('0x1a'),_0x2cc1ee,_0x4185e2);_0x2c1471(_0x4185e2);});});}exports['CreateSmsMessage']=function(_0x354b7b){var _0x521596=this;return new Promise(function(_0x4ed3a8,_0x9088b7){return db[_0x73fd('0x1d')]['create'](_0x354b7b[_0x73fd('0x1e')],{'raw':_0x354b7b[_0x73fd('0x1f')]?_0x354b7b[_0x73fd('0x1f')][_0x73fd('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x303aba){logger[_0x73fd('0x13')](_0x73fd('0x21'),_0x354b7b);logger[_0x73fd('0x15')](_0x73fd('0x21'),_0x354b7b,JSON[_0x73fd('0x17')](_0x303aba));_0x4ed3a8(_0x303aba);})[_0x73fd('0x1c')](function(_0x78d2){logger[_0x73fd('0x18')](_0x73fd('0x21'),_0x78d2[_0x73fd('0x1b')],_0x354b7b);_0x9088b7(_0x521596['error'](0x1f4,_0x78d2[_0x73fd('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index c876aa8..88f8bca 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 _0x1d62=['smsMessage:','./smsMessage.events','remove','update','emit','removeListener','register','length'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x1d62,0x1b9));var _0x21d6=function(_0x2d100a,_0x3a79e7){_0x2d100a=_0x2d100a-0x0;var _0x58c48b=_0x1d62[_0x2d100a];return _0x58c48b;};'use strict';var SmsMessageEvents=require(_0x21d6('0x0'));var events=['save',_0x21d6('0x1'),_0x21d6('0x2')];function createListener(_0x44f696,_0x30a935){return function(_0x16650d){_0x30a935[_0x21d6('0x3')](_0x44f696,_0x16650d);};}function removeListener(_0x53da91,_0x1318bf){return function(){SmsMessageEvents[_0x21d6('0x4')](_0x53da91,_0x1318bf);};}exports[_0x21d6('0x5')]=function(_0x5b4183){for(var _0x5c94ca=0x0,_0x2cf42c=events[_0x21d6('0x6')];_0x5c94ca<_0x2cf42c;_0x5c94ca++){var _0x4d77ce=events[_0x5c94ca];var _0x3fed1b=createListener(_0x21d6('0x7')+_0x4d77ce,_0x5b4183);SmsMessageEvents['on'](_0x4d77ce,_0x3fed1b);}}; \ No newline at end of file +var _0x361f=['save','remove','emit','removeListener','register','smsMessage:','./smsMessage.events'];(function(_0x1904c2,_0x5f205a){var _0xe90ed0=function(_0xae8313){while(--_0xae8313){_0x1904c2['push'](_0x1904c2['shift']());}};_0xe90ed0(++_0x5f205a);}(_0x361f,0xed));var _0xf361=function(_0x2116ce,_0x492a5d){_0x2116ce=_0x2116ce-0x0;var _0x11d651=_0x361f[_0x2116ce];return _0x11d651;};'use strict';var SmsMessageEvents=require(_0xf361('0x0'));var events=[_0xf361('0x1'),_0xf361('0x2'),'update'];function createListener(_0x219533,_0x1dc56d){return function(_0x4bbd1c){_0x1dc56d[_0xf361('0x3')](_0x219533,_0x4bbd1c);};}function removeListener(_0x2eb016,_0x2c8f13){return function(){SmsMessageEvents[_0xf361('0x4')](_0x2eb016,_0x2c8f13);};}exports[_0xf361('0x5')]=function(_0x20f942){for(var _0x52c71c=0x0,_0x55012d=events['length'];_0x52c71c<_0x55012d;_0x52c71c++){var _0x39b137=events[_0x52c71c];var _0x4619df=createListener(_0xf361('0x6')+_0x39b137,_0x20f942);SmsMessageEvents['on'](_0x39b137,_0x4619df);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 7e0ed3d..ee9750c 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 _0x6608=['fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','update','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6608,0x1ca));var _0x8660=function(_0x5bba2e,_0x1a0f45){_0x5bba2e=_0x5bba2e-0x0;var _0x3213a3=_0x6608[_0x5bba2e];return _0x3213a3;};'use strict';var multer=require(_0x8660('0x0'));var util=require(_0x8660('0x1'));var path=require(_0x8660('0x2'));var timeout=require(_0x8660('0x3'));var express=require(_0x8660('0x4'));var router=express[_0x8660('0x5')]();var fs_extra=require(_0x8660('0x6'));var auth=require(_0x8660('0x7'));var interaction=require(_0x8660('0x8'));var config=require('../../config/environment');var controller=require('./smsQueue.controller');router[_0x8660('0x9')]('/',auth[_0x8660('0xa')](),controller[_0x8660('0xb')]);router[_0x8660('0x9')](_0x8660('0xc'),auth[_0x8660('0xa')](),controller[_0x8660('0xd')]);router[_0x8660('0x9')](_0x8660('0xe'),auth[_0x8660('0xa')](),controller[_0x8660('0xf')]);router[_0x8660('0x9')]('/:id/members',auth[_0x8660('0xa')](),controller[_0x8660('0x10')]);router[_0x8660('0x9')](_0x8660('0x11'),auth[_0x8660('0xa')](),controller[_0x8660('0x12')]);router[_0x8660('0x9')](_0x8660('0x13'),auth[_0x8660('0xa')](),controller['getAgents']);router[_0x8660('0x14')]('/',auth[_0x8660('0xa')](),controller[_0x8660('0x15')]);router['post'](_0x8660('0x11'),auth['isAuthenticated'](),controller[_0x8660('0x16')]);router[_0x8660('0x14')](_0x8660('0x13'),auth[_0x8660('0xa')](),controller[_0x8660('0x17')]);router['put']('/:id',auth[_0x8660('0xa')](),controller[_0x8660('0x18')]);router['delete']('/:id',auth[_0x8660('0xa')](),controller['destroy']);router[_0x8660('0x19')](_0x8660('0x11'),auth[_0x8660('0xa')](),controller[_0x8660('0x1a')]);router[_0x8660('0x19')](_0x8660('0x13'),auth['isAuthenticated'](),controller[_0x8660('0x1b')]);module[_0x8660('0x1c')]=router; \ No newline at end of file +var _0x6400=['put','update','destroy','removeTeams','/:id/users','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/members','/:id/teams','getTeams','post','create','addAgents'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x6400,0x180));var _0x0640=function(_0x3d4488,_0x1b2b82){_0x3d4488=_0x3d4488-0x0;var _0x4a0548=_0x6400[_0x3d4488];return _0x4a0548;};'use strict';var multer=require(_0x0640('0x0'));var util=require(_0x0640('0x1'));var path=require(_0x0640('0x2'));var timeout=require(_0x0640('0x3'));var express=require(_0x0640('0x4'));var router=express[_0x0640('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0640('0x6'));var interaction=require(_0x0640('0x7'));var config=require(_0x0640('0x8'));var controller=require(_0x0640('0x9'));router[_0x0640('0xa')]('/',auth['isAuthenticated'](),controller[_0x0640('0xb')]);router['get'](_0x0640('0xc'),auth[_0x0640('0xd')](),controller['describe']);router[_0x0640('0xa')](_0x0640('0xe'),auth[_0x0640('0xd')](),controller[_0x0640('0xf')]);router[_0x0640('0xa')](_0x0640('0x10'),auth[_0x0640('0xd')](),controller['getMembers']);router[_0x0640('0xa')](_0x0640('0x11'),auth[_0x0640('0xd')](),controller[_0x0640('0x12')]);router['get']('/:id/users',auth[_0x0640('0xd')](),controller['getAgents']);router[_0x0640('0x13')]('/',auth[_0x0640('0xd')](),controller[_0x0640('0x14')]);router[_0x0640('0x13')](_0x0640('0x11'),auth['isAuthenticated'](),controller['addTeams']);router['post']('/:id/users',auth[_0x0640('0xd')](),controller[_0x0640('0x15')]);router[_0x0640('0x16')](_0x0640('0xe'),auth['isAuthenticated'](),controller[_0x0640('0x17')]);router['delete'](_0x0640('0xe'),auth[_0x0640('0xd')](),controller[_0x0640('0x18')]);router['delete'](_0x0640('0x11'),auth[_0x0640('0xd')](),controller[_0x0640('0x19')]);router['delete'](_0x0640('0x1a'),auth['isAuthenticated'](),controller[_0x0640('0x1b')]);module[_0x0640('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index e00ade8..045b717 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 _0x5596=['sequelize','exports','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x382282,_0x53394a){var _0x266310=function(_0x3a9bd3){while(--_0x3a9bd3){_0x382282['push'](_0x382282['shift']());}};_0x266310(++_0x53394a);}(_0x5596,0x1e0));var _0x6559=function(_0x29342b,_0xebd7e7){_0x29342b=_0x29342b-0x0;var _0x4cbd84=_0x5596[_0x29342b];return _0x4cbd84;};'use strict';var Sequelize=require(_0x6559('0x0'));module[_0x6559('0x1')]={'name':{'type':Sequelize[_0x6559('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6559('0x2')]},'timeout':{'type':Sequelize[_0x6559('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6559('0x4')](_0x6559('0x5'),_0x6559('0x6'),_0x6559('0x7'))}}; \ No newline at end of file +var _0x8390=['STRING','INTEGER','ENUM','roundrobin','sequelize','exports'];(function(_0x4ec049,_0x3e29a4){var _0x5b1baa=function(_0x2a8bf3){while(--_0x2a8bf3){_0x4ec049['push'](_0x4ec049['shift']());}};_0x5b1baa(++_0x3e29a4);}(_0x8390,0x94));var _0x0839=function(_0x4ea413,_0x51ff3a){_0x4ea413=_0x4ea413-0x0;var _0x51cf25=_0x8390[_0x4ea413];return _0x51cf25;};'use strict';var Sequelize=require(_0x0839('0x0'));module[_0x0839('0x1')]={'name':{'type':Sequelize[_0x0839('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0839('0x2')]},'timeout':{'type':Sequelize[_0x0839('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0839('0x4')]('rrmemory','beepall',_0x0839('0x5'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index a5e44d3..9d1e481 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 _0xd2b2=['User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userSmsQueue:save','select','field','tq.TeamId','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','includes','all','union','value','removeTeams','isEmpty','userSmsQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','limit','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','index','map','SmsQueue','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','count','includeAll','include','findAll','show','params','merge','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','SmsQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserSmsQueue','SmsQueueId'];(function(_0x55e0e7,_0x319f1b){var _0x14cc40=function(_0xf57dd0){while(--_0xf57dd0){_0x55e0e7['push'](_0x55e0e7['shift']());}};_0x14cc40(++_0x319f1b);}(_0xd2b2,0x1e8));var _0x2d2b=function(_0x21632a,_0x26725f){_0x21632a=_0x21632a-0x0;var _0x2dd916=_0xd2b2[_0x21632a];return _0x2dd916;};'use strict';var emlformat=require(_0x2d2b('0x0'));var rimraf=require(_0x2d2b('0x1'));var zipdir=require(_0x2d2b('0x2'));var jsonpatch=require(_0x2d2b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2d2b('0x4'));var Mustache=require(_0x2d2b('0x5'));var util=require(_0x2d2b('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2d2b('0x7'));var squel=require(_0x2d2b('0x8'));var crypto=require(_0x2d2b('0x9'));var jsforce=require(_0x2d2b('0xa'));var deskjs=require(_0x2d2b('0xb'));var toCsv=require(_0x2d2b('0xc'));var querystring=require(_0x2d2b('0xd'));var Papa=require(_0x2d2b('0xe'));var Redis=require(_0x2d2b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2d2b('0x10'));var as=require(_0x2d2b('0x11'));var hardwareService=require(_0x2d2b('0x12'));var logger=require(_0x2d2b('0x13'))(_0x2d2b('0x14'));var utils=require('../../config/utils');var config=require(_0x2d2b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2d2b('0x16'))['db'];config[_0x2d2b('0x17')]=_[_0x2d2b('0x18')](config[_0x2d2b('0x17')],{'host':_0x2d2b('0x19'),'port':0x18eb});var socket=require(_0x2d2b('0x1a'))(new Redis(config[_0x2d2b('0x17')]));require('./smsQueue.socket')[_0x2d2b('0x1b')](socket);function respondWithStatusCode(_0x15b0f1,_0x34590d){_0x34590d=_0x34590d||0xcc;return function(_0x47c2d1){if(_0x47c2d1){return _0x15b0f1[_0x2d2b('0x1c')](_0x34590d);}return _0x15b0f1['status'](_0x34590d)[_0x2d2b('0x1d')]();};}function respondWithResult(_0x5c485f,_0x293867){_0x293867=_0x293867||0xc8;return function(_0x33dfee){if(_0x33dfee){return _0x5c485f[_0x2d2b('0x1e')](_0x293867)[_0x2d2b('0x1f')](_0x33dfee);}};}function respondWithFilteredResult(_0x40f9ee,_0x4d27aa){return function(_0x3bfe8f){if(_0x3bfe8f){var _0xdab117=typeof _0x4d27aa[_0x2d2b('0x20')]===_0x2d2b('0x21')&&typeof _0x4d27aa[_0x2d2b('0x22')]===_0x2d2b('0x21');var _0x5f3991=_0x3bfe8f['count'];var _0x14a678=_0xdab117?0x0:_0x4d27aa['offset'];var _0x3660a0=_0xdab117?_0x3bfe8f['count']:_0x4d27aa[_0x2d2b('0x20')]+_0x4d27aa[_0x2d2b('0x22')];var _0x5ae472;if(_0x3660a0>=_0x5f3991){_0x3660a0=_0x5f3991;_0x5ae472=0xc8;}else{_0x5ae472=0xce;}_0x40f9ee[_0x2d2b('0x1e')](_0x5ae472);return _0x40f9ee['set']('Content-Range',_0x14a678+'-'+_0x3660a0+'/'+_0x5f3991)[_0x2d2b('0x1f')](_0x3bfe8f);}return null;};}function patchUpdates(_0x395441){return function(_0x4690ce){try{jsonpatch['apply'](_0x4690ce,_0x395441,!![]);}catch(_0x3fcd88){return BPromise[_0x2d2b('0x23')](_0x3fcd88);}return _0x4690ce[_0x2d2b('0x24')]();};}function saveUpdates(_0x5b74cb,_0x1b95c2){return function(_0x2f3e3e){if(_0x2f3e3e){return _0x2f3e3e[_0x2d2b('0x25')](_0x5b74cb)[_0x2d2b('0x26')](function(_0x33afd7){return _0x33afd7;});}return null;};}function removeEntity(_0x41adc8,_0x35c158){return function(_0x17e20e){if(_0x17e20e){return _0x17e20e[_0x2d2b('0x27')]()[_0x2d2b('0x26')](function(){var _0x38ed5b=_0x17e20e[_0x2d2b('0x28')]({'plain':!![]});var _0x3585c3='SmsQueues';return db[_0x2d2b('0x29')][_0x2d2b('0x27')]({'where':{'type':_0x3585c3,'resourceId':_0x38ed5b['id']}})[_0x2d2b('0x26')](function(){return _0x17e20e;});})[_0x2d2b('0x26')](function(){_0x41adc8['status'](0xcc)[_0x2d2b('0x1d')]();});}};}function handleEntityNotFound(_0x307039,_0x54ad6f){return function(_0x37ef43){if(!_0x37ef43){_0x307039['sendStatus'](0x194);}return _0x37ef43;};}function handleError(_0x5be273,_0x2b1613){_0x2b1613=_0x2b1613||0x1f4;return function(_0x2a4563){logger[_0x2d2b('0x2a')](_0x2a4563[_0x2d2b('0x2b')]);if(_0x2a4563[_0x2d2b('0x2c')]){delete _0x2a4563['name'];}_0x5be273[_0x2d2b('0x1e')](_0x2b1613)['send'](_0x2a4563);};}exports[_0x2d2b('0x2d')]=function(_0xe43b13,_0x2d0492){var _0xd3cc36={},_0x27b16f={},_0x3e3a4e={'count':0x0,'rows':[]};var _0x170053=_[_0x2d2b('0x2e')](db[_0x2d2b('0x2f')][_0x2d2b('0x30')],function(_0x5d6f1f){return{'name':_0x5d6f1f[_0x2d2b('0x31')],'type':_0x5d6f1f['type'][_0x2d2b('0x32')]};});_0x27b16f['model']=_[_0x2d2b('0x2e')](_0x170053,_0x2d2b('0x2c'));_0x27b16f[_0x2d2b('0x33')]=_[_0x2d2b('0x34')](_0xe43b13['query']);_0x27b16f[_0x2d2b('0x35')]=_[_0x2d2b('0x36')](_0x27b16f[_0x2d2b('0x37')],_0x27b16f['query']);_0xd3cc36[_0x2d2b('0x38')]=_[_0x2d2b('0x36')](_0x27b16f[_0x2d2b('0x37')],qs[_0x2d2b('0x39')](_0xe43b13[_0x2d2b('0x33')][_0x2d2b('0x39')]));_0xd3cc36['attributes']=_0xd3cc36[_0x2d2b('0x38')][_0x2d2b('0x3a')]?_0xd3cc36[_0x2d2b('0x38')]:_0x27b16f[_0x2d2b('0x37')];if(!_0xe43b13[_0x2d2b('0x33')][_0x2d2b('0x3b')](_0x2d2b('0x3c'))){_0xd3cc36[_0x2d2b('0x22')]=qs[_0x2d2b('0x22')](_0xe43b13['query']['limit']);_0xd3cc36[_0x2d2b('0x20')]=qs[_0x2d2b('0x20')](_0xe43b13['query']['offset']);}_0xd3cc36[_0x2d2b('0x3d')]=qs[_0x2d2b('0x3e')](_0xe43b13[_0x2d2b('0x33')][_0x2d2b('0x3e')]);_0xd3cc36['where']=qs[_0x2d2b('0x35')](_[_0x2d2b('0x3f')](_0xe43b13[_0x2d2b('0x33')],_0x27b16f[_0x2d2b('0x35')]),_0x170053);if(_0xe43b13[_0x2d2b('0x33')][_0x2d2b('0x40')]){_0xd3cc36[_0x2d2b('0x41')]=_['merge'](_0xd3cc36[_0x2d2b('0x41')],{'$or':_[_0x2d2b('0x2e')](_0x170053,function(_0x46e659){if(_0x46e659['type']!==_0x2d2b('0x42')){var _0x288561={};_0x288561[_0x46e659['name']]={'$like':'%'+_0xe43b13['query'][_0x2d2b('0x40')]+'%'};return _0x288561;}})});}_0xd3cc36=_['merge']({},_0xd3cc36,_0xe43b13[_0x2d2b('0x43')]);var _0x5adb78={'where':_0xd3cc36[_0x2d2b('0x41')]};return db[_0x2d2b('0x2f')][_0x2d2b('0x44')](_0x5adb78)[_0x2d2b('0x26')](function(_0x248fa0){_0x3e3a4e['count']=_0x248fa0;if(_0xe43b13[_0x2d2b('0x33')][_0x2d2b('0x45')]){_0xd3cc36[_0x2d2b('0x46')]=[{'all':!![]}];}return db[_0x2d2b('0x2f')][_0x2d2b('0x47')](_0xd3cc36);})[_0x2d2b('0x26')](function(_0x376408){_0x3e3a4e['rows']=_0x376408;return _0x3e3a4e;})['then'](respondWithFilteredResult(_0x2d0492,_0xd3cc36))['catch'](handleError(_0x2d0492,null));};exports[_0x2d2b('0x48')]=function(_0x3ab3d6,_0x119c33){var _0x14b1a3={'raw':!![],'where':{'id':_0x3ab3d6[_0x2d2b('0x49')]['id']}},_0x36026b={};_0x36026b[_0x2d2b('0x37')]=_[_0x2d2b('0x34')](db[_0x2d2b('0x2f')][_0x2d2b('0x30')]);_0x36026b[_0x2d2b('0x33')]=_[_0x2d2b('0x34')](_0x3ab3d6[_0x2d2b('0x33')]);_0x36026b['filters']=_['intersection'](_0x36026b['model'],_0x36026b['query']);_0x14b1a3[_0x2d2b('0x38')]=_['intersection'](_0x36026b[_0x2d2b('0x37')],qs['fields'](_0x3ab3d6['query']['fields']));_0x14b1a3['attributes']=_0x14b1a3[_0x2d2b('0x38')]['length']?_0x14b1a3[_0x2d2b('0x38')]:_0x36026b[_0x2d2b('0x37')];if(_0x3ab3d6[_0x2d2b('0x33')][_0x2d2b('0x45')]){_0x14b1a3['include']=[{'all':!![]}];}_0x14b1a3=_[_0x2d2b('0x4a')]({},_0x14b1a3,_0x3ab3d6[_0x2d2b('0x43')]);return db[_0x2d2b('0x2f')][_0x2d2b('0x4b')](_0x14b1a3)['then'](handleEntityNotFound(_0x119c33,null))[_0x2d2b('0x26')](respondWithResult(_0x119c33,null))[_0x2d2b('0x4c')](handleError(_0x119c33,null));};exports[_0x2d2b('0x4d')]=function(_0x2d6654,_0x392ca1){return db[_0x2d2b('0x2f')][_0x2d2b('0x4d')](_0x2d6654['body'],{})[_0x2d2b('0x26')](function(_0x425ce7){var _0x24c130=_0x2d6654['user'][_0x2d2b('0x28')]({'plain':!![]});if(!_0x24c130)throw new Error(_0x2d2b('0x4e'));if(_0x24c130[_0x2d2b('0x4f')]===_0x2d2b('0x50')){var _0x98b29c=_0x425ce7[_0x2d2b('0x28')]({'plain':!![]});var _0x52ed34=_0x2d2b('0x51');return db[_0x2d2b('0x52')][_0x2d2b('0x4b')]({'where':{'name':_0x52ed34,'userProfileId':_0x24c130[_0x2d2b('0x53')]},'raw':!![]})['then'](function(_0x502a32){if(_0x502a32&&_0x502a32[_0x2d2b('0x54')]===0x0){return db[_0x2d2b('0x29')][_0x2d2b('0x4d')]({'name':_0x98b29c[_0x2d2b('0x2c')],'resourceId':_0x98b29c['id'],'type':_0x502a32[_0x2d2b('0x2c')],'sectionId':_0x502a32['id']},{})[_0x2d2b('0x26')](function(){return _0x425ce7;});}else{return _0x425ce7;}})[_0x2d2b('0x4c')](function(_0x723137){logger[_0x2d2b('0x2a')](_0x2d2b('0x55'),_0x723137);throw _0x723137;});}return _0x425ce7;})['then'](respondWithResult(_0x392ca1,0xc9))[_0x2d2b('0x4c')](handleError(_0x392ca1,null));};exports['update']=function(_0x20aebb,_0x4ce6d4){if(_0x20aebb[_0x2d2b('0x56')]['id']){delete _0x20aebb[_0x2d2b('0x56')]['id'];}return db[_0x2d2b('0x2f')][_0x2d2b('0x4b')]({'where':{'id':_0x20aebb[_0x2d2b('0x49')]['id']}})['then'](handleEntityNotFound(_0x4ce6d4,null))[_0x2d2b('0x26')](saveUpdates(_0x20aebb['body'],null))[_0x2d2b('0x26')](respondWithResult(_0x4ce6d4,null))[_0x2d2b('0x4c')](handleError(_0x4ce6d4,null));};exports['destroy']=function(_0x1bce82,_0x346d13){return db['SmsQueue'][_0x2d2b('0x4b')]({'where':{'id':_0x1bce82[_0x2d2b('0x49')]['id']}})['then'](handleEntityNotFound(_0x346d13,null))[_0x2d2b('0x26')](removeEntity(_0x346d13,null))[_0x2d2b('0x4c')](handleError(_0x346d13,null));};exports[_0x2d2b('0x57')]=function(_0x2e786a,_0x3a23b2){return db['SmsQueue'][_0x2d2b('0x57')]()[_0x2d2b('0x26')](respondWithResult(_0x3a23b2,null))['catch'](handleError(_0x3a23b2,null));};exports[_0x2d2b('0x58')]=function(_0x49e1df,_0x7df283,_0x408b8f){var _0x5f3f95={'raw':!![],'where':{}},_0x342147={},_0xdc725b;return db[_0x2d2b('0x2f')][_0x2d2b('0x59')]({'where':{'id':_0x49e1df['params']['id']}})['then'](handleEntityNotFound(_0x7df283,null))[_0x2d2b('0x26')](function(_0x5f2937){if(_0x5f2937){_0xdc725b=_0x5f2937['get']({'plain':!![]});_0x342147['model']=_[_0x2d2b('0x34')](db[_0x2d2b('0x5a')][_0x2d2b('0x30')]);_0x342147[_0x2d2b('0x33')]=_[_0x2d2b('0x34')](_0x49e1df[_0x2d2b('0x33')]);_0x342147[_0x2d2b('0x35')]=_[_0x2d2b('0x36')](_0x342147[_0x2d2b('0x37')],_0x342147[_0x2d2b('0x33')]);_0x5f3f95[_0x2d2b('0x38')]=_['intersection'](_0x342147[_0x2d2b('0x37')],qs[_0x2d2b('0x39')](_0x49e1df['query']['fields']));_0x5f3f95[_0x2d2b('0x38')]=_0x5f3f95[_0x2d2b('0x38')]['length']?_0x5f3f95[_0x2d2b('0x38')]:_0x342147['model'];if(!_0x49e1df[_0x2d2b('0x33')][_0x2d2b('0x3b')](_0x2d2b('0x3c'))){_0x5f3f95[_0x2d2b('0x22')]=qs[_0x2d2b('0x22')](_0x49e1df[_0x2d2b('0x33')][_0x2d2b('0x22')]);_0x5f3f95[_0x2d2b('0x20')]=qs[_0x2d2b('0x20')](_0x49e1df[_0x2d2b('0x33')]['offset']);}_0x5f3f95[_0x2d2b('0x3d')]=qs[_0x2d2b('0x3e')](_0x49e1df[_0x2d2b('0x33')][_0x2d2b('0x3e')]);_0x5f3f95['where']=qs['filters'](_[_0x2d2b('0x3f')](_0x49e1df[_0x2d2b('0x33')],_0x342147['filters']));_0x5f3f95[_0x2d2b('0x41')][_0x2d2b('0x5b')]=_0x5f2937['id'];if(_0x49e1df['query']['filter']){_0x5f3f95[_0x2d2b('0x41')]=_[_0x2d2b('0x4a')](_0x5f3f95[_0x2d2b('0x41')],{'$or':_['map'](_0x5f3f95[_0x2d2b('0x38')],function(_0x228b49){var _0x450f33={};_0x450f33[_0x228b49]={'$like':'%'+_0x49e1df[_0x2d2b('0x33')][_0x2d2b('0x40')]+'%'};return _0x450f33;})});}_0x5f3f95=_[_0x2d2b('0x4a')]({},_0x5f3f95,_0x49e1df['options']);return db['UserSmsQueue'][_0x2d2b('0x47')](_0x5f3f95);}})[_0x2d2b('0x26')](function(_0x4132de){if(_0x4132de){return db[_0x2d2b('0x5c')][_0x2d2b('0x5d')]({'where':{'id':_['map'](_0x4132de,_0x2d2b('0x5e')),'role':_0x2d2b('0x5f')},'attributes':['id',_0x2d2b('0x2c'),_0x2d2b('0x60'),_0x2d2b('0x61'),_0x2d2b('0x62')]});}})['then'](function(_0x5ca7f7){if(_0x5ca7f7){return{'count':_0x5ca7f7['count'],'rows':_[_0x2d2b('0x2e')](_0x5ca7f7[_0x2d2b('0x63')],function(_0x275796){return{'membername':_0x275796[_0x2d2b('0x2c')],'UserId':_0x275796['id'],'queue_name':_0xdc725b[_0x2d2b('0x2c')],'SmsQueueId':_0xdc725b['id'],'interface':util[_0x2d2b('0x64')](_0x2d2b('0x65'),_0x2d2b('0x66'),_0x275796['name']),'penalty':0x0,'paused':_0x275796[_0x2d2b('0x60')],'createdAt':_0x275796[_0x2d2b('0x62')],'updatedAt':_0x275796['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x7df283,_0x5f3f95))[_0x2d2b('0x4c')](handleError(_0x7df283,null));};exports[_0x2d2b('0x67')]=function(_0x529295,_0x5ec8ae,_0x575ce6){var _0x106cf9={};var _0x1384be={};var _0x27970b;var _0x477320;return db[_0x2d2b('0x2f')][_0x2d2b('0x59')]({'where':{'id':_0x529295['params']['id']}})['then'](handleEntityNotFound(_0x5ec8ae,null))[_0x2d2b('0x26')](function(_0x13bdc2){if(_0x13bdc2){_0x27970b=_0x13bdc2;_0x1384be[_0x2d2b('0x37')]=_[_0x2d2b('0x34')](db[_0x2d2b('0x68')][_0x2d2b('0x30')]);_0x1384be[_0x2d2b('0x33')]=_[_0x2d2b('0x34')](_0x529295[_0x2d2b('0x33')]);_0x1384be[_0x2d2b('0x35')]=_[_0x2d2b('0x36')](_0x1384be['model'],_0x1384be['query']);_0x106cf9[_0x2d2b('0x38')]=_['intersection'](_0x1384be[_0x2d2b('0x37')],qs['fields'](_0x529295[_0x2d2b('0x33')]['fields']));_0x106cf9[_0x2d2b('0x38')]=_0x106cf9[_0x2d2b('0x38')][_0x2d2b('0x3a')]?_0x106cf9[_0x2d2b('0x38')]:_0x1384be[_0x2d2b('0x37')];_0x106cf9[_0x2d2b('0x3d')]=qs['sort'](_0x529295[_0x2d2b('0x33')]['sort']);_0x106cf9[_0x2d2b('0x41')]=qs['filters'](_['pick'](_0x529295['query'],_0x1384be[_0x2d2b('0x35')]));if(_0x529295[_0x2d2b('0x33')][_0x2d2b('0x40')]){_0x106cf9[_0x2d2b('0x41')]=_[_0x2d2b('0x4a')](_0x106cf9[_0x2d2b('0x41')],{'$or':_['map'](_0x106cf9['attributes'],function(_0x33ab74){var _0x4c7433={};_0x4c7433[_0x33ab74]={'$like':'%'+_0x529295[_0x2d2b('0x33')][_0x2d2b('0x40')]+'%'};return _0x4c7433;})});}_0x106cf9=_[_0x2d2b('0x4a')]({},_0x106cf9,_0x529295[_0x2d2b('0x43')]);return _0x27970b[_0x2d2b('0x67')](_0x106cf9);}})['then'](function(_0x16116e){if(_0x16116e){_0x477320=_0x16116e[_0x2d2b('0x3a')];if(!_0x529295[_0x2d2b('0x33')][_0x2d2b('0x3b')](_0x2d2b('0x3c'))){_0x106cf9[_0x2d2b('0x22')]=qs[_0x2d2b('0x22')](_0x529295[_0x2d2b('0x33')][_0x2d2b('0x22')]);_0x106cf9[_0x2d2b('0x20')]=qs[_0x2d2b('0x20')](_0x529295['query']['offset']);}return _0x27970b[_0x2d2b('0x67')](_0x106cf9);}})['then'](function(_0x7a7b31){if(_0x7a7b31){return _0x7a7b31?{'count':_0x477320,'rows':_0x7a7b31}:null;}})[_0x2d2b('0x26')](respondWithResult(_0x5ec8ae,null))['catch'](handleError(_0x5ec8ae,null));};exports[_0x2d2b('0x69')]=function(_0xc3c0ac,_0x190c14,_0xce63e2){var _0x73b4e7=_0xc3c0ac['body'][_0x2d2b('0x6a')];return db[_0x2d2b('0x68')][_0x2d2b('0x47')]({'where':{'id':_0x73b4e7},'attributes':['id'],'include':[{'model':db[_0x2d2b('0x5c')],'as':_0x2d2b('0x6b'),'attributes':['id',_0x2d2b('0x2c'),_0x2d2b('0x6c'),_0x2d2b('0x6d'),_0x2d2b('0x6e')],'raw':!![]}]})['then'](function(_0x1520d7){if(_0x1520d7){var _0x4b9ea9=_[_0x2d2b('0x6f')](_0x1520d7,function(_0x59e302){var _0x4bfd1a=_0x59e302['get']({'plain':!![]});return _0x4bfd1a[_0x2d2b('0x6b')];});return db[_0x2d2b('0x2f')][_0x2d2b('0x4b')]({'where':{'id':_0xc3c0ac[_0x2d2b('0x49')]['id']}})[_0x2d2b('0x26')](function(_0x2a988c){return db[_0x2d2b('0x70')][_0x2d2b('0x71')](function(_0x435e03){return _0x2a988c[_0x2d2b('0x69')](_0x73b4e7,{'transaction':_0x435e03})['then'](function(){return BPromise['each'](_0x4b9ea9,function(_0x26ee28){return db[_0x2d2b('0x5a')][_0x2d2b('0x72')]({'where':{'UserId':_0x26ee28['id'],'SmsQueueId':_0xc3c0ac['params']['id']},'transaction':_0x435e03});});})[_0x2d2b('0x26')](function(){_0x4b9ea9[_0x2d2b('0x73')](function(_0x407af1){socket[_0x2d2b('0x74')](_0x2d2b('0x75'),{'UserId':_0x407af1['id'],'SmsQueueId':_0x2a988c['id']});});});});});}})[_0x2d2b('0x26')](respondWithStatusCode(_0x190c14,null))[_0x2d2b('0x4c')](handleError(_0x190c14,null));};exports['removeTeams']=function(_0x107780,_0x485e92,_0x477cd1){return db[_0x2d2b('0x68')][_0x2d2b('0x47')]({'where':{'id':_0x107780[_0x2d2b('0x33')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2d2b('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x2d2b('0x26')](handleEntityNotFound(_0x485e92,null))[_0x2d2b('0x26')](function(_0x4d56b9){var _0x47f714=_[_0x2d2b('0x2e')](_0x4d56b9,'id');var _0x1d455a=[];var _0x3f275b=[];var _0x2ad6c6=squel[_0x2d2b('0x76')]();_0x2ad6c6[_0x2d2b('0x77')](_0x2d2b('0x78'))[_0x2d2b('0x79')](_0x2d2b('0x7a'),'tq')[_0x2d2b('0x7b')]('user_has_teams','ut',_0x2d2b('0x7c'))[_0x2d2b('0x41')](_0x2d2b('0x7d'),_0x107780[_0x2d2b('0x49')]['id']);for(var _0x1efb99=0x0;_0x1efb99<_0x4d56b9[_0x2d2b('0x3a')];_0x1efb99+=0x1){let _0x5103e1=_0x4d56b9[_0x1efb99];for(var _0x54e487=0x0;_0x54e487<_0x5103e1['Agents'][_0x2d2b('0x3a')];_0x54e487+=0x1){let _0x41614a=_0x5103e1[_0x2d2b('0x6b')][_0x54e487];var _0x5c3d0c=_0x2ad6c6[_0x2d2b('0x7e')]();_0x5c3d0c[_0x2d2b('0x41')](_0x2d2b('0x7f'),_0x41614a['id']);_0x3f275b['push'](db[_0x2d2b('0x70')]['query'](_0x5c3d0c[_0x2d2b('0x80')](),{'type':db[_0x2d2b('0x70')][_0x2d2b('0x81')]['SELECT']})['then'](function(_0x222bce){if(_0x222bce[_0x2d2b('0x3a')]===0x1){return _0x41614a['id'];}else{var _0x52108a=_[_0x2d2b('0x82')](_[_0x2d2b('0x2e')](_0x222bce,_0x2d2b('0x83')),function(_0x4d68c0){return _[_0x2d2b('0x84')](_0x47f714,_0x4d68c0);});if(_0x52108a){return _0x41614a['id'];}}}));}}return BPromise[_0x2d2b('0x85')](_0x3f275b)['then'](function(_0x1e4c2e){_0x1d455a=_(_0x1d455a)[_0x2d2b('0x86')](_0x1e4c2e)['compact']()[_0x2d2b('0x87')]();return db['SmsQueue'][_0x2d2b('0x4b')]({'where':{'id':_0x107780[_0x2d2b('0x49')]['id']}})[_0x2d2b('0x26')](function(_0x4b1ce8){return db[_0x2d2b('0x70')]['transaction'](function(_0x195d78){return _0x4b1ce8[_0x2d2b('0x88')](_0x107780[_0x2d2b('0x33')][_0x2d2b('0x6a')],{'transaction':_0x195d78})[_0x2d2b('0x26')](function(){if(!_[_0x2d2b('0x89')](_0x1d455a)){return _0x4b1ce8['removeAgents'](_0x1d455a,{'transaction':_0x195d78});}})['then'](function(){_0x1d455a['forEach'](function(_0x10a5a5){socket['emit'](_0x2d2b('0x8a'),{'UserId':_0x10a5a5,'SmsQueueId':_0x4b1ce8['id']});});});});});});})['then'](respondWithStatusCode(_0x485e92,null))[_0x2d2b('0x4c')](handleError(_0x485e92,null));};exports['addAgents']=function(_0x24e42b,_0x31802c,_0x237d4c){return db[_0x2d2b('0x2f')]['find']({'where':{'id':_0x24e42b[_0x2d2b('0x49')]['id']}})[_0x2d2b('0x26')](handleEntityNotFound(_0x31802c,null))[_0x2d2b('0x26')](function(_0x1f376a){if(_0x1f376a){return _0x1f376a[_0x2d2b('0x8b')](_0x24e42b[_0x2d2b('0x56')][_0x2d2b('0x6a')],_[_0x2d2b('0x8c')](_0x24e42b[_0x2d2b('0x56')],[_0x2d2b('0x6a'),'id'])||{})[_0x2d2b('0x8d')](function(_0x54a00c){for(var _0x1c67d1=0x0;_0x1c67d1<_0x24e42b[_0x2d2b('0x56')][_0x2d2b('0x6a')][_0x2d2b('0x3a')];_0x1c67d1+=0x1){socket['emit'](_0x2d2b('0x75'),{'UserId':Number(_0x24e42b['body']['ids'][_0x1c67d1]),'SmsQueueId':Number(_0x24e42b[_0x2d2b('0x49')]['id'])});}return _0x54a00c;});}})[_0x2d2b('0x26')](respondWithResult(_0x31802c,null))[_0x2d2b('0x4c')](handleError(_0x31802c,null));};exports[_0x2d2b('0x8e')]=function(_0x5f58be,_0x5c366a,_0x161732){return db[_0x2d2b('0x2f')][_0x2d2b('0x4b')]({'where':{'id':_0x5f58be[_0x2d2b('0x49')]['id']}})[_0x2d2b('0x26')](handleEntityNotFound(_0x5c366a,null))[_0x2d2b('0x26')](function(_0x6ed0c3){if(_0x6ed0c3){return _0x6ed0c3[_0x2d2b('0x8e')](_0x5f58be[_0x2d2b('0x33')][_0x2d2b('0x6a')])['then'](function(){if(_[_0x2d2b('0x8f')](_0x5f58be[_0x2d2b('0x33')]['ids'])){for(var _0x5c7fc5=0x0;_0x5c7fc5<_0x5f58be['query'][_0x2d2b('0x6a')][_0x2d2b('0x3a')];_0x5c7fc5+=0x1){socket[_0x2d2b('0x74')](_0x2d2b('0x8a'),{'UserId':Number(_0x5f58be[_0x2d2b('0x33')]['ids'][_0x5c7fc5]),'SmsQueueId':Number(_0x5f58be[_0x2d2b('0x49')]['id'])});}}else{socket[_0x2d2b('0x74')](_0x2d2b('0x8a'),{'UserId':Number(_0x5f58be[_0x2d2b('0x33')]['ids']),'SmsQueueId':Number(_0x5f58be['params']['id'])});}});}})[_0x2d2b('0x26')](respondWithStatusCode(_0x5c366a,null))['catch'](handleError(_0x5c366a,null));};exports[_0x2d2b('0x90')]=function(_0x265261,_0x86407d,_0xc4f710){var _0x372e97={};var _0x5bd0db={};var _0x4ec8b2;var _0x50e92e;return db[_0x2d2b('0x2f')][_0x2d2b('0x59')]({'where':{'id':_0x265261[_0x2d2b('0x49')]['id']}})[_0x2d2b('0x26')](handleEntityNotFound(_0x86407d,null))[_0x2d2b('0x26')](function(_0x29b85e){if(_0x29b85e){_0x4ec8b2=_0x29b85e;_0x5bd0db[_0x2d2b('0x37')]=_[_0x2d2b('0x34')](db['User'][_0x2d2b('0x30')]);_0x5bd0db[_0x2d2b('0x33')]=_[_0x2d2b('0x34')](_0x265261[_0x2d2b('0x33')]);_0x5bd0db[_0x2d2b('0x35')]=_['intersection'](_0x5bd0db[_0x2d2b('0x37')],_0x5bd0db['query']);_0x372e97[_0x2d2b('0x38')]=_[_0x2d2b('0x36')](_0x5bd0db[_0x2d2b('0x37')],qs[_0x2d2b('0x39')](_0x265261[_0x2d2b('0x33')][_0x2d2b('0x39')]));_0x372e97[_0x2d2b('0x38')]=_0x372e97[_0x2d2b('0x38')][_0x2d2b('0x3a')]?_0x372e97[_0x2d2b('0x38')]:_0x5bd0db[_0x2d2b('0x37')];_0x372e97[_0x2d2b('0x3d')]=qs[_0x2d2b('0x3e')](_0x265261['query']['sort']);_0x372e97[_0x2d2b('0x41')]=qs[_0x2d2b('0x35')](_[_0x2d2b('0x3f')](_0x265261[_0x2d2b('0x33')],_0x5bd0db[_0x2d2b('0x35')]));if(_0x265261[_0x2d2b('0x33')][_0x2d2b('0x40')]){_0x372e97[_0x2d2b('0x41')]=_[_0x2d2b('0x4a')](_0x372e97[_0x2d2b('0x41')],{'$or':_[_0x2d2b('0x2e')](_0x372e97['attributes'],function(_0x513392){var _0xb42cbf={};_0xb42cbf[_0x513392]={'$like':'%'+_0x265261[_0x2d2b('0x33')][_0x2d2b('0x40')]+'%'};return _0xb42cbf;})});}_0x372e97=_[_0x2d2b('0x4a')]({},_0x372e97,_0x265261['options']);return _0x4ec8b2[_0x2d2b('0x90')](_0x372e97);}})['then'](function(_0xe5873e){if(_0xe5873e){_0x50e92e=_0xe5873e[_0x2d2b('0x3a')];if(!_0x265261[_0x2d2b('0x33')]['hasOwnProperty'](_0x2d2b('0x3c'))){_0x372e97[_0x2d2b('0x22')]=qs['limit'](_0x265261[_0x2d2b('0x33')][_0x2d2b('0x22')]);_0x372e97[_0x2d2b('0x20')]=qs[_0x2d2b('0x20')](_0x265261[_0x2d2b('0x33')]['offset']);}return _0x4ec8b2['getAgents'](_0x372e97);}})[_0x2d2b('0x26')](function(_0xe5da2e){if(_0xe5da2e){return _0xe5da2e?{'count':_0x50e92e,'rows':_0xe5da2e}:null;}})['then'](respondWithResult(_0x86407d,null))[_0x2d2b('0x4c')](handleError(_0x86407d,null));}; \ No newline at end of file +var _0x1bae=['toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','emit','userSmsQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','save','update','then','destroy','SmsQueues','error','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','find','userProfileId','UserProfileResource','params','describe','getMembers','findOne','UserSmsQueue','order','SmsQueueId','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','SIP','getTeams','Team','pick','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?'];(function(_0x1fc84d,_0x3f469d){var _0x2658fa=function(_0x189ad0){while(--_0x189ad0){_0x1fc84d['push'](_0x1fc84d['shift']());}};_0x2658fa(++_0x3f469d);}(_0x1bae,0xa4));var _0xe1ba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1bae[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xe1ba('0x0'));var rimraf=require(_0xe1ba('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe1ba('0x2'));var rp=require(_0xe1ba('0x3'));var moment=require(_0xe1ba('0x4'));var BPromise=require(_0xe1ba('0x5'));var Mustache=require(_0xe1ba('0x6'));var util=require(_0xe1ba('0x7'));var path=require('path');var sox=require(_0xe1ba('0x8'));var csv=require(_0xe1ba('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe1ba('0xa'));var _=require(_0xe1ba('0xb'));var squel=require(_0xe1ba('0xc'));var crypto=require(_0xe1ba('0xd'));var jsforce=require(_0xe1ba('0xe'));var deskjs=require(_0xe1ba('0xf'));var toCsv=require(_0xe1ba('0x9'));var querystring=require(_0xe1ba('0x10'));var Papa=require(_0xe1ba('0x11'));var Redis=require(_0xe1ba('0x12'));var authService=require(_0xe1ba('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe1ba('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe1ba('0x15'))(_0xe1ba('0x16'));var utils=require(_0xe1ba('0x17'));var config=require(_0xe1ba('0x18'));var licenseUtil=require(_0xe1ba('0x19'));var db=require(_0xe1ba('0x1a'))['db'];config[_0xe1ba('0x1b')]=_[_0xe1ba('0x1c')](config['redis'],{'host':_0xe1ba('0x1d'),'port':0x18eb});var socket=require(_0xe1ba('0x1e'))(new Redis(config['redis']));require('./smsQueue.socket')[_0xe1ba('0x1f')](socket);function respondWithStatusCode(_0x3250de,_0x4e7498){_0x4e7498=_0x4e7498||0xcc;return function(_0x67df44){if(_0x67df44){return _0x3250de[_0xe1ba('0x20')](_0x4e7498);}return _0x3250de[_0xe1ba('0x21')](_0x4e7498)[_0xe1ba('0x22')]();};}function respondWithResult(_0x586b4d,_0x230d70){_0x230d70=_0x230d70||0xc8;return function(_0x505476){if(_0x505476){return _0x586b4d['status'](_0x230d70)[_0xe1ba('0x23')](_0x505476);}};}function respondWithFilteredResult(_0x117acb,_0x72eadb){return function(_0x33ee26){if(_0x33ee26){var _0x157185=typeof _0x72eadb[_0xe1ba('0x24')]==='undefined'&&typeof _0x72eadb[_0xe1ba('0x25')]==='undefined';var _0x38107a=_0x33ee26[_0xe1ba('0x26')];var _0x46bb44=_0x157185?0x0:_0x72eadb['offset'];var _0x29db86=_0x157185?_0x33ee26['count']:_0x72eadb['offset']+_0x72eadb[_0xe1ba('0x25')];var _0x11c3f6;if(_0x29db86>=_0x38107a){_0x29db86=_0x38107a;_0x11c3f6=0xc8;}else{_0x11c3f6=0xce;}_0x117acb[_0xe1ba('0x21')](_0x11c3f6);return _0x117acb[_0xe1ba('0x27')](_0xe1ba('0x28'),_0x46bb44+'-'+_0x29db86+'/'+_0x38107a)[_0xe1ba('0x23')](_0x33ee26);}return null;};}function patchUpdates(_0x5549f8){return function(_0xca254c){try{jsonpatch[_0xe1ba('0x29')](_0xca254c,_0x5549f8,!![]);}catch(_0x34b3f4){return BPromise['reject'](_0x34b3f4);}return _0xca254c[_0xe1ba('0x2a')]();};}function saveUpdates(_0x505211,_0x174ea6){return function(_0x4c9991){if(_0x4c9991){return _0x4c9991[_0xe1ba('0x2b')](_0x505211)[_0xe1ba('0x2c')](function(_0x4fca2e){return _0x4fca2e;});}return null;};}function removeEntity(_0x3534eb,_0x373222){return function(_0x5e9e31){if(_0x5e9e31){return _0x5e9e31[_0xe1ba('0x2d')]()[_0xe1ba('0x2c')](function(){var _0x4f1a7e=_0x5e9e31['get']({'plain':!![]});var _0x18158e=_0xe1ba('0x2e');return db['UserProfileResource'][_0xe1ba('0x2d')]({'where':{'type':_0x18158e,'resourceId':_0x4f1a7e['id']}})[_0xe1ba('0x2c')](function(){return _0x5e9e31;});})[_0xe1ba('0x2c')](function(){_0x3534eb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x29b7e2,_0x2b39bd){return function(_0x4ddcc0){if(!_0x4ddcc0){_0x29b7e2[_0xe1ba('0x20')](0x194);}return _0x4ddcc0;};}function handleError(_0x5cf9e3,_0x3e60d3){_0x3e60d3=_0x3e60d3||0x1f4;return function(_0x103c2a){logger[_0xe1ba('0x2f')](_0x103c2a[_0xe1ba('0x30')]);if(_0x103c2a[_0xe1ba('0x31')]){delete _0x103c2a[_0xe1ba('0x31')];}_0x5cf9e3[_0xe1ba('0x21')](_0x3e60d3)[_0xe1ba('0x32')](_0x103c2a);};}exports[_0xe1ba('0x33')]=function(_0x2226d9,_0x1449aa){var _0x44388d={},_0x784e97={},_0x2badc3={'count':0x0,'rows':[]};var _0x111e37=_[_0xe1ba('0x34')](db[_0xe1ba('0x35')][_0xe1ba('0x36')],function(_0x1aacb8){return{'name':_0x1aacb8[_0xe1ba('0x37')],'type':_0x1aacb8[_0xe1ba('0x38')][_0xe1ba('0x39')]};});_0x784e97[_0xe1ba('0x3a')]=_['map'](_0x111e37,_0xe1ba('0x31'));_0x784e97[_0xe1ba('0x3b')]=_[_0xe1ba('0x3c')](_0x2226d9[_0xe1ba('0x3b')]);_0x784e97['filters']=_[_0xe1ba('0x3d')](_0x784e97[_0xe1ba('0x3a')],_0x784e97[_0xe1ba('0x3b')]);_0x44388d['attributes']=_[_0xe1ba('0x3d')](_0x784e97[_0xe1ba('0x3a')],qs['fields'](_0x2226d9['query'][_0xe1ba('0x3e')]));_0x44388d[_0xe1ba('0x3f')]=_0x44388d[_0xe1ba('0x3f')][_0xe1ba('0x40')]?_0x44388d[_0xe1ba('0x3f')]:_0x784e97[_0xe1ba('0x3a')];if(!_0x2226d9['query'][_0xe1ba('0x41')](_0xe1ba('0x42'))){_0x44388d['limit']=qs[_0xe1ba('0x25')](_0x2226d9['query'][_0xe1ba('0x25')]);_0x44388d[_0xe1ba('0x24')]=qs['offset'](_0x2226d9[_0xe1ba('0x3b')][_0xe1ba('0x24')]);}_0x44388d['order']=qs['sort'](_0x2226d9['query'][_0xe1ba('0x43')]);_0x44388d[_0xe1ba('0x44')]=qs[_0xe1ba('0x45')](_['pick'](_0x2226d9[_0xe1ba('0x3b')],_0x784e97[_0xe1ba('0x45')]),_0x111e37);if(_0x2226d9[_0xe1ba('0x3b')][_0xe1ba('0x46')]){_0x44388d['where']=_[_0xe1ba('0x47')](_0x44388d[_0xe1ba('0x44')],{'$or':_[_0xe1ba('0x34')](_0x111e37,function(_0x1cfe5f){if(_0x1cfe5f[_0xe1ba('0x38')]!=='VIRTUAL'){var _0x58beaa={};_0x58beaa[_0x1cfe5f[_0xe1ba('0x31')]]={'$like':'%'+_0x2226d9[_0xe1ba('0x3b')][_0xe1ba('0x46')]+'%'};return _0x58beaa;}})});}_0x44388d=_[_0xe1ba('0x47')]({},_0x44388d,_0x2226d9[_0xe1ba('0x48')]);var _0x2d4878={'where':_0x44388d[_0xe1ba('0x44')]};return db[_0xe1ba('0x35')][_0xe1ba('0x26')](_0x2d4878)[_0xe1ba('0x2c')](function(_0x595f6d){_0x2badc3[_0xe1ba('0x26')]=_0x595f6d;if(_0x2226d9[_0xe1ba('0x3b')][_0xe1ba('0x49')]){_0x44388d[_0xe1ba('0x4a')]=[{'all':!![]}];}return db[_0xe1ba('0x35')][_0xe1ba('0x4b')](_0x44388d);})[_0xe1ba('0x2c')](function(_0x1a23bb){_0x2badc3[_0xe1ba('0x4c')]=_0x1a23bb;return _0x2badc3;})[_0xe1ba('0x2c')](respondWithFilteredResult(_0x1449aa,_0x44388d))[_0xe1ba('0x4d')](handleError(_0x1449aa,null));};exports[_0xe1ba('0x4e')]=function(_0x4d158a,_0x1af5d2){var _0x3d3113={'raw':!![],'where':{'id':_0x4d158a['params']['id']}},_0xf11017={};_0xf11017[_0xe1ba('0x3a')]=_[_0xe1ba('0x3c')](db[_0xe1ba('0x35')][_0xe1ba('0x36')]);_0xf11017[_0xe1ba('0x3b')]=_[_0xe1ba('0x3c')](_0x4d158a[_0xe1ba('0x3b')]);_0xf11017[_0xe1ba('0x45')]=_[_0xe1ba('0x3d')](_0xf11017[_0xe1ba('0x3a')],_0xf11017[_0xe1ba('0x3b')]);_0x3d3113[_0xe1ba('0x3f')]=_[_0xe1ba('0x3d')](_0xf11017[_0xe1ba('0x3a')],qs[_0xe1ba('0x3e')](_0x4d158a[_0xe1ba('0x3b')]['fields']));_0x3d3113['attributes']=_0x3d3113['attributes'][_0xe1ba('0x40')]?_0x3d3113[_0xe1ba('0x3f')]:_0xf11017['model'];if(_0x4d158a[_0xe1ba('0x3b')]['includeAll']){_0x3d3113[_0xe1ba('0x4a')]=[{'all':!![]}];}_0x3d3113=_[_0xe1ba('0x47')]({},_0x3d3113,_0x4d158a[_0xe1ba('0x48')]);return db[_0xe1ba('0x35')]['find'](_0x3d3113)[_0xe1ba('0x2c')](handleEntityNotFound(_0x1af5d2,null))['then'](respondWithResult(_0x1af5d2,null))[_0xe1ba('0x4d')](handleError(_0x1af5d2,null));};exports[_0xe1ba('0x4f')]=function(_0x328a7e,_0x4f973e){return db[_0xe1ba('0x35')][_0xe1ba('0x4f')](_0x328a7e[_0xe1ba('0x50')],{})[_0xe1ba('0x2c')](function(_0x1514c2){var _0x42b167=_0x328a7e[_0xe1ba('0x51')]['get']({'plain':!![]});if(!_0x42b167)throw new Error(_0xe1ba('0x52'));if(_0x42b167[_0xe1ba('0x53')]===_0xe1ba('0x51')){var _0x3a2545=_0x1514c2[_0xe1ba('0x54')]({'plain':!![]});var _0x4753ce=_0xe1ba('0x2e');return db['UserProfileSection'][_0xe1ba('0x55')]({'where':{'name':_0x4753ce,'userProfileId':_0x42b167[_0xe1ba('0x56')]},'raw':!![]})[_0xe1ba('0x2c')](function(_0x3f7dfa){if(_0x3f7dfa&&_0x3f7dfa['autoAssociation']===0x0){return db[_0xe1ba('0x57')][_0xe1ba('0x4f')]({'name':_0x3a2545[_0xe1ba('0x31')],'resourceId':_0x3a2545['id'],'type':_0x3f7dfa[_0xe1ba('0x31')],'sectionId':_0x3f7dfa['id']},{})[_0xe1ba('0x2c')](function(){return _0x1514c2;});}else{return _0x1514c2;}})[_0xe1ba('0x4d')](function(_0x3371e9){logger[_0xe1ba('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3371e9);throw _0x3371e9;});}return _0x1514c2;})[_0xe1ba('0x2c')](respondWithResult(_0x4f973e,0xc9))[_0xe1ba('0x4d')](handleError(_0x4f973e,null));};exports[_0xe1ba('0x2b')]=function(_0x681bad,_0x1d0b07){if(_0x681bad[_0xe1ba('0x50')]['id']){delete _0x681bad[_0xe1ba('0x50')]['id'];}return db['SmsQueue'][_0xe1ba('0x55')]({'where':{'id':_0x681bad[_0xe1ba('0x58')]['id']}})[_0xe1ba('0x2c')](handleEntityNotFound(_0x1d0b07,null))[_0xe1ba('0x2c')](saveUpdates(_0x681bad[_0xe1ba('0x50')],null))[_0xe1ba('0x2c')](respondWithResult(_0x1d0b07,null))[_0xe1ba('0x4d')](handleError(_0x1d0b07,null));};exports[_0xe1ba('0x2d')]=function(_0x137ad2,_0x3c8ec4){return db[_0xe1ba('0x35')][_0xe1ba('0x55')]({'where':{'id':_0x137ad2[_0xe1ba('0x58')]['id']}})[_0xe1ba('0x2c')](handleEntityNotFound(_0x3c8ec4,null))[_0xe1ba('0x2c')](removeEntity(_0x3c8ec4,null))[_0xe1ba('0x4d')](handleError(_0x3c8ec4,null));};exports[_0xe1ba('0x59')]=function(_0x2cd388,_0x583866){return db[_0xe1ba('0x35')][_0xe1ba('0x59')]()[_0xe1ba('0x2c')](respondWithResult(_0x583866,null))['catch'](handleError(_0x583866,null));};exports[_0xe1ba('0x5a')]=function(_0x3c0dda,_0x4bede7,_0x1143f7){var _0x450f97={'raw':!![],'where':{}},_0x1a48ab={},_0x2728d3;return db[_0xe1ba('0x35')][_0xe1ba('0x5b')]({'where':{'id':_0x3c0dda[_0xe1ba('0x58')]['id']}})['then'](handleEntityNotFound(_0x4bede7,null))[_0xe1ba('0x2c')](function(_0x4318c7){if(_0x4318c7){_0x2728d3=_0x4318c7['get']({'plain':!![]});_0x1a48ab[_0xe1ba('0x3a')]=_['keys'](db[_0xe1ba('0x5c')][_0xe1ba('0x36')]);_0x1a48ab['query']=_[_0xe1ba('0x3c')](_0x3c0dda['query']);_0x1a48ab[_0xe1ba('0x45')]=_['intersection'](_0x1a48ab[_0xe1ba('0x3a')],_0x1a48ab[_0xe1ba('0x3b')]);_0x450f97['attributes']=_[_0xe1ba('0x3d')](_0x1a48ab[_0xe1ba('0x3a')],qs[_0xe1ba('0x3e')](_0x3c0dda[_0xe1ba('0x3b')]['fields']));_0x450f97[_0xe1ba('0x3f')]=_0x450f97[_0xe1ba('0x3f')][_0xe1ba('0x40')]?_0x450f97[_0xe1ba('0x3f')]:_0x1a48ab[_0xe1ba('0x3a')];if(!_0x3c0dda['query'][_0xe1ba('0x41')](_0xe1ba('0x42'))){_0x450f97['limit']=qs[_0xe1ba('0x25')](_0x3c0dda[_0xe1ba('0x3b')][_0xe1ba('0x25')]);_0x450f97['offset']=qs['offset'](_0x3c0dda[_0xe1ba('0x3b')][_0xe1ba('0x24')]);}_0x450f97[_0xe1ba('0x5d')]=qs[_0xe1ba('0x43')](_0x3c0dda[_0xe1ba('0x3b')]['sort']);_0x450f97[_0xe1ba('0x44')]=qs['filters'](_['pick'](_0x3c0dda[_0xe1ba('0x3b')],_0x1a48ab['filters']));_0x450f97[_0xe1ba('0x44')][_0xe1ba('0x5e')]=_0x4318c7['id'];if(_0x3c0dda[_0xe1ba('0x3b')]['filter']){_0x450f97[_0xe1ba('0x44')]=_['merge'](_0x450f97[_0xe1ba('0x44')],{'$or':_[_0xe1ba('0x34')](_0x450f97[_0xe1ba('0x3f')],function(_0x3b0e7d){var _0x5fc85b={};_0x5fc85b[_0x3b0e7d]={'$like':'%'+_0x3c0dda[_0xe1ba('0x3b')][_0xe1ba('0x46')]+'%'};return _0x5fc85b;})});}_0x450f97=_[_0xe1ba('0x47')]({},_0x450f97,_0x3c0dda[_0xe1ba('0x48')]);return db[_0xe1ba('0x5c')][_0xe1ba('0x4b')](_0x450f97);}})[_0xe1ba('0x2c')](function(_0x4d35ba){if(_0x4d35ba){return db[_0xe1ba('0x5f')][_0xe1ba('0x60')]({'where':{'id':_[_0xe1ba('0x34')](_0x4d35ba,_0xe1ba('0x61')),'role':_0xe1ba('0x62')},'attributes':['id',_0xe1ba('0x31'),_0xe1ba('0x63'),_0xe1ba('0x64'),_0xe1ba('0x65')]});}})[_0xe1ba('0x2c')](function(_0xcdfed9){if(_0xcdfed9){return{'count':_0xcdfed9['count'],'rows':_[_0xe1ba('0x34')](_0xcdfed9[_0xe1ba('0x4c')],function(_0x231e38){return{'membername':_0x231e38['name'],'UserId':_0x231e38['id'],'queue_name':_0x2728d3[_0xe1ba('0x31')],'SmsQueueId':_0x2728d3['id'],'interface':util[_0xe1ba('0x66')]('%s/%s',_0xe1ba('0x67'),_0x231e38['name']),'penalty':0x0,'paused':_0x231e38['smsPause'],'createdAt':_0x231e38[_0xe1ba('0x65')],'updatedAt':_0x231e38[_0xe1ba('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe1ba('0x2c')](respondWithFilteredResult(_0x4bede7,_0x450f97))['catch'](handleError(_0x4bede7,null));};exports[_0xe1ba('0x68')]=function(_0x16c616,_0x3b5db1,_0x4a5c34){var _0x378d9d={};var _0x439eb1={};var _0xeaf655;var _0x5aa476;return db['SmsQueue']['findOne']({'where':{'id':_0x16c616[_0xe1ba('0x58')]['id']}})[_0xe1ba('0x2c')](handleEntityNotFound(_0x3b5db1,null))[_0xe1ba('0x2c')](function(_0x5b9378){if(_0x5b9378){_0xeaf655=_0x5b9378;_0x439eb1[_0xe1ba('0x3a')]=_[_0xe1ba('0x3c')](db[_0xe1ba('0x69')][_0xe1ba('0x36')]);_0x439eb1[_0xe1ba('0x3b')]=_[_0xe1ba('0x3c')](_0x16c616[_0xe1ba('0x3b')]);_0x439eb1[_0xe1ba('0x45')]=_['intersection'](_0x439eb1[_0xe1ba('0x3a')],_0x439eb1[_0xe1ba('0x3b')]);_0x378d9d[_0xe1ba('0x3f')]=_['intersection'](_0x439eb1[_0xe1ba('0x3a')],qs['fields'](_0x16c616['query'][_0xe1ba('0x3e')]));_0x378d9d[_0xe1ba('0x3f')]=_0x378d9d[_0xe1ba('0x3f')][_0xe1ba('0x40')]?_0x378d9d[_0xe1ba('0x3f')]:_0x439eb1['model'];_0x378d9d[_0xe1ba('0x5d')]=qs[_0xe1ba('0x43')](_0x16c616[_0xe1ba('0x3b')][_0xe1ba('0x43')]);_0x378d9d[_0xe1ba('0x44')]=qs['filters'](_[_0xe1ba('0x6a')](_0x16c616[_0xe1ba('0x3b')],_0x439eb1[_0xe1ba('0x45')]));if(_0x16c616[_0xe1ba('0x3b')][_0xe1ba('0x46')]){_0x378d9d[_0xe1ba('0x44')]=_[_0xe1ba('0x47')](_0x378d9d['where'],{'$or':_[_0xe1ba('0x34')](_0x378d9d[_0xe1ba('0x3f')],function(_0x16b7e8){var _0x4a2df3={};_0x4a2df3[_0x16b7e8]={'$like':'%'+_0x16c616[_0xe1ba('0x3b')][_0xe1ba('0x46')]+'%'};return _0x4a2df3;})});}_0x378d9d=_[_0xe1ba('0x47')]({},_0x378d9d,_0x16c616[_0xe1ba('0x48')]);return _0xeaf655['getTeams'](_0x378d9d);}})['then'](function(_0x5c664f){if(_0x5c664f){_0x5aa476=_0x5c664f['length'];if(!_0x16c616[_0xe1ba('0x3b')][_0xe1ba('0x41')](_0xe1ba('0x42'))){_0x378d9d[_0xe1ba('0x25')]=qs['limit'](_0x16c616[_0xe1ba('0x3b')][_0xe1ba('0x25')]);_0x378d9d[_0xe1ba('0x24')]=qs[_0xe1ba('0x24')](_0x16c616[_0xe1ba('0x3b')][_0xe1ba('0x24')]);}return _0xeaf655[_0xe1ba('0x68')](_0x378d9d);}})[_0xe1ba('0x2c')](function(_0x28461f){if(_0x28461f){return _0x28461f?{'count':_0x5aa476,'rows':_0x28461f}:null;}})[_0xe1ba('0x2c')](respondWithResult(_0x3b5db1,null))[_0xe1ba('0x4d')](handleError(_0x3b5db1,null));};exports[_0xe1ba('0x6b')]=function(_0x182bd9,_0x4bca53,_0x3e19f0){var _0x23e9ee=_0x182bd9[_0xe1ba('0x50')][_0xe1ba('0x6c')];return db['Team'][_0xe1ba('0x4b')]({'where':{'id':_0x23e9ee},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe1ba('0x6d'),'attributes':['id',_0xe1ba('0x31'),_0xe1ba('0x6e'),_0xe1ba('0x6f'),_0xe1ba('0x70')],'raw':!![]}]})[_0xe1ba('0x2c')](function(_0x5f17a1){if(_0x5f17a1){var _0x31bfee=_[_0xe1ba('0x71')](_0x5f17a1,function(_0x155e9e){var _0x143d8e=_0x155e9e[_0xe1ba('0x54')]({'plain':!![]});return _0x143d8e[_0xe1ba('0x6d')];});return db['SmsQueue'][_0xe1ba('0x55')]({'where':{'id':_0x182bd9[_0xe1ba('0x58')]['id']}})[_0xe1ba('0x2c')](function(_0x2aec01){return db[_0xe1ba('0x72')][_0xe1ba('0x73')](function(_0x225ff2){return _0x2aec01[_0xe1ba('0x6b')](_0x23e9ee,{'transaction':_0x225ff2})[_0xe1ba('0x2c')](function(){return BPromise[_0xe1ba('0x74')](_0x31bfee,function(_0x21d50a){return db[_0xe1ba('0x5c')][_0xe1ba('0x75')]({'where':{'UserId':_0x21d50a['id'],'SmsQueueId':_0x182bd9[_0xe1ba('0x58')]['id']},'transaction':_0x225ff2});});})[_0xe1ba('0x2c')](function(){_0x31bfee['forEach'](function(_0x165ec9){socket['emit']('userSmsQueue:save',{'UserId':_0x165ec9['id'],'SmsQueueId':_0x2aec01['id']});});});});});}})['then'](respondWithStatusCode(_0x4bca53,null))[_0xe1ba('0x4d')](handleError(_0x4bca53,null));};exports[_0xe1ba('0x76')]=function(_0x3c13cd,_0x4b4cb2,_0x1ba10a){return db[_0xe1ba('0x69')][_0xe1ba('0x4b')]({'where':{'id':_0x3c13cd[_0xe1ba('0x3b')][_0xe1ba('0x6c')]},'attributes':['id'],'include':[{'model':db[_0xe1ba('0x5f')],'as':_0xe1ba('0x6d'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4b4cb2,null))[_0xe1ba('0x2c')](function(_0xdba57d){var _0x4ec8ec=_['map'](_0xdba57d,'id');var _0x23da8b=[];var _0x47f2db=[];var _0x1a40ca=squel[_0xe1ba('0x77')]();_0x1a40ca[_0xe1ba('0x78')](_0xe1ba('0x79'))[_0xe1ba('0x7a')](_0xe1ba('0x7b'),'tq')[_0xe1ba('0x7c')](_0xe1ba('0x7d'),'ut',_0xe1ba('0x7e'))['where'](_0xe1ba('0x7f'),_0x3c13cd[_0xe1ba('0x58')]['id']);for(var _0x1b304b=0x0;_0x1b304b<_0xdba57d[_0xe1ba('0x40')];_0x1b304b+=0x1){let _0x54d344=_0xdba57d[_0x1b304b];for(var _0x33bfd5=0x0;_0x33bfd5<_0x54d344[_0xe1ba('0x6d')][_0xe1ba('0x40')];_0x33bfd5+=0x1){let _0x3e17f9=_0x54d344[_0xe1ba('0x6d')][_0x33bfd5];var _0x4035e4=_0x1a40ca[_0xe1ba('0x80')]();_0x4035e4['where'](_0xe1ba('0x81'),_0x3e17f9['id']);_0x47f2db['push'](db[_0xe1ba('0x72')]['query'](_0x4035e4[_0xe1ba('0x82')](),{'type':db[_0xe1ba('0x72')][_0xe1ba('0x83')][_0xe1ba('0x84')]})['then'](function(_0x7aae03){if(_0x7aae03['length']===0x1){return _0x3e17f9['id'];}else{var _0xeaac67=_[_0xe1ba('0x85')](_[_0xe1ba('0x34')](_0x7aae03,_0xe1ba('0x86')),function(_0x51af0b){return _['includes'](_0x4ec8ec,_0x51af0b);});if(_0xeaac67){return _0x3e17f9['id'];}}}));}}return BPromise[_0xe1ba('0x87')](_0x47f2db)[_0xe1ba('0x2c')](function(_0xa78d4f){_0x23da8b=_(_0x23da8b)[_0xe1ba('0x88')](_0xa78d4f)[_0xe1ba('0x89')]()[_0xe1ba('0x8a')]();return db[_0xe1ba('0x35')]['find']({'where':{'id':_0x3c13cd['params']['id']}})[_0xe1ba('0x2c')](function(_0x4cda15){return db[_0xe1ba('0x72')][_0xe1ba('0x73')](function(_0x507a6f){return _0x4cda15[_0xe1ba('0x76')](_0x3c13cd[_0xe1ba('0x3b')]['ids'],{'transaction':_0x507a6f})[_0xe1ba('0x2c')](function(){if(!_['isEmpty'](_0x23da8b)){return _0x4cda15['removeAgents'](_0x23da8b,{'transaction':_0x507a6f});}})[_0xe1ba('0x2c')](function(){_0x23da8b['forEach'](function(_0x4bb2f5){socket[_0xe1ba('0x8b')](_0xe1ba('0x8c'),{'UserId':_0x4bb2f5,'SmsQueueId':_0x4cda15['id']});});});});});});})[_0xe1ba('0x2c')](respondWithStatusCode(_0x4b4cb2,null))[_0xe1ba('0x4d')](handleError(_0x4b4cb2,null));};exports[_0xe1ba('0x8d')]=function(_0x25a7d4,_0x39c0ff,_0x39de72){return db[_0xe1ba('0x35')][_0xe1ba('0x55')]({'where':{'id':_0x25a7d4[_0xe1ba('0x58')]['id']}})[_0xe1ba('0x2c')](handleEntityNotFound(_0x39c0ff,null))[_0xe1ba('0x2c')](function(_0x31a39c){if(_0x31a39c){return _0x31a39c[_0xe1ba('0x8d')](_0x25a7d4['body'][_0xe1ba('0x6c')],_[_0xe1ba('0x8e')](_0x25a7d4['body'],['ids','id'])||{})[_0xe1ba('0x8f')](function(_0x486bd1){for(var _0x376920=0x0;_0x376920<_0x25a7d4[_0xe1ba('0x50')]['ids'][_0xe1ba('0x40')];_0x376920+=0x1){socket[_0xe1ba('0x8b')]('userSmsQueue:save',{'UserId':Number(_0x25a7d4['body']['ids'][_0x376920]),'SmsQueueId':Number(_0x25a7d4[_0xe1ba('0x58')]['id'])});}return _0x486bd1;});}})['then'](respondWithResult(_0x39c0ff,null))[_0xe1ba('0x4d')](handleError(_0x39c0ff,null));};exports[_0xe1ba('0x90')]=function(_0x3a473b,_0xb61289,_0x59b7c0){return db[_0xe1ba('0x35')][_0xe1ba('0x55')]({'where':{'id':_0x3a473b[_0xe1ba('0x58')]['id']}})[_0xe1ba('0x2c')](handleEntityNotFound(_0xb61289,null))[_0xe1ba('0x2c')](function(_0x57b5de){if(_0x57b5de){return _0x57b5de['removeAgents'](_0x3a473b[_0xe1ba('0x3b')]['ids'])[_0xe1ba('0x2c')](function(){if(_[_0xe1ba('0x91')](_0x3a473b['query'][_0xe1ba('0x6c')])){for(var _0x54603e=0x0;_0x54603e<_0x3a473b[_0xe1ba('0x3b')]['ids']['length'];_0x54603e+=0x1){socket[_0xe1ba('0x8b')](_0xe1ba('0x8c'),{'UserId':Number(_0x3a473b[_0xe1ba('0x3b')][_0xe1ba('0x6c')][_0x54603e]),'SmsQueueId':Number(_0x3a473b[_0xe1ba('0x58')]['id'])});}}else{socket[_0xe1ba('0x8b')](_0xe1ba('0x8c'),{'UserId':Number(_0x3a473b['query'][_0xe1ba('0x6c')]),'SmsQueueId':Number(_0x3a473b['params']['id'])});}});}})[_0xe1ba('0x2c')](respondWithStatusCode(_0xb61289,null))[_0xe1ba('0x4d')](handleError(_0xb61289,null));};exports[_0xe1ba('0x92')]=function(_0x1763c3,_0x332a0f,_0x5252a9){var _0x5e1a00={};var _0x56d6d7={};var _0x131685;var _0x2db573;return db[_0xe1ba('0x35')][_0xe1ba('0x5b')]({'where':{'id':_0x1763c3[_0xe1ba('0x58')]['id']}})[_0xe1ba('0x2c')](handleEntityNotFound(_0x332a0f,null))[_0xe1ba('0x2c')](function(_0x16af09){if(_0x16af09){_0x131685=_0x16af09;_0x56d6d7[_0xe1ba('0x3a')]=_[_0xe1ba('0x3c')](db[_0xe1ba('0x5f')][_0xe1ba('0x36')]);_0x56d6d7[_0xe1ba('0x3b')]=_['keys'](_0x1763c3[_0xe1ba('0x3b')]);_0x56d6d7[_0xe1ba('0x45')]=_['intersection'](_0x56d6d7[_0xe1ba('0x3a')],_0x56d6d7[_0xe1ba('0x3b')]);_0x5e1a00[_0xe1ba('0x3f')]=_[_0xe1ba('0x3d')](_0x56d6d7[_0xe1ba('0x3a')],qs[_0xe1ba('0x3e')](_0x1763c3[_0xe1ba('0x3b')][_0xe1ba('0x3e')]));_0x5e1a00[_0xe1ba('0x3f')]=_0x5e1a00[_0xe1ba('0x3f')][_0xe1ba('0x40')]?_0x5e1a00['attributes']:_0x56d6d7[_0xe1ba('0x3a')];_0x5e1a00[_0xe1ba('0x5d')]=qs[_0xe1ba('0x43')](_0x1763c3[_0xe1ba('0x3b')]['sort']);_0x5e1a00[_0xe1ba('0x44')]=qs[_0xe1ba('0x45')](_[_0xe1ba('0x6a')](_0x1763c3[_0xe1ba('0x3b')],_0x56d6d7['filters']));if(_0x1763c3[_0xe1ba('0x3b')][_0xe1ba('0x46')]){_0x5e1a00['where']=_['merge'](_0x5e1a00['where'],{'$or':_[_0xe1ba('0x34')](_0x5e1a00['attributes'],function(_0x57ad03){var _0x4e1836={};_0x4e1836[_0x57ad03]={'$like':'%'+_0x1763c3[_0xe1ba('0x3b')][_0xe1ba('0x46')]+'%'};return _0x4e1836;})});}_0x5e1a00=_['merge']({},_0x5e1a00,_0x1763c3['options']);return _0x131685['getAgents'](_0x5e1a00);}})[_0xe1ba('0x2c')](function(_0x483217){if(_0x483217){_0x2db573=_0x483217['length'];if(!_0x1763c3[_0xe1ba('0x3b')][_0xe1ba('0x41')](_0xe1ba('0x42'))){_0x5e1a00[_0xe1ba('0x25')]=qs[_0xe1ba('0x25')](_0x1763c3[_0xe1ba('0x3b')][_0xe1ba('0x25')]);_0x5e1a00['offset']=qs['offset'](_0x1763c3[_0xe1ba('0x3b')][_0xe1ba('0x24')]);}return _0x131685['getAgents'](_0x5e1a00);}})[_0xe1ba('0x2c')](function(_0x4569c6){if(_0x4569c6){return _0x4569c6?{'count':_0x2db573,'rows':_0x4569c6}:null;}})[_0xe1ba('0x2c')](respondWithResult(_0x332a0f,null))[_0xe1ba('0x4d')](handleError(_0x332a0f,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 8932e38..cfbd750 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 _0xaad8=['exports','events','../../mysqldb','SmsQueue','setMaxListeners','save','update','remove','emit'];(function(_0x411fc5,_0x3f712a){var _0x3d9914=function(_0x3cac05){while(--_0x3cac05){_0x411fc5['push'](_0x411fc5['shift']());}};_0x3d9914(++_0x3f712a);}(_0xaad8,0x1e7));var _0x8aad=function(_0x4ae138,_0x1c3ae0){_0x4ae138=_0x4ae138-0x0;var _0x3736f6=_0xaad8[_0x4ae138];return _0x3736f6;};'use strict';var EventEmitter=require(_0x8aad('0x0'));var SmsQueue=require(_0x8aad('0x1'))['db'][_0x8aad('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x8aad('0x3')](0x0);var events={'afterCreate':_0x8aad('0x4'),'afterUpdate':_0x8aad('0x5'),'afterDestroy':_0x8aad('0x6')};function emitEvent(_0xd5f340){return function(_0x575d63,_0x13e171,_0x41f1b5){SmsQueueEvents[_0x8aad('0x7')](_0xd5f340+':'+_0x575d63['id'],_0x575d63);SmsQueueEvents['emit'](_0xd5f340,_0x575d63);_0x41f1b5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x8aad('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0xf466=['update','remove','emit','hook','events','../../mysqldb','SmsQueue','save'];(function(_0x59947d,_0x27ad58){var _0x4b59e0=function(_0x3f996a){while(--_0x3f996a){_0x59947d['push'](_0x59947d['shift']());}};_0x4b59e0(++_0x27ad58);}(_0xf466,0x6c));var _0x6f46=function(_0x46e182,_0x1046a8){_0x46e182=_0x46e182-0x0;var _0x42ade0=_0xf466[_0x46e182];return _0x42ade0;};'use strict';var EventEmitter=require(_0x6f46('0x0'));var SmsQueue=require(_0x6f46('0x1'))['db'][_0x6f46('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6f46('0x3'),'afterUpdate':_0x6f46('0x4'),'afterDestroy':_0x6f46('0x5')};function emitEvent(_0x177e48){return function(_0x55f577,_0x29d6ec,_0x3cb2a1){SmsQueueEvents[_0x6f46('0x6')](_0x177e48+':'+_0x55f577['id'],_0x55f577);SmsQueueEvents[_0x6f46('0x6')](_0x177e48,_0x55f577);_0x3cb2a1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x6f46('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 38aa092..692826a 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 _0xdfa6=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsQueue.attributes','define','SmsQueue','sms_queues','lodash','util'];(function(_0x102f97,_0x5bda2f){var _0xd22058=function(_0x2ccc1f){while(--_0x2ccc1f){_0x102f97['push'](_0x102f97['shift']());}};_0xd22058(++_0x5bda2f);}(_0xdfa6,0xc1));var _0x6dfa=function(_0x2a5498,_0x456b85){_0x2a5498=_0x2a5498-0x0;var _0x35aa01=_0xdfa6[_0x2a5498];return _0x35aa01;};'use strict';var _=require(_0x6dfa('0x0'));var util=require(_0x6dfa('0x1'));var logger=require(_0x6dfa('0x2'))(_0x6dfa('0x3'));var moment=require(_0x6dfa('0x4'));var BPromise=require(_0x6dfa('0x5'));var rp=require(_0x6dfa('0x6'));var fs=require('fs');var path=require(_0x6dfa('0x7'));var rimraf=require(_0x6dfa('0x8'));var config=require('../../config/environment');var attributes=require(_0x6dfa('0x9'));module['exports']=function(_0x40a6aa,_0x48b077){return _0x40a6aa[_0x6dfa('0xa')](_0x6dfa('0xb'),attributes,{'tableName':_0x6dfa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc55=['bluebird','rimraf','../../config/environment','exports','define','sms_queues','util','../../config/logger','api','moment'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xdc55,0x150));var _0x5dc5=function(_0x5a7e78,_0x52d16a){_0x5a7e78=_0x5a7e78-0x0;var _0x1b4317=_0xdc55[_0x5a7e78];return _0x1b4317;};'use strict';var _=require('lodash');var util=require(_0x5dc5('0x0'));var logger=require(_0x5dc5('0x1'))(_0x5dc5('0x2'));var moment=require(_0x5dc5('0x3'));var BPromise=require(_0x5dc5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5dc5('0x5'));var config=require(_0x5dc5('0x6'));var attributes=require('./smsQueue.attributes');module[_0x5dc5('0x7')]=function(_0x1fa4c0,_0x736404){return _0x1fa4c0[_0x5dc5('0x8')]('SmsQueue',attributes,{'tableName':_0x5dc5('0x9'),'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 4643bab..7d2c770 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 _0x9cd3=['localhost','./smsQueue.socket','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','GetSmsQueue','SmsQueue','options','raw','where','attributes','map','include','model','then','ShowSmsQueue','find','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults'];(function(_0x140f10,_0x1b4e87){var _0x4120a0=function(_0x51891c){while(--_0x51891c){_0x140f10['push'](_0x140f10['shift']());}};_0x4120a0(++_0x1b4e87);}(_0x9cd3,0xb5));var _0x39cd=function(_0x58d5ac,_0x11c4bc){_0x58d5ac=_0x58d5ac-0x0;var _0x37985c=_0x9cd3[_0x58d5ac];return _0x37985c;};'use strict';var _=require(_0x39cd('0x0'));var util=require(_0x39cd('0x1'));var moment=require(_0x39cd('0x2'));var BPromise=require(_0x39cd('0x3'));var rs=require(_0x39cd('0x4'));var fs=require('fs');var Redis=require(_0x39cd('0x5'));var db=require(_0x39cd('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x39cd('0x7'))(_0x39cd('0x8'));var config=require('../../config/environment');var jayson=require(_0x39cd('0x9'));var client=jayson[_0x39cd('0xa')][_0x39cd('0xb')]({'port':0x232a});config[_0x39cd('0xc')]=_[_0x39cd('0xd')](config[_0x39cd('0xc')],{'host':_0x39cd('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x39cd('0xc')]));require(_0x39cd('0xf'))['register'](socket);function respondWithRpcPromise(_0x2dbd19,_0x37e682,_0x5b7da6){return new BPromise(function(_0x3427e0,_0x29fc6a){return client[_0x39cd('0x10')](_0x2dbd19,_0x5b7da6)['then'](function(_0x3348e5){logger[_0x39cd('0x11')](_0x39cd('0x12'),_0x37e682,_0x39cd('0x13'));logger[_0x39cd('0x14')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x37e682,'request\x20sent',JSON[_0x39cd('0x15')](_0x3348e5));if(_0x3348e5['error']){if(_0x3348e5['error'][_0x39cd('0x16')]===0x1f4){logger['error'](_0x39cd('0x12'),_0x37e682,_0x3348e5[_0x39cd('0x17')][_0x39cd('0x18')]);return _0x29fc6a(_0x3348e5[_0x39cd('0x17')][_0x39cd('0x18')]);}logger['error'](_0x39cd('0x12'),_0x37e682,_0x3348e5[_0x39cd('0x17')]['message']);return _0x3427e0(_0x3348e5[_0x39cd('0x17')][_0x39cd('0x18')]);}else{logger[_0x39cd('0x11')]('SmsQueue,\x20%s,\x20%s',_0x37e682,_0x39cd('0x13'));_0x3427e0(_0x3348e5[_0x39cd('0x19')][_0x39cd('0x18')]);}})['catch'](function(_0x35ba7d){logger[_0x39cd('0x17')](_0x39cd('0x12'),_0x37e682,_0x35ba7d);_0x29fc6a(_0x35ba7d);});});}exports[_0x39cd('0x1a')]=function(_0x1cca5c){var _0x52e1db=this;return new Promise(function(_0x21f059,_0x5dabfa){return db[_0x39cd('0x1b')]['findAll']({'raw':_0x1cca5c[_0x39cd('0x1c')]?_0x1cca5c[_0x39cd('0x1c')][_0x39cd('0x1d')]===undefined?!![]:![]:!![],'where':_0x1cca5c[_0x39cd('0x1c')]?_0x1cca5c['options'][_0x39cd('0x1e')]||null:null,'attributes':_0x1cca5c[_0x39cd('0x1c')]?_0x1cca5c[_0x39cd('0x1c')][_0x39cd('0x1f')]||null:null,'limit':_0x1cca5c[_0x39cd('0x1c')]?_0x1cca5c['options']['limit']||null:null,'include':_0x1cca5c[_0x39cd('0x1c')]?_0x1cca5c['options']['include']?_[_0x39cd('0x20')](_0x1cca5c[_0x39cd('0x1c')][_0x39cd('0x21')],function(_0x1d703b){return{'model':db[_0x1d703b['model']],'as':_0x1d703b['as'],'attributes':_0x1d703b[_0x39cd('0x1f')],'include':_0x1d703b[_0x39cd('0x21')]?_[_0x39cd('0x20')](_0x1d703b[_0x39cd('0x21')],function(_0xe4f444){return{'model':db[_0xe4f444[_0x39cd('0x22')]],'as':_0xe4f444['as'],'attributes':_0xe4f444[_0x39cd('0x1f')],'include':_0xe4f444[_0x39cd('0x21')]?_[_0x39cd('0x20')](_0xe4f444[_0x39cd('0x21')],function(_0x4dbea5){return{'model':db[_0x4dbea5[_0x39cd('0x22')]],'as':_0x4dbea5['as'],'attributes':_0x4dbea5[_0x39cd('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x39cd('0x23')](function(_0x1b5d04){logger[_0x39cd('0x11')](_0x39cd('0x1a'),_0x1cca5c);logger['debug'](_0x39cd('0x1a'),_0x1cca5c,JSON['stringify'](_0x1b5d04));_0x21f059(_0x1b5d04);})['catch'](function(_0x1d118b){logger[_0x39cd('0x17')]('GetSmsQueue',_0x1d118b[_0x39cd('0x18')],_0x1cca5c);_0x5dabfa(_0x52e1db[_0x39cd('0x17')](0x1f4,_0x1d118b['message']));});});};exports[_0x39cd('0x24')]=function(_0x3d611b){var _0x289358=this;return new Promise(function(_0x17063a,_0x5716a2){return db[_0x39cd('0x1b')][_0x39cd('0x25')]({'raw':_0x3d611b[_0x39cd('0x1c')]?_0x3d611b[_0x39cd('0x1c')][_0x39cd('0x1d')]===undefined?!![]:![]:!![],'where':_0x3d611b['options']?_0x3d611b[_0x39cd('0x1c')][_0x39cd('0x1e')]||null:null,'attributes':_0x3d611b[_0x39cd('0x1c')]?_0x3d611b['options'][_0x39cd('0x1f')]||null:null,'include':_0x3d611b[_0x39cd('0x1c')]?_0x3d611b[_0x39cd('0x1c')][_0x39cd('0x21')]?_[_0x39cd('0x20')](_0x3d611b[_0x39cd('0x1c')][_0x39cd('0x21')],function(_0x33482c){return{'model':db[_0x33482c[_0x39cd('0x22')]],'as':_0x33482c['as'],'attributes':_0x33482c['attributes'],'include':_0x33482c[_0x39cd('0x21')]?_[_0x39cd('0x20')](_0x33482c[_0x39cd('0x21')],function(_0x4ba0f7){return{'model':db[_0x4ba0f7[_0x39cd('0x22')]],'as':_0x4ba0f7['as'],'attributes':_0x4ba0f7[_0x39cd('0x1f')],'include':_0x4ba0f7[_0x39cd('0x21')]?_[_0x39cd('0x20')](_0x4ba0f7['include'],function(_0x318248){return{'model':db[_0x318248[_0x39cd('0x22')]],'as':_0x318248['as'],'attributes':_0x318248[_0x39cd('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e1f2e){logger[_0x39cd('0x11')](_0x39cd('0x24'),_0x3d611b);logger[_0x39cd('0x14')](_0x39cd('0x24'),_0x3d611b,JSON['stringify'](_0x3e1f2e));_0x17063a(_0x3e1f2e);})[_0x39cd('0x26')](function(_0x596d7e){logger['error']('ShowSmsQueue',_0x596d7e[_0x39cd('0x18')],_0x3d611b);_0x5716a2(_0x289358[_0x39cd('0x17')](0x1f4,_0x596d7e[_0x39cd('0x18')]));});});}; \ No newline at end of file +var _0xecab=['options','raw','where','attributes','include','map','model','stringify','find','ShowSmsQueue','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetSmsQueue','SmsQueue','findAll'];(function(_0x5535c3,_0x49323b){var _0x53fafa=function(_0x43f1f9){while(--_0x43f1f9){_0x5535c3['push'](_0x5535c3['shift']());}};_0x53fafa(++_0x49323b);}(_0xecab,0x114));var _0xbeca=function(_0x11db85,_0x355e60){_0x11db85=_0x11db85-0x0;var _0x18ca37=_0xecab[_0x11db85];return _0x18ca37;};'use strict';var _=require(_0xbeca('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbeca('0x1'));var fs=require('fs');var Redis=require(_0xbeca('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xbeca('0x3'));var logger=require(_0xbeca('0x4'))(_0xbeca('0x5'));var config=require('../../config/environment');var jayson=require(_0xbeca('0x6'));var client=jayson['client'][_0xbeca('0x7')]({'port':0x232a});config[_0xbeca('0x8')]=_[_0xbeca('0x9')](config[_0xbeca('0x8')],{'host':_0xbeca('0xa'),'port':0x18eb});var socket=require(_0xbeca('0xb'))(new Redis(config[_0xbeca('0x8')]));require('./smsQueue.socket')[_0xbeca('0xc')](socket);function respondWithRpcPromise(_0xe54beb,_0x75ca7e,_0x477395){return new BPromise(function(_0x456de7,_0x4abe0d){return client[_0xbeca('0xd')](_0xe54beb,_0x477395)[_0xbeca('0xe')](function(_0x2d05b4){logger['info'](_0xbeca('0xf'),_0x75ca7e,_0xbeca('0x10'));logger[_0xbeca('0x11')](_0xbeca('0x12'),_0x75ca7e,'request\x20sent',JSON['stringify'](_0x2d05b4));if(_0x2d05b4[_0xbeca('0x13')]){if(_0x2d05b4[_0xbeca('0x13')][_0xbeca('0x14')]===0x1f4){logger[_0xbeca('0x13')]('SmsQueue,\x20%s,\x20%s',_0x75ca7e,_0x2d05b4['error'][_0xbeca('0x15')]);return _0x4abe0d(_0x2d05b4[_0xbeca('0x13')][_0xbeca('0x15')]);}logger[_0xbeca('0x13')]('SmsQueue,\x20%s,\x20%s',_0x75ca7e,_0x2d05b4[_0xbeca('0x13')][_0xbeca('0x15')]);return _0x456de7(_0x2d05b4[_0xbeca('0x13')][_0xbeca('0x15')]);}else{logger[_0xbeca('0x16')](_0xbeca('0xf'),_0x75ca7e,_0xbeca('0x10'));_0x456de7(_0x2d05b4[_0xbeca('0x17')][_0xbeca('0x15')]);}})[_0xbeca('0x18')](function(_0x119308){logger[_0xbeca('0x13')](_0xbeca('0xf'),_0x75ca7e,_0x119308);_0x4abe0d(_0x119308);});});}exports[_0xbeca('0x19')]=function(_0x27071b){var _0x2d4157=this;return new Promise(function(_0x55dbfb,_0x1aa5ca){return db[_0xbeca('0x1a')][_0xbeca('0x1b')]({'raw':_0x27071b[_0xbeca('0x1c')]?_0x27071b[_0xbeca('0x1c')][_0xbeca('0x1d')]===undefined?!![]:![]:!![],'where':_0x27071b[_0xbeca('0x1c')]?_0x27071b[_0xbeca('0x1c')][_0xbeca('0x1e')]||null:null,'attributes':_0x27071b[_0xbeca('0x1c')]?_0x27071b[_0xbeca('0x1c')][_0xbeca('0x1f')]||null:null,'limit':_0x27071b[_0xbeca('0x1c')]?_0x27071b[_0xbeca('0x1c')]['limit']||null:null,'include':_0x27071b['options']?_0x27071b[_0xbeca('0x1c')][_0xbeca('0x20')]?_[_0xbeca('0x21')](_0x27071b['options'][_0xbeca('0x20')],function(_0x329f7c){return{'model':db[_0x329f7c['model']],'as':_0x329f7c['as'],'attributes':_0x329f7c[_0xbeca('0x1f')],'include':_0x329f7c[_0xbeca('0x20')]?_[_0xbeca('0x21')](_0x329f7c[_0xbeca('0x20')],function(_0x590362){return{'model':db[_0x590362['model']],'as':_0x590362['as'],'attributes':_0x590362[_0xbeca('0x1f')],'include':_0x590362[_0xbeca('0x20')]?_['map'](_0x590362[_0xbeca('0x20')],function(_0x51d81f){return{'model':db[_0x51d81f[_0xbeca('0x22')]],'as':_0x51d81f['as'],'attributes':_0x51d81f[_0xbeca('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xbeca('0xe')](function(_0x4a7bf6){logger['info'](_0xbeca('0x19'),_0x27071b);logger['debug'](_0xbeca('0x19'),_0x27071b,JSON[_0xbeca('0x23')](_0x4a7bf6));_0x55dbfb(_0x4a7bf6);})[_0xbeca('0x18')](function(_0x1ca7d0){logger[_0xbeca('0x13')](_0xbeca('0x19'),_0x1ca7d0[_0xbeca('0x15')],_0x27071b);_0x1aa5ca(_0x2d4157['error'](0x1f4,_0x1ca7d0[_0xbeca('0x15')]));});});};exports['ShowSmsQueue']=function(_0x5797ef){var _0x3fe5c9=this;return new Promise(function(_0xd9239e,_0x490599){return db[_0xbeca('0x1a')][_0xbeca('0x24')]({'raw':_0x5797ef['options']?_0x5797ef[_0xbeca('0x1c')][_0xbeca('0x1d')]===undefined?!![]:![]:!![],'where':_0x5797ef[_0xbeca('0x1c')]?_0x5797ef[_0xbeca('0x1c')][_0xbeca('0x1e')]||null:null,'attributes':_0x5797ef['options']?_0x5797ef[_0xbeca('0x1c')][_0xbeca('0x1f')]||null:null,'include':_0x5797ef['options']?_0x5797ef['options'][_0xbeca('0x20')]?_[_0xbeca('0x21')](_0x5797ef[_0xbeca('0x1c')][_0xbeca('0x20')],function(_0xbc31b2){return{'model':db[_0xbc31b2[_0xbeca('0x22')]],'as':_0xbc31b2['as'],'attributes':_0xbc31b2[_0xbeca('0x1f')],'include':_0xbc31b2[_0xbeca('0x20')]?_['map'](_0xbc31b2[_0xbeca('0x20')],function(_0xd29671){return{'model':db[_0xd29671[_0xbeca('0x22')]],'as':_0xd29671['as'],'attributes':_0xd29671[_0xbeca('0x1f')],'include':_0xd29671['include']?_['map'](_0xd29671[_0xbeca('0x20')],function(_0x332644){return{'model':db[_0x332644[_0xbeca('0x22')]],'as':_0x332644['as'],'attributes':_0x332644[_0xbeca('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xbeca('0xe')](function(_0x12543d){logger['info']('ShowSmsQueue',_0x5797ef);logger[_0xbeca('0x11')](_0xbeca('0x25'),_0x5797ef,JSON['stringify'](_0x12543d));_0xd9239e(_0x12543d);})[_0xbeca('0x18')](function(_0x21b78a){logger['error'](_0xbeca('0x25'),_0x21b78a['message'],_0x5797ef);_0x490599(_0x3fe5c9['error'](0x1f4,_0x21b78a['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 27d2af4..e487029 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 _0x9f83=['register','length','./smsQueue.events','remove','update'];(function(_0x2eabc7,_0x3539c9){var _0xe1eb71=function(_0x18fc53){while(--_0x18fc53){_0x2eabc7['push'](_0x2eabc7['shift']());}};_0xe1eb71(++_0x3539c9);}(_0x9f83,0xa7));var _0x39f8=function(_0x2775f4,_0x1890d6){_0x2775f4=_0x2775f4-0x0;var _0x256f26=_0x9f83[_0x2775f4];return _0x256f26;};'use strict';var SmsQueueEvents=require(_0x39f8('0x0'));var events=['save',_0x39f8('0x1'),_0x39f8('0x2')];function createListener(_0x4c0634,_0x328293){return function(_0x50d08b){_0x328293['emit'](_0x4c0634,_0x50d08b);};}function removeListener(_0x6b46b0,_0x14fcd8){return function(){SmsQueueEvents['removeListener'](_0x6b46b0,_0x14fcd8);};}exports[_0x39f8('0x3')]=function(_0x604599){for(var _0x18eca7=0x0,_0x43103a=events[_0x39f8('0x4')];_0x18eca7<_0x43103a;_0x18eca7++){var _0x4610b7=events[_0x18eca7];var _0x471599=createListener('smsQueue:'+_0x4610b7,_0x604599);SmsQueueEvents['on'](_0x4610b7,_0x471599);}}; \ No newline at end of file +var _0x4266=['./smsQueue.events','save','remove','update','emit','removeListener','register','smsQueue:'];(function(_0x2e2681,_0x4089c1){var _0x368a64=function(_0x267262){while(--_0x267262){_0x2e2681['push'](_0x2e2681['shift']());}};_0x368a64(++_0x4089c1);}(_0x4266,0x150));var _0x6426=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x4266[_0x19e35c];return _0x3e1fe8;};'use strict';var SmsQueueEvents=require(_0x6426('0x0'));var events=[_0x6426('0x1'),_0x6426('0x2'),_0x6426('0x3')];function createListener(_0x3258f4,_0x460979){return function(_0x214b24){_0x460979[_0x6426('0x4')](_0x3258f4,_0x214b24);};}function removeListener(_0x1116d3,_0xbe533d){return function(){SmsQueueEvents[_0x6426('0x5')](_0x1116d3,_0xbe533d);};}exports[_0x6426('0x6')]=function(_0x585e37){for(var _0xf59543=0x0,_0x589ab3=events['length'];_0xf59543<_0x589ab3;_0xf59543++){var _0x545305=events[_0xf59543];var _0x3a984b=createListener(_0x6426('0x7')+_0x545305,_0x585e37);SmsQueueEvents['on'](_0x545305,_0x3a984b);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 20c714d..8f9d7fb 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 _0xb84b=['put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','isAuthenticated','index','/describe','describe','/:id','post','create'];(function(_0x3abe6a,_0xdd7b1a){var _0x2fc39e=function(_0x13911e){while(--_0x13911e){_0x3abe6a['push'](_0x3abe6a['shift']());}};_0x2fc39e(++_0xdd7b1a);}(_0xb84b,0x1a2));var _0xbb84=function(_0x17e03f,_0x423a73){_0x17e03f=_0x17e03f-0x0;var _0x243ee4=_0xb84b[_0x17e03f];return _0x243ee4;};'use strict';var multer=require(_0xbb84('0x0'));var util=require(_0xbb84('0x1'));var path=require(_0xbb84('0x2'));var timeout=require(_0xbb84('0x3'));var express=require('express');var router=express[_0xbb84('0x4')]();var fs_extra=require(_0xbb84('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbb84('0x6'));var controller=require('./smsQueueReport.controller');router['get']('/',auth[_0xbb84('0x7')](),controller[_0xbb84('0x8')]);router['get'](_0xbb84('0x9'),auth['isAuthenticated'](),controller[_0xbb84('0xa')]);router['get'](_0xbb84('0xb'),auth[_0xbb84('0x7')](),controller['show']);router[_0xbb84('0xc')]('/',auth[_0xbb84('0x7')](),controller[_0xbb84('0xd')]);router[_0xbb84('0xe')](_0xbb84('0xb'),auth[_0xbb84('0x7')](),controller['update']);router[_0xbb84('0xf')]('/:id',auth[_0xbb84('0x7')](),controller[_0xbb84('0x10')]);module[_0xbb84('0x11')]=router; \ No newline at end of file +var _0x805b=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x4cb834,_0x5d48ee){var _0xaf9993=function(_0x16f815){while(--_0x16f815){_0x4cb834['push'](_0x4cb834['shift']());}};_0xaf9993(++_0x5d48ee);}(_0x805b,0xad));var _0xb805=function(_0x524592,_0x8e10b6){_0x524592=_0x524592-0x0;var _0x6248e2=_0x805b[_0x524592];return _0x6248e2;};'use strict';var multer=require(_0xb805('0x0'));var util=require(_0xb805('0x1'));var path=require(_0xb805('0x2'));var timeout=require(_0xb805('0x3'));var express=require(_0xb805('0x4'));var router=express[_0xb805('0x5')]();var fs_extra=require(_0xb805('0x6'));var auth=require(_0xb805('0x7'));var interaction=require(_0xb805('0x8'));var config=require(_0xb805('0x9'));var controller=require('./smsQueueReport.controller');router[_0xb805('0xa')]('/',auth[_0xb805('0xb')](),controller['index']);router[_0xb805('0xa')](_0xb805('0xc'),auth['isAuthenticated'](),controller[_0xb805('0xd')]);router[_0xb805('0xa')](_0xb805('0xe'),auth[_0xb805('0xb')](),controller[_0xb805('0xf')]);router[_0xb805('0x10')]('/',auth[_0xb805('0xb')](),controller['create']);router['put']('/:id',auth[_0xb805('0xb')](),controller['update']);router[_0xb805('0x11')](_0xb805('0xe'),auth[_0xb805('0xb')](),controller[_0xb805('0x12')]);module[_0xb805('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 2bab13d..cc9b266 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 _0x4980=['exports','STRING','DATE','moment'];(function(_0x428174,_0x36a5a5){var _0x3ac768=function(_0xd2326){while(--_0xd2326){_0x428174['push'](_0x428174['shift']());}};_0x3ac768(++_0x36a5a5);}(_0x4980,0x1ab));var _0x0498=function(_0x12b7e3,_0x3bab06){_0x12b7e3=_0x12b7e3-0x0;var _0x131288=_0x4980[_0x12b7e3];return _0x131288;};'use strict';var moment=require(_0x0498('0x0'));var Sequelize=require('sequelize');module[_0x0498('0x1')]={'uniqueid':{'type':Sequelize[_0x0498('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x0498('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x0498('0x3')]},'acceptAt':{'type':Sequelize[_0x0498('0x3')]},'exitAt':{'type':Sequelize[_0x0498('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x54c1=['sequelize','exports','STRING','DATE','moment'];(function(_0x1a2ed1,_0x2e752c){var _0x3dcc55=function(_0x48b2ec){while(--_0x48b2ec){_0x1a2ed1['push'](_0x1a2ed1['shift']());}};_0x3dcc55(++_0x2e752c);}(_0x54c1,0x12b));var _0x154c=function(_0x4c3206,_0x58cd5){_0x4c3206=_0x4c3206-0x0;var _0x4b97bb=_0x54c1[_0x4c3206];return _0x4b97bb;};'use strict';var moment=require(_0x154c('0x0'));var Sequelize=require(_0x154c('0x1'));module[_0x154c('0x2')]={'uniqueid':{'type':Sequelize[_0x154c('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x154c('0x3')]},'joinAt':{'type':Sequelize[_0x154c('0x4')]},'leaveAt':{'type':Sequelize[_0x154c('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x154c('0x4')]},'reason':{'type':Sequelize[_0x154c('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index b0517b7..cdb21b3 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 _0x0fd8=['attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','length','find','create','body','params','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','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','undefined','limit','count','offset','set','apply','reject','save','update','then','error','stack','name','index','SmsQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection'];(function(_0x1ff171,_0x4012af){var _0x456656=function(_0x12ca4f){while(--_0x12ca4f){_0x1ff171['push'](_0x1ff171['shift']());}};_0x456656(++_0x4012af);}(_0x0fd8,0x147));var _0x80fd=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x0fd8[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x80fd('0x0'));var zipdir=require(_0x80fd('0x1'));var jsonpatch=require(_0x80fd('0x2'));var rp=require(_0x80fd('0x3'));var moment=require(_0x80fd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x80fd('0x5'));var util=require(_0x80fd('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x80fd('0x7'));var ejs=require(_0x80fd('0x8'));var fs=require('fs');var fs_extra=require(_0x80fd('0x9'));var _=require(_0x80fd('0xa'));var squel=require(_0x80fd('0xb'));var crypto=require(_0x80fd('0xc'));var jsforce=require(_0x80fd('0xd'));var deskjs=require(_0x80fd('0xe'));var toCsv=require(_0x80fd('0x7'));var querystring=require('querystring');var Papa=require(_0x80fd('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x80fd('0x10'));var as=require(_0x80fd('0x11'));var hardwareService=require(_0x80fd('0x12'));var logger=require(_0x80fd('0x13'))(_0x80fd('0x14'));var utils=require('../../config/utils');var config=require(_0x80fd('0x15'));var licenseUtil=require(_0x80fd('0x16'));var db=require(_0x80fd('0x17'))['db'];function respondWithStatusCode(_0x1a042c,_0x4a243a){_0x4a243a=_0x4a243a||0xcc;return function(_0x4d827a){if(_0x4d827a){return _0x1a042c[_0x80fd('0x18')](_0x4a243a);}return _0x1a042c[_0x80fd('0x19')](_0x4a243a)[_0x80fd('0x1a')]();};}function respondWithResult(_0x56097e,_0x3e7ebf){_0x3e7ebf=_0x3e7ebf||0xc8;return function(_0x132e92){if(_0x132e92){return _0x56097e['status'](_0x3e7ebf)[_0x80fd('0x1b')](_0x132e92);}};}function respondWithFilteredResult(_0x3af03f,_0x490822){return function(_0x4f1dea){if(_0x4f1dea){var _0x2a6921=typeof _0x490822['offset']===_0x80fd('0x1c')&&typeof _0x490822[_0x80fd('0x1d')]===_0x80fd('0x1c');var _0x35ab54=_0x4f1dea[_0x80fd('0x1e')];var _0x32b71a=_0x2a6921?0x0:_0x490822['offset'];var _0x592b10=_0x2a6921?_0x4f1dea['count']:_0x490822[_0x80fd('0x1f')]+_0x490822[_0x80fd('0x1d')];var _0xf23644;if(_0x592b10>=_0x35ab54){_0x592b10=_0x35ab54;_0xf23644=0xc8;}else{_0xf23644=0xce;}_0x3af03f[_0x80fd('0x19')](_0xf23644);return _0x3af03f[_0x80fd('0x20')]('Content-Range',_0x32b71a+'-'+_0x592b10+'/'+_0x35ab54)['json'](_0x4f1dea);}return null;};}function patchUpdates(_0x2e9d7a){return function(_0x21ed9d){try{jsonpatch[_0x80fd('0x21')](_0x21ed9d,_0x2e9d7a,!![]);}catch(_0x4c6132){return BPromise[_0x80fd('0x22')](_0x4c6132);}return _0x21ed9d[_0x80fd('0x23')]();};}function saveUpdates(_0x35bf66,_0x2ae084){return function(_0x50a9b6){if(_0x50a9b6){return _0x50a9b6[_0x80fd('0x24')](_0x35bf66)[_0x80fd('0x25')](function(_0x5a1fd0){return _0x5a1fd0;});}return null;};}function removeEntity(_0x3a0914,_0x430432){return function(_0x528f13){if(_0x528f13){return _0x528f13['destroy']()[_0x80fd('0x25')](function(){_0x3a0914[_0x80fd('0x19')](0xcc)[_0x80fd('0x1a')]();});}};}function handleEntityNotFound(_0x54da3a,_0x3d63fe){return function(_0x3ceded){if(!_0x3ceded){_0x54da3a['sendStatus'](0x194);}return _0x3ceded;};}function handleError(_0x1881c6,_0x97d648){_0x97d648=_0x97d648||0x1f4;return function(_0x19b547){logger[_0x80fd('0x26')](_0x19b547[_0x80fd('0x27')]);if(_0x19b547[_0x80fd('0x28')]){delete _0x19b547['name'];}_0x1881c6['status'](_0x97d648)['send'](_0x19b547);};}exports[_0x80fd('0x29')]=function(_0x36cae1,_0x37dc15){var _0x349090={},_0x355468={},_0x105108={'count':0x0,'rows':[]};var _0x7941b9=_['map'](db[_0x80fd('0x2a')][_0x80fd('0x2b')],function(_0x2d1de8){return{'name':_0x2d1de8[_0x80fd('0x2c')],'type':_0x2d1de8[_0x80fd('0x2d')][_0x80fd('0x2e')]};});_0x355468[_0x80fd('0x2f')]=_[_0x80fd('0x30')](_0x7941b9,_0x80fd('0x28'));_0x355468[_0x80fd('0x31')]=_[_0x80fd('0x32')](_0x36cae1['query']);_0x355468[_0x80fd('0x33')]=_[_0x80fd('0x34')](_0x355468['model'],_0x355468[_0x80fd('0x31')]);_0x349090[_0x80fd('0x35')]=_[_0x80fd('0x34')](_0x355468['model'],qs[_0x80fd('0x36')](_0x36cae1['query']['fields']));_0x349090[_0x80fd('0x35')]=_0x349090[_0x80fd('0x35')]['length']?_0x349090[_0x80fd('0x35')]:_0x355468['model'];if(!_0x36cae1[_0x80fd('0x31')][_0x80fd('0x37')](_0x80fd('0x38'))){_0x349090[_0x80fd('0x1d')]=qs[_0x80fd('0x1d')](_0x36cae1['query'][_0x80fd('0x1d')]);_0x349090[_0x80fd('0x1f')]=qs[_0x80fd('0x1f')](_0x36cae1[_0x80fd('0x31')]['offset']);}_0x349090[_0x80fd('0x39')]=qs[_0x80fd('0x3a')](_0x36cae1['query']['sort']);_0x349090[_0x80fd('0x3b')]=qs['filters'](_[_0x80fd('0x3c')](_0x36cae1[_0x80fd('0x31')],_0x355468[_0x80fd('0x33')]),_0x7941b9);if(_0x36cae1['query']['filter']){_0x349090[_0x80fd('0x3b')]=_[_0x80fd('0x3d')](_0x349090['where'],{'$or':_[_0x80fd('0x30')](_0x7941b9,function(_0x23e2ac){if(_0x23e2ac['type']!==_0x80fd('0x3e')){var _0x56fa7b={};_0x56fa7b[_0x23e2ac['name']]={'$like':'%'+_0x36cae1[_0x80fd('0x31')]['filter']+'%'};return _0x56fa7b;}})});}_0x349090=_['merge']({},_0x349090,_0x36cae1[_0x80fd('0x3f')]);var _0x103054={'where':_0x349090[_0x80fd('0x3b')]};return db[_0x80fd('0x2a')][_0x80fd('0x1e')](_0x103054)['then'](function(_0xadfc43){_0x105108[_0x80fd('0x1e')]=_0xadfc43;if(_0x36cae1['query'][_0x80fd('0x40')]){_0x349090[_0x80fd('0x41')]=[{'all':!![]}];}return db[_0x80fd('0x2a')][_0x80fd('0x42')](_0x349090);})[_0x80fd('0x25')](function(_0x1eeaa0){_0x105108[_0x80fd('0x43')]=_0x1eeaa0;return _0x105108;})[_0x80fd('0x25')](respondWithFilteredResult(_0x37dc15,_0x349090))[_0x80fd('0x44')](handleError(_0x37dc15,null));};exports['show']=function(_0x3a64cd,_0x429a0e){var _0x33e5b4={'raw':!![],'where':{'id':_0x3a64cd['params']['id']}},_0x4008d0={};_0x4008d0[_0x80fd('0x2f')]=_[_0x80fd('0x32')](db[_0x80fd('0x2a')][_0x80fd('0x2b')]);_0x4008d0[_0x80fd('0x31')]=_['keys'](_0x3a64cd[_0x80fd('0x31')]);_0x4008d0[_0x80fd('0x33')]=_[_0x80fd('0x34')](_0x4008d0[_0x80fd('0x2f')],_0x4008d0[_0x80fd('0x31')]);_0x33e5b4[_0x80fd('0x35')]=_[_0x80fd('0x34')](_0x4008d0[_0x80fd('0x2f')],qs[_0x80fd('0x36')](_0x3a64cd[_0x80fd('0x31')][_0x80fd('0x36')]));_0x33e5b4[_0x80fd('0x35')]=_0x33e5b4['attributes'][_0x80fd('0x45')]?_0x33e5b4[_0x80fd('0x35')]:_0x4008d0[_0x80fd('0x2f')];if(_0x3a64cd[_0x80fd('0x31')][_0x80fd('0x40')]){_0x33e5b4[_0x80fd('0x41')]=[{'all':!![]}];}_0x33e5b4=_['merge']({},_0x33e5b4,_0x3a64cd[_0x80fd('0x3f')]);return db[_0x80fd('0x2a')][_0x80fd('0x46')](_0x33e5b4)[_0x80fd('0x25')](handleEntityNotFound(_0x429a0e,null))[_0x80fd('0x25')](respondWithResult(_0x429a0e,null))[_0x80fd('0x44')](handleError(_0x429a0e,null));};exports['create']=function(_0x3c2e23,_0x105d9d){return db[_0x80fd('0x2a')][_0x80fd('0x47')](_0x3c2e23['body'],{})[_0x80fd('0x25')](respondWithResult(_0x105d9d,0xc9))['catch'](handleError(_0x105d9d,null));};exports[_0x80fd('0x24')]=function(_0x44911f,_0x3f1333){if(_0x44911f[_0x80fd('0x48')]['id']){delete _0x44911f[_0x80fd('0x48')]['id'];}return db[_0x80fd('0x2a')][_0x80fd('0x46')]({'where':{'id':_0x44911f[_0x80fd('0x49')]['id']}})['then'](handleEntityNotFound(_0x3f1333,null))['then'](saveUpdates(_0x44911f[_0x80fd('0x48')],null))[_0x80fd('0x25')](respondWithResult(_0x3f1333,null))[_0x80fd('0x44')](handleError(_0x3f1333,null));};exports[_0x80fd('0x4a')]=function(_0x213e72,_0x32db01){return db[_0x80fd('0x2a')][_0x80fd('0x46')]({'where':{'id':_0x213e72[_0x80fd('0x49')]['id']}})[_0x80fd('0x25')](handleEntityNotFound(_0x32db01,null))['then'](removeEntity(_0x32db01,null))['catch'](handleError(_0x32db01,null));};exports['describe']=function(_0x3bfb8e,_0x369cc7){return db[_0x80fd('0x2a')][_0x80fd('0x4b')]()[_0x80fd('0x25')](respondWithResult(_0x369cc7,null))[_0x80fd('0x44')](handleError(_0x369cc7,null));}; \ No newline at end of file +var _0xf213=['squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','SmsQueueReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','includeAll','findAll','catch','show','params','include','options','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'];(function(_0x2fdc12,_0x3d90ba){var _0x5505a8=function(_0x18765d){while(--_0x18765d){_0x2fdc12['push'](_0x2fdc12['shift']());}};_0x5505a8(++_0x3d90ba);}(_0xf213,0xd3));var _0x3f21=function(_0x376f87,_0x5030d8){_0x376f87=_0x376f87-0x0;var _0x1795a4=_0xf213[_0x376f87];return _0x1795a4;};'use strict';var emlformat=require(_0x3f21('0x0'));var rimraf=require(_0x3f21('0x1'));var zipdir=require(_0x3f21('0x2'));var jsonpatch=require(_0x3f21('0x3'));var rp=require(_0x3f21('0x4'));var moment=require(_0x3f21('0x5'));var BPromise=require(_0x3f21('0x6'));var Mustache=require(_0x3f21('0x7'));var util=require(_0x3f21('0x8'));var path=require(_0x3f21('0x9'));var sox=require(_0x3f21('0xa'));var csv=require(_0x3f21('0xb'));var ejs=require(_0x3f21('0xc'));var fs=require('fs');var fs_extra=require(_0x3f21('0xd'));var _=require('lodash');var squel=require(_0x3f21('0xe'));var crypto=require(_0x3f21('0xf'));var jsforce=require(_0x3f21('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3f21('0x11'));var Redis=require(_0x3f21('0x12'));var authService=require(_0x3f21('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x3f21('0x14'));var hardwareService=require(_0x3f21('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x3f21('0x16'));var licenseUtil=require(_0x3f21('0x17'));var db=require(_0x3f21('0x18'))['db'];function respondWithStatusCode(_0x5a91ac,_0x38e2cb){_0x38e2cb=_0x38e2cb||0xcc;return function(_0x49e752){if(_0x49e752){return _0x5a91ac[_0x3f21('0x19')](_0x38e2cb);}return _0x5a91ac[_0x3f21('0x1a')](_0x38e2cb)[_0x3f21('0x1b')]();};}function respondWithResult(_0x535501,_0x3215a2){_0x3215a2=_0x3215a2||0xc8;return function(_0x256b83){if(_0x256b83){return _0x535501['status'](_0x3215a2)[_0x3f21('0x1c')](_0x256b83);}};}function respondWithFilteredResult(_0x29bee6,_0x238619){return function(_0x3b22f6){if(_0x3b22f6){var _0x30bf34=typeof _0x238619['offset']==='undefined'&&typeof _0x238619['limit']===_0x3f21('0x1d');var _0x2bd097=_0x3b22f6['count'];var _0x10cc67=_0x30bf34?0x0:_0x238619[_0x3f21('0x1e')];var _0x4f6d53=_0x30bf34?_0x3b22f6[_0x3f21('0x1f')]:_0x238619[_0x3f21('0x1e')]+_0x238619[_0x3f21('0x20')];var _0x24bc5a;if(_0x4f6d53>=_0x2bd097){_0x4f6d53=_0x2bd097;_0x24bc5a=0xc8;}else{_0x24bc5a=0xce;}_0x29bee6[_0x3f21('0x1a')](_0x24bc5a);return _0x29bee6[_0x3f21('0x21')](_0x3f21('0x22'),_0x10cc67+'-'+_0x4f6d53+'/'+_0x2bd097)[_0x3f21('0x1c')](_0x3b22f6);}return null;};}function patchUpdates(_0x257fa2){return function(_0x5304e4){try{jsonpatch[_0x3f21('0x23')](_0x5304e4,_0x257fa2,!![]);}catch(_0x590c01){return BPromise[_0x3f21('0x24')](_0x590c01);}return _0x5304e4[_0x3f21('0x25')]();};}function saveUpdates(_0x526566,_0xabc808){return function(_0x4bc27c){if(_0x4bc27c){return _0x4bc27c[_0x3f21('0x26')](_0x526566)[_0x3f21('0x27')](function(_0x5244ba){return _0x5244ba;});}return null;};}function removeEntity(_0x2f93b3,_0x2d8851){return function(_0x133ea5){if(_0x133ea5){return _0x133ea5[_0x3f21('0x28')]()['then'](function(){_0x2f93b3[_0x3f21('0x1a')](0xcc)[_0x3f21('0x1b')]();});}};}function handleEntityNotFound(_0x1ab878,_0x39f79e){return function(_0x317b29){if(!_0x317b29){_0x1ab878[_0x3f21('0x19')](0x194);}return _0x317b29;};}function handleError(_0x4d31ba,_0x951b1e){_0x951b1e=_0x951b1e||0x1f4;return function(_0x241001){logger['error'](_0x241001[_0x3f21('0x29')]);if(_0x241001['name']){delete _0x241001[_0x3f21('0x2a')];}_0x4d31ba[_0x3f21('0x1a')](_0x951b1e)[_0x3f21('0x2b')](_0x241001);};}exports['index']=function(_0x1a4f5f,_0x1bf0dd){var _0x2c53d1={},_0x3be1de={},_0x114c09={'count':0x0,'rows':[]};var _0x42f30d=_[_0x3f21('0x2c')](db[_0x3f21('0x2d')][_0x3f21('0x2e')],function(_0x535ee3){return{'name':_0x535ee3['fieldName'],'type':_0x535ee3[_0x3f21('0x2f')][_0x3f21('0x30')]};});_0x3be1de[_0x3f21('0x31')]=_['map'](_0x42f30d,_0x3f21('0x2a'));_0x3be1de[_0x3f21('0x32')]=_[_0x3f21('0x33')](_0x1a4f5f[_0x3f21('0x32')]);_0x3be1de[_0x3f21('0x34')]=_[_0x3f21('0x35')](_0x3be1de[_0x3f21('0x31')],_0x3be1de['query']);_0x2c53d1['attributes']=_['intersection'](_0x3be1de['model'],qs[_0x3f21('0x36')](_0x1a4f5f[_0x3f21('0x32')][_0x3f21('0x36')]));_0x2c53d1['attributes']=_0x2c53d1[_0x3f21('0x37')][_0x3f21('0x38')]?_0x2c53d1[_0x3f21('0x37')]:_0x3be1de[_0x3f21('0x31')];if(!_0x1a4f5f[_0x3f21('0x32')][_0x3f21('0x39')](_0x3f21('0x3a'))){_0x2c53d1['limit']=qs[_0x3f21('0x20')](_0x1a4f5f['query'][_0x3f21('0x20')]);_0x2c53d1['offset']=qs['offset'](_0x1a4f5f[_0x3f21('0x32')][_0x3f21('0x1e')]);}_0x2c53d1['order']=qs[_0x3f21('0x3b')](_0x1a4f5f[_0x3f21('0x32')][_0x3f21('0x3b')]);_0x2c53d1[_0x3f21('0x3c')]=qs[_0x3f21('0x34')](_[_0x3f21('0x3d')](_0x1a4f5f[_0x3f21('0x32')],_0x3be1de[_0x3f21('0x34')]),_0x42f30d);if(_0x1a4f5f[_0x3f21('0x32')]['filter']){_0x2c53d1[_0x3f21('0x3c')]=_[_0x3f21('0x3e')](_0x2c53d1[_0x3f21('0x3c')],{'$or':_[_0x3f21('0x2c')](_0x42f30d,function(_0x4bd988){if(_0x4bd988[_0x3f21('0x2f')]!=='VIRTUAL'){var _0x2465aa={};_0x2465aa[_0x4bd988[_0x3f21('0x2a')]]={'$like':'%'+_0x1a4f5f[_0x3f21('0x32')][_0x3f21('0x3f')]+'%'};return _0x2465aa;}})});}_0x2c53d1=_[_0x3f21('0x3e')]({},_0x2c53d1,_0x1a4f5f['options']);var _0xba8829={'where':_0x2c53d1[_0x3f21('0x3c')]};return db[_0x3f21('0x2d')]['count'](_0xba8829)['then'](function(_0xa3833f){_0x114c09['count']=_0xa3833f;if(_0x1a4f5f['query'][_0x3f21('0x40')]){_0x2c53d1['include']=[{'all':!![]}];}return db[_0x3f21('0x2d')][_0x3f21('0x41')](_0x2c53d1);})['then'](function(_0x8dd5c3){_0x114c09['rows']=_0x8dd5c3;return _0x114c09;})[_0x3f21('0x27')](respondWithFilteredResult(_0x1bf0dd,_0x2c53d1))[_0x3f21('0x42')](handleError(_0x1bf0dd,null));};exports[_0x3f21('0x43')]=function(_0x31aacf,_0x57fadb){var _0x3bbb6f={'raw':!![],'where':{'id':_0x31aacf[_0x3f21('0x44')]['id']}},_0x134f23={};_0x134f23[_0x3f21('0x31')]=_['keys'](db[_0x3f21('0x2d')][_0x3f21('0x2e')]);_0x134f23['query']=_[_0x3f21('0x33')](_0x31aacf['query']);_0x134f23[_0x3f21('0x34')]=_[_0x3f21('0x35')](_0x134f23[_0x3f21('0x31')],_0x134f23[_0x3f21('0x32')]);_0x3bbb6f[_0x3f21('0x37')]=_[_0x3f21('0x35')](_0x134f23[_0x3f21('0x31')],qs['fields'](_0x31aacf['query']['fields']));_0x3bbb6f[_0x3f21('0x37')]=_0x3bbb6f[_0x3f21('0x37')][_0x3f21('0x38')]?_0x3bbb6f[_0x3f21('0x37')]:_0x134f23['model'];if(_0x31aacf[_0x3f21('0x32')][_0x3f21('0x40')]){_0x3bbb6f[_0x3f21('0x45')]=[{'all':!![]}];}_0x3bbb6f=_[_0x3f21('0x3e')]({},_0x3bbb6f,_0x31aacf[_0x3f21('0x46')]);return db['SmsQueueReport'][_0x3f21('0x47')](_0x3bbb6f)[_0x3f21('0x27')](handleEntityNotFound(_0x57fadb,null))[_0x3f21('0x27')](respondWithResult(_0x57fadb,null))[_0x3f21('0x42')](handleError(_0x57fadb,null));};exports[_0x3f21('0x48')]=function(_0xab2a7b,_0x2469a4){return db[_0x3f21('0x2d')]['create'](_0xab2a7b['body'],{})[_0x3f21('0x27')](respondWithResult(_0x2469a4,0xc9))['catch'](handleError(_0x2469a4,null));};exports['update']=function(_0x2f8dd5,_0x2b57cc){if(_0x2f8dd5[_0x3f21('0x49')]['id']){delete _0x2f8dd5[_0x3f21('0x49')]['id'];}return db[_0x3f21('0x2d')][_0x3f21('0x47')]({'where':{'id':_0x2f8dd5['params']['id']}})['then'](handleEntityNotFound(_0x2b57cc,null))[_0x3f21('0x27')](saveUpdates(_0x2f8dd5[_0x3f21('0x49')],null))[_0x3f21('0x27')](respondWithResult(_0x2b57cc,null))[_0x3f21('0x42')](handleError(_0x2b57cc,null));};exports[_0x3f21('0x28')]=function(_0x282fb1,_0x5d9e35){return db[_0x3f21('0x2d')][_0x3f21('0x47')]({'where':{'id':_0x282fb1[_0x3f21('0x44')]['id']}})[_0x3f21('0x27')](handleEntityNotFound(_0x5d9e35,null))[_0x3f21('0x27')](removeEntity(_0x5d9e35,null))['catch'](handleError(_0x5d9e35,null));};exports[_0x3f21('0x4a')]=function(_0x1e2a2e,_0x4ecbd2){return db[_0x3f21('0x2d')][_0x3f21('0x4a')]()[_0x3f21('0x27')](respondWithResult(_0x4ecbd2,null))[_0x3f21('0x42')](handleError(_0x4ecbd2,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 98254a7..bb1657c 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 _0xbaf0=['define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x539bba,_0x41f570){var _0x1b71a4=function(_0x2a6706){while(--_0x2a6706){_0x539bba['push'](_0x539bba['shift']());}};_0x1b71a4(++_0x41f570);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 9b30b4a..6e7b44d 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 _0x1555=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','SmsQueueReport','body','options','raw','CreateSmsQueueReport','UpdateSmsQueueReport','update','limit','then'];(function(_0x271b2a,_0x4daa19){var _0x14f682=function(_0x1bbec5){while(--_0x1bbec5){_0x271b2a['push'](_0x271b2a['shift']());}};_0x14f682(++_0x4daa19);}(_0x1555,0x74));var _0x5155=function(_0x2de08f,_0x464f64){_0x2de08f=_0x2de08f-0x0;var _0x4ef0a8=_0x1555[_0x2de08f];return _0x4ef0a8;};'use strict';var _=require(_0x5155('0x0'));var util=require(_0x5155('0x1'));var moment=require(_0x5155('0x2'));var BPromise=require(_0x5155('0x3'));var rs=require(_0x5155('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5155('0x5'))['db'];var utils=require(_0x5155('0x6'));var logger=require('../../config/logger')(_0x5155('0x7'));var config=require(_0x5155('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5155('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1fbf8b,_0x46dfe2,_0xe501ce){return new BPromise(function(_0x15b97e,_0x2d7bfa){return client['request'](_0x1fbf8b,_0xe501ce)['then'](function(_0xcff553){logger[_0x5155('0xa')](_0x5155('0xb'),_0x46dfe2,_0x5155('0xc'));logger[_0x5155('0xd')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x46dfe2,'request\x20sent',JSON[_0x5155('0xe')](_0xcff553));if(_0xcff553[_0x5155('0xf')]){if(_0xcff553[_0x5155('0xf')][_0x5155('0x10')]===0x1f4){logger[_0x5155('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x46dfe2,_0xcff553[_0x5155('0xf')][_0x5155('0x11')]);return _0x2d7bfa(_0xcff553[_0x5155('0xf')]['message']);}logger[_0x5155('0xf')](_0x5155('0xb'),_0x46dfe2,_0xcff553['error'][_0x5155('0x11')]);return _0x15b97e(_0xcff553[_0x5155('0xf')][_0x5155('0x11')]);}else{logger['info'](_0x5155('0xb'),_0x46dfe2,'request\x20sent');_0x15b97e(_0xcff553[_0x5155('0x12')][_0x5155('0x11')]);}})[_0x5155('0x13')](function(_0x32314e){logger[_0x5155('0xf')](_0x5155('0xb'),_0x46dfe2,_0x32314e);_0x2d7bfa(_0x32314e);});});}exports['CreateSmsQueueReport']=function(_0x34bb07){var _0x1e220f=this;return new Promise(function(_0xdf32b6,_0x316981){return db[_0x5155('0x14')]['create'](_0x34bb07[_0x5155('0x15')],{'raw':_0x34bb07['options']?_0x34bb07[_0x5155('0x16')][_0x5155('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x147f9b){logger[_0x5155('0xa')](_0x5155('0x18'),_0x34bb07);logger[_0x5155('0xd')](_0x5155('0x18'),_0x34bb07,JSON[_0x5155('0xe')](_0x147f9b));_0xdf32b6(_0x147f9b);})['catch'](function(_0x5aa19b){logger[_0x5155('0xf')](_0x5155('0x18'),_0x5aa19b['message'],_0x34bb07);_0x316981(_0x1e220f[_0x5155('0xf')](0x1f4,_0x5aa19b['message']));});});};exports[_0x5155('0x19')]=function(_0x4c0d67){var _0x545afe=this;return new Promise(function(_0xebaed6,_0x2b45af){return db[_0x5155('0x14')][_0x5155('0x1a')](_0x4c0d67[_0x5155('0x15')],{'raw':_0x4c0d67[_0x5155('0x16')]?_0x4c0d67[_0x5155('0x16')][_0x5155('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c0d67[_0x5155('0x16')]?_0x4c0d67[_0x5155('0x16')]['where']||null:null,'attributes':_0x4c0d67[_0x5155('0x16')]?_0x4c0d67['options']['attributes']||null:null,'limit':_0x4c0d67[_0x5155('0x16')]?_0x4c0d67[_0x5155('0x16')][_0x5155('0x1b')]||null:null})[_0x5155('0x1c')](function(_0x52fd8b){logger['info'](_0x5155('0x19'),_0x4c0d67);logger[_0x5155('0xd')](_0x5155('0x19'),_0x4c0d67,JSON['stringify'](_0x52fd8b));_0xebaed6(_0x52fd8b);})[_0x5155('0x13')](function(_0xcf7189){logger['error'](_0x5155('0x19'),_0xcf7189[_0x5155('0x11')],_0x4c0d67);_0x2b45af(_0x545afe[_0x5155('0xf')](0x1f4,_0xcf7189[_0x5155('0x11')]));});});}; \ No newline at end of file +var _0x1de3=['request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','SmsQueueReport','options','raw','CreateSmsQueueReport','stringify','UpdateSmsQueueReport','update','body','where','attributes','limit','then','lodash','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','SmsQueueReport,\x20%s,\x20%s'];(function(_0x4428d2,_0x566bc7){var _0x2b7763=function(_0x5c6fd0){while(--_0x5c6fd0){_0x4428d2['push'](_0x4428d2['shift']());}};_0x2b7763(++_0x566bc7);}(_0x1de3,0x10c));var _0x31de=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x1de3[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x31de('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x31de('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x31de('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x31de('0x3'))(_0x31de('0x4'));var config=require(_0x31de('0x5'));var jayson=require(_0x31de('0x6'));var client=jayson[_0x31de('0x7')][_0x31de('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x16c1c1,_0x2c6b08,_0x4c0857){return new BPromise(function(_0x2b6cd7,_0x4fab9c){return client[_0x31de('0x9')](_0x16c1c1,_0x4c0857)['then'](function(_0x3accf8){logger['info'](_0x31de('0xa'),_0x2c6b08,_0x31de('0xb'));logger[_0x31de('0xc')](_0x31de('0xd'),_0x2c6b08,'request\x20sent',JSON['stringify'](_0x3accf8));if(_0x3accf8[_0x31de('0xe')]){if(_0x3accf8[_0x31de('0xe')][_0x31de('0xf')]===0x1f4){logger[_0x31de('0xe')](_0x31de('0xa'),_0x2c6b08,_0x3accf8[_0x31de('0xe')]['message']);return _0x4fab9c(_0x3accf8[_0x31de('0xe')]['message']);}logger[_0x31de('0xe')](_0x31de('0xa'),_0x2c6b08,_0x3accf8['error'][_0x31de('0x10')]);return _0x2b6cd7(_0x3accf8[_0x31de('0xe')]['message']);}else{logger[_0x31de('0x11')](_0x31de('0xa'),_0x2c6b08,_0x31de('0xb'));_0x2b6cd7(_0x3accf8['result'][_0x31de('0x10')]);}})[_0x31de('0x12')](function(_0x364af5){logger[_0x31de('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x2c6b08,_0x364af5);_0x4fab9c(_0x364af5);});});}exports['CreateSmsQueueReport']=function(_0x590bf5){var _0x45adfc=this;return new Promise(function(_0x1e946c,_0x5c481f){return db[_0x31de('0x13')]['create'](_0x590bf5['body'],{'raw':_0x590bf5[_0x31de('0x14')]?_0x590bf5['options'][_0x31de('0x15')]===undefined?!![]:![]:!![]})['then'](function(_0x38b831){logger[_0x31de('0x11')](_0x31de('0x16'),_0x590bf5);logger[_0x31de('0xc')](_0x31de('0x16'),_0x590bf5,JSON[_0x31de('0x17')](_0x38b831));_0x1e946c(_0x38b831);})[_0x31de('0x12')](function(_0x12fa7d){logger[_0x31de('0xe')](_0x31de('0x16'),_0x12fa7d[_0x31de('0x10')],_0x590bf5);_0x5c481f(_0x45adfc[_0x31de('0xe')](0x1f4,_0x12fa7d[_0x31de('0x10')]));});});};exports[_0x31de('0x18')]=function(_0x137ba3){var _0x30fc71=this;return new Promise(function(_0x51d2d7,_0x35e815){return db['SmsQueueReport'][_0x31de('0x19')](_0x137ba3[_0x31de('0x1a')],{'raw':_0x137ba3['options']?_0x137ba3[_0x31de('0x14')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x137ba3[_0x31de('0x14')]?_0x137ba3['options'][_0x31de('0x1b')]||null:null,'attributes':_0x137ba3['options']?_0x137ba3[_0x31de('0x14')][_0x31de('0x1c')]||null:null,'limit':_0x137ba3[_0x31de('0x14')]?_0x137ba3[_0x31de('0x14')][_0x31de('0x1d')]||null:null})[_0x31de('0x1e')](function(_0x522fa5){logger[_0x31de('0x11')]('UpdateSmsQueueReport',_0x137ba3);logger[_0x31de('0xc')](_0x31de('0x18'),_0x137ba3,JSON[_0x31de('0x17')](_0x522fa5));_0x51d2d7(_0x522fa5);})[_0x31de('0x12')](function(_0x5bbc45){logger[_0x31de('0xe')](_0x31de('0x18'),_0x5bbc45[_0x31de('0x10')],_0x137ba3);_0x35e815(_0x30fc71[_0x31de('0xe')](0x1f4,_0x5bbc45[_0x31de('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 1eb39eb..2e6928b 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 _0x55ca=['create','put','update','delete','destroy','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x1c2e6a,_0x3973d9){var _0x121218=function(_0x287c7e){while(--_0x287c7e){_0x1c2e6a['push'](_0x1c2e6a['shift']());}};_0x121218(++_0x3973d9);}(_0x55ca,0x126));var _0xa55c=function(_0x471a85,_0x239e8d){_0x471a85=_0x471a85-0x0;var _0x5f2039=_0x55ca[_0x471a85];return _0x5f2039;};'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')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xe')]);router[_0xa55c('0xf')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x10')]);module['exports']=router; \ No newline at end of file +var _0xac9d=['../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xac9d,0x14d));var _0xdac9=function(_0x466e89,_0x237ae3){_0x466e89=_0x466e89-0x0;var _0x580986=_0xac9d[_0x466e89];return _0x580986;};'use strict';var multer=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var path=require(_0xdac9('0x2'));var timeout=require(_0xdac9('0x3'));var express=require(_0xdac9('0x4'));var router=express[_0xdac9('0x5')]();var fs_extra=require(_0xdac9('0x6'));var auth=require(_0xdac9('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xdac9('0x8'));var controller=require('./smsTransferReport.controller');router[_0xdac9('0x9')]('/',auth[_0xdac9('0xa')](),controller[_0xdac9('0xb')]);router[_0xdac9('0x9')](_0xdac9('0xc'),auth[_0xdac9('0xa')](),controller['describe']);router[_0xdac9('0x9')]('/:id',auth[_0xdac9('0xa')](),controller[_0xdac9('0xd')]);router[_0xdac9('0xe')]('/',auth[_0xdac9('0xa')](),controller[_0xdac9('0xf')]);router[_0xdac9('0x10')](_0xdac9('0x11'),auth[_0xdac9('0xa')](),controller[_0xdac9('0x12')]);router['delete'](_0xdac9('0x11'),auth[_0xdac9('0xa')](),controller['destroy']);module[_0xdac9('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 2fdcbb3..fac5001 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x3bbe4b,_0x35f067){var _0x402d37=function(_0x2f7f78){while(--_0x2f7f78){_0x3bbe4b['push'](_0x3bbe4b['shift']());}};_0x402d37(++_0x35f067);}(_0x34e8,0x12c));var _0x834e=function(_0x5d85c3,_0xeeb7b){_0x5d85c3=_0x5d85c3-0x0;var _0x4e6420=_0x34e8[_0x5d85c3];return _0x4e6420;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x477598,_0x4dab5c){var _0x4c7ffb=function(_0x1be044){while(--_0x1be044){_0x477598['push'](_0x477598['shift']());}};_0x4c7ffb(++_0x4dab5c);}(_0x34e8,0x12c));var _0x834e=function(_0x4afbfe,_0x492c2a){_0x4afbfe=_0x4afbfe-0x0;var _0x27889d=_0x34e8[_0x4afbfe];return _0x27889d;};'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/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 3c8443d..b19864c 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 _0x6322=['limit','count','set','Content-Range','reject','save','then','end','sendStatus','stack','name','send','index','SmsTransferReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','nolimit','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','params','catch','body','update','find','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','status','json','offset','undefined'];(function(_0x3f8847,_0x59bdbe){var _0x3db3b7=function(_0x34be56){while(--_0x34be56){_0x3f8847['push'](_0x3f8847['shift']());}};_0x3db3b7(++_0x59bdbe);}(_0x6322,0xbb));var _0x2632=function(_0x4498ad,_0x27613e){_0x4498ad=_0x4498ad-0x0;var _0x4b91bd=_0x6322[_0x4498ad];return _0x4b91bd;};'use strict';var emlformat=require(_0x2632('0x0'));var rimraf=require(_0x2632('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2632('0x2'));var rp=require(_0x2632('0x3'));var moment=require(_0x2632('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2632('0x5'));var util=require('util');var path=require(_0x2632('0x6'));var sox=require(_0x2632('0x7'));var csv=require('to-csv');var ejs=require(_0x2632('0x8'));var fs=require('fs');var fs_extra=require(_0x2632('0x9'));var _=require('lodash');var squel=require(_0x2632('0xa'));var crypto=require('crypto');var jsforce=require(_0x2632('0xb'));var deskjs=require(_0x2632('0xc'));var toCsv=require(_0x2632('0xd'));var querystring=require(_0x2632('0xe'));var Papa=require(_0x2632('0xf'));var Redis=require(_0x2632('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2632('0x11'));var hardwareService=require(_0x2632('0x12'));var logger=require(_0x2632('0x13'))(_0x2632('0x14'));var utils=require('../../config/utils');var config=require(_0x2632('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e7740,_0x4d5504){_0x4d5504=_0x4d5504||0xcc;return function(_0xd28b0d){if(_0xd28b0d){return _0x5e7740['sendStatus'](_0x4d5504);}return _0x5e7740[_0x2632('0x16')](_0x4d5504)['end']();};}function respondWithResult(_0x1dc042,_0x1ddba6){_0x1ddba6=_0x1ddba6||0xc8;return function(_0x5d0406){if(_0x5d0406){return _0x1dc042[_0x2632('0x16')](_0x1ddba6)[_0x2632('0x17')](_0x5d0406);}};}function respondWithFilteredResult(_0x4eed10,_0xffa3a8){return function(_0x2efb05){if(_0x2efb05){var _0x4b61c8=typeof _0xffa3a8[_0x2632('0x18')]===_0x2632('0x19')&&typeof _0xffa3a8[_0x2632('0x1a')]===_0x2632('0x19');var _0x156b1f=_0x2efb05[_0x2632('0x1b')];var _0x5d531f=_0x4b61c8?0x0:_0xffa3a8[_0x2632('0x18')];var _0x4feb9=_0x4b61c8?_0x2efb05['count']:_0xffa3a8[_0x2632('0x18')]+_0xffa3a8[_0x2632('0x1a')];var _0x398eec;if(_0x4feb9>=_0x156b1f){_0x4feb9=_0x156b1f;_0x398eec=0xc8;}else{_0x398eec=0xce;}_0x4eed10['status'](_0x398eec);return _0x4eed10[_0x2632('0x1c')](_0x2632('0x1d'),_0x5d531f+'-'+_0x4feb9+'/'+_0x156b1f)['json'](_0x2efb05);}return null;};}function patchUpdates(_0x465e45){return function(_0x4cb018){try{jsonpatch['apply'](_0x4cb018,_0x465e45,!![]);}catch(_0x5143e9){return BPromise[_0x2632('0x1e')](_0x5143e9);}return _0x4cb018[_0x2632('0x1f')]();};}function saveUpdates(_0x116a79,_0x5944f8){return function(_0x4bb46d){if(_0x4bb46d){return _0x4bb46d['update'](_0x116a79)[_0x2632('0x20')](function(_0x25933f){return _0x25933f;});}return null;};}function removeEntity(_0x70bb04,_0xec42b8){return function(_0x367126){if(_0x367126){return _0x367126['destroy']()['then'](function(){_0x70bb04[_0x2632('0x16')](0xcc)[_0x2632('0x21')]();});}};}function handleEntityNotFound(_0x1d811c,_0x2a301c){return function(_0x113caa){if(!_0x113caa){_0x1d811c[_0x2632('0x22')](0x194);}return _0x113caa;};}function handleError(_0x368978,_0x1d7468){_0x1d7468=_0x1d7468||0x1f4;return function(_0x3db3de){logger['error'](_0x3db3de[_0x2632('0x23')]);if(_0x3db3de['name']){delete _0x3db3de[_0x2632('0x24')];}_0x368978['status'](_0x1d7468)[_0x2632('0x25')](_0x3db3de);};}exports[_0x2632('0x26')]=function(_0x41538b,_0x7c0ecc){var _0x28caf5={},_0x1d7135={},_0x1f1f9e={'count':0x0,'rows':[]};var _0x37988f=_['map'](db[_0x2632('0x27')][_0x2632('0x28')],function(_0x420da4){return{'name':_0x420da4[_0x2632('0x29')],'type':_0x420da4[_0x2632('0x2a')]['key']};});_0x1d7135[_0x2632('0x2b')]=_['map'](_0x37988f,_0x2632('0x24'));_0x1d7135[_0x2632('0x2c')]=_[_0x2632('0x2d')](_0x41538b[_0x2632('0x2c')]);_0x1d7135['filters']=_[_0x2632('0x2e')](_0x1d7135['model'],_0x1d7135[_0x2632('0x2c')]);_0x28caf5[_0x2632('0x2f')]=_['intersection'](_0x1d7135['model'],qs['fields'](_0x41538b[_0x2632('0x2c')][_0x2632('0x30')]));_0x28caf5[_0x2632('0x2f')]=_0x28caf5[_0x2632('0x2f')]['length']?_0x28caf5[_0x2632('0x2f')]:_0x1d7135['model'];if(!_0x41538b['query']['hasOwnProperty'](_0x2632('0x31'))){_0x28caf5['limit']=qs[_0x2632('0x1a')](_0x41538b[_0x2632('0x2c')][_0x2632('0x1a')]);_0x28caf5[_0x2632('0x18')]=qs[_0x2632('0x18')](_0x41538b[_0x2632('0x2c')][_0x2632('0x18')]);}_0x28caf5['order']=qs[_0x2632('0x32')](_0x41538b['query']['sort']);_0x28caf5[_0x2632('0x33')]=qs[_0x2632('0x34')](_[_0x2632('0x35')](_0x41538b[_0x2632('0x2c')],_0x1d7135[_0x2632('0x34')]),_0x37988f);if(_0x41538b['query'][_0x2632('0x36')]){_0x28caf5[_0x2632('0x33')]=_[_0x2632('0x37')](_0x28caf5[_0x2632('0x33')],{'$or':_[_0x2632('0x38')](_0x37988f,function(_0x3e1d0c){if(_0x3e1d0c[_0x2632('0x2a')]!==_0x2632('0x39')){var _0x5c804e={};_0x5c804e[_0x3e1d0c[_0x2632('0x24')]]={'$like':'%'+_0x41538b['query']['filter']+'%'};return _0x5c804e;}})});}_0x28caf5=_[_0x2632('0x37')]({},_0x28caf5,_0x41538b[_0x2632('0x3a')]);var _0x126b47={'where':_0x28caf5[_0x2632('0x33')]};return db['SmsTransferReport'][_0x2632('0x1b')](_0x126b47)[_0x2632('0x20')](function(_0x24d1c9){_0x1f1f9e[_0x2632('0x1b')]=_0x24d1c9;if(_0x41538b[_0x2632('0x2c')][_0x2632('0x3b')]){_0x28caf5[_0x2632('0x3c')]=[{'all':!![]}];}return db[_0x2632('0x27')][_0x2632('0x3d')](_0x28caf5);})[_0x2632('0x20')](function(_0x29e8a4){_0x1f1f9e[_0x2632('0x3e')]=_0x29e8a4;return _0x1f1f9e;})['then'](respondWithFilteredResult(_0x7c0ecc,_0x28caf5))['catch'](handleError(_0x7c0ecc,null));};exports[_0x2632('0x3f')]=function(_0x42a0fe,_0x5d192a){var _0x53cc7f={'raw':!![],'where':{'id':_0x42a0fe[_0x2632('0x40')]['id']}},_0x3ff6eb={};_0x3ff6eb['model']=_[_0x2632('0x2d')](db[_0x2632('0x27')]['rawAttributes']);_0x3ff6eb[_0x2632('0x2c')]=_[_0x2632('0x2d')](_0x42a0fe['query']);_0x3ff6eb[_0x2632('0x34')]=_['intersection'](_0x3ff6eb[_0x2632('0x2b')],_0x3ff6eb[_0x2632('0x2c')]);_0x53cc7f[_0x2632('0x2f')]=_['intersection'](_0x3ff6eb[_0x2632('0x2b')],qs[_0x2632('0x30')](_0x42a0fe[_0x2632('0x2c')]['fields']));_0x53cc7f[_0x2632('0x2f')]=_0x53cc7f[_0x2632('0x2f')]['length']?_0x53cc7f[_0x2632('0x2f')]:_0x3ff6eb['model'];if(_0x42a0fe[_0x2632('0x2c')][_0x2632('0x3b')]){_0x53cc7f[_0x2632('0x3c')]=[{'all':!![]}];}_0x53cc7f=_['merge']({},_0x53cc7f,_0x42a0fe[_0x2632('0x3a')]);return db[_0x2632('0x27')]['find'](_0x53cc7f)[_0x2632('0x20')](handleEntityNotFound(_0x5d192a,null))[_0x2632('0x20')](respondWithResult(_0x5d192a,null))[_0x2632('0x41')](handleError(_0x5d192a,null));};exports['create']=function(_0x502013,_0x475b8f){return db['SmsTransferReport']['create'](_0x502013[_0x2632('0x42')],{})[_0x2632('0x20')](respondWithResult(_0x475b8f,0xc9))[_0x2632('0x41')](handleError(_0x475b8f,null));};exports[_0x2632('0x43')]=function(_0x470adc,_0x4521a1){if(_0x470adc['body']['id']){delete _0x470adc[_0x2632('0x42')]['id'];}return db[_0x2632('0x27')][_0x2632('0x44')]({'where':{'id':_0x470adc[_0x2632('0x40')]['id']}})[_0x2632('0x20')](handleEntityNotFound(_0x4521a1,null))[_0x2632('0x20')](saveUpdates(_0x470adc['body'],null))[_0x2632('0x20')](respondWithResult(_0x4521a1,null))['catch'](handleError(_0x4521a1,null));};exports[_0x2632('0x45')]=function(_0x47b501,_0x5ec17b){return db[_0x2632('0x27')][_0x2632('0x44')]({'where':{'id':_0x47b501[_0x2632('0x40')]['id']}})[_0x2632('0x20')](handleEntityNotFound(_0x5ec17b,null))[_0x2632('0x20')](removeEntity(_0x5ec17b,null))[_0x2632('0x41')](handleError(_0x5ec17b,null));};exports[_0x2632('0x46')]=function(_0x560424,_0x5c7d85){return db[_0x2632('0x27')]['describe']()[_0x2632('0x20')](respondWithResult(_0x5c7d85,null))['catch'](handleError(_0x5c7d85,null));}; \ No newline at end of file +var _0xeced=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','end','error','stack','name','index','map','SmsTransferReport','rawAttributes','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','fields','includeAll','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x276caa,_0xbd5dd7){var _0x4d777f=function(_0x19b534){while(--_0x19b534){_0x276caa['push'](_0x276caa['shift']());}};_0x4d777f(++_0xbd5dd7);}(_0xeced,0x1c9));var _0xdece=function(_0x3727f8,_0x4c01ed){_0x3727f8=_0x3727f8-0x0;var _0x5cb419=_0xeced[_0x3727f8];return _0x5cb419;};'use strict';var emlformat=require(_0xdece('0x0'));var rimraf=require(_0xdece('0x1'));var zipdir=require(_0xdece('0x2'));var jsonpatch=require(_0xdece('0x3'));var rp=require(_0xdece('0x4'));var moment=require(_0xdece('0x5'));var BPromise=require(_0xdece('0x6'));var Mustache=require(_0xdece('0x7'));var util=require(_0xdece('0x8'));var path=require(_0xdece('0x9'));var sox=require(_0xdece('0xa'));var csv=require(_0xdece('0xb'));var ejs=require(_0xdece('0xc'));var fs=require('fs');var fs_extra=require(_0xdece('0xd'));var _=require(_0xdece('0xe'));var squel=require(_0xdece('0xf'));var crypto=require(_0xdece('0x10'));var jsforce=require('jsforce');var deskjs=require(_0xdece('0x11'));var toCsv=require(_0xdece('0xb'));var querystring=require(_0xdece('0x12'));var Papa=require(_0xdece('0x13'));var Redis=require(_0xdece('0x14'));var authService=require(_0xdece('0x15'));var qs=require(_0xdece('0x16'));var as=require(_0xdece('0x17'));var hardwareService=require(_0xdece('0x18'));var logger=require(_0xdece('0x19'))(_0xdece('0x1a'));var utils=require(_0xdece('0x1b'));var config=require(_0xdece('0x1c'));var licenseUtil=require(_0xdece('0x1d'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa6ed55,_0x2d51d8){_0x2d51d8=_0x2d51d8||0xcc;return function(_0x559d24){if(_0x559d24){return _0xa6ed55[_0xdece('0x1e')](_0x2d51d8);}return _0xa6ed55[_0xdece('0x1f')](_0x2d51d8)['end']();};}function respondWithResult(_0x15920c,_0xf02c23){_0xf02c23=_0xf02c23||0xc8;return function(_0x1e99a2){if(_0x1e99a2){return _0x15920c[_0xdece('0x1f')](_0xf02c23)['json'](_0x1e99a2);}};}function respondWithFilteredResult(_0x318c4b,_0x1985c6){return function(_0x34816e){if(_0x34816e){var _0x8833e1=typeof _0x1985c6[_0xdece('0x20')]===_0xdece('0x21')&&typeof _0x1985c6['limit']===_0xdece('0x21');var _0x2a8fe4=_0x34816e[_0xdece('0x22')];var _0x2e50bb=_0x8833e1?0x0:_0x1985c6['offset'];var _0x3927ea=_0x8833e1?_0x34816e['count']:_0x1985c6[_0xdece('0x20')]+_0x1985c6[_0xdece('0x23')];var _0x3aea28;if(_0x3927ea>=_0x2a8fe4){_0x3927ea=_0x2a8fe4;_0x3aea28=0xc8;}else{_0x3aea28=0xce;}_0x318c4b[_0xdece('0x1f')](_0x3aea28);return _0x318c4b[_0xdece('0x24')](_0xdece('0x25'),_0x2e50bb+'-'+_0x3927ea+'/'+_0x2a8fe4)[_0xdece('0x26')](_0x34816e);}return null;};}function patchUpdates(_0x52f43f){return function(_0x40e107){try{jsonpatch[_0xdece('0x27')](_0x40e107,_0x52f43f,!![]);}catch(_0x259f64){return BPromise[_0xdece('0x28')](_0x259f64);}return _0x40e107[_0xdece('0x29')]();};}function saveUpdates(_0x4c46fa,_0x38de95){return function(_0x5625b9){if(_0x5625b9){return _0x5625b9[_0xdece('0x2a')](_0x4c46fa)[_0xdece('0x2b')](function(_0x1061c5){return _0x1061c5;});}return null;};}function removeEntity(_0x3b495e,_0x142fd4){return function(_0x44ca9a){if(_0x44ca9a){return _0x44ca9a['destroy']()[_0xdece('0x2b')](function(){_0x3b495e[_0xdece('0x1f')](0xcc)[_0xdece('0x2c')]();});}};}function handleEntityNotFound(_0xdac3a5,_0x454256){return function(_0x1791e7){if(!_0x1791e7){_0xdac3a5[_0xdece('0x1e')](0x194);}return _0x1791e7;};}function handleError(_0x4c9b1c,_0x52a901){_0x52a901=_0x52a901||0x1f4;return function(_0x16ac4b){logger[_0xdece('0x2d')](_0x16ac4b[_0xdece('0x2e')]);if(_0x16ac4b[_0xdece('0x2f')]){delete _0x16ac4b[_0xdece('0x2f')];}_0x4c9b1c[_0xdece('0x1f')](_0x52a901)['send'](_0x16ac4b);};}exports[_0xdece('0x30')]=function(_0x1f40b0,_0x41f8d5){var _0x3199aa={},_0x46876c={},_0x7a9fb4={'count':0x0,'rows':[]};var _0x55af95=_[_0xdece('0x31')](db[_0xdece('0x32')][_0xdece('0x33')],function(_0x5bba58){return{'name':_0x5bba58['fieldName'],'type':_0x5bba58[_0xdece('0x34')]['key']};});_0x46876c[_0xdece('0x35')]=_[_0xdece('0x31')](_0x55af95,_0xdece('0x2f'));_0x46876c[_0xdece('0x36')]=_[_0xdece('0x37')](_0x1f40b0['query']);_0x46876c[_0xdece('0x38')]=_[_0xdece('0x39')](_0x46876c[_0xdece('0x35')],_0x46876c[_0xdece('0x36')]);_0x3199aa[_0xdece('0x3a')]=_[_0xdece('0x39')](_0x46876c[_0xdece('0x35')],qs['fields'](_0x1f40b0['query']['fields']));_0x3199aa['attributes']=_0x3199aa[_0xdece('0x3a')]['length']?_0x3199aa[_0xdece('0x3a')]:_0x46876c['model'];if(!_0x1f40b0['query'][_0xdece('0x3b')](_0xdece('0x3c'))){_0x3199aa[_0xdece('0x23')]=qs[_0xdece('0x23')](_0x1f40b0['query']['limit']);_0x3199aa['offset']=qs['offset'](_0x1f40b0[_0xdece('0x36')][_0xdece('0x20')]);}_0x3199aa[_0xdece('0x3d')]=qs[_0xdece('0x3e')](_0x1f40b0[_0xdece('0x36')]['sort']);_0x3199aa[_0xdece('0x3f')]=qs[_0xdece('0x38')](_[_0xdece('0x40')](_0x1f40b0[_0xdece('0x36')],_0x46876c[_0xdece('0x38')]),_0x55af95);if(_0x1f40b0[_0xdece('0x36')][_0xdece('0x41')]){_0x3199aa[_0xdece('0x3f')]=_[_0xdece('0x42')](_0x3199aa['where'],{'$or':_[_0xdece('0x31')](_0x55af95,function(_0x491420){if(_0x491420[_0xdece('0x34')]!=='VIRTUAL'){var _0x505ce3={};_0x505ce3[_0x491420[_0xdece('0x2f')]]={'$like':'%'+_0x1f40b0['query'][_0xdece('0x41')]+'%'};return _0x505ce3;}})});}_0x3199aa=_[_0xdece('0x42')]({},_0x3199aa,_0x1f40b0[_0xdece('0x43')]);var _0x3f3747={'where':_0x3199aa[_0xdece('0x3f')]};return db['SmsTransferReport'][_0xdece('0x22')](_0x3f3747)[_0xdece('0x2b')](function(_0x68182f){_0x7a9fb4['count']=_0x68182f;if(_0x1f40b0[_0xdece('0x36')]['includeAll']){_0x3199aa[_0xdece('0x44')]=[{'all':!![]}];}return db[_0xdece('0x32')][_0xdece('0x45')](_0x3199aa);})[_0xdece('0x2b')](function(_0xab5023){_0x7a9fb4[_0xdece('0x46')]=_0xab5023;return _0x7a9fb4;})[_0xdece('0x2b')](respondWithFilteredResult(_0x41f8d5,_0x3199aa))[_0xdece('0x47')](handleError(_0x41f8d5,null));};exports[_0xdece('0x48')]=function(_0x2e805e,_0x34f6de){var _0x34d474={'raw':!![],'where':{'id':_0x2e805e['params']['id']}},_0x2fe066={};_0x2fe066['model']=_[_0xdece('0x37')](db[_0xdece('0x32')][_0xdece('0x33')]);_0x2fe066[_0xdece('0x36')]=_['keys'](_0x2e805e[_0xdece('0x36')]);_0x2fe066[_0xdece('0x38')]=_[_0xdece('0x39')](_0x2fe066[_0xdece('0x35')],_0x2fe066[_0xdece('0x36')]);_0x34d474[_0xdece('0x3a')]=_[_0xdece('0x39')](_0x2fe066[_0xdece('0x35')],qs[_0xdece('0x49')](_0x2e805e['query'][_0xdece('0x49')]));_0x34d474[_0xdece('0x3a')]=_0x34d474[_0xdece('0x3a')]['length']?_0x34d474[_0xdece('0x3a')]:_0x2fe066[_0xdece('0x35')];if(_0x2e805e['query'][_0xdece('0x4a')]){_0x34d474[_0xdece('0x44')]=[{'all':!![]}];}_0x34d474=_[_0xdece('0x42')]({},_0x34d474,_0x2e805e[_0xdece('0x43')]);return db[_0xdece('0x32')]['find'](_0x34d474)[_0xdece('0x2b')](handleEntityNotFound(_0x34f6de,null))['then'](respondWithResult(_0x34f6de,null))[_0xdece('0x47')](handleError(_0x34f6de,null));};exports[_0xdece('0x4b')]=function(_0x4cb143,_0x3abc69){return db[_0xdece('0x32')]['create'](_0x4cb143[_0xdece('0x4c')],{})['then'](respondWithResult(_0x3abc69,0xc9))[_0xdece('0x47')](handleError(_0x3abc69,null));};exports['update']=function(_0xa1cfe3,_0x6312a8){if(_0xa1cfe3[_0xdece('0x4c')]['id']){delete _0xa1cfe3[_0xdece('0x4c')]['id'];}return db[_0xdece('0x32')]['find']({'where':{'id':_0xa1cfe3[_0xdece('0x4d')]['id']}})['then'](handleEntityNotFound(_0x6312a8,null))[_0xdece('0x2b')](saveUpdates(_0xa1cfe3[_0xdece('0x4c')],null))[_0xdece('0x2b')](respondWithResult(_0x6312a8,null))[_0xdece('0x47')](handleError(_0x6312a8,null));};exports[_0xdece('0x4e')]=function(_0x119b4b,_0x26d292){return db[_0xdece('0x32')]['find']({'where':{'id':_0x119b4b[_0xdece('0x4d')]['id']}})['then'](handleEntityNotFound(_0x26d292,null))['then'](removeEntity(_0x26d292,null))[_0xdece('0x47')](handleError(_0x26d292,null));};exports[_0xdece('0x4f')]=function(_0x37f8ff,_0xb82cc0){return db[_0xdece('0x32')]['describe']()['then'](respondWithResult(_0xb82cc0,null))[_0xdece('0x47')](handleError(_0xb82cc0,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 62bbaf6..f42d409 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 _0x657f=['rimraf','../../config/environment','exports','define','uniqueid','util','api','moment','bluebird','request-promise','path'];(function(_0x741c3c,_0x177632){var _0x30dcd8=function(_0x4d59c8){while(--_0x4d59c8){_0x741c3c['push'](_0x741c3c['shift']());}};_0x30dcd8(++_0x177632);}(_0x657f,0xaa));var _0xf657=function(_0x5b2c7e,_0x3d22f0){_0x5b2c7e=_0x5b2c7e-0x0;var _0x5ec399=_0x657f[_0x5b2c7e];return _0x5ec399;};'use strict';var _=require('lodash');var util=require(_0xf657('0x0'));var logger=require('../../config/logger')(_0xf657('0x1'));var moment=require(_0xf657('0x2'));var BPromise=require(_0xf657('0x3'));var rp=require(_0xf657('0x4'));var fs=require('fs');var path=require(_0xf657('0x5'));var rimraf=require(_0xf657('0x6'));var config=require(_0xf657('0x7'));var attributes=require('./smsTransferReport.attributes');module[_0xf657('0x8')]=function(_0x585003,_0x40515e){return _0x585003[_0xf657('0x9')]('SmsTransferReport',attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xf657('0xa'),'fields':[_0xf657('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9dcb=['api','moment','request-promise','path','../../config/environment','./smsTransferReport.attributes','exports','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util'];(function(_0x44a64f,_0x38475c){var _0x52024b=function(_0x2cd055){while(--_0x2cd055){_0x44a64f['push'](_0x44a64f['shift']());}};_0x52024b(++_0x38475c);}(_0x9dcb,0x172));var _0xb9dc=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x9dcb[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xb9dc('0x0'));var util=require(_0xb9dc('0x1'));var logger=require('../../config/logger')(_0xb9dc('0x2'));var moment=require(_0xb9dc('0x3'));var BPromise=require('bluebird');var rp=require(_0xb9dc('0x4'));var fs=require('fs');var path=require(_0xb9dc('0x5'));var rimraf=require('rimraf');var config=require(_0xb9dc('0x6'));var attributes=require(_0xb9dc('0x7'));module[_0xb9dc('0x8')]=function(_0x37b108,_0x298d62){return _0x37b108['define'](_0xb9dc('0x9'),attributes,{'tableName':_0xb9dc('0xa'),'paranoid':![],'indexes':[{'name':_0xb9dc('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 1fb92d9..a9d4295 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 _0x4aa3=['jayson/promise','http','request','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4aa3,0x174));var _0x34aa=function(_0x5e6ebe,_0xf7283f){_0x5e6ebe=_0x5e6ebe-0x0;var _0x20c44a=_0x4aa3[_0x5e6ebe];return _0x20c44a;};'use strict';var _=require(_0x34aa('0x0'));var util=require(_0x34aa('0x1'));var moment=require('moment');var BPromise=require(_0x34aa('0x2'));var rs=require(_0x34aa('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x34aa('0x4'))['db'];var utils=require(_0x34aa('0x5'));var logger=require('../../config/logger')(_0x34aa('0x6'));var config=require(_0x34aa('0x7'));var jayson=require(_0x34aa('0x8'));var client=jayson['client'][_0x34aa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xdcaa74,_0x55c471,_0x333bbe){return new BPromise(function(_0x420d9e,_0x4e7785){return client[_0x34aa('0xa')](_0xdcaa74,_0x333bbe)['then'](function(_0x4a332b){logger[_0x34aa('0xb')](_0x34aa('0xc'),_0x55c471,_0x34aa('0xd'));logger[_0x34aa('0xe')](_0x34aa('0xf'),_0x55c471,_0x34aa('0xd'),JSON['stringify'](_0x4a332b));if(_0x4a332b[_0x34aa('0x10')]){if(_0x4a332b['error']['code']===0x1f4){logger[_0x34aa('0x10')](_0x34aa('0xc'),_0x55c471,_0x4a332b[_0x34aa('0x10')]['message']);return _0x4e7785(_0x4a332b[_0x34aa('0x10')]['message']);}logger[_0x34aa('0x10')](_0x34aa('0xc'),_0x55c471,_0x4a332b[_0x34aa('0x10')][_0x34aa('0x11')]);return _0x420d9e(_0x4a332b[_0x34aa('0x10')]['message']);}else{logger[_0x34aa('0xb')](_0x34aa('0xc'),_0x55c471,_0x34aa('0xd'));_0x420d9e(_0x4a332b[_0x34aa('0x12')][_0x34aa('0x11')]);}})[_0x34aa('0x13')](function(_0x33cd7e){logger[_0x34aa('0x10')](_0x34aa('0xc'),_0x55c471,_0x33cd7e);_0x4e7785(_0x33cd7e);});});} \ No newline at end of file +var _0xb13b=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util'];(function(_0x53e1dc,_0x5c9bc9){var _0x2fa4fa=function(_0x35a5f8){while(--_0x35a5f8){_0x53e1dc['push'](_0x53e1dc['shift']());}};_0x2fa4fa(++_0x5c9bc9);}(_0xb13b,0x1de));var _0xbb13=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xb13b[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0xbb13('0x0'));var util=require(_0xbb13('0x1'));var moment=require(_0xbb13('0x2'));var BPromise=require(_0xbb13('0x3'));var rs=require(_0xbb13('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb13('0x5'))['db'];var utils=require(_0xbb13('0x6'));var logger=require('../../config/logger')(_0xbb13('0x7'));var config=require(_0xbb13('0x8'));var jayson=require(_0xbb13('0x9'));var client=jayson[_0xbb13('0xa')][_0xbb13('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd4a4bd,_0x1067a5,_0x3be2d2){return new BPromise(function(_0x56dc8f,_0x58d7d0){return client[_0xbb13('0xc')](_0xd4a4bd,_0x3be2d2)[_0xbb13('0xd')](function(_0x1c71b9){logger[_0xbb13('0xe')](_0xbb13('0xf'),_0x1067a5,_0xbb13('0x10'));logger[_0xbb13('0x11')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x1067a5,_0xbb13('0x10'),JSON[_0xbb13('0x12')](_0x1c71b9));if(_0x1c71b9[_0xbb13('0x13')]){if(_0x1c71b9['error'][_0xbb13('0x14')]===0x1f4){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x1067a5,_0x1c71b9[_0xbb13('0x13')][_0xbb13('0x15')]);return _0x58d7d0(_0x1c71b9[_0xbb13('0x13')][_0xbb13('0x15')]);}logger['error'](_0xbb13('0xf'),_0x1067a5,_0x1c71b9[_0xbb13('0x13')][_0xbb13('0x15')]);return _0x56dc8f(_0x1c71b9['error'][_0xbb13('0x15')]);}else{logger['info'](_0xbb13('0xf'),_0x1067a5,'request\x20sent');_0x56dc8f(_0x1c71b9[_0xbb13('0x16')][_0xbb13('0x15')]);}})[_0xbb13('0x17')](function(_0x53602a){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x1067a5,_0x53602a);_0x58d7d0(_0x53602a);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 915c7dd..7494bb2 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 _0xa1fe=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/download','download','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','extname','now','post','single','file','create','put','update','delete','/:id','exports','multer','util','path','connect-timeout'];(function(_0xbe00d7,_0x293d20){var _0x5435c6=function(_0x5f4dd0){while(--_0x5f4dd0){_0xbe00d7['push'](_0xbe00d7['shift']());}};_0x5435c6(++_0x293d20);}(_0xa1fe,0xbc));var _0xea1f=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xa1fe[_0x1beef3];return _0x5af964;};'use strict';var multer=require(_0xea1f('0x0'));var util=require(_0xea1f('0x1'));var path=require(_0xea1f('0x2'));var timeout=require(_0xea1f('0x3'));var express=require('express');var router=express[_0xea1f('0x4')]();var fs_extra=require(_0xea1f('0x5'));var auth=require(_0xea1f('0x6'));var interaction=require(_0xea1f('0x7'));var config=require(_0xea1f('0x8'));var controller=require('./sound.controller');router[_0xea1f('0x9')]('/',auth[_0xea1f('0xa')](),controller[_0xea1f('0xb')]);router['get']('/:id',auth[_0xea1f('0xa')](),controller['show']);router[_0xea1f('0x9')](_0xea1f('0xc'),auth[_0xea1f('0xa')](),controller[_0xea1f('0xd')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x454f6e,_0x23da1f,_0x3440c7){_0x3440c7(null,path[_0xea1f('0xe')](config[_0xea1f('0xf')],_0xea1f('0x10')));},'filename':function(_0x595661,_0x211c0e,_0x42c367){_0x211c0e['originalname']=_0x211c0e[_0xea1f('0x11')][_0xea1f('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x42c367(null,util[_0xea1f('0x13')](_0xea1f('0x14'),path['basename'](_0x211c0e['originalname'],path[_0xea1f('0x15')](_0x211c0e['originalname'])),Date[_0xea1f('0x16')](),path[_0xea1f('0x15')](_0x211c0e['originalname'])));}})});router[_0xea1f('0x17')]('/',upload[_0xea1f('0x18')](_0xea1f('0x19')),controller[_0xea1f('0x1a')]);router[_0xea1f('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0xea1f('0x1c')]);router[_0xea1f('0x1d')](_0xea1f('0x1e'),auth[_0xea1f('0xa')](),controller[_0xea1f('0x1d')]);module[_0xea1f('0x1f')]=router; \ No newline at end of file +var _0x85a1=['index','/:id','isAuthenticated','show','download','join','root','originalname','replace','format','basename','now','extname','post','single','file','put','delete','exports','multer','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x85a1,0x95));var _0x185a=function(_0x257a1f,_0x1ce950){_0x257a1f=_0x257a1f-0x0;var _0x1060ea=_0x85a1[_0x257a1f];return _0x1060ea;};'use strict';var multer=require(_0x185a('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(_0x185a('0x1'));var auth=require(_0x185a('0x2'));var interaction=require(_0x185a('0x3'));var config=require(_0x185a('0x4'));var controller=require(_0x185a('0x5'));router[_0x185a('0x6')]('/',auth['isAuthenticated'](),controller[_0x185a('0x7')]);router[_0x185a('0x6')](_0x185a('0x8'),auth[_0x185a('0x9')](),controller[_0x185a('0xa')]);router[_0x185a('0x6')]('/:id/download',auth['isAuthenticated'](),controller[_0x185a('0xb')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x331c40,_0x37609e,_0x15412f){_0x15412f(null,path[_0x185a('0xc')](config[_0x185a('0xd')],'server/files/sounds/original/'));},'filename':function(_0x1dea0a,_0x374caa,_0x61a2cb){_0x374caa[_0x185a('0xe')]=_0x374caa[_0x185a('0xe')][_0x185a('0xf')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x61a2cb(null,util[_0x185a('0x10')]('%s-%s%s',path[_0x185a('0x11')](_0x374caa[_0x185a('0xe')],path['extname'](_0x374caa[_0x185a('0xe')])),Date[_0x185a('0x12')](),path[_0x185a('0x13')](_0x374caa['originalname'])));}})});router[_0x185a('0x14')]('/',upload[_0x185a('0x15')](_0x185a('0x16')),controller['create']);router[_0x185a('0x17')](_0x185a('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x185a('0x18')](_0x185a('0x8'),auth['isAuthenticated'](),controller[_0x185a('0x18')]);module[_0x185a('0x19')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index fc81801..94f125b 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 _0xc257=['STRING','name','BIGINT','INTEGER','FLOAT'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc257,0x168));var _0x7c25=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xc257[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7c25('0x0')],'unique':_0x7c25('0x1'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x7c25('0x0')],'defaultValue':''},'description':{'type':Sequelize[_0x7c25('0x0')]},'original_format':{'type':Sequelize[_0x7c25('0x0')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x7c25('0x2')]},'original_channelCount':{'type':Sequelize[_0x7c25('0x3')]},'original_bitRate':{'type':Sequelize[_0x7c25('0x2')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x7c25('0x0')]},'converted_duration':{'type':Sequelize[_0x7c25('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x7c25('0x2')]},'converted_channelCount':{'type':Sequelize[_0x7c25('0x3')]},'converted_bitRate':{'type':Sequelize[_0x7c25('0x2')]},'converted_sampleRate':{'type':Sequelize[_0x7c25('0x3')]}}; \ No newline at end of file +var _0xe9d1=['FLOAT','BIGINT','INTEGER','exports','name','STRING'];(function(_0x3bbcb3,_0x2e3c3b){var _0x3c2041=function(_0x2ef688){while(--_0x2ef688){_0x3bbcb3['push'](_0x3bbcb3['shift']());}};_0x3c2041(++_0x2e3c3b);}(_0xe9d1,0x1e9));var _0x1e9d=function(_0xc41bd7,_0x2b1e41){_0xc41bd7=_0xc41bd7-0x0;var _0x4a415b=_0xe9d1[_0xc41bd7];return _0x4a415b;};'use strict';var Sequelize=require('sequelize');module[_0x1e9d('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x1e9d('0x1'),'allowNull':![]},'save_name':{'type':Sequelize[_0x1e9d('0x2')]},'display_name':{'type':Sequelize[_0x1e9d('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x1e9d('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x1e9d('0x3')]},'original_sampleCount':{'type':Sequelize[_0x1e9d('0x4')]},'original_channelCount':{'type':Sequelize[_0x1e9d('0x5')]},'original_bitRate':{'type':Sequelize[_0x1e9d('0x4')]},'original_sampleRate':{'type':Sequelize[_0x1e9d('0x5')]},'converted_format':{'type':Sequelize[_0x1e9d('0x2')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x1e9d('0x4')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 885d1fc..2ec2fd7 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 _0xb8bc=['%s.%s','create','file','extname','basename','filename','originalname','wav','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','0777','transcode','send','src','original_duration','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','eml-format','fast-json-patch','moment','mustache','util','path','fs-extra','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','get','Sounds','UserProfileResource','destroy','error','stack','name','index','map','Sound','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','download','converted_format','join','root','Sequelize','ValidationError','server/files/sounds/converted','format','save_name'];(function(_0x1a5453,_0x4ca1df){var _0x582b83=function(_0x1f524a){while(--_0x1f524a){_0x1a5453['push'](_0x1a5453['shift']());}};_0x582b83(++_0x4ca1df);}(_0xb8bc,0x194));var _0xcb8b=function(_0x2f9781,_0x33de38){_0x2f9781=_0x2f9781-0x0;var _0x4ad61e=_0xb8bc[_0x2f9781];return _0x4ad61e;};'use strict';var emlformat=require(_0xcb8b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcb8b('0x1'));var rp=require('request-promise');var moment=require(_0xcb8b('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xcb8b('0x3'));var util=require(_0xcb8b('0x4'));var path=require(_0xcb8b('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcb8b('0x6'));var _=require('lodash');var squel=require(_0xcb8b('0x7'));var crypto=require(_0xcb8b('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xcb8b('0x9'));var toCsv=require(_0xcb8b('0xa'));var querystring=require(_0xcb8b('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xcb8b('0xc'));var qs=require(_0xcb8b('0xd'));var as=require(_0xcb8b('0xe'));var hardwareService=require(_0xcb8b('0xf'));var logger=require(_0xcb8b('0x10'))(_0xcb8b('0x11'));var utils=require(_0xcb8b('0x12'));var config=require(_0xcb8b('0x13'));var licenseUtil=require(_0xcb8b('0x14'));var db=require(_0xcb8b('0x15'))['db'];function respondWithStatusCode(_0x40280c,_0xf8d0d9){_0xf8d0d9=_0xf8d0d9||0xcc;return function(_0x5396a4){if(_0x5396a4){return _0x40280c[_0xcb8b('0x16')](_0xf8d0d9);}return _0x40280c[_0xcb8b('0x17')](_0xf8d0d9)['end']();};}function respondWithResult(_0xba600b,_0x18991e){_0x18991e=_0x18991e||0xc8;return function(_0xd31910){if(_0xd31910){return _0xba600b['status'](_0x18991e)[_0xcb8b('0x18')](_0xd31910);}};}function respondWithFilteredResult(_0x36c5b9,_0x2db164){return function(_0x40f44c){if(_0x40f44c){var _0x423d49=typeof _0x2db164[_0xcb8b('0x19')]===_0xcb8b('0x1a')&&typeof _0x2db164[_0xcb8b('0x1b')]===_0xcb8b('0x1a');var _0x268fb1=_0x40f44c[_0xcb8b('0x1c')];var _0x3cb7b9=_0x423d49?0x0:_0x2db164[_0xcb8b('0x19')];var _0x22c9cb=_0x423d49?_0x40f44c[_0xcb8b('0x1c')]:_0x2db164['offset']+_0x2db164[_0xcb8b('0x1b')];var _0x210cb1;if(_0x22c9cb>=_0x268fb1){_0x22c9cb=_0x268fb1;_0x210cb1=0xc8;}else{_0x210cb1=0xce;}_0x36c5b9[_0xcb8b('0x17')](_0x210cb1);return _0x36c5b9[_0xcb8b('0x1d')](_0xcb8b('0x1e'),_0x3cb7b9+'-'+_0x22c9cb+'/'+_0x268fb1)[_0xcb8b('0x18')](_0x40f44c);}return null;};}function patchUpdates(_0x4cd92b){return function(_0x1cab11){try{jsonpatch['apply'](_0x1cab11,_0x4cd92b,!![]);}catch(_0x52878a){return BPromise[_0xcb8b('0x1f')](_0x52878a);}return _0x1cab11[_0xcb8b('0x20')]();};}function saveUpdates(_0x17f4cc,_0x2a265a){return function(_0x5ef81a){if(_0x5ef81a){return _0x5ef81a['update'](_0x17f4cc)[_0xcb8b('0x21')](function(_0x44a0b6){return _0x44a0b6;});}return null;};}function removeEntity(_0x213896,_0x396c28){return function(_0x55ed3f){if(_0x55ed3f){return _0x55ed3f['destroy']()[_0xcb8b('0x21')](function(){var _0x12fa94=_0x55ed3f[_0xcb8b('0x22')]({'plain':!![]});var _0x59ef93=_0xcb8b('0x23');return db[_0xcb8b('0x24')][_0xcb8b('0x25')]({'where':{'type':_0x59ef93,'resourceId':_0x12fa94['id']}})[_0xcb8b('0x21')](function(){return _0x55ed3f;});})[_0xcb8b('0x21')](function(){_0x213896[_0xcb8b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15e24c,_0x3bd8b1){return function(_0x2363cb){if(!_0x2363cb){_0x15e24c['sendStatus'](0x194);}return _0x2363cb;};}function handleError(_0x3cf532,_0xba1a2d){_0xba1a2d=_0xba1a2d||0x1f4;return function(_0x28d7a4){logger[_0xcb8b('0x26')](_0x28d7a4[_0xcb8b('0x27')]);if(_0x28d7a4[_0xcb8b('0x28')]){delete _0x28d7a4['name'];}_0x3cf532['status'](_0xba1a2d)['send'](_0x28d7a4);};}exports[_0xcb8b('0x29')]=function(_0x92a1d8,_0x2cca59){var _0x32326c={},_0x6e58f4={},_0x39abd5={'count':0x0,'rows':[]};var _0x3939ab=_[_0xcb8b('0x2a')](db[_0xcb8b('0x2b')]['rawAttributes'],function(_0x14ddb3){return{'name':_0x14ddb3[_0xcb8b('0x2c')],'type':_0x14ddb3[_0xcb8b('0x2d')][_0xcb8b('0x2e')]};});_0x6e58f4[_0xcb8b('0x2f')]=_[_0xcb8b('0x2a')](_0x3939ab,'name');_0x6e58f4[_0xcb8b('0x30')]=_[_0xcb8b('0x31')](_0x92a1d8[_0xcb8b('0x30')]);_0x6e58f4[_0xcb8b('0x32')]=_['intersection'](_0x6e58f4[_0xcb8b('0x2f')],_0x6e58f4[_0xcb8b('0x30')]);_0x32326c[_0xcb8b('0x33')]=_[_0xcb8b('0x34')](_0x6e58f4[_0xcb8b('0x2f')],qs[_0xcb8b('0x35')](_0x92a1d8[_0xcb8b('0x30')]['fields']));_0x32326c[_0xcb8b('0x33')]=_0x32326c[_0xcb8b('0x33')][_0xcb8b('0x36')]?_0x32326c[_0xcb8b('0x33')]:_0x6e58f4[_0xcb8b('0x2f')];if(!_0x92a1d8[_0xcb8b('0x30')][_0xcb8b('0x37')](_0xcb8b('0x38'))){_0x32326c[_0xcb8b('0x1b')]=qs[_0xcb8b('0x1b')](_0x92a1d8[_0xcb8b('0x30')][_0xcb8b('0x1b')]);_0x32326c[_0xcb8b('0x19')]=qs[_0xcb8b('0x19')](_0x92a1d8[_0xcb8b('0x30')]['offset']);}_0x32326c['order']=qs[_0xcb8b('0x39')](_0x92a1d8[_0xcb8b('0x30')][_0xcb8b('0x39')]);_0x32326c['where']=qs[_0xcb8b('0x32')](_[_0xcb8b('0x3a')](_0x92a1d8['query'],_0x6e58f4[_0xcb8b('0x32')]),_0x3939ab);if(_0x92a1d8[_0xcb8b('0x30')]['filter']){_0x32326c[_0xcb8b('0x3b')]=_[_0xcb8b('0x3c')](_0x32326c[_0xcb8b('0x3b')],{'$or':_[_0xcb8b('0x2a')](_0x3939ab,function(_0x3b4e28){if(_0x3b4e28[_0xcb8b('0x2d')]!==_0xcb8b('0x3d')){var _0x5a8b20={};_0x5a8b20[_0x3b4e28['name']]={'$like':'%'+_0x92a1d8[_0xcb8b('0x30')]['filter']+'%'};return _0x5a8b20;}})});}_0x32326c=_[_0xcb8b('0x3c')]({},_0x32326c,_0x92a1d8[_0xcb8b('0x3e')]);var _0x233711={'where':_0x32326c[_0xcb8b('0x3b')]};return db[_0xcb8b('0x2b')][_0xcb8b('0x1c')](_0x233711)['then'](function(_0x49ae81){_0x39abd5['count']=_0x49ae81;if(_0x92a1d8[_0xcb8b('0x30')][_0xcb8b('0x3f')]){_0x32326c[_0xcb8b('0x40')]=[{'all':!![]}];}return db[_0xcb8b('0x2b')][_0xcb8b('0x41')](_0x32326c);})['then'](function(_0x52b3b1){_0x39abd5[_0xcb8b('0x42')]=_0x52b3b1;return _0x39abd5;})[_0xcb8b('0x21')](respondWithFilteredResult(_0x2cca59,_0x32326c))['catch'](handleError(_0x2cca59,null));};exports[_0xcb8b('0x43')]=function(_0x13eb32,_0x1390a9){var _0x3c55a6={'raw':!![],'where':{'id':_0x13eb32[_0xcb8b('0x44')]['id']}},_0x4e199d={};_0x4e199d[_0xcb8b('0x2f')]=_[_0xcb8b('0x31')](db[_0xcb8b('0x2b')]['rawAttributes']);_0x4e199d[_0xcb8b('0x30')]=_['keys'](_0x13eb32[_0xcb8b('0x30')]);_0x4e199d[_0xcb8b('0x32')]=_['intersection'](_0x4e199d[_0xcb8b('0x2f')],_0x4e199d['query']);_0x3c55a6[_0xcb8b('0x33')]=_['intersection'](_0x4e199d['model'],qs[_0xcb8b('0x35')](_0x13eb32[_0xcb8b('0x30')]['fields']));_0x3c55a6[_0xcb8b('0x33')]=_0x3c55a6[_0xcb8b('0x33')][_0xcb8b('0x36')]?_0x3c55a6[_0xcb8b('0x33')]:_0x4e199d[_0xcb8b('0x2f')];if(_0x13eb32['query'][_0xcb8b('0x3f')]){_0x3c55a6[_0xcb8b('0x40')]=[{'all':!![]}];}_0x3c55a6=_['merge']({},_0x3c55a6,_0x13eb32['options']);return db['Sound'][_0xcb8b('0x45')](_0x3c55a6)[_0xcb8b('0x21')](handleEntityNotFound(_0x1390a9,null))[_0xcb8b('0x21')](respondWithResult(_0x1390a9,null))[_0xcb8b('0x46')](handleError(_0x1390a9,null));};exports[_0xcb8b('0x47')]=function(_0x50669b,_0x1f341f,_0x260a9c){return db[_0xcb8b('0x2b')][_0xcb8b('0x45')]({'where':{'id':_0x50669b[_0xcb8b('0x44')]['id']},'attributes':['name','save_name',_0xcb8b('0x48')],'raw':!![]})[_0xcb8b('0x21')](handleEntityNotFound(_0x1f341f,null))[_0xcb8b('0x21')](function(_0x36e897){if(_0x36e897){if(!fs['existsSync'](path[_0xcb8b('0x49')](config[_0xcb8b('0x4a')],'server/files/sounds/converted',_0x36e897['save_name']+'.'+_0x36e897[_0xcb8b('0x48')]))){throw new db[(_0xcb8b('0x4b'))][(_0xcb8b('0x4c'))]('Sound\x20not\x20found');}return _0x1f341f[_0xcb8b('0x47')](path[_0xcb8b('0x49')](config[_0xcb8b('0x4a')],_0xcb8b('0x4d'),util[_0xcb8b('0x4e')]('%s.%s',_0x36e897[_0xcb8b('0x4f')],_0x36e897[_0xcb8b('0x48')])),util[_0xcb8b('0x4e')](_0xcb8b('0x50'),_0x36e897[_0xcb8b('0x28')],_0x36e897['converted_format']));}return null;})['catch'](handleError(_0x1f341f,null));};exports[_0xcb8b('0x51')]=function(_0x59ec04,_0x86a16d,_0x408187){var _0x235ca8={'name':path['basename'](_0x59ec04[_0xcb8b('0x52')]['originalname'],path[_0xcb8b('0x53')](_0x59ec04[_0xcb8b('0x52')]['originalname'])),'save_name':path[_0xcb8b('0x54')](_0x59ec04['file'][_0xcb8b('0x55')],path[_0xcb8b('0x53')](_0x59ec04[_0xcb8b('0x52')]['filename'])),'original_format':path[_0xcb8b('0x53')](_0x59ec04[_0xcb8b('0x52')][_0xcb8b('0x56')])['substring'](0x1),'converted_format':_0xcb8b('0x57')};var _0x17ec6a=path[_0xcb8b('0x49')](config[_0xcb8b('0x4a')],_0xcb8b('0x58'),_0x59ec04[_0xcb8b('0x52')][_0xcb8b('0x55')]);var _0x17d38e=path[_0xcb8b('0x49')](config[_0xcb8b('0x4a')],'server/files/sounds/converted',util[_0xcb8b('0x4e')]('%s.%s',path[_0xcb8b('0x54')](_0x59ec04['file'][_0xcb8b('0x55')],path[_0xcb8b('0x53')](_0x59ec04[_0xcb8b('0x52')]['filename'])),_0x235ca8[_0xcb8b('0x48')]));logger['info'](_0xcb8b('0x59'),_0x17ec6a);logger[_0xcb8b('0x5a')](_0xcb8b('0x5b'),_0x17d38e);try{fs['chmodSync'](_0x17ec6a,parseInt(_0xcb8b('0x5c'),0x8));var _0x41c417=sox[_0xcb8b('0x5d')](_0x17ec6a,_0x17d38e,{'sampleRate':0x1f40,'format':_0xcb8b('0x57'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x41c417['on']('error',function(_0x3e7196){fs['unlinkSync'](_0x17ec6a);_0x86a16d['status'](0x1f4)[_0xcb8b('0x5e')](_0x3e7196);});_0x41c417['on'](_0xcb8b('0x5f'),function(_0x1f4b71){_0x235ca8[_0xcb8b('0x60')]=isNaN(_0x1f4b71[_0xcb8b('0x61')])?null:_0x1f4b71['duration']*0x3e8;_0x235ca8['original_sampleCount']=isNaN(_0x1f4b71[_0xcb8b('0x62')])?null:_0x1f4b71[_0xcb8b('0x62')];_0x235ca8[_0xcb8b('0x63')]=isNaN(_0x1f4b71[_0xcb8b('0x64')])?null:_0x1f4b71[_0xcb8b('0x64')];_0x235ca8[_0xcb8b('0x65')]=isNaN(_0x1f4b71[_0xcb8b('0x66')])?null:_0x1f4b71['bitRate'];_0x235ca8[_0xcb8b('0x67')]=isNaN(_0x1f4b71[_0xcb8b('0x68')])?null:_0x1f4b71[_0xcb8b('0x68')];});_0x41c417['on'](_0xcb8b('0x69'),function(_0x2e54c6){_0x235ca8[_0xcb8b('0x6a')]=isNaN(_0x2e54c6['duration'])?null:_0x2e54c6['duration']*0x3e8;_0x235ca8['converted_sampleCount']=isNaN(_0x2e54c6[_0xcb8b('0x62')])?null:_0x2e54c6[_0xcb8b('0x62')];_0x235ca8[_0xcb8b('0x6b')]=isNaN(_0x2e54c6['channelCount'])?null:_0x2e54c6[_0xcb8b('0x64')];_0x235ca8[_0xcb8b('0x6c')]=isNaN(_0x2e54c6['bitRate'])?null:_0x2e54c6['bitRate'];_0x235ca8[_0xcb8b('0x6d')]=isNaN(_0x2e54c6[_0xcb8b('0x68')])?null:_0x2e54c6[_0xcb8b('0x68')];});_0x41c417['on']('end',function(){fs['chmodSync'](_0x17d38e,parseInt(_0xcb8b('0x5c'),0x8));return db[_0xcb8b('0x2b')][_0xcb8b('0x51')](_0x235ca8)[_0xcb8b('0x21')](function(_0xf3699a){var _0x53f222={'role':_0x59ec04[_0xcb8b('0x6e')][_0xcb8b('0x6f')],'userProfileId':_0x59ec04[_0xcb8b('0x6e')][_0xcb8b('0x70')]};if(!_0x53f222)throw new Error(_0xcb8b('0x71'));if(_0x53f222[_0xcb8b('0x6f')]==='user'){var _0x38bccd=_0xf3699a[_0xcb8b('0x22')]({'plain':!![]});return db[_0xcb8b('0x72')][_0xcb8b('0x45')]({'where':{'name':_0xcb8b('0x23'),'userProfileId':_0x53f222['userProfileId']},'raw':!![]})[_0xcb8b('0x21')](function(_0x1f2332){if(_0x1f2332&&_0x1f2332[_0xcb8b('0x73')]===0x0){return db['UserProfileResource']['create']({'name':_0x38bccd[_0xcb8b('0x28')],'resourceId':_0x38bccd['id'],'type':_0x1f2332[_0xcb8b('0x28')],'sectionId':_0x1f2332['id']},{})[_0xcb8b('0x21')](function(){return _0xf3699a;});}else{return _0xf3699a;}})[_0xcb8b('0x46')](function(_0x4bdb89){logger[_0xcb8b('0x26')](_0xcb8b('0x74'),_0x4bdb89);throw _0x4bdb89;});}return _0xf3699a;})[_0xcb8b('0x21')](respondWithResult(_0x86a16d,null))[_0xcb8b('0x46')](handleError(_0x86a16d,null));});_0x41c417[_0xcb8b('0x75')]();}catch(_0x1bdb45){_0x86a16d[_0xcb8b('0x17')](0x1f4)[_0xcb8b('0x5e')](_0x1bdb45);}};exports['update']=function(_0x4e0f2d,_0x5af285,_0x1bc7bb){return db['Sound']['find']({'where':{'id':_0x4e0f2d['params']['id']}})[_0xcb8b('0x21')](handleEntityNotFound(_0x5af285,null))[_0xcb8b('0x21')](saveUpdates(_[_0xcb8b('0x3a')](_0x4e0f2d[_0xcb8b('0x6e')],[_0xcb8b('0x28'),_0xcb8b('0x76')]),null))[_0xcb8b('0x21')](respondWithResult(_0x5af285,null))[_0xcb8b('0x46')](handleError(_0x5af285,null));};exports[_0xcb8b('0x77')]=function(_0x5e00bb,_0x29ca45,_0x3f66da){return db[_0xcb8b('0x2b')][_0xcb8b('0x45')]({'where':{'id':_0x5e00bb[_0xcb8b('0x44')]['id']}})[_0xcb8b('0x21')](function(_0x11f23a){if(_0x11f23a){return _0x11f23a['destroy']();}})['then'](function(_0x2ca5fe){var _0x4da774=path['join'](config[_0xcb8b('0x4a')],_0xcb8b('0x58'),util[_0xcb8b('0x4e')](_0xcb8b('0x50'),_0x2ca5fe[_0xcb8b('0x4f')],_0x2ca5fe[_0xcb8b('0x78')]));var _0x3a5a32=path['join'](config[_0xcb8b('0x4a')],_0xcb8b('0x4d'),util[_0xcb8b('0x4e')]('%s.%s',_0x2ca5fe[_0xcb8b('0x4f')],_0x2ca5fe[_0xcb8b('0x48')]));fs['unlinkSync'](_0x4da774);fs['unlinkSync'](_0x3a5a32);return _0x2ca5fe;})[_0xcb8b('0x21')](function(_0x4ff31f){if(_0x4ff31f){return _0x29ca45[_0xcb8b('0x17')](0xcc)['end']();}})['then'](handleEntityNotFound(_0x29ca45,null))[_0xcb8b('0x46')](handleError(_0x29ca45,null));}; \ No newline at end of file +var _0xd093=['map','Sound','rawAttributes','fieldName','key','keys','filters','model','attributes','intersection','fields','query','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','merge','find','download','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','Sound\x20not\x20found','format','%s.%s','file','originalname','basename','filename','substring','wav','server/files/sounds/original','extname','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','unlinkSync','send','src','original_duration','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_channelCount','converted_bitRate','converted_sampleRate','0777','create','body','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','Sounds','UserProfileResource','end','error','stack','name','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd093,0x159));var _0x3d09=function(_0x437dcd,_0x2dc228){_0x437dcd=_0x437dcd-0x0;var _0x18de98=_0xd093[_0x437dcd];return _0x18de98;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3d09('0x0'));var jsonpatch=require(_0x3d09('0x1'));var rp=require(_0x3d09('0x2'));var moment=require(_0x3d09('0x3'));var BPromise=require(_0x3d09('0x4'));var Mustache=require(_0x3d09('0x5'));var util=require(_0x3d09('0x6'));var path=require(_0x3d09('0x7'));var sox=require(_0x3d09('0x8'));var csv=require(_0x3d09('0x9'));var ejs=require(_0x3d09('0xa'));var fs=require('fs');var fs_extra=require(_0x3d09('0xb'));var _=require(_0x3d09('0xc'));var squel=require('squel');var crypto=require(_0x3d09('0xd'));var jsforce=require(_0x3d09('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3d09('0x9'));var querystring=require(_0x3d09('0xf'));var Papa=require(_0x3d09('0x10'));var Redis=require(_0x3d09('0x11'));var authService=require(_0x3d09('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3d09('0x13'));var hardwareService=require(_0x3d09('0x14'));var logger=require(_0x3d09('0x15'))('api');var utils=require(_0x3d09('0x16'));var config=require(_0x3d09('0x17'));var licenseUtil=require(_0x3d09('0x18'));var db=require(_0x3d09('0x19'))['db'];function respondWithStatusCode(_0x46f877,_0x1aa72e){_0x1aa72e=_0x1aa72e||0xcc;return function(_0x245127){if(_0x245127){return _0x46f877[_0x3d09('0x1a')](_0x1aa72e);}return _0x46f877[_0x3d09('0x1b')](_0x1aa72e)['end']();};}function respondWithResult(_0x2fad18,_0x4afdc7){_0x4afdc7=_0x4afdc7||0xc8;return function(_0x215fea){if(_0x215fea){return _0x2fad18[_0x3d09('0x1b')](_0x4afdc7)[_0x3d09('0x1c')](_0x215fea);}};}function respondWithFilteredResult(_0x4bd931,_0x50b465){return function(_0x493f9e){if(_0x493f9e){var _0x549971=typeof _0x50b465[_0x3d09('0x1d')]===_0x3d09('0x1e')&&typeof _0x50b465[_0x3d09('0x1f')]===_0x3d09('0x1e');var _0x1c61b2=_0x493f9e[_0x3d09('0x20')];var _0x41689f=_0x549971?0x0:_0x50b465[_0x3d09('0x1d')];var _0x3b87d5=_0x549971?_0x493f9e[_0x3d09('0x20')]:_0x50b465['offset']+_0x50b465[_0x3d09('0x1f')];var _0xde9ee4;if(_0x3b87d5>=_0x1c61b2){_0x3b87d5=_0x1c61b2;_0xde9ee4=0xc8;}else{_0xde9ee4=0xce;}_0x4bd931[_0x3d09('0x1b')](_0xde9ee4);return _0x4bd931[_0x3d09('0x21')](_0x3d09('0x22'),_0x41689f+'-'+_0x3b87d5+'/'+_0x1c61b2)[_0x3d09('0x1c')](_0x493f9e);}return null;};}function patchUpdates(_0x2dfd9e){return function(_0x1e7aa4){try{jsonpatch[_0x3d09('0x23')](_0x1e7aa4,_0x2dfd9e,!![]);}catch(_0x2c7977){return BPromise[_0x3d09('0x24')](_0x2c7977);}return _0x1e7aa4['save']();};}function saveUpdates(_0x478290,_0x77dc6e){return function(_0x1e4f47){if(_0x1e4f47){return _0x1e4f47[_0x3d09('0x25')](_0x478290)[_0x3d09('0x26')](function(_0x181dee){return _0x181dee;});}return null;};}function removeEntity(_0xec32ff,_0x583c63){return function(_0x57d5eb){if(_0x57d5eb){return _0x57d5eb[_0x3d09('0x27')]()['then'](function(){var _0x1b2cce=_0x57d5eb[_0x3d09('0x28')]({'plain':!![]});var _0x580fc9=_0x3d09('0x29');return db[_0x3d09('0x2a')][_0x3d09('0x27')]({'where':{'type':_0x580fc9,'resourceId':_0x1b2cce['id']}})['then'](function(){return _0x57d5eb;});})[_0x3d09('0x26')](function(){_0xec32ff[_0x3d09('0x1b')](0xcc)[_0x3d09('0x2b')]();});}};}function handleEntityNotFound(_0x3d527b,_0x573a34){return function(_0x320a48){if(!_0x320a48){_0x3d527b[_0x3d09('0x1a')](0x194);}return _0x320a48;};}function handleError(_0x4e47c4,_0x317bb8){_0x317bb8=_0x317bb8||0x1f4;return function(_0x20c700){logger[_0x3d09('0x2c')](_0x20c700[_0x3d09('0x2d')]);if(_0x20c700['name']){delete _0x20c700[_0x3d09('0x2e')];}_0x4e47c4[_0x3d09('0x1b')](_0x317bb8)['send'](_0x20c700);};}exports[_0x3d09('0x2f')]=function(_0x3f2472,_0x545d58){var _0x4633b5={},_0x514504={},_0x268350={'count':0x0,'rows':[]};var _0x13a0a7=_[_0x3d09('0x30')](db[_0x3d09('0x31')][_0x3d09('0x32')],function(_0x150995){return{'name':_0x150995[_0x3d09('0x33')],'type':_0x150995['type'][_0x3d09('0x34')]};});_0x514504['model']=_[_0x3d09('0x30')](_0x13a0a7,_0x3d09('0x2e'));_0x514504['query']=_[_0x3d09('0x35')](_0x3f2472['query']);_0x514504[_0x3d09('0x36')]=_['intersection'](_0x514504[_0x3d09('0x37')],_0x514504['query']);_0x4633b5[_0x3d09('0x38')]=_[_0x3d09('0x39')](_0x514504[_0x3d09('0x37')],qs[_0x3d09('0x3a')](_0x3f2472[_0x3d09('0x3b')][_0x3d09('0x3a')]));_0x4633b5[_0x3d09('0x38')]=_0x4633b5[_0x3d09('0x38')]['length']?_0x4633b5['attributes']:_0x514504[_0x3d09('0x37')];if(!_0x3f2472[_0x3d09('0x3b')][_0x3d09('0x3c')](_0x3d09('0x3d'))){_0x4633b5['limit']=qs[_0x3d09('0x1f')](_0x3f2472[_0x3d09('0x3b')][_0x3d09('0x1f')]);_0x4633b5[_0x3d09('0x1d')]=qs['offset'](_0x3f2472['query'][_0x3d09('0x1d')]);}_0x4633b5[_0x3d09('0x3e')]=qs[_0x3d09('0x3f')](_0x3f2472[_0x3d09('0x3b')][_0x3d09('0x3f')]);_0x4633b5[_0x3d09('0x40')]=qs[_0x3d09('0x36')](_[_0x3d09('0x41')](_0x3f2472[_0x3d09('0x3b')],_0x514504['filters']),_0x13a0a7);if(_0x3f2472[_0x3d09('0x3b')][_0x3d09('0x42')]){_0x4633b5[_0x3d09('0x40')]=_['merge'](_0x4633b5['where'],{'$or':_[_0x3d09('0x30')](_0x13a0a7,function(_0x4e75b6){if(_0x4e75b6[_0x3d09('0x43')]!==_0x3d09('0x44')){var _0x199dbf={};_0x199dbf[_0x4e75b6[_0x3d09('0x2e')]]={'$like':'%'+_0x3f2472[_0x3d09('0x3b')][_0x3d09('0x42')]+'%'};return _0x199dbf;}})});}_0x4633b5=_['merge']({},_0x4633b5,_0x3f2472[_0x3d09('0x45')]);var _0x1b32dc={'where':_0x4633b5['where']};return db['Sound']['count'](_0x1b32dc)[_0x3d09('0x26')](function(_0x1c2d78){_0x268350[_0x3d09('0x20')]=_0x1c2d78;if(_0x3f2472[_0x3d09('0x3b')][_0x3d09('0x46')]){_0x4633b5[_0x3d09('0x47')]=[{'all':!![]}];}return db[_0x3d09('0x31')][_0x3d09('0x48')](_0x4633b5);})[_0x3d09('0x26')](function(_0x32f33c){_0x268350[_0x3d09('0x49')]=_0x32f33c;return _0x268350;})[_0x3d09('0x26')](respondWithFilteredResult(_0x545d58,_0x4633b5))[_0x3d09('0x4a')](handleError(_0x545d58,null));};exports[_0x3d09('0x4b')]=function(_0x3a62e2,_0x137ae6){var _0xf26db1={'raw':!![],'where':{'id':_0x3a62e2[_0x3d09('0x4c')]['id']}},_0x2128cc={};_0x2128cc[_0x3d09('0x37')]=_[_0x3d09('0x35')](db[_0x3d09('0x31')][_0x3d09('0x32')]);_0x2128cc[_0x3d09('0x3b')]=_['keys'](_0x3a62e2[_0x3d09('0x3b')]);_0x2128cc[_0x3d09('0x36')]=_[_0x3d09('0x39')](_0x2128cc['model'],_0x2128cc[_0x3d09('0x3b')]);_0xf26db1[_0x3d09('0x38')]=_['intersection'](_0x2128cc[_0x3d09('0x37')],qs[_0x3d09('0x3a')](_0x3a62e2[_0x3d09('0x3b')][_0x3d09('0x3a')]));_0xf26db1['attributes']=_0xf26db1[_0x3d09('0x38')][_0x3d09('0x4d')]?_0xf26db1[_0x3d09('0x38')]:_0x2128cc[_0x3d09('0x37')];if(_0x3a62e2['query'][_0x3d09('0x46')]){_0xf26db1[_0x3d09('0x47')]=[{'all':!![]}];}_0xf26db1=_[_0x3d09('0x4e')]({},_0xf26db1,_0x3a62e2[_0x3d09('0x45')]);return db[_0x3d09('0x31')][_0x3d09('0x4f')](_0xf26db1)[_0x3d09('0x26')](handleEntityNotFound(_0x137ae6,null))[_0x3d09('0x26')](respondWithResult(_0x137ae6,null))['catch'](handleError(_0x137ae6,null));};exports[_0x3d09('0x50')]=function(_0x383cf9,_0x1cf9da,_0x271d10){return db[_0x3d09('0x31')][_0x3d09('0x4f')]({'where':{'id':_0x383cf9[_0x3d09('0x4c')]['id']},'attributes':[_0x3d09('0x2e'),_0x3d09('0x51'),_0x3d09('0x52')],'raw':!![]})['then'](handleEntityNotFound(_0x1cf9da,null))[_0x3d09('0x26')](function(_0x3b7f9d){if(_0x3b7f9d){if(!fs[_0x3d09('0x53')](path[_0x3d09('0x54')](config[_0x3d09('0x55')],_0x3d09('0x56'),_0x3b7f9d[_0x3d09('0x51')]+'.'+_0x3b7f9d['converted_format']))){throw new db[(_0x3d09('0x57'))]['ValidationError'](_0x3d09('0x58'));}return _0x1cf9da[_0x3d09('0x50')](path[_0x3d09('0x54')](config['root'],_0x3d09('0x56'),util[_0x3d09('0x59')](_0x3d09('0x5a'),_0x3b7f9d['save_name'],_0x3b7f9d[_0x3d09('0x52')])),util['format'](_0x3d09('0x5a'),_0x3b7f9d[_0x3d09('0x2e')],_0x3b7f9d[_0x3d09('0x52')]));}return null;})[_0x3d09('0x4a')](handleError(_0x1cf9da,null));};exports['create']=function(_0x43202d,_0x451b88,_0x4d86db){var _0x18706f={'name':path['basename'](_0x43202d['file']['originalname'],path['extname'](_0x43202d[_0x3d09('0x5b')][_0x3d09('0x5c')])),'save_name':path[_0x3d09('0x5d')](_0x43202d['file'][_0x3d09('0x5e')],path['extname'](_0x43202d[_0x3d09('0x5b')][_0x3d09('0x5e')])),'original_format':path['extname'](_0x43202d[_0x3d09('0x5b')][_0x3d09('0x5c')])[_0x3d09('0x5f')](0x1),'converted_format':_0x3d09('0x60')};var _0x5a7a91=path[_0x3d09('0x54')](config['root'],_0x3d09('0x61'),_0x43202d['file']['filename']);var _0x47196b=path[_0x3d09('0x54')](config['root'],_0x3d09('0x56'),util['format'](_0x3d09('0x5a'),path[_0x3d09('0x5d')](_0x43202d[_0x3d09('0x5b')][_0x3d09('0x5e')],path[_0x3d09('0x62')](_0x43202d[_0x3d09('0x5b')]['filename'])),_0x18706f['converted_format']));logger[_0x3d09('0x63')](_0x3d09('0x64'),_0x5a7a91);logger[_0x3d09('0x63')](_0x3d09('0x65'),_0x47196b);try{fs[_0x3d09('0x66')](_0x5a7a91,parseInt('0777',0x8));var _0xab94f0=sox[_0x3d09('0x67')](_0x5a7a91,_0x47196b,{'sampleRate':0x1f40,'format':_0x3d09('0x60'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xab94f0['on'](_0x3d09('0x2c'),function(_0x488b60){fs[_0x3d09('0x68')](_0x5a7a91);_0x451b88[_0x3d09('0x1b')](0x1f4)[_0x3d09('0x69')](_0x488b60);});_0xab94f0['on'](_0x3d09('0x6a'),function(_0x2309d5){_0x18706f[_0x3d09('0x6b')]=isNaN(_0x2309d5[_0x3d09('0x6c')])?null:_0x2309d5['duration']*0x3e8;_0x18706f['original_sampleCount']=isNaN(_0x2309d5[_0x3d09('0x6d')])?null:_0x2309d5['sampleCount'];_0x18706f[_0x3d09('0x6e')]=isNaN(_0x2309d5[_0x3d09('0x6f')])?null:_0x2309d5[_0x3d09('0x6f')];_0x18706f[_0x3d09('0x70')]=isNaN(_0x2309d5[_0x3d09('0x71')])?null:_0x2309d5[_0x3d09('0x71')];_0x18706f['original_sampleRate']=isNaN(_0x2309d5[_0x3d09('0x72')])?null:_0x2309d5['sampleRate'];});_0xab94f0['on'](_0x3d09('0x73'),function(_0x5b869e){_0x18706f[_0x3d09('0x74')]=isNaN(_0x5b869e['duration'])?null:_0x5b869e[_0x3d09('0x6c')]*0x3e8;_0x18706f['converted_sampleCount']=isNaN(_0x5b869e[_0x3d09('0x6d')])?null:_0x5b869e[_0x3d09('0x6d')];_0x18706f[_0x3d09('0x75')]=isNaN(_0x5b869e[_0x3d09('0x6f')])?null:_0x5b869e['channelCount'];_0x18706f[_0x3d09('0x76')]=isNaN(_0x5b869e['bitRate'])?null:_0x5b869e[_0x3d09('0x71')];_0x18706f[_0x3d09('0x77')]=isNaN(_0x5b869e[_0x3d09('0x72')])?null:_0x5b869e[_0x3d09('0x72')];});_0xab94f0['on']('end',function(){fs[_0x3d09('0x66')](_0x47196b,parseInt(_0x3d09('0x78'),0x8));return db[_0x3d09('0x31')][_0x3d09('0x79')](_0x18706f)['then'](function(_0x1299a6){var _0x122672={'role':_0x43202d[_0x3d09('0x7a')][_0x3d09('0x7b')],'userProfileId':_0x43202d['body'][_0x3d09('0x7c')]};if(!_0x122672)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x122672[_0x3d09('0x7b')]==='user'){var _0x25119e=_0x1299a6[_0x3d09('0x28')]({'plain':!![]});return db['UserProfileSection'][_0x3d09('0x4f')]({'where':{'name':_0x3d09('0x29'),'userProfileId':_0x122672[_0x3d09('0x7c')]},'raw':!![]})['then'](function(_0x451883){if(_0x451883&&_0x451883[_0x3d09('0x7d')]===0x0){return db['UserProfileResource'][_0x3d09('0x79')]({'name':_0x25119e[_0x3d09('0x2e')],'resourceId':_0x25119e['id'],'type':_0x451883[_0x3d09('0x2e')],'sectionId':_0x451883['id']},{})[_0x3d09('0x26')](function(){return _0x1299a6;});}else{return _0x1299a6;}})[_0x3d09('0x4a')](function(_0x3bfa61){logger[_0x3d09('0x2c')](_0x3d09('0x7e'),_0x3bfa61);throw _0x3bfa61;});}return _0x1299a6;})[_0x3d09('0x26')](respondWithResult(_0x451b88,null))[_0x3d09('0x4a')](handleError(_0x451b88,null));});_0xab94f0[_0x3d09('0x7f')]();}catch(_0xfc732b){_0x451b88[_0x3d09('0x1b')](0x1f4)[_0x3d09('0x69')](_0xfc732b);}};exports['update']=function(_0xd6a937,_0xe1590d,_0xcee2ba){return db[_0x3d09('0x31')][_0x3d09('0x4f')]({'where':{'id':_0xd6a937[_0x3d09('0x4c')]['id']}})['then'](handleEntityNotFound(_0xe1590d,null))['then'](saveUpdates(_[_0x3d09('0x41')](_0xd6a937[_0x3d09('0x7a')],['name',_0x3d09('0x80')]),null))[_0x3d09('0x26')](respondWithResult(_0xe1590d,null))[_0x3d09('0x4a')](handleError(_0xe1590d,null));};exports[_0x3d09('0x81')]=function(_0x4a3e5f,_0x385aab,_0x4c572d){return db[_0x3d09('0x31')][_0x3d09('0x4f')]({'where':{'id':_0x4a3e5f['params']['id']}})[_0x3d09('0x26')](function(_0x225c83){if(_0x225c83){return _0x225c83[_0x3d09('0x27')]();}})['then'](function(_0x261c36){var _0x395824=path[_0x3d09('0x54')](config[_0x3d09('0x55')],_0x3d09('0x61'),util[_0x3d09('0x59')](_0x3d09('0x5a'),_0x261c36[_0x3d09('0x51')],_0x261c36[_0x3d09('0x82')]));var _0x567b53=path[_0x3d09('0x54')](config[_0x3d09('0x55')],_0x3d09('0x56'),util[_0x3d09('0x59')](_0x3d09('0x5a'),_0x261c36[_0x3d09('0x51')],_0x261c36[_0x3d09('0x52')]));fs[_0x3d09('0x68')](_0x395824);fs[_0x3d09('0x68')](_0x567b53);return _0x261c36;})[_0x3d09('0x26')](function(_0x5f5bfb){if(_0x5f5bfb){return _0x385aab[_0x3d09('0x1b')](0xcc)[_0x3d09('0x2b')]();}})[_0x3d09('0x26')](handleEntityNotFound(_0x385aab,null))[_0x3d09('0x4a')](handleError(_0x385aab,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 02a3251..cb4668b 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 _0xb375=['../../config/logger','api','moment','request-promise','path','rimraf','./sound.attributes','Sound','tools_sounds','lodash','util'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xb375,0x1c1));var _0x5b37=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb375[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5b37('0x0'));var util=require(_0x5b37('0x1'));var logger=require(_0x5b37('0x2'))(_0x5b37('0x3'));var moment=require(_0x5b37('0x4'));var BPromise=require('bluebird');var rp=require(_0x5b37('0x5'));var fs=require('fs');var path=require(_0x5b37('0x6'));var rimraf=require(_0x5b37('0x7'));var config=require('../../config/environment');var attributes=require(_0x5b37('0x8'));module['exports']=function(_0x86dc98,_0x29d046){return _0x86dc98['define'](_0x5b37('0x9'),attributes,{'tableName':_0x5b37('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1fdc=['bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','tools_sounds','lodash','../../config/logger','api','moment'];(function(_0x2dfe23,_0x3067b5){var _0x1e3aa3=function(_0x43077a){while(--_0x43077a){_0x2dfe23['push'](_0x2dfe23['shift']());}};_0x1e3aa3(++_0x3067b5);}(_0x1fdc,0x1c3));var _0xc1fd=function(_0x483102,_0x54e93d){_0x483102=_0x483102-0x0;var _0x5cc885=_0x1fdc[_0x483102];return _0x5cc885;};'use strict';var _=require(_0xc1fd('0x0'));var util=require('util');var logger=require(_0xc1fd('0x1'))(_0xc1fd('0x2'));var moment=require(_0xc1fd('0x3'));var BPromise=require(_0xc1fd('0x4'));var rp=require(_0xc1fd('0x5'));var fs=require('fs');var path=require(_0xc1fd('0x6'));var rimraf=require(_0xc1fd('0x7'));var config=require(_0xc1fd('0x8'));var attributes=require(_0xc1fd('0x9'));module[_0xc1fd('0xa')]=function(_0x2afd1b,_0x2b159b){return _0x2afd1b[_0xc1fd('0xb')]('Sound',attributes,{'tableName':_0xc1fd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index f9613b7..cf182ae 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 _0x1742=['debug','Sound,\x20%s,\x20%s,\x20%s','error','Sound,\x20%s,\x20%s','message','result','find','options','raw','where','attributes','include','map','model','info','ShowSound','stringify','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','request\x20sent'];(function(_0x578062,_0x2858e9){var _0x2ba7f5=function(_0x238e56){while(--_0x238e56){_0x578062['push'](_0x578062['shift']());}};_0x2ba7f5(++_0x2858e9);}(_0x1742,0x1b2));var _0x2174=function(_0x52c345,_0x4ea01b){_0x52c345=_0x52c345-0x0;var _0x38f158=_0x1742[_0x52c345];return _0x38f158;};'use strict';var _=require(_0x2174('0x0'));var util=require(_0x2174('0x1'));var moment=require('moment');var BPromise=require(_0x2174('0x2'));var rs=require(_0x2174('0x3'));var fs=require('fs');var Redis=require(_0x2174('0x4'));var db=require(_0x2174('0x5'))['db'];var utils=require(_0x2174('0x6'));var logger=require(_0x2174('0x7'))(_0x2174('0x8'));var config=require(_0x2174('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2174('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17afcd,_0x46a194,_0x2a53b7){return new BPromise(function(_0x2540b5,_0x41d308){return client[_0x2174('0xb')](_0x17afcd,_0x2a53b7)[_0x2174('0xc')](function(_0x336618){logger['info']('Sound,\x20%s,\x20%s',_0x46a194,_0x2174('0xd'));logger[_0x2174('0xe')](_0x2174('0xf'),_0x46a194,'request\x20sent',JSON['stringify'](_0x336618));if(_0x336618['error']){if(_0x336618[_0x2174('0x10')]['code']===0x1f4){logger['error'](_0x2174('0x11'),_0x46a194,_0x336618[_0x2174('0x10')][_0x2174('0x12')]);return _0x41d308(_0x336618[_0x2174('0x10')]['message']);}logger[_0x2174('0x10')](_0x2174('0x11'),_0x46a194,_0x336618['error'][_0x2174('0x12')]);return _0x2540b5(_0x336618[_0x2174('0x10')][_0x2174('0x12')]);}else{logger['info'](_0x2174('0x11'),_0x46a194,'request\x20sent');_0x2540b5(_0x336618[_0x2174('0x13')][_0x2174('0x12')]);}})['catch'](function(_0x4cf8c6){logger[_0x2174('0x10')](_0x2174('0x11'),_0x46a194,_0x4cf8c6);_0x41d308(_0x4cf8c6);});});}exports['ShowSound']=function(_0x51e79f){var _0x241b19=this;return new Promise(function(_0x551b30,_0x5a6b3a){return db['Sound'][_0x2174('0x14')]({'raw':_0x51e79f[_0x2174('0x15')]?_0x51e79f[_0x2174('0x15')][_0x2174('0x16')]===undefined?!![]:![]:!![],'where':_0x51e79f[_0x2174('0x15')]?_0x51e79f[_0x2174('0x15')][_0x2174('0x17')]||null:null,'attributes':_0x51e79f[_0x2174('0x15')]?_0x51e79f['options'][_0x2174('0x18')]||null:null,'include':_0x51e79f[_0x2174('0x15')]?_0x51e79f[_0x2174('0x15')][_0x2174('0x19')]?_[_0x2174('0x1a')](_0x51e79f[_0x2174('0x15')][_0x2174('0x19')],function(_0x1de834){return{'model':db[_0x1de834[_0x2174('0x1b')]],'as':_0x1de834['as'],'attributes':_0x1de834[_0x2174('0x18')],'include':_0x1de834['include']?_['map'](_0x1de834[_0x2174('0x19')],function(_0x7d6b68){return{'model':db[_0x7d6b68['model']],'as':_0x7d6b68['as'],'attributes':_0x7d6b68[_0x2174('0x18')],'include':_0x7d6b68[_0x2174('0x19')]?_[_0x2174('0x1a')](_0x7d6b68[_0x2174('0x19')],function(_0x4a5d70){return{'model':db[_0x4a5d70[_0x2174('0x1b')]],'as':_0x4a5d70['as'],'attributes':_0x4a5d70[_0x2174('0x18')]};}):[]};}):[]};}):[]:[]})[_0x2174('0xc')](function(_0x140089){logger[_0x2174('0x1c')]('ShowSound',_0x51e79f);logger[_0x2174('0xe')](_0x2174('0x1d'),_0x51e79f,JSON[_0x2174('0x1e')](_0x140089));_0x551b30(_0x140089);})[_0x2174('0x1f')](function(_0x2a2082){logger[_0x2174('0x10')](_0x2174('0x1d'),_0x2a2082[_0x2174('0x12')],_0x51e79f);_0x5a6b3a(_0x241b19[_0x2174('0x10')](0x1f4,_0x2a2082[_0x2174('0x12')]));});});}; \ No newline at end of file +var _0x29c5=['stringify','error','code','message','Sound,\x20%s,\x20%s','result','catch','Sound','find','options','raw','where','attributes','include','model','map','then','ShowSound','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','debug','request\x20sent'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x29c5,0x112));var _0x529c=function(_0x3d2a8b,_0x50e96c){_0x3d2a8b=_0x3d2a8b-0x0;var _0x1b93b7=_0x29c5[_0x3d2a8b];return _0x1b93b7;};'use strict';var _=require('lodash');var util=require(_0x529c('0x0'));var moment=require(_0x529c('0x1'));var BPromise=require(_0x529c('0x2'));var rs=require(_0x529c('0x3'));var fs=require('fs');var Redis=require(_0x529c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x529c('0x5'));var logger=require(_0x529c('0x6'))(_0x529c('0x7'));var config=require(_0x529c('0x8'));var jayson=require(_0x529c('0x9'));var client=jayson[_0x529c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5087db,_0x3b9bd7,_0x2d78aa){return new BPromise(function(_0x4fb99,_0x3c57ba){return client['request'](_0x5087db,_0x2d78aa)['then'](function(_0x32e869){logger[_0x529c('0xb')]('Sound,\x20%s,\x20%s',_0x3b9bd7,'request\x20sent');logger[_0x529c('0xc')]('Sound,\x20%s,\x20%s,\x20%s',_0x3b9bd7,_0x529c('0xd'),JSON[_0x529c('0xe')](_0x32e869));if(_0x32e869[_0x529c('0xf')]){if(_0x32e869['error'][_0x529c('0x10')]===0x1f4){logger[_0x529c('0xf')]('Sound,\x20%s,\x20%s',_0x3b9bd7,_0x32e869[_0x529c('0xf')][_0x529c('0x11')]);return _0x3c57ba(_0x32e869[_0x529c('0xf')][_0x529c('0x11')]);}logger[_0x529c('0xf')]('Sound,\x20%s,\x20%s',_0x3b9bd7,_0x32e869[_0x529c('0xf')][_0x529c('0x11')]);return _0x4fb99(_0x32e869[_0x529c('0xf')][_0x529c('0x11')]);}else{logger[_0x529c('0xb')](_0x529c('0x12'),_0x3b9bd7,_0x529c('0xd'));_0x4fb99(_0x32e869[_0x529c('0x13')][_0x529c('0x11')]);}})[_0x529c('0x14')](function(_0x3762bf){logger['error'](_0x529c('0x12'),_0x3b9bd7,_0x3762bf);_0x3c57ba(_0x3762bf);});});}exports['ShowSound']=function(_0x574dc0){var _0x134f9c=this;return new Promise(function(_0x4d85af,_0x20c70e){return db[_0x529c('0x15')][_0x529c('0x16')]({'raw':_0x574dc0[_0x529c('0x17')]?_0x574dc0['options'][_0x529c('0x18')]===undefined?!![]:![]:!![],'where':_0x574dc0[_0x529c('0x17')]?_0x574dc0['options'][_0x529c('0x19')]||null:null,'attributes':_0x574dc0[_0x529c('0x17')]?_0x574dc0[_0x529c('0x17')][_0x529c('0x1a')]||null:null,'include':_0x574dc0['options']?_0x574dc0[_0x529c('0x17')][_0x529c('0x1b')]?_['map'](_0x574dc0['options'][_0x529c('0x1b')],function(_0x5ccb31){return{'model':db[_0x5ccb31[_0x529c('0x1c')]],'as':_0x5ccb31['as'],'attributes':_0x5ccb31['attributes'],'include':_0x5ccb31[_0x529c('0x1b')]?_['map'](_0x5ccb31[_0x529c('0x1b')],function(_0x33f081){return{'model':db[_0x33f081['model']],'as':_0x33f081['as'],'attributes':_0x33f081[_0x529c('0x1a')],'include':_0x33f081[_0x529c('0x1b')]?_[_0x529c('0x1d')](_0x33f081[_0x529c('0x1b')],function(_0x26127b){return{'model':db[_0x26127b[_0x529c('0x1c')]],'as':_0x26127b['as'],'attributes':_0x26127b[_0x529c('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x529c('0x1e')](function(_0x224c2d){logger[_0x529c('0xb')]('ShowSound',_0x574dc0);logger[_0x529c('0xc')](_0x529c('0x1f'),_0x574dc0,JSON[_0x529c('0xe')](_0x224c2d));_0x4d85af(_0x224c2d);})[_0x529c('0x14')](function(_0x1ad1ec){logger[_0x529c('0xf')](_0x529c('0x1f'),_0x1ad1ec[_0x529c('0x11')],_0x574dc0);_0x20c70e(_0x134f9c['error'](0x1f4,_0x1ad1ec[_0x529c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index e0e6fcd..50ae5e6 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 _0x5eb8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','path','connect-timeout','express','Router'];(function(_0x3a98a4,_0x454633){var _0x122b6d=function(_0x551317){while(--_0x551317){_0x3a98a4['push'](_0x3a98a4['shift']());}};_0x122b6d(++_0x454633);}(_0x5eb8,0xb0));var _0x85eb=function(_0x3a0ebd,_0x47f368){_0x3a0ebd=_0x3a0ebd-0x0;var _0x51a660=_0x5eb8[_0x3a0ebd];return _0x51a660;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['post']('/',auth[_0x85eb('0xa')](),controller['create']);router[_0x85eb('0xe')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xf')]);router[_0x85eb('0x10')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller['destroy']);module[_0x85eb('0x11')]=router; \ No newline at end of file +var _0x8603=['../../components/interaction/service','./squareMessage.controller','isAuthenticated','index','get','/:id','create','put','update','exports','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x35f969,_0x2c03bd){var _0x373c46=function(_0x480568){while(--_0x480568){_0x35f969['push'](_0x35f969['shift']());}};_0x373c46(++_0x2c03bd);}(_0x8603,0x190));var _0x3860=function(_0x2b70f8,_0x361789){_0x2b70f8=_0x2b70f8-0x0;var _0x2f741e=_0x8603[_0x2b70f8];return _0x2f741e;};'use strict';var multer=require('multer');var util=require(_0x3860('0x0'));var path=require(_0x3860('0x1'));var timeout=require(_0x3860('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3860('0x3'));var auth=require(_0x3860('0x4'));var interaction=require(_0x3860('0x5'));var config=require('../../config/environment');var controller=require(_0x3860('0x6'));router['get']('/',auth[_0x3860('0x7')](),controller[_0x3860('0x8')]);router[_0x3860('0x9')](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x3860('0xb')]);router[_0x3860('0xc')]('/:id',auth[_0x3860('0x7')](),controller[_0x3860('0xd')]);router['delete'](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['destroy']);module[_0x3860('0xe')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 8ed5d60..c4c8b88 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 _0x95bd=['ENUM','out','exports','STRING','TEXT','medium'];(function(_0x4fcaf1,_0x59fa8b){var _0x509afb=function(_0x3019c1){while(--_0x3019c1){_0x4fcaf1['push'](_0x4fcaf1['shift']());}};_0x509afb(++_0x59fa8b);}(_0x95bd,0x1dc));var _0xd95b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x95bd[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0xd95b('0x0')]={'uniqueid':{'type':Sequelize[_0xd95b('0x1')]},'body':{'type':Sequelize[_0xd95b('0x2')](_0xd95b('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0xd95b('0x4')]('in',_0xd95b('0x5')),'defaultValue':_0xd95b('0x5'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xd95b('0x2')]}}; \ No newline at end of file +var _0x1fca=['exports','STRING','TEXT','medium','ENUM','out'];(function(_0x52a738,_0x4b0522){var _0x56a751=function(_0x299ef1){while(--_0x299ef1){_0x52a738['push'](_0x52a738['shift']());}};_0x56a751(++_0x4b0522);}(_0x1fca,0xd2));var _0xa1fc=function(_0x1a808e,_0x124671){_0x1a808e=_0x1a808e-0x0;var _0x1d3707=_0x1fca[_0x1a808e];return _0x1d3707;};'use strict';var Sequelize=require('sequelize');module[_0xa1fc('0x0')]={'uniqueid':{'type':Sequelize[_0xa1fc('0x1')]},'body':{'type':Sequelize[_0xa1fc('0x2')](_0xa1fc('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0xa1fc('0x4')]('in',_0xa1fc('0x5')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0xa1fc('0x1')]},'providerResponse':{'type':Sequelize[_0xa1fc('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index a907a7e..75723c1 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 _0x3301=['error','stack','name','send','index','map','SquareMessage','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','order','pick','filter','where','type','VIRTUAL','merge','includeAll','rows','catch','show','rawAttributes','create','body','params','find','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','limit','undefined','count','offset','Content-Range','reject','save','update','then','destroy','status'];(function(_0x3515b7,_0x2229bd){var _0x411a6b=function(_0x10b6bc){while(--_0x10b6bc){_0x3515b7['push'](_0x3515b7['shift']());}};_0x411a6b(++_0x2229bd);}(_0x3301,0x69));var _0x1330=function(_0x4e38fd,_0x13d776){_0x4e38fd=_0x4e38fd-0x0;var _0x2fe8b7=_0x3301[_0x4e38fd];return _0x2fe8b7;};'use strict';var emlformat=require(_0x1330('0x0'));var rimraf=require(_0x1330('0x1'));var zipdir=require(_0x1330('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1330('0x3'));var moment=require('moment');var BPromise=require(_0x1330('0x4'));var Mustache=require(_0x1330('0x5'));var util=require('util');var path=require(_0x1330('0x6'));var sox=require('sox');var csv=require(_0x1330('0x7'));var ejs=require(_0x1330('0x8'));var fs=require('fs');var fs_extra=require(_0x1330('0x9'));var _=require(_0x1330('0xa'));var squel=require(_0x1330('0xb'));var crypto=require(_0x1330('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1330('0xd'));var toCsv=require(_0x1330('0x7'));var querystring=require(_0x1330('0xe'));var Papa=require(_0x1330('0xf'));var Redis=require(_0x1330('0x10'));var authService=require(_0x1330('0x11'));var qs=require(_0x1330('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1330('0x13'));var logger=require(_0x1330('0x14'))(_0x1330('0x15'));var utils=require('../../config/utils');var config=require(_0x1330('0x16'));var licenseUtil=require(_0x1330('0x17'));var db=require(_0x1330('0x18'))['db'];function respondWithStatusCode(_0x2cd6d0,_0x217caa){_0x217caa=_0x217caa||0xcc;return function(_0x280647){if(_0x280647){return _0x2cd6d0[_0x1330('0x19')](_0x217caa);}return _0x2cd6d0['status'](_0x217caa)[_0x1330('0x1a')]();};}function respondWithResult(_0x12504d,_0x69fce9){_0x69fce9=_0x69fce9||0xc8;return function(_0x34f0b7){if(_0x34f0b7){return _0x12504d['status'](_0x69fce9)[_0x1330('0x1b')](_0x34f0b7);}};}function respondWithFilteredResult(_0x5ad2b4,_0xcf1492){return function(_0x187a14){if(_0x187a14){var _0x723bf=typeof _0xcf1492['offset']==='undefined'&&typeof _0xcf1492[_0x1330('0x1c')]===_0x1330('0x1d');var _0x2ded33=_0x187a14[_0x1330('0x1e')];var _0xda5a52=_0x723bf?0x0:_0xcf1492[_0x1330('0x1f')];var _0x4611cf=_0x723bf?_0x187a14[_0x1330('0x1e')]:_0xcf1492[_0x1330('0x1f')]+_0xcf1492[_0x1330('0x1c')];var _0x3ff10d;if(_0x4611cf>=_0x2ded33){_0x4611cf=_0x2ded33;_0x3ff10d=0xc8;}else{_0x3ff10d=0xce;}_0x5ad2b4['status'](_0x3ff10d);return _0x5ad2b4['set'](_0x1330('0x20'),_0xda5a52+'-'+_0x4611cf+'/'+_0x2ded33)[_0x1330('0x1b')](_0x187a14);}return null;};}function patchUpdates(_0x1609cd){return function(_0x2e71ce){try{jsonpatch['apply'](_0x2e71ce,_0x1609cd,!![]);}catch(_0x1d496b){return BPromise[_0x1330('0x21')](_0x1d496b);}return _0x2e71ce[_0x1330('0x22')]();};}function saveUpdates(_0x1e4d68,_0x44734d){return function(_0x4b7365){if(_0x4b7365){return _0x4b7365[_0x1330('0x23')](_0x1e4d68)[_0x1330('0x24')](function(_0x352e58){return _0x352e58;});}return null;};}function removeEntity(_0x3448d4,_0x3e79ab){return function(_0x32585e){if(_0x32585e){return _0x32585e[_0x1330('0x25')]()[_0x1330('0x24')](function(){_0x3448d4[_0x1330('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb38aa3,_0x46efa5){return function(_0x5680a0){if(!_0x5680a0){_0xb38aa3[_0x1330('0x19')](0x194);}return _0x5680a0;};}function handleError(_0x237dd7,_0x4256fe){_0x4256fe=_0x4256fe||0x1f4;return function(_0x56d202){logger[_0x1330('0x27')](_0x56d202[_0x1330('0x28')]);if(_0x56d202['name']){delete _0x56d202[_0x1330('0x29')];}_0x237dd7[_0x1330('0x26')](_0x4256fe)[_0x1330('0x2a')](_0x56d202);};}exports[_0x1330('0x2b')]=function(_0x55be26,_0xc9d282){var _0x9bce9e={},_0x583be3={},_0x21cff6={'count':0x0,'rows':[]};var _0x4f2370=_[_0x1330('0x2c')](db[_0x1330('0x2d')]['rawAttributes'],function(_0xcc061a){return{'name':_0xcc061a[_0x1330('0x2e')],'type':_0xcc061a['type'][_0x1330('0x2f')]};});_0x583be3['model']=_[_0x1330('0x2c')](_0x4f2370,_0x1330('0x29'));_0x583be3[_0x1330('0x30')]=_[_0x1330('0x31')](_0x55be26[_0x1330('0x30')]);_0x583be3[_0x1330('0x32')]=_[_0x1330('0x33')](_0x583be3[_0x1330('0x34')],_0x583be3[_0x1330('0x30')]);_0x9bce9e[_0x1330('0x35')]=_[_0x1330('0x33')](_0x583be3[_0x1330('0x34')],qs[_0x1330('0x36')](_0x55be26[_0x1330('0x30')][_0x1330('0x36')]));_0x9bce9e[_0x1330('0x35')]=_0x9bce9e[_0x1330('0x35')][_0x1330('0x37')]?_0x9bce9e[_0x1330('0x35')]:_0x583be3[_0x1330('0x34')];if(!_0x55be26[_0x1330('0x30')]['hasOwnProperty']('nolimit')){_0x9bce9e[_0x1330('0x1c')]=qs[_0x1330('0x1c')](_0x55be26[_0x1330('0x30')][_0x1330('0x1c')]);_0x9bce9e[_0x1330('0x1f')]=qs['offset'](_0x55be26['query'][_0x1330('0x1f')]);}_0x9bce9e[_0x1330('0x38')]=qs['sort'](_0x55be26[_0x1330('0x30')]['sort']);_0x9bce9e['where']=qs[_0x1330('0x32')](_[_0x1330('0x39')](_0x55be26['query'],_0x583be3[_0x1330('0x32')]),_0x4f2370);if(_0x55be26[_0x1330('0x30')][_0x1330('0x3a')]){_0x9bce9e[_0x1330('0x3b')]=_['merge'](_0x9bce9e[_0x1330('0x3b')],{'$or':_['map'](_0x4f2370,function(_0x485166){if(_0x485166[_0x1330('0x3c')]!==_0x1330('0x3d')){var _0x3a194d={};_0x3a194d[_0x485166[_0x1330('0x29')]]={'$like':'%'+_0x55be26[_0x1330('0x30')][_0x1330('0x3a')]+'%'};return _0x3a194d;}})});}_0x9bce9e=_[_0x1330('0x3e')]({},_0x9bce9e,_0x55be26['options']);var _0x257f55={'where':_0x9bce9e[_0x1330('0x3b')]};return db['SquareMessage'][_0x1330('0x1e')](_0x257f55)['then'](function(_0x514554){_0x21cff6[_0x1330('0x1e')]=_0x514554;if(_0x55be26[_0x1330('0x30')][_0x1330('0x3f')]){_0x9bce9e['include']=[{'all':!![]}];}return db['SquareMessage']['findAll'](_0x9bce9e);})[_0x1330('0x24')](function(_0x246337){_0x21cff6[_0x1330('0x40')]=_0x246337;return _0x21cff6;})[_0x1330('0x24')](respondWithFilteredResult(_0xc9d282,_0x9bce9e))[_0x1330('0x41')](handleError(_0xc9d282,null));};exports[_0x1330('0x42')]=function(_0x571629,_0x3b433e){var _0x2c35a9={'raw':!![],'where':{'id':_0x571629['params']['id']}},_0x5f24c6={};_0x5f24c6['model']=_[_0x1330('0x31')](db[_0x1330('0x2d')][_0x1330('0x43')]);_0x5f24c6[_0x1330('0x30')]=_['keys'](_0x571629['query']);_0x5f24c6[_0x1330('0x32')]=_['intersection'](_0x5f24c6[_0x1330('0x34')],_0x5f24c6['query']);_0x2c35a9[_0x1330('0x35')]=_[_0x1330('0x33')](_0x5f24c6['model'],qs[_0x1330('0x36')](_0x571629['query'][_0x1330('0x36')]));_0x2c35a9['attributes']=_0x2c35a9[_0x1330('0x35')][_0x1330('0x37')]?_0x2c35a9[_0x1330('0x35')]:_0x5f24c6[_0x1330('0x34')];if(_0x571629[_0x1330('0x30')][_0x1330('0x3f')]){_0x2c35a9['include']=[{'all':!![]}];}_0x2c35a9=_[_0x1330('0x3e')]({},_0x2c35a9,_0x571629['options']);return db[_0x1330('0x2d')]['find'](_0x2c35a9)[_0x1330('0x24')](handleEntityNotFound(_0x3b433e,null))[_0x1330('0x24')](respondWithResult(_0x3b433e,null))[_0x1330('0x41')](handleError(_0x3b433e,null));};exports[_0x1330('0x44')]=function(_0x62e446,_0x5f4556){return db[_0x1330('0x2d')][_0x1330('0x44')](_0x62e446[_0x1330('0x45')],{})[_0x1330('0x24')](respondWithResult(_0x5f4556,0xc9))[_0x1330('0x41')](handleError(_0x5f4556,null));};exports['update']=function(_0x5810f2,_0x5aab36){if(_0x5810f2[_0x1330('0x45')]['id']){delete _0x5810f2[_0x1330('0x45')]['id'];}return db['SquareMessage']['find']({'where':{'id':_0x5810f2[_0x1330('0x46')]['id']}})[_0x1330('0x24')](handleEntityNotFound(_0x5aab36,null))[_0x1330('0x24')](saveUpdates(_0x5810f2[_0x1330('0x45')],null))[_0x1330('0x24')](respondWithResult(_0x5aab36,null))['catch'](handleError(_0x5aab36,null));};exports[_0x1330('0x25')]=function(_0x5460af,_0x58c42d){return db[_0x1330('0x2d')][_0x1330('0x47')]({'where':{'id':_0x5460af[_0x1330('0x46')]['id']}})[_0x1330('0x24')](handleEntityNotFound(_0x58c42d,null))[_0x1330('0x24')](removeEntity(_0x58c42d,null))['catch'](handleError(_0x58c42d,null));}; \ No newline at end of file +var _0xc5e4=['util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','stack','name','send','index','map','SquareMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','rows','catch','show','params','find','create','body','destroy','rimraf','zip-dir','request-promise','moment','mustache'];(function(_0x141314,_0x2612f0){var _0x1fe037=function(_0x323052){while(--_0x323052){_0x141314['push'](_0x141314['shift']());}};_0x1fe037(++_0x2612f0);}(_0xc5e4,0x117));var _0x4c5e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc5e4[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4c5e('0x0'));var zipdir=require(_0x4c5e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4c5e('0x2'));var moment=require(_0x4c5e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4c5e('0x4'));var util=require(_0x4c5e('0x5'));var path=require(_0x4c5e('0x6'));var sox=require(_0x4c5e('0x7'));var csv=require(_0x4c5e('0x8'));var ejs=require(_0x4c5e('0x9'));var fs=require('fs');var fs_extra=require(_0x4c5e('0xa'));var _=require(_0x4c5e('0xb'));var squel=require('squel');var crypto=require(_0x4c5e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4c5e('0xd'));var toCsv=require(_0x4c5e('0x8'));var querystring=require(_0x4c5e('0xe'));var Papa=require(_0x4c5e('0xf'));var Redis=require(_0x4c5e('0x10'));var authService=require(_0x4c5e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4c5e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x4c5e('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4c5e('0x14'));var db=require(_0x4c5e('0x15'))['db'];function respondWithStatusCode(_0x3485f0,_0x47b4b6){_0x47b4b6=_0x47b4b6||0xcc;return function(_0x4e3a89){if(_0x4e3a89){return _0x3485f0[_0x4c5e('0x16')](_0x47b4b6);}return _0x3485f0[_0x4c5e('0x17')](_0x47b4b6)[_0x4c5e('0x18')]();};}function respondWithResult(_0x7cac0e,_0x145be5){_0x145be5=_0x145be5||0xc8;return function(_0x2c1504){if(_0x2c1504){return _0x7cac0e[_0x4c5e('0x17')](_0x145be5)['json'](_0x2c1504);}};}function respondWithFilteredResult(_0x52c3d4,_0x4283cc){return function(_0x3bf3ac){if(_0x3bf3ac){var _0x39f45e=typeof _0x4283cc[_0x4c5e('0x19')]===_0x4c5e('0x1a')&&typeof _0x4283cc[_0x4c5e('0x1b')]===_0x4c5e('0x1a');var _0x16343f=_0x3bf3ac[_0x4c5e('0x1c')];var _0x25c4d6=_0x39f45e?0x0:_0x4283cc['offset'];var _0x6eefe=_0x39f45e?_0x3bf3ac[_0x4c5e('0x1c')]:_0x4283cc['offset']+_0x4283cc['limit'];var _0x4a679d;if(_0x6eefe>=_0x16343f){_0x6eefe=_0x16343f;_0x4a679d=0xc8;}else{_0x4a679d=0xce;}_0x52c3d4[_0x4c5e('0x17')](_0x4a679d);return _0x52c3d4[_0x4c5e('0x1d')]('Content-Range',_0x25c4d6+'-'+_0x6eefe+'/'+_0x16343f)[_0x4c5e('0x1e')](_0x3bf3ac);}return null;};}function patchUpdates(_0x5d4824){return function(_0x82f918){try{jsonpatch[_0x4c5e('0x1f')](_0x82f918,_0x5d4824,!![]);}catch(_0x6bf00c){return BPromise[_0x4c5e('0x20')](_0x6bf00c);}return _0x82f918[_0x4c5e('0x21')]();};}function saveUpdates(_0x237cc7,_0x3561c7){return function(_0x4a0728){if(_0x4a0728){return _0x4a0728[_0x4c5e('0x22')](_0x237cc7)[_0x4c5e('0x23')](function(_0x2293bb){return _0x2293bb;});}return null;};}function removeEntity(_0x35b4ab,_0x54438f){return function(_0x5b3327){if(_0x5b3327){return _0x5b3327['destroy']()['then'](function(){_0x35b4ab['status'](0xcc)[_0x4c5e('0x18')]();});}};}function handleEntityNotFound(_0x2e9c75,_0x3712ca){return function(_0x4cf766){if(!_0x4cf766){_0x2e9c75[_0x4c5e('0x16')](0x194);}return _0x4cf766;};}function handleError(_0xea2d,_0x913095){_0x913095=_0x913095||0x1f4;return function(_0x172346){logger['error'](_0x172346[_0x4c5e('0x24')]);if(_0x172346[_0x4c5e('0x25')]){delete _0x172346[_0x4c5e('0x25')];}_0xea2d[_0x4c5e('0x17')](_0x913095)[_0x4c5e('0x26')](_0x172346);};}exports[_0x4c5e('0x27')]=function(_0x47582e,_0x3228cb){var _0x47a7ee={},_0x39aa40={},_0x4de60b={'count':0x0,'rows':[]};var _0x57bccb=_[_0x4c5e('0x28')](db[_0x4c5e('0x29')]['rawAttributes'],function(_0x3b2954){return{'name':_0x3b2954[_0x4c5e('0x2a')],'type':_0x3b2954[_0x4c5e('0x2b')][_0x4c5e('0x2c')]};});_0x39aa40[_0x4c5e('0x2d')]=_['map'](_0x57bccb,'name');_0x39aa40[_0x4c5e('0x2e')]=_[_0x4c5e('0x2f')](_0x47582e['query']);_0x39aa40[_0x4c5e('0x30')]=_[_0x4c5e('0x31')](_0x39aa40[_0x4c5e('0x2d')],_0x39aa40[_0x4c5e('0x2e')]);_0x47a7ee[_0x4c5e('0x32')]=_[_0x4c5e('0x31')](_0x39aa40['model'],qs[_0x4c5e('0x33')](_0x47582e[_0x4c5e('0x2e')][_0x4c5e('0x33')]));_0x47a7ee[_0x4c5e('0x32')]=_0x47a7ee[_0x4c5e('0x32')][_0x4c5e('0x34')]?_0x47a7ee[_0x4c5e('0x32')]:_0x39aa40['model'];if(!_0x47582e[_0x4c5e('0x2e')][_0x4c5e('0x35')](_0x4c5e('0x36'))){_0x47a7ee[_0x4c5e('0x1b')]=qs[_0x4c5e('0x1b')](_0x47582e[_0x4c5e('0x2e')][_0x4c5e('0x1b')]);_0x47a7ee['offset']=qs[_0x4c5e('0x19')](_0x47582e[_0x4c5e('0x2e')][_0x4c5e('0x19')]);}_0x47a7ee[_0x4c5e('0x37')]=qs[_0x4c5e('0x38')](_0x47582e[_0x4c5e('0x2e')][_0x4c5e('0x38')]);_0x47a7ee[_0x4c5e('0x39')]=qs['filters'](_[_0x4c5e('0x3a')](_0x47582e[_0x4c5e('0x2e')],_0x39aa40[_0x4c5e('0x30')]),_0x57bccb);if(_0x47582e[_0x4c5e('0x2e')][_0x4c5e('0x3b')]){_0x47a7ee[_0x4c5e('0x39')]=_['merge'](_0x47a7ee[_0x4c5e('0x39')],{'$or':_[_0x4c5e('0x28')](_0x57bccb,function(_0x1822e8){if(_0x1822e8[_0x4c5e('0x2b')]!==_0x4c5e('0x3c')){var _0x117d72={};_0x117d72[_0x1822e8[_0x4c5e('0x25')]]={'$like':'%'+_0x47582e['query']['filter']+'%'};return _0x117d72;}})});}_0x47a7ee=_[_0x4c5e('0x3d')]({},_0x47a7ee,_0x47582e['options']);var _0x5e5dd3={'where':_0x47a7ee[_0x4c5e('0x39')]};return db['SquareMessage'][_0x4c5e('0x1c')](_0x5e5dd3)['then'](function(_0x4521f6){_0x4de60b[_0x4c5e('0x1c')]=_0x4521f6;if(_0x47582e[_0x4c5e('0x2e')][_0x4c5e('0x3e')]){_0x47a7ee['include']=[{'all':!![]}];}return db['SquareMessage']['findAll'](_0x47a7ee);})['then'](function(_0x15be39){_0x4de60b[_0x4c5e('0x3f')]=_0x15be39;return _0x4de60b;})[_0x4c5e('0x23')](respondWithFilteredResult(_0x3228cb,_0x47a7ee))[_0x4c5e('0x40')](handleError(_0x3228cb,null));};exports[_0x4c5e('0x41')]=function(_0x58a168,_0x537535){var _0xa75344={'raw':!![],'where':{'id':_0x58a168[_0x4c5e('0x42')]['id']}},_0x3a4723={};_0x3a4723['model']=_[_0x4c5e('0x2f')](db[_0x4c5e('0x29')]['rawAttributes']);_0x3a4723[_0x4c5e('0x2e')]=_['keys'](_0x58a168['query']);_0x3a4723[_0x4c5e('0x30')]=_[_0x4c5e('0x31')](_0x3a4723[_0x4c5e('0x2d')],_0x3a4723[_0x4c5e('0x2e')]);_0xa75344[_0x4c5e('0x32')]=_['intersection'](_0x3a4723[_0x4c5e('0x2d')],qs[_0x4c5e('0x33')](_0x58a168[_0x4c5e('0x2e')][_0x4c5e('0x33')]));_0xa75344[_0x4c5e('0x32')]=_0xa75344[_0x4c5e('0x32')][_0x4c5e('0x34')]?_0xa75344[_0x4c5e('0x32')]:_0x3a4723['model'];if(_0x58a168[_0x4c5e('0x2e')][_0x4c5e('0x3e')]){_0xa75344['include']=[{'all':!![]}];}_0xa75344=_['merge']({},_0xa75344,_0x58a168['options']);return db['SquareMessage'][_0x4c5e('0x43')](_0xa75344)[_0x4c5e('0x23')](handleEntityNotFound(_0x537535,null))[_0x4c5e('0x23')](respondWithResult(_0x537535,null))[_0x4c5e('0x40')](handleError(_0x537535,null));};exports['create']=function(_0x37d3bb,_0xf76d27){return db[_0x4c5e('0x29')][_0x4c5e('0x44')](_0x37d3bb['body'],{})[_0x4c5e('0x23')](respondWithResult(_0xf76d27,0xc9))[_0x4c5e('0x40')](handleError(_0xf76d27,null));};exports['update']=function(_0x4c0b21,_0x2727c2){if(_0x4c0b21[_0x4c5e('0x45')]['id']){delete _0x4c0b21[_0x4c5e('0x45')]['id'];}return db['SquareMessage'][_0x4c5e('0x43')]({'where':{'id':_0x4c0b21[_0x4c5e('0x42')]['id']}})[_0x4c5e('0x23')](handleEntityNotFound(_0x2727c2,null))[_0x4c5e('0x23')](saveUpdates(_0x4c0b21['body'],null))['then'](respondWithResult(_0x2727c2,null))[_0x4c5e('0x40')](handleError(_0x2727c2,null));};exports[_0x4c5e('0x46')]=function(_0x3ae3e6,_0xc0b36){return db[_0x4c5e('0x29')]['find']({'where':{'id':_0x3ae3e6[_0x4c5e('0x42')]['id']}})[_0x4c5e('0x23')](handleEntityNotFound(_0xc0b36,null))[_0x4c5e('0x23')](removeEntity(_0xc0b36,null))[_0x4c5e('0x40')](handleError(_0xc0b36,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index e88daf8..c91b95a 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 _0xecf4=['./squareMessage.attributes','exports','SquareMessage','square_messages','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x4bc6ee,_0x2290de){var _0x49fc20=function(_0x33cfda){while(--_0x33cfda){_0x4bc6ee['push'](_0x4bc6ee['shift']());}};_0x49fc20(++_0x2290de);}(_0xecf4,0xcc));var _0x4ecf=function(_0x4bacb6,_0x2b299d){_0x4bacb6=_0x4bacb6-0x0;var _0x58c029=_0xecf4[_0x4bacb6];return _0x58c029;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4ecf('0x0'))(_0x4ecf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4ecf('0x2'));var fs=require('fs');var path=require(_0x4ecf('0x3'));var rimraf=require(_0x4ecf('0x4'));var config=require(_0x4ecf('0x5'));var attributes=require(_0x4ecf('0x6'));module[_0x4ecf('0x7')]=function(_0x55f43c,_0xd11c57){return _0x55f43c['define'](_0x4ecf('0x8'),attributes,{'tableName':_0x4ecf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d85=['SquareMessage','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x2d85,0x18d));var _0x52d8=function(_0x5460d6,_0x12d7c0){_0x5460d6=_0x5460d6-0x0;var _0x228c62=_0x2d85[_0x5460d6];return _0x228c62;};'use strict';var _=require(_0x52d8('0x0'));var util=require(_0x52d8('0x1'));var logger=require(_0x52d8('0x2'))(_0x52d8('0x3'));var moment=require('moment');var BPromise=require(_0x52d8('0x4'));var rp=require(_0x52d8('0x5'));var fs=require('fs');var path=require(_0x52d8('0x6'));var rimraf=require(_0x52d8('0x7'));var config=require(_0x52d8('0x8'));var attributes=require('./squareMessage.attributes');module[_0x52d8('0x9')]=function(_0x412aab,_0x1a59eb){return _0x412aab[_0x52d8('0xa')](_0x52d8('0xb'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 376e14d..ea1924e 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 _0x3b0d=['SquareMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSquareMessage','create','body','options','raw','stringify','util','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2a3dd4,_0x4722f8){var _0x12dda8=function(_0x568b43){while(--_0x568b43){_0x2a3dd4['push'](_0x2a3dd4['shift']());}};_0x12dda8(++_0x4722f8);}(_0x3b0d,0x12a));var _0xd3b0=function(_0x1021d7,_0x26b624){_0x1021d7=_0x1021d7-0x0;var _0x3c73b3=_0x3b0d[_0x1021d7];return _0x3c73b3;};'use strict';var _=require('lodash');var util=require(_0xd3b0('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd3b0('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd3b0('0x2'))(_0xd3b0('0x3'));var config=require(_0xd3b0('0x4'));var jayson=require(_0xd3b0('0x5'));var client=jayson[_0xd3b0('0x6')][_0xd3b0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x141208,_0xa075bb,_0x470238){return new BPromise(function(_0x2cbbf0,_0x33ca8a){return client[_0xd3b0('0x8')](_0x141208,_0x470238)[_0xd3b0('0x9')](function(_0x2f432d){logger[_0xd3b0('0xa')](_0xd3b0('0xb'),_0xa075bb,_0xd3b0('0xc'));logger[_0xd3b0('0xd')](_0xd3b0('0xe'),_0xa075bb,'request\x20sent',JSON['stringify'](_0x2f432d));if(_0x2f432d[_0xd3b0('0xf')]){if(_0x2f432d['error'][_0xd3b0('0x10')]===0x1f4){logger[_0xd3b0('0xf')](_0xd3b0('0xb'),_0xa075bb,_0x2f432d[_0xd3b0('0xf')][_0xd3b0('0x11')]);return _0x33ca8a(_0x2f432d[_0xd3b0('0xf')]['message']);}logger[_0xd3b0('0xf')](_0xd3b0('0xb'),_0xa075bb,_0x2f432d[_0xd3b0('0xf')]['message']);return _0x2cbbf0(_0x2f432d[_0xd3b0('0xf')]['message']);}else{logger[_0xd3b0('0xa')]('SquareMessage,\x20%s,\x20%s',_0xa075bb,_0xd3b0('0xc'));_0x2cbbf0(_0x2f432d[_0xd3b0('0x12')][_0xd3b0('0x11')]);}})[_0xd3b0('0x13')](function(_0x218dea){logger['error'](_0xd3b0('0xb'),_0xa075bb,_0x218dea);_0x33ca8a(_0x218dea);});});}exports[_0xd3b0('0x14')]=function(_0x25b80d){var _0xed693=this;return new Promise(function(_0x1f7270,_0x14ca6f){return db['SquareMessage'][_0xd3b0('0x15')](_0x25b80d[_0xd3b0('0x16')],{'raw':_0x25b80d[_0xd3b0('0x17')]?_0x25b80d['options'][_0xd3b0('0x18')]===undefined?!![]:![]:!![]})[_0xd3b0('0x9')](function(_0x92b23f){logger[_0xd3b0('0xa')](_0xd3b0('0x14'),_0x25b80d);logger['debug'](_0xd3b0('0x14'),_0x25b80d,JSON[_0xd3b0('0x19')](_0x92b23f));_0x1f7270(_0x92b23f);})['catch'](function(_0x2b038a){logger[_0xd3b0('0xf')](_0xd3b0('0x14'),_0x2b038a[_0xd3b0('0x11')],_0x25b80d);_0x14ca6f(_0xed693[_0xd3b0('0xf')](0x1f4,_0x2b038a[_0xd3b0('0x11')]));});});}; \ No newline at end of file +var _0x1ecc=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SquareMessage','create','body','options','CreateSquareMessage','lodash','moment','../../mysqldb','../../config/utils'];(function(_0x1ca5a3,_0x40b024){var _0xc8acbf=function(_0x5b50df){while(--_0x5b50df){_0x1ca5a3['push'](_0x1ca5a3['shift']());}};_0xc8acbf(++_0x40b024);}(_0x1ecc,0x1ac));var _0xc1ec=function(_0x4b6778,_0x505a76){_0x4b6778=_0x4b6778-0x0;var _0x22dbb9=_0x1ecc[_0x4b6778];return _0x22dbb9;};'use strict';var _=require(_0xc1ec('0x0'));var util=require('util');var moment=require(_0xc1ec('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc1ec('0x2'))['db'];var utils=require(_0xc1ec('0x3'));var logger=require(_0xc1ec('0x4'))(_0xc1ec('0x5'));var config=require(_0xc1ec('0x6'));var jayson=require(_0xc1ec('0x7'));var client=jayson[_0xc1ec('0x8')][_0xc1ec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b7e77,_0x54c900,_0x3a8f59){return new BPromise(function(_0x594355,_0x37932b){return client[_0xc1ec('0xa')](_0x4b7e77,_0x3a8f59)[_0xc1ec('0xb')](function(_0x554c4e){logger['info'](_0xc1ec('0xc'),_0x54c900,_0xc1ec('0xd'));logger[_0xc1ec('0xe')](_0xc1ec('0xf'),_0x54c900,_0xc1ec('0xd'),JSON[_0xc1ec('0x10')](_0x554c4e));if(_0x554c4e[_0xc1ec('0x11')]){if(_0x554c4e[_0xc1ec('0x11')][_0xc1ec('0x12')]===0x1f4){logger[_0xc1ec('0x11')](_0xc1ec('0xc'),_0x54c900,_0x554c4e[_0xc1ec('0x11')]['message']);return _0x37932b(_0x554c4e['error'][_0xc1ec('0x13')]);}logger['error']('SquareMessage,\x20%s,\x20%s',_0x54c900,_0x554c4e[_0xc1ec('0x11')][_0xc1ec('0x13')]);return _0x594355(_0x554c4e[_0xc1ec('0x11')][_0xc1ec('0x13')]);}else{logger['info']('SquareMessage,\x20%s,\x20%s',_0x54c900,_0xc1ec('0xd'));_0x594355(_0x554c4e[_0xc1ec('0x14')]['message']);}})[_0xc1ec('0x15')](function(_0x18b859){logger[_0xc1ec('0x11')](_0xc1ec('0xc'),_0x54c900,_0x18b859);_0x37932b(_0x18b859);});});}exports['CreateSquareMessage']=function(_0x442a9f){var _0x4b1574=this;return new Promise(function(_0x2c1bbd,_0xbfb28e){return db[_0xc1ec('0x16')][_0xc1ec('0x17')](_0x442a9f[_0xc1ec('0x18')],{'raw':_0x442a9f[_0xc1ec('0x19')]?_0x442a9f[_0xc1ec('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xc1ec('0xb')](function(_0x23c7c4){logger['info'](_0xc1ec('0x1a'),_0x442a9f);logger['debug'](_0xc1ec('0x1a'),_0x442a9f,JSON[_0xc1ec('0x10')](_0x23c7c4));_0x2c1bbd(_0x23c7c4);})['catch'](function(_0x2939e8){logger[_0xc1ec('0x11')](_0xc1ec('0x1a'),_0x2939e8[_0xc1ec('0x13')],_0x442a9f);_0xbfb28e(_0x4b1574[_0xc1ec('0x11')](0x1f4,_0x2939e8['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 5bc5e6f..721cd25 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 _0x37f5=['isAuthenticated','show','/:id/test','test','post','create','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get'];(function(_0x2f3cce,_0x169b38){var _0x5a8879=function(_0x102d38){while(--_0x102d38){_0x2f3cce['push'](_0x2f3cce['shift']());}};_0x5a8879(++_0x169b38);}(_0x37f5,0xb2));var _0x537f=function(_0x3d58eb,_0x55d647){_0x3d58eb=_0x3d58eb-0x0;var _0x8a508a=_0x37f5[_0x3d58eb];return _0x8a508a;};'use strict';var multer=require(_0x537f('0x0'));var util=require(_0x537f('0x1'));var path=require(_0x537f('0x2'));var timeout=require('connect-timeout');var express=require(_0x537f('0x3'));var router=express[_0x537f('0x4')]();var fs_extra=require(_0x537f('0x5'));var auth=require(_0x537f('0x6'));var interaction=require(_0x537f('0x7'));var config=require(_0x537f('0x8'));var controller=require(_0x537f('0x9'));router[_0x537f('0xa')]('/',auth[_0x537f('0xb')](),controller['index']);router[_0x537f('0xa')]('/:id',auth[_0x537f('0xb')](),controller[_0x537f('0xc')]);router[_0x537f('0xa')](_0x537f('0xd'),auth[_0x537f('0xb')](),timeout('15s'),controller[_0x537f('0xe')]);router[_0x537f('0xf')]('/',auth[_0x537f('0xb')](),controller[_0x537f('0x10')]);router[_0x537f('0x11')]('/:id',auth[_0x537f('0xb')](),controller[_0x537f('0x12')]);router[_0x537f('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x537f('0x14')]);module['exports']=router; \ No newline at end of file +var _0x515b=['express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','show','get','/:id/test','15s','test','/:id','update','delete','multer','util','path','connect-timeout'];(function(_0x158965,_0x117f97){var _0x3a3e9d=function(_0x1ee22b){while(--_0x1ee22b){_0x158965['push'](_0x158965['shift']());}};_0x3a3e9d(++_0x117f97);}(_0x515b,0xea));var _0xb515=function(_0x3ed8af,_0x12827a){_0x3ed8af=_0x3ed8af-0x0;var _0x3f5bf5=_0x515b[_0x3ed8af];return _0x3f5bf5;};'use strict';var multer=require(_0xb515('0x0'));var util=require(_0xb515('0x1'));var path=require(_0xb515('0x2'));var timeout=require(_0xb515('0x3'));var express=require(_0xb515('0x4'));var router=express['Router']();var fs_extra=require(_0xb515('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb515('0x6'));var config=require(_0xb515('0x7'));var controller=require('./squareOdbc.controller');router['get']('/',auth[_0xb515('0x8')](),controller['index']);router['get']('/:id',auth[_0xb515('0x8')](),controller[_0xb515('0x9')]);router[_0xb515('0xa')](_0xb515('0xb'),auth[_0xb515('0x8')](),timeout(_0xb515('0xc')),controller[_0xb515('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xb515('0xe'),auth[_0xb515('0x8')](),controller[_0xb515('0xf')]);router[_0xb515('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 13badc7..f37de77 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 _0x3a0a=['name','STRING','sequelize','exports'];(function(_0x1cfc5b,_0xad130a){var _0xfce762=function(_0x71d369){while(--_0x71d369){_0x1cfc5b['push'](_0x1cfc5b['shift']());}};_0xfce762(++_0xad130a);}(_0x3a0a,0xca));var _0xa3a0=function(_0x335fb5,_0x3cb808){_0x335fb5=_0x335fb5-0x0;var _0xd7a346=_0x3a0a[_0x335fb5];return _0xd7a346;};'use strict';var Sequelize=require(_0xa3a0('0x0'));module[_0xa3a0('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xa3a0('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0xa3a0('0x3')]},'description':{'type':Sequelize[_0xa3a0('0x3')]}}; \ No newline at end of file +var _0xdf90=['STRING','sequelize','exports'];(function(_0x431187,_0x1df5a8){var _0x3d2d2d=function(_0x4885d2){while(--_0x4885d2){_0x431187['push'](_0x431187['shift']());}};_0x3d2d2d(++_0x1df5a8);}(_0xdf90,0xb5));var _0x0df9=function(_0x207061,_0xe38cda){_0x207061=_0x207061-0x0;var _0x4a2833=_0xdf90[_0x207061];return _0x4a2833;};'use strict';var Sequelize=require(_0x0df9('0x0'));module[_0x0df9('0x1')]={'name':{'type':Sequelize[_0x0df9('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x0df9('0x2')]},'description':{'type':Sequelize[_0x0df9('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index f3cf562..7436b10 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 _0x7b22=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','get','ODBC','UserProfileResource','sendStatus','error','stack','name','index','SquareOdbc','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','findAll','catch','show','params','length','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','request-promise','moment','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis'];(function(_0x19a0f8,_0x2c27a6){var _0x17a100=function(_0x50d77f){while(--_0x50d77f){_0x19a0f8['push'](_0x19a0f8['shift']());}};_0x17a100(++_0x2c27a6);}(_0x7b22,0xec));var _0x27b2=function(_0x5a6644,_0x45d612){_0x5a6644=_0x5a6644-0x0;var _0x3a2a5d=_0x7b22[_0x5a6644];return _0x3a2a5d;};'use strict';var emlformat=require(_0x27b2('0x0'));var rimraf=require(_0x27b2('0x1'));var zipdir=require(_0x27b2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x27b2('0x3'));var moment=require(_0x27b2('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x27b2('0x5'));var sox=require('sox');var csv=require(_0x27b2('0x6'));var ejs=require(_0x27b2('0x7'));var fs=require('fs');var fs_extra=require(_0x27b2('0x8'));var _=require(_0x27b2('0x9'));var squel=require(_0x27b2('0xa'));var crypto=require(_0x27b2('0xb'));var jsforce=require(_0x27b2('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x27b2('0x6'));var querystring=require(_0x27b2('0xd'));var Papa=require(_0x27b2('0xe'));var Redis=require(_0x27b2('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x27b2('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x27b2('0x11'));var logger=require(_0x27b2('0x12'))(_0x27b2('0x13'));var utils=require(_0x27b2('0x14'));var config=require(_0x27b2('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x27b2('0x16'))['db'];function respondWithStatusCode(_0x256901,_0x4ee382){_0x4ee382=_0x4ee382||0xcc;return function(_0x272301){if(_0x272301){return _0x256901['sendStatus'](_0x4ee382);}return _0x256901['status'](_0x4ee382)[_0x27b2('0x17')]();};}function respondWithResult(_0x52455c,_0x5cd1f3){_0x5cd1f3=_0x5cd1f3||0xc8;return function(_0x82d714){if(_0x82d714){return _0x52455c[_0x27b2('0x18')](_0x5cd1f3)[_0x27b2('0x19')](_0x82d714);}};}function respondWithFilteredResult(_0x2c2f86,_0xa60b56){return function(_0x530ae0){if(_0x530ae0){var _0xf073f7=typeof _0xa60b56[_0x27b2('0x1a')]===_0x27b2('0x1b')&&typeof _0xa60b56[_0x27b2('0x1c')]===_0x27b2('0x1b');var _0x4326b7=_0x530ae0[_0x27b2('0x1d')];var _0x296c24=_0xf073f7?0x0:_0xa60b56['offset'];var _0x3f0307=_0xf073f7?_0x530ae0[_0x27b2('0x1d')]:_0xa60b56['offset']+_0xa60b56['limit'];var _0x52285b;if(_0x3f0307>=_0x4326b7){_0x3f0307=_0x4326b7;_0x52285b=0xc8;}else{_0x52285b=0xce;}_0x2c2f86['status'](_0x52285b);return _0x2c2f86['set'](_0x27b2('0x1e'),_0x296c24+'-'+_0x3f0307+'/'+_0x4326b7)[_0x27b2('0x19')](_0x530ae0);}return null;};}function patchUpdates(_0x58d90f){return function(_0x4d8e9c){try{jsonpatch[_0x27b2('0x1f')](_0x4d8e9c,_0x58d90f,!![]);}catch(_0x21646d){return BPromise['reject'](_0x21646d);}return _0x4d8e9c[_0x27b2('0x20')]();};}function saveUpdates(_0x4dce3a,_0x592730){return function(_0xf657f3){if(_0xf657f3){return _0xf657f3[_0x27b2('0x21')](_0x4dce3a)[_0x27b2('0x22')](function(_0x376b97){return _0x376b97;});}return null;};}function removeEntity(_0x478756,_0x52368b){return function(_0x4f7658){if(_0x4f7658){return _0x4f7658[_0x27b2('0x23')]()['then'](function(){var _0x17b366=_0x4f7658[_0x27b2('0x24')]({'plain':!![]});var _0x545ae7=_0x27b2('0x25');return db[_0x27b2('0x26')]['destroy']({'where':{'type':_0x545ae7,'resourceId':_0x17b366['id']}})[_0x27b2('0x22')](function(){return _0x4f7658;});})['then'](function(){_0x478756[_0x27b2('0x18')](0xcc)[_0x27b2('0x17')]();});}};}function handleEntityNotFound(_0xeaf0dd,_0x222846){return function(_0x4dd00f){if(!_0x4dd00f){_0xeaf0dd[_0x27b2('0x27')](0x194);}return _0x4dd00f;};}function handleError(_0x3881e4,_0x5456d6){_0x5456d6=_0x5456d6||0x1f4;return function(_0x4d98d6){logger[_0x27b2('0x28')](_0x4d98d6[_0x27b2('0x29')]);if(_0x4d98d6['name']){delete _0x4d98d6[_0x27b2('0x2a')];}_0x3881e4[_0x27b2('0x18')](_0x5456d6)['send'](_0x4d98d6);};}exports[_0x27b2('0x2b')]=function(_0x12c095,_0x4421de){var _0x4f1099={},_0x543855={},_0x4f1923={'count':0x0,'rows':[]};var _0x2c2072=_['map'](db[_0x27b2('0x2c')][_0x27b2('0x2d')],function(_0x50d302){return{'name':_0x50d302['fieldName'],'type':_0x50d302[_0x27b2('0x2e')][_0x27b2('0x2f')]};});_0x543855['model']=_['map'](_0x2c2072,_0x27b2('0x2a'));_0x543855[_0x27b2('0x30')]=_[_0x27b2('0x31')](_0x12c095[_0x27b2('0x30')]);_0x543855[_0x27b2('0x32')]=_[_0x27b2('0x33')](_0x543855[_0x27b2('0x34')],_0x543855[_0x27b2('0x30')]);_0x4f1099[_0x27b2('0x35')]=_[_0x27b2('0x33')](_0x543855[_0x27b2('0x34')],qs[_0x27b2('0x36')](_0x12c095['query']['fields']));_0x4f1099[_0x27b2('0x35')]=_0x4f1099['attributes']['length']?_0x4f1099[_0x27b2('0x35')]:_0x543855[_0x27b2('0x34')];if(!_0x12c095[_0x27b2('0x30')]['hasOwnProperty']('nolimit')){_0x4f1099[_0x27b2('0x1c')]=qs[_0x27b2('0x1c')](_0x12c095['query'][_0x27b2('0x1c')]);_0x4f1099[_0x27b2('0x1a')]=qs['offset'](_0x12c095[_0x27b2('0x30')]['offset']);}_0x4f1099[_0x27b2('0x37')]=qs[_0x27b2('0x38')](_0x12c095['query'][_0x27b2('0x38')]);_0x4f1099[_0x27b2('0x39')]=qs[_0x27b2('0x32')](_[_0x27b2('0x3a')](_0x12c095[_0x27b2('0x30')],_0x543855[_0x27b2('0x32')]),_0x2c2072);if(_0x12c095[_0x27b2('0x30')][_0x27b2('0x3b')]){_0x4f1099[_0x27b2('0x39')]=_[_0x27b2('0x3c')](_0x4f1099[_0x27b2('0x39')],{'$or':_[_0x27b2('0x3d')](_0x2c2072,function(_0x4e8a44){if(_0x4e8a44['type']!==_0x27b2('0x3e')){var _0x1d6cb4={};_0x1d6cb4[_0x4e8a44[_0x27b2('0x2a')]]={'$like':'%'+_0x12c095[_0x27b2('0x30')][_0x27b2('0x3b')]+'%'};return _0x1d6cb4;}})});}_0x4f1099=_[_0x27b2('0x3c')]({},_0x4f1099,_0x12c095[_0x27b2('0x3f')]);var _0xf4067e={'where':_0x4f1099[_0x27b2('0x39')]};return db['SquareOdbc'][_0x27b2('0x1d')](_0xf4067e)['then'](function(_0x125636){_0x4f1923[_0x27b2('0x1d')]=_0x125636;if(_0x12c095['query'][_0x27b2('0x40')]){_0x4f1099['include']=[{'all':!![]}];}return db[_0x27b2('0x2c')][_0x27b2('0x41')](_0x4f1099);})['then'](function(_0x1125d9){_0x4f1923['rows']=_0x1125d9;return _0x4f1923;})[_0x27b2('0x22')](respondWithFilteredResult(_0x4421de,_0x4f1099))[_0x27b2('0x42')](handleError(_0x4421de,null));};exports[_0x27b2('0x43')]=function(_0x15095a,_0x394490){var _0x1c088b={'raw':!![],'where':{'id':_0x15095a[_0x27b2('0x44')]['id']}},_0x345a7f={};_0x345a7f[_0x27b2('0x34')]=_['keys'](db['SquareOdbc'][_0x27b2('0x2d')]);_0x345a7f[_0x27b2('0x30')]=_[_0x27b2('0x31')](_0x15095a[_0x27b2('0x30')]);_0x345a7f[_0x27b2('0x32')]=_['intersection'](_0x345a7f[_0x27b2('0x34')],_0x345a7f[_0x27b2('0x30')]);_0x1c088b[_0x27b2('0x35')]=_[_0x27b2('0x33')](_0x345a7f[_0x27b2('0x34')],qs[_0x27b2('0x36')](_0x15095a[_0x27b2('0x30')]['fields']));_0x1c088b['attributes']=_0x1c088b[_0x27b2('0x35')][_0x27b2('0x45')]?_0x1c088b[_0x27b2('0x35')]:_0x345a7f['model'];if(_0x15095a[_0x27b2('0x30')]['includeAll']){_0x1c088b[_0x27b2('0x46')]=[{'all':!![]}];}_0x1c088b=_[_0x27b2('0x3c')]({},_0x1c088b,_0x15095a[_0x27b2('0x3f')]);return db[_0x27b2('0x2c')][_0x27b2('0x47')](_0x1c088b)[_0x27b2('0x22')](handleEntityNotFound(_0x394490,null))[_0x27b2('0x22')](respondWithResult(_0x394490,null))[_0x27b2('0x42')](handleError(_0x394490,null));};exports[_0x27b2('0x48')]=function(_0x42a9c1,_0x42a865){return db[_0x27b2('0x2c')][_0x27b2('0x48')](_0x42a9c1[_0x27b2('0x49')],{})[_0x27b2('0x22')](function(_0x4f4417){var _0x23c7c2=_0x42a9c1['user'][_0x27b2('0x24')]({'plain':!![]});if(!_0x23c7c2)throw new Error(_0x27b2('0x4a'));if(_0x23c7c2[_0x27b2('0x4b')]===_0x27b2('0x4c')){var _0x5c4abb=_0x4f4417[_0x27b2('0x24')]({'plain':!![]});var _0x3d5d3d=_0x27b2('0x25');return db['UserProfileSection'][_0x27b2('0x47')]({'where':{'name':_0x3d5d3d,'userProfileId':_0x23c7c2['userProfileId']},'raw':!![]})[_0x27b2('0x22')](function(_0x56ec98){if(_0x56ec98&&_0x56ec98[_0x27b2('0x4d')]===0x0){return db[_0x27b2('0x26')][_0x27b2('0x48')]({'name':_0x5c4abb[_0x27b2('0x2a')],'resourceId':_0x5c4abb['id'],'type':_0x56ec98[_0x27b2('0x2a')],'sectionId':_0x56ec98['id']},{})[_0x27b2('0x22')](function(){return _0x4f4417;});}else{return _0x4f4417;}})['catch'](function(_0xd10b){logger[_0x27b2('0x28')](_0x27b2('0x4e'),_0xd10b);throw _0xd10b;});}return _0x4f4417;})['then'](respondWithResult(_0x42a865,0xc9))['catch'](handleError(_0x42a865,null));};exports[_0x27b2('0x21')]=function(_0x274f22,_0x472a89){if(_0x274f22[_0x27b2('0x49')]['id']){delete _0x274f22[_0x27b2('0x49')]['id'];}return db[_0x27b2('0x2c')][_0x27b2('0x47')]({'where':{'id':_0x274f22['params']['id']}})[_0x27b2('0x22')](handleEntityNotFound(_0x472a89,null))[_0x27b2('0x22')](saveUpdates(_0x274f22[_0x27b2('0x49')],null))[_0x27b2('0x22')](respondWithResult(_0x472a89,null))[_0x27b2('0x42')](handleError(_0x472a89,null));};exports[_0x27b2('0x23')]=function(_0x4b28be,_0x5d30aa){return db[_0x27b2('0x2c')][_0x27b2('0x47')]({'where':{'id':_0x4b28be['params']['id']}})[_0x27b2('0x22')](handleEntityNotFound(_0x5d30aa,null))[_0x27b2('0x22')](removeEntity(_0x5d30aa,null))[_0x27b2('0x42')](handleError(_0x5d30aa,null));};exports[_0x27b2('0x4f')]=function(_0x1ab92a,_0x4ccea9,_0xe15108){var _0x4be6a6;return db[_0x27b2('0x2c')]['find']({'where':{'id':_0x1ab92a[_0x27b2('0x44')]['id']},'attributes':['id',_0x27b2('0x50')]})[_0x27b2('0x22')](handleEntityNotFound(_0x4ccea9,null))['then'](function(_0x1f77df){if(_0x1f77df){var _0x41a66b=require(_0x27b2('0x51'))();_0x41a66b[_0x27b2('0x52')](_0x1f77df[_0x27b2('0x50')]);_0x41a66b[_0x27b2('0x53')]();return _0x1f77df;}})['then'](respondWithResult(_0x4ccea9,null))[_0x27b2('0x42')](handleError(_0x4ccea9,null));}; \ No newline at end of file +var _0x6a28=['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','dsn','eml-format','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','ODBC','UserProfileResource','sendStatus','error','stack','name','send','map','SquareOdbc','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','includeAll','find'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x6a28,0x110));var _0x86a2=function(_0xc4baf2,_0x50c26c){_0xc4baf2=_0xc4baf2-0x0;var _0x2361e7=_0x6a28[_0xc4baf2];return _0x2361e7;};'use strict';var emlformat=require(_0x86a2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x86a2('0x1'));var rp=require(_0x86a2('0x2'));var moment=require('moment');var BPromise=require(_0x86a2('0x3'));var Mustache=require('mustache');var util=require(_0x86a2('0x4'));var path=require(_0x86a2('0x5'));var sox=require(_0x86a2('0x6'));var csv=require(_0x86a2('0x7'));var ejs=require(_0x86a2('0x8'));var fs=require('fs');var fs_extra=require(_0x86a2('0x9'));var _=require(_0x86a2('0xa'));var squel=require(_0x86a2('0xb'));var crypto=require(_0x86a2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x86a2('0xd'));var toCsv=require('to-csv');var querystring=require(_0x86a2('0xe'));var Papa=require(_0x86a2('0xf'));var Redis=require('ioredis');var authService=require(_0x86a2('0x10'));var qs=require(_0x86a2('0x11'));var as=require(_0x86a2('0x12'));var hardwareService=require(_0x86a2('0x13'));var logger=require(_0x86a2('0x14'))(_0x86a2('0x15'));var utils=require(_0x86a2('0x16'));var config=require(_0x86a2('0x17'));var licenseUtil=require(_0x86a2('0x18'));var db=require(_0x86a2('0x19'))['db'];function respondWithStatusCode(_0xd3a0eb,_0x190078){_0x190078=_0x190078||0xcc;return function(_0x2ef508){if(_0x2ef508){return _0xd3a0eb['sendStatus'](_0x190078);}return _0xd3a0eb[_0x86a2('0x1a')](_0x190078)[_0x86a2('0x1b')]();};}function respondWithResult(_0x1841ee,_0x214403){_0x214403=_0x214403||0xc8;return function(_0x3c6e98){if(_0x3c6e98){return _0x1841ee[_0x86a2('0x1a')](_0x214403)[_0x86a2('0x1c')](_0x3c6e98);}};}function respondWithFilteredResult(_0x25b2d8,_0x4e89c0){return function(_0x263033){if(_0x263033){var _0x439e2b=typeof _0x4e89c0[_0x86a2('0x1d')]===_0x86a2('0x1e')&&typeof _0x4e89c0[_0x86a2('0x1f')]===_0x86a2('0x1e');var _0x341a18=_0x263033['count'];var _0x4eded9=_0x439e2b?0x0:_0x4e89c0[_0x86a2('0x1d')];var _0xa50bcc=_0x439e2b?_0x263033[_0x86a2('0x20')]:_0x4e89c0[_0x86a2('0x1d')]+_0x4e89c0[_0x86a2('0x1f')];var _0x3df712;if(_0xa50bcc>=_0x341a18){_0xa50bcc=_0x341a18;_0x3df712=0xc8;}else{_0x3df712=0xce;}_0x25b2d8['status'](_0x3df712);return _0x25b2d8[_0x86a2('0x21')](_0x86a2('0x22'),_0x4eded9+'-'+_0xa50bcc+'/'+_0x341a18)['json'](_0x263033);}return null;};}function patchUpdates(_0xf9d455){return function(_0x23adb1){try{jsonpatch[_0x86a2('0x23')](_0x23adb1,_0xf9d455,!![]);}catch(_0x54169f){return BPromise[_0x86a2('0x24')](_0x54169f);}return _0x23adb1[_0x86a2('0x25')]();};}function saveUpdates(_0x1e351d,_0x21b95d){return function(_0x2ed750){if(_0x2ed750){return _0x2ed750[_0x86a2('0x26')](_0x1e351d)[_0x86a2('0x27')](function(_0x5eb233){return _0x5eb233;});}return null;};}function removeEntity(_0x3254b0,_0x48785e){return function(_0x3b6ff0){if(_0x3b6ff0){return _0x3b6ff0[_0x86a2('0x28')]()[_0x86a2('0x27')](function(){var _0x3f3bdd=_0x3b6ff0[_0x86a2('0x29')]({'plain':!![]});var _0x47e7e7=_0x86a2('0x2a');return db[_0x86a2('0x2b')][_0x86a2('0x28')]({'where':{'type':_0x47e7e7,'resourceId':_0x3f3bdd['id']}})['then'](function(){return _0x3b6ff0;});})[_0x86a2('0x27')](function(){_0x3254b0[_0x86a2('0x1a')](0xcc)[_0x86a2('0x1b')]();});}};}function handleEntityNotFound(_0x3e625f,_0x463f35){return function(_0x5b130c){if(!_0x5b130c){_0x3e625f[_0x86a2('0x2c')](0x194);}return _0x5b130c;};}function handleError(_0x5727e8,_0x315ec5){_0x315ec5=_0x315ec5||0x1f4;return function(_0x7c4a77){logger[_0x86a2('0x2d')](_0x7c4a77[_0x86a2('0x2e')]);if(_0x7c4a77[_0x86a2('0x2f')]){delete _0x7c4a77[_0x86a2('0x2f')];}_0x5727e8['status'](_0x315ec5)[_0x86a2('0x30')](_0x7c4a77);};}exports['index']=function(_0x2e2ef7,_0x3920db){var _0x285210={},_0x27a00b={},_0x3bb375={'count':0x0,'rows':[]};var _0x56df64=_[_0x86a2('0x31')](db[_0x86a2('0x32')][_0x86a2('0x33')],function(_0xd572e0){return{'name':_0xd572e0[_0x86a2('0x34')],'type':_0xd572e0['type'][_0x86a2('0x35')]};});_0x27a00b[_0x86a2('0x36')]=_['map'](_0x56df64,_0x86a2('0x2f'));_0x27a00b[_0x86a2('0x37')]=_[_0x86a2('0x38')](_0x2e2ef7['query']);_0x27a00b[_0x86a2('0x39')]=_[_0x86a2('0x3a')](_0x27a00b['model'],_0x27a00b[_0x86a2('0x37')]);_0x285210[_0x86a2('0x3b')]=_[_0x86a2('0x3a')](_0x27a00b[_0x86a2('0x36')],qs[_0x86a2('0x3c')](_0x2e2ef7[_0x86a2('0x37')][_0x86a2('0x3c')]));_0x285210['attributes']=_0x285210[_0x86a2('0x3b')][_0x86a2('0x3d')]?_0x285210[_0x86a2('0x3b')]:_0x27a00b[_0x86a2('0x36')];if(!_0x2e2ef7[_0x86a2('0x37')][_0x86a2('0x3e')]('nolimit')){_0x285210[_0x86a2('0x1f')]=qs[_0x86a2('0x1f')](_0x2e2ef7[_0x86a2('0x37')]['limit']);_0x285210[_0x86a2('0x1d')]=qs[_0x86a2('0x1d')](_0x2e2ef7[_0x86a2('0x37')]['offset']);}_0x285210['order']=qs['sort'](_0x2e2ef7[_0x86a2('0x37')][_0x86a2('0x3f')]);_0x285210['where']=qs[_0x86a2('0x39')](_[_0x86a2('0x40')](_0x2e2ef7[_0x86a2('0x37')],_0x27a00b[_0x86a2('0x39')]),_0x56df64);if(_0x2e2ef7[_0x86a2('0x37')]['filter']){_0x285210['where']=_[_0x86a2('0x41')](_0x285210['where'],{'$or':_[_0x86a2('0x31')](_0x56df64,function(_0x159fab){if(_0x159fab['type']!==_0x86a2('0x42')){var _0xbdb2f1={};_0xbdb2f1[_0x159fab[_0x86a2('0x2f')]]={'$like':'%'+_0x2e2ef7[_0x86a2('0x37')][_0x86a2('0x43')]+'%'};return _0xbdb2f1;}})});}_0x285210=_[_0x86a2('0x41')]({},_0x285210,_0x2e2ef7[_0x86a2('0x44')]);var _0x25439a={'where':_0x285210['where']};return db[_0x86a2('0x32')]['count'](_0x25439a)[_0x86a2('0x27')](function(_0x3a3715){_0x3bb375[_0x86a2('0x20')]=_0x3a3715;if(_0x2e2ef7[_0x86a2('0x37')]['includeAll']){_0x285210[_0x86a2('0x45')]=[{'all':!![]}];}return db['SquareOdbc'][_0x86a2('0x46')](_0x285210);})[_0x86a2('0x27')](function(_0x1f753a){_0x3bb375[_0x86a2('0x47')]=_0x1f753a;return _0x3bb375;})['then'](respondWithFilteredResult(_0x3920db,_0x285210))[_0x86a2('0x48')](handleError(_0x3920db,null));};exports[_0x86a2('0x49')]=function(_0x5d0ffb,_0x3ecac5){var _0x2c4be6={'raw':!![],'where':{'id':_0x5d0ffb['params']['id']}},_0x11f810={};_0x11f810[_0x86a2('0x36')]=_[_0x86a2('0x38')](db['SquareOdbc']['rawAttributes']);_0x11f810['query']=_['keys'](_0x5d0ffb[_0x86a2('0x37')]);_0x11f810['filters']=_[_0x86a2('0x3a')](_0x11f810[_0x86a2('0x36')],_0x11f810['query']);_0x2c4be6[_0x86a2('0x3b')]=_[_0x86a2('0x3a')](_0x11f810[_0x86a2('0x36')],qs[_0x86a2('0x3c')](_0x5d0ffb[_0x86a2('0x37')][_0x86a2('0x3c')]));_0x2c4be6[_0x86a2('0x3b')]=_0x2c4be6['attributes']['length']?_0x2c4be6[_0x86a2('0x3b')]:_0x11f810[_0x86a2('0x36')];if(_0x5d0ffb[_0x86a2('0x37')][_0x86a2('0x4a')]){_0x2c4be6[_0x86a2('0x45')]=[{'all':!![]}];}_0x2c4be6=_[_0x86a2('0x41')]({},_0x2c4be6,_0x5d0ffb[_0x86a2('0x44')]);return db[_0x86a2('0x32')][_0x86a2('0x4b')](_0x2c4be6)[_0x86a2('0x27')](handleEntityNotFound(_0x3ecac5,null))[_0x86a2('0x27')](respondWithResult(_0x3ecac5,null))[_0x86a2('0x48')](handleError(_0x3ecac5,null));};exports['create']=function(_0x585e91,_0x50bbe6){return db[_0x86a2('0x32')][_0x86a2('0x4c')](_0x585e91['body'],{})[_0x86a2('0x27')](function(_0x5432a3){var _0x53e417=_0x585e91[_0x86a2('0x4d')][_0x86a2('0x29')]({'plain':!![]});if(!_0x53e417)throw new Error(_0x86a2('0x4e'));if(_0x53e417[_0x86a2('0x4f')]===_0x86a2('0x4d')){var _0x4d3eed=_0x5432a3[_0x86a2('0x29')]({'plain':!![]});var _0x19fb17=_0x86a2('0x2a');return db[_0x86a2('0x50')][_0x86a2('0x4b')]({'where':{'name':_0x19fb17,'userProfileId':_0x53e417[_0x86a2('0x51')]},'raw':!![]})[_0x86a2('0x27')](function(_0x2cf485){if(_0x2cf485&&_0x2cf485[_0x86a2('0x52')]===0x0){return db[_0x86a2('0x2b')][_0x86a2('0x4c')]({'name':_0x4d3eed[_0x86a2('0x2f')],'resourceId':_0x4d3eed['id'],'type':_0x2cf485[_0x86a2('0x2f')],'sectionId':_0x2cf485['id']},{})[_0x86a2('0x27')](function(){return _0x5432a3;});}else{return _0x5432a3;}})[_0x86a2('0x48')](function(_0x3380ca){logger[_0x86a2('0x2d')](_0x86a2('0x53'),_0x3380ca);throw _0x3380ca;});}return _0x5432a3;})[_0x86a2('0x27')](respondWithResult(_0x50bbe6,0xc9))['catch'](handleError(_0x50bbe6,null));};exports[_0x86a2('0x26')]=function(_0x401507,_0x5bd211){if(_0x401507[_0x86a2('0x54')]['id']){delete _0x401507['body']['id'];}return db[_0x86a2('0x32')][_0x86a2('0x4b')]({'where':{'id':_0x401507[_0x86a2('0x55')]['id']}})[_0x86a2('0x27')](handleEntityNotFound(_0x5bd211,null))[_0x86a2('0x27')](saveUpdates(_0x401507['body'],null))[_0x86a2('0x27')](respondWithResult(_0x5bd211,null))['catch'](handleError(_0x5bd211,null));};exports['destroy']=function(_0x50bc92,_0x36097e){return db[_0x86a2('0x32')][_0x86a2('0x4b')]({'where':{'id':_0x50bc92['params']['id']}})[_0x86a2('0x27')](handleEntityNotFound(_0x36097e,null))[_0x86a2('0x27')](removeEntity(_0x36097e,null))[_0x86a2('0x48')](handleError(_0x36097e,null));};exports['test']=function(_0xfe71f0,_0x1fcefd,_0xb4b8b3){var _0x435d16;return db['SquareOdbc']['find']({'where':{'id':_0xfe71f0[_0x86a2('0x55')]['id']},'attributes':['id',_0x86a2('0x56')]})[_0x86a2('0x27')](handleEntityNotFound(_0x1fcefd,null))['then'](function(_0x42bb51){if(_0x42bb51){var _0x4b2869=require('odbc')();_0x4b2869['openSync'](_0x42bb51['dsn']);_0x4b2869['closeSync']();return _0x42bb51;}})[_0x86a2('0x27')](respondWithResult(_0x1fcefd,null))['catch'](handleError(_0x1fcefd,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 5d9244f..5151ce1 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 _0x0005=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc'];(function(_0x2e1fe0,_0xe49a38){var _0x3a0897=function(_0x28e77d){while(--_0x28e77d){_0x2e1fe0['push'](_0x2e1fe0['shift']());}};_0x3a0897(++_0xe49a38);}(_0x0005,0x12b));var _0x5000=function(_0x1251ae,_0x4ebcb7){_0x1251ae=_0x1251ae-0x0;var _0x5bffaa=_0x0005[_0x1251ae];return _0x5bffaa;};'use strict';var _=require(_0x5000('0x0'));var util=require(_0x5000('0x1'));var logger=require(_0x5000('0x2'))(_0x5000('0x3'));var moment=require(_0x5000('0x4'));var BPromise=require(_0x5000('0x5'));var rp=require(_0x5000('0x6'));var fs=require('fs');var path=require(_0x5000('0x7'));var rimraf=require('rimraf');var config=require(_0x5000('0x8'));var attributes=require(_0x5000('0x9'));module[_0x5000('0xa')]=function(_0x427574,_0x38268c){return _0x427574[_0x5000('0xb')](_0x5000('0xc'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x06bf=['api','bluebird','request-promise','path','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','../../config/logger'];(function(_0x1cd9bd,_0x18b149){var _0x10cb6f=function(_0x2b58db){while(--_0x2b58db){_0x1cd9bd['push'](_0x1cd9bd['shift']());}};_0x10cb6f(++_0x18b149);}(_0x06bf,0x169));var _0xf06b=function(_0x96862b,_0x57723f){_0x96862b=_0x96862b-0x0;var _0x1f1ca6=_0x06bf[_0x96862b];return _0x1f1ca6;};'use strict';var _=require(_0xf06b('0x0'));var util=require('util');var logger=require(_0xf06b('0x1'))(_0xf06b('0x2'));var moment=require('moment');var BPromise=require(_0xf06b('0x3'));var rp=require(_0xf06b('0x4'));var fs=require('fs');var path=require(_0xf06b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf06b('0x6'));module[_0xf06b('0x7')]=function(_0x4e30b6,_0x307ec8){return _0x4e30b6[_0xf06b('0x8')](_0xf06b('0x9'),attributes,{'tableName':_0xf06b('0xa'),'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 0ce908a..bfe0834 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 _0xe3da=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareOdbc,\x20%s,\x20%s','info','request\x20sent','result','catch','ShowSquareOdbc','SquareOdbc','options','raw','where','attributes','map','include','model','lodash','util','moment','randomstring'];(function(_0x3d646f,_0x29babe){var _0x34547c=function(_0x9daa8d){while(--_0x9daa8d){_0x3d646f['push'](_0x3d646f['shift']());}};_0x34547c(++_0x29babe);}(_0xe3da,0x1bc));var _0xae3d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe3da[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var moment=require(_0xae3d('0x2'));var BPromise=require('bluebird');var rs=require(_0xae3d('0x3'));var fs=require('fs');var Redis=require(_0xae3d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xae3d('0x5'));var logger=require(_0xae3d('0x6'))(_0xae3d('0x7'));var config=require(_0xae3d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xae3d('0x9')][_0xae3d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36bad4,_0x3998f1,_0x43adb6){return new BPromise(function(_0x27ef23,_0x29b9a3){return client['request'](_0x36bad4,_0x43adb6)[_0xae3d('0xb')](function(_0x3003c0){logger['info']('SquareOdbc,\x20%s,\x20%s',_0x3998f1,'request\x20sent');logger[_0xae3d('0xc')](_0xae3d('0xd'),_0x3998f1,'request\x20sent',JSON[_0xae3d('0xe')](_0x3003c0));if(_0x3003c0[_0xae3d('0xf')]){if(_0x3003c0[_0xae3d('0xf')][_0xae3d('0x10')]===0x1f4){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x3998f1,_0x3003c0[_0xae3d('0xf')]['message']);return _0x29b9a3(_0x3003c0[_0xae3d('0xf')][_0xae3d('0x11')]);}logger[_0xae3d('0xf')](_0xae3d('0x12'),_0x3998f1,_0x3003c0[_0xae3d('0xf')]['message']);return _0x27ef23(_0x3003c0[_0xae3d('0xf')][_0xae3d('0x11')]);}else{logger[_0xae3d('0x13')](_0xae3d('0x12'),_0x3998f1,_0xae3d('0x14'));_0x27ef23(_0x3003c0[_0xae3d('0x15')][_0xae3d('0x11')]);}})[_0xae3d('0x16')](function(_0x3e1bf0){logger[_0xae3d('0xf')]('SquareOdbc,\x20%s,\x20%s',_0x3998f1,_0x3e1bf0);_0x29b9a3(_0x3e1bf0);});});}exports[_0xae3d('0x17')]=function(_0x3da3ea){var _0x228d97=this;return new Promise(function(_0x2b46e6,_0x18b8e7){return db[_0xae3d('0x18')]['find']({'raw':_0x3da3ea[_0xae3d('0x19')]?_0x3da3ea['options'][_0xae3d('0x1a')]===undefined?!![]:![]:!![],'where':_0x3da3ea[_0xae3d('0x19')]?_0x3da3ea['options'][_0xae3d('0x1b')]||null:null,'attributes':_0x3da3ea[_0xae3d('0x19')]?_0x3da3ea[_0xae3d('0x19')][_0xae3d('0x1c')]||null:null,'include':_0x3da3ea[_0xae3d('0x19')]?_0x3da3ea[_0xae3d('0x19')]['include']?_[_0xae3d('0x1d')](_0x3da3ea[_0xae3d('0x19')][_0xae3d('0x1e')],function(_0x360e8b){return{'model':db[_0x360e8b[_0xae3d('0x1f')]],'as':_0x360e8b['as'],'attributes':_0x360e8b[_0xae3d('0x1c')],'include':_0x360e8b[_0xae3d('0x1e')]?_['map'](_0x360e8b[_0xae3d('0x1e')],function(_0xadcf0d){return{'model':db[_0xadcf0d[_0xae3d('0x1f')]],'as':_0xadcf0d['as'],'attributes':_0xadcf0d['attributes'],'include':_0xadcf0d[_0xae3d('0x1e')]?_[_0xae3d('0x1d')](_0xadcf0d[_0xae3d('0x1e')],function(_0x5519b8){return{'model':db[_0x5519b8[_0xae3d('0x1f')]],'as':_0x5519b8['as'],'attributes':_0x5519b8['attributes']};}):[]};}):[]};}):[]:[]})[_0xae3d('0xb')](function(_0x28da9e){logger['info'](_0xae3d('0x17'),_0x3da3ea);logger[_0xae3d('0xc')]('ShowSquareOdbc',_0x3da3ea,JSON[_0xae3d('0xe')](_0x28da9e));_0x2b46e6(_0x28da9e);})['catch'](function(_0x388f0b){logger[_0xae3d('0xf')](_0xae3d('0x17'),_0x388f0b[_0xae3d('0x11')],_0x3da3ea);_0x18b8e7(_0x228d97['error'](0x1f4,_0x388f0b[_0xae3d('0x11')]));});});}; \ No newline at end of file +var _0xa314=['rpc','../../config/environment','jayson/promise','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','where','attributes','map','model','include','debug','lodash','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x2b5a81,_0xbcf7b){var _0xc957b7=function(_0x87e2b5){while(--_0x87e2b5){_0x2b5a81['push'](_0x2b5a81['shift']());}};_0xc957b7(++_0xbcf7b);}(_0xa314,0xae));var _0x4a31=function(_0x5cbace,_0x33943c){_0x5cbace=_0x5cbace-0x0;var _0x6de5b8=_0xa314[_0x5cbace];return _0x6de5b8;};'use strict';var _=require(_0x4a31('0x0'));var util=require('util');var moment=require(_0x4a31('0x1'));var BPromise=require(_0x4a31('0x2'));var rs=require(_0x4a31('0x3'));var fs=require('fs');var Redis=require(_0x4a31('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4a31('0x5'));var logger=require('../../config/logger')(_0x4a31('0x6'));var config=require(_0x4a31('0x7'));var jayson=require(_0x4a31('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5b7411,_0x7b56b0,_0x12efa0){return new BPromise(function(_0x1a47fc,_0x4437b7){return client['request'](_0x5b7411,_0x12efa0)[_0x4a31('0x9')](function(_0x4857a6){logger[_0x4a31('0xa')](_0x4a31('0xb'),_0x7b56b0,_0x4a31('0xc'));logger['debug'](_0x4a31('0xd'),_0x7b56b0,_0x4a31('0xc'),JSON[_0x4a31('0xe')](_0x4857a6));if(_0x4857a6[_0x4a31('0xf')]){if(_0x4857a6[_0x4a31('0xf')][_0x4a31('0x10')]===0x1f4){logger[_0x4a31('0xf')](_0x4a31('0xb'),_0x7b56b0,_0x4857a6[_0x4a31('0xf')]['message']);return _0x4437b7(_0x4857a6[_0x4a31('0xf')][_0x4a31('0x11')]);}logger[_0x4a31('0xf')](_0x4a31('0xb'),_0x7b56b0,_0x4857a6['error']['message']);return _0x1a47fc(_0x4857a6[_0x4a31('0xf')]['message']);}else{logger[_0x4a31('0xa')](_0x4a31('0xb'),_0x7b56b0,'request\x20sent');_0x1a47fc(_0x4857a6[_0x4a31('0x12')][_0x4a31('0x11')]);}})[_0x4a31('0x13')](function(_0x57809f){logger[_0x4a31('0xf')](_0x4a31('0xb'),_0x7b56b0,_0x57809f);_0x4437b7(_0x57809f);});});}exports[_0x4a31('0x14')]=function(_0x81e86c){var _0x366af2=this;return new Promise(function(_0x334737,_0x583a88){return db[_0x4a31('0x15')][_0x4a31('0x16')]({'raw':_0x81e86c[_0x4a31('0x17')]?_0x81e86c[_0x4a31('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x81e86c[_0x4a31('0x17')]?_0x81e86c['options'][_0x4a31('0x18')]||null:null,'attributes':_0x81e86c[_0x4a31('0x17')]?_0x81e86c[_0x4a31('0x17')][_0x4a31('0x19')]||null:null,'include':_0x81e86c[_0x4a31('0x17')]?_0x81e86c[_0x4a31('0x17')]['include']?_[_0x4a31('0x1a')](_0x81e86c[_0x4a31('0x17')]['include'],function(_0x4d335a){return{'model':db[_0x4d335a[_0x4a31('0x1b')]],'as':_0x4d335a['as'],'attributes':_0x4d335a[_0x4a31('0x19')],'include':_0x4d335a[_0x4a31('0x1c')]?_[_0x4a31('0x1a')](_0x4d335a['include'],function(_0x295df0){return{'model':db[_0x295df0['model']],'as':_0x295df0['as'],'attributes':_0x295df0['attributes'],'include':_0x295df0[_0x4a31('0x1c')]?_[_0x4a31('0x1a')](_0x295df0[_0x4a31('0x1c')],function(_0x1bd1db){return{'model':db[_0x1bd1db[_0x4a31('0x1b')]],'as':_0x1bd1db['as'],'attributes':_0x1bd1db[_0x4a31('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4a31('0x9')](function(_0x17b005){logger[_0x4a31('0xa')](_0x4a31('0x14'),_0x81e86c);logger[_0x4a31('0x1d')](_0x4a31('0x14'),_0x81e86c,JSON[_0x4a31('0xe')](_0x17b005));_0x334737(_0x17b005);})[_0x4a31('0x13')](function(_0x12f8fa){logger[_0x4a31('0xf')]('ShowSquareOdbc',_0x12f8fa[_0x4a31('0x11')],_0x81e86c);_0x583a88(_0x366af2[_0x4a31('0xf')](0x1f4,_0x12f8fa['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 980836a..8b1a52d 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 _0x0cfa=['Router','../../components/auth/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','/:id/users','getUsers','post','addUsers','put','update','delete','destroy','removeUsers','exports','multer','util','path','connect-timeout','express'];(function(_0x192d66,_0x566908){var _0x3319da=function(_0x516bc8){while(--_0x516bc8){_0x192d66['push'](_0x192d66['shift']());}};_0x3319da(++_0x566908);}(_0x0cfa,0x73));var _0xa0cf=function(_0x5a64d7,_0x408582){_0x5a64d7=_0x5a64d7-0x0;var _0x3a9b5d=_0x0cfa[_0x5a64d7];return _0x3a9b5d;};'use strict';var multer=require(_0xa0cf('0x0'));var util=require(_0xa0cf('0x1'));var path=require(_0xa0cf('0x2'));var timeout=require(_0xa0cf('0x3'));var express=require(_0xa0cf('0x4'));var router=express[_0xa0cf('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa0cf('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa0cf('0x7'));var controller=require(_0xa0cf('0x8'));router[_0xa0cf('0x9')]('/',auth[_0xa0cf('0xa')](),controller[_0xa0cf('0xb')]);router[_0xa0cf('0x9')](_0xa0cf('0xc'),auth[_0xa0cf('0xa')](),controller[_0xa0cf('0xd')]);router[_0xa0cf('0x9')](_0xa0cf('0xe'),auth[_0xa0cf('0xa')](),controller[_0xa0cf('0xf')]);router[_0xa0cf('0x10')]('/',auth[_0xa0cf('0xa')](),controller['create']);router[_0xa0cf('0x10')](_0xa0cf('0xe'),auth['isAuthenticated'](),controller[_0xa0cf('0x11')]);router[_0xa0cf('0x12')](_0xa0cf('0xc'),auth[_0xa0cf('0xa')](),controller[_0xa0cf('0x13')]);router[_0xa0cf('0x14')](_0xa0cf('0xc'),auth[_0xa0cf('0xa')](),controller[_0xa0cf('0x15')]);router[_0xa0cf('0x14')]('/:id/users',auth['isAuthenticated'](),controller[_0xa0cf('0x16')]);module[_0xa0cf('0x17')]=router; \ No newline at end of file +var _0x2a5c=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','show','isAuthenticated','getUsers','post','create','/:id/users','addUsers','put','/:id','update','delete','destroy','removeUsers','exports','multer'];(function(_0x3dae98,_0x4cadd5){var _0xf8f1ec=function(_0x23778d){while(--_0x23778d){_0x3dae98['push'](_0x3dae98['shift']());}};_0xf8f1ec(++_0x4cadd5);}(_0x2a5c,0x1f3));var _0xc2a5=function(_0x1c91ec,_0x4af5b8){_0x1c91ec=_0x1c91ec-0x0;var _0xfabd14=_0x2a5c[_0x1c91ec];return _0xfabd14;};'use strict';var multer=require(_0xc2a5('0x0'));var util=require(_0xc2a5('0x1'));var path=require(_0xc2a5('0x2'));var timeout=require(_0xc2a5('0x3'));var express=require(_0xc2a5('0x4'));var router=express['Router']();var fs_extra=require(_0xc2a5('0x5'));var auth=require(_0xc2a5('0x6'));var interaction=require(_0xc2a5('0x7'));var config=require(_0xc2a5('0x8'));var controller=require('./squareProject.controller');router[_0xc2a5('0x9')]('/',auth['isAuthenticated'](),controller[_0xc2a5('0xa')]);router[_0xc2a5('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xc2a5('0xb')]);router[_0xc2a5('0x9')]('/:id/users',auth[_0xc2a5('0xc')](),controller[_0xc2a5('0xd')]);router[_0xc2a5('0xe')]('/',auth[_0xc2a5('0xc')](),controller[_0xc2a5('0xf')]);router[_0xc2a5('0xe')](_0xc2a5('0x10'),auth[_0xc2a5('0xc')](),controller[_0xc2a5('0x11')]);router[_0xc2a5('0x12')](_0xc2a5('0x13'),auth['isAuthenticated'](),controller[_0xc2a5('0x14')]);router[_0xc2a5('0x15')](_0xc2a5('0x13'),auth[_0xc2a5('0xc')](),controller[_0xc2a5('0x16')]);router[_0xc2a5('0x15')]('/:id/users',auth['isAuthenticated'](),controller[_0xc2a5('0x17')]);module[_0xc2a5('0x18')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index e8fc0cd..e9d4f9e 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 _0x22af=['preproduction','toString','utf8','BLOB','production','DATE','sequelize','exports','STRING','TEXT','long','getDataValue'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x22af,0x10e));var _0xf22a=function(_0x54c10d,_0x2f2251){_0x54c10d=_0x54c10d-0x0;var _0x1fa703=_0x22af[_0x54c10d];return _0x1fa703;};'use strict';var Sequelize=require(_0xf22a('0x0'));module[_0xf22a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xf22a('0x2')]},'notes':{'type':Sequelize[_0xf22a('0x3')]},'preproduction':{'type':Sequelize['BLOB'](_0xf22a('0x4')),'get':function(){if(this[_0xf22a('0x5')]('preproduction')){return this[_0xf22a('0x5')](_0xf22a('0x6'))[_0xf22a('0x7')](_0xf22a('0x8'));}}},'production':{'type':Sequelize[_0xf22a('0x9')](_0xf22a('0x4')),'get':function(){if(this[_0xf22a('0x5')](_0xf22a('0xa'))){return this[_0xf22a('0x5')](_0xf22a('0xa'))['toString'](_0xf22a('0x8'));}}},'savedAt':{'type':Sequelize[_0xf22a('0xb')]},'publishedAt':{'type':Sequelize[_0xf22a('0xb')]}}; \ No newline at end of file +var _0x57ee=['DATE','sequelize','exports','STRING','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production'];(function(_0x17f195,_0xd8a7e0){var _0x542c81=function(_0x315046){while(--_0x315046){_0x17f195['push'](_0x17f195['shift']());}};_0x542c81(++_0xd8a7e0);}(_0x57ee,0x199));var _0xe57e=function(_0x194a23,_0x3109c7){_0x194a23=_0x194a23-0x0;var _0x2f88f3=_0x57ee[_0x194a23];return _0x2f88f3;};'use strict';var Sequelize=require(_0xe57e('0x0'));module[_0xe57e('0x1')]={'name':{'type':Sequelize[_0xe57e('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xe57e('0x2')]},'notes':{'type':Sequelize[_0xe57e('0x3')]},'preproduction':{'type':Sequelize[_0xe57e('0x4')](_0xe57e('0x5')),'get':function(){if(this[_0xe57e('0x6')](_0xe57e('0x7'))){return this['getDataValue'](_0xe57e('0x7'))[_0xe57e('0x8')](_0xe57e('0x9'));}}},'production':{'type':Sequelize[_0xe57e('0x4')](_0xe57e('0x5')),'get':function(){if(this['getDataValue'](_0xe57e('0xa'))){return this[_0xe57e('0x6')](_0xe57e('0xa'))[_0xe57e('0x8')]('utf8');}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0xe57e('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 2109781..89c645f 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 _0x66fa=['nolimit','limit','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','rows','catch','show','params','includeAll','include','find','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','production','addUsers','omit','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','./squareProject.socket','register','sendStatus','end','undefined','count','status','set','Content-Range','json','update','then','destroy','get','SquareProjects','UserProfileResource','publish','agi','stringify','error','stack','name','index','map','SquareProject','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x66fa,0x117));var _0xa66f=function(_0x3c7867,_0x4858e0){_0x3c7867=_0x3c7867-0x0;var _0x5d1d95=_0x66fa[_0x3c7867];return _0x5d1d95;};'use strict';var _=require(_0xa66f('0x0'));var Redis=require(_0xa66f('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xa66f('0x2'))(_0xa66f('0x3'));var config=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];config[_0xa66f('0x6')]=_[_0xa66f('0x7')](config[_0xa66f('0x6')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa66f('0x6')]));require(_0xa66f('0x8'))[_0xa66f('0x9')](socket);function respondWithStatusCode(_0x1d02fc,_0x38b58b){_0x38b58b=_0x38b58b||0xcc;return function(_0x5096bf){if(_0x5096bf){return _0x1d02fc[_0xa66f('0xa')](_0x38b58b);}return _0x1d02fc['status'](_0x38b58b)[_0xa66f('0xb')]();};}function respondWithResult(_0x597c7c,_0x101e10){_0x101e10=_0x101e10||0xc8;return function(_0x53ca76){if(_0x53ca76){return _0x597c7c['status'](_0x101e10)['json'](_0x53ca76);}};}function respondWithFilteredResult(_0x1e1997,_0x825868){return function(_0x4979c6){if(_0x4979c6){var _0x14d31e=typeof _0x825868['offset']===_0xa66f('0xc')&&typeof _0x825868['limit']===_0xa66f('0xc');var _0x14af70=_0x4979c6[_0xa66f('0xd')];var _0x4ebd7b=_0x14d31e?0x0:_0x825868['offset'];var _0x215ffa=_0x14d31e?_0x4979c6['count']:_0x825868['offset']+_0x825868['limit'];var _0x3ac0ac;if(_0x215ffa>=_0x14af70){_0x215ffa=_0x14af70;_0x3ac0ac=0xc8;}else{_0x3ac0ac=0xce;}_0x1e1997[_0xa66f('0xe')](_0x3ac0ac);return _0x1e1997[_0xa66f('0xf')](_0xa66f('0x10'),_0x4ebd7b+'-'+_0x215ffa+'/'+_0x14af70)[_0xa66f('0x11')](_0x4979c6);}return null;};}function saveUpdates(_0x567d4f){return function(_0x5510dc){if(_0x5510dc){return _0x5510dc[_0xa66f('0x12')](_0x567d4f)[_0xa66f('0x13')](function(_0x295acf){return _0x295acf;});}return null;};}function removeEntity(_0x403f4d){return function(_0x5c67f5){if(_0x5c67f5){return _0x5c67f5[_0xa66f('0x14')]()['then'](function(){var _0x4a28d4=_0x5c67f5[_0xa66f('0x15')]({'plain':!![]});var _0x413e80=_0xa66f('0x16');return db[_0xa66f('0x17')][_0xa66f('0x14')]({'where':{'type':_0x413e80,'resourceId':_0x4a28d4['id']}})[_0xa66f('0x13')](function(){return _0x5c67f5;});})[_0xa66f('0x13')](function(){var _0x150291=new Redis(config[_0xa66f('0x6')]);_0x150291[_0xa66f('0x18')](_0xa66f('0x19'),JSON[_0xa66f('0x1a')]({'id':_0x5c67f5['id'],'deleted':!![]}));})[_0xa66f('0x13')](function(){_0x403f4d[_0xa66f('0xe')](0xcc)[_0xa66f('0xb')]();});}};}function handleEntityNotFound(_0x5cd613){return function(_0x27f570){if(!_0x27f570){_0x5cd613[_0xa66f('0xa')](0x194);}return _0x27f570;};}function handleError(_0x40ee00,_0x37ee13){_0x37ee13=_0x37ee13||0x1f4;return function(_0x5cbd82){logger[_0xa66f('0x1b')](_0x5cbd82[_0xa66f('0x1c')]);if(_0x5cbd82[_0xa66f('0x1d')]){delete _0x5cbd82[_0xa66f('0x1d')];}_0x40ee00['status'](_0x37ee13)['send'](_0x5cbd82);};}exports[_0xa66f('0x1e')]=function(_0x598942,_0x3a3e4f){var _0xc661f2={},_0x384164={},_0x57da7f={'count':0x0,'rows':[]};var _0x4683c7=_[_0xa66f('0x1f')](db[_0xa66f('0x20')][_0xa66f('0x21')],function(_0x17c103){return{'name':_0x17c103[_0xa66f('0x22')],'type':_0x17c103[_0xa66f('0x23')][_0xa66f('0x24')]};});_0x384164[_0xa66f('0x25')]=_[_0xa66f('0x1f')](_0x4683c7,_0xa66f('0x1d'));_0x384164[_0xa66f('0x26')]=_[_0xa66f('0x27')](_0x598942[_0xa66f('0x26')]);_0x384164['filters']=_['intersection'](_0x384164[_0xa66f('0x25')],_0x384164[_0xa66f('0x26')]);_0xc661f2['attributes']=_[_0xa66f('0x28')](_0x384164[_0xa66f('0x25')],qs['fields'](_0x598942[_0xa66f('0x26')][_0xa66f('0x29')]));_0xc661f2[_0xa66f('0x2a')]=_0xc661f2[_0xa66f('0x2a')][_0xa66f('0x2b')]?_0xc661f2['attributes']:_0x384164[_0xa66f('0x25')];if(!_0x598942['query'][_0xa66f('0x2c')](_0xa66f('0x2d'))){_0xc661f2[_0xa66f('0x2e')]=qs['limit'](_0x598942[_0xa66f('0x26')][_0xa66f('0x2e')]);_0xc661f2['offset']=qs[_0xa66f('0x2f')](_0x598942[_0xa66f('0x26')][_0xa66f('0x2f')]);}_0xc661f2[_0xa66f('0x30')]=qs[_0xa66f('0x31')](_0x598942[_0xa66f('0x26')][_0xa66f('0x31')]);_0xc661f2[_0xa66f('0x32')]=qs[_0xa66f('0x33')](_[_0xa66f('0x34')](_0x598942['query'],_0x384164[_0xa66f('0x33')]),_0x4683c7);if(_0x598942['query'][_0xa66f('0x35')]){_0xc661f2[_0xa66f('0x32')]=_[_0xa66f('0x36')](_0xc661f2[_0xa66f('0x32')],{'$or':_[_0xa66f('0x1f')](_0x4683c7,function(_0x201432){if(_0x201432[_0xa66f('0x23')]!==_0xa66f('0x37')){var _0x54d740={};_0x54d740[_0x201432[_0xa66f('0x1d')]]={'$like':'%'+_0x598942['query'][_0xa66f('0x35')]+'%'};return _0x54d740;}})});}_0xc661f2=_[_0xa66f('0x36')]({},_0xc661f2,_0x598942[_0xa66f('0x38')]);var _0x47b21a={'where':_0xc661f2['where']};return db[_0xa66f('0x20')][_0xa66f('0xd')](_0x47b21a)[_0xa66f('0x13')](function(_0x1f5a5f){_0x57da7f[_0xa66f('0xd')]=_0x1f5a5f;if(_0x598942['query']['includeAll']){_0xc661f2['include']=[{'all':!![]}];}return db[_0xa66f('0x20')]['findAll'](_0xc661f2);})['then'](function(_0x5bf856){_0x57da7f[_0xa66f('0x39')]=_0x5bf856;return _0x57da7f;})['then'](respondWithFilteredResult(_0x3a3e4f,_0xc661f2))[_0xa66f('0x3a')](handleError(_0x3a3e4f,null));};exports[_0xa66f('0x3b')]=function(_0x23a546,_0x1647a0){var _0xd65c5d={'raw':![],'where':{'id':_0x23a546[_0xa66f('0x3c')]['id']}},_0x360e61={};_0x360e61[_0xa66f('0x25')]=_[_0xa66f('0x27')](db[_0xa66f('0x20')][_0xa66f('0x21')]);_0x360e61[_0xa66f('0x26')]=_[_0xa66f('0x27')](_0x23a546[_0xa66f('0x26')]);_0x360e61['filters']=_[_0xa66f('0x28')](_0x360e61[_0xa66f('0x25')],_0x360e61['query']);_0xd65c5d[_0xa66f('0x2a')]=_['intersection'](_0x360e61[_0xa66f('0x25')],qs[_0xa66f('0x29')](_0x23a546['query'][_0xa66f('0x29')]));_0xd65c5d[_0xa66f('0x2a')]=_0xd65c5d[_0xa66f('0x2a')]['length']?_0xd65c5d[_0xa66f('0x2a')]:_0x360e61['model'];if(_0x23a546[_0xa66f('0x26')][_0xa66f('0x3d')]){_0xd65c5d[_0xa66f('0x3e')]=[{'all':!![]}];}_0xd65c5d=_[_0xa66f('0x36')]({},_0xd65c5d,_0x23a546[_0xa66f('0x38')]);return db[_0xa66f('0x20')][_0xa66f('0x3f')](_0xd65c5d)['then'](handleEntityNotFound(_0x1647a0,null))[_0xa66f('0x13')](respondWithResult(_0x1647a0,null))[_0xa66f('0x3a')](handleError(_0x1647a0,null));};exports[_0xa66f('0x40')]=function(_0x19ed53,_0x374e53){return db['SquareProject']['create'](_0x19ed53[_0xa66f('0x41')],{})[_0xa66f('0x13')](function(_0x3e441e){var _0x46d421=_0x19ed53[_0xa66f('0x42')][_0xa66f('0x15')]({'plain':!![]});if(!_0x46d421)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x46d421[_0xa66f('0x43')]===_0xa66f('0x42')){var _0x3f9cdd=_0x3e441e['get']({'plain':!![]});var _0x57c8a0=_0xa66f('0x16');return db[_0xa66f('0x44')][_0xa66f('0x3f')]({'where':{'name':_0x57c8a0,'userProfileId':_0x46d421['userProfileId']},'raw':!![]})['then'](function(_0x52054e){if(_0x52054e&&_0x52054e[_0xa66f('0x45')]===0x0){return db[_0xa66f('0x17')][_0xa66f('0x40')]({'name':_0x3f9cdd[_0xa66f('0x1d')],'resourceId':_0x3f9cdd['id'],'type':_0x52054e[_0xa66f('0x1d')],'sectionId':_0x52054e['id']},{})[_0xa66f('0x13')](function(){return _0x3e441e;});}else{return _0x3e441e;}})[_0xa66f('0x3a')](function(_0x15de06){logger['error'](_0xa66f('0x46'),_0x15de06);throw _0x15de06;});}return _0x3e441e;})[_0xa66f('0x13')](respondWithResult(_0x374e53,0xc9))[_0xa66f('0x3a')](handleError(_0x374e53,null));};exports[_0xa66f('0x12')]=function(_0x11597b,_0x33cdc7){if(_0x11597b['body']['id']){delete _0x11597b[_0xa66f('0x41')]['id'];}return db[_0xa66f('0x20')][_0xa66f('0x3f')]({'where':{'id':_0x11597b[_0xa66f('0x3c')]['id']}})[_0xa66f('0x13')](handleEntityNotFound(_0x33cdc7,null))['then'](saveUpdates(_0x11597b[_0xa66f('0x41')],null))['then'](function(_0x292648){if(!_0x292648)return;var _0x5dc2b8=_0x292648['get']({'plain':!![]});return _0x5dc2b8;})[_0xa66f('0x13')](function(_0x31233b){var _0x12271d=new Redis(config[_0xa66f('0x6')]);_0x12271d[_0xa66f('0x18')](_0xa66f('0x19'),JSON['stringify'](_[_0xa66f('0x34')](_0x31233b,['id',_0xa66f('0x1d'),_0xa66f('0x47')])));return _0x31233b;})[_0xa66f('0x13')](respondWithResult(_0x33cdc7,null))['catch'](handleError(_0x33cdc7,null));};exports[_0xa66f('0x14')]=function(_0x55dd8c,_0x8247aa){return db[_0xa66f('0x20')][_0xa66f('0x3f')]({'where':{'id':_0x55dd8c[_0xa66f('0x3c')]['id']}})[_0xa66f('0x13')](handleEntityNotFound(_0x8247aa,null))[_0xa66f('0x13')](removeEntity(_0x8247aa,null))[_0xa66f('0x3a')](handleError(_0x8247aa,null));};exports['addUsers']=function(_0x2ab3c8,_0x34025c){return db[_0xa66f('0x20')][_0xa66f('0x3f')]({'where':{'id':_0x2ab3c8[_0xa66f('0x3c')]['id']}})[_0xa66f('0x13')](handleEntityNotFound(_0x34025c,null))[_0xa66f('0x13')](function(_0x323145){if(_0x323145){return _0x323145[_0xa66f('0x48')](_0x2ab3c8['body']['ids'],_[_0xa66f('0x49')](_0x2ab3c8[_0xa66f('0x41')],[_0xa66f('0x4a'),'id'])||{});}})[_0xa66f('0x13')](respondWithResult(_0x34025c,null))[_0xa66f('0x3a')](handleError(_0x34025c,null));};exports[_0xa66f('0x4b')]=function(_0x8bea2b,_0x4b10cf){return db[_0xa66f('0x20')][_0xa66f('0x3f')]({'where':{'id':_0x8bea2b[_0xa66f('0x3c')]['id']}})[_0xa66f('0x13')](handleEntityNotFound(_0x4b10cf,null))['then'](function(_0x29f216){if(_0x29f216){return _0x29f216[_0xa66f('0x4b')](_0x8bea2b[_0xa66f('0x26')][_0xa66f('0x4a')])[_0xa66f('0x13')](function(){if(_[_0xa66f('0x4c')](_0x8bea2b['query']['ids'])){for(var _0x15fea8=0x0;_0x15fea8<_0x8bea2b[_0xa66f('0x26')][_0xa66f('0x4a')]['length'];_0x15fea8+=0x1){socket[_0xa66f('0x4d')](_0xa66f('0x4e'),{'UserId':Number(_0x8bea2b[_0xa66f('0x26')][_0xa66f('0x4a')][_0x15fea8]),'SquareProjectId':Number(_0x8bea2b[_0xa66f('0x3c')]['id'])});}}else{socket[_0xa66f('0x4d')](_0xa66f('0x4e'),{'UserId':Number(_0x8bea2b[_0xa66f('0x26')][_0xa66f('0x4a')]),'SquareProjectId':Number(_0x8bea2b['params']['id'])});}});}})[_0xa66f('0x13')](respondWithStatusCode(_0x4b10cf,null))[_0xa66f('0x3a')](handleError(_0x4b10cf,null));};exports[_0xa66f('0x4f')]=function(_0x172c42,_0x4565f5){var _0x148ad1={};var _0x41ffa7={};var _0x3b38ad;var _0x588060;return db['SquareProject'][_0xa66f('0x50')]({'where':{'id':_0x172c42[_0xa66f('0x3c')]['id']}})[_0xa66f('0x13')](handleEntityNotFound(_0x4565f5,null))[_0xa66f('0x13')](function(_0x3b6644){if(_0x3b6644){_0x3b38ad=_0x3b6644;_0x41ffa7['model']=_[_0xa66f('0x27')](db['User'][_0xa66f('0x21')]);_0x41ffa7[_0xa66f('0x26')]=_[_0xa66f('0x27')](_0x172c42[_0xa66f('0x26')]);_0x41ffa7['filters']=_[_0xa66f('0x28')](_0x41ffa7[_0xa66f('0x25')],_0x41ffa7[_0xa66f('0x26')]);_0x148ad1[_0xa66f('0x2a')]=_[_0xa66f('0x28')](_0x41ffa7[_0xa66f('0x25')],qs[_0xa66f('0x29')](_0x172c42[_0xa66f('0x26')][_0xa66f('0x29')]));_0x148ad1[_0xa66f('0x2a')]=_0x148ad1[_0xa66f('0x2a')][_0xa66f('0x2b')]?_0x148ad1['attributes']:_0x41ffa7[_0xa66f('0x25')];_0x148ad1[_0xa66f('0x30')]=qs[_0xa66f('0x31')](_0x172c42[_0xa66f('0x26')][_0xa66f('0x31')]);_0x148ad1[_0xa66f('0x32')]=qs[_0xa66f('0x33')](_[_0xa66f('0x34')](_0x172c42['query'],_0x41ffa7[_0xa66f('0x33')]));if(_0x172c42[_0xa66f('0x26')][_0xa66f('0x35')]){_0x148ad1[_0xa66f('0x32')]=_[_0xa66f('0x36')](_0x148ad1[_0xa66f('0x32')],{'$or':_[_0xa66f('0x1f')](_0x148ad1[_0xa66f('0x2a')],function(_0x4b5785){var _0x4c882e={};_0x4c882e[_0x4b5785]={'$like':'%'+_0x172c42[_0xa66f('0x26')][_0xa66f('0x35')]+'%'};return _0x4c882e;})});}_0x148ad1=_[_0xa66f('0x36')]({},_0x148ad1,_0x172c42['options']);return _0x3b38ad['getUsers'](_0x148ad1);}})[_0xa66f('0x13')](function(_0x421290){if(_0x421290){_0x588060=_0x421290[_0xa66f('0x2b')];if(!_0x172c42[_0xa66f('0x26')]['hasOwnProperty'](_0xa66f('0x2d'))){_0x148ad1[_0xa66f('0x2e')]=qs[_0xa66f('0x2e')](_0x172c42[_0xa66f('0x26')][_0xa66f('0x2e')]);_0x148ad1[_0xa66f('0x2f')]=qs[_0xa66f('0x2f')](_0x172c42[_0xa66f('0x26')]['offset']);}return _0x3b38ad[_0xa66f('0x4f')](_0x148ad1);}})[_0xa66f('0x13')](function(_0x5c6c40){if(_0x5c6c40){return _0x5c6c40?{'count':_0x588060,'rows':_0x5c6c40}:null;}})['then'](respondWithResult(_0x4565f5,null))[_0xa66f('0x3a')](handleError(_0x4565f5,null));}; \ No newline at end of file +var _0x5fab=['get','SquareProjects','UserProfileResource','agi','sendStatus','error','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','VIRTUAL','includeAll','include','SquareProject','rows','catch','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','publish','stringify','production','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','order','merge','hasOwnProperty','nolimit','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','status','end','json','offset','undefined','limit','count','update','destroy','then'];(function(_0x4b3b3a,_0x2ceedf){var _0x4823b0=function(_0x276113){while(--_0x276113){_0x4b3b3a['push'](_0x4b3b3a['shift']());}};_0x4823b0(++_0x2ceedf);}(_0x5fab,0x177));var _0xb5fa=function(_0xd7d69e,_0x20dcf0){_0xd7d69e=_0xd7d69e-0x0;var _0x2cb332=_0x5fab[_0xd7d69e];return _0x2cb332;};'use strict';var _=require(_0xb5fa('0x0'));var Redis=require(_0xb5fa('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xb5fa('0x2'))(_0xb5fa('0x3'));var config=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];config[_0xb5fa('0x6')]=_[_0xb5fa('0x7')](config[_0xb5fa('0x6')],{'host':_0xb5fa('0x8'),'port':0x18eb});var socket=require(_0xb5fa('0x9'))(new Redis(config[_0xb5fa('0x6')]));require('./squareProject.socket')['register'](socket);function respondWithStatusCode(_0x2e3804,_0x1aec3e){_0x1aec3e=_0x1aec3e||0xcc;return function(_0x9c7bce){if(_0x9c7bce){return _0x2e3804['sendStatus'](_0x1aec3e);}return _0x2e3804[_0xb5fa('0xa')](_0x1aec3e)[_0xb5fa('0xb')]();};}function respondWithResult(_0x2cf4a5,_0x54c7eb){_0x54c7eb=_0x54c7eb||0xc8;return function(_0x5b5ea8){if(_0x5b5ea8){return _0x2cf4a5[_0xb5fa('0xa')](_0x54c7eb)[_0xb5fa('0xc')](_0x5b5ea8);}};}function respondWithFilteredResult(_0xe46b26,_0x44e6c8){return function(_0x35ad13){if(_0x35ad13){var _0xadef41=typeof _0x44e6c8[_0xb5fa('0xd')]===_0xb5fa('0xe')&&typeof _0x44e6c8[_0xb5fa('0xf')]==='undefined';var _0x2ad830=_0x35ad13[_0xb5fa('0x10')];var _0x56e8b0=_0xadef41?0x0:_0x44e6c8[_0xb5fa('0xd')];var _0x577af0=_0xadef41?_0x35ad13[_0xb5fa('0x10')]:_0x44e6c8[_0xb5fa('0xd')]+_0x44e6c8[_0xb5fa('0xf')];var _0xca8d82;if(_0x577af0>=_0x2ad830){_0x577af0=_0x2ad830;_0xca8d82=0xc8;}else{_0xca8d82=0xce;}_0xe46b26[_0xb5fa('0xa')](_0xca8d82);return _0xe46b26['set']('Content-Range',_0x56e8b0+'-'+_0x577af0+'/'+_0x2ad830)[_0xb5fa('0xc')](_0x35ad13);}return null;};}function saveUpdates(_0x587043){return function(_0x31f252){if(_0x31f252){return _0x31f252[_0xb5fa('0x11')](_0x587043)['then'](function(_0x4fabcc){return _0x4fabcc;});}return null;};}function removeEntity(_0x451a55){return function(_0x1f7f05){if(_0x1f7f05){return _0x1f7f05[_0xb5fa('0x12')]()[_0xb5fa('0x13')](function(){var _0x324ba5=_0x1f7f05[_0xb5fa('0x14')]({'plain':!![]});var _0x3b0f69=_0xb5fa('0x15');return db[_0xb5fa('0x16')][_0xb5fa('0x12')]({'where':{'type':_0x3b0f69,'resourceId':_0x324ba5['id']}})[_0xb5fa('0x13')](function(){return _0x1f7f05;});})[_0xb5fa('0x13')](function(){var _0x5cd822=new Redis(config[_0xb5fa('0x6')]);_0x5cd822['publish'](_0xb5fa('0x17'),JSON['stringify']({'id':_0x1f7f05['id'],'deleted':!![]}));})[_0xb5fa('0x13')](function(){_0x451a55[_0xb5fa('0xa')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40dfdf){return function(_0x3a2ab9){if(!_0x3a2ab9){_0x40dfdf[_0xb5fa('0x18')](0x194);}return _0x3a2ab9;};}function handleError(_0x47f71a,_0x32a85c){_0x32a85c=_0x32a85c||0x1f4;return function(_0xec108f){logger[_0xb5fa('0x19')](_0xec108f['stack']);if(_0xec108f[_0xb5fa('0x1a')]){delete _0xec108f['name'];}_0x47f71a[_0xb5fa('0xa')](_0x32a85c)[_0xb5fa('0x1b')](_0xec108f);};}exports[_0xb5fa('0x1c')]=function(_0x543edf,_0x2dbd22){var _0x3f61cd={},_0x6a455c={},_0x20d649={'count':0x0,'rows':[]};var _0x568870=_['map'](db['SquareProject']['rawAttributes'],function(_0x28a350){return{'name':_0x28a350[_0xb5fa('0x1d')],'type':_0x28a350[_0xb5fa('0x1e')][_0xb5fa('0x1f')]};});_0x6a455c[_0xb5fa('0x20')]=_[_0xb5fa('0x21')](_0x568870,_0xb5fa('0x1a'));_0x6a455c[_0xb5fa('0x22')]=_[_0xb5fa('0x23')](_0x543edf[_0xb5fa('0x22')]);_0x6a455c[_0xb5fa('0x24')]=_[_0xb5fa('0x25')](_0x6a455c[_0xb5fa('0x20')],_0x6a455c[_0xb5fa('0x22')]);_0x3f61cd[_0xb5fa('0x26')]=_[_0xb5fa('0x25')](_0x6a455c[_0xb5fa('0x20')],qs[_0xb5fa('0x27')](_0x543edf[_0xb5fa('0x22')][_0xb5fa('0x27')]));_0x3f61cd[_0xb5fa('0x26')]=_0x3f61cd[_0xb5fa('0x26')][_0xb5fa('0x28')]?_0x3f61cd[_0xb5fa('0x26')]:_0x6a455c['model'];if(!_0x543edf[_0xb5fa('0x22')]['hasOwnProperty']('nolimit')){_0x3f61cd['limit']=qs[_0xb5fa('0xf')](_0x543edf['query'][_0xb5fa('0xf')]);_0x3f61cd['offset']=qs['offset'](_0x543edf[_0xb5fa('0x22')][_0xb5fa('0xd')]);}_0x3f61cd['order']=qs['sort'](_0x543edf[_0xb5fa('0x22')][_0xb5fa('0x29')]);_0x3f61cd[_0xb5fa('0x2a')]=qs['filters'](_[_0xb5fa('0x2b')](_0x543edf[_0xb5fa('0x22')],_0x6a455c['filters']),_0x568870);if(_0x543edf[_0xb5fa('0x22')][_0xb5fa('0x2c')]){_0x3f61cd[_0xb5fa('0x2a')]=_['merge'](_0x3f61cd[_0xb5fa('0x2a')],{'$or':_[_0xb5fa('0x21')](_0x568870,function(_0x24ef11){if(_0x24ef11['type']!==_0xb5fa('0x2d')){var _0x1c818f={};_0x1c818f[_0x24ef11[_0xb5fa('0x1a')]]={'$like':'%'+_0x543edf[_0xb5fa('0x22')]['filter']+'%'};return _0x1c818f;}})});}_0x3f61cd=_['merge']({},_0x3f61cd,_0x543edf['options']);var _0x49e786={'where':_0x3f61cd['where']};return db['SquareProject'][_0xb5fa('0x10')](_0x49e786)['then'](function(_0x43de71){_0x20d649[_0xb5fa('0x10')]=_0x43de71;if(_0x543edf[_0xb5fa('0x22')][_0xb5fa('0x2e')]){_0x3f61cd[_0xb5fa('0x2f')]=[{'all':!![]}];}return db[_0xb5fa('0x30')]['findAll'](_0x3f61cd);})['then'](function(_0x4c4bf0){_0x20d649[_0xb5fa('0x31')]=_0x4c4bf0;return _0x20d649;})['then'](respondWithFilteredResult(_0x2dbd22,_0x3f61cd))[_0xb5fa('0x32')](handleError(_0x2dbd22,null));};exports['show']=function(_0x58aa97,_0x3cdf63){var _0x42d331={'raw':![],'where':{'id':_0x58aa97[_0xb5fa('0x33')]['id']}},_0x2e056e={};_0x2e056e[_0xb5fa('0x20')]=_[_0xb5fa('0x23')](db[_0xb5fa('0x30')][_0xb5fa('0x34')]);_0x2e056e[_0xb5fa('0x22')]=_[_0xb5fa('0x23')](_0x58aa97['query']);_0x2e056e[_0xb5fa('0x24')]=_['intersection'](_0x2e056e[_0xb5fa('0x20')],_0x2e056e[_0xb5fa('0x22')]);_0x42d331[_0xb5fa('0x26')]=_[_0xb5fa('0x25')](_0x2e056e[_0xb5fa('0x20')],qs[_0xb5fa('0x27')](_0x58aa97[_0xb5fa('0x22')][_0xb5fa('0x27')]));_0x42d331['attributes']=_0x42d331[_0xb5fa('0x26')][_0xb5fa('0x28')]?_0x42d331['attributes']:_0x2e056e[_0xb5fa('0x20')];if(_0x58aa97['query'][_0xb5fa('0x2e')]){_0x42d331[_0xb5fa('0x2f')]=[{'all':!![]}];}_0x42d331=_['merge']({},_0x42d331,_0x58aa97['options']);return db[_0xb5fa('0x30')][_0xb5fa('0x35')](_0x42d331)[_0xb5fa('0x13')](handleEntityNotFound(_0x3cdf63,null))[_0xb5fa('0x13')](respondWithResult(_0x3cdf63,null))[_0xb5fa('0x32')](handleError(_0x3cdf63,null));};exports[_0xb5fa('0x36')]=function(_0x10f354,_0x125a5c){return db['SquareProject'][_0xb5fa('0x36')](_0x10f354[_0xb5fa('0x37')],{})['then'](function(_0xee6baa){var _0x2c378a=_0x10f354[_0xb5fa('0x38')][_0xb5fa('0x14')]({'plain':!![]});if(!_0x2c378a)throw new Error(_0xb5fa('0x39'));if(_0x2c378a[_0xb5fa('0x3a')]===_0xb5fa('0x38')){var _0x33eb2c=_0xee6baa[_0xb5fa('0x14')]({'plain':!![]});var _0x464e36=_0xb5fa('0x15');return db[_0xb5fa('0x3b')][_0xb5fa('0x35')]({'where':{'name':_0x464e36,'userProfileId':_0x2c378a[_0xb5fa('0x3c')]},'raw':!![]})[_0xb5fa('0x13')](function(_0x3a39f2){if(_0x3a39f2&&_0x3a39f2['autoAssociation']===0x0){return db['UserProfileResource'][_0xb5fa('0x36')]({'name':_0x33eb2c['name'],'resourceId':_0x33eb2c['id'],'type':_0x3a39f2[_0xb5fa('0x1a')],'sectionId':_0x3a39f2['id']},{})[_0xb5fa('0x13')](function(){return _0xee6baa;});}else{return _0xee6baa;}})['catch'](function(_0x4ef1d0){logger[_0xb5fa('0x19')](_0xb5fa('0x3d'),_0x4ef1d0);throw _0x4ef1d0;});}return _0xee6baa;})[_0xb5fa('0x13')](respondWithResult(_0x125a5c,0xc9))[_0xb5fa('0x32')](handleError(_0x125a5c,null));};exports[_0xb5fa('0x11')]=function(_0x51d5f7,_0x27a651){if(_0x51d5f7['body']['id']){delete _0x51d5f7[_0xb5fa('0x37')]['id'];}return db[_0xb5fa('0x30')][_0xb5fa('0x35')]({'where':{'id':_0x51d5f7['params']['id']}})[_0xb5fa('0x13')](handleEntityNotFound(_0x27a651,null))[_0xb5fa('0x13')](saveUpdates(_0x51d5f7['body'],null))['then'](function(_0x3f19ee){if(!_0x3f19ee)return;var _0x9ec8c0=_0x3f19ee[_0xb5fa('0x14')]({'plain':!![]});return _0x9ec8c0;})[_0xb5fa('0x13')](function(_0x353fed){var _0x7775b4=new Redis(config[_0xb5fa('0x6')]);_0x7775b4[_0xb5fa('0x3e')](_0xb5fa('0x17'),JSON[_0xb5fa('0x3f')](_[_0xb5fa('0x2b')](_0x353fed,['id',_0xb5fa('0x1a'),_0xb5fa('0x40')])));return _0x353fed;})[_0xb5fa('0x13')](respondWithResult(_0x27a651,null))[_0xb5fa('0x32')](handleError(_0x27a651,null));};exports[_0xb5fa('0x12')]=function(_0x10830a,_0x24acea){return db['SquareProject'][_0xb5fa('0x35')]({'where':{'id':_0x10830a[_0xb5fa('0x33')]['id']}})[_0xb5fa('0x13')](handleEntityNotFound(_0x24acea,null))[_0xb5fa('0x13')](removeEntity(_0x24acea,null))[_0xb5fa('0x32')](handleError(_0x24acea,null));};exports[_0xb5fa('0x41')]=function(_0x4224cf,_0x24117e){return db[_0xb5fa('0x30')][_0xb5fa('0x35')]({'where':{'id':_0x4224cf['params']['id']}})['then'](handleEntityNotFound(_0x24117e,null))[_0xb5fa('0x13')](function(_0x264732){if(_0x264732){return _0x264732[_0xb5fa('0x41')](_0x4224cf['body'][_0xb5fa('0x42')],_[_0xb5fa('0x43')](_0x4224cf[_0xb5fa('0x37')],[_0xb5fa('0x42'),'id'])||{});}})[_0xb5fa('0x13')](respondWithResult(_0x24117e,null))[_0xb5fa('0x32')](handleError(_0x24117e,null));};exports[_0xb5fa('0x44')]=function(_0x4f82f0,_0x7bcd09){return db[_0xb5fa('0x30')]['find']({'where':{'id':_0x4f82f0[_0xb5fa('0x33')]['id']}})[_0xb5fa('0x13')](handleEntityNotFound(_0x7bcd09,null))['then'](function(_0xd94224){if(_0xd94224){return _0xd94224[_0xb5fa('0x44')](_0x4f82f0[_0xb5fa('0x22')][_0xb5fa('0x42')])[_0xb5fa('0x13')](function(){if(_[_0xb5fa('0x45')](_0x4f82f0[_0xb5fa('0x22')][_0xb5fa('0x42')])){for(var _0xd2ba4e=0x0;_0xd2ba4e<_0x4f82f0[_0xb5fa('0x22')][_0xb5fa('0x42')][_0xb5fa('0x28')];_0xd2ba4e+=0x1){socket[_0xb5fa('0x46')](_0xb5fa('0x47'),{'UserId':Number(_0x4f82f0[_0xb5fa('0x22')][_0xb5fa('0x42')][_0xd2ba4e]),'SquareProjectId':Number(_0x4f82f0[_0xb5fa('0x33')]['id'])});}}else{socket[_0xb5fa('0x46')](_0xb5fa('0x47'),{'UserId':Number(_0x4f82f0[_0xb5fa('0x22')][_0xb5fa('0x42')]),'SquareProjectId':Number(_0x4f82f0[_0xb5fa('0x33')]['id'])});}});}})['then'](respondWithStatusCode(_0x7bcd09,null))[_0xb5fa('0x32')](handleError(_0x7bcd09,null));};exports[_0xb5fa('0x48')]=function(_0x43692b,_0x580d1a){var _0x32ab33={};var _0x2d786e={};var _0x58d394;var _0x44fd4a;return db[_0xb5fa('0x30')][_0xb5fa('0x49')]({'where':{'id':_0x43692b['params']['id']}})['then'](handleEntityNotFound(_0x580d1a,null))[_0xb5fa('0x13')](function(_0x2b518d){if(_0x2b518d){_0x58d394=_0x2b518d;_0x2d786e[_0xb5fa('0x20')]=_['keys'](db[_0xb5fa('0x4a')][_0xb5fa('0x34')]);_0x2d786e[_0xb5fa('0x22')]=_[_0xb5fa('0x23')](_0x43692b['query']);_0x2d786e['filters']=_['intersection'](_0x2d786e[_0xb5fa('0x20')],_0x2d786e[_0xb5fa('0x22')]);_0x32ab33[_0xb5fa('0x26')]=_['intersection'](_0x2d786e[_0xb5fa('0x20')],qs[_0xb5fa('0x27')](_0x43692b[_0xb5fa('0x22')][_0xb5fa('0x27')]));_0x32ab33[_0xb5fa('0x26')]=_0x32ab33[_0xb5fa('0x26')][_0xb5fa('0x28')]?_0x32ab33[_0xb5fa('0x26')]:_0x2d786e[_0xb5fa('0x20')];_0x32ab33[_0xb5fa('0x4b')]=qs[_0xb5fa('0x29')](_0x43692b[_0xb5fa('0x22')][_0xb5fa('0x29')]);_0x32ab33[_0xb5fa('0x2a')]=qs[_0xb5fa('0x24')](_['pick'](_0x43692b[_0xb5fa('0x22')],_0x2d786e['filters']));if(_0x43692b[_0xb5fa('0x22')][_0xb5fa('0x2c')]){_0x32ab33[_0xb5fa('0x2a')]=_[_0xb5fa('0x4c')](_0x32ab33[_0xb5fa('0x2a')],{'$or':_['map'](_0x32ab33[_0xb5fa('0x26')],function(_0x589c29){var _0x77a831={};_0x77a831[_0x589c29]={'$like':'%'+_0x43692b[_0xb5fa('0x22')][_0xb5fa('0x2c')]+'%'};return _0x77a831;})});}_0x32ab33=_[_0xb5fa('0x4c')]({},_0x32ab33,_0x43692b['options']);return _0x58d394['getUsers'](_0x32ab33);}})['then'](function(_0x78a34c){if(_0x78a34c){_0x44fd4a=_0x78a34c[_0xb5fa('0x28')];if(!_0x43692b[_0xb5fa('0x22')][_0xb5fa('0x4d')](_0xb5fa('0x4e'))){_0x32ab33[_0xb5fa('0xf')]=qs['limit'](_0x43692b[_0xb5fa('0x22')]['limit']);_0x32ab33['offset']=qs[_0xb5fa('0xd')](_0x43692b['query']['offset']);}return _0x58d394['getUsers'](_0x32ab33);}})[_0xb5fa('0x13')](function(_0x5cbd84){if(_0x5cbd84){return _0x5cbd84?{'count':_0x44fd4a,'rows':_0x5cbd84}:null;}})[_0xb5fa('0x13')](respondWithResult(_0x580d1a,null))[_0xb5fa('0x32')](handleError(_0x580d1a,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 74b850f..c8b420a 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 _0x2c7b=['SquareProject','setMaxListeners','save','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x253f2e,_0x3a320c){var _0x5a708f=function(_0xc2eea1){while(--_0xc2eea1){_0x253f2e['push'](_0x253f2e['shift']());}};_0x5a708f(++_0x3a320c);}(_0x2c7b,0x1ee));var _0xb2c7=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2c7b[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require(_0xb2c7('0x0'));var SquareProject=require(_0xb2c7('0x1'))['db'][_0xb2c7('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xb2c7('0x3')](0x0);var events={'afterCreate':_0xb2c7('0x4'),'afterUpdate':'update','afterDestroy':_0xb2c7('0x5')};function emitEvent(_0x1b4e29){return function(_0xfae59e,_0x47176e,_0x1803b6){SquareProjectEvents[_0xb2c7('0x6')](_0x1b4e29+':'+_0xfae59e['id'],_0xfae59e);SquareProjectEvents[_0xb2c7('0x6')](_0x1b4e29,_0xfae59e);_0x1803b6(null);};}for(var e in events){if(events[_0xb2c7('0x7')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0x56b1=['hook','events','../../mysqldb','setMaxListeners','update','emit'];(function(_0x12877b,_0x8650cf){var _0x3549ff=function(_0x4f96b7){while(--_0x4f96b7){_0x12877b['push'](_0x12877b['shift']());}};_0x3549ff(++_0x8650cf);}(_0x56b1,0x187));var _0x156b=function(_0x5d6328,_0x4ad227){_0x5d6328=_0x5d6328-0x0;var _0x3469cc=_0x56b1[_0x5d6328];return _0x3469cc;};'use strict';var EventEmitter=require(_0x156b('0x0'));var SquareProject=require(_0x156b('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x156b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x156b('0x3'),'afterDestroy':'remove'};function emitEvent(_0x54c154){return function(_0x215eb7,_0x2fd4bb,_0x5d52bf){SquareProjectEvents['emit'](_0x54c154+':'+_0x215eb7['id'],_0x215eb7);SquareProjectEvents[_0x156b('0x4')](_0x54c154,_0x215eb7);_0x5d52bf(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x156b('0x5')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index f21d400..24fe54a 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 _0xdb81=['bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','preproduction','savedAt','format','changed','production','publishedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','moment'];(function(_0x2f68fa,_0x212761){var _0x32abcf=function(_0x5bb2e3){while(--_0x5bb2e3){_0x2f68fa['push'](_0x2f68fa['shift']());}};_0x32abcf(++_0x212761);}(_0xdb81,0x89));var _0x1db8=function(_0x3f8cde,_0x34c7af){_0x3f8cde=_0x3f8cde-0x0;var _0x43c6f4=_0xdb81[_0x3f8cde];return _0x43c6f4;};'use strict';var _=require(_0x1db8('0x0'));var util=require('util');var logger=require(_0x1db8('0x1'))('api');var moment=require(_0x1db8('0x2'));var BPromise=require(_0x1db8('0x3'));var rp=require(_0x1db8('0x4'));var fs=require('fs');var path=require(_0x1db8('0x5'));var rimraf=require(_0x1db8('0x6'));var config=require(_0x1db8('0x7'));var attributes=require(_0x1db8('0x8'));module[_0x1db8('0x9')]=function(_0x1bdfae,_0x52e656){return _0x1bdfae[_0x1db8('0xa')](_0x1db8('0xb'),attributes,{'tableName':_0x1db8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x37fa3e,_0x3c6d82,_0x12453a){if(_0x37fa3e['changed'](_0x1db8('0xd'))){_0x37fa3e[_0x1db8('0xe')]=moment()[_0x1db8('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x37fa3e[_0x1db8('0x10')](_0x1db8('0x11'))){_0x37fa3e[_0x1db8('0x12')]=moment()['format'](_0x1db8('0x13'));}_0x12453a(null,_0x37fa3e);}}});}; \ No newline at end of file +var _0x612e=['square_projects','changed','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','publishedAt','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','SquareProject'];(function(_0x1b478b,_0x5e4049){var _0x35d4f8=function(_0x112b07){while(--_0x112b07){_0x1b478b['push'](_0x1b478b['shift']());}};_0x35d4f8(++_0x5e4049);}(_0x612e,0x1a6));var _0xe612=function(_0x4622d2,_0x3eb3bc){_0x4622d2=_0x4622d2-0x0;var _0x85cfea=_0x612e[_0x4622d2];return _0x85cfea;};'use strict';var _=require(_0xe612('0x0'));var util=require(_0xe612('0x1'));var logger=require('../../config/logger')(_0xe612('0x2'));var moment=require(_0xe612('0x3'));var BPromise=require(_0xe612('0x4'));var rp=require(_0xe612('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe612('0x6'));var config=require(_0xe612('0x7'));var attributes=require('./squareProject.attributes');module[_0xe612('0x8')]=function(_0x4e9ec2,_0x2506f8){return _0x4e9ec2['define'](_0xe612('0x9'),attributes,{'tableName':_0xe612('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x42fe96,_0x553db3,_0x313235){if(_0x42fe96[_0xe612('0xb')]('preproduction')){_0x42fe96[_0xe612('0xc')]=moment()[_0xe612('0xd')](_0xe612('0xe'));}if(_0x42fe96[_0xe612('0xb')]('production')){_0x42fe96[_0xe612('0xf')]=moment()[_0xe612('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x313235(null,_0x42fe96);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index aaf6d88..135bed3 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 _0xd81f=['map','include','model','attributes','debug','stringify','error','message','then','info','ShowSquareProject','catch','lodash','ioredis','../../mysqldb','../../config/logger','../../config/environment','redis','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','where','limit'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xd81f,0x1cc));var _0xfd81=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0xd81f[_0x1477ef];return _0x164acd;};'use strict';var _=require(_0xfd81('0x0'));var Redis=require(_0xfd81('0x1'));var db=require(_0xfd81('0x2'))['db'];var logger=require(_0xfd81('0x3'))('rpc');var config=require(_0xfd81('0x4'));config[_0xfd81('0x5')]=_['defaults'](config[_0xfd81('0x5')],{'host':_0xfd81('0x6'),'port':0x18eb});var socket=require(_0xfd81('0x7'))(new Redis(config[_0xfd81('0x5')]));require(_0xfd81('0x8'))[_0xfd81('0x9')](socket);exports[_0xfd81('0xa')]=function(_0x2c43bf){var _0x304a7d=this;return new Promise(function(_0x51b61a,_0x239eb3){return db[_0xfd81('0xb')][_0xfd81('0xc')]({'raw':_0x2c43bf[_0xfd81('0xd')]?_0x2c43bf[_0xfd81('0xd')]['raw']===undefined?!![]:![]:!![],'where':_0x2c43bf[_0xfd81('0xd')]?_0x2c43bf[_0xfd81('0xd')][_0xfd81('0xe')]||null:null,'attributes':_0x2c43bf[_0xfd81('0xd')]?_0x2c43bf[_0xfd81('0xd')]['attributes']||null:null,'limit':_0x2c43bf[_0xfd81('0xd')]?_0x2c43bf[_0xfd81('0xd')][_0xfd81('0xf')]||null:null,'include':_0x2c43bf[_0xfd81('0xd')]?_0x2c43bf['options']['include']?_[_0xfd81('0x10')](_0x2c43bf['options'][_0xfd81('0x11')],function(_0x518933){return{'model':db[_0x518933[_0xfd81('0x12')]],'as':_0x518933['as'],'attributes':_0x518933[_0xfd81('0x13')],'include':_0x518933[_0xfd81('0x11')]?_[_0xfd81('0x10')](_0x518933['include'],function(_0x31f25f){return{'model':db[_0x31f25f['model']],'as':_0x31f25f['as'],'attributes':_0x31f25f[_0xfd81('0x13')],'include':_0x31f25f[_0xfd81('0x11')]?_['map'](_0x31f25f[_0xfd81('0x11')],function(_0x9a6fda){return{'model':db[_0x9a6fda[_0xfd81('0x12')]],'as':_0x9a6fda['as'],'attributes':_0x9a6fda[_0xfd81('0x13')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb41859){logger['info'](_0xfd81('0xa'),_0x2c43bf);logger[_0xfd81('0x14')]('GetSquareProjects',_0x2c43bf,JSON[_0xfd81('0x15')](_0xb41859));_0x51b61a(_0xb41859);})['catch'](function(_0x1a7ad8){logger[_0xfd81('0x16')](_0xfd81('0xa'),_0x1a7ad8['message'],_0x2c43bf);_0x239eb3(_0x304a7d[_0xfd81('0x16')](0x1f4,_0x1a7ad8[_0xfd81('0x17')]));});});};exports['ShowSquareProject']=function(_0x193b4a){var _0x44d67b=this;return new Promise(function(_0xd11a40,_0x11aa8a){return db['SquareProject']['find']({'raw':_0x193b4a[_0xfd81('0xd')]?_0x193b4a['options']['raw']===undefined?!![]:![]:!![],'where':_0x193b4a[_0xfd81('0xd')]?_0x193b4a[_0xfd81('0xd')][_0xfd81('0xe')]||null:null,'attributes':_0x193b4a[_0xfd81('0xd')]?_0x193b4a['options'][_0xfd81('0x13')]||null:null,'include':_0x193b4a['options']?_0x193b4a[_0xfd81('0xd')][_0xfd81('0x11')]?_[_0xfd81('0x10')](_0x193b4a['options'][_0xfd81('0x11')],function(_0x632233){return{'model':db[_0x632233[_0xfd81('0x12')]],'as':_0x632233['as'],'attributes':_0x632233[_0xfd81('0x13')],'include':_0x632233[_0xfd81('0x11')]?_['map'](_0x632233['include'],function(_0x27b0db){return{'model':db[_0x27b0db[_0xfd81('0x12')]],'as':_0x27b0db['as'],'attributes':_0x27b0db[_0xfd81('0x13')],'include':_0x27b0db[_0xfd81('0x11')]?_['map'](_0x27b0db[_0xfd81('0x11')],function(_0x3e1de4){return{'model':db[_0x3e1de4['model']],'as':_0x3e1de4['as'],'attributes':_0x3e1de4[_0xfd81('0x13')]};}):[]};}):[]};}):[]:[]})[_0xfd81('0x18')](function(_0x2b1298){logger[_0xfd81('0x19')](_0xfd81('0x1a'),_0x193b4a);logger[_0xfd81('0x14')](_0xfd81('0x1a'),_0x193b4a,JSON[_0xfd81('0x15')](_0x2b1298));_0xd11a40(_0x2b1298);})[_0xfd81('0x1b')](function(_0x4d5156){logger['error']('ShowSquareProject',_0x4d5156[_0xfd81('0x17')],_0x193b4a);_0x11aa8a(_0x44d67b[_0xfd81('0x16')](0x1f4,_0x4d5156[_0xfd81('0x17')]));});});}; \ No newline at end of file +var _0x3b52=['then','GetSquareProjects','debug','stringify','catch','error','message','ShowSquareProject','SquareProject','raw','lodash','../../mysqldb','rpc','../../config/environment','defaults','redis','localhost','findAll','options','where','limit','include','model','attributes','map'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3b52,0xb9));var _0x23b5=function(_0x2b4ecf,_0x58a97){_0x2b4ecf=_0x2b4ecf-0x0;var _0x34faa4=_0x3b52[_0x2b4ecf];return _0x34faa4;};'use strict';var _=require(_0x23b5('0x0'));var Redis=require('ioredis');var db=require(_0x23b5('0x1'))['db'];var logger=require('../../config/logger')(_0x23b5('0x2'));var config=require(_0x23b5('0x3'));config['redis']=_[_0x23b5('0x4')](config[_0x23b5('0x5')],{'host':_0x23b5('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x23b5('0x5')]));require('./squareProject.socket')['register'](socket);exports['GetSquareProjects']=function(_0x2d192e){var _0x2d9dbf=this;return new Promise(function(_0x1ee68b,_0x52f3c8){return db['SquareProject'][_0x23b5('0x7')]({'raw':_0x2d192e[_0x23b5('0x8')]?_0x2d192e[_0x23b5('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x2d192e[_0x23b5('0x8')]?_0x2d192e[_0x23b5('0x8')][_0x23b5('0x9')]||null:null,'attributes':_0x2d192e[_0x23b5('0x8')]?_0x2d192e['options']['attributes']||null:null,'limit':_0x2d192e[_0x23b5('0x8')]?_0x2d192e[_0x23b5('0x8')][_0x23b5('0xa')]||null:null,'include':_0x2d192e[_0x23b5('0x8')]?_0x2d192e[_0x23b5('0x8')][_0x23b5('0xb')]?_['map'](_0x2d192e['options'][_0x23b5('0xb')],function(_0x489b28){return{'model':db[_0x489b28[_0x23b5('0xc')]],'as':_0x489b28['as'],'attributes':_0x489b28[_0x23b5('0xd')],'include':_0x489b28[_0x23b5('0xb')]?_[_0x23b5('0xe')](_0x489b28[_0x23b5('0xb')],function(_0x6b2dce){return{'model':db[_0x6b2dce['model']],'as':_0x6b2dce['as'],'attributes':_0x6b2dce['attributes'],'include':_0x6b2dce['include']?_[_0x23b5('0xe')](_0x6b2dce[_0x23b5('0xb')],function(_0x3b3c01){return{'model':db[_0x3b3c01['model']],'as':_0x3b3c01['as'],'attributes':_0x3b3c01['attributes']};}):[]};}):[]};}):[]:[]})[_0x23b5('0xf')](function(_0x832251){logger['info'](_0x23b5('0x10'),_0x2d192e);logger[_0x23b5('0x11')]('GetSquareProjects',_0x2d192e,JSON[_0x23b5('0x12')](_0x832251));_0x1ee68b(_0x832251);})[_0x23b5('0x13')](function(_0x4bc7d9){logger[_0x23b5('0x14')](_0x23b5('0x10'),_0x4bc7d9[_0x23b5('0x15')],_0x2d192e);_0x52f3c8(_0x2d9dbf[_0x23b5('0x14')](0x1f4,_0x4bc7d9[_0x23b5('0x15')]));});});};exports[_0x23b5('0x16')]=function(_0x1ef593){var _0x338b22=this;return new Promise(function(_0x419426,_0x1da72b){return db[_0x23b5('0x17')]['find']({'raw':_0x1ef593['options']?_0x1ef593[_0x23b5('0x8')][_0x23b5('0x18')]===undefined?!![]:![]:!![],'where':_0x1ef593['options']?_0x1ef593[_0x23b5('0x8')][_0x23b5('0x9')]||null:null,'attributes':_0x1ef593['options']?_0x1ef593[_0x23b5('0x8')][_0x23b5('0xd')]||null:null,'include':_0x1ef593[_0x23b5('0x8')]?_0x1ef593[_0x23b5('0x8')][_0x23b5('0xb')]?_[_0x23b5('0xe')](_0x1ef593[_0x23b5('0x8')][_0x23b5('0xb')],function(_0x1ce2cd){return{'model':db[_0x1ce2cd[_0x23b5('0xc')]],'as':_0x1ce2cd['as'],'attributes':_0x1ce2cd[_0x23b5('0xd')],'include':_0x1ce2cd[_0x23b5('0xb')]?_[_0x23b5('0xe')](_0x1ce2cd[_0x23b5('0xb')],function(_0x15972c){return{'model':db[_0x15972c[_0x23b5('0xc')]],'as':_0x15972c['as'],'attributes':_0x15972c['attributes'],'include':_0x15972c['include']?_[_0x23b5('0xe')](_0x15972c['include'],function(_0x49db42){return{'model':db[_0x49db42['model']],'as':_0x49db42['as'],'attributes':_0x49db42[_0x23b5('0xd')]};}):[]};}):[]};}):[]:[]})[_0x23b5('0xf')](function(_0x356f92){logger['info']('ShowSquareProject',_0x1ef593);logger[_0x23b5('0x11')](_0x23b5('0x16'),_0x1ef593,JSON[_0x23b5('0x12')](_0x356f92));_0x419426(_0x356f92);})['catch'](function(_0x56e1df){logger[_0x23b5('0x14')]('ShowSquareProject',_0x56e1df[_0x23b5('0x15')],_0x1ef593);_0x1da72b(_0x338b22['error'](0x1f4,_0x56e1df[_0x23b5('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 2f34bc7..197f52b 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 _0xeca3=['register','length','squareProject:','./squareProject.events','save','remove','emit'];(function(_0x41e7cc,_0x3e893e){var _0x4a79cf=function(_0x2056d7){while(--_0x2056d7){_0x41e7cc['push'](_0x41e7cc['shift']());}};_0x4a79cf(++_0x3e893e);}(_0xeca3,0x192));var _0x3eca=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xeca3[_0x25e7cb];return _0x375d92;};'use strict';var SquareProjectEvents=require(_0x3eca('0x0'));var events=[_0x3eca('0x1'),_0x3eca('0x2'),'update'];function createListener(_0x5e9dfa,_0x5a371c){return function(_0x149be4){_0x5a371c[_0x3eca('0x3')](_0x5e9dfa,_0x149be4);};}function removeListener(_0xfe36e5,_0x3c1985){return function(){SquareProjectEvents['removeListener'](_0xfe36e5,_0x3c1985);};}exports[_0x3eca('0x4')]=function(_0x98af33){for(var _0x546e76=0x0,_0x440a4d=events[_0x3eca('0x5')];_0x546e76<_0x440a4d;_0x546e76++){var _0x6ae24=events[_0x546e76];var _0x5e78c9=createListener(_0x3eca('0x6')+_0x6ae24,_0x98af33);SquareProjectEvents['on'](_0x6ae24,_0x5e78c9);}}; \ No newline at end of file +var _0x7608=['removeListener','register','length','squareProject:','./squareProject.events','save','remove','emit'];(function(_0x4d2999,_0x19600b){var _0x117511=function(_0x3fa529){while(--_0x3fa529){_0x4d2999['push'](_0x4d2999['shift']());}};_0x117511(++_0x19600b);}(_0x7608,0x17c));var _0x8760=function(_0x4e8236,_0x3a3bd4){_0x4e8236=_0x4e8236-0x0;var _0x105dff=_0x7608[_0x4e8236];return _0x105dff;};'use strict';var SquareProjectEvents=require(_0x8760('0x0'));var events=[_0x8760('0x1'),_0x8760('0x2'),'update'];function createListener(_0xe7c836,_0x394884){return function(_0x35e7a4){_0x394884[_0x8760('0x3')](_0xe7c836,_0x35e7a4);};}function removeListener(_0x284c49,_0x58bc6d){return function(){SquareProjectEvents[_0x8760('0x4')](_0x284c49,_0x58bc6d);};}exports[_0x8760('0x5')]=function(_0x5235bb){for(var _0x18fc2d=0x0,_0x42f51b=events[_0x8760('0x6')];_0x18fc2d<_0x42f51b;_0x18fc2d++){var _0x27940f=events[_0x18fc2d];var _0x227090=createListener(_0x8760('0x7')+_0x27940f,_0x5235bb);SquareProjectEvents['on'](_0x27940f,_0x227090);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 6e93ecf..ddbfb50 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 _0x0295=['isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0x0295,0x1f0));var _0x5029=function(_0x4ea444,_0x56dde4){_0x4ea444=_0x4ea444-0x0;var _0x52b1e0=_0x0295[_0x4ea444];return _0x52b1e0;};'use strict';var multer=require(_0x5029('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5029('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5029('0x2'));var auth=require(_0x5029('0x3'));var interaction=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var controller=require(_0x5029('0x6'));router[_0x5029('0x7')]('/',auth[_0x5029('0x8')](),controller[_0x5029('0x9')]);router[_0x5029('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x5029('0x7')]('/:id/download',auth[_0x5029('0x8')](),controller['download']);router[_0x5029('0xa')]('/',auth['isAuthenticated'](),controller[_0x5029('0xb')]);router[_0x5029('0xc')](_0x5029('0xd'),auth['isAuthenticated'](),controller[_0x5029('0xe')]);router[_0x5029('0xf')](_0x5029('0xd'),auth['isAuthenticated'](),controller[_0x5029('0x10')]);module[_0x5029('0x11')]=router; \ No newline at end of file +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(_0xe08821,_0x5f8de7){var _0x50ff0a=function(_0x2602b8){while(--_0x2602b8){_0xe08821['push'](_0xe08821['shift']());}};_0x50ff0a(++_0x5f8de7);}(_0x53ec,0x192));var _0xc53e=function(_0x1a547e,_0x5917d3){_0x1a547e=_0x1a547e-0x0;var _0x5ebdaf=_0x53ec[_0x1a547e];return _0x5ebdaf;};'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 fbf3293..433ca37 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 _0x814b=['substring','lastIndexOf','sequelize','exports','STRING','VIRTUAL','getDataValue','savePath'];(function(_0x131de5,_0x17c497){var _0x5672da=function(_0x10a073){while(--_0x10a073){_0x131de5['push'](_0x131de5['shift']());}};_0x5672da(++_0x17c497);}(_0x814b,0x1a2));var _0xb814=function(_0x4914e2,_0x48be8f){_0x4914e2=_0x4914e2-0x0;var _0x2dcd07=_0x814b[_0x4914e2];return _0x2dcd07;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'uniqueid':{'type':Sequelize[_0xb814('0x2')]},'callerid':{'type':Sequelize[_0xb814('0x2')]},'calleridname':{'type':Sequelize[_0xb814('0x2')]},'context':{'type':Sequelize[_0xb814('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xb814('0x2')]},'accountcode':{'type':Sequelize[_0xb814('0x2')]},'dnid':{'type':Sequelize[_0xb814('0x2')]},'projectName':{'type':Sequelize[_0xb814('0x2')]},'saveName':{'type':Sequelize[_0xb814('0x2')]},'filename':{'type':Sequelize[_0xb814('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xb814('0x3')],'get':function(){var _0x2e6272='';var _0x5c8539=this[_0xb814('0x4')](_0xb814('0x5'));if(_0x5c8539){_0x2e6272=_0x5c8539[_0xb814('0x6')](_0x5c8539[_0xb814('0x7')]('.'));}return _0x2e6272;}}}; \ No newline at end of file +var _0xeec6=['sequelize','exports','STRING','getDataValue','savePath','lastIndexOf'];(function(_0x5443c8,_0x287003){var _0x565bee=function(_0xfaa7d6){while(--_0xfaa7d6){_0x5443c8['push'](_0x5443c8['shift']());}};_0x565bee(++_0x287003);}(_0xeec6,0x1c2));var _0x6eec=function(_0x3feb8a,_0x47c784){_0x3feb8a=_0x3feb8a-0x0;var _0x4523ca=_0xeec6[_0x3feb8a];return _0x4523ca;};'use strict';var Sequelize=require(_0x6eec('0x0'));module[_0x6eec('0x1')]={'uniqueid':{'type':Sequelize[_0x6eec('0x2')]},'callerid':{'type':Sequelize[_0x6eec('0x2')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x6eec('0x2')]},'extension':{'type':Sequelize[_0x6eec('0x2')]},'priority':{'type':Sequelize[_0x6eec('0x2')]},'accountcode':{'type':Sequelize[_0x6eec('0x2')]},'dnid':{'type':Sequelize[_0x6eec('0x2')]},'projectName':{'type':Sequelize[_0x6eec('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x6eec('0x2')]},'savePath':{'type':Sequelize[_0x6eec('0x2')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x5a5e47='';var _0x1c810e=this[_0x6eec('0x3')](_0x6eec('0x4'));if(_0x1c810e){_0x5a5e47=_0x1c810e['substring'](_0x1c810e[_0x6eec('0x5')]('.'));}return _0x5a5e47;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index e9215ed..574e8c3 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 _0x8463=['savePath','filename','format','%s.cypher','existsSync','secrets','ValidationError','extname','unlink','message','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','limit','undefined','offset','count','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','body','download','../../components/encryptor','uniqueid'];(function(_0x312ece,_0x567b60){var _0x37b22c=function(_0x123362){while(--_0x123362){_0x312ece['push'](_0x312ece['shift']());}};_0x37b22c(++_0x567b60);}(_0x8463,0x12f));var _0x3846=function(_0x5486fc,_0x13f451){_0x5486fc=_0x5486fc-0x0;var _0x30e6de=_0x8463[_0x5486fc];return _0x30e6de;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3846('0x0'));var zipdir=require(_0x3846('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3846('0x2'));var moment=require(_0x3846('0x3'));var BPromise=require(_0x3846('0x4'));var Mustache=require(_0x3846('0x5'));var util=require('util');var path=require(_0x3846('0x6'));var sox=require(_0x3846('0x7'));var csv=require(_0x3846('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3846('0x9'));var _=require(_0x3846('0xa'));var squel=require(_0x3846('0xb'));var crypto=require('crypto');var jsforce=require(_0x3846('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3846('0xd'));var Redis=require(_0x3846('0xe'));var authService=require(_0x3846('0xf'));var qs=require(_0x3846('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3846('0x11'))(_0x3846('0x12'));var utils=require(_0x3846('0x13'));var config=require(_0x3846('0x14'));var licenseUtil=require(_0x3846('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xdba5e7,_0x1236e1){_0x1236e1=_0x1236e1||0xcc;return function(_0x3312f4){if(_0x3312f4){return _0xdba5e7[_0x3846('0x16')](_0x1236e1);}return _0xdba5e7['status'](_0x1236e1)[_0x3846('0x17')]();};}function respondWithResult(_0x189366,_0x118d60){_0x118d60=_0x118d60||0xc8;return function(_0xc90d90){if(_0xc90d90){return _0x189366[_0x3846('0x18')](_0x118d60)['json'](_0xc90d90);}};}function respondWithFilteredResult(_0x1ab05b,_0xa301c3){return function(_0x55fe6a){if(_0x55fe6a){var _0x130c95=typeof _0xa301c3['offset']==='undefined'&&typeof _0xa301c3[_0x3846('0x19')]===_0x3846('0x1a');var _0x1a0a19=_0x55fe6a['count'];var _0x42794f=_0x130c95?0x0:_0xa301c3[_0x3846('0x1b')];var _0x3ed323=_0x130c95?_0x55fe6a[_0x3846('0x1c')]:_0xa301c3['offset']+_0xa301c3[_0x3846('0x19')];var _0x102a15;if(_0x3ed323>=_0x1a0a19){_0x3ed323=_0x1a0a19;_0x102a15=0xc8;}else{_0x102a15=0xce;}_0x1ab05b['status'](_0x102a15);return _0x1ab05b[_0x3846('0x1d')](_0x3846('0x1e'),_0x42794f+'-'+_0x3ed323+'/'+_0x1a0a19)[_0x3846('0x1f')](_0x55fe6a);}return null;};}function patchUpdates(_0xff2bcd){return function(_0x22709a){try{jsonpatch['apply'](_0x22709a,_0xff2bcd,!![]);}catch(_0x913cf5){return BPromise[_0x3846('0x20')](_0x913cf5);}return _0x22709a[_0x3846('0x21')]();};}function saveUpdates(_0xca6c55,_0x15a4a3){return function(_0x5c02ca){if(_0x5c02ca){return _0x5c02ca[_0x3846('0x22')](_0xca6c55)[_0x3846('0x23')](function(_0x4c2d8f){return _0x4c2d8f;});}return null;};}function removeEntity(_0x2b32b0,_0x382586){return function(_0x3599b6){if(_0x3599b6){return _0x3599b6[_0x3846('0x24')]()[_0x3846('0x23')](function(){_0x2b32b0[_0x3846('0x18')](0xcc)[_0x3846('0x17')]();});}};}function handleEntityNotFound(_0x1e1a59,_0x58ffc9){return function(_0x4232a0){if(!_0x4232a0){_0x1e1a59[_0x3846('0x16')](0x194);}return _0x4232a0;};}function handleError(_0x229602,_0x8cfff2){_0x8cfff2=_0x8cfff2||0x1f4;return function(_0x48af9e){logger[_0x3846('0x25')](_0x48af9e[_0x3846('0x26')]);if(_0x48af9e[_0x3846('0x27')]){delete _0x48af9e[_0x3846('0x27')];}_0x229602[_0x3846('0x18')](_0x8cfff2)[_0x3846('0x28')](_0x48af9e);};}exports[_0x3846('0x29')]=function(_0xdf3904,_0xc95270){var _0x2cc1f7={},_0x11817d={},_0x1b1990={'count':0x0,'rows':[]};var _0x191dd4=_[_0x3846('0x2a')](db[_0x3846('0x2b')][_0x3846('0x2c')],function(_0xf420f2){return{'name':_0xf420f2[_0x3846('0x2d')],'type':_0xf420f2[_0x3846('0x2e')][_0x3846('0x2f')]};});_0x11817d[_0x3846('0x30')]=_[_0x3846('0x2a')](_0x191dd4,_0x3846('0x27'));_0x11817d[_0x3846('0x31')]=_[_0x3846('0x32')](_0xdf3904['query']);_0x11817d['filters']=_[_0x3846('0x33')](_0x11817d[_0x3846('0x30')],_0x11817d['query']);_0x2cc1f7[_0x3846('0x34')]=_['intersection'](_0x11817d['model'],qs[_0x3846('0x35')](_0xdf3904[_0x3846('0x31')][_0x3846('0x35')]));_0x2cc1f7[_0x3846('0x34')]=_0x2cc1f7[_0x3846('0x34')][_0x3846('0x36')]?_0x2cc1f7[_0x3846('0x34')]:_0x11817d[_0x3846('0x30')];if(!_0xdf3904['query'][_0x3846('0x37')](_0x3846('0x38'))){_0x2cc1f7[_0x3846('0x19')]=qs[_0x3846('0x19')](_0xdf3904[_0x3846('0x31')]['limit']);_0x2cc1f7[_0x3846('0x1b')]=qs['offset'](_0xdf3904[_0x3846('0x31')][_0x3846('0x1b')]);}_0x2cc1f7[_0x3846('0x39')]=qs[_0x3846('0x3a')](_0xdf3904[_0x3846('0x31')][_0x3846('0x3a')]);_0x2cc1f7[_0x3846('0x3b')]=qs[_0x3846('0x3c')](_['pick'](_0xdf3904['query'],_0x11817d[_0x3846('0x3c')]),_0x191dd4);if(_0xdf3904[_0x3846('0x31')][_0x3846('0x3d')]){_0x2cc1f7[_0x3846('0x3b')]=_[_0x3846('0x3e')](_0x2cc1f7['where'],{'$or':_['map'](_0x191dd4,function(_0x34a30c){if(_0x34a30c[_0x3846('0x2e')]!==_0x3846('0x3f')){var _0x5c1c6b={};_0x5c1c6b[_0x34a30c[_0x3846('0x27')]]={'$like':'%'+_0xdf3904['query'][_0x3846('0x3d')]+'%'};return _0x5c1c6b;}})});}_0x2cc1f7=_[_0x3846('0x3e')]({},_0x2cc1f7,_0xdf3904[_0x3846('0x40')]);var _0x21dff4={'where':_0x2cc1f7[_0x3846('0x3b')]};return db[_0x3846('0x2b')][_0x3846('0x1c')](_0x21dff4)[_0x3846('0x23')](function(_0x2af346){_0x1b1990[_0x3846('0x1c')]=_0x2af346;if(_0xdf3904['query'][_0x3846('0x41')]){_0x2cc1f7['include']=[{'all':!![]}];}return db[_0x3846('0x2b')][_0x3846('0x42')](_0x2cc1f7);})[_0x3846('0x23')](function(_0x26a101){_0x1b1990[_0x3846('0x43')]=_0x26a101;return _0x1b1990;})[_0x3846('0x23')](respondWithFilteredResult(_0xc95270,_0x2cc1f7))[_0x3846('0x44')](handleError(_0xc95270,null));};exports['show']=function(_0x111faf,_0x46d03a){var _0x31bce4={'raw':!![],'where':{'id':_0x111faf[_0x3846('0x45')]['id']}},_0x11a9bc={};_0x11a9bc[_0x3846('0x30')]=_['keys'](db[_0x3846('0x2b')][_0x3846('0x2c')]);_0x11a9bc[_0x3846('0x31')]=_[_0x3846('0x32')](_0x111faf['query']);_0x11a9bc['filters']=_[_0x3846('0x33')](_0x11a9bc[_0x3846('0x30')],_0x11a9bc[_0x3846('0x31')]);_0x31bce4[_0x3846('0x34')]=_[_0x3846('0x33')](_0x11a9bc[_0x3846('0x30')],qs['fields'](_0x111faf[_0x3846('0x31')][_0x3846('0x35')]));_0x31bce4['attributes']=_0x31bce4['attributes'][_0x3846('0x36')]?_0x31bce4[_0x3846('0x34')]:_0x11a9bc['model'];if(_0x111faf[_0x3846('0x31')][_0x3846('0x41')]){_0x31bce4[_0x3846('0x46')]=[{'all':!![]}];}_0x31bce4=_[_0x3846('0x3e')]({},_0x31bce4,_0x111faf[_0x3846('0x40')]);return db[_0x3846('0x2b')][_0x3846('0x47')](_0x31bce4)['then'](handleEntityNotFound(_0x46d03a,null))[_0x3846('0x23')](respondWithResult(_0x46d03a,null))[_0x3846('0x44')](handleError(_0x46d03a,null));};exports[_0x3846('0x48')]=function(_0x330d7e,_0x95d44d){return db[_0x3846('0x2b')][_0x3846('0x48')](_0x330d7e[_0x3846('0x49')],{})[_0x3846('0x23')](respondWithResult(_0x95d44d,0xc9))['catch'](handleError(_0x95d44d,null));};exports['update']=function(_0x59fd2e,_0x386704){if(_0x59fd2e[_0x3846('0x49')]['id']){delete _0x59fd2e[_0x3846('0x49')]['id'];}return db[_0x3846('0x2b')][_0x3846('0x47')]({'where':{'id':_0x59fd2e[_0x3846('0x45')]['id']}})['then'](handleEntityNotFound(_0x386704,null))[_0x3846('0x23')](saveUpdates(_0x59fd2e['body'],null))[_0x3846('0x23')](respondWithResult(_0x386704,null))['catch'](handleError(_0x386704,null));};exports[_0x3846('0x4a')]=function(_0x4596fd,_0x113184,_0x4f627b){var _0x2054ad=require(_0x3846('0x4b'));var _0x31f1e6=![];var _0x54f89c={};if(_0x4596fd[_0x3846('0x31')]['type']&&_0x4596fd[_0x3846('0x31')][_0x3846('0x2e')]===_0x3846('0x4c')){_0x54f89c[_0x3846('0x4c')]=_0x4596fd[_0x3846('0x45')]['id'];}else{_0x54f89c['id']=_0x4596fd[_0x3846('0x45')]['id'];}return db[_0x3846('0x2b')][_0x3846('0x47')]({'where':_0x54f89c,'attributes':['id',_0x3846('0x4d'),_0x3846('0x4e')],'raw':!![]})[_0x3846('0x23')](handleEntityNotFound(_0x113184,null))[_0x3846('0x23')](function(_0x160ed5){if(_0x160ed5){var _0x5c8e25=_0x160ed5[_0x3846('0x4d')];var _0x331576=util[_0x3846('0x4f')](_0x3846('0x50'),_0x5c8e25);if(fs[_0x3846('0x51')](_0x331576)){_0x31f1e6=!![];return _0x2054ad['decryptFile'](_0x331576,_0x5c8e25,config[_0x3846('0x52')]['recording'])[_0x3846('0x23')](function(){return _0x160ed5;});}return _0x160ed5;}})['then'](function(_0xefb99){if(_0xefb99){var _0x325d67=_0xefb99[_0x3846('0x4d')];if(!fs[_0x3846('0x51')](_0x325d67)){throw new db['Sequelize'][(_0x3846('0x53'))]('SquareRecording\x20not\x20found');}if(_0xefb99['filename']){return _0x113184[_0x3846('0x4a')](_0x325d67,_0xefb99['filename']+path[_0x3846('0x54')](_0x325d67),function(){if(_0x31f1e6){fs[_0x3846('0x55')](_0x325d67);}});}else{return _0x113184['download'](_0x325d67,function(_0x4addd7){if(_0x31f1e6){fs[_0x3846('0x55')](_0x325d67);}});}}})[_0x3846('0x44')](function(_0x3cd712){if(_0x3cd712[_0x3846('0x56')]==='SquareRecording\x20not\x20found'){_0x113184['status'](0x194)[_0x3846('0x28')](_0x3846('0x57'));}else{return handleError(_0x113184,null);}});};exports[_0x3846('0x24')]=function(_0x1db890,_0x489444){return db['SquareRecording'][_0x3846('0x47')]({'where':{'id':_0x1db890[_0x3846('0x45')]['id']}})[_0x3846('0x23')](function(_0x45de05){if(_[_0x3846('0x58')](_0x45de05)){throw new ReferenceError('Entity\x20not\x20found');}return _0x45de05;})[_0x3846('0x23')](function(_0x44e0ca){var _0x42e59c=_0x44e0ca[_0x3846('0x4d')];logger[_0x3846('0x59')](_0x3846('0x5a'),_0x42e59c);if(!_[_0x3846('0x58')](_0x44e0ca[_0x3846('0x4d')])&&fs[_0x3846('0x51')](_0x42e59c)){logger['info'](_0x3846('0x5b')+_0x42e59c+_0x3846('0x5c'));fs[_0x3846('0x5d')](_0x42e59c);}_0x42e59c=_0x42e59c+_0x3846('0x5e');if(!_[_0x3846('0x58')](_0x44e0ca[_0x3846('0x4d')])&&fs[_0x3846('0x51')](_0x42e59c)){logger['info']('File:\x20\x22'+_0x42e59c+_0x3846('0x5c'));fs[_0x3846('0x5d')](_0x42e59c);}return _0x44e0ca;})[_0x3846('0x23')](function(_0x53709e){if(!_0x53709e)throw new InternalError();return _0x53709e[_0x3846('0x24')]();})['then'](function(){_0x489444[_0x3846('0x18')](0xcc)[_0x3846('0x17')]();})[_0x3846('0x44')](handleError(_0x489444,null));}; \ No newline at end of file +var _0x1034=['Entity\x20not\x20found','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','File:\x20\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','status','Content-Range','apply','reject','save','update','then','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','SquareRecording','count','includeAll','include','findAll','rows','catch','show','create','body','find','download','../../components/encryptor','uniqueid','params','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','SquareRecording\x20not\x20found','unlink','message','Not\x20found','destroy','isNil'];(function(_0x2b1fa9,_0x2e6a4b){var _0x405640=function(_0x4c60cf){while(--_0x4c60cf){_0x2b1fa9['push'](_0x2b1fa9['shift']());}};_0x405640(++_0x2e6a4b);}(_0x1034,0x195));var _0x4103=function(_0x4d5e34,_0x18f0cd){_0x4d5e34=_0x4d5e34-0x0;var _0x9fda32=_0x1034[_0x4d5e34];return _0x9fda32;};'use strict';var emlformat=require(_0x4103('0x0'));var rimraf=require(_0x4103('0x1'));var zipdir=require(_0x4103('0x2'));var jsonpatch=require(_0x4103('0x3'));var rp=require(_0x4103('0x4'));var moment=require('moment');var BPromise=require(_0x4103('0x5'));var Mustache=require(_0x4103('0x6'));var util=require(_0x4103('0x7'));var path=require(_0x4103('0x8'));var sox=require(_0x4103('0x9'));var csv=require('to-csv');var ejs=require(_0x4103('0xa'));var fs=require('fs');var fs_extra=require(_0x4103('0xb'));var _=require(_0x4103('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4103('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4103('0xe'));var Papa=require(_0x4103('0xf'));var Redis=require(_0x4103('0x10'));var authService=require(_0x4103('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4103('0x12'));var hardwareService=require(_0x4103('0x13'));var logger=require(_0x4103('0x14'))(_0x4103('0x15'));var utils=require('../../config/utils');var config=require(_0x4103('0x16'));var licenseUtil=require(_0x4103('0x17'));var db=require(_0x4103('0x18'))['db'];function respondWithStatusCode(_0x245caf,_0x255850){_0x255850=_0x255850||0xcc;return function(_0x46d8ba){if(_0x46d8ba){return _0x245caf[_0x4103('0x19')](_0x255850);}return _0x245caf['status'](_0x255850)[_0x4103('0x1a')]();};}function respondWithResult(_0x5e5caf,_0x521f4c){_0x521f4c=_0x521f4c||0xc8;return function(_0x19b85c){if(_0x19b85c){return _0x5e5caf['status'](_0x521f4c)[_0x4103('0x1b')](_0x19b85c);}};}function respondWithFilteredResult(_0x22d26c,_0x533fbf){return function(_0x134b79){if(_0x134b79){var _0x2ed76c=typeof _0x533fbf[_0x4103('0x1c')]===_0x4103('0x1d')&&typeof _0x533fbf[_0x4103('0x1e')]===_0x4103('0x1d');var _0x2a8e4e=_0x134b79['count'];var _0x3f9fd4=_0x2ed76c?0x0:_0x533fbf[_0x4103('0x1c')];var _0x636445=_0x2ed76c?_0x134b79['count']:_0x533fbf[_0x4103('0x1c')]+_0x533fbf[_0x4103('0x1e')];var _0xb32fd5;if(_0x636445>=_0x2a8e4e){_0x636445=_0x2a8e4e;_0xb32fd5=0xc8;}else{_0xb32fd5=0xce;}_0x22d26c[_0x4103('0x1f')](_0xb32fd5);return _0x22d26c['set'](_0x4103('0x20'),_0x3f9fd4+'-'+_0x636445+'/'+_0x2a8e4e)[_0x4103('0x1b')](_0x134b79);}return null;};}function patchUpdates(_0x456b9b){return function(_0x2a148b){try{jsonpatch[_0x4103('0x21')](_0x2a148b,_0x456b9b,!![]);}catch(_0x35f995){return BPromise[_0x4103('0x22')](_0x35f995);}return _0x2a148b[_0x4103('0x23')]();};}function saveUpdates(_0x5a99d8,_0x121fe1){return function(_0x599632){if(_0x599632){return _0x599632[_0x4103('0x24')](_0x5a99d8)[_0x4103('0x25')](function(_0x62c918){return _0x62c918;});}return null;};}function removeEntity(_0x3b02b9,_0x33c37a){return function(_0x34a551){if(_0x34a551){return _0x34a551['destroy']()[_0x4103('0x25')](function(){_0x3b02b9[_0x4103('0x1f')](0xcc)[_0x4103('0x1a')]();});}};}function handleEntityNotFound(_0x37de71,_0x4d2fe9){return function(_0x2726cb){if(!_0x2726cb){_0x37de71[_0x4103('0x19')](0x194);}return _0x2726cb;};}function handleError(_0xacfd4e,_0x350e87){_0x350e87=_0x350e87||0x1f4;return function(_0x6c0c97){logger[_0x4103('0x26')](_0x6c0c97[_0x4103('0x27')]);if(_0x6c0c97['name']){delete _0x6c0c97[_0x4103('0x28')];}_0xacfd4e[_0x4103('0x1f')](_0x350e87)['send'](_0x6c0c97);};}exports[_0x4103('0x29')]=function(_0x2a7640,_0x19f328){var _0xde757={},_0x4fc572={},_0x39a6d7={'count':0x0,'rows':[]};var _0x4043f1=_['map'](db['SquareRecording'][_0x4103('0x2a')],function(_0x517fcd){return{'name':_0x517fcd[_0x4103('0x2b')],'type':_0x517fcd[_0x4103('0x2c')][_0x4103('0x2d')]};});_0x4fc572[_0x4103('0x2e')]=_[_0x4103('0x2f')](_0x4043f1,_0x4103('0x28'));_0x4fc572[_0x4103('0x30')]=_[_0x4103('0x31')](_0x2a7640[_0x4103('0x30')]);_0x4fc572[_0x4103('0x32')]=_[_0x4103('0x33')](_0x4fc572[_0x4103('0x2e')],_0x4fc572[_0x4103('0x30')]);_0xde757['attributes']=_[_0x4103('0x33')](_0x4fc572['model'],qs[_0x4103('0x34')](_0x2a7640['query'][_0x4103('0x34')]));_0xde757['attributes']=_0xde757[_0x4103('0x35')][_0x4103('0x36')]?_0xde757[_0x4103('0x35')]:_0x4fc572['model'];if(!_0x2a7640['query'][_0x4103('0x37')](_0x4103('0x38'))){_0xde757['limit']=qs[_0x4103('0x1e')](_0x2a7640[_0x4103('0x30')]['limit']);_0xde757[_0x4103('0x1c')]=qs[_0x4103('0x1c')](_0x2a7640['query'][_0x4103('0x1c')]);}_0xde757[_0x4103('0x39')]=qs[_0x4103('0x3a')](_0x2a7640['query']['sort']);_0xde757[_0x4103('0x3b')]=qs[_0x4103('0x32')](_[_0x4103('0x3c')](_0x2a7640[_0x4103('0x30')],_0x4fc572[_0x4103('0x32')]),_0x4043f1);if(_0x2a7640[_0x4103('0x30')]['filter']){_0xde757['where']=_[_0x4103('0x3d')](_0xde757[_0x4103('0x3b')],{'$or':_['map'](_0x4043f1,function(_0x49a8fd){if(_0x49a8fd[_0x4103('0x2c')]!==_0x4103('0x3e')){var _0x1c1756={};_0x1c1756[_0x49a8fd['name']]={'$like':'%'+_0x2a7640[_0x4103('0x30')][_0x4103('0x3f')]+'%'};return _0x1c1756;}})});}_0xde757=_[_0x4103('0x3d')]({},_0xde757,_0x2a7640[_0x4103('0x40')]);var _0x16ec0a={'where':_0xde757[_0x4103('0x3b')]};return db[_0x4103('0x41')][_0x4103('0x42')](_0x16ec0a)['then'](function(_0x32045c){_0x39a6d7['count']=_0x32045c;if(_0x2a7640[_0x4103('0x30')][_0x4103('0x43')]){_0xde757[_0x4103('0x44')]=[{'all':!![]}];}return db[_0x4103('0x41')][_0x4103('0x45')](_0xde757);})[_0x4103('0x25')](function(_0x55bffb){_0x39a6d7[_0x4103('0x46')]=_0x55bffb;return _0x39a6d7;})[_0x4103('0x25')](respondWithFilteredResult(_0x19f328,_0xde757))[_0x4103('0x47')](handleError(_0x19f328,null));};exports[_0x4103('0x48')]=function(_0x3bd7da,_0x4fbce8){var _0x3d45ac={'raw':!![],'where':{'id':_0x3bd7da['params']['id']}},_0x37e5da={};_0x37e5da[_0x4103('0x2e')]=_[_0x4103('0x31')](db[_0x4103('0x41')]['rawAttributes']);_0x37e5da[_0x4103('0x30')]=_[_0x4103('0x31')](_0x3bd7da[_0x4103('0x30')]);_0x37e5da[_0x4103('0x32')]=_[_0x4103('0x33')](_0x37e5da[_0x4103('0x2e')],_0x37e5da[_0x4103('0x30')]);_0x3d45ac['attributes']=_[_0x4103('0x33')](_0x37e5da[_0x4103('0x2e')],qs[_0x4103('0x34')](_0x3bd7da[_0x4103('0x30')][_0x4103('0x34')]));_0x3d45ac['attributes']=_0x3d45ac[_0x4103('0x35')][_0x4103('0x36')]?_0x3d45ac[_0x4103('0x35')]:_0x37e5da[_0x4103('0x2e')];if(_0x3bd7da[_0x4103('0x30')][_0x4103('0x43')]){_0x3d45ac['include']=[{'all':!![]}];}_0x3d45ac=_[_0x4103('0x3d')]({},_0x3d45ac,_0x3bd7da[_0x4103('0x40')]);return db[_0x4103('0x41')]['find'](_0x3d45ac)[_0x4103('0x25')](handleEntityNotFound(_0x4fbce8,null))[_0x4103('0x25')](respondWithResult(_0x4fbce8,null))[_0x4103('0x47')](handleError(_0x4fbce8,null));};exports['create']=function(_0x4d2584,_0x4da2b9){return db[_0x4103('0x41')][_0x4103('0x49')](_0x4d2584[_0x4103('0x4a')],{})[_0x4103('0x25')](respondWithResult(_0x4da2b9,0xc9))['catch'](handleError(_0x4da2b9,null));};exports[_0x4103('0x24')]=function(_0x2a8a7b,_0x421fb1){if(_0x2a8a7b[_0x4103('0x4a')]['id']){delete _0x2a8a7b[_0x4103('0x4a')]['id'];}return db[_0x4103('0x41')][_0x4103('0x4b')]({'where':{'id':_0x2a8a7b['params']['id']}})[_0x4103('0x25')](handleEntityNotFound(_0x421fb1,null))[_0x4103('0x25')](saveUpdates(_0x2a8a7b[_0x4103('0x4a')],null))[_0x4103('0x25')](respondWithResult(_0x421fb1,null))[_0x4103('0x47')](handleError(_0x421fb1,null));};exports[_0x4103('0x4c')]=function(_0x4fd6eb,_0x13e957,_0x162c17){var _0x3129d0=require(_0x4103('0x4d'));var _0x36d742=![];var _0x206143={};if(_0x4fd6eb[_0x4103('0x30')]['type']&&_0x4fd6eb['query'][_0x4103('0x2c')]===_0x4103('0x4e')){_0x206143[_0x4103('0x4e')]=_0x4fd6eb[_0x4103('0x4f')]['id'];}else{_0x206143['id']=_0x4fd6eb[_0x4103('0x4f')]['id'];}return db[_0x4103('0x41')][_0x4103('0x4b')]({'where':_0x206143,'attributes':['id',_0x4103('0x50'),_0x4103('0x51')],'raw':!![]})[_0x4103('0x25')](handleEntityNotFound(_0x13e957,null))[_0x4103('0x25')](function(_0x29836e){if(_0x29836e){var _0x14c51e=_0x29836e[_0x4103('0x50')];var _0x7ae6a2=util[_0x4103('0x52')](_0x4103('0x53'),_0x14c51e);if(fs[_0x4103('0x54')](_0x7ae6a2)){_0x36d742=!![];return _0x3129d0[_0x4103('0x55')](_0x7ae6a2,_0x14c51e,config[_0x4103('0x56')][_0x4103('0x57')])[_0x4103('0x25')](function(){return _0x29836e;});}return _0x29836e;}})[_0x4103('0x25')](function(_0x3b2ccb){if(_0x3b2ccb){var _0x3f9e6b=_0x3b2ccb['savePath'];if(!fs[_0x4103('0x54')](_0x3f9e6b)){throw new db['Sequelize'][(_0x4103('0x58'))](_0x4103('0x59'));}if(_0x3b2ccb[_0x4103('0x51')]){return _0x13e957[_0x4103('0x4c')](_0x3f9e6b,_0x3b2ccb['filename']+path['extname'](_0x3f9e6b),function(){if(_0x36d742){fs[_0x4103('0x5a')](_0x3f9e6b);}});}else{return _0x13e957[_0x4103('0x4c')](_0x3f9e6b,function(_0x14729f){if(_0x36d742){fs[_0x4103('0x5a')](_0x3f9e6b);}});}}})['catch'](function(_0x583ee0){if(_0x583ee0[_0x4103('0x5b')]===_0x4103('0x59')){_0x13e957['status'](0x194)['send'](_0x4103('0x5c'));}else{return handleError(_0x13e957,null);}});};exports[_0x4103('0x5d')]=function(_0x45c657,_0x166032){return db['SquareRecording']['find']({'where':{'id':_0x45c657['params']['id']}})[_0x4103('0x25')](function(_0x38b084){if(_[_0x4103('0x5e')](_0x38b084)){throw new ReferenceError(_0x4103('0x5f'));}return _0x38b084;})['then'](function(_0x396812){var _0x2dc6e9=_0x396812[_0x4103('0x50')];logger[_0x4103('0x60')]('cancellazione\x20fisica\x20documento\x20%s',_0x2dc6e9);if(!_[_0x4103('0x5e')](_0x396812[_0x4103('0x50')])&&fs[_0x4103('0x54')](_0x2dc6e9)){logger[_0x4103('0x60')]('File:\x20\x22'+_0x2dc6e9+_0x4103('0x61'));fs[_0x4103('0x62')](_0x2dc6e9);}_0x2dc6e9=_0x2dc6e9+'.cypher';if(!_['isNil'](_0x396812[_0x4103('0x50')])&&fs[_0x4103('0x54')](_0x2dc6e9)){logger[_0x4103('0x60')](_0x4103('0x63')+_0x2dc6e9+_0x4103('0x61'));fs['unlinkSync'](_0x2dc6e9);}return _0x396812;})['then'](function(_0x1cb844){if(!_0x1cb844)throw new InternalError();return _0x1cb844[_0x4103('0x5d')]();})[_0x4103('0x25')](function(){_0x166032['status'](0xcc)[_0x4103('0x1a')]();})['catch'](handleError(_0x166032,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 5b6a4f4..5aeca8f 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 _0x6fad=['./squareRecording.attributes','define','SquareRecording','square_recordings','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x5634ef,_0x2fb526){var _0x385f64=function(_0x3b3dcd){while(--_0x3b3dcd){_0x5634ef['push'](_0x5634ef['shift']());}};_0x385f64(++_0x2fb526);}(_0x6fad,0x17a));var _0xd6fa=function(_0x35b7d4,_0x5a5c43){_0x35b7d4=_0x35b7d4-0x0;var _0x4e8cee=_0x6fad[_0x35b7d4];return _0x4e8cee;};'use strict';var _=require(_0xd6fa('0x0'));var util=require(_0xd6fa('0x1'));var logger=require(_0xd6fa('0x2'))(_0xd6fa('0x3'));var moment=require(_0xd6fa('0x4'));var BPromise=require('bluebird');var rp=require(_0xd6fa('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd6fa('0x6'));var config=require('../../config/environment');var attributes=require(_0xd6fa('0x7'));module['exports']=function(_0x37cb49,_0x2d73ee){return _0x37cb49[_0xd6fa('0x8')](_0xd6fa('0x9'),attributes,{'tableName':_0xd6fa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd943=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','square_recordings','lodash'];(function(_0x1c5a3c,_0x22f3ae){var _0x42b7ba=function(_0x3e717f){while(--_0x3e717f){_0x1c5a3c['push'](_0x1c5a3c['shift']());}};_0x42b7ba(++_0x22f3ae);}(_0xd943,0x15d));var _0x3d94=function(_0x46ef9d,_0x51d592){_0x46ef9d=_0x46ef9d-0x0;var _0x335131=_0xd943[_0x46ef9d];return _0x335131;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var logger=require(_0x3d94('0x2'))(_0x3d94('0x3'));var moment=require('moment');var BPromise=require(_0x3d94('0x4'));var rp=require(_0x3d94('0x5'));var fs=require('fs');var path=require(_0x3d94('0x6'));var rimraf=require(_0x3d94('0x7'));var config=require(_0x3d94('0x8'));var attributes=require('./squareRecording.attributes');module['exports']=function(_0x34c9c3,_0x51cf1f){return _0x34c9c3['define']('SquareRecording',attributes,{'tableName':_0x3d94('0x9'),'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 ef84c5d..f7480b4 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 _0xa441=['debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','create','options','raw','CreateSquareRecording','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent'];(function(_0x38e177,_0x59ec9f){var _0x1faf15=function(_0x4cf149){while(--_0x4cf149){_0x38e177['push'](_0x38e177['shift']());}};_0x1faf15(++_0x59ec9f);}(_0xa441,0x79));var _0x1a44=function(_0x500eb4,_0x40df4b){_0x500eb4=_0x500eb4-0x0;var _0xec668b=_0xa441[_0x500eb4];return _0xec668b;};'use strict';var _=require(_0x1a44('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1a44('0x1'));var rs=require(_0x1a44('0x2'));var fs=require('fs');var Redis=require(_0x1a44('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1a44('0x4'));var logger=require(_0x1a44('0x5'))(_0x1a44('0x6'));var config=require('../../config/environment');var jayson=require(_0x1a44('0x7'));var client=jayson[_0x1a44('0x8')][_0x1a44('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ab3a7,_0x3d324c,_0x2eccac){return new BPromise(function(_0x3aec35,_0x176085){return client[_0x1a44('0xa')](_0x4ab3a7,_0x2eccac)[_0x1a44('0xb')](function(_0x1a296f){logger['info'](_0x1a44('0xc'),_0x3d324c,_0x1a44('0xd'));logger[_0x1a44('0xe')](_0x1a44('0xf'),_0x3d324c,'request\x20sent',JSON[_0x1a44('0x10')](_0x1a296f));if(_0x1a296f[_0x1a44('0x11')]){if(_0x1a296f[_0x1a44('0x11')][_0x1a44('0x12')]===0x1f4){logger[_0x1a44('0x11')](_0x1a44('0xc'),_0x3d324c,_0x1a296f[_0x1a44('0x11')][_0x1a44('0x13')]);return _0x176085(_0x1a296f[_0x1a44('0x11')][_0x1a44('0x13')]);}logger[_0x1a44('0x11')](_0x1a44('0xc'),_0x3d324c,_0x1a296f[_0x1a44('0x11')][_0x1a44('0x13')]);return _0x3aec35(_0x1a296f[_0x1a44('0x11')][_0x1a44('0x13')]);}else{logger[_0x1a44('0x14')](_0x1a44('0xc'),_0x3d324c,'request\x20sent');_0x3aec35(_0x1a296f[_0x1a44('0x15')][_0x1a44('0x13')]);}})[_0x1a44('0x16')](function(_0x1f7fc8){logger[_0x1a44('0x11')](_0x1a44('0xc'),_0x3d324c,_0x1f7fc8);_0x176085(_0x1f7fc8);});});}exports['CreateSquareRecording']=function(_0x5b7899){var _0x2169d8=this;return new Promise(function(_0x57d019,_0xeb47bd){return db['SquareRecording'][_0x1a44('0x17')](_0x5b7899['body'],{'raw':_0x5b7899['options']?_0x5b7899[_0x1a44('0x18')][_0x1a44('0x19')]===undefined?!![]:![]:!![]})[_0x1a44('0xb')](function(_0x3a773e){logger[_0x1a44('0x14')](_0x1a44('0x1a'),_0x5b7899);logger[_0x1a44('0xe')](_0x1a44('0x1a'),_0x5b7899,JSON['stringify'](_0x3a773e));_0x57d019(_0x3a773e);})[_0x1a44('0x16')](function(_0x52f6ed){logger[_0x1a44('0x11')](_0x1a44('0x1a'),_0x52f6ed['message'],_0x5b7899);_0xeb47bd(_0x2169d8['error'](0x1f4,_0x52f6ed[_0x1a44('0x13')]));});});}; \ No newline at end of file +var _0xba5a=['rpc','../../config/environment','jayson/promise','request','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','SquareRecording','create','body','options','raw','CreateSquareRecording','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xba5a,0x18e));var _0xaba5=function(_0xb99421,_0xaab133){_0xb99421=_0xb99421-0x0;var _0x4b3ec7=_0xba5a[_0xb99421];return _0x4b3ec7;};'use strict';var _=require(_0xaba5('0x0'));var util=require(_0xaba5('0x1'));var moment=require(_0xaba5('0x2'));var BPromise=require(_0xaba5('0x3'));var rs=require(_0xaba5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaba5('0x5'))['db'];var utils=require(_0xaba5('0x6'));var logger=require(_0xaba5('0x7'))(_0xaba5('0x8'));var config=require(_0xaba5('0x9'));var jayson=require(_0xaba5('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x324298,_0x5cc6f9,_0x2b0513){return new BPromise(function(_0x2b2fc0,_0x2bec6f){return client[_0xaba5('0xb')](_0x324298,_0x2b0513)['then'](function(_0xdedb7){logger[_0xaba5('0xc')](_0xaba5('0xd'),_0x5cc6f9,_0xaba5('0xe'));logger[_0xaba5('0xf')](_0xaba5('0x10'),_0x5cc6f9,_0xaba5('0xe'),JSON[_0xaba5('0x11')](_0xdedb7));if(_0xdedb7['error']){if(_0xdedb7['error'][_0xaba5('0x12')]===0x1f4){logger[_0xaba5('0x13')]('SquareRecording,\x20%s,\x20%s',_0x5cc6f9,_0xdedb7[_0xaba5('0x13')]['message']);return _0x2bec6f(_0xdedb7['error']['message']);}logger['error']('SquareRecording,\x20%s,\x20%s',_0x5cc6f9,_0xdedb7['error'][_0xaba5('0x14')]);return _0x2b2fc0(_0xdedb7['error'][_0xaba5('0x14')]);}else{logger[_0xaba5('0xc')](_0xaba5('0xd'),_0x5cc6f9,_0xaba5('0xe'));_0x2b2fc0(_0xdedb7[_0xaba5('0x15')][_0xaba5('0x14')]);}})[_0xaba5('0x16')](function(_0x51ed8c){logger[_0xaba5('0x13')]('SquareRecording,\x20%s,\x20%s',_0x5cc6f9,_0x51ed8c);_0x2bec6f(_0x51ed8c);});});}exports['CreateSquareRecording']=function(_0x362c5b){var _0x16a9b9=this;return new Promise(function(_0x2646a6,_0x2e4053){return db[_0xaba5('0x17')][_0xaba5('0x18')](_0x362c5b[_0xaba5('0x19')],{'raw':_0x362c5b[_0xaba5('0x1a')]?_0x362c5b[_0xaba5('0x1a')][_0xaba5('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x531fb2){logger[_0xaba5('0xc')]('CreateSquareRecording',_0x362c5b);logger[_0xaba5('0xf')](_0xaba5('0x1c'),_0x362c5b,JSON[_0xaba5('0x11')](_0x531fb2));_0x2646a6(_0x531fb2);})[_0xaba5('0x16')](function(_0x3e8f06){logger[_0xaba5('0x13')](_0xaba5('0x1c'),_0x3e8f06['message'],_0x362c5b);_0x2e4053(_0x16a9b9[_0xaba5('0x13')](0x1f4,_0x3e8f06[_0xaba5('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index fd44efa..a22079b 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(_0x2a84d6,_0x538497){var _0x55c2ea=function(_0x3f5d46){while(--_0x3f5d46){_0x2a84d6['push'](_0x2a84d6['shift']());}};_0x55c2ea(++_0x538497);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x6a66c7,_0x73e88c){var _0x24e1fa=function(_0xd584d4){while(--_0xd584d4){_0x6a66c7['push'](_0x6a66c7['shift']());}};_0x24e1fa(++_0x73e88c);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 5b776da..0e86022 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 _0x9679=['STRING','DATE','BOOLEAN','sequelize'];(function(_0x175374,_0x3c2440){var _0x4e1f61=function(_0x23e306){while(--_0x23e306){_0x175374['push'](_0x175374['shift']());}};_0x4e1f61(++_0x3c2440);}(_0x9679,0x15f));var _0x9967=function(_0x3688c2,_0x45adb5){_0x3688c2=_0x3688c2-0x0;var _0x27c78f=_0x9679[_0x3688c2];return _0x27c78f;};'use strict';var Sequelize=require(_0x9967('0x0'));module['exports']={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x9967('0x1')]},'request':{'type':Sequelize[_0x9967('0x1')]},'channel':{'type':Sequelize[_0x9967('0x1')]},'language':{'type':Sequelize[_0x9967('0x1')]},'type':{'type':Sequelize[_0x9967('0x1')]},'uniqueid':{'type':Sequelize[_0x9967('0x1')]},'version':{'type':Sequelize[_0x9967('0x1')]},'callerid':{'type':Sequelize[_0x9967('0x1')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x9967('0x1')]},'callingtns':{'type':Sequelize[_0x9967('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x9967('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x9967('0x1')]},'priority':{'type':Sequelize[_0x9967('0x1')]},'enhanced':{'type':Sequelize[_0x9967('0x1')]},'accountcode':{'type':Sequelize[_0x9967('0x1')]},'threadid':{'type':Sequelize[_0x9967('0x1')]},'project_name':{'type':Sequelize[_0x9967('0x1')]},'joinAt':{'type':Sequelize[_0x9967('0x2')]},'leaveAt':{'type':Sequelize[_0x9967('0x2')]},'bot':{'type':Sequelize[_0x9967('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x9ddb=['DATE','STRING'];(function(_0x2bd0ad,_0x1d5726){var _0x1966b3=function(_0x58bd74){while(--_0x58bd74){_0x2bd0ad['push'](_0x2bd0ad['shift']());}};_0x1966b3(++_0x1d5726);}(_0x9ddb,0x6b));var _0xb9dd=function(_0xc3ece0,_0x2e64c3){_0xc3ece0=_0xc3ece0-0x0;var _0x2f790e=_0x9ddb[_0xc3ece0];return _0x2f790e;};'use strict';var Sequelize=require('sequelize');module['exports']={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xb9dd('0x0')]},'request':{'type':Sequelize[_0xb9dd('0x0')]},'channel':{'type':Sequelize[_0xb9dd('0x0')]},'language':{'type':Sequelize[_0xb9dd('0x0')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xb9dd('0x0')]},'version':{'type':Sequelize[_0xb9dd('0x0')]},'callerid':{'type':Sequelize[_0xb9dd('0x0')]},'calleridname':{'type':Sequelize[_0xb9dd('0x0')]},'callingpres':{'type':Sequelize[_0xb9dd('0x0')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0xb9dd('0x0')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xb9dd('0x0')]},'rdnis':{'type':Sequelize[_0xb9dd('0x0')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xb9dd('0x0')]},'priority':{'type':Sequelize[_0xb9dd('0x0')]},'enhanced':{'type':Sequelize[_0xb9dd('0x0')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0xb9dd('0x0')]},'project_name':{'type':Sequelize[_0xb9dd('0x0')]},'joinAt':{'type':Sequelize[_0xb9dd('0x1')]},'leaveAt':{'type':Sequelize[_0xb9dd('0x1')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 96a0e99..25d6209 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 _0xfefd=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','SquareReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','length','include','catch','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x323f3f,_0x5603e0){var _0xe3f6e3=function(_0x170516){while(--_0x170516){_0x323f3f['push'](_0x323f3f['shift']());}};_0xe3f6e3(++_0x5603e0);}(_0xfefd,0x157));var _0xdfef=function(_0x3dea7d,_0x2cd4ea){_0x3dea7d=_0x3dea7d-0x0;var _0x53919a=_0xfefd[_0x3dea7d];return _0x53919a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdfef('0x0'));var zipdir=require(_0xdfef('0x1'));var jsonpatch=require(_0xdfef('0x2'));var rp=require(_0xdfef('0x3'));var moment=require(_0xdfef('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdfef('0x5'));var util=require(_0xdfef('0x6'));var path=require(_0xdfef('0x7'));var sox=require('sox');var csv=require(_0xdfef('0x8'));var ejs=require(_0xdfef('0x9'));var fs=require('fs');var fs_extra=require(_0xdfef('0xa'));var _=require(_0xdfef('0xb'));var squel=require(_0xdfef('0xc'));var crypto=require(_0xdfef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xdfef('0xe'));var toCsv=require(_0xdfef('0x8'));var querystring=require(_0xdfef('0xf'));var Papa=require('papaparse');var Redis=require(_0xdfef('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xdfef('0x11'));var as=require(_0xdfef('0x12'));var hardwareService=require(_0xdfef('0x13'));var logger=require(_0xdfef('0x14'))(_0xdfef('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xdfef('0x16'));var db=require(_0xdfef('0x17'))['db'];function respondWithStatusCode(_0x1ee879,_0x3f1379){_0x3f1379=_0x3f1379||0xcc;return function(_0x3e8eb2){if(_0x3e8eb2){return _0x1ee879[_0xdfef('0x18')](_0x3f1379);}return _0x1ee879[_0xdfef('0x19')](_0x3f1379)[_0xdfef('0x1a')]();};}function respondWithResult(_0x16d3fe,_0x182a63){_0x182a63=_0x182a63||0xc8;return function(_0x52a7c3){if(_0x52a7c3){return _0x16d3fe[_0xdfef('0x19')](_0x182a63)[_0xdfef('0x1b')](_0x52a7c3);}};}function respondWithFilteredResult(_0x22af2e,_0x156138){return function(_0x3ff9ec){if(_0x3ff9ec){var _0x1a2835=typeof _0x156138[_0xdfef('0x1c')]===_0xdfef('0x1d')&&typeof _0x156138[_0xdfef('0x1e')]===_0xdfef('0x1d');var _0x22414e=_0x3ff9ec[_0xdfef('0x1f')];var _0x59c077=_0x1a2835?0x0:_0x156138[_0xdfef('0x1c')];var _0x379993=_0x1a2835?_0x3ff9ec[_0xdfef('0x1f')]:_0x156138[_0xdfef('0x1c')]+_0x156138[_0xdfef('0x1e')];var _0x194bfc;if(_0x379993>=_0x22414e){_0x379993=_0x22414e;_0x194bfc=0xc8;}else{_0x194bfc=0xce;}_0x22af2e['status'](_0x194bfc);return _0x22af2e[_0xdfef('0x20')](_0xdfef('0x21'),_0x59c077+'-'+_0x379993+'/'+_0x22414e)['json'](_0x3ff9ec);}return null;};}function patchUpdates(_0x9e2547){return function(_0x448b5a){try{jsonpatch[_0xdfef('0x22')](_0x448b5a,_0x9e2547,!![]);}catch(_0x1748fd){return BPromise[_0xdfef('0x23')](_0x1748fd);}return _0x448b5a[_0xdfef('0x24')]();};}function saveUpdates(_0x57de8b,_0x1f249b){return function(_0x3bd89d){if(_0x3bd89d){return _0x3bd89d[_0xdfef('0x25')](_0x57de8b)[_0xdfef('0x26')](function(_0x55898f){return _0x55898f;});}return null;};}function removeEntity(_0x4f619c,_0x594280){return function(_0x30942b){if(_0x30942b){return _0x30942b[_0xdfef('0x27')]()[_0xdfef('0x26')](function(){_0x4f619c['status'](0xcc)[_0xdfef('0x1a')]();});}};}function handleEntityNotFound(_0x22dc76,_0x558909){return function(_0x46803a){if(!_0x46803a){_0x22dc76[_0xdfef('0x18')](0x194);}return _0x46803a;};}function handleError(_0x2b3f91,_0x389f2d){_0x389f2d=_0x389f2d||0x1f4;return function(_0x3edd96){logger[_0xdfef('0x28')](_0x3edd96[_0xdfef('0x29')]);if(_0x3edd96[_0xdfef('0x2a')]){delete _0x3edd96['name'];}_0x2b3f91['status'](_0x389f2d)['send'](_0x3edd96);};}exports['index']=function(_0x4b4b1a,_0x5c014e){var _0x2c15a3={},_0x6bbd82={},_0x397229={'count':0x0,'rows':[]};var _0x9aa7c2=_[_0xdfef('0x2b')](db[_0xdfef('0x2c')][_0xdfef('0x2d')],function(_0x4d99b2){return{'name':_0x4d99b2[_0xdfef('0x2e')],'type':_0x4d99b2[_0xdfef('0x2f')][_0xdfef('0x30')]};});_0x6bbd82[_0xdfef('0x31')]=_['map'](_0x9aa7c2,_0xdfef('0x2a'));_0x6bbd82[_0xdfef('0x32')]=_[_0xdfef('0x33')](_0x4b4b1a['query']);_0x6bbd82[_0xdfef('0x34')]=_[_0xdfef('0x35')](_0x6bbd82[_0xdfef('0x31')],_0x6bbd82[_0xdfef('0x32')]);_0x2c15a3[_0xdfef('0x36')]=_[_0xdfef('0x35')](_0x6bbd82[_0xdfef('0x31')],qs[_0xdfef('0x37')](_0x4b4b1a[_0xdfef('0x32')][_0xdfef('0x37')]));_0x2c15a3[_0xdfef('0x36')]=_0x2c15a3[_0xdfef('0x36')]['length']?_0x2c15a3['attributes']:_0x6bbd82['model'];if(!_0x4b4b1a['query']['hasOwnProperty']('nolimit')){_0x2c15a3[_0xdfef('0x1e')]=qs[_0xdfef('0x1e')](_0x4b4b1a[_0xdfef('0x32')][_0xdfef('0x1e')]);_0x2c15a3['offset']=qs[_0xdfef('0x1c')](_0x4b4b1a[_0xdfef('0x32')][_0xdfef('0x1c')]);}_0x2c15a3[_0xdfef('0x38')]=qs[_0xdfef('0x39')](_0x4b4b1a[_0xdfef('0x32')][_0xdfef('0x39')]);_0x2c15a3[_0xdfef('0x3a')]=qs[_0xdfef('0x34')](_['pick'](_0x4b4b1a[_0xdfef('0x32')],_0x6bbd82[_0xdfef('0x34')]),_0x9aa7c2);if(_0x4b4b1a[_0xdfef('0x32')][_0xdfef('0x3b')]){_0x2c15a3[_0xdfef('0x3a')]=_[_0xdfef('0x3c')](_0x2c15a3['where'],{'$or':_[_0xdfef('0x2b')](_0x9aa7c2,function(_0x2c168f){if(_0x2c168f[_0xdfef('0x2f')]!==_0xdfef('0x3d')){var _0x16fa8f={};_0x16fa8f[_0x2c168f['name']]={'$like':'%'+_0x4b4b1a[_0xdfef('0x32')][_0xdfef('0x3b')]+'%'};return _0x16fa8f;}})});}_0x2c15a3=_[_0xdfef('0x3c')]({},_0x2c15a3,_0x4b4b1a[_0xdfef('0x3e')]);var _0x4197fa={'where':_0x2c15a3['where']};return db['SquareReport']['count'](_0x4197fa)['then'](function(_0x4568d8){_0x397229['count']=_0x4568d8;if(_0x4b4b1a[_0xdfef('0x32')][_0xdfef('0x3f')]){_0x2c15a3['include']=[{'all':!![]}];}return db[_0xdfef('0x2c')][_0xdfef('0x40')](_0x2c15a3);})['then'](function(_0x4eec8b){_0x397229[_0xdfef('0x41')]=_0x4eec8b;return _0x397229;})[_0xdfef('0x26')](respondWithFilteredResult(_0x5c014e,_0x2c15a3))['catch'](handleError(_0x5c014e,null));};exports['show']=function(_0x3a32e3,_0x572ba3){var _0xcfa4aa={'raw':!![],'where':{'id':_0x3a32e3[_0xdfef('0x42')]['id']}},_0x5489e7={};_0x5489e7[_0xdfef('0x31')]=_['keys'](db[_0xdfef('0x2c')][_0xdfef('0x2d')]);_0x5489e7['query']=_['keys'](_0x3a32e3['query']);_0x5489e7['filters']=_[_0xdfef('0x35')](_0x5489e7[_0xdfef('0x31')],_0x5489e7[_0xdfef('0x32')]);_0xcfa4aa[_0xdfef('0x36')]=_['intersection'](_0x5489e7['model'],qs[_0xdfef('0x37')](_0x3a32e3[_0xdfef('0x32')][_0xdfef('0x37')]));_0xcfa4aa[_0xdfef('0x36')]=_0xcfa4aa[_0xdfef('0x36')][_0xdfef('0x43')]?_0xcfa4aa['attributes']:_0x5489e7[_0xdfef('0x31')];if(_0x3a32e3[_0xdfef('0x32')]['includeAll']){_0xcfa4aa[_0xdfef('0x44')]=[{'all':!![]}];}_0xcfa4aa=_[_0xdfef('0x3c')]({},_0xcfa4aa,_0x3a32e3[_0xdfef('0x3e')]);return db[_0xdfef('0x2c')]['find'](_0xcfa4aa)[_0xdfef('0x26')](handleEntityNotFound(_0x572ba3,null))['then'](respondWithResult(_0x572ba3,null))[_0xdfef('0x45')](handleError(_0x572ba3,null));};exports['create']=function(_0x45aab5,_0x224fa1){return db[_0xdfef('0x2c')]['create'](_0x45aab5[_0xdfef('0x46')],{})[_0xdfef('0x26')](respondWithResult(_0x224fa1,0xc9))[_0xdfef('0x45')](handleError(_0x224fa1,null));};exports[_0xdfef('0x25')]=function(_0x2e01da,_0x36eb81){if(_0x2e01da[_0xdfef('0x46')]['id']){delete _0x2e01da[_0xdfef('0x46')]['id'];}return db['SquareReport']['find']({'where':{'id':_0x2e01da[_0xdfef('0x42')]['id']}})[_0xdfef('0x26')](handleEntityNotFound(_0x36eb81,null))['then'](saveUpdates(_0x2e01da[_0xdfef('0x46')],null))['then'](respondWithResult(_0x36eb81,null))[_0xdfef('0x45')](handleError(_0x36eb81,null));};exports[_0xdfef('0x27')]=function(_0xd93d00,_0x13088f){return db[_0xdfef('0x2c')][_0xdfef('0x47')]({'where':{'id':_0xd93d00[_0xdfef('0x42')]['id']}})[_0xdfef('0x26')](handleEntityNotFound(_0x13088f,null))[_0xdfef('0x26')](removeEntity(_0x13088f,null))['catch'](handleError(_0x13088f,null));};exports[_0xdfef('0x48')]=function(_0x86db57,_0x7dc0ce){return db['SquareReport'][_0xdfef('0x48')]()[_0xdfef('0x26')](respondWithResult(_0x7dc0ce,null))['catch'](handleError(_0x7dc0ce,null));}; \ No newline at end of file +var _0x7cd6=['model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','params','options','create','update','body','find','describe','eml-format','rimraf','request-promise','moment','bluebird','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/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','reject','save','then','destroy','sendStatus','name','send','SquareReport','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection'];(function(_0xe8668f,_0x42446c){var _0xf3d4ff=function(_0x5447d6){while(--_0x5447d6){_0xe8668f['push'](_0xe8668f['shift']());}};_0xf3d4ff(++_0x42446c);}(_0x7cd6,0x194));var _0x67cd=function(_0x51400d,_0xe4ae5c){_0x51400d=_0x51400d-0x0;var _0x69b352=_0x7cd6[_0x51400d];return _0x69b352;};'use strict';var emlformat=require(_0x67cd('0x0'));var rimraf=require(_0x67cd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x67cd('0x2'));var moment=require(_0x67cd('0x3'));var BPromise=require(_0x67cd('0x4'));var Mustache=require('mustache');var util=require(_0x67cd('0x5'));var path=require('path');var sox=require(_0x67cd('0x6'));var csv=require(_0x67cd('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x67cd('0x8'));var _=require(_0x67cd('0x9'));var squel=require(_0x67cd('0xa'));var crypto=require(_0x67cd('0xb'));var jsforce=require(_0x67cd('0xc'));var deskjs=require(_0x67cd('0xd'));var toCsv=require(_0x67cd('0x7'));var querystring=require(_0x67cd('0xe'));var Papa=require(_0x67cd('0xf'));var Redis=require(_0x67cd('0x10'));var authService=require(_0x67cd('0x11'));var qs=require(_0x67cd('0x12'));var as=require(_0x67cd('0x13'));var hardwareService=require(_0x67cd('0x14'));var logger=require(_0x67cd('0x15'))(_0x67cd('0x16'));var utils=require(_0x67cd('0x17'));var config=require(_0x67cd('0x18'));var licenseUtil=require(_0x67cd('0x19'));var db=require(_0x67cd('0x1a'))['db'];function respondWithStatusCode(_0x1da85f,_0x57bcbb){_0x57bcbb=_0x57bcbb||0xcc;return function(_0x1c30e5){if(_0x1c30e5){return _0x1da85f['sendStatus'](_0x57bcbb);}return _0x1da85f[_0x67cd('0x1b')](_0x57bcbb)[_0x67cd('0x1c')]();};}function respondWithResult(_0x4879c1,_0x4baefd){_0x4baefd=_0x4baefd||0xc8;return function(_0x2707f9){if(_0x2707f9){return _0x4879c1['status'](_0x4baefd)[_0x67cd('0x1d')](_0x2707f9);}};}function respondWithFilteredResult(_0x58cffd,_0x2892e9){return function(_0x8bcffa){if(_0x8bcffa){var _0x356daa=typeof _0x2892e9[_0x67cd('0x1e')]===_0x67cd('0x1f')&&typeof _0x2892e9[_0x67cd('0x20')]===_0x67cd('0x1f');var _0x31e4f5=_0x8bcffa[_0x67cd('0x21')];var _0xa1b8fa=_0x356daa?0x0:_0x2892e9['offset'];var _0x29d801=_0x356daa?_0x8bcffa[_0x67cd('0x21')]:_0x2892e9['offset']+_0x2892e9[_0x67cd('0x20')];var _0x14fc11;if(_0x29d801>=_0x31e4f5){_0x29d801=_0x31e4f5;_0x14fc11=0xc8;}else{_0x14fc11=0xce;}_0x58cffd[_0x67cd('0x1b')](_0x14fc11);return _0x58cffd[_0x67cd('0x22')]('Content-Range',_0xa1b8fa+'-'+_0x29d801+'/'+_0x31e4f5)[_0x67cd('0x1d')](_0x8bcffa);}return null;};}function patchUpdates(_0x1ade8d){return function(_0x5242f4){try{jsonpatch['apply'](_0x5242f4,_0x1ade8d,!![]);}catch(_0x3c90e9){return BPromise[_0x67cd('0x23')](_0x3c90e9);}return _0x5242f4[_0x67cd('0x24')]();};}function saveUpdates(_0x180992,_0x1ac289){return function(_0x4f943a){if(_0x4f943a){return _0x4f943a['update'](_0x180992)[_0x67cd('0x25')](function(_0x41652b){return _0x41652b;});}return null;};}function removeEntity(_0x42442d,_0x56f73b){return function(_0x2808a6){if(_0x2808a6){return _0x2808a6[_0x67cd('0x26')]()[_0x67cd('0x25')](function(){_0x42442d[_0x67cd('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25c7ce,_0x3bb6d9){return function(_0x4134d5){if(!_0x4134d5){_0x25c7ce[_0x67cd('0x27')](0x194);}return _0x4134d5;};}function handleError(_0x294c4e,_0x4e771f){_0x4e771f=_0x4e771f||0x1f4;return function(_0x18b6b2){logger['error'](_0x18b6b2['stack']);if(_0x18b6b2[_0x67cd('0x28')]){delete _0x18b6b2['name'];}_0x294c4e[_0x67cd('0x1b')](_0x4e771f)[_0x67cd('0x29')](_0x18b6b2);};}exports['index']=function(_0x41d08a,_0x451bc0){var _0x225160={},_0x21fbae={},_0x19e3e3={'count':0x0,'rows':[]};var _0x180d47=_['map'](db[_0x67cd('0x2a')][_0x67cd('0x2b')],function(_0x5075b6){return{'name':_0x5075b6[_0x67cd('0x2c')],'type':_0x5075b6[_0x67cd('0x2d')][_0x67cd('0x2e')]};});_0x21fbae['model']=_[_0x67cd('0x2f')](_0x180d47,_0x67cd('0x28'));_0x21fbae[_0x67cd('0x30')]=_[_0x67cd('0x31')](_0x41d08a[_0x67cd('0x30')]);_0x21fbae[_0x67cd('0x32')]=_[_0x67cd('0x33')](_0x21fbae[_0x67cd('0x34')],_0x21fbae['query']);_0x225160['attributes']=_['intersection'](_0x21fbae['model'],qs[_0x67cd('0x35')](_0x41d08a[_0x67cd('0x30')][_0x67cd('0x35')]));_0x225160[_0x67cd('0x36')]=_0x225160[_0x67cd('0x36')][_0x67cd('0x37')]?_0x225160[_0x67cd('0x36')]:_0x21fbae[_0x67cd('0x34')];if(!_0x41d08a['query'][_0x67cd('0x38')](_0x67cd('0x39'))){_0x225160[_0x67cd('0x20')]=qs[_0x67cd('0x20')](_0x41d08a[_0x67cd('0x30')][_0x67cd('0x20')]);_0x225160['offset']=qs[_0x67cd('0x1e')](_0x41d08a['query'][_0x67cd('0x1e')]);}_0x225160[_0x67cd('0x3a')]=qs[_0x67cd('0x3b')](_0x41d08a[_0x67cd('0x30')][_0x67cd('0x3b')]);_0x225160[_0x67cd('0x3c')]=qs['filters'](_[_0x67cd('0x3d')](_0x41d08a[_0x67cd('0x30')],_0x21fbae[_0x67cd('0x32')]),_0x180d47);if(_0x41d08a[_0x67cd('0x30')][_0x67cd('0x3e')]){_0x225160[_0x67cd('0x3c')]=_[_0x67cd('0x3f')](_0x225160[_0x67cd('0x3c')],{'$or':_[_0x67cd('0x2f')](_0x180d47,function(_0x14c43c){if(_0x14c43c[_0x67cd('0x2d')]!==_0x67cd('0x40')){var _0x4d622e={};_0x4d622e[_0x14c43c['name']]={'$like':'%'+_0x41d08a[_0x67cd('0x30')][_0x67cd('0x3e')]+'%'};return _0x4d622e;}})});}_0x225160=_['merge']({},_0x225160,_0x41d08a['options']);var _0x24e1a0={'where':_0x225160[_0x67cd('0x3c')]};return db['SquareReport']['count'](_0x24e1a0)['then'](function(_0x43f0a0){_0x19e3e3[_0x67cd('0x21')]=_0x43f0a0;if(_0x41d08a[_0x67cd('0x30')][_0x67cd('0x41')]){_0x225160[_0x67cd('0x42')]=[{'all':!![]}];}return db[_0x67cd('0x2a')]['findAll'](_0x225160);})[_0x67cd('0x25')](function(_0x197f78){_0x19e3e3[_0x67cd('0x43')]=_0x197f78;return _0x19e3e3;})[_0x67cd('0x25')](respondWithFilteredResult(_0x451bc0,_0x225160))[_0x67cd('0x44')](handleError(_0x451bc0,null));};exports['show']=function(_0x113672,_0x4a69db){var _0x57b77f={'raw':!![],'where':{'id':_0x113672[_0x67cd('0x45')]['id']}},_0x244627={};_0x244627[_0x67cd('0x34')]=_[_0x67cd('0x31')](db[_0x67cd('0x2a')]['rawAttributes']);_0x244627[_0x67cd('0x30')]=_[_0x67cd('0x31')](_0x113672['query']);_0x244627[_0x67cd('0x32')]=_[_0x67cd('0x33')](_0x244627['model'],_0x244627[_0x67cd('0x30')]);_0x57b77f[_0x67cd('0x36')]=_[_0x67cd('0x33')](_0x244627[_0x67cd('0x34')],qs['fields'](_0x113672['query'][_0x67cd('0x35')]));_0x57b77f['attributes']=_0x57b77f['attributes']['length']?_0x57b77f[_0x67cd('0x36')]:_0x244627[_0x67cd('0x34')];if(_0x113672['query'][_0x67cd('0x41')]){_0x57b77f[_0x67cd('0x42')]=[{'all':!![]}];}_0x57b77f=_[_0x67cd('0x3f')]({},_0x57b77f,_0x113672[_0x67cd('0x46')]);return db[_0x67cd('0x2a')]['find'](_0x57b77f)[_0x67cd('0x25')](handleEntityNotFound(_0x4a69db,null))[_0x67cd('0x25')](respondWithResult(_0x4a69db,null))[_0x67cd('0x44')](handleError(_0x4a69db,null));};exports[_0x67cd('0x47')]=function(_0x2c68c5,_0x4076e7){return db['SquareReport'][_0x67cd('0x47')](_0x2c68c5['body'],{})[_0x67cd('0x25')](respondWithResult(_0x4076e7,0xc9))[_0x67cd('0x44')](handleError(_0x4076e7,null));};exports[_0x67cd('0x48')]=function(_0x349ecd,_0x1eb76d){if(_0x349ecd['body']['id']){delete _0x349ecd[_0x67cd('0x49')]['id'];}return db[_0x67cd('0x2a')][_0x67cd('0x4a')]({'where':{'id':_0x349ecd[_0x67cd('0x45')]['id']}})[_0x67cd('0x25')](handleEntityNotFound(_0x1eb76d,null))[_0x67cd('0x25')](saveUpdates(_0x349ecd[_0x67cd('0x49')],null))[_0x67cd('0x25')](respondWithResult(_0x1eb76d,null))[_0x67cd('0x44')](handleError(_0x1eb76d,null));};exports[_0x67cd('0x26')]=function(_0x51915c,_0x520cd7){return db['SquareReport'][_0x67cd('0x4a')]({'where':{'id':_0x51915c[_0x67cd('0x45')]['id']}})['then'](handleEntityNotFound(_0x520cd7,null))[_0x67cd('0x25')](removeEntity(_0x520cd7,null))[_0x67cd('0x44')](handleError(_0x520cd7,null));};exports[_0x67cd('0x4b')]=function(_0x57a786,_0x13566b){return db[_0x67cd('0x2a')][_0x67cd('0x4b')]()[_0x67cd('0x25')](respondWithResult(_0x13566b,null))[_0x67cd('0x44')](handleError(_0x13566b,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 72f5b15..260baa1 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 _0xe34a=['project_name','leaveAt','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid'];(function(_0xe2b13f,_0x68d664){var _0x2466e0=function(_0x18edb7){while(--_0x18edb7){_0xe2b13f['push'](_0xe2b13f['shift']());}};_0x2466e0(++_0x68d664);}(_0xe34a,0x1cd));var _0xae34=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xe34a[_0x24237f];return _0x48298e;};'use strict';var _=require(_0xae34('0x0'));var util=require('util');var logger=require(_0xae34('0x1'))('api');var moment=require(_0xae34('0x2'));var BPromise=require(_0xae34('0x3'));var rp=require(_0xae34('0x4'));var fs=require('fs');var path=require(_0xae34('0x5'));var rimraf=require(_0xae34('0x6'));var config=require(_0xae34('0x7'));var attributes=require(_0xae34('0x8'));module[_0xae34('0x9')]=function(_0x179994,_0x3c49b8){return _0x179994[_0xae34('0xa')](_0xae34('0xb'),attributes,{'tableName':_0xae34('0xc'),'paranoid':![],'indexes':[{'name':_0xae34('0xd'),'fields':[_0xae34('0xe'),_0xae34('0xf')]},{'name':_0xae34('0x10'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd0a7=['SquareReport','report_square','uniqueid','leaveAt','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','define'];(function(_0x3c7a6e,_0x3d8cc0){var _0x24cf77=function(_0x15e3ca){while(--_0x15e3ca){_0x3c7a6e['push'](_0x3c7a6e['shift']());}};_0x24cf77(++_0x3d8cc0);}(_0xd0a7,0x121));var _0x7d0a=function(_0x23e7b0,_0x306a23){_0x23e7b0=_0x23e7b0-0x0;var _0x5e0717=_0xd0a7[_0x23e7b0];return _0x5e0717;};'use strict';var _=require('lodash');var util=require(_0x7d0a('0x0'));var logger=require(_0x7d0a('0x1'))(_0x7d0a('0x2'));var moment=require('moment');var BPromise=require(_0x7d0a('0x3'));var rp=require(_0x7d0a('0x4'));var fs=require('fs');var path=require(_0x7d0a('0x5'));var rimraf=require(_0x7d0a('0x6'));var config=require(_0x7d0a('0x7'));var attributes=require(_0x7d0a('0x8'));module[_0x7d0a('0x9')]=function(_0x4c665d,_0xd2ade1){return _0x4c665d[_0x7d0a('0xa')](_0x7d0a('0xb'),attributes,{'tableName':_0x7d0a('0xc'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x7d0a('0xd'),'project_name']},{'name':'leaveAt','fields':[_0x7d0a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 40ec601..7a1a3a4 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 _0xbbb2=['result','catch','CreateSquareReport','SquareReport','create','options','raw','stringify','UpdateSquareReport','body','limit','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x2c27ed,_0x5c50f0){var _0x597bd1=function(_0xd6db18){while(--_0xd6db18){_0x2c27ed['push'](_0x2c27ed['shift']());}};_0x597bd1(++_0x5c50f0);}(_0xbbb2,0x167));var _0x2bbb=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xbbb2[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0x2bbb('0x0'));var util=require(_0x2bbb('0x1'));var moment=require(_0x2bbb('0x2'));var BPromise=require(_0x2bbb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2bbb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2bbb('0x5'));var logger=require('../../config/logger')(_0x2bbb('0x6'));var config=require(_0x2bbb('0x7'));var jayson=require(_0x2bbb('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x745dea,_0xe07bef,_0xba8767){return new BPromise(function(_0x45ac69,_0x286f99){return client['request'](_0x745dea,_0xba8767)[_0x2bbb('0x9')](function(_0x1d2824){logger[_0x2bbb('0xa')](_0x2bbb('0xb'),_0xe07bef,_0x2bbb('0xc'));logger[_0x2bbb('0xd')](_0x2bbb('0xe'),_0xe07bef,'request\x20sent',JSON['stringify'](_0x1d2824));if(_0x1d2824[_0x2bbb('0xf')]){if(_0x1d2824['error'][_0x2bbb('0x10')]===0x1f4){logger[_0x2bbb('0xf')](_0x2bbb('0xb'),_0xe07bef,_0x1d2824[_0x2bbb('0xf')][_0x2bbb('0x11')]);return _0x286f99(_0x1d2824[_0x2bbb('0xf')][_0x2bbb('0x11')]);}logger[_0x2bbb('0xf')](_0x2bbb('0xb'),_0xe07bef,_0x1d2824['error'][_0x2bbb('0x11')]);return _0x45ac69(_0x1d2824[_0x2bbb('0xf')][_0x2bbb('0x11')]);}else{logger[_0x2bbb('0xa')](_0x2bbb('0xb'),_0xe07bef,'request\x20sent');_0x45ac69(_0x1d2824[_0x2bbb('0x12')][_0x2bbb('0x11')]);}})[_0x2bbb('0x13')](function(_0x28ed57){logger[_0x2bbb('0xf')](_0x2bbb('0xb'),_0xe07bef,_0x28ed57);_0x286f99(_0x28ed57);});});}exports[_0x2bbb('0x14')]=function(_0x7ec9a1){var _0x262b27=this;return new Promise(function(_0x570178,_0x2db677){return db[_0x2bbb('0x15')][_0x2bbb('0x16')](_0x7ec9a1['body'],{'raw':_0x7ec9a1[_0x2bbb('0x17')]?_0x7ec9a1[_0x2bbb('0x17')][_0x2bbb('0x18')]===undefined?!![]:![]:!![]})[_0x2bbb('0x9')](function(_0xd87e7){logger[_0x2bbb('0xa')](_0x2bbb('0x14'),_0x7ec9a1);logger[_0x2bbb('0xd')](_0x2bbb('0x14'),_0x7ec9a1,JSON[_0x2bbb('0x19')](_0xd87e7));_0x570178(_0xd87e7);})[_0x2bbb('0x13')](function(_0x578af4){logger['error'](_0x2bbb('0x14'),_0x578af4[_0x2bbb('0x11')],_0x7ec9a1);_0x2db677(_0x262b27['error'](0x1f4,_0x578af4[_0x2bbb('0x11')]));});});};exports[_0x2bbb('0x1a')]=function(_0x19ce98){var _0x2c1fd5=this;return new Promise(function(_0x416ab6,_0x400e0b){return db['SquareReport']['update'](_0x19ce98[_0x2bbb('0x1b')],{'raw':_0x19ce98['options']?_0x19ce98[_0x2bbb('0x17')][_0x2bbb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19ce98['options']?_0x19ce98[_0x2bbb('0x17')]['where']||null:null,'attributes':_0x19ce98['options']?_0x19ce98[_0x2bbb('0x17')]['attributes']||null:null,'limit':_0x19ce98[_0x2bbb('0x17')]?_0x19ce98['options'][_0x2bbb('0x1c')]||null:null})['then'](function(_0x14816f){logger[_0x2bbb('0xa')](_0x2bbb('0x1a'),_0x19ce98);logger[_0x2bbb('0xd')]('UpdateSquareReport',_0x19ce98,JSON[_0x2bbb('0x19')](_0x14816f));_0x416ab6(_0x14816f);})[_0x2bbb('0x13')](function(_0x13881b){logger['error']('UpdateSquareReport',_0x13881b[_0x2bbb('0x11')],_0x19ce98);_0x400e0b(_0x2c1fd5[_0x2bbb('0xf')](0x1f4,_0x13881b[_0x2bbb('0x11')]));});});}; \ No newline at end of file +var _0x43e0=['attributes','limit','UpdateSquareReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','error','message','result','CreateSquareReport','create','body','options','raw','then','debug','stringify','SquareReport','where'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x43e0,0xe3));var _0x043e=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x43e0[_0x346737];return _0x1ade2e;};'use strict';var _=require(_0x043e('0x0'));var util=require(_0x043e('0x1'));var moment=require(_0x043e('0x2'));var BPromise=require('bluebird');var rs=require(_0x043e('0x3'));var fs=require('fs');var Redis=require(_0x043e('0x4'));var db=require(_0x043e('0x5'))['db'];var utils=require(_0x043e('0x6'));var logger=require(_0x043e('0x7'))('rpc');var config=require(_0x043e('0x8'));var jayson=require(_0x043e('0x9'));var client=jayson[_0x043e('0xa')][_0x043e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e818d,_0x532e60,_0x1c8c11){return new BPromise(function(_0x4db904,_0x389620){return client[_0x043e('0xc')](_0x2e818d,_0x1c8c11)['then'](function(_0x5efd6a){logger[_0x043e('0xd')](_0x043e('0xe'),_0x532e60,_0x043e('0xf'));logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x532e60,_0x043e('0xf'),JSON['stringify'](_0x5efd6a));if(_0x5efd6a[_0x043e('0x10')]){if(_0x5efd6a[_0x043e('0x10')]['code']===0x1f4){logger[_0x043e('0x10')](_0x043e('0xe'),_0x532e60,_0x5efd6a[_0x043e('0x10')][_0x043e('0x11')]);return _0x389620(_0x5efd6a[_0x043e('0x10')][_0x043e('0x11')]);}logger[_0x043e('0x10')]('SquareReport,\x20%s,\x20%s',_0x532e60,_0x5efd6a[_0x043e('0x10')][_0x043e('0x11')]);return _0x4db904(_0x5efd6a[_0x043e('0x10')][_0x043e('0x11')]);}else{logger[_0x043e('0xd')](_0x043e('0xe'),_0x532e60,_0x043e('0xf'));_0x4db904(_0x5efd6a[_0x043e('0x12')][_0x043e('0x11')]);}})['catch'](function(_0x395107){logger[_0x043e('0x10')](_0x043e('0xe'),_0x532e60,_0x395107);_0x389620(_0x395107);});});}exports[_0x043e('0x13')]=function(_0x1bf96b){var _0x596050=this;return new Promise(function(_0x43aaab,_0x2d6b45){return db['SquareReport'][_0x043e('0x14')](_0x1bf96b[_0x043e('0x15')],{'raw':_0x1bf96b[_0x043e('0x16')]?_0x1bf96b[_0x043e('0x16')][_0x043e('0x17')]===undefined?!![]:![]:!![]})[_0x043e('0x18')](function(_0x3f41c6){logger[_0x043e('0xd')](_0x043e('0x13'),_0x1bf96b);logger[_0x043e('0x19')]('CreateSquareReport',_0x1bf96b,JSON[_0x043e('0x1a')](_0x3f41c6));_0x43aaab(_0x3f41c6);})['catch'](function(_0x4fa9b0){logger['error']('CreateSquareReport',_0x4fa9b0[_0x043e('0x11')],_0x1bf96b);_0x2d6b45(_0x596050[_0x043e('0x10')](0x1f4,_0x4fa9b0[_0x043e('0x11')]));});});};exports['UpdateSquareReport']=function(_0xe7f1e){var _0x214eb5=this;return new Promise(function(_0x105f97,_0x4dd570){return db[_0x043e('0x1b')]['update'](_0xe7f1e[_0x043e('0x15')],{'raw':_0xe7f1e[_0x043e('0x16')]?_0xe7f1e[_0x043e('0x16')][_0x043e('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe7f1e[_0x043e('0x16')]?_0xe7f1e[_0x043e('0x16')][_0x043e('0x1c')]||null:null,'attributes':_0xe7f1e[_0x043e('0x16')]?_0xe7f1e['options'][_0x043e('0x1d')]||null:null,'limit':_0xe7f1e[_0x043e('0x16')]?_0xe7f1e['options'][_0x043e('0x1e')]||null:null})[_0x043e('0x18')](function(_0x2358eb){logger[_0x043e('0xd')]('UpdateSquareReport',_0xe7f1e);logger[_0x043e('0x19')](_0x043e('0x1f'),_0xe7f1e,JSON[_0x043e('0x1a')](_0x2358eb));_0x105f97(_0x2358eb);})['catch'](function(_0x121632){logger['error']('UpdateSquareReport',_0x121632['message'],_0xe7f1e);_0x4dd570(_0x214eb5['error'](0x1f4,_0x121632[_0x043e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index a4f4425..fe565ea 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 _0xbd82=['show','post','create','put','isAuthenticated','update','exports','util','path','connect-timeout','express','Router','../../components/auth/service','./squareReportDetail.controller','get','index','describe','/:id'];(function(_0x22b98c,_0x3cc5dc){var _0x5e846e=function(_0x265144){while(--_0x265144){_0x22b98c['push'](_0x22b98c['shift']());}};_0x5e846e(++_0x3cc5dc);}(_0xbd82,0x15d));var _0x2bd8=function(_0x455358,_0xcc2664){_0x455358=_0x455358-0x0;var _0x1628ac=_0xbd82[_0x455358];return _0x1628ac;};'use strict';var multer=require('multer');var util=require(_0x2bd8('0x0'));var path=require(_0x2bd8('0x1'));var timeout=require(_0x2bd8('0x2'));var express=require(_0x2bd8('0x3'));var router=express[_0x2bd8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2bd8('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2bd8('0x6'));router[_0x2bd8('0x7')]('/',auth['isAuthenticated'](),controller[_0x2bd8('0x8')]);router[_0x2bd8('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x2bd8('0x9')]);router['get'](_0x2bd8('0xa'),auth['isAuthenticated'](),controller[_0x2bd8('0xb')]);router[_0x2bd8('0xc')]('/',auth['isAuthenticated'](),controller[_0x2bd8('0xd')]);router[_0x2bd8('0xe')]('/:id',auth[_0x2bd8('0xf')](),controller[_0x2bd8('0x10')]);router['delete'](_0x2bd8('0xa'),auth[_0x2bd8('0xf')](),controller['destroy']);module[_0x2bd8('0x11')]=router; \ No newline at end of file +var _0x4ff1=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports'];(function(_0x4ad8f9,_0x35afe6){var _0x963a1b=function(_0x1c4acc){while(--_0x1c4acc){_0x4ad8f9['push'](_0x4ad8f9['shift']());}};_0x963a1b(++_0x35afe6);}(_0x4ff1,0x1e0));var _0x14ff=function(_0x3e45a6,_0x576195){_0x3e45a6=_0x3e45a6-0x0;var _0x4751f7=_0x4ff1[_0x3e45a6];return _0x4751f7;};'use strict';var multer=require(_0x14ff('0x0'));var util=require(_0x14ff('0x1'));var path=require('path');var timeout=require(_0x14ff('0x2'));var express=require(_0x14ff('0x3'));var router=express[_0x14ff('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x14ff('0x5'));var interaction=require(_0x14ff('0x6'));var config=require(_0x14ff('0x7'));var controller=require(_0x14ff('0x8'));router[_0x14ff('0x9')]('/',auth[_0x14ff('0xa')](),controller[_0x14ff('0xb')]);router[_0x14ff('0x9')]('/describe',auth[_0x14ff('0xa')](),controller['describe']);router[_0x14ff('0x9')](_0x14ff('0xc'),auth[_0x14ff('0xa')](),controller[_0x14ff('0xd')]);router[_0x14ff('0xe')]('/',auth[_0x14ff('0xa')](),controller[_0x14ff('0xf')]);router[_0x14ff('0x10')](_0x14ff('0xc'),auth['isAuthenticated'](),controller[_0x14ff('0x11')]);router['delete'](_0x14ff('0xc'),auth[_0x14ff('0xa')](),controller[_0x14ff('0x12')]);module[_0x14ff('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 9d6e2dd..d157763 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 _0x90fe=['STRING','TEXT','sequelize'];(function(_0x320784,_0x24332f){var _0x3f9de3=function(_0x465253){while(--_0x465253){_0x320784['push'](_0x320784['shift']());}};_0x3f9de3(++_0x24332f);}(_0x90fe,0x173));var _0xe90f=function(_0xfae845,_0x1cb66d){_0xfae845=_0xfae845-0x0;var _0x575787=_0x90fe[_0xfae845];return _0x575787;};'use strict';var Sequelize=require(_0xe90f('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe90f('0x1')]},'node':{'type':Sequelize[_0xe90f('0x1')]},'application':{'type':Sequelize[_0xe90f('0x1')]},'data':{'type':Sequelize[_0xe90f('0x2')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xe90f('0x1')]}}; \ No newline at end of file +var _0xf745=['TEXT','sequelize','exports','STRING'];(function(_0x573ea2,_0x1517e4){var _0x2dc6ab=function(_0x49a03d){while(--_0x49a03d){_0x573ea2['push'](_0x573ea2['shift']());}};_0x2dc6ab(++_0x1517e4);}(_0xf745,0x71));var _0x5f74=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xf745[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0x5f74('0x0'));module[_0x5f74('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x5f74('0x2')]},'application':{'type':Sequelize[_0x5f74('0x2')]},'data':{'type':Sequelize[_0x5f74('0x3')]},'project_name':{'type':Sequelize[_0x5f74('0x2')]},'callerid':{'type':Sequelize[_0x5f74('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 594f2a8..e8e55da 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 _0x0df1=['status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','SquareDetailsReport','includeAll','include','catch','show','options','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x425b10,_0xe4cbbe){var _0x1eecfe=function(_0x2233f1){while(--_0x2233f1){_0x425b10['push'](_0x425b10['shift']());}};_0x1eecfe(++_0xe4cbbe);}(_0x0df1,0x14b));var _0x10df=function(_0x5eed46,_0x2dfc8b){_0x5eed46=_0x5eed46-0x0;var _0xc6ee99=_0x0df1[_0x5eed46];return _0xc6ee99;};'use strict';var emlformat=require(_0x10df('0x0'));var rimraf=require(_0x10df('0x1'));var zipdir=require(_0x10df('0x2'));var jsonpatch=require(_0x10df('0x3'));var rp=require(_0x10df('0x4'));var moment=require(_0x10df('0x5'));var BPromise=require(_0x10df('0x6'));var Mustache=require(_0x10df('0x7'));var util=require(_0x10df('0x8'));var path=require(_0x10df('0x9'));var sox=require(_0x10df('0xa'));var csv=require(_0x10df('0xb'));var ejs=require(_0x10df('0xc'));var fs=require('fs');var fs_extra=require(_0x10df('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x10df('0xe'));var jsforce=require(_0x10df('0xf'));var deskjs=require(_0x10df('0x10'));var toCsv=require(_0x10df('0xb'));var querystring=require(_0x10df('0x11'));var Papa=require('papaparse');var Redis=require(_0x10df('0x12'));var authService=require(_0x10df('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x10df('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x10df('0x15'));var db=require(_0x10df('0x16'))['db'];function respondWithStatusCode(_0x436eb3,_0x171843){_0x171843=_0x171843||0xcc;return function(_0x1321be){if(_0x1321be){return _0x436eb3[_0x10df('0x17')](_0x171843);}return _0x436eb3[_0x10df('0x18')](_0x171843)[_0x10df('0x19')]();};}function respondWithResult(_0x4b1804,_0x2710bf){_0x2710bf=_0x2710bf||0xc8;return function(_0x5a6de9){if(_0x5a6de9){return _0x4b1804[_0x10df('0x18')](_0x2710bf)[_0x10df('0x1a')](_0x5a6de9);}};}function respondWithFilteredResult(_0x1644c1,_0x26f03a){return function(_0x1ded0c){if(_0x1ded0c){var _0x4b9636=typeof _0x26f03a[_0x10df('0x1b')]===_0x10df('0x1c')&&typeof _0x26f03a[_0x10df('0x1d')]===_0x10df('0x1c');var _0x5acf72=_0x1ded0c[_0x10df('0x1e')];var _0x38330e=_0x4b9636?0x0:_0x26f03a[_0x10df('0x1b')];var _0x2b42c8=_0x4b9636?_0x1ded0c[_0x10df('0x1e')]:_0x26f03a[_0x10df('0x1b')]+_0x26f03a['limit'];var _0x4583c3;if(_0x2b42c8>=_0x5acf72){_0x2b42c8=_0x5acf72;_0x4583c3=0xc8;}else{_0x4583c3=0xce;}_0x1644c1[_0x10df('0x18')](_0x4583c3);return _0x1644c1[_0x10df('0x1f')](_0x10df('0x20'),_0x38330e+'-'+_0x2b42c8+'/'+_0x5acf72)[_0x10df('0x1a')](_0x1ded0c);}return null;};}function patchUpdates(_0x1a7be7){return function(_0x58a325){try{jsonpatch[_0x10df('0x21')](_0x58a325,_0x1a7be7,!![]);}catch(_0x24a55a){return BPromise['reject'](_0x24a55a);}return _0x58a325[_0x10df('0x22')]();};}function saveUpdates(_0x3e2b4f,_0x823ff5){return function(_0x5ac780){if(_0x5ac780){return _0x5ac780[_0x10df('0x23')](_0x3e2b4f)[_0x10df('0x24')](function(_0x6d4f52){return _0x6d4f52;});}return null;};}function removeEntity(_0x3b053f,_0x47c721){return function(_0x250611){if(_0x250611){return _0x250611[_0x10df('0x25')]()[_0x10df('0x24')](function(){_0x3b053f[_0x10df('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28d180,_0xacd23){return function(_0x148073){if(!_0x148073){_0x28d180[_0x10df('0x17')](0x194);}return _0x148073;};}function handleError(_0x5880e4,_0x38ec3d){_0x38ec3d=_0x38ec3d||0x1f4;return function(_0xcb95d5){logger[_0x10df('0x26')](_0xcb95d5['stack']);if(_0xcb95d5[_0x10df('0x27')]){delete _0xcb95d5[_0x10df('0x27')];}_0x5880e4[_0x10df('0x18')](_0x38ec3d)[_0x10df('0x28')](_0xcb95d5);};}exports[_0x10df('0x29')]=function(_0x2f53de,_0x5ecbd3){var _0x341e8d={},_0xb7b339={},_0x29faff={'count':0x0,'rows':[]};var _0x35322d=_[_0x10df('0x2a')](db['SquareDetailsReport'][_0x10df('0x2b')],function(_0x191564){return{'name':_0x191564[_0x10df('0x2c')],'type':_0x191564[_0x10df('0x2d')]['key']};});_0xb7b339[_0x10df('0x2e')]=_[_0x10df('0x2a')](_0x35322d,_0x10df('0x27'));_0xb7b339[_0x10df('0x2f')]=_[_0x10df('0x30')](_0x2f53de[_0x10df('0x2f')]);_0xb7b339[_0x10df('0x31')]=_[_0x10df('0x32')](_0xb7b339[_0x10df('0x2e')],_0xb7b339[_0x10df('0x2f')]);_0x341e8d[_0x10df('0x33')]=_[_0x10df('0x32')](_0xb7b339[_0x10df('0x2e')],qs[_0x10df('0x34')](_0x2f53de[_0x10df('0x2f')][_0x10df('0x34')]));_0x341e8d[_0x10df('0x33')]=_0x341e8d['attributes'][_0x10df('0x35')]?_0x341e8d[_0x10df('0x33')]:_0xb7b339['model'];if(!_0x2f53de['query'][_0x10df('0x36')](_0x10df('0x37'))){_0x341e8d[_0x10df('0x1d')]=qs[_0x10df('0x1d')](_0x2f53de[_0x10df('0x2f')][_0x10df('0x1d')]);_0x341e8d[_0x10df('0x1b')]=qs[_0x10df('0x1b')](_0x2f53de[_0x10df('0x2f')][_0x10df('0x1b')]);}_0x341e8d[_0x10df('0x38')]=qs[_0x10df('0x39')](_0x2f53de['query']['sort']);_0x341e8d['where']=qs['filters'](_['pick'](_0x2f53de['query'],_0xb7b339[_0x10df('0x31')]),_0x35322d);if(_0x2f53de[_0x10df('0x2f')]['filter']){_0x341e8d[_0x10df('0x3a')]=_[_0x10df('0x3b')](_0x341e8d[_0x10df('0x3a')],{'$or':_['map'](_0x35322d,function(_0x293a5f){if(_0x293a5f['type']!==_0x10df('0x3c')){var _0xe04c2b={};_0xe04c2b[_0x293a5f[_0x10df('0x27')]]={'$like':'%'+_0x2f53de['query']['filter']+'%'};return _0xe04c2b;}})});}_0x341e8d=_['merge']({},_0x341e8d,_0x2f53de['options']);var _0x154d6c={'where':_0x341e8d[_0x10df('0x3a')]};return db[_0x10df('0x3d')][_0x10df('0x1e')](_0x154d6c)[_0x10df('0x24')](function(_0x26690f){_0x29faff[_0x10df('0x1e')]=_0x26690f;if(_0x2f53de['query'][_0x10df('0x3e')]){_0x341e8d[_0x10df('0x3f')]=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x341e8d);})[_0x10df('0x24')](function(_0x3b564c){_0x29faff['rows']=_0x3b564c;return _0x29faff;})[_0x10df('0x24')](respondWithFilteredResult(_0x5ecbd3,_0x341e8d))[_0x10df('0x40')](handleError(_0x5ecbd3,null));};exports[_0x10df('0x41')]=function(_0x2a69d3,_0x197754){var _0xbb9d37={'raw':!![],'where':{'id':_0x2a69d3['params']['id']}},_0x24c51e={};_0x24c51e['model']=_[_0x10df('0x30')](db[_0x10df('0x3d')][_0x10df('0x2b')]);_0x24c51e[_0x10df('0x2f')]=_['keys'](_0x2a69d3['query']);_0x24c51e[_0x10df('0x31')]=_[_0x10df('0x32')](_0x24c51e[_0x10df('0x2e')],_0x24c51e['query']);_0xbb9d37[_0x10df('0x33')]=_[_0x10df('0x32')](_0x24c51e[_0x10df('0x2e')],qs[_0x10df('0x34')](_0x2a69d3[_0x10df('0x2f')][_0x10df('0x34')]));_0xbb9d37['attributes']=_0xbb9d37[_0x10df('0x33')][_0x10df('0x35')]?_0xbb9d37[_0x10df('0x33')]:_0x24c51e[_0x10df('0x2e')];if(_0x2a69d3['query'][_0x10df('0x3e')]){_0xbb9d37[_0x10df('0x3f')]=[{'all':!![]}];}_0xbb9d37=_['merge']({},_0xbb9d37,_0x2a69d3[_0x10df('0x42')]);return db[_0x10df('0x3d')]['find'](_0xbb9d37)[_0x10df('0x24')](handleEntityNotFound(_0x197754,null))[_0x10df('0x24')](respondWithResult(_0x197754,null))['catch'](handleError(_0x197754,null));};exports[_0x10df('0x43')]=function(_0x3e7fbb,_0x5a27a9){return db[_0x10df('0x3d')][_0x10df('0x43')](_0x3e7fbb['body'],{})[_0x10df('0x24')](respondWithResult(_0x5a27a9,0xc9))[_0x10df('0x40')](handleError(_0x5a27a9,null));};exports[_0x10df('0x23')]=function(_0x30f0b1,_0x9b30fe){if(_0x30f0b1[_0x10df('0x44')]['id']){delete _0x30f0b1[_0x10df('0x44')]['id'];}return db[_0x10df('0x3d')]['find']({'where':{'id':_0x30f0b1[_0x10df('0x45')]['id']}})[_0x10df('0x24')](handleEntityNotFound(_0x9b30fe,null))[_0x10df('0x24')](saveUpdates(_0x30f0b1[_0x10df('0x44')],null))[_0x10df('0x24')](respondWithResult(_0x9b30fe,null))['catch'](handleError(_0x9b30fe,null));};exports['destroy']=function(_0x483dbc,_0x4f7ef7){return db[_0x10df('0x3d')]['find']({'where':{'id':_0x483dbc['params']['id']}})['then'](handleEntityNotFound(_0x4f7ef7,null))['then'](removeEntity(_0x4f7ef7,null))[_0x10df('0x40')](handleError(_0x4f7ef7,null));};exports[_0x10df('0x46')]=function(_0x5c1dc1,_0x2ab81c){return db['SquareDetailsReport'][_0x10df('0x46')]()[_0x10df('0x24')](respondWithResult(_0x2ab81c,null))[_0x10df('0x40')](handleError(_0x2ab81c,null));}; \ No newline at end of file +var _0xae15=['fieldName','type','key','model','query','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','then','include','findAll','rows','catch','show','params','keys','fields','length','includeAll','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','update','name','index','map','SquareDetailsReport'];(function(_0x17784a,_0x42fe44){var _0x41aded=function(_0x2e7319){while(--_0x2e7319){_0x17784a['push'](_0x17784a['shift']());}};_0x41aded(++_0x42fe44);}(_0xae15,0x194));var _0x5ae1=function(_0x179349,_0x4a2db2){_0x179349=_0x179349-0x0;var _0x554512=_0xae15[_0x179349];return _0x554512;};'use strict';var emlformat=require(_0x5ae1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5ae1('0x1'));var jsonpatch=require(_0x5ae1('0x2'));var rp=require('request-promise');var moment=require(_0x5ae1('0x3'));var BPromise=require(_0x5ae1('0x4'));var Mustache=require(_0x5ae1('0x5'));var util=require(_0x5ae1('0x6'));var path=require('path');var sox=require(_0x5ae1('0x7'));var csv=require(_0x5ae1('0x8'));var ejs=require(_0x5ae1('0x9'));var fs=require('fs');var fs_extra=require(_0x5ae1('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5ae1('0xb'));var jsforce=require(_0x5ae1('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5ae1('0x8'));var querystring=require(_0x5ae1('0xd'));var Papa=require(_0x5ae1('0xe'));var Redis=require(_0x5ae1('0xf'));var authService=require(_0x5ae1('0x10'));var qs=require(_0x5ae1('0x11'));var as=require(_0x5ae1('0x12'));var hardwareService=require(_0x5ae1('0x13'));var logger=require('../../config/logger')(_0x5ae1('0x14'));var utils=require(_0x5ae1('0x15'));var config=require(_0x5ae1('0x16'));var licenseUtil=require(_0x5ae1('0x17'));var db=require(_0x5ae1('0x18'))['db'];function respondWithStatusCode(_0xa5e940,_0x1b9bd2){_0x1b9bd2=_0x1b9bd2||0xcc;return function(_0x351147){if(_0x351147){return _0xa5e940[_0x5ae1('0x19')](_0x1b9bd2);}return _0xa5e940[_0x5ae1('0x1a')](_0x1b9bd2)[_0x5ae1('0x1b')]();};}function respondWithResult(_0x5b6e50,_0x46c1c0){_0x46c1c0=_0x46c1c0||0xc8;return function(_0x4a1000){if(_0x4a1000){return _0x5b6e50[_0x5ae1('0x1a')](_0x46c1c0)[_0x5ae1('0x1c')](_0x4a1000);}};}function respondWithFilteredResult(_0x5e6d69,_0x3ec686){return function(_0x15ec5e){if(_0x15ec5e){var _0x2d6316=typeof _0x3ec686[_0x5ae1('0x1d')]===_0x5ae1('0x1e')&&typeof _0x3ec686[_0x5ae1('0x1f')]===_0x5ae1('0x1e');var _0x33f01c=_0x15ec5e[_0x5ae1('0x20')];var _0x211b8b=_0x2d6316?0x0:_0x3ec686[_0x5ae1('0x1d')];var _0x581ce3=_0x2d6316?_0x15ec5e[_0x5ae1('0x20')]:_0x3ec686['offset']+_0x3ec686[_0x5ae1('0x1f')];var _0x33391e;if(_0x581ce3>=_0x33f01c){_0x581ce3=_0x33f01c;_0x33391e=0xc8;}else{_0x33391e=0xce;}_0x5e6d69['status'](_0x33391e);return _0x5e6d69['set']('Content-Range',_0x211b8b+'-'+_0x581ce3+'/'+_0x33f01c)[_0x5ae1('0x1c')](_0x15ec5e);}return null;};}function patchUpdates(_0x2f372e){return function(_0x1415eb){try{jsonpatch[_0x5ae1('0x21')](_0x1415eb,_0x2f372e,!![]);}catch(_0x11e10e){return BPromise[_0x5ae1('0x22')](_0x11e10e);}return _0x1415eb['save']();};}function saveUpdates(_0x2e65ce,_0x11664e){return function(_0x3d06ec){if(_0x3d06ec){return _0x3d06ec[_0x5ae1('0x23')](_0x2e65ce)['then'](function(_0x7c06ed){return _0x7c06ed;});}return null;};}function removeEntity(_0x3de71b,_0x347547){return function(_0x151649){if(_0x151649){return _0x151649['destroy']()['then'](function(){_0x3de71b['status'](0xcc)[_0x5ae1('0x1b')]();});}};}function handleEntityNotFound(_0x37d633,_0x1a0fa5){return function(_0x1f7723){if(!_0x1f7723){_0x37d633[_0x5ae1('0x19')](0x194);}return _0x1f7723;};}function handleError(_0x539cc9,_0x2d4364){_0x2d4364=_0x2d4364||0x1f4;return function(_0x3e9521){logger['error'](_0x3e9521['stack']);if(_0x3e9521[_0x5ae1('0x24')]){delete _0x3e9521[_0x5ae1('0x24')];}_0x539cc9['status'](_0x2d4364)['send'](_0x3e9521);};}exports[_0x5ae1('0x25')]=function(_0x2a5c3d,_0x19d601){var _0x313380={},_0x357333={},_0x182d6f={'count':0x0,'rows':[]};var _0x5296f4=_[_0x5ae1('0x26')](db[_0x5ae1('0x27')]['rawAttributes'],function(_0x44e4e3){return{'name':_0x44e4e3[_0x5ae1('0x28')],'type':_0x44e4e3[_0x5ae1('0x29')][_0x5ae1('0x2a')]};});_0x357333[_0x5ae1('0x2b')]=_['map'](_0x5296f4,_0x5ae1('0x24'));_0x357333[_0x5ae1('0x2c')]=_['keys'](_0x2a5c3d[_0x5ae1('0x2c')]);_0x357333['filters']=_['intersection'](_0x357333[_0x5ae1('0x2b')],_0x357333['query']);_0x313380[_0x5ae1('0x2d')]=_[_0x5ae1('0x2e')](_0x357333[_0x5ae1('0x2b')],qs['fields'](_0x2a5c3d[_0x5ae1('0x2c')]['fields']));_0x313380[_0x5ae1('0x2d')]=_0x313380[_0x5ae1('0x2d')]['length']?_0x313380[_0x5ae1('0x2d')]:_0x357333[_0x5ae1('0x2b')];if(!_0x2a5c3d[_0x5ae1('0x2c')][_0x5ae1('0x2f')](_0x5ae1('0x30'))){_0x313380[_0x5ae1('0x1f')]=qs[_0x5ae1('0x1f')](_0x2a5c3d[_0x5ae1('0x2c')][_0x5ae1('0x1f')]);_0x313380[_0x5ae1('0x1d')]=qs[_0x5ae1('0x1d')](_0x2a5c3d[_0x5ae1('0x2c')][_0x5ae1('0x1d')]);}_0x313380[_0x5ae1('0x31')]=qs[_0x5ae1('0x32')](_0x2a5c3d['query']['sort']);_0x313380[_0x5ae1('0x33')]=qs[_0x5ae1('0x34')](_[_0x5ae1('0x35')](_0x2a5c3d['query'],_0x357333[_0x5ae1('0x34')]),_0x5296f4);if(_0x2a5c3d['query'][_0x5ae1('0x36')]){_0x313380['where']=_[_0x5ae1('0x37')](_0x313380[_0x5ae1('0x33')],{'$or':_[_0x5ae1('0x26')](_0x5296f4,function(_0x528666){if(_0x528666['type']!==_0x5ae1('0x38')){var _0x1009de={};_0x1009de[_0x528666['name']]={'$like':'%'+_0x2a5c3d[_0x5ae1('0x2c')][_0x5ae1('0x36')]+'%'};return _0x1009de;}})});}_0x313380=_[_0x5ae1('0x37')]({},_0x313380,_0x2a5c3d[_0x5ae1('0x39')]);var _0x3594a1={'where':_0x313380['where']};return db[_0x5ae1('0x27')][_0x5ae1('0x20')](_0x3594a1)[_0x5ae1('0x3a')](function(_0x5b5b7c){_0x182d6f[_0x5ae1('0x20')]=_0x5b5b7c;if(_0x2a5c3d['query']['includeAll']){_0x313380[_0x5ae1('0x3b')]=[{'all':!![]}];}return db[_0x5ae1('0x27')][_0x5ae1('0x3c')](_0x313380);})[_0x5ae1('0x3a')](function(_0x2bd0b8){_0x182d6f[_0x5ae1('0x3d')]=_0x2bd0b8;return _0x182d6f;})[_0x5ae1('0x3a')](respondWithFilteredResult(_0x19d601,_0x313380))[_0x5ae1('0x3e')](handleError(_0x19d601,null));};exports[_0x5ae1('0x3f')]=function(_0x4abcf9,_0x5a3637){var _0x34bf83={'raw':!![],'where':{'id':_0x4abcf9[_0x5ae1('0x40')]['id']}},_0x5da274={};_0x5da274[_0x5ae1('0x2b')]=_[_0x5ae1('0x41')](db[_0x5ae1('0x27')]['rawAttributes']);_0x5da274[_0x5ae1('0x2c')]=_[_0x5ae1('0x41')](_0x4abcf9['query']);_0x5da274[_0x5ae1('0x34')]=_['intersection'](_0x5da274[_0x5ae1('0x2b')],_0x5da274['query']);_0x34bf83[_0x5ae1('0x2d')]=_[_0x5ae1('0x2e')](_0x5da274[_0x5ae1('0x2b')],qs[_0x5ae1('0x42')](_0x4abcf9[_0x5ae1('0x2c')]['fields']));_0x34bf83[_0x5ae1('0x2d')]=_0x34bf83['attributes'][_0x5ae1('0x43')]?_0x34bf83[_0x5ae1('0x2d')]:_0x5da274[_0x5ae1('0x2b')];if(_0x4abcf9[_0x5ae1('0x2c')][_0x5ae1('0x44')]){_0x34bf83['include']=[{'all':!![]}];}_0x34bf83=_[_0x5ae1('0x37')]({},_0x34bf83,_0x4abcf9['options']);return db[_0x5ae1('0x27')][_0x5ae1('0x45')](_0x34bf83)[_0x5ae1('0x3a')](handleEntityNotFound(_0x5a3637,null))[_0x5ae1('0x3a')](respondWithResult(_0x5a3637,null))[_0x5ae1('0x3e')](handleError(_0x5a3637,null));};exports[_0x5ae1('0x46')]=function(_0x502837,_0xac7ace){return db[_0x5ae1('0x27')][_0x5ae1('0x46')](_0x502837[_0x5ae1('0x47')],{})[_0x5ae1('0x3a')](respondWithResult(_0xac7ace,0xc9))[_0x5ae1('0x3e')](handleError(_0xac7ace,null));};exports['update']=function(_0x40dd11,_0x3d3c49){if(_0x40dd11['body']['id']){delete _0x40dd11[_0x5ae1('0x47')]['id'];}return db[_0x5ae1('0x27')][_0x5ae1('0x45')]({'where':{'id':_0x40dd11[_0x5ae1('0x40')]['id']}})[_0x5ae1('0x3a')](handleEntityNotFound(_0x3d3c49,null))['then'](saveUpdates(_0x40dd11[_0x5ae1('0x47')],null))[_0x5ae1('0x3a')](respondWithResult(_0x3d3c49,null))['catch'](handleError(_0x3d3c49,null));};exports[_0x5ae1('0x48')]=function(_0x561cf8,_0x34a57a){return db[_0x5ae1('0x27')][_0x5ae1('0x45')]({'where':{'id':_0x561cf8[_0x5ae1('0x40')]['id']}})['then'](handleEntityNotFound(_0x34a57a,null))[_0x5ae1('0x3a')](removeEntity(_0x34a57a,null))['catch'](handleError(_0x34a57a,null));};exports[_0x5ae1('0x49')]=function(_0x3786b1,_0x589276){return db[_0x5ae1('0x27')]['describe']()['then'](respondWithResult(_0x589276,null))[_0x5ae1('0x3e')](handleError(_0x589276,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 7c58196..a569f7c 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 _0xca40=['bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','lodash','util','../../config/logger','api','moment'];(function(_0x2d2ca2,_0x51873f){var _0x48489d=function(_0x1a2cf7){while(--_0x1a2cf7){_0x2d2ca2['push'](_0x2d2ca2['shift']());}};_0x48489d(++_0x51873f);}(_0xca40,0x1c2));var _0x0ca4=function(_0x528497,_0x147e87){_0x528497=_0x528497-0x0;var _0x392d59=_0xca40[_0x528497];return _0x392d59;};'use strict';var _=require(_0x0ca4('0x0'));var util=require(_0x0ca4('0x1'));var logger=require(_0x0ca4('0x2'))(_0x0ca4('0x3'));var moment=require(_0x0ca4('0x4'));var BPromise=require(_0x0ca4('0x5'));var rp=require(_0x0ca4('0x6'));var fs=require('fs');var path=require(_0x0ca4('0x7'));var rimraf=require(_0x0ca4('0x8'));var config=require(_0x0ca4('0x9'));var attributes=require(_0x0ca4('0xa'));module[_0x0ca4('0xb')]=function(_0x48110e,_0x152a19){return _0x48110e[_0x0ca4('0xc')]('SquareDetailsReport',attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2415=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2415,0x75));var _0x5241=function(_0x54270e,_0x21c471){_0x54270e=_0x54270e-0x0;var _0x25ac71=_0x2415[_0x54270e];return _0x25ac71;};'use strict';var _=require(_0x5241('0x0'));var util=require(_0x5241('0x1'));var logger=require('../../config/logger')(_0x5241('0x2'));var moment=require(_0x5241('0x3'));var BPromise=require(_0x5241('0x4'));var rp=require(_0x5241('0x5'));var fs=require('fs');var path=require(_0x5241('0x6'));var rimraf=require(_0x5241('0x7'));var config=require('../../config/environment');var attributes=require(_0x5241('0x8'));module[_0x5241('0x9')]=function(_0xeaf6aa,_0x3fd55f){return _0xeaf6aa[_0x5241('0xa')](_0x5241('0xb'),attributes,{'tableName':_0x5241('0xc'),'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 45e1113..c28895f 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 _0x93e6=['error','code','message','info','result','catch','CreateSquareDetailsReport','SquareDetailsReport','options','raw','stringify','lodash','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','SquareDetailsReport,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x278826,_0x20efcb){var _0x38e7f6=function(_0x3b8047){while(--_0x3b8047){_0x278826['push'](_0x278826['shift']());}};_0x38e7f6(++_0x20efcb);}(_0x93e6,0x11e));var _0x693e=function(_0x15b0d0,_0x49d4bc){_0x15b0d0=_0x15b0d0-0x0;var _0x31a929=_0x93e6[_0x15b0d0];return _0x31a929;};'use strict';var _=require(_0x693e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x693e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x693e('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x693e('0x3'));var logger=require(_0x693e('0x4'))(_0x693e('0x5'));var config=require('../../config/environment');var jayson=require(_0x693e('0x6'));var client=jayson[_0x693e('0x7')][_0x693e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x520113,_0x577dcb,_0x57897c){return new BPromise(function(_0x155601,_0x4b30f6){return client[_0x693e('0x9')](_0x520113,_0x57897c)[_0x693e('0xa')](function(_0x14b901){logger['info'](_0x693e('0xb'),_0x577dcb,'request\x20sent');logger[_0x693e('0xc')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x577dcb,_0x693e('0xd'),JSON['stringify'](_0x14b901));if(_0x14b901['error']){if(_0x14b901[_0x693e('0xe')][_0x693e('0xf')]===0x1f4){logger[_0x693e('0xe')](_0x693e('0xb'),_0x577dcb,_0x14b901['error'][_0x693e('0x10')]);return _0x4b30f6(_0x14b901[_0x693e('0xe')][_0x693e('0x10')]);}logger[_0x693e('0xe')](_0x693e('0xb'),_0x577dcb,_0x14b901[_0x693e('0xe')][_0x693e('0x10')]);return _0x155601(_0x14b901['error'][_0x693e('0x10')]);}else{logger[_0x693e('0x11')](_0x693e('0xb'),_0x577dcb,'request\x20sent');_0x155601(_0x14b901[_0x693e('0x12')][_0x693e('0x10')]);}})[_0x693e('0x13')](function(_0xb3a90a){logger[_0x693e('0xe')](_0x693e('0xb'),_0x577dcb,_0xb3a90a);_0x4b30f6(_0xb3a90a);});});}exports[_0x693e('0x14')]=function(_0x4f4264){var _0x593916=this;return new Promise(function(_0x5e842f,_0x149325){return db[_0x693e('0x15')]['create'](_0x4f4264['body'],{'raw':_0x4f4264[_0x693e('0x16')]?_0x4f4264[_0x693e('0x16')][_0x693e('0x17')]===undefined?!![]:![]:!![]})[_0x693e('0xa')](function(_0x49614c){logger[_0x693e('0x11')](_0x693e('0x14'),_0x4f4264);logger[_0x693e('0xc')]('CreateSquareDetailsReport',_0x4f4264,JSON[_0x693e('0x18')](_0x49614c));_0x5e842f(_0x49614c);})[_0x693e('0x13')](function(_0x569646){logger[_0x693e('0xe')](_0x693e('0x14'),_0x569646['message'],_0x4f4264);_0x149325(_0x593916[_0x693e('0xe')](0x1f4,_0x569646[_0x693e('0x10')]));});});}; \ No newline at end of file +var _0xf4f4=['SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x48b9aa,_0x332e25){var _0x186c14=function(_0x3c79d3){while(--_0x3c79d3){_0x48b9aa['push'](_0x48b9aa['shift']());}};_0x186c14(++_0x332e25);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x1b11e4,_0x4af9ae){_0x1b11e4=_0x1b11e4-0x0;var _0x28d646=_0xf4f4[_0x1b11e4];return _0x28d646;};'use strict';var _=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var moment=require('moment');var BPromise=require(_0x4f4f('0x2'));var rs=require(_0x4f4f('0x3'));var fs=require('fs');var Redis=require(_0x4f4f('0x4'));var db=require(_0x4f4f('0x5'))['db'];var utils=require(_0x4f4f('0x6'));var logger=require('../../config/logger')(_0x4f4f('0x7'));var config=require('../../config/environment');var jayson=require(_0x4f4f('0x8'));var client=jayson[_0x4f4f('0x9')][_0x4f4f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ff75a,_0x3c4877,_0x249f8a){return new BPromise(function(_0x2faba9,_0x3768d7){return client['request'](_0x1ff75a,_0x249f8a)[_0x4f4f('0xb')](function(_0x38d110){logger[_0x4f4f('0xc')](_0x4f4f('0xd'),_0x3c4877,_0x4f4f('0xe'));logger[_0x4f4f('0xf')](_0x4f4f('0x10'),_0x3c4877,_0x4f4f('0xe'),JSON['stringify'](_0x38d110));if(_0x38d110['error']){if(_0x38d110[_0x4f4f('0x11')][_0x4f4f('0x12')]===0x1f4){logger[_0x4f4f('0x11')](_0x4f4f('0xd'),_0x3c4877,_0x38d110[_0x4f4f('0x11')][_0x4f4f('0x13')]);return _0x3768d7(_0x38d110['error'][_0x4f4f('0x13')]);}logger['error'](_0x4f4f('0xd'),_0x3c4877,_0x38d110[_0x4f4f('0x11')][_0x4f4f('0x13')]);return _0x2faba9(_0x38d110[_0x4f4f('0x11')]['message']);}else{logger[_0x4f4f('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x3c4877,'request\x20sent');_0x2faba9(_0x38d110['result'][_0x4f4f('0x13')]);}})[_0x4f4f('0x14')](function(_0x2d21ed){logger[_0x4f4f('0x11')](_0x4f4f('0xd'),_0x3c4877,_0x2d21ed);_0x3768d7(_0x2d21ed);});});}exports[_0x4f4f('0x15')]=function(_0x1245c4){var _0x60ce2=this;return new Promise(function(_0x929a0b,_0x2f9397){return db[_0x4f4f('0x16')][_0x4f4f('0x17')](_0x1245c4['body'],{'raw':_0x1245c4[_0x4f4f('0x18')]?_0x1245c4[_0x4f4f('0x18')][_0x4f4f('0x19')]===undefined?!![]:![]:!![]})[_0x4f4f('0xb')](function(_0x302a79){logger[_0x4f4f('0xc')](_0x4f4f('0x15'),_0x1245c4);logger[_0x4f4f('0xf')](_0x4f4f('0x15'),_0x1245c4,JSON[_0x4f4f('0x1a')](_0x302a79));_0x929a0b(_0x302a79);})[_0x4f4f('0x14')](function(_0x17832f){logger[_0x4f4f('0x11')](_0x4f4f('0x15'),_0x17832f['message'],_0x1245c4);_0x2f9397(_0x60ce2['error'](0x1f4,_0x17832f['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index eeccd78..2c580d9 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 _0xc4c1=['/process/:pid/kill','killProcess','express','./system.controller','get','isAuthenticated','index'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc4c1,0x175));var _0x1c4c=function(_0x4f5028,_0x5de30a){_0x4f5028=_0x4f5028-0x0;var _0x21dfb4=_0xc4c1[_0x4f5028];return _0x21dfb4;};'use strict';var express=require(_0x1c4c('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x1c4c('0x1'));router[_0x1c4c('0x2')]('/',auth[_0x1c4c('0x3')](),controller[_0x1c4c('0x4')]);router[_0x1c4c('0x2')](_0x1c4c('0x5'),auth[_0x1c4c('0x3')](),controller[_0x1c4c('0x6')]);module['exports']=router; \ No newline at end of file +var _0x2724=['isAuthenticated','get','/process/:pid/kill','killProcess','express','Router','./system.controller'];(function(_0x5701a3,_0x1eae7f){var _0x46fd7f=function(_0x258fd6){while(--_0x258fd6){_0x5701a3['push'](_0x5701a3['shift']());}};_0x46fd7f(++_0x1eae7f);}(_0x2724,0xdd));var _0x4272=function(_0x45fa78,_0x4cb740){_0x45fa78=_0x45fa78-0x0;var _0x42d2cc=_0x2724[_0x45fa78];return _0x42d2cc;};'use strict';var express=require(_0x4272('0x0'));var router=express[_0x4272('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x4272('0x2'));router['get']('/',auth[_0x4272('0x3')](),controller['index']);router[_0x4272('0x4')](_0x4272('0x5'),auth['isAuthenticated'](),controller[_0x4272('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index e10e536..e831f72 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 _0x8f9f=['catch','systeminformation','child_process','../../config/logger','api','util','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','index','getAllData','then','status','json','killProcess','components/import/cm','pid','split','format','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','params','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly'];(function(_0x2b7293,_0x47d350){var _0x44a2a5=function(_0x1ef6a6){while(--_0x1ef6a6){_0x2b7293['push'](_0x2b7293['shift']());}};_0x44a2a5(++_0x47d350);}(_0x8f9f,0xeb));var _0xf8f9=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x8f9f[_0xfae23b];return _0x200640;};'use strict';var info=require(_0xf8f9('0x0'));var exec=require(_0xf8f9('0x1'))['exec'];var logger=require(_0xf8f9('0x2'))(_0xf8f9('0x3'));var util=require(_0xf8f9('0x4'));var BPromise=require('bluebird');var _=require(_0xf8f9('0x5'));function handleError(_0x3b43c3,_0x17e9a7,_0x20ca37){_0x17e9a7=_0x17e9a7||0x1f4;return function(_0x1f0cc4){logger[_0xf8f9('0x6')](_0xf8f9('0x7'),_0x20ca37,_0x17e9a7,util[_0xf8f9('0x8')](_0x1f0cc4,{'showHidden':![],'depth':null}));delete _0x1f0cc4[_0xf8f9('0x9')];_0x3b43c3['status'](_0x17e9a7)['send'](_0x1f0cc4);};}exports[_0xf8f9('0xa')]=function(_0xbaae1e,_0x459ce8){return info[_0xf8f9('0xb')]()[_0xf8f9('0xc')](function(_0x4023ac){return _0x459ce8[_0xf8f9('0xd')](0xc8)[_0xf8f9('0xe')](_0x4023ac);})['catch'](function(_0xe4f627){return _0x459ce8[_0xf8f9('0xd')](0x1f4)['json'](_0xe4f627);});};exports[_0xf8f9('0xf')]=function(_0x422f1a,_0x33655a){var _0x10d569=[_0xf8f9('0x10')];return new BPromise(function(_0x460d22,_0x5e2e20){return exec(util['format']('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x422f1a['params'][_0xf8f9('0x11')]),function(_0x3f891b,_0x21dfc8,_0x1aafee){if(_0x3f891b){return _0x5e2e20(_0x3f891b);}return _0x460d22(_0x21dfc8);});})[_0xf8f9('0xc')](function(_0x190ff9){var _0x498584=![];var _0x370a5b=_0x190ff9[_0xf8f9('0x12')](/\n/);for(var _0x48f9cf=0x0,_0x25d7cd=_0x10d569['length'];_0x48f9cf<_0x25d7cd,_0x498584===![];_0x48f9cf+=0x1){if(_0x190ff9['indexOf'](_0x10d569[_0x48f9cf])>=0x0){_0x498584=!![];}}if(!_0x498584){throw new Error(util[_0xf8f9('0x13')](_0xf8f9('0x14'),_0x422f1a['params'][_0xf8f9('0x11')]));}process[_0xf8f9('0x15')](_0x422f1a[_0xf8f9('0x16')][_0xf8f9('0x11')],_0xf8f9('0x17'));return _0x33655a['status'](0xc8)[_0xf8f9('0xe')]({'message':util[_0xf8f9('0x13')](_0xf8f9('0x18'),_0x422f1a['params'][_0xf8f9('0x11')])});})[_0xf8f9('0x19')](handleError(_0x33655a,null,_0xf8f9('0xf')));}; \ No newline at end of file +var _0x5cf2=['index','getAllData','then','catch','json','killProcess','components/import/cm','format','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status','send'];(function(_0x3e364e,_0x174a31){var _0x2a528a=function(_0x3d2c09){while(--_0x3d2c09){_0x3e364e['push'](_0x3e364e['shift']());}};_0x2a528a(++_0x174a31);}(_0x5cf2,0x11d));var _0x25cf=function(_0x38622b,_0x3cfdf7){_0x38622b=_0x38622b-0x0;var _0x2c1a7a=_0x5cf2[_0x38622b];return _0x2c1a7a;};'use strict';var info=require(_0x25cf('0x0'));var exec=require(_0x25cf('0x1'))[_0x25cf('0x2')];var logger=require(_0x25cf('0x3'))(_0x25cf('0x4'));var util=require(_0x25cf('0x5'));var BPromise=require(_0x25cf('0x6'));var _=require(_0x25cf('0x7'));function handleError(_0xca65e8,_0x52dc0c,_0x3c1412){_0x52dc0c=_0x52dc0c||0x1f4;return function(_0x1deda4){logger['error'](_0x25cf('0x8'),_0x3c1412,_0x52dc0c,util['inspect'](_0x1deda4,{'showHidden':![],'depth':null}));delete _0x1deda4[_0x25cf('0x9')];_0xca65e8[_0x25cf('0xa')](_0x52dc0c)[_0x25cf('0xb')](_0x1deda4);};}exports[_0x25cf('0xc')]=function(_0x6bd16c,_0x192a92){return info[_0x25cf('0xd')]()[_0x25cf('0xe')](function(_0x2fe5af){return _0x192a92[_0x25cf('0xa')](0xc8)['json'](_0x2fe5af);})[_0x25cf('0xf')](function(_0x1f3c79){return _0x192a92[_0x25cf('0xa')](0x1f4)[_0x25cf('0x10')](_0x1f3c79);});};exports[_0x25cf('0x11')]=function(_0x18a4eb,_0x4b7e24){var _0x13dba4=[_0x25cf('0x12')];return new BPromise(function(_0xdfbf74,_0x5d2ec){return exec(util[_0x25cf('0x13')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x18a4eb['params'][_0x25cf('0x14')]),function(_0xd2a5ad,_0x107b39,_0x562a29){if(_0xd2a5ad){return _0x5d2ec(_0xd2a5ad);}return _0xdfbf74(_0x107b39);});})[_0x25cf('0xe')](function(_0x53e425){var _0x56e0f6=![];var _0x9678cc=_0x53e425[_0x25cf('0x15')](/\n/);for(var _0x32653e=0x0,_0x38dccf=_0x13dba4[_0x25cf('0x16')];_0x32653e<_0x38dccf,_0x56e0f6===![];_0x32653e+=0x1){if(_0x53e425[_0x25cf('0x17')](_0x13dba4[_0x32653e])>=0x0){_0x56e0f6=!![];}}if(!_0x56e0f6){throw new Error(util['format'](_0x25cf('0x18'),_0x18a4eb[_0x25cf('0x19')][_0x25cf('0x14')]));}process['kill'](_0x18a4eb['params'][_0x25cf('0x14')],'SIGINT');return _0x4b7e24['status'](0xc8)[_0x25cf('0x10')]({'message':util[_0x25cf('0x13')](_0x25cf('0x1a'),_0x18a4eb['params'][_0x25cf('0x14')])});})[_0x25cf('0xf')](handleError(_0x4b7e24,null,_0x25cf('0x11')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 779baef..da509cd 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 _0x6afd=['isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','util','path','Router','fs-extra','../../config/environment','./tag.controller','get'];(function(_0x30dbc9,_0x1eeea3){var _0x6bb5c3=function(_0x4c2208){while(--_0x4c2208){_0x30dbc9['push'](_0x30dbc9['shift']());}};_0x6bb5c3(++_0x1eeea3);}(_0x6afd,0xe3));var _0xd6af=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0x6afd[_0x4e1d03];return _0x362d4b;};'use strict';var multer=require('multer');var util=require(_0xd6af('0x0'));var path=require(_0xd6af('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd6af('0x2')]();var fs_extra=require(_0xd6af('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd6af('0x4'));var controller=require(_0xd6af('0x5'));router[_0xd6af('0x6')]('/',auth[_0xd6af('0x7')](),controller[_0xd6af('0x8')]);router[_0xd6af('0x6')]('/:id',auth[_0xd6af('0x7')](),controller[_0xd6af('0x9')]);router[_0xd6af('0xa')]('/',auth[_0xd6af('0x7')](),controller[_0xd6af('0xb')]);router[_0xd6af('0xc')](_0xd6af('0xd'),auth[_0xd6af('0x7')](),controller[_0xd6af('0xe')]);router[_0xd6af('0xf')](_0xd6af('0xd'),auth[_0xd6af('0x7')](),controller[_0xd6af('0x10')]);module[_0xd6af('0x11')]=router; \ No newline at end of file +var _0x45c2=['Router','fs-extra','../../components/auth/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','show','post','create','update','destroy','multer','util','path','connect-timeout'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x45c2,0x68));var _0x245c=function(_0x4498ac,_0x30e301){_0x4498ac=_0x4498ac-0x0;var _0x4bf1b6=_0x45c2[_0x4498ac];return _0x4bf1b6;};'use strict';var multer=require(_0x245c('0x0'));var util=require(_0x245c('0x1'));var path=require(_0x245c('0x2'));var timeout=require(_0x245c('0x3'));var express=require('express');var router=express[_0x245c('0x4')]();var fs_extra=require(_0x245c('0x5'));var auth=require(_0x245c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x245c('0x7'));var controller=require(_0x245c('0x8'));router[_0x245c('0x9')]('/',auth[_0x245c('0xa')](),controller[_0x245c('0xb')]);router[_0x245c('0x9')](_0x245c('0xc'),auth[_0x245c('0xa')](),controller[_0x245c('0xd')]);router[_0x245c('0xe')]('/',auth[_0x245c('0xa')](),controller[_0x245c('0xf')]);router['put'](_0x245c('0xc'),auth[_0x245c('0xa')](),controller[_0x245c('0x10')]);router['delete']('/:id',auth[_0x245c('0xa')](),controller[_0x245c('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 138032d..afd9e2b 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 _0x7462=['sequelize','exports','STRING'];(function(_0x2a8c4e,_0x3fc720){var _0x387af6=function(_0x488e19){while(--_0x488e19){_0x2a8c4e['push'](_0x2a8c4e['shift']());}};_0x387af6(++_0x3fc720);}(_0x7462,0x165));var _0x2746=function(_0x47e549,_0x2e53d6){_0x47e549=_0x47e549-0x0;var _0x251374=_0x7462[_0x47e549];return _0x251374;};'use strict';var Sequelize=require(_0x2746('0x0'));module[_0x2746('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x2746('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb846=['sequelize','name','STRING','#0091EA'];(function(_0x483859,_0x151813){var _0x578ade=function(_0x59d589){while(--_0x59d589){_0x483859['push'](_0x483859['shift']());}};_0x578ade(++_0x151813);}(_0xb846,0x1d0));var _0x6b84=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xb846[_0x1d24eb];return _0x1dc576;};'use strict';var Sequelize=require(_0x6b84('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x6b84('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x6b84('0x2')],'defaultValue':_0x6b84('0x3')},'description':{'type':Sequelize[_0x6b84('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 5518920..77f1e30 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(_0x43be4b,_0x22e6a0){var _0x36c8e5=function(_0x2ece66){while(--_0x2ece66){_0x43be4b['push'](_0x43be4b['shift']());}};_0x36c8e5(++_0x22e6a0);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x4fec20,_0x5120f9){_0x4fec20=_0x4fec20-0x0;var _0x32192e=_0x4fdb[_0x4fec20];return _0x32192e;};'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 _0x2750=['sendStatus','status','end','json','undefined','limit','count','offset','set','reject','save','update','destroy','then','get','Tags','UserProfileResource','error','stack','name','send','map','Tag','fieldName','type','key','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','keys','length','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x159e85,_0x581012){var _0x3fd0ae=function(_0x18869b){while(--_0x18869b){_0x159e85['push'](_0x159e85['shift']());}};_0x3fd0ae(++_0x581012);}(_0x2750,0x13b));var _0x0275=function(_0x4352cf,_0x108059){_0x4352cf=_0x4352cf-0x0;var _0x2a7510=_0x2750[_0x4352cf];return _0x2a7510;};'use strict';var emlformat=require(_0x0275('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0275('0x1'));var jsonpatch=require(_0x0275('0x2'));var rp=require(_0x0275('0x3'));var moment=require(_0x0275('0x4'));var BPromise=require(_0x0275('0x5'));var Mustache=require(_0x0275('0x6'));var util=require(_0x0275('0x7'));var path=require(_0x0275('0x8'));var sox=require(_0x0275('0x9'));var csv=require(_0x0275('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0275('0xb'));var _=require(_0x0275('0xc'));var squel=require(_0x0275('0xd'));var crypto=require(_0x0275('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0275('0xf'));var toCsv=require(_0x0275('0xa'));var querystring=require(_0x0275('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0275('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0275('0x12'));var hardwareService=require(_0x0275('0x13'));var logger=require(_0x0275('0x14'))(_0x0275('0x15'));var utils=require(_0x0275('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0275('0x17'));var db=require(_0x0275('0x18'))['db'];function respondWithStatusCode(_0x1f128d,_0x4c6ee0){_0x4c6ee0=_0x4c6ee0||0xcc;return function(_0x55ffd6){if(_0x55ffd6){return _0x1f128d[_0x0275('0x19')](_0x4c6ee0);}return _0x1f128d[_0x0275('0x1a')](_0x4c6ee0)[_0x0275('0x1b')]();};}function respondWithResult(_0x46a729,_0x28827b){_0x28827b=_0x28827b||0xc8;return function(_0x36921c){if(_0x36921c){return _0x46a729['status'](_0x28827b)[_0x0275('0x1c')](_0x36921c);}};}function respondWithFilteredResult(_0x3030c0,_0x4aa412){return function(_0x6344fc){if(_0x6344fc){var _0xaae367=typeof _0x4aa412['offset']===_0x0275('0x1d')&&typeof _0x4aa412[_0x0275('0x1e')]==='undefined';var _0x5e7466=_0x6344fc['count'];var _0x591d27=_0xaae367?0x0:_0x4aa412['offset'];var _0x566ad6=_0xaae367?_0x6344fc[_0x0275('0x1f')]:_0x4aa412[_0x0275('0x20')]+_0x4aa412['limit'];var _0x7075c9;if(_0x566ad6>=_0x5e7466){_0x566ad6=_0x5e7466;_0x7075c9=0xc8;}else{_0x7075c9=0xce;}_0x3030c0[_0x0275('0x1a')](_0x7075c9);return _0x3030c0[_0x0275('0x21')]('Content-Range',_0x591d27+'-'+_0x566ad6+'/'+_0x5e7466)[_0x0275('0x1c')](_0x6344fc);}return null;};}function patchUpdates(_0x402f0d){return function(_0x575786){try{jsonpatch['apply'](_0x575786,_0x402f0d,!![]);}catch(_0x31ba9e){return BPromise[_0x0275('0x22')](_0x31ba9e);}return _0x575786[_0x0275('0x23')]();};}function saveUpdates(_0x592a53,_0xf3b68e){return function(_0x5ab9e7){if(_0x5ab9e7){return _0x5ab9e7[_0x0275('0x24')](_0x592a53)['then'](function(_0x26f2c2){return _0x26f2c2;});}return null;};}function removeEntity(_0xfa0081,_0x594321){return function(_0x140a18){if(_0x140a18){return _0x140a18[_0x0275('0x25')]()[_0x0275('0x26')](function(){var _0x52946b=_0x140a18[_0x0275('0x27')]({'plain':!![]});var _0x44bbf8=_0x0275('0x28');return db[_0x0275('0x29')][_0x0275('0x25')]({'where':{'type':_0x44bbf8,'resourceId':_0x52946b['id']}})[_0x0275('0x26')](function(){return _0x140a18;});})['then'](function(){_0xfa0081[_0x0275('0x1a')](0xcc)[_0x0275('0x1b')]();});}};}function handleEntityNotFound(_0x1d24b2,_0x275dac){return function(_0x4689a3){if(!_0x4689a3){_0x1d24b2['sendStatus'](0x194);}return _0x4689a3;};}function handleError(_0x1ffd57,_0xd59d69){_0xd59d69=_0xd59d69||0x1f4;return function(_0x3246ea){logger[_0x0275('0x2a')](_0x3246ea[_0x0275('0x2b')]);if(_0x3246ea['name']){delete _0x3246ea[_0x0275('0x2c')];}_0x1ffd57[_0x0275('0x1a')](_0xd59d69)[_0x0275('0x2d')](_0x3246ea);};}exports['index']=function(_0x5e2e22,_0x3cb2d7){var _0x299190={},_0x5dc2bc={},_0x7eff96={'count':0x0,'rows':[]};var _0x155a50=_[_0x0275('0x2e')](db[_0x0275('0x2f')]['rawAttributes'],function(_0x24c762){return{'name':_0x24c762[_0x0275('0x30')],'type':_0x24c762[_0x0275('0x31')][_0x0275('0x32')]};});_0x5dc2bc['model']=_[_0x0275('0x2e')](_0x155a50,'name');_0x5dc2bc[_0x0275('0x33')]=_['keys'](_0x5e2e22[_0x0275('0x33')]);_0x5dc2bc[_0x0275('0x34')]=_['intersection'](_0x5dc2bc[_0x0275('0x35')],_0x5dc2bc[_0x0275('0x33')]);_0x299190[_0x0275('0x36')]=_[_0x0275('0x37')](_0x5dc2bc['model'],qs[_0x0275('0x38')](_0x5e2e22[_0x0275('0x33')][_0x0275('0x38')]));_0x299190[_0x0275('0x36')]=_0x299190[_0x0275('0x36')]['length']?_0x299190[_0x0275('0x36')]:_0x5dc2bc[_0x0275('0x35')];if(!_0x5e2e22[_0x0275('0x33')][_0x0275('0x39')](_0x0275('0x3a'))){_0x299190[_0x0275('0x1e')]=qs[_0x0275('0x1e')](_0x5e2e22[_0x0275('0x33')][_0x0275('0x1e')]);_0x299190[_0x0275('0x20')]=qs[_0x0275('0x20')](_0x5e2e22['query'][_0x0275('0x20')]);}_0x299190[_0x0275('0x3b')]=qs[_0x0275('0x3c')](_0x5e2e22[_0x0275('0x33')][_0x0275('0x3c')]);_0x299190[_0x0275('0x3d')]=qs[_0x0275('0x34')](_[_0x0275('0x3e')](_0x5e2e22[_0x0275('0x33')],_0x5dc2bc[_0x0275('0x34')]),_0x155a50);if(_0x5e2e22[_0x0275('0x33')][_0x0275('0x3f')]){_0x299190[_0x0275('0x3d')]=_[_0x0275('0x40')](_0x299190['where'],{'$or':_[_0x0275('0x2e')](_0x155a50,function(_0x1cc40d){if(_0x1cc40d['type']!==_0x0275('0x41')){var _0x76b8fa={};_0x76b8fa[_0x1cc40d[_0x0275('0x2c')]]={'$like':'%'+_0x5e2e22[_0x0275('0x33')][_0x0275('0x3f')]+'%'};return _0x76b8fa;}})});}_0x299190=_[_0x0275('0x40')]({},_0x299190,_0x5e2e22[_0x0275('0x42')]);var _0x5e57b5={'where':_0x299190[_0x0275('0x3d')]};return db[_0x0275('0x2f')][_0x0275('0x1f')](_0x5e57b5)[_0x0275('0x26')](function(_0x4f888c){_0x7eff96[_0x0275('0x1f')]=_0x4f888c;if(_0x5e2e22[_0x0275('0x33')][_0x0275('0x43')]){_0x299190[_0x0275('0x44')]=[{'all':!![]}];}return db['Tag'][_0x0275('0x45')](_0x299190);})['then'](function(_0x261e66){_0x7eff96[_0x0275('0x46')]=_0x261e66;return _0x7eff96;})[_0x0275('0x26')](respondWithFilteredResult(_0x3cb2d7,_0x299190))[_0x0275('0x47')](handleError(_0x3cb2d7,null));};exports['show']=function(_0x13c651,_0x3d1bfc){var _0x59839d={'raw':!![],'where':{'id':_0x13c651[_0x0275('0x48')]['id']}},_0x1e143e={};_0x1e143e[_0x0275('0x35')]=_['keys'](db[_0x0275('0x2f')][_0x0275('0x49')]);_0x1e143e['query']=_[_0x0275('0x4a')](_0x13c651[_0x0275('0x33')]);_0x1e143e[_0x0275('0x34')]=_[_0x0275('0x37')](_0x1e143e[_0x0275('0x35')],_0x1e143e[_0x0275('0x33')]);_0x59839d[_0x0275('0x36')]=_[_0x0275('0x37')](_0x1e143e[_0x0275('0x35')],qs[_0x0275('0x38')](_0x13c651[_0x0275('0x33')]['fields']));_0x59839d[_0x0275('0x36')]=_0x59839d[_0x0275('0x36')][_0x0275('0x4b')]?_0x59839d[_0x0275('0x36')]:_0x1e143e[_0x0275('0x35')];if(_0x13c651[_0x0275('0x33')][_0x0275('0x43')]){_0x59839d[_0x0275('0x44')]=[{'all':!![]}];}_0x59839d=_[_0x0275('0x40')]({},_0x59839d,_0x13c651[_0x0275('0x42')]);return db[_0x0275('0x2f')]['find'](_0x59839d)['then'](handleEntityNotFound(_0x3d1bfc,null))[_0x0275('0x26')](respondWithResult(_0x3d1bfc,null))[_0x0275('0x47')](handleError(_0x3d1bfc,null));};exports[_0x0275('0x4c')]=function(_0x3bd019,_0x310c6b){return db['Tag'][_0x0275('0x4c')](_0x3bd019['body'],{})[_0x0275('0x26')](function(_0x17dde0){var _0x27a469=_0x3bd019[_0x0275('0x4d')]['get']({'plain':!![]});if(!_0x27a469)throw new Error(_0x0275('0x4e'));if(_0x27a469['role']==='user'){var _0x515860=_0x17dde0[_0x0275('0x27')]({'plain':!![]});var _0x4e36fc=_0x0275('0x28');return db[_0x0275('0x4f')][_0x0275('0x50')]({'where':{'name':_0x4e36fc,'userProfileId':_0x27a469[_0x0275('0x51')]},'raw':!![]})[_0x0275('0x26')](function(_0x11794b){if(_0x11794b&&_0x11794b[_0x0275('0x52')]===0x0){return db['UserProfileResource'][_0x0275('0x4c')]({'name':_0x515860['name'],'resourceId':_0x515860['id'],'type':_0x11794b[_0x0275('0x2c')],'sectionId':_0x11794b['id']},{})[_0x0275('0x26')](function(){return _0x17dde0;});}else{return _0x17dde0;}})[_0x0275('0x47')](function(_0x1686d9){logger[_0x0275('0x2a')](_0x0275('0x53'),_0x1686d9);throw _0x1686d9;});}return _0x17dde0;})[_0x0275('0x26')](respondWithResult(_0x310c6b,0xc9))[_0x0275('0x47')](handleError(_0x310c6b,null));};exports[_0x0275('0x24')]=function(_0x3673ad,_0x545333){if(_0x3673ad['body']['id']){delete _0x3673ad[_0x0275('0x54')]['id'];}return db['Tag']['find']({'where':{'id':_0x3673ad[_0x0275('0x48')]['id']}})[_0x0275('0x26')](handleEntityNotFound(_0x545333,null))[_0x0275('0x26')](saveUpdates(_0x3673ad[_0x0275('0x54')],null))[_0x0275('0x26')](respondWithResult(_0x545333,null))[_0x0275('0x47')](handleError(_0x545333,null));};exports['destroy']=function(_0x104232,_0x163ce2){return db[_0x0275('0x2f')][_0x0275('0x50')]({'where':{'id':_0x104232[_0x0275('0x48')]['id']}})[_0x0275('0x26')](handleEntityNotFound(_0x163ce2,null))['then'](removeEntity(_0x163ce2,null))[_0x0275('0x47')](handleError(_0x163ce2,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 600e278..168f666 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 _0xa96f=['Tag','tools_tags','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./tag.attributes','exports','define'];(function(_0x31cc91,_0x45e9c8){var _0x18f46f=function(_0x3106fc){while(--_0x3106fc){_0x31cc91['push'](_0x31cc91['shift']());}};_0x18f46f(++_0x45e9c8);}(_0xa96f,0x13a));var _0xfa96=function(_0x28d7b5,_0x1305a4){_0x28d7b5=_0x28d7b5-0x0;var _0x1ed035=_0xa96f[_0x28d7b5];return _0x1ed035;};'use strict';var _=require(_0xfa96('0x0'));var util=require(_0xfa96('0x1'));var logger=require(_0xfa96('0x2'))('api');var moment=require(_0xfa96('0x3'));var BPromise=require(_0xfa96('0x4'));var rp=require(_0xfa96('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfa96('0x6'));var config=require(_0xfa96('0x7'));var attributes=require(_0xfa96('0x8'));module[_0xfa96('0x9')]=function(_0x49d99d,_0x52c94e){return _0x49d99d[_0xfa96('0xa')](_0xfa96('0xb'),attributes,{'tableName':_0xfa96('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa588=['exports','define','Tag','tools_tags','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x232fda,_0x2bb751){var _0x493482=function(_0x484325){while(--_0x484325){_0x232fda['push'](_0x232fda['shift']());}};_0x493482(++_0x2bb751);}(_0xa588,0xe1));var _0x8a58=function(_0x22ed4b,_0x20609c){_0x22ed4b=_0x22ed4b-0x0;var _0x4e9cf6=_0xa588[_0x22ed4b];return _0x4e9cf6;};'use strict';var _=require('lodash');var util=require(_0x8a58('0x0'));var logger=require(_0x8a58('0x1'))(_0x8a58('0x2'));var moment=require(_0x8a58('0x3'));var BPromise=require(_0x8a58('0x4'));var rp=require(_0x8a58('0x5'));var fs=require('fs');var path=require(_0x8a58('0x6'));var rimraf=require(_0x8a58('0x7'));var config=require(_0x8a58('0x8'));var attributes=require('./tag.attributes');module[_0x8a58('0x9')]=function(_0x408a4a,_0x448366){return _0x408a4a[_0x8a58('0xa')](_0x8a58('0xb'),attributes,{'tableName':_0x8a58('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index c4d797a..f44b6f7 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 _0x5c12=['../../config/environment','client','http','request','then','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','error','message','info','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x146484,_0x27a7f0){var _0x4c7aa3=function(_0x481b98){while(--_0x481b98){_0x146484['push'](_0x146484['shift']());}};_0x4c7aa3(++_0x27a7f0);}(_0x5c12,0x188));var _0x25c1=function(_0x280f4a,_0x2ed8d6){_0x280f4a=_0x280f4a-0x0;var _0x1bb157=_0x5c12[_0x280f4a];return _0x1bb157;};'use strict';var _=require('lodash');var util=require(_0x25c1('0x0'));var moment=require(_0x25c1('0x1'));var BPromise=require('bluebird');var rs=require(_0x25c1('0x2'));var fs=require('fs');var Redis=require(_0x25c1('0x3'));var db=require(_0x25c1('0x4'))['db'];var utils=require(_0x25c1('0x5'));var logger=require(_0x25c1('0x6'))(_0x25c1('0x7'));var config=require(_0x25c1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x25c1('0x9')][_0x25c1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x382922,_0x4ab674,_0x5c69b1){return new BPromise(function(_0x24981c,_0x3b69ba){return client[_0x25c1('0xb')](_0x382922,_0x5c69b1)[_0x25c1('0xc')](function(_0xf8363f){logger['info'](_0x25c1('0xd'),_0x4ab674,_0x25c1('0xe'));logger[_0x25c1('0xf')](_0x25c1('0x10'),_0x4ab674,_0x25c1('0xe'),JSON['stringify'](_0xf8363f));if(_0xf8363f[_0x25c1('0x11')]){if(_0xf8363f[_0x25c1('0x11')]['code']===0x1f4){logger[_0x25c1('0x11')](_0x25c1('0xd'),_0x4ab674,_0xf8363f[_0x25c1('0x11')][_0x25c1('0x12')]);return _0x3b69ba(_0xf8363f['error']['message']);}logger['error']('Tag,\x20%s,\x20%s',_0x4ab674,_0xf8363f[_0x25c1('0x11')][_0x25c1('0x12')]);return _0x24981c(_0xf8363f[_0x25c1('0x11')][_0x25c1('0x12')]);}else{logger[_0x25c1('0x13')]('Tag,\x20%s,\x20%s',_0x4ab674,_0x25c1('0xe'));_0x24981c(_0xf8363f['result']['message']);}})['catch'](function(_0x284712){logger[_0x25c1('0x11')]('Tag,\x20%s,\x20%s',_0x4ab674,_0x284712);_0x3b69ba(_0x284712);});});} \ No newline at end of file +var _0xa41a=['rpc','../../config/environment','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1a95ef,_0x221aa1){var _0x36fc34=function(_0x319ce2){while(--_0x319ce2){_0x1a95ef['push'](_0x1a95ef['shift']());}};_0x36fc34(++_0x221aa1);}(_0xa41a,0x6b));var _0xaa41=function(_0x41cec0,_0x54342c){_0x41cec0=_0x41cec0-0x0;var _0x144f54=_0xa41a[_0x41cec0];return _0x144f54;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index a25a1c4..d31cc3c 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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 99573da..8406a83 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 _0xd8b0=['exports','sequelize'];(function(_0x52281a,_0x4031e1){var _0xf48fe0=function(_0x536d13){while(--_0x536d13){_0x52281a['push'](_0x52281a['shift']());}};_0xf48fe0(++_0x4031e1);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'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 diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index aca87f0..dbd1601 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 _0xa999=['sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','include','find','create','body','user','get','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','ChatQueueId','UserChatQueue','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','UserVoicePrefix','VoicePrefixId','Teams','send','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','toLowerCase','capitalize','Queues','addQueues','ids','removeQueues','remove','addAgents','isArray','Voice','Chat','Sms','Fax','Openchannel','Whatsapp','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','voicePause','UserVoiceQueueRt','upsert','format','interface','all','removeAgents','Mail','Queue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','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','./team.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','error','stack','name','map','Team','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa999,0xf4));var _0x9a99=function(_0x26aede,_0x18414f){_0x26aede=_0x26aede-0x0;var _0x1ec5c3=_0xa999[_0x26aede];return _0x1ec5c3;};'use strict';var emlformat=require(_0x9a99('0x0'));var rimraf=require(_0x9a99('0x1'));var zipdir=require(_0x9a99('0x2'));var jsonpatch=require(_0x9a99('0x3'));var rp=require(_0x9a99('0x4'));var moment=require(_0x9a99('0x5'));var BPromise=require(_0x9a99('0x6'));var Mustache=require(_0x9a99('0x7'));var util=require('util');var path=require(_0x9a99('0x8'));var sox=require(_0x9a99('0x9'));var csv=require(_0x9a99('0xa'));var ejs=require(_0x9a99('0xb'));var fs=require('fs');var fs_extra=require(_0x9a99('0xc'));var _=require('lodash');var squel=require(_0x9a99('0xd'));var crypto=require('crypto');var jsforce=require(_0x9a99('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9a99('0xa'));var querystring=require(_0x9a99('0xf'));var Papa=require(_0x9a99('0x10'));var Redis=require(_0x9a99('0x11'));var authService=require(_0x9a99('0x12'));var qs=require(_0x9a99('0x13'));var as=require(_0x9a99('0x14'));var hardwareService=require(_0x9a99('0x15'));var logger=require(_0x9a99('0x16'))(_0x9a99('0x17'));var utils=require(_0x9a99('0x18'));var config=require(_0x9a99('0x19'));var licenseUtil=require(_0x9a99('0x1a'));var db=require(_0x9a99('0x1b'))['db'];config[_0x9a99('0x1c')]=_[_0x9a99('0x1d')](config[_0x9a99('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x9a99('0x1e'))(new Redis(config[_0x9a99('0x1c')]));require(_0x9a99('0x1f'))[_0x9a99('0x20')](socket);function respondWithStatusCode(_0x3f8bee,_0x345a70){_0x345a70=_0x345a70||0xcc;return function(_0x17de06){if(_0x17de06){return _0x3f8bee[_0x9a99('0x21')](_0x345a70);}return _0x3f8bee[_0x9a99('0x22')](_0x345a70)[_0x9a99('0x23')]();};}function respondWithResult(_0x322e51,_0x214cc9){_0x214cc9=_0x214cc9||0xc8;return function(_0x25ffd8){if(_0x25ffd8){return _0x322e51['status'](_0x214cc9)[_0x9a99('0x24')](_0x25ffd8);}};}function respondWithFilteredResult(_0x38f60d,_0x4b112c){return function(_0x501d44){if(_0x501d44){var _0x5e44b4=typeof _0x4b112c[_0x9a99('0x25')]===_0x9a99('0x26')&&typeof _0x4b112c['limit']===_0x9a99('0x26');var _0x258626=_0x501d44[_0x9a99('0x27')];var _0x1cb540=_0x5e44b4?0x0:_0x4b112c[_0x9a99('0x25')];var _0x5dadf4=_0x5e44b4?_0x501d44['count']:_0x4b112c[_0x9a99('0x25')]+_0x4b112c[_0x9a99('0x28')];var _0x5d48d0;if(_0x5dadf4>=_0x258626){_0x5dadf4=_0x258626;_0x5d48d0=0xc8;}else{_0x5d48d0=0xce;}_0x38f60d['status'](_0x5d48d0);return _0x38f60d[_0x9a99('0x29')](_0x9a99('0x2a'),_0x1cb540+'-'+_0x5dadf4+'/'+_0x258626)[_0x9a99('0x24')](_0x501d44);}return null;};}function patchUpdates(_0x569c2d){return function(_0x12af9b){try{jsonpatch[_0x9a99('0x2b')](_0x12af9b,_0x569c2d,!![]);}catch(_0x1bac1c){return BPromise['reject'](_0x1bac1c);}return _0x12af9b[_0x9a99('0x2c')]();};}function saveUpdates(_0x20825e,_0x4f3ceb){return function(_0x4aacbd){if(_0x4aacbd){return _0x4aacbd['update'](_0x20825e)[_0x9a99('0x2d')](function(_0x4ec9c4){return _0x4ec9c4;});}return null;};}function handleEntityNotFound(_0x4fd676,_0x56e74d){return function(_0x522d5a){if(!_0x522d5a){_0x4fd676[_0x9a99('0x21')](0x194);}return _0x522d5a;};}function handleError(_0x186a2d,_0x58447f){_0x58447f=_0x58447f||0x1f4;return function(_0xb0c7e8){logger[_0x9a99('0x2e')](_0xb0c7e8[_0x9a99('0x2f')]);if(_0xb0c7e8[_0x9a99('0x30')]){delete _0xb0c7e8['name'];}_0x186a2d[_0x9a99('0x22')](_0x58447f)['send'](_0xb0c7e8);};}exports['index']=function(_0x6c3822,_0x4dcb27){var _0x1c6087={},_0x4067cb={},_0x3adbfa={'count':0x0,'rows':[]};var _0x4a1624=_[_0x9a99('0x31')](db[_0x9a99('0x32')][_0x9a99('0x33')],function(_0x124e03){return{'name':_0x124e03[_0x9a99('0x34')],'type':_0x124e03[_0x9a99('0x35')][_0x9a99('0x36')]};});_0x4067cb[_0x9a99('0x37')]=_[_0x9a99('0x31')](_0x4a1624,'name');_0x4067cb[_0x9a99('0x38')]=_[_0x9a99('0x39')](_0x6c3822[_0x9a99('0x38')]);_0x4067cb[_0x9a99('0x3a')]=_[_0x9a99('0x3b')](_0x4067cb['model'],_0x4067cb[_0x9a99('0x38')]);_0x1c6087[_0x9a99('0x3c')]=_['intersection'](_0x4067cb[_0x9a99('0x37')],qs[_0x9a99('0x3d')](_0x6c3822[_0x9a99('0x38')]['fields']));_0x1c6087[_0x9a99('0x3c')]=_0x1c6087[_0x9a99('0x3c')][_0x9a99('0x3e')]?_0x1c6087[_0x9a99('0x3c')]:_0x4067cb[_0x9a99('0x37')];if(!_0x6c3822['query'][_0x9a99('0x3f')](_0x9a99('0x40'))){_0x1c6087[_0x9a99('0x28')]=qs['limit'](_0x6c3822[_0x9a99('0x38')][_0x9a99('0x28')]);_0x1c6087[_0x9a99('0x25')]=qs[_0x9a99('0x25')](_0x6c3822[_0x9a99('0x38')][_0x9a99('0x25')]);}_0x1c6087[_0x9a99('0x41')]=qs[_0x9a99('0x42')](_0x6c3822[_0x9a99('0x38')]['sort']);_0x1c6087[_0x9a99('0x43')]=qs[_0x9a99('0x3a')](_[_0x9a99('0x44')](_0x6c3822[_0x9a99('0x38')],_0x4067cb['filters']),_0x4a1624);if(_0x6c3822[_0x9a99('0x38')][_0x9a99('0x45')]){_0x1c6087[_0x9a99('0x43')]=_[_0x9a99('0x46')](_0x1c6087[_0x9a99('0x43')],{'$or':_[_0x9a99('0x31')](_0x4a1624,function(_0x39c4fe){if(_0x39c4fe[_0x9a99('0x35')]!==_0x9a99('0x47')){var _0x530b0f={};_0x530b0f[_0x39c4fe[_0x9a99('0x30')]]={'$like':'%'+_0x6c3822['query'][_0x9a99('0x45')]+'%'};return _0x530b0f;}})});}_0x1c6087=_[_0x9a99('0x46')]({},_0x1c6087,_0x6c3822[_0x9a99('0x48')]);var _0x13970f={'where':_0x1c6087[_0x9a99('0x43')]};return db[_0x9a99('0x32')][_0x9a99('0x27')](_0x13970f)['then'](function(_0x202837){_0x3adbfa[_0x9a99('0x27')]=_0x202837;if(_0x6c3822['query'][_0x9a99('0x49')]){_0x1c6087['include']=[{'all':!![]}];}return db[_0x9a99('0x32')]['findAll'](_0x1c6087);})['then'](function(_0x1f8aa5){_0x3adbfa[_0x9a99('0x4a')]=_0x1f8aa5;return _0x3adbfa;})[_0x9a99('0x2d')](respondWithFilteredResult(_0x4dcb27,_0x1c6087))[_0x9a99('0x4b')](handleError(_0x4dcb27,null));};exports[_0x9a99('0x4c')]=function(_0x233758,_0x2f32c2){var _0x34016e={'raw':![],'where':{'id':_0x233758[_0x9a99('0x4d')]['id']}},_0x4b9c53={};_0x4b9c53[_0x9a99('0x37')]=_[_0x9a99('0x39')](db['Team']['rawAttributes']);_0x4b9c53['query']=_[_0x9a99('0x39')](_0x233758[_0x9a99('0x38')]);_0x4b9c53[_0x9a99('0x3a')]=_[_0x9a99('0x3b')](_0x4b9c53['model'],_0x4b9c53['query']);_0x34016e['attributes']=_[_0x9a99('0x3b')](_0x4b9c53['model'],qs[_0x9a99('0x3d')](_0x233758[_0x9a99('0x38')]['fields']));_0x34016e[_0x9a99('0x3c')]=_0x34016e[_0x9a99('0x3c')]['length']?_0x34016e['attributes']:_0x4b9c53[_0x9a99('0x37')];if(_0x233758[_0x9a99('0x38')][_0x9a99('0x49')]){_0x34016e[_0x9a99('0x4e')]=[{'all':!![]}];}_0x34016e=_['merge']({},_0x34016e,_0x233758[_0x9a99('0x48')]);return db[_0x9a99('0x32')][_0x9a99('0x4f')](_0x34016e)[_0x9a99('0x2d')](handleEntityNotFound(_0x2f32c2,null))[_0x9a99('0x2d')](respondWithResult(_0x2f32c2,null))[_0x9a99('0x4b')](handleError(_0x2f32c2,null));};exports[_0x9a99('0x50')]=function(_0x2cea09,_0x99956e){return db[_0x9a99('0x32')][_0x9a99('0x50')](_0x2cea09[_0x9a99('0x51')],{})[_0x9a99('0x2d')](function(_0x45a047){var _0x1359a4=_0x2cea09[_0x9a99('0x52')][_0x9a99('0x53')]({'plain':!![]});if(!_0x1359a4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1359a4[_0x9a99('0x54')]===_0x9a99('0x52')){var _0xa63286=_0x45a047['get']({'plain':!![]});var _0x615aea='Teams';return db[_0x9a99('0x55')][_0x9a99('0x4f')]({'where':{'name':_0x615aea,'userProfileId':_0x1359a4['userProfileId']},'raw':!![]})['then'](function(_0x5583a1){if(_0x5583a1&&_0x5583a1[_0x9a99('0x56')]===0x0){return db[_0x9a99('0x57')][_0x9a99('0x50')]({'name':_0xa63286['name'],'resourceId':_0xa63286['id'],'type':_0x5583a1[_0x9a99('0x30')],'sectionId':_0x5583a1['id']},{})[_0x9a99('0x2d')](function(){return _0x45a047;});}else{return _0x45a047;}})[_0x9a99('0x4b')](function(_0x4df589){logger[_0x9a99('0x2e')](_0x9a99('0x58'),_0x4df589);throw _0x4df589;});}return _0x45a047;})['then'](respondWithResult(_0x99956e,0xc9))[_0x9a99('0x4b')](handleError(_0x99956e,null));};exports[_0x9a99('0x59')]=function(_0x105c6a,_0x3670a4){if(_0x105c6a[_0x9a99('0x51')]['id']){delete _0x105c6a[_0x9a99('0x51')]['id'];}return db[_0x9a99('0x32')][_0x9a99('0x4f')]({'where':{'id':_0x105c6a[_0x9a99('0x4d')]['id']}})[_0x9a99('0x2d')](handleEntityNotFound(_0x3670a4,null))['then'](saveUpdates(_0x105c6a[_0x9a99('0x51')],null))[_0x9a99('0x2d')](respondWithResult(_0x3670a4,null))[_0x9a99('0x4b')](handleError(_0x3670a4,null));};exports[_0x9a99('0x5a')]=function(_0x1e078d,_0x4a4b83){var _0x5beabe=_0x1e078d[_0x9a99('0x4d')]['id'];var _0x4c0d47=[];return db['sequelize'][_0x9a99('0x5b')](function(_0x345a23){var _0x1d4842=_0x9a99('0x5c')+_0x5beabe;return db[_0x9a99('0x5d')]['query'](_0x1d4842,{'type':db[_0x9a99('0x5e')][_0x9a99('0x5f')][_0x9a99('0x60')],'raw':!![],'transaction':_0x345a23})[_0x9a99('0x2d')](function(_0x14cf5e){_0x4c0d47=_[_0x9a99('0x31')](_0x14cf5e,function(_0x553723){return Number(_0x553723['UserId']);});})[_0x9a99('0x2d')](function(){var _0x17b357=_0x9a99('0x61')+_0x5beabe;return db[_0x9a99('0x5d')]['query'](_0x17b357,{'type':db['Sequelize'][_0x9a99('0x5f')][_0x9a99('0x60')],'raw':!![],'transaction':_0x345a23});})[_0x9a99('0x2d')](function(_0xa17715){var _0x377136=_[_0x9a99('0x31')](_0xa17715,function(_0x2ed0c3){return Number(_0x2ed0c3['VoiceQueueId']);});return db[_0x9a99('0x62')][_0x9a99('0x5a')]({'where':{'UserId':{'$in':_0x4c0d47},'VoiceQueueId':{'$in':_0x377136}},'transaction':_0x345a23});})[_0x9a99('0x2d')](function(){var _0x5d0414=_0x9a99('0x63')+_0x5beabe;return db[_0x9a99('0x5d')][_0x9a99('0x38')](_0x5d0414,{'type':db['Sequelize'][_0x9a99('0x5f')][_0x9a99('0x60')],'raw':!![],'transaction':_0x345a23});})['then'](function(_0x2f001b){var _0x4a2e3a=_[_0x9a99('0x31')](_0x2f001b,function(_0x84a24c){return Number(_0x84a24c[_0x9a99('0x64')]);});return db[_0x9a99('0x65')][_0x9a99('0x5a')]({'where':{'UserId':{'$in':_0x4c0d47},'MailQueueId':{'$in':_0x4a2e3a}},'transaction':_0x345a23});})[_0x9a99('0x2d')](function(){var _0x183817=_0x9a99('0x66')+_0x5beabe;return db[_0x9a99('0x5d')][_0x9a99('0x38')](_0x183817,{'type':db[_0x9a99('0x5e')][_0x9a99('0x5f')][_0x9a99('0x60')],'raw':!![],'transaction':_0x345a23});})['then'](function(_0x347d36){var _0x29295a=_['map'](_0x347d36,function(_0x458868){return Number(_0x458868[_0x9a99('0x67')]);});return db[_0x9a99('0x68')]['destroy']({'where':{'UserId':{'$in':_0x4c0d47},'SmsQueueId':{'$in':_0x29295a}},'transaction':_0x345a23});})[_0x9a99('0x2d')](function(){var _0x44bde5='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5beabe;return db[_0x9a99('0x5d')]['query'](_0x44bde5,{'type':db['Sequelize'][_0x9a99('0x5f')][_0x9a99('0x60')],'raw':!![],'transaction':_0x345a23});})[_0x9a99('0x2d')](function(_0x257c5d){var _0x2de5cb=_[_0x9a99('0x31')](_0x257c5d,function(_0x12db8a){return Number(_0x12db8a[_0x9a99('0x69')]);});return db[_0x9a99('0x6a')][_0x9a99('0x5a')]({'where':{'UserId':{'$in':_0x4c0d47},'ChatQueueId':{'$in':_0x2de5cb}},'transaction':_0x345a23});})[_0x9a99('0x2d')](function(){var _0x4eb42b='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5beabe;return db[_0x9a99('0x5d')][_0x9a99('0x38')](_0x4eb42b,{'type':db[_0x9a99('0x5e')][_0x9a99('0x5f')][_0x9a99('0x60')],'raw':!![],'transaction':_0x345a23});})['then'](function(_0xb4e17a){var _0x3418d3=_[_0x9a99('0x31')](_0xb4e17a,function(_0x416dc5){return Number(_0x416dc5['FaxQueueId']);});return db[_0x9a99('0x6b')][_0x9a99('0x5a')]({'where':{'UserId':{'$in':_0x4c0d47},'FaxQueueId':{'$in':_0x3418d3}},'transaction':_0x345a23});})['then'](function(){var _0x57372c=_0x9a99('0x6c')+_0x5beabe;return db[_0x9a99('0x5d')]['query'](_0x57372c,{'type':db['Sequelize'][_0x9a99('0x5f')][_0x9a99('0x60')],'raw':!![],'transaction':_0x345a23});})['then'](function(_0x56c5d4){var _0x4301d2=_[_0x9a99('0x31')](_0x56c5d4,function(_0x4c8e18){return Number(_0x4c8e18[_0x9a99('0x6d')]);});return db[_0x9a99('0x6e')][_0x9a99('0x5a')]({'where':{'UserId':{'$in':_0x4c0d47},'OpenchannelQueueId':{'$in':_0x4301d2}},'transaction':_0x345a23});})[_0x9a99('0x2d')](function(){var _0x24de82=_0x9a99('0x6f')+_0x5beabe;return db[_0x9a99('0x5d')][_0x9a99('0x38')](_0x24de82,{'type':db['Sequelize'][_0x9a99('0x5f')][_0x9a99('0x60')],'raw':!![],'transaction':_0x345a23});})['then'](function(_0x1ee597){var _0x12e84b=_[_0x9a99('0x31')](_0x1ee597,function(_0x3fd590){return Number(_0x3fd590[_0x9a99('0x70')]);});return db[_0x9a99('0x71')][_0x9a99('0x5a')]({'where':{'UserId':{'$in':_0x4c0d47},'WhatsappQueueId':{'$in':_0x12e84b}},'transaction':_0x345a23});})[_0x9a99('0x2d')](function(){return db['TeamVoicePrefix'][_0x9a99('0x4f')]({'where':{'TeamId':_0x5beabe}});})[_0x9a99('0x2d')](function(_0x21502a){if(_0x21502a===null){return;}return db[_0x9a99('0x72')][_0x9a99('0x5a')]({'where':{'UserId':{'$in':_0x4c0d47},'VoicePrefixId':_0x21502a[_0x9a99('0x73')]},'transaction':_0x345a23});})[_0x9a99('0x2d')](function(){return db[_0x9a99('0x32')][_0x9a99('0x5a')]({'where':{'id':_0x5beabe},'cascade':!![],'transaction':_0x345a23});})[_0x9a99('0x2d')](function(_0x20e92e){if(_0x20e92e===0x0){_0x4a4b83[_0x9a99('0x21')](0x194);}else{return db['UserProfileResource'][_0x9a99('0x5a')]({'where':{'type':_0x9a99('0x74'),'resourceId':_0x5beabe},'cascade':!![],'transaction':_0x345a23})[_0x9a99('0x2d')](function(){_0x4a4b83[_0x9a99('0x22')](0xcc)[_0x9a99('0x23')]();});}})['catch'](function(_0x19e071){_0x4a4b83[_0x9a99('0x22')](0x1f4)[_0x9a99('0x75')](_0x19e071);});});};exports['getQueues']=function(_0x2a8887,_0x224a3b,_0x44f69f){return db[_0x9a99('0x32')][_0x9a99('0x76')]({'where':{'id':_0x2a8887[_0x9a99('0x4d')]['id']}})[_0x9a99('0x2d')](handleEntityNotFound(_0x224a3b,null))[_0x9a99('0x2d')](function(_0x5d0144){if(!_0x2a8887[_0x9a99('0x38')][_0x9a99('0x77')]||!utils[_0x9a99('0x78')](_0x2a8887['query'][_0x9a99('0x77')])){throw new db[(_0x9a99('0x5e'))][(_0x9a99('0x79'))](_0x9a99('0x7a'));}var _0x5a13ba={};var _0x3c414c={};_0x3c414c[_0x9a99('0x37')]=_[_0x9a99('0x39')](db[_['capitalize'](_0x2a8887['query']['channel'][_0x9a99('0x7b')]())+'Queue'][_0x9a99('0x33')]);_0x3c414c[_0x9a99('0x38')]=_[_0x9a99('0x39')](_0x2a8887[_0x9a99('0x38')]);_0x3c414c['filters']=_['intersection'](_0x3c414c['model'],_0x3c414c[_0x9a99('0x38')]);_0x5a13ba['attributes']=_['intersection'](_0x3c414c[_0x9a99('0x37')],qs['fields'](_0x2a8887[_0x9a99('0x38')][_0x9a99('0x3d')]));_0x5a13ba[_0x9a99('0x3c')]=_0x5a13ba[_0x9a99('0x3c')][_0x9a99('0x3e')]?_0x5a13ba['attributes']:_0x3c414c[_0x9a99('0x37')];_0x5a13ba[_0x9a99('0x28')]=qs[_0x9a99('0x28')](_0x2a8887[_0x9a99('0x38')][_0x9a99('0x28')]);_0x5a13ba[_0x9a99('0x25')]=qs[_0x9a99('0x25')](_0x2a8887[_0x9a99('0x38')][_0x9a99('0x25')]);_0x5a13ba['order']=qs[_0x9a99('0x42')](_0x2a8887[_0x9a99('0x38')][_0x9a99('0x42')]);_0x5a13ba[_0x9a99('0x43')]=qs[_0x9a99('0x3a')](_['pick'](_0x2a8887[_0x9a99('0x38')],_0x3c414c[_0x9a99('0x3a')]));_0x5a13ba=_[_0x9a99('0x46')]({},_0x5a13ba,_0x2a8887['options']);return _0x5d0144[_0x9a99('0x53')+_[_0x9a99('0x7c')](_0x2a8887[_0x9a99('0x38')]['channel']['toLowerCase']())+_0x9a99('0x7d')](_0x5a13ba);})[_0x9a99('0x2d')](respondWithResult(_0x224a3b,null))[_0x9a99('0x4b')](handleError(_0x224a3b,null));};exports[_0x9a99('0x7e')]=function(_0x34a04b,_0xcf5ee1,_0x417eef){return db[_0x9a99('0x32')][_0x9a99('0x76')]({'where':{'id':_0x34a04b[_0x9a99('0x4d')]['id']}})[_0x9a99('0x2d')](function(_0x26af57){if(_0x26af57){if(!_0x34a04b['body']['channel']||!utils[_0x9a99('0x78')](_0x34a04b['body'][_0x9a99('0x77')])){throw new db[(_0x9a99('0x5e'))]['ValidationError'](_0x9a99('0x7a'));}return _0x26af57['add'+_[_0x9a99('0x7c')](_0x34a04b[_0x9a99('0x51')]['channel']['toLowerCase']())+_0x9a99('0x7d')](_0x34a04b['body'][_0x9a99('0x7f')]);}return null;})[_0x9a99('0x2d')](handleEntityNotFound(_0xcf5ee1,null))[_0x9a99('0x2d')](respondWithStatusCode(_0xcf5ee1,null))[_0x9a99('0x4b')](handleError(_0xcf5ee1,null));};exports[_0x9a99('0x80')]=function(_0x341b1d,_0x4b9ba0,_0x11d4a0){return db['Team'][_0x9a99('0x76')]({'where':{'id':_0x341b1d[_0x9a99('0x4d')]['id']}})[_0x9a99('0x2d')](function(_0x19a691){if(_0x19a691){if(!_0x341b1d[_0x9a99('0x38')][_0x9a99('0x77')]||!utils[_0x9a99('0x78')](_0x341b1d[_0x9a99('0x38')][_0x9a99('0x77')])){throw new db[(_0x9a99('0x5e'))][(_0x9a99('0x79'))](_0x9a99('0x7a'));}return _0x19a691[_0x9a99('0x81')+_[_0x9a99('0x7c')](_0x341b1d[_0x9a99('0x38')][_0x9a99('0x77')]['toLowerCase']())+_0x9a99('0x7d')](_0x341b1d[_0x9a99('0x38')]['ids']);}return null;})['then'](handleEntityNotFound(_0x4b9ba0,null))['then'](respondWithStatusCode(_0x4b9ba0,null))[_0x9a99('0x4b')](handleError(_0x4b9ba0,null));};exports[_0x9a99('0x82')]=function(_0x230b30,_0x3d7ce1){var _0xed4107=_[_0x9a99('0x83')](_0x230b30['body'][_0x9a99('0x7f')])?_0x230b30[_0x9a99('0x51')][_0x9a99('0x7f')]:[_0x230b30[_0x9a99('0x51')][_0x9a99('0x7f')]];var _0x1b6118=_0x230b30[_0x9a99('0x4d')]['id'];return db[_0x9a99('0x32')][_0x9a99('0x4f')]({'where':{'id':_0x1b6118}})[_0x9a99('0x2d')](handleEntityNotFound(_0x3d7ce1,null))[_0x9a99('0x2d')](function(_0x1216e3){if(_0x1216e3){var _0x36ac82=[_0x9a99('0x84'),_0x9a99('0x85'),'Mail',_0x9a99('0x86'),_0x9a99('0x87'),_0x9a99('0x88'),_0x9a99('0x89')];return db[_0x9a99('0x5d')][_0x9a99('0x5b')](function(_0x1af8e6){var _0x262840=_['map'](_0x36ac82,function(_0x12243d){var _0x47349e={'attributes':['id',_0x9a99('0x30')]};if(_0x12243d===_0x9a99('0x84')){_0x47349e['through']={'attributes':[_0x9a99('0x8a')]};}return _0x1216e3['get'+_0x12243d+_0x9a99('0x7d')](_0x47349e)[_0x9a99('0x2d')](function(_0x47b04e){var _0x240402=_['map'](_0x47b04e,function(_0x165e10){var _0x4f0788=_[_0x9a99('0x31')](_0xed4107,function(_0xe49eb){var _0x1e9548={'where':{'UserId':_0xe49eb,[_0x12243d+_0x9a99('0x8b')]:_0x165e10['id']},'transaction':_0x1af8e6};if(_0x12243d===_0x9a99('0x84')){_0x1e9548[_0x9a99('0x1d')]={'penalty':_0x165e10[_0x9a99('0x8c')][_0x9a99('0x8a')]};}return db[_0x9a99('0x8d')+_0x12243d+'Queue'][_0x9a99('0x8e')](_0x1e9548)['then'](function(){socket[_0x9a99('0x8f')](_0x9a99('0x52')+_0x12243d+_0x9a99('0x90'),{'UserId':_0xe49eb,[_0x12243d+_0x9a99('0x8b')]:_0x165e10['id']});if(_0x12243d!==_0x9a99('0x84')){return;}return db['User']['findAll']({'where':{'id':_0xed4107,'online':0x1},'attributes':['id',_0x9a99('0x30'),'online',_0x9a99('0x91'),'interface'],'raw':!![]})[_0x9a99('0x2d')](function(_0x11c110){var _0x45cee2=_['map'](_0x11c110,function(_0x1e4db6){return db[_0x9a99('0x92')][_0x9a99('0x93')]({'membername':_0x1e4db6[_0x9a99('0x30')],'UserId':_0x1e4db6['id'],'queue_name':_0x165e10[_0x9a99('0x30')],'VoiceQueueId':_0x165e10['id'],'interface':_['isNil'](_0x1e4db6['interface'])?util[_0x9a99('0x94')]('SIP/%s',_0x1e4db6['name']):_0x1e4db6[_0x9a99('0x95')],'paused':_0x1e4db6[_0x9a99('0x91')]||![],'penalty':_0x165e10['TeamVoiceQueue'][_0x9a99('0x8a')]},{'transaction':_0x1af8e6});});return Promise[_0x9a99('0x96')](_0x45cee2);});});});return Promise['all'](_0x4f0788);});return Promise[_0x9a99('0x96')](_0x240402);})['then'](function(){return db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x1b6118}})[_0x9a99('0x2d')](function(_0x312575){if(_0x312575){var _0x5b032f=_[_0x9a99('0x31')](_0xed4107,function(_0x4d1254){db['UserVoicePrefix'][_0x9a99('0x93')]({'UserId':_0x4d1254,'VoicePrefixId':_0x312575['VoicePrefixId']});});return Promise['all'](_0x5b032f);}});});});return Promise[_0x9a99('0x96')](_0x262840)['then'](function(){return _0x1216e3[_0x9a99('0x82')](_0xed4107,{'transaction':_0x1af8e6})['spread'](function(_0x5c8900){return _0x5c8900;});});});}})[_0x9a99('0x2d')](respondWithResult(_0x3d7ce1,null))[_0x9a99('0x4b')](handleError(_0x3d7ce1,null));};exports[_0x9a99('0x97')]=function(_0x504430,_0x3a9ef4){var _0x140ab4=_[_0x9a99('0x83')](_0x504430[_0x9a99('0x38')][_0x9a99('0x7f')])?_0x504430[_0x9a99('0x38')]['ids']:[_0x504430[_0x9a99('0x38')]['ids']];var _0x208551=_0x504430[_0x9a99('0x4d')]['id'];return db[_0x9a99('0x32')][_0x9a99('0x4f')]({'where':{'id':_0x208551}})['then'](handleEntityNotFound(_0x3a9ef4,null))['then'](function(_0x5a13e6){if(_0x5a13e6){var _0x567ec7=[_0x9a99('0x84'),'Chat',_0x9a99('0x98'),_0x9a99('0x86'),_0x9a99('0x87'),_0x9a99('0x88'),'Whatsapp'];return db['sequelize'][_0x9a99('0x5b')](function(_0x1eea2a){var _0x403e52=_[_0x9a99('0x31')](_0x567ec7,function(_0x28216a){var _0x17efbe={'attributes':['id','name']};return _0x5a13e6[_0x9a99('0x53')+_0x28216a+_0x9a99('0x7d')](_0x17efbe)[_0x9a99('0x2d')](function(_0xca86ea){var _0x2ab17f=_['map'](_0xca86ea,function(_0x398ee5){return _0x398ee5[_0x9a99('0x97')](_0x140ab4,{'transaction':_0x1eea2a})[_0x9a99('0x2d')](function(){var _0x57cf9f=_[_0x9a99('0x31')](_0x140ab4,function(_0x56c24f){socket['emit'](_0x9a99('0x52')+_0x28216a+_0x9a99('0x99'),{'UserId':Number(_0x56c24f),[_0x28216a+_0x9a99('0x8b')]:_0x398ee5['id']});if(_0x28216a!==_0x9a99('0x84')){return;}return db[_0x9a99('0x92')][_0x9a99('0x5a')]({'where':{'VoiceQueueId':_0x398ee5['id'],'UserId':_0x56c24f},'transaction':_0x1eea2a});});return Promise['all'](_0x57cf9f);});});return Promise[_0x9a99('0x96')](_0x2ab17f);});});return Promise[_0x9a99('0x96')](_0x403e52)['then'](function(){return _0x5a13e6[_0x9a99('0x97')](_0x140ab4,{'transaction':_0x1eea2a});})[_0x9a99('0x2d')](function(){return db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x208551}})['then'](function(_0x16234e){if(_0x16234e){var _0x2d6724=_[_0x9a99('0x31')](_0x140ab4,function(_0x377761){db[_0x9a99('0x72')][_0x9a99('0x5a')]({'where':{'UserId':_0x377761,'VoicePrefixId':_0x16234e[_0x9a99('0x73')]}});});return Promise[_0x9a99('0x96')](_0x2d6724);}});});});}})[_0x9a99('0x2d')](respondWithStatusCode(_0x3a9ef4,null))[_0x9a99('0x4b')](handleError(_0x3a9ef4,null));};exports[_0x9a99('0x9a')]=function(_0x156d2e,_0x404381,_0x273939){var _0x202975={};var _0x1b58b9={};var _0x2a23d2;var _0x4c7ffb;return db['Team'][_0x9a99('0x76')]({'where':{'id':_0x156d2e[_0x9a99('0x4d')]['id']}})['then'](handleEntityNotFound(_0x404381,null))['then'](function(_0x3b4df3){if(_0x3b4df3){_0x2a23d2=_0x3b4df3;_0x1b58b9[_0x9a99('0x37')]=_[_0x9a99('0x39')](db['User']['rawAttributes']);_0x1b58b9[_0x9a99('0x38')]=_[_0x9a99('0x39')](_0x156d2e[_0x9a99('0x38')]);_0x1b58b9['filters']=_['intersection'](_0x1b58b9[_0x9a99('0x37')],_0x1b58b9['query']);_0x202975[_0x9a99('0x3c')]=_[_0x9a99('0x3b')](_0x1b58b9[_0x9a99('0x37')],qs['fields'](_0x156d2e[_0x9a99('0x38')][_0x9a99('0x3d')]));_0x202975[_0x9a99('0x3c')]=_0x202975[_0x9a99('0x3c')][_0x9a99('0x3e')]?_0x202975[_0x9a99('0x3c')]:_0x1b58b9[_0x9a99('0x37')];_0x202975['order']=qs['sort'](_0x156d2e[_0x9a99('0x38')][_0x9a99('0x42')]);_0x202975[_0x9a99('0x43')]=qs[_0x9a99('0x3a')](_[_0x9a99('0x44')](_0x156d2e['query'],_0x1b58b9['filters']));if(_0x156d2e[_0x9a99('0x38')][_0x9a99('0x45')]){_0x202975['where']=_[_0x9a99('0x46')](_0x202975[_0x9a99('0x43')],{'$or':_[_0x9a99('0x31')](_0x202975[_0x9a99('0x3c')],function(_0x1d666d){var _0xe35948={};_0xe35948[_0x1d666d]={'$like':'%'+_0x156d2e[_0x9a99('0x38')]['filter']+'%'};return _0xe35948;})});}_0x202975=_[_0x9a99('0x46')]({},_0x202975,_0x156d2e[_0x9a99('0x48')]);return _0x2a23d2[_0x9a99('0x9a')](_0x202975);}})['then'](function(_0x5f434e){if(_0x5f434e){_0x4c7ffb=_0x5f434e['length'];if(!_0x156d2e[_0x9a99('0x38')][_0x9a99('0x3f')](_0x9a99('0x40'))){_0x202975['limit']=qs['limit'](_0x156d2e[_0x9a99('0x38')][_0x9a99('0x28')]);_0x202975[_0x9a99('0x25')]=qs[_0x9a99('0x25')](_0x156d2e['query'][_0x9a99('0x25')]);}return _0x2a23d2[_0x9a99('0x9a')](_0x202975);}})[_0x9a99('0x2d')](function(_0x343aba){if(_0x343aba){return _0x343aba?{'count':_0x4c7ffb,'rows':_0x343aba}:null;}})[_0x9a99('0x2d')](respondWithResult(_0x404381,null))['catch'](handleError(_0x404381,null));}; \ No newline at end of file +var _0x36f8=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','sendStatus','status','end','json','offset','limit','count','save','update','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Team','includeAll','show','params','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','destroy','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','UserSmsQueue','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','TeamVoicePrefix','VoicePrefixId','catch','getQueues','findOne','channel','ValidationError','Unknown\x20channel','capitalize','pick','Queues','addQueues','isValidChannel','add','toLowerCase','ids','remove','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','transaction','through','penalty','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','QueueId','online','voicePause','upsert','isNil','interface','format','SIP/%s','all','UserVoicePrefix','spread','removeAgents','Queue:remove','UserVoiceQueueRt','getAgents','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x40ced5,_0x2b8fe9){var _0x51024e=function(_0xa97f42){while(--_0xa97f42){_0x40ced5['push'](_0x40ced5['shift']());}};_0x51024e(++_0x2b8fe9);}(_0x36f8,0x84));var _0x836f=function(_0x355c59,_0x418712){_0x355c59=_0x355c59-0x0;var _0x30056c=_0x36f8[_0x355c59];return _0x30056c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x836f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x836f('0x1'));var moment=require(_0x836f('0x2'));var BPromise=require(_0x836f('0x3'));var Mustache=require(_0x836f('0x4'));var util=require(_0x836f('0x5'));var path=require('path');var sox=require(_0x836f('0x6'));var csv=require(_0x836f('0x7'));var ejs=require(_0x836f('0x8'));var fs=require('fs');var fs_extra=require(_0x836f('0x9'));var _=require(_0x836f('0xa'));var squel=require(_0x836f('0xb'));var crypto=require(_0x836f('0xc'));var jsforce=require(_0x836f('0xd'));var deskjs=require(_0x836f('0xe'));var toCsv=require(_0x836f('0x7'));var querystring=require(_0x836f('0xf'));var Papa=require(_0x836f('0x10'));var Redis=require(_0x836f('0x11'));var authService=require(_0x836f('0x12'));var qs=require(_0x836f('0x13'));var as=require(_0x836f('0x14'));var hardwareService=require(_0x836f('0x15'));var logger=require('../../config/logger')(_0x836f('0x16'));var utils=require(_0x836f('0x17'));var config=require(_0x836f('0x18'));var licenseUtil=require(_0x836f('0x19'));var db=require(_0x836f('0x1a'))['db'];config[_0x836f('0x1b')]=_[_0x836f('0x1c')](config['redis'],{'host':_0x836f('0x1d'),'port':0x18eb});var socket=require(_0x836f('0x1e'))(new Redis(config[_0x836f('0x1b')]));require(_0x836f('0x1f'))['register'](socket);function respondWithStatusCode(_0x371fe5,_0x990b5){_0x990b5=_0x990b5||0xcc;return function(_0x42b0cf){if(_0x42b0cf){return _0x371fe5[_0x836f('0x20')](_0x990b5);}return _0x371fe5[_0x836f('0x21')](_0x990b5)[_0x836f('0x22')]();};}function respondWithResult(_0x19c32d,_0x202961){_0x202961=_0x202961||0xc8;return function(_0x140c97){if(_0x140c97){return _0x19c32d['status'](_0x202961)[_0x836f('0x23')](_0x140c97);}};}function respondWithFilteredResult(_0x2def46,_0x5842a0){return function(_0xdd8d3a){if(_0xdd8d3a){var _0x24f376=typeof _0x5842a0[_0x836f('0x24')]==='undefined'&&typeof _0x5842a0[_0x836f('0x25')]==='undefined';var _0x2376b5=_0xdd8d3a[_0x836f('0x26')];var _0x454926=_0x24f376?0x0:_0x5842a0['offset'];var _0x28f721=_0x24f376?_0xdd8d3a[_0x836f('0x26')]:_0x5842a0['offset']+_0x5842a0[_0x836f('0x25')];var _0xc5a80a;if(_0x28f721>=_0x2376b5){_0x28f721=_0x2376b5;_0xc5a80a=0xc8;}else{_0xc5a80a=0xce;}_0x2def46[_0x836f('0x21')](_0xc5a80a);return _0x2def46['set']('Content-Range',_0x454926+'-'+_0x28f721+'/'+_0x2376b5)[_0x836f('0x23')](_0xdd8d3a);}return null;};}function patchUpdates(_0x713bc5){return function(_0x35afee){try{jsonpatch['apply'](_0x35afee,_0x713bc5,!![]);}catch(_0x17f8dc){return BPromise['reject'](_0x17f8dc);}return _0x35afee[_0x836f('0x27')]();};}function saveUpdates(_0x350e00,_0x5a37f5){return function(_0x50b7a2){if(_0x50b7a2){return _0x50b7a2[_0x836f('0x28')](_0x350e00)[_0x836f('0x29')](function(_0x36eef8){return _0x36eef8;});}return null;};}function handleEntityNotFound(_0x2bb3a7,_0x17a12d){return function(_0xee05f7){if(!_0xee05f7){_0x2bb3a7[_0x836f('0x20')](0x194);}return _0xee05f7;};}function handleError(_0x35baac,_0x224cae){_0x224cae=_0x224cae||0x1f4;return function(_0x4e57ab){logger[_0x836f('0x2a')](_0x4e57ab['stack']);if(_0x4e57ab['name']){delete _0x4e57ab[_0x836f('0x2b')];}_0x35baac[_0x836f('0x21')](_0x224cae)[_0x836f('0x2c')](_0x4e57ab);};}exports[_0x836f('0x2d')]=function(_0x2e3133,_0x49d38a){var _0x164f29={},_0x981c69={},_0xf72e40={'count':0x0,'rows':[]};var _0x51343e=_[_0x836f('0x2e')](db['Team'][_0x836f('0x2f')],function(_0x49c140){return{'name':_0x49c140[_0x836f('0x30')],'type':_0x49c140[_0x836f('0x31')][_0x836f('0x32')]};});_0x981c69[_0x836f('0x33')]=_[_0x836f('0x2e')](_0x51343e,_0x836f('0x2b'));_0x981c69['query']=_['keys'](_0x2e3133[_0x836f('0x34')]);_0x981c69[_0x836f('0x35')]=_[_0x836f('0x36')](_0x981c69[_0x836f('0x33')],_0x981c69[_0x836f('0x34')]);_0x164f29[_0x836f('0x37')]=_['intersection'](_0x981c69[_0x836f('0x33')],qs[_0x836f('0x38')](_0x2e3133[_0x836f('0x34')][_0x836f('0x38')]));_0x164f29[_0x836f('0x37')]=_0x164f29[_0x836f('0x37')][_0x836f('0x39')]?_0x164f29[_0x836f('0x37')]:_0x981c69[_0x836f('0x33')];if(!_0x2e3133[_0x836f('0x34')][_0x836f('0x3a')](_0x836f('0x3b'))){_0x164f29[_0x836f('0x25')]=qs[_0x836f('0x25')](_0x2e3133['query'][_0x836f('0x25')]);_0x164f29[_0x836f('0x24')]=qs['offset'](_0x2e3133['query'][_0x836f('0x24')]);}_0x164f29[_0x836f('0x3c')]=qs['sort'](_0x2e3133[_0x836f('0x34')][_0x836f('0x3d')]);_0x164f29[_0x836f('0x3e')]=qs[_0x836f('0x35')](_['pick'](_0x2e3133[_0x836f('0x34')],_0x981c69['filters']),_0x51343e);if(_0x2e3133['query'][_0x836f('0x3f')]){_0x164f29[_0x836f('0x3e')]=_[_0x836f('0x40')](_0x164f29[_0x836f('0x3e')],{'$or':_[_0x836f('0x2e')](_0x51343e,function(_0x3f1e3d){if(_0x3f1e3d['type']!==_0x836f('0x41')){var _0x2ffce2={};_0x2ffce2[_0x3f1e3d[_0x836f('0x2b')]]={'$like':'%'+_0x2e3133[_0x836f('0x34')][_0x836f('0x3f')]+'%'};return _0x2ffce2;}})});}_0x164f29=_[_0x836f('0x40')]({},_0x164f29,_0x2e3133[_0x836f('0x42')]);var _0x1b542b={'where':_0x164f29['where']};return db[_0x836f('0x43')][_0x836f('0x26')](_0x1b542b)['then'](function(_0xed8684){_0xf72e40[_0x836f('0x26')]=_0xed8684;if(_0x2e3133[_0x836f('0x34')][_0x836f('0x44')]){_0x164f29['include']=[{'all':!![]}];}return db['Team']['findAll'](_0x164f29);})[_0x836f('0x29')](function(_0x4d28a0){_0xf72e40['rows']=_0x4d28a0;return _0xf72e40;})[_0x836f('0x29')](respondWithFilteredResult(_0x49d38a,_0x164f29))['catch'](handleError(_0x49d38a,null));};exports[_0x836f('0x45')]=function(_0x56a357,_0xae1656){var _0x2b64b2={'raw':![],'where':{'id':_0x56a357[_0x836f('0x46')]['id']}},_0x557ed4={};_0x557ed4[_0x836f('0x33')]=_[_0x836f('0x47')](db[_0x836f('0x43')][_0x836f('0x2f')]);_0x557ed4[_0x836f('0x34')]=_[_0x836f('0x47')](_0x56a357[_0x836f('0x34')]);_0x557ed4[_0x836f('0x35')]=_[_0x836f('0x36')](_0x557ed4['model'],_0x557ed4['query']);_0x2b64b2[_0x836f('0x37')]=_[_0x836f('0x36')](_0x557ed4[_0x836f('0x33')],qs['fields'](_0x56a357[_0x836f('0x34')]['fields']));_0x2b64b2[_0x836f('0x37')]=_0x2b64b2[_0x836f('0x37')]['length']?_0x2b64b2[_0x836f('0x37')]:_0x557ed4[_0x836f('0x33')];if(_0x56a357[_0x836f('0x34')][_0x836f('0x44')]){_0x2b64b2['include']=[{'all':!![]}];}_0x2b64b2=_[_0x836f('0x40')]({},_0x2b64b2,_0x56a357[_0x836f('0x42')]);return db[_0x836f('0x43')][_0x836f('0x48')](_0x2b64b2)[_0x836f('0x29')](handleEntityNotFound(_0xae1656,null))[_0x836f('0x29')](respondWithResult(_0xae1656,null))['catch'](handleError(_0xae1656,null));};exports['create']=function(_0x5a73bd,_0x45fc9c){return db[_0x836f('0x43')][_0x836f('0x49')](_0x5a73bd[_0x836f('0x4a')],{})[_0x836f('0x29')](function(_0x5e6356){var _0x4cc608=_0x5a73bd[_0x836f('0x4b')][_0x836f('0x4c')]({'plain':!![]});if(!_0x4cc608)throw new Error(_0x836f('0x4d'));if(_0x4cc608[_0x836f('0x4e')]===_0x836f('0x4b')){var _0x1c8edb=_0x5e6356[_0x836f('0x4c')]({'plain':!![]});var _0x2eef9f=_0x836f('0x4f');return db[_0x836f('0x50')][_0x836f('0x48')]({'where':{'name':_0x2eef9f,'userProfileId':_0x4cc608[_0x836f('0x51')]},'raw':!![]})[_0x836f('0x29')](function(_0x1d87a5){if(_0x1d87a5&&_0x1d87a5[_0x836f('0x52')]===0x0){return db[_0x836f('0x53')][_0x836f('0x49')]({'name':_0x1c8edb['name'],'resourceId':_0x1c8edb['id'],'type':_0x1d87a5[_0x836f('0x2b')],'sectionId':_0x1d87a5['id']},{})[_0x836f('0x29')](function(){return _0x5e6356;});}else{return _0x5e6356;}})['catch'](function(_0x5e2d8b){logger[_0x836f('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5e2d8b);throw _0x5e2d8b;});}return _0x5e6356;})['then'](respondWithResult(_0x45fc9c,0xc9))['catch'](handleError(_0x45fc9c,null));};exports[_0x836f('0x28')]=function(_0x54e134,_0x3aa0da){if(_0x54e134[_0x836f('0x4a')]['id']){delete _0x54e134['body']['id'];}return db[_0x836f('0x43')][_0x836f('0x48')]({'where':{'id':_0x54e134[_0x836f('0x46')]['id']}})[_0x836f('0x29')](handleEntityNotFound(_0x3aa0da,null))['then'](saveUpdates(_0x54e134[_0x836f('0x4a')],null))['then'](respondWithResult(_0x3aa0da,null))['catch'](handleError(_0x3aa0da,null));};exports[_0x836f('0x54')]=function(_0x5c8048,_0x28c2c9){var _0x82b2d4=_0x5c8048[_0x836f('0x46')]['id'];var _0x4b64cf=[];return db[_0x836f('0x55')]['transaction'](function(_0x1dca24){var _0x6e9e10=_0x836f('0x56')+_0x82b2d4;return db[_0x836f('0x55')]['query'](_0x6e9e10,{'type':db[_0x836f('0x57')][_0x836f('0x58')]['SELECT'],'raw':!![],'transaction':_0x1dca24})[_0x836f('0x29')](function(_0x342455){_0x4b64cf=_[_0x836f('0x2e')](_0x342455,function(_0x3829e8){return Number(_0x3829e8['UserId']);});})[_0x836f('0x29')](function(){var _0x1672e2=_0x836f('0x59')+_0x82b2d4;return db[_0x836f('0x55')]['query'](_0x1672e2,{'type':db['Sequelize'][_0x836f('0x58')][_0x836f('0x5a')],'raw':!![],'transaction':_0x1dca24});})[_0x836f('0x29')](function(_0x31a5da){var _0x2ae08e=_[_0x836f('0x2e')](_0x31a5da,function(_0x4fe2f1){return Number(_0x4fe2f1[_0x836f('0x5b')]);});return db[_0x836f('0x5c')]['destroy']({'where':{'UserId':{'$in':_0x4b64cf},'VoiceQueueId':{'$in':_0x2ae08e}},'transaction':_0x1dca24});})[_0x836f('0x29')](function(){var _0x5acb88=_0x836f('0x5d')+_0x82b2d4;return db[_0x836f('0x55')][_0x836f('0x34')](_0x5acb88,{'type':db[_0x836f('0x57')][_0x836f('0x58')][_0x836f('0x5a')],'raw':!![],'transaction':_0x1dca24});})['then'](function(_0x252b2c){var _0x538781=_[_0x836f('0x2e')](_0x252b2c,function(_0x3b3969){return Number(_0x3b3969[_0x836f('0x5e')]);});return db[_0x836f('0x5f')]['destroy']({'where':{'UserId':{'$in':_0x4b64cf},'MailQueueId':{'$in':_0x538781}},'transaction':_0x1dca24});})['then'](function(){var _0x25800f=_0x836f('0x60')+_0x82b2d4;return db[_0x836f('0x55')]['query'](_0x25800f,{'type':db[_0x836f('0x57')][_0x836f('0x58')][_0x836f('0x5a')],'raw':!![],'transaction':_0x1dca24});})[_0x836f('0x29')](function(_0x2ad304){var _0x360d31=_[_0x836f('0x2e')](_0x2ad304,function(_0xb33514){return Number(_0xb33514['SmsQueueId']);});return db[_0x836f('0x61')]['destroy']({'where':{'UserId':{'$in':_0x4b64cf},'SmsQueueId':{'$in':_0x360d31}},'transaction':_0x1dca24});})[_0x836f('0x29')](function(){var _0x4d06cd='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x82b2d4;return db[_0x836f('0x55')][_0x836f('0x34')](_0x4d06cd,{'type':db[_0x836f('0x57')][_0x836f('0x58')]['SELECT'],'raw':!![],'transaction':_0x1dca24});})['then'](function(_0x37f956){var _0x3ef300=_[_0x836f('0x2e')](_0x37f956,function(_0x3d6ad0){return Number(_0x3d6ad0[_0x836f('0x62')]);});return db[_0x836f('0x63')][_0x836f('0x54')]({'where':{'UserId':{'$in':_0x4b64cf},'ChatQueueId':{'$in':_0x3ef300}},'transaction':_0x1dca24});})[_0x836f('0x29')](function(){var _0xeb23e6=_0x836f('0x64')+_0x82b2d4;return db[_0x836f('0x55')][_0x836f('0x34')](_0xeb23e6,{'type':db[_0x836f('0x57')][_0x836f('0x58')][_0x836f('0x5a')],'raw':!![],'transaction':_0x1dca24});})[_0x836f('0x29')](function(_0x2f8daa){var _0x53e81b=_[_0x836f('0x2e')](_0x2f8daa,function(_0x6321f4){return Number(_0x6321f4['FaxQueueId']);});return db[_0x836f('0x65')][_0x836f('0x54')]({'where':{'UserId':{'$in':_0x4b64cf},'FaxQueueId':{'$in':_0x53e81b}},'transaction':_0x1dca24});})['then'](function(){var _0x5e3ada=_0x836f('0x66')+_0x82b2d4;return db[_0x836f('0x55')][_0x836f('0x34')](_0x5e3ada,{'type':db[_0x836f('0x57')]['QueryTypes'][_0x836f('0x5a')],'raw':!![],'transaction':_0x1dca24});})[_0x836f('0x29')](function(_0x5bf3b4){var _0xf11c59=_[_0x836f('0x2e')](_0x5bf3b4,function(_0x453d98){return Number(_0x453d98[_0x836f('0x67')]);});return db['UserOpenchannelQueue'][_0x836f('0x54')]({'where':{'UserId':{'$in':_0x4b64cf},'OpenchannelQueueId':{'$in':_0xf11c59}},'transaction':_0x1dca24});})[_0x836f('0x29')](function(){var _0x5b3848=_0x836f('0x68')+_0x82b2d4;return db[_0x836f('0x55')][_0x836f('0x34')](_0x5b3848,{'type':db['Sequelize'][_0x836f('0x58')][_0x836f('0x5a')],'raw':!![],'transaction':_0x1dca24});})[_0x836f('0x29')](function(_0x5d0c48){var _0x2dcfb9=_[_0x836f('0x2e')](_0x5d0c48,function(_0x5d2688){return Number(_0x5d2688['WhatsappQueueId']);});return db[_0x836f('0x69')][_0x836f('0x54')]({'where':{'UserId':{'$in':_0x4b64cf},'WhatsappQueueId':{'$in':_0x2dcfb9}},'transaction':_0x1dca24});})[_0x836f('0x29')](function(){return db[_0x836f('0x6a')]['find']({'where':{'TeamId':_0x82b2d4}});})[_0x836f('0x29')](function(_0x4dc58b){if(_0x4dc58b===null){return;}return db['UserVoicePrefix']['destroy']({'where':{'UserId':{'$in':_0x4b64cf},'VoicePrefixId':_0x4dc58b[_0x836f('0x6b')]},'transaction':_0x1dca24});})['then'](function(){return db[_0x836f('0x43')][_0x836f('0x54')]({'where':{'id':_0x82b2d4},'cascade':!![],'transaction':_0x1dca24});})[_0x836f('0x29')](function(_0x35da3b){if(_0x35da3b===0x0){_0x28c2c9['sendStatus'](0x194);}else{return db['UserProfileResource'][_0x836f('0x54')]({'where':{'type':'Teams','resourceId':_0x82b2d4},'cascade':!![],'transaction':_0x1dca24})['then'](function(){_0x28c2c9[_0x836f('0x21')](0xcc)[_0x836f('0x22')]();});}})[_0x836f('0x6c')](function(_0x256afa){_0x28c2c9['status'](0x1f4)[_0x836f('0x2c')](_0x256afa);});});};exports[_0x836f('0x6d')]=function(_0x13f4d8,_0x59e432,_0x5482f5){return db['Team'][_0x836f('0x6e')]({'where':{'id':_0x13f4d8['params']['id']}})[_0x836f('0x29')](handleEntityNotFound(_0x59e432,null))[_0x836f('0x29')](function(_0x618e46){if(!_0x13f4d8[_0x836f('0x34')][_0x836f('0x6f')]||!utils['isValidChannel'](_0x13f4d8[_0x836f('0x34')][_0x836f('0x6f')])){throw new db[(_0x836f('0x57'))][(_0x836f('0x70'))](_0x836f('0x71'));}var _0x3b54e1={};var _0xc0ced9={};_0xc0ced9['model']=_['keys'](db[_[_0x836f('0x72')](_0x13f4d8[_0x836f('0x34')][_0x836f('0x6f')]['toLowerCase']())+'Queue'][_0x836f('0x2f')]);_0xc0ced9['query']=_['keys'](_0x13f4d8[_0x836f('0x34')]);_0xc0ced9[_0x836f('0x35')]=_[_0x836f('0x36')](_0xc0ced9['model'],_0xc0ced9[_0x836f('0x34')]);_0x3b54e1['attributes']=_['intersection'](_0xc0ced9[_0x836f('0x33')],qs[_0x836f('0x38')](_0x13f4d8[_0x836f('0x34')]['fields']));_0x3b54e1[_0x836f('0x37')]=_0x3b54e1[_0x836f('0x37')]['length']?_0x3b54e1['attributes']:_0xc0ced9[_0x836f('0x33')];_0x3b54e1['limit']=qs['limit'](_0x13f4d8['query']['limit']);_0x3b54e1[_0x836f('0x24')]=qs[_0x836f('0x24')](_0x13f4d8['query']['offset']);_0x3b54e1[_0x836f('0x3c')]=qs[_0x836f('0x3d')](_0x13f4d8[_0x836f('0x34')][_0x836f('0x3d')]);_0x3b54e1[_0x836f('0x3e')]=qs[_0x836f('0x35')](_[_0x836f('0x73')](_0x13f4d8[_0x836f('0x34')],_0xc0ced9[_0x836f('0x35')]));_0x3b54e1=_['merge']({},_0x3b54e1,_0x13f4d8[_0x836f('0x42')]);return _0x618e46['get'+_[_0x836f('0x72')](_0x13f4d8[_0x836f('0x34')][_0x836f('0x6f')]['toLowerCase']())+_0x836f('0x74')](_0x3b54e1);})[_0x836f('0x29')](respondWithResult(_0x59e432,null))[_0x836f('0x6c')](handleError(_0x59e432,null));};exports[_0x836f('0x75')]=function(_0x227645,_0x4a2bef,_0x18e839){return db[_0x836f('0x43')][_0x836f('0x6e')]({'where':{'id':_0x227645['params']['id']}})[_0x836f('0x29')](function(_0x2fdf94){if(_0x2fdf94){if(!_0x227645[_0x836f('0x4a')]['channel']||!utils[_0x836f('0x76')](_0x227645[_0x836f('0x4a')][_0x836f('0x6f')])){throw new db[(_0x836f('0x57'))]['ValidationError']('Unknown\x20channel');}return _0x2fdf94[_0x836f('0x77')+_[_0x836f('0x72')](_0x227645[_0x836f('0x4a')][_0x836f('0x6f')][_0x836f('0x78')]())+_0x836f('0x74')](_0x227645[_0x836f('0x4a')][_0x836f('0x79')]);}return null;})['then'](handleEntityNotFound(_0x4a2bef,null))[_0x836f('0x29')](respondWithStatusCode(_0x4a2bef,null))[_0x836f('0x6c')](handleError(_0x4a2bef,null));};exports['removeQueues']=function(_0x19ec26,_0x51b0e4,_0x18b2f6){return db[_0x836f('0x43')]['findOne']({'where':{'id':_0x19ec26['params']['id']}})[_0x836f('0x29')](function(_0xbf1f6a){if(_0xbf1f6a){if(!_0x19ec26['query'][_0x836f('0x6f')]||!utils['isValidChannel'](_0x19ec26[_0x836f('0x34')]['channel'])){throw new db[(_0x836f('0x57'))][(_0x836f('0x70'))]('Unknown\x20channel');}return _0xbf1f6a[_0x836f('0x7a')+_['capitalize'](_0x19ec26[_0x836f('0x34')][_0x836f('0x6f')][_0x836f('0x78')]())+_0x836f('0x74')](_0x19ec26['query'][_0x836f('0x79')]);}return null;})[_0x836f('0x29')](handleEntityNotFound(_0x51b0e4,null))[_0x836f('0x29')](respondWithStatusCode(_0x51b0e4,null))[_0x836f('0x6c')](handleError(_0x51b0e4,null));};exports[_0x836f('0x7b')]=function(_0x2af20d,_0x2d0857){var _0xbc345=_[_0x836f('0x7c')](_0x2af20d['body'][_0x836f('0x79')])?_0x2af20d['body'][_0x836f('0x79')]:[_0x2af20d[_0x836f('0x4a')]['ids']];var _0x2a4c98=_0x2af20d[_0x836f('0x46')]['id'];return db[_0x836f('0x43')][_0x836f('0x48')]({'where':{'id':_0x2a4c98}})[_0x836f('0x29')](handleEntityNotFound(_0x2d0857,null))[_0x836f('0x29')](function(_0x327ec2){if(_0x327ec2){var _0x20f9c0=[_0x836f('0x7d'),_0x836f('0x7e'),_0x836f('0x7f'),_0x836f('0x80'),_0x836f('0x81'),_0x836f('0x82'),_0x836f('0x83')];return db[_0x836f('0x55')][_0x836f('0x84')](function(_0x1e83d3){var _0x5c2867=_['map'](_0x20f9c0,function(_0x54e0a9){var _0x1a8b07={'attributes':['id',_0x836f('0x2b')]};if(_0x54e0a9===_0x836f('0x7d')){_0x1a8b07[_0x836f('0x85')]={'attributes':[_0x836f('0x86')]};}return _0x327ec2[_0x836f('0x4c')+_0x54e0a9+_0x836f('0x74')](_0x1a8b07)['then'](function(_0x1ea972){var _0x157a8f=_[_0x836f('0x2e')](_0x1ea972,function(_0x199ad3){var _0x3d3b62=_[_0x836f('0x2e')](_0xbc345,function(_0x5ace50){var _0x27b3b7={'where':{'UserId':_0x5ace50,[_0x54e0a9+'QueueId']:_0x199ad3['id']},'transaction':_0x1e83d3};if(_0x54e0a9===_0x836f('0x7d')){_0x27b3b7[_0x836f('0x1c')]={'penalty':_0x199ad3[_0x836f('0x87')]['penalty']};}return db[_0x836f('0x88')+_0x54e0a9+'Queue'][_0x836f('0x89')](_0x27b3b7)[_0x836f('0x29')](function(){socket[_0x836f('0x8a')](_0x836f('0x4b')+_0x54e0a9+_0x836f('0x8b'),{'UserId':_0x5ace50,[_0x54e0a9+_0x836f('0x8c')]:_0x199ad3['id']});if(_0x54e0a9!==_0x836f('0x7d')){return;}return db[_0x836f('0x88')]['findAll']({'where':{'id':_0xbc345,'online':0x1},'attributes':['id',_0x836f('0x2b'),_0x836f('0x8d'),_0x836f('0x8e'),'interface'],'raw':!![]})[_0x836f('0x29')](function(_0x567499){var _0x101c83=_[_0x836f('0x2e')](_0x567499,function(_0x567101){return db['UserVoiceQueueRt'][_0x836f('0x8f')]({'membername':_0x567101[_0x836f('0x2b')],'UserId':_0x567101['id'],'queue_name':_0x199ad3[_0x836f('0x2b')],'VoiceQueueId':_0x199ad3['id'],'interface':_[_0x836f('0x90')](_0x567101[_0x836f('0x91')])?util[_0x836f('0x92')](_0x836f('0x93'),_0x567101[_0x836f('0x2b')]):_0x567101[_0x836f('0x91')],'paused':_0x567101[_0x836f('0x8e')]||![],'penalty':_0x199ad3[_0x836f('0x87')][_0x836f('0x86')]},{'transaction':_0x1e83d3});});return Promise[_0x836f('0x94')](_0x101c83);});});});return Promise['all'](_0x3d3b62);});return Promise['all'](_0x157a8f);})[_0x836f('0x29')](function(){return db[_0x836f('0x6a')][_0x836f('0x6e')]({'where':{'teamId':_0x2a4c98}})['then'](function(_0xc7234c){if(_0xc7234c){var _0x18d66d=_[_0x836f('0x2e')](_0xbc345,function(_0x4a52ea){db[_0x836f('0x95')][_0x836f('0x8f')]({'UserId':_0x4a52ea,'VoicePrefixId':_0xc7234c[_0x836f('0x6b')]});});return Promise[_0x836f('0x94')](_0x18d66d);}});});});return Promise['all'](_0x5c2867)[_0x836f('0x29')](function(){return _0x327ec2[_0x836f('0x7b')](_0xbc345,{'transaction':_0x1e83d3})[_0x836f('0x96')](function(_0x24773f){return _0x24773f;});});});}})[_0x836f('0x29')](respondWithResult(_0x2d0857,null))[_0x836f('0x6c')](handleError(_0x2d0857,null));};exports[_0x836f('0x97')]=function(_0x333445,_0xeed221){var _0x15791c=_[_0x836f('0x7c')](_0x333445[_0x836f('0x34')][_0x836f('0x79')])?_0x333445[_0x836f('0x34')][_0x836f('0x79')]:[_0x333445[_0x836f('0x34')]['ids']];var _0x42db7a=_0x333445['params']['id'];return db[_0x836f('0x43')][_0x836f('0x48')]({'where':{'id':_0x42db7a}})['then'](handleEntityNotFound(_0xeed221,null))['then'](function(_0x70c283){if(_0x70c283){var _0x1708fa=[_0x836f('0x7d'),_0x836f('0x7e'),'Mail','Sms',_0x836f('0x81'),_0x836f('0x82'),_0x836f('0x83')];return db['sequelize']['transaction'](function(_0x453dde){var _0x3a5093=_[_0x836f('0x2e')](_0x1708fa,function(_0x3ec1d2){var _0x4c0ac6={'attributes':['id',_0x836f('0x2b')]};return _0x70c283[_0x836f('0x4c')+_0x3ec1d2+_0x836f('0x74')](_0x4c0ac6)[_0x836f('0x29')](function(_0x2f32f4){var _0x2bd351=_[_0x836f('0x2e')](_0x2f32f4,function(_0x3957ee){return _0x3957ee[_0x836f('0x97')](_0x15791c,{'transaction':_0x453dde})[_0x836f('0x29')](function(){var _0x6e258e=_['map'](_0x15791c,function(_0x450544){socket[_0x836f('0x8a')]('user'+_0x3ec1d2+_0x836f('0x98'),{'UserId':Number(_0x450544),[_0x3ec1d2+_0x836f('0x8c')]:_0x3957ee['id']});if(_0x3ec1d2!==_0x836f('0x7d')){return;}return db[_0x836f('0x99')][_0x836f('0x54')]({'where':{'VoiceQueueId':_0x3957ee['id'],'UserId':_0x450544},'transaction':_0x453dde});});return Promise[_0x836f('0x94')](_0x6e258e);});});return Promise[_0x836f('0x94')](_0x2bd351);});});return Promise['all'](_0x3a5093)[_0x836f('0x29')](function(){return _0x70c283[_0x836f('0x97')](_0x15791c,{'transaction':_0x453dde});})[_0x836f('0x29')](function(){return db['TeamVoicePrefix'][_0x836f('0x6e')]({'where':{'teamId':_0x42db7a}})[_0x836f('0x29')](function(_0xedb78b){if(_0xedb78b){var _0x47ef39=_[_0x836f('0x2e')](_0x15791c,function(_0x321011){db[_0x836f('0x95')]['destroy']({'where':{'UserId':_0x321011,'VoicePrefixId':_0xedb78b[_0x836f('0x6b')]}});});return Promise[_0x836f('0x94')](_0x47ef39);}});});});}})[_0x836f('0x29')](respondWithStatusCode(_0xeed221,null))[_0x836f('0x6c')](handleError(_0xeed221,null));};exports[_0x836f('0x9a')]=function(_0x306e6c,_0x212e17,_0x30413b){var _0x5de7aa={};var _0x4e1708={};var _0x33664e;var _0x46bdbd;return db[_0x836f('0x43')][_0x836f('0x6e')]({'where':{'id':_0x306e6c[_0x836f('0x46')]['id']}})['then'](handleEntityNotFound(_0x212e17,null))[_0x836f('0x29')](function(_0x10d9b8){if(_0x10d9b8){_0x33664e=_0x10d9b8;_0x4e1708[_0x836f('0x33')]=_[_0x836f('0x47')](db[_0x836f('0x88')][_0x836f('0x2f')]);_0x4e1708[_0x836f('0x34')]=_['keys'](_0x306e6c[_0x836f('0x34')]);_0x4e1708['filters']=_['intersection'](_0x4e1708[_0x836f('0x33')],_0x4e1708[_0x836f('0x34')]);_0x5de7aa['attributes']=_[_0x836f('0x36')](_0x4e1708[_0x836f('0x33')],qs[_0x836f('0x38')](_0x306e6c[_0x836f('0x34')][_0x836f('0x38')]));_0x5de7aa['attributes']=_0x5de7aa[_0x836f('0x37')][_0x836f('0x39')]?_0x5de7aa[_0x836f('0x37')]:_0x4e1708[_0x836f('0x33')];_0x5de7aa[_0x836f('0x3c')]=qs['sort'](_0x306e6c[_0x836f('0x34')][_0x836f('0x3d')]);_0x5de7aa[_0x836f('0x3e')]=qs[_0x836f('0x35')](_['pick'](_0x306e6c['query'],_0x4e1708[_0x836f('0x35')]));if(_0x306e6c[_0x836f('0x34')][_0x836f('0x3f')]){_0x5de7aa[_0x836f('0x3e')]=_[_0x836f('0x40')](_0x5de7aa[_0x836f('0x3e')],{'$or':_[_0x836f('0x2e')](_0x5de7aa[_0x836f('0x37')],function(_0x2b3110){var _0x5c5444={};_0x5c5444[_0x2b3110]={'$like':'%'+_0x306e6c[_0x836f('0x34')]['filter']+'%'};return _0x5c5444;})});}_0x5de7aa=_[_0x836f('0x40')]({},_0x5de7aa,_0x306e6c[_0x836f('0x42')]);return _0x33664e[_0x836f('0x9a')](_0x5de7aa);}})[_0x836f('0x29')](function(_0x1636a1){if(_0x1636a1){_0x46bdbd=_0x1636a1[_0x836f('0x39')];if(!_0x306e6c[_0x836f('0x34')]['hasOwnProperty'](_0x836f('0x3b'))){_0x5de7aa[_0x836f('0x25')]=qs[_0x836f('0x25')](_0x306e6c[_0x836f('0x34')][_0x836f('0x25')]);_0x5de7aa[_0x836f('0x24')]=qs[_0x836f('0x24')](_0x306e6c[_0x836f('0x34')][_0x836f('0x24')]);}return _0x33664e[_0x836f('0x9a')](_0x5de7aa);}})[_0x836f('0x29')](function(_0x3e5f3b){if(_0x3e5f3b){return _0x3e5f3b?{'count':_0x46bdbd,'rows':_0x3e5f3b}:null;}})['then'](respondWithResult(_0x212e17,null))[_0x836f('0x6c')](handleError(_0x212e17,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index f0b4512..3350190 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 _0xa2fa=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team','setMaxListeners','save','update','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa2fa,0x159));var _0xaa2f=function(_0x5031dc,_0x1129f9){_0x5031dc=_0x5031dc-0x0;var _0x4b24ae=_0xa2fa[_0x5031dc];return _0x4b24ae;};'use strict';var EventEmitter=require(_0xaa2f('0x0'));var Team=require(_0xaa2f('0x1'))['db'][_0xaa2f('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xaa2f('0x3')](0x0);var events={'afterCreate':_0xaa2f('0x4'),'afterUpdate':_0xaa2f('0x5'),'afterDestroy':_0xaa2f('0x6')};function emitEvent(_0x1cc66b){return function(_0x533529,_0xceffab,_0x2547a1){TeamEvents[_0xaa2f('0x7')](_0x1cc66b+':'+_0x533529['id'],_0x533529);TeamEvents[_0xaa2f('0x7')](_0x1cc66b,_0x533529);_0x2547a1(null);};}for(var e in events){if(events[_0xaa2f('0x8')](e)){var event=events[e];Team[_0xaa2f('0x9')](e,emitEvent(event));}}module[_0xaa2f('0xa')]=TeamEvents; \ No newline at end of file +var _0xd7ac=['remove','emit','hasOwnProperty','hook','events','Team','setMaxListeners','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd7ac,0xb4));var _0xcd7a=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xd7ac[_0x5f3f88];return _0xd08119;};'use strict';var EventEmitter=require(_0xcd7a('0x0'));var Team=require('../../mysqldb')['db'][_0xcd7a('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0xcd7a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcd7a('0x3'),'afterDestroy':_0xcd7a('0x4')};function emitEvent(_0x5c5823){return function(_0x8e3c63,_0x32c691,_0x5704c3){TeamEvents['emit'](_0x5c5823+':'+_0x8e3c63['id'],_0x8e3c63);TeamEvents[_0xcd7a('0x5')](_0x5c5823,_0x8e3c63);_0x5704c3(null);};}for(var e in events){if(events[_0xcd7a('0x6')](e)){var event=events[e];Team[_0xcd7a('0x7')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index b96fb15..8fe58ef 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 _0xcb53=['resolve','all','catch','lodash','./team.attributes','get','then','channel','exports','define','Team','teams','Chat','Mail','Openchannel','Sms','Whatsapp'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xcb53,0x124));var _0x3cb5=function(_0x12ccfe,_0x3aad10){_0x12ccfe=_0x12ccfe-0x0;var _0x54b9f0=_0xcb53[_0x12ccfe];return _0x54b9f0;};'use strict';var _=require(_0x3cb5('0x0'));var attributes=require(_0x3cb5('0x1'));function getQueuesByChannel(_0x5e5005,_0x34adff){var _0x5d4ddf=_0x3cb5('0x2')+_0x34adff+'Queues';return _0x5e5005[_0x5d4ddf]()[_0x3cb5('0x3')](function(_0x2f7e4c){return _['map'](_0x2f7e4c,function(_0x39fd8e){_0x39fd8e['setDataValue'](_0x3cb5('0x4'),_0x34adff);return _0x39fd8e;});})['catch'](function(_0x1c4688){throw _0x1c4688;});}module[_0x3cb5('0x5')]=function(_0x5bd05a){return _0x5bd05a[_0x3cb5('0x6')](_0x3cb5('0x7'),attributes,{'tableName':_0x3cb5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x56ac0c=this;var _0x3f1559=[_0x3cb5('0x9'),'Fax',_0x3cb5('0xa'),_0x3cb5('0xb'),_0x3cb5('0xc'),'Voice',_0x3cb5('0xd')];return Promise[_0x3cb5('0xe')]()['then'](function(){var _0x1449e1=_['map'](_0x3f1559,function(_0x3a79a8){return getQueuesByChannel(_0x56ac0c,_0x3a79a8);});return Promise[_0x3cb5('0xf')](_0x1449e1);})[_0x3cb5('0x10')](function(_0x5c1745){throw _0x5c1745;});}}});}; \ No newline at end of file +var _0x0f92=['then','all','lodash','./team.attributes','get','map','channel','catch','define','teams','Fax','Mail','Voice','Whatsapp','resolve'];(function(_0x1a9db4,_0x50fe9e){var _0x333fb7=function(_0x3ceb9c){while(--_0x3ceb9c){_0x1a9db4['push'](_0x1a9db4['shift']());}};_0x333fb7(++_0x50fe9e);}(_0x0f92,0x188));var _0x20f9=function(_0x1ec67e,_0x12c0b6){_0x1ec67e=_0x1ec67e-0x0;var _0x42bb4f=_0x0f92[_0x1ec67e];return _0x42bb4f;};'use strict';var _=require(_0x20f9('0x0'));var attributes=require(_0x20f9('0x1'));function getQueuesByChannel(_0xcdf8f7,_0x3e61f9){var _0x404d18=_0x20f9('0x2')+_0x3e61f9+'Queues';return _0xcdf8f7[_0x404d18]()['then'](function(_0x5856d0){return _[_0x20f9('0x3')](_0x5856d0,function(_0x103085){_0x103085['setDataValue'](_0x20f9('0x4'),_0x3e61f9);return _0x103085;});})[_0x20f9('0x5')](function(_0x464c83){throw _0x464c83;});}module['exports']=function(_0x7ead98){return _0x7ead98[_0x20f9('0x6')]('Team',attributes,{'tableName':_0x20f9('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x386a65=this;var _0x470cb2=['Chat',_0x20f9('0x8'),_0x20f9('0x9'),'Openchannel','Sms',_0x20f9('0xa'),_0x20f9('0xb')];return Promise[_0x20f9('0xc')]()[_0x20f9('0xd')](function(){var _0x3204cf=_[_0x20f9('0x3')](_0x470cb2,function(_0x43a115){return getQueuesByChannel(_0x386a65,_0x43a115);});return Promise[_0x20f9('0xe')](_0x3204cf);})['catch'](function(_0x41fe88){throw _0x41fe88;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index c61f1cb..409d917 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 _0x4e96=['code','Team,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./team.socket','register','request','then','info','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2cef56,_0x201933){var _0x1bab58=function(_0x2ae2bf){while(--_0x2ae2bf){_0x2cef56['push'](_0x2cef56['shift']());}};_0x1bab58(++_0x201933);}(_0x4e96,0xf4));var _0x64e9=function(_0x440bf6,_0x31e6d9){_0x440bf6=_0x440bf6-0x0;var _0x2c0a6c=_0x4e96[_0x440bf6];return _0x2c0a6c;};'use strict';var _=require(_0x64e9('0x0'));var util=require(_0x64e9('0x1'));var moment=require(_0x64e9('0x2'));var BPromise=require(_0x64e9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x64e9('0x4'));var db=require(_0x64e9('0x5'))['db'];var utils=require(_0x64e9('0x6'));var logger=require(_0x64e9('0x7'))(_0x64e9('0x8'));var config=require(_0x64e9('0x9'));var jayson=require(_0x64e9('0xa'));var client=jayson[_0x64e9('0xb')][_0x64e9('0xc')]({'port':0x232a});config['redis']=_[_0x64e9('0xd')](config[_0x64e9('0xe')],{'host':_0x64e9('0xf'),'port':0x18eb});var socket=require(_0x64e9('0x10'))(new Redis(config[_0x64e9('0xe')]));require(_0x64e9('0x11'))[_0x64e9('0x12')](socket);function respondWithRpcPromise(_0x2d04da,_0xd1ec1f,_0x476f61){return new BPromise(function(_0x12cd1d,_0x272cd4){return client[_0x64e9('0x13')](_0x2d04da,_0x476f61)[_0x64e9('0x14')](function(_0x37b1c5){logger[_0x64e9('0x15')]('Team,\x20%s,\x20%s',_0xd1ec1f,_0x64e9('0x16'));logger['debug'](_0x64e9('0x17'),_0xd1ec1f,_0x64e9('0x16'),JSON[_0x64e9('0x18')](_0x37b1c5));if(_0x37b1c5[_0x64e9('0x19')]){if(_0x37b1c5[_0x64e9('0x19')][_0x64e9('0x1a')]===0x1f4){logger[_0x64e9('0x19')](_0x64e9('0x1b'),_0xd1ec1f,_0x37b1c5[_0x64e9('0x19')][_0x64e9('0x1c')]);return _0x272cd4(_0x37b1c5[_0x64e9('0x19')][_0x64e9('0x1c')]);}logger['error'](_0x64e9('0x1b'),_0xd1ec1f,_0x37b1c5[_0x64e9('0x19')][_0x64e9('0x1c')]);return _0x12cd1d(_0x37b1c5[_0x64e9('0x19')][_0x64e9('0x1c')]);}else{logger[_0x64e9('0x15')](_0x64e9('0x1b'),_0xd1ec1f,_0x64e9('0x16'));_0x12cd1d(_0x37b1c5['result']['message']);}})[_0x64e9('0x1d')](function(_0x2c2867){logger[_0x64e9('0x19')](_0x64e9('0x1b'),_0xd1ec1f,_0x2c2867);_0x272cd4(_0x2c2867);});});} \ No newline at end of file +var _0xf6bd=['../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x241a10,_0x548225){var _0x3c0e33=function(_0x26cbf9){while(--_0x26cbf9){_0x241a10['push'](_0x241a10['shift']());}};_0x3c0e33(++_0x548225);}(_0xf6bd,0x18f));var _0xdf6b=function(_0x3a1972,_0x194511){_0x3a1972=_0x3a1972-0x0;var _0xc7e0b5=_0xf6bd[_0x3a1972];return _0xc7e0b5;};'use strict';var _=require(_0xdf6b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdf6b('0x1'));var rs=require(_0xdf6b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf6b('0x3'))['db'];var utils=require(_0xdf6b('0x4'));var logger=require('../../config/logger')(_0xdf6b('0x5'));var config=require(_0xdf6b('0x6'));var jayson=require(_0xdf6b('0x7'));var client=jayson[_0xdf6b('0x8')]['http']({'port':0x232a});config[_0xdf6b('0x9')]=_[_0xdf6b('0xa')](config['redis'],{'host':_0xdf6b('0xb'),'port':0x18eb});var socket=require(_0xdf6b('0xc'))(new Redis(config['redis']));require(_0xdf6b('0xd'))[_0xdf6b('0xe')](socket);function respondWithRpcPromise(_0x2b6746,_0x489159,_0x3a6e97){return new BPromise(function(_0x43647c,_0x1faf4a){return client[_0xdf6b('0xf')](_0x2b6746,_0x3a6e97)[_0xdf6b('0x10')](function(_0x36d3ea){logger[_0xdf6b('0x11')](_0xdf6b('0x12'),_0x489159,'request\x20sent');logger[_0xdf6b('0x13')]('Team,\x20%s,\x20%s,\x20%s',_0x489159,_0xdf6b('0x14'),JSON[_0xdf6b('0x15')](_0x36d3ea));if(_0x36d3ea[_0xdf6b('0x16')]){if(_0x36d3ea[_0xdf6b('0x16')][_0xdf6b('0x17')]===0x1f4){logger[_0xdf6b('0x16')](_0xdf6b('0x12'),_0x489159,_0x36d3ea[_0xdf6b('0x16')][_0xdf6b('0x18')]);return _0x1faf4a(_0x36d3ea['error'][_0xdf6b('0x18')]);}logger[_0xdf6b('0x16')](_0xdf6b('0x12'),_0x489159,_0x36d3ea[_0xdf6b('0x16')][_0xdf6b('0x18')]);return _0x43647c(_0x36d3ea[_0xdf6b('0x16')][_0xdf6b('0x18')]);}else{logger[_0xdf6b('0x11')](_0xdf6b('0x12'),_0x489159,_0xdf6b('0x14'));_0x43647c(_0x36d3ea[_0xdf6b('0x19')][_0xdf6b('0x18')]);}})[_0xdf6b('0x1a')](function(_0xf6d22c){logger[_0xdf6b('0x16')](_0xdf6b('0x12'),_0x489159,_0xf6d22c);_0x1faf4a(_0xf6d22c);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index cf19f18..118279d 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 _0xdcfc=['register','./team.events','save','emit','removeListener'];(function(_0x4147ff,_0x154530){var _0x1e71e6=function(_0x21f992){while(--_0x21f992){_0x4147ff['push'](_0x4147ff['shift']());}};_0x1e71e6(++_0x154530);}(_0xdcfc,0x1c8));var _0xcdcf=function(_0x27053c,_0x19366a){_0x27053c=_0x27053c-0x0;var _0x3504d8=_0xdcfc[_0x27053c];return _0x3504d8;};'use strict';var TeamEvents=require(_0xcdcf('0x0'));var events=[_0xcdcf('0x1'),'remove','update'];function createListener(_0x5f5bf3,_0x3da8a6){return function(_0x1c9463){_0x3da8a6[_0xcdcf('0x2')](_0x5f5bf3,_0x1c9463);};}function removeListener(_0x381674,_0x55fdde){return function(){TeamEvents[_0xcdcf('0x3')](_0x381674,_0x55fdde);};}exports[_0xcdcf('0x4')]=function(_0x4dd6d7){for(var _0x309910=0x0,_0x4b49e4=events['length'];_0x309910<_0x4b49e4;_0x309910++){var _0x432d9b=events[_0x309910];var _0x148048=createListener('team:'+_0x432d9b,_0x4dd6d7);TeamEvents['on'](_0x432d9b,_0x148048);}}; \ No newline at end of file +var _0xc224=['emit','register','length','team:','./team.events','save','remove','update'];(function(_0x4d2c26,_0x2701f9){var _0x5bf9b4=function(_0x52edc6){while(--_0x52edc6){_0x4d2c26['push'](_0x4d2c26['shift']());}};_0x5bf9b4(++_0x2701f9);}(_0xc224,0xe4));var _0x4c22=function(_0x5db83a,_0x26053a){_0x5db83a=_0x5db83a-0x0;var _0x4fe0e7=_0xc224[_0x5db83a];return _0x4fe0e7;};'use strict';var TeamEvents=require(_0x4c22('0x0'));var events=[_0x4c22('0x1'),_0x4c22('0x2'),_0x4c22('0x3')];function createListener(_0x49cd0a,_0x1ee6b0){return function(_0xd2e9c4){_0x1ee6b0[_0x4c22('0x4')](_0x49cd0a,_0xd2e9c4);};}function removeListener(_0x50e3c8,_0x31a9a2){return function(){TeamEvents['removeListener'](_0x50e3c8,_0x31a9a2);};}exports[_0x4c22('0x5')]=function(_0x4fb258){for(var _0x4b2aa2=0x0,_0x2483a4=events[_0x4c22('0x6')];_0x4b2aa2<_0x2483a4;_0x4b2aa2++){var _0x39e3d3=events[_0x4b2aa2];var _0x5975a9=createListener(_0x4c22('0x7')+_0x39e3d3,_0x4fb258);TeamEvents['on'](_0x39e3d3,_0x5975a9);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index d068fc8..40733c5 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 _0x6ed3=['INTEGER','sequelize'];(function(_0x3f56eb,_0x394926){var _0x4bf776=function(_0x3970b7){while(--_0x3970b7){_0x3f56eb['push'](_0x3f56eb['shift']());}};_0x4bf776(++_0x394926);}(_0x6ed3,0x1d9));var _0x36ed=function(_0x4d9403,_0x33c5f0){_0x4d9403=_0x4d9403-0x0;var _0x5eef11=_0x6ed3[_0x4d9403];return _0x5eef11;};'use strict';var Sequelize=require(_0x36ed('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0x36ed('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x36ed('0x1')]}}; \ No newline at end of file +var _0x6931=['exports','sequelize'];(function(_0x466cf6,_0x3c2304){var _0x4c8e1d=function(_0x2d501e){while(--_0x2d501e){_0x466cf6['push'](_0x466cf6['shift']());}};_0x4c8e1d(++_0x3c2304);}(_0x6931,0xa5));var _0x1693=function(_0x517ca4,_0x1949aa){_0x517ca4=_0x517ca4-0x0;var _0x1534be=_0x6931[_0x517ca4];return _0x1534be;};'use strict';var Sequelize=require(_0x1693('0x0'));module[_0x1693('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 5850f27..5d384b2 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 _0xde9f=['lodash','api','moment','request-promise','path','../../config/environment','./teamVoicePrefix.attributes','exports','TeamVoicePrefix','team_has_voice_prefixes'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0xde9f,0x118));var _0xfde9=function(_0x2891d1,_0x2ddd3e){_0x2891d1=_0x2891d1-0x0;var _0x486948=_0xde9f[_0x2891d1];return _0x486948;};'use strict';var _=require(_0xfde9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfde9('0x1'));var moment=require(_0xfde9('0x2'));var BPromise=require('bluebird');var rp=require(_0xfde9('0x3'));var fs=require('fs');var path=require(_0xfde9('0x4'));var rimraf=require('rimraf');var config=require(_0xfde9('0x5'));var attributes=require(_0xfde9('0x6'));module[_0xfde9('0x7')]=function(_0xe30eaf,_0x5e69c0){return _0xe30eaf['define'](_0xfde9('0x8'),attributes,{'tableName':_0xfde9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e6b=['path','rimraf','../../config/environment','exports','TeamVoicePrefix','lodash','util','api','request-promise'];(function(_0x575a31,_0x56336f){var _0x5d7dad=function(_0x2c8c09){while(--_0x2c8c09){_0x575a31['push'](_0x575a31['shift']());}};_0x5d7dad(++_0x56336f);}(_0x9e6b,0x11c));var _0xb9e6=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x9e6b[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0xb9e6('0x0'));var util=require(_0xb9e6('0x1'));var logger=require('../../config/logger')(_0xb9e6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb9e6('0x3'));var fs=require('fs');var path=require(_0xb9e6('0x4'));var rimraf=require(_0xb9e6('0x5'));var config=require(_0xb9e6('0x6'));var attributes=require('./teamVoicePrefix.attributes');module[_0xb9e6('0x7')]=function(_0x1a6a4f,_0x1b9eed){return _0x1a6a4f['define'](_0xb9e6('0x8'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 3dbe7b0..f6963c1 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3fefbe,_0x3001b2){var _0x2559e4=function(_0x189c64){while(--_0x189c64){_0x3fefbe['push'](_0x3fefbe['shift']());}};_0x2559e4(++_0x3001b2);}(_0xe706,0xa3));var _0x6e70=function(_0x2f4ee6,_0x24a540){_0x2f4ee6=_0x2f4ee6-0x0;var _0x28f20e=_0xe706[_0x2f4ee6];return _0x28f20e;};'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(_0x36923f,_0x3caad1){var _0x56bab1=function(_0x46ab96){while(--_0x46ab96){_0x36923f['push'](_0x36923f['shift']());}};_0x56bab1(++_0x3caad1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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 6fe7da9..8d8510d 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 _0xfd74=['INTEGER','exports'];(function(_0x1d322e,_0x10582a){var _0x2efb6e=function(_0x29fc0f){while(--_0x29fc0f){_0x1d322e['push'](_0x1d322e['shift']());}};_0x2efb6e(++_0x10582a);}(_0xfd74,0x1f1));var _0x4fd7=function(_0x30033a,_0x5ce4a6){_0x30033a=_0x30033a-0x0;var _0x5e3518=_0xfd74[_0x30033a];return _0x5e3518;};'use strict';var Sequelize=require('sequelize');module[_0x4fd7('0x0')]={'penalty':{'type':Sequelize[_0x4fd7('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfee1=['INTEGER','exports'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0xfee1,0x85));var _0x1fee=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xfee1[_0x16d10f];return _0x50c823;};'use strict';var Sequelize=require('sequelize');module[_0x1fee('0x0')]={'penalty':{'type':Sequelize[_0x1fee('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 0ce3cbf..9327700 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 _0xefbf=['./teamVoiceQueue.attributes','define','TeamVoiceQueue','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5db287,_0x3f4647){var _0x3c11d8=function(_0x360cc7){while(--_0x360cc7){_0x5db287['push'](_0x5db287['shift']());}};_0x3c11d8(++_0x3f4647);}(_0xefbf,0xa3));var _0xfefb=function(_0x1a69d0,_0x35432a){_0x1a69d0=_0x1a69d0-0x0;var _0x1e1339=_0xefbf[_0x1a69d0];return _0x1e1339;};'use strict';var _=require(_0xfefb('0x0'));var util=require(_0xfefb('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xfefb('0x2'));var rp=require(_0xfefb('0x3'));var fs=require('fs');var path=require(_0xfefb('0x4'));var rimraf=require(_0xfefb('0x5'));var config=require(_0xfefb('0x6'));var attributes=require(_0xfefb('0x7'));module['exports']=function(_0xaac208,_0x58c767){return _0xaac208[_0xfefb('0x8')](_0xfefb('0x9'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x689c=['moment','bluebird','request-promise','path','../../config/environment','define','TeamVoiceQueue','team_has_voice_queues','../../config/logger','api'];(function(_0x17c916,_0x5f2e38){var _0x2b613d=function(_0x2c3de9){while(--_0x2c3de9){_0x17c916['push'](_0x17c916['shift']());}};_0x2b613d(++_0x5f2e38);}(_0x689c,0x9e));var _0xc689=function(_0x186d3e,_0x21eab3){_0x186d3e=_0x186d3e-0x0;var _0x184a5a=_0x689c[_0x186d3e];return _0x184a5a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc689('0x0'))(_0xc689('0x1'));var moment=require(_0xc689('0x2'));var BPromise=require(_0xc689('0x3'));var rp=require(_0xc689('0x4'));var fs=require('fs');var path=require(_0xc689('0x5'));var rimraf=require('rimraf');var config=require(_0xc689('0x6'));var attributes=require('./teamVoiceQueue.attributes');module['exports']=function(_0x3a4916,_0x28ce4c){return _0x3a4916[_0xc689('0x7')](_0xc689('0x8'),attributes,{'tableName':_0xc689('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 39481cb..3db1fa7 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 _0xea12=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x4c2609,_0x39867a){var _0x33946d=function(_0x2d7deb){while(--_0x2d7deb){_0x4c2609['push'](_0x4c2609['shift']());}};_0x33946d(++_0x39867a);}(_0xea12,0x149));var _0x2ea1=function(_0x1be7d9,_0x5a6119){_0x1be7d9=_0x1be7d9-0x0;var _0x23301a=_0xea12[_0x1be7d9];return _0x23301a;};'use strict';var _=require(_0x2ea1('0x0'));var util=require(_0x2ea1('0x1'));var moment=require(_0x2ea1('0x2'));var BPromise=require(_0x2ea1('0x3'));var rs=require(_0x2ea1('0x4'));var fs=require('fs');var Redis=require(_0x2ea1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2ea1('0x6'));var logger=require(_0x2ea1('0x7'))('rpc');var config=require(_0x2ea1('0x8'));var jayson=require(_0x2ea1('0x9'));var client=jayson[_0x2ea1('0xa')][_0x2ea1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e7ab2,_0x3177fd,_0x16b11e){return new BPromise(function(_0x5efe62,_0x19bfe4){return client['request'](_0x4e7ab2,_0x16b11e)[_0x2ea1('0xc')](function(_0x4016f3){logger[_0x2ea1('0xd')](_0x2ea1('0xe'),_0x3177fd,_0x2ea1('0xf'));logger['debug'](_0x2ea1('0x10'),_0x3177fd,_0x2ea1('0xf'),JSON['stringify'](_0x4016f3));if(_0x4016f3['error']){if(_0x4016f3[_0x2ea1('0x11')][_0x2ea1('0x12')]===0x1f4){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x3177fd,_0x4016f3[_0x2ea1('0x11')][_0x2ea1('0x13')]);return _0x19bfe4(_0x4016f3['error'][_0x2ea1('0x13')]);}logger[_0x2ea1('0x11')](_0x2ea1('0xe'),_0x3177fd,_0x4016f3[_0x2ea1('0x11')][_0x2ea1('0x13')]);return _0x5efe62(_0x4016f3[_0x2ea1('0x11')]['message']);}else{logger[_0x2ea1('0xd')]('TeamVoiceQueue,\x20%s,\x20%s',_0x3177fd,'request\x20sent');_0x5efe62(_0x4016f3[_0x2ea1('0x14')][_0x2ea1('0x13')]);}})[_0x2ea1('0x15')](function(_0x3d5736){logger[_0x2ea1('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x3177fd,_0x3d5736);_0x19bfe4(_0x3d5736);});});} \ No newline at end of file +var _0x9091=['bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','request','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x9091,0x7c));var _0x1909=function(_0x1a0513,_0x16b0b5){_0x1a0513=_0x1a0513-0x0;var _0x5a7285=_0x9091[_0x1a0513];return _0x5a7285;};'use strict';var _=require(_0x1909('0x0'));var util=require('util');var moment=require(_0x1909('0x1'));var BPromise=require(_0x1909('0x2'));var rs=require(_0x1909('0x3'));var fs=require('fs');var Redis=require(_0x1909('0x4'));var db=require(_0x1909('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1909('0x6'));var config=require(_0x1909('0x7'));var jayson=require(_0x1909('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x232b65,_0x292c04,_0x41bbdd){return new BPromise(function(_0x249f29,_0xff3826){return client[_0x1909('0x9')](_0x232b65,_0x41bbdd)['then'](function(_0x182114){logger[_0x1909('0xa')](_0x1909('0xb'),_0x292c04,_0x1909('0xc'));logger[_0x1909('0xd')](_0x1909('0xe'),_0x292c04,'request\x20sent',JSON[_0x1909('0xf')](_0x182114));if(_0x182114[_0x1909('0x10')]){if(_0x182114[_0x1909('0x10')][_0x1909('0x11')]===0x1f4){logger[_0x1909('0x10')](_0x1909('0xb'),_0x292c04,_0x182114[_0x1909('0x10')][_0x1909('0x12')]);return _0xff3826(_0x182114['error'][_0x1909('0x12')]);}logger[_0x1909('0x10')](_0x1909('0xb'),_0x292c04,_0x182114[_0x1909('0x10')][_0x1909('0x12')]);return _0x249f29(_0x182114['error']['message']);}else{logger[_0x1909('0xa')](_0x1909('0xb'),_0x292c04,'request\x20sent');_0x249f29(_0x182114[_0x1909('0x13')][_0x1909('0x12')]);}})[_0x1909('0x14')](function(_0x46663f){logger[_0x1909('0x10')](_0x1909('0xb'),_0x292c04,_0x46663f);_0xff3826(_0x46663f);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index dd70849..3c529d2 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 _0xf79e=['put','/:id','update','delete','destroy','util','path','connect-timeout','Router','fs-extra','../../config/environment','./template.controller','get','isAuthenticated','index','post'];(function(_0x5d4f9f,_0x25ab08){var _0x4c7afa=function(_0x218a93){while(--_0x218a93){_0x5d4f9f['push'](_0x5d4f9f['shift']());}};_0x4c7afa(++_0x25ab08);}(_0xf79e,0x185));var _0xef79=function(_0x424181,_0x5cd0fd){_0x424181=_0x424181-0x0;var _0x406eed=_0xf79e[_0x424181];return _0x406eed;};'use strict';var multer=require('multer');var util=require(_0xef79('0x0'));var path=require(_0xef79('0x1'));var timeout=require(_0xef79('0x2'));var express=require('express');var router=express[_0xef79('0x3')]();var fs_extra=require(_0xef79('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xef79('0x5'));var controller=require(_0xef79('0x6'));router[_0xef79('0x7')]('/',auth[_0xef79('0x8')](),controller[_0xef79('0x9')]);router[_0xef79('0x7')]('/:id',auth[_0xef79('0x8')](),controller['show']);router[_0xef79('0xa')]('/',auth[_0xef79('0x8')](),controller['create']);router[_0xef79('0xb')](_0xef79('0xc'),auth[_0xef79('0x8')](),controller[_0xef79('0xd')]);router[_0xef79('0xe')](_0xef79('0xc'),auth[_0xef79('0x8')](),controller[_0xef79('0xf')]);module['exports']=router; \ No newline at end of file +var _0xa7db=['./template.controller','isAuthenticated','index','get','/:id','show','create','put','delete','destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x567857,_0x167c33){var _0x31d919=function(_0x1e73d3){while(--_0x1e73d3){_0x567857['push'](_0x567857['shift']());}};_0x31d919(++_0x167c33);}(_0xa7db,0xbf));var _0xba7d=function(_0x18d3eb,_0x5334d6){_0x18d3eb=_0x18d3eb-0x0;var _0x4bddd1=_0xa7db[_0x18d3eb];return _0x4bddd1;};'use strict';var multer=require(_0xba7d('0x0'));var util=require(_0xba7d('0x1'));var path=require(_0xba7d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xba7d('0x3'));var auth=require(_0xba7d('0x4'));var interaction=require(_0xba7d('0x5'));var config=require(_0xba7d('0x6'));var controller=require(_0xba7d('0x7'));router['get']('/',auth[_0xba7d('0x8')](),controller[_0xba7d('0x9')]);router[_0xba7d('0xa')](_0xba7d('0xb'),auth[_0xba7d('0x8')](),controller[_0xba7d('0xc')]);router['post']('/',auth[_0xba7d('0x8')](),controller[_0xba7d('0xd')]);router[_0xba7d('0xe')](_0xba7d('0xb'),auth[_0xba7d('0x8')](),controller['update']);router[_0xba7d('0xf')](_0xba7d('0xb'),auth['isAuthenticated'](),controller[_0xba7d('0x10')]);module[_0xba7d('0x11')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 623a8b9..b72f6e4 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 _0x7463=['exports','STRING','TEXT'];(function(_0x5f16b5,_0x48bbd1){var _0x5105f1=function(_0x342b25){while(--_0x342b25){_0x5f16b5['push'](_0x5f16b5['shift']());}};_0x5105f1(++_0x48bbd1);}(_0x7463,0x1c2));var _0x3746=function(_0x37c07d,_0xdbdb5f){_0x37c07d=_0x37c07d-0x0;var _0x10dadc=_0x7463[_0x37c07d];return _0x10dadc;};'use strict';var Sequelize=require('sequelize');module[_0x3746('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3746('0x1')]},'html':{'type':Sequelize[_0x3746('0x2')]}}; \ No newline at end of file +var _0x85a0=['exports','STRING','sequelize'];(function(_0x10920f,_0x1e89e0){var _0x8edae2=function(_0x31e5a2){while(--_0x31e5a2){_0x10920f['push'](_0x10920f['shift']());}};_0x8edae2(++_0x1e89e0);}(_0x85a0,0x1d0));var _0x085a=function(_0xa4eab1,_0x217917){_0xa4eab1=_0xa4eab1-0x0;var _0xcff511=_0x85a0[_0xa4eab1];return _0xcff511;};'use strict';var Sequelize=require(_0x085a('0x0'));module[_0x085a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x085a('0x2')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index d0dc722..563d900 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 _0x33d0=['includeAll','findAll','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','zip-dir','request-promise','moment','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','reject','save','then','destroy','get','Templates','UserProfileResource','sendStatus','error','name','index','Template','rawAttributes','key','map','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge'];(function(_0x27849e,_0x3c58ce){var _0x159449=function(_0x1c8425){while(--_0x1c8425){_0x27849e['push'](_0x27849e['shift']());}};_0x159449(++_0x3c58ce);}(_0x33d0,0x1a6));var _0x033d=function(_0x643a8,_0x47161c){_0x643a8=_0x643a8-0x0;var _0x159201=_0x33d0[_0x643a8];return _0x159201;};'use strict';var emlformat=require(_0x033d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x033d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x033d('0x2'));var moment=require(_0x033d('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x033d('0x4'));var path=require(_0x033d('0x5'));var sox=require(_0x033d('0x6'));var csv=require('to-csv');var ejs=require(_0x033d('0x7'));var fs=require('fs');var fs_extra=require(_0x033d('0x8'));var _=require('lodash');var squel=require(_0x033d('0x9'));var crypto=require(_0x033d('0xa'));var jsforce=require(_0x033d('0xb'));var deskjs=require(_0x033d('0xc'));var toCsv=require(_0x033d('0xd'));var querystring=require(_0x033d('0xe'));var Papa=require(_0x033d('0xf'));var Redis=require(_0x033d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x033d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x033d('0x12'));var logger=require(_0x033d('0x13'))(_0x033d('0x14'));var utils=require('../../config/utils');var config=require(_0x033d('0x15'));var licenseUtil=require(_0x033d('0x16'));var db=require(_0x033d('0x17'))['db'];function respondWithStatusCode(_0x29a140,_0x28d1e7){_0x28d1e7=_0x28d1e7||0xcc;return function(_0x596cdc){if(_0x596cdc){return _0x29a140['sendStatus'](_0x28d1e7);}return _0x29a140[_0x033d('0x18')](_0x28d1e7)[_0x033d('0x19')]();};}function respondWithResult(_0x5bf8ff,_0x1aa1ba){_0x1aa1ba=_0x1aa1ba||0xc8;return function(_0x23dcce){if(_0x23dcce){return _0x5bf8ff[_0x033d('0x18')](_0x1aa1ba)['json'](_0x23dcce);}};}function respondWithFilteredResult(_0xc6fa8f,_0x25573f){return function(_0x811b0){if(_0x811b0){var _0x11f225=typeof _0x25573f['offset']===_0x033d('0x1a')&&typeof _0x25573f[_0x033d('0x1b')]==='undefined';var _0x3ae699=_0x811b0[_0x033d('0x1c')];var _0x107e8c=_0x11f225?0x0:_0x25573f[_0x033d('0x1d')];var _0x5d220d=_0x11f225?_0x811b0[_0x033d('0x1c')]:_0x25573f['offset']+_0x25573f[_0x033d('0x1b')];var _0x52112b;if(_0x5d220d>=_0x3ae699){_0x5d220d=_0x3ae699;_0x52112b=0xc8;}else{_0x52112b=0xce;}_0xc6fa8f[_0x033d('0x18')](_0x52112b);return _0xc6fa8f[_0x033d('0x1e')](_0x033d('0x1f'),_0x107e8c+'-'+_0x5d220d+'/'+_0x3ae699)['json'](_0x811b0);}return null;};}function patchUpdates(_0x24f813){return function(_0x10aa9a){try{jsonpatch['apply'](_0x10aa9a,_0x24f813,!![]);}catch(_0x5b17b5){return BPromise[_0x033d('0x20')](_0x5b17b5);}return _0x10aa9a[_0x033d('0x21')]();};}function saveUpdates(_0x2eaf4c,_0x4e4f08){return function(_0x4a0d24){if(_0x4a0d24){return _0x4a0d24['update'](_0x2eaf4c)[_0x033d('0x22')](function(_0x57addb){return _0x57addb;});}return null;};}function removeEntity(_0x5d1a28,_0x317cab){return function(_0x5e86ff){if(_0x5e86ff){return _0x5e86ff[_0x033d('0x23')]()[_0x033d('0x22')](function(){var _0x4096bf=_0x5e86ff[_0x033d('0x24')]({'plain':!![]});var _0x2f5bfe=_0x033d('0x25');return db[_0x033d('0x26')]['destroy']({'where':{'type':_0x2f5bfe,'resourceId':_0x4096bf['id']}})[_0x033d('0x22')](function(){return _0x5e86ff;});})[_0x033d('0x22')](function(){_0x5d1a28[_0x033d('0x18')](0xcc)[_0x033d('0x19')]();});}};}function handleEntityNotFound(_0x1cb5fd,_0x232fe2){return function(_0x40b255){if(!_0x40b255){_0x1cb5fd[_0x033d('0x27')](0x194);}return _0x40b255;};}function handleError(_0x26a9c9,_0x4ce88e){_0x4ce88e=_0x4ce88e||0x1f4;return function(_0x51d09a){logger[_0x033d('0x28')](_0x51d09a['stack']);if(_0x51d09a[_0x033d('0x29')]){delete _0x51d09a[_0x033d('0x29')];}_0x26a9c9['status'](_0x4ce88e)['send'](_0x51d09a);};}exports[_0x033d('0x2a')]=function(_0x5385c0,_0x245d32){var _0x273b03={},_0x27b268={},_0xd5f9eb={'count':0x0,'rows':[]};var _0x269077=_['map'](db[_0x033d('0x2b')][_0x033d('0x2c')],function(_0x244029){return{'name':_0x244029['fieldName'],'type':_0x244029['type'][_0x033d('0x2d')]};});_0x27b268['model']=_[_0x033d('0x2e')](_0x269077,_0x033d('0x29'));_0x27b268['query']=_[_0x033d('0x2f')](_0x5385c0[_0x033d('0x30')]);_0x27b268[_0x033d('0x31')]=_[_0x033d('0x32')](_0x27b268['model'],_0x27b268[_0x033d('0x30')]);_0x273b03[_0x033d('0x33')]=_[_0x033d('0x32')](_0x27b268[_0x033d('0x34')],qs['fields'](_0x5385c0['query'][_0x033d('0x35')]));_0x273b03[_0x033d('0x33')]=_0x273b03[_0x033d('0x33')][_0x033d('0x36')]?_0x273b03[_0x033d('0x33')]:_0x27b268[_0x033d('0x34')];if(!_0x5385c0[_0x033d('0x30')][_0x033d('0x37')](_0x033d('0x38'))){_0x273b03[_0x033d('0x1b')]=qs[_0x033d('0x1b')](_0x5385c0[_0x033d('0x30')][_0x033d('0x1b')]);_0x273b03[_0x033d('0x1d')]=qs['offset'](_0x5385c0[_0x033d('0x30')][_0x033d('0x1d')]);}_0x273b03[_0x033d('0x39')]=qs[_0x033d('0x3a')](_0x5385c0['query'][_0x033d('0x3a')]);_0x273b03[_0x033d('0x3b')]=qs[_0x033d('0x31')](_[_0x033d('0x3c')](_0x5385c0[_0x033d('0x30')],_0x27b268[_0x033d('0x31')]),_0x269077);if(_0x5385c0[_0x033d('0x30')][_0x033d('0x3d')]){_0x273b03[_0x033d('0x3b')]=_['merge'](_0x273b03[_0x033d('0x3b')],{'$or':_['map'](_0x269077,function(_0x11e06c){if(_0x11e06c['type']!==_0x033d('0x3e')){var _0x565ffc={};_0x565ffc[_0x11e06c[_0x033d('0x29')]]={'$like':'%'+_0x5385c0[_0x033d('0x30')][_0x033d('0x3d')]+'%'};return _0x565ffc;}})});}_0x273b03=_[_0x033d('0x3f')]({},_0x273b03,_0x5385c0['options']);var _0x21e8a7={'where':_0x273b03['where']};return db[_0x033d('0x2b')][_0x033d('0x1c')](_0x21e8a7)[_0x033d('0x22')](function(_0x1bedba){_0xd5f9eb[_0x033d('0x1c')]=_0x1bedba;if(_0x5385c0[_0x033d('0x30')][_0x033d('0x40')]){_0x273b03['include']=[{'all':!![]}];}return db['Template'][_0x033d('0x41')](_0x273b03);})['then'](function(_0x374776){_0xd5f9eb[_0x033d('0x42')]=_0x374776;return _0xd5f9eb;})[_0x033d('0x22')](respondWithFilteredResult(_0x245d32,_0x273b03))[_0x033d('0x43')](handleError(_0x245d32,null));};exports[_0x033d('0x44')]=function(_0x15fa0,_0x368728){var _0x1ff570={'raw':!![],'where':{'id':_0x15fa0[_0x033d('0x45')]['id']}},_0x286a85={};_0x286a85[_0x033d('0x34')]=_['keys'](db[_0x033d('0x2b')]['rawAttributes']);_0x286a85[_0x033d('0x30')]=_['keys'](_0x15fa0[_0x033d('0x30')]);_0x286a85['filters']=_['intersection'](_0x286a85[_0x033d('0x34')],_0x286a85[_0x033d('0x30')]);_0x1ff570[_0x033d('0x33')]=_[_0x033d('0x32')](_0x286a85[_0x033d('0x34')],qs[_0x033d('0x35')](_0x15fa0[_0x033d('0x30')]['fields']));_0x1ff570[_0x033d('0x33')]=_0x1ff570['attributes'][_0x033d('0x36')]?_0x1ff570[_0x033d('0x33')]:_0x286a85[_0x033d('0x34')];if(_0x15fa0[_0x033d('0x30')][_0x033d('0x40')]){_0x1ff570['include']=[{'all':!![]}];}_0x1ff570=_[_0x033d('0x3f')]({},_0x1ff570,_0x15fa0[_0x033d('0x46')]);return db['Template'][_0x033d('0x47')](_0x1ff570)[_0x033d('0x22')](handleEntityNotFound(_0x368728,null))[_0x033d('0x22')](respondWithResult(_0x368728,null))['catch'](handleError(_0x368728,null));};exports['create']=function(_0xd0513d,_0x57c2fa){return db[_0x033d('0x2b')][_0x033d('0x48')](_0xd0513d[_0x033d('0x49')],{})[_0x033d('0x22')](function(_0x454303){var _0x5dcb55=_0xd0513d[_0x033d('0x4a')][_0x033d('0x24')]({'plain':!![]});if(!_0x5dcb55)throw new Error(_0x033d('0x4b'));if(_0x5dcb55[_0x033d('0x4c')]==='user'){var _0x56d57d=_0x454303['get']({'plain':!![]});var _0x28ed54=_0x033d('0x25');return db[_0x033d('0x4d')][_0x033d('0x47')]({'where':{'name':_0x28ed54,'userProfileId':_0x5dcb55[_0x033d('0x4e')]},'raw':!![]})['then'](function(_0x472b29){if(_0x472b29&&_0x472b29['autoAssociation']===0x0){return db['UserProfileResource'][_0x033d('0x48')]({'name':_0x56d57d[_0x033d('0x29')],'resourceId':_0x56d57d['id'],'type':_0x472b29[_0x033d('0x29')],'sectionId':_0x472b29['id']},{})[_0x033d('0x22')](function(){return _0x454303;});}else{return _0x454303;}})[_0x033d('0x43')](function(_0x4a55e6){logger[_0x033d('0x28')](_0x033d('0x4f'),_0x4a55e6);throw _0x4a55e6;});}return _0x454303;})[_0x033d('0x22')](respondWithResult(_0x57c2fa,0xc9))[_0x033d('0x43')](handleError(_0x57c2fa,null));};exports[_0x033d('0x50')]=function(_0x45aa00,_0x406447){if(_0x45aa00[_0x033d('0x49')]['id']){delete _0x45aa00['body']['id'];}return db[_0x033d('0x2b')]['find']({'where':{'id':_0x45aa00['params']['id']}})[_0x033d('0x22')](handleEntityNotFound(_0x406447,null))[_0x033d('0x22')](saveUpdates(_0x45aa00['body'],null))[_0x033d('0x22')](respondWithResult(_0x406447,null))[_0x033d('0x43')](handleError(_0x406447,null));};exports[_0x033d('0x23')]=function(_0x2532ea,_0x229c90){return db[_0x033d('0x2b')]['find']({'where':{'id':_0x2532ea['params']['id']}})['then'](handleEntityNotFound(_0x229c90,null))[_0x033d('0x22')](removeEntity(_0x229c90,null))[_0x033d('0x43')](handleError(_0x229c90,null));}; \ No newline at end of file +var _0x7301=['VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','Template','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','merge','where'];(function(_0x5cd1e2,_0x4ba7c5){var _0xc60885=function(_0x17f488){while(--_0x17f488){_0x5cd1e2['push'](_0x5cd1e2['shift']());}};_0xc60885(++_0x4ba7c5);}(_0x7301,0x1c5));var _0x1730=function(_0x1393f7,_0x343816){_0x1393f7=_0x1393f7-0x0;var _0x34e63b=_0x7301[_0x1393f7];return _0x34e63b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1730('0x0'));var zipdir=require(_0x1730('0x1'));var jsonpatch=require(_0x1730('0x2'));var rp=require(_0x1730('0x3'));var moment=require('moment');var BPromise=require(_0x1730('0x4'));var Mustache=require(_0x1730('0x5'));var util=require(_0x1730('0x6'));var path=require(_0x1730('0x7'));var sox=require(_0x1730('0x8'));var csv=require(_0x1730('0x9'));var ejs=require(_0x1730('0xa'));var fs=require('fs');var fs_extra=require(_0x1730('0xb'));var _=require(_0x1730('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1730('0xd'));var deskjs=require(_0x1730('0xe'));var toCsv=require(_0x1730('0x9'));var querystring=require(_0x1730('0xf'));var Papa=require(_0x1730('0x10'));var Redis=require(_0x1730('0x11'));var authService=require(_0x1730('0x12'));var qs=require(_0x1730('0x13'));var as=require(_0x1730('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1730('0x15'))(_0x1730('0x16'));var utils=require(_0x1730('0x17'));var config=require(_0x1730('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x1730('0x19'))['db'];function respondWithStatusCode(_0x186683,_0x322b08){_0x322b08=_0x322b08||0xcc;return function(_0x4fbb00){if(_0x4fbb00){return _0x186683[_0x1730('0x1a')](_0x322b08);}return _0x186683[_0x1730('0x1b')](_0x322b08)[_0x1730('0x1c')]();};}function respondWithResult(_0x2474c4,_0x4a7a12){_0x4a7a12=_0x4a7a12||0xc8;return function(_0x4ab470){if(_0x4ab470){return _0x2474c4[_0x1730('0x1b')](_0x4a7a12)[_0x1730('0x1d')](_0x4ab470);}};}function respondWithFilteredResult(_0x4e3c6d,_0x454e18){return function(_0x5a3130){if(_0x5a3130){var _0x305d50=typeof _0x454e18['offset']===_0x1730('0x1e')&&typeof _0x454e18['limit']===_0x1730('0x1e');var _0x5a7407=_0x5a3130['count'];var _0x55b572=_0x305d50?0x0:_0x454e18['offset'];var _0xda17e7=_0x305d50?_0x5a3130[_0x1730('0x1f')]:_0x454e18[_0x1730('0x20')]+_0x454e18[_0x1730('0x21')];var _0x508790;if(_0xda17e7>=_0x5a7407){_0xda17e7=_0x5a7407;_0x508790=0xc8;}else{_0x508790=0xce;}_0x4e3c6d[_0x1730('0x1b')](_0x508790);return _0x4e3c6d[_0x1730('0x22')](_0x1730('0x23'),_0x55b572+'-'+_0xda17e7+'/'+_0x5a7407)[_0x1730('0x1d')](_0x5a3130);}return null;};}function patchUpdates(_0x4c2691){return function(_0x508eb5){try{jsonpatch[_0x1730('0x24')](_0x508eb5,_0x4c2691,!![]);}catch(_0x2ac452){return BPromise[_0x1730('0x25')](_0x2ac452);}return _0x508eb5[_0x1730('0x26')]();};}function saveUpdates(_0x5b5642,_0x51ef3c){return function(_0x51fb76){if(_0x51fb76){return _0x51fb76[_0x1730('0x27')](_0x5b5642)['then'](function(_0x3c649a){return _0x3c649a;});}return null;};}function removeEntity(_0x303aaf,_0x41d192){return function(_0x2404fa){if(_0x2404fa){return _0x2404fa['destroy']()[_0x1730('0x28')](function(){var _0xc91731=_0x2404fa[_0x1730('0x29')]({'plain':!![]});var _0x9168fb='Templates';return db[_0x1730('0x2a')][_0x1730('0x2b')]({'where':{'type':_0x9168fb,'resourceId':_0xc91731['id']}})[_0x1730('0x28')](function(){return _0x2404fa;});})[_0x1730('0x28')](function(){_0x303aaf[_0x1730('0x1b')](0xcc)[_0x1730('0x1c')]();});}};}function handleEntityNotFound(_0x8a028e,_0x4d6ed7){return function(_0x5eb6f3){if(!_0x5eb6f3){_0x8a028e[_0x1730('0x1a')](0x194);}return _0x5eb6f3;};}function handleError(_0x3cef14,_0x37f1c6){_0x37f1c6=_0x37f1c6||0x1f4;return function(_0x15f15e){logger[_0x1730('0x2c')](_0x15f15e[_0x1730('0x2d')]);if(_0x15f15e['name']){delete _0x15f15e[_0x1730('0x2e')];}_0x3cef14[_0x1730('0x1b')](_0x37f1c6)[_0x1730('0x2f')](_0x15f15e);};}exports[_0x1730('0x30')]=function(_0x134eb1,_0x23cb25){var _0x2fa559={},_0x3cc0aa={},_0x204bac={'count':0x0,'rows':[]};var _0x3a736c=_[_0x1730('0x31')](db[_0x1730('0x32')][_0x1730('0x33')],function(_0x30a551){return{'name':_0x30a551[_0x1730('0x34')],'type':_0x30a551[_0x1730('0x35')][_0x1730('0x36')]};});_0x3cc0aa[_0x1730('0x37')]=_[_0x1730('0x31')](_0x3a736c,_0x1730('0x2e'));_0x3cc0aa[_0x1730('0x38')]=_[_0x1730('0x39')](_0x134eb1['query']);_0x3cc0aa[_0x1730('0x3a')]=_[_0x1730('0x3b')](_0x3cc0aa[_0x1730('0x37')],_0x3cc0aa[_0x1730('0x38')]);_0x2fa559[_0x1730('0x3c')]=_['intersection'](_0x3cc0aa[_0x1730('0x37')],qs[_0x1730('0x3d')](_0x134eb1[_0x1730('0x38')]['fields']));_0x2fa559[_0x1730('0x3c')]=_0x2fa559[_0x1730('0x3c')]['length']?_0x2fa559[_0x1730('0x3c')]:_0x3cc0aa['model'];if(!_0x134eb1[_0x1730('0x38')][_0x1730('0x3e')](_0x1730('0x3f'))){_0x2fa559['limit']=qs[_0x1730('0x21')](_0x134eb1[_0x1730('0x38')][_0x1730('0x21')]);_0x2fa559[_0x1730('0x20')]=qs['offset'](_0x134eb1[_0x1730('0x38')][_0x1730('0x20')]);}_0x2fa559['order']=qs['sort'](_0x134eb1[_0x1730('0x38')][_0x1730('0x40')]);_0x2fa559['where']=qs[_0x1730('0x3a')](_[_0x1730('0x41')](_0x134eb1[_0x1730('0x38')],_0x3cc0aa[_0x1730('0x3a')]),_0x3a736c);if(_0x134eb1['query'][_0x1730('0x42')]){_0x2fa559['where']=_[_0x1730('0x43')](_0x2fa559[_0x1730('0x44')],{'$or':_[_0x1730('0x31')](_0x3a736c,function(_0x3fa0e1){if(_0x3fa0e1[_0x1730('0x35')]!==_0x1730('0x45')){var _0x252e0e={};_0x252e0e[_0x3fa0e1[_0x1730('0x2e')]]={'$like':'%'+_0x134eb1[_0x1730('0x38')][_0x1730('0x42')]+'%'};return _0x252e0e;}})});}_0x2fa559=_[_0x1730('0x43')]({},_0x2fa559,_0x134eb1[_0x1730('0x46')]);var _0xd88d0c={'where':_0x2fa559[_0x1730('0x44')]};return db[_0x1730('0x32')][_0x1730('0x1f')](_0xd88d0c)[_0x1730('0x28')](function(_0x3651ee){_0x204bac['count']=_0x3651ee;if(_0x134eb1[_0x1730('0x38')][_0x1730('0x47')]){_0x2fa559[_0x1730('0x48')]=[{'all':!![]}];}return db[_0x1730('0x32')][_0x1730('0x49')](_0x2fa559);})[_0x1730('0x28')](function(_0x19224f){_0x204bac[_0x1730('0x4a')]=_0x19224f;return _0x204bac;})['then'](respondWithFilteredResult(_0x23cb25,_0x2fa559))[_0x1730('0x4b')](handleError(_0x23cb25,null));};exports[_0x1730('0x4c')]=function(_0xb121cb,_0x44fc81){var _0x590a86={'raw':!![],'where':{'id':_0xb121cb[_0x1730('0x4d')]['id']}},_0x3aeccd={};_0x3aeccd[_0x1730('0x37')]=_['keys'](db[_0x1730('0x32')][_0x1730('0x33')]);_0x3aeccd['query']=_['keys'](_0xb121cb[_0x1730('0x38')]);_0x3aeccd[_0x1730('0x3a')]=_[_0x1730('0x3b')](_0x3aeccd[_0x1730('0x37')],_0x3aeccd[_0x1730('0x38')]);_0x590a86['attributes']=_[_0x1730('0x3b')](_0x3aeccd['model'],qs[_0x1730('0x3d')](_0xb121cb[_0x1730('0x38')][_0x1730('0x3d')]));_0x590a86[_0x1730('0x3c')]=_0x590a86[_0x1730('0x3c')][_0x1730('0x4e')]?_0x590a86['attributes']:_0x3aeccd[_0x1730('0x37')];if(_0xb121cb[_0x1730('0x38')][_0x1730('0x47')]){_0x590a86[_0x1730('0x48')]=[{'all':!![]}];}_0x590a86=_[_0x1730('0x43')]({},_0x590a86,_0xb121cb['options']);return db[_0x1730('0x32')][_0x1730('0x4f')](_0x590a86)[_0x1730('0x28')](handleEntityNotFound(_0x44fc81,null))[_0x1730('0x28')](respondWithResult(_0x44fc81,null))[_0x1730('0x4b')](handleError(_0x44fc81,null));};exports[_0x1730('0x50')]=function(_0xa47fe2,_0x1f7e58){return db[_0x1730('0x32')][_0x1730('0x50')](_0xa47fe2[_0x1730('0x51')],{})['then'](function(_0xbab02e){var _0x283600=_0xa47fe2[_0x1730('0x52')][_0x1730('0x29')]({'plain':!![]});if(!_0x283600)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x283600[_0x1730('0x53')]===_0x1730('0x52')){var _0x5e0777=_0xbab02e[_0x1730('0x29')]({'plain':!![]});var _0xb1c553='Templates';return db['UserProfileSection']['find']({'where':{'name':_0xb1c553,'userProfileId':_0x283600[_0x1730('0x54')]},'raw':!![]})[_0x1730('0x28')](function(_0x5a5ca2){if(_0x5a5ca2&&_0x5a5ca2[_0x1730('0x55')]===0x0){return db[_0x1730('0x2a')][_0x1730('0x50')]({'name':_0x5e0777[_0x1730('0x2e')],'resourceId':_0x5e0777['id'],'type':_0x5a5ca2['name'],'sectionId':_0x5a5ca2['id']},{})[_0x1730('0x28')](function(){return _0xbab02e;});}else{return _0xbab02e;}})[_0x1730('0x4b')](function(_0x266187){logger[_0x1730('0x2c')](_0x1730('0x56'),_0x266187);throw _0x266187;});}return _0xbab02e;})[_0x1730('0x28')](respondWithResult(_0x1f7e58,0xc9))[_0x1730('0x4b')](handleError(_0x1f7e58,null));};exports[_0x1730('0x27')]=function(_0x501260,_0x1531de){if(_0x501260[_0x1730('0x51')]['id']){delete _0x501260[_0x1730('0x51')]['id'];}return db[_0x1730('0x32')]['find']({'where':{'id':_0x501260[_0x1730('0x4d')]['id']}})[_0x1730('0x28')](handleEntityNotFound(_0x1531de,null))[_0x1730('0x28')](saveUpdates(_0x501260[_0x1730('0x51')],null))[_0x1730('0x28')](respondWithResult(_0x1531de,null))[_0x1730('0x4b')](handleError(_0x1531de,null));};exports[_0x1730('0x2b')]=function(_0x2004b3,_0x38376f){return db[_0x1730('0x32')][_0x1730('0x4f')]({'where':{'id':_0x2004b3[_0x1730('0x4d')]['id']}})[_0x1730('0x28')](handleEntityNotFound(_0x38376f,null))['then'](removeEntity(_0x38376f,null))['catch'](handleError(_0x38376f,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 906e8e1..1363b5e 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 _0xad5d=['path','rimraf','./template.attributes','exports','define','Template','tools_templates','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x10044f,_0x9b5cbd){var _0x81449b=function(_0x96c59e){while(--_0x96c59e){_0x10044f['push'](_0x10044f['shift']());}};_0x81449b(++_0x9b5cbd);}(_0xad5d,0x14b));var _0xdad5=function(_0x146438,_0x55662e){_0x146438=_0x146438-0x0;var _0x388433=_0xad5d[_0x146438];return _0x388433;};'use strict';var _=require('lodash');var util=require(_0xdad5('0x0'));var logger=require(_0xdad5('0x1'))('api');var moment=require(_0xdad5('0x2'));var BPromise=require(_0xdad5('0x3'));var rp=require(_0xdad5('0x4'));var fs=require('fs');var path=require(_0xdad5('0x5'));var rimraf=require(_0xdad5('0x6'));var config=require('../../config/environment');var attributes=require(_0xdad5('0x7'));module[_0xdad5('0x8')]=function(_0xfece82,_0x160901){return _0xfece82[_0xdad5('0x9')](_0xdad5('0xa'),attributes,{'tableName':_0xdad5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa727=['../../config/environment','./template.attributes','define','Template','tools_templates','lodash','util','../../config/logger','api','moment','path','rimraf'];(function(_0x26c6aa,_0x2ac757){var _0x55e06b=function(_0x292484){while(--_0x292484){_0x26c6aa['push'](_0x26c6aa['shift']());}};_0x55e06b(++_0x2ac757);}(_0xa727,0xf5));var _0x7a72=function(_0x1d5cd8,_0x1a9b57){_0x1d5cd8=_0x1d5cd8-0x0;var _0x18b119=_0xa727[_0x1d5cd8];return _0x18b119;};'use strict';var _=require(_0x7a72('0x0'));var util=require(_0x7a72('0x1'));var logger=require(_0x7a72('0x2'))(_0x7a72('0x3'));var moment=require(_0x7a72('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7a72('0x5'));var rimraf=require(_0x7a72('0x6'));var config=require(_0x7a72('0x7'));var attributes=require(_0x7a72('0x8'));module['exports']=function(_0x5e2f19,_0x3023e7){return _0x5e2f19[_0x7a72('0x9')](_0x7a72('0xa'),attributes,{'tableName':_0x7a72('0xb'),'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 e35b8c1..064bfb1 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 _0x08b7=['moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','where','attributes','limit','include','map','model','GetTemplate','util'];(function(_0xf65358,_0x12c05){var _0x3e701c=function(_0x189173){while(--_0x189173){_0xf65358['push'](_0xf65358['shift']());}};_0x3e701c(++_0x12c05);}(_0x08b7,0x173));var _0x708b=function(_0x2a8248,_0x4e9347){_0x2a8248=_0x2a8248-0x0;var _0x449219=_0x08b7[_0x2a8248];return _0x449219;};'use strict';var _=require('lodash');var util=require(_0x708b('0x0'));var moment=require(_0x708b('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x708b('0x2'))['db'];var utils=require(_0x708b('0x3'));var logger=require(_0x708b('0x4'))('rpc');var config=require(_0x708b('0x5'));var jayson=require(_0x708b('0x6'));var client=jayson[_0x708b('0x7')][_0x708b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4696ae,_0x3dd4a8,_0x263b12){return new BPromise(function(_0x2baff9,_0x3c371a){return client[_0x708b('0x9')](_0x4696ae,_0x263b12)[_0x708b('0xa')](function(_0x14ea9f){logger[_0x708b('0xb')](_0x708b('0xc'),_0x3dd4a8,_0x708b('0xd'));logger[_0x708b('0xe')](_0x708b('0xf'),_0x3dd4a8,_0x708b('0xd'),JSON[_0x708b('0x10')](_0x14ea9f));if(_0x14ea9f[_0x708b('0x11')]){if(_0x14ea9f['error'][_0x708b('0x12')]===0x1f4){logger[_0x708b('0x11')](_0x708b('0xc'),_0x3dd4a8,_0x14ea9f[_0x708b('0x11')]['message']);return _0x3c371a(_0x14ea9f['error'][_0x708b('0x13')]);}logger['error'](_0x708b('0xc'),_0x3dd4a8,_0x14ea9f['error'][_0x708b('0x13')]);return _0x2baff9(_0x14ea9f[_0x708b('0x11')]['message']);}else{logger['info'](_0x708b('0xc'),_0x3dd4a8,_0x708b('0xd'));_0x2baff9(_0x14ea9f[_0x708b('0x14')][_0x708b('0x13')]);}})[_0x708b('0x15')](function(_0x46e46d){logger['error'](_0x708b('0xc'),_0x3dd4a8,_0x46e46d);_0x3c371a(_0x46e46d);});});}exports['GetTemplate']=function(_0x4ee3ca){var _0x16b943=this;return new Promise(function(_0x3c2e78,_0x53afcf){return db['Template'][_0x708b('0x16')]({'raw':_0x4ee3ca['options']?_0x4ee3ca['options']['raw']===undefined?!![]:![]:!![],'where':_0x4ee3ca[_0x708b('0x17')]?_0x4ee3ca[_0x708b('0x17')][_0x708b('0x18')]||null:null,'attributes':_0x4ee3ca[_0x708b('0x17')]?_0x4ee3ca['options'][_0x708b('0x19')]||null:null,'limit':_0x4ee3ca['options']?_0x4ee3ca[_0x708b('0x17')][_0x708b('0x1a')]||null:null,'include':_0x4ee3ca[_0x708b('0x17')]?_0x4ee3ca[_0x708b('0x17')][_0x708b('0x1b')]?_[_0x708b('0x1c')](_0x4ee3ca[_0x708b('0x17')]['include'],function(_0x16a021){return{'model':db[_0x16a021[_0x708b('0x1d')]],'as':_0x16a021['as'],'attributes':_0x16a021[_0x708b('0x19')],'include':_0x16a021[_0x708b('0x1b')]?_[_0x708b('0x1c')](_0x16a021[_0x708b('0x1b')],function(_0x287be8){return{'model':db[_0x287be8['model']],'as':_0x287be8['as'],'attributes':_0x287be8[_0x708b('0x19')],'include':_0x287be8[_0x708b('0x1b')]?_[_0x708b('0x1c')](_0x287be8[_0x708b('0x1b')],function(_0xd28a87){return{'model':db[_0xd28a87[_0x708b('0x1d')]],'as':_0xd28a87['as'],'attributes':_0xd28a87[_0x708b('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x13d14c){logger['info'](_0x708b('0x1e'),_0x4ee3ca);logger[_0x708b('0xe')](_0x708b('0x1e'),_0x4ee3ca,JSON[_0x708b('0x10')](_0x13d14c));_0x3c2e78(_0x13d14c);})[_0x708b('0x15')](function(_0x32c6c2){logger[_0x708b('0x11')]('GetTemplate',_0x32c6c2[_0x708b('0x13')],_0x4ee3ca);_0x53afcf(_0x16b943[_0x708b('0x11')](0x1f4,_0x32c6c2[_0x708b('0x13')]));});});}; \ No newline at end of file +var _0x6bc4=['code','message','info','request\x20sent','catch','GetTemplate','Template','findAll','options','raw','where','attributes','include','map','model','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x36665f,_0x4f9488){var _0x481d25=function(_0x3779cc){while(--_0x3779cc){_0x36665f['push'](_0x36665f['shift']());}};_0x481d25(++_0x4f9488);}(_0x6bc4,0x164));var _0x46bc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6bc4[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x46bc('0x0'));var moment=require('moment');var BPromise=require(_0x46bc('0x1'));var rs=require(_0x46bc('0x2'));var fs=require('fs');var Redis=require(_0x46bc('0x3'));var db=require(_0x46bc('0x4'))['db'];var utils=require(_0x46bc('0x5'));var logger=require(_0x46bc('0x6'))('rpc');var config=require(_0x46bc('0x7'));var jayson=require(_0x46bc('0x8'));var client=jayson['client'][_0x46bc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19be50,_0x17710b,_0x75614){return new BPromise(function(_0x3c89e9,_0x3842b3){return client['request'](_0x19be50,_0x75614)[_0x46bc('0xa')](function(_0x28b7e1){logger['info'](_0x46bc('0xb'),_0x17710b,'request\x20sent');logger[_0x46bc('0xc')](_0x46bc('0xd'),_0x17710b,'request\x20sent',JSON[_0x46bc('0xe')](_0x28b7e1));if(_0x28b7e1[_0x46bc('0xf')]){if(_0x28b7e1['error'][_0x46bc('0x10')]===0x1f4){logger['error'](_0x46bc('0xb'),_0x17710b,_0x28b7e1[_0x46bc('0xf')][_0x46bc('0x11')]);return _0x3842b3(_0x28b7e1['error'][_0x46bc('0x11')]);}logger[_0x46bc('0xf')](_0x46bc('0xb'),_0x17710b,_0x28b7e1[_0x46bc('0xf')]['message']);return _0x3c89e9(_0x28b7e1[_0x46bc('0xf')][_0x46bc('0x11')]);}else{logger[_0x46bc('0x12')]('Template,\x20%s,\x20%s',_0x17710b,_0x46bc('0x13'));_0x3c89e9(_0x28b7e1['result'][_0x46bc('0x11')]);}})[_0x46bc('0x14')](function(_0x4c6de8){logger[_0x46bc('0xf')](_0x46bc('0xb'),_0x17710b,_0x4c6de8);_0x3842b3(_0x4c6de8);});});}exports[_0x46bc('0x15')]=function(_0x1da0ce){var _0x3311da=this;return new Promise(function(_0x4e931f,_0x2bb907){return db[_0x46bc('0x16')][_0x46bc('0x17')]({'raw':_0x1da0ce[_0x46bc('0x18')]?_0x1da0ce['options'][_0x46bc('0x19')]===undefined?!![]:![]:!![],'where':_0x1da0ce[_0x46bc('0x18')]?_0x1da0ce[_0x46bc('0x18')][_0x46bc('0x1a')]||null:null,'attributes':_0x1da0ce['options']?_0x1da0ce[_0x46bc('0x18')][_0x46bc('0x1b')]||null:null,'limit':_0x1da0ce[_0x46bc('0x18')]?_0x1da0ce[_0x46bc('0x18')]['limit']||null:null,'include':_0x1da0ce[_0x46bc('0x18')]?_0x1da0ce[_0x46bc('0x18')][_0x46bc('0x1c')]?_[_0x46bc('0x1d')](_0x1da0ce['options'][_0x46bc('0x1c')],function(_0x4ba53b){return{'model':db[_0x4ba53b[_0x46bc('0x1e')]],'as':_0x4ba53b['as'],'attributes':_0x4ba53b[_0x46bc('0x1b')],'include':_0x4ba53b['include']?_[_0x46bc('0x1d')](_0x4ba53b[_0x46bc('0x1c')],function(_0x1fe9b5){return{'model':db[_0x1fe9b5[_0x46bc('0x1e')]],'as':_0x1fe9b5['as'],'attributes':_0x1fe9b5[_0x46bc('0x1b')],'include':_0x1fe9b5[_0x46bc('0x1c')]?_[_0x46bc('0x1d')](_0x1fe9b5[_0x46bc('0x1c')],function(_0x47a63b){return{'model':db[_0x47a63b[_0x46bc('0x1e')]],'as':_0x47a63b['as'],'attributes':_0x47a63b[_0x46bc('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x46bc('0xa')](function(_0x4550a9){logger[_0x46bc('0x12')](_0x46bc('0x15'),_0x1da0ce);logger[_0x46bc('0xc')]('GetTemplate',_0x1da0ce,JSON['stringify'](_0x4550a9));_0x4e931f(_0x4550a9);})[_0x46bc('0x14')](function(_0x2a7ea5){logger[_0x46bc('0xf')]('GetTemplate',_0x2a7ea5['message'],_0x1da0ce);_0x2bb907(_0x3311da[_0x46bc('0xf')](0x1f4,_0x2a7ea5['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 46ee81f..5695c4f 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 _0x98e5=['addAllCondition','addAnyCondition','put','update','delete','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/:id','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','getActions','post','create'];(function(_0x284240,_0x555b56){var _0x390667=function(_0x409454){while(--_0x409454){_0x284240['push'](_0x284240['shift']());}};_0x390667(++_0x555b56);}(_0x98e5,0x1d4));var _0x598e=function(_0x4bd043,_0x4cea53){_0x4bd043=_0x4bd043-0x0;var _0x1e6cf9=_0x98e5[_0x4bd043];return _0x1e6cf9;};'use strict';var multer=require(_0x598e('0x0'));var util=require(_0x598e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x598e('0x2')]();var fs_extra=require(_0x598e('0x3'));var auth=require(_0x598e('0x4'));var interaction=require(_0x598e('0x5'));var config=require('../../config/environment');var controller=require('./trigger.controller');router['get']('/',auth[_0x598e('0x6')](),controller['index']);router[_0x598e('0x7')](_0x598e('0x8'),auth[_0x598e('0x6')](),controller['show']);router[_0x598e('0x7')](_0x598e('0x9'),auth['isAuthenticated'](),controller[_0x598e('0xa')]);router[_0x598e('0x7')](_0x598e('0xb'),auth[_0x598e('0x6')](),controller[_0x598e('0xc')]);router['get']('/:id/actions',auth[_0x598e('0x6')](),controller[_0x598e('0xd')]);router[_0x598e('0xe')]('/',auth[_0x598e('0x6')](),controller[_0x598e('0xf')]);router[_0x598e('0xe')](_0x598e('0x9'),auth['isAuthenticated'](),controller[_0x598e('0x10')]);router['post'](_0x598e('0xb'),auth[_0x598e('0x6')](),controller[_0x598e('0x11')]);router['post']('/:id/actions',auth[_0x598e('0x6')](),controller['addAction']);router[_0x598e('0x12')](_0x598e('0x8'),auth[_0x598e('0x6')](),controller[_0x598e('0x13')]);router[_0x598e('0x14')](_0x598e('0x8'),auth[_0x598e('0x6')](),controller['destroy']);module[_0x598e('0x15')]=router; \ No newline at end of file +var _0xa209=['addAnyCondition','/:id/actions','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id/all_conditions','getAllConditions','/:id/any_conditions','getActions','create','post','addAllCondition'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xa209,0xb6));var _0x9a20=function(_0x15a25a,_0x19c429){_0x15a25a=_0x15a25a-0x0;var _0x1d25f8=_0xa209[_0x15a25a];return _0x1d25f8;};'use strict';var multer=require(_0x9a20('0x0'));var util=require(_0x9a20('0x1'));var path=require(_0x9a20('0x2'));var timeout=require(_0x9a20('0x3'));var express=require('express');var router=express[_0x9a20('0x4')]();var fs_extra=require(_0x9a20('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9a20('0x6'));var controller=require(_0x9a20('0x7'));router[_0x9a20('0x8')]('/',auth[_0x9a20('0x9')](),controller[_0x9a20('0xa')]);router['get']('/:id',auth[_0x9a20('0x9')](),controller['show']);router[_0x9a20('0x8')](_0x9a20('0xb'),auth[_0x9a20('0x9')](),controller[_0x9a20('0xc')]);router[_0x9a20('0x8')](_0x9a20('0xd'),auth['isAuthenticated'](),controller['getAnyConditions']);router['get']('/:id/actions',auth[_0x9a20('0x9')](),controller[_0x9a20('0xe')]);router['post']('/',auth[_0x9a20('0x9')](),controller[_0x9a20('0xf')]);router[_0x9a20('0x10')](_0x9a20('0xb'),auth[_0x9a20('0x9')](),controller[_0x9a20('0x11')]);router[_0x9a20('0x10')]('/:id/any_conditions',auth[_0x9a20('0x9')](),controller[_0x9a20('0x12')]);router['post'](_0x9a20('0x13'),auth[_0x9a20('0x9')](),controller['addAction']);router[_0x9a20('0x14')](_0x9a20('0x15'),auth[_0x9a20('0x9')](),controller[_0x9a20('0x16')]);router['delete']('/:id',auth[_0x9a20('0x9')](),controller[_0x9a20('0x17')]);module[_0x9a20('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 56b4249..ea74c34 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 _0xedf5=['exports','STRING','sequelize'];(function(_0x25a441,_0x5a388b){var _0x3b0286=function(_0x3e6251){while(--_0x3e6251){_0x25a441['push'](_0x25a441['shift']());}};_0x3b0286(++_0x5a388b);}(_0xedf5,0xa7));var _0x5edf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xedf5[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5edf('0x0'));module[_0x5edf('0x1')]={'name':{'type':Sequelize[_0x5edf('0x2')]},'channel':{'type':Sequelize[_0x5edf('0x2')]},'description':{'type':Sequelize[_0x5edf('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xd098=['STRING','BOOLEAN'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd098,0xb8));var _0x8d09=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd098[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8d09('0x0')]},'channel':{'type':Sequelize[_0x8d09('0x0')]},'description':{'type':Sequelize[_0x8d09('0x0')]},'status':{'type':Sequelize[_0x8d09('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 2800b28..fef052b 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 _0x5ecd=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','TriggerAllId','Condition','addAnyCondition','getAllConditions','findOne','filter','options','nolimit','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','offset','undefined','limit','count','json','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','send','index','map','rawAttributes','fieldName','type','key','name','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','pick','where','VIRTUAL','merge','Trigger','includeAll','include','rows','show','params','find','create','body','role','user','Triggers','userProfileId'];(function(_0x3b79b4,_0x50a8e8){var _0x1cb006=function(_0x582425){while(--_0x582425){_0x3b79b4['push'](_0x3b79b4['shift']());}};_0x1cb006(++_0x50a8e8);}(_0x5ecd,0x6b));var _0xd5ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5ecd[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xd5ec('0x0'));var rimraf=require(_0xd5ec('0x1'));var zipdir=require(_0xd5ec('0x2'));var jsonpatch=require(_0xd5ec('0x3'));var rp=require(_0xd5ec('0x4'));var moment=require(_0xd5ec('0x5'));var BPromise=require(_0xd5ec('0x6'));var Mustache=require(_0xd5ec('0x7'));var util=require(_0xd5ec('0x8'));var path=require(_0xd5ec('0x9'));var sox=require('sox');var csv=require(_0xd5ec('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd5ec('0xb'));var _=require(_0xd5ec('0xc'));var squel=require(_0xd5ec('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd5ec('0xe'));var toCsv=require(_0xd5ec('0xa'));var querystring=require(_0xd5ec('0xf'));var Papa=require('papaparse');var Redis=require(_0xd5ec('0x10'));var authService=require(_0xd5ec('0x11'));var qs=require(_0xd5ec('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd5ec('0x13'));var logger=require('../../config/logger')(_0xd5ec('0x14'));var utils=require(_0xd5ec('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd5ec('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c9a0e,_0x9ce7d8){_0x9ce7d8=_0x9ce7d8||0xcc;return function(_0x2a3dd4){if(_0x2a3dd4){return _0x2c9a0e[_0xd5ec('0x17')](_0x9ce7d8);}return _0x2c9a0e[_0xd5ec('0x18')](_0x9ce7d8)['end']();};}function respondWithResult(_0x3cbbcc,_0x1f9932){_0x1f9932=_0x1f9932||0xc8;return function(_0x30ef05){if(_0x30ef05){return _0x3cbbcc[_0xd5ec('0x18')](_0x1f9932)['json'](_0x30ef05);}};}function respondWithFilteredResult(_0x49f786,_0x1babfc){return function(_0xd00b6){if(_0xd00b6){var _0x4eee04=typeof _0x1babfc[_0xd5ec('0x19')]===_0xd5ec('0x1a')&&typeof _0x1babfc[_0xd5ec('0x1b')]==='undefined';var _0x121a5f=_0xd00b6['count'];var _0x4975eb=_0x4eee04?0x0:_0x1babfc['offset'];var _0x4463e4=_0x4eee04?_0xd00b6[_0xd5ec('0x1c')]:_0x1babfc[_0xd5ec('0x19')]+_0x1babfc['limit'];var _0x3f4151;if(_0x4463e4>=_0x121a5f){_0x4463e4=_0x121a5f;_0x3f4151=0xc8;}else{_0x3f4151=0xce;}_0x49f786[_0xd5ec('0x18')](_0x3f4151);return _0x49f786['set']('Content-Range',_0x4975eb+'-'+_0x4463e4+'/'+_0x121a5f)[_0xd5ec('0x1d')](_0xd00b6);}return null;};}function patchUpdates(_0x237c43){return function(_0x5c5ad5){try{jsonpatch[_0xd5ec('0x1e')](_0x5c5ad5,_0x237c43,!![]);}catch(_0xc28ca1){return BPromise[_0xd5ec('0x1f')](_0xc28ca1);}return _0x5c5ad5[_0xd5ec('0x20')]();};}function saveUpdates(_0x3c1aae,_0x28d192){return function(_0x57e72e){if(_0x57e72e){return _0x57e72e[_0xd5ec('0x21')](_0x3c1aae)[_0xd5ec('0x22')](function(_0x23bcc4){return _0x23bcc4;});}return null;};}function removeEntity(_0x49d109,_0x448ced){return function(_0x178cfc){if(_0x178cfc){return _0x178cfc[_0xd5ec('0x23')]()[_0xd5ec('0x22')](function(){var _0x406360=_0x178cfc[_0xd5ec('0x24')]({'plain':!![]});var _0x4b8350='Triggers';return db[_0xd5ec('0x25')][_0xd5ec('0x23')]({'where':{'type':_0x4b8350,'resourceId':_0x406360['id']}})[_0xd5ec('0x22')](function(){return _0x178cfc;});})['then'](function(){_0x49d109[_0xd5ec('0x18')](0xcc)[_0xd5ec('0x26')]();});}};}function handleEntityNotFound(_0x2b3e26,_0x347607){return function(_0x1e52dd){if(!_0x1e52dd){_0x2b3e26['sendStatus'](0x194);}return _0x1e52dd;};}function handleError(_0x474a04,_0x28124d){_0x28124d=_0x28124d||0x1f4;return function(_0x1d5b2c){logger[_0xd5ec('0x27')](_0x1d5b2c[_0xd5ec('0x28')]);if(_0x1d5b2c['name']){delete _0x1d5b2c['name'];}_0x474a04[_0xd5ec('0x18')](_0x28124d)[_0xd5ec('0x29')](_0x1d5b2c);};}exports[_0xd5ec('0x2a')]=function(_0x54384e,_0x3b0c14){var _0x44cf08={},_0x2f6cd5={},_0x49ac60={'count':0x0,'rows':[]};var _0x543c25=_[_0xd5ec('0x2b')](db['Trigger'][_0xd5ec('0x2c')],function(_0x418d3f){return{'name':_0x418d3f[_0xd5ec('0x2d')],'type':_0x418d3f[_0xd5ec('0x2e')][_0xd5ec('0x2f')]};});_0x2f6cd5['model']=_[_0xd5ec('0x2b')](_0x543c25,_0xd5ec('0x30'));_0x2f6cd5['query']=_[_0xd5ec('0x31')](_0x54384e[_0xd5ec('0x32')]);_0x2f6cd5[_0xd5ec('0x33')]=_[_0xd5ec('0x34')](_0x2f6cd5['model'],_0x2f6cd5[_0xd5ec('0x32')]);_0x44cf08[_0xd5ec('0x35')]=_[_0xd5ec('0x34')](_0x2f6cd5[_0xd5ec('0x36')],qs[_0xd5ec('0x37')](_0x54384e[_0xd5ec('0x32')]['fields']));_0x44cf08[_0xd5ec('0x35')]=_0x44cf08[_0xd5ec('0x35')][_0xd5ec('0x38')]?_0x44cf08['attributes']:_0x2f6cd5[_0xd5ec('0x36')];if(!_0x54384e['query'][_0xd5ec('0x39')]('nolimit')){_0x44cf08[_0xd5ec('0x1b')]=qs[_0xd5ec('0x1b')](_0x54384e[_0xd5ec('0x32')][_0xd5ec('0x1b')]);_0x44cf08[_0xd5ec('0x19')]=qs['offset'](_0x54384e['query']['offset']);}_0x44cf08[_0xd5ec('0x3a')]=qs[_0xd5ec('0x3b')](_0x54384e[_0xd5ec('0x32')]['sort']);_0x44cf08['where']=qs[_0xd5ec('0x33')](_[_0xd5ec('0x3c')](_0x54384e[_0xd5ec('0x32')],_0x2f6cd5[_0xd5ec('0x33')]),_0x543c25);if(_0x54384e[_0xd5ec('0x32')]['filter']){_0x44cf08[_0xd5ec('0x3d')]=_['merge'](_0x44cf08['where'],{'$or':_[_0xd5ec('0x2b')](_0x543c25,function(_0x207a72){if(_0x207a72[_0xd5ec('0x2e')]!==_0xd5ec('0x3e')){var _0x5acd03={};_0x5acd03[_0x207a72[_0xd5ec('0x30')]]={'$like':'%'+_0x54384e['query']['filter']+'%'};return _0x5acd03;}})});}_0x44cf08=_[_0xd5ec('0x3f')]({},_0x44cf08,_0x54384e['options']);var _0x26cbe7={'where':_0x44cf08[_0xd5ec('0x3d')]};return db[_0xd5ec('0x40')][_0xd5ec('0x1c')](_0x26cbe7)[_0xd5ec('0x22')](function(_0x351aed){_0x49ac60[_0xd5ec('0x1c')]=_0x351aed;if(_0x54384e[_0xd5ec('0x32')][_0xd5ec('0x41')]){_0x44cf08[_0xd5ec('0x42')]=[{'all':!![]}];}return db[_0xd5ec('0x40')]['findAll'](_0x44cf08);})[_0xd5ec('0x22')](function(_0x185aac){_0x49ac60[_0xd5ec('0x43')]=_0x185aac;return _0x49ac60;})['then'](respondWithFilteredResult(_0x3b0c14,_0x44cf08))['catch'](handleError(_0x3b0c14,null));};exports[_0xd5ec('0x44')]=function(_0x157338,_0x3d37d2){var _0x5a75db={'raw':![],'where':{'id':_0x157338[_0xd5ec('0x45')]['id']}},_0x25138d={};_0x25138d[_0xd5ec('0x36')]=_[_0xd5ec('0x31')](db[_0xd5ec('0x40')][_0xd5ec('0x2c')]);_0x25138d[_0xd5ec('0x32')]=_['keys'](_0x157338[_0xd5ec('0x32')]);_0x25138d[_0xd5ec('0x33')]=_[_0xd5ec('0x34')](_0x25138d[_0xd5ec('0x36')],_0x25138d[_0xd5ec('0x32')]);_0x5a75db[_0xd5ec('0x35')]=_['intersection'](_0x25138d['model'],qs[_0xd5ec('0x37')](_0x157338[_0xd5ec('0x32')]['fields']));_0x5a75db[_0xd5ec('0x35')]=_0x5a75db['attributes'][_0xd5ec('0x38')]?_0x5a75db['attributes']:_0x25138d[_0xd5ec('0x36')];if(_0x157338[_0xd5ec('0x32')][_0xd5ec('0x41')]){_0x5a75db[_0xd5ec('0x42')]=[{'all':!![]}];}_0x5a75db=_[_0xd5ec('0x3f')]({},_0x5a75db,_0x157338['options']);return db[_0xd5ec('0x40')][_0xd5ec('0x46')](_0x5a75db)[_0xd5ec('0x22')](handleEntityNotFound(_0x3d37d2,null))[_0xd5ec('0x22')](respondWithResult(_0x3d37d2,null))['catch'](handleError(_0x3d37d2,null));};exports[_0xd5ec('0x47')]=function(_0x165480,_0x4f1b4a){return db[_0xd5ec('0x40')]['create'](_0x165480[_0xd5ec('0x48')],{})[_0xd5ec('0x22')](function(_0xe52981){var _0x214543=_0x165480['user']['get']({'plain':!![]});if(!_0x214543)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x214543[_0xd5ec('0x49')]===_0xd5ec('0x4a')){var _0x144b87=_0xe52981[_0xd5ec('0x24')]({'plain':!![]});var _0x38d9c6=_0xd5ec('0x4b');return db['UserProfileSection']['find']({'where':{'name':_0x38d9c6,'userProfileId':_0x214543[_0xd5ec('0x4c')]},'raw':!![]})[_0xd5ec('0x22')](function(_0x4fb101){if(_0x4fb101&&_0x4fb101['autoAssociation']===0x0){return db['UserProfileResource'][_0xd5ec('0x47')]({'name':_0x144b87[_0xd5ec('0x30')],'resourceId':_0x144b87['id'],'type':_0x4fb101['name'],'sectionId':_0x4fb101['id']},{})[_0xd5ec('0x22')](function(){return _0xe52981;});}else{return _0xe52981;}})['catch'](function(_0x55b260){logger[_0xd5ec('0x27')](_0xd5ec('0x4d'),_0x55b260);throw _0x55b260;});}return _0xe52981;})[_0xd5ec('0x22')](respondWithResult(_0x4f1b4a,0xc9))['catch'](handleError(_0x4f1b4a,null));};exports[_0xd5ec('0x21')]=function(_0x25961a,_0x1c1a3c){if(_0x25961a[_0xd5ec('0x48')]['id']){delete _0x25961a[_0xd5ec('0x48')]['id'];}return db[_0xd5ec('0x40')][_0xd5ec('0x46')]({'where':{'id':_0x25961a[_0xd5ec('0x45')]['id']}})[_0xd5ec('0x22')](handleEntityNotFound(_0x1c1a3c,null))[_0xd5ec('0x22')](saveUpdates(_0x25961a[_0xd5ec('0x48')],null))[_0xd5ec('0x22')](respondWithResult(_0x1c1a3c,null))[_0xd5ec('0x4e')](handleError(_0x1c1a3c,null));};exports[_0xd5ec('0x23')]=function(_0x206414,_0x4ac3b6){return db[_0xd5ec('0x40')][_0xd5ec('0x46')]({'where':{'id':_0x206414['params']['id']}})['then'](handleEntityNotFound(_0x4ac3b6,null))[_0xd5ec('0x22')](removeEntity(_0x4ac3b6,null))['catch'](handleError(_0x4ac3b6,null));};exports['addAllCondition']=function(_0x4e91e2,_0x6239e2,_0x2d5c43){if(_0x4e91e2['body']['id']){delete _0x4e91e2[_0xd5ec('0x48')]['id'];}return db['Trigger']['find']({'where':{'id':_0x4e91e2[_0xd5ec('0x45')]['id']}})[_0xd5ec('0x22')](handleEntityNotFound(_0x6239e2,null))['then'](function(_0x3c8bb2){if(_0x3c8bb2){_0x4e91e2[_0xd5ec('0x48')][_0xd5ec('0x4f')]=_0x3c8bb2['id'];return db[_0xd5ec('0x50')]['create'](_0x4e91e2[_0xd5ec('0x48')]);}})[_0xd5ec('0x22')](respondWithResult(_0x6239e2,null))[_0xd5ec('0x4e')](handleError(_0x6239e2,null));};exports[_0xd5ec('0x51')]=function(_0x33c237,_0x2d871c,_0x202c33){if(_0x33c237[_0xd5ec('0x48')]['id']){delete _0x33c237[_0xd5ec('0x48')]['id'];}return db[_0xd5ec('0x40')][_0xd5ec('0x46')]({'where':{'id':_0x33c237['params']['id']}})[_0xd5ec('0x22')](handleEntityNotFound(_0x2d871c,null))[_0xd5ec('0x22')](function(_0x2049c7){if(_0x2049c7){_0x33c237[_0xd5ec('0x48')]['TriggerAnyId']=_0x2049c7['id'];return db[_0xd5ec('0x50')][_0xd5ec('0x47')](_0x33c237[_0xd5ec('0x48')]);}})[_0xd5ec('0x22')](respondWithResult(_0x2d871c,null))[_0xd5ec('0x4e')](handleError(_0x2d871c,null));};exports[_0xd5ec('0x52')]=function(_0x556c72,_0x16537a,_0x2f7bdd){var _0x64421f={};var _0x50701c={};var _0x53dd3e;var _0x23870e;return db[_0xd5ec('0x40')][_0xd5ec('0x53')]({'where':{'id':_0x556c72[_0xd5ec('0x45')]['id']}})[_0xd5ec('0x22')](handleEntityNotFound(_0x16537a,null))[_0xd5ec('0x22')](function(_0x3b6cd4){if(_0x3b6cd4){_0x53dd3e=_0x3b6cd4;_0x50701c[_0xd5ec('0x36')]=_[_0xd5ec('0x31')](db['Condition'][_0xd5ec('0x2c')]);_0x50701c['query']=_['keys'](_0x556c72['query']);_0x50701c[_0xd5ec('0x33')]=_[_0xd5ec('0x34')](_0x50701c[_0xd5ec('0x36')],_0x50701c[_0xd5ec('0x32')]);_0x64421f['attributes']=_[_0xd5ec('0x34')](_0x50701c[_0xd5ec('0x36')],qs['fields'](_0x556c72[_0xd5ec('0x32')][_0xd5ec('0x37')]));_0x64421f[_0xd5ec('0x35')]=_0x64421f[_0xd5ec('0x35')][_0xd5ec('0x38')]?_0x64421f[_0xd5ec('0x35')]:_0x50701c[_0xd5ec('0x36')];_0x64421f[_0xd5ec('0x3a')]=qs[_0xd5ec('0x3b')](_0x556c72[_0xd5ec('0x32')][_0xd5ec('0x3b')]);_0x64421f[_0xd5ec('0x3d')]=qs[_0xd5ec('0x33')](_[_0xd5ec('0x3c')](_0x556c72[_0xd5ec('0x32')],_0x50701c[_0xd5ec('0x33')]));if(_0x556c72[_0xd5ec('0x32')][_0xd5ec('0x54')]){_0x64421f['where']=_['merge'](_0x64421f['where'],{'$or':_['map'](_0x64421f[_0xd5ec('0x35')],function(_0x425ed0){var _0x3b01cc={};_0x3b01cc[_0x425ed0]={'$like':'%'+_0x556c72[_0xd5ec('0x32')][_0xd5ec('0x54')]+'%'};return _0x3b01cc;})});}_0x64421f=_[_0xd5ec('0x3f')]({},_0x64421f,_0x556c72[_0xd5ec('0x55')]);return _0x53dd3e[_0xd5ec('0x52')](_0x64421f);}})[_0xd5ec('0x22')](function(_0x16e287){if(_0x16e287){_0x23870e=_0x16e287[_0xd5ec('0x38')];if(!_0x556c72[_0xd5ec('0x32')][_0xd5ec('0x39')](_0xd5ec('0x56'))){_0x64421f[_0xd5ec('0x1b')]=qs['limit'](_0x556c72[_0xd5ec('0x32')][_0xd5ec('0x1b')]);_0x64421f['offset']=qs['offset'](_0x556c72[_0xd5ec('0x32')][_0xd5ec('0x19')]);}return _0x53dd3e[_0xd5ec('0x52')](_0x64421f);}})['then'](function(_0x106323){if(_0x106323){return _0x106323?{'count':_0x23870e,'rows':_0x106323}:null;}})[_0xd5ec('0x22')](respondWithResult(_0x16537a,null))[_0xd5ec('0x4e')](handleError(_0x16537a,null));};exports[_0xd5ec('0x57')]=function(_0x504dbd,_0x111e63,_0x4b0119){var _0x1e565e={};var _0x305542={};var _0x169eae;var _0x209cdb;return db[_0xd5ec('0x40')][_0xd5ec('0x53')]({'where':{'id':_0x504dbd[_0xd5ec('0x45')]['id']}})['then'](handleEntityNotFound(_0x111e63,null))[_0xd5ec('0x22')](function(_0x167dfe){if(_0x167dfe){_0x169eae=_0x167dfe;_0x305542[_0xd5ec('0x36')]=_[_0xd5ec('0x31')](db[_0xd5ec('0x50')][_0xd5ec('0x2c')]);_0x305542[_0xd5ec('0x32')]=_[_0xd5ec('0x31')](_0x504dbd['query']);_0x305542[_0xd5ec('0x33')]=_[_0xd5ec('0x34')](_0x305542[_0xd5ec('0x36')],_0x305542['query']);_0x1e565e['attributes']=_[_0xd5ec('0x34')](_0x305542[_0xd5ec('0x36')],qs[_0xd5ec('0x37')](_0x504dbd[_0xd5ec('0x32')]['fields']));_0x1e565e[_0xd5ec('0x35')]=_0x1e565e[_0xd5ec('0x35')][_0xd5ec('0x38')]?_0x1e565e[_0xd5ec('0x35')]:_0x305542[_0xd5ec('0x36')];_0x1e565e[_0xd5ec('0x3a')]=qs[_0xd5ec('0x3b')](_0x504dbd['query'][_0xd5ec('0x3b')]);_0x1e565e[_0xd5ec('0x3d')]=qs[_0xd5ec('0x33')](_[_0xd5ec('0x3c')](_0x504dbd[_0xd5ec('0x32')],_0x305542[_0xd5ec('0x33')]));if(_0x504dbd[_0xd5ec('0x32')][_0xd5ec('0x54')]){_0x1e565e[_0xd5ec('0x3d')]=_[_0xd5ec('0x3f')](_0x1e565e[_0xd5ec('0x3d')],{'$or':_[_0xd5ec('0x2b')](_0x1e565e[_0xd5ec('0x35')],function(_0x6c22ba){var _0xac076c={};_0xac076c[_0x6c22ba]={'$like':'%'+_0x504dbd[_0xd5ec('0x32')][_0xd5ec('0x54')]+'%'};return _0xac076c;})});}_0x1e565e=_[_0xd5ec('0x3f')]({},_0x1e565e,_0x504dbd[_0xd5ec('0x55')]);return _0x169eae[_0xd5ec('0x57')](_0x1e565e);}})[_0xd5ec('0x22')](function(_0x4d1672){if(_0x4d1672){_0x209cdb=_0x4d1672['length'];if(!_0x504dbd[_0xd5ec('0x32')]['hasOwnProperty']('nolimit')){_0x1e565e['limit']=qs[_0xd5ec('0x1b')](_0x504dbd[_0xd5ec('0x32')][_0xd5ec('0x1b')]);_0x1e565e[_0xd5ec('0x19')]=qs[_0xd5ec('0x19')](_0x504dbd[_0xd5ec('0x32')][_0xd5ec('0x19')]);}return _0x169eae['getAnyConditions'](_0x1e565e);}})['then'](function(_0xe4dea){if(_0xe4dea){return _0xe4dea?{'count':_0x209cdb,'rows':_0xe4dea}:null;}})[_0xd5ec('0x22')](respondWithResult(_0x111e63,null))[_0xd5ec('0x4e')](handleError(_0x111e63,null));};exports[_0xd5ec('0x58')]=function(_0x215d91,_0x2a3854,_0x1c3831){if(_0x215d91[_0xd5ec('0x48')]['id']){delete _0x215d91[_0xd5ec('0x48')]['id'];}return db[_0xd5ec('0x40')][_0xd5ec('0x46')]({'where':{'id':_0x215d91[_0xd5ec('0x45')]['id']}})[_0xd5ec('0x22')](handleEntityNotFound(_0x2a3854,null))[_0xd5ec('0x22')](function(_0x3f7600){if(_0x3f7600){_0x215d91['body'][_0xd5ec('0x59')]=_0x3f7600['id'];return db[_0xd5ec('0x5a')][_0xd5ec('0x47')](_0x215d91[_0xd5ec('0x48')]);}})[_0xd5ec('0x22')](respondWithResult(_0x2a3854,null))[_0xd5ec('0x4e')](handleError(_0x2a3854,null));};exports['getActions']=function(_0x14bbb4,_0x39f873,_0x2d47ca){var _0x203096={};var _0x1008ec={};var _0x5406e4;var _0x42cd57;return db['Trigger'][_0xd5ec('0x53')]({'where':{'id':_0x14bbb4[_0xd5ec('0x45')]['id']}})[_0xd5ec('0x22')](handleEntityNotFound(_0x39f873,null))['then'](function(_0x3d5425){if(_0x3d5425){_0x5406e4=_0x3d5425;_0x1008ec[_0xd5ec('0x36')]=_['keys'](db[_0xd5ec('0x5a')][_0xd5ec('0x2c')]);_0x1008ec[_0xd5ec('0x32')]=_[_0xd5ec('0x31')](_0x14bbb4['query']);_0x1008ec['filters']=_[_0xd5ec('0x34')](_0x1008ec[_0xd5ec('0x36')],_0x1008ec[_0xd5ec('0x32')]);_0x203096[_0xd5ec('0x35')]=_[_0xd5ec('0x34')](_0x1008ec['model'],qs[_0xd5ec('0x37')](_0x14bbb4[_0xd5ec('0x32')][_0xd5ec('0x37')]));_0x203096[_0xd5ec('0x35')]=_0x203096[_0xd5ec('0x35')][_0xd5ec('0x38')]?_0x203096[_0xd5ec('0x35')]:_0x1008ec['model'];_0x203096['order']=qs['sort'](_0x14bbb4[_0xd5ec('0x32')]['sort']);_0x203096[_0xd5ec('0x3d')]=qs['filters'](_[_0xd5ec('0x3c')](_0x14bbb4[_0xd5ec('0x32')],_0x1008ec[_0xd5ec('0x33')]));if(_0x14bbb4[_0xd5ec('0x32')][_0xd5ec('0x54')]){_0x203096[_0xd5ec('0x3d')]=_['merge'](_0x203096[_0xd5ec('0x3d')],{'$or':_[_0xd5ec('0x2b')](_0x203096['attributes'],function(_0x222424){var _0x5b783c={};_0x5b783c[_0x222424]={'$like':'%'+_0x14bbb4[_0xd5ec('0x32')][_0xd5ec('0x54')]+'%'};return _0x5b783c;})});}_0x203096=_['merge']({},_0x203096,_0x14bbb4[_0xd5ec('0x55')]);return _0x5406e4[_0xd5ec('0x5b')](_0x203096);}})[_0xd5ec('0x22')](function(_0x1d75d2){if(_0x1d75d2){_0x42cd57=_0x1d75d2[_0xd5ec('0x38')];if(!_0x14bbb4[_0xd5ec('0x32')][_0xd5ec('0x39')]('nolimit')){_0x203096['limit']=qs['limit'](_0x14bbb4[_0xd5ec('0x32')][_0xd5ec('0x1b')]);_0x203096[_0xd5ec('0x19')]=qs[_0xd5ec('0x19')](_0x14bbb4[_0xd5ec('0x32')][_0xd5ec('0x19')]);}return _0x5406e4['getActions'](_0x203096);}})['then'](function(_0x1b74ff){if(_0x1b74ff){return _0x1b74ff?{'count':_0x42cd57,'rows':_0x1b74ff}:null;}})[_0xd5ec('0x22')](respondWithResult(_0x39f873,null))[_0xd5ec('0x4e')](handleError(_0x39f873,null));}; \ No newline at end of file +var _0x53d6=['json','apply','update','then','get','Triggers','UserProfileResource','error','name','send','Trigger','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','length','merge','catch','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','autoAssociation','destroy','create','addAnyCondition','params','getAllConditions','findOne','Condition','getAnyConditions','addAction','TriggerId','Action','getActions','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range'];(function(_0x3e7171,_0x86fb1e){var _0x2425b7=function(_0xcd6c71){while(--_0xcd6c71){_0x3e7171['push'](_0x3e7171['shift']());}};_0x2425b7(++_0x86fb1e);}(_0x53d6,0x1ae));var _0x653d=function(_0x5de818,_0x7c4485){_0x5de818=_0x5de818-0x0;var _0x345670=_0x53d6[_0x5de818];return _0x345670;};'use strict';var emlformat=require(_0x653d('0x0'));var rimraf=require(_0x653d('0x1'));var zipdir=require(_0x653d('0x2'));var jsonpatch=require(_0x653d('0x3'));var rp=require(_0x653d('0x4'));var moment=require(_0x653d('0x5'));var BPromise=require(_0x653d('0x6'));var Mustache=require(_0x653d('0x7'));var util=require(_0x653d('0x8'));var path=require(_0x653d('0x9'));var sox=require(_0x653d('0xa'));var csv=require(_0x653d('0xb'));var ejs=require(_0x653d('0xc'));var fs=require('fs');var fs_extra=require(_0x653d('0xd'));var _=require(_0x653d('0xe'));var squel=require(_0x653d('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x653d('0xb'));var querystring=require(_0x653d('0x10'));var Papa=require(_0x653d('0x11'));var Redis=require(_0x653d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x653d('0x13'));var as=require(_0x653d('0x14'));var hardwareService=require(_0x653d('0x15'));var logger=require('../../config/logger')(_0x653d('0x16'));var utils=require(_0x653d('0x17'));var config=require(_0x653d('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x653d('0x19'))['db'];function respondWithStatusCode(_0x372ad4,_0x3c4af0){_0x3c4af0=_0x3c4af0||0xcc;return function(_0x167301){if(_0x167301){return _0x372ad4[_0x653d('0x1a')](_0x3c4af0);}return _0x372ad4[_0x653d('0x1b')](_0x3c4af0)[_0x653d('0x1c')]();};}function respondWithResult(_0x1495d7,_0x1653c2){_0x1653c2=_0x1653c2||0xc8;return function(_0x28bd87){if(_0x28bd87){return _0x1495d7[_0x653d('0x1b')](_0x1653c2)['json'](_0x28bd87);}};}function respondWithFilteredResult(_0x2ce81d,_0x5bbc2e){return function(_0x45874a){if(_0x45874a){var _0x39b8e6=typeof _0x5bbc2e[_0x653d('0x1d')]===_0x653d('0x1e')&&typeof _0x5bbc2e['limit']==='undefined';var _0x2707e1=_0x45874a[_0x653d('0x1f')];var _0x433464=_0x39b8e6?0x0:_0x5bbc2e[_0x653d('0x1d')];var _0x255ca6=_0x39b8e6?_0x45874a[_0x653d('0x1f')]:_0x5bbc2e['offset']+_0x5bbc2e[_0x653d('0x20')];var _0xe03bdf;if(_0x255ca6>=_0x2707e1){_0x255ca6=_0x2707e1;_0xe03bdf=0xc8;}else{_0xe03bdf=0xce;}_0x2ce81d[_0x653d('0x1b')](_0xe03bdf);return _0x2ce81d[_0x653d('0x21')](_0x653d('0x22'),_0x433464+'-'+_0x255ca6+'/'+_0x2707e1)[_0x653d('0x23')](_0x45874a);}return null;};}function patchUpdates(_0x33ec7f){return function(_0x28defe){try{jsonpatch[_0x653d('0x24')](_0x28defe,_0x33ec7f,!![]);}catch(_0x17dda6){return BPromise['reject'](_0x17dda6);}return _0x28defe['save']();};}function saveUpdates(_0x12aca3,_0x4452a9){return function(_0x14176f){if(_0x14176f){return _0x14176f[_0x653d('0x25')](_0x12aca3)[_0x653d('0x26')](function(_0x58f605){return _0x58f605;});}return null;};}function removeEntity(_0x27cf94,_0x4d1fd0){return function(_0x4a1a4f){if(_0x4a1a4f){return _0x4a1a4f['destroy']()[_0x653d('0x26')](function(){var _0x516941=_0x4a1a4f[_0x653d('0x27')]({'plain':!![]});var _0x141296=_0x653d('0x28');return db[_0x653d('0x29')]['destroy']({'where':{'type':_0x141296,'resourceId':_0x516941['id']}})[_0x653d('0x26')](function(){return _0x4a1a4f;});})['then'](function(){_0x27cf94[_0x653d('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2500aa,_0x2f8d70){return function(_0x1d6b20){if(!_0x1d6b20){_0x2500aa[_0x653d('0x1a')](0x194);}return _0x1d6b20;};}function handleError(_0x23d0fb,_0x5ed28a){_0x5ed28a=_0x5ed28a||0x1f4;return function(_0x54b834){logger[_0x653d('0x2a')](_0x54b834['stack']);if(_0x54b834[_0x653d('0x2b')]){delete _0x54b834[_0x653d('0x2b')];}_0x23d0fb[_0x653d('0x1b')](_0x5ed28a)[_0x653d('0x2c')](_0x54b834);};}exports['index']=function(_0x6c0d10,_0x599d12){var _0x50d361={},_0x1829f4={},_0x2cb8b8={'count':0x0,'rows':[]};var _0x5acad9=_['map'](db[_0x653d('0x2d')][_0x653d('0x2e')],function(_0x35a6f4){return{'name':_0x35a6f4[_0x653d('0x2f')],'type':_0x35a6f4[_0x653d('0x30')][_0x653d('0x31')]};});_0x1829f4[_0x653d('0x32')]=_[_0x653d('0x33')](_0x5acad9,'name');_0x1829f4[_0x653d('0x34')]=_[_0x653d('0x35')](_0x6c0d10[_0x653d('0x34')]);_0x1829f4[_0x653d('0x36')]=_[_0x653d('0x37')](_0x1829f4['model'],_0x1829f4[_0x653d('0x34')]);_0x50d361[_0x653d('0x38')]=_[_0x653d('0x37')](_0x1829f4[_0x653d('0x32')],qs[_0x653d('0x39')](_0x6c0d10[_0x653d('0x34')][_0x653d('0x39')]));_0x50d361[_0x653d('0x38')]=_0x50d361['attributes']['length']?_0x50d361[_0x653d('0x38')]:_0x1829f4['model'];if(!_0x6c0d10[_0x653d('0x34')]['hasOwnProperty'](_0x653d('0x3a'))){_0x50d361[_0x653d('0x20')]=qs[_0x653d('0x20')](_0x6c0d10['query'][_0x653d('0x20')]);_0x50d361['offset']=qs[_0x653d('0x1d')](_0x6c0d10[_0x653d('0x34')][_0x653d('0x1d')]);}_0x50d361[_0x653d('0x3b')]=qs[_0x653d('0x3c')](_0x6c0d10[_0x653d('0x34')][_0x653d('0x3c')]);_0x50d361[_0x653d('0x3d')]=qs[_0x653d('0x36')](_[_0x653d('0x3e')](_0x6c0d10['query'],_0x1829f4[_0x653d('0x36')]),_0x5acad9);if(_0x6c0d10['query']['filter']){_0x50d361[_0x653d('0x3d')]=_['merge'](_0x50d361['where'],{'$or':_[_0x653d('0x33')](_0x5acad9,function(_0x45f9e5){if(_0x45f9e5[_0x653d('0x30')]!==_0x653d('0x3f')){var _0x18c884={};_0x18c884[_0x45f9e5[_0x653d('0x2b')]]={'$like':'%'+_0x6c0d10['query'][_0x653d('0x40')]+'%'};return _0x18c884;}})});}_0x50d361=_['merge']({},_0x50d361,_0x6c0d10[_0x653d('0x41')]);var _0x1a7556={'where':_0x50d361[_0x653d('0x3d')]};return db['Trigger'][_0x653d('0x1f')](_0x1a7556)['then'](function(_0x1b913c){_0x2cb8b8[_0x653d('0x1f')]=_0x1b913c;if(_0x6c0d10[_0x653d('0x34')][_0x653d('0x42')]){_0x50d361[_0x653d('0x43')]=[{'all':!![]}];}return db[_0x653d('0x2d')][_0x653d('0x44')](_0x50d361);})[_0x653d('0x26')](function(_0x5f547a){_0x2cb8b8[_0x653d('0x45')]=_0x5f547a;return _0x2cb8b8;})['then'](respondWithFilteredResult(_0x599d12,_0x50d361))['catch'](handleError(_0x599d12,null));};exports[_0x653d('0x46')]=function(_0x2bbcf9,_0x2c62f7){var _0x2f18d7={'raw':![],'where':{'id':_0x2bbcf9['params']['id']}},_0x2d23b1={};_0x2d23b1[_0x653d('0x32')]=_[_0x653d('0x35')](db[_0x653d('0x2d')][_0x653d('0x2e')]);_0x2d23b1[_0x653d('0x34')]=_[_0x653d('0x35')](_0x2bbcf9[_0x653d('0x34')]);_0x2d23b1['filters']=_[_0x653d('0x37')](_0x2d23b1[_0x653d('0x32')],_0x2d23b1[_0x653d('0x34')]);_0x2f18d7[_0x653d('0x38')]=_[_0x653d('0x37')](_0x2d23b1[_0x653d('0x32')],qs[_0x653d('0x39')](_0x2bbcf9[_0x653d('0x34')][_0x653d('0x39')]));_0x2f18d7[_0x653d('0x38')]=_0x2f18d7[_0x653d('0x38')][_0x653d('0x47')]?_0x2f18d7[_0x653d('0x38')]:_0x2d23b1[_0x653d('0x32')];if(_0x2bbcf9[_0x653d('0x34')][_0x653d('0x42')]){_0x2f18d7[_0x653d('0x43')]=[{'all':!![]}];}_0x2f18d7=_[_0x653d('0x48')]({},_0x2f18d7,_0x2bbcf9['options']);return db[_0x653d('0x2d')]['find'](_0x2f18d7)[_0x653d('0x26')](handleEntityNotFound(_0x2c62f7,null))['then'](respondWithResult(_0x2c62f7,null))[_0x653d('0x49')](handleError(_0x2c62f7,null));};exports['create']=function(_0x3e1e14,_0x347087){return db[_0x653d('0x2d')]['create'](_0x3e1e14[_0x653d('0x4a')],{})['then'](function(_0x4c9652){var _0x36ab78=_0x3e1e14['user'][_0x653d('0x27')]({'plain':!![]});if(!_0x36ab78)throw new Error(_0x653d('0x4b'));if(_0x36ab78['role']===_0x653d('0x4c')){var _0x1f1581=_0x4c9652['get']({'plain':!![]});var _0x475eea=_0x653d('0x28');return db[_0x653d('0x4d')][_0x653d('0x4e')]({'where':{'name':_0x475eea,'userProfileId':_0x36ab78['userProfileId']},'raw':!![]})[_0x653d('0x26')](function(_0x168109){if(_0x168109&&_0x168109[_0x653d('0x4f')]===0x0){return db[_0x653d('0x29')]['create']({'name':_0x1f1581['name'],'resourceId':_0x1f1581['id'],'type':_0x168109['name'],'sectionId':_0x168109['id']},{})['then'](function(){return _0x4c9652;});}else{return _0x4c9652;}})[_0x653d('0x49')](function(_0x20f396){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x20f396);throw _0x20f396;});}return _0x4c9652;})[_0x653d('0x26')](respondWithResult(_0x347087,0xc9))[_0x653d('0x49')](handleError(_0x347087,null));};exports[_0x653d('0x25')]=function(_0x2ea5aa,_0xf3cbc){if(_0x2ea5aa[_0x653d('0x4a')]['id']){delete _0x2ea5aa[_0x653d('0x4a')]['id'];}return db[_0x653d('0x2d')][_0x653d('0x4e')]({'where':{'id':_0x2ea5aa['params']['id']}})[_0x653d('0x26')](handleEntityNotFound(_0xf3cbc,null))[_0x653d('0x26')](saveUpdates(_0x2ea5aa['body'],null))[_0x653d('0x26')](respondWithResult(_0xf3cbc,null))[_0x653d('0x49')](handleError(_0xf3cbc,null));};exports[_0x653d('0x50')]=function(_0x3d4b93,_0x563bac){return db[_0x653d('0x2d')][_0x653d('0x4e')]({'where':{'id':_0x3d4b93['params']['id']}})[_0x653d('0x26')](handleEntityNotFound(_0x563bac,null))['then'](removeEntity(_0x563bac,null))[_0x653d('0x49')](handleError(_0x563bac,null));};exports['addAllCondition']=function(_0x5889db,_0x36418a,_0x3b3288){if(_0x5889db['body']['id']){delete _0x5889db[_0x653d('0x4a')]['id'];}return db[_0x653d('0x2d')]['find']({'where':{'id':_0x5889db['params']['id']}})['then'](handleEntityNotFound(_0x36418a,null))[_0x653d('0x26')](function(_0x50e671){if(_0x50e671){_0x5889db['body']['TriggerAllId']=_0x50e671['id'];return db['Condition'][_0x653d('0x51')](_0x5889db[_0x653d('0x4a')]);}})[_0x653d('0x26')](respondWithResult(_0x36418a,null))[_0x653d('0x49')](handleError(_0x36418a,null));};exports[_0x653d('0x52')]=function(_0x29f642,_0x194df0,_0x58559b){if(_0x29f642[_0x653d('0x4a')]['id']){delete _0x29f642[_0x653d('0x4a')]['id'];}return db[_0x653d('0x2d')]['find']({'where':{'id':_0x29f642[_0x653d('0x53')]['id']}})[_0x653d('0x26')](handleEntityNotFound(_0x194df0,null))[_0x653d('0x26')](function(_0x4f3a01){if(_0x4f3a01){_0x29f642[_0x653d('0x4a')]['TriggerAnyId']=_0x4f3a01['id'];return db['Condition']['create'](_0x29f642[_0x653d('0x4a')]);}})['then'](respondWithResult(_0x194df0,null))[_0x653d('0x49')](handleError(_0x194df0,null));};exports[_0x653d('0x54')]=function(_0xa38ddd,_0x3b7045,_0xd69a44){var _0x5def33={};var _0x453380={};var _0x1d14e1;var _0x47609d;return db[_0x653d('0x2d')][_0x653d('0x55')]({'where':{'id':_0xa38ddd[_0x653d('0x53')]['id']}})[_0x653d('0x26')](handleEntityNotFound(_0x3b7045,null))[_0x653d('0x26')](function(_0x5b723e){if(_0x5b723e){_0x1d14e1=_0x5b723e;_0x453380['model']=_['keys'](db[_0x653d('0x56')][_0x653d('0x2e')]);_0x453380[_0x653d('0x34')]=_['keys'](_0xa38ddd['query']);_0x453380[_0x653d('0x36')]=_[_0x653d('0x37')](_0x453380[_0x653d('0x32')],_0x453380[_0x653d('0x34')]);_0x5def33[_0x653d('0x38')]=_[_0x653d('0x37')](_0x453380[_0x653d('0x32')],qs[_0x653d('0x39')](_0xa38ddd[_0x653d('0x34')][_0x653d('0x39')]));_0x5def33[_0x653d('0x38')]=_0x5def33[_0x653d('0x38')][_0x653d('0x47')]?_0x5def33[_0x653d('0x38')]:_0x453380[_0x653d('0x32')];_0x5def33[_0x653d('0x3b')]=qs[_0x653d('0x3c')](_0xa38ddd['query'][_0x653d('0x3c')]);_0x5def33['where']=qs[_0x653d('0x36')](_[_0x653d('0x3e')](_0xa38ddd[_0x653d('0x34')],_0x453380[_0x653d('0x36')]));if(_0xa38ddd[_0x653d('0x34')]['filter']){_0x5def33['where']=_[_0x653d('0x48')](_0x5def33[_0x653d('0x3d')],{'$or':_[_0x653d('0x33')](_0x5def33[_0x653d('0x38')],function(_0x14b30c){var _0xd5f2c3={};_0xd5f2c3[_0x14b30c]={'$like':'%'+_0xa38ddd[_0x653d('0x34')][_0x653d('0x40')]+'%'};return _0xd5f2c3;})});}_0x5def33=_[_0x653d('0x48')]({},_0x5def33,_0xa38ddd[_0x653d('0x41')]);return _0x1d14e1['getAllConditions'](_0x5def33);}})['then'](function(_0x4e5d80){if(_0x4e5d80){_0x47609d=_0x4e5d80['length'];if(!_0xa38ddd[_0x653d('0x34')]['hasOwnProperty'](_0x653d('0x3a'))){_0x5def33[_0x653d('0x20')]=qs[_0x653d('0x20')](_0xa38ddd['query'][_0x653d('0x20')]);_0x5def33['offset']=qs[_0x653d('0x1d')](_0xa38ddd['query'][_0x653d('0x1d')]);}return _0x1d14e1[_0x653d('0x54')](_0x5def33);}})[_0x653d('0x26')](function(_0x545846){if(_0x545846){return _0x545846?{'count':_0x47609d,'rows':_0x545846}:null;}})[_0x653d('0x26')](respondWithResult(_0x3b7045,null))[_0x653d('0x49')](handleError(_0x3b7045,null));};exports[_0x653d('0x57')]=function(_0x5b9105,_0x5b4c16,_0x1f35b7){var _0x34061b={};var _0xaf3269={};var _0x55ed57;var _0x31daad;return db['Trigger']['findOne']({'where':{'id':_0x5b9105[_0x653d('0x53')]['id']}})[_0x653d('0x26')](handleEntityNotFound(_0x5b4c16,null))['then'](function(_0x37352b){if(_0x37352b){_0x55ed57=_0x37352b;_0xaf3269[_0x653d('0x32')]=_[_0x653d('0x35')](db[_0x653d('0x56')]['rawAttributes']);_0xaf3269[_0x653d('0x34')]=_[_0x653d('0x35')](_0x5b9105[_0x653d('0x34')]);_0xaf3269[_0x653d('0x36')]=_[_0x653d('0x37')](_0xaf3269[_0x653d('0x32')],_0xaf3269[_0x653d('0x34')]);_0x34061b[_0x653d('0x38')]=_[_0x653d('0x37')](_0xaf3269[_0x653d('0x32')],qs[_0x653d('0x39')](_0x5b9105[_0x653d('0x34')][_0x653d('0x39')]));_0x34061b['attributes']=_0x34061b[_0x653d('0x38')]['length']?_0x34061b['attributes']:_0xaf3269[_0x653d('0x32')];_0x34061b[_0x653d('0x3b')]=qs['sort'](_0x5b9105[_0x653d('0x34')][_0x653d('0x3c')]);_0x34061b[_0x653d('0x3d')]=qs[_0x653d('0x36')](_[_0x653d('0x3e')](_0x5b9105[_0x653d('0x34')],_0xaf3269['filters']));if(_0x5b9105['query'][_0x653d('0x40')]){_0x34061b['where']=_[_0x653d('0x48')](_0x34061b[_0x653d('0x3d')],{'$or':_[_0x653d('0x33')](_0x34061b[_0x653d('0x38')],function(_0xd5aa15){var _0x2acffc={};_0x2acffc[_0xd5aa15]={'$like':'%'+_0x5b9105['query']['filter']+'%'};return _0x2acffc;})});}_0x34061b=_[_0x653d('0x48')]({},_0x34061b,_0x5b9105[_0x653d('0x41')]);return _0x55ed57[_0x653d('0x57')](_0x34061b);}})[_0x653d('0x26')](function(_0x170cd5){if(_0x170cd5){_0x31daad=_0x170cd5['length'];if(!_0x5b9105['query']['hasOwnProperty'](_0x653d('0x3a'))){_0x34061b[_0x653d('0x20')]=qs[_0x653d('0x20')](_0x5b9105[_0x653d('0x34')][_0x653d('0x20')]);_0x34061b[_0x653d('0x1d')]=qs['offset'](_0x5b9105['query'][_0x653d('0x1d')]);}return _0x55ed57[_0x653d('0x57')](_0x34061b);}})[_0x653d('0x26')](function(_0x1ab347){if(_0x1ab347){return _0x1ab347?{'count':_0x31daad,'rows':_0x1ab347}:null;}})[_0x653d('0x26')](respondWithResult(_0x5b4c16,null))[_0x653d('0x49')](handleError(_0x5b4c16,null));};exports[_0x653d('0x58')]=function(_0x334ccc,_0x13bb4a,_0x2d3f95){if(_0x334ccc[_0x653d('0x4a')]['id']){delete _0x334ccc[_0x653d('0x4a')]['id'];}return db['Trigger'][_0x653d('0x4e')]({'where':{'id':_0x334ccc[_0x653d('0x53')]['id']}})[_0x653d('0x26')](handleEntityNotFound(_0x13bb4a,null))['then'](function(_0x2415a7){if(_0x2415a7){_0x334ccc[_0x653d('0x4a')][_0x653d('0x59')]=_0x2415a7['id'];return db['Action'][_0x653d('0x51')](_0x334ccc[_0x653d('0x4a')]);}})[_0x653d('0x26')](respondWithResult(_0x13bb4a,null))[_0x653d('0x49')](handleError(_0x13bb4a,null));};exports['getActions']=function(_0x55ae9d,_0x22528a,_0x29977d){var _0x5f1c32={};var _0x1aa6f6={};var _0x5d79f4;var _0x2ccc9e;return db[_0x653d('0x2d')]['findOne']({'where':{'id':_0x55ae9d[_0x653d('0x53')]['id']}})[_0x653d('0x26')](handleEntityNotFound(_0x22528a,null))['then'](function(_0x303472){if(_0x303472){_0x5d79f4=_0x303472;_0x1aa6f6['model']=_[_0x653d('0x35')](db[_0x653d('0x5a')][_0x653d('0x2e')]);_0x1aa6f6[_0x653d('0x34')]=_['keys'](_0x55ae9d[_0x653d('0x34')]);_0x1aa6f6[_0x653d('0x36')]=_[_0x653d('0x37')](_0x1aa6f6[_0x653d('0x32')],_0x1aa6f6[_0x653d('0x34')]);_0x5f1c32[_0x653d('0x38')]=_[_0x653d('0x37')](_0x1aa6f6[_0x653d('0x32')],qs[_0x653d('0x39')](_0x55ae9d[_0x653d('0x34')][_0x653d('0x39')]));_0x5f1c32[_0x653d('0x38')]=_0x5f1c32[_0x653d('0x38')][_0x653d('0x47')]?_0x5f1c32['attributes']:_0x1aa6f6['model'];_0x5f1c32[_0x653d('0x3b')]=qs[_0x653d('0x3c')](_0x55ae9d['query'][_0x653d('0x3c')]);_0x5f1c32[_0x653d('0x3d')]=qs['filters'](_[_0x653d('0x3e')](_0x55ae9d[_0x653d('0x34')],_0x1aa6f6[_0x653d('0x36')]));if(_0x55ae9d[_0x653d('0x34')]['filter']){_0x5f1c32[_0x653d('0x3d')]=_[_0x653d('0x48')](_0x5f1c32[_0x653d('0x3d')],{'$or':_[_0x653d('0x33')](_0x5f1c32[_0x653d('0x38')],function(_0x21e634){var _0x2ead97={};_0x2ead97[_0x21e634]={'$like':'%'+_0x55ae9d[_0x653d('0x34')][_0x653d('0x40')]+'%'};return _0x2ead97;})});}_0x5f1c32=_[_0x653d('0x48')]({},_0x5f1c32,_0x55ae9d[_0x653d('0x41')]);return _0x5d79f4[_0x653d('0x5b')](_0x5f1c32);}})[_0x653d('0x26')](function(_0x4e0a41){if(_0x4e0a41){_0x2ccc9e=_0x4e0a41[_0x653d('0x47')];if(!_0x55ae9d[_0x653d('0x34')][_0x653d('0x5c')](_0x653d('0x3a'))){_0x5f1c32['limit']=qs['limit'](_0x55ae9d[_0x653d('0x34')]['limit']);_0x5f1c32[_0x653d('0x1d')]=qs[_0x653d('0x1d')](_0x55ae9d[_0x653d('0x34')][_0x653d('0x1d')]);}return _0x5d79f4[_0x653d('0x5b')](_0x5f1c32);}})[_0x653d('0x26')](function(_0x1b2a48){if(_0x1b2a48){return _0x1b2a48?{'count':_0x2ccc9e,'rows':_0x1b2a48}:null;}})[_0x653d('0x26')](respondWithResult(_0x22528a,null))[_0x653d('0x49')](handleError(_0x22528a,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index e927c9e..9ef354e 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 _0x9879=['request-promise','path','rimraf','../../config/environment','./trigger.attributes','exports','define','tools_triggers','lodash','util','../../config/logger','moment'];(function(_0x566c40,_0x3c2178){var _0x5152ec=function(_0x3e2112){while(--_0x3e2112){_0x566c40['push'](_0x566c40['shift']());}};_0x5152ec(++_0x3c2178);}(_0x9879,0x98));var _0x9987=function(_0x389999,_0x208ffc){_0x389999=_0x389999-0x0;var _0x456386=_0x9879[_0x389999];return _0x456386;};'use strict';var _=require(_0x9987('0x0'));var util=require(_0x9987('0x1'));var logger=require(_0x9987('0x2'))('api');var moment=require(_0x9987('0x3'));var BPromise=require('bluebird');var rp=require(_0x9987('0x4'));var fs=require('fs');var path=require(_0x9987('0x5'));var rimraf=require(_0x9987('0x6'));var config=require(_0x9987('0x7'));var attributes=require(_0x9987('0x8'));module[_0x9987('0x9')]=function(_0x4258df,_0x4d479d){return _0x4258df[_0x9987('0xa')]('Trigger',attributes,{'tableName':_0x9987('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf430=['../../config/environment','./trigger.attributes','define','tools_triggers','lodash','util','../../config/logger','moment','bluebird','rimraf'];(function(_0x2e1a2,_0x81aa1c){var _0x3df6c8=function(_0x54d755){while(--_0x54d755){_0x2e1a2['push'](_0x2e1a2['shift']());}};_0x3df6c8(++_0x81aa1c);}(_0xf430,0x1e4));var _0x0f43=function(_0x2bbc07,_0x1e2168){_0x2bbc07=_0x2bbc07-0x0;var _0x6879e4=_0xf430[_0x2bbc07];return _0x6879e4;};'use strict';var _=require(_0x0f43('0x0'));var util=require(_0x0f43('0x1'));var logger=require(_0x0f43('0x2'))('api');var moment=require(_0x0f43('0x3'));var BPromise=require(_0x0f43('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0f43('0x5'));var config=require(_0x0f43('0x6'));var attributes=require(_0x0f43('0x7'));module['exports']=function(_0x5edfba,_0x31f752){return _0x5edfba[_0x0f43('0x8')]('Trigger',attributes,{'tableName':_0x0f43('0x9'),'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 f08c930..0b86abc 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 _0x03d0=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','Trigger,\x20%s,\x20%s','message','catch','GetTrigger','options','raw','where','attributes','limit','include','map','model','ShowTrigger','lodash','moment','bluebird'];(function(_0x186d11,_0x290d2e){var _0x3621dd=function(_0x3d356a){while(--_0x3d356a){_0x186d11['push'](_0x186d11['shift']());}};_0x3621dd(++_0x290d2e);}(_0x03d0,0x1bd));var _0x003d=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x03d0[_0x29b609];return _0x54c952;};'use strict';var _=require(_0x003d('0x0'));var util=require('util');var moment=require(_0x003d('0x1'));var BPromise=require(_0x003d('0x2'));var rs=require(_0x003d('0x3'));var fs=require('fs');var Redis=require(_0x003d('0x4'));var db=require(_0x003d('0x5'))['db'];var utils=require(_0x003d('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x003d('0x7'));var jayson=require(_0x003d('0x8'));var client=jayson[_0x003d('0x9')][_0x003d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x148704,_0x416b44,_0x554188){return new BPromise(function(_0x257934,_0x2e8908){return client[_0x003d('0xb')](_0x148704,_0x554188)[_0x003d('0xc')](function(_0x2b893b){logger[_0x003d('0xd')]('Trigger,\x20%s,\x20%s',_0x416b44,_0x003d('0xe'));logger[_0x003d('0xf')](_0x003d('0x10'),_0x416b44,_0x003d('0xe'),JSON[_0x003d('0x11')](_0x2b893b));if(_0x2b893b[_0x003d('0x12')]){if(_0x2b893b['error']['code']===0x1f4){logger[_0x003d('0x12')](_0x003d('0x13'),_0x416b44,_0x2b893b[_0x003d('0x12')]['message']);return _0x2e8908(_0x2b893b['error']['message']);}logger[_0x003d('0x12')]('Trigger,\x20%s,\x20%s',_0x416b44,_0x2b893b['error'][_0x003d('0x14')]);return _0x257934(_0x2b893b[_0x003d('0x12')][_0x003d('0x14')]);}else{logger[_0x003d('0xd')](_0x003d('0x13'),_0x416b44,_0x003d('0xe'));_0x257934(_0x2b893b['result'][_0x003d('0x14')]);}})[_0x003d('0x15')](function(_0x508a10){logger[_0x003d('0x12')](_0x003d('0x13'),_0x416b44,_0x508a10);_0x2e8908(_0x508a10);});});}exports[_0x003d('0x16')]=function(_0x2d9110){var _0x58e08f=this;return new Promise(function(_0x187e22,_0x547076){return db['Trigger']['findAll']({'raw':_0x2d9110['options']?_0x2d9110[_0x003d('0x17')][_0x003d('0x18')]===undefined?!![]:![]:!![],'where':_0x2d9110[_0x003d('0x17')]?_0x2d9110[_0x003d('0x17')][_0x003d('0x19')]||null:null,'attributes':_0x2d9110[_0x003d('0x17')]?_0x2d9110[_0x003d('0x17')][_0x003d('0x1a')]||null:null,'limit':_0x2d9110[_0x003d('0x17')]?_0x2d9110[_0x003d('0x17')][_0x003d('0x1b')]||null:null,'include':_0x2d9110[_0x003d('0x17')]?_0x2d9110[_0x003d('0x17')][_0x003d('0x1c')]?_[_0x003d('0x1d')](_0x2d9110[_0x003d('0x17')][_0x003d('0x1c')],function(_0x48c642){return{'model':db[_0x48c642[_0x003d('0x1e')]],'as':_0x48c642['as'],'attributes':_0x48c642[_0x003d('0x1a')],'include':_0x48c642[_0x003d('0x1c')]?_[_0x003d('0x1d')](_0x48c642[_0x003d('0x1c')],function(_0x221dee){return{'model':db[_0x221dee['model']],'as':_0x221dee['as'],'attributes':_0x221dee[_0x003d('0x1a')],'include':_0x221dee[_0x003d('0x1c')]?_[_0x003d('0x1d')](_0x221dee['include'],function(_0xfda93){return{'model':db[_0xfda93['model']],'as':_0xfda93['as'],'attributes':_0xfda93[_0x003d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x003d('0xc')](function(_0x4b48b7){logger[_0x003d('0xd')](_0x003d('0x16'),_0x2d9110);logger[_0x003d('0xf')](_0x003d('0x16'),_0x2d9110,JSON['stringify'](_0x4b48b7));_0x187e22(_0x4b48b7);})[_0x003d('0x15')](function(_0x41ee08){logger[_0x003d('0x12')](_0x003d('0x16'),_0x41ee08[_0x003d('0x14')],_0x2d9110);_0x547076(_0x58e08f['error'](0x1f4,_0x41ee08[_0x003d('0x14')]));});});};exports[_0x003d('0x1f')]=function(_0x4ae19c){var _0x459fe3=this;return new Promise(function(_0x36acf8,_0x3a1394){return db['Trigger']['find']({'raw':_0x4ae19c[_0x003d('0x17')]?_0x4ae19c['options'][_0x003d('0x18')]===undefined?!![]:![]:!![],'where':_0x4ae19c[_0x003d('0x17')]?_0x4ae19c['options'][_0x003d('0x19')]||null:null,'attributes':_0x4ae19c[_0x003d('0x17')]?_0x4ae19c[_0x003d('0x17')]['attributes']||null:null,'include':_0x4ae19c['options']?_0x4ae19c[_0x003d('0x17')]['include']?_['map'](_0x4ae19c[_0x003d('0x17')][_0x003d('0x1c')],function(_0x5b6b91){return{'model':db[_0x5b6b91[_0x003d('0x1e')]],'as':_0x5b6b91['as'],'attributes':_0x5b6b91[_0x003d('0x1a')],'include':_0x5b6b91['include']?_[_0x003d('0x1d')](_0x5b6b91['include'],function(_0x537abb){return{'model':db[_0x537abb[_0x003d('0x1e')]],'as':_0x537abb['as'],'attributes':_0x537abb['attributes'],'include':_0x537abb[_0x003d('0x1c')]?_[_0x003d('0x1d')](_0x537abb['include'],function(_0x3db2a9){return{'model':db[_0x3db2a9[_0x003d('0x1e')]],'as':_0x3db2a9['as'],'attributes':_0x3db2a9[_0x003d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x003d('0xc')](function(_0x1394e2){logger[_0x003d('0xd')](_0x003d('0x1f'),_0x4ae19c);logger['debug'](_0x003d('0x1f'),_0x4ae19c,JSON[_0x003d('0x11')](_0x1394e2));_0x36acf8(_0x1394e2);})[_0x003d('0x15')](function(_0x121e6e){logger[_0x003d('0x12')](_0x003d('0x1f'),_0x121e6e[_0x003d('0x14')],_0x4ae19c);_0x3a1394(_0x459fe3[_0x003d('0x12')](0x1f4,_0x121e6e['message']));});});}; \ No newline at end of file +var _0xd216=['raw','attributes','limit','include','map','model','then','debug','find','ShowTrigger','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetTrigger','Trigger','options'];(function(_0x10f3ad,_0xb00669){var _0x377a55=function(_0x28e070){while(--_0x28e070){_0x10f3ad['push'](_0x10f3ad['shift']());}};_0x377a55(++_0xb00669);}(_0xd216,0xf1));var _0x6d21=function(_0x5d264e,_0x580227){_0x5d264e=_0x5d264e-0x0;var _0x339dde=_0xd216[_0x5d264e];return _0x339dde;};'use strict';var _=require(_0x6d21('0x0'));var util=require(_0x6d21('0x1'));var moment=require('moment');var BPromise=require(_0x6d21('0x2'));var rs=require(_0x6d21('0x3'));var fs=require('fs');var Redis=require(_0x6d21('0x4'));var db=require(_0x6d21('0x5'))['db'];var utils=require(_0x6d21('0x6'));var logger=require('../../config/logger')(_0x6d21('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6d21('0x8')][_0x6d21('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c32c6,_0x6d254a,_0x5248e7){return new BPromise(function(_0x23027d,_0x3df12f){return client[_0x6d21('0xa')](_0x4c32c6,_0x5248e7)['then'](function(_0xc17c5a){logger['info'](_0x6d21('0xb'),_0x6d254a,_0x6d21('0xc'));logger['debug'](_0x6d21('0xd'),_0x6d254a,_0x6d21('0xc'),JSON[_0x6d21('0xe')](_0xc17c5a));if(_0xc17c5a['error']){if(_0xc17c5a[_0x6d21('0xf')]['code']===0x1f4){logger['error'](_0x6d21('0xb'),_0x6d254a,_0xc17c5a['error']['message']);return _0x3df12f(_0xc17c5a[_0x6d21('0xf')][_0x6d21('0x10')]);}logger['error']('Trigger,\x20%s,\x20%s',_0x6d254a,_0xc17c5a[_0x6d21('0xf')][_0x6d21('0x10')]);return _0x23027d(_0xc17c5a[_0x6d21('0xf')][_0x6d21('0x10')]);}else{logger[_0x6d21('0x11')]('Trigger,\x20%s,\x20%s',_0x6d254a,_0x6d21('0xc'));_0x23027d(_0xc17c5a[_0x6d21('0x12')]['message']);}})[_0x6d21('0x13')](function(_0x7b6771){logger[_0x6d21('0xf')]('Trigger,\x20%s,\x20%s',_0x6d254a,_0x7b6771);_0x3df12f(_0x7b6771);});});}exports[_0x6d21('0x14')]=function(_0x2cc71a){var _0x441deb=this;return new Promise(function(_0x2577a3,_0x36e505){return db[_0x6d21('0x15')]['findAll']({'raw':_0x2cc71a[_0x6d21('0x16')]?_0x2cc71a['options'][_0x6d21('0x17')]===undefined?!![]:![]:!![],'where':_0x2cc71a[_0x6d21('0x16')]?_0x2cc71a[_0x6d21('0x16')]['where']||null:null,'attributes':_0x2cc71a[_0x6d21('0x16')]?_0x2cc71a[_0x6d21('0x16')][_0x6d21('0x18')]||null:null,'limit':_0x2cc71a[_0x6d21('0x16')]?_0x2cc71a[_0x6d21('0x16')][_0x6d21('0x19')]||null:null,'include':_0x2cc71a['options']?_0x2cc71a[_0x6d21('0x16')][_0x6d21('0x1a')]?_[_0x6d21('0x1b')](_0x2cc71a[_0x6d21('0x16')][_0x6d21('0x1a')],function(_0x8a283d){return{'model':db[_0x8a283d['model']],'as':_0x8a283d['as'],'attributes':_0x8a283d[_0x6d21('0x18')],'include':_0x8a283d['include']?_[_0x6d21('0x1b')](_0x8a283d[_0x6d21('0x1a')],function(_0x138816){return{'model':db[_0x138816[_0x6d21('0x1c')]],'as':_0x138816['as'],'attributes':_0x138816[_0x6d21('0x18')],'include':_0x138816[_0x6d21('0x1a')]?_['map'](_0x138816[_0x6d21('0x1a')],function(_0x16048a){return{'model':db[_0x16048a[_0x6d21('0x1c')]],'as':_0x16048a['as'],'attributes':_0x16048a['attributes']};}):[]};}):[]};}):[]:[]})[_0x6d21('0x1d')](function(_0x4ffb8b){logger[_0x6d21('0x11')]('GetTrigger',_0x2cc71a);logger[_0x6d21('0x1e')](_0x6d21('0x14'),_0x2cc71a,JSON[_0x6d21('0xe')](_0x4ffb8b));_0x2577a3(_0x4ffb8b);})[_0x6d21('0x13')](function(_0x4c4fbe){logger[_0x6d21('0xf')]('GetTrigger',_0x4c4fbe[_0x6d21('0x10')],_0x2cc71a);_0x36e505(_0x441deb['error'](0x1f4,_0x4c4fbe[_0x6d21('0x10')]));});});};exports['ShowTrigger']=function(_0x229a3e){var _0x230f4b=this;return new Promise(function(_0x4a255c,_0x184258){return db['Trigger'][_0x6d21('0x1f')]({'raw':_0x229a3e[_0x6d21('0x16')]?_0x229a3e[_0x6d21('0x16')][_0x6d21('0x17')]===undefined?!![]:![]:!![],'where':_0x229a3e[_0x6d21('0x16')]?_0x229a3e[_0x6d21('0x16')]['where']||null:null,'attributes':_0x229a3e[_0x6d21('0x16')]?_0x229a3e[_0x6d21('0x16')]['attributes']||null:null,'include':_0x229a3e[_0x6d21('0x16')]?_0x229a3e[_0x6d21('0x16')][_0x6d21('0x1a')]?_['map'](_0x229a3e[_0x6d21('0x16')][_0x6d21('0x1a')],function(_0x4fa5ad){return{'model':db[_0x4fa5ad['model']],'as':_0x4fa5ad['as'],'attributes':_0x4fa5ad[_0x6d21('0x18')],'include':_0x4fa5ad[_0x6d21('0x1a')]?_[_0x6d21('0x1b')](_0x4fa5ad[_0x6d21('0x1a')],function(_0x4fd461){return{'model':db[_0x4fd461['model']],'as':_0x4fd461['as'],'attributes':_0x4fd461[_0x6d21('0x18')],'include':_0x4fd461[_0x6d21('0x1a')]?_['map'](_0x4fd461[_0x6d21('0x1a')],function(_0x524047){return{'model':db[_0x524047['model']],'as':_0x524047['as'],'attributes':_0x524047[_0x6d21('0x18')]};}):[]};}):[]};}):[]:[]})[_0x6d21('0x1d')](function(_0x3af52b){logger[_0x6d21('0x11')](_0x6d21('0x20'),_0x229a3e);logger[_0x6d21('0x1e')](_0x6d21('0x20'),_0x229a3e,JSON[_0x6d21('0xe')](_0x3af52b));_0x4a255c(_0x3af52b);})['catch'](function(_0x289fb2){logger[_0x6d21('0xf')](_0x6d21('0x20'),_0x289fb2[_0x6d21('0x10')],_0x229a3e);_0x184258(_0x230f4b['error'](0x1f4,_0x289fb2[_0x6d21('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index b714380..8d2f94b 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 _0x9227=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','/:id/clone','post','create','put','destroy','exports','multer','path','connect-timeout','express'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x9227,0x128));var _0x7922=function(_0x15178d,_0xa2810b){_0x15178d=_0x15178d-0x0;var _0x48a34e=_0x9227[_0x15178d];return _0x48a34e;};'use strict';var multer=require(_0x7922('0x0'));var util=require('util');var path=require(_0x7922('0x1'));var timeout=require(_0x7922('0x2'));var express=require(_0x7922('0x3'));var router=express['Router']();var fs_extra=require(_0x7922('0x4'));var auth=require(_0x7922('0x5'));var interaction=require(_0x7922('0x6'));var config=require(_0x7922('0x7'));var controller=require(_0x7922('0x8'));router[_0x7922('0x9')]('/',auth[_0x7922('0xa')](),controller[_0x7922('0xb')]);router[_0x7922('0x9')](_0x7922('0xc'),auth[_0x7922('0xa')](),controller[_0x7922('0xd')]);router['post'](_0x7922('0xe'),auth['isAuthenticated'](),controller['clone']);router[_0x7922('0xf')]('/',auth['isAuthenticated'](),controller[_0x7922('0x10')]);router[_0x7922('0x11')](_0x7922('0xc'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x7922('0xa')](),controller[_0x7922('0x12')]);module[_0x7922('0x13')]=router; \ No newline at end of file +var _0x4bf8=['delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','/:id/clone','clone','post','put'];(function(_0x5b458d,_0x2b7f7c){var _0x581a25=function(_0x1ed46b){while(--_0x1ed46b){_0x5b458d['push'](_0x5b458d['shift']());}};_0x581a25(++_0x2b7f7c);}(_0x4bf8,0x66));var _0x84bf=function(_0x5243f1,_0x257ea7){_0x5243f1=_0x5243f1-0x0;var _0x52c51b=_0x4bf8[_0x5243f1];return _0x52c51b;};'use strict';var multer=require('multer');var util=require(_0x84bf('0x0'));var path=require(_0x84bf('0x1'));var timeout=require(_0x84bf('0x2'));var express=require('express');var router=express[_0x84bf('0x3')]();var fs_extra=require(_0x84bf('0x4'));var auth=require(_0x84bf('0x5'));var interaction=require(_0x84bf('0x6'));var config=require(_0x84bf('0x7'));var controller=require(_0x84bf('0x8'));router[_0x84bf('0x9')]('/',auth[_0x84bf('0xa')](),controller[_0x84bf('0xb')]);router['get'](_0x84bf('0xc'),auth[_0x84bf('0xa')](),controller[_0x84bf('0xd')]);router['post'](_0x84bf('0xe'),auth['isAuthenticated'](),controller[_0x84bf('0xf')]);router[_0x84bf('0x10')]('/',auth[_0x84bf('0xa')](),controller['create']);router[_0x84bf('0x11')](_0x84bf('0xc'),auth[_0x84bf('0xa')](),controller['update']);router[_0x84bf('0x12')](_0x84bf('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x84bf('0x13')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 645413d..e012958 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 _0xec41=['yes','nonat','update','force_rport,comedia','nat','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','INTEGER','refuse','originate','uas','fingerprint','certificate','passive','update,nonat','BOOLEAN','STRING','name','ENUM','friend','user','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','info','inband','auto'];(function(_0x33bbea,_0x4337c5){var _0x516ac2=function(_0x123bbc){while(--_0x123bbc){_0x33bbea['push'](_0x33bbea['shift']());}};_0x516ac2(++_0x4337c5);}(_0xec41,0x177));var _0x1ec4=function(_0x10fa1e,_0x3761e9){_0x10fa1e=_0x10fa1e-0x0;var _0x4a9492=_0xec41[_0x10fa1e];return _0x4a9492;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1ec4('0x0')],'allowNull':![],'unique':_0x1ec4('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x1ec4('0x2')](_0x1ec4('0x3'),_0x1ec4('0x4'),'peer'),'allowNull':![],'defaultValue':_0x1ec4('0x3')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1ec4('0x5')},'callingpres':{'type':Sequelize[_0x1ec4('0x2')]('ALLOWED_NOT_SCREENED',_0x1ec4('0x6'),'ALLOWED_FAILED_SCREEN',_0x1ec4('0x7'),_0x1ec4('0x8'),_0x1ec4('0x9'),_0x1ec4('0xa'),_0x1ec4('0xb'))},'deny':{'type':Sequelize[_0x1ec4('0x0')]},'permit':{'type':Sequelize[_0x1ec4('0x0')]},'secret':{'type':Sequelize[_0x1ec4('0x0')]},'md5secret':{'type':Sequelize[_0x1ec4('0x0')]},'remotesecret':{'type':Sequelize[_0x1ec4('0x0')]},'transport':{'type':Sequelize[_0x1ec4('0x0')],'defaultValue':_0x1ec4('0xc'),'set':function(_0x108c99){this[_0x1ec4('0xd')](_0x1ec4('0xe'),_0x108c99?_0x108c99[_0x1ec4('0xf')](','):null);},'get':function(){return this[_0x1ec4('0x10')](_0x1ec4('0xe'))?this[_0x1ec4('0x10')](_0x1ec4('0xe'))[_0x1ec4('0x11')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x1ec4('0x2')]('rfc2833',_0x1ec4('0x12'),'shortinfo',_0x1ec4('0x13'),_0x1ec4('0x14')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x1ec4('0x2')](_0x1ec4('0x15'),'no',_0x1ec4('0x16'),_0x1ec4('0x17'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x1ec4('0x15'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x1ec4('0x0')]},'nat':{'type':Sequelize[_0x1ec4('0x0')],'defaultValue':_0x1ec4('0x18'),'set':function(_0x1cc0e0){this[_0x1ec4('0xd')]('nat',_0x1cc0e0?_0x1cc0e0['join'](','):null);},'get':function(){return this[_0x1ec4('0x10')]('nat')?this[_0x1ec4('0x10')](_0x1ec4('0x19'))[_0x1ec4('0x11')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x1ec4('0x0')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x1ec4('0x0')]},'namedpickupgroup':{'type':Sequelize[_0x1ec4('0x0')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1ec4('0x0')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x1ec4('0x1a')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x42d729){this[_0x1ec4('0xd')](_0x1ec4('0x1b'),_0x42d729?_0x42d729[_0x1ec4('0xf')](';'):_0x1ec4('0x1c'));},'get':function(){return this[_0x1ec4('0x10')](_0x1ec4('0x1b'))?this[_0x1ec4('0x10')](_0x1ec4('0x1b'))[_0x1ec4('0x11')](';'):null;},'comment':_0x1ec4('0x1d')},'autoframing':{'type':Sequelize[_0x1ec4('0x2')](_0x1ec4('0x15'),'no')},'insecure':{'type':Sequelize[_0x1ec4('0x0')],'defaultValue':'port,invite','set':function(_0x170ba9){this[_0x1ec4('0xd')](_0x1ec4('0x1e'),_0x170ba9?_0x170ba9[_0x1ec4('0xf')](','):null);},'get':function(){return this['getDataValue'](_0x1ec4('0x1e'))?this[_0x1ec4('0x10')]('insecure')[_0x1ec4('0x11')](','):null;},'comment':_0x1ec4('0x1f')},'trustrpid':{'type':Sequelize[_0x1ec4('0x2')](_0x1ec4('0x15'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1ec4('0x2')](_0x1ec4('0x15'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x1ec4('0x15'),'no',_0x1ec4('0x20'))},'promiscredir':{'type':Sequelize[_0x1ec4('0x2')](_0x1ec4('0x15'),'no')},'useclientcode':{'type':Sequelize[_0x1ec4('0x2')]('yes','no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x1ec4('0x0')]},'callerid':{'type':Sequelize[_0x1ec4('0x0')],'defaultValue':_0x1ec4('0x21')},'amaflags':{'type':Sequelize[_0x1ec4('0x0')]},'callcounter':{'type':Sequelize['ENUM'](_0x1ec4('0x15'),'no'),'defaultValue':_0x1ec4('0x15')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x1ec4('0x2')](_0x1ec4('0x15'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x1ec4('0x15'),'no')},'allowtransfer':{'type':Sequelize[_0x1ec4('0x2')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x1ec4('0x2')]('yes','no')},'subscribecontext':{'type':Sequelize[_0x1ec4('0x0')]},'template':{'type':Sequelize[_0x1ec4('0x0')]},'videosupport':{'type':Sequelize[_0x1ec4('0x2')](_0x1ec4('0x15'),'no',_0x1ec4('0x22')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1ec4('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x1ec4('0x2')](_0x1ec4('0x15'),'no')},'mailbox':{'type':Sequelize[_0x1ec4('0x0')]},'session_timers':{'type':Sequelize[_0x1ec4('0x2')]('accept',_0x1ec4('0x24'),_0x1ec4('0x25'))},'session_expires':{'type':Sequelize[_0x1ec4('0x23')](0xb)},'session_minse':{'type':Sequelize[_0x1ec4('0x23')](0xb)},'session_refresher':{'type':Sequelize[_0x1ec4('0x2')]('uac',_0x1ec4('0x26')),'defaultValue':_0x1ec4('0x26')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x1ec4('0x0')]},'fromdomain':{'type':Sequelize[_0x1ec4('0x0')]},'fromuser':{'type':Sequelize[_0x1ec4('0x0')]},'port':{'type':Sequelize[_0x1ec4('0x23')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x1ec4('0x15'),'no'),'defaultValue':_0x1ec4('0x15')},'keepalive':{'type':Sequelize[_0x1ec4('0x23')](0xb)},'defaultip':{'type':Sequelize[_0x1ec4('0x0')]},'defaultuser':{'type':Sequelize[_0x1ec4('0x0')]},'rtptimeout':{'type':Sequelize[_0x1ec4('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x1ec4('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x1ec4('0x23')](0xb)},'sendrpid':{'type':Sequelize[_0x1ec4('0x2')](_0x1ec4('0x15'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1ec4('0x0')]},'callbackextension':{'type':Sequelize[_0x1ec4('0x0')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x1ec4('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0x1ec4('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0x1ec4('0x0')]},'contactdeny':{'type':Sequelize[_0x1ec4('0x0')]},'contactacl':{'type':Sequelize[_0x1ec4('0x0')]},'unsolicited_mailbox':{'type':Sequelize[_0x1ec4('0x0')]},'use_q850_reason':{'type':Sequelize[_0x1ec4('0x0')]},'maxforwards':{'type':Sequelize[_0x1ec4('0x23')](0xb)},'encryption':{'type':Sequelize[_0x1ec4('0x2')](_0x1ec4('0x15'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x1ec4('0x15'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x1ec4('0x15'),'no')},'icesupport':{'type':Sequelize[_0x1ec4('0x2')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x1ec4('0x2')](_0x1ec4('0x15'),'no')},'dtlsverify':{'type':Sequelize[_0x1ec4('0x2')](_0x1ec4('0x15'),'no',_0x1ec4('0x27'),_0x1ec4('0x28'))},'dtlsrekey':{'type':Sequelize[_0x1ec4('0x23')](0xb)},'dtlscertfile':{'type':Sequelize[_0x1ec4('0x0')]},'dtlsprivatekey':{'type':Sequelize[_0x1ec4('0x0')]},'dtlscipher':{'type':Sequelize[_0x1ec4('0x0')]},'dtlscafile':{'type':Sequelize[_0x1ec4('0x0')]},'dtlscapath':{'type':Sequelize[_0x1ec4('0x0')]},'dtlssetup':{'type':Sequelize[_0x1ec4('0x2')]('active',_0x1ec4('0x29'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize['ENUM'](_0x1ec4('0x15'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1ec4('0x0')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x1ec4('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x1ec4('0x2')]('yes','no')},'subscribemwi':{'type':Sequelize[_0x1ec4('0x2')](_0x1ec4('0x15'),'no')},'vmexten':{'type':Sequelize[_0x1ec4('0x0')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x1ec4('0x0')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x1ec4('0x0')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize['ENUM']('yes','no',_0x1ec4('0x16'),_0x1ec4('0x17'),_0x1ec4('0x2a')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x1ec4('0x0')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x1ec4('0x2b')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x1ec4('0x0')],'defaultValue':'no'}}; \ No newline at end of file +var _0x6850=['String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','auto','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]','insecure','never','INTEGER','always','refuse','uac','uas','fingerprint','certificate','active','passive','actpass','update,nonat','sequelize','exports','STRING','name','ENUM','friend','user','peer','ALLOWED_NOT_SCREENED','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','join','getDataValue','split'];(function(_0x143dcf,_0x3b29fe){var _0x491740=function(_0x5b5635){while(--_0x5b5635){_0x143dcf['push'](_0x143dcf['shift']());}};_0x491740(++_0x3b29fe);}(_0x6850,0x1a6));var _0x0685=function(_0x441ad8,_0x34dbe8){_0x441ad8=_0x441ad8-0x0;var _0x11974b=_0x6850[_0x441ad8];return _0x11974b;};'use strict';var Sequelize=require(_0x0685('0x0'));module[_0x0685('0x1')]={'name':{'type':Sequelize[_0x0685('0x2')],'allowNull':![],'unique':_0x0685('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x0685('0x4')](_0x0685('0x5'),_0x0685('0x6'),_0x0685('0x7')),'allowNull':![],'defaultValue':_0x0685('0x5')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize['ENUM'](_0x0685('0x8'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN',_0x0685('0x9'),'PROHIB_NOT_SCREENED',_0x0685('0xa'),_0x0685('0xb'),_0x0685('0xc'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x0685('0x2')]},'secret':{'type':Sequelize[_0x0685('0x2')]},'md5secret':{'type':Sequelize[_0x0685('0x2')]},'remotesecret':{'type':Sequelize[_0x0685('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x0685('0xd'),'set':function(_0x5dad62){this[_0x0685('0xe')]('transport',_0x5dad62?_0x5dad62[_0x0685('0xf')](','):null);},'get':function(){return this[_0x0685('0x10')]('transport')?this[_0x0685('0x10')]('transport')[_0x0685('0x11')](','):null;},'comment':_0x0685('0x12')},'dtmfmode':{'type':Sequelize[_0x0685('0x4')](_0x0685('0x13'),'info','shortinfo','inband',_0x0685('0x14')),'defaultValue':_0x0685('0x13')},'directmedia':{'type':Sequelize['ENUM'](_0x0685('0x15'),'no',_0x0685('0x16'),_0x0685('0x17'),_0x0685('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0685('0x4')](_0x0685('0x15'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x0685('0x2')]},'directmediadeny':{'type':Sequelize[_0x0685('0x2')]},'nat':{'type':Sequelize[_0x0685('0x2')],'defaultValue':'force_rport,comedia','set':function(_0x3ed327){this[_0x0685('0xe')](_0x0685('0x19'),_0x3ed327?_0x3ed327[_0x0685('0xf')](','):null);},'get':function(){return this['getDataValue'](_0x0685('0x19'))?this[_0x0685('0x10')]('nat')[_0x0685('0x11')](','):null;},'comment':_0x0685('0x1a')},'callgroup':{'type':Sequelize[_0x0685('0x2')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x0685('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x0685('0x2')]},'language':{'type':Sequelize[_0x0685('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x0685('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x0685('0x2')],'defaultValue':_0x0685('0x1b')},'allow':{'type':Sequelize[_0x0685('0x2')],'allowNull':![],'defaultValue':_0x0685('0x1c'),'set':function(_0x1dcf60){this[_0x0685('0xe')](_0x0685('0x1d'),_0x1dcf60?_0x1dcf60[_0x0685('0xf')](';'):_0x0685('0x1c'));},'get':function(){return this[_0x0685('0x10')](_0x0685('0x1d'))?this[_0x0685('0x10')](_0x0685('0x1d'))[_0x0685('0x11')](';'):null;},'comment':_0x0685('0x1e')},'autoframing':{'type':Sequelize[_0x0685('0x4')](_0x0685('0x15'),'no')},'insecure':{'type':Sequelize[_0x0685('0x2')],'defaultValue':'port,invite','set':function(_0x2a4ec2){this[_0x0685('0xe')](_0x0685('0x1f'),_0x2a4ec2?_0x2a4ec2[_0x0685('0xf')](','):null);},'get':function(){return this[_0x0685('0x10')](_0x0685('0x1f'))?this[_0x0685('0x10')]('insecure')[_0x0685('0x11')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x0685('0x4')](_0x0685('0x15'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0685('0x4')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0685('0x4')](_0x0685('0x15'),'no',_0x0685('0x20'))},'promiscredir':{'type':Sequelize[_0x0685('0x4')]('yes','no')},'useclientcode':{'type':Sequelize[_0x0685('0x4')](_0x0685('0x15'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x0685('0x2')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x0685('0x2')]},'callcounter':{'type':Sequelize[_0x0685('0x4')]('yes','no'),'defaultValue':_0x0685('0x15')},'busylevel':{'type':Sequelize[_0x0685('0x21')](0xb)},'allowoverlap':{'type':Sequelize[_0x0685('0x4')](_0x0685('0x15'),'no')},'allowsubscribe':{'type':Sequelize[_0x0685('0x4')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x0685('0x4')](_0x0685('0x15'),'no')},'ignoresdpversion':{'type':Sequelize[_0x0685('0x4')]('yes','no')},'subscribecontext':{'type':Sequelize[_0x0685('0x2')]},'template':{'type':Sequelize[_0x0685('0x2')]},'videosupport':{'type':Sequelize[_0x0685('0x4')](_0x0685('0x15'),'no',_0x0685('0x22')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x0685('0x21')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x0685('0x4')](_0x0685('0x15'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x0685('0x4')]('accept',_0x0685('0x23'),'originate')},'session_expires':{'type':Sequelize[_0x0685('0x21')](0xb)},'session_minse':{'type':Sequelize[_0x0685('0x21')](0xb)},'session_refresher':{'type':Sequelize[_0x0685('0x4')](_0x0685('0x24'),_0x0685('0x25')),'defaultValue':_0x0685('0x25')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x0685('0x2')]},'fromdomain':{'type':Sequelize[_0x0685('0x2')]},'fromuser':{'type':Sequelize[_0x0685('0x2')]},'port':{'type':Sequelize[_0x0685('0x21')](0x5)},'qualify':{'type':Sequelize[_0x0685('0x4')](_0x0685('0x15'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x0685('0x21')](0xb)},'defaultip':{'type':Sequelize[_0x0685('0x2')]},'defaultuser':{'type':Sequelize[_0x0685('0x2')]},'rtptimeout':{'type':Sequelize[_0x0685('0x21')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x0685('0x21')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x0685('0x21')](0xb)},'sendrpid':{'type':Sequelize[_0x0685('0x4')](_0x0685('0x15'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0685('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x0685('0x21')](0xb)},'qualifyfreq':{'type':Sequelize[_0x0685('0x21')](0xb)},'contactpermit':{'type':Sequelize[_0x0685('0x2')]},'contactdeny':{'type':Sequelize[_0x0685('0x2')]},'contactacl':{'type':Sequelize[_0x0685('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x0685('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x0685('0x21')](0xb)},'encryption':{'type':Sequelize[_0x0685('0x4')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x0685('0x4')](_0x0685('0x15'),'no')},'force_avp':{'type':Sequelize[_0x0685('0x4')](_0x0685('0x15'),'no')},'icesupport':{'type':Sequelize[_0x0685('0x4')](_0x0685('0x15'),'no')},'dtlsenable':{'type':Sequelize[_0x0685('0x4')](_0x0685('0x15'),'no')},'dtlsverify':{'type':Sequelize[_0x0685('0x4')](_0x0685('0x15'),'no',_0x0685('0x26'),_0x0685('0x27'))},'dtlsrekey':{'type':Sequelize[_0x0685('0x21')](0xb)},'dtlscertfile':{'type':Sequelize[_0x0685('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x0685('0x2')]},'dtlscipher':{'type':Sequelize[_0x0685('0x2')]},'dtlscafile':{'type':Sequelize[_0x0685('0x2')]},'dtlscapath':{'type':Sequelize[_0x0685('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x0685('0x28'),_0x0685('0x29'),_0x0685('0x2a')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0685('0x2')]},'usereqphone':{'type':Sequelize[_0x0685('0x4')](_0x0685('0x15'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x0685('0x2')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x0685('0x21')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x0685('0x4')]('yes','no')},'subscribemwi':{'type':Sequelize[_0x0685('0x4')](_0x0685('0x15'),'no')},'vmexten':{'type':Sequelize[_0x0685('0x2')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x0685('0x2')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0685('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize['ENUM'](_0x0685('0x15'),'no','nonat',_0x0685('0x17'),_0x0685('0x2b')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x0685('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x0685('0x2')],'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 ac32971..d54d083 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 _0x6f0d=['server/files/templates/registry.ejs','utf8','render','writeFileSync','registry','Reload','chan_sip.so','user','UserProfileSection','autoAssociation','/etc/asterisk/sip_xcally_trunks.conf','/etc/asterisk/sip_xcally_registers.conf','destroy','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','get','Trunks','UserProfileResource','end','stack','name','send','index','map','Trunk','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','clone','rawAttributes','find','updatedAt','body','omit','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','root','server/files/templates/trunk.ejs','join'];(function(_0x211c55,_0x43e0aa){var _0x49f3cd=function(_0x44c135){while(--_0x44c135){_0x211c55['push'](_0x211c55['shift']());}};_0x49f3cd(++_0x43e0aa);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x471cf3,_0x56ac62){_0x471cf3=_0x471cf3-0x0;var _0x57eb65=_0x6f0d[_0x471cf3];return _0x57eb65;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd6f0('0x0'));var zipdir=require(_0xd6f0('0x1'));var jsonpatch=require(_0xd6f0('0x2'));var rp=require(_0xd6f0('0x3'));var moment=require('moment');var BPromise=require(_0xd6f0('0x4'));var Mustache=require(_0xd6f0('0x5'));var util=require(_0xd6f0('0x6'));var path=require(_0xd6f0('0x7'));var sox=require(_0xd6f0('0x8'));var csv=require('to-csv');var ejs=require(_0xd6f0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd6f0('0xa'));var squel=require(_0xd6f0('0xb'));var crypto=require(_0xd6f0('0xc'));var jsforce=require(_0xd6f0('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd6f0('0xe'));var Papa=require(_0xd6f0('0xf'));var Redis=require(_0xd6f0('0x10'));var authService=require(_0xd6f0('0x11'));var qs=require(_0xd6f0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd6f0('0x13'));var logger=require(_0xd6f0('0x14'))(_0xd6f0('0x15'));var utils=require(_0xd6f0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd6f0('0x17'));var db=require(_0xd6f0('0x18'))['db'];var jayson=require(_0xd6f0('0x19'));var client=jayson[_0xd6f0('0x1a')][_0xd6f0('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x409549,_0x2bf5b8,_0x250999,_0x246dad){return new BPromise(function(_0x4ab979,_0x2b3f32){var _0x354846=_0x246dad||client;return _0x354846['request'](_0x409549,_0x250999)[_0xd6f0('0x1c')](function(_0x593abe){logger[_0xd6f0('0x1d')](_0xd6f0('0x1e'),_0x2bf5b8,_0xd6f0('0x1f'));logger[_0xd6f0('0x20')](_0xd6f0('0x21'),_0x2bf5b8,_0xd6f0('0x1f'),JSON[_0xd6f0('0x22')](_0x593abe));if(_0x593abe[_0xd6f0('0x23')]){if(_0x593abe[_0xd6f0('0x23')][_0xd6f0('0x24')]===0x1f4){logger[_0xd6f0('0x23')](_0xd6f0('0x1e'),_0x2bf5b8,_0x593abe[_0xd6f0('0x23')][_0xd6f0('0x25')]);return _0x2b3f32(_0x593abe[_0xd6f0('0x23')][_0xd6f0('0x25')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x2bf5b8,_0x593abe[_0xd6f0('0x23')][_0xd6f0('0x25')]);return _0x4ab979(_0x593abe[_0xd6f0('0x23')]['message']);}else{logger[_0xd6f0('0x1d')](_0xd6f0('0x1e'),_0x2bf5b8,'request\x20sent');_0x4ab979(_0x593abe[_0xd6f0('0x26')]['message']);}})[_0xd6f0('0x27')](function(_0x1c9d90){logger['error'](_0xd6f0('0x1e'),_0x2bf5b8,_0x1c9d90);_0x2b3f32(_0x1c9d90);});});}function respondWithStatusCode(_0x45e99c,_0x5ea2dd){_0x5ea2dd=_0x5ea2dd||0xcc;return function(_0x3dbdc3){if(_0x3dbdc3){return _0x45e99c[_0xd6f0('0x28')](_0x5ea2dd);}return _0x45e99c[_0xd6f0('0x29')](_0x5ea2dd)['end']();};}function respondWithResult(_0x2ca8bb,_0x3dc166){_0x3dc166=_0x3dc166||0xc8;return function(_0x5ecb16){if(_0x5ecb16){return _0x2ca8bb[_0xd6f0('0x29')](_0x3dc166)['json'](_0x5ecb16);}};}function respondWithFilteredResult(_0x2042d5,_0x3fb5c3){return function(_0x1630dc){if(_0x1630dc){var _0x3c1bff=typeof _0x3fb5c3[_0xd6f0('0x2a')]===_0xd6f0('0x2b')&&typeof _0x3fb5c3[_0xd6f0('0x2c')]===_0xd6f0('0x2b');var _0x48975d=_0x1630dc[_0xd6f0('0x2d')];var _0x1982d3=_0x3c1bff?0x0:_0x3fb5c3['offset'];var _0x38a3e9=_0x3c1bff?_0x1630dc[_0xd6f0('0x2d')]:_0x3fb5c3[_0xd6f0('0x2a')]+_0x3fb5c3[_0xd6f0('0x2c')];var _0x1a3967;if(_0x38a3e9>=_0x48975d){_0x38a3e9=_0x48975d;_0x1a3967=0xc8;}else{_0x1a3967=0xce;}_0x2042d5[_0xd6f0('0x29')](_0x1a3967);return _0x2042d5[_0xd6f0('0x2e')](_0xd6f0('0x2f'),_0x1982d3+'-'+_0x38a3e9+'/'+_0x48975d)[_0xd6f0('0x30')](_0x1630dc);}return null;};}function patchUpdates(_0x43f72f){return function(_0x1dff9b){try{jsonpatch[_0xd6f0('0x31')](_0x1dff9b,_0x43f72f,!![]);}catch(_0x348529){return BPromise[_0xd6f0('0x32')](_0x348529);}return _0x1dff9b[_0xd6f0('0x33')]();};}function saveUpdates(_0x2d7c90,_0x31c493){return function(_0x376890){if(_0x376890){return _0x376890[_0xd6f0('0x34')](_0x2d7c90)[_0xd6f0('0x1c')](function(_0x3906ca){return _0x3906ca;});}return null;};}function removeEntity(_0x26ab29,_0x4a8ebe){return function(_0x11124c){if(_0x11124c){return _0x11124c['destroy']()['then'](function(){var _0x43d588=_0x11124c[_0xd6f0('0x35')]({'plain':!![]});var _0x12a6fa=_0xd6f0('0x36');return db[_0xd6f0('0x37')]['destroy']({'where':{'type':_0x12a6fa,'resourceId':_0x43d588['id']}})[_0xd6f0('0x1c')](function(){return _0x11124c;});})['then'](function(){_0x26ab29[_0xd6f0('0x29')](0xcc)[_0xd6f0('0x38')]();});}};}function handleEntityNotFound(_0x42c01a,_0x1eecf0){return function(_0x518751){if(!_0x518751){_0x42c01a['sendStatus'](0x194);}return _0x518751;};}function handleError(_0x47b33d,_0x3b6463){_0x3b6463=_0x3b6463||0x1f4;return function(_0xe2958d){logger['error'](_0xe2958d[_0xd6f0('0x39')]);if(_0xe2958d['name']){delete _0xe2958d[_0xd6f0('0x3a')];}_0x47b33d[_0xd6f0('0x29')](_0x3b6463)[_0xd6f0('0x3b')](_0xe2958d);};}exports[_0xd6f0('0x3c')]=function(_0x451834,_0x3d1280){var _0x6b44fa={},_0x4fd4db={},_0x52203d={'count':0x0,'rows':[]};var _0x162537=_[_0xd6f0('0x3d')](db[_0xd6f0('0x3e')]['rawAttributes'],function(_0x59f905){return{'name':_0x59f905[_0xd6f0('0x3f')],'type':_0x59f905[_0xd6f0('0x40')][_0xd6f0('0x41')]};});_0x4fd4db[_0xd6f0('0x42')]=_[_0xd6f0('0x3d')](_0x162537,_0xd6f0('0x3a'));_0x4fd4db[_0xd6f0('0x43')]=_[_0xd6f0('0x44')](_0x451834['query']);_0x4fd4db[_0xd6f0('0x45')]=_[_0xd6f0('0x46')](_0x4fd4db[_0xd6f0('0x42')],_0x4fd4db[_0xd6f0('0x43')]);_0x6b44fa['attributes']=_[_0xd6f0('0x46')](_0x4fd4db[_0xd6f0('0x42')],qs[_0xd6f0('0x47')](_0x451834[_0xd6f0('0x43')][_0xd6f0('0x47')]));_0x6b44fa['attributes']=_0x6b44fa[_0xd6f0('0x48')][_0xd6f0('0x49')]?_0x6b44fa[_0xd6f0('0x48')]:_0x4fd4db['model'];if(!_0x451834[_0xd6f0('0x43')][_0xd6f0('0x4a')]('nolimit')){_0x6b44fa['limit']=qs[_0xd6f0('0x2c')](_0x451834[_0xd6f0('0x43')][_0xd6f0('0x2c')]);_0x6b44fa['offset']=qs[_0xd6f0('0x2a')](_0x451834[_0xd6f0('0x43')]['offset']);}_0x6b44fa[_0xd6f0('0x4b')]=qs[_0xd6f0('0x4c')](_0x451834[_0xd6f0('0x43')][_0xd6f0('0x4c')]);_0x6b44fa['where']=qs[_0xd6f0('0x45')](_[_0xd6f0('0x4d')](_0x451834[_0xd6f0('0x43')],_0x4fd4db[_0xd6f0('0x45')]),_0x162537);if(_0x451834[_0xd6f0('0x43')][_0xd6f0('0x4e')]){_0x6b44fa[_0xd6f0('0x4f')]=_[_0xd6f0('0x50')](_0x6b44fa['where'],{'$or':_[_0xd6f0('0x3d')](_0x162537,function(_0x3d42ca){if(_0x3d42ca['type']!==_0xd6f0('0x51')){var _0x39ca69={};_0x39ca69[_0x3d42ca[_0xd6f0('0x3a')]]={'$like':'%'+_0x451834[_0xd6f0('0x43')]['filter']+'%'};return _0x39ca69;}})});}_0x6b44fa=_[_0xd6f0('0x50')]({},_0x6b44fa,_0x451834[_0xd6f0('0x52')]);var _0x494542={'where':_0x6b44fa['where']};return db[_0xd6f0('0x3e')]['count'](_0x494542)[_0xd6f0('0x1c')](function(_0x61b354){_0x52203d[_0xd6f0('0x2d')]=_0x61b354;if(_0x451834['query'][_0xd6f0('0x53')]){_0x6b44fa[_0xd6f0('0x54')]=[{'all':!![]}];}return db[_0xd6f0('0x3e')][_0xd6f0('0x55')](_0x6b44fa);})[_0xd6f0('0x1c')](function(_0x4c42ce){_0x52203d[_0xd6f0('0x56')]=_0x4c42ce;return _0x52203d;})['then'](respondWithFilteredResult(_0x3d1280,_0x6b44fa))[_0xd6f0('0x27')](handleError(_0x3d1280,null));};exports[_0xd6f0('0x57')]=function(_0x2eb338,_0x1dc320){var _0x554e37={'raw':![],'where':{'id':_0x2eb338[_0xd6f0('0x58')]['id']}},_0x5ceb6b={};_0x5ceb6b[_0xd6f0('0x42')]=_['keys'](db[_0xd6f0('0x3e')]['rawAttributes']);_0x5ceb6b[_0xd6f0('0x43')]=_[_0xd6f0('0x44')](_0x2eb338[_0xd6f0('0x43')]);_0x5ceb6b[_0xd6f0('0x45')]=_[_0xd6f0('0x46')](_0x5ceb6b['model'],_0x5ceb6b[_0xd6f0('0x43')]);_0x554e37[_0xd6f0('0x48')]=_[_0xd6f0('0x46')](_0x5ceb6b[_0xd6f0('0x42')],qs[_0xd6f0('0x47')](_0x2eb338[_0xd6f0('0x43')][_0xd6f0('0x47')]));_0x554e37[_0xd6f0('0x48')]=_0x554e37['attributes'][_0xd6f0('0x49')]?_0x554e37[_0xd6f0('0x48')]:_0x5ceb6b[_0xd6f0('0x42')];if(_0x2eb338[_0xd6f0('0x43')][_0xd6f0('0x53')]){_0x554e37[_0xd6f0('0x54')]=[{'all':!![]}];}_0x554e37=_[_0xd6f0('0x50')]({},_0x554e37,_0x2eb338[_0xd6f0('0x52')]);return db[_0xd6f0('0x3e')]['find'](_0x554e37)[_0xd6f0('0x1c')](handleEntityNotFound(_0x1dc320,null))['then'](respondWithResult(_0x1dc320,null))['catch'](handleError(_0x1dc320,null));};exports[_0xd6f0('0x59')]=function(_0x55fd25,_0x539ef1){var _0x28c3c4={'where':{'id':_0x55fd25[_0xd6f0('0x58')]['id']}},_0x2d39a2={};_0x2d39a2['model']=_[_0xd6f0('0x44')](db[_0xd6f0('0x3e')][_0xd6f0('0x5a')]);_0x28c3c4['attributes']=_[_0xd6f0('0x46')](_0x2d39a2[_0xd6f0('0x42')],qs['fields'](_0x55fd25[_0xd6f0('0x43')][_0xd6f0('0x47')]));_0x28c3c4['attributes']=_0x28c3c4[_0xd6f0('0x48')][_0xd6f0('0x49')]?_0x28c3c4[_0xd6f0('0x48')]:_0x2d39a2[_0xd6f0('0x42')];if(_0x55fd25[_0xd6f0('0x43')]['includeAll']){_0x28c3c4[_0xd6f0('0x54')]=[{'all':!![]}];}_0x28c3c4=_[_0xd6f0('0x50')]({},_0x28c3c4,_0x55fd25['options']);return db[_0xd6f0('0x3e')][_0xd6f0('0x5b')](_0x28c3c4)[_0xd6f0('0x1c')](handleEntityNotFound(_0x539ef1,null))['then'](function(_0x229f19){if(_0x229f19){var _0x5d75fa=_0x229f19['get']({'plain':!![]});_0x5d75fa=qs['omit'](_0x5d75fa,['id','createdAt',_0xd6f0('0x5c')]);_0x55fd25[_0xd6f0('0x5d')]=_[_0xd6f0('0x5e')](_0x55fd25[_0xd6f0('0x5d')],['id','createdAt',_0xd6f0('0x5c')]);return db['Trunk'][_0xd6f0('0x5f')](_[_0xd6f0('0x50')](_0x5d75fa,_0x55fd25[_0xd6f0('0x5d')]),{'include':_0x55fd25['query'][_0xd6f0('0x53')]?[{'all':!![]}]:undefined})[_0xd6f0('0x1c')](function(_0x269dd7){var _0x705eb=_0x55fd25['user'][_0xd6f0('0x35')]({'plain':!![]});if(!_0x705eb)throw new Error(_0xd6f0('0x60'));if(_0x705eb[_0xd6f0('0x61')]==='user'){var _0x5bc4e7=_0x269dd7[_0xd6f0('0x35')]({'plain':!![]});var _0x1fee47=_0xd6f0('0x36');return db['UserProfileSection'][_0xd6f0('0x5b')]({'where':{'name':_0x1fee47,'userProfileId':_0x705eb[_0xd6f0('0x62')]},'raw':!![]})[_0xd6f0('0x1c')](function(_0x282e9b){if(_0x282e9b&&_0x282e9b['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x5bc4e7['name'],'resourceId':_0x5bc4e7['id'],'type':_0x282e9b[_0xd6f0('0x3a')],'sectionId':_0x282e9b['id']},{})[_0xd6f0('0x1c')](function(){return _0x269dd7;});}else{return _0x269dd7;}})[_0xd6f0('0x27')](function(_0x30cd81){logger[_0xd6f0('0x23')](_0xd6f0('0x63'),_0x30cd81);throw _0x30cd81;});}return _0x269dd7;});}})[_0xd6f0('0x1c')](respondWithResult(_0x539ef1,0xc9))[_0xd6f0('0x27')](handleError(_0x539ef1,null));};exports[_0xd6f0('0x5f')]=function(_0x5ad146,_0x55f96e,_0x1b9728){var _0x5af4f6;return db[_0xd6f0('0x3e')][_0xd6f0('0x5f')](_0x5ad146[_0xd6f0('0x5d')],{'raw':!![]})[_0xd6f0('0x1c')](function(_0x14384f){_0x5af4f6=_0x14384f;return db[_0xd6f0('0x3e')][_0xd6f0('0x55')]({'raw':!![]});})['then'](function(_0x3c8a3e){var _0x318a68=fs[_0xd6f0('0x64')](path['join'](config[_0xd6f0('0x65')],_0xd6f0('0x66')),'utf8');var _0xad50ac=fs[_0xd6f0('0x64')](path[_0xd6f0('0x67')](config[_0xd6f0('0x65')],_0xd6f0('0x68')),_0xd6f0('0x69'));var _0x1c6140=ejs[_0xd6f0('0x6a')](_0x318a68,{'trunks':_0x3c8a3e||[]});fs[_0xd6f0('0x6b')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1c6140);if(_0x5af4f6[_0xd6f0('0x6c')]){var _0x205b6a=ejs[_0xd6f0('0x6a')](_0xad50ac,{'trunks':_0x3c8a3e||[]});fs[_0xd6f0('0x6b')]('/etc/asterisk/sip_xcally_registers.conf',_0x205b6a);}})[_0xd6f0('0x1c')](function(){return respondWithRpcPromise(_0xd6f0('0x6d'),_0xd6f0('0x5f'),{'module':_0xd6f0('0x6e')});})[_0xd6f0('0x1c')](function(){var _0x12e0e5=_0x5ad146[_0xd6f0('0x6f')][_0xd6f0('0x35')]({'plain':!![]});if(!_0x12e0e5)throw new Error(_0xd6f0('0x60'));if(_0x12e0e5[_0xd6f0('0x61')]==='user'){var _0x440d5c=_0x5af4f6[_0xd6f0('0x35')]({'plain':!![]});return db[_0xd6f0('0x70')]['find']({'where':{'name':_0xd6f0('0x36'),'userProfileId':_0x12e0e5[_0xd6f0('0x62')]},'raw':!![]})[_0xd6f0('0x1c')](function(_0x406bc7){if(_0x406bc7&&_0x406bc7[_0xd6f0('0x71')]===0x0){return db[_0xd6f0('0x37')][_0xd6f0('0x5f')]({'name':_0x440d5c[_0xd6f0('0x3a')],'resourceId':_0x440d5c['id'],'type':_0x406bc7[_0xd6f0('0x3a')],'sectionId':_0x406bc7['id']},{})[_0xd6f0('0x1c')](function(){return _0x5af4f6;});}else{return _0x5af4f6;}})[_0xd6f0('0x27')](function(_0x5b3155){logger['error'](_0xd6f0('0x63'),_0x5b3155);throw _0x5b3155;});}return _0x5af4f6;})[_0xd6f0('0x1c')](respondWithResult(_0x55f96e,0xc9))[_0xd6f0('0x27')](handleError(_0x55f96e,null));};exports[_0xd6f0('0x34')]=function(_0x1da442,_0x5a781b,_0x15143a){var _0x2d38e6;return db['Trunk'][_0xd6f0('0x5b')]({'where':{'id':_0x1da442['params']['id']}})[_0xd6f0('0x1c')](handleEntityNotFound(_0x5a781b,null))[_0xd6f0('0x1c')](saveUpdates(_0x1da442[_0xd6f0('0x5d')],null))[_0xd6f0('0x1c')](function(_0x391c2a){if(_0x391c2a){_0x2d38e6=_0x391c2a;return db['Trunk']['findAll']({'raw':!![]});}})[_0xd6f0('0x1c')](function(_0x17b320){if(_0x17b320){var _0x484124=fs[_0xd6f0('0x64')](path['join'](config['root'],_0xd6f0('0x66')),'utf8');var _0x5dc1c7=fs['readFileSync'](path['join'](config[_0xd6f0('0x65')],_0xd6f0('0x68')),_0xd6f0('0x69'));var _0xcfed18=ejs[_0xd6f0('0x6a')](_0x484124,{'trunks':_0x17b320||[]});fs[_0xd6f0('0x6b')](_0xd6f0('0x72'),_0xcfed18);var _0x381f88=ejs[_0xd6f0('0x6a')](_0x5dc1c7,{'trunks':_0x17b320||[]});fs['writeFileSync'](_0xd6f0('0x73'),_0x381f88);return respondWithRpcPromise('Reload','update',{'module':_0xd6f0('0x6e')});}return null;})[_0xd6f0('0x1c')](function(_0x397f2c){if(_0x397f2c){return _0x2d38e6;}})['then'](respondWithResult(_0x5a781b,null))[_0xd6f0('0x27')](handleError(_0x5a781b,null));};exports[_0xd6f0('0x74')]=function(_0xc0585c,_0xf7ade1,_0x41e738){var _0x202e37;return db[_0xd6f0('0x3e')][_0xd6f0('0x5b')]({'where':{'id':_0xc0585c['params']['id']}})[_0xd6f0('0x1c')](handleEntityNotFound(_0xf7ade1,null))[_0xd6f0('0x1c')](removeEntity(_0xf7ade1,null))['then'](function(){return db[_0xd6f0('0x3e')][_0xd6f0('0x55')]({'raw':!![]});})[_0xd6f0('0x1c')](function(_0x175ba6){var _0x403698=fs[_0xd6f0('0x64')](path[_0xd6f0('0x67')](config['root'],_0xd6f0('0x66')),_0xd6f0('0x69'));var _0x5c3659=fs['readFileSync'](path['join'](config['root'],_0xd6f0('0x68')),_0xd6f0('0x69'));var _0x2fdd59=ejs[_0xd6f0('0x6a')](_0x403698,{'trunks':_0x175ba6});var _0x427b95=ejs[_0xd6f0('0x6a')](_0x5c3659,{'trunks':_0x175ba6});fs['writeFileSync'](_0xd6f0('0x72'),_0x2fdd59);fs[_0xd6f0('0x6b')](_0xd6f0('0x73'),_0x427b95);return respondWithRpcPromise(_0xd6f0('0x6d'),'destroy',{'module':_0xd6f0('0x6e')});})['catch'](handleError(_0xf7ade1,null));}; \ No newline at end of file +var _0xedd9=['body','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','create','readFileSync','join','root','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Trunk,\x20%s,\x20%s','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','get','Trunks','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','Trunk','findAll','rows','show','params','length','find','omit'];(function(_0x464f75,_0x235716){var _0x123e87=function(_0x2a6cd8){while(--_0x2a6cd8){_0x464f75['push'](_0x464f75['shift']());}};_0x123e87(++_0x235716);}(_0xedd9,0xfc));var _0x9edd=function(_0x304375,_0x449e28){_0x304375=_0x304375-0x0;var _0x16e11e=_0xedd9[_0x304375];return _0x16e11e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];var jayson=require(_0x9edd('0x18'));var client=jayson[_0x9edd('0x19')][_0x9edd('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xfca576,_0xef5498,_0x47eb64,_0x176bfa){return new BPromise(function(_0x44fc7c,_0x891832){var _0x4d9a7=_0x176bfa||client;return _0x4d9a7[_0x9edd('0x1b')](_0xfca576,_0x47eb64)[_0x9edd('0x1c')](function(_0x1042aa){logger[_0x9edd('0x1d')]('Trunk,\x20%s,\x20%s',_0xef5498,_0x9edd('0x1e'));logger[_0x9edd('0x1f')](_0x9edd('0x20'),_0xef5498,'request\x20sent',JSON[_0x9edd('0x21')](_0x1042aa));if(_0x1042aa[_0x9edd('0x22')]){if(_0x1042aa[_0x9edd('0x22')]['code']===0x1f4){logger[_0x9edd('0x22')]('Trunk,\x20%s,\x20%s',_0xef5498,_0x1042aa[_0x9edd('0x22')][_0x9edd('0x23')]);return _0x891832(_0x1042aa['error']['message']);}logger[_0x9edd('0x22')]('Trunk,\x20%s,\x20%s',_0xef5498,_0x1042aa[_0x9edd('0x22')]['message']);return _0x44fc7c(_0x1042aa['error'][_0x9edd('0x23')]);}else{logger[_0x9edd('0x1d')]('Trunk,\x20%s,\x20%s',_0xef5498,'request\x20sent');_0x44fc7c(_0x1042aa[_0x9edd('0x24')][_0x9edd('0x23')]);}})[_0x9edd('0x25')](function(_0x542172){logger[_0x9edd('0x22')](_0x9edd('0x26'),_0xef5498,_0x542172);_0x891832(_0x542172);});});}function respondWithStatusCode(_0x44a6c1,_0x2ca65f){_0x2ca65f=_0x2ca65f||0xcc;return function(_0x339a0d){if(_0x339a0d){return _0x44a6c1['sendStatus'](_0x2ca65f);}return _0x44a6c1[_0x9edd('0x27')](_0x2ca65f)[_0x9edd('0x28')]();};}function respondWithResult(_0x3a1ea5,_0x2f9f86){_0x2f9f86=_0x2f9f86||0xc8;return function(_0x310a4d){if(_0x310a4d){return _0x3a1ea5['status'](_0x2f9f86)['json'](_0x310a4d);}};}function respondWithFilteredResult(_0x3276ee,_0xfeca7b){return function(_0x8d67aa){if(_0x8d67aa){var _0x25e135=typeof _0xfeca7b[_0x9edd('0x29')]==='undefined'&&typeof _0xfeca7b['limit']===_0x9edd('0x2a');var _0x257a26=_0x8d67aa[_0x9edd('0x2b')];var _0x52746a=_0x25e135?0x0:_0xfeca7b[_0x9edd('0x29')];var _0x28cfae=_0x25e135?_0x8d67aa[_0x9edd('0x2b')]:_0xfeca7b[_0x9edd('0x29')]+_0xfeca7b['limit'];var _0x2155a1;if(_0x28cfae>=_0x257a26){_0x28cfae=_0x257a26;_0x2155a1=0xc8;}else{_0x2155a1=0xce;}_0x3276ee[_0x9edd('0x27')](_0x2155a1);return _0x3276ee[_0x9edd('0x2c')](_0x9edd('0x2d'),_0x52746a+'-'+_0x28cfae+'/'+_0x257a26)[_0x9edd('0x2e')](_0x8d67aa);}return null;};}function patchUpdates(_0x42e664){return function(_0x209aba){try{jsonpatch[_0x9edd('0x2f')](_0x209aba,_0x42e664,!![]);}catch(_0x19b6c1){return BPromise[_0x9edd('0x30')](_0x19b6c1);}return _0x209aba[_0x9edd('0x31')]();};}function saveUpdates(_0x138002,_0x6907a5){return function(_0xa55906){if(_0xa55906){return _0xa55906[_0x9edd('0x32')](_0x138002)['then'](function(_0x1453d2){return _0x1453d2;});}return null;};}function removeEntity(_0x259259,_0x267c74){return function(_0x5d1707){if(_0x5d1707){return _0x5d1707[_0x9edd('0x33')]()[_0x9edd('0x1c')](function(){var _0xde9b13=_0x5d1707[_0x9edd('0x34')]({'plain':!![]});var _0x21bc30=_0x9edd('0x35');return db[_0x9edd('0x36')][_0x9edd('0x33')]({'where':{'type':_0x21bc30,'resourceId':_0xde9b13['id']}})[_0x9edd('0x1c')](function(){return _0x5d1707;});})[_0x9edd('0x1c')](function(){_0x259259[_0x9edd('0x27')](0xcc)[_0x9edd('0x28')]();});}};}function handleEntityNotFound(_0x27eb7e,_0x14f780){return function(_0x5757fc){if(!_0x5757fc){_0x27eb7e[_0x9edd('0x37')](0x194);}return _0x5757fc;};}function handleError(_0x5ed62d,_0x968303){_0x968303=_0x968303||0x1f4;return function(_0x148630){logger[_0x9edd('0x22')](_0x148630[_0x9edd('0x38')]);if(_0x148630[_0x9edd('0x39')]){delete _0x148630['name'];}_0x5ed62d[_0x9edd('0x27')](_0x968303)[_0x9edd('0x3a')](_0x148630);};}exports[_0x9edd('0x3b')]=function(_0x38e9be,_0x1be77f){var _0x337e6c={},_0x5c0627={},_0x1cbbac={'count':0x0,'rows':[]};var _0x1ccee8=_[_0x9edd('0x3c')](db['Trunk'][_0x9edd('0x3d')],function(_0x56a228){return{'name':_0x56a228[_0x9edd('0x3e')],'type':_0x56a228['type'][_0x9edd('0x3f')]};});_0x5c0627[_0x9edd('0x40')]=_[_0x9edd('0x3c')](_0x1ccee8,'name');_0x5c0627[_0x9edd('0x41')]=_[_0x9edd('0x42')](_0x38e9be[_0x9edd('0x41')]);_0x5c0627['filters']=_[_0x9edd('0x43')](_0x5c0627['model'],_0x5c0627[_0x9edd('0x41')]);_0x337e6c[_0x9edd('0x44')]=_['intersection'](_0x5c0627[_0x9edd('0x40')],qs[_0x9edd('0x45')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x45')]));_0x337e6c['attributes']=_0x337e6c[_0x9edd('0x44')]['length']?_0x337e6c[_0x9edd('0x44')]:_0x5c0627[_0x9edd('0x40')];if(!_0x38e9be['query'][_0x9edd('0x46')]('nolimit')){_0x337e6c['limit']=qs[_0x9edd('0x47')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x47')]);_0x337e6c[_0x9edd('0x29')]=qs[_0x9edd('0x29')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x29')]);}_0x337e6c[_0x9edd('0x48')]=qs[_0x9edd('0x49')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x49')]);_0x337e6c[_0x9edd('0x4a')]=qs[_0x9edd('0x4b')](_[_0x9edd('0x4c')](_0x38e9be[_0x9edd('0x41')],_0x5c0627['filters']),_0x1ccee8);if(_0x38e9be[_0x9edd('0x41')][_0x9edd('0x4d')]){_0x337e6c[_0x9edd('0x4a')]=_[_0x9edd('0x4e')](_0x337e6c[_0x9edd('0x4a')],{'$or':_[_0x9edd('0x3c')](_0x1ccee8,function(_0x10d41e){if(_0x10d41e['type']!=='VIRTUAL'){var _0x4bc7a1={};_0x4bc7a1[_0x10d41e[_0x9edd('0x39')]]={'$like':'%'+_0x38e9be['query'][_0x9edd('0x4d')]+'%'};return _0x4bc7a1;}})});}_0x337e6c=_[_0x9edd('0x4e')]({},_0x337e6c,_0x38e9be[_0x9edd('0x4f')]);var _0x8db801={'where':_0x337e6c[_0x9edd('0x4a')]};return db['Trunk'][_0x9edd('0x2b')](_0x8db801)[_0x9edd('0x1c')](function(_0x40e33d){_0x1cbbac['count']=_0x40e33d;if(_0x38e9be[_0x9edd('0x41')][_0x9edd('0x50')]){_0x337e6c[_0x9edd('0x51')]=[{'all':!![]}];}return db[_0x9edd('0x52')][_0x9edd('0x53')](_0x337e6c);})[_0x9edd('0x1c')](function(_0x4d4f33){_0x1cbbac[_0x9edd('0x54')]=_0x4d4f33;return _0x1cbbac;})[_0x9edd('0x1c')](respondWithFilteredResult(_0x1be77f,_0x337e6c))['catch'](handleError(_0x1be77f,null));};exports[_0x9edd('0x55')]=function(_0x8d8701,_0x4bb324){var _0x2bd089={'raw':![],'where':{'id':_0x8d8701[_0x9edd('0x56')]['id']}},_0x8134cd={};_0x8134cd['model']=_[_0x9edd('0x42')](db[_0x9edd('0x52')][_0x9edd('0x3d')]);_0x8134cd[_0x9edd('0x41')]=_['keys'](_0x8d8701[_0x9edd('0x41')]);_0x8134cd[_0x9edd('0x4b')]=_[_0x9edd('0x43')](_0x8134cd['model'],_0x8134cd[_0x9edd('0x41')]);_0x2bd089[_0x9edd('0x44')]=_['intersection'](_0x8134cd[_0x9edd('0x40')],qs['fields'](_0x8d8701[_0x9edd('0x41')][_0x9edd('0x45')]));_0x2bd089[_0x9edd('0x44')]=_0x2bd089[_0x9edd('0x44')][_0x9edd('0x57')]?_0x2bd089[_0x9edd('0x44')]:_0x8134cd[_0x9edd('0x40')];if(_0x8d8701[_0x9edd('0x41')][_0x9edd('0x50')]){_0x2bd089[_0x9edd('0x51')]=[{'all':!![]}];}_0x2bd089=_[_0x9edd('0x4e')]({},_0x2bd089,_0x8d8701['options']);return db[_0x9edd('0x52')][_0x9edd('0x58')](_0x2bd089)[_0x9edd('0x1c')](handleEntityNotFound(_0x4bb324,null))['then'](respondWithResult(_0x4bb324,null))[_0x9edd('0x25')](handleError(_0x4bb324,null));};exports['clone']=function(_0x54d83d,_0x54ecfa){var _0x1348a7={'where':{'id':_0x54d83d[_0x9edd('0x56')]['id']}},_0x45f47c={};_0x45f47c[_0x9edd('0x40')]=_['keys'](db['Trunk']['rawAttributes']);_0x1348a7[_0x9edd('0x44')]=_[_0x9edd('0x43')](_0x45f47c[_0x9edd('0x40')],qs[_0x9edd('0x45')](_0x54d83d[_0x9edd('0x41')][_0x9edd('0x45')]));_0x1348a7[_0x9edd('0x44')]=_0x1348a7[_0x9edd('0x44')]['length']?_0x1348a7[_0x9edd('0x44')]:_0x45f47c['model'];if(_0x54d83d[_0x9edd('0x41')][_0x9edd('0x50')]){_0x1348a7['include']=[{'all':!![]}];}_0x1348a7=_[_0x9edd('0x4e')]({},_0x1348a7,_0x54d83d[_0x9edd('0x4f')]);return db[_0x9edd('0x52')]['find'](_0x1348a7)[_0x9edd('0x1c')](handleEntityNotFound(_0x54ecfa,null))[_0x9edd('0x1c')](function(_0x430eb4){if(_0x430eb4){var _0x15ebfa=_0x430eb4[_0x9edd('0x34')]({'plain':!![]});_0x15ebfa=qs[_0x9edd('0x59')](_0x15ebfa,['id','createdAt','updatedAt']);_0x54d83d[_0x9edd('0x5a')]=_['omit'](_0x54d83d[_0x9edd('0x5a')],['id',_0x9edd('0x5b'),_0x9edd('0x5c')]);return db[_0x9edd('0x52')]['create'](_[_0x9edd('0x4e')](_0x15ebfa,_0x54d83d['body']),{'include':_0x54d83d[_0x9edd('0x41')][_0x9edd('0x50')]?[{'all':!![]}]:undefined})[_0x9edd('0x1c')](function(_0x5ca123){var _0x2651a2=_0x54d83d['user'][_0x9edd('0x34')]({'plain':!![]});if(!_0x2651a2)throw new Error(_0x9edd('0x5d'));if(_0x2651a2['role']===_0x9edd('0x5e')){var _0x4a72d0=_0x5ca123[_0x9edd('0x34')]({'plain':!![]});var _0x134c9c=_0x9edd('0x35');return db['UserProfileSection'][_0x9edd('0x58')]({'where':{'name':_0x134c9c,'userProfileId':_0x2651a2[_0x9edd('0x5f')]},'raw':!![]})[_0x9edd('0x1c')](function(_0x2015fc){if(_0x2015fc&&_0x2015fc[_0x9edd('0x60')]===0x0){return db['UserProfileResource']['create']({'name':_0x4a72d0[_0x9edd('0x39')],'resourceId':_0x4a72d0['id'],'type':_0x2015fc[_0x9edd('0x39')],'sectionId':_0x2015fc['id']},{})['then'](function(){return _0x5ca123;});}else{return _0x5ca123;}})['catch'](function(_0x52afd7){logger[_0x9edd('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x52afd7);throw _0x52afd7;});}return _0x5ca123;});}})['then'](respondWithResult(_0x54ecfa,0xc9))[_0x9edd('0x25')](handleError(_0x54ecfa,null));};exports[_0x9edd('0x61')]=function(_0x589348,_0xb9ebeb,_0x11e082){var _0x34dff5;return db['Trunk'][_0x9edd('0x61')](_0x589348['body'],{'raw':!![]})[_0x9edd('0x1c')](function(_0x18d1a0){_0x34dff5=_0x18d1a0;return db['Trunk'][_0x9edd('0x53')]({'raw':!![]});})[_0x9edd('0x1c')](function(_0x5c1746){var _0x2bd6d1=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],'server/files/templates/trunk.ejs'),_0x9edd('0x65'));var _0x58330c=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],'server/files/templates/registry.ejs'),_0x9edd('0x65'));var _0x286593=ejs[_0x9edd('0x66')](_0x2bd6d1,{'trunks':_0x5c1746||[]});fs[_0x9edd('0x67')](_0x9edd('0x68'),_0x286593);if(_0x34dff5[_0x9edd('0x69')]){var _0x3fa4a9=ejs['render'](_0x58330c,{'trunks':_0x5c1746||[]});fs['writeFileSync'](_0x9edd('0x6a'),_0x3fa4a9);}})[_0x9edd('0x1c')](function(){return respondWithRpcPromise(_0x9edd('0x6b'),_0x9edd('0x61'),{'module':_0x9edd('0x6c')});})['then'](function(){var _0x2e40c8=_0x589348[_0x9edd('0x5e')][_0x9edd('0x34')]({'plain':!![]});if(!_0x2e40c8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e40c8[_0x9edd('0x6d')]===_0x9edd('0x5e')){var _0x4b1c12=_0x34dff5[_0x9edd('0x34')]({'plain':!![]});return db[_0x9edd('0x6e')]['find']({'where':{'name':_0x9edd('0x35'),'userProfileId':_0x2e40c8[_0x9edd('0x5f')]},'raw':!![]})['then'](function(_0x3f08ac){if(_0x3f08ac&&_0x3f08ac['autoAssociation']===0x0){return db['UserProfileResource'][_0x9edd('0x61')]({'name':_0x4b1c12[_0x9edd('0x39')],'resourceId':_0x4b1c12['id'],'type':_0x3f08ac[_0x9edd('0x39')],'sectionId':_0x3f08ac['id']},{})['then'](function(){return _0x34dff5;});}else{return _0x34dff5;}})[_0x9edd('0x25')](function(_0x286e47){logger['error'](_0x9edd('0x6f'),_0x286e47);throw _0x286e47;});}return _0x34dff5;})[_0x9edd('0x1c')](respondWithResult(_0xb9ebeb,0xc9))[_0x9edd('0x25')](handleError(_0xb9ebeb,null));};exports[_0x9edd('0x32')]=function(_0x54ac71,_0x5e68db,_0x1129b7){var _0x5bb28c;return db[_0x9edd('0x52')][_0x9edd('0x58')]({'where':{'id':_0x54ac71[_0x9edd('0x56')]['id']}})[_0x9edd('0x1c')](handleEntityNotFound(_0x5e68db,null))[_0x9edd('0x1c')](saveUpdates(_0x54ac71[_0x9edd('0x5a')],null))[_0x9edd('0x1c')](function(_0x5a4d4b){if(_0x5a4d4b){_0x5bb28c=_0x5a4d4b;return db[_0x9edd('0x52')]['findAll']({'raw':!![]});}})[_0x9edd('0x1c')](function(_0x3c4db7){if(_0x3c4db7){var _0x2c7562=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],_0x9edd('0x70')),'utf8');var _0x25e3e7=fs[_0x9edd('0x62')](path['join'](config[_0x9edd('0x64')],_0x9edd('0x71')),'utf8');var _0x304e56=ejs[_0x9edd('0x66')](_0x2c7562,{'trunks':_0x3c4db7||[]});fs[_0x9edd('0x67')]('/etc/asterisk/sip_xcally_trunks.conf',_0x304e56);var _0x41cd76=ejs[_0x9edd('0x66')](_0x25e3e7,{'trunks':_0x3c4db7||[]});fs[_0x9edd('0x67')]('/etc/asterisk/sip_xcally_registers.conf',_0x41cd76);return respondWithRpcPromise('Reload','update',{'module':'chan_sip.so'});}return null;})[_0x9edd('0x1c')](function(_0x1a6d3d){if(_0x1a6d3d){return _0x5bb28c;}})[_0x9edd('0x1c')](respondWithResult(_0x5e68db,null))['catch'](handleError(_0x5e68db,null));};exports['destroy']=function(_0x49dc1d,_0x56d794,_0x388252){var _0x20762d;return db[_0x9edd('0x52')][_0x9edd('0x58')]({'where':{'id':_0x49dc1d[_0x9edd('0x56')]['id']}})[_0x9edd('0x1c')](handleEntityNotFound(_0x56d794,null))[_0x9edd('0x1c')](removeEntity(_0x56d794,null))[_0x9edd('0x1c')](function(){return db[_0x9edd('0x52')][_0x9edd('0x53')]({'raw':!![]});})[_0x9edd('0x1c')](function(_0x4cfa99){var _0x367fc6=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],_0x9edd('0x70')),_0x9edd('0x65'));var _0x3d4890=fs[_0x9edd('0x62')](path['join'](config['root'],_0x9edd('0x71')),'utf8');var _0x35950b=ejs['render'](_0x367fc6,{'trunks':_0x4cfa99});var _0x21c35f=ejs[_0x9edd('0x66')](_0x3d4890,{'trunks':_0x4cfa99});fs['writeFileSync'](_0x9edd('0x68'),_0x35950b);fs[_0x9edd('0x67')]('/etc/asterisk/sip_xcally_registers.conf',_0x21c35f);return respondWithRpcPromise(_0x9edd('0x6b'),_0x9edd('0x33'),{'module':_0x9edd('0x6c')});})[_0x9edd('0x25')](handleError(_0x56d794,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 5b85373..e5f2eab 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 _0x06fc=['../../config/logger','api','moment','bluebird','path','rimraf','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x06fc,0x177));var _0xc06f=function(_0x102ad5,_0x464d8c){_0x102ad5=_0x102ad5-0x0;var _0x2521e8=_0x06fc[_0x102ad5];return _0x2521e8;};'use strict';var _=require(_0xc06f('0x0'));var util=require(_0xc06f('0x1'));var logger=require(_0xc06f('0x2'))(_0xc06f('0x3'));var moment=require(_0xc06f('0x4'));var BPromise=require(_0xc06f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc06f('0x6'));var rimraf=require(_0xc06f('0x7'));var config=require('../../config/environment');var attributes=require(_0xc06f('0x8'));module[_0xc06f('0x9')]=function(_0x4fa2cc,_0x535560){return _0x4fa2cc[_0xc06f('0xa')](_0xc06f('0xb'),attributes,{'tableName':_0xc06f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b74=['define','Trunk','tools_trunks','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b74,0xdb));var _0x44b7=function(_0x522093,_0x3a8640){_0x522093=_0x522093-0x0;var _0x261b49=_0x4b74[_0x522093];return _0x261b49;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x44b7('0x0'))(_0x44b7('0x1'));var moment=require(_0x44b7('0x2'));var BPromise=require(_0x44b7('0x3'));var rp=require(_0x44b7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x44b7('0x5'));var attributes=require('./trunk.attributes');module['exports']=function(_0x3de904,_0x3a2b7e){return _0x3de904[_0x44b7('0x6')](_0x44b7('0x7'),attributes,{'tableName':_0x44b7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 983714d..4f817d2 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 _0x5eff=['model','attributes','ShowTrunk','find','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetTrunk','findAll','options','where','limit','include','map'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x5eff,0x1da));var _0xf5ef=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x5eff[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0xf5ef('0x0'));var util=require(_0xf5ef('0x1'));var moment=require(_0xf5ef('0x2'));var BPromise=require(_0xf5ef('0x3'));var rs=require(_0xf5ef('0x4'));var fs=require('fs');var Redis=require(_0xf5ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf5ef('0x6'));var logger=require(_0xf5ef('0x7'))(_0xf5ef('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf5ef('0x9')][_0xf5ef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x470439,_0x2b4a42,_0x5b02eb){return new BPromise(function(_0x279807,_0x1b0cd6){return client[_0xf5ef('0xb')](_0x470439,_0x5b02eb)[_0xf5ef('0xc')](function(_0x162c74){logger[_0xf5ef('0xd')](_0xf5ef('0xe'),_0x2b4a42,_0xf5ef('0xf'));logger[_0xf5ef('0x10')](_0xf5ef('0x11'),_0x2b4a42,_0xf5ef('0xf'),JSON['stringify'](_0x162c74));if(_0x162c74[_0xf5ef('0x12')]){if(_0x162c74[_0xf5ef('0x12')][_0xf5ef('0x13')]===0x1f4){logger[_0xf5ef('0x12')]('Trunk,\x20%s,\x20%s',_0x2b4a42,_0x162c74['error']['message']);return _0x1b0cd6(_0x162c74['error'][_0xf5ef('0x14')]);}logger[_0xf5ef('0x12')]('Trunk,\x20%s,\x20%s',_0x2b4a42,_0x162c74['error'][_0xf5ef('0x14')]);return _0x279807(_0x162c74[_0xf5ef('0x12')]['message']);}else{logger[_0xf5ef('0xd')](_0xf5ef('0xe'),_0x2b4a42,_0xf5ef('0xf'));_0x279807(_0x162c74[_0xf5ef('0x15')][_0xf5ef('0x14')]);}})[_0xf5ef('0x16')](function(_0x145f9f){logger['error'](_0xf5ef('0xe'),_0x2b4a42,_0x145f9f);_0x1b0cd6(_0x145f9f);});});}exports[_0xf5ef('0x17')]=function(_0x29458e){var _0x1f3252=this;return new Promise(function(_0x354ef4,_0x362003){return db['Trunk'][_0xf5ef('0x18')]({'raw':_0x29458e[_0xf5ef('0x19')]?_0x29458e[_0xf5ef('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x29458e[_0xf5ef('0x19')]?_0x29458e[_0xf5ef('0x19')][_0xf5ef('0x1a')]||null:null,'attributes':_0x29458e[_0xf5ef('0x19')]?_0x29458e[_0xf5ef('0x19')]['attributes']||null:null,'limit':_0x29458e['options']?_0x29458e[_0xf5ef('0x19')][_0xf5ef('0x1b')]||null:null,'include':_0x29458e['options']?_0x29458e[_0xf5ef('0x19')][_0xf5ef('0x1c')]?_[_0xf5ef('0x1d')](_0x29458e[_0xf5ef('0x19')]['include'],function(_0x417d05){return{'model':db[_0x417d05[_0xf5ef('0x1e')]],'as':_0x417d05['as'],'attributes':_0x417d05[_0xf5ef('0x1f')],'include':_0x417d05['include']?_[_0xf5ef('0x1d')](_0x417d05[_0xf5ef('0x1c')],function(_0x1dccf6){return{'model':db[_0x1dccf6[_0xf5ef('0x1e')]],'as':_0x1dccf6['as'],'attributes':_0x1dccf6[_0xf5ef('0x1f')],'include':_0x1dccf6[_0xf5ef('0x1c')]?_[_0xf5ef('0x1d')](_0x1dccf6[_0xf5ef('0x1c')],function(_0x57474e){return{'model':db[_0x57474e[_0xf5ef('0x1e')]],'as':_0x57474e['as'],'attributes':_0x57474e['attributes']};}):[]};}):[]};}):[]:[]})[_0xf5ef('0xc')](function(_0x5bb8bd){logger[_0xf5ef('0xd')](_0xf5ef('0x17'),_0x29458e);logger[_0xf5ef('0x10')]('GetTrunk',_0x29458e,JSON['stringify'](_0x5bb8bd));_0x354ef4(_0x5bb8bd);})[_0xf5ef('0x16')](function(_0x17a2f3){logger[_0xf5ef('0x12')](_0xf5ef('0x17'),_0x17a2f3['message'],_0x29458e);_0x362003(_0x1f3252[_0xf5ef('0x12')](0x1f4,_0x17a2f3[_0xf5ef('0x14')]));});});};exports[_0xf5ef('0x20')]=function(_0x2ac55a){var _0x5c5eff=this;return new Promise(function(_0x52c46e,_0x159a0f){return db['Trunk'][_0xf5ef('0x21')]({'raw':_0x2ac55a[_0xf5ef('0x19')]?_0x2ac55a[_0xf5ef('0x19')][_0xf5ef('0x22')]===undefined?!![]:![]:!![],'where':_0x2ac55a['options']?_0x2ac55a[_0xf5ef('0x19')]['where']||null:null,'attributes':_0x2ac55a[_0xf5ef('0x19')]?_0x2ac55a[_0xf5ef('0x19')][_0xf5ef('0x1f')]||null:null,'include':_0x2ac55a[_0xf5ef('0x19')]?_0x2ac55a['options'][_0xf5ef('0x1c')]?_[_0xf5ef('0x1d')](_0x2ac55a[_0xf5ef('0x19')][_0xf5ef('0x1c')],function(_0x28ccb0){return{'model':db[_0x28ccb0['model']],'as':_0x28ccb0['as'],'attributes':_0x28ccb0[_0xf5ef('0x1f')],'include':_0x28ccb0['include']?_['map'](_0x28ccb0[_0xf5ef('0x1c')],function(_0x10b38a){return{'model':db[_0x10b38a[_0xf5ef('0x1e')]],'as':_0x10b38a['as'],'attributes':_0x10b38a[_0xf5ef('0x1f')],'include':_0x10b38a[_0xf5ef('0x1c')]?_[_0xf5ef('0x1d')](_0x10b38a[_0xf5ef('0x1c')],function(_0xe70bbe){return{'model':db[_0xe70bbe[_0xf5ef('0x1e')]],'as':_0xe70bbe['as'],'attributes':_0xe70bbe[_0xf5ef('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf5ef('0xc')](function(_0x5ea6e5){logger[_0xf5ef('0xd')](_0xf5ef('0x20'),_0x2ac55a);logger[_0xf5ef('0x10')](_0xf5ef('0x20'),_0x2ac55a,JSON[_0xf5ef('0x23')](_0x5ea6e5));_0x52c46e(_0x5ea6e5);})['catch'](function(_0x46dfa3){logger[_0xf5ef('0x12')](_0xf5ef('0x20'),_0x46dfa3[_0xf5ef('0x14')],_0x2ac55a);_0x159a0f(_0x5c5eff[_0xf5ef('0x12')](0x1f4,_0x46dfa3[_0xf5ef('0x14')]));});});}; \ No newline at end of file +var _0xf3dc=['include','map','ShowTrunk','where','model','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','Trunk,\x20%s,\x20%s','message','result','catch','GetTrunk','Trunk','options','raw','attributes','limit'];(function(_0x25d069,_0x418ab6){var _0x45608e=function(_0x716af4){while(--_0x716af4){_0x25d069['push'](_0x25d069['shift']());}};_0x45608e(++_0x418ab6);}(_0xf3dc,0xfa));var _0xcf3d=function(_0x2e70e9,_0xa62fbc){_0x2e70e9=_0x2e70e9-0x0;var _0x2686ad=_0xf3dc[_0x2e70e9];return _0x2686ad;};'use strict';var _=require(_0xcf3d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcf3d('0x1'));var rs=require(_0xcf3d('0x2'));var fs=require('fs');var Redis=require(_0xcf3d('0x3'));var db=require(_0xcf3d('0x4'))['db'];var utils=require(_0xcf3d('0x5'));var logger=require(_0xcf3d('0x6'))(_0xcf3d('0x7'));var config=require(_0xcf3d('0x8'));var jayson=require(_0xcf3d('0x9'));var client=jayson['client'][_0xcf3d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x499d56,_0x4ded6d,_0x2d972e){return new BPromise(function(_0x3d8c6e,_0x569d15){return client[_0xcf3d('0xb')](_0x499d56,_0x2d972e)[_0xcf3d('0xc')](function(_0x37246c){logger[_0xcf3d('0xd')]('Trunk,\x20%s,\x20%s',_0x4ded6d,_0xcf3d('0xe'));logger[_0xcf3d('0xf')](_0xcf3d('0x10'),_0x4ded6d,_0xcf3d('0xe'),JSON[_0xcf3d('0x11')](_0x37246c));if(_0x37246c[_0xcf3d('0x12')]){if(_0x37246c['error'][_0xcf3d('0x13')]===0x1f4){logger['error'](_0xcf3d('0x14'),_0x4ded6d,_0x37246c[_0xcf3d('0x12')]['message']);return _0x569d15(_0x37246c[_0xcf3d('0x12')][_0xcf3d('0x15')]);}logger[_0xcf3d('0x12')]('Trunk,\x20%s,\x20%s',_0x4ded6d,_0x37246c[_0xcf3d('0x12')][_0xcf3d('0x15')]);return _0x3d8c6e(_0x37246c[_0xcf3d('0x12')][_0xcf3d('0x15')]);}else{logger['info'](_0xcf3d('0x14'),_0x4ded6d,_0xcf3d('0xe'));_0x3d8c6e(_0x37246c[_0xcf3d('0x16')]['message']);}})[_0xcf3d('0x17')](function(_0x382c6b){logger[_0xcf3d('0x12')](_0xcf3d('0x14'),_0x4ded6d,_0x382c6b);_0x569d15(_0x382c6b);});});}exports[_0xcf3d('0x18')]=function(_0x3d361a){var _0x27c153=this;return new Promise(function(_0x5ddd52,_0x2a640a){return db[_0xcf3d('0x19')]['findAll']({'raw':_0x3d361a[_0xcf3d('0x1a')]?_0x3d361a[_0xcf3d('0x1a')][_0xcf3d('0x1b')]===undefined?!![]:![]:!![],'where':_0x3d361a[_0xcf3d('0x1a')]?_0x3d361a[_0xcf3d('0x1a')]['where']||null:null,'attributes':_0x3d361a[_0xcf3d('0x1a')]?_0x3d361a['options'][_0xcf3d('0x1c')]||null:null,'limit':_0x3d361a['options']?_0x3d361a[_0xcf3d('0x1a')][_0xcf3d('0x1d')]||null:null,'include':_0x3d361a[_0xcf3d('0x1a')]?_0x3d361a[_0xcf3d('0x1a')][_0xcf3d('0x1e')]?_[_0xcf3d('0x1f')](_0x3d361a[_0xcf3d('0x1a')]['include'],function(_0x800712){return{'model':db[_0x800712['model']],'as':_0x800712['as'],'attributes':_0x800712['attributes'],'include':_0x800712[_0xcf3d('0x1e')]?_[_0xcf3d('0x1f')](_0x800712['include'],function(_0x57a754){return{'model':db[_0x57a754['model']],'as':_0x57a754['as'],'attributes':_0x57a754[_0xcf3d('0x1c')],'include':_0x57a754['include']?_['map'](_0x57a754[_0xcf3d('0x1e')],function(_0x5b347c){return{'model':db[_0x5b347c['model']],'as':_0x5b347c['as'],'attributes':_0x5b347c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x8790da){logger[_0xcf3d('0xd')]('GetTrunk',_0x3d361a);logger[_0xcf3d('0xf')](_0xcf3d('0x18'),_0x3d361a,JSON[_0xcf3d('0x11')](_0x8790da));_0x5ddd52(_0x8790da);})[_0xcf3d('0x17')](function(_0x12339b){logger[_0xcf3d('0x12')]('GetTrunk',_0x12339b['message'],_0x3d361a);_0x2a640a(_0x27c153[_0xcf3d('0x12')](0x1f4,_0x12339b[_0xcf3d('0x15')]));});});};exports[_0xcf3d('0x20')]=function(_0x379854){var _0x26eac=this;return new Promise(function(_0x54c641,_0x45b409){return db['Trunk']['find']({'raw':_0x379854['options']?_0x379854[_0xcf3d('0x1a')][_0xcf3d('0x1b')]===undefined?!![]:![]:!![],'where':_0x379854[_0xcf3d('0x1a')]?_0x379854[_0xcf3d('0x1a')][_0xcf3d('0x21')]||null:null,'attributes':_0x379854[_0xcf3d('0x1a')]?_0x379854[_0xcf3d('0x1a')]['attributes']||null:null,'include':_0x379854[_0xcf3d('0x1a')]?_0x379854[_0xcf3d('0x1a')][_0xcf3d('0x1e')]?_[_0xcf3d('0x1f')](_0x379854['options'][_0xcf3d('0x1e')],function(_0x354ffb){return{'model':db[_0x354ffb[_0xcf3d('0x22')]],'as':_0x354ffb['as'],'attributes':_0x354ffb[_0xcf3d('0x1c')],'include':_0x354ffb[_0xcf3d('0x1e')]?_['map'](_0x354ffb[_0xcf3d('0x1e')],function(_0x830766){return{'model':db[_0x830766[_0xcf3d('0x22')]],'as':_0x830766['as'],'attributes':_0x830766[_0xcf3d('0x1c')],'include':_0x830766[_0xcf3d('0x1e')]?_['map'](_0x830766[_0xcf3d('0x1e')],function(_0x43628c){return{'model':db[_0x43628c[_0xcf3d('0x22')]],'as':_0x43628c['as'],'attributes':_0x43628c[_0xcf3d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xcf3d('0xc')](function(_0x322ddd){logger[_0xcf3d('0xd')](_0xcf3d('0x20'),_0x379854);logger['debug'](_0xcf3d('0x20'),_0x379854,JSON[_0xcf3d('0x11')](_0x322ddd));_0x54c641(_0x322ddd);})[_0xcf3d('0x17')](function(_0x5c5e76){logger[_0xcf3d('0x12')](_0xcf3d('0x20'),_0x5c5e76[_0xcf3d('0x15')],_0x379854);_0x45b409(_0x26eac[_0xcf3d('0x12')](0x1f4,_0x5c5e76['message']));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index b13dd64..e1243af 100644 --- a/server/api/user-setting/index.js +++ b/server/api/user-setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf60c=['/:id','isAuthenticated','update','exports','express','Router','./user-setting.controller'];(function(_0x471f69,_0x16e4b3){var _0x141033=function(_0x5167a9){while(--_0x5167a9){_0x471f69['push'](_0x471f69['shift']());}};_0x141033(++_0x16e4b3);}(_0xf60c,0xf9));var _0xcf60=function(_0x223d25,_0x35ae44){_0x223d25=_0x223d25-0x0;var _0x468ad8=_0xf60c[_0x223d25];return _0x468ad8;};'use strict';var express=require(_0xcf60('0x0'));var router=express[_0xcf60('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xcf60('0x2'));router['put'](_0xcf60('0x3'),auth[_0xcf60('0x4')](),controller[_0xcf60('0x5')]);module[_0xcf60('0x6')]=router; \ No newline at end of file +var _0x3321=['./user-setting.controller','put','/:id','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0xdb4fa6,_0xfd3f51){var _0x20ef2e=function(_0x7b4bf3){while(--_0x7b4bf3){_0xdb4fa6['push'](_0xdb4fa6['shift']());}};_0x20ef2e(++_0xfd3f51);}(_0x3321,0x1bd));var _0x1332=function(_0x31365b,_0xdd62f9){_0x31365b=_0x31365b-0x0;var _0xfc1835=_0x3321[_0x31365b];return _0xfc1835;};'use strict';var express=require(_0x1332('0x0'));var router=express[_0x1332('0x1')]();var auth=require(_0x1332('0x2'));var controller=require(_0x1332('0x3'));router[_0x1332('0x4')](_0x1332('0x5'),auth[_0x1332('0x6')](),controller['update']);module[_0x1332('0x7')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index a627aaf..5ab5e19 100644 --- a/server/api/user-setting/user-setting.attributes.js +++ b/server/api/user-setting/user-setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2180=['ENUM','TEXT','DATE','sequelize','error','warning','info','debug'];(function(_0x10b2d7,_0x3d25ff){var _0x21c043=function(_0x367042){while(--_0x367042){_0x10b2d7['push'](_0x10b2d7['shift']());}};_0x21c043(++_0x3d25ff);}(_0x2180,0x11b));var _0x0218=function(_0x589f71,_0x212326){_0x589f71=_0x589f71-0x0;var _0x5763bd=_0x2180[_0x589f71];return _0x5763bd;};'use strict';var Sequelize=require(_0x0218('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x0218('0x1'),_0x0218('0x2'),_0x0218('0x3'),_0x0218('0x4')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0x0218('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x0218('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x0218('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x0218('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':'UserId'}}; \ No newline at end of file +var _0x4026=['exports','ENUM','BOOLEAN','DATE','INTEGER','UserId','sequelize','error','warning','info','debug'];(function(_0x3ad36c,_0x1594ce){var _0x48a0e7=function(_0x5852da){while(--_0x5852da){_0x3ad36c['push'](_0x3ad36c['shift']());}};_0x48a0e7(++_0x1594ce);}(_0x4026,0xe2));var _0x6402=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4026[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x6402('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x6402('0x1'),_0x6402('0x2'),_0x6402('0x3'),_0x6402('0x4')];module[_0x6402('0x5')]={'clientSideLoggingLevel':{'type':Sequelize[_0x6402('0x6')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x6402('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x6402('0x7')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x6402('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x6402('0x9')],'unique':_0x6402('0xa')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 6282a19..01eee08 100644 --- a/server/api/user-setting/user-setting.controller.js +++ b/server/api/user-setting/user-setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x03ce=['defaults','localhost','json','update','then','stack','name','status','send','user','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','body','catch','lodash','ioredis','../../config/logger','api','../../mysqldb','socket.io-emitter','redis','register'];(function(_0xc707bc,_0x3782e4){var _0x266f92=function(_0x47a0d9){while(--_0x47a0d9){_0xc707bc['push'](_0xc707bc['shift']());}};_0x266f92(++_0x3782e4);}(_0x03ce,0x1a1));var _0xe03c=function(_0x4863c1,_0x36e82b){_0x4863c1=_0x4863c1-0x0;var _0x1430b6=_0x03ce[_0x4863c1];return _0x1430b6;};'use strict';var _=require(_0xe03c('0x0'));var Redis=require(_0xe03c('0x1'));var logger=require(_0xe03c('0x2'))(_0xe03c('0x3'));var config=require('../../config/environment');var db=require(_0xe03c('0x4'))['db'];var socket=require(_0xe03c('0x5'))(new Redis(config[_0xe03c('0x6')]));require('./user-setting.socket')[_0xe03c('0x7')](socket);config[_0xe03c('0x6')]=_[_0xe03c('0x8')](config[_0xe03c('0x6')],{'host':_0xe03c('0x9'),'port':0x18eb});function respondWithResult(_0x44c54f,_0x89f039){_0x89f039=_0x89f039||0xc8;return function(_0x52dda4){if(_0x52dda4){return _0x44c54f['status'](_0x89f039)[_0xe03c('0xa')](_0x52dda4);}};}function saveUpdates(_0x2454e6){return function(_0x3ac0ed){if(_0x3ac0ed){return _0x3ac0ed[_0xe03c('0xb')](_0x2454e6)[_0xe03c('0xc')](function(_0x41e99f){return _0x41e99f;});}return null;};}function handleEntityNotFound(_0x46bf2b){return function(_0x3e0cb0){if(!_0x3e0cb0){_0x46bf2b['sendStatus'](0x194);}return _0x3e0cb0;};}function handleError(_0x7bf4a7,_0x3f93c0){_0x3f93c0=_0x3f93c0||0x1f4;return function(_0x116e4f){logger['error'](_0x116e4f[_0xe03c('0xd')]);if(_0x116e4f[_0xe03c('0xe')]){delete _0x116e4f[_0xe03c('0xe')];}_0x7bf4a7[_0xe03c('0xf')](_0x3f93c0)[_0xe03c('0x10')](_0x116e4f);};}exports['update']=function(_0xa82947,_0xacd30d){if(_0xa82947[_0xe03c('0x11')]['role']!==_0xe03c('0x12'))throw new Error(_0xe03c('0x13'));if(isNaN(Number(_0xa82947[_0xe03c('0x14')]['id'])))throw new Error(_0xe03c('0x15'));return db[_0xe03c('0x16')]['find']({'where':{'id':_0xa82947[_0xe03c('0x14')]['id']}})[_0xe03c('0xc')](handleEntityNotFound(_0xacd30d,null))['then'](saveUpdates(_0xa82947[_0xe03c('0x17')],null))[_0xe03c('0xc')](respondWithResult(_0xacd30d,null))[_0xe03c('0x18')](handleError(_0xacd30d,null));}; \ No newline at end of file +var _0xc112=['name','send','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','then','body','lodash','ioredis','../../config/logger','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','defaults','status','json','update','sendStatus','error','stack'];(function(_0x3f7b5b,_0x1b0ba5){var _0x1c5d49=function(_0x3f43cc){while(--_0x3f43cc){_0x3f7b5b['push'](_0x3f7b5b['shift']());}};_0x1c5d49(++_0x1b0ba5);}(_0xc112,0xec));var _0x2c11=function(_0x2ecced,_0x5c1a29){_0x2ecced=_0x2ecced-0x0;var _0x268bcf=_0xc112[_0x2ecced];return _0x268bcf;};'use strict';var _=require(_0x2c11('0x0'));var Redis=require(_0x2c11('0x1'));var logger=require(_0x2c11('0x2'))('api');var config=require(_0x2c11('0x3'));var db=require(_0x2c11('0x4'))['db'];var socket=require(_0x2c11('0x5'))(new Redis(config[_0x2c11('0x6')]));require(_0x2c11('0x7'))[_0x2c11('0x8')](socket);config[_0x2c11('0x6')]=_[_0x2c11('0x9')](config[_0x2c11('0x6')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x5c2399,_0x39c244){_0x39c244=_0x39c244||0xc8;return function(_0x1fada4){if(_0x1fada4){return _0x5c2399[_0x2c11('0xa')](_0x39c244)[_0x2c11('0xb')](_0x1fada4);}};}function saveUpdates(_0x5d4059){return function(_0xc6c988){if(_0xc6c988){return _0xc6c988[_0x2c11('0xc')](_0x5d4059)['then'](function(_0xa32d3f){return _0xa32d3f;});}return null;};}function handleEntityNotFound(_0xbba8c4){return function(_0x259897){if(!_0x259897){_0xbba8c4[_0x2c11('0xd')](0x194);}return _0x259897;};}function handleError(_0x45e672,_0x501d3c){_0x501d3c=_0x501d3c||0x1f4;return function(_0x6e8bfa){logger[_0x2c11('0xe')](_0x6e8bfa[_0x2c11('0xf')]);if(_0x6e8bfa[_0x2c11('0x10')]){delete _0x6e8bfa[_0x2c11('0x10')];}_0x45e672[_0x2c11('0xa')](_0x501d3c)[_0x2c11('0x11')](_0x6e8bfa);};}exports['update']=function(_0x19fdb6,_0x6ee1e2){if(_0x19fdb6[_0x2c11('0x12')][_0x2c11('0x13')]!==_0x2c11('0x14'))throw new Error(_0x2c11('0x15'));if(isNaN(Number(_0x19fdb6[_0x2c11('0x16')]['id'])))throw new Error(_0x2c11('0x17'));return db[_0x2c11('0x18')][_0x2c11('0x19')]({'where':{'id':_0x19fdb6[_0x2c11('0x16')]['id']}})['then'](handleEntityNotFound(_0x6ee1e2,null))[_0x2c11('0x1a')](saveUpdates(_0x19fdb6[_0x2c11('0x1b')],null))[_0x2c11('0x1a')](respondWithResult(_0x6ee1e2,null))['catch'](handleError(_0x6ee1e2,null));}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.events.js b/server/api/user-setting/user-setting.events.js index 2068528..e7b1754 100644 --- a/server/api/user-setting/user-setting.events.js +++ b/server/api/user-setting/user-setting.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe622=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserSetting','update','remove'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xe622,0x94));var _0x2e62=function(_0x3f80a5,_0xd69c93){_0x3f80a5=_0x3f80a5-0x0;var _0x439ded=_0xe622[_0x3f80a5];return _0x439ded;};'use strict';var EventEmitter=require(_0x2e62('0x0'));var UserSetting=require(_0x2e62('0x1'))['db'][_0x2e62('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x2e62('0x3'),'afterDestroy':_0x2e62('0x4')};function emitEvent(_0x284abd){return function(_0x5b00e8,_0x59e642,_0x11bcf3){UserSettingEvents[_0x2e62('0x5')](_0x284abd+':'+_0x5b00e8['id'],_0x5b00e8);UserSettingEvents['emit'](_0x284abd,_0x5b00e8);_0x11bcf3(null);};}for(var e in events){if(events[_0x2e62('0x6')](e)){var event=events[e];UserSetting[_0x2e62('0x7')](e,emitEvent(event));}}module[_0x2e62('0x8')]=UserSettingEvents; \ No newline at end of file +var _0xd734=['events','../../mysqldb','UserSetting','setMaxListeners','save','update','hasOwnProperty','hook'];(function(_0x18515d,_0x5c442b){var _0x175db2=function(_0x1abf22){while(--_0x1abf22){_0x18515d['push'](_0x18515d['shift']());}};_0x175db2(++_0x5c442b);}(_0xd734,0x108));var _0x4d73=function(_0x1ada96,_0x1c7384){_0x1ada96=_0x1ada96-0x0;var _0x359055=_0xd734[_0x1ada96];return _0x359055;};'use strict';var EventEmitter=require(_0x4d73('0x0'));var UserSetting=require(_0x4d73('0x1'))['db'][_0x4d73('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x4d73('0x3')](0x0);var events={'afterCreate':_0x4d73('0x4'),'afterUpdate':_0x4d73('0x5'),'afterDestroy':'remove'};function emitEvent(_0x46bce8){return function(_0x160285,_0x8b161c,_0x2e46ea){UserSettingEvents['emit'](_0x46bce8+':'+_0x160285['id'],_0x160285);UserSettingEvents['emit'](_0x46bce8,_0x160285);_0x2e46ea(null);};}for(var e in events){if(events[_0x4d73('0x6')](e)){var event=events[e];UserSetting[_0x4d73('0x7')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 567fa5a..8f9b3b2 100644 --- a/server/api/user-setting/user-setting.model.js +++ b/server/api/user-setting/user-setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7072=['user_settings','clientSideLoggingEnabledSince','exports','define','UserSetting'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7072,0x138));var _0x2707=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0x7072[_0x13ce0c];return _0x4388fb;};'use strict';var attributes=require('./user-setting.attributes');module[_0x2707('0x0')]=function(_0x2bb701){return _0x2bb701[_0x2707('0x1')](_0x2707('0x2'),attributes,{'tableName':_0x2707('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5493b4){if(!_0x5493b4['clientSideLoggingEnabled'])_0x5493b4[_0x2707('0x4')]=null;else if(_0x5493b4['clientSideLoggingEnabledSince']===null)_0x5493b4[_0x2707('0x4')]=new Date();}}});}; \ No newline at end of file +var _0x803f=['./user-setting.attributes','define','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x16f775,_0x45b10f){var _0x17d9e2=function(_0x3d2ccf){while(--_0x3d2ccf){_0x16f775['push'](_0x16f775['shift']());}};_0x17d9e2(++_0x45b10f);}(_0x803f,0x64));var _0xf803=function(_0x5667e6,_0x5b4a0d){_0x5667e6=_0x5667e6-0x0;var _0xfd97a6=_0x803f[_0x5667e6];return _0xfd97a6;};'use strict';var attributes=require(_0xf803('0x0'));module['exports']=function(_0x328b90){return _0x328b90[_0xf803('0x1')]('UserSetting',attributes,{'tableName':_0xf803('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x43fb3b){if(!_0x43fb3b[_0xf803('0x3')])_0x43fb3b[_0xf803('0x4')]=null;else if(_0x43fb3b[_0xf803('0x4')]===null)_0x43fb3b['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 63ffe09..7884a8d 100644 --- a/server/api/user-setting/user-setting.socket.js +++ b/server/api/user-setting/user-setting.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ae9=['register','length','./user-setting.events','save','remove','update','emit','user-setting:update','user-setting:update:user-'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x2ae9,0xf5));var _0x92ae=function(_0x3db791,_0xc96e9b){_0x3db791=_0x3db791-0x0;var _0x4d4eb0=_0x2ae9[_0x3db791];return _0x4d4eb0;};'use strict';var UserSettingEvents=require(_0x92ae('0x0'));var events=[_0x92ae('0x1'),_0x92ae('0x2'),_0x92ae('0x3')];function createListener(_0x4c1e10,_0x2b5738){return function(_0x5ccf7d){_0x2b5738[_0x92ae('0x4')](_0x4c1e10,_0x5ccf7d);if(_0x4c1e10===_0x92ae('0x5')){_0x2b5738[_0x92ae('0x4')](_0x92ae('0x6')+_0x5ccf7d['UserId'],_0x5ccf7d);}};}exports[_0x92ae('0x7')]=function(_0x1fddc){for(var _0xcb56f5=0x0,_0x32c7d3=events[_0x92ae('0x8')];_0xcb56f5<_0x32c7d3;_0xcb56f5++){var _0x541cb2=events[_0xcb56f5];var _0x18f474=createListener('user-setting:'+_0x541cb2,_0x1fddc);UserSettingEvents['on'](_0x541cb2,_0x18f474);}}; \ No newline at end of file +var _0x8a05=['emit','user-setting:update:user-','UserId','register','./user-setting.events','save'];(function(_0x13ce86,_0x3bff3e){var _0x5594fe=function(_0x1c325a){while(--_0x1c325a){_0x13ce86['push'](_0x13ce86['shift']());}};_0x5594fe(++_0x3bff3e);}(_0x8a05,0x160));var _0x58a0=function(_0x302322,_0x2d9ca7){_0x302322=_0x302322-0x0;var _0x42ff84=_0x8a05[_0x302322];return _0x42ff84;};'use strict';var UserSettingEvents=require(_0x58a0('0x0'));var events=[_0x58a0('0x1'),'remove','update'];function createListener(_0x3dbcd2,_0x526445){return function(_0x1127ab){_0x526445[_0x58a0('0x2')](_0x3dbcd2,_0x1127ab);if(_0x3dbcd2==='user-setting:update'){_0x526445[_0x58a0('0x2')](_0x58a0('0x3')+_0x1127ab[_0x58a0('0x4')],_0x1127ab);}};}exports[_0x58a0('0x5')]=function(_0x63a4fc){for(var _0x45446f=0x0,_0x3d9560=events['length'];_0x45446f<_0x3d9560;_0x45446f++){var _0x155eb7=events[_0x45446f];var _0x437173=createListener('user-setting:'+_0x155eb7,_0x63a4fc);UserSettingEvents['on'](_0x155eb7,_0x437173);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 3e420ae..c41e8cb 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 _0x1ab9=['destroy','/:id/chat_interactions','removeChatInteractions','removeFaxInteractions','/:id/sms_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','whoami','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','getContacts','/:id/queues','getQueues','getVoiceQueuesRt','/:id/groups','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','getFaxInteractions','/:id/teams','/:id/lists','getLists','getAgents','/:id/prefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','getScheduledCalls','/:id/api_key','getApiKey','post','/:id/contacts','addContacts','create','bulkCreate','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','single','addAvatar','/:id/login','login','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','/:id/square_projects','createApiKey','put','/:id/password','delete','removeQueues','removeTeams'];(function(_0x3a0f13,_0x31fba5){var _0x41af91=function(_0x31b374){while(--_0x31b374){_0x3a0f13['push'](_0x3a0f13['shift']());}};_0x41af91(++_0x31fba5);}(_0x1ab9,0x7a));var _0x91ab=function(_0x14d250,_0x4b2e12){_0x14d250=_0x14d250-0x0;var _0xb991d8=_0x1ab9[_0x14d250];return _0xb991d8;};'use strict';var multer=require('multer');var util=require(_0x91ab('0x0'));var path=require('path');var timeout=require(_0x91ab('0x1'));var express=require(_0x91ab('0x2'));var router=express['Router']();var fs_extra=require(_0x91ab('0x3'));var auth=require(_0x91ab('0x4'));var interaction=require(_0x91ab('0x5'));var config=require(_0x91ab('0x6'));var controller=require('./user.controller');router[_0x91ab('0x7')]('/',auth[_0x91ab('0x8')](),controller[_0x91ab('0x9')]);router[_0x91ab('0x7')](_0x91ab('0xa'),auth[_0x91ab('0x8')](),controller['describe']);router['get']('/whoami',auth['isAuthenticated'](),controller[_0x91ab('0xb')]);router[_0x91ab('0x7')]('/presence',auth[_0x91ab('0x8')](),controller['getPresence']);router[_0x91ab('0x7')](_0x91ab('0xc'),auth['isAuthenticated'](),controller[_0x91ab('0xd')]);router[_0x91ab('0x7')](_0x91ab('0xe'),controller[_0x91ab('0xf')]);router[_0x91ab('0x7')](_0x91ab('0x10'),auth[_0x91ab('0x8')](),controller[_0x91ab('0x11')]);router[_0x91ab('0x7')]('/:id/contacts',auth[_0x91ab('0x8')](),controller[_0x91ab('0x12')]);router[_0x91ab('0x7')](_0x91ab('0x13'),auth[_0x91ab('0x8')](),controller[_0x91ab('0x14')]);router['get']('/:id/queues_rt',auth[_0x91ab('0x8')](),controller[_0x91ab('0x15')]);router[_0x91ab('0x7')](_0x91ab('0x16'),auth[_0x91ab('0x8')](),controller['getGroups']);router['get']('/:id/recordings',auth[_0x91ab('0x8')](),controller[_0x91ab('0x17')]);router[_0x91ab('0x7')](_0x91ab('0x18'),auth[_0x91ab('0x8')](),controller[_0x91ab('0x19')]);router['get'](_0x91ab('0x1a'),auth['isAuthenticated'](),controller[_0x91ab('0x1b')]);router[_0x91ab('0x7')](_0x91ab('0x1c'),auth['isAuthenticated'](),controller[_0x91ab('0x1d')]);router[_0x91ab('0x7')](_0x91ab('0x1e'),auth[_0x91ab('0x8')](),controller['getMailInteractions']);router['get'](_0x91ab('0x1f'),auth[_0x91ab('0x8')](),controller['getSmsInteractions']);router[_0x91ab('0x7')]('/:id/fax/interactions',auth[_0x91ab('0x8')](),controller[_0x91ab('0x20')]);router[_0x91ab('0x7')]('/:id/whatsapp/interactions',auth[_0x91ab('0x8')](),controller['getWhatsappInteractions']);router[_0x91ab('0x7')](_0x91ab('0x21'),auth[_0x91ab('0x8')](),controller['getTeams']);router[_0x91ab('0x7')](_0x91ab('0x22'),auth[_0x91ab('0x8')](),controller[_0x91ab('0x23')]);router[_0x91ab('0x7')]('/:id/agents',auth[_0x91ab('0x8')](),controller[_0x91ab('0x24')]);router[_0x91ab('0x7')](_0x91ab('0x25'),auth[_0x91ab('0x8')](),controller['getVoicePrefixes']);router[_0x91ab('0x7')](_0x91ab('0x26'),auth[_0x91ab('0x8')](),controller['getFaxAccounts']);router[_0x91ab('0x7')](_0x91ab('0x27'),auth[_0x91ab('0x8')](),controller[_0x91ab('0x28')]);router['get'](_0x91ab('0x29'),auth[_0x91ab('0x8')](),controller['getOpenchannelAccounts']);router[_0x91ab('0x7')](_0x91ab('0x2a'),auth[_0x91ab('0x8')](),controller[_0x91ab('0x2b')]);router['get'](_0x91ab('0x2c'),auth['isAuthenticated'](),controller[_0x91ab('0x2d')]);router['get'](_0x91ab('0x2e'),auth[_0x91ab('0x8')](),controller[_0x91ab('0x2f')]);router[_0x91ab('0x7')]('/:id/square_projects',auth[_0x91ab('0x8')](),controller['getSquareProjects']);router[_0x91ab('0x7')]('/:id/scheduled_calls',auth[_0x91ab('0x8')](),controller[_0x91ab('0x30')]);router[_0x91ab('0x7')](_0x91ab('0x31'),auth[_0x91ab('0x8')](),controller[_0x91ab('0x32')]);router[_0x91ab('0x33')](_0x91ab('0x34'),auth['isAuthenticated'](),controller[_0x91ab('0x35')]);router[_0x91ab('0x33')]('/',auth[_0x91ab('0x8')](),controller[_0x91ab('0x36')]);router[_0x91ab('0x33')]('/create_many',auth['isAuthenticated'](),controller[_0x91ab('0x37')]);router[_0x91ab('0x33')](_0x91ab('0x13'),auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer[_0x91ab('0x38')]({'destination':function(_0x334ad6,_0x21601c,_0x2519fe){_0x2519fe(null,path[_0x91ab('0x39')](config[_0x91ab('0x3a')],_0x91ab('0x3b')));},'filename':function(_0x128012,_0x6c13e4,_0x7cc677){_0x7cc677(null,util[_0x91ab('0x3c')](_0x91ab('0x3d'),Date[_0x91ab('0x3e')](),_0x6c13e4[_0x91ab('0x3f')]));}})});router[_0x91ab('0x33')](_0x91ab('0xe'),upload[_0x91ab('0x40')]('file'),controller[_0x91ab('0x41')]);router[_0x91ab('0x33')](_0x91ab('0x42'),auth[_0x91ab('0x8')](),controller[_0x91ab('0x43')]);router['post']('/:id/logout',auth[_0x91ab('0x8')](),controller[_0x91ab('0x44')]);router['post'](_0x91ab('0x45'),auth[_0x91ab('0x8')](),controller[_0x91ab('0x46')]);router[_0x91ab('0x33')](_0x91ab('0x47'),auth[_0x91ab('0x8')](),controller[_0x91ab('0x48')]);router['post']('/:id/teams',auth['isAuthenticated'](),controller[_0x91ab('0x49')]);router[_0x91ab('0x33')]('/:id/chat_interactions',auth[_0x91ab('0x8')](),controller[_0x91ab('0x4a')]);router[_0x91ab('0x33')](_0x91ab('0x4b'),auth['isAuthenticated'](),controller['addMailInteractions']);router[_0x91ab('0x33')](_0x91ab('0x4c'),auth[_0x91ab('0x8')](),controller['addFaxInteractions']);router[_0x91ab('0x33')]('/:id/sms_interactions',auth[_0x91ab('0x8')](),controller['addSmsInteractions']);router[_0x91ab('0x33')](_0x91ab('0x4d'),auth['isAuthenticated'](),controller[_0x91ab('0x4e')]);router[_0x91ab('0x33')](_0x91ab('0x4f'),auth['isAuthenticated'](),controller['addWhatsappInteractions']);router[_0x91ab('0x33')](_0x91ab('0x26'),auth[_0x91ab('0x8')](),controller['addFaxAccounts']);router[_0x91ab('0x33')](_0x91ab('0x27'),auth['isAuthenticated'](),controller[_0x91ab('0x50')]);router[_0x91ab('0x33')](_0x91ab('0x29'),auth[_0x91ab('0x8')](),controller[_0x91ab('0x51')]);router[_0x91ab('0x33')](_0x91ab('0x2a'),auth[_0x91ab('0x8')](),controller[_0x91ab('0x52')]);router[_0x91ab('0x33')](_0x91ab('0x2c'),auth[_0x91ab('0x8')](),controller[_0x91ab('0x53')]);router['post'](_0x91ab('0x2e'),auth[_0x91ab('0x8')](),controller[_0x91ab('0x54')]);router['post'](_0x91ab('0x55'),auth[_0x91ab('0x8')](),controller['addSquareProjects']);router[_0x91ab('0x33')](_0x91ab('0x31'),auth[_0x91ab('0x8')](),controller[_0x91ab('0x56')]);router[_0x91ab('0x57')](_0x91ab('0xc'),auth[_0x91ab('0x8')](),controller['update']);router['put'](_0x91ab('0x58'),auth[_0x91ab('0x8')](),controller['changePassword']);router[_0x91ab('0x59')](_0x91ab('0x13'),auth[_0x91ab('0x8')](),controller[_0x91ab('0x5a')]);router[_0x91ab('0x59')](_0x91ab('0x21'),auth['isAuthenticated'](),controller[_0x91ab('0x5b')]);router[_0x91ab('0x59')](_0x91ab('0xc'),auth['isAuthenticated'](),controller[_0x91ab('0x5c')]);router[_0x91ab('0x59')](_0x91ab('0x5d'),auth['isAuthenticated'](),controller[_0x91ab('0x5e')]);router['delete'](_0x91ab('0x4b'),auth[_0x91ab('0x8')](),controller['removeMailInteractions']);router['delete'](_0x91ab('0x4c'),auth[_0x91ab('0x8')](),controller[_0x91ab('0x5f')]);router[_0x91ab('0x59')](_0x91ab('0x60'),auth['isAuthenticated'](),controller['removeSmsInteractions']);router['delete'](_0x91ab('0x4d'),auth['isAuthenticated'](),controller[_0x91ab('0x61')]);router['delete']('/:id/whatsapp_interactions',auth[_0x91ab('0x8')](),controller[_0x91ab('0x62')]);router[_0x91ab('0x59')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0x91ab('0x63')]);router[_0x91ab('0x59')](_0x91ab('0x27'),auth[_0x91ab('0x8')](),controller[_0x91ab('0x64')]);router[_0x91ab('0x59')](_0x91ab('0x29'),auth['isAuthenticated'](),controller['removeOpenchannelAccounts']);router[_0x91ab('0x59')](_0x91ab('0x2a'),auth[_0x91ab('0x8')](),controller[_0x91ab('0x65')]);router[_0x91ab('0x59')](_0x91ab('0x2c'),auth[_0x91ab('0x8')](),controller[_0x91ab('0x66')]);router[_0x91ab('0x59')](_0x91ab('0x2e'),auth[_0x91ab('0x8')](),controller[_0x91ab('0x67')]);router[_0x91ab('0x59')](_0x91ab('0x55'),auth[_0x91ab('0x8')](),controller[_0x91ab('0x68')]);router[_0x91ab('0x59')](_0x91ab('0x31'),auth['isAuthenticated'](),controller[_0x91ab('0x69')]);module[_0x91ab('0x6a')]=router; \ No newline at end of file +var _0xdb1d=['update','put','/:id/password','changePassword','delete','/:id/chat_interactions','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeMailAccounts','/:id/openchannel_accounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./user.controller','get','isAuthenticated','index','/describe','/whoami','whoami','/presence','/:id','show','getAvatar','/:id/open_tabs','getContacts','/:id/queues','getQueues','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','/:id/contacts','addContacts','create','/create_many','bulkCreate','addQueues','diskStorage','root','now','originalname','/:id/avatar','single','file','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addChatWebsites','addWhatsappAccounts','/:id/square_projects','addSquareProjects','createApiKey'];(function(_0x38f5dc,_0x313a2a){var _0x4cfde1=function(_0x46c866){while(--_0x46c866){_0x38f5dc['push'](_0x38f5dc['shift']());}};_0x4cfde1(++_0x313a2a);}(_0xdb1d,0x1df));var _0xddb1=function(_0x239ef7,_0x4a82c6){_0x239ef7=_0x239ef7-0x0;var _0x4c1225=_0xdb1d[_0x239ef7];return _0x4c1225;};'use strict';var multer=require(_0xddb1('0x0'));var util=require(_0xddb1('0x1'));var path=require(_0xddb1('0x2'));var timeout=require(_0xddb1('0x3'));var express=require(_0xddb1('0x4'));var router=express[_0xddb1('0x5')]();var fs_extra=require(_0xddb1('0x6'));var auth=require(_0xddb1('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xddb1('0x8'));router[_0xddb1('0x9')]('/',auth[_0xddb1('0xa')](),controller[_0xddb1('0xb')]);router[_0xddb1('0x9')](_0xddb1('0xc'),auth[_0xddb1('0xa')](),controller['describe']);router['get'](_0xddb1('0xd'),auth[_0xddb1('0xa')](),controller[_0xddb1('0xe')]);router['get'](_0xddb1('0xf'),auth[_0xddb1('0xa')](),controller['getPresence']);router[_0xddb1('0x9')](_0xddb1('0x10'),auth[_0xddb1('0xa')](),controller[_0xddb1('0x11')]);router['get']('/:id/avatar',controller[_0xddb1('0x12')]);router[_0xddb1('0x9')](_0xddb1('0x13'),auth[_0xddb1('0xa')](),controller['getOpenTabs']);router[_0xddb1('0x9')]('/:id/contacts',auth[_0xddb1('0xa')](),controller[_0xddb1('0x14')]);router[_0xddb1('0x9')](_0xddb1('0x15'),auth[_0xddb1('0xa')](),controller[_0xddb1('0x16')]);router[_0xddb1('0x9')]('/:id/queues_rt',auth[_0xddb1('0xa')](),controller['getVoiceQueuesRt']);router[_0xddb1('0x9')](_0xddb1('0x17'),auth[_0xddb1('0xa')](),controller[_0xddb1('0x18')]);router[_0xddb1('0x9')](_0xddb1('0x19'),auth[_0xddb1('0xa')](),controller[_0xddb1('0x1a')]);router[_0xddb1('0x9')](_0xddb1('0x1b'),auth[_0xddb1('0xa')](),controller[_0xddb1('0x1c')]);router[_0xddb1('0x9')](_0xddb1('0x1d'),auth[_0xddb1('0xa')](),controller[_0xddb1('0x1e')]);router[_0xddb1('0x9')](_0xddb1('0x1f'),auth[_0xddb1('0xa')](),controller[_0xddb1('0x20')]);router[_0xddb1('0x9')]('/:id/mail/interactions',auth[_0xddb1('0xa')](),controller[_0xddb1('0x21')]);router[_0xddb1('0x9')]('/:id/sms/interactions',auth[_0xddb1('0xa')](),controller[_0xddb1('0x22')]);router[_0xddb1('0x9')](_0xddb1('0x23'),auth[_0xddb1('0xa')](),controller['getFaxInteractions']);router[_0xddb1('0x9')](_0xddb1('0x24'),auth[_0xddb1('0xa')](),controller[_0xddb1('0x25')]);router[_0xddb1('0x9')](_0xddb1('0x26'),auth[_0xddb1('0xa')](),controller[_0xddb1('0x27')]);router[_0xddb1('0x9')](_0xddb1('0x28'),auth['isAuthenticated'](),controller[_0xddb1('0x29')]);router[_0xddb1('0x9')](_0xddb1('0x2a'),auth[_0xddb1('0xa')](),controller[_0xddb1('0x2b')]);router[_0xddb1('0x9')](_0xddb1('0x2c'),auth[_0xddb1('0xa')](),controller[_0xddb1('0x2d')]);router[_0xddb1('0x9')](_0xddb1('0x2e'),auth[_0xddb1('0xa')](),controller[_0xddb1('0x2f')]);router[_0xddb1('0x9')](_0xddb1('0x30'),auth['isAuthenticated'](),controller['getMailAccounts']);router['get']('/:id/openchannel_accounts',auth[_0xddb1('0xa')](),controller['getOpenchannelAccounts']);router['get'](_0xddb1('0x31'),auth[_0xddb1('0xa')](),controller[_0xddb1('0x32')]);router[_0xddb1('0x9')](_0xddb1('0x33'),auth[_0xddb1('0xa')](),controller['getChatWebsites']);router[_0xddb1('0x9')](_0xddb1('0x34'),auth['isAuthenticated'](),controller[_0xddb1('0x35')]);router[_0xddb1('0x9')]('/:id/square_projects',auth[_0xddb1('0xa')](),controller['getSquareProjects']);router[_0xddb1('0x9')](_0xddb1('0x36'),auth[_0xddb1('0xa')](),controller[_0xddb1('0x37')]);router[_0xddb1('0x9')](_0xddb1('0x38'),auth[_0xddb1('0xa')](),controller['getApiKey']);router[_0xddb1('0x39')](_0xddb1('0x3a'),auth['isAuthenticated'](),controller[_0xddb1('0x3b')]);router[_0xddb1('0x39')]('/',auth[_0xddb1('0xa')](),controller[_0xddb1('0x3c')]);router['post'](_0xddb1('0x3d'),auth[_0xddb1('0xa')](),controller[_0xddb1('0x3e')]);router[_0xddb1('0x39')](_0xddb1('0x15'),auth[_0xddb1('0xa')](),controller[_0xddb1('0x3f')]);var upload=multer({'storage':multer[_0xddb1('0x40')]({'destination':function(_0x5e00eb,_0x21ecb5,_0x52f412){_0x52f412(null,path['join'](config[_0xddb1('0x41')],'server/files/images/'));},'filename':function(_0x1f78c7,_0x2b857f,_0x355590){_0x355590(null,util['format']('%s-%s',Date[_0xddb1('0x42')](),_0x2b857f[_0xddb1('0x43')]));}})});router[_0xddb1('0x39')](_0xddb1('0x44'),upload[_0xddb1('0x45')](_0xddb1('0x46')),controller['addAvatar']);router['post'](_0xddb1('0x47'),auth[_0xddb1('0xa')](),controller[_0xddb1('0x48')]);router[_0xddb1('0x39')](_0xddb1('0x49'),auth[_0xddb1('0xa')](),controller[_0xddb1('0x4a')]);router['post'](_0xddb1('0x4b'),auth[_0xddb1('0xa')](),controller[_0xddb1('0x4c')]);router[_0xddb1('0x39')](_0xddb1('0x4d'),auth[_0xddb1('0xa')](),controller[_0xddb1('0x4e')]);router[_0xddb1('0x39')]('/:id/teams',auth[_0xddb1('0xa')](),controller[_0xddb1('0x4f')]);router['post']('/:id/chat_interactions',auth[_0xddb1('0xa')](),controller['addChatInteractions']);router[_0xddb1('0x39')](_0xddb1('0x50'),auth[_0xddb1('0xa')](),controller[_0xddb1('0x51')]);router[_0xddb1('0x39')](_0xddb1('0x52'),auth[_0xddb1('0xa')](),controller[_0xddb1('0x53')]);router[_0xddb1('0x39')](_0xddb1('0x54'),auth[_0xddb1('0xa')](),controller['addSmsInteractions']);router[_0xddb1('0x39')](_0xddb1('0x55'),auth[_0xddb1('0xa')](),controller[_0xddb1('0x56')]);router[_0xddb1('0x39')](_0xddb1('0x57'),auth[_0xddb1('0xa')](),controller['addWhatsappInteractions']);router[_0xddb1('0x39')](_0xddb1('0x2e'),auth[_0xddb1('0xa')](),controller[_0xddb1('0x58')]);router[_0xddb1('0x39')](_0xddb1('0x30'),auth[_0xddb1('0xa')](),controller[_0xddb1('0x59')]);router[_0xddb1('0x39')]('/:id/openchannel_accounts',auth[_0xddb1('0xa')](),controller[_0xddb1('0x5a')]);router[_0xddb1('0x39')]('/:id/sms_accounts',auth[_0xddb1('0xa')](),controller['addSmsAccounts']);router['post'](_0xddb1('0x33'),auth[_0xddb1('0xa')](),controller[_0xddb1('0x5b')]);router[_0xddb1('0x39')]('/:id/whatsapp_accounts',auth[_0xddb1('0xa')](),controller[_0xddb1('0x5c')]);router[_0xddb1('0x39')](_0xddb1('0x5d'),auth[_0xddb1('0xa')](),controller[_0xddb1('0x5e')]);router[_0xddb1('0x39')]('/:id/api_key',auth['isAuthenticated'](),controller[_0xddb1('0x5f')]);router['put'](_0xddb1('0x10'),auth[_0xddb1('0xa')](),controller[_0xddb1('0x60')]);router[_0xddb1('0x61')](_0xddb1('0x62'),auth['isAuthenticated'](),controller[_0xddb1('0x63')]);router['delete']('/:id/queues',auth[_0xddb1('0xa')](),controller['removeQueues']);router[_0xddb1('0x64')](_0xddb1('0x26'),auth[_0xddb1('0xa')](),controller['removeTeams']);router[_0xddb1('0x64')](_0xddb1('0x10'),auth[_0xddb1('0xa')](),controller['destroy']);router[_0xddb1('0x64')](_0xddb1('0x65'),auth[_0xddb1('0xa')](),controller[_0xddb1('0x66')]);router[_0xddb1('0x64')](_0xddb1('0x50'),auth[_0xddb1('0xa')](),controller[_0xddb1('0x67')]);router[_0xddb1('0x64')](_0xddb1('0x52'),auth[_0xddb1('0xa')](),controller[_0xddb1('0x68')]);router[_0xddb1('0x64')](_0xddb1('0x54'),auth[_0xddb1('0xa')](),controller['removeSmsInteractions']);router[_0xddb1('0x64')](_0xddb1('0x55'),auth['isAuthenticated'](),controller[_0xddb1('0x69')]);router[_0xddb1('0x64')](_0xddb1('0x57'),auth['isAuthenticated'](),controller[_0xddb1('0x6a')]);router[_0xddb1('0x64')](_0xddb1('0x2e'),auth[_0xddb1('0xa')](),controller['removeFaxAccounts']);router[_0xddb1('0x64')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0xddb1('0x6b')]);router[_0xddb1('0x64')](_0xddb1('0x6c'),auth[_0xddb1('0xa')](),controller['removeOpenchannelAccounts']);router[_0xddb1('0x64')]('/:id/sms_accounts',auth[_0xddb1('0xa')](),controller[_0xddb1('0x6d')]);router[_0xddb1('0x64')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0xddb1('0x6e')]);router[_0xddb1('0x64')]('/:id/whatsapp_accounts',auth[_0xddb1('0xa')](),controller[_0xddb1('0x6f')]);router['delete'](_0xddb1('0x5d'),auth[_0xddb1('0xa')](),controller[_0xddb1('0x70')]);router[_0xddb1('0x64')]('/:id/api_key',auth[_0xddb1('0xa')](),controller[_0xddb1('0x71')]);module[_0xddb1('0x72')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 448b41f..294285d 100644 --- a/server/api/user/user.attributes.js +++ b/server/api/user/user.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['certificate','passive','nonat','update,nonat','TEXT','showWebBar','wss','encryption','force_avp','icesupport','dtlsenable','dtlssetup','dtlscertfile','rtcp_mux','avpf','dtlsverify','actpass','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','setDataValue','name','defaultuser','callerid','getDataValue','internal','email','admin','user','agent','telephone','INTEGER','format','fullname','BOOLEAN','DATE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','split','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas'];(function(_0x1347f8,_0x233feb){var _0x218368=function(_0x3f4ca3){while(--_0x3f4ca3){_0x1347f8['push'](_0x1347f8['shift']());}};_0x218368(++_0x233feb);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x333808){this[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x333808);this[_0x0a9e('0x4')](_0x0a9e('0x6'),_0x333808);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'set':function(_0x441e3a){this[_0x0a9e('0x4')]('fullname',_0x441e3a);this['setDataValue'](_0x0a9e('0x7'),util['format']('\x22%s\x22\x20<%s>',_0x441e3a,this[_0x0a9e('0x8')](_0x0a9e('0x9'))));}},'alias':{'type':Sequelize[_0x0a9e('0x3')]},'email':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':_0x0a9e('0xa'),'validate':{'isEmail':!![]},'set':function(_0xbd1168){if(_0xbd1168){this['setDataValue']('email',_0xbd1168['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':![],'unique':_0x0a9e('0x9'),'set':function(_0x2b4227){this[_0x0a9e('0x4')](_0x0a9e('0x9'),_0x2b4227);this[_0x0a9e('0x4')]('accountcode',_0x2b4227);this[_0x0a9e('0x4')]('callerid',util[_0x0a9e('0x10')]('\x22%s\x22\x20<%s>',this[_0x0a9e('0x8')](_0x0a9e('0x11')),_0x2b4227));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0a9e('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x0a9e('0x3')]},'zipcode':{'type':Sequelize[_0x0a9e('0x3')]},'userpic':{'type':Sequelize[_0x0a9e('0x3')]},'city':{'type':Sequelize[_0x0a9e('0x3')]},'country':{'type':Sequelize[_0x0a9e('0x3')]},'online':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0a9e('0x13')]},'voicePause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x0a9e('0x13')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x14')},'ipaddr':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x0a9e('0xf')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x16'),_0x0a9e('0xc'),_0x0a9e('0x17')),'allowNull':!![],'defaultValue':_0x0a9e('0x16')},'context':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x18')},'callingpres':{'type':Sequelize[_0x0a9e('0x15')]('ALLOWED_NOT_SCREENED',_0x0a9e('0x19'),_0x0a9e('0x1a'),_0x0a9e('0x1b'),_0x0a9e('0x1c'),'PROHIB_PASSED_SCREEN',_0x0a9e('0x1d'),_0x0a9e('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x1f'),'set':function(_0x540530){this[_0x0a9e('0x4')]('transport',_0x540530?_0x540530[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x21'))?this[_0x0a9e('0x8')](_0x0a9e('0x21'))['split'](','):null;},'comment':_0x0a9e('0x22')},'dtmfmode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x23'),_0x0a9e('0x24'),_0x0a9e('0x25'),_0x0a9e('0x26'),_0x0a9e('0x27')),'allowNull':!![],'defaultValue':_0x0a9e('0x23')},'directmedia':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no','nonat',_0x0a9e('0x29'),_0x0a9e('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x2b'),'set':function(_0x15de0e){this['setDataValue']('nat',_0x15de0e?_0x15de0e[_0x0a9e('0x20')](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x2c'))?this[_0x0a9e('0x8')](_0x0a9e('0x2c'))[_0x0a9e('0x2d')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedcallgroup':{'type':Sequelize[_0x0a9e('0x3')]},'pickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x0a9e('0x3')]},'disallow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0a9e('0x2e'),'set':function(_0x40d766){this['setDataValue'](_0x0a9e('0x2f'),_0x40d766?_0x40d766[_0x0a9e('0x20')](';'):_0x0a9e('0x2e'));},'get':function(){return this[_0x0a9e('0x8')]('allow')?this['getDataValue'](_0x0a9e('0x2f'))[_0x0a9e('0x2d')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'set':function(_0x5b4f5e){this[_0x0a9e('0x4')](_0x0a9e('0x30'),_0x5b4f5e?_0x5b4f5e[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x30'))?this[_0x0a9e('0x8')](_0x0a9e('0x30'))[_0x0a9e('0x2d')](','):null;},'comment':_0x0a9e('0x31')},'trustrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x32')},'amaflags':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x28')},'busylevel':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x0a9e('0x15')]('yes','no',_0x0a9e('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x34'),_0x0a9e('0x35'),_0x0a9e('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x0a9e('0x37'),_0x0a9e('0x38')),'allowNull':!![],'defaultValue':_0x0a9e('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','fingerprint',_0x0a9e('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x0a9e('0x15')]('active',_0x0a9e('0x3a'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no',_0x0a9e('0x3b'),_0x0a9e('0x29'),_0x0a9e('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x0a9e('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x0a9e('0x3d')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x3649cc){this['setDataValue'](_0x0a9e('0x3e'),_0x3649cc);var _0x5ba1f9=this['get']({'plain':!![]});switch(_0x3649cc){case 0x0:case 0x1:var _0x5674ee=_0x5ba1f9[_0x0a9e('0x21')]?_['isArray'](_0x5ba1f9[_0x0a9e('0x21')])?_0x5ba1f9[_0x0a9e('0x21')][_0x0a9e('0x20')]():_0x5ba1f9[_0x0a9e('0x21')]:_0x0a9e('0x1f');if(_0x5674ee===_0x0a9e('0x3f')){_0x5674ee='udp';}this[_0x0a9e('0x4')]('transport',_0x5674ee);this[_0x0a9e('0x4')](_0x0a9e('0x40'),'no');this[_0x0a9e('0x4')]('avpf',null);this[_0x0a9e('0x4')](_0x0a9e('0x41'),null);this[_0x0a9e('0x4')](_0x0a9e('0x42'),null);this['setDataValue'](_0x0a9e('0x43'),null);this[_0x0a9e('0x4')]('dtlsverify',null);this[_0x0a9e('0x4')](_0x0a9e('0x44'),null);this[_0x0a9e('0x4')](_0x0a9e('0x45'),null);this[_0x0a9e('0x4')]('dtlsprivatekey',null);this[_0x0a9e('0x4')](_0x0a9e('0x46'),'no');break;case 0x2:this[_0x0a9e('0x4')]('transport',_0x0a9e('0x3f'));this['setDataValue']('encryption',_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x47'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x41'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x42'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x43'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x48'),'no');this[_0x0a9e('0x4')](_0x0a9e('0x44'),_0x0a9e('0x49'));this['setDataValue'](_0x0a9e('0x45'),_0x5ba1f9[_0x0a9e('0x45')]||_0x0a9e('0x4a'));this['setDataValue'](_0x0a9e('0x4b'),_0x5ba1f9[_0x0a9e('0x4b')]||'/etc/pki/tls/private/motion.key');this[_0x0a9e('0x4')](_0x0a9e('0x46'),_0x0a9e('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0x0a9e('0x3d')],'set':function(_0x13b5c0){this['setDataValue']('permissions',_0x13b5c0?_0x13b5c0['join'](','):[]);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x4c'))?_[_0x0a9e('0x4d')](this[_0x0a9e('0x8')](_0x0a9e('0x4c'))[_0x0a9e('0x2d')](','),function(_0xeef20){return parseInt(_0xeef20,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x0a9e('0x4e')],'get':function(){return this[_0x0a9e('0x8')]('phoneBarEnableScreenRecordingByAgent')?this[_0x0a9e('0x8')](_0x0a9e('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0xdb98ca){if(typeof _0xdb98ca===_0x0a9e('0x50')){var _0x3df0e3=_0xdb98ca==='1'?!![]:_0xdb98ca==='0'?![]:_0xdb98ca===_0x0a9e('0x51')?!![]:_0xdb98ca===_0x0a9e('0x52')?![]:![];this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0x3df0e3);}else{this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0xdb98ca);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0xf4120f){this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0xf4120f);if(_0xf4120f===!![]){this['setDataValue'](_0x0a9e('0x55'),moment());this[_0x0a9e('0x4')](_0x0a9e('0x56'),0x0);}else{this[_0x0a9e('0x4')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x0a9e('0xf')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0}}; \ No newline at end of file +var _0x70e0=['refuse','originate','uac','uas','fingerprint','update,nonat','TEXT','showWebBar','get','isArray','wss','udp','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','actpass','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','INTEGER','BOOLEAN','DATE','dynamic','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','join','transport','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','ulaw;alaw;gsm','allow','insecure','\x22\x22\x20<>','always','accept'];(function(_0x3138c9,_0x4715a5){var _0xfceab3=function(_0x5419bb){while(--_0x5419bb){_0x3138c9['push'](_0x3138c9['shift']());}};_0xfceab3(++_0x4715a5);}(_0x70e0,0x17b));var _0x070e=function(_0x5a6a58,_0x53a039){_0x5a6a58=_0x5a6a58-0x0;var _0x4f324d=_0x70e0[_0x5a6a58];return _0x4f324d;};'use strict';var Sequelize=require(_0x070e('0x0'));var moment=require(_0x070e('0x1'));var util=require(_0x070e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'unique':_0x070e('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x277d32){this[_0x070e('0x5')]('name',_0x277d32);this[_0x070e('0x5')]('defaultuser',_0x277d32);},'comment':_0x070e('0x6')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x56e420){this['setDataValue'](_0x070e('0x7'),_0x56e420);this[_0x070e('0x5')](_0x070e('0x8'),util[_0x070e('0x9')](_0x070e('0xa'),_0x56e420,this[_0x070e('0xb')](_0x070e('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x070e('0xd'),'validate':{'isEmail':!![]},'set':function(_0x2e3e5e){if(_0x2e3e5e){this[_0x070e('0x5')](_0x070e('0xd'),_0x2e3e5e[_0x070e('0xe')]());}}},'role':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x10'),_0x070e('0x11'),_0x070e('0x12'),_0x070e('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':![],'unique':'internal','set':function(_0x4a33d2){this['setDataValue'](_0x070e('0xc'),_0x4a33d2);this[_0x070e('0x5')]('accountcode',_0x4a33d2);this['setDataValue'](_0x070e('0x8'),util[_0x070e('0x9')](_0x070e('0xa'),this[_0x070e('0xb')]('fullname'),_0x4a33d2));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x070e('0x3')]},'mobile':{'type':Sequelize[_0x070e('0x3')]},'address':{'type':Sequelize[_0x070e('0x3')]},'zipcode':{'type':Sequelize[_0x070e('0x3')]},'userpic':{'type':Sequelize[_0x070e('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x070e('0x3')]},'online':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x070e('0x16')]},'voicePause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x070e('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x070e('0x16')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x070e('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x17')},'ipaddr':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x070e('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x18'),_0x070e('0x11'),_0x070e('0x19')),'allowNull':!![],'defaultValue':_0x070e('0x18')},'context':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x1a'),_0x070e('0x1b'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0x070e('0x1c'),_0x070e('0x1d'),_0x070e('0x1e'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'udp','set':function(_0x59c5b4){this[_0x070e('0x5')]('transport',_0x59c5b4?_0x59c5b4[_0x070e('0x1f')](','):null);},'get':function(){return this[_0x070e('0xb')]('transport')?this['getDataValue'](_0x070e('0x20'))[_0x070e('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x070e('0x22'),_0x070e('0x23'),_0x070e('0x24'),_0x070e('0x25'),_0x070e('0x26')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no',_0x070e('0x28'),_0x070e('0x29'),_0x070e('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x2b'),'set':function(_0x34746e){this['setDataValue']('nat',_0x34746e?_0x34746e['join'](','):null);},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2c'))?this[_0x070e('0xb')](_0x070e('0x2c'))[_0x070e('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x070e('0x3')]},'namedcallgroup':{'type':Sequelize[_0x070e('0x3')]},'pickupgroup':{'type':Sequelize[_0x070e('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x070e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x070e('0x3')]},'disallow':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'defaultValue':_0x070e('0x2d'),'set':function(_0x4800a9){this[_0x070e('0x5')]('allow',_0x4800a9?_0x4800a9[_0x070e('0x1f')](';'):_0x070e('0x2d'));},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2e'))?this[_0x070e('0xb')]('allow')[_0x070e('0x21')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![],'set':function(_0x38879f){this['setDataValue'](_0x070e('0x2f'),_0x38879f?_0x38879f[_0x070e('0x1f')](','):null);},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2f'))?this['getDataValue'](_0x070e('0x2f'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x30')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':_0x070e('0x27')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no',_0x070e('0x31')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x32'),_0x070e('0x33'),_0x070e('0x34')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x35'),'uas'),'allowNull':!![],'defaultValue':_0x070e('0x36')},'t38pt_usertpsource':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':_0x070e('0x27')},'keepalive':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no',_0x070e('0x37'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x070e('0xf')]('active','passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no',_0x070e('0x28'),'update',_0x070e('0x38')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x070e('0x16')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x070e('0x39')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x4cb86f){this['setDataValue'](_0x070e('0x3a'),_0x4cb86f);var _0x1ae5cb=this[_0x070e('0x3b')]({'plain':!![]});switch(_0x4cb86f){case 0x0:case 0x1:var _0x122198=_0x1ae5cb[_0x070e('0x20')]?_[_0x070e('0x3c')](_0x1ae5cb['transport'])?_0x1ae5cb[_0x070e('0x20')]['join']():_0x1ae5cb[_0x070e('0x20')]:'udp';if(_0x122198===_0x070e('0x3d')){_0x122198=_0x070e('0x3e');}this['setDataValue'](_0x070e('0x20'),_0x122198);this['setDataValue'](_0x070e('0x3f'),'no');this[_0x070e('0x5')](_0x070e('0x40'),null);this[_0x070e('0x5')](_0x070e('0x41'),null);this[_0x070e('0x5')](_0x070e('0x42'),null);this[_0x070e('0x5')](_0x070e('0x43'),null);this[_0x070e('0x5')](_0x070e('0x44'),null);this[_0x070e('0x5')](_0x070e('0x45'),null);this[_0x070e('0x5')]('dtlscertfile',null);this[_0x070e('0x5')](_0x070e('0x46'),null);this[_0x070e('0x5')](_0x070e('0x47'),'no');break;case 0x2:this['setDataValue'](_0x070e('0x20'),_0x070e('0x3d'));this[_0x070e('0x5')](_0x070e('0x3f'),_0x070e('0x27'));this[_0x070e('0x5')]('avpf',_0x070e('0x27'));this[_0x070e('0x5')](_0x070e('0x41'),_0x070e('0x27'));this['setDataValue'](_0x070e('0x42'),'yes');this[_0x070e('0x5')](_0x070e('0x43'),_0x070e('0x27'));this[_0x070e('0x5')](_0x070e('0x44'),'no');this['setDataValue'](_0x070e('0x45'),_0x070e('0x48'));this[_0x070e('0x5')](_0x070e('0x49'),_0x1ae5cb['dtlscertfile']||_0x070e('0x4a'));this['setDataValue'](_0x070e('0x46'),_0x1ae5cb[_0x070e('0x46')]||_0x070e('0x4b'));this['setDataValue'](_0x070e('0x47'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x070e('0x39')],'set':function(_0x5ce157){this[_0x070e('0x5')](_0x070e('0x4c'),_0x5ce157?_0x5ce157['join'](','):[]);},'get':function(){return this[_0x070e('0xb')]('permissions')?_[_0x070e('0x4d')](this[_0x070e('0xb')]('permissions')['split'](','),function(_0x29ee66){return parseInt(_0x29ee66,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x070e('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x070e('0x4e')],'get':function(){return this[_0x070e('0xb')](_0x070e('0x4f'))?this[_0x070e('0xb')](_0x070e('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x070e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x4f720f){if(typeof _0x4f720f==='string'){var _0x1624cd=_0x4f720f==='1'?!![]:_0x4f720f==='0'?![]:_0x4f720f===_0x070e('0x50')?!![]:_0x4f720f===_0x070e('0x51')?![]:![];this[_0x070e('0x5')]('screenrecording',_0x1624cd);}else{this[_0x070e('0x5')](_0x070e('0x52'),_0x4f720f);}}},'blocked':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![],'set':function(_0xd74f9c){this[_0x070e('0x5')](_0x070e('0x53'),_0xd74f9c);if(_0xd74f9c===!![]){this['setDataValue'](_0x070e('0x54'),moment());this['setDataValue'](_0x070e('0x55'),0x0);}else{this[_0x070e('0x5')](_0x070e('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x070e('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x070e('0x14')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 9e87e48..7a25643 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 _0x5a7e=['capitalize','toLowerCase','penalty','spread','emit','Queue:save','voice','VoiceQueue','get','SIP/%s','voicePause','UserVoiceQueueRt','removeQueues','remove','Queue:remove','QueueId','file','filename','join','server/files/images/logos/default_profile.png','userpic','root','server/files/images/','download','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','WhatsappOpenTabs','WHATSAPP','concat','getContacts','CmContact','sort','CmList','List','color','tag','hasOwnProperty','nolimit','Queue','order','Queues','Unknown\x20role','getVoiceQueuesRt','pick','ChatGroup','getGroups','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','phone','mobile','format','intrf','headers','x-forwarded-for','connection','remoteAddress','socket','destroy','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','resolve','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','mailPause','openchannelPause','whatsappPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','unpause','getTeams','Team','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','addTeams','getAssociatedQueues','flattenDeep','addAgent','getDataValue','upsert','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','isArray','Query\x20parameter\x20\x27ids\x27\x20is\x20required','removeAgent','Voice','getLists','getAgents','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','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','VoicePrefix','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$or','$gte','$lte','$ne','$notBetween','$in','$notIn','$notLike','$iLike','$notILike','$like','$overlap','$contains','$contained','$any','firstName','lastName','Contact','dialActive','getApiKey','retrieveApiKey','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','apiKeyNonce','apiKeyIat','whoami','send','Unable\x20to\x20retrieve\x20the\x20current\x20user','teams','queues','inbound','flatten','toString','asc','desc','substring','uniqBy','orderBy','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','client','http','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','unavailable','busy','charAt','toUpperCase','QueryTypes','SELECT','select','field','ui.','_interactions','OpenTabs','util','path','lodash','jayson/promise','ioredis','../../components/auth/service','api','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','handleError','../../mysqldb','socket.io-emitter','redis','./user.socket','register','defaults','then','info','User,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','User,\x20%s,\x20%s','result','catch','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','userNotification:recalc:','role','admin','Users','user','Agents','Telephones','telephone','filter','ignore','map','includes','find','value','name','UserProfileResource','index','User','rawAttributes','fieldName','type','password','salt','getOptions','where','includeAll','include','userSetting','true','UserSetting','attributes','push','findAll','query','openTabs','rows','length','chat','dataValues','sms','fax','whatsapp','show','params','model','differenceBy','keys','filters','intersection','fields','merge','options','openchannel','mail','all','update','body','describe','addContacts','ids','omit','internal','Setting','securePassword','validatePasswordPattern','max','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','from','voicemail','fullname','email','agent','permissions','103','113','110','105','106','107','109','100','111','114','115','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','VoiceMail','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','UserProfileSection','isEmpty','compact','changePassword','oldPassword','newPassword','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Sequelize','Wrong\x20credentials','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','passwordHistoryLimit','enforcePasswordHistory','previousPasswords','validatePasswordHistory','updatePasswordsHistory','channel','online','loginInPause','interface','isValidChannel','Unknown\x20channel','add'];(function(_0x21502b,_0x2d68e9){var _0x5ad707=function(_0x3e7a94){while(--_0x3e7a94){_0x21502b['push'](_0x21502b['shift']());}};_0x5ad707(++_0x2d68e9);}(_0x5a7e,0xed));var _0xe5a7=function(_0x2d6136,_0x2b7e85){_0x2d6136=_0x2d6136-0x0;var _0x1d5090=_0x5a7e[_0x2d6136];return _0x1d5090;};'use strict';var moment=require('moment');var util=require(_0xe5a7('0x0'));var path=require(_0xe5a7('0x1'));var fs=require('fs');var _=require(_0xe5a7('0x2'));var squel=require('squel');var jayson=require(_0xe5a7('0x3'));var Redis=require(_0xe5a7('0x4'));var authService=require(_0xe5a7('0x5'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xe5a7('0x6'));var utils=require('../../config/utils');var config=require(_0xe5a7('0x7'));var licenseUtil=require(_0xe5a7('0x8'));var APIBadRequestError=require(_0xe5a7('0x9'))[_0xe5a7('0xa')];var APINotFoundError=require(_0xe5a7('0x9'))[_0xe5a7('0xb')];var APIHandleError=require(_0xe5a7('0x9'))[_0xe5a7('0xc')];var db=require(_0xe5a7('0xd'))['db'];var socket=require(_0xe5a7('0xe'))(new Redis(config[_0xe5a7('0xf')]));require(_0xe5a7('0x10'))[_0xe5a7('0x11')](socket);config['redis']=_[_0xe5a7('0x12')](config['redis'],{'host':'localhost','port':0x18eb});var amiClient=jayson['client']['http']({'port':0x232a});var values;function respondWithRpcPromise(_0x8a9331,_0x4f8058,_0x164245,_0x4bc2d4){return new Promise(function(_0x266d6c,_0x5988af){var _0x540ab5=_0x4bc2d4||amiClient;return _0x540ab5['request'](_0x8a9331,_0x164245)[_0xe5a7('0x13')](function(_0x350ec5){logger[_0xe5a7('0x14')]('User,\x20%s,\x20%s',_0x4f8058,'request\x20sent');logger['debug'](_0xe5a7('0x15'),_0x4f8058,_0xe5a7('0x16'),JSON['stringify'](_0x350ec5));if(_0x350ec5[_0xe5a7('0x17')]){if(_0x350ec5['error'][_0xe5a7('0x18')]===0x1f4){logger[_0xe5a7('0x17')]('User,\x20%s,\x20%s',_0x4f8058,_0x350ec5[_0xe5a7('0x17')][_0xe5a7('0x19')]);return _0x5988af(_0x350ec5[_0xe5a7('0x17')][_0xe5a7('0x19')]);}logger[_0xe5a7('0x17')]('User,\x20%s,\x20%s',_0x4f8058,_0x350ec5[_0xe5a7('0x17')][_0xe5a7('0x19')]);return _0x266d6c(_0x350ec5[_0xe5a7('0x17')][_0xe5a7('0x19')]);}else{logger[_0xe5a7('0x14')](_0xe5a7('0x1a'),_0x4f8058,_0xe5a7('0x16'));_0x266d6c(_0x350ec5[_0xe5a7('0x1b')]['message']);}})[_0xe5a7('0x1c')](function(_0x531626){logger[_0xe5a7('0x17')](_0xe5a7('0x1a'),_0x4f8058,_0x531626);_0x5988af(_0x531626);});});}function respondWithStatusCode(_0x7e59b7,_0x5a9eca){_0x5a9eca=_0x5a9eca||0xcc;return function(_0x30b17f){if(_0x30b17f){return _0x7e59b7[_0xe5a7('0x1d')](_0x5a9eca);}return _0x7e59b7[_0xe5a7('0x1e')](_0x5a9eca)[_0xe5a7('0x1f')]();};}function respondWithResult(_0x982e1b,_0x138f2f){_0x138f2f=_0x138f2f||0xc8;return function(_0x4cf280){if(_0x4cf280){return _0x982e1b[_0xe5a7('0x1e')](_0x138f2f)['json'](_0x4cf280);}};}function respondWithFilteredResult(_0x146672,_0x310b12){return function(_0xce9b04){if(_0xce9b04){var _0x2be671=typeof _0x310b12[_0xe5a7('0x20')]===_0xe5a7('0x21')&&typeof _0x310b12['limit']===_0xe5a7('0x21');var _0x3a3d37=_0xce9b04[_0xe5a7('0x22')];var _0x3c493c=_0x2be671?0x0:_0x310b12[_0xe5a7('0x20')];var _0x1f0431=_0x2be671?_0xce9b04[_0xe5a7('0x22')]:_0x310b12[_0xe5a7('0x20')]+_0x310b12[_0xe5a7('0x23')];var _0xf29509;if(_0x1f0431>=_0x3a3d37){_0x1f0431=_0x3a3d37;_0xf29509=0xc8;}else{_0xf29509=0xce;}_0x146672[_0xe5a7('0x1e')](_0xf29509);return _0x146672[_0xe5a7('0x24')](_0xe5a7('0x25'),_0x3c493c+'-'+_0x1f0431+'/'+_0x3a3d37)[_0xe5a7('0x26')](_0xce9b04);}return null;};}function saveUpdates(_0x4377dd){return function(_0x1eba4c){if(_0x1eba4c){return _0x1eba4c['update'](_0x4377dd)[_0xe5a7('0x13')](function(_0x194425){socket['emit'](_0xe5a7('0x27')+_0x194425['id'],{});return _0x194425;});}return null;};}function removeEntity(_0x4a675f){return function(_0x1d5158){if(_0x1d5158){return _0x1d5158['destroy']()['then'](function(){var _0x3fa89f=_0x1d5158['get']({'plain':!![]});if(_0x3fa89f[_0xe5a7('0x28')]===_0xe5a7('0x29'))return;var _0xe02b4a=[{'name':_0xe5a7('0x2a'),'value':_0xe5a7('0x2b'),'ignore':!![]},{'name':_0xe5a7('0x2c'),'value':'agent','ignore':![]},{'name':_0xe5a7('0x2d'),'value':_0xe5a7('0x2e'),'ignore':![]}];var _0x44bd65=_(_0xe02b4a)[_0xe5a7('0x2f')](_0xe5a7('0x30'))[_0xe5a7('0x31')]('value')['value']();if(_[_0xe5a7('0x32')](_0x44bd65,_0x3fa89f['role'])){return;}var _0x478844=_[_0xe5a7('0x33')](_0xe02b4a,[_0xe5a7('0x34'),_0x3fa89f[_0xe5a7('0x28')]])[_0xe5a7('0x35')];return db[_0xe5a7('0x36')]['destroy']({'where':{'type':_0x478844,'resourceId':_0x3fa89f['id']}})['then'](function(){return _0x1d5158;});})[_0xe5a7('0x13')](function(){_0x4a675f[_0xe5a7('0x1e')](0xcc)[_0xe5a7('0x1f')]();});}};}function handleEntityNotFound(_0x1ea331){return function(_0xe590ca){if(!_0xe590ca){_0x1ea331[_0xe5a7('0x1d')](0x194);}return _0xe590ca;};}function handleError(_0xf59f6b,_0xf0bc4b){_0xf0bc4b=_0xf0bc4b||0x1f4;return function(_0x1f744c){logger[_0xe5a7('0x17')](_0x1f744c['stack']);if(_0x1f744c['name']){delete _0x1f744c[_0xe5a7('0x35')];}_0xf59f6b[_0xe5a7('0x1e')](_0xf0bc4b)['send'](_0x1f744c);};}exports[_0xe5a7('0x37')]=function(_0x9b0708,_0xbf2384){var _0x164fa6={},_0x2bf17e={'count':0x0,'rows':[]};var _0x3313bc=_(db[_0xe5a7('0x38')][_0xe5a7('0x39')])[_0xe5a7('0x31')](function(_0x202600){return{'name':_0x202600[_0xe5a7('0x3a')],'type':_0x202600[_0xe5a7('0x3b')]['key']};})['filter'](function(_0x4cd23e){return!_[_0xe5a7('0x32')]([_0xe5a7('0x3c'),_0xe5a7('0x3d')],_0x4cd23e[_0xe5a7('0x35')]);})[_0xe5a7('0x34')]();_0x164fa6=qs[_0xe5a7('0x3e')](_0x3313bc,_0x9b0708);var _0x34a614={'where':_0x164fa6[_0xe5a7('0x3f')]};return db['User']['count'](_0x34a614)['then'](function(_0x56e219){_0x2bf17e[_0xe5a7('0x22')]=_0x56e219;if(_0x9b0708['query'][_0xe5a7('0x40')]){_0x164fa6[_0xe5a7('0x41')]=[{'all':!![]}];}if(_0x9b0708['query'][_0xe5a7('0x42')]===_0xe5a7('0x43')){_0x164fa6[_0xe5a7('0x41')]=[{'model':db[_0xe5a7('0x44')],'as':_0xe5a7('0x42')}];}if(!_[_0xe5a7('0x32')](_0x164fa6[_0xe5a7('0x45')],'id')){_0x164fa6[_0xe5a7('0x45')][_0xe5a7('0x46')]('id');}return db[_0xe5a7('0x38')][_0xe5a7('0x47')](_0x164fa6);})[_0xe5a7('0x13')](function(_0x4f76e5){_0x2bf17e['rows']=_0x4f76e5;if(_0x9b0708[_0xe5a7('0x48')][_0xe5a7('0x49')]==='true'){var _0x1e229e=[];for(var _0x584319=0x0;_0x584319<_0x2bf17e[_0xe5a7('0x4a')][_0xe5a7('0x4b')];_0x584319++){_0x1e229e['push'](get_open_tabs(_0xe5a7('0x4c'),_0x2bf17e[_0xe5a7('0x4a')][_0x584319][_0xe5a7('0x4d')]));_0x1e229e[_0xe5a7('0x46')](get_open_tabs(_0xe5a7('0x4e'),_0x2bf17e[_0xe5a7('0x4a')][_0x584319][_0xe5a7('0x4d')]));_0x1e229e[_0xe5a7('0x46')](get_open_tabs(_0xe5a7('0x4f'),_0x2bf17e[_0xe5a7('0x4a')][_0x584319][_0xe5a7('0x4d')]));_0x1e229e[_0xe5a7('0x46')](get_open_tabs('mail',_0x2bf17e[_0xe5a7('0x4a')][_0x584319][_0xe5a7('0x4d')]));_0x1e229e[_0xe5a7('0x46')](get_open_tabs('openchannel',_0x2bf17e[_0xe5a7('0x4a')][_0x584319][_0xe5a7('0x4d')]));_0x1e229e[_0xe5a7('0x46')](get_open_tabs(_0xe5a7('0x50'),_0x2bf17e['rows'][_0x584319][_0xe5a7('0x4d')]));}return Promise['all'](_0x1e229e)['then'](function(){return _0x2bf17e;});}else{return _0x2bf17e;}})[_0xe5a7('0x13')](respondWithFilteredResult(_0xbf2384,_0x164fa6))[_0xe5a7('0x1c')](handleError(_0xbf2384,null));};exports[_0xe5a7('0x51')]=function(_0x52de79,_0x397374){var _0x14efb7={'raw':![],'where':{'id':_0x52de79[_0xe5a7('0x52')]['id']}},_0x686c15={};_0x686c15[_0xe5a7('0x53')]=_[_0xe5a7('0x54')](_[_0xe5a7('0x55')](db['User'][_0xe5a7('0x39')]),[_0xe5a7('0x3c'),_0xe5a7('0x3d')]);_0x686c15[_0xe5a7('0x48')]=_[_0xe5a7('0x55')](_0x52de79[_0xe5a7('0x48')]);_0x686c15[_0xe5a7('0x56')]=_[_0xe5a7('0x57')](_0x686c15[_0xe5a7('0x53')],_0x686c15['query']);_0x14efb7[_0xe5a7('0x45')]=_['intersection'](_0x686c15[_0xe5a7('0x53')],qs[_0xe5a7('0x58')](_0x52de79['query']['fields']));_0x14efb7[_0xe5a7('0x45')]=_0x14efb7[_0xe5a7('0x45')][_0xe5a7('0x4b')]?_0x14efb7[_0xe5a7('0x45')]:_0x686c15[_0xe5a7('0x53')];if(_0x52de79[_0xe5a7('0x48')]['includeAll']){_0x14efb7['include']=[{'all':!![]}];}if(_0x52de79[_0xe5a7('0x48')][_0xe5a7('0x42')]===_0xe5a7('0x43')){_0x14efb7[_0xe5a7('0x41')]=[{'model':db[_0xe5a7('0x44')],'as':_0xe5a7('0x42')}];}_0x14efb7=_[_0xe5a7('0x59')]({},_0x14efb7,_0x52de79[_0xe5a7('0x5a')]);if(!_[_0xe5a7('0x32')](_0x14efb7['attributes'],'id')){_0x14efb7[_0xe5a7('0x45')][_0xe5a7('0x46')]('id');}return db['User'][_0xe5a7('0x33')](_0x14efb7)['then'](handleEntityNotFound(_0x397374,null))[_0xe5a7('0x13')](function(_0x58f062){var _0x3c1ea5=[];values=_0x58f062;if(_0x52de79[_0xe5a7('0x48')][_0xe5a7('0x49')]===_0xe5a7('0x43')){_0x3c1ea5[_0xe5a7('0x46')](get_open_tabs(_0xe5a7('0x4c'),_0x58f062['dataValues']));_0x3c1ea5[_0xe5a7('0x46')](get_open_tabs(_0xe5a7('0x4e'),_0x58f062[_0xe5a7('0x4d')]));_0x3c1ea5[_0xe5a7('0x46')](get_open_tabs(_0xe5a7('0x5b'),_0x58f062[_0xe5a7('0x4d')]));_0x3c1ea5[_0xe5a7('0x46')](get_open_tabs(_0xe5a7('0x50'),_0x58f062[_0xe5a7('0x4d')]));_0x3c1ea5[_0xe5a7('0x46')](get_open_tabs(_0xe5a7('0x4f'),_0x58f062[_0xe5a7('0x4d')]));_0x3c1ea5[_0xe5a7('0x46')](get_open_tabs(_0xe5a7('0x5c'),_0x58f062[_0xe5a7('0x4d')]));return Promise[_0xe5a7('0x5d')](_0x3c1ea5);}else{return values;}})[_0xe5a7('0x13')](function(){return values;})[_0xe5a7('0x13')](respondWithResult(_0x397374,null))['catch'](handleError(_0x397374,null));};exports[_0xe5a7('0x5e')]=function(_0x194ef7,_0x3e6099){if(_0x194ef7['body']['id']){delete _0x194ef7[_0xe5a7('0x5f')]['id'];}delete _0x194ef7['body'][_0xe5a7('0x28')];return db['User'][_0xe5a7('0x33')]({'where':{'id':_0x194ef7['params']['id']}})['then'](handleEntityNotFound(_0x3e6099,null))[_0xe5a7('0x13')](saveUpdates(_0x194ef7[_0xe5a7('0x5f')],null))[_0xe5a7('0x13')](respondWithResult(_0x3e6099,null))[_0xe5a7('0x1c')](handleError(_0x3e6099,null));};exports['describe']=function(_0x29508a,_0x2c43e9){return db[_0xe5a7('0x38')][_0xe5a7('0x60')]()[_0xe5a7('0x13')](respondWithResult(_0x2c43e9,null))[_0xe5a7('0x1c')](handleError(_0x2c43e9,null));};exports[_0xe5a7('0x61')]=function(_0x46e600,_0x158692){return db[_0xe5a7('0x38')]['find']({'where':{'id':_0x46e600[_0xe5a7('0x52')]['id']}})['then'](handleEntityNotFound(_0x158692,null))[_0xe5a7('0x13')](function(_0x49f9b6){if(_0x49f9b6){return _0x49f9b6[_0xe5a7('0x61')](_0x46e600[_0xe5a7('0x5f')][_0xe5a7('0x62')],_[_0xe5a7('0x63')](_0x46e600[_0xe5a7('0x5f')],[_0xe5a7('0x62'),'id'])||{});}})[_0xe5a7('0x13')](respondWithResult(_0x158692,null))[_0xe5a7('0x1c')](handleError(_0x158692,null));};function validateUser(_0x4393d6){return new Promise(function(_0x3f0b71,_0x2f45cb){if(_0x4393d6[_0xe5a7('0x64')])return _0x3f0b71(_0x4393d6);return db[_0xe5a7('0x65')]['findById'](0x1)[_0xe5a7('0x13')](function(_0x4f0e14){if(_0x4f0e14[_0xe5a7('0x66')])authService[_0xe5a7('0x67')](_0x4393d6['password']);db[_0xe5a7('0x38')][_0xe5a7('0x68')](_0xe5a7('0x64'))['then'](function(_0x1e5ea1){if(_[_0xe5a7('0x69')](_0x1e5ea1)){_0x4393d6[_0xe5a7('0x64')]=_0x4f0e14[_0xe5a7('0x6a')]||0x1;return;}if(_[_0xe5a7('0x69')](_0x4f0e14['min_internal'])||_0x4f0e14[_0xe5a7('0x6a')]===_0x1e5ea1){_0x4393d6[_0xe5a7('0x64')]=_0x1e5ea1+0x1;return;}if(_0x4f0e14[_0xe5a7('0x6a')]>_0x1e5ea1){_0x4393d6[_0xe5a7('0x64')]=_0x4f0e14[_0xe5a7('0x6a')];return;}return db[_0xe5a7('0x6b')][_0xe5a7('0x48')](_0xe5a7('0x6c'),{'type':db['sequelize']['QueryTypes']['SELECT']})[_0xe5a7('0x13')](function(_0x51b982){if(_0x51b982&&_0x51b982[_0xe5a7('0x4b')]){for(var _0x582d1f=0x0,_0x514ced=_0x51b982['length'];_0x582d1f<_0x514ced&&_['isNil'](_0x4393d6[_0xe5a7('0x64')]);_0x582d1f++){if(_0x4f0e14['min_internal']<=_0x51b982[_0x582d1f][_0xe5a7('0x6d')]){_0x4393d6[_0xe5a7('0x64')]=_0x51b982[_0x582d1f][_0xe5a7('0x6d')];}else if(_0x4f0e14[_0xe5a7('0x6a')]>_0x51b982[_0x582d1f]['from']&&_0x4f0e14['min_internal']<=_0x51b982[_0x582d1f]['to']){_0x4393d6[_0xe5a7('0x64')]=_0x4f0e14[_0xe5a7('0x6a')];}}}if(_['isNil'](_0x4393d6['internal'])){_0x4393d6[_0xe5a7('0x64')]=_0x1e5ea1+0x1;}return _0x3f0b71(_0x4393d6);});});})['catch'](function(_0x3807bd){_0x2f45cb(_0x3807bd);});});}function updateUser(_0x3bd2b0){return new Promise(function(_0x37c276,_0x50c0cf){try{if(_0x3bd2b0[_0xe5a7('0x6e')]){_0x3bd2b0['mailbox']=_0x3bd2b0[_0xe5a7('0x64')];_0x3bd2b0['VoiceMail']={'mailbox':_0x3bd2b0[_0xe5a7('0x64')],'password':_0x3bd2b0[_0xe5a7('0x3c')],'fullname':_0x3bd2b0[_0xe5a7('0x6f')],'email':_0x3bd2b0[_0xe5a7('0x70')]};}if(_0x3bd2b0[_0xe5a7('0x28')]===_0xe5a7('0x71')){if(!_0x3bd2b0[_0xe5a7('0x72')])_0x3bd2b0[_0xe5a7('0x72')]=['101','102',_0xe5a7('0x73'),_0xe5a7('0x74'),_0xe5a7('0x75'),'104',_0xe5a7('0x76'),_0xe5a7('0x77'),_0xe5a7('0x78'),'108',_0xe5a7('0x79'),_0xe5a7('0x7a'),_0xe5a7('0x7b'),_0xe5a7('0x7c'),_0xe5a7('0x7d')];}_0x37c276(_0x3bd2b0);}catch(_0xd6895d){_0x50c0cf(_0xd6895d);}});}exports[_0xe5a7('0x7e')]=function(_0x18bb3e,_0x303062){if(_0x18bb3e[_0xe5a7('0x2b')][_0xe5a7('0x28')]==='agent')throw new Error(_0xe5a7('0x7f'));if(_0x18bb3e['body']['role']==='user'&&_0x18bb3e[_0xe5a7('0x2b')][_0xe5a7('0x28')]!==_0xe5a7('0x29')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x18bb3e['body']['role']===_0xe5a7('0x29')&&_0x18bb3e[_0xe5a7('0x2b')]['role']!==_0xe5a7('0x29')){throw new Error(_0xe5a7('0x80'));}return licenseUtil[_0xe5a7('0x81')]([_0x18bb3e[_0xe5a7('0x5f')]])[_0xe5a7('0x13')](function(){return validateUser(_0x18bb3e[_0xe5a7('0x5f')]);})['then'](function(_0xab2602){return updateUser(_0xab2602)['then'](function(_0x5a5cc0){if(_0x5a5cc0['role']===_0xe5a7('0x29')){_0x5a5cc0[_0xe5a7('0x82')]=_0x18bb3e[_0xe5a7('0x2b')][_0xe5a7('0x82')];delete _0x5a5cc0['userProfileId'];}return _0x5a5cc0;});})[_0xe5a7('0x13')](function(_0x5177c5){return db[_0xe5a7('0x38')]['create'](_0x5177c5,{'include':[{'model':db[_0xe5a7('0x83')],'as':_0xe5a7('0x83')}]});})[_0xe5a7('0x13')](function(_0x433f88){if(_0x18bb3e[_0xe5a7('0x5f')][_0xe5a7('0x28')]===_0xe5a7('0x2b'))return _0x433f88;if(_0x18bb3e['user'][_0xe5a7('0x28')]!==_0xe5a7('0x2b'))return _0x433f88;return db['UserProfileSection'][_0xe5a7('0x33')]({'where':{'name':_0x433f88[_0xe5a7('0x28')]==='agent'?_0xe5a7('0x2c'):_0xe5a7('0x2d'),'userProfileId':_0x18bb3e['user'][_0xe5a7('0x84')]},'raw':!![]})['then'](function(_0x456969){if(!_0x456969||_0x456969[_0xe5a7('0x85')]!=0x0)return _0x433f88;return db[_0xe5a7('0x36')][_0xe5a7('0x7e')]({'name':_0x433f88[_0xe5a7('0x35')],'resourceId':_0x433f88['id'],'type':_0x456969['name'],'sectionId':_0x456969['id']},{})[_0xe5a7('0x13')](function(){return _0x433f88;});})[_0xe5a7('0x1c')](function(_0x14130f){logger['error'](_0xe5a7('0x86'),_0x14130f);throw _0x14130f;});})[_0xe5a7('0x13')](respondWithResult(_0x303062,0xc9))[_0xe5a7('0x1c')](handleError(_0x303062,null));};exports[_0xe5a7('0x87')]=function(_0x1aed24,_0x368305){var _0x2efa8e=_0x1aed24[_0xe5a7('0x5f')];var _0x30ee30=[];if(_0x1aed24[_0xe5a7('0x2b')][_0xe5a7('0x28')]===_0xe5a7('0x71'))throw new Error('Unauthorized');if(_[_0xe5a7('0x88')](_0x2efa8e,[_0xe5a7('0x28'),_0xe5a7('0x2b')])&&_0x1aed24[_0xe5a7('0x2b')][_0xe5a7('0x28')]!=='admin'){throw new Error(_0xe5a7('0x89'));}if(_[_0xe5a7('0x88')](_0x2efa8e,[_0xe5a7('0x28'),_0xe5a7('0x29')])&&_0x1aed24[_0xe5a7('0x2b')][_0xe5a7('0x28')]!==_0xe5a7('0x29')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil['checkUserLimits'](_0x2efa8e)[_0xe5a7('0x13')](function(){return validateUser(_0x2efa8e[0x0]);})['then'](function(){for(var _0x504d65=0x1;_0x504d65<_0x2efa8e['length'];_0x504d65++){var _0x4d1608=_0x2efa8e[_0x504d65-0x1][_0xe5a7('0x64')];if(!_0x2efa8e[_0x504d65][_0xe5a7('0x64')])_0x2efa8e[_0x504d65][_0xe5a7('0x64')]=_0x4d1608+0x1;_0x30ee30[_0xe5a7('0x46')](validateUser(_0x2efa8e[_0x504d65]));}return Promise[_0xe5a7('0x5d')](_0x30ee30);})[_0xe5a7('0x13')](function(){_0x30ee30=[];for(var _0x3bc47c=0x0;_0x3bc47c<_0x2efa8e[_0xe5a7('0x4b')];_0x3bc47c++){_0x30ee30[_0xe5a7('0x46')](updateUser(_0x2efa8e[_0x3bc47c]));}return Promise[_0xe5a7('0x5d')](_0x30ee30);})[_0xe5a7('0x13')](function(){_0x30ee30=_0x2efa8e[_0xe5a7('0x31')](function(_0x1a9710){return db[_0xe5a7('0x38')][_0xe5a7('0x7e')](_0x1a9710,{'include':[{'model':db[_0xe5a7('0x83')],'as':_0xe5a7('0x83')}]})[_0xe5a7('0x13')](function(_0x494fa5){_0x1a9710['id']=_0x494fa5['id'];return _0x1a9710;});});return Promise['all'](_0x30ee30);})[_0xe5a7('0x13')](function(_0x697aec){if(_0x1aed24[_0xe5a7('0x5f')][_0xe5a7('0x28')]===_0xe5a7('0x2b'))return _0x697aec;if(_0x1aed24[_0xe5a7('0x2b')][_0xe5a7('0x28')]!==_0xe5a7('0x2b'))return _0x697aec;var _0x1b1d14=_[_0xe5a7('0x88')](_0x697aec,function(_0xa4c1ea){return _0xa4c1ea[_0xe5a7('0x28')]===_0xe5a7('0x71')||_0xa4c1ea[_0xe5a7('0x28')]==='telephone';});if(!_0x1b1d14)return _0x697aec;return db[_0xe5a7('0x8a')][_0xe5a7('0x47')]({'where':{'name':{'$or':[_0xe5a7('0x2c'),'Telephones']},'userProfileId':_0x1aed24[_0xe5a7('0x2b')][_0xe5a7('0x84')]},'raw':!![]})[_0xe5a7('0x13')](function(_0x3f719d){if(_[_0xe5a7('0x8b')](_0x3f719d)||!_[_0xe5a7('0x88')](_0x3f719d,['autoAssociation',0x0]))return _0x697aec;_0x30ee30=[];var _0x1d5aa9=_(_0x3f719d)[_0xe5a7('0x31')](function(_0x76e2cd){if(_0x76e2cd['autoAssociation']===0x1)return;return _0x76e2cd[_0xe5a7('0x35')]==='Agents'?'agent':_0xe5a7('0x2e');})[_0xe5a7('0x8c')]()[_0xe5a7('0x34')]();for(var _0x2313c1=0x0;_0x2313c1<_0x697aec[_0xe5a7('0x4b')];_0x2313c1++){if(!_['includes'](_0x1d5aa9,_0x697aec[_0x2313c1][_0xe5a7('0x28')]))return;var _0x2817d0=_0x697aec[_0x2313c1][_0xe5a7('0x28')]===_0xe5a7('0x71')?_0xe5a7('0x2c'):'Telephones';_0x30ee30[_0xe5a7('0x46')](db[_0xe5a7('0x36')][_0xe5a7('0x7e')]({'name':_0x697aec[_0x2313c1][_0xe5a7('0x35')],'resourceId':_0x697aec[_0x2313c1]['id'],'type':_0x2817d0,'sectionId':_['find'](_0x3f719d,[_0xe5a7('0x35'),_0x2817d0])['id']},{}));}return Promise[_0xe5a7('0x5d')](_0x30ee30);});})[_0xe5a7('0x13')](respondWithResult(_0x368305,0xc9))[_0xe5a7('0x1c')](handleError(_0x368305,null));};exports[_0xe5a7('0x8d')]=function(_0x976671,_0x1f388c){if(_0x976671[_0xe5a7('0x5f')]['id']){delete _0x976671[_0xe5a7('0x5f')]['id'];}return db[_0xe5a7('0x38')][_0xe5a7('0x33')]({'where':{'id':_0x976671[_0xe5a7('0x52')]['id']}})[_0xe5a7('0x13')](function(_0x8f0510){if(!_0x8f0510)return null;if(_0x8f0510['id']===_0x976671[_0xe5a7('0x2b')]['id']){if(!_0x976671[_0xe5a7('0x5f')][_0xe5a7('0x8e')]||!_0x976671[_0xe5a7('0x5f')][_0xe5a7('0x8f')]){throw new db['Sequelize'][(_0xe5a7('0x90'))](_0xe5a7('0x91'));}if(!_0x8f0510[_0xe5a7('0x92')](_0x976671[_0xe5a7('0x5f')][_0xe5a7('0x8e')])){throw new db[(_0xe5a7('0x93'))][(_0xe5a7('0x90'))](_0xe5a7('0x94'));}if(_0x976671['body']['oldPassword']===_0x976671[_0xe5a7('0x5f')][_0xe5a7('0x8f')]){throw new db[(_0xe5a7('0x93'))][(_0xe5a7('0x90'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x976671[_0xe5a7('0x2b')]['role']===_0xe5a7('0x29')){if(!_0x976671[_0xe5a7('0x5f')][_0xe5a7('0x8f')]){throw new db['Sequelize']['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x976671[_0xe5a7('0x2b')][_0xe5a7('0x28')]==='user'){if(!_0x976671[_0xe5a7('0x5f')][_0xe5a7('0x8f')]){throw new db[(_0xe5a7('0x93'))][(_0xe5a7('0x90'))](_0xe5a7('0x95'));}if(_0x8f0510[_0xe5a7('0x28')]!==_0xe5a7('0x71')){throw new db[(_0xe5a7('0x93'))]['ValidationError'](_0xe5a7('0x7f'));}}else{throw new db[(_0xe5a7('0x93'))][(_0xe5a7('0x90'))](_0xe5a7('0x7f'));}return _0x8f0510;})[_0xe5a7('0x13')](handleEntityNotFound(_0x1f388c,null))[_0xe5a7('0x13')](function(_0x4d1817){return db[_0xe5a7('0x65')][_0xe5a7('0x96')]({'attributes':['id',_0xe5a7('0x66'),'enforcePasswordHistory',_0xe5a7('0x97')]})[_0xe5a7('0x13')](function(_0x1d2f93){if(_0x1d2f93[_0xe5a7('0x66')])authService[_0xe5a7('0x67')](_0x976671[_0xe5a7('0x5f')][_0xe5a7('0x8f')]);if(!_0x1d2f93[_0xe5a7('0x98')]||!_0x4d1817[_0xe5a7('0x99')])return _0x4d1817;authService[_0xe5a7('0x9a')](_0x976671[_0xe5a7('0x5f')][_0xe5a7('0x8f')],_0x4d1817[_0xe5a7('0x99')],_0x1d2f93['passwordHistoryLimit']);return _0x4d1817;})['then'](saveUpdates({'password':_0x976671[_0xe5a7('0x5f')][_0xe5a7('0x8f')],'passwordResetAt':_0x976671[_0xe5a7('0x2b')]['id']==_0x976671['params']['id']?moment():null,'previousPasswords':authService[_0xe5a7('0x9b')](_0x976671['body'][_0xe5a7('0x8f')],_0x4d1817[_0xe5a7('0x99')])},null));})['then'](respondWithResult(_0x1f388c,null))['catch'](handleError(_0x1f388c,null));};exports['addQueues']=function(_0x69af54,_0x2f6316){var _0x571deb=_0x69af54[_0xe5a7('0x5f')][_0xe5a7('0x9c')];return db[_0xe5a7('0x38')][_0xe5a7('0x33')]({'where':{'id':_0x69af54[_0xe5a7('0x52')]['id']},'attributes':['id',_0xe5a7('0x35'),_0xe5a7('0x28'),_0xe5a7('0x9d'),_0xe5a7('0x9e'),'voicePause',_0xe5a7('0x9f')]})['then'](handleEntityNotFound(_0x2f6316,null))[_0xe5a7('0x13')](function(_0x469ecc){if(_0x469ecc){if(!utils[_0xe5a7('0xa0')](_0x571deb)){throw new db[(_0xe5a7('0x93'))]['ValidationError'](_0xe5a7('0xa1'));}return _0x469ecc[_0xe5a7('0xa2')+_[_0xe5a7('0xa3')](_0x571deb[_0xe5a7('0xa4')]())+'Queues'](_0x69af54[_0xe5a7('0x5f')][_0xe5a7('0x62')],{'penalty':_0x69af54['body'][_0xe5a7('0xa5')]||0x0})[_0xe5a7('0xa6')](function(_0x590843){for(var _0x4b9e5c=0x0;_0x4b9e5c<_0x69af54[_0xe5a7('0x5f')][_0xe5a7('0x62')][_0xe5a7('0x4b')];_0x4b9e5c+=0x1){var _0x188169={'UserId':Number(_0x69af54[_0xe5a7('0x52')]['id'])};_0x188169[_[_0xe5a7('0xa3')](_0x571deb['toLowerCase']())+'QueueId']=Number(_0x69af54[_0xe5a7('0x5f')][_0xe5a7('0x62')][_0x4b9e5c]);socket[_0xe5a7('0xa7')](_0xe5a7('0x2b')+_[_0xe5a7('0xa3')](_0x571deb[_0xe5a7('0xa4')]())+_0xe5a7('0xa8'),_0x188169);}return _0x590843;})[_0xe5a7('0x13')](function(){if(_0x571deb===_0xe5a7('0xa9')){return db[_0xe5a7('0xaa')][_0xe5a7('0x47')]({'where':{'id':_0x69af54['body'][_0xe5a7('0x62')]||[]},'raw':!![],'attributes':['id',_0xe5a7('0x35')]});}})[_0xe5a7('0x13')](function(_0x577b03){var _0x3487e0=_0x469ecc[_0xe5a7('0xab')]({'plain':!![]});var _0x40cff5=[];if(_0x571deb===_0xe5a7('0xa9')&&_0x3487e0[_0xe5a7('0x28')]===_0xe5a7('0x71')&&_0x3487e0[_0xe5a7('0x9d')]){for(let _0x15c155=0x0;_0x15c155<_0x577b03[_0xe5a7('0x4b')];_0x15c155+=0x1){_0x40cff5[_0xe5a7('0x46')]({'membername':_0x3487e0[_0xe5a7('0x35')],'UserId':_0x3487e0['id'],'queue_name':_0x577b03[_0x15c155][_0xe5a7('0x35')],'VoiceQueueId':_0x577b03[_0x15c155]['id'],'interface':_[_0xe5a7('0x69')](_0x3487e0[_0xe5a7('0x9f')])?util['format'](_0xe5a7('0xac'),_0x3487e0[_0xe5a7('0x35')]):_0x3487e0['interface'],'paused':_0x3487e0[_0xe5a7('0xad')]||![],'penalty':_0x69af54[_0xe5a7('0x5f')][_0xe5a7('0xa5')]||0x0});}return Promise[_0xe5a7('0x5d')](_0x40cff5[_0xe5a7('0x31')](function(_0x1dd764){return db[_0xe5a7('0xae')]['upsert'](_0x1dd764);}));}return _0x469ecc;});}})[_0xe5a7('0x13')](respondWithStatusCode(_0x2f6316,null))[_0xe5a7('0x1c')](handleError(_0x2f6316,null));};exports[_0xe5a7('0xaf')]=function(_0x44aeff,_0x50c20d){var _0xe79cd4,_0x118be5;return db[_0xe5a7('0x38')][_0xe5a7('0x33')]({'where':{'id':_0x44aeff[_0xe5a7('0x52')]['id']},'attributes':['id',_0xe5a7('0x35'),_0xe5a7('0x28')]})[_0xe5a7('0x13')](handleEntityNotFound(_0x50c20d,null))[_0xe5a7('0x13')](function(_0xb15f03){if(_0xb15f03){_0xe79cd4=_0xb15f03;if(!_0x44aeff['query'][_0xe5a7('0x9c')]||!utils[_0xe5a7('0xa0')](_0x44aeff[_0xe5a7('0x48')][_0xe5a7('0x9c')])){throw new db[(_0xe5a7('0x93'))][(_0xe5a7('0x90'))]('Unknown\x20channel');}return _0xb15f03[_0xe5a7('0xb0')+_[_0xe5a7('0xa3')](_0x44aeff[_0xe5a7('0x48')][_0xe5a7('0x9c')][_0xe5a7('0xa4')]())+'Queues'](_0x44aeff[_0xe5a7('0x48')][_0xe5a7('0x62')]);}})[_0xe5a7('0x13')](function(_0x236a09){if(_['isArray'](_0x44aeff[_0xe5a7('0x48')]['ids'])){for(var _0xa4e330=0x0;_0xa4e330<_0x44aeff[_0xe5a7('0x48')]['ids'][_0xe5a7('0x4b')];_0xa4e330+=0x1){_0x118be5={'UserId':Number(_0x44aeff[_0xe5a7('0x52')]['id'])};_0x118be5[_[_0xe5a7('0xa3')](_0x44aeff[_0xe5a7('0x48')][_0xe5a7('0x9c')][_0xe5a7('0xa4')]())+'QueueId']=Number(_0x44aeff['query'][_0xe5a7('0x62')][_0xa4e330]);socket[_0xe5a7('0xa7')]('user'+_[_0xe5a7('0xa3')](_0x44aeff['query']['channel']['toLowerCase']())+_0xe5a7('0xb1'),_0x118be5);}}else{_0x118be5={'UserId':Number(_0x44aeff[_0xe5a7('0x52')]['id'])};_0x118be5[_[_0xe5a7('0xa3')](_0x44aeff[_0xe5a7('0x48')]['channel'][_0xe5a7('0xa4')]())+_0xe5a7('0xb2')]=Number(_0x44aeff[_0xe5a7('0x48')][_0xe5a7('0x62')]);socket[_0xe5a7('0xa7')](_0xe5a7('0x2b')+_[_0xe5a7('0xa3')](_0x44aeff['query']['channel'][_0xe5a7('0xa4')]())+_0xe5a7('0xb1'),_0x118be5);}return _0x236a09;})[_0xe5a7('0x13')](function(){if(_0x44aeff['query'][_0xe5a7('0x9c')]===_0xe5a7('0xa9')){return db[_0xe5a7('0xae')]['destroy']({'where':{'UserId':_0x44aeff[_0xe5a7('0x52')]['id'],'VoiceQueueId':_0x44aeff[_0xe5a7('0x48')][_0xe5a7('0x62')]},'individualHooks':!![]})[_0xe5a7('0x13')](function(){return _0xe79cd4;});}return _0xe79cd4;})['then'](respondWithStatusCode(_0x50c20d,null))[_0xe5a7('0x1c')](handleError(_0x50c20d,null));};exports['addAvatar']=function(_0xf9d000,_0x34bdc9){_0xf9d000[_0xe5a7('0x5f')]['userpic']=_0xf9d000[_0xe5a7('0xb3')][_0xe5a7('0xb4')];return db[_0xe5a7('0x38')][_0xe5a7('0x33')]({'where':{'id':_0xf9d000[_0xe5a7('0x52')]['id']}})[_0xe5a7('0x13')](handleEntityNotFound(_0x34bdc9,null))[_0xe5a7('0x13')](saveUpdates(_0xf9d000[_0xe5a7('0x5f')],null))['then'](respondWithResult(_0x34bdc9,null))['catch'](handleError(_0x34bdc9,null));};exports['getAvatar']=function(_0x40e085,_0x358c9d){var _0x3c4561=path[_0xe5a7('0xb5')](config['root'],_0xe5a7('0xb6'));return db[_0xe5a7('0x38')][_0xe5a7('0x33')]({'where':{'id':_0x40e085['params']['id']},'attributes':['id',_0xe5a7('0xb7')],'raw':!![]})[_0xe5a7('0x13')](handleEntityNotFound(_0x358c9d,null))[_0xe5a7('0x13')](function(_0x15f9cf){if(_0x15f9cf){if(_['isNil'](_0x15f9cf[_0xe5a7('0xb7')])){return _0x358c9d['download'](_0x3c4561);}else{if(!fs['existsSync'](path['join'](config[_0xe5a7('0xb8')],_0xe5a7('0xb9'),_0x15f9cf[_0xe5a7('0xb7')]))){return _0x358c9d[_0xe5a7('0xba')](_0x3c4561);}return _0x358c9d[_0xe5a7('0xba')](path[_0xe5a7('0xb5')](config['root'],_0xe5a7('0xb9'),_0x15f9cf[_0xe5a7('0xb7')]));}}})[_0xe5a7('0x1c')](handleError(_0x358c9d,null));};exports[_0xe5a7('0xbb')]=function(_0x3baec2,_0x568dc4){return db[_0xe5a7('0x38')]['find']({'where':{'id':_0x3baec2['params']['id']},'attributes':['id']})[_0xe5a7('0x13')](handleEntityNotFound(_0x568dc4,null))[_0xe5a7('0x13')](function(_0x48e9a7){var _0x6a2aae=[];values=_0x48e9a7['dataValues'];_0x6a2aae[_0xe5a7('0x46')](get_open_tabs(_0xe5a7('0x4c'),_0x48e9a7[_0xe5a7('0x4d')]));_0x6a2aae[_0xe5a7('0x46')](get_open_tabs(_0xe5a7('0x4e'),_0x48e9a7['dataValues']));_0x6a2aae[_0xe5a7('0x46')](get_open_tabs(_0xe5a7('0x5b'),_0x48e9a7['dataValues']));_0x6a2aae[_0xe5a7('0x46')](get_open_tabs(_0xe5a7('0x50'),_0x48e9a7[_0xe5a7('0x4d')]));_0x6a2aae[_0xe5a7('0x46')](get_open_tabs('fax',_0x48e9a7['dataValues']));_0x6a2aae[_0xe5a7('0x46')](get_open_tabs('mail',_0x48e9a7[_0xe5a7('0x4d')]));return Promise[_0xe5a7('0x5d')](_0x6a2aae);})[_0xe5a7('0x13')](function(_0x235eac){if(_0x235eac){var _0x5905fd=_[_0xe5a7('0x31')](values[_0xe5a7('0xbc')],function(_0x5686a0){return{'channel':_0xe5a7('0xbd'),'id':_0x5686a0['id'],'createdAt':_0x5686a0[_0xe5a7('0xbe')]};});var _0x56a6cd=_['map'](values['FaxOpenTabs'],function(_0x2c45ba){return{'channel':_0xe5a7('0xbf'),'id':_0x2c45ba['id'],'createdAt':_0x2c45ba[_0xe5a7('0xbe')]};});var _0x5ea77a=_[_0xe5a7('0x31')](values[_0xe5a7('0xc0')],function(_0x4c948c){return{'channel':_0xe5a7('0xc1'),'id':_0x4c948c['id'],'createdAt':_0x4c948c['createdAt']};});var _0x1f7356=_['map'](values[_0xe5a7('0xc2')],function(_0x51715b){return{'channel':_0xe5a7('0xc3'),'id':_0x51715b['id'],'createdAt':_0x51715b['createdAt']};});var _0x245184=_[_0xe5a7('0x31')](values[_0xe5a7('0xc4')],function(_0x5e1751){return{'channel':'SMS','id':_0x5e1751['id'],'createdAt':_0x5e1751[_0xe5a7('0xbe')]};});var _0x53a19c=_['map'](values[_0xe5a7('0xc5')],function(_0x5246c5){return{'channel':_0xe5a7('0xc6'),'id':_0x5246c5['id'],'createdAt':_0x5246c5[_0xe5a7('0xbe')]};});var _0x1b102e=_[_0xe5a7('0xc7')](_0x5905fd,_0x56a6cd,_0x5ea77a,_0x1f7356,_0x245184,_0x53a19c);var _0x366e07={'count':_0x1b102e[_0xe5a7('0x4b')],'rows':_0x1b102e};return _0x366e07;}else return null;})[_0xe5a7('0x13')](respondWithResult(_0x568dc4,null))[_0xe5a7('0x1c')](handleError(_0x568dc4,null));};exports[_0xe5a7('0xc8')]=function(_0x52f06f,_0x1b74ea){var _0x52dcad={};var _0x42acb4={};var _0x3b651a;var _0x3a0445;return db['User'][_0xe5a7('0x96')]({'where':{'id':_0x52f06f['params']['id']}})[_0xe5a7('0x13')](handleEntityNotFound(_0x1b74ea,null))[_0xe5a7('0x13')](function(_0x5eedf5){if(_0x5eedf5){_0x3b651a=_0x5eedf5;_0x42acb4[_0xe5a7('0x53')]=_['keys'](db[_0xe5a7('0xc9')][_0xe5a7('0x39')]);_0x42acb4[_0xe5a7('0x48')]=_['keys'](_0x52f06f['query']);_0x42acb4['filters']=_[_0xe5a7('0x57')](_0x42acb4['model'],_0x42acb4[_0xe5a7('0x48')]);_0x52dcad[_0xe5a7('0x45')]=_['intersection'](_0x42acb4[_0xe5a7('0x53')],qs[_0xe5a7('0x58')](_0x52f06f['query'][_0xe5a7('0x58')]));_0x52dcad[_0xe5a7('0x45')]=_0x52dcad[_0xe5a7('0x45')]['length']?_0x52dcad['attributes']:_0x42acb4['model'];_0x52dcad['order']=qs[_0xe5a7('0xca')](_0x52f06f['query'][_0xe5a7('0xca')]);_0x52dcad[_0xe5a7('0x3f')]=qs[_0xe5a7('0x56')](_['pick'](_0x52f06f[_0xe5a7('0x48')],_0x42acb4[_0xe5a7('0x56')]));if(_0x52f06f[_0xe5a7('0x48')]['filter']){_0x52dcad[_0xe5a7('0x3f')]=_[_0xe5a7('0x59')](_0x52dcad[_0xe5a7('0x3f')],{'$or':_[_0xe5a7('0x31')](_0x52dcad[_0xe5a7('0x45')],function(_0x4fffa1){var _0x5daf65={};_0x5daf65[_0x4fffa1]={'$like':'%'+_0x52f06f[_0xe5a7('0x48')][_0xe5a7('0x2f')]+'%'};return _0x5daf65;})});}_0x52dcad=_[_0xe5a7('0x59')]({},_0x52dcad,_0x52f06f[_0xe5a7('0x5a')]);return _0x3b651a[_0xe5a7('0xc8')](_0x52dcad);}})[_0xe5a7('0x13')](function(_0x332332){if(_0x332332){_0x3a0445=_0x332332[_0xe5a7('0x4b')];if(_0x52f06f[_0xe5a7('0x48')]['hasOwnProperty'](_0xe5a7('0x40'))){_0x52dcad['include']=[{'model':db[_0xe5a7('0xcb')],'as':_0xe5a7('0xcc'),'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xe5a7('0x35'),_0xe5a7('0xcd')],'where':_0x52f06f[_0xe5a7('0x48')][_0xe5a7('0xce')]?{'id':_0x52f06f['query'][_0xe5a7('0xce')]}:undefined,'required':_0x52f06f[_0xe5a7('0x48')][_0xe5a7('0xce')]?!![]:![]}];}if(!_0x52f06f[_0xe5a7('0x48')][_0xe5a7('0xcf')](_0xe5a7('0xd0'))){_0x52dcad['limit']=qs[_0xe5a7('0x23')](_0x52f06f[_0xe5a7('0x48')][_0xe5a7('0x23')]);_0x52dcad[_0xe5a7('0x20')]=qs[_0xe5a7('0x20')](_0x52f06f[_0xe5a7('0x48')]['offset']);}return _0x3b651a[_0xe5a7('0xc8')](_0x52dcad);}})[_0xe5a7('0x13')](function(_0x4d12e2){if(_0x4d12e2){return _0x4d12e2?{'count':_0x3a0445,'rows':_0x4d12e2}:null;}})[_0xe5a7('0x13')](respondWithResult(_0x1b74ea,null))['catch'](handleError(_0x1b74ea,null));};exports['getQueues']=function(_0x535feb,_0x9435d1){var _0x2755d0;var _0x5c72b9={};var _0x4ad338;return db[_0xe5a7('0x38')][_0xe5a7('0x96')]({'where':{'id':_0x535feb[_0xe5a7('0x52')]['id']},'attributes':['id','name',_0xe5a7('0x28')]})[_0xe5a7('0x13')](handleEntityNotFound(_0x9435d1,null))[_0xe5a7('0x13')](function(_0x135f8b){if(!utils[_0xe5a7('0xa0')](_0x535feb[_0xe5a7('0x48')][_0xe5a7('0x9c')])){throw new db[(_0xe5a7('0x93'))][(_0xe5a7('0x90'))]('Unknown\x20channel');}_0x2755d0=_0x135f8b;var _0x29efed={};_0x29efed[_0xe5a7('0x53')]=_['keys'](db[_[_0xe5a7('0xa3')](_0x535feb['query']['channel'])+_0xe5a7('0xd1')][_0xe5a7('0x39')]);_0x29efed[_0xe5a7('0x48')]=_[_0xe5a7('0x55')](_0x535feb[_0xe5a7('0x48')]);_0x29efed['filters']=_[_0xe5a7('0x57')](_0x29efed['model'],_0x29efed[_0xe5a7('0x48')]);_0x5c72b9[_0xe5a7('0x45')]=_[_0xe5a7('0x57')](_0x29efed[_0xe5a7('0x53')],qs[_0xe5a7('0x58')](_0x535feb[_0xe5a7('0x48')]['fields']));_0x5c72b9['attributes']=_0x5c72b9['attributes'][_0xe5a7('0x4b')]?_0x5c72b9[_0xe5a7('0x45')]:_0x29efed[_0xe5a7('0x53')];_0x5c72b9[_0xe5a7('0xd2')]=qs[_0xe5a7('0xca')](_0x535feb[_0xe5a7('0x48')][_0xe5a7('0xca')]);_0x5c72b9[_0xe5a7('0x3f')]=qs[_0xe5a7('0x56')](_['pick'](_0x535feb[_0xe5a7('0x48')],_0x29efed[_0xe5a7('0x56')]));if(_0x535feb['query']['filter']){_0x5c72b9[_0xe5a7('0x3f')]=_[_0xe5a7('0x59')](_0x5c72b9[_0xe5a7('0x3f')],{'$or':_[_0xe5a7('0x31')](_0x5c72b9[_0xe5a7('0x45')],function(_0x521e9c){var _0x55b584={};_0x55b584[_0x521e9c]={'$like':'%'+_0x535feb[_0xe5a7('0x48')]['filter']+'%'};return _0x55b584;})});}_0x5c72b9=_[_0xe5a7('0x59')]({},_0x5c72b9,_0x535feb[_0xe5a7('0x5a')]);switch(_0x2755d0['role']){case'admin':return db[_[_0xe5a7('0xa3')](_0x535feb[_0xe5a7('0x48')][_0xe5a7('0x9c')])+_0xe5a7('0xd1')]['findAll'](_0x5c72b9);case _0xe5a7('0x2b'):case _0xe5a7('0x71'):return _0x2755d0[_0xe5a7('0xab')+_[_0xe5a7('0xa3')](_0x535feb[_0xe5a7('0x48')]['channel'])+_0xe5a7('0xd3')](_0x5c72b9);default:throw new db[(_0xe5a7('0x93'))][(_0xe5a7('0x90'))](_0xe5a7('0xd4'));}})[_0xe5a7('0x13')](function(_0x3bdfdd){_0x4ad338=_0x3bdfdd[_0xe5a7('0x4b')];if(!_0x535feb['query'][_0xe5a7('0xcf')](_0xe5a7('0xd0'))){_0x5c72b9[_0xe5a7('0x23')]=qs[_0xe5a7('0x23')](_0x535feb[_0xe5a7('0x48')][_0xe5a7('0x23')]);_0x5c72b9[_0xe5a7('0x20')]=qs[_0xe5a7('0x20')](_0x535feb[_0xe5a7('0x48')]['offset']);}switch(_0x2755d0[_0xe5a7('0x28')]){case _0xe5a7('0x29'):return db[_[_0xe5a7('0xa3')](_0x535feb[_0xe5a7('0x48')][_0xe5a7('0x9c')])+'Queue'][_0xe5a7('0x47')](_0x5c72b9);case'user':case _0xe5a7('0x71'):return _0x2755d0[_0xe5a7('0xab')+_['capitalize'](_0x535feb[_0xe5a7('0x48')][_0xe5a7('0x9c')])+'Queues'](_0x5c72b9);}})[_0xe5a7('0x13')](function(_0x41cc69){return{'count':_0x4ad338,'rows':_0x41cc69};})['then'](respondWithResult(_0x9435d1,null))[_0xe5a7('0x1c')](handleError(_0x9435d1,null));};exports[_0xe5a7('0xd5')]=function(_0x2e58e4,_0x3ee9ac){var _0x17b511={};var _0x423115={};var _0xa99e63;var _0x4c1883;return db[_0xe5a7('0x38')][_0xe5a7('0x96')]({'where':{'id':_0x2e58e4[_0xe5a7('0x52')]['id']}})[_0xe5a7('0x13')](handleEntityNotFound(_0x3ee9ac,null))[_0xe5a7('0x13')](function(_0x26f3a9){if(_0x26f3a9){_0xa99e63=_0x26f3a9;_0x423115[_0xe5a7('0x53')]=_['keys'](db['UserVoiceQueueRt'][_0xe5a7('0x39')]);_0x423115[_0xe5a7('0x48')]=_[_0xe5a7('0x55')](_0x2e58e4[_0xe5a7('0x48')]);_0x423115[_0xe5a7('0x56')]=_['intersection'](_0x423115['model'],_0x423115[_0xe5a7('0x48')]);_0x17b511[_0xe5a7('0x45')]=_['intersection'](_0x423115[_0xe5a7('0x53')],qs[_0xe5a7('0x58')](_0x2e58e4['query'][_0xe5a7('0x58')]));_0x17b511['attributes']=_0x17b511[_0xe5a7('0x45')][_0xe5a7('0x4b')]?_0x17b511[_0xe5a7('0x45')]:_0x423115[_0xe5a7('0x53')];_0x17b511[_0xe5a7('0xd2')]=qs['sort'](_0x2e58e4[_0xe5a7('0x48')][_0xe5a7('0xca')]);_0x17b511['where']=qs['filters'](_[_0xe5a7('0xd6')](_0x2e58e4[_0xe5a7('0x48')],_0x423115['filters']));if(_0x2e58e4[_0xe5a7('0x48')][_0xe5a7('0x2f')]){_0x17b511['where']=_[_0xe5a7('0x59')](_0x17b511[_0xe5a7('0x3f')],{'$or':_[_0xe5a7('0x31')](_0x17b511['attributes'],function(_0x41c9ce){var _0x116cc5={};_0x116cc5[_0x41c9ce]={'$like':'%'+_0x2e58e4['query'][_0xe5a7('0x2f')]+'%'};return _0x116cc5;})});}_0x17b511=_[_0xe5a7('0x59')]({},_0x17b511,_0x2e58e4['options']);return _0xa99e63[_0xe5a7('0xd5')](_0x17b511);}})['then'](function(_0x1d835a){if(_0x1d835a){_0x4c1883=_0x1d835a[_0xe5a7('0x4b')];if(!_0x2e58e4[_0xe5a7('0x48')]['hasOwnProperty'](_0xe5a7('0xd0'))){_0x17b511[_0xe5a7('0x23')]=qs['limit'](_0x2e58e4[_0xe5a7('0x48')]['limit']);_0x17b511[_0xe5a7('0x20')]=qs['offset'](_0x2e58e4[_0xe5a7('0x48')][_0xe5a7('0x20')]);}return _0xa99e63[_0xe5a7('0xd5')](_0x17b511);}})[_0xe5a7('0x13')](function(_0x149932){if(_0x149932){return _0x149932?{'count':_0x4c1883,'rows':_0x149932}:null;}})[_0xe5a7('0x13')](respondWithResult(_0x3ee9ac,null))[_0xe5a7('0x1c')](handleError(_0x3ee9ac,null));};exports['getGroups']=function(_0x3e5556,_0x48f152){var _0x2c1524={};var _0x18c713={};var _0x29e045;var _0xa77b6f;return db['User']['findOne']({'where':{'id':_0x3e5556[_0xe5a7('0x52')]['id']}})['then'](handleEntityNotFound(_0x48f152,null))[_0xe5a7('0x13')](function(_0x24bae4){if(_0x24bae4){_0x29e045=_0x24bae4;_0x18c713['model']=_['keys'](db[_0xe5a7('0xd7')][_0xe5a7('0x39')]);_0x18c713[_0xe5a7('0x48')]=_['keys'](_0x3e5556[_0xe5a7('0x48')]);_0x18c713[_0xe5a7('0x56')]=_[_0xe5a7('0x57')](_0x18c713[_0xe5a7('0x53')],_0x18c713['query']);_0x2c1524[_0xe5a7('0x45')]=_['intersection'](_0x18c713[_0xe5a7('0x53')],qs['fields'](_0x3e5556[_0xe5a7('0x48')][_0xe5a7('0x58')]));_0x2c1524['attributes']=_0x2c1524[_0xe5a7('0x45')][_0xe5a7('0x4b')]?_0x2c1524[_0xe5a7('0x45')]:_0x18c713['model'];_0x2c1524[_0xe5a7('0xd2')]=qs['sort'](_0x3e5556[_0xe5a7('0x48')]['sort']);_0x2c1524[_0xe5a7('0x3f')]=qs[_0xe5a7('0x56')](_[_0xe5a7('0xd6')](_0x3e5556[_0xe5a7('0x48')],_0x18c713['filters']));if(_0x3e5556['query'][_0xe5a7('0x2f')]){_0x2c1524['where']=_['merge'](_0x2c1524[_0xe5a7('0x3f')],{'$or':_[_0xe5a7('0x31')](_0x2c1524[_0xe5a7('0x45')],function(_0x33eb39){var _0xffe28a={};_0xffe28a[_0x33eb39]={'$like':'%'+_0x3e5556[_0xe5a7('0x48')]['filter']+'%'};return _0xffe28a;})});}_0x2c1524=_['merge']({},_0x2c1524,_0x3e5556[_0xe5a7('0x5a')]);return _0x29e045[_0xe5a7('0xd8')](_0x2c1524);}})['then'](function(_0x289bdf){if(_0x289bdf){_0xa77b6f=_0x289bdf[_0xe5a7('0x4b')];if(!_0x3e5556[_0xe5a7('0x48')][_0xe5a7('0xcf')](_0xe5a7('0xd0'))){_0x2c1524[_0xe5a7('0x23')]=qs['limit'](_0x3e5556[_0xe5a7('0x48')][_0xe5a7('0x23')]);_0x2c1524[_0xe5a7('0x20')]=qs['offset'](_0x3e5556['query'][_0xe5a7('0x20')]);}return _0x29e045[_0xe5a7('0xd8')](_0x2c1524);}})[_0xe5a7('0x13')](function(_0x15aae1){if(_0x15aae1){return _0x15aae1?{'count':_0xa77b6f,'rows':_0x15aae1}:null;}})['then'](respondWithResult(_0x48f152,null))[_0xe5a7('0x1c')](handleError(_0x48f152,null));};exports[_0xe5a7('0xd9')]=function(_0x2ba281,_0x252a74){var _0x5b025d={'raw':!![],'where':{}};var _0x172b8c={};var _0x29c3d8={'count':0x0,'rows':[]};return db[_0xe5a7('0x38')]['findOne']({'where':{'id':_0x2ba281[_0xe5a7('0x52')]['id']}})[_0xe5a7('0x13')](handleEntityNotFound(_0x252a74,null))[_0xe5a7('0x13')](function(_0x467068){if(_0x467068){_0x172b8c[_0xe5a7('0x53')]=_[_0xe5a7('0x55')](db[_0xe5a7('0xda')][_0xe5a7('0x39')]);_0x172b8c[_0xe5a7('0x48')]=_['keys'](_0x2ba281['query']);_0x172b8c[_0xe5a7('0x56')]=_[_0xe5a7('0x57')](_0x172b8c[_0xe5a7('0x53')],_0x172b8c[_0xe5a7('0x48')]);_0x5b025d[_0xe5a7('0x45')]=_[_0xe5a7('0x57')](_0x172b8c[_0xe5a7('0x53')],qs[_0xe5a7('0x58')](_0x2ba281[_0xe5a7('0x48')]['fields']));_0x5b025d[_0xe5a7('0x45')]=_0x5b025d[_0xe5a7('0x45')][_0xe5a7('0x4b')]?_0x5b025d[_0xe5a7('0x45')]:_0x172b8c[_0xe5a7('0x53')];if(!_0x2ba281[_0xe5a7('0x48')][_0xe5a7('0xcf')](_0xe5a7('0xd0'))){_0x5b025d[_0xe5a7('0x23')]=qs['limit'](_0x2ba281[_0xe5a7('0x48')][_0xe5a7('0x23')]);_0x5b025d['offset']=qs[_0xe5a7('0x20')](_0x2ba281[_0xe5a7('0x48')][_0xe5a7('0x20')]);}_0x5b025d[_0xe5a7('0xd2')]=qs[_0xe5a7('0xca')](_0x2ba281['query'][_0xe5a7('0xca')]);_0x5b025d[_0xe5a7('0x3f')]=qs[_0xe5a7('0x56')](_['pick'](_0x2ba281['query'],_0x172b8c[_0xe5a7('0x56')]));_0x5b025d['where'][_0xe5a7('0xdb')]=_0x467068['id'];if(_0x2ba281[_0xe5a7('0x48')][_0xe5a7('0x2f')]){_0x5b025d['where']=_['merge'](_0x5b025d[_0xe5a7('0x3f')],{'$or':_['map'](_0x5b025d[_0xe5a7('0x45')],function(_0x56e675){var _0x10551c={};_0x10551c[_0x56e675]={'$like':'%'+_0x2ba281[_0xe5a7('0x48')][_0xe5a7('0x2f')]+'%'};return _0x10551c;})});}_0x5b025d=_[_0xe5a7('0x59')]({},_0x5b025d,_0x2ba281[_0xe5a7('0x5a')]);return db[_0xe5a7('0xda')][_0xe5a7('0x22')]({'where':_0x5b025d['where']})['then'](function(_0x4e9887){_0x29c3d8[_0xe5a7('0x22')]=_0x4e9887;if(_0x2ba281['query'][_0xe5a7('0x40')]){_0x5b025d[_0xe5a7('0x41')]=[{'all':!![]}];}return db[_0xe5a7('0xda')][_0xe5a7('0x47')](_0x5b025d);})[_0xe5a7('0x13')](function(_0x4595e9){_0x29c3d8['rows']=_0x4595e9;return _0x29c3d8;});}})[_0xe5a7('0x13')](respondWithFilteredResult(_0x252a74,_0x5b025d))[_0xe5a7('0x1c')](handleError(_0x252a74,null));};exports[_0xe5a7('0xdc')]=function(_0x1e1591,_0x11a8bd){var _0x6c30eb={'raw':!![],'where':{}};var _0x2408d6={};var _0x57a45d={'count':0x0,'rows':[]};return db[_0xe5a7('0x38')][_0xe5a7('0x96')]({'where':{'id':_0x1e1591[_0xe5a7('0x52')]['id']}})[_0xe5a7('0x13')](handleEntityNotFound(_0x11a8bd,null))[_0xe5a7('0x13')](function(_0x4cf13c){if(_0x4cf13c){_0x2408d6[_0xe5a7('0x53')]=_['keys'](db[_0xe5a7('0xdd')][_0xe5a7('0x39')]);_0x2408d6[_0xe5a7('0x48')]=_['keys'](_0x1e1591['query']);_0x2408d6['filters']=_[_0xe5a7('0x57')](_0x2408d6['model'],_0x2408d6[_0xe5a7('0x48')]);_0x6c30eb[_0xe5a7('0x45')]=_[_0xe5a7('0x57')](_0x2408d6[_0xe5a7('0x53')],qs['fields'](_0x1e1591['query'][_0xe5a7('0x58')]));_0x6c30eb['attributes']=_0x6c30eb[_0xe5a7('0x45')][_0xe5a7('0x4b')]?_0x6c30eb['attributes']:_0x2408d6['model'];if(!_0x1e1591[_0xe5a7('0x48')][_0xe5a7('0xcf')](_0xe5a7('0xd0'))){_0x6c30eb[_0xe5a7('0x23')]=qs[_0xe5a7('0x23')](_0x1e1591[_0xe5a7('0x48')][_0xe5a7('0x23')]);_0x6c30eb['offset']=qs[_0xe5a7('0x20')](_0x1e1591['query'][_0xe5a7('0x20')]);}_0x6c30eb['order']=qs['sort'](_0x1e1591[_0xe5a7('0x48')][_0xe5a7('0xca')]);_0x6c30eb[_0xe5a7('0x3f')]=qs['filters'](_[_0xe5a7('0xd6')](_0x1e1591['query'],_0x2408d6[_0xe5a7('0x56')]));_0x6c30eb['where'][_0xe5a7('0xdb')]=_0x4cf13c['id'];if(_0x1e1591[_0xe5a7('0x48')][_0xe5a7('0x2f')]){_0x6c30eb['where']=_[_0xe5a7('0x59')](_0x6c30eb[_0xe5a7('0x3f')],{'$or':_[_0xe5a7('0x31')](_0x6c30eb[_0xe5a7('0x45')],function(_0x4c9a0d){var _0x3a3d93={};_0x3a3d93[_0x4c9a0d]={'$like':'%'+_0x1e1591[_0xe5a7('0x48')]['filter']+'%'};return _0x3a3d93;})});}_0x6c30eb=_[_0xe5a7('0x59')]({},_0x6c30eb,_0x1e1591[_0xe5a7('0x5a')]);return db[_0xe5a7('0xdd')][_0xe5a7('0x22')]({'where':_0x6c30eb[_0xe5a7('0x3f')]})[_0xe5a7('0x13')](function(_0x319a48){_0x57a45d[_0xe5a7('0x22')]=_0x319a48;if(_0x1e1591['query']['includeAll']){_0x6c30eb[_0xe5a7('0x41')]=[{'all':!![]}];}return db[_0xe5a7('0xdd')]['findAll'](_0x6c30eb);})[_0xe5a7('0x13')](function(_0x1650f4){_0x57a45d['rows']=_0x1650f4;return _0x57a45d;});}})[_0xe5a7('0x13')](respondWithFilteredResult(_0x11a8bd,_0x6c30eb))[_0xe5a7('0x1c')](handleError(_0x11a8bd,null));};exports[_0xe5a7('0xde')]=function(_0x422bf9,_0x20d078){var _0x42e5d5={};var _0x5d4cd1={};var _0x117b85;var _0x5c3f25;return db[_0xe5a7('0x38')]['findOne']({'where':{'id':_0x422bf9[_0xe5a7('0x52')]['id']}})['then'](handleEntityNotFound(_0x20d078,null))[_0xe5a7('0x13')](function(_0x337755){if(_0x337755){_0x117b85=_0x337755;_0x5d4cd1[_0xe5a7('0x53')]=_[_0xe5a7('0x55')](db[_0xe5a7('0xdf')]['rawAttributes']);_0x5d4cd1[_0xe5a7('0x48')]=_[_0xe5a7('0x55')](_0x422bf9[_0xe5a7('0x48')]);_0x5d4cd1['filters']=_['intersection'](_0x5d4cd1[_0xe5a7('0x53')],_0x5d4cd1[_0xe5a7('0x48')]);_0x42e5d5[_0xe5a7('0x45')]=_['intersection'](_0x5d4cd1[_0xe5a7('0x53')],qs['fields'](_0x422bf9[_0xe5a7('0x48')][_0xe5a7('0x58')]));_0x42e5d5['attributes']=_0x42e5d5['attributes'][_0xe5a7('0x4b')]?_0x42e5d5['attributes']:_0x5d4cd1[_0xe5a7('0x53')];_0x42e5d5['order']=qs[_0xe5a7('0xca')](_0x422bf9[_0xe5a7('0x48')][_0xe5a7('0xca')]);_0x42e5d5[_0xe5a7('0x3f')]=qs[_0xe5a7('0x56')](_[_0xe5a7('0xd6')](_0x422bf9[_0xe5a7('0x48')],_0x5d4cd1[_0xe5a7('0x56')]));if(_0x422bf9[_0xe5a7('0x48')][_0xe5a7('0x2f')]){_0x42e5d5[_0xe5a7('0x3f')]=_['merge'](_0x42e5d5[_0xe5a7('0x3f')],{'$or':_[_0xe5a7('0x31')](_0x42e5d5[_0xe5a7('0x45')],function(_0x2bb0b2){var _0x13baf7={};_0x13baf7[_0x2bb0b2]={'$like':'%'+_0x422bf9['query'][_0xe5a7('0x2f')]+'%'};return _0x13baf7;})});}_0x42e5d5=_['merge']({},_0x42e5d5,_0x422bf9[_0xe5a7('0x5a')]);return _0x117b85[_0xe5a7('0xde')](_0x42e5d5);}})[_0xe5a7('0x13')](function(_0x13870d){if(_0x13870d){_0x5c3f25=_0x13870d['length'];if(!_0x422bf9[_0xe5a7('0x48')][_0xe5a7('0xcf')]('nolimit')){_0x42e5d5[_0xe5a7('0x23')]=qs[_0xe5a7('0x23')](_0x422bf9['query'][_0xe5a7('0x23')]);_0x42e5d5[_0xe5a7('0x20')]=qs[_0xe5a7('0x20')](_0x422bf9[_0xe5a7('0x48')]['offset']);}return _0x117b85[_0xe5a7('0xde')](_0x42e5d5);}})['then'](function(_0x5daf5a){if(_0x5daf5a){return _0x5daf5a?{'count':_0x5c3f25,'rows':_0x5daf5a}:null;}})[_0xe5a7('0x13')](respondWithResult(_0x20d078,null))['catch'](handleError(_0x20d078,null));};exports[_0xe5a7('0xe0')]=function(_0x3bcfa8,_0xcef257){var _0x3a5084={};var _0x19d993={};var _0x86c469;var _0xc67a4d;return db[_0xe5a7('0x38')][_0xe5a7('0x96')]({'where':{'id':_0x3bcfa8[_0xe5a7('0x52')]['id']}})[_0xe5a7('0x13')](handleEntityNotFound(_0xcef257,null))[_0xe5a7('0x13')](function(_0x16b785){if(_0x16b785){_0x86c469=_0x16b785;_0x19d993[_0xe5a7('0x53')]=_[_0xe5a7('0x55')](db['OpenchannelInteraction'][_0xe5a7('0x39')]);_0x19d993[_0xe5a7('0x48')]=_['keys'](_0x3bcfa8['query']);_0x19d993[_0xe5a7('0x56')]=_[_0xe5a7('0x57')](_0x19d993[_0xe5a7('0x53')],_0x19d993[_0xe5a7('0x48')]);_0x3a5084[_0xe5a7('0x45')]=_[_0xe5a7('0x57')](_0x19d993[_0xe5a7('0x53')],qs[_0xe5a7('0x58')](_0x3bcfa8['query'][_0xe5a7('0x58')]));_0x3a5084['attributes']=_0x3a5084[_0xe5a7('0x45')][_0xe5a7('0x4b')]?_0x3a5084[_0xe5a7('0x45')]:_0x19d993[_0xe5a7('0x53')];_0x3a5084['order']=qs['sort'](_0x3bcfa8[_0xe5a7('0x48')][_0xe5a7('0xca')]);_0x3a5084[_0xe5a7('0x3f')]=qs[_0xe5a7('0x56')](_['pick'](_0x3bcfa8[_0xe5a7('0x48')],_0x19d993[_0xe5a7('0x56')]));if(_0x3bcfa8[_0xe5a7('0x48')]['filter']){_0x3a5084[_0xe5a7('0x3f')]=_[_0xe5a7('0x59')](_0x3a5084[_0xe5a7('0x3f')],{'$or':_[_0xe5a7('0x31')](_0x3a5084[_0xe5a7('0x45')],function(_0x18670f){var _0x13ad7c={};_0x13ad7c[_0x18670f]={'$like':'%'+_0x3bcfa8['query'][_0xe5a7('0x2f')]+'%'};return _0x13ad7c;})});}_0x3a5084=_[_0xe5a7('0x59')]({},_0x3a5084,_0x3bcfa8[_0xe5a7('0x5a')]);return _0x86c469['getOpenchannelInteractions'](_0x3a5084);}})[_0xe5a7('0x13')](function(_0x6b78d2){if(_0x6b78d2){_0xc67a4d=_0x6b78d2['length'];if(!_0x3bcfa8[_0xe5a7('0x48')][_0xe5a7('0xcf')](_0xe5a7('0xd0'))){_0x3a5084[_0xe5a7('0x23')]=qs[_0xe5a7('0x23')](_0x3bcfa8[_0xe5a7('0x48')][_0xe5a7('0x23')]);_0x3a5084[_0xe5a7('0x20')]=qs[_0xe5a7('0x20')](_0x3bcfa8[_0xe5a7('0x48')]['offset']);}return _0x86c469['getOpenchannelInteractions'](_0x3a5084);}})[_0xe5a7('0x13')](function(_0x1a9b8f){if(_0x1a9b8f){return _0x1a9b8f?{'count':_0xc67a4d,'rows':_0x1a9b8f}:null;}})[_0xe5a7('0x13')](respondWithResult(_0xcef257,null))['catch'](handleError(_0xcef257,null));};exports[_0xe5a7('0xe1')]=function(_0x3885e9,_0x251d49){var _0xb4b979={'raw':!![],'where':{}};var _0x261979={};var _0x2d9e0a={'count':0x0,'rows':[]};return db[_0xe5a7('0x38')][_0xe5a7('0x96')]({'where':{'id':_0x3885e9[_0xe5a7('0x52')]['id']}})[_0xe5a7('0x13')](handleEntityNotFound(_0x251d49,null))[_0xe5a7('0x13')](function(_0x214e21){if(_0x214e21){_0x261979['model']=_['keys'](db[_0xe5a7('0xe2')][_0xe5a7('0x39')]);_0x261979[_0xe5a7('0x48')]=_[_0xe5a7('0x55')](_0x3885e9[_0xe5a7('0x48')]);_0x261979[_0xe5a7('0x56')]=_[_0xe5a7('0x57')](_0x261979['model'],_0x261979['query']);_0xb4b979[_0xe5a7('0x45')]=_[_0xe5a7('0x57')](_0x261979[_0xe5a7('0x53')],qs[_0xe5a7('0x58')](_0x3885e9['query'][_0xe5a7('0x58')]));_0xb4b979[_0xe5a7('0x45')]=_0xb4b979[_0xe5a7('0x45')][_0xe5a7('0x4b')]?_0xb4b979[_0xe5a7('0x45')]:_0x261979[_0xe5a7('0x53')];if(!_0x3885e9[_0xe5a7('0x48')][_0xe5a7('0xcf')](_0xe5a7('0xd0'))){_0xb4b979['limit']=qs['limit'](_0x3885e9[_0xe5a7('0x48')][_0xe5a7('0x23')]);_0xb4b979[_0xe5a7('0x20')]=qs[_0xe5a7('0x20')](_0x3885e9[_0xe5a7('0x48')]['offset']);}_0xb4b979[_0xe5a7('0xd2')]=qs[_0xe5a7('0xca')](_0x3885e9[_0xe5a7('0x48')][_0xe5a7('0xca')]);_0xb4b979[_0xe5a7('0x3f')]=qs[_0xe5a7('0x56')](_[_0xe5a7('0xd6')](_0x3885e9[_0xe5a7('0x48')],_0x261979[_0xe5a7('0x56')]));_0xb4b979[_0xe5a7('0x3f')][_0xe5a7('0xdb')]=_0x214e21['id'];if(_0x3885e9[_0xe5a7('0x48')]['filter']){_0xb4b979[_0xe5a7('0x3f')]=_[_0xe5a7('0x59')](_0xb4b979[_0xe5a7('0x3f')],{'$or':_[_0xe5a7('0x31')](_0xb4b979[_0xe5a7('0x45')],function(_0x382b36){var _0x3eb1c3={};_0x3eb1c3[_0x382b36]={'$like':'%'+_0x3885e9[_0xe5a7('0x48')][_0xe5a7('0x2f')]+'%'};return _0x3eb1c3;})});}_0xb4b979=_['merge']({},_0xb4b979,_0x3885e9['options']);return db[_0xe5a7('0xe2')][_0xe5a7('0x22')]({'where':_0xb4b979['where']})['then'](function(_0x5d5aaa){_0x2d9e0a[_0xe5a7('0x22')]=_0x5d5aaa;if(_0x3885e9[_0xe5a7('0x48')][_0xe5a7('0x40')]){_0xb4b979['include']=[{'all':!![]}];}return db[_0xe5a7('0xe2')][_0xe5a7('0x47')](_0xb4b979);})[_0xe5a7('0x13')](function(_0x30412a){_0x2d9e0a[_0xe5a7('0x4a')]=_0x30412a;return _0x2d9e0a;});}})[_0xe5a7('0x13')](respondWithFilteredResult(_0x251d49,_0xb4b979))[_0xe5a7('0x1c')](handleError(_0x251d49,null));};exports[_0xe5a7('0xe3')]=function(_0x1c94e4,_0x49b74e){var _0x14bb5a={};var _0x4a2a80={};var _0x24de44;var _0x622aa2;return db[_0xe5a7('0x38')][_0xe5a7('0x96')]({'where':{'id':_0x1c94e4['params']['id']}})[_0xe5a7('0x13')](handleEntityNotFound(_0x49b74e,null))[_0xe5a7('0x13')](function(_0x384780){if(_0x384780){_0x24de44=_0x384780;_0x4a2a80[_0xe5a7('0x53')]=_['keys'](db['SmsInteraction'][_0xe5a7('0x39')]);_0x4a2a80[_0xe5a7('0x48')]=_['keys'](_0x1c94e4[_0xe5a7('0x48')]);_0x4a2a80[_0xe5a7('0x56')]=_[_0xe5a7('0x57')](_0x4a2a80[_0xe5a7('0x53')],_0x4a2a80[_0xe5a7('0x48')]);_0x14bb5a[_0xe5a7('0x45')]=_['intersection'](_0x4a2a80[_0xe5a7('0x53')],qs[_0xe5a7('0x58')](_0x1c94e4['query'][_0xe5a7('0x58')]));_0x14bb5a[_0xe5a7('0x45')]=_0x14bb5a[_0xe5a7('0x45')][_0xe5a7('0x4b')]?_0x14bb5a[_0xe5a7('0x45')]:_0x4a2a80[_0xe5a7('0x53')];_0x14bb5a[_0xe5a7('0xd2')]=qs[_0xe5a7('0xca')](_0x1c94e4[_0xe5a7('0x48')][_0xe5a7('0xca')]);_0x14bb5a[_0xe5a7('0x3f')]=qs[_0xe5a7('0x56')](_[_0xe5a7('0xd6')](_0x1c94e4[_0xe5a7('0x48')],_0x4a2a80[_0xe5a7('0x56')]));if(_0x1c94e4[_0xe5a7('0x48')]['filter']){_0x14bb5a[_0xe5a7('0x3f')]=_[_0xe5a7('0x59')](_0x14bb5a[_0xe5a7('0x3f')],{'$or':_['map'](_0x14bb5a[_0xe5a7('0x45')],function(_0x86e2b1){var _0x3e2188={};_0x3e2188[_0x86e2b1]={'$like':'%'+_0x1c94e4[_0xe5a7('0x48')][_0xe5a7('0x2f')]+'%'};return _0x3e2188;})});}_0x14bb5a=_[_0xe5a7('0x59')]({},_0x14bb5a,_0x1c94e4[_0xe5a7('0x5a')]);return _0x24de44['getSmsInteractions'](_0x14bb5a);}})[_0xe5a7('0x13')](function(_0xec3381){if(_0xec3381){_0x622aa2=_0xec3381[_0xe5a7('0x4b')];if(!_0x1c94e4[_0xe5a7('0x48')][_0xe5a7('0xcf')](_0xe5a7('0xd0'))){_0x14bb5a['limit']=qs[_0xe5a7('0x23')](_0x1c94e4[_0xe5a7('0x48')][_0xe5a7('0x23')]);_0x14bb5a[_0xe5a7('0x20')]=qs[_0xe5a7('0x20')](_0x1c94e4[_0xe5a7('0x48')]['offset']);}return _0x24de44[_0xe5a7('0xe3')](_0x14bb5a);}})[_0xe5a7('0x13')](function(_0x5aa67c){if(_0x5aa67c){return _0x5aa67c?{'count':_0x622aa2,'rows':_0x5aa67c}:null;}})[_0xe5a7('0x13')](respondWithResult(_0x49b74e,null))[_0xe5a7('0x1c')](handleError(_0x49b74e,null));};exports[_0xe5a7('0xe4')]=function(_0x70f39,_0x1c3b8c){var _0x5cfe6b={};var _0x22603b={};var _0xf42796;var _0x140654;return db[_0xe5a7('0x38')][_0xe5a7('0x96')]({'where':{'id':_0x70f39['params']['id']}})['then'](handleEntityNotFound(_0x1c3b8c,null))[_0xe5a7('0x13')](function(_0x187a72){if(_0x187a72){_0xf42796=_0x187a72;_0x22603b[_0xe5a7('0x53')]=_['keys'](db[_0xe5a7('0xe5')]['rawAttributes']);_0x22603b['query']=_['keys'](_0x70f39[_0xe5a7('0x48')]);_0x22603b['filters']=_[_0xe5a7('0x57')](_0x22603b[_0xe5a7('0x53')],_0x22603b['query']);_0x5cfe6b[_0xe5a7('0x45')]=_[_0xe5a7('0x57')](_0x22603b['model'],qs['fields'](_0x70f39[_0xe5a7('0x48')]['fields']));_0x5cfe6b[_0xe5a7('0x45')]=_0x5cfe6b['attributes'][_0xe5a7('0x4b')]?_0x5cfe6b['attributes']:_0x22603b[_0xe5a7('0x53')];_0x5cfe6b[_0xe5a7('0xd2')]=qs[_0xe5a7('0xca')](_0x70f39[_0xe5a7('0x48')][_0xe5a7('0xca')]);_0x5cfe6b[_0xe5a7('0x3f')]=qs[_0xe5a7('0x56')](_[_0xe5a7('0xd6')](_0x70f39[_0xe5a7('0x48')],_0x22603b[_0xe5a7('0x56')]));if(_0x70f39[_0xe5a7('0x48')][_0xe5a7('0x2f')]){_0x5cfe6b[_0xe5a7('0x3f')]=_[_0xe5a7('0x59')](_0x5cfe6b['where'],{'$or':_['map'](_0x5cfe6b['attributes'],function(_0x121a61){var _0x2831d4={};_0x2831d4[_0x121a61]={'$like':'%'+_0x70f39[_0xe5a7('0x48')][_0xe5a7('0x2f')]+'%'};return _0x2831d4;})});}_0x5cfe6b=_[_0xe5a7('0x59')]({},_0x5cfe6b,_0x70f39['options']);return _0xf42796['getFaxInteractions'](_0x5cfe6b);}})['then'](function(_0x235949){if(_0x235949){_0x140654=_0x235949[_0xe5a7('0x4b')];if(!_0x70f39[_0xe5a7('0x48')][_0xe5a7('0xcf')](_0xe5a7('0xd0'))){_0x5cfe6b[_0xe5a7('0x23')]=qs['limit'](_0x70f39['query']['limit']);_0x5cfe6b[_0xe5a7('0x20')]=qs[_0xe5a7('0x20')](_0x70f39[_0xe5a7('0x48')][_0xe5a7('0x20')]);}return _0xf42796[_0xe5a7('0xe4')](_0x5cfe6b);}})['then'](function(_0x57931e){if(_0x57931e){return _0x57931e?{'count':_0x140654,'rows':_0x57931e}:null;}})[_0xe5a7('0x13')](respondWithResult(_0x1c3b8c,null))[_0xe5a7('0x1c')](handleError(_0x1c3b8c,null));};exports[_0xe5a7('0xe6')]=function(_0x5e59a9,_0x196ce6){var _0x1b4bd4={};var _0x520eba={};var _0x3dd36e;var _0x29f766;return db[_0xe5a7('0x38')][_0xe5a7('0x96')]({'where':{'id':_0x5e59a9[_0xe5a7('0x52')]['id']}})['then'](handleEntityNotFound(_0x196ce6,null))[_0xe5a7('0x13')](function(_0x3f8ef2){if(_0x3f8ef2){_0x3dd36e=_0x3f8ef2;_0x520eba['model']=_[_0xe5a7('0x55')](db[_0xe5a7('0xe7')]['rawAttributes']);_0x520eba[_0xe5a7('0x48')]=_[_0xe5a7('0x55')](_0x5e59a9['query']);_0x520eba[_0xe5a7('0x56')]=_[_0xe5a7('0x57')](_0x520eba['model'],_0x520eba['query']);_0x1b4bd4[_0xe5a7('0x45')]=_[_0xe5a7('0x57')](_0x520eba[_0xe5a7('0x53')],qs[_0xe5a7('0x58')](_0x5e59a9['query']['fields']));_0x1b4bd4[_0xe5a7('0x45')]=_0x1b4bd4[_0xe5a7('0x45')][_0xe5a7('0x4b')]?_0x1b4bd4[_0xe5a7('0x45')]:_0x520eba[_0xe5a7('0x53')];_0x1b4bd4[_0xe5a7('0xd2')]=qs[_0xe5a7('0xca')](_0x5e59a9[_0xe5a7('0x48')][_0xe5a7('0xca')]);_0x1b4bd4[_0xe5a7('0x3f')]=qs['filters'](_[_0xe5a7('0xd6')](_0x5e59a9[_0xe5a7('0x48')],_0x520eba[_0xe5a7('0x56')]));if(_0x5e59a9['query'][_0xe5a7('0x2f')]){_0x1b4bd4['where']=_['merge'](_0x1b4bd4['where'],{'$or':_[_0xe5a7('0x31')](_0x1b4bd4[_0xe5a7('0x45')],function(_0x31e95b){var _0x110717={};_0x110717[_0x31e95b]={'$like':'%'+_0x5e59a9[_0xe5a7('0x48')][_0xe5a7('0x2f')]+'%'};return _0x110717;})});}_0x1b4bd4=_[_0xe5a7('0x59')]({},_0x1b4bd4,_0x5e59a9[_0xe5a7('0x5a')]);return _0x3dd36e[_0xe5a7('0xe6')](_0x1b4bd4);}})[_0xe5a7('0x13')](function(_0x529049){if(_0x529049){_0x29f766=_0x529049[_0xe5a7('0x4b')];if(!_0x5e59a9[_0xe5a7('0x48')][_0xe5a7('0xcf')](_0xe5a7('0xd0'))){_0x1b4bd4[_0xe5a7('0x23')]=qs[_0xe5a7('0x23')](_0x5e59a9[_0xe5a7('0x48')]['limit']);_0x1b4bd4[_0xe5a7('0x20')]=qs[_0xe5a7('0x20')](_0x5e59a9[_0xe5a7('0x48')][_0xe5a7('0x20')]);}return _0x3dd36e['getWhatsappInteractions'](_0x1b4bd4);}})[_0xe5a7('0x13')](function(_0x412369){if(_0x412369){return _0x412369?{'count':_0x29f766,'rows':_0x412369}:null;}})[_0xe5a7('0x13')](respondWithResult(_0x196ce6,null))['catch'](handleError(_0x196ce6,null));};exports['login']=function(_0x549eb3,_0x538364,_0xbec06a){var _0x111dbd;var _0x5008b1;var _0x7e7b67;var _0x4b45bb=!_['isNil'](_0x549eb3[_0xe5a7('0x52')]['id'])?_0x549eb3[_0xe5a7('0x52')]['id']:!_[_0xe5a7('0x69')](_0x549eb3[_0xe5a7('0x2b')]['id'])?_0x549eb3[_0xe5a7('0x2b')]['id']:null;return db['User'][_0xe5a7('0x33')]({'where':{'id':_0x4b45bb,'role':{'$or':[_0xe5a7('0x29'),_0xe5a7('0x2b'),_0xe5a7('0x71')]}},'attributes':['id',_0xe5a7('0x35'),_0xe5a7('0xe8'),_0xe5a7('0xe9'),_0xe5a7('0x28'),_0xe5a7('0x64'),'loginInPause']})[_0xe5a7('0x13')](function(_0x3a245a){if(_0x3a245a){if(_0x3a245a[_0xe5a7('0x28')]===_0xe5a7('0x71')){_0x111dbd=_0x3a245a;if(_0x549eb3[_0xe5a7('0x5f')]['interface']){_0x7e7b67=util['format']('LOCAL/%s@from-sip/n',_0x111dbd[_0x549eb3[_0xe5a7('0x5f')][_0xe5a7('0x9f')]]);}else if(_0x549eb3[_0xe5a7('0x5f')]['intrf']){_0x7e7b67=util[_0xe5a7('0xea')](_0xe5a7('0xac'),_0x549eb3[_0xe5a7('0x5f')][_0xe5a7('0xeb')]);}else{_0x7e7b67=util[_0xe5a7('0xea')](_0xe5a7('0xac'),_0x111dbd[_0xe5a7('0x35')]);}socket['to'](util[_0xe5a7('0xea')]('user:%s',_0x111dbd[_0xe5a7('0x35')]))[_0xe5a7('0xa7')]('user:forcelogout',{'user':{'id':_0x111dbd['id'],'name':_0x111dbd[_0xe5a7('0x35')]},'ip':_0x549eb3[_0xe5a7('0xec')][_0xe5a7('0xed')]||_0x549eb3[_0xe5a7('0xee')][_0xe5a7('0xef')]||_0x549eb3[_0xe5a7('0xf0')][_0xe5a7('0xef')]||_0x549eb3[_0xe5a7('0xee')]['socket'][_0xe5a7('0xef')]});return db[_0xe5a7('0xae')][_0xe5a7('0xf1')]({'where':{'membername':_0x111dbd[_0xe5a7('0x35')]},'individualHooks':!![]});}}else{throw new db[(_0xe5a7('0x93'))][(_0xe5a7('0x90'))](_0xe5a7('0xf2'));}})[_0xe5a7('0x13')](function(){if(_0x111dbd){return _0x111dbd[_0xe5a7('0xf3')]({'raw':!![]});}})[_0xe5a7('0x13')](function(_0x370776){if(_0x111dbd){if(_0x370776){_0x5008b1=_0x370776;if(_0x5008b1[_0xe5a7('0x4b')]){var _0x50941c=_0x5008b1[_0xe5a7('0x31')](function(_0x4ec559){var _0x391ad5={'membername':_0x111dbd[_0xe5a7('0x35')],'UserId':_0x111dbd['id'],'queue_name':_0x4ec559['name'],'VoiceQueueId':_0x4ec559['id'],'interface':_0x7e7b67,'paused':_0x111dbd[_0xe5a7('0x9e')]||![],'penalty':_0x4ec559[_0xe5a7('0xf4')]||0x0};return db[_0xe5a7('0xae')]['upsert'](_0x391ad5);});return Promise[_0xe5a7('0x5d')](_0x50941c);}}}})[_0xe5a7('0x13')](function(){if(_0x111dbd){return db[_0xe5a7('0xf5')][_0xe5a7('0x47')]({'where':{'membername':_0x111dbd['name'],'exitAt':null}});}})[_0xe5a7('0x13')](function(_0x43ad95){if(_0x111dbd){var _0x239fa4=[];_0x43ad95[_0xe5a7('0xf6')](function(_0x239b3a){_0x239fa4[_0xe5a7('0x46')](_0x239b3a['update']({'exitAt':moment()['format'](_0xe5a7('0xf7'))}));});return Promise[_0xe5a7('0x5d')](_0x239fa4);}})[_0xe5a7('0x13')](function(){if(_0x111dbd){var _0x35048c=[];var _0x962ef0=[];var _0x3b5566=utils[_0xe5a7('0xf8')]();var _0x21f914={'membername':_0x111dbd[_0xe5a7('0x35')],'interface':_0x7e7b67,'enterAt':moment()[_0xe5a7('0xea')](_0xe5a7('0xf7')),'role':_0x111dbd['role'],'internal':_0x111dbd['internal']};_0x3b5566[_0xe5a7('0xf6')](function(_0x3c87ab){_0x35048c[_0xe5a7('0x46')](_[_0xe5a7('0x59')]({'channel':_0x3c87ab,'type':_0xe5a7('0xf9'),'data1':_0x549eb3[_0xe5a7('0x5f')][_0xe5a7('0xfa')],'data2':_0x7e7b67},_0x21f914));if(_0x111dbd[_0xe5a7('0x9e')]){_0x962ef0[_0xe5a7('0x46')](_[_0xe5a7('0x59')]({'channel':_0x3c87ab,'type':_0xe5a7('0xfb'),'data1':_0xe5a7('0xfc')},_0x21f914));}});return db[_0xe5a7('0xf5')][_0xe5a7('0x87')](_0x35048c['concat'](_0x962ef0),{'individualHooks':!![]});}})['then'](function(){if(_0x111dbd){return _0x111dbd[_0xe5a7('0x5e')]({'online':!![],'lastLoginAt':moment()[_0xe5a7('0xea')](_0xe5a7('0xf7')),'voicePause':_0x111dbd[_0xe5a7('0x9e')]||![],'mailPause':_0x111dbd[_0xe5a7('0x9e')]||![],'chatPause':_0x111dbd[_0xe5a7('0x9e')]||![],'faxPause':_0x111dbd[_0xe5a7('0x9e')]||![],'smsPause':_0x111dbd[_0xe5a7('0x9e')]||![],'openchannelPause':_0x111dbd[_0xe5a7('0x9e')]||![],'whatsappPause':_0x111dbd['loginInPause']||![],'pauseType':_0x111dbd[_0xe5a7('0x9e')]?_0xe5a7('0xfc'):null,'interface':_0x7e7b67,'lastPauseAt':moment()[_0xe5a7('0xea')](_0xe5a7('0xf7'))});}})[_0xe5a7('0x13')](function(_0x5e078f){if(_0x549eb3[_0xe5a7('0xfd')]){return _0xbec06a();}else{return Promise[_0xe5a7('0xfe')](_0x5e078f)[_0xe5a7('0x13')](respondWithResult(_0x538364,null));}})['catch'](handleError(_0x538364,null));};exports['logout']=function(_0x19560e,_0x288a6b){var _0x5a77ae;return db[_0xe5a7('0x38')][_0xe5a7('0x33')]({'where':{'id':_0x19560e[_0xe5a7('0x52')]['id'],'role':_0xe5a7('0x71')},'attributes':['id','name',_0xe5a7('0x28')]})[_0xe5a7('0x13')](handleEntityNotFound(_0x288a6b,null))[_0xe5a7('0x13')](function(_0x465391){if(_0x465391){_0x5a77ae=_0x465391;return db['UserVoiceQueueRt'][_0xe5a7('0xf1')]({'where':{'membername':_0x5a77ae[_0xe5a7('0x35')]},'individualHooks':!![]});}})[_0xe5a7('0x13')](function(){return db[_0xe5a7('0xf5')][_0xe5a7('0x47')]({'where':{'membername':_0x5a77ae[_0xe5a7('0x35')],'exitAt':null}});})[_0xe5a7('0x13')](function(_0x58e629){var _0x193b39=[];_0x58e629[_0xe5a7('0xf6')](function(_0x464c45){_0x193b39[_0xe5a7('0x46')](_0x464c45['update']({'exitAt':moment()[_0xe5a7('0xea')](_0xe5a7('0xf7'))}));});return Promise['all'](_0x193b39);})[_0xe5a7('0x13')](function(){return _0x5a77ae[_0xe5a7('0x5e')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x288a6b,null))['catch'](handleError(_0x288a6b,null));};exports[_0xe5a7('0xff')]=function(_0x35c8db,_0x326fd4){var _0x2b652f;return db[_0xe5a7('0xae')]['update']({'paused':0x1},{'where':{'UserId':_0x35c8db[_0xe5a7('0x52')]['id']},'individualHooks':!![]})[_0xe5a7('0x13')](function(){return db[_0xe5a7('0x38')][_0xe5a7('0x33')]({'where':{'id':_0x35c8db[_0xe5a7('0x52')]['id'],'role':_0xe5a7('0x71')},'attributes':['id','name','role',_0xe5a7('0x64'),_0xe5a7('0x9f'),_0xe5a7('0x9d')]});})[_0xe5a7('0x13')](handleEntityNotFound(_0x326fd4,null))[_0xe5a7('0x13')](function(_0x230425){if(_0x230425){_0x2b652f=_0x230425;return respondWithRpcPromise(_0xe5a7('0x100'),'pause',{'id':_0x2b652f['id'],'name':_0x2b652f[_0xe5a7('0x35')],'pause':!![]});}})[_0xe5a7('0x13')](function(){if(_0x2b652f){return db['MemberReport'][_0xe5a7('0x47')]({'where':{'membername':_0x2b652f['name'],'type':_0xe5a7('0xfb'),'exitAt':null}});}})['then'](function(_0x5eb055){if(_0x5eb055['length']){var _0x3ae813=moment()['format'](_0xe5a7('0xf7'));for(var _0x5e8b68=0x0,_0x86a004=_0x5eb055['length'];_0x5e8b68<_0x86a004;_0x5e8b68++){_0x5eb055[_0x5e8b68][_0xe5a7('0x101')]({'exitAt':_0x3ae813});}}})[_0xe5a7('0x13')](function(){var _0x39cb2a=[];var _0x917907=utils[_0xe5a7('0xf8')]();_0x917907[_0xe5a7('0xf6')](function(_0x481c5d){_0x39cb2a[_0xe5a7('0x46')]({'channel':_0x481c5d,'membername':_0x2b652f[_0xe5a7('0x35')],'interface':_[_0xe5a7('0x69')](_0x2b652f[_0xe5a7('0x9f')])?util[_0xe5a7('0xea')](_0xe5a7('0xac'),_0x2b652f[_0xe5a7('0x35')]):_0x2b652f[_0xe5a7('0x9f')],'type':'PAUSE','enterAt':moment()[_0xe5a7('0xea')](_0xe5a7('0xf7')),'data1':_0x35c8db['body']['type']||_0xe5a7('0x102'),'role':_0x2b652f[_0xe5a7('0x28')],'internal':_0x2b652f['internal']});});return db[_0xe5a7('0xf5')][_0xe5a7('0x87')](_0x39cb2a,{'individualHooks':!![]});})['then'](function(){return _0x2b652f[_0xe5a7('0x5e')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x35c8db[_0xe5a7('0x5f')][_0xe5a7('0x3b')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xe5a7('0xea')](_0xe5a7('0xf7'))});})[_0xe5a7('0x13')](respondWithResult(_0x326fd4,null))[_0xe5a7('0x1c')](handleError(_0x326fd4,null));};exports['unpause']=function(_0x5d3b75,_0x240f74){if(_0x5d3b75['body'][_0xe5a7('0x9c')]&&!utils[_0xe5a7('0xa0')](_0x5d3b75[_0xe5a7('0x5f')]['channel'])){throw new APIBadRequestError(util[_0xe5a7('0xea')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x5d3b75[_0xe5a7('0x5f')][_0xe5a7('0x9c')]));}return db['User'][_0xe5a7('0x33')]({'where':{'id':_0x5d3b75[_0xe5a7('0x52')]['id']},'attributes':['id','name',_0xe5a7('0x28'),'internal',_0xe5a7('0x9f'),_0xe5a7('0x9d'),_0xe5a7('0xad'),_0xe5a7('0x103'),'chatPause','faxPause',_0xe5a7('0x104'),'smsPause',_0xe5a7('0x105'),_0xe5a7('0x106'),_0xe5a7('0x107')]})[_0xe5a7('0x13')](function(_0x13dcc2){if(!_0x13dcc2){throw new APINotFoundError(util['format'](_0xe5a7('0x108'),_0x5d3b75[_0xe5a7('0x52')]['id']));}return _0x13dcc2[_0xe5a7('0x109')](_0x5d3b75[_0xe5a7('0x5f')][_0xe5a7('0x9c')]);})[_0xe5a7('0x13')](respondWithResult(_0x240f74,null))[_0xe5a7('0x1c')](APIHandleError(_0x240f74));};exports[_0xe5a7('0x10a')]=function(_0x1de80a,_0x1b66fb){var _0x47ba7f={};var _0x45e3d1={};var _0x198a57;var _0x5a492d;return db['User']['findOne']({'where':{'id':_0x1de80a['params']['id']}})[_0xe5a7('0x13')](handleEntityNotFound(_0x1b66fb,null))['then'](function(_0x3e3b43){if(_0x3e3b43){_0x198a57=_0x3e3b43;_0x45e3d1['model']=_['keys'](db[_0xe5a7('0x10b')][_0xe5a7('0x39')]);_0x45e3d1[_0xe5a7('0x48')]=_['keys'](_0x1de80a[_0xe5a7('0x48')]);_0x45e3d1['filters']=_[_0xe5a7('0x57')](_0x45e3d1[_0xe5a7('0x53')],_0x45e3d1[_0xe5a7('0x48')]);_0x47ba7f[_0xe5a7('0x45')]=_['intersection'](_0x45e3d1[_0xe5a7('0x53')],qs[_0xe5a7('0x58')](_0x1de80a[_0xe5a7('0x48')][_0xe5a7('0x58')]));_0x47ba7f[_0xe5a7('0x45')]=_0x47ba7f['attributes'][_0xe5a7('0x4b')]?_0x47ba7f['attributes']:_0x45e3d1[_0xe5a7('0x53')];_0x47ba7f[_0xe5a7('0xd2')]=qs['sort'](_0x1de80a[_0xe5a7('0x48')]['sort']);_0x47ba7f[_0xe5a7('0x3f')]=qs['filters'](_[_0xe5a7('0xd6')](_0x1de80a[_0xe5a7('0x48')],_0x45e3d1['filters']));if(_0x1de80a[_0xe5a7('0x48')][_0xe5a7('0x2f')]){_0x47ba7f['where']=_['merge'](_0x47ba7f['where'],{'$or':_[_0xe5a7('0x31')](_0x47ba7f[_0xe5a7('0x45')],function(_0x18df39){var _0x2f07ef={};_0x2f07ef[_0x18df39]={'$like':'%'+_0x1de80a[_0xe5a7('0x48')][_0xe5a7('0x2f')]+'%'};return _0x2f07ef;})});}_0x47ba7f=_[_0xe5a7('0x59')]({},_0x47ba7f,_0x1de80a[_0xe5a7('0x5a')]);return _0x198a57['getTeams'](_0x47ba7f);}})[_0xe5a7('0x13')](function(_0x50a791){if(_0x50a791){_0x5a492d=_0x50a791['length'];if(!_0x1de80a['query'][_0xe5a7('0xcf')](_0xe5a7('0xd0'))){_0x47ba7f[_0xe5a7('0x23')]=qs[_0xe5a7('0x23')](_0x1de80a['query']['limit']);_0x47ba7f['offset']=qs[_0xe5a7('0x20')](_0x1de80a['query'][_0xe5a7('0x20')]);}return _0x198a57[_0xe5a7('0x10a')](_0x47ba7f);}})[_0xe5a7('0x13')](function(_0x4b82a8){if(_0x4b82a8){return _0x4b82a8?{'count':_0x5a492d,'rows':_0x4b82a8}:null;}})[_0xe5a7('0x13')](respondWithResult(_0x1b66fb,null))[_0xe5a7('0x1c')](handleError(_0x1b66fb,null));};exports['addTeams']=function(_0x5986c6,_0x149e5a){var _0x36f913=_0x5986c6[_0xe5a7('0x52')]['id'];var _0x563df0=_0x5986c6['body']?_0x5986c6[_0xe5a7('0x5f')][_0xe5a7('0x62')]:null;var _0x2f5910=[];return Promise['resolve']()[_0xe5a7('0x13')](function(){if(!_0x563df0)throw new APIBadRequestError(_0xe5a7('0x10c'));})[_0xe5a7('0x13')](function(){return db[_0xe5a7('0x38')][_0xe5a7('0x96')]({'where':{'id':_0x36f913}});})[_0xe5a7('0x13')](function(_0xa0c80d){if(!_0xa0c80d)throw new APINotFoundError(util[_0xe5a7('0xea')]('User\x20with\x20id\x20%s\x20not\x20found',_0x5986c6[_0xe5a7('0x52')]['id']));return db['sequelize'][_0xe5a7('0x10d')](function(_0x36e1bc){return _0xa0c80d[_0xe5a7('0x10e')](_0x563df0,{'transaction':_0x36e1bc})[_0xe5a7('0x13')](function(){return db[_0xe5a7('0x10b')][_0xe5a7('0x47')]({'where':{'id':{'$in':_0x563df0}}});})[_0xe5a7('0x13')](function(_0x318cab){var _0x5a5da0=_[_0xe5a7('0x31')](_0x318cab,function(_0x1ce233){return _0x1ce233[_0xe5a7('0x10f')]();});return Promise[_0xe5a7('0x5d')](_0x5a5da0);})['then'](function(_0xf79238){_0x2f5910=_[_0xe5a7('0x110')](_0xf79238);var _0x45405b=_[_0xe5a7('0x31')](_0x2f5910,function(_0x2081cf){return _0x2081cf[_0xe5a7('0x111')](_0xa0c80d['id'],{'transaction':_0x36e1bc});});return Promise[_0xe5a7('0x5d')](_0x45405b);})[_0xe5a7('0x13')](function(){if(!_0xa0c80d[_0xe5a7('0x9d')])return;var _0x54158a=_['filter'](_0x2f5910,function(_0x5da5f7){return _0x5da5f7[_0xe5a7('0x112')](_0xe5a7('0x9c'))==='Voice';});var _0x299762=_[_0xe5a7('0x31')](_0x54158a,function(_0x2843d){return db['UserVoiceQueueRt'][_0xe5a7('0x113')]({'membername':_0xa0c80d['name'],'UserId':_0xa0c80d['id'],'queue_name':_0x2843d[_0xe5a7('0x35')],'VoiceQueueId':_0x2843d['id'],'interface':_[_0xe5a7('0x69')](_0xa0c80d[_0xe5a7('0x9f')])?util['format'](_0xe5a7('0xac'),_0xa0c80d[_0xe5a7('0x35')]):_0xa0c80d[_0xe5a7('0x9f')],'paused':_0xa0c80d[_0xe5a7('0xad')]||![],'penalty':_0xa0c80d[_0xe5a7('0xa5')]},{'transaction':_0x36e1bc});});return Promise[_0xe5a7('0x5d')](_0x299762);})[_0xe5a7('0x13')](function(){return db[_0xe5a7('0x114')][_0xe5a7('0x47')]({'where':{'teamId':{'$in':_0x563df0}}});})[_0xe5a7('0x13')](function(_0xb56a21){var _0xaa2878=_[_0xe5a7('0x31')](_0xb56a21,function(_0x2028a1){return db[_0xe5a7('0x115')][_0xe5a7('0x7e')]({'UserId':_0xa0c80d['id'],'VoicePrefixId':_0x2028a1[_0xe5a7('0x116')]},{'transaction':_0x36e1bc});});return Promise[_0xe5a7('0x5d')](_0xaa2878);});});})[_0xe5a7('0x13')](function(){for(var _0x18b75d=0x0;_0x18b75d<_0x2f5910[_0xe5a7('0x4b')];_0x18b75d++){var _0x222b39=_0x2f5910[_0x18b75d]['getDataValue'](_0xe5a7('0x9c'));var _0x459ab4=_0x222b39+_0xe5a7('0xb2');socket[_0xe5a7('0xa7')](_0xe5a7('0x2b')+_0x222b39+_0xe5a7('0xa8'),{'UserId':_0x36f913,['queueField']:_0x2f5910[_0x18b75d]['id']});}})[_0xe5a7('0x13')](respondWithStatusCode(_0x149e5a,null))[_0xe5a7('0x1c')](APIHandleError(_0x149e5a));};exports['removeTeams']=function(_0xdbe6b6,_0x12ea9a){var _0x31f4a7=_0xdbe6b6[_0xe5a7('0x52')]['id'];var _0x2ca6cd=null;if(_0xdbe6b6[_0xe5a7('0x48')]['ids']){_0x2ca6cd=_[_0xe5a7('0x117')](_0xdbe6b6['query'][_0xe5a7('0x62')])?_0xdbe6b6['query'][_0xe5a7('0x62')]:[_0xdbe6b6[_0xe5a7('0x48')]['ids']];}var _0x4e57ce=[];return Promise[_0xe5a7('0xfe')]()[_0xe5a7('0x13')](function(){if(!_0x2ca6cd)throw new APIBadRequestError(_0xe5a7('0x118'));})['then'](function(){return db[_0xe5a7('0x38')]['findOne']({'where':{'id':_0x31f4a7}});})[_0xe5a7('0x13')](function(_0xee3ca2){if(!_0xee3ca2)throw new APINotFoundError(util['format'](_0xe5a7('0x108'),_0xdbe6b6[_0xe5a7('0x52')]['id']));return db[_0xe5a7('0x6b')][_0xe5a7('0x10d')](function(_0x3eefd7){return _0xee3ca2['removeTeams'](_0x2ca6cd,{'transaction':_0x3eefd7})['then'](function(){return db[_0xe5a7('0x10b')][_0xe5a7('0x47')]({'where':{'id':{'$in':_0x2ca6cd}}});})[_0xe5a7('0x13')](function(_0x1abbcc){var _0x568ea5=_[_0xe5a7('0x31')](_0x1abbcc,function(_0x3e4f75){return _0x3e4f75[_0xe5a7('0x10f')]();});return Promise[_0xe5a7('0x5d')](_0x568ea5);})[_0xe5a7('0x13')](function(_0x48f373){_0x4e57ce=_['flattenDeep'](_0x48f373);var _0x530d90=_[_0xe5a7('0x31')](_0x4e57ce,function(_0x4cbab4){return _0x4cbab4[_0xe5a7('0x119')](_0xee3ca2['id'],{'transaction':_0x3eefd7});});return Promise[_0xe5a7('0x5d')](_0x530d90);})[_0xe5a7('0x13')](function(){if(!_0xee3ca2[_0xe5a7('0x9d')])return;var _0x1cb795=_[_0xe5a7('0x2f')](_0x4e57ce,function(_0x5868a3){return _0x5868a3['getDataValue']('channel')===_0xe5a7('0x11a');});var _0x49c364=_[_0xe5a7('0x31')](_0x1cb795,function(_0xebf8e1){return db[_0xe5a7('0xae')][_0xe5a7('0xf1')]({'where':{'VoiceQueueId':_0xebf8e1['id'],'UserId':_0xee3ca2['id']},'transaction':_0x3eefd7});});return Promise[_0xe5a7('0x5d')](_0x49c364);})['then'](function(){return db[_0xe5a7('0x114')][_0xe5a7('0x47')]({'where':{'teamId':{'$in':_0x2ca6cd}}});})[_0xe5a7('0x13')](function(_0x83f352){var _0x47d3b8=_['map'](_0x83f352,function(_0x49c2a7){return db[_0xe5a7('0x115')][_0xe5a7('0xf1')]({'where':{'UserId':_0xee3ca2['id'],'VoicePrefixId':_0x49c2a7[_0xe5a7('0x116')]}},{'transaction':_0x3eefd7});});return Promise[_0xe5a7('0x5d')](_0x47d3b8);});});})[_0xe5a7('0x13')](function(){for(var _0xd4e0a1=0x0;_0xd4e0a1<_0x4e57ce['length'];_0xd4e0a1++){var _0x15f859=_0x4e57ce[_0xd4e0a1][_0xe5a7('0x112')]('channel');var _0x474604=_0x15f859+'QueueId';socket[_0xe5a7('0xa7')]('user'+_0x15f859+_0xe5a7('0xb1'),{'UserId':_0x31f4a7,['queueField']:_0x4e57ce[_0xd4e0a1]['id']});}})['then'](respondWithStatusCode(_0x12ea9a,null))[_0xe5a7('0x1c')](APIHandleError(_0x12ea9a));};exports[_0xe5a7('0x11b')]=function(_0x594965,_0x5ac78d){var _0x25134a={};var _0x38381c={};var _0x3d2280;var _0x28d569;return db[_0xe5a7('0x38')][_0xe5a7('0x96')]({'where':{'id':_0x594965['params']['id']}})['then'](handleEntityNotFound(_0x5ac78d,null))['then'](function(_0x109bed){if(_0x109bed){_0x3d2280=_0x109bed;_0x38381c[_0xe5a7('0x53')]=_[_0xe5a7('0x55')](db['CmList']['rawAttributes']);_0x38381c[_0xe5a7('0x48')]=_[_0xe5a7('0x55')](_0x594965[_0xe5a7('0x48')]);_0x38381c[_0xe5a7('0x56')]=_[_0xe5a7('0x57')](_0x38381c[_0xe5a7('0x53')],_0x38381c['query']);_0x25134a[_0xe5a7('0x45')]=_[_0xe5a7('0x57')](_0x38381c[_0xe5a7('0x53')],qs[_0xe5a7('0x58')](_0x594965[_0xe5a7('0x48')][_0xe5a7('0x58')]));_0x25134a[_0xe5a7('0x45')]=_0x25134a[_0xe5a7('0x45')]['length']?_0x25134a[_0xe5a7('0x45')]:_0x38381c[_0xe5a7('0x53')];_0x25134a[_0xe5a7('0xd2')]=qs[_0xe5a7('0xca')](_0x594965['query'][_0xe5a7('0xca')]);_0x25134a[_0xe5a7('0x3f')]=qs[_0xe5a7('0x56')](_[_0xe5a7('0xd6')](_0x594965[_0xe5a7('0x48')],_0x38381c[_0xe5a7('0x56')]));if(_0x594965[_0xe5a7('0x48')][_0xe5a7('0x2f')]){_0x25134a[_0xe5a7('0x3f')]=_[_0xe5a7('0x59')](_0x25134a[_0xe5a7('0x3f')],{'$or':_[_0xe5a7('0x31')](_0x25134a[_0xe5a7('0x45')],function(_0x26cdb0){var _0xf21aad={};_0xf21aad[_0x26cdb0]={'$like':'%'+_0x594965[_0xe5a7('0x48')][_0xe5a7('0x2f')]+'%'};return _0xf21aad;})});}_0x25134a=_[_0xe5a7('0x59')]({},_0x25134a,_0x594965[_0xe5a7('0x5a')]);return _0x3d2280['getLists'](_0x25134a);}})[_0xe5a7('0x13')](function(_0x11fddf){if(_0x11fddf){_0x28d569=_0x11fddf[_0xe5a7('0x4b')];if(!_0x594965[_0xe5a7('0x48')][_0xe5a7('0xcf')](_0xe5a7('0xd0'))){_0x25134a[_0xe5a7('0x23')]=qs['limit'](_0x594965['query']['limit']);_0x25134a[_0xe5a7('0x20')]=qs[_0xe5a7('0x20')](_0x594965[_0xe5a7('0x48')][_0xe5a7('0x20')]);}return _0x3d2280[_0xe5a7('0x11b')](_0x25134a);}})[_0xe5a7('0x13')](function(_0x2b2d18){if(_0x2b2d18){return _0x2b2d18?{'count':_0x28d569,'rows':_0x2b2d18}:null;}})[_0xe5a7('0x13')](respondWithResult(_0x5ac78d,null))[_0xe5a7('0x1c')](handleError(_0x5ac78d,null));};exports[_0xe5a7('0x11c')]=function(_0x5859df,_0x2c6498){var _0x487d83={};var _0x108520={};var _0x590b89;return db[_0xe5a7('0x38')][_0xe5a7('0x96')]({'where':{'id':_0x5859df[_0xe5a7('0x52')]['id']}})[_0xe5a7('0x13')](handleEntityNotFound(_0x2c6498,null))[_0xe5a7('0x13')](function(_0x206a7a){if(_0x206a7a){_0x590b89=_0x206a7a;_0x108520[_0xe5a7('0x53')]=_[_0xe5a7('0x55')](db[_0xe5a7('0x38')]['rawAttributes']);_0x108520[_0xe5a7('0x48')]=_[_0xe5a7('0x55')](_0x5859df['query']);_0x108520[_0xe5a7('0x56')]=_[_0xe5a7('0x57')](_0x108520['model'],_0x108520[_0xe5a7('0x48')]);_0x487d83[_0xe5a7('0x45')]=_[_0xe5a7('0x57')](_0x108520['model'],qs[_0xe5a7('0x58')](_0x5859df[_0xe5a7('0x48')][_0xe5a7('0x58')]));_0x487d83['attributes']=_0x487d83[_0xe5a7('0x45')][_0xe5a7('0x4b')]?_0x487d83[_0xe5a7('0x45')]:_0x108520[_0xe5a7('0x53')];_0x487d83[_0xe5a7('0xd2')]=qs[_0xe5a7('0xca')](_0x5859df[_0xe5a7('0x48')][_0xe5a7('0xca')]);_0x487d83['where']=qs[_0xe5a7('0x56')](_[_0xe5a7('0xd6')](_0x5859df[_0xe5a7('0x48')],_0x108520[_0xe5a7('0x56')]));if(_0x5859df['query'][_0xe5a7('0x2f')]){_0x487d83[_0xe5a7('0x3f')]=_[_0xe5a7('0x59')](_0x487d83[_0xe5a7('0x3f')],{'$or':_[_0xe5a7('0x31')](_0x487d83['attributes'],function(_0xedab1e){var _0x5ab4d4={};_0x5ab4d4[_0xedab1e]={'$like':'%'+_0x5859df['query'][_0xe5a7('0x2f')]+'%'};return _0x5ab4d4;})});}_0x487d83['model']=db[_0xe5a7('0x38')];_0x487d83['as']=_0xe5a7('0x2c');_0x487d83=_[_0xe5a7('0x59')]({},_0x487d83,_0x5859df[_0xe5a7('0x5a')]);return _0x590b89[_0xe5a7('0xf3')]({'include':[_0x487d83]});}})[_0xe5a7('0x13')](function(_0x494e4a){if(_0x494e4a){var _0x122561={},_0x260b81=[];for(var _0x346c45=0x0;_0x346c45<_0x494e4a[_0xe5a7('0x4b')];_0x346c45+=0x1){for(var _0x29b43c=0x0,_0x286523;_0x29b43c<_0x494e4a[_0x346c45][_0xe5a7('0x2c')][_0xe5a7('0x4b')];_0x29b43c+=0x1){_0x286523=_0x494e4a[_0x346c45][_0xe5a7('0x2c')][_0x29b43c]['get']({'plain':!![]});_0x122561[_0x286523['id']]=_0x286523;}}_0x122561=_[_0xe5a7('0x11d')](_0x122561);for(var _0x442e51=qs[_0xe5a7('0x20')](_0x5859df[_0xe5a7('0x48')][_0xe5a7('0x20')]);_0x442e51<_0x122561[_0xe5a7('0x4b')]&&_0x260b81['length']=_0x2f5261){_0x2cc0fc=_0x2f5261;_0x3642c9=0xc8;}else{_0x3642c9=0xce;}_0x263e29['status'](_0x3642c9);return _0x263e29[_0x4f75('0x24')](_0x4f75('0x25'),_0x4030da+'-'+_0x2cc0fc+'/'+_0x2f5261)[_0x4f75('0x1f')](_0x4a691e);}return null;};}function saveUpdates(_0x5d7c1c){return function(_0x4c5d67){if(_0x4c5d67){return _0x4c5d67['update'](_0x5d7c1c)[_0x4f75('0x26')](function(_0x515501){socket[_0x4f75('0x27')](_0x4f75('0x28')+_0x515501['id'],{});return _0x515501;});}return null;};}function removeEntity(_0x39a035){return function(_0x589f6d){if(_0x589f6d){return _0x589f6d[_0x4f75('0x29')]()['then'](function(){var _0x50e2d9=_0x589f6d[_0x4f75('0x2a')]({'plain':!![]});if(_0x50e2d9[_0x4f75('0x2b')]===_0x4f75('0x2c'))return;var _0x5266a9=[{'name':'Users','value':'user','ignore':!![]},{'name':_0x4f75('0x2d'),'value':_0x4f75('0x2e'),'ignore':![]},{'name':_0x4f75('0x2f'),'value':_0x4f75('0x30'),'ignore':![]}];var _0x4b7097=_(_0x5266a9)['filter'](_0x4f75('0x31'))[_0x4f75('0x32')](_0x4f75('0x33'))[_0x4f75('0x33')]();if(_[_0x4f75('0x34')](_0x4b7097,_0x50e2d9[_0x4f75('0x2b')])){return;}var _0x2814ff=_['find'](_0x5266a9,['value',_0x50e2d9['role']])[_0x4f75('0x35')];return db[_0x4f75('0x36')][_0x4f75('0x29')]({'where':{'type':_0x2814ff,'resourceId':_0x50e2d9['id']}})[_0x4f75('0x26')](function(){return _0x589f6d;});})[_0x4f75('0x26')](function(){_0x39a035['status'](0xcc)[_0x4f75('0x1e')]();});}};}function handleEntityNotFound(_0x2a1883){return function(_0x28ed8a){if(!_0x28ed8a){_0x2a1883[_0x4f75('0x37')](0x194);}return _0x28ed8a;};}function handleError(_0x33fdbe,_0x4edf62){_0x4edf62=_0x4edf62||0x1f4;return function(_0x290589){logger[_0x4f75('0x1c')](_0x290589[_0x4f75('0x38')]);if(_0x290589['name']){delete _0x290589[_0x4f75('0x35')];}_0x33fdbe[_0x4f75('0x39')](_0x4edf62)[_0x4f75('0x3a')](_0x290589);};}exports[_0x4f75('0x3b')]=function(_0x572537,_0x1cb209){var _0x36cb4d={},_0x1fc908={'count':0x0,'rows':[]};var _0x106061=_(db[_0x4f75('0x3c')]['rawAttributes'])['map'](function(_0x3529c0){return{'name':_0x3529c0[_0x4f75('0x3d')],'type':_0x3529c0['type'][_0x4f75('0x3e')]};})[_0x4f75('0x3f')](function(_0x4a43c0){return!_[_0x4f75('0x34')]([_0x4f75('0x40'),_0x4f75('0x41')],_0x4a43c0['name']);})['value']();_0x36cb4d=qs[_0x4f75('0x42')](_0x106061,_0x572537);var _0x4dd9={'where':_0x36cb4d[_0x4f75('0x43')]};return db[_0x4f75('0x3c')][_0x4f75('0x22')](_0x4dd9)[_0x4f75('0x26')](function(_0x1b5686){_0x1fc908[_0x4f75('0x22')]=_0x1b5686;if(_0x572537[_0x4f75('0x44')][_0x4f75('0x45')]){_0x36cb4d[_0x4f75('0x46')]=[{'all':!![]}];}if(_0x572537[_0x4f75('0x44')][_0x4f75('0x47')]===_0x4f75('0x48')){_0x36cb4d[_0x4f75('0x46')]=[{'model':db[_0x4f75('0x49')],'as':_0x4f75('0x47')}];}if(!_[_0x4f75('0x34')](_0x36cb4d['attributes'],'id')){_0x36cb4d[_0x4f75('0x4a')][_0x4f75('0x4b')]('id');}return db[_0x4f75('0x3c')][_0x4f75('0x4c')](_0x36cb4d);})[_0x4f75('0x26')](function(_0x46b2b7){_0x1fc908[_0x4f75('0x4d')]=_0x46b2b7;if(_0x572537[_0x4f75('0x44')][_0x4f75('0x4e')]===_0x4f75('0x48')){var _0x439b4a=[];for(var _0x5b3a9c=0x0;_0x5b3a9c<_0x1fc908[_0x4f75('0x4d')][_0x4f75('0x4f')];_0x5b3a9c++){_0x439b4a[_0x4f75('0x4b')](get_open_tabs(_0x4f75('0x50'),_0x1fc908[_0x4f75('0x4d')][_0x5b3a9c][_0x4f75('0x51')]));_0x439b4a[_0x4f75('0x4b')](get_open_tabs(_0x4f75('0x52'),_0x1fc908['rows'][_0x5b3a9c][_0x4f75('0x51')]));_0x439b4a['push'](get_open_tabs(_0x4f75('0x53'),_0x1fc908[_0x4f75('0x4d')][_0x5b3a9c]['dataValues']));_0x439b4a[_0x4f75('0x4b')](get_open_tabs('mail',_0x1fc908[_0x4f75('0x4d')][_0x5b3a9c][_0x4f75('0x51')]));_0x439b4a[_0x4f75('0x4b')](get_open_tabs(_0x4f75('0x54'),_0x1fc908[_0x4f75('0x4d')][_0x5b3a9c]['dataValues']));_0x439b4a['push'](get_open_tabs(_0x4f75('0x55'),_0x1fc908['rows'][_0x5b3a9c]['dataValues']));}return Promise[_0x4f75('0x56')](_0x439b4a)['then'](function(){return _0x1fc908;});}else{return _0x1fc908;}})[_0x4f75('0x26')](respondWithFilteredResult(_0x1cb209,_0x36cb4d))['catch'](handleError(_0x1cb209,null));};exports[_0x4f75('0x57')]=function(_0x390776,_0x5f5055){var _0x1d1eda={'raw':![],'where':{'id':_0x390776[_0x4f75('0x58')]['id']}},_0x3f1dbe={};_0x3f1dbe['model']=_['differenceBy'](_[_0x4f75('0x59')](db['User'][_0x4f75('0x5a')]),[_0x4f75('0x40'),_0x4f75('0x41')]);_0x3f1dbe[_0x4f75('0x44')]=_[_0x4f75('0x59')](_0x390776[_0x4f75('0x44')]);_0x3f1dbe['filters']=_[_0x4f75('0x5b')](_0x3f1dbe[_0x4f75('0x5c')],_0x3f1dbe[_0x4f75('0x44')]);_0x1d1eda[_0x4f75('0x4a')]=_[_0x4f75('0x5b')](_0x3f1dbe[_0x4f75('0x5c')],qs['fields'](_0x390776[_0x4f75('0x44')][_0x4f75('0x5d')]));_0x1d1eda[_0x4f75('0x4a')]=_0x1d1eda[_0x4f75('0x4a')][_0x4f75('0x4f')]?_0x1d1eda[_0x4f75('0x4a')]:_0x3f1dbe['model'];if(_0x390776[_0x4f75('0x44')][_0x4f75('0x45')]){_0x1d1eda[_0x4f75('0x46')]=[{'all':!![]}];}if(_0x390776[_0x4f75('0x44')][_0x4f75('0x47')]===_0x4f75('0x48')){_0x1d1eda[_0x4f75('0x46')]=[{'model':db[_0x4f75('0x49')],'as':'userSetting'}];}_0x1d1eda=_[_0x4f75('0x5e')]({},_0x1d1eda,_0x390776[_0x4f75('0x5f')]);if(!_[_0x4f75('0x34')](_0x1d1eda[_0x4f75('0x4a')],'id')){_0x1d1eda[_0x4f75('0x4a')]['push']('id');}return db[_0x4f75('0x3c')][_0x4f75('0x60')](_0x1d1eda)[_0x4f75('0x26')](handleEntityNotFound(_0x5f5055,null))['then'](function(_0x235da3){var _0x49c924=[];values=_0x235da3;if(_0x390776[_0x4f75('0x44')][_0x4f75('0x4e')]===_0x4f75('0x48')){_0x49c924[_0x4f75('0x4b')](get_open_tabs('chat',_0x235da3['dataValues']));_0x49c924[_0x4f75('0x4b')](get_open_tabs(_0x4f75('0x52'),_0x235da3[_0x4f75('0x51')]));_0x49c924[_0x4f75('0x4b')](get_open_tabs(_0x4f75('0x54'),_0x235da3[_0x4f75('0x51')]));_0x49c924[_0x4f75('0x4b')](get_open_tabs('whatsapp',_0x235da3[_0x4f75('0x51')]));_0x49c924[_0x4f75('0x4b')](get_open_tabs(_0x4f75('0x53'),_0x235da3[_0x4f75('0x51')]));_0x49c924[_0x4f75('0x4b')](get_open_tabs(_0x4f75('0x61'),_0x235da3['dataValues']));return Promise[_0x4f75('0x56')](_0x49c924);}else{return values;}})[_0x4f75('0x26')](function(){return values;})['then'](respondWithResult(_0x5f5055,null))[_0x4f75('0x62')](handleError(_0x5f5055,null));};exports[_0x4f75('0x63')]=function(_0x17862f,_0x17ffce){if(_0x17862f[_0x4f75('0x64')]['id']){delete _0x17862f['body']['id'];}delete _0x17862f[_0x4f75('0x64')][_0x4f75('0x2b')];return db['User'][_0x4f75('0x60')]({'where':{'id':_0x17862f['params']['id']}})[_0x4f75('0x26')](handleEntityNotFound(_0x17ffce,null))['then'](saveUpdates(_0x17862f[_0x4f75('0x64')],null))[_0x4f75('0x26')](respondWithResult(_0x17ffce,null))[_0x4f75('0x62')](handleError(_0x17ffce,null));};exports[_0x4f75('0x65')]=function(_0x388eab,_0x5d5118){return db['User'][_0x4f75('0x65')]()[_0x4f75('0x26')](respondWithResult(_0x5d5118,null))[_0x4f75('0x62')](handleError(_0x5d5118,null));};exports['addContacts']=function(_0x5b6243,_0x1e4f11){return db['User'][_0x4f75('0x60')]({'where':{'id':_0x5b6243[_0x4f75('0x58')]['id']}})['then'](handleEntityNotFound(_0x1e4f11,null))['then'](function(_0x29caf6){if(_0x29caf6){return _0x29caf6[_0x4f75('0x66')](_0x5b6243['body'][_0x4f75('0x67')],_[_0x4f75('0x68')](_0x5b6243[_0x4f75('0x64')],[_0x4f75('0x67'),'id'])||{});}})['then'](respondWithResult(_0x1e4f11,null))[_0x4f75('0x62')](handleError(_0x1e4f11,null));};function validateUser(_0x3d742f){return new Promise(function(_0x13e137,_0x3ed2ac){if(_0x3d742f[_0x4f75('0x69')])return _0x13e137(_0x3d742f);return db[_0x4f75('0x6a')][_0x4f75('0x6b')](0x1)['then'](function(_0x6b2453){if(_0x6b2453[_0x4f75('0x6c')])authService[_0x4f75('0x6d')](_0x3d742f[_0x4f75('0x40')]);db[_0x4f75('0x3c')][_0x4f75('0x6e')](_0x4f75('0x69'))[_0x4f75('0x26')](function(_0x5823c7){if(_[_0x4f75('0x6f')](_0x5823c7)){_0x3d742f[_0x4f75('0x69')]=_0x6b2453['min_internal']||0x1;return;}if(_[_0x4f75('0x6f')](_0x6b2453['min_internal'])||_0x6b2453[_0x4f75('0x70')]===_0x5823c7){_0x3d742f[_0x4f75('0x69')]=_0x5823c7+0x1;return;}if(_0x6b2453[_0x4f75('0x70')]>_0x5823c7){_0x3d742f[_0x4f75('0x69')]=_0x6b2453['min_internal'];return;}return db['sequelize'][_0x4f75('0x44')](_0x4f75('0x71'),{'type':db[_0x4f75('0x72')][_0x4f75('0x73')][_0x4f75('0x74')]})['then'](function(_0xdde4ba){if(_0xdde4ba&&_0xdde4ba[_0x4f75('0x4f')]){for(var _0x3f1b73=0x0,_0x1d01d8=_0xdde4ba[_0x4f75('0x4f')];_0x3f1b73<_0x1d01d8&&_['isNil'](_0x3d742f[_0x4f75('0x69')]);_0x3f1b73++){if(_0x6b2453[_0x4f75('0x70')]<=_0xdde4ba[_0x3f1b73][_0x4f75('0x75')]){_0x3d742f[_0x4f75('0x69')]=_0xdde4ba[_0x3f1b73]['from'];}else if(_0x6b2453[_0x4f75('0x70')]>_0xdde4ba[_0x3f1b73][_0x4f75('0x75')]&&_0x6b2453[_0x4f75('0x70')]<=_0xdde4ba[_0x3f1b73]['to']){_0x3d742f[_0x4f75('0x69')]=_0x6b2453['min_internal'];}}}if(_['isNil'](_0x3d742f[_0x4f75('0x69')])){_0x3d742f['internal']=_0x5823c7+0x1;}return _0x13e137(_0x3d742f);});});})[_0x4f75('0x62')](function(_0x507e45){_0x3ed2ac(_0x507e45);});});}function updateUser(_0x569f39){return new Promise(function(_0x35e4a9,_0x5e52eb){try{if(_0x569f39[_0x4f75('0x76')]){_0x569f39[_0x4f75('0x77')]=_0x569f39[_0x4f75('0x69')];_0x569f39[_0x4f75('0x78')]={'mailbox':_0x569f39[_0x4f75('0x69')],'password':_0x569f39['password'],'fullname':_0x569f39[_0x4f75('0x79')],'email':_0x569f39[_0x4f75('0x7a')]};}if(_0x569f39[_0x4f75('0x2b')]===_0x4f75('0x2e')){if(!_0x569f39[_0x4f75('0x7b')])_0x569f39['permissions']=[_0x4f75('0x7c'),_0x4f75('0x7d'),_0x4f75('0x7e'),_0x4f75('0x7f'),'110',_0x4f75('0x80'),_0x4f75('0x81'),_0x4f75('0x82'),_0x4f75('0x83'),'108',_0x4f75('0x84'),_0x4f75('0x85'),_0x4f75('0x86'),_0x4f75('0x87'),_0x4f75('0x88')];}_0x35e4a9(_0x569f39);}catch(_0x500a2a){_0x5e52eb(_0x500a2a);}});}exports[_0x4f75('0x89')]=function(_0x4c4550,_0x5131e2){if(_0x4c4550[_0x4f75('0x8a')][_0x4f75('0x2b')]===_0x4f75('0x2e'))throw new Error('Unauthorized');if(_0x4c4550[_0x4f75('0x64')]['role']==='user'&&_0x4c4550[_0x4f75('0x8a')][_0x4f75('0x2b')]!=='admin'){throw new Error(_0x4f75('0x8b'));}if(_0x4c4550[_0x4f75('0x64')]['role']===_0x4f75('0x2c')&&_0x4c4550['user'][_0x4f75('0x2b')]!==_0x4f75('0x2c')){throw new Error(_0x4f75('0x8c'));}return licenseUtil[_0x4f75('0x8d')]([_0x4c4550[_0x4f75('0x64')]])[_0x4f75('0x26')](function(){return validateUser(_0x4c4550['body']);})['then'](function(_0x4a7c0b){return updateUser(_0x4a7c0b)['then'](function(_0x149e1b){if(_0x149e1b[_0x4f75('0x2b')]==='admin'){_0x149e1b[_0x4f75('0x8e')]=_0x4c4550[_0x4f75('0x8a')][_0x4f75('0x8e')];delete _0x149e1b['userProfileId'];}return _0x149e1b;});})[_0x4f75('0x26')](function(_0x4554da){return db['User'][_0x4f75('0x89')](_0x4554da,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]});})[_0x4f75('0x26')](function(_0x158ea2){if(_0x4c4550[_0x4f75('0x64')][_0x4f75('0x2b')]===_0x4f75('0x8a'))return _0x158ea2;if(_0x4c4550[_0x4f75('0x8a')][_0x4f75('0x2b')]!==_0x4f75('0x8a'))return _0x158ea2;return db[_0x4f75('0x8f')][_0x4f75('0x60')]({'where':{'name':_0x158ea2[_0x4f75('0x2b')]===_0x4f75('0x2e')?_0x4f75('0x2d'):_0x4f75('0x2f'),'userProfileId':_0x4c4550['user'][_0x4f75('0x90')]},'raw':!![]})['then'](function(_0xedbd71){if(!_0xedbd71||_0xedbd71[_0x4f75('0x91')]!=0x0)return _0x158ea2;return db[_0x4f75('0x36')][_0x4f75('0x89')]({'name':_0x158ea2['name'],'resourceId':_0x158ea2['id'],'type':_0xedbd71[_0x4f75('0x35')],'sectionId':_0xedbd71['id']},{})['then'](function(){return _0x158ea2;});})[_0x4f75('0x62')](function(_0x37075f){logger[_0x4f75('0x1c')](_0x4f75('0x92'),_0x37075f);throw _0x37075f;});})[_0x4f75('0x26')](respondWithResult(_0x5131e2,0xc9))['catch'](handleError(_0x5131e2,null));};exports[_0x4f75('0x93')]=function(_0x2e4ac1,_0x48e553){var _0x16f598=_0x2e4ac1[_0x4f75('0x64')];var _0x14c939=[];if(_0x2e4ac1[_0x4f75('0x8a')][_0x4f75('0x2b')]===_0x4f75('0x2e'))throw new Error('Unauthorized');if(_[_0x4f75('0x94')](_0x16f598,[_0x4f75('0x2b'),_0x4f75('0x8a')])&&_0x2e4ac1[_0x4f75('0x8a')][_0x4f75('0x2b')]!=='admin'){throw new Error(_0x4f75('0x8b'));}if(_[_0x4f75('0x94')](_0x16f598,[_0x4f75('0x2b'),_0x4f75('0x2c')])&&_0x2e4ac1['user']['role']!==_0x4f75('0x2c')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x4f75('0x8d')](_0x16f598)[_0x4f75('0x26')](function(){return validateUser(_0x16f598[0x0]);})['then'](function(){for(var _0x1f99d4=0x1;_0x1f99d4<_0x16f598[_0x4f75('0x4f')];_0x1f99d4++){var _0x5b7cd1=_0x16f598[_0x1f99d4-0x1][_0x4f75('0x69')];if(!_0x16f598[_0x1f99d4]['internal'])_0x16f598[_0x1f99d4][_0x4f75('0x69')]=_0x5b7cd1+0x1;_0x14c939[_0x4f75('0x4b')](validateUser(_0x16f598[_0x1f99d4]));}return Promise['all'](_0x14c939);})[_0x4f75('0x26')](function(){_0x14c939=[];for(var _0x57d020=0x0;_0x57d020<_0x16f598['length'];_0x57d020++){_0x14c939['push'](updateUser(_0x16f598[_0x57d020]));}return Promise['all'](_0x14c939);})[_0x4f75('0x26')](function(){_0x14c939=_0x16f598[_0x4f75('0x32')](function(_0x4c8c68){return db['User'][_0x4f75('0x89')](_0x4c8c68,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]})[_0x4f75('0x26')](function(_0x550b5c){_0x4c8c68['id']=_0x550b5c['id'];return _0x4c8c68;});});return Promise[_0x4f75('0x56')](_0x14c939);})[_0x4f75('0x26')](function(_0x1a1955){if(_0x2e4ac1['body'][_0x4f75('0x2b')]===_0x4f75('0x8a'))return _0x1a1955;if(_0x2e4ac1['user'][_0x4f75('0x2b')]!==_0x4f75('0x8a'))return _0x1a1955;var _0x4278f0=_[_0x4f75('0x94')](_0x1a1955,function(_0x42a71b){return _0x42a71b['role']===_0x4f75('0x2e')||_0x42a71b[_0x4f75('0x2b')]===_0x4f75('0x30');});if(!_0x4278f0)return _0x1a1955;return db[_0x4f75('0x8f')]['findAll']({'where':{'name':{'$or':[_0x4f75('0x2d'),_0x4f75('0x2f')]},'userProfileId':_0x2e4ac1['user'][_0x4f75('0x90')]},'raw':!![]})['then'](function(_0x3f6277){if(_[_0x4f75('0x95')](_0x3f6277)||!_['some'](_0x3f6277,['autoAssociation',0x0]))return _0x1a1955;_0x14c939=[];var _0x304473=_(_0x3f6277)['map'](function(_0x1edc6d){if(_0x1edc6d[_0x4f75('0x91')]===0x1)return;return _0x1edc6d['name']==='Agents'?_0x4f75('0x2e'):_0x4f75('0x30');})[_0x4f75('0x96')]()[_0x4f75('0x33')]();for(var _0x55fd54=0x0;_0x55fd54<_0x1a1955[_0x4f75('0x4f')];_0x55fd54++){if(!_[_0x4f75('0x34')](_0x304473,_0x1a1955[_0x55fd54][_0x4f75('0x2b')]))return;var _0x32a239=_0x1a1955[_0x55fd54][_0x4f75('0x2b')]===_0x4f75('0x2e')?_0x4f75('0x2d'):_0x4f75('0x2f');_0x14c939[_0x4f75('0x4b')](db[_0x4f75('0x36')][_0x4f75('0x89')]({'name':_0x1a1955[_0x55fd54][_0x4f75('0x35')],'resourceId':_0x1a1955[_0x55fd54]['id'],'type':_0x32a239,'sectionId':_['find'](_0x3f6277,[_0x4f75('0x35'),_0x32a239])['id']},{}));}return Promise['all'](_0x14c939);});})[_0x4f75('0x26')](respondWithResult(_0x48e553,0xc9))[_0x4f75('0x62')](handleError(_0x48e553,null));};exports[_0x4f75('0x97')]=function(_0x231e03,_0x1d23b7){if(_0x231e03[_0x4f75('0x64')]['id']){delete _0x231e03[_0x4f75('0x64')]['id'];}return db[_0x4f75('0x3c')][_0x4f75('0x60')]({'where':{'id':_0x231e03[_0x4f75('0x58')]['id']}})['then'](function(_0x576c2d){if(!_0x576c2d)return null;if(_0x576c2d['id']===_0x231e03['user']['id']){if(!_0x231e03[_0x4f75('0x64')][_0x4f75('0x98')]||!_0x231e03[_0x4f75('0x64')][_0x4f75('0x99')]){throw new db[(_0x4f75('0x9a'))]['ValidationError'](_0x4f75('0x9b'));}if(!_0x576c2d['authenticate'](_0x231e03[_0x4f75('0x64')][_0x4f75('0x98')])){throw new db['Sequelize'][(_0x4f75('0x9c'))](_0x4f75('0x9d'));}if(_0x231e03[_0x4f75('0x64')]['oldPassword']===_0x231e03['body'][_0x4f75('0x99')]){throw new db['Sequelize']['ValidationError'](_0x4f75('0x9e'));}}else if(_0x231e03[_0x4f75('0x8a')]['role']===_0x4f75('0x2c')){if(!_0x231e03[_0x4f75('0x64')][_0x4f75('0x99')]){throw new db[(_0x4f75('0x9a'))][(_0x4f75('0x9c'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x231e03[_0x4f75('0x8a')]['role']===_0x4f75('0x8a')){if(!_0x231e03[_0x4f75('0x64')]['newPassword']){throw new db[(_0x4f75('0x9a'))][(_0x4f75('0x9c'))](_0x4f75('0x9f'));}if(_0x576c2d[_0x4f75('0x2b')]!==_0x4f75('0x2e')){throw new db[(_0x4f75('0x9a'))]['ValidationError']('Unauthorized');}}else{throw new db['Sequelize']['ValidationError'](_0x4f75('0xa0'));}return _0x576c2d;})[_0x4f75('0x26')](handleEntityNotFound(_0x1d23b7,null))[_0x4f75('0x26')](function(_0x2a3f72){return db[_0x4f75('0x6a')][_0x4f75('0xa1')]({'attributes':['id',_0x4f75('0x6c'),_0x4f75('0xa2'),'passwordHistoryLimit']})[_0x4f75('0x26')](function(_0x97f95c){if(_0x97f95c[_0x4f75('0x6c')])authService[_0x4f75('0x6d')](_0x231e03['body'][_0x4f75('0x99')]);if(!_0x97f95c[_0x4f75('0xa2')]||!_0x2a3f72[_0x4f75('0xa3')])return _0x2a3f72;authService['validatePasswordHistory'](_0x231e03[_0x4f75('0x64')][_0x4f75('0x99')],_0x2a3f72['previousPasswords'],_0x97f95c[_0x4f75('0xa4')]);return _0x2a3f72;})['then'](saveUpdates({'password':_0x231e03[_0x4f75('0x64')][_0x4f75('0x99')],'passwordResetAt':_0x231e03[_0x4f75('0x8a')]['id']==_0x231e03[_0x4f75('0x58')]['id']?moment():null,'previousPasswords':authService[_0x4f75('0xa5')](_0x231e03[_0x4f75('0x64')][_0x4f75('0x99')],_0x2a3f72[_0x4f75('0xa3')])},null));})['then'](respondWithResult(_0x1d23b7,null))[_0x4f75('0x62')](handleError(_0x1d23b7,null));};exports['addQueues']=function(_0x2fe6f5,_0x290750){var _0x4dca0b=_0x2fe6f5[_0x4f75('0x64')][_0x4f75('0xa6')];return db[_0x4f75('0x3c')][_0x4f75('0x60')]({'where':{'id':_0x2fe6f5[_0x4f75('0x58')]['id']},'attributes':['id',_0x4f75('0x35'),_0x4f75('0x2b'),_0x4f75('0xa7'),_0x4f75('0xa8'),_0x4f75('0xa9'),_0x4f75('0xaa')]})[_0x4f75('0x26')](handleEntityNotFound(_0x290750,null))[_0x4f75('0x26')](function(_0x64bfa){if(_0x64bfa){if(!utils[_0x4f75('0xab')](_0x4dca0b)){throw new db['Sequelize'][(_0x4f75('0x9c'))](_0x4f75('0xac'));}return _0x64bfa['add'+_['capitalize'](_0x4dca0b[_0x4f75('0xad')]())+_0x4f75('0xae')](_0x2fe6f5['body'][_0x4f75('0x67')],{'penalty':_0x2fe6f5[_0x4f75('0x64')]['penalty']||0x0})['spread'](function(_0x2a7a16){for(var _0x5684f0=0x0;_0x5684f0<_0x2fe6f5[_0x4f75('0x64')][_0x4f75('0x67')][_0x4f75('0x4f')];_0x5684f0+=0x1){var _0x4ce990={'UserId':Number(_0x2fe6f5[_0x4f75('0x58')]['id'])};_0x4ce990[_['capitalize'](_0x4dca0b[_0x4f75('0xad')]())+_0x4f75('0xaf')]=Number(_0x2fe6f5['body'][_0x4f75('0x67')][_0x5684f0]);socket[_0x4f75('0x27')](_0x4f75('0x8a')+_['capitalize'](_0x4dca0b[_0x4f75('0xad')]())+_0x4f75('0xb0'),_0x4ce990);}return _0x2a7a16;})[_0x4f75('0x26')](function(){if(_0x4dca0b===_0x4f75('0xb1')){return db[_0x4f75('0xb2')][_0x4f75('0x4c')]({'where':{'id':_0x2fe6f5[_0x4f75('0x64')][_0x4f75('0x67')]||[]},'raw':!![],'attributes':['id',_0x4f75('0x35')]});}})['then'](function(_0x7ce869){var _0xb7ee5d=_0x64bfa[_0x4f75('0x2a')]({'plain':!![]});var _0x60f1e0=[];if(_0x4dca0b===_0x4f75('0xb1')&&_0xb7ee5d[_0x4f75('0x2b')]===_0x4f75('0x2e')&&_0xb7ee5d[_0x4f75('0xa7')]){for(let _0xc5c564=0x0;_0xc5c564<_0x7ce869[_0x4f75('0x4f')];_0xc5c564+=0x1){_0x60f1e0[_0x4f75('0x4b')]({'membername':_0xb7ee5d['name'],'UserId':_0xb7ee5d['id'],'queue_name':_0x7ce869[_0xc5c564][_0x4f75('0x35')],'VoiceQueueId':_0x7ce869[_0xc5c564]['id'],'interface':_[_0x4f75('0x6f')](_0xb7ee5d[_0x4f75('0xaa')])?util[_0x4f75('0xb3')](_0x4f75('0xb4'),_0xb7ee5d[_0x4f75('0x35')]):_0xb7ee5d[_0x4f75('0xaa')],'paused':_0xb7ee5d[_0x4f75('0xa9')]||![],'penalty':_0x2fe6f5[_0x4f75('0x64')][_0x4f75('0xb5')]||0x0});}return Promise[_0x4f75('0x56')](_0x60f1e0['map'](function(_0x43b8e2){return db['UserVoiceQueueRt'][_0x4f75('0xb6')](_0x43b8e2);}));}return _0x64bfa;});}})[_0x4f75('0x26')](respondWithStatusCode(_0x290750,null))[_0x4f75('0x62')](handleError(_0x290750,null));};exports[_0x4f75('0xb7')]=function(_0x23ce54,_0xd07c5d){var _0xae0fc4,_0x555cfc;return db[_0x4f75('0x3c')][_0x4f75('0x60')]({'where':{'id':_0x23ce54[_0x4f75('0x58')]['id']},'attributes':['id',_0x4f75('0x35'),_0x4f75('0x2b')]})['then'](handleEntityNotFound(_0xd07c5d,null))[_0x4f75('0x26')](function(_0x2d0ea1){if(_0x2d0ea1){_0xae0fc4=_0x2d0ea1;if(!_0x23ce54['query']['channel']||!utils['isValidChannel'](_0x23ce54[_0x4f75('0x44')][_0x4f75('0xa6')])){throw new db[(_0x4f75('0x9a'))][(_0x4f75('0x9c'))](_0x4f75('0xac'));}return _0x2d0ea1[_0x4f75('0xb8')+_['capitalize'](_0x23ce54[_0x4f75('0x44')]['channel'][_0x4f75('0xad')]())+_0x4f75('0xae')](_0x23ce54[_0x4f75('0x44')][_0x4f75('0x67')]);}})[_0x4f75('0x26')](function(_0x1f3a95){if(_[_0x4f75('0xb9')](_0x23ce54[_0x4f75('0x44')][_0x4f75('0x67')])){for(var _0x2fa3ad=0x0;_0x2fa3ad<_0x23ce54['query'][_0x4f75('0x67')][_0x4f75('0x4f')];_0x2fa3ad+=0x1){_0x555cfc={'UserId':Number(_0x23ce54[_0x4f75('0x58')]['id'])};_0x555cfc[_['capitalize'](_0x23ce54[_0x4f75('0x44')][_0x4f75('0xa6')][_0x4f75('0xad')]())+'QueueId']=Number(_0x23ce54['query'][_0x4f75('0x67')][_0x2fa3ad]);socket[_0x4f75('0x27')]('user'+_[_0x4f75('0xba')](_0x23ce54['query'][_0x4f75('0xa6')][_0x4f75('0xad')]())+'Queue:remove',_0x555cfc);}}else{_0x555cfc={'UserId':Number(_0x23ce54[_0x4f75('0x58')]['id'])};_0x555cfc[_['capitalize'](_0x23ce54['query'][_0x4f75('0xa6')][_0x4f75('0xad')]())+'QueueId']=Number(_0x23ce54[_0x4f75('0x44')]['ids']);socket[_0x4f75('0x27')]('user'+_[_0x4f75('0xba')](_0x23ce54[_0x4f75('0x44')]['channel'][_0x4f75('0xad')]())+_0x4f75('0xbb'),_0x555cfc);}return _0x1f3a95;})['then'](function(){if(_0x23ce54['query'][_0x4f75('0xa6')]===_0x4f75('0xb1')){return db[_0x4f75('0xbc')][_0x4f75('0x29')]({'where':{'UserId':_0x23ce54[_0x4f75('0x58')]['id'],'VoiceQueueId':_0x23ce54['query'][_0x4f75('0x67')]},'individualHooks':!![]})[_0x4f75('0x26')](function(){return _0xae0fc4;});}return _0xae0fc4;})[_0x4f75('0x26')](respondWithStatusCode(_0xd07c5d,null))[_0x4f75('0x62')](handleError(_0xd07c5d,null));};exports[_0x4f75('0xbd')]=function(_0x385baf,_0x404ee0){_0x385baf[_0x4f75('0x64')][_0x4f75('0xbe')]=_0x385baf['file'][_0x4f75('0xbf')];return db[_0x4f75('0x3c')][_0x4f75('0x60')]({'where':{'id':_0x385baf[_0x4f75('0x58')]['id']}})[_0x4f75('0x26')](handleEntityNotFound(_0x404ee0,null))['then'](saveUpdates(_0x385baf[_0x4f75('0x64')],null))[_0x4f75('0x26')](respondWithResult(_0x404ee0,null))[_0x4f75('0x62')](handleError(_0x404ee0,null));};exports[_0x4f75('0xc0')]=function(_0x4e369e,_0x5ad026){var _0x4614f1=path[_0x4f75('0xc1')](config['root'],_0x4f75('0xc2'));return db[_0x4f75('0x3c')][_0x4f75('0x60')]({'where':{'id':_0x4e369e[_0x4f75('0x58')]['id']},'attributes':['id',_0x4f75('0xbe')],'raw':!![]})[_0x4f75('0x26')](handleEntityNotFound(_0x5ad026,null))[_0x4f75('0x26')](function(_0x1393bd){if(_0x1393bd){if(_[_0x4f75('0x6f')](_0x1393bd[_0x4f75('0xbe')])){return _0x5ad026['download'](_0x4614f1);}else{if(!fs[_0x4f75('0xc3')](path['join'](config['root'],_0x4f75('0xc4'),_0x1393bd['userpic']))){return _0x5ad026['download'](_0x4614f1);}return _0x5ad026[_0x4f75('0xc5')](path[_0x4f75('0xc1')](config['root'],_0x4f75('0xc4'),_0x1393bd[_0x4f75('0xbe')]));}}})['catch'](handleError(_0x5ad026,null));};exports[_0x4f75('0xc6')]=function(_0x96a011,_0x3d484a){return db[_0x4f75('0x3c')]['find']({'where':{'id':_0x96a011[_0x4f75('0x58')]['id']},'attributes':['id']})[_0x4f75('0x26')](handleEntityNotFound(_0x3d484a,null))['then'](function(_0x4c61fa){var _0x590716=[];values=_0x4c61fa[_0x4f75('0x51')];_0x590716[_0x4f75('0x4b')](get_open_tabs('chat',_0x4c61fa[_0x4f75('0x51')]));_0x590716[_0x4f75('0x4b')](get_open_tabs(_0x4f75('0x52'),_0x4c61fa[_0x4f75('0x51')]));_0x590716[_0x4f75('0x4b')](get_open_tabs(_0x4f75('0x54'),_0x4c61fa[_0x4f75('0x51')]));_0x590716['push'](get_open_tabs('whatsapp',_0x4c61fa[_0x4f75('0x51')]));_0x590716[_0x4f75('0x4b')](get_open_tabs(_0x4f75('0x53'),_0x4c61fa[_0x4f75('0x51')]));_0x590716['push'](get_open_tabs(_0x4f75('0x61'),_0x4c61fa[_0x4f75('0x51')]));return Promise['all'](_0x590716);})[_0x4f75('0x26')](function(_0x3dc312){if(_0x3dc312){var _0x170a6b=_['map'](values[_0x4f75('0xc7')],function(_0x4271ff){return{'channel':_0x4f75('0xc8'),'id':_0x4271ff['id'],'createdAt':_0x4271ff[_0x4f75('0xc9')]};});var _0x30af5f=_[_0x4f75('0x32')](values['FaxOpenTabs'],function(_0x577f4b){return{'channel':'FAX','id':_0x577f4b['id'],'createdAt':_0x577f4b['createdAt']};});var _0x2bbc3c=_['map'](values[_0x4f75('0xca')],function(_0x428dbd){return{'channel':'OPENCHANNEL','id':_0x428dbd['id'],'createdAt':_0x428dbd[_0x4f75('0xc9')]};});var _0x3bd7c4=_['map'](values['MailOpenTabs'],function(_0x4f92b2){return{'channel':_0x4f75('0xcb'),'id':_0x4f92b2['id'],'createdAt':_0x4f92b2[_0x4f75('0xc9')]};});var _0x5dc3e8=_[_0x4f75('0x32')](values[_0x4f75('0xcc')],function(_0x8796e2){return{'channel':'SMS','id':_0x8796e2['id'],'createdAt':_0x8796e2[_0x4f75('0xc9')]};});var _0xadf32=_['map'](values['WhatsappOpenTabs'],function(_0x4819e6){return{'channel':_0x4f75('0xcd'),'id':_0x4819e6['id'],'createdAt':_0x4819e6[_0x4f75('0xc9')]};});var _0x42676b=_[_0x4f75('0xce')](_0x170a6b,_0x30af5f,_0x2bbc3c,_0x3bd7c4,_0x5dc3e8,_0xadf32);var _0x221371={'count':_0x42676b[_0x4f75('0x4f')],'rows':_0x42676b};return _0x221371;}else return null;})[_0x4f75('0x26')](respondWithResult(_0x3d484a,null))[_0x4f75('0x62')](handleError(_0x3d484a,null));};exports[_0x4f75('0xcf')]=function(_0x40d0ed,_0x1f2422){var _0x134ec0={};var _0x3f60cf={};var _0x365d75;var _0x33043d;return db[_0x4f75('0x3c')][_0x4f75('0xa1')]({'where':{'id':_0x40d0ed[_0x4f75('0x58')]['id']}})[_0x4f75('0x26')](handleEntityNotFound(_0x1f2422,null))[_0x4f75('0x26')](function(_0x53be77){if(_0x53be77){_0x365d75=_0x53be77;_0x3f60cf[_0x4f75('0x5c')]=_['keys'](db[_0x4f75('0xd0')][_0x4f75('0x5a')]);_0x3f60cf['query']=_['keys'](_0x40d0ed[_0x4f75('0x44')]);_0x3f60cf[_0x4f75('0xd1')]=_['intersection'](_0x3f60cf[_0x4f75('0x5c')],_0x3f60cf[_0x4f75('0x44')]);_0x134ec0[_0x4f75('0x4a')]=_['intersection'](_0x3f60cf[_0x4f75('0x5c')],qs[_0x4f75('0x5d')](_0x40d0ed['query'][_0x4f75('0x5d')]));_0x134ec0[_0x4f75('0x4a')]=_0x134ec0['attributes'][_0x4f75('0x4f')]?_0x134ec0[_0x4f75('0x4a')]:_0x3f60cf[_0x4f75('0x5c')];_0x134ec0[_0x4f75('0xd2')]=qs['sort'](_0x40d0ed[_0x4f75('0x44')][_0x4f75('0xd3')]);_0x134ec0[_0x4f75('0x43')]=qs[_0x4f75('0xd1')](_[_0x4f75('0xd4')](_0x40d0ed['query'],_0x3f60cf[_0x4f75('0xd1')]));if(_0x40d0ed[_0x4f75('0x44')][_0x4f75('0x3f')]){_0x134ec0[_0x4f75('0x43')]=_[_0x4f75('0x5e')](_0x134ec0[_0x4f75('0x43')],{'$or':_[_0x4f75('0x32')](_0x134ec0[_0x4f75('0x4a')],function(_0x28dbee){var _0x3e3228={};_0x3e3228[_0x28dbee]={'$like':'%'+_0x40d0ed[_0x4f75('0x44')][_0x4f75('0x3f')]+'%'};return _0x3e3228;})});}_0x134ec0=_[_0x4f75('0x5e')]({},_0x134ec0,_0x40d0ed[_0x4f75('0x5f')]);return _0x365d75['getContacts'](_0x134ec0);}})[_0x4f75('0x26')](function(_0x17d1e8){if(_0x17d1e8){_0x33043d=_0x17d1e8[_0x4f75('0x4f')];if(_0x40d0ed[_0x4f75('0x44')][_0x4f75('0xd5')]('includeAll')){_0x134ec0['include']=[{'model':db[_0x4f75('0xd6')],'as':_0x4f75('0xd7'),'required':![]},{'model':db[_0x4f75('0xd8')],'as':_0x4f75('0xd9'),'attributes':['id',_0x4f75('0x35'),'color'],'where':_0x40d0ed[_0x4f75('0x44')][_0x4f75('0xda')]?{'id':_0x40d0ed['query']['tag']}:undefined,'required':_0x40d0ed['query'][_0x4f75('0xda')]?!![]:![]}];}if(!_0x40d0ed[_0x4f75('0x44')][_0x4f75('0xd5')]('nolimit')){_0x134ec0[_0x4f75('0x23')]=qs[_0x4f75('0x23')](_0x40d0ed[_0x4f75('0x44')][_0x4f75('0x23')]);_0x134ec0[_0x4f75('0x20')]=qs[_0x4f75('0x20')](_0x40d0ed[_0x4f75('0x44')][_0x4f75('0x20')]);}return _0x365d75['getContacts'](_0x134ec0);}})[_0x4f75('0x26')](function(_0x454835){if(_0x454835){return _0x454835?{'count':_0x33043d,'rows':_0x454835}:null;}})[_0x4f75('0x26')](respondWithResult(_0x1f2422,null))[_0x4f75('0x62')](handleError(_0x1f2422,null));};exports[_0x4f75('0xdb')]=function(_0x116cd5,_0x3f2fe9){var _0x245435;var _0x8d49d0={};var _0x2da66b;return db[_0x4f75('0x3c')][_0x4f75('0xa1')]({'where':{'id':_0x116cd5[_0x4f75('0x58')]['id']},'attributes':['id',_0x4f75('0x35'),'role']})[_0x4f75('0x26')](handleEntityNotFound(_0x3f2fe9,null))[_0x4f75('0x26')](function(_0x35efdd){if(!utils['isValidChannel'](_0x116cd5[_0x4f75('0x44')][_0x4f75('0xa6')])){throw new db['Sequelize'][(_0x4f75('0x9c'))](_0x4f75('0xac'));}_0x245435=_0x35efdd;var _0x585a41={};_0x585a41['model']=_[_0x4f75('0x59')](db[_['capitalize'](_0x116cd5['query']['channel'])+_0x4f75('0xdc')]['rawAttributes']);_0x585a41[_0x4f75('0x44')]=_['keys'](_0x116cd5[_0x4f75('0x44')]);_0x585a41[_0x4f75('0xd1')]=_[_0x4f75('0x5b')](_0x585a41[_0x4f75('0x5c')],_0x585a41[_0x4f75('0x44')]);_0x8d49d0['attributes']=_[_0x4f75('0x5b')](_0x585a41[_0x4f75('0x5c')],qs[_0x4f75('0x5d')](_0x116cd5['query'][_0x4f75('0x5d')]));_0x8d49d0[_0x4f75('0x4a')]=_0x8d49d0[_0x4f75('0x4a')][_0x4f75('0x4f')]?_0x8d49d0['attributes']:_0x585a41[_0x4f75('0x5c')];_0x8d49d0[_0x4f75('0xd2')]=qs['sort'](_0x116cd5[_0x4f75('0x44')][_0x4f75('0xd3')]);_0x8d49d0['where']=qs['filters'](_[_0x4f75('0xd4')](_0x116cd5[_0x4f75('0x44')],_0x585a41[_0x4f75('0xd1')]));if(_0x116cd5['query'][_0x4f75('0x3f')]){_0x8d49d0[_0x4f75('0x43')]=_[_0x4f75('0x5e')](_0x8d49d0[_0x4f75('0x43')],{'$or':_[_0x4f75('0x32')](_0x8d49d0[_0x4f75('0x4a')],function(_0x46db6f){var _0x190b4c={};_0x190b4c[_0x46db6f]={'$like':'%'+_0x116cd5['query'][_0x4f75('0x3f')]+'%'};return _0x190b4c;})});}_0x8d49d0=_['merge']({},_0x8d49d0,_0x116cd5[_0x4f75('0x5f')]);switch(_0x245435['role']){case _0x4f75('0x2c'):return db[_[_0x4f75('0xba')](_0x116cd5[_0x4f75('0x44')][_0x4f75('0xa6')])+_0x4f75('0xdc')][_0x4f75('0x4c')](_0x8d49d0);case'user':case _0x4f75('0x2e'):return _0x245435[_0x4f75('0x2a')+_[_0x4f75('0xba')](_0x116cd5[_0x4f75('0x44')][_0x4f75('0xa6')])+'Queues'](_0x8d49d0);default:throw new db[(_0x4f75('0x9a'))]['ValidationError'](_0x4f75('0xdd'));}})[_0x4f75('0x26')](function(_0x315a35){_0x2da66b=_0x315a35[_0x4f75('0x4f')];if(!_0x116cd5[_0x4f75('0x44')][_0x4f75('0xd5')]('nolimit')){_0x8d49d0[_0x4f75('0x23')]=qs[_0x4f75('0x23')](_0x116cd5['query'][_0x4f75('0x23')]);_0x8d49d0[_0x4f75('0x20')]=qs[_0x4f75('0x20')](_0x116cd5[_0x4f75('0x44')][_0x4f75('0x20')]);}switch(_0x245435['role']){case'admin':return db[_[_0x4f75('0xba')](_0x116cd5['query'][_0x4f75('0xa6')])+'Queue']['findAll'](_0x8d49d0);case _0x4f75('0x8a'):case _0x4f75('0x2e'):return _0x245435[_0x4f75('0x2a')+_[_0x4f75('0xba')](_0x116cd5[_0x4f75('0x44')]['channel'])+_0x4f75('0xae')](_0x8d49d0);}})[_0x4f75('0x26')](function(_0x225611){return{'count':_0x2da66b,'rows':_0x225611};})['then'](respondWithResult(_0x3f2fe9,null))[_0x4f75('0x62')](handleError(_0x3f2fe9,null));};exports[_0x4f75('0xde')]=function(_0x50eb17,_0x4ed335){var _0x38ae1b={};var _0x4a1e5d={};var _0x5dc221;var _0x5d6032;return db[_0x4f75('0x3c')][_0x4f75('0xa1')]({'where':{'id':_0x50eb17['params']['id']}})['then'](handleEntityNotFound(_0x4ed335,null))['then'](function(_0x43413d){if(_0x43413d){_0x5dc221=_0x43413d;_0x4a1e5d['model']=_['keys'](db[_0x4f75('0xbc')][_0x4f75('0x5a')]);_0x4a1e5d['query']=_[_0x4f75('0x59')](_0x50eb17[_0x4f75('0x44')]);_0x4a1e5d['filters']=_[_0x4f75('0x5b')](_0x4a1e5d[_0x4f75('0x5c')],_0x4a1e5d['query']);_0x38ae1b[_0x4f75('0x4a')]=_[_0x4f75('0x5b')](_0x4a1e5d[_0x4f75('0x5c')],qs[_0x4f75('0x5d')](_0x50eb17[_0x4f75('0x44')][_0x4f75('0x5d')]));_0x38ae1b['attributes']=_0x38ae1b[_0x4f75('0x4a')][_0x4f75('0x4f')]?_0x38ae1b[_0x4f75('0x4a')]:_0x4a1e5d['model'];_0x38ae1b[_0x4f75('0xd2')]=qs[_0x4f75('0xd3')](_0x50eb17[_0x4f75('0x44')][_0x4f75('0xd3')]);_0x38ae1b[_0x4f75('0x43')]=qs[_0x4f75('0xd1')](_[_0x4f75('0xd4')](_0x50eb17[_0x4f75('0x44')],_0x4a1e5d[_0x4f75('0xd1')]));if(_0x50eb17[_0x4f75('0x44')][_0x4f75('0x3f')]){_0x38ae1b['where']=_[_0x4f75('0x5e')](_0x38ae1b['where'],{'$or':_[_0x4f75('0x32')](_0x38ae1b['attributes'],function(_0x2a8b3b){var _0x345c36={};_0x345c36[_0x2a8b3b]={'$like':'%'+_0x50eb17['query']['filter']+'%'};return _0x345c36;})});}_0x38ae1b=_[_0x4f75('0x5e')]({},_0x38ae1b,_0x50eb17[_0x4f75('0x5f')]);return _0x5dc221[_0x4f75('0xde')](_0x38ae1b);}})[_0x4f75('0x26')](function(_0x15ae20){if(_0x15ae20){_0x5d6032=_0x15ae20[_0x4f75('0x4f')];if(!_0x50eb17[_0x4f75('0x44')]['hasOwnProperty'](_0x4f75('0xdf'))){_0x38ae1b['limit']=qs[_0x4f75('0x23')](_0x50eb17[_0x4f75('0x44')][_0x4f75('0x23')]);_0x38ae1b[_0x4f75('0x20')]=qs['offset'](_0x50eb17[_0x4f75('0x44')][_0x4f75('0x20')]);}return _0x5dc221[_0x4f75('0xde')](_0x38ae1b);}})[_0x4f75('0x26')](function(_0x118080){if(_0x118080){return _0x118080?{'count':_0x5d6032,'rows':_0x118080}:null;}})['then'](respondWithResult(_0x4ed335,null))[_0x4f75('0x62')](handleError(_0x4ed335,null));};exports[_0x4f75('0xe0')]=function(_0x4ebe29,_0x109309){var _0x1b74b9={};var _0x33bdc1={};var _0x4a177a;var _0x395239;return db[_0x4f75('0x3c')]['findOne']({'where':{'id':_0x4ebe29[_0x4f75('0x58')]['id']}})[_0x4f75('0x26')](handleEntityNotFound(_0x109309,null))[_0x4f75('0x26')](function(_0x3fd7c9){if(_0x3fd7c9){_0x4a177a=_0x3fd7c9;_0x33bdc1['model']=_[_0x4f75('0x59')](db[_0x4f75('0xe1')][_0x4f75('0x5a')]);_0x33bdc1[_0x4f75('0x44')]=_[_0x4f75('0x59')](_0x4ebe29[_0x4f75('0x44')]);_0x33bdc1[_0x4f75('0xd1')]=_['intersection'](_0x33bdc1[_0x4f75('0x5c')],_0x33bdc1[_0x4f75('0x44')]);_0x1b74b9[_0x4f75('0x4a')]=_['intersection'](_0x33bdc1[_0x4f75('0x5c')],qs['fields'](_0x4ebe29[_0x4f75('0x44')]['fields']));_0x1b74b9[_0x4f75('0x4a')]=_0x1b74b9[_0x4f75('0x4a')][_0x4f75('0x4f')]?_0x1b74b9[_0x4f75('0x4a')]:_0x33bdc1['model'];_0x1b74b9['order']=qs[_0x4f75('0xd3')](_0x4ebe29['query'][_0x4f75('0xd3')]);_0x1b74b9[_0x4f75('0x43')]=qs[_0x4f75('0xd1')](_[_0x4f75('0xd4')](_0x4ebe29[_0x4f75('0x44')],_0x33bdc1[_0x4f75('0xd1')]));if(_0x4ebe29[_0x4f75('0x44')]['filter']){_0x1b74b9['where']=_[_0x4f75('0x5e')](_0x1b74b9[_0x4f75('0x43')],{'$or':_[_0x4f75('0x32')](_0x1b74b9[_0x4f75('0x4a')],function(_0x52cfe0){var _0x353075={};_0x353075[_0x52cfe0]={'$like':'%'+_0x4ebe29[_0x4f75('0x44')][_0x4f75('0x3f')]+'%'};return _0x353075;})});}_0x1b74b9=_[_0x4f75('0x5e')]({},_0x1b74b9,_0x4ebe29[_0x4f75('0x5f')]);return _0x4a177a[_0x4f75('0xe0')](_0x1b74b9);}})[_0x4f75('0x26')](function(_0x23463f){if(_0x23463f){_0x395239=_0x23463f[_0x4f75('0x4f')];if(!_0x4ebe29[_0x4f75('0x44')][_0x4f75('0xd5')]('nolimit')){_0x1b74b9[_0x4f75('0x23')]=qs[_0x4f75('0x23')](_0x4ebe29[_0x4f75('0x44')][_0x4f75('0x23')]);_0x1b74b9[_0x4f75('0x20')]=qs[_0x4f75('0x20')](_0x4ebe29['query'][_0x4f75('0x20')]);}return _0x4a177a['getGroups'](_0x1b74b9);}})[_0x4f75('0x26')](function(_0x2240d6){if(_0x2240d6){return _0x2240d6?{'count':_0x395239,'rows':_0x2240d6}:null;}})[_0x4f75('0x26')](respondWithResult(_0x109309,null))[_0x4f75('0x62')](handleError(_0x109309,null));};exports[_0x4f75('0xe2')]=function(_0xdbe1c9,_0x12345b){var _0x5d238f={'raw':!![],'where':{}};var _0x29585c={};var _0x40971d={'count':0x0,'rows':[]};return db['User'][_0x4f75('0xa1')]({'where':{'id':_0xdbe1c9[_0x4f75('0x58')]['id']}})['then'](handleEntityNotFound(_0x12345b,null))['then'](function(_0x4c6ed0){if(_0x4c6ed0){_0x29585c[_0x4f75('0x5c')]=_['keys'](db['VoiceRecording'][_0x4f75('0x5a')]);_0x29585c[_0x4f75('0x44')]=_[_0x4f75('0x59')](_0xdbe1c9[_0x4f75('0x44')]);_0x29585c['filters']=_[_0x4f75('0x5b')](_0x29585c['model'],_0x29585c[_0x4f75('0x44')]);_0x5d238f[_0x4f75('0x4a')]=_[_0x4f75('0x5b')](_0x29585c[_0x4f75('0x5c')],qs[_0x4f75('0x5d')](_0xdbe1c9[_0x4f75('0x44')][_0x4f75('0x5d')]));_0x5d238f[_0x4f75('0x4a')]=_0x5d238f[_0x4f75('0x4a')][_0x4f75('0x4f')]?_0x5d238f['attributes']:_0x29585c['model'];if(!_0xdbe1c9['query']['hasOwnProperty'](_0x4f75('0xdf'))){_0x5d238f[_0x4f75('0x23')]=qs[_0x4f75('0x23')](_0xdbe1c9[_0x4f75('0x44')][_0x4f75('0x23')]);_0x5d238f[_0x4f75('0x20')]=qs[_0x4f75('0x20')](_0xdbe1c9['query'][_0x4f75('0x20')]);}_0x5d238f[_0x4f75('0xd2')]=qs[_0x4f75('0xd3')](_0xdbe1c9['query'][_0x4f75('0xd3')]);_0x5d238f[_0x4f75('0x43')]=qs[_0x4f75('0xd1')](_['pick'](_0xdbe1c9[_0x4f75('0x44')],_0x29585c[_0x4f75('0xd1')]));_0x5d238f[_0x4f75('0x43')][_0x4f75('0xe3')]=_0x4c6ed0['id'];if(_0xdbe1c9[_0x4f75('0x44')][_0x4f75('0x3f')]){_0x5d238f[_0x4f75('0x43')]=_[_0x4f75('0x5e')](_0x5d238f[_0x4f75('0x43')],{'$or':_['map'](_0x5d238f[_0x4f75('0x4a')],function(_0x4ad13f){var _0x44d61e={};_0x44d61e[_0x4ad13f]={'$like':'%'+_0xdbe1c9[_0x4f75('0x44')][_0x4f75('0x3f')]+'%'};return _0x44d61e;})});}_0x5d238f=_[_0x4f75('0x5e')]({},_0x5d238f,_0xdbe1c9[_0x4f75('0x5f')]);return db[_0x4f75('0xe4')][_0x4f75('0x22')]({'where':_0x5d238f[_0x4f75('0x43')]})[_0x4f75('0x26')](function(_0x3de0c9){_0x40971d[_0x4f75('0x22')]=_0x3de0c9;if(_0xdbe1c9[_0x4f75('0x44')]['includeAll']){_0x5d238f[_0x4f75('0x46')]=[{'all':!![]}];}return db[_0x4f75('0xe4')][_0x4f75('0x4c')](_0x5d238f);})[_0x4f75('0x26')](function(_0x5d3fce){_0x40971d[_0x4f75('0x4d')]=_0x5d3fce;return _0x40971d;});}})['then'](respondWithFilteredResult(_0x12345b,_0x5d238f))['catch'](handleError(_0x12345b,null));};exports[_0x4f75('0xe5')]=function(_0x30e750,_0x193465){var _0x598046={'raw':!![],'where':{}};var _0x44c6d9={};var _0x135350={'count':0x0,'rows':[]};return db[_0x4f75('0x3c')][_0x4f75('0xa1')]({'where':{'id':_0x30e750[_0x4f75('0x58')]['id']}})[_0x4f75('0x26')](handleEntityNotFound(_0x193465,null))[_0x4f75('0x26')](function(_0x5c2a5c){if(_0x5c2a5c){_0x44c6d9[_0x4f75('0x5c')]=_[_0x4f75('0x59')](db[_0x4f75('0xe6')][_0x4f75('0x5a')]);_0x44c6d9[_0x4f75('0x44')]=_[_0x4f75('0x59')](_0x30e750[_0x4f75('0x44')]);_0x44c6d9[_0x4f75('0xd1')]=_[_0x4f75('0x5b')](_0x44c6d9[_0x4f75('0x5c')],_0x44c6d9[_0x4f75('0x44')]);_0x598046['attributes']=_[_0x4f75('0x5b')](_0x44c6d9[_0x4f75('0x5c')],qs['fields'](_0x30e750['query']['fields']));_0x598046[_0x4f75('0x4a')]=_0x598046[_0x4f75('0x4a')][_0x4f75('0x4f')]?_0x598046[_0x4f75('0x4a')]:_0x44c6d9[_0x4f75('0x5c')];if(!_0x30e750['query'][_0x4f75('0xd5')](_0x4f75('0xdf'))){_0x598046['limit']=qs[_0x4f75('0x23')](_0x30e750[_0x4f75('0x44')]['limit']);_0x598046[_0x4f75('0x20')]=qs[_0x4f75('0x20')](_0x30e750[_0x4f75('0x44')][_0x4f75('0x20')]);}_0x598046[_0x4f75('0xd2')]=qs[_0x4f75('0xd3')](_0x30e750['query'][_0x4f75('0xd3')]);_0x598046[_0x4f75('0x43')]=qs[_0x4f75('0xd1')](_['pick'](_0x30e750[_0x4f75('0x44')],_0x44c6d9[_0x4f75('0xd1')]));_0x598046[_0x4f75('0x43')][_0x4f75('0xe3')]=_0x5c2a5c['id'];if(_0x30e750[_0x4f75('0x44')][_0x4f75('0x3f')]){_0x598046['where']=_[_0x4f75('0x5e')](_0x598046[_0x4f75('0x43')],{'$or':_['map'](_0x598046[_0x4f75('0x4a')],function(_0x456f1c){var _0x5cd858={};_0x5cd858[_0x456f1c]={'$like':'%'+_0x30e750['query'][_0x4f75('0x3f')]+'%'};return _0x5cd858;})});}_0x598046=_['merge']({},_0x598046,_0x30e750[_0x4f75('0x5f')]);return db[_0x4f75('0xe6')]['count']({'where':_0x598046[_0x4f75('0x43')]})[_0x4f75('0x26')](function(_0x2be25d){_0x135350[_0x4f75('0x22')]=_0x2be25d;if(_0x30e750[_0x4f75('0x44')]['includeAll']){_0x598046['include']=[{'all':!![]}];}return db[_0x4f75('0xe6')][_0x4f75('0x4c')](_0x598046);})['then'](function(_0x260e82){_0x135350[_0x4f75('0x4d')]=_0x260e82;return _0x135350;});}})['then'](respondWithFilteredResult(_0x193465,_0x598046))[_0x4f75('0x62')](handleError(_0x193465,null));};exports['getChatInteractions']=function(_0x5649a9,_0x12c928){var _0x582635={};var _0x454862={};var _0x56f889;var _0x2b537f;return db['User']['findOne']({'where':{'id':_0x5649a9[_0x4f75('0x58')]['id']}})[_0x4f75('0x26')](handleEntityNotFound(_0x12c928,null))[_0x4f75('0x26')](function(_0x39ad9c){if(_0x39ad9c){_0x56f889=_0x39ad9c;_0x454862[_0x4f75('0x5c')]=_[_0x4f75('0x59')](db['ChatInteraction'][_0x4f75('0x5a')]);_0x454862[_0x4f75('0x44')]=_['keys'](_0x5649a9[_0x4f75('0x44')]);_0x454862[_0x4f75('0xd1')]=_[_0x4f75('0x5b')](_0x454862[_0x4f75('0x5c')],_0x454862['query']);_0x582635['attributes']=_['intersection'](_0x454862[_0x4f75('0x5c')],qs[_0x4f75('0x5d')](_0x5649a9[_0x4f75('0x44')][_0x4f75('0x5d')]));_0x582635[_0x4f75('0x4a')]=_0x582635[_0x4f75('0x4a')][_0x4f75('0x4f')]?_0x582635[_0x4f75('0x4a')]:_0x454862[_0x4f75('0x5c')];_0x582635[_0x4f75('0xd2')]=qs[_0x4f75('0xd3')](_0x5649a9[_0x4f75('0x44')][_0x4f75('0xd3')]);_0x582635[_0x4f75('0x43')]=qs[_0x4f75('0xd1')](_[_0x4f75('0xd4')](_0x5649a9['query'],_0x454862[_0x4f75('0xd1')]));if(_0x5649a9['query']['filter']){_0x582635[_0x4f75('0x43')]=_['merge'](_0x582635[_0x4f75('0x43')],{'$or':_['map'](_0x582635[_0x4f75('0x4a')],function(_0x120f43){var _0x195422={};_0x195422[_0x120f43]={'$like':'%'+_0x5649a9['query']['filter']+'%'};return _0x195422;})});}_0x582635=_[_0x4f75('0x5e')]({},_0x582635,_0x5649a9['options']);return _0x56f889['getChatInteractions'](_0x582635);}})['then'](function(_0x432e11){if(_0x432e11){_0x2b537f=_0x432e11['length'];if(!_0x5649a9['query']['hasOwnProperty'](_0x4f75('0xdf'))){_0x582635['limit']=qs[_0x4f75('0x23')](_0x5649a9['query'][_0x4f75('0x23')]);_0x582635[_0x4f75('0x20')]=qs[_0x4f75('0x20')](_0x5649a9[_0x4f75('0x44')][_0x4f75('0x20')]);}return _0x56f889[_0x4f75('0xe7')](_0x582635);}})[_0x4f75('0x26')](function(_0x5410d1){if(_0x5410d1){return _0x5410d1?{'count':_0x2b537f,'rows':_0x5410d1}:null;}})[_0x4f75('0x26')](respondWithResult(_0x12c928,null))[_0x4f75('0x62')](handleError(_0x12c928,null));};exports[_0x4f75('0xe8')]=function(_0x186cae,_0x3318e4){var _0x4f862c={};var _0x39b5ff={};var _0x3b3d61;var _0x437c6e;return db[_0x4f75('0x3c')][_0x4f75('0xa1')]({'where':{'id':_0x186cae[_0x4f75('0x58')]['id']}})['then'](handleEntityNotFound(_0x3318e4,null))[_0x4f75('0x26')](function(_0x3af6c9){if(_0x3af6c9){_0x3b3d61=_0x3af6c9;_0x39b5ff[_0x4f75('0x5c')]=_['keys'](db[_0x4f75('0xe9')][_0x4f75('0x5a')]);_0x39b5ff[_0x4f75('0x44')]=_[_0x4f75('0x59')](_0x186cae[_0x4f75('0x44')]);_0x39b5ff[_0x4f75('0xd1')]=_['intersection'](_0x39b5ff[_0x4f75('0x5c')],_0x39b5ff[_0x4f75('0x44')]);_0x4f862c[_0x4f75('0x4a')]=_[_0x4f75('0x5b')](_0x39b5ff[_0x4f75('0x5c')],qs[_0x4f75('0x5d')](_0x186cae[_0x4f75('0x44')]['fields']));_0x4f862c[_0x4f75('0x4a')]=_0x4f862c[_0x4f75('0x4a')][_0x4f75('0x4f')]?_0x4f862c[_0x4f75('0x4a')]:_0x39b5ff['model'];_0x4f862c['order']=qs[_0x4f75('0xd3')](_0x186cae[_0x4f75('0x44')][_0x4f75('0xd3')]);_0x4f862c[_0x4f75('0x43')]=qs[_0x4f75('0xd1')](_[_0x4f75('0xd4')](_0x186cae['query'],_0x39b5ff[_0x4f75('0xd1')]));if(_0x186cae['query'][_0x4f75('0x3f')]){_0x4f862c[_0x4f75('0x43')]=_[_0x4f75('0x5e')](_0x4f862c['where'],{'$or':_['map'](_0x4f862c[_0x4f75('0x4a')],function(_0xecbd72){var _0x5e4e0b={};_0x5e4e0b[_0xecbd72]={'$like':'%'+_0x186cae[_0x4f75('0x44')]['filter']+'%'};return _0x5e4e0b;})});}_0x4f862c=_['merge']({},_0x4f862c,_0x186cae[_0x4f75('0x5f')]);return _0x3b3d61[_0x4f75('0xe8')](_0x4f862c);}})['then'](function(_0x263fe0){if(_0x263fe0){_0x437c6e=_0x263fe0[_0x4f75('0x4f')];if(!_0x186cae[_0x4f75('0x44')]['hasOwnProperty']('nolimit')){_0x4f862c['limit']=qs[_0x4f75('0x23')](_0x186cae[_0x4f75('0x44')][_0x4f75('0x23')]);_0x4f862c[_0x4f75('0x20')]=qs[_0x4f75('0x20')](_0x186cae[_0x4f75('0x44')][_0x4f75('0x20')]);}return _0x3b3d61[_0x4f75('0xe8')](_0x4f862c);}})[_0x4f75('0x26')](function(_0x11e296){if(_0x11e296){return _0x11e296?{'count':_0x437c6e,'rows':_0x11e296}:null;}})[_0x4f75('0x26')](respondWithResult(_0x3318e4,null))['catch'](handleError(_0x3318e4,null));};exports[_0x4f75('0xea')]=function(_0x3fd647,_0x4a262c){var _0x589a61={'raw':!![],'where':{}};var _0x5d0bbf={};var _0x1a375f={'count':0x0,'rows':[]};return db['User'][_0x4f75('0xa1')]({'where':{'id':_0x3fd647[_0x4f75('0x58')]['id']}})[_0x4f75('0x26')](handleEntityNotFound(_0x4a262c,null))[_0x4f75('0x26')](function(_0x471473){if(_0x471473){_0x5d0bbf[_0x4f75('0x5c')]=_[_0x4f75('0x59')](db[_0x4f75('0xeb')][_0x4f75('0x5a')]);_0x5d0bbf[_0x4f75('0x44')]=_[_0x4f75('0x59')](_0x3fd647[_0x4f75('0x44')]);_0x5d0bbf[_0x4f75('0xd1')]=_[_0x4f75('0x5b')](_0x5d0bbf[_0x4f75('0x5c')],_0x5d0bbf[_0x4f75('0x44')]);_0x589a61['attributes']=_[_0x4f75('0x5b')](_0x5d0bbf[_0x4f75('0x5c')],qs['fields'](_0x3fd647['query'][_0x4f75('0x5d')]));_0x589a61['attributes']=_0x589a61[_0x4f75('0x4a')][_0x4f75('0x4f')]?_0x589a61['attributes']:_0x5d0bbf[_0x4f75('0x5c')];if(!_0x3fd647[_0x4f75('0x44')][_0x4f75('0xd5')](_0x4f75('0xdf'))){_0x589a61['limit']=qs['limit'](_0x3fd647['query'][_0x4f75('0x23')]);_0x589a61['offset']=qs['offset'](_0x3fd647[_0x4f75('0x44')][_0x4f75('0x20')]);}_0x589a61['order']=qs[_0x4f75('0xd3')](_0x3fd647[_0x4f75('0x44')][_0x4f75('0xd3')]);_0x589a61['where']=qs[_0x4f75('0xd1')](_['pick'](_0x3fd647['query'],_0x5d0bbf[_0x4f75('0xd1')]));_0x589a61[_0x4f75('0x43')][_0x4f75('0xe3')]=_0x471473['id'];if(_0x3fd647[_0x4f75('0x44')][_0x4f75('0x3f')]){_0x589a61['where']=_['merge'](_0x589a61[_0x4f75('0x43')],{'$or':_[_0x4f75('0x32')](_0x589a61[_0x4f75('0x4a')],function(_0x3a0d08){var _0x33e1b4={};_0x33e1b4[_0x3a0d08]={'$like':'%'+_0x3fd647['query'][_0x4f75('0x3f')]+'%'};return _0x33e1b4;})});}_0x589a61=_[_0x4f75('0x5e')]({},_0x589a61,_0x3fd647[_0x4f75('0x5f')]);return db[_0x4f75('0xeb')]['count']({'where':_0x589a61[_0x4f75('0x43')]})[_0x4f75('0x26')](function(_0x3b055d){_0x1a375f[_0x4f75('0x22')]=_0x3b055d;if(_0x3fd647['query'][_0x4f75('0x45')]){_0x589a61['include']=[{'all':!![]}];}return db[_0x4f75('0xeb')][_0x4f75('0x4c')](_0x589a61);})[_0x4f75('0x26')](function(_0x49935f){_0x1a375f['rows']=_0x49935f;return _0x1a375f;});}})[_0x4f75('0x26')](respondWithFilteredResult(_0x4a262c,_0x589a61))[_0x4f75('0x62')](handleError(_0x4a262c,null));};exports[_0x4f75('0xec')]=function(_0x53c35a,_0x4922e0){var _0x4df0ed={};var _0x4eb31c={};var _0x296564;var _0x1ea8d2;return db[_0x4f75('0x3c')][_0x4f75('0xa1')]({'where':{'id':_0x53c35a[_0x4f75('0x58')]['id']}})[_0x4f75('0x26')](handleEntityNotFound(_0x4922e0,null))[_0x4f75('0x26')](function(_0x3a4f54){if(_0x3a4f54){_0x296564=_0x3a4f54;_0x4eb31c[_0x4f75('0x5c')]=_[_0x4f75('0x59')](db[_0x4f75('0xed')]['rawAttributes']);_0x4eb31c[_0x4f75('0x44')]=_[_0x4f75('0x59')](_0x53c35a[_0x4f75('0x44')]);_0x4eb31c[_0x4f75('0xd1')]=_['intersection'](_0x4eb31c['model'],_0x4eb31c[_0x4f75('0x44')]);_0x4df0ed[_0x4f75('0x4a')]=_[_0x4f75('0x5b')](_0x4eb31c[_0x4f75('0x5c')],qs[_0x4f75('0x5d')](_0x53c35a[_0x4f75('0x44')]['fields']));_0x4df0ed['attributes']=_0x4df0ed[_0x4f75('0x4a')][_0x4f75('0x4f')]?_0x4df0ed[_0x4f75('0x4a')]:_0x4eb31c[_0x4f75('0x5c')];_0x4df0ed['order']=qs[_0x4f75('0xd3')](_0x53c35a['query']['sort']);_0x4df0ed[_0x4f75('0x43')]=qs[_0x4f75('0xd1')](_[_0x4f75('0xd4')](_0x53c35a[_0x4f75('0x44')],_0x4eb31c[_0x4f75('0xd1')]));if(_0x53c35a[_0x4f75('0x44')][_0x4f75('0x3f')]){_0x4df0ed['where']=_[_0x4f75('0x5e')](_0x4df0ed['where'],{'$or':_[_0x4f75('0x32')](_0x4df0ed[_0x4f75('0x4a')],function(_0x2bcd14){var _0x508ebe={};_0x508ebe[_0x2bcd14]={'$like':'%'+_0x53c35a[_0x4f75('0x44')]['filter']+'%'};return _0x508ebe;})});}_0x4df0ed=_[_0x4f75('0x5e')]({},_0x4df0ed,_0x53c35a[_0x4f75('0x5f')]);return _0x296564[_0x4f75('0xec')](_0x4df0ed);}})[_0x4f75('0x26')](function(_0x4b6347){if(_0x4b6347){_0x1ea8d2=_0x4b6347['length'];if(!_0x53c35a['query']['hasOwnProperty']('nolimit')){_0x4df0ed[_0x4f75('0x23')]=qs['limit'](_0x53c35a[_0x4f75('0x44')][_0x4f75('0x23')]);_0x4df0ed[_0x4f75('0x20')]=qs['offset'](_0x53c35a[_0x4f75('0x44')][_0x4f75('0x20')]);}return _0x296564[_0x4f75('0xec')](_0x4df0ed);}})['then'](function(_0x45443c){if(_0x45443c){return _0x45443c?{'count':_0x1ea8d2,'rows':_0x45443c}:null;}})['then'](respondWithResult(_0x4922e0,null))[_0x4f75('0x62')](handleError(_0x4922e0,null));};exports[_0x4f75('0xee')]=function(_0x1264af,_0x5d1d88){var _0x494a97={};var _0x192371={};var _0x102f39;var _0x43e94b;return db[_0x4f75('0x3c')][_0x4f75('0xa1')]({'where':{'id':_0x1264af['params']['id']}})[_0x4f75('0x26')](handleEntityNotFound(_0x5d1d88,null))[_0x4f75('0x26')](function(_0x594947){if(_0x594947){_0x102f39=_0x594947;_0x192371[_0x4f75('0x5c')]=_['keys'](db[_0x4f75('0xef')][_0x4f75('0x5a')]);_0x192371[_0x4f75('0x44')]=_[_0x4f75('0x59')](_0x1264af[_0x4f75('0x44')]);_0x192371[_0x4f75('0xd1')]=_['intersection'](_0x192371[_0x4f75('0x5c')],_0x192371[_0x4f75('0x44')]);_0x494a97[_0x4f75('0x4a')]=_[_0x4f75('0x5b')](_0x192371[_0x4f75('0x5c')],qs[_0x4f75('0x5d')](_0x1264af['query'][_0x4f75('0x5d')]));_0x494a97[_0x4f75('0x4a')]=_0x494a97[_0x4f75('0x4a')][_0x4f75('0x4f')]?_0x494a97[_0x4f75('0x4a')]:_0x192371[_0x4f75('0x5c')];_0x494a97[_0x4f75('0xd2')]=qs[_0x4f75('0xd3')](_0x1264af[_0x4f75('0x44')][_0x4f75('0xd3')]);_0x494a97[_0x4f75('0x43')]=qs[_0x4f75('0xd1')](_[_0x4f75('0xd4')](_0x1264af[_0x4f75('0x44')],_0x192371[_0x4f75('0xd1')]));if(_0x1264af[_0x4f75('0x44')][_0x4f75('0x3f')]){_0x494a97[_0x4f75('0x43')]=_['merge'](_0x494a97[_0x4f75('0x43')],{'$or':_[_0x4f75('0x32')](_0x494a97['attributes'],function(_0x5594d7){var _0x431afe={};_0x431afe[_0x5594d7]={'$like':'%'+_0x1264af['query'][_0x4f75('0x3f')]+'%'};return _0x431afe;})});}_0x494a97=_['merge']({},_0x494a97,_0x1264af[_0x4f75('0x5f')]);return _0x102f39[_0x4f75('0xee')](_0x494a97);}})[_0x4f75('0x26')](function(_0x5e4a33){if(_0x5e4a33){_0x43e94b=_0x5e4a33['length'];if(!_0x1264af[_0x4f75('0x44')][_0x4f75('0xd5')]('nolimit')){_0x494a97['limit']=qs['limit'](_0x1264af[_0x4f75('0x44')][_0x4f75('0x23')]);_0x494a97[_0x4f75('0x20')]=qs[_0x4f75('0x20')](_0x1264af[_0x4f75('0x44')][_0x4f75('0x20')]);}return _0x102f39['getFaxInteractions'](_0x494a97);}})['then'](function(_0x34c5ea){if(_0x34c5ea){return _0x34c5ea?{'count':_0x43e94b,'rows':_0x34c5ea}:null;}})[_0x4f75('0x26')](respondWithResult(_0x5d1d88,null))['catch'](handleError(_0x5d1d88,null));};exports[_0x4f75('0xf0')]=function(_0x4eff53,_0x89cd0f){var _0xa86723={};var _0x33a075={};var _0x85a586;var _0x5b78e1;return db[_0x4f75('0x3c')][_0x4f75('0xa1')]({'where':{'id':_0x4eff53['params']['id']}})['then'](handleEntityNotFound(_0x89cd0f,null))[_0x4f75('0x26')](function(_0x404a94){if(_0x404a94){_0x85a586=_0x404a94;_0x33a075[_0x4f75('0x5c')]=_[_0x4f75('0x59')](db[_0x4f75('0xf1')][_0x4f75('0x5a')]);_0x33a075[_0x4f75('0x44')]=_['keys'](_0x4eff53[_0x4f75('0x44')]);_0x33a075[_0x4f75('0xd1')]=_['intersection'](_0x33a075[_0x4f75('0x5c')],_0x33a075[_0x4f75('0x44')]);_0xa86723[_0x4f75('0x4a')]=_['intersection'](_0x33a075['model'],qs['fields'](_0x4eff53[_0x4f75('0x44')][_0x4f75('0x5d')]));_0xa86723[_0x4f75('0x4a')]=_0xa86723[_0x4f75('0x4a')]['length']?_0xa86723['attributes']:_0x33a075[_0x4f75('0x5c')];_0xa86723[_0x4f75('0xd2')]=qs['sort'](_0x4eff53[_0x4f75('0x44')][_0x4f75('0xd3')]);_0xa86723[_0x4f75('0x43')]=qs['filters'](_['pick'](_0x4eff53[_0x4f75('0x44')],_0x33a075[_0x4f75('0xd1')]));if(_0x4eff53[_0x4f75('0x44')][_0x4f75('0x3f')]){_0xa86723[_0x4f75('0x43')]=_[_0x4f75('0x5e')](_0xa86723['where'],{'$or':_[_0x4f75('0x32')](_0xa86723[_0x4f75('0x4a')],function(_0x5a72ff){var _0x2f005b={};_0x2f005b[_0x5a72ff]={'$like':'%'+_0x4eff53['query'][_0x4f75('0x3f')]+'%'};return _0x2f005b;})});}_0xa86723=_['merge']({},_0xa86723,_0x4eff53[_0x4f75('0x5f')]);return _0x85a586[_0x4f75('0xf0')](_0xa86723);}})['then'](function(_0x396a4a){if(_0x396a4a){_0x5b78e1=_0x396a4a['length'];if(!_0x4eff53[_0x4f75('0x44')]['hasOwnProperty']('nolimit')){_0xa86723[_0x4f75('0x23')]=qs[_0x4f75('0x23')](_0x4eff53[_0x4f75('0x44')][_0x4f75('0x23')]);_0xa86723['offset']=qs[_0x4f75('0x20')](_0x4eff53['query'][_0x4f75('0x20')]);}return _0x85a586[_0x4f75('0xf0')](_0xa86723);}})[_0x4f75('0x26')](function(_0x30268d){if(_0x30268d){return _0x30268d?{'count':_0x5b78e1,'rows':_0x30268d}:null;}})[_0x4f75('0x26')](respondWithResult(_0x89cd0f,null))['catch'](handleError(_0x89cd0f,null));};exports['login']=function(_0x9cec58,_0x424dca,_0x417f63){var _0x487037;var _0x1a73a7;var _0x470e4d;var _0xfb65c9=!_[_0x4f75('0x6f')](_0x9cec58[_0x4f75('0x58')]['id'])?_0x9cec58[_0x4f75('0x58')]['id']:!_['isNil'](_0x9cec58[_0x4f75('0x8a')]['id'])?_0x9cec58['user']['id']:null;return db['User'][_0x4f75('0x60')]({'where':{'id':_0xfb65c9,'role':{'$or':['admin',_0x4f75('0x8a'),_0x4f75('0x2e')]}},'attributes':['id',_0x4f75('0x35'),_0x4f75('0xf2'),_0x4f75('0xf3'),_0x4f75('0x2b'),'internal',_0x4f75('0xa8')]})[_0x4f75('0x26')](function(_0x46629d){if(_0x46629d){if(_0x46629d['role']===_0x4f75('0x2e')){_0x487037=_0x46629d;if(_0x9cec58['body'][_0x4f75('0xaa')]){_0x470e4d=util['format'](_0x4f75('0xf4'),_0x487037[_0x9cec58['body'][_0x4f75('0xaa')]]);}else if(_0x9cec58[_0x4f75('0x64')][_0x4f75('0xf5')]){_0x470e4d=util[_0x4f75('0xb3')](_0x4f75('0xb4'),_0x9cec58[_0x4f75('0x64')][_0x4f75('0xf5')]);}else{_0x470e4d=util['format'](_0x4f75('0xb4'),_0x487037[_0x4f75('0x35')]);}socket['to'](util['format'](_0x4f75('0xf6'),_0x487037['name']))[_0x4f75('0x27')](_0x4f75('0xf7'),{'user':{'id':_0x487037['id'],'name':_0x487037['name']},'ip':_0x9cec58[_0x4f75('0xf8')]['x-forwarded-for']||_0x9cec58[_0x4f75('0xf9')][_0x4f75('0xfa')]||_0x9cec58[_0x4f75('0xfb')][_0x4f75('0xfa')]||_0x9cec58[_0x4f75('0xf9')]['socket'][_0x4f75('0xfa')]});return db[_0x4f75('0xbc')][_0x4f75('0x29')]({'where':{'membername':_0x487037[_0x4f75('0x35')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x4f75('0x9c'))](_0x4f75('0xfc'));}})[_0x4f75('0x26')](function(){if(_0x487037){return _0x487037['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x38a424){if(_0x487037){if(_0x38a424){_0x1a73a7=_0x38a424;if(_0x1a73a7['length']){var _0x398bc4=_0x1a73a7[_0x4f75('0x32')](function(_0x290ed5){var _0x45e6a6={'membername':_0x487037[_0x4f75('0x35')],'UserId':_0x487037['id'],'queue_name':_0x290ed5[_0x4f75('0x35')],'VoiceQueueId':_0x290ed5['id'],'interface':_0x470e4d,'paused':_0x487037[_0x4f75('0xa8')]||![],'penalty':_0x290ed5[_0x4f75('0xfd')]||0x0};return db[_0x4f75('0xbc')]['upsert'](_0x45e6a6);});return Promise[_0x4f75('0x56')](_0x398bc4);}}}})[_0x4f75('0x26')](function(){if(_0x487037){return db[_0x4f75('0xfe')][_0x4f75('0x4c')]({'where':{'membername':_0x487037[_0x4f75('0x35')],'exitAt':null}});}})[_0x4f75('0x26')](function(_0x1d3d06){if(_0x487037){var _0x438fa2=[];_0x1d3d06[_0x4f75('0xff')](function(_0x347ef1){_0x438fa2[_0x4f75('0x4b')](_0x347ef1[_0x4f75('0x63')]({'exitAt':moment()[_0x4f75('0xb3')](_0x4f75('0x100'))}));});return Promise[_0x4f75('0x56')](_0x438fa2);}})[_0x4f75('0x26')](function(){if(_0x487037){var _0x4a8839=[];var _0xc8b8b7=[];var _0x5ba8aa=utils[_0x4f75('0x101')]();var _0x207a18={'membername':_0x487037[_0x4f75('0x35')],'interface':_0x470e4d,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x487037[_0x4f75('0x2b')],'internal':_0x487037[_0x4f75('0x69')]};_0x5ba8aa[_0x4f75('0xff')](function(_0x472aa2){_0x4a8839[_0x4f75('0x4b')](_['merge']({'channel':_0x472aa2,'type':_0x4f75('0x102'),'data1':_0x9cec58[_0x4f75('0x64')]['device'],'data2':_0x470e4d},_0x207a18));if(_0x487037[_0x4f75('0xa8')]){_0xc8b8b7[_0x4f75('0x4b')](_[_0x4f75('0x5e')]({'channel':_0x472aa2,'type':_0x4f75('0x103'),'data1':_0x4f75('0x104')},_0x207a18));}});return db[_0x4f75('0xfe')][_0x4f75('0x93')](_0x4a8839[_0x4f75('0xce')](_0xc8b8b7),{'individualHooks':!![]});}})[_0x4f75('0x26')](function(){if(_0x487037){return _0x487037['update']({'online':!![],'lastLoginAt':moment()[_0x4f75('0xb3')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x487037['loginInPause']||![],'mailPause':_0x487037['loginInPause']||![],'chatPause':_0x487037[_0x4f75('0xa8')]||![],'faxPause':_0x487037[_0x4f75('0xa8')]||![],'smsPause':_0x487037[_0x4f75('0xa8')]||![],'openchannelPause':_0x487037[_0x4f75('0xa8')]||![],'whatsappPause':_0x487037[_0x4f75('0xa8')]||![],'pauseType':_0x487037['loginInPause']?_0x4f75('0x104'):null,'interface':_0x470e4d,'lastPauseAt':moment()[_0x4f75('0xb3')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x4f75('0x26')](function(_0x2b36cd){if(_0x9cec58[_0x4f75('0x105')]){return _0x417f63();}else{return Promise[_0x4f75('0x106')](_0x2b36cd)[_0x4f75('0x26')](respondWithResult(_0x424dca,null));}})[_0x4f75('0x62')](handleError(_0x424dca,null));};exports[_0x4f75('0x107')]=function(_0x251192,_0x4a71e4){var _0x54c431;return db[_0x4f75('0x3c')][_0x4f75('0x60')]({'where':{'id':_0x251192[_0x4f75('0x58')]['id'],'role':_0x4f75('0x2e')},'attributes':['id',_0x4f75('0x35'),_0x4f75('0x2b')]})[_0x4f75('0x26')](handleEntityNotFound(_0x4a71e4,null))[_0x4f75('0x26')](function(_0x59cbc7){if(_0x59cbc7){_0x54c431=_0x59cbc7;return db[_0x4f75('0xbc')][_0x4f75('0x29')]({'where':{'membername':_0x54c431[_0x4f75('0x35')]},'individualHooks':!![]});}})[_0x4f75('0x26')](function(){return db[_0x4f75('0xfe')][_0x4f75('0x4c')]({'where':{'membername':_0x54c431[_0x4f75('0x35')],'exitAt':null}});})['then'](function(_0x5799a3){var _0x5d03b3=[];_0x5799a3['forEach'](function(_0x387151){_0x5d03b3[_0x4f75('0x4b')](_0x387151[_0x4f75('0x63')]({'exitAt':moment()[_0x4f75('0xb3')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x4f75('0x56')](_0x5d03b3);})[_0x4f75('0x26')](function(){return _0x54c431['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x4f75('0x26')](respondWithResult(_0x4a71e4,null))[_0x4f75('0x62')](handleError(_0x4a71e4,null));};exports[_0x4f75('0x108')]=function(_0x2dacab,_0x471b88){var _0x4c0c8b;return db[_0x4f75('0xbc')][_0x4f75('0x63')]({'paused':0x1},{'where':{'UserId':_0x2dacab[_0x4f75('0x58')]['id']},'individualHooks':!![]})[_0x4f75('0x26')](function(){return db[_0x4f75('0x3c')][_0x4f75('0x60')]({'where':{'id':_0x2dacab[_0x4f75('0x58')]['id'],'role':_0x4f75('0x2e')},'attributes':['id',_0x4f75('0x35'),_0x4f75('0x2b'),_0x4f75('0x69'),_0x4f75('0xaa'),'online']});})['then'](handleEntityNotFound(_0x471b88,null))[_0x4f75('0x26')](function(_0x2494f3){if(_0x2494f3){_0x4c0c8b=_0x2494f3;return respondWithRpcPromise('QueuePause',_0x4f75('0x108'),{'id':_0x4c0c8b['id'],'name':_0x4c0c8b['name'],'pause':!![]});}})[_0x4f75('0x26')](function(){if(_0x4c0c8b){return db[_0x4f75('0xfe')]['findAll']({'where':{'membername':_0x4c0c8b[_0x4f75('0x35')],'type':_0x4f75('0x103'),'exitAt':null}});}})[_0x4f75('0x26')](function(_0xcec455){if(_0xcec455[_0x4f75('0x4f')]){var _0x379944=moment()['format'](_0x4f75('0x100'));for(var _0x2b3f17=0x0,_0x5b13a9=_0xcec455[_0x4f75('0x4f')];_0x2b3f17<_0x5b13a9;_0x2b3f17++){_0xcec455[_0x2b3f17]['updateAttributes']({'exitAt':_0x379944});}}})[_0x4f75('0x26')](function(){var _0x4cedfb=[];var _0xf40e0e=utils[_0x4f75('0x101')]();_0xf40e0e[_0x4f75('0xff')](function(_0x2e6e4c){_0x4cedfb[_0x4f75('0x4b')]({'channel':_0x2e6e4c,'membername':_0x4c0c8b['name'],'interface':_[_0x4f75('0x6f')](_0x4c0c8b[_0x4f75('0xaa')])?util['format'](_0x4f75('0xb4'),_0x4c0c8b[_0x4f75('0x35')]):_0x4c0c8b[_0x4f75('0xaa')],'type':_0x4f75('0x103'),'enterAt':moment()[_0x4f75('0xb3')](_0x4f75('0x100')),'data1':_0x2dacab[_0x4f75('0x64')][_0x4f75('0x109')]||_0x4f75('0x10a'),'role':_0x4c0c8b[_0x4f75('0x2b')],'internal':_0x4c0c8b['internal']});});return db[_0x4f75('0xfe')]['bulkCreate'](_0x4cedfb,{'individualHooks':!![]});})[_0x4f75('0x26')](function(){return _0x4c0c8b['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x2dacab[_0x4f75('0x64')][_0x4f75('0x109')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0x4f75('0x26')](respondWithResult(_0x471b88,null))[_0x4f75('0x62')](handleError(_0x471b88,null));};exports['unpause']=function(_0x5eb960,_0x7528a){if(_0x5eb960[_0x4f75('0x64')][_0x4f75('0xa6')]&&!utils['isValidChannel'](_0x5eb960[_0x4f75('0x64')][_0x4f75('0xa6')])){throw new APIBadRequestError(util[_0x4f75('0xb3')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x5eb960['body'][_0x4f75('0xa6')]));}return db[_0x4f75('0x3c')][_0x4f75('0x60')]({'where':{'id':_0x5eb960[_0x4f75('0x58')]['id']},'attributes':['id',_0x4f75('0x35'),_0x4f75('0x2b'),'internal','interface','online',_0x4f75('0xa9'),_0x4f75('0x10b'),_0x4f75('0x10c'),_0x4f75('0x10d'),_0x4f75('0x10e'),_0x4f75('0x10f'),_0x4f75('0x110'),_0x4f75('0x111'),'lastPauseAt']})[_0x4f75('0x26')](function(_0x1cf3b0){if(!_0x1cf3b0){throw new APINotFoundError(util['format'](_0x4f75('0x112'),_0x5eb960['params']['id']));}return _0x1cf3b0[_0x4f75('0x113')](_0x5eb960[_0x4f75('0x64')]['channel']);})['then'](respondWithResult(_0x7528a,null))[_0x4f75('0x62')](APIHandleError(_0x7528a));};exports[_0x4f75('0x114')]=function(_0x3bcc5d,_0x357fad){var _0x2018b0={};var _0x284535={};var _0x142acb;var _0x14ff36;return db[_0x4f75('0x3c')][_0x4f75('0xa1')]({'where':{'id':_0x3bcc5d['params']['id']}})[_0x4f75('0x26')](handleEntityNotFound(_0x357fad,null))[_0x4f75('0x26')](function(_0x5a2a09){if(_0x5a2a09){_0x142acb=_0x5a2a09;_0x284535['model']=_[_0x4f75('0x59')](db['Team']['rawAttributes']);_0x284535[_0x4f75('0x44')]=_['keys'](_0x3bcc5d['query']);_0x284535['filters']=_[_0x4f75('0x5b')](_0x284535[_0x4f75('0x5c')],_0x284535[_0x4f75('0x44')]);_0x2018b0[_0x4f75('0x4a')]=_[_0x4f75('0x5b')](_0x284535['model'],qs[_0x4f75('0x5d')](_0x3bcc5d[_0x4f75('0x44')][_0x4f75('0x5d')]));_0x2018b0[_0x4f75('0x4a')]=_0x2018b0[_0x4f75('0x4a')][_0x4f75('0x4f')]?_0x2018b0[_0x4f75('0x4a')]:_0x284535['model'];_0x2018b0[_0x4f75('0xd2')]=qs[_0x4f75('0xd3')](_0x3bcc5d['query']['sort']);_0x2018b0['where']=qs[_0x4f75('0xd1')](_[_0x4f75('0xd4')](_0x3bcc5d[_0x4f75('0x44')],_0x284535['filters']));if(_0x3bcc5d[_0x4f75('0x44')][_0x4f75('0x3f')]){_0x2018b0[_0x4f75('0x43')]=_['merge'](_0x2018b0['where'],{'$or':_['map'](_0x2018b0[_0x4f75('0x4a')],function(_0x25c1c0){var _0x1c8bed={};_0x1c8bed[_0x25c1c0]={'$like':'%'+_0x3bcc5d[_0x4f75('0x44')]['filter']+'%'};return _0x1c8bed;})});}_0x2018b0=_['merge']({},_0x2018b0,_0x3bcc5d[_0x4f75('0x5f')]);return _0x142acb[_0x4f75('0x114')](_0x2018b0);}})[_0x4f75('0x26')](function(_0x3e013f){if(_0x3e013f){_0x14ff36=_0x3e013f['length'];if(!_0x3bcc5d[_0x4f75('0x44')][_0x4f75('0xd5')](_0x4f75('0xdf'))){_0x2018b0[_0x4f75('0x23')]=qs[_0x4f75('0x23')](_0x3bcc5d['query'][_0x4f75('0x23')]);_0x2018b0[_0x4f75('0x20')]=qs[_0x4f75('0x20')](_0x3bcc5d[_0x4f75('0x44')]['offset']);}return _0x142acb[_0x4f75('0x114')](_0x2018b0);}})[_0x4f75('0x26')](function(_0x4a8a94){if(_0x4a8a94){return _0x4a8a94?{'count':_0x14ff36,'rows':_0x4a8a94}:null;}})['then'](respondWithResult(_0x357fad,null))[_0x4f75('0x62')](handleError(_0x357fad,null));};exports[_0x4f75('0x115')]=function(_0x247710,_0x30192c){var _0x23768f=_0x247710['params']['id'];var _0xa4f657=_0x247710[_0x4f75('0x64')]?_0x247710[_0x4f75('0x64')]['ids']:null;var _0x1f2e12=[];return Promise[_0x4f75('0x106')]()[_0x4f75('0x26')](function(){if(!_0xa4f657)throw new APIBadRequestError(_0x4f75('0x116'));})[_0x4f75('0x26')](function(){return db[_0x4f75('0x3c')]['findOne']({'where':{'id':_0x23768f}});})['then'](function(_0x420392){if(!_0x420392)throw new APINotFoundError(util[_0x4f75('0xb3')](_0x4f75('0x112'),_0x247710['params']['id']));return db['sequelize'][_0x4f75('0x117')](function(_0x40000c){return _0x420392[_0x4f75('0x115')](_0xa4f657,{'transaction':_0x40000c})[_0x4f75('0x26')](function(){return db[_0x4f75('0x118')][_0x4f75('0x4c')]({'where':{'id':{'$in':_0xa4f657}}});})[_0x4f75('0x26')](function(_0x1b4ea6){var _0x2d7784=_['map'](_0x1b4ea6,function(_0x1f7ed5){return _0x1f7ed5[_0x4f75('0x119')]();});return Promise[_0x4f75('0x56')](_0x2d7784);})['then'](function(_0x58e3b2){_0x1f2e12=_['flattenDeep'](_0x58e3b2);var _0x1879fd=_[_0x4f75('0x32')](_0x1f2e12,function(_0x5ef2ed){return _0x5ef2ed[_0x4f75('0x11a')](_0x420392['id'],{'transaction':_0x40000c});});return Promise[_0x4f75('0x56')](_0x1879fd);})[_0x4f75('0x26')](function(){if(!_0x420392[_0x4f75('0xa7')])return;var _0x342479=_[_0x4f75('0x3f')](_0x1f2e12,function(_0xb0d62){return _0xb0d62['getDataValue'](_0x4f75('0xa6'))==='Voice';});var _0x39a8be=_[_0x4f75('0x32')](_0x342479,function(_0xf8a208){return db['UserVoiceQueueRt'][_0x4f75('0xb6')]({'membername':_0x420392[_0x4f75('0x35')],'UserId':_0x420392['id'],'queue_name':_0xf8a208[_0x4f75('0x35')],'VoiceQueueId':_0xf8a208['id'],'interface':_[_0x4f75('0x6f')](_0x420392[_0x4f75('0xaa')])?util['format'](_0x4f75('0xb4'),_0x420392['name']):_0x420392[_0x4f75('0xaa')],'paused':_0x420392[_0x4f75('0xa9')]||![],'penalty':_0x420392[_0x4f75('0xb5')]},{'transaction':_0x40000c});});return Promise[_0x4f75('0x56')](_0x39a8be);})[_0x4f75('0x26')](function(){return db['TeamVoicePrefix'][_0x4f75('0x4c')]({'where':{'teamId':{'$in':_0xa4f657}}});})[_0x4f75('0x26')](function(_0x1ad76d){var _0x5494ec=_[_0x4f75('0x32')](_0x1ad76d,function(_0x594483){return db[_0x4f75('0x11b')][_0x4f75('0x89')]({'UserId':_0x420392['id'],'VoicePrefixId':_0x594483[_0x4f75('0x11c')]},{'transaction':_0x40000c});});return Promise[_0x4f75('0x56')](_0x5494ec);});});})[_0x4f75('0x26')](function(){for(var _0x21ebf4=0x0;_0x21ebf4<_0x1f2e12[_0x4f75('0x4f')];_0x21ebf4++){var _0x2bb05e=_0x1f2e12[_0x21ebf4][_0x4f75('0x11d')](_0x4f75('0xa6'));var _0x317649=_0x2bb05e+_0x4f75('0xaf');socket[_0x4f75('0x27')](_0x4f75('0x8a')+_0x2bb05e+_0x4f75('0xb0'),{'UserId':_0x23768f,['queueField']:_0x1f2e12[_0x21ebf4]['id']});}})[_0x4f75('0x26')](respondWithStatusCode(_0x30192c,null))[_0x4f75('0x62')](APIHandleError(_0x30192c));};exports[_0x4f75('0x11e')]=function(_0x20c9e3,_0x599b92){var _0x5b9c2f=_0x20c9e3[_0x4f75('0x58')]['id'];var _0x5d5c88=null;if(_0x20c9e3['query'][_0x4f75('0x67')]){_0x5d5c88=_[_0x4f75('0xb9')](_0x20c9e3[_0x4f75('0x44')]['ids'])?_0x20c9e3[_0x4f75('0x44')][_0x4f75('0x67')]:[_0x20c9e3['query'][_0x4f75('0x67')]];}var _0x394b01=[];return Promise[_0x4f75('0x106')]()['then'](function(){if(!_0x5d5c88)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x4f75('0x26')](function(){return db[_0x4f75('0x3c')][_0x4f75('0xa1')]({'where':{'id':_0x5b9c2f}});})[_0x4f75('0x26')](function(_0x18d929){if(!_0x18d929)throw new APINotFoundError(util[_0x4f75('0xb3')]('User\x20with\x20id\x20%s\x20not\x20found',_0x20c9e3[_0x4f75('0x58')]['id']));return db['sequelize'][_0x4f75('0x117')](function(_0x884a67){return _0x18d929[_0x4f75('0x11e')](_0x5d5c88,{'transaction':_0x884a67})[_0x4f75('0x26')](function(){return db['Team'][_0x4f75('0x4c')]({'where':{'id':{'$in':_0x5d5c88}}});})[_0x4f75('0x26')](function(_0x96151b){var _0x886db0=_['map'](_0x96151b,function(_0x4b3f7e){return _0x4b3f7e[_0x4f75('0x119')]();});return Promise[_0x4f75('0x56')](_0x886db0);})[_0x4f75('0x26')](function(_0x546860){_0x394b01=_[_0x4f75('0x11f')](_0x546860);var _0x1bfaf9=_['map'](_0x394b01,function(_0x3939fd){return _0x3939fd[_0x4f75('0x120')](_0x18d929['id'],{'transaction':_0x884a67});});return Promise['all'](_0x1bfaf9);})[_0x4f75('0x26')](function(){if(!_0x18d929['online'])return;var _0x34f657=_[_0x4f75('0x3f')](_0x394b01,function(_0x381eb1){return _0x381eb1['getDataValue'](_0x4f75('0xa6'))==='Voice';});var _0x42ea7c=_[_0x4f75('0x32')](_0x34f657,function(_0xe6b591){return db[_0x4f75('0xbc')]['destroy']({'where':{'VoiceQueueId':_0xe6b591['id'],'UserId':_0x18d929['id']},'transaction':_0x884a67});});return Promise[_0x4f75('0x56')](_0x42ea7c);})['then'](function(){return db[_0x4f75('0x121')][_0x4f75('0x4c')]({'where':{'teamId':{'$in':_0x5d5c88}}});})[_0x4f75('0x26')](function(_0x1c885d){var _0x4be190=_[_0x4f75('0x32')](_0x1c885d,function(_0x473bbd){return db[_0x4f75('0x11b')][_0x4f75('0x29')]({'where':{'UserId':_0x18d929['id'],'VoicePrefixId':_0x473bbd[_0x4f75('0x11c')]}},{'transaction':_0x884a67});});return Promise['all'](_0x4be190);});});})[_0x4f75('0x26')](function(){for(var _0x2b775b=0x0;_0x2b775b<_0x394b01[_0x4f75('0x4f')];_0x2b775b++){var _0x40d173=_0x394b01[_0x2b775b][_0x4f75('0x11d')]('channel');var _0x3ec717=_0x40d173+_0x4f75('0xaf');socket[_0x4f75('0x27')](_0x4f75('0x8a')+_0x40d173+'Queue:remove',{'UserId':_0x5b9c2f,['queueField']:_0x394b01[_0x2b775b]['id']});}})[_0x4f75('0x26')](respondWithStatusCode(_0x599b92,null))[_0x4f75('0x62')](APIHandleError(_0x599b92));};exports['getLists']=function(_0x124c72,_0x1ce868){var _0x320706={};var _0x1a3d53={};var _0x159cfe;var _0x3d0a05;return db['User'][_0x4f75('0xa1')]({'where':{'id':_0x124c72['params']['id']}})[_0x4f75('0x26')](handleEntityNotFound(_0x1ce868,null))['then'](function(_0x4deff4){if(_0x4deff4){_0x159cfe=_0x4deff4;_0x1a3d53[_0x4f75('0x5c')]=_[_0x4f75('0x59')](db[_0x4f75('0xd6')][_0x4f75('0x5a')]);_0x1a3d53[_0x4f75('0x44')]=_[_0x4f75('0x59')](_0x124c72[_0x4f75('0x44')]);_0x1a3d53[_0x4f75('0xd1')]=_['intersection'](_0x1a3d53[_0x4f75('0x5c')],_0x1a3d53[_0x4f75('0x44')]);_0x320706[_0x4f75('0x4a')]=_['intersection'](_0x1a3d53[_0x4f75('0x5c')],qs[_0x4f75('0x5d')](_0x124c72['query'][_0x4f75('0x5d')]));_0x320706[_0x4f75('0x4a')]=_0x320706['attributes'][_0x4f75('0x4f')]?_0x320706[_0x4f75('0x4a')]:_0x1a3d53[_0x4f75('0x5c')];_0x320706[_0x4f75('0xd2')]=qs['sort'](_0x124c72[_0x4f75('0x44')][_0x4f75('0xd3')]);_0x320706[_0x4f75('0x43')]=qs['filters'](_['pick'](_0x124c72[_0x4f75('0x44')],_0x1a3d53[_0x4f75('0xd1')]));if(_0x124c72[_0x4f75('0x44')]['filter']){_0x320706['where']=_[_0x4f75('0x5e')](_0x320706[_0x4f75('0x43')],{'$or':_[_0x4f75('0x32')](_0x320706[_0x4f75('0x4a')],function(_0x5e7bf9){var _0x1b57e1={};_0x1b57e1[_0x5e7bf9]={'$like':'%'+_0x124c72[_0x4f75('0x44')][_0x4f75('0x3f')]+'%'};return _0x1b57e1;})});}_0x320706=_[_0x4f75('0x5e')]({},_0x320706,_0x124c72[_0x4f75('0x5f')]);return _0x159cfe[_0x4f75('0x122')](_0x320706);}})[_0x4f75('0x26')](function(_0x2ea18f){if(_0x2ea18f){_0x3d0a05=_0x2ea18f[_0x4f75('0x4f')];if(!_0x124c72[_0x4f75('0x44')][_0x4f75('0xd5')](_0x4f75('0xdf'))){_0x320706[_0x4f75('0x23')]=qs['limit'](_0x124c72[_0x4f75('0x44')][_0x4f75('0x23')]);_0x320706[_0x4f75('0x20')]=qs[_0x4f75('0x20')](_0x124c72[_0x4f75('0x44')][_0x4f75('0x20')]);}return _0x159cfe['getLists'](_0x320706);}})[_0x4f75('0x26')](function(_0x52e7a1){if(_0x52e7a1){return _0x52e7a1?{'count':_0x3d0a05,'rows':_0x52e7a1}:null;}})[_0x4f75('0x26')](respondWithResult(_0x1ce868,null))[_0x4f75('0x62')](handleError(_0x1ce868,null));};exports['getAgents']=function(_0x2ef76d,_0x31112d){var _0x4e6568={};var _0x377692={};var _0x5c4f21;return db['User']['findOne']({'where':{'id':_0x2ef76d[_0x4f75('0x58')]['id']}})['then'](handleEntityNotFound(_0x31112d,null))[_0x4f75('0x26')](function(_0x4057d3){if(_0x4057d3){_0x5c4f21=_0x4057d3;_0x377692['model']=_['keys'](db[_0x4f75('0x3c')][_0x4f75('0x5a')]);_0x377692['query']=_['keys'](_0x2ef76d[_0x4f75('0x44')]);_0x377692[_0x4f75('0xd1')]=_[_0x4f75('0x5b')](_0x377692[_0x4f75('0x5c')],_0x377692[_0x4f75('0x44')]);_0x4e6568[_0x4f75('0x4a')]=_[_0x4f75('0x5b')](_0x377692[_0x4f75('0x5c')],qs[_0x4f75('0x5d')](_0x2ef76d[_0x4f75('0x44')][_0x4f75('0x5d')]));_0x4e6568[_0x4f75('0x4a')]=_0x4e6568[_0x4f75('0x4a')][_0x4f75('0x4f')]?_0x4e6568[_0x4f75('0x4a')]:_0x377692['model'];_0x4e6568[_0x4f75('0xd2')]=qs[_0x4f75('0xd3')](_0x2ef76d[_0x4f75('0x44')][_0x4f75('0xd3')]);_0x4e6568[_0x4f75('0x43')]=qs[_0x4f75('0xd1')](_['pick'](_0x2ef76d[_0x4f75('0x44')],_0x377692[_0x4f75('0xd1')]));if(_0x2ef76d[_0x4f75('0x44')]['filter']){_0x4e6568[_0x4f75('0x43')]=_['merge'](_0x4e6568[_0x4f75('0x43')],{'$or':_[_0x4f75('0x32')](_0x4e6568['attributes'],function(_0x4e84db){var _0x29f76f={};_0x29f76f[_0x4e84db]={'$like':'%'+_0x2ef76d[_0x4f75('0x44')][_0x4f75('0x3f')]+'%'};return _0x29f76f;})});}_0x4e6568[_0x4f75('0x5c')]=db[_0x4f75('0x3c')];_0x4e6568['as']=_0x4f75('0x2d');_0x4e6568=_['merge']({},_0x4e6568,_0x2ef76d[_0x4f75('0x5f')]);return _0x5c4f21[_0x4f75('0x123')]({'include':[_0x4e6568]});}})['then'](function(_0xdd390d){if(_0xdd390d){var _0x519a95={},_0x488e78=[];for(var _0x5a6f98=0x0;_0x5a6f98<_0xdd390d[_0x4f75('0x4f')];_0x5a6f98+=0x1){for(var _0x58011c=0x0,_0x15fea6;_0x58011c<_0xdd390d[_0x5a6f98][_0x4f75('0x2d')][_0x4f75('0x4f')];_0x58011c+=0x1){_0x15fea6=_0xdd390d[_0x5a6f98]['Agents'][_0x58011c][_0x4f75('0x2a')]({'plain':!![]});_0x519a95[_0x15fea6['id']]=_0x15fea6;}}_0x519a95=_['values'](_0x519a95);for(var _0x1c56db=qs[_0x4f75('0x20')](_0x2ef76d[_0x4f75('0x44')][_0x4f75('0x20')]);_0x1c56db<_0x519a95[_0x4f75('0x4f')]&&_0x488e78[_0x4f75('0x4f')]=_0x14a421[_0x4f62('0x4a')]){throw new Error(_0x4f62('0x4b'));}})[_0x4f62('0x17')](function(){if(_0x5a3bf9){return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x5a3bf9[_0x4f62('0x21')]},'individualHooks':!![]});}})[_0x4f62('0x17')](function(){if(_0x5a3bf9){return _0x5a3bf9[_0x4f62('0x4c')]({'raw':!![]});}})[_0x4f62('0x17')](function(_0x825088){if(_0x5a3bf9){if(_0x825088){var _0x279ff7=[];_0x568427=_0x825088;if(_0x568427[_0x4f62('0x26')]){for(var _0x2d37db=0x0;_0x2d37db<_0x568427[_0x4f62('0x26')];_0x2d37db++){_0x279ff7[_0x4f62('0x2a')](db[_0x4f62('0x25')]['upsert']({'membername':_0x5a3bf9['name'],'UserId':_0x5a3bf9['id'],'queue_name':_0x568427[_0x2d37db][_0x4f62('0x21')],'VoiceQueueId':_0x568427[_0x2d37db]['id'],'interface':_0x433d33,'paused':_0x5a3bf9['loginInPause']||![],'penalty':_0x568427[_0x2d37db][_0x4f62('0x4d')]||0x0}));}return BPromise['all'](_0x279ff7);}}}})[_0x4f62('0x17')](function(){if(_0x5a3bf9){return db['MemberReport'][_0x4f62('0xe')]({'where':{'membername':_0x5a3bf9[_0x4f62('0x21')],'exitAt':null}});}})['then'](function(_0x163ab6){if(_0x5a3bf9){if(_0x163ab6&&_0x163ab6[_0x4f62('0x26')]){var _0x486ec8=[];_0x163ab6['forEach'](function(_0x10daf9){_0x486ec8[_0x4f62('0x2a')](_0x10daf9[_0x4f62('0x43')]({'exitAt':moment()[_0x4f62('0x27')](_0x4f62('0x2d'))}));});return BPromise['all'](_0x486ec8);}}})[_0x4f62('0x17')](function(){if(_0x5a3bf9){var _0x4a265f=[];var _0x43ddaa=[];var _0x23baf5=utils[_0x4f62('0x28')]();var _0x1e84a0={'membername':_0x5a3bf9['name'],'interface':_0x433d33,'enterAt':moment()[_0x4f62('0x27')](_0x4f62('0x2d')),'role':_0x5a3bf9[_0x4f62('0x22')],'internal':_0x5a3bf9[_0x4f62('0x23')]};_0x23baf5[_0x4f62('0x29')](function(_0x8cc49c){_0x4a265f[_0x4f62('0x2a')](_[_0x4f62('0x4e')]({'channel':_0x8cc49c,'type':_0x4f62('0x4f'),'data1':_0x4f62('0x50'),'data2':_0x433d33},_0x1e84a0));if(_0x5a3bf9[_0x4f62('0x51')]){_0x43ddaa[_0x4f62('0x2a')](_['merge']({'channel':_0x8cc49c,'type':_0x4f62('0x52'),'data1':_0x4f62('0x53')},_0x1e84a0));}});return db[_0x4f62('0x30')][_0x4f62('0x31')](_0x4a265f[_0x4f62('0x54')](_0x43ddaa),{'individualHooks':!![]});}})[_0x4f62('0x17')](function(){if(_0x5a3bf9){return _0x5a3bf9[_0x4f62('0x43')]({'online':!![],'lastLoginAt':moment()[_0x4f62('0x27')](_0x4f62('0x2d')),'voicePause':_0x5a3bf9['loginInPause']||![],'mailPause':_0x5a3bf9[_0x4f62('0x51')]||![],'chatPause':_0x5a3bf9['loginInPause']||![],'faxPause':_0x5a3bf9['loginInPause']||![],'smsPause':_0x5a3bf9[_0x4f62('0x51')]||![],'openchannelPause':_0x5a3bf9[_0x4f62('0x51')]||![],'pauseType':_0x5a3bf9[_0x4f62('0x51')]?_0x4f62('0x53'):null,'lastPauseAt':moment()[_0x4f62('0x27')](_0x4f62('0x2d')),'interface':_0x433d33});}})[_0x4f62('0x17')](function(_0x1e3602){_0x39cf5a(_0x1e3602);})['catch'](function(_0x485fe6){_0xeb1503(_0x516069['error'](0x1f4,_0x485fe6[_0x4f62('0x1d')]));});});}; \ No newline at end of file +var _0x000d=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','redis','defaults','./user.socket','User','findAll','options','raw','where','attributes','limit','include','model','map','then','info','GetUser','debug','error','message','ShowUser','find','stringify','catch','PauseUser','name','role','interface','update','MemberReport','length','format','YYYY-MM-DD\x20HH:mm:ss','getChannels','push','isNil','SIP/%s','PAUSE','body','DEFAULT\x20PAUSE','UnpauseUser','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','internal','online','voicePause','chatPause','faxPause','openchannelPause','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','params','unpause','system','LogoutUser','UserVoiceQueueRt','destroy','forEach','all','LoginUser','mobile','phone','count','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','loginInPause','UserVoiceQueue.penalty','merge','LOGIN','bulkCreate','concat','lodash'];(function(_0x417cd7,_0x2d539c){var _0x36bac2=function(_0x283966){while(--_0x283966){_0x417cd7['push'](_0x417cd7['shift']());}};_0x36bac2(++_0x2d539c);}(_0x000d,0xfb));var _0xd000=function(_0x5dca7b,_0x5a0123){_0x5dca7b=_0x5dca7b-0x0;var _0x3f8ff0=_0x000d[_0x5dca7b];return _0x3f8ff0;};'use strict';var _=require(_0xd000('0x0'));var util=require(_0xd000('0x1'));var moment=require(_0xd000('0x2'));var BPromise=require(_0xd000('0x3'));var Redis=require(_0xd000('0x4'));var db=require(_0xd000('0x5'))['db'];var utils=require(_0xd000('0x6'));var logger=require(_0xd000('0x7'))(_0xd000('0x8'));var config=require('../../config/environment');config[_0xd000('0x9')]=_[_0xd000('0xa')](config[_0xd000('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd000('0x9')]));require(_0xd000('0xb'))['register'](socket);exports['GetUser']=function(_0x266e5b){var _0x118765=this;return new Promise(function(_0x5abaa2,_0x15664d){return db[_0xd000('0xc')][_0xd000('0xd')]({'raw':_0x266e5b[_0xd000('0xe')]?_0x266e5b['options'][_0xd000('0xf')]===undefined?!![]:![]:!![],'where':_0x266e5b['options']?_0x266e5b[_0xd000('0xe')][_0xd000('0x10')]||null:null,'attributes':_0x266e5b['options']?_0x266e5b[_0xd000('0xe')][_0xd000('0x11')]||null:null,'limit':_0x266e5b[_0xd000('0xe')]?_0x266e5b[_0xd000('0xe')][_0xd000('0x12')]||null:null,'include':_0x266e5b['options']?_0x266e5b[_0xd000('0xe')][_0xd000('0x13')]?_['map'](_0x266e5b[_0xd000('0xe')][_0xd000('0x13')],function(_0x3b5aa5){return{'model':db[_0x3b5aa5[_0xd000('0x14')]],'as':_0x3b5aa5['as'],'attributes':_0x3b5aa5[_0xd000('0x11')],'include':_0x3b5aa5[_0xd000('0x13')]?_[_0xd000('0x15')](_0x3b5aa5[_0xd000('0x13')],function(_0x4ee3a6){return{'model':db[_0x4ee3a6['model']],'as':_0x4ee3a6['as'],'attributes':_0x4ee3a6[_0xd000('0x11')],'include':_0x4ee3a6[_0xd000('0x13')]?_[_0xd000('0x15')](_0x4ee3a6[_0xd000('0x13')],function(_0x5ed8b9){return{'model':db[_0x5ed8b9[_0xd000('0x14')]],'as':_0x5ed8b9['as'],'attributes':_0x5ed8b9[_0xd000('0x11')]};}):[]};}):[]};}):[]:[]})[_0xd000('0x16')](function(_0x495259){logger[_0xd000('0x17')](_0xd000('0x18'),_0x266e5b);logger[_0xd000('0x19')](_0xd000('0x18'),_0x266e5b,JSON['stringify'](_0x495259));_0x5abaa2(_0x495259);})['catch'](function(_0x1e0d71){logger[_0xd000('0x1a')]('GetUser',_0x1e0d71['message'],_0x266e5b);_0x15664d(_0x118765[_0xd000('0x1a')](0x1f4,_0x1e0d71[_0xd000('0x1b')]));});});};exports[_0xd000('0x1c')]=function(_0x39ba03){var _0xfa2fba=this;return new Promise(function(_0x2f8c74,_0x2ed1e8){return db['User'][_0xd000('0x1d')]({'raw':_0x39ba03[_0xd000('0xe')]?_0x39ba03['options'][_0xd000('0xf')]===undefined?!![]:![]:!![],'where':_0x39ba03[_0xd000('0xe')]?_0x39ba03[_0xd000('0xe')][_0xd000('0x10')]||null:null,'attributes':_0x39ba03['options']?_0x39ba03[_0xd000('0xe')][_0xd000('0x11')]||null:null,'include':_0x39ba03[_0xd000('0xe')]?_0x39ba03[_0xd000('0xe')]['include']?_[_0xd000('0x15')](_0x39ba03['options'][_0xd000('0x13')],function(_0x70b79c){return{'model':db[_0x70b79c[_0xd000('0x14')]],'as':_0x70b79c['as'],'attributes':_0x70b79c[_0xd000('0x11')],'include':_0x70b79c[_0xd000('0x13')]?_['map'](_0x70b79c[_0xd000('0x13')],function(_0x1bd5b0){return{'model':db[_0x1bd5b0[_0xd000('0x14')]],'as':_0x1bd5b0['as'],'attributes':_0x1bd5b0['attributes'],'include':_0x1bd5b0[_0xd000('0x13')]?_[_0xd000('0x15')](_0x1bd5b0[_0xd000('0x13')],function(_0x483187){return{'model':db[_0x483187['model']],'as':_0x483187['as'],'attributes':_0x483187[_0xd000('0x11')]};}):[]};}):[]};}):[]:[]})[_0xd000('0x16')](function(_0x3e0e26){logger[_0xd000('0x17')](_0xd000('0x1c'),_0x39ba03);logger[_0xd000('0x19')](_0xd000('0x1c'),_0x39ba03,JSON[_0xd000('0x1e')](_0x3e0e26));_0x2f8c74(_0x3e0e26);})[_0xd000('0x1f')](function(_0x185598){logger[_0xd000('0x1a')](_0xd000('0x1c'),_0x185598[_0xd000('0x1b')],_0x39ba03);_0x2ed1e8(_0xfa2fba['error'](0x1f4,_0x185598[_0xd000('0x1b')]));});});};exports[_0xd000('0x20')]=function(_0x5d508b){var _0x5baae2=this;return new Promise(function(_0x1d1196,_0x307fb3){var _0x3b074c;return db[_0xd000('0xc')][_0xd000('0x1d')]({'where':_0x5d508b[_0xd000('0xe')][_0xd000('0x10')]||{},'attributes':['id',_0xd000('0x21'),_0xd000('0x22'),'internal',_0xd000('0x23')]})[_0xd000('0x16')](function(_0x1c34d1){if(_0x1c34d1){_0x3b074c=_0x1c34d1;return db['UserVoiceQueueRt'][_0xd000('0x24')]({'paused':0x1},{'where':{'UserId':_0x3b074c['id']},'individualHooks':!![]});}})[_0xd000('0x16')](function(){if(_0x3b074c){return db[_0xd000('0x25')][_0xd000('0xd')]({'where':{'membername':_0x3b074c['name'],'type':'PAUSE','exitAt':null}});}})[_0xd000('0x16')](function(_0x2dbda3){if(_0x3b074c){if(_0x2dbda3&&_0x2dbda3[_0xd000('0x26')]){var _0x1e9391=moment()[_0xd000('0x27')](_0xd000('0x28'));for(var _0xd5b531=0x0,_0x39572a=_0x2dbda3[_0xd000('0x26')];_0xd5b531<_0x39572a;_0xd5b531++){_0x2dbda3[_0xd5b531]['updateAttributes']({'exitAt':_0x1e9391});}}}})[_0xd000('0x16')](function(){if(_0x3b074c){var _0x3905c8=[];var _0x37e294=utils[_0xd000('0x29')]();_0x37e294['forEach'](function(_0x16d020){_0x3905c8[_0xd000('0x2a')]({'channel':_0x16d020,'membername':_0x3b074c[_0xd000('0x21')],'interface':_[_0xd000('0x2b')](_0x3b074c['interface'])?util['format'](_0xd000('0x2c'),_0x3b074c[_0xd000('0x21')]):_0x3b074c[_0xd000('0x23')],'type':_0xd000('0x2d'),'enterAt':moment()[_0xd000('0x27')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x5d508b[_0xd000('0x2e')]['type']||_0xd000('0x2f'),'role':_0x3b074c[_0xd000('0x22')],'internal':_0x3b074c['internal'],'uniqueid':_0x5d508b['body']['uniqueid']||null});});return db[_0xd000('0x25')]['bulkCreate'](_0x3905c8,{'individualHooks':!![]});}})[_0xd000('0x16')](function(){if(_0x3b074c){return _0x3b074c[_0xd000('0x24')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x5d508b['body']['type']||_0xd000('0x2f'),'lastPauseAt':moment()[_0xd000('0x27')](_0xd000('0x28'))});}})[_0xd000('0x16')](function(_0x530fd3){_0x1d1196(_0x530fd3);})[_0xd000('0x1f')](function(_0x4a5dc9){_0x307fb3(_0x5baae2['error'](0x1f4,_0x4a5dc9[_0xd000('0x1b')]));});});};exports[_0xd000('0x30')]=function(_0x498464){var _0x12b2c6=this;return new Promise(function(_0x21a596,_0x4a1283){if(_0x498464[_0xd000('0x2e')][_0xd000('0x31')]&&!utils[_0xd000('0x32')](_0x498464[_0xd000('0x2e')][_0xd000('0x31')])){throw new Error(util[_0xd000('0x27')](_0xd000('0x33'),_0x498464[_0xd000('0x2e')][_0xd000('0x31')]));}return db[_0xd000('0xc')][_0xd000('0x34')]({'where':_0x498464[_0xd000('0xe')][_0xd000('0x10')]||{},'attributes':['id',_0xd000('0x21'),_0xd000('0x22'),_0xd000('0x35'),_0xd000('0x23'),_0xd000('0x36'),_0xd000('0x37'),'mailPause',_0xd000('0x38'),_0xd000('0x39'),_0xd000('0x3a'),'smsPause','whatsappPause','pauseType',_0xd000('0x3b')]})[_0xd000('0x16')](function(_0x2c51d9){if(!_0x2c51d9){throw new Error(util[_0xd000('0x27')](_0xd000('0x3c'),_0x498464[_0xd000('0x3d')]['id']));}return _0x2c51d9[_0xd000('0x3e')](_0x498464[_0xd000('0x2e')][_0xd000('0x31')],_0xd000('0x3f'));})['then'](function(_0x34c271){_0x21a596(_0x34c271);})[_0xd000('0x1f')](function(_0xf99ab7){_0x4a1283(_0x12b2c6[_0xd000('0x1a')](0x1f4,_0xf99ab7[_0xd000('0x1b')]));});});};exports[_0xd000('0x40')]=function(_0x5b1dc8){var _0x22bc1f=this;return new Promise(function(_0x983777,_0x4171bc){var _0x1288d0;return db[_0xd000('0xc')][_0xd000('0x34')]({'where':_0x5b1dc8[_0xd000('0xe')][_0xd000('0x10')]||{},'attributes':['id',_0xd000('0x21')]})[_0xd000('0x16')](function(_0xcb2fd9){if(_0xcb2fd9){_0x1288d0=_0xcb2fd9;return db[_0xd000('0x41')][_0xd000('0x42')]({'where':{'membername':_0x1288d0[_0xd000('0x21')]},'individualHooks':!![]});}})[_0xd000('0x16')](function(){if(_0x1288d0){return db['MemberReport'][_0xd000('0xd')]({'where':{'membername':_0x1288d0[_0xd000('0x21')],'exitAt':null}});}})[_0xd000('0x16')](function(_0x495190){if(_0x1288d0){if(_0x495190&&_0x495190['length']){var _0x3aad02=[];_0x495190[_0xd000('0x43')](function(_0x54fecf){_0x3aad02[_0xd000('0x2a')](_0x54fecf[_0xd000('0x24')]({'exitAt':moment()['format'](_0xd000('0x28'))}));});return BPromise[_0xd000('0x44')](_0x3aad02);}}})['then'](function(){if(_0x1288d0){return _0x1288d0[_0xd000('0x24')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xd000('0x16')](function(_0x762a1d){_0x983777(_0x762a1d);})[_0xd000('0x1f')](function(_0x5e2c0f){_0x4171bc(_0x22bc1f[_0xd000('0x1a')](0x1f4,_0x5e2c0f[_0xd000('0x1b')]));});});};exports[_0xd000('0x45')]=function(_0xf36488){var _0x5cb93c=this;return new Promise(function(_0x13a940,_0x422f5d){var _0x1f7627;var _0x425026;var _0x3bef71;var _0x517019;return db[_0xd000('0xc')][_0xd000('0x34')]({'where':_0xf36488['options']['where']||{},'attributes':['id',_0xd000('0x21'),'role',_0xd000('0x46'),_0xd000('0x47'),_0xd000('0x35'),'loginInPause','interface']})['then'](function(_0x1a1d57){if(_0x1a1d57){_0x1f7627=_0x1a1d57;_0x517019=_0xf36488['body'][_0xd000('0x23')]?_0xf36488[_0xd000('0x2e')][_0xd000('0x23')]:util[_0xd000('0x27')](_0xd000('0x2c'),_0x1f7627[_0xd000('0x21')]);return db['User'][_0xd000('0x48')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x1f7627['id']}}});}})[_0xd000('0x16')](function(_0x12c933){if(_0x12c933){_0x3bef71=_0x12c933;return require(_0xd000('0x49'))[_0xd000('0x4a')]();}})[_0xd000('0x16')](function(_0x1937d2){if(_0x1937d2&&_0x1937d2[_0xd000('0x4b')]&&_0x3bef71>=_0x1937d2['agents']){throw new Error(_0xd000('0x4c'));}})[_0xd000('0x16')](function(){if(_0x1f7627){return db[_0xd000('0x41')][_0xd000('0x42')]({'where':{'membername':_0x1f7627[_0xd000('0x21')]},'individualHooks':!![]});}})['then'](function(){if(_0x1f7627){return _0x1f7627[_0xd000('0x4d')]({'raw':!![]});}})[_0xd000('0x16')](function(_0x228181){if(_0x1f7627){if(_0x228181){var _0x5a2a5e=[];_0x425026=_0x228181;if(_0x425026[_0xd000('0x26')]){for(var _0x19f55c=0x0;_0x19f55c<_0x425026[_0xd000('0x26')];_0x19f55c++){_0x5a2a5e[_0xd000('0x2a')](db['UserVoiceQueueRt']['upsert']({'membername':_0x1f7627['name'],'UserId':_0x1f7627['id'],'queue_name':_0x425026[_0x19f55c][_0xd000('0x21')],'VoiceQueueId':_0x425026[_0x19f55c]['id'],'interface':_0x517019,'paused':_0x1f7627[_0xd000('0x4e')]||![],'penalty':_0x425026[_0x19f55c][_0xd000('0x4f')]||0x0}));}return BPromise[_0xd000('0x44')](_0x5a2a5e);}}}})['then'](function(){if(_0x1f7627){return db[_0xd000('0x25')][_0xd000('0xd')]({'where':{'membername':_0x1f7627[_0xd000('0x21')],'exitAt':null}});}})[_0xd000('0x16')](function(_0x26f145){if(_0x1f7627){if(_0x26f145&&_0x26f145[_0xd000('0x26')]){var _0x2926da=[];_0x26f145[_0xd000('0x43')](function(_0x8e08ec){_0x2926da[_0xd000('0x2a')](_0x8e08ec['update']({'exitAt':moment()[_0xd000('0x27')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xd000('0x44')](_0x2926da);}}})[_0xd000('0x16')](function(){if(_0x1f7627){var _0x1a152d=[];var _0x8de8e6=[];var _0x2263da=utils[_0xd000('0x29')]();var _0xc31ad1={'membername':_0x1f7627['name'],'interface':_0x517019,'enterAt':moment()[_0xd000('0x27')](_0xd000('0x28')),'role':_0x1f7627[_0xd000('0x22')],'internal':_0x1f7627['internal']};_0x2263da['forEach'](function(_0x234c0c){_0x1a152d[_0xd000('0x2a')](_[_0xd000('0x50')]({'channel':_0x234c0c,'type':_0xd000('0x51'),'data1':'callysquare','data2':_0x517019},_0xc31ad1));if(_0x1f7627[_0xd000('0x4e')]){_0x8de8e6[_0xd000('0x2a')](_[_0xd000('0x50')]({'channel':_0x234c0c,'type':'PAUSE','data1':'LOGININPAUSE'},_0xc31ad1));}});return db[_0xd000('0x25')][_0xd000('0x52')](_0x1a152d[_0xd000('0x53')](_0x8de8e6),{'individualHooks':!![]});}})['then'](function(){if(_0x1f7627){return _0x1f7627[_0xd000('0x24')]({'online':!![],'lastLoginAt':moment()[_0xd000('0x27')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x1f7627['loginInPause']||![],'mailPause':_0x1f7627['loginInPause']||![],'chatPause':_0x1f7627[_0xd000('0x4e')]||![],'faxPause':_0x1f7627[_0xd000('0x4e')]||![],'smsPause':_0x1f7627['loginInPause']||![],'openchannelPause':_0x1f7627['loginInPause']||![],'pauseType':_0x1f7627['loginInPause']?'LOGININPAUSE':null,'lastPauseAt':moment()[_0xd000('0x27')](_0xd000('0x28')),'interface':_0x517019});}})[_0xd000('0x16')](function(_0x53a3fa){_0x13a940(_0x53a3fa);})[_0xd000('0x1f')](function(_0x329b12){_0x422f5d(_0x5cb93c['error'](0x1f4,_0x329b12[_0xd000('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index ba02eb5..3e61816 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 _0x2cc4=['save','remove','update','removeListener','register','length','user:'];(function(_0x1eb1c3,_0x23f677){var _0x4714af=function(_0x5ed5e3){while(--_0x5ed5e3){_0x1eb1c3['push'](_0x1eb1c3['shift']());}};_0x4714af(++_0x23f677);}(_0x2cc4,0xfc));var _0x42cc=function(_0xc40b9f,_0x17ec1f){_0xc40b9f=_0xc40b9f-0x0;var _0x535b9c=_0x2cc4[_0xc40b9f];return _0x535b9c;};'use strict';var UserEvents=require('./user.events');var events=[_0x42cc('0x0'),_0x42cc('0x1'),_0x42cc('0x2')];function createListener(_0x524b64,_0x10a32b){return function(_0x206235){_0x10a32b['emit'](_0x524b64,_0x206235);};}function removeListener(_0x265a3b,_0x977e69){return function(){UserEvents[_0x42cc('0x3')](_0x265a3b,_0x977e69);};}exports[_0x42cc('0x4')]=function(_0x5ad725){for(var _0xf789dd=0x0,_0x33e77a=events[_0x42cc('0x5')];_0xf789dd<_0x33e77a;_0xf789dd++){var _0x188fe2=events[_0xf789dd];var _0x2787b=createListener(_0x42cc('0x6')+_0x188fe2,_0x5ad725);UserEvents['on'](_0x188fe2,_0x2787b);}}; \ No newline at end of file +var _0x458b=['./user.events','update','removeListener','register','length','user:'];(function(_0x53f025,_0x476c3b){var _0x2a1bca=function(_0x4c7ac0){while(--_0x4c7ac0){_0x53f025['push'](_0x53f025['shift']());}};_0x2a1bca(++_0x476c3b);}(_0x458b,0x1f2));var _0xb458=function(_0x3e2480,_0x2eed70){_0x3e2480=_0x3e2480-0x0;var _0x652c0=_0x458b[_0x3e2480];return _0x652c0;};'use strict';var UserEvents=require(_0xb458('0x0'));var events=['save','remove',_0xb458('0x1')];function createListener(_0x9f56a1,_0x26ca93){return function(_0x3c09ba){_0x26ca93['emit'](_0x9f56a1,_0x3c09ba);};}function removeListener(_0x5dbe51,_0x59e982){return function(){UserEvents[_0xb458('0x2')](_0x5dbe51,_0x59e982);};}exports[_0xb458('0x3')]=function(_0x48481d){for(var _0xd8cebb=0x0,_0x12ddce=events[_0xb458('0x4')];_0xd8cebb<_0x12ddce;_0xd8cebb++){var _0x1431f1=events[_0xd8cebb];var _0x380eff=createListener(_0xb458('0x5')+_0x1431f1,_0x48481d);UserEvents['on'](_0x1431f1,_0x380eff);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 6f3b2dd..095e2d0 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x25b699,_0x3da35c){var _0x5e5d83=function(_0x36b8e4){while(--_0x36b8e4){_0x25b699['push'](_0x25b699['shift']());}};_0x5e5d83(++_0x3da35c);}(_0xedd9,0xfc));var _0x9edd=function(_0x369ee0,_0x57a15c){_0x369ee0=_0x369ee0-0x0;var _0x493a06=_0xedd9[_0x369ee0];return _0x493a06;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0xfc4b38,_0x44655f){var _0x775357=function(_0x5cddae){while(--_0x5cddae){_0xfc4b38['push'](_0xfc4b38['shift']());}};_0x775357(++_0x44655f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x53abe5,_0x33a9e5){_0x53abe5=_0x53abe5-0x0;var _0xc1c37e=_0xcb91[_0x53abe5];return _0xc1c37e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 8d3bea5..249a51d 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 _0xa74c=['exports','INTEGER'];(function(_0x1977d8,_0x3f9f06){var _0x3b8106=function(_0x57b8c4){while(--_0x57b8c4){_0x1977d8['push'](_0x1977d8['shift']());}};_0x3b8106(++_0x3f9f06);}(_0xa74c,0x106));var _0xca74=function(_0x3026ec,_0x4e9bed){_0x3026ec=_0x3026ec-0x0;var _0x3a6c2c=_0xa74c[_0x3026ec];return _0x3a6c2c;};'use strict';var Sequelize=require('sequelize');module[_0xca74('0x0')]={'penalty':{'type':Sequelize[_0xca74('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4b68=['sequelize','exports','INTEGER'];(function(_0x5ef35d,_0x241ac1){var _0x1d21f3=function(_0x32d283){while(--_0x32d283){_0x5ef35d['push'](_0x5ef35d['shift']());}};_0x1d21f3(++_0x241ac1);}(_0x4b68,0x129));var _0x84b6=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x4b68[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0x84b6('0x0'));module[_0x84b6('0x1')]={'penalty':{'type':Sequelize[_0x84b6('0x2')],'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 8c221e8..d91b42d 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 _0xe340=['../../config/environment','exports','UserChatQueue','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x75b50,_0xfb2eaf){var _0x27f7fb=function(_0x4d930b){while(--_0x4d930b){_0x75b50['push'](_0x75b50['shift']());}};_0x27f7fb(++_0xfb2eaf);}(_0xe340,0xa3));var _0x0e34=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xe340[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0x0e34('0x0'));var util=require(_0x0e34('0x1'));var logger=require(_0x0e34('0x2'))(_0x0e34('0x3'));var moment=require(_0x0e34('0x4'));var BPromise=require(_0x0e34('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0e34('0x6'));var rimraf=require('rimraf');var config=require(_0x0e34('0x7'));var attributes=require('./userChatQueue.attributes');module[_0x0e34('0x8')]=function(_0x7caed0,_0x1156d9){return _0x7caed0['define'](_0x0e34('0x9'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b8b=['define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x8b8b,0x1a7));var _0xb8b8=function(_0x334331,_0x469b81){_0x334331=_0x334331-0x0;var _0x386a4f=_0x8b8b[_0x334331];return _0x386a4f;};'use strict';var _=require(_0xb8b8('0x0'));var util=require(_0xb8b8('0x1'));var logger=require(_0xb8b8('0x2'))(_0xb8b8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb8b8('0x4'));var fs=require('fs');var path=require(_0xb8b8('0x5'));var rimraf=require(_0xb8b8('0x6'));var config=require(_0xb8b8('0x7'));var attributes=require('./userChatQueue.attributes');module[_0xb8b8('0x8')]=function(_0x2b412f,_0x4ffec8){return _0x2b412f[_0xb8b8('0x9')](_0xb8b8('0xa'),attributes,{'tableName':_0xb8b8('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 8cc8e27..8db314a 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 _0xfaf6=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','UserChatQueue,\x20%s,\x20%s','moment','bluebird','ioredis'];(function(_0xb6a299,_0x42fa56){var _0x356786=function(_0x146af9){while(--_0x146af9){_0xb6a299['push'](_0xb6a299['shift']());}};_0x356786(++_0x42fa56);}(_0xfaf6,0xc5));var _0x6faf=function(_0x42668d,_0x227cea){_0x42668d=_0x42668d-0x0;var _0x141a29=_0xfaf6[_0x42668d];return _0x141a29;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6faf('0x0'));var BPromise=require(_0x6faf('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6faf('0x2'));var db=require(_0x6faf('0x3'))['db'];var utils=require(_0x6faf('0x4'));var logger=require(_0x6faf('0x5'))(_0x6faf('0x6'));var config=require(_0x6faf('0x7'));var jayson=require(_0x6faf('0x8'));var client=jayson[_0x6faf('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39af11,_0x51c17,_0x131313){return new BPromise(function(_0x22d184,_0x57faa6){return client[_0x6faf('0xa')](_0x39af11,_0x131313)[_0x6faf('0xb')](function(_0x538fca){logger[_0x6faf('0xc')]('UserChatQueue,\x20%s,\x20%s',_0x51c17,'request\x20sent');logger['debug'](_0x6faf('0xd'),_0x51c17,_0x6faf('0xe'),JSON[_0x6faf('0xf')](_0x538fca));if(_0x538fca[_0x6faf('0x10')]){if(_0x538fca[_0x6faf('0x10')][_0x6faf('0x11')]===0x1f4){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x51c17,_0x538fca[_0x6faf('0x10')][_0x6faf('0x12')]);return _0x57faa6(_0x538fca[_0x6faf('0x10')]['message']);}logger[_0x6faf('0x10')](_0x6faf('0x13'),_0x51c17,_0x538fca[_0x6faf('0x10')][_0x6faf('0x12')]);return _0x22d184(_0x538fca[_0x6faf('0x10')][_0x6faf('0x12')]);}else{logger[_0x6faf('0xc')](_0x6faf('0x13'),_0x51c17,_0x6faf('0xe'));_0x22d184(_0x538fca['result']['message']);}})['catch'](function(_0x3f0017){logger[_0x6faf('0x10')](_0x6faf('0x13'),_0x51c17,_0x3f0017);_0x57faa6(_0x3f0017);});});} \ No newline at end of file +var _0x1a53=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','util','ioredis'];(function(_0x1834fb,_0x38bfa4){var _0x578b25=function(_0xb3980e){while(--_0xb3980e){_0x1834fb['push'](_0x1834fb['shift']());}};_0x578b25(++_0x38bfa4);}(_0x1a53,0x130));var _0x31a5=function(_0x1e019d,_0x38f18f){_0x1e019d=_0x1e019d-0x0;var _0xe848fc=_0x1a53[_0x1e019d];return _0xe848fc;};'use strict';var _=require('lodash');var util=require(_0x31a5('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x31a5('0x1'));var db=require(_0x31a5('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x31a5('0x3'))(_0x31a5('0x4'));var config=require(_0x31a5('0x5'));var jayson=require(_0x31a5('0x6'));var client=jayson[_0x31a5('0x7')][_0x31a5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2225ad,_0x2573f3,_0x2be35c){return new BPromise(function(_0x118b31,_0xd5952c){return client[_0x31a5('0x9')](_0x2225ad,_0x2be35c)[_0x31a5('0xa')](function(_0x23e2f6){logger[_0x31a5('0xb')](_0x31a5('0xc'),_0x2573f3,_0x31a5('0xd'));logger['debug']('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x2573f3,_0x31a5('0xd'),JSON[_0x31a5('0xe')](_0x23e2f6));if(_0x23e2f6['error']){if(_0x23e2f6[_0x31a5('0xf')][_0x31a5('0x10')]===0x1f4){logger[_0x31a5('0xf')](_0x31a5('0xc'),_0x2573f3,_0x23e2f6[_0x31a5('0xf')][_0x31a5('0x11')]);return _0xd5952c(_0x23e2f6[_0x31a5('0xf')]['message']);}logger[_0x31a5('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x2573f3,_0x23e2f6[_0x31a5('0xf')][_0x31a5('0x11')]);return _0x118b31(_0x23e2f6['error']['message']);}else{logger[_0x31a5('0xb')](_0x31a5('0xc'),_0x2573f3,_0x31a5('0xd'));_0x118b31(_0x23e2f6['result'][_0x31a5('0x11')]);}})['catch'](function(_0x5ac733){logger['error'](_0x31a5('0xc'),_0x2573f3,_0x5ac733);_0xd5952c(_0x5ac733);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 8db4bd6..e1493aa 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x49c824,_0x18e9be){var _0x29dc99=function(_0x1b1080){while(--_0x1b1080){_0x49c824['push'](_0x49c824['shift']());}};_0x29dc99(++_0x18e9be);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x564bdc,_0x43a797){var _0xb3b003=function(_0x18ba9c){while(--_0x18ba9c){_0x564bdc['push'](_0x564bdc['shift']());}};_0xb3b003(++_0x43a797);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4480b9,_0x5c2949){_0x4480b9=_0x4480b9-0x0;var _0x3f0f02=_0xcb91[_0x4480b9];return _0x3f0f02;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index b7e82d6..51bf03d 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 _0x0960=['STRING','sequelize','exports','INTEGER'];(function(_0x4ee0a1,_0x26b112){var _0x8589f7=function(_0x2f0e09){while(--_0x2f0e09){_0x4ee0a1['push'](_0x4ee0a1['shift']());}};_0x8589f7(++_0x26b112);}(_0x0960,0xe5));var _0x0096=function(_0x12fc10,_0x327cf5){_0x12fc10=_0x12fc10-0x0;var _0x3342c1=_0x0960[_0x12fc10];return _0x3342c1;};'use strict';var Sequelize=require(_0x0096('0x0'));module[_0x0096('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x0096('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x0096('0x3')]}}; \ No newline at end of file +var _0x6054=['STRING','sequelize','INTEGER'];(function(_0x25402f,_0x2808b0){var _0x4d5b8f=function(_0xf998d4){while(--_0xf998d4){_0x25402f['push'](_0x25402f['shift']());}};_0x4d5b8f(++_0x2808b0);}(_0x6054,0x1a8));var _0x4605=function(_0x5de02c,_0x2bca83){_0x5de02c=_0x5de02c-0x0;var _0x5bee77=_0x6054[_0x5de02c];return _0x5bee77;};'use strict';var Sequelize=require(_0x4605('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x4605('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x4605('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x4605('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 3f9555a..b32b431 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 _0xacf5=['rimraf','./userFaxQueue.attributes','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x5904a1,_0x298cb){var _0x1843c3=function(_0x5e8d5f){while(--_0x5e8d5f){_0x5904a1['push'](_0x5904a1['shift']());}};_0x1843c3(++_0x298cb);}(_0xacf5,0x123));var _0x5acf=function(_0x20dc9b,_0x2c80b4){_0x20dc9b=_0x20dc9b-0x0;var _0x5074ee=_0xacf5[_0x20dc9b];return _0x5074ee;};'use strict';var _=require(_0x5acf('0x0'));var util=require(_0x5acf('0x1'));var logger=require(_0x5acf('0x2'))('api');var moment=require(_0x5acf('0x3'));var BPromise=require(_0x5acf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5acf('0x5'));var rimraf=require(_0x5acf('0x6'));var config=require('../../config/environment');var attributes=require(_0x5acf('0x7'));module['exports']=function(_0x2a1247,_0x3bb7e6){return _0x2a1247[_0x5acf('0x8')](_0x5acf('0x9'),attributes,{'tableName':_0x5acf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2799=['./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','api','moment','path','rimraf','../../config/environment'];(function(_0x19df86,_0x492b29){var _0x1ccac5=function(_0x591840){while(--_0x591840){_0x19df86['push'](_0x19df86['shift']());}};_0x1ccac5(++_0x492b29);}(_0x2799,0x191));var _0x9279=function(_0x774bdb,_0x1cf041){_0x774bdb=_0x774bdb-0x0;var _0x1bdb26=_0x2799[_0x774bdb];return _0x1bdb26;};'use strict';var _=require(_0x9279('0x0'));var util=require(_0x9279('0x1'));var logger=require('../../config/logger')(_0x9279('0x2'));var moment=require(_0x9279('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9279('0x4'));var rimraf=require(_0x9279('0x5'));var config=require(_0x9279('0x6'));var attributes=require(_0x9279('0x7'));module[_0x9279('0x8')]=function(_0x247675,_0x48a1c1){return _0x247675[_0x9279('0x9')](_0x9279('0xa'),attributes,{'tableName':_0x9279('0xb'),'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 d2a30ab..7742c5e 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 _0x8e7b=['http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x8e7b,0x160));var _0xb8e7=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x8e7b[_0x36884e];return _0x1cc367;};'use strict';var _=require(_0xb8e7('0x0'));var util=require(_0xb8e7('0x1'));var moment=require(_0xb8e7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb8e7('0x3'));var db=require(_0xb8e7('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb8e7('0x5'));var config=require(_0xb8e7('0x6'));var jayson=require(_0xb8e7('0x7'));var client=jayson[_0xb8e7('0x8')][_0xb8e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3fb75b,_0xc28f00,_0x4408b7){return new BPromise(function(_0x4a3815,_0x515e9b){return client[_0xb8e7('0xa')](_0x3fb75b,_0x4408b7)[_0xb8e7('0xb')](function(_0x49bda3){logger[_0xb8e7('0xc')](_0xb8e7('0xd'),_0xc28f00,_0xb8e7('0xe'));logger['debug'](_0xb8e7('0xf'),_0xc28f00,_0xb8e7('0xe'),JSON['stringify'](_0x49bda3));if(_0x49bda3[_0xb8e7('0x10')]){if(_0x49bda3['error']['code']===0x1f4){logger[_0xb8e7('0x10')](_0xb8e7('0xd'),_0xc28f00,_0x49bda3[_0xb8e7('0x10')]['message']);return _0x515e9b(_0x49bda3['error'][_0xb8e7('0x11')]);}logger[_0xb8e7('0x10')](_0xb8e7('0xd'),_0xc28f00,_0x49bda3[_0xb8e7('0x10')][_0xb8e7('0x11')]);return _0x4a3815(_0x49bda3[_0xb8e7('0x10')][_0xb8e7('0x11')]);}else{logger[_0xb8e7('0xc')](_0xb8e7('0xd'),_0xc28f00,_0xb8e7('0xe'));_0x4a3815(_0x49bda3[_0xb8e7('0x12')][_0xb8e7('0x11')]);}})['catch'](function(_0x5a74eb){logger[_0xb8e7('0x10')](_0xb8e7('0xd'),_0xc28f00,_0x5a74eb);_0x515e9b(_0x5a74eb);});});} \ No newline at end of file +var _0xb2a2=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util'];(function(_0xee0db8,_0x173b33){var _0x2e0b61=function(_0x5690aa){while(--_0x5690aa){_0xee0db8['push'](_0xee0db8['shift']());}};_0x2e0b61(++_0x173b33);}(_0xb2a2,0x89));var _0x2b2a=function(_0x331682,_0x30acbe){_0x331682=_0x331682-0x0;var _0x390559=_0xb2a2[_0x331682];return _0x390559;};'use strict';var _=require('lodash');var util=require(_0x2b2a('0x0'));var moment=require(_0x2b2a('0x1'));var BPromise=require(_0x2b2a('0x2'));var rs=require(_0x2b2a('0x3'));var fs=require('fs');var Redis=require(_0x2b2a('0x4'));var db=require(_0x2b2a('0x5'))['db'];var utils=require(_0x2b2a('0x6'));var logger=require(_0x2b2a('0x7'))('rpc');var config=require(_0x2b2a('0x8'));var jayson=require(_0x2b2a('0x9'));var client=jayson[_0x2b2a('0xa')][_0x2b2a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5af906,_0x241c42,_0x30773b){return new BPromise(function(_0x2a6f02,_0x816f00){return client[_0x2b2a('0xc')](_0x5af906,_0x30773b)[_0x2b2a('0xd')](function(_0x440260){logger[_0x2b2a('0xe')](_0x2b2a('0xf'),_0x241c42,'request\x20sent');logger['debug'](_0x2b2a('0x10'),_0x241c42,_0x2b2a('0x11'),JSON[_0x2b2a('0x12')](_0x440260));if(_0x440260[_0x2b2a('0x13')]){if(_0x440260[_0x2b2a('0x13')][_0x2b2a('0x14')]===0x1f4){logger[_0x2b2a('0x13')](_0x2b2a('0xf'),_0x241c42,_0x440260[_0x2b2a('0x13')][_0x2b2a('0x15')]);return _0x816f00(_0x440260[_0x2b2a('0x13')][_0x2b2a('0x15')]);}logger[_0x2b2a('0x13')](_0x2b2a('0xf'),_0x241c42,_0x440260[_0x2b2a('0x13')][_0x2b2a('0x15')]);return _0x2a6f02(_0x440260['error']['message']);}else{logger[_0x2b2a('0xe')](_0x2b2a('0xf'),_0x241c42,_0x2b2a('0x11'));_0x2a6f02(_0x440260[_0x2b2a('0x16')][_0x2b2a('0x15')]);}})['catch'](function(_0x49f681){logger['error'](_0x2b2a('0xf'),_0x241c42,_0x49f681);_0x816f00(_0x49f681);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 7aadf61..ff6dc76 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x396466,_0xe9857b){var _0x5e9ab4=function(_0x362f66){while(--_0x362f66){_0x396466['push'](_0x396466['shift']());}};_0x5e9ab4(++_0xe9857b);}(_0x9c44,0x178));var _0x49c4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9c44[_0x4b055c];return _0x4b62bb;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x2ee13e,_0x4e322b){var _0x5e848a=function(_0x27e673){while(--_0x27e673){_0x2ee13e['push'](_0x2ee13e['shift']());}};_0x5e848a(++_0x4e322b);}(_0xe706,0xa3));var _0x6e70=function(_0x30b0fe,_0x542156){_0x30b0fe=_0x30b0fe-0x0;var _0x412d11=_0xe706[_0x30b0fe];return _0x412d11;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index c90e46e..c2fe161 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 _0x19d1=['sequelize','exports'];(function(_0x5eb24d,_0xa71a6f){var _0x4d4507=function(_0x659ccf){while(--_0x659ccf){_0x5eb24d['push'](_0x5eb24d['shift']());}};_0x4d4507(++_0xa71a6f);}(_0x19d1,0x16c));var _0x119d=function(_0x50c2d2,_0x466c6e){_0x50c2d2=_0x50c2d2-0x0;var _0x3cfaad=_0x19d1[_0x50c2d2];return _0x3cfaad;};'use strict';var Sequelize=require(_0x119d('0x0'));module[_0x119d('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xf66d=['exports','INTEGER','sequelize'];(function(_0x31bbf7,_0x292c9a){var _0x1469f3=function(_0x58ca15){while(--_0x58ca15){_0x31bbf7['push'](_0x31bbf7['shift']());}};_0x1469f3(++_0x292c9a);}(_0xf66d,0x152));var _0xdf66=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xf66d[_0x521929];return _0x632436;};'use strict';var Sequelize=require(_0xdf66('0x0'));module[_0xdf66('0x1')]={'penalty':{'type':Sequelize[_0xdf66('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index d43ef62..1db0cf7 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 _0xb173=['path','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','util','../../config/logger','api','request-promise'];(function(_0x369bd7,_0xcc2221){var _0x407fa4=function(_0x32f082){while(--_0x32f082){_0x369bd7['push'](_0x369bd7['shift']());}};_0x407fa4(++_0xcc2221);}(_0xb173,0x1ca));var _0x3b17=function(_0x23efe7,_0x31b333){_0x23efe7=_0x23efe7-0x0;var _0x116625=_0xb173[_0x23efe7];return _0x116625;};'use strict';var _=require('lodash');var util=require(_0x3b17('0x0'));var logger=require(_0x3b17('0x1'))(_0x3b17('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3b17('0x3'));var fs=require('fs');var path=require(_0x3b17('0x4'));var rimraf=require('rimraf');var config=require(_0x3b17('0x5'));var attributes=require(_0x3b17('0x6'));module[_0x3b17('0x7')]=function(_0x4f18bb,_0x1002c7){return _0x4f18bb[_0x3b17('0x8')](_0x3b17('0x9'),attributes,{'tableName':_0x3b17('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x674c=['UserMailQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./userMailQueue.attributes','define'];(function(_0x1d211b,_0x475f3b){var _0x47c88b=function(_0x3126f5){while(--_0x3126f5){_0x1d211b['push'](_0x1d211b['shift']());}};_0x47c88b(++_0x475f3b);}(_0x674c,0x18d));var _0xc674=function(_0x567405,_0x1b1e2e){_0x567405=_0x567405-0x0;var _0x6bcb6d=_0x674c[_0x567405];return _0x6bcb6d;};'use strict';var _=require(_0xc674('0x0'));var util=require(_0xc674('0x1'));var logger=require(_0xc674('0x2'))(_0xc674('0x3'));var moment=require(_0xc674('0x4'));var BPromise=require(_0xc674('0x5'));var rp=require(_0xc674('0x6'));var fs=require('fs');var path=require(_0xc674('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc674('0x8'));module['exports']=function(_0x58f385,_0x52c62a){return _0x58f385[_0xc674('0x9')](_0xc674('0xa'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 20a595b..619acef 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 _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x372335,_0x33505f){var _0xb50e7=function(_0x52a332){while(--_0x52a332){_0x372335['push'](_0x372335['shift']());}};_0xb50e7(++_0x33505f);}(_0x6aa7,0x178));var _0x76aa=function(_0x37dae6,_0x52ad16){_0x37dae6=_0x37dae6-0x0;var _0x4c2c33=_0x6aa7[_0x37dae6];return _0x4c2c33;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});} \ No newline at end of file +var _0x5fc3=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','UserMailQueue,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x46843d,_0x3005cc){var _0x46a75e=function(_0x167fc8){while(--_0x167fc8){_0x46843d['push'](_0x46843d['shift']());}};_0x46a75e(++_0x3005cc);}(_0x5fc3,0xa8));var _0x35fc=function(_0x15797a,_0x16274f){_0x15797a=_0x15797a-0x0;var _0x3e2618=_0x5fc3[_0x15797a];return _0x3e2618;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('UserMailQueue,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('UserMailQueue,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index cecaaf8..7abf0e1 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 _0x5c3b=['exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./userNotification.controller','sendUserNotification'];(function(_0x325cf3,_0x844a9){var _0x32a95a=function(_0x4f13de){while(--_0x4f13de){_0x325cf3['push'](_0x325cf3['shift']());}};_0x32a95a(++_0x844a9);}(_0x5c3b,0x1a8));var _0xb5c3=function(_0x432864,_0x2bfb80){_0x432864=_0x432864-0x0;var _0x1bb0a8=_0x5c3b[_0x432864];return _0x1bb0a8;};'use strict';var multer=require(_0xb5c3('0x0'));var util=require('util');var path=require(_0xb5c3('0x1'));var timeout=require(_0xb5c3('0x2'));var express=require(_0xb5c3('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb5c3('0x4'));var config=require(_0xb5c3('0x5'));var controller=require(_0xb5c3('0x6'));router['post']('/',auth['isAuthenticated'](),controller[_0xb5c3('0x7')]);module[_0xb5c3('0x8')]=router; \ No newline at end of file +var _0x84cd=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','exports','multer','util','path','Router'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x84cd,0x1f4));var _0xd84c=function(_0x223f40,_0x4cdcb5){_0x223f40=_0x223f40-0x0;var _0x324161=_0x84cd[_0x223f40];return _0x324161;};'use strict';var multer=require(_0xd84c('0x0'));var util=require(_0xd84c('0x1'));var path=require(_0xd84c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd84c('0x3')]();var fs_extra=require(_0xd84c('0x4'));var auth=require(_0xd84c('0x5'));var interaction=require(_0xd84c('0x6'));var config=require(_0xd84c('0x7'));var controller=require(_0xd84c('0x8'));router[_0xd84c('0x9')]('/',auth[_0xd84c('0xa')](),controller['sendUserNotification']);module[_0xd84c('0xb')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 53e6d64..b4e6825 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 _0x256e=['exports','TEXT','STRING','sequelize'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x256e,0x1f3));var _0xe256=function(_0x2136de,_0x52b4b1){_0x2136de=_0x2136de-0x0;var _0x2e9cd4=_0x256e[_0x2136de];return _0x2e9cd4;};'use strict';var Sequelize=require(_0xe256('0x0'));module[_0xe256('0x1')]={'body':{'type':Sequelize[_0xe256('0x2')]},'senderName':{'type':Sequelize[_0xe256('0x3')]},'recipientsId':{'type':Sequelize[_0xe256('0x2')]},'recipientsDescription':{'type':Sequelize[_0xe256('0x3')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0x225c=['exports','STRING','TEXT','BOOLEAN'];(function(_0x51ed62,_0x574379){var _0x34aee3=function(_0x2958bc){while(--_0x2958bc){_0x51ed62['push'](_0x51ed62['shift']());}};_0x34aee3(++_0x574379);}(_0x225c,0xc4));var _0xc225=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x225c[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0xc225('0x0')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0xc225('0x1')]},'recipientsId':{'type':Sequelize[_0xc225('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0xc225('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 0555a2f..72924e9 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 _0x1130=['limit','count','set','apply','reject','then','destroy','end','error','stack','name','sendUserNotification','body','hasOwnProperty','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','ValidationError','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','team','user','some','includes','senderName','fullname','recipientsDescription','beep','recipientsId','sortBy','join','sequelize','UserNotification','create','forEach','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','catch','model','toLowerCase','User','union','queue','replace','Queue','push','all','flatten','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','redis','./userNotification.socket','register','sendStatus','status','json','offset','undefined'];(function(_0x13342f,_0x3d6303){var _0x2fc1fc=function(_0x2d991f){while(--_0x2d991f){_0x13342f['push'](_0x13342f['shift']());}};_0x2fc1fc(++_0x3d6303);}(_0x1130,0x9a));var _0x0113=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1130[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x0113('0x0'));var rimraf=require(_0x0113('0x1'));var zipdir=require(_0x0113('0x2'));var jsonpatch=require(_0x0113('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0113('0x4'));var util=require(_0x0113('0x5'));var path=require(_0x0113('0x6'));var sox=require(_0x0113('0x7'));var csv=require(_0x0113('0x8'));var ejs=require(_0x0113('0x9'));var fs=require('fs');var fs_extra=require(_0x0113('0xa'));var _=require(_0x0113('0xb'));var squel=require(_0x0113('0xc'));var crypto=require(_0x0113('0xd'));var jsforce=require(_0x0113('0xe'));var deskjs=require(_0x0113('0xf'));var toCsv=require(_0x0113('0x8'));var querystring=require('querystring');var Papa=require(_0x0113('0x10'));var Redis=require(_0x0113('0x11'));var authService=require(_0x0113('0x12'));var qs=require(_0x0113('0x13'));var as=require(_0x0113('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0113('0x15'));var licenseUtil=require(_0x0113('0x16'));var db=require(_0x0113('0x17'))['db'];config['redis']=_['defaults'](config[_0x0113('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0113('0x18')]));require(_0x0113('0x19'))[_0x0113('0x1a')](socket);function respondWithStatusCode(_0x146426,_0x2283b3){_0x2283b3=_0x2283b3||0xcc;return function(_0x74ba38){if(_0x74ba38){return _0x146426[_0x0113('0x1b')](_0x2283b3);}return _0x146426[_0x0113('0x1c')](_0x2283b3)['end']();};}function respondWithResult(_0x256448,_0x39bf0a){_0x39bf0a=_0x39bf0a||0xc8;return function(_0x85d2cb){if(_0x85d2cb){return _0x256448[_0x0113('0x1c')](_0x39bf0a)[_0x0113('0x1d')](_0x85d2cb);}};}function respondWithFilteredResult(_0xced478,_0x3a893d){return function(_0x300985){if(_0x300985){var _0x784ca6=typeof _0x3a893d[_0x0113('0x1e')]===_0x0113('0x1f')&&typeof _0x3a893d[_0x0113('0x20')]===_0x0113('0x1f');var _0x17c80d=_0x300985[_0x0113('0x21')];var _0x36b44f=_0x784ca6?0x0:_0x3a893d['offset'];var _0x292f3f=_0x784ca6?_0x300985[_0x0113('0x21')]:_0x3a893d['offset']+_0x3a893d[_0x0113('0x20')];var _0x3353d0;if(_0x292f3f>=_0x17c80d){_0x292f3f=_0x17c80d;_0x3353d0=0xc8;}else{_0x3353d0=0xce;}_0xced478[_0x0113('0x1c')](_0x3353d0);return _0xced478[_0x0113('0x22')]('Content-Range',_0x36b44f+'-'+_0x292f3f+'/'+_0x17c80d)[_0x0113('0x1d')](_0x300985);}return null;};}function patchUpdates(_0x1d3e45){return function(_0x9e30cb){try{jsonpatch[_0x0113('0x23')](_0x9e30cb,_0x1d3e45,!![]);}catch(_0x2e6114){return BPromise[_0x0113('0x24')](_0x2e6114);}return _0x9e30cb['save']();};}function saveUpdates(_0x3e12f1,_0xeb9eb0){return function(_0x38e8ce){if(_0x38e8ce){return _0x38e8ce['update'](_0x3e12f1)[_0x0113('0x25')](function(_0x1e9c17){return _0x1e9c17;});}return null;};}function removeEntity(_0x1c8aa4,_0x395c2f){return function(_0x3bddfa){if(_0x3bddfa){return _0x3bddfa[_0x0113('0x26')]()[_0x0113('0x25')](function(){_0x1c8aa4[_0x0113('0x1c')](0xcc)[_0x0113('0x27')]();});}};}function handleEntityNotFound(_0x2649e8,_0x2e4256){return function(_0x44cf33){if(!_0x44cf33){_0x2649e8['sendStatus'](0x194);}return _0x44cf33;};}function handleError(_0x49c59d,_0x2a90d7){_0x2a90d7=_0x2a90d7||0x1f4;return function(_0x4c1648){logger[_0x0113('0x28')](_0x4c1648[_0x0113('0x29')]);if(_0x4c1648['name']){delete _0x4c1648[_0x0113('0x2a')];}_0x49c59d['status'](_0x2a90d7)['send'](_0x4c1648);};}exports[_0x0113('0x2b')]=function(_0x21d401,_0x5557f9,_0x5cc0d0){if(!_0x21d401[_0x0113('0x2c')][_0x0113('0x2d')]('text')&&!_0x21d401[_0x0113('0x2c')]['hasOwnProperty'](_0x0113('0x2e'))){throw new db[(_0x0113('0x2f'))]['ValidationError'](_0x0113('0x30'));}else{if(_0x21d401[_0x0113('0x2c')][_0x0113('0x2d')]('TemplateId')&&!_0x21d401[_0x0113('0x2c')][_0x0113('0x2d')]('view')){throw new db[(_0x0113('0x2f'))][(_0x0113('0x31'))](_0x0113('0x32'));}if(!_0x21d401[_0x0113('0x2c')][_0x0113('0x2d')]('recipients')){throw new db[(_0x0113('0x2f'))][(_0x0113('0x31'))](_0x0113('0x33'));}else{try{var _0x427d23=JSON[_0x0113('0x34')](_0x21d401[_0x0113('0x2c')][_0x0113('0x35')]);}catch(_0x1023b4){logger[_0x0113('0x28')](_0x1023b4);throw new db['Sequelize'][(_0x0113('0x31'))](_0x0113('0x36'));}var _0x19e01c=[_0x0113('0x37'),_0x0113('0x38'),_0x0113('0x39'),_0x0113('0x3a'),_0x0113('0x3b'),'voicequeue','whatsappqueue',_0x0113('0x3c'),_0x0113('0x3d')];if(_[_0x0113('0x3e')](_0x427d23,function(_0x7b872f){return!_[_0x0113('0x3f')](_0x19e01c,_0x7b872f['model']['toLowerCase']());})){throw new db[(_0x0113('0x2f'))]['ValidationError']('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x4afe16={};_0x4afe16['senderName']=_0x21d401[_0x0113('0x2c')]['hasOwnProperty'](_0x0113('0x40'))?_0x21d401[_0x0113('0x2c')][_0x0113('0x40')]:_0x21d401[_0x0113('0x3d')][_0x0113('0x41')];_0x4afe16[_0x0113('0x42')]=_['isEmpty'](_0x21d401['body'][_0x0113('0x42')])?null:_0x21d401['body']['recipientsDescription'];_0x4afe16[_0x0113('0x43')]=_0x21d401[_0x0113('0x2c')][_0x0113('0x43')]||![];_0x4afe16['SenderId']=_0x21d401['user']['id'];return getContent(_0x21d401[_0x0113('0x2c')])['then'](function(_0x13b744){_0x4afe16['body']=_0x13b744;return getRecipients(_0x427d23);})['then'](function(_0x2136dd){_0x4afe16[_0x0113('0x44')]=_[_0x0113('0x45')](_0x2136dd)[_0x0113('0x46')](',');return db[_0x0113('0x47')]['transaction'](function(_0x640269){return db[_0x0113('0x48')][_0x0113('0x49')](_0x4afe16,{'raw':!![],'transaction':_0x640269})['then'](function(_0x52626a){var _0xaa1105={'sender':_0x4afe16['senderName'],'description':_0x4afe16[_0x0113('0x42')],'content':_0x4afe16[_0x0113('0x2c')],'beep':_0x4afe16[_0x0113('0x43')]};_0x2136dd[_0x0113('0x4a')](function(_0x3761c1){_0xaa1105['recipient']=_0x3761c1;socket['emit']('userNotification:send',_0xaa1105);});return _0x52626a;});});})[_0x0113('0x25')](respondWithResult(_0x5557f9,0xc9))['catch'](handleError(_0x5557f9,null));};function getContent(_0x4e8394){return new BPromise(function(_0x2fa634,_0x5d72d1){if(_0x4e8394[_0x0113('0x4b')]){_0x2fa634(_0x4e8394[_0x0113('0x4b')]);return;}return db[_0x0113('0x4c')][_0x0113('0x4d')]({'attributes':[_0x0113('0x4e')],'where':{'id':_0x4e8394[_0x0113('0x2e')]},'raw':!![]})['then'](function(_0x3f57bb){if(!_0x3f57bb)throw new db[(_0x0113('0x2f'))][(_0x0113('0x31'))](_0x0113('0x4f'));var _0x94c3bd=Mustache[_0x0113('0x50')](_0x3f57bb[_0x0113('0x4e')],_0x4e8394['view']);_0x2fa634(_0x94c3bd);})[_0x0113('0x51')](function(_0x26f672){_0x5d72d1(_0x26f672);});});}function getRecipients(_0xc46939){return new BPromise(function(_0x2d9175,_0x4bfae0){var _0xbf1be2=[];var _0xb745ab=[];_0xc46939[_0x0113('0x4a')](function(_0x374571){var _0x573d8b=_['startCase'](_0x374571[_0x0113('0x52')][_0x0113('0x53')]());if(_0x573d8b===_0x0113('0x54')){_0xbf1be2=_[_0x0113('0x55')](_0xbf1be2,_0x374571['ids']);}else{if(_['includes'](_0x573d8b,_0x0113('0x56')))_0x573d8b=_0x573d8b[_0x0113('0x57')](_0x0113('0x56'),_0x0113('0x58'));_0x374571['ids'][_0x0113('0x4a')](function(_0x25aa98){_0xb745ab[_0x0113('0x59')](getAgents(_0x573d8b,_0x25aa98));});}});return BPromise[_0x0113('0x5a')](_0xb745ab)[_0x0113('0x25')](function(_0x2958ab){_0xbf1be2=_[_0x0113('0x55')](_0xbf1be2,_[_0x0113('0x5b')](_0x2958ab));_0x2d9175(_0xbf1be2);})['catch'](function(_0x8441ce){_0x4bfae0(_0x8441ce);});});}function getAgents(_0x51b312,_0x2bb133){return new BPromise(function(_0x40dd95,_0x52b133){return db[_0x51b312][_0x0113('0x4d')]({'where':{'id':_0x2bb133}})['then'](function(_0x3885b9){return _0x3885b9[_0x0113('0x5c')]({'attributes':['id'],'raw':!![]})['then'](function(_0x58a404){var _0x500056=_['map'](_0x58a404,'id');_0x40dd95(_0x500056);});})[_0x0113('0x51')](function(_0x233f86){_0x52b133(_0x233f86);});});} \ No newline at end of file +var _0x794d=['error','stack','name','sendUserNotification','body','hasOwnProperty','TemplateId','Sequelize','ValidationError','view','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','parse','chatqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','SenderId','recipientsId','sortBy','join','sequelize','transaction','create','beep','recipient','emit','userNotification:send','catch','text','html','Invalid\x20\x27TemplateId\x27\x20parameter','forEach','union','ids','includes','replace','queue','Queue','push','all','flatten','findOne','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','./userNotification.socket','register','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy'];(function(_0x3e8c4d,_0x18d01a){var _0x205fb5=function(_0x26ff7d){while(--_0x26ff7d){_0x3e8c4d['push'](_0x3e8c4d['shift']());}};_0x205fb5(++_0x18d01a);}(_0x794d,0x98));var _0xd794=function(_0x1be35b,_0xa49780){_0x1be35b=_0x1be35b-0x0;var _0xd22f6=_0x794d[_0x1be35b];return _0xd22f6;};'use strict';var emlformat=require(_0xd794('0x0'));var rimraf=require(_0xd794('0x1'));var zipdir=require(_0xd794('0x2'));var jsonpatch=require(_0xd794('0x3'));var rp=require(_0xd794('0x4'));var moment=require('moment');var BPromise=require(_0xd794('0x5'));var Mustache=require('mustache');var util=require(_0xd794('0x6'));var path=require(_0xd794('0x7'));var sox=require(_0xd794('0x8'));var csv=require(_0xd794('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd794('0xa'));var squel=require(_0xd794('0xb'));var crypto=require(_0xd794('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd794('0xd'));var Papa=require('papaparse');var Redis=require(_0xd794('0xe'));var authService=require(_0xd794('0xf'));var qs=require(_0xd794('0x10'));var as=require(_0xd794('0x11'));var hardwareService=require(_0xd794('0x12'));var logger=require(_0xd794('0x13'))('api');var utils=require(_0xd794('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd794('0x15'))['db'];config[_0xd794('0x16')]=_[_0xd794('0x17')](config[_0xd794('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd794('0x16')]));require(_0xd794('0x18'))[_0xd794('0x19')](socket);function respondWithStatusCode(_0x1166cf,_0x17993d){_0x17993d=_0x17993d||0xcc;return function(_0x207073){if(_0x207073){return _0x1166cf['sendStatus'](_0x17993d);}return _0x1166cf[_0xd794('0x1a')](_0x17993d)[_0xd794('0x1b')]();};}function respondWithResult(_0x51177d,_0x2c16b9){_0x2c16b9=_0x2c16b9||0xc8;return function(_0x1dc0a4){if(_0x1dc0a4){return _0x51177d[_0xd794('0x1a')](_0x2c16b9)['json'](_0x1dc0a4);}};}function respondWithFilteredResult(_0x120f06,_0xcf161a){return function(_0x5656c5){if(_0x5656c5){var _0x57849a=typeof _0xcf161a[_0xd794('0x1c')]===_0xd794('0x1d')&&typeof _0xcf161a[_0xd794('0x1e')]===_0xd794('0x1d');var _0x29409c=_0x5656c5[_0xd794('0x1f')];var _0x5d3fcd=_0x57849a?0x0:_0xcf161a[_0xd794('0x1c')];var _0x1b00f4=_0x57849a?_0x5656c5[_0xd794('0x1f')]:_0xcf161a['offset']+_0xcf161a['limit'];var _0x5ef5b1;if(_0x1b00f4>=_0x29409c){_0x1b00f4=_0x29409c;_0x5ef5b1=0xc8;}else{_0x5ef5b1=0xce;}_0x120f06['status'](_0x5ef5b1);return _0x120f06[_0xd794('0x20')](_0xd794('0x21'),_0x5d3fcd+'-'+_0x1b00f4+'/'+_0x29409c)[_0xd794('0x22')](_0x5656c5);}return null;};}function patchUpdates(_0x1086ad){return function(_0x2febba){try{jsonpatch[_0xd794('0x23')](_0x2febba,_0x1086ad,!![]);}catch(_0xaa3d3a){return BPromise[_0xd794('0x24')](_0xaa3d3a);}return _0x2febba['save']();};}function saveUpdates(_0x2b9f8d,_0x3bad75){return function(_0x17dd32){if(_0x17dd32){return _0x17dd32[_0xd794('0x25')](_0x2b9f8d)[_0xd794('0x26')](function(_0x10037f){return _0x10037f;});}return null;};}function removeEntity(_0x4f29fa,_0x37daa0){return function(_0x21e486){if(_0x21e486){return _0x21e486[_0xd794('0x27')]()[_0xd794('0x26')](function(){_0x4f29fa[_0xd794('0x1a')](0xcc)[_0xd794('0x1b')]();});}};}function handleEntityNotFound(_0x5a5dfc,_0x19c1a9){return function(_0x2261de){if(!_0x2261de){_0x5a5dfc['sendStatus'](0x194);}return _0x2261de;};}function handleError(_0x48b2f6,_0x16cc82){_0x16cc82=_0x16cc82||0x1f4;return function(_0x3a34fb){logger[_0xd794('0x28')](_0x3a34fb[_0xd794('0x29')]);if(_0x3a34fb[_0xd794('0x2a')]){delete _0x3a34fb[_0xd794('0x2a')];}_0x48b2f6[_0xd794('0x1a')](_0x16cc82)['send'](_0x3a34fb);};}exports[_0xd794('0x2b')]=function(_0x2811af,_0x55b1fd,_0x142fb9){if(!_0x2811af[_0xd794('0x2c')][_0xd794('0x2d')]('text')&&!_0x2811af['body'][_0xd794('0x2d')](_0xd794('0x2e'))){throw new db[(_0xd794('0x2f'))][(_0xd794('0x30'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x2811af[_0xd794('0x2c')][_0xd794('0x2d')]('TemplateId')&&!_0x2811af[_0xd794('0x2c')][_0xd794('0x2d')](_0xd794('0x31'))){throw new db[(_0xd794('0x2f'))]['ValidationError'](_0xd794('0x32'));}if(!_0x2811af[_0xd794('0x2c')][_0xd794('0x2d')]('recipients')){throw new db[(_0xd794('0x2f'))][(_0xd794('0x30'))](_0xd794('0x33'));}else{try{var _0x246cf7=JSON[_0xd794('0x34')](_0x2811af['body']['recipients']);}catch(_0x11dd68){logger[_0xd794('0x28')](_0x11dd68);throw new db[(_0xd794('0x2f'))][(_0xd794('0x30'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x580905=[_0xd794('0x35'),'faxqueue',_0xd794('0x36'),_0xd794('0x37'),_0xd794('0x38'),_0xd794('0x39'),_0xd794('0x3a'),_0xd794('0x3b'),_0xd794('0x3c')];if(_['some'](_0x246cf7,function(_0x1f9c7d){return!_['includes'](_0x580905,_0x1f9c7d[_0xd794('0x3d')][_0xd794('0x3e')]());})){throw new db[(_0xd794('0x2f'))]['ValidationError'](_0xd794('0x3f'));}}}var _0xff73a={};_0xff73a[_0xd794('0x40')]=_0x2811af[_0xd794('0x2c')][_0xd794('0x2d')]('senderName')?_0x2811af[_0xd794('0x2c')][_0xd794('0x40')]:_0x2811af[_0xd794('0x3c')][_0xd794('0x41')];_0xff73a[_0xd794('0x42')]=_[_0xd794('0x43')](_0x2811af[_0xd794('0x2c')][_0xd794('0x42')])?null:_0x2811af[_0xd794('0x2c')][_0xd794('0x42')];_0xff73a['beep']=_0x2811af[_0xd794('0x2c')]['beep']||![];_0xff73a[_0xd794('0x44')]=_0x2811af[_0xd794('0x3c')]['id'];return getContent(_0x2811af['body'])['then'](function(_0x10fdc9){_0xff73a['body']=_0x10fdc9;return getRecipients(_0x246cf7);})[_0xd794('0x26')](function(_0x10a4d6){_0xff73a[_0xd794('0x45')]=_[_0xd794('0x46')](_0x10a4d6)[_0xd794('0x47')](',');return db[_0xd794('0x48')][_0xd794('0x49')](function(_0x15e018){return db['UserNotification'][_0xd794('0x4a')](_0xff73a,{'raw':!![],'transaction':_0x15e018})[_0xd794('0x26')](function(_0x18f719){var _0x1730f0={'sender':_0xff73a[_0xd794('0x40')],'description':_0xff73a[_0xd794('0x42')],'content':_0xff73a[_0xd794('0x2c')],'beep':_0xff73a[_0xd794('0x4b')]};_0x10a4d6['forEach'](function(_0x59b5de){_0x1730f0[_0xd794('0x4c')]=_0x59b5de;socket[_0xd794('0x4d')](_0xd794('0x4e'),_0x1730f0);});return _0x18f719;});});})['then'](respondWithResult(_0x55b1fd,0xc9))[_0xd794('0x4f')](handleError(_0x55b1fd,null));};function getContent(_0x91f029){return new BPromise(function(_0x362014,_0x105f5b){if(_0x91f029[_0xd794('0x50')]){_0x362014(_0x91f029[_0xd794('0x50')]);return;}return db['Template']['findOne']({'attributes':[_0xd794('0x51')],'where':{'id':_0x91f029[_0xd794('0x2e')]},'raw':!![]})[_0xd794('0x26')](function(_0x544c59){if(!_0x544c59)throw new db[(_0xd794('0x2f'))][(_0xd794('0x30'))](_0xd794('0x52'));var _0x17dd6e=Mustache['render'](_0x544c59['html'],_0x91f029[_0xd794('0x31')]);_0x362014(_0x17dd6e);})[_0xd794('0x4f')](function(_0x54c154){_0x105f5b(_0x54c154);});});}function getRecipients(_0x2c11ee){return new BPromise(function(_0x46354f,_0x1acf6e){var _0xc6889d=[];var _0x5acfb4=[];_0x2c11ee[_0xd794('0x53')](function(_0x1114dc){var _0xd7ac8c=_['startCase'](_0x1114dc[_0xd794('0x3d')][_0xd794('0x3e')]());if(_0xd7ac8c==='User'){_0xc6889d=_[_0xd794('0x54')](_0xc6889d,_0x1114dc[_0xd794('0x55')]);}else{if(_[_0xd794('0x56')](_0xd7ac8c,'queue'))_0xd7ac8c=_0xd7ac8c[_0xd794('0x57')](_0xd794('0x58'),_0xd794('0x59'));_0x1114dc[_0xd794('0x55')]['forEach'](function(_0x502708){_0x5acfb4[_0xd794('0x5a')](getAgents(_0xd7ac8c,_0x502708));});}});return BPromise[_0xd794('0x5b')](_0x5acfb4)[_0xd794('0x26')](function(_0x5a9fc6){_0xc6889d=_[_0xd794('0x54')](_0xc6889d,_[_0xd794('0x5c')](_0x5a9fc6));_0x46354f(_0xc6889d);})['catch'](function(_0x5ac5d4){_0x1acf6e(_0x5ac5d4);});});}function getAgents(_0x4bf1c3,_0x13d7e5){return new BPromise(function(_0x40d250,_0x5e4cfc){return db[_0x4bf1c3][_0xd794('0x5d')]({'where':{'id':_0x13d7e5}})[_0xd794('0x26')](function(_0x4d4511){return _0x4d4511[_0xd794('0x5e')]({'attributes':['id'],'raw':!![]})[_0xd794('0x26')](function(_0x45e7e2){var _0x27eb89=_[_0xd794('0x5f')](_0x45e7e2,'id');_0x40d250(_0x27eb89);});})['catch'](function(_0x4d27a8){_0x5e4cfc(_0x4d27a8);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 96b0d3f..16cde4b 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 _0xd4df=['../../mysqldb','setMaxListeners','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x55c979,_0x36c5f0){var _0x690107=function(_0xa61dad){while(--_0xa61dad){_0x55c979['push'](_0x55c979['shift']());}};_0x690107(++_0x36c5f0);}(_0xd4df,0xcf));var _0xfd4d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd4df[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xfd4d('0x0'));var UserNotification=require(_0xfd4d('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xfd4d('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfd4d('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4cf3cc){return function(_0x5a042b,_0xaa2b2c,_0x2a7771){UserNotificationEvents[_0xfd4d('0x4')](_0x4cf3cc+':'+_0x5a042b['id'],_0x5a042b);UserNotificationEvents[_0xfd4d('0x4')](_0x4cf3cc,_0x5a042b);_0x2a7771(null);};}for(var e in events){if(events[_0xfd4d('0x5')](e)){var event=events[e];UserNotification[_0xfd4d('0x6')](e,emitEvent(event));}}module[_0xfd4d('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0x6dd4=['remove','hasOwnProperty','hook','exports','../../mysqldb','UserNotification','setMaxListeners','update'];(function(_0x1f2b34,_0x55eb12){var _0x5362f3=function(_0x521b64){while(--_0x521b64){_0x1f2b34['push'](_0x1f2b34['shift']());}};_0x5362f3(++_0x55eb12);}(_0x6dd4,0xb4));var _0x46dd=function(_0x2e2e5f,_0x4c387b){_0x2e2e5f=_0x2e2e5f-0x0;var _0x37df9a=_0x6dd4[_0x2e2e5f];return _0x37df9a;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x46dd('0x0'))['db'][_0x46dd('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x46dd('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x46dd('0x3'),'afterDestroy':_0x46dd('0x4')};function emitEvent(_0x1875fe){return function(_0x5791a8,_0x15f9d2,_0x476547){UserNotificationEvents['emit'](_0x1875fe+':'+_0x5791a8['id'],_0x5791a8);UserNotificationEvents['emit'](_0x1875fe,_0x5791a8);_0x476547(null);};}for(var e in events){if(events[_0x46dd('0x5')](e)){var event=events[e];UserNotification[_0x46dd('0x6')](e,emitEvent(event));}}module[_0x46dd('0x7')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 7968ca7..5d20829 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 _0x1546=['../../config/logger','request-promise','path','rimraf','../../config/environment','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x1546,0x18b));var _0x6154=function(_0x4e44bf,_0x199c3c){_0x4e44bf=_0x4e44bf-0x0;var _0xdc97f9=_0x1546[_0x4e44bf];return _0xdc97f9;};'use strict';var _=require('lodash');var util=require(_0x6154('0x0'));var logger=require(_0x6154('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6154('0x2'));var fs=require('fs');var path=require(_0x6154('0x3'));var rimraf=require(_0x6154('0x4'));var config=require(_0x6154('0x5'));var attributes=require('./userNotification.attributes');module['exports']=function(_0x37082f,_0xcf55bb){return _0x37082f[_0x6154('0x6')](_0x6154('0x7'),attributes,{'tableName':_0x6154('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6154('0x9'),'collate':_0x6154('0xa')});}; \ No newline at end of file +var _0xdb00=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','define','UserNotification','userNotifications','utf8mb4','util','../../config/logger','api'];(function(_0x50d4df,_0x26c472){var _0x593f76=function(_0x541b36){while(--_0x541b36){_0x50d4df['push'](_0x50d4df['shift']());}};_0x593f76(++_0x26c472);}(_0xdb00,0x1bd));var _0x0db0=function(_0x1e2080,_0x53283b){_0x1e2080=_0x1e2080-0x0;var _0x260111=_0xdb00[_0x1e2080];return _0x260111;};'use strict';var _=require('lodash');var util=require(_0x0db0('0x0'));var logger=require(_0x0db0('0x1'))(_0x0db0('0x2'));var moment=require(_0x0db0('0x3'));var BPromise=require(_0x0db0('0x4'));var rp=require(_0x0db0('0x5'));var fs=require('fs');var path=require(_0x0db0('0x6'));var rimraf=require(_0x0db0('0x7'));var config=require(_0x0db0('0x8'));var attributes=require(_0x0db0('0x9'));module['exports']=function(_0x5207d4,_0x21d49c){return _0x5207d4[_0x0db0('0xa')](_0x0db0('0xb'),attributes,{'tableName':_0x0db0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0db0('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index b45fe1a..2c52dfb 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 _0x2dd4=['stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s'];(function(_0x438a4b,_0x27af12){var _0x3ac5de=function(_0x5416f6){while(--_0x5416f6){_0x438a4b['push'](_0x438a4b['shift']());}};_0x3ac5de(++_0x27af12);}(_0x2dd4,0xf5));var _0x42dd=function(_0x103a4b,_0x3f35f4){_0x103a4b=_0x103a4b-0x0;var _0x32a502=_0x2dd4[_0x103a4b];return _0x32a502;};'use strict';var _=require(_0x42dd('0x0'));var util=require(_0x42dd('0x1'));var moment=require(_0x42dd('0x2'));var BPromise=require(_0x42dd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x42dd('0x4'));var db=require(_0x42dd('0x5'))['db'];var utils=require(_0x42dd('0x6'));var logger=require(_0x42dd('0x7'))(_0x42dd('0x8'));var config=require(_0x42dd('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x42dd('0xa')][_0x42dd('0xb')]({'port':0x232a});config[_0x42dd('0xc')]=_[_0x42dd('0xd')](config['redis'],{'host':_0x42dd('0xe'),'port':0x18eb});var socket=require(_0x42dd('0xf'))(new Redis(config['redis']));require(_0x42dd('0x10'))[_0x42dd('0x11')](socket);function respondWithRpcPromise(_0x476ff5,_0x4cb136,_0x486e6c){return new BPromise(function(_0x5d8567,_0x467d3d){return client[_0x42dd('0x12')](_0x476ff5,_0x486e6c)[_0x42dd('0x13')](function(_0x43dcb4){logger[_0x42dd('0x14')](_0x42dd('0x15'),_0x4cb136,_0x42dd('0x16'));logger[_0x42dd('0x17')](_0x42dd('0x18'),_0x4cb136,'request\x20sent',JSON[_0x42dd('0x19')](_0x43dcb4));if(_0x43dcb4[_0x42dd('0x1a')]){if(_0x43dcb4[_0x42dd('0x1a')]['code']===0x1f4){logger[_0x42dd('0x1a')](_0x42dd('0x15'),_0x4cb136,_0x43dcb4[_0x42dd('0x1a')][_0x42dd('0x1b')]);return _0x467d3d(_0x43dcb4[_0x42dd('0x1a')][_0x42dd('0x1b')]);}logger[_0x42dd('0x1a')]('UserNotification,\x20%s,\x20%s',_0x4cb136,_0x43dcb4['error'][_0x42dd('0x1b')]);return _0x5d8567(_0x43dcb4[_0x42dd('0x1a')]['message']);}else{logger[_0x42dd('0x14')](_0x42dd('0x15'),_0x4cb136,_0x42dd('0x16'));_0x5d8567(_0x43dcb4[_0x42dd('0x1c')][_0x42dd('0x1b')]);}})[_0x42dd('0x1d')](function(_0x2102a8){logger[_0x42dd('0x1a')]('UserNotification,\x20%s,\x20%s',_0x4cb136,_0x2102a8);_0x467d3d(_0x2102a8);});});} \ No newline at end of file +var _0x9840=['redis','localhost','socket.io-emitter','./userNotification.socket','register','then','info','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserNotification,\x20%s,\x20%s','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http'];(function(_0x47a5bd,_0x508329){var _0x5c2184=function(_0x40ddea){while(--_0x40ddea){_0x47a5bd['push'](_0x47a5bd['shift']());}};_0x5c2184(++_0x508329);}(_0x9840,0x162));var _0x0984=function(_0x564a0f,_0xf06b6e){_0x564a0f=_0x564a0f-0x0;var _0x25f42e=_0x9840[_0x564a0f];return _0x25f42e;};'use strict';var _=require(_0x0984('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0984('0x1'));var rs=require(_0x0984('0x2'));var fs=require('fs');var Redis=require(_0x0984('0x3'));var db=require(_0x0984('0x4'))['db'];var utils=require(_0x0984('0x5'));var logger=require('../../config/logger')(_0x0984('0x6'));var config=require(_0x0984('0x7'));var jayson=require(_0x0984('0x8'));var client=jayson['client'][_0x0984('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x0984('0xa')],{'host':_0x0984('0xb'),'port':0x18eb});var socket=require(_0x0984('0xc'))(new Redis(config[_0x0984('0xa')]));require(_0x0984('0xd'))[_0x0984('0xe')](socket);function respondWithRpcPromise(_0x3b335b,_0x4f1526,_0x5b9c6b){return new BPromise(function(_0x432330,_0x3266c0){return client['request'](_0x3b335b,_0x5b9c6b)[_0x0984('0xf')](function(_0xa3a2c8){logger[_0x0984('0x10')]('UserNotification,\x20%s,\x20%s',_0x4f1526,_0x0984('0x11'));logger[_0x0984('0x12')](_0x0984('0x13'),_0x4f1526,_0x0984('0x11'),JSON[_0x0984('0x14')](_0xa3a2c8));if(_0xa3a2c8[_0x0984('0x15')]){if(_0xa3a2c8['error'][_0x0984('0x16')]===0x1f4){logger[_0x0984('0x15')]('UserNotification,\x20%s,\x20%s',_0x4f1526,_0xa3a2c8[_0x0984('0x15')][_0x0984('0x17')]);return _0x3266c0(_0xa3a2c8['error']['message']);}logger['error']('UserNotification,\x20%s,\x20%s',_0x4f1526,_0xa3a2c8[_0x0984('0x15')]['message']);return _0x432330(_0xa3a2c8[_0x0984('0x15')]['message']);}else{logger[_0x0984('0x10')](_0x0984('0x18'),_0x4f1526,_0x0984('0x11'));_0x432330(_0xa3a2c8[_0x0984('0x19')][_0x0984('0x17')]);}})['catch'](function(_0x454ec5){logger['error'](_0x0984('0x18'),_0x4f1526,_0x454ec5);_0x3266c0(_0x454ec5);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 03068ff..9ab686b 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 _0xadda=['userNotification:','save','removeListener'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0xadda,0xb5));var _0xaadd=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xadda[_0xb0f7c3];return _0x28ea68;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0xaadd('0x0'),'remove','update'];function createListener(_0x45b1f9,_0x1971e5){return function(_0x1231b1){_0x1971e5['emit'](_0x45b1f9,_0x1231b1);};}function removeListener(_0x15839e,_0x1bac62){return function(){UserNotificationEvents[_0xaadd('0x1')](_0x15839e,_0x1bac62);};}exports['register']=function(_0x2438dd){for(var _0xc8cb19=0x0,_0x1cb627=events['length'];_0xc8cb19<_0x1cb627;_0xc8cb19++){var _0x62229c=events[_0xc8cb19];var _0x22388b=createListener(_0xaadd('0x2')+_0x62229c,_0x2438dd);UserNotificationEvents['on'](_0x62229c,_0x22388b);}}; \ No newline at end of file +var _0x48b9=['./userNotification.events','save','remove','emit','removeListener','register','userNotification:'];(function(_0x39b68b,_0x4ad96d){var _0xae091f=function(_0x13b5e1){while(--_0x13b5e1){_0x39b68b['push'](_0x39b68b['shift']());}};_0xae091f(++_0x4ad96d);}(_0x48b9,0x173));var _0x948b=function(_0x3f5bf5,_0x498786){_0x3f5bf5=_0x3f5bf5-0x0;var _0x59e229=_0x48b9[_0x3f5bf5];return _0x59e229;};'use strict';var UserNotificationEvents=require(_0x948b('0x0'));var events=[_0x948b('0x1'),_0x948b('0x2'),'update'];function createListener(_0x5c3308,_0xb0754c){return function(_0x105b6c){_0xb0754c[_0x948b('0x3')](_0x5c3308,_0x105b6c);};}function removeListener(_0x15f0d5,_0x2eeec9){return function(){UserNotificationEvents[_0x948b('0x4')](_0x15f0d5,_0x2eeec9);};}exports[_0x948b('0x5')]=function(_0x2e8aab){for(var _0x35ee9d=0x0,_0x383238=events['length'];_0x35ee9d<_0x383238;_0x35ee9d++){var _0xbf19d7=events[_0x35ee9d];var _0xef6127=createListener(_0x948b('0x6')+_0xbf19d7,_0x2e8aab);UserNotificationEvents['on'](_0xbf19d7,_0xef6127);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index c2b68e7..a4fd3dc 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x305111,_0x4cb267){var _0x40c017=function(_0xae2039){while(--_0xae2039){_0x305111['push'](_0x305111['shift']());}};_0x40c017(++_0x4cb267);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x32b30c,_0x2d5ec8){_0x32b30c=_0x32b30c-0x0;var _0xcfc212=_0xcb91[_0x32b30c];return _0xcfc212;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x58910b,_0x540685){var _0xfe1259=function(_0x41e447){while(--_0x41e447){_0x58910b['push'](_0x58910b['shift']());}};_0xfe1259(++_0x540685);}(_0x9c44,0x178));var _0x49c4=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9c44[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index e519260..d644cfb 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 _0xf03c=['exports','INTEGER','sequelize'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0xf03c,0x1eb));var _0xcf03=function(_0x12c76e,_0x51d0e8){_0x12c76e=_0x12c76e-0x0;var _0x319e9e=_0xf03c[_0x12c76e];return _0x319e9e;};'use strict';var Sequelize=require(_0xcf03('0x0'));module[_0xcf03('0x1')]={'penalty':{'type':Sequelize[_0xcf03('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8ead=['INTEGER','sequelize','exports'];(function(_0x1c8085,_0x1d5d5b){var _0x5ab7b4=function(_0x5a6072){while(--_0x5a6072){_0x1c8085['push'](_0x1c8085['shift']());}};_0x5ab7b4(++_0x1d5d5b);}(_0x8ead,0xc4));var _0xd8ea=function(_0x29d2ef,_0x3ded40){_0x29d2ef=_0x29d2ef-0x0;var _0x351b4b=_0x8ead[_0x29d2ef];return _0x351b4b;};'use strict';var Sequelize=require(_0xd8ea('0x0'));module[_0xd8ea('0x1')]={'penalty':{'type':Sequelize[_0xd8ea('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 8d66ed4..13743ea 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 _0xe789=['request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','../../config/logger','bluebird'];(function(_0x4f04e8,_0x5e3c43){var _0x20c11d=function(_0x1bb27d){while(--_0x1bb27d){_0x4f04e8['push'](_0x4f04e8['shift']());}};_0x20c11d(++_0x5e3c43);}(_0xe789,0x94));var _0x9e78=function(_0x5cdbb6,_0x2d3415){_0x5cdbb6=_0x5cdbb6-0x0;var _0x5c66ba=_0xe789[_0x5cdbb6];return _0x5c66ba;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9e78('0x0'))('api');var moment=require('moment');var BPromise=require(_0x9e78('0x1'));var rp=require(_0x9e78('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9e78('0x3'));var config=require(_0x9e78('0x4'));var attributes=require(_0x9e78('0x5'));module[_0x9e78('0x6')]=function(_0x207cb1,_0xccb9d2){return _0x207cb1[_0x9e78('0x7')](_0x9e78('0x8'),attributes,{'tableName':_0x9e78('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x33ff=['user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','define'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x33ff,0x1d5));var _0xf33f=function(_0x294f3d,_0x1b0f82){_0x294f3d=_0x294f3d-0x0;var _0x2c8f6c=_0x33ff[_0x294f3d];return _0x2c8f6c;};'use strict';var _=require(_0xf33f('0x0'));var util=require(_0xf33f('0x1'));var logger=require(_0xf33f('0x2'))(_0xf33f('0x3'));var moment=require(_0xf33f('0x4'));var BPromise=require('bluebird');var rp=require(_0xf33f('0x5'));var fs=require('fs');var path=require(_0xf33f('0x6'));var rimraf=require(_0xf33f('0x7'));var config=require(_0xf33f('0x8'));var attributes=require(_0xf33f('0x9'));module['exports']=function(_0x34cdc7,_0x209607){return _0x34cdc7[_0xf33f('0xa')]('UserOpenchannelQueue',attributes,{'tableName':_0xf33f('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 be51080..0244004 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 _0x7ea2=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','lodash'];(function(_0x3e105f,_0x19ee12){var _0x53844d=function(_0x1e7db9){while(--_0x1e7db9){_0x3e105f['push'](_0x3e105f['shift']());}};_0x53844d(++_0x19ee12);}(_0x7ea2,0x1e3));var _0x27ea=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0x7ea2[_0x17406a];return _0x1501ff;};'use strict';var _=require(_0x27ea('0x0'));var util=require(_0x27ea('0x1'));var moment=require(_0x27ea('0x2'));var BPromise=require(_0x27ea('0x3'));var rs=require(_0x27ea('0x4'));var fs=require('fs');var Redis=require(_0x27ea('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x27ea('0x6'));var logger=require(_0x27ea('0x7'))(_0x27ea('0x8'));var config=require(_0x27ea('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x27ea('0xa')][_0x27ea('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a0931,_0x34de90,_0x58f8e9){return new BPromise(function(_0x2354ec,_0x3a869e){return client[_0x27ea('0xc')](_0x5a0931,_0x58f8e9)[_0x27ea('0xd')](function(_0x40e26f){logger[_0x27ea('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x34de90,_0x27ea('0xf'));logger[_0x27ea('0x10')](_0x27ea('0x11'),_0x34de90,'request\x20sent',JSON['stringify'](_0x40e26f));if(_0x40e26f[_0x27ea('0x12')]){if(_0x40e26f[_0x27ea('0x12')][_0x27ea('0x13')]===0x1f4){logger[_0x27ea('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x34de90,_0x40e26f['error']['message']);return _0x3a869e(_0x40e26f[_0x27ea('0x12')]['message']);}logger['error'](_0x27ea('0x14'),_0x34de90,_0x40e26f[_0x27ea('0x12')][_0x27ea('0x15')]);return _0x2354ec(_0x40e26f[_0x27ea('0x12')][_0x27ea('0x15')]);}else{logger[_0x27ea('0xe')](_0x27ea('0x14'),_0x34de90,_0x27ea('0xf'));_0x2354ec(_0x40e26f['result'][_0x27ea('0x15')]);}})['catch'](function(_0x19195c){logger[_0x27ea('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x34de90,_0x19195c);_0x3a869e(_0x19195c);});});} \ No newline at end of file +var _0xf361=['ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','util','moment','bluebird'];(function(_0x503306,_0x356f2f){var _0x44a99d=function(_0x1a6ec4){while(--_0x1a6ec4){_0x503306['push'](_0x503306['shift']());}};_0x44a99d(++_0x356f2f);}(_0xf361,0x1e0));var _0x1f36=function(_0x235d89,_0x415fb9){_0x235d89=_0x235d89-0x0;var _0x451dd9=_0xf361[_0x235d89];return _0x451dd9;};'use strict';var _=require(_0x1f36('0x0'));var util=require(_0x1f36('0x1'));var moment=require(_0x1f36('0x2'));var BPromise=require(_0x1f36('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1f36('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1f36('0x5'));var logger=require(_0x1f36('0x6'))(_0x1f36('0x7'));var config=require('../../config/environment');var jayson=require(_0x1f36('0x8'));var client=jayson[_0x1f36('0x9')][_0x1f36('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x152d84,_0x3d6d78,_0x6dc5fb){return new BPromise(function(_0x493d29,_0x1c7c52){return client[_0x1f36('0xb')](_0x152d84,_0x6dc5fb)[_0x1f36('0xc')](function(_0x3c747f){logger['info'](_0x1f36('0xd'),_0x3d6d78,_0x1f36('0xe'));logger[_0x1f36('0xf')](_0x1f36('0x10'),_0x3d6d78,'request\x20sent',JSON[_0x1f36('0x11')](_0x3c747f));if(_0x3c747f['error']){if(_0x3c747f[_0x1f36('0x12')][_0x1f36('0x13')]===0x1f4){logger[_0x1f36('0x12')](_0x1f36('0xd'),_0x3d6d78,_0x3c747f[_0x1f36('0x12')][_0x1f36('0x14')]);return _0x1c7c52(_0x3c747f[_0x1f36('0x12')][_0x1f36('0x14')]);}logger['error'](_0x1f36('0xd'),_0x3d6d78,_0x3c747f[_0x1f36('0x12')][_0x1f36('0x14')]);return _0x493d29(_0x3c747f['error'][_0x1f36('0x14')]);}else{logger[_0x1f36('0x15')](_0x1f36('0xd'),_0x3d6d78,_0x1f36('0xe'));_0x493d29(_0x3c747f['result'][_0x1f36('0x14')]);}})['catch'](function(_0x4c73d6){logger[_0x1f36('0x12')](_0x1f36('0xd'),_0x3d6d78,_0x4c73d6);_0x1c7c52(_0x4c73d6);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index f579180..0ff804e 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 _0x02da=['/:id/clone','clone','addResources','update','delete','destroy','removeSections','removeResources','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','/describe','describe','/:id','/:id/sections','getSections','/:id/resources','getResources','post'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x02da,0xc6));var _0xa02d=function(_0x2f14c7,_0x3e7de0){_0x2f14c7=_0x2f14c7-0x0;var _0x4a416f=_0x02da[_0x2f14c7];return _0x4a416f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa02d('0x0'));var timeout=require(_0xa02d('0x1'));var express=require(_0xa02d('0x2'));var router=express[_0xa02d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa02d('0x4'));var interaction=require(_0xa02d('0x5'));var config=require(_0xa02d('0x6'));var controller=require(_0xa02d('0x7'));router[_0xa02d('0x8')]('/',auth[_0xa02d('0x9')](),controller['index']);router[_0xa02d('0x8')](_0xa02d('0xa'),auth[_0xa02d('0x9')](),controller[_0xa02d('0xb')]);router['get'](_0xa02d('0xc'),auth[_0xa02d('0x9')](),controller['show']);router[_0xa02d('0x8')](_0xa02d('0xd'),auth['isAuthenticated'](),controller[_0xa02d('0xe')]);router[_0xa02d('0x8')](_0xa02d('0xf'),auth[_0xa02d('0x9')](),controller[_0xa02d('0x10')]);router[_0xa02d('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa02d('0x11')](_0xa02d('0x12'),auth[_0xa02d('0x9')](),controller[_0xa02d('0x13')]);router[_0xa02d('0x11')](_0xa02d('0xd'),auth[_0xa02d('0x9')](),controller['addSections']);router[_0xa02d('0x11')](_0xa02d('0xf'),auth[_0xa02d('0x9')](),controller[_0xa02d('0x14')]);router['put'](_0xa02d('0xc'),auth[_0xa02d('0x9')](),controller[_0xa02d('0x15')]);router[_0xa02d('0x16')]('/:id',auth[_0xa02d('0x9')](),controller[_0xa02d('0x17')]);router['delete'](_0xa02d('0xd'),auth[_0xa02d('0x9')](),controller[_0xa02d('0x18')]);router[_0xa02d('0x16')](_0xa02d('0xf'),auth['isAuthenticated'](),controller[_0xa02d('0x19')]);module[_0xa02d('0x1a')]=router; \ No newline at end of file +var _0xfd62=['show','getSections','/:id/resources','post','create','addSections','addResources','put','delete','destroy','/:id/sections','removeSections','removeResources','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','index','/:id'];(function(_0x507b86,_0x1dc235){var _0x488667=function(_0x5ea667){while(--_0x5ea667){_0x507b86['push'](_0x507b86['shift']());}};_0x488667(++_0x1dc235);}(_0xfd62,0xaa));var _0x2fd6=function(_0x3e1af5,_0x49a9fd){_0x3e1af5=_0x3e1af5-0x0;var _0x5ce361=_0xfd62[_0x3e1af5];return _0x5ce361;};'use strict';var multer=require(_0x2fd6('0x0'));var util=require(_0x2fd6('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2fd6('0x2'));var router=express[_0x2fd6('0x3')]();var fs_extra=require(_0x2fd6('0x4'));var auth=require(_0x2fd6('0x5'));var interaction=require(_0x2fd6('0x6'));var config=require('../../config/environment');var controller=require(_0x2fd6('0x7'));router[_0x2fd6('0x8')]('/',auth[_0x2fd6('0x9')](),controller[_0x2fd6('0xa')]);router[_0x2fd6('0x8')]('/describe',auth[_0x2fd6('0x9')](),controller['describe']);router[_0x2fd6('0x8')](_0x2fd6('0xb'),auth[_0x2fd6('0x9')](),controller[_0x2fd6('0xc')]);router['get']('/:id/sections',auth[_0x2fd6('0x9')](),controller[_0x2fd6('0xd')]);router['get'](_0x2fd6('0xe'),auth[_0x2fd6('0x9')](),controller['getResources']);router[_0x2fd6('0xf')]('/',auth[_0x2fd6('0x9')](),controller[_0x2fd6('0x10')]);router['post']('/:id/clone',auth[_0x2fd6('0x9')](),controller['clone']);router[_0x2fd6('0xf')]('/:id/sections',auth['isAuthenticated'](),controller[_0x2fd6('0x11')]);router[_0x2fd6('0xf')](_0x2fd6('0xe'),auth[_0x2fd6('0x9')](),controller[_0x2fd6('0x12')]);router[_0x2fd6('0x13')]('/:id',auth[_0x2fd6('0x9')](),controller['update']);router[_0x2fd6('0x14')](_0x2fd6('0xb'),auth[_0x2fd6('0x9')](),controller[_0x2fd6('0x15')]);router[_0x2fd6('0x14')](_0x2fd6('0x16'),auth['isAuthenticated'](),controller[_0x2fd6('0x17')]);router[_0x2fd6('0x14')](_0x2fd6('0xe'),auth['isAuthenticated'](),controller[_0x2fd6('0x18')]);module[_0x2fd6('0x19')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index a1728f3..4b4d03e 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 _0xa8c5=['BOOLEAN','exports','STRING','setDataValue','crudPermissions','join','getDataValue'];(function(_0x436691,_0x355887){var _0x2f1dc5=function(_0x343b9b){while(--_0x343b9b){_0x436691['push'](_0x436691['shift']());}};_0x2f1dc5(++_0x355887);}(_0xa8c5,0xa2));var _0x5a8c=function(_0x4c6bdd,_0x58c754){_0x4c6bdd=_0x4c6bdd-0x0;var _0x458d4f=_0xa8c5[_0x4c6bdd];return _0x458d4f;};'use strict';var Sequelize=require('sequelize');module[_0x5a8c('0x0')]={'name':{'type':Sequelize[_0x5a8c('0x1')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x5a8c('0x1')],'set':function(_0x568ce3){this[_0x5a8c('0x2')](_0x5a8c('0x3'),_0x568ce3?_0x568ce3[_0x5a8c('0x4')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0x5a8c('0x5')](_0x5a8c('0x3'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x5a8c('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x5a8c('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x5a8c('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x5a8c('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x5a8c('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0x613e=['getDataValue','crudPermissions','BOOLEAN','exports','STRING','setDataValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x613e,0x1b3));var _0xe613=function(_0x577da0,_0x1a6999){_0x577da0=_0x577da0-0x0;var _0x21ca2c=_0x613e[_0x577da0];return _0x21ca2c;};'use strict';var Sequelize=require('sequelize');module[_0xe613('0x0')]={'name':{'type':Sequelize[_0xe613('0x1')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x21c154){this[_0xe613('0x2')]('crudPermissions',_0x21c154?_0x21c154['join'](''):[]);},'get':function(){return this[_0xe613('0x3')](_0xe613('0x4'))?this[_0xe613('0x3')](_0xe613('0x4'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xe613('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xe613('0x5')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xe613('0x5')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xe613('0x5')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xe613('0x5')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xe613('0x5')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xe613('0x5')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xe613('0x5')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 549c9d4..2c84001 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 _0x160f=['rows','catch','show','params','rawAttributes','includeAll','find','create','body','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','addSections','push','ids','includes','isEmpty','subsections','enabled','findOne','Dashboard','forEach','Plugin','resourceId','addResources','removeResources','getResources','section','Missing\x20section\x20parameter','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','UserProfile','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','include','findAll'];(function(_0x299e54,_0xea9e38){var _0x48997d=function(_0x12785d){while(--_0x12785d){_0x299e54['push'](_0x299e54['shift']());}};_0x48997d(++_0xea9e38);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xf160('0x0'));var rimraf=require(_0xf160('0x1'));var zipdir=require(_0xf160('0x2'));var jsonpatch=require(_0xf160('0x3'));var rp=require('request-promise');var moment=require(_0xf160('0x4'));var BPromise=require(_0xf160('0x5'));var Mustache=require(_0xf160('0x6'));var util=require(_0xf160('0x7'));var path=require(_0xf160('0x8'));var sox=require(_0xf160('0x9'));var csv=require('to-csv');var ejs=require(_0xf160('0xa'));var fs=require('fs');var fs_extra=require(_0xf160('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf160('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf160('0xd'));var Papa=require(_0xf160('0xe'));var Redis=require(_0xf160('0xf'));var authService=require(_0xf160('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf160('0x11'));var logger=require(_0xf160('0x12'))(_0xf160('0x13'));var utils=require('../../config/utils');var config=require(_0xf160('0x14'));var licenseUtil=require(_0xf160('0x15'));var db=require(_0xf160('0x16'))['db'];config[_0xf160('0x17')]=_[_0xf160('0x18')](config['redis'],{'host':_0xf160('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf160('0x17')]));require(_0xf160('0x1a'))[_0xf160('0x1b')](socket);function respondWithStatusCode(_0x2bb6c7,_0x3a4faa){_0x3a4faa=_0x3a4faa||0xcc;return function(_0x31f7ae){if(_0x31f7ae){return _0x2bb6c7[_0xf160('0x1c')](_0x3a4faa);}return _0x2bb6c7[_0xf160('0x1d')](_0x3a4faa)[_0xf160('0x1e')]();};}function respondWithResult(_0x59ac02,_0x477e4d){_0x477e4d=_0x477e4d||0xc8;return function(_0x400bda){if(_0x400bda){return _0x59ac02[_0xf160('0x1d')](_0x477e4d)[_0xf160('0x1f')](_0x400bda);}};}function respondWithFilteredResult(_0x51824b,_0x36a978){return function(_0x4b8185){if(_0x4b8185){var _0x5388c7=typeof _0x36a978[_0xf160('0x20')]===_0xf160('0x21')&&typeof _0x36a978[_0xf160('0x22')]===_0xf160('0x21');var _0x205afa=_0x4b8185[_0xf160('0x23')];var _0x2a8cb4=_0x5388c7?0x0:_0x36a978[_0xf160('0x20')];var _0x4a58d9=_0x5388c7?_0x4b8185[_0xf160('0x23')]:_0x36a978[_0xf160('0x20')]+_0x36a978[_0xf160('0x22')];var _0x5ad173;if(_0x4a58d9>=_0x205afa){_0x4a58d9=_0x205afa;_0x5ad173=0xc8;}else{_0x5ad173=0xce;}_0x51824b[_0xf160('0x1d')](_0x5ad173);return _0x51824b[_0xf160('0x24')](_0xf160('0x25'),_0x2a8cb4+'-'+_0x4a58d9+'/'+_0x205afa)[_0xf160('0x1f')](_0x4b8185);}return null;};}function patchUpdates(_0x2e03c8){return function(_0x1b0081){try{jsonpatch[_0xf160('0x26')](_0x1b0081,_0x2e03c8,!![]);}catch(_0x5a72d1){return BPromise[_0xf160('0x27')](_0x5a72d1);}return _0x1b0081[_0xf160('0x28')]();};}function saveUpdates(_0x305f6a,_0x49bb5c){return function(_0x578f7d){if(_0x578f7d){return _0x578f7d[_0xf160('0x29')](_0x305f6a)[_0xf160('0x2a')](function(_0x4a8003){return _0x4a8003;});}return null;};}function removeEntity(_0x487c0c,_0x168a09){return function(_0x1cc04c){if(_0x1cc04c){return _0x1cc04c[_0xf160('0x2b')]()['then'](function(){_0x487c0c[_0xf160('0x1d')](0xcc)[_0xf160('0x1e')]();});}};}function handleEntityNotFound(_0x2851e8,_0x2e2b00){return function(_0x135e0f){if(!_0x135e0f){_0x2851e8[_0xf160('0x1c')](0x194);}return _0x135e0f;};}function handleError(_0x5d0cc8,_0x4d7165){_0x4d7165=_0x4d7165||0x1f4;return function(_0x48145e){logger[_0xf160('0x2c')](_0x48145e[_0xf160('0x2d')]);if(_0x48145e[_0xf160('0x2e')]){delete _0x48145e[_0xf160('0x2e')];}_0x5d0cc8[_0xf160('0x1d')](_0x4d7165)['send'](_0x48145e);};}exports['index']=function(_0x329d6b,_0x558596){var _0x4ce478={},_0x22c2e3={},_0x3a35b3={'count':0x0,'rows':[]};var _0x5497f6=_[_0xf160('0x2f')](db[_0xf160('0x30')]['rawAttributes'],function(_0x528dff){return{'name':_0x528dff['fieldName'],'type':_0x528dff['type'][_0xf160('0x31')]};});_0x22c2e3[_0xf160('0x32')]=_[_0xf160('0x2f')](_0x5497f6,_0xf160('0x2e'));_0x22c2e3[_0xf160('0x33')]=_[_0xf160('0x34')](_0x329d6b['query']);_0x22c2e3['filters']=_['intersection'](_0x22c2e3[_0xf160('0x32')],_0x22c2e3['query']);_0x4ce478['attributes']=_[_0xf160('0x35')](_0x22c2e3[_0xf160('0x32')],qs['fields'](_0x329d6b[_0xf160('0x33')][_0xf160('0x36')]));_0x4ce478[_0xf160('0x37')]=_0x4ce478[_0xf160('0x37')][_0xf160('0x38')]?_0x4ce478['attributes']:_0x22c2e3[_0xf160('0x32')];if(!_0x329d6b[_0xf160('0x33')][_0xf160('0x39')]('nolimit')){_0x4ce478[_0xf160('0x22')]=qs[_0xf160('0x22')](_0x329d6b[_0xf160('0x33')][_0xf160('0x22')]);_0x4ce478[_0xf160('0x20')]=qs[_0xf160('0x20')](_0x329d6b['query']['offset']);}_0x4ce478[_0xf160('0x3a')]=qs[_0xf160('0x3b')](_0x329d6b[_0xf160('0x33')][_0xf160('0x3b')]);_0x4ce478[_0xf160('0x3c')]=qs[_0xf160('0x3d')](_[_0xf160('0x3e')](_0x329d6b[_0xf160('0x33')],_0x22c2e3[_0xf160('0x3d')]),_0x5497f6);if(_0x329d6b[_0xf160('0x33')][_0xf160('0x3f')]){_0x4ce478[_0xf160('0x3c')]=_[_0xf160('0x40')](_0x4ce478[_0xf160('0x3c')],{'$or':_[_0xf160('0x2f')](_0x5497f6,function(_0x256ce7){if(_0x256ce7[_0xf160('0x41')]!==_0xf160('0x42')){var _0x43f07f={};_0x43f07f[_0x256ce7[_0xf160('0x2e')]]={'$like':'%'+_0x329d6b[_0xf160('0x33')][_0xf160('0x3f')]+'%'};return _0x43f07f;}})});}_0x4ce478=_[_0xf160('0x40')]({},_0x4ce478,_0x329d6b[_0xf160('0x43')]);var _0x494d76={'where':_0x4ce478[_0xf160('0x3c')]};return db[_0xf160('0x30')][_0xf160('0x23')](_0x494d76)[_0xf160('0x2a')](function(_0x3d273d){_0x3a35b3[_0xf160('0x23')]=_0x3d273d;if(_0x329d6b[_0xf160('0x33')]['includeAll']){_0x4ce478[_0xf160('0x44')]=[{'all':!![]}];}return db['UserProfile'][_0xf160('0x45')](_0x4ce478);})[_0xf160('0x2a')](function(_0x530fc5){_0x3a35b3[_0xf160('0x46')]=_0x530fc5;return _0x3a35b3;})[_0xf160('0x2a')](respondWithFilteredResult(_0x558596,_0x4ce478))[_0xf160('0x47')](handleError(_0x558596,null));};exports[_0xf160('0x48')]=function(_0x468600,_0x43d243){var _0x1154ed={'raw':![],'where':{'id':_0x468600[_0xf160('0x49')]['id']}},_0x4f5eba={};_0x4f5eba[_0xf160('0x32')]=_[_0xf160('0x34')](db[_0xf160('0x30')][_0xf160('0x4a')]);_0x4f5eba[_0xf160('0x33')]=_[_0xf160('0x34')](_0x468600[_0xf160('0x33')]);_0x4f5eba[_0xf160('0x3d')]=_[_0xf160('0x35')](_0x4f5eba[_0xf160('0x32')],_0x4f5eba['query']);_0x1154ed['attributes']=_[_0xf160('0x35')](_0x4f5eba[_0xf160('0x32')],qs[_0xf160('0x36')](_0x468600[_0xf160('0x33')][_0xf160('0x36')]));_0x1154ed[_0xf160('0x37')]=_0x1154ed['attributes'][_0xf160('0x38')]?_0x1154ed['attributes']:_0x4f5eba['model'];if(_0x468600[_0xf160('0x33')][_0xf160('0x4b')]){_0x1154ed['include']=[{'all':!![]}];}_0x1154ed=_['merge']({},_0x1154ed,_0x468600[_0xf160('0x43')]);return db[_0xf160('0x30')][_0xf160('0x4c')](_0x1154ed)[_0xf160('0x2a')](handleEntityNotFound(_0x43d243,null))['then'](respondWithResult(_0x43d243,null))['catch'](handleError(_0x43d243,null));};exports['create']=function(_0x50a97d,_0x406494){return db['UserProfile'][_0xf160('0x4d')](_0x50a97d[_0xf160('0x4e')],{})[_0xf160('0x2a')](respondWithResult(_0x406494,0xc9))[_0xf160('0x47')](handleError(_0x406494,null));};exports['clone']=function(_0x45af83,_0x283f55){var _0x6acdc8={'where':{'id':_0x45af83[_0xf160('0x49')]['id']}},_0x56231c={};_0x56231c[_0xf160('0x32')]=_[_0xf160('0x34')](db['UserProfile'][_0xf160('0x4a')]);_0x6acdc8[_0xf160('0x37')]=_[_0xf160('0x35')](_0x56231c[_0xf160('0x32')],qs[_0xf160('0x36')](_0x45af83['query']['fields']));_0x6acdc8[_0xf160('0x37')]=_0x6acdc8['attributes'][_0xf160('0x38')]?_0x6acdc8[_0xf160('0x37')]:_0x56231c['model'];if(_0x45af83['query'][_0xf160('0x4b')]){_0x6acdc8[_0xf160('0x44')]=[{'all':!![]}];}_0x6acdc8=_['merge']({},_0x6acdc8,_0x45af83[_0xf160('0x43')]);return db[_0xf160('0x30')][_0xf160('0x4c')](_0x6acdc8)[_0xf160('0x2a')](handleEntityNotFound(_0x283f55,null))['then'](function(_0x3a8807){if(_0x3a8807){var _0x53792f=_0x3a8807[_0xf160('0x4f')]({'plain':!![]});_0x53792f=qs[_0xf160('0x50')](_0x53792f,['id',_0xf160('0x51'),_0xf160('0x52'),_0xf160('0x53')]);_0x45af83['body']=_[_0xf160('0x50')](_0x45af83['body'],['id',_0xf160('0x51'),_0xf160('0x52')]);return db[_0xf160('0x54')][_0xf160('0x55')](function(_0x402eb1){return db[_0xf160('0x30')][_0xf160('0x4d')](_[_0xf160('0x40')](_0x53792f,_0x45af83[_0xf160('0x4e')]),{'include':_0x45af83[_0xf160('0x33')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x402eb1})['then'](function(_0x22784f){var _0x35924b=_0x22784f['get']({'plain':!![]});return db[_0xf160('0x56')][_0xf160('0x45')]({'where':{'userProfileId':_0x45af83[_0xf160('0x49')]['id']},'raw':!![]})['then'](function(_0x499937){if(_0x499937){return BPromise[_0xf160('0x57')](_0x499937,function(_0x352ddb){return new BPromise(function(_0x5eeab6,_0x3243c6){if(_0x352ddb[_0xf160('0x58')]===null||_0x352ddb['autoAssociation']===0x1)_0x5eeab6(null);return db[_0xf160('0x59')][_0xf160('0x45')]({'where':{'sectionId':_0x352ddb['id']},'raw':!![]})[_0xf160('0x2a')](function(_0x2846fb){var _0x1761a5=_[_0xf160('0x2f')](_0x2846fb,function(_0x4f96bc){return qs[_0xf160('0x50')](_0x4f96bc,['id',_0xf160('0x51'),_0xf160('0x52'),_0xf160('0x5a')]);});_0x5eeab6(_0x1761a5);})[_0xf160('0x47')](function(_0x5a1be3){_0x3243c6(_0x5a1be3);});})[_0xf160('0x2a')](function(_0x518b7d){var _0x3a7fa2=qs[_0xf160('0x50')](_0x352ddb,['id',_0xf160('0x51'),_0xf160('0x52')]);_0x3a7fa2[_0xf160('0x5b')]=_0x35924b['id'];if(_0x518b7d)_0x3a7fa2[_0xf160('0x5c')]=_0x518b7d;return _0x3a7fa2;})['then'](function(_0x32ec90){return db[_0xf160('0x56')][_0xf160('0x4d')](_0x32ec90,{'include':[{'model':db[_0xf160('0x59')],'as':_0xf160('0x5c')}],'raw':!![],'transaction':_0x402eb1});});})['then'](function(){return _0x35924b;});}});});});}})['then'](respondWithResult(_0x283f55,0xc9))[_0xf160('0x47')](handleError(_0x283f55,null));};exports[_0xf160('0x29')]=function(_0xd14b64,_0x3d8c6c){if(_0xd14b64[_0xf160('0x4e')]['id']){delete _0xd14b64[_0xf160('0x4e')]['id'];}return db['UserProfile'][_0xf160('0x4c')]({'where':{'id':_0xd14b64[_0xf160('0x49')]['id']}})[_0xf160('0x2a')](handleEntityNotFound(_0x3d8c6c,null))[_0xf160('0x2a')](saveUpdates(_0xd14b64[_0xf160('0x4e')],null))[_0xf160('0x2a')](respondWithResult(_0x3d8c6c,null))[_0xf160('0x47')](handleError(_0x3d8c6c,null));};exports[_0xf160('0x2b')]=function(_0x53b347,_0x1818f8){return db['UserProfile'][_0xf160('0x4c')]({'where':{'id':_0x53b347[_0xf160('0x49')]['id']}})[_0xf160('0x2a')](handleEntityNotFound(_0x1818f8,null))[_0xf160('0x2a')](removeEntity(_0x1818f8,null))[_0xf160('0x47')](handleError(_0x1818f8,null));};exports[_0xf160('0x5d')]=function(_0x52d140,_0x348fd8){return db[_0xf160('0x30')][_0xf160('0x5d')]()['then'](respondWithResult(_0x348fd8,null))[_0xf160('0x47')](handleError(_0x348fd8,null));};exports[_0xf160('0x5e')]=function(_0x4db1df,_0x1db588){var _0x36f876=_0x4db1df[_0xf160('0x4e')];return db['UserProfile'][_0xf160('0x4c')]({'where':{'id':_0x4db1df[_0xf160('0x49')]['id']}})[_0xf160('0x2a')](handleEntityNotFound(_0x1db588,null))['then'](function(_0xc78642){if(_0xc78642){return db[_0xf160('0x54')][_0xf160('0x55')](function(_0xd67a1d){return db[_0xf160('0x56')][_0xf160('0x2b')]({'where':{'userProfileId':_0x4db1df[_0xf160('0x49')]['id'],'sectionId':_['map'](_0x36f876,function(_0x797ba1){return _0x797ba1[_0xf160('0x5a')];})},'transaction':_0xd67a1d})[_0xf160('0x2a')](function(){var _0x5906f3=_[_0xf160('0x2f')](_0x36f876,function(_0x46e889){_0x46e889[_0xf160('0x5b')]=_0x4db1df[_0xf160('0x49')]['id'];return _0x46e889;});var _0x36e5cb=[];return BPromise[_0xf160('0x57')](_0x5906f3,function(_0x2f8ec4){return db[_0xf160('0x56')]['create'](_0x2f8ec4,{'include':[{'model':db[_0xf160('0x59')],'as':_0xf160('0x5c')}],'raw':!![],'transaction':_0xd67a1d})[_0xf160('0x2a')](function(_0x9b62ec){_0x36e5cb[_0xf160('0x5f')](_0x9b62ec[_0xf160('0x4f')]({'plain':!![]}));});})[_0xf160('0x2a')](function(){return _0x36e5cb;});});});}})['then'](function(_0x471bb7){return _0x471bb7;})[_0xf160('0x2a')](respondWithResult(_0x1db588,null))['catch'](handleError(_0x1db588,null));};exports['removeSections']=function(_0x42481f,_0x14d69d){var _0x489a71;return db[_0xf160('0x30')][_0xf160('0x4c')]({'where':{'id':_0x42481f['params']['id']},'attributes':['id',_0xf160('0x2e')]})['then'](handleEntityNotFound(_0x14d69d,null))[_0xf160('0x2a')](function(_0x355226){if(_0x355226){_0x489a71=_0x355226;return db[_0xf160('0x56')][_0xf160('0x2b')]({'where':{'userProfileId':_0x42481f['params']['id'],'sectionId':_0x42481f[_0xf160('0x33')][_0xf160('0x60')]}});}})[_0xf160('0x2a')](function(){return _0x489a71;})[_0xf160('0x2a')](respondWithStatusCode(_0x14d69d,null))[_0xf160('0x47')](handleError(_0x14d69d,null));};exports['getSections']=function(_0x1b6f67,_0x1f856f){var _0x1388a4=[];var _0x5275b4=[];return db[_0xf160('0x56')][_0xf160('0x45')]({'where':{'userProfileId':_0x1b6f67[_0xf160('0x49')]['id']},'raw':!![]})[_0xf160('0x2a')](function(_0xb90df2){_0x1388a4=_[_0xf160('0x3f')](_0xb90df2,function(_0x18794f){return _0x18794f['enabled']===0x1||_[_0xf160('0x61')]([0x3eb,0x709],_0x18794f[_0xf160('0x5a')]);});if(!_[_0xf160('0x62')](_0x1388a4)){return _[_0xf160('0x2f')](_0x1388a4,function(_0x2313bf){return _0x2313bf['sectionId'];});}else{return;}})[_0xf160('0x2a')](function(_0x3526cd){if(_0x3526cd)_0x5275b4=_0x3526cd;if(_[_0xf160('0x61')](_0x5275b4,0x64)){var _0x2fa858=_[_0xf160('0x4c')](_0x1388a4,{'sectionId':0x64});return hasDefaultDashboard(_0x2fa858)[_0xf160('0x2a')](function(_0x36c24d){return _[_0xf160('0x2f')](_0x1388a4,function(_0x1e32cc){if(_0x1e32cc[_0xf160('0x5a')]===0x64){_0x1e32cc[_0xf160('0x63')]=_0x36c24d;}return _0x1e32cc;});});}else{return;}})['then'](function(_0x185c93){if(_0x185c93)_0x1388a4=_0x185c93;if(_['includes'](_0x5275b4,0x3eb)){var _0x1ddc68=_[_0xf160('0x4c')](_0x1388a4,{'sectionId':0x3eb});return getCustomDashboards(_0x1ddc68)[_0xf160('0x2a')](function(_0xf29ffa){return _[_0xf160('0x2f')](_0x1388a4,function(_0x59281e){if(_0x1ddc68[_0xf160('0x64')]){if(_0x59281e[_0xf160('0x5a')]===0x3eb){_0x59281e[_0xf160('0x63')]=_0xf29ffa;}}else{if(_0x59281e[_0xf160('0x5a')]===0x64){_0x59281e['subsections']=_0xf29ffa;}}return _0x59281e;});});}else{return;}})['then'](function(_0x489e98){if(_0x489e98)_0x1388a4=_0x489e98;if(_['includes'](_0x5275b4,0x709)){var _0x2559c8=_['find'](_0x1388a4,{'sectionId':0x709});return getPlugins(_0x2559c8)[_0xf160('0x2a')](function(_0x4fea4f){if(_0x2559c8['enabled']){return _[_0xf160('0x2f')](_0x1388a4,function(_0x110a31){if(_0x110a31[_0xf160('0x5a')]===0x709){_0x110a31[_0xf160('0x63')]=_0x4fea4f;}return _0x110a31;});}else{var _0x176400={'sectionId':0x76c,'enabled':0x1,'subsections':_0x4fea4f};var _0xc11747=_[_0xf160('0x2f')](_0x1388a4);_0xc11747[_0xf160('0x5f')](_0x176400);return _0xc11747;}});}else{return;}})[_0xf160('0x2a')](function(_0x48e9e9){if(_0x48e9e9)_0x1388a4=_0x48e9e9;return _['filter'](_0x1388a4,[_0xf160('0x64'),0x1]);})[_0xf160('0x2a')](respondWithResult(_0x1f856f,null))[_0xf160('0x47')](handleError(_0x1f856f,null));};function hasDefaultDashboard(_0x359f6f){var _0xbf7bb9=[0x65];return new BPromise(function(_0x56d84e,_0x194452){try{if(_0x359f6f[_0xf160('0x58')]){_0x56d84e(_0xbf7bb9);}else{return db[_0xf160('0x59')][_0xf160('0x65')]({'where':{'sectionId':_0x359f6f['id']},'raw':!![]})['then'](function(_0x5a0fee){_0x5a0fee?_0x56d84e(_0xbf7bb9):_0x56d84e();});}}catch(_0x5c2572){_0x194452(_0x5c2572);}});}function getCustomDashboards(_0x420f40){var _0x4ca91a=[];return new BPromise(function(_0x1230eb,_0x5a0bb3){try{if(_0x420f40[_0xf160('0x58')]){return db[_0xf160('0x66')]['findAll']({'raw':!![]})[_0xf160('0x2a')](function(_0x30b63c){_0x30b63c[_0xf160('0x67')](function(_0x376ff8){_0x4ca91a[_0xf160('0x5f')](_0x376ff8['id']+0x1869f);});_0x1230eb(_0x4ca91a);});}else{return db[_0xf160('0x59')][_0xf160('0x45')]({'where':{'sectionId':_0x420f40['id']},'raw':!![]})['then'](function(_0x5b2049){_0x5b2049[_0xf160('0x67')](function(_0xe32abb){_0x4ca91a[_0xf160('0x5f')](_0xe32abb['resourceId']+0x1869f);});_0x1230eb(_0x4ca91a);});}}catch(_0x5316c5){_0x5a0bb3(_0x5316c5);}});}function getPlugins(_0x10cade){var _0x3f9ec8=[];return new BPromise(function(_0x46566b,_0xe2d397){try{if(_0x10cade[_0xf160('0x58')]){return db[_0xf160('0x68')][_0xf160('0x45')]({'raw':!![]})[_0xf160('0x2a')](function(_0xfb4200){_0xfb4200[_0xf160('0x67')](function(_0x574907){_0x3f9ec8[_0xf160('0x5f')](_0x574907['id']+0x15b38);});_0x46566b(_0x3f9ec8);});}else{return db[_0xf160('0x59')][_0xf160('0x45')]({'where':{'sectionId':_0x10cade['id']},'raw':!![]})[_0xf160('0x2a')](function(_0x34a17c){_0x34a17c[_0xf160('0x67')](function(_0x5232bd){_0x3f9ec8[_0xf160('0x5f')](_0x5232bd[_0xf160('0x69')]+0x15b38);});_0x46566b(_0x3f9ec8);});}}catch(_0x2b6e56){_0xe2d397(_0x2b6e56);}});}exports[_0xf160('0x6a')]=function(_0xcf5dee,_0x2a8af4){return db[_0xf160('0x30')][_0xf160('0x4c')]({'where':{'id':_0xcf5dee['params']['id']}})['then'](handleEntityNotFound(_0x2a8af4,null))[_0xf160('0x2a')](function(_0x85f813){if(_0x85f813){return db['sequelize'][_0xf160('0x55')](function(_0x351c08){return db[_0xf160('0x56')][_0xf160('0x45')]({'where':{'userProfileId':_0xcf5dee[_0xf160('0x49')]['id']},'attributes':['id'],'raw':!![]})[_0xf160('0x2a')](function(_0x39210a){if(_0x39210a){return db[_0xf160('0x56')][_0xf160('0x2b')]({'where':{'userProfileId':_0xcf5dee[_0xf160('0x49')]['id'],'id':_['map'](_0x39210a,function(_0x2fb562){return _0x2fb562['id'];})},'transaction':_0x351c08});}})[_0xf160('0x2a')](function(_0x275ca6){var _0xcf7f19=_[_0xf160('0x2f')](_0xcf5dee['body'],function(_0x2e379e){_0x2e379e[_0xf160('0x5b')]=_0xcf5dee[_0xf160('0x49')]['id'];return _0x2e379e;});return db[_0xf160('0x56')]['bulkCreate'](_0xcf7f19,{'raw':!![],'transaction':_0x351c08});})[_0xf160('0x2a')](function(_0x2a6485){var _0x4b8fb8=_['filter'](_['map'](_0x2a6485,function(_0x49c401){return _0x49c401['get']({'plain':!![]});}),{'includeAll':![]});if(_0x4b8fb8){return db[_0xf160('0x56')][_0xf160('0x45')]({'where':{'userProfileId':_0xcf5dee['params']['id'],'sectionId':_['map'](_0x4b8fb8,function(_0x220b24){return _0x220b24[_0xf160('0x5a')];})},'attributes':['id','sectionId'],'raw':!![]})[_0xf160('0x2a')](function(_0x50f36d){var _0x32fb34=_[_0xf160('0x2f')](_0xcf5dee[_0xf160('0x4e')],function(_0x4f0cd0){_0x4f0cd0[_0xf160('0x5b')]=_0xcf5dee['params']['id'];return _0x4f0cd0;});return db[_0xf160('0x59')]['bulkCreate'](_0x32fb34,{'raw':!![],'transaction':_0x351c08});});}})[_0xf160('0x47')](handleError(_0x2a8af4,null));});}})['then'](function(_0x1d22eb){var _0x5048f0=_[_0xf160('0x2f')](_0x1d22eb,function(_0x2b266b){return _0x2b266b['get']({'plain':!![]});});})[_0xf160('0x2a')](respondWithResult(_0x2a8af4,null))[_0xf160('0x47')](handleError(_0x2a8af4,null));};exports['removeResources']=function(_0x7c3f86,_0x444f9e,_0x28fe5e){return db[_0xf160('0x30')]['find']({'where':{'id':_0x7c3f86['params']['id']}})[_0xf160('0x2a')](handleEntityNotFound(_0x444f9e,null))[_0xf160('0x2a')](function(_0x5c3464){if(_0x5c3464){return _0x5c3464[_0xf160('0x6b')](_0x7c3f86[_0xf160('0x33')]['ids']);}})[_0xf160('0x2a')](respondWithStatusCode(_0x444f9e,null))['catch'](handleError(_0x444f9e,null));};exports[_0xf160('0x6c')]=function(_0x2eada8,_0x231fac){var _0x4b397f={};if(!_0x2eada8[_0xf160('0x33')][_0xf160('0x6d')])throw new Error(_0xf160('0x6e'));if(!_0x2eada8[_0xf160('0x33')][_0xf160('0x39')](_0xf160('0x6f'))){_0x4b397f[_0xf160('0x22')]=qs[_0xf160('0x22')](_0x2eada8['query']['limit']);_0x4b397f[_0xf160('0x20')]=qs['offset'](_0x2eada8['query'][_0xf160('0x20')]);}return db['UserProfile'][_0xf160('0x4c')]({'where':{'id':_0x2eada8[_0xf160('0x49')]['id']}})[_0xf160('0x2a')](function(_0x26aa72){if(!_0x26aa72)throw new Error(_0xf160('0x70')+_0x2eada8[_0xf160('0x49')]['id']);return db[_0xf160('0x30')][_0xf160('0x6c')](_0x2eada8);})[_0xf160('0x2a')](respondWithFilteredResult(_0x231fac,_0x4b397f))[_0xf160('0x47')](handleError(_0x231fac,null));}; \ No newline at end of file +var _0x2272=['squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./userProfile.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','include','findAll','rows','catch','UserProfile','find','create','body','clone','params','includeAll','get','omit','updatedAt','crudPermissions','createdAt','UserProfileSection','each','autoAssociation','sectionId','UserProfileResource','Resources','destroy','describe','addSections','sequelize','userProfileId','removeSections','ids','getSections','includes','isEmpty','enabled','subsections','push','findOne','Dashboard','forEach','resourceId','Plugin','transaction','bulkCreate','removeResources','getResources','section','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash'];(function(_0x30231a,_0x33c2b3){var _0x18ac4a=function(_0xfe5bf1){while(--_0xfe5bf1){_0x30231a['push'](_0x30231a['shift']());}};_0x18ac4a(++_0x33c2b3);}(_0x2272,0xd8));var _0x2227=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2272[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x2227('0x0'));var rimraf=require(_0x2227('0x1'));var zipdir=require(_0x2227('0x2'));var jsonpatch=require(_0x2227('0x3'));var rp=require(_0x2227('0x4'));var moment=require('moment');var BPromise=require(_0x2227('0x5'));var Mustache=require(_0x2227('0x6'));var util=require(_0x2227('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x2227('0x8'));var ejs=require(_0x2227('0x9'));var fs=require('fs');var fs_extra=require(_0x2227('0xa'));var _=require(_0x2227('0xb'));var squel=require(_0x2227('0xc'));var crypto=require(_0x2227('0xd'));var jsforce=require(_0x2227('0xe'));var deskjs=require(_0x2227('0xf'));var toCsv=require(_0x2227('0x8'));var querystring=require(_0x2227('0x10'));var Papa=require('papaparse');var Redis=require(_0x2227('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2227('0x12'));var as=require(_0x2227('0x13'));var hardwareService=require(_0x2227('0x14'));var logger=require(_0x2227('0x15'))(_0x2227('0x16'));var utils=require('../../config/utils');var config=require(_0x2227('0x17'));var licenseUtil=require(_0x2227('0x18'));var db=require(_0x2227('0x19'))['db'];config[_0x2227('0x1a')]=_[_0x2227('0x1b')](config[_0x2227('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2227('0x1c'))['register'](socket);function respondWithStatusCode(_0x42f60b,_0xb631b0){_0xb631b0=_0xb631b0||0xcc;return function(_0x510b09){if(_0x510b09){return _0x42f60b[_0x2227('0x1d')](_0xb631b0);}return _0x42f60b[_0x2227('0x1e')](_0xb631b0)[_0x2227('0x1f')]();};}function respondWithResult(_0x43e174,_0x42a93c){_0x42a93c=_0x42a93c||0xc8;return function(_0x1e78a8){if(_0x1e78a8){return _0x43e174['status'](_0x42a93c)[_0x2227('0x20')](_0x1e78a8);}};}function respondWithFilteredResult(_0x1cf016,_0x162723){return function(_0x531f75){if(_0x531f75){var _0x11bf80=typeof _0x162723[_0x2227('0x21')]===_0x2227('0x22')&&typeof _0x162723[_0x2227('0x23')]===_0x2227('0x22');var _0x28e642=_0x531f75[_0x2227('0x24')];var _0x4e0bba=_0x11bf80?0x0:_0x162723[_0x2227('0x21')];var _0x59f988=_0x11bf80?_0x531f75[_0x2227('0x24')]:_0x162723[_0x2227('0x21')]+_0x162723[_0x2227('0x23')];var _0x1f28ef;if(_0x59f988>=_0x28e642){_0x59f988=_0x28e642;_0x1f28ef=0xc8;}else{_0x1f28ef=0xce;}_0x1cf016[_0x2227('0x1e')](_0x1f28ef);return _0x1cf016[_0x2227('0x25')](_0x2227('0x26'),_0x4e0bba+'-'+_0x59f988+'/'+_0x28e642)[_0x2227('0x20')](_0x531f75);}return null;};}function patchUpdates(_0x3299fd){return function(_0x34c090){try{jsonpatch[_0x2227('0x27')](_0x34c090,_0x3299fd,!![]);}catch(_0x5a454f){return BPromise[_0x2227('0x28')](_0x5a454f);}return _0x34c090[_0x2227('0x29')]();};}function saveUpdates(_0x5b3a09,_0x2cef4b){return function(_0xbfdce1){if(_0xbfdce1){return _0xbfdce1['update'](_0x5b3a09)['then'](function(_0x17c7a4){return _0x17c7a4;});}return null;};}function removeEntity(_0xa4d18b,_0x35333f){return function(_0x1f30c3){if(_0x1f30c3){return _0x1f30c3['destroy']()[_0x2227('0x2a')](function(){_0xa4d18b[_0x2227('0x1e')](0xcc)[_0x2227('0x1f')]();});}};}function handleEntityNotFound(_0x1957ee,_0x5d852f){return function(_0x204def){if(!_0x204def){_0x1957ee[_0x2227('0x1d')](0x194);}return _0x204def;};}function handleError(_0xedd3d9,_0x20bd12){_0x20bd12=_0x20bd12||0x1f4;return function(_0x1627d3){logger['error'](_0x1627d3['stack']);if(_0x1627d3['name']){delete _0x1627d3[_0x2227('0x2b')];}_0xedd3d9['status'](_0x20bd12)[_0x2227('0x2c')](_0x1627d3);};}exports[_0x2227('0x2d')]=function(_0x58609e,_0x5916d4){var _0x1f1ba7={},_0x1818ba={},_0x21838a={'count':0x0,'rows':[]};var _0x4cc1e1=_[_0x2227('0x2e')](db['UserProfile'][_0x2227('0x2f')],function(_0x3f108b){return{'name':_0x3f108b[_0x2227('0x30')],'type':_0x3f108b[_0x2227('0x31')][_0x2227('0x32')]};});_0x1818ba[_0x2227('0x33')]=_[_0x2227('0x2e')](_0x4cc1e1,_0x2227('0x2b'));_0x1818ba[_0x2227('0x34')]=_[_0x2227('0x35')](_0x58609e[_0x2227('0x34')]);_0x1818ba['filters']=_[_0x2227('0x36')](_0x1818ba[_0x2227('0x33')],_0x1818ba[_0x2227('0x34')]);_0x1f1ba7[_0x2227('0x37')]=_['intersection'](_0x1818ba[_0x2227('0x33')],qs[_0x2227('0x38')](_0x58609e[_0x2227('0x34')][_0x2227('0x38')]));_0x1f1ba7['attributes']=_0x1f1ba7[_0x2227('0x37')][_0x2227('0x39')]?_0x1f1ba7[_0x2227('0x37')]:_0x1818ba['model'];if(!_0x58609e['query'][_0x2227('0x3a')](_0x2227('0x3b'))){_0x1f1ba7['limit']=qs[_0x2227('0x23')](_0x58609e[_0x2227('0x34')]['limit']);_0x1f1ba7[_0x2227('0x21')]=qs['offset'](_0x58609e[_0x2227('0x34')][_0x2227('0x21')]);}_0x1f1ba7[_0x2227('0x3c')]=qs[_0x2227('0x3d')](_0x58609e['query'][_0x2227('0x3d')]);_0x1f1ba7['where']=qs[_0x2227('0x3e')](_[_0x2227('0x3f')](_0x58609e[_0x2227('0x34')],_0x1818ba['filters']),_0x4cc1e1);if(_0x58609e[_0x2227('0x34')][_0x2227('0x40')]){_0x1f1ba7[_0x2227('0x41')]=_[_0x2227('0x42')](_0x1f1ba7[_0x2227('0x41')],{'$or':_['map'](_0x4cc1e1,function(_0x4d9b1d){if(_0x4d9b1d[_0x2227('0x31')]!=='VIRTUAL'){var _0x17137d={};_0x17137d[_0x4d9b1d[_0x2227('0x2b')]]={'$like':'%'+_0x58609e[_0x2227('0x34')][_0x2227('0x40')]+'%'};return _0x17137d;}})});}_0x1f1ba7=_[_0x2227('0x42')]({},_0x1f1ba7,_0x58609e[_0x2227('0x43')]);var _0x351a6f={'where':_0x1f1ba7[_0x2227('0x41')]};return db['UserProfile'][_0x2227('0x24')](_0x351a6f)['then'](function(_0x3c67c6){_0x21838a['count']=_0x3c67c6;if(_0x58609e[_0x2227('0x34')]['includeAll']){_0x1f1ba7[_0x2227('0x44')]=[{'all':!![]}];}return db['UserProfile'][_0x2227('0x45')](_0x1f1ba7);})[_0x2227('0x2a')](function(_0x46eb0f){_0x21838a[_0x2227('0x46')]=_0x46eb0f;return _0x21838a;})[_0x2227('0x2a')](respondWithFilteredResult(_0x5916d4,_0x1f1ba7))[_0x2227('0x47')](handleError(_0x5916d4,null));};exports['show']=function(_0x5d58a1,_0x42d40d){var _0x4c7458={'raw':![],'where':{'id':_0x5d58a1['params']['id']}},_0x3552db={};_0x3552db[_0x2227('0x33')]=_[_0x2227('0x35')](db[_0x2227('0x48')][_0x2227('0x2f')]);_0x3552db[_0x2227('0x34')]=_[_0x2227('0x35')](_0x5d58a1['query']);_0x3552db[_0x2227('0x3e')]=_[_0x2227('0x36')](_0x3552db[_0x2227('0x33')],_0x3552db[_0x2227('0x34')]);_0x4c7458[_0x2227('0x37')]=_[_0x2227('0x36')](_0x3552db[_0x2227('0x33')],qs[_0x2227('0x38')](_0x5d58a1['query'][_0x2227('0x38')]));_0x4c7458[_0x2227('0x37')]=_0x4c7458[_0x2227('0x37')][_0x2227('0x39')]?_0x4c7458['attributes']:_0x3552db[_0x2227('0x33')];if(_0x5d58a1[_0x2227('0x34')]['includeAll']){_0x4c7458[_0x2227('0x44')]=[{'all':!![]}];}_0x4c7458=_[_0x2227('0x42')]({},_0x4c7458,_0x5d58a1[_0x2227('0x43')]);return db[_0x2227('0x48')][_0x2227('0x49')](_0x4c7458)[_0x2227('0x2a')](handleEntityNotFound(_0x42d40d,null))[_0x2227('0x2a')](respondWithResult(_0x42d40d,null))['catch'](handleError(_0x42d40d,null));};exports[_0x2227('0x4a')]=function(_0x3155dd,_0x482bf9){return db[_0x2227('0x48')]['create'](_0x3155dd[_0x2227('0x4b')],{})[_0x2227('0x2a')](respondWithResult(_0x482bf9,0xc9))[_0x2227('0x47')](handleError(_0x482bf9,null));};exports[_0x2227('0x4c')]=function(_0x5387fc,_0x4e12c7){var _0x4e2514={'where':{'id':_0x5387fc[_0x2227('0x4d')]['id']}},_0x434e90={};_0x434e90['model']=_[_0x2227('0x35')](db[_0x2227('0x48')][_0x2227('0x2f')]);_0x4e2514[_0x2227('0x37')]=_['intersection'](_0x434e90['model'],qs[_0x2227('0x38')](_0x5387fc[_0x2227('0x34')][_0x2227('0x38')]));_0x4e2514[_0x2227('0x37')]=_0x4e2514['attributes'][_0x2227('0x39')]?_0x4e2514[_0x2227('0x37')]:_0x434e90[_0x2227('0x33')];if(_0x5387fc[_0x2227('0x34')][_0x2227('0x4e')]){_0x4e2514[_0x2227('0x44')]=[{'all':!![]}];}_0x4e2514=_[_0x2227('0x42')]({},_0x4e2514,_0x5387fc[_0x2227('0x43')]);return db[_0x2227('0x48')][_0x2227('0x49')](_0x4e2514)[_0x2227('0x2a')](handleEntityNotFound(_0x4e12c7,null))[_0x2227('0x2a')](function(_0x7b6319){if(_0x7b6319){var _0x271f45=_0x7b6319[_0x2227('0x4f')]({'plain':!![]});_0x271f45=qs[_0x2227('0x50')](_0x271f45,['id','createdAt',_0x2227('0x51'),_0x2227('0x52')]);_0x5387fc['body']=_[_0x2227('0x50')](_0x5387fc[_0x2227('0x4b')],['id',_0x2227('0x53'),'updatedAt']);return db['sequelize']['transaction'](function(_0x238157){return db[_0x2227('0x48')]['create'](_[_0x2227('0x42')](_0x271f45,_0x5387fc[_0x2227('0x4b')]),{'include':_0x5387fc[_0x2227('0x34')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x238157})[_0x2227('0x2a')](function(_0x2ca7d8){var _0x51ea83=_0x2ca7d8[_0x2227('0x4f')]({'plain':!![]});return db[_0x2227('0x54')]['findAll']({'where':{'userProfileId':_0x5387fc[_0x2227('0x4d')]['id']},'raw':!![]})[_0x2227('0x2a')](function(_0x30b004){if(_0x30b004){return BPromise[_0x2227('0x55')](_0x30b004,function(_0x300741){return new BPromise(function(_0x118225,_0x52861f){if(_0x300741['autoAssociation']===null||_0x300741[_0x2227('0x56')]===0x1)_0x118225(null);return db['UserProfileResource'][_0x2227('0x45')]({'where':{'sectionId':_0x300741['id']},'raw':!![]})['then'](function(_0x34b44f){var _0x13d3c6=_[_0x2227('0x2e')](_0x34b44f,function(_0x449d86){return qs['omit'](_0x449d86,['id',_0x2227('0x53'),_0x2227('0x51'),_0x2227('0x57')]);});_0x118225(_0x13d3c6);})[_0x2227('0x47')](function(_0x30fbd8){_0x52861f(_0x30fbd8);});})['then'](function(_0x5cf875){var _0x2dfd29=qs['omit'](_0x300741,['id',_0x2227('0x53'),_0x2227('0x51')]);_0x2dfd29['userProfileId']=_0x51ea83['id'];if(_0x5cf875)_0x2dfd29['Resources']=_0x5cf875;return _0x2dfd29;})[_0x2227('0x2a')](function(_0x335798){return db[_0x2227('0x54')][_0x2227('0x4a')](_0x335798,{'include':[{'model':db[_0x2227('0x58')],'as':_0x2227('0x59')}],'raw':!![],'transaction':_0x238157});});})[_0x2227('0x2a')](function(){return _0x51ea83;});}});});});}})[_0x2227('0x2a')](respondWithResult(_0x4e12c7,0xc9))[_0x2227('0x47')](handleError(_0x4e12c7,null));};exports['update']=function(_0x2d7c67,_0x1d0e87){if(_0x2d7c67['body']['id']){delete _0x2d7c67[_0x2227('0x4b')]['id'];}return db[_0x2227('0x48')][_0x2227('0x49')]({'where':{'id':_0x2d7c67['params']['id']}})[_0x2227('0x2a')](handleEntityNotFound(_0x1d0e87,null))[_0x2227('0x2a')](saveUpdates(_0x2d7c67[_0x2227('0x4b')],null))[_0x2227('0x2a')](respondWithResult(_0x1d0e87,null))[_0x2227('0x47')](handleError(_0x1d0e87,null));};exports[_0x2227('0x5a')]=function(_0x362675,_0x223220){return db[_0x2227('0x48')][_0x2227('0x49')]({'where':{'id':_0x362675[_0x2227('0x4d')]['id']}})[_0x2227('0x2a')](handleEntityNotFound(_0x223220,null))[_0x2227('0x2a')](removeEntity(_0x223220,null))[_0x2227('0x47')](handleError(_0x223220,null));};exports['describe']=function(_0x38ef8a,_0x3bc736){return db[_0x2227('0x48')][_0x2227('0x5b')]()[_0x2227('0x2a')](respondWithResult(_0x3bc736,null))[_0x2227('0x47')](handleError(_0x3bc736,null));};exports[_0x2227('0x5c')]=function(_0x4633d8,_0x4e0ca2){var _0x38a1a2=_0x4633d8[_0x2227('0x4b')];return db[_0x2227('0x48')]['find']({'where':{'id':_0x4633d8[_0x2227('0x4d')]['id']}})[_0x2227('0x2a')](handleEntityNotFound(_0x4e0ca2,null))[_0x2227('0x2a')](function(_0x5bd233){if(_0x5bd233){return db[_0x2227('0x5d')]['transaction'](function(_0xb35937){return db[_0x2227('0x54')][_0x2227('0x5a')]({'where':{'userProfileId':_0x4633d8[_0x2227('0x4d')]['id'],'sectionId':_['map'](_0x38a1a2,function(_0x3a34d8){return _0x3a34d8[_0x2227('0x57')];})},'transaction':_0xb35937})['then'](function(){var _0x550c73=_[_0x2227('0x2e')](_0x38a1a2,function(_0x7fc9a){_0x7fc9a[_0x2227('0x5e')]=_0x4633d8[_0x2227('0x4d')]['id'];return _0x7fc9a;});var _0xe3b8bb=[];return BPromise[_0x2227('0x55')](_0x550c73,function(_0x21d840){return db[_0x2227('0x54')]['create'](_0x21d840,{'include':[{'model':db[_0x2227('0x58')],'as':_0x2227('0x59')}],'raw':!![],'transaction':_0xb35937})[_0x2227('0x2a')](function(_0x504c5c){_0xe3b8bb['push'](_0x504c5c['get']({'plain':!![]}));});})[_0x2227('0x2a')](function(){return _0xe3b8bb;});});});}})['then'](function(_0x11198a){return _0x11198a;})[_0x2227('0x2a')](respondWithResult(_0x4e0ca2,null))[_0x2227('0x47')](handleError(_0x4e0ca2,null));};exports[_0x2227('0x5f')]=function(_0x279941,_0x2435d0){var _0x28aeb8;return db[_0x2227('0x48')][_0x2227('0x49')]({'where':{'id':_0x279941['params']['id']},'attributes':['id',_0x2227('0x2b')]})[_0x2227('0x2a')](handleEntityNotFound(_0x2435d0,null))[_0x2227('0x2a')](function(_0x58e3ee){if(_0x58e3ee){_0x28aeb8=_0x58e3ee;return db[_0x2227('0x54')][_0x2227('0x5a')]({'where':{'userProfileId':_0x279941['params']['id'],'sectionId':_0x279941['query'][_0x2227('0x60')]}});}})['then'](function(){return _0x28aeb8;})[_0x2227('0x2a')](respondWithStatusCode(_0x2435d0,null))[_0x2227('0x47')](handleError(_0x2435d0,null));};exports[_0x2227('0x61')]=function(_0x474e7a,_0xd55972){var _0x4b6a4d=[];var _0x9b431a=[];return db[_0x2227('0x54')][_0x2227('0x45')]({'where':{'userProfileId':_0x474e7a[_0x2227('0x4d')]['id']},'raw':!![]})['then'](function(_0xdd2206){_0x4b6a4d=_[_0x2227('0x40')](_0xdd2206,function(_0x5b400c){return _0x5b400c['enabled']===0x1||_[_0x2227('0x62')]([0x3eb,0x709],_0x5b400c[_0x2227('0x57')]);});if(!_[_0x2227('0x63')](_0x4b6a4d)){return _['map'](_0x4b6a4d,function(_0x503c54){return _0x503c54[_0x2227('0x57')];});}else{return;}})[_0x2227('0x2a')](function(_0x13cd17){if(_0x13cd17)_0x9b431a=_0x13cd17;if(_[_0x2227('0x62')](_0x9b431a,0x64)){var _0x5c0c6f=_['find'](_0x4b6a4d,{'sectionId':0x64});return hasDefaultDashboard(_0x5c0c6f)[_0x2227('0x2a')](function(_0x5428b7){return _[_0x2227('0x2e')](_0x4b6a4d,function(_0x5fd5a){if(_0x5fd5a[_0x2227('0x57')]===0x64){_0x5fd5a['subsections']=_0x5428b7;}return _0x5fd5a;});});}else{return;}})[_0x2227('0x2a')](function(_0x5111aa){if(_0x5111aa)_0x4b6a4d=_0x5111aa;if(_[_0x2227('0x62')](_0x9b431a,0x3eb)){var _0x1c177c=_[_0x2227('0x49')](_0x4b6a4d,{'sectionId':0x3eb});return getCustomDashboards(_0x1c177c)[_0x2227('0x2a')](function(_0xa4d9b7){return _[_0x2227('0x2e')](_0x4b6a4d,function(_0x2eea42){if(_0x1c177c[_0x2227('0x64')]){if(_0x2eea42['sectionId']===0x3eb){_0x2eea42[_0x2227('0x65')]=_0xa4d9b7;}}else{if(_0x2eea42[_0x2227('0x57')]===0x64){_0x2eea42[_0x2227('0x65')]=_0xa4d9b7;}}return _0x2eea42;});});}else{return;}})['then'](function(_0x59097d){if(_0x59097d)_0x4b6a4d=_0x59097d;if(_[_0x2227('0x62')](_0x9b431a,0x709)){var _0x1d8c81=_[_0x2227('0x49')](_0x4b6a4d,{'sectionId':0x709});return getPlugins(_0x1d8c81)['then'](function(_0x17f3ff){if(_0x1d8c81['enabled']){return _[_0x2227('0x2e')](_0x4b6a4d,function(_0x5d5cfa){if(_0x5d5cfa[_0x2227('0x57')]===0x709){_0x5d5cfa[_0x2227('0x65')]=_0x17f3ff;}return _0x5d5cfa;});}else{var _0x5ca106={'sectionId':0x76c,'enabled':0x1,'subsections':_0x17f3ff};var _0xa1da3d=_[_0x2227('0x2e')](_0x4b6a4d);_0xa1da3d[_0x2227('0x66')](_0x5ca106);return _0xa1da3d;}});}else{return;}})[_0x2227('0x2a')](function(_0x2ae3e0){if(_0x2ae3e0)_0x4b6a4d=_0x2ae3e0;return _[_0x2227('0x40')](_0x4b6a4d,['enabled',0x1]);})['then'](respondWithResult(_0xd55972,null))[_0x2227('0x47')](handleError(_0xd55972,null));};function hasDefaultDashboard(_0x44a45e){var _0x304264=[0x65];return new BPromise(function(_0x86cb4e,_0x538575){try{if(_0x44a45e['autoAssociation']){_0x86cb4e(_0x304264);}else{return db[_0x2227('0x58')][_0x2227('0x67')]({'where':{'sectionId':_0x44a45e['id']},'raw':!![]})[_0x2227('0x2a')](function(_0x49bdd5){_0x49bdd5?_0x86cb4e(_0x304264):_0x86cb4e();});}}catch(_0x5115dc){_0x538575(_0x5115dc);}});}function getCustomDashboards(_0x2a5390){var _0x182ff3=[];return new BPromise(function(_0x216de9,_0x423e85){try{if(_0x2a5390[_0x2227('0x56')]){return db[_0x2227('0x68')][_0x2227('0x45')]({'raw':!![]})[_0x2227('0x2a')](function(_0x41e8ca){_0x41e8ca['forEach'](function(_0x4961e8){_0x182ff3[_0x2227('0x66')](_0x4961e8['id']+0x1869f);});_0x216de9(_0x182ff3);});}else{return db['UserProfileResource'][_0x2227('0x45')]({'where':{'sectionId':_0x2a5390['id']},'raw':!![]})[_0x2227('0x2a')](function(_0x595884){_0x595884[_0x2227('0x69')](function(_0xd5410e){_0x182ff3['push'](_0xd5410e[_0x2227('0x6a')]+0x1869f);});_0x216de9(_0x182ff3);});}}catch(_0x3174ef){_0x423e85(_0x3174ef);}});}function getPlugins(_0x292a0e){var _0x4cff8f=[];return new BPromise(function(_0x3e072f,_0x4f5707){try{if(_0x292a0e['autoAssociation']){return db[_0x2227('0x6b')]['findAll']({'raw':!![]})[_0x2227('0x2a')](function(_0x1b2b58){_0x1b2b58[_0x2227('0x69')](function(_0x576ce9){_0x4cff8f[_0x2227('0x66')](_0x576ce9['id']+0x15b38);});_0x3e072f(_0x4cff8f);});}else{return db[_0x2227('0x58')][_0x2227('0x45')]({'where':{'sectionId':_0x292a0e['id']},'raw':!![]})[_0x2227('0x2a')](function(_0x4c9d88){_0x4c9d88['forEach'](function(_0x1c6f54){_0x4cff8f[_0x2227('0x66')](_0x1c6f54[_0x2227('0x6a')]+0x15b38);});_0x3e072f(_0x4cff8f);});}}catch(_0x2e4a1b){_0x4f5707(_0x2e4a1b);}});}exports['addResources']=function(_0x1a2852,_0x4599ab){return db[_0x2227('0x48')][_0x2227('0x49')]({'where':{'id':_0x1a2852[_0x2227('0x4d')]['id']}})[_0x2227('0x2a')](handleEntityNotFound(_0x4599ab,null))[_0x2227('0x2a')](function(_0x4b09e6){if(_0x4b09e6){return db['sequelize'][_0x2227('0x6c')](function(_0x1366de){return db['UserProfileSection'][_0x2227('0x45')]({'where':{'userProfileId':_0x1a2852[_0x2227('0x4d')]['id']},'attributes':['id'],'raw':!![]})[_0x2227('0x2a')](function(_0x192e2a){if(_0x192e2a){return db['UserProfileSection'][_0x2227('0x5a')]({'where':{'userProfileId':_0x1a2852['params']['id'],'id':_['map'](_0x192e2a,function(_0x3f6fe2){return _0x3f6fe2['id'];})},'transaction':_0x1366de});}})[_0x2227('0x2a')](function(_0x3f7525){var _0x1c4aad=_[_0x2227('0x2e')](_0x1a2852[_0x2227('0x4b')],function(_0x334977){_0x334977[_0x2227('0x5e')]=_0x1a2852[_0x2227('0x4d')]['id'];return _0x334977;});return db['UserProfileSection'][_0x2227('0x6d')](_0x1c4aad,{'raw':!![],'transaction':_0x1366de});})[_0x2227('0x2a')](function(_0x2fb403){var _0x2d7713=_[_0x2227('0x40')](_['map'](_0x2fb403,function(_0x937480){return _0x937480['get']({'plain':!![]});}),{'includeAll':![]});if(_0x2d7713){return db[_0x2227('0x54')][_0x2227('0x45')]({'where':{'userProfileId':_0x1a2852[_0x2227('0x4d')]['id'],'sectionId':_[_0x2227('0x2e')](_0x2d7713,function(_0xf88d4){return _0xf88d4[_0x2227('0x57')];})},'attributes':['id',_0x2227('0x57')],'raw':!![]})[_0x2227('0x2a')](function(_0x56d29e){var _0x1686d7=_[_0x2227('0x2e')](_0x1a2852[_0x2227('0x4b')],function(_0x5e020e){_0x5e020e[_0x2227('0x5e')]=_0x1a2852[_0x2227('0x4d')]['id'];return _0x5e020e;});return db['UserProfileResource'][_0x2227('0x6d')](_0x1686d7,{'raw':!![],'transaction':_0x1366de});});}})[_0x2227('0x47')](handleError(_0x4599ab,null));});}})['then'](function(_0x1b140f){var _0x46e518=_[_0x2227('0x2e')](_0x1b140f,function(_0x27b1b9){return _0x27b1b9[_0x2227('0x4f')]({'plain':!![]});});})[_0x2227('0x2a')](respondWithResult(_0x4599ab,null))[_0x2227('0x47')](handleError(_0x4599ab,null));};exports[_0x2227('0x6e')]=function(_0x5e7ae7,_0x30431e,_0x26645a){return db[_0x2227('0x48')][_0x2227('0x49')]({'where':{'id':_0x5e7ae7[_0x2227('0x4d')]['id']}})[_0x2227('0x2a')](handleEntityNotFound(_0x30431e,null))['then'](function(_0x2c113c){if(_0x2c113c){return _0x2c113c[_0x2227('0x6e')](_0x5e7ae7[_0x2227('0x34')][_0x2227('0x60')]);}})[_0x2227('0x2a')](respondWithStatusCode(_0x30431e,null))[_0x2227('0x47')](handleError(_0x30431e,null));};exports[_0x2227('0x6f')]=function(_0x2cf763,_0x5072b){var _0x4537d8={};if(!_0x2cf763[_0x2227('0x34')][_0x2227('0x70')])throw new Error('Missing\x20section\x20parameter');if(!_0x2cf763[_0x2227('0x34')][_0x2227('0x3a')](_0x2227('0x3b'))){_0x4537d8[_0x2227('0x23')]=qs[_0x2227('0x23')](_0x2cf763[_0x2227('0x34')][_0x2227('0x23')]);_0x4537d8[_0x2227('0x21')]=qs[_0x2227('0x21')](_0x2cf763[_0x2227('0x34')]['offset']);}return db[_0x2227('0x48')][_0x2227('0x49')]({'where':{'id':_0x2cf763[_0x2227('0x4d')]['id']}})[_0x2227('0x2a')](function(_0x2fdc19){if(!_0x2fdc19)throw new Error(_0x2227('0x71')+_0x2cf763[_0x2227('0x4d')]['id']);return db[_0x2227('0x48')]['getResources'](_0x2cf763);})[_0x2227('0x2a')](respondWithFilteredResult(_0x5072b,_0x4537d8))[_0x2227('0x47')](handleError(_0x5072b,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index a20cfc4..0355da1 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 _0x1261=['update','remove','hasOwnProperty','hook','../../mysqldb','UserProfile','setMaxListeners','save'];(function(_0x32d655,_0x252a9c){var _0x4110e0=function(_0x58943c){while(--_0x58943c){_0x32d655['push'](_0x32d655['shift']());}};_0x4110e0(++_0x252a9c);}(_0x1261,0x144));var _0x1126=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0x1261[_0x62c958];return _0x57ec61;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x1126('0x0'))['db'][_0x1126('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x1126('0x2')](0x0);var events={'afterCreate':_0x1126('0x3'),'afterUpdate':_0x1126('0x4'),'afterDestroy':_0x1126('0x5')};function emitEvent(_0x3cc93f){return function(_0x4245ca,_0x21a480,_0x75a851){UserProfileEvents['emit'](_0x3cc93f+':'+_0x4245ca['id'],_0x4245ca);UserProfileEvents['emit'](_0x3cc93f,_0x4245ca);_0x75a851(null);};}for(var e in events){if(events[_0x1126('0x6')](e)){var event=events[e];UserProfile[_0x1126('0x7')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0xf69c=['exports','events','UserProfile','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0x3c8662,_0x482cea){var _0x9d1687=function(_0x24b4e4){while(--_0x24b4e4){_0x3c8662['push'](_0x3c8662['shift']());}};_0x9d1687(++_0x482cea);}(_0xf69c,0x151));var _0xcf69=function(_0x2b3dfe,_0x2e9db2){_0x2b3dfe=_0x2b3dfe-0x0;var _0xe18ef1=_0xf69c[_0x2b3dfe];return _0xe18ef1;};'use strict';var EventEmitter=require(_0xcf69('0x0'));var UserProfile=require('../../mysqldb')['db'][_0xcf69('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xcf69('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcf69('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3a8abe){return function(_0x52fc37,_0x4b315a,_0x4d8180){UserProfileEvents[_0xcf69('0x4')](_0x3a8abe+':'+_0x52fc37['id'],_0x52fc37);UserProfileEvents[_0xcf69('0x4')](_0x3a8abe,_0x52fc37);_0x4d8180(null);};}for(var e in events){if(events[_0xcf69('0x5')](e)){var event=events[e];UserProfile[_0xcf69('0x6')](e,emitEvent(event));}}module[_0xcf69('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 9d330e2..dffa627 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 _0x5f04=['custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','CmContact','color','tag','ThroughTags','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','lodash','./userProfile.attributes','../../components/parsers/qs','exports','models','filter','field','value','findAll','then','associatedResources','map','catch','model','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','squareprojects','childModel','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','contacts','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','ChatQueue','chatwebsites','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','contexts','VoiceContext','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','agent','role','telephone','VoiceQueues','VoiceQueue','inbound','QueueCampaigns','queue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','MailQueue','mailaccounts','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','queuecampaigns','parentSections','users','agents','telephones','Users','admin','user','Telephones','zendeskaccounts','ZendeskAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','reportId','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','select','ui.','InteractionId','ui.createdAt','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','push','find','params','all','ignore','union','length','rawAttributes','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','filters','pick','merge','key','VIRTUAL','foreignKey','options','autoAssociation','includeAll','include','default'];(function(_0x56da65,_0x52846f){var _0x1fa4e2=function(_0x2c6543){while(--_0x2c6543){_0x56da65['push'](_0x56da65['shift']());}};_0x1fa4e2(++_0x52846f);}(_0x5f04,0xdc));var _0x45f0=function(_0x349148,_0x31eabb){_0x349148=_0x349148-0x0;var _0x2f2b0f=_0x5f04[_0x349148];return _0x2f2b0f;};'use strict';var _=require(_0x45f0('0x0'));var attributes=require(_0x45f0('0x1'));var qs=require(_0x45f0('0x2'));var squel=require('squel');module[_0x45f0('0x3')]=function(_0x3523d1){var _0x239d54=_0x3523d1[_0x45f0('0x4')];function _0x849b(_0x5d0af0,_0x46941f){return new Promise(function(_0x1b81a7,_0x3fd7b0){if(!_0x46941f)return _0x1b81a7(null);var _0x55a436=_0x46941f[_0x45f0('0x5')]?{[_0x46941f['filter'][_0x45f0('0x6')]]:_0x46941f[_0x45f0('0x5')][_0x45f0('0x7')]}:undefined;return _0x239d54[_0x5d0af0][_0x45f0('0x8')]({'where':_0x55a436,'raw':!![]})[_0x45f0('0x9')](function(_0x4beeb3){_0x46941f[_0x45f0('0xa')]=_[_0x45f0('0xb')](_0x4beeb3,'id');_0x1b81a7(_0x46941f);})[_0x45f0('0xc')](function(_0x46fe20){_0x3fd7b0(_0x46fe20);});});}function _0x313084(_0x1bfd14,_0x3a5c91){return new Promise(function(_0x40b832,_0x1bfcd4){var _0x88657d=_0x1bfd14[_0x45f0('0x5')]?{[_0x1bfd14[_0x45f0('0x5')]['field']]:_0x1bfd14[_0x45f0('0x5')][_0x45f0('0x7')]}:undefined;return _0x239d54[_0x1bfd14[_0x45f0('0xd')]][_0x45f0('0x8')]({'where':_0x88657d,'raw':!![]})[_0x45f0('0x9')](function(_0x5ef2d5){_0x3a5c91[_0x45f0('0xa')]=_[_0x45f0('0xb')](_0x5ef2d5,function(_0x55a8db){return _0x55a8db[_0x45f0('0xe')];});_0x40b832(_0x3a5c91);})[_0x45f0('0xc')](function(_0x1386cb){_0x1bfcd4(_0x1386cb);});});}function _0x50433b(_0x2a682e,_0x47b18b,_0x56c3f7){if(!_0x47b18b)return Promise[_0x45f0('0xf')](null);return new Promise(function(_0x394ac3,_0x209d36){return _0x239d54[_0x45f0('0x10')]['findAll']({'where':{'sectionId':_0x47b18b['id']},'raw':!![]})[_0x45f0('0x9')](function(_0x5c9ad0){if(_0x2a682e['field']&&_0x2a682e['field']!=='id'){_0x47b18b[_0x45f0('0xa')]=_[_0x45f0('0xb')](_0x5c9ad0,function(_0x49c253){return _0x49c253[_0x2a682e[_0x45f0('0x6')]];});}else{if(_0x56c3f7===_0x45f0('0x11')){_0x47b18b['associatedResources']=_[_0x45f0('0xb')](_0x5c9ad0,function(_0x4541bc){return{'id':_0x4541bc[_0x45f0('0x12')],'type':_0x4541bc[_0x45f0('0x13')]};});}else{_0x47b18b['associatedResources']=_['map'](_0x5c9ad0,function(_0x5a1fa9){return _0x5a1fa9[_0x45f0('0x12')];});}}_0x394ac3(_0x47b18b);})[_0x45f0('0xc')](function(_0x3a2153){_0x209d36(_0x3a2153);});});}function _0x3d4e32(_0x459414,_0x5e833a){var _0x35683a={'parentSections':[]};switch(_0x459414['toLowerCase']()){case _0x45f0('0x14'):_0x35683a[_0x45f0('0x15')]='SquareProject';break;case _0x45f0('0x16'):_0x35683a[_0x45f0('0x15')]=_0x45f0('0x17');break;case _0x45f0('0x18'):_0x35683a[_0x45f0('0x15')]=_0x45f0('0x19');_0x35683a['parentSections']=[{'name':_0x45f0('0x1a'),'field':_0x45f0('0xe'),'foreignKey':_0x45f0('0x1b')}];break;case _0x45f0('0x1c'):_0x35683a[_0x45f0('0x15')]=_0x45f0('0x1d');break;case _0x45f0('0x1e'):_0x35683a[_0x45f0('0x15')]='CmContact';_0x35683a['parentSections']=[{'name':_0x45f0('0x1f'),'field':'id','foreignKey':_0x45f0('0x20')}];break;case _0x45f0('0x21'):_0x35683a['childModel']=_0x45f0('0x22');break;case _0x45f0('0x23'):_0x35683a[_0x45f0('0x15')]=_0x45f0('0x24');break;case _0x45f0('0x25'):_0x35683a[_0x45f0('0x15')]=_0x45f0('0x26');break;case'chatqueues':_0x35683a['childModel']=_0x45f0('0x27');break;case _0x45f0('0x28'):_0x35683a['childModel']='ChatWebsite';break;case'faxqueues':_0x35683a['childModel']=_0x45f0('0x29');break;case _0x45f0('0x2a'):_0x35683a[_0x45f0('0x15')]=_0x45f0('0x2b');break;case _0x45f0('0x2c'):case _0x45f0('0x2d'):case _0x45f0('0x2e'):_0x35683a['childModel']='VoiceExtension';break;case _0x45f0('0x2f'):_0x35683a[_0x45f0('0x15')]=_0x45f0('0x30');break;case'voicemails':_0x35683a[_0x45f0('0x15')]=_0x45f0('0x31');break;case _0x45f0('0x32'):_0x35683a[_0x45f0('0x15')]=_0x45f0('0x33');_0x35683a['parentSections']=[{'name':_0x45f0('0x34'),'field':_0x45f0('0xe'),'foreignKey':_0x45f0('0x35'),'model':_0x45f0('0x36'),'filter':{'field':'role','value':[_0x45f0('0x37')]}},{'name':'Telephones','field':_0x45f0('0xe'),'foreignKey':_0x45f0('0x35'),'model':_0x45f0('0x36'),'filter':{'field':_0x45f0('0x38'),'value':[_0x45f0('0x39')]}},{'name':_0x45f0('0x3a'),'field':_0x45f0('0xe'),'foreignKey':'queue','model':_0x45f0('0x3b'),'filter':{'field':_0x45f0('0x13'),'value':[_0x45f0('0x3c')]}},{'name':_0x45f0('0x3d'),'field':_0x45f0('0xe'),'foreignKey':_0x45f0('0x3e'),'model':'VoiceQueue','filter':{'field':'type','value':[_0x45f0('0x3f')]}}];break;case _0x45f0('0x40'):_0x35683a['childModel']=_0x45f0('0x41');break;case _0x45f0('0x42'):_0x35683a[_0x45f0('0x15')]=_0x45f0('0x43');break;case _0x45f0('0x44'):_0x35683a[_0x45f0('0x15')]=_0x45f0('0x45');break;case _0x45f0('0x46'):_0x35683a[_0x45f0('0x15')]=_0x45f0('0x47');break;case'mailqueues':_0x35683a['childModel']=_0x45f0('0x48');break;case _0x45f0('0x49'):_0x35683a[_0x45f0('0x15')]='MailAccount';break;case'mailsubstatuses':_0x35683a[_0x45f0('0x15')]='MailSubstatus';break;case'openchannelqueues':_0x35683a[_0x45f0('0x15')]=_0x45f0('0x4a');break;case _0x45f0('0x4b'):_0x35683a[_0x45f0('0x15')]=_0x45f0('0x4c');break;case'smsqueues':_0x35683a[_0x45f0('0x15')]=_0x45f0('0x4d');break;case'smsaccounts':_0x35683a[_0x45f0('0x15')]=_0x45f0('0x4e');break;case _0x45f0('0x4f'):_0x35683a['childModel']=_0x45f0('0x50');break;case _0x45f0('0x51'):_0x35683a[_0x45f0('0x15')]=_0x45f0('0x52');break;case _0x45f0('0x53'):_0x35683a[_0x45f0('0x15')]=_0x45f0('0x54');break;case'voicequeues':case _0x45f0('0x55'):_0x35683a['childModel']=_0x45f0('0x3b');if(_0x5e833a){_0x35683a[_0x45f0('0x56')]=[{'name':'VoiceQueues'},{'name':_0x45f0('0x3d')}];}break;case _0x45f0('0x57'):case _0x45f0('0x58'):case _0x45f0('0x59'):_0x35683a[_0x45f0('0x15')]=_0x45f0('0x36');if(_0x5e833a){_0x35683a[_0x45f0('0x56')]=[{'name':_0x45f0('0x5a'),'filter':{'field':'role','value':[_0x45f0('0x5b'),_0x45f0('0x5c')]},'ignore':!![]},{'name':_0x45f0('0x34')},{'name':_0x45f0('0x5d')}];}break;case _0x45f0('0x5e'):_0x35683a[_0x45f0('0x15')]=_0x45f0('0x5f');break;case'salesforceaccounts':_0x35683a['childModel']='SalesforceAccount';break;case _0x45f0('0x60'):_0x35683a[_0x45f0('0x15')]='FreshdeskAccount';break;case _0x45f0('0x61'):_0x35683a[_0x45f0('0x15')]=_0x45f0('0x62');break;case _0x45f0('0x63'):_0x35683a[_0x45f0('0x15')]='DeskAccount';break;case _0x45f0('0x64'):_0x35683a[_0x45f0('0x15')]=_0x45f0('0x65');break;case _0x45f0('0x66'):_0x35683a[_0x45f0('0x15')]=_0x45f0('0x36');break;case _0x45f0('0x67'):_0x35683a[_0x45f0('0x15')]='CannedAnswer';break;case _0x45f0('0x68'):_0x35683a[_0x45f0('0x15')]='Disposition';break;case'customdashboards':_0x35683a[_0x45f0('0x15')]='Dashboard';break;case _0x45f0('0x69'):_0x35683a[_0x45f0('0x15')]=_0x45f0('0x6a');break;case _0x45f0('0x6b'):_0x35683a[_0x45f0('0x15')]=_0x45f0('0x6c');break;case _0x45f0('0x6d'):_0x35683a['childModel']=_0x45f0('0x6e');break;case _0x45f0('0x6f'):_0x35683a[_0x45f0('0x15')]=_0x45f0('0x70');break;case _0x45f0('0x71'):_0x35683a[_0x45f0('0x15')]=_0x45f0('0x72');break;case _0x45f0('0x73'):_0x35683a['childModel']=_0x45f0('0x74');break;case _0x45f0('0x75'):_0x35683a[_0x45f0('0x15')]=_0x45f0('0x76');break;case _0x45f0('0x77'):_0x35683a[_0x45f0('0x15')]=_0x45f0('0x78');break;case _0x45f0('0x79'):_0x35683a[_0x45f0('0x15')]=_0x45f0('0x7a');break;case _0x45f0('0x7b'):_0x35683a['childModel']=_0x45f0('0x7c');break;case _0x45f0('0x7d'):_0x35683a[_0x45f0('0x15')]='AnalyticExtractedReport';_0x35683a['parentSections']=[{'name':_0x45f0('0x7e'),'field':'id','foreignKey':_0x45f0('0x7f')}];break;case'metrics':_0x35683a['childModel']=_0x45f0('0x80');break;}return _0x35683a;}function _0x123bad(_0x5d7374,_0x54b286){var _0x160f0f=_0x5d7374[_0x45f0('0x81')](0x0)[_0x45f0('0x82')]()+_0x5d7374[_0x45f0('0x83')](0x1);var _0x3bc801={'type':_0x239d54[_0x45f0('0x84')][_0x45f0('0x85')]['SELECT'],'raw':!![]};return new Promise(function(_0x1c8912,_0x1b0fdf){var _0x370d43=squel[_0x45f0('0x86')]()[_0x45f0('0x6')](_0x45f0('0x87')+_0x160f0f+_0x45f0('0x88'),'id')[_0x45f0('0x6')](_0x45f0('0x89'))['from']('user_has_'+_0x5d7374+_0x45f0('0x8a'),'ui')[_0x45f0('0x8b')](_0x45f0('0x8c'),_0x54b286['id']);return _0x239d54[_0x45f0('0x8d')][_0x45f0('0x8e')](_0x370d43[_0x45f0('0x8f')](),_0x3bc801)[_0x45f0('0x9')](function(_0x4f538c){_0x54b286[_0x160f0f+_0x45f0('0x90')]=_0x4f538c;_0x1c8912(_0x4f538c);})['catch'](function(_0x4d9df7){_0x1b0fdf(_0x4d9df7);});});}return _0x3523d1[_0x45f0('0x91')](_0x45f0('0x92'),attributes,{'tableName':_0x45f0('0x93'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x3f679d){var _0x17ddfb={'raw':_0x3f679d['query'][_0x45f0('0x94')],'where':{}};var _0x4f67f9={};var _0x1208ac={'count':0x0,'rows':[]};var _0x432478=_0x3f679d[_0x45f0('0x8e')][_0x45f0('0x95')];var _0x13f48d=_0x3f679d[_0x45f0('0x8e')][_0x45f0('0x96')]||![];var _0x385864=_0x3d4e32(_0x432478,_0x13f48d);if(!_0x385864[_0x45f0('0x15')])throw new Error(_0x45f0('0x97')+_0x432478+'\x27');var _0x3377cb=[{'name':_0x432478}];if(!_[_0x45f0('0x98')](_0x385864[_0x45f0('0x56')]))_0x3377cb=_0x385864[_0x45f0('0x56')];var _0x8922c3=[];for(var _0x438985=0x0;_0x438985<_0x3377cb['length'];_0x438985++){_0x8922c3[_0x45f0('0x99')](_0x239d54['UserProfileSection'][_0x45f0('0x9a')]({'where':{'userProfileId':_0x3f679d[_0x45f0('0x9b')]['id'],'name':_0x3377cb[_0x438985]['name']},'raw':!![]}));}return Promise[_0x45f0('0x9c')](_0x8922c3)[_0x45f0('0x9')](function(_0x5c82b3){var _0x1571be=_[_0x45f0('0x5')](_0x5c82b3,function(_0x1a0c9b){return _0x1a0c9b?_0x1a0c9b:undefined;});var _0x37e34a=_[_0x45f0('0x5')](_0x3377cb,[_0x45f0('0x9d'),!![]]);var _0x52362a=_[_0x45f0('0x98')](_0x1571be)&&_[_0x45f0('0x98')](_0x37e34a)?null:_[_0x45f0('0x9e')](_0x37e34a,_0x1571be);if(!_0x52362a)return null;var _0x441a89=[];for(var _0x2d1cec=0x0;_0x2d1cec<_0x52362a[_0x45f0('0x9f')];_0x2d1cec++){var _0x692dd6=_['find'](_0x3377cb,function(_0x40aa30){return _0x52362a[_0x2d1cec]?_0x40aa30[_0x45f0('0xe')]===_0x52362a[_0x2d1cec][_0x45f0('0xe')]:null;});if(_0x692dd6){if(_0x52362a[_0x2d1cec]['ignore']){_0x441a89['push'](_0x849b(_0x385864[_0x45f0('0x15')],_0x52362a[_0x2d1cec]));}else{if(!_0x52362a[_0x2d1cec]['autoAssociation']){_0x441a89[_0x45f0('0x99')](_0x50433b(_0x692dd6,_0x52362a[_0x2d1cec],_0x385864[_0x45f0('0x15')]));}else{if(_0x692dd6[_0x45f0('0xd')]){_0x441a89['push'](_0x313084(_0x692dd6,_0x52362a[_0x2d1cec]));}}}}}return Promise[_0x45f0('0x9c')](_0x441a89);})[_0x45f0('0x9')](function(_0x370084){var _0x3832f9=_0x370084;var _0x5a45e5=null;if(_0x3832f9){_0x5a45e5=_0x3832f9[_0x45f0('0x9f')]===0x1?_0x3832f9[0x0]:null;}if(!_0x5a45e5&&!_0x3832f9)return _0x1208ac;var _0x24cad0=_0x239d54[_0x385864['childModel']][_0x45f0('0xa0')];_0x4f67f9[_0x45f0('0xd')]=_['keys'](_0x24cad0);_0x4f67f9['query']=_[_0x45f0('0xa1')](_0x3f679d[_0x45f0('0x8e')]);_0x4f67f9['filters']=_[_0x45f0('0xa2')](_0x4f67f9['model'],_0x4f67f9['query']);_0x17ddfb[_0x45f0('0xa3')]=_[_0x45f0('0xa2')](_0x4f67f9[_0x45f0('0xd')],qs[_0x45f0('0xa4')](_0x3f679d[_0x45f0('0x8e')]['fields']));_0x17ddfb[_0x45f0('0xa3')]=_0x17ddfb[_0x45f0('0xa3')][_0x45f0('0x9f')]?_0x17ddfb[_0x45f0('0xa3')]:_0x4f67f9[_0x45f0('0xd')];if(!_0x3f679d['query'][_0x45f0('0xa5')](_0x45f0('0xa6'))){_0x17ddfb['limit']=qs[_0x45f0('0xa7')](_0x3f679d[_0x45f0('0x8e')][_0x45f0('0xa7')]);_0x17ddfb[_0x45f0('0xa8')]=qs['offset'](_0x3f679d[_0x45f0('0x8e')][_0x45f0('0xa8')]);}_0x17ddfb[_0x45f0('0xa9')]=qs[_0x45f0('0xaa')](_0x3f679d[_0x45f0('0x8e')][_0x45f0('0xaa')]);_0x17ddfb['where']=qs[_0x45f0('0xab')](_[_0x45f0('0xac')](_0x3f679d[_0x45f0('0x8e')],_0x4f67f9[_0x45f0('0xab')]));if(_0x3f679d[_0x45f0('0x8e')]['filter']){_0x17ddfb[_0x45f0('0x8b')]=_[_0x45f0('0xad')](_0x17ddfb[_0x45f0('0x8b')],{'$or':_[_0x45f0('0xb')](_0x24cad0,function(_0x447278){if(_0x447278[_0x45f0('0x13')][_0x45f0('0xae')]!==_0x45f0('0xaf')){var _0x29cd09={};_0x29cd09[_0x447278[_0x45f0('0x6')]]={'$like':'%'+_0x3f679d['query'][_0x45f0('0x5')]+'%'};return _0x29cd09;}})});}var _0x2a6a1f=[];var _0x417b0b=null;var _0x615faf={};if(_0x5a45e5){_0x417b0b=_[_0x45f0('0x9a')](_0x3377cb,[_0x45f0('0xe'),_0x5a45e5[_0x45f0('0xe')]]);if(_0x417b0b['field']){_0x615faf={};if(_0x385864[_0x45f0('0x15')]===_0x45f0('0x11')){_0x615faf[_0x417b0b['foreignKey']]=_[_0x45f0('0xb')](_0x5a45e5[_0x45f0('0xa')],'id');}else{_0x615faf[_0x417b0b[_0x45f0('0xb0')]]=_0x5a45e5['associatedResources'];}_0x2a6a1f['push'](_0x615faf);}else{_0x17ddfb[_0x45f0('0x8b')]['id']=_0x5a45e5[_0x45f0('0xa')];}}else{for(var _0x296d9e=0x0;_0x296d9e<_0x3832f9[_0x45f0('0x9f')];_0x296d9e++){_0x417b0b=_[_0x45f0('0x9a')](_0x3377cb,[_0x45f0('0xe'),_0x3832f9[_0x296d9e][_0x45f0('0xe')]]);if(_0x417b0b[_0x45f0('0x6')]){_0x615faf={};_0x615faf[_0x417b0b['foreignKey']]=_0x3832f9[_0x296d9e][_0x45f0('0xa')];_0x2a6a1f[_0x45f0('0x99')](_0x615faf);}else{if(!_0x17ddfb[_0x45f0('0x8b')]['id'])_0x17ddfb[_0x45f0('0x8b')]['id']=[];_0x3832f9[_0x296d9e][_0x45f0('0xa')]['forEach'](function(_0x63008c){_0x17ddfb[_0x45f0('0x8b')]['id'][_0x45f0('0x99')](_0x63008c);});}}}if(!_[_0x45f0('0x98')](_0x2a6a1f)){_0x17ddfb[_0x45f0('0x8b')]=_[_0x45f0('0xad')](_0x17ddfb[_0x45f0('0x8b')],{'$and':{'$or':_0x2a6a1f}});}_0x17ddfb=_[_0x45f0('0xad')]({},_0x17ddfb,_0x3f679d[_0x45f0('0xb1')]);if(_0x5a45e5&&!_0x5a45e5[_0x45f0('0xb2')]&&_0x385864[_0x45f0('0x15')]===_0x45f0('0x11')){if(_0x3f679d['query'][_0x45f0('0xb3')]){_0x17ddfb[_0x45f0('0xb4')]=[{'all':!![]}];}return _0x239d54[_0x385864[_0x45f0('0x15')]][_0x45f0('0x8')](_0x17ddfb)['then'](function(_0x4ab0b1){var _0x233777=[];_0x4ab0b1['forEach'](function(_0xc0d5e3){var _0x21ab37;switch(_0xc0d5e3['reportType']){case _0x45f0('0xb5'):_0x21ab37=_[_0x45f0('0x9a')](_0x5a45e5['associatedResources'],function(_0x778939){return _0x778939['id']===_0xc0d5e3[_0x45f0('0x7f')]&&_0x778939['type']==='DefaultReports';});break;case _0x45f0('0xb6'):_0x21ab37=_[_0x45f0('0x9a')](_0x5a45e5[_0x45f0('0xa')],function(_0x75c31a){return _0x75c31a['id']===_0xc0d5e3[_0x45f0('0x7f')]&&_0x75c31a[_0x45f0('0x13')]===_0x45f0('0xb7');});break;}if(_0x21ab37)_0x233777[_0x45f0('0x99')](_0xc0d5e3);});_0x1208ac[_0x45f0('0xb8')]=_0x233777[_0x45f0('0x9f')];_0x1208ac[_0x45f0('0xb9')]=_0x233777;return _0x1208ac;});}else{if(!_['isEmpty'](_0x3f679d[_0x45f0('0x8e')][_0x45f0('0xba')])){_0x17ddfb[_0x45f0('0x8b')]['id']=_0x17ddfb[_0x45f0('0x8b')]['id']?_[_0x45f0('0xa2')](_0x17ddfb[_0x45f0('0x8b')]['id'],_0x3f679d[_0x45f0('0x8e')]['ids']):_0x3f679d[_0x45f0('0x8e')][_0x45f0('0xba')];if(_0x3f679d[_0x45f0('0x8e')][_0x45f0('0xbb')]){_0x17ddfb[_0x45f0('0xa9')]=_0x3f679d[_0x45f0('0x8e')]['customSorting'];}}if(_0x3f679d[_0x45f0('0x8e')][_0x45f0('0xbc')]){_0x17ddfb[_0x45f0('0x8b')]=_[_0x45f0('0xad')](_0x17ddfb[_0x45f0('0x8b')],{'$and':_0x3f679d[_0x45f0('0x8e')][_0x45f0('0xbc')]});}return _0x239d54[_0x385864[_0x45f0('0x15')]]['count']({'where':_0x17ddfb[_0x45f0('0x8b')]})[_0x45f0('0x9')](function(_0x4fa0ec){_0x1208ac['count']=_0x4fa0ec;if(_0x3f679d[_0x45f0('0x8e')][_0x45f0('0xb3')]){if(_0x385864['childModel']===_0x45f0('0xbd')){_0x17ddfb['include']=[{'model':_0x239d54[_0x45f0('0x72')],'as':'Tags','attributes':['id','name',_0x45f0('0xbe')],'required':_0x3f679d['query'][_0x45f0('0xbf')]?!![]:![]},{'model':_0x239d54[_0x45f0('0x72')],'as':_0x45f0('0xc0'),'attributes':['id',_0x45f0('0xe'),_0x45f0('0xbe')],'through':_0x3f679d['query']['tag']?{'attributes':[],'where':{'TagId':_0x3f679d[_0x45f0('0x8e')][_0x45f0('0xbf')]||undefined}}:{},'required':_0x3f679d[_0x45f0('0x8e')][_0x45f0('0xbf')]?!![]:![]}];}else{_0x17ddfb[_0x45f0('0xb4')]=[{'all':!![]}];}}return _0x239d54[_0x385864[_0x45f0('0x15')]][_0x45f0('0x8')](_0x17ddfb);})['then'](function(_0x14ee0a){_0x1208ac['rows']=_0x14ee0a;if(_0x432478==='Agents'&&_0x3f679d[_0x45f0('0x8e')][_0x45f0('0xc1')]===_0x45f0('0xc2')){var _0x420c64=[];for(var _0x5aad05=0x0;_0x5aad05<_0x1208ac[_0x45f0('0xb9')][_0x45f0('0x9f')];_0x5aad05++){_0x420c64['push'](_0x123bad(_0x45f0('0xc3'),_0x1208ac['rows'][_0x5aad05][_0x45f0('0xc4')]));_0x420c64[_0x45f0('0x99')](_0x123bad(_0x45f0('0xc5'),_0x1208ac[_0x45f0('0xb9')][_0x5aad05]['dataValues']));_0x420c64[_0x45f0('0x99')](_0x123bad(_0x45f0('0xc6'),_0x1208ac['rows'][_0x5aad05]['dataValues']));_0x420c64['push'](_0x123bad(_0x45f0('0xc7'),_0x1208ac['rows'][_0x5aad05][_0x45f0('0xc4')]));_0x420c64[_0x45f0('0x99')](_0x123bad(_0x45f0('0xc8'),_0x1208ac[_0x45f0('0xb9')][_0x5aad05]['dataValues']));_0x420c64[_0x45f0('0x99')](_0x123bad('whatsapp',_0x1208ac[_0x45f0('0xb9')][_0x5aad05][_0x45f0('0xc4')]));}return Promise['all'](_0x420c64)[_0x45f0('0x9')](function(){return _0x1208ac;});}return _0x1208ac;});}});}}});}; \ No newline at end of file +var _0x69d7=['zohoaccounts','ZohoAccount','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','variables','Variable','plugins','extractedreports','reportId','charAt','toUpperCase','slice','Sequelize','QueryTypes','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','toString','OpenTabs','UserProfile','user_profiles','raw','query','section','mergeResources','isEmpty','length','push','find','params','all','ignore','autoAssociation','model','rawAttributes','keys','filters','intersection','attributes','fields','limit','offset','order','sort','pick','merge','VIRTUAL','foreignKey','forEach','includeAll','include','reportType','DefaultReports','CustomReports','count','rows','ids','customSorting','extraQueryConditions','Tags','color','tag','openTabs','true','chat','dataValues','sms','fax','mail','whatsapp','../../components/parsers/qs','squel','exports','models','filter','field','value','findAll','then','associatedResources','map','catch','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','SquareProject','childModel','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','lists','companies','CmCompany','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','Agents','User','agent','Telephones','membername','telephone','VoiceQueues','VoiceQueue','inbound','queue','outbound','musiconholds','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','WhatsappQueue','whatsappaccounts','Team','voicequeues','queuecampaigns','QueueCampaigns','users','agents','telephones','Users','role','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','DeskAccount'];(function(_0x44d860,_0x175739){var _0x5b4295=function(_0x165bd2){while(--_0x165bd2){_0x44d860['push'](_0x44d860['shift']());}};_0x5b4295(++_0x175739);}(_0x69d7,0x1de));var _0x769d=function(_0x2637b0,_0x3b8d5a){_0x2637b0=_0x2637b0-0x0;var _0x1037b1=_0x69d7[_0x2637b0];return _0x1037b1;};'use strict';var _=require('lodash');var attributes=require('./userProfile.attributes');var qs=require(_0x769d('0x0'));var squel=require(_0x769d('0x1'));module[_0x769d('0x2')]=function(_0x11ac1a){var _0x198d0f=_0x11ac1a[_0x769d('0x3')];function _0xb5189a(_0x26b8c7,_0x2d0f83){return new Promise(function(_0x3f28b8,_0x50110a){if(!_0x2d0f83)return _0x3f28b8(null);var _0x57a6ea=_0x2d0f83[_0x769d('0x4')]?{[_0x2d0f83[_0x769d('0x4')][_0x769d('0x5')]]:_0x2d0f83[_0x769d('0x4')][_0x769d('0x6')]}:undefined;return _0x198d0f[_0x26b8c7][_0x769d('0x7')]({'where':_0x57a6ea,'raw':!![]})[_0x769d('0x8')](function(_0x407da7){_0x2d0f83[_0x769d('0x9')]=_[_0x769d('0xa')](_0x407da7,'id');_0x3f28b8(_0x2d0f83);})[_0x769d('0xb')](function(_0x225507){_0x50110a(_0x225507);});});}function _0x3b7a4c(_0x1959d4,_0x42f428){return new Promise(function(_0x57a66d,_0x4072ff){var _0x1427fa=_0x1959d4[_0x769d('0x4')]?{[_0x1959d4[_0x769d('0x4')]['field']]:_0x1959d4[_0x769d('0x4')][_0x769d('0x6')]}:undefined;return _0x198d0f[_0x1959d4['model']][_0x769d('0x7')]({'where':_0x1427fa,'raw':!![]})[_0x769d('0x8')](function(_0x18804a){_0x42f428[_0x769d('0x9')]=_[_0x769d('0xa')](_0x18804a,function(_0xbb2408){return _0xbb2408[_0x769d('0xc')];});_0x57a66d(_0x42f428);})['catch'](function(_0x47eaad){_0x4072ff(_0x47eaad);});});}function _0x5bb77b(_0x18b587,_0x171c8c,_0x55843c){if(!_0x171c8c)return Promise[_0x769d('0xd')](null);return new Promise(function(_0x1e4645,_0x369751){return _0x198d0f[_0x769d('0xe')][_0x769d('0x7')]({'where':{'sectionId':_0x171c8c['id']},'raw':!![]})[_0x769d('0x8')](function(_0x53c438){if(_0x18b587[_0x769d('0x5')]&&_0x18b587[_0x769d('0x5')]!=='id'){_0x171c8c['associatedResources']=_['map'](_0x53c438,function(_0x3ffc38){return _0x3ffc38[_0x18b587[_0x769d('0x5')]];});}else{if(_0x55843c===_0x769d('0xf')){_0x171c8c['associatedResources']=_[_0x769d('0xa')](_0x53c438,function(_0x2b64c4){return{'id':_0x2b64c4[_0x769d('0x10')],'type':_0x2b64c4[_0x769d('0x11')]};});}else{_0x171c8c[_0x769d('0x9')]=_['map'](_0x53c438,function(_0x421b7a){return _0x421b7a[_0x769d('0x10')];});}}_0x1e4645(_0x171c8c);})[_0x769d('0xb')](function(_0x4c82ec){_0x369751(_0x4c82ec);});});}function _0x4e224a(_0xafc209,_0x163130){var _0x139800={'parentSections':[]};switch(_0xafc209[_0x769d('0x12')]()){case _0x769d('0x13'):_0x139800['childModel']=_0x769d('0x14');break;case'odbc':_0x139800[_0x769d('0x15')]=_0x769d('0x16');break;case _0x769d('0x17'):_0x139800[_0x769d('0x15')]=_0x769d('0x18');_0x139800[_0x769d('0x19')]=[{'name':_0x769d('0x1a'),'field':'name','foreignKey':_0x769d('0x1b')}];break;case _0x769d('0x1c'):_0x139800['childModel']=_0x769d('0x1d');break;case _0x769d('0x1e'):_0x139800['childModel']=_0x769d('0x1f');_0x139800[_0x769d('0x19')]=[{'name':'Lists','field':'id','foreignKey':'ListId'}];break;case _0x769d('0x20'):_0x139800[_0x769d('0x15')]='CmList';break;case _0x769d('0x21'):_0x139800[_0x769d('0x15')]=_0x769d('0x22');break;case'globalcustomfields':_0x139800[_0x769d('0x15')]=_0x769d('0x23');break;case _0x769d('0x24'):_0x139800[_0x769d('0x15')]=_0x769d('0x25');break;case _0x769d('0x26'):_0x139800[_0x769d('0x15')]=_0x769d('0x27');break;case _0x769d('0x28'):_0x139800[_0x769d('0x15')]=_0x769d('0x29');break;case _0x769d('0x2a'):_0x139800['childModel']=_0x769d('0x2b');break;case _0x769d('0x2c'):case _0x769d('0x2d'):case _0x769d('0x2e'):_0x139800[_0x769d('0x15')]='VoiceExtension';break;case _0x769d('0x2f'):_0x139800[_0x769d('0x15')]=_0x769d('0x30');break;case _0x769d('0x31'):_0x139800[_0x769d('0x15')]=_0x769d('0x32');break;case _0x769d('0x33'):_0x139800[_0x769d('0x15')]='VoiceRecording';_0x139800['parentSections']=[{'name':_0x769d('0x34'),'field':_0x769d('0xc'),'foreignKey':'membername','model':_0x769d('0x35'),'filter':{'field':'role','value':[_0x769d('0x36')]}},{'name':_0x769d('0x37'),'field':_0x769d('0xc'),'foreignKey':_0x769d('0x38'),'model':_0x769d('0x35'),'filter':{'field':'role','value':[_0x769d('0x39')]}},{'name':_0x769d('0x3a'),'field':'name','foreignKey':'queue','model':_0x769d('0x3b'),'filter':{'field':_0x769d('0x11'),'value':[_0x769d('0x3c')]}},{'name':'QueueCampaigns','field':'name','foreignKey':_0x769d('0x3d'),'model':_0x769d('0x3b'),'filter':{'field':_0x769d('0x11'),'value':[_0x769d('0x3e')]}}];break;case _0x769d('0x3f'):_0x139800['childModel']=_0x769d('0x40');break;case'chanspies':_0x139800[_0x769d('0x15')]=_0x769d('0x41');break;case _0x769d('0x42'):_0x139800[_0x769d('0x15')]=_0x769d('0x43');break;case'ivrcampaigns':_0x139800['childModel']=_0x769d('0x44');break;case'mailqueues':_0x139800['childModel']='MailQueue';break;case _0x769d('0x45'):_0x139800[_0x769d('0x15')]=_0x769d('0x46');break;case _0x769d('0x47'):_0x139800[_0x769d('0x15')]=_0x769d('0x48');break;case _0x769d('0x49'):_0x139800[_0x769d('0x15')]='OpenchannelQueue';break;case'openchannelaccounts':_0x139800[_0x769d('0x15')]=_0x769d('0x4a');break;case _0x769d('0x4b'):_0x139800[_0x769d('0x15')]=_0x769d('0x4c');break;case _0x769d('0x4d'):_0x139800[_0x769d('0x15')]=_0x769d('0x4e');break;case'whatsappqueues':_0x139800[_0x769d('0x15')]=_0x769d('0x4f');break;case _0x769d('0x50'):_0x139800[_0x769d('0x15')]='WhatsappAccount';break;case'teams':_0x139800['childModel']=_0x769d('0x51');break;case _0x769d('0x52'):case _0x769d('0x53'):_0x139800[_0x769d('0x15')]=_0x769d('0x3b');if(_0x163130){_0x139800[_0x769d('0x19')]=[{'name':'VoiceQueues'},{'name':_0x769d('0x54')}];}break;case _0x769d('0x55'):case _0x769d('0x56'):case _0x769d('0x57'):_0x139800[_0x769d('0x15')]='User';if(_0x163130){_0x139800['parentSections']=[{'name':_0x769d('0x58'),'filter':{'field':_0x769d('0x59'),'value':[_0x769d('0x5a'),_0x769d('0x5b')]},'ignore':!![]},{'name':_0x769d('0x34')},{'name':'Telephones'}];}break;case _0x769d('0x5c'):_0x139800[_0x769d('0x15')]=_0x769d('0x5d');break;case _0x769d('0x5e'):_0x139800[_0x769d('0x15')]=_0x769d('0x5f');break;case'freshdeskaccounts':_0x139800[_0x769d('0x15')]=_0x769d('0x60');break;case'sugarcrmaccounts':_0x139800['childModel']='SugarcrmAccount';break;case'deskaccounts':_0x139800[_0x769d('0x15')]=_0x769d('0x61');break;case _0x769d('0x62'):_0x139800['childModel']=_0x769d('0x63');break;case'vtigeraccounts':_0x139800[_0x769d('0x15')]=_0x769d('0x35');break;case _0x769d('0x64'):_0x139800[_0x769d('0x15')]=_0x769d('0x65');break;case _0x769d('0x66'):_0x139800[_0x769d('0x15')]=_0x769d('0x67');break;case _0x769d('0x68'):_0x139800[_0x769d('0x15')]=_0x769d('0x69');break;case _0x769d('0x6a'):_0x139800[_0x769d('0x15')]='Interval';break;case _0x769d('0x6b'):_0x139800['childModel']=_0x769d('0x6c');break;case _0x769d('0x6d'):_0x139800[_0x769d('0x15')]=_0x769d('0x6e');break;case _0x769d('0x6f'):_0x139800[_0x769d('0x15')]=_0x769d('0x70');break;case _0x769d('0x71'):_0x139800[_0x769d('0x15')]=_0x769d('0x72');break;case _0x769d('0x73'):_0x139800[_0x769d('0x15')]=_0x769d('0x74');break;case _0x769d('0x75'):_0x139800['childModel']=_0x769d('0x76');break;case _0x769d('0x77'):_0x139800[_0x769d('0x15')]='Trunk';break;case _0x769d('0x78'):_0x139800[_0x769d('0x15')]=_0x769d('0x79');break;case _0x769d('0x7a'):_0x139800[_0x769d('0x15')]='Plugin';break;case _0x769d('0x7b'):_0x139800['childModel']=_0x769d('0xf');_0x139800[_0x769d('0x19')]=[{'name':'Reports','field':'id','foreignKey':_0x769d('0x7c')}];break;case'metrics':_0x139800[_0x769d('0x15')]='AnalyticMetric';break;}return _0x139800;}function _0x140d43(_0x3e6e5a,_0x226229){var _0xf8071f=_0x3e6e5a[_0x769d('0x7d')](0x0)[_0x769d('0x7e')]()+_0x3e6e5a[_0x769d('0x7f')](0x1);var _0x265d79={'type':_0x198d0f[_0x769d('0x80')][_0x769d('0x81')]['SELECT'],'raw':!![]};return new Promise(function(_0x431487,_0xf12c54){var _0x21116f=squel['select']()['field'](_0x769d('0x82')+_0xf8071f+_0x769d('0x83'),'id')['field'](_0x769d('0x84'))[_0x769d('0x85')](_0x769d('0x86')+_0x3e6e5a+_0x769d('0x87'),'ui')[_0x769d('0x88')](_0x769d('0x89'),_0x226229['id']);return _0x198d0f[_0x769d('0x8a')]['query'](_0x21116f[_0x769d('0x8b')](),_0x265d79)[_0x769d('0x8')](function(_0x138fdf){_0x226229[_0xf8071f+_0x769d('0x8c')]=_0x138fdf;_0x431487(_0x138fdf);})[_0x769d('0xb')](function(_0xbbbefa){_0xf12c54(_0xbbbefa);});});}return _0x11ac1a['define'](_0x769d('0x8d'),attributes,{'tableName':_0x769d('0x8e'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x95d536){var _0x421772={'raw':_0x95d536['query'][_0x769d('0x8f')],'where':{}};var _0x16c655={};var _0xdb82f2={'count':0x0,'rows':[]};var _0x1b08ac=_0x95d536[_0x769d('0x90')][_0x769d('0x91')];var _0x449312=_0x95d536[_0x769d('0x90')][_0x769d('0x92')]||![];var _0x554721=_0x4e224a(_0x1b08ac,_0x449312);if(!_0x554721[_0x769d('0x15')])throw new Error('Invalid\x20section\x20\x27'+_0x1b08ac+'\x27');var _0x230e99=[{'name':_0x1b08ac}];if(!_[_0x769d('0x93')](_0x554721[_0x769d('0x19')]))_0x230e99=_0x554721[_0x769d('0x19')];var _0x18f814=[];for(var _0x33b08f=0x0;_0x33b08f<_0x230e99[_0x769d('0x94')];_0x33b08f++){_0x18f814[_0x769d('0x95')](_0x198d0f['UserProfileSection'][_0x769d('0x96')]({'where':{'userProfileId':_0x95d536[_0x769d('0x97')]['id'],'name':_0x230e99[_0x33b08f][_0x769d('0xc')]},'raw':!![]}));}return Promise[_0x769d('0x98')](_0x18f814)[_0x769d('0x8')](function(_0x47e2e4){var _0x1b7717=_['filter'](_0x47e2e4,function(_0x478700){return _0x478700?_0x478700:undefined;});var _0x2f0c8b=_[_0x769d('0x4')](_0x230e99,[_0x769d('0x99'),!![]]);var _0x285c8e=_[_0x769d('0x93')](_0x1b7717)&&_[_0x769d('0x93')](_0x2f0c8b)?null:_['union'](_0x2f0c8b,_0x1b7717);if(!_0x285c8e)return null;var _0x3639a6=[];for(var _0x46b2dc=0x0;_0x46b2dc<_0x285c8e[_0x769d('0x94')];_0x46b2dc++){var _0x38e429=_[_0x769d('0x96')](_0x230e99,function(_0x4127e5){return _0x285c8e[_0x46b2dc]?_0x4127e5[_0x769d('0xc')]===_0x285c8e[_0x46b2dc][_0x769d('0xc')]:null;});if(_0x38e429){if(_0x285c8e[_0x46b2dc][_0x769d('0x99')]){_0x3639a6[_0x769d('0x95')](_0xb5189a(_0x554721[_0x769d('0x15')],_0x285c8e[_0x46b2dc]));}else{if(!_0x285c8e[_0x46b2dc][_0x769d('0x9a')]){_0x3639a6[_0x769d('0x95')](_0x5bb77b(_0x38e429,_0x285c8e[_0x46b2dc],_0x554721[_0x769d('0x15')]));}else{if(_0x38e429[_0x769d('0x9b')]){_0x3639a6[_0x769d('0x95')](_0x3b7a4c(_0x38e429,_0x285c8e[_0x46b2dc]));}}}}}return Promise[_0x769d('0x98')](_0x3639a6);})[_0x769d('0x8')](function(_0x1c64cc){var _0x2938e8=_0x1c64cc;var _0xf83741=null;if(_0x2938e8){_0xf83741=_0x2938e8[_0x769d('0x94')]===0x1?_0x2938e8[0x0]:null;}if(!_0xf83741&&!_0x2938e8)return _0xdb82f2;var _0x1a4c79=_0x198d0f[_0x554721['childModel']][_0x769d('0x9c')];_0x16c655['model']=_[_0x769d('0x9d')](_0x1a4c79);_0x16c655[_0x769d('0x90')]=_[_0x769d('0x9d')](_0x95d536[_0x769d('0x90')]);_0x16c655[_0x769d('0x9e')]=_[_0x769d('0x9f')](_0x16c655[_0x769d('0x9b')],_0x16c655[_0x769d('0x90')]);_0x421772[_0x769d('0xa0')]=_['intersection'](_0x16c655[_0x769d('0x9b')],qs[_0x769d('0xa1')](_0x95d536[_0x769d('0x90')]['fields']));_0x421772[_0x769d('0xa0')]=_0x421772[_0x769d('0xa0')][_0x769d('0x94')]?_0x421772[_0x769d('0xa0')]:_0x16c655[_0x769d('0x9b')];if(!_0x95d536[_0x769d('0x90')]['hasOwnProperty']('nolimit')){_0x421772[_0x769d('0xa2')]=qs['limit'](_0x95d536[_0x769d('0x90')][_0x769d('0xa2')]);_0x421772[_0x769d('0xa3')]=qs[_0x769d('0xa3')](_0x95d536[_0x769d('0x90')][_0x769d('0xa3')]);}_0x421772[_0x769d('0xa4')]=qs[_0x769d('0xa5')](_0x95d536[_0x769d('0x90')][_0x769d('0xa5')]);_0x421772[_0x769d('0x88')]=qs[_0x769d('0x9e')](_[_0x769d('0xa6')](_0x95d536['query'],_0x16c655[_0x769d('0x9e')]));if(_0x95d536[_0x769d('0x90')][_0x769d('0x4')]){_0x421772[_0x769d('0x88')]=_[_0x769d('0xa7')](_0x421772['where'],{'$or':_['map'](_0x1a4c79,function(_0x2fe6a2){if(_0x2fe6a2[_0x769d('0x11')]['key']!==_0x769d('0xa8')){var _0xb6176e={};_0xb6176e[_0x2fe6a2[_0x769d('0x5')]]={'$like':'%'+_0x95d536[_0x769d('0x90')]['filter']+'%'};return _0xb6176e;}})});}var _0x5221cd=[];var _0x19cbd5=null;var _0x2e239a={};if(_0xf83741){_0x19cbd5=_[_0x769d('0x96')](_0x230e99,[_0x769d('0xc'),_0xf83741['name']]);if(_0x19cbd5[_0x769d('0x5')]){_0x2e239a={};if(_0x554721[_0x769d('0x15')]===_0x769d('0xf')){_0x2e239a[_0x19cbd5[_0x769d('0xa9')]]=_[_0x769d('0xa')](_0xf83741[_0x769d('0x9')],'id');}else{_0x2e239a[_0x19cbd5['foreignKey']]=_0xf83741['associatedResources'];}_0x5221cd[_0x769d('0x95')](_0x2e239a);}else{_0x421772[_0x769d('0x88')]['id']=_0xf83741[_0x769d('0x9')];}}else{for(var _0x5167cc=0x0;_0x5167cc<_0x2938e8['length'];_0x5167cc++){_0x19cbd5=_[_0x769d('0x96')](_0x230e99,[_0x769d('0xc'),_0x2938e8[_0x5167cc]['name']]);if(_0x19cbd5['field']){_0x2e239a={};_0x2e239a[_0x19cbd5[_0x769d('0xa9')]]=_0x2938e8[_0x5167cc]['associatedResources'];_0x5221cd[_0x769d('0x95')](_0x2e239a);}else{if(!_0x421772[_0x769d('0x88')]['id'])_0x421772[_0x769d('0x88')]['id']=[];_0x2938e8[_0x5167cc]['associatedResources'][_0x769d('0xaa')](function(_0x261668){_0x421772[_0x769d('0x88')]['id'][_0x769d('0x95')](_0x261668);});}}}if(!_[_0x769d('0x93')](_0x5221cd)){_0x421772[_0x769d('0x88')]=_['merge'](_0x421772[_0x769d('0x88')],{'$and':{'$or':_0x5221cd}});}_0x421772=_[_0x769d('0xa7')]({},_0x421772,_0x95d536['options']);if(_0xf83741&&!_0xf83741['autoAssociation']&&_0x554721[_0x769d('0x15')]===_0x769d('0xf')){if(_0x95d536[_0x769d('0x90')][_0x769d('0xab')]){_0x421772[_0x769d('0xac')]=[{'all':!![]}];}return _0x198d0f[_0x554721[_0x769d('0x15')]]['findAll'](_0x421772)[_0x769d('0x8')](function(_0x4a912d){var _0x2580a3=[];_0x4a912d['forEach'](function(_0x1ff464){var _0x25477e;switch(_0x1ff464[_0x769d('0xad')]){case'default':_0x25477e=_['find'](_0xf83741[_0x769d('0x9')],function(_0x383800){return _0x383800['id']===_0x1ff464[_0x769d('0x7c')]&&_0x383800[_0x769d('0x11')]===_0x769d('0xae');});break;case'custom':_0x25477e=_[_0x769d('0x96')](_0xf83741[_0x769d('0x9')],function(_0x45cc28){return _0x45cc28['id']===_0x1ff464[_0x769d('0x7c')]&&_0x45cc28[_0x769d('0x11')]===_0x769d('0xaf');});break;}if(_0x25477e)_0x2580a3[_0x769d('0x95')](_0x1ff464);});_0xdb82f2[_0x769d('0xb0')]=_0x2580a3['length'];_0xdb82f2[_0x769d('0xb1')]=_0x2580a3;return _0xdb82f2;});}else{if(!_['isEmpty'](_0x95d536[_0x769d('0x90')]['ids'])){_0x421772['where']['id']=_0x421772[_0x769d('0x88')]['id']?_[_0x769d('0x9f')](_0x421772['where']['id'],_0x95d536['query'][_0x769d('0xb2')]):_0x95d536[_0x769d('0x90')]['ids'];if(_0x95d536[_0x769d('0x90')]['customSorting']){_0x421772[_0x769d('0xa4')]=_0x95d536[_0x769d('0x90')][_0x769d('0xb3')];}}if(_0x95d536['query'][_0x769d('0xb4')]){_0x421772[_0x769d('0x88')]=_[_0x769d('0xa7')](_0x421772['where'],{'$and':_0x95d536[_0x769d('0x90')][_0x769d('0xb4')]});}return _0x198d0f[_0x554721[_0x769d('0x15')]][_0x769d('0xb0')]({'where':_0x421772[_0x769d('0x88')]})[_0x769d('0x8')](function(_0x5f8af2){_0xdb82f2[_0x769d('0xb0')]=_0x5f8af2;if(_0x95d536[_0x769d('0x90')][_0x769d('0xab')]){if(_0x554721[_0x769d('0x15')]===_0x769d('0x1f')){_0x421772[_0x769d('0xac')]=[{'model':_0x198d0f['Tag'],'as':_0x769d('0xb5'),'attributes':['id',_0x769d('0xc'),_0x769d('0xb6')],'required':_0x95d536[_0x769d('0x90')][_0x769d('0xb7')]?!![]:![]},{'model':_0x198d0f[_0x769d('0x72')],'as':'ThroughTags','attributes':['id',_0x769d('0xc'),_0x769d('0xb6')],'through':_0x95d536[_0x769d('0x90')][_0x769d('0xb7')]?{'attributes':[],'where':{'TagId':_0x95d536['query'][_0x769d('0xb7')]||undefined}}:{},'required':_0x95d536['query']['tag']?!![]:![]}];}else{_0x421772['include']=[{'all':!![]}];}}return _0x198d0f[_0x554721[_0x769d('0x15')]][_0x769d('0x7')](_0x421772);})[_0x769d('0x8')](function(_0x1acc22){_0xdb82f2[_0x769d('0xb1')]=_0x1acc22;if(_0x1b08ac===_0x769d('0x34')&&_0x95d536[_0x769d('0x90')][_0x769d('0xb8')]===_0x769d('0xb9')){var _0xbb7eb=[];for(var _0x1d0eda=0x0;_0x1d0eda<_0xdb82f2[_0x769d('0xb1')][_0x769d('0x94')];_0x1d0eda++){_0xbb7eb['push'](_0x140d43(_0x769d('0xba'),_0xdb82f2[_0x769d('0xb1')][_0x1d0eda][_0x769d('0xbb')]));_0xbb7eb[_0x769d('0x95')](_0x140d43(_0x769d('0xbc'),_0xdb82f2['rows'][_0x1d0eda]['dataValues']));_0xbb7eb['push'](_0x140d43(_0x769d('0xbd'),_0xdb82f2['rows'][_0x1d0eda][_0x769d('0xbb')]));_0xbb7eb[_0x769d('0x95')](_0x140d43(_0x769d('0xbe'),_0xdb82f2['rows'][_0x1d0eda]['dataValues']));_0xbb7eb['push'](_0x140d43('openchannel',_0xdb82f2['rows'][_0x1d0eda]['dataValues']));_0xbb7eb[_0x769d('0x95')](_0x140d43(_0x769d('0xbf'),_0xdb82f2[_0x769d('0xb1')][_0x1d0eda]['dataValues']));}return Promise['all'](_0xbb7eb)[_0x769d('0x8')](function(){return _0xdb82f2;});}return _0xdb82f2;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 0d4e29a..bb6e080 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 _0xb366=['request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','redis','localhost','socket.io-emitter','./userProfile.socket'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xb366,0xa4));var _0x6b36=function(_0x5f3cde,_0x449d92){_0x5f3cde=_0x5f3cde-0x0;var _0x3c1a1c=_0xb366[_0x5f3cde];return _0x3c1a1c;};'use strict';var _=require(_0x6b36('0x0'));var util=require('util');var moment=require(_0x6b36('0x1'));var BPromise=require(_0x6b36('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6b36('0x3'));var db=require(_0x6b36('0x4'))['db'];var utils=require(_0x6b36('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6b36('0x6'));var client=jayson[_0x6b36('0x7')]['http']({'port':0x232a});config[_0x6b36('0x8')]=_['defaults'](config['redis'],{'host':_0x6b36('0x9'),'port':0x18eb});var socket=require(_0x6b36('0xa'))(new Redis(config[_0x6b36('0x8')]));require(_0x6b36('0xb'))['register'](socket);function respondWithRpcPromise(_0x171558,_0x22804e,_0x4d1437){return new BPromise(function(_0x32bbb5,_0x567985){return client[_0x6b36('0xc')](_0x171558,_0x4d1437)[_0x6b36('0xd')](function(_0x46eaa8){logger[_0x6b36('0xe')](_0x6b36('0xf'),_0x22804e,_0x6b36('0x10'));logger['debug'](_0x6b36('0x11'),_0x22804e,_0x6b36('0x10'),JSON['stringify'](_0x46eaa8));if(_0x46eaa8[_0x6b36('0x12')]){if(_0x46eaa8['error'][_0x6b36('0x13')]===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x22804e,_0x46eaa8['error'][_0x6b36('0x14')]);return _0x567985(_0x46eaa8[_0x6b36('0x12')][_0x6b36('0x14')]);}logger['error'](_0x6b36('0xf'),_0x22804e,_0x46eaa8['error'][_0x6b36('0x14')]);return _0x32bbb5(_0x46eaa8[_0x6b36('0x12')][_0x6b36('0x14')]);}else{logger['info']('UserProfile,\x20%s,\x20%s',_0x22804e,_0x6b36('0x10'));_0x32bbb5(_0x46eaa8['result'][_0x6b36('0x14')]);}})[_0x6b36('0x15')](function(_0x5ad465){logger[_0x6b36('0x12')]('UserProfile,\x20%s,\x20%s',_0x22804e,_0x5ad465);_0x567985(_0x5ad465);});});} \ No newline at end of file +var _0x3e24=['info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register'];(function(_0x160dab,_0xa06863){var _0x4a1b54=function(_0x2f85ff){while(--_0x2f85ff){_0x160dab['push'](_0x160dab['shift']());}};_0x4a1b54(++_0xa06863);}(_0x3e24,0x167));var _0x43e2=function(_0x100916,_0x25270d){_0x100916=_0x100916-0x0;var _0xa31589=_0x3e24[_0x100916];return _0xa31589;};'use strict';var _=require(_0x43e2('0x0'));var util=require(_0x43e2('0x1'));var moment=require(_0x43e2('0x2'));var BPromise=require(_0x43e2('0x3'));var rs=require(_0x43e2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x43e2('0x5'))['db'];var utils=require(_0x43e2('0x6'));var logger=require('../../config/logger')(_0x43e2('0x7'));var config=require(_0x43e2('0x8'));var jayson=require(_0x43e2('0x9'));var client=jayson[_0x43e2('0xa')][_0x43e2('0xb')]({'port':0x232a});config[_0x43e2('0xc')]=_[_0x43e2('0xd')](config['redis'],{'host':_0x43e2('0xe'),'port':0x18eb});var socket=require(_0x43e2('0xf'))(new Redis(config['redis']));require(_0x43e2('0x10'))[_0x43e2('0x11')](socket);function respondWithRpcPromise(_0x5375d8,_0x2ed387,_0x1ef968){return new BPromise(function(_0x52146c,_0x45848e){return client['request'](_0x5375d8,_0x1ef968)['then'](function(_0x5847f0){logger[_0x43e2('0x12')](_0x43e2('0x13'),_0x2ed387,_0x43e2('0x14'));logger[_0x43e2('0x15')](_0x43e2('0x16'),_0x2ed387,_0x43e2('0x14'),JSON[_0x43e2('0x17')](_0x5847f0));if(_0x5847f0[_0x43e2('0x18')]){if(_0x5847f0[_0x43e2('0x18')][_0x43e2('0x19')]===0x1f4){logger[_0x43e2('0x18')](_0x43e2('0x13'),_0x2ed387,_0x5847f0['error'][_0x43e2('0x1a')]);return _0x45848e(_0x5847f0[_0x43e2('0x18')][_0x43e2('0x1a')]);}logger[_0x43e2('0x18')]('UserProfile,\x20%s,\x20%s',_0x2ed387,_0x5847f0['error'][_0x43e2('0x1a')]);return _0x52146c(_0x5847f0[_0x43e2('0x18')][_0x43e2('0x1a')]);}else{logger[_0x43e2('0x12')](_0x43e2('0x13'),_0x2ed387,_0x43e2('0x14'));_0x52146c(_0x5847f0[_0x43e2('0x1b')][_0x43e2('0x1a')]);}})[_0x43e2('0x1c')](function(_0x399cab){logger['error'](_0x43e2('0x13'),_0x2ed387,_0x399cab);_0x45848e(_0x399cab);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 59d72ce..e460ec5 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 _0x0d28=['register','length','userProfile:','./userProfile.events','remove','emit','removeListener'];(function(_0x5c91fc,_0x2d0bba){var _0x1c50ed=function(_0x4bfe37){while(--_0x4bfe37){_0x5c91fc['push'](_0x5c91fc['shift']());}};_0x1c50ed(++_0x2d0bba);}(_0x0d28,0xa4));var _0x80d2=function(_0xe98508,_0x17f727){_0xe98508=_0xe98508-0x0;var _0x21f63e=_0x0d28[_0xe98508];return _0x21f63e;};'use strict';var UserProfileEvents=require(_0x80d2('0x0'));var events=['save',_0x80d2('0x1'),'update'];function createListener(_0x2ba94b,_0x118521){return function(_0x1e345c){_0x118521[_0x80d2('0x2')](_0x2ba94b,_0x1e345c);};}function removeListener(_0x13291e,_0x5a7b4c){return function(){UserProfileEvents[_0x80d2('0x3')](_0x13291e,_0x5a7b4c);};}exports[_0x80d2('0x4')]=function(_0xa28a1b){for(var _0x554488=0x0,_0x7943be=events[_0x80d2('0x5')];_0x554488<_0x7943be;_0x554488++){var _0x17e8b7=events[_0x554488];var _0x57310e=createListener(_0x80d2('0x6')+_0x17e8b7,_0xa28a1b);UserProfileEvents['on'](_0x17e8b7,_0x57310e);}}; \ No newline at end of file +var _0xca9a=['remove','update','emit','removeListener','register','userProfile:','./userProfile.events','save'];(function(_0x35a140,_0x3aeac6){var _0x30ab82=function(_0x15a7c3){while(--_0x15a7c3){_0x35a140['push'](_0x35a140['shift']());}};_0x30ab82(++_0x3aeac6);}(_0xca9a,0x186));var _0xaca9=function(_0x5b670a,_0x4f43bf){_0x5b670a=_0x5b670a-0x0;var _0xf6a9b0=_0xca9a[_0x5b670a];return _0xf6a9b0;};'use strict';var UserProfileEvents=require(_0xaca9('0x0'));var events=[_0xaca9('0x1'),_0xaca9('0x2'),_0xaca9('0x3')];function createListener(_0x4d6fe6,_0x21d5fa){return function(_0x1ee06c){_0x21d5fa[_0xaca9('0x4')](_0x4d6fe6,_0x1ee06c);};}function removeListener(_0x3ff8b1,_0x5ccf37){return function(){UserProfileEvents[_0xaca9('0x5')](_0x3ff8b1,_0x5ccf37);};}exports[_0xaca9('0x6')]=function(_0x470f91){for(var _0x92b2fa=0x0,_0x292701=events['length'];_0x92b2fa<_0x292701;_0x92b2fa++){var _0x46778a=events[_0x92b2fa];var _0x21b5c2=createListener(_0xaca9('0x7')+_0x46778a,_0x470f91);UserProfileEvents['on'](_0x46778a,_0x21b5c2);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index c7d224b..0827b2e 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 _0xd0a3=['show','create','put','update','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x4417a9,_0x1e3b4d){var _0x7c14c=function(_0x2fd917){while(--_0x2fd917){_0x4417a9['push'](_0x4417a9['shift']());}};_0x7c14c(++_0x1e3b4d);}(_0xd0a3,0x1e5));var _0x3d0a=function(_0x32d1bd,_0x3d1d42){_0x32d1bd=_0x32d1bd-0x0;var _0x1ac143=_0xd0a3[_0x32d1bd];return _0x1ac143;};'use strict';var multer=require(_0x3d0a('0x0'));var util=require(_0x3d0a('0x1'));var path=require('path');var timeout=require(_0x3d0a('0x2'));var express=require(_0x3d0a('0x3'));var router=express[_0x3d0a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3d0a('0x5'));var interaction=require(_0x3d0a('0x6'));var config=require(_0x3d0a('0x7'));var controller=require(_0x3d0a('0x8'));router['get']('/',auth[_0x3d0a('0x9')](),controller[_0x3d0a('0xa')]);router[_0x3d0a('0xb')](_0x3d0a('0xc'),auth[_0x3d0a('0x9')](),controller[_0x3d0a('0xd')]);router[_0x3d0a('0xb')](_0x3d0a('0xe'),auth[_0x3d0a('0x9')](),controller[_0x3d0a('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3d0a('0x10')]);router[_0x3d0a('0x11')](_0x3d0a('0xe'),auth[_0x3d0a('0x9')](),controller[_0x3d0a('0x12')]);router['delete'](_0x3d0a('0xe'),auth[_0x3d0a('0x9')](),controller['destroy']);module[_0x3d0a('0x13')]=router; \ No newline at end of file +var _0x6e8a=['fs-extra','../../config/environment','./userProfileResource.controller','isAuthenticated','index','/describe','/:id','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0xf6add1,_0x323887){var _0x33f30d=function(_0x51ec1f){while(--_0x51ec1f){_0xf6add1['push'](_0xf6add1['shift']());}};_0x33f30d(++_0x323887);}(_0x6e8a,0xed));var _0xa6e8=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x6e8a[_0x40ac5e];return _0x2839d6;};'use strict';var multer=require(_0xa6e8('0x0'));var util=require(_0xa6e8('0x1'));var path=require(_0xa6e8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa6e8('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa6e8('0x4'));var controller=require(_0xa6e8('0x5'));router['get']('/',auth[_0xa6e8('0x6')](),controller[_0xa6e8('0x7')]);router['get'](_0xa6e8('0x8'),auth[_0xa6e8('0x6')](),controller['describe']);router['get'](_0xa6e8('0x9'),auth[_0xa6e8('0x6')](),controller['show']);router['post']('/',auth[_0xa6e8('0x6')](),controller[_0xa6e8('0xa')]);router[_0xa6e8('0xb')](_0xa6e8('0x9'),auth[_0xa6e8('0x6')](),controller[_0xa6e8('0xc')]);router[_0xa6e8('0xd')]('/:id',auth[_0xa6e8('0x6')](),controller[_0xa6e8('0xe')]);module[_0xa6e8('0xf')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index dee8810..7df857a 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 _0xf6f9=['INTEGER','exports','STRING'];(function(_0x456dc1,_0x4464e8){var _0x443faf=function(_0xeb1d1c){while(--_0xeb1d1c){_0x456dc1['push'](_0x456dc1['shift']());}};_0x443faf(++_0x4464e8);}(_0xf6f9,0x85));var _0x9f6f=function(_0x108536,_0x87d6f1){_0x108536=_0x108536-0x0;var _0x1bbdc2=_0xf6f9[_0x108536];return _0x1bbdc2;};'use strict';var Sequelize=require('sequelize');module[_0x9f6f('0x0')]={'name':{'type':Sequelize[_0x9f6f('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x9f6f('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9f6f('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x978c=['exports','sequelize'];(function(_0x376135,_0x50c84f){var _0x2340b7=function(_0x2d08b0){while(--_0x2d08b0){_0x376135['push'](_0x376135['shift']());}};_0x2340b7(++_0x50c84f);}(_0x978c,0x1bd));var _0xc978=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x978c[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0xc978('0x0'));module[_0xc978('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 5236cf5..6f7119c 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 _0x1a85=['describe','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','end','error','stack','name','send','index','UserProfileResource','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','pick','map','VIRTUAL','merge','options','include','findAll','rows','catch','show','fields','includeAll','find','create','body','params','destroy'];(function(_0x1af6c0,_0x25c300){var _0x732cef=function(_0x47cc9f){while(--_0x47cc9f){_0x1af6c0['push'](_0x1af6c0['shift']());}};_0x732cef(++_0x25c300);}(_0x1a85,0x178));var _0x51a8=function(_0x562faf,_0x102bcc){_0x562faf=_0x562faf-0x0;var _0x22c1f6=_0x1a85[_0x562faf];return _0x22c1f6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x51a8('0x0'));var jsonpatch=require(_0x51a8('0x1'));var rp=require(_0x51a8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x51a8('0x3'));var util=require(_0x51a8('0x4'));var path=require(_0x51a8('0x5'));var sox=require('sox');var csv=require(_0x51a8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x51a8('0x7'));var _=require('lodash');var squel=require(_0x51a8('0x8'));var crypto=require(_0x51a8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x51a8('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x51a8('0xb'));var Redis=require(_0x51a8('0xc'));var authService=require(_0x51a8('0xd'));var qs=require(_0x51a8('0xe'));var as=require(_0x51a8('0xf'));var hardwareService=require(_0x51a8('0x10'));var logger=require(_0x51a8('0x11'))(_0x51a8('0x12'));var utils=require(_0x51a8('0x13'));var config=require(_0x51a8('0x14'));var licenseUtil=require(_0x51a8('0x15'));var db=require(_0x51a8('0x16'))['db'];function respondWithStatusCode(_0x38a1d2,_0x1827e6){_0x1827e6=_0x1827e6||0xcc;return function(_0x43c042){if(_0x43c042){return _0x38a1d2[_0x51a8('0x17')](_0x1827e6);}return _0x38a1d2[_0x51a8('0x18')](_0x1827e6)['end']();};}function respondWithResult(_0x461f5c,_0x7a4c36){_0x7a4c36=_0x7a4c36||0xc8;return function(_0xaec066){if(_0xaec066){return _0x461f5c['status'](_0x7a4c36)[_0x51a8('0x19')](_0xaec066);}};}function respondWithFilteredResult(_0x547d40,_0x10584b){return function(_0x2b8d37){if(_0x2b8d37){var _0x39cd45=typeof _0x10584b[_0x51a8('0x1a')]===_0x51a8('0x1b')&&typeof _0x10584b[_0x51a8('0x1c')]===_0x51a8('0x1b');var _0x516abc=_0x2b8d37[_0x51a8('0x1d')];var _0x45a433=_0x39cd45?0x0:_0x10584b[_0x51a8('0x1a')];var _0x23539e=_0x39cd45?_0x2b8d37[_0x51a8('0x1d')]:_0x10584b[_0x51a8('0x1a')]+_0x10584b['limit'];var _0x1df8c2;if(_0x23539e>=_0x516abc){_0x23539e=_0x516abc;_0x1df8c2=0xc8;}else{_0x1df8c2=0xce;}_0x547d40[_0x51a8('0x18')](_0x1df8c2);return _0x547d40[_0x51a8('0x1e')](_0x51a8('0x1f'),_0x45a433+'-'+_0x23539e+'/'+_0x516abc)[_0x51a8('0x19')](_0x2b8d37);}return null;};}function patchUpdates(_0x3bc044){return function(_0x28aea0){try{jsonpatch[_0x51a8('0x20')](_0x28aea0,_0x3bc044,!![]);}catch(_0x5ac1c0){return BPromise[_0x51a8('0x21')](_0x5ac1c0);}return _0x28aea0['save']();};}function saveUpdates(_0xfe0ddb,_0x12c029){return function(_0x8bda40){if(_0x8bda40){return _0x8bda40[_0x51a8('0x22')](_0xfe0ddb)['then'](function(_0xae3588){return _0xae3588;});}return null;};}function removeEntity(_0x4b9cdd,_0x47f063){return function(_0x23d26a){if(_0x23d26a){return _0x23d26a['destroy']()[_0x51a8('0x23')](function(){_0x4b9cdd[_0x51a8('0x18')](0xcc)[_0x51a8('0x24')]();});}};}function handleEntityNotFound(_0x18e2f3,_0x157554){return function(_0x2f2f05){if(!_0x2f2f05){_0x18e2f3[_0x51a8('0x17')](0x194);}return _0x2f2f05;};}function handleError(_0x1326a2,_0x5b3f49){_0x5b3f49=_0x5b3f49||0x1f4;return function(_0x273ce2){logger[_0x51a8('0x25')](_0x273ce2[_0x51a8('0x26')]);if(_0x273ce2[_0x51a8('0x27')]){delete _0x273ce2[_0x51a8('0x27')];}_0x1326a2[_0x51a8('0x18')](_0x5b3f49)[_0x51a8('0x28')](_0x273ce2);};}exports[_0x51a8('0x29')]=function(_0xec08ae,_0x4b5cda){var _0x20c6b5={},_0x347a02={},_0x4a1548={'count':0x0,'rows':[]};var _0x2f9d53=_['map'](db[_0x51a8('0x2a')][_0x51a8('0x2b')],function(_0x143f46){return{'name':_0x143f46[_0x51a8('0x2c')],'type':_0x143f46[_0x51a8('0x2d')]['key']};});_0x347a02[_0x51a8('0x2e')]=_['map'](_0x2f9d53,_0x51a8('0x27'));_0x347a02[_0x51a8('0x2f')]=_[_0x51a8('0x30')](_0xec08ae['query']);_0x347a02[_0x51a8('0x31')]=_['intersection'](_0x347a02[_0x51a8('0x2e')],_0x347a02[_0x51a8('0x2f')]);_0x20c6b5[_0x51a8('0x32')]=_[_0x51a8('0x33')](_0x347a02[_0x51a8('0x2e')],qs['fields'](_0xec08ae[_0x51a8('0x2f')]['fields']));_0x20c6b5[_0x51a8('0x32')]=_0x20c6b5[_0x51a8('0x32')][_0x51a8('0x34')]?_0x20c6b5['attributes']:_0x347a02[_0x51a8('0x2e')];if(!_0xec08ae[_0x51a8('0x2f')][_0x51a8('0x35')](_0x51a8('0x36'))){_0x20c6b5[_0x51a8('0x1c')]=qs['limit'](_0xec08ae['query']['limit']);_0x20c6b5[_0x51a8('0x1a')]=qs[_0x51a8('0x1a')](_0xec08ae['query'][_0x51a8('0x1a')]);}_0x20c6b5['order']=qs[_0x51a8('0x37')](_0xec08ae[_0x51a8('0x2f')][_0x51a8('0x37')]);_0x20c6b5[_0x51a8('0x38')]=qs[_0x51a8('0x31')](_[_0x51a8('0x39')](_0xec08ae['query'],_0x347a02['filters']),_0x2f9d53);if(_0xec08ae[_0x51a8('0x2f')]['filter']){_0x20c6b5['where']=_['merge'](_0x20c6b5[_0x51a8('0x38')],{'$or':_[_0x51a8('0x3a')](_0x2f9d53,function(_0x3cbf97){if(_0x3cbf97['type']!==_0x51a8('0x3b')){var _0x25d772={};_0x25d772[_0x3cbf97[_0x51a8('0x27')]]={'$like':'%'+_0xec08ae[_0x51a8('0x2f')]['filter']+'%'};return _0x25d772;}})});}_0x20c6b5=_[_0x51a8('0x3c')]({},_0x20c6b5,_0xec08ae[_0x51a8('0x3d')]);var _0x1b0333={'where':_0x20c6b5['where']};return db[_0x51a8('0x2a')]['count'](_0x1b0333)[_0x51a8('0x23')](function(_0x1e637a){_0x4a1548[_0x51a8('0x1d')]=_0x1e637a;if(_0xec08ae[_0x51a8('0x2f')]['includeAll']){_0x20c6b5[_0x51a8('0x3e')]=[{'all':!![]}];}return db[_0x51a8('0x2a')][_0x51a8('0x3f')](_0x20c6b5);})[_0x51a8('0x23')](function(_0xa33fc){_0x4a1548[_0x51a8('0x40')]=_0xa33fc;return _0x4a1548;})[_0x51a8('0x23')](respondWithFilteredResult(_0x4b5cda,_0x20c6b5))[_0x51a8('0x41')](handleError(_0x4b5cda,null));};exports[_0x51a8('0x42')]=function(_0x4b8467,_0x22e6e6){var _0x2afb74={'raw':![],'where':{'id':_0x4b8467['params']['id']}},_0x4c7c67={};_0x4c7c67[_0x51a8('0x2e')]=_[_0x51a8('0x30')](db[_0x51a8('0x2a')][_0x51a8('0x2b')]);_0x4c7c67[_0x51a8('0x2f')]=_[_0x51a8('0x30')](_0x4b8467[_0x51a8('0x2f')]);_0x4c7c67[_0x51a8('0x31')]=_[_0x51a8('0x33')](_0x4c7c67[_0x51a8('0x2e')],_0x4c7c67['query']);_0x2afb74[_0x51a8('0x32')]=_[_0x51a8('0x33')](_0x4c7c67[_0x51a8('0x2e')],qs[_0x51a8('0x43')](_0x4b8467[_0x51a8('0x2f')][_0x51a8('0x43')]));_0x2afb74['attributes']=_0x2afb74[_0x51a8('0x32')]['length']?_0x2afb74[_0x51a8('0x32')]:_0x4c7c67[_0x51a8('0x2e')];if(_0x4b8467[_0x51a8('0x2f')][_0x51a8('0x44')]){_0x2afb74[_0x51a8('0x3e')]=[{'all':!![]}];}_0x2afb74=_['merge']({},_0x2afb74,_0x4b8467['options']);return db[_0x51a8('0x2a')][_0x51a8('0x45')](_0x2afb74)[_0x51a8('0x23')](handleEntityNotFound(_0x22e6e6,null))[_0x51a8('0x23')](respondWithResult(_0x22e6e6,null))[_0x51a8('0x41')](handleError(_0x22e6e6,null));};exports['create']=function(_0x504a43,_0xcbd998){return db[_0x51a8('0x2a')][_0x51a8('0x46')](_0x504a43[_0x51a8('0x47')],{})[_0x51a8('0x23')](respondWithResult(_0xcbd998,0xc9))[_0x51a8('0x41')](handleError(_0xcbd998,null));};exports[_0x51a8('0x22')]=function(_0x1103a3,_0x301578){if(_0x1103a3['body']['id']){delete _0x1103a3['body']['id'];}return db['UserProfileResource'][_0x51a8('0x45')]({'where':{'id':_0x1103a3[_0x51a8('0x48')]['id']}})[_0x51a8('0x23')](handleEntityNotFound(_0x301578,null))['then'](saveUpdates(_0x1103a3[_0x51a8('0x47')],null))[_0x51a8('0x23')](respondWithResult(_0x301578,null))['catch'](handleError(_0x301578,null));};exports[_0x51a8('0x49')]=function(_0x4fb93c,_0x50a2f8){return db[_0x51a8('0x2a')][_0x51a8('0x45')]({'where':{'id':_0x4fb93c[_0x51a8('0x48')]['id']}})['then'](handleEntityNotFound(_0x50a2f8,null))['then'](removeEntity(_0x50a2f8,null))[_0x51a8('0x41')](handleError(_0x50a2f8,null));};exports['describe']=function(_0x21c4da,_0xc89617){return db[_0x51a8('0x2a')][_0x51a8('0x4a')]()[_0x51a8('0x23')](respondWithResult(_0xc89617,null))[_0x51a8('0x41')](handleError(_0xc89617,null));}; \ No newline at end of file +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','UserProfileResource','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','merge','options','include'];(function(_0x5302fb,_0x1a2db3){var _0x43e6a4=function(_0x324ae6){while(--_0x324ae6){_0x5302fb['push'](_0x5302fb['shift']());}};_0x43e6a4(++_0x1a2db3);}(_0xacf4,0xe7));var _0x4acf=function(_0x54fa8c,_0xc2d9d0){_0x54fa8c=_0x54fa8c-0x0;var _0x26e2d6=_0xacf4[_0x54fa8c];return _0x26e2d6;};'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['UserProfileResource'][_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['UserProfileResource']['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 diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 2759a1b..c4abb6d 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 _0xce1e=['exports','define','UserProfileResource','resourceId','sectionId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userProfileResource.attributes'];(function(_0x2de91a,_0x542708){var _0x49d0b8=function(_0x2e4bcf){while(--_0x2e4bcf){_0x2de91a['push'](_0x2de91a['shift']());}};_0x49d0b8(++_0x542708);}(_0xce1e,0xb9));var _0xece1=function(_0x4c4855,_0x27f504){_0x4c4855=_0x4c4855-0x0;var _0x50a07f=_0xce1e[_0x4c4855];return _0x50a07f;};'use strict';var _=require(_0xece1('0x0'));var util=require(_0xece1('0x1'));var logger=require(_0xece1('0x2'))(_0xece1('0x3'));var moment=require(_0xece1('0x4'));var BPromise=require(_0xece1('0x5'));var rp=require(_0xece1('0x6'));var fs=require('fs');var path=require(_0xece1('0x7'));var rimraf=require(_0xece1('0x8'));var config=require('../../config/environment');var attributes=require(_0xece1('0x9'));module[_0xece1('0xa')]=function(_0x8db649,_0x5839ad){return _0x8db649[_0xece1('0xb')](_0xece1('0xc'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xece1('0xd'),_0xece1('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6584=['user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource'];(function(_0x36f3df,_0x2b1621){var _0xcfb7b7=function(_0xcc9fc0){while(--_0xcc9fc0){_0x36f3df['push'](_0x36f3df['shift']());}};_0xcfb7b7(++_0x2b1621);}(_0x6584,0x15a));var _0x4658=function(_0xdd827a,_0x482ad2){_0xdd827a=_0xdd827a-0x0;var _0x2f46f1=_0x6584[_0xdd827a];return _0x2f46f1;};'use strict';var _=require(_0x4658('0x0'));var util=require(_0x4658('0x1'));var logger=require(_0x4658('0x2'))(_0x4658('0x3'));var moment=require(_0x4658('0x4'));var BPromise=require(_0x4658('0x5'));var rp=require(_0x4658('0x6'));var fs=require('fs');var path=require(_0x4658('0x7'));var rimraf=require(_0x4658('0x8'));var config=require(_0x4658('0x9'));var attributes=require(_0x4658('0xa'));module[_0x4658('0xb')]=function(_0x5a5e18,_0x121b32){return _0x5a5e18[_0x4658('0xc')](_0x4658('0xd'),attributes,{'tableName':_0x4658('0xe'),'paranoid':![],'indexes':[{'name':_0x4658('0xf'),'fields':[_0x4658('0x10'),_0x4658('0x11')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index e1153ab..ecf9913 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 _0xc108=['../../config/environment','client','http','request','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x137c02,_0x2a2175){var _0x6ee5bc=function(_0x50805c){while(--_0x50805c){_0x137c02['push'](_0x137c02['shift']());}};_0x6ee5bc(++_0x2a2175);}(_0xc108,0x19d));var _0x8c10=function(_0x539dd7,_0x5d224d){_0x539dd7=_0x539dd7-0x0;var _0x24cab6=_0xc108[_0x539dd7];return _0x24cab6;};'use strict';var _=require(_0x8c10('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8c10('0x1'));var rs=require(_0x8c10('0x2'));var fs=require('fs');var Redis=require(_0x8c10('0x3'));var db=require(_0x8c10('0x4'))['db'];var utils=require(_0x8c10('0x5'));var logger=require(_0x8c10('0x6'))('rpc');var config=require(_0x8c10('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8c10('0x8')][_0x8c10('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcea86c,_0x493e50,_0x311fe2){return new BPromise(function(_0x1ab7a1,_0x46f6b7){return client[_0x8c10('0xa')](_0xcea86c,_0x311fe2)[_0x8c10('0xb')](function(_0x24dcf3){logger['info'](_0x8c10('0xc'),_0x493e50,_0x8c10('0xd'));logger[_0x8c10('0xe')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x493e50,_0x8c10('0xd'),JSON[_0x8c10('0xf')](_0x24dcf3));if(_0x24dcf3[_0x8c10('0x10')]){if(_0x24dcf3['error']['code']===0x1f4){logger[_0x8c10('0x10')](_0x8c10('0xc'),_0x493e50,_0x24dcf3[_0x8c10('0x10')]['message']);return _0x46f6b7(_0x24dcf3[_0x8c10('0x10')][_0x8c10('0x11')]);}logger['error'](_0x8c10('0xc'),_0x493e50,_0x24dcf3['error'][_0x8c10('0x11')]);return _0x1ab7a1(_0x24dcf3[_0x8c10('0x10')][_0x8c10('0x11')]);}else{logger[_0x8c10('0x12')](_0x8c10('0xc'),_0x493e50,'request\x20sent');_0x1ab7a1(_0x24dcf3['result'][_0x8c10('0x11')]);}})[_0x8c10('0x13')](function(_0x15f838){logger[_0x8c10('0x10')](_0x8c10('0xc'),_0x493e50,_0x15f838);_0x46f6b7(_0x15f838);});});} \ No newline at end of file +var _0xfbc1=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring'];(function(_0x2efd63,_0x232f8b){var _0x2afcb9=function(_0x52f6f0){while(--_0x52f6f0){_0x2efd63['push'](_0x2efd63['shift']());}};_0x2afcb9(++_0x232f8b);}(_0xfbc1,0x1ca));var _0x1fbc=function(_0x2cc711,_0x300328){_0x2cc711=_0x2cc711-0x0;var _0x31a52e=_0xfbc1[_0x2cc711];return _0x31a52e;};'use strict';var _=require(_0x1fbc('0x0'));var util=require(_0x1fbc('0x1'));var moment=require(_0x1fbc('0x2'));var BPromise=require('bluebird');var rs=require(_0x1fbc('0x3'));var fs=require('fs');var Redis=require(_0x1fbc('0x4'));var db=require(_0x1fbc('0x5'))['db'];var utils=require(_0x1fbc('0x6'));var logger=require(_0x1fbc('0x7'))(_0x1fbc('0x8'));var config=require(_0x1fbc('0x9'));var jayson=require(_0x1fbc('0xa'));var client=jayson[_0x1fbc('0xb')][_0x1fbc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x35f08c,_0x2b7bbd,_0x544636){return new BPromise(function(_0x2bb31b,_0x5ebd66){return client['request'](_0x35f08c,_0x544636)[_0x1fbc('0xd')](function(_0x51879e){logger[_0x1fbc('0xe')](_0x1fbc('0xf'),_0x2b7bbd,_0x1fbc('0x10'));logger[_0x1fbc('0x11')](_0x1fbc('0x12'),_0x2b7bbd,_0x1fbc('0x10'),JSON['stringify'](_0x51879e));if(_0x51879e[_0x1fbc('0x13')]){if(_0x51879e[_0x1fbc('0x13')]['code']===0x1f4){logger[_0x1fbc('0x13')](_0x1fbc('0xf'),_0x2b7bbd,_0x51879e['error'][_0x1fbc('0x14')]);return _0x5ebd66(_0x51879e[_0x1fbc('0x13')][_0x1fbc('0x14')]);}logger[_0x1fbc('0x13')](_0x1fbc('0xf'),_0x2b7bbd,_0x51879e[_0x1fbc('0x13')][_0x1fbc('0x14')]);return _0x2bb31b(_0x51879e[_0x1fbc('0x13')][_0x1fbc('0x14')]);}else{logger[_0x1fbc('0xe')](_0x1fbc('0xf'),_0x2b7bbd,_0x1fbc('0x10'));_0x2bb31b(_0x51879e['result'][_0x1fbc('0x14')]);}})[_0x1fbc('0x15')](function(_0x2a5d8e){logger['error'](_0x1fbc('0xf'),_0x2b7bbd,_0x2a5d8e);_0x5ebd66(_0x2a5d8e);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index feab8de..f30d874 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 _0xea0f=['delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','post','put','update'];(function(_0x4ffa71,_0xaa30de){var _0x476096=function(_0x1afb9c){while(--_0x1afb9c){_0x4ffa71['push'](_0x4ffa71['shift']());}};_0x476096(++_0xaa30de);}(_0xea0f,0x1ca));var _0xfea0=function(_0x3a6f78,_0x2e6503){_0x3a6f78=_0x3a6f78-0x0;var _0x179126=_0xea0f[_0x3a6f78];return _0x179126;};'use strict';var multer=require(_0xfea0('0x0'));var util=require(_0xfea0('0x1'));var path=require('path');var timeout=require(_0xfea0('0x2'));var express=require(_0xfea0('0x3'));var router=express[_0xfea0('0x4')]();var fs_extra=require(_0xfea0('0x5'));var auth=require(_0xfea0('0x6'));var interaction=require(_0xfea0('0x7'));var config=require('../../config/environment');var controller=require('./userProfileSection.controller');router['get']('/',auth[_0xfea0('0x8')](),controller[_0xfea0('0x9')]);router[_0xfea0('0xa')](_0xfea0('0xb'),auth[_0xfea0('0x8')](),controller[_0xfea0('0xc')]);router[_0xfea0('0xa')](_0xfea0('0xd'),auth[_0xfea0('0x8')](),controller['show']);router[_0xfea0('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xfea0('0xf')](_0xfea0('0xd'),auth[_0xfea0('0x8')](),controller[_0xfea0('0x10')]);router[_0xfea0('0x11')](_0xfea0('0xd'),auth['isAuthenticated'](),controller[_0xfea0('0x12')]);module['exports']=router; \ No newline at end of file +var _0x8f65=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','get','index','/describe','describe','/:id','isAuthenticated','post','create','delete','destroy','multer','util','path'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x8f65,0x82));var _0x58f6=function(_0x49d61f,_0x11b835){_0x49d61f=_0x49d61f-0x0;var _0x97efc6=_0x8f65[_0x49d61f];return _0x97efc6;};'use strict';var multer=require(_0x58f6('0x0'));var util=require(_0x58f6('0x1'));var path=require(_0x58f6('0x2'));var timeout=require('connect-timeout');var express=require(_0x58f6('0x3'));var router=express[_0x58f6('0x4')]();var fs_extra=require(_0x58f6('0x5'));var auth=require(_0x58f6('0x6'));var interaction=require(_0x58f6('0x7'));var config=require('../../config/environment');var controller=require(_0x58f6('0x8'));router[_0x58f6('0x9')]('/',auth['isAuthenticated'](),controller[_0x58f6('0xa')]);router['get'](_0x58f6('0xb'),auth['isAuthenticated'](),controller[_0x58f6('0xc')]);router[_0x58f6('0x9')](_0x58f6('0xd'),auth[_0x58f6('0xe')](),controller['show']);router[_0x58f6('0xf')]('/',auth[_0x58f6('0xe')](),controller[_0x58f6('0x10')]);router['put'](_0x58f6('0xd'),auth[_0x58f6('0xe')](),controller['update']);router[_0x58f6('0x11')](_0x58f6('0xd'),auth[_0x58f6('0xe')](),controller[_0x58f6('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index bdf9359..54e3c7e 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 _0xdb94=['INTEGER','BOOLEAN','crudPermissions','sequelize','exports','STRING'];(function(_0x52f20c,_0xc3fb53){var _0x3e805e=function(_0x56554f){while(--_0x56554f){_0x52f20c['push'](_0x52f20c['shift']());}};_0x3e805e(++_0xc3fb53);}(_0xdb94,0xab));var _0x4db9=function(_0x2a3ef2,_0x471cbb){_0x2a3ef2=_0x2a3ef2-0x0;var _0x4df40e=_0xdb94[_0x2a3ef2];return _0x4df40e;};'use strict';var Sequelize=require(_0x4db9('0x0'));module[_0x4db9('0x1')]={'name':{'type':Sequelize[_0x4db9('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x4db9('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x4db9('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x4db9('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x4db9('0x2')],'set':function(_0x554bd5){this['setDataValue'](_0x4db9('0x5'),_0x554bd5?_0x554bd5['join'](''):[]);},'get':function(){return this['getDataValue'](_0x4db9('0x5'))?this['getDataValue'](_0x4db9('0x5'))['split'](''):[];}}}; \ No newline at end of file +var _0x0abf=['sequelize','STRING','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split'];(function(_0x503922,_0x523c5c){var _0x4bc97a=function(_0x59cace){while(--_0x59cace){_0x503922['push'](_0x503922['shift']());}};_0x4bc97a(++_0x523c5c);}(_0x0abf,0xe8));var _0xf0ab=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x0abf[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0xf0ab('0x0'));module['exports']={'name':{'type':Sequelize[_0xf0ab('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0xf0ab('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xf0ab('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x7ea4e0){this[_0xf0ab('0x3')](_0xf0ab('0x4'),_0x7ea4e0?_0x7ea4e0[_0xf0ab('0x5')](''):[]);},'get':function(){return this[_0xf0ab('0x6')](_0xf0ab('0x4'))?this[_0xf0ab('0x6')]('crudPermissions')[_0xf0ab('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index ab9a6d2..5ec1a08 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 _0x769e=['papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','then','destroy','error','stack','name','send','map','UserProfileSection','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','length','includeAll','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x444fde,_0x33e8c6){var _0x8cd4cf=function(_0x376668){while(--_0x376668){_0x444fde['push'](_0x444fde['shift']());}};_0x8cd4cf(++_0x33e8c6);}(_0x769e,0x11a));var _0xe769=function(_0x1fc11f,_0x3379ec){_0x1fc11f=_0x1fc11f-0x0;var _0x2bc7a3=_0x769e[_0x1fc11f];return _0x2bc7a3;};'use strict';var emlformat=require(_0xe769('0x0'));var rimraf=require(_0xe769('0x1'));var zipdir=require(_0xe769('0x2'));var jsonpatch=require(_0xe769('0x3'));var rp=require(_0xe769('0x4'));var moment=require(_0xe769('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe769('0x6'));var util=require(_0xe769('0x7'));var path=require(_0xe769('0x8'));var sox=require(_0xe769('0x9'));var csv=require(_0xe769('0xa'));var ejs=require(_0xe769('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe769('0xc'));var squel=require(_0xe769('0xd'));var crypto=require(_0xe769('0xe'));var jsforce=require(_0xe769('0xf'));var deskjs=require(_0xe769('0x10'));var toCsv=require('to-csv');var querystring=require(_0xe769('0x11'));var Papa=require(_0xe769('0x12'));var Redis=require('ioredis');var authService=require(_0xe769('0x13'));var qs=require(_0xe769('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe769('0x15'));var logger=require(_0xe769('0x16'))('api');var utils=require(_0xe769('0x17'));var config=require(_0xe769('0x18'));var licenseUtil=require(_0xe769('0x19'));var db=require(_0xe769('0x1a'))['db'];function respondWithStatusCode(_0x55cec4,_0xb38718){_0xb38718=_0xb38718||0xcc;return function(_0x5bab4b){if(_0x5bab4b){return _0x55cec4[_0xe769('0x1b')](_0xb38718);}return _0x55cec4[_0xe769('0x1c')](_0xb38718)[_0xe769('0x1d')]();};}function respondWithResult(_0x1d2ce9,_0x28e623){_0x28e623=_0x28e623||0xc8;return function(_0x464d3e){if(_0x464d3e){return _0x1d2ce9[_0xe769('0x1c')](_0x28e623)[_0xe769('0x1e')](_0x464d3e);}};}function respondWithFilteredResult(_0x2be1b0,_0x58fd0d){return function(_0x3f9683){if(_0x3f9683){var _0x2fb1d5=typeof _0x58fd0d[_0xe769('0x1f')]==='undefined'&&typeof _0x58fd0d[_0xe769('0x20')]===_0xe769('0x21');var _0x27ac39=_0x3f9683[_0xe769('0x22')];var _0x419a82=_0x2fb1d5?0x0:_0x58fd0d['offset'];var _0x127d61=_0x2fb1d5?_0x3f9683[_0xe769('0x22')]:_0x58fd0d[_0xe769('0x1f')]+_0x58fd0d[_0xe769('0x20')];var _0x28ed68;if(_0x127d61>=_0x27ac39){_0x127d61=_0x27ac39;_0x28ed68=0xc8;}else{_0x28ed68=0xce;}_0x2be1b0[_0xe769('0x1c')](_0x28ed68);return _0x2be1b0[_0xe769('0x23')]('Content-Range',_0x419a82+'-'+_0x127d61+'/'+_0x27ac39)['json'](_0x3f9683);}return null;};}function patchUpdates(_0xd3e34f){return function(_0x23cef6){try{jsonpatch[_0xe769('0x24')](_0x23cef6,_0xd3e34f,!![]);}catch(_0x23084b){return BPromise[_0xe769('0x25')](_0x23084b);}return _0x23cef6['save']();};}function saveUpdates(_0x5063bd,_0x2a941c){return function(_0x569a42){if(_0x569a42){return _0x569a42['update'](_0x5063bd)[_0xe769('0x26')](function(_0x3c30e9){return _0x3c30e9;});}return null;};}function removeEntity(_0x718fed,_0x1eb654){return function(_0x59457e){if(_0x59457e){return _0x59457e[_0xe769('0x27')]()[_0xe769('0x26')](function(){_0x718fed['status'](0xcc)[_0xe769('0x1d')]();});}};}function handleEntityNotFound(_0x4544ff,_0x575271){return function(_0xc35bd6){if(!_0xc35bd6){_0x4544ff[_0xe769('0x1b')](0x194);}return _0xc35bd6;};}function handleError(_0x51d97a,_0x332844){_0x332844=_0x332844||0x1f4;return function(_0x8bb2df){logger[_0xe769('0x28')](_0x8bb2df[_0xe769('0x29')]);if(_0x8bb2df[_0xe769('0x2a')]){delete _0x8bb2df[_0xe769('0x2a')];}_0x51d97a[_0xe769('0x1c')](_0x332844)[_0xe769('0x2b')](_0x8bb2df);};}exports['index']=function(_0x28b768,_0x1cad20){var _0x5ca29b={},_0x51aa29={},_0x55e094={'count':0x0,'rows':[]};var _0x30c51f=_[_0xe769('0x2c')](db[_0xe769('0x2d')][_0xe769('0x2e')],function(_0x1474b4){return{'name':_0x1474b4[_0xe769('0x2f')],'type':_0x1474b4[_0xe769('0x30')]['key']};});_0x51aa29[_0xe769('0x31')]=_[_0xe769('0x2c')](_0x30c51f,_0xe769('0x2a'));_0x51aa29[_0xe769('0x32')]=_[_0xe769('0x33')](_0x28b768[_0xe769('0x32')]);_0x51aa29[_0xe769('0x34')]=_['intersection'](_0x51aa29[_0xe769('0x31')],_0x51aa29[_0xe769('0x32')]);_0x5ca29b['attributes']=_[_0xe769('0x35')](_0x51aa29[_0xe769('0x31')],qs[_0xe769('0x36')](_0x28b768[_0xe769('0x32')]['fields']));_0x5ca29b[_0xe769('0x37')]=_0x5ca29b[_0xe769('0x37')]['length']?_0x5ca29b[_0xe769('0x37')]:_0x51aa29[_0xe769('0x31')];if(!_0x28b768[_0xe769('0x32')][_0xe769('0x38')](_0xe769('0x39'))){_0x5ca29b[_0xe769('0x20')]=qs[_0xe769('0x20')](_0x28b768['query']['limit']);_0x5ca29b[_0xe769('0x1f')]=qs[_0xe769('0x1f')](_0x28b768['query'][_0xe769('0x1f')]);}_0x5ca29b[_0xe769('0x3a')]=qs[_0xe769('0x3b')](_0x28b768['query'][_0xe769('0x3b')]);_0x5ca29b[_0xe769('0x3c')]=qs[_0xe769('0x34')](_['pick'](_0x28b768[_0xe769('0x32')],_0x51aa29['filters']),_0x30c51f);if(_0x28b768['query']['filter']){_0x5ca29b[_0xe769('0x3c')]=_[_0xe769('0x3d')](_0x5ca29b[_0xe769('0x3c')],{'$or':_[_0xe769('0x2c')](_0x30c51f,function(_0x413cc1){if(_0x413cc1[_0xe769('0x30')]!==_0xe769('0x3e')){var _0x55d499={};_0x55d499[_0x413cc1['name']]={'$like':'%'+_0x28b768[_0xe769('0x32')]['filter']+'%'};return _0x55d499;}})});}_0x5ca29b=_[_0xe769('0x3d')]({},_0x5ca29b,_0x28b768[_0xe769('0x3f')]);var _0xadc016={'where':_0x5ca29b[_0xe769('0x3c')]};return db[_0xe769('0x2d')]['count'](_0xadc016)[_0xe769('0x26')](function(_0x46c046){_0x55e094[_0xe769('0x22')]=_0x46c046;if(_0x28b768[_0xe769('0x32')]['includeAll']){_0x5ca29b[_0xe769('0x40')]=[{'all':!![]}];}return db['UserProfileSection'][_0xe769('0x41')](_0x5ca29b);})[_0xe769('0x26')](function(_0x38bf61){_0x55e094[_0xe769('0x42')]=_0x38bf61;return _0x55e094;})['then'](respondWithFilteredResult(_0x1cad20,_0x5ca29b))[_0xe769('0x43')](handleError(_0x1cad20,null));};exports[_0xe769('0x44')]=function(_0x596b29,_0x2e6611){var _0x291b27={'raw':![],'where':{'id':_0x596b29[_0xe769('0x45')]['id']}},_0x19e042={};_0x19e042['model']=_[_0xe769('0x33')](db[_0xe769('0x2d')]['rawAttributes']);_0x19e042['query']=_[_0xe769('0x33')](_0x596b29[_0xe769('0x32')]);_0x19e042[_0xe769('0x34')]=_['intersection'](_0x19e042[_0xe769('0x31')],_0x19e042[_0xe769('0x32')]);_0x291b27[_0xe769('0x37')]=_[_0xe769('0x35')](_0x19e042['model'],qs[_0xe769('0x36')](_0x596b29[_0xe769('0x32')][_0xe769('0x36')]));_0x291b27['attributes']=_0x291b27['attributes'][_0xe769('0x46')]?_0x291b27[_0xe769('0x37')]:_0x19e042[_0xe769('0x31')];if(_0x596b29[_0xe769('0x32')][_0xe769('0x47')]){_0x291b27[_0xe769('0x40')]=[{'all':!![]}];}_0x291b27=_[_0xe769('0x3d')]({},_0x291b27,_0x596b29['options']);return db[_0xe769('0x2d')][_0xe769('0x48')](_0x291b27)[_0xe769('0x26')](handleEntityNotFound(_0x2e6611,null))[_0xe769('0x26')](respondWithResult(_0x2e6611,null))[_0xe769('0x43')](handleError(_0x2e6611,null));};exports['create']=function(_0x48fd06,_0x590a46){return db[_0xe769('0x2d')]['create'](_0x48fd06[_0xe769('0x49')],{})['then'](respondWithResult(_0x590a46,0xc9))[_0xe769('0x43')](handleError(_0x590a46,null));};exports['update']=function(_0x4422dd,_0x344f08){if(_0x4422dd['body']['id']){delete _0x4422dd['body']['id'];}return db[_0xe769('0x2d')]['find']({'where':{'id':_0x4422dd[_0xe769('0x45')]['id']}})['then'](handleEntityNotFound(_0x344f08,null))['then'](saveUpdates(_0x4422dd[_0xe769('0x49')],null))[_0xe769('0x26')](respondWithResult(_0x344f08,null))[_0xe769('0x43')](handleError(_0x344f08,null));};exports['destroy']=function(_0x16079a,_0x1a2309){return db[_0xe769('0x2d')][_0xe769('0x48')]({'where':{'id':_0x16079a[_0xe769('0x45')]['id']}})[_0xe769('0x26')](handleEntityNotFound(_0x1a2309,null))[_0xe769('0x26')](removeEntity(_0x1a2309,null))[_0xe769('0x43')](handleError(_0x1a2309,null));};exports[_0xe769('0x4a')]=function(_0x2caf00,_0x5e2b16){return db[_0xe769('0x2d')][_0xe769('0x4a')]()['then'](respondWithResult(_0x5e2b16,null))[_0xe769('0x43')](handleError(_0x5e2b16,null));}; \ No newline at end of file +var _0x9af5=['mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x493503,_0x351993){var _0x1986d0=function(_0x59a6a1){while(--_0x59a6a1){_0x493503['push'](_0x493503['shift']());}};_0x1986d0(++_0x351993);}(_0x9af5,0x136));var _0x59af=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9af5[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x59af('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x59af('0x1'));var jsonpatch=require(_0x59af('0x2'));var rp=require(_0x59af('0x3'));var moment=require(_0x59af('0x4'));var BPromise=require(_0x59af('0x5'));var Mustache=require(_0x59af('0x6'));var util=require(_0x59af('0x7'));var path=require(_0x59af('0x8'));var sox=require('sox');var csv=require(_0x59af('0x9'));var ejs=require(_0x59af('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x59af('0xb'));var squel=require(_0x59af('0xc'));var crypto=require('crypto');var jsforce=require(_0x59af('0xd'));var deskjs=require(_0x59af('0xe'));var toCsv=require(_0x59af('0x9'));var querystring=require(_0x59af('0xf'));var Papa=require(_0x59af('0x10'));var Redis=require(_0x59af('0x11'));var authService=require(_0x59af('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x59af('0x13'));var hardwareService=require(_0x59af('0x14'));var logger=require(_0x59af('0x15'))(_0x59af('0x16'));var utils=require(_0x59af('0x17'));var config=require(_0x59af('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x59af('0x19'))['db'];function respondWithStatusCode(_0x5d1fe2,_0xd1edd){_0xd1edd=_0xd1edd||0xcc;return function(_0x310c46){if(_0x310c46){return _0x5d1fe2[_0x59af('0x1a')](_0xd1edd);}return _0x5d1fe2[_0x59af('0x1b')](_0xd1edd)[_0x59af('0x1c')]();};}function respondWithResult(_0x3635fe,_0x4c58f3){_0x4c58f3=_0x4c58f3||0xc8;return function(_0x51b609){if(_0x51b609){return _0x3635fe[_0x59af('0x1b')](_0x4c58f3)[_0x59af('0x1d')](_0x51b609);}};}function respondWithFilteredResult(_0x5b2707,_0x3d56b9){return function(_0x8edb32){if(_0x8edb32){var _0x15afab=typeof _0x3d56b9[_0x59af('0x1e')]==='undefined'&&typeof _0x3d56b9['limit']===_0x59af('0x1f');var _0x55e732=_0x8edb32[_0x59af('0x20')];var _0x220a90=_0x15afab?0x0:_0x3d56b9[_0x59af('0x1e')];var _0x360bcc=_0x15afab?_0x8edb32[_0x59af('0x20')]:_0x3d56b9[_0x59af('0x1e')]+_0x3d56b9[_0x59af('0x21')];var _0x59f2b3;if(_0x360bcc>=_0x55e732){_0x360bcc=_0x55e732;_0x59f2b3=0xc8;}else{_0x59f2b3=0xce;}_0x5b2707[_0x59af('0x1b')](_0x59f2b3);return _0x5b2707[_0x59af('0x22')](_0x59af('0x23'),_0x220a90+'-'+_0x360bcc+'/'+_0x55e732)[_0x59af('0x1d')](_0x8edb32);}return null;};}function patchUpdates(_0x3ac059){return function(_0x1b31b9){try{jsonpatch[_0x59af('0x24')](_0x1b31b9,_0x3ac059,!![]);}catch(_0x2ae49d){return BPromise[_0x59af('0x25')](_0x2ae49d);}return _0x1b31b9[_0x59af('0x26')]();};}function saveUpdates(_0x254ab5,_0x2e8472){return function(_0x4b90ab){if(_0x4b90ab){return _0x4b90ab[_0x59af('0x27')](_0x254ab5)[_0x59af('0x28')](function(_0x491db8){return _0x491db8;});}return null;};}function removeEntity(_0x10bd81,_0x22687d){return function(_0x3113f6){if(_0x3113f6){return _0x3113f6[_0x59af('0x29')]()[_0x59af('0x28')](function(){_0x10bd81[_0x59af('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58c60a,_0x327f17){return function(_0x5aa2de){if(!_0x5aa2de){_0x58c60a[_0x59af('0x1a')](0x194);}return _0x5aa2de;};}function handleError(_0x5ee714,_0x1700ae){_0x1700ae=_0x1700ae||0x1f4;return function(_0x40a12a){logger[_0x59af('0x2a')](_0x40a12a['stack']);if(_0x40a12a[_0x59af('0x2b')]){delete _0x40a12a['name'];}_0x5ee714[_0x59af('0x1b')](_0x1700ae)[_0x59af('0x2c')](_0x40a12a);};}exports[_0x59af('0x2d')]=function(_0x51177c,_0x5d9169){var _0x45410b={},_0x2c89ae={},_0x474d73={'count':0x0,'rows':[]};var _0xf557fd=_[_0x59af('0x2e')](db[_0x59af('0x2f')][_0x59af('0x30')],function(_0x543e41){return{'name':_0x543e41[_0x59af('0x31')],'type':_0x543e41[_0x59af('0x32')][_0x59af('0x33')]};});_0x2c89ae[_0x59af('0x34')]=_[_0x59af('0x2e')](_0xf557fd,_0x59af('0x2b'));_0x2c89ae[_0x59af('0x35')]=_[_0x59af('0x36')](_0x51177c['query']);_0x2c89ae[_0x59af('0x37')]=_[_0x59af('0x38')](_0x2c89ae['model'],_0x2c89ae[_0x59af('0x35')]);_0x45410b[_0x59af('0x39')]=_[_0x59af('0x38')](_0x2c89ae[_0x59af('0x34')],qs['fields'](_0x51177c[_0x59af('0x35')][_0x59af('0x3a')]));_0x45410b['attributes']=_0x45410b[_0x59af('0x39')][_0x59af('0x3b')]?_0x45410b[_0x59af('0x39')]:_0x2c89ae[_0x59af('0x34')];if(!_0x51177c[_0x59af('0x35')][_0x59af('0x3c')](_0x59af('0x3d'))){_0x45410b['limit']=qs[_0x59af('0x21')](_0x51177c['query'][_0x59af('0x21')]);_0x45410b[_0x59af('0x1e')]=qs['offset'](_0x51177c[_0x59af('0x35')][_0x59af('0x1e')]);}_0x45410b[_0x59af('0x3e')]=qs[_0x59af('0x3f')](_0x51177c['query'][_0x59af('0x3f')]);_0x45410b[_0x59af('0x40')]=qs[_0x59af('0x37')](_[_0x59af('0x41')](_0x51177c[_0x59af('0x35')],_0x2c89ae[_0x59af('0x37')]),_0xf557fd);if(_0x51177c[_0x59af('0x35')][_0x59af('0x42')]){_0x45410b[_0x59af('0x40')]=_[_0x59af('0x43')](_0x45410b[_0x59af('0x40')],{'$or':_[_0x59af('0x2e')](_0xf557fd,function(_0x4ea2b1){if(_0x4ea2b1['type']!==_0x59af('0x44')){var _0x1faddf={};_0x1faddf[_0x4ea2b1[_0x59af('0x2b')]]={'$like':'%'+_0x51177c[_0x59af('0x35')]['filter']+'%'};return _0x1faddf;}})});}_0x45410b=_[_0x59af('0x43')]({},_0x45410b,_0x51177c[_0x59af('0x45')]);var _0x1079aa={'where':_0x45410b[_0x59af('0x40')]};return db['UserProfileSection'][_0x59af('0x20')](_0x1079aa)[_0x59af('0x28')](function(_0xcb2a8d){_0x474d73['count']=_0xcb2a8d;if(_0x51177c['query'][_0x59af('0x46')]){_0x45410b[_0x59af('0x47')]=[{'all':!![]}];}return db[_0x59af('0x2f')]['findAll'](_0x45410b);})[_0x59af('0x28')](function(_0xbddd44){_0x474d73[_0x59af('0x48')]=_0xbddd44;return _0x474d73;})[_0x59af('0x28')](respondWithFilteredResult(_0x5d9169,_0x45410b))[_0x59af('0x49')](handleError(_0x5d9169,null));};exports[_0x59af('0x4a')]=function(_0x27ebde,_0x10c193){var _0x142646={'raw':![],'where':{'id':_0x27ebde[_0x59af('0x4b')]['id']}},_0x48576e={};_0x48576e[_0x59af('0x34')]=_[_0x59af('0x36')](db[_0x59af('0x2f')][_0x59af('0x30')]);_0x48576e[_0x59af('0x35')]=_[_0x59af('0x36')](_0x27ebde[_0x59af('0x35')]);_0x48576e[_0x59af('0x37')]=_[_0x59af('0x38')](_0x48576e[_0x59af('0x34')],_0x48576e['query']);_0x142646[_0x59af('0x39')]=_[_0x59af('0x38')](_0x48576e[_0x59af('0x34')],qs['fields'](_0x27ebde[_0x59af('0x35')][_0x59af('0x3a')]));_0x142646[_0x59af('0x39')]=_0x142646['attributes'][_0x59af('0x3b')]?_0x142646[_0x59af('0x39')]:_0x48576e['model'];if(_0x27ebde[_0x59af('0x35')][_0x59af('0x46')]){_0x142646[_0x59af('0x47')]=[{'all':!![]}];}_0x142646=_['merge']({},_0x142646,_0x27ebde[_0x59af('0x45')]);return db['UserProfileSection'][_0x59af('0x4c')](_0x142646)[_0x59af('0x28')](handleEntityNotFound(_0x10c193,null))[_0x59af('0x28')](respondWithResult(_0x10c193,null))[_0x59af('0x49')](handleError(_0x10c193,null));};exports[_0x59af('0x4d')]=function(_0x5f20c1,_0x3d4360){return db[_0x59af('0x2f')][_0x59af('0x4d')](_0x5f20c1[_0x59af('0x4e')],{})[_0x59af('0x28')](respondWithResult(_0x3d4360,0xc9))[_0x59af('0x49')](handleError(_0x3d4360,null));};exports[_0x59af('0x27')]=function(_0x1fbd78,_0x3ed4a0){if(_0x1fbd78[_0x59af('0x4e')]['id']){delete _0x1fbd78[_0x59af('0x4e')]['id'];}return db[_0x59af('0x2f')]['find']({'where':{'id':_0x1fbd78['params']['id']}})[_0x59af('0x28')](handleEntityNotFound(_0x3ed4a0,null))[_0x59af('0x28')](saveUpdates(_0x1fbd78[_0x59af('0x4e')],null))[_0x59af('0x28')](respondWithResult(_0x3ed4a0,null))['catch'](handleError(_0x3ed4a0,null));};exports[_0x59af('0x29')]=function(_0x4c786f,_0x1f2724){return db[_0x59af('0x2f')][_0x59af('0x4c')]({'where':{'id':_0x4c786f[_0x59af('0x4b')]['id']}})[_0x59af('0x28')](handleEntityNotFound(_0x1f2724,null))[_0x59af('0x28')](removeEntity(_0x1f2724,null))[_0x59af('0x49')](handleError(_0x1f2724,null));};exports['describe']=function(_0xadc528,_0x23303c){return db[_0x59af('0x2f')]['describe']()[_0x59af('0x28')](respondWithResult(_0x23303c,null))[_0x59af('0x49')](handleError(_0x23303c,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index d85315c..6bf0fc4 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 _0x5c9b=['../../config/logger','bluebird','request-promise','path','rimraf','./userProfileSection.attributes','exports','UserProfileSection','user_profile_has_sections','compositeIndex','userProfileId','util'];(function(_0x7d2a57,_0x2a3316){var _0x2d9664=function(_0x2b18f9){while(--_0x2b18f9){_0x7d2a57['push'](_0x7d2a57['shift']());}};_0x2d9664(++_0x2a3316);}(_0x5c9b,0x1a3));var _0xb5c9=function(_0x1ea8fe,_0x2447bf){_0x1ea8fe=_0x1ea8fe-0x0;var _0x4f3293=_0x5c9b[_0x1ea8fe];return _0x4f3293;};'use strict';var _=require('lodash');var util=require(_0xb5c9('0x0'));var logger=require(_0xb5c9('0x1'))('api');var moment=require('moment');var BPromise=require(_0xb5c9('0x2'));var rp=require(_0xb5c9('0x3'));var fs=require('fs');var path=require(_0xb5c9('0x4'));var rimraf=require(_0xb5c9('0x5'));var config=require('../../config/environment');var attributes=require(_0xb5c9('0x6'));module[_0xb5c9('0x7')]=function(_0x129012,_0x15e438){return _0x129012['define'](_0xb5c9('0x8'),attributes,{'tableName':_0xb5c9('0x9'),'paranoid':![],'indexes':[{'name':_0xb5c9('0xa'),'fields':['sectionId',_0xb5c9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbada=['../../config/environment','exports','define','UserProfileSection','user_profile_has_sections','userProfileId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbada,0x180));var _0xabad=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xbada[_0x29d915];return _0x160f86;};'use strict';var _=require(_0xabad('0x0'));var util=require(_0xabad('0x1'));var logger=require(_0xabad('0x2'))(_0xabad('0x3'));var moment=require(_0xabad('0x4'));var BPromise=require(_0xabad('0x5'));var rp=require(_0xabad('0x6'));var fs=require('fs');var path=require(_0xabad('0x7'));var rimraf=require('rimraf');var config=require(_0xabad('0x8'));var attributes=require('./userProfileSection.attributes');module[_0xabad('0x9')]=function(_0x415f91,_0x5289c4){return _0x415f91[_0xabad('0xa')](_0xabad('0xb'),attributes,{'tableName':_0xabad('0xc'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['sectionId',_0xabad('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 379c10d..d2b2070 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 _0x415a=['moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util'];(function(_0x3d3aa6,_0x440e63){var _0x4699b7=function(_0x198f6a){while(--_0x198f6a){_0x3d3aa6['push'](_0x3d3aa6['shift']());}};_0x4699b7(++_0x440e63);}(_0x415a,0x1df));var _0xa415=function(_0x146b1f,_0x24c91b){_0x146b1f=_0x146b1f-0x0;var _0x395f99=_0x415a[_0x146b1f];return _0x395f99;};'use strict';var _=require('lodash');var util=require(_0xa415('0x0'));var moment=require(_0xa415('0x1'));var BPromise=require(_0xa415('0x2'));var rs=require(_0xa415('0x3'));var fs=require('fs');var Redis=require(_0xa415('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa415('0x5'))(_0xa415('0x6'));var config=require(_0xa415('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa415('0x8')][_0xa415('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2420cc,_0x4c1ea0,_0x115405){return new BPromise(function(_0x9983c8,_0x58c3fc){return client['request'](_0x2420cc,_0x115405)[_0xa415('0xa')](function(_0xb51f2){logger[_0xa415('0xb')](_0xa415('0xc'),_0x4c1ea0,_0xa415('0xd'));logger['debug'](_0xa415('0xe'),_0x4c1ea0,_0xa415('0xd'),JSON[_0xa415('0xf')](_0xb51f2));if(_0xb51f2[_0xa415('0x10')]){if(_0xb51f2['error'][_0xa415('0x11')]===0x1f4){logger['error'](_0xa415('0xc'),_0x4c1ea0,_0xb51f2['error']['message']);return _0x58c3fc(_0xb51f2[_0xa415('0x10')][_0xa415('0x12')]);}logger[_0xa415('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x4c1ea0,_0xb51f2['error'][_0xa415('0x12')]);return _0x9983c8(_0xb51f2['error'][_0xa415('0x12')]);}else{logger[_0xa415('0xb')]('UserProfileSection,\x20%s,\x20%s',_0x4c1ea0,_0xa415('0xd'));_0x9983c8(_0xb51f2['result']['message']);}})[_0xa415('0x13')](function(_0x22c054){logger[_0xa415('0x10')](_0xa415('0xc'),_0x4c1ea0,_0x22c054);_0x58c3fc(_0x22c054);});});} \ No newline at end of file +var _0x4b19=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s'];(function(_0x5920c9,_0x4ccbd1){var _0x19a89f=function(_0x16d9d8){while(--_0x16d9d8){_0x5920c9['push'](_0x5920c9['shift']());}};_0x19a89f(++_0x4ccbd1);}(_0x4b19,0x195));var _0x94b1=function(_0x3bc7b7,_0x2cf8b9){_0x3bc7b7=_0x3bc7b7-0x0;var _0xcfd3ac=_0x4b19[_0x3bc7b7];return _0xcfd3ac;};'use strict';var _=require(_0x94b1('0x0'));var util=require('util');var moment=require(_0x94b1('0x1'));var BPromise=require(_0x94b1('0x2'));var rs=require(_0x94b1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x94b1('0x4'))['db'];var utils=require(_0x94b1('0x5'));var logger=require(_0x94b1('0x6'))('rpc');var config=require(_0x94b1('0x7'));var jayson=require(_0x94b1('0x8'));var client=jayson['client'][_0x94b1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x110a52,_0x4ea1f9,_0x40c69c){return new BPromise(function(_0x201a02,_0xad0a85){return client['request'](_0x110a52,_0x40c69c)[_0x94b1('0xa')](function(_0x4f948b){logger['info'](_0x94b1('0xb'),_0x4ea1f9,_0x94b1('0xc'));logger[_0x94b1('0xd')](_0x94b1('0xe'),_0x4ea1f9,_0x94b1('0xc'),JSON[_0x94b1('0xf')](_0x4f948b));if(_0x4f948b['error']){if(_0x4f948b[_0x94b1('0x10')][_0x94b1('0x11')]===0x1f4){logger[_0x94b1('0x10')](_0x94b1('0xb'),_0x4ea1f9,_0x4f948b['error']['message']);return _0xad0a85(_0x4f948b[_0x94b1('0x10')][_0x94b1('0x12')]);}logger['error']('UserProfileSection,\x20%s,\x20%s',_0x4ea1f9,_0x4f948b[_0x94b1('0x10')][_0x94b1('0x12')]);return _0x201a02(_0x4f948b['error'][_0x94b1('0x12')]);}else{logger['info']('UserProfileSection,\x20%s,\x20%s',_0x4ea1f9,_0x94b1('0xc'));_0x201a02(_0x4f948b[_0x94b1('0x13')][_0x94b1('0x12')]);}})[_0x94b1('0x14')](function(_0x494138){logger[_0x94b1('0x10')](_0x94b1('0xb'),_0x4ea1f9,_0x494138);_0xad0a85(_0x494138);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 7d8e713..3b94546 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3c5d9a,_0x2951fb){var _0x501fb8=function(_0x364192){while(--_0x364192){_0x3c5d9a['push'](_0x3c5d9a['shift']());}};_0x501fb8(++_0x2951fb);}(_0x70e0,0x17b));var _0x070e=function(_0xaf722c,_0x10467a){_0xaf722c=_0xaf722c-0x0;var _0x1a12d4=_0x70e0[_0xaf722c];return _0x1a12d4;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x17283e,_0x223a00){var _0x4addfb=function(_0x1b247d){while(--_0x1b247d){_0x17283e['push'](_0x17283e['shift']());}};_0x4addfb(++_0x223a00);}(_0x70e0,0x17b));var _0x070e=function(_0x36a45a,_0x4acf5b){_0x36a45a=_0x36a45a-0x0;var _0x402d03=_0x70e0[_0x36a45a];return _0x402d03;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 6b99337..9d7cb6c 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 _0x3ed8=['sequelize','exports','INTEGER'];(function(_0x34bc32,_0x22f99b){var _0x529d8e=function(_0x35c7bf){while(--_0x35c7bf){_0x34bc32['push'](_0x34bc32['shift']());}};_0x529d8e(++_0x22f99b);}(_0x3ed8,0x17d));var _0x83ed=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x3ed8[_0x36c5b0];return _0xf19333;};'use strict';var Sequelize=require(_0x83ed('0x0'));module[_0x83ed('0x1')]={'penalty':{'type':Sequelize[_0x83ed('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x47f9=['INTEGER','exports'];(function(_0x58c76c,_0x3d8d7d){var _0x120891=function(_0x1fdc79){while(--_0x1fdc79){_0x58c76c['push'](_0x58c76c['shift']());}};_0x120891(++_0x3d8d7d);}(_0x47f9,0xff));var _0x947f=function(_0x57ec1a,_0x2b7624){_0x57ec1a=_0x57ec1a-0x0;var _0x2159ad=_0x47f9[_0x57ec1a];return _0x2159ad;};'use strict';var Sequelize=require('sequelize');module[_0x947f('0x0')]={'penalty':{'type':Sequelize[_0x947f('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 593a57b..77169ee 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 _0x4bd3=['exports','define','UserSmsQueue','lodash','../../config/logger','api','path','rimraf','../../config/environment'];(function(_0x572cd8,_0x3b6531){var _0x31997d=function(_0x537543){while(--_0x537543){_0x572cd8['push'](_0x572cd8['shift']());}};_0x31997d(++_0x3b6531);}(_0x4bd3,0x174));var _0x34bd=function(_0x21edd3,_0x2e2b5e){_0x21edd3=_0x21edd3-0x0;var _0x1f492e=_0x4bd3[_0x21edd3];return _0x1f492e;};'use strict';var _=require(_0x34bd('0x0'));var util=require('util');var logger=require(_0x34bd('0x1'))(_0x34bd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x34bd('0x3'));var rimraf=require(_0x34bd('0x4'));var config=require(_0x34bd('0x5'));var attributes=require('./userSmsQueue.attributes');module[_0x34bd('0x6')]=function(_0x2a15a2,_0x5c2a7a){return _0x2a15a2[_0x34bd('0x7')](_0x34bd('0x8'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x82d8=['define','UserSmsQueue','user_has_sms_queues','lodash','../../config/logger','bluebird','path','./userSmsQueue.attributes','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x82d8,0xff));var _0x882d=function(_0x2b5f59,_0x117038){_0x2b5f59=_0x2b5f59-0x0;var _0x1870f5=_0x82d8[_0x2b5f59];return _0x1870f5;};'use strict';var _=require(_0x882d('0x0'));var util=require('util');var logger=require(_0x882d('0x1'))('api');var moment=require('moment');var BPromise=require(_0x882d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x882d('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x882d('0x4'));module[_0x882d('0x5')]=function(_0x19f644,_0xa928f7){return _0x19f644[_0x882d('0x6')](_0x882d('0x7'),attributes,{'tableName':_0x882d('0x8'),'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 37f7fc3..f92e669 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 _0xc6b8=['debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent'];(function(_0x203006,_0x3dbd7c){var _0x3cf752=function(_0x39e51e){while(--_0x39e51e){_0x203006['push'](_0x203006['shift']());}};_0x3cf752(++_0x3dbd7c);}(_0xc6b8,0x171));var _0x8c6b=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xc6b8[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x8c6b('0x0'));var util=require('util');var moment=require(_0x8c6b('0x1'));var BPromise=require(_0x8c6b('0x2'));var rs=require(_0x8c6b('0x3'));var fs=require('fs');var Redis=require(_0x8c6b('0x4'));var db=require(_0x8c6b('0x5'))['db'];var utils=require(_0x8c6b('0x6'));var logger=require(_0x8c6b('0x7'))(_0x8c6b('0x8'));var config=require(_0x8c6b('0x9'));var jayson=require(_0x8c6b('0xa'));var client=jayson[_0x8c6b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14afe3,_0x4503b2,_0x14323e){return new BPromise(function(_0x7ffc58,_0x41c948){return client[_0x8c6b('0xc')](_0x14afe3,_0x14323e)['then'](function(_0x6657cd){logger[_0x8c6b('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x4503b2,_0x8c6b('0xe'));logger[_0x8c6b('0xf')](_0x8c6b('0x10'),_0x4503b2,_0x8c6b('0xe'),JSON[_0x8c6b('0x11')](_0x6657cd));if(_0x6657cd['error']){if(_0x6657cd[_0x8c6b('0x12')][_0x8c6b('0x13')]===0x1f4){logger['error'](_0x8c6b('0x14'),_0x4503b2,_0x6657cd[_0x8c6b('0x12')][_0x8c6b('0x15')]);return _0x41c948(_0x6657cd['error'][_0x8c6b('0x15')]);}logger[_0x8c6b('0x12')](_0x8c6b('0x14'),_0x4503b2,_0x6657cd[_0x8c6b('0x12')][_0x8c6b('0x15')]);return _0x7ffc58(_0x6657cd[_0x8c6b('0x12')][_0x8c6b('0x15')]);}else{logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x4503b2,_0x8c6b('0xe'));_0x7ffc58(_0x6657cd[_0x8c6b('0x16')][_0x8c6b('0x15')]);}})[_0x8c6b('0x17')](function(_0x1e8f97){logger[_0x8c6b('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x4503b2,_0x1e8f97);_0x41c948(_0x1e8f97);});});} \ No newline at end of file +var _0x3635=['client','http','request','then','UserSmsQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3635,0xf3));var _0x5363=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x3635[_0x3d42d8];return _0x27fc41;};'use strict';var _=require(_0x5363('0x0'));var util=require(_0x5363('0x1'));var moment=require('moment');var BPromise=require(_0x5363('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5363('0x3'));var db=require(_0x5363('0x4'))['db'];var utils=require(_0x5363('0x5'));var logger=require('../../config/logger')(_0x5363('0x6'));var config=require(_0x5363('0x7'));var jayson=require(_0x5363('0x8'));var client=jayson[_0x5363('0x9')][_0x5363('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1125a0,_0x1a00d6,_0x33e560){return new BPromise(function(_0x584c83,_0x4a0af5){return client[_0x5363('0xb')](_0x1125a0,_0x33e560)[_0x5363('0xc')](function(_0x1d596d){logger['info'](_0x5363('0xd'),_0x1a00d6,'request\x20sent');logger[_0x5363('0xe')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x1a00d6,_0x5363('0xf'),JSON[_0x5363('0x10')](_0x1d596d));if(_0x1d596d[_0x5363('0x11')]){if(_0x1d596d[_0x5363('0x11')]['code']===0x1f4){logger[_0x5363('0x11')](_0x5363('0xd'),_0x1a00d6,_0x1d596d[_0x5363('0x11')][_0x5363('0x12')]);return _0x4a0af5(_0x1d596d['error'][_0x5363('0x12')]);}logger[_0x5363('0x11')](_0x5363('0xd'),_0x1a00d6,_0x1d596d[_0x5363('0x11')][_0x5363('0x12')]);return _0x584c83(_0x1d596d[_0x5363('0x11')][_0x5363('0x12')]);}else{logger[_0x5363('0x13')](_0x5363('0xd'),_0x1a00d6,_0x5363('0xf'));_0x584c83(_0x1d596d[_0x5363('0x14')]['message']);}})['catch'](function(_0xb76145){logger[_0x5363('0x11')](_0x5363('0xd'),_0x1a00d6,_0xb76145);_0x4a0af5(_0xb76145);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index d08a57d..7188ad7 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 _0xfb18=['INTEGER','sequelize','exports'];(function(_0x43a5ea,_0x31b984){var _0x5a9aa9=function(_0x174ab3){while(--_0x174ab3){_0x43a5ea['push'](_0x43a5ea['shift']());}};_0x5a9aa9(++_0x31b984);}(_0xfb18,0x139));var _0x8fb1=function(_0x810e4d,_0x909ef4){_0x810e4d=_0x810e4d-0x0;var _0x13f01c=_0xfb18[_0x810e4d];return _0x13f01c;};'use strict';var Sequelize=require(_0x8fb1('0x0'));module[_0x8fb1('0x1')]={'UserId':{'type':Sequelize[_0x8fb1('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x8fb1('0x2')]}}; \ No newline at end of file +var _0x3539=['sequelize','exports','INTEGER'];(function(_0x31dc62,_0x59e159){var _0xfc2b8e=function(_0x11ba55){while(--_0x11ba55){_0x31dc62['push'](_0x31dc62['shift']());}};_0xfc2b8e(++_0x59e159);}(_0x3539,0xf6));var _0x9353=function(_0x4ee057,_0x39f068){_0x4ee057=_0x4ee057-0x0;var _0x24cc88=_0x3539[_0x4ee057];return _0x24cc88;};'use strict';var Sequelize=require(_0x9353('0x0'));module[_0x9353('0x1')]={'UserId':{'type':Sequelize[_0x9353('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x9353('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 40c4b50..9e3e2f7 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(_0x53dabb,_0x46ad83){var _0x5bf377=function(_0x2784ea){while(--_0x2784ea){_0x53dabb['push'](_0x53dabb['shift']());}};_0x5bf377(++_0x46ad83);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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(_0x148f0b,_0x25af56){var _0x318104=function(_0x2645d2){while(--_0x2645d2){_0x148f0b['push'](_0x148f0b['shift']());}};_0x318104(++_0x25af56);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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 f77f929..44d01c0 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x22dac7,_0x45d32a){var _0x3e6cfa=function(_0x4c2e9d){while(--_0x4c2e9d){_0x22dac7['push'](_0x22dac7['shift']());}};_0x3e6cfa(++_0x45d32a);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x178f3e,_0x567056){var _0x2c73ab=function(_0x240923){while(--_0x240923){_0x178f3e['push'](_0x178f3e['shift']());}};_0x2c73ab(++_0x567056);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index b3a53ed..574fb6b 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 _0xbfbd=['sequelize','exports','INTEGER'];(function(_0x4d34eb,_0x44aebf){var _0x4967f6=function(_0x5026a5){while(--_0x5026a5){_0x4d34eb['push'](_0x4d34eb['shift']());}};_0x4967f6(++_0x44aebf);}(_0xbfbd,0x102));var _0xdbfb=function(_0x5cd675,_0x352cca){_0x5cd675=_0x5cd675-0x0;var _0x2379b0=_0xbfbd[_0x5cd675];return _0x2379b0;};'use strict';var Sequelize=require(_0xdbfb('0x0'));module[_0xdbfb('0x1')]={'penalty':{'type':Sequelize[_0xdbfb('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdf85=['exports'];(function(_0x219143,_0x451ca3){var _0x501e6b=function(_0x5888fc){while(--_0x5888fc){_0x219143['push'](_0x219143['shift']());}};_0x501e6b(++_0x451ca3);}(_0xdf85,0x12c));var _0x5df8=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xdf85[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require('sequelize');module[_0x5df8('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index f846081..f50b3ea 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 _0x6072=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util'];(function(_0x310990,_0x245984){var _0x648534=function(_0xd320e5){while(--_0xd320e5){_0x310990['push'](_0x310990['shift']());}};_0x648534(++_0x245984);}(_0x6072,0x191));var _0x2607=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x6072[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x2607('0x0'));var util=require(_0x2607('0x1'));var logger=require(_0x2607('0x2'))(_0x2607('0x3'));var moment=require(_0x2607('0x4'));var BPromise=require(_0x2607('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2607('0x6'));var config=require(_0x2607('0x7'));var attributes=require(_0x2607('0x8'));module[_0x2607('0x9')]=function(_0x37808d,_0x560c2f){return _0x37808d[_0x2607('0xa')](_0x2607('0xb'),attributes,{'tableName':_0x2607('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf6cc=['UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','define'];(function(_0x4307ef,_0x4ab157){var _0x4a370b=function(_0x294bee){while(--_0x294bee){_0x4307ef['push'](_0x4307ef['shift']());}};_0x4a370b(++_0x4ab157);}(_0xf6cc,0x9c));var _0xcf6c=function(_0x5c149a,_0xed7207){_0x5c149a=_0x5c149a-0x0;var _0x5ccd49=_0xf6cc[_0x5c149a];return _0x5ccd49;};'use strict';var _=require(_0xcf6c('0x0'));var util=require(_0xcf6c('0x1'));var logger=require(_0xcf6c('0x2'))(_0xcf6c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcf6c('0x4'));var fs=require('fs');var path=require(_0xcf6c('0x5'));var rimraf=require(_0xcf6c('0x6'));var config=require(_0xcf6c('0x7'));var attributes=require('./userVoiceQueue.attributes');module['exports']=function(_0x30d7e0,_0x5bea1d){return _0x30d7e0[_0xcf6c('0x8')](_0xcf6c('0x9'),attributes,{'tableName':_0xcf6c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 1703df9..5cb8ee6 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 _0x6ad6=['code','message','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error'];(function(_0x35069b,_0x30f989){var _0x4ead49=function(_0x112ec8){while(--_0x112ec8){_0x35069b['push'](_0x35069b['shift']());}};_0x4ead49(++_0x30f989);}(_0x6ad6,0xdf));var _0x66ad=function(_0x3a037b,_0x485e17){_0x3a037b=_0x3a037b-0x0;var _0x37e106=_0x6ad6[_0x3a037b];return _0x37e106;};'use strict';var _=require(_0x66ad('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x66ad('0x1'));var rs=require(_0x66ad('0x2'));var fs=require('fs');var Redis=require(_0x66ad('0x3'));var db=require(_0x66ad('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x66ad('0x5'));var config=require('../../config/environment');var jayson=require(_0x66ad('0x6'));var client=jayson[_0x66ad('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc5d587,_0x3d00a5,_0x8a67f9){return new BPromise(function(_0x2d72e8,_0x4b26f5){return client['request'](_0xc5d587,_0x8a67f9)[_0x66ad('0x8')](function(_0x5b1c98){logger[_0x66ad('0x9')](_0x66ad('0xa'),_0x3d00a5,_0x66ad('0xb'));logger[_0x66ad('0xc')](_0x66ad('0xd'),_0x3d00a5,_0x66ad('0xb'),JSON['stringify'](_0x5b1c98));if(_0x5b1c98[_0x66ad('0xe')]){if(_0x5b1c98[_0x66ad('0xe')][_0x66ad('0xf')]===0x1f4){logger[_0x66ad('0xe')](_0x66ad('0xa'),_0x3d00a5,_0x5b1c98[_0x66ad('0xe')][_0x66ad('0x10')]);return _0x4b26f5(_0x5b1c98['error'][_0x66ad('0x10')]);}logger[_0x66ad('0xe')](_0x66ad('0xa'),_0x3d00a5,_0x5b1c98[_0x66ad('0xe')][_0x66ad('0x10')]);return _0x2d72e8(_0x5b1c98[_0x66ad('0xe')][_0x66ad('0x10')]);}else{logger['info'](_0x66ad('0xa'),_0x3d00a5,_0x66ad('0xb'));_0x2d72e8(_0x5b1c98['result'][_0x66ad('0x10')]);}})['catch'](function(_0x187569){logger['error'](_0x66ad('0xa'),_0x3d00a5,_0x187569);_0x4b26f5(_0x187569);});});} \ No newline at end of file +var _0x25b7=['UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent'];(function(_0xb3bbc8,_0x2a3635){var _0x3254b7=function(_0x823e23){while(--_0x823e23){_0xb3bbc8['push'](_0xb3bbc8['shift']());}};_0x3254b7(++_0x2a3635);}(_0x25b7,0x132));var _0x725b=function(_0x32e8f9,_0x245f75){_0x32e8f9=_0x32e8f9-0x0;var _0x1eaa31=_0x25b7[_0x32e8f9];return _0x1eaa31;};'use strict';var _=require(_0x725b('0x0'));var util=require(_0x725b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x725b('0x2'));var db=require(_0x725b('0x3'))['db'];var utils=require(_0x725b('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x725b('0x5'));var jayson=require(_0x725b('0x6'));var client=jayson[_0x725b('0x7')][_0x725b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3094b1,_0x14b5c5,_0x5b10fa){return new BPromise(function(_0x4f658e,_0x343e76){return client[_0x725b('0x9')](_0x3094b1,_0x5b10fa)[_0x725b('0xa')](function(_0x4feb92){logger[_0x725b('0xb')](_0x725b('0xc'),_0x14b5c5,_0x725b('0xd'));logger['debug'](_0x725b('0xe'),_0x14b5c5,_0x725b('0xd'),JSON['stringify'](_0x4feb92));if(_0x4feb92[_0x725b('0xf')]){if(_0x4feb92[_0x725b('0xf')][_0x725b('0x10')]===0x1f4){logger[_0x725b('0xf')](_0x725b('0xc'),_0x14b5c5,_0x4feb92['error']['message']);return _0x343e76(_0x4feb92[_0x725b('0xf')][_0x725b('0x11')]);}logger['error'](_0x725b('0xc'),_0x14b5c5,_0x4feb92[_0x725b('0xf')][_0x725b('0x11')]);return _0x4f658e(_0x4feb92[_0x725b('0xf')][_0x725b('0x11')]);}else{logger[_0x725b('0xb')]('UserVoiceQueue,\x20%s,\x20%s',_0x14b5c5,_0x725b('0xd'));_0x4f658e(_0x4feb92[_0x725b('0x12')][_0x725b('0x11')]);}})[_0x725b('0x13')](function(_0x32cc63){logger['error'](_0x725b('0xc'),_0x14b5c5,_0x32cc63);_0x343e76(_0x32cc63);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 34a3598..dff5d6d 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x457cbb,_0x197207){var _0x2a0657=function(_0x198757){while(--_0x198757){_0x457cbb['push'](_0x457cbb['shift']());}};_0x2a0657(++_0x197207);}(_0x70e0,0x17b));var _0x070e=function(_0x163182,_0x340e38){_0x163182=_0x163182-0x0;var _0x347d2b=_0x70e0[_0x163182];return _0x347d2b;};'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(_0x266ddc,_0x45aa52){var _0x39c1d7=function(_0x4cd07c){while(--_0x4cd07c){_0x266ddc['push'](_0x266ddc['shift']());}};_0x39c1d7(++_0x45aa52);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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 bd65de9..0b201b4 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 _0x091e=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x1c97df,_0x5172f6){var _0x311ed6=function(_0x33e2dc){while(--_0x33e2dc){_0x1c97df['push'](_0x1c97df['shift']());}};_0x311ed6(++_0x5172f6);}(_0x091e,0x161));var _0xe091=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x091e[_0x243b2f];return _0xcb3c2d;};'use strict';var Sequelize=require(_0xe091('0x0'));module[_0xe091('0x1')]={'uniqueid':{'type':Sequelize[_0xe091('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xe091('0x3')},'membername':{'type':Sequelize[_0xe091('0x4')],'allowNull':![],'comment':_0xe091('0x3')},'UserId':{'type':Sequelize[_0xe091('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe091('0x5'),'comment':_0xe091('0x3')},'VoiceQueueId':{'type':Sequelize[_0xe091('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xe091('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0xe091('0x3')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xe091('0x3')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xe091('0x3')}}; \ No newline at end of file +var _0x05a8=['STRING','queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x1e1639,_0x352143){var _0x29893c=function(_0x56cb00){while(--_0x56cb00){_0x1e1639['push'](_0x1e1639['shift']());}};_0x29893c(++_0x352143);}(_0x05a8,0x1d6));var _0x805a=function(_0x1e8ecc,_0x27b83b){_0x1e8ecc=_0x1e8ecc-0x0;var _0x11abc1=_0x05a8[_0x1e8ecc];return _0x11abc1;};'use strict';var Sequelize=require(_0x805a('0x0'));module[_0x805a('0x1')]={'uniqueid':{'type':Sequelize[_0x805a('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x805a('0x3')},'membername':{'type':Sequelize[_0x805a('0x4')],'allowNull':![],'comment':_0x805a('0x3')},'UserId':{'type':Sequelize[_0x805a('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x805a('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0x805a('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x805a('0x4')],'allowNull':![],'unique':_0x805a('0x5'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x805a('0x2')](0xb),'defaultValue':0x0,'comment':_0x805a('0x3')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x805a('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 3cb55ac..6278b7e 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 _0xa5b9=['../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x660671,_0x2d138f){var _0x481a59=function(_0x57ab11){while(--_0x57ab11){_0x660671['push'](_0x660671['shift']());}};_0x481a59(++_0x2d138f);}(_0xa5b9,0x10e));var _0x9a5b=function(_0x20fb81,_0x16ba3e){_0x20fb81=_0x20fb81-0x0;var _0x2a9d21=_0xa5b9[_0x20fb81];return _0x2a9d21;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x9a5b('0x0'))['db'][_0x9a5b('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x9a5b('0x2')](0x0);var events={'afterCreate':_0x9a5b('0x3'),'afterUpdate':_0x9a5b('0x4'),'afterDestroy':_0x9a5b('0x5')};function emitEvent(_0x1f9725){return function(_0x46164f,_0x9c2732,_0x112973){UserVoiceQueueRtEvents[_0x9a5b('0x6')](_0x1f9725+':'+_0x46164f['id'],_0x46164f);UserVoiceQueueRtEvents[_0x9a5b('0x6')](_0x1f9725,_0x46164f);_0x112973(null);};}for(var e in events){if(events[_0x9a5b('0x7')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0x9a5b('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x3f7d=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update'];(function(_0x3f0da6,_0x25cdc9){var _0x64ffa9=function(_0x31cc25){while(--_0x31cc25){_0x3f0da6['push'](_0x3f0da6['shift']());}};_0x64ffa9(++_0x25cdc9);}(_0x3f7d,0x1bc));var _0xd3f7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3f7d[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0xd3f7('0x0'));var UserVoiceQueueRt=require(_0xd3f7('0x1'))['db'][_0xd3f7('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xd3f7('0x3')](0x0);var events={'afterCreate':_0xd3f7('0x4'),'afterUpdate':_0xd3f7('0x5'),'afterDestroy':_0xd3f7('0x6')};function emitEvent(_0x3e4da0){return function(_0x12c028,_0x386f2d,_0x3021c3){UserVoiceQueueRtEvents[_0xd3f7('0x7')](_0x3e4da0+':'+_0x12c028['id'],_0x12c028);UserVoiceQueueRtEvents['emit'](_0x3e4da0,_0x12c028);_0x3021c3(null);};}for(var e in events){if(events[_0xd3f7('0x8')](e)){var event=events[e];UserVoiceQueueRt[_0xd3f7('0x9')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index e6d6db6..ee13986 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 _0x5c7d=['./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x488e30,_0xb792bd){var _0xe25e7=function(_0x1f9cee){while(--_0x1f9cee){_0x488e30['push'](_0x488e30['shift']());}};_0xe25e7(++_0xb792bd);}(_0x5c7d,0xd7));var _0xd5c7=function(_0x4c2257,_0x2d1ae4){_0x4c2257=_0x4c2257-0x0;var _0x1ad8bf=_0x5c7d[_0x4c2257];return _0x1ad8bf;};'use strict';var _=require(_0xd5c7('0x0'));var util=require(_0xd5c7('0x1'));var logger=require(_0xd5c7('0x2'))(_0xd5c7('0x3'));var moment=require(_0xd5c7('0x4'));var BPromise=require(_0xd5c7('0x5'));var rp=require(_0xd5c7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd5c7('0x7'));var config=require(_0xd5c7('0x8'));var attributes=require(_0xd5c7('0x9'));module[_0xd5c7('0xa')]=function(_0x6d51f8,_0x22287f){return _0x6d51f8[_0xd5c7('0xb')](_0xd5c7('0xc'),attributes,{'tableName':_0xd5c7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e09=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','UserVoiceQueueRt','lodash','../../config/logger'];(function(_0x53e787,_0x4298e6){var _0x2781a0=function(_0x21f861){while(--_0x21f861){_0x53e787['push'](_0x53e787['shift']());}};_0x2781a0(++_0x4298e6);}(_0x5e09,0x1ed));var _0x95e0=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5e09[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x95e0('0x0'));var util=require('util');var logger=require(_0x95e0('0x1'))(_0x95e0('0x2'));var moment=require(_0x95e0('0x3'));var BPromise=require(_0x95e0('0x4'));var rp=require(_0x95e0('0x5'));var fs=require('fs');var path=require(_0x95e0('0x6'));var rimraf=require(_0x95e0('0x7'));var config=require(_0x95e0('0x8'));var attributes=require(_0x95e0('0x9'));module['exports']=function(_0x44367d,_0x191bae){return _0x44367d['define'](_0x95e0('0xa'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 8498985..e986373 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 _0x054a=['socket.io-emitter','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','findAll','options','raw','where','sequelize','COUNT','literal','outboundQueuePauses','debug','GetVoiceQueueRtPauses','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','defaults','redis'];(function(_0x19d172,_0x21bf9b){var _0x4e1ccd=function(_0x144213){while(--_0x144213){_0x19d172['push'](_0x19d172['shift']());}};_0x4e1ccd(++_0x21bf9b);}(_0x054a,0x114));var _0xa054=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x054a[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xa054('0x0'));var moment=require(_0xa054('0x1'));var BPromise=require(_0xa054('0x2'));var rs=require(_0xa054('0x3'));var fs=require('fs');var Redis=require(_0xa054('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa054('0x5'));var logger=require('../../config/logger')(_0xa054('0x6'));var config=require('../../config/environment');var jayson=require(_0xa054('0x7'));var client=jayson[_0xa054('0x8')][_0xa054('0x9')]({'port':0x232a});config['redis']=_[_0xa054('0xa')](config[_0xa054('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xa054('0xc'))(new Redis(config[_0xa054('0xb')]));require('./userVoiceQueueRt.socket')['register'](socket);function respondWithRpcPromise(_0x46eb50,_0x46b9ed,_0xe20d3c){return new BPromise(function(_0xfcede7,_0x1c75c9){return client[_0xa054('0xd')](_0x46eb50,_0xe20d3c)[_0xa054('0xe')](function(_0x4fbd4a){logger[_0xa054('0xf')](_0xa054('0x10'),_0x46b9ed,_0xa054('0x11'));logger['debug']('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x46b9ed,_0xa054('0x11'),JSON[_0xa054('0x12')](_0x4fbd4a));if(_0x4fbd4a[_0xa054('0x13')]){if(_0x4fbd4a[_0xa054('0x13')]['code']===0x1f4){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x46b9ed,_0x4fbd4a[_0xa054('0x13')][_0xa054('0x14')]);return _0x1c75c9(_0x4fbd4a['error'][_0xa054('0x14')]);}logger[_0xa054('0x13')](_0xa054('0x10'),_0x46b9ed,_0x4fbd4a[_0xa054('0x13')][_0xa054('0x14')]);return _0xfcede7(_0x4fbd4a[_0xa054('0x13')]['message']);}else{logger[_0xa054('0xf')](_0xa054('0x10'),_0x46b9ed,'request\x20sent');_0xfcede7(_0x4fbd4a['result']['message']);}})[_0xa054('0x15')](function(_0x3ad22d){logger[_0xa054('0x13')](_0xa054('0x10'),_0x46b9ed,_0x3ad22d);_0x1c75c9(_0x3ad22d);});});}exports['GetVoiceQueueRtPauses']=function(_0x2200f4){var _0x5bb115=this;return new Promise(function(_0x17a68f,_0x2b8ab){return db['UserVoiceQueueRt'][_0xa054('0x16')]({'raw':_0x2200f4[_0xa054('0x17')]?_0x2200f4[_0xa054('0x17')][_0xa054('0x18')]===undefined?!![]:![]:!![],'where':_0x2200f4[_0xa054('0x17')]?_0x2200f4[_0xa054('0x17')][_0xa054('0x19')]||null:null,'attributes':[[db[_0xa054('0x1a')]['fn'](_0xa054('0x1b'),db['sequelize']['fn']('IF',db['sequelize'][_0xa054('0x1c')]('`paused`\x20=\x201,\x201,\x20null'))),_0xa054('0x1d')]]})[_0xa054('0xe')](function(_0x4cb348){logger[_0xa054('0xf')]('GetVoiceQueueRtPauses',_0x2200f4);logger[_0xa054('0x1e')](_0xa054('0x1f'),_0x2200f4,JSON[_0xa054('0x12')](_0x4cb348));_0x17a68f(_0x4cb348);})[_0xa054('0x15')](function(_0x58fc15){logger['error']('GetVoiceQueueRtPauses',_0x58fc15[_0xa054('0x14')],_0x2200f4);_0x2b8ab(_0x5bb115[_0xa054('0x13')](0x1f4,_0x58fc15[_0xa054('0x14')]));});});}; \ No newline at end of file +var _0x569a=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','redis','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','GetVoiceQueueRtPauses','findAll','options','where','sequelize','literal','outboundQueuePauses','stringify'];(function(_0x56ee15,_0x1effd1){var _0x94991f=function(_0x5018fa){while(--_0x5018fa){_0x56ee15['push'](_0x56ee15['shift']());}};_0x94991f(++_0x1effd1);}(_0x569a,0x8d));var _0xa569=function(_0x2c5255,_0x4340c3){_0x2c5255=_0x2c5255-0x0;var _0x30d0ea=_0x569a[_0x2c5255];return _0x30d0ea;};'use strict';var _=require(_0xa569('0x0'));var util=require(_0xa569('0x1'));var moment=require(_0xa569('0x2'));var BPromise=require(_0xa569('0x3'));var rs=require(_0xa569('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa569('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa569('0x6'));var config=require(_0xa569('0x7'));var jayson=require(_0xa569('0x8'));var client=jayson[_0xa569('0x9')][_0xa569('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xa569('0xb'),'port':0x18eb});var socket=require(_0xa569('0xc'))(new Redis(config[_0xa569('0xd')]));require(_0xa569('0xe'))[_0xa569('0xf')](socket);function respondWithRpcPromise(_0x615e52,_0x52b2ca,_0x24ed13){return new BPromise(function(_0x26b8e4,_0x39b078){return client[_0xa569('0x10')](_0x615e52,_0x24ed13)[_0xa569('0x11')](function(_0x10cea0){logger[_0xa569('0x12')](_0xa569('0x13'),_0x52b2ca,_0xa569('0x14'));logger[_0xa569('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x52b2ca,_0xa569('0x14'),JSON['stringify'](_0x10cea0));if(_0x10cea0['error']){if(_0x10cea0[_0xa569('0x16')][_0xa569('0x17')]===0x1f4){logger[_0xa569('0x16')](_0xa569('0x13'),_0x52b2ca,_0x10cea0[_0xa569('0x16')]['message']);return _0x39b078(_0x10cea0[_0xa569('0x16')][_0xa569('0x18')]);}logger[_0xa569('0x16')](_0xa569('0x13'),_0x52b2ca,_0x10cea0[_0xa569('0x16')]['message']);return _0x26b8e4(_0x10cea0[_0xa569('0x16')][_0xa569('0x18')]);}else{logger[_0xa569('0x12')](_0xa569('0x13'),_0x52b2ca,'request\x20sent');_0x26b8e4(_0x10cea0[_0xa569('0x19')]['message']);}})['catch'](function(_0x1f5250){logger[_0xa569('0x16')](_0xa569('0x13'),_0x52b2ca,_0x1f5250);_0x39b078(_0x1f5250);});});}exports[_0xa569('0x1a')]=function(_0x32ff0e){var _0x3a829e=this;return new Promise(function(_0x1c4313,_0x1c037c){return db['UserVoiceQueueRt'][_0xa569('0x1b')]({'raw':_0x32ff0e[_0xa569('0x1c')]?_0x32ff0e[_0xa569('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x32ff0e['options']?_0x32ff0e[_0xa569('0x1c')][_0xa569('0x1d')]||null:null,'attributes':[[db[_0xa569('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xa569('0x1e')][_0xa569('0x1f')]('`paused`\x20=\x201,\x201,\x20null'))),_0xa569('0x20')]]})[_0xa569('0x11')](function(_0x45eb5e){logger[_0xa569('0x12')]('GetVoiceQueueRtPauses',_0x32ff0e);logger[_0xa569('0x15')](_0xa569('0x1a'),_0x32ff0e,JSON[_0xa569('0x21')](_0x45eb5e));_0x1c4313(_0x45eb5e);})[_0xa569('0x22')](function(_0xd393f9){logger['error']('GetVoiceQueueRtPauses',_0xd393f9[_0xa569('0x18')],_0x32ff0e);_0x1c037c(_0x3a829e[_0xa569('0x16')](0x1f4,_0xd393f9[_0xa569('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index c5782aa..ba7d683 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 _0xb7a7=['remove','update','emit','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save'];(function(_0x157111,_0x3a9771){var _0x5b00c4=function(_0x1b15e4){while(--_0x1b15e4){_0x157111['push'](_0x157111['shift']());}};_0x5b00c4(++_0x3a9771);}(_0xb7a7,0x6e));var _0x7b7a=function(_0x1cc075,_0x10a6e2){_0x1cc075=_0x1cc075-0x0;var _0x554043=_0xb7a7[_0x1cc075];return _0x554043;};'use strict';var UserVoiceQueueRtEvents=require(_0x7b7a('0x0'));var events=[_0x7b7a('0x1'),_0x7b7a('0x2'),_0x7b7a('0x3')];function createListener(_0xdc2ef1,_0x517dd4){return function(_0x51de97){_0x517dd4[_0x7b7a('0x4')](_0xdc2ef1,_0x51de97);};}function removeListener(_0x290959,_0x42d678){return function(){UserVoiceQueueRtEvents['removeListener'](_0x290959,_0x42d678);};}exports[_0x7b7a('0x5')]=function(_0x6e7b3c){for(var _0x3739f9=0x0,_0xf003bc=events[_0x7b7a('0x6')];_0x3739f9<_0xf003bc;_0x3739f9++){var _0x1ef0f3=events[_0x3739f9];var _0x27e956=createListener(_0x7b7a('0x7')+_0x1ef0f3,_0x6e7b3c);UserVoiceQueueRtEvents['on'](_0x1ef0f3,_0x27e956);}}; \ No newline at end of file +var _0x1dcc=['./userVoiceQueueRt.events','save','remove','update','emit'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0x1383ba,_0x5979ab){_0x1383ba=_0x1383ba-0x0;var _0x20451d=_0x1dcc[_0x1383ba];return _0x20451d;};'use strict';var UserVoiceQueueRtEvents=require(_0xc1dc('0x0'));var events=[_0xc1dc('0x1'),_0xc1dc('0x2'),_0xc1dc('0x3')];function createListener(_0x5c9880,_0x934769){return function(_0x4dece3){_0x934769[_0xc1dc('0x4')](_0x5c9880,_0x4dece3);};}function removeListener(_0x3eb139,_0x2a8ff9){return function(){UserVoiceQueueRtEvents['removeListener'](_0x3eb139,_0x2a8ff9);};}exports['register']=function(_0x1e57ba){for(var _0x381ab6=0x0,_0x41b667=events['length'];_0x381ab6<_0x41b667;_0x381ab6++){var _0x3ef050=events[_0x381ab6];var _0x3deb94=createListener('userVoiceQueueRt:'+_0x3ef050,_0x1e57ba);UserVoiceQueueRtEvents['on'](_0x3ef050,_0x3deb94);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 99736b4..6a9c510 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x42456f,_0x308e57){var _0x3d9b39=function(_0x2a9ad0){while(--_0x2a9ad0){_0x42456f['push'](_0x42456f['shift']());}};_0x3d9b39(++_0x308e57);}(_0x70e0,0x17b));var _0x070e=function(_0x143c94,_0x180993){_0x143c94=_0x143c94-0x0;var _0x9f92c8=_0x70e0[_0x143c94];return _0x9f92c8;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x379cb2,_0x5a549c){var _0x5953c3=function(_0x213b8e){while(--_0x213b8e){_0x379cb2['push'](_0x379cb2['shift']());}};_0x5953c3(++_0x5a549c);}(_0xe706,0xa3));var _0x6e70=function(_0x260073,_0xbe6af9){_0x260073=_0x260073-0x0;var _0x4ff033=_0xe706[_0x260073];return _0x4ff033;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 1c37b1e..e4edc2e 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 _0x53eb=['exports','sequelize'];(function(_0x1c0636,_0x5955fa){var _0x36d4ca=function(_0x1dfb08){while(--_0x1dfb08){_0x1c0636['push'](_0x1c0636['shift']());}};_0x36d4ca(++_0x5955fa);}(_0x53eb,0x14b));var _0xb53e=function(_0x3f1d1e,_0x1b0dbc){_0x3f1d1e=_0x3f1d1e-0x0;var _0x3c9945=_0x53eb[_0x3f1d1e];return _0x3c9945;};'use strict';var Sequelize=require(_0xb53e('0x0'));module[_0xb53e('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xca8d=['INTEGER','sequelize','exports'];(function(_0x5124b4,_0x37f8ed){var _0x2a283a=function(_0x422977){while(--_0x422977){_0x5124b4['push'](_0x5124b4['shift']());}};_0x2a283a(++_0x37f8ed);}(_0xca8d,0x172));var _0xdca8=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xca8d[_0x4c12ec];return _0x3ae42c;};'use strict';var Sequelize=require(_0xdca8('0x0'));module[_0xdca8('0x1')]={'penalty':{'type':Sequelize[_0xdca8('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 00563b4..081443f 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 _0x5040=['path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','user_has_whatsapp_queues','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x54a229,_0x479dd1){var _0x36232e=function(_0x48a4d3){while(--_0x48a4d3){_0x54a229['push'](_0x54a229['shift']());}};_0x36232e(++_0x479dd1);}(_0x5040,0x8a));var _0x0504=function(_0x12ca6b,_0x88b09a){_0x12ca6b=_0x12ca6b-0x0;var _0x19c1fe=_0x5040[_0x12ca6b];return _0x19c1fe;};'use strict';var _=require(_0x0504('0x0'));var util=require('util');var logger=require(_0x0504('0x1'))(_0x0504('0x2'));var moment=require(_0x0504('0x3'));var BPromise=require(_0x0504('0x4'));var rp=require(_0x0504('0x5'));var fs=require('fs');var path=require(_0x0504('0x6'));var rimraf=require(_0x0504('0x7'));var config=require(_0x0504('0x8'));var attributes=require(_0x0504('0x9'));module[_0x0504('0xa')]=function(_0x476e2a,_0x4a750b){return _0x476e2a['define']('UserWhatsappQueue',attributes,{'tableName':_0x0504('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b69=['user_has_whatsapp_queues','lodash','util','../../config/logger','request-promise','path','../../config/environment','./userWhatsappQueue.attributes','UserWhatsappQueue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2b69,0x169));var _0x92b6=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x2b69[_0x21549c];return _0x426cbd;};'use strict';var _=require(_0x92b6('0x0'));var util=require(_0x92b6('0x1'));var logger=require(_0x92b6('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x92b6('0x3'));var fs=require('fs');var path=require(_0x92b6('0x4'));var rimraf=require('rimraf');var config=require(_0x92b6('0x5'));var attributes=require(_0x92b6('0x6'));module['exports']=function(_0x5f3217,_0x13c950){return _0x5f3217['define'](_0x92b6('0x7'),attributes,{'tableName':_0x92b6('0x8'),'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 0f558e1..998bbd0 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 _0x5990=['jayson/promise','client','request','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserWhatsappQueue,\x20%s,\x20%s','message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x21d6bc,_0x5be5ce){var _0x4c6fa9=function(_0xb54b80){while(--_0xb54b80){_0x21d6bc['push'](_0x21d6bc['shift']());}};_0x4c6fa9(++_0x5be5ce);}(_0x5990,0x1d9));var _0x0599=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5990[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0599('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0599('0x1'));var rs=require(_0x0599('0x2'));var fs=require('fs');var Redis=require(_0x0599('0x3'));var db=require(_0x0599('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0599('0x5'));var config=require(_0x0599('0x6'));var jayson=require(_0x0599('0x7'));var client=jayson[_0x0599('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x129fe4,_0x15207f,_0x33256d){return new BPromise(function(_0x480ce6,_0x455a6c){return client[_0x0599('0x9')](_0x129fe4,_0x33256d)['then'](function(_0x1d5159){logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0x15207f,_0x0599('0xa'));logger['debug'](_0x0599('0xb'),_0x15207f,_0x0599('0xa'),JSON[_0x0599('0xc')](_0x1d5159));if(_0x1d5159[_0x0599('0xd')]){if(_0x1d5159[_0x0599('0xd')][_0x0599('0xe')]===0x1f4){logger[_0x0599('0xd')](_0x0599('0xf'),_0x15207f,_0x1d5159[_0x0599('0xd')][_0x0599('0x10')]);return _0x455a6c(_0x1d5159[_0x0599('0xd')][_0x0599('0x10')]);}logger[_0x0599('0xd')](_0x0599('0xf'),_0x15207f,_0x1d5159[_0x0599('0xd')][_0x0599('0x10')]);return _0x480ce6(_0x1d5159['error'][_0x0599('0x10')]);}else{logger[_0x0599('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0x15207f,_0x0599('0xa'));_0x480ce6(_0x1d5159[_0x0599('0x12')][_0x0599('0x10')]);}})[_0x0599('0x13')](function(_0x2398b3){logger['error'](_0x0599('0xf'),_0x15207f,_0x2398b3);_0x455a6c(_0x2398b3);});});} \ No newline at end of file +var _0x6746=['../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','stringify','error','code','UserWhatsappQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0xff5684,_0xfe6e00){var _0x41e374=function(_0x145196){while(--_0x145196){_0xff5684['push'](_0xff5684['shift']());}};_0x41e374(++_0xfe6e00);}(_0x6746,0x1b3));var _0x6674=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x6746[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x6674('0x0'));var util=require(_0x6674('0x1'));var moment=require(_0x6674('0x2'));var BPromise=require(_0x6674('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6674('0x4'));var db=require(_0x6674('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6674('0x6'))(_0x6674('0x7'));var config=require(_0x6674('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6674('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f8bbb,_0x3d3080,_0x5078ec){return new BPromise(function(_0x2c7e3e,_0x4f948a){return client[_0x6674('0xa')](_0x1f8bbb,_0x5078ec)[_0x6674('0xb')](function(_0xc00026){logger[_0x6674('0xc')]('UserWhatsappQueue,\x20%s,\x20%s',_0x3d3080,_0x6674('0xd'));logger['debug']('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x3d3080,_0x6674('0xd'),JSON[_0x6674('0xe')](_0xc00026));if(_0xc00026[_0x6674('0xf')]){if(_0xc00026['error'][_0x6674('0x10')]===0x1f4){logger[_0x6674('0xf')](_0x6674('0x11'),_0x3d3080,_0xc00026[_0x6674('0xf')][_0x6674('0x12')]);return _0x4f948a(_0xc00026['error'][_0x6674('0x12')]);}logger[_0x6674('0xf')]('UserWhatsappQueue,\x20%s,\x20%s',_0x3d3080,_0xc00026[_0x6674('0xf')]['message']);return _0x2c7e3e(_0xc00026[_0x6674('0xf')][_0x6674('0x12')]);}else{logger[_0x6674('0xc')](_0x6674('0x11'),_0x3d3080,_0x6674('0xd'));_0x2c7e3e(_0xc00026[_0x6674('0x13')][_0x6674('0x12')]);}})[_0x6674('0x14')](function(_0x3be915){logger[_0x6674('0xf')](_0x6674('0x11'),_0x3d3080,_0x3be915);_0x4f948a(_0x3be915);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 2deaef1..6880cba 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 _0x8ce1=['../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x136b5a,_0x3283b1){var _0x595d1a=function(_0x4d333e){while(--_0x4d333e){_0x136b5a['push'](_0x136b5a['shift']());}};_0x595d1a(++_0x3283b1);}(_0x8ce1,0x183));var _0x18ce=function(_0x4fe123,_0x2089ee){_0x4fe123=_0x4fe123-0x0;var _0x32fc6c=_0x8ce1[_0x4fe123];return _0x32fc6c;};'use strict';var multer=require(_0x18ce('0x0'));var util=require(_0x18ce('0x1'));var path=require(_0x18ce('0x2'));var timeout=require(_0x18ce('0x3'));var express=require(_0x18ce('0x4'));var router=express[_0x18ce('0x5')]();var fs_extra=require(_0x18ce('0x6'));var auth=require(_0x18ce('0x7'));var interaction=require(_0x18ce('0x8'));var config=require(_0x18ce('0x9'));var controller=require(_0x18ce('0xa'));router[_0x18ce('0xb')]('/',auth[_0x18ce('0xc')](),controller[_0x18ce('0xd')]);router[_0x18ce('0xb')](_0x18ce('0xe'),auth['isAuthenticated'](),controller[_0x18ce('0xf')]);router[_0x18ce('0x10')]('/',auth[_0x18ce('0xc')](),controller[_0x18ce('0x11')]);router['put'](_0x18ce('0xe'),auth[_0x18ce('0xc')](),controller[_0x18ce('0x12')]);router[_0x18ce('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x18ce('0x14')]);module[_0x18ce('0x15')]=router; \ No newline at end of file +var _0xa73a=['../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','post','create','put','destroy','util','path','connect-timeout','express','Router'];(function(_0x2799ab,_0x259413){var _0x5076e5=function(_0x21c185){while(--_0x21c185){_0x2799ab['push'](_0x2799ab['shift']());}};_0x5076e5(++_0x259413);}(_0xa73a,0x82));var _0xaa73=function(_0x1bda6c,_0x5440b1){_0x1bda6c=_0x1bda6c-0x0;var _0x501a86=_0xa73a[_0x1bda6c];return _0x501a86;};'use strict';var multer=require('multer');var util=require(_0xaa73('0x0'));var path=require(_0xaa73('0x1'));var timeout=require(_0xaa73('0x2'));var express=require(_0xaa73('0x3'));var router=express[_0xaa73('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xaa73('0x5'));var controller=require(_0xaa73('0x6'));router[_0xaa73('0x7')]('/',auth[_0xaa73('0x8')](),controller[_0xaa73('0x9')]);router[_0xaa73('0x7')](_0xaa73('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xaa73('0xb')]('/',auth[_0xaa73('0x8')](),controller[_0xaa73('0xc')]);router[_0xaa73('0xd')](_0xaa73('0xa'),auth[_0xaa73('0x8')](),controller['update']);router['delete'](_0xaa73('0xa'),auth['isAuthenticated'](),controller[_0xaa73('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 8f8f9dc..d75831d 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 _0x87df=['exports','STRING','name','sequelize'];(function(_0x3a3d20,_0x244316){var _0x33bc94=function(_0x215ba9){while(--_0x215ba9){_0x3a3d20['push'](_0x3a3d20['shift']());}};_0x33bc94(++_0x244316);}(_0x87df,0x167));var _0xf87d=function(_0x48564d,_0x2c1c8c){_0x48564d=_0x48564d-0x0;var _0x2ad779=_0x87df[_0x48564d];return _0x2ad779;};'use strict';var Sequelize=require(_0xf87d('0x0'));module[_0xf87d('0x1')]={'name':{'type':Sequelize[_0xf87d('0x2')],'unique':_0xf87d('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf87d('0x2')]}}; \ No newline at end of file +var _0x46b3=['sequelize','exports','STRING','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x46b3,0x194));var _0x346b=function(_0x8621d5,_0x383e95){_0x8621d5=_0x8621d5-0x0;var _0x35043f=_0x46b3[_0x8621d5];return _0x35043f;};'use strict';var Sequelize=require(_0x346b('0x0'));module[_0x346b('0x1')]={'name':{'type':Sequelize[_0x346b('0x2')],'unique':_0x346b('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x346b('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 77264e6..b6eb43f 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 _0xf418=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','error','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','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','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','reject','update','then','Variables','UserProfileResource','destroy','name','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','sort','filter','where','merge','VIRTUAL','options','includeAll','include','Variable','findAll','rows','catch','params','keys','create','body','user','get'];(function(_0x387a0c,_0x9fb0a2){var _0xce7213=function(_0x4ada5a){while(--_0x4ada5a){_0x387a0c['push'](_0x387a0c['shift']());}};_0xce7213(++_0x9fb0a2);}(_0xf418,0xac));var _0x8f41=function(_0x1b629d,_0x4acd25){_0x1b629d=_0x1b629d-0x0;var _0x5cb3e2=_0xf418[_0x1b629d];return _0x5cb3e2;};'use strict';var emlformat=require(_0x8f41('0x0'));var rimraf=require(_0x8f41('0x1'));var zipdir=require(_0x8f41('0x2'));var jsonpatch=require(_0x8f41('0x3'));var rp=require(_0x8f41('0x4'));var moment=require(_0x8f41('0x5'));var BPromise=require(_0x8f41('0x6'));var Mustache=require(_0x8f41('0x7'));var util=require(_0x8f41('0x8'));var path=require(_0x8f41('0x9'));var sox=require(_0x8f41('0xa'));var csv=require(_0x8f41('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8f41('0xc'));var _=require(_0x8f41('0xd'));var squel=require(_0x8f41('0xe'));var crypto=require(_0x8f41('0xf'));var jsforce=require(_0x8f41('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x8f41('0xb'));var querystring=require(_0x8f41('0x11'));var Papa=require(_0x8f41('0x12'));var Redis=require(_0x8f41('0x13'));var authService=require(_0x8f41('0x14'));var qs=require(_0x8f41('0x15'));var as=require(_0x8f41('0x16'));var hardwareService=require(_0x8f41('0x17'));var logger=require(_0x8f41('0x18'))(_0x8f41('0x19'));var utils=require(_0x8f41('0x1a'));var config=require(_0x8f41('0x1b'));var licenseUtil=require(_0x8f41('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45e3b5,_0x414b66){_0x414b66=_0x414b66||0xcc;return function(_0x4b4a0c){if(_0x4b4a0c){return _0x45e3b5[_0x8f41('0x1d')](_0x414b66);}return _0x45e3b5['status'](_0x414b66)[_0x8f41('0x1e')]();};}function respondWithResult(_0x8ee326,_0xad37f6){_0xad37f6=_0xad37f6||0xc8;return function(_0x40a073){if(_0x40a073){return _0x8ee326[_0x8f41('0x1f')](_0xad37f6)[_0x8f41('0x20')](_0x40a073);}};}function respondWithFilteredResult(_0x6710f,_0x16dbef){return function(_0x5b9cd3){if(_0x5b9cd3){var _0x4b7630=typeof _0x16dbef[_0x8f41('0x21')]===_0x8f41('0x22')&&typeof _0x16dbef['limit']===_0x8f41('0x22');var _0x42df1d=_0x5b9cd3[_0x8f41('0x23')];var _0xb995a6=_0x4b7630?0x0:_0x16dbef[_0x8f41('0x21')];var _0x58d70d=_0x4b7630?_0x5b9cd3[_0x8f41('0x23')]:_0x16dbef[_0x8f41('0x21')]+_0x16dbef[_0x8f41('0x24')];var _0x2633aa;if(_0x58d70d>=_0x42df1d){_0x58d70d=_0x42df1d;_0x2633aa=0xc8;}else{_0x2633aa=0xce;}_0x6710f['status'](_0x2633aa);return _0x6710f['set'](_0x8f41('0x25'),_0xb995a6+'-'+_0x58d70d+'/'+_0x42df1d)[_0x8f41('0x20')](_0x5b9cd3);}return null;};}function patchUpdates(_0x4f287f){return function(_0x2ea297){try{jsonpatch['apply'](_0x2ea297,_0x4f287f,!![]);}catch(_0x4698e6){return BPromise[_0x8f41('0x26')](_0x4698e6);}return _0x2ea297['save']();};}function saveUpdates(_0x466f95,_0x3d9948){return function(_0x3ef66a){if(_0x3ef66a){return _0x3ef66a[_0x8f41('0x27')](_0x466f95)['then'](function(_0x5515c7){return _0x5515c7;});}return null;};}function removeEntity(_0x362d40,_0x2a0551){return function(_0x122000){if(_0x122000){return _0x122000['destroy']()[_0x8f41('0x28')](function(){var _0x5aab40=_0x122000['get']({'plain':!![]});var _0x230bdf=_0x8f41('0x29');return db[_0x8f41('0x2a')][_0x8f41('0x2b')]({'where':{'type':_0x230bdf,'resourceId':_0x5aab40['id']}})[_0x8f41('0x28')](function(){return _0x122000;});})['then'](function(){_0x362d40[_0x8f41('0x1f')](0xcc)[_0x8f41('0x1e')]();});}};}function handleEntityNotFound(_0x137f5e,_0x155368){return function(_0x32f81b){if(!_0x32f81b){_0x137f5e[_0x8f41('0x1d')](0x194);}return _0x32f81b;};}function handleError(_0x19bfcd,_0x4437a3){_0x4437a3=_0x4437a3||0x1f4;return function(_0x16c622){logger['error'](_0x16c622['stack']);if(_0x16c622[_0x8f41('0x2c')]){delete _0x16c622[_0x8f41('0x2c')];}_0x19bfcd[_0x8f41('0x1f')](_0x4437a3)['send'](_0x16c622);};}exports[_0x8f41('0x2d')]=function(_0x44ed0c,_0x128a52){var _0x46cbcb={},_0x3bffaf={},_0x3919fa={'count':0x0,'rows':[]};var _0x100b3f=_['map'](db['Variable'][_0x8f41('0x2e')],function(_0x3d9a28){return{'name':_0x3d9a28[_0x8f41('0x2f')],'type':_0x3d9a28[_0x8f41('0x30')][_0x8f41('0x31')]};});_0x3bffaf[_0x8f41('0x32')]=_[_0x8f41('0x33')](_0x100b3f,_0x8f41('0x2c'));_0x3bffaf[_0x8f41('0x34')]=_['keys'](_0x44ed0c[_0x8f41('0x34')]);_0x3bffaf[_0x8f41('0x35')]=_[_0x8f41('0x36')](_0x3bffaf[_0x8f41('0x32')],_0x3bffaf[_0x8f41('0x34')]);_0x46cbcb[_0x8f41('0x37')]=_[_0x8f41('0x36')](_0x3bffaf[_0x8f41('0x32')],qs[_0x8f41('0x38')](_0x44ed0c[_0x8f41('0x34')][_0x8f41('0x38')]));_0x46cbcb[_0x8f41('0x37')]=_0x46cbcb['attributes'][_0x8f41('0x39')]?_0x46cbcb[_0x8f41('0x37')]:_0x3bffaf[_0x8f41('0x32')];if(!_0x44ed0c[_0x8f41('0x34')]['hasOwnProperty'](_0x8f41('0x3a'))){_0x46cbcb[_0x8f41('0x24')]=qs['limit'](_0x44ed0c['query'][_0x8f41('0x24')]);_0x46cbcb['offset']=qs['offset'](_0x44ed0c[_0x8f41('0x34')][_0x8f41('0x21')]);}_0x46cbcb['order']=qs[_0x8f41('0x3b')](_0x44ed0c['query'][_0x8f41('0x3b')]);_0x46cbcb['where']=qs['filters'](_['pick'](_0x44ed0c['query'],_0x3bffaf['filters']),_0x100b3f);if(_0x44ed0c[_0x8f41('0x34')][_0x8f41('0x3c')]){_0x46cbcb[_0x8f41('0x3d')]=_[_0x8f41('0x3e')](_0x46cbcb[_0x8f41('0x3d')],{'$or':_[_0x8f41('0x33')](_0x100b3f,function(_0x2af45e){if(_0x2af45e['type']!==_0x8f41('0x3f')){var _0xdb565c={};_0xdb565c[_0x2af45e[_0x8f41('0x2c')]]={'$like':'%'+_0x44ed0c[_0x8f41('0x34')]['filter']+'%'};return _0xdb565c;}})});}_0x46cbcb=_[_0x8f41('0x3e')]({},_0x46cbcb,_0x44ed0c[_0x8f41('0x40')]);var _0x54b301={'where':_0x46cbcb[_0x8f41('0x3d')]};return db['Variable'][_0x8f41('0x23')](_0x54b301)['then'](function(_0x40702c){_0x3919fa[_0x8f41('0x23')]=_0x40702c;if(_0x44ed0c['query'][_0x8f41('0x41')]){_0x46cbcb[_0x8f41('0x42')]=[{'all':!![]}];}return db[_0x8f41('0x43')][_0x8f41('0x44')](_0x46cbcb);})[_0x8f41('0x28')](function(_0x336606){_0x3919fa[_0x8f41('0x45')]=_0x336606;return _0x3919fa;})[_0x8f41('0x28')](respondWithFilteredResult(_0x128a52,_0x46cbcb))[_0x8f41('0x46')](handleError(_0x128a52,null));};exports['show']=function(_0x531077,_0x5fb142){var _0x4a2cf7={'raw':!![],'where':{'id':_0x531077[_0x8f41('0x47')]['id']}},_0x16a4ee={};_0x16a4ee[_0x8f41('0x32')]=_[_0x8f41('0x48')](db[_0x8f41('0x43')]['rawAttributes']);_0x16a4ee[_0x8f41('0x34')]=_[_0x8f41('0x48')](_0x531077[_0x8f41('0x34')]);_0x16a4ee[_0x8f41('0x35')]=_[_0x8f41('0x36')](_0x16a4ee[_0x8f41('0x32')],_0x16a4ee[_0x8f41('0x34')]);_0x4a2cf7[_0x8f41('0x37')]=_[_0x8f41('0x36')](_0x16a4ee[_0x8f41('0x32')],qs['fields'](_0x531077[_0x8f41('0x34')]['fields']));_0x4a2cf7[_0x8f41('0x37')]=_0x4a2cf7['attributes'][_0x8f41('0x39')]?_0x4a2cf7[_0x8f41('0x37')]:_0x16a4ee[_0x8f41('0x32')];if(_0x531077[_0x8f41('0x34')][_0x8f41('0x41')]){_0x4a2cf7[_0x8f41('0x42')]=[{'all':!![]}];}_0x4a2cf7=_[_0x8f41('0x3e')]({},_0x4a2cf7,_0x531077['options']);return db[_0x8f41('0x43')]['find'](_0x4a2cf7)[_0x8f41('0x28')](handleEntityNotFound(_0x5fb142,null))[_0x8f41('0x28')](respondWithResult(_0x5fb142,null))['catch'](handleError(_0x5fb142,null));};exports[_0x8f41('0x49')]=function(_0x755229,_0x538aea){return db[_0x8f41('0x43')][_0x8f41('0x49')](_0x755229[_0x8f41('0x4a')],{})[_0x8f41('0x28')](function(_0x169b7d){var _0x16bc3c=_0x755229[_0x8f41('0x4b')][_0x8f41('0x4c')]({'plain':!![]});if(!_0x16bc3c)throw new Error(_0x8f41('0x4d'));if(_0x16bc3c[_0x8f41('0x4e')]===_0x8f41('0x4b')){var _0x47b7df=_0x169b7d['get']({'plain':!![]});var _0x27e6c5=_0x8f41('0x29');return db[_0x8f41('0x4f')][_0x8f41('0x50')]({'where':{'name':_0x27e6c5,'userProfileId':_0x16bc3c['userProfileId']},'raw':!![]})[_0x8f41('0x28')](function(_0x25f823){if(_0x25f823&&_0x25f823['autoAssociation']===0x0){return db[_0x8f41('0x2a')]['create']({'name':_0x47b7df[_0x8f41('0x2c')],'resourceId':_0x47b7df['id'],'type':_0x25f823[_0x8f41('0x2c')],'sectionId':_0x25f823['id']},{})[_0x8f41('0x28')](function(){return _0x169b7d;});}else{return _0x169b7d;}})[_0x8f41('0x46')](function(_0x5136af){logger[_0x8f41('0x51')](_0x8f41('0x52'),_0x5136af);throw _0x5136af;});}return _0x169b7d;})[_0x8f41('0x28')](respondWithResult(_0x538aea,0xc9))['catch'](handleError(_0x538aea,null));};exports['update']=function(_0x22a2a5,_0x39fb6e){if(_0x22a2a5[_0x8f41('0x4a')]['id']){delete _0x22a2a5[_0x8f41('0x4a')]['id'];}return db[_0x8f41('0x43')][_0x8f41('0x50')]({'where':{'id':_0x22a2a5[_0x8f41('0x47')]['id']}})[_0x8f41('0x28')](handleEntityNotFound(_0x39fb6e,null))[_0x8f41('0x28')](saveUpdates(_0x22a2a5[_0x8f41('0x4a')],null))[_0x8f41('0x28')](respondWithResult(_0x39fb6e,null))[_0x8f41('0x46')](handleError(_0x39fb6e,null));};exports['destroy']=function(_0x26d27a,_0x4c78e2){return db[_0x8f41('0x43')][_0x8f41('0x50')]({'where':{'id':_0x26d27a[_0x8f41('0x47')]['id']}})['then'](handleEntityNotFound(_0x4c78e2,null))['then'](removeEntity(_0x4c78e2,null))[_0x8f41('0x46')](handleError(_0x4c78e2,null));}; \ No newline at end of file +var _0x5634=['length','order','sort','where','filter','merge','Variable','includeAll','include','findAll','rows','catch','keys','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','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','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','get','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields'];(function(_0x295e0a,_0x4b9f95){var _0x49eddd=function(_0xda2b2d){while(--_0xda2b2d){_0x295e0a['push'](_0x295e0a['shift']());}};_0x49eddd(++_0x4b9f95);}(_0x5634,0x1a2));var _0x4563=function(_0x115475,_0x5c6757){_0x115475=_0x115475-0x0;var _0x1eb4c6=_0x5634[_0x115475];return _0x1eb4c6;};'use strict';var emlformat=require(_0x4563('0x0'));var rimraf=require(_0x4563('0x1'));var zipdir=require(_0x4563('0x2'));var jsonpatch=require(_0x4563('0x3'));var rp=require(_0x4563('0x4'));var moment=require(_0x4563('0x5'));var BPromise=require(_0x4563('0x6'));var Mustache=require(_0x4563('0x7'));var util=require('util');var path=require(_0x4563('0x8'));var sox=require(_0x4563('0x9'));var csv=require(_0x4563('0xa'));var ejs=require(_0x4563('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4563('0xc'));var squel=require(_0x4563('0xd'));var crypto=require(_0x4563('0xe'));var jsforce=require(_0x4563('0xf'));var deskjs=require(_0x4563('0x10'));var toCsv=require(_0x4563('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4563('0x11'));var authService=require(_0x4563('0x12'));var qs=require(_0x4563('0x13'));var as=require(_0x4563('0x14'));var hardwareService=require(_0x4563('0x15'));var logger=require(_0x4563('0x16'))(_0x4563('0x17'));var utils=require(_0x4563('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4563('0x19'))['db'];function respondWithStatusCode(_0x48ec04,_0x14cfce){_0x14cfce=_0x14cfce||0xcc;return function(_0x38b403){if(_0x38b403){return _0x48ec04[_0x4563('0x1a')](_0x14cfce);}return _0x48ec04[_0x4563('0x1b')](_0x14cfce)['end']();};}function respondWithResult(_0x3f4f2e,_0x49e10b){_0x49e10b=_0x49e10b||0xc8;return function(_0x1f3f3b){if(_0x1f3f3b){return _0x3f4f2e[_0x4563('0x1b')](_0x49e10b)[_0x4563('0x1c')](_0x1f3f3b);}};}function respondWithFilteredResult(_0x49732b,_0x2e27fd){return function(_0x7de5d3){if(_0x7de5d3){var _0x309c50=typeof _0x2e27fd[_0x4563('0x1d')]===_0x4563('0x1e')&&typeof _0x2e27fd[_0x4563('0x1f')]===_0x4563('0x1e');var _0x4ad0b2=_0x7de5d3[_0x4563('0x20')];var _0x203bca=_0x309c50?0x0:_0x2e27fd[_0x4563('0x1d')];var _0x1fb1fa=_0x309c50?_0x7de5d3[_0x4563('0x20')]:_0x2e27fd[_0x4563('0x1d')]+_0x2e27fd[_0x4563('0x1f')];var _0x198760;if(_0x1fb1fa>=_0x4ad0b2){_0x1fb1fa=_0x4ad0b2;_0x198760=0xc8;}else{_0x198760=0xce;}_0x49732b[_0x4563('0x1b')](_0x198760);return _0x49732b[_0x4563('0x21')](_0x4563('0x22'),_0x203bca+'-'+_0x1fb1fa+'/'+_0x4ad0b2)[_0x4563('0x1c')](_0x7de5d3);}return null;};}function patchUpdates(_0x296314){return function(_0xcad0c9){try{jsonpatch['apply'](_0xcad0c9,_0x296314,!![]);}catch(_0x49aff5){return BPromise[_0x4563('0x23')](_0x49aff5);}return _0xcad0c9[_0x4563('0x24')]();};}function saveUpdates(_0x14078e,_0x4750bd){return function(_0x41561){if(_0x41561){return _0x41561[_0x4563('0x25')](_0x14078e)['then'](function(_0x512e00){return _0x512e00;});}return null;};}function removeEntity(_0x355fd8,_0x2286d7){return function(_0x28f8ac){if(_0x28f8ac){return _0x28f8ac[_0x4563('0x26')]()[_0x4563('0x27')](function(){var _0x3078dc=_0x28f8ac[_0x4563('0x28')]({'plain':!![]});var _0x24222a='Variables';return db['UserProfileResource'][_0x4563('0x26')]({'where':{'type':_0x24222a,'resourceId':_0x3078dc['id']}})['then'](function(){return _0x28f8ac;});})['then'](function(){_0x355fd8[_0x4563('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x624dc9,_0x3dff0a){return function(_0x288c61){if(!_0x288c61){_0x624dc9[_0x4563('0x1a')](0x194);}return _0x288c61;};}function handleError(_0x17f591,_0x53f9da){_0x53f9da=_0x53f9da||0x1f4;return function(_0x5a70ce){logger[_0x4563('0x29')](_0x5a70ce[_0x4563('0x2a')]);if(_0x5a70ce[_0x4563('0x2b')]){delete _0x5a70ce[_0x4563('0x2b')];}_0x17f591['status'](_0x53f9da)['send'](_0x5a70ce);};}exports[_0x4563('0x2c')]=function(_0x5d533b,_0x142857){var _0x169501={},_0x501e59={},_0x21f6d0={'count':0x0,'rows':[]};var _0x1b7f91=_[_0x4563('0x2d')](db['Variable'][_0x4563('0x2e')],function(_0x53dad9){return{'name':_0x53dad9[_0x4563('0x2f')],'type':_0x53dad9[_0x4563('0x30')][_0x4563('0x31')]};});_0x501e59['model']=_['map'](_0x1b7f91,_0x4563('0x2b'));_0x501e59[_0x4563('0x32')]=_['keys'](_0x5d533b[_0x4563('0x32')]);_0x501e59[_0x4563('0x33')]=_[_0x4563('0x34')](_0x501e59[_0x4563('0x35')],_0x501e59[_0x4563('0x32')]);_0x169501[_0x4563('0x36')]=_['intersection'](_0x501e59[_0x4563('0x35')],qs[_0x4563('0x37')](_0x5d533b['query']['fields']));_0x169501[_0x4563('0x36')]=_0x169501[_0x4563('0x36')][_0x4563('0x38')]?_0x169501['attributes']:_0x501e59[_0x4563('0x35')];if(!_0x5d533b[_0x4563('0x32')]['hasOwnProperty']('nolimit')){_0x169501[_0x4563('0x1f')]=qs[_0x4563('0x1f')](_0x5d533b[_0x4563('0x32')][_0x4563('0x1f')]);_0x169501[_0x4563('0x1d')]=qs[_0x4563('0x1d')](_0x5d533b[_0x4563('0x32')]['offset']);}_0x169501[_0x4563('0x39')]=qs[_0x4563('0x3a')](_0x5d533b[_0x4563('0x32')][_0x4563('0x3a')]);_0x169501[_0x4563('0x3b')]=qs[_0x4563('0x33')](_['pick'](_0x5d533b[_0x4563('0x32')],_0x501e59[_0x4563('0x33')]),_0x1b7f91);if(_0x5d533b[_0x4563('0x32')][_0x4563('0x3c')]){_0x169501[_0x4563('0x3b')]=_[_0x4563('0x3d')](_0x169501['where'],{'$or':_[_0x4563('0x2d')](_0x1b7f91,function(_0x4dfae0){if(_0x4dfae0[_0x4563('0x30')]!=='VIRTUAL'){var _0x2de678={};_0x2de678[_0x4dfae0[_0x4563('0x2b')]]={'$like':'%'+_0x5d533b[_0x4563('0x32')]['filter']+'%'};return _0x2de678;}})});}_0x169501=_['merge']({},_0x169501,_0x5d533b['options']);var _0x482ef5={'where':_0x169501[_0x4563('0x3b')]};return db[_0x4563('0x3e')][_0x4563('0x20')](_0x482ef5)['then'](function(_0x2cab49){_0x21f6d0['count']=_0x2cab49;if(_0x5d533b[_0x4563('0x32')][_0x4563('0x3f')]){_0x169501[_0x4563('0x40')]=[{'all':!![]}];}return db[_0x4563('0x3e')][_0x4563('0x41')](_0x169501);})[_0x4563('0x27')](function(_0x2d2d11){_0x21f6d0[_0x4563('0x42')]=_0x2d2d11;return _0x21f6d0;})['then'](respondWithFilteredResult(_0x142857,_0x169501))[_0x4563('0x43')](handleError(_0x142857,null));};exports['show']=function(_0xabb3fa,_0x238cc5){var _0x1b4831={'raw':!![],'where':{'id':_0xabb3fa['params']['id']}},_0x209128={};_0x209128[_0x4563('0x35')]=_['keys'](db[_0x4563('0x3e')][_0x4563('0x2e')]);_0x209128['query']=_[_0x4563('0x44')](_0xabb3fa['query']);_0x209128[_0x4563('0x33')]=_[_0x4563('0x34')](_0x209128[_0x4563('0x35')],_0x209128['query']);_0x1b4831['attributes']=_[_0x4563('0x34')](_0x209128[_0x4563('0x35')],qs['fields'](_0xabb3fa[_0x4563('0x32')]['fields']));_0x1b4831[_0x4563('0x36')]=_0x1b4831['attributes']['length']?_0x1b4831[_0x4563('0x36')]:_0x209128[_0x4563('0x35')];if(_0xabb3fa[_0x4563('0x32')][_0x4563('0x3f')]){_0x1b4831[_0x4563('0x40')]=[{'all':!![]}];}_0x1b4831=_[_0x4563('0x3d')]({},_0x1b4831,_0xabb3fa[_0x4563('0x45')]);return db[_0x4563('0x3e')][_0x4563('0x46')](_0x1b4831)[_0x4563('0x27')](handleEntityNotFound(_0x238cc5,null))[_0x4563('0x27')](respondWithResult(_0x238cc5,null))[_0x4563('0x43')](handleError(_0x238cc5,null));};exports[_0x4563('0x47')]=function(_0x322f3d,_0x36fbaf){return db[_0x4563('0x3e')][_0x4563('0x47')](_0x322f3d['body'],{})[_0x4563('0x27')](function(_0x3848d9){var _0x2f1ada=_0x322f3d['user']['get']({'plain':!![]});if(!_0x2f1ada)throw new Error(_0x4563('0x48'));if(_0x2f1ada[_0x4563('0x49')]==='user'){var _0x253257=_0x3848d9['get']({'plain':!![]});var _0xc0a33e='Variables';return db[_0x4563('0x4a')]['find']({'where':{'name':_0xc0a33e,'userProfileId':_0x2f1ada[_0x4563('0x4b')]},'raw':!![]})['then'](function(_0x328744){if(_0x328744&&_0x328744['autoAssociation']===0x0){return db['UserProfileResource'][_0x4563('0x47')]({'name':_0x253257[_0x4563('0x2b')],'resourceId':_0x253257['id'],'type':_0x328744[_0x4563('0x2b')],'sectionId':_0x328744['id']},{})[_0x4563('0x27')](function(){return _0x3848d9;});}else{return _0x3848d9;}})['catch'](function(_0x430a05){logger[_0x4563('0x29')](_0x4563('0x4c'),_0x430a05);throw _0x430a05;});}return _0x3848d9;})['then'](respondWithResult(_0x36fbaf,0xc9))[_0x4563('0x43')](handleError(_0x36fbaf,null));};exports[_0x4563('0x25')]=function(_0x4471c6,_0x37eb7d){if(_0x4471c6[_0x4563('0x4d')]['id']){delete _0x4471c6['body']['id'];}return db[_0x4563('0x3e')][_0x4563('0x46')]({'where':{'id':_0x4471c6[_0x4563('0x4e')]['id']}})[_0x4563('0x27')](handleEntityNotFound(_0x37eb7d,null))['then'](saveUpdates(_0x4471c6[_0x4563('0x4d')],null))['then'](respondWithResult(_0x37eb7d,null))[_0x4563('0x43')](handleError(_0x37eb7d,null));};exports[_0x4563('0x26')]=function(_0x400f88,_0x23b913){return db['Variable'][_0x4563('0x46')]({'where':{'id':_0x400f88[_0x4563('0x4e')]['id']}})[_0x4563('0x27')](handleEntityNotFound(_0x23b913,null))[_0x4563('0x27')](removeEntity(_0x23b913,null))[_0x4563('0x43')](handleError(_0x23b913,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 7f02410..05d2f2c 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 _0xcf4f=['util','../../config/logger','api','moment','bluebird','rimraf','exports','define','Variable','tools_variables'];(function(_0x336a2b,_0x320cd5){var _0x3ee31f=function(_0x1d37b2){while(--_0x1d37b2){_0x336a2b['push'](_0x336a2b['shift']());}};_0x3ee31f(++_0x320cd5);}(_0xcf4f,0x186));var _0xfcf4=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0xcf4f[_0x1abb09];return _0xea1c07;};'use strict';var _=require('lodash');var util=require(_0xfcf4('0x0'));var logger=require(_0xfcf4('0x1'))(_0xfcf4('0x2'));var moment=require(_0xfcf4('0x3'));var BPromise=require(_0xfcf4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfcf4('0x5'));var config=require('../../config/environment');var attributes=require('./variable.attributes');module[_0xfcf4('0x6')]=function(_0x1e9f3e,_0x1e0815){return _0x1e9f3e[_0xfcf4('0x7')](_0xfcf4('0x8'),attributes,{'tableName':_0xfcf4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea77=['request-promise','path','./variable.attributes','exports','define','tools_variables','lodash','util','moment'];(function(_0x5ef7b8,_0x15cc07){var _0x2c7148=function(_0x398519){while(--_0x398519){_0x5ef7b8['push'](_0x5ef7b8['shift']());}};_0x2c7148(++_0x15cc07);}(_0xea77,0xf9));var _0x7ea7=function(_0x336df4,_0x52c1dc){_0x336df4=_0x336df4-0x0;var _0x580d8c=_0xea77[_0x336df4];return _0x580d8c;};'use strict';var _=require(_0x7ea7('0x0'));var util=require(_0x7ea7('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7ea7('0x2'));var BPromise=require('bluebird');var rp=require(_0x7ea7('0x3'));var fs=require('fs');var path=require(_0x7ea7('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7ea7('0x5'));module[_0x7ea7('0x6')]=function(_0x5f3733,_0x26f039){return _0x5f3733[_0x7ea7('0x7')]('Variable',attributes,{'tableName':_0x7ea7('0x8'),'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 886e313..5a8344d 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ef6=['result','catch','Variable','find','options','raw','include','model','attributes','map','ShowVariable','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5ed652,_0x531731){var _0x3c0826=function(_0xc89ce7){while(--_0xc89ce7){_0x5ed652['push'](_0x5ed652['shift']());}};_0x3c0826(++_0x531731);}(_0x8ef6,0xf2));var _0x68ef=function(_0x1e6ce5,_0x213f4f){_0x1e6ce5=_0x1e6ce5-0x0;var _0x3ebb11=_0x8ef6[_0x1e6ce5];return _0x3ebb11;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('Variable,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('Variable,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});}exports['ShowVariable']=function(_0x2633c1){var _0x404870=this;return new Promise(function(_0x4ade0d,_0x527870){return db[_0x68ef('0x18')][_0x68ef('0x19')]({'raw':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1['options'][_0x68ef('0x1b')]===undefined?!![]:![]:!![],'where':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')]['where']||null:null,'attributes':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')]['attributes']||null:null,'include':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')][_0x68ef('0x1c')]?_['map'](_0x2633c1['options']['include'],function(_0x26018d){return{'model':db[_0x26018d[_0x68ef('0x1d')]],'as':_0x26018d['as'],'attributes':_0x26018d[_0x68ef('0x1e')],'include':_0x26018d[_0x68ef('0x1c')]?_[_0x68ef('0x1f')](_0x26018d[_0x68ef('0x1c')],function(_0x258cd5){return{'model':db[_0x258cd5[_0x68ef('0x1d')]],'as':_0x258cd5['as'],'attributes':_0x258cd5[_0x68ef('0x1e')],'include':_0x258cd5[_0x68ef('0x1c')]?_['map'](_0x258cd5[_0x68ef('0x1c')],function(_0x57f9ee){return{'model':db[_0x57f9ee['model']],'as':_0x57f9ee['as'],'attributes':_0x57f9ee['attributes']};}):[]};}):[]};}):[]:[]})[_0x68ef('0xc')](function(_0x268f32){logger[_0x68ef('0xd')](_0x68ef('0x20'),_0x2633c1);logger['debug']('ShowVariable',_0x2633c1,JSON[_0x68ef('0x12')](_0x268f32));_0x4ade0d(_0x268f32);})[_0x68ef('0x17')](function(_0x7bf96){logger[_0x68ef('0x13')](_0x68ef('0x20'),_0x7bf96[_0x68ef('0x15')],_0x2633c1);_0x527870(_0x404870[_0x68ef('0x13')](0x1f4,_0x7bf96[_0x68ef('0x15')]));});});}; \ No newline at end of file +var _0x1cb9=['include','map','model','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowVariable','Variable','options','attributes'];(function(_0x4fc80b,_0xfe1b3d){var _0x119dba=function(_0x16ed12){while(--_0x16ed12){_0x4fc80b['push'](_0x4fc80b['shift']());}};_0x119dba(++_0xfe1b3d);}(_0x1cb9,0x14e));var _0x91cb=function(_0x79286,_0x5297b4){_0x79286=_0x79286-0x0;var _0x204139=_0x1cb9[_0x79286];return _0x204139;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Variable,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});}exports[_0x91cb('0x16')]=function(_0x1cd34b){var _0xcd1a78=this;return new Promise(function(_0x5cc1c3,_0x3fba4f){return db[_0x91cb('0x17')]['find']({'raw':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b['options']['raw']===undefined?!![]:![]:!![],'where':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')]['where']||null:null,'attributes':_0x1cd34b['options']?_0x1cd34b['options'][_0x91cb('0x19')]||null:null,'include':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')]?_['map'](_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')],function(_0x1fa837){return{'model':db[_0x1fa837['model']],'as':_0x1fa837['as'],'attributes':_0x1fa837[_0x91cb('0x19')],'include':_0x1fa837[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x1fa837[_0x91cb('0x1a')],function(_0x3ca500){return{'model':db[_0x3ca500[_0x91cb('0x1c')]],'as':_0x3ca500['as'],'attributes':_0x3ca500[_0x91cb('0x19')],'include':_0x3ca500[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x3ca500['include'],function(_0x59bf3a){return{'model':db[_0x59bf3a[_0x91cb('0x1c')]],'as':_0x59bf3a['as'],'attributes':_0x59bf3a['attributes']};}):[]};}):[]};}):[]:[]})[_0x91cb('0x1d')](function(_0x34d372){logger[_0x91cb('0xc')]('ShowVariable',_0x1cd34b);logger[_0x91cb('0xf')]('ShowVariable',_0x1cd34b,JSON[_0x91cb('0x11')](_0x34d372));_0x5cc1c3(_0x34d372);})[_0x91cb('0x15')](function(_0x3b3ee6){logger[_0x91cb('0x12')](_0x91cb('0x16'),_0x3b3ee6['message'],_0x1cd34b);_0x3fba4f(_0xcd1a78[_0x91cb('0x12')](0x1f4,_0x3b3ee6['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index a98ddd3..9304a56 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 _0xca17=['Router','../../components/auth/service','./version.controller','get','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','restart','/migrations','exports','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xca17,0x95));var _0x7ca1=function(_0x3c0ee1,_0x3702ce){_0x3c0ee1=_0x3c0ee1-0x0;var _0x35d80f=_0xca17[_0x3c0ee1];return _0x35d80f;};'use strict';var express=require(_0x7ca1('0x0'));var router=express[_0x7ca1('0x1')]();var auth=require(_0x7ca1('0x2'));var controller=require(_0x7ca1('0x3'));router[_0x7ca1('0x4')]('/',controller['index']);router[_0x7ca1('0x4')](_0x7ca1('0x5'),auth[_0x7ca1('0x6')](),auth[_0x7ca1('0x7')](),controller[_0x7ca1('0x8')]);router[_0x7ca1('0x4')](_0x7ca1('0x9'),auth[_0x7ca1('0x6')](),auth[_0x7ca1('0x7')](),controller[_0x7ca1('0xa')]);router[_0x7ca1('0x4')](_0x7ca1('0xb'),auth[_0x7ca1('0x6')](),auth[_0x7ca1('0x7')](),controller['pull']);router['get']('/restart',auth[_0x7ca1('0x6')](),controller[_0x7ca1('0xc')]);router[_0x7ca1('0x4')](_0x7ca1('0xd'),controller['migrations']);module[_0x7ca1('0xe')]=router; \ No newline at end of file +var _0xdf52=['Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','/restart','/migrations','migrations','exports','express'];(function(_0x143150,_0x55c918){var _0x3a3d7e=function(_0x50e80a){while(--_0x50e80a){_0x143150['push'](_0x143150['shift']());}};_0x3a3d7e(++_0x55c918);}(_0xdf52,0xfb));var _0x2df5=function(_0x416788,_0x508230){_0x416788=_0x416788-0x0;var _0x2148af=_0xdf52[_0x416788];return _0x2148af;};'use strict';var express=require(_0x2df5('0x0'));var router=express[_0x2df5('0x1')]();var auth=require(_0x2df5('0x2'));var controller=require(_0x2df5('0x3'));router[_0x2df5('0x4')]('/',controller[_0x2df5('0x5')]);router[_0x2df5('0x4')](_0x2df5('0x6'),auth[_0x2df5('0x7')](),auth[_0x2df5('0x8')](),controller[_0x2df5('0x9')]);router[_0x2df5('0x4')](_0x2df5('0xa'),auth[_0x2df5('0x7')](),auth[_0x2df5('0x8')](),controller[_0x2df5('0xb')]);router[_0x2df5('0x4')](_0x2df5('0xc'),auth['isAuthenticated'](),auth[_0x2df5('0x8')](),controller[_0x2df5('0xd')]);router[_0x2df5('0x4')](_0x2df5('0xe'),auth[_0x2df5('0x7')](),controller['restart']);router[_0x2df5('0x4')](_0x2df5('0xf'),controller[_0x2df5('0x10')]);module[_0x2df5('0x11')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 7de6250..ee60f1e 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 _0x4d22=['catch','migrations','readdirSync','join','root','server','length','replace','.js','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.','map','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','child_process','exec','../../config/pm2','../../config/logger','update','simple-git','exports','query','tags','latest','2.0.0','status','json','fetch','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','pm2\x20restart\x20motion\x20%s'];(function(_0x539533,_0x59b89b){var _0x3942f3=function(_0x3b386c){while(--_0x3b386c){_0x539533['push'](_0x539533['shift']());}};_0x3942f3(++_0x59b89b);}(_0x4d22,0xbb));var _0x24d2=function(_0x19609b,_0x164cb2){_0x19609b=_0x19609b-0x0;var _0xb6e95e=_0x4d22[_0x19609b];return _0xb6e95e;};'use strict';var Umzug=require(_0x24d2('0x0'));var path=require(_0x24d2('0x1'));var fs=require('fs');var _=require(_0x24d2('0x2'));var pkginfo=require(_0x24d2('0x3'))(module,_0x24d2('0x4'));var compareVersions=require('compare-versions');var exec=require(_0x24d2('0x5'))[_0x24d2('0x6')];var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var pm2=require(_0x24d2('0x7'));var logger=require(_0x24d2('0x8'))(_0x24d2('0x9'));var git=require(_0x24d2('0xa'))(config['root']);exports['index']=function(_0x13956e,_0xa9f9da){var _0x4f69e4={'current':module[_0x24d2('0xb')][_0x24d2('0x4')],'phonebar':0x2};if(_0x13956e[_0x24d2('0xc')]&&_0x13956e[_0x24d2('0xc')]['latest']){return git['fetch']()[_0x24d2('0xd')](function(_0x37c187,_0x1d04c4){_0x4f69e4[_0x24d2('0xe')]=(_0x37c187?module[_0x24d2('0xb')][_0x24d2('0x4')]:_0x1d04c4[_0x24d2('0xe')])||_0x24d2('0xf');return _0xa9f9da[_0x24d2('0x10')](0xc8)[_0x24d2('0x11')](_0x4f69e4);});}else{return _0xa9f9da[_0x24d2('0x10')](0xc8)['json'](_0x4f69e4);}};exports[_0x24d2('0x12')]=function(_0x24d7d0,_0x2fb692){return git[_0x24d2('0x12')]([_0x24d2('0x13'),_0x24d2('0x14')],function(_0x3c74a4){if(_0x3c74a4){logger[_0x24d2('0x15')](_0x3c74a4);return _0x2fb692[_0x24d2('0x10')](0x1f4)[_0x24d2('0x11')](_0x3c74a4);}logger[_0x24d2('0x16')](_0x24d2('0x17'));return _0x2fb692['status'](0xc8)['json']({'output':_0x24d2('0x18')});});};exports[_0x24d2('0x19')]=function(_0x34e1ac,_0x1d3813){return git[_0x24d2('0x19')](['--hard',_0x24d2('0x1a')],function(_0x1ecc56){if(_0x1ecc56){logger['error'](_0x1ecc56);return _0x1d3813[_0x24d2('0x10')](0x1f4)['json'](_0x1ecc56);}logger[_0x24d2('0x16')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x1d3813['status'](0xc8)[_0x24d2('0x11')]({'output':_0x24d2('0x1b')});});};exports[_0x24d2('0x1c')]=function(_0x33aa55,_0x4c83ea){exec(_0x24d2('0x1d'),function(_0x53a8a2,_0x1d4bc7,_0xba910e){logger[_0x24d2('0x16')](_0x1d4bc7);logger[_0x24d2('0x16')](_0xba910e);if(_0x53a8a2){logger[_0x24d2('0x15')](_0x53a8a2);return _0x4c83ea['status'](0x1f4)[_0x24d2('0x11')](_0x53a8a2);}return _0x4c83ea['status'](0xc8)[_0x24d2('0x11')]({'output':_0x1d4bc7});});};exports['restart']=function(_0x386aa4,_0x55dd0a){return pm2[_0x24d2('0x1e')](_0x24d2('0x1f'))['then'](function(_0x1fd4c2){logger[_0x24d2('0x16')](_0x24d2('0x20'),_0x1fd4c2);return _0x55dd0a[_0x24d2('0x10')](0xc8)[_0x24d2('0x11')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x24d2('0x21')](function(_0x1f3a51){logger[_0x24d2('0x15')](_0x1f3a51);return _0x55dd0a[_0x24d2('0x10')](0x1f4)['json'](_0x1f3a51);});};exports[_0x24d2('0x22')]=function(_0x5bd76d,_0x52472f){var _0x530dd4=fs[_0x24d2('0x23')](path[_0x24d2('0x24')](config[_0x24d2('0x25')],_0x24d2('0x26'),_0x24d2('0x22')));var _0x40abd0=[];for(var _0x59af20=0x0;_0x59af20<_0x530dd4[_0x24d2('0x27')];_0x59af20++){var _0xeef262=_0x530dd4[_0x59af20][_0x24d2('0x28')](_0x24d2('0x29'),'');if(compareVersions(module[_0x24d2('0xb')][_0x24d2('0x4')],_0xeef262)===-0x1){_0x40abd0['push'](_0xeef262);}}if(_0x40abd0[_0x24d2('0x27')]){var _0x650ea8=_0x40abd0[_0x24d2('0x2a')](compareVersions);var _0x106484=new Umzug({'storage':_0x24d2('0x2b'),'storageOptions':{'model':db[_0x24d2('0x2c')],'modelName':_0x24d2('0x2c'),'columnName':'version'},'migrations':{'params':[db['sequelize'][_0x24d2('0x2d')](),db['sequelize'][_0x24d2('0x2e')],function(){throw new Error(_0x24d2('0x2f'));}],'path':path[_0x24d2('0x24')](config[_0x24d2('0x25')],_0x24d2('0x26'),_0x24d2('0x22')),'pattern':/\.js$/}});_0x106484['up']({'migrations':_[_0x24d2('0x30')](_0x650ea8,function(_0x44eeff){return _0x44eeff+'.js';})})[_0x24d2('0x31')](function(){return _0x52472f[_0x24d2('0x10')](0xc8)['json']({'output':_0x24d2('0x32')+module[_0x24d2('0xb')][_0x24d2('0x4')]+_0x24d2('0x33')+_[_0x24d2('0x34')](_0x650ea8),'migrations':_['join'](_0x650ea8)});})[_0x24d2('0x21')](function(_0x144db0){if(_0x144db0 instanceof db[_0x24d2('0x2b')][_0x24d2('0x35')]){return _0x52472f[_0x24d2('0x10')](0xc8)['json']({'output':_0x24d2('0x36')});}else{return _0x52472f[_0x24d2('0x10')](0x1f4)['json'](_0x144db0);}});}else{return _0x52472f[_0x24d2('0x10')](0xc8)[_0x24d2('0x11')]({'output':_0x24d2('0x36')});}}; \ No newline at end of file +var _0xd839=['tags','2.0.0','status','origin','master','error','json','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','info','restart','motion2','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','join','root','server','replace','.js','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.','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','path','lodash','version','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','exports','query','latest','fetch'];(function(_0x286757,_0x1f0209){var _0x2eb41c=function(_0x1e3a7d){while(--_0x1e3a7d){_0x286757['push'](_0x286757['shift']());}};_0x2eb41c(++_0x1f0209);}(_0xd839,0x1c5));var _0x9d83=function(_0x499263,_0x10426a){_0x499263=_0x499263-0x0;var _0x53fdc3=_0xd839[_0x499263];return _0x53fdc3;};'use strict';var Umzug=require('umzug');var path=require(_0x9d83('0x0'));var fs=require('fs');var _=require(_0x9d83('0x1'));var pkginfo=require('pkginfo')(module,_0x9d83('0x2'));var compareVersions=require('compare-versions');var exec=require(_0x9d83('0x3'))[_0x9d83('0x4')];var db=require(_0x9d83('0x5'))['db'];var config=require(_0x9d83('0x6'));var pm2=require(_0x9d83('0x7'));var logger=require(_0x9d83('0x8'))(_0x9d83('0x9'));var git=require(_0x9d83('0xa'))(config['root']);exports['index']=function(_0x142291,_0x3e414b){var _0x30be3f={'current':module[_0x9d83('0xb')]['version'],'phonebar':0x2};if(_0x142291[_0x9d83('0xc')]&&_0x142291[_0x9d83('0xc')][_0x9d83('0xd')]){return git[_0x9d83('0xe')]()[_0x9d83('0xf')](function(_0x3b8289,_0x279534){_0x30be3f[_0x9d83('0xd')]=(_0x3b8289?module[_0x9d83('0xb')][_0x9d83('0x2')]:_0x279534[_0x9d83('0xd')])||_0x9d83('0x10');return _0x3e414b['status'](0xc8)['json'](_0x30be3f);});}else{return _0x3e414b[_0x9d83('0x11')](0xc8)['json'](_0x30be3f);}};exports['fetch']=function(_0x10a824,_0x525538){return git[_0x9d83('0xe')]([_0x9d83('0x12'),_0x9d83('0x13')],function(_0x1d09f2){if(_0x1d09f2){logger[_0x9d83('0x14')](_0x1d09f2);return _0x525538[_0x9d83('0x11')](0x1f4)[_0x9d83('0x15')](_0x1d09f2);}logger['info']('git\x20fetch');return _0x525538['status'](0xc8)[_0x9d83('0x15')]({'output':_0x9d83('0x16')});});};exports[_0x9d83('0x17')]=function(_0x5bf822,_0xe58ada){return git[_0x9d83('0x17')]([_0x9d83('0x18'),_0x9d83('0x19')],function(_0x18896d){if(_0x18896d){logger[_0x9d83('0x14')](_0x18896d);return _0xe58ada[_0x9d83('0x11')](0x1f4)[_0x9d83('0x15')](_0x18896d);}logger['info'](_0x9d83('0x1a'));return _0xe58ada['status'](0xc8)['json']({'output':_0x9d83('0x1b')});});};exports[_0x9d83('0x1c')]=function(_0x24794f,_0xe5e4ca){exec(_0x9d83('0x1d'),function(_0x52288e,_0x5507cf,_0x4abfea){logger[_0x9d83('0x1e')](_0x5507cf);logger['info'](_0x4abfea);if(_0x52288e){logger['error'](_0x52288e);return _0xe5e4ca['status'](0x1f4)[_0x9d83('0x15')](_0x52288e);}return _0xe5e4ca[_0x9d83('0x11')](0xc8)['json']({'output':_0x5507cf});});};exports[_0x9d83('0x1f')]=function(_0x4a975e,_0x1fb90f){return pm2[_0x9d83('0x1f')](_0x9d83('0x20'))['then'](function(_0xd8354e){logger[_0x9d83('0x1e')]('pm2\x20restart\x20motion\x20%s',_0xd8354e);return _0x1fb90f[_0x9d83('0x11')](0xc8)[_0x9d83('0x15')]({'output':_0x9d83('0x21')});})[_0x9d83('0x22')](function(_0x1775b4){logger['error'](_0x1775b4);return _0x1fb90f['status'](0x1f4)[_0x9d83('0x15')](_0x1775b4);});};exports[_0x9d83('0x23')]=function(_0x5469bc,_0x47f943){var _0x1bc2ce=fs['readdirSync'](path[_0x9d83('0x24')](config[_0x9d83('0x25')],_0x9d83('0x26'),_0x9d83('0x23')));var _0xfafdad=[];for(var _0xf637a3=0x0;_0xf637a3<_0x1bc2ce['length'];_0xf637a3++){var _0x3d8975=_0x1bc2ce[_0xf637a3][_0x9d83('0x27')](_0x9d83('0x28'),'');if(compareVersions(module['exports'][_0x9d83('0x2')],_0x3d8975)===-0x1){_0xfafdad[_0x9d83('0x29')](_0x3d8975);}}if(_0xfafdad['length']){var _0x444788=_0xfafdad[_0x9d83('0x2a')](compareVersions);var _0xbb43e8=new Umzug({'storage':_0x9d83('0x2b'),'storageOptions':{'model':db['Migration'],'modelName':_0x9d83('0x2c'),'columnName':_0x9d83('0x2')},'migrations':{'params':[db[_0x9d83('0x2b')][_0x9d83('0x2d')](),db[_0x9d83('0x2b')]['constructor'],function(){throw new Error(_0x9d83('0x2e'));}],'path':path[_0x9d83('0x24')](config['root'],_0x9d83('0x26'),_0x9d83('0x23')),'pattern':/\.js$/}});_0xbb43e8['up']({'migrations':_['map'](_0x444788,function(_0x5bcaf6){return _0x5bcaf6+_0x9d83('0x28');})})[_0x9d83('0x2f')](function(){return _0x47f943[_0x9d83('0x11')](0xc8)[_0x9d83('0x15')]({'output':_0x9d83('0x30')+module[_0x9d83('0xb')][_0x9d83('0x2')]+_0x9d83('0x31')+_['last'](_0x444788),'migrations':_[_0x9d83('0x24')](_0x444788)});})[_0x9d83('0x22')](function(_0x4fcadc){if(_0x4fcadc instanceof db[_0x9d83('0x2b')][_0x9d83('0x32')]){return _0x47f943['status'](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}else{return _0x47f943[_0x9d83('0x11')](0x1f4)[_0x9d83('0x15')](_0x4fcadc);}});}else{return _0x47f943[_0x9d83('0x11')](0xc8)['json']({'output':_0x9d83('0x33')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 2c370e5..138be00 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 _0x8de0=['exports','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8de0,0x1e7));var _0x08de=function(_0x374dbf,_0x3f6f88){_0x374dbf=_0x374dbf-0x0;var _0x29c8a6=_0x8de0[_0x374dbf];return _0x29c8a6;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x08de('0x0'));var express=require('express');var router=express[_0x08de('0x1')]();var fs_extra=require(_0x08de('0x2'));var auth=require(_0x08de('0x3'));var interaction=require(_0x08de('0x4'));var config=require(_0x08de('0x5'));var controller=require(_0x08de('0x6'));router[_0x08de('0x7')]('/',auth[_0x08de('0x8')](),controller[_0x08de('0x9')]);router[_0x08de('0x7')]('/describe',auth[_0x08de('0x8')](),controller[_0x08de('0xa')]);router[_0x08de('0x7')](_0x08de('0xb'),auth[_0x08de('0x8')](),controller[_0x08de('0xc')]);router[_0x08de('0xd')]('/',auth[_0x08de('0x8')](),controller[_0x08de('0xe')]);router['put'](_0x08de('0xb'),auth[_0x08de('0x8')](),controller['update']);router[_0x08de('0xf')](_0x08de('0xb'),auth['isAuthenticated'](),controller[_0x08de('0x10')]);module[_0x08de('0x11')]=router; \ No newline at end of file +var _0xe76f=['isAuthenticated','/describe','describe','/:id','create','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','get'];(function(_0x574b2a,_0x4aac51){var _0x5a34c5=function(_0x1c6315){while(--_0x1c6315){_0x574b2a['push'](_0x574b2a['shift']());}};_0x5a34c5(++_0x4aac51);}(_0xe76f,0x1ab));var _0xfe76=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xe76f[_0x45d3f0];return _0x314b79;};'use strict';var multer=require(_0xfe76('0x0'));var util=require(_0xfe76('0x1'));var path=require(_0xfe76('0x2'));var timeout=require('connect-timeout');var express=require(_0xfe76('0x3'));var router=express[_0xfe76('0x4')]();var fs_extra=require(_0xfe76('0x5'));var auth=require(_0xfe76('0x6'));var interaction=require(_0xfe76('0x7'));var config=require('../../config/environment');var controller=require(_0xfe76('0x8'));router[_0xfe76('0x9')]('/',auth[_0xfe76('0xa')](),controller['index']);router[_0xfe76('0x9')](_0xfe76('0xb'),auth['isAuthenticated'](),controller[_0xfe76('0xc')]);router['get'](_0xfe76('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xfe76('0xa')](),controller[_0xfe76('0xe')]);router[_0xfe76('0xf')](_0xfe76('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xfe76('0x10')]('/:id',auth[_0xfe76('0xa')](),controller[_0xfe76('0x11')]);module[_0xfe76('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 21fd8cc..cbc3775 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 _0xabad=['BOOLEAN','sequelize','STRING','DATE','INTEGER'];(function(_0x3807fe,_0xf97eb0){var _0x2fd55b=function(_0xe8b01e){while(--_0xe8b01e){_0x3807fe['push'](_0x3807fe['shift']());}};_0x2fd55b(++_0xf97eb0);}(_0xabad,0x150));var _0xdaba=function(_0x256d6a,_0x2f002f){_0x256d6a=_0x256d6a-0x0;var _0x460058=_0xabad[_0x256d6a];return _0x460058;};'use strict';var Sequelize=require(_0xdaba('0x0'));module['exports']={'type':{'type':Sequelize[_0xdaba('0x1')]},'uniqueid':{'type':Sequelize[_0xdaba('0x1')]},'calleridnum':{'type':Sequelize[_0xdaba('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xdaba('0x1')]},'interface':{'type':Sequelize[_0xdaba('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xdaba('0x2')]},'agentconnectAt':{'type':Sequelize[_0xdaba('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xdaba('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xdaba('0x2')]},'agentdumpAt':{'type':Sequelize[_0xdaba('0x2')]},'holdtime':{'type':Sequelize[_0xdaba('0x3')]},'agentcomplete':{'type':Sequelize[_0xdaba('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xdaba('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xdaba('0x3')]},'agentacw':{'type':Sequelize[_0xdaba('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xdaba('0x3')]},'reason':{'type':Sequelize[_0xdaba('0x1')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xdaba('0x1')]},'channelstate':{'type':Sequelize[_0xdaba('0x3')]},'channelstatedesc':{'type':Sequelize[_0xdaba('0x1')]},'connectedlinenum':{'type':Sequelize[_0xdaba('0x1')]},'connectedlinename':{'type':Sequelize[_0xdaba('0x1')]},'language':{'type':Sequelize[_0xdaba('0x1')]},'accountcode':{'type':Sequelize[_0xdaba('0x1')]},'context':{'type':Sequelize[_0xdaba('0x1')]},'exten':{'type':Sequelize[_0xdaba('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xdaba('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xdaba('0x1')]},'destcalleridnum':{'type':Sequelize[_0xdaba('0x1')]},'destcalleridname':{'type':Sequelize[_0xdaba('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xdaba('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xdaba('0x1')]},'destlanguage':{'type':Sequelize[_0xdaba('0x1')]},'destaccountcode':{'type':Sequelize[_0xdaba('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xdaba('0x1')]},'destpriority':{'type':Sequelize[_0xdaba('0x1')]},'destuniqueid':{'type':Sequelize[_0xdaba('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xdaba('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xdaba('0x1')]},'transfer':{'type':Sequelize[_0xdaba('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xdaba('0x1')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xdaba('0x1')]},'transferuniqueid':{'type':Sequelize[_0xdaba('0x1')]},'agententerreason':{'type':Sequelize[_0xdaba('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb574=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb574,0x106));var _0x4b57=function(_0x1d7e62,_0x3ff08b){_0x1d7e62=_0x1d7e62-0x0;var _0x18fb8e=_0xb574[_0x1d7e62];return _0x18fb8e;};'use strict';var Sequelize=require(_0x4b57('0x0'));module[_0x4b57('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4b57('0x2')]},'calleridnum':{'type':Sequelize[_0x4b57('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x4b57('0x2')]},'interface':{'type':Sequelize[_0x4b57('0x2')]},'membername':{'type':Sequelize[_0x4b57('0x2')]},'agentcalledAt':{'type':Sequelize[_0x4b57('0x3')]},'agentconnectAt':{'type':Sequelize[_0x4b57('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x4b57('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x4b57('0x4')]},'agentacw':{'type':Sequelize[_0x4b57('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x4b57('0x4')]},'reason':{'type':Sequelize[_0x4b57('0x2')]},'lastevent':{'type':Sequelize[_0x4b57('0x2')]},'channel':{'type':Sequelize[_0x4b57('0x2')]},'channelstate':{'type':Sequelize[_0x4b57('0x4')]},'channelstatedesc':{'type':Sequelize[_0x4b57('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x4b57('0x2')]},'language':{'type':Sequelize[_0x4b57('0x2')]},'accountcode':{'type':Sequelize[_0x4b57('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x4b57('0x2')]},'destchannel':{'type':Sequelize[_0x4b57('0x2')]},'destchannelstate':{'type':Sequelize[_0x4b57('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x4b57('0x2')]},'destcalleridnum':{'type':Sequelize[_0x4b57('0x2')]},'destcalleridname':{'type':Sequelize[_0x4b57('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x4b57('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x4b57('0x2')]},'destlanguage':{'type':Sequelize[_0x4b57('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x4b57('0x2')]},'destpriority':{'type':Sequelize[_0x4b57('0x2')]},'destuniqueid':{'type':Sequelize[_0x4b57('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x4b57('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4b57('0x2')],'comment':_0x4b57('0x6')},'transferexten':{'type':Sequelize[_0x4b57('0x2')]},'transferuniqueid':{'type':Sequelize[_0x4b57('0x2')]},'agententerreason':{'type':Sequelize[_0x4b57('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 fcabe7c..7887ab6 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.controller.js +++ b/server/api/voiceAgentReport/voiceAgentReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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 a982e34..2383512 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 _0x37cc=['api','moment','bluebird','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','destuniqueid','lodash','util','../../config/logger'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x37cc,0x185));var _0xc37c=function(_0x2be004,_0x7393c3){_0x2be004=_0x2be004-0x0;var _0x1722ea=_0x37cc[_0x2be004];return _0x1722ea;};'use strict';var _=require(_0xc37c('0x0'));var util=require(_0xc37c('0x1'));var logger=require(_0xc37c('0x2'))(_0xc37c('0x3'));var moment=require(_0xc37c('0x4'));var BPromise=require(_0xc37c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc37c('0x6'));var config=require(_0xc37c('0x7'));var attributes=require(_0xc37c('0x8'));module[_0xc37c('0x9')]=function(_0x4c9dcd,_0x582100){return _0x4c9dcd[_0xc37c('0xa')](_0xc37c('0xb'),attributes,{'tableName':_0xc37c('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0xc37c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x83d3=['report_agent','destuniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','VoiceAgentReport'];(function(_0x5b3ea6,_0x28e1ac){var _0x29a08a=function(_0x5923e8){while(--_0x5923e8){_0x5b3ea6['push'](_0x5b3ea6['shift']());}};_0x29a08a(++_0x28e1ac);}(_0x83d3,0x17c));var _0x383d=function(_0x56ccd2,_0x1fbef1){_0x56ccd2=_0x56ccd2-0x0;var _0x341819=_0x83d3[_0x56ccd2];return _0x341819;};'use strict';var _=require(_0x383d('0x0'));var util=require(_0x383d('0x1'));var logger=require(_0x383d('0x2'))(_0x383d('0x3'));var moment=require(_0x383d('0x4'));var BPromise=require('bluebird');var rp=require(_0x383d('0x5'));var fs=require('fs');var path=require(_0x383d('0x6'));var rimraf=require(_0x383d('0x7'));var config=require(_0x383d('0x8'));var attributes=require('./voiceAgentReport.attributes');module[_0x383d('0x9')]=function(_0x4f3c10,_0x50eaff){return _0x4f3c10[_0x383d('0xa')](_0x383d('0xb'),attributes,{'tableName':_0x383d('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x383d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index d272966..b16e813 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 _0x29db=['options','raw','then','CreateVoiceAgentReport','UpdateVoiceAgentReport','VoiceAgentReport','update','where','attributes','limit','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','create','body'];(function(_0x325ef0,_0x44d7db){var _0x5cc638=function(_0x3add28){while(--_0x3add28){_0x325ef0['push'](_0x325ef0['shift']());}};_0x5cc638(++_0x44d7db);}(_0x29db,0x196));var _0xb29d=function(_0x1a135e,_0x312135){_0x1a135e=_0x1a135e-0x0;var _0x4d2ef5=_0x29db[_0x1a135e];return _0x4d2ef5;};'use strict';var _=require(_0xb29d('0x0'));var util=require('util');var moment=require(_0xb29d('0x1'));var BPromise=require('bluebird');var rs=require(_0xb29d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb29d('0x3'))['db'];var utils=require(_0xb29d('0x4'));var logger=require(_0xb29d('0x5'))(_0xb29d('0x6'));var config=require('../../config/environment');var jayson=require(_0xb29d('0x7'));var client=jayson[_0xb29d('0x8')][_0xb29d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14784d,_0x480c97,_0xfa270d){return new BPromise(function(_0x30b151,_0x52ddb8){return client[_0xb29d('0xa')](_0x14784d,_0xfa270d)['then'](function(_0x10793e){logger[_0xb29d('0xb')](_0xb29d('0xc'),_0x480c97,_0xb29d('0xd'));logger[_0xb29d('0xe')](_0xb29d('0xf'),_0x480c97,_0xb29d('0xd'),JSON[_0xb29d('0x10')](_0x10793e));if(_0x10793e[_0xb29d('0x11')]){if(_0x10793e[_0xb29d('0x11')][_0xb29d('0x12')]===0x1f4){logger[_0xb29d('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x480c97,_0x10793e[_0xb29d('0x11')]['message']);return _0x52ddb8(_0x10793e[_0xb29d('0x11')][_0xb29d('0x13')]);}logger[_0xb29d('0x11')](_0xb29d('0xc'),_0x480c97,_0x10793e['error'][_0xb29d('0x13')]);return _0x30b151(_0x10793e[_0xb29d('0x11')][_0xb29d('0x13')]);}else{logger[_0xb29d('0xb')]('VoiceAgentReport,\x20%s,\x20%s',_0x480c97,_0xb29d('0xd'));_0x30b151(_0x10793e['result'][_0xb29d('0x13')]);}})[_0xb29d('0x14')](function(_0x12684c){logger[_0xb29d('0x11')](_0xb29d('0xc'),_0x480c97,_0x12684c);_0x52ddb8(_0x12684c);});});}exports['CreateVoiceAgentReport']=function(_0x5398a2){var _0x1cf27b=this;return new Promise(function(_0x3e8169,_0x559351){return db['VoiceAgentReport'][_0xb29d('0x15')](_0x5398a2[_0xb29d('0x16')],{'raw':_0x5398a2[_0xb29d('0x17')]?_0x5398a2[_0xb29d('0x17')][_0xb29d('0x18')]===undefined?!![]:![]:!![]})[_0xb29d('0x19')](function(_0xd93325){logger[_0xb29d('0xb')]('CreateVoiceAgentReport',_0x5398a2);logger['debug']('CreateVoiceAgentReport',_0x5398a2,JSON[_0xb29d('0x10')](_0xd93325));_0x3e8169(_0xd93325);})[_0xb29d('0x14')](function(_0x5dce78){logger[_0xb29d('0x11')](_0xb29d('0x1a'),_0x5dce78[_0xb29d('0x13')],_0x5398a2);_0x559351(_0x1cf27b[_0xb29d('0x11')](0x1f4,_0x5dce78[_0xb29d('0x13')]));});});};exports[_0xb29d('0x1b')]=function(_0x58bdfa){var _0x2f5061=this;return new Promise(function(_0x199608,_0x1e4bab){return db[_0xb29d('0x1c')][_0xb29d('0x1d')](_0x58bdfa[_0xb29d('0x16')],{'raw':_0x58bdfa['options']?_0x58bdfa[_0xb29d('0x17')][_0xb29d('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58bdfa['options']?_0x58bdfa[_0xb29d('0x17')][_0xb29d('0x1e')]||null:null,'attributes':_0x58bdfa[_0xb29d('0x17')]?_0x58bdfa[_0xb29d('0x17')][_0xb29d('0x1f')]||null:null,'limit':_0x58bdfa[_0xb29d('0x17')]?_0x58bdfa[_0xb29d('0x17')][_0xb29d('0x20')]||null:null})['then'](function(_0x2825c6){logger['info'](_0xb29d('0x1b'),_0x58bdfa);logger[_0xb29d('0xe')](_0xb29d('0x1b'),_0x58bdfa,JSON[_0xb29d('0x10')](_0x2825c6));_0x199608(_0x2825c6);})[_0xb29d('0x14')](function(_0x301e9d){logger[_0xb29d('0x11')](_0xb29d('0x1b'),_0x301e9d['message'],_0x58bdfa);_0x1e4bab(_0x2f5061[_0xb29d('0x11')](0x1f4,_0x301e9d[_0xb29d('0x13')]));});});}; \ No newline at end of file +var _0x182e=['where','attributes','limit','UpdateVoiceAgentReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','create','body','options','raw','CreateVoiceAgentReport','stringify','VoiceAgentReport','update'];(function(_0x2b6b2d,_0x2377b1){var _0x132cc4=function(_0x5f5db3){while(--_0x5f5db3){_0x2b6b2d['push'](_0x2b6b2d['shift']());}};_0x132cc4(++_0x2377b1);}(_0x182e,0xae));var _0xe182=function(_0xf26c2e,_0x56c3ea){_0xf26c2e=_0xf26c2e-0x0;var _0x46ecb4=_0x182e[_0xf26c2e];return _0x46ecb4;};'use strict';var _=require(_0xe182('0x0'));var util=require(_0xe182('0x1'));var moment=require(_0xe182('0x2'));var BPromise=require(_0xe182('0x3'));var rs=require(_0xe182('0x4'));var fs=require('fs');var Redis=require(_0xe182('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe182('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe182('0x7'));var client=jayson[_0xe182('0x8')][_0xe182('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x529494,_0x51126b,_0x557824){return new BPromise(function(_0x14a03f,_0x5aff4a){return client[_0xe182('0xa')](_0x529494,_0x557824)[_0xe182('0xb')](function(_0x4b7de9){logger[_0xe182('0xc')](_0xe182('0xd'),_0x51126b,_0xe182('0xe'));logger[_0xe182('0xf')](_0xe182('0x10'),_0x51126b,_0xe182('0xe'),JSON['stringify'](_0x4b7de9));if(_0x4b7de9['error']){if(_0x4b7de9[_0xe182('0x11')][_0xe182('0x12')]===0x1f4){logger[_0xe182('0x11')](_0xe182('0xd'),_0x51126b,_0x4b7de9['error'][_0xe182('0x13')]);return _0x5aff4a(_0x4b7de9[_0xe182('0x11')][_0xe182('0x13')]);}logger[_0xe182('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x51126b,_0x4b7de9[_0xe182('0x11')][_0xe182('0x13')]);return _0x14a03f(_0x4b7de9[_0xe182('0x11')][_0xe182('0x13')]);}else{logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x51126b,'request\x20sent');_0x14a03f(_0x4b7de9[_0xe182('0x14')]['message']);}})[_0xe182('0x15')](function(_0x140ee1){logger['error'](_0xe182('0xd'),_0x51126b,_0x140ee1);_0x5aff4a(_0x140ee1);});});}exports['CreateVoiceAgentReport']=function(_0x473b3c){var _0x5f508f=this;return new Promise(function(_0xf17703,_0x3af580){return db['VoiceAgentReport'][_0xe182('0x16')](_0x473b3c[_0xe182('0x17')],{'raw':_0x473b3c[_0xe182('0x18')]?_0x473b3c[_0xe182('0x18')][_0xe182('0x19')]===undefined?!![]:![]:!![]})[_0xe182('0xb')](function(_0x131a13){logger[_0xe182('0xc')]('CreateVoiceAgentReport',_0x473b3c);logger[_0xe182('0xf')](_0xe182('0x1a'),_0x473b3c,JSON[_0xe182('0x1b')](_0x131a13));_0xf17703(_0x131a13);})[_0xe182('0x15')](function(_0x147b9f){logger[_0xe182('0x11')](_0xe182('0x1a'),_0x147b9f[_0xe182('0x13')],_0x473b3c);_0x3af580(_0x5f508f['error'](0x1f4,_0x147b9f['message']));});});};exports['UpdateVoiceAgentReport']=function(_0x39a280){var _0x4e5164=this;return new Promise(function(_0x43fcf1,_0x43d8c3){return db[_0xe182('0x1c')][_0xe182('0x1d')](_0x39a280[_0xe182('0x17')],{'raw':_0x39a280['options']?_0x39a280[_0xe182('0x18')][_0xe182('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39a280[_0xe182('0x18')]?_0x39a280[_0xe182('0x18')][_0xe182('0x1e')]||null:null,'attributes':_0x39a280[_0xe182('0x18')]?_0x39a280[_0xe182('0x18')][_0xe182('0x1f')]||null:null,'limit':_0x39a280[_0xe182('0x18')]?_0x39a280[_0xe182('0x18')][_0xe182('0x20')]||null:null})[_0xe182('0xb')](function(_0x36e182){logger['info']('UpdateVoiceAgentReport',_0x39a280);logger['debug'](_0xe182('0x21'),_0x39a280,JSON[_0xe182('0x1b')](_0x36e182));_0x43fcf1(_0x36e182);})['catch'](function(_0x542cc2){logger[_0xe182('0x11')]('UpdateVoiceAgentReport',_0x542cc2[_0xe182('0x13')],_0x39a280);_0x43d8c3(_0x4e5164[_0xe182('0x11')](0x1f4,_0x542cc2[_0xe182('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 9ae5aad..9433ce1 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 _0x9a19=['delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/:id','post','create','put','update'];(function(_0x1d58a4,_0x150ed6){var _0x1f05a7=function(_0x35fcf6){while(--_0x35fcf6){_0x1d58a4['push'](_0x1d58a4['shift']());}};_0x1f05a7(++_0x150ed6);}(_0x9a19,0x114));var _0x99a1=function(_0x25701b,_0x2a6976){_0x25701b=_0x25701b-0x0;var _0x3a8a2c=_0x9a19[_0x25701b];return _0x3a8a2c;};'use strict';var multer=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var path=require(_0x99a1('0x2'));var timeout=require('connect-timeout');var express=require(_0x99a1('0x3'));var router=express[_0x99a1('0x4')]();var fs_extra=require(_0x99a1('0x5'));var auth=require(_0x99a1('0x6'));var interaction=require(_0x99a1('0x7'));var config=require(_0x99a1('0x8'));var controller=require(_0x99a1('0x9'));router[_0x99a1('0xa')]('/',auth[_0x99a1('0xb')](),controller[_0x99a1('0xc')]);router[_0x99a1('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x99a1('0xa')](_0x99a1('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x99a1('0xe')]('/',auth[_0x99a1('0xb')](),controller[_0x99a1('0xf')]);router[_0x99a1('0x10')](_0x99a1('0xd'),auth['isAuthenticated'](),controller[_0x99a1('0x11')]);router[_0x99a1('0x12')](_0x99a1('0xd'),auth[_0x99a1('0xb')](),controller[_0x99a1('0x13')]);module[_0x99a1('0x14')]=router; \ No newline at end of file +var _0x2bd8=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','get','isAuthenticated','/describe','describe','/:id','delete','destroy'];(function(_0x5f4948,_0x16cb3b){var _0x16a23c=function(_0x5b63fa){while(--_0x5b63fa){_0x5f4948['push'](_0x5f4948['shift']());}};_0x16a23c(++_0x16cb3b);}(_0x2bd8,0x130));var _0x82bd=function(_0x4dc7a6,_0x44cf8b){_0x4dc7a6=_0x4dc7a6-0x0;var _0x5fbe09=_0x2bd8[_0x4dc7a6];return _0x5fbe09;};'use strict';var multer=require(_0x82bd('0x0'));var util=require('util');var path=require(_0x82bd('0x1'));var timeout=require(_0x82bd('0x2'));var express=require(_0x82bd('0x3'));var router=express[_0x82bd('0x4')]();var fs_extra=require(_0x82bd('0x5'));var auth=require(_0x82bd('0x6'));var interaction=require(_0x82bd('0x7'));var config=require('../../config/environment');var controller=require(_0x82bd('0x8'));router[_0x82bd('0x9')]('/',auth[_0x82bd('0xa')](),controller['index']);router[_0x82bd('0x9')](_0x82bd('0xb'),auth[_0x82bd('0xa')](),controller[_0x82bd('0xc')]);router['get'](_0x82bd('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x82bd('0xa')](),controller['create']);router['put'](_0x82bd('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x82bd('0xe')](_0x82bd('0xd'),auth['isAuthenticated'](),controller[_0x82bd('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 0bad54a..4f98509 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 _0x3e22=['inbound','internal','outbound','dialer','STRING','TEXT','DATE','INTEGER','exports','ENUM'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3e22,0xa8));var _0x23e2=function(_0x1a5486,_0x26eb12){_0x1a5486=_0x1a5486-0x0;var _0x432d61=_0x3e22[_0x1a5486];return _0x432d61;};'use strict';var Sequelize=require('sequelize');module[_0x23e2('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x23e2('0x1')](_0x23e2('0x2'),_0x23e2('0x3'),_0x23e2('0x4'),'inbound-fax','outbound-fax',_0x23e2('0x5'))},'tag':{'type':Sequelize[_0x23e2('0x6')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x23e2('0x6')]},'destination':{'type':Sequelize[_0x23e2('0x6')]},'destinationcontext':{'type':Sequelize[_0x23e2('0x6')]},'callerid':{'type':Sequelize[_0x23e2('0x6')]},'channel':{'type':Sequelize[_0x23e2('0x6')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x23e2('0x6')]},'lastdata':{'type':Sequelize[_0x23e2('0x7')]},'starttime':{'type':Sequelize[_0x23e2('0x8')]},'systemanswertime':{'type':Sequelize[_0x23e2('0x8')]},'answertime':{'type':Sequelize[_0x23e2('0x8')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0x23e2('0x9')]},'billableseconds':{'type':Sequelize[_0x23e2('0x9')]},'mohtime':{'type':Sequelize[_0x23e2('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x23e2('0x6')]},'amaflags':{'type':Sequelize[_0x23e2('0x6')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x23e2('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x23e2('0x6')]},'note':{'type':Sequelize[_0x23e2('0x6')]},'prefix':{'type':Sequelize[_0x23e2('0x6')]},'routeid':{'type':Sequelize[_0x23e2('0x9')]},'sipcallid':{'type':Sequelize[_0x23e2('0x6')]}}; \ No newline at end of file +var _0x64eb=['sequelize','exports','ENUM','internal','outbound','inbound-fax','dialer','STRING','TEXT','DATE','INTEGER'];(function(_0x1b6578,_0x51352e){var _0x3738c3=function(_0x5a3ada){while(--_0x5a3ada){_0x1b6578['push'](_0x1b6578['shift']());}};_0x3738c3(++_0x51352e);}(_0x64eb,0xc6));var _0xb64e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x64eb[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xb64e('0x0'));module[_0xb64e('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb64e('0x2')]('inbound',_0xb64e('0x3'),_0xb64e('0x4'),_0xb64e('0x5'),'outbound-fax',_0xb64e('0x6'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xb64e('0x7')]},'source':{'type':Sequelize[_0xb64e('0x7')]},'destination':{'type':Sequelize[_0xb64e('0x7')]},'destinationcontext':{'type':Sequelize[_0xb64e('0x7')]},'callerid':{'type':Sequelize[_0xb64e('0x7')]},'channel':{'type':Sequelize[_0xb64e('0x7')]},'destinationchannel':{'type':Sequelize[_0xb64e('0x7')]},'lastapplication':{'type':Sequelize[_0xb64e('0x7')]},'lastdata':{'type':Sequelize[_0xb64e('0x8')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xb64e('0x9')]},'endtime':{'type':Sequelize[_0xb64e('0x9')]},'duration':{'type':Sequelize[_0xb64e('0xa')]},'billableseconds':{'type':Sequelize[_0xb64e('0xa')]},'mohtime':{'type':Sequelize[_0xb64e('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xb64e('0x7')]},'amaflags':{'type':Sequelize[_0xb64e('0x7')]},'userfield':{'type':Sequelize[_0xb64e('0x7')]},'userDisposition':{'type':Sequelize[_0xb64e('0x7')]},'userSecondDisposition':{'type':Sequelize[_0xb64e('0x7')]},'userThirdDisposition':{'type':Sequelize[_0xb64e('0x7')]},'note':{'type':Sequelize[_0xb64e('0x7')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0xb64e('0xa')]},'sipcallid':{'type':Sequelize[_0xb64e('0x7')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 1ddab75..a3c7efc 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['pick','filter','merge','options','VoiceCallReport','then','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','keys','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where'];(function(_0x1a0daa,_0x2a4634){var _0x1dbe15=function(_0xa8ab22){while(--_0xa8ab22){_0x1a0daa['push'](_0x1a0daa['shift']());}};_0x1dbe15(++_0x2a4634);}(_0x2ef3,0xba));var _0x32ef=function(_0x54d1b6,_0x5b2b37){_0x54d1b6=_0x54d1b6-0x0;var _0x1546b6=_0x2ef3[_0x54d1b6];return _0x1546b6;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['VoiceCallReport'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'attributes':['id',_0x32ef('0x27'),_0x32ef('0x41'),_0x32ef('0x42')],'model':db[_0x32ef('0x43')],'as':'User'}];}return db['VoiceCallReport'][_0x32ef('0x44')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x2a33dd){_0x3c569d[_0x32ef('0x45')]=_0x2a33dd;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x46')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x47')]=function(_0x5d2f06,_0x4744ba){var _0x4bc5bc={'raw':!![],'where':{'id':_0x5d2f06[_0x32ef('0x48')]['id']}},_0xcb3c08={};_0xcb3c08[_0x32ef('0x2e')]=_[_0x32ef('0x49')](db[_0x32ef('0x3d')][_0x32ef('0x2a')]);_0xcb3c08[_0x32ef('0x2f')]=_[_0x32ef('0x49')](_0x5d2f06[_0x32ef('0x2f')]);_0xcb3c08[_0x32ef('0x30')]=_['intersection'](_0xcb3c08[_0x32ef('0x2e')],_0xcb3c08['query']);_0x4bc5bc[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0xcb3c08[_0x32ef('0x2e')],qs['fields'](_0x5d2f06[_0x32ef('0x2f')][_0x32ef('0x33')]));_0x4bc5bc[_0x32ef('0x31')]=_0x4bc5bc[_0x32ef('0x31')][_0x32ef('0x34')]?_0x4bc5bc[_0x32ef('0x31')]:_0xcb3c08[_0x32ef('0x2e')];if(_0x5d2f06['query']['includeAll']){_0x4bc5bc[_0x32ef('0x40')]=[{'all':!![]}];}_0x4bc5bc=_[_0x32ef('0x3b')]({},_0x4bc5bc,_0x5d2f06[_0x32ef('0x3c')]);return db[_0x32ef('0x3d')][_0x32ef('0x4a')](_0x4bc5bc)[_0x32ef('0x3e')](handleEntityNotFound(_0x4744ba,null))[_0x32ef('0x3e')](respondWithResult(_0x4744ba,null))[_0x32ef('0x46')](handleError(_0x4744ba,null));};exports[_0x32ef('0x4b')]=function(_0x1ebedf,_0x35a294){return db[_0x32ef('0x3d')][_0x32ef('0x4b')](_0x1ebedf['body'],{})[_0x32ef('0x3e')](respondWithResult(_0x35a294,0xc9))[_0x32ef('0x46')](handleError(_0x35a294,null));};exports[_0x32ef('0x4c')]=function(_0xd42609,_0x1cc9f3){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'id':_0xd42609[_0x32ef('0x48')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x1cc9f3,null))[_0x32ef('0x3e')](removeEntity(_0x1cc9f3,null))[_0x32ef('0x46')](handleError(_0x1cc9f3,null));};exports[_0x32ef('0x4d')]=function(_0x272377,_0x326445){return db[_0x32ef('0x3d')][_0x32ef('0x4d')]()[_0x32ef('0x3e')](respondWithResult(_0x326445,null))[_0x32ef('0x46')](handleError(_0x326445,null));};exports['update']=function(_0x515ac9,_0x179c2f){if(_0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')]){delete _0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')];}return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'uniqueid':_0x515ac9[_0x32ef('0x48')]['id'],'UserId':{'$or':[null,_0x515ac9[_0x32ef('0x50')]['id']]}}})[_0x32ef('0x3e')](handleEntityNotFound(_0x179c2f,null))[_0x32ef('0x3e')](saveUpdates(_0x515ac9['body'],null))[_0x32ef('0x3e')](respondWithResult(_0x179c2f,null))[_0x32ef('0x46')](handleError(_0x179c2f,null));}; \ No newline at end of file +var _0x2ef3=['pick','filter','merge','options','VoiceCallReport','then','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','keys','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0x2ef3,0xba));var _0x32ef=function(_0x1120e0,_0x4aa593){_0x1120e0=_0x1120e0-0x0;var _0x57eefa=_0x2ef3[_0x1120e0];return _0x57eefa;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['VoiceCallReport'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'attributes':['id',_0x32ef('0x27'),_0x32ef('0x41'),_0x32ef('0x42')],'model':db[_0x32ef('0x43')],'as':'User'}];}return db['VoiceCallReport'][_0x32ef('0x44')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x2a33dd){_0x3c569d[_0x32ef('0x45')]=_0x2a33dd;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x46')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x47')]=function(_0x5d2f06,_0x4744ba){var _0x4bc5bc={'raw':!![],'where':{'id':_0x5d2f06[_0x32ef('0x48')]['id']}},_0xcb3c08={};_0xcb3c08[_0x32ef('0x2e')]=_[_0x32ef('0x49')](db[_0x32ef('0x3d')][_0x32ef('0x2a')]);_0xcb3c08[_0x32ef('0x2f')]=_[_0x32ef('0x49')](_0x5d2f06[_0x32ef('0x2f')]);_0xcb3c08[_0x32ef('0x30')]=_['intersection'](_0xcb3c08[_0x32ef('0x2e')],_0xcb3c08['query']);_0x4bc5bc[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0xcb3c08[_0x32ef('0x2e')],qs['fields'](_0x5d2f06[_0x32ef('0x2f')][_0x32ef('0x33')]));_0x4bc5bc[_0x32ef('0x31')]=_0x4bc5bc[_0x32ef('0x31')][_0x32ef('0x34')]?_0x4bc5bc[_0x32ef('0x31')]:_0xcb3c08[_0x32ef('0x2e')];if(_0x5d2f06['query']['includeAll']){_0x4bc5bc[_0x32ef('0x40')]=[{'all':!![]}];}_0x4bc5bc=_[_0x32ef('0x3b')]({},_0x4bc5bc,_0x5d2f06[_0x32ef('0x3c')]);return db[_0x32ef('0x3d')][_0x32ef('0x4a')](_0x4bc5bc)[_0x32ef('0x3e')](handleEntityNotFound(_0x4744ba,null))[_0x32ef('0x3e')](respondWithResult(_0x4744ba,null))[_0x32ef('0x46')](handleError(_0x4744ba,null));};exports[_0x32ef('0x4b')]=function(_0x1ebedf,_0x35a294){return db[_0x32ef('0x3d')][_0x32ef('0x4b')](_0x1ebedf['body'],{})[_0x32ef('0x3e')](respondWithResult(_0x35a294,0xc9))[_0x32ef('0x46')](handleError(_0x35a294,null));};exports[_0x32ef('0x4c')]=function(_0xd42609,_0x1cc9f3){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'id':_0xd42609[_0x32ef('0x48')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x1cc9f3,null))[_0x32ef('0x3e')](removeEntity(_0x1cc9f3,null))[_0x32ef('0x46')](handleError(_0x1cc9f3,null));};exports[_0x32ef('0x4d')]=function(_0x272377,_0x326445){return db[_0x32ef('0x3d')][_0x32ef('0x4d')]()[_0x32ef('0x3e')](respondWithResult(_0x326445,null))[_0x32ef('0x46')](handleError(_0x326445,null));};exports['update']=function(_0x515ac9,_0x179c2f){if(_0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')]){delete _0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')];}return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'uniqueid':_0x515ac9[_0x32ef('0x48')]['id'],'UserId':{'$or':[null,_0x515ac9[_0x32ef('0x50')]['id']]}}})[_0x32ef('0x3e')](handleEntityNotFound(_0x179c2f,null))[_0x32ef('0x3e')](saveUpdates(_0x515ac9['body'],null))[_0x32ef('0x3e')](respondWithResult(_0x179c2f,null))[_0x32ef('0x46')](handleError(_0x179c2f,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 43fb63f..21b4ae8 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 _0x58b1=['uniqueid','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport'];(function(_0x327c4a,_0x2cd283){var _0x416035=function(_0x425dcb){while(--_0x425dcb){_0x327c4a['push'](_0x327c4a['shift']());}};_0x416035(++_0x2cd283);}(_0x58b1,0x139));var _0x158b=function(_0x46361e,_0x243aaf){_0x46361e=_0x46361e-0x0;var _0x14e302=_0x58b1[_0x46361e];return _0x14e302;};'use strict';var _=require(_0x158b('0x0'));var util=require('util');var logger=require(_0x158b('0x1'))(_0x158b('0x2'));var moment=require('moment');var BPromise=require(_0x158b('0x3'));var rp=require(_0x158b('0x4'));var fs=require('fs');var path=require(_0x158b('0x5'));var rimraf=require(_0x158b('0x6'));var config=require(_0x158b('0x7'));var attributes=require(_0x158b('0x8'));module[_0x158b('0x9')]=function(_0xa4ef1e,_0x3b7609){return _0xa4ef1e[_0x158b('0xa')](_0x158b('0xb'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x158b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x729c=['api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','lodash','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x729c,0x15a));var _0xc729=function(_0x10042f,_0x5ab64f){_0x10042f=_0x10042f-0x0;var _0xb37c65=_0x729c[_0x10042f];return _0xb37c65;};'use strict';var _=require(_0xc729('0x0'));var util=require('util');var logger=require(_0xc729('0x1'))(_0xc729('0x2'));var moment=require('moment');var BPromise=require(_0xc729('0x3'));var rp=require(_0xc729('0x4'));var fs=require('fs');var path=require(_0xc729('0x5'));var rimraf=require(_0xc729('0x6'));var config=require(_0xc729('0x7'));var attributes=require(_0xc729('0x8'));module[_0xc729('0x9')]=function(_0x53504a,_0x5ba9ed){return _0x53504a[_0xc729('0xa')](_0xc729('0xb'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index ec50d70..01905f7 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 _0xfeb5=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','VoiceCallReport,\x20%s,\x20%s','message','GetVoiceCallReport','VoiceCallReport','options','where','attributes','limit','include','map','model','stringify','catch','create','body','CreateVoiceCallReport','debug','update','raw','UpdateVoiceCallReport','lodash','util'];(function(_0x5d2e4a,_0x5ddd41){var _0x4f247a=function(_0xe8241e){while(--_0xe8241e){_0x5d2e4a['push'](_0x5d2e4a['shift']());}};_0x4f247a(++_0x5ddd41);}(_0xfeb5,0x195));var _0x5feb=function(_0x1f0c9b,_0x234e61){_0x1f0c9b=_0x1f0c9b-0x0;var _0x1283e6=_0xfeb5[_0x1f0c9b];return _0x1283e6;};'use strict';var _=require(_0x5feb('0x0'));var util=require(_0x5feb('0x1'));var moment=require(_0x5feb('0x2'));var BPromise=require(_0x5feb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5feb('0x4'));var db=require(_0x5feb('0x5'))['db'];var utils=require(_0x5feb('0x6'));var logger=require(_0x5feb('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5feb('0x8'));var client=jayson[_0x5feb('0x9')][_0x5feb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19512d,_0x1e3afe,_0x23323c){return new BPromise(function(_0x4806f5,_0x9351a4){return client['request'](_0x19512d,_0x23323c)[_0x5feb('0xb')](function(_0x41059d){logger[_0x5feb('0xc')]('VoiceCallReport,\x20%s,\x20%s',_0x1e3afe,_0x5feb('0xd'));logger['debug'](_0x5feb('0xe'),_0x1e3afe,_0x5feb('0xd'),JSON['stringify'](_0x41059d));if(_0x41059d['error']){if(_0x41059d[_0x5feb('0xf')][_0x5feb('0x10')]===0x1f4){logger['error'](_0x5feb('0x11'),_0x1e3afe,_0x41059d[_0x5feb('0xf')]['message']);return _0x9351a4(_0x41059d['error']['message']);}logger[_0x5feb('0xf')]('VoiceCallReport,\x20%s,\x20%s',_0x1e3afe,_0x41059d[_0x5feb('0xf')]['message']);return _0x4806f5(_0x41059d[_0x5feb('0xf')][_0x5feb('0x12')]);}else{logger['info'](_0x5feb('0x11'),_0x1e3afe,_0x5feb('0xd'));_0x4806f5(_0x41059d['result'][_0x5feb('0x12')]);}})['catch'](function(_0x59a6cb){logger[_0x5feb('0xf')]('VoiceCallReport,\x20%s,\x20%s',_0x1e3afe,_0x59a6cb);_0x9351a4(_0x59a6cb);});});}exports[_0x5feb('0x13')]=function(_0x3c0d4e){var _0x422e2d=this;return new Promise(function(_0x445344,_0x1ba77f){return db[_0x5feb('0x14')]['findAll']({'raw':_0x3c0d4e['options']?_0x3c0d4e[_0x5feb('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x3c0d4e[_0x5feb('0x15')]?_0x3c0d4e[_0x5feb('0x15')][_0x5feb('0x16')]||null:null,'attributes':_0x3c0d4e[_0x5feb('0x15')]?_0x3c0d4e['options'][_0x5feb('0x17')]||null:null,'limit':_0x3c0d4e[_0x5feb('0x15')]?_0x3c0d4e[_0x5feb('0x15')][_0x5feb('0x18')]||null:null,'include':_0x3c0d4e[_0x5feb('0x15')]?_0x3c0d4e['options'][_0x5feb('0x19')]?_[_0x5feb('0x1a')](_0x3c0d4e[_0x5feb('0x15')][_0x5feb('0x19')],function(_0x3f90c0){return{'model':db[_0x3f90c0[_0x5feb('0x1b')]],'as':_0x3f90c0['as'],'attributes':_0x3f90c0[_0x5feb('0x17')],'include':_0x3f90c0['include']?_[_0x5feb('0x1a')](_0x3f90c0[_0x5feb('0x19')],function(_0x22315c){return{'model':db[_0x22315c[_0x5feb('0x1b')]],'as':_0x22315c['as'],'attributes':_0x22315c['attributes'],'include':_0x22315c[_0x5feb('0x19')]?_[_0x5feb('0x1a')](_0x22315c[_0x5feb('0x19')],function(_0x82db6f){return{'model':db[_0x82db6f[_0x5feb('0x1b')]],'as':_0x82db6f['as'],'attributes':_0x82db6f[_0x5feb('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x10c3b7){logger[_0x5feb('0xc')]('GetVoiceCallReport',_0x3c0d4e);logger['debug'](_0x5feb('0x13'),_0x3c0d4e,JSON[_0x5feb('0x1c')](_0x10c3b7));_0x445344(_0x10c3b7);})[_0x5feb('0x1d')](function(_0x3ede94){logger[_0x5feb('0xf')](_0x5feb('0x13'),_0x3ede94[_0x5feb('0x12')],_0x3c0d4e);_0x1ba77f(_0x422e2d[_0x5feb('0xf')](0x1f4,_0x3ede94[_0x5feb('0x12')]));});});};exports['CreateVoiceCallReport']=function(_0x56ed46){var _0x32161b=this;return new Promise(function(_0x1e663d,_0x569464){return db['VoiceCallReport'][_0x5feb('0x1e')](_0x56ed46[_0x5feb('0x1f')],{'raw':_0x56ed46['options']?_0x56ed46[_0x5feb('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x5feb('0xb')](function(_0x1cbe44){logger[_0x5feb('0xc')](_0x5feb('0x20'),_0x56ed46);logger[_0x5feb('0x21')](_0x5feb('0x20'),_0x56ed46,JSON['stringify'](_0x1cbe44));_0x1e663d(_0x1cbe44);})[_0x5feb('0x1d')](function(_0x1389fe){logger['error'](_0x5feb('0x20'),_0x1389fe[_0x5feb('0x12')],_0x56ed46);_0x569464(_0x32161b[_0x5feb('0xf')](0x1f4,_0x1389fe[_0x5feb('0x12')]));});});};exports['UpdateVoiceCallReport']=function(_0x502f8e){var _0x243cf0=this;return new Promise(function(_0x31e783,_0x333f98){return db['VoiceCallReport'][_0x5feb('0x22')](_0x502f8e[_0x5feb('0x1f')],{'raw':_0x502f8e[_0x5feb('0x15')]?_0x502f8e[_0x5feb('0x15')][_0x5feb('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x502f8e['options']?_0x502f8e[_0x5feb('0x15')][_0x5feb('0x16')]||null:null,'attributes':_0x502f8e[_0x5feb('0x15')]?_0x502f8e[_0x5feb('0x15')][_0x5feb('0x17')]||null:null,'limit':_0x502f8e[_0x5feb('0x15')]?_0x502f8e[_0x5feb('0x15')][_0x5feb('0x18')]||null:null})[_0x5feb('0xb')](function(_0x3e73d7){logger[_0x5feb('0xc')](_0x5feb('0x24'),_0x502f8e);logger[_0x5feb('0x21')](_0x5feb('0x24'),_0x502f8e,JSON[_0x5feb('0x1c')](_0x3e73d7));_0x31e783(_0x3e73d7);})['catch'](function(_0x147ae1){logger[_0x5feb('0xf')]('UpdateVoiceCallReport',_0x147ae1[_0x5feb('0x12')],_0x502f8e);_0x333f98(_0x243cf0[_0x5feb('0xf')](0x1f4,_0x147ae1[_0x5feb('0x12')]));});});}; \ No newline at end of file +var _0xefe2=['http','request','then','info','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','include','map','model','attributes','CreateVoiceCallReport','UpdateVoiceCallReport','update','body','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0xefe2,0xea));var _0x2efe=function(_0x4f5d1a,_0x4be7ab){_0x4f5d1a=_0x4f5d1a-0x0;var _0x272240=_0xefe2[_0x4f5d1a];return _0x272240;};'use strict';var _=require('lodash');var util=require(_0x2efe('0x0'));var moment=require(_0x2efe('0x1'));var BPromise=require(_0x2efe('0x2'));var rs=require(_0x2efe('0x3'));var fs=require('fs');var Redis=require(_0x2efe('0x4'));var db=require(_0x2efe('0x5'))['db'];var utils=require(_0x2efe('0x6'));var logger=require(_0x2efe('0x7'))(_0x2efe('0x8'));var config=require(_0x2efe('0x9'));var jayson=require(_0x2efe('0xa'));var client=jayson[_0x2efe('0xb')][_0x2efe('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3d1a9b,_0x17b28a,_0x5ea9a7){return new BPromise(function(_0x466cf8,_0x4961b9){return client[_0x2efe('0xd')](_0x3d1a9b,_0x5ea9a7)[_0x2efe('0xe')](function(_0x509379){logger[_0x2efe('0xf')]('VoiceCallReport,\x20%s,\x20%s',_0x17b28a,_0x2efe('0x10'));logger[_0x2efe('0x11')](_0x2efe('0x12'),_0x17b28a,_0x2efe('0x10'),JSON[_0x2efe('0x13')](_0x509379));if(_0x509379[_0x2efe('0x14')]){if(_0x509379[_0x2efe('0x14')][_0x2efe('0x15')]===0x1f4){logger[_0x2efe('0x14')](_0x2efe('0x16'),_0x17b28a,_0x509379['error'][_0x2efe('0x17')]);return _0x4961b9(_0x509379[_0x2efe('0x14')]['message']);}logger['error'](_0x2efe('0x16'),_0x17b28a,_0x509379[_0x2efe('0x14')]['message']);return _0x466cf8(_0x509379[_0x2efe('0x14')][_0x2efe('0x17')]);}else{logger[_0x2efe('0xf')]('VoiceCallReport,\x20%s,\x20%s',_0x17b28a,'request\x20sent');_0x466cf8(_0x509379[_0x2efe('0x18')][_0x2efe('0x17')]);}})[_0x2efe('0x19')](function(_0x25705a){logger[_0x2efe('0x14')]('VoiceCallReport,\x20%s,\x20%s',_0x17b28a,_0x25705a);_0x4961b9(_0x25705a);});});}exports[_0x2efe('0x1a')]=function(_0x3b9bc6){var _0xf9ea68=this;return new Promise(function(_0x1e8981,_0x2dbeb0){return db[_0x2efe('0x1b')][_0x2efe('0x1c')]({'raw':_0x3b9bc6[_0x2efe('0x1d')]?_0x3b9bc6[_0x2efe('0x1d')][_0x2efe('0x1e')]===undefined?!![]:![]:!![],'where':_0x3b9bc6[_0x2efe('0x1d')]?_0x3b9bc6[_0x2efe('0x1d')][_0x2efe('0x1f')]||null:null,'attributes':_0x3b9bc6[_0x2efe('0x1d')]?_0x3b9bc6[_0x2efe('0x1d')]['attributes']||null:null,'limit':_0x3b9bc6[_0x2efe('0x1d')]?_0x3b9bc6[_0x2efe('0x1d')]['limit']||null:null,'include':_0x3b9bc6[_0x2efe('0x1d')]?_0x3b9bc6['options'][_0x2efe('0x20')]?_[_0x2efe('0x21')](_0x3b9bc6[_0x2efe('0x1d')][_0x2efe('0x20')],function(_0x4e68c7){return{'model':db[_0x4e68c7[_0x2efe('0x22')]],'as':_0x4e68c7['as'],'attributes':_0x4e68c7[_0x2efe('0x23')],'include':_0x4e68c7[_0x2efe('0x20')]?_[_0x2efe('0x21')](_0x4e68c7['include'],function(_0xae7ccb){return{'model':db[_0xae7ccb['model']],'as':_0xae7ccb['as'],'attributes':_0xae7ccb[_0x2efe('0x23')],'include':_0xae7ccb[_0x2efe('0x20')]?_[_0x2efe('0x21')](_0xae7ccb[_0x2efe('0x20')],function(_0x2b5b9b){return{'model':db[_0x2b5b9b[_0x2efe('0x22')]],'as':_0x2b5b9b['as'],'attributes':_0x2b5b9b['attributes']};}):[]};}):[]};}):[]:[]})[_0x2efe('0xe')](function(_0x9244c9){logger[_0x2efe('0xf')](_0x2efe('0x1a'),_0x3b9bc6);logger[_0x2efe('0x11')](_0x2efe('0x1a'),_0x3b9bc6,JSON[_0x2efe('0x13')](_0x9244c9));_0x1e8981(_0x9244c9);})[_0x2efe('0x19')](function(_0x347382){logger[_0x2efe('0x14')](_0x2efe('0x1a'),_0x347382[_0x2efe('0x17')],_0x3b9bc6);_0x2dbeb0(_0xf9ea68['error'](0x1f4,_0x347382['message']));});});};exports[_0x2efe('0x24')]=function(_0x247af0){var _0x2c4642=this;return new Promise(function(_0xc11679,_0xa5a4f7){return db[_0x2efe('0x1b')]['create'](_0x247af0['body'],{'raw':_0x247af0[_0x2efe('0x1d')]?_0x247af0[_0x2efe('0x1d')][_0x2efe('0x1e')]===undefined?!![]:![]:!![]})[_0x2efe('0xe')](function(_0xb233a){logger['info'](_0x2efe('0x24'),_0x247af0);logger[_0x2efe('0x11')](_0x2efe('0x24'),_0x247af0,JSON[_0x2efe('0x13')](_0xb233a));_0xc11679(_0xb233a);})['catch'](function(_0x1e7885){logger['error'](_0x2efe('0x24'),_0x1e7885[_0x2efe('0x17')],_0x247af0);_0xa5a4f7(_0x2c4642['error'](0x1f4,_0x1e7885[_0x2efe('0x17')]));});});};exports[_0x2efe('0x25')]=function(_0x2626f9){var _0xce4d14=this;return new Promise(function(_0x1dab95,_0x52f7f5){return db[_0x2efe('0x1b')][_0x2efe('0x26')](_0x2626f9[_0x2efe('0x27')],{'raw':_0x2626f9[_0x2efe('0x1d')]?_0x2626f9['options'][_0x2efe('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2626f9[_0x2efe('0x1d')]?_0x2626f9['options'][_0x2efe('0x1f')]||null:null,'attributes':_0x2626f9[_0x2efe('0x1d')]?_0x2626f9[_0x2efe('0x1d')][_0x2efe('0x23')]||null:null,'limit':_0x2626f9['options']?_0x2626f9['options'][_0x2efe('0x28')]||null:null})['then'](function(_0x10705a){logger['info'](_0x2efe('0x25'),_0x2626f9);logger[_0x2efe('0x11')](_0x2efe('0x25'),_0x2626f9,JSON[_0x2efe('0x13')](_0x10705a));_0x1dab95(_0x10705a);})[_0x2efe('0x19')](function(_0xdb4b06){logger['error'](_0x2efe('0x25'),_0xdb4b06['message'],_0x2626f9);_0x52f7f5(_0xce4d14['error'](0x1f4,_0xdb4b06[_0x2efe('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 6faa318..7e0a849 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 _0x1b27=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1b27,0xa3));var _0x71b2=function(_0x576188,_0x1f6d14){_0x576188=_0x576188-0x0;var _0x5a13b7=_0x1b27[_0x576188];return _0x5a13b7;};'use strict';var multer=require(_0x71b2('0x0'));var util=require(_0x71b2('0x1'));var path=require('path');var timeout=require(_0x71b2('0x2'));var express=require(_0x71b2('0x3'));var router=express[_0x71b2('0x4')]();var fs_extra=require(_0x71b2('0x5'));var auth=require(_0x71b2('0x6'));var interaction=require(_0x71b2('0x7'));var config=require(_0x71b2('0x8'));var controller=require('./voiceChanSpy.controller');router['get']('/',auth[_0x71b2('0x9')](),controller[_0x71b2('0xa')]);router[_0x71b2('0xb')](_0x71b2('0xc'),auth[_0x71b2('0x9')](),controller[_0x71b2('0xd')]);router[_0x71b2('0xe')]('/',auth['isAuthenticated'](),controller[_0x71b2('0xf')]);router[_0x71b2('0x10')](_0x71b2('0xc'),auth[_0x71b2('0x9')](),controller[_0x71b2('0x11')]);router[_0x71b2('0x12')](_0x71b2('0xc'),auth['isAuthenticated'](),controller[_0x71b2('0x13')]);module[_0x71b2('0x14')]=router; \ No newline at end of file +var _0x27e0=['fs-extra','../../config/environment','./voiceChanSpy.controller','isAuthenticated','index','get','/:id','show','post','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x27e0,0x162));var _0x027e=function(_0x497213,_0x4764f5){_0x497213=_0x497213-0x0;var _0x313e74=_0x27e0[_0x497213];return _0x313e74;};'use strict';var multer=require(_0x027e('0x0'));var util=require(_0x027e('0x1'));var path=require(_0x027e('0x2'));var timeout=require(_0x027e('0x3'));var express=require(_0x027e('0x4'));var router=express[_0x027e('0x5')]();var fs_extra=require(_0x027e('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x027e('0x7'));var controller=require(_0x027e('0x8'));router['get']('/',auth[_0x027e('0x9')](),controller[_0x027e('0xa')]);router[_0x027e('0xb')](_0x027e('0xc'),auth[_0x027e('0x9')](),controller[_0x027e('0xd')]);router[_0x027e('0xe')]('/',auth[_0x027e('0x9')](),controller['create']);router['put'](_0x027e('0xc'),auth[_0x027e('0x9')](),controller['update']);router[_0x027e('0xf')](_0x027e('0xc'),auth['isAuthenticated'](),controller[_0x027e('0x10')]);module[_0x027e('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 82bc351..9d85ef9 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 _0x0458=['split','BOOLEAN','STRING','options','join','getDataValue'];(function(_0x492481,_0x270034){var _0x320ae8=function(_0xaeb83){while(--_0xaeb83){_0x492481['push'](_0x492481['shift']());}};_0x320ae8(++_0x270034);}(_0x0458,0xaa));var _0x8045=function(_0x18824d,_0x5b629f){_0x18824d=_0x18824d-0x0;var _0x10ae33=_0x0458[_0x18824d];return _0x10ae33;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8045('0x0')]},'prefix':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x8045('0x0')],'set':function(_0xc4d5a5){this['setDataValue'](_0x8045('0x1'),_0xc4d5a5?_0xc4d5a5[_0x8045('0x2')](''):[]);},'get':function(){return this[_0x8045('0x3')](_0x8045('0x1'))?this[_0x8045('0x3')](_0x8045('0x1'))[_0x8045('0x4')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x8045('0x5')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x8045('0x0')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x344c=['exports','STRING','setDataValue','options','join','getDataValue','split','sequelize'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x344c,0x1c7));var _0xc344=function(_0x409951,_0x3ad248){_0x409951=_0x409951-0x0;var _0x4bb29d=_0x344c[_0x409951];return _0x4bb29d;};'use strict';var Sequelize=require(_0xc344('0x0'));module[_0xc344('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xc344('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x2350e1){this[_0xc344('0x3')](_0xc344('0x4'),_0x2350e1?_0x2350e1[_0xc344('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0xc344('0x4'))?this[_0xc344('0x6')](_0xc344('0x4'))[_0xc344('0x7')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xc344('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc344('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 9230090..e2d0abd 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 _0x3eec=['set','Content-Range','apply','reject','save','update','then','get','ChanSpies','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','VoiceChanSpy','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','undefined','count','offset','limit'];(function(_0x343bfc,_0x489f24){var _0x28cfbd=function(_0x5d618e){while(--_0x5d618e){_0x343bfc['push'](_0x343bfc['shift']());}};_0x28cfbd(++_0x489f24);}(_0x3eec,0x1e9));var _0xc3ee=function(_0x366c47,_0x4937ca){_0x366c47=_0x366c47-0x0;var _0x297870=_0x3eec[_0x366c47];return _0x297870;};'use strict';var emlformat=require(_0xc3ee('0x0'));var rimraf=require(_0xc3ee('0x1'));var zipdir=require(_0xc3ee('0x2'));var jsonpatch=require(_0xc3ee('0x3'));var rp=require('request-promise');var moment=require(_0xc3ee('0x4'));var BPromise=require(_0xc3ee('0x5'));var Mustache=require(_0xc3ee('0x6'));var util=require(_0xc3ee('0x7'));var path=require(_0xc3ee('0x8'));var sox=require(_0xc3ee('0x9'));var csv=require('to-csv');var ejs=require(_0xc3ee('0xa'));var fs=require('fs');var fs_extra=require(_0xc3ee('0xb'));var _=require(_0xc3ee('0xc'));var squel=require(_0xc3ee('0xd'));var crypto=require(_0xc3ee('0xe'));var jsforce=require(_0xc3ee('0xf'));var deskjs=require(_0xc3ee('0x10'));var toCsv=require(_0xc3ee('0x11'));var querystring=require(_0xc3ee('0x12'));var Papa=require(_0xc3ee('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc3ee('0x14'));var as=require(_0xc3ee('0x15'));var hardwareService=require(_0xc3ee('0x16'));var logger=require(_0xc3ee('0x17'))('api');var utils=require(_0xc3ee('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xc3ee('0x19'));var db=require(_0xc3ee('0x1a'))['db'];function respondWithStatusCode(_0x4beb01,_0x5f2c3a){_0x5f2c3a=_0x5f2c3a||0xcc;return function(_0x2eb82e){if(_0x2eb82e){return _0x4beb01['sendStatus'](_0x5f2c3a);}return _0x4beb01[_0xc3ee('0x1b')](_0x5f2c3a)['end']();};}function respondWithResult(_0x19feb3,_0x58ebe7){_0x58ebe7=_0x58ebe7||0xc8;return function(_0x3d669d){if(_0x3d669d){return _0x19feb3[_0xc3ee('0x1b')](_0x58ebe7)[_0xc3ee('0x1c')](_0x3d669d);}};}function respondWithFilteredResult(_0x664bad,_0x476f8f){return function(_0xf63359){if(_0xf63359){var _0x277e11=typeof _0x476f8f['offset']===_0xc3ee('0x1d')&&typeof _0x476f8f['limit']===_0xc3ee('0x1d');var _0x1bf49a=_0xf63359[_0xc3ee('0x1e')];var _0x219db0=_0x277e11?0x0:_0x476f8f[_0xc3ee('0x1f')];var _0x3acb0c=_0x277e11?_0xf63359[_0xc3ee('0x1e')]:_0x476f8f[_0xc3ee('0x1f')]+_0x476f8f[_0xc3ee('0x20')];var _0x202a9a;if(_0x3acb0c>=_0x1bf49a){_0x3acb0c=_0x1bf49a;_0x202a9a=0xc8;}else{_0x202a9a=0xce;}_0x664bad[_0xc3ee('0x1b')](_0x202a9a);return _0x664bad[_0xc3ee('0x21')](_0xc3ee('0x22'),_0x219db0+'-'+_0x3acb0c+'/'+_0x1bf49a)[_0xc3ee('0x1c')](_0xf63359);}return null;};}function patchUpdates(_0x3e7224){return function(_0x46a8c9){try{jsonpatch[_0xc3ee('0x23')](_0x46a8c9,_0x3e7224,!![]);}catch(_0x30df3a){return BPromise[_0xc3ee('0x24')](_0x30df3a);}return _0x46a8c9[_0xc3ee('0x25')]();};}function saveUpdates(_0x11778f,_0x493fea){return function(_0x4d672e){if(_0x4d672e){return _0x4d672e[_0xc3ee('0x26')](_0x11778f)[_0xc3ee('0x27')](function(_0x3b8f75){return _0x3b8f75;});}return null;};}function removeEntity(_0x464ffc,_0x28bfeb){return function(_0x238df7){if(_0x238df7){return _0x238df7['destroy']()[_0xc3ee('0x27')](function(){var _0x3f8f7b=_0x238df7[_0xc3ee('0x28')]({'plain':!![]});var _0xfd03bd=_0xc3ee('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0xfd03bd,'resourceId':_0x3f8f7b['id']}})[_0xc3ee('0x27')](function(){return _0x238df7;});})[_0xc3ee('0x27')](function(){_0x464ffc[_0xc3ee('0x1b')](0xcc)[_0xc3ee('0x2a')]();});}};}function handleEntityNotFound(_0x836fac,_0x4ecfec){return function(_0x56201a){if(!_0x56201a){_0x836fac['sendStatus'](0x194);}return _0x56201a;};}function handleError(_0x1be005,_0x2f2c29){_0x2f2c29=_0x2f2c29||0x1f4;return function(_0x44678b){logger[_0xc3ee('0x2b')](_0x44678b[_0xc3ee('0x2c')]);if(_0x44678b['name']){delete _0x44678b[_0xc3ee('0x2d')];}_0x1be005[_0xc3ee('0x1b')](_0x2f2c29)[_0xc3ee('0x2e')](_0x44678b);};}exports[_0xc3ee('0x2f')]=function(_0x1f7b3a,_0x8bbe1e){var _0x3b17f7={},_0x4da264={},_0x330b71={'count':0x0,'rows':[]};var _0x35c19a=_[_0xc3ee('0x30')](db['VoiceChanSpy'][_0xc3ee('0x31')],function(_0x240a16){return{'name':_0x240a16[_0xc3ee('0x32')],'type':_0x240a16[_0xc3ee('0x33')][_0xc3ee('0x34')]};});_0x4da264[_0xc3ee('0x35')]=_[_0xc3ee('0x30')](_0x35c19a,'name');_0x4da264[_0xc3ee('0x36')]=_['keys'](_0x1f7b3a[_0xc3ee('0x36')]);_0x4da264[_0xc3ee('0x37')]=_[_0xc3ee('0x38')](_0x4da264[_0xc3ee('0x35')],_0x4da264[_0xc3ee('0x36')]);_0x3b17f7[_0xc3ee('0x39')]=_['intersection'](_0x4da264[_0xc3ee('0x35')],qs[_0xc3ee('0x3a')](_0x1f7b3a[_0xc3ee('0x36')][_0xc3ee('0x3a')]));_0x3b17f7[_0xc3ee('0x39')]=_0x3b17f7[_0xc3ee('0x39')][_0xc3ee('0x3b')]?_0x3b17f7[_0xc3ee('0x39')]:_0x4da264[_0xc3ee('0x35')];if(!_0x1f7b3a[_0xc3ee('0x36')][_0xc3ee('0x3c')](_0xc3ee('0x3d'))){_0x3b17f7[_0xc3ee('0x20')]=qs[_0xc3ee('0x20')](_0x1f7b3a[_0xc3ee('0x36')][_0xc3ee('0x20')]);_0x3b17f7[_0xc3ee('0x1f')]=qs[_0xc3ee('0x1f')](_0x1f7b3a[_0xc3ee('0x36')][_0xc3ee('0x1f')]);}_0x3b17f7[_0xc3ee('0x3e')]=qs['sort'](_0x1f7b3a[_0xc3ee('0x36')]['sort']);_0x3b17f7[_0xc3ee('0x3f')]=qs[_0xc3ee('0x37')](_[_0xc3ee('0x40')](_0x1f7b3a[_0xc3ee('0x36')],_0x4da264[_0xc3ee('0x37')]),_0x35c19a);if(_0x1f7b3a[_0xc3ee('0x36')]['filter']){_0x3b17f7[_0xc3ee('0x3f')]=_[_0xc3ee('0x41')](_0x3b17f7[_0xc3ee('0x3f')],{'$or':_['map'](_0x35c19a,function(_0x181179){if(_0x181179[_0xc3ee('0x33')]!==_0xc3ee('0x42')){var _0x1fe17f={};_0x1fe17f[_0x181179[_0xc3ee('0x2d')]]={'$like':'%'+_0x1f7b3a[_0xc3ee('0x36')][_0xc3ee('0x43')]+'%'};return _0x1fe17f;}})});}_0x3b17f7=_[_0xc3ee('0x41')]({},_0x3b17f7,_0x1f7b3a[_0xc3ee('0x44')]);var _0x23d365={'where':_0x3b17f7[_0xc3ee('0x3f')]};return db['VoiceChanSpy'][_0xc3ee('0x1e')](_0x23d365)[_0xc3ee('0x27')](function(_0x4a89b7){_0x330b71['count']=_0x4a89b7;if(_0x1f7b3a[_0xc3ee('0x36')][_0xc3ee('0x45')]){_0x3b17f7[_0xc3ee('0x46')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0xc3ee('0x47')](_0x3b17f7);})[_0xc3ee('0x27')](function(_0x112e77){_0x330b71[_0xc3ee('0x48')]=_0x112e77;return _0x330b71;})[_0xc3ee('0x27')](respondWithFilteredResult(_0x8bbe1e,_0x3b17f7))[_0xc3ee('0x49')](handleError(_0x8bbe1e,null));};exports[_0xc3ee('0x4a')]=function(_0x724c4e,_0x49b424){var _0x602d47={'raw':![],'where':{'id':_0x724c4e[_0xc3ee('0x4b')]['id']}},_0xf833d9={};_0xf833d9[_0xc3ee('0x35')]=_[_0xc3ee('0x4c')](db['VoiceChanSpy'][_0xc3ee('0x31')]);_0xf833d9['query']=_['keys'](_0x724c4e[_0xc3ee('0x36')]);_0xf833d9[_0xc3ee('0x37')]=_['intersection'](_0xf833d9[_0xc3ee('0x35')],_0xf833d9[_0xc3ee('0x36')]);_0x602d47['attributes']=_[_0xc3ee('0x38')](_0xf833d9['model'],qs[_0xc3ee('0x3a')](_0x724c4e['query'][_0xc3ee('0x3a')]));_0x602d47[_0xc3ee('0x39')]=_0x602d47['attributes']['length']?_0x602d47['attributes']:_0xf833d9[_0xc3ee('0x35')];if(_0x724c4e[_0xc3ee('0x36')][_0xc3ee('0x45')]){_0x602d47[_0xc3ee('0x46')]=[{'all':!![]}];}_0x602d47=_[_0xc3ee('0x41')]({},_0x602d47,_0x724c4e['options']);return db['VoiceChanSpy'][_0xc3ee('0x4d')](_0x602d47)[_0xc3ee('0x27')](handleEntityNotFound(_0x49b424,null))['then'](respondWithResult(_0x49b424,null))[_0xc3ee('0x49')](handleError(_0x49b424,null));};exports['create']=function(_0x60e36a,_0x5d0017){return db[_0xc3ee('0x4e')][_0xc3ee('0x4f')](_0x60e36a[_0xc3ee('0x50')],{})[_0xc3ee('0x27')](function(_0x8c8cc6){var _0x281adc=_0x60e36a[_0xc3ee('0x51')]['get']({'plain':!![]});if(!_0x281adc)throw new Error(_0xc3ee('0x52'));if(_0x281adc[_0xc3ee('0x53')]===_0xc3ee('0x51')){var _0x237aa8=_0x8c8cc6['get']({'plain':!![]});var _0xd246f2=_0xc3ee('0x29');return db[_0xc3ee('0x54')][_0xc3ee('0x4d')]({'where':{'name':_0xd246f2,'userProfileId':_0x281adc[_0xc3ee('0x55')]},'raw':!![]})[_0xc3ee('0x27')](function(_0x14df9d){if(_0x14df9d&&_0x14df9d['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x237aa8['name'],'resourceId':_0x237aa8['id'],'type':_0x14df9d[_0xc3ee('0x2d')],'sectionId':_0x14df9d['id']},{})[_0xc3ee('0x27')](function(){return _0x8c8cc6;});}else{return _0x8c8cc6;}})[_0xc3ee('0x49')](function(_0x2b9ea){logger[_0xc3ee('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b9ea);throw _0x2b9ea;});}return _0x8c8cc6;})['then'](respondWithResult(_0x5d0017,0xc9))[_0xc3ee('0x49')](handleError(_0x5d0017,null));};exports['update']=function(_0x1ca127,_0x28eca9){if(_0x1ca127[_0xc3ee('0x50')]['id']){delete _0x1ca127['body']['id'];}return db[_0xc3ee('0x4e')][_0xc3ee('0x4d')]({'where':{'id':_0x1ca127[_0xc3ee('0x4b')]['id']}})[_0xc3ee('0x27')](handleEntityNotFound(_0x28eca9,null))[_0xc3ee('0x27')](saveUpdates(_0x1ca127[_0xc3ee('0x50')],null))[_0xc3ee('0x27')](respondWithResult(_0x28eca9,null))[_0xc3ee('0x49')](handleError(_0x28eca9,null));};exports[_0xc3ee('0x56')]=function(_0x5d5ca5,_0x3fdc8f){return db[_0xc3ee('0x4e')][_0xc3ee('0x4d')]({'where':{'id':_0x5d5ca5[_0xc3ee('0x4b')]['id']}})[_0xc3ee('0x27')](handleEntityNotFound(_0x3fdc8f,null))[_0xc3ee('0x27')](removeEntity(_0x3fdc8f,null))[_0xc3ee('0x49')](handleError(_0x3fdc8f,null));}; \ No newline at end of file +var _0x7cda=['error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','save','destroy','ChanSpies','then','end','stack','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','options','count','findAll','catch','show','params','includeAll','include','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','autoAssociation','UserProfileResource','create'];(function(_0x1635fe,_0x5f1d9f){var _0x3c512a=function(_0x26b53d){while(--_0x26b53d){_0x1635fe['push'](_0x1635fe['shift']());}};_0x3c512a(++_0x5f1d9f);}(_0x7cda,0xf6));var _0xa7cd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7cda[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa7cd('0x0'));var zipdir=require(_0xa7cd('0x1'));var jsonpatch=require(_0xa7cd('0x2'));var rp=require('request-promise');var moment=require(_0xa7cd('0x3'));var BPromise=require(_0xa7cd('0x4'));var Mustache=require('mustache');var util=require(_0xa7cd('0x5'));var path=require(_0xa7cd('0x6'));var sox=require(_0xa7cd('0x7'));var csv=require(_0xa7cd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa7cd('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa7cd('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xa7cd('0xb'));var toCsv=require(_0xa7cd('0x8'));var querystring=require(_0xa7cd('0xc'));var Papa=require(_0xa7cd('0xd'));var Redis=require(_0xa7cd('0xe'));var authService=require(_0xa7cd('0xf'));var qs=require(_0xa7cd('0x10'));var as=require(_0xa7cd('0x11'));var hardwareService=require(_0xa7cd('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xa7cd('0x13'));var config=require(_0xa7cd('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xa7cd('0x15'))['db'];function respondWithStatusCode(_0x4056ee,_0x57fb93){_0x57fb93=_0x57fb93||0xcc;return function(_0x3bbf3b){if(_0x3bbf3b){return _0x4056ee[_0xa7cd('0x16')](_0x57fb93);}return _0x4056ee[_0xa7cd('0x17')](_0x57fb93)['end']();};}function respondWithResult(_0x20c9ef,_0xff7938){_0xff7938=_0xff7938||0xc8;return function(_0x43abdf){if(_0x43abdf){return _0x20c9ef[_0xa7cd('0x17')](_0xff7938)[_0xa7cd('0x18')](_0x43abdf);}};}function respondWithFilteredResult(_0x2f53cd,_0x4e8710){return function(_0x5b2c7f){if(_0x5b2c7f){var _0x44d991=typeof _0x4e8710[_0xa7cd('0x19')]===_0xa7cd('0x1a')&&typeof _0x4e8710['limit']===_0xa7cd('0x1a');var _0x323e4b=_0x5b2c7f['count'];var _0x54b13f=_0x44d991?0x0:_0x4e8710[_0xa7cd('0x19')];var _0x2e1d4d=_0x44d991?_0x5b2c7f['count']:_0x4e8710[_0xa7cd('0x19')]+_0x4e8710[_0xa7cd('0x1b')];var _0x5b0e92;if(_0x2e1d4d>=_0x323e4b){_0x2e1d4d=_0x323e4b;_0x5b0e92=0xc8;}else{_0x5b0e92=0xce;}_0x2f53cd[_0xa7cd('0x17')](_0x5b0e92);return _0x2f53cd[_0xa7cd('0x1c')](_0xa7cd('0x1d'),_0x54b13f+'-'+_0x2e1d4d+'/'+_0x323e4b)['json'](_0x5b2c7f);}return null;};}function patchUpdates(_0x4c601c){return function(_0x57f8b4){try{jsonpatch[_0xa7cd('0x1e')](_0x57f8b4,_0x4c601c,!![]);}catch(_0x5dcd3b){return BPromise['reject'](_0x5dcd3b);}return _0x57f8b4[_0xa7cd('0x1f')]();};}function saveUpdates(_0x4dc29b,_0x2f20df){return function(_0x134612){if(_0x134612){return _0x134612['update'](_0x4dc29b)['then'](function(_0x49bd91){return _0x49bd91;});}return null;};}function removeEntity(_0x18f13a,_0x5c9891){return function(_0x242eab){if(_0x242eab){return _0x242eab[_0xa7cd('0x20')]()['then'](function(){var _0x39f093=_0x242eab['get']({'plain':!![]});var _0x313e79=_0xa7cd('0x21');return db['UserProfileResource'][_0xa7cd('0x20')]({'where':{'type':_0x313e79,'resourceId':_0x39f093['id']}})[_0xa7cd('0x22')](function(){return _0x242eab;});})['then'](function(){_0x18f13a['status'](0xcc)[_0xa7cd('0x23')]();});}};}function handleEntityNotFound(_0x4afca2,_0x3c2575){return function(_0x56491f){if(!_0x56491f){_0x4afca2[_0xa7cd('0x16')](0x194);}return _0x56491f;};}function handleError(_0x2b1b0a,_0x58bd0c){_0x58bd0c=_0x58bd0c||0x1f4;return function(_0x484fdc){logger['error'](_0x484fdc[_0xa7cd('0x24')]);if(_0x484fdc['name']){delete _0x484fdc[_0xa7cd('0x25')];}_0x2b1b0a[_0xa7cd('0x17')](_0x58bd0c)[_0xa7cd('0x26')](_0x484fdc);};}exports[_0xa7cd('0x27')]=function(_0x578c35,_0x11b7d7){var _0x4e1d87={},_0xbf5aa9={},_0x2299f1={'count':0x0,'rows':[]};var _0x4f8fb7=_[_0xa7cd('0x28')](db[_0xa7cd('0x29')][_0xa7cd('0x2a')],function(_0x129515){return{'name':_0x129515[_0xa7cd('0x2b')],'type':_0x129515[_0xa7cd('0x2c')][_0xa7cd('0x2d')]};});_0xbf5aa9[_0xa7cd('0x2e')]=_[_0xa7cd('0x28')](_0x4f8fb7,_0xa7cd('0x25'));_0xbf5aa9['query']=_[_0xa7cd('0x2f')](_0x578c35[_0xa7cd('0x30')]);_0xbf5aa9['filters']=_['intersection'](_0xbf5aa9[_0xa7cd('0x2e')],_0xbf5aa9[_0xa7cd('0x30')]);_0x4e1d87['attributes']=_[_0xa7cd('0x31')](_0xbf5aa9[_0xa7cd('0x2e')],qs[_0xa7cd('0x32')](_0x578c35['query'][_0xa7cd('0x32')]));_0x4e1d87['attributes']=_0x4e1d87[_0xa7cd('0x33')][_0xa7cd('0x34')]?_0x4e1d87[_0xa7cd('0x33')]:_0xbf5aa9[_0xa7cd('0x2e')];if(!_0x578c35['query']['hasOwnProperty'](_0xa7cd('0x35'))){_0x4e1d87[_0xa7cd('0x1b')]=qs[_0xa7cd('0x1b')](_0x578c35[_0xa7cd('0x30')][_0xa7cd('0x1b')]);_0x4e1d87[_0xa7cd('0x19')]=qs[_0xa7cd('0x19')](_0x578c35['query'][_0xa7cd('0x19')]);}_0x4e1d87[_0xa7cd('0x36')]=qs[_0xa7cd('0x37')](_0x578c35[_0xa7cd('0x30')][_0xa7cd('0x37')]);_0x4e1d87[_0xa7cd('0x38')]=qs[_0xa7cd('0x39')](_[_0xa7cd('0x3a')](_0x578c35['query'],_0xbf5aa9[_0xa7cd('0x39')]),_0x4f8fb7);if(_0x578c35[_0xa7cd('0x30')][_0xa7cd('0x3b')]){_0x4e1d87[_0xa7cd('0x38')]=_[_0xa7cd('0x3c')](_0x4e1d87[_0xa7cd('0x38')],{'$or':_[_0xa7cd('0x28')](_0x4f8fb7,function(_0x321c2c){if(_0x321c2c['type']!=='VIRTUAL'){var _0x14e899={};_0x14e899[_0x321c2c[_0xa7cd('0x25')]]={'$like':'%'+_0x578c35[_0xa7cd('0x30')]['filter']+'%'};return _0x14e899;}})});}_0x4e1d87=_[_0xa7cd('0x3c')]({},_0x4e1d87,_0x578c35[_0xa7cd('0x3d')]);var _0x23a3d3={'where':_0x4e1d87[_0xa7cd('0x38')]};return db['VoiceChanSpy'][_0xa7cd('0x3e')](_0x23a3d3)[_0xa7cd('0x22')](function(_0x1c8958){_0x2299f1[_0xa7cd('0x3e')]=_0x1c8958;if(_0x578c35['query']['includeAll']){_0x4e1d87['include']=[{'all':!![]}];}return db[_0xa7cd('0x29')][_0xa7cd('0x3f')](_0x4e1d87);})[_0xa7cd('0x22')](function(_0x54802d){_0x2299f1['rows']=_0x54802d;return _0x2299f1;})[_0xa7cd('0x22')](respondWithFilteredResult(_0x11b7d7,_0x4e1d87))[_0xa7cd('0x40')](handleError(_0x11b7d7,null));};exports[_0xa7cd('0x41')]=function(_0x9accc4,_0x24ca0c){var _0x34ebf0={'raw':![],'where':{'id':_0x9accc4[_0xa7cd('0x42')]['id']}},_0x2c9ca8={};_0x2c9ca8[_0xa7cd('0x2e')]=_[_0xa7cd('0x2f')](db[_0xa7cd('0x29')][_0xa7cd('0x2a')]);_0x2c9ca8[_0xa7cd('0x30')]=_[_0xa7cd('0x2f')](_0x9accc4[_0xa7cd('0x30')]);_0x2c9ca8[_0xa7cd('0x39')]=_['intersection'](_0x2c9ca8[_0xa7cd('0x2e')],_0x2c9ca8[_0xa7cd('0x30')]);_0x34ebf0[_0xa7cd('0x33')]=_[_0xa7cd('0x31')](_0x2c9ca8[_0xa7cd('0x2e')],qs[_0xa7cd('0x32')](_0x9accc4[_0xa7cd('0x30')]['fields']));_0x34ebf0[_0xa7cd('0x33')]=_0x34ebf0[_0xa7cd('0x33')][_0xa7cd('0x34')]?_0x34ebf0['attributes']:_0x2c9ca8[_0xa7cd('0x2e')];if(_0x9accc4[_0xa7cd('0x30')][_0xa7cd('0x43')]){_0x34ebf0[_0xa7cd('0x44')]=[{'all':!![]}];}_0x34ebf0=_[_0xa7cd('0x3c')]({},_0x34ebf0,_0x9accc4[_0xa7cd('0x3d')]);return db[_0xa7cd('0x29')][_0xa7cd('0x45')](_0x34ebf0)[_0xa7cd('0x22')](handleEntityNotFound(_0x24ca0c,null))['then'](respondWithResult(_0x24ca0c,null))['catch'](handleError(_0x24ca0c,null));};exports['create']=function(_0x35e023,_0xf668be){return db[_0xa7cd('0x29')]['create'](_0x35e023[_0xa7cd('0x46')],{})[_0xa7cd('0x22')](function(_0x4b991d){var _0x5d25d7=_0x35e023['user']['get']({'plain':!![]});if(!_0x5d25d7)throw new Error(_0xa7cd('0x47'));if(_0x5d25d7[_0xa7cd('0x48')]===_0xa7cd('0x49')){var _0x11f0d0=_0x4b991d[_0xa7cd('0x4a')]({'plain':!![]});var _0x2bf8be=_0xa7cd('0x21');return db['UserProfileSection'][_0xa7cd('0x45')]({'where':{'name':_0x2bf8be,'userProfileId':_0x5d25d7['userProfileId']},'raw':!![]})[_0xa7cd('0x22')](function(_0x2b0b47){if(_0x2b0b47&&_0x2b0b47[_0xa7cd('0x4b')]===0x0){return db[_0xa7cd('0x4c')][_0xa7cd('0x4d')]({'name':_0x11f0d0[_0xa7cd('0x25')],'resourceId':_0x11f0d0['id'],'type':_0x2b0b47[_0xa7cd('0x25')],'sectionId':_0x2b0b47['id']},{})['then'](function(){return _0x4b991d;});}else{return _0x4b991d;}})[_0xa7cd('0x40')](function(_0x51c67f){logger[_0xa7cd('0x4e')](_0xa7cd('0x4f'),_0x51c67f);throw _0x51c67f;});}return _0x4b991d;})[_0xa7cd('0x22')](respondWithResult(_0xf668be,0xc9))[_0xa7cd('0x40')](handleError(_0xf668be,null));};exports[_0xa7cd('0x50')]=function(_0x5e5c3f,_0x5b7fb9){if(_0x5e5c3f[_0xa7cd('0x46')]['id']){delete _0x5e5c3f[_0xa7cd('0x46')]['id'];}return db[_0xa7cd('0x29')][_0xa7cd('0x45')]({'where':{'id':_0x5e5c3f['params']['id']}})[_0xa7cd('0x22')](handleEntityNotFound(_0x5b7fb9,null))[_0xa7cd('0x22')](saveUpdates(_0x5e5c3f[_0xa7cd('0x46')],null))[_0xa7cd('0x22')](respondWithResult(_0x5b7fb9,null))['catch'](handleError(_0x5b7fb9,null));};exports['destroy']=function(_0x555594,_0x346687){return db[_0xa7cd('0x29')][_0xa7cd('0x45')]({'where':{'id':_0x555594[_0xa7cd('0x42')]['id']}})['then'](handleEntityNotFound(_0x346687,null))[_0xa7cd('0x22')](removeEntity(_0x346687,null))[_0xa7cd('0x40')](handleError(_0x346687,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 798ff0f..c19667b 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 _0x9f26=['StopMixMonitor','length','internal','User','findAll','agent','catch','exports','models','define','VoiceChanSpy','voice_chanspy','bulkCreate','destroy','then','VoiceExtension','util','bluebird','context','from-sip','format','prefix','system','push','merge','Set','CDR(type)=%s','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options'];(function(_0x1f120b,_0x3c6511){var _0x152e97=function(_0x355314){while(--_0x355314){_0x1f120b['push'](_0x1f120b['shift']());}};_0x152e97(++_0x3c6511);}(_0x9f26,0x11a));var _0x69f2=function(_0x183261,_0xaad4a4){_0x183261=_0x183261-0x0;var _0x336016=_0x9f26[_0x183261];return _0x336016;};'use strict';var _=require('lodash');var util=require(_0x69f2('0x0'));var BPromise=require(_0x69f2('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x1d69ea,_0x5c7d9c,_0x46820b){var _0x436813=0x1;var _0x130051=[];var _0x2e06c5={'context':_0x5c7d9c[_0x69f2('0x2')]||_0x69f2('0x3'),'exten':util[_0x69f2('0x4')]('%s%s',_0x1d69ea[_0x69f2('0x5')],_0x46820b),'type':_0x69f2('0x6'),'isApp':![],'ChanSpyId':_0x1d69ea['id'],'UserId':_0x5c7d9c['id']};_0x130051[_0x69f2('0x7')](_[_0x69f2('0x8')]({'app':_0x69f2('0x9'),'appdata':util[_0x69f2('0x4')](_0x69f2('0xa'),'chanspy'),'priority':_0x436813++},_0x2e06c5));if(_0x1d69ea[_0x69f2('0xb')]){_0x130051[_0x69f2('0x7')](_[_0x69f2('0x8')]({'app':_0x69f2('0xc'),'appdata':util[_0x69f2('0x4')](_0x69f2('0xd'),_0x1d69ea[_0x69f2('0xe')]),'priority':_0x436813++},_0x2e06c5));}if(_0x1d69ea[_0x69f2('0xf')]){_0x130051[_0x69f2('0x7')](_[_0x69f2('0x8')]({'app':_0x69f2('0x10'),'appdata':_0x1d69ea[_0x69f2('0x11')],'priority':_0x436813++},_0x2e06c5));}_0x130051[_0x69f2('0x7')](_[_0x69f2('0x8')]({'app':_0x69f2('0x12'),'appdata':util[_0x69f2('0x4')](_0x69f2('0x13'),_0x5c7d9c[_0x69f2('0x14')],_0x1d69ea[_0x69f2('0x15')]?_0x1d69ea[_0x69f2('0x15')]['join'](''):''),'priority':_0x436813++},_0x2e06c5));if(_0x1d69ea[_0x69f2('0xb')]){_0x130051[_0x69f2('0x7')](_['merge']({'app':_0x69f2('0x16'),'priority':_0x436813++},_0x2e06c5));}return _0x130051;};var getChanSpyApplications=function(_0x148e8c,_0x59bcfb){var _0x167f42=[];for(var _0x2767f1=0x0,_0x513eca=0x1;_0x2767f1<_0x59bcfb[_0x69f2('0x17')];_0x2767f1++,_0x513eca=0x1){_0x167f42=_0x167f42['concat'](getUserApplications(_0x148e8c,_0x59bcfb[_0x2767f1],_0x59bcfb[_0x2767f1][_0x69f2('0x18')]));if(_0x59bcfb[_0x2767f1][_0x69f2('0x18')]!=_0x59bcfb[_0x2767f1][_0x69f2('0x14')]){_0x167f42=_0x167f42['concat'](getUserApplications(_0x148e8c,_0x59bcfb[_0x2767f1],_0x59bcfb[_0x2767f1][_0x69f2('0x14')]));}}return _0x167f42;};var getChanSpyPromise=function(_0x355f46,_0x3a0e14){return new BPromise(function(_0x1e87d5,_0x2feed9){return _0x355f46[_0x69f2('0x19')][_0x69f2('0x1a')]({'attributes':['id',_0x69f2('0x14'),'internal'],'where':{'role':_0x69f2('0x1b'),'chanspy':!![]},'raw':!![]})['then'](function(_0x49d5bc){if(_0x49d5bc){return _0x1e87d5(getChanSpyApplications(_0x3a0e14,_0x49d5bc));}return _0x1e87d5([]);})[_0x69f2('0x1c')](function(_0xfec70d){_0x2feed9(_0xfec70d);});});};module[_0x69f2('0x1d')]=function(_0x52becb,_0x4dad25){var _0x412b1d=_0x52becb[_0x69f2('0x1e')];return _0x52becb[_0x69f2('0x1f')](_0x69f2('0x20'),attributes,{'tableName':_0x69f2('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1f6ad8,_0x32ae90,_0x2876f0){return getChanSpyPromise(_0x412b1d,_0x1f6ad8)['then'](function(_0x261b2f){if(_0x261b2f&&_0x261b2f[_0x69f2('0x17')]){return _0x412b1d['VoiceExtension'][_0x69f2('0x22')](_0x261b2f);}})['then'](function(){_0x2876f0();})[_0x69f2('0x1c')](function(_0x46e5a6){_0x2876f0(_0x46e5a6);});},'afterUpdate':function(_0x32399b,_0x51082a,_0x77f60b){return _0x412b1d['VoiceExtension'][_0x69f2('0x23')]({'where':{'ChanSpyId':_0x32399b['id']}})[_0x69f2('0x24')](function(){return getChanSpyPromise(_0x412b1d,_0x32399b);})[_0x69f2('0x24')](function(_0x323a7f){if(_0x323a7f&&_0x323a7f[_0x69f2('0x17')]){return _0x412b1d['VoiceExtension'][_0x69f2('0x22')](_0x323a7f);}})[_0x69f2('0x24')](function(){_0x77f60b();})[_0x69f2('0x1c')](function(_0x3b6b68){_0x77f60b(_0x3b6b68);});},'afterDestroy':function(_0x3c1bcb,_0x294698,_0x50abd1){return _0x412b1d[_0x69f2('0x25')][_0x69f2('0x23')]({'where':{'ChanSpyId':_0x3c1bcb['id']}})['then'](function(){_0x50abd1();})['catch'](function(_0x2bb04d){_0x50abd1(_0x2bb04d);});}}});}; \ No newline at end of file +var _0xc603=['record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','password','ChanSpy','SIP/%s,%s','name','options','join','length','concat','internal','findAll','agent','then','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','catch','destroy','lodash','util','bluebird','context','from-sip','%s%s','prefix','system','push','merge','Set','format','chanspy'];(function(_0x4e9133,_0x58a6e2){var _0x21a983=function(_0x1f8eaa){while(--_0x1f8eaa){_0x4e9133['push'](_0x4e9133['shift']());}};_0x21a983(++_0x58a6e2);}(_0xc603,0xb6));var _0x3c60=function(_0x267094,_0x535d9a){_0x267094=_0x267094-0x0;var _0x43589b=_0xc603[_0x267094];return _0x43589b;};'use strict';var _=require(_0x3c60('0x0'));var util=require(_0x3c60('0x1'));var BPromise=require(_0x3c60('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x3f3fe1,_0x275b6c,_0x58c327){var _0x50cf12=0x1;var _0x402f12=[];var _0x22e539={'context':_0x275b6c[_0x3c60('0x3')]||_0x3c60('0x4'),'exten':util['format'](_0x3c60('0x5'),_0x3f3fe1[_0x3c60('0x6')],_0x58c327),'type':_0x3c60('0x7'),'isApp':![],'ChanSpyId':_0x3f3fe1['id'],'UserId':_0x275b6c['id']};_0x402f12[_0x3c60('0x8')](_[_0x3c60('0x9')]({'app':_0x3c60('0xa'),'appdata':util[_0x3c60('0xb')]('CDR(type)=%s',_0x3c60('0xc')),'priority':_0x50cf12++},_0x22e539));if(_0x3f3fe1[_0x3c60('0xd')]){_0x402f12[_0x3c60('0x8')](_[_0x3c60('0x9')]({'app':_0x3c60('0xe'),'appdata':util[_0x3c60('0xb')](_0x3c60('0xf'),_0x3f3fe1[_0x3c60('0x10')]),'priority':_0x50cf12++},_0x22e539));}if(_0x3f3fe1[_0x3c60('0x11')]){_0x402f12[_0x3c60('0x8')](_[_0x3c60('0x9')]({'app':'Authenticate','appdata':_0x3f3fe1[_0x3c60('0x12')],'priority':_0x50cf12++},_0x22e539));}_0x402f12[_0x3c60('0x8')](_[_0x3c60('0x9')]({'app':_0x3c60('0x13'),'appdata':util['format'](_0x3c60('0x14'),_0x275b6c[_0x3c60('0x15')],_0x3f3fe1['options']?_0x3f3fe1[_0x3c60('0x16')][_0x3c60('0x17')](''):''),'priority':_0x50cf12++},_0x22e539));if(_0x3f3fe1[_0x3c60('0xd')]){_0x402f12[_0x3c60('0x8')](_[_0x3c60('0x9')]({'app':'StopMixMonitor','priority':_0x50cf12++},_0x22e539));}return _0x402f12;};var getChanSpyApplications=function(_0x1901af,_0x40ce01){var _0x23ce10=[];for(var _0x4b457c=0x0,_0x23703d=0x1;_0x4b457c<_0x40ce01[_0x3c60('0x18')];_0x4b457c++,_0x23703d=0x1){_0x23ce10=_0x23ce10[_0x3c60('0x19')](getUserApplications(_0x1901af,_0x40ce01[_0x4b457c],_0x40ce01[_0x4b457c]['internal']));if(_0x40ce01[_0x4b457c][_0x3c60('0x1a')]!=_0x40ce01[_0x4b457c]['name']){_0x23ce10=_0x23ce10['concat'](getUserApplications(_0x1901af,_0x40ce01[_0x4b457c],_0x40ce01[_0x4b457c][_0x3c60('0x15')]));}}return _0x23ce10;};var getChanSpyPromise=function(_0x3ce7de,_0x3141ff){return new BPromise(function(_0x3275c4,_0x5a802e){return _0x3ce7de['User'][_0x3c60('0x1b')]({'attributes':['id','name','internal'],'where':{'role':_0x3c60('0x1c'),'chanspy':!![]},'raw':!![]})[_0x3c60('0x1d')](function(_0x57704f){if(_0x57704f){return _0x3275c4(getChanSpyApplications(_0x3141ff,_0x57704f));}return _0x3275c4([]);})['catch'](function(_0x127e3b){_0x5a802e(_0x127e3b);});});};module[_0x3c60('0x1e')]=function(_0x5e5bd9,_0x102e2f){var _0x2c7ad1=_0x5e5bd9[_0x3c60('0x1f')];return _0x5e5bd9[_0x3c60('0x20')](_0x3c60('0x21'),attributes,{'tableName':_0x3c60('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x7aa2c6,_0x54b227,_0x1f31d1){return getChanSpyPromise(_0x2c7ad1,_0x7aa2c6)[_0x3c60('0x1d')](function(_0x59e2d2){if(_0x59e2d2&&_0x59e2d2['length']){return _0x2c7ad1[_0x3c60('0x23')][_0x3c60('0x24')](_0x59e2d2);}})[_0x3c60('0x1d')](function(){_0x1f31d1();})[_0x3c60('0x25')](function(_0x46bcc9){_0x1f31d1(_0x46bcc9);});},'afterUpdate':function(_0x46bc1d,_0x1bccaa,_0x99cf40){return _0x2c7ad1[_0x3c60('0x23')][_0x3c60('0x26')]({'where':{'ChanSpyId':_0x46bc1d['id']}})['then'](function(){return getChanSpyPromise(_0x2c7ad1,_0x46bc1d);})['then'](function(_0x28be4e){if(_0x28be4e&&_0x28be4e['length']){return _0x2c7ad1[_0x3c60('0x23')][_0x3c60('0x24')](_0x28be4e);}})[_0x3c60('0x1d')](function(){_0x99cf40();})[_0x3c60('0x25')](function(_0x2d65d4){_0x99cf40(_0x2d65d4);});},'afterDestroy':function(_0x17df0b,_0x140bab,_0x4cdef6){return _0x2c7ad1[_0x3c60('0x23')][_0x3c60('0x26')]({'where':{'ChanSpyId':_0x17df0b['id']}})[_0x3c60('0x1d')](function(){_0x4cdef6();})['catch'](function(_0x4c3c53){_0x4cdef6(_0x4c3c53);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index a8d76de..f3e90bf 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 _0x2f3a=['http','request','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x35f58e,_0x36c73c){var _0x307911=function(_0x49824d){while(--_0x49824d){_0x35f58e['push'](_0x35f58e['shift']());}};_0x307911(++_0x36c73c);}(_0x2f3a,0xfb));var _0xa2f3=function(_0x31355d,_0x131035){_0x31355d=_0x31355d-0x0;var _0x456781=_0x2f3a[_0x31355d];return _0x456781;};'use strict';var _=require(_0xa2f3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa2f3('0x1'));var rs=require(_0xa2f3('0x2'));var fs=require('fs');var Redis=require(_0xa2f3('0x3'));var db=require(_0xa2f3('0x4'))['db'];var utils=require(_0xa2f3('0x5'));var logger=require(_0xa2f3('0x6'))('rpc');var config=require(_0xa2f3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa2f3('0x8')][_0xa2f3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4db21d,_0x521ddf,_0x2faf36){return new BPromise(function(_0x3944a0,_0x4405a2){return client[_0xa2f3('0xa')](_0x4db21d,_0x2faf36)['then'](function(_0x358263){logger[_0xa2f3('0xb')](_0xa2f3('0xc'),_0x521ddf,_0xa2f3('0xd'));logger[_0xa2f3('0xe')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x521ddf,_0xa2f3('0xd'),JSON[_0xa2f3('0xf')](_0x358263));if(_0x358263['error']){if(_0x358263[_0xa2f3('0x10')][_0xa2f3('0x11')]===0x1f4){logger[_0xa2f3('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x521ddf,_0x358263[_0xa2f3('0x10')][_0xa2f3('0x12')]);return _0x4405a2(_0x358263[_0xa2f3('0x10')][_0xa2f3('0x12')]);}logger[_0xa2f3('0x10')](_0xa2f3('0xc'),_0x521ddf,_0x358263[_0xa2f3('0x10')][_0xa2f3('0x12')]);return _0x3944a0(_0x358263[_0xa2f3('0x10')]['message']);}else{logger[_0xa2f3('0xb')](_0xa2f3('0xc'),_0x521ddf,_0xa2f3('0xd'));_0x3944a0(_0x358263['result'][_0xa2f3('0x12')]);}})[_0xa2f3('0x13')](function(_0x4b138b){logger['error'](_0xa2f3('0xc'),_0x521ddf,_0x4b138b);_0x4405a2(_0x4b138b);});});} \ No newline at end of file +var _0x6f2f=['lodash','util','ioredis','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','code','error','VoiceChanSpy,\x20%s,\x20%s','message','result','catch'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0x6f2f,0xbe));var _0xf6f2=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x6f2f[_0x45d55e];return _0x29812a;};'use strict';var _=require(_0xf6f2('0x0'));var util=require(_0xf6f2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf6f2('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf6f2('0x3'))(_0xf6f2('0x4'));var config=require(_0xf6f2('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf6f2('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1c94ad,_0x26cd28,_0x774922){return new BPromise(function(_0x15a71c,_0x1873c8){return client[_0xf6f2('0x7')](_0x1c94ad,_0x774922)[_0xf6f2('0x8')](function(_0x294a85){logger[_0xf6f2('0x9')]('VoiceChanSpy,\x20%s,\x20%s',_0x26cd28,_0xf6f2('0xa'));logger[_0xf6f2('0xb')](_0xf6f2('0xc'),_0x26cd28,_0xf6f2('0xa'),JSON['stringify'](_0x294a85));if(_0x294a85['error']){if(_0x294a85['error'][_0xf6f2('0xd')]===0x1f4){logger[_0xf6f2('0xe')](_0xf6f2('0xf'),_0x26cd28,_0x294a85[_0xf6f2('0xe')][_0xf6f2('0x10')]);return _0x1873c8(_0x294a85[_0xf6f2('0xe')]['message']);}logger[_0xf6f2('0xe')](_0xf6f2('0xf'),_0x26cd28,_0x294a85[_0xf6f2('0xe')][_0xf6f2('0x10')]);return _0x15a71c(_0x294a85[_0xf6f2('0xe')]['message']);}else{logger[_0xf6f2('0x9')](_0xf6f2('0xf'),_0x26cd28,_0xf6f2('0xa'));_0x15a71c(_0x294a85[_0xf6f2('0x11')][_0xf6f2('0x10')]);}})[_0xf6f2('0x12')](function(_0x17dec3){logger[_0xf6f2('0xe')](_0xf6f2('0xf'),_0x26cd28,_0x17dec3);_0x1873c8(_0x17dec3);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index be9f60c..8a0afa2 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 _0x1f9b=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','show','post','isAuthenticated','create','/:id','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x2dda5e,_0x50c725){var _0x2b726d=function(_0x278176){while(--_0x278176){_0x2dda5e['push'](_0x2dda5e['shift']());}};_0x2b726d(++_0x50c725);}(_0x1f9b,0xc5));var _0xb1f9=function(_0x5ea19e,_0x4f5d42){_0x5ea19e=_0x5ea19e-0x0;var _0x4d8eb1=_0x1f9b[_0x5ea19e];return _0x4d8eb1;};'use strict';var multer=require('multer');var util=require(_0xb1f9('0x0'));var path=require(_0xb1f9('0x1'));var timeout=require(_0xb1f9('0x2'));var express=require(_0xb1f9('0x3'));var router=express[_0xb1f9('0x4')]();var fs_extra=require(_0xb1f9('0x5'));var auth=require(_0xb1f9('0x6'));var interaction=require(_0xb1f9('0x7'));var config=require(_0xb1f9('0x8'));var controller=require('./voiceContext.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xb1f9('0x9')]);router[_0xb1f9('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xb1f9('0xb')]);router[_0xb1f9('0xc')]('/',auth[_0xb1f9('0xd')](),controller[_0xb1f9('0xe')]);router['put'](_0xb1f9('0xf'),auth[_0xb1f9('0xd')](),controller[_0xb1f9('0x10')]);router[_0xb1f9('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xb1f9('0x12')]);module[_0xb1f9('0x13')]=router; \ No newline at end of file +var _0xb9c7=['../../config/environment','./voiceContext.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x271060,_0x3f86b1){var _0x40540b=function(_0x1735a7){while(--_0x1735a7){_0x271060['push'](_0x271060['shift']());}};_0x40540b(++_0x3f86b1);}(_0xb9c7,0x110));var _0x7b9c=function(_0x36ec71,_0x3e50bf){_0x36ec71=_0x36ec71-0x0;var _0xcbb9a5=_0xb9c7[_0x36ec71];return _0xcbb9a5;};'use strict';var multer=require(_0x7b9c('0x0'));var util=require(_0x7b9c('0x1'));var path=require(_0x7b9c('0x2'));var timeout=require(_0x7b9c('0x3'));var express=require(_0x7b9c('0x4'));var router=express[_0x7b9c('0x5')]();var fs_extra=require(_0x7b9c('0x6'));var auth=require(_0x7b9c('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x7b9c('0x8'));var controller=require(_0x7b9c('0x9'));router[_0x7b9c('0xa')]('/',auth[_0x7b9c('0xb')](),controller['index']);router['get'](_0x7b9c('0xc'),auth[_0x7b9c('0xb')](),controller[_0x7b9c('0xd')]);router[_0x7b9c('0xe')]('/',auth[_0x7b9c('0xb')](),controller['create']);router[_0x7b9c('0xf')](_0x7b9c('0xc'),auth[_0x7b9c('0xb')](),controller[_0x7b9c('0x10')]);router[_0x7b9c('0x11')](_0x7b9c('0xc'),auth[_0x7b9c('0xb')](),controller[_0x7b9c('0x12')]);module[_0x7b9c('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 8ec008b..fb4e330 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 _0x859f=['BOOLEAN','sequelize','exports','STRING'];(function(_0x2363ed,_0x58ea74){var _0x530666=function(_0x177efc){while(--_0x177efc){_0x2363ed['push'](_0x2363ed['shift']());}};_0x530666(++_0x58ea74);}(_0x859f,0x121));var _0xf859=function(_0x5006c9,_0x3d05d1){_0x5006c9=_0x5006c9-0x0;var _0x2d240c=_0x859f[_0x5006c9];return _0x2d240c;};'use strict';var Sequelize=require(_0xf859('0x0'));module[_0xf859('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0xf859('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xf859('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x171d=['BOOLEAN','sequelize','exports','STRING','name'];(function(_0x4e9427,_0x11f23e){var _0x2f64ba=function(_0x25fa17){while(--_0x25fa17){_0x4e9427['push'](_0x4e9427['shift']());}};_0x2f64ba(++_0x11f23e);}(_0x171d,0xb5));var _0xd171=function(_0x3bab09,_0x217c29){_0x3bab09=_0x3bab09-0x0;var _0x164376=_0x171d[_0x3bab09];return _0x164376;};'use strict';var Sequelize=require(_0xd171('0x0'));module[_0xd171('0x1')]={'name':{'type':Sequelize[_0xd171('0x2')],'unique':_0xd171('0x3')},'description':{'type':Sequelize[_0xd171('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xd171('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 9d04e4d..bd61480 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 _0xcd5e=['role','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','body','readFileSync','writeFileSync','Reload','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','client','http','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','VoiceContext,\x20%s,\x20%s','message','result','sendStatus','status','end','json','undefined','count','offset','apply','update','get','Contexts','UserProfileResource','destroy','stack','name','send','map','VoiceContext','rawAttributes','fieldName','type','key','keys','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','merge','VIRTUAL','filter','options','include','findAll','rows','show','includeAll','find','catch','join','root','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','create','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x3c22ab,_0x4478c3){var _0x4aeac4=function(_0x11df02){while(--_0x11df02){_0x3c22ab['push'](_0x3c22ab['shift']());}};_0x4aeac4(++_0x4478c3);}(_0xcd5e,0x13e));var _0xecd5=function(_0x1589c3,_0x3ad0ee){_0x1589c3=_0x1589c3-0x0;var _0x243192=_0xcd5e[_0x1589c3];return _0x243192;};'use strict';var emlformat=require(_0xecd5('0x0'));var rimraf=require(_0xecd5('0x1'));var zipdir=require(_0xecd5('0x2'));var jsonpatch=require(_0xecd5('0x3'));var rp=require(_0xecd5('0x4'));var moment=require('moment');var BPromise=require(_0xecd5('0x5'));var Mustache=require(_0xecd5('0x6'));var util=require(_0xecd5('0x7'));var path=require(_0xecd5('0x8'));var sox=require(_0xecd5('0x9'));var csv=require(_0xecd5('0xa'));var ejs=require(_0xecd5('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xecd5('0xc'));var crypto=require(_0xecd5('0xd'));var jsforce=require(_0xecd5('0xe'));var deskjs=require(_0xecd5('0xf'));var toCsv=require(_0xecd5('0xa'));var querystring=require('querystring');var Papa=require(_0xecd5('0x10'));var Redis=require(_0xecd5('0x11'));var authService=require(_0xecd5('0x12'));var qs=require(_0xecd5('0x13'));var as=require(_0xecd5('0x14'));var hardwareService=require(_0xecd5('0x15'));var logger=require(_0xecd5('0x16'))(_0xecd5('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xecd5('0x18'));var db=require(_0xecd5('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xecd5('0x1a')][_0xecd5('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x522d8f,_0x18448e,_0x4490f1,_0x2035ba){return new BPromise(function(_0x1c224e,_0x4bf682){var _0x2f33f7=_0x2035ba||client;return _0x2f33f7[_0xecd5('0x1c')](_0x522d8f,_0x4490f1)[_0xecd5('0x1d')](function(_0x1f5c12){logger[_0xecd5('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x18448e,_0xecd5('0x1f'));logger[_0xecd5('0x20')](_0xecd5('0x21'),_0x18448e,_0xecd5('0x1f'),JSON[_0xecd5('0x22')](_0x1f5c12));if(_0x1f5c12[_0xecd5('0x23')]){if(_0x1f5c12['error']['code']===0x1f4){logger[_0xecd5('0x23')](_0xecd5('0x24'),_0x18448e,_0x1f5c12[_0xecd5('0x23')][_0xecd5('0x25')]);return _0x4bf682(_0x1f5c12[_0xecd5('0x23')][_0xecd5('0x25')]);}logger[_0xecd5('0x23')]('VoiceContext,\x20%s,\x20%s',_0x18448e,_0x1f5c12['error'][_0xecd5('0x25')]);return _0x1c224e(_0x1f5c12['error'][_0xecd5('0x25')]);}else{logger[_0xecd5('0x1e')](_0xecd5('0x24'),_0x18448e,_0xecd5('0x1f'));_0x1c224e(_0x1f5c12[_0xecd5('0x26')]['message']);}})['catch'](function(_0x12a9d2){logger[_0xecd5('0x23')](_0xecd5('0x24'),_0x18448e,_0x12a9d2);_0x4bf682(_0x12a9d2);});});}function respondWithStatusCode(_0x4a7811,_0x31dee6){_0x31dee6=_0x31dee6||0xcc;return function(_0x412fb8){if(_0x412fb8){return _0x4a7811[_0xecd5('0x27')](_0x31dee6);}return _0x4a7811[_0xecd5('0x28')](_0x31dee6)[_0xecd5('0x29')]();};}function respondWithResult(_0x16db73,_0x2a813a){_0x2a813a=_0x2a813a||0xc8;return function(_0xf3727a){if(_0xf3727a){return _0x16db73[_0xecd5('0x28')](_0x2a813a)[_0xecd5('0x2a')](_0xf3727a);}};}function respondWithFilteredResult(_0x172dcb,_0x3900aa){return function(_0x3c35ee){if(_0x3c35ee){var _0x42a335=typeof _0x3900aa['offset']===_0xecd5('0x2b')&&typeof _0x3900aa['limit']===_0xecd5('0x2b');var _0x2ad90e=_0x3c35ee[_0xecd5('0x2c')];var _0x505a87=_0x42a335?0x0:_0x3900aa[_0xecd5('0x2d')];var _0x554d1d=_0x42a335?_0x3c35ee[_0xecd5('0x2c')]:_0x3900aa[_0xecd5('0x2d')]+_0x3900aa['limit'];var _0x166f60;if(_0x554d1d>=_0x2ad90e){_0x554d1d=_0x2ad90e;_0x166f60=0xc8;}else{_0x166f60=0xce;}_0x172dcb[_0xecd5('0x28')](_0x166f60);return _0x172dcb['set']('Content-Range',_0x505a87+'-'+_0x554d1d+'/'+_0x2ad90e)['json'](_0x3c35ee);}return null;};}function patchUpdates(_0x3953fc){return function(_0x2f7af1){try{jsonpatch[_0xecd5('0x2e')](_0x2f7af1,_0x3953fc,!![]);}catch(_0x1fa22d){return BPromise['reject'](_0x1fa22d);}return _0x2f7af1['save']();};}function saveUpdates(_0x1bbe00,_0x1fff8b){return function(_0x46c0db){if(_0x46c0db){return _0x46c0db[_0xecd5('0x2f')](_0x1bbe00)[_0xecd5('0x1d')](function(_0x5ad01e){return _0x5ad01e;});}return null;};}function removeEntity(_0x37086e,_0x4990fd){return function(_0x468434){if(_0x468434){return _0x468434['destroy']()['then'](function(){var _0xb03ed6=_0x468434[_0xecd5('0x30')]({'plain':!![]});var _0x5576a1=_0xecd5('0x31');return db[_0xecd5('0x32')][_0xecd5('0x33')]({'where':{'type':_0x5576a1,'resourceId':_0xb03ed6['id']}})['then'](function(){return _0x468434;});})[_0xecd5('0x1d')](function(){_0x37086e['status'](0xcc)[_0xecd5('0x29')]();});}};}function handleEntityNotFound(_0x517ddd,_0x11a6bd){return function(_0x10faa0){if(!_0x10faa0){_0x517ddd['sendStatus'](0x194);}return _0x10faa0;};}function handleError(_0x218fbf,_0x3e64a5){_0x3e64a5=_0x3e64a5||0x1f4;return function(_0x376ca4){logger[_0xecd5('0x23')](_0x376ca4[_0xecd5('0x34')]);if(_0x376ca4[_0xecd5('0x35')]){delete _0x376ca4['name'];}_0x218fbf['status'](_0x3e64a5)[_0xecd5('0x36')](_0x376ca4);};}exports['index']=function(_0x282007,_0x527070){var _0x4d6763={},_0x426254={},_0x558585={'count':0x0,'rows':[]};var _0x11c1d3=_[_0xecd5('0x37')](db[_0xecd5('0x38')][_0xecd5('0x39')],function(_0x542017){return{'name':_0x542017[_0xecd5('0x3a')],'type':_0x542017[_0xecd5('0x3b')][_0xecd5('0x3c')]};});_0x426254['model']=_[_0xecd5('0x37')](_0x11c1d3,_0xecd5('0x35'));_0x426254['query']=_[_0xecd5('0x3d')](_0x282007['query']);_0x426254['filters']=_[_0xecd5('0x3e')](_0x426254[_0xecd5('0x3f')],_0x426254[_0xecd5('0x40')]);_0x4d6763[_0xecd5('0x41')]=_[_0xecd5('0x3e')](_0x426254['model'],qs[_0xecd5('0x42')](_0x282007[_0xecd5('0x40')]['fields']));_0x4d6763[_0xecd5('0x41')]=_0x4d6763[_0xecd5('0x41')]['length']?_0x4d6763[_0xecd5('0x41')]:_0x426254[_0xecd5('0x3f')];if(!_0x282007[_0xecd5('0x40')][_0xecd5('0x43')](_0xecd5('0x44'))){_0x4d6763['limit']=qs[_0xecd5('0x45')](_0x282007[_0xecd5('0x40')][_0xecd5('0x45')]);_0x4d6763[_0xecd5('0x2d')]=qs['offset'](_0x282007[_0xecd5('0x40')][_0xecd5('0x2d')]);}_0x4d6763[_0xecd5('0x46')]=qs[_0xecd5('0x47')](_0x282007[_0xecd5('0x40')][_0xecd5('0x47')]);_0x4d6763[_0xecd5('0x48')]=qs[_0xecd5('0x49')](_['pick'](_0x282007['query'],_0x426254[_0xecd5('0x49')]),_0x11c1d3);if(_0x282007['query']['filter']){_0x4d6763[_0xecd5('0x48')]=_[_0xecd5('0x4a')](_0x4d6763[_0xecd5('0x48')],{'$or':_[_0xecd5('0x37')](_0x11c1d3,function(_0x487eb6){if(_0x487eb6[_0xecd5('0x3b')]!==_0xecd5('0x4b')){var _0x1e87d4={};_0x1e87d4[_0x487eb6['name']]={'$like':'%'+_0x282007['query'][_0xecd5('0x4c')]+'%'};return _0x1e87d4;}})});}_0x4d6763=_[_0xecd5('0x4a')]({},_0x4d6763,_0x282007[_0xecd5('0x4d')]);var _0x5732ae={'where':_0x4d6763[_0xecd5('0x48')]};return db[_0xecd5('0x38')]['count'](_0x5732ae)[_0xecd5('0x1d')](function(_0x150072){_0x558585['count']=_0x150072;if(_0x282007[_0xecd5('0x40')]['includeAll']){_0x4d6763[_0xecd5('0x4e')]=[{'all':!![]}];}return db['VoiceContext'][_0xecd5('0x4f')](_0x4d6763);})[_0xecd5('0x1d')](function(_0x49b795){_0x558585[_0xecd5('0x50')]=_0x49b795;return _0x558585;})['then'](respondWithFilteredResult(_0x527070,_0x4d6763))['catch'](handleError(_0x527070,null));};exports[_0xecd5('0x51')]=function(_0x29196c,_0x43fb2f){var _0x3d7de6={'raw':![],'where':{'id':_0x29196c['params']['id']}},_0x3c34c1={};_0x3c34c1[_0xecd5('0x3f')]=_[_0xecd5('0x3d')](db[_0xecd5('0x38')][_0xecd5('0x39')]);_0x3c34c1[_0xecd5('0x40')]=_['keys'](_0x29196c[_0xecd5('0x40')]);_0x3c34c1[_0xecd5('0x49')]=_[_0xecd5('0x3e')](_0x3c34c1[_0xecd5('0x3f')],_0x3c34c1[_0xecd5('0x40')]);_0x3d7de6[_0xecd5('0x41')]=_[_0xecd5('0x3e')](_0x3c34c1[_0xecd5('0x3f')],qs[_0xecd5('0x42')](_0x29196c[_0xecd5('0x40')][_0xecd5('0x42')]));_0x3d7de6[_0xecd5('0x41')]=_0x3d7de6[_0xecd5('0x41')]['length']?_0x3d7de6[_0xecd5('0x41')]:_0x3c34c1[_0xecd5('0x3f')];if(_0x29196c[_0xecd5('0x40')][_0xecd5('0x52')]){_0x3d7de6[_0xecd5('0x4e')]=[{'all':!![]}];}_0x3d7de6=_[_0xecd5('0x4a')]({},_0x3d7de6,_0x29196c['options']);return db[_0xecd5('0x38')][_0xecd5('0x53')](_0x3d7de6)['then'](handleEntityNotFound(_0x43fb2f,null))[_0xecd5('0x1d')](respondWithResult(_0x43fb2f,null))[_0xecd5('0x54')](handleError(_0x43fb2f,null));};exports['create']=function(_0x4ca359,_0x1b491c,_0x545723){var _0x116ea0;return db[_0xecd5('0x38')]['create'](_0x4ca359['body'],{'raw':!![]})[_0xecd5('0x1d')](function(_0x376ca9){_0x116ea0=_0x376ca9;return db[_0xecd5('0x38')][_0xecd5('0x4f')]({'raw':!![]});})[_0xecd5('0x1d')](function(_0x3a3ae8){var _0x327c25=fs['readFileSync'](path[_0xecd5('0x55')](config[_0xecd5('0x56')],_0xecd5('0x57')),_0xecd5('0x58'));var _0x25ba91=ejs[_0xecd5('0x59')](_0x327c25,{'contexts':_0x3a3ae8||[]});fs['writeFileSync'](_0xecd5('0x5a'),_0x25ba91);})[_0xecd5('0x1d')](function(){return respondWithRpcPromise('Reload',_0xecd5('0x5b'),{'module':_0xecd5('0x5c')});})[_0xecd5('0x1d')](function(){var _0x23ca22=_0x4ca359['user'][_0xecd5('0x30')]({'plain':!![]});if(!_0x23ca22)throw new Error(_0xecd5('0x5d'));if(_0x23ca22[_0xecd5('0x5e')]===_0xecd5('0x5f')){var _0x1dcfb5=_0x116ea0['get']({'plain':!![]});return db['UserProfileSection'][_0xecd5('0x53')]({'where':{'name':_0xecd5('0x31'),'userProfileId':_0x23ca22[_0xecd5('0x60')]},'raw':!![]})[_0xecd5('0x1d')](function(_0x2b73a7){if(_0x2b73a7&&_0x2b73a7['autoAssociation']===0x0){return db[_0xecd5('0x32')][_0xecd5('0x5b')]({'name':_0x1dcfb5['name'],'resourceId':_0x1dcfb5['id'],'type':_0x2b73a7[_0xecd5('0x35')],'sectionId':_0x2b73a7['id']},{})[_0xecd5('0x1d')](function(){return _0x116ea0;});}else{return _0x116ea0;}})[_0xecd5('0x54')](function(_0x84da8a){logger['error'](_0xecd5('0x61'),_0x84da8a);throw _0x84da8a;});}return _0x116ea0;})[_0xecd5('0x1d')](respondWithResult(_0x1b491c,0xc9))[_0xecd5('0x54')](handleError(_0x1b491c,null));};exports[_0xecd5('0x2f')]=function(_0x2fb106,_0x4c914e,_0x18499c){var _0x18bc92;return db[_0xecd5('0x38')][_0xecd5('0x53')]({'where':{'id':_0x2fb106[_0xecd5('0x62')]['id']}})['then'](handleEntityNotFound(_0x4c914e,null))[_0xecd5('0x1d')](saveUpdates(_0x2fb106[_0xecd5('0x63')],null))[_0xecd5('0x1d')](function(_0x3adf4e){if(_0x3adf4e){_0x18bc92=_0x3adf4e;return db['VoiceContext']['findAll']({'raw':!![]});}})[_0xecd5('0x1d')](function(_0x4f76b4){var _0x43656b=fs[_0xecd5('0x64')](path[_0xecd5('0x55')](config[_0xecd5('0x56')],_0xecd5('0x57')),_0xecd5('0x58'));var _0x923f80=ejs[_0xecd5('0x59')](_0x43656b,{'contexts':_0x4f76b4||[]});fs[_0xecd5('0x65')](_0xecd5('0x5a'),_0x923f80);})[_0xecd5('0x1d')](function(){return respondWithRpcPromise(_0xecd5('0x66'),_0xecd5('0x2f'),{'module':'chan_sip.so'});})[_0xecd5('0x1d')](function(){return _0x18bc92;})[_0xecd5('0x1d')](respondWithResult(_0x4c914e,null))[_0xecd5('0x54')](handleError(_0x4c914e,null));};exports[_0xecd5('0x33')]=function(_0x3ebdde,_0xde06a6,_0xb4834f){var _0x5f5a34;return db[_0xecd5('0x38')][_0xecd5('0x53')]({'where':{'id':_0x3ebdde[_0xecd5('0x62')]['id']}})[_0xecd5('0x1d')](handleEntityNotFound(_0xde06a6,null))[_0xecd5('0x1d')](removeEntity(_0xde06a6,null))[_0xecd5('0x1d')](function(){return db[_0xecd5('0x38')][_0xecd5('0x4f')]({'raw':!![]});})[_0xecd5('0x1d')](function(_0x570468){var _0x221082=fs[_0xecd5('0x64')](path['join'](config['root'],_0xecd5('0x57')),_0xecd5('0x58'));var _0x4dbc3e=ejs[_0xecd5('0x59')](_0x221082,{'contexts':_0x570468});fs[_0xecd5('0x65')](_0xecd5('0x5a'),_0x4dbc3e);return respondWithRpcPromise(_0xecd5('0x66'),'destroy',{'module':_0xecd5('0x5c')});})['catch'](handleError(_0xde06a6,null));}; \ No newline at end of file +var _0xb803=['reject','update','destroy','get','Contexts','UserProfileResource','sendStatus','name','send','VoiceContext','rawAttributes','fieldName','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','writeFileSync','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','render','/etc/asterisk/extensions_xcally_contexts.conf','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','json','offset','undefined','limit','count','status','set','Content-Range'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xb803,0x9c));var _0x3b80=function(_0x15306f,_0x3af850){_0x15306f=_0x15306f-0x0;var _0x26e261=_0xb803[_0x15306f];return _0x26e261;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3b80('0x0'));var zipdir=require(_0x3b80('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3b80('0x2'));var moment=require(_0x3b80('0x3'));var BPromise=require(_0x3b80('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3b80('0x5'));var sox=require(_0x3b80('0x6'));var csv=require('to-csv');var ejs=require(_0x3b80('0x7'));var fs=require('fs');var fs_extra=require(_0x3b80('0x8'));var _=require(_0x3b80('0x9'));var squel=require(_0x3b80('0xa'));var crypto=require(_0x3b80('0xb'));var jsforce=require(_0x3b80('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3b80('0xd'));var Papa=require(_0x3b80('0xe'));var Redis=require('ioredis');var authService=require(_0x3b80('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3b80('0x10'));var logger=require(_0x3b80('0x11'))(_0x3b80('0x12'));var utils=require(_0x3b80('0x13'));var config=require(_0x3b80('0x14'));var licenseUtil=require(_0x3b80('0x15'));var db=require(_0x3b80('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x3b80('0x17')][_0x3b80('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x1861c9,_0x48b806,_0x46ff1b,_0x71946d){return new BPromise(function(_0x2814ae,_0x5486b0){var _0x421d8b=_0x71946d||client;return _0x421d8b[_0x3b80('0x19')](_0x1861c9,_0x46ff1b)[_0x3b80('0x1a')](function(_0x5d26a0){logger[_0x3b80('0x1b')](_0x3b80('0x1c'),_0x48b806,_0x3b80('0x1d'));logger['debug'](_0x3b80('0x1e'),_0x48b806,'request\x20sent',JSON[_0x3b80('0x1f')](_0x5d26a0));if(_0x5d26a0[_0x3b80('0x20')]){if(_0x5d26a0[_0x3b80('0x20')][_0x3b80('0x21')]===0x1f4){logger[_0x3b80('0x20')](_0x3b80('0x1c'),_0x48b806,_0x5d26a0[_0x3b80('0x20')][_0x3b80('0x22')]);return _0x5486b0(_0x5d26a0['error']['message']);}logger[_0x3b80('0x20')]('VoiceContext,\x20%s,\x20%s',_0x48b806,_0x5d26a0[_0x3b80('0x20')]['message']);return _0x2814ae(_0x5d26a0[_0x3b80('0x20')][_0x3b80('0x22')]);}else{logger['info'](_0x3b80('0x1c'),_0x48b806,'request\x20sent');_0x2814ae(_0x5d26a0[_0x3b80('0x23')]['message']);}})[_0x3b80('0x24')](function(_0x1be895){logger[_0x3b80('0x20')]('VoiceContext,\x20%s,\x20%s',_0x48b806,_0x1be895);_0x5486b0(_0x1be895);});});}function respondWithStatusCode(_0xa81bb8,_0xe32c16){_0xe32c16=_0xe32c16||0xcc;return function(_0x43277){if(_0x43277){return _0xa81bb8['sendStatus'](_0xe32c16);}return _0xa81bb8['status'](_0xe32c16)[_0x3b80('0x25')]();};}function respondWithResult(_0x2a96ee,_0x3b56ee){_0x3b56ee=_0x3b56ee||0xc8;return function(_0x24c588){if(_0x24c588){return _0x2a96ee['status'](_0x3b56ee)[_0x3b80('0x26')](_0x24c588);}};}function respondWithFilteredResult(_0x2721fb,_0xb07fac){return function(_0x123423){if(_0x123423){var _0xb4dda4=typeof _0xb07fac[_0x3b80('0x27')]===_0x3b80('0x28')&&typeof _0xb07fac[_0x3b80('0x29')]===_0x3b80('0x28');var _0xba7f75=_0x123423[_0x3b80('0x2a')];var _0x119964=_0xb4dda4?0x0:_0xb07fac[_0x3b80('0x27')];var _0x23333d=_0xb4dda4?_0x123423[_0x3b80('0x2a')]:_0xb07fac['offset']+_0xb07fac[_0x3b80('0x29')];var _0x104725;if(_0x23333d>=_0xba7f75){_0x23333d=_0xba7f75;_0x104725=0xc8;}else{_0x104725=0xce;}_0x2721fb[_0x3b80('0x2b')](_0x104725);return _0x2721fb[_0x3b80('0x2c')](_0x3b80('0x2d'),_0x119964+'-'+_0x23333d+'/'+_0xba7f75)[_0x3b80('0x26')](_0x123423);}return null;};}function patchUpdates(_0x1955ae){return function(_0x434f7f){try{jsonpatch['apply'](_0x434f7f,_0x1955ae,!![]);}catch(_0x3524d3){return BPromise[_0x3b80('0x2e')](_0x3524d3);}return _0x434f7f['save']();};}function saveUpdates(_0x33efb6,_0x4b9bab){return function(_0x3f403e){if(_0x3f403e){return _0x3f403e[_0x3b80('0x2f')](_0x33efb6)['then'](function(_0x421ebb){return _0x421ebb;});}return null;};}function removeEntity(_0x5123b3,_0xdd696a){return function(_0x2bd8f3){if(_0x2bd8f3){return _0x2bd8f3[_0x3b80('0x30')]()[_0x3b80('0x1a')](function(){var _0x5f5667=_0x2bd8f3[_0x3b80('0x31')]({'plain':!![]});var _0x516567=_0x3b80('0x32');return db[_0x3b80('0x33')][_0x3b80('0x30')]({'where':{'type':_0x516567,'resourceId':_0x5f5667['id']}})['then'](function(){return _0x2bd8f3;});})[_0x3b80('0x1a')](function(){_0x5123b3[_0x3b80('0x2b')](0xcc)[_0x3b80('0x25')]();});}};}function handleEntityNotFound(_0x10cdc5,_0x4482d4){return function(_0x5cf5c0){if(!_0x5cf5c0){_0x10cdc5[_0x3b80('0x34')](0x194);}return _0x5cf5c0;};}function handleError(_0x180054,_0x7a8ac8){_0x7a8ac8=_0x7a8ac8||0x1f4;return function(_0x387b18){logger[_0x3b80('0x20')](_0x387b18['stack']);if(_0x387b18[_0x3b80('0x35')]){delete _0x387b18[_0x3b80('0x35')];}_0x180054['status'](_0x7a8ac8)[_0x3b80('0x36')](_0x387b18);};}exports['index']=function(_0x38f26d,_0x356dc1){var _0x17c8dd={},_0x153bd5={},_0x102b8c={'count':0x0,'rows':[]};var _0xa50ec4=_['map'](db[_0x3b80('0x37')][_0x3b80('0x38')],function(_0x5900d8){return{'name':_0x5900d8[_0x3b80('0x39')],'type':_0x5900d8['type'][_0x3b80('0x3a')]};});_0x153bd5['model']=_[_0x3b80('0x3b')](_0xa50ec4,_0x3b80('0x35'));_0x153bd5[_0x3b80('0x3c')]=_['keys'](_0x38f26d[_0x3b80('0x3c')]);_0x153bd5[_0x3b80('0x3d')]=_[_0x3b80('0x3e')](_0x153bd5[_0x3b80('0x3f')],_0x153bd5[_0x3b80('0x3c')]);_0x17c8dd[_0x3b80('0x40')]=_[_0x3b80('0x3e')](_0x153bd5['model'],qs[_0x3b80('0x41')](_0x38f26d[_0x3b80('0x3c')][_0x3b80('0x41')]));_0x17c8dd[_0x3b80('0x40')]=_0x17c8dd[_0x3b80('0x40')][_0x3b80('0x42')]?_0x17c8dd[_0x3b80('0x40')]:_0x153bd5[_0x3b80('0x3f')];if(!_0x38f26d[_0x3b80('0x3c')][_0x3b80('0x43')]('nolimit')){_0x17c8dd[_0x3b80('0x29')]=qs[_0x3b80('0x29')](_0x38f26d['query'][_0x3b80('0x29')]);_0x17c8dd[_0x3b80('0x27')]=qs['offset'](_0x38f26d['query']['offset']);}_0x17c8dd[_0x3b80('0x44')]=qs['sort'](_0x38f26d[_0x3b80('0x3c')]['sort']);_0x17c8dd[_0x3b80('0x45')]=qs['filters'](_[_0x3b80('0x46')](_0x38f26d['query'],_0x153bd5[_0x3b80('0x3d')]),_0xa50ec4);if(_0x38f26d['query'][_0x3b80('0x47')]){_0x17c8dd[_0x3b80('0x45')]=_[_0x3b80('0x48')](_0x17c8dd[_0x3b80('0x45')],{'$or':_[_0x3b80('0x3b')](_0xa50ec4,function(_0xd964bc){if(_0xd964bc[_0x3b80('0x49')]!==_0x3b80('0x4a')){var _0x2adc02={};_0x2adc02[_0xd964bc[_0x3b80('0x35')]]={'$like':'%'+_0x38f26d['query'][_0x3b80('0x47')]+'%'};return _0x2adc02;}})});}_0x17c8dd=_[_0x3b80('0x48')]({},_0x17c8dd,_0x38f26d[_0x3b80('0x4b')]);var _0x7bdc2d={'where':_0x17c8dd[_0x3b80('0x45')]};return db[_0x3b80('0x37')][_0x3b80('0x2a')](_0x7bdc2d)['then'](function(_0x1361ad){_0x102b8c[_0x3b80('0x2a')]=_0x1361ad;if(_0x38f26d['query'][_0x3b80('0x4c')]){_0x17c8dd[_0x3b80('0x4d')]=[{'all':!![]}];}return db[_0x3b80('0x37')][_0x3b80('0x4e')](_0x17c8dd);})[_0x3b80('0x1a')](function(_0x29b8d1){_0x102b8c[_0x3b80('0x4f')]=_0x29b8d1;return _0x102b8c;})[_0x3b80('0x1a')](respondWithFilteredResult(_0x356dc1,_0x17c8dd))[_0x3b80('0x24')](handleError(_0x356dc1,null));};exports[_0x3b80('0x50')]=function(_0xf4bf07,_0x3e5140){var _0x3ec753={'raw':![],'where':{'id':_0xf4bf07['params']['id']}},_0x3427e9={};_0x3427e9[_0x3b80('0x3f')]=_[_0x3b80('0x51')](db['VoiceContext'][_0x3b80('0x38')]);_0x3427e9[_0x3b80('0x3c')]=_['keys'](_0xf4bf07['query']);_0x3427e9[_0x3b80('0x3d')]=_[_0x3b80('0x3e')](_0x3427e9['model'],_0x3427e9[_0x3b80('0x3c')]);_0x3ec753[_0x3b80('0x40')]=_[_0x3b80('0x3e')](_0x3427e9[_0x3b80('0x3f')],qs[_0x3b80('0x41')](_0xf4bf07[_0x3b80('0x3c')]['fields']));_0x3ec753[_0x3b80('0x40')]=_0x3ec753[_0x3b80('0x40')][_0x3b80('0x42')]?_0x3ec753[_0x3b80('0x40')]:_0x3427e9[_0x3b80('0x3f')];if(_0xf4bf07[_0x3b80('0x3c')][_0x3b80('0x4c')]){_0x3ec753[_0x3b80('0x4d')]=[{'all':!![]}];}_0x3ec753=_[_0x3b80('0x48')]({},_0x3ec753,_0xf4bf07[_0x3b80('0x4b')]);return db['VoiceContext'][_0x3b80('0x52')](_0x3ec753)[_0x3b80('0x1a')](handleEntityNotFound(_0x3e5140,null))[_0x3b80('0x1a')](respondWithResult(_0x3e5140,null))[_0x3b80('0x24')](handleError(_0x3e5140,null));};exports[_0x3b80('0x53')]=function(_0x2fe95f,_0x127b93,_0x4cd053){var _0x2a63d6;return db[_0x3b80('0x37')][_0x3b80('0x53')](_0x2fe95f[_0x3b80('0x54')],{'raw':!![]})[_0x3b80('0x1a')](function(_0x5c93fe){_0x2a63d6=_0x5c93fe;return db[_0x3b80('0x37')][_0x3b80('0x4e')]({'raw':!![]});})[_0x3b80('0x1a')](function(_0x4a1e4a){var _0x37c2cc=fs[_0x3b80('0x55')](path[_0x3b80('0x56')](config[_0x3b80('0x57')],_0x3b80('0x58')),_0x3b80('0x59'));var _0x2595b4=ejs['render'](_0x37c2cc,{'contexts':_0x4a1e4a||[]});fs[_0x3b80('0x5a')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x2595b4);})['then'](function(){return respondWithRpcPromise(_0x3b80('0x5b'),_0x3b80('0x53'),{'module':_0x3b80('0x5c')});})[_0x3b80('0x1a')](function(){var _0x57cb24=_0x2fe95f[_0x3b80('0x5d')][_0x3b80('0x31')]({'plain':!![]});if(!_0x57cb24)throw new Error(_0x3b80('0x5e'));if(_0x57cb24[_0x3b80('0x5f')]==='user'){var _0x471c51=_0x2a63d6[_0x3b80('0x31')]({'plain':!![]});return db['UserProfileSection'][_0x3b80('0x52')]({'where':{'name':_0x3b80('0x32'),'userProfileId':_0x57cb24['userProfileId']},'raw':!![]})['then'](function(_0x528e83){if(_0x528e83&&_0x528e83[_0x3b80('0x60')]===0x0){return db[_0x3b80('0x33')][_0x3b80('0x53')]({'name':_0x471c51['name'],'resourceId':_0x471c51['id'],'type':_0x528e83[_0x3b80('0x35')],'sectionId':_0x528e83['id']},{})[_0x3b80('0x1a')](function(){return _0x2a63d6;});}else{return _0x2a63d6;}})[_0x3b80('0x24')](function(_0x4bf3d0){logger[_0x3b80('0x20')](_0x3b80('0x61'),_0x4bf3d0);throw _0x4bf3d0;});}return _0x2a63d6;})[_0x3b80('0x1a')](respondWithResult(_0x127b93,0xc9))[_0x3b80('0x24')](handleError(_0x127b93,null));};exports['update']=function(_0x37ceab,_0x3cbb07,_0x4156a5){var _0x2d0802;return db[_0x3b80('0x37')][_0x3b80('0x52')]({'where':{'id':_0x37ceab[_0x3b80('0x62')]['id']}})[_0x3b80('0x1a')](handleEntityNotFound(_0x3cbb07,null))['then'](saveUpdates(_0x37ceab[_0x3b80('0x54')],null))[_0x3b80('0x1a')](function(_0x2faff8){if(_0x2faff8){_0x2d0802=_0x2faff8;return db['VoiceContext'][_0x3b80('0x4e')]({'raw':!![]});}})[_0x3b80('0x1a')](function(_0x483418){var _0x323812=fs[_0x3b80('0x55')](path[_0x3b80('0x56')](config[_0x3b80('0x57')],_0x3b80('0x58')),_0x3b80('0x59'));var _0x156a0f=ejs[_0x3b80('0x63')](_0x323812,{'contexts':_0x483418||[]});fs[_0x3b80('0x5a')](_0x3b80('0x64'),_0x156a0f);})[_0x3b80('0x1a')](function(){return respondWithRpcPromise(_0x3b80('0x5b'),_0x3b80('0x2f'),{'module':'chan_sip.so'});})[_0x3b80('0x1a')](function(){return _0x2d0802;})['then'](respondWithResult(_0x3cbb07,null))[_0x3b80('0x24')](handleError(_0x3cbb07,null));};exports[_0x3b80('0x30')]=function(_0x23d93d,_0x38a91c,_0x4966a7){var _0x1d0726;return db[_0x3b80('0x37')][_0x3b80('0x52')]({'where':{'id':_0x23d93d[_0x3b80('0x62')]['id']}})[_0x3b80('0x1a')](handleEntityNotFound(_0x38a91c,null))[_0x3b80('0x1a')](removeEntity(_0x38a91c,null))['then'](function(){return db[_0x3b80('0x37')]['findAll']({'raw':!![]});})[_0x3b80('0x1a')](function(_0x123d53){var _0x56ddea=fs['readFileSync'](path[_0x3b80('0x56')](config[_0x3b80('0x57')],_0x3b80('0x58')),_0x3b80('0x59'));var _0x428935=ejs[_0x3b80('0x63')](_0x56ddea,{'contexts':_0x123d53});fs[_0x3b80('0x5a')](_0x3b80('0x64'),_0x428935);return respondWithRpcPromise('Reload',_0x3b80('0x30'),{'module':_0x3b80('0x5c')});})[_0x3b80('0x24')](handleError(_0x38a91c,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 72757a1..6748c71 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 _0x8ff4=['api','moment','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8ff4,0x11f));var _0x48ff=function(_0x2808d0,_0x221a9f){_0x2808d0=_0x2808d0-0x0;var _0x3aef7c=_0x8ff4[_0x2808d0];return _0x3aef7c;};'use strict';var _=require(_0x48ff('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x48ff('0x1'));var moment=require(_0x48ff('0x2'));var BPromise=require('bluebird');var rp=require(_0x48ff('0x3'));var fs=require('fs');var path=require(_0x48ff('0x4'));var rimraf=require(_0x48ff('0x5'));var config=require(_0x48ff('0x6'));var attributes=require(_0x48ff('0x7'));module[_0x48ff('0x8')]=function(_0x2909ca,_0x61d3b9){return _0x2909ca[_0x48ff('0x9')](_0x48ff('0xa'),attributes,{'tableName':_0x48ff('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x299a=['request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','util','../../config/logger','api','moment'];(function(_0x144426,_0x251ee2){var _0x70482c=function(_0x4d18b8){while(--_0x4d18b8){_0x144426['push'](_0x144426['shift']());}};_0x70482c(++_0x251ee2);}(_0x299a,0x182));var _0xa299=function(_0x397f41,_0x48306b){_0x397f41=_0x397f41-0x0;var _0x44f494=_0x299a[_0x397f41];return _0x44f494;};'use strict';var _=require('lodash');var util=require(_0xa299('0x0'));var logger=require(_0xa299('0x1'))(_0xa299('0x2'));var moment=require(_0xa299('0x3'));var BPromise=require('bluebird');var rp=require(_0xa299('0x4'));var fs=require('fs');var path=require(_0xa299('0x5'));var rimraf=require(_0xa299('0x6'));var config=require(_0xa299('0x7'));var attributes=require(_0xa299('0x8'));module[_0xa299('0x9')]=function(_0x401e8b,_0x1f4700){return _0x401e8b[_0xa299('0xa')](_0xa299('0xb'),attributes,{'tableName':_0xa299('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 4ff4213..c1c2ac2 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 _0xc2f4=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash'];(function(_0x53801e,_0x20c8c7){var _0x1c7d35=function(_0x4216dc){while(--_0x4216dc){_0x53801e['push'](_0x53801e['shift']());}};_0x1c7d35(++_0x20c8c7);}(_0xc2f4,0x107));var _0x4c2f=function(_0x59591b,_0x354045){_0x59591b=_0x59591b-0x0;var _0x576642=_0xc2f4[_0x59591b];return _0x576642;};'use strict';var _=require(_0x4c2f('0x0'));var util=require(_0x4c2f('0x1'));var moment=require(_0x4c2f('0x2'));var BPromise=require(_0x4c2f('0x3'));var rs=require(_0x4c2f('0x4'));var fs=require('fs');var Redis=require(_0x4c2f('0x5'));var db=require(_0x4c2f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4c2f('0x7'))(_0x4c2f('0x8'));var config=require(_0x4c2f('0x9'));var jayson=require(_0x4c2f('0xa'));var client=jayson[_0x4c2f('0xb')][_0x4c2f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ea773,_0x23de10,_0x4a6e8d){return new BPromise(function(_0x59212b,_0x175fc1){return client[_0x4c2f('0xd')](_0x4ea773,_0x4a6e8d)['then'](function(_0x349b7b){logger['info'](_0x4c2f('0xe'),_0x23de10,'request\x20sent');logger[_0x4c2f('0xf')](_0x4c2f('0x10'),_0x23de10,_0x4c2f('0x11'),JSON[_0x4c2f('0x12')](_0x349b7b));if(_0x349b7b[_0x4c2f('0x13')]){if(_0x349b7b[_0x4c2f('0x13')]['code']===0x1f4){logger[_0x4c2f('0x13')](_0x4c2f('0xe'),_0x23de10,_0x349b7b['error'][_0x4c2f('0x14')]);return _0x175fc1(_0x349b7b[_0x4c2f('0x13')][_0x4c2f('0x14')]);}logger[_0x4c2f('0x13')]('VoiceContext,\x20%s,\x20%s',_0x23de10,_0x349b7b[_0x4c2f('0x13')]['message']);return _0x59212b(_0x349b7b['error'][_0x4c2f('0x14')]);}else{logger[_0x4c2f('0x15')](_0x4c2f('0xe'),_0x23de10,'request\x20sent');_0x59212b(_0x349b7b[_0x4c2f('0x16')][_0x4c2f('0x14')]);}})[_0x4c2f('0x17')](function(_0x5598ac){logger[_0x4c2f('0x13')]('VoiceContext,\x20%s,\x20%s',_0x23de10,_0x5598ac);_0x175fc1(_0x5598ac);});});} \ No newline at end of file +var _0x5454=['stringify','error','code','message','result','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x5454,0x15b));var _0x4545=function(_0x391a42,_0x34f07f){_0x391a42=_0x391a42-0x0;var _0x268d09=_0x5454[_0x391a42];return _0x268d09;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x4545('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4545('0x1'));var logger=require(_0x4545('0x2'))(_0x4545('0x3'));var config=require(_0x4545('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x4545('0x5')][_0x4545('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x6fd3bb,_0xc79c57,_0x3f1134){return new BPromise(function(_0x1fd7e5,_0x1c5649){return client[_0x4545('0x7')](_0x6fd3bb,_0x3f1134)[_0x4545('0x8')](function(_0x3e2526){logger[_0x4545('0x9')](_0x4545('0xa'),_0xc79c57,_0x4545('0xb'));logger['debug'](_0x4545('0xc'),_0xc79c57,_0x4545('0xb'),JSON[_0x4545('0xd')](_0x3e2526));if(_0x3e2526[_0x4545('0xe')]){if(_0x3e2526[_0x4545('0xe')][_0x4545('0xf')]===0x1f4){logger['error'](_0x4545('0xa'),_0xc79c57,_0x3e2526[_0x4545('0xe')][_0x4545('0x10')]);return _0x1c5649(_0x3e2526[_0x4545('0xe')][_0x4545('0x10')]);}logger[_0x4545('0xe')](_0x4545('0xa'),_0xc79c57,_0x3e2526[_0x4545('0xe')][_0x4545('0x10')]);return _0x1fd7e5(_0x3e2526[_0x4545('0xe')][_0x4545('0x10')]);}else{logger['info'](_0x4545('0xa'),_0xc79c57,_0x4545('0xb'));_0x1fd7e5(_0x3e2526[_0x4545('0x11')][_0x4545('0x10')]);}})['catch'](function(_0x4a5bdf){logger[_0x4545('0xe')](_0x4545('0xa'),_0xc79c57,_0x4a5bdf);_0x1c5649(_0x4a5bdf);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 87f9cbc..b97d892 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 _0xf429=['update','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','index','get','/describe','isAuthenticated','/:id','show','create','put'];(function(_0x59e3db,_0x499793){var _0x2ec9a9=function(_0x1c2926){while(--_0x1c2926){_0x59e3db['push'](_0x59e3db['shift']());}};_0x2ec9a9(++_0x499793);}(_0xf429,0xd4));var _0x9f42=function(_0x22e47a,_0x4ea10c){_0x22e47a=_0x22e47a-0x0;var _0x15a12a=_0xf429[_0x22e47a];return _0x15a12a;};'use strict';var multer=require('multer');var util=require(_0x9f42('0x0'));var path=require(_0x9f42('0x1'));var timeout=require(_0x9f42('0x2'));var express=require('express');var router=express[_0x9f42('0x3')]();var fs_extra=require(_0x9f42('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9f42('0x5'));var config=require(_0x9f42('0x6'));var controller=require(_0x9f42('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x9f42('0x8')]);router[_0x9f42('0x9')](_0x9f42('0xa'),auth[_0x9f42('0xb')](),controller['describe']);router['get'](_0x9f42('0xc'),auth['isAuthenticated'](),controller[_0x9f42('0xd')]);router['post']('/',auth[_0x9f42('0xb')](),controller[_0x9f42('0xe')]);router[_0x9f42('0xf')](_0x9f42('0xc'),auth[_0x9f42('0xb')](),controller[_0x9f42('0x10')]);router['delete'](_0x9f42('0xc'),auth['isAuthenticated'](),controller[_0x9f42('0x11')]);module[_0x9f42('0x12')]=router; \ No newline at end of file +var _0xc87e=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','get','isAuthenticated','/describe','describe','/:id','post','create','update','delete','destroy','multer'];(function(_0x3817a9,_0x29e215){var _0x443f30=function(_0x13940b){while(--_0x13940b){_0x3817a9['push'](_0x3817a9['shift']());}};_0x443f30(++_0x29e215);}(_0xc87e,0x17b));var _0xec87=function(_0x126e42,_0x40e7bc){_0x126e42=_0x126e42-0x0;var _0x1fb1d5=_0xc87e[_0x126e42];return _0x1fb1d5;};'use strict';var multer=require(_0xec87('0x0'));var util=require(_0xec87('0x1'));var path=require(_0xec87('0x2'));var timeout=require(_0xec87('0x3'));var express=require(_0xec87('0x4'));var router=express[_0xec87('0x5')]();var fs_extra=require(_0xec87('0x6'));var auth=require(_0xec87('0x7'));var interaction=require(_0xec87('0x8'));var config=require('../../config/environment');var controller=require(_0xec87('0x9'));router[_0xec87('0xa')]('/',auth[_0xec87('0xb')](),controller['index']);router['get'](_0xec87('0xc'),auth[_0xec87('0xb')](),controller[_0xec87('0xd')]);router[_0xec87('0xa')](_0xec87('0xe'),auth[_0xec87('0xb')](),controller['show']);router[_0xec87('0xf')]('/',auth['isAuthenticated'](),controller[_0xec87('0x10')]);router['put'](_0xec87('0xe'),auth[_0xec87('0xb')](),controller[_0xec87('0x11')]);router[_0xec87('0x12')](_0xec87('0xe'),auth[_0xec87('0xb')](),controller[_0xec87('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index e797bb3..d97d44d 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 _0xa41a=['exports','STRING','INTEGER','DATE','called,connect,complete','sequelize'];(function(_0x430aea,_0x44ed78){var _0xdfac3=function(_0x5c3de3){while(--_0x5c3de3){_0x430aea['push'](_0x430aea['shift']());}};_0xdfac3(++_0x44ed78);}(_0xa41a,0x6b));var _0xaa41=function(_0x2cee2d,_0x16050c){_0x2cee2d=_0x2cee2d-0x0;var _0x4c96e8=_0xa41a[_0x2cee2d];return _0x4c96e8;};'use strict';var Sequelize=require(_0xaa41('0x0'));module[_0xaa41('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xaa41('0x2')]},'channelstate':{'type':Sequelize[_0xaa41('0x3')]},'channelstatedesc':{'type':Sequelize[_0xaa41('0x2')]},'calleridnum':{'type':Sequelize[_0xaa41('0x2')]},'calleridname':{'type':Sequelize[_0xaa41('0x2')]},'connectedlinenum':{'type':Sequelize[_0xaa41('0x2')]},'connectedlinename':{'type':Sequelize[_0xaa41('0x2')]},'language':{'type':Sequelize[_0xaa41('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xaa41('0x2')]},'exten':{'type':Sequelize[_0xaa41('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xaa41('0x2')]},'destchannel':{'type':Sequelize[_0xaa41('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xaa41('0x2')]},'destcalleridnum':{'type':Sequelize[_0xaa41('0x2')]},'destcalleridname':{'type':Sequelize[_0xaa41('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xaa41('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xaa41('0x2')]},'destlanguage':{'type':Sequelize[_0xaa41('0x2')]},'destaccountcode':{'type':Sequelize[_0xaa41('0x2')]},'destcontext':{'type':Sequelize[_0xaa41('0x2')]},'destexten':{'type':Sequelize[_0xaa41('0x2')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xaa41('0x2')]},'destlinkedid':{'type':Sequelize[_0xaa41('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xaa41('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xaa41('0x4')]},'lastevent':{'type':Sequelize[_0xaa41('0x2')],'comment':_0xaa41('0x5')},'routeId':{'type':Sequelize[_0xaa41('0x3')]},'duration':{'type':Sequelize[_0xaa41('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xaa41('0x3')]}}; \ No newline at end of file +var _0x9bde=['exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x19694d,_0x414ba4){var _0x1a2ae2=function(_0x25d349){while(--_0x25d349){_0x19694d['push'](_0x19694d['shift']());}};_0x1a2ae2(++_0x414ba4);}(_0x9bde,0xe1));var _0xe9bd=function(_0x274e6f,_0x31ab9f){_0x274e6f=_0x274e6f-0x0;var _0xe83ff=_0x9bde[_0x274e6f];return _0xe83ff;};'use strict';var Sequelize=require('sequelize');module[_0xe9bd('0x0')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe9bd('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xe9bd('0x1')]},'calleridnum':{'type':Sequelize[_0xe9bd('0x1')]},'calleridname':{'type':Sequelize[_0xe9bd('0x1')]},'connectedlinenum':{'type':Sequelize[_0xe9bd('0x1')]},'connectedlinename':{'type':Sequelize[_0xe9bd('0x1')]},'language':{'type':Sequelize[_0xe9bd('0x1')]},'accountcode':{'type':Sequelize[_0xe9bd('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xe9bd('0x1')]},'priority':{'type':Sequelize[_0xe9bd('0x2')]},'uniqueid':{'type':Sequelize[_0xe9bd('0x1')]},'linkedid':{'type':Sequelize[_0xe9bd('0x1')]},'destchannel':{'type':Sequelize[_0xe9bd('0x1')]},'destchannelstate':{'type':Sequelize[_0xe9bd('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xe9bd('0x1')]},'destcalleridnum':{'type':Sequelize[_0xe9bd('0x1')]},'destcalleridname':{'type':Sequelize[_0xe9bd('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xe9bd('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xe9bd('0x1')]},'destcontext':{'type':Sequelize[_0xe9bd('0x1')]},'destexten':{'type':Sequelize[_0xe9bd('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xe9bd('0x1')]},'destlinkedid':{'type':Sequelize[_0xe9bd('0x1')]},'dialstring':{'type':Sequelize[_0xe9bd('0x1')]},'dialstatus':{'type':Sequelize[_0xe9bd('0x1')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xe9bd('0x3')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xe9bd('0x1')],'comment':_0xe9bd('0x4')},'routeId':{'type':Sequelize[_0xe9bd('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xe9bd('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index cf3e962..2a277ef 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 _0xc928=['catch','show','params','includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','VoiceDialReport','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','include','findAll','rows'];(function(_0x15ed84,_0x589521){var _0x426d2b=function(_0x5d294a){while(--_0x5d294a){_0x15ed84['push'](_0x15ed84['shift']());}};_0x426d2b(++_0x589521);}(_0xc928,0x9a));var _0x8c92=function(_0x4ba10e,_0x4eddca){_0x4ba10e=_0x4ba10e-0x0;var _0x3cecd8=_0xc928[_0x4ba10e];return _0x3cecd8;};'use strict';var emlformat=require(_0x8c92('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8c92('0x1'));var jsonpatch=require(_0x8c92('0x2'));var rp=require(_0x8c92('0x3'));var moment=require(_0x8c92('0x4'));var BPromise=require(_0x8c92('0x5'));var Mustache=require(_0x8c92('0x6'));var util=require(_0x8c92('0x7'));var path=require(_0x8c92('0x8'));var sox=require('sox');var csv=require(_0x8c92('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8c92('0xa'));var _=require(_0x8c92('0xb'));var squel=require(_0x8c92('0xc'));var crypto=require(_0x8c92('0xd'));var jsforce=require(_0x8c92('0xe'));var deskjs=require(_0x8c92('0xf'));var toCsv=require(_0x8c92('0x9'));var querystring=require(_0x8c92('0x10'));var Papa=require(_0x8c92('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8c92('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8c92('0x13'));var logger=require(_0x8c92('0x14'))(_0x8c92('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8c92('0x16'));var db=require(_0x8c92('0x17'))['db'];function respondWithStatusCode(_0x136601,_0x182a44){_0x182a44=_0x182a44||0xcc;return function(_0x4202f8){if(_0x4202f8){return _0x136601[_0x8c92('0x18')](_0x182a44);}return _0x136601[_0x8c92('0x19')](_0x182a44)[_0x8c92('0x1a')]();};}function respondWithResult(_0x4564fb,_0x12fa31){_0x12fa31=_0x12fa31||0xc8;return function(_0x1d423e){if(_0x1d423e){return _0x4564fb['status'](_0x12fa31)[_0x8c92('0x1b')](_0x1d423e);}};}function respondWithFilteredResult(_0x5908d6,_0x5ab1e0){return function(_0x3251ca){if(_0x3251ca){var _0x251140=typeof _0x5ab1e0[_0x8c92('0x1c')]===_0x8c92('0x1d')&&typeof _0x5ab1e0['limit']===_0x8c92('0x1d');var _0x28d639=_0x3251ca[_0x8c92('0x1e')];var _0x46e2fe=_0x251140?0x0:_0x5ab1e0[_0x8c92('0x1c')];var _0x64384d=_0x251140?_0x3251ca[_0x8c92('0x1e')]:_0x5ab1e0[_0x8c92('0x1c')]+_0x5ab1e0[_0x8c92('0x1f')];var _0xac3ba6;if(_0x64384d>=_0x28d639){_0x64384d=_0x28d639;_0xac3ba6=0xc8;}else{_0xac3ba6=0xce;}_0x5908d6[_0x8c92('0x19')](_0xac3ba6);return _0x5908d6[_0x8c92('0x20')](_0x8c92('0x21'),_0x46e2fe+'-'+_0x64384d+'/'+_0x28d639)[_0x8c92('0x1b')](_0x3251ca);}return null;};}function patchUpdates(_0x333748){return function(_0x3f4b6b){try{jsonpatch[_0x8c92('0x22')](_0x3f4b6b,_0x333748,!![]);}catch(_0x2ed485){return BPromise['reject'](_0x2ed485);}return _0x3f4b6b[_0x8c92('0x23')]();};}function saveUpdates(_0x595666,_0x1ae5ef){return function(_0x382953){if(_0x382953){return _0x382953[_0x8c92('0x24')](_0x595666)['then'](function(_0x205b75){return _0x205b75;});}return null;};}function removeEntity(_0x41640d,_0x4c0d70){return function(_0x1466a9){if(_0x1466a9){return _0x1466a9['destroy']()[_0x8c92('0x25')](function(){_0x41640d[_0x8c92('0x19')](0xcc)[_0x8c92('0x1a')]();});}};}function handleEntityNotFound(_0x3a5c0b,_0x200597){return function(_0x2c240b){if(!_0x2c240b){_0x3a5c0b[_0x8c92('0x18')](0x194);}return _0x2c240b;};}function handleError(_0x4e4498,_0x1cfdde){_0x1cfdde=_0x1cfdde||0x1f4;return function(_0x52603c){logger[_0x8c92('0x26')](_0x52603c[_0x8c92('0x27')]);if(_0x52603c[_0x8c92('0x28')]){delete _0x52603c['name'];}_0x4e4498[_0x8c92('0x19')](_0x1cfdde)[_0x8c92('0x29')](_0x52603c);};}exports[_0x8c92('0x2a')]=function(_0x3ca98d,_0x476afd){var _0x36a434={},_0x3547b6={},_0x23d68d={'count':0x0,'rows':[]};var _0x312f2e=_[_0x8c92('0x2b')](db[_0x8c92('0x2c')]['rawAttributes'],function(_0x3412c2){return{'name':_0x3412c2['fieldName'],'type':_0x3412c2[_0x8c92('0x2d')]['key']};});_0x3547b6[_0x8c92('0x2e')]=_['map'](_0x312f2e,'name');_0x3547b6[_0x8c92('0x2f')]=_[_0x8c92('0x30')](_0x3ca98d[_0x8c92('0x2f')]);_0x3547b6['filters']=_['intersection'](_0x3547b6[_0x8c92('0x2e')],_0x3547b6[_0x8c92('0x2f')]);_0x36a434[_0x8c92('0x31')]=_[_0x8c92('0x32')](_0x3547b6[_0x8c92('0x2e')],qs['fields'](_0x3ca98d[_0x8c92('0x2f')][_0x8c92('0x33')]));_0x36a434[_0x8c92('0x31')]=_0x36a434[_0x8c92('0x31')][_0x8c92('0x34')]?_0x36a434['attributes']:_0x3547b6[_0x8c92('0x2e')];if(!_0x3ca98d[_0x8c92('0x2f')][_0x8c92('0x35')](_0x8c92('0x36'))){_0x36a434[_0x8c92('0x1f')]=qs[_0x8c92('0x1f')](_0x3ca98d['query']['limit']);_0x36a434[_0x8c92('0x1c')]=qs['offset'](_0x3ca98d[_0x8c92('0x2f')][_0x8c92('0x1c')]);}_0x36a434['order']=qs[_0x8c92('0x37')](_0x3ca98d[_0x8c92('0x2f')]['sort']);_0x36a434[_0x8c92('0x38')]=qs[_0x8c92('0x39')](_[_0x8c92('0x3a')](_0x3ca98d[_0x8c92('0x2f')],_0x3547b6['filters']),_0x312f2e);if(_0x3ca98d[_0x8c92('0x2f')][_0x8c92('0x3b')]){_0x36a434[_0x8c92('0x38')]=_[_0x8c92('0x3c')](_0x36a434[_0x8c92('0x38')],{'$or':_[_0x8c92('0x2b')](_0x312f2e,function(_0x13fb71){if(_0x13fb71[_0x8c92('0x2d')]!=='VIRTUAL'){var _0x3e185b={};_0x3e185b[_0x13fb71[_0x8c92('0x28')]]={'$like':'%'+_0x3ca98d[_0x8c92('0x2f')][_0x8c92('0x3b')]+'%'};return _0x3e185b;}})});}_0x36a434=_['merge']({},_0x36a434,_0x3ca98d[_0x8c92('0x3d')]);var _0x1c244f={'where':_0x36a434[_0x8c92('0x38')]};return db[_0x8c92('0x2c')]['count'](_0x1c244f)['then'](function(_0x5b0670){_0x23d68d[_0x8c92('0x1e')]=_0x5b0670;if(_0x3ca98d['query']['includeAll']){_0x36a434[_0x8c92('0x3e')]=[{'all':!![]}];}return db[_0x8c92('0x2c')][_0x8c92('0x3f')](_0x36a434);})[_0x8c92('0x25')](function(_0x3789db){_0x23d68d[_0x8c92('0x40')]=_0x3789db;return _0x23d68d;})['then'](respondWithFilteredResult(_0x476afd,_0x36a434))[_0x8c92('0x41')](handleError(_0x476afd,null));};exports[_0x8c92('0x42')]=function(_0x5971aa,_0x3ed637){var _0xbf1b7e={'raw':!![],'where':{'id':_0x5971aa[_0x8c92('0x43')]['id']}},_0x39b196={};_0x39b196[_0x8c92('0x2e')]=_[_0x8c92('0x30')](db['VoiceDialReport']['rawAttributes']);_0x39b196[_0x8c92('0x2f')]=_[_0x8c92('0x30')](_0x5971aa[_0x8c92('0x2f')]);_0x39b196[_0x8c92('0x39')]=_[_0x8c92('0x32')](_0x39b196[_0x8c92('0x2e')],_0x39b196[_0x8c92('0x2f')]);_0xbf1b7e[_0x8c92('0x31')]=_[_0x8c92('0x32')](_0x39b196['model'],qs[_0x8c92('0x33')](_0x5971aa['query'][_0x8c92('0x33')]));_0xbf1b7e['attributes']=_0xbf1b7e[_0x8c92('0x31')][_0x8c92('0x34')]?_0xbf1b7e[_0x8c92('0x31')]:_0x39b196[_0x8c92('0x2e')];if(_0x5971aa['query'][_0x8c92('0x44')]){_0xbf1b7e['include']=[{'all':!![]}];}_0xbf1b7e=_[_0x8c92('0x3c')]({},_0xbf1b7e,_0x5971aa['options']);return db[_0x8c92('0x2c')][_0x8c92('0x45')](_0xbf1b7e)[_0x8c92('0x25')](handleEntityNotFound(_0x3ed637,null))[_0x8c92('0x25')](respondWithResult(_0x3ed637,null))[_0x8c92('0x41')](handleError(_0x3ed637,null));};exports[_0x8c92('0x46')]=function(_0x3e8898,_0x431108){return db[_0x8c92('0x2c')][_0x8c92('0x46')](_0x3e8898[_0x8c92('0x47')],{})[_0x8c92('0x25')](respondWithResult(_0x431108,0xc9))[_0x8c92('0x41')](handleError(_0x431108,null));};exports[_0x8c92('0x24')]=function(_0x18325e,_0x5d6506){if(_0x18325e[_0x8c92('0x47')]['id']){delete _0x18325e[_0x8c92('0x47')]['id'];}return db[_0x8c92('0x2c')][_0x8c92('0x45')]({'where':{'id':_0x18325e[_0x8c92('0x43')]['id']}})[_0x8c92('0x25')](handleEntityNotFound(_0x5d6506,null))[_0x8c92('0x25')](saveUpdates(_0x18325e[_0x8c92('0x47')],null))[_0x8c92('0x25')](respondWithResult(_0x5d6506,null))[_0x8c92('0x41')](handleError(_0x5d6506,null));};exports['destroy']=function(_0x5fb1f1,_0x6016dd){return db[_0x8c92('0x2c')][_0x8c92('0x45')]({'where':{'id':_0x5fb1f1['params']['id']}})['then'](handleEntityNotFound(_0x6016dd,null))['then'](removeEntity(_0x6016dd,null))[_0x8c92('0x41')](handleError(_0x6016dd,null));};exports[_0x8c92('0x48')]=function(_0x1a8507,_0x2ad8e1){return db['VoiceDialReport'][_0x8c92('0x48')]()[_0x8c92('0x25')](respondWithResult(_0x2ad8e1,null))[_0x8c92('0x41')](handleError(_0x2ad8e1,null));}; \ No newline at end of file +var _0xe5da=['desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','error','stack','name','index','VoiceDialReport','rawAttributes','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','includeAll','include','findAll','catch','show','params','keys','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','moment','bluebird','util','path','fs-extra','lodash','squel','crypto','jsforce'];(function(_0xb82328,_0x3aa9c8){var _0x4d9097=function(_0x583250){while(--_0x583250){_0xb82328['push'](_0xb82328['shift']());}};_0x4d9097(++_0x3aa9c8);}(_0xe5da,0x19e));var _0xae5d=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xe5da[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0xae5d('0x0'));var rimraf=require(_0xae5d('0x1'));var zipdir=require(_0xae5d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xae5d('0x3'));var BPromise=require(_0xae5d('0x4'));var Mustache=require('mustache');var util=require(_0xae5d('0x5'));var path=require(_0xae5d('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xae5d('0x7'));var _=require(_0xae5d('0x8'));var squel=require(_0xae5d('0x9'));var crypto=require(_0xae5d('0xa'));var jsforce=require(_0xae5d('0xb'));var deskjs=require(_0xae5d('0xc'));var toCsv=require(_0xae5d('0xd'));var querystring=require(_0xae5d('0xe'));var Papa=require(_0xae5d('0xf'));var Redis=require(_0xae5d('0x10'));var authService=require(_0xae5d('0x11'));var qs=require(_0xae5d('0x12'));var as=require(_0xae5d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xae5d('0x14'))(_0xae5d('0x15'));var utils=require(_0xae5d('0x16'));var config=require(_0xae5d('0x17'));var licenseUtil=require(_0xae5d('0x18'));var db=require(_0xae5d('0x19'))['db'];function respondWithStatusCode(_0x3a003b,_0x273aa9){_0x273aa9=_0x273aa9||0xcc;return function(_0x342f23){if(_0x342f23){return _0x3a003b[_0xae5d('0x1a')](_0x273aa9);}return _0x3a003b[_0xae5d('0x1b')](_0x273aa9)['end']();};}function respondWithResult(_0x24c64e,_0x3008fd){_0x3008fd=_0x3008fd||0xc8;return function(_0x5a0af1){if(_0x5a0af1){return _0x24c64e[_0xae5d('0x1b')](_0x3008fd)[_0xae5d('0x1c')](_0x5a0af1);}};}function respondWithFilteredResult(_0x29563d,_0x43be70){return function(_0x99d4c6){if(_0x99d4c6){var _0x4a701e=typeof _0x43be70[_0xae5d('0x1d')]===_0xae5d('0x1e')&&typeof _0x43be70[_0xae5d('0x1f')]===_0xae5d('0x1e');var _0x3d59d2=_0x99d4c6[_0xae5d('0x20')];var _0x914cda=_0x4a701e?0x0:_0x43be70['offset'];var _0x1d79ab=_0x4a701e?_0x99d4c6['count']:_0x43be70[_0xae5d('0x1d')]+_0x43be70['limit'];var _0x562f75;if(_0x1d79ab>=_0x3d59d2){_0x1d79ab=_0x3d59d2;_0x562f75=0xc8;}else{_0x562f75=0xce;}_0x29563d[_0xae5d('0x1b')](_0x562f75);return _0x29563d[_0xae5d('0x21')](_0xae5d('0x22'),_0x914cda+'-'+_0x1d79ab+'/'+_0x3d59d2)['json'](_0x99d4c6);}return null;};}function patchUpdates(_0x34bc5d){return function(_0x320f0f){try{jsonpatch['apply'](_0x320f0f,_0x34bc5d,!![]);}catch(_0x3acf1a){return BPromise['reject'](_0x3acf1a);}return _0x320f0f[_0xae5d('0x23')]();};}function saveUpdates(_0x1f7f7c,_0x3a27b2){return function(_0x52ed93){if(_0x52ed93){return _0x52ed93[_0xae5d('0x24')](_0x1f7f7c)[_0xae5d('0x25')](function(_0x482d9f){return _0x482d9f;});}return null;};}function removeEntity(_0x3bdfa5,_0x57f4b2){return function(_0x4811e5){if(_0x4811e5){return _0x4811e5['destroy']()['then'](function(){_0x3bdfa5[_0xae5d('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b1f83,_0x5180ed){return function(_0x5ebd98){if(!_0x5ebd98){_0x4b1f83[_0xae5d('0x1a')](0x194);}return _0x5ebd98;};}function handleError(_0x514c02,_0x8b14c1){_0x8b14c1=_0x8b14c1||0x1f4;return function(_0x335962){logger[_0xae5d('0x26')](_0x335962[_0xae5d('0x27')]);if(_0x335962[_0xae5d('0x28')]){delete _0x335962[_0xae5d('0x28')];}_0x514c02[_0xae5d('0x1b')](_0x8b14c1)['send'](_0x335962);};}exports[_0xae5d('0x29')]=function(_0x5c537d,_0x5cefed){var _0x5b781e={},_0x437c68={},_0x29a87a={'count':0x0,'rows':[]};var _0x39eb4a=_['map'](db[_0xae5d('0x2a')][_0xae5d('0x2b')],function(_0x40c193){return{'name':_0x40c193['fieldName'],'type':_0x40c193[_0xae5d('0x2c')]['key']};});_0x437c68['model']=_[_0xae5d('0x2d')](_0x39eb4a,'name');_0x437c68[_0xae5d('0x2e')]=_['keys'](_0x5c537d[_0xae5d('0x2e')]);_0x437c68[_0xae5d('0x2f')]=_[_0xae5d('0x30')](_0x437c68[_0xae5d('0x31')],_0x437c68[_0xae5d('0x2e')]);_0x5b781e[_0xae5d('0x32')]=_['intersection'](_0x437c68[_0xae5d('0x31')],qs[_0xae5d('0x33')](_0x5c537d['query'][_0xae5d('0x33')]));_0x5b781e[_0xae5d('0x32')]=_0x5b781e[_0xae5d('0x32')][_0xae5d('0x34')]?_0x5b781e[_0xae5d('0x32')]:_0x437c68[_0xae5d('0x31')];if(!_0x5c537d[_0xae5d('0x2e')][_0xae5d('0x35')]('nolimit')){_0x5b781e[_0xae5d('0x1f')]=qs['limit'](_0x5c537d['query'][_0xae5d('0x1f')]);_0x5b781e[_0xae5d('0x1d')]=qs['offset'](_0x5c537d['query'][_0xae5d('0x1d')]);}_0x5b781e['order']=qs['sort'](_0x5c537d[_0xae5d('0x2e')][_0xae5d('0x36')]);_0x5b781e[_0xae5d('0x37')]=qs[_0xae5d('0x2f')](_[_0xae5d('0x38')](_0x5c537d[_0xae5d('0x2e')],_0x437c68[_0xae5d('0x2f')]),_0x39eb4a);if(_0x5c537d[_0xae5d('0x2e')][_0xae5d('0x39')]){_0x5b781e[_0xae5d('0x37')]=_['merge'](_0x5b781e['where'],{'$or':_[_0xae5d('0x2d')](_0x39eb4a,function(_0x27b062){if(_0x27b062[_0xae5d('0x2c')]!=='VIRTUAL'){var _0x5eb419={};_0x5eb419[_0x27b062[_0xae5d('0x28')]]={'$like':'%'+_0x5c537d['query'][_0xae5d('0x39')]+'%'};return _0x5eb419;}})});}_0x5b781e=_[_0xae5d('0x3a')]({},_0x5b781e,_0x5c537d['options']);var _0xcc3ce4={'where':_0x5b781e[_0xae5d('0x37')]};return db[_0xae5d('0x2a')][_0xae5d('0x20')](_0xcc3ce4)[_0xae5d('0x25')](function(_0x560806){_0x29a87a['count']=_0x560806;if(_0x5c537d['query'][_0xae5d('0x3b')]){_0x5b781e[_0xae5d('0x3c')]=[{'all':!![]}];}return db['VoiceDialReport'][_0xae5d('0x3d')](_0x5b781e);})[_0xae5d('0x25')](function(_0x128127){_0x29a87a['rows']=_0x128127;return _0x29a87a;})[_0xae5d('0x25')](respondWithFilteredResult(_0x5cefed,_0x5b781e))[_0xae5d('0x3e')](handleError(_0x5cefed,null));};exports[_0xae5d('0x3f')]=function(_0x1f4224,_0xeb9da8){var _0x3035a5={'raw':!![],'where':{'id':_0x1f4224[_0xae5d('0x40')]['id']}},_0x1bd516={};_0x1bd516[_0xae5d('0x31')]=_[_0xae5d('0x41')](db[_0xae5d('0x2a')][_0xae5d('0x2b')]);_0x1bd516[_0xae5d('0x2e')]=_['keys'](_0x1f4224[_0xae5d('0x2e')]);_0x1bd516[_0xae5d('0x2f')]=_['intersection'](_0x1bd516[_0xae5d('0x31')],_0x1bd516[_0xae5d('0x2e')]);_0x3035a5[_0xae5d('0x32')]=_['intersection'](_0x1bd516[_0xae5d('0x31')],qs[_0xae5d('0x33')](_0x1f4224[_0xae5d('0x2e')][_0xae5d('0x33')]));_0x3035a5[_0xae5d('0x32')]=_0x3035a5[_0xae5d('0x32')][_0xae5d('0x34')]?_0x3035a5[_0xae5d('0x32')]:_0x1bd516[_0xae5d('0x31')];if(_0x1f4224[_0xae5d('0x2e')][_0xae5d('0x3b')]){_0x3035a5['include']=[{'all':!![]}];}_0x3035a5=_['merge']({},_0x3035a5,_0x1f4224['options']);return db[_0xae5d('0x2a')][_0xae5d('0x42')](_0x3035a5)[_0xae5d('0x25')](handleEntityNotFound(_0xeb9da8,null))[_0xae5d('0x25')](respondWithResult(_0xeb9da8,null))[_0xae5d('0x3e')](handleError(_0xeb9da8,null));};exports[_0xae5d('0x43')]=function(_0x587103,_0x2de871){return db[_0xae5d('0x2a')]['create'](_0x587103[_0xae5d('0x44')],{})['then'](respondWithResult(_0x2de871,0xc9))['catch'](handleError(_0x2de871,null));};exports[_0xae5d('0x24')]=function(_0x177953,_0x2c35b2){if(_0x177953[_0xae5d('0x44')]['id']){delete _0x177953[_0xae5d('0x44')]['id'];}return db[_0xae5d('0x2a')]['find']({'where':{'id':_0x177953[_0xae5d('0x40')]['id']}})['then'](handleEntityNotFound(_0x2c35b2,null))[_0xae5d('0x25')](saveUpdates(_0x177953['body'],null))['then'](respondWithResult(_0x2c35b2,null))[_0xae5d('0x3e')](handleError(_0x2c35b2,null));};exports[_0xae5d('0x45')]=function(_0x2b9bef,_0x243fb1){return db[_0xae5d('0x2a')][_0xae5d('0x42')]({'where':{'id':_0x2b9bef['params']['id']}})[_0xae5d('0x25')](handleEntityNotFound(_0x243fb1,null))[_0xae5d('0x25')](removeEntity(_0x243fb1,null))[_0xae5d('0x3e')](handleError(_0x243fb1,null));};exports[_0xae5d('0x46')]=function(_0x272723,_0x10a338){return db[_0xae5d('0x2a')]['describe']()[_0xae5d('0x25')](respondWithResult(_0x10a338,null))[_0xae5d('0x3e')](handleError(_0x10a338,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 6bb1389..c796c03 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 _0xda33=['moment','bluebird','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','lodash','util','../../config/logger'];(function(_0x248170,_0x2caf89){var _0x401039=function(_0xf55a0a){while(--_0xf55a0a){_0x248170['push'](_0x248170['shift']());}};_0x401039(++_0x2caf89);}(_0xda33,0x1b7));var _0x3da3=function(_0x515b9d,_0x353d5c){_0x515b9d=_0x515b9d-0x0;var _0x59c8a3=_0xda33[_0x515b9d];return _0x59c8a3;};'use strict';var _=require(_0x3da3('0x0'));var util=require(_0x3da3('0x1'));var logger=require(_0x3da3('0x2'))('api');var moment=require(_0x3da3('0x3'));var BPromise=require(_0x3da3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3da3('0x5'));var rimraf=require(_0x3da3('0x6'));var config=require(_0x3da3('0x7'));var attributes=require(_0x3da3('0x8'));module[_0x3da3('0x9')]=function(_0x2d2317,_0x5633bf){return _0x2d2317[_0x3da3('0xa')](_0x3da3('0xb'),attributes,{'tableName':_0x3da3('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe080=['moment','bluebird','request-promise','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','report_dial','lodash','util','../../config/logger'];(function(_0xa552e7,_0x2e28f5){var _0x2554e1=function(_0x742dc4){while(--_0x742dc4){_0xa552e7['push'](_0xa552e7['shift']());}};_0x2554e1(++_0x2e28f5);}(_0xe080,0x141));var _0x0e08=function(_0x32a4f6,_0xcac95b){_0x32a4f6=_0x32a4f6-0x0;var _0x9c8c7=_0xe080[_0x32a4f6];return _0x9c8c7;};'use strict';var _=require(_0x0e08('0x0'));var util=require(_0x0e08('0x1'));var logger=require(_0x0e08('0x2'))('api');var moment=require(_0x0e08('0x3'));var BPromise=require(_0x0e08('0x4'));var rp=require(_0x0e08('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0e08('0x6'));var config=require(_0x0e08('0x7'));var attributes=require(_0x0e08('0x8'));module[_0x0e08('0x9')]=function(_0x1c7948,_0x3d506b){return _0x1c7948[_0x0e08('0xa')]('VoiceDialReport',attributes,{'tableName':_0x0e08('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index df79f47..43769ab 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 _0x8099=['error','VoiceDialReport,\x20%s,\x20%s','message','CreateVoiceDialReport','VoiceDialReport','create','body','options','catch','update','attributes','limit','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3e49fe,_0x552dba){var _0x150873=function(_0x88c188){while(--_0x88c188){_0x3e49fe['push'](_0x3e49fe['shift']());}};_0x150873(++_0x552dba);}(_0x8099,0xb4));var _0x9809=function(_0x2b5653,_0x26521f){_0x2b5653=_0x2b5653-0x0;var _0x447b9d=_0x8099[_0x2b5653];return _0x447b9d;};'use strict';var _=require('lodash');var util=require(_0x9809('0x0'));var moment=require(_0x9809('0x1'));var BPromise=require('bluebird');var rs=require(_0x9809('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9809('0x3'))['db'];var utils=require(_0x9809('0x4'));var logger=require(_0x9809('0x5'))(_0x9809('0x6'));var config=require(_0x9809('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9809('0x8')][_0x9809('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39e728,_0x4702af,_0x6602e9){return new BPromise(function(_0x373f2c,_0x91985b){return client['request'](_0x39e728,_0x6602e9)[_0x9809('0xa')](function(_0x112c4d){logger[_0x9809('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x4702af,_0x9809('0xc'));logger[_0x9809('0xd')](_0x9809('0xe'),_0x4702af,_0x9809('0xc'),JSON[_0x9809('0xf')](_0x112c4d));if(_0x112c4d[_0x9809('0x10')]){if(_0x112c4d[_0x9809('0x10')]['code']===0x1f4){logger[_0x9809('0x10')](_0x9809('0x11'),_0x4702af,_0x112c4d[_0x9809('0x10')][_0x9809('0x12')]);return _0x91985b(_0x112c4d[_0x9809('0x10')]['message']);}logger[_0x9809('0x10')](_0x9809('0x11'),_0x4702af,_0x112c4d[_0x9809('0x10')][_0x9809('0x12')]);return _0x373f2c(_0x112c4d[_0x9809('0x10')][_0x9809('0x12')]);}else{logger[_0x9809('0xb')](_0x9809('0x11'),_0x4702af,_0x9809('0xc'));_0x373f2c(_0x112c4d['result'][_0x9809('0x12')]);}})['catch'](function(_0x8102e2){logger[_0x9809('0x10')](_0x9809('0x11'),_0x4702af,_0x8102e2);_0x91985b(_0x8102e2);});});}exports[_0x9809('0x13')]=function(_0x222f86){var _0x4b3720=this;return new Promise(function(_0x1fb92e,_0x4aa24f){return db[_0x9809('0x14')][_0x9809('0x15')](_0x222f86[_0x9809('0x16')],{'raw':_0x222f86['options']?_0x222f86[_0x9809('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x9809('0xa')](function(_0x3b5761){logger['info'](_0x9809('0x13'),_0x222f86);logger[_0x9809('0xd')](_0x9809('0x13'),_0x222f86,JSON[_0x9809('0xf')](_0x3b5761));_0x1fb92e(_0x3b5761);})[_0x9809('0x18')](function(_0x412a10){logger[_0x9809('0x10')](_0x9809('0x13'),_0x412a10['message'],_0x222f86);_0x4aa24f(_0x4b3720['error'](0x1f4,_0x412a10[_0x9809('0x12')]));});});};exports['UpdateVoiceDialReport']=function(_0x41958){var _0x4eb9fa=this;return new Promise(function(_0x301d58,_0x56b286){return db[_0x9809('0x14')][_0x9809('0x19')](_0x41958[_0x9809('0x16')],{'raw':_0x41958[_0x9809('0x17')]?_0x41958['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41958[_0x9809('0x17')]?_0x41958[_0x9809('0x17')]['where']||null:null,'attributes':_0x41958[_0x9809('0x17')]?_0x41958[_0x9809('0x17')][_0x9809('0x1a')]||null:null,'limit':_0x41958[_0x9809('0x17')]?_0x41958[_0x9809('0x17')][_0x9809('0x1b')]||null:null})[_0x9809('0xa')](function(_0x3e740c){logger['info']('UpdateVoiceDialReport',_0x41958);logger[_0x9809('0xd')]('UpdateVoiceDialReport',_0x41958,JSON[_0x9809('0xf')](_0x3e740c));_0x301d58(_0x3e740c);})[_0x9809('0x18')](function(_0x194305){logger[_0x9809('0x10')]('UpdateVoiceDialReport',_0x194305[_0x9809('0x12')],_0x41958);_0x56b286(_0x4eb9fa[_0x9809('0x10')](0x1f4,_0x194305[_0x9809('0x12')]));});});}; \ No newline at end of file +var _0xcb6f=['../../config/environment','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','result','catch','body','options','CreateVoiceDialReport','UpdateVoiceDialReport','raw','where','attributes','limit','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x392dc2,_0x47c3f3){var _0x14150f=function(_0x9f305a){while(--_0x9f305a){_0x392dc2['push'](_0x392dc2['shift']());}};_0x14150f(++_0x47c3f3);}(_0xcb6f,0x18b));var _0xfcb6=function(_0xb9f9d8,_0x54d1d6){_0xb9f9d8=_0xb9f9d8-0x0;var _0x2e8701=_0xcb6f[_0xb9f9d8];return _0x2e8701;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfcb6('0x0'));var BPromise=require(_0xfcb6('0x1'));var rs=require(_0xfcb6('0x2'));var fs=require('fs');var Redis=require(_0xfcb6('0x3'));var db=require(_0xfcb6('0x4'))['db'];var utils=require(_0xfcb6('0x5'));var logger=require(_0xfcb6('0x6'))(_0xfcb6('0x7'));var config=require(_0xfcb6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xfcb6('0x9')][_0xfcb6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x125fbc,_0x284b9e,_0x57925c){return new BPromise(function(_0x17fa9e,_0x1c3fdb){return client[_0xfcb6('0xb')](_0x125fbc,_0x57925c)[_0xfcb6('0xc')](function(_0x518e94){logger[_0xfcb6('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x284b9e,_0xfcb6('0xe'));logger[_0xfcb6('0xf')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x284b9e,_0xfcb6('0xe'),JSON[_0xfcb6('0x10')](_0x518e94));if(_0x518e94[_0xfcb6('0x11')]){if(_0x518e94[_0xfcb6('0x11')][_0xfcb6('0x12')]===0x1f4){logger[_0xfcb6('0x11')](_0xfcb6('0x13'),_0x284b9e,_0x518e94['error'][_0xfcb6('0x14')]);return _0x1c3fdb(_0x518e94[_0xfcb6('0x11')][_0xfcb6('0x14')]);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x284b9e,_0x518e94[_0xfcb6('0x11')][_0xfcb6('0x14')]);return _0x17fa9e(_0x518e94[_0xfcb6('0x11')][_0xfcb6('0x14')]);}else{logger[_0xfcb6('0xd')](_0xfcb6('0x13'),_0x284b9e,'request\x20sent');_0x17fa9e(_0x518e94[_0xfcb6('0x15')][_0xfcb6('0x14')]);}})[_0xfcb6('0x16')](function(_0x40b64d){logger['error'](_0xfcb6('0x13'),_0x284b9e,_0x40b64d);_0x1c3fdb(_0x40b64d);});});}exports['CreateVoiceDialReport']=function(_0x3996b1){var _0x5557cc=this;return new Promise(function(_0x40a054,_0x4e93ec){return db['VoiceDialReport']['create'](_0x3996b1[_0xfcb6('0x17')],{'raw':_0x3996b1[_0xfcb6('0x18')]?_0x3996b1[_0xfcb6('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5081c3){logger[_0xfcb6('0xd')](_0xfcb6('0x19'),_0x3996b1);logger[_0xfcb6('0xf')](_0xfcb6('0x19'),_0x3996b1,JSON[_0xfcb6('0x10')](_0x5081c3));_0x40a054(_0x5081c3);})[_0xfcb6('0x16')](function(_0x43c90d){logger[_0xfcb6('0x11')](_0xfcb6('0x19'),_0x43c90d[_0xfcb6('0x14')],_0x3996b1);_0x4e93ec(_0x5557cc[_0xfcb6('0x11')](0x1f4,_0x43c90d[_0xfcb6('0x14')]));});});};exports[_0xfcb6('0x1a')]=function(_0x46b62d){var _0x21cad9=this;return new Promise(function(_0x278a34,_0x545b9a){return db['VoiceDialReport']['update'](_0x46b62d['body'],{'raw':_0x46b62d['options']?_0x46b62d['options'][_0xfcb6('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46b62d[_0xfcb6('0x18')]?_0x46b62d['options'][_0xfcb6('0x1c')]||null:null,'attributes':_0x46b62d[_0xfcb6('0x18')]?_0x46b62d[_0xfcb6('0x18')][_0xfcb6('0x1d')]||null:null,'limit':_0x46b62d[_0xfcb6('0x18')]?_0x46b62d['options'][_0xfcb6('0x1e')]||null:null})[_0xfcb6('0xc')](function(_0x5a54cc){logger[_0xfcb6('0xd')](_0xfcb6('0x1a'),_0x46b62d);logger[_0xfcb6('0xf')](_0xfcb6('0x1a'),_0x46b62d,JSON['stringify'](_0x5a54cc));_0x278a34(_0x5a54cc);})[_0xfcb6('0x16')](function(_0x54530d){logger['error'](_0xfcb6('0x1a'),_0x54530d[_0xfcb6('0x14')],_0x46b62d);_0x545b9a(_0x21cad9[_0xfcb6('0x11')](0x1f4,_0x54530d[_0xfcb6('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index da43a9a..d215882 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 _0xc091=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','/:id','post','/:id/applications','addApplications','update','delete','exports','multer'];(function(_0x44e4ac,_0x1717d0){var _0x1ff571=function(_0x109514){while(--_0x109514){_0x44e4ac['push'](_0x44e4ac['shift']());}};_0x1ff571(++_0x1717d0);}(_0xc091,0x17b));var _0x1c09=function(_0x4861dd,_0x4bcab8){_0x4861dd=_0x4861dd-0x0;var _0x4ae1dd=_0xc091[_0x4861dd];return _0x4ae1dd;};'use strict';var multer=require(_0x1c09('0x0'));var util=require(_0x1c09('0x1'));var path=require(_0x1c09('0x2'));var timeout=require(_0x1c09('0x3'));var express=require('express');var router=express[_0x1c09('0x4')]();var fs_extra=require(_0x1c09('0x5'));var auth=require(_0x1c09('0x6'));var interaction=require(_0x1c09('0x7'));var config=require(_0x1c09('0x8'));var controller=require(_0x1c09('0x9'));router[_0x1c09('0xa')]('/',auth[_0x1c09('0xb')](),controller['index']);router[_0x1c09('0xa')](_0x1c09('0xc'),auth[_0x1c09('0xb')](),controller['show']);router[_0x1c09('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1c09('0xd')](_0x1c09('0xe'),auth['isAuthenticated'](),controller[_0x1c09('0xf')]);router['put'](_0x1c09('0xc'),auth[_0x1c09('0xb')](),controller[_0x1c09('0x10')]);router[_0x1c09('0x11')]('/:id',auth[_0x1c09('0xb')](),controller['destroy']);module[_0x1c09('0x12')]=router; \ No newline at end of file +var _0x6e3b=['./voiceExtension.controller','isAuthenticated','index','/:id','show','post','/:id/applications','addApplications','put','update','delete','exports','multer','util','path','express','fs-extra','../../config/environment'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x6e3b,0x108));var _0xb6e3=function(_0x1fdbda,_0x249d10){_0x1fdbda=_0x1fdbda-0x0;var _0x3c4c0d=_0x6e3b[_0x1fdbda];return _0x3c4c0d;};'use strict';var multer=require(_0xb6e3('0x0'));var util=require(_0xb6e3('0x1'));var path=require(_0xb6e3('0x2'));var timeout=require('connect-timeout');var express=require(_0xb6e3('0x3'));var router=express['Router']();var fs_extra=require(_0xb6e3('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb6e3('0x5'));var controller=require(_0xb6e3('0x6'));router['get']('/',auth[_0xb6e3('0x7')](),controller[_0xb6e3('0x8')]);router['get'](_0xb6e3('0x9'),auth['isAuthenticated'](),controller[_0xb6e3('0xa')]);router[_0xb6e3('0xb')]('/',auth[_0xb6e3('0x7')](),controller['create']);router[_0xb6e3('0xb')](_0xb6e3('0xc'),auth['isAuthenticated'](),controller[_0xb6e3('0xd')]);router[_0xb6e3('0xe')](_0xb6e3('0x9'),auth[_0xb6e3('0x7')](),controller[_0xb6e3('0xf')]);router[_0xb6e3('0x10')](_0xb6e3('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xb6e3('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 68ac694..055fb7e 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 _0xb36c=['inbound','inbound-fax','outbound-fax','system','any','BOOLEAN','INTEGER','VIRTUAL','getDataValue','exten','exports','compositeIndex','STRING','NoOp'];(function(_0x23f8d2,_0x301fec){var _0x5d174b=function(_0x2c3c9e){while(--_0x2c3c9e){_0x23f8d2['push'](_0x23f8d2['shift']());}};_0x5d174b(++_0x301fec);}(_0xb36c,0xf8));var _0xcb36=function(_0x19f939,_0x1a19fa){_0x19f939=_0x19f939-0x0;var _0x2fb03d=_0xb36c[_0x19f939];return _0x2fb03d;};'use strict';var Sequelize=require('sequelize');module[_0xcb36('0x0')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xcb36('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xcb36('0x2')],'allowNull':![],'unique':_0xcb36('0x1')},'priority':{'type':Sequelize[_0xcb36('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xcb36('0x2')],'allowNull':![],'defaultValue':_0xcb36('0x3')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0xcb36('0x4'),'outbound','internal',_0xcb36('0x5'),_0xcb36('0x6'),_0xcb36('0x7'),_0xcb36('0x8')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0xcb36('0x9')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0xcb36('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xcb36('0x9')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xcb36('0xa')]},'recordingFormat':{'type':Sequelize[_0xcb36('0x2')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0xcb36('0x9')],'defaultValue':!![]},'name':{'type':Sequelize[_0xcb36('0xb')],'get':function(_0x310f50){return this[_0xcb36('0xc')](_0xcb36('0xd'));}},'alias':{'type':Sequelize[_0xcb36('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xf748=['exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','exten'];(function(_0x5816da,_0x22087a){var _0x2f425b=function(_0x5584c0){while(--_0x5584c0){_0x5816da['push'](_0x5816da['shift']());}};_0x2f425b(++_0x22087a);}(_0xf748,0x156));var _0x8f74=function(_0x1c20bd,_0x5d1c1c){_0x1c20bd=_0x1c20bd-0x0;var _0x42d43e=_0xf748[_0x1c20bd];return _0x42d43e;};'use strict';var Sequelize=require('sequelize');module[_0x8f74('0x0')]={'context':{'type':Sequelize[_0x8f74('0x1')],'allowNull':![],'unique':_0x8f74('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x8f74('0x1')],'allowNull':![],'unique':_0x8f74('0x2')},'priority':{'type':Sequelize[_0x8f74('0x1')],'allowNull':![],'defaultValue':'1','unique':_0x8f74('0x2')},'tag':{'type':Sequelize[_0x8f74('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x8f74('0x1')],'allowNull':![],'defaultValue':_0x8f74('0x3')},'appdata':{'type':Sequelize[_0x8f74('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x8f74('0x4')](_0x8f74('0x5'),_0x8f74('0x6'),_0x8f74('0x7'),_0x8f74('0x8'),_0x8f74('0x9'),_0x8f74('0xa'),_0x8f74('0xb')),'allowNull':![]},'description':{'type':Sequelize[_0x8f74('0x1')]},'interval':{'type':Sequelize[_0x8f74('0x1')],'allowNull':![],'defaultValue':_0x8f74('0xc')},'IntervalId':{'type':Sequelize[_0x8f74('0xd')]},'isApp':{'type':Sequelize[_0x8f74('0xe')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x8f74('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0x8f74('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x8f74('0xe')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x8f74('0xd')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x8f74('0xf')},'answer':{'type':Sequelize[_0x8f74('0xe')],'defaultValue':!![]},'name':{'type':Sequelize[_0x8f74('0x10')],'get':function(_0x523902){return this[_0x8f74('0x11')](_0x8f74('0x12'));}},'alias':{'type':Sequelize[_0x8f74('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 612c9f7..26e710b 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 _0xef11=['VoiceExtension','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','description','recordingFormat','cutdigits','alias','context','Transaction','ISOLATION_LEVELS','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','destroy','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','map','value','includes','type','then','stack','name','send','rawAttributes','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','merge','options','includeAll','include','findAll','catch','show','params','find','startsWith','body','exten'];(function(_0x296bc9,_0x1b2414){var _0x5d1ea9=function(_0x2a209a){while(--_0x2a209a){_0x296bc9['push'](_0x296bc9['shift']());}};_0x5d1ea9(++_0x1b2414);}(_0xef11,0x175));var _0x1ef1=function(_0x2e2681,_0x4089c1){_0x2e2681=_0x2e2681-0x0;var _0x368a64=_0xef11[_0x2e2681];return _0x368a64;};'use strict';var _=require(_0x1ef1('0x0'));var Redis=require(_0x1ef1('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x1ef1('0x2'))(_0x1ef1('0x3'));var config=require(_0x1ef1('0x4'));var db=require(_0x1ef1('0x5'))['db'];config[_0x1ef1('0x6')]=_[_0x1ef1('0x7')](config['redis'],{'host':_0x1ef1('0x8'),'port':0x18eb});var socket=require(_0x1ef1('0x9'))(new Redis(config[_0x1ef1('0x6')]));require(_0x1ef1('0xa'))[_0x1ef1('0xb')](socket);function respondWithStatusCode(_0x55da69,_0x5e0896){_0x5e0896=_0x5e0896||0xcc;return function(_0xc0d243){if(_0xc0d243){return _0x55da69[_0x1ef1('0xc')](_0x5e0896);}return _0x55da69[_0x1ef1('0xd')](_0x5e0896)[_0x1ef1('0xe')]();};}function respondWithResult(_0x15b688,_0x3d4333){_0x3d4333=_0x3d4333||0xc8;return function(_0xfaa5d7){if(_0xfaa5d7){return _0x15b688[_0x1ef1('0xd')](_0x3d4333)[_0x1ef1('0xf')](_0xfaa5d7);}};}function respondWithFilteredResult(_0x4e5574,_0xda7244){return function(_0x564580){if(_0x564580){var _0x211f3c=typeof _0xda7244[_0x1ef1('0x10')]==='undefined'&&typeof _0xda7244[_0x1ef1('0x11')]===_0x1ef1('0x12');var _0x114ad2=_0x564580[_0x1ef1('0x13')];var _0x57453b=_0x211f3c?0x0:_0xda7244[_0x1ef1('0x10')];var _0x4c9e25=_0x211f3c?_0x564580[_0x1ef1('0x13')]:_0xda7244[_0x1ef1('0x10')]+_0xda7244[_0x1ef1('0x11')];var _0x2de4b7;if(_0x4c9e25>=_0x114ad2){_0x4c9e25=_0x114ad2;_0x2de4b7=0xc8;}else{_0x2de4b7=0xce;}_0x4e5574[_0x1ef1('0xd')](_0x2de4b7);return _0x4e5574[_0x1ef1('0x14')](_0x1ef1('0x15'),_0x57453b+'-'+_0x4c9e25+'/'+_0x114ad2)[_0x1ef1('0xf')](_0x564580);}return null;};}function removeEntity(_0x2ea7ab){return function(_0x568717){if(_0x568717){return _0x568717[_0x1ef1('0x16')]()['then'](function(){var _0x396284=_0x568717['get']({'plain':!![]});var _0xf229e1=[{'name':'InboundRoutes','value':_0x1ef1('0x17'),'ignore':![]},{'name':_0x1ef1('0x18'),'value':_0x1ef1('0x19'),'ignore':![]},{'name':_0x1ef1('0x1a'),'value':_0x1ef1('0x1b'),'ignore':![]}];var _0x4c8643=_(_0xf229e1)[_0x1ef1('0x1c')]('ignore')[_0x1ef1('0x1d')](_0x1ef1('0x1e'))[_0x1ef1('0x1e')]();if(_[_0x1ef1('0x1f')](_0x4c8643,_0x396284[_0x1ef1('0x20')])){return;}var _0x320069=_['find'](_0xf229e1,[_0x1ef1('0x1e'),_0x396284[_0x1ef1('0x20')]])['name'];return db['UserProfileResource'][_0x1ef1('0x16')]({'where':{'type':_0x320069,'resourceId':_0x396284['id']}})[_0x1ef1('0x21')](function(){return _0x568717;});})[_0x1ef1('0x21')](function(){_0x2ea7ab['status'](0xcc)[_0x1ef1('0xe')]();});}};}function handleEntityNotFound(_0x5cc55f){return function(_0x17f42a){if(!_0x17f42a){_0x5cc55f[_0x1ef1('0xc')](0x194);}return _0x17f42a;};}function handleError(_0x14466c,_0x4ee6b6){_0x4ee6b6=_0x4ee6b6||0x1f4;return function(_0x21d84f){logger['error'](_0x21d84f[_0x1ef1('0x22')]);if(_0x21d84f[_0x1ef1('0x23')]){delete _0x21d84f[_0x1ef1('0x23')];}_0x14466c[_0x1ef1('0xd')](_0x4ee6b6)[_0x1ef1('0x24')](_0x21d84f);};}exports['index']=function(_0x37c601,_0x850e37){var _0x202350={},_0x7fa343={},_0x2cc84f={'count':0x0,'rows':[]};var _0x54a6ec=_[_0x1ef1('0x1d')](db['VoiceExtension'][_0x1ef1('0x25')],function(_0x142378){return{'name':_0x142378['fieldName'],'type':_0x142378['type']['key']};});_0x7fa343['model']=_[_0x1ef1('0x1d')](_0x54a6ec,_0x1ef1('0x23'));_0x7fa343[_0x1ef1('0x26')]=_[_0x1ef1('0x27')](_0x37c601['query']);_0x7fa343['filters']=_[_0x1ef1('0x28')](_0x7fa343[_0x1ef1('0x29')],_0x7fa343[_0x1ef1('0x26')]);_0x202350[_0x1ef1('0x2a')]=_['intersection'](_0x7fa343[_0x1ef1('0x29')],qs[_0x1ef1('0x2b')](_0x37c601[_0x1ef1('0x26')][_0x1ef1('0x2b')]));_0x202350[_0x1ef1('0x2a')]=_0x202350[_0x1ef1('0x2a')][_0x1ef1('0x2c')]?_0x202350[_0x1ef1('0x2a')]:_0x7fa343[_0x1ef1('0x29')];if(!_0x37c601[_0x1ef1('0x26')][_0x1ef1('0x2d')]('nolimit')){_0x202350[_0x1ef1('0x11')]=qs[_0x1ef1('0x11')](_0x37c601[_0x1ef1('0x26')][_0x1ef1('0x11')]);_0x202350['offset']=qs[_0x1ef1('0x10')](_0x37c601[_0x1ef1('0x26')][_0x1ef1('0x10')]);}_0x202350[_0x1ef1('0x2e')]=qs[_0x1ef1('0x2f')](_0x37c601[_0x1ef1('0x26')][_0x1ef1('0x2f')]);_0x202350[_0x1ef1('0x30')]=qs[_0x1ef1('0x31')](_['pick'](_0x37c601[_0x1ef1('0x26')],_0x7fa343[_0x1ef1('0x31')]),_0x54a6ec);if(_0x37c601[_0x1ef1('0x26')][_0x1ef1('0x1c')]){_0x202350[_0x1ef1('0x30')]=_[_0x1ef1('0x32')](_0x202350[_0x1ef1('0x30')],{'$or':_['map'](_0x54a6ec,function(_0x33303e){if(_0x33303e[_0x1ef1('0x20')]!=='VIRTUAL'){var _0x37ccff={};_0x37ccff[_0x33303e['name']]={'$like':'%'+_0x37c601['query'][_0x1ef1('0x1c')]+'%'};return _0x37ccff;}})});}_0x202350=_[_0x1ef1('0x32')]({},_0x202350,_0x37c601[_0x1ef1('0x33')]);var _0x389eaa={'where':_0x202350['where']};return db['VoiceExtension'][_0x1ef1('0x13')](_0x389eaa)['then'](function(_0x4f3705){_0x2cc84f['count']=_0x4f3705;if(_0x37c601[_0x1ef1('0x26')][_0x1ef1('0x34')]){_0x202350[_0x1ef1('0x35')]=[{'all':!![]}];}return db['VoiceExtension'][_0x1ef1('0x36')](_0x202350);})[_0x1ef1('0x21')](function(_0x45481b){_0x2cc84f['rows']=_0x45481b;return _0x2cc84f;})['then'](respondWithFilteredResult(_0x850e37,_0x202350))[_0x1ef1('0x37')](handleError(_0x850e37,null));};exports[_0x1ef1('0x38')]=function(_0x210da4,_0xa62f97){var _0x168050={'raw':![],'where':{'id':_0x210da4[_0x1ef1('0x39')]['id']}},_0x15777a={};_0x15777a['model']=_[_0x1ef1('0x27')](db['VoiceExtension'][_0x1ef1('0x25')]);_0x15777a['query']=_['keys'](_0x210da4[_0x1ef1('0x26')]);_0x15777a[_0x1ef1('0x31')]=_[_0x1ef1('0x28')](_0x15777a[_0x1ef1('0x29')],_0x15777a['query']);_0x168050[_0x1ef1('0x2a')]=_[_0x1ef1('0x28')](_0x15777a[_0x1ef1('0x29')],qs['fields'](_0x210da4[_0x1ef1('0x26')][_0x1ef1('0x2b')]));_0x168050[_0x1ef1('0x2a')]=_0x168050[_0x1ef1('0x2a')][_0x1ef1('0x2c')]?_0x168050[_0x1ef1('0x2a')]:_0x15777a[_0x1ef1('0x29')];if(_0x210da4[_0x1ef1('0x26')]['includeAll']){_0x168050[_0x1ef1('0x35')]=[{'all':!![]}];}_0x168050=_[_0x1ef1('0x32')]({},_0x168050,_0x210da4[_0x1ef1('0x33')]);return db['VoiceExtension'][_0x1ef1('0x3a')](_0x168050)[_0x1ef1('0x21')](handleEntityNotFound(_0xa62f97,null))[_0x1ef1('0x21')](respondWithResult(_0xa62f97,null))[_0x1ef1('0x37')](handleError(_0xa62f97,null));};exports[_0x1ef1('0x16')]=function(_0x5e3a7b,_0x1192f8){return db['VoiceExtension'][_0x1ef1('0x3a')]({'where':{'id':_0x5e3a7b[_0x1ef1('0x39')]['id']}})[_0x1ef1('0x21')](handleEntityNotFound(_0x1192f8,null))[_0x1ef1('0x21')](removeEntity(_0x1192f8,null))['catch'](handleError(_0x1192f8,null));};exports['create']=function(_0x4acb5e,_0x59c022){if(_0x4acb5e['body'][_0x1ef1('0x20')]==='outbound'&&!_[_0x1ef1('0x3b')](_0x4acb5e[_0x1ef1('0x3c')]['exten'],'_')){_0x4acb5e['body'][_0x1ef1('0x3d')]='_'['concat'](_0x4acb5e[_0x1ef1('0x3c')][_0x1ef1('0x3d')]);}return db[_0x1ef1('0x3e')][_0x1ef1('0x3f')](_0x4acb5e[_0x1ef1('0x3c')],{'raw':![]})[_0x1ef1('0x21')](function(_0xd1f24a){var _0x142337=_0x4acb5e['user']['get']({'plain':!![]});if(!_0x142337)throw new Error(_0x1ef1('0x40'));if(_0x142337[_0x1ef1('0x41')]==='user'){var _0x2962d6=_0xd1f24a['get']({'plain':!![]});var _0x5909a4=[{'name':'InboundRoutes','value':'inbound'},{'name':'OutboundRoutes','value':'outbound'},{'name':_0x1ef1('0x1a'),'value':'internal'}];var _0xbebe18=_['find'](_0x5909a4,['value',_0x2962d6[_0x1ef1('0x20')]])[_0x1ef1('0x23')];return db['UserProfileSection'][_0x1ef1('0x3a')]({'where':{'name':_0xbebe18,'userProfileId':_0x142337['userProfileId']},'raw':!![]})[_0x1ef1('0x21')](function(_0x3880c1){if(_0x3880c1&&_0x3880c1[_0x1ef1('0x42')]===0x0){return db[_0x1ef1('0x43')][_0x1ef1('0x3f')]({'name':_0x2962d6[_0x1ef1('0x23')],'resourceId':_0x2962d6['id'],'type':_0x3880c1[_0x1ef1('0x23')],'sectionId':_0x3880c1['id']},{})[_0x1ef1('0x21')](function(){return _0xd1f24a;});}else{return _0xd1f24a;}})['catch'](function(_0x20e6f8){logger[_0x1ef1('0x44')](_0x1ef1('0x45'),_0x20e6f8);throw _0x20e6f8;});}return _0xd1f24a;})[_0x1ef1('0x21')](respondWithResult(_0x59c022,0xc9))[_0x1ef1('0x37')](handleError(_0x59c022,null));};exports[_0x1ef1('0x46')]=function(_0x1f3da,_0xd18236){if(_0x1f3da[_0x1ef1('0x3c')]['id']){delete _0x1f3da[_0x1ef1('0x3c')]['id'];}return db[_0x1ef1('0x3e')][_0x1ef1('0x3a')]({'where':{'id':_0x1f3da[_0x1ef1('0x39')]['id']}})[_0x1ef1('0x21')](handleEntityNotFound(_0xd18236,null))[_0x1ef1('0x21')](function(_0x560d99){if(_0x560d99){return db[_0x1ef1('0x3e')][_0x1ef1('0x46')](_[_0x1ef1('0x47')](_0x1f3da[_0x1ef1('0x3c')],['exten','context',_0x1ef1('0x48'),_0x1ef1('0x49'),_0x1ef1('0x4a'),'mandatoryDisposition',_0x1ef1('0x4b')]),{'where':{'context':_0x560d99[_0x1ef1('0x4c')],'exten':_0x560d99[_0x1ef1('0x3d')]},'individualHooks':!![]})[_0x1ef1('0x21')](function(_0x2e71ce){return _0x2e71ce;});}return null;})[_0x1ef1('0x21')](respondWithStatusCode(_0xd18236,null))[_0x1ef1('0x37')](handleError(_0xd18236,null));};exports['addApplications']=function(_0x417249,_0x108874){var _0x517acd=_0x417249[_0x1ef1('0x39')]['id'];var _0x59b09d=_0x417249[_0x1ef1('0x3c')];var _0x93b5d8=0xc8;var _0x429681=null;return db['sequelize']['transaction']({'isolationLevel':db['sequelize'][_0x1ef1('0x4d')][_0x1ef1('0x4e')]['READ_COMMITTED']},function(_0x3eb83e){return db[_0x1ef1('0x3e')][_0x1ef1('0x4f')]({'where':{'id':_0x517acd},'transaction':_0x3eb83e})[_0x1ef1('0x21')](function(_0xed826a){if(_0xed826a){return db['VoiceExtension'][_0x1ef1('0x16')]({'where':{'VoiceExtensionId':_0x517acd},'transaction':_0x3eb83e})[_0x1ef1('0x21')](function(){var _0x5dc457=_[_0x1ef1('0x1d')](_0x59b09d,function(_0x3f9756){_0x3f9756[_0x1ef1('0x50')]=_0x517acd;_0x3f9756[_0x1ef1('0x51')]=!![];return _0x3f9756;});return _0xed826a[_0x1ef1('0x52')](_0x5dc457);})[_0x1ef1('0x21')](function(_0x5f3d84){return db[_0x1ef1('0x3e')][_0x1ef1('0x53')](_0x5f3d84,{'transaction':_0x3eb83e});});}else{_0x93b5d8=0x194;_0x429681=[];}});})[_0x1ef1('0x21')](function(){if(_0x93b5d8!==0x194){return db['VoiceExtension'][_0x1ef1('0x54')]({'where':{'isApp':!![],'VoiceExtensionId':_0x517acd},'order':_0x1ef1('0x55')})[_0x1ef1('0x21')](function(_0x4ba5fb){_0x429681=_0x4ba5fb;});}})[_0x1ef1('0x37')](function(_0x26221b){_0x93b5d8=0x1f4;logger[_0x1ef1('0x44')](_0x26221b[_0x1ef1('0x22')]);if(_0x26221b[_0x1ef1('0x23')]){delete _0x26221b[_0x1ef1('0x23')];}_0x429681=_0x26221b;})[_0x1ef1('0x56')](function(){if(_0x429681===null){_0x108874[_0x1ef1('0xc')](_0x93b5d8);}else{if(_0x93b5d8===0x1f4){_0x108874[_0x1ef1('0xd')](_0x93b5d8)[_0x1ef1('0x24')](_0x429681);}else{_0x108874['status'](_0x93b5d8)[_0x1ef1('0xf')](_0x429681);}}});}; \ No newline at end of file +var _0x78b9=['outbound','InternalRoutes','internal','filter','ignore','map','value','includes','type','find','UserProfileResource','then','stack','name','send','index','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','merge','VIRTUAL','options','include','rows','catch','show','params','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','Transaction','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','finally','ioredis','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','./voiceExtension.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','set','destroy','get','InboundRoutes','inbound','OutboundRoutes'];(function(_0x4d919b,_0x19fd47){var _0x2eeb66=function(_0x2cdeaf){while(--_0x2cdeaf){_0x4d919b['push'](_0x4d919b['shift']());}};_0x2eeb66(++_0x19fd47);}(_0x78b9,0x1c0));var _0x978b=function(_0xbb025,_0x3e3651){_0xbb025=_0xbb025-0x0;var _0x33f5b1=_0x78b9[_0xbb025];return _0x33f5b1;};'use strict';var _=require('lodash');var Redis=require(_0x978b('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0x978b('0x1'))('api');var config=require(_0x978b('0x2'));var db=require(_0x978b('0x3'))['db'];config[_0x978b('0x4')]=_[_0x978b('0x5')](config[_0x978b('0x4')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x978b('0x4')]));require(_0x978b('0x6'))[_0x978b('0x7')](socket);function respondWithStatusCode(_0xd467ad,_0x2e3c4e){_0x2e3c4e=_0x2e3c4e||0xcc;return function(_0x5af5cd){if(_0x5af5cd){return _0xd467ad[_0x978b('0x8')](_0x2e3c4e);}return _0xd467ad['status'](_0x2e3c4e)[_0x978b('0x9')]();};}function respondWithResult(_0x114af9,_0xfd7051){_0xfd7051=_0xfd7051||0xc8;return function(_0x148468){if(_0x148468){return _0x114af9[_0x978b('0xa')](_0xfd7051)[_0x978b('0xb')](_0x148468);}};}function respondWithFilteredResult(_0x2ecce1,_0x452686){return function(_0x532f35){if(_0x532f35){var _0x48ae0e=typeof _0x452686[_0x978b('0xc')]===_0x978b('0xd')&&typeof _0x452686['limit']===_0x978b('0xd');var _0x2573a2=_0x532f35['count'];var _0x46b1b3=_0x48ae0e?0x0:_0x452686[_0x978b('0xc')];var _0x21928d=_0x48ae0e?_0x532f35[_0x978b('0xe')]:_0x452686[_0x978b('0xc')]+_0x452686[_0x978b('0xf')];var _0x39a0bc;if(_0x21928d>=_0x2573a2){_0x21928d=_0x2573a2;_0x39a0bc=0xc8;}else{_0x39a0bc=0xce;}_0x2ecce1[_0x978b('0xa')](_0x39a0bc);return _0x2ecce1[_0x978b('0x10')]('Content-Range',_0x46b1b3+'-'+_0x21928d+'/'+_0x2573a2)['json'](_0x532f35);}return null;};}function removeEntity(_0x293f76){return function(_0x579209){if(_0x579209){return _0x579209[_0x978b('0x11')]()['then'](function(){var _0x12add1=_0x579209[_0x978b('0x12')]({'plain':!![]});var _0x1ed23a=[{'name':_0x978b('0x13'),'value':_0x978b('0x14'),'ignore':![]},{'name':_0x978b('0x15'),'value':_0x978b('0x16'),'ignore':![]},{'name':_0x978b('0x17'),'value':_0x978b('0x18'),'ignore':![]}];var _0x3916f1=_(_0x1ed23a)[_0x978b('0x19')](_0x978b('0x1a'))[_0x978b('0x1b')](_0x978b('0x1c'))[_0x978b('0x1c')]();if(_[_0x978b('0x1d')](_0x3916f1,_0x12add1[_0x978b('0x1e')])){return;}var _0x392864=_[_0x978b('0x1f')](_0x1ed23a,[_0x978b('0x1c'),_0x12add1[_0x978b('0x1e')]])['name'];return db[_0x978b('0x20')][_0x978b('0x11')]({'where':{'type':_0x392864,'resourceId':_0x12add1['id']}})['then'](function(){return _0x579209;});})[_0x978b('0x21')](function(){_0x293f76['status'](0xcc)[_0x978b('0x9')]();});}};}function handleEntityNotFound(_0x34293e){return function(_0x509566){if(!_0x509566){_0x34293e[_0x978b('0x8')](0x194);}return _0x509566;};}function handleError(_0x3a77a3,_0x49bd00){_0x49bd00=_0x49bd00||0x1f4;return function(_0x21a646){logger['error'](_0x21a646[_0x978b('0x22')]);if(_0x21a646[_0x978b('0x23')]){delete _0x21a646[_0x978b('0x23')];}_0x3a77a3['status'](_0x49bd00)[_0x978b('0x24')](_0x21a646);};}exports[_0x978b('0x25')]=function(_0x51b8ec,_0x4c342f){var _0x5cdb61={},_0xb2474b={},_0x1aa6f6={'count':0x0,'rows':[]};var _0x584595=_[_0x978b('0x1b')](db[_0x978b('0x26')][_0x978b('0x27')],function(_0x3a8615){return{'name':_0x3a8615[_0x978b('0x28')],'type':_0x3a8615[_0x978b('0x1e')][_0x978b('0x29')]};});_0xb2474b[_0x978b('0x2a')]=_[_0x978b('0x1b')](_0x584595,_0x978b('0x23'));_0xb2474b[_0x978b('0x2b')]=_[_0x978b('0x2c')](_0x51b8ec[_0x978b('0x2b')]);_0xb2474b['filters']=_[_0x978b('0x2d')](_0xb2474b['model'],_0xb2474b[_0x978b('0x2b')]);_0x5cdb61[_0x978b('0x2e')]=_[_0x978b('0x2d')](_0xb2474b['model'],qs[_0x978b('0x2f')](_0x51b8ec[_0x978b('0x2b')][_0x978b('0x2f')]));_0x5cdb61[_0x978b('0x2e')]=_0x5cdb61[_0x978b('0x2e')][_0x978b('0x30')]?_0x5cdb61[_0x978b('0x2e')]:_0xb2474b[_0x978b('0x2a')];if(!_0x51b8ec[_0x978b('0x2b')][_0x978b('0x31')](_0x978b('0x32'))){_0x5cdb61[_0x978b('0xf')]=qs[_0x978b('0xf')](_0x51b8ec[_0x978b('0x2b')]['limit']);_0x5cdb61[_0x978b('0xc')]=qs['offset'](_0x51b8ec['query'][_0x978b('0xc')]);}_0x5cdb61[_0x978b('0x33')]=qs['sort'](_0x51b8ec[_0x978b('0x2b')]['sort']);_0x5cdb61[_0x978b('0x34')]=qs[_0x978b('0x35')](_['pick'](_0x51b8ec[_0x978b('0x2b')],_0xb2474b[_0x978b('0x35')]),_0x584595);if(_0x51b8ec['query'][_0x978b('0x19')]){_0x5cdb61['where']=_[_0x978b('0x36')](_0x5cdb61['where'],{'$or':_[_0x978b('0x1b')](_0x584595,function(_0x180488){if(_0x180488['type']!==_0x978b('0x37')){var _0x2ccaa5={};_0x2ccaa5[_0x180488[_0x978b('0x23')]]={'$like':'%'+_0x51b8ec[_0x978b('0x2b')][_0x978b('0x19')]+'%'};return _0x2ccaa5;}})});}_0x5cdb61=_[_0x978b('0x36')]({},_0x5cdb61,_0x51b8ec[_0x978b('0x38')]);var _0x29fdae={'where':_0x5cdb61[_0x978b('0x34')]};return db[_0x978b('0x26')][_0x978b('0xe')](_0x29fdae)[_0x978b('0x21')](function(_0x5632f4){_0x1aa6f6['count']=_0x5632f4;if(_0x51b8ec[_0x978b('0x2b')]['includeAll']){_0x5cdb61[_0x978b('0x39')]=[{'all':!![]}];}return db[_0x978b('0x26')]['findAll'](_0x5cdb61);})[_0x978b('0x21')](function(_0x477a21){_0x1aa6f6[_0x978b('0x3a')]=_0x477a21;return _0x1aa6f6;})['then'](respondWithFilteredResult(_0x4c342f,_0x5cdb61))[_0x978b('0x3b')](handleError(_0x4c342f,null));};exports[_0x978b('0x3c')]=function(_0x2b752b,_0x31ba27){var _0x2a0f94={'raw':![],'where':{'id':_0x2b752b[_0x978b('0x3d')]['id']}},_0x3e0f7a={};_0x3e0f7a[_0x978b('0x2a')]=_[_0x978b('0x2c')](db['VoiceExtension'][_0x978b('0x27')]);_0x3e0f7a[_0x978b('0x2b')]=_[_0x978b('0x2c')](_0x2b752b[_0x978b('0x2b')]);_0x3e0f7a[_0x978b('0x35')]=_[_0x978b('0x2d')](_0x3e0f7a[_0x978b('0x2a')],_0x3e0f7a[_0x978b('0x2b')]);_0x2a0f94[_0x978b('0x2e')]=_[_0x978b('0x2d')](_0x3e0f7a['model'],qs[_0x978b('0x2f')](_0x2b752b[_0x978b('0x2b')]['fields']));_0x2a0f94['attributes']=_0x2a0f94[_0x978b('0x2e')][_0x978b('0x30')]?_0x2a0f94[_0x978b('0x2e')]:_0x3e0f7a[_0x978b('0x2a')];if(_0x2b752b[_0x978b('0x2b')]['includeAll']){_0x2a0f94[_0x978b('0x39')]=[{'all':!![]}];}_0x2a0f94=_[_0x978b('0x36')]({},_0x2a0f94,_0x2b752b['options']);return db[_0x978b('0x26')][_0x978b('0x1f')](_0x2a0f94)[_0x978b('0x21')](handleEntityNotFound(_0x31ba27,null))[_0x978b('0x21')](respondWithResult(_0x31ba27,null))[_0x978b('0x3b')](handleError(_0x31ba27,null));};exports['destroy']=function(_0x34d440,_0x379cc8){return db[_0x978b('0x26')][_0x978b('0x1f')]({'where':{'id':_0x34d440[_0x978b('0x3d')]['id']}})['then'](handleEntityNotFound(_0x379cc8,null))[_0x978b('0x21')](removeEntity(_0x379cc8,null))[_0x978b('0x3b')](handleError(_0x379cc8,null));};exports[_0x978b('0x3e')]=function(_0x271e27,_0xe7bee1){if(_0x271e27[_0x978b('0x3f')][_0x978b('0x1e')]===_0x978b('0x16')&&!_[_0x978b('0x40')](_0x271e27[_0x978b('0x3f')]['exten'],'_')){_0x271e27['body'][_0x978b('0x41')]='_'[_0x978b('0x42')](_0x271e27[_0x978b('0x3f')][_0x978b('0x41')]);}return db['VoiceExtension'][_0x978b('0x3e')](_0x271e27['body'],{'raw':![]})[_0x978b('0x21')](function(_0x20720e){var _0x107d29=_0x271e27[_0x978b('0x43')][_0x978b('0x12')]({'plain':!![]});if(!_0x107d29)throw new Error(_0x978b('0x44'));if(_0x107d29[_0x978b('0x45')]===_0x978b('0x43')){var _0x10a982=_0x20720e[_0x978b('0x12')]({'plain':!![]});var _0x336a04=[{'name':'InboundRoutes','value':_0x978b('0x14')},{'name':'OutboundRoutes','value':_0x978b('0x16')},{'name':'InternalRoutes','value':_0x978b('0x18')}];var _0x561c66=_[_0x978b('0x1f')](_0x336a04,[_0x978b('0x1c'),_0x10a982[_0x978b('0x1e')]])[_0x978b('0x23')];return db[_0x978b('0x46')][_0x978b('0x1f')]({'where':{'name':_0x561c66,'userProfileId':_0x107d29[_0x978b('0x47')]},'raw':!![]})['then'](function(_0x67834b){if(_0x67834b&&_0x67834b[_0x978b('0x48')]===0x0){return db[_0x978b('0x20')][_0x978b('0x3e')]({'name':_0x10a982[_0x978b('0x23')],'resourceId':_0x10a982['id'],'type':_0x67834b[_0x978b('0x23')],'sectionId':_0x67834b['id']},{})[_0x978b('0x21')](function(){return _0x20720e;});}else{return _0x20720e;}})[_0x978b('0x3b')](function(_0x221eb8){logger[_0x978b('0x49')](_0x978b('0x4a'),_0x221eb8);throw _0x221eb8;});}return _0x20720e;})[_0x978b('0x21')](respondWithResult(_0xe7bee1,0xc9))['catch'](handleError(_0xe7bee1,null));};exports[_0x978b('0x4b')]=function(_0x5f576f,_0x2f8079){if(_0x5f576f['body']['id']){delete _0x5f576f[_0x978b('0x3f')]['id'];}return db[_0x978b('0x26')][_0x978b('0x1f')]({'where':{'id':_0x5f576f[_0x978b('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2f8079,null))['then'](function(_0x3cbac1){if(_0x3cbac1){return db['VoiceExtension'][_0x978b('0x4b')](_[_0x978b('0x4c')](_0x5f576f['body'],['exten',_0x978b('0x4d'),_0x978b('0x4e'),_0x978b('0x4f'),_0x978b('0x50'),_0x978b('0x51'),_0x978b('0x52')]),{'where':{'context':_0x3cbac1[_0x978b('0x4d')],'exten':_0x3cbac1[_0x978b('0x41')]},'individualHooks':!![]})[_0x978b('0x21')](function(_0x3fd98b){return _0x3fd98b;});}return null;})[_0x978b('0x21')](respondWithStatusCode(_0x2f8079,null))[_0x978b('0x3b')](handleError(_0x2f8079,null));};exports[_0x978b('0x53')]=function(_0x406236,_0x38d6b7){var _0x37bb2e=_0x406236[_0x978b('0x3d')]['id'];var _0x14efaf=_0x406236[_0x978b('0x3f')];var _0x2043b1=0xc8;var _0x16bb30=null;return db[_0x978b('0x54')]['transaction']({'isolationLevel':db[_0x978b('0x54')][_0x978b('0x55')]['ISOLATION_LEVELS'][_0x978b('0x56')]},function(_0xe8c1d8){return db[_0x978b('0x26')][_0x978b('0x57')]({'where':{'id':_0x37bb2e},'transaction':_0xe8c1d8})[_0x978b('0x21')](function(_0x53548b){if(_0x53548b){return db['VoiceExtension'][_0x978b('0x11')]({'where':{'VoiceExtensionId':_0x37bb2e},'transaction':_0xe8c1d8})[_0x978b('0x21')](function(){var _0xc292a4=_[_0x978b('0x1b')](_0x14efaf,function(_0x403405){_0x403405[_0x978b('0x58')]=_0x37bb2e;_0x403405[_0x978b('0x59')]=!![];return _0x403405;});return _0x53548b[_0x978b('0x5a')](_0xc292a4);})[_0x978b('0x21')](function(_0x6b6be4){return db[_0x978b('0x26')][_0x978b('0x5b')](_0x6b6be4,{'transaction':_0xe8c1d8});});}else{_0x2043b1=0x194;_0x16bb30=[];}});})[_0x978b('0x21')](function(){if(_0x2043b1!==0x194){return db[_0x978b('0x26')][_0x978b('0x5c')]({'where':{'isApp':!![],'VoiceExtensionId':_0x37bb2e},'order':'cast(priority\x20as\x20unsigned)'})[_0x978b('0x21')](function(_0x855d50){_0x16bb30=_0x855d50;});}})['catch'](function(_0x1bae03){_0x2043b1=0x1f4;logger['error'](_0x1bae03[_0x978b('0x22')]);if(_0x1bae03[_0x978b('0x23')]){delete _0x1bae03['name'];}_0x16bb30=_0x1bae03;})[_0x978b('0x5d')](function(){if(_0x16bb30===null){_0x38d6b7[_0x978b('0x8')](_0x2043b1);}else{if(_0x2043b1===0x1f4){_0x38d6b7[_0x978b('0xa')](_0x2043b1)[_0x978b('0x24')](_0x16bb30);}else{_0x38d6b7['status'](_0x2043b1)[_0x978b('0xb')](_0x16bb30);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 10ee882..b5b8c9f 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 _0x9312=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save','update'];(function(_0x5c3bb0,_0x32caed){var _0x595565=function(_0x366c89){while(--_0x366c89){_0x5c3bb0['push'](_0x5c3bb0['shift']());}};_0x595565(++_0x32caed);}(_0x9312,0x15a));var _0x2931=function(_0x4a5f6c,_0x4f532e){_0x4a5f6c=_0x4a5f6c-0x0;var _0x281ffd=_0x9312[_0x4a5f6c];return _0x281ffd;};'use strict';var EventEmitter=require(_0x2931('0x0'));var VoiceExtension=require(_0x2931('0x1'))['db'][_0x2931('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x2931('0x3')](0x0);var events={'afterCreate':_0x2931('0x4'),'afterUpdate':_0x2931('0x5'),'afterDestroy':_0x2931('0x6')};function emitEvent(_0x4f7c36){return function(_0x5a82aa,_0x5e6351,_0x391552){VoiceExtensionEvents['emit'](_0x4f7c36+':'+_0x5a82aa['id'],_0x5a82aa);VoiceExtensionEvents[_0x2931('0x7')](_0x4f7c36,_0x5a82aa);_0x391552(null);};}for(var e in events){if(events[_0x2931('0x8')](e)){var event=events[e];VoiceExtension[_0x2931('0x9')](e,emitEvent(event));}}module[_0x2931('0xa')]=VoiceExtensionEvents; \ No newline at end of file +var _0x7149=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x7149,0xeb));var _0x9714=function(_0x3264b8,_0x2f0874){_0x3264b8=_0x3264b8-0x0;var _0x53a437=_0x7149[_0x3264b8];return _0x53a437;};'use strict';var EventEmitter=require(_0x9714('0x0'));var VoiceExtension=require(_0x9714('0x1'))['db'][_0x9714('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x9714('0x3')](0x0);var events={'afterCreate':_0x9714('0x4'),'afterUpdate':_0x9714('0x5'),'afterDestroy':_0x9714('0x6')};function emitEvent(_0x304c8b){return function(_0x1ed52d,_0x168f1a,_0x843853){VoiceExtensionEvents['emit'](_0x304c8b+':'+_0x1ed52d['id'],_0x1ed52d);VoiceExtensionEvents[_0x9714('0x7')](_0x304c8b,_0x1ed52d);_0x843853(null);};}for(var e in events){if(events[_0x9714('0x8')](e)){var event=events[e];VoiceExtension[_0x9714('0x9')](e,emitEvent(event));}}module[_0x9714('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 9dd8d5d..9436ab8 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 _0xec82=['recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','trunk','length','name','split','phone','prefix','${EXTEN:','${EXTEN}','param','SIP','options','U(xcally-mixmonitor-context)','replace','join','isEmpty','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','answer','queue','playback','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','outboundDial','appdata','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','Hangup','lodash','type','Set','CDR(type)=','context','exten','CDR(routeAlias)=','alias','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','cutdigits','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','XCALLY-MOTION-PROGRESS=0','outboundrouteid='];(function(_0x17b2a9,_0x357459){var _0x55affd=function(_0x46d667){while(--_0x46d667){_0x17b2a9['push'](_0x17b2a9['shift']());}};_0x55affd(++_0x357459);}(_0xec82,0x83));var _0x2ec8=function(_0x43d097,_0x104d6a){_0x43d097=_0x43d097-0x0;var _0x5c0a2d=_0xec82[_0x43d097];return _0x5c0a2d;};'use strict';var _=require(_0x2ec8('0x0'));var attributes=require('./voiceExtension.attributes');module['exports']=function(_0x17b33f){var _0x8ac598=_0x17b33f['models'];function _0xc9144c(_0x2e64ef){var _0x2e10d7=0x2;var _0x22aa5b=[{'type':_0x2e64ef[_0x2ec8('0x1')],'app':_0x2ec8('0x2'),'appdata':_0x2ec8('0x3')+_0x2e64ef[_0x2ec8('0x1')],'context':_0x2e64ef[_0x2ec8('0x4')],'exten':_0x2e64ef[_0x2ec8('0x5')],'priority':_0x2e10d7++,'VoiceExtensionId':_0x2e64ef['id']},{'type':_0x2e64ef[_0x2ec8('0x1')],'app':_0x2e64ef['alias']?_0x2ec8('0x2'):'NoOp','appdata':_0x2e64ef['alias']?_0x2ec8('0x6')+_0x2e64ef[_0x2ec8('0x7')]:'No\x20alias\x20set','context':_0x2e64ef['context'],'exten':_0x2e64ef[_0x2ec8('0x5')],'priority':_0x2e10d7++,'VoiceExtensionId':_0x2e64ef['id']}];if(_0x2e64ef[_0x2ec8('0x1')]===_0x2ec8('0x8')){_0x22aa5b[_0x2ec8('0x9')]({'type':_0x2ec8('0x8'),'app':_0x2ec8('0x2'),'appdata':_0x2ec8('0xa')+_0x2e64ef['id'],'context':_0x2e64ef['context'],'exten':_0x2e64ef[_0x2ec8('0x5')],'priority':_0x2e10d7++,'VoiceExtensionId':_0x2e64ef['id']});}_0x22aa5b[_0x2ec8('0x9')]({'type':_0x2e64ef['type'],'app':_0x2ec8('0x2'),'appdata':_0x2ec8('0xb'),'context':_0x2e64ef[_0x2ec8('0x4')],'exten':_0x2e64ef[_0x2ec8('0x5')],'priority':_0x2e10d7++,'VoiceExtensionId':_0x2e64ef['id']},{'type':_0x2e64ef[_0x2ec8('0x1')],'app':_0x2ec8('0x2'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x2e64ef[_0x2ec8('0x4')],'exten':_0x2e64ef['exten'],'priority':_0x2e10d7++,'VoiceExtensionId':_0x2e64ef['id']},{'type':_0x2e64ef[_0x2ec8('0x1')],'app':_0x2ec8('0x2'),'appdata':_0x2ec8('0xc'),'context':_0x2e64ef[_0x2ec8('0x4')],'exten':_0x2e64ef['exten'],'priority':_0x2e10d7++,'VoiceExtensionId':_0x2e64ef['id']});return _0x22aa5b;}function _0x3a33f4(_0x236f25){var _0x2a5bc1=0x2;var _0x5586c9=[{'type':'outbound','app':_0x2ec8('0x2'),'appdata':'CDR(type)=outbound','context':_0x236f25['context'],'exten':_0x236f25[_0x2ec8('0x5')],'priority':_0x2a5bc1++,'VoiceExtensionId':_0x236f25['id']},{'type':_0x2ec8('0xd'),'app':_0x236f25[_0x2ec8('0x7')]?_0x2ec8('0x2'):'NoOp','appdata':_0x236f25[_0x2ec8('0x7')]?_0x2ec8('0x6')+_0x236f25['alias']:'No\x20alias\x20set','context':_0x236f25['context'],'exten':_0x236f25['exten'],'priority':_0x2a5bc1++,'VoiceExtensionId':_0x236f25['id']},{'type':_0x2ec8('0xd'),'app':'Set','appdata':'CDR(destination)='+(_0x236f25[_0x2ec8('0xe')]?'${EXTEN:'+_0x236f25[_0x2ec8('0xe')]+'}':'${EXTEN}'),'context':_0x236f25['context'],'exten':_0x236f25[_0x2ec8('0x5')],'priority':_0x2a5bc1++,'VoiceExtensionId':_0x236f25['id']},{'type':_0x2ec8('0xd'),'app':'Set','appdata':'CDR(routeid)='+_0x236f25['id'],'context':_0x236f25[_0x2ec8('0x4')],'exten':_0x236f25[_0x2ec8('0x5')],'priority':_0x2a5bc1++,'VoiceExtensionId':_0x236f25['id']},{'type':'outbound','app':_0x2ec8('0xf'),'appdata':_0x2ec8('0x10')+(_0x2a5bc1+0x2)+_0x2ec8('0x11')+(_0x2a5bc1+0x1)+')','context':_0x236f25[_0x2ec8('0x4')],'exten':_0x236f25[_0x2ec8('0x5')],'priority':_0x2a5bc1++,'VoiceExtensionId':_0x236f25['id']},{'type':'outbound','app':_0x2ec8('0x2'),'appdata':_0x236f25[_0x2ec8('0xe')]?_0x2ec8('0x12')+_0x236f25[_0x2ec8('0xe')]+'}':'CDR(prefix)=noprefix','context':_0x236f25['context'],'exten':_0x236f25[_0x2ec8('0x5')],'priority':_0x2a5bc1++,'VoiceExtensionId':_0x236f25['id']},{'type':'outbound','app':_0x2ec8('0x2'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x236f25[_0x2ec8('0x4')],'exten':_0x236f25[_0x2ec8('0x5')],'priority':_0x2a5bc1++,'VoiceExtensionId':_0x236f25['id']},{'type':'outbound','app':'Set','appdata':_0x2ec8('0x13'),'context':_0x236f25[_0x2ec8('0x4')],'exten':_0x236f25['exten'],'priority':_0x2a5bc1++,'VoiceExtensionId':_0x236f25['id']},{'type':_0x2ec8('0xd'),'app':_0x2ec8('0x2'),'appdata':_0x2ec8('0xc'),'context':_0x236f25[_0x2ec8('0x4')],'exten':_0x236f25[_0x2ec8('0x5')],'priority':_0x2a5bc1++,'VoiceExtensionId':_0x236f25['id']},{'type':_0x2ec8('0xd'),'app':'Set','appdata':_0x2ec8('0x14')+_0x236f25['id'],'context':_0x236f25[_0x2ec8('0x4')],'exten':_0x236f25[_0x2ec8('0x5')],'priority':_0x2a5bc1++,'VoiceExtensionId':_0x236f25['id']}];if(_0x236f25['hasOwnProperty'](_0x2ec8('0x15'))&&_0x236f25[_0x2ec8('0x15')]!==_0x2ec8('0x16')){_0x5586c9['push']({'type':_0x2ec8('0xd'),'app':_0x2ec8('0x2'),'appdata':_0x2ec8('0x17'),'context':_0x236f25[_0x2ec8('0x4')],'exten':_0x236f25[_0x2ec8('0x5')],'priority':_0x2a5bc1++,'VoiceExtensionId':_0x236f25['id']},{'type':_0x2ec8('0xd'),'app':_0x2ec8('0x2'),'appdata':_0x2ec8('0x18')+_0x236f25['recordingFormat']||'wav','context':_0x236f25[_0x2ec8('0x4')],'exten':_0x236f25[_0x2ec8('0x5')],'priority':_0x2a5bc1++,'VoiceExtensionId':_0x236f25['id']});}return _0x5586c9;}function _0x1d85af(_0x3213c4,_0x26f41d){var _0x181df7=[{'name':_0x2ec8('0x19'),'param':0x0},{'name':'timeout','param':0x1},{'name':'options','param':0x2},{'name':'url','param':0x3}];var _0x37bca0={};var _0x288bfc=_0x26f41d['split'](',');var _0x5706a6=[];for(var _0x2d6f6c=0x0;_0x2d6f6c<_0x181df7[_0x2ec8('0x1a')];_0x2d6f6c++){switch(_0x181df7[_0x2d6f6c][_0x2ec8('0x1b')]){case'trunk':_0x37bca0[_0x2ec8('0x19')]=_0x288bfc[_0x181df7[_0x2d6f6c]['param']][_0x2ec8('0x1c')]('/')[0x1];_0x37bca0[_0x2ec8('0x1d')]=_0x288bfc[_0x181df7[_0x2d6f6c]['param']][_0x2ec8('0x1c')]('/')[0x2];_0x37bca0[_0x2ec8('0x1e')]=_0x37bca0[_0x2ec8('0x1d')]?_0x37bca0[_0x2ec8('0x1d')][_0x2ec8('0x1c')]('$')[0x0]:undefined;_0x37bca0[_0x2ec8('0x1d')]=_0x3213c4[_0x2ec8('0xe')]?(_0x37bca0['prefix']||'')+_0x2ec8('0x1f')+_0x3213c4['cutdigits']+'}':(_0x37bca0[_0x2ec8('0x1e')]||'')+_0x2ec8('0x20');_0x5706a6[_0x181df7[_0x2d6f6c][_0x2ec8('0x21')]]=[_0x2ec8('0x22'),_0x37bca0['trunk'],_0x37bca0[_0x2ec8('0x1d')]]['join']('/');break;case _0x2ec8('0x23'):_0x37bca0[_0x2ec8('0x23')]=_0x288bfc[_0x181df7[_0x2d6f6c][_0x2ec8('0x21')]];if(_0x3213c4['recordingFormat']!=='none'){if(_0x37bca0[_0x2ec8('0x23')]['indexOf'](_0x2ec8('0x24'))<0x0){_0x37bca0[_0x2ec8('0x23')]+='U(xcally-mixmonitor-context)';}}else{_0x37bca0[_0x2ec8('0x23')]=_0x37bca0[_0x2ec8('0x23')][_0x2ec8('0x25')]('U(xcally-mixmonitor-context)','');}_0x5706a6[_0x181df7[_0x2d6f6c][_0x2ec8('0x21')]]=_0x37bca0['options'];break;default:_0x5706a6[_0x181df7[_0x2d6f6c][_0x2ec8('0x21')]]=_0x288bfc[_0x181df7[_0x2d6f6c][_0x2ec8('0x21')]];}}return _0x5706a6[_0x2ec8('0x26')](',');}function _0x5aec9a(_0x547d88,_0x153227,_0x1a35a2){return new Promise(function(_0x1d3b72,_0xbe5f3b){var _0x437745=[];if(_[_0x2ec8('0x27')](_0x153227))return _0x1d3b72(_0x437745);_0x8ac598['Interval'][_0x2ec8('0x28')]({'attributes':['id',_0x2ec8('0x29'),_0x2ec8('0x2a')],'raw':!![]})[_0x2ec8('0x2b')](function(_0x2b4d8a){for(var _0x12731f=0x0,_0x1c7fd2=0x0;_0x12731f<_0x153227[_0x2ec8('0x1a')];_0x12731f++,_0x1c7fd2=0x0){var _0x1660b1=_0x153227[_0x12731f];var _0x40182a=[];var _0x628734=[];delete _0x1660b1['id'];if(_0x1660b1[_0x2ec8('0x29')]!==_0x2ec8('0x2c')){_0x1660b1[_0x2ec8('0x2d')]=[_0x1660b1['interval']];}else{_0x1660b1[_0x2ec8('0x2d')]=_0x1660b1[_0x2ec8('0x2a')]?_[_0x2ec8('0x2e')](_[_0x2ec8('0x2f')](_0x2b4d8a,{'IntervalId':_0x1660b1[_0x2ec8('0x2a')]}),_0x2ec8('0x29')):[];}_0x1660b1[_0x2ec8('0x4')]=_0x547d88[_0x2ec8('0x4')];_0x1660b1[_0x2ec8('0x5')]=_0x547d88['exten'];if(_0x1660b1[_0x2ec8('0x1')])_0x1660b1['type']=_0x1660b1[_0x2ec8('0x1')][_0x2ec8('0x30')]();if(_0x547d88[_0x2ec8('0x1')]===_0x2ec8('0xd')){if(_0x1660b1['hasOwnProperty'](_0x2ec8('0x31'))&&_0x1660b1[_0x2ec8('0x31')]&&_0x1660b1[_0x2ec8('0x31')]!=='--'){_0x40182a[_0x2ec8('0x9')]({'type':_0x1660b1['type'][_0x2ec8('0x30')](),'app':_0x2ec8('0x2'),'appdata':_0x2ec8('0x32')+_0x1660b1[_0x2ec8('0x31')],'context':_0x547d88[_0x2ec8('0x4')],'exten':_0x547d88[_0x2ec8('0x5')],'priority':_0x1660b1['intervals']['length']+_0x1a35a2+_0x1c7fd2++,'VoiceExtensionId':_0x547d88['id']});}_0x40182a[_0x2ec8('0x9')]({'type':_0x1660b1[_0x2ec8('0x1')][_0x2ec8('0x30')](),'app':_0x2ec8('0xf'),'appdata':_0x2ec8('0x33')+(_0x1660b1['callerID']?'Set(CALLERID(all)='+_0x1660b1[_0x2ec8('0x34')]+')':_0x2ec8('0x35')),'context':_0x547d88['context'],'exten':_0x547d88['exten'],'priority':_0x1660b1['intervals'][_0x2ec8('0x1a')]+_0x1a35a2+_0x1c7fd2++,'VoiceExtensionId':_0x547d88['id']});}else{if(_0x1660b1['hasOwnProperty'](_0x2ec8('0x36'))){if([_0x2ec8('0x37'),_0x2ec8('0x38')]['includes'](_0x1660b1[_0x2ec8('0x39')][_0x2ec8('0x30')]())&&_0x1660b1[_0x2ec8('0x3a')]!==_0x2ec8('0x3b')){if(_0x1660b1['answer']){_0x40182a[_0x2ec8('0x9')]({'type':_0x1660b1[_0x2ec8('0x1')][_0x2ec8('0x30')](),'app':'ExecIf','appdata':_0x2ec8('0x3c'),'context':_0x547d88['context'],'exten':_0x547d88[_0x2ec8('0x5')],'priority':_0x1660b1[_0x2ec8('0x2d')]['length']+_0x1a35a2+_0x1c7fd2++,'VoiceExtensionId':_0x547d88['id']});_0x40182a['push']({'type':_0x1660b1[_0x2ec8('0x1')]['toLowerCase'](),'app':_0x2ec8('0x2'),'appdata':_0x2ec8('0x3d'),'context':_0x547d88[_0x2ec8('0x4')],'exten':_0x547d88[_0x2ec8('0x5')],'priority':_0x1660b1[_0x2ec8('0x2d')]['length']+_0x1a35a2+_0x1c7fd2++,'VoiceExtensionId':_0x547d88['id']});}else{_0x40182a[_0x2ec8('0x9')]({'type':_0x1660b1['type'][_0x2ec8('0x30')](),'app':_0x2ec8('0xf'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x547d88[_0x2ec8('0x4')],'exten':_0x547d88[_0x2ec8('0x5')],'priority':_0x1660b1[_0x2ec8('0x2d')][_0x2ec8('0x1a')]+_0x1a35a2+_0x1c7fd2++,'VoiceExtensionId':_0x547d88['id']});_0x40182a[_0x2ec8('0x9')]({'type':_0x1660b1[_0x2ec8('0x1')][_0x2ec8('0x30')](),'app':_0x2ec8('0x2'),'appdata':_0x2ec8('0x3e'),'context':_0x547d88[_0x2ec8('0x4')],'exten':_0x547d88[_0x2ec8('0x5')],'priority':_0x1660b1[_0x2ec8('0x2d')][_0x2ec8('0x1a')]+_0x1a35a2+_0x1c7fd2++,'VoiceExtensionId':_0x547d88['id']});}}}}for(var _0x54090e=0x0;_0x54090e<_0x1660b1['intervals'][_0x2ec8('0x1a')];_0x54090e++){var _0x4fa91c=_0x1a35a2+_0x1660b1[_0x2ec8('0x2d')][_0x2ec8('0x1a')];var _0x5c8fa3=_0x54090e===_0x1660b1['intervals']['length']-0x1?_0x1a35a2+_0x40182a['length']+_0x628734['length']+0x2:_0x1a35a2+_0x54090e+0x1;_0x40182a[_0x2ec8('0x3f')](_0x54090e,0x0,{'type':_0x547d88['type'],'app':'GotoIfTime','appdata':_0x1660b1['intervals'][_0x54090e]+'?'+_0x547d88[_0x2ec8('0x4')]+',${EXTEN},'+_0x4fa91c+':'+_0x547d88[_0x2ec8('0x4')]+_0x2ec8('0x40')+_0x5c8fa3,'exten':_0x547d88[_0x2ec8('0x5')],'context':_0x547d88['context'],'priority':_0x1a35a2+_0x54090e,'VoiceExtensionId':_0x547d88['id']});}if(_0x1660b1['appType']===_0x2ec8('0x41'))_0x1660b1[_0x2ec8('0x42')]=_0x1d85af(_0x547d88,_0x1660b1[_0x2ec8('0x42')]);_0x1660b1[_0x2ec8('0x43')]=_0x40182a['length']?_[_0x2ec8('0x44')](_0x40182a)[_0x2ec8('0x43')]+0x1:_0x1a35a2;_0x437745=_[_0x2ec8('0x45')](_0x437745,_0x40182a,[_0x1660b1],_0x628734);_0x1a35a2=_[_0x2ec8('0x44')](_0x437745)[_0x2ec8('0x43')]+0x1;}return _0x1d3b72(_0x437745);})[_0x2ec8('0x46')](function(_0x429cf3){_0xbe5f3b(_0x429cf3);});});}return _0x17b33f[_0x2ec8('0x47')](_0x2ec8('0x48'),attributes,{'tableName':_0x2ec8('0x49'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x55a946){var _0x5af4ab=this[_0x2ec8('0x4a')]({'plain':!![]});var _0x3c20cd=_0x5af4ab[_0x2ec8('0x1')]===_0x2ec8('0xd')?_0x3a33f4(_0x5af4ab):_0xc9144c(_0x5af4ab);return _0x5aec9a(_0x5af4ab,_0x55a946,_[_0x2ec8('0x44')](_0x3c20cd)['priority']+0x1)[_0x2ec8('0x2b')](function(_0xf508d){var _0x2886ae=_['concat'](_0x3c20cd,_0xf508d);_0x2886ae[_0x2ec8('0x9')]({'type':_0x5af4ab[_0x2ec8('0x1')],'app':_0x2ec8('0x4b'),'exten':_0x5af4ab[_0x2ec8('0x5')],'context':_0x5af4ab['context'],'priority':_[_0x2ec8('0x44')](_0x2886ae)[_0x2ec8('0x43')]+0x1,'VoiceExtensionId':_0x5af4ab['id']});return _0x2886ae;});}}});}; \ No newline at end of file +var _0xc770=['hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','trunk','timeout','options','url','split','length','name','param','phone','prefix','SIP','join','U(xcally-mixmonitor-context)','Interval','findAll','interval','then','*,*,*,*','intervals','IntervalId','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','callerID','answer','playback','includes','app','custom','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','appType','outboundDial','appdata','priority','last','catch','define','VoiceExtension','get','concat','Hangup','lodash','./voiceExtension.attributes','models','type','Set','context','NoOp','alias','No\x20alias\x20set','push','inbound','CDR(routeid)=','exten','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(routeAlias)=','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0'];(function(_0x26a22a,_0x3f52e3){var _0x2b025a=function(_0x2d8d6a){while(--_0x2d8d6a){_0x26a22a['push'](_0x26a22a['shift']());}};_0x2b025a(++_0x3f52e3);}(_0xc770,0xd3));var _0x0c77=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc770[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0c77('0x0'));var attributes=require(_0x0c77('0x1'));module['exports']=function(_0x514623){var _0x36e5c9=_0x514623[_0x0c77('0x2')];function _0x3eaca5(_0x23ae87){var _0xdcfb07=0x2;var _0x18e293=[{'type':_0x23ae87[_0x0c77('0x3')],'app':_0x0c77('0x4'),'appdata':'CDR(type)='+_0x23ae87[_0x0c77('0x3')],'context':_0x23ae87[_0x0c77('0x5')],'exten':_0x23ae87['exten'],'priority':_0xdcfb07++,'VoiceExtensionId':_0x23ae87['id']},{'type':_0x23ae87[_0x0c77('0x3')],'app':_0x23ae87['alias']?_0x0c77('0x4'):_0x0c77('0x6'),'appdata':_0x23ae87[_0x0c77('0x7')]?'CDR(routeAlias)='+_0x23ae87[_0x0c77('0x7')]:_0x0c77('0x8'),'context':_0x23ae87['context'],'exten':_0x23ae87['exten'],'priority':_0xdcfb07++,'VoiceExtensionId':_0x23ae87['id']}];if(_0x23ae87[_0x0c77('0x3')]==='inbound'){_0x18e293[_0x0c77('0x9')]({'type':_0x0c77('0xa'),'app':'Set','appdata':_0x0c77('0xb')+_0x23ae87['id'],'context':_0x23ae87[_0x0c77('0x5')],'exten':_0x23ae87[_0x0c77('0xc')],'priority':_0xdcfb07++,'VoiceExtensionId':_0x23ae87['id']});}_0x18e293[_0x0c77('0x9')]({'type':_0x23ae87['type'],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x23ae87[_0x0c77('0x5')],'exten':_0x23ae87[_0x0c77('0xc')],'priority':_0xdcfb07++,'VoiceExtensionId':_0x23ae87['id']},{'type':_0x23ae87[_0x0c77('0x3')],'app':_0x0c77('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x23ae87[_0x0c77('0x5')],'exten':_0x23ae87[_0x0c77('0xc')],'priority':_0xdcfb07++,'VoiceExtensionId':_0x23ae87['id']},{'type':_0x23ae87['type'],'app':_0x0c77('0x4'),'appdata':_0x0c77('0xd'),'context':_0x23ae87['context'],'exten':_0x23ae87['exten'],'priority':_0xdcfb07++,'VoiceExtensionId':_0x23ae87['id']});return _0x18e293;}function _0x233042(_0xff27f5){var _0x5aba1e=0x2;var _0x4af65c=[{'type':_0x0c77('0xe'),'app':_0x0c77('0x4'),'appdata':_0x0c77('0xf'),'context':_0xff27f5[_0x0c77('0x5')],'exten':_0xff27f5['exten'],'priority':_0x5aba1e++,'VoiceExtensionId':_0xff27f5['id']},{'type':_0x0c77('0xe'),'app':_0xff27f5[_0x0c77('0x7')]?_0x0c77('0x4'):'NoOp','appdata':_0xff27f5[_0x0c77('0x7')]?_0x0c77('0x10')+_0xff27f5['alias']:'No\x20alias\x20set','context':_0xff27f5['context'],'exten':_0xff27f5[_0x0c77('0xc')],'priority':_0x5aba1e++,'VoiceExtensionId':_0xff27f5['id']},{'type':_0x0c77('0xe'),'app':_0x0c77('0x4'),'appdata':_0x0c77('0x11')+(_0xff27f5[_0x0c77('0x12')]?_0x0c77('0x13')+_0xff27f5[_0x0c77('0x12')]+'}':'${EXTEN}'),'context':_0xff27f5[_0x0c77('0x5')],'exten':_0xff27f5['exten'],'priority':_0x5aba1e++,'VoiceExtensionId':_0xff27f5['id']},{'type':_0x0c77('0xe'),'app':_0x0c77('0x4'),'appdata':_0x0c77('0xb')+_0xff27f5['id'],'context':_0xff27f5[_0x0c77('0x5')],'exten':_0xff27f5[_0x0c77('0xc')],'priority':_0x5aba1e++,'VoiceExtensionId':_0xff27f5['id']},{'type':_0x0c77('0xe'),'app':_0x0c77('0x14'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x5aba1e+0x2)+_0x0c77('0x15')+(_0x5aba1e+0x1)+')','context':_0xff27f5[_0x0c77('0x5')],'exten':_0xff27f5[_0x0c77('0xc')],'priority':_0x5aba1e++,'VoiceExtensionId':_0xff27f5['id']},{'type':_0x0c77('0xe'),'app':_0x0c77('0x4'),'appdata':_0xff27f5[_0x0c77('0x12')]?_0x0c77('0x16')+_0xff27f5[_0x0c77('0x12')]+'}':_0x0c77('0x17'),'context':_0xff27f5['context'],'exten':_0xff27f5['exten'],'priority':_0x5aba1e++,'VoiceExtensionId':_0xff27f5['id']},{'type':_0x0c77('0xe'),'app':'Set','appdata':_0x0c77('0x18'),'context':_0xff27f5[_0x0c77('0x5')],'exten':_0xff27f5[_0x0c77('0xc')],'priority':_0x5aba1e++,'VoiceExtensionId':_0xff27f5['id']},{'type':_0x0c77('0xe'),'app':'Set','appdata':_0x0c77('0x19'),'context':_0xff27f5['context'],'exten':_0xff27f5[_0x0c77('0xc')],'priority':_0x5aba1e++,'VoiceExtensionId':_0xff27f5['id']},{'type':'outbound','app':'Set','appdata':_0x0c77('0xd'),'context':_0xff27f5[_0x0c77('0x5')],'exten':_0xff27f5[_0x0c77('0xc')],'priority':_0x5aba1e++,'VoiceExtensionId':_0xff27f5['id']},{'type':_0x0c77('0xe'),'app':_0x0c77('0x4'),'appdata':'outboundrouteid='+_0xff27f5['id'],'context':_0xff27f5['context'],'exten':_0xff27f5['exten'],'priority':_0x5aba1e++,'VoiceExtensionId':_0xff27f5['id']}];if(_0xff27f5[_0x0c77('0x1a')]('recordingFormat')&&_0xff27f5[_0x0c77('0x1b')]!==_0x0c77('0x1c')){_0x4af65c[_0x0c77('0x9')]({'type':'outbound','app':_0x0c77('0x4'),'appdata':_0x0c77('0x1d'),'context':_0xff27f5[_0x0c77('0x5')],'exten':_0xff27f5['exten'],'priority':_0x5aba1e++,'VoiceExtensionId':_0xff27f5['id']},{'type':_0x0c77('0xe'),'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0xff27f5['recordingFormat']||_0x0c77('0x1e'),'context':_0xff27f5[_0x0c77('0x5')],'exten':_0xff27f5['exten'],'priority':_0x5aba1e++,'VoiceExtensionId':_0xff27f5['id']});}return _0x4af65c;}function _0x577866(_0x5c393b,_0x235bfe){var _0x5d683d=[{'name':_0x0c77('0x1f'),'param':0x0},{'name':_0x0c77('0x20'),'param':0x1},{'name':_0x0c77('0x21'),'param':0x2},{'name':_0x0c77('0x22'),'param':0x3}];var _0x8b5bf0={};var _0x4ad9d5=_0x235bfe[_0x0c77('0x23')](',');var _0x3a13e8=[];for(var _0x501455=0x0;_0x501455<_0x5d683d[_0x0c77('0x24')];_0x501455++){switch(_0x5d683d[_0x501455][_0x0c77('0x25')]){case _0x0c77('0x1f'):_0x8b5bf0[_0x0c77('0x1f')]=_0x4ad9d5[_0x5d683d[_0x501455][_0x0c77('0x26')]]['split']('/')[0x1];_0x8b5bf0[_0x0c77('0x27')]=_0x4ad9d5[_0x5d683d[_0x501455][_0x0c77('0x26')]][_0x0c77('0x23')]('/')[0x2];_0x8b5bf0[_0x0c77('0x28')]=_0x8b5bf0[_0x0c77('0x27')]?_0x8b5bf0[_0x0c77('0x27')][_0x0c77('0x23')]('$')[0x0]:undefined;_0x8b5bf0['phone']=_0x5c393b[_0x0c77('0x12')]?(_0x8b5bf0[_0x0c77('0x28')]||'')+_0x0c77('0x13')+_0x5c393b[_0x0c77('0x12')]+'}':(_0x8b5bf0[_0x0c77('0x28')]||'')+'${EXTEN}';_0x3a13e8[_0x5d683d[_0x501455][_0x0c77('0x26')]]=[_0x0c77('0x29'),_0x8b5bf0[_0x0c77('0x1f')],_0x8b5bf0['phone']][_0x0c77('0x2a')]('/');break;case'options':_0x8b5bf0[_0x0c77('0x21')]=_0x4ad9d5[_0x5d683d[_0x501455][_0x0c77('0x26')]];if(_0x5c393b['recordingFormat']!=='none'){if(_0x8b5bf0[_0x0c77('0x21')]['indexOf'](_0x0c77('0x2b'))<0x0){_0x8b5bf0[_0x0c77('0x21')]+=_0x0c77('0x2b');}}else{_0x8b5bf0['options']=_0x8b5bf0[_0x0c77('0x21')]['replace'](_0x0c77('0x2b'),'');}_0x3a13e8[_0x5d683d[_0x501455][_0x0c77('0x26')]]=_0x8b5bf0['options'];break;default:_0x3a13e8[_0x5d683d[_0x501455][_0x0c77('0x26')]]=_0x4ad9d5[_0x5d683d[_0x501455][_0x0c77('0x26')]];}}return _0x3a13e8[_0x0c77('0x2a')](',');}function _0x1b08a5(_0x45c49d,_0x24bdb4,_0x1fbd41){return new Promise(function(_0x1c024d,_0x402d6f){var _0x47df3c=[];if(_['isEmpty'](_0x24bdb4))return _0x1c024d(_0x47df3c);_0x36e5c9[_0x0c77('0x2c')][_0x0c77('0x2d')]({'attributes':['id',_0x0c77('0x2e'),'IntervalId'],'raw':!![]})[_0x0c77('0x2f')](function(_0x15e53e){for(var _0xb08baa=0x0,_0x423a43=0x0;_0xb08baa<_0x24bdb4[_0x0c77('0x24')];_0xb08baa++,_0x423a43=0x0){var _0x5790ca=_0x24bdb4[_0xb08baa];var _0x495c8e=[];var _0x21f9fc=[];delete _0x5790ca['id'];if(_0x5790ca[_0x0c77('0x2e')]!==_0x0c77('0x30')){_0x5790ca[_0x0c77('0x31')]=[_0x5790ca[_0x0c77('0x2e')]];}else{_0x5790ca[_0x0c77('0x31')]=_0x5790ca[_0x0c77('0x32')]?_[_0x0c77('0x33')](_[_0x0c77('0x34')](_0x15e53e,{'IntervalId':_0x5790ca[_0x0c77('0x32')]}),_0x0c77('0x2e')):[];}_0x5790ca[_0x0c77('0x5')]=_0x45c49d[_0x0c77('0x5')];_0x5790ca[_0x0c77('0xc')]=_0x45c49d[_0x0c77('0xc')];if(_0x5790ca['type'])_0x5790ca[_0x0c77('0x3')]=_0x5790ca[_0x0c77('0x3')][_0x0c77('0x35')]();if(_0x45c49d[_0x0c77('0x3')]===_0x0c77('0xe')){if(_0x5790ca[_0x0c77('0x1a')]('tag')&&_0x5790ca[_0x0c77('0x36')]&&_0x5790ca[_0x0c77('0x36')]!=='--'){_0x495c8e[_0x0c77('0x9')]({'type':_0x5790ca['type'][_0x0c77('0x35')](),'app':_0x0c77('0x4'),'appdata':_0x0c77('0x37')+_0x5790ca[_0x0c77('0x36')],'context':_0x45c49d['context'],'exten':_0x45c49d[_0x0c77('0xc')],'priority':_0x5790ca[_0x0c77('0x31')]['length']+_0x1fbd41+_0x423a43++,'VoiceExtensionId':_0x45c49d['id']});}_0x495c8e[_0x0c77('0x9')]({'type':_0x5790ca[_0x0c77('0x3')][_0x0c77('0x35')](),'app':_0x0c77('0x14'),'appdata':_0x0c77('0x38')+(_0x5790ca['callerID']?_0x0c77('0x39')+_0x5790ca[_0x0c77('0x3a')]+')':'NoOp(No\x20number\x20available)'),'context':_0x45c49d[_0x0c77('0x5')],'exten':_0x45c49d['exten'],'priority':_0x5790ca[_0x0c77('0x31')]['length']+_0x1fbd41+_0x423a43++,'VoiceExtensionId':_0x45c49d['id']});}else{if(_0x5790ca['hasOwnProperty'](_0x0c77('0x3b'))){if(['queue',_0x0c77('0x3c')][_0x0c77('0x3d')](_0x5790ca[_0x0c77('0x3e')][_0x0c77('0x35')]())&&_0x5790ca['appType']!==_0x0c77('0x3f')){if(_0x5790ca[_0x0c77('0x3b')]){_0x495c8e[_0x0c77('0x9')]({'type':_0x5790ca[_0x0c77('0x3')][_0x0c77('0x35')](),'app':_0x0c77('0x14'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x45c49d[_0x0c77('0x5')],'exten':_0x45c49d[_0x0c77('0xc')],'priority':_0x5790ca[_0x0c77('0x31')]['length']+_0x1fbd41+_0x423a43++,'VoiceExtensionId':_0x45c49d['id']});_0x495c8e[_0x0c77('0x9')]({'type':_0x5790ca[_0x0c77('0x3')][_0x0c77('0x35')](),'app':_0x0c77('0x4'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x45c49d[_0x0c77('0x5')],'exten':_0x45c49d[_0x0c77('0xc')],'priority':_0x5790ca[_0x0c77('0x31')][_0x0c77('0x24')]+_0x1fbd41+_0x423a43++,'VoiceExtensionId':_0x45c49d['id']});}else{_0x495c8e['push']({'type':_0x5790ca[_0x0c77('0x3')][_0x0c77('0x35')](),'app':_0x0c77('0x14'),'appdata':_0x0c77('0x40'),'context':_0x45c49d[_0x0c77('0x5')],'exten':_0x45c49d[_0x0c77('0xc')],'priority':_0x5790ca[_0x0c77('0x31')][_0x0c77('0x24')]+_0x1fbd41+_0x423a43++,'VoiceExtensionId':_0x45c49d['id']});_0x495c8e['push']({'type':_0x5790ca[_0x0c77('0x3')][_0x0c77('0x35')](),'app':_0x0c77('0x4'),'appdata':_0x0c77('0x41'),'context':_0x45c49d[_0x0c77('0x5')],'exten':_0x45c49d[_0x0c77('0xc')],'priority':_0x5790ca['intervals'][_0x0c77('0x24')]+_0x1fbd41+_0x423a43++,'VoiceExtensionId':_0x45c49d['id']});}}}}for(var _0x167282=0x0;_0x167282<_0x5790ca[_0x0c77('0x31')]['length'];_0x167282++){var _0x320022=_0x1fbd41+_0x5790ca[_0x0c77('0x31')][_0x0c77('0x24')];var _0x1852d7=_0x167282===_0x5790ca['intervals'][_0x0c77('0x24')]-0x1?_0x1fbd41+_0x495c8e[_0x0c77('0x24')]+_0x21f9fc[_0x0c77('0x24')]+0x2:_0x1fbd41+_0x167282+0x1;_0x495c8e['splice'](_0x167282,0x0,{'type':_0x45c49d['type'],'app':_0x0c77('0x42'),'appdata':_0x5790ca[_0x0c77('0x31')][_0x167282]+'?'+_0x45c49d['context']+_0x0c77('0x43')+_0x320022+':'+_0x45c49d[_0x0c77('0x5')]+_0x0c77('0x43')+_0x1852d7,'exten':_0x45c49d[_0x0c77('0xc')],'context':_0x45c49d[_0x0c77('0x5')],'priority':_0x1fbd41+_0x167282,'VoiceExtensionId':_0x45c49d['id']});}if(_0x5790ca[_0x0c77('0x44')]===_0x0c77('0x45'))_0x5790ca['appdata']=_0x577866(_0x45c49d,_0x5790ca[_0x0c77('0x46')]);_0x5790ca[_0x0c77('0x47')]=_0x495c8e['length']?_[_0x0c77('0x48')](_0x495c8e)[_0x0c77('0x47')]+0x1:_0x1fbd41;_0x47df3c=_['concat'](_0x47df3c,_0x495c8e,[_0x5790ca],_0x21f9fc);_0x1fbd41=_[_0x0c77('0x48')](_0x47df3c)['priority']+0x1;}return _0x1c024d(_0x47df3c);})[_0x0c77('0x49')](function(_0x1a15d6){_0x402d6f(_0x1a15d6);});});}return _0x514623[_0x0c77('0x4a')](_0x0c77('0x4b'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x1975d1){var _0x18a435=this[_0x0c77('0x4c')]({'plain':!![]});var _0x1fdbcf=_0x18a435[_0x0c77('0x3')]==='outbound'?_0x233042(_0x18a435):_0x3eaca5(_0x18a435);return _0x1b08a5(_0x18a435,_0x1975d1,_[_0x0c77('0x48')](_0x1fdbcf)[_0x0c77('0x47')]+0x1)[_0x0c77('0x2f')](function(_0x5f10ba){var _0x42391d=_[_0x0c77('0x4d')](_0x1fdbcf,_0x5f10ba);_0x42391d[_0x0c77('0x9')]({'type':_0x18a435[_0x0c77('0x3')],'app':_0x0c77('0x4e'),'exten':_0x18a435[_0x0c77('0xc')],'context':_0x18a435[_0x0c77('0x5')],'priority':_['last'](_0x42391d)[_0x0c77('0x47')]+0x1,'VoiceExtensionId':_0x18a435['id']});return _0x42391d;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 6493744..eec7de8 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 _0x5a63=['GetVoiceExtension','findAll','options','raw','attributes','limit','include','map','model','then','stringify','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','localhost','redis','./voiceExtension.socket','register','request','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch'];(function(_0xc0dc9b,_0x249a98){var _0x1c832f=function(_0x4c430f){while(--_0x4c430f){_0xc0dc9b['push'](_0xc0dc9b['shift']());}};_0x1c832f(++_0x249a98);}(_0x5a63,0xe3));var _0x35a6=function(_0x281a78,_0x2b0e82){_0x281a78=_0x281a78-0x0;var _0xe5f8c4=_0x5a63[_0x281a78];return _0xe5f8c4;};'use strict';var _=require(_0x35a6('0x0'));var util=require(_0x35a6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x35a6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x35a6('0x3'));var logger=require(_0x35a6('0x4'))(_0x35a6('0x5'));var config=require(_0x35a6('0x6'));var jayson=require(_0x35a6('0x7'));var client=jayson['client'][_0x35a6('0x8')]({'port':0x232a});config['redis']=_[_0x35a6('0x9')](config['redis'],{'host':_0x35a6('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x35a6('0xb')]));require(_0x35a6('0xc'))[_0x35a6('0xd')](socket);function respondWithRpcPromise(_0x44d0d5,_0x1df564,_0x4e4c93){return new BPromise(function(_0x2899a8,_0xf55896){return client[_0x35a6('0xe')](_0x44d0d5,_0x4e4c93)['then'](function(_0x24afc4){logger['info'](_0x35a6('0xf'),_0x1df564,_0x35a6('0x10'));logger[_0x35a6('0x11')](_0x35a6('0x12'),_0x1df564,_0x35a6('0x10'),JSON['stringify'](_0x24afc4));if(_0x24afc4[_0x35a6('0x13')]){if(_0x24afc4[_0x35a6('0x13')][_0x35a6('0x14')]===0x1f4){logger[_0x35a6('0x13')](_0x35a6('0xf'),_0x1df564,_0x24afc4[_0x35a6('0x13')]['message']);return _0xf55896(_0x24afc4[_0x35a6('0x13')][_0x35a6('0x15')]);}logger[_0x35a6('0x13')](_0x35a6('0xf'),_0x1df564,_0x24afc4[_0x35a6('0x13')][_0x35a6('0x15')]);return _0x2899a8(_0x24afc4['error'][_0x35a6('0x15')]);}else{logger[_0x35a6('0x16')](_0x35a6('0xf'),_0x1df564,_0x35a6('0x10'));_0x2899a8(_0x24afc4[_0x35a6('0x17')][_0x35a6('0x15')]);}})[_0x35a6('0x18')](function(_0x5818e0){logger[_0x35a6('0x13')](_0x35a6('0xf'),_0x1df564,_0x5818e0);_0xf55896(_0x5818e0);});});}exports[_0x35a6('0x19')]=function(_0x5d82c0){var _0x3dbf65=this;return new Promise(function(_0x32a260,_0x3183eb){return db['VoiceExtension'][_0x35a6('0x1a')]({'raw':_0x5d82c0[_0x35a6('0x1b')]?_0x5d82c0['options'][_0x35a6('0x1c')]===undefined?!![]:![]:!![],'where':_0x5d82c0[_0x35a6('0x1b')]?_0x5d82c0['options']['where']||null:null,'attributes':_0x5d82c0[_0x35a6('0x1b')]?_0x5d82c0[_0x35a6('0x1b')][_0x35a6('0x1d')]||null:null,'limit':_0x5d82c0[_0x35a6('0x1b')]?_0x5d82c0[_0x35a6('0x1b')][_0x35a6('0x1e')]||null:null,'include':_0x5d82c0[_0x35a6('0x1b')]?_0x5d82c0[_0x35a6('0x1b')][_0x35a6('0x1f')]?_[_0x35a6('0x20')](_0x5d82c0[_0x35a6('0x1b')][_0x35a6('0x1f')],function(_0x5e9a69){return{'model':db[_0x5e9a69[_0x35a6('0x21')]],'as':_0x5e9a69['as'],'attributes':_0x5e9a69[_0x35a6('0x1d')],'include':_0x5e9a69['include']?_['map'](_0x5e9a69[_0x35a6('0x1f')],function(_0x287c0b){return{'model':db[_0x287c0b[_0x35a6('0x21')]],'as':_0x287c0b['as'],'attributes':_0x287c0b['attributes'],'include':_0x287c0b[_0x35a6('0x1f')]?_[_0x35a6('0x20')](_0x287c0b[_0x35a6('0x1f')],function(_0x422ca0){return{'model':db[_0x422ca0['model']],'as':_0x422ca0['as'],'attributes':_0x422ca0[_0x35a6('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x35a6('0x22')](function(_0x1bdbe2){logger[_0x35a6('0x16')]('GetVoiceExtension',_0x5d82c0);logger['debug'](_0x35a6('0x19'),_0x5d82c0,JSON[_0x35a6('0x23')](_0x1bdbe2));_0x32a260(_0x1bdbe2);})[_0x35a6('0x18')](function(_0x2a0719){logger[_0x35a6('0x13')](_0x35a6('0x19'),_0x2a0719[_0x35a6('0x15')],_0x5d82c0);_0x3183eb(_0x3dbf65[_0x35a6('0x13')](0x1f4,_0x2a0719[_0x35a6('0x15')]));});});}; \ No newline at end of file +var _0x49df=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','info','request\x20sent','error','code','VoiceExtension,\x20%s,\x20%s','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','where','attributes','include','map','model','then','debug','stringify','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3ec416,_0x2c7d93){var _0x3b4df6=function(_0x105f09){while(--_0x105f09){_0x3ec416['push'](_0x3ec416['shift']());}};_0x3b4df6(++_0x2c7d93);}(_0x49df,0xad));var _0xf49d=function(_0x4f3b10,_0x35cc88){_0x4f3b10=_0x4f3b10-0x0;var _0x454404=_0x49df[_0x4f3b10];return _0x454404;};'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('./voiceExtension.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')]('VoiceExtension,\x20%s,\x20%s',_0x4a8ad3,_0xf49d('0x11'));logger['debug']('VoiceExtension,\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')]({'raw':_0x416a9f[_0xf49d('0x1b')]?_0x416a9f[_0xf49d('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x416a9f['options']?_0x416a9f[_0xf49d('0x1b')][_0xf49d('0x1c')]||null:null,'attributes':_0x416a9f['options']?_0x416a9f['options'][_0xf49d('0x1d')]||null:null,'limit':_0x416a9f[_0xf49d('0x1b')]?_0x416a9f['options']['limit']||null:null,'include':_0x416a9f[_0xf49d('0x1b')]?_0x416a9f['options'][_0xf49d('0x1e')]?_[_0xf49d('0x1f')](_0x416a9f[_0xf49d('0x1b')][_0xf49d('0x1e')],function(_0x4d909d){return{'model':db[_0x4d909d[_0xf49d('0x20')]],'as':_0x4d909d['as'],'attributes':_0x4d909d[_0xf49d('0x1d')],'include':_0x4d909d[_0xf49d('0x1e')]?_[_0xf49d('0x1f')](_0x4d909d[_0xf49d('0x1e')],function(_0x325e60){return{'model':db[_0x325e60[_0xf49d('0x20')]],'as':_0x325e60['as'],'attributes':_0x325e60[_0xf49d('0x1d')],'include':_0x325e60[_0xf49d('0x1e')]?_[_0xf49d('0x1f')](_0x325e60['include'],function(_0x516d70){return{'model':db[_0x516d70[_0xf49d('0x20')]],'as':_0x516d70['as'],'attributes':_0x516d70[_0xf49d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf49d('0x21')](function(_0x1c5cf3){logger[_0xf49d('0x10')](_0xf49d('0x18'),_0x416a9f);logger[_0xf49d('0x22')]('GetVoiceExtension',_0x416a9f,JSON[_0xf49d('0x23')](_0x1c5cf3));_0x45c16e(_0x1c5cf3);})[_0xf49d('0x17')](function(_0x17eb47){logger[_0xf49d('0x12')](_0xf49d('0x18'),_0x17eb47[_0xf49d('0x15')],_0x416a9f);_0x199f35(_0x67d3af[_0xf49d('0x12')](0x1f4,_0x17eb47[_0xf49d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 3f498c1..b22bacf 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 _0x1261=['save','remove','update','emit','removeListener','voiceExtension:'];(function(_0x2dfbc8,_0x350ba8){var _0x52830c=function(_0x45a9f9){while(--_0x45a9f9){_0x2dfbc8['push'](_0x2dfbc8['shift']());}};_0x52830c(++_0x350ba8);}(_0x1261,0x144));var _0x1126=function(_0xd7b7c4,_0x3bde33){_0xd7b7c4=_0xd7b7c4-0x0;var _0x3701d4=_0x1261[_0xd7b7c4];return _0x3701d4;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0x1126('0x0'),_0x1126('0x1'),_0x1126('0x2')];function createListener(_0x331a2c,_0x39b786){return function(_0x350f3a){_0x39b786[_0x1126('0x3')](_0x331a2c,_0x350f3a);};}function removeListener(_0x4245ca,_0x21a480){return function(){VoiceExtensionEvents[_0x1126('0x4')](_0x4245ca,_0x21a480);};}exports['register']=function(_0x5c68c8){for(var _0x40ba58=0x0,_0x907180=events['length'];_0x40ba58<_0x907180;_0x40ba58++){var _0x17e5f0=events[_0x40ba58];var _0x28772d=createListener(_0x1126('0x5')+_0x17e5f0,_0x5c68c8);VoiceExtensionEvents['on'](_0x17e5f0,_0x28772d);}}; \ No newline at end of file +var _0x1261=['save','remove','update','emit','removeListener','voiceExtension:'];(function(_0x37a8f9,_0x24f1b7){var _0x11a600=function(_0x4d2b80){while(--_0x4d2b80){_0x37a8f9['push'](_0x37a8f9['shift']());}};_0x11a600(++_0x24f1b7);}(_0x1261,0x144));var _0x1126=function(_0x37ca5f,_0x7b93d4){_0x37ca5f=_0x37ca5f-0x0;var _0x4b0676=_0x1261[_0x37ca5f];return _0x4b0676;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0x1126('0x0'),_0x1126('0x1'),_0x1126('0x2')];function createListener(_0x331a2c,_0x39b786){return function(_0x350f3a){_0x39b786[_0x1126('0x3')](_0x331a2c,_0x350f3a);};}function removeListener(_0x4245ca,_0x21a480){return function(){VoiceExtensionEvents[_0x1126('0x4')](_0x4245ca,_0x21a480);};}exports['register']=function(_0x5c68c8){for(var _0x40ba58=0x0,_0x907180=events['length'];_0x40ba58<_0x907180;_0x40ba58++){var _0x17e5f0=events[_0x40ba58];var _0x28772d=createListener(_0x1126('0x5')+_0x17e5f0,_0x5c68c8);VoiceExtensionEvents['on'](_0x17e5f0,_0x28772d);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 1ba16bd..fbb40ce 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 _0x741c=['get','isAuthenticated','index','/:id','/:id/messages','getMessages','create','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./voiceMail.controller'];(function(_0x444209,_0x274875){var _0x4cedd6=function(_0x141954){while(--_0x141954){_0x444209['push'](_0x444209['shift']());}};_0x4cedd6(++_0x274875);}(_0x741c,0x196));var _0xc741=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x741c[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xc741('0x0'));var util=require(_0xc741('0x1'));var path=require(_0xc741('0x2'));var timeout=require(_0xc741('0x3'));var express=require(_0xc741('0x4'));var router=express[_0xc741('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc741('0x6'));var config=require('../../config/environment');var controller=require(_0xc741('0x7'));router[_0xc741('0x8')]('/',auth[_0xc741('0x9')](),controller[_0xc741('0xa')]);router[_0xc741('0x8')](_0xc741('0xb'),auth[_0xc741('0x9')](),controller['show']);router[_0xc741('0x8')](_0xc741('0xc'),auth['isAuthenticated'](),controller[_0xc741('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc741('0xe')]);router[_0xc741('0xf')](_0xc741('0xb'),auth[_0xc741('0x9')](),controller[_0xc741('0x10')]);router[_0xc741('0x11')](_0xc741('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0a6b=['fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','isAuthenticated','index','/:id','show','getMessages','post','create','delete','destroy','exports','multer','express'];(function(_0x244c18,_0x311450){var _0x4617a8=function(_0x2937b1){while(--_0x2937b1){_0x244c18['push'](_0x244c18['shift']());}};_0x4617a8(++_0x311450);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x599318,_0x319486){_0x599318=_0x599318-0x0;var _0x7b06fa=_0x0a6b[_0x599318];return _0x7b06fa;};'use strict';var multer=require(_0xb0a6('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb0a6('0x1'));var router=express['Router']();var fs_extra=require(_0xb0a6('0x2'));var auth=require(_0xb0a6('0x3'));var interaction=require(_0xb0a6('0x4'));var config=require('../../config/environment');var controller=require(_0xb0a6('0x5'));router['get']('/',auth[_0xb0a6('0x6')](),controller[_0xb0a6('0x7')]);router['get'](_0xb0a6('0x8'),auth[_0xb0a6('0x6')](),controller[_0xb0a6('0x9')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0xb0a6('0xa')]);router[_0xb0a6('0xb')]('/',auth[_0xb0a6('0x6')](),controller[_0xb0a6('0xc')]);router['put'](_0xb0a6('0x8'),auth[_0xb0a6('0x6')](),controller['update']);router[_0xb0a6('0xd')](_0xb0a6('0x8'),auth[_0xb0a6('0x6')](),controller[_0xb0a6('0xe')]);module[_0xb0a6('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 105ba26..41a40b2 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 _0xb9a6=['getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','email','trim','central','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL'];(function(_0x1c8c1b,_0x13290b){var _0x192357=function(_0x5756e4){while(--_0x5756e4){_0x1c8c1b['push'](_0x1c8c1b['shift']());}};_0x192357(++_0x13290b);}(_0xb9a6,0x103));var _0x6b9a=function(_0x58d4af,_0x15cfde){_0x58d4af=_0x58d4af-0x0;var _0x5b7068=_0xb9a6[_0x58d4af];return _0x5b7068;};'use strict';var Sequelize=require(_0x6b9a('0x0'));module[_0x6b9a('0x1')]={'customer_id':{'type':Sequelize[_0x6b9a('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x6b9a('0x3'),'unique':_0x6b9a('0x4')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x6b9a('0x4')},'password':{'type':Sequelize[_0x6b9a('0x2')]},'fullname':{'type':Sequelize[_0x6b9a('0x2')]},'email':{'type':Sequelize[_0x6b9a('0x2')],'validate':{'isEmail':!![]},'set':function(_0x345263){this['setDataValue'](_0x6b9a('0x5'),typeof _0x345263==='string'&&_0x345263[_0x6b9a('0x6')]()?_0x345263[_0x6b9a('0x6')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x6b9a('0x2')],'defaultValue':_0x6b9a('0x7')},'attach':{'type':Sequelize[_0x6b9a('0x8')](_0x6b9a('0x9'),'no'),'defaultValue':_0x6b9a('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x6b9a('0x8')](_0x6b9a('0x9'),'no'),'defaultValue':_0x6b9a('0x9'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x6b9a('0x2')]},'review':{'type':Sequelize[_0x6b9a('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x6b9a('0x8')](_0x6b9a('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x6b9a('0x8')](_0x6b9a('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x6b9a('0x8')](_0x6b9a('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x6b9a('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x6b9a('0x8')](_0x6b9a('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x6b9a('0x8')](_0x6b9a('0x9'),'no'),'defaultValue':_0x6b9a('0x9'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x6b9a('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x6b9a('0x8')](_0x6b9a('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x6b9a('0x8')](_0x6b9a('0x9'),'no'),'defaultValue':_0x6b9a('0x9'),'allowNull':![]},'stamp':{'type':_0x6b9a('0xa')},'emailsubject':{'type':Sequelize[_0x6b9a('0x2')]},'emailbody':{'type':Sequelize[_0x6b9a('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x6b9a('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x6b9a('0xc')],'get':function(){return this[_0x6b9a('0xd')](_0x6b9a('0xe'))+_0x6b9a('0xf')+this[_0x6b9a('0xd')](_0x6b9a('0x10'));}}}; \ No newline at end of file +var _0x960e=['contest_mailbox','setDataValue','string','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail'];(function(_0x3537e1,_0xbc7714){var _0x164a50=function(_0x57c2d1){while(--_0x57c2d1){_0x3537e1['push'](_0x3537e1['shift']());}};_0x164a50(++_0xbc7714);}(_0x960e,0x150));var _0xe960=function(_0x318e2f,_0x417a4a){_0x318e2f=_0x318e2f-0x0;var _0x707a94=_0x960e[_0x318e2f];return _0x707a94;};'use strict';var Sequelize=require(_0xe960('0x0'));module[_0xe960('0x1')]={'customer_id':{'type':Sequelize[_0xe960('0x2')]},'context':{'type':Sequelize[_0xe960('0x2')],'defaultValue':_0xe960('0x3'),'unique':_0xe960('0x4')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xe960('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xe960('0x2')],'validate':{'isEmail':!![]},'set':function(_0x3be738){this[_0xe960('0x5')]('email',typeof _0x3be738===_0xe960('0x6')&&_0x3be738['trim']()?_0x3be738['trim']():null);}},'pager':{'type':Sequelize[_0xe960('0x2')]},'tz':{'type':Sequelize[_0xe960('0x2')],'defaultValue':_0xe960('0x7')},'attach':{'type':Sequelize[_0xe960('0x8')](_0xe960('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0xe960('0x8')](_0xe960('0x9'),'no'),'defaultValue':_0xe960('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0xe960('0x2')]},'callback':{'type':Sequelize[_0xe960('0x2')]},'review':{'type':Sequelize[_0xe960('0x8')](_0xe960('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xe960('0x8')](_0xe960('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0xe960('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xe960('0x8')](_0xe960('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xe960('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0xe960('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xe960('0x8')](_0xe960('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xe960('0x8')](_0xe960('0x9'),'no'),'defaultValue':_0xe960('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0xe960('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xe960('0x8')](_0xe960('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0xe960('0x9'),'no'),'defaultValue':_0xe960('0x9'),'allowNull':![]},'stamp':{'type':_0xe960('0xb')},'emailsubject':{'type':Sequelize[_0xe960('0x2')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0xe960('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xe960('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xe960('0xd')],'get':function(){return this[_0xe960('0xe')]('fullname')+_0xe960('0xf')+this[_0xe960('0xe')](_0xe960('0x10'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index ece2f44..588b21c 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 _0xed3c=['body','getMessages','findOne','order','sort','mailbox','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','save','update','then','destroy','get','UserProfileResource','end','stack','name','send','index','map','VoiceMail','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Voicemails','UserProfileSection','userProfileId','autoAssociation'];(function(_0x406ea8,_0x1c159d){var _0x14f4bc=function(_0xdba986){while(--_0xdba986){_0x406ea8['push'](_0x406ea8['shift']());}};_0x14f4bc(++_0x1c159d);}(_0xed3c,0x1a6));var _0xced3=function(_0x573f83,_0x1f3cd3){_0x573f83=_0x573f83-0x0;var _0xe89cd1=_0xed3c[_0x573f83];return _0xe89cd1;};'use strict';var emlformat=require(_0xced3('0x0'));var rimraf=require(_0xced3('0x1'));var zipdir=require(_0xced3('0x2'));var jsonpatch=require(_0xced3('0x3'));var rp=require('request-promise');var moment=require(_0xced3('0x4'));var BPromise=require(_0xced3('0x5'));var Mustache=require(_0xced3('0x6'));var util=require('util');var path=require('path');var sox=require(_0xced3('0x7'));var csv=require(_0xced3('0x8'));var ejs=require(_0xced3('0x9'));var fs=require('fs');var fs_extra=require(_0xced3('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xced3('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xced3('0xc'));var Redis=require(_0xced3('0xd'));var authService=require(_0xced3('0xe'));var qs=require(_0xced3('0xf'));var as=require(_0xced3('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xced3('0x11'))(_0xced3('0x12'));var utils=require(_0xced3('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xced3('0x14'));var db=require(_0xced3('0x15'))['db'];function respondWithStatusCode(_0x42d879,_0x3b2ac4){_0x3b2ac4=_0x3b2ac4||0xcc;return function(_0x457caf){if(_0x457caf){return _0x42d879[_0xced3('0x16')](_0x3b2ac4);}return _0x42d879[_0xced3('0x17')](_0x3b2ac4)['end']();};}function respondWithResult(_0x65bb58,_0x5e186e){_0x5e186e=_0x5e186e||0xc8;return function(_0xf2db6f){if(_0xf2db6f){return _0x65bb58[_0xced3('0x17')](_0x5e186e)[_0xced3('0x18')](_0xf2db6f);}};}function respondWithFilteredResult(_0x39e4aa,_0x4dd4c3){return function(_0x146a21){if(_0x146a21){var _0x322c2d=typeof _0x4dd4c3['offset']===_0xced3('0x19')&&typeof _0x4dd4c3[_0xced3('0x1a')]===_0xced3('0x19');var _0x17f611=_0x146a21['count'];var _0x4569af=_0x322c2d?0x0:_0x4dd4c3['offset'];var _0x353580=_0x322c2d?_0x146a21[_0xced3('0x1b')]:_0x4dd4c3[_0xced3('0x1c')]+_0x4dd4c3[_0xced3('0x1a')];var _0x44143f;if(_0x353580>=_0x17f611){_0x353580=_0x17f611;_0x44143f=0xc8;}else{_0x44143f=0xce;}_0x39e4aa[_0xced3('0x17')](_0x44143f);return _0x39e4aa[_0xced3('0x1d')](_0xced3('0x1e'),_0x4569af+'-'+_0x353580+'/'+_0x17f611)[_0xced3('0x18')](_0x146a21);}return null;};}function patchUpdates(_0x17c011){return function(_0x2008f2){try{jsonpatch['apply'](_0x2008f2,_0x17c011,!![]);}catch(_0x5b8b1f){return BPromise['reject'](_0x5b8b1f);}return _0x2008f2[_0xced3('0x1f')]();};}function saveUpdates(_0x342b9e,_0x21e074){return function(_0x4bf915){if(_0x4bf915){return _0x4bf915[_0xced3('0x20')](_0x342b9e)[_0xced3('0x21')](function(_0x526854){return _0x526854;});}return null;};}function removeEntity(_0x559fa2,_0x3adf14){return function(_0x101708){if(_0x101708){return _0x101708[_0xced3('0x22')]()[_0xced3('0x21')](function(){var _0x50f7c1=_0x101708[_0xced3('0x23')]({'plain':!![]});var _0x23f92b='Voicemails';return db[_0xced3('0x24')]['destroy']({'where':{'type':_0x23f92b,'resourceId':_0x50f7c1['id']}})[_0xced3('0x21')](function(){return _0x101708;});})[_0xced3('0x21')](function(){_0x559fa2[_0xced3('0x17')](0xcc)[_0xced3('0x25')]();});}};}function handleEntityNotFound(_0x2ec2c4,_0x502cf1){return function(_0x5454c0){if(!_0x5454c0){_0x2ec2c4[_0xced3('0x16')](0x194);}return _0x5454c0;};}function handleError(_0x5bb425,_0x2ab8a8){_0x2ab8a8=_0x2ab8a8||0x1f4;return function(_0x1e6923){logger['error'](_0x1e6923[_0xced3('0x26')]);if(_0x1e6923[_0xced3('0x27')]){delete _0x1e6923[_0xced3('0x27')];}_0x5bb425[_0xced3('0x17')](_0x2ab8a8)[_0xced3('0x28')](_0x1e6923);};}exports[_0xced3('0x29')]=function(_0x895a32,_0x41d003){var _0x116cc7={},_0x559b8e={},_0xa78899={'count':0x0,'rows':[]};var _0x1b8baa=_[_0xced3('0x2a')](db[_0xced3('0x2b')][_0xced3('0x2c')],function(_0x21e4a2){return{'name':_0x21e4a2[_0xced3('0x2d')],'type':_0x21e4a2[_0xced3('0x2e')][_0xced3('0x2f')]};});_0x559b8e[_0xced3('0x30')]=_[_0xced3('0x2a')](_0x1b8baa,_0xced3('0x27'));_0x559b8e[_0xced3('0x31')]=_[_0xced3('0x32')](_0x895a32[_0xced3('0x31')]);_0x559b8e[_0xced3('0x33')]=_[_0xced3('0x34')](_0x559b8e[_0xced3('0x30')],_0x559b8e[_0xced3('0x31')]);_0x116cc7[_0xced3('0x35')]=_[_0xced3('0x34')](_0x559b8e['model'],qs[_0xced3('0x36')](_0x895a32['query'][_0xced3('0x36')]));_0x116cc7[_0xced3('0x35')]=_0x116cc7[_0xced3('0x35')][_0xced3('0x37')]?_0x116cc7[_0xced3('0x35')]:_0x559b8e[_0xced3('0x30')];if(!_0x895a32[_0xced3('0x31')][_0xced3('0x38')](_0xced3('0x39'))){_0x116cc7[_0xced3('0x1a')]=qs['limit'](_0x895a32[_0xced3('0x31')][_0xced3('0x1a')]);_0x116cc7['offset']=qs[_0xced3('0x1c')](_0x895a32[_0xced3('0x31')][_0xced3('0x1c')]);}_0x116cc7['order']=qs['sort'](_0x895a32[_0xced3('0x31')]['sort']);_0x116cc7[_0xced3('0x3a')]=qs[_0xced3('0x33')](_['pick'](_0x895a32[_0xced3('0x31')],_0x559b8e[_0xced3('0x33')]),_0x1b8baa);if(_0x895a32[_0xced3('0x31')]['filter']){_0x116cc7[_0xced3('0x3a')]=_['merge'](_0x116cc7['where'],{'$or':_[_0xced3('0x2a')](_0x1b8baa,function(_0x31e281){if(_0x31e281[_0xced3('0x2e')]!=='VIRTUAL'){var _0xb2cf20={};_0xb2cf20[_0x31e281[_0xced3('0x27')]]={'$like':'%'+_0x895a32[_0xced3('0x31')][_0xced3('0x3b')]+'%'};return _0xb2cf20;}})});}_0x116cc7=_[_0xced3('0x3c')]({},_0x116cc7,_0x895a32[_0xced3('0x3d')]);var _0x30e890={'where':_0x116cc7[_0xced3('0x3a')]};return db[_0xced3('0x2b')][_0xced3('0x1b')](_0x30e890)[_0xced3('0x21')](function(_0x38855f){_0xa78899[_0xced3('0x1b')]=_0x38855f;if(_0x895a32[_0xced3('0x31')][_0xced3('0x3e')]){_0x116cc7['include']=[{'all':!![]}];}return db[_0xced3('0x2b')][_0xced3('0x3f')](_0x116cc7);})[_0xced3('0x21')](function(_0x1a6c1f){_0xa78899[_0xced3('0x40')]=_0x1a6c1f;return _0xa78899;})[_0xced3('0x21')](respondWithFilteredResult(_0x41d003,_0x116cc7))[_0xced3('0x41')](handleError(_0x41d003,null));};exports[_0xced3('0x42')]=function(_0x1ab7e0,_0x4cea5c){var _0x6c0238={'raw':!![],'where':{'id':_0x1ab7e0[_0xced3('0x43')]['id']}},_0x47ab23={};_0x47ab23[_0xced3('0x30')]=_[_0xced3('0x32')](db['VoiceMail'][_0xced3('0x2c')]);_0x47ab23[_0xced3('0x31')]=_[_0xced3('0x32')](_0x1ab7e0[_0xced3('0x31')]);_0x47ab23['filters']=_[_0xced3('0x34')](_0x47ab23[_0xced3('0x30')],_0x47ab23[_0xced3('0x31')]);_0x6c0238[_0xced3('0x35')]=_[_0xced3('0x34')](_0x47ab23['model'],qs[_0xced3('0x36')](_0x1ab7e0[_0xced3('0x31')][_0xced3('0x36')]));_0x6c0238[_0xced3('0x35')]=_0x6c0238[_0xced3('0x35')][_0xced3('0x37')]?_0x6c0238[_0xced3('0x35')]:_0x47ab23['model'];if(_0x1ab7e0[_0xced3('0x31')][_0xced3('0x3e')]){_0x6c0238['include']=[{'all':!![]}];}_0x6c0238=_['merge']({},_0x6c0238,_0x1ab7e0[_0xced3('0x3d')]);return db['VoiceMail'][_0xced3('0x44')](_0x6c0238)[_0xced3('0x21')](handleEntityNotFound(_0x4cea5c,null))[_0xced3('0x21')](respondWithResult(_0x4cea5c,null))[_0xced3('0x41')](handleError(_0x4cea5c,null));};exports[_0xced3('0x45')]=function(_0x1b3396,_0x3700ed){return db[_0xced3('0x2b')][_0xced3('0x45')](_0x1b3396['body'],{})[_0xced3('0x21')](function(_0x8df206){var _0x2aa876=_0x1b3396[_0xced3('0x46')][_0xced3('0x23')]({'plain':!![]});if(!_0x2aa876)throw new Error(_0xced3('0x47'));if(_0x2aa876['role']===_0xced3('0x46')){var _0x629ecf=_0x8df206[_0xced3('0x23')]({'plain':!![]});var _0x409da0=_0xced3('0x48');return db[_0xced3('0x49')][_0xced3('0x44')]({'where':{'name':_0x409da0,'userProfileId':_0x2aa876[_0xced3('0x4a')]},'raw':!![]})[_0xced3('0x21')](function(_0x44d779){if(_0x44d779&&_0x44d779[_0xced3('0x4b')]===0x0){return db[_0xced3('0x24')]['create']({'name':_0x629ecf[_0xced3('0x27')],'resourceId':_0x629ecf['id'],'type':_0x44d779['name'],'sectionId':_0x44d779['id']},{})[_0xced3('0x21')](function(){return _0x8df206;});}else{return _0x8df206;}})[_0xced3('0x41')](function(_0xc93e05){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc93e05);throw _0xc93e05;});}return _0x8df206;})[_0xced3('0x21')](respondWithResult(_0x3700ed,0xc9))[_0xced3('0x41')](handleError(_0x3700ed,null));};exports['update']=function(_0x3f41cc,_0x4ae67d){if(_0x3f41cc[_0xced3('0x4c')]['id']){delete _0x3f41cc[_0xced3('0x4c')]['id'];}return db['VoiceMail'][_0xced3('0x44')]({'where':{'id':_0x3f41cc[_0xced3('0x43')]['id']}})[_0xced3('0x21')](handleEntityNotFound(_0x4ae67d,null))['then'](saveUpdates(_0x3f41cc[_0xced3('0x4c')],null))['then'](respondWithResult(_0x4ae67d,null))[_0xced3('0x41')](handleError(_0x4ae67d,null));};exports[_0xced3('0x22')]=function(_0x4694b8,_0x168c36){return db[_0xced3('0x2b')][_0xced3('0x44')]({'where':{'id':_0x4694b8[_0xced3('0x43')]['id']}})[_0xced3('0x21')](handleEntityNotFound(_0x168c36,null))[_0xced3('0x21')](removeEntity(_0x168c36,null))[_0xced3('0x41')](handleError(_0x168c36,null));};exports[_0xced3('0x4d')]=function(_0x4b14dd,_0x3859e8,_0x3de35d){return db[_0xced3('0x2b')][_0xced3('0x4e')]({'where':{'id':_0x4b14dd[_0xced3('0x43')]['id']}})[_0xced3('0x21')](handleEntityNotFound(_0x3859e8,null))['then'](function(_0x9db425){var _0x171081;var _0x21ea6a={},_0x440a0f={};_0x440a0f[_0xced3('0x30')]=_[_0xced3('0x32')](db['VoiceMailMessage'][_0xced3('0x2c')]);_0x440a0f['query']=_[_0xced3('0x32')](_0x4b14dd['query']);_0x440a0f[_0xced3('0x33')]=_[_0xced3('0x34')](_0x440a0f['model'],_0x440a0f[_0xced3('0x31')]);_0x21ea6a[_0xced3('0x35')]=_[_0xced3('0x34')](_0x440a0f[_0xced3('0x30')],qs[_0xced3('0x36')](_0x4b14dd[_0xced3('0x31')][_0xced3('0x36')]));_0x21ea6a[_0xced3('0x35')]=_0x21ea6a[_0xced3('0x35')][_0xced3('0x37')]?_0x21ea6a[_0xced3('0x35')]:_0x440a0f[_0xced3('0x30')];if(!_0x4b14dd[_0xced3('0x31')]['hasOwnProperty'](_0xced3('0x39'))){_0x21ea6a[_0xced3('0x1a')]=qs[_0xced3('0x1a')](_0x4b14dd[_0xced3('0x31')]['limit']);_0x21ea6a[_0xced3('0x1c')]=qs[_0xced3('0x1c')](_0x4b14dd[_0xced3('0x31')][_0xced3('0x1c')]);}_0x21ea6a[_0xced3('0x4f')]=qs[_0xced3('0x50')](_0x4b14dd[_0xced3('0x31')]['sort']);_0x21ea6a[_0xced3('0x3a')]=qs[_0xced3('0x33')](_['pick'](_0x4b14dd[_0xced3('0x31')],_0x440a0f[_0xced3('0x33')]));if(_0x4b14dd[_0xced3('0x31')][_0xced3('0x3b')]){_0x21ea6a['where']=_[_0xced3('0x3c')](_0x21ea6a[_0xced3('0x3a')],{'$or':_[_0xced3('0x2a')](_0x21ea6a[_0xced3('0x35')],function(_0x3992d2){var _0x385d45={};_0x385d45[_0x3992d2]={'$like':'%'+_0x4b14dd[_0xced3('0x31')][_0xced3('0x3b')]+'%'};return _0x385d45;})});}_0x21ea6a[_0xced3('0x3a')]=_[_0xced3('0x3c')](_0x21ea6a['where'],{'mailboxuser':_0x9db425[_0xced3('0x51')]});_0x21ea6a=_[_0xced3('0x3c')]({},_0x21ea6a,_0x4b14dd['options']);return db['VoiceMailMessage'][_0xced3('0x52')](_0x21ea6a)['then'](respondWithFilteredResult(_0x3859e8,_0x21ea6a));})[_0xced3('0x41')](handleError(_0x3859e8,null));}; \ No newline at end of file +var _0x9354=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','apply','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','error','name','send','index','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','map','VIRTUAL','filter','merge','options','VoiceMail','include','findAll','catch','params','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','VoiceMailMessage','pick','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service'];(function(_0x341ab6,_0x1aeff9){var _0x34d86b=function(_0x5089fb){while(--_0x5089fb){_0x341ab6['push'](_0x341ab6['shift']());}};_0x34d86b(++_0x1aeff9);}(_0x9354,0x96));var _0x4935=function(_0x9148ba,_0x2cb1b5){_0x9148ba=_0x9148ba-0x0;var _0x355e3b=_0x9354[_0x9148ba];return _0x355e3b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4935('0x0'));var zipdir=require(_0x4935('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4935('0x2'));var moment=require(_0x4935('0x3'));var BPromise=require(_0x4935('0x4'));var Mustache=require(_0x4935('0x5'));var util=require('util');var path=require(_0x4935('0x6'));var sox=require(_0x4935('0x7'));var csv=require(_0x4935('0x8'));var ejs=require(_0x4935('0x9'));var fs=require('fs');var fs_extra=require(_0x4935('0xa'));var _=require(_0x4935('0xb'));var squel=require(_0x4935('0xc'));var crypto=require(_0x4935('0xd'));var jsforce=require(_0x4935('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4935('0x8'));var querystring=require('querystring');var Papa=require(_0x4935('0xf'));var Redis=require(_0x4935('0x10'));var authService=require(_0x4935('0x11'));var qs=require(_0x4935('0x12'));var as=require(_0x4935('0x13'));var hardwareService=require(_0x4935('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x4935('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4935('0x16'))['db'];function respondWithStatusCode(_0x32916f,_0x3bb388){_0x3bb388=_0x3bb388||0xcc;return function(_0x1c6c22){if(_0x1c6c22){return _0x32916f[_0x4935('0x17')](_0x3bb388);}return _0x32916f[_0x4935('0x18')](_0x3bb388)[_0x4935('0x19')]();};}function respondWithResult(_0x3a7c30,_0x57549f){_0x57549f=_0x57549f||0xc8;return function(_0x237e28){if(_0x237e28){return _0x3a7c30[_0x4935('0x18')](_0x57549f)[_0x4935('0x1a')](_0x237e28);}};}function respondWithFilteredResult(_0xa41961,_0x3652c4){return function(_0x24cc99){if(_0x24cc99){var _0x395a43=typeof _0x3652c4['offset']===_0x4935('0x1b')&&typeof _0x3652c4[_0x4935('0x1c')]===_0x4935('0x1b');var _0x123300=_0x24cc99[_0x4935('0x1d')];var _0x429ef3=_0x395a43?0x0:_0x3652c4['offset'];var _0xd70eff=_0x395a43?_0x24cc99[_0x4935('0x1d')]:_0x3652c4['offset']+_0x3652c4[_0x4935('0x1c')];var _0x10407f;if(_0xd70eff>=_0x123300){_0xd70eff=_0x123300;_0x10407f=0xc8;}else{_0x10407f=0xce;}_0xa41961[_0x4935('0x18')](_0x10407f);return _0xa41961['set']('Content-Range',_0x429ef3+'-'+_0xd70eff+'/'+_0x123300)[_0x4935('0x1a')](_0x24cc99);}return null;};}function patchUpdates(_0x6b849f){return function(_0x1ae059){try{jsonpatch[_0x4935('0x1e')](_0x1ae059,_0x6b849f,!![]);}catch(_0x41d76e){return BPromise[_0x4935('0x1f')](_0x41d76e);}return _0x1ae059[_0x4935('0x20')]();};}function saveUpdates(_0xe482a5,_0x58b2f3){return function(_0x2f520a){if(_0x2f520a){return _0x2f520a[_0x4935('0x21')](_0xe482a5)[_0x4935('0x22')](function(_0x2c701f){return _0x2c701f;});}return null;};}function removeEntity(_0x52c65a,_0x53530f){return function(_0x4dc1f5){if(_0x4dc1f5){return _0x4dc1f5[_0x4935('0x23')]()[_0x4935('0x22')](function(){var _0x3786ff=_0x4dc1f5[_0x4935('0x24')]({'plain':!![]});var _0x344e51=_0x4935('0x25');return db[_0x4935('0x26')][_0x4935('0x23')]({'where':{'type':_0x344e51,'resourceId':_0x3786ff['id']}})[_0x4935('0x22')](function(){return _0x4dc1f5;});})[_0x4935('0x22')](function(){_0x52c65a[_0x4935('0x18')](0xcc)[_0x4935('0x19')]();});}};}function handleEntityNotFound(_0x2c47ab,_0xbb00d6){return function(_0x359522){if(!_0x359522){_0x2c47ab['sendStatus'](0x194);}return _0x359522;};}function handleError(_0x5c3aaa,_0x5cec4d){_0x5cec4d=_0x5cec4d||0x1f4;return function(_0x1fc218){logger[_0x4935('0x27')](_0x1fc218['stack']);if(_0x1fc218[_0x4935('0x28')]){delete _0x1fc218[_0x4935('0x28')];}_0x5c3aaa[_0x4935('0x18')](_0x5cec4d)[_0x4935('0x29')](_0x1fc218);};}exports[_0x4935('0x2a')]=function(_0x24262e,_0x28afc2){var _0x2fe6da={},_0x5b3c8e={},_0xb7fe2a={'count':0x0,'rows':[]};var _0x2dcb0b=_['map'](db['VoiceMail'][_0x4935('0x2b')],function(_0x479d28){return{'name':_0x479d28[_0x4935('0x2c')],'type':_0x479d28[_0x4935('0x2d')][_0x4935('0x2e')]};});_0x5b3c8e['model']=_['map'](_0x2dcb0b,_0x4935('0x28'));_0x5b3c8e[_0x4935('0x2f')]=_['keys'](_0x24262e[_0x4935('0x2f')]);_0x5b3c8e[_0x4935('0x30')]=_[_0x4935('0x31')](_0x5b3c8e[_0x4935('0x32')],_0x5b3c8e[_0x4935('0x2f')]);_0x2fe6da['attributes']=_['intersection'](_0x5b3c8e[_0x4935('0x32')],qs[_0x4935('0x33')](_0x24262e['query']['fields']));_0x2fe6da[_0x4935('0x34')]=_0x2fe6da['attributes'][_0x4935('0x35')]?_0x2fe6da[_0x4935('0x34')]:_0x5b3c8e[_0x4935('0x32')];if(!_0x24262e[_0x4935('0x2f')][_0x4935('0x36')](_0x4935('0x37'))){_0x2fe6da['limit']=qs[_0x4935('0x1c')](_0x24262e['query'][_0x4935('0x1c')]);_0x2fe6da['offset']=qs[_0x4935('0x38')](_0x24262e['query'][_0x4935('0x38')]);}_0x2fe6da[_0x4935('0x39')]=qs[_0x4935('0x3a')](_0x24262e[_0x4935('0x2f')][_0x4935('0x3a')]);_0x2fe6da[_0x4935('0x3b')]=qs[_0x4935('0x30')](_['pick'](_0x24262e['query'],_0x5b3c8e[_0x4935('0x30')]),_0x2dcb0b);if(_0x24262e['query']['filter']){_0x2fe6da[_0x4935('0x3b')]=_['merge'](_0x2fe6da[_0x4935('0x3b')],{'$or':_[_0x4935('0x3c')](_0x2dcb0b,function(_0x2d67e3){if(_0x2d67e3[_0x4935('0x2d')]!==_0x4935('0x3d')){var _0x53aac5={};_0x53aac5[_0x2d67e3['name']]={'$like':'%'+_0x24262e[_0x4935('0x2f')][_0x4935('0x3e')]+'%'};return _0x53aac5;}})});}_0x2fe6da=_[_0x4935('0x3f')]({},_0x2fe6da,_0x24262e[_0x4935('0x40')]);var _0x4d9436={'where':_0x2fe6da[_0x4935('0x3b')]};return db[_0x4935('0x41')][_0x4935('0x1d')](_0x4d9436)['then'](function(_0x4e94f6){_0xb7fe2a[_0x4935('0x1d')]=_0x4e94f6;if(_0x24262e[_0x4935('0x2f')]['includeAll']){_0x2fe6da[_0x4935('0x42')]=[{'all':!![]}];}return db[_0x4935('0x41')][_0x4935('0x43')](_0x2fe6da);})[_0x4935('0x22')](function(_0x52ab0c){_0xb7fe2a['rows']=_0x52ab0c;return _0xb7fe2a;})[_0x4935('0x22')](respondWithFilteredResult(_0x28afc2,_0x2fe6da))[_0x4935('0x44')](handleError(_0x28afc2,null));};exports['show']=function(_0x1eaa47,_0x40f5ff){var _0x2195da={'raw':!![],'where':{'id':_0x1eaa47[_0x4935('0x45')]['id']}},_0x5135fd={};_0x5135fd[_0x4935('0x32')]=_[_0x4935('0x46')](db[_0x4935('0x41')][_0x4935('0x2b')]);_0x5135fd[_0x4935('0x2f')]=_[_0x4935('0x46')](_0x1eaa47[_0x4935('0x2f')]);_0x5135fd[_0x4935('0x30')]=_[_0x4935('0x31')](_0x5135fd[_0x4935('0x32')],_0x5135fd[_0x4935('0x2f')]);_0x2195da[_0x4935('0x34')]=_[_0x4935('0x31')](_0x5135fd[_0x4935('0x32')],qs[_0x4935('0x33')](_0x1eaa47[_0x4935('0x2f')][_0x4935('0x33')]));_0x2195da['attributes']=_0x2195da[_0x4935('0x34')]['length']?_0x2195da[_0x4935('0x34')]:_0x5135fd[_0x4935('0x32')];if(_0x1eaa47[_0x4935('0x2f')][_0x4935('0x47')]){_0x2195da['include']=[{'all':!![]}];}_0x2195da=_[_0x4935('0x3f')]({},_0x2195da,_0x1eaa47[_0x4935('0x40')]);return db[_0x4935('0x41')][_0x4935('0x48')](_0x2195da)[_0x4935('0x22')](handleEntityNotFound(_0x40f5ff,null))[_0x4935('0x22')](respondWithResult(_0x40f5ff,null))[_0x4935('0x44')](handleError(_0x40f5ff,null));};exports[_0x4935('0x49')]=function(_0x29b932,_0x392cba){return db['VoiceMail'][_0x4935('0x49')](_0x29b932[_0x4935('0x4a')],{})['then'](function(_0x447a64){var _0x2636f4=_0x29b932[_0x4935('0x4b')][_0x4935('0x24')]({'plain':!![]});if(!_0x2636f4)throw new Error(_0x4935('0x4c'));if(_0x2636f4[_0x4935('0x4d')]===_0x4935('0x4b')){var _0x471fb1=_0x447a64['get']({'plain':!![]});var _0x57d0d9='Voicemails';return db['UserProfileSection'][_0x4935('0x48')]({'where':{'name':_0x57d0d9,'userProfileId':_0x2636f4[_0x4935('0x4e')]},'raw':!![]})[_0x4935('0x22')](function(_0x2072df){if(_0x2072df&&_0x2072df[_0x4935('0x4f')]===0x0){return db['UserProfileResource'][_0x4935('0x49')]({'name':_0x471fb1[_0x4935('0x28')],'resourceId':_0x471fb1['id'],'type':_0x2072df[_0x4935('0x28')],'sectionId':_0x2072df['id']},{})[_0x4935('0x22')](function(){return _0x447a64;});}else{return _0x447a64;}})[_0x4935('0x44')](function(_0x8196b4){logger[_0x4935('0x27')](_0x4935('0x50'),_0x8196b4);throw _0x8196b4;});}return _0x447a64;})[_0x4935('0x22')](respondWithResult(_0x392cba,0xc9))[_0x4935('0x44')](handleError(_0x392cba,null));};exports['update']=function(_0x24b83b,_0x4e99bb){if(_0x24b83b[_0x4935('0x4a')]['id']){delete _0x24b83b[_0x4935('0x4a')]['id'];}return db['VoiceMail'][_0x4935('0x48')]({'where':{'id':_0x24b83b['params']['id']}})['then'](handleEntityNotFound(_0x4e99bb,null))['then'](saveUpdates(_0x24b83b[_0x4935('0x4a')],null))[_0x4935('0x22')](respondWithResult(_0x4e99bb,null))[_0x4935('0x44')](handleError(_0x4e99bb,null));};exports[_0x4935('0x23')]=function(_0xd5a489,_0x56db7f){return db['VoiceMail'][_0x4935('0x48')]({'where':{'id':_0xd5a489[_0x4935('0x45')]['id']}})[_0x4935('0x22')](handleEntityNotFound(_0x56db7f,null))['then'](removeEntity(_0x56db7f,null))[_0x4935('0x44')](handleError(_0x56db7f,null));};exports[_0x4935('0x51')]=function(_0x24141a,_0xc92288,_0x5009c9){return db[_0x4935('0x41')]['findOne']({'where':{'id':_0x24141a['params']['id']}})['then'](handleEntityNotFound(_0xc92288,null))[_0x4935('0x22')](function(_0x10cd78){var _0x47e73d;var _0x3190d2={},_0x395eba={};_0x395eba['model']=_[_0x4935('0x46')](db[_0x4935('0x52')][_0x4935('0x2b')]);_0x395eba[_0x4935('0x2f')]=_[_0x4935('0x46')](_0x24141a[_0x4935('0x2f')]);_0x395eba[_0x4935('0x30')]=_['intersection'](_0x395eba[_0x4935('0x32')],_0x395eba['query']);_0x3190d2['attributes']=_[_0x4935('0x31')](_0x395eba[_0x4935('0x32')],qs['fields'](_0x24141a['query'][_0x4935('0x33')]));_0x3190d2[_0x4935('0x34')]=_0x3190d2[_0x4935('0x34')]['length']?_0x3190d2[_0x4935('0x34')]:_0x395eba['model'];if(!_0x24141a[_0x4935('0x2f')][_0x4935('0x36')](_0x4935('0x37'))){_0x3190d2[_0x4935('0x1c')]=qs[_0x4935('0x1c')](_0x24141a['query'][_0x4935('0x1c')]);_0x3190d2[_0x4935('0x38')]=qs['offset'](_0x24141a[_0x4935('0x2f')][_0x4935('0x38')]);}_0x3190d2[_0x4935('0x39')]=qs[_0x4935('0x3a')](_0x24141a[_0x4935('0x2f')][_0x4935('0x3a')]);_0x3190d2[_0x4935('0x3b')]=qs[_0x4935('0x30')](_[_0x4935('0x53')](_0x24141a[_0x4935('0x2f')],_0x395eba[_0x4935('0x30')]));if(_0x24141a['query'][_0x4935('0x3e')]){_0x3190d2[_0x4935('0x3b')]=_[_0x4935('0x3f')](_0x3190d2[_0x4935('0x3b')],{'$or':_[_0x4935('0x3c')](_0x3190d2[_0x4935('0x34')],function(_0x2c06f5){var _0x9023e={};_0x9023e[_0x2c06f5]={'$like':'%'+_0x24141a[_0x4935('0x2f')][_0x4935('0x3e')]+'%'};return _0x9023e;})});}_0x3190d2[_0x4935('0x3b')]=_[_0x4935('0x3f')](_0x3190d2[_0x4935('0x3b')],{'mailboxuser':_0x10cd78['mailbox']});_0x3190d2=_['merge']({},_0x3190d2,_0x24141a[_0x4935('0x40')]);return db[_0x4935('0x52')]['findAndCountAll'](_0x3190d2)[_0x4935('0x22')](respondWithFilteredResult(_0xc92288,_0x3190d2));})[_0x4935('0x44')](handleError(_0xc92288,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 74478e3..4dfcfc4 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 _0xf3d8=['../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','lodash','util','moment','path','rimraf'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf3d8,0x1c2));var _0x8f3d=function(_0x2ee790,_0x5a8661){_0x2ee790=_0x2ee790-0x0;var _0x5a54a5=_0xf3d8[_0x2ee790];return _0x5a54a5;};'use strict';var _=require(_0x8f3d('0x0'));var util=require(_0x8f3d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8f3d('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8f3d('0x3'));var rimraf=require(_0x8f3d('0x4'));var config=require(_0x8f3d('0x5'));var attributes=require(_0x8f3d('0x6'));module[_0x8f3d('0x7')]=function(_0x1fb9fb,_0x4ed07b){return _0x1fb9fb[_0x8f3d('0x8')](_0x8f3d('0x9'),attributes,{'tableName':_0x8f3d('0xa'),'paranoid':![],'indexes':[{'name':_0x8f3d('0xb'),'fields':[_0x8f3d('0xc'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5b53=['voice_voicemail','mailbox_context','mailbox','context','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','VoiceMail'];(function(_0x373b47,_0x5c2e4d){var _0x3eede7=function(_0x22ff0d){while(--_0x22ff0d){_0x373b47['push'](_0x373b47['shift']());}};_0x3eede7(++_0x5c2e4d);}(_0x5b53,0xe4));var _0x35b5=function(_0x34ed02,_0x3eddbb){_0x34ed02=_0x34ed02-0x0;var _0xa80fcd=_0x5b53[_0x34ed02];return _0xa80fcd;};'use strict';var _=require(_0x35b5('0x0'));var util=require(_0x35b5('0x1'));var logger=require(_0x35b5('0x2'))(_0x35b5('0x3'));var moment=require(_0x35b5('0x4'));var BPromise=require('bluebird');var rp=require(_0x35b5('0x5'));var fs=require('fs');var path=require(_0x35b5('0x6'));var rimraf=require(_0x35b5('0x7'));var config=require(_0x35b5('0x8'));var attributes=require(_0x35b5('0x9'));module[_0x35b5('0xa')]=function(_0x1b61f2,_0x25ed8f){return _0x1b61f2['define'](_0x35b5('0xb'),attributes,{'tableName':_0x35b5('0xc'),'paranoid':![],'indexes':[{'name':_0x35b5('0xd'),'fields':[_0x35b5('0xe'),_0x35b5('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 1ae2684..e2944f4 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 _0x074c=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0xfcf3c9,_0xb349fd){var _0x376538=function(_0x599f75){while(--_0x599f75){_0xfcf3c9['push'](_0xfcf3c9['shift']());}};_0x376538(++_0xb349fd);}(_0x074c,0x78));var _0xc074=function(_0x587577,_0x53a237){_0x587577=_0x587577-0x0;var _0x75d167=_0x074c[_0x587577];return _0x75d167;};'use strict';var _=require(_0xc074('0x0'));var util=require('util');var moment=require(_0xc074('0x1'));var BPromise=require(_0xc074('0x2'));var rs=require(_0xc074('0x3'));var fs=require('fs');var Redis=require(_0xc074('0x4'));var db=require(_0xc074('0x5'))['db'];var utils=require(_0xc074('0x6'));var logger=require(_0xc074('0x7'))(_0xc074('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc074('0x9')][_0xc074('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x184937,_0x1d5493,_0x4cc833){return new BPromise(function(_0x36a5aa,_0x37ae63){return client[_0xc074('0xb')](_0x184937,_0x4cc833)[_0xc074('0xc')](function(_0x2cf530){logger[_0xc074('0xd')](_0xc074('0xe'),_0x1d5493,_0xc074('0xf'));logger[_0xc074('0x10')](_0xc074('0x11'),_0x1d5493,'request\x20sent',JSON[_0xc074('0x12')](_0x2cf530));if(_0x2cf530['error']){if(_0x2cf530[_0xc074('0x13')][_0xc074('0x14')]===0x1f4){logger[_0xc074('0x13')](_0xc074('0xe'),_0x1d5493,_0x2cf530[_0xc074('0x13')][_0xc074('0x15')]);return _0x37ae63(_0x2cf530[_0xc074('0x13')]['message']);}logger[_0xc074('0x13')](_0xc074('0xe'),_0x1d5493,_0x2cf530['error'][_0xc074('0x15')]);return _0x36a5aa(_0x2cf530[_0xc074('0x13')][_0xc074('0x15')]);}else{logger[_0xc074('0xd')](_0xc074('0xe'),_0x1d5493,_0xc074('0xf'));_0x36a5aa(_0x2cf530[_0xc074('0x16')][_0xc074('0x15')]);}})[_0xc074('0x17')](function(_0x5c4506){logger[_0xc074('0x13')](_0xc074('0xe'),_0x1d5493,_0x5c4506);_0x37ae63(_0x5c4506);});});} \ No newline at end of file +var _0xf18c=['debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','../../config/logger','rpc','client','http','request','then','info','VoiceMail,\x20%s,\x20%s'];(function(_0x3442fc,_0x42f679){var _0x1a97ca=function(_0x525835){while(--_0x525835){_0x3442fc['push'](_0x3442fc['shift']());}};_0x1a97ca(++_0x42f679);}(_0xf18c,0x1ed));var _0xcf18=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xf18c[_0x1d1779];return _0x2377e9;};'use strict';var _=require('lodash');var util=require(_0xcf18('0x0'));var moment=require(_0xcf18('0x1'));var BPromise=require(_0xcf18('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcf18('0x3'))(_0xcf18('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcf18('0x5')][_0xcf18('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x59b792,_0x521f2c,_0x28c55c){return new BPromise(function(_0x45dfec,_0x5882d5){return client[_0xcf18('0x7')](_0x59b792,_0x28c55c)[_0xcf18('0x8')](function(_0x2a1bd4){logger[_0xcf18('0x9')](_0xcf18('0xa'),_0x521f2c,'request\x20sent');logger[_0xcf18('0xb')](_0xcf18('0xc'),_0x521f2c,'request\x20sent',JSON[_0xcf18('0xd')](_0x2a1bd4));if(_0x2a1bd4[_0xcf18('0xe')]){if(_0x2a1bd4['error']['code']===0x1f4){logger[_0xcf18('0xe')](_0xcf18('0xa'),_0x521f2c,_0x2a1bd4[_0xcf18('0xe')][_0xcf18('0xf')]);return _0x5882d5(_0x2a1bd4[_0xcf18('0xe')]['message']);}logger[_0xcf18('0xe')](_0xcf18('0xa'),_0x521f2c,_0x2a1bd4[_0xcf18('0xe')][_0xcf18('0xf')]);return _0x45dfec(_0x2a1bd4[_0xcf18('0xe')][_0xcf18('0xf')]);}else{logger[_0xcf18('0x9')](_0xcf18('0xa'),_0x521f2c,'request\x20sent');_0x45dfec(_0x2a1bd4[_0xcf18('0x10')][_0xcf18('0xf')]);}})[_0xcf18('0x11')](function(_0x27ac42){logger['error'](_0xcf18('0xa'),_0x521f2c,_0x27ac42);_0x5882d5(_0x27ac42);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 56a379f..f84b96c 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 _0x4ed7=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/download','download','post','create','put','update','delete'];(function(_0x1a0a64,_0x4422c5){var _0x46d8b5=function(_0x20f56e){while(--_0x20f56e){_0x1a0a64['push'](_0x1a0a64['shift']());}};_0x46d8b5(++_0x4422c5);}(_0x4ed7,0x1a6));var _0x74ed=function(_0x5466ab,_0x227b13){_0x5466ab=_0x5466ab-0x0;var _0x40751a=_0x4ed7[_0x5466ab];return _0x40751a;};'use strict';var multer=require('multer');var util=require(_0x74ed('0x0'));var path=require(_0x74ed('0x1'));var timeout=require(_0x74ed('0x2'));var express=require(_0x74ed('0x3'));var router=express[_0x74ed('0x4')]();var fs_extra=require(_0x74ed('0x5'));var auth=require(_0x74ed('0x6'));var interaction=require(_0x74ed('0x7'));var config=require('../../config/environment');var controller=require('./voiceMailMessage.controller');router[_0x74ed('0x8')]('/',auth[_0x74ed('0x9')](),controller['index']);router['get'](_0x74ed('0xa'),auth[_0x74ed('0x9')](),controller[_0x74ed('0xb')]);router[_0x74ed('0x8')](_0x74ed('0xc'),auth['isAuthenticated'](),controller[_0x74ed('0xd')]);router[_0x74ed('0xe')]('/',auth[_0x74ed('0x9')](),controller[_0x74ed('0xf')]);router[_0x74ed('0x10')](_0x74ed('0xa'),auth[_0x74ed('0x9')](),controller[_0x74ed('0x11')]);router[_0x74ed('0x12')](_0x74ed('0xa'),auth[_0x74ed('0x9')](),controller[_0x74ed('0x13')]);module[_0x74ed('0x14')]=router; \ No newline at end of file +var _0x80b6=['../../config/environment','./voiceMailMessage.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','create','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x80b6,0xd5));var _0x680b=function(_0x496c7f,_0x20cd1a){_0x496c7f=_0x496c7f-0x0;var _0x58581a=_0x80b6[_0x496c7f];return _0x58581a;};'use strict';var multer=require(_0x680b('0x0'));var util=require(_0x680b('0x1'));var path=require('path');var timeout=require(_0x680b('0x2'));var express=require(_0x680b('0x3'));var router=express[_0x680b('0x4')]();var fs_extra=require(_0x680b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x680b('0x6'));var config=require(_0x680b('0x7'));var controller=require(_0x680b('0x8'));router[_0x680b('0x9')]('/',auth['isAuthenticated'](),controller[_0x680b('0xa')]);router['get'](_0x680b('0xb'),auth[_0x680b('0xc')](),controller[_0x680b('0xd')]);router[_0x680b('0x9')](_0x680b('0xe'),auth['isAuthenticated'](),controller[_0x680b('0xf')]);router['post']('/',auth[_0x680b('0xc')](),controller[_0x680b('0x10')]);router['put'](_0x680b('0xb'),auth['isAuthenticated'](),controller[_0x680b('0x11')]);router[_0x680b('0x12')](_0x680b('0xb'),auth[_0x680b('0xc')](),controller[_0x680b('0x13')]);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 ebcdeb3..1c977eb 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 _0x42bd=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','TIMESTAMP','literal'];(function(_0x285a66,_0x3b96f0){var _0xba38a6=function(_0x1a3153){while(--_0x1a3153){_0x285a66['push'](_0x285a66['shift']());}};_0xba38a6(++_0x3b96f0);}(_0x42bd,0x118));var _0xd42b=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x42bd[_0x27af45];return _0x18df21;};'use strict';var Sequelize=require(_0xd42b('0x0'));module['exports']={'name':{'type':Sequelize[_0xd42b('0x1')],'get':function(_0x571f4d){return this[_0xd42b('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xd42b('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xd42b('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xd42b('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xd42b('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xd42b('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xd42b('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0xd42b('0x5')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xd42b('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xd42b('0x4')],'defaultValue':''},'stamp':{'type':_0xd42b('0x6'),'defaultValue':Sequelize[_0xd42b('0x7')](_0xd42b('0x8'))}}; \ No newline at end of file +var _0x9d7a=['literal','sequelize','exports','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP'];(function(_0x1d8212,_0x1a2476){var _0x388ad9=function(_0x23cc21){while(--_0x23cc21){_0x1d8212['push'](_0x1d8212['shift']());}};_0x388ad9(++_0x1a2476);}(_0x9d7a,0x169));var _0xa9d7=function(_0x11292a,_0x233a80){_0x11292a=_0x11292a-0x0;var _0x20f99a=_0x9d7a[_0x11292a];return _0x20f99a;};'use strict';var Sequelize=require(_0xa9d7('0x0'));module[_0xa9d7('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x340fdf){return this[_0xa9d7('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xa9d7('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xa9d7('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xa9d7('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xa9d7('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0xa9d7('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xa9d7('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xa9d7('0x5')](_0xa9d7('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0xa9d7('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xa9d7('0x7'),'defaultValue':Sequelize[_0xa9d7('0x8')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 50000bb..442ac67 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 _0x8495=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VoiceMailMessage','includeAll','include','findAll','rows','catch','params','rawAttributes','options','find','create','body','msg_id','recording','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition','.wav\x22','eml-format','zip-dir','request-promise','moment'];(function(_0x21b36c,_0x543483){var _0x236627=function(_0x174f99){while(--_0x174f99){_0x21b36c['push'](_0x21b36c['shift']());}};_0x236627(++_0x543483);}(_0x8495,0x1e8));var _0x5849=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8495[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x5849('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5849('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5849('0x2'));var moment=require(_0x5849('0x3'));var BPromise=require(_0x5849('0x4'));var Mustache=require(_0x5849('0x5'));var util=require(_0x5849('0x6'));var path=require(_0x5849('0x7'));var sox=require(_0x5849('0x8'));var csv=require(_0x5849('0x9'));var ejs=require(_0x5849('0xa'));var fs=require('fs');var fs_extra=require(_0x5849('0xb'));var _=require(_0x5849('0xc'));var squel=require(_0x5849('0xd'));var crypto=require('crypto');var jsforce=require(_0x5849('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5849('0x9'));var querystring=require(_0x5849('0xf'));var Papa=require(_0x5849('0x10'));var Redis=require(_0x5849('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5849('0x12'));var as=require(_0x5849('0x13'));var hardwareService=require(_0x5849('0x14'));var logger=require(_0x5849('0x15'))(_0x5849('0x16'));var utils=require(_0x5849('0x17'));var config=require(_0x5849('0x18'));var licenseUtil=require(_0x5849('0x19'));var db=require(_0x5849('0x1a'))['db'];function respondWithStatusCode(_0x45574e,_0x24c6b6){_0x24c6b6=_0x24c6b6||0xcc;return function(_0x3ac4ac){if(_0x3ac4ac){return _0x45574e[_0x5849('0x1b')](_0x24c6b6);}return _0x45574e[_0x5849('0x1c')](_0x24c6b6)[_0x5849('0x1d')]();};}function respondWithResult(_0x1f797b,_0x3e6c48){_0x3e6c48=_0x3e6c48||0xc8;return function(_0x165b35){if(_0x165b35){return _0x1f797b['status'](_0x3e6c48)[_0x5849('0x1e')](_0x165b35);}};}function respondWithFilteredResult(_0x45928b,_0x4e417f){return function(_0x1dcf18){if(_0x1dcf18){var _0x304b98=typeof _0x4e417f[_0x5849('0x1f')]==='undefined'&&typeof _0x4e417f[_0x5849('0x20')]===_0x5849('0x21');var _0x177d97=_0x1dcf18[_0x5849('0x22')];var _0x4b28f4=_0x304b98?0x0:_0x4e417f[_0x5849('0x1f')];var _0x4398a9=_0x304b98?_0x1dcf18['count']:_0x4e417f[_0x5849('0x1f')]+_0x4e417f[_0x5849('0x20')];var _0x4ee796;if(_0x4398a9>=_0x177d97){_0x4398a9=_0x177d97;_0x4ee796=0xc8;}else{_0x4ee796=0xce;}_0x45928b['status'](_0x4ee796);return _0x45928b[_0x5849('0x23')](_0x5849('0x24'),_0x4b28f4+'-'+_0x4398a9+'/'+_0x177d97)[_0x5849('0x1e')](_0x1dcf18);}return null;};}function patchUpdates(_0xbe5387){return function(_0x2a3871){try{jsonpatch[_0x5849('0x25')](_0x2a3871,_0xbe5387,!![]);}catch(_0x344a1f){return BPromise[_0x5849('0x26')](_0x344a1f);}return _0x2a3871[_0x5849('0x27')]();};}function saveUpdates(_0x215764,_0x3b6f95){return function(_0x31ab69){if(_0x31ab69){return _0x31ab69[_0x5849('0x28')](_0x215764)['then'](function(_0x3191bf){return _0x3191bf;});}return null;};}function removeEntity(_0x1f9769,_0x243c8){return function(_0x57e89f){if(_0x57e89f){return _0x57e89f[_0x5849('0x29')]()[_0x5849('0x2a')](function(){_0x1f9769['status'](0xcc)[_0x5849('0x1d')]();});}};}function handleEntityNotFound(_0x194c33,_0x96fb2b){return function(_0x5e750a){if(!_0x5e750a){_0x194c33[_0x5849('0x1b')](0x194);}return _0x5e750a;};}function handleError(_0x42d90b,_0x29b391){_0x29b391=_0x29b391||0x1f4;return function(_0x842a75){logger['error'](_0x842a75[_0x5849('0x2b')]);if(_0x842a75['name']){delete _0x842a75[_0x5849('0x2c')];}_0x42d90b['status'](_0x29b391)[_0x5849('0x2d')](_0x842a75);};}exports['index']=function(_0x15b6b0,_0x374797){var _0x151854={},_0x4da9cc={},_0x268f0c={'count':0x0,'rows':[]};var _0x4489e9=_['map'](db['VoiceMailMessage']['rawAttributes'],function(_0x2e490f){return{'name':_0x2e490f['fieldName'],'type':_0x2e490f['type'][_0x5849('0x2e')]};});_0x4da9cc[_0x5849('0x2f')]=_['differenceBy'](_[_0x5849('0x30')](_0x4489e9,_0x5849('0x2c')),[_0x5849('0x2c')]);_0x4da9cc[_0x5849('0x31')]=_[_0x5849('0x32')](_0x15b6b0['query']);_0x4da9cc[_0x5849('0x33')]=_[_0x5849('0x34')](_0x4da9cc[_0x5849('0x2f')],_0x4da9cc[_0x5849('0x31')]);_0x151854[_0x5849('0x35')]=_[_0x5849('0x34')](_0x4da9cc[_0x5849('0x2f')],qs[_0x5849('0x36')](_0x15b6b0[_0x5849('0x31')][_0x5849('0x36')]));_0x151854[_0x5849('0x35')]=_0x151854[_0x5849('0x35')][_0x5849('0x37')]?_0x151854[_0x5849('0x35')]:_0x4da9cc[_0x5849('0x2f')];if(!_0x15b6b0[_0x5849('0x31')][_0x5849('0x38')](_0x5849('0x39'))){_0x151854[_0x5849('0x20')]=qs[_0x5849('0x20')](_0x15b6b0[_0x5849('0x31')][_0x5849('0x20')]);_0x151854[_0x5849('0x1f')]=qs['offset'](_0x15b6b0[_0x5849('0x31')]['offset']);}_0x151854['order']=qs[_0x5849('0x3a')](_0x15b6b0[_0x5849('0x31')][_0x5849('0x3a')]);_0x151854[_0x5849('0x3b')]=qs[_0x5849('0x33')](_['pick'](_0x15b6b0[_0x5849('0x31')],_0x4da9cc[_0x5849('0x33')]),_0x4489e9);if(_0x15b6b0[_0x5849('0x31')][_0x5849('0x3c')]){_0x151854[_0x5849('0x3b')]=_[_0x5849('0x3d')](_0x151854['where'],{'$or':_[_0x5849('0x30')](_0x4489e9,function(_0xe0b98a){if(_0xe0b98a[_0x5849('0x3e')]!=='VIRTUAL'){var _0x54e5c8={};_0x54e5c8[_0xe0b98a[_0x5849('0x2c')]]={'$like':'%'+_0x15b6b0[_0x5849('0x31')][_0x5849('0x3c')]+'%'};return _0x54e5c8;}})});}_0x151854=_['merge']({},_0x151854,_0x15b6b0['options']);var _0x4b6141={'where':_0x151854[_0x5849('0x3b')]};return db[_0x5849('0x3f')][_0x5849('0x22')](_0x4b6141)[_0x5849('0x2a')](function(_0x1a4a8e){_0x268f0c[_0x5849('0x22')]=_0x1a4a8e;if(_0x15b6b0[_0x5849('0x31')][_0x5849('0x40')]){_0x151854[_0x5849('0x41')]=[{'all':!![]}];}return db[_0x5849('0x3f')][_0x5849('0x42')](_0x151854);})[_0x5849('0x2a')](function(_0x5ca975){_0x268f0c[_0x5849('0x43')]=_0x5ca975;return _0x268f0c;})[_0x5849('0x2a')](respondWithFilteredResult(_0x374797,_0x151854))[_0x5849('0x44')](handleError(_0x374797,null));};exports['show']=function(_0x5e9648,_0xfa5247){var _0x3d7929={'raw':!![],'where':{'id':_0x5e9648[_0x5849('0x45')]['id']}},_0x247104={};_0x247104['model']=_[_0x5849('0x32')](db['VoiceMailMessage'][_0x5849('0x46')]);_0x247104['query']=_[_0x5849('0x32')](_0x5e9648[_0x5849('0x31')]);_0x247104[_0x5849('0x33')]=_[_0x5849('0x34')](_0x247104['model'],_0x247104[_0x5849('0x31')]);_0x3d7929['attributes']=_[_0x5849('0x34')](_0x247104[_0x5849('0x2f')],qs['fields'](_0x5e9648[_0x5849('0x31')][_0x5849('0x36')]));_0x3d7929[_0x5849('0x35')]=_0x3d7929[_0x5849('0x35')][_0x5849('0x37')]?_0x3d7929['attributes']:_0x247104['model'];if(_0x5e9648[_0x5849('0x31')][_0x5849('0x40')]){_0x3d7929[_0x5849('0x41')]=[{'all':!![]}];}_0x3d7929=_['merge']({},_0x3d7929,_0x5e9648[_0x5849('0x47')]);return db[_0x5849('0x3f')][_0x5849('0x48')](_0x3d7929)[_0x5849('0x2a')](handleEntityNotFound(_0xfa5247,null))['then'](respondWithResult(_0xfa5247,null))[_0x5849('0x44')](handleError(_0xfa5247,null));};exports[_0x5849('0x49')]=function(_0x881751,_0x2eda18){return db[_0x5849('0x3f')][_0x5849('0x49')](_0x881751[_0x5849('0x4a')],{})[_0x5849('0x2a')](respondWithResult(_0x2eda18,0xc9))[_0x5849('0x44')](handleError(_0x2eda18,null));};exports['update']=function(_0x240660,_0x2e40c7){if(_0x240660[_0x5849('0x4a')]['id']){delete _0x240660[_0x5849('0x4a')]['id'];}return db[_0x5849('0x3f')][_0x5849('0x48')]({'where':{'id':_0x240660[_0x5849('0x45')]['id']}})[_0x5849('0x2a')](handleEntityNotFound(_0x2e40c7,null))[_0x5849('0x2a')](saveUpdates(_0x240660[_0x5849('0x4a')],null))[_0x5849('0x2a')](respondWithResult(_0x2e40c7,null))['catch'](handleError(_0x2e40c7,null));};exports[_0x5849('0x29')]=function(_0xbd3129,_0x3038bd){return db[_0x5849('0x3f')][_0x5849('0x48')]({'where':{'id':_0xbd3129['params']['id']}})['then'](handleEntityNotFound(_0x3038bd,null))[_0x5849('0x2a')](removeEntity(_0x3038bd,null))['catch'](handleError(_0x3038bd,null));};exports['download']=function(_0x2b8bb1,_0x391e6a,_0x4257d7){return db[_0x5849('0x3f')][_0x5849('0x48')]({'where':{'id':_0x2b8bb1[_0x5849('0x45')]['id']},'attributes':['id','recording',_0x5849('0x4b')]})[_0x5849('0x2a')](handleEntityNotFound(_0x391e6a,null))[_0x5849('0x2a')](function(_0x13aa7c){if(_0x13aa7c){if(!_0x13aa7c[_0x5849('0x4c')]){throw new db['Sequelize'][(_0x5849('0x4d'))](_0x5849('0x4e'));}var _0x30efe4={'Content-Type':_0x5849('0x4f'),'Content-Disposition':'attachment'};if(_0x13aa7c['msg_id']){_0x30efe4[_0x5849('0x50')]='attachment;\x20filename=\x22'+_0x13aa7c[_0x5849('0x4b')]+_0x5849('0x51');}_0x391e6a['set'](_0x30efe4);return _0x391e6a['send'](new Buffer(_0x13aa7c[_0x5849('0x4c')]));}})[_0x5849('0x44')](handleError(_0x391e6a,null));}; \ No newline at end of file +var _0x1fa8=['map','VoiceMailMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','rawAttributes','fields','find','catch','create','update','body','params','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','.wav\x22','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','error','stack','name','send','index'];(function(_0xa3f96d,_0x178175){var _0x3669f9=function(_0x11ba61){while(--_0x11ba61){_0xa3f96d['push'](_0xa3f96d['shift']());}};_0x3669f9(++_0x178175);}(_0x1fa8,0xd4));var _0x81fa=function(_0x1a6dc2,_0x10e9c1){_0x1a6dc2=_0x1a6dc2-0x0;var _0x2fae8d=_0x1fa8[_0x1a6dc2];return _0x2fae8d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x81fa('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x81fa('0x1'));var rp=require(_0x81fa('0x2'));var moment=require(_0x81fa('0x3'));var BPromise=require(_0x81fa('0x4'));var Mustache=require('mustache');var util=require(_0x81fa('0x5'));var path=require(_0x81fa('0x6'));var sox=require(_0x81fa('0x7'));var csv=require('to-csv');var ejs=require(_0x81fa('0x8'));var fs=require('fs');var fs_extra=require(_0x81fa('0x9'));var _=require(_0x81fa('0xa'));var squel=require(_0x81fa('0xb'));var crypto=require(_0x81fa('0xc'));var jsforce=require(_0x81fa('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x81fa('0xe'));var querystring=require('querystring');var Papa=require(_0x81fa('0xf'));var Redis=require(_0x81fa('0x10'));var authService=require(_0x81fa('0x11'));var qs=require(_0x81fa('0x12'));var as=require(_0x81fa('0x13'));var hardwareService=require(_0x81fa('0x14'));var logger=require('../../config/logger')(_0x81fa('0x15'));var utils=require(_0x81fa('0x16'));var config=require(_0x81fa('0x17'));var licenseUtil=require(_0x81fa('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x400bfc,_0x54edba){_0x54edba=_0x54edba||0xcc;return function(_0x14bbc1){if(_0x14bbc1){return _0x400bfc[_0x81fa('0x19')](_0x54edba);}return _0x400bfc['status'](_0x54edba)[_0x81fa('0x1a')]();};}function respondWithResult(_0x57a081,_0x22b5bf){_0x22b5bf=_0x22b5bf||0xc8;return function(_0x305a85){if(_0x305a85){return _0x57a081[_0x81fa('0x1b')](_0x22b5bf)[_0x81fa('0x1c')](_0x305a85);}};}function respondWithFilteredResult(_0x57e5cf,_0x472e17){return function(_0x5f3658){if(_0x5f3658){var _0x25c74e=typeof _0x472e17['offset']===_0x81fa('0x1d')&&typeof _0x472e17[_0x81fa('0x1e')]===_0x81fa('0x1d');var _0xe10f8=_0x5f3658[_0x81fa('0x1f')];var _0x3d42f7=_0x25c74e?0x0:_0x472e17[_0x81fa('0x20')];var _0x316338=_0x25c74e?_0x5f3658['count']:_0x472e17['offset']+_0x472e17[_0x81fa('0x1e')];var _0x5916b3;if(_0x316338>=_0xe10f8){_0x316338=_0xe10f8;_0x5916b3=0xc8;}else{_0x5916b3=0xce;}_0x57e5cf[_0x81fa('0x1b')](_0x5916b3);return _0x57e5cf[_0x81fa('0x21')](_0x81fa('0x22'),_0x3d42f7+'-'+_0x316338+'/'+_0xe10f8)[_0x81fa('0x1c')](_0x5f3658);}return null;};}function patchUpdates(_0x260763){return function(_0x11dba4){try{jsonpatch['apply'](_0x11dba4,_0x260763,!![]);}catch(_0x408731){return BPromise[_0x81fa('0x23')](_0x408731);}return _0x11dba4[_0x81fa('0x24')]();};}function saveUpdates(_0x4783fe,_0x42d509){return function(_0x1d1ab7){if(_0x1d1ab7){return _0x1d1ab7['update'](_0x4783fe)['then'](function(_0x2dbb50){return _0x2dbb50;});}return null;};}function removeEntity(_0x3d3cc9,_0x54a588){return function(_0x52bc95){if(_0x52bc95){return _0x52bc95['destroy']()[_0x81fa('0x25')](function(){_0x3d3cc9['status'](0xcc)[_0x81fa('0x1a')]();});}};}function handleEntityNotFound(_0x5287c0,_0x3853b5){return function(_0x511dbf){if(!_0x511dbf){_0x5287c0['sendStatus'](0x194);}return _0x511dbf;};}function handleError(_0x3686ab,_0x3fb21d){_0x3fb21d=_0x3fb21d||0x1f4;return function(_0x2b587c){logger[_0x81fa('0x26')](_0x2b587c[_0x81fa('0x27')]);if(_0x2b587c[_0x81fa('0x28')]){delete _0x2b587c['name'];}_0x3686ab[_0x81fa('0x1b')](_0x3fb21d)[_0x81fa('0x29')](_0x2b587c);};}exports[_0x81fa('0x2a')]=function(_0x2f4682,_0x5275fe){var _0x233294={},_0x49ae62={},_0x350352={'count':0x0,'rows':[]};var _0x51b1b0=_[_0x81fa('0x2b')](db[_0x81fa('0x2c')]['rawAttributes'],function(_0x5be026){return{'name':_0x5be026[_0x81fa('0x2d')],'type':_0x5be026[_0x81fa('0x2e')][_0x81fa('0x2f')]};});_0x49ae62[_0x81fa('0x30')]=_['differenceBy'](_[_0x81fa('0x2b')](_0x51b1b0,_0x81fa('0x28')),[_0x81fa('0x28')]);_0x49ae62[_0x81fa('0x31')]=_[_0x81fa('0x32')](_0x2f4682[_0x81fa('0x31')]);_0x49ae62[_0x81fa('0x33')]=_[_0x81fa('0x34')](_0x49ae62[_0x81fa('0x30')],_0x49ae62['query']);_0x233294[_0x81fa('0x35')]=_[_0x81fa('0x34')](_0x49ae62[_0x81fa('0x30')],qs['fields'](_0x2f4682[_0x81fa('0x31')]['fields']));_0x233294['attributes']=_0x233294[_0x81fa('0x35')]['length']?_0x233294[_0x81fa('0x35')]:_0x49ae62[_0x81fa('0x30')];if(!_0x2f4682[_0x81fa('0x31')][_0x81fa('0x36')](_0x81fa('0x37'))){_0x233294[_0x81fa('0x1e')]=qs['limit'](_0x2f4682[_0x81fa('0x31')][_0x81fa('0x1e')]);_0x233294[_0x81fa('0x20')]=qs['offset'](_0x2f4682[_0x81fa('0x31')][_0x81fa('0x20')]);}_0x233294[_0x81fa('0x38')]=qs['sort'](_0x2f4682[_0x81fa('0x31')][_0x81fa('0x39')]);_0x233294[_0x81fa('0x3a')]=qs[_0x81fa('0x33')](_[_0x81fa('0x3b')](_0x2f4682[_0x81fa('0x31')],_0x49ae62[_0x81fa('0x33')]),_0x51b1b0);if(_0x2f4682['query'][_0x81fa('0x3c')]){_0x233294['where']=_[_0x81fa('0x3d')](_0x233294[_0x81fa('0x3a')],{'$or':_[_0x81fa('0x2b')](_0x51b1b0,function(_0x443b59){if(_0x443b59[_0x81fa('0x2e')]!==_0x81fa('0x3e')){var _0x918c94={};_0x918c94[_0x443b59[_0x81fa('0x28')]]={'$like':'%'+_0x2f4682['query'][_0x81fa('0x3c')]+'%'};return _0x918c94;}})});}_0x233294=_[_0x81fa('0x3d')]({},_0x233294,_0x2f4682['options']);var _0x5d63e9={'where':_0x233294['where']};return db[_0x81fa('0x2c')][_0x81fa('0x1f')](_0x5d63e9)[_0x81fa('0x25')](function(_0x4e62a2){_0x350352[_0x81fa('0x1f')]=_0x4e62a2;if(_0x2f4682[_0x81fa('0x31')][_0x81fa('0x3f')]){_0x233294[_0x81fa('0x40')]=[{'all':!![]}];}return db[_0x81fa('0x2c')][_0x81fa('0x41')](_0x233294);})[_0x81fa('0x25')](function(_0x2432e0){_0x350352[_0x81fa('0x42')]=_0x2432e0;return _0x350352;})[_0x81fa('0x25')](respondWithFilteredResult(_0x5275fe,_0x233294))['catch'](handleError(_0x5275fe,null));};exports[_0x81fa('0x43')]=function(_0x185f94,_0x29d268){var _0x5e07ef={'raw':!![],'where':{'id':_0x185f94['params']['id']}},_0x20adf7={};_0x20adf7[_0x81fa('0x30')]=_[_0x81fa('0x32')](db[_0x81fa('0x2c')][_0x81fa('0x44')]);_0x20adf7[_0x81fa('0x31')]=_['keys'](_0x185f94[_0x81fa('0x31')]);_0x20adf7[_0x81fa('0x33')]=_[_0x81fa('0x34')](_0x20adf7[_0x81fa('0x30')],_0x20adf7[_0x81fa('0x31')]);_0x5e07ef[_0x81fa('0x35')]=_[_0x81fa('0x34')](_0x20adf7[_0x81fa('0x30')],qs[_0x81fa('0x45')](_0x185f94[_0x81fa('0x31')][_0x81fa('0x45')]));_0x5e07ef[_0x81fa('0x35')]=_0x5e07ef[_0x81fa('0x35')]['length']?_0x5e07ef[_0x81fa('0x35')]:_0x20adf7[_0x81fa('0x30')];if(_0x185f94[_0x81fa('0x31')]['includeAll']){_0x5e07ef[_0x81fa('0x40')]=[{'all':!![]}];}_0x5e07ef=_[_0x81fa('0x3d')]({},_0x5e07ef,_0x185f94['options']);return db['VoiceMailMessage'][_0x81fa('0x46')](_0x5e07ef)[_0x81fa('0x25')](handleEntityNotFound(_0x29d268,null))[_0x81fa('0x25')](respondWithResult(_0x29d268,null))[_0x81fa('0x47')](handleError(_0x29d268,null));};exports[_0x81fa('0x48')]=function(_0x3b2c32,_0x385ac0){return db[_0x81fa('0x2c')][_0x81fa('0x48')](_0x3b2c32['body'],{})[_0x81fa('0x25')](respondWithResult(_0x385ac0,0xc9))['catch'](handleError(_0x385ac0,null));};exports[_0x81fa('0x49')]=function(_0x23a3ba,_0x160c4c){if(_0x23a3ba[_0x81fa('0x4a')]['id']){delete _0x23a3ba[_0x81fa('0x4a')]['id'];}return db[_0x81fa('0x2c')][_0x81fa('0x46')]({'where':{'id':_0x23a3ba[_0x81fa('0x4b')]['id']}})[_0x81fa('0x25')](handleEntityNotFound(_0x160c4c,null))['then'](saveUpdates(_0x23a3ba[_0x81fa('0x4a')],null))[_0x81fa('0x25')](respondWithResult(_0x160c4c,null))[_0x81fa('0x47')](handleError(_0x160c4c,null));};exports['destroy']=function(_0x39004e,_0xc0fbe7){return db[_0x81fa('0x2c')][_0x81fa('0x46')]({'where':{'id':_0x39004e[_0x81fa('0x4b')]['id']}})[_0x81fa('0x25')](handleEntityNotFound(_0xc0fbe7,null))[_0x81fa('0x25')](removeEntity(_0xc0fbe7,null))[_0x81fa('0x47')](handleError(_0xc0fbe7,null));};exports[_0x81fa('0x4c')]=function(_0x10f524,_0x3eb87b,_0x4ccd65){return db[_0x81fa('0x2c')][_0x81fa('0x46')]({'where':{'id':_0x10f524[_0x81fa('0x4b')]['id']},'attributes':['id',_0x81fa('0x4d'),_0x81fa('0x4e')]})[_0x81fa('0x25')](handleEntityNotFound(_0x3eb87b,null))[_0x81fa('0x25')](function(_0x34b575){if(_0x34b575){if(!_0x34b575['recording']){throw new db[(_0x81fa('0x4f'))][(_0x81fa('0x50'))](_0x81fa('0x51'));}var _0x439505={'Content-Type':'audio/wav','Content-Disposition':_0x81fa('0x52')};if(_0x34b575['msg_id']){_0x439505[_0x81fa('0x53')]='attachment;\x20filename=\x22'+_0x34b575[_0x81fa('0x4e')]+_0x81fa('0x54');}_0x3eb87b[_0x81fa('0x21')](_0x439505);return _0x3eb87b[_0x81fa('0x29')](new Buffer(_0x34b575['recording']));}})[_0x81fa('0x47')](handleError(_0x3eb87b,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index e43a999..b245c83 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 _0x1381=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','dir','lodash','util'];(function(_0x19c064,_0x198b6b){var _0x1ffd31=function(_0x2a8d20){while(--_0x2a8d20){_0x19c064['push'](_0x19c064['shift']());}};_0x1ffd31(++_0x198b6b);}(_0x1381,0x19e));var _0x1138=function(_0x51b2fb,_0x41badc){_0x51b2fb=_0x51b2fb-0x0;var _0x293ecb=_0x1381[_0x51b2fb];return _0x293ecb;};'use strict';var _=require(_0x1138('0x0'));var util=require(_0x1138('0x1'));var logger=require('../../config/logger')(_0x1138('0x2'));var moment=require(_0x1138('0x3'));var BPromise=require(_0x1138('0x4'));var rp=require(_0x1138('0x5'));var fs=require('fs');var path=require(_0x1138('0x6'));var rimraf=require(_0x1138('0x7'));var config=require(_0x1138('0x8'));var attributes=require(_0x1138('0x9'));module[_0x1138('0xa')]=function(_0x4551d4,_0x55cf9c){return _0x4551d4[_0x1138('0xb')]('VoiceMailMessage',attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x1138('0xc'),'fields':[_0x1138('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x8a28=['dir','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages'];(function(_0x56b795,_0x2b25ba){var _0x55323f=function(_0x28b880){while(--_0x28b880){_0x56b795['push'](_0x56b795['shift']());}};_0x55323f(++_0x2b25ba);}(_0x8a28,0xe1));var _0x88a2=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x8a28[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x88a2('0x0'));var util=require(_0x88a2('0x1'));var logger=require(_0x88a2('0x2'))(_0x88a2('0x3'));var moment=require(_0x88a2('0x4'));var BPromise=require('bluebird');var rp=require(_0x88a2('0x5'));var fs=require('fs');var path=require(_0x88a2('0x6'));var rimraf=require('rimraf');var config=require(_0x88a2('0x7'));var attributes=require(_0x88a2('0x8'));module[_0x88a2('0x9')]=function(_0x51eab6,_0x4b4c3a){return _0x51eab6[_0x88a2('0xa')](_0x88a2('0xb'),attributes,{'tableName':_0x88a2('0xc'),'paranoid':![],'indexes':[{'name':_0x88a2('0xd'),'fields':[_0x88a2('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index d9c6f17..01b5b60 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 _0xa278=['ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','stringify','error','VoiceMailMessage,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring'];(function(_0x6ed9df,_0x479094){var _0x19dd32=function(_0xd93a9b){while(--_0xd93a9b){_0x6ed9df['push'](_0x6ed9df['shift']());}};_0x19dd32(++_0x479094);}(_0xa278,0x1ca));var _0x8a27=function(_0x4996d5,_0x123daf){_0x4996d5=_0x4996d5-0x0;var _0x4793f9=_0xa278[_0x4996d5];return _0x4793f9;};'use strict';var _=require('lodash');var util=require(_0x8a27('0x0'));var moment=require(_0x8a27('0x1'));var BPromise=require(_0x8a27('0x2'));var rs=require(_0x8a27('0x3'));var fs=require('fs');var Redis=require(_0x8a27('0x4'));var db=require(_0x8a27('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8a27('0x6'))('rpc');var config=require(_0x8a27('0x7'));var jayson=require(_0x8a27('0x8'));var client=jayson[_0x8a27('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d9a56,_0x976c19,_0xe2c8e6){return new BPromise(function(_0x2919e8,_0x27836b){return client[_0x8a27('0xa')](_0x3d9a56,_0xe2c8e6)[_0x8a27('0xb')](function(_0x107386){logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x976c19,_0x8a27('0xc'));logger[_0x8a27('0xd')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x976c19,_0x8a27('0xc'),JSON[_0x8a27('0xe')](_0x107386));if(_0x107386[_0x8a27('0xf')]){if(_0x107386['error']['code']===0x1f4){logger[_0x8a27('0xf')](_0x8a27('0x10'),_0x976c19,_0x107386[_0x8a27('0xf')]['message']);return _0x27836b(_0x107386['error'][_0x8a27('0x11')]);}logger[_0x8a27('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x976c19,_0x107386[_0x8a27('0xf')][_0x8a27('0x11')]);return _0x2919e8(_0x107386[_0x8a27('0xf')][_0x8a27('0x11')]);}else{logger[_0x8a27('0x12')](_0x8a27('0x10'),_0x976c19,'request\x20sent');_0x2919e8(_0x107386[_0x8a27('0x13')][_0x8a27('0x11')]);}})[_0x8a27('0x14')](function(_0x375c24){logger[_0x8a27('0xf')](_0x8a27('0x10'),_0x976c19,_0x375c24);_0x27836b(_0x375c24);});});} \ No newline at end of file +var _0xf48f=['rpc','../../config/environment','client','request','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x3e1b2c,_0x271716){var _0x6a2001=function(_0x793917){while(--_0x793917){_0x3e1b2c['push'](_0x3e1b2c['shift']());}};_0x6a2001(++_0x271716);}(_0xf48f,0x1e9));var _0xff48=function(_0x467a85,_0x4a7544){_0x467a85=_0x467a85-0x0;var _0x24f40c=_0xf48f[_0x467a85];return _0x24f40c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xff48('0x0'));var BPromise=require(_0xff48('0x1'));var rs=require(_0xff48('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xff48('0x3'))['db'];var utils=require(_0xff48('0x4'));var logger=require('../../config/logger')(_0xff48('0x5'));var config=require(_0xff48('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xff48('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3eb2ee,_0x15b8f7,_0x8c8030){return new BPromise(function(_0x27a2b7,_0x170ffd){return client[_0xff48('0x8')](_0x3eb2ee,_0x8c8030)['then'](function(_0x422aef){logger[_0xff48('0x9')](_0xff48('0xa'),_0x15b8f7,_0xff48('0xb'));logger[_0xff48('0xc')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x15b8f7,_0xff48('0xb'),JSON[_0xff48('0xd')](_0x422aef));if(_0x422aef[_0xff48('0xe')]){if(_0x422aef[_0xff48('0xe')][_0xff48('0xf')]===0x1f4){logger[_0xff48('0xe')](_0xff48('0xa'),_0x15b8f7,_0x422aef[_0xff48('0xe')]['message']);return _0x170ffd(_0x422aef[_0xff48('0xe')][_0xff48('0x10')]);}logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x15b8f7,_0x422aef['error']['message']);return _0x27a2b7(_0x422aef[_0xff48('0xe')]['message']);}else{logger[_0xff48('0x9')](_0xff48('0xa'),_0x15b8f7,_0xff48('0xb'));_0x27a2b7(_0x422aef[_0xff48('0x11')]['message']);}})[_0xff48('0x12')](function(_0x3fd074){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x15b8f7,_0x3fd074);_0x170ffd(_0x3fd074);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 2331d57..bc3f282 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 _0x267f=['isAuthenticated','index','/:id','show','getSounds','post','create','addSound','put','update','destroy','delete','/:id/sounds/:id2','removeSound','exports','multer','util','path','express','Router','../../components/interaction/service','get'];(function(_0x5f4ce2,_0x42c469){var _0x219b5b=function(_0x47ff9a){while(--_0x47ff9a){_0x5f4ce2['push'](_0x5f4ce2['shift']());}};_0x219b5b(++_0x42c469);}(_0x267f,0x93));var _0xf267=function(_0x1676ed,_0x17c6ac){_0x1676ed=_0x1676ed-0x0;var _0x1b449e=_0x267f[_0x1676ed];return _0x1b449e;};'use strict';var multer=require(_0xf267('0x0'));var util=require(_0xf267('0x1'));var path=require(_0xf267('0x2'));var timeout=require('connect-timeout');var express=require(_0xf267('0x3'));var router=express[_0xf267('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf267('0x5'));var config=require('../../config/environment');var controller=require('./voiceMusicOnHold.controller');router[_0xf267('0x6')]('/',auth[_0xf267('0x7')](),controller[_0xf267('0x8')]);router['get'](_0xf267('0x9'),auth[_0xf267('0x7')](),controller[_0xf267('0xa')]);router[_0xf267('0x6')]('/:id/sounds',auth['isAuthenticated'](),controller[_0xf267('0xb')]);router[_0xf267('0xc')]('/',auth[_0xf267('0x7')](),controller[_0xf267('0xd')]);router[_0xf267('0xc')]('/:id/sounds',auth[_0xf267('0x7')](),controller[_0xf267('0xe')]);router[_0xf267('0xf')](_0xf267('0x9'),auth['isAuthenticated'](),controller[_0xf267('0x10')]);router['delete'](_0xf267('0x9'),auth[_0xf267('0x7')](),controller[_0xf267('0x11')]);router[_0xf267('0x12')](_0xf267('0x13'),auth['isAuthenticated'](),controller[_0xf267('0x14')]);module[_0xf267('0x15')]=router; \ No newline at end of file +var _0x6f11=['/:id/sounds','post','create','addSound','/:id','update','delete','destroy','removeSound','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceMusicOnHold.controller','get','index','isAuthenticated','show'];(function(_0x5c8f3e,_0x11f776){var _0x26f42f=function(_0x2b3ce8){while(--_0x2b3ce8){_0x5c8f3e['push'](_0x5c8f3e['shift']());}};_0x26f42f(++_0x11f776);}(_0x6f11,0x1ed));var _0x16f1=function(_0x3457a4,_0x4b2d1d){_0x3457a4=_0x3457a4-0x0;var _0x2d447a=_0x6f11[_0x3457a4];return _0x2d447a;};'use strict';var multer=require(_0x16f1('0x0'));var util=require(_0x16f1('0x1'));var path=require(_0x16f1('0x2'));var timeout=require(_0x16f1('0x3'));var express=require(_0x16f1('0x4'));var router=express[_0x16f1('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x16f1('0x6'));var interaction=require(_0x16f1('0x7'));var config=require('../../config/environment');var controller=require(_0x16f1('0x8'));router[_0x16f1('0x9')]('/',auth['isAuthenticated'](),controller[_0x16f1('0xa')]);router['get']('/:id',auth[_0x16f1('0xb')](),controller[_0x16f1('0xc')]);router['get'](_0x16f1('0xd'),auth['isAuthenticated'](),controller['getSounds']);router[_0x16f1('0xe')]('/',auth[_0x16f1('0xb')](),controller[_0x16f1('0xf')]);router[_0x16f1('0xe')](_0x16f1('0xd'),auth[_0x16f1('0xb')](),controller[_0x16f1('0x10')]);router['put'](_0x16f1('0x11'),auth[_0x16f1('0xb')](),controller[_0x16f1('0x12')]);router[_0x16f1('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x16f1('0x14')]);router['delete']('/:id/sounds/:id2',auth[_0x16f1('0xb')](),controller[_0x16f1('0x15')]);module[_0x16f1('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index f5145a3..2f3bf30 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 _0xd239=['sequelize','name','custom','files','mp3nb','mp3','STRING','alpha','TIMESTAMP','BOOLEAN'];(function(_0x39b07e,_0x33b057){var _0x591dae=function(_0x5bdec5){while(--_0x5bdec5){_0x39b07e['push'](_0x39b07e['shift']());}};_0x591dae(++_0x33b057);}(_0xd239,0x82));var _0x9d23=function(_0x3070a5,_0xcf7f85){_0x3070a5=_0x3070a5-0x0;var _0x2ae47f=_0xd239[_0x3070a5];return _0x2ae47f;};'use strict';var Sequelize=require(_0x9d23('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9d23('0x1')},'mode':{'type':Sequelize['ENUM'](_0x9d23('0x2'),_0x9d23('0x3'),_0x9d23('0x4'),'quietmp3nb','quietmp3',_0x9d23('0x5')),'allowNull':!![],'defaultValue':_0x9d23('0x3')},'directory':{'type':Sequelize[_0x9d23('0x6')],'allowNull':!![]},'application':{'type':Sequelize[_0x9d23('0x6')],'allowNull':!![]},'digit':{'type':Sequelize[_0x9d23('0x6')],'allowNull':!![]},'sort':{'type':Sequelize[_0x9d23('0x6')],'allowNull':!![],'defaultValue':_0x9d23('0x7')},'format':{'type':Sequelize[_0x9d23('0x6')],'allowNull':!![]},'stamp':{'type':_0x9d23('0x8')},'defaultEntry':{'type':Sequelize[_0x9d23('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0x66b4=['name','ENUM','custom','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','BOOLEAN','exports','STRING'];(function(_0x5a3962,_0x49770b){var _0x2ca6d1=function(_0x413516){while(--_0x413516){_0x5a3962['push'](_0x5a3962['shift']());}};_0x2ca6d1(++_0x49770b);}(_0x66b4,0x1ba));var _0x466b=function(_0x29a194,_0x3079e2){_0x29a194=_0x29a194-0x0;var _0x589f4f=_0x66b4[_0x29a194];return _0x589f4f;};'use strict';var Sequelize=require('sequelize');module[_0x466b('0x0')]={'name':{'type':Sequelize[_0x466b('0x1')],'allowNull':![],'unique':_0x466b('0x2')},'mode':{'type':Sequelize[_0x466b('0x3')](_0x466b('0x4'),_0x466b('0x5'),_0x466b('0x6'),_0x466b('0x7'),_0x466b('0x8'),_0x466b('0x9')),'allowNull':!![],'defaultValue':_0x466b('0x5')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x466b('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x466b('0x1')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x466b('0xa')},'format':{'type':Sequelize[_0x466b('0x1')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x466b('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 e1e8947..cca867f 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 _0xd1f8=['transaction','mode','files','directory','root','server/files/moh','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MusicOnHolds','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','readdirSync','forEach','join','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','server/files/sounds/converted','format','%s.%s','extname','symlinkSync','removeSound','id2','createdAt','getSounds','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','update','then','get','UserProfileResource','name','send','index','VoiceMusicOnHold','rawAttributes','model','map','keys','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','includeAll','rows','catch','show','params','fields','include','find','body','create','sequelize'];(function(_0x29db36,_0x410ae9){var _0x234e87=function(_0x48697b){while(--_0x48697b){_0x29db36['push'](_0x29db36['shift']());}};_0x234e87(++_0x410ae9);}(_0xd1f8,0x104));var _0x8d1f=function(_0x4f0c2b,_0x2c9d14){_0x4f0c2b=_0x4f0c2b-0x0;var _0x526436=_0xd1f8[_0x4f0c2b];return _0x526436;};'use strict';var emlformat=require(_0x8d1f('0x0'));var rimraf=require(_0x8d1f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8d1f('0x2'));var rp=require(_0x8d1f('0x3'));var moment=require(_0x8d1f('0x4'));var BPromise=require(_0x8d1f('0x5'));var Mustache=require(_0x8d1f('0x6'));var util=require(_0x8d1f('0x7'));var path=require(_0x8d1f('0x8'));var sox=require(_0x8d1f('0x9'));var csv=require(_0x8d1f('0xa'));var ejs=require(_0x8d1f('0xb'));var fs=require('fs');var fs_extra=require(_0x8d1f('0xc'));var _=require(_0x8d1f('0xd'));var squel=require(_0x8d1f('0xe'));var crypto=require('crypto');var jsforce=require(_0x8d1f('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8d1f('0x10'));var Redis=require(_0x8d1f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8d1f('0x12'));var as=require(_0x8d1f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8d1f('0x14'))(_0x8d1f('0x15'));var utils=require(_0x8d1f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8d1f('0x17'));var db=require(_0x8d1f('0x18'))['db'];function respondWithStatusCode(_0xe0d69d,_0x1b88f0){_0x1b88f0=_0x1b88f0||0xcc;return function(_0x2e555f){if(_0x2e555f){return _0xe0d69d[_0x8d1f('0x19')](_0x1b88f0);}return _0xe0d69d['status'](_0x1b88f0)[_0x8d1f('0x1a')]();};}function respondWithResult(_0x5da71b,_0x3405ce){_0x3405ce=_0x3405ce||0xc8;return function(_0x3983c3){if(_0x3983c3){return _0x5da71b[_0x8d1f('0x1b')](_0x3405ce)[_0x8d1f('0x1c')](_0x3983c3);}};}function respondWithFilteredResult(_0x421e8b,_0x3b8ebf){return function(_0x54f7e0){if(_0x54f7e0){var _0xd2355=typeof _0x3b8ebf['offset']===_0x8d1f('0x1d')&&typeof _0x3b8ebf[_0x8d1f('0x1e')]==='undefined';var _0x370a6f=_0x54f7e0[_0x8d1f('0x1f')];var _0x21a35c=_0xd2355?0x0:_0x3b8ebf[_0x8d1f('0x20')];var _0x221e21=_0xd2355?_0x54f7e0[_0x8d1f('0x1f')]:_0x3b8ebf[_0x8d1f('0x20')]+_0x3b8ebf['limit'];var _0x59c8a7;if(_0x221e21>=_0x370a6f){_0x221e21=_0x370a6f;_0x59c8a7=0xc8;}else{_0x59c8a7=0xce;}_0x421e8b['status'](_0x59c8a7);return _0x421e8b['set'](_0x8d1f('0x21'),_0x21a35c+'-'+_0x221e21+'/'+_0x370a6f)['json'](_0x54f7e0);}return null;};}function patchUpdates(_0x1b2850){return function(_0x11a35e){try{jsonpatch[_0x8d1f('0x22')](_0x11a35e,_0x1b2850,!![]);}catch(_0x4b1e6e){return BPromise[_0x8d1f('0x23')](_0x4b1e6e);}return _0x11a35e['save']();};}function saveUpdates(_0x5d7f9d,_0xf59e5e){return function(_0x20f89d){if(_0x20f89d){return _0x20f89d[_0x8d1f('0x24')](_0x5d7f9d)['then'](function(_0x4a09e2){return _0x4a09e2;});}return null;};}function removeEntity(_0x1c5c14,_0x358e0f){return function(_0x3a33d2){if(_0x3a33d2){return _0x3a33d2['destroy']()[_0x8d1f('0x25')](function(){var _0x3846a7=_0x3a33d2[_0x8d1f('0x26')]({'plain':!![]});var _0x56af13='MusicOnHolds';return db[_0x8d1f('0x27')]['destroy']({'where':{'type':_0x56af13,'resourceId':_0x3846a7['id']}})[_0x8d1f('0x25')](function(){return _0x3a33d2;});})[_0x8d1f('0x25')](function(){_0x1c5c14[_0x8d1f('0x1b')](0xcc)[_0x8d1f('0x1a')]();});}};}function handleEntityNotFound(_0x5bef66,_0x2b61c7){return function(_0x192873){if(!_0x192873){_0x5bef66[_0x8d1f('0x19')](0x194);}return _0x192873;};}function handleError(_0x113e81,_0x58f79){_0x58f79=_0x58f79||0x1f4;return function(_0x3cf237){logger['error'](_0x3cf237['stack']);if(_0x3cf237[_0x8d1f('0x28')]){delete _0x3cf237[_0x8d1f('0x28')];}_0x113e81['status'](_0x58f79)[_0x8d1f('0x29')](_0x3cf237);};}exports[_0x8d1f('0x2a')]=function(_0x17c328,_0x3cb68c){var _0x21c903={},_0x381a24={},_0x4bb6ea={'count':0x0,'rows':[]};var _0xe1bfb8=_['map'](db[_0x8d1f('0x2b')][_0x8d1f('0x2c')],function(_0x3ab341){return{'name':_0x3ab341['fieldName'],'type':_0x3ab341['type']['key']};});_0x381a24[_0x8d1f('0x2d')]=_[_0x8d1f('0x2e')](_0xe1bfb8,'name');_0x381a24['query']=_[_0x8d1f('0x2f')](_0x17c328[_0x8d1f('0x30')]);_0x381a24['filters']=_[_0x8d1f('0x31')](_0x381a24['model'],_0x381a24['query']);_0x21c903[_0x8d1f('0x32')]=_[_0x8d1f('0x31')](_0x381a24[_0x8d1f('0x2d')],qs['fields'](_0x17c328[_0x8d1f('0x30')]['fields']));_0x21c903[_0x8d1f('0x32')]=_0x21c903[_0x8d1f('0x32')][_0x8d1f('0x33')]?_0x21c903[_0x8d1f('0x32')]:_0x381a24[_0x8d1f('0x2d')];if(!_0x17c328[_0x8d1f('0x30')][_0x8d1f('0x34')](_0x8d1f('0x35'))){_0x21c903[_0x8d1f('0x1e')]=qs[_0x8d1f('0x1e')](_0x17c328['query'][_0x8d1f('0x1e')]);_0x21c903[_0x8d1f('0x20')]=qs[_0x8d1f('0x20')](_0x17c328['query'][_0x8d1f('0x20')]);}_0x21c903[_0x8d1f('0x36')]=qs['sort'](_0x17c328['query'][_0x8d1f('0x37')]);delete _0x17c328[_0x8d1f('0x30')][_0x8d1f('0x37')];_0x21c903[_0x8d1f('0x38')]=qs[_0x8d1f('0x39')](_[_0x8d1f('0x3a')](_0x17c328[_0x8d1f('0x30')],_0x381a24[_0x8d1f('0x39')]),_0xe1bfb8);if(_0x17c328[_0x8d1f('0x30')]['filter']){_0x21c903[_0x8d1f('0x38')]=_[_0x8d1f('0x3b')](_0x21c903['where'],{'$or':_[_0x8d1f('0x2e')](_0xe1bfb8,function(_0x3bc940){if(_0x3bc940['type']!=='VIRTUAL'){var _0x598bcf={};_0x598bcf[_0x3bc940['name']]={'$like':'%'+_0x17c328[_0x8d1f('0x30')][_0x8d1f('0x3c')]+'%'};return _0x598bcf;}})});}_0x21c903=_[_0x8d1f('0x3b')]({},_0x21c903,_0x17c328[_0x8d1f('0x3d')]);var _0x66f7c1={'where':_0x21c903[_0x8d1f('0x38')]};return db[_0x8d1f('0x2b')][_0x8d1f('0x1f')](_0x66f7c1)[_0x8d1f('0x25')](function(_0x49cf2a){_0x4bb6ea[_0x8d1f('0x1f')]=_0x49cf2a;if(_0x17c328[_0x8d1f('0x30')][_0x8d1f('0x3e')]){_0x21c903['include']=[{'all':!![]}];}return db['VoiceMusicOnHold']['findAll'](_0x21c903);})[_0x8d1f('0x25')](function(_0x26841d){_0x4bb6ea[_0x8d1f('0x3f')]=_0x26841d;return _0x4bb6ea;})[_0x8d1f('0x25')](respondWithFilteredResult(_0x3cb68c,_0x21c903))[_0x8d1f('0x40')](handleError(_0x3cb68c,null));};exports[_0x8d1f('0x41')]=function(_0x485e94,_0xc91e7d){var _0x5529e1={'raw':![],'where':{'id':_0x485e94[_0x8d1f('0x42')]['id']}},_0x1cef59={};_0x1cef59[_0x8d1f('0x2d')]=_[_0x8d1f('0x2f')](db[_0x8d1f('0x2b')][_0x8d1f('0x2c')]);_0x1cef59[_0x8d1f('0x30')]=_[_0x8d1f('0x2f')](_0x485e94['query']);_0x1cef59[_0x8d1f('0x39')]=_[_0x8d1f('0x31')](_0x1cef59[_0x8d1f('0x2d')],_0x1cef59['query']);_0x5529e1['attributes']=_[_0x8d1f('0x31')](_0x1cef59[_0x8d1f('0x2d')],qs[_0x8d1f('0x43')](_0x485e94['query'][_0x8d1f('0x43')]));_0x5529e1[_0x8d1f('0x32')]=_0x5529e1['attributes'][_0x8d1f('0x33')]?_0x5529e1['attributes']:_0x1cef59[_0x8d1f('0x2d')];if(_0x485e94[_0x8d1f('0x30')][_0x8d1f('0x3e')]){_0x5529e1[_0x8d1f('0x44')]=[{'all':!![]}];}_0x5529e1=_[_0x8d1f('0x3b')]({},_0x5529e1,_0x485e94[_0x8d1f('0x3d')]);return db[_0x8d1f('0x2b')][_0x8d1f('0x45')](_0x5529e1)[_0x8d1f('0x25')](handleEntityNotFound(_0xc91e7d,null))[_0x8d1f('0x25')](respondWithResult(_0xc91e7d,null))[_0x8d1f('0x40')](handleError(_0xc91e7d,null));};exports[_0x8d1f('0x24')]=function(_0x1aaec1,_0x99babf){if(_0x1aaec1[_0x8d1f('0x46')]['id']){delete _0x1aaec1[_0x8d1f('0x46')]['id'];}return db['VoiceMusicOnHold']['find']({'where':{'id':_0x1aaec1[_0x8d1f('0x42')]['id']}})[_0x8d1f('0x25')](handleEntityNotFound(_0x99babf,null))['then'](saveUpdates(_0x1aaec1[_0x8d1f('0x46')],null))[_0x8d1f('0x25')](respondWithResult(_0x99babf,null))[_0x8d1f('0x40')](handleError(_0x99babf,null));};exports[_0x8d1f('0x47')]=function(_0x8ae4fd,_0x26ffcc,_0x486eaa){return db[_0x8d1f('0x48')][_0x8d1f('0x49')](function(_0x24697e){if(_0x8ae4fd[_0x8d1f('0x46')][_0x8d1f('0x4a')]===_0x8d1f('0x4b')){_0x8ae4fd['body'][_0x8d1f('0x4c')]=path['join'](config[_0x8d1f('0x4d')],_0x8d1f('0x4e'),_0x8ae4fd[_0x8d1f('0x46')][_0x8d1f('0x28')]);}return db[_0x8d1f('0x2b')]['create'](_0x8ae4fd[_0x8d1f('0x46')],{'transaction':_0x24697e})[_0x8d1f('0x25')](function(_0x1dc502){if(_0x8ae4fd['body']['mode']===_0x8d1f('0x4b')){fs[_0x8d1f('0x4f')](_0x1dc502[_0x8d1f('0x4c')],parseInt(_0x8d1f('0x50'),0x8));}var _0x49cf58=_0x8ae4fd[_0x8d1f('0x51')][_0x8d1f('0x26')]({'plain':!![]});if(!_0x49cf58)throw new Error(_0x8d1f('0x52'));if(_0x49cf58[_0x8d1f('0x53')]===_0x8d1f('0x51')){var _0x5a66c7=_0x1dc502[_0x8d1f('0x26')]({'plain':!![]});return db[_0x8d1f('0x54')][_0x8d1f('0x45')]({'where':{'name':_0x8d1f('0x55'),'userProfileId':_0x49cf58[_0x8d1f('0x56')]},'raw':!![]})[_0x8d1f('0x25')](function(_0x2b831b){if(_0x2b831b&&_0x2b831b[_0x8d1f('0x57')]===0x0){return db[_0x8d1f('0x27')][_0x8d1f('0x47')]({'name':_0x5a66c7['name'],'resourceId':_0x5a66c7['id'],'type':_0x2b831b[_0x8d1f('0x28')],'sectionId':_0x2b831b['id']},{})[_0x8d1f('0x25')](function(){return _0x1dc502;});}else{return _0x1dc502;}})[_0x8d1f('0x40')](function(_0x5406b8){logger[_0x8d1f('0x58')](_0x8d1f('0x59'),_0x5406b8);});}return _0x1dc502;});})[_0x8d1f('0x25')](respondWithResult(_0x26ffcc,0xc9))[_0x8d1f('0x40')](handleError(_0x26ffcc,null));};exports[_0x8d1f('0x5a')]=function(_0x4b4947,_0x31da99,_0x397862){var _0x2766cf;return db[_0x8d1f('0x2b')][_0x8d1f('0x45')]({'where':{'id':_0x4b4947[_0x8d1f('0x42')]['id']}})[_0x8d1f('0x25')](function(_0x1c14ea){if(_0x1c14ea){return db['sequelize'][_0x8d1f('0x49')](function(_0x137941){return _0x1c14ea[_0x8d1f('0x5a')]({'transaction':_0x137941,'raw':!![]})[_0x8d1f('0x25')](function(_0x5ff0a6){if(_0x5ff0a6[_0x8d1f('0x4c')]){fs[_0x8d1f('0x5b')](_0x5ff0a6['directory'])[_0x8d1f('0x5c')](function(_0x125bec){fs['unlinkSync'](path[_0x8d1f('0x5d')](_0x5ff0a6[_0x8d1f('0x4c')],_0x125bec));});fs['rmdirSync'](_0x5ff0a6[_0x8d1f('0x4c')]);}return _0x5ff0a6;});})[_0x8d1f('0x40')](function(_0x317fa8){throw new db[(_0x8d1f('0x5e'))][(_0x8d1f('0x5f'))](_0x317fa8[_0x8d1f('0x60')]);});}})['then'](handleEntityNotFound(_0x31da99,null))[_0x8d1f('0x25')](removeEntity(_0x31da99,null))[_0x8d1f('0x40')](handleError(_0x31da99,null));};exports[_0x8d1f('0x61')]=function(_0x16951d,_0x3aaa67,_0x3c15cd){return db[_0x8d1f('0x48')][_0x8d1f('0x49')](function(_0x25e378){var _0x3a2a64;return db[_0x8d1f('0x2b')][_0x8d1f('0x45')]({'where':{'id':_0x16951d[_0x8d1f('0x42')]['id']}})[_0x8d1f('0x25')](function(_0x1415b1){if(_0x1415b1){_0x3a2a64=_0x1415b1;return _0x1415b1[_0x8d1f('0x61')](_0x16951d['body']['id'],{'transaction':_0x25e378});}})[_0x8d1f('0x25')](function(_0x345377){if(_0x345377){return db[_0x8d1f('0x62')][_0x8d1f('0x63')]({'where':{'id':_0x16951d['body']['id']},'attributes':['id',_0x8d1f('0x28'),_0x8d1f('0x64'),_0x8d1f('0x65'),'createdAt'],'raw':!![]});}})[_0x8d1f('0x25')](function(_0x2e5ad4){if(_0x2e5ad4){var _0x2b6624=path[_0x8d1f('0x5d')](config['root'],_0x8d1f('0x66'),util[_0x8d1f('0x67')](_0x8d1f('0x68'),path['basename'](_0x2e5ad4[_0x8d1f('0x64')],path[_0x8d1f('0x69')](_0x2e5ad4['save_name'])),_0x2e5ad4['converted_format']));var _0x164e1f=path[_0x8d1f('0x5d')](config[_0x8d1f('0x4d')],'server/files/moh',_0x3a2a64[_0x8d1f('0x28')],util['format'](_0x8d1f('0x68'),_0x2e5ad4['name'],_0x2e5ad4['converted_format']));fs[_0x8d1f('0x6a')](_0x2b6624,_0x164e1f);return _0x2e5ad4;}})[_0x8d1f('0x40')](function(_0x3a46ab){throw new db[(_0x8d1f('0x5e'))][(_0x8d1f('0x5f'))](_0x3a46ab['message']);});})[_0x8d1f('0x25')](handleEntityNotFound(_0x3aaa67,null))[_0x8d1f('0x25')](respondWithResult(_0x3aaa67,0xc9))[_0x8d1f('0x40')](handleError(_0x3aaa67,null));};exports[_0x8d1f('0x6b')]=function(_0x3c5ee5,_0xb9680f,_0x30cd4c){return db[_0x8d1f('0x48')]['transaction'](function(_0x41d23c){var _0x20114e;return db[_0x8d1f('0x2b')][_0x8d1f('0x63')]({'where':{'id':_0x3c5ee5[_0x8d1f('0x42')]['id']}})[_0x8d1f('0x25')](handleEntityNotFound(_0xb9680f,null))[_0x8d1f('0x25')](function(_0x2d03a6){if(_0x2d03a6){_0x20114e=_0x2d03a6;return _0x2d03a6[_0x8d1f('0x6b')](_0x3c5ee5[_0x8d1f('0x42')][_0x8d1f('0x6c')]);}})['then'](function(_0x3c3391){if(_0x3c3391){return db['Sound'][_0x8d1f('0x63')]({'where':{'id':_0x3c5ee5[_0x8d1f('0x42')][_0x8d1f('0x6c')]},'attributes':['id',_0x8d1f('0x28'),_0x8d1f('0x64'),_0x8d1f('0x65'),_0x8d1f('0x6d')],'raw':!![]});}})[_0x8d1f('0x25')](function(_0x29a7a2){if(_0x29a7a2){fs['unlinkSync'](path['join'](_0x20114e[_0x8d1f('0x4c')],util[_0x8d1f('0x67')](_0x8d1f('0x68'),_0x29a7a2[_0x8d1f('0x28')],_0x29a7a2[_0x8d1f('0x65')])));return _0x29a7a2;}})['catch'](function(_0x56cb2e){throw new db['Sequelize'][(_0x8d1f('0x5f'))](_0x56cb2e[_0x8d1f('0x60')]);});})['then'](handleEntityNotFound(_0xb9680f,null))[_0x8d1f('0x25')](respondWithStatusCode(_0xb9680f,0xcc))[_0x8d1f('0x40')](handleError(_0xb9680f,null));};exports[_0x8d1f('0x6e')]=function(_0x50727f,_0x3e06f2,_0x995e1c){var _0xe05258={};var _0x50ce6d={};var _0x13b17a;var _0x5c4c70;return db[_0x8d1f('0x2b')]['findOne']({'where':{'id':_0x50727f[_0x8d1f('0x42')]['id']}})[_0x8d1f('0x25')](handleEntityNotFound(_0x3e06f2,null))[_0x8d1f('0x25')](function(_0x2595b0){if(_0x2595b0){_0x13b17a=_0x2595b0;_0x50ce6d[_0x8d1f('0x2d')]=_[_0x8d1f('0x2f')](db[_0x8d1f('0x62')]['rawAttributes']);_0x50ce6d[_0x8d1f('0x30')]=_['keys'](_0x50727f[_0x8d1f('0x30')]);_0x50ce6d[_0x8d1f('0x39')]=_['intersection'](_0x50ce6d[_0x8d1f('0x2d')],_0x50ce6d['query']);_0xe05258['attributes']=_[_0x8d1f('0x31')](_0x50ce6d[_0x8d1f('0x2d')],qs[_0x8d1f('0x43')](_0x50727f[_0x8d1f('0x30')][_0x8d1f('0x43')]));_0xe05258[_0x8d1f('0x32')]=_0xe05258[_0x8d1f('0x32')][_0x8d1f('0x33')]?_0xe05258['attributes']:_0x50ce6d[_0x8d1f('0x2d')];_0xe05258['order']=qs[_0x8d1f('0x37')](_0x50727f['query']['sort']);_0xe05258[_0x8d1f('0x38')]=qs[_0x8d1f('0x39')](_[_0x8d1f('0x3a')](_0x50727f[_0x8d1f('0x30')],_0x50ce6d[_0x8d1f('0x39')]));if(_0x50727f[_0x8d1f('0x30')]['filter']){_0xe05258['where']=_[_0x8d1f('0x3b')](_0xe05258[_0x8d1f('0x38')],{'$or':_[_0x8d1f('0x2e')](_0xe05258[_0x8d1f('0x32')],function(_0xa54b02){var _0x2c0316={};_0x2c0316[_0xa54b02]={'$like':'%'+_0x50727f[_0x8d1f('0x30')][_0x8d1f('0x3c')]+'%'};return _0x2c0316;})});}_0xe05258=_[_0x8d1f('0x3b')]({},_0xe05258,_0x50727f[_0x8d1f('0x3d')]);return _0x13b17a[_0x8d1f('0x6e')](_0xe05258);}})[_0x8d1f('0x25')](function(_0xcb9ef1){if(_0xcb9ef1){_0x5c4c70=_0xcb9ef1[_0x8d1f('0x33')];if(!_0x50727f[_0x8d1f('0x30')][_0x8d1f('0x34')]('nolimit')){_0xe05258[_0x8d1f('0x1e')]=qs[_0x8d1f('0x1e')](_0x50727f['query'][_0x8d1f('0x1e')]);_0xe05258[_0x8d1f('0x20')]=qs[_0x8d1f('0x20')](_0x50727f[_0x8d1f('0x30')][_0x8d1f('0x20')]);}return _0x13b17a['getSounds'](_0xe05258);}})[_0x8d1f('0x25')](function(_0xb466aa){if(_0xb466aa){return _0xb466aa?{'count':_0x5c4c70,'rows':_0xb466aa}:null;}})[_0x8d1f('0x25')](respondWithResult(_0x3e06f2,null))[_0x8d1f('0x40')](handleError(_0x3e06f2,null));}; \ No newline at end of file +var _0xbb39=['Sequelize','ValidationError','message','addSound','Sound','findOne','converted_format','createdAt','%s.%s','basename','save_name','extname','server/files/moh','format','symlinkSync','removeSound','id2','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','get','UserProfileResource','end','error','stack','name','index','VoiceMusicOnHold','rawAttributes','type','key','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','params','keys','find','catch','update','body','create','transaction','mode','directory','root','files','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','readdirSync','unlinkSync','join','rmdirSync'];(function(_0x41dc67,_0x351d1f){var _0x500360=function(_0x54bc53){while(--_0x54bc53){_0x41dc67['push'](_0x41dc67['shift']());}};_0x500360(++_0x351d1f);}(_0xbb39,0xf0));var _0x9bb3=function(_0x290df5,_0x2cc0cb){_0x290df5=_0x290df5-0x0;var _0x27c215=_0xbb39[_0x290df5];return _0x27c215;};'use strict';var emlformat=require(_0x9bb3('0x0'));var rimraf=require(_0x9bb3('0x1'));var zipdir=require(_0x9bb3('0x2'));var jsonpatch=require(_0x9bb3('0x3'));var rp=require(_0x9bb3('0x4'));var moment=require('moment');var BPromise=require(_0x9bb3('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9bb3('0x6'));var sox=require(_0x9bb3('0x7'));var csv=require(_0x9bb3('0x8'));var ejs=require(_0x9bb3('0x9'));var fs=require('fs');var fs_extra=require(_0x9bb3('0xa'));var _=require('lodash');var squel=require(_0x9bb3('0xb'));var crypto=require(_0x9bb3('0xc'));var jsforce=require(_0x9bb3('0xd'));var deskjs=require(_0x9bb3('0xe'));var toCsv=require(_0x9bb3('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9bb3('0xf'));var authService=require(_0x9bb3('0x10'));var qs=require(_0x9bb3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9bb3('0x12'));var logger=require('../../config/logger')(_0x9bb3('0x13'));var utils=require(_0x9bb3('0x14'));var config=require(_0x9bb3('0x15'));var licenseUtil=require(_0x9bb3('0x16'));var db=require(_0x9bb3('0x17'))['db'];function respondWithStatusCode(_0x30ee9d,_0x17a53a){_0x17a53a=_0x17a53a||0xcc;return function(_0x4c68cc){if(_0x4c68cc){return _0x30ee9d[_0x9bb3('0x18')](_0x17a53a);}return _0x30ee9d[_0x9bb3('0x19')](_0x17a53a)['end']();};}function respondWithResult(_0x230ae6,_0xc39609){_0xc39609=_0xc39609||0xc8;return function(_0x591d8e){if(_0x591d8e){return _0x230ae6[_0x9bb3('0x19')](_0xc39609)[_0x9bb3('0x1a')](_0x591d8e);}};}function respondWithFilteredResult(_0x1fe973,_0xb1a557){return function(_0x48fbec){if(_0x48fbec){var _0x81f7df=typeof _0xb1a557[_0x9bb3('0x1b')]===_0x9bb3('0x1c')&&typeof _0xb1a557['limit']===_0x9bb3('0x1c');var _0x40ea05=_0x48fbec[_0x9bb3('0x1d')];var _0x1f054a=_0x81f7df?0x0:_0xb1a557['offset'];var _0x3cfe3f=_0x81f7df?_0x48fbec[_0x9bb3('0x1d')]:_0xb1a557[_0x9bb3('0x1b')]+_0xb1a557[_0x9bb3('0x1e')];var _0x4b0940;if(_0x3cfe3f>=_0x40ea05){_0x3cfe3f=_0x40ea05;_0x4b0940=0xc8;}else{_0x4b0940=0xce;}_0x1fe973[_0x9bb3('0x19')](_0x4b0940);return _0x1fe973['set'](_0x9bb3('0x1f'),_0x1f054a+'-'+_0x3cfe3f+'/'+_0x40ea05)[_0x9bb3('0x1a')](_0x48fbec);}return null;};}function patchUpdates(_0x268c6c){return function(_0x217da4){try{jsonpatch[_0x9bb3('0x20')](_0x217da4,_0x268c6c,!![]);}catch(_0x4e799b){return BPromise[_0x9bb3('0x21')](_0x4e799b);}return _0x217da4[_0x9bb3('0x22')]();};}function saveUpdates(_0x1be369,_0x5efca7){return function(_0x10f326){if(_0x10f326){return _0x10f326['update'](_0x1be369)['then'](function(_0x2030c3){return _0x2030c3;});}return null;};}function removeEntity(_0x4366a3,_0x258999){return function(_0x30f3f0){if(_0x30f3f0){return _0x30f3f0['destroy']()[_0x9bb3('0x23')](function(){var _0x13de8c=_0x30f3f0[_0x9bb3('0x24')]({'plain':!![]});var _0xbff03a='MusicOnHolds';return db[_0x9bb3('0x25')]['destroy']({'where':{'type':_0xbff03a,'resourceId':_0x13de8c['id']}})[_0x9bb3('0x23')](function(){return _0x30f3f0;});})[_0x9bb3('0x23')](function(){_0x4366a3[_0x9bb3('0x19')](0xcc)[_0x9bb3('0x26')]();});}};}function handleEntityNotFound(_0x3e6d4e,_0x14e87d){return function(_0x545b89){if(!_0x545b89){_0x3e6d4e['sendStatus'](0x194);}return _0x545b89;};}function handleError(_0x15343c,_0x2fad48){_0x2fad48=_0x2fad48||0x1f4;return function(_0x46733c){logger[_0x9bb3('0x27')](_0x46733c[_0x9bb3('0x28')]);if(_0x46733c[_0x9bb3('0x29')]){delete _0x46733c[_0x9bb3('0x29')];}_0x15343c[_0x9bb3('0x19')](_0x2fad48)['send'](_0x46733c);};}exports[_0x9bb3('0x2a')]=function(_0x2d5166,_0x50c25a){var _0x809006={},_0x131bf1={},_0x51e478={'count':0x0,'rows':[]};var _0x285dd7=_['map'](db[_0x9bb3('0x2b')][_0x9bb3('0x2c')],function(_0x3e2b70){return{'name':_0x3e2b70['fieldName'],'type':_0x3e2b70[_0x9bb3('0x2d')][_0x9bb3('0x2e')]};});_0x131bf1['model']=_[_0x9bb3('0x2f')](_0x285dd7,_0x9bb3('0x29'));_0x131bf1[_0x9bb3('0x30')]=_['keys'](_0x2d5166[_0x9bb3('0x30')]);_0x131bf1[_0x9bb3('0x31')]=_[_0x9bb3('0x32')](_0x131bf1[_0x9bb3('0x33')],_0x131bf1[_0x9bb3('0x30')]);_0x809006['attributes']=_['intersection'](_0x131bf1[_0x9bb3('0x33')],qs[_0x9bb3('0x34')](_0x2d5166[_0x9bb3('0x30')]['fields']));_0x809006[_0x9bb3('0x35')]=_0x809006['attributes'][_0x9bb3('0x36')]?_0x809006[_0x9bb3('0x35')]:_0x131bf1[_0x9bb3('0x33')];if(!_0x2d5166['query'][_0x9bb3('0x37')]('nolimit')){_0x809006[_0x9bb3('0x1e')]=qs[_0x9bb3('0x1e')](_0x2d5166['query'][_0x9bb3('0x1e')]);_0x809006[_0x9bb3('0x1b')]=qs[_0x9bb3('0x1b')](_0x2d5166[_0x9bb3('0x30')]['offset']);}_0x809006[_0x9bb3('0x38')]=qs[_0x9bb3('0x39')](_0x2d5166[_0x9bb3('0x30')][_0x9bb3('0x39')]);delete _0x2d5166[_0x9bb3('0x30')][_0x9bb3('0x39')];_0x809006[_0x9bb3('0x3a')]=qs[_0x9bb3('0x31')](_[_0x9bb3('0x3b')](_0x2d5166[_0x9bb3('0x30')],_0x131bf1['filters']),_0x285dd7);if(_0x2d5166[_0x9bb3('0x30')]['filter']){_0x809006[_0x9bb3('0x3a')]=_[_0x9bb3('0x3c')](_0x809006[_0x9bb3('0x3a')],{'$or':_['map'](_0x285dd7,function(_0x149e8a){if(_0x149e8a[_0x9bb3('0x2d')]!==_0x9bb3('0x3d')){var _0x451ed0={};_0x451ed0[_0x149e8a[_0x9bb3('0x29')]]={'$like':'%'+_0x2d5166[_0x9bb3('0x30')][_0x9bb3('0x3e')]+'%'};return _0x451ed0;}})});}_0x809006=_[_0x9bb3('0x3c')]({},_0x809006,_0x2d5166[_0x9bb3('0x3f')]);var _0x320162={'where':_0x809006[_0x9bb3('0x3a')]};return db[_0x9bb3('0x2b')][_0x9bb3('0x1d')](_0x320162)[_0x9bb3('0x23')](function(_0x43a798){_0x51e478[_0x9bb3('0x1d')]=_0x43a798;if(_0x2d5166[_0x9bb3('0x30')][_0x9bb3('0x40')]){_0x809006[_0x9bb3('0x41')]=[{'all':!![]}];}return db[_0x9bb3('0x2b')]['findAll'](_0x809006);})[_0x9bb3('0x23')](function(_0xa7f74c){_0x51e478[_0x9bb3('0x42')]=_0xa7f74c;return _0x51e478;})[_0x9bb3('0x23')](respondWithFilteredResult(_0x50c25a,_0x809006))['catch'](handleError(_0x50c25a,null));};exports['show']=function(_0x44bd39,_0x2250c7){var _0x231e96={'raw':![],'where':{'id':_0x44bd39[_0x9bb3('0x43')]['id']}},_0x2e005f={};_0x2e005f[_0x9bb3('0x33')]=_[_0x9bb3('0x44')](db[_0x9bb3('0x2b')][_0x9bb3('0x2c')]);_0x2e005f[_0x9bb3('0x30')]=_[_0x9bb3('0x44')](_0x44bd39[_0x9bb3('0x30')]);_0x2e005f[_0x9bb3('0x31')]=_['intersection'](_0x2e005f[_0x9bb3('0x33')],_0x2e005f[_0x9bb3('0x30')]);_0x231e96['attributes']=_[_0x9bb3('0x32')](_0x2e005f[_0x9bb3('0x33')],qs[_0x9bb3('0x34')](_0x44bd39[_0x9bb3('0x30')]['fields']));_0x231e96[_0x9bb3('0x35')]=_0x231e96[_0x9bb3('0x35')][_0x9bb3('0x36')]?_0x231e96[_0x9bb3('0x35')]:_0x2e005f[_0x9bb3('0x33')];if(_0x44bd39['query'][_0x9bb3('0x40')]){_0x231e96[_0x9bb3('0x41')]=[{'all':!![]}];}_0x231e96=_[_0x9bb3('0x3c')]({},_0x231e96,_0x44bd39[_0x9bb3('0x3f')]);return db[_0x9bb3('0x2b')][_0x9bb3('0x45')](_0x231e96)[_0x9bb3('0x23')](handleEntityNotFound(_0x2250c7,null))[_0x9bb3('0x23')](respondWithResult(_0x2250c7,null))[_0x9bb3('0x46')](handleError(_0x2250c7,null));};exports[_0x9bb3('0x47')]=function(_0x3facdc,_0x20f433){if(_0x3facdc[_0x9bb3('0x48')]['id']){delete _0x3facdc[_0x9bb3('0x48')]['id'];}return db['VoiceMusicOnHold']['find']({'where':{'id':_0x3facdc['params']['id']}})[_0x9bb3('0x23')](handleEntityNotFound(_0x20f433,null))[_0x9bb3('0x23')](saveUpdates(_0x3facdc['body'],null))[_0x9bb3('0x23')](respondWithResult(_0x20f433,null))[_0x9bb3('0x46')](handleError(_0x20f433,null));};exports[_0x9bb3('0x49')]=function(_0x2c28eb,_0x2bb4bf,_0x73f7dc){return db['sequelize'][_0x9bb3('0x4a')](function(_0x5dca2d){if(_0x2c28eb[_0x9bb3('0x48')][_0x9bb3('0x4b')]==='files'){_0x2c28eb[_0x9bb3('0x48')][_0x9bb3('0x4c')]=path['join'](config[_0x9bb3('0x4d')],'server/files/moh',_0x2c28eb[_0x9bb3('0x48')][_0x9bb3('0x29')]);}return db[_0x9bb3('0x2b')][_0x9bb3('0x49')](_0x2c28eb[_0x9bb3('0x48')],{'transaction':_0x5dca2d})['then'](function(_0x213af4){if(_0x2c28eb['body'][_0x9bb3('0x4b')]===_0x9bb3('0x4e')){fs[_0x9bb3('0x4f')](_0x213af4['directory'],parseInt(_0x9bb3('0x50'),0x8));}var _0x299144=_0x2c28eb[_0x9bb3('0x51')][_0x9bb3('0x24')]({'plain':!![]});if(!_0x299144)throw new Error(_0x9bb3('0x52'));if(_0x299144[_0x9bb3('0x53')]===_0x9bb3('0x51')){var _0x2600f2=_0x213af4[_0x9bb3('0x24')]({'plain':!![]});return db['UserProfileSection'][_0x9bb3('0x45')]({'where':{'name':'MusicOnHolds','userProfileId':_0x299144[_0x9bb3('0x54')]},'raw':!![]})['then'](function(_0x4b959f){if(_0x4b959f&&_0x4b959f[_0x9bb3('0x55')]===0x0){return db[_0x9bb3('0x25')][_0x9bb3('0x49')]({'name':_0x2600f2['name'],'resourceId':_0x2600f2['id'],'type':_0x4b959f['name'],'sectionId':_0x4b959f['id']},{})[_0x9bb3('0x23')](function(){return _0x213af4;});}else{return _0x213af4;}})[_0x9bb3('0x46')](function(_0x4304b6){logger[_0x9bb3('0x27')](_0x9bb3('0x56'),_0x4304b6);});}return _0x213af4;});})[_0x9bb3('0x23')](respondWithResult(_0x2bb4bf,0xc9))[_0x9bb3('0x46')](handleError(_0x2bb4bf,null));};exports[_0x9bb3('0x57')]=function(_0x5e07c1,_0x42c657,_0x4a68d5){var _0x134639;return db[_0x9bb3('0x2b')][_0x9bb3('0x45')]({'where':{'id':_0x5e07c1[_0x9bb3('0x43')]['id']}})[_0x9bb3('0x23')](function(_0x3a3341){if(_0x3a3341){return db[_0x9bb3('0x58')][_0x9bb3('0x4a')](function(_0x58c8a2){return _0x3a3341[_0x9bb3('0x57')]({'transaction':_0x58c8a2,'raw':!![]})[_0x9bb3('0x23')](function(_0x10e0ad){if(_0x10e0ad['directory']){fs[_0x9bb3('0x59')](_0x10e0ad[_0x9bb3('0x4c')])['forEach'](function(_0x3b2936){fs[_0x9bb3('0x5a')](path[_0x9bb3('0x5b')](_0x10e0ad[_0x9bb3('0x4c')],_0x3b2936));});fs[_0x9bb3('0x5c')](_0x10e0ad[_0x9bb3('0x4c')]);}return _0x10e0ad;});})[_0x9bb3('0x46')](function(_0x1f2156){throw new db[(_0x9bb3('0x5d'))][(_0x9bb3('0x5e'))](_0x1f2156[_0x9bb3('0x5f')]);});}})[_0x9bb3('0x23')](handleEntityNotFound(_0x42c657,null))['then'](removeEntity(_0x42c657,null))[_0x9bb3('0x46')](handleError(_0x42c657,null));};exports['addSound']=function(_0x42c30b,_0x26ba4d,_0x247a16){return db[_0x9bb3('0x58')]['transaction'](function(_0xb42f00){var _0x49469b;return db[_0x9bb3('0x2b')][_0x9bb3('0x45')]({'where':{'id':_0x42c30b[_0x9bb3('0x43')]['id']}})['then'](function(_0x40208e){if(_0x40208e){_0x49469b=_0x40208e;return _0x40208e[_0x9bb3('0x60')](_0x42c30b[_0x9bb3('0x48')]['id'],{'transaction':_0xb42f00});}})['then'](function(_0x4f4b26){if(_0x4f4b26){return db[_0x9bb3('0x61')][_0x9bb3('0x62')]({'where':{'id':_0x42c30b['body']['id']},'attributes':['id',_0x9bb3('0x29'),'save_name',_0x9bb3('0x63'),_0x9bb3('0x64')],'raw':!![]});}})['then'](function(_0x198388){if(_0x198388){var _0x351a65=path[_0x9bb3('0x5b')](config['root'],'server/files/sounds/converted',util['format'](_0x9bb3('0x65'),path[_0x9bb3('0x66')](_0x198388[_0x9bb3('0x67')],path[_0x9bb3('0x68')](_0x198388['save_name'])),_0x198388[_0x9bb3('0x63')]));var _0x594707=path[_0x9bb3('0x5b')](config[_0x9bb3('0x4d')],_0x9bb3('0x69'),_0x49469b[_0x9bb3('0x29')],util[_0x9bb3('0x6a')](_0x9bb3('0x65'),_0x198388[_0x9bb3('0x29')],_0x198388[_0x9bb3('0x63')]));fs[_0x9bb3('0x6b')](_0x351a65,_0x594707);return _0x198388;}})['catch'](function(_0x94a69a){throw new db['Sequelize'][(_0x9bb3('0x5e'))](_0x94a69a[_0x9bb3('0x5f')]);});})[_0x9bb3('0x23')](handleEntityNotFound(_0x26ba4d,null))['then'](respondWithResult(_0x26ba4d,0xc9))[_0x9bb3('0x46')](handleError(_0x26ba4d,null));};exports[_0x9bb3('0x6c')]=function(_0x23d93e,_0x33ee88,_0x4bae52){return db[_0x9bb3('0x58')]['transaction'](function(_0x4e777a){var _0x163d26;return db[_0x9bb3('0x2b')]['findOne']({'where':{'id':_0x23d93e['params']['id']}})['then'](handleEntityNotFound(_0x33ee88,null))['then'](function(_0x3ef2bc){if(_0x3ef2bc){_0x163d26=_0x3ef2bc;return _0x3ef2bc[_0x9bb3('0x6c')](_0x23d93e[_0x9bb3('0x43')][_0x9bb3('0x6d')]);}})['then'](function(_0x1b7e52){if(_0x1b7e52){return db['Sound'][_0x9bb3('0x62')]({'where':{'id':_0x23d93e[_0x9bb3('0x43')][_0x9bb3('0x6d')]},'attributes':['id','name',_0x9bb3('0x67'),_0x9bb3('0x63'),'createdAt'],'raw':!![]});}})[_0x9bb3('0x23')](function(_0x1e7c15){if(_0x1e7c15){fs['unlinkSync'](path[_0x9bb3('0x5b')](_0x163d26[_0x9bb3('0x4c')],util[_0x9bb3('0x6a')]('%s.%s',_0x1e7c15['name'],_0x1e7c15[_0x9bb3('0x63')])));return _0x1e7c15;}})[_0x9bb3('0x46')](function(_0xcbc20a){throw new db[(_0x9bb3('0x5d'))][(_0x9bb3('0x5e'))](_0xcbc20a[_0x9bb3('0x5f')]);});})[_0x9bb3('0x23')](handleEntityNotFound(_0x33ee88,null))[_0x9bb3('0x23')](respondWithStatusCode(_0x33ee88,0xcc))[_0x9bb3('0x46')](handleError(_0x33ee88,null));};exports[_0x9bb3('0x6e')]=function(_0x59d6c6,_0x242034,_0x109b73){var _0x2c32b5={};var _0x3842d6={};var _0x465ef4;var _0x1b1396;return db[_0x9bb3('0x2b')][_0x9bb3('0x62')]({'where':{'id':_0x59d6c6[_0x9bb3('0x43')]['id']}})['then'](handleEntityNotFound(_0x242034,null))['then'](function(_0xca7c70){if(_0xca7c70){_0x465ef4=_0xca7c70;_0x3842d6[_0x9bb3('0x33')]=_[_0x9bb3('0x44')](db[_0x9bb3('0x61')]['rawAttributes']);_0x3842d6[_0x9bb3('0x30')]=_[_0x9bb3('0x44')](_0x59d6c6[_0x9bb3('0x30')]);_0x3842d6[_0x9bb3('0x31')]=_[_0x9bb3('0x32')](_0x3842d6[_0x9bb3('0x33')],_0x3842d6['query']);_0x2c32b5[_0x9bb3('0x35')]=_[_0x9bb3('0x32')](_0x3842d6['model'],qs[_0x9bb3('0x34')](_0x59d6c6[_0x9bb3('0x30')][_0x9bb3('0x34')]));_0x2c32b5['attributes']=_0x2c32b5[_0x9bb3('0x35')][_0x9bb3('0x36')]?_0x2c32b5[_0x9bb3('0x35')]:_0x3842d6[_0x9bb3('0x33')];_0x2c32b5['order']=qs['sort'](_0x59d6c6['query'][_0x9bb3('0x39')]);_0x2c32b5['where']=qs[_0x9bb3('0x31')](_[_0x9bb3('0x3b')](_0x59d6c6[_0x9bb3('0x30')],_0x3842d6[_0x9bb3('0x31')]));if(_0x59d6c6[_0x9bb3('0x30')][_0x9bb3('0x3e')]){_0x2c32b5[_0x9bb3('0x3a')]=_[_0x9bb3('0x3c')](_0x2c32b5['where'],{'$or':_[_0x9bb3('0x2f')](_0x2c32b5[_0x9bb3('0x35')],function(_0x3641ed){var _0x5daaf9={};_0x5daaf9[_0x3641ed]={'$like':'%'+_0x59d6c6['query'][_0x9bb3('0x3e')]+'%'};return _0x5daaf9;})});}_0x2c32b5=_[_0x9bb3('0x3c')]({},_0x2c32b5,_0x59d6c6[_0x9bb3('0x3f')]);return _0x465ef4[_0x9bb3('0x6e')](_0x2c32b5);}})['then'](function(_0x57bbc4){if(_0x57bbc4){_0x1b1396=_0x57bbc4['length'];if(!_0x59d6c6['query'][_0x9bb3('0x37')]('nolimit')){_0x2c32b5[_0x9bb3('0x1e')]=qs[_0x9bb3('0x1e')](_0x59d6c6[_0x9bb3('0x30')][_0x9bb3('0x1e')]);_0x2c32b5['offset']=qs[_0x9bb3('0x1b')](_0x59d6c6[_0x9bb3('0x30')][_0x9bb3('0x1b')]);}return _0x465ef4['getSounds'](_0x2c32b5);}})[_0x9bb3('0x23')](function(_0x4993fb){if(_0x4993fb){return _0x4993fb?{'count':_0x1b1396,'rows':_0x4993fb}:null;}})[_0x9bb3('0x23')](respondWithResult(_0x242034,null))[_0x9bb3('0x46')](handleError(_0x242034,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 23b4ff9..c67f07b 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 _0xef69=['../../config/logger','api','request-promise','rimraf','./voiceMusicOnHold.attributes','define','VoiceMusicOnHold','voice_musiconhold','lodash'];(function(_0x54b539,_0xdf871e){var _0xb4222b=function(_0x20ae2e){while(--_0x20ae2e){_0x54b539['push'](_0x54b539['shift']());}};_0xb4222b(++_0xdf871e);}(_0xef69,0x10d));var _0x9ef6=function(_0x162c89,_0x3bfbe9){_0x162c89=_0x162c89-0x0;var _0x42cf58=_0xef69[_0x162c89];return _0x42cf58;};'use strict';var _=require(_0x9ef6('0x0'));var util=require('util');var logger=require(_0x9ef6('0x1'))(_0x9ef6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9ef6('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9ef6('0x4'));var config=require('../../config/environment');var attributes=require(_0x9ef6('0x5'));module['exports']=function(_0x267155,_0x48f090){return _0x267155[_0x9ef6('0x6')](_0x9ef6('0x7'),attributes,{'tableName':_0x9ef6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x475e=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceMusicOnHold'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x475e,0xd0));var _0xe475=function(_0x251b09,_0x30436a){_0x251b09=_0x251b09-0x0;var _0x772481=_0x475e[_0x251b09];return _0x772481;};'use strict';var _=require(_0xe475('0x0'));var util=require(_0xe475('0x1'));var logger=require(_0xe475('0x2'))(_0xe475('0x3'));var moment=require(_0xe475('0x4'));var BPromise=require(_0xe475('0x5'));var rp=require(_0xe475('0x6'));var fs=require('fs');var path=require(_0xe475('0x7'));var rimraf=require(_0xe475('0x8'));var config=require(_0xe475('0x9'));var attributes=require('./voiceMusicOnHold.attributes');module[_0xe475('0xa')]=function(_0x162a0b,_0x2e1815){return _0x162a0b[_0xe475('0xb')](_0xe475('0xc'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 7e89a3c..7f1b448 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3f87af,_0x2caa2c){var _0x467278=function(_0x21b722){while(--_0x21b722){_0x3f87af['push'](_0x3f87af['shift']());}};_0x467278(++_0x2caa2c);}(_0x70e0,0x17b));var _0x070e=function(_0x39ce2e,_0x3567ba){_0x39ce2e=_0x39ce2e-0x0;var _0x156285=_0x70e0[_0x39ce2e];return _0x156285;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x40369f,_0x2ba665){var _0x1dbf30=function(_0x35156d){while(--_0x35156d){_0x40369f['push'](_0x40369f['shift']());}};_0x1dbf30(++_0x2ba665);}(_0xe706,0xa3));var _0x6e70=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xe706[_0x8de54f];return _0x14cba4;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 01b0d2c..74b2435 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 _0xf873=['index','/describe','describe','/:id','/:id/users','getAgents','/:id/teams','getTeams','post','create','addTeams','put','update','delete','removeTeams','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x2d53c3,_0x21427f){var _0x2106f0=function(_0xd4e169){while(--_0xd4e169){_0x2d53c3['push'](_0x2d53c3['shift']());}};_0x2106f0(++_0x21427f);}(_0xf873,0xb2));var _0x3f87=function(_0x27e0ec,_0x3f03db){_0x27e0ec=_0x27e0ec-0x0;var _0x3e11e1=_0xf873[_0x27e0ec];return _0x3e11e1;};'use strict';var multer=require('multer');var util=require(_0x3f87('0x0'));var path=require(_0x3f87('0x1'));var timeout=require(_0x3f87('0x2'));var express=require(_0x3f87('0x3'));var router=express[_0x3f87('0x4')]();var fs_extra=require(_0x3f87('0x5'));var auth=require(_0x3f87('0x6'));var interaction=require(_0x3f87('0x7'));var config=require(_0x3f87('0x8'));var controller=require('./voicePrefix.controller');router[_0x3f87('0x9')]('/',auth[_0x3f87('0xa')](),controller[_0x3f87('0xb')]);router['get'](_0x3f87('0xc'),auth[_0x3f87('0xa')](),controller[_0x3f87('0xd')]);router[_0x3f87('0x9')](_0x3f87('0xe'),auth[_0x3f87('0xa')](),controller['show']);router[_0x3f87('0x9')](_0x3f87('0xf'),auth[_0x3f87('0xa')](),controller[_0x3f87('0x10')]);router[_0x3f87('0x9')](_0x3f87('0x11'),auth[_0x3f87('0xa')](),controller[_0x3f87('0x12')]);router[_0x3f87('0x13')]('/',auth[_0x3f87('0xa')](),controller[_0x3f87('0x14')]);router[_0x3f87('0x13')](_0x3f87('0xf'),auth[_0x3f87('0xa')](),controller['addAgents']);router[_0x3f87('0x13')](_0x3f87('0x11'),auth['isAuthenticated'](),controller[_0x3f87('0x15')]);router[_0x3f87('0x16')](_0x3f87('0xe'),auth[_0x3f87('0xa')](),controller[_0x3f87('0x17')]);router[_0x3f87('0x18')](_0x3f87('0xe'),auth[_0x3f87('0xa')](),controller['destroy']);router[_0x3f87('0x18')](_0x3f87('0xf'),auth[_0x3f87('0xa')](),controller['removeAgents']);router[_0x3f87('0x18')]('/:id/teams',auth[_0x3f87('0xa')](),controller[_0x3f87('0x19')]);module[_0x3f87('0x1a')]=router; \ No newline at end of file +var _0xa87e=['getTeams','post','addTeams','put','delete','removeAgents','removeTeams','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/users','getAgents','/:id/teams'];(function(_0x56aa66,_0x1ddf52){var _0xeba9ff=function(_0x5467b5){while(--_0x5467b5){_0x56aa66['push'](_0x56aa66['shift']());}};_0xeba9ff(++_0x1ddf52);}(_0xa87e,0x1c2));var _0xea87=function(_0x468cfb,_0x2fc025){_0x468cfb=_0x468cfb-0x0;var _0x194020=_0xa87e[_0x468cfb];return _0x194020;};'use strict';var multer=require(_0xea87('0x0'));var util=require(_0xea87('0x1'));var path=require(_0xea87('0x2'));var timeout=require(_0xea87('0x3'));var express=require('express');var router=express[_0xea87('0x4')]();var fs_extra=require(_0xea87('0x5'));var auth=require(_0xea87('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xea87('0x7'));var controller=require(_0xea87('0x8'));router[_0xea87('0x9')]('/',auth[_0xea87('0xa')](),controller['index']);router[_0xea87('0x9')](_0xea87('0xb'),auth[_0xea87('0xa')](),controller[_0xea87('0xc')]);router[_0xea87('0x9')](_0xea87('0xd'),auth[_0xea87('0xa')](),controller[_0xea87('0xe')]);router[_0xea87('0x9')](_0xea87('0xf'),auth[_0xea87('0xa')](),controller[_0xea87('0x10')]);router['get'](_0xea87('0x11'),auth[_0xea87('0xa')](),controller[_0xea87('0x12')]);router['post']('/',auth[_0xea87('0xa')](),controller['create']);router[_0xea87('0x13')](_0xea87('0xf'),auth[_0xea87('0xa')](),controller['addAgents']);router[_0xea87('0x13')](_0xea87('0x11'),auth[_0xea87('0xa')](),controller[_0xea87('0x14')]);router[_0xea87('0x15')](_0xea87('0xd'),auth[_0xea87('0xa')](),controller['update']);router[_0xea87('0x16')]('/:id',auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xea87('0xf'),auth[_0xea87('0xa')](),controller[_0xea87('0x17')]);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xea87('0x18')]);module[_0xea87('0x19')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index b3d08b0..ec76f4f 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 _0xbed3=['STRING','name','VIRTUAL','system-','sequelize','exports'];(function(_0x43576f,_0x1356ed){var _0x4d2466=function(_0x865deb){while(--_0x865deb){_0x43576f['push'](_0x43576f['shift']());}};_0x4d2466(++_0x1356ed);}(_0xbed3,0x106));var _0x3bed=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xbed3[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x3bed('0x0'));module[_0x3bed('0x1')]={'name':{'type':Sequelize[_0x3bed('0x2')],'allowNull':![],'unique':_0x3bed('0x3')},'prefix':{'type':Sequelize[_0x3bed('0x4')],'get':function(_0xb13a7a){return _0x3bed('0x5')+this['getDataValue'](_0x3bed('0x3'))+'-';}},'description':{'type':Sequelize[_0x3bed('0x2')]},'callerIdAll':{'type':Sequelize[_0x3bed('0x2')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xf361=['sequelize','exports','name','VIRTUAL','system-','getDataValue','STRING'];(function(_0x5d9af5,_0x5b41ca){var _0x1d379b=function(_0x2295fa){while(--_0x2295fa){_0x5d9af5['push'](_0x5d9af5['shift']());}};_0x1d379b(++_0x5b41ca);}(_0xf361,0x77));var _0x1f36=function(_0x246088,_0x3b348d){_0x246088=_0x246088-0x0;var _0xebaba1=_0xf361[_0x246088];return _0xebaba1;};'use strict';var Sequelize=require(_0x1f36('0x0'));module[_0x1f36('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1f36('0x2')},'prefix':{'type':Sequelize[_0x1f36('0x3')],'get':function(_0x20dfa4){return _0x1f36('0x4')+this[_0x1f36('0x5')](_0x1f36('0x2'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x1f36('0x6')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 5d1fc2f..6a42107 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 _0x1c9a=['sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','offset','limit','undefined','set','Content-Range','apply','reject','update','then','destroy','VoicePrefixes','UserProfileResource','error','stack','send','index','map','VoicePrefix','rawAttributes','fieldName','type','model','name','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','find','params','describe','sequelize','create','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','VoiceExtension','Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','Set','PREFIX-CALLERIDALL=','No\x20callerid\x20available','context','${EXTEN:','charAt','body','system-','transaction','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','User','filter','getAgents','getTeams','findOne','addTeams','Team','Agents','online','voicePause','flatMap','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','every','TeamId','includes','all','union','compact','isEmpty','eml-format','zip-dir','request-promise','moment','bluebird','util','path'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x1c9a,0x98));var _0xa1c9=function(_0x3f218a,_0x225de1){_0x3f218a=_0x3f218a-0x0;var _0x24407b=_0x1c9a[_0x3f218a];return _0x24407b;};'use strict';var emlformat=require(_0xa1c9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa1c9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa1c9('0x2'));var moment=require(_0xa1c9('0x3'));var BPromise=require(_0xa1c9('0x4'));var Mustache=require('mustache');var util=require(_0xa1c9('0x5'));var path=require(_0xa1c9('0x6'));var sox=require(_0xa1c9('0x7'));var csv=require(_0xa1c9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa1c9('0x9'));var _=require('lodash');var squel=require(_0xa1c9('0xa'));var crypto=require(_0xa1c9('0xb'));var jsforce=require(_0xa1c9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa1c9('0x8'));var querystring=require(_0xa1c9('0xd'));var Papa=require(_0xa1c9('0xe'));var Redis=require(_0xa1c9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa1c9('0x10'));var as=require(_0xa1c9('0x11'));var hardwareService=require(_0xa1c9('0x12'));var logger=require(_0xa1c9('0x13'))(_0xa1c9('0x14'));var utils=require(_0xa1c9('0x15'));var config=require(_0xa1c9('0x16'));var licenseUtil=require(_0xa1c9('0x17'));var db=require(_0xa1c9('0x18'))['db'];config[_0xa1c9('0x19')]=_['defaults'](config[_0xa1c9('0x19')],{'host':_0xa1c9('0x1a'),'port':0x18eb});var socket=require(_0xa1c9('0x1b'))(new Redis(config[_0xa1c9('0x19')]));require(_0xa1c9('0x1c'))['register'](socket);function respondWithStatusCode(_0x335dda,_0x4b2fa5){_0x4b2fa5=_0x4b2fa5||0xcc;return function(_0x2cba13){if(_0x2cba13){return _0x335dda[_0xa1c9('0x1d')](_0x4b2fa5);}return _0x335dda[_0xa1c9('0x1e')](_0x4b2fa5)[_0xa1c9('0x1f')]();};}function respondWithResult(_0x44ab5b,_0x3b51f5){_0x3b51f5=_0x3b51f5||0xc8;return function(_0x1f6d26){if(_0x1f6d26){return _0x44ab5b[_0xa1c9('0x1e')](_0x3b51f5)['json'](_0x1f6d26);}};}function respondWithFilteredResult(_0x11ca10,_0x1084d2){return function(_0x224ae4){if(_0x224ae4){var _0x50db9b=typeof _0x1084d2[_0xa1c9('0x20')]==='undefined'&&typeof _0x1084d2[_0xa1c9('0x21')]===_0xa1c9('0x22');var _0x204d54=_0x224ae4['count'];var _0x3a1110=_0x50db9b?0x0:_0x1084d2[_0xa1c9('0x20')];var _0x128732=_0x50db9b?_0x224ae4['count']:_0x1084d2[_0xa1c9('0x20')]+_0x1084d2[_0xa1c9('0x21')];var _0x4c6dbb;if(_0x128732>=_0x204d54){_0x128732=_0x204d54;_0x4c6dbb=0xc8;}else{_0x4c6dbb=0xce;}_0x11ca10[_0xa1c9('0x1e')](_0x4c6dbb);return _0x11ca10[_0xa1c9('0x23')](_0xa1c9('0x24'),_0x3a1110+'-'+_0x128732+'/'+_0x204d54)['json'](_0x224ae4);}return null;};}function patchUpdates(_0x29f1b1){return function(_0x3dcec5){try{jsonpatch[_0xa1c9('0x25')](_0x3dcec5,_0x29f1b1,!![]);}catch(_0x23a461){return BPromise[_0xa1c9('0x26')](_0x23a461);}return _0x3dcec5['save']();};}function saveUpdates(_0x50b16b,_0x200749){return function(_0x50b16d){if(_0x50b16d){return _0x50b16d[_0xa1c9('0x27')](_0x50b16b)[_0xa1c9('0x28')](function(_0x1c6f37){return _0x1c6f37;});}return null;};}function removeEntity(_0x3059eb,_0x339ed1){return function(_0x522dc0){if(_0x522dc0){return _0x522dc0[_0xa1c9('0x29')]()[_0xa1c9('0x28')](function(){var _0x20cbe1=_0x522dc0['get']({'plain':!![]});var _0x133f80=_0xa1c9('0x2a');return db[_0xa1c9('0x2b')]['destroy']({'where':{'type':_0x133f80,'resourceId':_0x20cbe1['id']}})[_0xa1c9('0x28')](function(){return _0x522dc0;});})[_0xa1c9('0x28')](function(){_0x3059eb['status'](0xcc)[_0xa1c9('0x1f')]();});}};}function handleEntityNotFound(_0x48ce34,_0xdf6d0c){return function(_0x2404c3){if(!_0x2404c3){_0x48ce34[_0xa1c9('0x1d')](0x194);}return _0x2404c3;};}function handleError(_0x254b13,_0x40b9d5){_0x40b9d5=_0x40b9d5||0x1f4;return function(_0xe8523b){logger[_0xa1c9('0x2c')](_0xe8523b[_0xa1c9('0x2d')]);if(_0xe8523b['name']){delete _0xe8523b['name'];}_0x254b13[_0xa1c9('0x1e')](_0x40b9d5)[_0xa1c9('0x2e')](_0xe8523b);};}exports[_0xa1c9('0x2f')]=function(_0xf419d0,_0x3161b0){var _0x5b67c3={},_0x53f325={},_0x5aecd7={'count':0x0,'rows':[]};var _0x259ac3=_[_0xa1c9('0x30')](db[_0xa1c9('0x31')][_0xa1c9('0x32')],function(_0x39cf81){return{'name':_0x39cf81[_0xa1c9('0x33')],'type':_0x39cf81[_0xa1c9('0x34')]['key']};});_0x53f325[_0xa1c9('0x35')]=_['map'](_0x259ac3,_0xa1c9('0x36'));_0x53f325['query']=_[_0xa1c9('0x37')](_0xf419d0[_0xa1c9('0x38')]);_0x53f325[_0xa1c9('0x39')]=_['intersection'](_0x53f325[_0xa1c9('0x35')],_0x53f325[_0xa1c9('0x38')]);_0x5b67c3[_0xa1c9('0x3a')]=_[_0xa1c9('0x3b')](_0x53f325['model'],qs['fields'](_0xf419d0[_0xa1c9('0x38')][_0xa1c9('0x3c')]));_0x5b67c3[_0xa1c9('0x3a')]=_0x5b67c3[_0xa1c9('0x3a')][_0xa1c9('0x3d')]?_0x5b67c3[_0xa1c9('0x3a')]:_0x53f325[_0xa1c9('0x35')];if(!_0xf419d0[_0xa1c9('0x38')][_0xa1c9('0x3e')](_0xa1c9('0x3f'))){_0x5b67c3['limit']=qs[_0xa1c9('0x21')](_0xf419d0[_0xa1c9('0x38')][_0xa1c9('0x21')]);_0x5b67c3[_0xa1c9('0x20')]=qs[_0xa1c9('0x20')](_0xf419d0[_0xa1c9('0x38')]['offset']);}_0x5b67c3[_0xa1c9('0x40')]=qs[_0xa1c9('0x41')](_0xf419d0[_0xa1c9('0x38')]['sort']);_0x5b67c3[_0xa1c9('0x42')]=qs[_0xa1c9('0x39')](_['pick'](_0xf419d0[_0xa1c9('0x38')],_0x53f325[_0xa1c9('0x39')]),_0x259ac3);if(_0xf419d0['query']['filter']){_0x5b67c3[_0xa1c9('0x42')]=_[_0xa1c9('0x43')](_0x5b67c3[_0xa1c9('0x42')],{'$or':_[_0xa1c9('0x30')](_0x259ac3,function(_0xd9e67){if(_0xd9e67[_0xa1c9('0x34')]!==_0xa1c9('0x44')){var _0x146e47={};_0x146e47[_0xd9e67[_0xa1c9('0x36')]]={'$like':'%'+_0xf419d0[_0xa1c9('0x38')]['filter']+'%'};return _0x146e47;}})});}_0x5b67c3=_['merge']({},_0x5b67c3,_0xf419d0[_0xa1c9('0x45')]);var _0x46920c={'where':_0x5b67c3['where']};return db[_0xa1c9('0x31')][_0xa1c9('0x46')](_0x46920c)[_0xa1c9('0x28')](function(_0x36c846){_0x5aecd7[_0xa1c9('0x46')]=_0x36c846;if(_0xf419d0[_0xa1c9('0x38')][_0xa1c9('0x47')]){_0x5b67c3[_0xa1c9('0x48')]=[{'all':!![]}];}return db[_0xa1c9('0x31')][_0xa1c9('0x49')](_0x5b67c3);})[_0xa1c9('0x28')](function(_0x50cc27){_0x5aecd7[_0xa1c9('0x4a')]=_0x50cc27;return _0x5aecd7;})['then'](respondWithFilteredResult(_0x3161b0,_0x5b67c3))[_0xa1c9('0x4b')](handleError(_0x3161b0,null));};exports['show']=function(_0x42be67,_0x4a9e02){var _0x43598b={'raw':![],'where':{'id':_0x42be67['params']['id']}},_0x18bb43={};_0x18bb43[_0xa1c9('0x35')]=_[_0xa1c9('0x37')](db['VoicePrefix'][_0xa1c9('0x32')]);_0x18bb43[_0xa1c9('0x38')]=_[_0xa1c9('0x37')](_0x42be67[_0xa1c9('0x38')]);_0x18bb43[_0xa1c9('0x39')]=_[_0xa1c9('0x3b')](_0x18bb43['model'],_0x18bb43[_0xa1c9('0x38')]);_0x43598b[_0xa1c9('0x3a')]=_[_0xa1c9('0x3b')](_0x18bb43[_0xa1c9('0x35')],qs[_0xa1c9('0x3c')](_0x42be67['query']['fields']));_0x43598b['attributes']=_0x43598b[_0xa1c9('0x3a')][_0xa1c9('0x3d')]?_0x43598b[_0xa1c9('0x3a')]:_0x18bb43['model'];if(_0x42be67[_0xa1c9('0x38')][_0xa1c9('0x47')]){_0x43598b['include']=[{'all':!![]}];}_0x43598b=_[_0xa1c9('0x43')]({},_0x43598b,_0x42be67['options']);return db['VoicePrefix'][_0xa1c9('0x4c')](_0x43598b)[_0xa1c9('0x28')](handleEntityNotFound(_0x4a9e02,null))[_0xa1c9('0x28')](respondWithResult(_0x4a9e02,null))[_0xa1c9('0x4b')](handleError(_0x4a9e02,null));};exports[_0xa1c9('0x29')]=function(_0x31fbb8,_0x18aa46){return db[_0xa1c9('0x31')][_0xa1c9('0x4c')]({'where':{'id':_0x31fbb8[_0xa1c9('0x4d')]['id']}})[_0xa1c9('0x28')](handleEntityNotFound(_0x18aa46,null))[_0xa1c9('0x28')](removeEntity(_0x18aa46,null))[_0xa1c9('0x4b')](handleError(_0x18aa46,null));};exports[_0xa1c9('0x4e')]=function(_0x149450,_0x112f82){return db[_0xa1c9('0x31')][_0xa1c9('0x4e')]()[_0xa1c9('0x28')](respondWithResult(_0x112f82,null))['catch'](handleError(_0x112f82,null));};exports['create']=function(_0x12118e,_0x6160fc){var _0x66a5eb;return db[_0xa1c9('0x4f')]['transaction'](function(_0x449e85){return db[_0xa1c9('0x31')][_0xa1c9('0x50')](_0x12118e['body'],{'transaction':_0x449e85})[_0xa1c9('0x28')](function(_0x3f650a){_0x66a5eb=_0x3f650a['get']({'plain':!![]});return db['VoiceExtension'][_0xa1c9('0x4c')]({'where':{'id':_0x66a5eb['VoiceExtensionId']},'raw':!![]})[_0xa1c9('0x28')](function(_0x1bd5c7){return createVoicePrefixExtensions(_0x66a5eb,_0x1bd5c7,_0x449e85);});});})[_0xa1c9('0x28')](function(){var _0x4c1165=_0x12118e['user'][_0xa1c9('0x51')]({'plain':!![]});if(!_0x4c1165)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c1165[_0xa1c9('0x52')]==='user'){var _0x3334ad=_0x66a5eb;return db[_0xa1c9('0x53')][_0xa1c9('0x4c')]({'where':{'name':_0xa1c9('0x2a'),'userProfileId':_0x4c1165[_0xa1c9('0x54')]},'raw':!![]})[_0xa1c9('0x28')](function(_0x3917ed){if(_0x3917ed&&_0x3917ed['autoAssociation']===0x0){return db[_0xa1c9('0x2b')][_0xa1c9('0x50')]({'name':_0x3334ad['name'],'resourceId':_0x3334ad['id'],'type':_0x3917ed['name'],'sectionId':_0x3917ed['id']},{})['then'](function(){return _0x66a5eb;});}else{return _0x66a5eb;}})[_0xa1c9('0x4b')](function(_0x55fe87){logger[_0xa1c9('0x2c')](_0xa1c9('0x55'),_0x55fe87);throw _0x55fe87;});}return _0x66a5eb;})[_0xa1c9('0x28')](respondWithResult(_0x6160fc,null))[_0xa1c9('0x4b')](handleError(_0x6160fc,null));};function Extension(_0x2f0c80,_0x5b81f4,_0x4bf711,_0x48950c){this['context']=_0xa1c9('0x56');this[_0xa1c9('0x57')]=_0x2f0c80;this[_0xa1c9('0x58')]=_0x4bf711;this[_0xa1c9('0x34')]=_0xa1c9('0x59');this[_0xa1c9('0x5a')]=_0xa1c9('0x5b');this[_0xa1c9('0x5c')]=_0x5b81f4;this[_0xa1c9('0x5d')]=_0x48950c;}function createVoicePrefixExtensions(_0x317799,_0x4639cf,_0xef5d24){return new BPromise(function(_0x288267,_0x29d833){var _0x51f675=new Extension(formatPrefixName(_0x317799[_0xa1c9('0x5e')]),0x1,_0xa1c9('0x5f'),_0xa1c9('0x60'));_0x51f675[_0xa1c9('0x61')]=_0x317799['id'];return db['VoiceExtension'][_0xa1c9('0x50')](_0x51f675,{'transaction':_0xef5d24})[_0xa1c9('0x28')](function(_0x1b2cff){var _0x39ffed=_0x1b2cff['get']({'plain':!![]});var _0x4b9aa8=_[_0xa1c9('0x30')](addVoicePrefixExtensions(_0x317799,_0x4639cf),function(_0x2a89d2){_0x2a89d2[_0xa1c9('0x62')]=_0x39ffed['id'];_0x2a89d2[_0xa1c9('0x61')]=_0x317799['id'];return _0x2a89d2;});return db[_0xa1c9('0x63')]['bulkCreate'](_0x4b9aa8,{'transaction':_0xef5d24})[_0xa1c9('0x28')](function(_0x21abdf){if(!_0x21abdf){return _0x29d833(_0xa1c9('0x64'));}else{return _0x288267(_0x21abdf);}})[_0xa1c9('0x4b')](function(_0x5ba7aa){return _0x29d833(_0x5ba7aa);});});;});};function addVoicePrefixExtensions(_0x37613f,_0x17d848){var _0xa18fa4=[];var _0x5a5c65=formatPrefixName(_0x37613f[_0xa1c9('0x5e')]);_0xa18fa4[_0xa1c9('0x65')](new Extension(_0x5a5c65,0x2,'Set',_0xa1c9('0x66')+_0x37613f[_0xa1c9('0x36')]));if(_0x37613f[_0xa1c9('0x67')]){_0xa18fa4[_0xa1c9('0x65')](new Extension(_0x5a5c65,0x3,_0xa1c9('0x68'),_0xa1c9('0x69')+_0x37613f[_0xa1c9('0x67')]));}else{_0xa18fa4[_0xa1c9('0x65')](new Extension(_0x5a5c65,0x3,_0xa1c9('0x5f'),_0xa1c9('0x6a')));}_0xa18fa4[_0xa1c9('0x65')](new Extension(_0x5a5c65,0x4,'goto',_0x17d848[_0xa1c9('0x6b')]+','+_0xa1c9('0x6c')+(0x8+_0x37613f[_0xa1c9('0x36')][_0xa1c9('0x3d')])+'}'+','+0x1));return _0xa18fa4;}function formatPrefixName(_0x5961aa){var _0x358481='_';for(var _0xdbc56a=0x0;_0xdbc56a<_0x5961aa[_0xa1c9('0x3d')];_0xdbc56a++){if(_0x5961aa[_0xa1c9('0x6d')](_0xdbc56a)=='-'){_0x358481+=_0x5961aa[_0xa1c9('0x6d')](_0xdbc56a);}else{_0x358481+='['+_0x5961aa[_0xa1c9('0x6d')](_0xdbc56a)+']';}}_0x358481+='.';return _0x358481;}exports[_0xa1c9('0x27')]=function(_0x27048c,_0xb24e0b,_0x178e47){var _0x1fec82=_0x27048c[_0xa1c9('0x6e')];_0x1fec82[_0xa1c9('0x5e')]=_0xa1c9('0x6f')+_0x1fec82['name']+'-';return db[_0xa1c9('0x4f')][_0xa1c9('0x70')](function(_0x1f219d){return db[_0xa1c9('0x31')][_0xa1c9('0x27')](_0x1fec82,{'where':{'id':_0x1fec82['id']},'transaction':_0x1f219d})[_0xa1c9('0x28')](function(){return db[_0xa1c9('0x63')]['destroy']({'where':{'VoicePrefixId':_0x1fec82['id']},'transaction':_0x1f219d})[_0xa1c9('0x28')](function(){return db[_0xa1c9('0x63')]['find']({'where':{'id':_0x1fec82[_0xa1c9('0x62')]},'raw':!![]})[_0xa1c9('0x28')](function(_0x150d76){return createVoicePrefixExtensions(_0x1fec82,_0x150d76,_0x1f219d);});});});})[_0xa1c9('0x28')](function(){return db['VoicePrefix'][_0xa1c9('0x71')](_0x1fec82['id']);})['then'](respondWithResult(_0xb24e0b,null))['catch'](handleError(_0xb24e0b,null));};exports[_0xa1c9('0x72')]=function(_0x134d3f,_0x40f420,_0x423c58){return db['VoicePrefix'][_0xa1c9('0x4c')]({'where':{'id':_0x134d3f[_0xa1c9('0x4d')]['id']}})['then'](handleEntityNotFound(_0x40f420,null))[_0xa1c9('0x28')](function(_0x464da9){if(_0x464da9){return _0x464da9[_0xa1c9('0x72')](_0x134d3f[_0xa1c9('0x6e')][_0xa1c9('0x73')],_[_0xa1c9('0x74')](_0x134d3f['body'],['ids','id'])||{})[_0xa1c9('0x75')](function(_0x52e78b){for(var _0x3de2c7=0x0;_0x3de2c7<_0x134d3f[_0xa1c9('0x6e')][_0xa1c9('0x73')][_0xa1c9('0x3d')];_0x3de2c7+=0x1){socket[_0xa1c9('0x76')](_0xa1c9('0x77'),{'UserId':Number(_0x134d3f[_0xa1c9('0x6e')][_0xa1c9('0x73')][_0x3de2c7]),'VoicePrefixId':Number(_0x134d3f[_0xa1c9('0x4d')]['id'])});}return _0x52e78b;});}})['then'](respondWithResult(_0x40f420,null))[_0xa1c9('0x4b')](handleError(_0x40f420,null));};exports['removeAgents']=function(_0x4a8841,_0x8bc83d,_0x518811){return db[_0xa1c9('0x31')][_0xa1c9('0x4c')]({'where':{'id':_0x4a8841[_0xa1c9('0x4d')]['id']}})[_0xa1c9('0x28')](handleEntityNotFound(_0x8bc83d,null))[_0xa1c9('0x28')](function(_0x2a17b7){if(_0x2a17b7){return _0x2a17b7[_0xa1c9('0x78')](_0x4a8841['query'][_0xa1c9('0x73')])[_0xa1c9('0x28')](function(){if(_[_0xa1c9('0x79')](_0x4a8841['query']['ids'])){for(var _0x3f4f76=0x0;_0x3f4f76<_0x4a8841['query'][_0xa1c9('0x73')][_0xa1c9('0x3d')];_0x3f4f76+=0x1){socket[_0xa1c9('0x76')](_0xa1c9('0x7a'),{'UserId':Number(_0x4a8841['query'][_0xa1c9('0x73')][_0x3f4f76]),'VoicePrefixId':Number(_0x4a8841[_0xa1c9('0x4d')]['id'])});}}else{socket[_0xa1c9('0x76')](_0xa1c9('0x7a'),{'UserId':Number(_0x4a8841[_0xa1c9('0x38')]['ids']),'VoicePrefixId':Number(_0x4a8841[_0xa1c9('0x4d')]['id'])});}});}})[_0xa1c9('0x28')](respondWithStatusCode(_0x8bc83d,null))[_0xa1c9('0x4b')](handleError(_0x8bc83d,null));};exports['getAgents']=function(_0x3936cb,_0x175662,_0x134935){var _0x197721={};var _0x7281bd={};var _0x35a356;var _0x53ea3b;return db[_0xa1c9('0x31')]['findOne']({'where':{'id':_0x3936cb[_0xa1c9('0x4d')]['id']}})[_0xa1c9('0x28')](handleEntityNotFound(_0x175662,null))['then'](function(_0x28d323){if(_0x28d323){_0x35a356=_0x28d323;_0x7281bd['model']=_[_0xa1c9('0x37')](db[_0xa1c9('0x7b')][_0xa1c9('0x32')]);_0x7281bd[_0xa1c9('0x38')]=_[_0xa1c9('0x37')](_0x3936cb[_0xa1c9('0x38')]);_0x7281bd[_0xa1c9('0x39')]=_[_0xa1c9('0x3b')](_0x7281bd[_0xa1c9('0x35')],_0x7281bd[_0xa1c9('0x38')]);_0x197721[_0xa1c9('0x3a')]=_[_0xa1c9('0x3b')](_0x7281bd[_0xa1c9('0x35')],qs[_0xa1c9('0x3c')](_0x3936cb[_0xa1c9('0x38')][_0xa1c9('0x3c')]));_0x197721['attributes']=_0x197721['attributes'][_0xa1c9('0x3d')]?_0x197721[_0xa1c9('0x3a')]:_0x7281bd[_0xa1c9('0x35')];_0x197721['order']=qs[_0xa1c9('0x41')](_0x3936cb['query']['sort']);_0x197721[_0xa1c9('0x42')]=qs[_0xa1c9('0x39')](_['pick'](_0x3936cb[_0xa1c9('0x38')],_0x7281bd['filters']));if(_0x3936cb['query'][_0xa1c9('0x7c')]){_0x197721['where']=_[_0xa1c9('0x43')](_0x197721[_0xa1c9('0x42')],{'$or':_['map'](_0x197721[_0xa1c9('0x3a')],function(_0x1277eb){var _0x88cb2c={};_0x88cb2c[_0x1277eb]={'$like':'%'+_0x3936cb[_0xa1c9('0x38')]['filter']+'%'};return _0x88cb2c;})});}_0x197721=_[_0xa1c9('0x43')]({},_0x197721,_0x3936cb[_0xa1c9('0x45')]);return _0x35a356[_0xa1c9('0x7d')](_0x197721);}})[_0xa1c9('0x28')](function(_0x465162){if(_0x465162){_0x53ea3b=_0x465162[_0xa1c9('0x3d')];if(!_0x3936cb['query'][_0xa1c9('0x3e')](_0xa1c9('0x3f'))){_0x197721['limit']=qs['limit'](_0x3936cb[_0xa1c9('0x38')][_0xa1c9('0x21')]);_0x197721[_0xa1c9('0x20')]=qs[_0xa1c9('0x20')](_0x3936cb[_0xa1c9('0x38')][_0xa1c9('0x20')]);}return _0x35a356['getAgents'](_0x197721);}})[_0xa1c9('0x28')](function(_0x4deadc){if(_0x4deadc){return _0x4deadc?{'count':_0x53ea3b,'rows':_0x4deadc}:null;}})[_0xa1c9('0x28')](respondWithResult(_0x175662,null))[_0xa1c9('0x4b')](handleError(_0x175662,null));};exports[_0xa1c9('0x7e')]=function(_0x59bc9f,_0x1c8a80,_0x2780b7){var _0x26f241={};var _0x537f48={};var _0x4e1e2f;var _0x46d8d1;return db['VoicePrefix'][_0xa1c9('0x7f')]({'where':{'id':_0x59bc9f['params']['id']}})[_0xa1c9('0x28')](handleEntityNotFound(_0x1c8a80,null))[_0xa1c9('0x28')](function(_0x2d2374){if(_0x2d2374){_0x4e1e2f=_0x2d2374;_0x537f48['model']=_['keys'](db['Team'][_0xa1c9('0x32')]);_0x537f48[_0xa1c9('0x38')]=_[_0xa1c9('0x37')](_0x59bc9f[_0xa1c9('0x38')]);_0x537f48['filters']=_['intersection'](_0x537f48[_0xa1c9('0x35')],_0x537f48['query']);_0x26f241[_0xa1c9('0x3a')]=_[_0xa1c9('0x3b')](_0x537f48[_0xa1c9('0x35')],qs['fields'](_0x59bc9f[_0xa1c9('0x38')][_0xa1c9('0x3c')]));_0x26f241[_0xa1c9('0x3a')]=_0x26f241[_0xa1c9('0x3a')][_0xa1c9('0x3d')]?_0x26f241[_0xa1c9('0x3a')]:_0x537f48[_0xa1c9('0x35')];_0x26f241[_0xa1c9('0x40')]=qs[_0xa1c9('0x41')](_0x59bc9f[_0xa1c9('0x38')]['sort']);_0x26f241[_0xa1c9('0x42')]=qs[_0xa1c9('0x39')](_['pick'](_0x59bc9f[_0xa1c9('0x38')],_0x537f48[_0xa1c9('0x39')]));if(_0x59bc9f[_0xa1c9('0x38')][_0xa1c9('0x7c')]){_0x26f241[_0xa1c9('0x42')]=_['merge'](_0x26f241[_0xa1c9('0x42')],{'$or':_['map'](_0x26f241[_0xa1c9('0x3a')],function(_0x2c04c5){var _0x137a58={};_0x137a58[_0x2c04c5]={'$like':'%'+_0x59bc9f['query'][_0xa1c9('0x7c')]+'%'};return _0x137a58;})});}_0x26f241=_[_0xa1c9('0x43')]({},_0x26f241,_0x59bc9f[_0xa1c9('0x45')]);return _0x4e1e2f[_0xa1c9('0x7e')](_0x26f241);}})[_0xa1c9('0x28')](function(_0x328fa7){if(_0x328fa7){_0x46d8d1=_0x328fa7[_0xa1c9('0x3d')];if(!_0x59bc9f['query'][_0xa1c9('0x3e')](_0xa1c9('0x3f'))){_0x26f241[_0xa1c9('0x21')]=qs['limit'](_0x59bc9f[_0xa1c9('0x38')][_0xa1c9('0x21')]);_0x26f241['offset']=qs[_0xa1c9('0x20')](_0x59bc9f['query'][_0xa1c9('0x20')]);}return _0x4e1e2f[_0xa1c9('0x7e')](_0x26f241);}})[_0xa1c9('0x28')](function(_0x3e5016){if(_0x3e5016){return _0x3e5016?{'count':_0x46d8d1,'rows':_0x3e5016}:null;}})[_0xa1c9('0x28')](respondWithResult(_0x1c8a80,null))['catch'](handleError(_0x1c8a80,null));};exports[_0xa1c9('0x80')]=function(_0xabacf1,_0x38a7fc,_0x2a3082){var _0x276c98=_0xabacf1[_0xa1c9('0x6e')][_0xa1c9('0x73')];var _0x48520d;return db[_0xa1c9('0x81')][_0xa1c9('0x49')]({'where':{'id':_0x276c98},'attributes':['id'],'include':[{'model':db[_0xa1c9('0x7b')],'as':_0xa1c9('0x82'),'attributes':['id','name',_0xa1c9('0x83'),_0xa1c9('0x84'),'interface'],'raw':!![]}]})[_0xa1c9('0x28')](function(_0x2a82fd){if(_0x2a82fd){_0x48520d=_0x2a82fd;var _0x419cf2=_[_0xa1c9('0x85')](_0x2a82fd,function(_0x51884d){var _0x52360b=_0x51884d[_0xa1c9('0x51')]({'plain':!![]});return _0x52360b['Agents'];});return db[_0xa1c9('0x31')]['find']({'where':{'id':_0xabacf1['params']['id']}})[_0xa1c9('0x28')](function(_0x507b2a){return db[_0xa1c9('0x4f')][_0xa1c9('0x70')](function(_0x296607){return _0x507b2a[_0xa1c9('0x80')](_0x276c98,{'transaction':_0x296607})[_0xa1c9('0x28')](function(){return BPromise[_0xa1c9('0x86')](_0x48520d,function(_0x531c20){return db[_0xa1c9('0x87')]['upsert']({'TeamId':_0x531c20['id'],'VoicePrefixId':_0xabacf1[_0xa1c9('0x4d')]['id']},{'transaction':_0x296607});});})[_0xa1c9('0x28')](function(){return BPromise['each'](_0x419cf2,function(_0x110617){return db[_0xa1c9('0x88')][_0xa1c9('0x89')]({'where':{'UserId':_0x110617['id'],'VoicePrefixId':_0xabacf1[_0xa1c9('0x4d')]['id']},'transaction':_0x296607});});})[_0xa1c9('0x28')](function(){_0x419cf2[_0xa1c9('0x8a')](function(_0x5640bb){socket[_0xa1c9('0x76')](_0xa1c9('0x77'),{'UserId':_0x5640bb['id'],'VoicePrefixId':_0x507b2a['id']});});});});});}})[_0xa1c9('0x28')](respondWithStatusCode(_0x38a7fc,null))['catch'](handleError(_0x38a7fc,null));};exports[_0xa1c9('0x8b')]=function(_0x4c8c5e,_0x3cb7d4,_0x5c504c){return db['Team'][_0xa1c9('0x49')]({'where':{'id':_0x4c8c5e['query'][_0xa1c9('0x73')]},'attributes':['id'],'include':[{'model':db[_0xa1c9('0x7b')],'as':_0xa1c9('0x82'),'attributes':['id'],'raw':!![]}]})[_0xa1c9('0x28')](handleEntityNotFound(_0x3cb7d4,null))['then'](function(_0x4423e8){var _0x2c75e6=_['map'](_0x4423e8,'id');var _0x163589=[];var _0x5f3e31=[];var _0x6e0efe=squel[_0xa1c9('0x8c')]();_0x6e0efe[_0xa1c9('0x8d')](_0xa1c9('0x8e'))[_0xa1c9('0x8f')](_0xa1c9('0x90'),'tq')[_0xa1c9('0x91')](_0xa1c9('0x92'),'ut',_0xa1c9('0x93'))[_0xa1c9('0x42')](_0xa1c9('0x94'),_0x4c8c5e[_0xa1c9('0x4d')]['id']);for(var _0x2953bd=0x0;_0x2953bd<_0x4423e8['length'];_0x2953bd+=0x1){let _0x28050b=_0x4423e8[_0x2953bd];for(var _0x3f998a=0x0;_0x3f998a<_0x28050b['Agents'][_0xa1c9('0x3d')];_0x3f998a+=0x1){let _0x12cdd5=_0x28050b[_0xa1c9('0x82')][_0x3f998a];var _0x1c5baa=_0x6e0efe[_0xa1c9('0x95')]();_0x1c5baa[_0xa1c9('0x42')](_0xa1c9('0x96'),_0x12cdd5['id']);_0x5f3e31[_0xa1c9('0x65')](db['sequelize']['query'](_0x1c5baa[_0xa1c9('0x97')](),{'type':db[_0xa1c9('0x4f')]['QueryTypes']['SELECT']})['then'](function(_0x5c9f06){if(_0x5c9f06['length']===0x1){return _0x12cdd5['id'];}else{var _0x4d6b40=_[_0xa1c9('0x98')](_[_0xa1c9('0x30')](_0x5c9f06,_0xa1c9('0x99')),function(_0x20c454){return _[_0xa1c9('0x9a')](_0x2c75e6,_0x20c454);});if(_0x4d6b40){return _0x12cdd5['id'];}}}));}}return BPromise[_0xa1c9('0x9b')](_0x5f3e31)['then'](function(_0x22fde9){_0x163589=_(_0x163589)[_0xa1c9('0x9c')](_0x22fde9)[_0xa1c9('0x9d')]()['value']();return db[_0xa1c9('0x31')]['find']({'where':{'id':_0x4c8c5e['params']['id']}})[_0xa1c9('0x28')](function(_0x3e67f4){return db[_0xa1c9('0x4f')][_0xa1c9('0x70')](function(_0x52905a){return _0x3e67f4[_0xa1c9('0x8b')](_0x4c8c5e[_0xa1c9('0x38')][_0xa1c9('0x73')],{'transaction':_0x52905a})[_0xa1c9('0x28')](function(){if(!_[_0xa1c9('0x9e')](_0x163589)){return _0x3e67f4['removeAgents'](_0x163589,{'transaction':_0x52905a});}})[_0xa1c9('0x28')](function(){_0x163589['forEach'](function(_0x424be7){socket[_0xa1c9('0x76')]('userVoicePrefix:remove',{'UserId':_0x424be7,'VoicePrefixId':_0x3e67f4['id']});});});});});});})[_0xa1c9('0x28')](respondWithStatusCode(_0x3cb7d4,null))[_0xa1c9('0x4b')](handleError(_0x3cb7d4,null));}; \ No newline at end of file +var _0x02ce=['apply','reject','save','update','destroy','then','get','VoicePrefixes','UserProfileResource','sendStatus','error','name','send','index','map','VoicePrefix','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','show','params','length','find','catch','sequelize','body','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','create','context','from-sip','exten','app','type','description','Voice\x20Prefix\x20Extension','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','callerIdAll','Set','PREFIX-CALLERIDALL=','${EXTEN:','charAt','system-','transaction','VoiceExtension','findById','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','getAgents','User','pick','findOne','Team','getTeams','addTeams','online','voicePause','flatMap','Agents','each','TeamVoicePrefix','upsert','forEach','removeTeams','select','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','includes','union','compact','value','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voicePrefix.socket','status','end','json','undefined','limit','count','offset','set'];(function(_0x1b6ecd,_0x15ab30){var _0x50f535=function(_0x48f047){while(--_0x48f047){_0x1b6ecd['push'](_0x1b6ecd['shift']());}};_0x50f535(++_0x15ab30);}(_0x02ce,0x1ac));var _0xe02c=function(_0x56f437,_0x5690cd){_0x56f437=_0x56f437-0x0;var _0x3377b=_0x02ce[_0x56f437];return _0x3377b;};'use strict';var emlformat=require(_0xe02c('0x0'));var rimraf=require(_0xe02c('0x1'));var zipdir=require(_0xe02c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe02c('0x3'));var moment=require('moment');var BPromise=require(_0xe02c('0x4'));var Mustache=require(_0xe02c('0x5'));var util=require(_0xe02c('0x6'));var path=require(_0xe02c('0x7'));var sox=require(_0xe02c('0x8'));var csv=require(_0xe02c('0x9'));var ejs=require(_0xe02c('0xa'));var fs=require('fs');var fs_extra=require(_0xe02c('0xb'));var _=require(_0xe02c('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe02c('0xd'));var deskjs=require(_0xe02c('0xe'));var toCsv=require(_0xe02c('0x9'));var querystring=require(_0xe02c('0xf'));var Papa=require(_0xe02c('0x10'));var Redis=require(_0xe02c('0x11'));var authService=require(_0xe02c('0x12'));var qs=require(_0xe02c('0x13'));var as=require(_0xe02c('0x14'));var hardwareService=require(_0xe02c('0x15'));var logger=require(_0xe02c('0x16'))(_0xe02c('0x17'));var utils=require(_0xe02c('0x18'));var config=require(_0xe02c('0x19'));var licenseUtil=require(_0xe02c('0x1a'));var db=require(_0xe02c('0x1b'))['db'];config[_0xe02c('0x1c')]=_[_0xe02c('0x1d')](config['redis'],{'host':_0xe02c('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe02c('0x1f'))['register'](socket);function respondWithStatusCode(_0x221910,_0x59614c){_0x59614c=_0x59614c||0xcc;return function(_0x3a5a2c){if(_0x3a5a2c){return _0x221910['sendStatus'](_0x59614c);}return _0x221910[_0xe02c('0x20')](_0x59614c)[_0xe02c('0x21')]();};}function respondWithResult(_0x59f2f6,_0x10a2a6){_0x10a2a6=_0x10a2a6||0xc8;return function(_0x226a80){if(_0x226a80){return _0x59f2f6['status'](_0x10a2a6)[_0xe02c('0x22')](_0x226a80);}};}function respondWithFilteredResult(_0x20f492,_0x5a4583){return function(_0x52917f){if(_0x52917f){var _0x3e37bf=typeof _0x5a4583['offset']===_0xe02c('0x23')&&typeof _0x5a4583[_0xe02c('0x24')]===_0xe02c('0x23');var _0x36fed0=_0x52917f[_0xe02c('0x25')];var _0x54c5b0=_0x3e37bf?0x0:_0x5a4583[_0xe02c('0x26')];var _0x59026f=_0x3e37bf?_0x52917f['count']:_0x5a4583[_0xe02c('0x26')]+_0x5a4583[_0xe02c('0x24')];var _0x480b9a;if(_0x59026f>=_0x36fed0){_0x59026f=_0x36fed0;_0x480b9a=0xc8;}else{_0x480b9a=0xce;}_0x20f492[_0xe02c('0x20')](_0x480b9a);return _0x20f492[_0xe02c('0x27')]('Content-Range',_0x54c5b0+'-'+_0x59026f+'/'+_0x36fed0)[_0xe02c('0x22')](_0x52917f);}return null;};}function patchUpdates(_0x45fd82){return function(_0x39b00c){try{jsonpatch[_0xe02c('0x28')](_0x39b00c,_0x45fd82,!![]);}catch(_0x2d44c8){return BPromise[_0xe02c('0x29')](_0x2d44c8);}return _0x39b00c[_0xe02c('0x2a')]();};}function saveUpdates(_0xf41d4c,_0xeae877){return function(_0x18b538){if(_0x18b538){return _0x18b538[_0xe02c('0x2b')](_0xf41d4c)['then'](function(_0xefd882){return _0xefd882;});}return null;};}function removeEntity(_0x4411d8,_0x3592ca){return function(_0x14ffba){if(_0x14ffba){return _0x14ffba[_0xe02c('0x2c')]()[_0xe02c('0x2d')](function(){var _0x43dc78=_0x14ffba[_0xe02c('0x2e')]({'plain':!![]});var _0x55ef2a=_0xe02c('0x2f');return db[_0xe02c('0x30')][_0xe02c('0x2c')]({'where':{'type':_0x55ef2a,'resourceId':_0x43dc78['id']}})['then'](function(){return _0x14ffba;});})[_0xe02c('0x2d')](function(){_0x4411d8[_0xe02c('0x20')](0xcc)[_0xe02c('0x21')]();});}};}function handleEntityNotFound(_0x287f7e,_0x1e7eab){return function(_0x35a309){if(!_0x35a309){_0x287f7e[_0xe02c('0x31')](0x194);}return _0x35a309;};}function handleError(_0x1b8f21,_0x9ee479){_0x9ee479=_0x9ee479||0x1f4;return function(_0x288004){logger[_0xe02c('0x32')](_0x288004['stack']);if(_0x288004[_0xe02c('0x33')]){delete _0x288004[_0xe02c('0x33')];}_0x1b8f21[_0xe02c('0x20')](_0x9ee479)[_0xe02c('0x34')](_0x288004);};}exports[_0xe02c('0x35')]=function(_0x14d27a,_0x58bf16){var _0x436bcc={},_0x1e605c={},_0x4fc4fd={'count':0x0,'rows':[]};var _0x1ce34c=_[_0xe02c('0x36')](db[_0xe02c('0x37')][_0xe02c('0x38')],function(_0x2b5ebe){return{'name':_0x2b5ebe['fieldName'],'type':_0x2b5ebe['type'][_0xe02c('0x39')]};});_0x1e605c[_0xe02c('0x3a')]=_['map'](_0x1ce34c,_0xe02c('0x33'));_0x1e605c['query']=_[_0xe02c('0x3b')](_0x14d27a[_0xe02c('0x3c')]);_0x1e605c[_0xe02c('0x3d')]=_[_0xe02c('0x3e')](_0x1e605c[_0xe02c('0x3a')],_0x1e605c['query']);_0x436bcc[_0xe02c('0x3f')]=_['intersection'](_0x1e605c[_0xe02c('0x3a')],qs[_0xe02c('0x40')](_0x14d27a[_0xe02c('0x3c')][_0xe02c('0x40')]));_0x436bcc[_0xe02c('0x3f')]=_0x436bcc[_0xe02c('0x3f')]['length']?_0x436bcc[_0xe02c('0x3f')]:_0x1e605c[_0xe02c('0x3a')];if(!_0x14d27a['query'][_0xe02c('0x41')](_0xe02c('0x42'))){_0x436bcc['limit']=qs[_0xe02c('0x24')](_0x14d27a['query'][_0xe02c('0x24')]);_0x436bcc[_0xe02c('0x26')]=qs['offset'](_0x14d27a[_0xe02c('0x3c')][_0xe02c('0x26')]);}_0x436bcc[_0xe02c('0x43')]=qs[_0xe02c('0x44')](_0x14d27a[_0xe02c('0x3c')][_0xe02c('0x44')]);_0x436bcc['where']=qs[_0xe02c('0x3d')](_['pick'](_0x14d27a['query'],_0x1e605c[_0xe02c('0x3d')]),_0x1ce34c);if(_0x14d27a[_0xe02c('0x3c')][_0xe02c('0x45')]){_0x436bcc[_0xe02c('0x46')]=_['merge'](_0x436bcc[_0xe02c('0x46')],{'$or':_[_0xe02c('0x36')](_0x1ce34c,function(_0x163573){if(_0x163573['type']!=='VIRTUAL'){var _0x33c6da={};_0x33c6da[_0x163573[_0xe02c('0x33')]]={'$like':'%'+_0x14d27a[_0xe02c('0x3c')][_0xe02c('0x45')]+'%'};return _0x33c6da;}})});}_0x436bcc=_[_0xe02c('0x47')]({},_0x436bcc,_0x14d27a[_0xe02c('0x48')]);var _0x25f8ae={'where':_0x436bcc[_0xe02c('0x46')]};return db[_0xe02c('0x37')]['count'](_0x25f8ae)[_0xe02c('0x2d')](function(_0x5ef4a1){_0x4fc4fd['count']=_0x5ef4a1;if(_0x14d27a[_0xe02c('0x3c')][_0xe02c('0x49')]){_0x436bcc[_0xe02c('0x4a')]=[{'all':!![]}];}return db[_0xe02c('0x37')][_0xe02c('0x4b')](_0x436bcc);})[_0xe02c('0x2d')](function(_0x165f4a){_0x4fc4fd[_0xe02c('0x4c')]=_0x165f4a;return _0x4fc4fd;})['then'](respondWithFilteredResult(_0x58bf16,_0x436bcc))['catch'](handleError(_0x58bf16,null));};exports[_0xe02c('0x4d')]=function(_0xf89a57,_0x304ece){var _0x52f239={'raw':![],'where':{'id':_0xf89a57[_0xe02c('0x4e')]['id']}},_0x1cf443={};_0x1cf443[_0xe02c('0x3a')]=_[_0xe02c('0x3b')](db[_0xe02c('0x37')][_0xe02c('0x38')]);_0x1cf443[_0xe02c('0x3c')]=_[_0xe02c('0x3b')](_0xf89a57[_0xe02c('0x3c')]);_0x1cf443[_0xe02c('0x3d')]=_['intersection'](_0x1cf443[_0xe02c('0x3a')],_0x1cf443[_0xe02c('0x3c')]);_0x52f239[_0xe02c('0x3f')]=_[_0xe02c('0x3e')](_0x1cf443[_0xe02c('0x3a')],qs[_0xe02c('0x40')](_0xf89a57[_0xe02c('0x3c')][_0xe02c('0x40')]));_0x52f239[_0xe02c('0x3f')]=_0x52f239[_0xe02c('0x3f')][_0xe02c('0x4f')]?_0x52f239[_0xe02c('0x3f')]:_0x1cf443[_0xe02c('0x3a')];if(_0xf89a57['query'][_0xe02c('0x49')]){_0x52f239['include']=[{'all':!![]}];}_0x52f239=_[_0xe02c('0x47')]({},_0x52f239,_0xf89a57[_0xe02c('0x48')]);return db[_0xe02c('0x37')][_0xe02c('0x50')](_0x52f239)[_0xe02c('0x2d')](handleEntityNotFound(_0x304ece,null))[_0xe02c('0x2d')](respondWithResult(_0x304ece,null))[_0xe02c('0x51')](handleError(_0x304ece,null));};exports[_0xe02c('0x2c')]=function(_0xc6ea7b,_0x385497){return db['VoicePrefix'][_0xe02c('0x50')]({'where':{'id':_0xc6ea7b[_0xe02c('0x4e')]['id']}})[_0xe02c('0x2d')](handleEntityNotFound(_0x385497,null))['then'](removeEntity(_0x385497,null))[_0xe02c('0x51')](handleError(_0x385497,null));};exports['describe']=function(_0x21a126,_0x56b9e2){return db['VoicePrefix']['describe']()['then'](respondWithResult(_0x56b9e2,null))['catch'](handleError(_0x56b9e2,null));};exports['create']=function(_0x107f3f,_0x3ac0a5){var _0x1510aa;return db[_0xe02c('0x52')]['transaction'](function(_0x274beb){return db[_0xe02c('0x37')]['create'](_0x107f3f[_0xe02c('0x53')],{'transaction':_0x274beb})[_0xe02c('0x2d')](function(_0x221e5e){_0x1510aa=_0x221e5e['get']({'plain':!![]});return db['VoiceExtension'][_0xe02c('0x50')]({'where':{'id':_0x1510aa[_0xe02c('0x54')]},'raw':!![]})[_0xe02c('0x2d')](function(_0x5b2d2b){return createVoicePrefixExtensions(_0x1510aa,_0x5b2d2b,_0x274beb);});});})[_0xe02c('0x2d')](function(){var _0x53765c=_0x107f3f['user'][_0xe02c('0x2e')]({'plain':!![]});if(!_0x53765c)throw new Error(_0xe02c('0x55'));if(_0x53765c['role']===_0xe02c('0x56')){var _0x849eea=_0x1510aa;return db[_0xe02c('0x57')]['find']({'where':{'name':_0xe02c('0x2f'),'userProfileId':_0x53765c[_0xe02c('0x58')]},'raw':!![]})['then'](function(_0x3788e8){if(_0x3788e8&&_0x3788e8[_0xe02c('0x59')]===0x0){return db[_0xe02c('0x30')][_0xe02c('0x5a')]({'name':_0x849eea[_0xe02c('0x33')],'resourceId':_0x849eea['id'],'type':_0x3788e8[_0xe02c('0x33')],'sectionId':_0x3788e8['id']},{})[_0xe02c('0x2d')](function(){return _0x1510aa;});}else{return _0x1510aa;}})[_0xe02c('0x51')](function(_0xf7e836){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf7e836);throw _0xf7e836;});}return _0x1510aa;})['then'](respondWithResult(_0x3ac0a5,null))[_0xe02c('0x51')](handleError(_0x3ac0a5,null));};function Extension(_0x299770,_0x42f2fd,_0x496eb1,_0x4eb35d){this[_0xe02c('0x5b')]=_0xe02c('0x5c');this[_0xe02c('0x5d')]=_0x299770;this[_0xe02c('0x5e')]=_0x496eb1;this[_0xe02c('0x5f')]='system';this[_0xe02c('0x60')]=_0xe02c('0x61');this['priority']=_0x42f2fd;this['appdata']=_0x4eb35d;}function createVoicePrefixExtensions(_0x879d99,_0x566204,_0x4da197){return new BPromise(function(_0x480d49,_0x3b19c9){var _0x28d7a2=new Extension(formatPrefixName(_0x879d99[_0xe02c('0x62')]),0x1,_0xe02c('0x63'),_0xe02c('0x64'));_0x28d7a2[_0xe02c('0x65')]=_0x879d99['id'];return db['VoiceExtension'][_0xe02c('0x5a')](_0x28d7a2,{'transaction':_0x4da197})['then'](function(_0x4f3c9a){var _0x185dc2=_0x4f3c9a[_0xe02c('0x2e')]({'plain':!![]});var _0x44ba68=_[_0xe02c('0x36')](addVoicePrefixExtensions(_0x879d99,_0x566204),function(_0x5b6979){_0x5b6979[_0xe02c('0x54')]=_0x185dc2['id'];_0x5b6979[_0xe02c('0x65')]=_0x879d99['id'];return _0x5b6979;});return db['VoiceExtension'][_0xe02c('0x66')](_0x44ba68,{'transaction':_0x4da197})[_0xe02c('0x2d')](function(_0x4cc74d){if(!_0x4cc74d){return _0x3b19c9(_0xe02c('0x67'));}else{return _0x480d49(_0x4cc74d);}})[_0xe02c('0x51')](function(_0x44f28f){return _0x3b19c9(_0x44f28f);});});;});};function addVoicePrefixExtensions(_0x4053e6,_0x323f3b){var _0x3a62a2=[];var _0x31b281=formatPrefixName(_0x4053e6['prefix']);_0x3a62a2[_0xe02c('0x68')](new Extension(_0x31b281,0x2,'Set','CDR(prefix)='+_0x4053e6['name']));if(_0x4053e6[_0xe02c('0x69')]){_0x3a62a2[_0xe02c('0x68')](new Extension(_0x31b281,0x3,_0xe02c('0x6a'),_0xe02c('0x6b')+_0x4053e6['callerIdAll']));}else{_0x3a62a2[_0xe02c('0x68')](new Extension(_0x31b281,0x3,_0xe02c('0x63'),'No\x20callerid\x20available'));}_0x3a62a2['push'](new Extension(_0x31b281,0x4,'goto',_0x323f3b[_0xe02c('0x5b')]+','+_0xe02c('0x6c')+(0x8+_0x4053e6['name']['length'])+'}'+','+0x1));return _0x3a62a2;}function formatPrefixName(_0x38789c){var _0x30ad9f='_';for(var _0x120ef1=0x0;_0x120ef1<_0x38789c[_0xe02c('0x4f')];_0x120ef1++){if(_0x38789c[_0xe02c('0x6d')](_0x120ef1)=='-'){_0x30ad9f+=_0x38789c['charAt'](_0x120ef1);}else{_0x30ad9f+='['+_0x38789c[_0xe02c('0x6d')](_0x120ef1)+']';}}_0x30ad9f+='.';return _0x30ad9f;}exports[_0xe02c('0x2b')]=function(_0x3f277b,_0x2776c0,_0x11c506){var _0x119119=_0x3f277b['body'];_0x119119[_0xe02c('0x62')]=_0xe02c('0x6e')+_0x119119['name']+'-';return db[_0xe02c('0x52')][_0xe02c('0x6f')](function(_0x123ca9){return db[_0xe02c('0x37')]['update'](_0x119119,{'where':{'id':_0x119119['id']},'transaction':_0x123ca9})[_0xe02c('0x2d')](function(){return db[_0xe02c('0x70')]['destroy']({'where':{'VoicePrefixId':_0x119119['id']},'transaction':_0x123ca9})['then'](function(){return db['VoiceExtension'][_0xe02c('0x50')]({'where':{'id':_0x119119[_0xe02c('0x54')]},'raw':!![]})[_0xe02c('0x2d')](function(_0x34e692){return createVoicePrefixExtensions(_0x119119,_0x34e692,_0x123ca9);});});});})[_0xe02c('0x2d')](function(){return db['VoicePrefix'][_0xe02c('0x71')](_0x119119['id']);})[_0xe02c('0x2d')](respondWithResult(_0x2776c0,null))[_0xe02c('0x51')](handleError(_0x2776c0,null));};exports['addAgents']=function(_0x4a7783,_0x4c3c91,_0x3cd802){return db[_0xe02c('0x37')][_0xe02c('0x50')]({'where':{'id':_0x4a7783[_0xe02c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4c3c91,null))[_0xe02c('0x2d')](function(_0x48f524){if(_0x48f524){return _0x48f524['addAgents'](_0x4a7783[_0xe02c('0x53')][_0xe02c('0x72')],_[_0xe02c('0x73')](_0x4a7783[_0xe02c('0x53')],[_0xe02c('0x72'),'id'])||{})[_0xe02c('0x74')](function(_0x748217){for(var _0x12aaea=0x0;_0x12aaea<_0x4a7783['body'][_0xe02c('0x72')][_0xe02c('0x4f')];_0x12aaea+=0x1){socket[_0xe02c('0x75')](_0xe02c('0x76'),{'UserId':Number(_0x4a7783[_0xe02c('0x53')][_0xe02c('0x72')][_0x12aaea]),'VoicePrefixId':Number(_0x4a7783[_0xe02c('0x4e')]['id'])});}return _0x748217;});}})[_0xe02c('0x2d')](respondWithResult(_0x4c3c91,null))[_0xe02c('0x51')](handleError(_0x4c3c91,null));};exports[_0xe02c('0x77')]=function(_0x5e6df5,_0x58acfd,_0x120dd7){return db[_0xe02c('0x37')][_0xe02c('0x50')]({'where':{'id':_0x5e6df5[_0xe02c('0x4e')]['id']}})[_0xe02c('0x2d')](handleEntityNotFound(_0x58acfd,null))['then'](function(_0x405b16){if(_0x405b16){return _0x405b16[_0xe02c('0x77')](_0x5e6df5[_0xe02c('0x3c')][_0xe02c('0x72')])[_0xe02c('0x2d')](function(){if(_[_0xe02c('0x78')](_0x5e6df5[_0xe02c('0x3c')][_0xe02c('0x72')])){for(var _0x1d594c=0x0;_0x1d594c<_0x5e6df5[_0xe02c('0x3c')][_0xe02c('0x72')][_0xe02c('0x4f')];_0x1d594c+=0x1){socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x5e6df5[_0xe02c('0x3c')][_0xe02c('0x72')][_0x1d594c]),'VoicePrefixId':Number(_0x5e6df5['params']['id'])});}}else{socket[_0xe02c('0x75')]('userVoicePrefix:remove',{'UserId':Number(_0x5e6df5[_0xe02c('0x3c')]['ids']),'VoicePrefixId':Number(_0x5e6df5[_0xe02c('0x4e')]['id'])});}});}})[_0xe02c('0x2d')](respondWithStatusCode(_0x58acfd,null))[_0xe02c('0x51')](handleError(_0x58acfd,null));};exports[_0xe02c('0x79')]=function(_0x28755a,_0x3c44d3,_0x119439){var _0x10d067={};var _0x3d3954={};var _0xd0d895;var _0x567478;return db['VoicePrefix']['findOne']({'where':{'id':_0x28755a[_0xe02c('0x4e')]['id']}})[_0xe02c('0x2d')](handleEntityNotFound(_0x3c44d3,null))[_0xe02c('0x2d')](function(_0x1133ce){if(_0x1133ce){_0xd0d895=_0x1133ce;_0x3d3954[_0xe02c('0x3a')]=_[_0xe02c('0x3b')](db[_0xe02c('0x7a')][_0xe02c('0x38')]);_0x3d3954[_0xe02c('0x3c')]=_[_0xe02c('0x3b')](_0x28755a[_0xe02c('0x3c')]);_0x3d3954[_0xe02c('0x3d')]=_[_0xe02c('0x3e')](_0x3d3954['model'],_0x3d3954['query']);_0x10d067[_0xe02c('0x3f')]=_[_0xe02c('0x3e')](_0x3d3954[_0xe02c('0x3a')],qs['fields'](_0x28755a[_0xe02c('0x3c')][_0xe02c('0x40')]));_0x10d067[_0xe02c('0x3f')]=_0x10d067[_0xe02c('0x3f')][_0xe02c('0x4f')]?_0x10d067['attributes']:_0x3d3954[_0xe02c('0x3a')];_0x10d067[_0xe02c('0x43')]=qs[_0xe02c('0x44')](_0x28755a['query'][_0xe02c('0x44')]);_0x10d067[_0xe02c('0x46')]=qs[_0xe02c('0x3d')](_[_0xe02c('0x7b')](_0x28755a[_0xe02c('0x3c')],_0x3d3954['filters']));if(_0x28755a[_0xe02c('0x3c')][_0xe02c('0x45')]){_0x10d067[_0xe02c('0x46')]=_['merge'](_0x10d067[_0xe02c('0x46')],{'$or':_[_0xe02c('0x36')](_0x10d067[_0xe02c('0x3f')],function(_0x3a5ec8){var _0x45e463={};_0x45e463[_0x3a5ec8]={'$like':'%'+_0x28755a['query'][_0xe02c('0x45')]+'%'};return _0x45e463;})});}_0x10d067=_[_0xe02c('0x47')]({},_0x10d067,_0x28755a['options']);return _0xd0d895[_0xe02c('0x79')](_0x10d067);}})['then'](function(_0x52fcd6){if(_0x52fcd6){_0x567478=_0x52fcd6['length'];if(!_0x28755a[_0xe02c('0x3c')][_0xe02c('0x41')](_0xe02c('0x42'))){_0x10d067[_0xe02c('0x24')]=qs[_0xe02c('0x24')](_0x28755a[_0xe02c('0x3c')][_0xe02c('0x24')]);_0x10d067[_0xe02c('0x26')]=qs[_0xe02c('0x26')](_0x28755a[_0xe02c('0x3c')][_0xe02c('0x26')]);}return _0xd0d895[_0xe02c('0x79')](_0x10d067);}})[_0xe02c('0x2d')](function(_0xfe0b1c){if(_0xfe0b1c){return _0xfe0b1c?{'count':_0x567478,'rows':_0xfe0b1c}:null;}})[_0xe02c('0x2d')](respondWithResult(_0x3c44d3,null))[_0xe02c('0x51')](handleError(_0x3c44d3,null));};exports['getTeams']=function(_0x283de9,_0x4cfbc0,_0x3650cb){var _0xdc8df0={};var _0x4564f1={};var _0x2c6d29;var _0x5b75ed;return db[_0xe02c('0x37')][_0xe02c('0x7c')]({'where':{'id':_0x283de9[_0xe02c('0x4e')]['id']}})[_0xe02c('0x2d')](handleEntityNotFound(_0x4cfbc0,null))[_0xe02c('0x2d')](function(_0xced62f){if(_0xced62f){_0x2c6d29=_0xced62f;_0x4564f1[_0xe02c('0x3a')]=_['keys'](db[_0xe02c('0x7d')][_0xe02c('0x38')]);_0x4564f1['query']=_[_0xe02c('0x3b')](_0x283de9['query']);_0x4564f1['filters']=_[_0xe02c('0x3e')](_0x4564f1[_0xe02c('0x3a')],_0x4564f1[_0xe02c('0x3c')]);_0xdc8df0[_0xe02c('0x3f')]=_['intersection'](_0x4564f1['model'],qs[_0xe02c('0x40')](_0x283de9[_0xe02c('0x3c')]['fields']));_0xdc8df0[_0xe02c('0x3f')]=_0xdc8df0[_0xe02c('0x3f')][_0xe02c('0x4f')]?_0xdc8df0[_0xe02c('0x3f')]:_0x4564f1[_0xe02c('0x3a')];_0xdc8df0[_0xe02c('0x43')]=qs['sort'](_0x283de9[_0xe02c('0x3c')][_0xe02c('0x44')]);_0xdc8df0[_0xe02c('0x46')]=qs[_0xe02c('0x3d')](_[_0xe02c('0x7b')](_0x283de9[_0xe02c('0x3c')],_0x4564f1[_0xe02c('0x3d')]));if(_0x283de9[_0xe02c('0x3c')][_0xe02c('0x45')]){_0xdc8df0[_0xe02c('0x46')]=_[_0xe02c('0x47')](_0xdc8df0[_0xe02c('0x46')],{'$or':_[_0xe02c('0x36')](_0xdc8df0[_0xe02c('0x3f')],function(_0x5c4ed7){var _0x1abb2d={};_0x1abb2d[_0x5c4ed7]={'$like':'%'+_0x283de9[_0xe02c('0x3c')][_0xe02c('0x45')]+'%'};return _0x1abb2d;})});}_0xdc8df0=_['merge']({},_0xdc8df0,_0x283de9[_0xe02c('0x48')]);return _0x2c6d29[_0xe02c('0x7e')](_0xdc8df0);}})[_0xe02c('0x2d')](function(_0x2127e7){if(_0x2127e7){_0x5b75ed=_0x2127e7[_0xe02c('0x4f')];if(!_0x283de9[_0xe02c('0x3c')][_0xe02c('0x41')]('nolimit')){_0xdc8df0[_0xe02c('0x24')]=qs[_0xe02c('0x24')](_0x283de9[_0xe02c('0x3c')][_0xe02c('0x24')]);_0xdc8df0[_0xe02c('0x26')]=qs[_0xe02c('0x26')](_0x283de9[_0xe02c('0x3c')][_0xe02c('0x26')]);}return _0x2c6d29[_0xe02c('0x7e')](_0xdc8df0);}})['then'](function(_0x4297b2){if(_0x4297b2){return _0x4297b2?{'count':_0x5b75ed,'rows':_0x4297b2}:null;}})[_0xe02c('0x2d')](respondWithResult(_0x4cfbc0,null))['catch'](handleError(_0x4cfbc0,null));};exports[_0xe02c('0x7f')]=function(_0x4081f5,_0x1d23ed,_0x46fd38){var _0x7cd9df=_0x4081f5[_0xe02c('0x53')]['ids'];var _0xc21958;return db[_0xe02c('0x7d')][_0xe02c('0x4b')]({'where':{'id':_0x7cd9df},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xe02c('0x33'),_0xe02c('0x80'),_0xe02c('0x81'),'interface'],'raw':!![]}]})[_0xe02c('0x2d')](function(_0x35b30c){if(_0x35b30c){_0xc21958=_0x35b30c;var _0x469eac=_[_0xe02c('0x82')](_0x35b30c,function(_0x7441e6){var _0x56e35d=_0x7441e6[_0xe02c('0x2e')]({'plain':!![]});return _0x56e35d[_0xe02c('0x83')];});return db[_0xe02c('0x37')][_0xe02c('0x50')]({'where':{'id':_0x4081f5[_0xe02c('0x4e')]['id']}})[_0xe02c('0x2d')](function(_0x327507){return db[_0xe02c('0x52')][_0xe02c('0x6f')](function(_0x2ee007){return _0x327507[_0xe02c('0x7f')](_0x7cd9df,{'transaction':_0x2ee007})[_0xe02c('0x2d')](function(){return BPromise[_0xe02c('0x84')](_0xc21958,function(_0x1de725){return db[_0xe02c('0x85')][_0xe02c('0x86')]({'TeamId':_0x1de725['id'],'VoicePrefixId':_0x4081f5[_0xe02c('0x4e')]['id']},{'transaction':_0x2ee007});});})['then'](function(){return BPromise['each'](_0x469eac,function(_0x4400b2){return db['UserVoicePrefix']['findOrCreate']({'where':{'UserId':_0x4400b2['id'],'VoicePrefixId':_0x4081f5['params']['id']},'transaction':_0x2ee007});});})[_0xe02c('0x2d')](function(){_0x469eac[_0xe02c('0x87')](function(_0x889cef){socket['emit'](_0xe02c('0x76'),{'UserId':_0x889cef['id'],'VoicePrefixId':_0x327507['id']});});});});});}})['then'](respondWithStatusCode(_0x1d23ed,null))['catch'](handleError(_0x1d23ed,null));};exports[_0xe02c('0x88')]=function(_0x3ca665,_0x4eb163,_0x1433bd){return db['Team']['findAll']({'where':{'id':_0x3ca665[_0xe02c('0x3c')][_0xe02c('0x72')]},'attributes':['id'],'include':[{'model':db[_0xe02c('0x7a')],'as':_0xe02c('0x83'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4eb163,null))[_0xe02c('0x2d')](function(_0x25933f){var _0x323d81=_[_0xe02c('0x36')](_0x25933f,'id');var _0x3b6e15=[];var _0x1c96cc=[];var _0x322b4a=squel[_0xe02c('0x89')]();_0x322b4a[_0xe02c('0x8a')](_0xe02c('0x8b'))[_0xe02c('0x8c')](_0xe02c('0x8d'),'tq')[_0xe02c('0x8e')](_0xe02c('0x8f'),'ut',_0xe02c('0x90'))[_0xe02c('0x46')](_0xe02c('0x91'),_0x3ca665['params']['id']);for(var _0x252f5f=0x0;_0x252f5f<_0x25933f[_0xe02c('0x4f')];_0x252f5f+=0x1){let _0x4d112d=_0x25933f[_0x252f5f];for(var _0x3e0961=0x0;_0x3e0961<_0x4d112d[_0xe02c('0x83')][_0xe02c('0x4f')];_0x3e0961+=0x1){let _0x4b7886=_0x4d112d[_0xe02c('0x83')][_0x3e0961];var _0x505074=_0x322b4a[_0xe02c('0x92')]();_0x505074['where'](_0xe02c('0x93'),_0x4b7886['id']);_0x1c96cc[_0xe02c('0x68')](db[_0xe02c('0x52')][_0xe02c('0x3c')](_0x505074[_0xe02c('0x94')](),{'type':db['sequelize'][_0xe02c('0x95')]['SELECT']})[_0xe02c('0x2d')](function(_0x47d3fa){if(_0x47d3fa[_0xe02c('0x4f')]===0x1){return _0x4b7886['id'];}else{var _0x534002=_[_0xe02c('0x96')](_[_0xe02c('0x36')](_0x47d3fa,_0xe02c('0x97')),function(_0x45c425){return _[_0xe02c('0x98')](_0x323d81,_0x45c425);});if(_0x534002){return _0x4b7886['id'];}}}));}}return BPromise['all'](_0x1c96cc)['then'](function(_0x27ea6e){_0x3b6e15=_(_0x3b6e15)[_0xe02c('0x99')](_0x27ea6e)[_0xe02c('0x9a')]()[_0xe02c('0x9b')]();return db[_0xe02c('0x37')]['find']({'where':{'id':_0x3ca665[_0xe02c('0x4e')]['id']}})[_0xe02c('0x2d')](function(_0x34b426){return db['sequelize'][_0xe02c('0x6f')](function(_0x2a8e1d){return _0x34b426[_0xe02c('0x88')](_0x3ca665[_0xe02c('0x3c')][_0xe02c('0x72')],{'transaction':_0x2a8e1d})[_0xe02c('0x2d')](function(){if(!_['isEmpty'](_0x3b6e15)){return _0x34b426['removeAgents'](_0x3b6e15,{'transaction':_0x2a8e1d});}})[_0xe02c('0x2d')](function(){_0x3b6e15[_0xe02c('0x87')](function(_0x4b9fb7){socket['emit']('userVoicePrefix:remove',{'UserId':_0x4b9fb7,'VoicePrefixId':_0x34b426['id']});});});});});});})['then'](respondWithStatusCode(_0x4eb163,null))[_0xe02c('0x51')](handleError(_0x4eb163,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 0391966..43774e4 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 _0x1b29=['VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x3fd5bb,_0x2749aa){var _0x382cd2=function(_0x613553){while(--_0x613553){_0x3fd5bb['push'](_0x3fd5bb['shift']());}};_0x382cd2(++_0x2749aa);}(_0x1b29,0x1c0));var _0x91b2=function(_0x3d44e1,_0x36db1f){_0x3d44e1=_0x3d44e1-0x0;var _0x521e4c=_0x1b29[_0x3d44e1];return _0x521e4c;};'use strict';var EventEmitter=require(_0x91b2('0x0'));var VoicePrefix=require(_0x91b2('0x1'))['db'][_0x91b2('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x91b2('0x3')](0x0);var events={'afterCreate':_0x91b2('0x4'),'afterUpdate':_0x91b2('0x5'),'afterDestroy':_0x91b2('0x6')};function emitEvent(_0x20f540){return function(_0x405272,_0x5ddda3,_0xfb8a0e){VoicePrefixEvents[_0x91b2('0x7')](_0x20f540+':'+_0x405272['id'],_0x405272);VoicePrefixEvents[_0x91b2('0x7')](_0x20f540,_0x405272);_0xfb8a0e(null);};}for(var e in events){if(events[_0x91b2('0x8')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x91b2('0x9')]=VoicePrefixEvents; \ No newline at end of file +var _0x62bd=['remove','emit','hasOwnProperty','exports','../../mysqldb','VoicePrefix','setMaxListeners','save'];(function(_0x334b59,_0x4ff2df){var _0x366e04=function(_0x2d16c9){while(--_0x2d16c9){_0x334b59['push'](_0x334b59['shift']());}};_0x366e04(++_0x4ff2df);}(_0x62bd,0x104));var _0xd62b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x62bd[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0xd62b('0x0'))['db'][_0xd62b('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xd62b('0x2')](0x0);var events={'afterCreate':_0xd62b('0x3'),'afterUpdate':'update','afterDestroy':_0xd62b('0x4')};function emitEvent(_0x23e858){return function(_0x1c200c,_0x570ca2,_0x196d12){VoicePrefixEvents[_0xd62b('0x5')](_0x23e858+':'+_0x1c200c['id'],_0x1c200c);VoicePrefixEvents['emit'](_0x23e858,_0x1c200c);_0x196d12(null);};}for(var e in events){if(events[_0xd62b('0x6')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0xd62b('0x7')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 83bcf7d..820ee22 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 _0x235c=['exports','define','VoicePrefix','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes'];(function(_0x4e6eb2,_0x16a451){var _0x4e0c1c=function(_0x59f144){while(--_0x59f144){_0x4e6eb2['push'](_0x4e6eb2['shift']());}};_0x4e0c1c(++_0x16a451);}(_0x235c,0x153));var _0xc235=function(_0x319371,_0x9639ad){_0x319371=_0x319371-0x0;var _0x4c8319=_0x235c[_0x319371];return _0x4c8319;};'use strict';var _=require(_0xc235('0x0'));var util=require(_0xc235('0x1'));var logger=require(_0xc235('0x2'))('api');var moment=require(_0xc235('0x3'));var BPromise=require('bluebird');var rp=require(_0xc235('0x4'));var fs=require('fs');var path=require(_0xc235('0x5'));var rimraf=require(_0xc235('0x6'));var config=require(_0xc235('0x7'));var attributes=require(_0xc235('0x8'));module[_0xc235('0x9')]=function(_0x15894d,_0x32ddde){return _0x15894d[_0xc235('0xa')](_0xc235('0xb'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x581e=['../../config/environment','exports','define','VoicePrefix','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x581e,0xb4));var _0xe581=function(_0x4e3f0d,_0x2450c7){_0x4e3f0d=_0x4e3f0d-0x0;var _0x509c73=_0x581e[_0x4e3f0d];return _0x509c73;};'use strict';var _=require(_0xe581('0x0'));var util=require(_0xe581('0x1'));var logger=require(_0xe581('0x2'))('api');var moment=require(_0xe581('0x3'));var BPromise=require(_0xe581('0x4'));var rp=require(_0xe581('0x5'));var fs=require('fs');var path=require(_0xe581('0x6'));var rimraf=require('rimraf');var config=require(_0xe581('0x7'));var attributes=require('./voicePrefix.attributes');module[_0xe581('0x8')]=function(_0x54870b,_0x5d80f1){return _0x54870b[_0xe581('0x9')](_0xe581('0xa'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index f7f0627..35c1a44 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 _0x2ff5=['request','then','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','request\x20sent','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register'];(function(_0x1889e8,_0x30b3df){var _0x3a8bac=function(_0x1f2e64){while(--_0x1f2e64){_0x1889e8['push'](_0x1889e8['shift']());}};_0x3a8bac(++_0x30b3df);}(_0x2ff5,0x1d5));var _0x52ff=function(_0xe7e9a6,_0x462b3a){_0xe7e9a6=_0xe7e9a6-0x0;var _0x2655ad=_0x2ff5[_0xe7e9a6];return _0x2655ad;};'use strict';var _=require('lodash');var util=require(_0x52ff('0x0'));var moment=require(_0x52ff('0x1'));var BPromise=require('bluebird');var rs=require(_0x52ff('0x2'));var fs=require('fs');var Redis=require(_0x52ff('0x3'));var db=require(_0x52ff('0x4'))['db'];var utils=require(_0x52ff('0x5'));var logger=require(_0x52ff('0x6'))(_0x52ff('0x7'));var config=require('../../config/environment');var jayson=require(_0x52ff('0x8'));var client=jayson[_0x52ff('0x9')][_0x52ff('0xa')]({'port':0x232a});config['redis']=_[_0x52ff('0xb')](config[_0x52ff('0xc')],{'host':_0x52ff('0xd'),'port':0x18eb});var socket=require(_0x52ff('0xe'))(new Redis(config[_0x52ff('0xc')]));require(_0x52ff('0xf'))[_0x52ff('0x10')](socket);function respondWithRpcPromise(_0x16aaf4,_0x5e127e,_0xa7c521){return new BPromise(function(_0x9fb89c,_0x111904){return client[_0x52ff('0x11')](_0x16aaf4,_0xa7c521)[_0x52ff('0x12')](function(_0x300409){logger['info']('VoicePrefix,\x20%s,\x20%s',_0x5e127e,'request\x20sent');logger['debug'](_0x52ff('0x13'),_0x5e127e,'request\x20sent',JSON[_0x52ff('0x14')](_0x300409));if(_0x300409[_0x52ff('0x15')]){if(_0x300409['error'][_0x52ff('0x16')]===0x1f4){logger[_0x52ff('0x15')](_0x52ff('0x17'),_0x5e127e,_0x300409[_0x52ff('0x15')][_0x52ff('0x18')]);return _0x111904(_0x300409[_0x52ff('0x15')]['message']);}logger[_0x52ff('0x15')](_0x52ff('0x17'),_0x5e127e,_0x300409[_0x52ff('0x15')][_0x52ff('0x18')]);return _0x9fb89c(_0x300409[_0x52ff('0x15')][_0x52ff('0x18')]);}else{logger['info'](_0x52ff('0x17'),_0x5e127e,_0x52ff('0x19'));_0x9fb89c(_0x300409[_0x52ff('0x1a')][_0x52ff('0x18')]);}})['catch'](function(_0x355ea4){logger[_0x52ff('0x15')](_0x52ff('0x17'),_0x5e127e,_0x355ea4);_0x111904(_0x355ea4);});});} \ No newline at end of file +var _0xd4ad=['util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','redis','defaults','localhost','./voicePrefix.socket','register','request','info','request\x20sent','debug','error','code','VoicePrefix,\x20%s,\x20%s','message','result','lodash'];(function(_0x43ff0f,_0x11b848){var _0x5ab15f=function(_0xdaa908){while(--_0xdaa908){_0x43ff0f['push'](_0x43ff0f['shift']());}};_0x5ab15f(++_0x11b848);}(_0xd4ad,0x158));var _0xdd4a=function(_0x4839f6,_0xbd11){_0x4839f6=_0x4839f6-0x0;var _0x20910a=_0xd4ad[_0x4839f6];return _0x20910a;};'use strict';var _=require(_0xdd4a('0x0'));var util=require(_0xdd4a('0x1'));var moment=require(_0xdd4a('0x2'));var BPromise=require(_0xdd4a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdd4a('0x4'));var db=require(_0xdd4a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdd4a('0x6'));var config=require(_0xdd4a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdd4a('0x8')]['http']({'port':0x232a});config[_0xdd4a('0x9')]=_[_0xdd4a('0xa')](config['redis'],{'host':_0xdd4a('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdd4a('0x9')]));require(_0xdd4a('0xc'))[_0xdd4a('0xd')](socket);function respondWithRpcPromise(_0x1bb817,_0x23e1dc,_0x934dff){return new BPromise(function(_0x4de3d5,_0x521e0d){return client[_0xdd4a('0xe')](_0x1bb817,_0x934dff)['then'](function(_0x11d422){logger[_0xdd4a('0xf')]('VoicePrefix,\x20%s,\x20%s',_0x23e1dc,_0xdd4a('0x10'));logger[_0xdd4a('0x11')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x23e1dc,_0xdd4a('0x10'),JSON['stringify'](_0x11d422));if(_0x11d422[_0xdd4a('0x12')]){if(_0x11d422['error'][_0xdd4a('0x13')]===0x1f4){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x23e1dc,_0x11d422[_0xdd4a('0x12')]['message']);return _0x521e0d(_0x11d422['error']['message']);}logger[_0xdd4a('0x12')](_0xdd4a('0x14'),_0x23e1dc,_0x11d422[_0xdd4a('0x12')][_0xdd4a('0x15')]);return _0x4de3d5(_0x11d422[_0xdd4a('0x12')][_0xdd4a('0x15')]);}else{logger[_0xdd4a('0xf')](_0xdd4a('0x14'),_0x23e1dc,'request\x20sent');_0x4de3d5(_0x11d422[_0xdd4a('0x16')][_0xdd4a('0x15')]);}})['catch'](function(_0x2aaf26){logger[_0xdd4a('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x23e1dc,_0x2aaf26);_0x521e0d(_0x2aaf26);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 3cbf453..8d0b83b 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 _0x6611=['emit','removeListener','register','length','save','remove','update'];(function(_0x1f025a,_0x42dda7){var _0x56b034=function(_0x522a85){while(--_0x522a85){_0x1f025a['push'](_0x1f025a['shift']());}};_0x56b034(++_0x42dda7);}(_0x6611,0xdd));var _0x1661=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x6611[_0x5b644e];return _0x49c6bf;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x1661('0x0'),_0x1661('0x1'),_0x1661('0x2')];function createListener(_0x1a93fb,_0x3dcfbd){return function(_0x474832){_0x3dcfbd[_0x1661('0x3')](_0x1a93fb,_0x474832);};}function removeListener(_0x25bce6,_0x277da8){return function(){VoicePrefixEvents[_0x1661('0x4')](_0x25bce6,_0x277da8);};}exports[_0x1661('0x5')]=function(_0x1e5dab){for(var _0x58781d=0x0,_0x516d22=events[_0x1661('0x6')];_0x58781d<_0x516d22;_0x58781d++){var _0x3be60f=events[_0x58781d];var _0x57e4b8=createListener('voicePrefix:'+_0x3be60f,_0x1e5dab);VoicePrefixEvents['on'](_0x3be60f,_0x57e4b8);}}; \ No newline at end of file +var _0xb16f=['voicePrefix:','./voicePrefix.events','save','remove','emit'];(function(_0x2835db,_0x12e852){var _0x5df667=function(_0x3d14aa){while(--_0x3d14aa){_0x2835db['push'](_0x2835db['shift']());}};_0x5df667(++_0x12e852);}(_0xb16f,0xf6));var _0xfb16=function(_0x51e79c,_0x51485e){_0x51e79c=_0x51e79c-0x0;var _0x2467be=_0xb16f[_0x51e79c];return _0x2467be;};'use strict';var VoicePrefixEvents=require(_0xfb16('0x0'));var events=[_0xfb16('0x1'),_0xfb16('0x2'),'update'];function createListener(_0x144a71,_0x4483aa){return function(_0x402009){_0x4483aa[_0xfb16('0x3')](_0x144a71,_0x402009);};}function removeListener(_0x5caa17,_0x21fee8){return function(){VoicePrefixEvents['removeListener'](_0x5caa17,_0x21fee8);};}exports['register']=function(_0x5ed3ef){for(var _0x552b74=0x0,_0x3cdd5e=events['length'];_0x552b74<_0x3cdd5e;_0x552b74++){var _0x1e615f=events[_0x552b74];var _0x4b5296=createListener(_0xfb16('0x4')+_0x1e615f,_0x5ed3ef);VoicePrefixEvents['on'](_0x1e615f,_0x4b5296);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 97dc171..03e5dda 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x3aaae2,_0x558dac){var _0x5b6e34=function(_0x6ebd72){while(--_0x6ebd72){_0x3aaae2['push'](_0x3aaae2['shift']());}};_0x5b6e34(++_0x558dac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x1e2321,_0x3ae1c5){var _0x1d346d=function(_0x24f171){while(--_0x24f171){_0x1e2321['push'](_0x1e2321['shift']());}};_0x1d346d(++_0x3ae1c5);}(_0xb10b,0x12a));var _0xbb10=function(_0x58a4b5,_0x182439){_0x58a4b5=_0x58a4b5-0x0;var _0x51821d=_0xb10b[_0x58a4b5];return _0x51821d;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 3e9c87d..f0dd726 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 _0x6643=['#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','ENUM','inbound','default','ringall','leastrecent','random','rrmemory','linear','rrordered','setDataValue','strategy','getDataValue','type','dialMethod','booked','progressive','predictive','INTEGER','yes','once','TEXT','join','periodic_announce','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','preview','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','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','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\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','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x6643,0x1ee));var _0x3664=function(_0x2fc188,_0x1d973e){_0x2fc188=_0x2fc188-0x0;var _0x2e329=_0x6643[_0x2fc188];return _0x2e329;};'use strict';var Sequelize=require(_0x3664('0x0'));module[_0x3664('0x1')]={'name':{'type':Sequelize[_0x3664('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x3664('0x3')](_0x3664('0x4'),'outbound'),'allowNull':![],'defaultValue':_0x3664('0x4')},'musiconhold':{'type':Sequelize[_0x3664('0x2')],'defaultValue':_0x3664('0x5')},'announce':{'type':Sequelize[_0x3664('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x3664('0x3')]('rr',_0x3664('0x6'),_0x3664('0x7'),'fewestcalls',_0x3664('0x8'),_0x3664('0x9'),_0x3664('0xa'),'wrandom',_0x3664('0xb')),'allowNull':![],'defaultValue':'ringall','set':function(_0x37592d){this[_0x3664('0xc')](_0x3664('0xd'),_0x37592d?_0x37592d:'rrmemory');},'get':function(){var _0x4fae3a=this[_0x3664('0xe')](_0x3664('0xf'));var _0x11c444=this[_0x3664('0xe')](_0x3664('0x10'));var _0x5f8f9e=this[_0x3664('0xe')](_0x3664('0xd'));if(_0x4fae3a==='inbound'){return _0x5f8f9e;}if(_0x11c444===_0x3664('0x11')&&_0x5f8f9e==='rrmemory'||_0x11c444==='booked'&&_0x5f8f9e==='roundrobin'){return _0x5f8f9e;}if(_0x11c444===_0x3664('0x12')||_0x11c444===_0x3664('0x13')||_0x11c444==='power'){return _0x5f8f9e;}return null;}},'servicelevel':{'type':Sequelize[_0x3664('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x3664('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x3664('0x14')](0xb)},'timeout':{'type':Sequelize[_0x3664('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x3664('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x3664('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x3664('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0x3664('0x15'),'no'),'defaultValue':_0x3664('0x15')},'autopause':{'type':Sequelize['ENUM'](_0x3664('0x15'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x3664('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0x3664('0x3')](_0x3664('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x3664('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x3664('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x3664('0x3')](_0x3664('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x3664('0x3')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x3664('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x3664('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x3664('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x3664('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x3664('0x3')]('yes','no'),'defaultValue':_0x3664('0x15')},'announce_holdtime':{'type':Sequelize[_0x3664('0x3')](_0x3664('0x15'),'no',_0x3664('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x3664('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x3664('0x3')](_0x3664('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0x3664('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x3664('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x3664('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x3664('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x3664('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x3664('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x3664('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x3664('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x3664('0x2')]},'queue_quantity1':{'type':Sequelize[_0x3664('0x2')]},'queue_quantity2':{'type':Sequelize[_0x3664('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x3664('0x2')]},'queue_less_than':{'type':Sequelize[_0x3664('0x2')]},'periodic_announce':{'type':Sequelize[_0x3664('0x17')],'set':function(_0x2c816b){this[_0x3664('0xc')]('periodic_announce',_0x2c816b?_0x2c816b[_0x3664('0x18')](','):[]);},'get':function(){return this[_0x3664('0xe')](_0x3664('0x19'))?this[_0x3664('0xe')](_0x3664('0x19'))[_0x3664('0x1a')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x3664('0x15'),'set':function(_0x226ee5){this[_0x3664('0xc')](_0x3664('0x1b'),_0x226ee5?_0x226ee5['join'](','):undefined);},'get':function(){return this[_0x3664('0xe')]('joinempty')?this[_0x3664('0xe')]('joinempty')['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x3664('0x2')],'defaultValue':'no','set':function(_0x4f549f){this[_0x3664('0xc')](_0x3664('0x1c'),_0x4f549f?_0x4f549f[_0x3664('0x18')](','):undefined);},'get':function(){return this[_0x3664('0xe')](_0x3664('0x1c'))?this['getDataValue']('leavewhenempty')['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x3664('0x3')](_0x3664('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x3664('0x3')](_0x3664('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x3664('0x3')](_0x3664('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x3664('0x2')]},'description':{'type':Sequelize[_0x3664('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x1048dc){this[_0x3664('0xc')](_0x3664('0x1d'),_0x1048dc);if(_0x1048dc){if(this['getDataValue'](_0x3664('0x1e'))<0x2){this[_0x3664('0xc')](_0x3664('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x3664('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x3664('0x3')](_0x3664('0x20'),'progressive','power',_0x3664('0x13'),_0x3664('0x11')),'defaultValue':_0x3664('0x12'),'comment':_0x3664('0x21')},'dialLimitChannel':{'type':Sequelize[_0x3664('0x14')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x3664('0x22')},'dialLimitQueue':{'type':Sequelize[_0x3664('0x14')](0x4)[_0x3664('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x3664('0x24')},'dialPowerLevel':{'type':Sequelize[_0x3664('0x25')](0x2)[_0x3664('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x3664('0x26')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x3664('0x27'),'dropRate'),'defaultValue':_0x3664('0x28'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x3664('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x3664('0x14')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x3664('0x29')},'dialOriginateCallerIdName':{'type':Sequelize[_0x3664('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x3664('0x14')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0x3664('0x2')],'defaultValue':_0x3664('0x2a'),'comment':_0x3664('0x2b')},'dialQueueTimeout':{'type':Sequelize[_0x3664('0x14')](0x3)[_0x3664('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3664('0x2c')},'dialQueueProject':{'type':Sequelize[_0x3664('0x2')],'comment':_0x3664('0x2d')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3664('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3664('0x2e')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3664('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x3664('0x14')](0x3)[_0x3664('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3664('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3664('0x30')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x3664('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x3664('0x31')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x3664('0x14')](0x5)[_0x3664('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3664('0x32')},'dialGlobalMaxRetry':{'type':Sequelize[_0x3664('0x14')](0x3)[_0x3664('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x3664('0x33')},'dialTimezone':{'type':Sequelize[_0x3664('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x3664('0x2')],'defaultValue':_0x3664('0x34')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x3664('0x3')](_0x3664('0x35'),'never',_0x3664('0x36')),'defaultValue':_0x3664('0x35')},'dialAMDActive':{'type':Sequelize[_0x3664('0x1f')],'defaultValue':0x0,'comment':_0x3664('0x37')},'dialAMDInitialSilence':{'type':Sequelize[_0x3664('0x14')](0x9)[_0x3664('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x3664('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x3664('0x14')](0x9)[_0x3664('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x3664('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x3664('0x14')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x3664('0x14')](0x9)[_0x3664('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3664('0x3a')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x3664('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x3664('0x3b')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x3664('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x3664('0x3c')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x3664('0x14')](0x9)[_0x3664('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x3664('0x3d')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x3664('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x3664('0x3e')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x3664('0x14')](0x9)[_0x3664('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3664('0x3f')},'dialRecallMeTimeout':{'type':Sequelize[_0x3664('0x14')](0x5)[_0x3664('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x3664('0x40')},'dialRecallInQueue':{'type':Sequelize[_0x3664('0x1f')],'defaultValue':0x0,'comment':_0x3664('0x41')},'dialOrderByScheduledAt':{'type':Sequelize[_0x3664('0x3')](_0x3664('0x42'),'ASC'),'defaultValue':_0x3664('0x42')},'dialQueueProject2':{'type':Sequelize[_0x3664('0x2')],'comment':_0x3664('0x2d')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x3664('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x3664('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x3664('0x14')](0x3)[_0x3664('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3664('0x43')},'dialCutDigit':{'type':Sequelize[_0x3664('0x14')](0x3)[_0x3664('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3664('0x44')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3664('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3664('0x45')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x3664('0x14')](0x5)[_0x3664('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3664('0x46')},'dialDropMaxRetry':{'type':Sequelize[_0x3664('0x14')](0x3)[_0x3664('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x3664('0x14')](0x5)[_0x3664('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3664('0x47')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3664('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3664('0x48')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3664('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3664('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3664('0x49')},'dialMachineRetryFrequency':{'type':Sequelize[_0x3664('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3664('0x4a')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x3664('0x14')](0x3)[_0x3664('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3664('0x4b')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3664('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3664('0x4c')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3664('0x14')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x3664('0x1f')],'defaultValue':![],'comment':_0x3664('0x4d'),'set':function(_0x105152){if(!_0x105152)this[_0x3664('0xc')]('mandatoryDispositionPauseId',null);this[_0x3664('0xc')](_0x3664('0x4e'),_0x105152);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x3664('0x14')](0x3)[_0x3664('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x3664('0x14')](0x3)[_0x3664('0x23')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xea5e=['booked','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\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)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','default','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','getDataValue','type','dialMethod','roundrobin','progressive','predictive','power','INTEGER','all','yes','once','setDataValue','periodic_announce','joinempty','join','split','leavewhenempty','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign'];(function(_0x352e09,_0x37a7da){var _0x1b7094=function(_0x561074){while(--_0x561074){_0x352e09['push'](_0x352e09['shift']());}};_0x1b7094(++_0x37a7da);}(_0xea5e,0x7d));var _0xeea5=function(_0x4c85f4,_0x2d1c1b){_0x4c85f4=_0x4c85f4-0x0;var _0x4b46e2=_0xea5e[_0x4c85f4];return _0x4b46e2;};'use strict';var Sequelize=require(_0xeea5('0x0'));module[_0xeea5('0x1')]={'name':{'type':Sequelize[_0xeea5('0x2')],'allowNull':![],'unique':_0xeea5('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xeea5('0x4')]('inbound','outbound'),'allowNull':![],'defaultValue':_0xeea5('0x5')},'musiconhold':{'type':Sequelize[_0xeea5('0x2')],'defaultValue':_0xeea5('0x6')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0xeea5('0x4')]('rr',_0xeea5('0x7'),_0xeea5('0x8'),_0xeea5('0x9'),_0xeea5('0xa'),_0xeea5('0xb'),_0xeea5('0xc'),_0xeea5('0xd'),_0xeea5('0xe')),'allowNull':![],'defaultValue':_0xeea5('0x7'),'set':function(_0x562041){this['setDataValue']('strategy',_0x562041?_0x562041:'rrmemory');},'get':function(){var _0x455af6=this[_0xeea5('0xf')](_0xeea5('0x10'));var _0x1b482e=this[_0xeea5('0xf')](_0xeea5('0x11'));var _0x32a566=this[_0xeea5('0xf')]('strategy');if(_0x455af6==='inbound'){return _0x32a566;}if(_0x1b482e==='booked'&&_0x32a566===_0xeea5('0xb')||_0x1b482e==='booked'&&_0x32a566===_0xeea5('0x12')){return _0x32a566;}if(_0x1b482e===_0xeea5('0x13')||_0x1b482e===_0xeea5('0x14')||_0x1b482e===_0xeea5('0x15')){return _0x32a566;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xeea5('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xeea5('0x16')](0xb)},'timeout':{'type':Sequelize[_0xeea5('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xeea5('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xeea5('0x2')]},'weight':{'type':Sequelize[_0xeea5('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xeea5('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xeea5('0x4')]('yes','no'),'defaultValue':'yes'},'autopause':{'type':Sequelize['ENUM']('yes','no',_0xeea5('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0xeea5('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xeea5('0x4')](_0xeea5('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xeea5('0x4')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0xeea5('0x18'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xeea5('0x4')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xeea5('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xeea5('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xeea5('0x4')](_0xeea5('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xeea5('0x4')](_0xeea5('0x18'),'no'),'defaultValue':_0xeea5('0x18')},'announce_holdtime':{'type':Sequelize['ENUM']('yes','no',_0xeea5('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xeea5('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0xeea5('0x18'),'no')},'announce_position_limit':{'type':Sequelize[_0xeea5('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xeea5('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xeea5('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xeea5('0x2')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xeea5('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xeea5('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xeea5('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xeea5('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xeea5('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xeea5('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xeea5('0x2')]},'queue_quantity1':{'type':Sequelize[_0xeea5('0x2')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0xeea5('0x2')]},'queue_less_than':{'type':Sequelize[_0xeea5('0x2')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x53c7ad){this[_0xeea5('0x1a')](_0xeea5('0x1b'),_0x53c7ad?_0x53c7ad['join'](','):[]);},'get':function(){return this[_0xeea5('0xf')](_0xeea5('0x1b'))?this['getDataValue'](_0xeea5('0x1b'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0xeea5('0x2')],'defaultValue':'yes','set':function(_0x12757f){this[_0xeea5('0x1a')](_0xeea5('0x1c'),_0x12757f?_0x12757f[_0xeea5('0x1d')](','):undefined);},'get':function(){return this[_0xeea5('0xf')](_0xeea5('0x1c'))?this[_0xeea5('0xf')]('joinempty')[_0xeea5('0x1e')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xeea5('0x2')],'defaultValue':'no','set':function(_0x34bcbf){this[_0xeea5('0x1a')](_0xeea5('0x1f'),_0x34bcbf?_0x34bcbf[_0xeea5('0x1d')](','):undefined);},'get':function(){return this[_0xeea5('0xf')]('leavewhenempty')?this[_0xeea5('0xf')](_0xeea5('0x1f'))[_0xeea5('0x1e')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xeea5('0x4')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xeea5('0x4')](_0xeea5('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xeea5('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xeea5('0x4')](_0xeea5('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xeea5('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x5d08a4){this[_0xeea5('0x1a')]('acw',_0x5d08a4);if(_0x5d08a4){if(this[_0xeea5('0xf')](_0xeea5('0x20'))<0x2){this[_0xeea5('0x1a')](_0xeea5('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xeea5('0x21')],'defaultValue':0x0,'comment':_0xeea5('0x22')},'dialMethod':{'type':Sequelize[_0xeea5('0x4')]('preview','progressive',_0xeea5('0x15'),'predictive',_0xeea5('0x23')),'defaultValue':'progressive','comment':_0xeea5('0x24')},'dialLimitChannel':{'type':Sequelize[_0xeea5('0x16')](0x4)[_0xeea5('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xeea5('0x26')},'dialLimitQueue':{'type':Sequelize[_0xeea5('0x16')](0x4)[_0xeea5('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0xeea5('0x27')](0x2)[_0xeea5('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xeea5('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0xeea5('0x4')](_0xeea5('0x29'),'dropRate'),'defaultValue':_0xeea5('0x2a'),'comment':_0xeea5('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xeea5('0x27')](0x2)[_0xeea5('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xeea5('0x2c')},'dialPredictiveInterval':{'type':Sequelize[_0xeea5('0x16')](0x3)[_0xeea5('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0xeea5('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xeea5('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xeea5('0x16')](0x3)[_0xeea5('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0xeea5('0x2')],'defaultValue':_0xeea5('0x2d'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0xeea5('0x16')](0x3)[_0xeea5('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xeea5('0x2e')},'dialQueueProject':{'type':Sequelize[_0xeea5('0x2')],'comment':_0xeea5('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xeea5('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xeea5('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xeea5('0x16')](0x5)[_0xeea5('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xeea5('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xeea5('0x31')},'dialBusyRetryFrequency':{'type':Sequelize[_0xeea5('0x16')](0x5)[_0xeea5('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xeea5('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xeea5('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xeea5('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xeea5('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xeea5('0x34')},'dialTimezone':{'type':Sequelize[_0xeea5('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xeea5('0x2')],'defaultValue':_0xeea5('0x35')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xeea5('0x4')]('always',_0xeea5('0x36'),_0xeea5('0x37')),'defaultValue':_0xeea5('0x38')},'dialAMDActive':{'type':Sequelize[_0xeea5('0x21')],'defaultValue':0x0,'comment':_0xeea5('0x39')},'dialAMDInitialSilence':{'type':Sequelize[_0xeea5('0x16')](0x9)[_0xeea5('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xeea5('0x3a')},'dialAMDGreeting':{'type':Sequelize[_0xeea5('0x16')](0x9)[_0xeea5('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xeea5('0x16')](0x9)[_0xeea5('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xeea5('0x3b')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xeea5('0x16')](0x9)[_0xeea5('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xeea5('0x3c')},'dialAMDMinWordLength':{'type':Sequelize[_0xeea5('0x16')](0x9)[_0xeea5('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xeea5('0x16')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xeea5('0x16')](0x9)[_0xeea5('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xeea5('0x3d')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xeea5('0x16')](0x5)[_0xeea5('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xeea5('0x16')](0x9)[_0xeea5('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xeea5('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0xeea5('0x16')](0x5)[_0xeea5('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xeea5('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0xeea5('0x21')],'defaultValue':0x0,'comment':_0xeea5('0x40')},'dialOrderByScheduledAt':{'type':Sequelize[_0xeea5('0x4')]('DESC',_0xeea5('0x41')),'defaultValue':_0xeea5('0x42')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0xeea5('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xeea5('0x21')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xeea5('0x21')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xeea5('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xeea5('0x43')},'dialCutDigit':{'type':Sequelize[_0xeea5('0x16')](0x3)[_0xeea5('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xeea5('0x44')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xeea5('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xeea5('0x45')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xeea5('0x16')](0x5)[_0xeea5('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xeea5('0x16')](0x3)[_0xeea5('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xeea5('0x46')},'dialDropRetryFrequency':{'type':Sequelize[_0xeea5('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xeea5('0x47')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xeea5('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xeea5('0x48')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xeea5('0x16')](0x5)[_0xeea5('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xeea5('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xeea5('0x49')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xeea5('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xeea5('0x4a')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xeea5('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xeea5('0x4b')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xeea5('0x16')](0x5)[_0xeea5('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xeea5('0x4c')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xeea5('0x21')],'defaultValue':![],'comment':_0xeea5('0x4d'),'set':function(_0x3358e3){if(!_0x3358e3)this[_0xeea5('0x1a')](_0xeea5('0x4e'),null);this['setDataValue'](_0xeea5('0x4f'),_0x3358e3);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xeea5('0x16')](0x3)[_0xeea5('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xeea5('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xeea5('0x16')](0x3)[_0xeea5('0x25')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 0d0165a..d29cbcc 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 _0x0a6b=['ci.item','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','CmList','NOW()','removeBlackLists','eml-format','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','reject','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','name','UserProfileResource','destroy','error','stack','send','VoiceQueue','rawAttributes','fieldName','key','query','keys','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','role','user','UserProfileSection','userProfileId','autoAssociation','clone','omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getHoppers','findOne','CmHopper','VoiceQueueId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','User','online','interface','flatMap','forEach','Agents','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','penalty','UserVoiceQueueRt','isNil','format','SIP/%s','voicePause','emit','userVoiceQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_voice_queues','join','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','every','TeamId','all','union','compact','ids','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','push','isArray','getAgents','getMembers','getLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt','ListId','ContactId','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','into','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id'];(function(_0x3c6c76,_0x43fe5e){var _0x51b821=function(_0x27e7a6){while(--_0x27e7a6){_0x3c6c76['push'](_0x3c6c76['shift']());}};_0x51b821(++_0x43fe5e);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x2c87f6,_0x525c2a){_0x2c87f6=_0x2c87f6-0x0;var _0x431a13=_0x0a6b[_0x2c87f6];return _0x431a13;};'use strict';var emlformat=require(_0xb0a6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb0a6('0x1'));var moment=require('moment');var BPromise=require(_0xb0a6('0x2'));var Mustache=require(_0xb0a6('0x3'));var util=require(_0xb0a6('0x4'));var path=require('path');var sox=require(_0xb0a6('0x5'));var csv=require('to-csv');var ejs=require(_0xb0a6('0x6'));var fs=require('fs');var fs_extra=require(_0xb0a6('0x7'));var _=require('lodash');var squel=require(_0xb0a6('0x8'));var crypto=require(_0xb0a6('0x9'));var jsforce=require(_0xb0a6('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb0a6('0xb'));var Redis=require(_0xb0a6('0xc'));var authService=require(_0xb0a6('0xd'));var qs=require(_0xb0a6('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb0a6('0xf'));var logger=require(_0xb0a6('0x10'))('api');var utils=require(_0xb0a6('0x11'));var config=require(_0xb0a6('0x12'));var licenseUtil=require(_0xb0a6('0x13'));var db=require(_0xb0a6('0x14'))['db'];config[_0xb0a6('0x15')]=_[_0xb0a6('0x16')](config[_0xb0a6('0x15')],{'host':_0xb0a6('0x17'),'port':0x18eb});var socket=require(_0xb0a6('0x18'))(new Redis(config[_0xb0a6('0x15')]));require('./voiceQueue.socket')[_0xb0a6('0x19')](socket);function respondWithStatusCode(_0x54016c,_0x397c36){_0x397c36=_0x397c36||0xcc;return function(_0x5351ed){if(_0x5351ed){return _0x54016c[_0xb0a6('0x1a')](_0x397c36);}return _0x54016c['status'](_0x397c36)[_0xb0a6('0x1b')]();};}function respondWithResult(_0x382c2f,_0x93243e){_0x93243e=_0x93243e||0xc8;return function(_0x5673ad){if(_0x5673ad){return _0x382c2f['status'](_0x93243e)[_0xb0a6('0x1c')](_0x5673ad);}};}function respondWithFilteredResult(_0x295b53,_0x59bc9c){return function(_0x18f994){if(_0x18f994){var _0x10f504=typeof _0x59bc9c[_0xb0a6('0x1d')]==='undefined'&&typeof _0x59bc9c[_0xb0a6('0x1e')]===_0xb0a6('0x1f');var _0x372457=_0x18f994[_0xb0a6('0x20')];var _0x4406d0=_0x10f504?0x0:_0x59bc9c[_0xb0a6('0x1d')];var _0x4c111f=_0x10f504?_0x18f994[_0xb0a6('0x20')]:_0x59bc9c[_0xb0a6('0x1d')]+_0x59bc9c[_0xb0a6('0x1e')];var _0x6bdcc1;if(_0x4c111f>=_0x372457){_0x4c111f=_0x372457;_0x6bdcc1=0xc8;}else{_0x6bdcc1=0xce;}_0x295b53[_0xb0a6('0x21')](_0x6bdcc1);return _0x295b53[_0xb0a6('0x22')](_0xb0a6('0x23'),_0x4406d0+'-'+_0x4c111f+'/'+_0x372457)[_0xb0a6('0x1c')](_0x18f994);}return null;};}function patchUpdates(_0x4b9a6c){return function(_0x3db6a6){try{jsonpatch['apply'](_0x3db6a6,_0x4b9a6c,!![]);}catch(_0x1322ec){return BPromise[_0xb0a6('0x24')](_0x1322ec);}return _0x3db6a6['save']();};}function saveUpdates(_0x4aa68d,_0x10d753){return function(_0x14993f){if(_0x14993f){return _0x14993f['update'](_0x4aa68d)[_0xb0a6('0x25')](function(_0x24574a){return _0x24574a;});}return null;};}function removeEntity(_0x259f47,_0x5b19c1){return function(_0x5600c5){if(_0x5600c5){return _0x5600c5['destroy']()[_0xb0a6('0x25')](function(){var _0x1e9947=_0x5600c5[_0xb0a6('0x26')]({'plain':!![]});var _0x58d923=[{'name':_0xb0a6('0x27'),'value':_0xb0a6('0x28'),'ignore':![]},{'name':_0xb0a6('0x29'),'value':_0xb0a6('0x2a'),'ignore':![]}];var _0x10cf86=_(_0x58d923)[_0xb0a6('0x2b')](_0xb0a6('0x2c'))[_0xb0a6('0x2d')](_0xb0a6('0x2e'))['value']();if(_[_0xb0a6('0x2f')](_0x10cf86,_0x1e9947[_0xb0a6('0x30')])){return;}var _0x3993bf=_['find'](_0x58d923,[_0xb0a6('0x2e'),_0x1e9947['type']])[_0xb0a6('0x31')];return db[_0xb0a6('0x32')][_0xb0a6('0x33')]({'where':{'type':_0x3993bf,'resourceId':_0x1e9947['id']}})[_0xb0a6('0x25')](function(){return _0x5600c5;});})[_0xb0a6('0x25')](function(){_0x259f47[_0xb0a6('0x21')](0xcc)[_0xb0a6('0x1b')]();});}};}function handleEntityNotFound(_0x4b5ac5,_0xa05fd0){return function(_0x150f6b){if(!_0x150f6b){_0x4b5ac5['sendStatus'](0x194);}return _0x150f6b;};}function handleError(_0x57f408,_0x4093f8){_0x4093f8=_0x4093f8||0x1f4;return function(_0x1fcbdd){logger[_0xb0a6('0x34')](_0x1fcbdd[_0xb0a6('0x35')]);if(_0x1fcbdd[_0xb0a6('0x31')]){delete _0x1fcbdd[_0xb0a6('0x31')];}_0x57f408[_0xb0a6('0x21')](_0x4093f8)[_0xb0a6('0x36')](_0x1fcbdd);};}exports['index']=function(_0x3001af,_0x16471f){var _0x572cf7={},_0x8502f8={},_0x88f3b1={'count':0x0,'rows':[]};var _0x52e397=_['map'](db[_0xb0a6('0x37')][_0xb0a6('0x38')],function(_0x472799){return{'name':_0x472799[_0xb0a6('0x39')],'type':_0x472799[_0xb0a6('0x30')][_0xb0a6('0x3a')]};});_0x8502f8['model']=_[_0xb0a6('0x2d')](_0x52e397,'name');_0x8502f8[_0xb0a6('0x3b')]=_[_0xb0a6('0x3c')](_0x3001af['query']);_0x8502f8['filters']=_['intersection'](_0x8502f8[_0xb0a6('0x3d')],_0x8502f8[_0xb0a6('0x3b')]);_0x572cf7[_0xb0a6('0x3e')]=_[_0xb0a6('0x3f')](_0x8502f8[_0xb0a6('0x3d')],qs['fields'](_0x3001af[_0xb0a6('0x3b')][_0xb0a6('0x40')]));_0x572cf7[_0xb0a6('0x3e')]=_0x572cf7[_0xb0a6('0x3e')]['length']?_0x572cf7[_0xb0a6('0x3e')]:_0x8502f8[_0xb0a6('0x3d')];if(!_0x3001af[_0xb0a6('0x3b')][_0xb0a6('0x41')](_0xb0a6('0x42'))){_0x572cf7['limit']=qs['limit'](_0x3001af[_0xb0a6('0x3b')][_0xb0a6('0x1e')]);_0x572cf7[_0xb0a6('0x1d')]=qs[_0xb0a6('0x1d')](_0x3001af[_0xb0a6('0x3b')][_0xb0a6('0x1d')]);}_0x572cf7[_0xb0a6('0x43')]=qs[_0xb0a6('0x44')](_0x3001af['query'][_0xb0a6('0x44')]);_0x572cf7[_0xb0a6('0x45')]=qs[_0xb0a6('0x46')](_[_0xb0a6('0x47')](_0x3001af[_0xb0a6('0x3b')],_0x8502f8['filters']),_0x52e397);if(_0x3001af[_0xb0a6('0x3b')]['filter']){_0x572cf7[_0xb0a6('0x45')]=_['merge'](_0x572cf7[_0xb0a6('0x45')],{'$or':_['map'](_0x52e397,function(_0x2f94d8){if(_0x2f94d8[_0xb0a6('0x30')]!==_0xb0a6('0x48')){var _0x34b193={};_0x34b193[_0x2f94d8[_0xb0a6('0x31')]]={'$like':'%'+_0x3001af[_0xb0a6('0x3b')][_0xb0a6('0x2b')]+'%'};return _0x34b193;}})});}_0x572cf7=_[_0xb0a6('0x49')]({},_0x572cf7,_0x3001af[_0xb0a6('0x4a')]);var _0x155a84={'where':_0x572cf7[_0xb0a6('0x45')]};return db[_0xb0a6('0x37')]['count'](_0x155a84)[_0xb0a6('0x25')](function(_0x42d03a){_0x88f3b1['count']=_0x42d03a;if(_0x3001af[_0xb0a6('0x3b')]['includeAll']){_0x572cf7[_0xb0a6('0x4b')]=[{'all':!![]}];}return db[_0xb0a6('0x37')][_0xb0a6('0x4c')](_0x572cf7);})['then'](function(_0x74a665){_0x88f3b1[_0xb0a6('0x4d')]=_0x74a665;return _0x88f3b1;})[_0xb0a6('0x25')](respondWithFilteredResult(_0x16471f,_0x572cf7))[_0xb0a6('0x4e')](handleError(_0x16471f,null));};exports[_0xb0a6('0x4f')]=function(_0x2cb5f6,_0x86881){var _0x410886={'raw':![],'where':{'id':_0x2cb5f6[_0xb0a6('0x50')]['id']}},_0x5a87a2={};_0x5a87a2[_0xb0a6('0x3d')]=_[_0xb0a6('0x3c')](db[_0xb0a6('0x37')]['rawAttributes']);_0x5a87a2['query']=_['keys'](_0x2cb5f6['query']);_0x5a87a2['filters']=_['intersection'](_0x5a87a2['model'],_0x5a87a2[_0xb0a6('0x3b')]);_0x410886[_0xb0a6('0x3e')]=_[_0xb0a6('0x3f')](_0x5a87a2[_0xb0a6('0x3d')],qs[_0xb0a6('0x40')](_0x2cb5f6[_0xb0a6('0x3b')][_0xb0a6('0x40')]));_0x410886[_0xb0a6('0x3e')]=_0x410886[_0xb0a6('0x3e')][_0xb0a6('0x51')]?_0x410886[_0xb0a6('0x3e')]:_0x5a87a2[_0xb0a6('0x3d')];if(_0x2cb5f6[_0xb0a6('0x3b')][_0xb0a6('0x52')]){_0x410886[_0xb0a6('0x4b')]=[{'all':!![]}];}_0x410886=_[_0xb0a6('0x49')]({},_0x410886,_0x2cb5f6['options']);return db[_0xb0a6('0x37')][_0xb0a6('0x53')](_0x410886)[_0xb0a6('0x25')](handleEntityNotFound(_0x86881,null))[_0xb0a6('0x25')](respondWithResult(_0x86881,null))[_0xb0a6('0x4e')](handleError(_0x86881,null));};exports[_0xb0a6('0x54')]=function(_0x269614,_0x1812c8){return db[_0xb0a6('0x37')]['create'](_0x269614['body'],{})[_0xb0a6('0x25')](function(_0x29cda9){var _0x429b7c=_0x269614['user'][_0xb0a6('0x26')]({'plain':!![]});if(!_0x429b7c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x429b7c[_0xb0a6('0x55')]===_0xb0a6('0x56')){var _0x4a157e=_0x29cda9[_0xb0a6('0x26')]({'plain':!![]});var _0x380b26=[{'name':'VoiceQueues','value':_0xb0a6('0x28')},{'name':'QueueCampaigns','value':_0xb0a6('0x2a')}];var _0x4e11fb=_[_0xb0a6('0x53')](_0x380b26,[_0xb0a6('0x2e'),_0x4a157e['type']])[_0xb0a6('0x31')];return db[_0xb0a6('0x57')][_0xb0a6('0x53')]({'where':{'name':_0x4e11fb,'userProfileId':_0x429b7c[_0xb0a6('0x58')]},'raw':!![]})[_0xb0a6('0x25')](function(_0x59016a){if(_0x59016a&&_0x59016a[_0xb0a6('0x59')]===0x0){return db['UserProfileResource'][_0xb0a6('0x54')]({'name':_0x4a157e['name'],'resourceId':_0x4a157e['id'],'type':_0x59016a['name'],'sectionId':_0x59016a['id']},{})[_0xb0a6('0x25')](function(){return _0x29cda9;});}else{return _0x29cda9;}})[_0xb0a6('0x4e')](function(_0x5da439){logger[_0xb0a6('0x34')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5da439);throw _0x5da439;});}return _0x29cda9;})[_0xb0a6('0x25')](respondWithResult(_0x1812c8,0xc9))[_0xb0a6('0x4e')](handleError(_0x1812c8,null));};exports[_0xb0a6('0x5a')]=function(_0x229666,_0x59fb5a){var _0x384d9f={'where':{'id':_0x229666[_0xb0a6('0x50')]['id']}},_0x299545={};_0x299545[_0xb0a6('0x3d')]=_[_0xb0a6('0x3c')](db[_0xb0a6('0x37')]['rawAttributes']);_0x384d9f['attributes']=_[_0xb0a6('0x3f')](_0x299545['model'],qs[_0xb0a6('0x40')](_0x229666[_0xb0a6('0x3b')][_0xb0a6('0x40')]));_0x384d9f['attributes']=_0x384d9f[_0xb0a6('0x3e')][_0xb0a6('0x51')]?_0x384d9f['attributes']:_0x299545[_0xb0a6('0x3d')];if(_0x229666[_0xb0a6('0x3b')][_0xb0a6('0x52')]){_0x384d9f[_0xb0a6('0x4b')]=[{'all':!![]}];}_0x384d9f=_[_0xb0a6('0x49')]({},_0x384d9f,_0x229666['options']);return db[_0xb0a6('0x37')][_0xb0a6('0x53')](_0x384d9f)['then'](handleEntityNotFound(_0x59fb5a,null))[_0xb0a6('0x25')](function(_0x3f197a){if(_0x3f197a){var _0x13a9ca=_0x3f197a[_0xb0a6('0x26')]({'plain':!![]});_0x13a9ca=qs[_0xb0a6('0x5b')](_0x13a9ca,['id',_0xb0a6('0x5c'),_0xb0a6('0x5d')]);_0x229666[_0xb0a6('0x5e')]=_[_0xb0a6('0x5b')](_0x229666[_0xb0a6('0x5e')],['id',_0xb0a6('0x5c'),_0xb0a6('0x5d')]);return db['VoiceQueue'][_0xb0a6('0x54')](_['merge'](_0x13a9ca,_0x229666[_0xb0a6('0x5e')]),{'include':_0x229666[_0xb0a6('0x3b')][_0xb0a6('0x52')]?[{'all':!![]}]:undefined})[_0xb0a6('0x25')](function(_0x49ea98){var _0x22521a=_0x229666[_0xb0a6('0x56')][_0xb0a6('0x26')]({'plain':!![]});if(!_0x22521a)throw new Error(_0xb0a6('0x5f'));if(_0x22521a[_0xb0a6('0x55')]===_0xb0a6('0x56')){var _0x35dd17=_0x49ea98[_0xb0a6('0x26')]({'plain':!![]});var _0x3a6c4c=[{'name':_0xb0a6('0x27'),'value':_0xb0a6('0x28')},{'name':_0xb0a6('0x29'),'value':_0xb0a6('0x2a')}];var _0x2f1b5a=_[_0xb0a6('0x53')](_0x3a6c4c,[_0xb0a6('0x2e'),_0x35dd17[_0xb0a6('0x30')]])[_0xb0a6('0x31')];return db['UserProfileSection'][_0xb0a6('0x53')]({'where':{'name':_0x2f1b5a,'userProfileId':_0x22521a[_0xb0a6('0x58')]},'raw':!![]})[_0xb0a6('0x25')](function(_0x35e3fb){if(_0x35e3fb&&_0x35e3fb[_0xb0a6('0x59')]===0x0){return db[_0xb0a6('0x32')]['create']({'name':_0x35dd17['name'],'resourceId':_0x35dd17['id'],'type':_0x35e3fb[_0xb0a6('0x31')],'sectionId':_0x35e3fb['id']},{})[_0xb0a6('0x25')](function(){return _0x49ea98;});}else{return _0x49ea98;}})[_0xb0a6('0x4e')](function(_0x2f2b44){logger['error'](_0xb0a6('0x60'),_0x2f2b44);throw _0x2f2b44;});}return _0x49ea98;});}})[_0xb0a6('0x25')](respondWithResult(_0x59fb5a,0xc9))[_0xb0a6('0x4e')](handleError(_0x59fb5a,null));};exports[_0xb0a6('0x61')]=function(_0x3143de,_0x265a02){if(_0x3143de[_0xb0a6('0x5e')]['id']){delete _0x3143de['body']['id'];}return db[_0xb0a6('0x37')][_0xb0a6('0x53')]({'where':{'id':_0x3143de['params']['id']}})['then'](handleEntityNotFound(_0x265a02,null))[_0xb0a6('0x25')](saveUpdates(_0x3143de['body'],null))[_0xb0a6('0x25')](respondWithResult(_0x265a02,null))[_0xb0a6('0x4e')](handleError(_0x265a02,null));};exports[_0xb0a6('0x33')]=function(_0x438a8b,_0x575b2c){return db[_0xb0a6('0x37')]['find']({'where':{'id':_0x438a8b[_0xb0a6('0x50')]['id']}})[_0xb0a6('0x25')](handleEntityNotFound(_0x575b2c,null))['then'](removeEntity(_0x575b2c,null))['catch'](handleError(_0x575b2c,null));};exports[_0xb0a6('0x62')]=function(_0x247cb9,_0x24acde,_0x59827b){var _0x57ce94={'raw':![],'where':{}};var _0x567fd9={};var _0x907f16={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xb0a6('0x63')]({'where':{'id':_0x247cb9[_0xb0a6('0x50')]['id']}})[_0xb0a6('0x25')](handleEntityNotFound(_0x24acde,null))['then'](function(_0x19b519){if(_0x19b519){_0x567fd9[_0xb0a6('0x3d')]=_[_0xb0a6('0x3c')](db[_0xb0a6('0x64')][_0xb0a6('0x38')]);_0x567fd9[_0xb0a6('0x3b')]=_[_0xb0a6('0x3c')](_0x247cb9['query']);_0x567fd9['filters']=_[_0xb0a6('0x3f')](_0x567fd9[_0xb0a6('0x3d')],_0x567fd9[_0xb0a6('0x3b')]);_0x57ce94[_0xb0a6('0x3e')]=_['intersection'](_0x567fd9['model'],qs[_0xb0a6('0x40')](_0x247cb9[_0xb0a6('0x3b')][_0xb0a6('0x40')]));_0x57ce94[_0xb0a6('0x3e')]=_0x57ce94[_0xb0a6('0x3e')]['length']?_0x57ce94[_0xb0a6('0x3e')]:_0x567fd9[_0xb0a6('0x3d')];if(!_0x247cb9['query'][_0xb0a6('0x41')](_0xb0a6('0x42'))){_0x57ce94[_0xb0a6('0x1e')]=qs[_0xb0a6('0x1e')](_0x247cb9[_0xb0a6('0x3b')][_0xb0a6('0x1e')]);_0x57ce94['offset']=qs[_0xb0a6('0x1d')](_0x247cb9[_0xb0a6('0x3b')][_0xb0a6('0x1d')]);}_0x57ce94[_0xb0a6('0x43')]=qs[_0xb0a6('0x44')](_0x247cb9['query']['sort']);_0x57ce94[_0xb0a6('0x45')]=qs['filters'](_[_0xb0a6('0x47')](_0x247cb9['query'],_0x567fd9[_0xb0a6('0x46')]));_0x57ce94['where'][_0xb0a6('0x65')]=_0x19b519['id'];if(_0x247cb9[_0xb0a6('0x3b')][_0xb0a6('0x2b')]){_0x57ce94[_0xb0a6('0x45')]=_[_0xb0a6('0x49')](_0x57ce94[_0xb0a6('0x45')],{'$or':_[_0xb0a6('0x2d')](_0x57ce94[_0xb0a6('0x3e')],function(_0x5281bf){var _0x5524ae={};_0x5524ae[_0x5281bf]={'$like':'%'+_0x247cb9['query']['filter']+'%'};return _0x5524ae;})});}_0x57ce94=_['merge']({},_0x57ce94,_0x247cb9[_0xb0a6('0x4a')]);return db[_0xb0a6('0x64')][_0xb0a6('0x20')]({'where':_0x57ce94[_0xb0a6('0x45')]})['then'](function(_0x2fcf51){_0x907f16[_0xb0a6('0x20')]=_0x2fcf51;if(_0x247cb9[_0xb0a6('0x3b')][_0xb0a6('0x52')]){_0x57ce94[_0xb0a6('0x4b')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x57ce94);})[_0xb0a6('0x25')](function(_0x33fd7e){_0x907f16[_0xb0a6('0x4d')]=_0x33fd7e;return _0x907f16;});}})[_0xb0a6('0x25')](respondWithFilteredResult(_0x24acde,_0x57ce94))[_0xb0a6('0x4e')](handleError(_0x24acde,null));};exports[_0xb0a6('0x66')]=function(_0x5d61ac,_0x5817ac,_0x482c07){var _0x292189={'raw':!![],'where':{}};var _0x40cd4d={};var _0x39149a={'count':0x0,'rows':[]};return db[_0xb0a6('0x37')][_0xb0a6('0x63')]({'where':{'id':_0x5d61ac[_0xb0a6('0x50')]['id']}})[_0xb0a6('0x25')](handleEntityNotFound(_0x5817ac,null))['then'](function(_0x1bd0ec){if(_0x1bd0ec){_0x40cd4d[_0xb0a6('0x3d')]=_[_0xb0a6('0x3c')](db[_0xb0a6('0x67')][_0xb0a6('0x38')]);_0x40cd4d[_0xb0a6('0x3b')]=_['keys'](_0x5d61ac[_0xb0a6('0x3b')]);_0x40cd4d[_0xb0a6('0x46')]=_[_0xb0a6('0x3f')](_0x40cd4d[_0xb0a6('0x3d')],_0x40cd4d[_0xb0a6('0x3b')]);_0x292189[_0xb0a6('0x3e')]=_[_0xb0a6('0x3f')](_0x40cd4d['model'],qs[_0xb0a6('0x40')](_0x5d61ac['query'][_0xb0a6('0x40')]));_0x292189['attributes']=_0x292189[_0xb0a6('0x3e')][_0xb0a6('0x51')]?_0x292189[_0xb0a6('0x3e')]:_0x40cd4d[_0xb0a6('0x3d')];if(!_0x5d61ac[_0xb0a6('0x3b')][_0xb0a6('0x41')](_0xb0a6('0x42'))){_0x292189[_0xb0a6('0x1e')]=qs['limit'](_0x5d61ac[_0xb0a6('0x3b')][_0xb0a6('0x1e')]);_0x292189['offset']=qs[_0xb0a6('0x1d')](_0x5d61ac[_0xb0a6('0x3b')]['offset']);}_0x292189['order']=qs[_0xb0a6('0x44')](_0x5d61ac['query'][_0xb0a6('0x44')]);_0x292189[_0xb0a6('0x45')]=qs[_0xb0a6('0x46')](_[_0xb0a6('0x47')](_0x5d61ac[_0xb0a6('0x3b')],_0x40cd4d[_0xb0a6('0x46')]));_0x292189['where'][_0xb0a6('0x65')]=_0x1bd0ec['id'];if(_0x5d61ac[_0xb0a6('0x3b')]['filter']){_0x292189['where']=_[_0xb0a6('0x49')](_0x292189[_0xb0a6('0x45')],{'$or':_[_0xb0a6('0x2d')](_0x292189[_0xb0a6('0x3e')],function(_0x281665){var _0x3322d9={};_0x3322d9[_0x281665]={'$like':'%'+_0x5d61ac['query'][_0xb0a6('0x2b')]+'%'};return _0x3322d9;})});}_0x292189=_['merge']({},_0x292189,_0x5d61ac[_0xb0a6('0x4a')]);return db[_0xb0a6('0x67')][_0xb0a6('0x20')]({'where':_0x292189['where']})['then'](function(_0x586d32){_0x39149a[_0xb0a6('0x20')]=_0x586d32;if(_0x5d61ac[_0xb0a6('0x3b')][_0xb0a6('0x52')]){_0x292189[_0xb0a6('0x4b')]=[{'all':!![]}];}return db[_0xb0a6('0x67')][_0xb0a6('0x4c')](_0x292189);})[_0xb0a6('0x25')](function(_0x102f30){_0x39149a[_0xb0a6('0x4d')]=_0x102f30;return _0x39149a;});}})[_0xb0a6('0x25')](respondWithFilteredResult(_0x5817ac,_0x292189))[_0xb0a6('0x4e')](handleError(_0x5817ac,null));};exports[_0xb0a6('0x68')]=function(_0x12892b,_0x2c5d71,_0x4e4638){var _0x268cda={'raw':!![],'where':{}};var _0x49e431={};var _0x29bebb={'count':0x0,'rows':[]};return db[_0xb0a6('0x37')]['findOne']({'where':{'id':_0x12892b[_0xb0a6('0x50')]['id']}})[_0xb0a6('0x25')](handleEntityNotFound(_0x2c5d71,null))[_0xb0a6('0x25')](function(_0x26a9d2){if(_0x26a9d2){_0x49e431[_0xb0a6('0x3d')]=_[_0xb0a6('0x3c')](db[_0xb0a6('0x69')]['rawAttributes']);_0x49e431['query']=_[_0xb0a6('0x3c')](_0x12892b['query']);_0x49e431[_0xb0a6('0x46')]=_[_0xb0a6('0x3f')](_0x49e431[_0xb0a6('0x3d')],_0x49e431[_0xb0a6('0x3b')]);_0x268cda[_0xb0a6('0x3e')]=_[_0xb0a6('0x3f')](_0x49e431[_0xb0a6('0x3d')],qs[_0xb0a6('0x40')](_0x12892b[_0xb0a6('0x3b')][_0xb0a6('0x40')]));_0x268cda[_0xb0a6('0x3e')]=_0x268cda[_0xb0a6('0x3e')][_0xb0a6('0x51')]?_0x268cda[_0xb0a6('0x3e')]:_0x49e431[_0xb0a6('0x3d')];if(!_0x12892b[_0xb0a6('0x3b')][_0xb0a6('0x41')](_0xb0a6('0x42'))){_0x268cda[_0xb0a6('0x1e')]=qs[_0xb0a6('0x1e')](_0x12892b[_0xb0a6('0x3b')][_0xb0a6('0x1e')]);_0x268cda[_0xb0a6('0x1d')]=qs[_0xb0a6('0x1d')](_0x12892b[_0xb0a6('0x3b')][_0xb0a6('0x1d')]);}_0x268cda[_0xb0a6('0x43')]=qs[_0xb0a6('0x44')](_0x12892b['query'][_0xb0a6('0x44')]);_0x268cda['where']=qs[_0xb0a6('0x46')](_[_0xb0a6('0x47')](_0x12892b[_0xb0a6('0x3b')],_0x49e431['filters']));_0x268cda['where']['VoiceQueueId']=_0x26a9d2['id'];if(_0x12892b[_0xb0a6('0x3b')][_0xb0a6('0x2b')]){_0x268cda[_0xb0a6('0x45')]=_[_0xb0a6('0x49')](_0x268cda[_0xb0a6('0x45')],{'$or':_[_0xb0a6('0x2d')](_0x268cda['attributes'],function(_0x1e1241){var _0x1f92c7={};_0x1f92c7[_0x1e1241]={'$like':'%'+_0x12892b[_0xb0a6('0x3b')][_0xb0a6('0x2b')]+'%'};return _0x1f92c7;})});}_0x268cda=_['merge']({},_0x268cda,_0x12892b['options']);return db[_0xb0a6('0x69')][_0xb0a6('0x20')]({'where':_0x268cda[_0xb0a6('0x45')]})['then'](function(_0x57ce79){_0x29bebb[_0xb0a6('0x20')]=_0x57ce79;if(_0x12892b[_0xb0a6('0x3b')]['includeAll']){_0x268cda['include']=[{'all':!![]}];}return db[_0xb0a6('0x69')]['findAll'](_0x268cda);})[_0xb0a6('0x25')](function(_0x11cdfe){_0x29bebb[_0xb0a6('0x4d')]=_0x11cdfe;return _0x29bebb;});}})['then'](respondWithFilteredResult(_0x2c5d71,_0x268cda))[_0xb0a6('0x4e')](handleError(_0x2c5d71,null));};exports[_0xb0a6('0x6a')]=function(_0x310fa3,_0x1eb8ac,_0x4be9ff){var _0x261c6c={'raw':!![],'where':{}};var _0x1710a6={};var _0x464bc8={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xb0a6('0x63')]({'where':{'id':_0x310fa3[_0xb0a6('0x50')]['id']}})[_0xb0a6('0x25')](handleEntityNotFound(_0x1eb8ac,null))['then'](function(_0x2ec56d){if(_0x2ec56d){_0x1710a6[_0xb0a6('0x3d')]=_['keys'](db[_0xb0a6('0x6b')]['rawAttributes']);_0x1710a6['query']=_[_0xb0a6('0x3c')](_0x310fa3['query']);_0x1710a6[_0xb0a6('0x46')]=_[_0xb0a6('0x3f')](_0x1710a6[_0xb0a6('0x3d')],_0x1710a6[_0xb0a6('0x3b')]);_0x261c6c['attributes']=_[_0xb0a6('0x3f')](_0x1710a6[_0xb0a6('0x3d')],qs[_0xb0a6('0x40')](_0x310fa3[_0xb0a6('0x3b')][_0xb0a6('0x40')]));_0x261c6c['attributes']=_0x261c6c[_0xb0a6('0x3e')][_0xb0a6('0x51')]?_0x261c6c['attributes']:_0x1710a6['model'];if(!_0x310fa3[_0xb0a6('0x3b')][_0xb0a6('0x41')](_0xb0a6('0x42'))){_0x261c6c[_0xb0a6('0x1e')]=qs['limit'](_0x310fa3[_0xb0a6('0x3b')][_0xb0a6('0x1e')]);_0x261c6c[_0xb0a6('0x1d')]=qs[_0xb0a6('0x1d')](_0x310fa3[_0xb0a6('0x3b')]['offset']);}_0x261c6c[_0xb0a6('0x43')]=qs[_0xb0a6('0x44')](_0x310fa3[_0xb0a6('0x3b')]['sort']);_0x261c6c['where']=qs[_0xb0a6('0x46')](_[_0xb0a6('0x47')](_0x310fa3[_0xb0a6('0x3b')],_0x1710a6[_0xb0a6('0x46')]));_0x261c6c[_0xb0a6('0x45')]['VoiceQueueId']=_0x2ec56d['id'];if(_0x310fa3[_0xb0a6('0x3b')]['filter']){_0x261c6c['where']=_[_0xb0a6('0x49')](_0x261c6c[_0xb0a6('0x45')],{'$or':_[_0xb0a6('0x2d')](_0x261c6c['attributes'],function(_0xca3fbc){var _0x334b2e={};_0x334b2e[_0xca3fbc]={'$like':'%'+_0x310fa3[_0xb0a6('0x3b')][_0xb0a6('0x2b')]+'%'};return _0x334b2e;})});}_0x261c6c=_[_0xb0a6('0x49')]({},_0x261c6c,_0x310fa3[_0xb0a6('0x4a')]);return db[_0xb0a6('0x6b')][_0xb0a6('0x20')]({'where':_0x261c6c[_0xb0a6('0x45')]})['then'](function(_0x4983ba){_0x464bc8[_0xb0a6('0x20')]=_0x4983ba;if(_0x310fa3[_0xb0a6('0x3b')]['includeAll']){_0x261c6c['include']=[{'all':!![]}];}return db[_0xb0a6('0x6b')]['findAll'](_0x261c6c);})[_0xb0a6('0x25')](function(_0x2da7b4){_0x464bc8[_0xb0a6('0x4d')]=_0x2da7b4;return _0x464bc8;});}})[_0xb0a6('0x25')](respondWithFilteredResult(_0x1eb8ac,_0x261c6c))[_0xb0a6('0x4e')](handleError(_0x1eb8ac,null));};exports[_0xb0a6('0x6c')]=function(_0x42f6c1,_0x656b76,_0x381da8){var _0xb6a936={};var _0x52eeb9={};var _0x249a28;var _0x263719;return db['VoiceQueue'][_0xb0a6('0x63')]({'where':{'id':_0x42f6c1[_0xb0a6('0x50')]['id']}})[_0xb0a6('0x25')](handleEntityNotFound(_0x656b76,null))['then'](function(_0xe4ef40){if(_0xe4ef40){_0x249a28=_0xe4ef40;_0x52eeb9['model']=_[_0xb0a6('0x3c')](db['Team'][_0xb0a6('0x38')]);_0x52eeb9[_0xb0a6('0x3b')]=_[_0xb0a6('0x3c')](_0x42f6c1[_0xb0a6('0x3b')]);_0x52eeb9[_0xb0a6('0x46')]=_[_0xb0a6('0x3f')](_0x52eeb9[_0xb0a6('0x3d')],_0x52eeb9['query']);_0xb6a936[_0xb0a6('0x3e')]=_[_0xb0a6('0x3f')](_0x52eeb9[_0xb0a6('0x3d')],qs[_0xb0a6('0x40')](_0x42f6c1[_0xb0a6('0x3b')]['fields']));_0xb6a936[_0xb0a6('0x3e')]=_0xb6a936['attributes'][_0xb0a6('0x51')]?_0xb6a936[_0xb0a6('0x3e')]:_0x52eeb9[_0xb0a6('0x3d')];_0xb6a936[_0xb0a6('0x43')]=qs[_0xb0a6('0x44')](_0x42f6c1[_0xb0a6('0x3b')][_0xb0a6('0x44')]);_0xb6a936[_0xb0a6('0x45')]=qs[_0xb0a6('0x46')](_[_0xb0a6('0x47')](_0x42f6c1[_0xb0a6('0x3b')],_0x52eeb9[_0xb0a6('0x46')]));if(_0x42f6c1[_0xb0a6('0x3b')][_0xb0a6('0x2b')]){_0xb6a936[_0xb0a6('0x45')]=_['merge'](_0xb6a936['where'],{'$or':_[_0xb0a6('0x2d')](_0xb6a936['attributes'],function(_0x5f4f76){var _0x57c3ab={};_0x57c3ab[_0x5f4f76]={'$like':'%'+_0x42f6c1[_0xb0a6('0x3b')]['filter']+'%'};return _0x57c3ab;})});}_0xb6a936=_[_0xb0a6('0x49')]({},_0xb6a936,_0x42f6c1[_0xb0a6('0x4a')]);return _0x249a28[_0xb0a6('0x6c')](_0xb6a936);}})['then'](function(_0x52ca93){if(_0x52ca93){_0x263719=_0x52ca93[_0xb0a6('0x51')];if(!_0x42f6c1['query'][_0xb0a6('0x41')](_0xb0a6('0x42'))){_0xb6a936[_0xb0a6('0x1e')]=qs[_0xb0a6('0x1e')](_0x42f6c1[_0xb0a6('0x3b')][_0xb0a6('0x1e')]);_0xb6a936[_0xb0a6('0x1d')]=qs[_0xb0a6('0x1d')](_0x42f6c1[_0xb0a6('0x3b')][_0xb0a6('0x1d')]);}return _0x249a28[_0xb0a6('0x6c')](_0xb6a936);}})[_0xb0a6('0x25')](function(_0x7ef690){if(_0x7ef690){return _0x7ef690?{'count':_0x263719,'rows':_0x7ef690}:null;}})[_0xb0a6('0x25')](respondWithResult(_0x656b76,null))[_0xb0a6('0x4e')](handleError(_0x656b76,null));};exports[_0xb0a6('0x6d')]=function(_0x32c7bb,_0x1d0404,_0x5a56c0){var _0x3bec09=_0x32c7bb['body'][_0xb0a6('0x6e')];var _0x4247b0=_['map'](_0x3bec09,'id');return db['Team'][_0xb0a6('0x4c')]({'where':{'id':_0x4247b0},'attributes':['id'],'include':[{'model':db[_0xb0a6('0x6f')],'as':'Agents','attributes':['id',_0xb0a6('0x31'),_0xb0a6('0x70'),'voicePause',_0xb0a6('0x71')],'raw':!![]}]})[_0xb0a6('0x25')](function(_0x197da0){if(_0x197da0){var _0x1d092d=_[_0xb0a6('0x72')](_0x197da0,function(_0x3add6b){var _0x228965=_0x3add6b['get']({'plain':!![]});_0x228965['Agents'][_0xb0a6('0x73')](function(_0x3c5e8e){_0x3c5e8e['penalty']=_[_0xb0a6('0x53')](_0x3bec09,{'id':_0x228965['id']})['penalty'];});return _0x228965[_0xb0a6('0x74')];});return db['VoiceQueue'][_0xb0a6('0x53')]({'where':{'id':_0x32c7bb[_0xb0a6('0x50')]['id']}})['then'](function(_0x169e4b){return db[_0xb0a6('0x75')][_0xb0a6('0x76')](function(_0x5231a7){return _0x169e4b[_0xb0a6('0x6d')](_0x4247b0,{'transaction':_0x5231a7})[_0xb0a6('0x25')](function(){return BPromise[_0xb0a6('0x77')](_0x3bec09,function(_0x1f77ce){return db[_0xb0a6('0x78')][_0xb0a6('0x79')]({'TeamId':_0x1f77ce['id'],'VoiceQueueId':_0x32c7bb[_0xb0a6('0x50')]['id'],'penalty':_0x1f77ce['penalty']},{'transaction':_0x5231a7});});})[_0xb0a6('0x25')](function(){return BPromise['each'](_0x1d092d,function(_0x9ea1f4){return db[_0xb0a6('0x7a')][_0xb0a6('0x7b')]({'where':{'UserId':_0x9ea1f4['id'],'VoiceQueueId':_0x32c7bb[_0xb0a6('0x50')]['id']},'defaults':{'penalty':_0x9ea1f4[_0xb0a6('0x7c')]},'transaction':_0x5231a7});});})['then'](function(){return BPromise['each'](_[_0xb0a6('0x2b')](_0x1d092d,{'online':!![]}),function(_0x3290a6){return db[_0xb0a6('0x7d')]['upsert']({'membername':_0x3290a6[_0xb0a6('0x31')],'UserId':_0x3290a6['id'],'queue_name':_0x169e4b[_0xb0a6('0x31')],'VoiceQueueId':_0x169e4b['id'],'interface':_[_0xb0a6('0x7e')](_0x3290a6[_0xb0a6('0x71')])?util[_0xb0a6('0x7f')](_0xb0a6('0x80'),_0x3290a6['name']):_0x3290a6[_0xb0a6('0x71')],'paused':_0x3290a6[_0xb0a6('0x81')]||![],'penalty':_0x3290a6[_0xb0a6('0x7c')]},{'transaction':_0x5231a7});});})[_0xb0a6('0x25')](function(){_0x1d092d['forEach'](function(_0x34fad3){socket[_0xb0a6('0x82')](_0xb0a6('0x83'),{'UserId':_0x34fad3['id'],'VoiceQueueId':_0x169e4b['id']});});});});});}})[_0xb0a6('0x25')](respondWithStatusCode(_0x1d0404,null))[_0xb0a6('0x4e')](handleError(_0x1d0404,null));};exports[_0xb0a6('0x84')]=function(_0x4283d8,_0x36ac4e,_0x465f34){return db['Team'][_0xb0a6('0x4c')]({'where':{'id':_0x4283d8[_0xb0a6('0x3b')]['ids']},'attributes':['id'],'include':[{'model':db[_0xb0a6('0x6f')],'as':_0xb0a6('0x74'),'attributes':['id'],'raw':!![]}]})[_0xb0a6('0x25')](handleEntityNotFound(_0x36ac4e,null))[_0xb0a6('0x25')](function(_0x309a7b){var _0x2b2abd=_['map'](_0x309a7b,'id');var _0x514b49=[];var _0x1cda2c=[];var _0xab2fdd=squel[_0xb0a6('0x85')]();_0xab2fdd[_0xb0a6('0x86')](_0xb0a6('0x87'))[_0xb0a6('0x88')](_0xb0a6('0x89'),'tq')[_0xb0a6('0x8a')]('user_has_teams','ut',_0xb0a6('0x8b'))['where'](_0xb0a6('0x8c'),_0x4283d8[_0xb0a6('0x50')]['id']);for(var _0x125ea0=0x0;_0x125ea0<_0x309a7b[_0xb0a6('0x51')];_0x125ea0+=0x1){let _0x4b4f64=_0x309a7b[_0x125ea0];for(var _0x155ea5=0x0;_0x155ea5<_0x4b4f64['Agents'][_0xb0a6('0x51')];_0x155ea5+=0x1){let _0x294761=_0x4b4f64[_0xb0a6('0x74')][_0x155ea5];var _0x16f9f6=_0xab2fdd[_0xb0a6('0x5a')]();_0x16f9f6['where'](_0xb0a6('0x8d'),_0x294761['id']);_0x1cda2c['push'](db[_0xb0a6('0x75')][_0xb0a6('0x3b')](_0x16f9f6[_0xb0a6('0x8e')](),{'type':db[_0xb0a6('0x75')]['QueryTypes']['SELECT']})[_0xb0a6('0x25')](function(_0x2f1795){if(_0x2f1795[_0xb0a6('0x51')]===0x1){return _0x294761['id'];}else{var _0x4e30c3=_[_0xb0a6('0x8f')](_['map'](_0x2f1795,_0xb0a6('0x90')),function(_0x28e82d){return _[_0xb0a6('0x2f')](_0x2b2abd,_0x28e82d);});if(_0x4e30c3){return _0x294761['id'];}}}));}}return BPromise[_0xb0a6('0x91')](_0x1cda2c)['then'](function(_0x1594c6){_0x514b49=_(_0x514b49)[_0xb0a6('0x92')](_0x1594c6)[_0xb0a6('0x93')]()[_0xb0a6('0x2e')]();return db[_0xb0a6('0x37')][_0xb0a6('0x53')]({'where':{'id':_0x4283d8['params']['id']}})[_0xb0a6('0x25')](function(_0x5db32f){return db[_0xb0a6('0x75')][_0xb0a6('0x76')](function(_0x2befab){return _0x5db32f['removeTeams'](_0x4283d8[_0xb0a6('0x3b')][_0xb0a6('0x94')],{'transaction':_0x2befab})[_0xb0a6('0x25')](function(){if(!_[_0xb0a6('0x95')](_0x514b49)){return _0x5db32f[_0xb0a6('0x96')](_0x514b49,{'transaction':_0x2befab})[_0xb0a6('0x25')](function(){return db[_0xb0a6('0x7d')][_0xb0a6('0x33')]({'where':{'VoiceQueueId':_0x4283d8[_0xb0a6('0x50')]['id'],'UserId':_0x514b49},'transaction':_0x2befab});});}})[_0xb0a6('0x25')](function(){_0x514b49[_0xb0a6('0x73')](function(_0x286405){socket[_0xb0a6('0x82')](_0xb0a6('0x97'),{'UserId':_0x286405,'VoiceQueueId':_0x5db32f['id']});});});});});});})[_0xb0a6('0x25')](respondWithStatusCode(_0x36ac4e,null))[_0xb0a6('0x4e')](handleError(_0x36ac4e,null));};exports[_0xb0a6('0x98')]=function(_0x137212,_0x33679b,_0x3f427d){var _0x28701c,_0x40c162;return db['VoiceQueue']['find']({'where':{'id':_0x137212[_0xb0a6('0x50')]['id']}})['then'](handleEntityNotFound(_0x33679b,null))['then'](function(_0x54a74d){if(_0x54a74d){_0x40c162=_0x54a74d;return _0x54a74d[_0xb0a6('0x98')](_0x137212['body'][_0xb0a6('0x94')],_[_0xb0a6('0x5b')](_0x137212[_0xb0a6('0x5e')],['ids','id'])||{})[_0xb0a6('0x99')](function(_0x2a8992){for(var _0x4cefc8=0x0;_0x4cefc8<_0x137212[_0xb0a6('0x5e')]['ids'][_0xb0a6('0x51')];_0x4cefc8+=0x1){socket[_0xb0a6('0x82')]('userVoiceQueue:save',{'UserId':Number(_0x137212['body'][_0xb0a6('0x94')][_0x4cefc8]),'VoiceQueueId':Number(_0x137212[_0xb0a6('0x50')]['id'])});}return _0x2a8992;});}})[_0xb0a6('0x25')](function(_0x1c5f17){_0x28701c=_0x1c5f17||[];if(_0x40c162){return db[_0xb0a6('0x6f')][_0xb0a6('0x4c')]({'where':{'id':_0x137212['body'][_0xb0a6('0x94')]},'attributes':['id',_0xb0a6('0x31'),'online',_0xb0a6('0x81'),_0xb0a6('0x71')],'raw':!![]});}})['then'](function(_0x4a4504){if(!_[_0xb0a6('0x95')](_0x4a4504)){var _0x1da461=[];for(var _0x39a995=0x0;_0x39a995<_0x4a4504['length'];_0x39a995++){if(_0x4a4504[_0x39a995]['online']){_0x1da461[_0xb0a6('0x9a')](db['UserVoiceQueueRt']['upsert']({'membername':_0x4a4504[_0x39a995][_0xb0a6('0x31')],'UserId':_0x4a4504[_0x39a995]['id'],'queue_name':_0x40c162['name'],'VoiceQueueId':_0x40c162['id'],'interface':_[_0xb0a6('0x7e')](_0x4a4504[_0x39a995][_0xb0a6('0x71')])?util[_0xb0a6('0x7f')]('SIP/%s',_0x4a4504[_0x39a995][_0xb0a6('0x31')]):_0x4a4504[_0x39a995][_0xb0a6('0x71')],'paused':_0x4a4504[_0x39a995][_0xb0a6('0x81')]||![],'penalty':_0x137212['body'][_0xb0a6('0x7c')]||0x0}));}}return BPromise[_0xb0a6('0x91')](_0x1da461);}})[_0xb0a6('0x25')](function(){return _0x28701c;})[_0xb0a6('0x25')](respondWithResult(_0x33679b,null))['catch'](handleError(_0x33679b,null));};exports[_0xb0a6('0x96')]=function(_0xd14e8a,_0x556584,_0x118e75){return db['VoiceQueue'][_0xb0a6('0x53')]({'where':{'id':_0xd14e8a[_0xb0a6('0x50')]['id']}})[_0xb0a6('0x25')](handleEntityNotFound(_0x556584,null))[_0xb0a6('0x25')](function(_0x223b86){if(_0x223b86){return _0x223b86[_0xb0a6('0x96')](_0xd14e8a[_0xb0a6('0x3b')]['ids'])[_0xb0a6('0x25')](function(){if(_[_0xb0a6('0x9b')](_0xd14e8a[_0xb0a6('0x3b')]['ids'])){for(var _0xa076f9=0x0;_0xa076f9<_0xd14e8a['query'][_0xb0a6('0x94')][_0xb0a6('0x51')];_0xa076f9+=0x1){socket[_0xb0a6('0x82')]('userVoiceQueue:remove',{'UserId':Number(_0xd14e8a[_0xb0a6('0x3b')][_0xb0a6('0x94')][_0xa076f9]),'VoiceQueueId':Number(_0xd14e8a[_0xb0a6('0x50')]['id'])});}}else{socket[_0xb0a6('0x82')]('userVoiceQueue:remove',{'UserId':Number(_0xd14e8a[_0xb0a6('0x3b')][_0xb0a6('0x94')]),'VoiceQueueId':Number(_0xd14e8a['params']['id'])});}});}})[_0xb0a6('0x25')](function(_0x470848){return db[_0xb0a6('0x7d')]['destroy']({'where':{'VoiceQueueId':_0xd14e8a[_0xb0a6('0x50')]['id'],'UserId':_0xd14e8a['query'][_0xb0a6('0x94')]}})['then'](function(){return _0x470848;});})[_0xb0a6('0x25')](respondWithStatusCode(_0x556584,null))[_0xb0a6('0x4e')](handleError(_0x556584,null));};exports['getAgents']=function(_0x3a6b2c,_0x2d6099,_0x4119a0){var _0x99cdb={};var _0x4333f6={};var _0x462737;var _0x4e0bc6;return db[_0xb0a6('0x37')]['findOne']({'where':{'id':_0x3a6b2c[_0xb0a6('0x50')]['id']}})[_0xb0a6('0x25')](handleEntityNotFound(_0x2d6099,null))[_0xb0a6('0x25')](function(_0x45b479){if(_0x45b479){_0x462737=_0x45b479;_0x4333f6[_0xb0a6('0x3d')]=_[_0xb0a6('0x3c')](db[_0xb0a6('0x6f')][_0xb0a6('0x38')]);_0x4333f6['query']=_[_0xb0a6('0x3c')](_0x3a6b2c['query']);_0x4333f6[_0xb0a6('0x46')]=_[_0xb0a6('0x3f')](_0x4333f6['model'],_0x4333f6[_0xb0a6('0x3b')]);_0x99cdb[_0xb0a6('0x3e')]=_[_0xb0a6('0x3f')](_0x4333f6[_0xb0a6('0x3d')],qs[_0xb0a6('0x40')](_0x3a6b2c[_0xb0a6('0x3b')][_0xb0a6('0x40')]));_0x99cdb[_0xb0a6('0x3e')]=_0x99cdb[_0xb0a6('0x3e')]['length']?_0x99cdb[_0xb0a6('0x3e')]:_0x4333f6[_0xb0a6('0x3d')];_0x99cdb[_0xb0a6('0x43')]=qs[_0xb0a6('0x44')](_0x3a6b2c[_0xb0a6('0x3b')][_0xb0a6('0x44')]);_0x99cdb[_0xb0a6('0x45')]=qs[_0xb0a6('0x46')](_[_0xb0a6('0x47')](_0x3a6b2c[_0xb0a6('0x3b')],_0x4333f6[_0xb0a6('0x46')]));if(_0x3a6b2c['query'][_0xb0a6('0x2b')]){_0x99cdb['where']=_[_0xb0a6('0x49')](_0x99cdb[_0xb0a6('0x45')],{'$or':_[_0xb0a6('0x2d')](_0x99cdb[_0xb0a6('0x3e')],function(_0x4a80d3){var _0x5796bb={};_0x5796bb[_0x4a80d3]={'$like':'%'+_0x3a6b2c[_0xb0a6('0x3b')][_0xb0a6('0x2b')]+'%'};return _0x5796bb;})});}_0x99cdb=_[_0xb0a6('0x49')]({},_0x99cdb,_0x3a6b2c[_0xb0a6('0x4a')]);return _0x462737[_0xb0a6('0x9c')](_0x99cdb);}})[_0xb0a6('0x25')](function(_0x432e61){if(_0x432e61){_0x4e0bc6=_0x432e61[_0xb0a6('0x51')];if(!_0x3a6b2c['query'][_0xb0a6('0x41')]('nolimit')){_0x99cdb[_0xb0a6('0x1e')]=qs['limit'](_0x3a6b2c[_0xb0a6('0x3b')][_0xb0a6('0x1e')]);_0x99cdb[_0xb0a6('0x1d')]=qs['offset'](_0x3a6b2c[_0xb0a6('0x3b')][_0xb0a6('0x1d')]);}return _0x462737[_0xb0a6('0x9c')](_0x99cdb);}})[_0xb0a6('0x25')](function(_0x196627){if(_0x196627){return _0x196627?{'count':_0x4e0bc6,'rows':_0x196627}:null;}})[_0xb0a6('0x25')](respondWithResult(_0x2d6099,null))[_0xb0a6('0x4e')](handleError(_0x2d6099,null));};exports['getMembers']=function(_0x2fdf9c,_0x4b11da,_0x440e8d){var _0x596957={};var _0x3fabfa={};var _0x56242f;var _0x5ad6a8;return db[_0xb0a6('0x37')]['findOne']({'where':{'id':_0x2fdf9c['params']['id']}})[_0xb0a6('0x25')](handleEntityNotFound(_0x4b11da,null))['then'](function(_0x3eb842){if(_0x3eb842){_0x56242f=_0x3eb842;_0x3fabfa[_0xb0a6('0x3d')]=_[_0xb0a6('0x3c')](db[_0xb0a6('0x7d')][_0xb0a6('0x38')]);_0x3fabfa['query']=_[_0xb0a6('0x3c')](_0x2fdf9c[_0xb0a6('0x3b')]);_0x3fabfa[_0xb0a6('0x46')]=_[_0xb0a6('0x3f')](_0x3fabfa[_0xb0a6('0x3d')],_0x3fabfa['query']);_0x596957['attributes']=_[_0xb0a6('0x3f')](_0x3fabfa[_0xb0a6('0x3d')],qs[_0xb0a6('0x40')](_0x2fdf9c[_0xb0a6('0x3b')][_0xb0a6('0x40')]));_0x596957['attributes']=_0x596957[_0xb0a6('0x3e')][_0xb0a6('0x51')]?_0x596957[_0xb0a6('0x3e')]:_0x3fabfa[_0xb0a6('0x3d')];_0x596957[_0xb0a6('0x43')]=qs[_0xb0a6('0x44')](_0x2fdf9c[_0xb0a6('0x3b')][_0xb0a6('0x44')]);_0x596957[_0xb0a6('0x45')]=qs['filters'](_['pick'](_0x2fdf9c[_0xb0a6('0x3b')],_0x3fabfa['filters']));if(_0x2fdf9c['query']['filter']){_0x596957[_0xb0a6('0x45')]=_['merge'](_0x596957['where'],{'$or':_[_0xb0a6('0x2d')](_0x596957['attributes'],function(_0x3890ba){var _0x62706a={};_0x62706a[_0x3890ba]={'$like':'%'+_0x2fdf9c[_0xb0a6('0x3b')][_0xb0a6('0x2b')]+'%'};return _0x62706a;})});}_0x596957=_[_0xb0a6('0x49')]({},_0x596957,_0x2fdf9c[_0xb0a6('0x4a')]);return _0x56242f[_0xb0a6('0x9d')](_0x596957);}})['then'](function(_0x2f0f84){if(_0x2f0f84){_0x5ad6a8=_0x2f0f84['length'];if(!_0x2fdf9c['query'][_0xb0a6('0x41')]('nolimit')){_0x596957[_0xb0a6('0x1e')]=qs[_0xb0a6('0x1e')](_0x2fdf9c['query'][_0xb0a6('0x1e')]);_0x596957[_0xb0a6('0x1d')]=qs[_0xb0a6('0x1d')](_0x2fdf9c['query'][_0xb0a6('0x1d')]);}return _0x56242f[_0xb0a6('0x9d')](_0x596957);}})[_0xb0a6('0x25')](function(_0x58474b){return _0x58474b?{'count':_0x5ad6a8,'rows':_0x58474b}:null;})[_0xb0a6('0x25')](respondWithResult(_0x4b11da,null))[_0xb0a6('0x4e')](handleError(_0x4b11da,null));};exports['getLists']=function(_0x271352,_0x15936d,_0x828a3d){var _0x280785={};var _0x313ef2={};var _0x59661a;var _0x439324;return db[_0xb0a6('0x37')]['findOne']({'where':{'id':_0x271352[_0xb0a6('0x50')]['id']}})[_0xb0a6('0x25')](handleEntityNotFound(_0x15936d,null))[_0xb0a6('0x25')](function(_0x1f8f7a){if(_0x1f8f7a){_0x59661a=_0x1f8f7a;_0x313ef2[_0xb0a6('0x3d')]=_[_0xb0a6('0x3c')](db['CmList']['rawAttributes']);_0x313ef2[_0xb0a6('0x3b')]=_['keys'](_0x271352[_0xb0a6('0x3b')]);_0x313ef2[_0xb0a6('0x46')]=_['intersection'](_0x313ef2[_0xb0a6('0x3d')],_0x313ef2[_0xb0a6('0x3b')]);_0x280785[_0xb0a6('0x3e')]=_[_0xb0a6('0x3f')](_0x313ef2['model'],qs[_0xb0a6('0x40')](_0x271352[_0xb0a6('0x3b')][_0xb0a6('0x40')]));_0x280785[_0xb0a6('0x3e')]=_0x280785[_0xb0a6('0x3e')][_0xb0a6('0x51')]?_0x280785[_0xb0a6('0x3e')]:_0x313ef2[_0xb0a6('0x3d')];_0x280785[_0xb0a6('0x43')]=qs['sort'](_0x271352[_0xb0a6('0x3b')]['sort']);_0x280785['where']=qs['filters'](_[_0xb0a6('0x47')](_0x271352[_0xb0a6('0x3b')],_0x313ef2['filters']));if(_0x271352['query'][_0xb0a6('0x2b')]){_0x280785[_0xb0a6('0x45')]=_[_0xb0a6('0x49')](_0x280785['where'],{'$or':_[_0xb0a6('0x2d')](_0x280785['attributes'],function(_0x136d83){var _0x340456={};_0x340456[_0x136d83]={'$like':'%'+_0x271352[_0xb0a6('0x3b')][_0xb0a6('0x2b')]+'%'};return _0x340456;})});}_0x280785=_[_0xb0a6('0x49')]({},_0x280785,_0x271352[_0xb0a6('0x4a')]);return _0x59661a[_0xb0a6('0x9e')](_0x280785);}})[_0xb0a6('0x25')](function(_0x409c47){if(_0x409c47){_0x439324=_0x409c47[_0xb0a6('0x51')];if(!_0x271352[_0xb0a6('0x3b')][_0xb0a6('0x41')](_0xb0a6('0x42'))){_0x280785[_0xb0a6('0x1e')]=qs[_0xb0a6('0x1e')](_0x271352['query'][_0xb0a6('0x1e')]);_0x280785[_0xb0a6('0x1d')]=qs[_0xb0a6('0x1d')](_0x271352[_0xb0a6('0x3b')][_0xb0a6('0x1d')]);}return _0x59661a[_0xb0a6('0x9e')](_0x280785);}})['then'](function(_0x43ab1b){if(_0x43ab1b){return _0x43ab1b?{'count':_0x439324,'rows':_0x43ab1b}:null;}})['then'](respondWithResult(_0x15936d,null))['catch'](handleError(_0x15936d,null));};exports['addLists']=function(_0x4e6832,_0x2f9e50,_0xd73b91){var _0x19bc15=moment()[_0xb0a6('0x7f')](_0xb0a6('0x9f'));var _0x1007c2,_0x5e0d9e;return db[_0xb0a6('0x37')][_0xb0a6('0x53')]({'where':{'id':_0x4e6832[_0xb0a6('0x50')]['id']}})[_0xb0a6('0x25')](handleEntityNotFound(_0x2f9e50,null))[_0xb0a6('0x25')](function(_0x1425c0){if(_0x1425c0){_0x5e0d9e=_0x1425c0;return _0x1425c0['addLists'](_0x4e6832[_0xb0a6('0x5e')][_0xb0a6('0x94')],_[_0xb0a6('0x5b')](_0x4e6832[_0xb0a6('0x5e')],[_0xb0a6('0x94'),'id'])||{});}return null;})['spread'](function(_0x2b1457){var _0x5b582c;_0x1007c2=_0x2b1457||[];var _0x33d77c=[];if(_0x2b1457){for(var _0x1361b0=0x0;_0x1361b0<_0x2b1457[_0xb0a6('0x51')];_0x1361b0+=0x1){var _0x1139d0=_0x2b1457[_0x1361b0]['get']({'plain':!![]});_0x5e0d9e[_0xb0a6('0xa0')]=_0x4e6832[_0xb0a6('0x5e')][_0xb0a6('0xa0')]?_0x4e6832[_0xb0a6('0x5e')]['dialCheckDuplicateType']:_0x5e0d9e[_0xb0a6('0xa0')];switch(_0x5e0d9e[_0xb0a6('0xa0')]){case _0xb0a6('0xa1'):_0x5b582c=squel[_0xb0a6('0xa2')]()['into'](_0xb0a6('0xa3'))[_0xb0a6('0xa4')]([_0xb0a6('0xa5'),_0xb0a6('0xa6'),'ContactId',_0xb0a6('0xa7'),'VoiceQueueId',_0xb0a6('0x5c'),_0xb0a6('0x5d')],squel[_0xb0a6('0x85')]()[_0xb0a6('0x86')]('phone',_0xb0a6('0xa5'))[_0xb0a6('0x86')]('\x27'+_0x19bc15+'\x27',_0xb0a6('0xa6'))['field']('id',_0xb0a6('0xa8'))['field'](_0x1139d0[_0xb0a6('0xa9')][_0xb0a6('0x8e')](),_0xb0a6('0xa7'))[_0xb0a6('0x86')](_0x4e6832[_0xb0a6('0x50')]['id']['toString'](),'VoiceQueueId')[_0xb0a6('0x86')]('\x27'+_0x19bc15+'\x27',_0xb0a6('0x5c'))['field']('\x27'+_0x19bc15+'\x27',_0xb0a6('0x5d'))[_0xb0a6('0x88')]('cm_contacts')[_0xb0a6('0x45')]('deletedAt\x20IS\x20NULL')[_0xb0a6('0x45')]('ListId\x20=\x20?',_0x1139d0['CmListId']['toString']())[_0xb0a6('0x45')](_0xb0a6('0xaa'))['where'](_0xb0a6('0xab'),squel['select']()[_0xb0a6('0x86')](_0xb0a6('0xac'))[_0xb0a6('0x88')](_0xb0a6('0xad'))['where']('VoiceQueueId\x20=\x20?',_0x4e6832[_0xb0a6('0x50')]['id']['toString']()))[_0xb0a6('0x45')](_0xb0a6('0xab'),squel[_0xb0a6('0x85')]()['field'](_0xb0a6('0xae'))[_0xb0a6('0x88')]('cm_hopper')[_0xb0a6('0x45')](_0xb0a6('0x8c'),_0x4e6832['params']['id'][_0xb0a6('0x8e')]())))[_0xb0a6('0x8e')]();break;case _0xb0a6('0xaf'):_0x5b582c=squel[_0xb0a6('0xa2')]()['into'](_0xb0a6('0xa3'))[_0xb0a6('0xa4')](['phone','scheduledAt',_0xb0a6('0xa8'),_0xb0a6('0xa7'),'VoiceQueueId',_0xb0a6('0x5c'),'updatedAt'],squel['select']()[_0xb0a6('0x86')]('phone',_0xb0a6('0xa5'))['field']('\x27'+_0x19bc15+'\x27','scheduledAt')['field']('id',_0xb0a6('0xa8'))[_0xb0a6('0x86')](_0x1139d0['CmListId'][_0xb0a6('0x8e')](),_0xb0a6('0xa7'))[_0xb0a6('0x86')](_0x4e6832[_0xb0a6('0x50')]['id'][_0xb0a6('0x8e')](),'VoiceQueueId')[_0xb0a6('0x86')]('\x27'+_0x19bc15+'\x27',_0xb0a6('0x5c'))[_0xb0a6('0x86')]('\x27'+_0x19bc15+'\x27',_0xb0a6('0x5d'))['from'](_0xb0a6('0xb0'))[_0xb0a6('0x45')]('deletedAt\x20IS\x20NULL')[_0xb0a6('0x45')](_0xb0a6('0xb1'),_0x1139d0[_0xb0a6('0xa9')][_0xb0a6('0x8e')]())[_0xb0a6('0x45')](_0xb0a6('0xaa'))[_0xb0a6('0x45')]('phone\x20NOT\x20IN\x20(?)',squel[_0xb0a6('0x85')]()[_0xb0a6('0x86')](_0xb0a6('0xae'))[_0xb0a6('0x88')](_0xb0a6('0xa3'))['where'](_0xb0a6('0x8c'),_0x4e6832['params']['id'][_0xb0a6('0x8e')]())))['toString']();break;default:_0x5b582c=squel[_0xb0a6('0xa2')]()['into'](_0xb0a6('0xa3'))[_0xb0a6('0xa4')]([_0xb0a6('0xa5'),_0xb0a6('0xa6'),'ContactId',_0xb0a6('0xa7'),'VoiceQueueId','createdAt',_0xb0a6('0x5d')],squel[_0xb0a6('0x85')]()[_0xb0a6('0x86')](_0xb0a6('0xa5'),_0xb0a6('0xa5'))[_0xb0a6('0x86')]('\x27'+_0x19bc15+'\x27',_0xb0a6('0xa6'))['field']('id','ContactId')['field'](_0x1139d0[_0xb0a6('0xa9')][_0xb0a6('0x8e')](),_0xb0a6('0xa7'))['field'](_0x4e6832['params']['id'][_0xb0a6('0x8e')](),_0xb0a6('0x65'))[_0xb0a6('0x86')]('\x27'+_0x19bc15+'\x27','createdAt')[_0xb0a6('0x86')]('\x27'+_0x19bc15+'\x27',_0xb0a6('0x5d'))[_0xb0a6('0x88')](_0xb0a6('0xb0'))[_0xb0a6('0x45')](_0xb0a6('0xb2'))[_0xb0a6('0x45')](_0xb0a6('0xb1'),_0x1139d0[_0xb0a6('0xa9')][_0xb0a6('0x8e')]())['where'](_0xb0a6('0xaa')))[_0xb0a6('0x8e')]();}_0x33d77c['push'](db['sequelize'][_0xb0a6('0x3b')](_0x5b582c));}return BPromise[_0xb0a6('0x91')](_0x33d77c);}})[_0xb0a6('0x25')](function(){var _0x37f857=[];var _0xfadea8=squel['insert']()[_0xb0a6('0xb3')](_0xb0a6('0xb4'))[_0xb0a6('0xa4')]([_0xb0a6('0xb5'),_0xb0a6('0xa5'),_0xb0a6('0xb6'),'createdAt',_0xb0a6('0x5d')],squel[_0xb0a6('0x85')]()[_0xb0a6('0x86')](_0xb0a6('0xb7'))[_0xb0a6('0x86')](_0xb0a6('0xb8'))[_0xb0a6('0x86')]('ci.OrderBy+1')['field']('\x27'+_0x19bc15+'\x27',_0xb0a6('0x5c'))[_0xb0a6('0x86')]('\x27'+_0x19bc15+'\x27','updatedAt')[_0xb0a6('0x88')](_0xb0a6('0xb9'),'ci')[_0xb0a6('0x8a')](_0xb0a6('0xa3'),'h',_0xb0a6('0xba'))[_0xb0a6('0x45')](_0xb0a6('0xbb'),_0x19bc15)[_0xb0a6('0x45')](_0xb0a6('0xbc'),'PHONE'))[_0xb0a6('0x8e')]();_0x37f857['push'](db[_0xb0a6('0x75')][_0xb0a6('0x3b')](_0xfadea8));return BPromise['all'](_0x37f857);})[_0xb0a6('0x25')](function(){return _0x1007c2;})[_0xb0a6('0x25')](respondWithResult(_0x2f9e50,null))[_0xb0a6('0x4e')](handleError(_0x2f9e50,null));};exports[_0xb0a6('0xbd')]=function(_0x5a27dd,_0x4d5cf5,_0x437675){return db[_0xb0a6('0x37')]['find']({'where':{'id':_0x5a27dd['params']['id']}})[_0xb0a6('0x25')](handleEntityNotFound(_0x4d5cf5,null))[_0xb0a6('0x25')](function(_0x2cf5a1){if(_0x2cf5a1){return _0x2cf5a1[_0xb0a6('0xbd')](_0x5a27dd[_0xb0a6('0x3b')][_0xb0a6('0x94')]);}})[_0xb0a6('0x25')](function(_0x3f5bcc){if(_0x3f5bcc){return db[_0xb0a6('0x64')][_0xb0a6('0x33')]({'where':{'ListId':_0x5a27dd[_0xb0a6('0x3b')][_0xb0a6('0x94')],'VoiceQueueId':_0x5a27dd[_0xb0a6('0x50')]['id']}})['then'](function(){return _0x3f5bcc;});}})[_0xb0a6('0x25')](respondWithStatusCode(_0x4d5cf5,null))[_0xb0a6('0x4e')](handleError(_0x4d5cf5,null));};exports[_0xb0a6('0xbe')]=function(_0x5d11be,_0x47812a,_0x52ba59){var _0x5d2d94={};var _0x3012db={};var _0xdc45c;var _0x339459;return db[_0xb0a6('0x37')][_0xb0a6('0x63')]({'where':{'id':_0x5d11be['params']['id']}})[_0xb0a6('0x25')](handleEntityNotFound(_0x47812a,null))['then'](function(_0x160fe0){if(_0x160fe0){_0xdc45c=_0x160fe0;_0x3012db[_0xb0a6('0x3d')]=_[_0xb0a6('0x3c')](db[_0xb0a6('0xbf')][_0xb0a6('0x38')]);_0x3012db[_0xb0a6('0x3b')]=_[_0xb0a6('0x3c')](_0x5d11be['query']);_0x3012db[_0xb0a6('0x46')]=_['intersection'](_0x3012db[_0xb0a6('0x3d')],_0x3012db['query']);_0x5d2d94[_0xb0a6('0x3e')]=_[_0xb0a6('0x3f')](_0x3012db[_0xb0a6('0x3d')],qs[_0xb0a6('0x40')](_0x5d11be[_0xb0a6('0x3b')][_0xb0a6('0x40')]));_0x5d2d94[_0xb0a6('0x3e')]=_0x5d2d94[_0xb0a6('0x3e')][_0xb0a6('0x51')]?_0x5d2d94['attributes']:_0x3012db[_0xb0a6('0x3d')];_0x5d2d94[_0xb0a6('0x43')]=qs[_0xb0a6('0x44')](_0x5d11be['query']['sort']);_0x5d2d94[_0xb0a6('0x45')]=qs[_0xb0a6('0x46')](_[_0xb0a6('0x47')](_0x5d11be[_0xb0a6('0x3b')],_0x3012db[_0xb0a6('0x46')]));if(_0x5d11be['query'][_0xb0a6('0x2b')]){_0x5d2d94[_0xb0a6('0x45')]=_['merge'](_0x5d2d94[_0xb0a6('0x45')],{'$or':_[_0xb0a6('0x2d')](_0x5d2d94[_0xb0a6('0x3e')],function(_0x1aba15){var _0x4a4512={};_0x4a4512[_0x1aba15]={'$like':'%'+_0x5d11be[_0xb0a6('0x3b')][_0xb0a6('0x2b')]+'%'};return _0x4a4512;})});}_0x5d2d94=_[_0xb0a6('0x49')]({},_0x5d2d94,_0x5d11be['options']);return _0xdc45c[_0xb0a6('0xbe')](_0x5d2d94);}})[_0xb0a6('0x25')](function(_0x1791b9){if(_0x1791b9){_0x339459=_0x1791b9[_0xb0a6('0x51')];if(!_0x5d11be['query']['hasOwnProperty'](_0xb0a6('0x42'))){_0x5d2d94['limit']=qs['limit'](_0x5d11be[_0xb0a6('0x3b')]['limit']);_0x5d2d94[_0xb0a6('0x1d')]=qs[_0xb0a6('0x1d')](_0x5d11be[_0xb0a6('0x3b')]['offset']);}return _0xdc45c[_0xb0a6('0xbe')](_0x5d2d94);}})['then'](function(_0x1a4f19){if(_0x1a4f19){return _0x1a4f19?{'count':_0x339459,'rows':_0x1a4f19}:null;}})['then'](respondWithResult(_0x47812a,null))['catch'](handleError(_0x47812a,null));};exports['addBlackLists']=function(_0x240500,_0x5a7f7c,_0x47d469){var _0x529901,_0x2762bc;return db[_0xb0a6('0x37')]['find']({'where':{'id':_0x240500['params']['id']}})[_0xb0a6('0x25')](handleEntityNotFound(_0x5a7f7c,null))['then'](function(_0x233f4e){if(_0x233f4e){_0x2762bc=_0x233f4e;return _0x233f4e['addBlackLists'](_0x240500[_0xb0a6('0x5e')][_0xb0a6('0x94')],_[_0xb0a6('0x5b')](_0x240500[_0xb0a6('0x5e')],[_0xb0a6('0x94'),'id'])||{});}return null;})[_0xb0a6('0x99')](function(_0x18a761){var _0x3091c5;_0x529901=_0x18a761||[];var _0x45a3cc=[];if(_0x18a761){for(var _0x29cb05=0x0;_0x29cb05<_0x18a761[_0xb0a6('0x51')];_0x29cb05+=0x1){var _0x35c6d7=_0x18a761[_0x29cb05][_0xb0a6('0x26')]({'plain':!![]});_0x3091c5=squel[_0xb0a6('0xa2')]()[_0xb0a6('0xb3')]('cm_hopper_black')[_0xb0a6('0xa4')](['phone',_0xb0a6('0xa8'),_0xb0a6('0xa7'),_0xb0a6('0x65'),_0xb0a6('0x5c'),_0xb0a6('0x5d')],squel[_0xb0a6('0x85')]()['field'](_0xb0a6('0xa5'),_0xb0a6('0xa5'))[_0xb0a6('0x86')]('id','ContactId')[_0xb0a6('0x86')](_0x35c6d7[_0xb0a6('0xa9')][_0xb0a6('0x8e')](),_0xb0a6('0xa7'))[_0xb0a6('0x86')](_0x240500[_0xb0a6('0x50')]['id']['toString'](),_0xb0a6('0x65'))[_0xb0a6('0x86')](_0xb0a6('0xc0'),'createdAt')['field'](_0xb0a6('0xc0'),_0xb0a6('0x5d'))[_0xb0a6('0x88')](_0xb0a6('0xb0'))['where'](_0xb0a6('0xb2'))[_0xb0a6('0x45')](_0xb0a6('0xb1'),_0x35c6d7[_0xb0a6('0xa9')][_0xb0a6('0x8e')]())[_0xb0a6('0x45')]('phone\x20IS\x20NOT\x20NULL'))[_0xb0a6('0x8e')]();_0x45a3cc[_0xb0a6('0x9a')](db[_0xb0a6('0x75')][_0xb0a6('0x3b')](_0x3091c5));}return BPromise[_0xb0a6('0x91')](_0x45a3cc);}})[_0xb0a6('0x25')](function(){return _0x529901;})[_0xb0a6('0x25')](respondWithResult(_0x5a7f7c,null))['catch'](handleError(_0x5a7f7c,null));};exports[_0xb0a6('0xc1')]=function(_0x24c7d1,_0x1f80a8,_0x59a29e){return db[_0xb0a6('0x37')][_0xb0a6('0x53')]({'where':{'id':_0x24c7d1['params']['id']}})[_0xb0a6('0x25')](handleEntityNotFound(_0x1f80a8,null))[_0xb0a6('0x25')](function(_0x42f86d){if(_0x42f86d){return _0x42f86d[_0xb0a6('0xc1')](_0x24c7d1['query'][_0xb0a6('0x94')]);}})[_0xb0a6('0x25')](function(_0x5edf19){if(_0x5edf19){return db[_0xb0a6('0x6b')]['destroy']({'where':{'ListId':_0x24c7d1[_0xb0a6('0x3b')][_0xb0a6('0x94')],'VoiceQueueId':_0x24c7d1[_0xb0a6('0x50')]['id']}})['then'](function(){return _0x5edf19;});}})[_0xb0a6('0x25')](respondWithStatusCode(_0x1f80a8,null))[_0xb0a6('0x4e')](handleError(_0x1f80a8,null));}; \ No newline at end of file +var _0x49fe=['show','params','includeAll','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','user','update','findOne','hasOwnProperty','order','CmHopper','getHopperHistories','CmHopperHistory','VoiceQueueId','rows','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','Agents','voicePause','interface','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_voice_queues','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','TeamId','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','online','format','all','getAgents','User','getMembers','CmList','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','onlyIfOpen','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','join','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','request-promise','moment','bluebird','mustache','util','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/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueue.socket','status','end','undefined','limit','set','Content-Range','json','apply','reject','save','then','inbound','QueueCampaigns','outbound','ignore','map','value','type','find','name','destroy','sendStatus','error','stack','index','VoiceQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll'];(function(_0x197cae,_0x131ae0){var _0x3db4e2=function(_0x4db44d){while(--_0x4db44d){_0x197cae['push'](_0x197cae['shift']());}};_0x3db4e2(++_0x131ae0);}(_0x49fe,0x75));var _0xe49f=function(_0x1b0f9d,_0x36e1a7){_0x1b0f9d=_0x1b0f9d-0x0;var _0x353ac8=_0x49fe[_0x1b0f9d];return _0x353ac8;};'use strict';var emlformat=require(_0xe49f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe49f('0x1'));var moment=require(_0xe49f('0x2'));var BPromise=require(_0xe49f('0x3'));var Mustache=require(_0xe49f('0x4'));var util=require(_0xe49f('0x5'));var path=require(_0xe49f('0x6'));var sox=require(_0xe49f('0x7'));var csv=require(_0xe49f('0x8'));var ejs=require(_0xe49f('0x9'));var fs=require('fs');var fs_extra=require(_0xe49f('0xa'));var _=require(_0xe49f('0xb'));var squel=require(_0xe49f('0xc'));var crypto=require(_0xe49f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe49f('0xe'));var toCsv=require(_0xe49f('0x8'));var querystring=require('querystring');var Papa=require(_0xe49f('0xf'));var Redis=require('ioredis');var authService=require(_0xe49f('0x10'));var qs=require(_0xe49f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe49f('0x12'));var logger=require(_0xe49f('0x13'))(_0xe49f('0x14'));var utils=require(_0xe49f('0x15'));var config=require(_0xe49f('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe49f('0x17'))['db'];config[_0xe49f('0x18')]=_['defaults'](config[_0xe49f('0x18')],{'host':_0xe49f('0x19'),'port':0x18eb});var socket=require(_0xe49f('0x1a'))(new Redis(config[_0xe49f('0x18')]));require(_0xe49f('0x1b'))['register'](socket);function respondWithStatusCode(_0x3645e8,_0x2f7fb6){_0x2f7fb6=_0x2f7fb6||0xcc;return function(_0x534473){if(_0x534473){return _0x3645e8['sendStatus'](_0x2f7fb6);}return _0x3645e8[_0xe49f('0x1c')](_0x2f7fb6)[_0xe49f('0x1d')]();};}function respondWithResult(_0x1e8eb8,_0x219632){_0x219632=_0x219632||0xc8;return function(_0x3e9885){if(_0x3e9885){return _0x1e8eb8[_0xe49f('0x1c')](_0x219632)['json'](_0x3e9885);}};}function respondWithFilteredResult(_0x7831f1,_0x50655f){return function(_0x6ab378){if(_0x6ab378){var _0x4df1cc=typeof _0x50655f['offset']===_0xe49f('0x1e')&&typeof _0x50655f[_0xe49f('0x1f')]==='undefined';var _0x7a5643=_0x6ab378['count'];var _0x34008b=_0x4df1cc?0x0:_0x50655f['offset'];var _0x3bc2fd=_0x4df1cc?_0x6ab378['count']:_0x50655f['offset']+_0x50655f[_0xe49f('0x1f')];var _0x5b50e0;if(_0x3bc2fd>=_0x7a5643){_0x3bc2fd=_0x7a5643;_0x5b50e0=0xc8;}else{_0x5b50e0=0xce;}_0x7831f1[_0xe49f('0x1c')](_0x5b50e0);return _0x7831f1[_0xe49f('0x20')](_0xe49f('0x21'),_0x34008b+'-'+_0x3bc2fd+'/'+_0x7a5643)[_0xe49f('0x22')](_0x6ab378);}return null;};}function patchUpdates(_0x424927){return function(_0x169a6c){try{jsonpatch[_0xe49f('0x23')](_0x169a6c,_0x424927,!![]);}catch(_0x3d4146){return BPromise[_0xe49f('0x24')](_0x3d4146);}return _0x169a6c[_0xe49f('0x25')]();};}function saveUpdates(_0x2bc2b2,_0x25f82f){return function(_0x1e0703){if(_0x1e0703){return _0x1e0703['update'](_0x2bc2b2)[_0xe49f('0x26')](function(_0x298cba){return _0x298cba;});}return null;};}function removeEntity(_0xbe357,_0x14d820){return function(_0x5424d9){if(_0x5424d9){return _0x5424d9['destroy']()[_0xe49f('0x26')](function(){var _0x44b702=_0x5424d9['get']({'plain':!![]});var _0x300a1c=[{'name':'VoiceQueues','value':_0xe49f('0x27'),'ignore':![]},{'name':_0xe49f('0x28'),'value':_0xe49f('0x29'),'ignore':![]}];var _0x5ece7e=_(_0x300a1c)['filter'](_0xe49f('0x2a'))[_0xe49f('0x2b')](_0xe49f('0x2c'))[_0xe49f('0x2c')]();if(_['includes'](_0x5ece7e,_0x44b702[_0xe49f('0x2d')])){return;}var _0x114652=_[_0xe49f('0x2e')](_0x300a1c,[_0xe49f('0x2c'),_0x44b702[_0xe49f('0x2d')]])[_0xe49f('0x2f')];return db['UserProfileResource'][_0xe49f('0x30')]({'where':{'type':_0x114652,'resourceId':_0x44b702['id']}})[_0xe49f('0x26')](function(){return _0x5424d9;});})[_0xe49f('0x26')](function(){_0xbe357[_0xe49f('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a13cc,_0x893e9f){return function(_0x825a4d){if(!_0x825a4d){_0x4a13cc[_0xe49f('0x31')](0x194);}return _0x825a4d;};}function handleError(_0x4833c3,_0x4b8da8){_0x4b8da8=_0x4b8da8||0x1f4;return function(_0x33954a){logger[_0xe49f('0x32')](_0x33954a[_0xe49f('0x33')]);if(_0x33954a['name']){delete _0x33954a[_0xe49f('0x2f')];}_0x4833c3['status'](_0x4b8da8)['send'](_0x33954a);};}exports[_0xe49f('0x34')]=function(_0x100d21,_0x110942){var _0x4f81e0={},_0x4708bf={},_0xc45a91={'count':0x0,'rows':[]};var _0x56d17a=_['map'](db[_0xe49f('0x35')][_0xe49f('0x36')],function(_0x2aeefb){return{'name':_0x2aeefb[_0xe49f('0x37')],'type':_0x2aeefb['type'][_0xe49f('0x38')]};});_0x4708bf[_0xe49f('0x39')]=_[_0xe49f('0x2b')](_0x56d17a,_0xe49f('0x2f'));_0x4708bf[_0xe49f('0x3a')]=_[_0xe49f('0x3b')](_0x100d21[_0xe49f('0x3a')]);_0x4708bf[_0xe49f('0x3c')]=_[_0xe49f('0x3d')](_0x4708bf[_0xe49f('0x39')],_0x4708bf[_0xe49f('0x3a')]);_0x4f81e0[_0xe49f('0x3e')]=_[_0xe49f('0x3d')](_0x4708bf[_0xe49f('0x39')],qs[_0xe49f('0x3f')](_0x100d21[_0xe49f('0x3a')][_0xe49f('0x3f')]));_0x4f81e0[_0xe49f('0x3e')]=_0x4f81e0[_0xe49f('0x3e')][_0xe49f('0x40')]?_0x4f81e0[_0xe49f('0x3e')]:_0x4708bf[_0xe49f('0x39')];if(!_0x100d21[_0xe49f('0x3a')]['hasOwnProperty'](_0xe49f('0x41'))){_0x4f81e0[_0xe49f('0x1f')]=qs[_0xe49f('0x1f')](_0x100d21['query'][_0xe49f('0x1f')]);_0x4f81e0['offset']=qs['offset'](_0x100d21[_0xe49f('0x3a')][_0xe49f('0x42')]);}_0x4f81e0['order']=qs[_0xe49f('0x43')](_0x100d21[_0xe49f('0x3a')][_0xe49f('0x43')]);_0x4f81e0[_0xe49f('0x44')]=qs[_0xe49f('0x3c')](_[_0xe49f('0x45')](_0x100d21[_0xe49f('0x3a')],_0x4708bf['filters']),_0x56d17a);if(_0x100d21[_0xe49f('0x3a')][_0xe49f('0x46')]){_0x4f81e0[_0xe49f('0x44')]=_[_0xe49f('0x47')](_0x4f81e0[_0xe49f('0x44')],{'$or':_[_0xe49f('0x2b')](_0x56d17a,function(_0x58bc4c){if(_0x58bc4c[_0xe49f('0x2d')]!==_0xe49f('0x48')){var _0x2cebba={};_0x2cebba[_0x58bc4c[_0xe49f('0x2f')]]={'$like':'%'+_0x100d21[_0xe49f('0x3a')][_0xe49f('0x46')]+'%'};return _0x2cebba;}})});}_0x4f81e0=_[_0xe49f('0x47')]({},_0x4f81e0,_0x100d21[_0xe49f('0x49')]);var _0x5dbc0e={'where':_0x4f81e0['where']};return db[_0xe49f('0x35')]['count'](_0x5dbc0e)[_0xe49f('0x26')](function(_0x3d710c){_0xc45a91[_0xe49f('0x4a')]=_0x3d710c;if(_0x100d21[_0xe49f('0x3a')]['includeAll']){_0x4f81e0[_0xe49f('0x4b')]=[{'all':!![]}];}return db[_0xe49f('0x35')][_0xe49f('0x4c')](_0x4f81e0);})['then'](function(_0x43a4fd){_0xc45a91['rows']=_0x43a4fd;return _0xc45a91;})[_0xe49f('0x26')](respondWithFilteredResult(_0x110942,_0x4f81e0))['catch'](handleError(_0x110942,null));};exports[_0xe49f('0x4d')]=function(_0x5b7ce6,_0xe108fb){var _0x3acc60={'raw':![],'where':{'id':_0x5b7ce6[_0xe49f('0x4e')]['id']}},_0x1e9ca5={};_0x1e9ca5[_0xe49f('0x39')]=_[_0xe49f('0x3b')](db[_0xe49f('0x35')][_0xe49f('0x36')]);_0x1e9ca5[_0xe49f('0x3a')]=_['keys'](_0x5b7ce6['query']);_0x1e9ca5[_0xe49f('0x3c')]=_[_0xe49f('0x3d')](_0x1e9ca5[_0xe49f('0x39')],_0x1e9ca5[_0xe49f('0x3a')]);_0x3acc60[_0xe49f('0x3e')]=_[_0xe49f('0x3d')](_0x1e9ca5[_0xe49f('0x39')],qs[_0xe49f('0x3f')](_0x5b7ce6[_0xe49f('0x3a')][_0xe49f('0x3f')]));_0x3acc60[_0xe49f('0x3e')]=_0x3acc60['attributes'][_0xe49f('0x40')]?_0x3acc60['attributes']:_0x1e9ca5[_0xe49f('0x39')];if(_0x5b7ce6[_0xe49f('0x3a')][_0xe49f('0x4f')]){_0x3acc60[_0xe49f('0x4b')]=[{'all':!![]}];}_0x3acc60=_[_0xe49f('0x47')]({},_0x3acc60,_0x5b7ce6[_0xe49f('0x49')]);return db[_0xe49f('0x35')][_0xe49f('0x2e')](_0x3acc60)[_0xe49f('0x26')](handleEntityNotFound(_0xe108fb,null))[_0xe49f('0x26')](respondWithResult(_0xe108fb,null))[_0xe49f('0x50')](handleError(_0xe108fb,null));};exports[_0xe49f('0x51')]=function(_0x51a5c2,_0x16e6a7){return db[_0xe49f('0x35')]['create'](_0x51a5c2[_0xe49f('0x52')],{})['then'](function(_0x2b99ee){var _0x1195d7=_0x51a5c2['user'][_0xe49f('0x53')]({'plain':!![]});if(!_0x1195d7)throw new Error(_0xe49f('0x54'));if(_0x1195d7[_0xe49f('0x55')]==='user'){var _0x54a170=_0x2b99ee['get']({'plain':!![]});var _0x4e58f6=[{'name':'VoiceQueues','value':'inbound'},{'name':_0xe49f('0x28'),'value':_0xe49f('0x29')}];var _0x27120e=_[_0xe49f('0x2e')](_0x4e58f6,[_0xe49f('0x2c'),_0x54a170[_0xe49f('0x2d')]])[_0xe49f('0x2f')];return db[_0xe49f('0x56')]['find']({'where':{'name':_0x27120e,'userProfileId':_0x1195d7[_0xe49f('0x57')]},'raw':!![]})[_0xe49f('0x26')](function(_0x57a5d2){if(_0x57a5d2&&_0x57a5d2[_0xe49f('0x58')]===0x0){return db[_0xe49f('0x59')][_0xe49f('0x51')]({'name':_0x54a170['name'],'resourceId':_0x54a170['id'],'type':_0x57a5d2['name'],'sectionId':_0x57a5d2['id']},{})[_0xe49f('0x26')](function(){return _0x2b99ee;});}else{return _0x2b99ee;}})[_0xe49f('0x50')](function(_0x5d3f50){logger['error'](_0xe49f('0x5a'),_0x5d3f50);throw _0x5d3f50;});}return _0x2b99ee;})['then'](respondWithResult(_0x16e6a7,0xc9))['catch'](handleError(_0x16e6a7,null));};exports[_0xe49f('0x5b')]=function(_0x3dd9af,_0x554e8c){var _0x328bf3={'where':{'id':_0x3dd9af[_0xe49f('0x4e')]['id']}},_0x371972={};_0x371972[_0xe49f('0x39')]=_['keys'](db['VoiceQueue'][_0xe49f('0x36')]);_0x328bf3['attributes']=_['intersection'](_0x371972[_0xe49f('0x39')],qs[_0xe49f('0x3f')](_0x3dd9af[_0xe49f('0x3a')][_0xe49f('0x3f')]));_0x328bf3[_0xe49f('0x3e')]=_0x328bf3[_0xe49f('0x3e')][_0xe49f('0x40')]?_0x328bf3[_0xe49f('0x3e')]:_0x371972[_0xe49f('0x39')];if(_0x3dd9af[_0xe49f('0x3a')][_0xe49f('0x4f')]){_0x328bf3[_0xe49f('0x4b')]=[{'all':!![]}];}_0x328bf3=_[_0xe49f('0x47')]({},_0x328bf3,_0x3dd9af[_0xe49f('0x49')]);return db[_0xe49f('0x35')][_0xe49f('0x2e')](_0x328bf3)['then'](handleEntityNotFound(_0x554e8c,null))[_0xe49f('0x26')](function(_0xc038bc){if(_0xc038bc){var _0x1f906c=_0xc038bc['get']({'plain':!![]});_0x1f906c=qs[_0xe49f('0x5c')](_0x1f906c,['id',_0xe49f('0x5d'),_0xe49f('0x5e')]);_0x3dd9af[_0xe49f('0x52')]=_[_0xe49f('0x5c')](_0x3dd9af['body'],['id',_0xe49f('0x5d'),'updatedAt']);return db[_0xe49f('0x35')]['create'](_[_0xe49f('0x47')](_0x1f906c,_0x3dd9af['body']),{'include':_0x3dd9af['query'][_0xe49f('0x4f')]?[{'all':!![]}]:undefined})[_0xe49f('0x26')](function(_0x1de28a){var _0x4fd4ad=_0x3dd9af['user'][_0xe49f('0x53')]({'plain':!![]});if(!_0x4fd4ad)throw new Error(_0xe49f('0x54'));if(_0x4fd4ad['role']===_0xe49f('0x5f')){var _0x2d038a=_0x1de28a[_0xe49f('0x53')]({'plain':!![]});var _0xf3a873=[{'name':'VoiceQueues','value':_0xe49f('0x27')},{'name':'QueueCampaigns','value':'outbound'}];var _0x4ff0a2=_[_0xe49f('0x2e')](_0xf3a873,['value',_0x2d038a['type']])[_0xe49f('0x2f')];return db[_0xe49f('0x56')]['find']({'where':{'name':_0x4ff0a2,'userProfileId':_0x4fd4ad['userProfileId']},'raw':!![]})[_0xe49f('0x26')](function(_0x226a9b){if(_0x226a9b&&_0x226a9b[_0xe49f('0x58')]===0x0){return db[_0xe49f('0x59')][_0xe49f('0x51')]({'name':_0x2d038a['name'],'resourceId':_0x2d038a['id'],'type':_0x226a9b[_0xe49f('0x2f')],'sectionId':_0x226a9b['id']},{})['then'](function(){return _0x1de28a;});}else{return _0x1de28a;}})[_0xe49f('0x50')](function(_0x2bfe0b){logger['error'](_0xe49f('0x5a'),_0x2bfe0b);throw _0x2bfe0b;});}return _0x1de28a;});}})[_0xe49f('0x26')](respondWithResult(_0x554e8c,0xc9))[_0xe49f('0x50')](handleError(_0x554e8c,null));};exports[_0xe49f('0x60')]=function(_0x50bbc0,_0x45dc71){if(_0x50bbc0['body']['id']){delete _0x50bbc0[_0xe49f('0x52')]['id'];}return db['VoiceQueue'][_0xe49f('0x2e')]({'where':{'id':_0x50bbc0[_0xe49f('0x4e')]['id']}})[_0xe49f('0x26')](handleEntityNotFound(_0x45dc71,null))['then'](saveUpdates(_0x50bbc0[_0xe49f('0x52')],null))[_0xe49f('0x26')](respondWithResult(_0x45dc71,null))[_0xe49f('0x50')](handleError(_0x45dc71,null));};exports[_0xe49f('0x30')]=function(_0x44759f,_0xcbbb5d){return db['VoiceQueue'][_0xe49f('0x2e')]({'where':{'id':_0x44759f[_0xe49f('0x4e')]['id']}})[_0xe49f('0x26')](handleEntityNotFound(_0xcbbb5d,null))[_0xe49f('0x26')](removeEntity(_0xcbbb5d,null))['catch'](handleError(_0xcbbb5d,null));};exports['getHoppers']=function(_0x373f53,_0x1ebc9e,_0x36339a){var _0x2099fd={'raw':![],'where':{}};var _0x332b14={};var _0x35f217={'count':0x0,'rows':[]};return db[_0xe49f('0x35')][_0xe49f('0x61')]({'where':{'id':_0x373f53[_0xe49f('0x4e')]['id']}})[_0xe49f('0x26')](handleEntityNotFound(_0x1ebc9e,null))[_0xe49f('0x26')](function(_0x350550){if(_0x350550){_0x332b14[_0xe49f('0x39')]=_[_0xe49f('0x3b')](db['CmHopper'][_0xe49f('0x36')]);_0x332b14[_0xe49f('0x3a')]=_[_0xe49f('0x3b')](_0x373f53[_0xe49f('0x3a')]);_0x332b14[_0xe49f('0x3c')]=_[_0xe49f('0x3d')](_0x332b14[_0xe49f('0x39')],_0x332b14['query']);_0x2099fd[_0xe49f('0x3e')]=_[_0xe49f('0x3d')](_0x332b14['model'],qs['fields'](_0x373f53[_0xe49f('0x3a')]['fields']));_0x2099fd[_0xe49f('0x3e')]=_0x2099fd[_0xe49f('0x3e')][_0xe49f('0x40')]?_0x2099fd[_0xe49f('0x3e')]:_0x332b14[_0xe49f('0x39')];if(!_0x373f53[_0xe49f('0x3a')][_0xe49f('0x62')](_0xe49f('0x41'))){_0x2099fd['limit']=qs[_0xe49f('0x1f')](_0x373f53[_0xe49f('0x3a')][_0xe49f('0x1f')]);_0x2099fd[_0xe49f('0x42')]=qs[_0xe49f('0x42')](_0x373f53[_0xe49f('0x3a')][_0xe49f('0x42')]);}_0x2099fd[_0xe49f('0x63')]=qs['sort'](_0x373f53[_0xe49f('0x3a')]['sort']);_0x2099fd['where']=qs['filters'](_[_0xe49f('0x45')](_0x373f53[_0xe49f('0x3a')],_0x332b14[_0xe49f('0x3c')]));_0x2099fd[_0xe49f('0x44')]['VoiceQueueId']=_0x350550['id'];if(_0x373f53[_0xe49f('0x3a')]['filter']){_0x2099fd[_0xe49f('0x44')]=_[_0xe49f('0x47')](_0x2099fd[_0xe49f('0x44')],{'$or':_[_0xe49f('0x2b')](_0x2099fd[_0xe49f('0x3e')],function(_0x4ce153){var _0x43ba3e={};_0x43ba3e[_0x4ce153]={'$like':'%'+_0x373f53[_0xe49f('0x3a')][_0xe49f('0x46')]+'%'};return _0x43ba3e;})});}_0x2099fd=_['merge']({},_0x2099fd,_0x373f53[_0xe49f('0x49')]);return db[_0xe49f('0x64')][_0xe49f('0x4a')]({'where':_0x2099fd[_0xe49f('0x44')]})['then'](function(_0x1dfa89){_0x35f217[_0xe49f('0x4a')]=_0x1dfa89;if(_0x373f53[_0xe49f('0x3a')][_0xe49f('0x4f')]){_0x2099fd[_0xe49f('0x4b')]=[{'all':!![]}];}return db[_0xe49f('0x64')]['findAll'](_0x2099fd);})['then'](function(_0x5d3c6e){_0x35f217['rows']=_0x5d3c6e;return _0x35f217;});}})[_0xe49f('0x26')](respondWithFilteredResult(_0x1ebc9e,_0x2099fd))[_0xe49f('0x50')](handleError(_0x1ebc9e,null));};exports[_0xe49f('0x65')]=function(_0x36533e,_0x1f93e5,_0x3ab658){var _0x1a7cfb={'raw':!![],'where':{}};var _0x274ac6={};var _0x271af0={'count':0x0,'rows':[]};return db[_0xe49f('0x35')][_0xe49f('0x61')]({'where':{'id':_0x36533e[_0xe49f('0x4e')]['id']}})[_0xe49f('0x26')](handleEntityNotFound(_0x1f93e5,null))[_0xe49f('0x26')](function(_0x596281){if(_0x596281){_0x274ac6['model']=_[_0xe49f('0x3b')](db[_0xe49f('0x66')][_0xe49f('0x36')]);_0x274ac6[_0xe49f('0x3a')]=_['keys'](_0x36533e[_0xe49f('0x3a')]);_0x274ac6[_0xe49f('0x3c')]=_['intersection'](_0x274ac6[_0xe49f('0x39')],_0x274ac6['query']);_0x1a7cfb[_0xe49f('0x3e')]=_[_0xe49f('0x3d')](_0x274ac6[_0xe49f('0x39')],qs['fields'](_0x36533e['query'][_0xe49f('0x3f')]));_0x1a7cfb[_0xe49f('0x3e')]=_0x1a7cfb[_0xe49f('0x3e')][_0xe49f('0x40')]?_0x1a7cfb[_0xe49f('0x3e')]:_0x274ac6[_0xe49f('0x39')];if(!_0x36533e[_0xe49f('0x3a')][_0xe49f('0x62')](_0xe49f('0x41'))){_0x1a7cfb[_0xe49f('0x1f')]=qs[_0xe49f('0x1f')](_0x36533e['query']['limit']);_0x1a7cfb[_0xe49f('0x42')]=qs[_0xe49f('0x42')](_0x36533e['query'][_0xe49f('0x42')]);}_0x1a7cfb[_0xe49f('0x63')]=qs[_0xe49f('0x43')](_0x36533e[_0xe49f('0x3a')][_0xe49f('0x43')]);_0x1a7cfb['where']=qs[_0xe49f('0x3c')](_['pick'](_0x36533e[_0xe49f('0x3a')],_0x274ac6['filters']));_0x1a7cfb['where'][_0xe49f('0x67')]=_0x596281['id'];if(_0x36533e[_0xe49f('0x3a')][_0xe49f('0x46')]){_0x1a7cfb[_0xe49f('0x44')]=_[_0xe49f('0x47')](_0x1a7cfb[_0xe49f('0x44')],{'$or':_[_0xe49f('0x2b')](_0x1a7cfb[_0xe49f('0x3e')],function(_0x3ec189){var _0x5b25f4={};_0x5b25f4[_0x3ec189]={'$like':'%'+_0x36533e['query'][_0xe49f('0x46')]+'%'};return _0x5b25f4;})});}_0x1a7cfb=_['merge']({},_0x1a7cfb,_0x36533e['options']);return db[_0xe49f('0x66')]['count']({'where':_0x1a7cfb[_0xe49f('0x44')]})[_0xe49f('0x26')](function(_0x36e932){_0x271af0[_0xe49f('0x4a')]=_0x36e932;if(_0x36533e[_0xe49f('0x3a')]['includeAll']){_0x1a7cfb['include']=[{'all':!![]}];}return db[_0xe49f('0x66')][_0xe49f('0x4c')](_0x1a7cfb);})[_0xe49f('0x26')](function(_0x4307e0){_0x271af0[_0xe49f('0x68')]=_0x4307e0;return _0x271af0;});}})['then'](respondWithFilteredResult(_0x1f93e5,_0x1a7cfb))[_0xe49f('0x50')](handleError(_0x1f93e5,null));};exports['getHopperFinals']=function(_0x13a180,_0x40bbe6,_0x5cfac5){var _0x2488f8={'raw':!![],'where':{}};var _0x9fdcdc={};var _0x4e99fa={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xe49f('0x61')]({'where':{'id':_0x13a180[_0xe49f('0x4e')]['id']}})[_0xe49f('0x26')](handleEntityNotFound(_0x40bbe6,null))[_0xe49f('0x26')](function(_0x52aceb){if(_0x52aceb){_0x9fdcdc[_0xe49f('0x39')]=_[_0xe49f('0x3b')](db['CmHopperFinal'][_0xe49f('0x36')]);_0x9fdcdc[_0xe49f('0x3a')]=_['keys'](_0x13a180[_0xe49f('0x3a')]);_0x9fdcdc['filters']=_[_0xe49f('0x3d')](_0x9fdcdc[_0xe49f('0x39')],_0x9fdcdc[_0xe49f('0x3a')]);_0x2488f8['attributes']=_[_0xe49f('0x3d')](_0x9fdcdc[_0xe49f('0x39')],qs['fields'](_0x13a180[_0xe49f('0x3a')][_0xe49f('0x3f')]));_0x2488f8['attributes']=_0x2488f8['attributes'][_0xe49f('0x40')]?_0x2488f8[_0xe49f('0x3e')]:_0x9fdcdc[_0xe49f('0x39')];if(!_0x13a180[_0xe49f('0x3a')]['hasOwnProperty']('nolimit')){_0x2488f8[_0xe49f('0x1f')]=qs['limit'](_0x13a180[_0xe49f('0x3a')][_0xe49f('0x1f')]);_0x2488f8[_0xe49f('0x42')]=qs[_0xe49f('0x42')](_0x13a180[_0xe49f('0x3a')][_0xe49f('0x42')]);}_0x2488f8[_0xe49f('0x63')]=qs[_0xe49f('0x43')](_0x13a180[_0xe49f('0x3a')][_0xe49f('0x43')]);_0x2488f8['where']=qs['filters'](_[_0xe49f('0x45')](_0x13a180[_0xe49f('0x3a')],_0x9fdcdc[_0xe49f('0x3c')]));_0x2488f8[_0xe49f('0x44')][_0xe49f('0x67')]=_0x52aceb['id'];if(_0x13a180[_0xe49f('0x3a')][_0xe49f('0x46')]){_0x2488f8[_0xe49f('0x44')]=_[_0xe49f('0x47')](_0x2488f8['where'],{'$or':_[_0xe49f('0x2b')](_0x2488f8[_0xe49f('0x3e')],function(_0x1820aa){var _0x56067a={};_0x56067a[_0x1820aa]={'$like':'%'+_0x13a180[_0xe49f('0x3a')][_0xe49f('0x46')]+'%'};return _0x56067a;})});}_0x2488f8=_[_0xe49f('0x47')]({},_0x2488f8,_0x13a180[_0xe49f('0x49')]);return db[_0xe49f('0x69')]['count']({'where':_0x2488f8[_0xe49f('0x44')]})[_0xe49f('0x26')](function(_0x570851){_0x4e99fa[_0xe49f('0x4a')]=_0x570851;if(_0x13a180[_0xe49f('0x3a')][_0xe49f('0x4f')]){_0x2488f8[_0xe49f('0x4b')]=[{'all':!![]}];}return db[_0xe49f('0x69')][_0xe49f('0x4c')](_0x2488f8);})['then'](function(_0x40d518){_0x4e99fa[_0xe49f('0x68')]=_0x40d518;return _0x4e99fa;});}})[_0xe49f('0x26')](respondWithFilteredResult(_0x40bbe6,_0x2488f8))[_0xe49f('0x50')](handleError(_0x40bbe6,null));};exports[_0xe49f('0x6a')]=function(_0x24a11b,_0x16ae47,_0x4501cf){var _0x3c22ce={'raw':!![],'where':{}};var _0x23553b={};var _0x331f75={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xe49f('0x61')]({'where':{'id':_0x24a11b[_0xe49f('0x4e')]['id']}})[_0xe49f('0x26')](handleEntityNotFound(_0x16ae47,null))[_0xe49f('0x26')](function(_0x2f61a3){if(_0x2f61a3){_0x23553b['model']=_['keys'](db[_0xe49f('0x6b')]['rawAttributes']);_0x23553b[_0xe49f('0x3a')]=_['keys'](_0x24a11b[_0xe49f('0x3a')]);_0x23553b[_0xe49f('0x3c')]=_[_0xe49f('0x3d')](_0x23553b[_0xe49f('0x39')],_0x23553b['query']);_0x3c22ce['attributes']=_['intersection'](_0x23553b['model'],qs[_0xe49f('0x3f')](_0x24a11b['query'][_0xe49f('0x3f')]));_0x3c22ce[_0xe49f('0x3e')]=_0x3c22ce[_0xe49f('0x3e')][_0xe49f('0x40')]?_0x3c22ce['attributes']:_0x23553b[_0xe49f('0x39')];if(!_0x24a11b[_0xe49f('0x3a')][_0xe49f('0x62')](_0xe49f('0x41'))){_0x3c22ce[_0xe49f('0x1f')]=qs[_0xe49f('0x1f')](_0x24a11b[_0xe49f('0x3a')][_0xe49f('0x1f')]);_0x3c22ce[_0xe49f('0x42')]=qs[_0xe49f('0x42')](_0x24a11b[_0xe49f('0x3a')]['offset']);}_0x3c22ce[_0xe49f('0x63')]=qs['sort'](_0x24a11b['query']['sort']);_0x3c22ce[_0xe49f('0x44')]=qs[_0xe49f('0x3c')](_[_0xe49f('0x45')](_0x24a11b['query'],_0x23553b['filters']));_0x3c22ce[_0xe49f('0x44')][_0xe49f('0x67')]=_0x2f61a3['id'];if(_0x24a11b[_0xe49f('0x3a')][_0xe49f('0x46')]){_0x3c22ce[_0xe49f('0x44')]=_[_0xe49f('0x47')](_0x3c22ce[_0xe49f('0x44')],{'$or':_['map'](_0x3c22ce['attributes'],function(_0x12e650){var _0x4573d5={};_0x4573d5[_0x12e650]={'$like':'%'+_0x24a11b['query'][_0xe49f('0x46')]+'%'};return _0x4573d5;})});}_0x3c22ce=_[_0xe49f('0x47')]({},_0x3c22ce,_0x24a11b[_0xe49f('0x49')]);return db[_0xe49f('0x6b')][_0xe49f('0x4a')]({'where':_0x3c22ce[_0xe49f('0x44')]})['then'](function(_0xc9cbe2){_0x331f75[_0xe49f('0x4a')]=_0xc9cbe2;if(_0x24a11b[_0xe49f('0x3a')][_0xe49f('0x4f')]){_0x3c22ce['include']=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x3c22ce);})[_0xe49f('0x26')](function(_0x26e24f){_0x331f75[_0xe49f('0x68')]=_0x26e24f;return _0x331f75;});}})[_0xe49f('0x26')](respondWithFilteredResult(_0x16ae47,_0x3c22ce))['catch'](handleError(_0x16ae47,null));};exports[_0xe49f('0x6c')]=function(_0x2c5c4c,_0x571937,_0x37cfdb){var _0x15d8b1={};var _0x49f2df={};var _0x24703c;var _0x6abf4c;return db[_0xe49f('0x35')]['findOne']({'where':{'id':_0x2c5c4c[_0xe49f('0x4e')]['id']}})[_0xe49f('0x26')](handleEntityNotFound(_0x571937,null))['then'](function(_0x2e1aca){if(_0x2e1aca){_0x24703c=_0x2e1aca;_0x49f2df['model']=_[_0xe49f('0x3b')](db[_0xe49f('0x6d')][_0xe49f('0x36')]);_0x49f2df['query']=_[_0xe49f('0x3b')](_0x2c5c4c[_0xe49f('0x3a')]);_0x49f2df[_0xe49f('0x3c')]=_['intersection'](_0x49f2df[_0xe49f('0x39')],_0x49f2df[_0xe49f('0x3a')]);_0x15d8b1['attributes']=_['intersection'](_0x49f2df['model'],qs['fields'](_0x2c5c4c[_0xe49f('0x3a')]['fields']));_0x15d8b1['attributes']=_0x15d8b1[_0xe49f('0x3e')]['length']?_0x15d8b1[_0xe49f('0x3e')]:_0x49f2df[_0xe49f('0x39')];_0x15d8b1[_0xe49f('0x63')]=qs[_0xe49f('0x43')](_0x2c5c4c['query'][_0xe49f('0x43')]);_0x15d8b1['where']=qs['filters'](_[_0xe49f('0x45')](_0x2c5c4c['query'],_0x49f2df[_0xe49f('0x3c')]));if(_0x2c5c4c[_0xe49f('0x3a')][_0xe49f('0x46')]){_0x15d8b1[_0xe49f('0x44')]=_[_0xe49f('0x47')](_0x15d8b1[_0xe49f('0x44')],{'$or':_['map'](_0x15d8b1[_0xe49f('0x3e')],function(_0x440ab3){var _0x450be3={};_0x450be3[_0x440ab3]={'$like':'%'+_0x2c5c4c[_0xe49f('0x3a')][_0xe49f('0x46')]+'%'};return _0x450be3;})});}_0x15d8b1=_['merge']({},_0x15d8b1,_0x2c5c4c['options']);return _0x24703c['getTeams'](_0x15d8b1);}})[_0xe49f('0x26')](function(_0x39f624){if(_0x39f624){_0x6abf4c=_0x39f624[_0xe49f('0x40')];if(!_0x2c5c4c[_0xe49f('0x3a')][_0xe49f('0x62')](_0xe49f('0x41'))){_0x15d8b1[_0xe49f('0x1f')]=qs[_0xe49f('0x1f')](_0x2c5c4c['query'][_0xe49f('0x1f')]);_0x15d8b1[_0xe49f('0x42')]=qs[_0xe49f('0x42')](_0x2c5c4c[_0xe49f('0x3a')][_0xe49f('0x42')]);}return _0x24703c['getTeams'](_0x15d8b1);}})[_0xe49f('0x26')](function(_0x29f015){if(_0x29f015){return _0x29f015?{'count':_0x6abf4c,'rows':_0x29f015}:null;}})['then'](respondWithResult(_0x571937,null))[_0xe49f('0x50')](handleError(_0x571937,null));};exports[_0xe49f('0x6e')]=function(_0x209fa9,_0x1c616c,_0x2c6f4d){var _0x2947a7=_0x209fa9[_0xe49f('0x52')][_0xe49f('0x6f')];var _0xa272e=_[_0xe49f('0x2b')](_0x2947a7,'id');return db[_0xe49f('0x6d')]['findAll']({'where':{'id':_0xa272e},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe49f('0x70'),'attributes':['id',_0xe49f('0x2f'),'online',_0xe49f('0x71'),_0xe49f('0x72')],'raw':!![]}]})[_0xe49f('0x26')](function(_0x4d70a5){if(_0x4d70a5){var _0x1663e1=_['flatMap'](_0x4d70a5,function(_0x82d860){var _0x586720=_0x82d860[_0xe49f('0x53')]({'plain':!![]});_0x586720[_0xe49f('0x70')][_0xe49f('0x73')](function(_0x3bcc29){_0x3bcc29['penalty']=_[_0xe49f('0x2e')](_0x2947a7,{'id':_0x586720['id']})[_0xe49f('0x74')];});return _0x586720[_0xe49f('0x70')];});return db[_0xe49f('0x35')][_0xe49f('0x2e')]({'where':{'id':_0x209fa9[_0xe49f('0x4e')]['id']}})['then'](function(_0x4cf4f4){return db[_0xe49f('0x75')][_0xe49f('0x76')](function(_0x50eef8){return _0x4cf4f4[_0xe49f('0x6e')](_0xa272e,{'transaction':_0x50eef8})[_0xe49f('0x26')](function(){return BPromise[_0xe49f('0x77')](_0x2947a7,function(_0x2b945e){return db[_0xe49f('0x78')][_0xe49f('0x79')]({'TeamId':_0x2b945e['id'],'VoiceQueueId':_0x209fa9['params']['id'],'penalty':_0x2b945e[_0xe49f('0x74')]},{'transaction':_0x50eef8});});})[_0xe49f('0x26')](function(){return BPromise[_0xe49f('0x77')](_0x1663e1,function(_0x40d1c8){return db[_0xe49f('0x7a')][_0xe49f('0x7b')]({'where':{'UserId':_0x40d1c8['id'],'VoiceQueueId':_0x209fa9[_0xe49f('0x4e')]['id']},'defaults':{'penalty':_0x40d1c8[_0xe49f('0x74')]},'transaction':_0x50eef8});});})[_0xe49f('0x26')](function(){return BPromise[_0xe49f('0x77')](_[_0xe49f('0x46')](_0x1663e1,{'online':!![]}),function(_0x4be3e2){return db[_0xe49f('0x7c')][_0xe49f('0x79')]({'membername':_0x4be3e2['name'],'UserId':_0x4be3e2['id'],'queue_name':_0x4cf4f4['name'],'VoiceQueueId':_0x4cf4f4['id'],'interface':_[_0xe49f('0x7d')](_0x4be3e2[_0xe49f('0x72')])?util['format'](_0xe49f('0x7e'),_0x4be3e2[_0xe49f('0x2f')]):_0x4be3e2[_0xe49f('0x72')],'paused':_0x4be3e2[_0xe49f('0x71')]||![],'penalty':_0x4be3e2['penalty']},{'transaction':_0x50eef8});});})[_0xe49f('0x26')](function(){_0x1663e1[_0xe49f('0x73')](function(_0x243550){socket[_0xe49f('0x7f')](_0xe49f('0x80'),{'UserId':_0x243550['id'],'VoiceQueueId':_0x4cf4f4['id']});});});});});}})['then'](respondWithStatusCode(_0x1c616c,null))[_0xe49f('0x50')](handleError(_0x1c616c,null));};exports[_0xe49f('0x81')]=function(_0x55e9f3,_0x32976d,_0x42789f){return db[_0xe49f('0x6d')][_0xe49f('0x4c')]({'where':{'id':_0x55e9f3[_0xe49f('0x3a')][_0xe49f('0x82')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe49f('0x70'),'attributes':['id'],'raw':!![]}]})[_0xe49f('0x26')](handleEntityNotFound(_0x32976d,null))[_0xe49f('0x26')](function(_0x4e074f){var _0x3e99b2=_['map'](_0x4e074f,'id');var _0x3faee4=[];var _0x2b0fe0=[];var _0xe9866d=squel[_0xe49f('0x83')]();_0xe9866d[_0xe49f('0x84')](_0xe49f('0x85'))[_0xe49f('0x86')](_0xe49f('0x87'),'tq')['join'](_0xe49f('0x88'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xe49f('0x44')](_0xe49f('0x89'),_0x55e9f3[_0xe49f('0x4e')]['id']);for(var _0x2ccd28=0x0;_0x2ccd28<_0x4e074f[_0xe49f('0x40')];_0x2ccd28+=0x1){let _0xa62b7b=_0x4e074f[_0x2ccd28];for(var _0x2a27a4=0x0;_0x2a27a4<_0xa62b7b[_0xe49f('0x70')][_0xe49f('0x40')];_0x2a27a4+=0x1){let _0x38eaa4=_0xa62b7b[_0xe49f('0x70')][_0x2a27a4];var _0x3d341c=_0xe9866d[_0xe49f('0x5b')]();_0x3d341c[_0xe49f('0x44')](_0xe49f('0x8a'),_0x38eaa4['id']);_0x2b0fe0[_0xe49f('0x8b')](db['sequelize']['query'](_0x3d341c[_0xe49f('0x8c')](),{'type':db[_0xe49f('0x75')][_0xe49f('0x8d')]['SELECT']})[_0xe49f('0x26')](function(_0x9e32e0){if(_0x9e32e0[_0xe49f('0x40')]===0x1){return _0x38eaa4['id'];}else{var _0x184a84=_['every'](_[_0xe49f('0x2b')](_0x9e32e0,_0xe49f('0x8e')),function(_0x17fd6e){return _['includes'](_0x3e99b2,_0x17fd6e);});if(_0x184a84){return _0x38eaa4['id'];}}}));}}return BPromise['all'](_0x2b0fe0)[_0xe49f('0x26')](function(_0x43091f){_0x3faee4=_(_0x3faee4)[_0xe49f('0x8f')](_0x43091f)[_0xe49f('0x90')]()[_0xe49f('0x2c')]();return db['VoiceQueue'][_0xe49f('0x2e')]({'where':{'id':_0x55e9f3[_0xe49f('0x4e')]['id']}})[_0xe49f('0x26')](function(_0x5c6f42){return db['sequelize'][_0xe49f('0x76')](function(_0x284164){return _0x5c6f42[_0xe49f('0x81')](_0x55e9f3[_0xe49f('0x3a')][_0xe49f('0x82')],{'transaction':_0x284164})[_0xe49f('0x26')](function(){if(!_[_0xe49f('0x91')](_0x3faee4)){return _0x5c6f42[_0xe49f('0x92')](_0x3faee4,{'transaction':_0x284164})['then'](function(){return db['UserVoiceQueueRt'][_0xe49f('0x30')]({'where':{'VoiceQueueId':_0x55e9f3[_0xe49f('0x4e')]['id'],'UserId':_0x3faee4},'transaction':_0x284164});});}})['then'](function(){_0x3faee4[_0xe49f('0x73')](function(_0x1e53ee){socket[_0xe49f('0x7f')](_0xe49f('0x93'),{'UserId':_0x1e53ee,'VoiceQueueId':_0x5c6f42['id']});});});});});});})[_0xe49f('0x26')](respondWithStatusCode(_0x32976d,null))[_0xe49f('0x50')](handleError(_0x32976d,null));};exports['addAgents']=function(_0x55eae3,_0x441f7b,_0x51b395){var _0x2985f5,_0x4dad43;return db['VoiceQueue'][_0xe49f('0x2e')]({'where':{'id':_0x55eae3[_0xe49f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x441f7b,null))['then'](function(_0x40d29e){if(_0x40d29e){_0x4dad43=_0x40d29e;return _0x40d29e[_0xe49f('0x94')](_0x55eae3[_0xe49f('0x52')]['ids'],_['omit'](_0x55eae3[_0xe49f('0x52')],[_0xe49f('0x82'),'id'])||{})[_0xe49f('0x95')](function(_0x183d1c){for(var _0x2b217a=0x0;_0x2b217a<_0x55eae3['body'][_0xe49f('0x82')]['length'];_0x2b217a+=0x1){socket[_0xe49f('0x7f')](_0xe49f('0x80'),{'UserId':Number(_0x55eae3[_0xe49f('0x52')][_0xe49f('0x82')][_0x2b217a]),'VoiceQueueId':Number(_0x55eae3[_0xe49f('0x4e')]['id'])});}return _0x183d1c;});}})['then'](function(_0x26f56a){_0x2985f5=_0x26f56a||[];if(_0x4dad43){return db['User'][_0xe49f('0x4c')]({'where':{'id':_0x55eae3[_0xe49f('0x52')][_0xe49f('0x82')]},'attributes':['id','name',_0xe49f('0x96'),_0xe49f('0x71'),_0xe49f('0x72')],'raw':!![]});}})['then'](function(_0x35f809){if(!_[_0xe49f('0x91')](_0x35f809)){var _0x5ee30a=[];for(var _0x2d0a4e=0x0;_0x2d0a4e<_0x35f809[_0xe49f('0x40')];_0x2d0a4e++){if(_0x35f809[_0x2d0a4e][_0xe49f('0x96')]){_0x5ee30a['push'](db[_0xe49f('0x7c')]['upsert']({'membername':_0x35f809[_0x2d0a4e][_0xe49f('0x2f')],'UserId':_0x35f809[_0x2d0a4e]['id'],'queue_name':_0x4dad43['name'],'VoiceQueueId':_0x4dad43['id'],'interface':_[_0xe49f('0x7d')](_0x35f809[_0x2d0a4e][_0xe49f('0x72')])?util[_0xe49f('0x97')](_0xe49f('0x7e'),_0x35f809[_0x2d0a4e][_0xe49f('0x2f')]):_0x35f809[_0x2d0a4e]['interface'],'paused':_0x35f809[_0x2d0a4e]['voicePause']||![],'penalty':_0x55eae3[_0xe49f('0x52')][_0xe49f('0x74')]||0x0}));}}return BPromise[_0xe49f('0x98')](_0x5ee30a);}})[_0xe49f('0x26')](function(){return _0x2985f5;})['then'](respondWithResult(_0x441f7b,null))[_0xe49f('0x50')](handleError(_0x441f7b,null));};exports[_0xe49f('0x92')]=function(_0x181a39,_0x1fe52c,_0x49a554){return db[_0xe49f('0x35')][_0xe49f('0x2e')]({'where':{'id':_0x181a39[_0xe49f('0x4e')]['id']}})[_0xe49f('0x26')](handleEntityNotFound(_0x1fe52c,null))[_0xe49f('0x26')](function(_0x2a8737){if(_0x2a8737){return _0x2a8737[_0xe49f('0x92')](_0x181a39[_0xe49f('0x3a')][_0xe49f('0x82')])[_0xe49f('0x26')](function(){if(_['isArray'](_0x181a39[_0xe49f('0x3a')][_0xe49f('0x82')])){for(var _0x3b817a=0x0;_0x3b817a<_0x181a39['query']['ids'][_0xe49f('0x40')];_0x3b817a+=0x1){socket[_0xe49f('0x7f')](_0xe49f('0x93'),{'UserId':Number(_0x181a39[_0xe49f('0x3a')][_0xe49f('0x82')][_0x3b817a]),'VoiceQueueId':Number(_0x181a39[_0xe49f('0x4e')]['id'])});}}else{socket[_0xe49f('0x7f')]('userVoiceQueue:remove',{'UserId':Number(_0x181a39[_0xe49f('0x3a')][_0xe49f('0x82')]),'VoiceQueueId':Number(_0x181a39[_0xe49f('0x4e')]['id'])});}});}})[_0xe49f('0x26')](function(_0x3c7842){return db[_0xe49f('0x7c')][_0xe49f('0x30')]({'where':{'VoiceQueueId':_0x181a39['params']['id'],'UserId':_0x181a39[_0xe49f('0x3a')]['ids']}})['then'](function(){return _0x3c7842;});})[_0xe49f('0x26')](respondWithStatusCode(_0x1fe52c,null))[_0xe49f('0x50')](handleError(_0x1fe52c,null));};exports[_0xe49f('0x99')]=function(_0x39af3c,_0x7e39aa,_0x2aed94){var _0xd9a42e={};var _0x20120f={};var _0x45b43a;var _0x301e5a;return db['VoiceQueue']['findOne']({'where':{'id':_0x39af3c[_0xe49f('0x4e')]['id']}})[_0xe49f('0x26')](handleEntityNotFound(_0x7e39aa,null))[_0xe49f('0x26')](function(_0x9b27f0){if(_0x9b27f0){_0x45b43a=_0x9b27f0;_0x20120f[_0xe49f('0x39')]=_['keys'](db[_0xe49f('0x9a')]['rawAttributes']);_0x20120f[_0xe49f('0x3a')]=_['keys'](_0x39af3c['query']);_0x20120f[_0xe49f('0x3c')]=_[_0xe49f('0x3d')](_0x20120f[_0xe49f('0x39')],_0x20120f[_0xe49f('0x3a')]);_0xd9a42e[_0xe49f('0x3e')]=_[_0xe49f('0x3d')](_0x20120f[_0xe49f('0x39')],qs[_0xe49f('0x3f')](_0x39af3c['query'][_0xe49f('0x3f')]));_0xd9a42e[_0xe49f('0x3e')]=_0xd9a42e[_0xe49f('0x3e')][_0xe49f('0x40')]?_0xd9a42e['attributes']:_0x20120f[_0xe49f('0x39')];_0xd9a42e[_0xe49f('0x63')]=qs[_0xe49f('0x43')](_0x39af3c[_0xe49f('0x3a')][_0xe49f('0x43')]);_0xd9a42e['where']=qs[_0xe49f('0x3c')](_[_0xe49f('0x45')](_0x39af3c[_0xe49f('0x3a')],_0x20120f[_0xe49f('0x3c')]));if(_0x39af3c[_0xe49f('0x3a')]['filter']){_0xd9a42e[_0xe49f('0x44')]=_[_0xe49f('0x47')](_0xd9a42e[_0xe49f('0x44')],{'$or':_[_0xe49f('0x2b')](_0xd9a42e['attributes'],function(_0x3fabf5){var _0x5b792b={};_0x5b792b[_0x3fabf5]={'$like':'%'+_0x39af3c['query'][_0xe49f('0x46')]+'%'};return _0x5b792b;})});}_0xd9a42e=_['merge']({},_0xd9a42e,_0x39af3c[_0xe49f('0x49')]);return _0x45b43a[_0xe49f('0x99')](_0xd9a42e);}})['then'](function(_0x2f0971){if(_0x2f0971){_0x301e5a=_0x2f0971[_0xe49f('0x40')];if(!_0x39af3c['query'][_0xe49f('0x62')](_0xe49f('0x41'))){_0xd9a42e['limit']=qs[_0xe49f('0x1f')](_0x39af3c[_0xe49f('0x3a')][_0xe49f('0x1f')]);_0xd9a42e[_0xe49f('0x42')]=qs[_0xe49f('0x42')](_0x39af3c['query'][_0xe49f('0x42')]);}return _0x45b43a[_0xe49f('0x99')](_0xd9a42e);}})['then'](function(_0x5a37c7){if(_0x5a37c7){return _0x5a37c7?{'count':_0x301e5a,'rows':_0x5a37c7}:null;}})['then'](respondWithResult(_0x7e39aa,null))['catch'](handleError(_0x7e39aa,null));};exports[_0xe49f('0x9b')]=function(_0x302b80,_0x1a085d,_0x30692a){var _0x216e94={};var _0x17a628={};var _0xf07e56;var _0x4b1446;return db[_0xe49f('0x35')][_0xe49f('0x61')]({'where':{'id':_0x302b80['params']['id']}})[_0xe49f('0x26')](handleEntityNotFound(_0x1a085d,null))['then'](function(_0x6834ec){if(_0x6834ec){_0xf07e56=_0x6834ec;_0x17a628[_0xe49f('0x39')]=_['keys'](db[_0xe49f('0x7c')][_0xe49f('0x36')]);_0x17a628[_0xe49f('0x3a')]=_[_0xe49f('0x3b')](_0x302b80['query']);_0x17a628[_0xe49f('0x3c')]=_[_0xe49f('0x3d')](_0x17a628[_0xe49f('0x39')],_0x17a628['query']);_0x216e94['attributes']=_[_0xe49f('0x3d')](_0x17a628[_0xe49f('0x39')],qs[_0xe49f('0x3f')](_0x302b80[_0xe49f('0x3a')][_0xe49f('0x3f')]));_0x216e94[_0xe49f('0x3e')]=_0x216e94['attributes'][_0xe49f('0x40')]?_0x216e94[_0xe49f('0x3e')]:_0x17a628[_0xe49f('0x39')];_0x216e94[_0xe49f('0x63')]=qs[_0xe49f('0x43')](_0x302b80[_0xe49f('0x3a')]['sort']);_0x216e94[_0xe49f('0x44')]=qs[_0xe49f('0x3c')](_[_0xe49f('0x45')](_0x302b80[_0xe49f('0x3a')],_0x17a628['filters']));if(_0x302b80[_0xe49f('0x3a')][_0xe49f('0x46')]){_0x216e94[_0xe49f('0x44')]=_[_0xe49f('0x47')](_0x216e94['where'],{'$or':_[_0xe49f('0x2b')](_0x216e94[_0xe49f('0x3e')],function(_0x126a63){var _0x3ec68f={};_0x3ec68f[_0x126a63]={'$like':'%'+_0x302b80['query'][_0xe49f('0x46')]+'%'};return _0x3ec68f;})});}_0x216e94=_[_0xe49f('0x47')]({},_0x216e94,_0x302b80['options']);return _0xf07e56[_0xe49f('0x9b')](_0x216e94);}})['then'](function(_0x5764ad){if(_0x5764ad){_0x4b1446=_0x5764ad[_0xe49f('0x40')];if(!_0x302b80[_0xe49f('0x3a')][_0xe49f('0x62')](_0xe49f('0x41'))){_0x216e94[_0xe49f('0x1f')]=qs[_0xe49f('0x1f')](_0x302b80[_0xe49f('0x3a')][_0xe49f('0x1f')]);_0x216e94['offset']=qs[_0xe49f('0x42')](_0x302b80['query'][_0xe49f('0x42')]);}return _0xf07e56['getMembers'](_0x216e94);}})[_0xe49f('0x26')](function(_0x559d0a){return _0x559d0a?{'count':_0x4b1446,'rows':_0x559d0a}:null;})[_0xe49f('0x26')](respondWithResult(_0x1a085d,null))[_0xe49f('0x50')](handleError(_0x1a085d,null));};exports['getLists']=function(_0x383bd5,_0x5cf8a4,_0x3ef462){var _0x5cff8d={};var _0x1c5729={};var _0x4bcc03;var _0x20e599;return db[_0xe49f('0x35')][_0xe49f('0x61')]({'where':{'id':_0x383bd5[_0xe49f('0x4e')]['id']}})[_0xe49f('0x26')](handleEntityNotFound(_0x5cf8a4,null))[_0xe49f('0x26')](function(_0x281207){if(_0x281207){_0x4bcc03=_0x281207;_0x1c5729[_0xe49f('0x39')]=_['keys'](db[_0xe49f('0x9c')]['rawAttributes']);_0x1c5729[_0xe49f('0x3a')]=_[_0xe49f('0x3b')](_0x383bd5[_0xe49f('0x3a')]);_0x1c5729['filters']=_[_0xe49f('0x3d')](_0x1c5729[_0xe49f('0x39')],_0x1c5729[_0xe49f('0x3a')]);_0x5cff8d['attributes']=_[_0xe49f('0x3d')](_0x1c5729[_0xe49f('0x39')],qs[_0xe49f('0x3f')](_0x383bd5[_0xe49f('0x3a')][_0xe49f('0x3f')]));_0x5cff8d['attributes']=_0x5cff8d['attributes'][_0xe49f('0x40')]?_0x5cff8d[_0xe49f('0x3e')]:_0x1c5729[_0xe49f('0x39')];_0x5cff8d['order']=qs[_0xe49f('0x43')](_0x383bd5[_0xe49f('0x3a')]['sort']);_0x5cff8d['where']=qs[_0xe49f('0x3c')](_['pick'](_0x383bd5[_0xe49f('0x3a')],_0x1c5729[_0xe49f('0x3c')]));if(_0x383bd5['query']['filter']){_0x5cff8d[_0xe49f('0x44')]=_['merge'](_0x5cff8d[_0xe49f('0x44')],{'$or':_[_0xe49f('0x2b')](_0x5cff8d[_0xe49f('0x3e')],function(_0x45e0b1){var _0x138fd0={};_0x138fd0[_0x45e0b1]={'$like':'%'+_0x383bd5[_0xe49f('0x3a')]['filter']+'%'};return _0x138fd0;})});}_0x5cff8d=_[_0xe49f('0x47')]({},_0x5cff8d,_0x383bd5['options']);return _0x4bcc03[_0xe49f('0x9d')](_0x5cff8d);}})['then'](function(_0x566b76){if(_0x566b76){_0x20e599=_0x566b76[_0xe49f('0x40')];if(!_0x383bd5[_0xe49f('0x3a')]['hasOwnProperty']('nolimit')){_0x5cff8d[_0xe49f('0x1f')]=qs['limit'](_0x383bd5[_0xe49f('0x3a')][_0xe49f('0x1f')]);_0x5cff8d[_0xe49f('0x42')]=qs['offset'](_0x383bd5[_0xe49f('0x3a')][_0xe49f('0x42')]);}return _0x4bcc03[_0xe49f('0x9d')](_0x5cff8d);}})['then'](function(_0x5eb795){if(_0x5eb795){return _0x5eb795?{'count':_0x20e599,'rows':_0x5eb795}:null;}})['then'](respondWithResult(_0x5cf8a4,null))[_0xe49f('0x50')](handleError(_0x5cf8a4,null));};exports[_0xe49f('0x9e')]=function(_0x21ed01,_0x21c32a,_0x7b7496){var _0x5423cb=moment()[_0xe49f('0x97')](_0xe49f('0x9f'));var _0x47aa7a,_0x4a593b;return db['VoiceQueue'][_0xe49f('0x2e')]({'where':{'id':_0x21ed01['params']['id']}})[_0xe49f('0x26')](handleEntityNotFound(_0x21c32a,null))['then'](function(_0x3d7980){if(_0x3d7980){_0x4a593b=_0x3d7980;return _0x3d7980[_0xe49f('0x9e')](_0x21ed01[_0xe49f('0x52')]['ids'],_[_0xe49f('0x5c')](_0x21ed01[_0xe49f('0x52')],[_0xe49f('0x82'),'id'])||{});}return null;})[_0xe49f('0x95')](function(_0x1279cb){var _0x5a3d16;_0x47aa7a=_0x1279cb||[];var _0xe44568=[];if(_0x1279cb){for(var _0x16069b=0x0;_0x16069b<_0x1279cb[_0xe49f('0x40')];_0x16069b+=0x1){var _0xb26c6e=_0x1279cb[_0x16069b]['get']({'plain':!![]});_0x4a593b[_0xe49f('0xa0')]=_0x21ed01[_0xe49f('0x52')][_0xe49f('0xa0')]?_0x21ed01[_0xe49f('0x52')][_0xe49f('0xa0')]:_0x4a593b['dialCheckDuplicateType'];switch(_0x4a593b[_0xe49f('0xa0')]){case _0xe49f('0xa1'):_0x5a3d16=squel[_0xe49f('0xa2')]()[_0xe49f('0xa3')](_0xe49f('0xa4'))[_0xe49f('0xa5')]([_0xe49f('0xa6'),_0xe49f('0xa7'),_0xe49f('0xa8'),_0xe49f('0xa9'),_0xe49f('0x67'),'createdAt',_0xe49f('0x5e')],squel[_0xe49f('0x83')]()[_0xe49f('0x84')](_0xe49f('0xa6'),_0xe49f('0xa6'))[_0xe49f('0x84')]('\x27'+_0x5423cb+'\x27',_0xe49f('0xa7'))[_0xe49f('0x84')]('id',_0xe49f('0xa8'))[_0xe49f('0x84')](_0xb26c6e[_0xe49f('0xaa')][_0xe49f('0x8c')](),_0xe49f('0xa9'))[_0xe49f('0x84')](_0x21ed01['params']['id'][_0xe49f('0x8c')](),_0xe49f('0x67'))[_0xe49f('0x84')]('\x27'+_0x5423cb+'\x27','createdAt')[_0xe49f('0x84')]('\x27'+_0x5423cb+'\x27','updatedAt')[_0xe49f('0x86')](_0xe49f('0xab'))[_0xe49f('0x44')](_0xe49f('0xac'))['where'](_0xe49f('0xad'),_0xb26c6e[_0xe49f('0xaa')]['toString']())['where'](_0xe49f('0xae'))[_0xe49f('0x44')](_0xe49f('0xaf'),squel[_0xe49f('0x83')]()['field'](_0xe49f('0xb0'))['from']('cm_hopper_final')[_0xe49f('0x44')](_0xe49f('0x89'),_0x21ed01['params']['id'][_0xe49f('0x8c')]()))[_0xe49f('0x44')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xe49f('0x84')]('COALESCE(phone,\x27\x27)')['from'](_0xe49f('0xa4'))[_0xe49f('0x44')]('VoiceQueueId\x20=\x20?',_0x21ed01['params']['id']['toString']())))['toString']();break;case _0xe49f('0xb1'):_0x5a3d16=squel[_0xe49f('0xa2')]()[_0xe49f('0xa3')](_0xe49f('0xa4'))['fromQuery']([_0xe49f('0xa6'),_0xe49f('0xa7'),_0xe49f('0xa8'),_0xe49f('0xa9'),_0xe49f('0x67'),'createdAt',_0xe49f('0x5e')],squel[_0xe49f('0x83')]()['field'](_0xe49f('0xa6'),_0xe49f('0xa6'))[_0xe49f('0x84')]('\x27'+_0x5423cb+'\x27',_0xe49f('0xa7'))[_0xe49f('0x84')]('id',_0xe49f('0xa8'))[_0xe49f('0x84')](_0xb26c6e[_0xe49f('0xaa')]['toString'](),_0xe49f('0xa9'))[_0xe49f('0x84')](_0x21ed01[_0xe49f('0x4e')]['id'][_0xe49f('0x8c')](),'VoiceQueueId')[_0xe49f('0x84')]('\x27'+_0x5423cb+'\x27','createdAt')[_0xe49f('0x84')]('\x27'+_0x5423cb+'\x27',_0xe49f('0x5e'))[_0xe49f('0x86')](_0xe49f('0xab'))[_0xe49f('0x44')](_0xe49f('0xac'))[_0xe49f('0x44')](_0xe49f('0xad'),_0xb26c6e[_0xe49f('0xaa')][_0xe49f('0x8c')]())[_0xe49f('0x44')](_0xe49f('0xae'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xe49f('0x83')]()[_0xe49f('0x84')]('COALESCE(phone,\x27\x27)')[_0xe49f('0x86')]('cm_hopper')['where'](_0xe49f('0x89'),_0x21ed01[_0xe49f('0x4e')]['id'][_0xe49f('0x8c')]())))[_0xe49f('0x8c')]();break;default:_0x5a3d16=squel['insert']()[_0xe49f('0xa3')](_0xe49f('0xa4'))[_0xe49f('0xa5')](['phone','scheduledAt',_0xe49f('0xa8'),'ListId',_0xe49f('0x67'),'createdAt',_0xe49f('0x5e')],squel[_0xe49f('0x83')]()[_0xe49f('0x84')](_0xe49f('0xa6'),_0xe49f('0xa6'))[_0xe49f('0x84')]('\x27'+_0x5423cb+'\x27',_0xe49f('0xa7'))['field']('id','ContactId')[_0xe49f('0x84')](_0xb26c6e[_0xe49f('0xaa')][_0xe49f('0x8c')](),_0xe49f('0xa9'))[_0xe49f('0x84')](_0x21ed01[_0xe49f('0x4e')]['id'][_0xe49f('0x8c')](),_0xe49f('0x67'))[_0xe49f('0x84')]('\x27'+_0x5423cb+'\x27',_0xe49f('0x5d'))['field']('\x27'+_0x5423cb+'\x27',_0xe49f('0x5e'))['from'](_0xe49f('0xab'))['where'](_0xe49f('0xac'))['where'](_0xe49f('0xad'),_0xb26c6e[_0xe49f('0xaa')]['toString']())[_0xe49f('0x44')](_0xe49f('0xae')))['toString']();}_0xe44568[_0xe49f('0x8b')](db[_0xe49f('0x75')][_0xe49f('0x3a')](_0x5a3d16));}return BPromise[_0xe49f('0x98')](_0xe44568);}})['then'](function(){var _0x1ae0cc=[];var _0x4987de=squel['insert']()[_0xe49f('0xa3')](_0xe49f('0xb2'))['fromQuery']([_0xe49f('0xb3'),_0xe49f('0xa6'),_0xe49f('0xb4'),_0xe49f('0x5d'),_0xe49f('0x5e')],squel[_0xe49f('0x83')]()[_0xe49f('0x84')](_0xe49f('0xb5'))[_0xe49f('0x84')](_0xe49f('0xb6'))[_0xe49f('0x84')](_0xe49f('0xb7'))['field']('\x27'+_0x5423cb+'\x27',_0xe49f('0x5d'))['field']('\x27'+_0x5423cb+'\x27',_0xe49f('0x5e'))[_0xe49f('0x86')]('cm_contact_has_items','ci')[_0xe49f('0xb8')](_0xe49f('0xa4'),'h',_0xe49f('0xb9'))[_0xe49f('0x44')](_0xe49f('0xba'),_0x5423cb)[_0xe49f('0x44')](_0xe49f('0xbb'),'PHONE'))[_0xe49f('0x8c')]();_0x1ae0cc[_0xe49f('0x8b')](db['sequelize'][_0xe49f('0x3a')](_0x4987de));return BPromise[_0xe49f('0x98')](_0x1ae0cc);})['then'](function(){return _0x47aa7a;})[_0xe49f('0x26')](respondWithResult(_0x21c32a,null))[_0xe49f('0x50')](handleError(_0x21c32a,null));};exports[_0xe49f('0xbc')]=function(_0xac8f1f,_0x3741b5,_0x4aefea){return db[_0xe49f('0x35')][_0xe49f('0x2e')]({'where':{'id':_0xac8f1f[_0xe49f('0x4e')]['id']}})[_0xe49f('0x26')](handleEntityNotFound(_0x3741b5,null))[_0xe49f('0x26')](function(_0x2606f3){if(_0x2606f3){return _0x2606f3[_0xe49f('0xbc')](_0xac8f1f[_0xe49f('0x3a')][_0xe49f('0x82')]);}})[_0xe49f('0x26')](function(_0x1915e3){if(_0x1915e3){return db[_0xe49f('0x64')]['destroy']({'where':{'ListId':_0xac8f1f[_0xe49f('0x3a')][_0xe49f('0x82')],'VoiceQueueId':_0xac8f1f['params']['id']}})['then'](function(){return _0x1915e3;});}})['then'](respondWithStatusCode(_0x3741b5,null))[_0xe49f('0x50')](handleError(_0x3741b5,null));};exports[_0xe49f('0xbd')]=function(_0x361327,_0x51561e,_0x33df5b){var _0x5de6f8={};var _0x29a1ae={};var _0x370c83;var _0x2a9045;return db[_0xe49f('0x35')][_0xe49f('0x61')]({'where':{'id':_0x361327['params']['id']}})[_0xe49f('0x26')](handleEntityNotFound(_0x51561e,null))['then'](function(_0x1440f0){if(_0x1440f0){_0x370c83=_0x1440f0;_0x29a1ae[_0xe49f('0x39')]=_[_0xe49f('0x3b')](db[_0xe49f('0x9c')][_0xe49f('0x36')]);_0x29a1ae[_0xe49f('0x3a')]=_[_0xe49f('0x3b')](_0x361327[_0xe49f('0x3a')]);_0x29a1ae['filters']=_[_0xe49f('0x3d')](_0x29a1ae['model'],_0x29a1ae['query']);_0x5de6f8[_0xe49f('0x3e')]=_[_0xe49f('0x3d')](_0x29a1ae[_0xe49f('0x39')],qs[_0xe49f('0x3f')](_0x361327[_0xe49f('0x3a')][_0xe49f('0x3f')]));_0x5de6f8[_0xe49f('0x3e')]=_0x5de6f8['attributes']['length']?_0x5de6f8[_0xe49f('0x3e')]:_0x29a1ae[_0xe49f('0x39')];_0x5de6f8['order']=qs[_0xe49f('0x43')](_0x361327['query'][_0xe49f('0x43')]);_0x5de6f8['where']=qs[_0xe49f('0x3c')](_[_0xe49f('0x45')](_0x361327[_0xe49f('0x3a')],_0x29a1ae[_0xe49f('0x3c')]));if(_0x361327[_0xe49f('0x3a')][_0xe49f('0x46')]){_0x5de6f8[_0xe49f('0x44')]=_[_0xe49f('0x47')](_0x5de6f8[_0xe49f('0x44')],{'$or':_[_0xe49f('0x2b')](_0x5de6f8[_0xe49f('0x3e')],function(_0x100326){var _0x4c30d2={};_0x4c30d2[_0x100326]={'$like':'%'+_0x361327[_0xe49f('0x3a')]['filter']+'%'};return _0x4c30d2;})});}_0x5de6f8=_['merge']({},_0x5de6f8,_0x361327[_0xe49f('0x49')]);return _0x370c83[_0xe49f('0xbd')](_0x5de6f8);}})[_0xe49f('0x26')](function(_0x55996a){if(_0x55996a){_0x2a9045=_0x55996a[_0xe49f('0x40')];if(!_0x361327[_0xe49f('0x3a')][_0xe49f('0x62')](_0xe49f('0x41'))){_0x5de6f8[_0xe49f('0x1f')]=qs['limit'](_0x361327[_0xe49f('0x3a')][_0xe49f('0x1f')]);_0x5de6f8[_0xe49f('0x42')]=qs['offset'](_0x361327[_0xe49f('0x3a')][_0xe49f('0x42')]);}return _0x370c83[_0xe49f('0xbd')](_0x5de6f8);}})[_0xe49f('0x26')](function(_0x2f6ebe){if(_0x2f6ebe){return _0x2f6ebe?{'count':_0x2a9045,'rows':_0x2f6ebe}:null;}})['then'](respondWithResult(_0x51561e,null))[_0xe49f('0x50')](handleError(_0x51561e,null));};exports[_0xe49f('0xbe')]=function(_0x3d8746,_0x183169,_0x14b4f2){var _0x50b520,_0x47a07f;return db[_0xe49f('0x35')][_0xe49f('0x2e')]({'where':{'id':_0x3d8746[_0xe49f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x183169,null))[_0xe49f('0x26')](function(_0x5813f2){if(_0x5813f2){_0x47a07f=_0x5813f2;return _0x5813f2[_0xe49f('0xbe')](_0x3d8746['body'][_0xe49f('0x82')],_[_0xe49f('0x5c')](_0x3d8746[_0xe49f('0x52')],['ids','id'])||{});}return null;})[_0xe49f('0x95')](function(_0x147b9e){var _0xcd0de7;_0x50b520=_0x147b9e||[];var _0x15ac6d=[];if(_0x147b9e){for(var _0x1b8cc7=0x0;_0x1b8cc7<_0x147b9e['length'];_0x1b8cc7+=0x1){var _0x1e9f01=_0x147b9e[_0x1b8cc7][_0xe49f('0x53')]({'plain':!![]});_0xcd0de7=squel['insert']()[_0xe49f('0xa3')](_0xe49f('0xbf'))[_0xe49f('0xa5')](['phone',_0xe49f('0xa8'),_0xe49f('0xa9'),_0xe49f('0x67'),_0xe49f('0x5d'),'updatedAt'],squel[_0xe49f('0x83')]()['field'](_0xe49f('0xa6'),_0xe49f('0xa6'))[_0xe49f('0x84')]('id',_0xe49f('0xa8'))[_0xe49f('0x84')](_0x1e9f01[_0xe49f('0xaa')][_0xe49f('0x8c')](),_0xe49f('0xa9'))[_0xe49f('0x84')](_0x3d8746[_0xe49f('0x4e')]['id'][_0xe49f('0x8c')](),_0xe49f('0x67'))[_0xe49f('0x84')](_0xe49f('0xc0'),_0xe49f('0x5d'))['field'](_0xe49f('0xc0'),_0xe49f('0x5e'))[_0xe49f('0x86')](_0xe49f('0xab'))[_0xe49f('0x44')]('deletedAt\x20IS\x20NULL')['where'](_0xe49f('0xad'),_0x1e9f01[_0xe49f('0xaa')][_0xe49f('0x8c')]())['where'](_0xe49f('0xae')))[_0xe49f('0x8c')]();_0x15ac6d[_0xe49f('0x8b')](db[_0xe49f('0x75')][_0xe49f('0x3a')](_0xcd0de7));}return BPromise['all'](_0x15ac6d);}})['then'](function(){return _0x50b520;})[_0xe49f('0x26')](respondWithResult(_0x183169,null))[_0xe49f('0x50')](handleError(_0x183169,null));};exports[_0xe49f('0xc1')]=function(_0x1b7580,_0x340938,_0x2c143f){return db[_0xe49f('0x35')][_0xe49f('0x2e')]({'where':{'id':_0x1b7580[_0xe49f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x340938,null))[_0xe49f('0x26')](function(_0x542885){if(_0x542885){return _0x542885[_0xe49f('0xc1')](_0x1b7580[_0xe49f('0x3a')][_0xe49f('0x82')]);}})[_0xe49f('0x26')](function(_0x4e3041){if(_0x4e3041){return db[_0xe49f('0x6b')][_0xe49f('0x30')]({'where':{'ListId':_0x1b7580[_0xe49f('0x3a')][_0xe49f('0x82')],'VoiceQueueId':_0x1b7580[_0xe49f('0x4e')]['id']}})[_0xe49f('0x26')](function(){return _0x4e3041;});}})['then'](respondWithStatusCode(_0x340938,null))[_0xe49f('0x50')](handleError(_0x340938,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index ff3f31a..d0629e6 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 _0xc383=['save','update','remove','emit','hasOwnProperty','hook','exports','VoiceQueue','setMaxListeners'];(function(_0x1472d4,_0x51b147){var _0x44ad14=function(_0x43b058){while(--_0x43b058){_0x1472d4['push'](_0x1472d4['shift']());}};_0x44ad14(++_0x51b147);}(_0xc383,0x11e));var _0x3c38=function(_0x5ed8e2,_0x4d1edf){_0x5ed8e2=_0x5ed8e2-0x0;var _0x5056fd=_0xc383[_0x5ed8e2];return _0x5056fd;};'use strict';var EventEmitter=require('events');var VoiceQueue=require('../../mysqldb')['db'][_0x3c38('0x0')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x3c38('0x1')](0x0);var events={'afterCreate':_0x3c38('0x2'),'afterUpdate':_0x3c38('0x3'),'afterDestroy':_0x3c38('0x4')};function emitEvent(_0x516264){return function(_0x37311f,_0x46b27c,_0x14a897){VoiceQueueEvents['emit'](_0x516264+':'+_0x37311f['id'],_0x37311f);VoiceQueueEvents[_0x3c38('0x5')](_0x516264,_0x37311f);_0x14a897(null);};}for(var e in events){if(events[_0x3c38('0x6')](e)){var event=events[e];VoiceQueue[_0x3c38('0x7')](e,emitEvent(event));}}module[_0x3c38('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0x8a61=['setMaxListeners','save','update','remove','emit','exports','events','../../mysqldb','VoiceQueue'];(function(_0x3173c5,_0xd3b316){var _0x531ecd=function(_0x20ce58){while(--_0x20ce58){_0x3173c5['push'](_0x3173c5['shift']());}};_0x531ecd(++_0xd3b316);}(_0x8a61,0x1b6));var _0x18a6=function(_0x16bb60,_0x642047){_0x16bb60=_0x16bb60-0x0;var _0xf15848=_0x8a61[_0x16bb60];return _0xf15848;};'use strict';var EventEmitter=require(_0x18a6('0x0'));var VoiceQueue=require(_0x18a6('0x1'))['db'][_0x18a6('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x18a6('0x3')](0x0);var events={'afterCreate':_0x18a6('0x4'),'afterUpdate':_0x18a6('0x5'),'afterDestroy':_0x18a6('0x6')};function emitEvent(_0x2019ec){return function(_0x31f806,_0x47721f,_0x1f4078){VoiceQueueEvents[_0x18a6('0x7')](_0x2019ec+':'+_0x31f806['id'],_0x31f806);VoiceQueueEvents[_0x18a6('0x7')](_0x2019ec,_0x31f806);_0x1f4078(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x18a6('0x8')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 7a6f9aa..a5fbbc5 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 _0x008c=['define','voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0xed4881,_0x45771c){var _0x7fcbd5=function(_0x36b960){while(--_0x36b960){_0xed4881['push'](_0xed4881['shift']());}};_0x7fcbd5(++_0x45771c);}(_0x008c,0x188));var _0xc008=function(_0x374dd6,_0xadc0eb){_0x374dd6=_0x374dd6-0x0;var _0x1aadd0=_0x008c[_0x374dd6];return _0x1aadd0;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('VoiceQueue',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','util'];(function(_0x7b441c,_0x3b75d9){var _0x140168=function(_0xeaf35f){while(--_0xeaf35f){_0x7b441c['push'](_0x7b441c['shift']());}};_0x140168(++_0x3b75d9);}(_0xedd9,0xfc));var _0x9edd=function(_0x28e5f7,_0x18ce28){_0x28e5f7=_0x28e5f7-0x0;var _0x1ba4de=_0xedd9[_0x28e5f7];return _0x1ba4de;};'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 7451bd7..18bba30 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 _0xcbc1=['where','limit','include','map','attributes','model','info','GetVoiceQueue','stringify','ShowVoiceQueue','find','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./voiceQueue.socket','register','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','VoiceQueue','options','raw'];(function(_0x1ecab2,_0x2d30e4){var _0x57c21d=function(_0x1fbe59){while(--_0x1fbe59){_0x1ecab2['push'](_0x1ecab2['shift']());}};_0x57c21d(++_0x2d30e4);}(_0xcbc1,0x7d));var _0x1cbc=function(_0x2e84f6,_0x5354c8){_0x2e84f6=_0x2e84f6-0x0;var _0x59d210=_0xcbc1[_0x2e84f6];return _0x59d210;};'use strict';var _=require(_0x1cbc('0x0'));var util=require(_0x1cbc('0x1'));var moment=require('moment');var BPromise=require(_0x1cbc('0x2'));var rs=require(_0x1cbc('0x3'));var fs=require('fs');var Redis=require(_0x1cbc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cbc('0x5'));var logger=require(_0x1cbc('0x6'))(_0x1cbc('0x7'));var config=require(_0x1cbc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1cbc('0x9')][_0x1cbc('0xa')]({'port':0x232a});config[_0x1cbc('0xb')]=_[_0x1cbc('0xc')](config[_0x1cbc('0xb')],{'host':_0x1cbc('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1cbc('0xb')]));require(_0x1cbc('0xe'))[_0x1cbc('0xf')](socket);function respondWithRpcPromise(_0x1b001f,_0x4098b2,_0x47b179){return new BPromise(function(_0x3cdd71,_0xa65f58){return client['request'](_0x1b001f,_0x47b179)[_0x1cbc('0x10')](function(_0x2218c1){logger['info'](_0x1cbc('0x11'),_0x4098b2,_0x1cbc('0x12'));logger[_0x1cbc('0x13')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x4098b2,_0x1cbc('0x12'),JSON['stringify'](_0x2218c1));if(_0x2218c1['error']){if(_0x2218c1[_0x1cbc('0x14')]['code']===0x1f4){logger[_0x1cbc('0x14')](_0x1cbc('0x11'),_0x4098b2,_0x2218c1[_0x1cbc('0x14')][_0x1cbc('0x15')]);return _0xa65f58(_0x2218c1['error'][_0x1cbc('0x15')]);}logger[_0x1cbc('0x14')](_0x1cbc('0x11'),_0x4098b2,_0x2218c1[_0x1cbc('0x14')]['message']);return _0x3cdd71(_0x2218c1[_0x1cbc('0x14')][_0x1cbc('0x15')]);}else{logger['info']('VoiceQueue,\x20%s,\x20%s',_0x4098b2,_0x1cbc('0x12'));_0x3cdd71(_0x2218c1[_0x1cbc('0x16')][_0x1cbc('0x15')]);}})[_0x1cbc('0x17')](function(_0x2f44ba){logger['error'](_0x1cbc('0x11'),_0x4098b2,_0x2f44ba);_0xa65f58(_0x2f44ba);});});}exports['GetVoiceQueue']=function(_0x6ea727){var _0x1d6eed=this;return new Promise(function(_0x456247,_0x82f194){return db[_0x1cbc('0x18')]['findAll']({'raw':_0x6ea727[_0x1cbc('0x19')]?_0x6ea727[_0x1cbc('0x19')][_0x1cbc('0x1a')]===undefined?!![]:![]:!![],'where':_0x6ea727[_0x1cbc('0x19')]?_0x6ea727[_0x1cbc('0x19')][_0x1cbc('0x1b')]||null:null,'attributes':_0x6ea727[_0x1cbc('0x19')]?_0x6ea727['options']['attributes']||null:null,'limit':_0x6ea727[_0x1cbc('0x19')]?_0x6ea727[_0x1cbc('0x19')][_0x1cbc('0x1c')]||null:null,'include':_0x6ea727[_0x1cbc('0x19')]?_0x6ea727[_0x1cbc('0x19')][_0x1cbc('0x1d')]?_[_0x1cbc('0x1e')](_0x6ea727['options'][_0x1cbc('0x1d')],function(_0x219c45){return{'model':db[_0x219c45['model']],'as':_0x219c45['as'],'attributes':_0x219c45[_0x1cbc('0x1f')],'include':_0x219c45[_0x1cbc('0x1d')]?_['map'](_0x219c45[_0x1cbc('0x1d')],function(_0x53b147){return{'model':db[_0x53b147['model']],'as':_0x53b147['as'],'attributes':_0x53b147['attributes'],'include':_0x53b147[_0x1cbc('0x1d')]?_[_0x1cbc('0x1e')](_0x53b147['include'],function(_0x1413e4){return{'model':db[_0x1413e4[_0x1cbc('0x20')]],'as':_0x1413e4['as'],'attributes':_0x1413e4[_0x1cbc('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1cbc('0x10')](function(_0x34086c){logger[_0x1cbc('0x21')](_0x1cbc('0x22'),_0x6ea727);logger[_0x1cbc('0x13')](_0x1cbc('0x22'),_0x6ea727,JSON[_0x1cbc('0x23')](_0x34086c));_0x456247(_0x34086c);})['catch'](function(_0x432d01){logger[_0x1cbc('0x14')]('GetVoiceQueue',_0x432d01['message'],_0x6ea727);_0x82f194(_0x1d6eed['error'](0x1f4,_0x432d01[_0x1cbc('0x15')]));});});};exports[_0x1cbc('0x24')]=function(_0xc51158){var _0x168369=this;return new Promise(function(_0x231193,_0x27c4b1){return db['VoiceQueue'][_0x1cbc('0x25')]({'raw':_0xc51158[_0x1cbc('0x19')]?_0xc51158[_0x1cbc('0x19')][_0x1cbc('0x1a')]===undefined?!![]:![]:!![],'where':_0xc51158['options']?_0xc51158['options'][_0x1cbc('0x1b')]||null:null,'attributes':_0xc51158[_0x1cbc('0x19')]?_0xc51158[_0x1cbc('0x19')]['attributes']||null:null,'include':_0xc51158[_0x1cbc('0x19')]?_0xc51158[_0x1cbc('0x19')]['include']?_[_0x1cbc('0x1e')](_0xc51158[_0x1cbc('0x19')]['include'],function(_0x31f937){return{'model':db[_0x31f937[_0x1cbc('0x20')]],'as':_0x31f937['as'],'attributes':_0x31f937[_0x1cbc('0x1f')],'include':_0x31f937[_0x1cbc('0x1d')]?_[_0x1cbc('0x1e')](_0x31f937[_0x1cbc('0x1d')],function(_0x450d8b){return{'model':db[_0x450d8b[_0x1cbc('0x20')]],'as':_0x450d8b['as'],'attributes':_0x450d8b[_0x1cbc('0x1f')],'include':_0x450d8b['include']?_[_0x1cbc('0x1e')](_0x450d8b[_0x1cbc('0x1d')],function(_0x583deb){return{'model':db[_0x583deb['model']],'as':_0x583deb['as'],'attributes':_0x583deb['attributes']};}):[]};}):[]};}):[]:[]})[_0x1cbc('0x10')](function(_0x2396cb){logger[_0x1cbc('0x21')](_0x1cbc('0x24'),_0xc51158);logger[_0x1cbc('0x13')](_0x1cbc('0x24'),_0xc51158,JSON[_0x1cbc('0x23')](_0x2396cb));_0x231193(_0x2396cb);})[_0x1cbc('0x17')](function(_0x466523){logger['error'](_0x1cbc('0x24'),_0x466523[_0x1cbc('0x15')],_0xc51158);_0x27c4b1(_0x168369[_0x1cbc('0x14')](0x1f4,_0x466523[_0x1cbc('0x15')]));});});}; \ No newline at end of file +var _0x5053=['stringify','ShowVoiceQueue','find','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','attributes','limit','include','map','model'];(function(_0x566098,_0x23a0f4){var _0x52e799=function(_0x363440){while(--_0x363440){_0x566098['push'](_0x566098['shift']());}};_0x52e799(++_0x23a0f4);}(_0x5053,0xfa));var _0x3505=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x5053[_0x373dee];return _0x46798f;};'use strict';var _=require('lodash');var util=require(_0x3505('0x0'));var moment=require(_0x3505('0x1'));var BPromise=require(_0x3505('0x2'));var rs=require(_0x3505('0x3'));var fs=require('fs');var Redis=require(_0x3505('0x4'));var db=require(_0x3505('0x5'))['db'];var utils=require(_0x3505('0x6'));var logger=require(_0x3505('0x7'))(_0x3505('0x8'));var config=require(_0x3505('0x9'));var jayson=require(_0x3505('0xa'));var client=jayson[_0x3505('0xb')][_0x3505('0xc')]({'port':0x232a});config[_0x3505('0xd')]=_[_0x3505('0xe')](config[_0x3505('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x3505('0xf'))(new Redis(config[_0x3505('0xd')]));require('./voiceQueue.socket')[_0x3505('0x10')](socket);function respondWithRpcPromise(_0x4e7258,_0x22d398,_0x243654){return new BPromise(function(_0x588024,_0x17ac36){return client[_0x3505('0x11')](_0x4e7258,_0x243654)['then'](function(_0x22754d){logger[_0x3505('0x12')](_0x3505('0x13'),_0x22d398,_0x3505('0x14'));logger[_0x3505('0x15')](_0x3505('0x16'),_0x22d398,_0x3505('0x14'),JSON['stringify'](_0x22754d));if(_0x22754d[_0x3505('0x17')]){if(_0x22754d[_0x3505('0x17')]['code']===0x1f4){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x22d398,_0x22754d[_0x3505('0x17')][_0x3505('0x18')]);return _0x17ac36(_0x22754d[_0x3505('0x17')]['message']);}logger[_0x3505('0x17')](_0x3505('0x13'),_0x22d398,_0x22754d[_0x3505('0x17')][_0x3505('0x18')]);return _0x588024(_0x22754d[_0x3505('0x17')]['message']);}else{logger[_0x3505('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x22d398,'request\x20sent');_0x588024(_0x22754d[_0x3505('0x19')][_0x3505('0x18')]);}})[_0x3505('0x1a')](function(_0xa065af){logger[_0x3505('0x17')]('VoiceQueue,\x20%s,\x20%s',_0x22d398,_0xa065af);_0x17ac36(_0xa065af);});});}exports[_0x3505('0x1b')]=function(_0x40b14a){var _0x3c247c=this;return new Promise(function(_0x2617df,_0x4ab89a){return db[_0x3505('0x1c')][_0x3505('0x1d')]({'raw':_0x40b14a[_0x3505('0x1e')]?_0x40b14a[_0x3505('0x1e')][_0x3505('0x1f')]===undefined?!![]:![]:!![],'where':_0x40b14a[_0x3505('0x1e')]?_0x40b14a[_0x3505('0x1e')]['where']||null:null,'attributes':_0x40b14a[_0x3505('0x1e')]?_0x40b14a[_0x3505('0x1e')][_0x3505('0x20')]||null:null,'limit':_0x40b14a['options']?_0x40b14a[_0x3505('0x1e')][_0x3505('0x21')]||null:null,'include':_0x40b14a[_0x3505('0x1e')]?_0x40b14a[_0x3505('0x1e')][_0x3505('0x22')]?_[_0x3505('0x23')](_0x40b14a[_0x3505('0x1e')][_0x3505('0x22')],function(_0x2a9fb0){return{'model':db[_0x2a9fb0[_0x3505('0x24')]],'as':_0x2a9fb0['as'],'attributes':_0x2a9fb0[_0x3505('0x20')],'include':_0x2a9fb0[_0x3505('0x22')]?_['map'](_0x2a9fb0[_0x3505('0x22')],function(_0x5e0207){return{'model':db[_0x5e0207[_0x3505('0x24')]],'as':_0x5e0207['as'],'attributes':_0x5e0207[_0x3505('0x20')],'include':_0x5e0207['include']?_[_0x3505('0x23')](_0x5e0207[_0x3505('0x22')],function(_0x197f7c){return{'model':db[_0x197f7c['model']],'as':_0x197f7c['as'],'attributes':_0x197f7c[_0x3505('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x42ebcd){logger[_0x3505('0x12')](_0x3505('0x1b'),_0x40b14a);logger['debug'](_0x3505('0x1b'),_0x40b14a,JSON[_0x3505('0x25')](_0x42ebcd));_0x2617df(_0x42ebcd);})['catch'](function(_0x3acc32){logger['error'](_0x3505('0x1b'),_0x3acc32['message'],_0x40b14a);_0x4ab89a(_0x3c247c[_0x3505('0x17')](0x1f4,_0x3acc32[_0x3505('0x18')]));});});};exports[_0x3505('0x26')]=function(_0x1abae4){var _0xd2ed14=this;return new Promise(function(_0x1cc4c9,_0x3aca39){return db['VoiceQueue'][_0x3505('0x27')]({'raw':_0x1abae4[_0x3505('0x1e')]?_0x1abae4[_0x3505('0x1e')][_0x3505('0x1f')]===undefined?!![]:![]:!![],'where':_0x1abae4[_0x3505('0x1e')]?_0x1abae4[_0x3505('0x1e')]['where']||null:null,'attributes':_0x1abae4['options']?_0x1abae4['options']['attributes']||null:null,'include':_0x1abae4[_0x3505('0x1e')]?_0x1abae4[_0x3505('0x1e')]['include']?_['map'](_0x1abae4[_0x3505('0x1e')][_0x3505('0x22')],function(_0x2a0527){return{'model':db[_0x2a0527['model']],'as':_0x2a0527['as'],'attributes':_0x2a0527[_0x3505('0x20')],'include':_0x2a0527[_0x3505('0x22')]?_[_0x3505('0x23')](_0x2a0527[_0x3505('0x22')],function(_0x293613){return{'model':db[_0x293613[_0x3505('0x24')]],'as':_0x293613['as'],'attributes':_0x293613[_0x3505('0x20')],'include':_0x293613[_0x3505('0x22')]?_[_0x3505('0x23')](_0x293613[_0x3505('0x22')],function(_0x5d3a0d){return{'model':db[_0x5d3a0d['model']],'as':_0x5d3a0d['as'],'attributes':_0x5d3a0d['attributes']};}):[]};}):[]};}):[]:[]})[_0x3505('0x28')](function(_0x57f4d0){logger[_0x3505('0x12')](_0x3505('0x26'),_0x1abae4);logger['debug'](_0x3505('0x26'),_0x1abae4,JSON[_0x3505('0x25')](_0x57f4d0));_0x1cc4c9(_0x57f4d0);})[_0x3505('0x1a')](function(_0x3c3981){logger['error'](_0x3505('0x26'),_0x3c3981[_0x3505('0x18')],_0x1abae4);_0x3aca39(_0xd2ed14[_0x3505('0x17')](0x1f4,_0x3c3981[_0x3505('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 12d6832..9cd3045 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 _0x7bf1=['length','voiceQueue:','./voiceQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x4758f8,_0x4f5461){var _0x28b8e0=function(_0x400d6f){while(--_0x400d6f){_0x4758f8['push'](_0x4758f8['shift']());}};_0x28b8e0(++_0x4f5461);}(_0x7bf1,0x65));var _0x17bf=function(_0xc9521a,_0x1f3c0e){_0xc9521a=_0xc9521a-0x0;var _0x156e4c=_0x7bf1[_0xc9521a];return _0x156e4c;};'use strict';var VoiceQueueEvents=require(_0x17bf('0x0'));var events=[_0x17bf('0x1'),_0x17bf('0x2'),_0x17bf('0x3')];function createListener(_0x87574,_0x587b35){return function(_0x2a1928){_0x587b35[_0x17bf('0x4')](_0x87574,_0x2a1928);};}function removeListener(_0x29c12d,_0x175564){return function(){VoiceQueueEvents[_0x17bf('0x5')](_0x29c12d,_0x175564);};}exports[_0x17bf('0x6')]=function(_0x1733c4){for(var _0x2f89a6=0x0,_0x5c720f=events[_0x17bf('0x7')];_0x2f89a6<_0x5c720f;_0x2f89a6++){var _0x24e8b5=events[_0x2f89a6];var _0x5084f9=createListener(_0x17bf('0x8')+_0x24e8b5,_0x1733c4);VoiceQueueEvents['on'](_0x24e8b5,_0x5084f9);}}; \ No newline at end of file +var _0xf641=['voiceQueue:','./voiceQueue.events','remove','update','emit','removeListener','register'];(function(_0x560448,_0x2c1082){var _0x550276=function(_0x37e949){while(--_0x37e949){_0x560448['push'](_0x560448['shift']());}};_0x550276(++_0x2c1082);}(_0xf641,0x119));var _0x1f64=function(_0x1b2baf,_0x5e2a94){_0x1b2baf=_0x1b2baf-0x0;var _0x3d25a4=_0xf641[_0x1b2baf];return _0x3d25a4;};'use strict';var VoiceQueueEvents=require(_0x1f64('0x0'));var events=['save',_0x1f64('0x1'),_0x1f64('0x2')];function createListener(_0x297d0d,_0x539e35){return function(_0x7a72da){_0x539e35[_0x1f64('0x3')](_0x297d0d,_0x7a72da);};}function removeListener(_0x2ab882,_0xa3e6b0){return function(){VoiceQueueEvents[_0x1f64('0x4')](_0x2ab882,_0xa3e6b0);};}exports[_0x1f64('0x5')]=function(_0x2fbeb9){for(var _0x459ab7=0x0,_0xe63a49=events['length'];_0x459ab7<_0xe63a49;_0x459ab7++){var _0x591f36=events[_0x459ab7];var _0x29d403=createListener(_0x1f64('0x6')+_0x591f36,_0x2fbeb9);VoiceQueueEvents['on'](_0x591f36,_0x29d403);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 36e1e01..44c481d 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 _0xc151=['/:id','show','post','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/index'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc151,0xef));var _0x1c15=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc151[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x1c15('0x0'));var util=require(_0x1c15('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1c15('0x2'));var router=express[_0x1c15('0x3')]();var fs_extra=require(_0x1c15('0x4'));var auth=require(_0x1c15('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1c15('0x6'));var controller=require('./voiceQueueReport.controller');router[_0x1c15('0x7')]('/',auth[_0x1c15('0x8')](),controller[_0x1c15('0x9')]);router[_0x1c15('0x7')](_0x1c15('0xa'),auth[_0x1c15('0x8')](),controller[_0x1c15('0xb')]);router['get'](_0x1c15('0xc'),auth['isAuthenticated'](),controller['getVoiceQueuesReport']);router[_0x1c15('0x7')](_0x1c15('0xd'),auth['isAuthenticated'](),controller[_0x1c15('0xe')]);router[_0x1c15('0xf')]('/',auth[_0x1c15('0x8')](),controller['create']);router[_0x1c15('0x10')](_0x1c15('0xd'),auth['isAuthenticated'](),controller[_0x1c15('0x11')]);router[_0x1c15('0x12')](_0x1c15('0xd'),auth['isAuthenticated'](),controller[_0x1c15('0x13')]);module[_0x1c15('0x14')]=router; \ No newline at end of file +var _0x061a=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','index','get','/describe','/index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x358da3,_0x4c8e36){var _0x590e25=function(_0x1d6fce){while(--_0x1d6fce){_0x358da3['push'](_0x358da3['shift']());}};_0x590e25(++_0x4c8e36);}(_0x061a,0x13e));var _0xa061=function(_0x31a032,_0x329857){_0x31a032=_0x31a032-0x0;var _0x58e33d=_0x061a[_0x31a032];return _0x58e33d;};'use strict';var multer=require(_0xa061('0x0'));var util=require(_0xa061('0x1'));var path=require(_0xa061('0x2'));var timeout=require(_0xa061('0x3'));var express=require(_0xa061('0x4'));var router=express[_0xa061('0x5')]();var fs_extra=require(_0xa061('0x6'));var auth=require(_0xa061('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xa061('0x8'));var controller=require(_0xa061('0x9'));router['get']('/',auth[_0xa061('0xa')](),controller[_0xa061('0xb')]);router[_0xa061('0xc')](_0xa061('0xd'),auth[_0xa061('0xa')](),controller['describe']);router[_0xa061('0xc')](_0xa061('0xe'),auth[_0xa061('0xa')](),controller['getVoiceQueuesReport']);router['get'](_0xa061('0xf'),auth['isAuthenticated'](),controller[_0xa061('0x10')]);router[_0xa061('0x11')]('/',auth[_0xa061('0xa')](),controller[_0xa061('0x12')]);router[_0xa061('0x13')](_0xa061('0xf'),auth[_0xa061('0xa')](),controller[_0xa061('0x14')]);router['delete']('/:id',auth[_0xa061('0xa')](),controller[_0xa061('0x15')]);module[_0xa061('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 24c0308..fee99d0 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 _0x8e8d=['STRING','DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports'];(function(_0x459380,_0x47dfe4){var _0x1861b4=function(_0x2c0a06){while(--_0x2c0a06){_0x459380['push'](_0x459380['shift']());}};_0x1861b4(++_0x47dfe4);}(_0x8e8d,0x13d));var _0xd8e8=function(_0x525c10,_0x1838ad){_0x525c10=_0x525c10-0x0;var _0x52c798=_0x8e8d[_0x525c10];return _0x52c798;};'use strict';var Sequelize=require(_0xd8e8('0x0'));var moment=require(_0xd8e8('0x1'));module[_0xd8e8('0x2')]={'type':{'type':Sequelize[_0xd8e8('0x3')]},'uniqueid':{'type':Sequelize[_0xd8e8('0x3')]},'calleridnum':{'type':Sequelize[_0xd8e8('0x3')]},'calleridname':{'type':Sequelize[_0xd8e8('0x3')]},'queue':{'type':Sequelize[_0xd8e8('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0xd8e8('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0xd8e8('0x4')],'set':function(_0x14bfa1){var _0x310c8f=moment(_0x14bfa1);var _0x20c6e0=moment(this[_0xd8e8('0x5')](_0xd8e8('0x6')))['format'](_0xd8e8('0x7'));var _0x3f2516=_0x310c8f[_0xd8e8('0x8')](_0x20c6e0,_0xd8e8('0x9'));this['setDataValue'](_0xd8e8('0xa'),_0x14bfa1);this['setDataValue'](_0xd8e8('0xb'),_0x3f2516||null);}},'position':{'type':Sequelize[_0xd8e8('0xc')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0xd8e8('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xd8e8('0x4')]},'queuecallercomplete':{'type':Sequelize[_0xd8e8('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xd8e8('0x4')]},'queuecallerexit':{'type':Sequelize[_0xd8e8('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xd8e8('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0xd8e8('0x3')],'comment':_0xd8e8('0xe')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0xd8e8('0x3')]},'connectedlinenum':{'type':Sequelize[_0xd8e8('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xd8e8('0x3')]},'context':{'type':Sequelize[_0xd8e8('0x3')]},'exten':{'type':Sequelize[_0xd8e8('0x3')]},'priority':{'type':Sequelize[_0xd8e8('0x3')]},'holdtime':{'type':Sequelize[_0xd8e8('0xc')]},'mohtime':{'type':Sequelize[_0xd8e8('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xd8e8('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xd8e8('0xf')},'transferexten':{'type':Sequelize[_0xd8e8('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xd8e8('0x3')]},'secondDisposition':{'type':Sequelize[_0xd8e8('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0xd8e8('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5bf6=['moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize'];(function(_0x12f761,_0x122e63){var _0x2797d2=function(_0x2e06f1){while(--_0x2e06f1){_0x12f761['push'](_0x12f761['shift']());}};_0x2797d2(++_0x122e63);}(_0x5bf6,0x77));var _0x65bf=function(_0x4c6cf0,_0x826f70){_0x4c6cf0=_0x4c6cf0-0x0;var _0x108145=_0x5bf6[_0x4c6cf0];return _0x108145;};'use strict';var Sequelize=require(_0x65bf('0x0'));var moment=require(_0x65bf('0x1'));module[_0x65bf('0x2')]={'type':{'type':Sequelize[_0x65bf('0x3')]},'uniqueid':{'type':Sequelize[_0x65bf('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x65bf('0x3')]},'queue':{'type':Sequelize[_0x65bf('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x65bf('0x4')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x45a309){var _0x57efbc=moment(_0x45a309);var _0x353163=moment(this[_0x65bf('0x5')](_0x65bf('0x6')))[_0x65bf('0x7')]('YYYY-MM-DD\x20HH:mm:ss');var _0xa9165e=_0x57efbc['diff'](_0x353163,_0x65bf('0x8'));this[_0x65bf('0x9')](_0x65bf('0xa'),_0x45a309);this['setDataValue'](_0x65bf('0xb'),_0xa9165e||null);}},'position':{'type':Sequelize[_0x65bf('0xc')]},'count':{'type':Sequelize[_0x65bf('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x65bf('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x65bf('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x65bf('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x65bf('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x65bf('0x3')],'comment':_0x65bf('0xe')},'originalposition':{'type':Sequelize[_0x65bf('0xc')]},'channel':{'type':Sequelize[_0x65bf('0x3')]},'connectedlinenum':{'type':Sequelize[_0x65bf('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x65bf('0x3')]},'context':{'type':Sequelize[_0x65bf('0x3')]},'exten':{'type':Sequelize[_0x65bf('0x3')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x65bf('0xc')]},'mohtime':{'type':Sequelize[_0x65bf('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x65bf('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x65bf('0x3')]},'transfer':{'type':Sequelize[_0x65bf('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x65bf('0x3')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x65bf('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x65bf('0x3')]},'thirdDisposition':{'type':Sequelize[_0x65bf('0x3')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'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 ba8784e..00f10a8 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 _0x4800=['catch','params','length','includeAll','include','options','find','create','body','describe','getVoiceQueuesReport','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','end','status','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','VoiceQueueReport','rawAttributes','type','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','findAll','rows'];(function(_0x12c634,_0x1cae16){var _0x3f8f71=function(_0x32c008){while(--_0x32c008){_0x12c634['push'](_0x12c634['shift']());}};_0x3f8f71(++_0x1cae16);}(_0x4800,0x1eb));var _0x0480=function(_0x108c01,_0x24dfc7){_0x108c01=_0x108c01-0x0;var _0x249029=_0x4800[_0x108c01];return _0x249029;};'use strict';var emlformat=require(_0x0480('0x0'));var rimraf=require(_0x0480('0x1'));var zipdir=require(_0x0480('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0480('0x3'));var moment=require(_0x0480('0x4'));var BPromise=require(_0x0480('0x5'));var Mustache=require(_0x0480('0x6'));var util=require(_0x0480('0x7'));var path=require('path');var sox=require(_0x0480('0x8'));var csv=require('to-csv');var ejs=require(_0x0480('0x9'));var fs=require('fs');var fs_extra=require(_0x0480('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0480('0xb'));var deskjs=require(_0x0480('0xc'));var toCsv=require(_0x0480('0xd'));var querystring=require('querystring');var Papa=require(_0x0480('0xe'));var Redis=require(_0x0480('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0480('0x10'));var as=require(_0x0480('0x11'));var hardwareService=require(_0x0480('0x12'));var logger=require(_0x0480('0x13'))(_0x0480('0x14'));var utils=require(_0x0480('0x15'));var config=require(_0x0480('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0480('0x17'))['db'];config['redis']=_[_0x0480('0x18')](config[_0x0480('0x19')],{'host':_0x0480('0x1a'),'port':0x18eb});var socket=require(_0x0480('0x1b'))(new Redis(config[_0x0480('0x19')]));require(_0x0480('0x1c'))[_0x0480('0x1d')](socket);function respondWithStatusCode(_0x20f7a8,_0x2cbc20){_0x2cbc20=_0x2cbc20||0xcc;return function(_0x24e5bb){if(_0x24e5bb){return _0x20f7a8['sendStatus'](_0x2cbc20);}return _0x20f7a8['status'](_0x2cbc20)[_0x0480('0x1e')]();};}function respondWithResult(_0x52c118,_0x2ac1a3){_0x2ac1a3=_0x2ac1a3||0xc8;return function(_0x417455){if(_0x417455){return _0x52c118[_0x0480('0x1f')](_0x2ac1a3)[_0x0480('0x20')](_0x417455);}};}function respondWithFilteredResult(_0x209f45,_0x4dddd7){return function(_0x15f813){if(_0x15f813){var _0x101516=typeof _0x4dddd7[_0x0480('0x21')]===_0x0480('0x22')&&typeof _0x4dddd7['limit']===_0x0480('0x22');var _0x28723a=_0x15f813[_0x0480('0x23')];var _0x2549a0=_0x101516?0x0:_0x4dddd7[_0x0480('0x21')];var _0x2d8d01=_0x101516?_0x15f813[_0x0480('0x23')]:_0x4dddd7[_0x0480('0x21')]+_0x4dddd7['limit'];var _0x63b946;if(_0x2d8d01>=_0x28723a){_0x2d8d01=_0x28723a;_0x63b946=0xc8;}else{_0x63b946=0xce;}_0x209f45['status'](_0x63b946);return _0x209f45[_0x0480('0x24')](_0x0480('0x25'),_0x2549a0+'-'+_0x2d8d01+'/'+_0x28723a)[_0x0480('0x20')](_0x15f813);}return null;};}function patchUpdates(_0x3f3c76){return function(_0x2391ac){try{jsonpatch[_0x0480('0x26')](_0x2391ac,_0x3f3c76,!![]);}catch(_0x5b673f){return BPromise['reject'](_0x5b673f);}return _0x2391ac[_0x0480('0x27')]();};}function saveUpdates(_0x502425,_0xef844f){return function(_0x48faaa){if(_0x48faaa){return _0x48faaa[_0x0480('0x28')](_0x502425)[_0x0480('0x29')](function(_0x5a00d5){return _0x5a00d5;});}return null;};}function removeEntity(_0x30f17b,_0x3c5ae8){return function(_0x5e8706){if(_0x5e8706){return _0x5e8706[_0x0480('0x2a')]()[_0x0480('0x29')](function(){_0x30f17b[_0x0480('0x1f')](0xcc)[_0x0480('0x1e')]();});}};}function handleEntityNotFound(_0x4366d8,_0x1dafb2){return function(_0x1e3fdb){if(!_0x1e3fdb){_0x4366d8['sendStatus'](0x194);}return _0x1e3fdb;};}function handleError(_0x2145a9,_0xe83226){_0xe83226=_0xe83226||0x1f4;return function(_0x1765fa){logger[_0x0480('0x2b')](_0x1765fa['stack']);if(_0x1765fa[_0x0480('0x2c')]){delete _0x1765fa[_0x0480('0x2c')];}_0x2145a9[_0x0480('0x1f')](_0xe83226)[_0x0480('0x2d')](_0x1765fa);};}exports[_0x0480('0x2e')]=function(_0x6dccfe,_0x2abf2c){var _0x1eaa82={},_0x30990a={},_0x571672={'count':0x0,'rows':[]};var _0x288385=_['map'](db[_0x0480('0x2f')][_0x0480('0x30')],function(_0x3bbc0d){return{'name':_0x3bbc0d['fieldName'],'type':_0x3bbc0d[_0x0480('0x31')]['key']};});_0x30990a[_0x0480('0x32')]=_[_0x0480('0x33')](_0x288385,'name');_0x30990a[_0x0480('0x34')]=_[_0x0480('0x35')](_0x6dccfe[_0x0480('0x34')]);_0x30990a[_0x0480('0x36')]=_[_0x0480('0x37')](_0x30990a[_0x0480('0x32')],_0x30990a[_0x0480('0x34')]);_0x1eaa82['attributes']=_['intersection'](_0x30990a[_0x0480('0x32')],qs[_0x0480('0x38')](_0x6dccfe['query'][_0x0480('0x38')]));_0x1eaa82['attributes']=_0x1eaa82[_0x0480('0x39')]['length']?_0x1eaa82[_0x0480('0x39')]:_0x30990a[_0x0480('0x32')];if(!_0x6dccfe['query'][_0x0480('0x3a')](_0x0480('0x3b'))){_0x1eaa82['limit']=qs['limit'](_0x6dccfe['query'][_0x0480('0x3c')]);_0x1eaa82[_0x0480('0x21')]=qs[_0x0480('0x21')](_0x6dccfe[_0x0480('0x34')][_0x0480('0x21')]);}_0x1eaa82[_0x0480('0x3d')]=qs['sort'](_0x6dccfe[_0x0480('0x34')][_0x0480('0x3e')]);_0x1eaa82[_0x0480('0x3f')]=qs['filters'](_[_0x0480('0x40')](_0x6dccfe[_0x0480('0x34')],_0x30990a['filters']),_0x288385);if(_0x6dccfe[_0x0480('0x34')][_0x0480('0x41')]){_0x1eaa82[_0x0480('0x3f')]=_[_0x0480('0x42')](_0x1eaa82['where'],{'$or':_['map'](_0x288385,function(_0xd87b45){if(_0xd87b45['type']!=='VIRTUAL'){var _0x20c528={};_0x20c528[_0xd87b45[_0x0480('0x2c')]]={'$like':'%'+_0x6dccfe[_0x0480('0x34')][_0x0480('0x41')]+'%'};return _0x20c528;}})});}_0x1eaa82=_[_0x0480('0x42')]({},_0x1eaa82,_0x6dccfe['options']);var _0x38ce9d={'where':_0x1eaa82[_0x0480('0x3f')]};return db[_0x0480('0x2f')][_0x0480('0x23')](_0x38ce9d)['then'](function(_0x205ba){_0x571672[_0x0480('0x23')]=_0x205ba;if(_0x6dccfe[_0x0480('0x34')]['includeAll']){_0x1eaa82['include']=[{'all':!![]}];}return db[_0x0480('0x2f')][_0x0480('0x43')](_0x1eaa82);})[_0x0480('0x29')](function(_0x211314){_0x571672[_0x0480('0x44')]=_0x211314;return _0x571672;})['then'](respondWithFilteredResult(_0x2abf2c,_0x1eaa82))[_0x0480('0x45')](handleError(_0x2abf2c,null));};exports['show']=function(_0x280fa5,_0x58f6e1){var _0x399dd5={'raw':![],'where':{'id':_0x280fa5[_0x0480('0x46')]['id']}},_0x3d63c0={};_0x3d63c0[_0x0480('0x32')]=_[_0x0480('0x35')](db[_0x0480('0x2f')][_0x0480('0x30')]);_0x3d63c0[_0x0480('0x34')]=_[_0x0480('0x35')](_0x280fa5['query']);_0x3d63c0[_0x0480('0x36')]=_[_0x0480('0x37')](_0x3d63c0[_0x0480('0x32')],_0x3d63c0['query']);_0x399dd5[_0x0480('0x39')]=_[_0x0480('0x37')](_0x3d63c0[_0x0480('0x32')],qs[_0x0480('0x38')](_0x280fa5[_0x0480('0x34')]['fields']));_0x399dd5[_0x0480('0x39')]=_0x399dd5[_0x0480('0x39')][_0x0480('0x47')]?_0x399dd5[_0x0480('0x39')]:_0x3d63c0[_0x0480('0x32')];if(_0x280fa5[_0x0480('0x34')][_0x0480('0x48')]){_0x399dd5[_0x0480('0x49')]=[{'all':!![]}];}_0x399dd5=_[_0x0480('0x42')]({},_0x399dd5,_0x280fa5[_0x0480('0x4a')]);return db['VoiceQueueReport'][_0x0480('0x4b')](_0x399dd5)[_0x0480('0x29')](handleEntityNotFound(_0x58f6e1,null))[_0x0480('0x29')](respondWithResult(_0x58f6e1,null))[_0x0480('0x45')](handleError(_0x58f6e1,null));};exports['create']=function(_0x5c2b64,_0x5a6d79){return db['VoiceQueueReport'][_0x0480('0x4c')](_0x5c2b64['body'],{})[_0x0480('0x29')](respondWithResult(_0x5a6d79,0xc9))[_0x0480('0x45')](handleError(_0x5a6d79,null));};exports[_0x0480('0x28')]=function(_0x256ad0,_0x424eda){if(_0x256ad0[_0x0480('0x4d')]['id']){delete _0x256ad0[_0x0480('0x4d')]['id'];}return db['VoiceQueueReport'][_0x0480('0x4b')]({'where':{'id':_0x256ad0[_0x0480('0x46')]['id']}})[_0x0480('0x29')](handleEntityNotFound(_0x424eda,null))[_0x0480('0x29')](saveUpdates(_0x256ad0[_0x0480('0x4d')],null))['then'](respondWithResult(_0x424eda,null))[_0x0480('0x45')](handleError(_0x424eda,null));};exports[_0x0480('0x2a')]=function(_0x331469,_0x4bc6f5){return db['VoiceQueueReport'][_0x0480('0x4b')]({'where':{'id':_0x331469[_0x0480('0x46')]['id']}})[_0x0480('0x29')](handleEntityNotFound(_0x4bc6f5,null))[_0x0480('0x29')](removeEntity(_0x4bc6f5,null))[_0x0480('0x45')](handleError(_0x4bc6f5,null));};exports['describe']=function(_0x348c5b,_0xb9f16e){return db['VoiceQueueReport'][_0x0480('0x4e')]()[_0x0480('0x29')](respondWithResult(_0xb9f16e,null))[_0x0480('0x45')](handleError(_0xb9f16e,null));};exports[_0x0480('0x4f')]=function(_0x26634f,_0x23728f){var _0x457421={},_0x39c9d7={},_0x1d3271={'count':0x0,'rows':[]};_0x39c9d7['model']=_[_0x0480('0x35')](db[_0x0480('0x2f')][_0x0480('0x30')]);_0x39c9d7[_0x0480('0x34')]=_[_0x0480('0x35')](_0x26634f[_0x0480('0x34')]);_0x39c9d7[_0x0480('0x36')]=_[_0x0480('0x37')](_0x39c9d7['model'],_0x39c9d7[_0x0480('0x34')]);_0x457421['attributes']=_['intersection'](_0x39c9d7[_0x0480('0x32')],qs[_0x0480('0x38')](_0x26634f['query'][_0x0480('0x38')]));_0x457421[_0x0480('0x39')]=_0x457421[_0x0480('0x39')]['length']?_0x457421[_0x0480('0x39')]:_0x39c9d7[_0x0480('0x32')];if(!_0x26634f['query'][_0x0480('0x3a')](_0x0480('0x3b'))){_0x457421[_0x0480('0x3c')]=qs[_0x0480('0x3c')](_0x26634f['query'][_0x0480('0x3c')]);_0x457421[_0x0480('0x21')]=qs[_0x0480('0x21')](_0x26634f[_0x0480('0x34')][_0x0480('0x21')]);}_0x457421[_0x0480('0x3d')]=qs[_0x0480('0x3e')](_0x26634f[_0x0480('0x34')]['sort']);_0x457421[_0x0480('0x3f')]=qs['filters'](_[_0x0480('0x40')](_0x26634f[_0x0480('0x34')],_0x39c9d7[_0x0480('0x36')]));if(_0x26634f['query'][_0x0480('0x41')]){_0x457421['where']=_[_0x0480('0x42')](_0x457421[_0x0480('0x3f')],{'$or':_['map'](_0x457421[_0x0480('0x39')],function(_0x11a65e){var _0x56176b={};_0x56176b[_0x11a65e]={'$like':'%'+_0x26634f[_0x0480('0x34')][_0x0480('0x41')]+'%'};return _0x56176b;})});}_0x457421=_[_0x0480('0x42')]({},_0x457421,_0x26634f[_0x0480('0x4a')]);var _0x4062bd={'where':_0x457421[_0x0480('0x3f')]};return db['VoiceQueueReport']['count'](_0x4062bd)[_0x0480('0x29')](function(_0x1fe926){_0x1d3271[_0x0480('0x23')]=_0x1fe926;if(_0x26634f[_0x0480('0x34')][_0x0480('0x48')]){_0x457421[_0x0480('0x49')]=[{'all':!![]}];}return db[_0x0480('0x2f')][_0x0480('0x43')](_0x457421);})[_0x0480('0x29')](function(_0x3f55bd){_0x1d3271[_0x0480('0x44')]=_0x3f55bd;return _0x1d3271;})[_0x0480('0x29')](respondWithFilteredResult(_0x23728f,_0x457421,_0x0480('0x4f')))[_0x0480('0x45')](handleError(_0x23728f,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0x1b44=['filter','merge','type','VIRTUAL','options','VoiceQueueReport','includeAll','include','findAll','params','rawAttributes','create','body','catch','find','describe','getVoiceQueuesReport','hasOwnProperty','nolimit','rows','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','register','sendStatus','status','end','json','undefined','limit','offset','count','set','apply','reject','update','then','destroy','error','name','send','index','map','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick'];(function(_0x1f1bac,_0x87b957){var _0x2c4b41=function(_0x4c2ff5){while(--_0x4c2ff5){_0x1f1bac['push'](_0x1f1bac['shift']());}};_0x2c4b41(++_0x87b957);}(_0x1b44,0x164));var _0x41b4=function(_0x169e3b,_0x5c5716){_0x169e3b=_0x169e3b-0x0;var _0x1a0584=_0x1b44[_0x169e3b];return _0x1a0584;};'use strict';var emlformat=require(_0x41b4('0x0'));var rimraf=require(_0x41b4('0x1'));var zipdir=require(_0x41b4('0x2'));var jsonpatch=require(_0x41b4('0x3'));var rp=require('request-promise');var moment=require(_0x41b4('0x4'));var BPromise=require(_0x41b4('0x5'));var Mustache=require('mustache');var util=require(_0x41b4('0x6'));var path=require(_0x41b4('0x7'));var sox=require('sox');var csv=require(_0x41b4('0x8'));var ejs=require(_0x41b4('0x9'));var fs=require('fs');var fs_extra=require(_0x41b4('0xa'));var _=require(_0x41b4('0xb'));var squel=require(_0x41b4('0xc'));var crypto=require(_0x41b4('0xd'));var jsforce=require(_0x41b4('0xe'));var deskjs=require(_0x41b4('0xf'));var toCsv=require(_0x41b4('0x8'));var querystring=require(_0x41b4('0x10'));var Papa=require(_0x41b4('0x11'));var Redis=require(_0x41b4('0x12'));var authService=require(_0x41b4('0x13'));var qs=require(_0x41b4('0x14'));var as=require(_0x41b4('0x15'));var hardwareService=require(_0x41b4('0x16'));var logger=require('../../config/logger')(_0x41b4('0x17'));var utils=require(_0x41b4('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x41b4('0x19'));var db=require(_0x41b4('0x1a'))['db'];config[_0x41b4('0x1b')]=_[_0x41b4('0x1c')](config[_0x41b4('0x1b')],{'host':_0x41b4('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x41b4('0x1b')]));require(_0x41b4('0x1e'))[_0x41b4('0x1f')](socket);function respondWithStatusCode(_0x220fc7,_0xdb60d0){_0xdb60d0=_0xdb60d0||0xcc;return function(_0x449ccd){if(_0x449ccd){return _0x220fc7[_0x41b4('0x20')](_0xdb60d0);}return _0x220fc7[_0x41b4('0x21')](_0xdb60d0)[_0x41b4('0x22')]();};}function respondWithResult(_0x272a2d,_0x4514db){_0x4514db=_0x4514db||0xc8;return function(_0x49c02d){if(_0x49c02d){return _0x272a2d[_0x41b4('0x21')](_0x4514db)[_0x41b4('0x23')](_0x49c02d);}};}function respondWithFilteredResult(_0x3553c7,_0x24463a){return function(_0x5bfbea){if(_0x5bfbea){var _0x946f46=typeof _0x24463a['offset']===_0x41b4('0x24')&&typeof _0x24463a[_0x41b4('0x25')]===_0x41b4('0x24');var _0x127838=_0x5bfbea['count'];var _0x105492=_0x946f46?0x0:_0x24463a[_0x41b4('0x26')];var _0x1c2365=_0x946f46?_0x5bfbea[_0x41b4('0x27')]:_0x24463a[_0x41b4('0x26')]+_0x24463a['limit'];var _0x303d25;if(_0x1c2365>=_0x127838){_0x1c2365=_0x127838;_0x303d25=0xc8;}else{_0x303d25=0xce;}_0x3553c7[_0x41b4('0x21')](_0x303d25);return _0x3553c7[_0x41b4('0x28')]('Content-Range',_0x105492+'-'+_0x1c2365+'/'+_0x127838)['json'](_0x5bfbea);}return null;};}function patchUpdates(_0x4e53e3){return function(_0x18af67){try{jsonpatch[_0x41b4('0x29')](_0x18af67,_0x4e53e3,!![]);}catch(_0x4ca0ff){return BPromise[_0x41b4('0x2a')](_0x4ca0ff);}return _0x18af67['save']();};}function saveUpdates(_0xb02057,_0x3a9cea){return function(_0x268d77){if(_0x268d77){return _0x268d77[_0x41b4('0x2b')](_0xb02057)[_0x41b4('0x2c')](function(_0x12e154){return _0x12e154;});}return null;};}function removeEntity(_0x25a899,_0x348559){return function(_0x3cdc35){if(_0x3cdc35){return _0x3cdc35[_0x41b4('0x2d')]()[_0x41b4('0x2c')](function(){_0x25a899['status'](0xcc)[_0x41b4('0x22')]();});}};}function handleEntityNotFound(_0x5bd95d,_0x19a7b5){return function(_0x1daa42){if(!_0x1daa42){_0x5bd95d['sendStatus'](0x194);}return _0x1daa42;};}function handleError(_0x6a1c31,_0x5f462f){_0x5f462f=_0x5f462f||0x1f4;return function(_0x2c8e62){logger[_0x41b4('0x2e')](_0x2c8e62['stack']);if(_0x2c8e62[_0x41b4('0x2f')]){delete _0x2c8e62[_0x41b4('0x2f')];}_0x6a1c31[_0x41b4('0x21')](_0x5f462f)[_0x41b4('0x30')](_0x2c8e62);};}exports[_0x41b4('0x31')]=function(_0x235bc8,_0x42b675){var _0x2b94b3={},_0xe30377={},_0x4b8606={'count':0x0,'rows':[]};var _0x504922=_[_0x41b4('0x32')](db['VoiceQueueReport']['rawAttributes'],function(_0xf42eb9){return{'name':_0xf42eb9['fieldName'],'type':_0xf42eb9['type'][_0x41b4('0x33')]};});_0xe30377[_0x41b4('0x34')]=_[_0x41b4('0x32')](_0x504922,_0x41b4('0x2f'));_0xe30377[_0x41b4('0x35')]=_[_0x41b4('0x36')](_0x235bc8[_0x41b4('0x35')]);_0xe30377[_0x41b4('0x37')]=_[_0x41b4('0x38')](_0xe30377[_0x41b4('0x34')],_0xe30377[_0x41b4('0x35')]);_0x2b94b3[_0x41b4('0x39')]=_[_0x41b4('0x38')](_0xe30377[_0x41b4('0x34')],qs[_0x41b4('0x3a')](_0x235bc8[_0x41b4('0x35')][_0x41b4('0x3a')]));_0x2b94b3[_0x41b4('0x39')]=_0x2b94b3[_0x41b4('0x39')][_0x41b4('0x3b')]?_0x2b94b3[_0x41b4('0x39')]:_0xe30377[_0x41b4('0x34')];if(!_0x235bc8['query']['hasOwnProperty']('nolimit')){_0x2b94b3[_0x41b4('0x25')]=qs[_0x41b4('0x25')](_0x235bc8[_0x41b4('0x35')][_0x41b4('0x25')]);_0x2b94b3[_0x41b4('0x26')]=qs[_0x41b4('0x26')](_0x235bc8[_0x41b4('0x35')][_0x41b4('0x26')]);}_0x2b94b3[_0x41b4('0x3c')]=qs[_0x41b4('0x3d')](_0x235bc8[_0x41b4('0x35')]['sort']);_0x2b94b3[_0x41b4('0x3e')]=qs[_0x41b4('0x37')](_[_0x41b4('0x3f')](_0x235bc8[_0x41b4('0x35')],_0xe30377['filters']),_0x504922);if(_0x235bc8[_0x41b4('0x35')][_0x41b4('0x40')]){_0x2b94b3['where']=_[_0x41b4('0x41')](_0x2b94b3[_0x41b4('0x3e')],{'$or':_[_0x41b4('0x32')](_0x504922,function(_0x38e912){if(_0x38e912[_0x41b4('0x42')]!==_0x41b4('0x43')){var _0x680bb9={};_0x680bb9[_0x38e912[_0x41b4('0x2f')]]={'$like':'%'+_0x235bc8[_0x41b4('0x35')][_0x41b4('0x40')]+'%'};return _0x680bb9;}})});}_0x2b94b3=_[_0x41b4('0x41')]({},_0x2b94b3,_0x235bc8[_0x41b4('0x44')]);var _0x283ec9={'where':_0x2b94b3[_0x41b4('0x3e')]};return db[_0x41b4('0x45')][_0x41b4('0x27')](_0x283ec9)['then'](function(_0x2336b6){_0x4b8606['count']=_0x2336b6;if(_0x235bc8[_0x41b4('0x35')][_0x41b4('0x46')]){_0x2b94b3[_0x41b4('0x47')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x41b4('0x48')](_0x2b94b3);})[_0x41b4('0x2c')](function(_0x1d9cac){_0x4b8606['rows']=_0x1d9cac;return _0x4b8606;})[_0x41b4('0x2c')](respondWithFilteredResult(_0x42b675,_0x2b94b3))['catch'](handleError(_0x42b675,null));};exports['show']=function(_0x85fe0a,_0x2c70ce){var _0x29eec4={'raw':![],'where':{'id':_0x85fe0a[_0x41b4('0x49')]['id']}},_0x175c14={};_0x175c14[_0x41b4('0x34')]=_[_0x41b4('0x36')](db[_0x41b4('0x45')][_0x41b4('0x4a')]);_0x175c14[_0x41b4('0x35')]=_[_0x41b4('0x36')](_0x85fe0a[_0x41b4('0x35')]);_0x175c14[_0x41b4('0x37')]=_['intersection'](_0x175c14[_0x41b4('0x34')],_0x175c14[_0x41b4('0x35')]);_0x29eec4[_0x41b4('0x39')]=_[_0x41b4('0x38')](_0x175c14[_0x41b4('0x34')],qs[_0x41b4('0x3a')](_0x85fe0a[_0x41b4('0x35')]['fields']));_0x29eec4[_0x41b4('0x39')]=_0x29eec4['attributes'][_0x41b4('0x3b')]?_0x29eec4[_0x41b4('0x39')]:_0x175c14[_0x41b4('0x34')];if(_0x85fe0a[_0x41b4('0x35')][_0x41b4('0x46')]){_0x29eec4[_0x41b4('0x47')]=[{'all':!![]}];}_0x29eec4=_[_0x41b4('0x41')]({},_0x29eec4,_0x85fe0a[_0x41b4('0x44')]);return db[_0x41b4('0x45')]['find'](_0x29eec4)[_0x41b4('0x2c')](handleEntityNotFound(_0x2c70ce,null))[_0x41b4('0x2c')](respondWithResult(_0x2c70ce,null))['catch'](handleError(_0x2c70ce,null));};exports[_0x41b4('0x4b')]=function(_0x5a7671,_0x4cfae3){return db[_0x41b4('0x45')][_0x41b4('0x4b')](_0x5a7671[_0x41b4('0x4c')],{})[_0x41b4('0x2c')](respondWithResult(_0x4cfae3,0xc9))[_0x41b4('0x4d')](handleError(_0x4cfae3,null));};exports[_0x41b4('0x2b')]=function(_0x56a285,_0x38a0cf){if(_0x56a285[_0x41b4('0x4c')]['id']){delete _0x56a285[_0x41b4('0x4c')]['id'];}return db[_0x41b4('0x45')][_0x41b4('0x4e')]({'where':{'id':_0x56a285['params']['id']}})[_0x41b4('0x2c')](handleEntityNotFound(_0x38a0cf,null))[_0x41b4('0x2c')](saveUpdates(_0x56a285['body'],null))['then'](respondWithResult(_0x38a0cf,null))[_0x41b4('0x4d')](handleError(_0x38a0cf,null));};exports[_0x41b4('0x2d')]=function(_0x226c9f,_0x39ceb5){return db['VoiceQueueReport']['find']({'where':{'id':_0x226c9f[_0x41b4('0x49')]['id']}})[_0x41b4('0x2c')](handleEntityNotFound(_0x39ceb5,null))[_0x41b4('0x2c')](removeEntity(_0x39ceb5,null))[_0x41b4('0x4d')](handleError(_0x39ceb5,null));};exports[_0x41b4('0x4f')]=function(_0xec8a2d,_0x48b631){return db[_0x41b4('0x45')][_0x41b4('0x4f')]()['then'](respondWithResult(_0x48b631,null))[_0x41b4('0x4d')](handleError(_0x48b631,null));};exports[_0x41b4('0x50')]=function(_0x1aae26,_0x29f427){var _0x32b193={},_0x30419c={},_0x5880b3={'count':0x0,'rows':[]};_0x30419c[_0x41b4('0x34')]=_[_0x41b4('0x36')](db['VoiceQueueReport']['rawAttributes']);_0x30419c['query']=_[_0x41b4('0x36')](_0x1aae26[_0x41b4('0x35')]);_0x30419c[_0x41b4('0x37')]=_[_0x41b4('0x38')](_0x30419c[_0x41b4('0x34')],_0x30419c[_0x41b4('0x35')]);_0x32b193['attributes']=_[_0x41b4('0x38')](_0x30419c['model'],qs[_0x41b4('0x3a')](_0x1aae26[_0x41b4('0x35')][_0x41b4('0x3a')]));_0x32b193[_0x41b4('0x39')]=_0x32b193[_0x41b4('0x39')]['length']?_0x32b193['attributes']:_0x30419c['model'];if(!_0x1aae26['query'][_0x41b4('0x51')](_0x41b4('0x52'))){_0x32b193[_0x41b4('0x25')]=qs[_0x41b4('0x25')](_0x1aae26[_0x41b4('0x35')][_0x41b4('0x25')]);_0x32b193['offset']=qs[_0x41b4('0x26')](_0x1aae26['query'][_0x41b4('0x26')]);}_0x32b193[_0x41b4('0x3c')]=qs['sort'](_0x1aae26['query'][_0x41b4('0x3d')]);_0x32b193[_0x41b4('0x3e')]=qs[_0x41b4('0x37')](_['pick'](_0x1aae26[_0x41b4('0x35')],_0x30419c[_0x41b4('0x37')]));if(_0x1aae26[_0x41b4('0x35')]['filter']){_0x32b193[_0x41b4('0x3e')]=_['merge'](_0x32b193['where'],{'$or':_[_0x41b4('0x32')](_0x32b193[_0x41b4('0x39')],function(_0x94ba40){var _0x1aef0f={};_0x1aef0f[_0x94ba40]={'$like':'%'+_0x1aae26[_0x41b4('0x35')][_0x41b4('0x40')]+'%'};return _0x1aef0f;})});}_0x32b193=_['merge']({},_0x32b193,_0x1aae26['options']);var _0x30c1ed={'where':_0x32b193[_0x41b4('0x3e')]};return db[_0x41b4('0x45')][_0x41b4('0x27')](_0x30c1ed)[_0x41b4('0x2c')](function(_0x45efcf){_0x5880b3[_0x41b4('0x27')]=_0x45efcf;if(_0x1aae26[_0x41b4('0x35')][_0x41b4('0x46')]){_0x32b193[_0x41b4('0x47')]=[{'all':!![]}];}return db[_0x41b4('0x45')]['findAll'](_0x32b193);})[_0x41b4('0x2c')](function(_0x5561dc){_0x5880b3[_0x41b4('0x53')]=_0x5561dc;return _0x5880b3;})[_0x41b4('0x2c')](respondWithFilteredResult(_0x29f427,_0x32b193,_0x41b4('0x50')))[_0x41b4('0x4d')](handleError(_0x29f427,null,'getVoiceQueuesReport'));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index e8136ef..b028a83 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 _0xa86b=['save','remove','emit','hook','VoiceQueueReport','setMaxListeners'];(function(_0x368cfb,_0x571855){var _0x27e714=function(_0x142d64){while(--_0x142d64){_0x368cfb['push'](_0x368cfb['shift']());}};_0x27e714(++_0x571855);}(_0xa86b,0x172));var _0xba86=function(_0x1012dd,_0x4e09dd){_0x1012dd=_0x1012dd-0x0;var _0x206ecc=_0xa86b[_0x1012dd];return _0x206ecc;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require('../../mysqldb')['db'][_0xba86('0x0')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xba86('0x1')](0x0);var events={'afterCreate':_0xba86('0x2'),'afterUpdate':'update','afterDestroy':_0xba86('0x3')};function emitEvent(_0x37030b){return function(_0x495bd1,_0x2cf99e,_0x6aa542){VoiceQueueReportEvents[_0xba86('0x4')](_0x37030b+':'+_0x495bd1['id'],_0x495bd1);VoiceQueueReportEvents[_0xba86('0x4')](_0x37030b,_0x495bd1);_0x6aa542(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0xba86('0x5')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x9d46=['emit','hook','events','../../mysqldb','VoiceQueueReport','setMaxListeners','update'];(function(_0x8a6117,_0xeed0c3){var _0x49ae06=function(_0x45db18){while(--_0x45db18){_0x8a6117['push'](_0x8a6117['shift']());}};_0x49ae06(++_0xeed0c3);}(_0x9d46,0x9c));var _0x69d4=function(_0x1045e3,_0x315eb5){_0x1045e3=_0x1045e3-0x0;var _0x51d906=_0x9d46[_0x1045e3];return _0x51d906;};'use strict';var EventEmitter=require(_0x69d4('0x0'));var VoiceQueueReport=require(_0x69d4('0x1'))['db'][_0x69d4('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x69d4('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x69d4('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1b75b9){return function(_0x1fc20c,_0x47ec4b,_0x498448){VoiceQueueReportEvents['emit'](_0x1b75b9+':'+_0x1fc20c['id'],_0x1fc20c);VoiceQueueReportEvents[_0x69d4('0x5')](_0x1b75b9,_0x1fc20c);_0x498448(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x69d4('0x6')](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 f7abd62..bf9f7c2 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 _0x5b76=['api','moment','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','calleridnum','../../config/logger'];(function(_0xe6e3e2,_0x2b01da){var _0x126571=function(_0x515ab3){while(--_0x515ab3){_0xe6e3e2['push'](_0xe6e3e2['shift']());}};_0x126571(++_0x2b01da);}(_0x5b76,0xba));var _0x65b7=function(_0x5dc362,_0x9a6f19){_0x5dc362=_0x5dc362-0x0;var _0x4a4e86=_0x5b76[_0x5dc362];return _0x4a4e86;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x65b7('0x0'))(_0x65b7('0x1'));var moment=require(_0x65b7('0x2'));var BPromise=require('bluebird');var rp=require(_0x65b7('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x65b7('0x4'));var config=require(_0x65b7('0x5'));var attributes=require(_0x65b7('0x6'));module[_0x65b7('0x7')]=function(_0x454a6b,_0x8bc50a){return _0x454a6b[_0x65b7('0x8')](_0x65b7('0x9'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x65b7('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x82f4=['moment','bluebird','request-promise','rimraf','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','lodash','util','../../config/logger','api'];(function(_0x4271f6,_0x30012d){var _0x34659c=function(_0x43e64a){while(--_0x43e64a){_0x4271f6['push'](_0x4271f6['shift']());}};_0x34659c(++_0x30012d);}(_0x82f4,0xce));var _0x482f=function(_0x41e225,_0x16b262){_0x41e225=_0x41e225-0x0;var _0x34b8a4=_0x82f4[_0x41e225];return _0x34b8a4;};'use strict';var _=require(_0x482f('0x0'));var util=require(_0x482f('0x1'));var logger=require(_0x482f('0x2'))(_0x482f('0x3'));var moment=require(_0x482f('0x4'));var BPromise=require(_0x482f('0x5'));var rp=require(_0x482f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x482f('0x7'));var config=require('../../config/environment');var attributes=require(_0x482f('0x8'));module[_0x482f('0x9')]=function(_0x2def51,_0x1e05ce){return _0x2def51[_0x482f('0xa')](_0x482f('0xb'),attributes,{'tableName':_0x482f('0xc'),'paranoid':![],'indexes':[{'fields':[_0x482f('0xd')]},{'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 e568384..869f27f 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 _0x519f=['message','result','catch','GetVoiceQueueReport','findAll','options','raw','attributes','limit','map','include','model','stringify','VoiceQueueReport','create','body','then','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','where','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','request','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x538c70,_0x35531f){var _0x42ae01=function(_0x5c7368){while(--_0x5c7368){_0x538c70['push'](_0x538c70['shift']());}};_0x42ae01(++_0x35531f);}(_0x519f,0xe7));var _0xf519=function(_0x48c94e,_0x44a7ad){_0x48c94e=_0x48c94e-0x0;var _0x504044=_0x519f[_0x48c94e];return _0x504044;};'use strict';var _=require(_0xf519('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf519('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf519('0x2'));var db=require(_0xf519('0x3'))['db'];var utils=require(_0xf519('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xf519('0x5'));var jayson=require(_0xf519('0x6'));var client=jayson[_0xf519('0x7')][_0xf519('0x8')]({'port':0x232a});config[_0xf519('0x9')]=_[_0xf519('0xa')](config[_0xf519('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xf519('0xb'))(new Redis(config[_0xf519('0x9')]));require(_0xf519('0xc'))[_0xf519('0xd')](socket);function respondWithRpcPromise(_0x1e2376,_0x36154c,_0x578cac){return new BPromise(function(_0x509c75,_0x10dffa){return client[_0xf519('0xe')](_0x1e2376,_0x578cac)['then'](function(_0x4f707c){logger[_0xf519('0xf')](_0xf519('0x10'),_0x36154c,_0xf519('0x11'));logger[_0xf519('0x12')](_0xf519('0x13'),_0x36154c,_0xf519('0x11'),JSON['stringify'](_0x4f707c));if(_0x4f707c[_0xf519('0x14')]){if(_0x4f707c[_0xf519('0x14')]['code']===0x1f4){logger[_0xf519('0x14')](_0xf519('0x10'),_0x36154c,_0x4f707c[_0xf519('0x14')]['message']);return _0x10dffa(_0x4f707c[_0xf519('0x14')][_0xf519('0x15')]);}logger['error'](_0xf519('0x10'),_0x36154c,_0x4f707c[_0xf519('0x14')][_0xf519('0x15')]);return _0x509c75(_0x4f707c['error'][_0xf519('0x15')]);}else{logger[_0xf519('0xf')](_0xf519('0x10'),_0x36154c,_0xf519('0x11'));_0x509c75(_0x4f707c[_0xf519('0x16')]['message']);}})[_0xf519('0x17')](function(_0x266ef9){logger['error'](_0xf519('0x10'),_0x36154c,_0x266ef9);_0x10dffa(_0x266ef9);});});}exports[_0xf519('0x18')]=function(_0xb34aac){var _0x55605b=this;return new Promise(function(_0x2e122c,_0x2c2397){return db['VoiceQueueReport'][_0xf519('0x19')]({'raw':_0xb34aac[_0xf519('0x1a')]?_0xb34aac['options'][_0xf519('0x1b')]===undefined?!![]:![]:!![],'where':_0xb34aac['options']?_0xb34aac[_0xf519('0x1a')]['where']||null:null,'attributes':_0xb34aac['options']?_0xb34aac[_0xf519('0x1a')][_0xf519('0x1c')]||null:null,'limit':_0xb34aac[_0xf519('0x1a')]?_0xb34aac['options'][_0xf519('0x1d')]||null:null,'include':_0xb34aac['options']?_0xb34aac[_0xf519('0x1a')]['include']?_[_0xf519('0x1e')](_0xb34aac[_0xf519('0x1a')][_0xf519('0x1f')],function(_0x4b7a8f){return{'model':db[_0x4b7a8f[_0xf519('0x20')]],'as':_0x4b7a8f['as'],'attributes':_0x4b7a8f[_0xf519('0x1c')],'include':_0x4b7a8f[_0xf519('0x1f')]?_[_0xf519('0x1e')](_0x4b7a8f[_0xf519('0x1f')],function(_0x4f33bb){return{'model':db[_0x4f33bb[_0xf519('0x20')]],'as':_0x4f33bb['as'],'attributes':_0x4f33bb['attributes'],'include':_0x4f33bb[_0xf519('0x1f')]?_[_0xf519('0x1e')](_0x4f33bb[_0xf519('0x1f')],function(_0x199d90){return{'model':db[_0x199d90['model']],'as':_0x199d90['as'],'attributes':_0x199d90['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5600d8){logger[_0xf519('0xf')]('GetVoiceQueueReport',_0xb34aac);logger[_0xf519('0x12')](_0xf519('0x18'),_0xb34aac,JSON[_0xf519('0x21')](_0x5600d8));_0x2e122c(_0x5600d8);})[_0xf519('0x17')](function(_0x36c7ef){logger[_0xf519('0x14')](_0xf519('0x18'),_0x36c7ef[_0xf519('0x15')],_0xb34aac);_0x2c2397(_0x55605b[_0xf519('0x14')](0x1f4,_0x36c7ef[_0xf519('0x15')]));});});};exports['CreateVoiceQueueReport']=function(_0x245d55){var _0x3b6f05=this;return new Promise(function(_0xe9f23e,_0xe7e94){return db[_0xf519('0x22')][_0xf519('0x23')](_0x245d55[_0xf519('0x24')],{'raw':_0x245d55[_0xf519('0x1a')]?_0x245d55['options'][_0xf519('0x1b')]===undefined?!![]:![]:!![]})[_0xf519('0x25')](function(_0xa463c9){logger[_0xf519('0xf')]('CreateVoiceQueueReport',_0x245d55);logger['debug'](_0xf519('0x26'),_0x245d55,JSON[_0xf519('0x21')](_0xa463c9));_0xe9f23e(_0xa463c9);})[_0xf519('0x17')](function(_0x1eedd5){logger[_0xf519('0x14')](_0xf519('0x26'),_0x1eedd5['message'],_0x245d55);_0xe7e94(_0x3b6f05['error'](0x1f4,_0x1eedd5[_0xf519('0x15')]));});});};exports[_0xf519('0x27')]=function(_0x350bd5){var _0x5e7da2=this;return new Promise(function(_0x59a433,_0x444f80){return db[_0xf519('0x22')][_0xf519('0x28')](_0x350bd5[_0xf519('0x24')],{'raw':_0x350bd5[_0xf519('0x1a')]?_0x350bd5[_0xf519('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x350bd5['options']?_0x350bd5[_0xf519('0x1a')][_0xf519('0x29')]||null:null,'attributes':_0x350bd5['options']?_0x350bd5['options'][_0xf519('0x1c')]||null:null,'limit':_0x350bd5[_0xf519('0x1a')]?_0x350bd5['options'][_0xf519('0x1d')]||null:null})[_0xf519('0x25')](function(_0x24d4dd){logger[_0xf519('0xf')](_0xf519('0x27'),_0x350bd5);logger[_0xf519('0x12')](_0xf519('0x27'),_0x350bd5,JSON[_0xf519('0x21')](_0x24d4dd));_0x59a433(_0x24d4dd);})[_0xf519('0x17')](function(_0x13e04b){logger[_0xf519('0x14')]('UpdateVoiceQueueReport',_0x13e04b[_0xf519('0x15')],_0x350bd5);_0x444f80(_0x5e7da2[_0xf519('0x14')](0x1f4,_0x13e04b['message']));});});}; \ No newline at end of file +var _0x605b=['result','catch','VoiceQueueReport','options','raw','attributes','limit','include','model','map','GetVoiceQueueReport','stringify','create','body','UpdateVoiceQueueReport','update','where','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','./voiceQueueReport.socket','register','request','then','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','VoiceQueueReport,\x20%s,\x20%s','message','info'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x605b,0x18b));var _0xb605=function(_0x38a59c,_0x3e41de){_0x38a59c=_0x38a59c-0x0;var _0x453be8=_0x605b[_0x38a59c];return _0x453be8;};'use strict';var _=require('lodash');var util=require(_0xb605('0x0'));var moment=require(_0xb605('0x1'));var BPromise=require(_0xb605('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb605('0x3'));var db=require(_0xb605('0x4'))['db'];var utils=require(_0xb605('0x5'));var logger=require(_0xb605('0x6'))(_0xb605('0x7'));var config=require('../../config/environment');var jayson=require(_0xb605('0x8'));var client=jayson['client'][_0xb605('0x9')]({'port':0x232a});config[_0xb605('0xa')]=_[_0xb605('0xb')](config[_0xb605('0xa')],{'host':_0xb605('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb605('0xa')]));require(_0xb605('0xd'))[_0xb605('0xe')](socket);function respondWithRpcPromise(_0x4fcbea,_0x43e93f,_0x1da804){return new BPromise(function(_0x4687b9,_0x45401d){return client[_0xb605('0xf')](_0x4fcbea,_0x1da804)[_0xb605('0x10')](function(_0x4ceaeb){logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x43e93f,_0xb605('0x11'));logger[_0xb605('0x12')](_0xb605('0x13'),_0x43e93f,_0xb605('0x11'),JSON['stringify'](_0x4ceaeb));if(_0x4ceaeb['error']){if(_0x4ceaeb[_0xb605('0x14')][_0xb605('0x15')]===0x1f4){logger[_0xb605('0x14')](_0xb605('0x16'),_0x43e93f,_0x4ceaeb[_0xb605('0x14')]['message']);return _0x45401d(_0x4ceaeb[_0xb605('0x14')][_0xb605('0x17')]);}logger['error'](_0xb605('0x16'),_0x43e93f,_0x4ceaeb[_0xb605('0x14')][_0xb605('0x17')]);return _0x4687b9(_0x4ceaeb[_0xb605('0x14')]['message']);}else{logger[_0xb605('0x18')]('VoiceQueueReport,\x20%s,\x20%s',_0x43e93f,_0xb605('0x11'));_0x4687b9(_0x4ceaeb[_0xb605('0x19')][_0xb605('0x17')]);}})[_0xb605('0x1a')](function(_0x11c33f){logger[_0xb605('0x14')](_0xb605('0x16'),_0x43e93f,_0x11c33f);_0x45401d(_0x11c33f);});});}exports['GetVoiceQueueReport']=function(_0x253afa){var _0xfe9661=this;return new Promise(function(_0x6b2d9c,_0x72bc){return db[_0xb605('0x1b')]['findAll']({'raw':_0x253afa[_0xb605('0x1c')]?_0x253afa[_0xb605('0x1c')][_0xb605('0x1d')]===undefined?!![]:![]:!![],'where':_0x253afa[_0xb605('0x1c')]?_0x253afa[_0xb605('0x1c')]['where']||null:null,'attributes':_0x253afa[_0xb605('0x1c')]?_0x253afa[_0xb605('0x1c')][_0xb605('0x1e')]||null:null,'limit':_0x253afa['options']?_0x253afa['options'][_0xb605('0x1f')]||null:null,'include':_0x253afa[_0xb605('0x1c')]?_0x253afa[_0xb605('0x1c')][_0xb605('0x20')]?_['map'](_0x253afa['options'][_0xb605('0x20')],function(_0x14ec02){return{'model':db[_0x14ec02[_0xb605('0x21')]],'as':_0x14ec02['as'],'attributes':_0x14ec02[_0xb605('0x1e')],'include':_0x14ec02[_0xb605('0x20')]?_['map'](_0x14ec02[_0xb605('0x20')],function(_0x13bced){return{'model':db[_0x13bced['model']],'as':_0x13bced['as'],'attributes':_0x13bced[_0xb605('0x1e')],'include':_0x13bced['include']?_[_0xb605('0x22')](_0x13bced[_0xb605('0x20')],function(_0x5aae74){return{'model':db[_0x5aae74[_0xb605('0x21')]],'as':_0x5aae74['as'],'attributes':_0x5aae74[_0xb605('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb605('0x10')](function(_0x5aeab0){logger['info'](_0xb605('0x23'),_0x253afa);logger[_0xb605('0x12')](_0xb605('0x23'),_0x253afa,JSON[_0xb605('0x24')](_0x5aeab0));_0x6b2d9c(_0x5aeab0);})['catch'](function(_0xbb09e7){logger[_0xb605('0x14')](_0xb605('0x23'),_0xbb09e7['message'],_0x253afa);_0x72bc(_0xfe9661['error'](0x1f4,_0xbb09e7[_0xb605('0x17')]));});});};exports['CreateVoiceQueueReport']=function(_0x463ef5){var _0x107f81=this;return new Promise(function(_0x55c87a,_0x3568e9){return db[_0xb605('0x1b')][_0xb605('0x25')](_0x463ef5[_0xb605('0x26')],{'raw':_0x463ef5[_0xb605('0x1c')]?_0x463ef5[_0xb605('0x1c')][_0xb605('0x1d')]===undefined?!![]:![]:!![]})[_0xb605('0x10')](function(_0x4b2909){logger[_0xb605('0x18')]('CreateVoiceQueueReport',_0x463ef5);logger[_0xb605('0x12')]('CreateVoiceQueueReport',_0x463ef5,JSON['stringify'](_0x4b2909));_0x55c87a(_0x4b2909);})[_0xb605('0x1a')](function(_0x66829d){logger[_0xb605('0x14')]('CreateVoiceQueueReport',_0x66829d[_0xb605('0x17')],_0x463ef5);_0x3568e9(_0x107f81[_0xb605('0x14')](0x1f4,_0x66829d[_0xb605('0x17')]));});});};exports[_0xb605('0x27')]=function(_0x5d1d35){var _0x253153=this;return new Promise(function(_0x5ba0cd,_0x3cb180){return db[_0xb605('0x1b')][_0xb605('0x28')](_0x5d1d35[_0xb605('0x26')],{'raw':_0x5d1d35[_0xb605('0x1c')]?_0x5d1d35['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d1d35[_0xb605('0x1c')]?_0x5d1d35[_0xb605('0x1c')][_0xb605('0x29')]||null:null,'attributes':_0x5d1d35[_0xb605('0x1c')]?_0x5d1d35[_0xb605('0x1c')][_0xb605('0x1e')]||null:null,'limit':_0x5d1d35[_0xb605('0x1c')]?_0x5d1d35[_0xb605('0x1c')][_0xb605('0x1f')]||null:null})[_0xb605('0x10')](function(_0x91d1a6){logger[_0xb605('0x18')](_0xb605('0x27'),_0x5d1d35);logger[_0xb605('0x12')](_0xb605('0x27'),_0x5d1d35,JSON[_0xb605('0x24')](_0x91d1a6));_0x5ba0cd(_0x91d1a6);})[_0xb605('0x1a')](function(_0x501901){logger[_0xb605('0x14')](_0xb605('0x27'),_0x501901[_0xb605('0x17')],_0x5d1d35);_0x3cb180(_0x253153[_0xb605('0x14')](0x1f4,_0x501901['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 26f70a4..53d5a8d 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 _0xf13b=['./voiceQueueReport.events','emit','removeListener','register'];(function(_0x4fb501,_0x529be8){var _0x41a9c1=function(_0x433025){while(--_0x433025){_0x4fb501['push'](_0x4fb501['shift']());}};_0x41a9c1(++_0x529be8);}(_0xf13b,0x1f0));var _0xbf13=function(_0x511a8f,_0x17c1f3){_0x511a8f=_0x511a8f-0x0;var _0x3bc09f=_0xf13b[_0x511a8f];return _0x3bc09f;};'use strict';var VoiceQueueReportEvents=require(_0xbf13('0x0'));var events=['save','remove','update'];function createListener(_0x347ba8,_0x3ca1f7){return function(_0x20a031){_0x3ca1f7[_0xbf13('0x1')](_0x347ba8,_0x20a031);};}function removeListener(_0x4bb133,_0x58ec26){return function(){VoiceQueueReportEvents[_0xbf13('0x2')](_0x4bb133,_0x58ec26);};}exports[_0xbf13('0x3')]=function(_0x5f4b13){for(var _0x325b03=0x0,_0x2316ad=events['length'];_0x325b03<_0x2316ad;_0x325b03++){var _0x462933=events[_0x325b03];var _0x212fac=createListener('voiceQueueReport:'+_0x462933,_0x5f4b13);VoiceQueueReportEvents['on'](_0x462933,_0x212fac);}}; \ No newline at end of file +var _0x00b3=['voiceQueueReport:','./voiceQueueReport.events','update','emit','register','length'];(function(_0x384827,_0x48df70){var _0x1c535c=function(_0xff800c){while(--_0xff800c){_0x384827['push'](_0x384827['shift']());}};_0x1c535c(++_0x48df70);}(_0x00b3,0x97));var _0x300b=function(_0x2c466c,_0x4fbea5){_0x2c466c=_0x2c466c-0x0;var _0xaacec9=_0x00b3[_0x2c466c];return _0xaacec9;};'use strict';var VoiceQueueReportEvents=require(_0x300b('0x0'));var events=['save','remove',_0x300b('0x1')];function createListener(_0x46c812,_0x4aa4f4){return function(_0x5a96e9){_0x4aa4f4[_0x300b('0x2')](_0x46c812,_0x5a96e9);};}function removeListener(_0x29e653,_0x2feba7){return function(){VoiceQueueReportEvents['removeListener'](_0x29e653,_0x2feba7);};}exports[_0x300b('0x3')]=function(_0xbceeb8){for(var _0x34a5cd=0x0,_0x4294fe=events[_0x300b('0x4')];_0x34a5cd<_0x4294fe;_0x34a5cd++){var _0x2cf1c5=events[_0x34a5cd];var _0x103922=createListener(_0x300b('0x5')+_0x2cf1c5,_0xbceeb8);VoiceQueueReportEvents['on'](_0x2cf1c5,_0x103922);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index a19e73a..20dbd4f 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 _0x5cc6=['get','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','index'];(function(_0x1d899a,_0x5d51ee){var _0x4b6c5a=function(_0x1745b1){while(--_0x1745b1){_0x1d899a['push'](_0x1d899a['shift']());}};_0x4b6c5a(++_0x5d51ee);}(_0x5cc6,0x1c1));var _0x65cc=function(_0x3d5df9,_0x5b3623){_0x3d5df9=_0x3d5df9-0x0;var _0x50ba39=_0x5cc6[_0x3d5df9];return _0x50ba39;};'use strict';var multer=require(_0x65cc('0x0'));var util=require('util');var path=require(_0x65cc('0x1'));var timeout=require(_0x65cc('0x2'));var express=require(_0x65cc('0x3'));var router=express[_0x65cc('0x4')]();var fs_extra=require(_0x65cc('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x65cc('0x6'));var config=require(_0x65cc('0x7'));var controller=require(_0x65cc('0x8'));router['get']('/',auth[_0x65cc('0x9')](),controller[_0x65cc('0xa')]);router[_0x65cc('0xb')](_0x65cc('0xc'),auth['isAuthenticated'](),controller[_0x65cc('0xd')]);router[_0x65cc('0xe')]('/',auth['isAuthenticated'](),controller[_0x65cc('0xf')]);router[_0x65cc('0x10')](_0x65cc('0xc'),auth[_0x65cc('0x9')](),controller['update']);router[_0x65cc('0x11')](_0x65cc('0xc'),auth['isAuthenticated'](),controller[_0x65cc('0x12')]);module[_0x65cc('0x13')]=router; \ No newline at end of file +var _0x65f4=['destroy','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','delete'];(function(_0x41cc3f,_0x2678a2){var _0x47ff58=function(_0x190d53){while(--_0x190d53){_0x41cc3f['push'](_0x41cc3f['shift']());}};_0x47ff58(++_0x2678a2);}(_0x65f4,0x19a));var _0x465f=function(_0x5e4039,_0x579886){_0x5e4039=_0x5e4039-0x0;var _0x2cbf14=_0x65f4[_0x5e4039];return _0x2cbf14;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x465f('0x0'));var timeout=require(_0x465f('0x1'));var express=require(_0x465f('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x465f('0x3'));var interaction=require(_0x465f('0x4'));var config=require(_0x465f('0x5'));var controller=require('./voiceQueuesLog.controller');router[_0x465f('0x6')]('/',auth[_0x465f('0x7')](),controller[_0x465f('0x8')]);router['get'](_0x465f('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x465f('0xa')]('/',auth[_0x465f('0x7')](),controller[_0x465f('0xb')]);router[_0x465f('0xc')](_0x465f('0x9'),auth[_0x465f('0x7')](),controller[_0x465f('0xd')]);router[_0x465f('0xe')]('/:id',auth[_0x465f('0x7')](),controller[_0x465f('0xf')]);module[_0x465f('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index af21ec4..1e40253 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 _0xb77b=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports','STRING'];(function(_0x4f4ce8,_0x1a461a){var _0x5ccc1e=function(_0x2d1feb){while(--_0x2d1feb){_0x4f4ce8['push'](_0x4f4ce8['shift']());}};_0x5ccc1e(++_0x1a461a);}(_0xb77b,0x1ed));var _0xbb77=function(_0x422e1c,_0x1ee46d){_0x422e1c=_0x422e1c-0x0;var _0x3adca3=_0xb77b[_0x422e1c];return _0x3adca3;};'use strict';var Sequelize=require(_0xbb77('0x0'));var moment=require(_0xbb77('0x1'));module[_0xbb77('0x2')]={'time':{'type':Sequelize[_0xbb77('0x3')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xbb77('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xbb77('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xbb77('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xbb77('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xbb77('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xbb77('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xbb77('0x4')],'allowNull':![],'defaultValue':moment()[_0xbb77('0x5')](_0xbb77('0x6'))}}; \ No newline at end of file +var _0x4753=['format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports','STRING'];(function(_0x352d0e,_0x18a2b1){var _0x5cfa77=function(_0x3fff4f){while(--_0x3fff4f){_0x352d0e['push'](_0x352d0e['shift']());}};_0x5cfa77(++_0x18a2b1);}(_0x4753,0x1f4));var _0x3475=function(_0x1ae641,_0x5d21d0){_0x1ae641=_0x1ae641-0x0;var _0x1f4c10=_0x4753[_0x1ae641];return _0x1f4c10;};'use strict';var Sequelize=require(_0x3475('0x0'));var moment=require(_0x3475('0x1'));module[_0x3475('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x3475('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x3475('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x3475('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x3475('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x3475('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0x3475('0x4')](_0x3475('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 9ed9921..503ec55 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 _0xe7c7=['../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','end','sendStatus','stack','name','send','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','VoiceQueuesLog','includeAll','include','findAll','catch','params','rawAttributes','find','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','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/utils'];(function(_0x480bfd,_0x438f5b){var _0x48ec9b=function(_0x3705b1){while(--_0x3705b1){_0x480bfd['push'](_0x480bfd['shift']());}};_0x48ec9b(++_0x438f5b);}(_0xe7c7,0xc7));var _0x7e7c=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xe7c7[_0x36ed48];return _0x51c63a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7e7c('0x0'));var zipdir=require(_0x7e7c('0x1'));var jsonpatch=require(_0x7e7c('0x2'));var rp=require('request-promise');var moment=require(_0x7e7c('0x3'));var BPromise=require(_0x7e7c('0x4'));var Mustache=require('mustache');var util=require(_0x7e7c('0x5'));var path=require('path');var sox=require(_0x7e7c('0x6'));var csv=require(_0x7e7c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7e7c('0x8'));var _=require(_0x7e7c('0x9'));var squel=require(_0x7e7c('0xa'));var crypto=require(_0x7e7c('0xb'));var jsforce=require(_0x7e7c('0xc'));var deskjs=require(_0x7e7c('0xd'));var toCsv=require(_0x7e7c('0x7'));var querystring=require(_0x7e7c('0xe'));var Papa=require(_0x7e7c('0xf'));var Redis=require(_0x7e7c('0x10'));var authService=require(_0x7e7c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7e7c('0x12'));var hardwareService=require(_0x7e7c('0x13'));var logger=require(_0x7e7c('0x14'))(_0x7e7c('0x15'));var utils=require(_0x7e7c('0x16'));var config=require(_0x7e7c('0x17'));var licenseUtil=require(_0x7e7c('0x18'));var db=require(_0x7e7c('0x19'))['db'];function respondWithStatusCode(_0x2b651a,_0x18c5bc){_0x18c5bc=_0x18c5bc||0xcc;return function(_0x51f2b4){if(_0x51f2b4){return _0x2b651a['sendStatus'](_0x18c5bc);}return _0x2b651a[_0x7e7c('0x1a')](_0x18c5bc)['end']();};}function respondWithResult(_0x1990ed,_0x578a6d){_0x578a6d=_0x578a6d||0xc8;return function(_0x4e5c3e){if(_0x4e5c3e){return _0x1990ed[_0x7e7c('0x1a')](_0x578a6d)[_0x7e7c('0x1b')](_0x4e5c3e);}};}function respondWithFilteredResult(_0x10de5c,_0x20365a){return function(_0x2e0673){if(_0x2e0673){var _0x297b61=typeof _0x20365a[_0x7e7c('0x1c')]===_0x7e7c('0x1d')&&typeof _0x20365a[_0x7e7c('0x1e')]===_0x7e7c('0x1d');var _0x4234cb=_0x2e0673[_0x7e7c('0x1f')];var _0x5cd9fb=_0x297b61?0x0:_0x20365a[_0x7e7c('0x1c')];var _0x21bfc9=_0x297b61?_0x2e0673[_0x7e7c('0x1f')]:_0x20365a[_0x7e7c('0x1c')]+_0x20365a[_0x7e7c('0x1e')];var _0x556bfd;if(_0x21bfc9>=_0x4234cb){_0x21bfc9=_0x4234cb;_0x556bfd=0xc8;}else{_0x556bfd=0xce;}_0x10de5c['status'](_0x556bfd);return _0x10de5c['set'](_0x7e7c('0x20'),_0x5cd9fb+'-'+_0x21bfc9+'/'+_0x4234cb)['json'](_0x2e0673);}return null;};}function patchUpdates(_0x4f2c5b){return function(_0x2ef493){try{jsonpatch[_0x7e7c('0x21')](_0x2ef493,_0x4f2c5b,!![]);}catch(_0xee61f6){return BPromise[_0x7e7c('0x22')](_0xee61f6);}return _0x2ef493[_0x7e7c('0x23')]();};}function saveUpdates(_0x929110,_0x287440){return function(_0x3b4e43){if(_0x3b4e43){return _0x3b4e43[_0x7e7c('0x24')](_0x929110)['then'](function(_0x39a181){return _0x39a181;});}return null;};}function removeEntity(_0x2dcce0,_0x3f120b){return function(_0x3fe843){if(_0x3fe843){return _0x3fe843[_0x7e7c('0x25')]()[_0x7e7c('0x26')](function(){_0x2dcce0['status'](0xcc)[_0x7e7c('0x27')]();});}};}function handleEntityNotFound(_0x5815d9,_0x3fc175){return function(_0x23d542){if(!_0x23d542){_0x5815d9[_0x7e7c('0x28')](0x194);}return _0x23d542;};}function handleError(_0x482eea,_0x23fa17){_0x23fa17=_0x23fa17||0x1f4;return function(_0x2166dc){logger['error'](_0x2166dc[_0x7e7c('0x29')]);if(_0x2166dc[_0x7e7c('0x2a')]){delete _0x2166dc[_0x7e7c('0x2a')];}_0x482eea['status'](_0x23fa17)[_0x7e7c('0x2b')](_0x2166dc);};}exports['index']=function(_0x4ae9f4,_0x418a20){var _0x3e267f={},_0x46109a={},_0x1912de={'count':0x0,'rows':[]};var _0x345205=_['map'](db['VoiceQueuesLog']['rawAttributes'],function(_0x1f2213){return{'name':_0x1f2213[_0x7e7c('0x2c')],'type':_0x1f2213[_0x7e7c('0x2d')][_0x7e7c('0x2e')]};});_0x46109a[_0x7e7c('0x2f')]=_[_0x7e7c('0x30')](_0x345205,_0x7e7c('0x2a'));_0x46109a[_0x7e7c('0x31')]=_['keys'](_0x4ae9f4[_0x7e7c('0x31')]);_0x46109a[_0x7e7c('0x32')]=_[_0x7e7c('0x33')](_0x46109a[_0x7e7c('0x2f')],_0x46109a[_0x7e7c('0x31')]);_0x3e267f[_0x7e7c('0x34')]=_[_0x7e7c('0x33')](_0x46109a[_0x7e7c('0x2f')],qs[_0x7e7c('0x35')](_0x4ae9f4[_0x7e7c('0x31')][_0x7e7c('0x35')]));_0x3e267f[_0x7e7c('0x34')]=_0x3e267f[_0x7e7c('0x34')]['length']?_0x3e267f[_0x7e7c('0x34')]:_0x46109a[_0x7e7c('0x2f')];if(!_0x4ae9f4['query'][_0x7e7c('0x36')](_0x7e7c('0x37'))){_0x3e267f['limit']=qs[_0x7e7c('0x1e')](_0x4ae9f4[_0x7e7c('0x31')][_0x7e7c('0x1e')]);_0x3e267f['offset']=qs['offset'](_0x4ae9f4['query']['offset']);}_0x3e267f[_0x7e7c('0x38')]=qs[_0x7e7c('0x39')](_0x4ae9f4['query']['sort']);_0x3e267f[_0x7e7c('0x3a')]=qs[_0x7e7c('0x32')](_[_0x7e7c('0x3b')](_0x4ae9f4['query'],_0x46109a[_0x7e7c('0x32')]),_0x345205);if(_0x4ae9f4['query']['filter']){_0x3e267f[_0x7e7c('0x3a')]=_[_0x7e7c('0x3c')](_0x3e267f[_0x7e7c('0x3a')],{'$or':_['map'](_0x345205,function(_0x18316d){if(_0x18316d['type']!==_0x7e7c('0x3d')){var _0x57ce45={};_0x57ce45[_0x18316d['name']]={'$like':'%'+_0x4ae9f4[_0x7e7c('0x31')][_0x7e7c('0x3e')]+'%'};return _0x57ce45;}})});}_0x3e267f=_[_0x7e7c('0x3c')]({},_0x3e267f,_0x4ae9f4[_0x7e7c('0x3f')]);var _0x1461a4={'where':_0x3e267f[_0x7e7c('0x3a')]};return db[_0x7e7c('0x40')][_0x7e7c('0x1f')](_0x1461a4)[_0x7e7c('0x26')](function(_0x49b5ea){_0x1912de['count']=_0x49b5ea;if(_0x4ae9f4[_0x7e7c('0x31')][_0x7e7c('0x41')]){_0x3e267f[_0x7e7c('0x42')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x7e7c('0x43')](_0x3e267f);})[_0x7e7c('0x26')](function(_0x1090b4){_0x1912de['rows']=_0x1090b4;return _0x1912de;})['then'](respondWithFilteredResult(_0x418a20,_0x3e267f))[_0x7e7c('0x44')](handleError(_0x418a20,null));};exports['show']=function(_0x2ad362,_0x2f1240){var _0xfb4f77={'raw':!![],'where':{'id':_0x2ad362[_0x7e7c('0x45')]['id']}},_0x1a52e4={};_0x1a52e4[_0x7e7c('0x2f')]=_['keys'](db['VoiceQueuesLog'][_0x7e7c('0x46')]);_0x1a52e4[_0x7e7c('0x31')]=_['keys'](_0x2ad362[_0x7e7c('0x31')]);_0x1a52e4['filters']=_[_0x7e7c('0x33')](_0x1a52e4[_0x7e7c('0x2f')],_0x1a52e4[_0x7e7c('0x31')]);_0xfb4f77[_0x7e7c('0x34')]=_[_0x7e7c('0x33')](_0x1a52e4['model'],qs[_0x7e7c('0x35')](_0x2ad362['query'][_0x7e7c('0x35')]));_0xfb4f77['attributes']=_0xfb4f77[_0x7e7c('0x34')]['length']?_0xfb4f77[_0x7e7c('0x34')]:_0x1a52e4[_0x7e7c('0x2f')];if(_0x2ad362[_0x7e7c('0x31')]['includeAll']){_0xfb4f77[_0x7e7c('0x42')]=[{'all':!![]}];}_0xfb4f77=_[_0x7e7c('0x3c')]({},_0xfb4f77,_0x2ad362[_0x7e7c('0x3f')]);return db[_0x7e7c('0x40')][_0x7e7c('0x47')](_0xfb4f77)[_0x7e7c('0x26')](handleEntityNotFound(_0x2f1240,null))[_0x7e7c('0x26')](respondWithResult(_0x2f1240,null))['catch'](handleError(_0x2f1240,null));};exports['create']=function(_0x3c52c4,_0x2a0c61){return db['VoiceQueuesLog'][_0x7e7c('0x48')](_0x3c52c4[_0x7e7c('0x49')],{})['then'](respondWithResult(_0x2a0c61,0xc9))[_0x7e7c('0x44')](handleError(_0x2a0c61,null));};exports[_0x7e7c('0x24')]=function(_0x5ac944,_0x2f5d5a){if(_0x5ac944[_0x7e7c('0x49')]['id']){delete _0x5ac944['body']['id'];}return db[_0x7e7c('0x40')]['find']({'where':{'id':_0x5ac944[_0x7e7c('0x45')]['id']}})[_0x7e7c('0x26')](handleEntityNotFound(_0x2f5d5a,null))['then'](saveUpdates(_0x5ac944[_0x7e7c('0x49')],null))[_0x7e7c('0x26')](respondWithResult(_0x2f5d5a,null))[_0x7e7c('0x44')](handleError(_0x2f5d5a,null));};exports[_0x7e7c('0x25')]=function(_0x1c9680,_0x596a08){return db[_0x7e7c('0x40')][_0x7e7c('0x47')]({'where':{'id':_0x1c9680[_0x7e7c('0x45')]['id']}})[_0x7e7c('0x26')](handleEntityNotFound(_0x596a08,null))[_0x7e7c('0x26')](removeEntity(_0x596a08,null))['catch'](handleError(_0x596a08,null));}; \ No newline at end of file +var _0xf2eb=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','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','set','save','update','then','error','stack','send','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','create','body','params','destroy','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x406f80,_0x230d56){var _0x5bf5d8=function(_0x26c1ed){while(--_0x26c1ed){_0x406f80['push'](_0x406f80['shift']());}};_0x5bf5d8(++_0x230d56);}(_0xf2eb,0x128));var _0xbf2e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xf2eb[_0x311c35];return _0x5cc50c;};'use strict';var emlformat=require(_0xbf2e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbf2e('0x1'));var jsonpatch=require(_0xbf2e('0x2'));var rp=require(_0xbf2e('0x3'));var moment=require(_0xbf2e('0x4'));var BPromise=require(_0xbf2e('0x5'));var Mustache=require(_0xbf2e('0x6'));var util=require(_0xbf2e('0x7'));var path=require(_0xbf2e('0x8'));var sox=require(_0xbf2e('0x9'));var csv=require(_0xbf2e('0xa'));var ejs=require(_0xbf2e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbf2e('0xc'));var squel=require('squel');var crypto=require(_0xbf2e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbf2e('0xe'));var toCsv=require(_0xbf2e('0xa'));var querystring=require(_0xbf2e('0xf'));var Papa=require('papaparse');var Redis=require(_0xbf2e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbf2e('0x11'));var as=require(_0xbf2e('0x12'));var hardwareService=require(_0xbf2e('0x13'));var logger=require(_0xbf2e('0x14'))(_0xbf2e('0x15'));var utils=require(_0xbf2e('0x16'));var config=require(_0xbf2e('0x17'));var licenseUtil=require(_0xbf2e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xfe8bfd,_0x17085f){_0x17085f=_0x17085f||0xcc;return function(_0x16b4fc){if(_0x16b4fc){return _0xfe8bfd[_0xbf2e('0x19')](_0x17085f);}return _0xfe8bfd[_0xbf2e('0x1a')](_0x17085f)[_0xbf2e('0x1b')]();};}function respondWithResult(_0x44dfa5,_0x546113){_0x546113=_0x546113||0xc8;return function(_0x2dcedd){if(_0x2dcedd){return _0x44dfa5[_0xbf2e('0x1a')](_0x546113)[_0xbf2e('0x1c')](_0x2dcedd);}};}function respondWithFilteredResult(_0x110522,_0x3d7a76){return function(_0x2d92ef){if(_0x2d92ef){var _0xc6babb=typeof _0x3d7a76[_0xbf2e('0x1d')]===_0xbf2e('0x1e')&&typeof _0x3d7a76[_0xbf2e('0x1f')]===_0xbf2e('0x1e');var _0x587f2e=_0x2d92ef['count'];var _0x84cc9=_0xc6babb?0x0:_0x3d7a76['offset'];var _0x4662d8=_0xc6babb?_0x2d92ef[_0xbf2e('0x20')]:_0x3d7a76[_0xbf2e('0x1d')]+_0x3d7a76[_0xbf2e('0x1f')];var _0x556880;if(_0x4662d8>=_0x587f2e){_0x4662d8=_0x587f2e;_0x556880=0xc8;}else{_0x556880=0xce;}_0x110522['status'](_0x556880);return _0x110522[_0xbf2e('0x21')]('Content-Range',_0x84cc9+'-'+_0x4662d8+'/'+_0x587f2e)[_0xbf2e('0x1c')](_0x2d92ef);}return null;};}function patchUpdates(_0x201ac0){return function(_0x29523c){try{jsonpatch['apply'](_0x29523c,_0x201ac0,!![]);}catch(_0x182ad3){return BPromise['reject'](_0x182ad3);}return _0x29523c[_0xbf2e('0x22')]();};}function saveUpdates(_0x4efab9,_0x5dcef2){return function(_0x168cb7){if(_0x168cb7){return _0x168cb7[_0xbf2e('0x23')](_0x4efab9)[_0xbf2e('0x24')](function(_0x23e3b8){return _0x23e3b8;});}return null;};}function removeEntity(_0x6f40c0,_0x436a29){return function(_0x50b99a){if(_0x50b99a){return _0x50b99a['destroy']()[_0xbf2e('0x24')](function(){_0x6f40c0[_0xbf2e('0x1a')](0xcc)[_0xbf2e('0x1b')]();});}};}function handleEntityNotFound(_0x477f17,_0xfa7732){return function(_0x41f641){if(!_0x41f641){_0x477f17[_0xbf2e('0x19')](0x194);}return _0x41f641;};}function handleError(_0x5d9c8b,_0x49edd4){_0x49edd4=_0x49edd4||0x1f4;return function(_0x1f6f63){logger[_0xbf2e('0x25')](_0x1f6f63[_0xbf2e('0x26')]);if(_0x1f6f63['name']){delete _0x1f6f63['name'];}_0x5d9c8b[_0xbf2e('0x1a')](_0x49edd4)[_0xbf2e('0x27')](_0x1f6f63);};}exports['index']=function(_0x466430,_0xc29b74){var _0x5df40d={},_0x3a7ca4={},_0x1add2f={'count':0x0,'rows':[]};var _0x1fd420=_[_0xbf2e('0x28')](db[_0xbf2e('0x29')][_0xbf2e('0x2a')],function(_0x566917){return{'name':_0x566917[_0xbf2e('0x2b')],'type':_0x566917[_0xbf2e('0x2c')][_0xbf2e('0x2d')]};});_0x3a7ca4[_0xbf2e('0x2e')]=_[_0xbf2e('0x28')](_0x1fd420,_0xbf2e('0x2f'));_0x3a7ca4['query']=_[_0xbf2e('0x30')](_0x466430[_0xbf2e('0x31')]);_0x3a7ca4[_0xbf2e('0x32')]=_[_0xbf2e('0x33')](_0x3a7ca4['model'],_0x3a7ca4[_0xbf2e('0x31')]);_0x5df40d[_0xbf2e('0x34')]=_['intersection'](_0x3a7ca4[_0xbf2e('0x2e')],qs[_0xbf2e('0x35')](_0x466430[_0xbf2e('0x31')]['fields']));_0x5df40d[_0xbf2e('0x34')]=_0x5df40d[_0xbf2e('0x34')][_0xbf2e('0x36')]?_0x5df40d[_0xbf2e('0x34')]:_0x3a7ca4[_0xbf2e('0x2e')];if(!_0x466430[_0xbf2e('0x31')][_0xbf2e('0x37')]('nolimit')){_0x5df40d[_0xbf2e('0x1f')]=qs['limit'](_0x466430[_0xbf2e('0x31')][_0xbf2e('0x1f')]);_0x5df40d[_0xbf2e('0x1d')]=qs[_0xbf2e('0x1d')](_0x466430['query'][_0xbf2e('0x1d')]);}_0x5df40d[_0xbf2e('0x38')]=qs[_0xbf2e('0x39')](_0x466430[_0xbf2e('0x31')][_0xbf2e('0x39')]);_0x5df40d[_0xbf2e('0x3a')]=qs[_0xbf2e('0x32')](_[_0xbf2e('0x3b')](_0x466430[_0xbf2e('0x31')],_0x3a7ca4[_0xbf2e('0x32')]),_0x1fd420);if(_0x466430[_0xbf2e('0x31')][_0xbf2e('0x3c')]){_0x5df40d[_0xbf2e('0x3a')]=_[_0xbf2e('0x3d')](_0x5df40d[_0xbf2e('0x3a')],{'$or':_[_0xbf2e('0x28')](_0x1fd420,function(_0xe44b9d){if(_0xe44b9d['type']!==_0xbf2e('0x3e')){var _0xafcd70={};_0xafcd70[_0xe44b9d[_0xbf2e('0x2f')]]={'$like':'%'+_0x466430['query'][_0xbf2e('0x3c')]+'%'};return _0xafcd70;}})});}_0x5df40d=_[_0xbf2e('0x3d')]({},_0x5df40d,_0x466430[_0xbf2e('0x3f')]);var _0x5b8cdf={'where':_0x5df40d[_0xbf2e('0x3a')]};return db[_0xbf2e('0x29')][_0xbf2e('0x20')](_0x5b8cdf)[_0xbf2e('0x24')](function(_0x17ac3e){_0x1add2f[_0xbf2e('0x20')]=_0x17ac3e;if(_0x466430[_0xbf2e('0x31')][_0xbf2e('0x40')]){_0x5df40d[_0xbf2e('0x41')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0xbf2e('0x42')](_0x5df40d);})[_0xbf2e('0x24')](function(_0x5d5286){_0x1add2f[_0xbf2e('0x43')]=_0x5d5286;return _0x1add2f;})[_0xbf2e('0x24')](respondWithFilteredResult(_0xc29b74,_0x5df40d))['catch'](handleError(_0xc29b74,null));};exports[_0xbf2e('0x44')]=function(_0x343c62,_0x31549e){var _0x632e9f={'raw':!![],'where':{'id':_0x343c62['params']['id']}},_0xbd2346={};_0xbd2346['model']=_[_0xbf2e('0x30')](db[_0xbf2e('0x29')][_0xbf2e('0x2a')]);_0xbd2346[_0xbf2e('0x31')]=_[_0xbf2e('0x30')](_0x343c62[_0xbf2e('0x31')]);_0xbd2346[_0xbf2e('0x32')]=_['intersection'](_0xbd2346[_0xbf2e('0x2e')],_0xbd2346[_0xbf2e('0x31')]);_0x632e9f[_0xbf2e('0x34')]=_[_0xbf2e('0x33')](_0xbd2346[_0xbf2e('0x2e')],qs[_0xbf2e('0x35')](_0x343c62[_0xbf2e('0x31')]['fields']));_0x632e9f['attributes']=_0x632e9f['attributes'][_0xbf2e('0x36')]?_0x632e9f[_0xbf2e('0x34')]:_0xbd2346[_0xbf2e('0x2e')];if(_0x343c62[_0xbf2e('0x31')][_0xbf2e('0x40')]){_0x632e9f[_0xbf2e('0x41')]=[{'all':!![]}];}_0x632e9f=_[_0xbf2e('0x3d')]({},_0x632e9f,_0x343c62[_0xbf2e('0x3f')]);return db['VoiceQueuesLog'][_0xbf2e('0x45')](_0x632e9f)[_0xbf2e('0x24')](handleEntityNotFound(_0x31549e,null))['then'](respondWithResult(_0x31549e,null))[_0xbf2e('0x46')](handleError(_0x31549e,null));};exports['create']=function(_0x34f1f0,_0x31846f){return db[_0xbf2e('0x29')][_0xbf2e('0x47')](_0x34f1f0[_0xbf2e('0x48')],{})[_0xbf2e('0x24')](respondWithResult(_0x31846f,0xc9))['catch'](handleError(_0x31846f,null));};exports['update']=function(_0x29df77,_0x3815e9){if(_0x29df77[_0xbf2e('0x48')]['id']){delete _0x29df77['body']['id'];}return db[_0xbf2e('0x29')][_0xbf2e('0x45')]({'where':{'id':_0x29df77[_0xbf2e('0x49')]['id']}})[_0xbf2e('0x24')](handleEntityNotFound(_0x3815e9,null))[_0xbf2e('0x24')](saveUpdates(_0x29df77[_0xbf2e('0x48')],null))[_0xbf2e('0x24')](respondWithResult(_0x3815e9,null))['catch'](handleError(_0x3815e9,null));};exports[_0xbf2e('0x4a')]=function(_0x3b54b9,_0x37ffb8){return db[_0xbf2e('0x29')][_0xbf2e('0x45')]({'where':{'id':_0x3b54b9[_0xbf2e('0x49')]['id']}})['then'](handleEntityNotFound(_0x37ffb8,null))[_0xbf2e('0x24')](removeEntity(_0x37ffb8,null))[_0xbf2e('0x46')](handleError(_0x37ffb8,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 232cb61..9683e1e 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 _0x94b1=['moment','bluebird','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','util','api'];(function(_0x31383b,_0x8a7e0f){var _0x438b36=function(_0x543e87){while(--_0x543e87){_0x31383b['push'](_0x31383b['shift']());}};_0x438b36(++_0x8a7e0f);}(_0x94b1,0x102));var _0x194b=function(_0x5b41dc,_0x1e880b){_0x5b41dc=_0x5b41dc-0x0;var _0x29caf2=_0x94b1[_0x5b41dc];return _0x29caf2;};'use strict';var _=require('lodash');var util=require(_0x194b('0x0'));var logger=require('../../config/logger')(_0x194b('0x1'));var moment=require(_0x194b('0x2'));var BPromise=require(_0x194b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x194b('0x4'));var rimraf=require(_0x194b('0x5'));var config=require(_0x194b('0x6'));var attributes=require(_0x194b('0x7'));module['exports']=function(_0x3a15fb,_0x31b63d){return _0x3a15fb['define'](_0x194b('0x8'),attributes,{'tableName':_0x194b('0x9'),'paranoid':![],'indexes':[{'name':_0x194b('0xa'),'fields':[_0x194b('0xb'),_0x194b('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x8369=['api','moment','bluebird','request-promise','rimraf','./voiceQueuesLog.attributes','exports','define','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger'];(function(_0x5275b8,_0x51e5dd){var _0x568a9b=function(_0x583a71){while(--_0x583a71){_0x5275b8['push'](_0x5275b8['shift']());}};_0x568a9b(++_0x51e5dd);}(_0x8369,0x10b));var _0x9836=function(_0x5eb6de,_0xdb4c4d){_0x5eb6de=_0x5eb6de-0x0;var _0x514fad=_0x8369[_0x5eb6de];return _0x514fad;};'use strict';var _=require(_0x9836('0x0'));var util=require(_0x9836('0x1'));var logger=require(_0x9836('0x2'))(_0x9836('0x3'));var moment=require(_0x9836('0x4'));var BPromise=require(_0x9836('0x5'));var rp=require(_0x9836('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9836('0x7'));var config=require('../../config/environment');var attributes=require(_0x9836('0x8'));module[_0x9836('0x9')]=function(_0x4e937c,_0x33ac6d){return _0x4e937c[_0x9836('0xa')]('VoiceQueuesLog',attributes,{'tableName':_0x9836('0xb'),'paranoid':![],'indexes':[{'name':_0x9836('0xc'),'fields':[_0x9836('0xd'),_0x9836('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index d4937ff..4b1faaa 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 _0xa87e=['client','then','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0xcbf7d7,_0x32e64a){var _0x23269d=function(_0x27502a){while(--_0x27502a){_0xcbf7d7['push'](_0xcbf7d7['shift']());}};_0x23269d(++_0x32e64a);}(_0xa87e,0x173));var _0xea87=function(_0x3dd185,_0x49230e){_0x3dd185=_0x3dd185-0x0;var _0x5ac9b9=_0xa87e[_0x3dd185];return _0x5ac9b9;};'use strict';var _=require('lodash');var util=require(_0xea87('0x0'));var moment=require(_0xea87('0x1'));var BPromise=require(_0xea87('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xea87('0x3'));var db=require(_0xea87('0x4'))['db'];var utils=require(_0xea87('0x5'));var logger=require(_0xea87('0x6'))(_0xea87('0x7'));var config=require('../../config/environment');var jayson=require(_0xea87('0x8'));var client=jayson[_0xea87('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f3c3a,_0x1b566a,_0x36352b){return new BPromise(function(_0xd0dd3b,_0xa7d4f){return client['request'](_0x2f3c3a,_0x36352b)[_0xea87('0xa')](function(_0x1ea786){logger['info'](_0xea87('0xb'),_0x1b566a,_0xea87('0xc'));logger['debug']('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x1b566a,_0xea87('0xc'),JSON[_0xea87('0xd')](_0x1ea786));if(_0x1ea786[_0xea87('0xe')]){if(_0x1ea786[_0xea87('0xe')][_0xea87('0xf')]===0x1f4){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x1b566a,_0x1ea786[_0xea87('0xe')][_0xea87('0x10')]);return _0xa7d4f(_0x1ea786['error'][_0xea87('0x10')]);}logger[_0xea87('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1b566a,_0x1ea786[_0xea87('0xe')][_0xea87('0x10')]);return _0xd0dd3b(_0x1ea786[_0xea87('0xe')][_0xea87('0x10')]);}else{logger[_0xea87('0x11')](_0xea87('0xb'),_0x1b566a,'request\x20sent');_0xd0dd3b(_0x1ea786[_0xea87('0x12')][_0xea87('0x10')]);}})['catch'](function(_0x22b62d){logger[_0xea87('0xe')](_0xea87('0xb'),_0x1b566a,_0x22b62d);_0xa7d4f(_0x22b62d);});});} \ No newline at end of file +var _0x7119=['jayson/promise','client','http','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x7119,0x1c7));var _0x9711=function(_0x29c261,_0x3af39a){_0x29c261=_0x29c261-0x0;var _0x1a9335=_0x7119[_0x29c261];return _0x1a9335;};'use strict';var _=require('lodash');var util=require(_0x9711('0x0'));var moment=require('moment');var BPromise=require(_0x9711('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9711('0x2'));var db=require(_0x9711('0x3'))['db'];var utils=require(_0x9711('0x4'));var logger=require(_0x9711('0x5'))('rpc');var config=require(_0x9711('0x6'));var jayson=require(_0x9711('0x7'));var client=jayson[_0x9711('0x8')][_0x9711('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x191701,_0x4c75dd,_0x31af88){return new BPromise(function(_0x3a5f79,_0x132b5b){return client['request'](_0x191701,_0x31af88)[_0x9711('0xa')](function(_0x4b13b9){logger[_0x9711('0xb')](_0x9711('0xc'),_0x4c75dd,_0x9711('0xd'));logger['debug'](_0x9711('0xe'),_0x4c75dd,_0x9711('0xd'),JSON[_0x9711('0xf')](_0x4b13b9));if(_0x4b13b9[_0x9711('0x10')]){if(_0x4b13b9[_0x9711('0x10')][_0x9711('0x11')]===0x1f4){logger[_0x9711('0x10')](_0x9711('0xc'),_0x4c75dd,_0x4b13b9[_0x9711('0x10')][_0x9711('0x12')]);return _0x132b5b(_0x4b13b9[_0x9711('0x10')]['message']);}logger['error'](_0x9711('0xc'),_0x4c75dd,_0x4b13b9[_0x9711('0x10')][_0x9711('0x12')]);return _0x3a5f79(_0x4b13b9[_0x9711('0x10')][_0x9711('0x12')]);}else{logger['info'](_0x9711('0xc'),_0x4c75dd,'request\x20sent');_0x3a5f79(_0x4b13b9[_0x9711('0x13')][_0x9711('0x12')]);}})[_0x9711('0x14')](function(_0x640894){logger[_0x9711('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4c75dd,_0x640894);_0x132b5b(_0x640894);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index d9ad942..a88c884 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 _0xef3d=['/describe','/:id','show','/:id/download','download','/:id/downloads','downloadTranscribe','post','create','/:id/transcribe','runTranscribe','put','destroy','exports','util','path','express','Router','fs-extra','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xef3d,0xce));var _0xdef3=function(_0x3ef45c,_0x435028){_0x3ef45c=_0x3ef45c-0x0;var _0xdff7b2=_0xef3d[_0x3ef45c];return _0xdff7b2;};'use strict';var multer=require('multer');var util=require(_0xdef3('0x0'));var path=require(_0xdef3('0x1'));var timeout=require('connect-timeout');var express=require(_0xdef3('0x2'));var router=express[_0xdef3('0x3')]();var fs_extra=require(_0xdef3('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdef3('0x5'));var controller=require(_0xdef3('0x6'));router[_0xdef3('0x7')]('/',auth[_0xdef3('0x8')](),controller[_0xdef3('0x9')]);router[_0xdef3('0x7')](_0xdef3('0xa'),auth[_0xdef3('0x8')](),controller['describe']);router[_0xdef3('0x7')](_0xdef3('0xb'),auth[_0xdef3('0x8')](),controller[_0xdef3('0xc')]);router['get'](_0xdef3('0xd'),auth['isAuthenticated'](),controller[_0xdef3('0xe')]);router[_0xdef3('0x7')](_0xdef3('0xf'),controller['downloads']);router[_0xdef3('0x7')]('/:id/transcribe',auth[_0xdef3('0x8')](),controller[_0xdef3('0x10')]);router[_0xdef3('0x11')]('/',auth['isAuthenticated'](),controller[_0xdef3('0x12')]);router[_0xdef3('0x11')](_0xdef3('0x13'),auth[_0xdef3('0x8')](),controller[_0xdef3('0x14')]);router[_0xdef3('0x15')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xdef3('0x16')]);module[_0xdef3('0x17')]=router; \ No newline at end of file +var _0x7064=['downloads','/:id/transcribe','downloadTranscribe','post','put','/:id','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','show','download'];(function(_0x92c998,_0x1a4026){var _0x246239=function(_0x4d8f0b){while(--_0x4d8f0b){_0x92c998['push'](_0x92c998['shift']());}};_0x246239(++_0x1a4026);}(_0x7064,0x159));var _0x4706=function(_0x2fc158,_0x1dcafc){_0x2fc158=_0x2fc158-0x0;var _0xbbdcd3=_0x7064[_0x2fc158];return _0xbbdcd3;};'use strict';var multer=require(_0x4706('0x0'));var util=require(_0x4706('0x1'));var path=require(_0x4706('0x2'));var timeout=require('connect-timeout');var express=require(_0x4706('0x3'));var router=express[_0x4706('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4706('0x5'));var interaction=require(_0x4706('0x6'));var config=require('../../config/environment');var controller=require(_0x4706('0x7'));router[_0x4706('0x8')]('/',auth[_0x4706('0x9')](),controller[_0x4706('0xa')]);router[_0x4706('0x8')](_0x4706('0xb'),auth[_0x4706('0x9')](),controller[_0x4706('0xc')]);router[_0x4706('0x8')]('/:id',auth[_0x4706('0x9')](),controller[_0x4706('0xd')]);router['get']('/:id/download',auth[_0x4706('0x9')](),controller[_0x4706('0xe')]);router['get']('/:id/downloads',controller[_0x4706('0xf')]);router['get'](_0x4706('0x10'),auth['isAuthenticated'](),controller[_0x4706('0x11')]);router[_0x4706('0x12')]('/',auth[_0x4706('0x9')](),controller['create']);router['post'](_0x4706('0x10'),auth[_0x4706('0x9')](),controller['runTranscribe']);router[_0x4706('0x13')](_0x4706('0x14'),auth[_0x4706('0x9')](),controller[_0x4706('0x15')]);router[_0x4706('0x16')](_0x4706('0x14'),auth[_0x4706('0x9')](),controller['destroy']);module[_0x4706('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 515b77d..8193474 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(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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 bbfb5ba..30a4010 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 _0x3f2b=['.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','error','name','send','index','VoiceRecording','rawAttributes','type','key','model','format','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','offset','order','sort','where','filter','map','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','downloads','sequelize','col','token','$and','push','decryptFile','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','createBucket','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','TranscriptionJobStatus','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','language','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','data1','data2','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x3f2b,0x95));var _0xb3f2=function(_0x5f2e88,_0x42a255){_0x5f2e88=_0x5f2e88-0x0;var _0x5af328=_0x3f2b[_0x5f2e88];return _0x5af328;};'use strict';var emlformat=require(_0xb3f2('0x0'));var rimraf=require(_0xb3f2('0x1'));var zipdir=require(_0xb3f2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb3f2('0x3'));var moment=require('moment');var BPromise=require(_0xb3f2('0x4'));var Mustache=require('mustache');var util=require(_0xb3f2('0x5'));var path=require('path');var sox=require(_0xb3f2('0x6'));var csv=require(_0xb3f2('0x7'));var ejs=require(_0xb3f2('0x8'));var fs=require('fs');var fs_extra=require(_0xb3f2('0x9'));var _=require('lodash');var squel=require(_0xb3f2('0xa'));var crypto=require(_0xb3f2('0xb'));var jsforce=require(_0xb3f2('0xc'));var deskjs=require(_0xb3f2('0xd'));var toCsv=require(_0xb3f2('0x7'));var querystring=require(_0xb3f2('0xe'));var Papa=require(_0xb3f2('0xf'));var AWS=require('aws-sdk');var uuidv4=require(_0xb3f2('0x10'));var Redis=require(_0xb3f2('0x11'));var authService=require(_0xb3f2('0x12'));var qs=require(_0xb3f2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb3f2('0x14'))(_0xb3f2('0x15'));var utils=require(_0xb3f2('0x16'));var config=require(_0xb3f2('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb3f2('0x18'))['db'];function respondWithStatusCode(_0x2db321,_0x4ff341){_0x4ff341=_0x4ff341||0xcc;return function(_0x395015){if(_0x395015){return _0x2db321[_0xb3f2('0x19')](_0x4ff341);}return _0x2db321[_0xb3f2('0x1a')](_0x4ff341)[_0xb3f2('0x1b')]();};}function respondWithResult(_0x22a40a,_0x16798f){_0x16798f=_0x16798f||0xc8;return function(_0x29cfa6){if(_0x29cfa6){return _0x22a40a[_0xb3f2('0x1a')](_0x16798f)['json'](_0x29cfa6);}};}function respondWithFilteredResult(_0x529dc4,_0x680298){return function(_0xa81969){if(_0xa81969){var _0xc72136=typeof _0x680298['offset']===_0xb3f2('0x1c')&&typeof _0x680298[_0xb3f2('0x1d')]==='undefined';var _0xadefa6=_0xa81969[_0xb3f2('0x1e')];var _0x2ea024=_0xc72136?0x0:_0x680298['offset'];var _0x3e24c2=_0xc72136?_0xa81969[_0xb3f2('0x1e')]:_0x680298['offset']+_0x680298[_0xb3f2('0x1d')];var _0x3b7073;if(_0x3e24c2>=_0xadefa6){_0x3e24c2=_0xadefa6;_0x3b7073=0xc8;}else{_0x3b7073=0xce;}_0x529dc4[_0xb3f2('0x1a')](_0x3b7073);return _0x529dc4[_0xb3f2('0x1f')](_0xb3f2('0x20'),_0x2ea024+'-'+_0x3e24c2+'/'+_0xadefa6)['json'](_0xa81969);}return null;};}function patchUpdates(_0x1a0638){return function(_0x9037ee){try{jsonpatch[_0xb3f2('0x21')](_0x9037ee,_0x1a0638,!![]);}catch(_0x3d2f12){return BPromise['reject'](_0x3d2f12);}return _0x9037ee[_0xb3f2('0x22')]();};}function saveUpdates(_0x85db00,_0x3c8dcf){return function(_0x33e2bf){if(_0x33e2bf){return _0x33e2bf[_0xb3f2('0x23')](_0x85db00)['then'](function(_0x13adee){return _0x13adee;});}return null;};}function removeEntity(_0x57af3d,_0x1cf545){return function(_0xc9c0f8){if(_0xc9c0f8){return _0xc9c0f8[_0xb3f2('0x24')]()[_0xb3f2('0x25')](function(){_0x57af3d[_0xb3f2('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7ed4a5,_0x48c780){return function(_0x444ff8){if(!_0x444ff8){_0x7ed4a5[_0xb3f2('0x19')](0x194);}return _0x444ff8;};}function handleError(_0x1f526a,_0x5467e6){_0x5467e6=_0x5467e6||0x1f4;return function(_0x49f0e7){logger[_0xb3f2('0x26')](_0x49f0e7['stack']);if(_0x49f0e7['name']){delete _0x49f0e7[_0xb3f2('0x27')];}_0x1f526a[_0xb3f2('0x1a')](_0x5467e6)[_0xb3f2('0x28')](_0x49f0e7);};}exports[_0xb3f2('0x29')]=function(_0x397aae,_0x21764a){var _0x52d8fc={},_0x218da3={},_0x33f937={'count':0x0,'rows':[]};var _0x5d9c6b=_['map'](db[_0xb3f2('0x2a')][_0xb3f2('0x2b')],function(_0x326dcf){return{'name':_0x326dcf['fieldName'],'type':_0x326dcf[_0xb3f2('0x2c')][_0xb3f2('0x2d')]};});_0x218da3[_0xb3f2('0x2e')]=_['differenceBy'](_['map'](_0x5d9c6b,'name'),[_0xb3f2('0x2f')]);_0x218da3['query']=_[_0xb3f2('0x30')](_0x397aae[_0xb3f2('0x31')]);_0x218da3[_0xb3f2('0x32')]=_[_0xb3f2('0x33')](_0x218da3['model'],_0x218da3[_0xb3f2('0x31')]);_0x52d8fc['attributes']=_[_0xb3f2('0x33')](_0x218da3['model'],qs[_0xb3f2('0x34')](_0x397aae[_0xb3f2('0x31')][_0xb3f2('0x34')]));_0x52d8fc[_0xb3f2('0x35')]=_0x52d8fc['attributes'][_0xb3f2('0x36')]?_0x52d8fc[_0xb3f2('0x35')]:_0x218da3[_0xb3f2('0x2e')];if(!_0x397aae[_0xb3f2('0x31')][_0xb3f2('0x37')]('nolimit')){_0x52d8fc[_0xb3f2('0x1d')]=qs[_0xb3f2('0x1d')](_0x397aae['query'][_0xb3f2('0x1d')]);_0x52d8fc['offset']=qs['offset'](_0x397aae[_0xb3f2('0x31')][_0xb3f2('0x38')]);}_0x52d8fc[_0xb3f2('0x39')]=qs[_0xb3f2('0x3a')](_0x397aae[_0xb3f2('0x31')]['sort']);_0x52d8fc[_0xb3f2('0x3b')]=qs[_0xb3f2('0x32')](_['pick'](_0x397aae[_0xb3f2('0x31')],_0x218da3[_0xb3f2('0x32')]),_0x5d9c6b);if(_0x397aae['query'][_0xb3f2('0x3c')]){_0x52d8fc[_0xb3f2('0x3b')]=_['merge'](_0x52d8fc[_0xb3f2('0x3b')],{'$or':_[_0xb3f2('0x3d')](_0x5d9c6b,function(_0x258daa){if(_0x258daa['type']!=='VIRTUAL'){var _0x3e8dca={};_0x3e8dca[_0x258daa[_0xb3f2('0x27')]]={'$like':'%'+_0x397aae['query'][_0xb3f2('0x3c')]+'%'};return _0x3e8dca;}})});}_0x52d8fc=_[_0xb3f2('0x3e')]({},_0x52d8fc,_0x397aae[_0xb3f2('0x3f')]);var _0x5ea1bc={'where':_0x52d8fc[_0xb3f2('0x3b')]};return db[_0xb3f2('0x2a')]['count'](_0x5ea1bc)['then'](function(_0x3b09cb){_0x33f937[_0xb3f2('0x1e')]=_0x3b09cb;if(_0x397aae[_0xb3f2('0x31')][_0xb3f2('0x40')]){_0x52d8fc[_0xb3f2('0x41')]=[{'all':!![]}];}return db['VoiceRecording'][_0xb3f2('0x42')](_0x52d8fc);})[_0xb3f2('0x25')](function(_0xb27535){_0x33f937[_0xb3f2('0x43')]=_0xb27535;return _0x33f937;})[_0xb3f2('0x25')](respondWithFilteredResult(_0x21764a,_0x52d8fc))[_0xb3f2('0x44')](handleError(_0x21764a,null));};exports[_0xb3f2('0x45')]=function(_0x315a87,_0x3dc14e){var _0x1bb47c={'raw':![],'where':{'id':_0x315a87[_0xb3f2('0x46')]['id']}},_0x44947f={};_0x44947f[_0xb3f2('0x2e')]=_[_0xb3f2('0x30')](db['VoiceRecording'][_0xb3f2('0x2b')]);_0x44947f[_0xb3f2('0x31')]=_['keys'](_0x315a87['query']);_0x44947f['filters']=_[_0xb3f2('0x33')](_0x44947f[_0xb3f2('0x2e')],_0x44947f['query']);_0x1bb47c[_0xb3f2('0x35')]=_[_0xb3f2('0x33')](_0x44947f[_0xb3f2('0x2e')],qs['fields'](_0x315a87['query']['fields']));_0x1bb47c[_0xb3f2('0x35')]=_0x1bb47c[_0xb3f2('0x35')][_0xb3f2('0x36')]?_0x1bb47c['attributes']:_0x44947f['model'];if(_0x315a87['query'][_0xb3f2('0x40')]){_0x1bb47c[_0xb3f2('0x41')]=[{'all':!![]}];}_0x1bb47c=_[_0xb3f2('0x3e')]({},_0x1bb47c,_0x315a87[_0xb3f2('0x3f')]);return db[_0xb3f2('0x2a')][_0xb3f2('0x47')](_0x1bb47c)[_0xb3f2('0x25')](handleEntityNotFound(_0x3dc14e,null))[_0xb3f2('0x25')](respondWithResult(_0x3dc14e,null))[_0xb3f2('0x44')](handleError(_0x3dc14e,null));};exports['create']=function(_0x50c002,_0x576a93){return db[_0xb3f2('0x2a')][_0xb3f2('0x48')](_0x50c002['body'],{})[_0xb3f2('0x25')](respondWithResult(_0x576a93,0xc9))[_0xb3f2('0x44')](handleError(_0x576a93,null));};exports[_0xb3f2('0x23')]=function(_0x3f3b8d,_0x77a449){if(_0x3f3b8d[_0xb3f2('0x49')]['id']){delete _0x3f3b8d[_0xb3f2('0x49')]['id'];}return db['VoiceRecording'][_0xb3f2('0x47')]({'where':{'id':_0x3f3b8d[_0xb3f2('0x46')]['id']}})[_0xb3f2('0x25')](handleEntityNotFound(_0x77a449,null))['then'](saveUpdates(_0x3f3b8d['body'],null))[_0xb3f2('0x25')](respondWithResult(_0x77a449,null))[_0xb3f2('0x44')](handleError(_0x77a449,null));};exports[_0xb3f2('0x4a')]=function(_0x585813,_0x1ec206){return db[_0xb3f2('0x2a')]['describe']()['then'](respondWithResult(_0x1ec206,null))['catch'](handleError(_0x1ec206,null));};exports[_0xb3f2('0x4b')]=function(_0x2fbfb7,_0x1448d5,_0x58305c){var _0x322c44=require(_0xb3f2('0x4c'));var _0x1f5811=![];var _0x345d01={};if(_0x2fbfb7['query'][_0xb3f2('0x2c')]&&_0x2fbfb7[_0xb3f2('0x31')]['type']===_0xb3f2('0x4d')){_0x345d01['uniqueid']=_0x2fbfb7[_0xb3f2('0x46')]['id'];}else{_0x345d01['id']=_0x2fbfb7[_0xb3f2('0x46')]['id'];}return db[_0xb3f2('0x2a')][_0xb3f2('0x47')]({'where':_0x345d01,'attributes':['id',_0xb3f2('0x4e')],'raw':!![]})[_0xb3f2('0x25')](handleEntityNotFound(_0x1448d5,null))[_0xb3f2('0x25')](function(_0x1e8077){if(_0x1e8077){var _0x4a638=_0x1e8077[_0xb3f2('0x4e')];var _0x641119=util[_0xb3f2('0x2f')](_0xb3f2('0x4f'),_0x4a638);if(fs[_0xb3f2('0x50')](_0x641119)){_0x1f5811=!![];return _0x322c44['decryptFile'](_0x641119,_0x4a638,config[_0xb3f2('0x51')][_0xb3f2('0x52')])[_0xb3f2('0x25')](function(){return _0x1e8077;});}return _0x1e8077;}})[_0xb3f2('0x25')](function(_0x2cfca8){if(_0x2cfca8){var _0xa230e2=_0x2cfca8['value'];if(!fs[_0xb3f2('0x50')](_0xa230e2)){throw new db[(_0xb3f2('0x53'))][(_0xb3f2('0x54'))](_0xb3f2('0x55'));}if(_0x2cfca8[_0xb3f2('0x56')]){return _0x1448d5['download'](_0xa230e2,_0x2cfca8[_0xb3f2('0x56')]+path[_0xb3f2('0x57')](_0xa230e2),function(){if(_0x1f5811){fs[_0xb3f2('0x58')](_0xa230e2);}});}else{return _0x1448d5['download'](_0xa230e2,function(_0x15e122){if(_0x1f5811){fs[_0xb3f2('0x58')](_0xa230e2);}});}}})[_0xb3f2('0x44')](function(_0xc88f84){if(_0xc88f84[_0xb3f2('0x59')]===_0xb3f2('0x55')){_0x1448d5[_0xb3f2('0x1a')](0x194)[_0xb3f2('0x28')]('Not\x20found');}else{return handleError(_0x1448d5,null);}});};exports[_0xb3f2('0x5a')]=function(_0x4d7c96,_0x1850fb,_0x16b0ca){var _0x475fc1=require(_0xb3f2('0x4c'));var _0x310ce9=![];var _0x4bb137={'$and':[db[_0xb3f2('0x5b')][_0xb3f2('0x3b')](db['sequelize']['fn']('MD5',db['sequelize'][_0xb3f2('0x5c')](_0xb3f2('0x4d'))),_0x4d7c96[_0xb3f2('0x31')][_0xb3f2('0x5d')])]};if(_0x4d7c96[_0xb3f2('0x31')]['type']&&_0x4d7c96['query'][_0xb3f2('0x2c')]===_0xb3f2('0x4d')){_0x4bb137[_0xb3f2('0x5e')][_0xb3f2('0x5f')]({'uniqueid':_0x4d7c96[_0xb3f2('0x46')]['id']});}else{_0x4bb137['$and'][_0xb3f2('0x5f')]({'id':_0x4d7c96[_0xb3f2('0x46')]['id']});}return db['VoiceRecording']['find']({'where':_0x4bb137,'attributes':['id',_0xb3f2('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x1850fb,null))['then'](function(_0x2b74e8){if(_0x2b74e8){var _0x180434=util[_0xb3f2('0x2f')](_0xb3f2('0x4f'),_0x2b74e8['value']);if(fs[_0xb3f2('0x50')](_0x180434)){_0x310ce9=!![];return _0x475fc1[_0xb3f2('0x60')](_0x180434,_0x2b74e8[_0xb3f2('0x4e')],config[_0xb3f2('0x51')]['recording'])[_0xb3f2('0x25')](function(){return _0x2b74e8;});}return _0x2b74e8;}})['then'](function(_0x8c1a1c){if(_0x8c1a1c){if(!fs[_0xb3f2('0x50')](_0x8c1a1c[_0xb3f2('0x4e')])){throw new db['Sequelize'][(_0xb3f2('0x54'))](_0xb3f2('0x55'));}if(_0x8c1a1c[_0xb3f2('0x56')]){return _0x1850fb['download'](_0x8c1a1c[_0xb3f2('0x4e')],_0x8c1a1c['filename']+path['extname'](_0x8c1a1c[_0xb3f2('0x4e')]),function(){if(_0x310ce9){fs[_0xb3f2('0x58')](_0x8c1a1c[_0xb3f2('0x4e')]);}});}else{return _0x1850fb[_0xb3f2('0x4b')](_0x8c1a1c['value'],function(_0x2b0a09){if(_0x310ce9){fs[_0xb3f2('0x58')](_0x8c1a1c[_0xb3f2('0x4e')]);}});}}})['catch'](handleError(_0x1850fb,null));};exports['destroy']=function(_0x393753,_0x236f99){return db['VoiceRecording'][_0xb3f2('0x47')]({'where':{'id':_0x393753[_0xb3f2('0x46')]['id']}})['then'](function(_0x2040d1){if(_[_0xb3f2('0x61')](_0x2040d1)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2040d1;})[_0xb3f2('0x25')](function(_0x2ba466){var _0x17d73d=_0x2ba466['value'];logger[_0xb3f2('0x62')](_0xb3f2('0x63'),_0x17d73d);if(!_[_0xb3f2('0x61')](_0x2ba466[_0xb3f2('0x4e')])&&fs[_0xb3f2('0x50')](_0x17d73d)){logger[_0xb3f2('0x62')](_0xb3f2('0x64')+_0x17d73d+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x17d73d);}_0x17d73d=_0x17d73d+'.cypher';if(!_[_0xb3f2('0x61')](_0x2ba466[_0xb3f2('0x4e')])&&fs[_0xb3f2('0x50')](_0x17d73d)){logger[_0xb3f2('0x62')](_0xb3f2('0x64')+_0x17d73d+_0xb3f2('0x65'));fs['unlinkSync'](_0x17d73d);}return _0x2ba466;})[_0xb3f2('0x25')](function(_0x2f57ac){if(!_0x2f57ac)throw new InternalError();return _0x2f57ac['destroy']();})['then'](function(){_0x236f99['status'](0xcc)[_0xb3f2('0x1b')]();})[_0xb3f2('0x44')](handleError(_0x236f99,null));};function getBucketslist(_0xc5272e,_0x4f671d,_0x5e44fd){return new Promise(function(_0x984ecf,_0x49169c){var _0x127604=new AWS['S3']({'accessKeyId':_0x4f671d,'secretAccessKey':_0xc5272e,'region':_0x5e44fd});_0x127604[_0xb3f2('0x66')]({},function(_0x131fb7,_0x549da4){if(_0x131fb7){return _0x49169c(_0x131fb7);}else{return _0x984ecf(_0x549da4);}});});}function createBucket(_0x5a6cd2,_0x3e7277,_0x29e2c9,_0x385641){return new Promise(function(_0x11cfcb,_0x11a84c){var _0x4c3f90=new AWS['S3']({'accessKeyId':_0x3e7277,'secretAccessKey':_0x5a6cd2,'region':_0x29e2c9});_0x4c3f90[_0xb3f2('0x67')]({'Bucket':_0x385641},function(_0x4d6b13,_0x1c71a9){if(_0x4d6b13){return _0x11a84c(_0x4d6b13);}else{return _0x11cfcb(_0x1c71a9);}});});}function uploadFile(_0x23d55d,_0x335189,_0x41144d,_0x11d7ca,_0x12d6a4,_0x38d632){return new Promise(function(_0x5bb77c,_0x58955f){var _0xf8d27=new AWS['S3']({'accessKeyId':_0x335189,'secretAccessKey':_0x23d55d,'region':_0x41144d});_0xf8d27['upload']({'Bucket':_0x11d7ca,'Key':_0x12d6a4,'Body':_0x38d632},function(_0xdd4076,_0x136f3c){if(_0xdd4076){return _0x58955f(_0xdd4076);}else{return _0x5bb77c(_0x136f3c);}});});}function startTranscribe(_0x5460b8,_0xf90cc0,_0x26b881,_0x4d03b8,_0x3df6d2,_0x4fc049){return new Promise(function(_0xda1b6e,_0x164bf8){var _0x4b2b79=new AWS[(_0xb3f2('0x68'))]({'accessKeyId':_0xf90cc0,'secretAccessKey':_0x5460b8,'region':_0x26b881});_0x4b2b79[_0xb3f2('0x69')]({'TranscriptionJobName':_0x4d03b8,'LanguageCode':_0x3df6d2,'Media':{'MediaFileUri':_0x4fc049}},function(_0x1a773e,_0x32ef9b){if(_0x1a773e){return _0x164bf8(_0x1a773e);}else{return _0xda1b6e(_0x32ef9b);}});});}function transcribe(_0x48207f,_0x324a58,_0x3576f2,_0x2aef44,_0x52fdc4,_0x4e9f5d,_0x7130d7){return new Promise(function(_0x5531a5,_0x5bc076){var _0x1634b9={};logger[_0xb3f2('0x62')](util['format'](_0xb3f2('0x6a'),_0x48207f,_0x52fdc4));return uploadFile(_0x324a58,_0x3576f2,_0x2aef44,_0x52fdc4,path[_0xb3f2('0x6b')](_0x4e9f5d),fs[_0xb3f2('0x6c')](_0x4e9f5d))[_0xb3f2('0x25')](function(_0x55d806){logger[_0xb3f2('0x62')](util[_0xb3f2('0x2f')](_0xb3f2('0x6d'),_0x48207f,_0x52fdc4,_0x55d806[_0xb3f2('0x6e')]));_0x1634b9[_0xb3f2('0x6f')]=_0x55d806[_0xb3f2('0x70')];_0x1634b9[_0xb3f2('0x71')]=_0x55d806['Location'];logger['info'](util[_0xb3f2('0x2f')](_0xb3f2('0x72'),_0x48207f));return startTranscribe(_0x324a58,_0x3576f2,_0x2aef44,uuidv4(),_0x7130d7,_0x55d806[_0xb3f2('0x6e')]);})[_0xb3f2('0x25')](function(_0x452c2d){logger[_0xb3f2('0x62')](util[_0xb3f2('0x2f')](_0xb3f2('0x73'),_0x48207f,_0x452c2d['TranscriptionJob'][_0xb3f2('0x74')]));_0x1634b9[_0xb3f2('0x75')]=_0x452c2d['TranscriptionJob'][_0xb3f2('0x74')];_0x1634b9['transcribeStatus']=_0x452c2d['TranscriptionJob'][_0xb3f2('0x76')];return _0x5531a5(_0x1634b9);})[_0xb3f2('0x44')](function(_0x3a92e0){return _0x5bc076(_0x3a92e0);});});}exports['runTranscribe']=function(_0x407ff1,_0x2b45f8,_0x481e99){var _0x45099a;var _0x510e3e;var _0x2b13b5;var _0x1a4a6e=require(_0xb3f2('0x4c'));return db[_0xb3f2('0x2a')][_0xb3f2('0x77')]({'where':{'id':_0x407ff1['params']['id']}})[_0xb3f2('0x25')](function(_0x400dc7){if(_0x400dc7){var _0xb24a08=util[_0xb3f2('0x2f')](_0xb3f2('0x4f'),_0x400dc7[_0xb3f2('0x4e')]);if(fs[_0xb3f2('0x50')](_0xb24a08)){cypher=!![];return _0x1a4a6e[_0xb3f2('0x60')](_0xb24a08,_0x400dc7['value'],config[_0xb3f2('0x51')][_0xb3f2('0x52')])[_0xb3f2('0x25')](function(){return _0x400dc7;});}return _0x400dc7;}})['then'](function(_0x193e82){if(!_0x193e82){throw new db['Sequelize'][(_0xb3f2('0x54'))](_0xb3f2('0x78'));}_0x510e3e=_0x193e82;return db[_0xb3f2('0x79')][_0xb3f2('0x77')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x2b45f8,null))[_0xb3f2('0x25')](function(_0x16f377){if(_0x16f377){_0x45099a=_0x16f377;if(!_0x45099a[_0xb3f2('0x7a')]||!_0x45099a[_0xb3f2('0x7b')]||!_0x45099a['transcribeRegion']||!_0x45099a[_0xb3f2('0x7c')]||!_0x45099a['bucket']){throw new db[(_0xb3f2('0x53'))][(_0xb3f2('0x54'))](_0xb3f2('0x7d'));}if(_0x407ff1[_0xb3f2('0x49')][_0xb3f2('0x7e')]&&(!_0x45099a['sentiment']||!_0x45099a[_0xb3f2('0x7f')]||!_0x45099a[_0xb3f2('0x80')]||!_0x45099a[_0xb3f2('0x7c')]||!_0x45099a[_0xb3f2('0x6f')])){throw new db[(_0xb3f2('0x53'))][(_0xb3f2('0x54'))](_0xb3f2('0x81'));}return db[_0xb3f2('0x82')][_0xb3f2('0x77')]({'where':{'id':_0x45099a[_0xb3f2('0x7b')]}});}})[_0xb3f2('0x25')](function(_0x151c4d){if(!_0x151c4d){throw new db['Sequelize'][(_0xb3f2('0x54'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x151c4d[_0xb3f2('0x83')]||!_0x151c4d[_0xb3f2('0x84')]){throw new db[(_0xb3f2('0x53'))][(_0xb3f2('0x54'))](_0xb3f2('0x85'));}_0x2b13b5=_0x151c4d;return getBucketslist(_0x2b13b5['data1'],_0x2b13b5[_0xb3f2('0x84')],_0x45099a[_0xb3f2('0x86')]);})[_0xb3f2('0x25')](function(_0x3c6580){if(_0x3c6580&&_0x3c6580[_0xb3f2('0x87')]){var _0xc290f9=_['find'](_0x3c6580['Buckets'],function(_0x4f48c9){return _0x4f48c9['Name']===_0x45099a[_0xb3f2('0x6f')];});if(!_0xc290f9){logger[_0xb3f2('0x62')](util[_0xb3f2('0x2f')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x407ff1[_0xb3f2('0x46')]['id'],_0x45099a[_0xb3f2('0x6f')]));return createBucket(_0x2b13b5[_0xb3f2('0x83')],_0x2b13b5[_0xb3f2('0x84')],_0x45099a[_0xb3f2('0x86')],_0x45099a[_0xb3f2('0x6f')]);}logger['info'](util['format'](_0xb3f2('0x88'),_0x407ff1[_0xb3f2('0x46')]['id'],_0x45099a[_0xb3f2('0x6f')]));return;}})[_0xb3f2('0x25')](function(_0x293524){if(_0x510e3e[_0xb3f2('0x89')]==='NEW'){return transcribe(_0x407ff1[_0xb3f2('0x46')]['id'],_0x2b13b5[_0xb3f2('0x83')],_0x2b13b5[_0xb3f2('0x84')],_0x45099a[_0xb3f2('0x86')],_0x45099a[_0xb3f2('0x6f')],_0x510e3e[_0xb3f2('0x4e')],_0x45099a[_0xb3f2('0x7c')]);}else{logger[_0xb3f2('0x62')](util['format'](_0xb3f2('0x8a'),_0x407ff1[_0xb3f2('0x46')]['id']));return{'transcribeStatus':_0xb3f2('0x8b')};}})[_0xb3f2('0x25')](function(_0x362137){if(_0x362137){_0x362137[_0xb3f2('0x8c')]=_0x407ff1['body'][_0xb3f2('0x7e')];return _0x510e3e['updateAttributes'](_0x362137);}})['then'](respondWithResult(_0x2b45f8,null))[_0xb3f2('0x44')](handleError(_0x2b45f8,null));};function writeFile(_0x4d12de,_0xe0d534){return new Promise(function(_0x46dc55,_0x4f4b05){fs['writeFile'](_0xe0d534,_0x4d12de,function(_0x470ae0,_0x35a746){if(_0x470ae0){return _0x4f4b05(_0x470ae0);}else{return _0x46dc55(_0x35a746);}});});}exports[_0xb3f2('0x8d')]=function(_0x20a2a1,_0x55accf,_0x3ce880){return db[_0xb3f2('0x2a')][_0xb3f2('0x77')]({'where':{'id':_0x20a2a1[_0xb3f2('0x46')]['id']}})[_0xb3f2('0x25')](handleEntityNotFound(_0x55accf))[_0xb3f2('0x25')](function(_0x13e058){if(_0x13e058&&_0x13e058[_0xb3f2('0x8e')]){var _0x102c97=_0x13e058[_0xb3f2('0x8e')];var _0x5dbffe=config[_0xb3f2('0x8f')]+_0xb3f2('0x90')+_0x13e058['id']+_0xb3f2('0x91');if(fs['existsSync'](_0x5dbffe)){return _0x5dbffe;}return writeFile(_0x102c97,_0x5dbffe)[_0xb3f2('0x25')](function(){return _0x5dbffe;});}else{throw new db[(_0xb3f2('0x53'))][(_0xb3f2('0x54'))](_0xb3f2('0x92'));}})[_0xb3f2('0x25')](function(_0x1c4c85){return _0x55accf[_0xb3f2('0x4b')](_0x1c4c85);})[_0xb3f2('0x44')](handleError(_0x55accf));}; \ No newline at end of file +var _0x71f8=['show','params','includeAll','include','create','body','find','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','Not\x20found','downloads','sequelize','MD5','token','push','Sequelize','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','.txt','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','error','stack','name','send','index','VoiceRecording','rawAttributes','type','key','model','differenceBy','map','format','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','findAll','rows','catch'];(function(_0x13c391,_0x147226){var _0x14d618=function(_0x375bb8){while(--_0x375bb8){_0x13c391['push'](_0x13c391['shift']());}};_0x14d618(++_0x147226);}(_0x71f8,0xe1));var _0x871f=function(_0xb97913,_0x43ecd2){_0xb97913=_0xb97913-0x0;var _0x2498a1=_0x71f8[_0xb97913];return _0x2498a1;};'use strict';var emlformat=require(_0x871f('0x0'));var rimraf=require(_0x871f('0x1'));var zipdir=require(_0x871f('0x2'));var jsonpatch=require(_0x871f('0x3'));var rp=require(_0x871f('0x4'));var moment=require(_0x871f('0x5'));var BPromise=require(_0x871f('0x6'));var Mustache=require(_0x871f('0x7'));var util=require(_0x871f('0x8'));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(_0x871f('0x9'));var _=require(_0x871f('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x871f('0xb'));var deskjs=require(_0x871f('0xc'));var toCsv=require(_0x871f('0xd'));var querystring=require(_0x871f('0xe'));var Papa=require(_0x871f('0xf'));var AWS=require(_0x871f('0x10'));var uuidv4=require(_0x871f('0x11'));var Redis=require(_0x871f('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x871f('0x13'));var hardwareService=require(_0x871f('0x14'));var logger=require('../../config/logger')(_0x871f('0x15'));var utils=require('../../config/utils');var config=require(_0x871f('0x16'));var licenseUtil=require(_0x871f('0x17'));var db=require(_0x871f('0x18'))['db'];function respondWithStatusCode(_0x347cc1,_0x41a07b){_0x41a07b=_0x41a07b||0xcc;return function(_0x293dc5){if(_0x293dc5){return _0x347cc1[_0x871f('0x19')](_0x41a07b);}return _0x347cc1['status'](_0x41a07b)[_0x871f('0x1a')]();};}function respondWithResult(_0x51f653,_0x557fd6){_0x557fd6=_0x557fd6||0xc8;return function(_0xa603f2){if(_0xa603f2){return _0x51f653[_0x871f('0x1b')](_0x557fd6)[_0x871f('0x1c')](_0xa603f2);}};}function respondWithFilteredResult(_0x8629be,_0x2dfe61){return function(_0x57940f){if(_0x57940f){var _0x3a57e5=typeof _0x2dfe61[_0x871f('0x1d')]===_0x871f('0x1e')&&typeof _0x2dfe61[_0x871f('0x1f')]===_0x871f('0x1e');var _0x181f87=_0x57940f[_0x871f('0x20')];var _0x1cfc97=_0x3a57e5?0x0:_0x2dfe61['offset'];var _0x4c9493=_0x3a57e5?_0x57940f[_0x871f('0x20')]:_0x2dfe61[_0x871f('0x1d')]+_0x2dfe61[_0x871f('0x1f')];var _0x151dc8;if(_0x4c9493>=_0x181f87){_0x4c9493=_0x181f87;_0x151dc8=0xc8;}else{_0x151dc8=0xce;}_0x8629be[_0x871f('0x1b')](_0x151dc8);return _0x8629be[_0x871f('0x21')]('Content-Range',_0x1cfc97+'-'+_0x4c9493+'/'+_0x181f87)[_0x871f('0x1c')](_0x57940f);}return null;};}function patchUpdates(_0x4903a2){return function(_0x42c6f3){try{jsonpatch['apply'](_0x42c6f3,_0x4903a2,!![]);}catch(_0x4349b8){return BPromise[_0x871f('0x22')](_0x4349b8);}return _0x42c6f3[_0x871f('0x23')]();};}function saveUpdates(_0x398842,_0x32c1d0){return function(_0x366331){if(_0x366331){return _0x366331[_0x871f('0x24')](_0x398842)[_0x871f('0x25')](function(_0x36a65f){return _0x36a65f;});}return null;};}function removeEntity(_0x5c4f10,_0x11a3b7){return function(_0x1ffdf7){if(_0x1ffdf7){return _0x1ffdf7[_0x871f('0x26')]()[_0x871f('0x25')](function(){_0x5c4f10[_0x871f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c7d65,_0x461993){return function(_0x1c2826){if(!_0x1c2826){_0x4c7d65[_0x871f('0x19')](0x194);}return _0x1c2826;};}function handleError(_0x35311c,_0x495e97){_0x495e97=_0x495e97||0x1f4;return function(_0x1aa81e){logger[_0x871f('0x27')](_0x1aa81e[_0x871f('0x28')]);if(_0x1aa81e[_0x871f('0x29')]){delete _0x1aa81e[_0x871f('0x29')];}_0x35311c[_0x871f('0x1b')](_0x495e97)[_0x871f('0x2a')](_0x1aa81e);};}exports[_0x871f('0x2b')]=function(_0x4f1065,_0x3041c1){var _0x23a6e2={},_0x15e8df={},_0xb14aa1={'count':0x0,'rows':[]};var _0x570409=_['map'](db[_0x871f('0x2c')][_0x871f('0x2d')],function(_0xc2e31b){return{'name':_0xc2e31b['fieldName'],'type':_0xc2e31b[_0x871f('0x2e')][_0x871f('0x2f')]};});_0x15e8df[_0x871f('0x30')]=_[_0x871f('0x31')](_[_0x871f('0x32')](_0x570409,_0x871f('0x29')),[_0x871f('0x33')]);_0x15e8df[_0x871f('0x34')]=_[_0x871f('0x35')](_0x4f1065[_0x871f('0x34')]);_0x15e8df['filters']=_[_0x871f('0x36')](_0x15e8df[_0x871f('0x30')],_0x15e8df[_0x871f('0x34')]);_0x23a6e2[_0x871f('0x37')]=_['intersection'](_0x15e8df[_0x871f('0x30')],qs[_0x871f('0x38')](_0x4f1065[_0x871f('0x34')][_0x871f('0x38')]));_0x23a6e2['attributes']=_0x23a6e2[_0x871f('0x37')][_0x871f('0x39')]?_0x23a6e2['attributes']:_0x15e8df[_0x871f('0x30')];if(!_0x4f1065[_0x871f('0x34')][_0x871f('0x3a')](_0x871f('0x3b'))){_0x23a6e2[_0x871f('0x1f')]=qs[_0x871f('0x1f')](_0x4f1065['query']['limit']);_0x23a6e2[_0x871f('0x1d')]=qs['offset'](_0x4f1065[_0x871f('0x34')][_0x871f('0x1d')]);}_0x23a6e2['order']=qs[_0x871f('0x3c')](_0x4f1065[_0x871f('0x34')]['sort']);_0x23a6e2[_0x871f('0x3d')]=qs[_0x871f('0x3e')](_[_0x871f('0x3f')](_0x4f1065[_0x871f('0x34')],_0x15e8df[_0x871f('0x3e')]),_0x570409);if(_0x4f1065[_0x871f('0x34')][_0x871f('0x40')]){_0x23a6e2[_0x871f('0x3d')]=_[_0x871f('0x41')](_0x23a6e2[_0x871f('0x3d')],{'$or':_[_0x871f('0x32')](_0x570409,function(_0x514ae5){if(_0x514ae5['type']!==_0x871f('0x42')){var _0x476df8={};_0x476df8[_0x514ae5[_0x871f('0x29')]]={'$like':'%'+_0x4f1065['query'][_0x871f('0x40')]+'%'};return _0x476df8;}})});}_0x23a6e2=_[_0x871f('0x41')]({},_0x23a6e2,_0x4f1065[_0x871f('0x43')]);var _0x567a2f={'where':_0x23a6e2[_0x871f('0x3d')]};return db[_0x871f('0x2c')][_0x871f('0x20')](_0x567a2f)[_0x871f('0x25')](function(_0x5f44d1){_0xb14aa1[_0x871f('0x20')]=_0x5f44d1;if(_0x4f1065[_0x871f('0x34')]['includeAll']){_0x23a6e2['include']=[{'all':!![]}];}return db[_0x871f('0x2c')][_0x871f('0x44')](_0x23a6e2);})['then'](function(_0x57e37f){_0xb14aa1[_0x871f('0x45')]=_0x57e37f;return _0xb14aa1;})['then'](respondWithFilteredResult(_0x3041c1,_0x23a6e2))[_0x871f('0x46')](handleError(_0x3041c1,null));};exports[_0x871f('0x47')]=function(_0x426fff,_0x4d913d){var _0xe93509={'raw':![],'where':{'id':_0x426fff[_0x871f('0x48')]['id']}},_0x193aec={};_0x193aec[_0x871f('0x30')]=_[_0x871f('0x35')](db[_0x871f('0x2c')][_0x871f('0x2d')]);_0x193aec[_0x871f('0x34')]=_[_0x871f('0x35')](_0x426fff[_0x871f('0x34')]);_0x193aec[_0x871f('0x3e')]=_['intersection'](_0x193aec[_0x871f('0x30')],_0x193aec[_0x871f('0x34')]);_0xe93509[_0x871f('0x37')]=_['intersection'](_0x193aec[_0x871f('0x30')],qs[_0x871f('0x38')](_0x426fff[_0x871f('0x34')]['fields']));_0xe93509[_0x871f('0x37')]=_0xe93509[_0x871f('0x37')][_0x871f('0x39')]?_0xe93509[_0x871f('0x37')]:_0x193aec[_0x871f('0x30')];if(_0x426fff['query'][_0x871f('0x49')]){_0xe93509[_0x871f('0x4a')]=[{'all':!![]}];}_0xe93509=_[_0x871f('0x41')]({},_0xe93509,_0x426fff[_0x871f('0x43')]);return db[_0x871f('0x2c')]['find'](_0xe93509)[_0x871f('0x25')](handleEntityNotFound(_0x4d913d,null))[_0x871f('0x25')](respondWithResult(_0x4d913d,null))[_0x871f('0x46')](handleError(_0x4d913d,null));};exports[_0x871f('0x4b')]=function(_0x12a613,_0x5aa5a9){return db[_0x871f('0x2c')][_0x871f('0x4b')](_0x12a613[_0x871f('0x4c')],{})[_0x871f('0x25')](respondWithResult(_0x5aa5a9,0xc9))['catch'](handleError(_0x5aa5a9,null));};exports['update']=function(_0x458451,_0x3b26fb){if(_0x458451['body']['id']){delete _0x458451[_0x871f('0x4c')]['id'];}return db['VoiceRecording'][_0x871f('0x4d')]({'where':{'id':_0x458451[_0x871f('0x48')]['id']}})[_0x871f('0x25')](handleEntityNotFound(_0x3b26fb,null))['then'](saveUpdates(_0x458451[_0x871f('0x4c')],null))['then'](respondWithResult(_0x3b26fb,null))[_0x871f('0x46')](handleError(_0x3b26fb,null));};exports[_0x871f('0x4e')]=function(_0x827fa,_0xaf1eac){return db[_0x871f('0x2c')][_0x871f('0x4e')]()[_0x871f('0x25')](respondWithResult(_0xaf1eac,null))[_0x871f('0x46')](handleError(_0xaf1eac,null));};exports[_0x871f('0x4f')]=function(_0x4a67c9,_0x3e0689,_0x4bffd5){var _0x37dee1=require(_0x871f('0x50'));var _0x3f76ad=![];var _0x44a40a={};if(_0x4a67c9[_0x871f('0x34')][_0x871f('0x2e')]&&_0x4a67c9[_0x871f('0x34')][_0x871f('0x2e')]===_0x871f('0x51')){_0x44a40a['uniqueid']=_0x4a67c9[_0x871f('0x48')]['id'];}else{_0x44a40a['id']=_0x4a67c9[_0x871f('0x48')]['id'];}return db[_0x871f('0x2c')][_0x871f('0x4d')]({'where':_0x44a40a,'attributes':['id',_0x871f('0x52')],'raw':!![]})[_0x871f('0x25')](handleEntityNotFound(_0x3e0689,null))['then'](function(_0x36ce17){if(_0x36ce17){var _0x5672fc=_0x36ce17[_0x871f('0x52')];var _0x25d069=util[_0x871f('0x33')](_0x871f('0x53'),_0x5672fc);if(fs[_0x871f('0x54')](_0x25d069)){_0x3f76ad=!![];return _0x37dee1[_0x871f('0x55')](_0x25d069,_0x5672fc,config[_0x871f('0x56')][_0x871f('0x57')])[_0x871f('0x25')](function(){return _0x36ce17;});}return _0x36ce17;}})['then'](function(_0x1aa051){if(_0x1aa051){var _0x316fec=_0x1aa051[_0x871f('0x52')];if(!fs[_0x871f('0x54')](_0x316fec)){throw new db['Sequelize'][(_0x871f('0x58'))](_0x871f('0x59'));}if(_0x1aa051['filename']){return _0x3e0689[_0x871f('0x4f')](_0x316fec,_0x1aa051[_0x871f('0x5a')]+path[_0x871f('0x5b')](_0x316fec),function(){if(_0x3f76ad){fs['unlink'](_0x316fec);}});}else{return _0x3e0689[_0x871f('0x4f')](_0x316fec,function(_0x8eeb4d){if(_0x3f76ad){fs[_0x871f('0x5c')](_0x316fec);}});}}})[_0x871f('0x46')](function(_0x5e8fce){if(_0x5e8fce['message']==='VoiceRecording\x20not\x20found'){_0x3e0689[_0x871f('0x1b')](0x194)[_0x871f('0x2a')](_0x871f('0x5d'));}else{return handleError(_0x3e0689,null);}});};exports[_0x871f('0x5e')]=function(_0x21f716,_0x4b9195,_0x2c179c){var _0x54bccb=require(_0x871f('0x50'));var _0x5335a8=![];var _0x14fecb={'$and':[db[_0x871f('0x5f')]['where'](db[_0x871f('0x5f')]['fn'](_0x871f('0x60'),db['sequelize']['col'](_0x871f('0x51'))),_0x21f716[_0x871f('0x34')][_0x871f('0x61')])]};if(_0x21f716['query'][_0x871f('0x2e')]&&_0x21f716[_0x871f('0x34')][_0x871f('0x2e')]===_0x871f('0x51')){_0x14fecb['$and'][_0x871f('0x62')]({'uniqueid':_0x21f716[_0x871f('0x48')]['id']});}else{_0x14fecb['$and']['push']({'id':_0x21f716['params']['id']});}return db[_0x871f('0x2c')]['find']({'where':_0x14fecb,'attributes':['id',_0x871f('0x52')],'raw':!![]})[_0x871f('0x25')](handleEntityNotFound(_0x4b9195,null))[_0x871f('0x25')](function(_0x1c97b3){if(_0x1c97b3){var _0x10532d=util[_0x871f('0x33')](_0x871f('0x53'),_0x1c97b3[_0x871f('0x52')]);if(fs[_0x871f('0x54')](_0x10532d)){_0x5335a8=!![];return _0x54bccb[_0x871f('0x55')](_0x10532d,_0x1c97b3[_0x871f('0x52')],config['secrets'][_0x871f('0x57')])[_0x871f('0x25')](function(){return _0x1c97b3;});}return _0x1c97b3;}})[_0x871f('0x25')](function(_0x457007){if(_0x457007){if(!fs[_0x871f('0x54')](_0x457007['value'])){throw new db[(_0x871f('0x63'))]['ValidationError'](_0x871f('0x59'));}if(_0x457007['filename']){return _0x4b9195['download'](_0x457007['value'],_0x457007[_0x871f('0x5a')]+path[_0x871f('0x5b')](_0x457007['value']),function(){if(_0x5335a8){fs['unlink'](_0x457007[_0x871f('0x52')]);}});}else{return _0x4b9195[_0x871f('0x4f')](_0x457007[_0x871f('0x52')],function(_0x1c346a){if(_0x5335a8){fs[_0x871f('0x5c')](_0x457007[_0x871f('0x52')]);}});}}})[_0x871f('0x46')](handleError(_0x4b9195,null));};exports[_0x871f('0x26')]=function(_0x3fdc18,_0x13fa26){return db[_0x871f('0x2c')][_0x871f('0x4d')]({'where':{'id':_0x3fdc18[_0x871f('0x48')]['id']}})['then'](function(_0x351686){if(_[_0x871f('0x64')](_0x351686)){throw new ReferenceError(_0x871f('0x65'));}return _0x351686;})['then'](function(_0x1dee24){var _0x1e7982=_0x1dee24['value'];logger[_0x871f('0x66')](_0x871f('0x67'),_0x1e7982);if(!_[_0x871f('0x64')](_0x1dee24[_0x871f('0x52')])&&fs[_0x871f('0x54')](_0x1e7982)){logger[_0x871f('0x66')](_0x871f('0x68')+_0x1e7982+_0x871f('0x69'));fs[_0x871f('0x6a')](_0x1e7982);}_0x1e7982=_0x1e7982+'.cypher';if(!_[_0x871f('0x64')](_0x1dee24[_0x871f('0x52')])&&fs['existsSync'](_0x1e7982)){logger[_0x871f('0x66')]('File:\x20\x22'+_0x1e7982+_0x871f('0x69'));fs[_0x871f('0x6a')](_0x1e7982);}return _0x1dee24;})[_0x871f('0x25')](function(_0x4e6364){if(!_0x4e6364)throw new InternalError();return _0x4e6364[_0x871f('0x26')]();})['then'](function(){_0x13fa26[_0x871f('0x1b')](0xcc)[_0x871f('0x1a')]();})[_0x871f('0x46')](handleError(_0x13fa26,null));};function getBucketslist(_0x545c14,_0x333d0e,_0x54b2ae){return new Promise(function(_0x4a2136,_0x340c7f){var _0x3b76f5=new AWS['S3']({'accessKeyId':_0x333d0e,'secretAccessKey':_0x545c14,'region':_0x54b2ae});_0x3b76f5['listBuckets']({},function(_0x8eaea7,_0x34fb58){if(_0x8eaea7){return _0x340c7f(_0x8eaea7);}else{return _0x4a2136(_0x34fb58);}});});}function createBucket(_0x15f093,_0x276b74,_0x1d2f85,_0x195616){return new Promise(function(_0x47c7fd,_0x2788eb){var _0x1b2612=new AWS['S3']({'accessKeyId':_0x276b74,'secretAccessKey':_0x15f093,'region':_0x1d2f85});_0x1b2612[_0x871f('0x6b')]({'Bucket':_0x195616},function(_0x20a372,_0x5840d){if(_0x20a372){return _0x2788eb(_0x20a372);}else{return _0x47c7fd(_0x5840d);}});});}function uploadFile(_0x3fd4f4,_0x5a9cb4,_0x432711,_0x11431b,_0xc65d24,_0x54992b){return new Promise(function(_0x5e209c,_0x5c13c4){var _0xe47f86=new AWS['S3']({'accessKeyId':_0x5a9cb4,'secretAccessKey':_0x3fd4f4,'region':_0x432711});_0xe47f86[_0x871f('0x6c')]({'Bucket':_0x11431b,'Key':_0xc65d24,'Body':_0x54992b},function(_0x3b21fd,_0x158053){if(_0x3b21fd){return _0x5c13c4(_0x3b21fd);}else{return _0x5e209c(_0x158053);}});});}function startTranscribe(_0x16235b,_0x525fee,_0x23fb7d,_0x3ebcac,_0x84301,_0x2382fd){return new Promise(function(_0x359ce3,_0xcb1043){var _0x3f6906=new AWS[(_0x871f('0x6d'))]({'accessKeyId':_0x525fee,'secretAccessKey':_0x16235b,'region':_0x23fb7d});_0x3f6906[_0x871f('0x6e')]({'TranscriptionJobName':_0x3ebcac,'LanguageCode':_0x84301,'Media':{'MediaFileUri':_0x2382fd}},function(_0x32aaa0,_0x1ed6d1){if(_0x32aaa0){return _0xcb1043(_0x32aaa0);}else{return _0x359ce3(_0x1ed6d1);}});});}function transcribe(_0x521656,_0xaa9148,_0x309b85,_0x4521dc,_0x217f03,_0x26df88,_0x421027){return new Promise(function(_0x3c8150,_0x26b982){var _0x52034f={};logger[_0x871f('0x66')](util['format'](_0x871f('0x6f'),_0x521656,_0x217f03));return uploadFile(_0xaa9148,_0x309b85,_0x4521dc,_0x217f03,path['basename'](_0x26df88),fs['readFileSync'](_0x26df88))[_0x871f('0x25')](function(_0x1fdecb){logger[_0x871f('0x66')](util['format'](_0x871f('0x70'),_0x521656,_0x217f03,_0x1fdecb['Location']));_0x52034f[_0x871f('0x71')]=_0x1fdecb[_0x871f('0x72')];_0x52034f[_0x871f('0x73')]=_0x1fdecb[_0x871f('0x74')];logger[_0x871f('0x66')](util[_0x871f('0x33')](_0x871f('0x75'),_0x521656));return startTranscribe(_0xaa9148,_0x309b85,_0x4521dc,uuidv4(),_0x421027,_0x1fdecb['Location']);})[_0x871f('0x25')](function(_0x5c33ad){logger[_0x871f('0x66')](util[_0x871f('0x33')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x521656,_0x5c33ad['TranscriptionJob']['TranscriptionJobName']));_0x52034f['transcribeName']=_0x5c33ad[_0x871f('0x76')][_0x871f('0x77')];_0x52034f[_0x871f('0x78')]=_0x5c33ad[_0x871f('0x76')][_0x871f('0x79')];return _0x3c8150(_0x52034f);})[_0x871f('0x46')](function(_0x4dbcc3){return _0x26b982(_0x4dbcc3);});});}exports[_0x871f('0x7a')]=function(_0xb43b2a,_0x63b090,_0x122f04){var _0x1c69f3;var _0x45336c;var _0x4a552c;var _0x74c620=require(_0x871f('0x50'));return db[_0x871f('0x2c')][_0x871f('0x7b')]({'where':{'id':_0xb43b2a[_0x871f('0x48')]['id']}})[_0x871f('0x25')](function(_0x1bc972){if(_0x1bc972){var _0xe12e0e=util[_0x871f('0x33')](_0x871f('0x53'),_0x1bc972[_0x871f('0x52')]);if(fs['existsSync'](_0xe12e0e)){cypher=!![];return _0x74c620[_0x871f('0x55')](_0xe12e0e,_0x1bc972[_0x871f('0x52')],config[_0x871f('0x56')]['recording'])[_0x871f('0x25')](function(){return _0x1bc972;});}return _0x1bc972;}})[_0x871f('0x25')](function(_0x1b13ff){if(!_0x1b13ff){throw new db['Sequelize'][(_0x871f('0x58'))]('Voice\x20Recording\x20not\x20found');}_0x45336c=_0x1b13ff;return db['Setting'][_0x871f('0x7b')]({'where':{'id':0x1}});})[_0x871f('0x25')](handleEntityNotFound(_0x63b090,null))[_0x871f('0x25')](function(_0x35436a){if(_0x35436a){_0x1c69f3=_0x35436a;if(!_0x1c69f3[_0x871f('0x7c')]||!_0x1c69f3[_0x871f('0x7d')]||!_0x1c69f3[_0x871f('0x7e')]||!_0x1c69f3[_0x871f('0x7f')]||!_0x1c69f3['bucket']){throw new db['Sequelize'][(_0x871f('0x58'))](_0x871f('0x80'));}if(_0xb43b2a['body'][_0x871f('0x81')]&&(!_0x1c69f3[_0x871f('0x82')]||!_0x1c69f3[_0x871f('0x83')]||!_0x1c69f3[_0x871f('0x84')]||!_0x1c69f3[_0x871f('0x7f')]||!_0x1c69f3[_0x871f('0x71')])){throw new db[(_0x871f('0x63'))][(_0x871f('0x58'))](_0x871f('0x85'));}return db[_0x871f('0x86')]['findOne']({'where':{'id':_0x1c69f3[_0x871f('0x7d')]}});}})['then'](function(_0x49fb7d){if(!_0x49fb7d){throw new db[(_0x871f('0x63'))]['ValidationError'](_0x871f('0x87'));}if(!_0x49fb7d[_0x871f('0x88')]||!_0x49fb7d[_0x871f('0x89')]){throw new db['Sequelize'][(_0x871f('0x58'))](_0x871f('0x8a'));}_0x4a552c=_0x49fb7d;return getBucketslist(_0x4a552c[_0x871f('0x88')],_0x4a552c[_0x871f('0x89')],_0x1c69f3[_0x871f('0x7e')]);})[_0x871f('0x25')](function(_0x56c208){if(_0x56c208&&_0x56c208[_0x871f('0x8b')]){var _0xdfb814=_[_0x871f('0x4d')](_0x56c208[_0x871f('0x8b')],function(_0xc45bde){return _0xc45bde[_0x871f('0x8c')]===_0x1c69f3['bucket'];});if(!_0xdfb814){logger[_0x871f('0x66')](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0xb43b2a[_0x871f('0x48')]['id'],_0x1c69f3['bucket']));return createBucket(_0x4a552c[_0x871f('0x88')],_0x4a552c[_0x871f('0x89')],_0x1c69f3[_0x871f('0x7e')],_0x1c69f3[_0x871f('0x71')]);}logger['info'](util[_0x871f('0x33')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0xb43b2a[_0x871f('0x48')]['id'],_0x1c69f3['bucket']));return;}})[_0x871f('0x25')](function(_0x3483be){if(_0x45336c['transcribeStatus']==='NEW'){return transcribe(_0xb43b2a['params']['id'],_0x4a552c[_0x871f('0x88')],_0x4a552c[_0x871f('0x89')],_0x1c69f3[_0x871f('0x7e')],_0x1c69f3[_0x871f('0x71')],_0x45336c[_0x871f('0x52')],_0x1c69f3[_0x871f('0x7f')]);}else{logger[_0x871f('0x66')](util[_0x871f('0x33')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0xb43b2a[_0x871f('0x48')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x871f('0x25')](function(_0x4dcf4d){if(_0x4dcf4d){_0x4dcf4d[_0x871f('0x8d')]=_0xb43b2a['body'][_0x871f('0x81')];return _0x45336c[_0x871f('0x8e')](_0x4dcf4d);}})[_0x871f('0x25')](respondWithResult(_0x63b090,null))['catch'](handleError(_0x63b090,null));};function writeFile(_0x4c075f,_0x1c3c58){return new Promise(function(_0x384305,_0x4bac32){fs[_0x871f('0x8f')](_0x1c3c58,_0x4c075f,function(_0x1d7b0a,_0x15ce24){if(_0x1d7b0a){return _0x4bac32(_0x1d7b0a);}else{return _0x384305(_0x15ce24);}});});}exports[_0x871f('0x90')]=function(_0x1ef7f9,_0x17d362,_0x5b6ca1){return db['VoiceRecording'][_0x871f('0x7b')]({'where':{'id':_0x1ef7f9[_0x871f('0x48')]['id']}})[_0x871f('0x25')](handleEntityNotFound(_0x17d362))[_0x871f('0x25')](function(_0x563077){if(_0x563077&&_0x563077['fileText']){var _0x3d8a94=_0x563077[_0x871f('0x91')];var _0x59227c=config[_0x871f('0x92')]+'/server/files/transcribes/transcribe_'+_0x563077['id']+_0x871f('0x93');if(fs['existsSync'](_0x59227c)){return _0x59227c;}return writeFile(_0x3d8a94,_0x59227c)[_0x871f('0x25')](function(){return _0x59227c;});}else{throw new db[(_0x871f('0x63'))][(_0x871f('0x58'))]('Transcript\x20not\x20available');}})[_0x871f('0x25')](function(_0x1273fb){return _0x17d362['download'](_0x1273fb);})['catch'](handleError(_0x17d362));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 729b5a8..e8656bc 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 _0x2557=['uniqueid','./voiceRecording.attributes','define','VoiceRecording','voice_recordings'];(function(_0x4f5d1a,_0x1696fa){var _0x3a2759=function(_0x4fd1fe){while(--_0x4fd1fe){_0x4f5d1a['push'](_0x4f5d1a['shift']());}};_0x3a2759(++_0x1696fa);}(_0x2557,0x11e));var _0x7255=function(_0x3992fc,_0x39e96d){_0x3992fc=_0x3992fc-0x0;var _0xa0c127=_0x2557[_0x3992fc];return _0xa0c127;};'use strict';var attributes=require(_0x7255('0x0'));module['exports']=function(_0x3bbb12,_0xa82fd8){return _0x3bbb12[_0x7255('0x1')](_0x7255('0x2'),attributes,{'tableName':_0x7255('0x3'),'paranoid':![],'indexes':[{'name':_0x7255('0x4'),'fields':['uniqueid']},{'name':'transcribeStatus','fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0e35=['define','VoiceRecording','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','exports'];(function(_0x524fcd,_0x530fcf){var _0x1f82bd=function(_0x45496f){while(--_0x45496f){_0x524fcd['push'](_0x524fcd['shift']());}};_0x1f82bd(++_0x530fcf);}(_0x0e35,0xc2));var _0x50e3=function(_0x5d02b8,_0x4ba47f){_0x5d02b8=_0x5d02b8-0x0;var _0x444ba1=_0x0e35[_0x5d02b8];return _0x444ba1;};'use strict';var attributes=require(_0x50e3('0x0'));module[_0x50e3('0x1')]=function(_0x792482,_0x35f5c7){return _0x792482[_0x50e3('0x2')](_0x50e3('0x3'),attributes,{'tableName':_0x50e3('0x4'),'paranoid':![],'indexes':[{'name':_0x50e3('0x5'),'fields':[_0x50e3('0x5')]},{'name':_0x50e3('0x6'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 2eb1b75..6329376 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 _0x5204=['attributes','limit','then','CreateVoiceRecording','../../components/encryptor','Setting','findOne','create','callRecordingEncryption','value','format','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','where'];(function(_0x2bfb8d,_0x21fceb){var _0x5d3a17=function(_0x3581c4){while(--_0x3581c4){_0x2bfb8d['push'](_0x2bfb8d['shift']());}};_0x5d3a17(++_0x21fceb);}(_0x5204,0xdf));var _0x4520=function(_0x21b706,_0x1022f4){_0x21b706=_0x21b706-0x0;var _0x13b94a=_0x5204[_0x21b706];return _0x13b94a;};'use strict';var _=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var moment=require('moment');var BPromise=require(_0x4520('0x2'));var rs=require(_0x4520('0x3'));var fs=require('fs');var Redis=require(_0x4520('0x4'));var db=require(_0x4520('0x5'))['db'];var utils=require(_0x4520('0x6'));var logger=require('../../config/logger')(_0x4520('0x7'));var config=require('../../config/environment');var jayson=require(_0x4520('0x8'));var client=jayson[_0x4520('0x9')][_0x4520('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe741c2,_0x396d29,_0x446dc9){return new BPromise(function(_0x27890f,_0x55b44f){return client[_0x4520('0xb')](_0xe741c2,_0x446dc9)['then'](function(_0x168e62){logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));logger[_0x4520('0xf')](_0x4520('0x10'),_0x396d29,_0x4520('0xe'),JSON[_0x4520('0x11')](_0x168e62));if(_0x168e62[_0x4520('0x12')]){if(_0x168e62[_0x4520('0x12')][_0x4520('0x13')]===0x1f4){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x55b44f(_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);}logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x27890f(_0x168e62['error'][_0x4520('0x14')]);}else{logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));_0x27890f(_0x168e62[_0x4520('0x15')]['message']);}})[_0x4520('0x16')](function(_0x33ac29){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x33ac29);_0x55b44f(_0x33ac29);});});}exports[_0x4520('0x17')]=function(_0x2e00f4){var _0x1dcf51=this;return new Promise(function(_0x4ba69f,_0x3791b6){return db[_0x4520('0x18')][_0x4520('0x19')](_0x2e00f4[_0x4520('0x1a')],{'raw':_0x2e00f4['options']?_0x2e00f4[_0x4520('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e00f4['options']?_0x2e00f4['options'][_0x4520('0x1c')]||null:null,'attributes':_0x2e00f4['options']?_0x2e00f4[_0x4520('0x1b')][_0x4520('0x1d')]||null:null,'limit':_0x2e00f4[_0x4520('0x1b')]?_0x2e00f4['options'][_0x4520('0x1e')]||null:null})[_0x4520('0x1f')](function(_0x3b2ede){logger['info'](_0x4520('0x17'),_0x2e00f4);logger[_0x4520('0xf')](_0x4520('0x17'),_0x2e00f4,JSON[_0x4520('0x11')](_0x3b2ede));_0x4ba69f(_0x3b2ede);})[_0x4520('0x16')](function(_0x552da1){logger[_0x4520('0x12')](_0x4520('0x17'),_0x552da1[_0x4520('0x14')],_0x2e00f4);_0x3791b6(_0x1dcf51[_0x4520('0x12')](0x1f4,_0x552da1['message']));});});};exports[_0x4520('0x20')]=function(_0x4602a4){var _0x92168b=this;return new Promise(function(_0x21e1f3,_0xad9f8){var _0x2c95ea=require(_0x4520('0x21'));var _0x195c58;return db[_0x4520('0x22')][_0x4520('0x23')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x4520('0x1f')](function(_0x5c1a0b){_0x195c58=_0x5c1a0b;return db[_0x4520('0x18')][_0x4520('0x24')](_0x4602a4[_0x4520('0x1a')]);})[_0x4520('0x1f')](function(_0x1da740){if(_0x195c58[_0x4520('0x25')]&&fs['existsSync'](_0x1da740[_0x4520('0x26')])){var _0x508c05=util[_0x4520('0x27')]('%s.cypher',_0x1da740[_0x4520('0x26')]);return _0x2c95ea['encryptFile'](_0x1da740[_0x4520('0x26')],_0x508c05,config['secrets']['recording'])[_0x4520('0x1f')](function(){fs[_0x4520('0x28')](_0x1da740[_0x4520('0x26')]);logger['info'](_0x4520('0x29'));return _0x1da740;});}return _0x1da740;})[_0x4520('0x1f')](function(_0x2acb4e){logger[_0x4520('0xc')]('CreateVoiceRecording',_0x4602a4);logger['debug'](_0x4520('0x20'),_0x4602a4,JSON[_0x4520('0x11')](_0x2acb4e));_0x21e1f3(_0x2acb4e);})['catch'](function(_0x779e94){logger[_0x4520('0x12')](_0x4520('0x20'),_0x779e94[_0x4520('0x14')],_0x4602a4);_0xad9f8(_0x92168b[_0x4520('0x12')](0x1f4,_0x779e94[_0x4520('0x14')]));});});}; \ No newline at end of file +var _0xfb11=['update','body','options','where','attributes','debug','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher','encryptFile','recording','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateVoiceRecording','VoiceRecording'];(function(_0x5805d7,_0x3d584a){var _0x170fe4=function(_0x3b9b73){while(--_0x3b9b73){_0x5805d7['push'](_0x5805d7['shift']());}};_0x170fe4(++_0x3d584a);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0xfb11[_0x2df507];return _0x1f7167;};'use strict';var _=require(_0x1fb1('0x0'));var util=require('util');var moment=require(_0x1fb1('0x1'));var BPromise=require(_0x1fb1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1fb1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1fb1('0x4'));var logger=require('../../config/logger')(_0x1fb1('0x5'));var config=require(_0x1fb1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1fb1('0x7')][_0x1fb1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c098d,_0x1859da,_0x2596c2){return new BPromise(function(_0x34e61a,_0x236b20){return client[_0x1fb1('0x9')](_0x4c098d,_0x2596c2)[_0x1fb1('0xa')](function(_0x438d15){logger[_0x1fb1('0xb')](_0x1fb1('0xc'),_0x1859da,_0x1fb1('0xd'));logger['debug'](_0x1fb1('0xe'),_0x1859da,'request\x20sent',JSON[_0x1fb1('0xf')](_0x438d15));if(_0x438d15['error']){if(_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x11')]===0x1f4){logger[_0x1fb1('0x10')](_0x1fb1('0xc'),_0x1859da,_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x12')]);return _0x236b20(_0x438d15['error'][_0x1fb1('0x12')]);}logger[_0x1fb1('0x10')](_0x1fb1('0xc'),_0x1859da,_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x12')]);return _0x34e61a(_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x12')]);}else{logger[_0x1fb1('0xb')](_0x1fb1('0xc'),_0x1859da,'request\x20sent');_0x34e61a(_0x438d15['result'][_0x1fb1('0x12')]);}})[_0x1fb1('0x13')](function(_0x3924ab){logger['error'](_0x1fb1('0xc'),_0x1859da,_0x3924ab);_0x236b20(_0x3924ab);});});}exports[_0x1fb1('0x14')]=function(_0x24d4df){var _0x34076b=this;return new Promise(function(_0x33c6b6,_0x27d71f){return db[_0x1fb1('0x15')][_0x1fb1('0x16')](_0x24d4df[_0x1fb1('0x17')],{'raw':_0x24d4df['options']?_0x24d4df[_0x1fb1('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24d4df['options']?_0x24d4df[_0x1fb1('0x18')][_0x1fb1('0x19')]||null:null,'attributes':_0x24d4df[_0x1fb1('0x18')]?_0x24d4df['options'][_0x1fb1('0x1a')]||null:null,'limit':_0x24d4df['options']?_0x24d4df['options']['limit']||null:null})[_0x1fb1('0xa')](function(_0x1f8e5a){logger[_0x1fb1('0xb')](_0x1fb1('0x14'),_0x24d4df);logger[_0x1fb1('0x1b')]('UpdateVoiceRecording',_0x24d4df,JSON[_0x1fb1('0xf')](_0x1f8e5a));_0x33c6b6(_0x1f8e5a);})[_0x1fb1('0x13')](function(_0x1dc03f){logger[_0x1fb1('0x10')](_0x1fb1('0x14'),_0x1dc03f[_0x1fb1('0x12')],_0x24d4df);_0x27d71f(_0x34076b[_0x1fb1('0x10')](0x1f4,_0x1dc03f[_0x1fb1('0x12')]));});});};exports['CreateVoiceRecording']=function(_0x1b25b3){var _0x1aac7d=this;return new Promise(function(_0x46ff60,_0xc5188b){var _0x1898e7=require(_0x1fb1('0x1c'));var _0x1a74c4;return db[_0x1fb1('0x1d')][_0x1fb1('0x1e')]({'attributes':['id',_0x1fb1('0x1f')],'where':{'id':0x1},'raw':!![]})[_0x1fb1('0xa')](function(_0x497017){_0x1a74c4=_0x497017;return db[_0x1fb1('0x15')][_0x1fb1('0x20')](_0x1b25b3[_0x1fb1('0x17')]);})['then'](function(_0x106134){if(_0x1a74c4[_0x1fb1('0x1f')]&&fs[_0x1fb1('0x21')](_0x106134[_0x1fb1('0x22')])){var _0x5402e9=util[_0x1fb1('0x23')](_0x1fb1('0x24'),_0x106134['value']);return _0x1898e7[_0x1fb1('0x25')](_0x106134['value'],_0x5402e9,config['secrets'][_0x1fb1('0x26')])[_0x1fb1('0xa')](function(){fs['unlink'](_0x106134[_0x1fb1('0x22')]);logger[_0x1fb1('0xb')](_0x1fb1('0x27'));return _0x106134;});}return _0x106134;})[_0x1fb1('0xa')](function(_0x32d797){logger['info'](_0x1fb1('0x28'),_0x1b25b3);logger[_0x1fb1('0x1b')](_0x1fb1('0x28'),_0x1b25b3,JSON[_0x1fb1('0xf')](_0x32d797));_0x46ff60(_0x32d797);})[_0x1fb1('0x13')](function(_0x307700){logger[_0x1fb1('0x10')](_0x1fb1('0x28'),_0x307700[_0x1fb1('0x12')],_0x1b25b3);_0xc5188b(_0x1aac7d['error'](0x1f4,_0x307700[_0x1fb1('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 9214f8e..cf49a9d 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 _0x457b=['create','put','update','delete','destroy','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','describe'];(function(_0x1b54e6,_0x5edb65){var _0x4d1ea0=function(_0xec5fb6){while(--_0xec5fb6){_0x1b54e6['push'](_0x1b54e6['shift']());}};_0x4d1ea0(++_0x5edb65);}(_0x457b,0x1c6));var _0xb457=function(_0x1d937b,_0xcd426c){_0x1d937b=_0x1d937b-0x0;var _0x25f48c=_0x457b[_0x1d937b];return _0x25f48c;};'use strict';var multer=require(_0xb457('0x0'));var util=require('util');var path=require(_0xb457('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb457('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xb457('0x3'));var interaction=require(_0xb457('0x4'));var config=require('../../config/environment');var controller=require('./voiceTransferReport.controller');router[_0xb457('0x5')]('/',auth[_0xb457('0x6')](),controller['index']);router[_0xb457('0x5')]('/describe',auth[_0xb457('0x6')](),controller[_0xb457('0x7')]);router[_0xb457('0x5')]('/:id',auth[_0xb457('0x6')](),controller['show']);router['post']('/',auth[_0xb457('0x6')](),controller[_0xb457('0x8')]);router[_0xb457('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xb457('0xa')]);router[_0xb457('0xb')]('/:id',auth[_0xb457('0x6')](),controller[_0xb457('0xc')]);module[_0xb457('0xd')]=router; \ No newline at end of file +var _0xbf57=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','create','put','update','delete','destroy','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbf57,0xe6));var _0x7bf5=function(_0x40a77f,_0x1d5f8d){_0x40a77f=_0x40a77f-0x0;var _0x415aa1=_0xbf57[_0x40a77f];return _0x415aa1;};'use strict';var multer=require(_0x7bf5('0x0'));var util=require(_0x7bf5('0x1'));var path=require(_0x7bf5('0x2'));var timeout=require(_0x7bf5('0x3'));var express=require(_0x7bf5('0x4'));var router=express[_0x7bf5('0x5')]();var fs_extra=require(_0x7bf5('0x6'));var auth=require(_0x7bf5('0x7'));var interaction=require(_0x7bf5('0x8'));var config=require(_0x7bf5('0x9'));var controller=require('./voiceTransferReport.controller');router[_0x7bf5('0xa')]('/',auth['isAuthenticated'](),controller[_0x7bf5('0xb')]);router['get'](_0x7bf5('0xc'),auth[_0x7bf5('0xd')](),controller[_0x7bf5('0xe')]);router['get'](_0x7bf5('0xf'),auth[_0x7bf5('0xd')](),controller[_0x7bf5('0x10')]);router['post']('/',auth[_0x7bf5('0xd')](),controller[_0x7bf5('0x11')]);router[_0x7bf5('0x12')]('/:id',auth[_0x7bf5('0xd')](),controller[_0x7bf5('0x13')]);router[_0x7bf5('0x14')](_0x7bf5('0xf'),auth[_0x7bf5('0xd')](),controller[_0x7bf5('0x15')]);module[_0x7bf5('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 8c11ec1..9cefb82 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 _0xf966=['STRING','sequelize','moment','exports','ENUM','attended'];(function(_0x12bcf7,_0xc11103){var _0x2825a=function(_0x4452ba){while(--_0x4452ba){_0x12bcf7['push'](_0x12bcf7['shift']());}};_0x2825a(++_0xc11103);}(_0xf966,0x16f));var _0x6f96=function(_0x1ff7e7,_0x423e78){_0x1ff7e7=_0x1ff7e7-0x0;var _0x1fcdb3=_0xf966[_0x1ff7e7];return _0x1fcdb3;};'use strict';var Sequelize=require(_0x6f96('0x0'));var moment=require(_0x6f96('0x1'));module[_0x6f96('0x2')]={'type':{'type':Sequelize[_0x6f96('0x3')]('blind',_0x6f96('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x6f96('0x5')]},'transferercalleridname':{'type':Sequelize[_0x6f96('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x6f96('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x6f96('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x6f96('0x5')]},'transferercontext':{'type':Sequelize[_0x6f96('0x5')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x6f96('0x5')]},'transfereechannel':{'type':Sequelize[_0x6f96('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x6f96('0x5')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x6f96('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x6f96('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x6f96('0x5')]},'transfereecontext':{'type':Sequelize[_0x6f96('0x5')]},'transfereeexten':{'type':Sequelize[_0x6f96('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x6f96('0x5')]},'isexternal':{'type':Sequelize['ENUM']('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x6f96('0x5')]}}; \ No newline at end of file +var _0x1732=['exports','ENUM','blind','STRING','Yes','sequelize'];(function(_0x3c7246,_0x2dd7c4){var _0x3095f8=function(_0x18d2a3){while(--_0x18d2a3){_0x3c7246['push'](_0x3c7246['shift']());}};_0x3095f8(++_0x2dd7c4);}(_0x1732,0x89));var _0x2173=function(_0x29661c,_0x4448ef){_0x29661c=_0x29661c-0x0;var _0x4c2791=_0x1732[_0x29661c];return _0x4c2791;};'use strict';var Sequelize=require(_0x2173('0x0'));var moment=require('moment');module[_0x2173('0x1')]={'type':{'type':Sequelize[_0x2173('0x2')](_0x2173('0x3'),'attended')},'result':{'type':Sequelize[_0x2173('0x4')]},'transfererchannel':{'type':Sequelize[_0x2173('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x2173('0x4')]},'transferercalleridname':{'type':Sequelize[_0x2173('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x2173('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x2173('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x2173('0x4')]},'transferercontext':{'type':Sequelize[_0x2173('0x4')]},'transfererexten':{'type':Sequelize[_0x2173('0x4')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x2173('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x2173('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x2173('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x2173('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x2173('0x4')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x2173('0x4')]},'transfereeexten':{'type':Sequelize[_0x2173('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x2173('0x4')]},'isexternal':{'type':Sequelize[_0x2173('0x2')](_0x2173('0x5'),'No')},'context':{'type':Sequelize[_0x2173('0x4')]},'extension':{'type':Sequelize[_0x2173('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index ff47821..b4bdde4 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 _0x046f=['send','index','map','VoiceTransferReport','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','show','params','length','find','create','body','catch','update','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','undefined','limit','count','offset','Content-Range','apply','reject','destroy','error','stack','name'];(function(_0x4504c3,_0x33bf87){var _0xe3424d=function(_0x242353){while(--_0x242353){_0x4504c3['push'](_0x4504c3['shift']());}};_0xe3424d(++_0x33bf87);}(_0x046f,0x1c8));var _0xf046=function(_0x4411bd,_0x569f05){_0x4411bd=_0x4411bd-0x0;var _0x7fbd77=_0x046f[_0x4411bd];return _0x7fbd77;};'use strict';var emlformat=require(_0xf046('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf046('0x1'));var jsonpatch=require(_0xf046('0x2'));var rp=require('request-promise');var moment=require(_0xf046('0x3'));var BPromise=require(_0xf046('0x4'));var Mustache=require(_0xf046('0x5'));var util=require('util');var path=require(_0xf046('0x6'));var sox=require(_0xf046('0x7'));var csv=require(_0xf046('0x8'));var ejs=require(_0xf046('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf046('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf046('0xb'));var toCsv=require(_0xf046('0x8'));var querystring=require('querystring');var Papa=require(_0xf046('0xc'));var Redis=require(_0xf046('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xf046('0xe'));var as=require(_0xf046('0xf'));var hardwareService=require(_0xf046('0x10'));var logger=require(_0xf046('0x11'))(_0xf046('0x12'));var utils=require(_0xf046('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf046('0x14'))['db'];function respondWithStatusCode(_0x1bc6cc,_0x1eba3c){_0x1eba3c=_0x1eba3c||0xcc;return function(_0x1045c){if(_0x1045c){return _0x1bc6cc['sendStatus'](_0x1eba3c);}return _0x1bc6cc[_0xf046('0x15')](_0x1eba3c)[_0xf046('0x16')]();};}function respondWithResult(_0x4640f8,_0x1411a9){_0x1411a9=_0x1411a9||0xc8;return function(_0x215296){if(_0x215296){return _0x4640f8[_0xf046('0x15')](_0x1411a9)['json'](_0x215296);}};}function respondWithFilteredResult(_0x4ee8d8,_0x26ed18){return function(_0x592c03){if(_0x592c03){var _0x39d338=typeof _0x26ed18['offset']===_0xf046('0x17')&&typeof _0x26ed18[_0xf046('0x18')]===_0xf046('0x17');var _0x3deeba=_0x592c03[_0xf046('0x19')];var _0x3e7c45=_0x39d338?0x0:_0x26ed18[_0xf046('0x1a')];var _0x21bff5=_0x39d338?_0x592c03[_0xf046('0x19')]:_0x26ed18[_0xf046('0x1a')]+_0x26ed18[_0xf046('0x18')];var _0xb29b8e;if(_0x21bff5>=_0x3deeba){_0x21bff5=_0x3deeba;_0xb29b8e=0xc8;}else{_0xb29b8e=0xce;}_0x4ee8d8['status'](_0xb29b8e);return _0x4ee8d8['set'](_0xf046('0x1b'),_0x3e7c45+'-'+_0x21bff5+'/'+_0x3deeba)['json'](_0x592c03);}return null;};}function patchUpdates(_0x6b5ff){return function(_0x12a9eb){try{jsonpatch[_0xf046('0x1c')](_0x12a9eb,_0x6b5ff,!![]);}catch(_0x3e9581){return BPromise[_0xf046('0x1d')](_0x3e9581);}return _0x12a9eb['save']();};}function saveUpdates(_0x3334e6,_0x434e2e){return function(_0x138306){if(_0x138306){return _0x138306['update'](_0x3334e6)['then'](function(_0x2e56ae){return _0x2e56ae;});}return null;};}function removeEntity(_0xcb05eb,_0xbf65ce){return function(_0x5b71f3){if(_0x5b71f3){return _0x5b71f3[_0xf046('0x1e')]()['then'](function(){_0xcb05eb[_0xf046('0x15')](0xcc)[_0xf046('0x16')]();});}};}function handleEntityNotFound(_0x4ff81c,_0x5273d3){return function(_0x5537b3){if(!_0x5537b3){_0x4ff81c['sendStatus'](0x194);}return _0x5537b3;};}function handleError(_0x564f78,_0x16cffe){_0x16cffe=_0x16cffe||0x1f4;return function(_0x2f47ff){logger[_0xf046('0x1f')](_0x2f47ff[_0xf046('0x20')]);if(_0x2f47ff[_0xf046('0x21')]){delete _0x2f47ff['name'];}_0x564f78['status'](_0x16cffe)[_0xf046('0x22')](_0x2f47ff);};}exports[_0xf046('0x23')]=function(_0x112ce8,_0x3ecc35){var _0x11de4c={},_0x3c04b9={},_0x6d0ab9={'count':0x0,'rows':[]};var _0x196e55=_[_0xf046('0x24')](db[_0xf046('0x25')][_0xf046('0x26')],function(_0x3a4d7d){return{'name':_0x3a4d7d['fieldName'],'type':_0x3a4d7d[_0xf046('0x27')]['key']};});_0x3c04b9[_0xf046('0x28')]=_[_0xf046('0x24')](_0x196e55,_0xf046('0x21'));_0x3c04b9[_0xf046('0x29')]=_[_0xf046('0x2a')](_0x112ce8[_0xf046('0x29')]);_0x3c04b9[_0xf046('0x2b')]=_['intersection'](_0x3c04b9['model'],_0x3c04b9[_0xf046('0x29')]);_0x11de4c[_0xf046('0x2c')]=_[_0xf046('0x2d')](_0x3c04b9['model'],qs[_0xf046('0x2e')](_0x112ce8[_0xf046('0x29')][_0xf046('0x2e')]));_0x11de4c[_0xf046('0x2c')]=_0x11de4c['attributes']['length']?_0x11de4c[_0xf046('0x2c')]:_0x3c04b9[_0xf046('0x28')];if(!_0x112ce8[_0xf046('0x29')]['hasOwnProperty'](_0xf046('0x2f'))){_0x11de4c[_0xf046('0x18')]=qs[_0xf046('0x18')](_0x112ce8[_0xf046('0x29')][_0xf046('0x18')]);_0x11de4c['offset']=qs[_0xf046('0x1a')](_0x112ce8[_0xf046('0x29')][_0xf046('0x1a')]);}_0x11de4c[_0xf046('0x30')]=qs[_0xf046('0x31')](_0x112ce8['query'][_0xf046('0x31')]);_0x11de4c[_0xf046('0x32')]=qs[_0xf046('0x2b')](_[_0xf046('0x33')](_0x112ce8[_0xf046('0x29')],_0x3c04b9[_0xf046('0x2b')]),_0x196e55);if(_0x112ce8[_0xf046('0x29')][_0xf046('0x34')]){_0x11de4c[_0xf046('0x32')]=_[_0xf046('0x35')](_0x11de4c[_0xf046('0x32')],{'$or':_[_0xf046('0x24')](_0x196e55,function(_0x24e11c){if(_0x24e11c[_0xf046('0x27')]!==_0xf046('0x36')){var _0x8a7946={};_0x8a7946[_0x24e11c[_0xf046('0x21')]]={'$like':'%'+_0x112ce8['query'][_0xf046('0x34')]+'%'};return _0x8a7946;}})});}_0x11de4c=_[_0xf046('0x35')]({},_0x11de4c,_0x112ce8[_0xf046('0x37')]);var _0xf9f812={'where':_0x11de4c['where']};return db['VoiceTransferReport'][_0xf046('0x19')](_0xf9f812)[_0xf046('0x38')](function(_0x233da7){_0x6d0ab9[_0xf046('0x19')]=_0x233da7;if(_0x112ce8[_0xf046('0x29')][_0xf046('0x39')]){_0x11de4c[_0xf046('0x3a')]=[{'all':!![]}];}return db[_0xf046('0x25')][_0xf046('0x3b')](_0x11de4c);})[_0xf046('0x38')](function(_0xea2f23){_0x6d0ab9[_0xf046('0x3c')]=_0xea2f23;return _0x6d0ab9;})[_0xf046('0x38')](respondWithFilteredResult(_0x3ecc35,_0x11de4c))['catch'](handleError(_0x3ecc35,null));};exports[_0xf046('0x3d')]=function(_0x5018a5,_0x26d08a){var _0x41e0f8={'raw':!![],'where':{'id':_0x5018a5[_0xf046('0x3e')]['id']}},_0x4002c={};_0x4002c['model']=_[_0xf046('0x2a')](db[_0xf046('0x25')][_0xf046('0x26')]);_0x4002c[_0xf046('0x29')]=_[_0xf046('0x2a')](_0x5018a5[_0xf046('0x29')]);_0x4002c['filters']=_[_0xf046('0x2d')](_0x4002c[_0xf046('0x28')],_0x4002c[_0xf046('0x29')]);_0x41e0f8[_0xf046('0x2c')]=_[_0xf046('0x2d')](_0x4002c[_0xf046('0x28')],qs[_0xf046('0x2e')](_0x5018a5[_0xf046('0x29')][_0xf046('0x2e')]));_0x41e0f8[_0xf046('0x2c')]=_0x41e0f8[_0xf046('0x2c')][_0xf046('0x3f')]?_0x41e0f8[_0xf046('0x2c')]:_0x4002c[_0xf046('0x28')];if(_0x5018a5[_0xf046('0x29')][_0xf046('0x39')]){_0x41e0f8['include']=[{'all':!![]}];}_0x41e0f8=_[_0xf046('0x35')]({},_0x41e0f8,_0x5018a5[_0xf046('0x37')]);return db[_0xf046('0x25')][_0xf046('0x40')](_0x41e0f8)[_0xf046('0x38')](handleEntityNotFound(_0x26d08a,null))[_0xf046('0x38')](respondWithResult(_0x26d08a,null))['catch'](handleError(_0x26d08a,null));};exports[_0xf046('0x41')]=function(_0x15df3b,_0x1ed9a3){return db['VoiceTransferReport'][_0xf046('0x41')](_0x15df3b[_0xf046('0x42')],{})[_0xf046('0x38')](respondWithResult(_0x1ed9a3,0xc9))[_0xf046('0x43')](handleError(_0x1ed9a3,null));};exports[_0xf046('0x44')]=function(_0x4556d4,_0x2a8d26){if(_0x4556d4[_0xf046('0x42')]['id']){delete _0x4556d4[_0xf046('0x42')]['id'];}return db[_0xf046('0x25')]['find']({'where':{'id':_0x4556d4[_0xf046('0x3e')]['id']}})[_0xf046('0x38')](handleEntityNotFound(_0x2a8d26,null))[_0xf046('0x38')](saveUpdates(_0x4556d4[_0xf046('0x42')],null))[_0xf046('0x38')](respondWithResult(_0x2a8d26,null))[_0xf046('0x43')](handleError(_0x2a8d26,null));};exports['destroy']=function(_0x54ea93,_0x3dc6e0){return db[_0xf046('0x25')][_0xf046('0x40')]({'where':{'id':_0x54ea93[_0xf046('0x3e')]['id']}})[_0xf046('0x38')](handleEntityNotFound(_0x3dc6e0,null))[_0xf046('0x38')](removeEntity(_0x3dc6e0,null))['catch'](handleError(_0x3dc6e0,null));};exports[_0xf046('0x45')]=function(_0x2b4828,_0x447eb7){return db[_0xf046('0x25')][_0xf046('0x45')]()[_0xf046('0x38')](respondWithResult(_0x447eb7,null))[_0xf046('0x43')](handleError(_0x447eb7,null));}; \ No newline at end of file +var _0x1ea5=['fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','stack','name','index','map','VoiceTransferReport','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs'];(function(_0x4a782b,_0x55584a){var _0x5cb5a0=function(_0x3010ed){while(--_0x3010ed){_0x4a782b['push'](_0x4a782b['shift']());}};_0x5cb5a0(++_0x55584a);}(_0x1ea5,0xe2));var _0x51ea=function(_0x4b9dc9,_0x14b3a2){_0x4b9dc9=_0x4b9dc9-0x0;var _0x57b302=_0x1ea5[_0x4b9dc9];return _0x57b302;};'use strict';var emlformat=require(_0x51ea('0x0'));var rimraf=require(_0x51ea('0x1'));var zipdir=require(_0x51ea('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x51ea('0x3'));var moment=require(_0x51ea('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x51ea('0x5'));var util=require(_0x51ea('0x6'));var path=require(_0x51ea('0x7'));var sox=require(_0x51ea('0x8'));var csv=require(_0x51ea('0x9'));var ejs=require(_0x51ea('0xa'));var fs=require('fs');var fs_extra=require(_0x51ea('0xb'));var _=require(_0x51ea('0xc'));var squel=require(_0x51ea('0xd'));var crypto=require(_0x51ea('0xe'));var jsforce=require(_0x51ea('0xf'));var deskjs=require(_0x51ea('0x10'));var toCsv=require(_0x51ea('0x9'));var querystring=require('querystring');var Papa=require(_0x51ea('0x11'));var Redis=require(_0x51ea('0x12'));var authService=require(_0x51ea('0x13'));var qs=require(_0x51ea('0x14'));var as=require(_0x51ea('0x15'));var hardwareService=require(_0x51ea('0x16'));var logger=require(_0x51ea('0x17'))(_0x51ea('0x18'));var utils=require(_0x51ea('0x19'));var config=require(_0x51ea('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x51ea('0x1b'))['db'];function respondWithStatusCode(_0x532a91,_0x3ac7b5){_0x3ac7b5=_0x3ac7b5||0xcc;return function(_0x38a5fd){if(_0x38a5fd){return _0x532a91[_0x51ea('0x1c')](_0x3ac7b5);}return _0x532a91[_0x51ea('0x1d')](_0x3ac7b5)['end']();};}function respondWithResult(_0x178928,_0x773658){_0x773658=_0x773658||0xc8;return function(_0x215b87){if(_0x215b87){return _0x178928[_0x51ea('0x1d')](_0x773658)[_0x51ea('0x1e')](_0x215b87);}};}function respondWithFilteredResult(_0x1d7f1c,_0x2dacb0){return function(_0xa6e496){if(_0xa6e496){var _0x5cd015=typeof _0x2dacb0[_0x51ea('0x1f')]===_0x51ea('0x20')&&typeof _0x2dacb0[_0x51ea('0x21')]===_0x51ea('0x20');var _0x29f3a6=_0xa6e496[_0x51ea('0x22')];var _0x436c17=_0x5cd015?0x0:_0x2dacb0[_0x51ea('0x1f')];var _0x5d7247=_0x5cd015?_0xa6e496[_0x51ea('0x22')]:_0x2dacb0[_0x51ea('0x1f')]+_0x2dacb0[_0x51ea('0x21')];var _0x558bcb;if(_0x5d7247>=_0x29f3a6){_0x5d7247=_0x29f3a6;_0x558bcb=0xc8;}else{_0x558bcb=0xce;}_0x1d7f1c[_0x51ea('0x1d')](_0x558bcb);return _0x1d7f1c[_0x51ea('0x23')](_0x51ea('0x24'),_0x436c17+'-'+_0x5d7247+'/'+_0x29f3a6)['json'](_0xa6e496);}return null;};}function patchUpdates(_0x5654fa){return function(_0x7fb43c){try{jsonpatch[_0x51ea('0x25')](_0x7fb43c,_0x5654fa,!![]);}catch(_0x15e520){return BPromise['reject'](_0x15e520);}return _0x7fb43c[_0x51ea('0x26')]();};}function saveUpdates(_0x44ff6a,_0xa616cf){return function(_0x47d59e){if(_0x47d59e){return _0x47d59e[_0x51ea('0x27')](_0x44ff6a)[_0x51ea('0x28')](function(_0x2d6733){return _0x2d6733;});}return null;};}function removeEntity(_0x1a7f20,_0x58ccda){return function(_0x3db369){if(_0x3db369){return _0x3db369[_0x51ea('0x29')]()[_0x51ea('0x28')](function(){_0x1a7f20[_0x51ea('0x1d')](0xcc)[_0x51ea('0x2a')]();});}};}function handleEntityNotFound(_0x427ab4,_0xdbd01c){return function(_0x21c362){if(!_0x21c362){_0x427ab4[_0x51ea('0x1c')](0x194);}return _0x21c362;};}function handleError(_0xda477b,_0x571e6c){_0x571e6c=_0x571e6c||0x1f4;return function(_0x5ca596){logger['error'](_0x5ca596[_0x51ea('0x2b')]);if(_0x5ca596['name']){delete _0x5ca596[_0x51ea('0x2c')];}_0xda477b[_0x51ea('0x1d')](_0x571e6c)['send'](_0x5ca596);};}exports[_0x51ea('0x2d')]=function(_0x59f84f,_0x43f608){var _0x5e2709={},_0x3feb73={},_0x3e5737={'count':0x0,'rows':[]};var _0x39e851=_[_0x51ea('0x2e')](db[_0x51ea('0x2f')][_0x51ea('0x30')],function(_0xc0f294){return{'name':_0xc0f294['fieldName'],'type':_0xc0f294[_0x51ea('0x31')]['key']};});_0x3feb73[_0x51ea('0x32')]=_[_0x51ea('0x2e')](_0x39e851,_0x51ea('0x2c'));_0x3feb73[_0x51ea('0x33')]=_[_0x51ea('0x34')](_0x59f84f[_0x51ea('0x33')]);_0x3feb73[_0x51ea('0x35')]=_[_0x51ea('0x36')](_0x3feb73[_0x51ea('0x32')],_0x3feb73[_0x51ea('0x33')]);_0x5e2709[_0x51ea('0x37')]=_[_0x51ea('0x36')](_0x3feb73[_0x51ea('0x32')],qs[_0x51ea('0x38')](_0x59f84f[_0x51ea('0x33')][_0x51ea('0x38')]));_0x5e2709[_0x51ea('0x37')]=_0x5e2709[_0x51ea('0x37')][_0x51ea('0x39')]?_0x5e2709[_0x51ea('0x37')]:_0x3feb73[_0x51ea('0x32')];if(!_0x59f84f[_0x51ea('0x33')][_0x51ea('0x3a')](_0x51ea('0x3b'))){_0x5e2709[_0x51ea('0x21')]=qs[_0x51ea('0x21')](_0x59f84f[_0x51ea('0x33')][_0x51ea('0x21')]);_0x5e2709['offset']=qs[_0x51ea('0x1f')](_0x59f84f[_0x51ea('0x33')][_0x51ea('0x1f')]);}_0x5e2709[_0x51ea('0x3c')]=qs[_0x51ea('0x3d')](_0x59f84f[_0x51ea('0x33')][_0x51ea('0x3d')]);_0x5e2709['where']=qs['filters'](_[_0x51ea('0x3e')](_0x59f84f['query'],_0x3feb73[_0x51ea('0x35')]),_0x39e851);if(_0x59f84f[_0x51ea('0x33')][_0x51ea('0x3f')]){_0x5e2709['where']=_[_0x51ea('0x40')](_0x5e2709[_0x51ea('0x41')],{'$or':_[_0x51ea('0x2e')](_0x39e851,function(_0x1805d9){if(_0x1805d9[_0x51ea('0x31')]!==_0x51ea('0x42')){var _0x29da7f={};_0x29da7f[_0x1805d9[_0x51ea('0x2c')]]={'$like':'%'+_0x59f84f[_0x51ea('0x33')][_0x51ea('0x3f')]+'%'};return _0x29da7f;}})});}_0x5e2709=_[_0x51ea('0x40')]({},_0x5e2709,_0x59f84f[_0x51ea('0x43')]);var _0x503388={'where':_0x5e2709[_0x51ea('0x41')]};return db['VoiceTransferReport']['count'](_0x503388)['then'](function(_0x1cb1fa){_0x3e5737[_0x51ea('0x22')]=_0x1cb1fa;if(_0x59f84f[_0x51ea('0x33')][_0x51ea('0x44')]){_0x5e2709['include']=[{'all':!![]}];}return db[_0x51ea('0x2f')][_0x51ea('0x45')](_0x5e2709);})[_0x51ea('0x28')](function(_0x42e37b){_0x3e5737[_0x51ea('0x46')]=_0x42e37b;return _0x3e5737;})[_0x51ea('0x28')](respondWithFilteredResult(_0x43f608,_0x5e2709))[_0x51ea('0x47')](handleError(_0x43f608,null));};exports[_0x51ea('0x48')]=function(_0x129f05,_0x1795dc){var _0x167ceb={'raw':!![],'where':{'id':_0x129f05[_0x51ea('0x49')]['id']}},_0x33509c={};_0x33509c['model']=_[_0x51ea('0x34')](db[_0x51ea('0x2f')][_0x51ea('0x30')]);_0x33509c[_0x51ea('0x33')]=_[_0x51ea('0x34')](_0x129f05[_0x51ea('0x33')]);_0x33509c[_0x51ea('0x35')]=_['intersection'](_0x33509c[_0x51ea('0x32')],_0x33509c[_0x51ea('0x33')]);_0x167ceb['attributes']=_[_0x51ea('0x36')](_0x33509c[_0x51ea('0x32')],qs[_0x51ea('0x38')](_0x129f05[_0x51ea('0x33')]['fields']));_0x167ceb[_0x51ea('0x37')]=_0x167ceb['attributes'][_0x51ea('0x39')]?_0x167ceb[_0x51ea('0x37')]:_0x33509c['model'];if(_0x129f05[_0x51ea('0x33')][_0x51ea('0x44')]){_0x167ceb[_0x51ea('0x4a')]=[{'all':!![]}];}_0x167ceb=_[_0x51ea('0x40')]({},_0x167ceb,_0x129f05[_0x51ea('0x43')]);return db[_0x51ea('0x2f')][_0x51ea('0x4b')](_0x167ceb)[_0x51ea('0x28')](handleEntityNotFound(_0x1795dc,null))[_0x51ea('0x28')](respondWithResult(_0x1795dc,null))[_0x51ea('0x47')](handleError(_0x1795dc,null));};exports[_0x51ea('0x4c')]=function(_0x4b968e,_0x1f5a22){return db[_0x51ea('0x2f')][_0x51ea('0x4c')](_0x4b968e[_0x51ea('0x4d')],{})[_0x51ea('0x28')](respondWithResult(_0x1f5a22,0xc9))[_0x51ea('0x47')](handleError(_0x1f5a22,null));};exports['update']=function(_0x34ccd2,_0x243968){if(_0x34ccd2[_0x51ea('0x4d')]['id']){delete _0x34ccd2[_0x51ea('0x4d')]['id'];}return db[_0x51ea('0x2f')][_0x51ea('0x4b')]({'where':{'id':_0x34ccd2[_0x51ea('0x49')]['id']}})['then'](handleEntityNotFound(_0x243968,null))[_0x51ea('0x28')](saveUpdates(_0x34ccd2[_0x51ea('0x4d')],null))[_0x51ea('0x28')](respondWithResult(_0x243968,null))['catch'](handleError(_0x243968,null));};exports['destroy']=function(_0x3e1d51,_0x5e3e29){return db['VoiceTransferReport'][_0x51ea('0x4b')]({'where':{'id':_0x3e1d51[_0x51ea('0x49')]['id']}})[_0x51ea('0x28')](handleEntityNotFound(_0x5e3e29,null))[_0x51ea('0x28')](removeEntity(_0x5e3e29,null))[_0x51ea('0x47')](handleError(_0x5e3e29,null));};exports[_0x51ea('0x4e')]=function(_0x554827,_0x5ac076){return db['VoiceTransferReport']['describe']()['then'](respondWithResult(_0x5ac076,null))['catch'](handleError(_0x5ac076,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 70e3aed..0c5abf7 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 _0x119c=['path','./voiceTransferReport.attributes','exports','VoiceTransferReport','report_call_transfer','lodash','util','api','moment','bluebird','request-promise'];(function(_0x4d97ff,_0x348225){var _0x4a7db0=function(_0x3b141d){while(--_0x3b141d){_0x4d97ff['push'](_0x4d97ff['shift']());}};_0x4a7db0(++_0x348225);}(_0x119c,0x118));var _0xc119=function(_0x3dd8dd,_0x369f8e){_0x3dd8dd=_0x3dd8dd-0x0;var _0x33e300=_0x119c[_0x3dd8dd];return _0x33e300;};'use strict';var _=require(_0xc119('0x0'));var util=require(_0xc119('0x1'));var logger=require('../../config/logger')(_0xc119('0x2'));var moment=require(_0xc119('0x3'));var BPromise=require(_0xc119('0x4'));var rp=require(_0xc119('0x5'));var fs=require('fs');var path=require(_0xc119('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc119('0x7'));module[_0xc119('0x8')]=function(_0x375062,_0x3d41c8){return _0x375062['define'](_0xc119('0x9'),attributes,{'tableName':_0xc119('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x58f3=['exports','report_call_transfer','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceTransferReport.attributes'];(function(_0x2e4f9f,_0x316676){var _0x333252=function(_0x3b9a60){while(--_0x3b9a60){_0x2e4f9f['push'](_0x2e4f9f['shift']());}};_0x333252(++_0x316676);}(_0x58f3,0x176));var _0x358f=function(_0xbf5a68,_0x41a0f4){_0xbf5a68=_0xbf5a68-0x0;var _0x231ad5=_0x58f3[_0xbf5a68];return _0x231ad5;};'use strict';var _=require(_0x358f('0x0'));var util=require(_0x358f('0x1'));var logger=require(_0x358f('0x2'))(_0x358f('0x3'));var moment=require(_0x358f('0x4'));var BPromise=require(_0x358f('0x5'));var rp=require(_0x358f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x358f('0x7'));var config=require(_0x358f('0x8'));var attributes=require(_0x358f('0x9'));module[_0x358f('0xa')]=function(_0x166c34,_0x21ea12){return _0x166c34['define']('VoiceTransferReport',attributes,{'tableName':_0x358f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index d9c8528..d24e93d 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 _0xaeba=['catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','debug','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x354404,_0x141542){var _0x1c10f8=function(_0x2bfd21){while(--_0x2bfd21){_0x354404['push'](_0x354404['shift']());}};_0x1c10f8(++_0x141542);}(_0xaeba,0x7b));var _0xaaeb=function(_0xf2fed2,_0x3fd77e){_0xf2fed2=_0xf2fed2-0x0;var _0x2b996c=_0xaeba[_0xf2fed2];return _0x2b996c;};'use strict';var _=require(_0xaaeb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaaeb('0x1'));var rs=require(_0xaaeb('0x2'));var fs=require('fs');var Redis=require(_0xaaeb('0x3'));var db=require(_0xaaeb('0x4'))['db'];var utils=require(_0xaaeb('0x5'));var logger=require(_0xaaeb('0x6'))(_0xaaeb('0x7'));var config=require(_0xaaeb('0x8'));var jayson=require(_0xaaeb('0x9'));var client=jayson['client'][_0xaaeb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c305e,_0x1418fa,_0x25a449){return new BPromise(function(_0x355bc0,_0x4b1fd4){return client[_0xaaeb('0xb')](_0x4c305e,_0x25a449)[_0xaaeb('0xc')](function(_0x741e91){logger[_0xaaeb('0xd')](_0xaaeb('0xe'),_0x1418fa,'request\x20sent');logger['debug'](_0xaaeb('0xf'),_0x1418fa,_0xaaeb('0x10'),JSON[_0xaaeb('0x11')](_0x741e91));if(_0x741e91[_0xaaeb('0x12')]){if(_0x741e91[_0xaaeb('0x12')][_0xaaeb('0x13')]===0x1f4){logger[_0xaaeb('0x12')](_0xaaeb('0xe'),_0x1418fa,_0x741e91['error']['message']);return _0x4b1fd4(_0x741e91['error']['message']);}logger[_0xaaeb('0x12')](_0xaaeb('0xe'),_0x1418fa,_0x741e91[_0xaaeb('0x12')]['message']);return _0x355bc0(_0x741e91[_0xaaeb('0x12')][_0xaaeb('0x14')]);}else{logger['info'](_0xaaeb('0xe'),_0x1418fa,_0xaaeb('0x10'));_0x355bc0(_0x741e91[_0xaaeb('0x15')]['message']);}})[_0xaaeb('0x16')](function(_0x539fd2){logger[_0xaaeb('0x12')](_0xaaeb('0xe'),_0x1418fa,_0x539fd2);_0x4b1fd4(_0x539fd2);});});}exports[_0xaaeb('0x17')]=function(_0x1324f0){var _0x26991c=this;return new Promise(function(_0x51bdc4,_0x168798){return db[_0xaaeb('0x18')][_0xaaeb('0x19')](_0x1324f0[_0xaaeb('0x1a')],{'raw':_0x1324f0[_0xaaeb('0x1b')]?_0x1324f0[_0xaaeb('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xaaeb('0xc')](function(_0x46f720){logger[_0xaaeb('0xd')](_0xaaeb('0x17'),_0x1324f0);logger[_0xaaeb('0x1c')](_0xaaeb('0x17'),_0x1324f0,JSON[_0xaaeb('0x11')](_0x46f720));_0x51bdc4(_0x46f720);})['catch'](function(_0x3e51e8){logger[_0xaaeb('0x12')]('CreateVoiceTransferReport',_0x3e51e8['message'],_0x1324f0);_0x168798(_0x26991c[_0xaaeb('0x12')](0x1f4,_0x3e51e8[_0xaaeb('0x14')]));});});}; \ No newline at end of file +var _0xa9a6=['VoiceTransferReport','create','body','options','raw','lodash','util','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceTransferReport'];(function(_0x3fa3fb,_0x3d4084){var _0x16b6f4=function(_0x457ee9){while(--_0x457ee9){_0x3fa3fb['push'](_0x3fa3fb['shift']());}};_0x16b6f4(++_0x3d4084);}(_0xa9a6,0x17f));var _0x6a9a=function(_0x3d1a71,_0x31a7a9){_0x3d1a71=_0x3d1a71-0x0;var _0x3b665d=_0xa9a6[_0x3d1a71];return _0x3b665d;};'use strict';var _=require(_0x6a9a('0x0'));var util=require(_0x6a9a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6a9a('0x2'));var logger=require(_0x6a9a('0x3'))(_0x6a9a('0x4'));var config=require('../../config/environment');var jayson=require(_0x6a9a('0x5'));var client=jayson[_0x6a9a('0x6')][_0x6a9a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15edb2,_0x3e8472,_0xb624cf){return new BPromise(function(_0x29865f,_0x3dc622){return client[_0x6a9a('0x8')](_0x15edb2,_0xb624cf)[_0x6a9a('0x9')](function(_0x23ce7c){logger[_0x6a9a('0xa')](_0x6a9a('0xb'),_0x3e8472,_0x6a9a('0xc'));logger[_0x6a9a('0xd')](_0x6a9a('0xe'),_0x3e8472,_0x6a9a('0xc'),JSON[_0x6a9a('0xf')](_0x23ce7c));if(_0x23ce7c[_0x6a9a('0x10')]){if(_0x23ce7c[_0x6a9a('0x10')][_0x6a9a('0x11')]===0x1f4){logger[_0x6a9a('0x10')](_0x6a9a('0xb'),_0x3e8472,_0x23ce7c[_0x6a9a('0x10')][_0x6a9a('0x12')]);return _0x3dc622(_0x23ce7c[_0x6a9a('0x10')][_0x6a9a('0x12')]);}logger[_0x6a9a('0x10')](_0x6a9a('0xb'),_0x3e8472,_0x23ce7c['error'][_0x6a9a('0x12')]);return _0x29865f(_0x23ce7c['error'][_0x6a9a('0x12')]);}else{logger[_0x6a9a('0xa')]('VoiceTransferReport,\x20%s,\x20%s',_0x3e8472,_0x6a9a('0xc'));_0x29865f(_0x23ce7c[_0x6a9a('0x13')][_0x6a9a('0x12')]);}})[_0x6a9a('0x14')](function(_0x6403fe){logger[_0x6a9a('0x10')](_0x6a9a('0xb'),_0x3e8472,_0x6403fe);_0x3dc622(_0x6403fe);});});}exports[_0x6a9a('0x15')]=function(_0x1c2f32){var _0x4bc16b=this;return new Promise(function(_0x343846,_0x320973){return db[_0x6a9a('0x16')][_0x6a9a('0x17')](_0x1c2f32[_0x6a9a('0x18')],{'raw':_0x1c2f32[_0x6a9a('0x19')]?_0x1c2f32[_0x6a9a('0x19')][_0x6a9a('0x1a')]===undefined?!![]:![]:!![]})[_0x6a9a('0x9')](function(_0x126de1){logger[_0x6a9a('0xa')]('CreateVoiceTransferReport',_0x1c2f32);logger[_0x6a9a('0xd')](_0x6a9a('0x15'),_0x1c2f32,JSON[_0x6a9a('0xf')](_0x126de1));_0x343846(_0x126de1);})[_0x6a9a('0x14')](function(_0x19e36a){logger['error'](_0x6a9a('0x15'),_0x19e36a[_0x6a9a('0x12')],_0x1c2f32);_0x320973(_0x4bc16b[_0x6a9a('0x10')](0x1f4,_0x19e36a['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 67ed74f..dcfaabb 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 _0x0bb5=['unhold','/calls','calls','/transfer','exports','express','Router','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','/answer','/hold','hold','/unhold'];(function(_0x47b113,_0x5a2e0e){var _0x230d82=function(_0x28a248){while(--_0x28a248){_0x47b113['push'](_0x47b113['shift']());}};_0x230d82(++_0x5a2e0e);}(_0x0bb5,0x148));var _0x50bb=function(_0xf5131a,_0x45b99c){_0xf5131a=_0xf5131a-0x0;var _0x5b6fca=_0x0bb5[_0xf5131a];return _0x5b6fca;};'use strict';var express=require(_0x50bb('0x0'));var router=express[_0x50bb('0x1')]();var auth=require('../../components/auth/service');var controller=require('./webbar.controller');router[_0x50bb('0x2')](_0x50bb('0x3'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller[_0x50bb('0x6')]);router[_0x50bb('0x2')](_0x50bb('0x7'),auth[_0x50bb('0x4')](),auth['isWebrtcLicence'](),controller['hangup']);router[_0x50bb('0x2')](_0x50bb('0x8'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller['answer']);router['post'](_0x50bb('0x9'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller[_0x50bb('0xa')]);router['post'](_0x50bb('0xb'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller[_0x50bb('0xc')]);router[_0x50bb('0x2')](_0x50bb('0xd'),auth[_0x50bb('0x4')](),auth['isWebrtcLicence'](),controller[_0x50bb('0xe')]);router['post'](_0x50bb('0xf'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller['transfer']);module[_0x50bb('0x10')]=router; \ No newline at end of file +var _0x9c44=['/answer','answer','/hold','/unhold','unhold','/transfer','transfer','exports','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','/hangup','hangup'];(function(_0x223461,_0x2bca70){var _0x4dbe0a=function(_0x3c3cb6){while(--_0x3c3cb6){_0x223461['push'](_0x223461['shift']());}};_0x4dbe0a(++_0x2bca70);}(_0x9c44,0x178));var _0x49c4=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x9c44[_0x21549c];return _0x426cbd;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x49c4('0x0'));var controller=require(_0x49c4('0x1'));router[_0x49c4('0x2')](_0x49c4('0x3'),auth[_0x49c4('0x4')](),auth[_0x49c4('0x5')](),controller['originate']);router['post'](_0x49c4('0x6'),auth['isAuthenticated'](),auth[_0x49c4('0x5')](),controller[_0x49c4('0x7')]);router[_0x49c4('0x2')](_0x49c4('0x8'),auth[_0x49c4('0x4')](),auth['isWebrtcLicence'](),controller[_0x49c4('0x9')]);router[_0x49c4('0x2')](_0x49c4('0xa'),auth[_0x49c4('0x4')](),auth['isWebrtcLicence'](),controller['hold']);router[_0x49c4('0x2')](_0x49c4('0xb'),auth['isAuthenticated'](),auth[_0x49c4('0x5')](),controller[_0x49c4('0xc')]);router['post']('/calls',auth[_0x49c4('0x4')](),auth[_0x49c4('0x5')](),controller['calls']);router[_0x49c4('0x2')](_0x49c4('0xd'),auth['isAuthenticated'](),auth[_0x49c4('0x5')](),controller[_0x49c4('0xe')]);module[_0x49c4('0xf')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index eb93c9a..065a238 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 _0x222f=['json','userId','callNumber','callbackUrl','entityFound:','format','originate\x20executed!','hangup','sessionId','user:%s','answer','answer\x20fired:','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','jayson/promise','client','http','../../config/logger','ioredis','defaults','redis','socket.io-emitter','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','emit','log','handleError:','error','stack','name','status','send','NotFound','request','then','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','length','sessionId\x20','\x20not\x20found!','originate','validate','body'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x222f,0x1a4));var _0xf222=function(_0x1ab758,_0x3dbede){_0x1ab758=_0x1ab758-0x0;var _0x5788a0=_0x222f[_0x1ab758];return _0x5788a0;};'use strict';var path=require(_0xf222('0x0'));var fs=require('fs');var _=require(_0xf222('0x1'));var db=require(_0xf222('0x2'))['db'];var config=require(_0xf222('0x3'));var util=require('util');var BPromise=require('bluebird');var jayson=require(_0xf222('0x4'));var amiClient=jayson[_0xf222('0x5')][_0xf222('0x6')]({'port':0x232a});var logger=require(_0xf222('0x7'))('webbarapi');var Redis=require(_0xf222('0x8'));config['redis']=_[_0xf222('0x9')](config[_0xf222('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xf222('0xb'))(new Redis(config[_0xf222('0xa')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0xf222('0xc'),'required':[!![],_0xf222('0xd')]},'callNumber':{'type':_0xf222('0xe'),'required':[!![],_0xf222('0xf')]},'callerId':{'type':_0xf222('0xe')},'callbackUrl':{'type':_0xf222('0xe')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf222('0xd')]},'sessionId':{'type':_0xf222('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xf222('0xc'),'required':[!![],_0xf222('0xd')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0xf222('0xc'),'required':[!![],_0xf222('0xd')]},'sessionId':{'type':_0xf222('0xe'),'required':[!![],_0xf222('0x10')]},'transferNumber':{'type':_0xf222('0xe'),'required':[!![],_0xf222('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0xf222('0xc'),'required':[!![],_0xf222('0xd')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf222('0xd')]},'sessionId':{'type':_0xf222('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf222('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':_0xf222('0xc'),'required':[!![],_0xf222('0xd')]}});function emit(_0x4392a0,_0x464060,_0x25e1c2){logger[_0xf222('0x12')](_0x4392a0,_0x464060,JSON['stringify'](_0x25e1c2));io['to'](_0x4392a0)[_0xf222('0x13')](_0x464060,_0x25e1c2);}function handleError(_0x823314){return function(_0x8783ab){console[_0xf222('0x14')](_0xf222('0x15'),_0x8783ab,_0x8783ab instanceof RangeError);logger[_0xf222('0x16')](_0x8783ab[_0xf222('0x17')]);if(_0x8783ab instanceof RangeError){if(_0x8783ab['name']){delete _0x8783ab[_0xf222('0x18')];}_0x823314[_0xf222('0x19')](0x194)[_0xf222('0x1a')](_0x8783ab);}else{if(_0x8783ab[_0xf222('0x18')]){delete _0x8783ab['name'];}_0x823314['status'](0x1f4)[_0xf222('0x1a')](_0x8783ab);}};}function checkError(){return function(_0x3e8875){if(!_0x3e8875){throw new RangeError(_0xf222('0x1b'));}return _0x3e8875;};}function respondWithRpcPromise(_0x33406d,_0x35539d){return new BPromise(function(_0x151a89,_0x51b872){var _0x176b20=amiClient;return _0x176b20[_0xf222('0x1c')](_0x33406d,_0x35539d)[_0xf222('0x1d')](function(_0x12d443){if(_0x12d443[_0xf222('0x16')]){if(_0x12d443[_0xf222('0x16')][_0xf222('0x1e')]===0x1f4){return _0x51b872(_0x12d443[_0xf222('0x16')]['message']);}return _0x151a89(_0x12d443[_0xf222('0x16')][_0xf222('0x1f')]);}else{_0x151a89(_0x12d443[_0xf222('0x20')]);}})[_0xf222('0x21')](function(_0x4305e0){_0x51b872(_0x4305e0);});});}function getAgent(_0x3e2a1c){return db[_0xf222('0x22')][_0xf222('0x23')]({'where':{'id':_0x3e2a1c,'role':_0xf222('0x24')}})[_0xf222('0x1d')](checkError());}function getAgentCheckSession(_0x2a8310,_0x501f8e){return new BPromise(function(_0x14b2b1,_0x1c5cd3){var _0x3d5508=respondWithRpcPromise(_0xf222('0x25'));var _0xe41039=getAgent(_0x2a8310);Promise[_0xf222('0x26')]([_0x3d5508,_0xe41039])[_0xf222('0x1d')](function(_0x1b928b){var _0x1e87ec=_0x1b928b[0x0];var _0x59721a=_0x1b928b[0x1];var _0x3bdf98=_[_0xf222('0x27')](_0x1e87ec[_0xf222('0x28')],function(_0x53a382){return _0x53a382[_0xf222('0x29')]==_0x59721a['id']&&_0x53a382['sessionId']==_0x501f8e;});if(_0x3bdf98[_0xf222('0x2a')]==0x1){_0x14b2b1(_0x59721a);}else{_0x1c5cd3(new RangeError(_0xf222('0x2b')+_0x501f8e+_0xf222('0x2c')));}});});}exports[_0xf222('0x2d')]=function(_0x37b4f7,_0x152d79){logger[_0xf222('0x12')]('originate\x20fired:',_0x37b4f7['body']);var _0x439c2f=originateValidation[_0xf222('0x2e')](_0x37b4f7[_0xf222('0x2f')]);if(_0x439c2f[_0xf222('0x2a')]>0x0){return _0x152d79[_0xf222('0x19')](0x190)[_0xf222('0x30')](_0x439c2f);}var _0x4e6a5e=_0x37b4f7[_0xf222('0x2f')][_0xf222('0x31')];var _0x13324a=_0x37b4f7['body'][_0xf222('0x32')];var _0x22ca97=_0x37b4f7[_0xf222('0x2f')]['callerId'];var _0x226d84=_0x37b4f7[_0xf222('0x2f')][_0xf222('0x33')];return getAgent(_0x4e6a5e)['then'](function(_0x3acea1){logger[_0xf222('0x12')](_0xf222('0x34'),_0x3acea1[_0xf222('0x18')]);emit(util[_0xf222('0x35')]('user:%s',_0x3acea1[_0xf222('0x18')]),'webbar:originate',{'callNumber':_0x13324a,'callerId':_0x22ca97,'callbackUrl':_0x226d84});return _0x152d79[_0xf222('0x19')](0xc8)[_0xf222('0x30')]({'error':![],'message':_0xf222('0x36')});})['catch'](handleError(_0x152d79));};exports[_0xf222('0x37')]=function(_0x3d70b0,_0x54a10d){logger[_0xf222('0x12')]('hangup\x20fired:',_0x3d70b0[_0xf222('0x2f')]);var _0x1b2f78=hangupValidation[_0xf222('0x2e')](_0x3d70b0['body']);if(_0x1b2f78[_0xf222('0x2a')]>0x0){return _0x54a10d[_0xf222('0x19')](0x190)[_0xf222('0x30')](_0x1b2f78);}var _0x2cacca=_0x3d70b0[_0xf222('0x2f')][_0xf222('0x31')];var _0x51154b=_0x3d70b0[_0xf222('0x2f')][_0xf222('0x38')];return getAgent(_0x2cacca)['then'](function(_0x49cad2){logger[_0xf222('0x12')]('entityFound:',_0x49cad2[_0xf222('0x18')]);emit(util[_0xf222('0x35')](_0xf222('0x39'),_0x49cad2[_0xf222('0x18')]),'webbar:hangup',{'sessionId':_0x51154b});return _0x54a10d['status'](0xc8)[_0xf222('0x30')]({'error':![],'message':'hangup\x20executed!'});})['catch'](handleError(_0x54a10d));};exports[_0xf222('0x3a')]=function(_0x278fb8,_0x153597){logger[_0xf222('0x12')](_0xf222('0x3b'),_0x278fb8[_0xf222('0x2f')]);var _0x5c60e6=answerValidation[_0xf222('0x2e')](_0x278fb8[_0xf222('0x2f')]);if(_0x5c60e6['length']>0x0){return _0x153597[_0xf222('0x19')](0x190)[_0xf222('0x30')](_0x5c60e6);}var _0x56a5f0=_0x278fb8[_0xf222('0x2f')]['userId'];var _0x149589=_0x278fb8[_0xf222('0x2f')][_0xf222('0x38')];return getAgent(_0x56a5f0)[_0xf222('0x1d')](function(_0x3a3185){logger[_0xf222('0x12')](_0xf222('0x34'),_0x3a3185[_0xf222('0x18')]);emit(util[_0xf222('0x35')](_0xf222('0x39'),_0x3a3185[_0xf222('0x18')]),'webbar:answer',{'sessionId':_0x149589});return _0x153597['status'](0xc8)['json']({'error':![],'message':_0xf222('0x3c')});})[_0xf222('0x21')](handleError(_0x153597));};exports[_0xf222('0x3d')]=function(_0x3cf89b,_0x5a0763){logger[_0xf222('0x12')](_0xf222('0x3e'),_0x3cf89b[_0xf222('0x2f')]);var _0x2841a2=holdValidation['validate'](_0x3cf89b[_0xf222('0x2f')]);if(_0x2841a2[_0xf222('0x2a')]>0x0){return _0x5a0763[_0xf222('0x19')](0x190)[_0xf222('0x30')](_0x2841a2);}var _0x1d60e5=_0x3cf89b[_0xf222('0x2f')][_0xf222('0x31')];var _0x7a8ea9=_0x3cf89b[_0xf222('0x2f')][_0xf222('0x38')];return getAgent(_0x1d60e5)['then'](function(_0x5d0d70){logger[_0xf222('0x12')]('entityFound:',_0x5d0d70[_0xf222('0x18')]);emit(util['format'](_0xf222('0x39'),_0x5d0d70['name']),_0xf222('0x3f'),{'sessionId':_0x7a8ea9});return _0x5a0763[_0xf222('0x19')](0xc8)[_0xf222('0x30')]({'error':![],'message':_0xf222('0x40')});})['catch'](handleError(_0x5a0763));};exports[_0xf222('0x41')]=function(_0x34fd50,_0x380642){logger[_0xf222('0x12')](_0xf222('0x42'),_0x34fd50[_0xf222('0x2f')]);var _0xe3809c=unholdValidation[_0xf222('0x2e')](_0x34fd50[_0xf222('0x2f')]);if(_0xe3809c[_0xf222('0x2a')]>0x0){return _0x380642[_0xf222('0x19')](0x190)[_0xf222('0x30')](_0xe3809c);}var _0x4aa98c=_0x34fd50['body'][_0xf222('0x31')];var _0x28c5d1=_0x34fd50[_0xf222('0x2f')][_0xf222('0x38')];return getAgent(_0x4aa98c)[_0xf222('0x1d')](function(_0x1be64c){logger[_0xf222('0x12')](_0xf222('0x34'),_0x1be64c[_0xf222('0x18')]);emit(util[_0xf222('0x35')](_0xf222('0x39'),_0x1be64c['name']),'webbar:unhold',{'sessionId':_0x28c5d1});return _0x380642[_0xf222('0x19')](0xc8)[_0xf222('0x30')]({'error':![],'message':_0xf222('0x43')});})[_0xf222('0x21')](handleError(_0x380642));};exports[_0xf222('0x44')]=function(_0x6eb194,_0x22bc07){logger[_0xf222('0x12')](_0xf222('0x45'),_0x22bc07[_0xf222('0x2f')]);var _0x32ec77=callsValidation[_0xf222('0x2e')](_0x6eb194[_0xf222('0x2f')]);if(_0x32ec77[_0xf222('0x2a')]>0x0){return _0x22bc07['status'](0x190)[_0xf222('0x30')](_0x32ec77);}var _0x5ee917=_0x6eb194[_0xf222('0x2f')][_0xf222('0x31')];var _0x2c9222=respondWithRpcPromise(_0xf222('0x25'));var _0x5dc3fa=getAgent(_0x5ee917);return Promise['all']([_0x2c9222,_0x5dc3fa])[_0xf222('0x1d')](function(_0x2fc98a){var _0x29eaa9=_0x2fc98a[0x0];var _0xd092fc=_0x2fc98a[0x1];var _0x356746=_['filter'](_0x29eaa9[_0xf222('0x28')],function(_0x497994){return _0x497994[_0xf222('0x29')]==_0xd092fc['id'];});return _0x22bc07[_0xf222('0x19')](0xc8)['json']({'count':_0x356746[_0xf222('0x2a')],'rows':_0x356746});})['catch'](handleError(_0x22bc07));};exports[_0xf222('0x46')]=function(_0x2b6181,_0x41469e){logger['info'](_0xf222('0x47'),_0x2b6181[_0xf222('0x2f')]);var _0x434e8e=conferenceValidation[_0xf222('0x2e')](_0x2b6181[_0xf222('0x2f')]);if(_0x434e8e[_0xf222('0x2a')]>0x0){return _0x41469e[_0xf222('0x19')](0x190)['json'](_0x434e8e);}var _0x286355=_0x2b6181[_0xf222('0x2f')]['userId'];return getAgent(_0x286355)['then'](function(_0x5befb8){logger[_0xf222('0x12')](_0xf222('0x34'),_0x5befb8[_0xf222('0x18')]);emit(util[_0xf222('0x35')]('user:%s',_0x5befb8[_0xf222('0x18')]),'webbar:conference');return _0x41469e[_0xf222('0x19')](0xc8)[_0xf222('0x30')]({'error':![],'message':_0xf222('0x48')});})[_0xf222('0x21')](handleError(_0x41469e));};exports[_0xf222('0x49')]=function(_0x369b85,_0x3bb273){logger[_0xf222('0x12')](_0xf222('0x4a'),_0x369b85['body']);var _0x4e7d09=transferValidation[_0xf222('0x2e')](_0x369b85['body']);if(_0x4e7d09[_0xf222('0x2a')]>0x0){return _0x3bb273[_0xf222('0x19')](0x190)[_0xf222('0x30')](_0x4e7d09);}var _0x5e14f1=_0x369b85[_0xf222('0x2f')]['userId'];var _0x3dbda2=_0x369b85[_0xf222('0x2f')][_0xf222('0x38')];var _0x476655=_0x369b85['body'][_0xf222('0x4b')];return getAgent(_0x5e14f1)[_0xf222('0x1d')](function(_0x3c6cda){logger[_0xf222('0x12')](_0xf222('0x34'),_0x3c6cda[_0xf222('0x18')]);emit(util[_0xf222('0x35')](_0xf222('0x39'),_0x3c6cda[_0xf222('0x18')]),_0xf222('0x4c'),{'sessionId':_0x3dbda2,'transferNumber':_0x476655});return _0x3bb273['status'](0xc8)[_0xf222('0x30')]({'error':![],'message':_0xf222('0x4d')});})[_0xf222('0x21')](handleError(_0x3bb273));}; \ No newline at end of file +var _0xb43b=['ioredis','redis','validate','number','userId\x20is\x20required','string','info','stringify','emit','log','error','name','status','send','NotFound','request','then','code','message','result','User','VoiceChannels','filter','rows','UserId','sessionId','length','\x20not\x20found!','originate','originate\x20fired:','body','userId','callNumber','callbackUrl','entityFound:','format','json','originate\x20executed!','catch','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','user:%s','answer\x20executed!','hold','hold\x20fired:','webbar:hold','calls','calls\x20fired:','all','conference','webbar:conference','conference\x20executed!','transfer','transferNumber','webbar:transfer','path','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi'];(function(_0x4e4c0f,_0x2b0221){var _0x54e512=function(_0x28abc5){while(--_0x28abc5){_0x4e4c0f['push'](_0x4e4c0f['shift']());}};_0x54e512(++_0x2b0221);}(_0xb43b,0xbf));var _0xbb43=function(_0x45077b,_0x540a3f){_0x45077b=_0x45077b-0x0;var _0x1249af=_0xb43b[_0x45077b];return _0x1249af;};'use strict';var path=require(_0xbb43('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0xbb43('0x1'))['db'];var config=require(_0xbb43('0x2'));var util=require(_0xbb43('0x3'));var BPromise=require(_0xbb43('0x4'));var jayson=require(_0xbb43('0x5'));var amiClient=jayson[_0xbb43('0x6')][_0xbb43('0x7')]({'port':0x232a});var logger=require(_0xbb43('0x8'))(_0xbb43('0x9'));var Redis=require(_0xbb43('0xa'));config[_0xbb43('0xb')]=_['defaults'](config[_0xbb43('0xb')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbb43('0xb')]));var Schema=require(_0xbb43('0xc'));var originateValidation=new Schema({'userId':{'type':_0xbb43('0xd'),'required':[!![],_0xbb43('0xe')]},'callNumber':{'type':_0xbb43('0xf'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0xbb43('0xf')},'callbackUrl':{'type':_0xbb43('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0xbb43('0xd'),'required':[!![],_0xbb43('0xe')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0xbb43('0xd'),'required':[!![],_0xbb43('0xe')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xbb43('0xf'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xbb43('0xf'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0xbb43('0xd'),'required':[!![],_0xbb43('0xe')]},'sessionId':{'type':_0xbb43('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xbb43('0xd'),'required':[!![],_0xbb43('0xe')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xbb43('0xd'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0xbb43('0xd'),'required':[!![],_0xbb43('0xe')]}});function emit(_0x15182b,_0x10c91b,_0x3be44b){logger[_0xbb43('0x10')](_0x15182b,_0x10c91b,JSON[_0xbb43('0x11')](_0x3be44b));io['to'](_0x15182b)[_0xbb43('0x12')](_0x10c91b,_0x3be44b);}function handleError(_0x20b839){return function(_0x4c223b){console[_0xbb43('0x13')]('handleError:',_0x4c223b,_0x4c223b instanceof RangeError);logger[_0xbb43('0x14')](_0x4c223b['stack']);if(_0x4c223b instanceof RangeError){if(_0x4c223b[_0xbb43('0x15')]){delete _0x4c223b[_0xbb43('0x15')];}_0x20b839[_0xbb43('0x16')](0x194)[_0xbb43('0x17')](_0x4c223b);}else{if(_0x4c223b['name']){delete _0x4c223b[_0xbb43('0x15')];}_0x20b839[_0xbb43('0x16')](0x1f4)[_0xbb43('0x17')](_0x4c223b);}};}function checkError(){return function(_0x6f34d6){if(!_0x6f34d6){throw new RangeError(_0xbb43('0x18'));}return _0x6f34d6;};}function respondWithRpcPromise(_0x57fc97,_0xee1084){return new BPromise(function(_0x1e83cd,_0x3409d0){var _0x3cb6d1=amiClient;return _0x3cb6d1[_0xbb43('0x19')](_0x57fc97,_0xee1084)[_0xbb43('0x1a')](function(_0x36992f){if(_0x36992f[_0xbb43('0x14')]){if(_0x36992f['error'][_0xbb43('0x1b')]===0x1f4){return _0x3409d0(_0x36992f[_0xbb43('0x14')]['message']);}return _0x1e83cd(_0x36992f[_0xbb43('0x14')][_0xbb43('0x1c')]);}else{_0x1e83cd(_0x36992f[_0xbb43('0x1d')]);}})['catch'](function(_0x4ea4c5){_0x3409d0(_0x4ea4c5);});});}function getAgent(_0x20f223){return db[_0xbb43('0x1e')]['findOne']({'where':{'id':_0x20f223,'role':'agent'}})[_0xbb43('0x1a')](checkError());}function getAgentCheckSession(_0xb9fe3b,_0x268fb5){return new BPromise(function(_0x4bb859,_0x27bb65){var _0x426cec=respondWithRpcPromise(_0xbb43('0x1f'));var _0x1a6e2b=getAgent(_0xb9fe3b);Promise['all']([_0x426cec,_0x1a6e2b])[_0xbb43('0x1a')](function(_0x170e7a){var _0x821beb=_0x170e7a[0x0];var _0x293d66=_0x170e7a[0x1];var _0x34b679=_[_0xbb43('0x20')](_0x821beb[_0xbb43('0x21')],function(_0x48986d){return _0x48986d[_0xbb43('0x22')]==_0x293d66['id']&&_0x48986d[_0xbb43('0x23')]==_0x268fb5;});if(_0x34b679[_0xbb43('0x24')]==0x1){_0x4bb859(_0x293d66);}else{_0x27bb65(new RangeError('sessionId\x20'+_0x268fb5+_0xbb43('0x25')));}});});}exports[_0xbb43('0x26')]=function(_0x9384d8,_0x168374){logger[_0xbb43('0x10')](_0xbb43('0x27'),_0x9384d8[_0xbb43('0x28')]);var _0xa86300=originateValidation[_0xbb43('0xc')](_0x9384d8['body']);if(_0xa86300['length']>0x0){return _0x168374['status'](0x190)['json'](_0xa86300);}var _0x352249=_0x9384d8[_0xbb43('0x28')][_0xbb43('0x29')];var _0xe5d75b=_0x9384d8[_0xbb43('0x28')][_0xbb43('0x2a')];var _0x3c8758=_0x9384d8[_0xbb43('0x28')]['callerId'];var _0x1cf664=_0x9384d8[_0xbb43('0x28')][_0xbb43('0x2b')];return getAgent(_0x352249)[_0xbb43('0x1a')](function(_0x4c65d0){logger[_0xbb43('0x10')](_0xbb43('0x2c'),_0x4c65d0[_0xbb43('0x15')]);emit(util[_0xbb43('0x2d')]('user:%s',_0x4c65d0[_0xbb43('0x15')]),'webbar:originate',{'callNumber':_0xe5d75b,'callerId':_0x3c8758,'callbackUrl':_0x1cf664});return _0x168374[_0xbb43('0x16')](0xc8)[_0xbb43('0x2e')]({'error':![],'message':_0xbb43('0x2f')});})[_0xbb43('0x30')](handleError(_0x168374));};exports[_0xbb43('0x31')]=function(_0x1c1f8b,_0x316ab1){logger[_0xbb43('0x10')](_0xbb43('0x32'),_0x1c1f8b[_0xbb43('0x28')]);var _0xfeaa38=hangupValidation[_0xbb43('0xc')](_0x1c1f8b['body']);if(_0xfeaa38[_0xbb43('0x24')]>0x0){return _0x316ab1[_0xbb43('0x16')](0x190)[_0xbb43('0x2e')](_0xfeaa38);}var _0x2db230=_0x1c1f8b[_0xbb43('0x28')][_0xbb43('0x29')];var _0x21e03d=_0x1c1f8b[_0xbb43('0x28')][_0xbb43('0x23')];return getAgent(_0x2db230)[_0xbb43('0x1a')](function(_0x1fe204){logger[_0xbb43('0x10')](_0xbb43('0x2c'),_0x1fe204[_0xbb43('0x15')]);emit(util[_0xbb43('0x2d')]('user:%s',_0x1fe204[_0xbb43('0x15')]),_0xbb43('0x33'),{'sessionId':_0x21e03d});return _0x316ab1[_0xbb43('0x16')](0xc8)[_0xbb43('0x2e')]({'error':![],'message':_0xbb43('0x34')});})[_0xbb43('0x30')](handleError(_0x316ab1));};exports['answer']=function(_0x13e9f7,_0x448c6f){logger['info']('answer\x20fired:',_0x13e9f7[_0xbb43('0x28')]);var _0x1eb63f=answerValidation[_0xbb43('0xc')](_0x13e9f7[_0xbb43('0x28')]);if(_0x1eb63f[_0xbb43('0x24')]>0x0){return _0x448c6f['status'](0x190)['json'](_0x1eb63f);}var _0x2ea37b=_0x13e9f7[_0xbb43('0x28')][_0xbb43('0x29')];var _0x2d1256=_0x13e9f7[_0xbb43('0x28')][_0xbb43('0x23')];return getAgent(_0x2ea37b)[_0xbb43('0x1a')](function(_0x1d8993){logger[_0xbb43('0x10')](_0xbb43('0x2c'),_0x1d8993['name']);emit(util['format'](_0xbb43('0x35'),_0x1d8993[_0xbb43('0x15')]),'webbar:answer',{'sessionId':_0x2d1256});return _0x448c6f[_0xbb43('0x16')](0xc8)[_0xbb43('0x2e')]({'error':![],'message':_0xbb43('0x36')});})[_0xbb43('0x30')](handleError(_0x448c6f));};exports[_0xbb43('0x37')]=function(_0x1fcb16,_0x3976f1){logger['info'](_0xbb43('0x38'),_0x1fcb16[_0xbb43('0x28')]);var _0x5970cc=holdValidation[_0xbb43('0xc')](_0x1fcb16[_0xbb43('0x28')]);if(_0x5970cc['length']>0x0){return _0x3976f1[_0xbb43('0x16')](0x190)[_0xbb43('0x2e')](_0x5970cc);}var _0xd1f32b=_0x1fcb16[_0xbb43('0x28')][_0xbb43('0x29')];var _0x43a840=_0x1fcb16[_0xbb43('0x28')][_0xbb43('0x23')];return getAgent(_0xd1f32b)[_0xbb43('0x1a')](function(_0x2f044f){logger[_0xbb43('0x10')](_0xbb43('0x2c'),_0x2f044f['name']);emit(util[_0xbb43('0x2d')](_0xbb43('0x35'),_0x2f044f[_0xbb43('0x15')]),_0xbb43('0x39'),{'sessionId':_0x43a840});return _0x3976f1['status'](0xc8)[_0xbb43('0x2e')]({'error':![],'message':'hold\x20executed!'});})[_0xbb43('0x30')](handleError(_0x3976f1));};exports['unhold']=function(_0x21f78b,_0x322a77){logger[_0xbb43('0x10')]('unhold\x20fired:',_0x21f78b[_0xbb43('0x28')]);var _0x218da6=unholdValidation[_0xbb43('0xc')](_0x21f78b['body']);if(_0x218da6[_0xbb43('0x24')]>0x0){return _0x322a77[_0xbb43('0x16')](0x190)['json'](_0x218da6);}var _0x42029c=_0x21f78b['body'][_0xbb43('0x29')];var _0x476116=_0x21f78b['body'][_0xbb43('0x23')];return getAgent(_0x42029c)[_0xbb43('0x1a')](function(_0x349390){logger['info'](_0xbb43('0x2c'),_0x349390['name']);emit(util[_0xbb43('0x2d')](_0xbb43('0x35'),_0x349390[_0xbb43('0x15')]),'webbar:unhold',{'sessionId':_0x476116});return _0x322a77[_0xbb43('0x16')](0xc8)[_0xbb43('0x2e')]({'error':![],'message':'unhold\x20executed!'});})['catch'](handleError(_0x322a77));};exports[_0xbb43('0x3a')]=function(_0x9e3707,_0x5b7b39){logger['info'](_0xbb43('0x3b'),_0x5b7b39['body']);var _0x30908e=callsValidation[_0xbb43('0xc')](_0x9e3707[_0xbb43('0x28')]);if(_0x30908e['length']>0x0){return _0x5b7b39['status'](0x190)['json'](_0x30908e);}var _0x55cb63=_0x9e3707['body'][_0xbb43('0x29')];var _0x31d265=respondWithRpcPromise(_0xbb43('0x1f'));var _0x4024bb=getAgent(_0x55cb63);return Promise[_0xbb43('0x3c')]([_0x31d265,_0x4024bb])['then'](function(_0x19e8b7){var _0x529455=_0x19e8b7[0x0];var _0x6e7c04=_0x19e8b7[0x1];var _0x4b5e4b=_[_0xbb43('0x20')](_0x529455[_0xbb43('0x21')],function(_0x132b98){return _0x132b98[_0xbb43('0x22')]==_0x6e7c04['id'];});return _0x5b7b39['status'](0xc8)[_0xbb43('0x2e')]({'count':_0x4b5e4b['length'],'rows':_0x4b5e4b});})[_0xbb43('0x30')](handleError(_0x5b7b39));};exports[_0xbb43('0x3d')]=function(_0x512619,_0x1b69ab){logger[_0xbb43('0x10')]('conference\x20fired:',_0x512619[_0xbb43('0x28')]);var _0x13e1e3=conferenceValidation[_0xbb43('0xc')](_0x512619[_0xbb43('0x28')]);if(_0x13e1e3[_0xbb43('0x24')]>0x0){return _0x1b69ab[_0xbb43('0x16')](0x190)[_0xbb43('0x2e')](_0x13e1e3);}var _0x161556=_0x512619['body'][_0xbb43('0x29')];return getAgent(_0x161556)['then'](function(_0x36a69b){logger[_0xbb43('0x10')]('entityFound:',_0x36a69b[_0xbb43('0x15')]);emit(util[_0xbb43('0x2d')](_0xbb43('0x35'),_0x36a69b[_0xbb43('0x15')]),_0xbb43('0x3e'));return _0x1b69ab[_0xbb43('0x16')](0xc8)[_0xbb43('0x2e')]({'error':![],'message':_0xbb43('0x3f')});})['catch'](handleError(_0x1b69ab));};exports[_0xbb43('0x40')]=function(_0x21260c,_0x12f96c){logger[_0xbb43('0x10')]('transfer\x20fired:',_0x21260c[_0xbb43('0x28')]);var _0x5d73a5=transferValidation[_0xbb43('0xc')](_0x21260c['body']);if(_0x5d73a5[_0xbb43('0x24')]>0x0){return _0x12f96c[_0xbb43('0x16')](0x190)[_0xbb43('0x2e')](_0x5d73a5);}var _0x265d2d=_0x21260c[_0xbb43('0x28')][_0xbb43('0x29')];var _0x349699=_0x21260c[_0xbb43('0x28')][_0xbb43('0x23')];var _0x32483f=_0x21260c['body'][_0xbb43('0x41')];return getAgent(_0x265d2d)['then'](function(_0x1b9280){logger[_0xbb43('0x10')](_0xbb43('0x2c'),_0x1b9280[_0xbb43('0x15')]);emit(util[_0xbb43('0x2d')](_0xbb43('0x35'),_0x1b9280[_0xbb43('0x15')]),_0xbb43('0x42'),{'sessionId':_0x349699,'transferNumber':_0x32483f});return _0x12f96c['status'](0xc8)[_0xbb43('0x2e')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0x12f96c));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index cf7e191..4bdd6db 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 _0x66fa=['/:id','update','delete','destroy','removeDispositions','removeAnswers','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','post','/:id/dispositions','addDisposition','addAgents','/:id/notify','notify','/:id/send','send','put'];(function(_0x15a119,_0xe3bf9d){var _0x29aa04=function(_0x1827bc){while(--_0x1827bc){_0x15a119['push'](_0x15a119['shift']());}};_0x29aa04(++_0xe3bf9d);}(_0x66fa,0x117));var _0xa66f=function(_0x406e01,_0xa70706){_0x406e01=_0x406e01-0x0;var _0x130e10=_0x66fa[_0x406e01];return _0x130e10;};'use strict';var multer=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var path=require('path');var timeout=require(_0xa66f('0x2'));var express=require(_0xa66f('0x3'));var router=express[_0xa66f('0x4')]();var fs_extra=require(_0xa66f('0x5'));var auth=require(_0xa66f('0x6'));var interaction=require(_0xa66f('0x7'));var config=require(_0xa66f('0x8'));var controller=require('./whatsappAccount.controller');router['get']('/',auth[_0xa66f('0x9')](),controller[_0xa66f('0xa')]);router[_0xa66f('0xb')](_0xa66f('0xc'),auth[_0xa66f('0x9')](),controller['describe']);router[_0xa66f('0xb')]('/:id',auth[_0xa66f('0x9')](),controller['show']);router[_0xa66f('0xb')]('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router[_0xa66f('0xb')](_0xa66f('0xd'),auth['isAuthenticated'](),controller[_0xa66f('0xe')]);router['get'](_0xa66f('0xf'),auth['isAuthenticated'](),controller[_0xa66f('0x10')]);router[_0xa66f('0xb')](_0xa66f('0x11'),auth['isAuthenticated'](),controller['getApplications']);router[_0xa66f('0x12')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xa66f('0x13'),auth[_0xa66f('0x9')](),controller[_0xa66f('0x14')]);router[_0xa66f('0x12')](_0xa66f('0xd'),auth['isAuthenticated'](),controller['addAnswer']);router[_0xa66f('0x12')](_0xa66f('0xf'),auth[_0xa66f('0x9')](),controller[_0xa66f('0x15')]);router['post'](_0xa66f('0x11'),auth['isAuthenticated'](),controller['addApplications']);router[_0xa66f('0x12')](_0xa66f('0x16'),controller[_0xa66f('0x17')]);router[_0xa66f('0x12')](_0xa66f('0x18'),auth[_0xa66f('0x9')](),controller[_0xa66f('0x19')]);router[_0xa66f('0x1a')](_0xa66f('0x1b'),auth[_0xa66f('0x9')](),controller[_0xa66f('0x1c')]);router[_0xa66f('0x1d')](_0xa66f('0x1b'),auth[_0xa66f('0x9')](),controller[_0xa66f('0x1e')]);router['delete'](_0xa66f('0x13'),auth[_0xa66f('0x9')](),controller[_0xa66f('0x1f')]);router[_0xa66f('0x1d')]('/:id/canned_answers',auth[_0xa66f('0x9')](),controller[_0xa66f('0x20')]);router[_0xa66f('0x1d')](_0xa66f('0xf'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xa66f('0x21')]=router; \ No newline at end of file +var _0x2a07=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getAgents','/:id/applications','getApplications','post','addDisposition','addAnswer','/:id/users','addAgents','addApplications','/:id/notify','notify','/:id/send','send','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout'];(function(_0x1c925e,_0x4fa658){var _0xa0982e=function(_0x288af1){while(--_0x288af1){_0x1c925e['push'](_0x1c925e['shift']());}};_0xa0982e(++_0x4fa658);}(_0x2a07,0x74));var _0x72a0=function(_0x3396cd,_0x4047f0){_0x3396cd=_0x3396cd-0x0;var _0x2d6b4a=_0x2a07[_0x3396cd];return _0x2d6b4a;};'use strict';var multer=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var path=require(_0x72a0('0x2'));var timeout=require(_0x72a0('0x3'));var express=require(_0x72a0('0x4'));var router=express['Router']();var fs_extra=require(_0x72a0('0x5'));var auth=require(_0x72a0('0x6'));var interaction=require(_0x72a0('0x7'));var config=require(_0x72a0('0x8'));var controller=require(_0x72a0('0x9'));router[_0x72a0('0xa')]('/',auth[_0x72a0('0xb')](),controller[_0x72a0('0xc')]);router[_0x72a0('0xa')](_0x72a0('0xd'),auth[_0x72a0('0xb')](),controller[_0x72a0('0xe')]);router[_0x72a0('0xa')](_0x72a0('0xf'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x10')]);router['get'](_0x72a0('0x11'),auth[_0x72a0('0xb')](),controller['getDispositions']);router[_0x72a0('0xa')](_0x72a0('0x12'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x13')]);router[_0x72a0('0xa')]('/:id/users',auth[_0x72a0('0xb')](),controller[_0x72a0('0x14')]);router[_0x72a0('0xa')](_0x72a0('0x15'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x16')]);router[_0x72a0('0x17')]('/',auth['isAuthenticated'](),controller['create']);router[_0x72a0('0x17')](_0x72a0('0x11'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x18')]);router[_0x72a0('0x17')](_0x72a0('0x12'),auth['isAuthenticated'](),controller[_0x72a0('0x19')]);router[_0x72a0('0x17')](_0x72a0('0x1a'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x1b')]);router['post'](_0x72a0('0x15'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x1c')]);router['post'](_0x72a0('0x1d'),controller[_0x72a0('0x1e')]);router[_0x72a0('0x17')](_0x72a0('0x1f'),auth['isAuthenticated'](),controller[_0x72a0('0x20')]);router['put'](_0x72a0('0xf'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x21')]);router['delete'](_0x72a0('0xf'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x22')]);router[_0x72a0('0x23')]('/:id/dispositions',auth[_0x72a0('0xb')](),controller[_0x72a0('0x24')]);router[_0x72a0('0x23')](_0x72a0('0x12'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x25')]);router['delete']('/:id/users',auth[_0x72a0('0xb')](),controller[_0x72a0('0x26')]);module[_0x72a0('0x27')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 0be7b7a..dcd0e66 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 _0x71e4=['sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','twilio'];(function(_0x429189,_0x58eee6){var _0x21b685=function(_0x54f958){while(--_0x54f958){_0x429189['push'](_0x429189['shift']());}};_0x21b685(++_0x58eee6);}(_0x71e4,0x1da));var _0x471e=function(_0x1fb6e2,_0x3a22ce){_0x1fb6e2=_0x1fb6e2-0x0;var _0x354690=_0x71e4[_0x1fb6e2];return _0x354690;};'use strict';var Sequelize=require(_0x471e('0x0'));var rs=require('randomstring');module[_0x471e('0x1')]={'name':{'type':Sequelize[_0x471e('0x2')],'unique':_0x471e('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x471e('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x471e('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x471e('0x2')]},'type':{'type':Sequelize[_0x471e('0x4')](_0x471e('0x5'),_0x471e('0x6'))},'accountSid':{'type':Sequelize[_0x471e('0x2')]},'baseUrl':{'type':Sequelize[_0x471e('0x2')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x471e('0x7')],'defaultValue':function(){return _0x471e('0x8');}},'notificationSound':{'type':Sequelize[_0x471e('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x471e('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x471e('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x471e('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x471e('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x471e('0xb'),'set':function(_0xb5387f){if(!_0xb5387f){this[_0x471e('0xc')](_0x471e('0xd'),null);}this['setDataValue'](_0x471e('0xe'),_0xb5387f);}},'description':{'type':Sequelize[_0x471e('0x2')]}}; \ No newline at end of file +var _0x5145=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','STRING','name','generate','ENUM','twilio','sinch','TEXT','BOOLEAN','INTEGER'];(function(_0xb6b9f,_0x542f73){var _0x44ac2c=function(_0x3dd8f9){while(--_0x3dd8f9){_0xb6b9f['push'](_0xb6b9f['shift']());}};_0x44ac2c(++_0x542f73);}(_0x5145,0x130));var _0x5514=function(_0x2e7e02,_0x56b9b5){_0x2e7e02=_0x2e7e02-0x0;var _0x148e4c=_0x5145[_0x2e7e02];return _0x148e4c;};'use strict';var Sequelize=require(_0x5514('0x0'));var rs=require(_0x5514('0x1'));module['exports']={'name':{'type':Sequelize[_0x5514('0x2')],'unique':_0x5514('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x5514('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x5514('0x2')],'defaultValue':function(){return rs[_0x5514('0x4')]();}},'phone':{'type':Sequelize[_0x5514('0x2')]},'type':{'type':Sequelize[_0x5514('0x5')](_0x5514('0x6'),_0x5514('0x7'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0x5514('0x2')]},'authToken':{'type':Sequelize[_0x5514('0x2')]},'notificationTemplate':{'type':Sequelize[_0x5514('0x8')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x5514('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x5514('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5514('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5514('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5514('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5514('0xa')],'comment':_0x5514('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x5514('0x9')],'defaultValue':![],'comment':_0x5514('0xc'),'set':function(_0x59d566){if(!_0x59d566){this[_0x5514('0xd')](_0x5514('0xe'),null);}this[_0x5514('0xd')]('mandatoryDisposition',_0x59d566);}},'description':{'type':Sequelize[_0x5514('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 0871fd7..12aa4a7 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 _0x75a2=['map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','includeAll','include','rows','show','params','options','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','findOne','rawAttributes','pick','where','findAll','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','addAgents','omit','spread','userWhatsappAccount:save','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','User','sequelize','transaction','Transaction','ISOLATION_LEVELS','WhatsappApplication','findAndCountAll','priority','getApplications','Applications','account','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','mobile','twilio','from','From','whatsapp:','messageId','MessageSid','sinch','notifications','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','list','contact','WhatsappInteraction','interaction','created','autoclose','close','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','agent','Start','entity\x20found','Content-Type','text/xml','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','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','redis','defaults','localhost','./whatsappAccount.socket','register','client','http','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','status','end','limit','count','offset','set','Content-Range','json','apply','save','update','destroy','WhatsappAccounts','sendStatus','stack','name','send','Pause','mandatoryDispositionPause','WhatsappAccount','fieldName','type','key','model'];(function(_0x307a07,_0x4abf9a){var _0x501917=function(_0x59d4da){while(--_0x59d4da){_0x307a07['push'](_0x307a07['shift']());}};_0x501917(++_0x4abf9a);}(_0x75a2,0x132));var _0x275a=function(_0x32969b,_0x437513){_0x32969b=_0x32969b-0x0;var _0x39195f=_0x75a2[_0x32969b];return _0x39195f;};'use strict';var emlformat=require(_0x275a('0x0'));var rimraf=require(_0x275a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x275a('0x2'));var moment=require(_0x275a('0x3'));var BPromise=require(_0x275a('0x4'));var Mustache=require('mustache');var util=require(_0x275a('0x5'));var path=require(_0x275a('0x6'));var sox=require(_0x275a('0x7'));var csv=require(_0x275a('0x8'));var ejs=require(_0x275a('0x9'));var fs=require('fs');var fs_extra=require(_0x275a('0xa'));var _=require(_0x275a('0xb'));var squel=require('squel');var crypto=require(_0x275a('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x275a('0xd'));var Papa=require(_0x275a('0xe'));var Redis=require('ioredis');var authService=require(_0x275a('0xf'));var qs=require(_0x275a('0x10'));var as=require(_0x275a('0x11'));var hardwareService=require(_0x275a('0x12'));var logger=require(_0x275a('0x13'))(_0x275a('0x14'));var utils=require(_0x275a('0x15'));var config=require(_0x275a('0x16'));var licenseUtil=require(_0x275a('0x17'));var db=require(_0x275a('0x18'))['db'];config[_0x275a('0x19')]=_[_0x275a('0x1a')](config['redis'],{'host':_0x275a('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x275a('0x19')]));require(_0x275a('0x1c'))[_0x275a('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x275a('0x1e')][_0x275a('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x41a1fd,_0x3fe35d,_0x11b641,_0x1e1a2f){return new BPromise(function(_0x5a6aac,_0x205f55){var _0x51fd80=_0x1e1a2f||client;return _0x51fd80[_0x275a('0x20')](_0x41a1fd,_0x11b641)[_0x275a('0x21')](function(_0x53dc04){logger['info'](_0x275a('0x22'),_0x3fe35d,_0x275a('0x23'));logger[_0x275a('0x24')](_0x275a('0x25'),_0x3fe35d,_0x275a('0x23'),JSON[_0x275a('0x26')](_0x53dc04));if(_0x53dc04[_0x275a('0x27')]){if(_0x53dc04[_0x275a('0x27')][_0x275a('0x28')]===0x1f4){logger[_0x275a('0x27')](_0x275a('0x22'),_0x3fe35d,_0x53dc04['error'][_0x275a('0x29')]);return _0x205f55(_0x53dc04['error'][_0x275a('0x29')]);}logger[_0x275a('0x27')](_0x275a('0x22'),_0x3fe35d,_0x53dc04[_0x275a('0x27')][_0x275a('0x29')]);return _0x5a6aac(_0x53dc04[_0x275a('0x27')][_0x275a('0x29')]);}else{logger[_0x275a('0x2a')](_0x275a('0x22'),_0x3fe35d,'request\x20sent');_0x5a6aac(_0x53dc04['result'][_0x275a('0x29')]);}})[_0x275a('0x2b')](function(_0x23496f){logger[_0x275a('0x27')]('WhatsappAccount,\x20%s,\x20%s',_0x3fe35d,_0x23496f);_0x205f55(_0x23496f);});});}function respondWithStatusCode(_0x2fdc98,_0xf36c05){_0xf36c05=_0xf36c05||0xcc;return function(_0x1cca60){if(_0x1cca60){return _0x2fdc98['sendStatus'](_0xf36c05);}return _0x2fdc98[_0x275a('0x2c')](_0xf36c05)[_0x275a('0x2d')]();};}function respondWithResult(_0x2a7fec,_0x52ebed){_0x52ebed=_0x52ebed||0xc8;return function(_0x25f072){if(_0x25f072){return _0x2a7fec['status'](_0x52ebed)['json'](_0x25f072);}};}function respondWithFilteredResult(_0x5267af,_0x3ee16f){return function(_0x344f86){if(_0x344f86){var _0x3c488d=typeof _0x3ee16f['offset']==='undefined'&&typeof _0x3ee16f[_0x275a('0x2e')]==='undefined';var _0x945afb=_0x344f86[_0x275a('0x2f')];var _0x5ea47=_0x3c488d?0x0:_0x3ee16f['offset'];var _0x19b8ee=_0x3c488d?_0x344f86[_0x275a('0x2f')]:_0x3ee16f[_0x275a('0x30')]+_0x3ee16f[_0x275a('0x2e')];var _0xc5cdae;if(_0x19b8ee>=_0x945afb){_0x19b8ee=_0x945afb;_0xc5cdae=0xc8;}else{_0xc5cdae=0xce;}_0x5267af[_0x275a('0x2c')](_0xc5cdae);return _0x5267af[_0x275a('0x31')](_0x275a('0x32'),_0x5ea47+'-'+_0x19b8ee+'/'+_0x945afb)[_0x275a('0x33')](_0x344f86);}return null;};}function patchUpdates(_0x1cb75a){return function(_0x4dab19){try{jsonpatch[_0x275a('0x34')](_0x4dab19,_0x1cb75a,!![]);}catch(_0x2937b6){return BPromise['reject'](_0x2937b6);}return _0x4dab19[_0x275a('0x35')]();};}function saveUpdates(_0x1e1489,_0x57c7d2){return function(_0x47dc70){if(_0x47dc70){return _0x47dc70[_0x275a('0x36')](_0x1e1489)[_0x275a('0x21')](function(_0x1cbca2){return _0x1cbca2;});}return null;};}function removeEntity(_0x1e79fa,_0xc95260){return function(_0x3e57cd){if(_0x3e57cd){return _0x3e57cd[_0x275a('0x37')]()[_0x275a('0x21')](function(){var _0x35c15b=_0x3e57cd['get']({'plain':!![]});var _0x309e9a=_0x275a('0x38');return db['UserProfileResource'][_0x275a('0x37')]({'where':{'type':_0x309e9a,'resourceId':_0x35c15b['id']}})[_0x275a('0x21')](function(){return _0x3e57cd;});})[_0x275a('0x21')](function(){_0x1e79fa[_0x275a('0x2c')](0xcc)[_0x275a('0x2d')]();});}};}function handleEntityNotFound(_0x28430b,_0x39467a){return function(_0x303996){if(!_0x303996){_0x28430b[_0x275a('0x39')](0x194);}return _0x303996;};}function handleError(_0x4385e7,_0x24ed28){_0x24ed28=_0x24ed28||0x1f4;return function(_0x59a043){logger[_0x275a('0x27')](_0x59a043[_0x275a('0x3a')]);if(_0x59a043[_0x275a('0x3b')]){delete _0x59a043[_0x275a('0x3b')];}_0x4385e7['status'](_0x24ed28)[_0x275a('0x3c')](_0x59a043);};}exports['index']=function(_0x2f6b79,_0x5effa2){var _0x27f736={'include':[{'model':db[_0x275a('0x3d')],'as':_0x275a('0x3e')}]},_0x19d207={},_0x5b5124={'count':0x0,'rows':[]};var _0x1d8f4a=_['map'](db[_0x275a('0x3f')]['rawAttributes'],function(_0x291d22){return{'name':_0x291d22[_0x275a('0x40')],'type':_0x291d22[_0x275a('0x41')][_0x275a('0x42')]};});_0x19d207[_0x275a('0x43')]=_[_0x275a('0x44')](_0x1d8f4a,_0x275a('0x3b'));_0x19d207['query']=_[_0x275a('0x45')](_0x2f6b79[_0x275a('0x46')]);_0x19d207[_0x275a('0x47')]=_[_0x275a('0x48')](_0x19d207['model'],_0x19d207[_0x275a('0x46')]);_0x27f736[_0x275a('0x49')]=_['intersection'](_0x19d207[_0x275a('0x43')],qs[_0x275a('0x4a')](_0x2f6b79['query'][_0x275a('0x4a')]));_0x27f736[_0x275a('0x49')]=_0x27f736[_0x275a('0x49')][_0x275a('0x4b')]?_0x27f736[_0x275a('0x49')]:_0x19d207['model'];if(!_0x2f6b79['query'][_0x275a('0x4c')](_0x275a('0x4d'))){_0x27f736[_0x275a('0x2e')]=qs[_0x275a('0x2e')](_0x2f6b79[_0x275a('0x46')][_0x275a('0x2e')]);_0x27f736[_0x275a('0x30')]=qs[_0x275a('0x30')](_0x2f6b79[_0x275a('0x46')][_0x275a('0x30')]);}_0x27f736[_0x275a('0x4e')]=qs[_0x275a('0x4f')](_0x2f6b79['query'][_0x275a('0x4f')]);_0x27f736['where']=qs[_0x275a('0x47')](_['pick'](_0x2f6b79['query'],_0x19d207[_0x275a('0x47')]),_0x1d8f4a);if(_0x2f6b79[_0x275a('0x46')][_0x275a('0x50')]){_0x27f736['where']=_[_0x275a('0x51')](_0x27f736['where'],{'$or':_[_0x275a('0x44')](_0x1d8f4a,function(_0xacc3a){if(_0xacc3a[_0x275a('0x41')]!=='VIRTUAL'){var _0x4f7ace={};_0x4f7ace[_0xacc3a[_0x275a('0x3b')]]={'$like':'%'+_0x2f6b79[_0x275a('0x46')][_0x275a('0x50')]+'%'};return _0x4f7ace;}})});}_0x27f736=_[_0x275a('0x51')]({},_0x27f736,_0x2f6b79['options']);var _0x2d0a2e={'where':_0x27f736['where']};return db[_0x275a('0x3f')][_0x275a('0x2f')](_0x2d0a2e)[_0x275a('0x21')](function(_0x2f9e99){_0x5b5124[_0x275a('0x2f')]=_0x2f9e99;if(_0x2f6b79[_0x275a('0x46')][_0x275a('0x52')]){_0x27f736[_0x275a('0x53')]=[{'all':!![]}];}return db['WhatsappAccount']['findAll'](_0x27f736);})[_0x275a('0x21')](function(_0x1c5e14){_0x5b5124[_0x275a('0x54')]=_0x1c5e14;return _0x5b5124;})[_0x275a('0x21')](respondWithFilteredResult(_0x5effa2,_0x27f736))[_0x275a('0x2b')](handleError(_0x5effa2,null));};exports[_0x275a('0x55')]=function(_0x599871,_0x5e26a3){var _0x140566={'raw':![],'where':{'id':_0x599871[_0x275a('0x56')]['id']},'include':[{'model':db[_0x275a('0x3d')],'as':_0x275a('0x3e')}]},_0x4b481c={};_0x4b481c[_0x275a('0x43')]=_[_0x275a('0x45')](db[_0x275a('0x3f')]['rawAttributes']);_0x4b481c[_0x275a('0x46')]=_[_0x275a('0x45')](_0x599871['query']);_0x4b481c[_0x275a('0x47')]=_['intersection'](_0x4b481c['model'],_0x4b481c[_0x275a('0x46')]);_0x140566[_0x275a('0x49')]=_[_0x275a('0x48')](_0x4b481c[_0x275a('0x43')],qs[_0x275a('0x4a')](_0x599871[_0x275a('0x46')][_0x275a('0x4a')]));_0x140566[_0x275a('0x49')]=_0x140566[_0x275a('0x49')][_0x275a('0x4b')]?_0x140566[_0x275a('0x49')]:_0x4b481c[_0x275a('0x43')];if(_0x599871[_0x275a('0x46')][_0x275a('0x52')]){_0x140566[_0x275a('0x53')]=[{'all':!![]}];}_0x140566=_[_0x275a('0x51')]({},_0x140566,_0x599871[_0x275a('0x57')]);return db[_0x275a('0x3f')]['find'](_0x140566)[_0x275a('0x21')](handleEntityNotFound(_0x5e26a3,null))['then'](respondWithResult(_0x5e26a3,null))[_0x275a('0x2b')](handleError(_0x5e26a3,null));};exports['create']=function(_0x20b96e,_0x4ef279){return db[_0x275a('0x3f')]['create'](_0x20b96e[_0x275a('0x58')],{})[_0x275a('0x21')](function(_0x297cd1){var _0x31f997=_0x20b96e[_0x275a('0x59')][_0x275a('0x5a')]({'plain':!![]});if(!_0x31f997)throw new Error(_0x275a('0x5b'));if(_0x31f997['role']===_0x275a('0x59')){var _0x20330a=_0x297cd1[_0x275a('0x5a')]({'plain':!![]});var _0x2abb25=_0x275a('0x38');return db['UserProfileSection'][_0x275a('0x5c')]({'where':{'name':_0x2abb25,'userProfileId':_0x31f997['userProfileId']},'raw':!![]})[_0x275a('0x21')](function(_0x4cc478){if(_0x4cc478&&_0x4cc478[_0x275a('0x5d')]===0x0){return db['UserProfileResource'][_0x275a('0x5e')]({'name':_0x20330a[_0x275a('0x3b')],'resourceId':_0x20330a['id'],'type':_0x4cc478['name'],'sectionId':_0x4cc478['id']},{})[_0x275a('0x21')](function(){return _0x297cd1;});}else{return _0x297cd1;}})['catch'](function(_0x4cff0c){logger['error'](_0x275a('0x5f'),_0x4cff0c);throw _0x4cff0c;});}return _0x297cd1;})[_0x275a('0x21')](respondWithResult(_0x4ef279,0xc9))['catch'](handleError(_0x4ef279,null));};exports[_0x275a('0x36')]=function(_0x166bfe,_0x4aab94){if(_0x166bfe[_0x275a('0x58')]['id']){delete _0x166bfe['body']['id'];}return db[_0x275a('0x3f')][_0x275a('0x5c')]({'where':{'id':_0x166bfe[_0x275a('0x56')]['id']},'include':[{'model':db[_0x275a('0x3d')],'as':_0x275a('0x3e')}]})['then'](handleEntityNotFound(_0x4aab94,null))[_0x275a('0x21')](saveUpdates(_0x166bfe[_0x275a('0x58')],null))[_0x275a('0x21')](respondWithResult(_0x4aab94,null))[_0x275a('0x2b')](handleError(_0x4aab94,null));};exports[_0x275a('0x37')]=function(_0x3a7714,_0x3de8fb){return db['WhatsappAccount']['find']({'where':{'id':_0x3a7714[_0x275a('0x56')]['id']}})['then'](handleEntityNotFound(_0x3de8fb,null))[_0x275a('0x21')](removeEntity(_0x3de8fb,null))['catch'](handleError(_0x3de8fb,null));};exports[_0x275a('0x60')]=function(_0x411689,_0x1dc17f){return db[_0x275a('0x3f')]['describe']()['then'](respondWithResult(_0x1dc17f,null))[_0x275a('0x2b')](handleError(_0x1dc17f,null));};exports[_0x275a('0x61')]=function(_0xf21fee,_0x546a9d,_0x41e325){if(_0xf21fee[_0x275a('0x58')]['id']){delete _0xf21fee[_0x275a('0x58')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0xf21fee[_0x275a('0x56')]['id']}})[_0x275a('0x21')](handleEntityNotFound(_0x546a9d,null))['then'](function(_0x3cc45f){if(_0x3cc45f){_0xf21fee[_0x275a('0x58')][_0x275a('0x62')]=_0x3cc45f['id'];return db[_0x275a('0x63')]['create'](_0xf21fee[_0x275a('0x58')]);}})[_0x275a('0x21')](respondWithResult(_0x546a9d,null))['catch'](handleError(_0x546a9d,null));};exports['getDispositions']=function(_0x176947,_0x57df22,_0xce68ae){var _0x1ca5e0={'raw':![],'where':{}};var _0x100b64={};var _0x4e73a9={'count':0x0,'rows':[]};return db[_0x275a('0x3f')][_0x275a('0x64')]({'where':{'id':_0x176947[_0x275a('0x56')]['id']}})[_0x275a('0x21')](handleEntityNotFound(_0x57df22,null))[_0x275a('0x21')](function(_0x4a5e59){if(_0x4a5e59){_0x100b64[_0x275a('0x43')]=_['keys'](db[_0x275a('0x63')][_0x275a('0x65')]);_0x100b64['query']=_[_0x275a('0x45')](_0x176947[_0x275a('0x46')]);_0x100b64[_0x275a('0x47')]=_[_0x275a('0x48')](_0x100b64[_0x275a('0x43')],_0x100b64['query']);_0x1ca5e0[_0x275a('0x49')]=_[_0x275a('0x48')](_0x100b64['model'],qs[_0x275a('0x4a')](_0x176947[_0x275a('0x46')]['fields']));_0x1ca5e0[_0x275a('0x49')]=_0x1ca5e0[_0x275a('0x49')][_0x275a('0x4b')]?_0x1ca5e0['attributes']:_0x100b64[_0x275a('0x43')];if(!_0x176947['query'][_0x275a('0x4c')](_0x275a('0x4d'))){_0x1ca5e0['limit']=qs[_0x275a('0x2e')](_0x176947[_0x275a('0x46')]['limit']);_0x1ca5e0[_0x275a('0x30')]=qs[_0x275a('0x30')](_0x176947[_0x275a('0x46')][_0x275a('0x30')]);}_0x1ca5e0[_0x275a('0x4e')]=qs[_0x275a('0x4f')](_0x176947['query'][_0x275a('0x4f')]);_0x1ca5e0['where']=qs['filters'](_[_0x275a('0x66')](_0x176947['query'],_0x100b64[_0x275a('0x47')]));_0x1ca5e0[_0x275a('0x67')][_0x275a('0x62')]=_0x4a5e59['id'];if(_0x176947[_0x275a('0x46')][_0x275a('0x50')]){_0x1ca5e0[_0x275a('0x67')]=_['merge'](_0x1ca5e0['where'],{'$or':_[_0x275a('0x44')](_0x1ca5e0['attributes'],function(_0x59402d){var _0x6c2113={};_0x6c2113[_0x59402d]={'$like':'%'+_0x176947[_0x275a('0x46')][_0x275a('0x50')]+'%'};return _0x6c2113;})});}_0x1ca5e0=_[_0x275a('0x51')]({},_0x1ca5e0,_0x176947['options']);return db[_0x275a('0x63')][_0x275a('0x2f')]({'where':_0x1ca5e0[_0x275a('0x67')]})['then'](function(_0x32196b){_0x4e73a9[_0x275a('0x2f')]=_0x32196b;if(_0x176947[_0x275a('0x46')][_0x275a('0x52')]){_0x1ca5e0[_0x275a('0x53')]=[{'all':!![]}];}return db[_0x275a('0x63')][_0x275a('0x68')](_0x1ca5e0);})[_0x275a('0x21')](function(_0x1857fd){_0x4e73a9['rows']=_0x1857fd;return _0x4e73a9;});}})['then'](respondWithFilteredResult(_0x57df22,_0x1ca5e0))[_0x275a('0x2b')](handleError(_0x57df22,null));};exports[_0x275a('0x69')]=function(_0x5d12cf,_0x33c052,_0x6bc1ee){return db[_0x275a('0x3f')][_0x275a('0x5c')]({'where':{'id':_0x5d12cf[_0x275a('0x56')]['id']}})[_0x275a('0x21')](handleEntityNotFound(_0x33c052,null))[_0x275a('0x21')](function(_0x50660d){if(_0x50660d){return _0x50660d[_0x275a('0x69')](_0x5d12cf[_0x275a('0x46')]['ids']);}})['then'](respondWithStatusCode(_0x33c052,null))[_0x275a('0x2b')](handleError(_0x33c052,null));};exports[_0x275a('0x6a')]=function(_0x30f3b6,_0x16c673,_0x2e679c){if(_0x30f3b6[_0x275a('0x58')]['id']){delete _0x30f3b6[_0x275a('0x58')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x30f3b6[_0x275a('0x56')]['id']}})[_0x275a('0x21')](handleEntityNotFound(_0x16c673,null))['then'](function(_0xc56284){if(_0xc56284){_0x30f3b6[_0x275a('0x58')][_0x275a('0x62')]=_0xc56284['id'];return db['CannedAnswer']['create'](_0x30f3b6[_0x275a('0x58')]);}})[_0x275a('0x21')](respondWithResult(_0x16c673,null))['catch'](handleError(_0x16c673,null));};exports['getAnswers']=function(_0x35d4a3,_0xb38494,_0x22d8df){var _0x214e45={'raw':![],'where':{}};var _0x1cc9a5={};var _0x14b148={'count':0x0,'rows':[]};return db[_0x275a('0x3f')][_0x275a('0x64')]({'where':{'id':_0x35d4a3[_0x275a('0x56')]['id']}})[_0x275a('0x21')](handleEntityNotFound(_0xb38494,null))['then'](function(_0x41114a){if(_0x41114a){_0x1cc9a5[_0x275a('0x43')]=_[_0x275a('0x45')](db['CannedAnswer'][_0x275a('0x65')]);_0x1cc9a5[_0x275a('0x46')]=_['keys'](_0x35d4a3[_0x275a('0x46')]);_0x1cc9a5[_0x275a('0x47')]=_[_0x275a('0x48')](_0x1cc9a5[_0x275a('0x43')],_0x1cc9a5[_0x275a('0x46')]);_0x214e45['attributes']=_['intersection'](_0x1cc9a5[_0x275a('0x43')],qs[_0x275a('0x4a')](_0x35d4a3[_0x275a('0x46')][_0x275a('0x4a')]));_0x214e45[_0x275a('0x49')]=_0x214e45[_0x275a('0x49')][_0x275a('0x4b')]?_0x214e45[_0x275a('0x49')]:_0x1cc9a5[_0x275a('0x43')];if(!_0x35d4a3[_0x275a('0x46')][_0x275a('0x4c')](_0x275a('0x4d'))){_0x214e45[_0x275a('0x2e')]=qs[_0x275a('0x2e')](_0x35d4a3[_0x275a('0x46')][_0x275a('0x2e')]);_0x214e45[_0x275a('0x30')]=qs[_0x275a('0x30')](_0x35d4a3[_0x275a('0x46')]['offset']);}_0x214e45[_0x275a('0x4e')]=qs[_0x275a('0x4f')](_0x35d4a3[_0x275a('0x46')][_0x275a('0x4f')]);_0x214e45[_0x275a('0x67')]=qs[_0x275a('0x47')](_[_0x275a('0x66')](_0x35d4a3[_0x275a('0x46')],_0x1cc9a5[_0x275a('0x47')]));_0x214e45[_0x275a('0x67')][_0x275a('0x62')]=_0x41114a['id'];if(_0x35d4a3[_0x275a('0x46')]['filter']){_0x214e45['where']=_[_0x275a('0x51')](_0x214e45[_0x275a('0x67')],{'$or':_[_0x275a('0x44')](_0x214e45[_0x275a('0x49')],function(_0x196e5b){var _0xf30d9b={};_0xf30d9b[_0x196e5b]={'$like':'%'+_0x35d4a3[_0x275a('0x46')][_0x275a('0x50')]+'%'};return _0xf30d9b;})});}_0x214e45=_['merge']({},_0x214e45,_0x35d4a3[_0x275a('0x57')]);return db[_0x275a('0x6b')][_0x275a('0x2f')]({'where':_0x214e45[_0x275a('0x67')]})[_0x275a('0x21')](function(_0x1875ad){_0x14b148[_0x275a('0x2f')]=_0x1875ad;if(_0x35d4a3[_0x275a('0x46')]['includeAll']){_0x214e45['include']=[{'all':!![]}];}return db[_0x275a('0x6b')][_0x275a('0x68')](_0x214e45);})['then'](function(_0x3ef86a){_0x14b148[_0x275a('0x54')]=_0x3ef86a;return _0x14b148;});}})['then'](respondWithFilteredResult(_0xb38494,_0x214e45))['catch'](handleError(_0xb38494,null));};exports[_0x275a('0x6c')]=function(_0x2b0ed4,_0x364f4a,_0x5c229b){return db[_0x275a('0x3f')][_0x275a('0x5c')]({'where':{'id':_0x2b0ed4[_0x275a('0x56')]['id']}})[_0x275a('0x21')](handleEntityNotFound(_0x364f4a,null))[_0x275a('0x21')](function(_0x43773a){if(_0x43773a){return _0x43773a[_0x275a('0x6c')](_0x2b0ed4[_0x275a('0x46')][_0x275a('0x6d')]);}})[_0x275a('0x21')](respondWithStatusCode(_0x364f4a,null))[_0x275a('0x2b')](handleError(_0x364f4a,null));};exports['addAgents']=function(_0x5a093c,_0x294b77,_0x5e1228){return db[_0x275a('0x3f')][_0x275a('0x5c')]({'where':{'id':_0x5a093c[_0x275a('0x56')]['id']}})['then'](handleEntityNotFound(_0x294b77,null))[_0x275a('0x21')](function(_0x5edf2a){if(_0x5edf2a){return _0x5edf2a[_0x275a('0x6e')](_0x5a093c[_0x275a('0x58')][_0x275a('0x6d')],_[_0x275a('0x6f')](_0x5a093c[_0x275a('0x58')],[_0x275a('0x6d'),'id'])||{})[_0x275a('0x70')](function(_0x33a6ff){for(var _0xdac4=0x0;_0xdac4<_0x5a093c[_0x275a('0x58')][_0x275a('0x6d')][_0x275a('0x4b')];_0xdac4+=0x1){socket['emit'](_0x275a('0x71'),{'UserId':Number(_0x5a093c[_0x275a('0x58')][_0x275a('0x6d')][_0xdac4]),'WhatsappAccountId':Number(_0x5a093c[_0x275a('0x56')]['id'])});}return _0x33a6ff;});}})[_0x275a('0x21')](respondWithResult(_0x294b77,null))[_0x275a('0x2b')](handleError(_0x294b77,null));};exports[_0x275a('0x72')]=function(_0x3b6ea4,_0x34bea6,_0x168beb){return db['WhatsappAccount'][_0x275a('0x5c')]({'where':{'id':_0x3b6ea4[_0x275a('0x56')]['id']}})[_0x275a('0x21')](handleEntityNotFound(_0x34bea6,null))[_0x275a('0x21')](function(_0x128c50){if(_0x128c50){return _0x128c50[_0x275a('0x72')](_0x3b6ea4[_0x275a('0x46')][_0x275a('0x6d')])[_0x275a('0x21')](function(){if(_[_0x275a('0x73')](_0x3b6ea4[_0x275a('0x46')]['ids'])){for(var _0x333285=0x0;_0x333285<_0x3b6ea4[_0x275a('0x46')][_0x275a('0x6d')][_0x275a('0x4b')];_0x333285+=0x1){socket[_0x275a('0x74')]('userWhatsappAccount:remove',{'UserId':Number(_0x3b6ea4[_0x275a('0x46')][_0x275a('0x6d')][_0x333285]),'WhatsappAccountId':Number(_0x3b6ea4['params']['id'])});}}else{socket[_0x275a('0x74')](_0x275a('0x75'),{'UserId':Number(_0x3b6ea4[_0x275a('0x46')][_0x275a('0x6d')]),'WhatsappAccountId':Number(_0x3b6ea4[_0x275a('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0x34bea6,null))[_0x275a('0x2b')](handleError(_0x34bea6,null));};exports[_0x275a('0x76')]=function(_0x289108,_0x16ea1f,_0x60b367){var _0x36ccc9={};var _0x172ca5={};var _0x55e795;var _0x2189f9;return db['WhatsappAccount'][_0x275a('0x64')]({'where':{'id':_0x289108[_0x275a('0x56')]['id']}})['then'](handleEntityNotFound(_0x16ea1f,null))['then'](function(_0x1adaef){if(_0x1adaef){_0x55e795=_0x1adaef;_0x172ca5['model']=_[_0x275a('0x45')](db[_0x275a('0x77')][_0x275a('0x65')]);_0x172ca5[_0x275a('0x46')]=_[_0x275a('0x45')](_0x289108['query']);_0x172ca5[_0x275a('0x47')]=_[_0x275a('0x48')](_0x172ca5['model'],_0x172ca5[_0x275a('0x46')]);_0x36ccc9[_0x275a('0x49')]=_[_0x275a('0x48')](_0x172ca5['model'],qs[_0x275a('0x4a')](_0x289108['query']['fields']));_0x36ccc9[_0x275a('0x49')]=_0x36ccc9[_0x275a('0x49')]['length']?_0x36ccc9[_0x275a('0x49')]:_0x172ca5[_0x275a('0x43')];_0x36ccc9['order']=qs[_0x275a('0x4f')](_0x289108[_0x275a('0x46')][_0x275a('0x4f')]);_0x36ccc9[_0x275a('0x67')]=qs['filters'](_[_0x275a('0x66')](_0x289108[_0x275a('0x46')],_0x172ca5[_0x275a('0x47')]));if(_0x289108[_0x275a('0x46')][_0x275a('0x50')]){_0x36ccc9[_0x275a('0x67')]=_[_0x275a('0x51')](_0x36ccc9[_0x275a('0x67')],{'$or':_[_0x275a('0x44')](_0x36ccc9[_0x275a('0x49')],function(_0x16ac92){var _0x3edb59={};_0x3edb59[_0x16ac92]={'$like':'%'+_0x289108[_0x275a('0x46')]['filter']+'%'};return _0x3edb59;})});}_0x36ccc9=_[_0x275a('0x51')]({},_0x36ccc9,_0x289108[_0x275a('0x57')]);return _0x55e795['getAgents'](_0x36ccc9);}})['then'](function(_0x506693){if(_0x506693){_0x2189f9=_0x506693[_0x275a('0x4b')];if(!_0x289108[_0x275a('0x46')][_0x275a('0x4c')](_0x275a('0x4d'))){_0x36ccc9['limit']=qs[_0x275a('0x2e')](_0x289108[_0x275a('0x46')]['limit']);_0x36ccc9['offset']=qs[_0x275a('0x30')](_0x289108[_0x275a('0x46')][_0x275a('0x30')]);}return _0x55e795['getAgents'](_0x36ccc9);}})[_0x275a('0x21')](function(_0x5910b2){if(_0x5910b2){return _0x5910b2?{'count':_0x2189f9,'rows':_0x5910b2}:null;}})[_0x275a('0x21')](respondWithResult(_0x16ea1f,null))[_0x275a('0x2b')](handleError(_0x16ea1f,null));};exports['addApplications']=function(_0x4666bb,_0x100105){var _0x95dc83=_0x4666bb[_0x275a('0x56')]['id'];var _0x4514c0=_0x4666bb['body'];var _0x1e260a=0xc8;var _0x20a82c=null;return db[_0x275a('0x78')][_0x275a('0x79')]({'isolationLevel':db[_0x275a('0x78')][_0x275a('0x7a')][_0x275a('0x7b')]['READ_COMMITTED']},function(_0x22a2bd){return db[_0x275a('0x3f')][_0x275a('0x64')]({'where':{'id':_0x95dc83},'transaction':_0x22a2bd})[_0x275a('0x21')](function(_0x31f982){if(_0x31f982){return db[_0x275a('0x7c')][_0x275a('0x37')]({'where':{'WhatsappAccountId':_0x95dc83},'transaction':_0x22a2bd})[_0x275a('0x21')](function(){var _0x4a7457=_[_0x275a('0x44')](_0x4514c0,function(_0x3eb44f){_0x3eb44f[_0x275a('0x62')]=_0x95dc83;return _0x3eb44f;});return db[_0x275a('0x7c')]['bulkCreate'](_0x4a7457,{'transaction':_0x22a2bd});});}else{_0x1e260a=0x194;_0x20a82c=[];}});})[_0x275a('0x21')](function(){if(_0x1e260a!==0x194){return db[_0x275a('0x7c')][_0x275a('0x7d')]({'where':{'WhatsappAccountId':_0x95dc83},'order':_0x275a('0x7e')})[_0x275a('0x21')](function(_0x403d12){_0x20a82c=_0x403d12;});}})[_0x275a('0x2b')](function(_0xbbc37a){_0x1e260a=0x1f4;logger[_0x275a('0x27')](_0xbbc37a[_0x275a('0x3a')]);if(_0xbbc37a[_0x275a('0x3b')]){delete _0xbbc37a[_0x275a('0x3b')];}_0x20a82c=_0xbbc37a;})['finally'](function(){if(_0x20a82c===null){_0x100105[_0x275a('0x39')](_0x1e260a);}else{if(_0x1e260a===0x1f4){_0x100105['status'](_0x1e260a)[_0x275a('0x3c')](_0x20a82c);}else{_0x100105['status'](_0x1e260a)['json'](_0x20a82c);}}});};exports[_0x275a('0x7f')]=function(_0x1e540b,_0x2f2cc7,_0x38e213){var _0x49cc74={};var _0x9f44f9={};var _0x56d1e4;var _0x55f221;return db[_0x275a('0x3f')][_0x275a('0x64')]({'where':{'id':_0x1e540b['params']['id']}})[_0x275a('0x21')](handleEntityNotFound(_0x2f2cc7,null))[_0x275a('0x21')](function(_0x459a0c){if(_0x459a0c){_0x56d1e4=_0x459a0c;_0x9f44f9[_0x275a('0x43')]=_['keys'](db[_0x275a('0x7c')][_0x275a('0x65')]);_0x9f44f9[_0x275a('0x46')]=_['keys'](_0x1e540b['query']);_0x9f44f9[_0x275a('0x47')]=_[_0x275a('0x48')](_0x9f44f9[_0x275a('0x43')],_0x9f44f9['query']);_0x49cc74[_0x275a('0x49')]=_['intersection'](_0x9f44f9[_0x275a('0x43')],qs[_0x275a('0x4a')](_0x1e540b[_0x275a('0x46')]['fields']));_0x49cc74['attributes']=_0x49cc74[_0x275a('0x49')][_0x275a('0x4b')]?_0x49cc74[_0x275a('0x49')]:_0x9f44f9[_0x275a('0x43')];_0x49cc74[_0x275a('0x4e')]=qs[_0x275a('0x4f')](_0x1e540b[_0x275a('0x46')][_0x275a('0x4f')]);_0x49cc74[_0x275a('0x67')]=qs[_0x275a('0x47')](_['pick'](_0x1e540b['query'],_0x9f44f9[_0x275a('0x47')]));if(_0x1e540b[_0x275a('0x46')][_0x275a('0x50')]){_0x49cc74[_0x275a('0x67')]=_['merge'](_0x49cc74[_0x275a('0x67')],{'$or':_[_0x275a('0x44')](_0x49cc74[_0x275a('0x49')],function(_0x2838b9){var _0x1d21f6={};_0x1d21f6[_0x2838b9]={'$like':'%'+_0x1e540b[_0x275a('0x46')][_0x275a('0x50')]+'%'};return _0x1d21f6;})});}_0x49cc74=_[_0x275a('0x51')]({},_0x49cc74,_0x1e540b[_0x275a('0x57')]);return _0x56d1e4[_0x275a('0x7f')](_0x49cc74);}})[_0x275a('0x21')](function(_0x258cc6){if(_0x258cc6){_0x55f221=_0x258cc6['length'];if(!_0x1e540b[_0x275a('0x46')][_0x275a('0x4c')](_0x275a('0x4d'))){_0x49cc74['limit']=qs['limit'](_0x1e540b[_0x275a('0x46')][_0x275a('0x2e')]);_0x49cc74[_0x275a('0x30')]=qs[_0x275a('0x30')](_0x1e540b['query'][_0x275a('0x30')]);}return _0x56d1e4['getApplications'](_0x49cc74);}})['then'](function(_0x39bde5){if(_0x39bde5){return _0x39bde5?{'count':_0x55f221,'rows':_0x39bde5}:null;}})[_0x275a('0x21')](respondWithResult(_0x2f2cc7,null))[_0x275a('0x2b')](handleError(_0x2f2cc7,null));};exports['notify']=function(_0x1a25c7,_0x3f2c18,_0x4f3b4c){var _0x4b69b0={'channel':'whatsapp'};var _0x27bd7a=[];var _0xebfb2b=[];var _0x24e401={};return db[_0x275a('0x3f')][_0x275a('0x5c')]({'where':{'id':_0x1a25c7[_0x275a('0x56')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x275a('0x80')}]})['then'](handleEntityNotFound(_0x3f2c18,null))[_0x275a('0x21')](function(_0x3244f1){_0x4b69b0['account']=_0x3244f1;if(_0x4b69b0[_0x275a('0x81')]&&_0x4b69b0[_0x275a('0x81')][_0x275a('0x41')]==='sinch'&&_0x1a25c7['body']['statuses']){if(_0x1a25c7[_0x275a('0x58')][_0x275a('0x82')][_0x275a('0x4b')]===0x0)return;if(_0x1a25c7['body'][_0x275a('0x82')][0x0][_0x275a('0x83')]!==_0x275a('0x84'))return;return db[_0x275a('0x85')][_0x275a('0x36')]({'read':!![],'readAt':_0x1a25c7[_0x275a('0x58')][_0x275a('0x82')][0x0][_0x275a('0x86')]},{'where':{'messageId':_0x1a25c7[_0x275a('0x58')][_0x275a('0x82')][0x0][_0x275a('0x87')]},'individualHooks':!![]})['then'](function(_0x5dd182){return _0x3f2c18[_0x275a('0x2c')](0xc8)['json'](_0x5dd182);});}_0x4b69b0[_0x275a('0x88')]=_['orderBy'](_0x3244f1[_0x275a('0x80')],[_0x275a('0x7e')],[_0x275a('0x89')]);if(_0x4b69b0[_0x275a('0x81')][_0x275a('0x80')]){delete _0x4b69b0[_0x275a('0x81')]['Applications'];}return db[_0x275a('0x8a')][_0x275a('0x60')]()[_0x275a('0x21')](function(_0x30956f){if(!_0x30956f){throw new db[(_0x275a('0x8b'))]['ValidationError'](_0x275a('0x8c'));}_0x27bd7a=_[_0x275a('0x8d')](_[_0x275a('0x45')](_0x30956f),['createdAt',_0x275a('0x8e')]);_0xebfb2b=_[_0x275a('0x8d')](_[_0x275a('0x45')](_0x30956f),[_0x275a('0x8f'),_0x275a('0x8e'),_0x275a('0x90'),'ListId']);_0x4b69b0[_0x275a('0x58')]={'mapKey':_0x275a('0x91')};if(_0x4b69b0[_0x275a('0x81')]&&_0x4b69b0[_0x275a('0x81')][_0x275a('0x41')]===_0x275a('0x92')){_0x4b69b0[_0x275a('0x58')][_0x275a('0x93')]=_0x1a25c7[_0x275a('0x58')][_0x275a('0x94')]['replace'](_0x275a('0x95'),'');_0x4b69b0[_0x275a('0x58')][_0x275a('0x58')]=_0x1a25c7[_0x275a('0x58')]['Body'];_0x4b69b0[_0x275a('0x58')][_0x275a('0x96')]=_0x1a25c7[_0x275a('0x58')][_0x275a('0x97')];}if(_0x4b69b0[_0x275a('0x81')]&&_0x4b69b0[_0x275a('0x81')][_0x275a('0x41')]===_0x275a('0x98')){_0x4b69b0[_0x275a('0x58')][_0x275a('0x93')]=_0x1a25c7['body'][_0x275a('0x99')][0x0][_0x275a('0x93')];_0x4b69b0[_0x275a('0x58')][_0x275a('0x58')]=_0x1a25c7[_0x275a('0x58')][_0x275a('0x99')][0x0][_0x275a('0x29')][_0x275a('0x58')];_0x4b69b0[_0x275a('0x58')][_0x275a('0x96')]=_0x1a25c7[_0x275a('0x58')]['notifications'][0x0]['message_id'];}if(_0x4b69b0[_0x275a('0x58')]['id']){delete _0x4b69b0['body']['id'];}if(_[_0x275a('0x9a')](_0x4b69b0[_0x275a('0x58')][_0x275a('0x93')])){throw new db[(_0x275a('0x8b'))][(_0x275a('0x9b'))](_0x275a('0x9c'));}if(_[_0x275a('0x9a')](_0x4b69b0[_0x275a('0x58')][_0x275a('0x58')])||_0x4b69b0[_0x275a('0x58')][_0x275a('0x58')]===''){throw new db[(_0x275a('0x8b'))][(_0x275a('0x9b'))](_0x275a('0x9d'));}if(_[_0x275a('0x9a')](_0x4b69b0['body'][_0x275a('0x9e')])){throw new db['Sequelize'][(_0x275a('0x9b'))](_0x275a('0x9f')+_0xebfb2b);}if(!_['includes'](_0xebfb2b,_0x4b69b0[_0x275a('0x58')][_0x275a('0x9e')])){throw new db[(_0x275a('0x8b'))]['ValidationError'](_0x275a('0xa0')+_0xebfb2b);}_0x24e401[_0x4b69b0[_0x275a('0x58')]['mapKey']]=_0x4b69b0['body']['from'];return db[_0x275a('0xa1')][_0x275a('0x5c')]({'where':{'id':_0x4b69b0[_0x275a('0x81')][_0x275a('0xa2')]},'include':[{'model':db[_0x275a('0x8a')],'as':_0x275a('0xa3'),'where':_0x24e401,'limit':0x1,'order':[[_0x275a('0x8e'),_0x275a('0xa4')]]}]});})['then'](handleEntityNotFound(_0x3f2c18,null))[_0x275a('0x21')](function(_0x243e21){if(_0x243e21){_0x4b69b0[_0x275a('0xa5')]=_['omit'](_0x243e21,[_0x275a('0xa3')]);if(_0x243e21['Contacts'][_0x275a('0x4b')]){return _0x243e21['Contacts'][0x0];}var _0x1d8fcd=_[_0x275a('0x1a')](_0x4b69b0[_0x275a('0x58')],{'firstName':_0x4b69b0['body']['from'],'ListId':_0x243e21['id']});_0x1d8fcd[_0x4b69b0[_0x275a('0x58')][_0x275a('0x9e')]]=_0x4b69b0[_0x275a('0x58')][_0x275a('0x93')];return db['CmContact'][_0x275a('0x5e')](_0x1d8fcd,{'fields':_0x27bd7a,'raw':!![]});}})[_0x275a('0x21')](handleEntityNotFound(_0x3f2c18,null))['then'](function(_0x11a85e){if(_0x11a85e){_0x4b69b0[_0x275a('0xa6')]=_0x11a85e;var _0x36c18a={'ContactId':_0x11a85e['id'],'phone':_0x4b69b0[_0x275a('0x58')][_0x275a('0x93')],'WhatsappAccountId':_0x1a25c7['params']['id']};var _0x5bba73={'ContactId':_0x11a85e['id'],'WhatsappAccountId':_0x1a25c7[_0x275a('0x56')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x275a('0x5c')]({'where':_0x5bba73})[_0x275a('0x21')](function(_0x51102c){if(_0x51102c){return[_0x51102c,![]];}return db[_0x275a('0xa7')][_0x275a('0x5e')](_0x36c18a)[_0x275a('0x21')](function(_0x581ed0){return[_0x581ed0,!![]];});});}})[_0x275a('0x70')](function(_0x23ee66,_0x4ab2fe){_0x4b69b0[_0x275a('0xa8')]=_0x23ee66[_0x275a('0x5a')]({'plain':!![]});_0x4b69b0[_0x275a('0xa8')][_0x275a('0xa9')]=![];if(_0x4ab2fe){if(_0x4b69b0[_0x275a('0x81')][_0x275a('0xaa')]){_0x4b69b0['applications']['push']({'id':0x0,'priority':_0x4b69b0['applications'][_0x275a('0x4b')]+0x1,'app':_0x275a('0xab'),'appdata':_0x275a('0xac'),'interval':_0x275a('0xad')});}_0x4b69b0[_0x275a('0xa8')][_0x275a('0xa9')]=!![];}return db['WhatsappMessage'][_0x275a('0x5e')]({'phone':_0x4b69b0[_0x275a('0x58')][_0x275a('0x93')],'messageId':_0x4b69b0[_0x275a('0x58')][_0x275a('0x96')],'body':_0x4b69b0[_0x275a('0x58')][_0x275a('0x58')],'WhatsappAccountId':_0x1a25c7[_0x275a('0x56')]['id'],'WhatsappInteractionId':_0x23ee66['id'],'direction':'in','ContactId':_0x23ee66['ContactId'],'AttachmentId':_0x4b69b0[_0x275a('0x58')][_0x275a('0xae')]});})[_0x275a('0x21')](function(_0x553e7f){_0x4b69b0['message']=_0x553e7f;if(_0x4b69b0['interaction'][_0x275a('0xaf')]){return db[_0x275a('0x77')][_0x275a('0x5c')]({'attributes':['id',_0x275a('0x3b')],'where':{'id':_0x4b69b0[_0x275a('0xa8')][_0x275a('0xaf')]}})[_0x275a('0x21')](function(_0x3eb1db){if(_0x3eb1db){_0x4b69b0[_0x275a('0x88')][_0x275a('0xb0')]({'id':0x0,'priority':0x0,'app':_0x275a('0xb1'),'appdata':_0x3eb1db['name']+','+(_0x4b69b0[_0x275a('0x81')]['waitForTheAssignedAgent']||0xa),'interval':_0x275a('0xad')});}return respondWithRpcPromise('Start','startRouting',_0x4b69b0);});}return respondWithRpcPromise(_0x275a('0xb2'),'startRouting',_0x4b69b0);})[_0x275a('0x21')](function(_0x419377){if(_0x419377){var _0x34728b=0xc8;var _0x2a1ad3='receiveMessage';logger[_0x275a('0x2a')](_0x275a('0x25'),_0x2a1ad3,_0x34728b,'entity\x20found');logger[_0x275a('0x24')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x2a1ad3,_0x34728b,_0x275a('0xb3'),JSON[_0x275a('0x26')](_0x419377));if(_0x4b69b0[_0x275a('0x81')][_0x275a('0x41')]==='twilio'){return _0x3f2c18[_0x275a('0x2c')](_0x34728b)[_0x275a('0x31')](_0x275a('0xb4'),_0x275a('0xb5'))[_0x275a('0x3c')]('\x0a');}else{return _0x3f2c18[_0x275a('0x2c')](_0x34728b)[_0x275a('0x33')](_0x419377);}}});})[_0x275a('0x2b')](handleError(_0x3f2c18,null));};exports[_0x275a('0x3c')]=function(_0x26ea45,_0x39c1eb,_0x4b4b8d){var _0x363905,_0x59c17e,_0x40dbfb;if(_[_0x275a('0x9a')](_0x26ea45['body']['body'])||_0x26ea45[_0x275a('0x58')][_0x275a('0x58')]===''){throw new db[(_0x275a('0x8b'))][(_0x275a('0x9b'))](_0x275a('0x9d'));}if(_[_0x275a('0x9a')](_0x26ea45[_0x275a('0x58')]['to'])){throw new db[(_0x275a('0x8b'))][(_0x275a('0x9b'))](_0x275a('0xb6'));}_0x363905=_0x26ea45[_0x275a('0x58')]['to'];return db['WhatsappAccount']['find']({'where':{'id':_0x26ea45[_0x275a('0x56')]['id']},'include':[{'model':db[_0x275a('0xa1')],'as':_0x275a('0xb7'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0x363905},'limit':0x1,'order':[[_0x275a('0x8e'),_0x275a('0xa4')]]}]}]})[_0x275a('0x21')](handleEntityNotFound(_0x39c1eb,null))[_0x275a('0x21')](function(_0x2dbf73){if(_0x2dbf73&&_0x2dbf73['List']){_0x59c17e=_0x2dbf73['get']({'plain':!![]});if(_0x59c17e[_0x275a('0xb7')]&&_0x59c17e[_0x275a('0xb7')][_0x275a('0xa3')][_0x275a('0x4b')]){return _0x59c17e[_0x275a('0xb7')]['Contacts'][0x0];}return db[_0x275a('0x8a')][_0x275a('0x5e')](_[_0x275a('0x1a')](_0x26ea45[_0x275a('0x58')],{'firstName':_0x363905,'mobile':_0x363905,'phone':_0x363905,'ListId':_0x59c17e[_0x275a('0xa2')]}));}})[_0x275a('0x21')](handleEntityNotFound(_0x39c1eb,null))[_0x275a('0x21')](function(_0x3e6e0f){if(_0x3e6e0f){_0x40dbfb=_0x3e6e0f;return db[_0x275a('0xa7')][_0x275a('0x5c')]({'where':{'ContactId':_0x40dbfb['id'],'closed':![],'WhatsappAccountId':_0x59c17e['id']}})[_0x275a('0x21')](function(_0x40a85f){if(_0x40a85f){return[_0x40a85f,![]];}return db[_0x275a('0xa7')][_0x275a('0x5e')]({'UserId':_0x26ea45[_0x275a('0x59')]['id'],'ContactId':_0x40dbfb['id'],'WhatsappAccountId':_0x59c17e['id'],'phone':_0x363905,'firstMsgDirection':_0x275a('0xb8'),'Messages':[_['merge'](_0x26ea45[_0x275a('0x58')],{'read':![],'body':_0x26ea45[_0x275a('0x58')][_0x275a('0x58')],'phone':_0x363905,'WhatsappAccountId':_0x59c17e['id'],'UserId':_0x26ea45[_0x275a('0x59')]['id'],'ContactId':_0x40dbfb['id']})]},{'include':[{'model':db[_0x275a('0x85')],'as':_0x275a('0xb9')}]})[_0x275a('0x21')](function(_0x3d906a){return[_0x3d906a,!![]];});});}})['spread'](function(_0x3e9a1b,_0x30fb88){if(_0x30fb88){return _0x3e9a1b;}return db[_0x275a('0x85')]['create'](_['merge'](_0x26ea45[_0x275a('0x58')],{'read':![],'body':_0x26ea45[_0x275a('0x58')]['body'],'phone':_0x363905,'WhatsappAccountId':_0x59c17e['id'],'WhatsappInteractionId':_0x3e9a1b['id'],'UserId':_0x26ea45['user']['id'],'ContactId':_0x40dbfb['id']}))[_0x275a('0x21')](function(_0x3ff636){_0x3e9a1b[_0x275a('0xba')][_0x275a('0xb9')]=[];_0x3e9a1b[_0x275a('0xba')][_0x275a('0xb9')]['push'](_0x3ff636['dataValues']);return _0x3e9a1b;});})[_0x275a('0x21')](respondWithResult(_0x39c1eb,null))[_0x275a('0x2b')](handleError(_0x39c1eb,null));}; \ No newline at end of file +var _0xaa63=['state','WhatsappMessage','timestamp','message_id','applications','orderBy','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','twilio','From','whatsapp:','Body','messageId','sinch','from','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','DESC','list','Contacts','defaults','contact','WhatsappInteraction','interaction','created','autoclose','push','close','ContactId','AttachmentId','UserId','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','set','\x0a','to\x20is\x20mandatory','CmList','List','out','Messages','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','WhatsappAccount,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','update','destroy','WhatsappAccounts','stack','send','index','mandatoryDispositionPause','WhatsappAccount','rawAttributes','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','name','options','includeAll','include','rows','params','Pause','keys','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','describe','WhatsappAccountId','findOne','Disposition','order','findAll','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','priority','finally','getApplications','whatsapp','Applications','statuses'];(function(_0x1c0828,_0x2659f5){var _0x307a0d=function(_0x2d404e){while(--_0x2d404e){_0x1c0828['push'](_0x1c0828['shift']());}};_0x307a0d(++_0x2659f5);}(_0xaa63,0xff));var _0x3aa6=function(_0x2ec71e,_0x4dd62d){_0x2ec71e=_0x2ec71e-0x0;var _0x3ae1a0=_0xaa63[_0x2ec71e];return _0x3ae1a0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3aa6('0x0'));var zipdir=require(_0x3aa6('0x1'));var jsonpatch=require(_0x3aa6('0x2'));var rp=require(_0x3aa6('0x3'));var moment=require(_0x3aa6('0x4'));var BPromise=require(_0x3aa6('0x5'));var Mustache=require(_0x3aa6('0x6'));var util=require('util');var path=require(_0x3aa6('0x7'));var sox=require(_0x3aa6('0x8'));var csv=require(_0x3aa6('0x9'));var ejs=require(_0x3aa6('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3aa6('0xb'));var squel=require(_0x3aa6('0xc'));var crypto=require(_0x3aa6('0xd'));var jsforce=require(_0x3aa6('0xe'));var deskjs=require(_0x3aa6('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3aa6('0x10'));var Redis=require(_0x3aa6('0x11'));var authService=require(_0x3aa6('0x12'));var qs=require(_0x3aa6('0x13'));var as=require(_0x3aa6('0x14'));var hardwareService=require(_0x3aa6('0x15'));var logger=require('../../config/logger')(_0x3aa6('0x16'));var utils=require(_0x3aa6('0x17'));var config=require(_0x3aa6('0x18'));var licenseUtil=require(_0x3aa6('0x19'));var db=require('../../mysqldb')['db'];config[_0x3aa6('0x1a')]=_['defaults'](config['redis'],{'host':_0x3aa6('0x1b'),'port':0x18eb});var socket=require(_0x3aa6('0x1c'))(new Redis(config['redis']));require(_0x3aa6('0x1d'))[_0x3aa6('0x1e')](socket);var jayson=require(_0x3aa6('0x1f'));var client=jayson[_0x3aa6('0x20')][_0x3aa6('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x3c2dce,_0x5470f1,_0x4c9613,_0x30b4a5){return new BPromise(function(_0x51b5b2,_0x44f884){var _0x30a35e=_0x30b4a5||client;return _0x30a35e[_0x3aa6('0x22')](_0x3c2dce,_0x4c9613)[_0x3aa6('0x23')](function(_0x1e7e8a){logger['info'](_0x3aa6('0x24'),_0x5470f1,'request\x20sent');logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x5470f1,'request\x20sent',JSON['stringify'](_0x1e7e8a));if(_0x1e7e8a[_0x3aa6('0x25')]){if(_0x1e7e8a[_0x3aa6('0x25')][_0x3aa6('0x26')]===0x1f4){logger[_0x3aa6('0x25')](_0x3aa6('0x24'),_0x5470f1,_0x1e7e8a['error'][_0x3aa6('0x27')]);return _0x44f884(_0x1e7e8a['error'][_0x3aa6('0x27')]);}logger[_0x3aa6('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x5470f1,_0x1e7e8a['error'][_0x3aa6('0x27')]);return _0x51b5b2(_0x1e7e8a[_0x3aa6('0x25')]['message']);}else{logger[_0x3aa6('0x28')](_0x3aa6('0x24'),_0x5470f1,_0x3aa6('0x29'));_0x51b5b2(_0x1e7e8a[_0x3aa6('0x2a')]['message']);}})['catch'](function(_0x21a0b7){logger['error'](_0x3aa6('0x24'),_0x5470f1,_0x21a0b7);_0x44f884(_0x21a0b7);});});}function respondWithStatusCode(_0x38097e,_0x16b984){_0x16b984=_0x16b984||0xcc;return function(_0x5a3d29){if(_0x5a3d29){return _0x38097e[_0x3aa6('0x2b')](_0x16b984);}return _0x38097e[_0x3aa6('0x2c')](_0x16b984)[_0x3aa6('0x2d')]();};}function respondWithResult(_0x14b1ea,_0x28c4ab){_0x28c4ab=_0x28c4ab||0xc8;return function(_0x1bc21f){if(_0x1bc21f){return _0x14b1ea[_0x3aa6('0x2c')](_0x28c4ab)[_0x3aa6('0x2e')](_0x1bc21f);}};}function respondWithFilteredResult(_0x172d03,_0x2d23e7){return function(_0x146d89){if(_0x146d89){var _0x735a22=typeof _0x2d23e7[_0x3aa6('0x2f')]===_0x3aa6('0x30')&&typeof _0x2d23e7['limit']==='undefined';var _0x53dcf2=_0x146d89[_0x3aa6('0x31')];var _0x5c0954=_0x735a22?0x0:_0x2d23e7['offset'];var _0x19ef12=_0x735a22?_0x146d89[_0x3aa6('0x31')]:_0x2d23e7['offset']+_0x2d23e7[_0x3aa6('0x32')];var _0x293adf;if(_0x19ef12>=_0x53dcf2){_0x19ef12=_0x53dcf2;_0x293adf=0xc8;}else{_0x293adf=0xce;}_0x172d03[_0x3aa6('0x2c')](_0x293adf);return _0x172d03['set'](_0x3aa6('0x33'),_0x5c0954+'-'+_0x19ef12+'/'+_0x53dcf2)[_0x3aa6('0x2e')](_0x146d89);}return null;};}function patchUpdates(_0x138112){return function(_0x4090e2){try{jsonpatch[_0x3aa6('0x34')](_0x4090e2,_0x138112,!![]);}catch(_0x497fd0){return BPromise['reject'](_0x497fd0);}return _0x4090e2[_0x3aa6('0x35')]();};}function saveUpdates(_0x47dc9b,_0x16af5d){return function(_0x516aa7){if(_0x516aa7){return _0x516aa7[_0x3aa6('0x36')](_0x47dc9b)['then'](function(_0x38ca54){return _0x38ca54;});}return null;};}function removeEntity(_0x21c0d1,_0x455741){return function(_0x2b4408){if(_0x2b4408){return _0x2b4408[_0x3aa6('0x37')]()[_0x3aa6('0x23')](function(){var _0x18c268=_0x2b4408['get']({'plain':!![]});var _0x40b933=_0x3aa6('0x38');return db['UserProfileResource'][_0x3aa6('0x37')]({'where':{'type':_0x40b933,'resourceId':_0x18c268['id']}})[_0x3aa6('0x23')](function(){return _0x2b4408;});})[_0x3aa6('0x23')](function(){_0x21c0d1[_0x3aa6('0x2c')](0xcc)[_0x3aa6('0x2d')]();});}};}function handleEntityNotFound(_0x4e16af,_0x325ba0){return function(_0x54dbc9){if(!_0x54dbc9){_0x4e16af['sendStatus'](0x194);}return _0x54dbc9;};}function handleError(_0x2bc112,_0x35497c){_0x35497c=_0x35497c||0x1f4;return function(_0x4d4dcd){logger['error'](_0x4d4dcd[_0x3aa6('0x39')]);if(_0x4d4dcd['name']){delete _0x4d4dcd['name'];}_0x2bc112[_0x3aa6('0x2c')](_0x35497c)[_0x3aa6('0x3a')](_0x4d4dcd);};}exports[_0x3aa6('0x3b')]=function(_0x2dc8c0,_0x5ec851){var _0x3855a4={'include':[{'model':db['Pause'],'as':_0x3aa6('0x3c')}]},_0x252d89={},_0x4b67b7={'count':0x0,'rows':[]};var _0x19e523=_['map'](db[_0x3aa6('0x3d')][_0x3aa6('0x3e')],function(_0x2852f8){return{'name':_0x2852f8['fieldName'],'type':_0x2852f8[_0x3aa6('0x3f')][_0x3aa6('0x40')]};});_0x252d89[_0x3aa6('0x41')]=_[_0x3aa6('0x42')](_0x19e523,'name');_0x252d89[_0x3aa6('0x43')]=_['keys'](_0x2dc8c0[_0x3aa6('0x43')]);_0x252d89['filters']=_[_0x3aa6('0x44')](_0x252d89[_0x3aa6('0x41')],_0x252d89[_0x3aa6('0x43')]);_0x3855a4[_0x3aa6('0x45')]=_[_0x3aa6('0x44')](_0x252d89[_0x3aa6('0x41')],qs['fields'](_0x2dc8c0[_0x3aa6('0x43')][_0x3aa6('0x46')]));_0x3855a4[_0x3aa6('0x45')]=_0x3855a4['attributes'][_0x3aa6('0x47')]?_0x3855a4['attributes']:_0x252d89['model'];if(!_0x2dc8c0[_0x3aa6('0x43')][_0x3aa6('0x48')](_0x3aa6('0x49'))){_0x3855a4[_0x3aa6('0x32')]=qs[_0x3aa6('0x32')](_0x2dc8c0[_0x3aa6('0x43')][_0x3aa6('0x32')]);_0x3855a4[_0x3aa6('0x2f')]=qs[_0x3aa6('0x2f')](_0x2dc8c0[_0x3aa6('0x43')][_0x3aa6('0x2f')]);}_0x3855a4['order']=qs[_0x3aa6('0x4a')](_0x2dc8c0[_0x3aa6('0x43')][_0x3aa6('0x4a')]);_0x3855a4[_0x3aa6('0x4b')]=qs[_0x3aa6('0x4c')](_[_0x3aa6('0x4d')](_0x2dc8c0[_0x3aa6('0x43')],_0x252d89[_0x3aa6('0x4c')]),_0x19e523);if(_0x2dc8c0['query'][_0x3aa6('0x4e')]){_0x3855a4[_0x3aa6('0x4b')]=_[_0x3aa6('0x4f')](_0x3855a4['where'],{'$or':_[_0x3aa6('0x42')](_0x19e523,function(_0x32d030){if(_0x32d030['type']!==_0x3aa6('0x50')){var _0x183b89={};_0x183b89[_0x32d030[_0x3aa6('0x51')]]={'$like':'%'+_0x2dc8c0[_0x3aa6('0x43')][_0x3aa6('0x4e')]+'%'};return _0x183b89;}})});}_0x3855a4=_[_0x3aa6('0x4f')]({},_0x3855a4,_0x2dc8c0[_0x3aa6('0x52')]);var _0x41b24a={'where':_0x3855a4[_0x3aa6('0x4b')]};return db[_0x3aa6('0x3d')][_0x3aa6('0x31')](_0x41b24a)['then'](function(_0x28eb7f){_0x4b67b7[_0x3aa6('0x31')]=_0x28eb7f;if(_0x2dc8c0[_0x3aa6('0x43')][_0x3aa6('0x53')]){_0x3855a4[_0x3aa6('0x54')]=[{'all':!![]}];}return db['WhatsappAccount']['findAll'](_0x3855a4);})[_0x3aa6('0x23')](function(_0x10fd3e){_0x4b67b7[_0x3aa6('0x55')]=_0x10fd3e;return _0x4b67b7;})[_0x3aa6('0x23')](respondWithFilteredResult(_0x5ec851,_0x3855a4))['catch'](handleError(_0x5ec851,null));};exports['show']=function(_0x323982,_0x5cf5f9){var _0x634150={'raw':![],'where':{'id':_0x323982[_0x3aa6('0x56')]['id']},'include':[{'model':db[_0x3aa6('0x57')],'as':_0x3aa6('0x3c')}]},_0x47ca94={};_0x47ca94[_0x3aa6('0x41')]=_[_0x3aa6('0x58')](db[_0x3aa6('0x3d')]['rawAttributes']);_0x47ca94[_0x3aa6('0x43')]=_[_0x3aa6('0x58')](_0x323982[_0x3aa6('0x43')]);_0x47ca94['filters']=_['intersection'](_0x47ca94[_0x3aa6('0x41')],_0x47ca94[_0x3aa6('0x43')]);_0x634150[_0x3aa6('0x45')]=_[_0x3aa6('0x44')](_0x47ca94[_0x3aa6('0x41')],qs[_0x3aa6('0x46')](_0x323982[_0x3aa6('0x43')][_0x3aa6('0x46')]));_0x634150['attributes']=_0x634150[_0x3aa6('0x45')]['length']?_0x634150[_0x3aa6('0x45')]:_0x47ca94[_0x3aa6('0x41')];if(_0x323982[_0x3aa6('0x43')][_0x3aa6('0x53')]){_0x634150[_0x3aa6('0x54')]=[{'all':!![]}];}_0x634150=_[_0x3aa6('0x4f')]({},_0x634150,_0x323982['options']);return db['WhatsappAccount'][_0x3aa6('0x59')](_0x634150)[_0x3aa6('0x23')](handleEntityNotFound(_0x5cf5f9,null))[_0x3aa6('0x23')](respondWithResult(_0x5cf5f9,null))[_0x3aa6('0x5a')](handleError(_0x5cf5f9,null));};exports[_0x3aa6('0x5b')]=function(_0xfcbfb3,_0x594286){return db[_0x3aa6('0x3d')][_0x3aa6('0x5b')](_0xfcbfb3[_0x3aa6('0x5c')],{})[_0x3aa6('0x23')](function(_0x282d92){var _0x1cb165=_0xfcbfb3[_0x3aa6('0x5d')][_0x3aa6('0x5e')]({'plain':!![]});if(!_0x1cb165)throw new Error(_0x3aa6('0x5f'));if(_0x1cb165['role']===_0x3aa6('0x5d')){var _0x58094d=_0x282d92[_0x3aa6('0x5e')]({'plain':!![]});var _0x464962='WhatsappAccounts';return db[_0x3aa6('0x60')][_0x3aa6('0x59')]({'where':{'name':_0x464962,'userProfileId':_0x1cb165[_0x3aa6('0x61')]},'raw':!![]})['then'](function(_0x521950){if(_0x521950&&_0x521950[_0x3aa6('0x62')]===0x0){return db[_0x3aa6('0x63')][_0x3aa6('0x5b')]({'name':_0x58094d[_0x3aa6('0x51')],'resourceId':_0x58094d['id'],'type':_0x521950['name'],'sectionId':_0x521950['id']},{})['then'](function(){return _0x282d92;});}else{return _0x282d92;}})['catch'](function(_0x17ab18){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17ab18);throw _0x17ab18;});}return _0x282d92;})[_0x3aa6('0x23')](respondWithResult(_0x594286,0xc9))[_0x3aa6('0x5a')](handleError(_0x594286,null));};exports[_0x3aa6('0x36')]=function(_0x49711b,_0x2843c3){if(_0x49711b[_0x3aa6('0x5c')]['id']){delete _0x49711b['body']['id'];}return db[_0x3aa6('0x3d')]['find']({'where':{'id':_0x49711b[_0x3aa6('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0x3aa6('0x3c')}]})[_0x3aa6('0x23')](handleEntityNotFound(_0x2843c3,null))[_0x3aa6('0x23')](saveUpdates(_0x49711b['body'],null))['then'](respondWithResult(_0x2843c3,null))[_0x3aa6('0x5a')](handleError(_0x2843c3,null));};exports[_0x3aa6('0x37')]=function(_0x1e1f48,_0xd61280){return db[_0x3aa6('0x3d')]['find']({'where':{'id':_0x1e1f48[_0x3aa6('0x56')]['id']}})[_0x3aa6('0x23')](handleEntityNotFound(_0xd61280,null))['then'](removeEntity(_0xd61280,null))[_0x3aa6('0x5a')](handleError(_0xd61280,null));};exports[_0x3aa6('0x64')]=function(_0x20fcad,_0x139848){return db[_0x3aa6('0x3d')][_0x3aa6('0x64')]()['then'](respondWithResult(_0x139848,null))[_0x3aa6('0x5a')](handleError(_0x139848,null));};exports['addDisposition']=function(_0x1cbeed,_0x4342ce,_0x2b11d8){if(_0x1cbeed[_0x3aa6('0x5c')]['id']){delete _0x1cbeed['body']['id'];}return db[_0x3aa6('0x3d')][_0x3aa6('0x59')]({'where':{'id':_0x1cbeed[_0x3aa6('0x56')]['id']}})['then'](handleEntityNotFound(_0x4342ce,null))['then'](function(_0x40cf6b){if(_0x40cf6b){_0x1cbeed[_0x3aa6('0x5c')][_0x3aa6('0x65')]=_0x40cf6b['id'];return db['Disposition'][_0x3aa6('0x5b')](_0x1cbeed['body']);}})[_0x3aa6('0x23')](respondWithResult(_0x4342ce,null))[_0x3aa6('0x5a')](handleError(_0x4342ce,null));};exports['getDispositions']=function(_0x5e32b7,_0x2b9f4b,_0xef264){var _0x2b9cbf={'raw':![],'where':{}};var _0x5d278b={};var _0x1d6cef={'count':0x0,'rows':[]};return db[_0x3aa6('0x3d')][_0x3aa6('0x66')]({'where':{'id':_0x5e32b7[_0x3aa6('0x56')]['id']}})[_0x3aa6('0x23')](handleEntityNotFound(_0x2b9f4b,null))[_0x3aa6('0x23')](function(_0x488a16){if(_0x488a16){_0x5d278b[_0x3aa6('0x41')]=_[_0x3aa6('0x58')](db[_0x3aa6('0x67')][_0x3aa6('0x3e')]);_0x5d278b[_0x3aa6('0x43')]=_[_0x3aa6('0x58')](_0x5e32b7['query']);_0x5d278b[_0x3aa6('0x4c')]=_[_0x3aa6('0x44')](_0x5d278b['model'],_0x5d278b['query']);_0x2b9cbf[_0x3aa6('0x45')]=_['intersection'](_0x5d278b[_0x3aa6('0x41')],qs[_0x3aa6('0x46')](_0x5e32b7[_0x3aa6('0x43')]['fields']));_0x2b9cbf[_0x3aa6('0x45')]=_0x2b9cbf['attributes'][_0x3aa6('0x47')]?_0x2b9cbf['attributes']:_0x5d278b[_0x3aa6('0x41')];if(!_0x5e32b7[_0x3aa6('0x43')][_0x3aa6('0x48')](_0x3aa6('0x49'))){_0x2b9cbf[_0x3aa6('0x32')]=qs[_0x3aa6('0x32')](_0x5e32b7['query'][_0x3aa6('0x32')]);_0x2b9cbf[_0x3aa6('0x2f')]=qs[_0x3aa6('0x2f')](_0x5e32b7[_0x3aa6('0x43')][_0x3aa6('0x2f')]);}_0x2b9cbf[_0x3aa6('0x68')]=qs[_0x3aa6('0x4a')](_0x5e32b7[_0x3aa6('0x43')][_0x3aa6('0x4a')]);_0x2b9cbf[_0x3aa6('0x4b')]=qs['filters'](_[_0x3aa6('0x4d')](_0x5e32b7[_0x3aa6('0x43')],_0x5d278b['filters']));_0x2b9cbf['where']['WhatsappAccountId']=_0x488a16['id'];if(_0x5e32b7[_0x3aa6('0x43')]['filter']){_0x2b9cbf[_0x3aa6('0x4b')]=_[_0x3aa6('0x4f')](_0x2b9cbf[_0x3aa6('0x4b')],{'$or':_[_0x3aa6('0x42')](_0x2b9cbf[_0x3aa6('0x45')],function(_0x1c0a72){var _0xbbea8b={};_0xbbea8b[_0x1c0a72]={'$like':'%'+_0x5e32b7[_0x3aa6('0x43')]['filter']+'%'};return _0xbbea8b;})});}_0x2b9cbf=_['merge']({},_0x2b9cbf,_0x5e32b7['options']);return db[_0x3aa6('0x67')]['count']({'where':_0x2b9cbf['where']})['then'](function(_0x534236){_0x1d6cef[_0x3aa6('0x31')]=_0x534236;if(_0x5e32b7['query'][_0x3aa6('0x53')]){_0x2b9cbf[_0x3aa6('0x54')]=[{'all':!![]}];}return db[_0x3aa6('0x67')][_0x3aa6('0x69')](_0x2b9cbf);})[_0x3aa6('0x23')](function(_0x36c9fe){_0x1d6cef['rows']=_0x36c9fe;return _0x1d6cef;});}})[_0x3aa6('0x23')](respondWithFilteredResult(_0x2b9f4b,_0x2b9cbf))[_0x3aa6('0x5a')](handleError(_0x2b9f4b,null));};exports['removeDispositions']=function(_0x464b5a,_0x3e3dbc,_0x2528e0){return db[_0x3aa6('0x3d')][_0x3aa6('0x59')]({'where':{'id':_0x464b5a[_0x3aa6('0x56')]['id']}})[_0x3aa6('0x23')](handleEntityNotFound(_0x3e3dbc,null))[_0x3aa6('0x23')](function(_0x422c35){if(_0x422c35){return _0x422c35[_0x3aa6('0x6a')](_0x464b5a[_0x3aa6('0x43')][_0x3aa6('0x6b')]);}})['then'](respondWithStatusCode(_0x3e3dbc,null))[_0x3aa6('0x5a')](handleError(_0x3e3dbc,null));};exports['addAnswer']=function(_0x12d419,_0x2bcf2a,_0x22422d){if(_0x12d419['body']['id']){delete _0x12d419[_0x3aa6('0x5c')]['id'];}return db['WhatsappAccount'][_0x3aa6('0x59')]({'where':{'id':_0x12d419[_0x3aa6('0x56')]['id']}})['then'](handleEntityNotFound(_0x2bcf2a,null))[_0x3aa6('0x23')](function(_0x23a4ad){if(_0x23a4ad){_0x12d419[_0x3aa6('0x5c')][_0x3aa6('0x65')]=_0x23a4ad['id'];return db[_0x3aa6('0x6c')][_0x3aa6('0x5b')](_0x12d419['body']);}})['then'](respondWithResult(_0x2bcf2a,null))['catch'](handleError(_0x2bcf2a,null));};exports[_0x3aa6('0x6d')]=function(_0x400967,_0x2fb08f,_0x12ab2c){var _0xf8e6ea={'raw':![],'where':{}};var _0xe9fee6={};var _0x17a65c={'count':0x0,'rows':[]};return db[_0x3aa6('0x3d')]['findOne']({'where':{'id':_0x400967[_0x3aa6('0x56')]['id']}})[_0x3aa6('0x23')](handleEntityNotFound(_0x2fb08f,null))[_0x3aa6('0x23')](function(_0x1e43c5){if(_0x1e43c5){_0xe9fee6[_0x3aa6('0x41')]=_[_0x3aa6('0x58')](db[_0x3aa6('0x6c')][_0x3aa6('0x3e')]);_0xe9fee6[_0x3aa6('0x43')]=_[_0x3aa6('0x58')](_0x400967['query']);_0xe9fee6[_0x3aa6('0x4c')]=_[_0x3aa6('0x44')](_0xe9fee6['model'],_0xe9fee6['query']);_0xf8e6ea['attributes']=_[_0x3aa6('0x44')](_0xe9fee6[_0x3aa6('0x41')],qs[_0x3aa6('0x46')](_0x400967[_0x3aa6('0x43')][_0x3aa6('0x46')]));_0xf8e6ea[_0x3aa6('0x45')]=_0xf8e6ea['attributes'][_0x3aa6('0x47')]?_0xf8e6ea['attributes']:_0xe9fee6['model'];if(!_0x400967['query'][_0x3aa6('0x48')]('nolimit')){_0xf8e6ea['limit']=qs['limit'](_0x400967[_0x3aa6('0x43')][_0x3aa6('0x32')]);_0xf8e6ea[_0x3aa6('0x2f')]=qs[_0x3aa6('0x2f')](_0x400967[_0x3aa6('0x43')][_0x3aa6('0x2f')]);}_0xf8e6ea['order']=qs[_0x3aa6('0x4a')](_0x400967[_0x3aa6('0x43')][_0x3aa6('0x4a')]);_0xf8e6ea[_0x3aa6('0x4b')]=qs[_0x3aa6('0x4c')](_[_0x3aa6('0x4d')](_0x400967[_0x3aa6('0x43')],_0xe9fee6[_0x3aa6('0x4c')]));_0xf8e6ea[_0x3aa6('0x4b')][_0x3aa6('0x65')]=_0x1e43c5['id'];if(_0x400967[_0x3aa6('0x43')][_0x3aa6('0x4e')]){_0xf8e6ea[_0x3aa6('0x4b')]=_['merge'](_0xf8e6ea[_0x3aa6('0x4b')],{'$or':_[_0x3aa6('0x42')](_0xf8e6ea['attributes'],function(_0x5c420e){var _0x1f82c0={};_0x1f82c0[_0x5c420e]={'$like':'%'+_0x400967[_0x3aa6('0x43')]['filter']+'%'};return _0x1f82c0;})});}_0xf8e6ea=_[_0x3aa6('0x4f')]({},_0xf8e6ea,_0x400967[_0x3aa6('0x52')]);return db[_0x3aa6('0x6c')][_0x3aa6('0x31')]({'where':_0xf8e6ea[_0x3aa6('0x4b')]})[_0x3aa6('0x23')](function(_0x4baf18){_0x17a65c[_0x3aa6('0x31')]=_0x4baf18;if(_0x400967[_0x3aa6('0x43')][_0x3aa6('0x53')]){_0xf8e6ea[_0x3aa6('0x54')]=[{'all':!![]}];}return db[_0x3aa6('0x6c')][_0x3aa6('0x69')](_0xf8e6ea);})[_0x3aa6('0x23')](function(_0x1da393){_0x17a65c[_0x3aa6('0x55')]=_0x1da393;return _0x17a65c;});}})['then'](respondWithFilteredResult(_0x2fb08f,_0xf8e6ea))['catch'](handleError(_0x2fb08f,null));};exports[_0x3aa6('0x6e')]=function(_0x45db6c,_0x11e51f,_0x11966f){return db[_0x3aa6('0x3d')]['find']({'where':{'id':_0x45db6c[_0x3aa6('0x56')]['id']}})[_0x3aa6('0x23')](handleEntityNotFound(_0x11e51f,null))[_0x3aa6('0x23')](function(_0x294730){if(_0x294730){return _0x294730['removeAnswers'](_0x45db6c[_0x3aa6('0x43')]['ids']);}})[_0x3aa6('0x23')](respondWithStatusCode(_0x11e51f,null))[_0x3aa6('0x5a')](handleError(_0x11e51f,null));};exports[_0x3aa6('0x6f')]=function(_0x334812,_0x119457,_0x556b59){return db[_0x3aa6('0x3d')][_0x3aa6('0x59')]({'where':{'id':_0x334812[_0x3aa6('0x56')]['id']}})[_0x3aa6('0x23')](handleEntityNotFound(_0x119457,null))[_0x3aa6('0x23')](function(_0x4be9a2){if(_0x4be9a2){return _0x4be9a2[_0x3aa6('0x6f')](_0x334812[_0x3aa6('0x5c')]['ids'],_[_0x3aa6('0x70')](_0x334812[_0x3aa6('0x5c')],[_0x3aa6('0x6b'),'id'])||{})[_0x3aa6('0x71')](function(_0x3f6308){for(var _0x31cf76=0x0;_0x31cf76<_0x334812[_0x3aa6('0x5c')][_0x3aa6('0x6b')][_0x3aa6('0x47')];_0x31cf76+=0x1){socket[_0x3aa6('0x72')](_0x3aa6('0x73'),{'UserId':Number(_0x334812[_0x3aa6('0x5c')][_0x3aa6('0x6b')][_0x31cf76]),'WhatsappAccountId':Number(_0x334812[_0x3aa6('0x56')]['id'])});}return _0x3f6308;});}})[_0x3aa6('0x23')](respondWithResult(_0x119457,null))[_0x3aa6('0x5a')](handleError(_0x119457,null));};exports[_0x3aa6('0x74')]=function(_0x5924b1,_0x4c01b1,_0x574d63){return db['WhatsappAccount'][_0x3aa6('0x59')]({'where':{'id':_0x5924b1['params']['id']}})['then'](handleEntityNotFound(_0x4c01b1,null))[_0x3aa6('0x23')](function(_0x17dc20){if(_0x17dc20){return _0x17dc20[_0x3aa6('0x74')](_0x5924b1[_0x3aa6('0x43')][_0x3aa6('0x6b')])[_0x3aa6('0x23')](function(){if(_['isArray'](_0x5924b1[_0x3aa6('0x43')][_0x3aa6('0x6b')])){for(var _0x18154d=0x0;_0x18154d<_0x5924b1[_0x3aa6('0x43')][_0x3aa6('0x6b')][_0x3aa6('0x47')];_0x18154d+=0x1){socket[_0x3aa6('0x72')](_0x3aa6('0x75'),{'UserId':Number(_0x5924b1[_0x3aa6('0x43')][_0x3aa6('0x6b')][_0x18154d]),'WhatsappAccountId':Number(_0x5924b1['params']['id'])});}}else{socket[_0x3aa6('0x72')](_0x3aa6('0x75'),{'UserId':Number(_0x5924b1[_0x3aa6('0x43')]['ids']),'WhatsappAccountId':Number(_0x5924b1[_0x3aa6('0x56')]['id'])});}});}})[_0x3aa6('0x23')](respondWithStatusCode(_0x4c01b1,null))['catch'](handleError(_0x4c01b1,null));};exports[_0x3aa6('0x76')]=function(_0x1439f2,_0x21c819,_0x39aa86){var _0x2dc2d7={};var _0x8f7b59={};var _0x58200c;var _0x10fb91;return db[_0x3aa6('0x3d')][_0x3aa6('0x66')]({'where':{'id':_0x1439f2['params']['id']}})[_0x3aa6('0x23')](handleEntityNotFound(_0x21c819,null))[_0x3aa6('0x23')](function(_0x335f74){if(_0x335f74){_0x58200c=_0x335f74;_0x8f7b59[_0x3aa6('0x41')]=_['keys'](db[_0x3aa6('0x77')][_0x3aa6('0x3e')]);_0x8f7b59[_0x3aa6('0x43')]=_[_0x3aa6('0x58')](_0x1439f2[_0x3aa6('0x43')]);_0x8f7b59[_0x3aa6('0x4c')]=_[_0x3aa6('0x44')](_0x8f7b59[_0x3aa6('0x41')],_0x8f7b59[_0x3aa6('0x43')]);_0x2dc2d7[_0x3aa6('0x45')]=_['intersection'](_0x8f7b59[_0x3aa6('0x41')],qs[_0x3aa6('0x46')](_0x1439f2[_0x3aa6('0x43')][_0x3aa6('0x46')]));_0x2dc2d7[_0x3aa6('0x45')]=_0x2dc2d7[_0x3aa6('0x45')][_0x3aa6('0x47')]?_0x2dc2d7[_0x3aa6('0x45')]:_0x8f7b59[_0x3aa6('0x41')];_0x2dc2d7[_0x3aa6('0x68')]=qs['sort'](_0x1439f2[_0x3aa6('0x43')][_0x3aa6('0x4a')]);_0x2dc2d7['where']=qs[_0x3aa6('0x4c')](_[_0x3aa6('0x4d')](_0x1439f2[_0x3aa6('0x43')],_0x8f7b59[_0x3aa6('0x4c')]));if(_0x1439f2[_0x3aa6('0x43')][_0x3aa6('0x4e')]){_0x2dc2d7['where']=_['merge'](_0x2dc2d7[_0x3aa6('0x4b')],{'$or':_[_0x3aa6('0x42')](_0x2dc2d7[_0x3aa6('0x45')],function(_0x327cb1){var _0x570762={};_0x570762[_0x327cb1]={'$like':'%'+_0x1439f2[_0x3aa6('0x43')][_0x3aa6('0x4e')]+'%'};return _0x570762;})});}_0x2dc2d7=_[_0x3aa6('0x4f')]({},_0x2dc2d7,_0x1439f2[_0x3aa6('0x52')]);return _0x58200c[_0x3aa6('0x76')](_0x2dc2d7);}})['then'](function(_0x240176){if(_0x240176){_0x10fb91=_0x240176[_0x3aa6('0x47')];if(!_0x1439f2[_0x3aa6('0x43')]['hasOwnProperty'](_0x3aa6('0x49'))){_0x2dc2d7['limit']=qs[_0x3aa6('0x32')](_0x1439f2['query'][_0x3aa6('0x32')]);_0x2dc2d7[_0x3aa6('0x2f')]=qs[_0x3aa6('0x2f')](_0x1439f2['query']['offset']);}return _0x58200c[_0x3aa6('0x76')](_0x2dc2d7);}})[_0x3aa6('0x23')](function(_0x567776){if(_0x567776){return _0x567776?{'count':_0x10fb91,'rows':_0x567776}:null;}})[_0x3aa6('0x23')](respondWithResult(_0x21c819,null))['catch'](handleError(_0x21c819,null));};exports[_0x3aa6('0x78')]=function(_0x53fafe,_0x2fbe60){var _0x2f9775=_0x53fafe['params']['id'];var _0x34f7e2=_0x53fafe['body'];var _0xae3ec2=0xc8;var _0x5478ef=null;return db[_0x3aa6('0x79')][_0x3aa6('0x7a')]({'isolationLevel':db[_0x3aa6('0x79')]['Transaction'][_0x3aa6('0x7b')][_0x3aa6('0x7c')]},function(_0x3f0959){return db[_0x3aa6('0x3d')][_0x3aa6('0x66')]({'where':{'id':_0x2f9775},'transaction':_0x3f0959})[_0x3aa6('0x23')](function(_0xc103f6){if(_0xc103f6){return db[_0x3aa6('0x7d')]['destroy']({'where':{'WhatsappAccountId':_0x2f9775},'transaction':_0x3f0959})[_0x3aa6('0x23')](function(){var _0x3bf176=_[_0x3aa6('0x42')](_0x34f7e2,function(_0x3a1988){_0x3a1988[_0x3aa6('0x65')]=_0x2f9775;return _0x3a1988;});return db[_0x3aa6('0x7d')][_0x3aa6('0x7e')](_0x3bf176,{'transaction':_0x3f0959});});}else{_0xae3ec2=0x194;_0x5478ef=[];}});})['then'](function(){if(_0xae3ec2!==0x194){return db['WhatsappApplication']['findAndCountAll']({'where':{'WhatsappAccountId':_0x2f9775},'order':_0x3aa6('0x7f')})[_0x3aa6('0x23')](function(_0x8819a5){_0x5478ef=_0x8819a5;});}})['catch'](function(_0x1d9857){_0xae3ec2=0x1f4;logger[_0x3aa6('0x25')](_0x1d9857[_0x3aa6('0x39')]);if(_0x1d9857[_0x3aa6('0x51')]){delete _0x1d9857[_0x3aa6('0x51')];}_0x5478ef=_0x1d9857;})[_0x3aa6('0x80')](function(){if(_0x5478ef===null){_0x2fbe60[_0x3aa6('0x2b')](_0xae3ec2);}else{if(_0xae3ec2===0x1f4){_0x2fbe60[_0x3aa6('0x2c')](_0xae3ec2)[_0x3aa6('0x3a')](_0x5478ef);}else{_0x2fbe60['status'](_0xae3ec2)[_0x3aa6('0x2e')](_0x5478ef);}}});};exports[_0x3aa6('0x81')]=function(_0x41d8e0,_0x38ef91,_0x1c9864){var _0xdeae0e={};var _0x35529f={};var _0x3de628;var _0x400937;return db[_0x3aa6('0x3d')][_0x3aa6('0x66')]({'where':{'id':_0x41d8e0[_0x3aa6('0x56')]['id']}})['then'](handleEntityNotFound(_0x38ef91,null))[_0x3aa6('0x23')](function(_0x452155){if(_0x452155){_0x3de628=_0x452155;_0x35529f[_0x3aa6('0x41')]=_['keys'](db[_0x3aa6('0x7d')][_0x3aa6('0x3e')]);_0x35529f['query']=_['keys'](_0x41d8e0[_0x3aa6('0x43')]);_0x35529f[_0x3aa6('0x4c')]=_[_0x3aa6('0x44')](_0x35529f[_0x3aa6('0x41')],_0x35529f[_0x3aa6('0x43')]);_0xdeae0e[_0x3aa6('0x45')]=_[_0x3aa6('0x44')](_0x35529f['model'],qs[_0x3aa6('0x46')](_0x41d8e0[_0x3aa6('0x43')]['fields']));_0xdeae0e['attributes']=_0xdeae0e['attributes']['length']?_0xdeae0e['attributes']:_0x35529f[_0x3aa6('0x41')];_0xdeae0e[_0x3aa6('0x68')]=qs[_0x3aa6('0x4a')](_0x41d8e0[_0x3aa6('0x43')]['sort']);_0xdeae0e[_0x3aa6('0x4b')]=qs[_0x3aa6('0x4c')](_['pick'](_0x41d8e0['query'],_0x35529f[_0x3aa6('0x4c')]));if(_0x41d8e0['query'][_0x3aa6('0x4e')]){_0xdeae0e[_0x3aa6('0x4b')]=_['merge'](_0xdeae0e['where'],{'$or':_[_0x3aa6('0x42')](_0xdeae0e[_0x3aa6('0x45')],function(_0x4c01ab){var _0x5ac5b0={};_0x5ac5b0[_0x4c01ab]={'$like':'%'+_0x41d8e0[_0x3aa6('0x43')]['filter']+'%'};return _0x5ac5b0;})});}_0xdeae0e=_[_0x3aa6('0x4f')]({},_0xdeae0e,_0x41d8e0[_0x3aa6('0x52')]);return _0x3de628[_0x3aa6('0x81')](_0xdeae0e);}})[_0x3aa6('0x23')](function(_0x4deed5){if(_0x4deed5){_0x400937=_0x4deed5[_0x3aa6('0x47')];if(!_0x41d8e0['query'][_0x3aa6('0x48')](_0x3aa6('0x49'))){_0xdeae0e[_0x3aa6('0x32')]=qs[_0x3aa6('0x32')](_0x41d8e0[_0x3aa6('0x43')][_0x3aa6('0x32')]);_0xdeae0e[_0x3aa6('0x2f')]=qs[_0x3aa6('0x2f')](_0x41d8e0[_0x3aa6('0x43')]['offset']);}return _0x3de628['getApplications'](_0xdeae0e);}})[_0x3aa6('0x23')](function(_0x70fea){if(_0x70fea){return _0x70fea?{'count':_0x400937,'rows':_0x70fea}:null;}})['then'](respondWithResult(_0x38ef91,null))[_0x3aa6('0x5a')](handleError(_0x38ef91,null));};exports['notify']=function(_0x438d26,_0x5cd1af,_0x34f50f){var _0x2656cf={'channel':_0x3aa6('0x82')};var _0x421831=[];var _0x1b92c3=[];var _0x3a0305={};return db['WhatsappAccount'][_0x3aa6('0x59')]({'where':{'id':_0x438d26[_0x3aa6('0x56')]['id']},'include':[{'model':db[_0x3aa6('0x7d')],'as':_0x3aa6('0x83')}]})[_0x3aa6('0x23')](handleEntityNotFound(_0x5cd1af,null))[_0x3aa6('0x23')](function(_0x1040d5){_0x2656cf['account']=_0x1040d5;if(_0x2656cf['account']&&_0x2656cf['account'][_0x3aa6('0x3f')]==='sinch'&&_0x438d26['body'][_0x3aa6('0x84')]){if(_0x438d26['body'][_0x3aa6('0x84')]['length']===0x0)return;if(_0x438d26['body']['statuses'][0x0][_0x3aa6('0x85')]!=='read')return;return db[_0x3aa6('0x86')][_0x3aa6('0x36')]({'read':!![],'readAt':_0x438d26['body'][_0x3aa6('0x84')][0x0][_0x3aa6('0x87')]},{'where':{'messageId':_0x438d26[_0x3aa6('0x5c')][_0x3aa6('0x84')][0x0][_0x3aa6('0x88')]},'individualHooks':!![]})[_0x3aa6('0x23')](function(_0x387751){return _0x5cd1af['status'](0xc8)[_0x3aa6('0x2e')](_0x387751);});}_0x2656cf[_0x3aa6('0x89')]=_[_0x3aa6('0x8a')](_0x1040d5[_0x3aa6('0x83')],[_0x3aa6('0x7f')],['asc']);if(_0x2656cf[_0x3aa6('0x8b')][_0x3aa6('0x83')]){delete _0x2656cf[_0x3aa6('0x8b')]['Applications'];}return db[_0x3aa6('0x8c')][_0x3aa6('0x64')]()['then'](function(_0x153024){if(!_0x153024){throw new db[(_0x3aa6('0x8d'))][(_0x3aa6('0x8e'))](_0x3aa6('0x8f'));}_0x421831=_[_0x3aa6('0x90')](_['keys'](_0x153024),[_0x3aa6('0x91'),'updatedAt']);_0x1b92c3=_[_0x3aa6('0x90')](_[_0x3aa6('0x58')](_0x153024),[_0x3aa6('0x91'),_0x3aa6('0x92'),_0x3aa6('0x93'),_0x3aa6('0x94')]);_0x2656cf['body']={'mapKey':'mobile'};if(_0x2656cf['account']&&_0x2656cf[_0x3aa6('0x8b')][_0x3aa6('0x3f')]===_0x3aa6('0x95')){_0x2656cf[_0x3aa6('0x5c')]['from']=_0x438d26[_0x3aa6('0x5c')][_0x3aa6('0x96')]['replace'](_0x3aa6('0x97'),'');_0x2656cf[_0x3aa6('0x5c')]['body']=_0x438d26[_0x3aa6('0x5c')][_0x3aa6('0x98')];_0x2656cf[_0x3aa6('0x5c')][_0x3aa6('0x99')]=_0x438d26['body']['MessageSid'];}if(_0x2656cf[_0x3aa6('0x8b')]&&_0x2656cf[_0x3aa6('0x8b')][_0x3aa6('0x3f')]===_0x3aa6('0x9a')){_0x2656cf[_0x3aa6('0x5c')][_0x3aa6('0x9b')]=_0x438d26[_0x3aa6('0x5c')][_0x3aa6('0x9c')][0x0][_0x3aa6('0x9b')];_0x2656cf['body'][_0x3aa6('0x5c')]=_0x438d26[_0x3aa6('0x5c')][_0x3aa6('0x9c')][0x0][_0x3aa6('0x27')][_0x3aa6('0x5c')];_0x2656cf[_0x3aa6('0x5c')][_0x3aa6('0x99')]=_0x438d26[_0x3aa6('0x5c')][_0x3aa6('0x9c')][0x0][_0x3aa6('0x88')];}if(_0x2656cf[_0x3aa6('0x5c')]['id']){delete _0x2656cf['body']['id'];}if(_[_0x3aa6('0x9d')](_0x2656cf[_0x3aa6('0x5c')]['from'])){throw new db[(_0x3aa6('0x8d'))]['ValidationError'](_0x3aa6('0x9e'));}if(_[_0x3aa6('0x9d')](_0x2656cf[_0x3aa6('0x5c')][_0x3aa6('0x5c')])||_0x2656cf[_0x3aa6('0x5c')][_0x3aa6('0x5c')]===''){throw new db[(_0x3aa6('0x8d'))][(_0x3aa6('0x8e'))](_0x3aa6('0x9f'));}if(_[_0x3aa6('0x9d')](_0x2656cf[_0x3aa6('0x5c')][_0x3aa6('0xa0')])){throw new db[(_0x3aa6('0x8d'))]['ValidationError'](_0x3aa6('0xa1')+_0x1b92c3);}if(!_[_0x3aa6('0xa2')](_0x1b92c3,_0x2656cf[_0x3aa6('0x5c')][_0x3aa6('0xa0')])){throw new db[(_0x3aa6('0x8d'))][(_0x3aa6('0x8e'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1b92c3);}_0x3a0305[_0x2656cf[_0x3aa6('0x5c')][_0x3aa6('0xa0')]]=_0x2656cf[_0x3aa6('0x5c')]['from'];return db['CmList']['find']({'where':{'id':_0x2656cf[_0x3aa6('0x8b')][_0x3aa6('0x94')]},'include':[{'model':db[_0x3aa6('0x8c')],'as':'Contacts','where':_0x3a0305,'limit':0x1,'order':[[_0x3aa6('0x92'),_0x3aa6('0xa3')]]}]});})[_0x3aa6('0x23')](handleEntityNotFound(_0x5cd1af,null))[_0x3aa6('0x23')](function(_0x360bc1){if(_0x360bc1){_0x2656cf[_0x3aa6('0xa4')]=_[_0x3aa6('0x70')](_0x360bc1,[_0x3aa6('0xa5')]);if(_0x360bc1[_0x3aa6('0xa5')][_0x3aa6('0x47')]){return _0x360bc1[_0x3aa6('0xa5')][0x0];}var _0xd50754=_[_0x3aa6('0xa6')](_0x2656cf['body'],{'firstName':_0x2656cf['body']['from'],'ListId':_0x360bc1['id']});_0xd50754[_0x2656cf['body']['mapKey']]=_0x2656cf[_0x3aa6('0x5c')]['from'];return db[_0x3aa6('0x8c')][_0x3aa6('0x5b')](_0xd50754,{'fields':_0x421831,'raw':!![]});}})[_0x3aa6('0x23')](handleEntityNotFound(_0x5cd1af,null))[_0x3aa6('0x23')](function(_0x574a05){if(_0x574a05){_0x2656cf[_0x3aa6('0xa7')]=_0x574a05;var _0x3611f5={'ContactId':_0x574a05['id'],'phone':_0x2656cf[_0x3aa6('0x5c')][_0x3aa6('0x9b')],'WhatsappAccountId':_0x438d26[_0x3aa6('0x56')]['id']};var _0x44579b={'ContactId':_0x574a05['id'],'WhatsappAccountId':_0x438d26[_0x3aa6('0x56')]['id'],'closed':![]};return db[_0x3aa6('0xa8')][_0x3aa6('0x59')]({'where':_0x44579b})[_0x3aa6('0x23')](function(_0x55f14f){if(_0x55f14f){return[_0x55f14f,![]];}return db[_0x3aa6('0xa8')][_0x3aa6('0x5b')](_0x3611f5)[_0x3aa6('0x23')](function(_0x193055){return[_0x193055,!![]];});});}})['spread'](function(_0x1a9348,_0x37fcbf){_0x2656cf[_0x3aa6('0xa9')]=_0x1a9348['get']({'plain':!![]});_0x2656cf[_0x3aa6('0xa9')][_0x3aa6('0xaa')]=![];if(_0x37fcbf){if(_0x2656cf['account'][_0x3aa6('0xab')]){_0x2656cf['applications'][_0x3aa6('0xac')]({'id':0x0,'priority':_0x2656cf[_0x3aa6('0x89')]['length']+0x1,'app':_0x3aa6('0xad'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x2656cf[_0x3aa6('0xa9')]['created']=!![];}return db[_0x3aa6('0x86')][_0x3aa6('0x5b')]({'phone':_0x2656cf[_0x3aa6('0x5c')][_0x3aa6('0x9b')],'messageId':_0x2656cf[_0x3aa6('0x5c')][_0x3aa6('0x99')],'body':_0x2656cf[_0x3aa6('0x5c')][_0x3aa6('0x5c')],'WhatsappAccountId':_0x438d26[_0x3aa6('0x56')]['id'],'WhatsappInteractionId':_0x1a9348['id'],'direction':'in','ContactId':_0x1a9348[_0x3aa6('0xae')],'AttachmentId':_0x2656cf['body'][_0x3aa6('0xaf')]});})['then'](function(_0x790a5e){_0x2656cf[_0x3aa6('0x27')]=_0x790a5e;if(_0x2656cf['interaction'][_0x3aa6('0xb0')]){return db['User'][_0x3aa6('0x59')]({'attributes':['id',_0x3aa6('0x51')],'where':{'id':_0x2656cf[_0x3aa6('0xa9')][_0x3aa6('0xb0')]}})['then'](function(_0x57e316){if(_0x57e316){_0x2656cf[_0x3aa6('0x89')]['unshift']({'id':0x0,'priority':0x0,'app':_0x3aa6('0xb1'),'appdata':_0x57e316[_0x3aa6('0x51')]+','+(_0x2656cf['account'][_0x3aa6('0xb2')]||0xa),'interval':_0x3aa6('0xb3')});}return respondWithRpcPromise(_0x3aa6('0xb4'),_0x3aa6('0xb5'),_0x2656cf);});}return respondWithRpcPromise(_0x3aa6('0xb4'),'startRouting',_0x2656cf);})[_0x3aa6('0x23')](function(_0x2466eb){if(_0x2466eb){var _0x2febdc=0xc8;var _0x1bb897='receiveMessage';logger[_0x3aa6('0x28')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x1bb897,_0x2febdc,_0x3aa6('0xb6'));logger[_0x3aa6('0xb7')](_0x3aa6('0xb8'),_0x1bb897,_0x2febdc,'entity\x20found',JSON[_0x3aa6('0xb9')](_0x2466eb));if(_0x2656cf['account'][_0x3aa6('0x3f')]===_0x3aa6('0x95')){return _0x5cd1af[_0x3aa6('0x2c')](_0x2febdc)[_0x3aa6('0xba')]('Content-Type','text/xml')[_0x3aa6('0x3a')](_0x3aa6('0xbb'));}else{return _0x5cd1af[_0x3aa6('0x2c')](_0x2febdc)[_0x3aa6('0x2e')](_0x2466eb);}}});})[_0x3aa6('0x5a')](handleError(_0x5cd1af,null));};exports['send']=function(_0x1495fe,_0x284a83,_0x230272){var _0x49b154,_0x241052,_0x4c12ee;if(_[_0x3aa6('0x9d')](_0x1495fe[_0x3aa6('0x5c')][_0x3aa6('0x5c')])||_0x1495fe[_0x3aa6('0x5c')][_0x3aa6('0x5c')]===''){throw new db[(_0x3aa6('0x8d'))][(_0x3aa6('0x8e'))](_0x3aa6('0x9f'));}if(_[_0x3aa6('0x9d')](_0x1495fe[_0x3aa6('0x5c')]['to'])){throw new db[(_0x3aa6('0x8d'))]['ValidationError'](_0x3aa6('0xbc'));}_0x49b154=_0x1495fe[_0x3aa6('0x5c')]['to'];return db[_0x3aa6('0x3d')][_0x3aa6('0x59')]({'where':{'id':_0x1495fe[_0x3aa6('0x56')]['id']},'include':[{'model':db[_0x3aa6('0xbd')],'as':_0x3aa6('0xbe'),'include':[{'model':db[_0x3aa6('0x8c')],'as':_0x3aa6('0xa5'),'where':{'mobile':_0x49b154},'limit':0x1,'order':[[_0x3aa6('0x92'),_0x3aa6('0xa3')]]}]}]})['then'](handleEntityNotFound(_0x284a83,null))[_0x3aa6('0x23')](function(_0x55ac99){if(_0x55ac99&&_0x55ac99[_0x3aa6('0xbe')]){_0x241052=_0x55ac99[_0x3aa6('0x5e')]({'plain':!![]});if(_0x241052[_0x3aa6('0xbe')]&&_0x241052['List'][_0x3aa6('0xa5')][_0x3aa6('0x47')]){return _0x241052[_0x3aa6('0xbe')][_0x3aa6('0xa5')][0x0];}return db['CmContact'][_0x3aa6('0x5b')](_[_0x3aa6('0xa6')](_0x1495fe[_0x3aa6('0x5c')],{'firstName':_0x49b154,'mobile':_0x49b154,'phone':_0x49b154,'ListId':_0x241052[_0x3aa6('0x94')]}));}})[_0x3aa6('0x23')](handleEntityNotFound(_0x284a83,null))[_0x3aa6('0x23')](function(_0x58caf0){if(_0x58caf0){_0x4c12ee=_0x58caf0;return db[_0x3aa6('0xa8')]['find']({'where':{'ContactId':_0x4c12ee['id'],'closed':![],'WhatsappAccountId':_0x241052['id']}})[_0x3aa6('0x23')](function(_0x51ca62){if(_0x51ca62){return[_0x51ca62,![]];}return db['WhatsappInteraction'][_0x3aa6('0x5b')]({'UserId':_0x1495fe[_0x3aa6('0x5d')]['id'],'ContactId':_0x4c12ee['id'],'WhatsappAccountId':_0x241052['id'],'phone':_0x49b154,'firstMsgDirection':_0x3aa6('0xbf'),'Messages':[_[_0x3aa6('0x4f')](_0x1495fe['body'],{'read':![],'body':_0x1495fe['body'][_0x3aa6('0x5c')],'phone':_0x49b154,'WhatsappAccountId':_0x241052['id'],'UserId':_0x1495fe[_0x3aa6('0x5d')]['id'],'ContactId':_0x4c12ee['id']})]},{'include':[{'model':db[_0x3aa6('0x86')],'as':_0x3aa6('0xc0')}]})[_0x3aa6('0x23')](function(_0xf2a91){return[_0xf2a91,!![]];});});}})[_0x3aa6('0x71')](function(_0x5996be,_0x56af71){if(_0x56af71){return _0x5996be;}return db[_0x3aa6('0x86')][_0x3aa6('0x5b')](_[_0x3aa6('0x4f')](_0x1495fe[_0x3aa6('0x5c')],{'read':![],'body':_0x1495fe[_0x3aa6('0x5c')][_0x3aa6('0x5c')],'phone':_0x49b154,'WhatsappAccountId':_0x241052['id'],'WhatsappInteractionId':_0x5996be['id'],'UserId':_0x1495fe[_0x3aa6('0x5d')]['id'],'ContactId':_0x4c12ee['id']}))[_0x3aa6('0x23')](function(_0x221d91){_0x5996be['dataValues'][_0x3aa6('0xc0')]=[];_0x5996be[_0x3aa6('0xc1')][_0x3aa6('0xc0')][_0x3aa6('0xac')](_0x221d91[_0x3aa6('0xc1')]);return _0x5996be;});})['then'](respondWithResult(_0x284a83,null))['catch'](handleError(_0x284a83,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 13b026b..ad17ad7 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 _0xa3ae=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xa3ae,0x9f));var _0xea3a=function(_0x287528,_0x2fbba7){_0x287528=_0x287528-0x0;var _0xc05e28=_0xa3ae[_0x287528];return _0xc05e28;};'use strict';var EventEmitter=require(_0xea3a('0x0'));var WhatsappAccount=require(_0xea3a('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xea3a('0x2')](0x0);var events={'afterCreate':_0xea3a('0x3'),'afterUpdate':_0xea3a('0x4'),'afterDestroy':_0xea3a('0x5')};function emitEvent(_0x1443ca){return function(_0x4274e8,_0x3dcb07,_0x7591f3){WhatsappAccountEvents[_0xea3a('0x6')](_0x1443ca+':'+_0x4274e8['id'],_0x4274e8);WhatsappAccountEvents[_0xea3a('0x6')](_0x1443ca,_0x4274e8);_0x7591f3(null);};}for(var e in events){if(events[_0xea3a('0x7')](e)){var event=events[e];WhatsappAccount[_0xea3a('0x8')](e,emitEvent(event));}}module[_0xea3a('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0x9fb3=['events','WhatsappAccount','save','update','emit','hook','exports'];(function(_0x29be0d,_0x4177df){var _0x9c5f5=function(_0x1adeda){while(--_0x1adeda){_0x29be0d['push'](_0x29be0d['shift']());}};_0x9c5f5(++_0x4177df);}(_0x9fb3,0x70));var _0x39fb=function(_0x7c62fa,_0x33884d){_0x7c62fa=_0x7c62fa-0x0;var _0x4c2809=_0x9fb3[_0x7c62fa];return _0x4c2809;};'use strict';var EventEmitter=require(_0x39fb('0x0'));var WhatsappAccount=require('../../mysqldb')['db'][_0x39fb('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x39fb('0x2'),'afterUpdate':_0x39fb('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3a7d8c){return function(_0xa4f797,_0x404bbf,_0xa35422){WhatsappAccountEvents[_0x39fb('0x4')](_0x3a7d8c+':'+_0xa4f797['id'],_0xa4f797);WhatsappAccountEvents[_0x39fb('0x4')](_0x3a7d8c,_0xa4f797);_0xa35422(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x39fb('0x5')](e,emitEvent(event));}}module[_0x39fb('0x6')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 99ffed0..b1f26bb 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 _0x5682=['define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes'];(function(_0x32055a,_0x301b19){var _0x3f1a9d=function(_0x3f7c70){while(--_0x3f7c70){_0x32055a['push'](_0x32055a['shift']());}};_0x3f1a9d(++_0x301b19);}(_0x5682,0x129));var _0x2568=function(_0x156861,_0x23f9b3){_0x156861=_0x156861-0x0;var _0xfd48d1=_0x5682[_0x156861];return _0xfd48d1;};'use strict';var _=require(_0x2568('0x0'));var util=require(_0x2568('0x1'));var logger=require(_0x2568('0x2'))(_0x2568('0x3'));var moment=require(_0x2568('0x4'));var BPromise=require(_0x2568('0x5'));var rp=require(_0x2568('0x6'));var fs=require('fs');var path=require(_0x2568('0x7'));var rimraf=require(_0x2568('0x8'));var config=require(_0x2568('0x9'));var attributes=require(_0x2568('0xa'));module['exports']=function(_0x383cd0,_0x10543d){return _0x383cd0[_0x2568('0xb')](_0x2568('0xc'),attributes,{'tableName':_0x2568('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ad2=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappAccount.attributes','define','lodash'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4ad2,0x199));var _0x24ad=function(_0x60bd6,_0x55cdd8){_0x60bd6=_0x60bd6-0x0;var _0x2a8061=_0x4ad2[_0x60bd6];return _0x2a8061;};'use strict';var _=require(_0x24ad('0x0'));var util=require('util');var logger=require(_0x24ad('0x1'))(_0x24ad('0x2'));var moment=require(_0x24ad('0x3'));var BPromise=require(_0x24ad('0x4'));var rp=require(_0x24ad('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x24ad('0x6'));var config=require(_0x24ad('0x7'));var attributes=require(_0x24ad('0x8'));module['exports']=function(_0x2c526a,_0x815ea3){return _0x2c526a[_0x24ad('0x9')]('WhatsappAccount',attributes,{'tableName':'whatsapp_accounts','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 89e210f..99ff3e3 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 _0x46ef=['raw','attributes','include','map','model','lodash','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./whatsappAccount.socket','register','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','ShowWhatsappAccount','WhatsappAccount','options'];(function(_0xb14249,_0x2e85c4){var _0x2bcf5e=function(_0x14e1e3){while(--_0x14e1e3){_0xb14249['push'](_0xb14249['shift']());}};_0x2bcf5e(++_0x2e85c4);}(_0x46ef,0xaa));var _0xf46e=function(_0xc90511,_0x526d31){_0xc90511=_0xc90511-0x0;var _0x4985b6=_0x46ef[_0xc90511];return _0x4985b6;};'use strict';var _=require(_0xf46e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf46e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf46e('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf46e('0x3'))(_0xf46e('0x4'));var config=require(_0xf46e('0x5'));var jayson=require(_0xf46e('0x6'));var client=jayson['client'][_0xf46e('0x7')]({'port':0x232a});config[_0xf46e('0x8')]=_[_0xf46e('0x9')](config[_0xf46e('0x8')],{'host':_0xf46e('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf46e('0x8')]));require(_0xf46e('0xb'))[_0xf46e('0xc')](socket);function respondWithRpcPromise(_0xbfe2af,_0xb04b3,_0x4b8c2e){return new BPromise(function(_0xd797d6,_0x21e7c7){return client['request'](_0xbfe2af,_0x4b8c2e)[_0xf46e('0xd')](function(_0x33aa44){logger[_0xf46e('0xe')]('WhatsappAccount,\x20%s,\x20%s',_0xb04b3,_0xf46e('0xf'));logger[_0xf46e('0x10')](_0xf46e('0x11'),_0xb04b3,_0xf46e('0xf'),JSON[_0xf46e('0x12')](_0x33aa44));if(_0x33aa44[_0xf46e('0x13')]){if(_0x33aa44[_0xf46e('0x13')][_0xf46e('0x14')]===0x1f4){logger[_0xf46e('0x13')](_0xf46e('0x15'),_0xb04b3,_0x33aa44[_0xf46e('0x13')][_0xf46e('0x16')]);return _0x21e7c7(_0x33aa44[_0xf46e('0x13')][_0xf46e('0x16')]);}logger[_0xf46e('0x13')](_0xf46e('0x15'),_0xb04b3,_0x33aa44[_0xf46e('0x13')][_0xf46e('0x16')]);return _0xd797d6(_0x33aa44[_0xf46e('0x13')][_0xf46e('0x16')]);}else{logger['info'](_0xf46e('0x15'),_0xb04b3,_0xf46e('0xf'));_0xd797d6(_0x33aa44[_0xf46e('0x17')][_0xf46e('0x16')]);}})[_0xf46e('0x18')](function(_0x2c9299){logger[_0xf46e('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0xb04b3,_0x2c9299);_0x21e7c7(_0x2c9299);});});}exports[_0xf46e('0x19')]=function(_0x1bdade){var _0x190ca6=this;return new Promise(function(_0x22fee0,_0x4ca2e4){return db[_0xf46e('0x1a')]['find']({'raw':_0x1bdade[_0xf46e('0x1b')]?_0x1bdade[_0xf46e('0x1b')][_0xf46e('0x1c')]===undefined?!![]:![]:!![],'where':_0x1bdade[_0xf46e('0x1b')]?_0x1bdade['options']['where']||null:null,'attributes':_0x1bdade[_0xf46e('0x1b')]?_0x1bdade[_0xf46e('0x1b')][_0xf46e('0x1d')]||null:null,'include':_0x1bdade[_0xf46e('0x1b')]?_0x1bdade[_0xf46e('0x1b')][_0xf46e('0x1e')]?_[_0xf46e('0x1f')](_0x1bdade[_0xf46e('0x1b')][_0xf46e('0x1e')],function(_0x9418fd){return{'model':db[_0x9418fd[_0xf46e('0x20')]],'as':_0x9418fd['as'],'attributes':_0x9418fd[_0xf46e('0x1d')],'include':_0x9418fd['include']?_['map'](_0x9418fd[_0xf46e('0x1e')],function(_0x38f146){return{'model':db[_0x38f146[_0xf46e('0x20')]],'as':_0x38f146['as'],'attributes':_0x38f146[_0xf46e('0x1d')],'include':_0x38f146['include']?_[_0xf46e('0x1f')](_0x38f146[_0xf46e('0x1e')],function(_0x2e65b0){return{'model':db[_0x2e65b0[_0xf46e('0x20')]],'as':_0x2e65b0['as'],'attributes':_0x2e65b0[_0xf46e('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e7d0c){logger[_0xf46e('0xe')](_0xf46e('0x19'),_0x1bdade);logger['debug'](_0xf46e('0x19'),_0x1bdade,JSON[_0xf46e('0x12')](_0x5e7d0c));_0x22fee0(_0x5e7d0c);})[_0xf46e('0x18')](function(_0x4751f9){logger['error']('ShowWhatsappAccount',_0x4751f9['message'],_0x1bdade);_0x4ca2e4(_0x190ca6[_0xf46e('0x13')](0x1f4,_0x4751f9['message']));});});}; \ No newline at end of file +var _0x33d0=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','request','then','info','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','WhatsappAccount,\x20%s,\x20%s','message','result','catch','options','where','include','map','model','attributes','ShowWhatsappAccount','stringify','lodash','util','moment','bluebird'];(function(_0x270b43,_0x186ab0){var _0x154dd7=function(_0x20291e){while(--_0x20291e){_0x270b43['push'](_0x270b43['shift']());}};_0x154dd7(++_0x186ab0);}(_0x33d0,0xb0));var _0x033d=function(_0x4ef734,_0x5826d){_0x4ef734=_0x4ef734-0x0;var _0x33a7cb=_0x33d0[_0x4ef734];return _0x33a7cb;};'use strict';var _=require(_0x033d('0x0'));var util=require(_0x033d('0x1'));var moment=require(_0x033d('0x2'));var BPromise=require(_0x033d('0x3'));var rs=require(_0x033d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x033d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x033d('0x6'))(_0x033d('0x7'));var config=require(_0x033d('0x8'));var jayson=require(_0x033d('0x9'));var client=jayson[_0x033d('0xa')][_0x033d('0xb')]({'port':0x232a});config[_0x033d('0xc')]=_[_0x033d('0xd')](config[_0x033d('0xc')],{'host':_0x033d('0xe'),'port':0x18eb});var socket=require(_0x033d('0xf'))(new Redis(config[_0x033d('0xc')]));require(_0x033d('0x10'))['register'](socket);function respondWithRpcPromise(_0x47c049,_0x76c66,_0x41b24b){return new BPromise(function(_0x3a2c47,_0x57e9e4){return client[_0x033d('0x11')](_0x47c049,_0x41b24b)[_0x033d('0x12')](function(_0x4c9c05){logger[_0x033d('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x76c66,'request\x20sent');logger[_0x033d('0x14')](_0x033d('0x15'),_0x76c66,_0x033d('0x16'),JSON['stringify'](_0x4c9c05));if(_0x4c9c05[_0x033d('0x17')]){if(_0x4c9c05[_0x033d('0x17')]['code']===0x1f4){logger[_0x033d('0x17')](_0x033d('0x18'),_0x76c66,_0x4c9c05['error'][_0x033d('0x19')]);return _0x57e9e4(_0x4c9c05[_0x033d('0x17')]['message']);}logger['error'](_0x033d('0x18'),_0x76c66,_0x4c9c05[_0x033d('0x17')]['message']);return _0x3a2c47(_0x4c9c05[_0x033d('0x17')][_0x033d('0x19')]);}else{logger[_0x033d('0x13')](_0x033d('0x18'),_0x76c66,_0x033d('0x16'));_0x3a2c47(_0x4c9c05[_0x033d('0x1a')][_0x033d('0x19')]);}})[_0x033d('0x1b')](function(_0x67dd00){logger['error'](_0x033d('0x18'),_0x76c66,_0x67dd00);_0x57e9e4(_0x67dd00);});});}exports['ShowWhatsappAccount']=function(_0x236652){var _0x6e5794=this;return new Promise(function(_0x125e72,_0x3934fb){return db['WhatsappAccount']['find']({'raw':_0x236652[_0x033d('0x1c')]?_0x236652[_0x033d('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x236652[_0x033d('0x1c')]?_0x236652['options'][_0x033d('0x1d')]||null:null,'attributes':_0x236652[_0x033d('0x1c')]?_0x236652[_0x033d('0x1c')]['attributes']||null:null,'include':_0x236652[_0x033d('0x1c')]?_0x236652['options'][_0x033d('0x1e')]?_[_0x033d('0x1f')](_0x236652[_0x033d('0x1c')][_0x033d('0x1e')],function(_0x2e2190){return{'model':db[_0x2e2190[_0x033d('0x20')]],'as':_0x2e2190['as'],'attributes':_0x2e2190[_0x033d('0x21')],'include':_0x2e2190['include']?_[_0x033d('0x1f')](_0x2e2190[_0x033d('0x1e')],function(_0x2d742b){return{'model':db[_0x2d742b[_0x033d('0x20')]],'as':_0x2d742b['as'],'attributes':_0x2d742b[_0x033d('0x21')],'include':_0x2d742b['include']?_['map'](_0x2d742b[_0x033d('0x1e')],function(_0x4ec969){return{'model':db[_0x4ec969[_0x033d('0x20')]],'as':_0x4ec969['as'],'attributes':_0x4ec969[_0x033d('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d33bb){logger[_0x033d('0x13')](_0x033d('0x22'),_0x236652);logger[_0x033d('0x14')](_0x033d('0x22'),_0x236652,JSON[_0x033d('0x23')](_0x4d33bb));_0x125e72(_0x4d33bb);})[_0x033d('0x1b')](function(_0x3f7f36){logger[_0x033d('0x17')](_0x033d('0x22'),_0x3f7f36[_0x033d('0x19')],_0x236652);_0x3934fb(_0x6e5794[_0x033d('0x17')](0x1f4,_0x3f7f36['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 4ba74ce..3b1ec3d 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 _0xbc3a=['whatsappAccount:','./whatsappAccount.events','remove','update','emit','removeListener','length'];(function(_0x520180,_0x7e19db){var _0x318860=function(_0x5d9b9a){while(--_0x5d9b9a){_0x520180['push'](_0x520180['shift']());}};_0x318860(++_0x7e19db);}(_0xbc3a,0x19e));var _0xabc3=function(_0x1c3d8a,_0x33ea3e){_0x1c3d8a=_0x1c3d8a-0x0;var _0x2b359=_0xbc3a[_0x1c3d8a];return _0x2b359;};'use strict';var WhatsappAccountEvents=require(_0xabc3('0x0'));var events=['save',_0xabc3('0x1'),_0xabc3('0x2')];function createListener(_0x4b7f22,_0xf48752){return function(_0x2a6215){_0xf48752[_0xabc3('0x3')](_0x4b7f22,_0x2a6215);};}function removeListener(_0x99d916,_0x1f29a5){return function(){WhatsappAccountEvents[_0xabc3('0x4')](_0x99d916,_0x1f29a5);};}exports['register']=function(_0x593cdb){for(var _0x58a1c0=0x0,_0x5c9a32=events[_0xabc3('0x5')];_0x58a1c0<_0x5c9a32;_0x58a1c0++){var _0x5c7731=events[_0x58a1c0];var _0x593556=createListener(_0xabc3('0x6')+_0x5c7731,_0x593cdb);WhatsappAccountEvents['on'](_0x5c7731,_0x593556);}}; \ No newline at end of file +var _0xda59=['update','emit','removeListener','register','length','whatsappAccount:','./whatsappAccount.events','save','remove'];(function(_0x2a4206,_0x10c0ff){var _0x4cbb46=function(_0x57d41e){while(--_0x57d41e){_0x2a4206['push'](_0x2a4206['shift']());}};_0x4cbb46(++_0x10c0ff);}(_0xda59,0x11d));var _0x9da5=function(_0x4d49da,_0x38f2bf){_0x4d49da=_0x4d49da-0x0;var _0x55f8fe=_0xda59[_0x4d49da];return _0x55f8fe;};'use strict';var WhatsappAccountEvents=require(_0x9da5('0x0'));var events=[_0x9da5('0x1'),_0x9da5('0x2'),_0x9da5('0x3')];function createListener(_0x1eef54,_0x1039f7){return function(_0x4eafde){_0x1039f7[_0x9da5('0x4')](_0x1eef54,_0x4eafde);};}function removeListener(_0x563497,_0x508c84){return function(){WhatsappAccountEvents[_0x9da5('0x5')](_0x563497,_0x508c84);};}exports[_0x9da5('0x6')]=function(_0x58f4c8){for(var _0x49ecf0=0x0,_0x3d8de8=events[_0x9da5('0x7')];_0x49ecf0<_0x3d8de8;_0x49ecf0++){var _0x31f0ba=events[_0x49ecf0];var _0x5daf35=createListener(_0x9da5('0x8')+_0x31f0ba,_0x58f4c8);WhatsappAccountEvents['on'](_0x31f0ba,_0x5daf35);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 60805fc..75c6c85 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 _0xdfdd=['multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x3d9019,_0x5ca52b){var _0x295666=function(_0x5d9db2){while(--_0x5d9db2){_0x3d9019['push'](_0x3d9019['shift']());}};_0x295666(++_0x5ca52b);}(_0xdfdd,0x18f));var _0xddfd=function(_0x5036ed,_0x5f5239){_0x5036ed=_0x5036ed-0x0;var _0x36d20e=_0xdfdd[_0x5036ed];return _0x36d20e;};'use strict';var multer=require(_0xddfd('0x0'));var util=require('util');var path=require(_0xddfd('0x1'));var timeout=require(_0xddfd('0x2'));var express=require(_0xddfd('0x3'));var router=express['Router']();var fs_extra=require(_0xddfd('0x4'));var auth=require(_0xddfd('0x5'));var interaction=require(_0xddfd('0x6'));var config=require(_0xddfd('0x7'));var controller=require(_0xddfd('0x8'));router[_0xddfd('0x9')]('/',auth[_0xddfd('0xa')](),controller[_0xddfd('0xb')]);router[_0xddfd('0x9')](_0xddfd('0xc'),auth[_0xddfd('0xa')](),controller[_0xddfd('0xd')]);router[_0xddfd('0xe')]('/',auth[_0xddfd('0xa')](),controller[_0xddfd('0xf')]);router[_0xddfd('0x10')]('/:id',auth[_0xddfd('0xa')](),controller[_0xddfd('0x11')]);router[_0xddfd('0x12')]('/:id',auth[_0xddfd('0xa')](),controller[_0xddfd('0x13')]);module[_0xddfd('0x14')]=router; \ No newline at end of file +var _0x8702=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','destroy','exports'];(function(_0xc647ee,_0x3a5a60){var _0x1aa825=function(_0x3b4544){while(--_0x3b4544){_0xc647ee['push'](_0xc647ee['shift']());}};_0x1aa825(++_0x3a5a60);}(_0x8702,0xa8));var _0x2870=function(_0x3f3130,_0x4db58a){_0x3f3130=_0x3f3130-0x0;var _0x1bc0c8=_0x8702[_0x3f3130];return _0x1bc0c8;};'use strict';var multer=require(_0x2870('0x0'));var util=require(_0x2870('0x1'));var path=require(_0x2870('0x2'));var timeout=require(_0x2870('0x3'));var express=require(_0x2870('0x4'));var router=express[_0x2870('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2870('0x6'));var interaction=require(_0x2870('0x7'));var config=require(_0x2870('0x8'));var controller=require(_0x2870('0x9'));router['get']('/',auth[_0x2870('0xa')](),controller[_0x2870('0xb')]);router[_0x2870('0xc')](_0x2870('0xd'),auth['isAuthenticated'](),controller[_0x2870('0xe')]);router[_0x2870('0xf')]('/',auth[_0x2870('0xa')](),controller[_0x2870('0x10')]);router[_0x2870('0x11')](_0x2870('0xd'),auth[_0x2870('0xa')](),controller[_0x2870('0x12')]);router['delete'](_0x2870('0xd'),auth['isAuthenticated'](),controller[_0x2870('0x13')]);module[_0x2870('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 83b1c1d..944da65 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 _0xedac=['STRING','noop','TEXT','*,*,*,*','INTEGER'];(function(_0xa3fac1,_0x28edde){var _0x1c0ad4=function(_0xec9a44){while(--_0xec9a44){_0xa3fac1['push'](_0xa3fac1['shift']());}};_0x1c0ad4(++_0x28edde);}(_0xedac,0x108));var _0xceda=function(_0x22dae3,_0x3639a4){_0x22dae3=_0x22dae3-0x0;var _0x3d34c7=_0xedac[_0x22dae3];return _0x3d34c7;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xceda('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0xceda('0x1')],'allowNull':![],'defaultValue':_0xceda('0x2')},'appdata':{'type':Sequelize[_0xceda('0x3')]()},'description':{'type':Sequelize[_0xceda('0x1')]},'interval':{'type':Sequelize[_0xceda('0x1')],'defaultValue':_0xceda('0x4')}}; \ No newline at end of file +var _0xcd55=['INTEGER','STRING','TEXT','*,*,*,*','exports'];(function(_0x5de7ea,_0x67ba6a){var _0x12d8b0=function(_0x253ce3){while(--_0x253ce3){_0x5de7ea['push'](_0x5de7ea['shift']());}};_0x12d8b0(++_0x67ba6a);}(_0xcd55,0x14e));var _0x5cd5=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xcd55[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require('sequelize');module[_0x5cd5('0x0')]={'priority':{'type':Sequelize[_0x5cd5('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x5cd5('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x5cd5('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x5cd5('0x2')],'defaultValue':_0x5cd5('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 68e48fa..b086274 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 _0xb8cb=['lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','then','destroy','error','name','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra'];(function(_0x1afabc,_0x320c2b){var _0x440f44=function(_0x3017bd){while(--_0x3017bd){_0x1afabc['push'](_0x1afabc['shift']());}};_0x440f44(++_0x320c2b);}(_0xb8cb,0xd9));var _0xbb8c=function(_0x4ad0c4,_0x3181ab){_0x4ad0c4=_0x4ad0c4-0x0;var _0x133779=_0xb8cb[_0x4ad0c4];return _0x133779;};'use strict';var emlformat=require(_0xbb8c('0x0'));var rimraf=require(_0xbb8c('0x1'));var zipdir=require(_0xbb8c('0x2'));var jsonpatch=require(_0xbb8c('0x3'));var rp=require(_0xbb8c('0x4'));var moment=require(_0xbb8c('0x5'));var BPromise=require(_0xbb8c('0x6'));var Mustache=require('mustache');var util=require(_0xbb8c('0x7'));var path=require(_0xbb8c('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbb8c('0x9'));var fs=require('fs');var fs_extra=require(_0xbb8c('0xa'));var _=require(_0xbb8c('0xb'));var squel=require('squel');var crypto=require(_0xbb8c('0xc'));var jsforce=require(_0xbb8c('0xd'));var deskjs=require(_0xbb8c('0xe'));var toCsv=require(_0xbb8c('0xf'));var querystring=require(_0xbb8c('0x10'));var Papa=require(_0xbb8c('0x11'));var Redis=require(_0xbb8c('0x12'));var authService=require(_0xbb8c('0x13'));var qs=require(_0xbb8c('0x14'));var as=require(_0xbb8c('0x15'));var hardwareService=require(_0xbb8c('0x16'));var logger=require(_0xbb8c('0x17'))('api');var utils=require(_0xbb8c('0x18'));var config=require(_0xbb8c('0x19'));var licenseUtil=require(_0xbb8c('0x1a'));var db=require(_0xbb8c('0x1b'))['db'];function respondWithStatusCode(_0x3ac367,_0x57e624){_0x57e624=_0x57e624||0xcc;return function(_0x275252){if(_0x275252){return _0x3ac367[_0xbb8c('0x1c')](_0x57e624);}return _0x3ac367[_0xbb8c('0x1d')](_0x57e624)[_0xbb8c('0x1e')]();};}function respondWithResult(_0x3a0fe2,_0x151bf2){_0x151bf2=_0x151bf2||0xc8;return function(_0x1de932){if(_0x1de932){return _0x3a0fe2['status'](_0x151bf2)[_0xbb8c('0x1f')](_0x1de932);}};}function respondWithFilteredResult(_0x1e6dc9,_0x425891){return function(_0x403710){if(_0x403710){var _0x2cc079=typeof _0x425891[_0xbb8c('0x20')]===_0xbb8c('0x21')&&typeof _0x425891[_0xbb8c('0x22')]===_0xbb8c('0x21');var _0x187ee5=_0x403710['count'];var _0x67712e=_0x2cc079?0x0:_0x425891[_0xbb8c('0x20')];var _0x2a02c9=_0x2cc079?_0x403710[_0xbb8c('0x23')]:_0x425891[_0xbb8c('0x20')]+_0x425891[_0xbb8c('0x22')];var _0x520ea9;if(_0x2a02c9>=_0x187ee5){_0x2a02c9=_0x187ee5;_0x520ea9=0xc8;}else{_0x520ea9=0xce;}_0x1e6dc9[_0xbb8c('0x1d')](_0x520ea9);return _0x1e6dc9[_0xbb8c('0x24')]('Content-Range',_0x67712e+'-'+_0x2a02c9+'/'+_0x187ee5)[_0xbb8c('0x1f')](_0x403710);}return null;};}function patchUpdates(_0x5e2803){return function(_0x44a56e){try{jsonpatch['apply'](_0x44a56e,_0x5e2803,!![]);}catch(_0x32b961){return BPromise[_0xbb8c('0x25')](_0x32b961);}return _0x44a56e[_0xbb8c('0x26')]();};}function saveUpdates(_0x546215,_0x4b4100){return function(_0x10f265){if(_0x10f265){return _0x10f265['update'](_0x546215)[_0xbb8c('0x27')](function(_0x1b764d){return _0x1b764d;});}return null;};}function removeEntity(_0x36163c,_0xec7fb5){return function(_0x362a2f){if(_0x362a2f){return _0x362a2f[_0xbb8c('0x28')]()[_0xbb8c('0x27')](function(){_0x36163c['status'](0xcc)[_0xbb8c('0x1e')]();});}};}function handleEntityNotFound(_0x5f4f96,_0x4a5684){return function(_0xe7475d){if(!_0xe7475d){_0x5f4f96['sendStatus'](0x194);}return _0xe7475d;};}function handleError(_0x47fb37,_0x26ea5f){_0x26ea5f=_0x26ea5f||0x1f4;return function(_0x283ec3){logger[_0xbb8c('0x29')](_0x283ec3['stack']);if(_0x283ec3['name']){delete _0x283ec3[_0xbb8c('0x2a')];}_0x47fb37[_0xbb8c('0x1d')](_0x26ea5f)['send'](_0x283ec3);};}exports[_0xbb8c('0x2b')]=function(_0x23bf3d,_0x292f11){var _0x4f0f13={},_0x271ad7={},_0x1e0e3={'count':0x0,'rows':[]};var _0x219976=_[_0xbb8c('0x2c')](db[_0xbb8c('0x2d')][_0xbb8c('0x2e')],function(_0x2f3db6){return{'name':_0x2f3db6[_0xbb8c('0x2f')],'type':_0x2f3db6[_0xbb8c('0x30')][_0xbb8c('0x31')]};});_0x271ad7['model']=_['map'](_0x219976,_0xbb8c('0x2a'));_0x271ad7[_0xbb8c('0x32')]=_[_0xbb8c('0x33')](_0x23bf3d[_0xbb8c('0x32')]);_0x271ad7[_0xbb8c('0x34')]=_['intersection'](_0x271ad7[_0xbb8c('0x35')],_0x271ad7[_0xbb8c('0x32')]);_0x4f0f13[_0xbb8c('0x36')]=_[_0xbb8c('0x37')](_0x271ad7[_0xbb8c('0x35')],qs[_0xbb8c('0x38')](_0x23bf3d[_0xbb8c('0x32')][_0xbb8c('0x38')]));_0x4f0f13[_0xbb8c('0x36')]=_0x4f0f13['attributes'][_0xbb8c('0x39')]?_0x4f0f13[_0xbb8c('0x36')]:_0x271ad7[_0xbb8c('0x35')];if(!_0x23bf3d['query']['hasOwnProperty'](_0xbb8c('0x3a'))){_0x4f0f13[_0xbb8c('0x22')]=qs[_0xbb8c('0x22')](_0x23bf3d[_0xbb8c('0x32')]['limit']);_0x4f0f13[_0xbb8c('0x20')]=qs[_0xbb8c('0x20')](_0x23bf3d[_0xbb8c('0x32')][_0xbb8c('0x20')]);}_0x4f0f13[_0xbb8c('0x3b')]=qs['sort'](_0x23bf3d[_0xbb8c('0x32')][_0xbb8c('0x3c')]);_0x4f0f13[_0xbb8c('0x3d')]=qs[_0xbb8c('0x34')](_['pick'](_0x23bf3d[_0xbb8c('0x32')],_0x271ad7[_0xbb8c('0x34')]),_0x219976);if(_0x23bf3d[_0xbb8c('0x32')][_0xbb8c('0x3e')]){_0x4f0f13[_0xbb8c('0x3d')]=_[_0xbb8c('0x3f')](_0x4f0f13[_0xbb8c('0x3d')],{'$or':_[_0xbb8c('0x2c')](_0x219976,function(_0x423bba){if(_0x423bba[_0xbb8c('0x30')]!==_0xbb8c('0x40')){var _0x1f4d03={};_0x1f4d03[_0x423bba['name']]={'$like':'%'+_0x23bf3d[_0xbb8c('0x32')][_0xbb8c('0x3e')]+'%'};return _0x1f4d03;}})});}_0x4f0f13=_[_0xbb8c('0x3f')]({},_0x4f0f13,_0x23bf3d[_0xbb8c('0x41')]);var _0x55a698={'where':_0x4f0f13[_0xbb8c('0x3d')]};return db['WhatsappApplication']['count'](_0x55a698)[_0xbb8c('0x27')](function(_0x1c5197){_0x1e0e3[_0xbb8c('0x23')]=_0x1c5197;if(_0x23bf3d['query'][_0xbb8c('0x42')]){_0x4f0f13[_0xbb8c('0x43')]=[{'all':!![]}];}return db['WhatsappApplication'][_0xbb8c('0x44')](_0x4f0f13);})[_0xbb8c('0x27')](function(_0x3b8311){_0x1e0e3[_0xbb8c('0x45')]=_0x3b8311;return _0x1e0e3;})['then'](respondWithFilteredResult(_0x292f11,_0x4f0f13))[_0xbb8c('0x46')](handleError(_0x292f11,null));};exports[_0xbb8c('0x47')]=function(_0x17ffa5,_0x5b662e){var _0xa601d5={'raw':!![],'where':{'id':_0x17ffa5['params']['id']}},_0xff11d5={};_0xff11d5['model']=_[_0xbb8c('0x33')](db[_0xbb8c('0x2d')]['rawAttributes']);_0xff11d5['query']=_[_0xbb8c('0x33')](_0x17ffa5['query']);_0xff11d5[_0xbb8c('0x34')]=_['intersection'](_0xff11d5[_0xbb8c('0x35')],_0xff11d5['query']);_0xa601d5[_0xbb8c('0x36')]=_[_0xbb8c('0x37')](_0xff11d5[_0xbb8c('0x35')],qs[_0xbb8c('0x38')](_0x17ffa5[_0xbb8c('0x32')][_0xbb8c('0x38')]));_0xa601d5['attributes']=_0xa601d5[_0xbb8c('0x36')]['length']?_0xa601d5[_0xbb8c('0x36')]:_0xff11d5[_0xbb8c('0x35')];if(_0x17ffa5[_0xbb8c('0x32')][_0xbb8c('0x42')]){_0xa601d5[_0xbb8c('0x43')]=[{'all':!![]}];}_0xa601d5=_[_0xbb8c('0x3f')]({},_0xa601d5,_0x17ffa5['options']);return db['WhatsappApplication'][_0xbb8c('0x48')](_0xa601d5)[_0xbb8c('0x27')](handleEntityNotFound(_0x5b662e,null))['then'](respondWithResult(_0x5b662e,null))[_0xbb8c('0x46')](handleError(_0x5b662e,null));};exports[_0xbb8c('0x49')]=function(_0x3f0a8b,_0x599e51){return db[_0xbb8c('0x2d')]['create'](_0x3f0a8b[_0xbb8c('0x4a')],{})[_0xbb8c('0x27')](respondWithResult(_0x599e51,0xc9))[_0xbb8c('0x46')](handleError(_0x599e51,null));};exports['update']=function(_0x1953f7,_0x295bb0){if(_0x1953f7[_0xbb8c('0x4a')]['id']){delete _0x1953f7[_0xbb8c('0x4a')]['id'];}return db[_0xbb8c('0x2d')][_0xbb8c('0x48')]({'where':{'id':_0x1953f7[_0xbb8c('0x4b')]['id']}})[_0xbb8c('0x27')](handleEntityNotFound(_0x295bb0,null))[_0xbb8c('0x27')](saveUpdates(_0x1953f7[_0xbb8c('0x4a')],null))['then'](respondWithResult(_0x295bb0,null))[_0xbb8c('0x46')](handleError(_0x295bb0,null));};exports[_0xbb8c('0x28')]=function(_0x4400c7,_0x5c3373){return db[_0xbb8c('0x2d')][_0xbb8c('0x48')]({'where':{'id':_0x4400c7[_0xbb8c('0x4b')]['id']}})[_0xbb8c('0x27')](handleEntityNotFound(_0x5c3373,null))[_0xbb8c('0x27')](removeEntity(_0x5c3373,null))[_0xbb8c('0x46')](handleError(_0x5c3373,null));}; \ No newline at end of file +var _0x095b=['limit','Content-Range','apply','save','update','error','stack','name','map','WhatsappApplication','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','then','includeAll','include','findAll','catch','find','body','destroy','params','eml-format','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','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x095b,0x6e));var _0xb095=function(_0x117bf9,_0x9d5a48){_0x117bf9=_0x117bf9-0x0;var _0x4e43e2=_0x095b[_0x117bf9];return _0x4e43e2;};'use strict';var emlformat=require(_0xb095('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb095('0x1'));var jsonpatch=require(_0xb095('0x2'));var rp=require(_0xb095('0x3'));var moment=require(_0xb095('0x4'));var BPromise=require(_0xb095('0x5'));var Mustache=require('mustache');var util=require(_0xb095('0x6'));var path=require(_0xb095('0x7'));var sox=require(_0xb095('0x8'));var csv=require(_0xb095('0x9'));var ejs=require(_0xb095('0xa'));var fs=require('fs');var fs_extra=require(_0xb095('0xb'));var _=require(_0xb095('0xc'));var squel=require(_0xb095('0xd'));var crypto=require(_0xb095('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb095('0xf'));var toCsv=require(_0xb095('0x9'));var querystring=require(_0xb095('0x10'));var Papa=require(_0xb095('0x11'));var Redis=require(_0xb095('0x12'));var authService=require(_0xb095('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb095('0x14'));var logger=require(_0xb095('0x15'))('api');var utils=require(_0xb095('0x16'));var config=require(_0xb095('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb095('0x18'))['db'];function respondWithStatusCode(_0x5e0fb3,_0x7b6edf){_0x7b6edf=_0x7b6edf||0xcc;return function(_0x23dcc5){if(_0x23dcc5){return _0x5e0fb3[_0xb095('0x19')](_0x7b6edf);}return _0x5e0fb3[_0xb095('0x1a')](_0x7b6edf)[_0xb095('0x1b')]();};}function respondWithResult(_0x394df0,_0x781a3f){_0x781a3f=_0x781a3f||0xc8;return function(_0x4afb4d){if(_0x4afb4d){return _0x394df0[_0xb095('0x1a')](_0x781a3f)[_0xb095('0x1c')](_0x4afb4d);}};}function respondWithFilteredResult(_0x44280b,_0x2e6a89){return function(_0xd92481){if(_0xd92481){var _0x2568f8=typeof _0x2e6a89['offset']==='undefined'&&typeof _0x2e6a89['limit']===_0xb095('0x1d');var _0x2c4e86=_0xd92481[_0xb095('0x1e')];var _0x54d06=_0x2568f8?0x0:_0x2e6a89[_0xb095('0x1f')];var _0x7f0681=_0x2568f8?_0xd92481['count']:_0x2e6a89[_0xb095('0x1f')]+_0x2e6a89[_0xb095('0x20')];var _0x27e1d0;if(_0x7f0681>=_0x2c4e86){_0x7f0681=_0x2c4e86;_0x27e1d0=0xc8;}else{_0x27e1d0=0xce;}_0x44280b[_0xb095('0x1a')](_0x27e1d0);return _0x44280b['set'](_0xb095('0x21'),_0x54d06+'-'+_0x7f0681+'/'+_0x2c4e86)[_0xb095('0x1c')](_0xd92481);}return null;};}function patchUpdates(_0x2273f8){return function(_0x318687){try{jsonpatch[_0xb095('0x22')](_0x318687,_0x2273f8,!![]);}catch(_0x2af120){return BPromise['reject'](_0x2af120);}return _0x318687[_0xb095('0x23')]();};}function saveUpdates(_0x525a1a,_0x51750f){return function(_0x4ef4a9){if(_0x4ef4a9){return _0x4ef4a9[_0xb095('0x24')](_0x525a1a)['then'](function(_0x39f9de){return _0x39f9de;});}return null;};}function removeEntity(_0x4650f1,_0x2f1a8b){return function(_0x32d1e6){if(_0x32d1e6){return _0x32d1e6['destroy']()['then'](function(){_0x4650f1[_0xb095('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c6488,_0x1bbe29){return function(_0x1f1206){if(!_0x1f1206){_0x3c6488['sendStatus'](0x194);}return _0x1f1206;};}function handleError(_0x3e2095,_0x608591){_0x608591=_0x608591||0x1f4;return function(_0x3cb69f){logger[_0xb095('0x25')](_0x3cb69f[_0xb095('0x26')]);if(_0x3cb69f[_0xb095('0x27')]){delete _0x3cb69f[_0xb095('0x27')];}_0x3e2095[_0xb095('0x1a')](_0x608591)['send'](_0x3cb69f);};}exports['index']=function(_0xd6426c,_0x1d82a5){var _0x53803f={},_0x2f273f={},_0x3d00d1={'count':0x0,'rows':[]};var _0x468d94=_[_0xb095('0x28')](db[_0xb095('0x29')][_0xb095('0x2a')],function(_0xafd194){return{'name':_0xafd194['fieldName'],'type':_0xafd194[_0xb095('0x2b')][_0xb095('0x2c')]};});_0x2f273f[_0xb095('0x2d')]=_[_0xb095('0x28')](_0x468d94,_0xb095('0x27'));_0x2f273f[_0xb095('0x2e')]=_[_0xb095('0x2f')](_0xd6426c['query']);_0x2f273f['filters']=_['intersection'](_0x2f273f['model'],_0x2f273f['query']);_0x53803f[_0xb095('0x30')]=_[_0xb095('0x31')](_0x2f273f[_0xb095('0x2d')],qs[_0xb095('0x32')](_0xd6426c[_0xb095('0x2e')][_0xb095('0x32')]));_0x53803f[_0xb095('0x30')]=_0x53803f[_0xb095('0x30')][_0xb095('0x33')]?_0x53803f[_0xb095('0x30')]:_0x2f273f[_0xb095('0x2d')];if(!_0xd6426c['query'][_0xb095('0x34')](_0xb095('0x35'))){_0x53803f[_0xb095('0x20')]=qs['limit'](_0xd6426c['query'][_0xb095('0x20')]);_0x53803f[_0xb095('0x1f')]=qs[_0xb095('0x1f')](_0xd6426c[_0xb095('0x2e')]['offset']);}_0x53803f['order']=qs[_0xb095('0x36')](_0xd6426c['query'][_0xb095('0x36')]);_0x53803f[_0xb095('0x37')]=qs['filters'](_[_0xb095('0x38')](_0xd6426c[_0xb095('0x2e')],_0x2f273f[_0xb095('0x39')]),_0x468d94);if(_0xd6426c['query'][_0xb095('0x3a')]){_0x53803f[_0xb095('0x37')]=_['merge'](_0x53803f[_0xb095('0x37')],{'$or':_[_0xb095('0x28')](_0x468d94,function(_0x7dd3c9){if(_0x7dd3c9[_0xb095('0x2b')]!==_0xb095('0x3b')){var _0x3d5e17={};_0x3d5e17[_0x7dd3c9[_0xb095('0x27')]]={'$like':'%'+_0xd6426c[_0xb095('0x2e')]['filter']+'%'};return _0x3d5e17;}})});}_0x53803f=_[_0xb095('0x3c')]({},_0x53803f,_0xd6426c[_0xb095('0x3d')]);var _0x69cfbe={'where':_0x53803f[_0xb095('0x37')]};return db[_0xb095('0x29')][_0xb095('0x1e')](_0x69cfbe)[_0xb095('0x3e')](function(_0x1eb503){_0x3d00d1[_0xb095('0x1e')]=_0x1eb503;if(_0xd6426c[_0xb095('0x2e')][_0xb095('0x3f')]){_0x53803f[_0xb095('0x40')]=[{'all':!![]}];}return db[_0xb095('0x29')][_0xb095('0x41')](_0x53803f);})[_0xb095('0x3e')](function(_0x4f57ef){_0x3d00d1['rows']=_0x4f57ef;return _0x3d00d1;})[_0xb095('0x3e')](respondWithFilteredResult(_0x1d82a5,_0x53803f))[_0xb095('0x42')](handleError(_0x1d82a5,null));};exports['show']=function(_0x2a8178,_0x3f63fa){var _0x1582d5={'raw':!![],'where':{'id':_0x2a8178['params']['id']}},_0x367bce={};_0x367bce['model']=_[_0xb095('0x2f')](db[_0xb095('0x29')][_0xb095('0x2a')]);_0x367bce['query']=_['keys'](_0x2a8178['query']);_0x367bce[_0xb095('0x39')]=_['intersection'](_0x367bce[_0xb095('0x2d')],_0x367bce[_0xb095('0x2e')]);_0x1582d5[_0xb095('0x30')]=_['intersection'](_0x367bce[_0xb095('0x2d')],qs['fields'](_0x2a8178['query']['fields']));_0x1582d5[_0xb095('0x30')]=_0x1582d5['attributes'][_0xb095('0x33')]?_0x1582d5['attributes']:_0x367bce[_0xb095('0x2d')];if(_0x2a8178['query'][_0xb095('0x3f')]){_0x1582d5[_0xb095('0x40')]=[{'all':!![]}];}_0x1582d5=_[_0xb095('0x3c')]({},_0x1582d5,_0x2a8178['options']);return db[_0xb095('0x29')][_0xb095('0x43')](_0x1582d5)[_0xb095('0x3e')](handleEntityNotFound(_0x3f63fa,null))[_0xb095('0x3e')](respondWithResult(_0x3f63fa,null))[_0xb095('0x42')](handleError(_0x3f63fa,null));};exports['create']=function(_0x45c71c,_0x4ad545){return db['WhatsappApplication']['create'](_0x45c71c[_0xb095('0x44')],{})['then'](respondWithResult(_0x4ad545,0xc9))[_0xb095('0x42')](handleError(_0x4ad545,null));};exports[_0xb095('0x24')]=function(_0x5685e2,_0x32f642){if(_0x5685e2[_0xb095('0x44')]['id']){delete _0x5685e2[_0xb095('0x44')]['id'];}return db[_0xb095('0x29')][_0xb095('0x43')]({'where':{'id':_0x5685e2['params']['id']}})['then'](handleEntityNotFound(_0x32f642,null))[_0xb095('0x3e')](saveUpdates(_0x5685e2[_0xb095('0x44')],null))[_0xb095('0x3e')](respondWithResult(_0x32f642,null))['catch'](handleError(_0x32f642,null));};exports[_0xb095('0x45')]=function(_0xf0f9e6,_0x13bb46){return db[_0xb095('0x29')][_0xb095('0x43')]({'where':{'id':_0xf0f9e6[_0xb095('0x46')]['id']}})[_0xb095('0x3e')](handleEntityNotFound(_0x13bb46,null))['then'](removeEntity(_0x13bb46,null))[_0xb095('0x42')](handleError(_0x13bb46,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index b5ef1ee..733a841 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 _0xac31=['request-promise','rimraf','../../config/environment','define','WhatsappApplication','whatsapp_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x54f322,_0x24a660){var _0xb0a1d5=function(_0x523587){while(--_0x523587){_0x54f322['push'](_0x54f322['shift']());}};_0xb0a1d5(++_0x24a660);}(_0xac31,0xca));var _0x1ac3=function(_0x5d1857,_0x504f52){_0x5d1857=_0x5d1857-0x0;var _0xf6bbe9=_0xac31[_0x5d1857];return _0xf6bbe9;};'use strict';var _=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var logger=require(_0x1ac3('0x2'))(_0x1ac3('0x3'));var moment=require(_0x1ac3('0x4'));var BPromise=require(_0x1ac3('0x5'));var rp=require(_0x1ac3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1ac3('0x7'));var config=require(_0x1ac3('0x8'));var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0xbe22b7,_0x20027f){return _0xbe22b7[_0x1ac3('0x9')](_0x1ac3('0xa'),attributes,{'tableName':_0x1ac3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x1ac3('0xc')});}; \ No newline at end of file +var _0x1d25=['exports','define','whatsapp_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./whatsappApplication.attributes'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x1d25,0xba));var _0x51d2=function(_0x329d13,_0x1aff27){_0x329d13=_0x329d13-0x0;var _0x33efd9=_0x1d25[_0x329d13];return _0x33efd9;};'use strict';var _=require(_0x51d2('0x0'));var util=require(_0x51d2('0x1'));var logger=require(_0x51d2('0x2'))(_0x51d2('0x3'));var moment=require(_0x51d2('0x4'));var BPromise=require('bluebird');var rp=require(_0x51d2('0x5'));var fs=require('fs');var path=require(_0x51d2('0x6'));var rimraf=require('rimraf');var config=require(_0x51d2('0x7'));var attributes=require(_0x51d2('0x8'));module[_0x51d2('0x9')]=function(_0x407091,_0x449fec){return _0x407091[_0x51d2('0xa')]('WhatsappApplication',attributes,{'tableName':_0x51d2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x51d2('0xc')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index e29a1c0..63e3c05 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 _0x81bd=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x59bbb5,_0xc4d508){var _0x3f9c56=function(_0x34eac5){while(--_0x34eac5){_0x59bbb5['push'](_0x59bbb5['shift']());}};_0x3f9c56(++_0xc4d508);}(_0x81bd,0x7c));var _0xd81b=function(_0x4ec805,_0x3b8515){_0x4ec805=_0x4ec805-0x0;var _0x386805=_0x81bd[_0x4ec805];return _0x386805;};'use strict';var _=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var moment=require(_0xd81b('0x2'));var BPromise=require(_0xd81b('0x3'));var rs=require(_0xd81b('0x4'));var fs=require('fs');var Redis=require(_0xd81b('0x5'));var db=require(_0xd81b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd81b('0x7'))(_0xd81b('0x8'));var config=require(_0xd81b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd81b('0xa')][_0xd81b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f3f2c,_0x562084,_0x5e14e8){return new BPromise(function(_0xa4cf97,_0x5468d5){return client[_0xd81b('0xc')](_0x1f3f2c,_0x5e14e8)[_0xd81b('0xd')](function(_0x3420a7){logger[_0xd81b('0xe')](_0xd81b('0xf'),_0x562084,_0xd81b('0x10'));logger[_0xd81b('0x11')](_0xd81b('0x12'),_0x562084,_0xd81b('0x10'),JSON[_0xd81b('0x13')](_0x3420a7));if(_0x3420a7[_0xd81b('0x14')]){if(_0x3420a7[_0xd81b('0x14')][_0xd81b('0x15')]===0x1f4){logger['error'](_0xd81b('0xf'),_0x562084,_0x3420a7['error'][_0xd81b('0x16')]);return _0x5468d5(_0x3420a7[_0xd81b('0x14')]['message']);}logger[_0xd81b('0x14')]('WhatsappApplication,\x20%s,\x20%s',_0x562084,_0x3420a7[_0xd81b('0x14')][_0xd81b('0x16')]);return _0xa4cf97(_0x3420a7[_0xd81b('0x14')][_0xd81b('0x16')]);}else{logger[_0xd81b('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x562084,_0xd81b('0x10'));_0xa4cf97(_0x3420a7[_0xd81b('0x17')]['message']);}})[_0xd81b('0x18')](function(_0x26df61){logger[_0xd81b('0x14')](_0xd81b('0xf'),_0x562084,_0x26df61);_0x5468d5(_0x26df61);});});} \ No newline at end of file +var _0x70e0=['code','WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x39a242,_0x33e53a){var _0x5c4720=function(_0x162d43){while(--_0x162d43){_0x39a242['push'](_0x39a242['shift']());}};_0x5c4720(++_0x33e53a);}(_0x70e0,0x17b));var _0x070e=function(_0x3574b3,_0x148325){_0x3574b3=_0x3574b3-0x0;var _0x515074=_0x70e0[_0x3574b3];return _0x515074;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('WhatsappApplication,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index d582434..1269c9c 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 _0x31c2=['/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage'];(function(_0xf1226a,_0x29a250){var _0x1b8fe7=function(_0x7178a5){while(--_0x7178a5){_0xf1226a['push'](_0xf1226a['shift']());}};_0x1b8fe7(++_0x29a250);}(_0x31c2,0x1e1));var _0x231c=function(_0x36c82a,_0x6945fb){_0x36c82a=_0x36c82a-0x0;var _0xba08f4=_0x31c2[_0x36c82a];return _0xba08f4;};'use strict';var multer=require(_0x231c('0x0'));var util=require(_0x231c('0x1'));var path=require(_0x231c('0x2'));var timeout=require(_0x231c('0x3'));var express=require(_0x231c('0x4'));var router=express[_0x231c('0x5')]();var fs_extra=require(_0x231c('0x6'));var auth=require(_0x231c('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x231c('0x8'));router[_0x231c('0x9')]('/',auth[_0x231c('0xa')](),controller[_0x231c('0xb')]);router['get'](_0x231c('0xc'),auth['isAuthenticated'](),controller[_0x231c('0xd')]);router[_0x231c('0x9')](_0x231c('0xe'),auth['isAuthenticated'](),controller[_0x231c('0xf')]);router[_0x231c('0x9')](_0x231c('0x10'),auth[_0x231c('0xa')](),controller[_0x231c('0x11')]);router[_0x231c('0x9')](_0x231c('0x12'),auth['isAuthenticated'](),controller[_0x231c('0x13')]);router[_0x231c('0x14')]('/',auth['isAuthenticated'](),controller[_0x231c('0x15')]);router[_0x231c('0x14')](_0x231c('0x10'),auth[_0x231c('0xa')](),controller[_0x231c('0x16')]);router[_0x231c('0x14')](_0x231c('0x17'),auth[_0x231c('0xa')](),interaction[_0x231c('0x18')](_0x231c('0x19'),_0x231c('0x1a')),controller[_0x231c('0x1b')]);router[_0x231c('0x1c')](_0x231c('0xe'),auth[_0x231c('0xa')](),interaction[_0x231c('0x18')](_0x231c('0x19'),_0x231c('0x1d')),controller[_0x231c('0x1e')]);router[_0x231c('0x1f')]('/:id',auth[_0x231c('0xa')](),interaction[_0x231c('0x18')](_0x231c('0x19'),_0x231c('0x20')),controller[_0x231c('0x21')]);router[_0x231c('0x1f')](_0x231c('0x17'),auth[_0x231c('0xa')](),controller[_0x231c('0x22')]);module[_0x231c('0x23')]=router; \ No newline at end of file +var _0x81c6=['removeTags','util','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','/describe','/:id','/:id/messages','getMessages','/:id/download','create','post','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','/:id/tags'];(function(_0x5c0db8,_0x55103e){var _0x1e27bb=function(_0x51cc62){while(--_0x51cc62){_0x5c0db8['push'](_0x5c0db8['shift']());}};_0x1e27bb(++_0x55103e);}(_0x81c6,0x1d5));var _0x681c=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0x81c6[_0x409353];return _0x4f4b59;};'use strict';var multer=require('multer');var util=require(_0x681c('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x681c('0x1')]();var fs_extra=require(_0x681c('0x2'));var auth=require(_0x681c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x681c('0x4'));var controller=require(_0x681c('0x5'));router[_0x681c('0x6')]('/',auth[_0x681c('0x7')](),controller['index']);router[_0x681c('0x6')](_0x681c('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x681c('0x6')](_0x681c('0x9'),auth[_0x681c('0x7')](),controller['show']);router['get'](_0x681c('0xa'),auth['isAuthenticated'](),controller[_0x681c('0xb')]);router[_0x681c('0x6')](_0x681c('0xc'),auth[_0x681c('0x7')](),controller['download']);router['post']('/',auth[_0x681c('0x7')](),controller[_0x681c('0xd')]);router[_0x681c('0xe')]('/:id/messages',auth[_0x681c('0x7')](),controller['addMessage']);router[_0x681c('0xe')]('/:id/tags',auth[_0x681c('0x7')](),interaction[_0x681c('0xf')](_0x681c('0x10'),_0x681c('0x11')),controller[_0x681c('0x12')]);router[_0x681c('0x13')]('/:id',auth[_0x681c('0x7')](),interaction[_0x681c('0xf')](_0x681c('0x10'),_0x681c('0x14')),controller[_0x681c('0x15')]);router[_0x681c('0x16')]('/:id',auth[_0x681c('0x7')](),interaction[_0x681c('0xf')](_0x681c('0x10'),_0x681c('0x17')),controller['destroy']);router[_0x681c('0x16')](_0x681c('0x18'),auth['isAuthenticated'](),controller[_0x681c('0x19')]);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 d648f7d..df286b2 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 _0xc99e=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment'];(function(_0xf54627,_0x35b47d){var _0x1f9d48=function(_0x204277){while(--_0x204277){_0xf54627['push'](_0xf54627['shift']());}};_0x1f9d48(++_0x35b47d);}(_0xc99e,0x6e));var _0xec99=function(_0x3b6116,_0xbca657){_0x3b6116=_0x3b6116-0x0;var _0x33af83=_0xc99e[_0x3b6116];return _0x33af83;};'use strict';var Sequelize=require(_0xec99('0x0'));var moment=require(_0xec99('0x1'));module[_0xec99('0x2')]={'closed':{'type':Sequelize[_0xec99('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xec99('0x4')]},'disposition':{'type':Sequelize[_0xec99('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xec99('0x5')]},'note':{'type':Sequelize[_0xec99('0x5')]},'phone':{'type':Sequelize[_0xec99('0x5')]},'read1stAt':{'type':Sequelize[_0xec99('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xec99('0x6')]('in',_0xec99('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xec99('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xec99('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xec99('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x4312=['ENUM','exports','BOOLEAN','STRING','DATE','out'];(function(_0x1a5435,_0xaa249a){var _0x182250=function(_0x13af82){while(--_0x13af82){_0x1a5435['push'](_0x1a5435['shift']());}};_0x182250(++_0xaa249a);}(_0x4312,0xaf));var _0x2431=function(_0x12e1fa,_0x44e981){_0x12e1fa=_0x12e1fa-0x0;var _0x1e743e=_0x4312[_0x12e1fa];return _0x1e743e;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x2431('0x0')]={'closed':{'type':Sequelize[_0x2431('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x2431('0x2')]},'secondDisposition':{'type':Sequelize[_0x2431('0x2')]},'thirdDisposition':{'type':Sequelize[_0x2431('0x2')]},'note':{'type':Sequelize[_0x2431('0x2')]},'phone':{'type':Sequelize[_0x2431('0x2')]},'read1stAt':{'type':Sequelize[_0x2431('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x2431('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x2431('0x5')]('in',_0x2431('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 8a84d2e..3747671 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 _0xb235=['basename','createReadStream','pipe','createWriteStream','out','System','lastName','value','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','unlinkSync','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','localhost','./whatsappInteraction.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','getOptions','whatsapp','user','catch','show','model','keys','WhatsappInteraction','query','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','destroy','params','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','hasOwnProperty','order','sort','where','filters','WhatsappInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','spread','color','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','join','server','files','root','push','fullname','CmContact','Contact','firstName','attachments','Attachment','Messages','createdAt','direction','secret','read','WhatsappAccount','Account','User','Owner','get','Whatsapp','N.A.','closed','disposition'];(function(_0x37e5fb,_0x4813ab){var _0x471143=function(_0x529a65){while(--_0x529a65){_0x37e5fb['push'](_0x37e5fb['shift']());}};_0x471143(++_0x4813ab);}(_0xb235,0x10d));var _0x5b23=function(_0x3d8b1d,_0x1c0f88){_0x3d8b1d=_0x3d8b1d-0x0;var _0x2bb57a=_0xb235[_0x3d8b1d];return _0x2bb57a;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0x5b23('0x0'));var util=require(_0x5b23('0x1'));var path=require(_0x5b23('0x2'));var ejs=require(_0x5b23('0x3'));var fs=require('fs');var _=require(_0x5b23('0x4'));var Redis=require(_0x5b23('0x5'));var interaction=require(_0x5b23('0x6'));var qs=require('../../components/parsers/qs');var pdf=require(_0x5b23('0x7'));var logger=require(_0x5b23('0x8'))(_0x5b23('0x9'));var config=require('../../config/environment');var db=require(_0x5b23('0xa'))['db'];config['redis']=_['defaults'](config[_0x5b23('0xb')],{'host':_0x5b23('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5b23('0xb')]));require(_0x5b23('0xd'))[_0x5b23('0xe')](socket);function respondWithStatusCode(_0x15f86b,_0x14b68c){_0x14b68c=_0x14b68c||0xcc;return function(_0x230a11){if(_0x230a11){return _0x15f86b[_0x5b23('0xf')](_0x14b68c);}return _0x15f86b[_0x5b23('0x10')](_0x14b68c)[_0x5b23('0x11')]();};}function respondWithResult(_0x317d57,_0x46c971){_0x46c971=_0x46c971||0xc8;return function(_0x549b47){if(_0x549b47){return _0x317d57[_0x5b23('0x10')](_0x46c971)[_0x5b23('0x12')](_0x549b47);}};}function respondWithFilteredResult(_0x108156,_0xeaabd9){return function(_0x29706d){if(_0x29706d){var _0xda27ec=typeof _0xeaabd9['offset']===_0x5b23('0x13')&&typeof _0xeaabd9[_0x5b23('0x14')]===_0x5b23('0x13');var _0x4a4a38=_0x29706d[_0x5b23('0x15')];var _0x55331d=_0xda27ec?0x0:_0xeaabd9['offset'];var _0x3c9db5=_0xda27ec?_0x29706d[_0x5b23('0x15')]:_0xeaabd9[_0x5b23('0x16')]+_0xeaabd9[_0x5b23('0x14')];var _0x1c1226;if(_0x3c9db5>=_0x4a4a38){_0x3c9db5=_0x4a4a38;_0x1c1226=0xc8;}else{_0x1c1226=0xce;}_0x108156[_0x5b23('0x10')](_0x1c1226);return _0x108156[_0x5b23('0x17')](_0x5b23('0x18'),_0x55331d+'-'+_0x3c9db5+'/'+_0x4a4a38)[_0x5b23('0x12')](_0x29706d);}return null;};}function saveUpdates(_0x225b8c){return function(_0x9233e8){if(_0x9233e8){return _0x9233e8[_0x5b23('0x19')](_0x225b8c)['then'](function(_0x3f0b12){return _0x3f0b12;});}return null;};}function removeEntity(_0x2aeb1a){return function(_0x58b2f3){if(_0x58b2f3){return _0x58b2f3['destroy']()[_0x5b23('0x1a')](function(){_0x2aeb1a[_0x5b23('0x10')](0xcc)[_0x5b23('0x11')]();});}};}function handleEntityNotFound(_0x2a670a){return function(_0x4413a3){if(!_0x4413a3){_0x2a670a[_0x5b23('0xf')](0x194);}return _0x4413a3;};}function handleError(_0x5b5ead,_0x1e004a){_0x1e004a=_0x1e004a||0x1f4;return function(_0x920f7b){logger[_0x5b23('0x1b')](_0x920f7b[_0x5b23('0x1c')]);if(_0x920f7b[_0x5b23('0x1d')]){delete _0x920f7b[_0x5b23('0x1d')];}_0x5b5ead[_0x5b23('0x10')](_0x1e004a)[_0x5b23('0x1e')](_0x920f7b);};}exports['index']=function(_0x32be01,_0x1fa5ea){var _0x11264d={};var _0x43e88b=_[_0x5b23('0x1f')](db['WhatsappInteraction'][_0x5b23('0x20')],function(_0x5e8d24){return{'name':_0x5e8d24[_0x5b23('0x21')],'type':_0x5e8d24[_0x5b23('0x22')][_0x5b23('0x23')]};});_0x11264d=qs[_0x5b23('0x24')](_0x43e88b,_0x32be01);return interaction['findAll'](_0x5b23('0x25'),_0x32be01['query'],_0x32be01[_0x5b23('0x26')],_0x11264d,_0x43e88b)['then'](respondWithFilteredResult(_0x1fa5ea,_0x11264d))[_0x5b23('0x27')](handleError(_0x1fa5ea,null));};exports[_0x5b23('0x28')]=function(_0x802f77,_0x3511f3){var _0x29d1ca={'raw':![],'where':{'id':_0x802f77['params']['id']}},_0x37172a={};_0x37172a[_0x5b23('0x29')]=_[_0x5b23('0x2a')](db[_0x5b23('0x2b')][_0x5b23('0x20')]);_0x37172a[_0x5b23('0x2c')]=_[_0x5b23('0x2a')](_0x802f77[_0x5b23('0x2c')]);_0x37172a['filters']=_[_0x5b23('0x2d')](_0x37172a['model'],_0x37172a['query']);_0x29d1ca[_0x5b23('0x2e')]=_['intersection'](_0x37172a[_0x5b23('0x29')],qs[_0x5b23('0x2f')](_0x802f77[_0x5b23('0x2c')][_0x5b23('0x2f')]));_0x29d1ca[_0x5b23('0x2e')]=_0x29d1ca['attributes'][_0x5b23('0x30')]?_0x29d1ca[_0x5b23('0x2e')]:_0x37172a[_0x5b23('0x29')];if(_0x802f77[_0x5b23('0x2c')][_0x5b23('0x31')]){_0x29d1ca[_0x5b23('0x32')]=[{'all':!![]}];}_0x29d1ca=_[_0x5b23('0x33')]({},_0x29d1ca,_0x802f77[_0x5b23('0x34')]);return db[_0x5b23('0x2b')][_0x5b23('0x35')](_0x29d1ca)[_0x5b23('0x1a')](handleEntityNotFound(_0x3511f3,null))[_0x5b23('0x1a')](respondWithResult(_0x3511f3,null))[_0x5b23('0x27')](handleError(_0x3511f3,null));};exports[_0x5b23('0x36')]=function(_0x58e1a1,_0x33d389){return db['WhatsappInteraction'][_0x5b23('0x36')](_0x58e1a1['body'],{})[_0x5b23('0x1a')](respondWithResult(_0x33d389,0xc9))[_0x5b23('0x27')](handleError(_0x33d389,null));};exports[_0x5b23('0x19')]=function(_0x3b1e33,_0x2af213){if(_0x3b1e33[_0x5b23('0x37')]['id']){delete _0x3b1e33['body']['id'];}return db[_0x5b23('0x2b')][_0x5b23('0x35')]({'where':{'id':_0x3b1e33['params']['id']}})[_0x5b23('0x1a')](handleEntityNotFound(_0x2af213,null))['then'](saveUpdates(_0x3b1e33[_0x5b23('0x37')],null))['then'](respondWithResult(_0x2af213,null))[_0x5b23('0x27')](handleError(_0x2af213,null));};exports[_0x5b23('0x38')]=function(_0x2e4afa,_0x3535fa){return db[_0x5b23('0x2b')][_0x5b23('0x35')]({'where':{'id':_0x2e4afa[_0x5b23('0x39')]['id']}})[_0x5b23('0x1a')](handleEntityNotFound(_0x3535fa,null))[_0x5b23('0x1a')](removeEntity(_0x3535fa,null))[_0x5b23('0x27')](handleError(_0x3535fa,null));};exports[_0x5b23('0x3a')]=function(_0x52e3fa,_0x3237ec){return db[_0x5b23('0x2b')][_0x5b23('0x3a')]()[_0x5b23('0x1a')](respondWithResult(_0x3237ec,null))[_0x5b23('0x27')](handleError(_0x3237ec,null));};exports[_0x5b23('0x3b')]=function(_0x46958c,_0x54e7f9){return db[_0x5b23('0x3c')][_0x5b23('0x35')]({'where':{'id':_0x46958c['params']['id']}})['then'](handleEntityNotFound(_0x54e7f9,null))[_0x5b23('0x1a')](function(_0x283780){if(_0x283780){return _0x283780[_0x5b23('0x3b')](_0x46958c[_0x5b23('0x37')][_0x5b23('0x3d')],_[_0x5b23('0x3e')](_0x46958c['body'],[_0x5b23('0x3d'),'id'])||{});}})['then'](respondWithResult(_0x54e7f9,null))[_0x5b23('0x27')](handleError(_0x54e7f9,null));};exports[_0x5b23('0x3f')]=function(_0x41b4b0,_0x1e7ed7){var _0x36074b={'raw':![],'where':{}};var _0xb85e0={};var _0x501beb={'count':0x0,'rows':[]};return db[_0x5b23('0x2b')][_0x5b23('0x40')]({'where':{'id':_0x41b4b0[_0x5b23('0x39')]['id']}})[_0x5b23('0x1a')](handleEntityNotFound(_0x1e7ed7,null))['then'](function(_0x3facfd){if(_0x3facfd){_0xb85e0['model']=_['keys'](db[_0x5b23('0x3c')]['rawAttributes']);_0xb85e0[_0x5b23('0x2c')]=_['keys'](_0x41b4b0[_0x5b23('0x2c')]);_0xb85e0['filters']=_['intersection'](_0xb85e0[_0x5b23('0x29')],_0xb85e0[_0x5b23('0x2c')]);_0x36074b[_0x5b23('0x2e')]=_[_0x5b23('0x2d')](_0xb85e0[_0x5b23('0x29')],qs['fields'](_0x41b4b0[_0x5b23('0x2c')][_0x5b23('0x2f')]));_0x36074b['attributes']=_0x36074b[_0x5b23('0x2e')][_0x5b23('0x30')]?_0x36074b[_0x5b23('0x2e')]:_0xb85e0[_0x5b23('0x29')];if(!_0x41b4b0['query'][_0x5b23('0x41')]('nolimit')){_0x36074b['limit']=qs[_0x5b23('0x14')](_0x41b4b0[_0x5b23('0x2c')]['limit']);_0x36074b[_0x5b23('0x16')]=qs[_0x5b23('0x16')](_0x41b4b0[_0x5b23('0x2c')]['offset']);}_0x36074b[_0x5b23('0x42')]=qs['sort'](_0x41b4b0[_0x5b23('0x2c')][_0x5b23('0x43')]);_0x36074b[_0x5b23('0x44')]=qs[_0x5b23('0x45')](_['pick'](_0x41b4b0[_0x5b23('0x2c')],_0xb85e0['filters']));_0x36074b['where'][_0x5b23('0x46')]=_0x3facfd['id'];if(_0x41b4b0[_0x5b23('0x2c')][_0x5b23('0x47')]){_0x36074b['where']=_[_0x5b23('0x33')](_0x36074b[_0x5b23('0x44')],{'$or':_['map'](_0x36074b[_0x5b23('0x2e')],function(_0x45b4d8){var _0x169490={};_0x169490[_0x45b4d8]={'$like':'%'+_0x41b4b0[_0x5b23('0x2c')][_0x5b23('0x47')]+'%'};return _0x169490;})});}if(_0x41b4b0['query']['$gte']){var _0x296782=_0x41b4b0[_0x5b23('0x2c')][_0x5b23('0x48')]['split'](',');var _0x10124c={};_0x10124c[_0x296782[0x0]]={'$gte':moment(_0x296782[0x1])[_0x5b23('0x49')](_0x5b23('0x4a'))};_0x36074b[_0x5b23('0x44')]=_[_0x5b23('0x33')](_0x36074b[_0x5b23('0x44')],_0x10124c);}_0x36074b=_['merge']({},_0x36074b,_0x41b4b0[_0x5b23('0x34')]);return db[_0x5b23('0x3c')][_0x5b23('0x15')]({'where':_0x36074b[_0x5b23('0x44')]})['then'](function(_0x1e320c){_0x501beb[_0x5b23('0x15')]=_0x1e320c;if(_0x41b4b0['query'][_0x5b23('0x31')]){_0x36074b['include']=[{'all':!![]}];}return db[_0x5b23('0x3c')][_0x5b23('0x4b')](_0x36074b);})[_0x5b23('0x1a')](function(_0x142439){_0x501beb[_0x5b23('0x4c')]=_0x142439;return _0x501beb;});}})['then'](respondWithFilteredResult(_0x1e7ed7,_0x36074b))[_0x5b23('0x27')](handleError(_0x1e7ed7,null));};exports[_0x5b23('0x4d')]=function(_0x1bd85f,_0x322b0d){return db['WhatsappInteraction'][_0x5b23('0x35')]({'where':{'id':_0x1bd85f['params']['id']}})[_0x5b23('0x1a')](handleEntityNotFound(_0x322b0d,null))[_0x5b23('0x1a')](function(_0xd57f1f){if(_0xd57f1f){return _0xd57f1f[_0x5b23('0x4e')](_0x1bd85f['body'][_0x5b23('0x3d')],_[_0x5b23('0x3e')](_0x1bd85f[_0x5b23('0x37')],[_0x5b23('0x3d'),'id'])||{})[_0x5b23('0x4f')](function(){return db['Tag'][_0x5b23('0x4b')]({'attributes':['id',_0x5b23('0x1d'),_0x5b23('0x50')],'where':{'id':_0x1bd85f[_0x5b23('0x37')][_0x5b23('0x3d')]}});})[_0x5b23('0x1a')](function(_0x276745){socket[_0x5b23('0x51')](_0x5b23('0x52'),{'id':Number(_0x1bd85f[_0x5b23('0x39')]['id']),'tags':_0x276745||[]});return{'id':Number(_0x1bd85f['params']['id']),'tags':_0x276745||[]};});}})[_0x5b23('0x1a')](respondWithResult(_0x322b0d,null))[_0x5b23('0x27')](handleError(_0x322b0d,null));};exports[_0x5b23('0x53')]=function(_0x4f205a,_0x49b1d7){return db['WhatsappInteraction'][_0x5b23('0x35')]({'where':{'id':_0x4f205a[_0x5b23('0x39')]['id']}})['then'](handleEntityNotFound(_0x49b1d7,null))['then'](function(_0x1a081f){if(_0x1a081f){return _0x1a081f[_0x5b23('0x53')](_0x4f205a[_0x5b23('0x2c')][_0x5b23('0x3d')]);}})[_0x5b23('0x1a')](respondWithStatusCode(_0x49b1d7,null))[_0x5b23('0x27')](handleError(_0x49b1d7,null));};exports[_0x5b23('0x54')]=function(_0x2fef9b,_0x17b421){var _0x5289c9=moment()[_0x5b23('0x55')]()[_0x5b23('0x56')]();var _0x2b0d9b=path[_0x5b23('0x57')](config['root'],_0x5b23('0x58'),_0x5b23('0x59'),'tmp');var _0x590f1d=path['join'](config[_0x5b23('0x5a')],_0x5b23('0x58'),_0x5b23('0x59'),'attachments');var _0x3dad94=path[_0x5b23('0x57')](_0x2b0d9b,_0x5289c9);var _0x16d5c2=util[_0x5b23('0x49')]('transcript-%d-%s.zip',_0x2fef9b[_0x5b23('0x39')]['id'],_0x5289c9);var _0x193d26=path[_0x5b23('0x57')](_0x2b0d9b,_0x16d5c2);var _0x453133=[];_0x453133[_0x5b23('0x5b')]({'model':db['User'],'as':'User','attributes':['id',_0x5b23('0x5c')],'raw':!![]});_0x453133['push']({'model':db[_0x5b23('0x5d')],'as':_0x5b23('0x5e'),'attributes':['id',_0x5b23('0x5f'),'lastName'],'raw':!![]});if(_0x2fef9b[_0x5b23('0x2c')][_0x5b23('0x60')]){_0x453133['push']({'model':db['Attachment'],'as':_0x5b23('0x61'),'raw':!![]});}var _0x1b7ab0=[{'model':db[_0x5b23('0x3c')],'as':_0x5b23('0x62'),'attributes':['id','body',_0x5b23('0x63'),_0x5b23('0x64'),_0x5b23('0x65'),_0x5b23('0x66')],'include':_0x453133}];_0x1b7ab0[_0x5b23('0x5b')]({'model':db[_0x5b23('0x67')],'as':_0x5b23('0x68'),'attributes':['id',_0x5b23('0x1d')]});_0x1b7ab0['push']({'model':db[_0x5b23('0x69')],'as':_0x5b23('0x6a'),'attributes':['id',_0x5b23('0x5c')]});return db[_0x5b23('0x2b')][_0x5b23('0x35')]({'where':{'id':_0x2fef9b['params']['id']},'include':_0x1b7ab0})[_0x5b23('0x1a')](handleEntityNotFound(_0x17b421,null))[_0x5b23('0x1a')](function(_0xabed1f){if(_0xabed1f){var _0x2b4666=_0xabed1f[_0x5b23('0x6b')]({'plain':!![]});fs['mkdirSync'](_0x3dad94);var _0x19ff9d={'channel':_0x5b23('0x6c'),'account':_0x2b4666['Account']['name'],'agent':_0x2b4666[_0x5b23('0x6a')]?_0x2b4666[_0x5b23('0x6a')][_0x5b23('0x5c')]:_0x5b23('0x6d'),'createdAt':moment(_0x2b4666[_0x5b23('0x63')])[_0x5b23('0x49')]('YYYY-MM-DD\x20HH:mm:ss')[_0x5b23('0x56')](),'closedAt':_0x2b4666[_0x5b23('0x6e')]?moment(_0x2b4666['closedAt'])[_0x5b23('0x49')](_0x5b23('0x4a'))['toString']():'','disposition':_0x2b4666[_0x5b23('0x6f')],'messages':_(_0x2b4666[_0x5b23('0x62')])[_0x5b23('0x47')]({'secret':![]})['map'](function(_0x26034e){if(_0x26034e[_0x5b23('0x61')]){var _0x1be071=path['join'](_0x590f1d,_0x26034e[_0x5b23('0x61')][_0x5b23('0x70')]);if(fs['existsSync'](_0x1be071)){fs[_0x5b23('0x71')](_0x1be071)[_0x5b23('0x72')](fs[_0x5b23('0x73')](path[_0x5b23('0x57')](_0x3dad94,_0x26034e[_0x5b23('0x61')][_0x5b23('0x70')])));}}return{'date':moment(_0x26034e[_0x5b23('0x63')])['format'](_0x5b23('0x4a'))[_0x5b23('0x56')](),'sender':_0x26034e[_0x5b23('0x64')]===_0x5b23('0x74')?_0x26034e[_0x5b23('0x69')]?_0x26034e[_0x5b23('0x69')][_0x5b23('0x5c')]:_0x5b23('0x75'):_0x26034e[_0x5b23('0x5e')][_0x5b23('0x5f')]+(_0x26034e[_0x5b23('0x5e')][_0x5b23('0x76')]?'\x20'+_0x26034e[_0x5b23('0x5e')][_0x5b23('0x76')]:''),'body':_0x26034e['Attachment']?_0x26034e[_0x5b23('0x61')][_0x5b23('0x70')]:_0x26034e['body'],'direction':_0x26034e[_0x5b23('0x64')]===_0x5b23('0x74')?'A':'C','secret':_0x26034e[_0x5b23('0x65')],'read':_0x26034e[_0x5b23('0x66')],'attachment':_0x26034e[_0x5b23('0x61')]};})[_0x5b23('0x77')]()};return ejs[_0x5b23('0x78')](path[_0x5b23('0x57')](config[_0x5b23('0x5a')],_0x5b23('0x58'),_0x5b23('0x79'),_0x5b23('0x7a')),{'interaction':_0x19ff9d})[_0x5b23('0x1a')](function(_0xceb8c1){var _0x5c0d57=path['join'](_0x3dad94,_0x5b23('0x7b')+_0x2b4666['id']+'-'+_0x5289c9+'.pdf');var _0x1cd103={'path':_0x5c0d57,'channel':'Whatsapp','interactionId':_0x2b4666['id']};return pdf[_0x5b23('0x7c')](_0xceb8c1,_0x1cd103);})[_0x5b23('0x1a')](function(){return new BPromise(function(_0x35c758,_0x16ef85){zipdir(_0x3dad94,{'saveTo':_0x193d26},function(_0x41451c,_0x4d1628){if(_0x41451c)return _0x16ef85(_0x41451c);return _0x35c758(_0x4d1628);});})[_0x5b23('0x1a')](function(){return new BPromise(function(_0x8098aa,_0x1cb7b8){rimraf(_0x3dad94,function(_0x175313){if(_0x175313)_0x1cb7b8(_0x175313);return _0x8098aa();});});})[_0x5b23('0x1a')](function(){return _0x17b421[_0x5b23('0x54')](_0x193d26,_0x16d5c2,function(_0x268707){if(_0x268707){console[_0x5b23('0x7d')]('err',_0x268707);}else{fs[_0x5b23('0x7e')](_0x193d26);}});});});}else{return _0x17b421[_0x5b23('0xf')](0xc8);}})['catch'](handleError(_0x17b421,null));}; \ No newline at end of file +var _0x1d4f=['defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','error','stack','name','map','fieldName','type','key','getOptions','whatsapp','query','user','catch','show','params','model','keys','rawAttributes','filters','intersection','attributes','length','includeAll','include','merge','options','find','create','WhatsappInteraction','body','describe','addMessage','ids','omit','getMessages','findOne','WhatsappMessage','fields','order','sort','where','pick','WhatsappInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','spread','Tag','removeTags','download','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','Account','Owner','get','mkdirSync','Whatsapp','N.A.','closed','disposition','createReadStream','pipe','createWriteStream','System','value','renderFile','transcript-','log','rimraf','moment','bluebird','util','ejs','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb'];(function(_0x252e5a,_0x1da513){var _0x5dbda6=function(_0x540601){while(--_0x540601){_0x252e5a['push'](_0x252e5a['shift']());}};_0x5dbda6(++_0x1da513);}(_0x1d4f,0x160));var _0xf1d4=function(_0x11150d,_0x11bd74){_0x11150d=_0x11150d-0x0;var _0x1edd83=_0x1d4f[_0x11150d];return _0x1edd83;};'use strict';var rimraf=require(_0xf1d4('0x0'));var zipdir=require('zip-dir');var moment=require(_0xf1d4('0x1'));var BPromise=require(_0xf1d4('0x2'));var util=require(_0xf1d4('0x3'));var path=require('path');var ejs=require(_0xf1d4('0x4'));var fs=require('fs');var _=require(_0xf1d4('0x5'));var Redis=require(_0xf1d4('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0xf1d4('0x7'));var pdf=require('../../components/export/pdf');var logger=require(_0xf1d4('0x8'))(_0xf1d4('0x9'));var config=require('../../config/environment');var db=require(_0xf1d4('0xa'))['db'];config['redis']=_[_0xf1d4('0xb')](config[_0xf1d4('0xc')],{'host':_0xf1d4('0xd'),'port':0x18eb});var socket=require(_0xf1d4('0xe'))(new Redis(config[_0xf1d4('0xc')]));require(_0xf1d4('0xf'))[_0xf1d4('0x10')](socket);function respondWithStatusCode(_0x387637,_0x4ddc3e){_0x4ddc3e=_0x4ddc3e||0xcc;return function(_0x245ba6){if(_0x245ba6){return _0x387637[_0xf1d4('0x11')](_0x4ddc3e);}return _0x387637[_0xf1d4('0x12')](_0x4ddc3e)[_0xf1d4('0x13')]();};}function respondWithResult(_0x2047fc,_0x1b6397){_0x1b6397=_0x1b6397||0xc8;return function(_0x51570c){if(_0x51570c){return _0x2047fc['status'](_0x1b6397)[_0xf1d4('0x14')](_0x51570c);}};}function respondWithFilteredResult(_0x380dd6,_0x11609f){return function(_0x5a05dd){if(_0x5a05dd){var _0x1a4a84=typeof _0x11609f[_0xf1d4('0x15')]==='undefined'&&typeof _0x11609f[_0xf1d4('0x16')]===_0xf1d4('0x17');var _0x140445=_0x5a05dd[_0xf1d4('0x18')];var _0x40c13c=_0x1a4a84?0x0:_0x11609f[_0xf1d4('0x15')];var _0x537007=_0x1a4a84?_0x5a05dd['count']:_0x11609f[_0xf1d4('0x15')]+_0x11609f[_0xf1d4('0x16')];var _0x3c51d0;if(_0x537007>=_0x140445){_0x537007=_0x140445;_0x3c51d0=0xc8;}else{_0x3c51d0=0xce;}_0x380dd6[_0xf1d4('0x12')](_0x3c51d0);return _0x380dd6[_0xf1d4('0x19')](_0xf1d4('0x1a'),_0x40c13c+'-'+_0x537007+'/'+_0x140445)['json'](_0x5a05dd);}return null;};}function saveUpdates(_0x4330da){return function(_0x535096){if(_0x535096){return _0x535096[_0xf1d4('0x1b')](_0x4330da)[_0xf1d4('0x1c')](function(_0x3c0431){return _0x3c0431;});}return null;};}function removeEntity(_0x86a26){return function(_0x28c37b){if(_0x28c37b){return _0x28c37b[_0xf1d4('0x1d')]()['then'](function(){_0x86a26[_0xf1d4('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x195c0d){return function(_0x1d45fb){if(!_0x1d45fb){_0x195c0d[_0xf1d4('0x11')](0x194);}return _0x1d45fb;};}function handleError(_0xa8f2ff,_0xbac553){_0xbac553=_0xbac553||0x1f4;return function(_0x471968){logger[_0xf1d4('0x1e')](_0x471968[_0xf1d4('0x1f')]);if(_0x471968[_0xf1d4('0x20')]){delete _0x471968[_0xf1d4('0x20')];}_0xa8f2ff['status'](_0xbac553)['send'](_0x471968);};}exports['index']=function(_0x12a2a3,_0x4beb02){var _0x3e9139={};var _0x1d8c2d=_[_0xf1d4('0x21')](db['WhatsappInteraction']['rawAttributes'],function(_0x52ec57){return{'name':_0x52ec57[_0xf1d4('0x22')],'type':_0x52ec57[_0xf1d4('0x23')][_0xf1d4('0x24')]};});_0x3e9139=qs[_0xf1d4('0x25')](_0x1d8c2d,_0x12a2a3);return interaction['findAll'](_0xf1d4('0x26'),_0x12a2a3[_0xf1d4('0x27')],_0x12a2a3[_0xf1d4('0x28')],_0x3e9139,_0x1d8c2d)[_0xf1d4('0x1c')](respondWithFilteredResult(_0x4beb02,_0x3e9139))[_0xf1d4('0x29')](handleError(_0x4beb02,null));};exports[_0xf1d4('0x2a')]=function(_0x32fe14,_0x53f1e4){var _0x21febf={'raw':![],'where':{'id':_0x32fe14[_0xf1d4('0x2b')]['id']}},_0x921f7a={};_0x921f7a[_0xf1d4('0x2c')]=_[_0xf1d4('0x2d')](db['WhatsappInteraction'][_0xf1d4('0x2e')]);_0x921f7a[_0xf1d4('0x27')]=_[_0xf1d4('0x2d')](_0x32fe14[_0xf1d4('0x27')]);_0x921f7a[_0xf1d4('0x2f')]=_[_0xf1d4('0x30')](_0x921f7a[_0xf1d4('0x2c')],_0x921f7a[_0xf1d4('0x27')]);_0x21febf[_0xf1d4('0x31')]=_['intersection'](_0x921f7a[_0xf1d4('0x2c')],qs['fields'](_0x32fe14['query']['fields']));_0x21febf[_0xf1d4('0x31')]=_0x21febf[_0xf1d4('0x31')][_0xf1d4('0x32')]?_0x21febf['attributes']:_0x921f7a[_0xf1d4('0x2c')];if(_0x32fe14['query'][_0xf1d4('0x33')]){_0x21febf[_0xf1d4('0x34')]=[{'all':!![]}];}_0x21febf=_[_0xf1d4('0x35')]({},_0x21febf,_0x32fe14[_0xf1d4('0x36')]);return db['WhatsappInteraction'][_0xf1d4('0x37')](_0x21febf)[_0xf1d4('0x1c')](handleEntityNotFound(_0x53f1e4,null))[_0xf1d4('0x1c')](respondWithResult(_0x53f1e4,null))[_0xf1d4('0x29')](handleError(_0x53f1e4,null));};exports[_0xf1d4('0x38')]=function(_0x196672,_0xde935a){return db[_0xf1d4('0x39')][_0xf1d4('0x38')](_0x196672[_0xf1d4('0x3a')],{})[_0xf1d4('0x1c')](respondWithResult(_0xde935a,0xc9))[_0xf1d4('0x29')](handleError(_0xde935a,null));};exports[_0xf1d4('0x1b')]=function(_0x2d0c11,_0x20f345){if(_0x2d0c11[_0xf1d4('0x3a')]['id']){delete _0x2d0c11[_0xf1d4('0x3a')]['id'];}return db['WhatsappInteraction']['find']({'where':{'id':_0x2d0c11[_0xf1d4('0x2b')]['id']}})[_0xf1d4('0x1c')](handleEntityNotFound(_0x20f345,null))[_0xf1d4('0x1c')](saveUpdates(_0x2d0c11[_0xf1d4('0x3a')],null))[_0xf1d4('0x1c')](respondWithResult(_0x20f345,null))[_0xf1d4('0x29')](handleError(_0x20f345,null));};exports[_0xf1d4('0x1d')]=function(_0x317e69,_0x5dfb5d){return db[_0xf1d4('0x39')]['find']({'where':{'id':_0x317e69[_0xf1d4('0x2b')]['id']}})[_0xf1d4('0x1c')](handleEntityNotFound(_0x5dfb5d,null))['then'](removeEntity(_0x5dfb5d,null))[_0xf1d4('0x29')](handleError(_0x5dfb5d,null));};exports[_0xf1d4('0x3b')]=function(_0x23a579,_0x24a7f7){return db[_0xf1d4('0x39')]['describe']()[_0xf1d4('0x1c')](respondWithResult(_0x24a7f7,null))['catch'](handleError(_0x24a7f7,null));};exports[_0xf1d4('0x3c')]=function(_0x176df3,_0x34144a){return db['WhatsappMessage'][_0xf1d4('0x37')]({'where':{'id':_0x176df3[_0xf1d4('0x2b')]['id']}})['then'](handleEntityNotFound(_0x34144a,null))['then'](function(_0x4c25f0){if(_0x4c25f0){return _0x4c25f0[_0xf1d4('0x3c')](_0x176df3[_0xf1d4('0x3a')][_0xf1d4('0x3d')],_[_0xf1d4('0x3e')](_0x176df3[_0xf1d4('0x3a')],[_0xf1d4('0x3d'),'id'])||{});}})[_0xf1d4('0x1c')](respondWithResult(_0x34144a,null))['catch'](handleError(_0x34144a,null));};exports[_0xf1d4('0x3f')]=function(_0x295404,_0x372735){var _0x50fff6={'raw':![],'where':{}};var _0x301bbd={};var _0x5c3fc7={'count':0x0,'rows':[]};return db[_0xf1d4('0x39')][_0xf1d4('0x40')]({'where':{'id':_0x295404['params']['id']}})['then'](handleEntityNotFound(_0x372735,null))[_0xf1d4('0x1c')](function(_0x3d7f5a){if(_0x3d7f5a){_0x301bbd['model']=_['keys'](db[_0xf1d4('0x41')][_0xf1d4('0x2e')]);_0x301bbd[_0xf1d4('0x27')]=_[_0xf1d4('0x2d')](_0x295404[_0xf1d4('0x27')]);_0x301bbd[_0xf1d4('0x2f')]=_[_0xf1d4('0x30')](_0x301bbd[_0xf1d4('0x2c')],_0x301bbd[_0xf1d4('0x27')]);_0x50fff6[_0xf1d4('0x31')]=_['intersection'](_0x301bbd[_0xf1d4('0x2c')],qs[_0xf1d4('0x42')](_0x295404['query'][_0xf1d4('0x42')]));_0x50fff6[_0xf1d4('0x31')]=_0x50fff6[_0xf1d4('0x31')][_0xf1d4('0x32')]?_0x50fff6[_0xf1d4('0x31')]:_0x301bbd[_0xf1d4('0x2c')];if(!_0x295404[_0xf1d4('0x27')]['hasOwnProperty']('nolimit')){_0x50fff6[_0xf1d4('0x16')]=qs[_0xf1d4('0x16')](_0x295404[_0xf1d4('0x27')][_0xf1d4('0x16')]);_0x50fff6[_0xf1d4('0x15')]=qs[_0xf1d4('0x15')](_0x295404['query'][_0xf1d4('0x15')]);}_0x50fff6[_0xf1d4('0x43')]=qs[_0xf1d4('0x44')](_0x295404[_0xf1d4('0x27')][_0xf1d4('0x44')]);_0x50fff6[_0xf1d4('0x45')]=qs['filters'](_[_0xf1d4('0x46')](_0x295404[_0xf1d4('0x27')],_0x301bbd['filters']));_0x50fff6[_0xf1d4('0x45')][_0xf1d4('0x47')]=_0x3d7f5a['id'];if(_0x295404[_0xf1d4('0x27')][_0xf1d4('0x48')]){_0x50fff6[_0xf1d4('0x45')]=_[_0xf1d4('0x35')](_0x50fff6[_0xf1d4('0x45')],{'$or':_[_0xf1d4('0x21')](_0x50fff6['attributes'],function(_0x3cbdea){var _0x18d427={};_0x18d427[_0x3cbdea]={'$like':'%'+_0x295404[_0xf1d4('0x27')][_0xf1d4('0x48')]+'%'};return _0x18d427;})});}if(_0x295404[_0xf1d4('0x27')]['$gte']){var _0x43324b=_0x295404['query'][_0xf1d4('0x49')]['split'](',');var _0x16ed37={};_0x16ed37[_0x43324b[0x0]]={'$gte':moment(_0x43324b[0x1])[_0xf1d4('0x4a')](_0xf1d4('0x4b'))};_0x50fff6[_0xf1d4('0x45')]=_[_0xf1d4('0x35')](_0x50fff6[_0xf1d4('0x45')],_0x16ed37);}_0x50fff6=_[_0xf1d4('0x35')]({},_0x50fff6,_0x295404['options']);return db[_0xf1d4('0x41')][_0xf1d4('0x18')]({'where':_0x50fff6['where']})[_0xf1d4('0x1c')](function(_0x4554b0){_0x5c3fc7['count']=_0x4554b0;if(_0x295404[_0xf1d4('0x27')][_0xf1d4('0x33')]){_0x50fff6[_0xf1d4('0x34')]=[{'all':!![]}];}return db[_0xf1d4('0x41')][_0xf1d4('0x4c')](_0x50fff6);})[_0xf1d4('0x1c')](function(_0x73d024){_0x5c3fc7[_0xf1d4('0x4d')]=_0x73d024;return _0x5c3fc7;});}})[_0xf1d4('0x1c')](respondWithFilteredResult(_0x372735,_0x50fff6))[_0xf1d4('0x29')](handleError(_0x372735,null));};exports[_0xf1d4('0x4e')]=function(_0xe6aeac,_0xebee76){return db[_0xf1d4('0x39')][_0xf1d4('0x37')]({'where':{'id':_0xe6aeac[_0xf1d4('0x2b')]['id']}})['then'](handleEntityNotFound(_0xebee76,null))[_0xf1d4('0x1c')](function(_0x37d4ad){if(_0x37d4ad){return _0x37d4ad[_0xf1d4('0x4f')](_0xe6aeac[_0xf1d4('0x3a')]['ids'],_[_0xf1d4('0x3e')](_0xe6aeac[_0xf1d4('0x3a')],[_0xf1d4('0x3d'),'id'])||{})[_0xf1d4('0x50')](function(){return db[_0xf1d4('0x51')][_0xf1d4('0x4c')]({'attributes':['id','name','color'],'where':{'id':_0xe6aeac[_0xf1d4('0x3a')][_0xf1d4('0x3d')]}});})[_0xf1d4('0x1c')](function(_0x164cdb){socket['emit']('whatsappInteractionTags:save',{'id':Number(_0xe6aeac[_0xf1d4('0x2b')]['id']),'tags':_0x164cdb||[]});return{'id':Number(_0xe6aeac[_0xf1d4('0x2b')]['id']),'tags':_0x164cdb||[]};});}})[_0xf1d4('0x1c')](respondWithResult(_0xebee76,null))[_0xf1d4('0x29')](handleError(_0xebee76,null));};exports[_0xf1d4('0x52')]=function(_0x28d045,_0x33661c){return db[_0xf1d4('0x39')][_0xf1d4('0x37')]({'where':{'id':_0x28d045['params']['id']}})['then'](handleEntityNotFound(_0x33661c,null))[_0xf1d4('0x1c')](function(_0xac8ede){if(_0xac8ede){return _0xac8ede[_0xf1d4('0x52')](_0x28d045[_0xf1d4('0x27')][_0xf1d4('0x3d')]);}})['then'](respondWithStatusCode(_0x33661c,null))['catch'](handleError(_0x33661c,null));};exports[_0xf1d4('0x53')]=function(_0x1c4b8a,_0x53e76e){var _0x57e728=moment()['unix']()[_0xf1d4('0x54')]();var _0x30e8df=path[_0xf1d4('0x55')](config[_0xf1d4('0x56')],_0xf1d4('0x57'),_0xf1d4('0x58'),_0xf1d4('0x59'));var _0x36601d=path[_0xf1d4('0x55')](config[_0xf1d4('0x56')],_0xf1d4('0x57'),_0xf1d4('0x58'),_0xf1d4('0x5a'));var _0x3a9eca=path[_0xf1d4('0x55')](_0x30e8df,_0x57e728);var _0x38ac01=util[_0xf1d4('0x4a')](_0xf1d4('0x5b'),_0x1c4b8a[_0xf1d4('0x2b')]['id'],_0x57e728);var _0xf14cfc=path[_0xf1d4('0x55')](_0x30e8df,_0x38ac01);var _0x1c0862=[];_0x1c0862[_0xf1d4('0x5c')]({'model':db['User'],'as':_0xf1d4('0x5d'),'attributes':['id',_0xf1d4('0x5e')],'raw':!![]});_0x1c0862[_0xf1d4('0x5c')]({'model':db[_0xf1d4('0x5f')],'as':_0xf1d4('0x60'),'attributes':['id',_0xf1d4('0x61'),_0xf1d4('0x62')],'raw':!![]});if(_0x1c4b8a[_0xf1d4('0x27')][_0xf1d4('0x5a')]){_0x1c0862[_0xf1d4('0x5c')]({'model':db['Attachment'],'as':_0xf1d4('0x63'),'raw':!![]});}var _0xbc606f=[{'model':db[_0xf1d4('0x41')],'as':_0xf1d4('0x64'),'attributes':['id','body',_0xf1d4('0x65'),_0xf1d4('0x66'),_0xf1d4('0x67'),_0xf1d4('0x68')],'include':_0x1c0862}];_0xbc606f[_0xf1d4('0x5c')]({'model':db['WhatsappAccount'],'as':_0xf1d4('0x69'),'attributes':['id',_0xf1d4('0x20')]});_0xbc606f[_0xf1d4('0x5c')]({'model':db[_0xf1d4('0x5d')],'as':_0xf1d4('0x6a'),'attributes':['id',_0xf1d4('0x5e')]});return db[_0xf1d4('0x39')]['find']({'where':{'id':_0x1c4b8a[_0xf1d4('0x2b')]['id']},'include':_0xbc606f})[_0xf1d4('0x1c')](handleEntityNotFound(_0x53e76e,null))[_0xf1d4('0x1c')](function(_0x2e0ca3){if(_0x2e0ca3){var _0x248b22=_0x2e0ca3[_0xf1d4('0x6b')]({'plain':!![]});fs[_0xf1d4('0x6c')](_0x3a9eca);var _0x440b48={'channel':_0xf1d4('0x6d'),'account':_0x248b22[_0xf1d4('0x69')][_0xf1d4('0x20')],'agent':_0x248b22[_0xf1d4('0x6a')]?_0x248b22['Owner'][_0xf1d4('0x5e')]:_0xf1d4('0x6e'),'createdAt':moment(_0x248b22[_0xf1d4('0x65')])[_0xf1d4('0x4a')](_0xf1d4('0x4b'))['toString'](),'closedAt':_0x248b22[_0xf1d4('0x6f')]?moment(_0x248b22['closedAt'])[_0xf1d4('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x248b22[_0xf1d4('0x70')],'messages':_(_0x248b22['Messages'])[_0xf1d4('0x48')]({'secret':![]})[_0xf1d4('0x21')](function(_0x35b53d){if(_0x35b53d[_0xf1d4('0x63')]){var _0x3257fd=path['join'](_0x36601d,_0x35b53d['Attachment']['basename']);if(fs['existsSync'](_0x3257fd)){fs[_0xf1d4('0x71')](_0x3257fd)[_0xf1d4('0x72')](fs[_0xf1d4('0x73')](path['join'](_0x3a9eca,_0x35b53d['Attachment']['basename'])));}}return{'date':moment(_0x35b53d[_0xf1d4('0x65')])[_0xf1d4('0x4a')](_0xf1d4('0x4b'))[_0xf1d4('0x54')](),'sender':_0x35b53d[_0xf1d4('0x66')]==='out'?_0x35b53d[_0xf1d4('0x5d')]?_0x35b53d['User'][_0xf1d4('0x5e')]:_0xf1d4('0x74'):_0x35b53d[_0xf1d4('0x60')][_0xf1d4('0x61')]+(_0x35b53d[_0xf1d4('0x60')][_0xf1d4('0x62')]?'\x20'+_0x35b53d['Contact'][_0xf1d4('0x62')]:''),'body':_0x35b53d[_0xf1d4('0x63')]?_0x35b53d[_0xf1d4('0x63')]['basename']:_0x35b53d[_0xf1d4('0x3a')],'direction':_0x35b53d[_0xf1d4('0x66')]==='out'?'A':'C','secret':_0x35b53d[_0xf1d4('0x67')],'read':_0x35b53d['read'],'attachment':_0x35b53d['Attachment']};})[_0xf1d4('0x75')]()};return ejs[_0xf1d4('0x76')](path['join'](config['root'],_0xf1d4('0x57'),'views','downloadInteraction.ejs'),{'interaction':_0x440b48})[_0xf1d4('0x1c')](function(_0x39c3b5){var _0x5a013d=path['join'](_0x3a9eca,_0xf1d4('0x77')+_0x248b22['id']+'-'+_0x57e728+'.pdf');var _0x4f0f12={'path':_0x5a013d,'channel':_0xf1d4('0x6d'),'interactionId':_0x248b22['id']};return pdf['createPdfFromHTML'](_0x39c3b5,_0x4f0f12);})['then'](function(){return new BPromise(function(_0x1ff985,_0x186015){zipdir(_0x3a9eca,{'saveTo':_0xf14cfc},function(_0x1b63bd,_0x54ba8b){if(_0x1b63bd)return _0x186015(_0x1b63bd);return _0x1ff985(_0x54ba8b);});})[_0xf1d4('0x1c')](function(){return new BPromise(function(_0x22f8a7,_0x179570){rimraf(_0x3a9eca,function(_0x125087){if(_0x125087)_0x179570(_0x125087);return _0x22f8a7();});});})[_0xf1d4('0x1c')](function(){return _0x53e76e[_0xf1d4('0x53')](_0xf14cfc,_0x38ac01,function(_0x23421b){if(_0x23421b){console[_0xf1d4('0x78')]('err',_0x23421b);}else{fs['unlinkSync'](_0xf14cfc);}});});});}else{return _0x53e76e[_0xf1d4('0x11')](0xc8);}})[_0xf1d4('0x29')](handleError(_0x53e76e,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index dfc793a..61656cb 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 _0x3c81=['hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','getUsers','then','Users','findAll','setDataValue','unreadMessages','length','emit','catch'];(function(_0x1e29a9,_0x3b695a){var _0x48786a=function(_0x24e9ab){while(--_0x24e9ab){_0x1e29a9['push'](_0x1e29a9['shift']());}};_0x48786a(++_0x3b695a);}(_0x3c81,0x102));var _0x13c8=function(_0x4105a7,_0x2411ef){_0x4105a7=_0x4105a7-0x0;var _0x38d3bb=_0x3c81[_0x4105a7];return _0x38d3bb;};'use strict';var EventEmitter=require(_0x13c8('0x0'));var WhatsappInteraction=require(_0x13c8('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x13c8('0x1'))['db'][_0x13c8('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x101d4f){return function(_0x3ec886,_0x18bd0f,_0x1c16f1){_0x3ec886[_0x13c8('0x3')]({'attributes':['id'],'raw':!![]})[_0x13c8('0x4')](function(_0x445b69){_0x3ec886['setDataValue'](_0x13c8('0x5'),_0x445b69['map'](function(_0x380aed){return{'id':_0x380aed['id']};}));return WhatsappMessage[_0x13c8('0x6')]({'where':{'WhatsappInteractionId':_0x3ec886['id'],'direction':'in','read':![]},'raw':!![]});})[_0x13c8('0x4')](function(_0x30b4d6){_0x3ec886[_0x13c8('0x7')](_0x13c8('0x8'),_0x30b4d6[_0x13c8('0x9')]);WhatsappInteractionEvents[_0x13c8('0xa')](_0x101d4f+':'+_0x3ec886['id'],_0x3ec886);WhatsappInteractionEvents[_0x13c8('0xa')](_0x101d4f,_0x3ec886);_0x1c16f1(null);})[_0x13c8('0xb')](_0x1c16f1(null));};}for(var e in events){if(events[_0x13c8('0xc')](e)){var event=events[e];WhatsappInteraction[_0x13c8('0xd')](e,emitEvent(event));}}module[_0x13c8('0xe')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xc874=['emit','catch','hook','exports','events','WhatsappInteraction','../../mysqldb','save','update','remove','getUsers','then','setDataValue','Users','unreadMessages','length'];(function(_0x15e06f,_0xa2de37){var _0x579ee0=function(_0x346e87){while(--_0x346e87){_0x15e06f['push'](_0x15e06f['shift']());}};_0x579ee0(++_0xa2de37);}(_0xc874,0x154));var _0x4c87=function(_0x16de68,_0x33d7ff){_0x16de68=_0x16de68-0x0;var _0x1c277e=_0xc874[_0x16de68];return _0x1c277e;};'use strict';var EventEmitter=require(_0x4c87('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0x4c87('0x1')];var WhatsappMessage=require(_0x4c87('0x2'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4c87('0x3'),'afterUpdate':_0x4c87('0x4'),'afterDestroy':_0x4c87('0x5')};function emitEvent(_0x575a7c){return function(_0x3fbf14,_0xebd7d1,_0x5d63ae){_0x3fbf14[_0x4c87('0x6')]({'attributes':['id'],'raw':!![]})[_0x4c87('0x7')](function(_0x30c939){_0x3fbf14[_0x4c87('0x8')](_0x4c87('0x9'),_0x30c939['map'](function(_0x1e0897){return{'id':_0x1e0897['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x3fbf14['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4c87('0x7')](function(_0x42f471){_0x3fbf14[_0x4c87('0x8')](_0x4c87('0xa'),_0x42f471[_0x4c87('0xb')]);WhatsappInteractionEvents['emit'](_0x575a7c+':'+_0x3fbf14['id'],_0x3fbf14);WhatsappInteractionEvents[_0x4c87('0xc')](_0x575a7c,_0x3fbf14);_0x5d63ae(null);})[_0x4c87('0xd')](_0x5d63ae(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x4c87('0xe')](e,emitEvent(event));}}module[_0x4c87('0xf')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 56f530e..4df96c7 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 _0x713e=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','path','rimraf','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed'];(function(_0x4a0f16,_0x21ba18){var _0x45d653=function(_0x137e2c){while(--_0x137e2c){_0x4a0f16['push'](_0x4a0f16['shift']());}};_0x45d653(++_0x21ba18);}(_0x713e,0x147));var _0xe713=function(_0x229e80,_0x414425){_0x229e80=_0x229e80-0x0;var _0x30c4a4=_0x713e[_0x229e80];return _0x30c4a4;};'use strict';var _=require(_0xe713('0x0'));var util=require(_0xe713('0x1'));var logger=require(_0xe713('0x2'))(_0xe713('0x3'));var moment=require('moment');var BPromise=require(_0xe713('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe713('0x5'));var rimraf=require(_0xe713('0x6'));var config=require('../../config/environment');var attributes=require(_0xe713('0x7'));module[_0xe713('0x8')]=function(_0x47f3ea,_0x1cb55a){return _0x47f3ea[_0xe713('0x9')](_0xe713('0xa'),attributes,{'tableName':_0xe713('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x23e227,_0x4191b,_0x456175){if(_0x23e227[_0xe713('0xc')](_0xe713('0xd'))){_0x23e227[_0xe713('0xe')]=moment()[_0xe713('0xf')](_0xe713('0x10'));}_0x456175(null,_0x23e227);}}});}; \ No newline at end of file +var _0x6967=['util','api','moment','bluebird','path','rimraf','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','changed','closed','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x856272,_0x35d8fe){var _0x2abec4=function(_0x320353){while(--_0x320353){_0x856272['push'](_0x856272['shift']());}};_0x2abec4(++_0x35d8fe);}(_0x6967,0x99));var _0x7696=function(_0x20e8d3,_0x480761){_0x20e8d3=_0x20e8d3-0x0;var _0x30e1ff=_0x6967[_0x20e8d3];return _0x30e1ff;};'use strict';var _=require(_0x7696('0x0'));var util=require(_0x7696('0x1'));var logger=require('../../config/logger')(_0x7696('0x2'));var moment=require(_0x7696('0x3'));var BPromise=require(_0x7696('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7696('0x5'));var rimraf=require(_0x7696('0x6'));var config=require('../../config/environment');var attributes=require(_0x7696('0x7'));module[_0x7696('0x8')]=function(_0x1dff87,_0x256b5d){return _0x1dff87[_0x7696('0x9')](_0x7696('0xa'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4d5b1d,_0xdb4488,_0x42b537){if(_0x4d5b1d[_0x7696('0xb')](_0x7696('0xc'))){_0x4d5b1d['closedAt']=moment()['format'](_0x7696('0xd'));}_0x42b537(null,_0x4d5b1d);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index b47f30a..9cf174e 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 _0xc21a=['socket.io-emitter','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','message','WhatsappInteraction','update','body','options','raw','where','limit','UpdateWhatsappInteraction','stringify','catch','AddTagsToWhatsappInteraction','find','ids','omit','spread','AddTags','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x2fea53,_0x4c275c){var _0x3f48b5=function(_0x9a198a){while(--_0x9a198a){_0x2fea53['push'](_0x2fea53['shift']());}};_0x3f48b5(++_0x4c275c);}(_0xc21a,0x90));var _0xac21=function(_0x89807f,_0x16741b){_0x89807f=_0x89807f-0x0;var _0x352f86=_0xc21a[_0x89807f];return _0x352f86;};'use strict';var _=require('lodash');var util=require(_0xac21('0x0'));var moment=require(_0xac21('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xac21('0x2'));var db=require(_0xac21('0x3'))['db'];var utils=require(_0xac21('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xac21('0x5'));var jayson=require(_0xac21('0x6'));var client=jayson[_0xac21('0x7')][_0xac21('0x8')]({'port':0x232a});config[_0xac21('0x9')]=_[_0xac21('0xa')](config[_0xac21('0x9')],{'host':_0xac21('0xb'),'port':0x18eb});var socket=require(_0xac21('0xc'))(new Redis(config[_0xac21('0x9')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x3f391b,_0x26d6ec,_0x57a1bd){return new BPromise(function(_0x38f4f5,_0xc648b0){return client[_0xac21('0xd')](_0x3f391b,_0x57a1bd)[_0xac21('0xe')](function(_0x2ec9f3){logger[_0xac21('0xf')](_0xac21('0x10'),_0x26d6ec,_0xac21('0x11'));logger[_0xac21('0x12')](_0xac21('0x13'),_0x26d6ec,_0xac21('0x11'),JSON['stringify'](_0x2ec9f3));if(_0x2ec9f3['error']){if(_0x2ec9f3[_0xac21('0x14')][_0xac21('0x15')]===0x1f4){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x26d6ec,_0x2ec9f3[_0xac21('0x14')][_0xac21('0x16')]);return _0xc648b0(_0x2ec9f3[_0xac21('0x14')][_0xac21('0x16')]);}logger['error'](_0xac21('0x10'),_0x26d6ec,_0x2ec9f3[_0xac21('0x14')]['message']);return _0x38f4f5(_0x2ec9f3[_0xac21('0x14')][_0xac21('0x16')]);}else{logger[_0xac21('0xf')](_0xac21('0x10'),_0x26d6ec,_0xac21('0x11'));_0x38f4f5(_0x2ec9f3['result'][_0xac21('0x16')]);}})['catch'](function(_0x51341c){logger[_0xac21('0x14')](_0xac21('0x10'),_0x26d6ec,_0x51341c);_0xc648b0(_0x51341c);});});}exports['UpdateWhatsappInteraction']=function(_0x269a41){var _0x18cde3=this;return new Promise(function(_0x198b78,_0x230ecd){return db[_0xac21('0x17')][_0xac21('0x18')](_0x269a41[_0xac21('0x19')],{'raw':_0x269a41[_0xac21('0x1a')]?_0x269a41['options'][_0xac21('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x269a41[_0xac21('0x1a')]?_0x269a41[_0xac21('0x1a')][_0xac21('0x1c')]||null:null,'attributes':_0x269a41['options']?_0x269a41['options']['attributes']||null:null,'limit':_0x269a41['options']?_0x269a41[_0xac21('0x1a')][_0xac21('0x1d')]||null:null})[_0xac21('0xe')](function(_0x525489){logger['info'](_0xac21('0x1e'),_0x269a41);logger['debug'](_0xac21('0x1e'),_0x269a41,JSON[_0xac21('0x1f')](_0x525489));_0x198b78(_0x525489);})[_0xac21('0x20')](function(_0x3a4daa){logger['error']('UpdateWhatsappInteraction',_0x3a4daa['message'],_0x269a41);_0x230ecd(_0x18cde3[_0xac21('0x14')](0x1f4,_0x3a4daa['message']));});});};exports[_0xac21('0x21')]=function(_0x345d99){return new Promise(function(_0x238581,_0x12dfb6){return db[_0xac21('0x17')][_0xac21('0x22')]({'where':_0x345d99['options']?_0x345d99[_0xac21('0x1a')][_0xac21('0x1c')]||null:null})['then'](function(_0x1323e9){if(_0x1323e9){return _0x1323e9['addTags'](_0x345d99[_0xac21('0x19')][_0xac21('0x23')],_[_0xac21('0x24')](_0x345d99[_0xac21('0x19')],['ids','id'])||{});}})[_0xac21('0x25')](function(_0x5cea14){logger['info'](_0xac21('0x26'),_0x345d99);logger['debug'](_0xac21('0x26'),_0x345d99,JSON[_0xac21('0x1f')](_0x5cea14));_0x238581(_0x5cea14);})[_0xac21('0x20')](function(_0x1bf61c){logger[_0xac21('0x14')]('AddTags',_0x1bf61c[_0xac21('0x16')],_0x345d99);_0x12dfb6(_this['error'](0x1f4,_0x1bf61c[_0xac21('0x16')]));});});}; \ No newline at end of file +var _0x4e2f=['WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw','where','attributes','limit','catch','AddTagsToWhatsappInteraction','addTags','ids','omit','body','spread','debug','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','request','then','info','WhatsappInteraction,\x20%s,\x20%s'];(function(_0x481ee8,_0x5aa574){var _0x5ad55f=function(_0x81c176){while(--_0x81c176){_0x481ee8['push'](_0x481ee8['shift']());}};_0x5ad55f(++_0x5aa574);}(_0x4e2f,0xc3));var _0xf4e2=function(_0x56ef0c,_0xe89aa0){_0x56ef0c=_0x56ef0c-0x0;var _0x4f192b=_0x4e2f[_0x56ef0c];return _0x4f192b;};'use strict';var _=require(_0xf4e2('0x0'));var util=require(_0xf4e2('0x1'));var moment=require('moment');var BPromise=require(_0xf4e2('0x2'));var rs=require(_0xf4e2('0x3'));var fs=require('fs');var Redis=require(_0xf4e2('0x4'));var db=require(_0xf4e2('0x5'))['db'];var utils=require(_0xf4e2('0x6'));var logger=require(_0xf4e2('0x7'))(_0xf4e2('0x8'));var config=require(_0xf4e2('0x9'));var jayson=require(_0xf4e2('0xa'));var client=jayson[_0xf4e2('0xb')][_0xf4e2('0xc')]({'port':0x232a});config[_0xf4e2('0xd')]=_[_0xf4e2('0xe')](config[_0xf4e2('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xf4e2('0xf'))(new Redis(config[_0xf4e2('0xd')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x10188b,_0x1196aa,_0x47a855){return new BPromise(function(_0x1aa14f,_0xb9211e){return client[_0xf4e2('0x10')](_0x10188b,_0x47a855)[_0xf4e2('0x11')](function(_0xd7f73e){logger[_0xf4e2('0x12')](_0xf4e2('0x13'),_0x1196aa,'request\x20sent');logger['debug'](_0xf4e2('0x14'),_0x1196aa,_0xf4e2('0x15'),JSON[_0xf4e2('0x16')](_0xd7f73e));if(_0xd7f73e[_0xf4e2('0x17')]){if(_0xd7f73e[_0xf4e2('0x17')]['code']===0x1f4){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x1196aa,_0xd7f73e[_0xf4e2('0x17')][_0xf4e2('0x18')]);return _0xb9211e(_0xd7f73e[_0xf4e2('0x17')][_0xf4e2('0x18')]);}logger[_0xf4e2('0x17')]('WhatsappInteraction,\x20%s,\x20%s',_0x1196aa,_0xd7f73e[_0xf4e2('0x17')][_0xf4e2('0x18')]);return _0x1aa14f(_0xd7f73e[_0xf4e2('0x17')][_0xf4e2('0x18')]);}else{logger[_0xf4e2('0x12')](_0xf4e2('0x13'),_0x1196aa,_0xf4e2('0x15'));_0x1aa14f(_0xd7f73e[_0xf4e2('0x19')][_0xf4e2('0x18')]);}})['catch'](function(_0x2e5456){logger[_0xf4e2('0x17')](_0xf4e2('0x13'),_0x1196aa,_0x2e5456);_0xb9211e(_0x2e5456);});});}exports[_0xf4e2('0x1a')]=function(_0x193cd8){var _0x5afd4f=this;return new Promise(function(_0x1c362d,_0x5c08b9){return db[_0xf4e2('0x1b')][_0xf4e2('0x1c')](_0x193cd8['body'],{'raw':_0x193cd8['options']?_0x193cd8[_0xf4e2('0x1d')][_0xf4e2('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x193cd8[_0xf4e2('0x1d')]?_0x193cd8[_0xf4e2('0x1d')][_0xf4e2('0x1f')]||null:null,'attributes':_0x193cd8[_0xf4e2('0x1d')]?_0x193cd8[_0xf4e2('0x1d')][_0xf4e2('0x20')]||null:null,'limit':_0x193cd8[_0xf4e2('0x1d')]?_0x193cd8[_0xf4e2('0x1d')][_0xf4e2('0x21')]||null:null})[_0xf4e2('0x11')](function(_0x583c12){logger[_0xf4e2('0x12')](_0xf4e2('0x1a'),_0x193cd8);logger['debug']('UpdateWhatsappInteraction',_0x193cd8,JSON[_0xf4e2('0x16')](_0x583c12));_0x1c362d(_0x583c12);})[_0xf4e2('0x22')](function(_0x3ab8c1){logger[_0xf4e2('0x17')](_0xf4e2('0x1a'),_0x3ab8c1[_0xf4e2('0x18')],_0x193cd8);_0x5c08b9(_0x5afd4f[_0xf4e2('0x17')](0x1f4,_0x3ab8c1[_0xf4e2('0x18')]));});});};exports[_0xf4e2('0x23')]=function(_0x5b8034){return new Promise(function(_0x3cc912,_0x27e5e2){return db[_0xf4e2('0x1b')]['find']({'where':_0x5b8034[_0xf4e2('0x1d')]?_0x5b8034[_0xf4e2('0x1d')][_0xf4e2('0x1f')]||null:null})['then'](function(_0x3ae29f){if(_0x3ae29f){return _0x3ae29f[_0xf4e2('0x24')](_0x5b8034['body'][_0xf4e2('0x25')],_[_0xf4e2('0x26')](_0x5b8034[_0xf4e2('0x27')],[_0xf4e2('0x25'),'id'])||{});}})[_0xf4e2('0x28')](function(_0x2baa2e){logger['info']('AddTags',_0x5b8034);logger[_0xf4e2('0x29')]('AddTags',_0x5b8034,JSON[_0xf4e2('0x16')](_0x2baa2e));_0x3cc912(_0x2baa2e);})['catch'](function(_0x333bca){logger[_0xf4e2('0x17')](_0xf4e2('0x2a'),_0x333bca[_0xf4e2('0x18')],_0x5b8034);_0x27e5e2(_this[_0xf4e2('0x17')](0x1f4,_0x333bca['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index cea063e..10f2f73 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 _0x6495=['removeListener','length','whatsappInteraction:','save','remove'];(function(_0xe8129c,_0x2fb03c){var _0x709fc5=function(_0xb8e0c6){while(--_0xb8e0c6){_0xe8129c['push'](_0xe8129c['shift']());}};_0x709fc5(++_0x2fb03c);}(_0x6495,0x85));var _0x5649=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x6495[_0xfae23b];return _0x200640;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x5649('0x0'),_0x5649('0x1'),'update'];function createListener(_0x8aceb1,_0x2004fa){return function(_0x5ae272){_0x2004fa['emit'](_0x8aceb1,_0x5ae272);};}function removeListener(_0x160e29,_0x57f25f){return function(){WhatsappInteractionEvents[_0x5649('0x2')](_0x160e29,_0x57f25f);};}exports['register']=function(_0x514fd6){for(var _0x8ceebd=0x0,_0xa15b85=events[_0x5649('0x3')];_0x8ceebd<_0xa15b85;_0x8ceebd++){var _0x314f29=events[_0x8ceebd];var _0xebc016=createListener(_0x5649('0x4')+_0x314f29,_0x514fd6);WhatsappInteractionEvents['on'](_0x314f29,_0xebc016);}}; \ No newline at end of file +var _0x321a=['whatsappInteraction:','./whatsappInteraction.events','remove','update','emit','register','length'];(function(_0x255c48,_0x2a4449){var _0xaebda3=function(_0x12a04e){while(--_0x12a04e){_0x255c48['push'](_0x255c48['shift']());}};_0xaebda3(++_0x2a4449);}(_0x321a,0xb0));var _0xa321=function(_0x30818e,_0x537701){_0x30818e=_0x30818e-0x0;var _0x4d6a94=_0x321a[_0x30818e];return _0x4d6a94;};'use strict';var WhatsappInteractionEvents=require(_0xa321('0x0'));var events=['save',_0xa321('0x1'),_0xa321('0x2')];function createListener(_0x3f532e,_0x9afca0){return function(_0x24486b){_0x9afca0[_0xa321('0x3')](_0x3f532e,_0x24486b);};}function removeListener(_0x2bd5c4,_0x2ddbf1){return function(){WhatsappInteractionEvents['removeListener'](_0x2bd5c4,_0x2ddbf1);};}exports[_0xa321('0x4')]=function(_0x11be91){for(var _0x2c8bde=0x0,_0x3d7117=events[_0xa321('0x5')];_0x2c8bde<_0x3d7117;_0x2c8bde++){var _0x3c9d1c=events[_0x2c8bde];var _0x260f65=createListener(_0xa321('0x6')+_0x3c9d1c,_0x11be91);WhatsappInteractionEvents['on'](_0x3c9d1c,_0x260f65);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 2b4ad34..6934a93 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 _0x5a24=['index','get','/describe','/:id','show','post','tracked','whatsapp','create','/:id/status','status','put','/:id/accept','accept','reject','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappMessage.controller','isAuthenticated'];(function(_0x2d8645,_0x31b1d0){var _0x556347=function(_0x13b4c4){while(--_0x13b4c4){_0x2d8645['push'](_0x2d8645['shift']());}};_0x556347(++_0x31b1d0);}(_0x5a24,0x1dd));var _0x45a2=function(_0x42e7af,_0x4a0993){_0x42e7af=_0x42e7af-0x0;var _0x3f953f=_0x5a24[_0x42e7af];return _0x3f953f;};'use strict';var multer=require('multer');var util=require(_0x45a2('0x0'));var path=require(_0x45a2('0x1'));var timeout=require(_0x45a2('0x2'));var express=require(_0x45a2('0x3'));var router=express[_0x45a2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x45a2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x45a2('0x6'));var controller=require(_0x45a2('0x7'));router['get']('/',auth[_0x45a2('0x8')](),controller[_0x45a2('0x9')]);router[_0x45a2('0xa')](_0x45a2('0xb'),auth[_0x45a2('0x8')](),controller['describe']);router[_0x45a2('0xa')](_0x45a2('0xc'),auth['isAuthenticated'](),controller[_0x45a2('0xd')]);router[_0x45a2('0xe')]('/',auth['isAuthenticated'](),interaction[_0x45a2('0xf')](_0x45a2('0x10'),'whatsappmessage:create'),controller[_0x45a2('0x11')]);router[_0x45a2('0xe')](_0x45a2('0x12'),controller[_0x45a2('0x13')]);router[_0x45a2('0x14')](_0x45a2('0xc'),auth['isAuthenticated'](),controller['update']);router['put'](_0x45a2('0x15'),auth['isAuthenticated'](),controller[_0x45a2('0x16')]);router['put']('/:id/reject',auth[_0x45a2('0x8')](),controller[_0x45a2('0x17')]);router[_0x45a2('0x18')]('/:id',auth[_0x45a2('0x8')](),controller[_0x45a2('0x19')]);module[_0x45a2('0x1a')]=router; \ No newline at end of file +var _0xb61d=['post','tracked','whatsapp','create','/:id/status','status','update','put','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x314f03,_0x14d0df){var _0x1344aa=function(_0x7c14b2){while(--_0x7c14b2){_0x314f03['push'](_0x314f03['shift']());}};_0x1344aa(++_0x14d0df);}(_0xb61d,0x169));var _0xdb61=function(_0x190260,_0x50b1d7){_0x190260=_0x190260-0x0;var _0x344454=_0xb61d[_0x190260];return _0x344454;};'use strict';var multer=require(_0xdb61('0x0'));var util=require(_0xdb61('0x1'));var path=require(_0xdb61('0x2'));var timeout=require(_0xdb61('0x3'));var express=require(_0xdb61('0x4'));var router=express[_0xdb61('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xdb61('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdb61('0x7'));var controller=require(_0xdb61('0x8'));router[_0xdb61('0x9')]('/',auth[_0xdb61('0xa')](),controller[_0xdb61('0xb')]);router[_0xdb61('0x9')](_0xdb61('0xc'),auth[_0xdb61('0xa')](),controller[_0xdb61('0xd')]);router['get'](_0xdb61('0xe'),auth[_0xdb61('0xa')](),controller[_0xdb61('0xf')]);router[_0xdb61('0x10')]('/',auth[_0xdb61('0xa')](),interaction[_0xdb61('0x11')](_0xdb61('0x12'),'whatsappmessage:create'),controller[_0xdb61('0x13')]);router['post'](_0xdb61('0x14'),controller[_0xdb61('0x15')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xdb61('0x16')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0xdb61('0x17')](_0xdb61('0x18'),auth[_0xdb61('0xa')](),controller[_0xdb61('0x19')]);router[_0xdb61('0x1a')](_0xdb61('0xe'),auth['isAuthenticated'](),controller[_0xdb61('0x1b')]);module[_0xdb61('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index d57a005..1d495d6 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 _0x323e=['BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports','TEXT','medium'];(function(_0x5d048d,_0x13ddae){var _0x280824=function(_0xf985fd){while(--_0xf985fd){_0x5d048d['push'](_0x5d048d['shift']());}};_0x280824(++_0x13ddae);}(_0x323e,0x188));var _0xe323=function(_0x1234cd,_0x3a11e3){_0x1234cd=_0x1234cd-0x0;var _0x5e83b2=_0x323e[_0x1234cd];return _0x5e83b2;};'use strict';var Sequelize=require(_0xe323('0x0'));module[_0xe323('0x1')]={'body':{'type':Sequelize[_0xe323('0x2')](_0xe323('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xe323('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe323('0x5')]('in',_0xe323('0x6')),'defaultValue':_0xe323('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xe323('0x7')](0xbe)},'phone':{'type':Sequelize[_0xe323('0x7')]},'readAt':{'type':Sequelize[_0xe323('0x8')]},'secret':{'type':Sequelize[_0xe323('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xe323('0x2')]}}; \ No newline at end of file +var _0x888e=['out','DATE','STRING','exports','TEXT','BOOLEAN','ENUM'];(function(_0x5ad91b,_0x5d07a6){var _0x4c7410=function(_0x2eac48){while(--_0x2eac48){_0x5ad91b['push'](_0x5ad91b['shift']());}};_0x4c7410(++_0x5d07a6);}(_0x888e,0xc0));var _0xe888=function(_0x2cdc62,_0x4b778b){_0x2cdc62=_0x2cdc62-0x0;var _0x1351d9=_0x888e[_0x2cdc62];return _0x1351d9;};'use strict';var Sequelize=require('sequelize');module[_0xe888('0x0')]={'body':{'type':Sequelize[_0xe888('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe888('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe888('0x3')]('in','out'),'defaultValue':_0xe888('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xe888('0x5')]},'secret':{'type':Sequelize[_0xe888('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xe888('0x6')]},'providerResponse':{'type':Sequelize[_0xe888('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 986c8b9..d7c94fd 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 _0xee14=['get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','../../config/logger','reject','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','internal','rejectmessage','WhatsappAccount','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','./whatsappMessage.socket','register','jayson/promise','http','client','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','save','update','destroy','end','stack','name','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','includeAll','include','findAll','rows','params','keys','options','find','create','body','describe','whatsapp-interactions','whatsapp','read','readAt','format','UserId','user','agent'];(function(_0x189548,_0x30ada7){var _0x261850=function(_0x5ae8b5){while(--_0x5ae8b5){_0x189548['push'](_0x189548['shift']());}};_0x261850(++_0x30ada7);}(_0xee14,0x1e4));var _0x4ee1=function(_0x36346a,_0x47662c){_0x36346a=_0x36346a-0x0;var _0x4d748b=_0xee14[_0x36346a];return _0x4d748b;};'use strict';var emlformat=require(_0x4ee1('0x0'));var rimraf=require(_0x4ee1('0x1'));var zipdir=require(_0x4ee1('0x2'));var jsonpatch=require(_0x4ee1('0x3'));var rp=require(_0x4ee1('0x4'));var moment=require('moment');var BPromise=require(_0x4ee1('0x5'));var Mustache=require(_0x4ee1('0x6'));var util=require(_0x4ee1('0x7'));var path=require(_0x4ee1('0x8'));var sox=require(_0x4ee1('0x9'));var csv=require(_0x4ee1('0xa'));var ejs=require(_0x4ee1('0xb'));var fs=require('fs');var fs_extra=require(_0x4ee1('0xc'));var _=require(_0x4ee1('0xd'));var squel=require(_0x4ee1('0xe'));var crypto=require(_0x4ee1('0xf'));var jsforce=require(_0x4ee1('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x4ee1('0xa'));var querystring=require(_0x4ee1('0x11'));var Papa=require(_0x4ee1('0x12'));var Redis=require(_0x4ee1('0x13'));var authService=require(_0x4ee1('0x14'));var qs=require(_0x4ee1('0x15'));var as=require(_0x4ee1('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4ee1('0x17'));var utils=require(_0x4ee1('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x4ee1('0x19'));var db=require(_0x4ee1('0x1a'))['db'];config[_0x4ee1('0x1b')]=_['defaults'](config[_0x4ee1('0x1b')],{'host':_0x4ee1('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4ee1('0x1b')]));require(_0x4ee1('0x1d'))[_0x4ee1('0x1e')](socket);var jayson=require(_0x4ee1('0x1f'));var client=jayson['client'][_0x4ee1('0x20')]({'port':0x232c});var client9002=jayson[_0x4ee1('0x21')][_0x4ee1('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x5020a2,_0x8ceed5,_0x1de354,_0xeef48a){return new BPromise(function(_0x1949bf,_0x24e35a){var _0x194a14=_0xeef48a||client;return _0x194a14['request'](_0x5020a2,_0x1de354)[_0x4ee1('0x22')](function(_0x3ba037){logger[_0x4ee1('0x23')](_0x4ee1('0x24'),_0x8ceed5,_0x4ee1('0x25'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x8ceed5,'request\x20sent',JSON[_0x4ee1('0x26')](_0x3ba037));if(_0x3ba037[_0x4ee1('0x27')]){if(_0x3ba037[_0x4ee1('0x27')][_0x4ee1('0x28')]===0x1f4){logger['error'](_0x4ee1('0x24'),_0x8ceed5,_0x3ba037[_0x4ee1('0x27')][_0x4ee1('0x29')]);return _0x24e35a(_0x3ba037[_0x4ee1('0x27')][_0x4ee1('0x29')]);}logger['error'](_0x4ee1('0x24'),_0x8ceed5,_0x3ba037[_0x4ee1('0x27')][_0x4ee1('0x29')]);return _0x1949bf(_0x3ba037[_0x4ee1('0x27')][_0x4ee1('0x29')]);}else{logger[_0x4ee1('0x23')](_0x4ee1('0x24'),_0x8ceed5,_0x4ee1('0x25'));_0x1949bf(_0x3ba037[_0x4ee1('0x2a')]['message']);}})[_0x4ee1('0x2b')](function(_0x16a3a3){logger[_0x4ee1('0x27')](_0x4ee1('0x24'),_0x8ceed5,_0x16a3a3);_0x24e35a(_0x16a3a3);});});}function respondWithStatusCode(_0xcc98c9,_0x4b0ae6){_0x4b0ae6=_0x4b0ae6||0xcc;return function(_0x3673b2){if(_0x3673b2){return _0xcc98c9[_0x4ee1('0x2c')](_0x4b0ae6);}return _0xcc98c9[_0x4ee1('0x2d')](_0x4b0ae6)['end']();};}function respondWithResult(_0x1eeec6,_0x5af18f){_0x5af18f=_0x5af18f||0xc8;return function(_0x1ecf85){if(_0x1ecf85){return _0x1eeec6['status'](_0x5af18f)[_0x4ee1('0x2e')](_0x1ecf85);}};}function respondWithFilteredResult(_0x21fb16,_0x3ab316){return function(_0x528d3d){if(_0x528d3d){var _0x21e921=typeof _0x3ab316[_0x4ee1('0x2f')]===_0x4ee1('0x30')&&typeof _0x3ab316['limit']==='undefined';var _0x57e795=_0x528d3d['count'];var _0x358bde=_0x21e921?0x0:_0x3ab316['offset'];var _0x49b82c=_0x21e921?_0x528d3d[_0x4ee1('0x31')]:_0x3ab316[_0x4ee1('0x2f')]+_0x3ab316[_0x4ee1('0x32')];var _0x4cf338;if(_0x49b82c>=_0x57e795){_0x49b82c=_0x57e795;_0x4cf338=0xc8;}else{_0x4cf338=0xce;}_0x21fb16['status'](_0x4cf338);return _0x21fb16['set'](_0x4ee1('0x33'),_0x358bde+'-'+_0x49b82c+'/'+_0x57e795)['json'](_0x528d3d);}return null;};}function patchUpdates(_0x4af058){return function(_0x2bd356){try{jsonpatch[_0x4ee1('0x34')](_0x2bd356,_0x4af058,!![]);}catch(_0xb55c17){return BPromise['reject'](_0xb55c17);}return _0x2bd356[_0x4ee1('0x35')]();};}function saveUpdates(_0x20b416,_0x81a91b){return function(_0x5b7c29){if(_0x5b7c29){return _0x5b7c29[_0x4ee1('0x36')](_0x20b416)[_0x4ee1('0x22')](function(_0xe49805){return _0xe49805;});}return null;};}function removeEntity(_0x743463,_0xc0e978){return function(_0x49b366){if(_0x49b366){return _0x49b366[_0x4ee1('0x37')]()['then'](function(){_0x743463[_0x4ee1('0x2d')](0xcc)[_0x4ee1('0x38')]();});}};}function handleEntityNotFound(_0x60c124,_0x318a9f){return function(_0x16ad4f){if(!_0x16ad4f){_0x60c124[_0x4ee1('0x2c')](0x194);}return _0x16ad4f;};}function handleError(_0x350f70,_0x2a1217){_0x2a1217=_0x2a1217||0x1f4;return function(_0x52add0){logger['error'](_0x52add0[_0x4ee1('0x39')]);if(_0x52add0['name']){delete _0x52add0[_0x4ee1('0x3a')];}_0x350f70[_0x4ee1('0x2d')](_0x2a1217)['send'](_0x52add0);};}exports[_0x4ee1('0x3b')]=function(_0x362bf4,_0x276966){var _0x555caf={},_0x4c4736={},_0x59b56a={'count':0x0,'rows':[]};var _0x5cc023=_[_0x4ee1('0x3c')](db[_0x4ee1('0x3d')][_0x4ee1('0x3e')],function(_0x4f4795){return{'name':_0x4f4795[_0x4ee1('0x3f')],'type':_0x4f4795[_0x4ee1('0x40')][_0x4ee1('0x41')]};});_0x4c4736[_0x4ee1('0x42')]=_[_0x4ee1('0x3c')](_0x5cc023,'name');_0x4c4736[_0x4ee1('0x43')]=_['keys'](_0x362bf4['query']);_0x4c4736[_0x4ee1('0x44')]=_['intersection'](_0x4c4736[_0x4ee1('0x42')],_0x4c4736[_0x4ee1('0x43')]);_0x555caf['attributes']=_[_0x4ee1('0x45')](_0x4c4736['model'],qs[_0x4ee1('0x46')](_0x362bf4[_0x4ee1('0x43')][_0x4ee1('0x46')]));_0x555caf[_0x4ee1('0x47')]=_0x555caf[_0x4ee1('0x47')][_0x4ee1('0x48')]?_0x555caf[_0x4ee1('0x47')]:_0x4c4736[_0x4ee1('0x42')];if(!_0x362bf4[_0x4ee1('0x43')][_0x4ee1('0x49')](_0x4ee1('0x4a'))){_0x555caf[_0x4ee1('0x32')]=qs['limit'](_0x362bf4[_0x4ee1('0x43')][_0x4ee1('0x32')]);_0x555caf[_0x4ee1('0x2f')]=qs['offset'](_0x362bf4['query']['offset']);}_0x555caf[_0x4ee1('0x4b')]=qs[_0x4ee1('0x4c')](_0x362bf4[_0x4ee1('0x43')]['sort']);_0x555caf['where']=qs[_0x4ee1('0x44')](_[_0x4ee1('0x4d')](_0x362bf4[_0x4ee1('0x43')],_0x4c4736[_0x4ee1('0x44')]),_0x5cc023);if(_0x362bf4[_0x4ee1('0x43')][_0x4ee1('0x4e')]){_0x555caf[_0x4ee1('0x4f')]=_['merge'](_0x555caf[_0x4ee1('0x4f')],{'$or':_[_0x4ee1('0x3c')](_0x5cc023,function(_0x2b8915){if(_0x2b8915[_0x4ee1('0x40')]!==_0x4ee1('0x50')){var _0x1e3270={};_0x1e3270[_0x2b8915[_0x4ee1('0x3a')]]={'$like':'%'+_0x362bf4[_0x4ee1('0x43')]['filter']+'%'};return _0x1e3270;}})});}_0x555caf=_['merge']({},_0x555caf,_0x362bf4['options']);var _0x32c373={'where':_0x555caf[_0x4ee1('0x4f')]};return db['WhatsappMessage'][_0x4ee1('0x31')](_0x32c373)['then'](function(_0x313a07){_0x59b56a['count']=_0x313a07;if(_0x362bf4['query'][_0x4ee1('0x51')]){_0x555caf[_0x4ee1('0x52')]=[{'all':!![]}];}return db[_0x4ee1('0x3d')][_0x4ee1('0x53')](_0x555caf);})['then'](function(_0x28e53){_0x59b56a[_0x4ee1('0x54')]=_0x28e53;return _0x59b56a;})[_0x4ee1('0x22')](respondWithFilteredResult(_0x276966,_0x555caf))[_0x4ee1('0x2b')](handleError(_0x276966,null));};exports['show']=function(_0x1719bb,_0x192dd2){var _0x57852f={'raw':!![],'where':{'id':_0x1719bb[_0x4ee1('0x55')]['id']}},_0x501a51={};_0x501a51[_0x4ee1('0x42')]=_[_0x4ee1('0x56')](db[_0x4ee1('0x3d')][_0x4ee1('0x3e')]);_0x501a51[_0x4ee1('0x43')]=_[_0x4ee1('0x56')](_0x1719bb[_0x4ee1('0x43')]);_0x501a51[_0x4ee1('0x44')]=_[_0x4ee1('0x45')](_0x501a51[_0x4ee1('0x42')],_0x501a51[_0x4ee1('0x43')]);_0x57852f[_0x4ee1('0x47')]=_[_0x4ee1('0x45')](_0x501a51[_0x4ee1('0x42')],qs[_0x4ee1('0x46')](_0x1719bb[_0x4ee1('0x43')]['fields']));_0x57852f[_0x4ee1('0x47')]=_0x57852f[_0x4ee1('0x47')][_0x4ee1('0x48')]?_0x57852f[_0x4ee1('0x47')]:_0x501a51['model'];if(_0x1719bb['query'][_0x4ee1('0x51')]){_0x57852f['include']=[{'all':!![]}];}_0x57852f=_['merge']({},_0x57852f,_0x1719bb[_0x4ee1('0x57')]);return db[_0x4ee1('0x3d')][_0x4ee1('0x58')](_0x57852f)['then'](handleEntityNotFound(_0x192dd2,null))[_0x4ee1('0x22')](respondWithResult(_0x192dd2,null))['catch'](handleError(_0x192dd2,null));};exports[_0x4ee1('0x59')]=function(_0x301f74,_0x1ce9b8){return db['WhatsappMessage'][_0x4ee1('0x59')](_0x301f74['body'],{})[_0x4ee1('0x22')](respondWithResult(_0x1ce9b8,0xc9))['catch'](handleError(_0x1ce9b8,null));};exports[_0x4ee1('0x36')]=function(_0x371dda,_0x83b99c){if(_0x371dda[_0x4ee1('0x5a')]['id']){delete _0x371dda['body']['id'];}return db['WhatsappMessage']['find']({'where':{'id':_0x371dda[_0x4ee1('0x55')]['id']}})[_0x4ee1('0x22')](handleEntityNotFound(_0x83b99c,null))[_0x4ee1('0x22')](saveUpdates(_0x371dda[_0x4ee1('0x5a')],null))['then'](respondWithResult(_0x83b99c,null))[_0x4ee1('0x2b')](handleError(_0x83b99c,null));};exports['destroy']=function(_0x2136cf,_0x335012){return db[_0x4ee1('0x3d')][_0x4ee1('0x58')]({'where':{'id':_0x2136cf['params']['id']}})[_0x4ee1('0x22')](handleEntityNotFound(_0x335012,null))[_0x4ee1('0x22')](removeEntity(_0x335012,null))[_0x4ee1('0x2b')](handleError(_0x335012,null));};exports[_0x4ee1('0x5b')]=function(_0x570bfb,_0x389b8a){return db[_0x4ee1('0x3d')][_0x4ee1('0x5b')]()['then'](respondWithResult(_0x389b8a,null))[_0x4ee1('0x2b')](handleError(_0x389b8a,null));};var interaction_log=require('../../config/logger')(_0x4ee1('0x5c'));exports['accept']=function(_0x30a421,_0x1204da,_0x1b869f){var _0x2558ea={'agent':{},'channel':_0x4ee1('0x5d')};if(_0x30a421['body']['id']){delete _0x30a421[_0x4ee1('0x5a')]['id'];}_0x30a421[_0x4ee1('0x5a')][_0x4ee1('0x5e')]=!![];_0x30a421['body'][_0x4ee1('0x5f')]=moment()[_0x4ee1('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x30a421[_0x4ee1('0x5a')][_0x4ee1('0x61')]=_0x30a421['body']['UserId']||_0x30a421[_0x4ee1('0x62')]['id'];_0x2558ea[_0x4ee1('0x63')]['id']=_0x30a421[_0x4ee1('0x5a')][_0x4ee1('0x61')];return db['WhatsappMessage'][_0x4ee1('0x58')]({'where':{'id':_0x30a421[_0x4ee1('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1204da,null))[_0x4ee1('0x22')](saveUpdates(_0x30a421['body'],null))['then'](function(_0x509462){if(_0x509462){_0x2558ea[_0x4ee1('0x29')]=_0x509462[_0x4ee1('0x64')]({'plain':!![]});return db[_0x4ee1('0x65')][_0x4ee1('0x58')]({'where':{'id':_0x509462[_0x4ee1('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x1204da,null))[_0x4ee1('0x22')](function(_0x1c97bb){if(_0x1c97bb){return _0x1c97bb['update']({'UserId':_0x30a421['body'][_0x4ee1('0x61')],'read1stAt':_[_0x4ee1('0x67')](_0x1c97bb[_0x4ee1('0x68')])?moment()[_0x4ee1('0x60')](_0x4ee1('0x69')):undefined});}return null;})[_0x4ee1('0x22')](function(_0x493f8b){if(_0x493f8b){_0x2558ea['interaction']=_0x493f8b['get']({'plain':!![]});interaction_log[_0x4ee1('0x23')](_0x4ee1('0x6a'),_0x30a421[_0x4ee1('0x62')]['id'],_0x30a421['user']['name'],_0x30a421[_0x4ee1('0x62')][_0x4ee1('0x6b')],_0x2558ea[_0x4ee1('0x6c')]['id'],_0x30a421[_0x4ee1('0x5a')]?JSON[_0x4ee1('0x26')](_0x30a421[_0x4ee1('0x5a')]):_0x4ee1('0x6d'));return respondWithRpcPromise(_0x4ee1('0x6e'),_0x4ee1('0x6f'),_0x2558ea);}return null;})[_0x4ee1('0x22')](function(_0x262615){var _0x39ec5f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x262615['message']['ContactId'];return db['sequelize'][_0x4ee1('0x43')](_0x39ec5f,{'type':db[_0x4ee1('0x70')][_0x4ee1('0x71')][_0x4ee1('0x72')],'raw':!![]})[_0x4ee1('0x22')](function(_0x2c3eef){return _0x2c3eef;});})[_0x4ee1('0x22')](function(_0x28e2be){if(_0x28e2be){_0x2558ea[_0x4ee1('0x29')][_0x4ee1('0x73')]=_0x28e2be[0x0];if(!_0x30a421[_0x4ee1('0x5a')]['UserId'])return;return db[_0x4ee1('0x74')][_0x4ee1('0x58')]({'where':{'id':_0x30a421[_0x4ee1('0x5a')]['UserId'],'role':_0x4ee1('0x63')},'attributes':['id',_0x4ee1('0x3a'),_0x4ee1('0x75'),_0x4ee1('0x76'),'internal'],'raw':!![]});}return null;})[_0x4ee1('0x22')](function(_0x2f1497){if(!_0x2f1497)return null;_0x2558ea[_0x4ee1('0x29')][_0x4ee1('0x63')]=_0x2f1497;return _0x2558ea;})['then'](function(_0x2285e3){if(_0x2285e3){if(_0x30a421[_0x4ee1('0x5a')][_0x4ee1('0x77')]){_0x2558ea[_0x4ee1('0x29')]['interface']=util[_0x4ee1('0x60')](_0x4ee1('0x78'),_0x30a421['user'][_0x4ee1('0x3a')]);_0x2558ea[_0x4ee1('0x29')][_0x4ee1('0x79')]=_0x2558ea[_0x4ee1('0x79')];_0x2558ea[_0x4ee1('0x29')][_0x4ee1('0x7a')]=_0x2558ea[_0x4ee1('0x79')];_0x2558ea[_0x4ee1('0x29')][_0x4ee1('0x7b')]=_0x4ee1('0x7c');return respondWithRpcPromise(_0x4ee1('0x7d'),'EventManager',{'event':_0x4ee1('0x7e'),'message':_0x2558ea['message']},client9002)[_0x4ee1('0x22')](function(){return _0x2558ea;});}return _0x2558ea;}return null;})['then'](respondWithResult(_0x1204da,null))[_0x4ee1('0x2b')](handleError(_0x1204da,null));};var interaction_log=require(_0x4ee1('0x7f'))('whatsapp-interactions');exports[_0x4ee1('0x80')]=function(_0x58f4cb,_0x1dd547,_0x258fec){var _0x1fe756={'agent':{},'channel':_0x4ee1('0x5d')};if(_0x58f4cb[_0x4ee1('0x5a')]['id']){delete _0x58f4cb[_0x4ee1('0x5a')]['id'];}_0x58f4cb['body'][_0x4ee1('0x61')]=_0x58f4cb['body'][_0x4ee1('0x61')]||_0x58f4cb['user']['id'];_0x1fe756[_0x4ee1('0x63')]['id']=_0x58f4cb[_0x4ee1('0x5a')][_0x4ee1('0x61')];return db[_0x4ee1('0x3d')][_0x4ee1('0x58')]({'where':{'id':_0x58f4cb[_0x4ee1('0x55')]['id'],'UserId':null}})[_0x4ee1('0x22')](handleEntityNotFound(_0x1dd547,null))['then'](function(_0x159c28){if(_0x159c28){_0x1fe756[_0x4ee1('0x29')]=_0x159c28[_0x4ee1('0x64')]({'plain':!![]});return db[_0x4ee1('0x65')][_0x4ee1('0x58')]({'where':{'id':_0x159c28['WhatsappInteractionId']}});}return null;})[_0x4ee1('0x22')](handleEntityNotFound(_0x1dd547,null))[_0x4ee1('0x22')](function(_0x37632b){if(_0x37632b){_0x1fe756[_0x4ee1('0x6c')]=_0x37632b[_0x4ee1('0x64')]({'plain':!![]});interaction_log[_0x4ee1('0x23')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x58f4cb[_0x4ee1('0x62')]['id'],_0x58f4cb[_0x4ee1('0x62')]['name'],_0x58f4cb[_0x4ee1('0x62')][_0x4ee1('0x6b')],_0x1fe756[_0x4ee1('0x6c')]['id'],_0x58f4cb[_0x4ee1('0x5a')]?JSON[_0x4ee1('0x26')](_0x58f4cb[_0x4ee1('0x5a')]):_0x4ee1('0x6d'));return respondWithRpcPromise(_0x4ee1('0x81'),_0x4ee1('0x82'),_0x1fe756);}return null;})[_0x4ee1('0x22')](function(_0xfd464a){var _0x1f52db=_0x4ee1('0x83')+_0xfd464a[_0x4ee1('0x29')][_0x4ee1('0x84')];return db[_0x4ee1('0x85')]['query'](_0x1f52db,{'type':db['Sequelize'][_0x4ee1('0x71')][_0x4ee1('0x72')],'raw':!![]})[_0x4ee1('0x22')](function(_0x5abf23){return _0x5abf23;});})[_0x4ee1('0x22')](function(_0x3bc1d7){if(_0x3bc1d7){_0x1fe756[_0x4ee1('0x29')]['contact']=_0x3bc1d7[0x0];if(!_0x58f4cb[_0x4ee1('0x5a')][_0x4ee1('0x61')])return;return db['User'][_0x4ee1('0x58')]({'where':{'id':_0x58f4cb[_0x4ee1('0x5a')][_0x4ee1('0x61')],'role':_0x4ee1('0x63')},'attributes':['id','name',_0x4ee1('0x75'),_0x4ee1('0x76'),_0x4ee1('0x86')],'raw':!![]});}return null;})[_0x4ee1('0x22')](function(_0x556569){if(!_0x556569)return null;_0x1fe756['message'][_0x4ee1('0x63')]=_0x556569;return _0x1fe756;})[_0x4ee1('0x22')](function(_0x1e7a6e){if(_0x1e7a6e){_0x1e7a6e[_0x4ee1('0x29')]['interface']=util[_0x4ee1('0x60')](_0x4ee1('0x78'),_0x58f4cb['user']['name']);_0x1e7a6e['message'][_0x4ee1('0x79')]=_0x1fe756['channel'];_0x1e7a6e[_0x4ee1('0x29')]['motionChannel']=_0x1fe756['channel'];_0x1e7a6e[_0x4ee1('0x29')][_0x4ee1('0x7b')]=_0x4ee1('0x80');respondWithRpcPromise(_0x4ee1('0x7d'),_0x4ee1('0x7d'),{'event':_0x4ee1('0x87'),'message':_0x1e7a6e[_0x4ee1('0x29')]},client9002);return _0x1fe756;}return null;})[_0x4ee1('0x22')](respondWithResult(_0x1dd547,null))['catch'](handleError(_0x1dd547,null));};exports[_0x4ee1('0x2d')]=function(_0x22089d,_0x40190c,_0x5e25d0){if(_0x22089d[_0x4ee1('0x5a')]['id']){delete _0x22089d[_0x4ee1('0x5a')]['id'];}var _0x4a0bcb;return db[_0x4ee1('0x3d')][_0x4ee1('0x58')]({'where':{'id':_0x22089d[_0x4ee1('0x55')]['id']}})['then'](handleEntityNotFound(_0x40190c,null))[_0x4ee1('0x22')](function(_0x31b1eb){if(_0x31b1eb){_0x4a0bcb=_0x31b1eb;return db[_0x4ee1('0x88')][_0x4ee1('0x58')]({'where':{'id':_0x31b1eb['WhatsappAccountId']}});}})[_0x4ee1('0x22')](handleEntityNotFound(_0x40190c,null))['then'](function(_0x403661){if(_0x403661){logger[_0x4ee1('0x89')](_0x4ee1('0x8a'),_0x4ee1('0x2d'),_0x4ee1('0x8b'),_0x403661[_0x4ee1('0x40')],util[_0x4ee1('0x8c')](_0x22089d[_0x4ee1('0x5a')],{'showHidden':![],'depth':null}));switch(_0x403661[_0x4ee1('0x40')]){case'twilio':if(_0x22089d['body'][_0x4ee1('0x8d')]&&_0x22089d['body'][_0x4ee1('0x8d')]===_0x4a0bcb[_0x4ee1('0x8e')]&&_0x22089d['body'][_0x4ee1('0x8f')]&&_0x22089d[_0x4ee1('0x5a')]['MessageStatus']==='read'){return _0x4a0bcb[_0x4ee1('0x36')]({'read':!![]});}else{logger[_0x4ee1('0x27')](_0x4ee1('0x90'),_0x4ee1('0x2d'),_0x4ee1('0x91'),util[_0x4ee1('0x8c')](_0x22089d[_0x4ee1('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x4a0bcb;}})[_0x4ee1('0x22')](respondWithResult(_0x40190c,null))['catch'](handleError(_0x40190c,null));}; \ No newline at end of file +var _0xabec=['email','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','whatsapp-interactions','agent','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','sequelize','fullname','internal','motionChannel','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','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','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','http','client','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','update','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','include','findAll','rows','show','keys','attributes','options','find','create','body','params','describe','whatsapp','read','UserId','user','get','WhatsappInteraction','isNil','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','interaction','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact'];(function(_0x264d15,_0x2f5360){var _0x87a28e=function(_0x13e780){while(--_0x13e780){_0x264d15['push'](_0x264d15['shift']());}};_0x87a28e(++_0x2f5360);}(_0xabec,0xa5));var _0xcabe=function(_0x21eef2,_0x1480ea){_0x21eef2=_0x21eef2-0x0;var _0x32f106=_0xabec[_0x21eef2];return _0x32f106;};'use strict';var emlformat=require(_0xcabe('0x0'));var rimraf=require(_0xcabe('0x1'));var zipdir=require(_0xcabe('0x2'));var jsonpatch=require(_0xcabe('0x3'));var rp=require(_0xcabe('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcabe('0x5'));var util=require(_0xcabe('0x6'));var path=require(_0xcabe('0x7'));var sox=require(_0xcabe('0x8'));var csv=require('to-csv');var ejs=require(_0xcabe('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xcabe('0xa'));var crypto=require(_0xcabe('0xb'));var jsforce=require(_0xcabe('0xc'));var deskjs=require(_0xcabe('0xd'));var toCsv=require('to-csv');var querystring=require(_0xcabe('0xe'));var Papa=require(_0xcabe('0xf'));var Redis=require('ioredis');var authService=require(_0xcabe('0x10'));var qs=require(_0xcabe('0x11'));var as=require(_0xcabe('0x12'));var hardwareService=require(_0xcabe('0x13'));var logger=require(_0xcabe('0x14'))('api');var utils=require(_0xcabe('0x15'));var config=require(_0xcabe('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xcabe('0x17'))['db'];config[_0xcabe('0x18')]=_['defaults'](config[_0xcabe('0x18')],{'host':_0xcabe('0x19'),'port':0x18eb});var socket=require(_0xcabe('0x1a'))(new Redis(config['redis']));require(_0xcabe('0x1b'))[_0xcabe('0x1c')](socket);var jayson=require(_0xcabe('0x1d'));var client=jayson['client'][_0xcabe('0x1e')]({'port':0x232c});var client9002=jayson[_0xcabe('0x1f')][_0xcabe('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x151da3,_0x358213,_0x100181,_0x28b1f2){return new BPromise(function(_0x36f8a1,_0x3a228f){var _0x4cea99=_0x28b1f2||client;return _0x4cea99[_0xcabe('0x20')](_0x151da3,_0x100181)[_0xcabe('0x21')](function(_0x56ff53){logger[_0xcabe('0x22')](_0xcabe('0x23'),_0x358213,_0xcabe('0x24'));logger[_0xcabe('0x25')](_0xcabe('0x26'),_0x358213,'request\x20sent',JSON[_0xcabe('0x27')](_0x56ff53));if(_0x56ff53[_0xcabe('0x28')]){if(_0x56ff53['error'][_0xcabe('0x29')]===0x1f4){logger['error'](_0xcabe('0x23'),_0x358213,_0x56ff53[_0xcabe('0x28')][_0xcabe('0x2a')]);return _0x3a228f(_0x56ff53[_0xcabe('0x28')]['message']);}logger[_0xcabe('0x28')](_0xcabe('0x23'),_0x358213,_0x56ff53['error'][_0xcabe('0x2a')]);return _0x36f8a1(_0x56ff53[_0xcabe('0x28')][_0xcabe('0x2a')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x358213,_0xcabe('0x24'));_0x36f8a1(_0x56ff53[_0xcabe('0x2b')][_0xcabe('0x2a')]);}})[_0xcabe('0x2c')](function(_0x2edc79){logger['error'](_0xcabe('0x23'),_0x358213,_0x2edc79);_0x3a228f(_0x2edc79);});});}function respondWithStatusCode(_0x1914a6,_0xba2e9){_0xba2e9=_0xba2e9||0xcc;return function(_0x92373c){if(_0x92373c){return _0x1914a6[_0xcabe('0x2d')](_0xba2e9);}return _0x1914a6[_0xcabe('0x2e')](_0xba2e9)[_0xcabe('0x2f')]();};}function respondWithResult(_0x1044b9,_0x51e518){_0x51e518=_0x51e518||0xc8;return function(_0x551e61){if(_0x551e61){return _0x1044b9[_0xcabe('0x2e')](_0x51e518)[_0xcabe('0x30')](_0x551e61);}};}function respondWithFilteredResult(_0x4c8ebe,_0x38e4ad){return function(_0x307ceb){if(_0x307ceb){var _0x587b7e=typeof _0x38e4ad[_0xcabe('0x31')]===_0xcabe('0x32')&&typeof _0x38e4ad[_0xcabe('0x33')]===_0xcabe('0x32');var _0x37d97a=_0x307ceb[_0xcabe('0x34')];var _0x12cc3c=_0x587b7e?0x0:_0x38e4ad[_0xcabe('0x31')];var _0x4fcb7d=_0x587b7e?_0x307ceb[_0xcabe('0x34')]:_0x38e4ad['offset']+_0x38e4ad[_0xcabe('0x33')];var _0x797222;if(_0x4fcb7d>=_0x37d97a){_0x4fcb7d=_0x37d97a;_0x797222=0xc8;}else{_0x797222=0xce;}_0x4c8ebe['status'](_0x797222);return _0x4c8ebe['set']('Content-Range',_0x12cc3c+'-'+_0x4fcb7d+'/'+_0x37d97a)[_0xcabe('0x30')](_0x307ceb);}return null;};}function patchUpdates(_0x164b73){return function(_0x5e0a49){try{jsonpatch[_0xcabe('0x35')](_0x5e0a49,_0x164b73,!![]);}catch(_0x4fb554){return BPromise[_0xcabe('0x36')](_0x4fb554);}return _0x5e0a49['save']();};}function saveUpdates(_0x99e412,_0x5bfa6a){return function(_0x3d3a49){if(_0x3d3a49){return _0x3d3a49[_0xcabe('0x37')](_0x99e412)[_0xcabe('0x21')](function(_0x4ea639){return _0x4ea639;});}return null;};}function removeEntity(_0x388b30,_0x5f90c4){return function(_0x1eabc2){if(_0x1eabc2){return _0x1eabc2['destroy']()[_0xcabe('0x21')](function(){_0x388b30[_0xcabe('0x2e')](0xcc)[_0xcabe('0x2f')]();});}};}function handleEntityNotFound(_0x23e92f,_0x5aa415){return function(_0x219d9e){if(!_0x219d9e){_0x23e92f['sendStatus'](0x194);}return _0x219d9e;};}function handleError(_0x53125f,_0x534746){_0x534746=_0x534746||0x1f4;return function(_0xfac48c){logger['error'](_0xfac48c[_0xcabe('0x38')]);if(_0xfac48c[_0xcabe('0x39')]){delete _0xfac48c[_0xcabe('0x39')];}_0x53125f[_0xcabe('0x2e')](_0x534746)[_0xcabe('0x3a')](_0xfac48c);};}exports[_0xcabe('0x3b')]=function(_0x264392,_0x37b461){var _0x4b4986={},_0x10d125={},_0x429f0b={'count':0x0,'rows':[]};var _0x5371f3=_[_0xcabe('0x3c')](db[_0xcabe('0x3d')][_0xcabe('0x3e')],function(_0x132e20){return{'name':_0x132e20[_0xcabe('0x3f')],'type':_0x132e20[_0xcabe('0x40')][_0xcabe('0x41')]};});_0x10d125[_0xcabe('0x42')]=_[_0xcabe('0x3c')](_0x5371f3,'name');_0x10d125[_0xcabe('0x43')]=_['keys'](_0x264392[_0xcabe('0x43')]);_0x10d125['filters']=_[_0xcabe('0x44')](_0x10d125[_0xcabe('0x42')],_0x10d125[_0xcabe('0x43')]);_0x4b4986['attributes']=_[_0xcabe('0x44')](_0x10d125[_0xcabe('0x42')],qs[_0xcabe('0x45')](_0x264392[_0xcabe('0x43')][_0xcabe('0x45')]));_0x4b4986['attributes']=_0x4b4986['attributes'][_0xcabe('0x46')]?_0x4b4986['attributes']:_0x10d125[_0xcabe('0x42')];if(!_0x264392[_0xcabe('0x43')][_0xcabe('0x47')](_0xcabe('0x48'))){_0x4b4986[_0xcabe('0x33')]=qs[_0xcabe('0x33')](_0x264392[_0xcabe('0x43')]['limit']);_0x4b4986[_0xcabe('0x31')]=qs[_0xcabe('0x31')](_0x264392[_0xcabe('0x43')][_0xcabe('0x31')]);}_0x4b4986[_0xcabe('0x49')]=qs['sort'](_0x264392[_0xcabe('0x43')][_0xcabe('0x4a')]);_0x4b4986[_0xcabe('0x4b')]=qs['filters'](_['pick'](_0x264392[_0xcabe('0x43')],_0x10d125[_0xcabe('0x4c')]),_0x5371f3);if(_0x264392[_0xcabe('0x43')][_0xcabe('0x4d')]){_0x4b4986['where']=_['merge'](_0x4b4986[_0xcabe('0x4b')],{'$or':_[_0xcabe('0x3c')](_0x5371f3,function(_0x6e9449){if(_0x6e9449[_0xcabe('0x40')]!==_0xcabe('0x4e')){var _0x2ce8e0={};_0x2ce8e0[_0x6e9449[_0xcabe('0x39')]]={'$like':'%'+_0x264392[_0xcabe('0x43')][_0xcabe('0x4d')]+'%'};return _0x2ce8e0;}})});}_0x4b4986=_[_0xcabe('0x4f')]({},_0x4b4986,_0x264392['options']);var _0x32370d={'where':_0x4b4986[_0xcabe('0x4b')]};return db[_0xcabe('0x3d')][_0xcabe('0x34')](_0x32370d)[_0xcabe('0x21')](function(_0x34bdf4){_0x429f0b[_0xcabe('0x34')]=_0x34bdf4;if(_0x264392['query']['includeAll']){_0x4b4986[_0xcabe('0x50')]=[{'all':!![]}];}return db['WhatsappMessage'][_0xcabe('0x51')](_0x4b4986);})[_0xcabe('0x21')](function(_0x43989b){_0x429f0b[_0xcabe('0x52')]=_0x43989b;return _0x429f0b;})[_0xcabe('0x21')](respondWithFilteredResult(_0x37b461,_0x4b4986))[_0xcabe('0x2c')](handleError(_0x37b461,null));};exports[_0xcabe('0x53')]=function(_0x50a0d5,_0x4a7deb){var _0x17a635={'raw':!![],'where':{'id':_0x50a0d5['params']['id']}},_0x4bc75f={};_0x4bc75f[_0xcabe('0x42')]=_[_0xcabe('0x54')](db[_0xcabe('0x3d')][_0xcabe('0x3e')]);_0x4bc75f[_0xcabe('0x43')]=_['keys'](_0x50a0d5[_0xcabe('0x43')]);_0x4bc75f[_0xcabe('0x4c')]=_[_0xcabe('0x44')](_0x4bc75f[_0xcabe('0x42')],_0x4bc75f['query']);_0x17a635[_0xcabe('0x55')]=_[_0xcabe('0x44')](_0x4bc75f['model'],qs['fields'](_0x50a0d5['query'][_0xcabe('0x45')]));_0x17a635[_0xcabe('0x55')]=_0x17a635[_0xcabe('0x55')]['length']?_0x17a635[_0xcabe('0x55')]:_0x4bc75f['model'];if(_0x50a0d5[_0xcabe('0x43')]['includeAll']){_0x17a635[_0xcabe('0x50')]=[{'all':!![]}];}_0x17a635=_[_0xcabe('0x4f')]({},_0x17a635,_0x50a0d5[_0xcabe('0x56')]);return db[_0xcabe('0x3d')][_0xcabe('0x57')](_0x17a635)[_0xcabe('0x21')](handleEntityNotFound(_0x4a7deb,null))[_0xcabe('0x21')](respondWithResult(_0x4a7deb,null))['catch'](handleError(_0x4a7deb,null));};exports['create']=function(_0x3d5d5f,_0x5283a9){return db[_0xcabe('0x3d')][_0xcabe('0x58')](_0x3d5d5f['body'],{})[_0xcabe('0x21')](respondWithResult(_0x5283a9,0xc9))['catch'](handleError(_0x5283a9,null));};exports['update']=function(_0x42eb13,_0x3ab40e){if(_0x42eb13[_0xcabe('0x59')]['id']){delete _0x42eb13[_0xcabe('0x59')]['id'];}return db[_0xcabe('0x3d')][_0xcabe('0x57')]({'where':{'id':_0x42eb13[_0xcabe('0x5a')]['id']}})[_0xcabe('0x21')](handleEntityNotFound(_0x3ab40e,null))['then'](saveUpdates(_0x42eb13[_0xcabe('0x59')],null))[_0xcabe('0x21')](respondWithResult(_0x3ab40e,null))[_0xcabe('0x2c')](handleError(_0x3ab40e,null));};exports['destroy']=function(_0x3afee4,_0x9df944){return db[_0xcabe('0x3d')][_0xcabe('0x57')]({'where':{'id':_0x3afee4[_0xcabe('0x5a')]['id']}})[_0xcabe('0x21')](handleEntityNotFound(_0x9df944,null))[_0xcabe('0x21')](removeEntity(_0x9df944,null))[_0xcabe('0x2c')](handleError(_0x9df944,null));};exports[_0xcabe('0x5b')]=function(_0x48a01d,_0x3a3682){return db['WhatsappMessage'][_0xcabe('0x5b')]()[_0xcabe('0x21')](respondWithResult(_0x3a3682,null))[_0xcabe('0x2c')](handleError(_0x3a3682,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports['accept']=function(_0x22178f,_0x5703c4,_0x1d90ed){var _0x30ea41={'agent':{},'channel':_0xcabe('0x5c')};if(_0x22178f[_0xcabe('0x59')]['id']){delete _0x22178f[_0xcabe('0x59')]['id'];}_0x22178f[_0xcabe('0x59')][_0xcabe('0x5d')]=!![];_0x22178f[_0xcabe('0x59')]['readAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x22178f['body'][_0xcabe('0x5e')]=_0x22178f[_0xcabe('0x59')][_0xcabe('0x5e')]||_0x22178f[_0xcabe('0x5f')]['id'];_0x30ea41['agent']['id']=_0x22178f['body']['UserId'];return db[_0xcabe('0x3d')][_0xcabe('0x57')]({'where':{'id':_0x22178f[_0xcabe('0x5a')]['id'],'UserId':null}})[_0xcabe('0x21')](handleEntityNotFound(_0x5703c4,null))['then'](saveUpdates(_0x22178f[_0xcabe('0x59')],null))[_0xcabe('0x21')](function(_0x1043cb){if(_0x1043cb){_0x30ea41[_0xcabe('0x2a')]=_0x1043cb[_0xcabe('0x60')]({'plain':!![]});return db[_0xcabe('0x61')][_0xcabe('0x57')]({'where':{'id':_0x1043cb['WhatsappInteractionId']}});}return null;})[_0xcabe('0x21')](handleEntityNotFound(_0x5703c4,null))[_0xcabe('0x21')](function(_0x281161){if(_0x281161){return _0x281161[_0xcabe('0x37')]({'UserId':_0x22178f[_0xcabe('0x59')][_0xcabe('0x5e')],'read1stAt':_[_0xcabe('0x62')](_0x281161[_0xcabe('0x63')])?moment()[_0xcabe('0x64')](_0xcabe('0x65')):undefined});}return null;})[_0xcabe('0x21')](function(_0x42a6da){if(_0x42a6da){_0x30ea41[_0xcabe('0x66')]=_0x42a6da['get']({'plain':!![]});interaction_log[_0xcabe('0x22')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x22178f[_0xcabe('0x5f')]['id'],_0x22178f[_0xcabe('0x5f')][_0xcabe('0x39')],_0x22178f[_0xcabe('0x5f')][_0xcabe('0x67')],_0x30ea41['interaction']['id'],_0x22178f[_0xcabe('0x59')]?JSON[_0xcabe('0x27')](_0x22178f[_0xcabe('0x59')]):_0xcabe('0x68'));return respondWithRpcPromise(_0xcabe('0x69'),_0xcabe('0x6a'),_0x30ea41);}return null;})['then'](function(_0x14b3ad){var _0x591793=_0xcabe('0x6b')+_0x14b3ad['message'][_0xcabe('0x6c')];return db['sequelize'][_0xcabe('0x43')](_0x591793,{'type':db[_0xcabe('0x6d')][_0xcabe('0x6e')][_0xcabe('0x6f')],'raw':!![]})['then'](function(_0x549a41){return _0x549a41;});})[_0xcabe('0x21')](function(_0x55c027){if(_0x55c027){_0x30ea41[_0xcabe('0x2a')][_0xcabe('0x70')]=_0x55c027[0x0];if(!_0x22178f[_0xcabe('0x59')][_0xcabe('0x5e')])return;return db['User'][_0xcabe('0x57')]({'where':{'id':_0x22178f[_0xcabe('0x59')][_0xcabe('0x5e')],'role':'agent'},'attributes':['id',_0xcabe('0x39'),'fullname',_0xcabe('0x71'),'internal'],'raw':!![]});}return null;})[_0xcabe('0x21')](function(_0x6881b4){if(!_0x6881b4)return null;_0x30ea41['message']['agent']=_0x6881b4;return _0x30ea41;})[_0xcabe('0x21')](function(_0x11d07a){if(_0x11d07a){if(_0x22178f[_0xcabe('0x59')]['manual']){_0x30ea41['message'][_0xcabe('0x72')]=util[_0xcabe('0x64')](_0xcabe('0x73'),_0x22178f[_0xcabe('0x5f')]['name']);_0x30ea41[_0xcabe('0x2a')][_0xcabe('0x74')]=_0x30ea41[_0xcabe('0x74')];_0x30ea41[_0xcabe('0x2a')]['motionChannel']=_0x30ea41['channel'];_0x30ea41[_0xcabe('0x2a')][_0xcabe('0x75')]=_0xcabe('0x76');return respondWithRpcPromise(_0xcabe('0x77'),_0xcabe('0x77'),{'event':_0xcabe('0x78'),'message':_0x30ea41['message']},client9002)[_0xcabe('0x21')](function(){return _0x30ea41;});}return _0x30ea41;}return null;})[_0xcabe('0x21')](respondWithResult(_0x5703c4,null))[_0xcabe('0x2c')](handleError(_0x5703c4,null));};var interaction_log=require(_0xcabe('0x14'))(_0xcabe('0x79'));exports['reject']=function(_0x1ea003,_0x50be2,_0x5360ec){var _0x599c7e={'agent':{},'channel':_0xcabe('0x5c')};if(_0x1ea003['body']['id']){delete _0x1ea003[_0xcabe('0x59')]['id'];}_0x1ea003[_0xcabe('0x59')][_0xcabe('0x5e')]=_0x1ea003[_0xcabe('0x59')]['UserId']||_0x1ea003[_0xcabe('0x5f')]['id'];_0x599c7e[_0xcabe('0x7a')]['id']=_0x1ea003[_0xcabe('0x59')][_0xcabe('0x5e')];return db['WhatsappMessage'][_0xcabe('0x57')]({'where':{'id':_0x1ea003[_0xcabe('0x5a')]['id'],'UserId':null}})[_0xcabe('0x21')](handleEntityNotFound(_0x50be2,null))[_0xcabe('0x21')](function(_0x182d1d){if(_0x182d1d){_0x599c7e[_0xcabe('0x2a')]=_0x182d1d[_0xcabe('0x60')]({'plain':!![]});return db['WhatsappInteraction'][_0xcabe('0x57')]({'where':{'id':_0x182d1d[_0xcabe('0x7b')]}});}return null;})['then'](handleEntityNotFound(_0x50be2,null))[_0xcabe('0x21')](function(_0x57da01){if(_0x57da01){_0x599c7e[_0xcabe('0x66')]=_0x57da01['get']({'plain':!![]});interaction_log[_0xcabe('0x22')](_0xcabe('0x7c'),_0x1ea003[_0xcabe('0x5f')]['id'],_0x1ea003[_0xcabe('0x5f')][_0xcabe('0x39')],_0x1ea003[_0xcabe('0x5f')]['role'],_0x599c7e['interaction']['id'],_0x1ea003['body']?JSON[_0xcabe('0x27')](_0x1ea003[_0xcabe('0x59')]):_0xcabe('0x68'));return respondWithRpcPromise('RejectMessage',_0xcabe('0x7d'),_0x599c7e);}return null;})['then'](function(_0x37ccaa){var _0x1889c2=_0xcabe('0x6b')+_0x37ccaa[_0xcabe('0x2a')]['ContactId'];return db[_0xcabe('0x7e')]['query'](_0x1889c2,{'type':db[_0xcabe('0x6d')][_0xcabe('0x6e')][_0xcabe('0x6f')],'raw':!![]})[_0xcabe('0x21')](function(_0x2f0c70){return _0x2f0c70;});})[_0xcabe('0x21')](function(_0x5ecc76){if(_0x5ecc76){_0x599c7e['message'][_0xcabe('0x70')]=_0x5ecc76[0x0];if(!_0x1ea003['body']['UserId'])return;return db['User'][_0xcabe('0x57')]({'where':{'id':_0x1ea003[_0xcabe('0x59')]['UserId'],'role':'agent'},'attributes':['id','name',_0xcabe('0x7f'),_0xcabe('0x71'),_0xcabe('0x80')],'raw':!![]});}return null;})[_0xcabe('0x21')](function(_0x2c4cbc){if(!_0x2c4cbc)return null;_0x599c7e[_0xcabe('0x2a')]['agent']=_0x2c4cbc;return _0x599c7e;})[_0xcabe('0x21')](function(_0x3899cd){if(_0x3899cd){_0x3899cd['message'][_0xcabe('0x72')]=util[_0xcabe('0x64')](_0xcabe('0x73'),_0x1ea003[_0xcabe('0x5f')]['name']);_0x3899cd[_0xcabe('0x2a')][_0xcabe('0x74')]=_0x599c7e[_0xcabe('0x74')];_0x3899cd[_0xcabe('0x2a')][_0xcabe('0x81')]=_0x599c7e[_0xcabe('0x74')];_0x3899cd[_0xcabe('0x2a')]['event']=_0xcabe('0x36');respondWithRpcPromise('EventManager','EventManager',{'event':_0xcabe('0x82'),'message':_0x3899cd['message']},client9002);return _0x599c7e;}return null;})[_0xcabe('0x21')](respondWithResult(_0x50be2,null))[_0xcabe('0x2c')](handleError(_0x50be2,null));};exports[_0xcabe('0x2e')]=function(_0x75f95d,_0x843ab1,_0x161de3){if(_0x75f95d[_0xcabe('0x59')]['id']){delete _0x75f95d['body']['id'];}var _0x13ac1b;return db['WhatsappMessage'][_0xcabe('0x57')]({'where':{'id':_0x75f95d[_0xcabe('0x5a')]['id']}})['then'](handleEntityNotFound(_0x843ab1,null))['then'](function(_0x2e706c){if(_0x2e706c){_0x13ac1b=_0x2e706c;return db['WhatsappAccount'][_0xcabe('0x57')]({'where':{'id':_0x2e706c[_0xcabe('0x83')]}});}})[_0xcabe('0x21')](handleEntityNotFound(_0x843ab1,null))[_0xcabe('0x21')](function(_0x35390b){if(_0x35390b){logger['debug'](_0xcabe('0x84'),_0xcabe('0x2e'),_0xcabe('0x85'),_0x35390b[_0xcabe('0x40')],util[_0xcabe('0x86')](_0x75f95d[_0xcabe('0x59')],{'showHidden':![],'depth':null}));switch(_0x35390b[_0xcabe('0x40')]){case _0xcabe('0x87'):if(_0x75f95d[_0xcabe('0x59')]['MessageSid']&&_0x75f95d[_0xcabe('0x59')][_0xcabe('0x88')]===_0x13ac1b[_0xcabe('0x89')]&&_0x75f95d[_0xcabe('0x59')]['MessageStatus']&&_0x75f95d[_0xcabe('0x59')][_0xcabe('0x8a')]===_0xcabe('0x5d')){return _0x13ac1b['update']({'read':!![]});}else{logger[_0xcabe('0x28')]('WhatsappAccount,\x20%s,\x20%s,\x20%s','status',_0xcabe('0x87'),util[_0xcabe('0x86')](_0x75f95d[_0xcabe('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x13ac1b;}})[_0xcabe('0x21')](respondWithResult(_0x843ab1,null))['catch'](handleError(_0x843ab1,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 93cad81..51425b2 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 _0x6ae2=['emit','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove'];(function(_0x562ec5,_0x517a26){var _0x2d9a15=function(_0x22bd68){while(--_0x22bd68){_0x562ec5['push'](_0x562ec5['shift']());}};_0x2d9a15(++_0x517a26);}(_0x6ae2,0x1ed));var _0x26ae=function(_0x16233a,_0x54e4dc){_0x16233a=_0x16233a-0x0;var _0x428060=_0x6ae2[_0x16233a];return _0x428060;};'use strict';var EventEmitter=require(_0x26ae('0x0'));var WhatsappMessage=require(_0x26ae('0x1'))['db'][_0x26ae('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x26ae('0x3')](0x0);var events={'afterCreate':_0x26ae('0x4'),'afterUpdate':_0x26ae('0x5'),'afterDestroy':_0x26ae('0x6')};function emitEvent(_0x281760){return function(_0x318952,_0x5b52b9,_0x1158ff){WhatsappMessageEvents[_0x26ae('0x7')](_0x281760+':'+_0x318952['id'],_0x318952);WhatsappMessageEvents['emit'](_0x281760,_0x318952);_0x1158ff(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0x26ae('0x8')](e,emitEvent(event));}}module[_0x26ae('0x9')]=WhatsappMessageEvents; \ No newline at end of file +var _0xf7b4=['hook','exports','events','setMaxListeners','save','emit','hasOwnProperty'];(function(_0xe248ac,_0x5a6fc2){var _0x58b960=function(_0x2ff700){while(--_0x2ff700){_0xe248ac['push'](_0xe248ac['shift']());}};_0x58b960(++_0x5a6fc2);}(_0xf7b4,0x152));var _0x4f7b=function(_0x4ab62e,_0x1c9869){_0x4ab62e=_0x4ab62e-0x0;var _0x19c3d1=_0xf7b4[_0x4ab62e];return _0x19c3d1;};'use strict';var EventEmitter=require(_0x4f7b('0x0'));var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x4f7b('0x1')](0x0);var events={'afterCreate':_0x4f7b('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x21b85f){return function(_0x3e18fd,_0x2e0e51,_0x44f991){WhatsappMessageEvents[_0x4f7b('0x3')](_0x21b85f+':'+_0x3e18fd['id'],_0x3e18fd);WhatsappMessageEvents[_0x4f7b('0x3')](_0x21b85f,_0x3e18fd);_0x44f991(null);};}for(var e in events){if(events[_0x4f7b('0x4')](e)){var event=events[e];WhatsappMessage[_0x4f7b('0x5')](e,emitEvent(event));}}module[_0x4f7b('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 2157134..c240490 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 _0x17c6=['api','moment','bluebird','request-promise','node-fetch','path','rimraf','exports','define','WhatsappMessage','whatsapp_messages','messageId','body','models','direction','toLowerCase','secret','isNil','UserId','WhatsappInteraction','WhatsappInteractionId','error','out','WhatsappAccount','find','WhatsappAccountId','then','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','/api/whatsapp/messages/','token','sid','update','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x18f64a,_0x1c8248){var _0x44687f=function(_0x1234ad){while(--_0x1234ad){_0x18f64a['push'](_0x18f64a['shift']());}};_0x44687f(++_0x1c8248);}(_0x17c6,0x19b));var _0x617c=function(_0x238c24,_0x3c4ed3){_0x238c24=_0x238c24-0x0;var _0x402c1b=_0x17c6[_0x238c24];return _0x402c1b;};'use strict';var _=require(_0x617c('0x0'));var util=require(_0x617c('0x1'));var logger=require('../../config/logger')(_0x617c('0x2'));var moment=require(_0x617c('0x3'));var BPromise=require(_0x617c('0x4'));var rp=require(_0x617c('0x5'));var fetch=require(_0x617c('0x6'));var fs=require('fs');var path=require(_0x617c('0x7'));var rimraf=require(_0x617c('0x8'));var config=require('../../config/environment');var attributes=require('./whatsappMessage.attributes');module[_0x617c('0x9')]=function(_0x1f6738,_0x391dae){return _0x1f6738[_0x617c('0xa')](_0x617c('0xb'),attributes,{'tableName':_0x617c('0xc'),'paranoid':![],'indexes':[{'name':_0x617c('0xd'),'fields':['messageId']},{'name':'fti_whatsapp_messages','fields':[_0x617c('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2fa606,_0x5aa2c7,_0x55e0c2){var _0x390a69=_0x1f6738[_0x617c('0xf')];var _0x494c81=_0x2fa606['get']({'plain':!![]});if(_0x494c81[_0x617c('0x10')][_0x617c('0x11')]()==='in'||_0x494c81[_0x617c('0x10')][_0x617c('0x11')]()==='out'&&!_0x494c81[_0x617c('0x12')]&&!_[_0x617c('0x13')](_0x494c81[_0x617c('0x14')])){_0x390a69[_0x617c('0x15')]['findOne']({'where':{'id':_0x494c81[_0x617c('0x16')]}})['then'](function(_0xab2f08){if(_0xab2f08){_0xab2f08['update']({'lastMsgAt':_0x494c81['createdAt'],'lastMsgDirection':_0x494c81[_0x617c('0x10')][_0x617c('0x11')]()});}})['catch'](function(_0x3821ec){console[_0x617c('0x17')](_0x3821ec);});}if(_0x494c81['direction']===_0x617c('0x18')&&!_0x494c81['secret']){var _0x3a3457;_0x390a69[_0x617c('0x19')][_0x617c('0x1a')]({'where':{'id':_0x494c81[_0x617c('0x1b')]},'raw':!![]})[_0x617c('0x1c')](function(_0x2cb77d){_0x3a3457=_0x2cb77d;if(_0x3a3457&&_0x3a3457[_0x617c('0x1d')]){switch(_0x3a3457[_0x617c('0x1d')]){case'twilio':var _0x33c446=require(_0x617c('0x1e'));if(_0x3a3457[_0x617c('0x1f')]&&_0x3a3457[_0x617c('0x20')]&&_0x3a3457[_0x617c('0x21')]){var _0x5ee299=new _0x33c446(_0x3a3457['accountSid'],_0x3a3457['authToken']);_0x5ee299[_0x617c('0x22')][_0x617c('0x23')]({'body':_0x494c81[_0x617c('0xe')],'to':'whatsapp:'+_0x494c81[_0x617c('0x21')],'from':_0x617c('0x24')+_0x3a3457[_0x617c('0x21')],'statusCallback':_0x3a3457['remote']+_0x617c('0x25')+_0x494c81['id']+'/status?token='+_0x3a3457[_0x617c('0x26')]})[_0x617c('0x1c')](function(_0x2a424b){if(_0x2a424b[_0x617c('0x27')]){return _0x2fa606[_0x617c('0x28')]({'messageId':_0x2a424b[_0x617c('0x27')]});}})['catch'](function(_0x45e6fe){logger[_0x617c('0x17')](_0x617c('0x29'),_0x617c('0x2a'),_0x617c('0x1e'),util[_0x617c('0x2b')](_0x45e6fe,{'showHidden':![],'depth':null}));});}else{logger[_0x617c('0x17')](_0x617c('0x29'),_0x617c('0x2a'),_0x617c('0x1e'),_0x617c('0x2c'));}break;case _0x617c('0x2d'):var _0x3d67c4=_0x3a3457[_0x617c('0x1f')];var _0x1cea89=_0x3a3457[_0x617c('0x20')];var _0x5217c6=_0x3a3457['baseUrl']+_0x617c('0x2e')+_0x3d67c4+_0x617c('0x2f');var _0x23ef08={'to':[_0x494c81['phone']],'message':{'type':_0x617c('0x30'),'text':_0x494c81[_0x617c('0xe')]}};var _0x4fffe2={'method':_0x617c('0x31'),'uri':_0x5217c6,'headers':{'Authorization':_0x617c('0x32')+_0x1cea89,'Content-Type':_0x617c('0x33')},'body':_0x23ef08,'json':!![]};rp(_0x4fffe2)[_0x617c('0x1c')](function(_0x2c9a59){if(_0x2c9a59[_0x617c('0x34')][0x0][_0x617c('0x35')]){return _0x2fa606[_0x617c('0x28')]({'messageId':_0x2c9a59[_0x617c('0x34')][0x0]['message_id']});}})['catch'](function(_0x13cc1d){logger[_0x617c('0x36')](_0x617c('0x37'),_0x13cc1d);});break;}}})[_0x617c('0x38')](function(){_0x55e0c2();});}else{_0x55e0c2();}}},'charset':_0x617c('0x39'),'collate':_0x617c('0x3a')});}; \ No newline at end of file +var _0x1b2b=['api','bluebird','node-fetch','../../config/environment','exports','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','UserId','WhatsappInteractionId','update','createdAt','error','WhatsappAccount','WhatsappAccountId','then','type','twilio','phone','authToken','messages','create','whatsapp:','/status?token=','token','sid','catch','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','accountSid','baseUrl','/whatsapp/v1/','/messages/','POST','Bearer\x20','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','lodash','util','../../config/logger'];(function(_0x911353,_0x1648ed){var _0x2f05fa=function(_0x4a00a4){while(--_0x4a00a4){_0x911353['push'](_0x911353['shift']());}};_0x2f05fa(++_0x1648ed);}(_0x1b2b,0x69));var _0xb1b2=function(_0x27acbf,_0xe7afec){_0x27acbf=_0x27acbf-0x0;var _0xf93fc8=_0x1b2b[_0x27acbf];return _0xf93fc8;};'use strict';var _=require(_0xb1b2('0x0'));var util=require(_0xb1b2('0x1'));var logger=require(_0xb1b2('0x2'))(_0xb1b2('0x3'));var moment=require('moment');var BPromise=require(_0xb1b2('0x4'));var rp=require('request-promise');var fetch=require(_0xb1b2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb1b2('0x6'));var attributes=require('./whatsappMessage.attributes');module[_0xb1b2('0x7')]=function(_0x30ce86,_0x1cde51){return _0x30ce86['define'](_0xb1b2('0x8'),attributes,{'tableName':_0xb1b2('0x9'),'paranoid':![],'indexes':[{'name':_0xb1b2('0xa'),'fields':[_0xb1b2('0xa')]},{'name':_0xb1b2('0xb'),'fields':[_0xb1b2('0xc')],'type':_0xb1b2('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2d345f,_0xa1cc63,_0x23e737){var _0x9576ab=_0x30ce86[_0xb1b2('0xe')];var _0x5ad56f=_0x2d345f[_0xb1b2('0xf')]({'plain':!![]});if(_0x5ad56f['direction'][_0xb1b2('0x10')]()==='in'||_0x5ad56f[_0xb1b2('0x11')][_0xb1b2('0x10')]()===_0xb1b2('0x12')&&!_0x5ad56f['secret']&&!_['isNil'](_0x5ad56f[_0xb1b2('0x13')])){_0x9576ab['WhatsappInteraction']['findOne']({'where':{'id':_0x5ad56f[_0xb1b2('0x14')]}})['then'](function(_0x5d8588){if(_0x5d8588){_0x5d8588[_0xb1b2('0x15')]({'lastMsgAt':_0x5ad56f[_0xb1b2('0x16')],'lastMsgDirection':_0x5ad56f['direction'][_0xb1b2('0x10')]()});}})['catch'](function(_0x57a868){console[_0xb1b2('0x17')](_0x57a868);});}if(_0x5ad56f[_0xb1b2('0x11')]===_0xb1b2('0x12')&&!_0x5ad56f['secret']){var _0x11947e;_0x9576ab[_0xb1b2('0x18')]['find']({'where':{'id':_0x5ad56f[_0xb1b2('0x19')]},'raw':!![]})[_0xb1b2('0x1a')](function(_0x392918){_0x11947e=_0x392918;if(_0x11947e&&_0x11947e[_0xb1b2('0x1b')]){switch(_0x11947e[_0xb1b2('0x1b')]){case'twilio':var _0xc9e23f=require(_0xb1b2('0x1c'));if(_0x11947e['accountSid']&&_0x11947e['authToken']&&_0x11947e[_0xb1b2('0x1d')]){var _0xafabf4=new _0xc9e23f(_0x11947e['accountSid'],_0x11947e[_0xb1b2('0x1e')]);_0xafabf4[_0xb1b2('0x1f')][_0xb1b2('0x20')]({'body':_0x5ad56f[_0xb1b2('0xc')],'to':_0xb1b2('0x21')+_0x5ad56f[_0xb1b2('0x1d')],'from':'whatsapp:'+_0x11947e['phone'],'statusCallback':_0x11947e['remote']+'/api/whatsapp/messages/'+_0x5ad56f['id']+_0xb1b2('0x22')+_0x11947e[_0xb1b2('0x23')]})[_0xb1b2('0x1a')](function(_0x18b683){if(_0x18b683['sid']){return _0x2d345f[_0xb1b2('0x15')]({'messageId':_0x18b683[_0xb1b2('0x24')]});}})[_0xb1b2('0x25')](function(_0x4e6ddf){logger[_0xb1b2('0x17')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xb1b2('0x26'),_0xb1b2('0x1c'),util[_0xb1b2('0x27')](_0x4e6ddf,{'showHidden':![],'depth':null}));});}else{logger[_0xb1b2('0x17')](_0xb1b2('0x28'),'afterCreate','twilio',_0xb1b2('0x29'));}break;case _0xb1b2('0x2a'):var _0x7405=_0x11947e[_0xb1b2('0x2b')];var _0x8c2b1=_0x11947e['authToken'];var _0x25f6a2=_0x11947e[_0xb1b2('0x2c')]+_0xb1b2('0x2d')+_0x7405+_0xb1b2('0x2e');var _0x3f1c0b={'to':[_0x5ad56f[_0xb1b2('0x1d')]],'message':{'type':'text','text':_0x5ad56f[_0xb1b2('0xc')]}};var _0x559c63={'method':_0xb1b2('0x2f'),'uri':_0x25f6a2,'headers':{'Authorization':_0xb1b2('0x30')+_0x8c2b1,'Content-Type':'application/json'},'body':_0x3f1c0b,'json':!![]};rp(_0x559c63)[_0xb1b2('0x1a')](function(_0x3d31f9){if(_0x3d31f9['statuses'][0x0][_0xb1b2('0x31')]){return _0x2d345f[_0xb1b2('0x15')]({'messageId':_0x3d31f9['statuses'][0x0][_0xb1b2('0x31')]});}})[_0xb1b2('0x25')](function(_0x1ecb7e){logger[_0xb1b2('0x32')](_0xb1b2('0x33'),_0x1ecb7e);});break;}}})[_0xb1b2('0x34')](function(){_0x23e737();});}else{_0x23e737();}}},'charset':_0xb1b2('0x35'),'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 7a5f2cf..4ed22de 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 _0xbd09=['WhatsappMessage,\x20%s,\x20%s','message','result','catch','CreateWhatsappMessage','WhatsappMessage','body','options','raw','then','debug','lodash','moment','../../config/utils','../../config/environment','jayson/promise','client','http','redis','./whatsappMessage.socket','info','stringify','error','code'];(function(_0x468e06,_0x1a1001){var _0x3891cf=function(_0x1398f9){while(--_0x1398f9){_0x468e06['push'](_0x468e06['shift']());}};_0x3891cf(++_0x1a1001);}(_0xbd09,0xb3));var _0x9bd0=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xbd09[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x9bd0('0x0'));var util=require('util');var moment=require(_0x9bd0('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9bd0('0x2'));var logger=require('../../config/logger')('rpc');var config=require(_0x9bd0('0x3'));var jayson=require(_0x9bd0('0x4'));var client=jayson[_0x9bd0('0x5')][_0x9bd0('0x6')]({'port':0x232a});config[_0x9bd0('0x7')]=_['defaults'](config[_0x9bd0('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9bd0('0x8'))['register'](socket);function respondWithRpcPromise(_0x5d5a81,_0x260b3d,_0x44e309){return new BPromise(function(_0x5dd1d6,_0x221d64){return client['request'](_0x5d5a81,_0x44e309)['then'](function(_0x2df6ea){logger[_0x9bd0('0x9')]('WhatsappMessage,\x20%s,\x20%s',_0x260b3d,'request\x20sent');logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x260b3d,'request\x20sent',JSON[_0x9bd0('0xa')](_0x2df6ea));if(_0x2df6ea[_0x9bd0('0xb')]){if(_0x2df6ea[_0x9bd0('0xb')][_0x9bd0('0xc')]===0x1f4){logger['error'](_0x9bd0('0xd'),_0x260b3d,_0x2df6ea[_0x9bd0('0xb')]['message']);return _0x221d64(_0x2df6ea['error'][_0x9bd0('0xe')]);}logger[_0x9bd0('0xb')]('WhatsappMessage,\x20%s,\x20%s',_0x260b3d,_0x2df6ea['error'][_0x9bd0('0xe')]);return _0x5dd1d6(_0x2df6ea[_0x9bd0('0xb')]['message']);}else{logger['info'](_0x9bd0('0xd'),_0x260b3d,'request\x20sent');_0x5dd1d6(_0x2df6ea[_0x9bd0('0xf')]['message']);}})[_0x9bd0('0x10')](function(_0x2f8464){logger[_0x9bd0('0xb')](_0x9bd0('0xd'),_0x260b3d,_0x2f8464);_0x221d64(_0x2f8464);});});}exports[_0x9bd0('0x11')]=function(_0x2cbfad){var _0x3bb361=this;return new Promise(function(_0x3f2ee6,_0x493f5f){return db[_0x9bd0('0x12')]['create'](_0x2cbfad[_0x9bd0('0x13')],{'raw':_0x2cbfad[_0x9bd0('0x14')]?_0x2cbfad[_0x9bd0('0x14')][_0x9bd0('0x15')]===undefined?!![]:![]:!![]})[_0x9bd0('0x16')](function(_0x296819){logger['info']('CreateWhatsappMessage',_0x2cbfad);logger[_0x9bd0('0x17')]('CreateWhatsappMessage',_0x2cbfad,JSON[_0x9bd0('0xa')](_0x296819));_0x3f2ee6(_0x296819);})['catch'](function(_0xab7e5e){logger[_0x9bd0('0xb')](_0x9bd0('0x11'),_0xab7e5e[_0x9bd0('0xe')],_0x2cbfad);_0x493f5f(_0x3bb361[_0x9bd0('0xb')](0x1f4,_0xab7e5e['message']));});});}; \ No newline at end of file +var _0x1a7f=['then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappMessage','create','body','options','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','request'];(function(_0x9a5ffe,_0x4ad525){var _0x5860ac=function(_0x450479){while(--_0x450479){_0x9a5ffe['push'](_0x9a5ffe['shift']());}};_0x5860ac(++_0x4ad525);}(_0x1a7f,0x191));var _0xf1a7=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x1a7f[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xf1a7('0x0'));var util=require(_0xf1a7('0x1'));var moment=require(_0xf1a7('0x2'));var BPromise=require(_0xf1a7('0x3'));var rs=require(_0xf1a7('0x4'));var fs=require('fs');var Redis=require(_0xf1a7('0x5'));var db=require(_0xf1a7('0x6'))['db'];var utils=require(_0xf1a7('0x7'));var logger=require(_0xf1a7('0x8'))(_0xf1a7('0x9'));var config=require('../../config/environment');var jayson=require(_0xf1a7('0xa'));var client=jayson[_0xf1a7('0xb')][_0xf1a7('0xc')]({'port':0x232a});config[_0xf1a7('0xd')]=_['defaults'](config[_0xf1a7('0xd')],{'host':_0xf1a7('0xe'),'port':0x18eb});var socket=require(_0xf1a7('0xf'))(new Redis(config['redis']));require(_0xf1a7('0x10'))[_0xf1a7('0x11')](socket);function respondWithRpcPromise(_0x5ba6a1,_0x258cdb,_0xe72653){return new BPromise(function(_0x4fa5b9,_0xa06ef0){return client[_0xf1a7('0x12')](_0x5ba6a1,_0xe72653)[_0xf1a7('0x13')](function(_0x3a9c8b){logger[_0xf1a7('0x14')](_0xf1a7('0x15'),_0x258cdb,_0xf1a7('0x16'));logger[_0xf1a7('0x17')](_0xf1a7('0x18'),_0x258cdb,_0xf1a7('0x16'),JSON[_0xf1a7('0x19')](_0x3a9c8b));if(_0x3a9c8b[_0xf1a7('0x1a')]){if(_0x3a9c8b[_0xf1a7('0x1a')][_0xf1a7('0x1b')]===0x1f4){logger[_0xf1a7('0x1a')]('WhatsappMessage,\x20%s,\x20%s',_0x258cdb,_0x3a9c8b[_0xf1a7('0x1a')][_0xf1a7('0x1c')]);return _0xa06ef0(_0x3a9c8b[_0xf1a7('0x1a')]['message']);}logger[_0xf1a7('0x1a')](_0xf1a7('0x15'),_0x258cdb,_0x3a9c8b[_0xf1a7('0x1a')]['message']);return _0x4fa5b9(_0x3a9c8b[_0xf1a7('0x1a')]['message']);}else{logger[_0xf1a7('0x14')](_0xf1a7('0x15'),_0x258cdb,_0xf1a7('0x16'));_0x4fa5b9(_0x3a9c8b[_0xf1a7('0x1d')][_0xf1a7('0x1c')]);}})[_0xf1a7('0x1e')](function(_0x4353e5){logger[_0xf1a7('0x1a')](_0xf1a7('0x15'),_0x258cdb,_0x4353e5);_0xa06ef0(_0x4353e5);});});}exports[_0xf1a7('0x1f')]=function(_0x5b6afa){var _0x21238a=this;return new Promise(function(_0x2e8ad5,_0x378021){return db['WhatsappMessage'][_0xf1a7('0x20')](_0x5b6afa[_0xf1a7('0x21')],{'raw':_0x5b6afa['options']?_0x5b6afa[_0xf1a7('0x22')]['raw']===undefined?!![]:![]:!![]})[_0xf1a7('0x13')](function(_0x4bba82){logger[_0xf1a7('0x14')]('CreateWhatsappMessage',_0x5b6afa);logger['debug'](_0xf1a7('0x1f'),_0x5b6afa,JSON[_0xf1a7('0x19')](_0x4bba82));_0x2e8ad5(_0x4bba82);})[_0xf1a7('0x1e')](function(_0x2d6053){logger[_0xf1a7('0x1a')]('CreateWhatsappMessage',_0x2d6053[_0xf1a7('0x1c')],_0x5b6afa);_0x378021(_0x21238a[_0xf1a7('0x1a')](0x1f4,_0x2d6053[_0xf1a7('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 2e414a1..bd3f9fb 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 _0xc08a=['register','whatsappMessage:','./whatsappMessage.events','save','update','removeListener'];(function(_0x4b6507,_0x5518b5){var _0x2001ec=function(_0x330ddf){while(--_0x330ddf){_0x4b6507['push'](_0x4b6507['shift']());}};_0x2001ec(++_0x5518b5);}(_0xc08a,0x13a));var _0xac08=function(_0x11e007,_0x1a0b4f){_0x11e007=_0x11e007-0x0;var _0x46c0b8=_0xc08a[_0x11e007];return _0x46c0b8;};'use strict';var WhatsappMessageEvents=require(_0xac08('0x0'));var events=[_0xac08('0x1'),'remove',_0xac08('0x2')];function createListener(_0x281bd5,_0x5c9f9b){return function(_0x508ba6){_0x5c9f9b['emit'](_0x281bd5,_0x508ba6);};}function removeListener(_0x14f6ba,_0x463cc7){return function(){WhatsappMessageEvents[_0xac08('0x3')](_0x14f6ba,_0x463cc7);};}exports[_0xac08('0x4')]=function(_0x5d2dd0){for(var _0x2607db=0x0,_0x1ab0da=events['length'];_0x2607db<_0x1ab0da;_0x2607db++){var _0xd48edb=events[_0x2607db];var _0x32615a=createListener(_0xac08('0x5')+_0xd48edb,_0x5d2dd0);WhatsappMessageEvents['on'](_0xd48edb,_0x32615a);}}; \ No newline at end of file +var _0x9551=['update','emit','removeListener','length','whatsappMessage:','./whatsappMessage.events','remove'];(function(_0x362ad7,_0x948800){var _0x54703b=function(_0x4153b8){while(--_0x4153b8){_0x362ad7['push'](_0x362ad7['shift']());}};_0x54703b(++_0x948800);}(_0x9551,0x116));var _0x1955=function(_0x367c8e,_0x3a6502){_0x367c8e=_0x367c8e-0x0;var _0x1c2789=_0x9551[_0x367c8e];return _0x1c2789;};'use strict';var WhatsappMessageEvents=require(_0x1955('0x0'));var events=['save',_0x1955('0x1'),_0x1955('0x2')];function createListener(_0x346d21,_0x4ae731){return function(_0x3ed06c){_0x4ae731[_0x1955('0x3')](_0x346d21,_0x3ed06c);};}function removeListener(_0x3423ec,_0x15e5cd){return function(){WhatsappMessageEvents[_0x1955('0x4')](_0x3423ec,_0x15e5cd);};}exports['register']=function(_0x4d569f){for(var _0x12aa38=0x0,_0x1f611e=events[_0x1955('0x5')];_0x12aa38<_0x1f611e;_0x12aa38++){var _0x6f3f62=events[_0x12aa38];var _0x16f143=createListener(_0x1955('0x6')+_0x6f3f62,_0x4d569f);WhatsappMessageEvents['on'](_0x6f3f62,_0x16f143);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 433dd1b..c5d1b34 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 _0xd77a=['post','put','update','delete','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','create'];(function(_0x4e8817,_0x1e2625){var _0x203655=function(_0x445a7b){while(--_0x445a7b){_0x4e8817['push'](_0x4e8817['shift']());}};_0x203655(++_0x1e2625);}(_0xd77a,0x1a7));var _0xad77=function(_0x494b81,_0x21564f){_0x494b81=_0x494b81-0x0;var _0x117284=_0xd77a[_0x494b81];return _0x117284;};'use strict';var multer=require(_0xad77('0x0'));var util=require('util');var path=require(_0xad77('0x1'));var timeout=require(_0xad77('0x2'));var express=require(_0xad77('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xad77('0x4'));var interaction=require(_0xad77('0x5'));var config=require('../../config/environment');var controller=require(_0xad77('0x6'));router[_0xad77('0x7')]('/',auth['isAuthenticated'](),controller[_0xad77('0x8')]);router[_0xad77('0x7')](_0xad77('0x9'),auth[_0xad77('0xa')](),controller[_0xad77('0xb')]);router[_0xad77('0x7')](_0xad77('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xad77('0x7')](_0xad77('0xd'),auth[_0xad77('0xa')](),controller[_0xad77('0xe')]);router[_0xad77('0x7')](_0xad77('0xf'),auth[_0xad77('0xa')](),controller['getTeams']);router[_0xad77('0x7')](_0xad77('0x10'),auth[_0xad77('0xa')](),controller[_0xad77('0x11')]);router['post']('/',auth[_0xad77('0xa')](),controller[_0xad77('0x12')]);router[_0xad77('0x13')](_0xad77('0xf'),auth[_0xad77('0xa')](),controller['addTeams']);router['post'](_0xad77('0x10'),auth[_0xad77('0xa')](),controller['addAgents']);router[_0xad77('0x14')](_0xad77('0xc'),auth[_0xad77('0xa')](),controller[_0xad77('0x15')]);router[_0xad77('0x16')](_0xad77('0xc'),auth[_0xad77('0xa')](),controller['destroy']);router['delete'](_0xad77('0xf'),auth[_0xad77('0xa')](),controller[_0xad77('0x17')]);router[_0xad77('0x16')]('/:id/users',auth[_0xad77('0xa')](),controller[_0xad77('0x18')]);module[_0xad77('0x19')]=router; \ No newline at end of file +var _0xcceb=['getMembers','/:id/teams','getAgents','post','create','addAgents','put','update','delete','/:id','destroy','removeTeams','/:id/users','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xcceb,0x144));var _0xbcce=function(_0xef0a8c,_0x39e693){_0xef0a8c=_0xef0a8c-0x0;var _0x1cded6=_0xcceb[_0xef0a8c];return _0x1cded6;};'use strict';var multer=require(_0xbcce('0x0'));var util=require(_0xbcce('0x1'));var path=require(_0xbcce('0x2'));var timeout=require(_0xbcce('0x3'));var express=require(_0xbcce('0x4'));var router=express[_0xbcce('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbcce('0x6'));var interaction=require(_0xbcce('0x7'));var config=require(_0xbcce('0x8'));var controller=require(_0xbcce('0x9'));router[_0xbcce('0xa')]('/',auth[_0xbcce('0xb')](),controller[_0xbcce('0xc')]);router[_0xbcce('0xa')](_0xbcce('0xd'),auth[_0xbcce('0xb')](),controller[_0xbcce('0xe')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xbcce('0xf')]);router[_0xbcce('0xa')](_0xbcce('0x10'),auth[_0xbcce('0xb')](),controller[_0xbcce('0x11')]);router[_0xbcce('0xa')](_0xbcce('0x12'),auth['isAuthenticated'](),controller['getTeams']);router[_0xbcce('0xa')]('/:id/users',auth[_0xbcce('0xb')](),controller[_0xbcce('0x13')]);router[_0xbcce('0x14')]('/',auth[_0xbcce('0xb')](),controller[_0xbcce('0x15')]);router['post'](_0xbcce('0x12'),auth[_0xbcce('0xb')](),controller['addTeams']);router[_0xbcce('0x14')]('/:id/users',auth[_0xbcce('0xb')](),controller[_0xbcce('0x16')]);router[_0xbcce('0x17')]('/:id',auth[_0xbcce('0xb')](),controller[_0xbcce('0x18')]);router[_0xbcce('0x19')](_0xbcce('0x1a'),auth[_0xbcce('0xb')](),controller[_0xbcce('0x1b')]);router['delete'](_0xbcce('0x12'),auth[_0xbcce('0xb')](),controller[_0xbcce('0x1c')]);router[_0xbcce('0x19')](_0xbcce('0x1d'),auth[_0xbcce('0xb')](),controller['removeAgents']);module[_0xbcce('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 1b2d1d1..56d15fb 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 _0xd2ea=['exports','STRING','name','INTEGER','rrmemory','beepall','roundrobin','sequelize'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xd2ea,0x15f));var _0xad2e=function(_0x570a66,_0x399546){_0x570a66=_0x570a66-0x0;var _0x16a9aa=_0xd2ea[_0x570a66];return _0x16a9aa;};'use strict';var Sequelize=require(_0xad2e('0x0'));module[_0xad2e('0x1')]={'name':{'type':Sequelize[_0xad2e('0x2')],'unique':_0xad2e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xad2e('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xad2e('0x5'),_0xad2e('0x6'),_0xad2e('0x7'))},'description':{'type':Sequelize[_0xad2e('0x2')]}}; \ No newline at end of file +var _0x58e5=['exports','STRING','name','INTEGER','ENUM','beepall','sequelize'];(function(_0xb4820c,_0x4ccfe3){var _0x1c13c3=function(_0xf9c5df){while(--_0xf9c5df){_0xb4820c['push'](_0xb4820c['shift']());}};_0x1c13c3(++_0x4ccfe3);}(_0x58e5,0xd1));var _0x558e=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0x58e5[_0x307d86];return _0x361745;};'use strict';var Sequelize=require(_0x558e('0x0'));module[_0x558e('0x1')]={'name':{'type':Sequelize[_0x558e('0x2')],'unique':_0x558e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x558e('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x558e('0x5')]('rrmemory',_0x558e('0x6'),'roundrobin')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index ec24b46..31a1591 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 _0x441f=['includeAll','include','findAll','rows','show','params','create','body','user','role','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','describe','getMembers','findOne','UserWhatsappQueue','rawAttributes','WhatsappQueueId','UserId','whatsappPause','updatedAt','format','createdAt','getTeams','Team','addTeams','ids','User','online','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','status','end','json','offset','undefined','limit','set','apply','reject','save','update','destroy','get','WhatsappQueues','then','error','name','send','WhatsappQueue','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','count'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x441f,0x159));var _0xf441=function(_0xf168d3,_0x43dcfc){_0xf168d3=_0xf168d3-0x0;var _0x17fb54=_0x441f[_0xf168d3];return _0x17fb54;};'use strict';var emlformat=require(_0xf441('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf441('0x1'));var jsonpatch=require(_0xf441('0x2'));var rp=require(_0xf441('0x3'));var moment=require(_0xf441('0x4'));var BPromise=require(_0xf441('0x5'));var Mustache=require(_0xf441('0x6'));var util=require(_0xf441('0x7'));var path=require('path');var sox=require(_0xf441('0x8'));var csv=require(_0xf441('0x9'));var ejs=require(_0xf441('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf441('0xb'));var squel=require(_0xf441('0xc'));var crypto=require('crypto');var jsforce=require(_0xf441('0xd'));var deskjs=require(_0xf441('0xe'));var toCsv=require(_0xf441('0x9'));var querystring=require(_0xf441('0xf'));var Papa=require(_0xf441('0x10'));var Redis=require(_0xf441('0x11'));var authService=require(_0xf441('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf441('0x13'));var hardwareService=require(_0xf441('0x14'));var logger=require(_0xf441('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xf441('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xf441('0x17')]=_[_0xf441('0x18')](config[_0xf441('0x17')],{'host':_0xf441('0x19'),'port':0x18eb});var socket=require(_0xf441('0x1a'))(new Redis(config[_0xf441('0x17')]));require(_0xf441('0x1b'))['register'](socket);function respondWithStatusCode(_0x360646,_0xf730c5){_0xf730c5=_0xf730c5||0xcc;return function(_0x5a8afa){if(_0x5a8afa){return _0x360646['sendStatus'](_0xf730c5);}return _0x360646[_0xf441('0x1c')](_0xf730c5)[_0xf441('0x1d')]();};}function respondWithResult(_0x23e63a,_0x56e11c){_0x56e11c=_0x56e11c||0xc8;return function(_0x47b0c5){if(_0x47b0c5){return _0x23e63a[_0xf441('0x1c')](_0x56e11c)[_0xf441('0x1e')](_0x47b0c5);}};}function respondWithFilteredResult(_0x5e34ea,_0x376a4c){return function(_0x53d0db){if(_0x53d0db){var _0x5bdc9a=typeof _0x376a4c[_0xf441('0x1f')]===_0xf441('0x20')&&typeof _0x376a4c[_0xf441('0x21')]===_0xf441('0x20');var _0x5075ee=_0x53d0db['count'];var _0x5bdc62=_0x5bdc9a?0x0:_0x376a4c['offset'];var _0x480e21=_0x5bdc9a?_0x53d0db['count']:_0x376a4c['offset']+_0x376a4c['limit'];var _0x20fcd1;if(_0x480e21>=_0x5075ee){_0x480e21=_0x5075ee;_0x20fcd1=0xc8;}else{_0x20fcd1=0xce;}_0x5e34ea['status'](_0x20fcd1);return _0x5e34ea[_0xf441('0x22')]('Content-Range',_0x5bdc62+'-'+_0x480e21+'/'+_0x5075ee)[_0xf441('0x1e')](_0x53d0db);}return null;};}function patchUpdates(_0x2a9bb3){return function(_0xff5c50){try{jsonpatch[_0xf441('0x23')](_0xff5c50,_0x2a9bb3,!![]);}catch(_0x506958){return BPromise[_0xf441('0x24')](_0x506958);}return _0xff5c50[_0xf441('0x25')]();};}function saveUpdates(_0x182937,_0x26f8f2){return function(_0x5c351f){if(_0x5c351f){return _0x5c351f[_0xf441('0x26')](_0x182937)['then'](function(_0x36b4e1){return _0x36b4e1;});}return null;};}function removeEntity(_0x277e32,_0xb222d6){return function(_0x33e904){if(_0x33e904){return _0x33e904[_0xf441('0x27')]()['then'](function(){var _0x4926b2=_0x33e904[_0xf441('0x28')]({'plain':!![]});var _0x5ca0d4=_0xf441('0x29');return db['UserProfileResource'][_0xf441('0x27')]({'where':{'type':_0x5ca0d4,'resourceId':_0x4926b2['id']}})[_0xf441('0x2a')](function(){return _0x33e904;});})['then'](function(){_0x277e32[_0xf441('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49fa57,_0x180179){return function(_0x3c627c){if(!_0x3c627c){_0x49fa57['sendStatus'](0x194);}return _0x3c627c;};}function handleError(_0x1c4772,_0x1e2155){_0x1e2155=_0x1e2155||0x1f4;return function(_0x5a7b3b){logger[_0xf441('0x2b')](_0x5a7b3b['stack']);if(_0x5a7b3b['name']){delete _0x5a7b3b[_0xf441('0x2c')];}_0x1c4772[_0xf441('0x1c')](_0x1e2155)[_0xf441('0x2d')](_0x5a7b3b);};}exports['index']=function(_0x1d0073,_0x117a0a){var _0x38b22e={},_0x39e2a4={},_0x2b0318={'count':0x0,'rows':[]};var _0x3538a3=_['map'](db[_0xf441('0x2e')]['rawAttributes'],function(_0x471eb2){return{'name':_0x471eb2['fieldName'],'type':_0x471eb2['type'][_0xf441('0x2f')]};});_0x39e2a4['model']=_[_0xf441('0x30')](_0x3538a3,_0xf441('0x2c'));_0x39e2a4['query']=_[_0xf441('0x31')](_0x1d0073[_0xf441('0x32')]);_0x39e2a4[_0xf441('0x33')]=_[_0xf441('0x34')](_0x39e2a4[_0xf441('0x35')],_0x39e2a4[_0xf441('0x32')]);_0x38b22e[_0xf441('0x36')]=_[_0xf441('0x34')](_0x39e2a4[_0xf441('0x35')],qs[_0xf441('0x37')](_0x1d0073[_0xf441('0x32')][_0xf441('0x37')]));_0x38b22e[_0xf441('0x36')]=_0x38b22e[_0xf441('0x36')][_0xf441('0x38')]?_0x38b22e[_0xf441('0x36')]:_0x39e2a4[_0xf441('0x35')];if(!_0x1d0073[_0xf441('0x32')][_0xf441('0x39')](_0xf441('0x3a'))){_0x38b22e[_0xf441('0x21')]=qs[_0xf441('0x21')](_0x1d0073[_0xf441('0x32')][_0xf441('0x21')]);_0x38b22e[_0xf441('0x1f')]=qs['offset'](_0x1d0073[_0xf441('0x32')][_0xf441('0x1f')]);}_0x38b22e[_0xf441('0x3b')]=qs[_0xf441('0x3c')](_0x1d0073[_0xf441('0x32')]['sort']);_0x38b22e[_0xf441('0x3d')]=qs[_0xf441('0x33')](_[_0xf441('0x3e')](_0x1d0073[_0xf441('0x32')],_0x39e2a4[_0xf441('0x33')]),_0x3538a3);if(_0x1d0073['query']['filter']){_0x38b22e[_0xf441('0x3d')]=_['merge'](_0x38b22e['where'],{'$or':_['map'](_0x3538a3,function(_0x37a53d){if(_0x37a53d[_0xf441('0x3f')]!==_0xf441('0x40')){var _0x4c1c5e={};_0x4c1c5e[_0x37a53d[_0xf441('0x2c')]]={'$like':'%'+_0x1d0073[_0xf441('0x32')][_0xf441('0x41')]+'%'};return _0x4c1c5e;}})});}_0x38b22e=_[_0xf441('0x42')]({},_0x38b22e,_0x1d0073[_0xf441('0x43')]);var _0x501b18={'where':_0x38b22e[_0xf441('0x3d')]};return db['WhatsappQueue'][_0xf441('0x44')](_0x501b18)[_0xf441('0x2a')](function(_0x49db0b){_0x2b0318[_0xf441('0x44')]=_0x49db0b;if(_0x1d0073[_0xf441('0x32')][_0xf441('0x45')]){_0x38b22e[_0xf441('0x46')]=[{'all':!![]}];}return db['WhatsappQueue'][_0xf441('0x47')](_0x38b22e);})[_0xf441('0x2a')](function(_0x4ecb0c){_0x2b0318[_0xf441('0x48')]=_0x4ecb0c;return _0x2b0318;})[_0xf441('0x2a')](respondWithFilteredResult(_0x117a0a,_0x38b22e))['catch'](handleError(_0x117a0a,null));};exports[_0xf441('0x49')]=function(_0x225855,_0x5788fa){var _0x5de2b3={'raw':!![],'where':{'id':_0x225855[_0xf441('0x4a')]['id']}},_0x26b057={};_0x26b057['model']=_['keys'](db[_0xf441('0x2e')]['rawAttributes']);_0x26b057[_0xf441('0x32')]=_[_0xf441('0x31')](_0x225855[_0xf441('0x32')]);_0x26b057[_0xf441('0x33')]=_[_0xf441('0x34')](_0x26b057[_0xf441('0x35')],_0x26b057['query']);_0x5de2b3[_0xf441('0x36')]=_[_0xf441('0x34')](_0x26b057['model'],qs[_0xf441('0x37')](_0x225855['query'][_0xf441('0x37')]));_0x5de2b3[_0xf441('0x36')]=_0x5de2b3['attributes'][_0xf441('0x38')]?_0x5de2b3['attributes']:_0x26b057['model'];if(_0x225855[_0xf441('0x32')][_0xf441('0x45')]){_0x5de2b3['include']=[{'all':!![]}];}_0x5de2b3=_[_0xf441('0x42')]({},_0x5de2b3,_0x225855['options']);return db[_0xf441('0x2e')]['find'](_0x5de2b3)['then'](handleEntityNotFound(_0x5788fa,null))[_0xf441('0x2a')](respondWithResult(_0x5788fa,null))['catch'](handleError(_0x5788fa,null));};exports[_0xf441('0x4b')]=function(_0x48bfdf,_0x2958ee){return db[_0xf441('0x2e')][_0xf441('0x4b')](_0x48bfdf[_0xf441('0x4c')],{})['then'](function(_0x566eec){var _0x3c1e81=_0x48bfdf[_0xf441('0x4d')]['get']({'plain':!![]});if(!_0x3c1e81)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3c1e81[_0xf441('0x4e')]===_0xf441('0x4d')){var _0x2947b3=_0x566eec['get']({'plain':!![]});var _0x94397d=_0xf441('0x29');return db['UserProfileSection'][_0xf441('0x4f')]({'where':{'name':_0x94397d,'userProfileId':_0x3c1e81[_0xf441('0x50')]},'raw':!![]})[_0xf441('0x2a')](function(_0x94bde7){if(_0x94bde7&&_0x94bde7['autoAssociation']===0x0){return db['UserProfileResource'][_0xf441('0x4b')]({'name':_0x2947b3[_0xf441('0x2c')],'resourceId':_0x2947b3['id'],'type':_0x94bde7[_0xf441('0x2c')],'sectionId':_0x94bde7['id']},{})['then'](function(){return _0x566eec;});}else{return _0x566eec;}})['catch'](function(_0x40989d){logger[_0xf441('0x2b')](_0xf441('0x51'),_0x40989d);throw _0x40989d;});}return _0x566eec;})[_0xf441('0x2a')](respondWithResult(_0x2958ee,0xc9))[_0xf441('0x52')](handleError(_0x2958ee,null));};exports['update']=function(_0x35e6b5,_0x1fdbe3){if(_0x35e6b5[_0xf441('0x4c')]['id']){delete _0x35e6b5[_0xf441('0x4c')]['id'];}return db[_0xf441('0x2e')][_0xf441('0x4f')]({'where':{'id':_0x35e6b5[_0xf441('0x4a')]['id']}})[_0xf441('0x2a')](handleEntityNotFound(_0x1fdbe3,null))['then'](saveUpdates(_0x35e6b5[_0xf441('0x4c')],null))[_0xf441('0x2a')](respondWithResult(_0x1fdbe3,null))[_0xf441('0x52')](handleError(_0x1fdbe3,null));};exports['destroy']=function(_0x505603,_0x5d45a3){return db[_0xf441('0x2e')][_0xf441('0x4f')]({'where':{'id':_0x505603[_0xf441('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5d45a3,null))[_0xf441('0x2a')](removeEntity(_0x5d45a3,null))[_0xf441('0x52')](handleError(_0x5d45a3,null));};exports[_0xf441('0x53')]=function(_0x28a845,_0x131c52){return db['WhatsappQueue'][_0xf441('0x53')]()[_0xf441('0x2a')](respondWithResult(_0x131c52,null))[_0xf441('0x52')](handleError(_0x131c52,null));};exports[_0xf441('0x54')]=function(_0x27fdf3,_0x4a86a6,_0x50434e){var _0x413514={'raw':!![],'where':{}},_0x163fc3={},_0x59e69d;return db[_0xf441('0x2e')][_0xf441('0x55')]({'where':{'id':_0x27fdf3[_0xf441('0x4a')]['id']}})[_0xf441('0x2a')](handleEntityNotFound(_0x4a86a6,null))['then'](function(_0x59c8a2){if(_0x59c8a2){_0x59e69d=_0x59c8a2[_0xf441('0x28')]({'plain':!![]});_0x163fc3[_0xf441('0x35')]=_[_0xf441('0x31')](db[_0xf441('0x56')][_0xf441('0x57')]);_0x163fc3[_0xf441('0x32')]=_[_0xf441('0x31')](_0x27fdf3[_0xf441('0x32')]);_0x163fc3[_0xf441('0x33')]=_[_0xf441('0x34')](_0x163fc3[_0xf441('0x35')],_0x163fc3['query']);_0x413514[_0xf441('0x36')]=_[_0xf441('0x34')](_0x163fc3['model'],qs[_0xf441('0x37')](_0x27fdf3[_0xf441('0x32')][_0xf441('0x37')]));_0x413514[_0xf441('0x36')]=_0x413514['attributes'][_0xf441('0x38')]?_0x413514['attributes']:_0x163fc3[_0xf441('0x35')];if(!_0x27fdf3[_0xf441('0x32')][_0xf441('0x39')](_0xf441('0x3a'))){_0x413514['limit']=qs[_0xf441('0x21')](_0x27fdf3[_0xf441('0x32')][_0xf441('0x21')]);_0x413514[_0xf441('0x1f')]=qs['offset'](_0x27fdf3['query'][_0xf441('0x1f')]);}_0x413514[_0xf441('0x3b')]=qs['sort'](_0x27fdf3['query']['sort']);_0x413514[_0xf441('0x3d')]=qs[_0xf441('0x33')](_[_0xf441('0x3e')](_0x27fdf3['query'],_0x163fc3[_0xf441('0x33')]));_0x413514[_0xf441('0x3d')][_0xf441('0x58')]=_0x59c8a2['id'];if(_0x27fdf3['query'][_0xf441('0x41')]){_0x413514['where']=_['merge'](_0x413514[_0xf441('0x3d')],{'$or':_['map'](_0x413514[_0xf441('0x36')],function(_0x5c8973){var _0x1bce0c={};_0x1bce0c[_0x5c8973]={'$like':'%'+_0x27fdf3[_0xf441('0x32')][_0xf441('0x41')]+'%'};return _0x1bce0c;})});}_0x413514=_['merge']({},_0x413514,_0x27fdf3[_0xf441('0x43')]);return db['UserWhatsappQueue'][_0xf441('0x47')](_0x413514);}})['then'](function(_0x14c361){if(_0x14c361){return db['User']['findAndCountAll']({'where':{'id':_['map'](_0x14c361,_0xf441('0x59')),'role':'agent'},'attributes':['id',_0xf441('0x2c'),_0xf441('0x5a'),_0xf441('0x5b'),'createdAt']});}})[_0xf441('0x2a')](function(_0x4b24bb){if(_0x4b24bb){return{'count':_0x4b24bb[_0xf441('0x44')],'rows':_['map'](_0x4b24bb['rows'],function(_0x561e95){return{'membername':_0x561e95[_0xf441('0x2c')],'UserId':_0x561e95['id'],'queue_name':_0x59e69d[_0xf441('0x2c')],'WhatsappQueueId':_0x59e69d['id'],'interface':util[_0xf441('0x5c')]('%s/%s','SIP',_0x561e95[_0xf441('0x2c')]),'penalty':0x0,'paused':_0x561e95[_0xf441('0x5a')],'createdAt':_0x561e95[_0xf441('0x5d')],'updatedAt':_0x561e95[_0xf441('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf441('0x2a')](respondWithFilteredResult(_0x4a86a6,_0x413514))['catch'](handleError(_0x4a86a6,null));};exports[_0xf441('0x5e')]=function(_0x2740ab,_0x2b4a5f,_0x1b67cd){var _0x30bc03={};var _0x4cff9f={};var _0xe7a89a;var _0x11b144;return db[_0xf441('0x2e')][_0xf441('0x55')]({'where':{'id':_0x2740ab[_0xf441('0x4a')]['id']}})[_0xf441('0x2a')](handleEntityNotFound(_0x2b4a5f,null))['then'](function(_0xa147c){if(_0xa147c){_0xe7a89a=_0xa147c;_0x4cff9f[_0xf441('0x35')]=_[_0xf441('0x31')](db[_0xf441('0x5f')][_0xf441('0x57')]);_0x4cff9f[_0xf441('0x32')]=_[_0xf441('0x31')](_0x2740ab[_0xf441('0x32')]);_0x4cff9f['filters']=_[_0xf441('0x34')](_0x4cff9f[_0xf441('0x35')],_0x4cff9f[_0xf441('0x32')]);_0x30bc03[_0xf441('0x36')]=_[_0xf441('0x34')](_0x4cff9f[_0xf441('0x35')],qs[_0xf441('0x37')](_0x2740ab['query'][_0xf441('0x37')]));_0x30bc03[_0xf441('0x36')]=_0x30bc03['attributes'][_0xf441('0x38')]?_0x30bc03[_0xf441('0x36')]:_0x4cff9f[_0xf441('0x35')];_0x30bc03['order']=qs[_0xf441('0x3c')](_0x2740ab[_0xf441('0x32')][_0xf441('0x3c')]);_0x30bc03[_0xf441('0x3d')]=qs[_0xf441('0x33')](_[_0xf441('0x3e')](_0x2740ab[_0xf441('0x32')],_0x4cff9f[_0xf441('0x33')]));if(_0x2740ab[_0xf441('0x32')][_0xf441('0x41')]){_0x30bc03[_0xf441('0x3d')]=_['merge'](_0x30bc03[_0xf441('0x3d')],{'$or':_[_0xf441('0x30')](_0x30bc03[_0xf441('0x36')],function(_0x3add05){var _0x535ae6={};_0x535ae6[_0x3add05]={'$like':'%'+_0x2740ab[_0xf441('0x32')][_0xf441('0x41')]+'%'};return _0x535ae6;})});}_0x30bc03=_[_0xf441('0x42')]({},_0x30bc03,_0x2740ab[_0xf441('0x43')]);return _0xe7a89a[_0xf441('0x5e')](_0x30bc03);}})['then'](function(_0x5d4590){if(_0x5d4590){_0x11b144=_0x5d4590[_0xf441('0x38')];if(!_0x2740ab['query'][_0xf441('0x39')]('nolimit')){_0x30bc03[_0xf441('0x21')]=qs['limit'](_0x2740ab[_0xf441('0x32')][_0xf441('0x21')]);_0x30bc03[_0xf441('0x1f')]=qs['offset'](_0x2740ab['query'][_0xf441('0x1f')]);}return _0xe7a89a[_0xf441('0x5e')](_0x30bc03);}})[_0xf441('0x2a')](function(_0x4a8cd4){if(_0x4a8cd4){return _0x4a8cd4?{'count':_0x11b144,'rows':_0x4a8cd4}:null;}})[_0xf441('0x2a')](respondWithResult(_0x2b4a5f,null))['catch'](handleError(_0x2b4a5f,null));};exports[_0xf441('0x60')]=function(_0x35a6b1,_0x374a0c,_0x1e26e5){var _0x46c4f1=_0x35a6b1['body'][_0xf441('0x61')];return db['Team']['findAll']({'where':{'id':_0x46c4f1},'attributes':['id'],'include':[{'model':db[_0xf441('0x62')],'as':'Agents','attributes':['id','name',_0xf441('0x63'),'voicePause',_0xf441('0x64')],'raw':!![]}]})[_0xf441('0x2a')](function(_0x43d963){if(_0x43d963){var _0x1582a2=_[_0xf441('0x65')](_0x43d963,function(_0x1c8bf5){var _0x5694cf=_0x1c8bf5[_0xf441('0x28')]({'plain':!![]});return _0x5694cf[_0xf441('0x66')];});return db['WhatsappQueue']['find']({'where':{'id':_0x35a6b1[_0xf441('0x4a')]['id']}})['then'](function(_0x563fab){return db[_0xf441('0x67')][_0xf441('0x68')](function(_0x29307d){return _0x563fab[_0xf441('0x60')](_0x46c4f1,{'transaction':_0x29307d})[_0xf441('0x2a')](function(){return BPromise[_0xf441('0x69')](_0x1582a2,function(_0x2e8665){return db[_0xf441('0x56')][_0xf441('0x6a')]({'where':{'UserId':_0x2e8665['id'],'WhatsappQueueId':_0x35a6b1[_0xf441('0x4a')]['id']},'transaction':_0x29307d});});})['then'](function(){_0x1582a2[_0xf441('0x6b')](function(_0x370593){socket[_0xf441('0x6c')](_0xf441('0x6d'),{'UserId':_0x370593['id'],'WhatsappQueueId':_0x563fab['id']});});});});});}})[_0xf441('0x2a')](respondWithStatusCode(_0x374a0c,null))[_0xf441('0x52')](handleError(_0x374a0c,null));};exports[_0xf441('0x6e')]=function(_0x5c31a7,_0x5160ee,_0x1afb74){return db[_0xf441('0x5f')][_0xf441('0x47')]({'where':{'id':_0x5c31a7[_0xf441('0x32')][_0xf441('0x61')]},'attributes':['id'],'include':[{'model':db[_0xf441('0x62')],'as':_0xf441('0x66'),'attributes':['id'],'raw':!![]}]})[_0xf441('0x2a')](handleEntityNotFound(_0x5160ee,null))[_0xf441('0x2a')](function(_0x2154eb){var _0x4b3c02=_['map'](_0x2154eb,'id');var _0x379cfd=[];var _0x2d2198=[];var _0x1b817c=squel[_0xf441('0x6f')]();_0x1b817c[_0xf441('0x70')](_0xf441('0x71'))['from'](_0xf441('0x72'),'tq')['join'](_0xf441('0x73'),'ut',_0xf441('0x74'))[_0xf441('0x3d')]('WhatsappQueueId\x20=\x20?',_0x5c31a7[_0xf441('0x4a')]['id']);for(var _0x25e3ba=0x0;_0x25e3ba<_0x2154eb[_0xf441('0x38')];_0x25e3ba+=0x1){let _0x9189eb=_0x2154eb[_0x25e3ba];for(var _0x181135=0x0;_0x181135<_0x9189eb[_0xf441('0x66')]['length'];_0x181135+=0x1){let _0x2558ae=_0x9189eb[_0xf441('0x66')][_0x181135];var _0x27c363=_0x1b817c[_0xf441('0x75')]();_0x27c363[_0xf441('0x3d')](_0xf441('0x76'),_0x2558ae['id']);_0x2d2198[_0xf441('0x77')](db[_0xf441('0x67')]['query'](_0x27c363[_0xf441('0x78')](),{'type':db[_0xf441('0x67')][_0xf441('0x79')][_0xf441('0x7a')]})['then'](function(_0x3fd6b1){if(_0x3fd6b1[_0xf441('0x38')]===0x1){return _0x2558ae['id'];}else{var _0x28d6fe=_[_0xf441('0x7b')](_[_0xf441('0x30')](_0x3fd6b1,_0xf441('0x7c')),function(_0x2aae92){return _[_0xf441('0x7d')](_0x4b3c02,_0x2aae92);});if(_0x28d6fe){return _0x2558ae['id'];}}}));}}return BPromise[_0xf441('0x7e')](_0x2d2198)[_0xf441('0x2a')](function(_0x551b0a){_0x379cfd=_(_0x379cfd)[_0xf441('0x7f')](_0x551b0a)[_0xf441('0x80')]()[_0xf441('0x81')]();return db[_0xf441('0x2e')][_0xf441('0x4f')]({'where':{'id':_0x5c31a7[_0xf441('0x4a')]['id']}})[_0xf441('0x2a')](function(_0x202fdc){return db[_0xf441('0x67')][_0xf441('0x68')](function(_0x3a6d4c){return _0x202fdc['removeTeams'](_0x5c31a7[_0xf441('0x32')][_0xf441('0x61')],{'transaction':_0x3a6d4c})[_0xf441('0x2a')](function(){if(!_[_0xf441('0x82')](_0x379cfd)){return _0x202fdc[_0xf441('0x83')](_0x379cfd,{'transaction':_0x3a6d4c});}})[_0xf441('0x2a')](function(){_0x379cfd[_0xf441('0x6b')](function(_0x4a7b69){socket[_0xf441('0x6c')](_0xf441('0x84'),{'UserId':_0x4a7b69,'WhatsappQueueId':_0x202fdc['id']});});});});});});})[_0xf441('0x2a')](respondWithStatusCode(_0x5160ee,null))['catch'](handleError(_0x5160ee,null));};exports[_0xf441('0x85')]=function(_0x45a19b,_0x38ad65,_0x37158d){return db[_0xf441('0x2e')]['find']({'where':{'id':_0x45a19b['params']['id']}})[_0xf441('0x2a')](handleEntityNotFound(_0x38ad65,null))[_0xf441('0x2a')](function(_0x483c8a){if(_0x483c8a){return _0x483c8a[_0xf441('0x85')](_0x45a19b[_0xf441('0x4c')]['ids'],_[_0xf441('0x86')](_0x45a19b['body'],[_0xf441('0x61'),'id'])||{})[_0xf441('0x87')](function(_0x4ebd6c){for(var _0x3b2aa4=0x0;_0x3b2aa4<_0x45a19b[_0xf441('0x4c')][_0xf441('0x61')][_0xf441('0x38')];_0x3b2aa4+=0x1){socket['emit'](_0xf441('0x6d'),{'UserId':Number(_0x45a19b['body'][_0xf441('0x61')][_0x3b2aa4]),'WhatsappQueueId':Number(_0x45a19b[_0xf441('0x4a')]['id'])});}return _0x4ebd6c;});}})[_0xf441('0x2a')](respondWithResult(_0x38ad65,null))[_0xf441('0x52')](handleError(_0x38ad65,null));};exports['removeAgents']=function(_0x5319ad,_0x27cf63,_0x14d195){return db[_0xf441('0x2e')][_0xf441('0x4f')]({'where':{'id':_0x5319ad['params']['id']}})[_0xf441('0x2a')](handleEntityNotFound(_0x27cf63,null))[_0xf441('0x2a')](function(_0x19abb0){if(_0x19abb0){return _0x19abb0[_0xf441('0x83')](_0x5319ad['query'][_0xf441('0x61')])[_0xf441('0x2a')](function(){if(_[_0xf441('0x88')](_0x5319ad['query']['ids'])){for(var _0x35e346=0x0;_0x35e346<_0x5319ad[_0xf441('0x32')][_0xf441('0x61')][_0xf441('0x38')];_0x35e346+=0x1){socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x5319ad['query']['ids'][_0x35e346]),'WhatsappQueueId':Number(_0x5319ad[_0xf441('0x4a')]['id'])});}}else{socket[_0xf441('0x6c')](_0xf441('0x84'),{'UserId':Number(_0x5319ad['query']['ids']),'WhatsappQueueId':Number(_0x5319ad[_0xf441('0x4a')]['id'])});}});}})[_0xf441('0x2a')](respondWithStatusCode(_0x27cf63,null))[_0xf441('0x52')](handleError(_0x27cf63,null));};exports[_0xf441('0x89')]=function(_0x410059,_0x195422,_0x51f21c){var _0x34943b={};var _0x20f01={};var _0x5715e7;var _0x145c69;return db[_0xf441('0x2e')][_0xf441('0x55')]({'where':{'id':_0x410059[_0xf441('0x4a')]['id']}})[_0xf441('0x2a')](handleEntityNotFound(_0x195422,null))[_0xf441('0x2a')](function(_0x4b576a){if(_0x4b576a){_0x5715e7=_0x4b576a;_0x20f01[_0xf441('0x35')]=_['keys'](db[_0xf441('0x62')][_0xf441('0x57')]);_0x20f01['query']=_[_0xf441('0x31')](_0x410059[_0xf441('0x32')]);_0x20f01[_0xf441('0x33')]=_[_0xf441('0x34')](_0x20f01[_0xf441('0x35')],_0x20f01[_0xf441('0x32')]);_0x34943b[_0xf441('0x36')]=_[_0xf441('0x34')](_0x20f01[_0xf441('0x35')],qs[_0xf441('0x37')](_0x410059[_0xf441('0x32')][_0xf441('0x37')]));_0x34943b[_0xf441('0x36')]=_0x34943b[_0xf441('0x36')][_0xf441('0x38')]?_0x34943b[_0xf441('0x36')]:_0x20f01[_0xf441('0x35')];_0x34943b['order']=qs[_0xf441('0x3c')](_0x410059['query'][_0xf441('0x3c')]);_0x34943b[_0xf441('0x3d')]=qs[_0xf441('0x33')](_['pick'](_0x410059[_0xf441('0x32')],_0x20f01[_0xf441('0x33')]));if(_0x410059[_0xf441('0x32')][_0xf441('0x41')]){_0x34943b[_0xf441('0x3d')]=_[_0xf441('0x42')](_0x34943b[_0xf441('0x3d')],{'$or':_[_0xf441('0x30')](_0x34943b[_0xf441('0x36')],function(_0x3a985e){var _0x8d9c7={};_0x8d9c7[_0x3a985e]={'$like':'%'+_0x410059[_0xf441('0x32')][_0xf441('0x41')]+'%'};return _0x8d9c7;})});}_0x34943b=_[_0xf441('0x42')]({},_0x34943b,_0x410059[_0xf441('0x43')]);return _0x5715e7[_0xf441('0x89')](_0x34943b);}})[_0xf441('0x2a')](function(_0x2dc908){if(_0x2dc908){_0x145c69=_0x2dc908[_0xf441('0x38')];if(!_0x410059[_0xf441('0x32')][_0xf441('0x39')]('nolimit')){_0x34943b[_0xf441('0x21')]=qs[_0xf441('0x21')](_0x410059[_0xf441('0x32')][_0xf441('0x21')]);_0x34943b['offset']=qs[_0xf441('0x1f')](_0x410059[_0xf441('0x32')][_0xf441('0x1f')]);}return _0x5715e7[_0xf441('0x89')](_0x34943b);}})[_0xf441('0x2a')](function(_0x4fe46e){if(_0x4fe46e){return _0x4fe46e?{'count':_0x145c69,'rows':_0x4fe46e}:null;}})[_0xf441('0x2a')](respondWithResult(_0x195422,null))[_0xf441('0x52')](handleError(_0x195422,null));}; \ No newline at end of file +var _0xea8a=['util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','reject','save','destroy','then','get','UserProfileResource','error','stack','name','index','map','WhatsappQueue','rawAttributes','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','count','findAll','catch','show','params','keys','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','WhatsappQueues','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','UserWhatsappQueue','length','User','findAndCountAll','agent','whatsappPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','ids','Agents','voicePause','interface','flatMap','sequelize','addTeams','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','transaction','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','zip-dir','moment','bluebird','mustache'];(function(_0x15057e,_0x1381f6){var _0x46e736=function(_0x4dcb2b){while(--_0x4dcb2b){_0x15057e['push'](_0x15057e['shift']());}};_0x46e736(++_0x1381f6);}(_0xea8a,0x111));var _0xaea8=function(_0x470699,_0x510dc6){_0x470699=_0x470699-0x0;var _0x4e7143=_0xea8a[_0x470699];return _0x4e7143;};'use strict';var emlformat=require(_0xaea8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaea8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xaea8('0x2'));var BPromise=require(_0xaea8('0x3'));var Mustache=require(_0xaea8('0x4'));var util=require(_0xaea8('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xaea8('0x6'));var fs=require('fs');var fs_extra=require(_0xaea8('0x7'));var _=require(_0xaea8('0x8'));var squel=require(_0xaea8('0x9'));var crypto=require(_0xaea8('0xa'));var jsforce=require(_0xaea8('0xb'));var deskjs=require(_0xaea8('0xc'));var toCsv=require(_0xaea8('0xd'));var querystring=require(_0xaea8('0xe'));var Papa=require(_0xaea8('0xf'));var Redis=require(_0xaea8('0x10'));var authService=require(_0xaea8('0x11'));var qs=require(_0xaea8('0x12'));var as=require(_0xaea8('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaea8('0x14'));var utils=require('../../config/utils');var config=require(_0xaea8('0x15'));var licenseUtil=require(_0xaea8('0x16'));var db=require('../../mysqldb')['db'];config[_0xaea8('0x17')]=_[_0xaea8('0x18')](config['redis'],{'host':_0xaea8('0x19'),'port':0x18eb});var socket=require(_0xaea8('0x1a'))(new Redis(config[_0xaea8('0x17')]));require(_0xaea8('0x1b'))[_0xaea8('0x1c')](socket);function respondWithStatusCode(_0x1b2cfc,_0x3807c2){_0x3807c2=_0x3807c2||0xcc;return function(_0x87242e){if(_0x87242e){return _0x1b2cfc[_0xaea8('0x1d')](_0x3807c2);}return _0x1b2cfc[_0xaea8('0x1e')](_0x3807c2)[_0xaea8('0x1f')]();};}function respondWithResult(_0x176bab,_0x34bd4d){_0x34bd4d=_0x34bd4d||0xc8;return function(_0x5f5a0e){if(_0x5f5a0e){return _0x176bab[_0xaea8('0x1e')](_0x34bd4d)[_0xaea8('0x20')](_0x5f5a0e);}};}function respondWithFilteredResult(_0x595fe2,_0x304477){return function(_0x34e426){if(_0x34e426){var _0x45285a=typeof _0x304477[_0xaea8('0x21')]===_0xaea8('0x22')&&typeof _0x304477[_0xaea8('0x23')]==='undefined';var _0x3c3951=_0x34e426['count'];var _0x1c0473=_0x45285a?0x0:_0x304477[_0xaea8('0x21')];var _0x2dfb9e=_0x45285a?_0x34e426['count']:_0x304477['offset']+_0x304477[_0xaea8('0x23')];var _0x369323;if(_0x2dfb9e>=_0x3c3951){_0x2dfb9e=_0x3c3951;_0x369323=0xc8;}else{_0x369323=0xce;}_0x595fe2[_0xaea8('0x1e')](_0x369323);return _0x595fe2[_0xaea8('0x24')](_0xaea8('0x25'),_0x1c0473+'-'+_0x2dfb9e+'/'+_0x3c3951)['json'](_0x34e426);}return null;};}function patchUpdates(_0x481e1b){return function(_0xdd3b3d){try{jsonpatch['apply'](_0xdd3b3d,_0x481e1b,!![]);}catch(_0x7f16de){return BPromise[_0xaea8('0x26')](_0x7f16de);}return _0xdd3b3d[_0xaea8('0x27')]();};}function saveUpdates(_0xbc37d4,_0x12cff8){return function(_0x453e03){if(_0x453e03){return _0x453e03['update'](_0xbc37d4)['then'](function(_0x556ace){return _0x556ace;});}return null;};}function removeEntity(_0x5345bb,_0x2ce078){return function(_0x2f156d){if(_0x2f156d){return _0x2f156d[_0xaea8('0x28')]()[_0xaea8('0x29')](function(){var _0x423728=_0x2f156d[_0xaea8('0x2a')]({'plain':!![]});var _0x2b6785='WhatsappQueues';return db[_0xaea8('0x2b')][_0xaea8('0x28')]({'where':{'type':_0x2b6785,'resourceId':_0x423728['id']}})[_0xaea8('0x29')](function(){return _0x2f156d;});})[_0xaea8('0x29')](function(){_0x5345bb['status'](0xcc)[_0xaea8('0x1f')]();});}};}function handleEntityNotFound(_0x253a97,_0x3e7b54){return function(_0x549896){if(!_0x549896){_0x253a97[_0xaea8('0x1d')](0x194);}return _0x549896;};}function handleError(_0x369a3a,_0x5bfe60){_0x5bfe60=_0x5bfe60||0x1f4;return function(_0xb27c67){logger[_0xaea8('0x2c')](_0xb27c67[_0xaea8('0x2d')]);if(_0xb27c67[_0xaea8('0x2e')]){delete _0xb27c67[_0xaea8('0x2e')];}_0x369a3a[_0xaea8('0x1e')](_0x5bfe60)['send'](_0xb27c67);};}exports[_0xaea8('0x2f')]=function(_0x2fc6a6,_0x4f9862){var _0xee232e={},_0x3cc091={},_0x145514={'count':0x0,'rows':[]};var _0xebfc10=_[_0xaea8('0x30')](db[_0xaea8('0x31')][_0xaea8('0x32')],function(_0x72b0e1){return{'name':_0x72b0e1['fieldName'],'type':_0x72b0e1[_0xaea8('0x33')]['key']};});_0x3cc091[_0xaea8('0x34')]=_[_0xaea8('0x30')](_0xebfc10,_0xaea8('0x2e'));_0x3cc091[_0xaea8('0x35')]=_['keys'](_0x2fc6a6[_0xaea8('0x35')]);_0x3cc091[_0xaea8('0x36')]=_[_0xaea8('0x37')](_0x3cc091[_0xaea8('0x34')],_0x3cc091[_0xaea8('0x35')]);_0xee232e[_0xaea8('0x38')]=_[_0xaea8('0x37')](_0x3cc091[_0xaea8('0x34')],qs[_0xaea8('0x39')](_0x2fc6a6['query'][_0xaea8('0x39')]));_0xee232e['attributes']=_0xee232e[_0xaea8('0x38')]['length']?_0xee232e[_0xaea8('0x38')]:_0x3cc091[_0xaea8('0x34')];if(!_0x2fc6a6[_0xaea8('0x35')][_0xaea8('0x3a')](_0xaea8('0x3b'))){_0xee232e['limit']=qs['limit'](_0x2fc6a6['query']['limit']);_0xee232e['offset']=qs['offset'](_0x2fc6a6[_0xaea8('0x35')]['offset']);}_0xee232e[_0xaea8('0x3c')]=qs[_0xaea8('0x3d')](_0x2fc6a6[_0xaea8('0x35')]['sort']);_0xee232e[_0xaea8('0x3e')]=qs['filters'](_[_0xaea8('0x3f')](_0x2fc6a6[_0xaea8('0x35')],_0x3cc091['filters']),_0xebfc10);if(_0x2fc6a6[_0xaea8('0x35')][_0xaea8('0x40')]){_0xee232e['where']=_[_0xaea8('0x41')](_0xee232e['where'],{'$or':_['map'](_0xebfc10,function(_0x141149){if(_0x141149[_0xaea8('0x33')]!=='VIRTUAL'){var _0x12cf9b={};_0x12cf9b[_0x141149[_0xaea8('0x2e')]]={'$like':'%'+_0x2fc6a6['query']['filter']+'%'};return _0x12cf9b;}})});}_0xee232e=_[_0xaea8('0x41')]({},_0xee232e,_0x2fc6a6['options']);var _0x5e1244={'where':_0xee232e['where']};return db[_0xaea8('0x31')][_0xaea8('0x42')](_0x5e1244)[_0xaea8('0x29')](function(_0x33b7ff){_0x145514[_0xaea8('0x42')]=_0x33b7ff;if(_0x2fc6a6['query']['includeAll']){_0xee232e['include']=[{'all':!![]}];}return db[_0xaea8('0x31')][_0xaea8('0x43')](_0xee232e);})['then'](function(_0x36bcb4){_0x145514['rows']=_0x36bcb4;return _0x145514;})[_0xaea8('0x29')](respondWithFilteredResult(_0x4f9862,_0xee232e))[_0xaea8('0x44')](handleError(_0x4f9862,null));};exports[_0xaea8('0x45')]=function(_0x50d459,_0x50cb7c){var _0x508841={'raw':!![],'where':{'id':_0x50d459[_0xaea8('0x46')]['id']}},_0x2336ee={};_0x2336ee[_0xaea8('0x34')]=_['keys'](db[_0xaea8('0x31')]['rawAttributes']);_0x2336ee[_0xaea8('0x35')]=_[_0xaea8('0x47')](_0x50d459[_0xaea8('0x35')]);_0x2336ee[_0xaea8('0x36')]=_[_0xaea8('0x37')](_0x2336ee[_0xaea8('0x34')],_0x2336ee[_0xaea8('0x35')]);_0x508841[_0xaea8('0x38')]=_[_0xaea8('0x37')](_0x2336ee[_0xaea8('0x34')],qs['fields'](_0x50d459['query'][_0xaea8('0x39')]));_0x508841['attributes']=_0x508841['attributes']['length']?_0x508841[_0xaea8('0x38')]:_0x2336ee[_0xaea8('0x34')];if(_0x50d459['query']['includeAll']){_0x508841['include']=[{'all':!![]}];}_0x508841=_[_0xaea8('0x41')]({},_0x508841,_0x50d459[_0xaea8('0x48')]);return db[_0xaea8('0x31')][_0xaea8('0x49')](_0x508841)[_0xaea8('0x29')](handleEntityNotFound(_0x50cb7c,null))[_0xaea8('0x29')](respondWithResult(_0x50cb7c,null))[_0xaea8('0x44')](handleError(_0x50cb7c,null));};exports[_0xaea8('0x4a')]=function(_0x9d91e,_0x220e2e){return db[_0xaea8('0x31')][_0xaea8('0x4a')](_0x9d91e['body'],{})[_0xaea8('0x29')](function(_0xaea685){var _0x3793fa=_0x9d91e['user'][_0xaea8('0x2a')]({'plain':!![]});if(!_0x3793fa)throw new Error(_0xaea8('0x4b'));if(_0x3793fa[_0xaea8('0x4c')]===_0xaea8('0x4d')){var _0x22bd38=_0xaea685['get']({'plain':!![]});var _0x38c75e=_0xaea8('0x4e');return db[_0xaea8('0x4f')]['find']({'where':{'name':_0x38c75e,'userProfileId':_0x3793fa['userProfileId']},'raw':!![]})['then'](function(_0x49a2fd){if(_0x49a2fd&&_0x49a2fd['autoAssociation']===0x0){return db[_0xaea8('0x2b')][_0xaea8('0x4a')]({'name':_0x22bd38[_0xaea8('0x2e')],'resourceId':_0x22bd38['id'],'type':_0x49a2fd[_0xaea8('0x2e')],'sectionId':_0x49a2fd['id']},{})['then'](function(){return _0xaea685;});}else{return _0xaea685;}})['catch'](function(_0x135733){logger[_0xaea8('0x2c')](_0xaea8('0x50'),_0x135733);throw _0x135733;});}return _0xaea685;})[_0xaea8('0x29')](respondWithResult(_0x220e2e,0xc9))[_0xaea8('0x44')](handleError(_0x220e2e,null));};exports['update']=function(_0x1a2657,_0x291609){if(_0x1a2657[_0xaea8('0x51')]['id']){delete _0x1a2657[_0xaea8('0x51')]['id'];}return db[_0xaea8('0x31')][_0xaea8('0x49')]({'where':{'id':_0x1a2657[_0xaea8('0x46')]['id']}})[_0xaea8('0x29')](handleEntityNotFound(_0x291609,null))[_0xaea8('0x29')](saveUpdates(_0x1a2657[_0xaea8('0x51')],null))[_0xaea8('0x29')](respondWithResult(_0x291609,null))['catch'](handleError(_0x291609,null));};exports[_0xaea8('0x28')]=function(_0xdc723b,_0x33f03d){return db[_0xaea8('0x31')][_0xaea8('0x49')]({'where':{'id':_0xdc723b['params']['id']}})[_0xaea8('0x29')](handleEntityNotFound(_0x33f03d,null))[_0xaea8('0x29')](removeEntity(_0x33f03d,null))[_0xaea8('0x44')](handleError(_0x33f03d,null));};exports[_0xaea8('0x52')]=function(_0x32a084,_0x4884cb){return db[_0xaea8('0x31')][_0xaea8('0x52')]()[_0xaea8('0x29')](respondWithResult(_0x4884cb,null))[_0xaea8('0x44')](handleError(_0x4884cb,null));};exports['getMembers']=function(_0x4bb1c7,_0x168fd9,_0x5a35de){var _0x10495f={'raw':!![],'where':{}},_0x173bd2={},_0x345b5e;return db['WhatsappQueue'][_0xaea8('0x53')]({'where':{'id':_0x4bb1c7[_0xaea8('0x46')]['id']}})[_0xaea8('0x29')](handleEntityNotFound(_0x168fd9,null))[_0xaea8('0x29')](function(_0x5eb3cc){if(_0x5eb3cc){_0x345b5e=_0x5eb3cc[_0xaea8('0x2a')]({'plain':!![]});_0x173bd2['model']=_[_0xaea8('0x47')](db[_0xaea8('0x54')][_0xaea8('0x32')]);_0x173bd2[_0xaea8('0x35')]=_[_0xaea8('0x47')](_0x4bb1c7[_0xaea8('0x35')]);_0x173bd2['filters']=_[_0xaea8('0x37')](_0x173bd2[_0xaea8('0x34')],_0x173bd2['query']);_0x10495f['attributes']=_[_0xaea8('0x37')](_0x173bd2[_0xaea8('0x34')],qs[_0xaea8('0x39')](_0x4bb1c7[_0xaea8('0x35')][_0xaea8('0x39')]));_0x10495f[_0xaea8('0x38')]=_0x10495f[_0xaea8('0x38')][_0xaea8('0x55')]?_0x10495f[_0xaea8('0x38')]:_0x173bd2[_0xaea8('0x34')];if(!_0x4bb1c7[_0xaea8('0x35')]['hasOwnProperty'](_0xaea8('0x3b'))){_0x10495f[_0xaea8('0x23')]=qs[_0xaea8('0x23')](_0x4bb1c7[_0xaea8('0x35')][_0xaea8('0x23')]);_0x10495f['offset']=qs[_0xaea8('0x21')](_0x4bb1c7[_0xaea8('0x35')][_0xaea8('0x21')]);}_0x10495f[_0xaea8('0x3c')]=qs[_0xaea8('0x3d')](_0x4bb1c7[_0xaea8('0x35')]['sort']);_0x10495f[_0xaea8('0x3e')]=qs[_0xaea8('0x36')](_['pick'](_0x4bb1c7[_0xaea8('0x35')],_0x173bd2[_0xaea8('0x36')]));_0x10495f[_0xaea8('0x3e')]['WhatsappQueueId']=_0x5eb3cc['id'];if(_0x4bb1c7[_0xaea8('0x35')][_0xaea8('0x40')]){_0x10495f[_0xaea8('0x3e')]=_[_0xaea8('0x41')](_0x10495f[_0xaea8('0x3e')],{'$or':_['map'](_0x10495f[_0xaea8('0x38')],function(_0x44c02b){var _0x586ede={};_0x586ede[_0x44c02b]={'$like':'%'+_0x4bb1c7[_0xaea8('0x35')]['filter']+'%'};return _0x586ede;})});}_0x10495f=_['merge']({},_0x10495f,_0x4bb1c7['options']);return db[_0xaea8('0x54')]['findAll'](_0x10495f);}})['then'](function(_0x145b4e){if(_0x145b4e){return db[_0xaea8('0x56')][_0xaea8('0x57')]({'where':{'id':_[_0xaea8('0x30')](_0x145b4e,'UserId'),'role':_0xaea8('0x58')},'attributes':['id',_0xaea8('0x2e'),_0xaea8('0x59'),_0xaea8('0x5a'),_0xaea8('0x5b')]});}})[_0xaea8('0x29')](function(_0xddde2a){if(_0xddde2a){return{'count':_0xddde2a[_0xaea8('0x42')],'rows':_[_0xaea8('0x30')](_0xddde2a[_0xaea8('0x5c')],function(_0x23d610){return{'membername':_0x23d610[_0xaea8('0x2e')],'UserId':_0x23d610['id'],'queue_name':_0x345b5e[_0xaea8('0x2e')],'WhatsappQueueId':_0x345b5e['id'],'interface':util[_0xaea8('0x5d')](_0xaea8('0x5e'),_0xaea8('0x5f'),_0x23d610[_0xaea8('0x2e')]),'penalty':0x0,'paused':_0x23d610[_0xaea8('0x59')],'createdAt':_0x23d610[_0xaea8('0x5b')],'updatedAt':_0x23d610['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x168fd9,_0x10495f))['catch'](handleError(_0x168fd9,null));};exports[_0xaea8('0x60')]=function(_0x4f210f,_0x523c1c,_0xda2465){var _0x4abdca={};var _0x815494={};var _0x40b8a1;var _0x2c6ed8;return db[_0xaea8('0x31')][_0xaea8('0x53')]({'where':{'id':_0x4f210f['params']['id']}})['then'](handleEntityNotFound(_0x523c1c,null))[_0xaea8('0x29')](function(_0x5e1c0e){if(_0x5e1c0e){_0x40b8a1=_0x5e1c0e;_0x815494['model']=_[_0xaea8('0x47')](db[_0xaea8('0x61')]['rawAttributes']);_0x815494[_0xaea8('0x35')]=_[_0xaea8('0x47')](_0x4f210f[_0xaea8('0x35')]);_0x815494[_0xaea8('0x36')]=_[_0xaea8('0x37')](_0x815494['model'],_0x815494[_0xaea8('0x35')]);_0x4abdca[_0xaea8('0x38')]=_[_0xaea8('0x37')](_0x815494[_0xaea8('0x34')],qs[_0xaea8('0x39')](_0x4f210f[_0xaea8('0x35')][_0xaea8('0x39')]));_0x4abdca[_0xaea8('0x38')]=_0x4abdca[_0xaea8('0x38')]['length']?_0x4abdca[_0xaea8('0x38')]:_0x815494[_0xaea8('0x34')];_0x4abdca[_0xaea8('0x3c')]=qs[_0xaea8('0x3d')](_0x4f210f[_0xaea8('0x35')]['sort']);_0x4abdca[_0xaea8('0x3e')]=qs[_0xaea8('0x36')](_[_0xaea8('0x3f')](_0x4f210f[_0xaea8('0x35')],_0x815494['filters']));if(_0x4f210f[_0xaea8('0x35')][_0xaea8('0x40')]){_0x4abdca[_0xaea8('0x3e')]=_[_0xaea8('0x41')](_0x4abdca[_0xaea8('0x3e')],{'$or':_[_0xaea8('0x30')](_0x4abdca['attributes'],function(_0x85ebf8){var _0x2b27bb={};_0x2b27bb[_0x85ebf8]={'$like':'%'+_0x4f210f['query'][_0xaea8('0x40')]+'%'};return _0x2b27bb;})});}_0x4abdca=_['merge']({},_0x4abdca,_0x4f210f[_0xaea8('0x48')]);return _0x40b8a1['getTeams'](_0x4abdca);}})[_0xaea8('0x29')](function(_0x1c810d){if(_0x1c810d){_0x2c6ed8=_0x1c810d['length'];if(!_0x4f210f[_0xaea8('0x35')][_0xaea8('0x3a')](_0xaea8('0x3b'))){_0x4abdca[_0xaea8('0x23')]=qs['limit'](_0x4f210f['query']['limit']);_0x4abdca[_0xaea8('0x21')]=qs[_0xaea8('0x21')](_0x4f210f[_0xaea8('0x35')]['offset']);}return _0x40b8a1[_0xaea8('0x60')](_0x4abdca);}})[_0xaea8('0x29')](function(_0x4a93a6){if(_0x4a93a6){return _0x4a93a6?{'count':_0x2c6ed8,'rows':_0x4a93a6}:null;}})[_0xaea8('0x29')](respondWithResult(_0x523c1c,null))[_0xaea8('0x44')](handleError(_0x523c1c,null));};exports['addTeams']=function(_0x2ad98f,_0x132914,_0x79ee47){var _0x2d4ad3=_0x2ad98f[_0xaea8('0x51')][_0xaea8('0x62')];return db[_0xaea8('0x61')][_0xaea8('0x43')]({'where':{'id':_0x2d4ad3},'attributes':['id'],'include':[{'model':db['User'],'as':_0xaea8('0x63'),'attributes':['id',_0xaea8('0x2e'),'online',_0xaea8('0x64'),_0xaea8('0x65')],'raw':!![]}]})['then'](function(_0x43cb54){if(_0x43cb54){var _0x51303d=_[_0xaea8('0x66')](_0x43cb54,function(_0x2b7e3b){var _0x39882e=_0x2b7e3b[_0xaea8('0x2a')]({'plain':!![]});return _0x39882e[_0xaea8('0x63')];});return db[_0xaea8('0x31')][_0xaea8('0x49')]({'where':{'id':_0x2ad98f[_0xaea8('0x46')]['id']}})[_0xaea8('0x29')](function(_0x176ea8){return db[_0xaea8('0x67')]['transaction'](function(_0x295158){return _0x176ea8[_0xaea8('0x68')](_0x2d4ad3,{'transaction':_0x295158})[_0xaea8('0x29')](function(){return BPromise[_0xaea8('0x69')](_0x51303d,function(_0x3908d5){return db[_0xaea8('0x54')][_0xaea8('0x6a')]({'where':{'UserId':_0x3908d5['id'],'WhatsappQueueId':_0x2ad98f[_0xaea8('0x46')]['id']},'transaction':_0x295158});});})[_0xaea8('0x29')](function(){_0x51303d[_0xaea8('0x6b')](function(_0x554e31){socket[_0xaea8('0x6c')](_0xaea8('0x6d'),{'UserId':_0x554e31['id'],'WhatsappQueueId':_0x176ea8['id']});});});});});}})[_0xaea8('0x29')](respondWithStatusCode(_0x132914,null))['catch'](handleError(_0x132914,null));};exports[_0xaea8('0x6e')]=function(_0x2edf15,_0x3c0d40,_0x411c67){return db[_0xaea8('0x61')][_0xaea8('0x43')]({'where':{'id':_0x2edf15[_0xaea8('0x35')][_0xaea8('0x62')]},'attributes':['id'],'include':[{'model':db[_0xaea8('0x56')],'as':_0xaea8('0x63'),'attributes':['id'],'raw':!![]}]})[_0xaea8('0x29')](handleEntityNotFound(_0x3c0d40,null))[_0xaea8('0x29')](function(_0x11e4ec){var _0x2099d9=_[_0xaea8('0x30')](_0x11e4ec,'id');var _0x3d8ba6=[];var _0x98a59e=[];var _0x3458b6=squel[_0xaea8('0x6f')]();_0x3458b6['field'](_0xaea8('0x70'))[_0xaea8('0x71')](_0xaea8('0x72'),'tq')[_0xaea8('0x73')](_0xaea8('0x74'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xaea8('0x3e')](_0xaea8('0x75'),_0x2edf15[_0xaea8('0x46')]['id']);for(var _0x21d395=0x0;_0x21d395<_0x11e4ec['length'];_0x21d395+=0x1){let _0x534ceb=_0x11e4ec[_0x21d395];for(var _0x401665=0x0;_0x401665<_0x534ceb[_0xaea8('0x63')][_0xaea8('0x55')];_0x401665+=0x1){let _0x2183d1=_0x534ceb[_0xaea8('0x63')][_0x401665];var _0x314545=_0x3458b6['clone']();_0x314545[_0xaea8('0x3e')](_0xaea8('0x76'),_0x2183d1['id']);_0x98a59e[_0xaea8('0x77')](db['sequelize']['query'](_0x314545[_0xaea8('0x78')](),{'type':db['sequelize'][_0xaea8('0x79')][_0xaea8('0x7a')]})[_0xaea8('0x29')](function(_0x2c7171){if(_0x2c7171[_0xaea8('0x55')]===0x1){return _0x2183d1['id'];}else{var _0x404b99=_[_0xaea8('0x7b')](_['map'](_0x2c7171,_0xaea8('0x7c')),function(_0x3cfda3){return _[_0xaea8('0x7d')](_0x2099d9,_0x3cfda3);});if(_0x404b99){return _0x2183d1['id'];}}}));}}return BPromise[_0xaea8('0x7e')](_0x98a59e)[_0xaea8('0x29')](function(_0x49d4fa){_0x3d8ba6=_(_0x3d8ba6)[_0xaea8('0x7f')](_0x49d4fa)[_0xaea8('0x80')]()[_0xaea8('0x81')]();return db[_0xaea8('0x31')][_0xaea8('0x49')]({'where':{'id':_0x2edf15[_0xaea8('0x46')]['id']}})['then'](function(_0x1bba32){return db['sequelize'][_0xaea8('0x82')](function(_0x26977f){return _0x1bba32[_0xaea8('0x6e')](_0x2edf15[_0xaea8('0x35')]['ids'],{'transaction':_0x26977f})['then'](function(){if(!_[_0xaea8('0x83')](_0x3d8ba6)){return _0x1bba32[_0xaea8('0x84')](_0x3d8ba6,{'transaction':_0x26977f});}})['then'](function(){_0x3d8ba6[_0xaea8('0x6b')](function(_0x57c5dc){socket[_0xaea8('0x6c')](_0xaea8('0x85'),{'UserId':_0x57c5dc,'WhatsappQueueId':_0x1bba32['id']});});});});});});})[_0xaea8('0x29')](respondWithStatusCode(_0x3c0d40,null))[_0xaea8('0x44')](handleError(_0x3c0d40,null));};exports['addAgents']=function(_0x1993e1,_0x428b1d,_0x2f030e){return db['WhatsappQueue'][_0xaea8('0x49')]({'where':{'id':_0x1993e1[_0xaea8('0x46')]['id']}})[_0xaea8('0x29')](handleEntityNotFound(_0x428b1d,null))[_0xaea8('0x29')](function(_0x9f8a82){if(_0x9f8a82){return _0x9f8a82[_0xaea8('0x86')](_0x1993e1[_0xaea8('0x51')][_0xaea8('0x62')],_[_0xaea8('0x87')](_0x1993e1['body'],['ids','id'])||{})[_0xaea8('0x88')](function(_0x23ea8f){for(var _0x321276=0x0;_0x321276<_0x1993e1['body'][_0xaea8('0x62')][_0xaea8('0x55')];_0x321276+=0x1){socket[_0xaea8('0x6c')]('userWhatsappQueue:save',{'UserId':Number(_0x1993e1[_0xaea8('0x51')][_0xaea8('0x62')][_0x321276]),'WhatsappQueueId':Number(_0x1993e1[_0xaea8('0x46')]['id'])});}return _0x23ea8f;});}})[_0xaea8('0x29')](respondWithResult(_0x428b1d,null))['catch'](handleError(_0x428b1d,null));};exports[_0xaea8('0x84')]=function(_0x4d97ca,_0x23298f,_0x1981ff){return db[_0xaea8('0x31')][_0xaea8('0x49')]({'where':{'id':_0x4d97ca[_0xaea8('0x46')]['id']}})[_0xaea8('0x29')](handleEntityNotFound(_0x23298f,null))['then'](function(_0x539566){if(_0x539566){return _0x539566[_0xaea8('0x84')](_0x4d97ca[_0xaea8('0x35')][_0xaea8('0x62')])['then'](function(){if(_[_0xaea8('0x89')](_0x4d97ca[_0xaea8('0x35')][_0xaea8('0x62')])){for(var _0x4f02bf=0x0;_0x4f02bf<_0x4d97ca[_0xaea8('0x35')][_0xaea8('0x62')][_0xaea8('0x55')];_0x4f02bf+=0x1){socket[_0xaea8('0x6c')](_0xaea8('0x85'),{'UserId':Number(_0x4d97ca[_0xaea8('0x35')][_0xaea8('0x62')][_0x4f02bf]),'WhatsappQueueId':Number(_0x4d97ca[_0xaea8('0x46')]['id'])});}}else{socket[_0xaea8('0x6c')](_0xaea8('0x85'),{'UserId':Number(_0x4d97ca['query'][_0xaea8('0x62')]),'WhatsappQueueId':Number(_0x4d97ca[_0xaea8('0x46')]['id'])});}});}})[_0xaea8('0x29')](respondWithStatusCode(_0x23298f,null))[_0xaea8('0x44')](handleError(_0x23298f,null));};exports['getAgents']=function(_0x2e6f86,_0x22c89f,_0xa29d0b){var _0x1049a3={};var _0x23dda6={};var _0x535092;var _0x56ce8e;return db[_0xaea8('0x31')][_0xaea8('0x53')]({'where':{'id':_0x2e6f86['params']['id']}})[_0xaea8('0x29')](handleEntityNotFound(_0x22c89f,null))[_0xaea8('0x29')](function(_0x394712){if(_0x394712){_0x535092=_0x394712;_0x23dda6[_0xaea8('0x34')]=_[_0xaea8('0x47')](db['User'][_0xaea8('0x32')]);_0x23dda6[_0xaea8('0x35')]=_[_0xaea8('0x47')](_0x2e6f86['query']);_0x23dda6[_0xaea8('0x36')]=_[_0xaea8('0x37')](_0x23dda6[_0xaea8('0x34')],_0x23dda6[_0xaea8('0x35')]);_0x1049a3[_0xaea8('0x38')]=_[_0xaea8('0x37')](_0x23dda6[_0xaea8('0x34')],qs['fields'](_0x2e6f86['query'][_0xaea8('0x39')]));_0x1049a3[_0xaea8('0x38')]=_0x1049a3[_0xaea8('0x38')][_0xaea8('0x55')]?_0x1049a3[_0xaea8('0x38')]:_0x23dda6['model'];_0x1049a3[_0xaea8('0x3c')]=qs[_0xaea8('0x3d')](_0x2e6f86['query'][_0xaea8('0x3d')]);_0x1049a3[_0xaea8('0x3e')]=qs['filters'](_[_0xaea8('0x3f')](_0x2e6f86[_0xaea8('0x35')],_0x23dda6['filters']));if(_0x2e6f86[_0xaea8('0x35')]['filter']){_0x1049a3[_0xaea8('0x3e')]=_['merge'](_0x1049a3[_0xaea8('0x3e')],{'$or':_[_0xaea8('0x30')](_0x1049a3[_0xaea8('0x38')],function(_0x54916f){var _0xad4ef2={};_0xad4ef2[_0x54916f]={'$like':'%'+_0x2e6f86[_0xaea8('0x35')][_0xaea8('0x40')]+'%'};return _0xad4ef2;})});}_0x1049a3=_[_0xaea8('0x41')]({},_0x1049a3,_0x2e6f86[_0xaea8('0x48')]);return _0x535092[_0xaea8('0x8a')](_0x1049a3);}})[_0xaea8('0x29')](function(_0x1b082a){if(_0x1b082a){_0x56ce8e=_0x1b082a[_0xaea8('0x55')];if(!_0x2e6f86[_0xaea8('0x35')]['hasOwnProperty'](_0xaea8('0x3b'))){_0x1049a3[_0xaea8('0x23')]=qs[_0xaea8('0x23')](_0x2e6f86[_0xaea8('0x35')]['limit']);_0x1049a3[_0xaea8('0x21')]=qs['offset'](_0x2e6f86[_0xaea8('0x35')][_0xaea8('0x21')]);}return _0x535092['getAgents'](_0x1049a3);}})['then'](function(_0x593eb6){if(_0x593eb6){return _0x593eb6?{'count':_0x56ce8e,'rows':_0x593eb6}:null;}})[_0xaea8('0x29')](respondWithResult(_0x22c89f,null))[_0xaea8('0x44')](handleError(_0x22c89f,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 6ef7bd1..19230e0 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 _0x0005=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x4250b4,_0x3fd543){var _0x8a4807=function(_0x147c84){while(--_0x147c84){_0x4250b4['push'](_0x4250b4['shift']());}};_0x8a4807(++_0x3fd543);}(_0x0005,0xd2));var _0x5000=function(_0x3b82e2,_0xf20b3f){_0x3b82e2=_0x3b82e2-0x0;var _0x26021d=_0x0005[_0x3b82e2];return _0x26021d;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x5000('0x0'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x5000('0x1')](0x0);var events={'afterCreate':_0x5000('0x2'),'afterUpdate':_0x5000('0x3'),'afterDestroy':_0x5000('0x4')};function emitEvent(_0x323fab){return function(_0x4a8650,_0x58ac39,_0x1e294e){WhatsappQueueEvents[_0x5000('0x5')](_0x323fab+':'+_0x4a8650['id'],_0x4a8650);WhatsappQueueEvents[_0x5000('0x5')](_0x323fab,_0x4a8650);_0x1e294e(null);};}for(var e in events){if(events[_0x5000('0x6')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0x481c=['exports','WhatsappQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x481c,0x13c));var _0xc481=function(_0x166185,_0xc2a42f){_0x166185=_0x166185-0x0;var _0x2e9801=_0x481c[_0x166185];return _0x2e9801;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require('../../mysqldb')['db'][_0xc481('0x0')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xc481('0x1')](0x0);var events={'afterCreate':_0xc481('0x2'),'afterUpdate':_0xc481('0x3'),'afterDestroy':_0xc481('0x4')};function emitEvent(_0x24ab9e){return function(_0x5f507a,_0xb0b937,_0x72ec49){WhatsappQueueEvents[_0xc481('0x5')](_0x24ab9e+':'+_0x5f507a['id'],_0x5f507a);WhatsappQueueEvents['emit'](_0x24ab9e,_0x5f507a);_0x72ec49(null);};}for(var e in events){if(events[_0xc481('0x6')](e)){var event=events[e];WhatsappQueue[_0xc481('0x7')](e,emitEvent(event));}}module[_0xc481('0x8')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 2387483..253336b 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 _0x3ab5=['bluebird','request-promise','path','rimraf','exports','whatsapp_queues','lodash','util','../../config/logger','api'];(function(_0x1e4bec,_0xea2748){var _0x37a73c=function(_0x3e9728){while(--_0x3e9728){_0x1e4bec['push'](_0x1e4bec['shift']());}};_0x37a73c(++_0xea2748);}(_0x3ab5,0x114));var _0x53ab=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x3ab5[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x53ab('0x0'));var util=require(_0x53ab('0x1'));var logger=require(_0x53ab('0x2'))(_0x53ab('0x3'));var moment=require('moment');var BPromise=require(_0x53ab('0x4'));var rp=require(_0x53ab('0x5'));var fs=require('fs');var path=require(_0x53ab('0x6'));var rimraf=require(_0x53ab('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappQueue.attributes');module[_0x53ab('0x8')]=function(_0x2fbe1f,_0x1eb060){return _0x2fbe1f['define']('WhatsappQueue',attributes,{'tableName':_0x53ab('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5406=['api','bluebird','request-promise','../../config/environment','./whatsappQueue.attributes','define','WhatsappQueue','whatsapp_queues','util'];(function(_0x115c6b,_0xc1a232){var _0x4a05a5=function(_0x38c2ae){while(--_0x38c2ae){_0x115c6b['push'](_0x115c6b['shift']());}};_0x4a05a5(++_0xc1a232);}(_0x5406,0x14c));var _0x6540=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5406[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x6540('0x0'));var logger=require('../../config/logger')(_0x6540('0x1'));var moment=require('moment');var BPromise=require(_0x6540('0x2'));var rp=require(_0x6540('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6540('0x4'));var attributes=require(_0x6540('0x5'));module['exports']=function(_0x4dc258,_0x84d1c1){return _0x4dc258[_0x6540('0x6')](_0x6540('0x7'),attributes,{'tableName':_0x6540('0x8'),'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 de16ec6..846a78a 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 _0x729d=['jayson/promise','client','http','redis','defaults','localhost','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','GetWhatsappQueue','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowWhatsappQueue','WhatsappQueue','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x238671,_0x34aea0){var _0x474844=function(_0x26cab4){while(--_0x26cab4){_0x238671['push'](_0x238671['shift']());}};_0x474844(++_0x34aea0);}(_0x729d,0x148));var _0xd729=function(_0x59ae8f,_0x148344){_0x59ae8f=_0x59ae8f-0x0;var _0x3900b5=_0x729d[_0x59ae8f];return _0x3900b5;};'use strict';var _=require(_0xd729('0x0'));var util=require('util');var moment=require(_0xd729('0x1'));var BPromise=require(_0xd729('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd729('0x3'));var db=require(_0xd729('0x4'))['db'];var utils=require(_0xd729('0x5'));var logger=require('../../config/logger')(_0xd729('0x6'));var config=require(_0xd729('0x7'));var jayson=require(_0xd729('0x8'));var client=jayson[_0xd729('0x9')][_0xd729('0xa')]({'port':0x232a});config[_0xd729('0xb')]=_[_0xd729('0xc')](config['redis'],{'host':_0xd729('0xd'),'port':0x18eb});var socket=require(_0xd729('0xe'))(new Redis(config[_0xd729('0xb')]));require(_0xd729('0xf'))[_0xd729('0x10')](socket);function respondWithRpcPromise(_0x537f35,_0x41bc01,_0x4a04bb){return new BPromise(function(_0x18d477,_0x3aa05c){return client[_0xd729('0x11')](_0x537f35,_0x4a04bb)[_0xd729('0x12')](function(_0x27ed30){logger[_0xd729('0x13')](_0xd729('0x14'),_0x41bc01,_0xd729('0x15'));logger[_0xd729('0x16')](_0xd729('0x17'),_0x41bc01,_0xd729('0x15'),JSON[_0xd729('0x18')](_0x27ed30));if(_0x27ed30[_0xd729('0x19')]){if(_0x27ed30[_0xd729('0x19')]['code']===0x1f4){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x41bc01,_0x27ed30[_0xd729('0x19')][_0xd729('0x1a')]);return _0x3aa05c(_0x27ed30[_0xd729('0x19')]['message']);}logger[_0xd729('0x19')](_0xd729('0x14'),_0x41bc01,_0x27ed30[_0xd729('0x19')][_0xd729('0x1a')]);return _0x18d477(_0x27ed30['error']['message']);}else{logger[_0xd729('0x13')](_0xd729('0x14'),_0x41bc01,_0xd729('0x15'));_0x18d477(_0x27ed30[_0xd729('0x1b')][_0xd729('0x1a')]);}})['catch'](function(_0x4514e7){logger['error'](_0xd729('0x14'),_0x41bc01,_0x4514e7);_0x3aa05c(_0x4514e7);});});}exports[_0xd729('0x1c')]=function(_0x77ad80){var _0x2b8601=this;return new Promise(function(_0xaf726a,_0x166019){return db['WhatsappQueue'][_0xd729('0x1d')]({'raw':_0x77ad80[_0xd729('0x1e')]?_0x77ad80[_0xd729('0x1e')][_0xd729('0x1f')]===undefined?!![]:![]:!![],'where':_0x77ad80[_0xd729('0x1e')]?_0x77ad80[_0xd729('0x1e')][_0xd729('0x20')]||null:null,'attributes':_0x77ad80[_0xd729('0x1e')]?_0x77ad80[_0xd729('0x1e')][_0xd729('0x21')]||null:null,'limit':_0x77ad80[_0xd729('0x1e')]?_0x77ad80[_0xd729('0x1e')][_0xd729('0x22')]||null:null,'include':_0x77ad80[_0xd729('0x1e')]?_0x77ad80[_0xd729('0x1e')][_0xd729('0x23')]?_['map'](_0x77ad80['options'][_0xd729('0x23')],function(_0x3e52c9){return{'model':db[_0x3e52c9['model']],'as':_0x3e52c9['as'],'attributes':_0x3e52c9[_0xd729('0x21')],'include':_0x3e52c9[_0xd729('0x23')]?_[_0xd729('0x24')](_0x3e52c9[_0xd729('0x23')],function(_0x1f4865){return{'model':db[_0x1f4865[_0xd729('0x25')]],'as':_0x1f4865['as'],'attributes':_0x1f4865[_0xd729('0x21')],'include':_0x1f4865[_0xd729('0x23')]?_['map'](_0x1f4865[_0xd729('0x23')],function(_0x299eae){return{'model':db[_0x299eae[_0xd729('0x25')]],'as':_0x299eae['as'],'attributes':_0x299eae[_0xd729('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x15d15b){logger['info'](_0xd729('0x1c'),_0x77ad80);logger[_0xd729('0x16')]('GetWhatsappQueue',_0x77ad80,JSON[_0xd729('0x18')](_0x15d15b));_0xaf726a(_0x15d15b);})[_0xd729('0x26')](function(_0x275055){logger[_0xd729('0x19')](_0xd729('0x1c'),_0x275055[_0xd729('0x1a')],_0x77ad80);_0x166019(_0x2b8601[_0xd729('0x19')](0x1f4,_0x275055[_0xd729('0x1a')]));});});};exports[_0xd729('0x27')]=function(_0x303b9c){var _0x4e3fd8=this;return new Promise(function(_0x2ef7f7,_0x4f492e){return db[_0xd729('0x28')][_0xd729('0x29')]({'raw':_0x303b9c[_0xd729('0x1e')]?_0x303b9c[_0xd729('0x1e')][_0xd729('0x1f')]===undefined?!![]:![]:!![],'where':_0x303b9c[_0xd729('0x1e')]?_0x303b9c['options']['where']||null:null,'attributes':_0x303b9c[_0xd729('0x1e')]?_0x303b9c[_0xd729('0x1e')][_0xd729('0x21')]||null:null,'include':_0x303b9c[_0xd729('0x1e')]?_0x303b9c[_0xd729('0x1e')][_0xd729('0x23')]?_[_0xd729('0x24')](_0x303b9c[_0xd729('0x1e')]['include'],function(_0x40c2f4){return{'model':db[_0x40c2f4[_0xd729('0x25')]],'as':_0x40c2f4['as'],'attributes':_0x40c2f4[_0xd729('0x21')],'include':_0x40c2f4[_0xd729('0x23')]?_[_0xd729('0x24')](_0x40c2f4[_0xd729('0x23')],function(_0x3cda91){return{'model':db[_0x3cda91[_0xd729('0x25')]],'as':_0x3cda91['as'],'attributes':_0x3cda91[_0xd729('0x21')],'include':_0x3cda91['include']?_[_0xd729('0x24')](_0x3cda91['include'],function(_0x254b8a){return{'model':db[_0x254b8a[_0xd729('0x25')]],'as':_0x254b8a['as'],'attributes':_0x254b8a[_0xd729('0x21')]};}):[]};}):[]};}):[]:[]})[_0xd729('0x12')](function(_0x5cce66){logger[_0xd729('0x13')](_0xd729('0x27'),_0x303b9c);logger[_0xd729('0x16')](_0xd729('0x27'),_0x303b9c,JSON[_0xd729('0x18')](_0x5cce66));_0x2ef7f7(_0x5cce66);})['catch'](function(_0x513def){logger[_0xd729('0x19')]('ShowWhatsappQueue',_0x513def[_0xd729('0x1a')],_0x303b9c);_0x4f492e(_0x4e3fd8[_0xd729('0x19')](0x1f4,_0x513def['message']));});});}; \ No newline at end of file +var _0x3db5=['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','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','options','raw','where','attributes','limit','include','map','model','find','ShowWhatsappQueue','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x188fbc,_0x35b4d3){var _0x3cad38=function(_0x38470b){while(--_0x38470b){_0x188fbc['push'](_0x188fbc['shift']());}};_0x3cad38(++_0x35b4d3);}(_0x3db5,0x139));var _0x53db=function(_0x1f62c3,_0x1ff95b){_0x1f62c3=_0x1f62c3-0x0;var _0x385c1c=_0x3db5[_0x1f62c3];return _0x385c1c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x53db('0x0'));var rs=require(_0x53db('0x1'));var fs=require('fs');var Redis=require(_0x53db('0x2'));var db=require(_0x53db('0x3'))['db'];var utils=require(_0x53db('0x4'));var logger=require('../../config/logger')(_0x53db('0x5'));var config=require(_0x53db('0x6'));var jayson=require(_0x53db('0x7'));var client=jayson[_0x53db('0x8')][_0x53db('0x9')]({'port':0x232a});config[_0x53db('0xa')]=_[_0x53db('0xb')](config[_0x53db('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x53db('0xc'))(new Redis(config[_0x53db('0xa')]));require(_0x53db('0xd'))[_0x53db('0xe')](socket);function respondWithRpcPromise(_0x28c52b,_0x519df9,_0x538262){return new BPromise(function(_0x5f1090,_0x50db77){return client[_0x53db('0xf')](_0x28c52b,_0x538262)[_0x53db('0x10')](function(_0x59d847){logger[_0x53db('0x11')](_0x53db('0x12'),_0x519df9,_0x53db('0x13'));logger[_0x53db('0x14')](_0x53db('0x15'),_0x519df9,_0x53db('0x13'),JSON[_0x53db('0x16')](_0x59d847));if(_0x59d847[_0x53db('0x17')]){if(_0x59d847['error'][_0x53db('0x18')]===0x1f4){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x519df9,_0x59d847[_0x53db('0x17')][_0x53db('0x19')]);return _0x50db77(_0x59d847[_0x53db('0x17')][_0x53db('0x19')]);}logger[_0x53db('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x519df9,_0x59d847[_0x53db('0x17')]['message']);return _0x5f1090(_0x59d847['error']['message']);}else{logger[_0x53db('0x11')]('WhatsappQueue,\x20%s,\x20%s',_0x519df9,_0x53db('0x13'));_0x5f1090(_0x59d847[_0x53db('0x1a')][_0x53db('0x19')]);}})[_0x53db('0x1b')](function(_0x121797){logger[_0x53db('0x17')](_0x53db('0x12'),_0x519df9,_0x121797);_0x50db77(_0x121797);});});}exports[_0x53db('0x1c')]=function(_0x20f361){var _0x16c9cd=this;return new Promise(function(_0x215af3,_0x2c6a4e){return db[_0x53db('0x1d')]['findAll']({'raw':_0x20f361['options']?_0x20f361[_0x53db('0x1e')][_0x53db('0x1f')]===undefined?!![]:![]:!![],'where':_0x20f361[_0x53db('0x1e')]?_0x20f361[_0x53db('0x1e')][_0x53db('0x20')]||null:null,'attributes':_0x20f361[_0x53db('0x1e')]?_0x20f361[_0x53db('0x1e')][_0x53db('0x21')]||null:null,'limit':_0x20f361[_0x53db('0x1e')]?_0x20f361[_0x53db('0x1e')][_0x53db('0x22')]||null:null,'include':_0x20f361[_0x53db('0x1e')]?_0x20f361['options'][_0x53db('0x23')]?_[_0x53db('0x24')](_0x20f361[_0x53db('0x1e')][_0x53db('0x23')],function(_0x37a0a6){return{'model':db[_0x37a0a6['model']],'as':_0x37a0a6['as'],'attributes':_0x37a0a6['attributes'],'include':_0x37a0a6[_0x53db('0x23')]?_['map'](_0x37a0a6[_0x53db('0x23')],function(_0x12c47f){return{'model':db[_0x12c47f[_0x53db('0x25')]],'as':_0x12c47f['as'],'attributes':_0x12c47f[_0x53db('0x21')],'include':_0x12c47f[_0x53db('0x23')]?_[_0x53db('0x24')](_0x12c47f[_0x53db('0x23')],function(_0x3d1069){return{'model':db[_0x3d1069[_0x53db('0x25')]],'as':_0x3d1069['as'],'attributes':_0x3d1069[_0x53db('0x21')]};}):[]};}):[]};}):[]:[]})[_0x53db('0x10')](function(_0x4e46c4){logger[_0x53db('0x11')](_0x53db('0x1c'),_0x20f361);logger[_0x53db('0x14')](_0x53db('0x1c'),_0x20f361,JSON[_0x53db('0x16')](_0x4e46c4));_0x215af3(_0x4e46c4);})['catch'](function(_0x31f2b5){logger[_0x53db('0x17')]('GetWhatsappQueue',_0x31f2b5[_0x53db('0x19')],_0x20f361);_0x2c6a4e(_0x16c9cd[_0x53db('0x17')](0x1f4,_0x31f2b5[_0x53db('0x19')]));});});};exports['ShowWhatsappQueue']=function(_0x56a7a4){var _0x4dacca=this;return new Promise(function(_0x1680ed,_0xc065a9){return db[_0x53db('0x1d')][_0x53db('0x26')]({'raw':_0x56a7a4[_0x53db('0x1e')]?_0x56a7a4[_0x53db('0x1e')][_0x53db('0x1f')]===undefined?!![]:![]:!![],'where':_0x56a7a4[_0x53db('0x1e')]?_0x56a7a4[_0x53db('0x1e')][_0x53db('0x20')]||null:null,'attributes':_0x56a7a4[_0x53db('0x1e')]?_0x56a7a4[_0x53db('0x1e')][_0x53db('0x21')]||null:null,'include':_0x56a7a4[_0x53db('0x1e')]?_0x56a7a4[_0x53db('0x1e')]['include']?_[_0x53db('0x24')](_0x56a7a4['options'][_0x53db('0x23')],function(_0x203b64){return{'model':db[_0x203b64['model']],'as':_0x203b64['as'],'attributes':_0x203b64[_0x53db('0x21')],'include':_0x203b64[_0x53db('0x23')]?_[_0x53db('0x24')](_0x203b64[_0x53db('0x23')],function(_0x5ec97c){return{'model':db[_0x5ec97c[_0x53db('0x25')]],'as':_0x5ec97c['as'],'attributes':_0x5ec97c[_0x53db('0x21')],'include':_0x5ec97c['include']?_[_0x53db('0x24')](_0x5ec97c[_0x53db('0x23')],function(_0x19d888){return{'model':db[_0x19d888[_0x53db('0x25')]],'as':_0x19d888['as'],'attributes':_0x19d888[_0x53db('0x21')]};}):[]};}):[]};}):[]:[]})[_0x53db('0x10')](function(_0x2e41ff){logger[_0x53db('0x11')](_0x53db('0x27'),_0x56a7a4);logger[_0x53db('0x14')](_0x53db('0x27'),_0x56a7a4,JSON[_0x53db('0x16')](_0x2e41ff));_0x1680ed(_0x2e41ff);})['catch'](function(_0x17324e){logger[_0x53db('0x17')](_0x53db('0x27'),_0x17324e[_0x53db('0x19')],_0x56a7a4);_0xc065a9(_0x4dacca[_0x53db('0x17')](0x1f4,_0x17324e[_0x53db('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 43d5589..3ab2285 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 _0xc2ee=['./whatsappQueue.events','remove','update','emit','removeListener','register'];(function(_0x507c81,_0x3e1b56){var _0x368a25=function(_0x1e7519){while(--_0x1e7519){_0x507c81['push'](_0x507c81['shift']());}};_0x368a25(++_0x3e1b56);}(_0xc2ee,0x19e));var _0xec2e=function(_0x4e5481,_0x322281){_0x4e5481=_0x4e5481-0x0;var _0x3b5db7=_0xc2ee[_0x4e5481];return _0x3b5db7;};'use strict';var WhatsappQueueEvents=require(_0xec2e('0x0'));var events=['save',_0xec2e('0x1'),_0xec2e('0x2')];function createListener(_0x407501,_0xeb578f){return function(_0x16abc2){_0xeb578f[_0xec2e('0x3')](_0x407501,_0x16abc2);};}function removeListener(_0x1b470f,_0x5c1322){return function(){WhatsappQueueEvents[_0xec2e('0x4')](_0x1b470f,_0x5c1322);};}exports[_0xec2e('0x5')]=function(_0x155777){for(var _0x540565=0x0,_0x104708=events['length'];_0x540565<_0x104708;_0x540565++){var _0x4e83bb=events[_0x540565];var _0x29e2c7=createListener('whatsappQueue:'+_0x4e83bb,_0x155777);WhatsappQueueEvents['on'](_0x4e83bb,_0x29e2c7);}}; \ No newline at end of file +var _0xc036=['save','remove','emit','removeListener','register','whatsappQueue:'];(function(_0x34f9a6,_0x4bf60b){var _0x5a94a2=function(_0x12e12a){while(--_0x12e12a){_0x34f9a6['push'](_0x34f9a6['shift']());}};_0x5a94a2(++_0x4bf60b);}(_0xc036,0x126));var _0x6c03=function(_0x1c80e9,_0x3b7f77){_0x1c80e9=_0x1c80e9-0x0;var _0x509563=_0xc036[_0x1c80e9];return _0x509563;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x6c03('0x0'),_0x6c03('0x1'),'update'];function createListener(_0x577962,_0x11081d){return function(_0x4add20){_0x11081d[_0x6c03('0x2')](_0x577962,_0x4add20);};}function removeListener(_0x4c65f6,_0x1c94cb){return function(){WhatsappQueueEvents[_0x6c03('0x3')](_0x4c65f6,_0x1c94cb);};}exports[_0x6c03('0x4')]=function(_0x2cb626){for(var _0x2fbee0=0x0,_0xff4316=events['length'];_0x2fbee0<_0xff4316;_0x2fbee0++){var _0x2106ab=events[_0x2fbee0];var _0x4ef6e7=createListener(_0x6c03('0x5')+_0x2106ab,_0x2cb626);WhatsappQueueEvents['on'](_0x2106ab,_0x4ef6e7);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 2e1eb60..634e632 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 _0x3276=['describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0x1dd8df,_0x2d37e8){var _0x22f4e7=function(_0xfef0cf){while(--_0xfef0cf){_0x1dd8df['push'](_0x1dd8df['shift']());}};_0x22f4e7(++_0x2d37e8);}(_0x3276,0xc7));var _0x6327=function(_0x43e94f,_0x1501bc){_0x43e94f=_0x43e94f-0x0;var _0x25ae56=_0x3276[_0x43e94f];return _0x25ae56;};'use strict';var multer=require(_0x6327('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6327('0x1'));var express=require(_0x6327('0x2'));var router=express[_0x6327('0x3')]();var fs_extra=require(_0x6327('0x4'));var auth=require(_0x6327('0x5'));var interaction=require(_0x6327('0x6'));var config=require(_0x6327('0x7'));var controller=require('./whatsappQueueReport.controller');router['get']('/',auth[_0x6327('0x8')](),controller[_0x6327('0x9')]);router[_0x6327('0xa')]('/describe',auth[_0x6327('0x8')](),controller[_0x6327('0xb')]);router[_0x6327('0xa')](_0x6327('0xc'),auth['isAuthenticated'](),controller[_0x6327('0xd')]);router[_0x6327('0xe')]('/',auth['isAuthenticated'](),controller[_0x6327('0xf')]);router[_0x6327('0x10')]('/:id',auth[_0x6327('0x8')](),controller[_0x6327('0x11')]);router[_0x6327('0x12')]('/:id',auth[_0x6327('0x8')](),controller[_0x6327('0x13')]);module[_0x6327('0x14')]=router; \ No newline at end of file +var _0xff0d=['../../components/auth/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','describe','/:id','show','post','put','update','delete','destroy','exports','express','Router','fs-extra'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0xff0d,0xda));var _0xdff0=function(_0x48e1ec,_0x35f468){_0x48e1ec=_0x48e1ec-0x0;var _0x3b33eb=_0xff0d[_0x48e1ec];return _0x3b33eb;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdff0('0x0'));var router=express[_0xdff0('0x1')]();var fs_extra=require(_0xdff0('0x2'));var auth=require(_0xdff0('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xdff0('0x4'));var controller=require(_0xdff0('0x5'));router[_0xdff0('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdff0('0x6')]('/describe',auth[_0xdff0('0x7')](),controller[_0xdff0('0x8')]);router[_0xdff0('0x6')](_0xdff0('0x9'),auth[_0xdff0('0x7')](),controller[_0xdff0('0xa')]);router[_0xdff0('0xb')]('/',auth[_0xdff0('0x7')](),controller['create']);router[_0xdff0('0xc')](_0xdff0('0x9'),auth[_0xdff0('0x7')](),controller[_0xdff0('0xd')]);router[_0xdff0('0xe')](_0xdff0('0x9'),auth['isAuthenticated'](),controller[_0xdff0('0xf')]);module[_0xdff0('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 2a43baf..de98ba6 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(_0x45024a,_0x1224dd){var _0x5ca6ca=function(_0x5eb0ca){while(--_0x5eb0ca){_0x45024a['push'](_0x45024a['shift']());}};_0x5ca6ca(++_0x1224dd);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x5ec2bf,_0x24b812){var _0x28e7eb=function(_0x19f3be){while(--_0x19f3be){_0x5ec2bf['push'](_0x5ec2bf['shift']());}};_0x28e7eb(++_0x24b812);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 509e57f..be95677 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 _0xa5fa=['offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','index','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','options','WhatsappQueueReport','includeAll','rows','catch','show','params','fields','include','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x475b66,_0x5a4207){var _0x202962=function(_0xc4be9f){while(--_0xc4be9f){_0x475b66['push'](_0x475b66['shift']());}};_0x202962(++_0x5a4207);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x367fa2,_0x1722da){_0x367fa2=_0x367fa2-0x0;var _0x3c9bd4=_0xa5fa[_0x367fa2];return _0x3c9bd4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaa5f('0x0'));var zipdir=require(_0xaa5f('0x1'));var jsonpatch=require(_0xaa5f('0x2'));var rp=require(_0xaa5f('0x3'));var moment=require('moment');var BPromise=require(_0xaa5f('0x4'));var Mustache=require(_0xaa5f('0x5'));var util=require('util');var path=require(_0xaa5f('0x6'));var sox=require(_0xaa5f('0x7'));var csv=require(_0xaa5f('0x8'));var ejs=require(_0xaa5f('0x9'));var fs=require('fs');var fs_extra=require(_0xaa5f('0xa'));var _=require(_0xaa5f('0xb'));var squel=require(_0xaa5f('0xc'));var crypto=require(_0xaa5f('0xd'));var jsforce=require(_0xaa5f('0xe'));var deskjs=require(_0xaa5f('0xf'));var toCsv=require(_0xaa5f('0x8'));var querystring=require('querystring');var Papa=require(_0xaa5f('0x10'));var Redis=require(_0xaa5f('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaa5f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaa5f('0x13'));var utils=require('../../config/utils');var config=require(_0xaa5f('0x14'));var licenseUtil=require(_0xaa5f('0x15'));var db=require(_0xaa5f('0x16'))['db'];function respondWithStatusCode(_0x9aeae9,_0x252ae0){_0x252ae0=_0x252ae0||0xcc;return function(_0x48d1d3){if(_0x48d1d3){return _0x9aeae9[_0xaa5f('0x17')](_0x252ae0);}return _0x9aeae9['status'](_0x252ae0)[_0xaa5f('0x18')]();};}function respondWithResult(_0x23f872,_0x31eabc){_0x31eabc=_0x31eabc||0xc8;return function(_0x19aa27){if(_0x19aa27){return _0x23f872[_0xaa5f('0x19')](_0x31eabc)['json'](_0x19aa27);}};}function respondWithFilteredResult(_0x4fc828,_0x1f37fb){return function(_0x291042){if(_0x291042){var _0xb0bfb6=typeof _0x1f37fb[_0xaa5f('0x1a')]===_0xaa5f('0x1b')&&typeof _0x1f37fb[_0xaa5f('0x1c')]===_0xaa5f('0x1b');var _0x28407c=_0x291042[_0xaa5f('0x1d')];var _0x3d874f=_0xb0bfb6?0x0:_0x1f37fb[_0xaa5f('0x1a')];var _0x1019e8=_0xb0bfb6?_0x291042['count']:_0x1f37fb[_0xaa5f('0x1a')]+_0x1f37fb[_0xaa5f('0x1c')];var _0x1cbab5;if(_0x1019e8>=_0x28407c){_0x1019e8=_0x28407c;_0x1cbab5=0xc8;}else{_0x1cbab5=0xce;}_0x4fc828[_0xaa5f('0x19')](_0x1cbab5);return _0x4fc828[_0xaa5f('0x1e')](_0xaa5f('0x1f'),_0x3d874f+'-'+_0x1019e8+'/'+_0x28407c)[_0xaa5f('0x20')](_0x291042);}return null;};}function patchUpdates(_0x194691){return function(_0x2d8fc3){try{jsonpatch[_0xaa5f('0x21')](_0x2d8fc3,_0x194691,!![]);}catch(_0x40c223){return BPromise[_0xaa5f('0x22')](_0x40c223);}return _0x2d8fc3[_0xaa5f('0x23')]();};}function saveUpdates(_0x5238a8,_0x1e917d){return function(_0x57082c){if(_0x57082c){return _0x57082c[_0xaa5f('0x24')](_0x5238a8)[_0xaa5f('0x25')](function(_0x561381){return _0x561381;});}return null;};}function removeEntity(_0x1baa2e,_0x1032ce){return function(_0x5b9f0b){if(_0x5b9f0b){return _0x5b9f0b[_0xaa5f('0x26')]()[_0xaa5f('0x25')](function(){_0x1baa2e[_0xaa5f('0x19')](0xcc)[_0xaa5f('0x18')]();});}};}function handleEntityNotFound(_0x1f66c0,_0xacbded){return function(_0x3d7bca){if(!_0x3d7bca){_0x1f66c0[_0xaa5f('0x17')](0x194);}return _0x3d7bca;};}function handleError(_0x51eb55,_0x2445a6){_0x2445a6=_0x2445a6||0x1f4;return function(_0x3a66e8){logger[_0xaa5f('0x27')](_0x3a66e8['stack']);if(_0x3a66e8[_0xaa5f('0x28')]){delete _0x3a66e8[_0xaa5f('0x28')];}_0x51eb55[_0xaa5f('0x19')](_0x2445a6)['send'](_0x3a66e8);};}exports[_0xaa5f('0x29')]=function(_0x479f29,_0x5990d2){var _0x27d1a4={},_0x50998f={},_0x1bffec={'count':0x0,'rows':[]};var _0x4e0ec9=_['map'](db['WhatsappQueueReport'][_0xaa5f('0x2a')],function(_0x4ddebd){return{'name':_0x4ddebd[_0xaa5f('0x2b')],'type':_0x4ddebd[_0xaa5f('0x2c')]['key']};});_0x50998f['model']=_[_0xaa5f('0x2d')](_0x4e0ec9,'name');_0x50998f[_0xaa5f('0x2e')]=_[_0xaa5f('0x2f')](_0x479f29['query']);_0x50998f[_0xaa5f('0x30')]=_[_0xaa5f('0x31')](_0x50998f[_0xaa5f('0x32')],_0x50998f['query']);_0x27d1a4[_0xaa5f('0x33')]=_[_0xaa5f('0x31')](_0x50998f['model'],qs['fields'](_0x479f29['query']['fields']));_0x27d1a4[_0xaa5f('0x33')]=_0x27d1a4[_0xaa5f('0x33')][_0xaa5f('0x34')]?_0x27d1a4[_0xaa5f('0x33')]:_0x50998f[_0xaa5f('0x32')];if(!_0x479f29[_0xaa5f('0x2e')][_0xaa5f('0x35')]('nolimit')){_0x27d1a4[_0xaa5f('0x1c')]=qs[_0xaa5f('0x1c')](_0x479f29[_0xaa5f('0x2e')][_0xaa5f('0x1c')]);_0x27d1a4[_0xaa5f('0x1a')]=qs[_0xaa5f('0x1a')](_0x479f29['query'][_0xaa5f('0x1a')]);}_0x27d1a4[_0xaa5f('0x36')]=qs[_0xaa5f('0x37')](_0x479f29[_0xaa5f('0x2e')][_0xaa5f('0x37')]);_0x27d1a4['where']=qs['filters'](_[_0xaa5f('0x38')](_0x479f29[_0xaa5f('0x2e')],_0x50998f[_0xaa5f('0x30')]),_0x4e0ec9);if(_0x479f29[_0xaa5f('0x2e')]['filter']){_0x27d1a4[_0xaa5f('0x39')]=_[_0xaa5f('0x3a')](_0x27d1a4[_0xaa5f('0x39')],{'$or':_[_0xaa5f('0x2d')](_0x4e0ec9,function(_0x37db88){if(_0x37db88[_0xaa5f('0x2c')]!==_0xaa5f('0x3b')){var _0x2c4d29={};_0x2c4d29[_0x37db88[_0xaa5f('0x28')]]={'$like':'%'+_0x479f29[_0xaa5f('0x2e')][_0xaa5f('0x3c')]+'%'};return _0x2c4d29;}})});}_0x27d1a4=_['merge']({},_0x27d1a4,_0x479f29[_0xaa5f('0x3d')]);var _0x2562ce={'where':_0x27d1a4[_0xaa5f('0x39')]};return db[_0xaa5f('0x3e')][_0xaa5f('0x1d')](_0x2562ce)[_0xaa5f('0x25')](function(_0x1fb572){_0x1bffec[_0xaa5f('0x1d')]=_0x1fb572;if(_0x479f29[_0xaa5f('0x2e')][_0xaa5f('0x3f')]){_0x27d1a4['include']=[{'all':!![]}];}return db[_0xaa5f('0x3e')]['findAll'](_0x27d1a4);})[_0xaa5f('0x25')](function(_0x21f4bc){_0x1bffec[_0xaa5f('0x40')]=_0x21f4bc;return _0x1bffec;})['then'](respondWithFilteredResult(_0x5990d2,_0x27d1a4))[_0xaa5f('0x41')](handleError(_0x5990d2,null));};exports[_0xaa5f('0x42')]=function(_0xe49f8,_0x528b08){var _0x12a8e4={'raw':!![],'where':{'id':_0xe49f8[_0xaa5f('0x43')]['id']}},_0x179be8={};_0x179be8[_0xaa5f('0x32')]=_['keys'](db[_0xaa5f('0x3e')][_0xaa5f('0x2a')]);_0x179be8[_0xaa5f('0x2e')]=_[_0xaa5f('0x2f')](_0xe49f8[_0xaa5f('0x2e')]);_0x179be8[_0xaa5f('0x30')]=_[_0xaa5f('0x31')](_0x179be8[_0xaa5f('0x32')],_0x179be8['query']);_0x12a8e4[_0xaa5f('0x33')]=_['intersection'](_0x179be8[_0xaa5f('0x32')],qs['fields'](_0xe49f8[_0xaa5f('0x2e')][_0xaa5f('0x44')]));_0x12a8e4['attributes']=_0x12a8e4[_0xaa5f('0x33')][_0xaa5f('0x34')]?_0x12a8e4[_0xaa5f('0x33')]:_0x179be8['model'];if(_0xe49f8['query']['includeAll']){_0x12a8e4[_0xaa5f('0x45')]=[{'all':!![]}];}_0x12a8e4=_['merge']({},_0x12a8e4,_0xe49f8[_0xaa5f('0x3d')]);return db[_0xaa5f('0x3e')][_0xaa5f('0x46')](_0x12a8e4)[_0xaa5f('0x25')](handleEntityNotFound(_0x528b08,null))['then'](respondWithResult(_0x528b08,null))[_0xaa5f('0x41')](handleError(_0x528b08,null));};exports[_0xaa5f('0x47')]=function(_0x3c6a17,_0x231ad1){return db[_0xaa5f('0x3e')][_0xaa5f('0x47')](_0x3c6a17[_0xaa5f('0x48')],{})[_0xaa5f('0x25')](respondWithResult(_0x231ad1,0xc9))[_0xaa5f('0x41')](handleError(_0x231ad1,null));};exports[_0xaa5f('0x24')]=function(_0x3ea553,_0x2de737){if(_0x3ea553[_0xaa5f('0x48')]['id']){delete _0x3ea553[_0xaa5f('0x48')]['id'];}return db[_0xaa5f('0x3e')][_0xaa5f('0x46')]({'where':{'id':_0x3ea553['params']['id']}})[_0xaa5f('0x25')](handleEntityNotFound(_0x2de737,null))[_0xaa5f('0x25')](saveUpdates(_0x3ea553[_0xaa5f('0x48')],null))[_0xaa5f('0x25')](respondWithResult(_0x2de737,null))[_0xaa5f('0x41')](handleError(_0x2de737,null));};exports[_0xaa5f('0x26')]=function(_0x32bbed,_0x4aa556){return db[_0xaa5f('0x3e')][_0xaa5f('0x46')]({'where':{'id':_0x32bbed[_0xaa5f('0x43')]['id']}})[_0xaa5f('0x25')](handleEntityNotFound(_0x4aa556,null))['then'](removeEntity(_0x4aa556,null))[_0xaa5f('0x41')](handleError(_0x4aa556,null));};exports[_0xaa5f('0x49')]=function(_0x36c4aa,_0x575803){return db['WhatsappQueueReport']['describe']()['then'](respondWithResult(_0x575803,null))['catch'](handleError(_0x575803,null));}; \ No newline at end of file +var _0x34b7=['WhatsappQueueReport','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','show','params','includeAll','include','find','catch','create','body','update','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','index','map'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x34b7,0x196));var _0x734b=function(_0x9f3e89,_0x39b12c){_0x9f3e89=_0x9f3e89-0x0;var _0x12d365=_0x34b7[_0x9f3e89];return _0x12d365;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x734b('0x0'));var jsonpatch=require(_0x734b('0x1'));var rp=require(_0x734b('0x2'));var moment=require(_0x734b('0x3'));var BPromise=require(_0x734b('0x4'));var Mustache=require(_0x734b('0x5'));var util=require('util');var path=require('path');var sox=require(_0x734b('0x6'));var csv=require(_0x734b('0x7'));var ejs=require(_0x734b('0x8'));var fs=require('fs');var fs_extra=require(_0x734b('0x9'));var _=require(_0x734b('0xa'));var squel=require(_0x734b('0xb'));var crypto=require('crypto');var jsforce=require(_0x734b('0xc'));var deskjs=require(_0x734b('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x734b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x734b('0xf'));var as=require(_0x734b('0x10'));var hardwareService=require(_0x734b('0x11'));var logger=require(_0x734b('0x12'))(_0x734b('0x13'));var utils=require(_0x734b('0x14'));var config=require(_0x734b('0x15'));var licenseUtil=require(_0x734b('0x16'));var db=require(_0x734b('0x17'))['db'];function respondWithStatusCode(_0x1e0fca,_0x189a82){_0x189a82=_0x189a82||0xcc;return function(_0xff9ddf){if(_0xff9ddf){return _0x1e0fca[_0x734b('0x18')](_0x189a82);}return _0x1e0fca[_0x734b('0x19')](_0x189a82)['end']();};}function respondWithResult(_0x18fc18,_0x252510){_0x252510=_0x252510||0xc8;return function(_0x47791c){if(_0x47791c){return _0x18fc18[_0x734b('0x19')](_0x252510)[_0x734b('0x1a')](_0x47791c);}};}function respondWithFilteredResult(_0x2e00ad,_0x2372bd){return function(_0x2c03bd){if(_0x2c03bd){var _0xa6d111=typeof _0x2372bd[_0x734b('0x1b')]===_0x734b('0x1c')&&typeof _0x2372bd['limit']===_0x734b('0x1c');var _0x2ee290=_0x2c03bd[_0x734b('0x1d')];var _0x5edbe9=_0xa6d111?0x0:_0x2372bd['offset'];var _0x56a95c=_0xa6d111?_0x2c03bd[_0x734b('0x1d')]:_0x2372bd[_0x734b('0x1b')]+_0x2372bd[_0x734b('0x1e')];var _0x41ba87;if(_0x56a95c>=_0x2ee290){_0x56a95c=_0x2ee290;_0x41ba87=0xc8;}else{_0x41ba87=0xce;}_0x2e00ad[_0x734b('0x19')](_0x41ba87);return _0x2e00ad[_0x734b('0x1f')](_0x734b('0x20'),_0x5edbe9+'-'+_0x56a95c+'/'+_0x2ee290)[_0x734b('0x1a')](_0x2c03bd);}return null;};}function patchUpdates(_0x67eed){return function(_0x1d2b27){try{jsonpatch[_0x734b('0x21')](_0x1d2b27,_0x67eed,!![]);}catch(_0x3d0ffd){return BPromise[_0x734b('0x22')](_0x3d0ffd);}return _0x1d2b27[_0x734b('0x23')]();};}function saveUpdates(_0x56f807,_0x1e4dcc){return function(_0x7856d7){if(_0x7856d7){return _0x7856d7['update'](_0x56f807)[_0x734b('0x24')](function(_0x1f81de){return _0x1f81de;});}return null;};}function removeEntity(_0x1a7908,_0x11fb8e){return function(_0x46d432){if(_0x46d432){return _0x46d432[_0x734b('0x25')]()[_0x734b('0x24')](function(){_0x1a7908[_0x734b('0x19')](0xcc)[_0x734b('0x26')]();});}};}function handleEntityNotFound(_0x3abbe6,_0x44ffa9){return function(_0x148abe){if(!_0x148abe){_0x3abbe6[_0x734b('0x18')](0x194);}return _0x148abe;};}function handleError(_0x566d55,_0x49732b){_0x49732b=_0x49732b||0x1f4;return function(_0x13cc5a){logger[_0x734b('0x27')](_0x13cc5a['stack']);if(_0x13cc5a[_0x734b('0x28')]){delete _0x13cc5a[_0x734b('0x28')];}_0x566d55[_0x734b('0x19')](_0x49732b)[_0x734b('0x29')](_0x13cc5a);};}exports[_0x734b('0x2a')]=function(_0x1b8295,_0x3ba39c){var _0x5c6c5d={},_0x1f3652={},_0x436efe={'count':0x0,'rows':[]};var _0x42e9ae=_[_0x734b('0x2b')](db[_0x734b('0x2c')][_0x734b('0x2d')],function(_0x1fed72){return{'name':_0x1fed72[_0x734b('0x2e')],'type':_0x1fed72[_0x734b('0x2f')][_0x734b('0x30')]};});_0x1f3652['model']=_[_0x734b('0x2b')](_0x42e9ae,_0x734b('0x28'));_0x1f3652['query']=_[_0x734b('0x31')](_0x1b8295[_0x734b('0x32')]);_0x1f3652[_0x734b('0x33')]=_[_0x734b('0x34')](_0x1f3652[_0x734b('0x35')],_0x1f3652[_0x734b('0x32')]);_0x5c6c5d[_0x734b('0x36')]=_[_0x734b('0x34')](_0x1f3652[_0x734b('0x35')],qs[_0x734b('0x37')](_0x1b8295[_0x734b('0x32')][_0x734b('0x37')]));_0x5c6c5d[_0x734b('0x36')]=_0x5c6c5d[_0x734b('0x36')][_0x734b('0x38')]?_0x5c6c5d['attributes']:_0x1f3652[_0x734b('0x35')];if(!_0x1b8295['query'][_0x734b('0x39')](_0x734b('0x3a'))){_0x5c6c5d[_0x734b('0x1e')]=qs[_0x734b('0x1e')](_0x1b8295[_0x734b('0x32')][_0x734b('0x1e')]);_0x5c6c5d['offset']=qs['offset'](_0x1b8295[_0x734b('0x32')]['offset']);}_0x5c6c5d[_0x734b('0x3b')]=qs['sort'](_0x1b8295[_0x734b('0x32')]['sort']);_0x5c6c5d[_0x734b('0x3c')]=qs['filters'](_[_0x734b('0x3d')](_0x1b8295[_0x734b('0x32')],_0x1f3652[_0x734b('0x33')]),_0x42e9ae);if(_0x1b8295[_0x734b('0x32')][_0x734b('0x3e')]){_0x5c6c5d[_0x734b('0x3c')]=_[_0x734b('0x3f')](_0x5c6c5d['where'],{'$or':_[_0x734b('0x2b')](_0x42e9ae,function(_0x317d32){if(_0x317d32['type']!==_0x734b('0x40')){var _0x309b31={};_0x309b31[_0x317d32[_0x734b('0x28')]]={'$like':'%'+_0x1b8295[_0x734b('0x32')]['filter']+'%'};return _0x309b31;}})});}_0x5c6c5d=_[_0x734b('0x3f')]({},_0x5c6c5d,_0x1b8295[_0x734b('0x41')]);var _0x4efb1f={'where':_0x5c6c5d[_0x734b('0x3c')]};return db[_0x734b('0x2c')]['count'](_0x4efb1f)[_0x734b('0x24')](function(_0x2d8f31){_0x436efe[_0x734b('0x1d')]=_0x2d8f31;if(_0x1b8295[_0x734b('0x32')]['includeAll']){_0x5c6c5d['include']=[{'all':!![]}];}return db[_0x734b('0x2c')]['findAll'](_0x5c6c5d);})['then'](function(_0x121a00){_0x436efe['rows']=_0x121a00;return _0x436efe;})[_0x734b('0x24')](respondWithFilteredResult(_0x3ba39c,_0x5c6c5d))['catch'](handleError(_0x3ba39c,null));};exports[_0x734b('0x42')]=function(_0x337106,_0xe4fe38){var _0x4c3fdc={'raw':!![],'where':{'id':_0x337106[_0x734b('0x43')]['id']}},_0x5cf3a0={};_0x5cf3a0['model']=_['keys'](db[_0x734b('0x2c')][_0x734b('0x2d')]);_0x5cf3a0['query']=_[_0x734b('0x31')](_0x337106['query']);_0x5cf3a0[_0x734b('0x33')]=_[_0x734b('0x34')](_0x5cf3a0[_0x734b('0x35')],_0x5cf3a0['query']);_0x4c3fdc[_0x734b('0x36')]=_[_0x734b('0x34')](_0x5cf3a0[_0x734b('0x35')],qs[_0x734b('0x37')](_0x337106['query']['fields']));_0x4c3fdc['attributes']=_0x4c3fdc[_0x734b('0x36')]['length']?_0x4c3fdc['attributes']:_0x5cf3a0[_0x734b('0x35')];if(_0x337106['query'][_0x734b('0x44')]){_0x4c3fdc[_0x734b('0x45')]=[{'all':!![]}];}_0x4c3fdc=_[_0x734b('0x3f')]({},_0x4c3fdc,_0x337106[_0x734b('0x41')]);return db['WhatsappQueueReport'][_0x734b('0x46')](_0x4c3fdc)['then'](handleEntityNotFound(_0xe4fe38,null))[_0x734b('0x24')](respondWithResult(_0xe4fe38,null))[_0x734b('0x47')](handleError(_0xe4fe38,null));};exports[_0x734b('0x48')]=function(_0x5cdacb,_0x370326){return db['WhatsappQueueReport'][_0x734b('0x48')](_0x5cdacb[_0x734b('0x49')],{})['then'](respondWithResult(_0x370326,0xc9))[_0x734b('0x47')](handleError(_0x370326,null));};exports[_0x734b('0x4a')]=function(_0x145ced,_0x38125a){if(_0x145ced[_0x734b('0x49')]['id']){delete _0x145ced['body']['id'];}return db[_0x734b('0x2c')]['find']({'where':{'id':_0x145ced[_0x734b('0x43')]['id']}})['then'](handleEntityNotFound(_0x38125a,null))[_0x734b('0x24')](saveUpdates(_0x145ced[_0x734b('0x49')],null))[_0x734b('0x24')](respondWithResult(_0x38125a,null))[_0x734b('0x47')](handleError(_0x38125a,null));};exports[_0x734b('0x25')]=function(_0x4b70f2,_0x4c0378){return db['WhatsappQueueReport'][_0x734b('0x46')]({'where':{'id':_0x4b70f2[_0x734b('0x43')]['id']}})['then'](handleEntityNotFound(_0x4c0378,null))[_0x734b('0x24')](removeEntity(_0x4c0378,null))[_0x734b('0x47')](handleError(_0x4c0378,null));};exports['describe']=function(_0x167173,_0x3a9749){return db[_0x734b('0x2c')]['describe']()[_0x734b('0x24')](respondWithResult(_0x3a9749,null))[_0x734b('0x47')](handleError(_0x3a9749,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index cb9ea89..f7c2496 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 _0x1761=['../../config/environment','exports','define','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment','rimraf'];(function(_0x2b5e66,_0x4efc74){var _0xbd69a8=function(_0x20c4f4){while(--_0x20c4f4){_0x2b5e66['push'](_0x2b5e66['shift']());}};_0xbd69a8(++_0x4efc74);}(_0x1761,0x17b));var _0x1176=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x1761[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x1176('0x0'));var util=require(_0x1176('0x1'));var logger=require(_0x1176('0x2'))(_0x1176('0x3'));var moment=require(_0x1176('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1176('0x5'));var config=require(_0x1176('0x6'));var attributes=require('./whatsappQueueReport.attributes');module[_0x1176('0x7')]=function(_0x456547,_0x5cef9){return _0x456547[_0x1176('0x8')]('WhatsappQueueReport',attributes,{'tableName':_0x1176('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1176('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf720=['rimraf','../../config/environment','./whatsappQueueReport.attributes','define','WhatsappQueueReport','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf720,0x10a));var _0x0f72=function(_0x497c0c,_0x41ce4e){_0x497c0c=_0x497c0c-0x0;var _0x1c7c5f=_0xf720[_0x497c0c];return _0x1c7c5f;};'use strict';var _=require('lodash');var util=require(_0x0f72('0x0'));var logger=require(_0x0f72('0x1'))(_0x0f72('0x2'));var moment=require(_0x0f72('0x3'));var BPromise=require(_0x0f72('0x4'));var rp=require(_0x0f72('0x5'));var fs=require('fs');var path=require(_0x0f72('0x6'));var rimraf=require(_0x0f72('0x7'));var config=require(_0x0f72('0x8'));var attributes=require(_0x0f72('0x9'));module['exports']=function(_0x5412da,_0x14ef6f){return _0x5412da[_0x0f72('0xa')](_0x0f72('0xb'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x0f72('0xc'),'fields':[_0x0f72('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 8b7a0f2..0e9feb9 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 _0x4d96=['stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','options','raw','UpdateWhatsappQueueReport','update','attributes','info','lodash','util','moment','bluebird','randomstring','../../config/logger','jayson/promise','client','then','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x1715c8,_0x240d7c){var _0x3c4974=function(_0x5b716f){while(--_0x5b716f){_0x1715c8['push'](_0x1715c8['shift']());}};_0x3c4974(++_0x240d7c);}(_0x4d96,0x1da));var _0x64d9=function(_0x12c35f,_0x28469e){_0x12c35f=_0x12c35f-0x0;var _0x6696d9=_0x4d96[_0x12c35f];return _0x6696d9;};'use strict';var _=require(_0x64d9('0x0'));var util=require(_0x64d9('0x1'));var moment=require(_0x64d9('0x2'));var BPromise=require(_0x64d9('0x3'));var rs=require(_0x64d9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x64d9('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x64d9('0x6'));var client=jayson[_0x64d9('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3fa65f,_0x4b0efe,_0xd98c82){return new BPromise(function(_0x5a3574,_0x337059){return client['request'](_0x3fa65f,_0xd98c82)[_0x64d9('0x8')](function(_0x116ed9){logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x4b0efe,_0x64d9('0x9'));logger[_0x64d9('0xa')](_0x64d9('0xb'),_0x4b0efe,_0x64d9('0x9'),JSON[_0x64d9('0xc')](_0x116ed9));if(_0x116ed9['error']){if(_0x116ed9[_0x64d9('0xd')][_0x64d9('0xe')]===0x1f4){logger[_0x64d9('0xd')](_0x64d9('0xf'),_0x4b0efe,_0x116ed9[_0x64d9('0xd')][_0x64d9('0x10')]);return _0x337059(_0x116ed9['error']['message']);}logger[_0x64d9('0xd')](_0x64d9('0xf'),_0x4b0efe,_0x116ed9[_0x64d9('0xd')][_0x64d9('0x10')]);return _0x5a3574(_0x116ed9[_0x64d9('0xd')]['message']);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x4b0efe,'request\x20sent');_0x5a3574(_0x116ed9[_0x64d9('0x11')][_0x64d9('0x10')]);}})[_0x64d9('0x12')](function(_0x2e71ce){logger[_0x64d9('0xd')](_0x64d9('0xf'),_0x4b0efe,_0x2e71ce);_0x337059(_0x2e71ce);});});}exports[_0x64d9('0x13')]=function(_0xb39749){var _0xc52b6d=this;return new Promise(function(_0x4d7cee,_0x4c727a){return db[_0x64d9('0x14')]['create'](_0xb39749['body'],{'raw':_0xb39749[_0x64d9('0x15')]?_0xb39749['options'][_0x64d9('0x16')]===undefined?!![]:![]:!![]})[_0x64d9('0x8')](function(_0x53d8f2){logger['info'](_0x64d9('0x13'),_0xb39749);logger[_0x64d9('0xa')]('CreateWhatsappQueueReport',_0xb39749,JSON[_0x64d9('0xc')](_0x53d8f2));_0x4d7cee(_0x53d8f2);})[_0x64d9('0x12')](function(_0x4524a6){logger[_0x64d9('0xd')](_0x64d9('0x13'),_0x4524a6[_0x64d9('0x10')],_0xb39749);_0x4c727a(_0xc52b6d['error'](0x1f4,_0x4524a6[_0x64d9('0x10')]));});});};exports[_0x64d9('0x17')]=function(_0x5ad701){var _0x41bae2=this;return new Promise(function(_0xad0a9d,_0x205659){return db[_0x64d9('0x14')][_0x64d9('0x18')](_0x5ad701['body'],{'raw':_0x5ad701[_0x64d9('0x15')]?_0x5ad701['options'][_0x64d9('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ad701[_0x64d9('0x15')]?_0x5ad701[_0x64d9('0x15')]['where']||null:null,'attributes':_0x5ad701[_0x64d9('0x15')]?_0x5ad701['options'][_0x64d9('0x19')]||null:null,'limit':_0x5ad701['options']?_0x5ad701[_0x64d9('0x15')]['limit']||null:null})[_0x64d9('0x8')](function(_0x38e5e2){logger[_0x64d9('0x1a')](_0x64d9('0x17'),_0x5ad701);logger[_0x64d9('0xa')](_0x64d9('0x17'),_0x5ad701,JSON[_0x64d9('0xc')](_0x38e5e2));_0xad0a9d(_0x38e5e2);})['catch'](function(_0x2e6415){logger[_0x64d9('0xd')](_0x64d9('0x17'),_0x2e6415['message'],_0x5ad701);_0x205659(_0x41bae2[_0x64d9('0xd')](0x1f4,_0x2e6415[_0x64d9('0x10')]));});});}; \ No newline at end of file +var _0x980b=['message','info','result','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','then','catch','UpdateWhatsappQueueReport','update','where','attributes','limit','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3f92bc,_0x482ad4){var _0xa15d20=function(_0x1381be){while(--_0x1381be){_0x3f92bc['push'](_0x3f92bc['shift']());}};_0xa15d20(++_0x482ad4);}(_0x980b,0xf7));var _0xb980=function(_0x51e7d4,_0x206da8){_0x51e7d4=_0x51e7d4-0x0;var _0x414d63=_0x980b[_0x51e7d4];return _0x414d63;};'use strict';var _=require(_0xb980('0x0'));var util=require('util');var moment=require(_0xb980('0x1'));var BPromise=require('bluebird');var rs=require(_0xb980('0x2'));var fs=require('fs');var Redis=require(_0xb980('0x3'));var db=require(_0xb980('0x4'))['db'];var utils=require(_0xb980('0x5'));var logger=require(_0xb980('0x6'))(_0xb980('0x7'));var config=require('../../config/environment');var jayson=require(_0xb980('0x8'));var client=jayson['client'][_0xb980('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xac85ba,_0x1016da,_0x375d2d){return new BPromise(function(_0x55f71e,_0x54735b){return client['request'](_0xac85ba,_0x375d2d)['then'](function(_0xe279d3){logger['info'](_0xb980('0xa'),_0x1016da,_0xb980('0xb'));logger[_0xb980('0xc')](_0xb980('0xd'),_0x1016da,_0xb980('0xb'),JSON[_0xb980('0xe')](_0xe279d3));if(_0xe279d3[_0xb980('0xf')]){if(_0xe279d3['error'][_0xb980('0x10')]===0x1f4){logger[_0xb980('0xf')](_0xb980('0xa'),_0x1016da,_0xe279d3['error'][_0xb980('0x11')]);return _0x54735b(_0xe279d3[_0xb980('0xf')]['message']);}logger[_0xb980('0xf')](_0xb980('0xa'),_0x1016da,_0xe279d3[_0xb980('0xf')][_0xb980('0x11')]);return _0x55f71e(_0xe279d3[_0xb980('0xf')][_0xb980('0x11')]);}else{logger[_0xb980('0x12')](_0xb980('0xa'),_0x1016da,'request\x20sent');_0x55f71e(_0xe279d3[_0xb980('0x13')][_0xb980('0x11')]);}})['catch'](function(_0x5d5322){logger[_0xb980('0xf')](_0xb980('0xa'),_0x1016da,_0x5d5322);_0x54735b(_0x5d5322);});});}exports[_0xb980('0x14')]=function(_0xf510f0){var _0x59cd71=this;return new Promise(function(_0x2b470a,_0x4e600f){return db[_0xb980('0x15')][_0xb980('0x16')](_0xf510f0[_0xb980('0x17')],{'raw':_0xf510f0['options']?_0xf510f0[_0xb980('0x18')][_0xb980('0x19')]===undefined?!![]:![]:!![]})[_0xb980('0x1a')](function(_0xdceb8e){logger[_0xb980('0x12')]('CreateWhatsappQueueReport',_0xf510f0);logger[_0xb980('0xc')](_0xb980('0x14'),_0xf510f0,JSON['stringify'](_0xdceb8e));_0x2b470a(_0xdceb8e);})[_0xb980('0x1b')](function(_0x39ce35){logger[_0xb980('0xf')]('CreateWhatsappQueueReport',_0x39ce35[_0xb980('0x11')],_0xf510f0);_0x4e600f(_0x59cd71[_0xb980('0xf')](0x1f4,_0x39ce35[_0xb980('0x11')]));});});};exports[_0xb980('0x1c')]=function(_0x5a7a10){var _0x4d792f=this;return new Promise(function(_0x3eb686,_0x4623f0){return db[_0xb980('0x15')][_0xb980('0x1d')](_0x5a7a10['body'],{'raw':_0x5a7a10[_0xb980('0x18')]?_0x5a7a10[_0xb980('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a7a10[_0xb980('0x18')]?_0x5a7a10['options'][_0xb980('0x1e')]||null:null,'attributes':_0x5a7a10['options']?_0x5a7a10[_0xb980('0x18')][_0xb980('0x1f')]||null:null,'limit':_0x5a7a10[_0xb980('0x18')]?_0x5a7a10[_0xb980('0x18')][_0xb980('0x20')]||null:null})['then'](function(_0x4afbb2){logger[_0xb980('0x12')]('UpdateWhatsappQueueReport',_0x5a7a10);logger[_0xb980('0xc')](_0xb980('0x1c'),_0x5a7a10,JSON[_0xb980('0xe')](_0x4afbb2));_0x3eb686(_0x4afbb2);})[_0xb980('0x1b')](function(_0x10ef9b){logger[_0xb980('0xf')](_0xb980('0x1c'),_0x10ef9b[_0xb980('0x11')],_0x5a7a10);_0x4623f0(_0x4d792f[_0xb980('0xf')](0x1f4,_0x10ef9b['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 94b05df..18f7064 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 _0x15f2=['isAuthenticated','index','/describe','/:id','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0xbb7885,_0x30c84f){var _0xfdd112=function(_0x2feb7d){while(--_0x2feb7d){_0xbb7885['push'](_0xbb7885['shift']());}};_0xfdd112(++_0x30c84f);}(_0x15f2,0xaa));var _0x215f=function(_0x2f9849,_0x209c0e){_0x2f9849=_0x2f9849-0x0;var _0x1aefac=_0x15f2[_0x2f9849];return _0x1aefac;};'use strict';var multer=require(_0x215f('0x0'));var util=require('util');var path=require(_0x215f('0x1'));var timeout=require(_0x215f('0x2'));var express=require(_0x215f('0x3'));var router=express[_0x215f('0x4')]();var fs_extra=require(_0x215f('0x5'));var auth=require(_0x215f('0x6'));var interaction=require(_0x215f('0x7'));var config=require(_0x215f('0x8'));var controller=require('./whatsappTransferReport.controller');router[_0x215f('0x9')]('/',auth[_0x215f('0xa')](),controller[_0x215f('0xb')]);router[_0x215f('0x9')](_0x215f('0xc'),auth[_0x215f('0xa')](),controller['describe']);router[_0x215f('0x9')](_0x215f('0xd'),auth[_0x215f('0xa')](),controller['show']);router[_0x215f('0xe')]('/',auth[_0x215f('0xa')](),controller[_0x215f('0xf')]);router[_0x215f('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x215f('0x11')]('/:id',auth[_0x215f('0xa')](),controller[_0x215f('0x12')]);module[_0x215f('0x13')]=router; \ No newline at end of file +var _0x69c9=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','create','put','update','delete','destroy','exports','util'];(function(_0x8d1a79,_0x5e22a8){var _0x217f27=function(_0x15aedb){while(--_0x15aedb){_0x8d1a79['push'](_0x8d1a79['shift']());}};_0x217f27(++_0x5e22a8);}(_0x69c9,0x1cb));var _0x969c=function(_0x5d23d6,_0x4c6974){_0x5d23d6=_0x5d23d6-0x0;var _0x19e969=_0x69c9[_0x5d23d6];return _0x19e969;};'use strict';var multer=require('multer');var util=require(_0x969c('0x0'));var path=require(_0x969c('0x1'));var timeout=require(_0x969c('0x2'));var express=require(_0x969c('0x3'));var router=express['Router']();var fs_extra=require(_0x969c('0x4'));var auth=require(_0x969c('0x5'));var interaction=require(_0x969c('0x6'));var config=require('../../config/environment');var controller=require(_0x969c('0x7'));router[_0x969c('0x8')]('/',auth[_0x969c('0x9')](),controller[_0x969c('0xa')]);router[_0x969c('0x8')]('/describe',auth[_0x969c('0x9')](),controller[_0x969c('0xb')]);router[_0x969c('0x8')](_0x969c('0xc'),auth[_0x969c('0x9')](),controller[_0x969c('0xd')]);router['post']('/',auth[_0x969c('0x9')](),controller[_0x969c('0xe')]);router[_0x969c('0xf')](_0x969c('0xc'),auth['isAuthenticated'](),controller[_0x969c('0x10')]);router[_0x969c('0x11')](_0x969c('0xc'),auth[_0x969c('0x9')](),controller[_0x969c('0x12')]);module[_0x969c('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 389ad33..ca65584 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 _0x6836=['STRING','account','queue','sequelize','exports'];(function(_0x2ab5d7,_0x1243d9){var _0x516388=function(_0x412cd1){while(--_0x412cd1){_0x2ab5d7['push'](_0x2ab5d7['shift']());}};_0x516388(++_0x1243d9);}(_0x6836,0x1c0));var _0x6683=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x6836[_0x45d3f0];return _0x314b79;};'use strict';var Sequelize=require(_0x6683('0x0'));module[_0x6683('0x1')]={'uniqueid':{'type':Sequelize[_0x6683('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x6683('0x3'),'agent',_0x6683('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xd5c8=['account','agent','queue','DATE','STRING','ENUM'];(function(_0x194865,_0x540468){var _0x228789=function(_0x534e5a){while(--_0x534e5a){_0x194865['push'](_0x194865['shift']());}};_0x228789(++_0x540468);}(_0xd5c8,0x166));var _0x8d5c=function(_0x4817f9,_0x4070d1){_0x4817f9=_0x4817f9-0x0;var _0x2dcfa6=_0xd5c8[_0x4817f9];return _0x2dcfa6;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x8d5c('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x8d5c('0x1')](_0x8d5c('0x2'),_0x8d5c('0x3'),_0x8d5c('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x8d5c('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 8ee6a16..c8f0dfb 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 _0x4012=['../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','json','apply','save','update','then','sendStatus','error','stack','name','send','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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/utils'];(function(_0xbc5ccd,_0x3c5b4f){var _0x6f93d3=function(_0x83275f){while(--_0x83275f){_0xbc5ccd['push'](_0xbc5ccd['shift']());}};_0x6f93d3(++_0x3c5b4f);}(_0x4012,0x1bf));var _0x2401=function(_0x3dbc72,_0x4c9a7b){_0x3dbc72=_0x3dbc72-0x0;var _0xb6a492=_0x4012[_0x3dbc72];return _0xb6a492;};'use strict';var emlformat=require(_0x2401('0x0'));var rimraf=require(_0x2401('0x1'));var zipdir=require(_0x2401('0x2'));var jsonpatch=require(_0x2401('0x3'));var rp=require(_0x2401('0x4'));var moment=require('moment');var BPromise=require(_0x2401('0x5'));var Mustache=require(_0x2401('0x6'));var util=require(_0x2401('0x7'));var path=require(_0x2401('0x8'));var sox=require(_0x2401('0x9'));var csv=require(_0x2401('0xa'));var ejs=require(_0x2401('0xb'));var fs=require('fs');var fs_extra=require(_0x2401('0xc'));var _=require(_0x2401('0xd'));var squel=require(_0x2401('0xe'));var crypto=require(_0x2401('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x2401('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2401('0x11'));var Papa=require(_0x2401('0x12'));var Redis=require(_0x2401('0x13'));var authService=require(_0x2401('0x14'));var qs=require(_0x2401('0x15'));var as=require(_0x2401('0x16'));var hardwareService=require(_0x2401('0x17'));var logger=require(_0x2401('0x18'))(_0x2401('0x19'));var utils=require(_0x2401('0x1a'));var config=require(_0x2401('0x1b'));var licenseUtil=require(_0x2401('0x1c'));var db=require(_0x2401('0x1d'))['db'];function respondWithStatusCode(_0x1b677f,_0x5ea894){_0x5ea894=_0x5ea894||0xcc;return function(_0x41cf0d){if(_0x41cf0d){return _0x1b677f['sendStatus'](_0x5ea894);}return _0x1b677f[_0x2401('0x1e')](_0x5ea894)[_0x2401('0x1f')]();};}function respondWithResult(_0x4e9bc4,_0xde3736){_0xde3736=_0xde3736||0xc8;return function(_0x3f54e4){if(_0x3f54e4){return _0x4e9bc4['status'](_0xde3736)['json'](_0x3f54e4);}};}function respondWithFilteredResult(_0x10daf8,_0x5eac05){return function(_0x49525e){if(_0x49525e){var _0x2abb8c=typeof _0x5eac05[_0x2401('0x20')]===_0x2401('0x21')&&typeof _0x5eac05[_0x2401('0x22')]===_0x2401('0x21');var _0x2c66c=_0x49525e[_0x2401('0x23')];var _0x4ca827=_0x2abb8c?0x0:_0x5eac05[_0x2401('0x20')];var _0x3e6103=_0x2abb8c?_0x49525e['count']:_0x5eac05['offset']+_0x5eac05['limit'];var _0x4d1fd1;if(_0x3e6103>=_0x2c66c){_0x3e6103=_0x2c66c;_0x4d1fd1=0xc8;}else{_0x4d1fd1=0xce;}_0x10daf8['status'](_0x4d1fd1);return _0x10daf8[_0x2401('0x24')]('Content-Range',_0x4ca827+'-'+_0x3e6103+'/'+_0x2c66c)[_0x2401('0x25')](_0x49525e);}return null;};}function patchUpdates(_0x58dbd6){return function(_0x13b6f4){try{jsonpatch[_0x2401('0x26')](_0x13b6f4,_0x58dbd6,!![]);}catch(_0xbbfcbd){return BPromise['reject'](_0xbbfcbd);}return _0x13b6f4[_0x2401('0x27')]();};}function saveUpdates(_0x2d4847,_0x4313dd){return function(_0x46a4ce){if(_0x46a4ce){return _0x46a4ce[_0x2401('0x28')](_0x2d4847)[_0x2401('0x29')](function(_0x2ff84c){return _0x2ff84c;});}return null;};}function removeEntity(_0x4d7ace,_0x10045d){return function(_0x38d527){if(_0x38d527){return _0x38d527['destroy']()[_0x2401('0x29')](function(){_0x4d7ace[_0x2401('0x1e')](0xcc)[_0x2401('0x1f')]();});}};}function handleEntityNotFound(_0x1111c3,_0x402749){return function(_0x3426e7){if(!_0x3426e7){_0x1111c3[_0x2401('0x2a')](0x194);}return _0x3426e7;};}function handleError(_0x4c45cc,_0x5505a4){_0x5505a4=_0x5505a4||0x1f4;return function(_0x24a660){logger[_0x2401('0x2b')](_0x24a660[_0x2401('0x2c')]);if(_0x24a660['name']){delete _0x24a660[_0x2401('0x2d')];}_0x4c45cc[_0x2401('0x1e')](_0x5505a4)[_0x2401('0x2e')](_0x24a660);};}exports['index']=function(_0x2ac5c2,_0x263051){var _0x292a78={},_0x3fad1b={},_0x19302a={'count':0x0,'rows':[]};var _0x2fefab=_['map'](db[_0x2401('0x2f')][_0x2401('0x30')],function(_0x2869de){return{'name':_0x2869de[_0x2401('0x31')],'type':_0x2869de[_0x2401('0x32')][_0x2401('0x33')]};});_0x3fad1b[_0x2401('0x34')]=_['map'](_0x2fefab,_0x2401('0x2d'));_0x3fad1b[_0x2401('0x35')]=_[_0x2401('0x36')](_0x2ac5c2[_0x2401('0x35')]);_0x3fad1b[_0x2401('0x37')]=_[_0x2401('0x38')](_0x3fad1b[_0x2401('0x34')],_0x3fad1b[_0x2401('0x35')]);_0x292a78['attributes']=_[_0x2401('0x38')](_0x3fad1b[_0x2401('0x34')],qs[_0x2401('0x39')](_0x2ac5c2[_0x2401('0x35')][_0x2401('0x39')]));_0x292a78[_0x2401('0x3a')]=_0x292a78[_0x2401('0x3a')]['length']?_0x292a78['attributes']:_0x3fad1b[_0x2401('0x34')];if(!_0x2ac5c2[_0x2401('0x35')][_0x2401('0x3b')]('nolimit')){_0x292a78[_0x2401('0x22')]=qs[_0x2401('0x22')](_0x2ac5c2[_0x2401('0x35')][_0x2401('0x22')]);_0x292a78[_0x2401('0x20')]=qs[_0x2401('0x20')](_0x2ac5c2[_0x2401('0x35')]['offset']);}_0x292a78['order']=qs['sort'](_0x2ac5c2['query'][_0x2401('0x3c')]);_0x292a78[_0x2401('0x3d')]=qs[_0x2401('0x37')](_[_0x2401('0x3e')](_0x2ac5c2[_0x2401('0x35')],_0x3fad1b[_0x2401('0x37')]),_0x2fefab);if(_0x2ac5c2[_0x2401('0x35')][_0x2401('0x3f')]){_0x292a78['where']=_[_0x2401('0x40')](_0x292a78['where'],{'$or':_[_0x2401('0x41')](_0x2fefab,function(_0x4bbf1a){if(_0x4bbf1a['type']!==_0x2401('0x42')){var _0xf8619a={};_0xf8619a[_0x4bbf1a[_0x2401('0x2d')]]={'$like':'%'+_0x2ac5c2[_0x2401('0x35')][_0x2401('0x3f')]+'%'};return _0xf8619a;}})});}_0x292a78=_[_0x2401('0x40')]({},_0x292a78,_0x2ac5c2[_0x2401('0x43')]);var _0x20e3ea={'where':_0x292a78[_0x2401('0x3d')]};return db[_0x2401('0x2f')]['count'](_0x20e3ea)[_0x2401('0x29')](function(_0x11d92e){_0x19302a['count']=_0x11d92e;if(_0x2ac5c2[_0x2401('0x35')][_0x2401('0x44')]){_0x292a78[_0x2401('0x45')]=[{'all':!![]}];}return db[_0x2401('0x2f')][_0x2401('0x46')](_0x292a78);})[_0x2401('0x29')](function(_0xad6e61){_0x19302a['rows']=_0xad6e61;return _0x19302a;})[_0x2401('0x29')](respondWithFilteredResult(_0x263051,_0x292a78))['catch'](handleError(_0x263051,null));};exports[_0x2401('0x47')]=function(_0x1cff66,_0x388cad){var _0x3eee17={'raw':!![],'where':{'id':_0x1cff66[_0x2401('0x48')]['id']}},_0x4a7b5b={};_0x4a7b5b['model']=_[_0x2401('0x36')](db[_0x2401('0x2f')][_0x2401('0x30')]);_0x4a7b5b[_0x2401('0x35')]=_['keys'](_0x1cff66[_0x2401('0x35')]);_0x4a7b5b[_0x2401('0x37')]=_['intersection'](_0x4a7b5b[_0x2401('0x34')],_0x4a7b5b[_0x2401('0x35')]);_0x3eee17[_0x2401('0x3a')]=_['intersection'](_0x4a7b5b[_0x2401('0x34')],qs[_0x2401('0x39')](_0x1cff66[_0x2401('0x35')][_0x2401('0x39')]));_0x3eee17[_0x2401('0x3a')]=_0x3eee17['attributes']['length']?_0x3eee17['attributes']:_0x4a7b5b[_0x2401('0x34')];if(_0x1cff66[_0x2401('0x35')][_0x2401('0x44')]){_0x3eee17[_0x2401('0x45')]=[{'all':!![]}];}_0x3eee17=_['merge']({},_0x3eee17,_0x1cff66[_0x2401('0x43')]);return db['WhatsappTransferReport'][_0x2401('0x49')](_0x3eee17)[_0x2401('0x29')](handleEntityNotFound(_0x388cad,null))[_0x2401('0x29')](respondWithResult(_0x388cad,null))[_0x2401('0x4a')](handleError(_0x388cad,null));};exports[_0x2401('0x4b')]=function(_0x3dd693,_0x57c484){return db['WhatsappTransferReport'][_0x2401('0x4b')](_0x3dd693[_0x2401('0x4c')],{})[_0x2401('0x29')](respondWithResult(_0x57c484,0xc9))[_0x2401('0x4a')](handleError(_0x57c484,null));};exports[_0x2401('0x28')]=function(_0x11065f,_0x4f9afc){if(_0x11065f[_0x2401('0x4c')]['id']){delete _0x11065f['body']['id'];}return db[_0x2401('0x2f')][_0x2401('0x49')]({'where':{'id':_0x11065f[_0x2401('0x48')]['id']}})[_0x2401('0x29')](handleEntityNotFound(_0x4f9afc,null))[_0x2401('0x29')](saveUpdates(_0x11065f[_0x2401('0x4c')],null))[_0x2401('0x29')](respondWithResult(_0x4f9afc,null))['catch'](handleError(_0x4f9afc,null));};exports[_0x2401('0x4d')]=function(_0x148cfc,_0x5147ec){return db[_0x2401('0x2f')][_0x2401('0x49')]({'where':{'id':_0x148cfc['params']['id']}})[_0x2401('0x29')](handleEntityNotFound(_0x5147ec,null))[_0x2401('0x29')](removeEntity(_0x5147ec,null))['catch'](handleError(_0x5147ec,null));};exports[_0x2401('0x4e')]=function(_0x2617b9,_0xf3950f){return db[_0x2401('0x2f')]['describe']()[_0x2401('0x29')](respondWithResult(_0xf3950f,null))[_0x2401('0x4a')](handleError(_0xf3950f,null));}; \ No newline at end of file +var _0xb5fa=['then','error','stack','name','send','index','map','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','WhatsappTransferReport','includeAll','show','params','keys','rawAttributes','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update'];(function(_0x1cbd7e,_0x1dc155){var _0x18334e=function(_0x2d6fb5){while(--_0x2d6fb5){_0x1cbd7e['push'](_0x1cbd7e['shift']());}};_0x18334e(++_0x1dc155);}(_0xb5fa,0xf8));var _0xab5f=function(_0x4a2609,_0x55ade1){_0x4a2609=_0x4a2609-0x0;var _0x58e66d=_0xb5fa[_0x4a2609];return _0x58e66d;};'use strict';var emlformat=require(_0xab5f('0x0'));var rimraf=require(_0xab5f('0x1'));var zipdir=require(_0xab5f('0x2'));var jsonpatch=require(_0xab5f('0x3'));var rp=require(_0xab5f('0x4'));var moment=require(_0xab5f('0x5'));var BPromise=require(_0xab5f('0x6'));var Mustache=require(_0xab5f('0x7'));var util=require(_0xab5f('0x8'));var path=require(_0xab5f('0x9'));var sox=require(_0xab5f('0xa'));var csv=require(_0xab5f('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xab5f('0xc'));var crypto=require(_0xab5f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xab5f('0xe'));var toCsv=require(_0xab5f('0xb'));var querystring=require(_0xab5f('0xf'));var Papa=require(_0xab5f('0x10'));var Redis=require(_0xab5f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xab5f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xab5f('0x13'));var logger=require('../../config/logger')(_0xab5f('0x14'));var utils=require(_0xab5f('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d9f16,_0x32fca3){_0x32fca3=_0x32fca3||0xcc;return function(_0x56d072){if(_0x56d072){return _0x3d9f16[_0xab5f('0x16')](_0x32fca3);}return _0x3d9f16[_0xab5f('0x17')](_0x32fca3)[_0xab5f('0x18')]();};}function respondWithResult(_0x318335,_0x410269){_0x410269=_0x410269||0xc8;return function(_0x4101ee){if(_0x4101ee){return _0x318335[_0xab5f('0x17')](_0x410269)[_0xab5f('0x19')](_0x4101ee);}};}function respondWithFilteredResult(_0x32def2,_0x45bbf6){return function(_0x2dcfb7){if(_0x2dcfb7){var _0x30089f=typeof _0x45bbf6[_0xab5f('0x1a')]===_0xab5f('0x1b')&&typeof _0x45bbf6[_0xab5f('0x1c')]===_0xab5f('0x1b');var _0xecd649=_0x2dcfb7[_0xab5f('0x1d')];var _0x4aca7d=_0x30089f?0x0:_0x45bbf6[_0xab5f('0x1a')];var _0x4da25e=_0x30089f?_0x2dcfb7[_0xab5f('0x1d')]:_0x45bbf6[_0xab5f('0x1a')]+_0x45bbf6[_0xab5f('0x1c')];var _0x1d6c2b;if(_0x4da25e>=_0xecd649){_0x4da25e=_0xecd649;_0x1d6c2b=0xc8;}else{_0x1d6c2b=0xce;}_0x32def2['status'](_0x1d6c2b);return _0x32def2[_0xab5f('0x1e')](_0xab5f('0x1f'),_0x4aca7d+'-'+_0x4da25e+'/'+_0xecd649)[_0xab5f('0x19')](_0x2dcfb7);}return null;};}function patchUpdates(_0x1bc5ae){return function(_0x34aa5e){try{jsonpatch[_0xab5f('0x20')](_0x34aa5e,_0x1bc5ae,!![]);}catch(_0x58cfa4){return BPromise[_0xab5f('0x21')](_0x58cfa4);}return _0x34aa5e[_0xab5f('0x22')]();};}function saveUpdates(_0x41a2af,_0x5377dd){return function(_0xb47124){if(_0xb47124){return _0xb47124[_0xab5f('0x23')](_0x41a2af)[_0xab5f('0x24')](function(_0x237704){return _0x237704;});}return null;};}function removeEntity(_0x297dff,_0x823c5){return function(_0x4b3127){if(_0x4b3127){return _0x4b3127['destroy']()[_0xab5f('0x24')](function(){_0x297dff[_0xab5f('0x17')](0xcc)[_0xab5f('0x18')]();});}};}function handleEntityNotFound(_0x39bf0f,_0x3fb403){return function(_0x49972a){if(!_0x49972a){_0x39bf0f[_0xab5f('0x16')](0x194);}return _0x49972a;};}function handleError(_0x38d793,_0x4944b6){_0x4944b6=_0x4944b6||0x1f4;return function(_0x1dad1d){logger[_0xab5f('0x25')](_0x1dad1d[_0xab5f('0x26')]);if(_0x1dad1d[_0xab5f('0x27')]){delete _0x1dad1d['name'];}_0x38d793[_0xab5f('0x17')](_0x4944b6)[_0xab5f('0x28')](_0x1dad1d);};}exports[_0xab5f('0x29')]=function(_0x239229,_0x5e43a5){var _0x173688={},_0x165ef6={},_0x36ec77={'count':0x0,'rows':[]};var _0x2de322=_[_0xab5f('0x2a')](db['WhatsappTransferReport']['rawAttributes'],function(_0x7f5308){return{'name':_0x7f5308[_0xab5f('0x2b')],'type':_0x7f5308[_0xab5f('0x2c')][_0xab5f('0x2d')]};});_0x165ef6['model']=_['map'](_0x2de322,'name');_0x165ef6['query']=_['keys'](_0x239229[_0xab5f('0x2e')]);_0x165ef6[_0xab5f('0x2f')]=_[_0xab5f('0x30')](_0x165ef6[_0xab5f('0x31')],_0x165ef6[_0xab5f('0x2e')]);_0x173688[_0xab5f('0x32')]=_[_0xab5f('0x30')](_0x165ef6['model'],qs[_0xab5f('0x33')](_0x239229[_0xab5f('0x2e')][_0xab5f('0x33')]));_0x173688[_0xab5f('0x32')]=_0x173688[_0xab5f('0x32')][_0xab5f('0x34')]?_0x173688['attributes']:_0x165ef6[_0xab5f('0x31')];if(!_0x239229['query'][_0xab5f('0x35')]('nolimit')){_0x173688['limit']=qs['limit'](_0x239229['query'][_0xab5f('0x1c')]);_0x173688['offset']=qs[_0xab5f('0x1a')](_0x239229[_0xab5f('0x2e')][_0xab5f('0x1a')]);}_0x173688[_0xab5f('0x36')]=qs[_0xab5f('0x37')](_0x239229[_0xab5f('0x2e')][_0xab5f('0x37')]);_0x173688[_0xab5f('0x38')]=qs[_0xab5f('0x2f')](_['pick'](_0x239229[_0xab5f('0x2e')],_0x165ef6['filters']),_0x2de322);if(_0x239229[_0xab5f('0x2e')][_0xab5f('0x39')]){_0x173688[_0xab5f('0x38')]=_['merge'](_0x173688[_0xab5f('0x38')],{'$or':_[_0xab5f('0x2a')](_0x2de322,function(_0xaf7a59){if(_0xaf7a59[_0xab5f('0x2c')]!==_0xab5f('0x3a')){var _0x1390f1={};_0x1390f1[_0xaf7a59[_0xab5f('0x27')]]={'$like':'%'+_0x239229['query'][_0xab5f('0x39')]+'%'};return _0x1390f1;}})});}_0x173688=_[_0xab5f('0x3b')]({},_0x173688,_0x239229[_0xab5f('0x3c')]);var _0x446efc={'where':_0x173688[_0xab5f('0x38')]};return db[_0xab5f('0x3d')][_0xab5f('0x1d')](_0x446efc)[_0xab5f('0x24')](function(_0x4aaaa3){_0x36ec77['count']=_0x4aaaa3;if(_0x239229[_0xab5f('0x2e')][_0xab5f('0x3e')]){_0x173688['include']=[{'all':!![]}];}return db[_0xab5f('0x3d')]['findAll'](_0x173688);})[_0xab5f('0x24')](function(_0x71490a){_0x36ec77['rows']=_0x71490a;return _0x36ec77;})[_0xab5f('0x24')](respondWithFilteredResult(_0x5e43a5,_0x173688))['catch'](handleError(_0x5e43a5,null));};exports[_0xab5f('0x3f')]=function(_0x223681,_0xf58cc){var _0xa78132={'raw':!![],'where':{'id':_0x223681[_0xab5f('0x40')]['id']}},_0x2da96f={};_0x2da96f['model']=_[_0xab5f('0x41')](db[_0xab5f('0x3d')][_0xab5f('0x42')]);_0x2da96f[_0xab5f('0x2e')]=_[_0xab5f('0x41')](_0x223681[_0xab5f('0x2e')]);_0x2da96f['filters']=_[_0xab5f('0x30')](_0x2da96f[_0xab5f('0x31')],_0x2da96f['query']);_0xa78132[_0xab5f('0x32')]=_['intersection'](_0x2da96f[_0xab5f('0x31')],qs[_0xab5f('0x33')](_0x223681['query'][_0xab5f('0x33')]));_0xa78132[_0xab5f('0x32')]=_0xa78132[_0xab5f('0x32')][_0xab5f('0x34')]?_0xa78132[_0xab5f('0x32')]:_0x2da96f[_0xab5f('0x31')];if(_0x223681[_0xab5f('0x2e')][_0xab5f('0x3e')]){_0xa78132['include']=[{'all':!![]}];}_0xa78132=_[_0xab5f('0x3b')]({},_0xa78132,_0x223681[_0xab5f('0x3c')]);return db[_0xab5f('0x3d')]['find'](_0xa78132)[_0xab5f('0x24')](handleEntityNotFound(_0xf58cc,null))[_0xab5f('0x24')](respondWithResult(_0xf58cc,null))[_0xab5f('0x43')](handleError(_0xf58cc,null));};exports[_0xab5f('0x44')]=function(_0x3e699e,_0x14e815){return db[_0xab5f('0x3d')][_0xab5f('0x44')](_0x3e699e[_0xab5f('0x45')],{})[_0xab5f('0x24')](respondWithResult(_0x14e815,0xc9))[_0xab5f('0x43')](handleError(_0x14e815,null));};exports[_0xab5f('0x23')]=function(_0x4502ee,_0x28a126){if(_0x4502ee['body']['id']){delete _0x4502ee[_0xab5f('0x45')]['id'];}return db[_0xab5f('0x3d')][_0xab5f('0x46')]({'where':{'id':_0x4502ee[_0xab5f('0x40')]['id']}})[_0xab5f('0x24')](handleEntityNotFound(_0x28a126,null))['then'](saveUpdates(_0x4502ee['body'],null))[_0xab5f('0x24')](respondWithResult(_0x28a126,null))[_0xab5f('0x43')](handleError(_0x28a126,null));};exports['destroy']=function(_0x409c61,_0x3fb478){return db[_0xab5f('0x3d')][_0xab5f('0x46')]({'where':{'id':_0x409c61['params']['id']}})['then'](handleEntityNotFound(_0x3fb478,null))[_0xab5f('0x24')](removeEntity(_0x3fb478,null))[_0xab5f('0x43')](handleError(_0x3fb478,null));};exports['describe']=function(_0x413b41,_0x8253da){return db['WhatsappTransferReport']['describe']()[_0xab5f('0x24')](respondWithResult(_0x8253da,null))['catch'](handleError(_0x8253da,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 1156ab6..5f32dfc 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 _0x9b07=['./whatsappTransferReport.attributes','exports','WhatsappTransferReport','uniqueid','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x348d8d,_0x25a6dd){var _0x2a7d1f=function(_0x32fed7){while(--_0x32fed7){_0x348d8d['push'](_0x348d8d['shift']());}};_0x2a7d1f(++_0x25a6dd);}(_0x9b07,0xb4));var _0x79b0=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x9b07[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x79b0('0x0'));var util=require(_0x79b0('0x1'));var logger=require('../../config/logger')(_0x79b0('0x2'));var moment=require('moment');var BPromise=require(_0x79b0('0x3'));var rp=require(_0x79b0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x79b0('0x5'));var config=require(_0x79b0('0x6'));var attributes=require(_0x79b0('0x7'));module[_0x79b0('0x8')]=function(_0x463fdf,_0x116caf){return _0x463fdf['define'](_0x79b0('0x9'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x79b0('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7201=['rimraf','../../config/environment','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','api','moment','bluebird','request-promise','path'];(function(_0x32e649,_0x228649){var _0x14d386=function(_0x3fb3ed){while(--_0x3fb3ed){_0x32e649['push'](_0x32e649['shift']());}};_0x14d386(++_0x228649);}(_0x7201,0x10b));var _0x1720=function(_0x404473,_0x306a78){_0x404473=_0x404473-0x0;var _0x152b4c=_0x7201[_0x404473];return _0x152b4c;};'use strict';var _=require(_0x1720('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1720('0x1'));var moment=require(_0x1720('0x2'));var BPromise=require(_0x1720('0x3'));var rp=require(_0x1720('0x4'));var fs=require('fs');var path=require(_0x1720('0x5'));var rimraf=require(_0x1720('0x6'));var config=require(_0x1720('0x7'));var attributes=require('./whatsappTransferReport.attributes');module[_0x1720('0x8')]=function(_0x2613da,_0xe5032c){return _0x2613da[_0x1720('0x9')](_0x1720('0xa'),attributes,{'tableName':_0x1720('0xb'),'paranoid':![],'indexes':[{'name':_0x1720('0xc'),'fields':[_0x1720('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 6663881..d2af176 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 _0x2e8f=['lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch'];(function(_0x51c8c0,_0x31a8fc){var _0x40bba2=function(_0xc55f4d){while(--_0xc55f4d){_0x51c8c0['push'](_0x51c8c0['shift']());}};_0x40bba2(++_0x31a8fc);}(_0x2e8f,0x180));var _0xf2e8=function(_0x1147ab,_0x10e72b){_0x1147ab=_0x1147ab-0x0;var _0x55cb5a=_0x2e8f[_0x1147ab];return _0x55cb5a;};'use strict';var _=require(_0xf2e8('0x0'));var util=require('util');var moment=require(_0xf2e8('0x1'));var BPromise=require(_0xf2e8('0x2'));var rs=require(_0xf2e8('0x3'));var fs=require('fs');var Redis=require(_0xf2e8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf2e8('0x5'));var logger=require(_0xf2e8('0x6'))(_0xf2e8('0x7'));var config=require('../../config/environment');var jayson=require(_0xf2e8('0x8'));var client=jayson[_0xf2e8('0x9')][_0xf2e8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c8fa3,_0x2aa715,_0x16ac32){return new BPromise(function(_0x461917,_0x23a075){return client[_0xf2e8('0xb')](_0x1c8fa3,_0x16ac32)[_0xf2e8('0xc')](function(_0x52a34e){logger[_0xf2e8('0xd')](_0xf2e8('0xe'),_0x2aa715,'request\x20sent');logger[_0xf2e8('0xf')](_0xf2e8('0x10'),_0x2aa715,_0xf2e8('0x11'),JSON[_0xf2e8('0x12')](_0x52a34e));if(_0x52a34e['error']){if(_0x52a34e['error'][_0xf2e8('0x13')]===0x1f4){logger[_0xf2e8('0x14')](_0xf2e8('0xe'),_0x2aa715,_0x52a34e[_0xf2e8('0x14')]['message']);return _0x23a075(_0x52a34e['error'][_0xf2e8('0x15')]);}logger[_0xf2e8('0x14')](_0xf2e8('0xe'),_0x2aa715,_0x52a34e[_0xf2e8('0x14')][_0xf2e8('0x15')]);return _0x461917(_0x52a34e[_0xf2e8('0x14')][_0xf2e8('0x15')]);}else{logger['info'](_0xf2e8('0xe'),_0x2aa715,'request\x20sent');_0x461917(_0x52a34e[_0xf2e8('0x16')][_0xf2e8('0x15')]);}})[_0xf2e8('0x17')](function(_0x59788d){logger[_0xf2e8('0x14')]('WhatsappTransferReport,\x20%s,\x20%s',_0x2aa715,_0x59788d);_0x23a075(_0x59788d);});});} \ No newline at end of file +var _0xdebe=['moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util'];(function(_0x41e8c4,_0x30d9ff){var _0x54ffbe=function(_0x4131af){while(--_0x4131af){_0x41e8c4['push'](_0x41e8c4['shift']());}};_0x54ffbe(++_0x30d9ff);}(_0xdebe,0x142));var _0xedeb=function(_0x21ced2,_0x36378f){_0x21ced2=_0x21ced2-0x0;var _0x43761d=_0xdebe[_0x21ced2];return _0x43761d;};'use strict';var _=require(_0xedeb('0x0'));var util=require(_0xedeb('0x1'));var moment=require(_0xedeb('0x2'));var BPromise=require(_0xedeb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xedeb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xedeb('0x5'));var logger=require(_0xedeb('0x6'))('rpc');var config=require(_0xedeb('0x7'));var jayson=require(_0xedeb('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x49a448,_0x14b98b,_0x135b81){return new BPromise(function(_0x5396dd,_0x2646bc){return client['request'](_0x49a448,_0x135b81)[_0xedeb('0x9')](function(_0xfd527e){logger[_0xedeb('0xa')](_0xedeb('0xb'),_0x14b98b,_0xedeb('0xc'));logger['debug'](_0xedeb('0xd'),_0x14b98b,_0xedeb('0xc'),JSON[_0xedeb('0xe')](_0xfd527e));if(_0xfd527e[_0xedeb('0xf')]){if(_0xfd527e['error']['code']===0x1f4){logger[_0xedeb('0xf')](_0xedeb('0xb'),_0x14b98b,_0xfd527e[_0xedeb('0xf')][_0xedeb('0x10')]);return _0x2646bc(_0xfd527e['error'][_0xedeb('0x10')]);}logger['error'](_0xedeb('0xb'),_0x14b98b,_0xfd527e[_0xedeb('0xf')][_0xedeb('0x10')]);return _0x5396dd(_0xfd527e[_0xedeb('0xf')][_0xedeb('0x10')]);}else{logger[_0xedeb('0xa')](_0xedeb('0xb'),_0x14b98b,_0xedeb('0xc'));_0x5396dd(_0xfd527e['result'][_0xedeb('0x10')]);}})[_0xedeb('0x11')](function(_0x55082f){logger[_0xedeb('0xf')](_0xedeb('0xb'),_0x14b98b,_0x55082f);_0x2646bc(_0x55082f);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 90090a1..a4cc02a 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbc8d=['map','pm2_env','online','name','join','Offline\x20apps:','status','None','log','App\x20Ready!','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./config/seedDB','./config/license','./rpc','./config/environment','app','./config/pm2','./config/pm2/config','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','then','seedDB','default','listen','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20'];(function(_0x4b6600,_0x430bdf){var _0x3f814f=function(_0x563910){while(--_0x563910){_0x4b6600['push'](_0x4b6600['shift']());}};_0x3f814f(++_0x430bdf);}(_0xbc8d,0x15b));var _0xdbc8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc8d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdbc8('0x0'));var db=require('./mysqldb')['db'];var seedDb=require(_0xdbc8('0x1'));var checkLicense=require(_0xdbc8('0x2'));var rpc=require(_0xdbc8('0x3'));var config=require(_0xdbc8('0x4'));var logger=require('./config/logger')(_0xdbc8('0x5'));var pm2=require(_0xdbc8('0x6'));var pm2Config=require(_0xdbc8('0x7'));var schedule=require('./config/schedule');var chat=require(_0xdbc8('0x8'));var whatsapp=require(_0xdbc8('0x9'));var transcribe=require(_0xdbc8('0xa'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0xdbc8('0xb')]['sync']()[_0xdbc8('0xc')](function(){if(config[_0xdbc8('0xd')]){return seedDb['default']();}})[_0xdbc8('0xc')](function(){return checkLicense[_0xdbc8('0xe')]();})[_0xdbc8('0xc')](function(){return rpc[_0xdbc8('0xf')]();})[_0xdbc8('0xc')](function(_0x40a2c5){logger[_0xdbc8('0x10')](_0x40a2c5);return chat[_0xdbc8('0x11')]();})[_0xdbc8('0xc')](function(){return whatsapp[_0xdbc8('0x11')]();})[_0xdbc8('0xc')](function(){return schedule[_0xdbc8('0x11')]();})[_0xdbc8('0xc')](function(){return transcribe[_0xdbc8('0x11')]();})[_0xdbc8('0xc')](function(){return provider['start']();})[_0xdbc8('0xc')](function(_0x562914){logger[_0xdbc8('0x10')](_0x562914);return pm2[_0xdbc8('0x11')](pm2Config);})[_0xdbc8('0xc')](function(_0x3a7698){var _0x1406b9=_0x3a7698[_0xdbc8('0x12')](function(_0x1d5d7e){return typeof _0x1d5d7e[_0xdbc8('0x13')]===_0xdbc8('0x14')&&_0x1d5d7e[_0xdbc8('0x13')]>=0x0;});if(_0x1406b9[_0xdbc8('0x15')]>0x0){throw new Error(_0x1406b9[_0xdbc8('0x15')]+_0xdbc8('0x16')+_[_0xdbc8('0x17')](_0x1406b9,function(_0x4cdb17){return'\x22'+_0x4cdb17[_0xdbc8('0x18')]['name']+'\x22';}));}logger['info']('Online\x20apps:',_['map'](_[_0xdbc8('0x12')](_0x3a7698,{'status':_0xdbc8('0x19')}),_0xdbc8('0x1a'))[_0xdbc8('0x1b')]());logger[_0xdbc8('0x10')](_0xdbc8('0x1c'),_[_0xdbc8('0x17')](_[_0xdbc8('0x12')](_0x3a7698,function(_0x2f0b08){return _0x2f0b08[_0xdbc8('0x1d')]!==_0xdbc8('0x19');}),_0xdbc8('0x1a'))[_0xdbc8('0x1b')]()||_0xdbc8('0x1e'));console[_0xdbc8('0x1f')](_0xdbc8('0x20'));})[_0xdbc8('0x21')](function(_0x2b5a97){console[_0xdbc8('0x1f')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x2b5a97);logger[_0xdbc8('0x22')](_0xdbc8('0x23'),_0x2b5a97);process[_0xdbc8('0x24')](0x1);});}main(); \ No newline at end of file +var _0xe75a=['filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','pm2_env','name','map','online','join','status','None','log','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','exit','lodash','./mysqldb','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/cloud-provider','then','default','start','info'];(function(_0x1a160d,_0xa2c72d){var _0x4e8844=function(_0x2d982e){while(--_0x2d982e){_0x1a160d['push'](_0x1a160d['shift']());}};_0x4e8844(++_0xa2c72d);}(_0xe75a,0x1de));var _0xae75=function(_0x3c0dcc,_0x18c419){_0x3c0dcc=_0x3c0dcc-0x0;var _0x1a224c=_0xe75a[_0x3c0dcc];return _0x1a224c;};'use strict';var _=require(_0xae75('0x0'));var db=require(_0xae75('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0xae75('0x2'));var rpc=require(_0xae75('0x3'));var config=require(_0xae75('0x4'));var logger=require(_0xae75('0x5'))(_0xae75('0x6'));var pm2=require(_0xae75('0x7'));var pm2Config=require(_0xae75('0x8'));var schedule=require(_0xae75('0x9'));var chat=require(_0xae75('0xa'));var whatsapp=require(_0xae75('0xb'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0xae75('0xc'));function main(){return db['sequelize']['sync']()[_0xae75('0xd')](function(){if(config['seedDB']){return seedDb['default']();}})['then'](function(){return checkLicense[_0xae75('0xe')]();})['then'](function(){return rpc['listen']();})[_0xae75('0xd')](function(_0x3f6ae2){logger['info'](_0x3f6ae2);return chat[_0xae75('0xf')]();})[_0xae75('0xd')](function(){return whatsapp['start']();})[_0xae75('0xd')](function(){return schedule[_0xae75('0xf')]();})[_0xae75('0xd')](function(){return transcribe['start']();})[_0xae75('0xd')](function(){return provider[_0xae75('0xf')]();})[_0xae75('0xd')](function(_0x105487){logger[_0xae75('0x10')](_0x105487);return pm2[_0xae75('0xf')](pm2Config);})[_0xae75('0xd')](function(_0x99fdc8){var _0xa268ec=_0x99fdc8[_0xae75('0x11')](function(_0x5dcc10){return typeof _0x5dcc10[_0xae75('0x12')]===_0xae75('0x13')&&_0x5dcc10[_0xae75('0x12')]>=0x0;});if(_0xa268ec[_0xae75('0x14')]>0x0){throw new Error(_0xa268ec[_0xae75('0x14')]+_0xae75('0x15')+_['map'](_0xa268ec,function(_0x52f683){return'\x22'+_0x52f683[_0xae75('0x16')][_0xae75('0x17')]+'\x22';}));}logger[_0xae75('0x10')]('Online\x20apps:',_[_0xae75('0x18')](_[_0xae75('0x11')](_0x99fdc8,{'status':_0xae75('0x19')}),_0xae75('0x17'))[_0xae75('0x1a')]());logger[_0xae75('0x10')]('Offline\x20apps:',_[_0xae75('0x18')](_[_0xae75('0x11')](_0x99fdc8,function(_0x3c82bc){return _0x3c82bc[_0xae75('0x1b')]!==_0xae75('0x19');}),_0xae75('0x17'))[_0xae75('0x1a')]()||_0xae75('0x1c'));console[_0xae75('0x1d')]('App\x20Ready!');})[_0xae75('0x1e')](function(_0x24e207){console[_0xae75('0x1d')](_0xae75('0x1f'),_0x24e207);logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x24e207);process[_0xae75('0x20')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 0564496..6204cf1 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 _0x55ca=['It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','/dashboards/general','send','isNil','apiKeyIat','generateApiKey','regenerateApiKey','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','splice','unshift','encryptString','join','promisify','payload','options','session','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','lodash','jsonwebtoken','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','role','fullname','internal','email','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','allowmessenger','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswerDelay','whatsappAutoanswer','isChatInteractionAuthorized','isAuthenticated','use','user','closed','then','status','disposition','unmanaged','json','Unmanaged.','Forbidden.','headers','authorization','startsWith','User','find','name','authenticate','pass','Wrong\x20credentials.','catch','query','apikey','getUuid','Setting','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','blockDuration','add','Invalid\x20API\x20access\x20key','Unknown\x20authorization\x20format','User\x20not\x20found.','canUpdate','update','isWebrtcLicence','getLicense','webrtc','Forbidden','isMiddleware','signToken'];(function(_0x50637b,_0x2af82d){var _0x3df72f=function(_0xcab883){while(--_0xcab883){_0x50637b['push'](_0x50637b['shift']());}};_0x3df72f(++_0x2af82d);}(_0x55ca,0x126));var _0xa55c=function(_0x3e5a76,_0x1e2316){_0x3e5a76=_0x3e5a76-0x0;var _0x2b9bc6=_0x55ca[_0x3e5a76];return _0x2b9bc6;};'use strict';var db=require(_0xa55c('0x0'))['db'];var config=require(_0xa55c('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require('../../config/license/util');var encryptor=require('../encryptor');var _=require(_0xa55c('0x2'));var jwt=require(_0xa55c('0x3'));var expressJwt=require('express-jwt');var compose=require(_0xa55c('0x4'));var basicAuth=require(_0xa55c('0x5'));var crypto=require(_0xa55c('0x6'));var BPromise=require(_0xa55c('0x7'));var util=require(_0xa55c('0x8'));var moment=require(_0xa55c('0x9'));var validateJwt=expressJwt({'secret':config[_0xa55c('0xa')]['session']});var userAttributes=['id',_0xa55c('0xb'),_0xa55c('0xc'),'name',_0xa55c('0xd'),_0xa55c('0xe'),'userpic','permissions',_0xa55c('0xf'),_0xa55c('0x10'),_0xa55c('0x11'),_0xa55c('0x12'),_0xa55c('0x13'),_0xa55c('0x14'),_0xa55c('0x15'),_0xa55c('0x16'),_0xa55c('0x17'),_0xa55c('0x18'),'lastPauseAt','crudPermissions',_0xa55c('0x19'),'passwordResetAt','alias','phoneBarAutoAnswer',_0xa55c('0x1a'),_0xa55c('0x1b'),_0xa55c('0x1c'),_0xa55c('0x1d'),_0xa55c('0x1e'),_0xa55c('0x1f'),'phoneBarPrefixRequired',_0xa55c('0x20'),_0xa55c('0x21'),_0xa55c('0x22'),_0xa55c('0x23'),_0xa55c('0x24'),_0xa55c('0x25'),_0xa55c('0x26'),_0xa55c('0x27'),_0xa55c('0x28'),'downloadOmnichannelInteractions',_0xa55c('0x29'),_0xa55c('0x2a'),_0xa55c('0x2b'),_0xa55c('0x2c'),_0xa55c('0x2d'),_0xa55c('0x2e'),'emailAutoanswerDelay','smsAutoanswer',_0xa55c('0x2f'),_0xa55c('0x30'),_0xa55c('0x31'),'faxAutoanswer',_0xa55c('0x32'),_0xa55c('0x33'),'whatsappAutoanswerDelay'];exports[_0xa55c('0x34')]=function(){return this[_0xa55c('0x35')](!![])[_0xa55c('0x36')](function(_0x1965f1,_0x234372,_0x49ed04){if(_0x1965f1[_0xa55c('0x37')]){_0x49ed04();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x1965f1['params']['id']},'attributes':['id',_0xa55c('0x38'),'disposition'],'raw':!![]})[_0xa55c('0x39')](function(_0x190757){if(_0x190757&&_0x190757[_0xa55c('0x38')]){return _0x234372[_0xa55c('0x3a')](_0x190757[_0xa55c('0x3b')]===_0xa55c('0x3c')?0x195:0x193)[_0xa55c('0x3d')]({'message':_0x190757[_0xa55c('0x3b')]===_0xa55c('0x3c')?_0xa55c('0x3e'):_0xa55c('0x3f')});}else{_0x49ed04();}})['catch'](function(_0x430d55){_0x49ed04(_0x430d55);});}});};exports[_0xa55c('0x35')]=function isAuthenticated(_0x1c9f6b){return compose()[_0xa55c('0x36')](function(_0x5d940d,_0x1377b0,_0x22f6b6){var _0x1b8388;if(_0x5d940d[_0xa55c('0x40')][_0xa55c('0x41')]){if(_[_0xa55c('0x42')](_0x5d940d['headers'][_0xa55c('0x41')],'Basic')){var _0x35c9c2=basicAuth(_0x5d940d);db[_0xa55c('0x43')][_0xa55c('0x44')]({'where':{'name':_0x35c9c2[_0xa55c('0x45')]}})['then'](function(_0x3d28fb){if(!_0x3d28fb||!_0x3d28fb[_0xa55c('0x46')](_0x35c9c2[_0xa55c('0x47')])){return _0x1377b0[_0xa55c('0x3a')](0x191)[_0xa55c('0x3d')]({'message':_0xa55c('0x48')});}_0x5d940d[_0xa55c('0x37')]={'id':_0x3d28fb['id']};_0x22f6b6();})[_0xa55c('0x49')](function(_0x2808e9){_0x22f6b6(_0x2808e9);});}else if(_[_0xa55c('0x42')](_0x5d940d[_0xa55c('0x40')]['authorization'],'Bearer')){validateJwt(_0x5d940d,_0x1377b0,_0x22f6b6);}else{if(_0x1c9f6b){_0x22f6b6();}else{return _0x1377b0[_0xa55c('0x3a')](0x193)[_0xa55c('0x3d')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x5d940d[_0xa55c('0x4a')][_0xa55c('0x4b')]){try{var _0x2e9623={'audience':hardwareConf[_0xa55c('0x4c')](),'issuer':hardwareConf[_0xa55c('0x4c')]()};verifyJwt(_0x5d940d[_0xa55c('0x4a')][_0xa55c('0x4b')],_0x2e9623)[_0xa55c('0x39')](function(_0x3959e3){return db['User']['find']({'where':{'id':_0x3959e3['sub']}})[_0xa55c('0x39')](function(_0x18e00e){_0x1b8388=_0x18e00e;return db[_0xa55c('0x4d')]['findOne']({'where':{'id':0x1},'attributes':[_0xa55c('0x4e'),'blockDuration'],'raw':!![]});})[_0xa55c('0x39')](function(_0x4ad813){if(!_0x1b8388||!_[_0xa55c('0x4f')](_0x1b8388[_0xa55c('0x50')],_0x3959e3[_0xa55c('0x51')])){return _0x1377b0['status'](0x191)[_0xa55c('0x3d')]({'message':_0xa55c('0x52')});}if(_0x1b8388['disabled']){return _0x1377b0[_0xa55c('0x3a')](0x191)[_0xa55c('0x3d')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x1b8388['blocked']){if(_0x4ad813[_0xa55c('0x53')]>0x0){if(moment(_0x1b8388['blockedAt'])[_0xa55c('0x54')](_0x4ad813[_0xa55c('0x53')],'minutes')>moment()){return _0x1377b0['status'](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x1377b0[_0xa55c('0x3a')](0x191)[_0xa55c('0x3d')]({'message':_0xa55c('0x55')});}}_0x5d940d[_0xa55c('0x37')]={'id':_0x1b8388['id']};_0x22f6b6();});})[_0xa55c('0x49')](function(){return _0x1377b0['status'](0x191)[_0xa55c('0x3d')]({'message':_0xa55c('0x55')});});}catch(_0x77d623){_0x22f6b6(_0x77d623);}}else if(_0x1c9f6b){_0x22f6b6();}else{return _0x1377b0[_0xa55c('0x3a')](0x193)[_0xa55c('0x3d')]({'message':_0xa55c('0x56')});}})['use'](function(_0x386e34,_0x5ee63d,_0x57a972){if(_0x386e34[_0xa55c('0x37')]){db[_0xa55c('0x43')]['find']({'where':{'id':_0x386e34[_0xa55c('0x37')]['id']},'attributes':userAttributes})['then'](function(_0x5f25f7){if(!_0x5f25f7){return _0x5ee63d[_0xa55c('0x3a')](0x194)[_0xa55c('0x3d')]({'message':_0xa55c('0x57')});}_0x386e34['user']=_0x5f25f7;_0x57a972();})[_0xa55c('0x49')](function(_0xd5a006){_0x57a972(_0xd5a006);});}else if(_0x1c9f6b){_0x57a972();}else{return _0x5ee63d['status'](0x194)[_0xa55c('0x3d')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xa55c('0x58')]=function canUpdate(){return compose()[_0xa55c('0x36')](function(_0x5be43f,_0x66d1de,_0x1dae70){return licenseUtil['getLicense']()[_0xa55c('0x39')](function(_0x187e09){if(_0x187e09[_0xa55c('0x59')]){_0x1dae70();}else{return _0x66d1de['status'](0x193)[_0xa55c('0x3d')]({'message':'Forbidden'});}})[_0xa55c('0x49')](function(_0x3a8af4){_0x1dae70(_0x3a8af4);});});};exports[_0xa55c('0x5a')]=function isWebrtcLicence(){return compose()['use'](function(_0x41eab1,_0x106adb,_0x592429){return licenseUtil[_0xa55c('0x5b')]()[_0xa55c('0x39')](function(_0x5d5cf6){if(_0x5d5cf6[_0xa55c('0x5c')]){_0x592429();}else{return _0x106adb[_0xa55c('0x3a')](0x193)['json']({'message':_0xa55c('0x5d')});}})[_0xa55c('0x49')](function(_0x219a68){_0x592429(_0x219a68);});});};exports[_0xa55c('0x5e')]=function(_0x564cb3,_0x143989,_0x58a7ea){_0x564cb3[_0xa55c('0x5e')]=!![];return _0x58a7ea();};exports[_0xa55c('0x5f')]=function signToken(_0x194a79){return signJwt(_0x194a79);};exports['setTokenCookie']=function(_0x39bd3d,_0x250b00){if(!_0x39bd3d['user']){return _0x250b00[_0xa55c('0x3a')](0x194)[_0xa55c('0x3d')]({'message':_0xa55c('0x60')});}var _0xcd78c5={'payload':{'id':_0x39bd3d[_0xa55c('0x37')]['id'],'role':_0x39bd3d[_0xa55c('0x37')][_0xa55c('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0xcd78c5)[_0xa55c('0x39')](function(_0x3c147b){_0x250b00[_0xa55c('0x61')]('motion.token',_0x3c147b);_0x250b00[_0xa55c('0x62')](_0xa55c('0x63'));})[_0xa55c('0x49')](function(_0x4f73b6){return _0x250b00[_0xa55c('0x3a')](0x1f4)[_0xa55c('0x64')](_0x4f73b6);});};exports['retrieveApiKey']=function(_0x21b760){if(_['isNil'](_0x21b760[_0xa55c('0x50')])||_[_0xa55c('0x65')](_0x21b760[_0xa55c('0x66')])){return null;}else{return createJwt(_0x21b760);}};exports[_0xa55c('0x67')]=function(_0x2ecf79){_0x2ecf79['apiKeyNonce']=generateNonce();_0x2ecf79[_0xa55c('0x66')]=generateIssuedAt();return createJwt(_0x2ecf79);};exports[_0xa55c('0x68')]=function(_0x4b85cc,_0x3929a6){var _0x2291e0=_0x4b85cc[_0xa55c('0x4a')][_0xa55c('0x4b')];if(_0x2291e0){var _0x50176b={'nonce':_0x3929a6['apiKeyNonce'],'iat':_0x3929a6[_0xa55c('0x66')],'audience':hardwareConf[_0xa55c('0x4c')](),'issuer':hardwareConf[_0xa55c('0x4c')]()};return verifyJwt(_0x2291e0,_0x50176b)[_0xa55c('0x39')](function(){return generateApiKey(_0x3929a6);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0xa55c('0x69')]=function(_0x5ce463){var _0x2742e4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2742e4[_0xa55c('0x6a')](_0x5ce463))throw new db[(_0xa55c('0x6b'))][(_0xa55c('0x6c'))](_0xa55c('0x6d'));return;};exports['validatePasswordHistory']=function(_0x1cb73b,_0x54f776,_0x23f67f){var _0x157afe=encryptor[_0xa55c('0x6e')](_0x54f776)[_0xa55c('0x6f')](',');for(var _0x19aaf5=0x0;_0x19aaf5<_0x23f67f;_0x19aaf5++){if(!_0x157afe[_0x19aaf5])break;if(_0x1cb73b[_0xa55c('0x70')]()===_0x157afe[_0x19aaf5][_0xa55c('0x70')]()){var _0x53e2be=util[_0xa55c('0x71')](_0xa55c('0x72'),_0x23f67f);if(_0x23f67f===0x1){_0x53e2be=_0xa55c('0x73');}throw new db[(_0xa55c('0x6b'))][(_0xa55c('0x6c'))](_0x53e2be);}}return;};exports['updatePasswordsHistory']=function(_0xa72718,_0x3cd40d){var _0x28bac4=_0x3cd40d?encryptor[_0xa55c('0x6e')](_0x3cd40d)[_0xa55c('0x6f')](','):[];if(_0x28bac4['length']===0x5){_0x28bac4[_0xa55c('0x74')](-0x1,0x1);}_0x28bac4[_0xa55c('0x75')](_0xa72718);return encryptor[_0xa55c('0x76')](_0x28bac4[_0xa55c('0x77')](','));};function signJwt(_0x3ba56d){var _0x480dfc=BPromise[_0xa55c('0x78')](jwt['sign'],{'context':jwt});var _0x2e482a=_0x3ba56d['secret']||config[_0xa55c('0xa')]['session'];return new BPromise(function(_0x34edc5,_0x1333da){_0x480dfc(_0x3ba56d[_0xa55c('0x79')],_0x2e482a,_0x3ba56d[_0xa55c('0x7a')])[_0xa55c('0x39')](function(_0x3a5a52){_0x34edc5(_0x3a5a52);})[_0xa55c('0x49')](function(_0x2f2226){_0x1333da(_0x2f2226);});});}function verifyJwt(_0x14b515,_0x1acf50,_0x51c736){var _0x150a07=BPromise[_0xa55c('0x78')](jwt['verify'],{'context':jwt});var _0x18b928=_0x51c736||config[_0xa55c('0xa')][_0xa55c('0x7b')];return new BPromise(function(_0x9fe234,_0x1b8b06){_0x150a07(_0x14b515,_0x18b928,_0x1acf50)[_0xa55c('0x39')](function(_0x3cef1f){_0x9fe234(_0x3cef1f);})[_0xa55c('0x49')](function(_0x47de0a){_0x1b8b06(_0x47de0a);});});}function generateNonce(){return crypto[_0xa55c('0x7c')](0x10)[_0xa55c('0x7d')](_0xa55c('0x7e'));}function generateIssuedAt(){return Math[_0xa55c('0x7f')](Date[_0xa55c('0x80')]()/0x3e8)[_0xa55c('0x7d')]();}function createJwt(_0x2f1237){var _0x4249c1={'payload':{'iat':_0x2f1237[_0xa55c('0x66')],'nonce':_0x2f1237['apiKeyNonce']},'options':{'algorithm':_0xa55c('0x81'),'subject':_0x2f1237['id'][_0xa55c('0x7d')](),'issuer':hardwareConf[_0xa55c('0x4c')](),'audience':hardwareConf[_0xa55c('0x4c')]()}};return signJwt(_0x4249c1)[_0xa55c('0x39')](function(_0x10e711){return{'iat':_0x2f1237[_0xa55c('0x66')],'nonce':_0x2f1237[_0xa55c('0x50')],'token':_0x10e711};});} \ No newline at end of file +var _0x34e8=['validatePasswordPattern','test','Sequelize','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','length','splice','unshift','encryptString','join','promisify','sign','secret','secrets','payload','options','verify','toString','hex','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','moment','session','role','fullname','name','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','user','ChatInteraction','params','closed','disposition','unmanaged','Unmanaged.','Forbidden.','catch','authorization','startsWith','headers','Basic','User','find','pass','status','json','Wrong\x20credentials.','Unknown\x20authorization\x20format','query','getUuid','then','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blockedAt','minutes','User\x20not\x20found.','canUpdate','use','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','/dashboards/general','send','isNil','apiKeyNonce','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'];(function(_0x36070b,_0x2adb3e){var _0x267bde=function(_0x30d536){while(--_0x30d536){_0x36070b['push'](_0x36070b['shift']());}};_0x267bde(++_0x2adb3e);}(_0x34e8,0x12c));var _0x834e=function(_0x324126,_0x315b8a){_0x324126=_0x324126-0x0;var _0x432409=_0x34e8[_0x324126];return _0x432409;};'use strict';var db=require(_0x834e('0x0'))['db'];var config=require(_0x834e('0x1'));var hardwareConf=require(_0x834e('0x2'));var licenseUtil=require(_0x834e('0x3'));var encryptor=require('../encryptor');var _=require(_0x834e('0x4'));var jwt=require(_0x834e('0x5'));var expressJwt=require(_0x834e('0x6'));var compose=require(_0x834e('0x7'));var basicAuth=require(_0x834e('0x8'));var crypto=require(_0x834e('0x9'));var BPromise=require(_0x834e('0xa'));var util=require('util');var moment=require(_0x834e('0xb'));var validateJwt=expressJwt({'secret':config['secrets'][_0x834e('0xc')]});var userAttributes=['id',_0x834e('0xd'),_0x834e('0xe'),_0x834e('0xf'),_0x834e('0x10'),_0x834e('0x11'),_0x834e('0x12'),_0x834e('0x13'),_0x834e('0x14'),_0x834e('0x15'),_0x834e('0x16'),_0x834e('0x17'),_0x834e('0x18'),_0x834e('0x19'),_0x834e('0x1a'),_0x834e('0x1b'),_0x834e('0x1c'),'lastLoginAt',_0x834e('0x1d'),_0x834e('0x1e'),'allowmessenger',_0x834e('0x1f'),_0x834e('0x20'),_0x834e('0x21'),_0x834e('0x22'),'phoneBarDnd',_0x834e('0x23'),_0x834e('0x24'),'phoneBarEnableSettings',_0x834e('0x25'),'phoneBarPrefixRequired',_0x834e('0x26'),_0x834e('0x27'),'hotdesk',_0x834e('0x28'),_0x834e('0x29'),_0x834e('0x2a'),'settingsEnabled',_0x834e('0x2b'),_0x834e('0x2c'),_0x834e('0x2d'),_0x834e('0x2e'),_0x834e('0x2f'),_0x834e('0x30'),_0x834e('0x31'),'chatAutoanswerDelay',_0x834e('0x32'),_0x834e('0x33'),_0x834e('0x34'),_0x834e('0x35'),'openchannelAutoanswer',_0x834e('0x36'),_0x834e('0x37'),'faxAutoanswerDelay',_0x834e('0x38'),_0x834e('0x39')];exports[_0x834e('0x3a')]=function(){return this['isAuthenticated'](!![])['use'](function(_0x231619,_0x34563b,_0x589dde){if(_0x231619[_0x834e('0x3b')]){_0x589dde();}else{return db[_0x834e('0x3c')]['findOne']({'where':{'id':_0x231619[_0x834e('0x3d')]['id']},'attributes':['id',_0x834e('0x3e'),_0x834e('0x3f')],'raw':!![]})['then'](function(_0x24fcf7){if(_0x24fcf7&&_0x24fcf7[_0x834e('0x3e')]){return _0x34563b['status'](_0x24fcf7['disposition']===_0x834e('0x40')?0x195:0x193)['json']({'message':_0x24fcf7[_0x834e('0x3f')]===_0x834e('0x40')?_0x834e('0x41'):_0x834e('0x42')});}else{_0x589dde();}})[_0x834e('0x43')](function(_0x130cc5){_0x589dde(_0x130cc5);});}});};exports['isAuthenticated']=function isAuthenticated(_0x510780){return compose()['use'](function(_0x58c1d7,_0x2c7a8d,_0x567cea){var _0x106d6a;if(_0x58c1d7['headers'][_0x834e('0x44')]){if(_[_0x834e('0x45')](_0x58c1d7[_0x834e('0x46')][_0x834e('0x44')],_0x834e('0x47'))){var _0x390119=basicAuth(_0x58c1d7);db[_0x834e('0x48')][_0x834e('0x49')]({'where':{'name':_0x390119[_0x834e('0xf')]}})['then'](function(_0xef9ec2){if(!_0xef9ec2||!_0xef9ec2['authenticate'](_0x390119[_0x834e('0x4a')])){return _0x2c7a8d[_0x834e('0x4b')](0x191)[_0x834e('0x4c')]({'message':_0x834e('0x4d')});}_0x58c1d7[_0x834e('0x3b')]={'id':_0xef9ec2['id']};_0x567cea();})[_0x834e('0x43')](function(_0x4696a1){_0x567cea(_0x4696a1);});}else if(_[_0x834e('0x45')](_0x58c1d7[_0x834e('0x46')][_0x834e('0x44')],'Bearer')){validateJwt(_0x58c1d7,_0x2c7a8d,_0x567cea);}else{if(_0x510780){_0x567cea();}else{return _0x2c7a8d[_0x834e('0x4b')](0x193)[_0x834e('0x4c')]({'message':_0x834e('0x4e')});}}}else if(_0x58c1d7[_0x834e('0x4f')]['apikey']){try{var _0x3f88ad={'audience':hardwareConf[_0x834e('0x50')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x58c1d7['query']['apikey'],_0x3f88ad)[_0x834e('0x51')](function(_0x41bf4d){return db[_0x834e('0x48')][_0x834e('0x49')]({'where':{'id':_0x41bf4d[_0x834e('0x52')]}})[_0x834e('0x51')](function(_0x4c2ef6){_0x106d6a=_0x4c2ef6;return db[_0x834e('0x53')]['findOne']({'where':{'id':0x1},'attributes':[_0x834e('0x54'),_0x834e('0x55')],'raw':!![]});})['then'](function(_0x18ac3b){if(!_0x106d6a||!_[_0x834e('0x56')](_0x106d6a['apiKeyNonce'],_0x41bf4d['nonce'])){return _0x2c7a8d[_0x834e('0x4b')](0x191)[_0x834e('0x4c')]({'message':_0x834e('0x57')});}if(_0x106d6a[_0x834e('0x58')]){return _0x2c7a8d[_0x834e('0x4b')](0x191)['json']({'message':_0x834e('0x59')});}if(_0x106d6a['blocked']){if(_0x18ac3b['blockDuration']>0x0){if(moment(_0x106d6a[_0x834e('0x5a')])['add'](_0x18ac3b[_0x834e('0x55')],_0x834e('0x5b'))>moment()){return _0x2c7a8d[_0x834e('0x4b')](0x191)[_0x834e('0x4c')]({'message':_0x834e('0x59')});}}else{return _0x2c7a8d['status'](0x191)[_0x834e('0x4c')]({'message':_0x834e('0x59')});}}_0x58c1d7[_0x834e('0x3b')]={'id':_0x106d6a['id']};_0x567cea();});})['catch'](function(){return _0x2c7a8d[_0x834e('0x4b')](0x191)[_0x834e('0x4c')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x1e3e71){_0x567cea(_0x1e3e71);}}else if(_0x510780){_0x567cea();}else{return _0x2c7a8d['status'](0x193)[_0x834e('0x4c')]({'message':_0x834e('0x4e')});}})['use'](function(_0x4a6942,_0x22ea21,_0x16969b){if(_0x4a6942[_0x834e('0x3b')]){db[_0x834e('0x48')][_0x834e('0x49')]({'where':{'id':_0x4a6942[_0x834e('0x3b')]['id']},'attributes':userAttributes})[_0x834e('0x51')](function(_0x4a3381){if(!_0x4a3381){return _0x22ea21[_0x834e('0x4b')](0x194)['json']({'message':_0x834e('0x5c')});}_0x4a6942['user']=_0x4a3381;_0x16969b();})[_0x834e('0x43')](function(_0x5a5807){_0x16969b(_0x5a5807);});}else if(_0x510780){_0x16969b();}else{return _0x22ea21[_0x834e('0x4b')](0x194)[_0x834e('0x4c')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x834e('0x5d')]=function canUpdate(){return compose()[_0x834e('0x5e')](function(_0xa880cb,_0xd55cc3,_0x252ea0){return licenseUtil[_0x834e('0x5f')]()[_0x834e('0x51')](function(_0x3ccd8e){if(_0x3ccd8e[_0x834e('0x60')]){_0x252ea0();}else{return _0xd55cc3[_0x834e('0x4b')](0x193)['json']({'message':_0x834e('0x61')});}})[_0x834e('0x43')](function(_0x47a8a9){_0x252ea0(_0x47a8a9);});});};exports[_0x834e('0x62')]=function isWebrtcLicence(){return compose()[_0x834e('0x5e')](function(_0x25b035,_0x2112d5,_0x19b5ef){return licenseUtil[_0x834e('0x5f')]()['then'](function(_0x59c855){if(_0x59c855[_0x834e('0x63')]){_0x19b5ef();}else{return _0x2112d5[_0x834e('0x4b')](0x193)[_0x834e('0x4c')]({'message':_0x834e('0x61')});}})[_0x834e('0x43')](function(_0xd1d83b){_0x19b5ef(_0xd1d83b);});});};exports[_0x834e('0x64')]=function(_0x43f599,_0x1419eb,_0x390c45){_0x43f599[_0x834e('0x64')]=!![];return _0x390c45();};exports[_0x834e('0x65')]=function signToken(_0x1a28f6){return signJwt(_0x1a28f6);};exports[_0x834e('0x66')]=function(_0x2aa072,_0x1a3855){if(!_0x2aa072[_0x834e('0x3b')]){return _0x1a3855[_0x834e('0x4b')](0x194)[_0x834e('0x4c')]({'message':_0x834e('0x67')});}var _0x4cfacd={'payload':{'id':_0x2aa072[_0x834e('0x3b')]['id'],'role':_0x2aa072[_0x834e('0x3b')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x4cfacd)[_0x834e('0x51')](function(_0x3b0988){_0x1a3855['cookie'](_0x834e('0x68'),_0x3b0988);_0x1a3855[_0x834e('0x69')](_0x834e('0x6a'));})[_0x834e('0x43')](function(_0x4288e4){return _0x1a3855[_0x834e('0x4b')](0x1f4)[_0x834e('0x6b')](_0x4288e4);});};exports['retrieveApiKey']=function(_0x1ad7fe){if(_[_0x834e('0x6c')](_0x1ad7fe[_0x834e('0x6d')])||_[_0x834e('0x6c')](_0x1ad7fe[_0x834e('0x6e')])){return null;}else{return createJwt(_0x1ad7fe);}};exports[_0x834e('0x6f')]=function(_0x344b51){_0x344b51[_0x834e('0x6d')]=generateNonce();_0x344b51['apiKeyIat']=generateIssuedAt();return createJwt(_0x344b51);};exports[_0x834e('0x70')]=function(_0x4dc104,_0x2f4bde){var _0x53a9ee=_0x4dc104[_0x834e('0x4f')]['apikey'];if(_0x53a9ee){var _0x527eef={'nonce':_0x2f4bde[_0x834e('0x6d')],'iat':_0x2f4bde[_0x834e('0x6e')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x53a9ee,_0x527eef)[_0x834e('0x51')](function(){return generateApiKey(_0x2f4bde);});}else{throw{'message':_0x834e('0x71')};}};exports[_0x834e('0x72')]=function(_0x387365){var _0x21c417=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x21c417[_0x834e('0x73')](_0x387365))throw new db[(_0x834e('0x74'))][(_0x834e('0x75'))]('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[_0x834e('0x76')]=function(_0x3c70bf,_0x5d5ac2,_0x281342){var _0x4e2b22=encryptor[_0x834e('0x77')](_0x5d5ac2)[_0x834e('0x78')](',');for(var _0x5160c4=0x0;_0x5160c4<_0x281342;_0x5160c4++){if(!_0x4e2b22[_0x5160c4])break;if(_0x3c70bf[_0x834e('0x79')]()===_0x4e2b22[_0x5160c4][_0x834e('0x79')]()){var _0x2de29a=util[_0x834e('0x7a')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x281342);if(_0x281342===0x1){_0x2de29a=_0x834e('0x7b');}throw new db[(_0x834e('0x74'))][(_0x834e('0x75'))](_0x2de29a);}}return;};exports['updatePasswordsHistory']=function(_0x246b8e,_0x1fcae9){var _0x3a7683=_0x1fcae9?encryptor[_0x834e('0x77')](_0x1fcae9)[_0x834e('0x78')](','):[];if(_0x3a7683[_0x834e('0x7c')]===0x5){_0x3a7683[_0x834e('0x7d')](-0x1,0x1);}_0x3a7683[_0x834e('0x7e')](_0x246b8e);return encryptor[_0x834e('0x7f')](_0x3a7683[_0x834e('0x80')](','));};function signJwt(_0x1e4310){var _0x1dfa95=BPromise[_0x834e('0x81')](jwt[_0x834e('0x82')],{'context':jwt});var _0x460a7a=_0x1e4310[_0x834e('0x83')]||config[_0x834e('0x84')][_0x834e('0xc')];return new BPromise(function(_0x193a15,_0x3e3467){_0x1dfa95(_0x1e4310[_0x834e('0x85')],_0x460a7a,_0x1e4310[_0x834e('0x86')])['then'](function(_0x2145cf){_0x193a15(_0x2145cf);})[_0x834e('0x43')](function(_0x45bcc2){_0x3e3467(_0x45bcc2);});});}function verifyJwt(_0x36cc14,_0x4ca099,_0x30faa8){var _0x5a9c70=BPromise['promisify'](jwt[_0x834e('0x87')],{'context':jwt});var _0x2b1ec7=_0x30faa8||config[_0x834e('0x84')][_0x834e('0xc')];return new BPromise(function(_0x216105,_0x3821ad){_0x5a9c70(_0x36cc14,_0x2b1ec7,_0x4ca099)[_0x834e('0x51')](function(_0xe5c8f6){_0x216105(_0xe5c8f6);})['catch'](function(_0xdef8c4){_0x3821ad(_0xdef8c4);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x834e('0x88')](_0x834e('0x89'));}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0x834e('0x88')]();}function createJwt(_0x82f2a7){var _0x363cc2={'payload':{'iat':_0x82f2a7[_0x834e('0x6e')],'nonce':_0x82f2a7[_0x834e('0x6d')]},'options':{'algorithm':'HS512','subject':_0x82f2a7['id'][_0x834e('0x88')](),'issuer':hardwareConf[_0x834e('0x50')](),'audience':hardwareConf[_0x834e('0x50')]()}};return signJwt(_0x363cc2)[_0x834e('0x51')](function(_0x3181af){return{'iat':_0x82f2a7[_0x834e('0x6e')],'nonce':_0x82f2a7[_0x834e('0x6d')],'token':_0x3181af};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 796b380..5afb78c 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['map','findOne','slice','all','length','fieldType','type','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','where','user','ids','tag','countFilteredContacts','count','buildContactsQuery','clause','getFilteredContacts','rows','describe','CmContact','filter','startsWith','cf_'];(function(_0x16c7d7,_0x1ff2b9){var _0x269330=function(_0x38d9e0){while(--_0x38d9e0){_0x16c7d7['push'](_0x16c7d7['shift']());}};_0x269330(++_0x1ff2b9);}(_0x2032,0xd9));var _0x2203=function(_0x5c653d,_0x1a24ce){_0x5c653d=_0x5c653d-0x0;var _0x1ae64f=_0x2032[_0x5c653d];return _0x1ae64f;};'use strict';var _=require('lodash');var sqlUtils=require(_0x2203('0x0'));var db=require(_0x2203('0x1'))['db'];exports[_0x2203('0x2')]=function(_0x4c28da,_0x486390,_0x228a29,_0x4b4c7f){var _0x46c49a={'count':0x0,'rows':[]};var _0x880dcd=sqlUtils[_0x2203('0x3')](_0x486390,_0x4c28da);if(_0x880dcd){return Promise[_0x2203('0x4')](_0x46c49a);}var _0x3f7ba1=sqlUtils[_0x2203('0x5')]();var _0x2e0f63={};var _0x2676aa=![];var _0x18c4d6=![];return Promise[_0x2203('0x4')]()[_0x2203('0x6')](function(){if(_0x4c28da['search']){return sqlUtils['parseAdvancedSearchFilter'](_0x4c28da[_0x2203('0x7')],_0x4b4c7f);}else{return sqlUtils['parseQueryParameters'](_0x4c28da,_0x4b4c7f);}})[_0x2203('0x6')](function(_0x2972f3){_0x3f7ba1[_0x2203('0x8')](_0x2972f3['default']);_0x3f7ba1[_0x2203('0x8')](_0x2972f3['fields']);_0x3f7ba1[_0x2203('0x8')](_0x2972f3['filter']);_0x3f7ba1[_0x2203('0x8')](_0x2972f3[_0x2203('0x9')]['clause']);_0x2e0f63=_0x2972f3['tags'];_0x18c4d6=_0x2972f3['user']['skip'];return sqlUtils['checkListsRestrictions'](_0x486390,_0x4c28da,_0x18c4d6);})[_0x2203('0x6')](function(_0x538b30){_0x3f7ba1['where'](_0x538b30);var _0x21a3af=_0x4c28da[_0x2203('0x7')]?_0x2e0f63[_0x2203('0xa')]:_0x4c28da[_0x2203('0xb')];_0x2676aa=_0x21a3af?!![]:![];return sqlUtils[_0x2203('0xc')](_0x3f7ba1,_0x21a3af);})[_0x2203('0x6')](function(_0x2c36e6){_0x46c49a[_0x2203('0xd')]=_0x2c36e6;if(_0x46c49a[_0x2203('0xd')]===0x0){return;}return sqlUtils[_0x2203('0xe')](_0x3f7ba1,_0x4c28da['fields'],_0x228a29,_0x2676aa,_0x2e0f63[_0x2203('0xf')],_0x18c4d6);})[_0x2203('0x6')](function(_0x4893ff){if(!_0x4893ff){return[];}return sqlUtils[_0x2203('0x10')](_0x4893ff,_0x4c28da,_0x228a29);})[_0x2203('0x6')](function(_0x4aeb9f){_0x46c49a[_0x2203('0x11')]=_0x4aeb9f;return _0x46c49a;})['catch'](function(_0x2904ba){throw _0x2904ba;});};exports[_0x2203('0x12')]=function(){var _0x3c8c34={};var _0x3b4034=[];return db[_0x2203('0x13')][_0x2203('0x12')]()['then'](function(_0x13d3f7){_0x3c8c34=_0x13d3f7;var _0x50822b=Object['keys'](_0x3c8c34)[_0x2203('0x14')](function(_0x496d82){return _[_0x2203('0x15')](_0x496d82,_0x2203('0x16'))?_0x496d82:undefined;});var _0x5d4c4e=_0x50822b[_0x2203('0x17')](function(_0x5e29cd){return db['CmCustomField'][_0x2203('0x18')]({'where':{'id':_0x5e29cd[_0x2203('0x19')](0x3)},'raw':!![]});});return Promise[_0x2203('0x1a')](_0x5d4c4e);})[_0x2203('0x6')](function(_0x1244f4){for(var _0x3114ef=0x0;_0x3114ef<_0x1244f4[_0x2203('0x1b')];_0x3114ef++){if(_0x1244f4[_0x3114ef]){var _0x250349='cf_'+_0x1244f4[_0x3114ef]['id'];_0x3c8c34[_0x250349][_0x2203('0x1c')]=_0x1244f4[_0x3114ef][_0x2203('0x1d')];}}_0x3b4034=_[_0x2203('0x17')](Object['keys'](_0x3c8c34),function(_0xb2071b){return{'name':_0xb2071b,'type':_0x3c8c34[_0xb2071b][_0x2203('0x1d')]};});return _0x3b4034;})['catch'](function(_0xd6e109){throw _0xd6e109;});}; \ No newline at end of file +var _0x5f66=['buildContactsQuery','getFilteredContacts','catch','CmContact','keys','filter','cf_','CmCustomField','slice','all','length','./sql-utils','findAll','resolve','then','search','parseAdvancedSearchFilter','where','default','fields','clause','user','skip','checkListsRestrictions','ids','tag','count'];(function(_0x14132a,_0x583365){var _0x3d2d78=function(_0x1655a6){while(--_0x1655a6){_0x14132a['push'](_0x14132a['shift']());}};_0x3d2d78(++_0x583365);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5f66[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var sqlUtils=require(_0x65f6('0x0'));var db=require('../../mysqldb')['db'];exports[_0x65f6('0x1')]=function(_0x2f06ae,_0x3461cd,_0xbce843,_0x1a330c){var _0x5eb9ad={'count':0x0,'rows':[]};var _0x3c5029=sqlUtils['skipContactsQuery'](_0x3461cd,_0x2f06ae);if(_0x3c5029){return Promise[_0x65f6('0x2')](_0x5eb9ad);}var _0x22b017=sqlUtils['getContactsSubquery']();var _0x4ed98f={};var _0x1c0e12=![];var _0x2c6571=![];return Promise[_0x65f6('0x2')]()[_0x65f6('0x3')](function(){if(_0x2f06ae[_0x65f6('0x4')]){return sqlUtils[_0x65f6('0x5')](_0x2f06ae['search'],_0x1a330c);}else{return sqlUtils['parseQueryParameters'](_0x2f06ae,_0x1a330c);}})[_0x65f6('0x3')](function(_0x2f6d5b){_0x22b017[_0x65f6('0x6')](_0x2f6d5b[_0x65f6('0x7')]);_0x22b017['where'](_0x2f6d5b[_0x65f6('0x8')]);_0x22b017['where'](_0x2f6d5b['filter']);_0x22b017[_0x65f6('0x6')](_0x2f6d5b['user'][_0x65f6('0x9')]);_0x4ed98f=_0x2f6d5b['tags'];_0x2c6571=_0x2f6d5b[_0x65f6('0xa')][_0x65f6('0xb')];return sqlUtils[_0x65f6('0xc')](_0x3461cd,_0x2f06ae,_0x2c6571);})[_0x65f6('0x3')](function(_0x369f96){_0x22b017[_0x65f6('0x6')](_0x369f96);var _0x44144b=_0x2f06ae[_0x65f6('0x4')]?_0x4ed98f[_0x65f6('0xd')]:_0x2f06ae[_0x65f6('0xe')];_0x1c0e12=_0x44144b?!![]:![];return sqlUtils['countFilteredContacts'](_0x22b017,_0x44144b);})[_0x65f6('0x3')](function(_0x49a913){_0x5eb9ad['count']=_0x49a913;if(_0x5eb9ad[_0x65f6('0xf')]===0x0){return;}return sqlUtils[_0x65f6('0x10')](_0x22b017,_0x2f06ae[_0x65f6('0x8')],_0xbce843,_0x1c0e12,_0x4ed98f[_0x65f6('0x9')],_0x2c6571);})[_0x65f6('0x3')](function(_0x1f974c){if(!_0x1f974c){return[];}return sqlUtils[_0x65f6('0x11')](_0x1f974c,_0x2f06ae,_0xbce843);})[_0x65f6('0x3')](function(_0x495dd6){_0x5eb9ad['rows']=_0x495dd6;return _0x5eb9ad;})[_0x65f6('0x12')](function(_0x5b4055){throw _0x5b4055;});};exports['describe']=function(){var _0x5c5b91={};var _0x365159=[];return db[_0x65f6('0x13')]['describe']()[_0x65f6('0x3')](function(_0x270893){_0x5c5b91=_0x270893;var _0xbee6a4=Object[_0x65f6('0x14')](_0x5c5b91)[_0x65f6('0x15')](function(_0xc139c2){return _['startsWith'](_0xc139c2,_0x65f6('0x16'))?_0xc139c2:undefined;});var _0x4bb39e=_0xbee6a4['map'](function(_0x212247){return db[_0x65f6('0x17')]['findOne']({'where':{'id':_0x212247[_0x65f6('0x18')](0x3)},'raw':!![]});});return Promise[_0x65f6('0x19')](_0x4bb39e);})[_0x65f6('0x3')](function(_0x2774a1){for(var _0x4f5a69=0x0;_0x4f5a69<_0x2774a1[_0x65f6('0x1a')];_0x4f5a69++){if(_0x2774a1[_0x4f5a69]){var _0x59ea32=_0x65f6('0x16')+_0x2774a1[_0x4f5a69]['id'];_0x5c5b91[_0x59ea32]['fieldType']=_0x2774a1[_0x4f5a69]['type'];}}_0x365159=_['map'](Object[_0x65f6('0x14')](_0x5c5b91),function(_0x16cde8){return{'name':_0x16cde8,'type':_0x5c5b91[_0x16cde8]['type']};});return _0x365159;})[_0x65f6('0x12')](function(_0x28f710){throw _0x28f710;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 862de36..30e5a6c 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3da6=['Tag','findAll','color','keyBy','Sequelize','SELECT','CmContact','sequelize','toString','Tags','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','QueryTypes','exports','lodash','squel','../parsers/advancedSearch','../interaction/utils','role','agent','autocomplete','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','subqry','lastName','phone','mobile','fax','email','ListId','createdAt','updatedAt','TagIds','includes','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','length','find','name','dateOfBirth','fieldType','datetime','castTo','DATE','buildExpression','type','value','start','end','map','tags','clause','and','ids','User','user','uc.UserId\x20=\x20?','skip','some','compact','Contact','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','tag','filter','search','getLists','c.ListId\x20IN\x20?','attributes','group','c.id','limit','offset','subqry.id','having','order','DESC','subqry.'];(function(_0x244259,_0x229538){var _0x27cfc0=function(_0x163ec1){while(--_0x163ec1){_0x244259['push'](_0x244259['shift']());}};_0x27cfc0(++_0x229538);}(_0x3da6,0x1d8));var _0x63da=function(_0x1bf015,_0x340cc2){_0x1bf015=_0x1bf015-0x0;var _0x346543=_0x3da6[_0x1bf015];return _0x346543;};'use strict';var _=require(_0x63da('0x0'));var squel=require(_0x63da('0x1'));var as=require(_0x63da('0x2'));var qs=require('../parsers/qs');var utils=require(_0x63da('0x3'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0xad2839,_0x292d2b){var _0x449c25=![];if(_0xad2839[_0x63da('0x4')]===_0x63da('0x5')&&!_0x292d2b['search']&&!_0x292d2b['ListId']&&_0x292d2b[_0x63da('0x6')]!==_0x63da('0x7')){_0x449c25=!![];}return _0x449c25;}function getContactsSubquery(){return squel[_0x63da('0x8')]()[_0x63da('0x9')](_0x63da('0xa'),'c')[_0x63da('0xb')](_0x63da('0xc'));}function applyJoinClauses(_0x5c2353,_0x50cb7d){var _0x21a02c=_0x50cb7d?'c':'subqry';_0x5c2353[_0x63da('0xd')](_0x63da('0xe'),'uc',_0x63da('0xf')+_0x21a02c+_0x63da('0x10'))[_0x63da('0xd')](_0x63da('0x11'),'ct',_0x63da('0x12')+_0x21a02c+_0x63da('0x10'))[_0x63da('0xd')](_0x63da('0x13'),'t',_0x63da('0x14'));return _0x5c2353;}function addFieldsToQuery(_0x515411,_0x25fc8a,_0x30e34c,_0x25d598,_0x367683){var _0x3acbb4=_0x367683?'c':_0x63da('0x15');if(!_0x25fc8a){_0x25fc8a=['id','firstName',_0x63da('0x16'),_0x63da('0x17'),_0x63da('0x18'),_0x63da('0x19'),_0x63da('0x1a'),_0x63da('0x1b'),'CompanyId',_0x63da('0x1c'),_0x63da('0x1d'),'deletedAt',_0x63da('0x1e')];}else if(!_0x25fc8a[_0x63da('0x1f')]('id')){_0x25fc8a[_0x63da('0x20')]('id');}var _0x2c83ca=_0x30e34c&&_0x367683||!_0x30e34c&&!_0x367683;if(_0x25d598){_0x2c83ca=_0x25d598&&_0x367683||!_0x25d598&&!_0x367683;}_0x25fc8a[_0x63da('0x21')](function(_0x932b84){if(_0x932b84===_0x63da('0x1e')){if(_0x2c83ca){_0x515411[_0x63da('0x22')](_0x63da('0x23'),_0x932b84);}else if(_0x30e34c||_0x25d598){_0x515411[_0x63da('0x22')](_0x3acbb4+'.'+_0x932b84);}}else{_0x515411['field'](_0x3acbb4+'.'+_0x932b84);}});return _0x515411;}function getSqlClauses(){var _0x3fd8dc={'default':squel['expr'](),'fields':squel[_0x63da('0x24')](),'filter':squel[_0x63da('0x24')](),'tags':{'clause':squel['expr'](),'ids':null},'user':{'clause':squel[_0x63da('0x24')](),'skip':![]}};return _0x3fd8dc;}function parseTagParameter(_0x4bc0ed){var _0x52e41e=squel[_0x63da('0x24')]();if(_0x4bc0ed){var _0x404ebd=utils[_0x63da('0x25')](_0x4bc0ed);_0x404ebd['forEach'](function(_0xa8b746){_0x52e41e['or'](_0x63da('0x26'),'%,'+_0xa8b746+',%');});}return _0x52e41e;}function parseSearchFilter(_0x85147){var _0x318ec1=squel[_0x63da('0x24')]();if(_0x85147){var _0x1d894b=_0x85147['replace']('\x5c','\x5c\x5c')[_0x63da('0x27')](/'/g,'\x27\x27');if(_0x1d894b[_0x63da('0x28')]('\x20')['length']>0x1){_0x318ec1['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x63da('0x29')](_0x1d894b),null);}else{if(qs['isNumeric'](_0x1d894b)){_0x318ec1['or'](_0x63da('0x2a'),_0x1d894b+'%');_0x318ec1['or'](_0x63da('0x2b'),_0x1d894b+'%');_0x318ec1['or'](_0x63da('0x2c'),_0x1d894b+'%');_0x318ec1['or'](_0x63da('0x2d'),_0x1d894b+'%');}else if(qs[_0x63da('0x2e')](_0x1d894b)){_0x318ec1['or'](_0x63da('0x2f'),_0x1d894b+'%');}else{_0x318ec1['or'](_0x63da('0x30'),'%'+_0x1d894b+'%');_0x318ec1['or'](_0x63da('0x31'),'%'+_0x1d894b+'%');_0x318ec1['or']('c.email\x20LIKE\x20?','%'+_0x1d894b+'%');}}}return _0x318ec1;}function parseAdvancedSearchFilter(_0x1e0fc7,_0x5cfe03){var _0x552d80=getSqlClauses();var _0x15d2c2=as[_0x63da('0x32')](_0x1e0fc7);var _0x12ed05=_0x15d2c2[_0x63da('0x33')];for(var _0x3b657a=0x0;_0x3b657a<_0x15d2c2[_0x63da('0x34')][_0x63da('0x35')];_0x3b657a++){var _0x586d30=_0x15d2c2[_0x63da('0x34')][_0x3b657a];var _0x4ab71c='c';var _0x2acddc=_[_0x63da('0x36')](_0x5cfe03,[_0x63da('0x37'),_0x586d30['field']]);if(_0x2acddc){if(_0x586d30[_0x63da('0x22')]===_0x63da('0x38')||_0x2acddc[_0x63da('0x39')]===_0x63da('0x3a')){_0x586d30[_0x63da('0x3b')]=_0x63da('0x3c');}var _0x965cce=as[_0x63da('0x3d')](_0x4ab71c,_0x2acddc[_0x63da('0x3e')],_0x586d30);_0x552d80['default'][_0x12ed05](_0x965cce['text'],_0x965cce[_0x63da('0x3f')][_0x63da('0x40')],_0x965cce[_0x63da('0x3f')][_0x63da('0x41')]);}else{if(_0x586d30[_0x63da('0x22')]==='Tag'){var _0x200d52=_0x586d30[_0x63da('0x3f')][_0x63da('0x28')](',')[_0x63da('0x42')](function(_0x28028e){return Number(_0x28028e);});var _0x26bb5b=parseTagParameter(_0x200d52);_0x552d80[_0x63da('0x43')][_0x63da('0x44')][_0x63da('0x45')](_0x26bb5b);_0x552d80['tags'][_0x63da('0x46')]=_0x200d52;}else if(_0x586d30[_0x63da('0x22')]===_0x63da('0x47')){_0x552d80[_0x63da('0x48')][_0x63da('0x44')][_0x63da('0x45')](_0x63da('0x49'),_0x586d30[_0x63da('0x3f')]);_0x552d80['user'][_0x63da('0x4a')]=!![];}}}return _0x552d80;}function parseModelFields(_0x1685fb,_0x52cb84){var _0x42c3e3=squel[_0x63da('0x24')]();var _0x297dfe=_(_0x1685fb)['keys']()[_0x63da('0x42')](function(_0x288739){return _[_0x63da('0x4b')](_0x52cb84,['name',_0x288739])?_0x288739:undefined;})[_0x63da('0x4c')]()[_0x63da('0x3f')]();if(_0x1685fb[_0x63da('0x4d')]){_0x297dfe[_0x63da('0x20')](_0x63da('0x4d'));}if(_0x297dfe[_0x63da('0x35')]>0x0){_0x297dfe[_0x63da('0x21')](function(_0x27a37b){if(_0x27a37b===_0x63da('0x1b')){_0x42c3e3['and']('c.ListId\x20IN\x20?',[][_0x63da('0x4e')](_0x1685fb[_0x27a37b]));}else if(_0x27a37b===_0x63da('0x4d')){var _0x31cc32='%'+_0x1685fb[_0x27a37b]+'%';_0x42c3e3['and'](_0x63da('0x4f'),_0x31cc32);}else{_0x42c3e3[_0x63da('0x45')]('c.'+_0x27a37b+_0x63da('0x50'),_0x1685fb[_0x27a37b]);}});}return _0x42c3e3;}function parseQueryParameters(_0x13b52e,_0x2bcebd){var _0x4cd40e=getSqlClauses();return Promise[_0x63da('0x51')]()[_0x63da('0x52')](function(){return parseModelFields(_0x13b52e,_0x2bcebd);})['then'](function(_0x52fc1f){_0x4cd40e['fields'][_0x63da('0x45')](_0x52fc1f);return parseTagParameter(_0x13b52e[_0x63da('0x53')]);})[_0x63da('0x52')](function(_0x11f6f3){_0x4cd40e['tags']['clause'][_0x63da('0x45')](_0x11f6f3);return parseSearchFilter(_0x13b52e[_0x63da('0x54')]);})[_0x63da('0x52')](function(_0x4484c2){_0x4cd40e[_0x63da('0x54')]=_0x4484c2;return _0x4cd40e;});}function checkListsRestrictions(_0x2f758d,_0x29e119,_0x1309e1){var _0x2d532d=squel[_0x63da('0x24')]();return Promise['resolve']()[_0x63da('0x52')](function(){if(_0x29e119[_0x63da('0x55')]&&_0x2f758d[_0x63da('0x4')]===_0x63da('0x5')&&!_0x1309e1){return _0x2f758d[_0x63da('0x56')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x2b5449){if(_0x2b5449){if(_0x2b5449[_0x63da('0x35')]===0x0){_0x2d532d[_0x63da('0x45')]('c.ListId\x20IS\x20NULL');}else{_0x2d532d[_0x63da('0x45')](_0x63da('0x57'),_[_0x63da('0x42')](_0x2b5449,'id'));}}})[_0x63da('0x52')](function(){return _0x2d532d;});}function buildContactsQuery(_0x41bcc8,_0x342c6e,_0x5afcc9,_0x5280b6,_0x5c15f9,_0x39a54f){if(_0x342c6e){_0x342c6e=_0x5afcc9[_0x63da('0x58')];}_0x41bcc8=addFieldsToQuery(_0x41bcc8,_0x342c6e,_0x5280b6,_0x39a54f,!![]);var _0x110d75=squel[_0x63da('0x8')]();_0x110d75=addFieldsToQuery(_0x110d75,_0x342c6e,_0x5280b6,_0x39a54f,![]);if(_0x5280b6||_0x39a54f){_0x41bcc8=applyJoinClauses(_0x41bcc8,!![]);_0x41bcc8[_0x63da('0x59')](_0x63da('0x5a'));if(_0x5afcc9[_0x63da('0x5b')]){_0x110d75['limit'](_0x5afcc9[_0x63da('0x5b')]);}if(_0x5afcc9[_0x63da('0x5c')]){_0x110d75['offset'](_0x5afcc9['offset']);}}else{_0x110d75=applyJoinClauses(_0x110d75,![]);_0x110d75['group'](_0x63da('0x5d'));if(_0x5afcc9[_0x63da('0x5b')]){_0x41bcc8[_0x63da('0x5b')](_0x5afcc9[_0x63da('0x5b')]);}if(_0x5afcc9[_0x63da('0x5c')]){_0x41bcc8[_0x63da('0x5c')](_0x5afcc9['offset']);}}_0x110d75[_0x63da('0x5e')](_0x5c15f9);if(_0x5afcc9[_0x63da('0x5f')]){_0x5afcc9[_0x63da('0x5f')][_0x63da('0x21')](function(_0x474224){_0x41bcc8['order']('c.'+_0x474224[0x0],_0x474224[0x1]===_0x63da('0x60')?![]:!![]);_0x110d75[_0x63da('0x5f')](_0x63da('0x61')+_0x474224[0x0],_0x474224[0x1]===_0x63da('0x60')?![]:!![]);});}_0x110d75[_0x63da('0x9')](_0x41bcc8,_0x63da('0x15'));return _0x110d75;}function getFilteredContacts(_0x15dcbf){var _0x50cf07=[];return db[_0x63da('0x62')][_0x63da('0x63')]({'attributes':['id',_0x63da('0x37'),_0x63da('0x64')],'raw':!![]})[_0x63da('0x52')](function(_0x39f166){_0x50cf07=_[_0x63da('0x65')](_0x39f166,'id');var _0x1221f8={'type':db[_0x63da('0x66')]['QueryTypes'][_0x63da('0x67')],'model':db[_0x63da('0x68')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x63da('0x69')]['query'](_0x15dcbf[_0x63da('0x6a')](),_0x1221f8);})[_0x63da('0x52')](function(_0x37da9b){_0x37da9b[_0x63da('0x21')](function(_0x56cd9e){if(_0x56cd9e[_0x63da('0x1e')]){_0x56cd9e['Tags']=[];_0x56cd9e[_0x63da('0x1e')][_0x63da('0x28')](',')[_0x63da('0x21')](function(_0x4b0b3f){_0x56cd9e[_0x63da('0x6b')]['push'](_0x50cf07[_0x4b0b3f]);});}delete _0x56cd9e[_0x63da('0x1e')];});return _0x37da9b;});}function countFilteredContacts(_0x4e531a,_0x323c5f){var _0x509a77=_0x4e531a[_0x63da('0x6c')]();_0x509a77[_0x63da('0x22')](_0x63da('0x6d'));_0x509a77=applyJoinClauses(_0x509a77,!![]);_0x4e531a['group'](_0x63da('0x5a'));var _0x3677df=utils[_0x63da('0x25')](_0x323c5f);if(!_[_0x63da('0x6e')](_0x3677df)){_0x509a77[_0x63da('0xb')](_0x63da('0x6f'),_0x3677df);}var _0x2c15db={'type':db[_0x63da('0x66')][_0x63da('0x70')][_0x63da('0x67')],'raw':!![]};return db[_0x63da('0x69')]['query'](_0x509a77[_0x63da('0x6a')](),_0x2c15db)['then'](function(_0x3f9669){return _0x3f9669[0x0][_0x63da('0x6d')];});}module[_0x63da('0x71')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0xbcf8=['concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','then','fields','filter','getLists','c.ListId\x20IS\x20NULL','attributes','select','group','c.id','limit','offset','subqry.id','order','DESC','subqry.','from','findAll','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','query','toString','Tags','clone','COUNT(*)','getSelectedTags','t.id\x20IN\x20?','exports','lodash','../parsers/advancedSearch','../parsers/qs','../interaction/utils','role','search','autocomplete','where','c.deletedAt\x20IS\x20NULL','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','ct.CmContactId\x20=\x20','subqry','firstName','lastName','phone','fax','ListId','CompanyId','createdAt','deletedAt','TagIds','includes','push','field','expr','forEach','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','sqlOperator','conditions','find','dateOfBirth','fieldType','castTo','DATE','type','default','value','end','Tag','map','tags','and','ids','User','clause','uc.UserId\x20=\x20?','user','skip','keys','some','name','Contact','c.ListId\x20IN\x20?'];(function(_0x554dc7,_0x348a57){var _0x3d7bc6=function(_0x3dddea){while(--_0x3dddea){_0x554dc7['push'](_0x554dc7['shift']());}};_0x3d7bc6(++_0x348a57);}(_0xbcf8,0x1bb));var _0x8bcf=function(_0x1d8df8,_0x77eec5){_0x1d8df8=_0x1d8df8-0x0;var _0x6c0898=_0xbcf8[_0x1d8df8];return _0x6c0898;};'use strict';var _=require(_0x8bcf('0x0'));var squel=require('squel');var as=require(_0x8bcf('0x1'));var qs=require(_0x8bcf('0x2'));var utils=require(_0x8bcf('0x3'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x468efc,_0x27c835){var _0x405e83=![];if(_0x468efc[_0x8bcf('0x4')]==='agent'&&!_0x27c835[_0x8bcf('0x5')]&&!_0x27c835['ListId']&&_0x27c835[_0x8bcf('0x6')]!=='true'){_0x405e83=!![];}return _0x405e83;}function getContactsSubquery(){return squel['select']()['from']('cm_contacts','c')[_0x8bcf('0x7')](_0x8bcf('0x8'));}function applyJoinClauses(_0x4ced96,_0x1fc2a6){var _0x562bf6=_0x1fc2a6?'c':'subqry';_0x4ced96[_0x8bcf('0x9')](_0x8bcf('0xa'),'uc',_0x8bcf('0xb')+_0x562bf6+_0x8bcf('0xc'))['left_join']('cm_contact_has_tags','ct',_0x8bcf('0xd')+_0x562bf6+'.id')[_0x8bcf('0x9')]('tools_tags','t','t.id\x20=\x20ct.TagId');return _0x4ced96;}function addFieldsToQuery(_0x3ced3f,_0x52758b,_0x55e291,_0x4b7e82,_0x4a13be){var _0x4bbb50=_0x4a13be?'c':_0x8bcf('0xe');if(!_0x52758b){_0x52758b=['id',_0x8bcf('0xf'),_0x8bcf('0x10'),_0x8bcf('0x11'),'mobile',_0x8bcf('0x12'),'email',_0x8bcf('0x13'),_0x8bcf('0x14'),_0x8bcf('0x15'),'updatedAt',_0x8bcf('0x16'),_0x8bcf('0x17')];}else if(!_0x52758b[_0x8bcf('0x18')]('id')){_0x52758b[_0x8bcf('0x19')]('id');}var _0x2b1f8a=_0x55e291&&_0x4a13be||!_0x55e291&&!_0x4a13be;if(_0x4b7e82){_0x2b1f8a=_0x4b7e82&&_0x4a13be||!_0x4b7e82&&!_0x4a13be;}_0x52758b['forEach'](function(_0x4309b8){if(_0x4309b8==='TagIds'){if(_0x2b1f8a){_0x3ced3f[_0x8bcf('0x1a')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x4309b8);}else if(_0x55e291||_0x4b7e82){_0x3ced3f['field'](_0x4bbb50+'.'+_0x4309b8);}}else{_0x3ced3f[_0x8bcf('0x1a')](_0x4bbb50+'.'+_0x4309b8);}});return _0x3ced3f;}function getSqlClauses(){var _0x49290b={'default':squel[_0x8bcf('0x1b')](),'fields':squel[_0x8bcf('0x1b')](),'filter':squel[_0x8bcf('0x1b')](),'tags':{'clause':squel['expr'](),'ids':null},'user':{'clause':squel[_0x8bcf('0x1b')](),'skip':![]}};return _0x49290b;}function parseTagParameter(_0x4f9f81){var _0x55850b=squel[_0x8bcf('0x1b')]();if(_0x4f9f81){var _0x473186=utils['getSelectedTags'](_0x4f9f81);_0x473186[_0x8bcf('0x1c')](function(_0x4cd859){_0x55850b['or'](_0x8bcf('0x1d'),'%,'+_0x4cd859+',%');});}return _0x55850b;}function parseSearchFilter(_0x4dfe93){var _0x205c35=squel[_0x8bcf('0x1b')]();if(_0x4dfe93){var _0x4dad0b=_0x4dfe93[_0x8bcf('0x1e')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x4dad0b[_0x8bcf('0x1f')]('\x20')[_0x8bcf('0x20')]>0x1){_0x205c35['or'](_0x8bcf('0x21'),qs[_0x8bcf('0x22')](_0x4dad0b),null);}else{if(qs['isNumeric'](_0x4dad0b)){_0x205c35['or'](_0x8bcf('0x23'),_0x4dad0b+'%');_0x205c35['or'](_0x8bcf('0x24'),_0x4dad0b+'%');_0x205c35['or']('c.mobile\x20LIKE\x20?',_0x4dad0b+'%');_0x205c35['or'](_0x8bcf('0x25'),_0x4dad0b+'%');}else if(qs[_0x8bcf('0x26')](_0x4dad0b)){_0x205c35['or'](_0x8bcf('0x27'),_0x4dad0b+'%');}else{_0x205c35['or'](_0x8bcf('0x28'),'%'+_0x4dad0b+'%');_0x205c35['or']('c.lastName\x20LIKE\x20?','%'+_0x4dad0b+'%');_0x205c35['or'](_0x8bcf('0x27'),'%'+_0x4dad0b+'%');}}}return _0x205c35;}function parseAdvancedSearchFilter(_0x2caeca,_0x287177){var _0x28a825=getSqlClauses();var _0x1d3634=as['parseSearch'](_0x2caeca);var _0x230ab9=_0x1d3634[_0x8bcf('0x29')];for(var _0x5b729e=0x0;_0x5b729e<_0x1d3634[_0x8bcf('0x2a')][_0x8bcf('0x20')];_0x5b729e++){var _0x24f952=_0x1d3634['conditions'][_0x5b729e];var _0x1aa28f='c';var _0x40f3a7=_[_0x8bcf('0x2b')](_0x287177,['name',_0x24f952[_0x8bcf('0x1a')]]);if(_0x40f3a7){if(_0x24f952[_0x8bcf('0x1a')]===_0x8bcf('0x2c')||_0x40f3a7[_0x8bcf('0x2d')]==='datetime'){_0x24f952[_0x8bcf('0x2e')]=_0x8bcf('0x2f');}var _0x14d34d=as['buildExpression'](_0x1aa28f,_0x40f3a7[_0x8bcf('0x30')],_0x24f952);_0x28a825[_0x8bcf('0x31')][_0x230ab9](_0x14d34d['text'],_0x14d34d[_0x8bcf('0x32')]['start'],_0x14d34d[_0x8bcf('0x32')][_0x8bcf('0x33')]);}else{if(_0x24f952['field']===_0x8bcf('0x34')){var _0x408944=_0x24f952[_0x8bcf('0x32')][_0x8bcf('0x1f')](',')[_0x8bcf('0x35')](function(_0x507298){return Number(_0x507298);});var _0x21ac3f=parseTagParameter(_0x408944);_0x28a825[_0x8bcf('0x36')]['clause'][_0x8bcf('0x37')](_0x21ac3f);_0x28a825[_0x8bcf('0x36')][_0x8bcf('0x38')]=_0x408944;}else if(_0x24f952[_0x8bcf('0x1a')]===_0x8bcf('0x39')){_0x28a825['user'][_0x8bcf('0x3a')]['and'](_0x8bcf('0x3b'),_0x24f952['value']);_0x28a825[_0x8bcf('0x3c')][_0x8bcf('0x3d')]=!![];}}}return _0x28a825;}function parseModelFields(_0x5df8c4,_0x52ffe0){var _0x1fdc98=squel[_0x8bcf('0x1b')]();var _0x28f3bb=_(_0x5df8c4)[_0x8bcf('0x3e')]()['map'](function(_0x1b326a){return _[_0x8bcf('0x3f')](_0x52ffe0,[_0x8bcf('0x40'),_0x1b326a])?_0x1b326a:undefined;})['compact']()[_0x8bcf('0x32')]();if(_0x5df8c4['Contact']){_0x28f3bb['push'](_0x8bcf('0x41'));}if(_0x28f3bb[_0x8bcf('0x20')]>0x0){_0x28f3bb[_0x8bcf('0x1c')](function(_0x1c658a){if(_0x1c658a===_0x8bcf('0x13')){_0x1fdc98[_0x8bcf('0x37')](_0x8bcf('0x42'),[][_0x8bcf('0x43')](_0x5df8c4[_0x1c658a]));}else if(_0x1c658a===_0x8bcf('0x41')){var _0x4ffc26='%'+_0x5df8c4[_0x1c658a]+'%';_0x1fdc98[_0x8bcf('0x37')](_0x8bcf('0x44'),_0x4ffc26);}else{_0x1fdc98[_0x8bcf('0x37')]('c.'+_0x1c658a+_0x8bcf('0x45'),_0x5df8c4[_0x1c658a]);}});}return _0x1fdc98;}function parseQueryParameters(_0x42aabc,_0x2771b6){var _0x57e24d=getSqlClauses();return Promise['resolve']()[_0x8bcf('0x46')](function(){return parseModelFields(_0x42aabc,_0x2771b6);})['then'](function(_0x32702f){_0x57e24d[_0x8bcf('0x47')][_0x8bcf('0x37')](_0x32702f);return parseTagParameter(_0x42aabc['tag']);})[_0x8bcf('0x46')](function(_0x78257a){_0x57e24d[_0x8bcf('0x36')][_0x8bcf('0x3a')][_0x8bcf('0x37')](_0x78257a);return parseSearchFilter(_0x42aabc[_0x8bcf('0x48')]);})[_0x8bcf('0x46')](function(_0x4ebaf3){_0x57e24d['filter']=_0x4ebaf3;return _0x57e24d;});}function checkListsRestrictions(_0x2f9525,_0x13c00f,_0x3b12f7){var _0x304d48=squel[_0x8bcf('0x1b')]();return Promise['resolve']()[_0x8bcf('0x46')](function(){if(_0x13c00f[_0x8bcf('0x5')]&&_0x2f9525[_0x8bcf('0x4')]==='agent'&&!_0x3b12f7){return _0x2f9525[_0x8bcf('0x49')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x248ebb){if(_0x248ebb){if(_0x248ebb[_0x8bcf('0x20')]===0x0){_0x304d48[_0x8bcf('0x37')](_0x8bcf('0x4a'));}else{_0x304d48[_0x8bcf('0x37')]('c.ListId\x20IN\x20?',_[_0x8bcf('0x35')](_0x248ebb,'id'));}}})[_0x8bcf('0x46')](function(){return _0x304d48;});}function buildContactsQuery(_0x3735ea,_0x524850,_0x450850,_0x32063b,_0x5b2725,_0x10f58d){if(_0x524850){_0x524850=_0x450850[_0x8bcf('0x4b')];}_0x3735ea=addFieldsToQuery(_0x3735ea,_0x524850,_0x32063b,_0x10f58d,!![]);var _0x19797e=squel[_0x8bcf('0x4c')]();_0x19797e=addFieldsToQuery(_0x19797e,_0x524850,_0x32063b,_0x10f58d,![]);if(_0x32063b||_0x10f58d){_0x3735ea=applyJoinClauses(_0x3735ea,!![]);_0x3735ea[_0x8bcf('0x4d')](_0x8bcf('0x4e'));if(_0x450850[_0x8bcf('0x4f')]){_0x19797e[_0x8bcf('0x4f')](_0x450850[_0x8bcf('0x4f')]);}if(_0x450850['offset']){_0x19797e['offset'](_0x450850[_0x8bcf('0x50')]);}}else{_0x19797e=applyJoinClauses(_0x19797e,![]);_0x19797e['group'](_0x8bcf('0x51'));if(_0x450850[_0x8bcf('0x4f')]){_0x3735ea[_0x8bcf('0x4f')](_0x450850[_0x8bcf('0x4f')]);}if(_0x450850[_0x8bcf('0x50')]){_0x3735ea[_0x8bcf('0x50')](_0x450850['offset']);}}_0x19797e['having'](_0x5b2725);if(_0x450850[_0x8bcf('0x52')]){_0x450850[_0x8bcf('0x52')][_0x8bcf('0x1c')](function(_0x390a9b){_0x3735ea['order']('c.'+_0x390a9b[0x0],_0x390a9b[0x1]===_0x8bcf('0x53')?![]:!![]);_0x19797e[_0x8bcf('0x52')](_0x8bcf('0x54')+_0x390a9b[0x0],_0x390a9b[0x1]===_0x8bcf('0x53')?![]:!![]);});}_0x19797e[_0x8bcf('0x55')](_0x3735ea,_0x8bcf('0xe'));return _0x19797e;}function getFilteredContacts(_0x21cbf3){var _0x499dd5=[];return db[_0x8bcf('0x34')][_0x8bcf('0x56')]({'attributes':['id',_0x8bcf('0x40'),_0x8bcf('0x57')],'raw':!![]})['then'](function(_0x199a81){_0x499dd5=_[_0x8bcf('0x58')](_0x199a81,'id');var _0x59e99b={'type':db[_0x8bcf('0x59')][_0x8bcf('0x5a')][_0x8bcf('0x5b')],'model':db[_0x8bcf('0x5c')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x8bcf('0x5d')][_0x8bcf('0x5e')](_0x21cbf3[_0x8bcf('0x5f')](),_0x59e99b);})['then'](function(_0x43868d){_0x43868d['forEach'](function(_0x290d2e){if(_0x290d2e['TagIds']){_0x290d2e[_0x8bcf('0x60')]=[];_0x290d2e['TagIds'][_0x8bcf('0x1f')](',')['forEach'](function(_0x19bc8a){_0x290d2e['Tags'][_0x8bcf('0x19')](_0x499dd5[_0x19bc8a]);});}delete _0x290d2e[_0x8bcf('0x17')];});return _0x43868d;});}function countFilteredContacts(_0x1f40f3,_0x346541){var _0x17434c=_0x1f40f3[_0x8bcf('0x61')]();_0x17434c[_0x8bcf('0x1a')](_0x8bcf('0x62'));_0x17434c=applyJoinClauses(_0x17434c,!![]);_0x1f40f3[_0x8bcf('0x4d')]('c.id');var _0x3e5c2d=utils[_0x8bcf('0x63')](_0x346541);if(!_['isEmpty'](_0x3e5c2d)){_0x17434c[_0x8bcf('0x7')](_0x8bcf('0x64'),_0x3e5c2d);}var _0x598a2f={'type':db[_0x8bcf('0x59')][_0x8bcf('0x5a')][_0x8bcf('0x5b')],'raw':!![]};return db[_0x8bcf('0x5d')][_0x8bcf('0x5e')](_0x17434c[_0x8bcf('0x5f')](),_0x598a2f)['then'](function(_0x583018){return _0x583018[0x0][_0x8bcf('0x62')];});}module[_0x8bcf('0x65')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 9f991f0..9208bee 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 _0xb3b3=['algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createWriteStream','data','update','binary','write','end','final','close','decryptFile','createDecipher','unlink','encryptString','createCipher','utf8','base64','secret','crypto','bluebird','../../config/logger','secrets','aes-256-ctr','aes192','encrypt'];(function(_0x567f8a,_0x1ad54d){var _0x3d3d08=function(_0x16085f){while(--_0x16085f){_0x567f8a['push'](_0x567f8a['shift']());}};_0x3d3d08(++_0x1ad54d);}(_0xb3b3,0x16d));var _0x3b3b=function(_0x52e345,_0x3f8a9c){_0x52e345=_0x52e345-0x0;var _0xb727c6=_0xb3b3[_0x52e345];return _0xb727c6;};'use strict';var crypto=require(_0x3b3b('0x0'));var fs=require('fs');var BPromise=require(_0x3b3b('0x1'));var _=require('lodash');var config=require('../../config/environment');var logger=require(_0x3b3b('0x2'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x3b3b('0x3')]['session'],'algorithm':_0x3b3b('0x4')};const fileOptions={'algorithm':_0x3b3b('0x5')};if(config[_0x3b3b('0x6')]&&config[_0x3b3b('0x6')][_0x3b3b('0x7')]){var isSupported=isAlgorithmSupported(config[_0x3b3b('0x6')][_0x3b3b('0x7')]);if(isSupported){fileOptions[_0x3b3b('0x7')]=config[_0x3b3b('0x6')][_0x3b3b('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x3b3b('0x8')](',\x20');logger['error'](config[_0x3b3b('0x6')][_0x3b3b('0x7')],_0x3b3b('0x9'),supportedAlgorithms);}}function isASupportedCipher(_0x38291d){return AES_SUPPORTED_RX['test'](_0x38291d);}function getSupportedCiphers(){return crypto[_0x3b3b('0xa')]()[_0x3b3b('0xb')](isASupportedCipher);}function isAlgorithmSupported(_0x3afdae){return getSupportedCiphers()[_0x3b3b('0xc')](_0x3afdae)>-0x1;}function combineOptions(_0x400d17){var _0xf6b915={};for(var _0x4e5911 in fileOptions){if(fileOptions[_0x3b3b('0xd')](_0x4e5911)){_0xf6b915[_0x4e5911]=fileOptions[_0x4e5911];}}if(_0x400d17){for(var _0x1b044d in _0x400d17){if(_0x400d17['hasOwnProperty'](_0x1b044d)){_0xf6b915[_0x1b044d]=_0x400d17[_0x1b044d];}}}return _0xf6b915;}exports[_0x3b3b('0xe')]=function(_0x9d8732,_0x3db95c,_0x2e1111,_0x5f0a67){return new BPromise(function(_0x49ec7f,_0x1c3dc7){_0x5f0a67=combineOptions(_0x5f0a67);var _0x44ed96=new Buffer(_0x2e1111);var _0x59b4e3=fs['createReadStream'](_0x9d8732);var _0xa1b7e=fs[_0x3b3b('0xf')](_0x3db95c);var _0x263258=crypto['createCipher'](_0x5f0a67[_0x3b3b('0x7')],_0x44ed96);_0x59b4e3['on'](_0x3b3b('0x10'),function(_0x52592f){var _0x5bcc46=new Buffer(_0x263258[_0x3b3b('0x11')](_0x52592f),_0x3b3b('0x12'));_0xa1b7e[_0x3b3b('0x13')](_0x5bcc46);});_0x59b4e3['on'](_0x3b3b('0x14'),function(){try{var _0x5614a0=new Buffer(_0x263258[_0x3b3b('0x15')]('binary'),'binary');_0xa1b7e[_0x3b3b('0x13')](_0x5614a0);_0xa1b7e[_0x3b3b('0x14')]();_0xa1b7e['on'](_0x3b3b('0x16'),function(){return _0x49ec7f(_0x3db95c);});}catch(_0x43625d){fs['unlink'](_0x3db95c);return _0x1c3dc7(_0x43625d);}});});};exports[_0x3b3b('0x17')]=function(_0x38dd2d,_0x456217,_0x42be73,_0x467eda){return new BPromise(function(_0x23bd64,_0x6cdb4){_0x467eda=combineOptions(_0x467eda);var _0x3a6de0=new Buffer(_0x42be73);var _0x4e4bd6=fs['createReadStream'](_0x38dd2d);var _0x3b20e2=fs[_0x3b3b('0xf')](_0x456217);var _0x21ff20=crypto[_0x3b3b('0x18')](_0x467eda['algorithm'],_0x3a6de0);_0x4e4bd6['on'](_0x3b3b('0x10'),function(_0x56c666){var _0x3badff=new Buffer(_0x21ff20['update'](_0x56c666),_0x3b3b('0x12'));_0x3b20e2[_0x3b3b('0x13')](_0x3badff);});_0x4e4bd6['on'](_0x3b3b('0x14'),function(){try{var _0x3e43f4=new Buffer(_0x21ff20[_0x3b3b('0x15')](_0x3b3b('0x12')),_0x3b3b('0x12'));_0x3b20e2[_0x3b3b('0x13')](_0x3e43f4);_0x3b20e2[_0x3b3b('0x14')]();_0x3b20e2['on'](_0x3b3b('0x16'),function(){return _0x23bd64(_0x456217);});}catch(_0x4d1162){fs[_0x3b3b('0x19')](_0x456217);return _0x6cdb4(_0x4d1162);}});});};exports[_0x3b3b('0x1a')]=function(_0x155f42,_0x4be2c0,_0x1b094c){var _0xe2728b=_0x1b094c||stringOptions[_0x3b3b('0x7')];var _0x58723f=_0x4be2c0||stringOptions['secret'];var _0xd32ff6=crypto[_0x3b3b('0x1b')](_0xe2728b,_0x58723f);var _0x4809d5=_0xd32ff6[_0x3b3b('0x11')](_0x155f42,_0x3b3b('0x1c'),_0x3b3b('0x1d'));_0x4809d5+=_0xd32ff6[_0x3b3b('0x15')](_0x3b3b('0x1d'));return _0x4809d5;};exports['decryptString']=function(_0x503a9f,_0x2320aa,_0x1f9091){var _0x1cbc86=_0x1f9091||stringOptions[_0x3b3b('0x7')];var _0x4faa51=_0x2320aa||stringOptions[_0x3b3b('0x1e')];var _0x26feb4=crypto[_0x3b3b('0x18')](_0x1cbc86,_0x4faa51);var _0x3df84b=_0x26feb4[_0x3b3b('0x11')](_0x503a9f,'base64',_0x3b3b('0x1c'));_0x3df84b+=_0x26feb4[_0x3b3b('0x15')](_0x3b3b('0x1c'));return _0x3df84b;}; \ No newline at end of file +var _0x19dd=['../../config/environment','../../config/logger','app','secrets','session','encrypt','algorithm','join','test','getCiphers','filter','indexOf','createCipher','binary','write','end','final','close','createReadStream','createWriteStream','createDecipher','data','update','utf8','base64','decryptString','secret','crypto','lodash'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0x19dd,0x194));var _0xd19d=function(_0x4096be,_0x1a7ca1){_0x4096be=_0x4096be-0x0;var _0x1455bd=_0x19dd[_0x4096be];return _0x1455bd;};'use strict';var crypto=require(_0xd19d('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0xd19d('0x1'));var config=require(_0xd19d('0x2'));var logger=require(_0xd19d('0x3'))(_0xd19d('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xd19d('0x5')][_0xd19d('0x6')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':'aes192'};if(config[_0xd19d('0x7')]&&config['encrypt'][_0xd19d('0x8')]){var isSupported=isAlgorithmSupported(config[_0xd19d('0x7')]['algorithm']);if(isSupported){fileOptions[_0xd19d('0x8')]=config['encrypt'][_0xd19d('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xd19d('0x9')](',\x20');logger['error'](config['encrypt'][_0xd19d('0x8')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x1673b6){return AES_SUPPORTED_RX[_0xd19d('0xa')](_0x1673b6);}function getSupportedCiphers(){return crypto[_0xd19d('0xb')]()[_0xd19d('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x4cc3e7){return getSupportedCiphers()[_0xd19d('0xd')](_0x4cc3e7)>-0x1;}function combineOptions(_0x38912b){var _0x3f0424={};for(var _0x41b5fb in fileOptions){if(fileOptions['hasOwnProperty'](_0x41b5fb)){_0x3f0424[_0x41b5fb]=fileOptions[_0x41b5fb];}}if(_0x38912b){for(var _0x331d0e in _0x38912b){if(_0x38912b['hasOwnProperty'](_0x331d0e)){_0x3f0424[_0x331d0e]=_0x38912b[_0x331d0e];}}}return _0x3f0424;}exports['encryptFile']=function(_0x13ccbe,_0x5435b1,_0x373575,_0x17547b){return new BPromise(function(_0x11af01,_0x1231f2){_0x17547b=combineOptions(_0x17547b);var _0x554771=new Buffer(_0x373575);var _0x4ba012=fs['createReadStream'](_0x13ccbe);var _0x30940=fs['createWriteStream'](_0x5435b1);var _0x3dae33=crypto[_0xd19d('0xe')](_0x17547b[_0xd19d('0x8')],_0x554771);_0x4ba012['on']('data',function(_0x20ea58){var _0x2549a5=new Buffer(_0x3dae33['update'](_0x20ea58),_0xd19d('0xf'));_0x30940[_0xd19d('0x10')](_0x2549a5);});_0x4ba012['on'](_0xd19d('0x11'),function(){try{var _0x1fddea=new Buffer(_0x3dae33[_0xd19d('0x12')](_0xd19d('0xf')),'binary');_0x30940[_0xd19d('0x10')](_0x1fddea);_0x30940['end']();_0x30940['on'](_0xd19d('0x13'),function(){return _0x11af01(_0x5435b1);});}catch(_0x3571f4){fs['unlink'](_0x5435b1);return _0x1231f2(_0x3571f4);}});});};exports['decryptFile']=function(_0x3e0e3c,_0x3f6f4d,_0x391592,_0x20b914){return new BPromise(function(_0x47009f,_0x393a1f){_0x20b914=combineOptions(_0x20b914);var _0x501879=new Buffer(_0x391592);var _0x551b8f=fs[_0xd19d('0x14')](_0x3e0e3c);var _0x119111=fs[_0xd19d('0x15')](_0x3f6f4d);var _0x2f9cc6=crypto[_0xd19d('0x16')](_0x20b914['algorithm'],_0x501879);_0x551b8f['on'](_0xd19d('0x17'),function(_0x56c6cc){var _0x30ff16=new Buffer(_0x2f9cc6['update'](_0x56c6cc),_0xd19d('0xf'));_0x119111[_0xd19d('0x10')](_0x30ff16);});_0x551b8f['on'](_0xd19d('0x11'),function(){try{var _0x49f9c6=new Buffer(_0x2f9cc6[_0xd19d('0x12')]('binary'),_0xd19d('0xf'));_0x119111[_0xd19d('0x10')](_0x49f9c6);_0x119111[_0xd19d('0x11')]();_0x119111['on']('close',function(){return _0x47009f(_0x3f6f4d);});}catch(_0x2a4ee5){fs['unlink'](_0x3f6f4d);return _0x393a1f(_0x2a4ee5);}});});};exports['encryptString']=function(_0x4c6786,_0x262d4b,_0x397997){var _0x4b41c7=_0x397997||stringOptions[_0xd19d('0x8')];var _0x54c879=_0x262d4b||stringOptions['secret'];var _0x5ae239=crypto[_0xd19d('0xe')](_0x4b41c7,_0x54c879);var _0xe6b96c=_0x5ae239[_0xd19d('0x18')](_0x4c6786,_0xd19d('0x19'),'base64');_0xe6b96c+=_0x5ae239[_0xd19d('0x12')](_0xd19d('0x1a'));return _0xe6b96c;};exports[_0xd19d('0x1b')]=function(_0x204057,_0x215ed0,_0x3d0afc){var _0x19eb56=_0x3d0afc||stringOptions[_0xd19d('0x8')];var _0xf301a8=_0x215ed0||stringOptions[_0xd19d('0x1c')];var _0xb12032=crypto[_0xd19d('0x16')](_0x19eb56,_0xf301a8);var _0x2b4f15=_0xb12032[_0xd19d('0x18')](_0x204057,'base64',_0xd19d('0x19'));_0x2b4f15+=_0xb12032['final'](_0xd19d('0x19'));return _0x2b4f15;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index f622a40..3fc5150 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 _0xc31a=['Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','length','range','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','.csv','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch'];(function(_0x1c66f7,_0x2358a4){var _0x4de878=function(_0x259432){while(--_0x259432){_0x1c66f7['push'](_0x1c66f7['shift']());}};_0x4de878(++_0x2358a4);}(_0xc31a,0x15a));var _0xac31=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc31a[_0x14add3];return _0x4a174f;};'use strict';var util=require('util');var path=require(_0xac31('0x0'));var _=require(_0xac31('0x1'));var csv=require(_0xac31('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xac31('0x3'));var rimraf=require(_0xac31('0x4'));var db=require(_0xac31('0x5'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0xac31('0x6'))(_0xac31('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xac31('0x8')][0x2]);var QUERY=process[_0xac31('0x8')][0x3];var PATH=process[_0xac31('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4d8d81,_0x26aa14){var _0x3efc58={'status':_0x4d8d81};var _0x1a38da={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x26aa14){_0x3efc58[_0xac31('0x9')]=_0x26aa14;}return db['AnalyticExtractedReport'][_0xac31('0xa')](_0x3efc58,_0x1a38da);}function main(){var _0x3671a5=0x1388;var _0x48a693;logger[_0xac31('0xb')](util[_0xac31('0xc')](_0xac31('0xd'),EXTRACTED_REPORT_ID,_0xac31('0xe')));return db[_0xac31('0xf')][_0xac31('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xac31('0x11'),_0xac31('0x12')]})[_0xac31('0x13')](function(_0x334d75){if(_0x334d75){_0x48a693=_0x334d75;_0x3671a5=_0x48a693[_0xac31('0x12')]||0x1388;}})[_0xac31('0x13')](function(){return dbH[_0xac31('0x14')][_0xac31('0x15')](util[_0xac31('0xc')](_0xac31('0x16'),QUERY),{'type':dbH[_0xac31('0x14')]['QueryTypes'][_0xac31('0x17')]});})[_0xac31('0x13')](function(_0xb5134e){if(!_0xb5134e[0x0][_0xac31('0x18')]){return analyticExtractedReport(_0xac31('0x19'));}var _0x2d4175=[];var _0x2a64d9=0x0;if(_0x48a693[_0xac31('0x11')]){if(_0xb5134e&&_0xb5134e[_0xac31('0x1a')]){var _0x3d577b=_[_0xac31('0x1b')](_0xb5134e[0x0][_0xac31('0x18')]/_0x3671a5);var _0x52cc89=Number[_0xac31('0x1c')](_0xb5134e[0x0][_0xac31('0x18')]/_0x3671a5)?_0xb5134e[0x0]['num']%_0x3671a5:0x0;_0x3d577b['forEach'](function(_0xeb363d){if(_0xeb363d>0x0){_0x2a64d9+=_0x3671a5;}_0x2d4175[_0xac31('0x1d')](dbH['sequelize'][_0xac31('0x15')](util[_0xac31('0xc')](_0xac31('0x1e'),QUERY,_0x3671a5,_0x2a64d9),{'type':dbH[_0xac31('0x14')]['QueryTypes']['SELECT']}));});if(_0x52cc89>0x0){_0x2a64d9+=_0x3671a5;_0x2d4175[_0xac31('0x1d')](dbH[_0xac31('0x14')][_0xac31('0x15')](util[_0xac31('0xc')](_0xac31('0x1e'),QUERY,_0x52cc89,_0x2a64d9),{'type':dbH[_0xac31('0x14')][_0xac31('0x1f')]['SELECT']}));}}}else{_0x2d4175['push'](dbH[_0xac31('0x14')][_0xac31('0x15')](QUERY,{'type':dbH[_0xac31('0x14')][_0xac31('0x1f')][_0xac31('0x17')]}));}var _0x434aa0=path[_0xac31('0x20')](PATH);var _0x51903f=path['basename'](PATH,_0xac31('0x21'));var _0xbfe686=_0x48a693[_0xac31('0x11')]&&_0x2d4175[_0xac31('0x1a')]>0x1;var _0x305b5f=[];if(!fs['existsSync'](path[_0xac31('0x22')](_0x434aa0,_0x51903f))&&_0xbfe686){fs[_0xac31('0x23')](path[_0xac31('0x22')](_0x434aa0,_0x51903f));}return BPromise[_0xac31('0x24')](_0x2d4175,function(_0x20ab2d){_0x305b5f[_0xac31('0x1d')](_0x20ab2d);})[_0xac31('0x13')](function(){for(var _0x53e732=0x0;_0x53e732<_0x305b5f['length'];_0x53e732+=0x1){var _0x5b25b9;var _0x8de7c0=_0x305b5f[_0x53e732];if(_0xbfe686){_0x5b25b9=path[_0xac31('0x22')](_0x434aa0,_0x51903f,util[_0xac31('0xc')](_0xac31('0x25'),_0x51903f,_0x53e732,_0xac31('0x26')));}else{_0x5b25b9=path[_0xac31('0x22')](_0x434aa0,util[_0xac31('0xc')](_0xac31('0x27'),_0x51903f,_0xac31('0x26')));}fs[_0xac31('0x28')](_0x5b25b9,csv(_0x8de7c0));}})[_0xac31('0x13')](function(){if(_0xbfe686){return new Promise(function(_0x57b831){zipdir(path[_0xac31('0x22')](_0x434aa0,_0x51903f),{'saveTo':path['join'](_0x434aa0,util[_0xac31('0xc')](_0xac31('0x27'),_0x51903f,'zip'))},function(_0x32bc7a,_0x1eef1e){rimraf(path[_0xac31('0x22')](_0x434aa0,_0x51903f),function(){});_0x57b831(_0xac31('0x29'));});});}})[_0xac31('0x13')](function(){logger[_0xac31('0xb')](util[_0xac31('0xc')](_0xac31('0x2a'),EXTRACTED_REPORT_ID,_0xac31('0xe')));return analyticExtractedReport(_0xac31('0x2b'),_0xbfe686?util[_0xac31('0xc')](_0xac31('0x27'),_0x51903f,_0xbfe686?_0xac31('0x2c'):'csv'):null);});})[_0xac31('0x2d')](function(_0x441378){logger[_0xac31('0xb')](util[_0xac31('0xc')](_0xac31('0x2e'),EXTRACTED_REPORT_ID,_0xac31('0xe')),util['inspect'](_0x441378,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xac31('0x2f'));})[_0xac31('0x30')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0xe395=['CSV','Setting','split','splitSizeCsv','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','length','range','forEach','push','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.csv','existsSync','join','mkdirSync','each','%s%d.%s','csv','writeFileSync','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','exit','util','path','to-csv','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','info','format'];(function(_0xe33aea,_0x5a6404){var _0x432f7e=function(_0x267399){while(--_0x267399){_0xe33aea['push'](_0xe33aea['shift']());}};_0x432f7e(++_0x5a6404);}(_0xe395,0xb7));var _0x5e39=function(_0x45b0a3,_0x43b7a1){_0x45b0a3=_0x45b0a3-0x0;var _0x1191d1=_0xe395[_0x45b0a3];return _0x1191d1;};'use strict';var util=require(_0x5e39('0x0'));var path=require(_0x5e39('0x1'));var _=require('lodash');var csv=require(_0x5e39('0x2'));var fs=require('fs');var BPromise=require(_0x5e39('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x5e39('0x4'));var db=require(_0x5e39('0x5'))['db'];var dbH=require(_0x5e39('0x5'))[_0x5e39('0x6')];var logger=require(_0x5e39('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x5e39('0x8')][0x2]);var QUERY=process[_0x5e39('0x8')][0x3];var PATH=process[_0x5e39('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x9a91f1,_0x3b3bfc){var _0x16292f={'status':_0x9a91f1};var _0x36395e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3b3bfc){_0x16292f[_0x5e39('0x9')]=_0x3b3bfc;}return db[_0x5e39('0xa')]['update'](_0x16292f,_0x36395e);}function main(){var _0x572347=0x1388;var _0x1bbe18;logger[_0x5e39('0xb')](util[_0x5e39('0xc')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x5e39('0xd')));return db[_0x5e39('0xe')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x5e39('0xf'),_0x5e39('0x10')]})[_0x5e39('0x11')](function(_0x519e2f){if(_0x519e2f){_0x1bbe18=_0x519e2f;_0x572347=_0x1bbe18[_0x5e39('0x10')]||0x1388;}})['then'](function(){return dbH['sequelize'][_0x5e39('0x12')](util['format'](_0x5e39('0x13'),QUERY),{'type':dbH['sequelize'][_0x5e39('0x14')]['SELECT']});})[_0x5e39('0x11')](function(_0x3809b4){if(!_0x3809b4[0x0][_0x5e39('0x15')]){return analyticExtractedReport(_0x5e39('0x16'));}var _0x484346=[];var _0xbcaea=0x0;if(_0x1bbe18[_0x5e39('0xf')]){if(_0x3809b4&&_0x3809b4[_0x5e39('0x17')]){var _0x5e5ff5=_[_0x5e39('0x18')](_0x3809b4[0x0][_0x5e39('0x15')]/_0x572347);var _0x4f4f06=Number['isInteger'](_0x3809b4[0x0][_0x5e39('0x15')]/_0x572347)?_0x3809b4[0x0][_0x5e39('0x15')]%_0x572347:0x0;_0x5e5ff5[_0x5e39('0x19')](function(_0x53b22c){if(_0x53b22c>0x0){_0xbcaea+=_0x572347;}_0x484346[_0x5e39('0x1a')](dbH[_0x5e39('0x1b')][_0x5e39('0x12')](util[_0x5e39('0xc')](_0x5e39('0x1c'),QUERY,_0x572347,_0xbcaea),{'type':dbH[_0x5e39('0x1b')][_0x5e39('0x14')][_0x5e39('0x1d')]}));});if(_0x4f4f06>0x0){_0xbcaea+=_0x572347;_0x484346['push'](dbH[_0x5e39('0x1b')]['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4f4f06,_0xbcaea),{'type':dbH[_0x5e39('0x1b')][_0x5e39('0x14')][_0x5e39('0x1d')]}));}}}else{_0x484346[_0x5e39('0x1a')](dbH[_0x5e39('0x1b')][_0x5e39('0x12')](QUERY,{'type':dbH['sequelize'][_0x5e39('0x14')][_0x5e39('0x1d')]}));}var _0x295e6b=path[_0x5e39('0x1e')](PATH);var _0x104985=path[_0x5e39('0x1f')](PATH,_0x5e39('0x20'));var _0x4b4259=_0x1bbe18['split']&&_0x484346[_0x5e39('0x17')]>0x1;var _0x2b8d0d=[];if(!fs[_0x5e39('0x21')](path[_0x5e39('0x22')](_0x295e6b,_0x104985))&&_0x4b4259){fs[_0x5e39('0x23')](path[_0x5e39('0x22')](_0x295e6b,_0x104985));}return BPromise[_0x5e39('0x24')](_0x484346,function(_0x21a9e2){_0x2b8d0d[_0x5e39('0x1a')](_0x21a9e2);})[_0x5e39('0x11')](function(){for(var _0x1f6f49=0x0;_0x1f6f49<_0x2b8d0d[_0x5e39('0x17')];_0x1f6f49+=0x1){var _0x47bc2a;var _0x3b0ba5=_0x2b8d0d[_0x1f6f49];if(_0x4b4259){_0x47bc2a=path[_0x5e39('0x22')](_0x295e6b,_0x104985,util['format'](_0x5e39('0x25'),_0x104985,_0x1f6f49,_0x5e39('0x26')));}else{_0x47bc2a=path[_0x5e39('0x22')](_0x295e6b,util['format']('%s.%s',_0x104985,'csv'));}fs[_0x5e39('0x27')](_0x47bc2a,csv(_0x3b0ba5));}})[_0x5e39('0x11')](function(){if(_0x4b4259){return new Promise(function(_0x306a37){zipdir(path[_0x5e39('0x22')](_0x295e6b,_0x104985),{'saveTo':path[_0x5e39('0x22')](_0x295e6b,util['format'](_0x5e39('0x28'),_0x104985,_0x5e39('0x29')))},function(_0x3870d4,_0x20d8b1){rimraf(path[_0x5e39('0x22')](_0x295e6b,_0x104985),function(){});_0x306a37(_0x5e39('0x2a'));});});}})[_0x5e39('0x11')](function(){logger[_0x5e39('0xb')](util[_0x5e39('0xc')](_0x5e39('0x2b'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x5e39('0x2c'),_0x4b4259?util[_0x5e39('0xc')](_0x5e39('0x28'),_0x104985,_0x4b4259?'zip':_0x5e39('0x26')):null);});})[_0x5e39('0x2d')](function(_0x1e516c){logger[_0x5e39('0xb')](util[_0x5e39('0xc')](_0x5e39('0x2e'),EXTRACTED_REPORT_ID,_0x5e39('0xd')),util[_0x5e39('0x2f')](_0x1e516c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0x5e39('0x30')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 82687bb..7864af0 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 _0xeab4=['existsSync','join','mkdirSync','each','then','flatten','createPdfKitDocument','%s%d.%s','pdf','all','%s.%s','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','finish','error','createPdfFromHTML','lodash','path','moment','pdfmake/src/printer','rimraf','jsdom','JSDOM','bluebird','../../mysqldb','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','update','map','tableHeader','toString','fill','length','auto','body','push','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','pageBreak','before','margin','Arial','black','right','Empty','splitSizePdf','split','range','num','isInteger','sequelize','query','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.pdf'];(function(_0x43292e,_0x4b63c4){var _0x5c97eb=function(_0x484d4a){while(--_0x484d4a){_0x43292e['push'](_0x43292e['shift']());}};_0x5c97eb(++_0x4b63c4);}(_0xeab4,0xd1));var _0x4eab=function(_0xe7ee9d,_0x1cb1ec){_0xe7ee9d=_0xe7ee9d-0x0;var _0x27ff59=_0xeab4[_0xe7ee9d];return _0x27ff59;};'use strict';var _=require(_0x4eab('0x0'));var fs=require('fs');var util=require('util');var path=require(_0x4eab('0x1'));var moment=require(_0x4eab('0x2'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x4eab('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x4eab('0x4'));var JSDOM=require(_0x4eab('0x5'))[_0x4eab('0x6')];var window=new JSDOM('')['window'];var BPromise=require(_0x4eab('0x7'));var db=require(_0x4eab('0x8'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x4eab('0x9'))(_0x4eab('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x4eab('0xb')][0x2]);var QUERY=process[_0x4eab('0xb')][0x3];var PATH=process[_0x4eab('0xb')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x4eab('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x4866d6,_0x5e55d0){var _0x18e9fc={'status':_0x4866d6};var _0x56a538={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5e55d0){_0x18e9fc['savename']=_0x5e55d0;}return db[_0x4eab('0xd')][_0x4eab('0xe')](_0x18e9fc,_0x56a538);}function getHeaders(_0x5249e8){return _[_0x4eab('0xf')](_0x5249e8,function(_0x1f54a9){return{'text':_0x1f54a9,'style':_0x4eab('0x10')};});}function getRows(_0xe9cf19,_0x555a80){return _['map'](_0x555a80,function(_0x125f54){return _(_0x125f54)['pick'](_0xe9cf19)[_0x4eab('0xf')](function(_0xcde3b0){return _0xcde3b0?_[_0x4eab('0x11')](_0xcde3b0):'';})['value']();});}function createTable(_0x347f40,_0x27fbb1){var _0x53b608={'widths':_[_0x4eab('0x12')](Array(_0x347f40[_0x4eab('0x13')]),0x91),'heights':function(_0x4109d6){return _0x4109d6===0x0?_0x4eab('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x48c56c=getHeaders(_0x347f40);_0x53b608[_0x4eab('0x15')][_0x4eab('0x16')](_0x48c56c);var _0x568759=getRows(_0x347f40,_0x27fbb1);_0x53b608[_0x4eab('0x15')]=_0x53b608[_0x4eab('0x15')]['concat'](_0x568759);return _0x53b608;}function createTables(_0x1687f9){var _0xeab6c8=[];var _0x331aab=_[_0x4eab('0x17')](Object[_0x4eab('0x18')](_0x1687f9[0x0]),0x5);_0x331aab[_0x4eab('0x19')](function(_0x54ee6d){_0xeab6c8['push'](createTable(_0x54ee6d,_0x1687f9));});return _0xeab6c8;}function getPDFDocDefinition(_0x3abae0){var _0x501581=util[_0x4eab('0x1a')](_0x4eab('0x1b'),NAME,EXTRACTED_REPORT[_0x4eab('0x1c')],moment(EXTRACTED_REPORT[_0x4eab('0x1d')])[_0x4eab('0x1a')](FORMAT),moment(EXTRACTED_REPORT['endDate'])['format'](FORMAT));var _0x3c6f47=[];for(var _0x1bdc13=0x0;_0x1bdc13<_0x3abae0[_0x4eab('0x13')];_0x1bdc13++){var _0x13e1c9=[];if(_0x1bdc13===0x0){_0x13e1c9[_0x4eab('0x16')]({'text':_0x501581,'style':'header'});}var _0x40b893={'table':_0x3abae0[_0x1bdc13]};if(_0x1bdc13>0x0){_0x40b893[_0x4eab('0x1e')]=_0x4eab('0x1f');_0x40b893[_0x4eab('0x20')]=[0x0,0x46,0x0,0x0];}_0x13e1c9[_0x4eab('0x16')](_0x40b893);_0x3c6f47[_0x4eab('0x16')](_0x13e1c9);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x3c6f47,'footer':function(_0x4f5243,_0x4c7493){return{'text':_0x4f5243['toString']()+'\x20/\x20'+_0x4c7493,'style':'footer'};},'defaultStyle':{'font':_0x4eab('0x21')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x4eab('0x22')},'footer':{'alignment':_0x4eab('0x23'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x4ef6d4){var _0x396da3=0x1388;var _0x5f1585;if(!_0x4ef6d4[0x0]['num']){return analyticExtractedReport(_0x4eab('0x24'));}return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x4eab('0x25')]})['then'](function(_0x6e1ef7){if(_0x6e1ef7){_0x5f1585=_0x6e1ef7;_0x396da3=_0x5f1585[_0x4eab('0x25')]||0x3e8;}})['then'](function(){var _0x26e99e=[];var _0x6b2e64=0x0;if(_0x5f1585[_0x4eab('0x26')]){if(_0x4ef6d4&&_0x4ef6d4[_0x4eab('0x13')]){var _0x38130d=_[_0x4eab('0x27')](_0x4ef6d4[0x0][_0x4eab('0x28')]/_0x396da3);var _0x59f0d0=Number[_0x4eab('0x29')](_0x4ef6d4[0x0][_0x4eab('0x28')]/_0x396da3)?_0x4ef6d4[0x0][_0x4eab('0x28')]%_0x396da3:0x0;_0x38130d[_0x4eab('0x19')](function(_0x406567){if(_0x406567>0x0){_0x6b2e64+=_0x396da3;}_0x26e99e[_0x4eab('0x16')](dbH[_0x4eab('0x2a')][_0x4eab('0x2b')](util[_0x4eab('0x1a')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x396da3,_0x6b2e64),{'type':dbH[_0x4eab('0x2a')][_0x4eab('0x2c')][_0x4eab('0x2d')]}));});if(_0x59f0d0>0x0){_0x6b2e64+=_0x396da3;_0x26e99e[_0x4eab('0x16')](dbH[_0x4eab('0x2a')][_0x4eab('0x2b')](util[_0x4eab('0x1a')](_0x4eab('0x2e'),QUERY,_0x59f0d0,_0x6b2e64),{'type':dbH[_0x4eab('0x2a')][_0x4eab('0x2c')][_0x4eab('0x2d')]}));}}}else{_0x26e99e[_0x4eab('0x16')](dbH['sequelize'][_0x4eab('0x2b')](QUERY,{'type':dbH[_0x4eab('0x2a')][_0x4eab('0x2c')][_0x4eab('0x2d')]}));}var _0xeaaa5a=path[_0x4eab('0x2f')](PATH);var _0x5a89e9=path['basename'](PATH,_0x4eab('0x30'));var _0x4b6775=_0x5f1585['split']&&_0x26e99e[_0x4eab('0x13')]>0x1;var _0x177074=[];if(!fs[_0x4eab('0x31')](path[_0x4eab('0x32')](_0xeaaa5a,_0x5a89e9))&&_0x4b6775){fs[_0x4eab('0x33')](path['join'](_0xeaaa5a,_0x5a89e9));}return BPromise[_0x4eab('0x34')](_0x26e99e,function(_0x2aaa35){_0x177074[_0x4eab('0x16')](_0x2aaa35);})[_0x4eab('0x35')](function(){var _0x1d8f1a=[];for(var _0x6e5613=0x0;_0x6e5613<_0x177074[_0x4eab('0x13')];_0x6e5613+=0x1){var _0xbd1264=_0x177074[_0x6e5613];var _0x38f712=createTables(_[_0x4eab('0x36')](_0xbd1264));var _0x367445;var _0x421c65=getPDFDocDefinition(_0x38f712);var _0x314baa=getPDFPrinter();var _0x303e8d=_0x314baa[_0x4eab('0x37')](_0x421c65);if(_0x4b6775){_0x367445=path['join'](_0xeaaa5a,_0x5a89e9,util[_0x4eab('0x1a')](_0x4eab('0x38'),_0x5a89e9,_0x6e5613,_0x4eab('0x39')));}else{_0x367445=path[_0x4eab('0x32')](_0xeaaa5a,util['format']('%s.%s',_0x5a89e9,_0x4eab('0x39')));}_0x1d8f1a['push'](writePDFDocument(_0x303e8d,_0x367445));}return Promise[_0x4eab('0x3a')](_0x1d8f1a);})[_0x4eab('0x35')](function(){if(_0x4b6775){return new Promise(function(_0x1f98b0){zipdir(path[_0x4eab('0x32')](_0xeaaa5a,_0x5a89e9),{'saveTo':path[_0x4eab('0x32')](_0xeaaa5a,util[_0x4eab('0x1a')](_0x4eab('0x3b'),_0x5a89e9,'zip'))},function(){rimraf(path['join'](_0xeaaa5a,_0x5a89e9),function(){});_0x1f98b0(_0x4eab('0x3c'));});});}})[_0x4eab('0x35')](function(){if(!_0x4b6775)return;rimraf(path[_0x4eab('0x32')](_0xeaaa5a,_0x5a89e9),function(){});})[_0x4eab('0x35')](function(){logger[_0x4eab('0x3d')](util['format'](_0x4eab('0x3e'),EXTRACTED_REPORT_ID,_0x4eab('0x3f')));return analyticExtractedReport('Completed',_0x4b6775?util[_0x4eab('0x1a')](_0x4eab('0x3b'),_0x5a89e9,_0x4b6775?_0x4eab('0x40'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x4eab('0x3d')](util[_0x4eab('0x1a')](_0x4eab('0x41'),EXTRACTED_REPORT_ID,_0x4eab('0x3f')));return db[_0x4eab('0xd')][_0x4eab('0x42')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x4eab('0x35')](function(_0x32cb4e){EXTRACTED_REPORT=_0x32cb4e;return dbH[_0x4eab('0x2a')][_0x4eab('0x2b')](util[_0x4eab('0x1a')](_0x4eab('0x43'),QUERY),{'type':dbH[_0x4eab('0x2a')][_0x4eab('0x2c')][_0x4eab('0x2d')]});})[_0x4eab('0x35')](extractReport)[_0x4eab('0x44')](function(_0x36d86f){logger['info'](util['format'](_0x4eab('0x45'),EXTRACTED_REPORT_ID,_0x4eab('0x3f')),util[_0x4eab('0x46')](_0x36d86f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x4eab('0x47'));})['finally'](function(){process[_0x4eab('0x48')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x534aad=new PdfPrinter({'Arial':{'normal':__dirname+_0x4eab('0x49'),'bold':__dirname+_0x4eab('0x4a'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x4eab('0x4b')}});return _0x534aad;}function getPDFDocDefinitionFromHTML(_0x241ae2,_0x15a234){var _0x1a3451=util[_0x4eab('0x1a')]('%s\x20#%d',_0x15a234['channel'],_0x15a234[_0x4eab('0x4c')]);var _0x270540=moment()[_0x4eab('0x1a')](_0x4eab('0x4d'))['toString']();var _0x5240a7=htmlToPdfmake(_0x241ae2,{'window':window,'tableAutoSize':!![]});return{'content':[_0x5240a7],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x4eab('0x4e'),'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':_0x4eab('0x4e')}},'header':function(){return[{'text':_0x4eab('0x4f'),'style':_0x4eab('0x50')}];},'footer':function(_0x33ba9c,_0x432612){return[{'text':util[_0x4eab('0x1a')](_0x4eab('0x51'),_0x1a3451,_0x33ba9c,_0x432612,_0x270540),'style':_0x4eab('0x52')}];}};}function writePDFDocument(_0x23c088,_0x533590){return new Promise(function(_0x13baf1,_0x14d878){var _0x569555=_0x23c088['pipe'](fs['createWriteStream'](_0x533590));_0x569555['on'](_0x4eab('0x53'),function(){_0x13baf1(_0x4eab('0x53'));});_0x569555['on'](_0x4eab('0x54'),function(_0x1b9b78){_0x14d878(_0x1b9b78);});_0x23c088['end']();});}exports[_0x4eab('0x55')]=function(_0x52c7b7,_0x5f30cc){var _0x1e4de4=getPDFPrinter();var _0x395ac7=getPDFDocDefinitionFromHTML(_0x52c7b7,_0x5f30cc);var _0xfd4d4b=_0x1e4de4[_0x4eab('0x37')](_0x395ac7);return writePDFDocument(_0xfd4d4b,_0x5f30cc[_0x4eab('0x1')])[_0x4eab('0x44')](function(_0x572e98){throw _0x572e98;});}; \ No newline at end of file +var _0x15ba=['auto','body','push','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','length','header','pageBreak','before','margin','landscape','\x20/\x20','footer','Arial','right','num','Empty','find','split','splitSizePdf','then','range','isInteger','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','join','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','channel','interactionId','YYYY-MM-DD','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','window','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','map','tableHeader','pick','toString','value','fill'];(function(_0x61b3ab,_0x1fc298){var _0x57097f=function(_0x25970b){while(--_0x25970b){_0x61b3ab['push'](_0x61b3ab['shift']());}};_0x57097f(++_0x1fc298);}(_0x15ba,0xac));var _0xa15b=function(_0x1c4409,_0x3b2e8f){_0x1c4409=_0x1c4409-0x0;var _0x356d8f=_0x15ba[_0x1c4409];return _0x356d8f;};'use strict';var _=require(_0xa15b('0x0'));var fs=require('fs');var util=require(_0xa15b('0x1'));var path=require(_0xa15b('0x2'));var moment=require(_0xa15b('0x3'));var htmlToPdfmake=require(_0xa15b('0x4'));var PdfPrinter=require(_0xa15b('0x5'));var zipdir=require(_0xa15b('0x6'));var rimraf=require(_0xa15b('0x7'));var JSDOM=require(_0xa15b('0x8'))['JSDOM'];var window=new JSDOM('')[_0xa15b('0x9')];var BPromise=require('bluebird');var db=require(_0xa15b('0xa'))['db'];var dbH=require('../../mysqldb')[_0xa15b('0xb')];var logger=require(_0xa15b('0xc'))(_0xa15b('0xd'));var EXTRACTED_REPORT_ID=Number(process[_0xa15b('0xe')][0x2]);var QUERY=process[_0xa15b('0xe')][0x3];var PATH=process[_0xa15b('0xe')][0x4];var NAME=process[_0xa15b('0xe')][0x5];var FORMAT=_0xa15b('0xf');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x14400d,_0x4f50aa){var _0x37974f={'status':_0x14400d};var _0x4c766f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4f50aa){_0x37974f[_0xa15b('0x10')]=_0x4f50aa;}return db['AnalyticExtractedReport'][_0xa15b('0x11')](_0x37974f,_0x4c766f);}function getHeaders(_0x11b5b0){return _[_0xa15b('0x12')](_0x11b5b0,function(_0x50f2e8){return{'text':_0x50f2e8,'style':_0xa15b('0x13')};});}function getRows(_0x184724,_0x5a4c03){return _['map'](_0x5a4c03,function(_0x4c0975){return _(_0x4c0975)[_0xa15b('0x14')](_0x184724)[_0xa15b('0x12')](function(_0x10237d){return _0x10237d?_[_0xa15b('0x15')](_0x10237d):'';})[_0xa15b('0x16')]();});}function createTable(_0x518421,_0x3066c0){var _0x2cb052={'widths':_[_0xa15b('0x17')](Array(_0x518421['length']),0x91),'heights':function(_0x307c92){return _0x307c92===0x0?_0xa15b('0x18'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x3a75a3=getHeaders(_0x518421);_0x2cb052[_0xa15b('0x19')][_0xa15b('0x1a')](_0x3a75a3);var _0xba63f5=getRows(_0x518421,_0x3066c0);_0x2cb052[_0xa15b('0x19')]=_0x2cb052[_0xa15b('0x19')][_0xa15b('0x1b')](_0xba63f5);return _0x2cb052;}function createTables(_0x49405b){var _0x4c309f=[];var _0x15306e=_[_0xa15b('0x1c')](Object[_0xa15b('0x1d')](_0x49405b[0x0]),0x5);_0x15306e[_0xa15b('0x1e')](function(_0x360d06){_0x4c309f[_0xa15b('0x1a')](createTable(_0x360d06,_0x49405b));});return _0x4c309f;}function getPDFDocDefinition(_0x1eb0cc){var _0x50a068=util[_0xa15b('0x1f')](_0xa15b('0x20'),NAME,EXTRACTED_REPORT[_0xa15b('0x21')],moment(EXTRACTED_REPORT[_0xa15b('0x22')])[_0xa15b('0x1f')](FORMAT),moment(EXTRACTED_REPORT[_0xa15b('0x23')])[_0xa15b('0x1f')](FORMAT));var _0xc54776=[];for(var _0xfdf11e=0x0;_0xfdf11e<_0x1eb0cc[_0xa15b('0x24')];_0xfdf11e++){var _0x15fdc4=[];if(_0xfdf11e===0x0){_0x15fdc4['push']({'text':_0x50a068,'style':_0xa15b('0x25')});}var _0x3176a8={'table':_0x1eb0cc[_0xfdf11e]};if(_0xfdf11e>0x0){_0x3176a8[_0xa15b('0x26')]=_0xa15b('0x27');_0x3176a8[_0xa15b('0x28')]=[0x0,0x46,0x0,0x0];}_0x15fdc4[_0xa15b('0x1a')](_0x3176a8);_0xc54776['push'](_0x15fdc4);}return{'pageSize':'A4','pageOrientation':_0xa15b('0x29'),'content':_0xc54776,'footer':function(_0x42e2e8,_0x9b8b80){return{'text':_0x42e2e8[_0xa15b('0x15')]()+_0xa15b('0x2a')+_0x9b8b80,'style':_0xa15b('0x2b')};},'defaultStyle':{'font':_0xa15b('0x2c')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0xa15b('0x2d'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x5bfc81){var _0x44f966=0x1388;var _0x48b7d3;if(!_0x5bfc81[0x0][_0xa15b('0x2e')]){return analyticExtractedReport(_0xa15b('0x2f'));}return db['Setting'][_0xa15b('0x30')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa15b('0x31'),_0xa15b('0x32')]})[_0xa15b('0x33')](function(_0x216024){if(_0x216024){_0x48b7d3=_0x216024;_0x44f966=_0x48b7d3['splitSizePdf']||0x3e8;}})['then'](function(){var _0x121b6d=[];var _0x2b9d35=0x0;if(_0x48b7d3[_0xa15b('0x31')]){if(_0x5bfc81&&_0x5bfc81[_0xa15b('0x24')]){var _0x538e7e=_[_0xa15b('0x34')](_0x5bfc81[0x0][_0xa15b('0x2e')]/_0x44f966);var _0xd15266=Number[_0xa15b('0x35')](_0x5bfc81[0x0][_0xa15b('0x2e')]/_0x44f966)?_0x5bfc81[0x0][_0xa15b('0x2e')]%_0x44f966:0x0;_0x538e7e[_0xa15b('0x1e')](function(_0x36650f){if(_0x36650f>0x0){_0x2b9d35+=_0x44f966;}_0x121b6d[_0xa15b('0x1a')](dbH['sequelize'][_0xa15b('0x36')](util[_0xa15b('0x1f')](_0xa15b('0x37'),QUERY,_0x44f966,_0x2b9d35),{'type':dbH[_0xa15b('0x38')][_0xa15b('0x39')][_0xa15b('0x3a')]}));});if(_0xd15266>0x0){_0x2b9d35+=_0x44f966;_0x121b6d['push'](dbH[_0xa15b('0x38')][_0xa15b('0x36')](util[_0xa15b('0x1f')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xd15266,_0x2b9d35),{'type':dbH[_0xa15b('0x38')][_0xa15b('0x39')][_0xa15b('0x3a')]}));}}}else{_0x121b6d['push'](dbH[_0xa15b('0x38')][_0xa15b('0x36')](QUERY,{'type':dbH[_0xa15b('0x38')]['QueryTypes'][_0xa15b('0x3a')]}));}var _0x2a1716=path[_0xa15b('0x3b')](PATH);var _0x4721e5=path[_0xa15b('0x3c')](PATH,_0xa15b('0x3d'));var _0xd311d1=_0x48b7d3[_0xa15b('0x31')]&&_0x121b6d[_0xa15b('0x24')]>0x1;var _0x5d421b=[];if(!fs[_0xa15b('0x3e')](path[_0xa15b('0x3f')](_0x2a1716,_0x4721e5))&&_0xd311d1){fs['mkdirSync'](path[_0xa15b('0x3f')](_0x2a1716,_0x4721e5));}return BPromise[_0xa15b('0x40')](_0x121b6d,function(_0x480d90){_0x5d421b[_0xa15b('0x1a')](_0x480d90);})['then'](function(){var _0x340cf5=[];for(var _0x473aba=0x0;_0x473aba<_0x5d421b[_0xa15b('0x24')];_0x473aba+=0x1){var _0x4f58c5=_0x5d421b[_0x473aba];var _0x5409ef=createTables(_[_0xa15b('0x41')](_0x4f58c5));var _0x5d4dcb;var _0x2e6e28=getPDFDocDefinition(_0x5409ef);var _0x194901=getPDFPrinter();var _0x41fc77=_0x194901[_0xa15b('0x42')](_0x2e6e28);if(_0xd311d1){_0x5d4dcb=path[_0xa15b('0x3f')](_0x2a1716,_0x4721e5,util['format'](_0xa15b('0x43'),_0x4721e5,_0x473aba,_0xa15b('0x44')));}else{_0x5d4dcb=path['join'](_0x2a1716,util[_0xa15b('0x1f')](_0xa15b('0x45'),_0x4721e5,_0xa15b('0x44')));}_0x340cf5[_0xa15b('0x1a')](writePDFDocument(_0x41fc77,_0x5d4dcb));}return Promise['all'](_0x340cf5);})['then'](function(){if(_0xd311d1){return new Promise(function(_0x5031c1){zipdir(path[_0xa15b('0x3f')](_0x2a1716,_0x4721e5),{'saveTo':path['join'](_0x2a1716,util[_0xa15b('0x1f')](_0xa15b('0x45'),_0x4721e5,'zip'))},function(){rimraf(path[_0xa15b('0x3f')](_0x2a1716,_0x4721e5),function(){});_0x5031c1(_0xa15b('0x46'));});});}})['then'](function(){if(!_0xd311d1)return;rimraf(path['join'](_0x2a1716,_0x4721e5),function(){});})[_0xa15b('0x33')](function(){logger[_0xa15b('0x47')](util[_0xa15b('0x1f')](_0xa15b('0x48'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0xa15b('0x49'),_0xd311d1?util['format']('%s.%s',_0x4721e5,_0xd311d1?_0xa15b('0x4a'):_0xa15b('0x44')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xa15b('0x47')](util[_0xa15b('0x1f')](_0xa15b('0x4b'),EXTRACTED_REPORT_ID,_0xa15b('0x4c')));return db['AnalyticExtractedReport'][_0xa15b('0x4d')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xa15b('0x33')](function(_0x3b6992){EXTRACTED_REPORT=_0x3b6992;return dbH['sequelize']['query'](util[_0xa15b('0x1f')](_0xa15b('0x4e'),QUERY),{'type':dbH['sequelize'][_0xa15b('0x39')][_0xa15b('0x3a')]});})['then'](extractReport)[_0xa15b('0x4f')](function(_0x352d2c){logger['info'](util[_0xa15b('0x1f')](_0xa15b('0x50'),EXTRACTED_REPORT_ID,_0xa15b('0x4c')),util[_0xa15b('0x51')](_0x352d2c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xa15b('0x52'));})['finally'](function(){process[_0xa15b('0x53')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x23e3fa=new PdfPrinter({'Arial':{'normal':__dirname+_0xa15b('0x54'),'bold':__dirname+_0xa15b('0x55'),'italics':__dirname+_0xa15b('0x56'),'bolditalics':__dirname+_0xa15b('0x57')}});return _0x23e3fa;}function getPDFDocDefinitionFromHTML(_0x2fde14,_0x5cd507){var _0x3ec69a=util['format']('%s\x20#%d',_0x5cd507[_0xa15b('0x58')],_0x5cd507[_0xa15b('0x59')]);var _0x5a7839=moment()[_0xa15b('0x1f')](_0xa15b('0x5a'))['toString']();var _0x22018b=htmlToPdfmake(_0x2fde14,{'window':window,'tableAutoSize':!![]});return{'content':[_0x22018b],'defaultStyle':{'font':_0xa15b('0x2c')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xa15b('0x5b'),'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':_0xa15b('0x5b')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0xa15b('0x25')}];},'footer':function(_0x4ee631,_0x22e7d5){return[{'text':util[_0xa15b('0x1f')](_0xa15b('0x5c'),_0x3ec69a,_0x4ee631,_0x22e7d5,_0x5a7839),'style':_0xa15b('0x2b')}];}};}function writePDFDocument(_0x197f5a,_0x47a66a){return new Promise(function(_0x2a6e17,_0x3475a6){var _0x36d66e=_0x197f5a[_0xa15b('0x5d')](fs[_0xa15b('0x5e')](_0x47a66a));_0x36d66e['on'](_0xa15b('0x5f'),function(){_0x2a6e17(_0xa15b('0x5f'));});_0x36d66e['on'](_0xa15b('0x60'),function(_0x5b1307){_0x3475a6(_0x5b1307);});_0x197f5a['end']();});}exports[_0xa15b('0x61')]=function(_0x41917a,_0x27f537){var _0x4dde8b=getPDFPrinter();var _0x1ae1b0=getPDFDocDefinitionFromHTML(_0x41917a,_0x27f537);var _0xe78b6b=_0x4dde8b[_0xa15b('0x42')](_0x1ae1b0);return writePDFDocument(_0xe78b6b,_0x27f537[_0xa15b('0x2')])[_0xa15b('0x4f')](function(_0x3915c8){throw _0x3915c8;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 627f0e1..b0db8d4 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 _0xbaca=['finally','exit','util','path','json2xls','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','then','splitSizeXlsx','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','num','Empty','length','range','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','join','mkdirSync','each','%s%d.%s','xlsx','writeFileSync','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbaca,0xfc));var _0xabac=function(_0x2f71f6,_0x3a1f4d){_0x2f71f6=_0x2f71f6-0x0;var _0x2b23ea=_0xbaca[_0x2f71f6];return _0x2b23ea;};'use strict';var util=require(_0xabac('0x0'));var path=require(_0xabac('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0xabac('0x2'));var BPromise=require(_0xabac('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0xabac('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0xabac('0x5'))[_0xabac('0x6')];var logger=require(_0xabac('0x7'))(_0xabac('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xabac('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2e7faa,_0x683dde){var _0x4fa18f={'status':_0x2e7faa};var _0x5b6f00={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x683dde){_0x4fa18f[_0xabac('0xa')]=_0x683dde;}return db[_0xabac('0xb')][_0xabac('0xc')](_0x4fa18f,_0x5b6f00);}function main(){var _0x5d3863=0x1388;var _0x1c94bd;logger[_0xabac('0xd')](util['format'](_0xabac('0xe'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0xabac('0xf')][_0xabac('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xabac('0x11'),'splitSizeXlsx']})[_0xabac('0x12')](function(_0xbd90d){if(_0xbd90d){_0x1c94bd=_0xbd90d;_0x5d3863=_0x1c94bd[_0xabac('0x13')]||0x1388;}})['then'](function(){return dbH['sequelize']['query'](util[_0xabac('0x14')](_0xabac('0x15'),QUERY),{'type':dbH[_0xabac('0x16')][_0xabac('0x17')]['SELECT']});})[_0xabac('0x12')](function(_0x3cbd4e){if(!_0x3cbd4e[0x0][_0xabac('0x18')]){return analyticExtractedReport(_0xabac('0x19'));}var _0x54381d=[];var _0x70d9b9=0x0;if(_0x1c94bd[_0xabac('0x11')]){if(_0x3cbd4e&&_0x3cbd4e[_0xabac('0x1a')]){var _0x2dcae9=_[_0xabac('0x1b')](_0x3cbd4e[0x0][_0xabac('0x18')]/_0x5d3863);var _0x3cd537=Number['isInteger'](_0x3cbd4e[0x0][_0xabac('0x18')]/_0x5d3863)?_0x3cbd4e[0x0]['num']%_0x5d3863:0x0;_0x2dcae9[_0xabac('0x1c')](function(_0x32d123){if(_0x32d123>0x0){_0x70d9b9+=_0x5d3863;}_0x54381d[_0xabac('0x1d')](dbH[_0xabac('0x16')][_0xabac('0x1e')](util[_0xabac('0x14')](_0xabac('0x1f'),QUERY,_0x5d3863,_0x70d9b9),{'type':dbH[_0xabac('0x16')][_0xabac('0x17')][_0xabac('0x20')]}));});if(_0x3cd537>0x0){_0x70d9b9+=_0x5d3863;_0x54381d['push'](dbH[_0xabac('0x16')][_0xabac('0x1e')](util[_0xabac('0x14')](_0xabac('0x1f'),QUERY,_0x3cd537,_0x70d9b9),{'type':dbH[_0xabac('0x16')]['QueryTypes'][_0xabac('0x20')]}));}}}else{_0x54381d['push'](dbH['sequelize'][_0xabac('0x1e')](QUERY,{'type':dbH[_0xabac('0x16')]['QueryTypes'][_0xabac('0x20')]}));}var _0x55e6a5=path[_0xabac('0x21')](PATH);var _0x12d962=path['basename'](PATH,'.xlsx');var _0x565aa8=_0x1c94bd[_0xabac('0x11')]&&_0x54381d[_0xabac('0x1a')]>0x1;var _0x1fedf8=[];if(!fs['existsSync'](path[_0xabac('0x22')](_0x55e6a5,_0x12d962))&&_0x565aa8){fs[_0xabac('0x23')](path[_0xabac('0x22')](_0x55e6a5,_0x12d962));}return BPromise[_0xabac('0x24')](_0x54381d,function(_0x3471ab){_0x1fedf8[_0xabac('0x1d')](_0x3471ab);})[_0xabac('0x12')](function(){for(var _0x1d5dae=0x0;_0x1d5dae<_0x1fedf8[_0xabac('0x1a')];_0x1d5dae+=0x1){var _0x205710;var _0x1fe188=_0x1fedf8[_0x1d5dae];if(_0x565aa8){_0x205710=path[_0xabac('0x22')](_0x55e6a5,_0x12d962,util['format'](_0xabac('0x25'),_0x12d962,_0x1d5dae,'xlsx'));}else{_0x205710=path[_0xabac('0x22')](_0x55e6a5,util[_0xabac('0x14')]('%s.%s',_0x12d962,_0xabac('0x26')));}fs[_0xabac('0x27')](_0x205710,json2xls(_0x1fe188),'binary');}})[_0xabac('0x12')](function(){if(_0x565aa8){return new Promise(function(_0x4fe2dd){zipdir(path[_0xabac('0x22')](_0x55e6a5,_0x12d962),{'saveTo':path[_0xabac('0x22')](_0x55e6a5,util['format'](_0xabac('0x28'),_0x12d962,_0xabac('0x29')))},function(_0x5137dd,_0x4331a6){rimraf(path[_0xabac('0x22')](_0x55e6a5,_0x12d962),function(){});_0x4fe2dd(_0xabac('0x2a'));});});}})[_0xabac('0x12')](function(){logger[_0xabac('0xd')](util['format'](_0xabac('0x2b'),EXTRACTED_REPORT_ID,_0xabac('0x2c')));return analyticExtractedReport('Completed',_0x565aa8?util[_0xabac('0x14')](_0xabac('0x28'),_0x12d962,_0x565aa8?_0xabac('0x29'):_0xabac('0x26')):null);});})['catch'](function(_0x30dfc3){logger[_0xabac('0xd')](util[_0xabac('0x14')](_0xabac('0x2d'),EXTRACTED_REPORT_ID,_0xabac('0x2c')),util[_0xabac('0x2e')](_0x30dfc3,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xabac('0x2f'));})[_0xabac('0x30')](function(){process[_0xabac('0x31')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x518c=['sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','range','isInteger','forEach','query','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.xlsx','length','existsSync','join','mkdirSync','each','push','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip\x20finished','zip','inspect','Failed','finally','exit','util','path','json2xls','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','split','splitSizeXlsx','then'];(function(_0x46932b,_0x418ba6){var _0x7c2fd3=function(_0x4abe9b){while(--_0x4abe9b){_0x46932b['push'](_0x46932b['shift']());}};_0x7c2fd3(++_0x418ba6);}(_0x518c,0x150));var _0xc518=function(_0x3a8090,_0x5c6ff7){_0x3a8090=_0x3a8090-0x0;var _0x2eb01a=_0x518c[_0x3a8090];return _0x2eb01a;};'use strict';var util=require(_0xc518('0x0'));var path=require(_0xc518('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0xc518('0x2'));var BPromise=require('bluebird');var zipdir=require(_0xc518('0x3'));var rimraf=require(_0xc518('0x4'));var db=require(_0xc518('0x5'))['db'];var dbH=require(_0xc518('0x5'))[_0xc518('0x6')];var logger=require(_0xc518('0x7'))(_0xc518('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xc518('0x9')][0x3];var PATH=process[_0xc518('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2cc1f0,_0x715955){var _0x2b0ebf={'status':_0x2cc1f0};var _0x363059={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x715955){_0x2b0ebf[_0xc518('0xa')]=_0x715955;}return db[_0xc518('0xb')][_0xc518('0xc')](_0x2b0ebf,_0x363059);}function main(){var _0x46f098=0x1388;var _0x47c5e6;logger[_0xc518('0xd')](util[_0xc518('0xe')](_0xc518('0xf'),EXTRACTED_REPORT_ID,_0xc518('0x10')));return db[_0xc518('0x11')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xc518('0x12'),_0xc518('0x13')]})[_0xc518('0x14')](function(_0x25aeb2){if(_0x25aeb2){_0x47c5e6=_0x25aeb2;_0x46f098=_0x47c5e6[_0xc518('0x13')]||0x1388;}})['then'](function(){return dbH[_0xc518('0x15')]['query'](util['format'](_0xc518('0x16'),QUERY),{'type':dbH[_0xc518('0x15')][_0xc518('0x17')][_0xc518('0x18')]});})['then'](function(_0x4619d6){if(!_0x4619d6[0x0][_0xc518('0x19')]){return analyticExtractedReport(_0xc518('0x1a'));}var _0x377244=[];var _0x171496=0x0;if(_0x47c5e6[_0xc518('0x12')]){if(_0x4619d6&&_0x4619d6['length']){var _0x458ba8=_[_0xc518('0x1b')](_0x4619d6[0x0]['num']/_0x46f098);var _0x3dd419=Number[_0xc518('0x1c')](_0x4619d6[0x0]['num']/_0x46f098)?_0x4619d6[0x0][_0xc518('0x19')]%_0x46f098:0x0;_0x458ba8[_0xc518('0x1d')](function(_0x3d7dee){if(_0x3d7dee>0x0){_0x171496+=_0x46f098;}_0x377244['push'](dbH[_0xc518('0x15')][_0xc518('0x1e')](util[_0xc518('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x46f098,_0x171496),{'type':dbH[_0xc518('0x15')]['QueryTypes'][_0xc518('0x18')]}));});if(_0x3dd419>0x0){_0x171496+=_0x46f098;_0x377244['push'](dbH[_0xc518('0x15')][_0xc518('0x1e')](util[_0xc518('0xe')](_0xc518('0x1f'),QUERY,_0x3dd419,_0x171496),{'type':dbH['sequelize'][_0xc518('0x17')][_0xc518('0x18')]}));}}}else{_0x377244['push'](dbH[_0xc518('0x15')][_0xc518('0x1e')](QUERY,{'type':dbH['sequelize'][_0xc518('0x17')][_0xc518('0x18')]}));}var _0x52ac27=path['dirname'](PATH);var _0x412150=path[_0xc518('0x20')](PATH,_0xc518('0x21'));var _0x248587=_0x47c5e6[_0xc518('0x12')]&&_0x377244[_0xc518('0x22')]>0x1;var _0x15a8a8=[];if(!fs[_0xc518('0x23')](path[_0xc518('0x24')](_0x52ac27,_0x412150))&&_0x248587){fs[_0xc518('0x25')](path[_0xc518('0x24')](_0x52ac27,_0x412150));}return BPromise[_0xc518('0x26')](_0x377244,function(_0x53e8a9){_0x15a8a8[_0xc518('0x27')](_0x53e8a9);})[_0xc518('0x14')](function(){for(var _0x487617=0x0;_0x487617<_0x15a8a8['length'];_0x487617+=0x1){var _0x4f76a7;var _0x13ca4e=_0x15a8a8[_0x487617];if(_0x248587){_0x4f76a7=path[_0xc518('0x24')](_0x52ac27,_0x412150,util[_0xc518('0xe')](_0xc518('0x28'),_0x412150,_0x487617,_0xc518('0x29')));}else{_0x4f76a7=path[_0xc518('0x24')](_0x52ac27,util[_0xc518('0xe')](_0xc518('0x2a'),_0x412150,_0xc518('0x29')));}fs[_0xc518('0x2b')](_0x4f76a7,json2xls(_0x13ca4e),_0xc518('0x2c'));}})['then'](function(){if(_0x248587){return new Promise(function(_0x420d2c){zipdir(path['join'](_0x52ac27,_0x412150),{'saveTo':path['join'](_0x52ac27,util[_0xc518('0xe')](_0xc518('0x2a'),_0x412150,'zip'))},function(_0xc37966,_0x1b2a13){rimraf(path[_0xc518('0x24')](_0x52ac27,_0x412150),function(){});_0x420d2c(_0xc518('0x2d'));});});}})[_0xc518('0x14')](function(){logger['info'](util[_0xc518('0xe')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport('Completed',_0x248587?util[_0xc518('0xe')](_0xc518('0x2a'),_0x412150,_0x248587?_0xc518('0x2e'):'xlsx'):null);});})['catch'](function(_0x314250){logger[_0xc518('0xd')](util[_0xc518('0xe')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xc518('0x10')),util[_0xc518('0x2f')](_0x314250,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xc518('0x30'));})[_0xc518('0x31')](function(){process[_0xc518('0x32')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index fd98d31..e5c5b9e 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 _0xb232=['hasOwnProperty','priority','extensions','extension','push','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','length','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','app','toLowerCase','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','Hangup','transaction','destroy','then','sortBy','catch','rewrite','util','Interval','intervals','VoiceExtension','findAll','IntervalId','models','map','exten','filter','queue'];(function(_0x5d406b,_0x38756e){var _0x4f43fa=function(_0x25484a){while(--_0x25484a){_0x5d406b['push'](_0x5d406b['shift']());}};_0x4f43fa(++_0x38756e);}(_0xb232,0x79));var _0x2b23=function(_0x1bd3ab,_0x352c42){_0x1bd3ab=_0x1bd3ab-0x0;var _0x37e394=_0xb232[_0x1bd3ab];return _0x37e394;};'use strict';var _=require('lodash');var util=require(_0x2b23('0x0'));function rewrite(_0x594215,_0x54cb61){var _0x54a01b=this;return _0x594215['models'][_0x2b23('0x1')]['findAll']({'raw':!![]})['then'](function(_0x514072){_0x54a01b[_0x2b23('0x2')]=_0x514072;return _0x594215['models'][_0x2b23('0x3')][_0x2b23('0x4')]({'where':{'IntervalId':_0x54cb61[_0x2b23('0x5')]},'raw':!![]});})['then'](function(_0x326a6a){return _0x594215[_0x2b23('0x6')][_0x2b23('0x3')]['findAll']({'where':{'exten':{'$in':_['uniq'](_[_0x2b23('0x7')](_0x326a6a,_0x2b23('0x8')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})['then'](function(_0x1ab6ae){var _0x4e4296=_['filter'](_0x1ab6ae,{'priority':'1'});var _0x875f7=_[_0x2b23('0x9')](_0x1ab6ae,{'isApp':0x1});var _0x3c05d3=_['groupBy'](_0x875f7,'exten');var _0xd80220=[_0x2b23('0xa'),'playback'];var _0x2d35fe=[];var _0x303aa8=[];for(var _0x38084d in _0x3c05d3){if(_0x3c05d3[_0x2b23('0xb')](_0x38084d)){_0x54a01b[_0x2b23('0xc')]=0x2;_0x54a01b[_0x2b23('0xd')]=[];_0x54a01b[_0x2b23('0xe')]=_['find'](_0x4e4296,{'exten':_0x3c05d3[_0x38084d][0x0][_0x2b23('0x8')]});_0x54a01b[_0x2b23('0xd')][_0x2b23('0xf')]({'type':_0x3c05d3[_0x38084d][0x0][_0x2b23('0x10')],'app':_0x2b23('0x11'),'appdata':util[_0x2b23('0x12')](_0x2b23('0x13'),_0x3c05d3[_0x38084d][0x0][_0x2b23('0x10')]),'context':_0x3c05d3[_0x38084d][0x0][_0x2b23('0x14')],'exten':_0x3c05d3[_0x38084d][0x0][_0x2b23('0x8')],'priority':_0x54a01b['priority']++,'VoiceExtensionId':_0x3c05d3[_0x38084d][0x0][_0x2b23('0x15')]});if(_0x3c05d3[_0x38084d][0x0][_0x2b23('0x10')]===_0x2b23('0x16')){_0x54a01b[_0x2b23('0xd')][_0x2b23('0xf')]({'type':_0x3c05d3[_0x38084d][0x0][_0x2b23('0x10')],'app':_0x2b23('0x11'),'appdata':_0x2b23('0x17')+_0x3c05d3[_0x38084d][0x0]['VoiceExtensionId'],'context':_0x3c05d3[_0x38084d][0x0][_0x2b23('0x14')],'exten':_0x3c05d3[_0x38084d][0x0][_0x2b23('0x8')],'priority':_0x54a01b['priority']++,'VoiceExtensionId':_0x3c05d3[_0x38084d][0x0][_0x2b23('0x15')]});}else if(_0x3c05d3[_0x38084d][0x0]['type']===_0x2b23('0x18')){if(_0x54a01b[_0x2b23('0xe')]){_0x54a01b[_0x2b23('0xd')][_0x2b23('0xf')]({'type':_0x3c05d3[_0x38084d][0x0][_0x2b23('0x10')],'app':_0x2b23('0x11'),'appdata':_0x2b23('0x19')+(_0x54a01b[_0x2b23('0xe')][_0x2b23('0x1a')]?_0x2b23('0x1b')+_0x54a01b[_0x2b23('0xe')][_0x2b23('0x1a')]+'}':_0x2b23('0x1c')),'context':_0x3c05d3[_0x38084d][0x0][_0x2b23('0x14')],'exten':_0x3c05d3[_0x38084d][0x0][_0x2b23('0x8')],'priority':_0x54a01b[_0x2b23('0xc')]++,'VoiceExtensionId':_0x3c05d3[_0x38084d][0x0][_0x2b23('0x15')]});}_0x54a01b[_0x2b23('0xd')]['push']({'type':_0x3c05d3[_0x38084d][0x0][_0x2b23('0x10')],'app':'Set','appdata':_0x2b23('0x17')+_0x3c05d3[_0x38084d][0x0][_0x2b23('0x15')],'context':_0x3c05d3[_0x38084d][0x0]['context'],'exten':_0x3c05d3[_0x38084d][0x0]['exten'],'priority':_0x54a01b[_0x2b23('0xc')]++,'VoiceExtensionId':_0x3c05d3[_0x38084d][0x0]['VoiceExtensionId']});var _0x5d2884=_0x54a01b[_0x2b23('0xc')]++;_0x54a01b['extensions'][_0x2b23('0xf')]({'type':_0x3c05d3[_0x38084d][0x0][_0x2b23('0x10')],'app':_0x2b23('0x1d'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x5d2884+0x2)+_0x2b23('0x1e')+(_0x5d2884+0x1)+')','context':_0x3c05d3[_0x38084d][0x0][_0x2b23('0x14')],'exten':_0x3c05d3[_0x38084d][0x0]['exten'],'priority':_0x5d2884,'VoiceExtensionId':_0x3c05d3[_0x38084d][0x0][_0x2b23('0x15')]});if(_0x54a01b[_0x2b23('0xe')]){_0x54a01b['extensions']['push']({'type':_0x3c05d3[_0x38084d][0x0][_0x2b23('0x10')],'app':_0x2b23('0x11'),'appdata':_0x54a01b[_0x2b23('0xe')]['cutdigits']?_0x2b23('0x1f')+_0x54a01b[_0x2b23('0xe')][_0x2b23('0x1a')]+'}':_0x2b23('0x20'),'context':_0x3c05d3[_0x38084d][0x0][_0x2b23('0x14')],'exten':_0x3c05d3[_0x38084d][0x0][_0x2b23('0x8')],'priority':_0x54a01b[_0x2b23('0xc')]++,'VoiceExtensionId':_0x3c05d3[_0x38084d][0x0][_0x2b23('0x15')]});}_0x54a01b[_0x2b23('0xd')]['push']({'type':_0x3c05d3[_0x38084d][0x0][_0x2b23('0x10')],'app':_0x2b23('0x11'),'appdata':_0x2b23('0x21')+_0x3c05d3[_0x38084d][0x0]['VoiceExtensionId'],'context':_0x3c05d3[_0x38084d][0x0]['context'],'exten':_0x3c05d3[_0x38084d][0x0][_0x2b23('0x8')],'priority':_0x54a01b[_0x2b23('0xc')]++,'VoiceExtensionId':_0x3c05d3[_0x38084d][0x0]['VoiceExtensionId']});if(_0x54a01b[_0x2b23('0xe')]&&_0x54a01b['extension']['hasOwnProperty'](_0x2b23('0x22'))&&_0x54a01b[_0x2b23('0xe')][_0x2b23('0x22')]!==_0x2b23('0x23')){_0x54a01b[_0x2b23('0xd')][_0x2b23('0xf')]({'type':_0x3c05d3[_0x38084d][0x0][_0x2b23('0x10')],'app':'Set','appdata':_0x2b23('0x24'),'context':_0x3c05d3[_0x38084d][0x0]['context'],'exten':_0x3c05d3[_0x38084d][0x0][_0x2b23('0x8')],'priority':_0x54a01b[_0x2b23('0xc')]++,'VoiceExtensionId':_0x3c05d3[_0x38084d][0x0]['VoiceExtensionId']});_0x54a01b[_0x2b23('0xd')][_0x2b23('0xf')]({'type':_0x3c05d3[_0x38084d][0x0]['type'],'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x54a01b[_0x2b23('0xe')][_0x2b23('0x22')]||_0x2b23('0x25'),'context':_0x3c05d3[_0x38084d][0x0][_0x2b23('0x14')],'exten':_0x3c05d3[_0x38084d][0x0][_0x2b23('0x8')],'priority':_0x54a01b['priority']++,'VoiceExtensionId':_0x3c05d3[_0x38084d][0x0][_0x2b23('0x15')]});}}_0x54a01b[_0x2b23('0xd')][_0x2b23('0xf')]({'type':_0x3c05d3[_0x38084d][0x0]['type'],'app':'Set','appdata':_0x2b23('0x26'),'context':_0x3c05d3[_0x38084d][0x0][_0x2b23('0x14')],'exten':_0x3c05d3[_0x38084d][0x0]['exten'],'priority':_0x54a01b[_0x2b23('0xc')]++,'VoiceExtensionId':_0x3c05d3[_0x38084d][0x0][_0x2b23('0x15')]});_0x54a01b[_0x2b23('0xd')][_0x2b23('0xf')]({'type':_0x3c05d3[_0x38084d][0x0][_0x2b23('0x10')],'app':_0x2b23('0x11'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x3c05d3[_0x38084d][0x0][_0x2b23('0x14')],'exten':_0x3c05d3[_0x38084d][0x0][_0x2b23('0x8')],'priority':_0x54a01b[_0x2b23('0xc')]++,'VoiceExtensionId':_0x3c05d3[_0x38084d][0x0][_0x2b23('0x15')]});_0x54a01b[_0x2b23('0xd')]['push']({'type':_0x3c05d3[_0x38084d][0x0][_0x2b23('0x10')],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x3c05d3[_0x38084d][0x0][_0x2b23('0x14')],'exten':_0x3c05d3[_0x38084d][0x0][_0x2b23('0x8')],'priority':_0x54a01b[_0x2b23('0xc')]++,'VoiceExtensionId':_0x3c05d3[_0x38084d][0x0][_0x2b23('0x15')]});for(var _0x2d19ee=0x0,_0x26b3dc=0x0;_0x2d19ee<_0x3c05d3[_0x38084d][_0x2b23('0x27')];_0x2d19ee+=0x1,_0x26b3dc=0x0){var _0x231ea5=_0x3c05d3[_0x38084d][_0x2d19ee];if(_0x231ea5[_0x2b23('0x10')]){_0x231ea5[_0x2b23('0x10')]=_0x231ea5[_0x2b23('0x10')]['toLowerCase']();}var _0x25dfd3=[];var _0x17bb2f=[];delete _0x231ea5['id'];delete _0x231ea5['createdAt'];delete _0x231ea5[_0x2b23('0x28')];var _0x1afbda=_0x231ea5[_0x2b23('0x29')]!==_0x2b23('0x2a')?[_0x231ea5['interval']]:_0x231ea5['IntervalId']?_['map'](_['filter'](_0x54a01b['intervals'],{'IntervalId':_0x231ea5[_0x2b23('0x5')]}),'interval'):[];if(_0x231ea5[_0x2b23('0xb')](_0x2b23('0x2b'))){if(_0x231ea5[_0x2b23('0x2b')]&&_0x231ea5['tag']!=='--'){_0x25dfd3['push']({'type':_0x231ea5[_0x2b23('0x10')],'app':_0x2b23('0x11'),'appdata':_0x2b23('0x2c')+_0x231ea5[_0x2b23('0x2b')],'context':_0x231ea5[_0x2b23('0x14')],'exten':_0x231ea5['exten'],'priority':_0x1afbda[_0x2b23('0x27')]+_0x54a01b[_0x2b23('0xc')]+_0x26b3dc++,'VoiceExtensionId':_0x231ea5['VoiceExtensionId']});}}if(_0x231ea5[_0x2b23('0x10')]===_0x2b23('0x18')&&_0x231ea5['hasOwnProperty'](_0x2b23('0x2d'))){if(_0x231ea5[_0x2b23('0x2d')]){_0x25dfd3[_0x2b23('0xf')]({'type':_0x231ea5[_0x2b23('0x10')],'app':_0x2b23('0x1d'),'appdata':_0x2b23('0x2e')+_0x231ea5['callerID']+')','context':_0x231ea5[_0x2b23('0x14')],'exten':_0x231ea5['exten'],'priority':_0x1afbda[_0x2b23('0x27')]+_0x54a01b[_0x2b23('0xc')]+_0x26b3dc++,'VoiceExtensionId':_0x231ea5[_0x2b23('0x15')]});}else{_0x25dfd3[_0x2b23('0xf')]({'type':_0x231ea5['type'],'app':_0x2b23('0x1d'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x231ea5[_0x2b23('0x14')],'exten':_0x231ea5[_0x2b23('0x8')],'priority':_0x1afbda[_0x2b23('0x27')]+_0x54a01b[_0x2b23('0xc')]+_0x26b3dc++,'VoiceExtensionId':_0x231ea5[_0x2b23('0x15')]});}}if(_0x231ea5['hasOwnProperty'](_0x2b23('0x2f'))){if(_0xd80220['indexOf'](_0x231ea5[_0x2b23('0x30')][_0x2b23('0x31')]())>=0x0&&_0x231ea5[_0x2b23('0x32')]!=='custom'){if(_0x231ea5[_0x2b23('0x2f')]){_0x25dfd3[_0x2b23('0xf')]({'type':_0x231ea5[_0x2b23('0x10')],'app':_0x2b23('0x1d'),'appdata':_0x2b23('0x33'),'context':_0x231ea5['context'],'exten':_0x231ea5[_0x2b23('0x8')],'priority':_0x1afbda['length']+_0x54a01b['priority']+_0x26b3dc++,'VoiceExtensionId':_0x231ea5[_0x2b23('0x15')]});_0x25dfd3[_0x2b23('0xf')]({'type':_0x231ea5[_0x2b23('0x10')],'app':'Set','appdata':_0x2b23('0x34'),'context':_0x231ea5[_0x2b23('0x14')],'exten':_0x231ea5[_0x2b23('0x8')],'priority':_0x1afbda['length']+_0x54a01b['priority']+_0x26b3dc++,'VoiceExtensionId':_0x231ea5[_0x2b23('0x15')]});}else{_0x25dfd3['push']({'type':_0x231ea5[_0x2b23('0x10')],'app':_0x2b23('0x1d'),'appdata':_0x2b23('0x35'),'context':_0x231ea5[_0x2b23('0x14')],'exten':_0x231ea5[_0x2b23('0x8')],'priority':_0x1afbda[_0x2b23('0x27')]+_0x54a01b[_0x2b23('0xc')]+_0x26b3dc++,'VoiceExtensionId':_0x231ea5[_0x2b23('0x15')]});_0x25dfd3[_0x2b23('0xf')]({'type':_0x231ea5[_0x2b23('0x10')],'app':_0x2b23('0x11'),'appdata':_0x2b23('0x36'),'context':_0x231ea5['context'],'exten':_0x231ea5[_0x2b23('0x8')],'priority':_0x1afbda[_0x2b23('0x27')]+_0x54a01b[_0x2b23('0xc')]+_0x26b3dc++,'VoiceExtensionId':_0x231ea5[_0x2b23('0x15')]});}}}for(var _0x17d364=0x0;_0x17d364<_0x1afbda[_0x2b23('0x27')];_0x17d364+=0x1){var _0xbf186c=_0x54a01b[_0x2b23('0xc')]+_0x1afbda[_0x2b23('0x27')];var _0x3cb2e0=_0x17d364===_0x1afbda['length']-0x1?_0x54a01b[_0x2b23('0xc')]+_0x25dfd3[_0x2b23('0x27')]+_0x17bb2f['length']+0x2:_0x54a01b[_0x2b23('0xc')]+_0x17d364+0x1;_0x25dfd3[_0x2b23('0x37')](_0x17d364,0x0,{'type':_0x231ea5[_0x2b23('0x10')],'app':'GotoIfTime','appdata':_0x1afbda[_0x17d364]+'?'+_0x231ea5[_0x2b23('0x14')]+_0x2b23('0x38')+_0xbf186c+':'+_0x231ea5[_0x2b23('0x14')]+_0x2b23('0x38')+_0x3cb2e0,'exten':_0x231ea5[_0x2b23('0x8')],'context':_0x231ea5[_0x2b23('0x14')],'priority':_0x54a01b[_0x2b23('0xc')]+_0x17d364,'VoiceExtensionId':_0x3c05d3[_0x38084d][0x0]['VoiceExtensionId']});}_0x231ea5[_0x2b23('0xc')]=_0x25dfd3[_0x2b23('0x27')]?_[_0x2b23('0x39')](_0x25dfd3)[_0x2b23('0xc')]+0x1:_0x54a01b[_0x2b23('0xc')];_0x54a01b[_0x2b23('0xc')]=(_0x17bb2f[_0x2b23('0x27')]?_[_0x2b23('0x39')](_0x17bb2f)[_0x2b23('0xc')]:_0x231ea5[_0x2b23('0xc')])+0x1;_0x54a01b[_0x2b23('0xd')]=_[_0x2b23('0x3a')](_0x54a01b['extensions'],_0x25dfd3,[_0x231ea5],_0x17bb2f);}_0x54a01b[_0x2b23('0xd')][_0x2b23('0xf')]({'type':_0x3c05d3[_0x38084d][0x0][_0x2b23('0x10')],'app':_0x2b23('0x3b'),'exten':_0x3c05d3[_0x38084d][0x0][_0x2b23('0x8')],'context':_0x3c05d3[_0x38084d][0x0][_0x2b23('0x14')],'priority':_0x54a01b[_0x2b23('0xc')],'VoiceExtensionId':_0x3c05d3[_0x38084d][0x0][_0x2b23('0x15')]});_0x2d35fe[_0x2b23('0xf')](_0x3c05d3[_0x38084d][0x0][_0x2b23('0x15')]);_0x303aa8=_[_0x2b23('0x3a')](_0x303aa8,_0x54a01b[_0x2b23('0xd')]);}}return _0x594215[_0x2b23('0x3c')](function(_0x27c5a3){return _0x594215[_0x2b23('0x6')]['VoiceExtension'][_0x2b23('0x3d')]({'where':{'VoiceExtensionId':{'$in':_0x2d35fe}},'transaction':_0x27c5a3})[_0x2b23('0x3e')](function(_0x2adb57){return _0x594215[_0x2b23('0x6')]['VoiceExtension']['bulkCreate'](_[_0x2b23('0x3f')](_0x303aa8,_0x2b23('0xc')),{'transaction':_0x27c5a3});});});})[_0x2b23('0x40')](function(_0x5cf105){console['error'](_0x5cf105);});}exports[_0x2b23('0x41')]=rewrite; \ No newline at end of file +var _0x02a1=['priority','extensions','extension','type','format','CDR(type)=%s','VoiceExtensionId','inbound','Set','CDR(routeid)=','context','outbound','push','cutdigits','${EXTEN}','ExecIf','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','toLowerCase','updatedAt','interval','intervals','hasOwnProperty','tag','CDR(tag)=','length','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','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','Hangup','concat','transaction','destroy','bulkCreate','sortBy','catch','rewrite','models','Interval','findAll','then','VoiceExtension','IntervalId','uniq','map','exten','filter','groupBy','queue','playback'];(function(_0x802fe1,_0x15435e){var _0x3f5fe1=function(_0x39e490){while(--_0x39e490){_0x802fe1['push'](_0x802fe1['shift']());}};_0x3f5fe1(++_0x15435e);}(_0x02a1,0xff));var _0x102a=function(_0x8906bc,_0x104d0c){_0x8906bc=_0x8906bc-0x0;var _0x12e910=_0x02a1[_0x8906bc];return _0x12e910;};'use strict';var _=require('lodash');var util=require('util');function rewrite(_0x4c9155,_0x32c0a1){var _0x2d0356=this;return _0x4c9155[_0x102a('0x0')][_0x102a('0x1')][_0x102a('0x2')]({'raw':!![]})[_0x102a('0x3')](function(_0x2b34b4){_0x2d0356['intervals']=_0x2b34b4;return _0x4c9155[_0x102a('0x0')][_0x102a('0x4')][_0x102a('0x2')]({'where':{'IntervalId':_0x32c0a1[_0x102a('0x5')]},'raw':!![]});})['then'](function(_0xa61728){return _0x4c9155[_0x102a('0x0')]['VoiceExtension'][_0x102a('0x2')]({'where':{'exten':{'$in':_[_0x102a('0x6')](_[_0x102a('0x7')](_0xa61728,_0x102a('0x8')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})['then'](function(_0x42c4fc){var _0x458f7d=_[_0x102a('0x9')](_0x42c4fc,{'priority':'1'});var _0x1db466=_[_0x102a('0x9')](_0x42c4fc,{'isApp':0x1});var _0x258f5a=_[_0x102a('0xa')](_0x1db466,'exten');var _0x13ef7b=[_0x102a('0xb'),_0x102a('0xc')];var _0x1d3578=[];var _0x1daed0=[];for(var _0x2c7a7a in _0x258f5a){if(_0x258f5a['hasOwnProperty'](_0x2c7a7a)){_0x2d0356[_0x102a('0xd')]=0x2;_0x2d0356[_0x102a('0xe')]=[];_0x2d0356[_0x102a('0xf')]=_['find'](_0x458f7d,{'exten':_0x258f5a[_0x2c7a7a][0x0][_0x102a('0x8')]});_0x2d0356[_0x102a('0xe')]['push']({'type':_0x258f5a[_0x2c7a7a][0x0][_0x102a('0x10')],'app':'Set','appdata':util[_0x102a('0x11')](_0x102a('0x12'),_0x258f5a[_0x2c7a7a][0x0][_0x102a('0x10')]),'context':_0x258f5a[_0x2c7a7a][0x0]['context'],'exten':_0x258f5a[_0x2c7a7a][0x0][_0x102a('0x8')],'priority':_0x2d0356[_0x102a('0xd')]++,'VoiceExtensionId':_0x258f5a[_0x2c7a7a][0x0][_0x102a('0x13')]});if(_0x258f5a[_0x2c7a7a][0x0][_0x102a('0x10')]===_0x102a('0x14')){_0x2d0356[_0x102a('0xe')]['push']({'type':_0x258f5a[_0x2c7a7a][0x0][_0x102a('0x10')],'app':_0x102a('0x15'),'appdata':_0x102a('0x16')+_0x258f5a[_0x2c7a7a][0x0][_0x102a('0x13')],'context':_0x258f5a[_0x2c7a7a][0x0][_0x102a('0x17')],'exten':_0x258f5a[_0x2c7a7a][0x0][_0x102a('0x8')],'priority':_0x2d0356['priority']++,'VoiceExtensionId':_0x258f5a[_0x2c7a7a][0x0]['VoiceExtensionId']});}else if(_0x258f5a[_0x2c7a7a][0x0]['type']===_0x102a('0x18')){if(_0x2d0356[_0x102a('0xf')]){_0x2d0356[_0x102a('0xe')][_0x102a('0x19')]({'type':_0x258f5a[_0x2c7a7a][0x0][_0x102a('0x10')],'app':_0x102a('0x15'),'appdata':'CDR(destination)='+(_0x2d0356[_0x102a('0xf')][_0x102a('0x1a')]?'${EXTEN:'+_0x2d0356[_0x102a('0xf')][_0x102a('0x1a')]+'}':_0x102a('0x1b')),'context':_0x258f5a[_0x2c7a7a][0x0]['context'],'exten':_0x258f5a[_0x2c7a7a][0x0]['exten'],'priority':_0x2d0356[_0x102a('0xd')]++,'VoiceExtensionId':_0x258f5a[_0x2c7a7a][0x0][_0x102a('0x13')]});}_0x2d0356[_0x102a('0xe')]['push']({'type':_0x258f5a[_0x2c7a7a][0x0]['type'],'app':_0x102a('0x15'),'appdata':_0x102a('0x16')+_0x258f5a[_0x2c7a7a][0x0][_0x102a('0x13')],'context':_0x258f5a[_0x2c7a7a][0x0][_0x102a('0x17')],'exten':_0x258f5a[_0x2c7a7a][0x0][_0x102a('0x8')],'priority':_0x2d0356['priority']++,'VoiceExtensionId':_0x258f5a[_0x2c7a7a][0x0]['VoiceExtensionId']});var _0x334fb7=_0x2d0356[_0x102a('0xd')]++;_0x2d0356['extensions'][_0x102a('0x19')]({'type':_0x258f5a[_0x2c7a7a][0x0][_0x102a('0x10')],'app':_0x102a('0x1c'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x334fb7+0x2)+'):Goto('+(_0x334fb7+0x1)+')','context':_0x258f5a[_0x2c7a7a][0x0]['context'],'exten':_0x258f5a[_0x2c7a7a][0x0][_0x102a('0x8')],'priority':_0x334fb7,'VoiceExtensionId':_0x258f5a[_0x2c7a7a][0x0][_0x102a('0x13')]});if(_0x2d0356[_0x102a('0xf')]){_0x2d0356[_0x102a('0xe')][_0x102a('0x19')]({'type':_0x258f5a[_0x2c7a7a][0x0]['type'],'app':_0x102a('0x15'),'appdata':_0x2d0356[_0x102a('0xf')][_0x102a('0x1a')]?_0x102a('0x1d')+_0x2d0356['extension'][_0x102a('0x1a')]+'}':_0x102a('0x1e'),'context':_0x258f5a[_0x2c7a7a][0x0][_0x102a('0x17')],'exten':_0x258f5a[_0x2c7a7a][0x0][_0x102a('0x8')],'priority':_0x2d0356[_0x102a('0xd')]++,'VoiceExtensionId':_0x258f5a[_0x2c7a7a][0x0]['VoiceExtensionId']});}_0x2d0356[_0x102a('0xe')]['push']({'type':_0x258f5a[_0x2c7a7a][0x0][_0x102a('0x10')],'app':_0x102a('0x15'),'appdata':_0x102a('0x1f')+_0x258f5a[_0x2c7a7a][0x0][_0x102a('0x13')],'context':_0x258f5a[_0x2c7a7a][0x0][_0x102a('0x17')],'exten':_0x258f5a[_0x2c7a7a][0x0][_0x102a('0x8')],'priority':_0x2d0356['priority']++,'VoiceExtensionId':_0x258f5a[_0x2c7a7a][0x0][_0x102a('0x13')]});if(_0x2d0356[_0x102a('0xf')]&&_0x2d0356['extension']['hasOwnProperty'](_0x102a('0x20'))&&_0x2d0356['extension'][_0x102a('0x20')]!=='none'){_0x2d0356['extensions']['push']({'type':_0x258f5a[_0x2c7a7a][0x0][_0x102a('0x10')],'app':'Set','appdata':_0x102a('0x21'),'context':_0x258f5a[_0x2c7a7a][0x0][_0x102a('0x17')],'exten':_0x258f5a[_0x2c7a7a][0x0]['exten'],'priority':_0x2d0356[_0x102a('0xd')]++,'VoiceExtensionId':_0x258f5a[_0x2c7a7a][0x0][_0x102a('0x13')]});_0x2d0356[_0x102a('0xe')]['push']({'type':_0x258f5a[_0x2c7a7a][0x0]['type'],'app':_0x102a('0x15'),'appdata':_0x102a('0x22')+_0x2d0356[_0x102a('0xf')]['recordingFormat']||'wav','context':_0x258f5a[_0x2c7a7a][0x0]['context'],'exten':_0x258f5a[_0x2c7a7a][0x0][_0x102a('0x8')],'priority':_0x2d0356['priority']++,'VoiceExtensionId':_0x258f5a[_0x2c7a7a][0x0][_0x102a('0x13')]});}}_0x2d0356['extensions'][_0x102a('0x19')]({'type':_0x258f5a[_0x2c7a7a][0x0][_0x102a('0x10')],'app':_0x102a('0x15'),'appdata':_0x102a('0x23'),'context':_0x258f5a[_0x2c7a7a][0x0][_0x102a('0x17')],'exten':_0x258f5a[_0x2c7a7a][0x0]['exten'],'priority':_0x2d0356[_0x102a('0xd')]++,'VoiceExtensionId':_0x258f5a[_0x2c7a7a][0x0][_0x102a('0x13')]});_0x2d0356['extensions'][_0x102a('0x19')]({'type':_0x258f5a[_0x2c7a7a][0x0][_0x102a('0x10')],'app':_0x102a('0x15'),'appdata':_0x102a('0x24'),'context':_0x258f5a[_0x2c7a7a][0x0][_0x102a('0x17')],'exten':_0x258f5a[_0x2c7a7a][0x0][_0x102a('0x8')],'priority':_0x2d0356[_0x102a('0xd')]++,'VoiceExtensionId':_0x258f5a[_0x2c7a7a][0x0][_0x102a('0x13')]});_0x2d0356[_0x102a('0xe')][_0x102a('0x19')]({'type':_0x258f5a[_0x2c7a7a][0x0][_0x102a('0x10')],'app':_0x102a('0x15'),'appdata':'MONITOR_OPTIONS=ab','context':_0x258f5a[_0x2c7a7a][0x0][_0x102a('0x17')],'exten':_0x258f5a[_0x2c7a7a][0x0][_0x102a('0x8')],'priority':_0x2d0356[_0x102a('0xd')]++,'VoiceExtensionId':_0x258f5a[_0x2c7a7a][0x0][_0x102a('0x13')]});for(var _0x409040=0x0,_0x4bcaa9=0x0;_0x409040<_0x258f5a[_0x2c7a7a]['length'];_0x409040+=0x1,_0x4bcaa9=0x0){var _0x516d51=_0x258f5a[_0x2c7a7a][_0x409040];if(_0x516d51[_0x102a('0x10')]){_0x516d51[_0x102a('0x10')]=_0x516d51[_0x102a('0x10')][_0x102a('0x25')]();}var _0x37e667=[];var _0x2050e4=[];delete _0x516d51['id'];delete _0x516d51['createdAt'];delete _0x516d51[_0x102a('0x26')];var _0x14e4b7=_0x516d51[_0x102a('0x27')]!=='*,*,*,*'?[_0x516d51['interval']]:_0x516d51[_0x102a('0x5')]?_[_0x102a('0x7')](_[_0x102a('0x9')](_0x2d0356[_0x102a('0x28')],{'IntervalId':_0x516d51[_0x102a('0x5')]}),_0x102a('0x27')):[];if(_0x516d51[_0x102a('0x29')](_0x102a('0x2a'))){if(_0x516d51[_0x102a('0x2a')]&&_0x516d51[_0x102a('0x2a')]!=='--'){_0x37e667[_0x102a('0x19')]({'type':_0x516d51[_0x102a('0x10')],'app':_0x102a('0x15'),'appdata':_0x102a('0x2b')+_0x516d51['tag'],'context':_0x516d51[_0x102a('0x17')],'exten':_0x516d51[_0x102a('0x8')],'priority':_0x14e4b7[_0x102a('0x2c')]+_0x2d0356[_0x102a('0xd')]+_0x4bcaa9++,'VoiceExtensionId':_0x516d51[_0x102a('0x13')]});}}if(_0x516d51[_0x102a('0x10')]==='outbound'&&_0x516d51[_0x102a('0x29')](_0x102a('0x2d'))){if(_0x516d51[_0x102a('0x2d')]){_0x37e667[_0x102a('0x19')]({'type':_0x516d51[_0x102a('0x10')],'app':'ExecIf','appdata':_0x102a('0x2e')+_0x516d51[_0x102a('0x2d')]+')','context':_0x516d51['context'],'exten':_0x516d51['exten'],'priority':_0x14e4b7[_0x102a('0x2c')]+_0x2d0356[_0x102a('0xd')]+_0x4bcaa9++,'VoiceExtensionId':_0x516d51[_0x102a('0x13')]});}else{_0x37e667['push']({'type':_0x516d51[_0x102a('0x10')],'app':_0x102a('0x1c'),'appdata':_0x102a('0x2f'),'context':_0x516d51[_0x102a('0x17')],'exten':_0x516d51['exten'],'priority':_0x14e4b7['length']+_0x2d0356[_0x102a('0xd')]+_0x4bcaa9++,'VoiceExtensionId':_0x516d51[_0x102a('0x13')]});}}if(_0x516d51[_0x102a('0x29')](_0x102a('0x30'))){if(_0x13ef7b['indexOf'](_0x516d51[_0x102a('0x31')][_0x102a('0x25')]())>=0x0&&_0x516d51[_0x102a('0x32')]!==_0x102a('0x33')){if(_0x516d51['answer']){_0x37e667[_0x102a('0x19')]({'type':_0x516d51[_0x102a('0x10')],'app':'ExecIf','appdata':_0x102a('0x34'),'context':_0x516d51[_0x102a('0x17')],'exten':_0x516d51[_0x102a('0x8')],'priority':_0x14e4b7['length']+_0x2d0356['priority']+_0x4bcaa9++,'VoiceExtensionId':_0x516d51[_0x102a('0x13')]});_0x37e667[_0x102a('0x19')]({'type':_0x516d51[_0x102a('0x10')],'app':_0x102a('0x15'),'appdata':_0x102a('0x35'),'context':_0x516d51['context'],'exten':_0x516d51['exten'],'priority':_0x14e4b7[_0x102a('0x2c')]+_0x2d0356[_0x102a('0xd')]+_0x4bcaa9++,'VoiceExtensionId':_0x516d51['VoiceExtensionId']});}else{_0x37e667['push']({'type':_0x516d51[_0x102a('0x10')],'app':_0x102a('0x1c'),'appdata':_0x102a('0x36'),'context':_0x516d51[_0x102a('0x17')],'exten':_0x516d51[_0x102a('0x8')],'priority':_0x14e4b7[_0x102a('0x2c')]+_0x2d0356[_0x102a('0xd')]+_0x4bcaa9++,'VoiceExtensionId':_0x516d51['VoiceExtensionId']});_0x37e667[_0x102a('0x19')]({'type':_0x516d51['type'],'app':_0x102a('0x15'),'appdata':_0x102a('0x37'),'context':_0x516d51[_0x102a('0x17')],'exten':_0x516d51[_0x102a('0x8')],'priority':_0x14e4b7['length']+_0x2d0356['priority']+_0x4bcaa9++,'VoiceExtensionId':_0x516d51[_0x102a('0x13')]});}}}for(var _0x5ab7cd=0x0;_0x5ab7cd<_0x14e4b7[_0x102a('0x2c')];_0x5ab7cd+=0x1){var _0x10f874=_0x2d0356[_0x102a('0xd')]+_0x14e4b7['length'];var _0x36ad29=_0x5ab7cd===_0x14e4b7[_0x102a('0x2c')]-0x1?_0x2d0356[_0x102a('0xd')]+_0x37e667['length']+_0x2050e4[_0x102a('0x2c')]+0x2:_0x2d0356[_0x102a('0xd')]+_0x5ab7cd+0x1;_0x37e667['splice'](_0x5ab7cd,0x0,{'type':_0x516d51['type'],'app':_0x102a('0x38'),'appdata':_0x14e4b7[_0x5ab7cd]+'?'+_0x516d51[_0x102a('0x17')]+_0x102a('0x39')+_0x10f874+':'+_0x516d51['context']+_0x102a('0x39')+_0x36ad29,'exten':_0x516d51[_0x102a('0x8')],'context':_0x516d51['context'],'priority':_0x2d0356[_0x102a('0xd')]+_0x5ab7cd,'VoiceExtensionId':_0x258f5a[_0x2c7a7a][0x0]['VoiceExtensionId']});}_0x516d51['priority']=_0x37e667[_0x102a('0x2c')]?_['last'](_0x37e667)[_0x102a('0xd')]+0x1:_0x2d0356['priority'];_0x2d0356[_0x102a('0xd')]=(_0x2050e4[_0x102a('0x2c')]?_[_0x102a('0x3a')](_0x2050e4)['priority']:_0x516d51['priority'])+0x1;_0x2d0356[_0x102a('0xe')]=_['concat'](_0x2d0356['extensions'],_0x37e667,[_0x516d51],_0x2050e4);}_0x2d0356[_0x102a('0xe')]['push']({'type':_0x258f5a[_0x2c7a7a][0x0][_0x102a('0x10')],'app':_0x102a('0x3b'),'exten':_0x258f5a[_0x2c7a7a][0x0][_0x102a('0x8')],'context':_0x258f5a[_0x2c7a7a][0x0]['context'],'priority':_0x2d0356[_0x102a('0xd')],'VoiceExtensionId':_0x258f5a[_0x2c7a7a][0x0]['VoiceExtensionId']});_0x1d3578[_0x102a('0x19')](_0x258f5a[_0x2c7a7a][0x0][_0x102a('0x13')]);_0x1daed0=_[_0x102a('0x3c')](_0x1daed0,_0x2d0356[_0x102a('0xe')]);}}return _0x4c9155[_0x102a('0x3d')](function(_0x579649){return _0x4c9155[_0x102a('0x0')]['VoiceExtension'][_0x102a('0x3e')]({'where':{'VoiceExtensionId':{'$in':_0x1d3578}},'transaction':_0x579649})[_0x102a('0x3')](function(_0x4f60bd){return _0x4c9155[_0x102a('0x0')][_0x102a('0x4')][_0x102a('0x3f')](_[_0x102a('0x40')](_0x1daed0,_0x102a('0xd')),{'transaction':_0x579649});});});})[_0x102a('0x41')](function(_0x3d2367){console['error'](_0x3d2367);});}exports[_0x102a('0x42')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 2155987..5367314 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 _0x0f4b=['index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','Duplicate\x20Contact','CmContact','create','keys','then','push','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','inspect','insert','fromQuery','phone','scheduledAt','ContactId','createdAt','updatedAt','field','toString','NOW()','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','cm_hopper','\x20=\x20?','id\x20IN\x20?','str','cm_hopper_final','into','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','query','VoiceQueueId','onlyIfOpen','catch','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','emit','resume','resolve','contact:csv_','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','parse','duplicate','pause','info','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','squel','../../../mysqldb','../../../config/environment','../../../config/logger','api','defaults','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','error','contact'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0f4b,0x139));var _0xb0f4=function(_0x20da64,_0x38d4cc){_0x20da64=_0x20da64-0x0;var _0x51777c=_0x0f4b[_0x20da64];return _0x51777c;};'use strict';var BPromise=require(_0xb0f4('0x0'));var util=require(_0xb0f4('0x1'));var _=require('lodash');var fs=require('fs');var squel=require(_0xb0f4('0x2'));var Papa=require('papaparse');var Redis=require('ioredis');var db=require(_0xb0f4('0x3'))['db'];var config=require(_0xb0f4('0x4'));var logger=require(_0xb0f4('0x5'))(_0xb0f4('0x6'));config['redis']=_[_0xb0f4('0x7')](config[_0xb0f4('0x8')],{'host':_0xb0f4('0x9'),'port':0x18eb});var socket=require(_0xb0f4('0xa'))(new Redis(config[_0xb0f4('0x8')]));require(_0xb0f4('0xb'))[_0xb0f4('0xc')](socket);try{if(!process[_0xb0f4('0xd')][0x2]||process[_0xb0f4('0xd')][0x2]===_0xb0f4('0xe')||process[_0xb0f4('0xd')][0x2]===_0xb0f4('0xf')){throw new Error(_0xb0f4('0x10'));}var FILEPATH=process[_0xb0f4('0xd')][0x2];if(!process[_0xb0f4('0xd')][0x3]||process[_0xb0f4('0xd')][0x3]==='undefined'||process[_0xb0f4('0xd')][0x3]==='null'||!process[_0xb0f4('0xd')][0x4]||process['argv'][0x4]==='undefined'||process['argv'][0x4]===_0xb0f4('0xf')){throw new Error(_0xb0f4('0x11'));}var FIELDS=_[_0xb0f4('0x12')](process[_0xb0f4('0xd')][0x3][_0xb0f4('0x13')](','),process[_0xb0f4('0xd')][0x4][_0xb0f4('0x13')](','));if(!process[_0xb0f4('0xd')][0x5]||process[_0xb0f4('0xd')][0x5]===_0xb0f4('0xe')||process['argv'][0x5]===_0xb0f4('0xf')){throw new Error(_0xb0f4('0x14'));}var LISTID=process['argv'][0x5];var COMPANYID=process['argv'][0x6]&&process[_0xb0f4('0xd')][0x6]!=='undefined'&&process[_0xb0f4('0xd')][0x6]!==_0xb0f4('0xf')?process[_0xb0f4('0xd')][0x6]:null;var DUPLICATES=process[_0xb0f4('0xd')][0x7]&&process[_0xb0f4('0xd')][0x7]!==_0xb0f4('0xe')&&process['argv'][0x7]!==_0xb0f4('0xf')?process['argv'][0x7]:null;if(!process[_0xb0f4('0xd')][0x8]||process['argv'][0x8]==='undefined'||process[_0xb0f4('0xd')][0x8]===_0xb0f4('0xf')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0xb0f4('0xd')][0x8];}catch(_0x18904b){logger[_0xb0f4('0x15')](_0x18904b);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(_0x167bc0,_0x2e517c,_0x67fe6e,_0x5e7230){var _0x2098fb={'message':_0x2e517c};_0x2098fb[_0x167bc0]=!![];if(_0x67fe6e){_0x2098fb[_0xb0f4('0x16')]=_0x67fe6e;}if(_0x5e7230){_0x2098fb[_0xb0f4('0x17')]=_0x5e7230;}return _0x2098fb;}function isEmail(_0x7b0e90){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))*$/[_0xb0f4('0x18')](_0x7b0e90);}function checkRow(_0x47919e,_0x2c3457,_0x4c98f7){return new BPromise(function(_0x85af1f,_0x5baaba){if(_[_0xb0f4('0x19')](_0x47919e)){return _0x5baaba(handleCheckRowError(_0xb0f4('0x15'),_0xb0f4('0x1a'),null,_0x4c98f7));}if(_0x47919e[_0xb0f4('0x1b')]&&_0x47919e[_0xb0f4('0x1b')][_0xb0f4('0x1c')]){var _0x1eda13=_[_0xb0f4('0x1d')](_0x47919e[_0xb0f4('0x1b')],_0xb0f4('0x1e'))[_0xb0f4('0x1f')](';');return _0x5baaba(handleCheckRowError(_0xb0f4('0x15'),_0x1eda13,null,_0x4c98f7));}var _0x58659f={};for(var _0x7fb781 in FIELDS){if(FIELDS[_0xb0f4('0x20')](_0x7fb781)&&FIELDS[_0x7fb781]){_0x58659f[_0x7fb781]=_0x47919e[_0xb0f4('0x21')][0x0][FIELDS[_0x7fb781]]||_0x47919e[_0xb0f4('0x21')][0x0]['\ufeff'+FIELDS[_0x7fb781]];}}if(!_0x58659f[_0xb0f4('0x22')]){return _0x5baaba(handleCheckRowError(_0xb0f4('0x15'),_0xb0f4('0x23'),null,_0x4c98f7));}if(!_0x58659f['phone']){return _0x5baaba(handleCheckRowError(_0xb0f4('0x15'),'phone\x20not\x20specified!',null,_0x4c98f7));}if(_0x58659f['birthDate']){var _0x261d08=moment(_0x58659f[_0xb0f4('0x24')],_0xb0f4('0x25'));if(!_0x261d08[_0xb0f4('0x26')]()){return _0x5baaba(handleCheckRowError(_0xb0f4('0x15'),_0xb0f4('0x27'),null,_0x4c98f7));}}if(_0x58659f[_0xb0f4('0x28')]){if(!isEmail(_0x58659f['email'])){return _0x5baaba(handleCheckRowError(_0xb0f4('0x15'),_0xb0f4('0x29'),null,_0x4c98f7));}}_0x58659f[_0xb0f4('0x2a')]=LISTID;_0x58659f['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xb0f4('0x1c')]&&_0x2c3457){var _0x145ecf={};for(var _0x12d5f1=0x0,_0x39b6ce=DUPLICATES[_0xb0f4('0x1c')];_0x12d5f1<_0x39b6ce;_0x12d5f1+=0x1){_0x145ecf[DUPLICATES[_0x12d5f1]]=_0x58659f[DUPLICATES[_0x12d5f1]];}var _0x3d825e=_['find'](_0x2c3457,_0x145ecf);if(_0x3d825e){return _0x5baaba(handleCheckRowError('duplicate',_0xb0f4('0x2b'),_0x3d825e,_0x4c98f7));}}return db[_0xb0f4('0x2c')][_0xb0f4('0x2d')](_0x58659f,{'raw':!![],'hooks':![],'fields':_[_0xb0f4('0x2e')](_0x58659f)})[_0xb0f4('0x2f')](function(_0x4cadda){if(DUPLICATES&&DUPLICATES[_0xb0f4('0x1c')]&&_0x2c3457){_0x2c3457[_0xb0f4('0x30')](_['pick'](_0x58659f,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x4cadda['id'];return _0x85af1f();})['catch'](function(_0x36f3da){return _0x5baaba(handleCheckRowError(_0xb0f4('0x15'),_0xb0f4('0x31')+(_0x36f3da[_0xb0f4('0x1e')]||JSON[_0xb0f4('0x32')](_0x36f3da)),null,_0x4c98f7));});});}function checkHopper(){function _0x4ea841(){return function(_0x1c1560){logger[_0xb0f4('0x15')](_0xb0f4('0x33'),'checkHopper',util[_0xb0f4('0x34')](_0x1c1560,{'showHidden':![],'depth':null}));};}var _0xe770d7=function(_0x9f4759,_0xe29999){var _0x338448=squel[_0xb0f4('0x35')]()['into']('cm_hopper')[_0xb0f4('0x36')]([_0xb0f4('0x37'),_0xb0f4('0x38'),_0xb0f4('0x39'),_0xb0f4('0x2a'),_0xe29999,_0xb0f4('0x3a'),_0xb0f4('0x3b')],squel['select']()[_0xb0f4('0x3c')](_0xb0f4('0x37'),_0xb0f4('0x37'))[_0xb0f4('0x3c')]('NOW()',_0xb0f4('0x38'))[_0xb0f4('0x3c')]('id',_0xb0f4('0x39'))[_0xb0f4('0x3c')](LISTID[_0xb0f4('0x3d')](),_0xb0f4('0x2a'))[_0xb0f4('0x3c')](_0x9f4759['id'][_0xb0f4('0x3d')](),_0xe29999)[_0xb0f4('0x3c')]('NOW()',_0xb0f4('0x3a'))[_0xb0f4('0x3c')](_0xb0f4('0x3e'),_0xb0f4('0x3b'))[_0xb0f4('0x3f')](_0xb0f4('0x40'))[_0xb0f4('0x41')](_0xb0f4('0x42'))[_0xb0f4('0x41')](_0xb0f4('0x43'),LISTID[_0xb0f4('0x3d')]())[_0xb0f4('0x41')](_0xb0f4('0x44'))[_0xb0f4('0x41')](_0xb0f4('0x45'),squel[_0xb0f4('0x46')]()[_0xb0f4('0x3c')]('phone')[_0xb0f4('0x3f')](_0xb0f4('0x47'))[_0xb0f4('0x41')](_0xe29999+_0xb0f4('0x48'),_0x9f4759['id'][_0xb0f4('0x3d')]())))[_0xb0f4('0x3d')]();return _0x338448;};var _0x768fd0=function(_0x197382,_0x52b169){var _0x3d591f=squel['insert']()['into'](_0xb0f4('0x47'))[_0xb0f4('0x36')]([_0xb0f4('0x37'),_0xb0f4('0x38'),_0xb0f4('0x39'),_0xb0f4('0x2a'),_0x52b169,_0xb0f4('0x3a'),'updatedAt'],squel['select']()[_0xb0f4('0x3c')](_0xb0f4('0x37'),_0xb0f4('0x37'))['field'](_0xb0f4('0x3e'),'scheduledAt')[_0xb0f4('0x3c')]('id',_0xb0f4('0x39'))[_0xb0f4('0x3c')](LISTID[_0xb0f4('0x3d')](),_0xb0f4('0x2a'))[_0xb0f4('0x3c')](_0x197382['id'][_0xb0f4('0x3d')](),_0x52b169)[_0xb0f4('0x3c')](_0xb0f4('0x3e'),'createdAt')['field'](_0xb0f4('0x3e'),_0xb0f4('0x3b'))['from']('cm_contacts')[_0xb0f4('0x41')](_0xb0f4('0x42'))[_0xb0f4('0x41')](_0xb0f4('0x43'),LISTID['toString']())['where'](_0xb0f4('0x49'),squel[_0xb0f4('0x4a')](hopperContacts))[_0xb0f4('0x41')]('phone\x20IS\x20NOT\x20NULL')[_0xb0f4('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0xb0f4('0x46')]()[_0xb0f4('0x3c')]('calleridnum')[_0xb0f4('0x3f')](_0xb0f4('0x4b'))[_0xb0f4('0x41')](_0x52b169+_0xb0f4('0x48'),_0x197382['id'][_0xb0f4('0x3d')]()))[_0xb0f4('0x41')](_0xb0f4('0x45'),squel[_0xb0f4('0x46')]()[_0xb0f4('0x3c')](_0xb0f4('0x37'))['from'](_0xb0f4('0x47'))[_0xb0f4('0x41')](_0x52b169+_0xb0f4('0x48'),_0x197382['id'][_0xb0f4('0x3d')]())))[_0xb0f4('0x3d')]();return _0x3d591f;};function _0x42ed81(_0x438e2d,_0x34ece9){var _0x17bef9=squel['insert']()['into'](_0xb0f4('0x47'))['fromQuery'](['phone','scheduledAt','ContactId','ListId',_0x34ece9,_0xb0f4('0x3a'),_0xb0f4('0x3b')],squel[_0xb0f4('0x46')]()['field']('phone','phone')[_0xb0f4('0x3c')](_0xb0f4('0x3e'),_0xb0f4('0x38'))[_0xb0f4('0x3c')]('id',_0xb0f4('0x39'))[_0xb0f4('0x3c')](LISTID[_0xb0f4('0x3d')](),'ListId')[_0xb0f4('0x3c')](_0x438e2d['id']['toString'](),_0x34ece9)['field'](_0xb0f4('0x3e'),_0xb0f4('0x3a'))[_0xb0f4('0x3c')](_0xb0f4('0x3e'),_0xb0f4('0x3b'))[_0xb0f4('0x3f')](_0xb0f4('0x40'))[_0xb0f4('0x41')](_0xb0f4('0x42'))[_0xb0f4('0x41')](_0xb0f4('0x43'),LISTID[_0xb0f4('0x3d')]())[_0xb0f4('0x41')](_0xb0f4('0x49'),squel[_0xb0f4('0x4a')](hopperContacts))[_0xb0f4('0x41')]('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x17bef9;}function _0x5118ca(_0x1b8944,_0x369b5c){var _0x53b849=squel[_0xb0f4('0x35')]()[_0xb0f4('0x4c')](_0xb0f4('0x4d'))[_0xb0f4('0x36')]([_0xb0f4('0x37'),'ContactId',_0xb0f4('0x2a'),_0x369b5c,'createdAt',_0xb0f4('0x3b')],squel[_0xb0f4('0x46')]()[_0xb0f4('0x3c')]('phone',_0xb0f4('0x37'))[_0xb0f4('0x3c')]('id',_0xb0f4('0x39'))[_0xb0f4('0x3c')](LISTID[_0xb0f4('0x3d')](),'ListId')['field'](_0x1b8944['id'][_0xb0f4('0x3d')](),_0x369b5c)['field']('NOW()',_0xb0f4('0x3a'))['field'](_0xb0f4('0x3e'),_0xb0f4('0x3b'))[_0xb0f4('0x3f')](_0xb0f4('0x40'))[_0xb0f4('0x41')](_0xb0f4('0x42'))[_0xb0f4('0x41')]('ListId\x20=\x20?',LISTID['toString']())['where'](_0xb0f4('0x49'),squel[_0xb0f4('0x4a')](hopperContacts))[_0xb0f4('0x41')](_0xb0f4('0x44')))['toString']();return _0x53b849;}return db[_0xb0f4('0x4e')][_0xb0f4('0x4f')]({'where':{'type':_0xb0f4('0x50')},'attributes':['id',_0xb0f4('0x51')],'include':[{'model':db[_0xb0f4('0x52')],'as':_0xb0f4('0x53'),'where':{'id':LISTID}}]})[_0xb0f4('0x2f')](function(_0x259609){var _0x4d4220=[];if(_0x259609){var _0x49155a;for(var _0x3f866c=0x0,_0x217145;_0x3f866c<_0x259609['length'];_0x3f866c+=0x1){_0x217145=_0x259609[_0x3f866c][_0xb0f4('0x54')]({'plain':!![]});switch(_0x217145[_0xb0f4('0x51')]){case _0xb0f4('0x55'):_0x4d4220[_0xb0f4('0x30')](db[_0xb0f4('0x56')][_0xb0f4('0x57')](_0x768fd0(_0x217145,_0xb0f4('0x58')))['then'](function(){})['catch'](_0x4ea841()));break;case _0xb0f4('0x59'):_0x4d4220[_0xb0f4('0x30')](db[_0xb0f4('0x56')]['query'](_0xe770d7(_0x217145,_0xb0f4('0x58')))[_0xb0f4('0x2f')](function(){})[_0xb0f4('0x5a')](_0x4ea841()));break;default:_0x4d4220['push'](db['sequelize'][_0xb0f4('0x57')](_0x42ed81(_0x217145,_0xb0f4('0x58')))[_0xb0f4('0x2f')](function(){})[_0xb0f4('0x5a')](_0x4ea841()));}}}return _0x4d4220;})[_0xb0f4('0x5b')]()['then'](function(){return db[_0xb0f4('0x4e')][_0xb0f4('0x4f')]({'where':{'type':_0xb0f4('0x50')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xb0f4('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0x32b9be){var _0x23dc04=[];if(_0x32b9be){var _0x327d17;for(var _0x4e6501=0x0,_0x14328c;_0x4e6501<_0x32b9be['length'];_0x4e6501+=0x1){_0x14328c=_0x32b9be[_0x4e6501][_0xb0f4('0x54')]({'plain':!![]});_0x23dc04[_0xb0f4('0x30')](db[_0xb0f4('0x56')][_0xb0f4('0x57')](_0x5118ca(_0x14328c,'VoiceQueueId'))[_0xb0f4('0x2f')](function(){})[_0xb0f4('0x5a')](_0x4ea841()));}}return _0x23dc04;})[_0xb0f4('0x5b')]();})[_0xb0f4('0x2f')](function(){return db[_0xb0f4('0x5d')][_0xb0f4('0x4f')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xb0f4('0x52')],'as':_0xb0f4('0x53'),'where':{'id':LISTID}}]})[_0xb0f4('0x2f')](function(_0x5e327b){var _0x4c96b3=[];if(_0x5e327b){for(var _0x48c256=0x0,_0x14c801;_0x48c256<_0x5e327b['length'];_0x48c256+=0x1){_0x14c801=_0x5e327b[_0x48c256][_0xb0f4('0x54')]({'plain':!![]});switch(_0x14c801[_0xb0f4('0x51')]){case'always':_0x4c96b3[_0xb0f4('0x30')](db[_0xb0f4('0x56')][_0xb0f4('0x57')](_0x768fd0(_0x14c801,_0xb0f4('0x5e')))['then'](function(){})[_0xb0f4('0x5a')](_0x4ea841()));break;case _0xb0f4('0x59'):_0x4c96b3[_0xb0f4('0x30')](db[_0xb0f4('0x56')][_0xb0f4('0x57')](_0xe770d7(_0x14c801,'CampaignId'))[_0xb0f4('0x2f')](function(){})[_0xb0f4('0x5a')](_0x4ea841()));break;default:_0x4c96b3['push'](db['sequelize'][_0xb0f4('0x57')](_0x42ed81(_0x14c801,'CampaignId'))[_0xb0f4('0x2f')](function(){})['catch'](_0x4ea841()));}}}return _0x4c96b3;})[_0xb0f4('0x5b')]();})[_0xb0f4('0x2f')](function(){return db[_0xb0f4('0x5d')][_0xb0f4('0x4f')]({'attributes':['id'],'include':[{'model':db[_0xb0f4('0x52')],'as':_0xb0f4('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0xccd9ce){var _0x242e87=[];if(_0xccd9ce){for(var _0x22d1f8=0x0,_0x2c133c;_0x22d1f8<_0xccd9ce[_0xb0f4('0x1c')];_0x22d1f8+=0x1){_0x2c133c=_0xccd9ce[_0x22d1f8]['get']({'plain':!![]});_0x242e87[_0xb0f4('0x30')](db['sequelize'][_0xb0f4('0x57')](_0x5118ca(_0x2c133c,'CampaignId'))[_0xb0f4('0x2f')](function(){})['catch'](_0x4ea841()));}}return _0x242e87;})[_0xb0f4('0x5b')]();})[_0xb0f4('0x5a')](function(_0x18e581){logger[_0xb0f4('0x15')](_0xb0f4('0x5f'),_0xb0f4('0x60'),_0x18e581['message']);});}var processPromises=function(_0x2741fd){return BPromise[_0xb0f4('0x5b')](promises)['then'](function(_0x287c3f){})['catch'](function(_0x119deb){logger[_0xb0f4('0x15')](_0xb0f4('0x61'),JSON[_0xb0f4('0x32')](_0x119deb));})['finally'](function(){socket[_0xb0f4('0x62')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2741fd){return _0x2741fd[_0xb0f4('0x63')]();}});};var endCsv=function(){return BPromise[_0xb0f4('0x64')]()[_0xb0f4('0x2f')](function(){if(hopperContacts){return checkHopper();}})[_0xb0f4('0x2f')](function(){socket['emit'](_0xb0f4('0x65')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0xc93783){logger[_0xb0f4('0x15')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0xb0f4('0x32')](_0xc93783));}finally{process[_0xb0f4('0x66')](0x0);}});};process['on'](_0xb0f4('0x67'),function(){logger['info'](_0xb0f4('0x68'));endCsv();});function main(){return BPromise[_0xb0f4('0x64')]()[_0xb0f4('0x2f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xb0f4('0x13')](',');return db[_0xb0f4('0x2c')][_0xb0f4('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xb0f4('0x2f')](function(_0x28dee5){var _0x22a958=fs[_0xb0f4('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xb0f4('0x6a')](_0x22a958,{'header':!![],'skipEmptyLines':!![],'step':function(_0x16cfd7,_0x2d77bb){total+=0x1;var _0x1a3aac=total;promises['push'](checkRow(_0x16cfd7,_0x28dee5,_0x1a3aac)[_0xb0f4('0x2f')](function(){success+=0x1;})[_0xb0f4('0x5a')](function(_0x1597a3){if(_0x1597a3[_0xb0f4('0x15')]){errors+=0x1;delete _0x1597a3['error'];}else if(_0x1597a3[_0xb0f4('0x6b')]){duplicates+=0x1;delete _0x1597a3['duplicate'];}rows[_0xb0f4('0x30')](_0x1597a3);}));if(total%0xc8===0x0){_0x2d77bb[_0xb0f4('0x6c')]();return processPromises(_0x2d77bb);}},'complete':function(){return processPromises()[_0xb0f4('0x2f')](function(){logger['info']('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x597d34,_0xa82492){logger[_0xb0f4('0x6d')](_0xb0f4('0x6e'),JSON[_0xb0f4('0x32')](_0x597d34));endCsv();}});})['catch'](function(_0xa33ffb){logger[_0xb0f4('0x15')](_0xb0f4('0x6f'),JSON[_0xb0f4('0x32')](_0xa33ffb));});}main(); \ No newline at end of file +var _0x87a9=['ioredis','../../../config/environment','redis','defaults','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','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','create','keys','push','pick','catch','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','field','phone','toString','NOW()','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','select','\x20=\x20?','cm_contacts','str','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','insert','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','then','always','query','VoiceQueueId','onlyIfOpen','get','sequelize','Campaign','Lists','CampaignId','all','BlackLists','generalCheckHopper','Error\x20processing\x20rows\x20block:','emit','resume','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','resolve','CmContact','createReadStream','parse','CSV\x20parsed\x20correctly!','info','CSV\x20parse\x20error','bluebird','lodash','papaparse'];(function(_0x175724,_0x23f8c3){var _0x1d71a5=function(_0x116e9f){while(--_0x116e9f){_0x175724['push'](_0x175724['shift']());}};_0x1d71a5(++_0x23f8c3);}(_0x87a9,0x1a5));var _0x987a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x87a9[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x987a('0x0'));var util=require('util');var _=require(_0x987a('0x1'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x987a('0x2'));var Redis=require(_0x987a('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x987a('0x4'));var logger=require('../../../config/logger')('api');config[_0x987a('0x5')]=_[_0x987a('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x987a('0x7'))(new Redis(config[_0x987a('0x5')]));require(_0x987a('0x8'))[_0x987a('0x9')](socket);try{if(!process[_0x987a('0xa')][0x2]||process[_0x987a('0xa')][0x2]===_0x987a('0xb')||process[_0x987a('0xa')][0x2]===_0x987a('0xc')){throw new Error(_0x987a('0xd'));}var FILEPATH=process[_0x987a('0xa')][0x2];if(!process[_0x987a('0xa')][0x3]||process[_0x987a('0xa')][0x3]==='undefined'||process[_0x987a('0xa')][0x3]===_0x987a('0xc')||!process['argv'][0x4]||process[_0x987a('0xa')][0x4]==='undefined'||process['argv'][0x4]===_0x987a('0xc')){throw new Error(_0x987a('0xe'));}var FIELDS=_['zipObject'](process[_0x987a('0xa')][0x3][_0x987a('0xf')](','),process[_0x987a('0xa')][0x4][_0x987a('0xf')](','));if(!process['argv'][0x5]||process[_0x987a('0xa')][0x5]===_0x987a('0xb')||process[_0x987a('0xa')][0x5]===_0x987a('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x987a('0xa')][0x5];var COMPANYID=process[_0x987a('0xa')][0x6]&&process[_0x987a('0xa')][0x6]!==_0x987a('0xb')&&process[_0x987a('0xa')][0x6]!==_0x987a('0xc')?process['argv'][0x6]:null;var DUPLICATES=process[_0x987a('0xa')][0x7]&&process[_0x987a('0xa')][0x7]!=='undefined'&&process[_0x987a('0xa')][0x7]!==_0x987a('0xc')?process[_0x987a('0xa')][0x7]:null;if(!process[_0x987a('0xa')][0x8]||process[_0x987a('0xa')][0x8]===_0x987a('0xb')||process[_0x987a('0xa')][0x8]===_0x987a('0xc')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x987a('0xa')][0x8];}catch(_0x129204){logger[_0x987a('0x10')](_0x129204);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(_0x5092fc,_0x14d304,_0x1c79ae,_0x39b598){var _0xe8ec8b={'message':_0x14d304};_0xe8ec8b[_0x5092fc]=!![];if(_0x1c79ae){_0xe8ec8b['contact']=_0x1c79ae;}if(_0x39b598){_0xe8ec8b['index']=_0x39b598;}return _0xe8ec8b;}function isEmail(_0x23ac71){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x23ac71);}function checkRow(_0x2e7f60,_0x151f6f,_0x5ec7c9){return new BPromise(function(_0x2e6dc1,_0x2b699c){if(_['isNil'](_0x2e7f60)){return _0x2b699c(handleCheckRowError(_0x987a('0x10'),_0x987a('0x11'),null,_0x5ec7c9));}if(_0x2e7f60[_0x987a('0x12')]&&_0x2e7f60[_0x987a('0x12')][_0x987a('0x13')]){var _0x1b4502=_[_0x987a('0x14')](_0x2e7f60[_0x987a('0x12')],_0x987a('0x15'))[_0x987a('0x16')](';');return _0x2b699c(handleCheckRowError(_0x987a('0x10'),_0x1b4502,null,_0x5ec7c9));}var _0x1afe1f={};for(var _0x5c10a5 in FIELDS){if(FIELDS[_0x987a('0x17')](_0x5c10a5)&&FIELDS[_0x5c10a5]){_0x1afe1f[_0x5c10a5]=_0x2e7f60[_0x987a('0x18')][0x0][FIELDS[_0x5c10a5]]||_0x2e7f60[_0x987a('0x18')][0x0]['\ufeff'+FIELDS[_0x5c10a5]];}}if(!_0x1afe1f[_0x987a('0x19')]){return _0x2b699c(handleCheckRowError('error',_0x987a('0x1a'),null,_0x5ec7c9));}if(!_0x1afe1f['phone']){return _0x2b699c(handleCheckRowError(_0x987a('0x10'),_0x987a('0x1b'),null,_0x5ec7c9));}if(_0x1afe1f[_0x987a('0x1c')]){var _0x464c63=moment(_0x1afe1f[_0x987a('0x1c')],_0x987a('0x1d'));if(!_0x464c63[_0x987a('0x1e')]()){return _0x2b699c(handleCheckRowError(_0x987a('0x10'),_0x987a('0x1f'),null,_0x5ec7c9));}}if(_0x1afe1f[_0x987a('0x20')]){if(!isEmail(_0x1afe1f[_0x987a('0x20')])){return _0x2b699c(handleCheckRowError('error',_0x987a('0x21'),null,_0x5ec7c9));}}_0x1afe1f[_0x987a('0x22')]=LISTID;_0x1afe1f[_0x987a('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x987a('0x13')]&&_0x151f6f){var _0x583bf5={};for(var _0x1d10ab=0x0,_0x4b7b4f=DUPLICATES[_0x987a('0x13')];_0x1d10ab<_0x4b7b4f;_0x1d10ab+=0x1){_0x583bf5[DUPLICATES[_0x1d10ab]]=_0x1afe1f[DUPLICATES[_0x1d10ab]];}var _0x391820=_['find'](_0x151f6f,_0x583bf5);if(_0x391820){return _0x2b699c(handleCheckRowError(_0x987a('0x24'),_0x987a('0x25'),_0x391820,_0x5ec7c9));}}return db['CmContact'][_0x987a('0x26')](_0x1afe1f,{'raw':!![],'hooks':![],'fields':_[_0x987a('0x27')](_0x1afe1f)})['then'](function(_0x9f779a){if(DUPLICATES&&DUPLICATES[_0x987a('0x13')]&&_0x151f6f){_0x151f6f[_0x987a('0x28')](_[_0x987a('0x29')](_0x1afe1f,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x9f779a['id'];return _0x2e6dc1();})[_0x987a('0x2a')](function(_0x8bc3e2){return _0x2b699c(handleCheckRowError(_0x987a('0x10'),'Error\x20while\x20creating\x20contact:\x20'+(_0x8bc3e2[_0x987a('0x15')]||JSON[_0x987a('0x2b')](_0x8bc3e2)),null,_0x5ec7c9));});});}function checkHopper(){function _0x430b8f(){return function(_0xc2dccf){logger[_0x987a('0x10')](_0x987a('0x2c'),_0x987a('0x2d'),util[_0x987a('0x2e')](_0xc2dccf,{'showHidden':![],'depth':null}));};}var _0x19e186=function(_0x3b48ae,_0x440279){var _0x5a6679=squel['insert']()[_0x987a('0x2f')](_0x987a('0x30'))[_0x987a('0x31')](['phone',_0x987a('0x32'),_0x987a('0x33'),_0x987a('0x22'),_0x440279,_0x987a('0x34'),_0x987a('0x35')],squel['select']()[_0x987a('0x36')](_0x987a('0x37'),'phone')['field']('NOW()',_0x987a('0x32'))['field']('id',_0x987a('0x33'))[_0x987a('0x36')](LISTID['toString'](),_0x987a('0x22'))[_0x987a('0x36')](_0x3b48ae['id'][_0x987a('0x38')](),_0x440279)[_0x987a('0x36')](_0x987a('0x39'),_0x987a('0x34'))[_0x987a('0x36')](_0x987a('0x39'),_0x987a('0x35'))[_0x987a('0x3a')]('cm_contacts')[_0x987a('0x3b')](_0x987a('0x3c'))['where'](_0x987a('0x3d'),LISTID[_0x987a('0x38')]())[_0x987a('0x3b')]('phone\x20IS\x20NOT\x20NULL')[_0x987a('0x3b')]('phone\x20NOT\x20IN\x20(?)',squel[_0x987a('0x3e')]()['field'](_0x987a('0x37'))[_0x987a('0x3a')](_0x987a('0x30'))[_0x987a('0x3b')](_0x440279+_0x987a('0x3f'),_0x3b48ae['id'][_0x987a('0x38')]())))['toString']();return _0x5a6679;};var _0x2954cf=function(_0x22fc8e,_0x1fbc3a){var _0x521a45=squel['insert']()['into'](_0x987a('0x30'))['fromQuery']([_0x987a('0x37'),_0x987a('0x32'),_0x987a('0x33'),'ListId',_0x1fbc3a,'createdAt','updatedAt'],squel['select']()['field'](_0x987a('0x37'),_0x987a('0x37'))['field']('NOW()','scheduledAt')[_0x987a('0x36')]('id',_0x987a('0x33'))[_0x987a('0x36')](LISTID[_0x987a('0x38')](),_0x987a('0x22'))[_0x987a('0x36')](_0x22fc8e['id'][_0x987a('0x38')](),_0x1fbc3a)[_0x987a('0x36')](_0x987a('0x39'),_0x987a('0x34'))['field'](_0x987a('0x39'),_0x987a('0x35'))[_0x987a('0x3a')](_0x987a('0x40'))['where']('deletedAt\x20IS\x20NULL')[_0x987a('0x3b')](_0x987a('0x3d'),LISTID['toString']())[_0x987a('0x3b')]('id\x20IN\x20?',squel[_0x987a('0x41')](hopperContacts))['where'](_0x987a('0x42'))[_0x987a('0x3b')](_0x987a('0x43'),squel[_0x987a('0x3e')]()['field'](_0x987a('0x44'))[_0x987a('0x3a')](_0x987a('0x45'))[_0x987a('0x3b')](_0x1fbc3a+_0x987a('0x3f'),_0x22fc8e['id'][_0x987a('0x38')]()))[_0x987a('0x3b')](_0x987a('0x43'),squel[_0x987a('0x3e')]()['field'](_0x987a('0x37'))[_0x987a('0x3a')](_0x987a('0x30'))[_0x987a('0x3b')](_0x1fbc3a+_0x987a('0x3f'),_0x22fc8e['id'][_0x987a('0x38')]())))[_0x987a('0x38')]();return _0x521a45;};function _0x1aa3c6(_0x201b5a,_0x223e3b){var _0x3058e1=squel[_0x987a('0x46')]()[_0x987a('0x2f')](_0x987a('0x30'))['fromQuery']([_0x987a('0x37'),'scheduledAt',_0x987a('0x33'),_0x987a('0x22'),_0x223e3b,_0x987a('0x34'),_0x987a('0x35')],squel['select']()[_0x987a('0x36')](_0x987a('0x37'),_0x987a('0x37'))[_0x987a('0x36')]('NOW()',_0x987a('0x32'))[_0x987a('0x36')]('id',_0x987a('0x33'))[_0x987a('0x36')](LISTID[_0x987a('0x38')](),'ListId')[_0x987a('0x36')](_0x201b5a['id'][_0x987a('0x38')](),_0x223e3b)[_0x987a('0x36')](_0x987a('0x39'),_0x987a('0x34'))[_0x987a('0x36')](_0x987a('0x39'),_0x987a('0x35'))[_0x987a('0x3a')](_0x987a('0x40'))[_0x987a('0x3b')](_0x987a('0x3c'))['where']('ListId\x20=\x20?',LISTID[_0x987a('0x38')]())[_0x987a('0x3b')](_0x987a('0x47'),squel[_0x987a('0x41')](hopperContacts))[_0x987a('0x3b')](_0x987a('0x42')))[_0x987a('0x38')]();return _0x3058e1;}function _0x5ba652(_0x3a067c,_0x1779f7){var _0x119ada=squel[_0x987a('0x46')]()[_0x987a('0x2f')](_0x987a('0x48'))['fromQuery']([_0x987a('0x37'),_0x987a('0x33'),'ListId',_0x1779f7,'createdAt',_0x987a('0x35')],squel[_0x987a('0x3e')]()[_0x987a('0x36')](_0x987a('0x37'),'phone')[_0x987a('0x36')]('id',_0x987a('0x33'))[_0x987a('0x36')](LISTID[_0x987a('0x38')](),_0x987a('0x22'))['field'](_0x3a067c['id']['toString'](),_0x1779f7)[_0x987a('0x36')]('NOW()',_0x987a('0x34'))[_0x987a('0x36')](_0x987a('0x39'),'updatedAt')['from'](_0x987a('0x40'))[_0x987a('0x3b')](_0x987a('0x3c'))[_0x987a('0x3b')](_0x987a('0x3d'),LISTID['toString']())[_0x987a('0x3b')]('id\x20IN\x20?',squel[_0x987a('0x41')](hopperContacts))[_0x987a('0x3b')](_0x987a('0x42')))[_0x987a('0x38')]();return _0x119ada;}return db[_0x987a('0x49')][_0x987a('0x4a')]({'where':{'type':_0x987a('0x4b')},'attributes':['id',_0x987a('0x4c')],'include':[{'model':db[_0x987a('0x4d')],'as':'Lists','where':{'id':LISTID}}]})[_0x987a('0x4e')](function(_0x29a548){var _0x5b0999=[];if(_0x29a548){var _0x1e54c0;for(var _0x12d996=0x0,_0x10414e;_0x12d996<_0x29a548[_0x987a('0x13')];_0x12d996+=0x1){_0x10414e=_0x29a548[_0x12d996]['get']({'plain':!![]});switch(_0x10414e[_0x987a('0x4c')]){case _0x987a('0x4f'):_0x5b0999[_0x987a('0x28')](db['sequelize'][_0x987a('0x50')](_0x2954cf(_0x10414e,_0x987a('0x51')))[_0x987a('0x4e')](function(){})[_0x987a('0x2a')](_0x430b8f()));break;case _0x987a('0x52'):_0x5b0999[_0x987a('0x28')](db['sequelize'][_0x987a('0x50')](_0x19e186(_0x10414e,_0x987a('0x51')))[_0x987a('0x4e')](function(){})[_0x987a('0x2a')](_0x430b8f()));break;default:_0x5b0999[_0x987a('0x28')](db['sequelize'][_0x987a('0x50')](_0x1aa3c6(_0x10414e,_0x987a('0x51')))['then'](function(){})[_0x987a('0x2a')](_0x430b8f()));}}}return _0x5b0999;})['all']()['then'](function(){return db[_0x987a('0x49')][_0x987a('0x4a')]({'where':{'type':_0x987a('0x4b')},'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x987a('0x4e')](function(_0x255548){var _0x39068e=[];if(_0x255548){var _0x502806;for(var _0x43265c=0x0,_0x9f86c7;_0x43265c<_0x255548[_0x987a('0x13')];_0x43265c+=0x1){_0x9f86c7=_0x255548[_0x43265c][_0x987a('0x53')]({'plain':!![]});_0x39068e['push'](db[_0x987a('0x54')]['query'](_0x5ba652(_0x9f86c7,_0x987a('0x51')))[_0x987a('0x4e')](function(){})['catch'](_0x430b8f()));}}return _0x39068e;})['all']();})[_0x987a('0x4e')](function(){return db[_0x987a('0x55')]['findAll']({'attributes':['id',_0x987a('0x4c')],'include':[{'model':db[_0x987a('0x4d')],'as':_0x987a('0x56'),'where':{'id':LISTID}}]})[_0x987a('0x4e')](function(_0x2121b3){var _0x544e34=[];if(_0x2121b3){for(var _0x22de50=0x0,_0x43e7fc;_0x22de50<_0x2121b3[_0x987a('0x13')];_0x22de50+=0x1){_0x43e7fc=_0x2121b3[_0x22de50][_0x987a('0x53')]({'plain':!![]});switch(_0x43e7fc[_0x987a('0x4c')]){case'always':_0x544e34[_0x987a('0x28')](db['sequelize'][_0x987a('0x50')](_0x2954cf(_0x43e7fc,'CampaignId'))[_0x987a('0x4e')](function(){})['catch'](_0x430b8f()));break;case _0x987a('0x52'):_0x544e34[_0x987a('0x28')](db[_0x987a('0x54')][_0x987a('0x50')](_0x19e186(_0x43e7fc,_0x987a('0x57')))[_0x987a('0x4e')](function(){})[_0x987a('0x2a')](_0x430b8f()));break;default:_0x544e34[_0x987a('0x28')](db[_0x987a('0x54')][_0x987a('0x50')](_0x1aa3c6(_0x43e7fc,_0x987a('0x57')))[_0x987a('0x4e')](function(){})[_0x987a('0x2a')](_0x430b8f()));}}}return _0x544e34;})[_0x987a('0x58')]();})[_0x987a('0x4e')](function(){return db[_0x987a('0x55')][_0x987a('0x4a')]({'attributes':['id'],'include':[{'model':db[_0x987a('0x4d')],'as':_0x987a('0x59'),'where':{'id':LISTID}}]})[_0x987a('0x4e')](function(_0x307c25){var _0x36b3a5=[];if(_0x307c25){for(var _0x3b7c59=0x0,_0x487fe7;_0x3b7c59<_0x307c25[_0x987a('0x13')];_0x3b7c59+=0x1){_0x487fe7=_0x307c25[_0x3b7c59][_0x987a('0x53')]({'plain':!![]});_0x36b3a5[_0x987a('0x28')](db[_0x987a('0x54')][_0x987a('0x50')](_0x5ba652(_0x487fe7,_0x987a('0x57')))[_0x987a('0x4e')](function(){})['catch'](_0x430b8f()));}}return _0x36b3a5;})['all']();})['catch'](function(_0xcce8a9){logger[_0x987a('0x10')]('cmContact,\x20%s,\x20%s',_0x987a('0x5a'),_0xcce8a9['message']);});}var processPromises=function(_0x499fd8){return BPromise[_0x987a('0x58')](promises)[_0x987a('0x4e')](function(_0x4158c5){})['catch'](function(_0x8d8418){logger['error'](_0x987a('0x5b'),JSON['stringify'](_0x8d8418));})['finally'](function(){socket[_0x987a('0x5c')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x499fd8){return _0x499fd8[_0x987a('0x5d')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x987a('0x4e')](function(){if(hopperContacts){return checkHopper();}})[_0x987a('0x4e')](function(){socket[_0x987a('0x5c')](_0x987a('0x5e')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x987a('0x5f')](FILEPATH);}catch(_0x2423da){logger[_0x987a('0x10')](_0x987a('0x60'),JSON[_0x987a('0x2b')](_0x2423da));}finally{process[_0x987a('0x61')](0x0);}});};process['on'](_0x987a('0x62'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x987a('0x63')]()[_0x987a('0x4e')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x987a('0xf')](',');return db[_0x987a('0x64')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x987a('0x4e')](function(_0x1b0c08){var _0x1e9d53=fs[_0x987a('0x65')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x987a('0x66')](_0x1e9d53,{'header':!![],'skipEmptyLines':!![],'step':function(_0x2bcf25,_0x378a89){total+=0x1;var _0x328435=total;promises[_0x987a('0x28')](checkRow(_0x2bcf25,_0x1b0c08,_0x328435)[_0x987a('0x4e')](function(){success+=0x1;})[_0x987a('0x2a')](function(_0x1ab032){if(_0x1ab032[_0x987a('0x10')]){errors+=0x1;delete _0x1ab032['error'];}else if(_0x1ab032[_0x987a('0x24')]){duplicates+=0x1;delete _0x1ab032[_0x987a('0x24')];}rows[_0x987a('0x28')](_0x1ab032);}));if(total%0xc8===0x0){_0x378a89['pause']();return processPromises(_0x378a89);}},'complete':function(){return processPromises()['then'](function(){logger['info'](_0x987a('0x67'));endCsv();});},'error':function(_0x2d79ae,_0x778491){logger[_0x987a('0x68')](_0x987a('0x69'),JSON[_0x987a('0x2b')](_0x2d79ae));endCsv();}});})['catch'](function(_0x3b3375){logger[_0x987a('0x10')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x987a('0x2b')](_0x3b3375));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 6aa8404..0ff1f11 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 _0x3e51=['cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_hopper','fromQuery','cm_hopper.id','cm_contact_has_items.createdAt','cm_hopper_additional_phones','OrderBy','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','code','sequelize','query','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns_has_cm_lists.CmListId=','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues_has_cm_lists.CmListId=','spread','dialTimezone','utcOffset','set','offset','main','stringify','send','start','binding','clone','socket_timestamp','root','server/files/tmp','.csv','includes','ContactItemType','name','_description','header','writeFileSync','parse','data','rows','errors','find','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','timezones','firstName','description','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','step','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','VoiceQueueId','CampaignId','campaigns_has_cm_blacklists','voice_queues_has_cm_blacklists','finish','affectedRows','unlink','exit','complete','argv','arguments\x20\x20\x20','existsSync','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','length','push','then','split','all','isNil','filter','CmContactHasItem','findOne','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_hopper_black'];(function(_0x47b704,_0x48b09e){var _0x1a2c5a=function(_0xa2ef8c){while(--_0xa2ef8c){_0x47b704['push'](_0x47b704['shift']());}};_0x1a2c5a(++_0x48b09e);}(_0x3e51,0x74));var _0x13e5=function(_0x2337d2,_0x840b0e){_0x2337d2=_0x2337d2-0x0;var _0x579862=_0x3e51[_0x2337d2];return _0x579862;};'use strict';var fs=require('fs');var path=require(_0x13e5('0x0'));var _=require(_0x13e5('0x1'));var Papa=require(_0x13e5('0x2'));var util=require(_0x13e5('0x3'));var BPromise=require(_0x13e5('0x4'));var moment=require(_0x13e5('0x5'));var squel=require('squel');var Redis=require(_0x13e5('0x6'));var db=require(_0x13e5('0x7'))['db'];var config=require(_0x13e5('0x8'));var shared=require(_0x13e5('0x9'));var logger=require(_0x13e5('0xa'))(_0x13e5('0xb'));config[_0x13e5('0xc')]=_[_0x13e5('0xd')](config['redis'],{'host':_0x13e5('0xe'),'port':0x18eb});var socket=require(_0x13e5('0xf'))(new Redis(config[_0x13e5('0xc')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x13e5('0x10')](_0x13e5('0x11'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0x13e5('0x11'));function isEmail(_0x167c10){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))*$/[_0x13e5('0x12')](_0x167c10);}function selectNotIn(_0x531dad,_0x4864a9,_0x315c42,_0x1c7553,_0x54c8d5){return squel[_0x13e5('0x13')]()[_0x13e5('0x14')](_0x13e5('0x15'))[_0x13e5('0x16')](_0x1c7553)[_0x13e5('0x17')](_0x4864a9,null,_0x4864a9+'.id\x20=\x20'+_0x1c7553+'.'+_0x315c42)['where'](_0x1c7553+'.'+_0x315c42+_0x13e5('0x18')+_0x531dad+'.'+_0x315c42)[_0x13e5('0x19')](_0x4864a9+_0x13e5('0x1a')+_0x54c8d5[_0x13e5('0x17')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x12c4a9,_0x67a67b){promisesAdditionalPhones=[];return db[_0x13e5('0x1b')][_0x13e5('0x1c')]({'raw':!![],'attributes':['id',_0x13e5('0x1d')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x2b2afe){if(_0x2b2afe!==null){var _0x40cf2d=[];for(var _0x1e8d5e=0x0;_0x1e8d5e<_0x2b2afe[_0x13e5('0x1e')];_0x1e8d5e++){var _0x40da84=_0x2b2afe[_0x1e8d5e];_0x40cf2d[_0x13e5('0x1f')](insertAdditionalPhones(_0x40da84));}}Promise['all'](_0x40cf2d)[_0x13e5('0x20')](function(){_0x12c4a9({'val':0x1});});});});}function insertAdditionalPhones(_0x2e9204){return new Promise(function(_0x34f067,_0x2de3da){var _0x4f07cf=_0x2e9204[_0x13e5('0x1d')];var _0x7071f6=_0x4f07cf[_0x13e5('0x21')](';');var _0x32543b=[];orderBy=0x0;for(var _0x40993a=0x0;_0x40993a<_0x7071f6['length'];_0x40993a++){_0x32543b[_0x13e5('0x1f')](splitAdditionalPhone(_0x2e9204['id'],_0x7071f6[_0x40993a]));}Promise[_0x13e5('0x22')](_0x32543b)[_0x13e5('0x20')](function(){_0x34f067({'val':_0x7071f6['length']});});});}function splitAdditionalPhone(_0x6c4449,_0x181ecf){return new Promise(function(_0x4a90a0,_0x5ef406){var _0x516075=_0x181ecf[_0x13e5('0x21')](':');var _0x3708f5=_0x516075[0x0];var _0x1df0c5=_0x516075[0x1];if(!_[_0x13e5('0x23')](_0x1df0c5)){var _0x121709=_0x1df0c5[_0x13e5('0x21')]('|');var _0x5c7eff=[];for(var _0x1f28a5=0x0;_0x1f28a5<_0x121709[_0x13e5('0x1e')];_0x1f28a5++){if(_0x121709[_0x1f28a5]!==''){var _0x220576=_[_0x13e5('0x24')](promisesAdditionalPhones,{'contactId':_0x6c4449,'phone':_0x121709[_0x1f28a5]});if(_0x220576[_0x13e5('0x1e')]==0x0){orderBy++;promisesAdditionalPhones[_0x13e5('0x1f')]({'contactId':_0x6c4449,'contactTypeId':_0x3708f5,'phone':_0x121709[_0x1f28a5],'orderBy':orderBy});}}}_0x4a90a0({'ok':0x1});}else _0x4a90a0({'res':0x0});});}function createAdditionalPhone(_0x12298c,_0x2cb7f5,_0x516f65,_0x2398b8){var _0x196d69='';var _0x3fb27a='';var _0x383122=_0x516f65['split']('§');_0x196d69=_0x383122[0x0];if(_0x383122[_0x13e5('0x1e')]==0x2)_0x3fb27a=_0x383122[0x1];return new Promise(function(_0x421a91,_0x10f4c7){return db[_0x13e5('0x25')][_0x13e5('0x26')]({'where':{'CmContactId':_0x12298c,'item':_0x196d69}})[_0x13e5('0x20')](function(_0x5f0e35){if(_0x5f0e35){return db[_0x13e5('0x25')]['update']({'ItemTypeId':_0x2cb7f5,'description':_0x3fb27a,'OrderBy':_0x2398b8},{'where':{'CmContactId':_0x12298c,'item':_0x196d69}})['then'](function(_0x4f8c82){_0x421a91({'res':_0x13e5('0x27')});});}else{return db['CmContactHasItem'][_0x13e5('0x28')]({'CmContactId':_0x12298c,'item':_0x196d69,'description':_0x3fb27a,'ItemTypeId':_0x2cb7f5,'OrderBy':_0x2398b8,'ItemClass':_0x13e5('0x29')})[_0x13e5('0x20')](function(_0x15c836){_0x421a91({'res':_0x13e5('0x2a')});});}});});}function insertCmHopper(_0x1cd892,_0x304fc9,_0x4b735e,_0x300220,_0x369399){var _0x2d64fd=[_0x13e5('0x2b'),'cm_contacts.scheduledat',_0x13e5('0x2c'),_0x13e5('0x2d'),_0x304fc9+'.'+_0x300220,_0x13e5('0x2e'),_0x13e5('0x2f'),_0x13e5('0x30'),_0x13e5('0x31'),'\x22'+_0x369399+'\x22'];return squel[_0x13e5('0x32')]()[_0x13e5('0x33')]('cm_hopper')['fromQuery'](['phone',_0x13e5('0x34'),_0x13e5('0x35'),_0x13e5('0x36'),_0x300220,_0x13e5('0x37'),_0x13e5('0x38'),_0x13e5('0x39'),_0x13e5('0x3a'),_0x13e5('0x3b')],squel['select']()[_0x13e5('0x3c')](_0x2d64fd)['from'](_0x304fc9)[_0x13e5('0x17')](_0x13e5('0x3d'),null,_0x13e5('0x3e')+_0x304fc9+_0x13e5('0x3f'))[_0x13e5('0x17')](_0x4b735e,null,_0x4b735e+_0x13e5('0x40')+_0x304fc9+'.'+_0x300220)[_0x13e5('0x19')](_0x304fc9+_0x13e5('0x41'),_0x1cd892)[_0x13e5('0x19')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x13e5('0x19')](_0x13e5('0x42'),selectNotIn(_0x304fc9,_0x4b735e,_0x300220,'cm_hopper',[_0x13e5('0x43'),'\x22onlyIfOpen\x22']))[_0x13e5('0x19')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x304fc9,_0x4b735e,_0x300220,'cm_hopper',['\x22always\x22'])))[_0x13e5('0x44')]();}function insertCmHopperBlack(_0x556cb1,_0x44446e,_0xaaeee4,_0x26cf4f){var _0x579f10=[_0x13e5('0x2b'),_0x13e5('0x2c'),_0x13e5('0x2d'),_0x44446e+'.'+_0x26cf4f,_0x13e5('0x2e'),_0x13e5('0x2f')];return squel[_0x13e5('0x32')]()[_0x13e5('0x33')](_0x13e5('0x45'))['fromQuery']([_0x13e5('0x15'),_0x13e5('0x35'),'ListId',_0x26cf4f,'createdAt','updatedAt'],squel[_0x13e5('0x13')]()[_0x13e5('0x3c')](_0x579f10)[_0x13e5('0x16')](_0x44446e)[_0x13e5('0x17')](_0x13e5('0x3d'),null,_0x13e5('0x3e')+_0x44446e+_0x13e5('0x3f'))[_0x13e5('0x17')](_0xaaeee4,null,_0xaaeee4+_0x13e5('0x40')+_0x44446e+'.'+_0x26cf4f)['where'](_0x44446e+_0x13e5('0x41'),_0x556cb1)[_0x13e5('0x19')](_0x13e5('0x46'),NOW)['where'](_0x13e5('0x42'),squel['select']()[_0x13e5('0x14')](_0x13e5('0x15'))[_0x13e5('0x16')](_0x13e5('0x45'))['where'](_0x13e5('0x47'),_0x556cb1)[_0x13e5('0x19')](_0x26cf4f+_0x13e5('0x18')+_0x44446e+'.'+_0x26cf4f)))['toString']();}function insertTzCmHopper(_0x4b699b,_0x12f615,_0x41f22a,_0x4d2aa4,_0x35e672,_0x572bee){var _0x2c27bf=[_0x13e5('0x2b'),_0x13e5('0x48')+_0x572bee+_0x13e5('0x49'),_0x13e5('0x2c'),_0x13e5('0x2d'),_0x12f615+'.'+_0x4d2aa4,_0x13e5('0x2e'),_0x13e5('0x2f'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0x35e672+'\x22'];var _0xef9980=squel[_0x13e5('0x32')]()['into'](_0x13e5('0x4a'))[_0x13e5('0x4b')]([_0x13e5('0x15'),_0x13e5('0x34'),_0x13e5('0x35'),_0x13e5('0x36'),_0x4d2aa4,'createdAt',_0x13e5('0x38'),_0x13e5('0x39'),_0x13e5('0x3a'),_0x13e5('0x3b')],squel[_0x13e5('0x13')]()[_0x13e5('0x3c')](_0x2c27bf)[_0x13e5('0x16')](_0x12f615)[_0x13e5('0x17')]('cm_contacts',null,_0x13e5('0x3e')+_0x12f615+_0x13e5('0x3f'))[_0x13e5('0x17')](_0x41f22a,null,_0x41f22a+_0x13e5('0x40')+_0x12f615+'.'+_0x4d2aa4)[_0x13e5('0x17')](_0x572bee,null,_0x572bee+'.id\x20=\x20'+_0x12f615+'.'+_0x4d2aa4)[_0x13e5('0x19')](_0x12f615+_0x13e5('0x41'),_0x4b699b)['where'](_0x13e5('0x46'),NOW)[_0x13e5('0x19')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x12f615,_0x41f22a,_0x4d2aa4,_0x13e5('0x4a'),[_0x13e5('0x43'),'\x22onlyIfOpen\x22']))[_0x13e5('0x19')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x12f615,_0x41f22a,_0x4d2aa4,_0x13e5('0x4a'),[_0x13e5('0x43')])))[_0x13e5('0x44')]();return _0xef9980;}function insertTzCmHopperBlack(_0x3f4d40,_0x4bb468,_0x3de806,_0x362e25){var _0x44d626=[_0x13e5('0x2b'),_0x13e5('0x2c'),'cm_contacts.ListId',_0x4bb468+'.'+_0x362e25,_0x13e5('0x2e'),_0x13e5('0x2f')];return squel[_0x13e5('0x32')]()['into']('cm_hopper_black')[_0x13e5('0x4b')]([_0x13e5('0x15'),_0x13e5('0x35'),_0x13e5('0x36'),_0x362e25,'createdAt',_0x13e5('0x38')],squel[_0x13e5('0x13')]()[_0x13e5('0x3c')](_0x44d626)[_0x13e5('0x16')](_0x4bb468)[_0x13e5('0x17')](_0x13e5('0x3d'),null,_0x13e5('0x3e')+_0x4bb468+_0x13e5('0x3f'))[_0x13e5('0x17')](_0x3de806,null,_0x3de806+_0x13e5('0x40')+_0x4bb468+'.'+_0x362e25)[_0x13e5('0x19')](_0x4bb468+'.CmListId\x20=\x20?',_0x3f4d40)[_0x13e5('0x19')](_0x13e5('0x46'),NOW)[_0x13e5('0x19')](_0x13e5('0x42'),squel[_0x13e5('0x13')]()[_0x13e5('0x14')]('phone')[_0x13e5('0x16')](_0x13e5('0x45'))[_0x13e5('0x19')](_0x13e5('0x47'),_0x3f4d40)[_0x13e5('0x19')](_0x362e25+_0x13e5('0x18')+_0x4bb468+'.'+_0x362e25)))[_0x13e5('0x44')]();}function insertCmHopperAdditionalPhones(_0x2e20e1){var _0x3994d3=[_0x13e5('0x4c'),'cm_contact_has_items.item','cm_contact_has_items.OrderBy',_0x13e5('0x4d'),'cm_contact_has_items.updatedAt'];return squel[_0x13e5('0x32')]()['into'](_0x13e5('0x4e'))['fromQuery'](['CmHopperId','phone',_0x13e5('0x4f'),_0x13e5('0x37'),_0x13e5('0x38')],squel[_0x13e5('0x13')]()['fields'](_0x3994d3)[_0x13e5('0x16')](_0x13e5('0x4a'))[_0x13e5('0x17')]('cm_contacts',null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x13e5('0x17')](_0x13e5('0x50'),null,_0x13e5('0x51'))[_0x13e5('0x19')](_0x13e5('0x52'),_0x2e20e1)[_0x13e5('0x19')](_0x13e5('0x46'),NOW))[_0x13e5('0x44')]();}function insertCmContact(_0x2c80d4,_0x30b4fd,_0x4b50b4,_0xeceb42){var _0x54131c=_[_0x13e5('0x53')](_[_0x13e5('0x54')](_0xeceb42),[_0x13e5('0x36'),_0x13e5('0x55'),_0x13e5('0x37'),_0x13e5('0x38')]);return squel[_0x13e5('0x32')]()[_0x13e5('0x33')](_0x13e5('0x3d'))[_0x13e5('0x4b')](_0x54131c,squel[_0x13e5('0x13')]()['fields'](_0x54131c)[_0x13e5('0x16')](_0x30b4fd)[_0x13e5('0x19')]('('+_0x4b50b4[_0x13e5('0x17')](',')+_0x13e5('0x56'),squel['select']()[_0x13e5('0x3c')](_0x4b50b4)[_0x13e5('0x16')](_0x13e5('0x3d'))['where']('ListId\x20=\x20?',_0x2c80d4)[_0x13e5('0x19')](_0x13e5('0x57')))[_0x13e5('0x19')](_0x13e5('0x58'),squel['select']()[_0x13e5('0x14')](_0x13e5('0x59'),_0x13e5('0x5a'))[_0x13e5('0x16')](_0x30b4fd)[_0x13e5('0x5b')](_0x4b50b4[_0x13e5('0x17')](','))))[_0x13e5('0x44')]();}function handleStop(){logger[_0x13e5('0x5c')](_0x13e5('0x5d'));stopped=!![];}function handleUncaughtException(_0x7728f6){logger[_0x13e5('0x5e')](_0x7728f6[_0x13e5('0x5f')]);process['exit'](0x1);}function handleError(_0x5242f3,_0x5a1589){stats['errors'][_0x13e5('0x1f')]({'name':_0x5a1589[_0x13e5('0x60')],'message':_0x5a1589[_0x13e5('0x5f')],'row':_0x5242f3});}function handleQuery(_0x4effd7){logger[_0x13e5('0x5c')](_0x4effd7);return db[_0x13e5('0x61')][_0x13e5('0x62')](_0x4effd7)['spread'](function(_0x14ab79){results['push'](_0x14ab79);})[_0x13e5('0x63')](function(_0x3ef3f7){logger[_0x13e5('0x5e')](_0x3ef3f7[_0x13e5('0x5f')]);});}function updateTzCampaigns(_0x44fa81){return new Promise(function(_0x4ea189,_0x108728){var _0x46f8ad=squel[_0x13e5('0x13')]()['fields']([_0x13e5('0x64'),_0x13e5('0x65')])[_0x13e5('0x16')](_0x13e5('0x66'))['join'](_0x13e5('0x67'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')[_0x13e5('0x19')](_0x13e5('0x68')+_0x44fa81);db[_0x13e5('0x61')][_0x13e5('0x62')](_0x46f8ad[_0x13e5('0x44')]())['spread'](function(_0xe73d08){var _0x2b959b=[];for(var _0x2f8a02=0x0;_0x2f8a02<_0xe73d08[_0x13e5('0x1e')];_0x2f8a02++){_0x2b959b['push'](getTimezoneData(_0xe73d08[_0x2f8a02],tmp_campaigns));}BPromise[_0x13e5('0x22')](_0x2b959b)[_0x13e5('0x20')](function(){_0x4ea189({'val':0x1});});})[_0x13e5('0x63')](function(_0x5ecbe2){logger[_0x13e5('0x5e')](_0x5ecbe2[_0x13e5('0x5f')]);_0x4ea189({'val':0x0});});});}function updateTzVoiceQueues(_0x4b8cf3){return new Promise(function(_0x27a3cd,_0x2c36a8){var _0x30d4d3=squel[_0x13e5('0x13')]()[_0x13e5('0x3c')](['voice_queues.id',_0x13e5('0x69')])[_0x13e5('0x16')](_0x13e5('0x6a'))[_0x13e5('0x17')](_0x13e5('0x6b'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')['where'](_0x13e5('0x6c')+_0x4b8cf3);db['sequelize'][_0x13e5('0x62')](_0x30d4d3[_0x13e5('0x44')]())[_0x13e5('0x6d')](function(_0x143826){var _0x51ef66=[];for(var _0x237fbf=0x0;_0x237fbf<_0x143826[_0x13e5('0x1e')];_0x237fbf++){_0x51ef66[_0x13e5('0x1f')](getTimezoneData(_0x143826[_0x237fbf],tmp_voice_queues));}BPromise[_0x13e5('0x22')](_0x51ef66)[_0x13e5('0x20')](function(){_0x27a3cd({'val':0x1});});})['catch'](function(_0x1579dd){logger[_0x13e5('0x5e')](_0x1579dd['message']);_0x27a3cd({'val':0x0});});});}function getTimezoneData(_0x4bf6a8,_0x13ab88){return new Promise(function(_0x32260a,_0x1ee899){var _0x3bf548=shared['timezones'];var _0x26cd23=_0x3bf548[_0x4bf6a8[_0x13e5('0x6e')]];if(_[_0x13e5('0x23')](_0x26cd23)){_0x32260a({'ret':0x1});}else{var _0x4b1204=_0x26cd23[_0x13e5('0x6f')];var _0x5e2a12=squel[_0x13e5('0x32')]()[_0x13e5('0x33')](_0x13ab88)[_0x13e5('0x70')]('id',_0x4bf6a8['id'])[_0x13e5('0x70')](_0x13e5('0x71'),_0x4b1204)['set']('dialTimezone',_0x4bf6a8[_0x13e5('0x6e')])[_0x13e5('0x44')]();return db['sequelize'][_0x13e5('0x62')](_0x5e2a12)[_0x13e5('0x6d')](function(_0x421f81){_0x32260a({'ret':0x1});})[_0x13e5('0x63')](function(_0x4df390){logger[_0x13e5('0x5e')](_0x4df390[_0x13e5('0x5f')]);_0x1ee899({'ret':0x1});});}});}function handleTZQuery(_0xaac7bc){logger[_0x13e5('0x5c')](_0xaac7bc);return db[_0x13e5('0x61')][_0x13e5('0x62')](_0xaac7bc)['spread'](function(_0x32a9d1){})[_0x13e5('0x63')](function(_0x2bd2a6){logger[_0x13e5('0x5e')](_0x2bd2a6[_0x13e5('0x5f')]);});}function main(_0x271536,_0x53721f,_0x14afd5,_0x28e4ef){logger[_0x13e5('0x5c')](_0x13e5('0x72'),_0x271536,JSON[_0x13e5('0x73')](_0x53721f));process[_0x13e5('0x74')](_0x13e5('0x75'));var _0x1db6a8=_0x53721f[_0x13e5('0x76')];var _0x3cca5a=_[_0x13e5('0x77')](_0x1db6a8);var _0x4c2137=_0x53721f[_0x13e5('0x78')];var _0x4a5d17=path[_0x13e5('0x17')](config[_0x13e5('0x79')],_0x13e5('0x7a'),_0x4c2137+_0x13e5('0x7b'));hasTZ=_['keys'](_0x1db6a8)[_0x13e5('0x7c')]('dialTimezone');var _0x535dce=_[_0x13e5('0x54')](_0x1db6a8)['join']();logger[_0x13e5('0x5c')]('header',_0x535dce);db[_0x13e5('0x7d')][_0x13e5('0x1c')]({'raw':!![],'attributes':['id',_0x13e5('0x7e')]})[_0x13e5('0x20')](function(_0x345e2f){for(var _0x3a3280=0x0;_0x3a3280<_0x345e2f[_0x13e5('0x1e')];_0x3a3280++){if(_0x345e2f[_0x3a3280]['name']in _0x1db6a8){contactItemTypes[_0x13e5('0x1f')](_0x345e2f[_0x3a3280]);delete _0x3cca5a[_0x345e2f[_0x3a3280]['name']];hasAdditionalPhones=!![];}for(var _0x3e789d in _0x1db6a8){if(_0x345e2f[_0x3a3280][_0x13e5('0x7e')]+_0x13e5('0x7f')===_0x3e789d){phoneDescriptions[_0x13e5('0x1f')]({'itemTypeId':_0x345e2f[_0x3a3280]['id'],'description':_0x3e789d});delete _0x3cca5a[_0x3e789d];}}}if(hasAdditionalPhones)_0x3cca5a['AdditionalPhones']='';var _0x12ec55=_[_0x13e5('0x54')](_0x3cca5a)[_0x13e5('0x17')]();logger[_0x13e5('0x5c')](_0x13e5('0x80'),_0x12ec55);fs[_0x13e5('0x81')](_0x4a5d17,_0x12ec55+'\x0a');Papa[_0x13e5('0x82')](fs['createReadStream'](_0x271536),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4802b7,_0x185ddd){try{for(var _0x59ed51=0x0,_0x1d782d=[];_0x59ed51<_0x4802b7[_0x13e5('0x83')][_0x13e5('0x1e')];_0x59ed51++){stats[_0x13e5('0x84')]+=0x1;if(_0x4802b7[_0x13e5('0x85')][_0x59ed51]){handleError(_0x4802b7[_0x13e5('0x83')][_0x59ed51],_0x4802b7['errors'][_0x59ed51]);}else{var _0x4fec2b=[];var _0x31a399=[];var _0x594b18={};for(var _0xb957cd in _0x1db6a8){let _0x5478c8=contactItemTypes[_0x13e5('0x86')](_0x512f40=>_0x512f40[_0x13e5('0x7e')]===_0xb957cd);let _0x5e778d=contactItemTypes[_0x13e5('0x86')](_0x5ea49a=>_0x5ea49a[_0x13e5('0x7e')]+_0x13e5('0x7f')===_0xb957cd);if(_[_0x13e5('0x23')](_0x5478c8)&&_[_0x13e5('0x23')](_0x5e778d)){if(_0x1db6a8[_0x13e5('0x87')](_0xb957cd)){if(_0x4802b7[_0x13e5('0x83')][_0x59ed51][_0x1db6a8[_0xb957cd]]){var _0x103861=_[_0x13e5('0x88')](_0x4802b7[_0x13e5('0x83')][_0x59ed51][_0x1db6a8[_0xb957cd]][_0x13e5('0x89')](/"/g,'\x27'));switch(_0xb957cd){case'scheduledat':var _0xaf14f8=moment(_0x103861,_0x13e5('0x11'),!![]);if(_0xaf14f8[_0x13e5('0x8a')]()){_0x1d782d['push']('\x22'+_0x103861+'\x22');}else{_0x4fec2b[_0x13e5('0x1f')](_0x13e5('0x8b'));}break;case'priority':var _0x586c1a=parseInt(_0x103861);_0x103861=_['isNaN'](_0x586c1a)||_0x586c1a<0x0||_0x586c1a>0x4?_0x28e4ef?0x3:0x2:_0x586c1a;_0x1d782d[_0x13e5('0x1f')]('\x22'+_0x103861+'\x22');break;case _0x13e5('0x3a'):var _0x54fd4c=parseInt(_0x103861);if(_['isNumber'](_0x54fd4c)&&_[_0x13e5('0x7c')](_0x14afd5,_0x54fd4c)){_0x1d782d[_0x13e5('0x1f')]('\x22'+_0x54fd4c+'\x22');}else{_0x4fec2b[_0x13e5('0x1f')](_0x13e5('0x8c'));}break;case _0x13e5('0x8d'):if(isEmail(_0x103861)){_0x1d782d[_0x13e5('0x1f')]('\x22'+_0x103861+'\x22');}else{_0x4fec2b['push'](_0x13e5('0x8e'));}break;case _0x13e5('0x8f'):var _0x5a4237=moment(_0x103861,_0x13e5('0x90'),!![]);if(_0x5a4237[_0x13e5('0x8a')]()){_0x1d782d[_0x13e5('0x1f')]('\x22'+_0x103861+'\x22');}else{_0x4fec2b[_0x13e5('0x1f')](_0x13e5('0x91'));}break;case _0x13e5('0x6e'):var _0x5616e0=shared[_0x13e5('0x92')];var _0x3c4475=_0x5616e0[_0x103861];if(!_[_0x13e5('0x23')](_0x3c4475)){var _0x5a814f=_0x3c4475[_0x13e5('0x6f')];_0x1d782d['push']('\x22'+_0x103861+'\x22');_0x1d782d['push']('\x22'+_0x5a814f+'\x22');}break;default:_0x1d782d[_0x13e5('0x1f')]('\x22'+_0x103861+'\x22');}}else{switch(_0xb957cd){case _0x13e5('0x93'):case _0x13e5('0x15'):_0x4fec2b[_0x13e5('0x1f')](_0xb957cd+'\x20not\x20specified');break;default:_0x1d782d[_0x13e5('0x1f')]('\x22\x22');}}}}else{var _0xfa72cf='';if(!_[_0x13e5('0x23')](_0x5478c8)){if(!_0x594b18[_0x13e5('0x87')](_0x5478c8['id'])){if(!_['isNil'](_0x4802b7['data'][_0x59ed51][_0x1db6a8[_0xb957cd]])){var _0x103861=_['trim'](_0x4802b7[_0x13e5('0x83')][_0x59ed51][_0x1db6a8[_0xb957cd]]['replace'](/"/g,'\x27'));var _0x5f143e=phoneDescriptions[_0x13e5('0x86')](_0x27ddbd=>_0x27ddbd['itemTypeId']===_0x5478c8['id']);if(!_['isNil'](_0x5f143e)){var _0x1452be=_[_0x13e5('0x88')](_0x4802b7[_0x13e5('0x83')][_0x59ed51][_0x1db6a8[_0x5f143e[_0x13e5('0x94')]]][_0x13e5('0x89')](/"/g,'\x27'));if(!_[_0x13e5('0x23')](_0x1452be))_0x103861=_0x103861+'§'+_0x1452be;}if(_0xfa72cf=='')_0xfa72cf=_0x103861;else _0xfa72cf+='|'+_0x103861;}_0x31a399['push'](_0x5478c8['id']+':'+_0xfa72cf);_0x594b18[_0x5478c8['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1d782d[_0x13e5('0x1f')]('\x22'+_0x31a399[_0x13e5('0x17')](';')+'\x22');}if(_0x4fec2b[_0x13e5('0x1e')]){handleError(_0x4802b7[_0x13e5('0x83')][_0x59ed51],{'code':_0x13e5('0x95'),'message':_0x4fec2b[_0x13e5('0x17')]()});}else{fs[_0x13e5('0x96')](_0x4a5d17,_0x1d782d['join']()+'\x0a');}_0x1d782d=[];}if(!(stats['rows']%0xc8)){socket[_0x13e5('0x97')](_0x13e5('0x98')+_0x4c2137,stats);stats['errors']=[];}}if(stopped){logger[_0x13e5('0x5c')](_0x13e5('0x99'));_0x185ddd[_0x13e5('0x9a')]();}}catch(_0x39bd65){handleError(_0x4802b7['data'][_0x59ed51],{'code':'SystemError','message':_0x39bd65['message']});logger[_0x13e5('0x5e')](_0x13e5('0x9b'),_0x39bd65['message']);}},'complete':function(){try{var _0x687ddf=[];var _0x461e28=[];var _0x3e0a70=_0x13e5('0x3d');if(_0x53721f[_0x13e5('0x9c')]&&_0x53721f[_0x13e5('0x9c')][_0x13e5('0x1e')]){_0x3e0a70='cm_contacts_'+_0x4c2137;_0x687ddf[_0x13e5('0x1f')](_0x13e5('0x9d')+_0x3e0a70+_0x13e5('0x9e'));}tmp_campaigns='campaigns_'+_0x4c2137;tmp_voice_queues='voice_queues_'+_0x4c2137;_0x461e28[_0x13e5('0x1f')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x13e5('0x9f'));_0x461e28[_0x13e5('0x1f')](_0x13e5('0x9d')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x13e5('0xa0')](_0x461e28,handleTZQuery)[_0x13e5('0x20')](function(_0x56e2f2){updateTzCampaigns(_0x53721f[_0x13e5('0x36')])['then'](function(_0x48bcf4){updateTzVoiceQueues(_0x53721f['ListId'])[_0x13e5('0x20')](function(_0x2afe9f){if(hasTZ)_0x12ec55=_0x12ec55[_0x13e5('0x89')](_0x13e5('0x6e'),_0x13e5('0xa1'));var _0x1c535a=util[_0x13e5('0x10')](_0x13e5('0xa2'),_0x4a5d17,_0x3e0a70,_0x12ec55,_0x53721f['ListId'],_0x53721f['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x1db6a8['scheduledat'])){_0x1c535a+=_0x13e5('0xa3');}_0x687ddf[_0x13e5('0x1f')](_0x1c535a);if(_0x53721f[_0x13e5('0x9c')]&&_0x53721f[_0x13e5('0x9c')][_0x13e5('0x1e')]){_0x687ddf[_0x13e5('0x1f')](insertCmContact(_0x53721f[_0x13e5('0x36')],_0x3e0a70,_0x53721f[_0x13e5('0x9c')],_0x1db6a8));_0x687ddf[_0x13e5('0x1f')](_0x13e5('0xa4')+_0x3e0a70+';');}BPromise[_0x13e5('0xa0')](_0x687ddf,handleQuery)[_0x13e5('0x20')](function(_0x5b8df0){BPromise[_0x13e5('0x22')]([handleAdditionalPhones()])[_0x13e5('0x20')](function(){_0x687ddf=[];for(var _0x2105f3=0x0;_0x2105f3\x20\x20','root','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','parse','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','from','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','findAll','AdditionalPhones','then','length','split','all','push','CmContactHasItem','findOne','updated','create','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','scheduledat','ListId','updatedAt','priority','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_hopper','\x22always\x22','toString','cm_contacts.ListId','cm_hopper_black','ContactId','createdAt','cm_contacts','cm_contacts.phone\x20NOT\x20IN\x20(?)','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','fromQuery','UserId','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','group','info','message','exit','errors','sequelize','query','spread','catch','error','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns_has_cm_lists.CmListId=','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','dialTimezone','isNil','utcOffset','set','offset','stringify','send','start','socket_timestamp','server/files/tmp','.csv','includes'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xb1f7,0x19d));var _0x7b1f=function(_0x53e51c,_0x539f41){_0x53e51c=_0x53e51c-0x0;var _0x646659=_0xb1f7[_0x53e51c];return _0x646659;};'use strict';var fs=require('fs');var path=require(_0x7b1f('0x0'));var _=require(_0x7b1f('0x1'));var Papa=require(_0x7b1f('0x2'));var util=require(_0x7b1f('0x3'));var BPromise=require(_0x7b1f('0x4'));var moment=require(_0x7b1f('0x5'));var squel=require(_0x7b1f('0x6'));var Redis=require(_0x7b1f('0x7'));var db=require(_0x7b1f('0x8'))['db'];var config=require(_0x7b1f('0x9'));var shared=require(_0x7b1f('0xa'));var logger=require(_0x7b1f('0xb'))(_0x7b1f('0xc'));config[_0x7b1f('0xd')]=_[_0x7b1f('0xe')](config[_0x7b1f('0xd')],{'host':_0x7b1f('0xf'),'port':0x18eb});var socket=require(_0x7b1f('0x10'))(new Redis(config[_0x7b1f('0xd')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x7b1f('0x11')](_0x7b1f('0x12'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x7b1f('0x11')](_0x7b1f('0x12'));function isEmail(_0x563935){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x563935);}function selectNotIn(_0x4802ab,_0x40ada3,_0xa2c8ee,_0x1d0989,_0x5a4bac){return squel[_0x7b1f('0x13')]()[_0x7b1f('0x14')](_0x7b1f('0x15'))[_0x7b1f('0x16')](_0x1d0989)['join'](_0x40ada3,null,_0x40ada3+_0x7b1f('0x17')+_0x1d0989+'.'+_0xa2c8ee)[_0x7b1f('0x18')](_0x1d0989+'.'+_0xa2c8ee+_0x7b1f('0x19')+_0x4802ab+'.'+_0xa2c8ee)[_0x7b1f('0x18')](_0x40ada3+_0x7b1f('0x1a')+_0x5a4bac[_0x7b1f('0x1b')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x558955,_0x15f532){promisesAdditionalPhones=[];return db['CmContact'][_0x7b1f('0x1c')]({'raw':!![],'attributes':['id',_0x7b1f('0x1d')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x7b1f('0x1e')](function(_0x3966f2){if(_0x3966f2!==null){var _0x5a613a=[];for(var _0x9ffba5=0x0;_0x9ffba5<_0x3966f2[_0x7b1f('0x1f')];_0x9ffba5++){var _0x5608e6=_0x3966f2[_0x9ffba5];_0x5a613a['push'](insertAdditionalPhones(_0x5608e6));}}Promise['all'](_0x5a613a)[_0x7b1f('0x1e')](function(){_0x558955({'val':0x1});});});});}function insertAdditionalPhones(_0x3b768b){return new Promise(function(_0x3a6841,_0x4dca3b){var _0x42dea8=_0x3b768b['AdditionalPhones'];var _0x22946c=_0x42dea8[_0x7b1f('0x20')](';');var _0x21b1f6=[];orderBy=0x0;for(var _0x5890af=0x0;_0x5890af<_0x22946c[_0x7b1f('0x1f')];_0x5890af++){_0x21b1f6['push'](splitAdditionalPhone(_0x3b768b['id'],_0x22946c[_0x5890af]));}Promise[_0x7b1f('0x21')](_0x21b1f6)[_0x7b1f('0x1e')](function(){_0x3a6841({'val':_0x22946c[_0x7b1f('0x1f')]});});});}function splitAdditionalPhone(_0xc3a52a,_0x48487d){return new Promise(function(_0x5abce6,_0x264483){var _0x543310=_0x48487d[_0x7b1f('0x20')](':');var _0x1e01df=_0x543310[0x0];var _0x2c4588=_0x543310[0x1];if(!_['isNil'](_0x2c4588)){var _0x580cbb=_0x2c4588[_0x7b1f('0x20')]('|');var _0x5c0a5d=[];for(var _0x1a8038=0x0;_0x1a8038<_0x580cbb[_0x7b1f('0x1f')];_0x1a8038++){if(_0x580cbb[_0x1a8038]!==''){var _0x309bd6=_['filter'](promisesAdditionalPhones,{'contactId':_0xc3a52a,'phone':_0x580cbb[_0x1a8038]});if(_0x309bd6[_0x7b1f('0x1f')]==0x0){orderBy++;promisesAdditionalPhones[_0x7b1f('0x22')]({'contactId':_0xc3a52a,'contactTypeId':_0x1e01df,'phone':_0x580cbb[_0x1a8038],'orderBy':orderBy});}}}_0x5abce6({'ok':0x1});}else _0x5abce6({'res':0x0});});}function createAdditionalPhone(_0x299df8,_0x305fc4,_0x58033b,_0x9aeac6){var _0xa9207a='';var _0x20cf70='';var _0xf3764a=_0x58033b['split']('§');_0xa9207a=_0xf3764a[0x0];if(_0xf3764a[_0x7b1f('0x1f')]==0x2)_0x20cf70=_0xf3764a[0x1];return new Promise(function(_0x33b5bc,_0x44fe2b){return db[_0x7b1f('0x23')][_0x7b1f('0x24')]({'where':{'CmContactId':_0x299df8,'item':_0xa9207a}})['then'](function(_0x30a07e){if(_0x30a07e){return db[_0x7b1f('0x23')]['update']({'ItemTypeId':_0x305fc4,'description':_0x20cf70,'OrderBy':_0x9aeac6},{'where':{'CmContactId':_0x299df8,'item':_0xa9207a}})[_0x7b1f('0x1e')](function(_0x13a8ee){_0x33b5bc({'res':_0x7b1f('0x25')});});}else{return db[_0x7b1f('0x23')][_0x7b1f('0x26')]({'CmContactId':_0x299df8,'item':_0xa9207a,'description':_0x20cf70,'ItemTypeId':_0x305fc4,'OrderBy':_0x9aeac6,'ItemClass':'PHONE'})[_0x7b1f('0x1e')](function(_0x45eba4){_0x33b5bc({'res':_0x7b1f('0x27')});});}});});}function insertCmHopper(_0x3ad8f1,_0x1d2340,_0x3dd4d2,_0x73f22b,_0x53da55){var _0x2894c9=[_0x7b1f('0x28'),_0x7b1f('0x29'),_0x7b1f('0x2a'),'cm_contacts.ListId',_0x1d2340+'.'+_0x73f22b,_0x7b1f('0x2b'),_0x7b1f('0x2c'),_0x7b1f('0x2d'),_0x7b1f('0x2e'),'\x22'+_0x53da55+'\x22'];return squel[_0x7b1f('0x2f')]()[_0x7b1f('0x30')]('cm_hopper')['fromQuery']([_0x7b1f('0x15'),_0x7b1f('0x31'),'ContactId',_0x7b1f('0x32'),_0x73f22b,'createdAt',_0x7b1f('0x33'),_0x7b1f('0x34'),'UserId',_0x7b1f('0x35')],squel[_0x7b1f('0x13')]()[_0x7b1f('0x36')](_0x2894c9)[_0x7b1f('0x16')](_0x1d2340)[_0x7b1f('0x1b')]('cm_contacts',null,_0x7b1f('0x37')+_0x1d2340+_0x7b1f('0x38'))[_0x7b1f('0x1b')](_0x3dd4d2,null,_0x3dd4d2+_0x7b1f('0x17')+_0x1d2340+'.'+_0x73f22b)['where'](_0x1d2340+_0x7b1f('0x39'),_0x3ad8f1)['where'](_0x7b1f('0x3a'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1d2340,_0x3dd4d2,_0x73f22b,_0x7b1f('0x3b'),['\x22always\x22','\x22onlyIfOpen\x22']))[_0x7b1f('0x18')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1d2340,_0x3dd4d2,_0x73f22b,_0x7b1f('0x3b'),[_0x7b1f('0x3c')])))[_0x7b1f('0x3d')]();}function insertCmHopperBlack(_0x3d2c56,_0x31b11c,_0x40d093,_0x11f317){var _0x456e74=['cm_contacts.phone','cm_contacts.id',_0x7b1f('0x3e'),_0x31b11c+'.'+_0x11f317,_0x7b1f('0x2b'),_0x7b1f('0x2c')];return squel[_0x7b1f('0x2f')]()[_0x7b1f('0x30')](_0x7b1f('0x3f'))['fromQuery']([_0x7b1f('0x15'),_0x7b1f('0x40'),_0x7b1f('0x32'),_0x11f317,_0x7b1f('0x41'),_0x7b1f('0x33')],squel[_0x7b1f('0x13')]()['fields'](_0x456e74)[_0x7b1f('0x16')](_0x31b11c)[_0x7b1f('0x1b')](_0x7b1f('0x42'),null,_0x7b1f('0x37')+_0x31b11c+_0x7b1f('0x38'))[_0x7b1f('0x1b')](_0x40d093,null,_0x40d093+_0x7b1f('0x17')+_0x31b11c+'.'+_0x11f317)[_0x7b1f('0x18')](_0x31b11c+_0x7b1f('0x39'),_0x3d2c56)['where'](_0x7b1f('0x3a'),NOW)[_0x7b1f('0x18')](_0x7b1f('0x43'),squel['select']()[_0x7b1f('0x14')]('phone')[_0x7b1f('0x16')](_0x7b1f('0x3f'))[_0x7b1f('0x18')](_0x7b1f('0x44'),_0x3d2c56)[_0x7b1f('0x18')](_0x11f317+_0x7b1f('0x19')+_0x31b11c+'.'+_0x11f317)))[_0x7b1f('0x3d')]();}function insertTzCmHopper(_0x51140e,_0x1062f7,_0x1d2b27,_0x3ec2eb,_0x3a5ec0,_0x10497d){var _0x873319=['cm_contacts.phone',_0x7b1f('0x45')+_0x10497d+_0x7b1f('0x46'),_0x7b1f('0x2a'),_0x7b1f('0x3e'),_0x1062f7+'.'+_0x3ec2eb,_0x7b1f('0x2b'),'cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','\x22'+_0x3a5ec0+'\x22'];var _0x519c95=squel[_0x7b1f('0x2f')]()[_0x7b1f('0x30')](_0x7b1f('0x3b'))[_0x7b1f('0x47')](['phone','scheduledat',_0x7b1f('0x40'),_0x7b1f('0x32'),_0x3ec2eb,'createdAt',_0x7b1f('0x33'),'priority',_0x7b1f('0x48'),'recallme'],squel[_0x7b1f('0x13')]()[_0x7b1f('0x36')](_0x873319)[_0x7b1f('0x16')](_0x1062f7)[_0x7b1f('0x1b')](_0x7b1f('0x42'),null,_0x7b1f('0x37')+_0x1062f7+_0x7b1f('0x38'))['join'](_0x1d2b27,null,_0x1d2b27+_0x7b1f('0x17')+_0x1062f7+'.'+_0x3ec2eb)[_0x7b1f('0x1b')](_0x10497d,null,_0x10497d+_0x7b1f('0x17')+_0x1062f7+'.'+_0x3ec2eb)['where'](_0x1062f7+'.CmListId\x20=\x20?',_0x51140e)[_0x7b1f('0x18')](_0x7b1f('0x3a'),NOW)['where'](_0x7b1f('0x43'),selectNotIn(_0x1062f7,_0x1d2b27,_0x3ec2eb,_0x7b1f('0x3b'),[_0x7b1f('0x3c'),'\x22onlyIfOpen\x22']))[_0x7b1f('0x18')](_0x7b1f('0x43'),selectNotIn(_0x1062f7,_0x1d2b27,_0x3ec2eb,_0x7b1f('0x3b'),['\x22always\x22'])))[_0x7b1f('0x3d')]();return _0x519c95;}function insertTzCmHopperBlack(_0x32fde2,_0x4d6d87,_0x4e5f5a,_0x4815c8){var _0x22b6cf=[_0x7b1f('0x28'),_0x7b1f('0x2a'),_0x7b1f('0x3e'),_0x4d6d87+'.'+_0x4815c8,_0x7b1f('0x2b'),_0x7b1f('0x2c')];return squel['insert']()['into']('cm_hopper_black')[_0x7b1f('0x47')]([_0x7b1f('0x15'),_0x7b1f('0x40'),_0x7b1f('0x32'),_0x4815c8,_0x7b1f('0x41'),_0x7b1f('0x33')],squel[_0x7b1f('0x13')]()[_0x7b1f('0x36')](_0x22b6cf)[_0x7b1f('0x16')](_0x4d6d87)[_0x7b1f('0x1b')](_0x7b1f('0x42'),null,_0x7b1f('0x37')+_0x4d6d87+'.CmListId')['join'](_0x4e5f5a,null,_0x4e5f5a+_0x7b1f('0x17')+_0x4d6d87+'.'+_0x4815c8)[_0x7b1f('0x18')](_0x4d6d87+_0x7b1f('0x39'),_0x32fde2)[_0x7b1f('0x18')](_0x7b1f('0x3a'),NOW)[_0x7b1f('0x18')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x7b1f('0x14')](_0x7b1f('0x15'))['from'](_0x7b1f('0x3f'))[_0x7b1f('0x18')]('ListId\x20=\x20?',_0x32fde2)[_0x7b1f('0x18')](_0x4815c8+'\x20=\x20'+_0x4d6d87+'.'+_0x4815c8)))[_0x7b1f('0x3d')]();}function insertCmHopperAdditionalPhones(_0x4d3bf4){var _0x243f78=[_0x7b1f('0x49'),_0x7b1f('0x4a'),'cm_contact_has_items.OrderBy',_0x7b1f('0x4b'),_0x7b1f('0x4c')];return squel[_0x7b1f('0x2f')]()[_0x7b1f('0x30')]('cm_hopper_additional_phones')[_0x7b1f('0x47')]([_0x7b1f('0x4d'),_0x7b1f('0x15'),_0x7b1f('0x4e'),_0x7b1f('0x41'),_0x7b1f('0x33')],squel[_0x7b1f('0x13')]()['fields'](_0x243f78)[_0x7b1f('0x16')](_0x7b1f('0x3b'))[_0x7b1f('0x1b')](_0x7b1f('0x42'),null,_0x7b1f('0x4f'))['join']('cm_contact_has_items',null,_0x7b1f('0x50'))[_0x7b1f('0x18')](_0x7b1f('0x51'),_0x4d3bf4)[_0x7b1f('0x18')](_0x7b1f('0x3a'),NOW))[_0x7b1f('0x3d')]();}function insertCmContact(_0x1f1954,_0x4c2764,_0x26f5dd,_0x4393b7){var _0x2e3387=_[_0x7b1f('0x52')](_[_0x7b1f('0x53')](_0x4393b7),[_0x7b1f('0x32'),'CompanyId',_0x7b1f('0x41'),'updatedAt']);return squel[_0x7b1f('0x2f')]()[_0x7b1f('0x30')](_0x7b1f('0x42'))['fromQuery'](_0x2e3387,squel[_0x7b1f('0x13')]()[_0x7b1f('0x36')](_0x2e3387)['from'](_0x4c2764)['where']('('+_0x26f5dd[_0x7b1f('0x1b')](',')+_0x7b1f('0x54'),squel[_0x7b1f('0x13')]()[_0x7b1f('0x36')](_0x26f5dd)['from'](_0x7b1f('0x42'))['where'](_0x7b1f('0x44'),_0x1f1954)['where'](_0x7b1f('0x55')))[_0x7b1f('0x18')]('id\x20IN\x20?',squel[_0x7b1f('0x13')]()[_0x7b1f('0x14')]('MIN(id)','min_id')[_0x7b1f('0x16')](_0x4c2764)[_0x7b1f('0x56')](_0x26f5dd[_0x7b1f('0x1b')](','))))[_0x7b1f('0x3d')]();}function handleStop(){logger[_0x7b1f('0x57')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x37bec1){logger['error'](_0x37bec1[_0x7b1f('0x58')]);process[_0x7b1f('0x59')](0x1);}function handleError(_0x2eef02,_0x12cc04){stats[_0x7b1f('0x5a')][_0x7b1f('0x22')]({'name':_0x12cc04['code'],'message':_0x12cc04['message'],'row':_0x2eef02});}function handleQuery(_0x987115){logger['info'](_0x987115);return db[_0x7b1f('0x5b')][_0x7b1f('0x5c')](_0x987115)[_0x7b1f('0x5d')](function(_0x507108){results[_0x7b1f('0x22')](_0x507108);})[_0x7b1f('0x5e')](function(_0x17298d){logger[_0x7b1f('0x5f')](_0x17298d[_0x7b1f('0x58')]);});}function updateTzCampaigns(_0x3c8533){return new Promise(function(_0x59fd28,_0x5247ff){var _0x4c0da5=squel[_0x7b1f('0x13')]()[_0x7b1f('0x36')]([_0x7b1f('0x60'),_0x7b1f('0x61')])[_0x7b1f('0x16')](_0x7b1f('0x62'))[_0x7b1f('0x1b')](_0x7b1f('0x63'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')['where'](_0x7b1f('0x64')+_0x3c8533);db[_0x7b1f('0x5b')][_0x7b1f('0x5c')](_0x4c0da5[_0x7b1f('0x3d')]())['spread'](function(_0x36516e){var _0x402b82=[];for(var _0x5c6325=0x0;_0x5c6325<_0x36516e[_0x7b1f('0x1f')];_0x5c6325++){_0x402b82[_0x7b1f('0x22')](getTimezoneData(_0x36516e[_0x5c6325],tmp_campaigns));}BPromise[_0x7b1f('0x21')](_0x402b82)[_0x7b1f('0x1e')](function(){_0x59fd28({'val':0x1});});})[_0x7b1f('0x5e')](function(_0x14b6d6){logger[_0x7b1f('0x5f')](_0x14b6d6['message']);_0x59fd28({'val':0x0});});});}function updateTzVoiceQueues(_0x54ca6a){return new Promise(function(_0x211f08,_0x620fe0){var _0x55847d=squel[_0x7b1f('0x13')]()[_0x7b1f('0x36')]([_0x7b1f('0x65'),_0x7b1f('0x66')])[_0x7b1f('0x16')](_0x7b1f('0x67'))[_0x7b1f('0x1b')]('voice_queues_has_cm_lists',null,_0x7b1f('0x68'))[_0x7b1f('0x18')](_0x7b1f('0x69')+_0x54ca6a);db['sequelize'][_0x7b1f('0x5c')](_0x55847d[_0x7b1f('0x3d')]())[_0x7b1f('0x5d')](function(_0x209b1c){var _0x4a2351=[];for(var _0x1def38=0x0;_0x1def38<_0x209b1c[_0x7b1f('0x1f')];_0x1def38++){_0x4a2351['push'](getTimezoneData(_0x209b1c[_0x1def38],tmp_voice_queues));}BPromise['all'](_0x4a2351)[_0x7b1f('0x1e')](function(){_0x211f08({'val':0x1});});})[_0x7b1f('0x5e')](function(_0x374202){logger[_0x7b1f('0x5f')](_0x374202[_0x7b1f('0x58')]);_0x211f08({'val':0x0});});});}function getTimezoneData(_0x51ebf3,_0x3f7c53){return new Promise(function(_0xf043e1,_0x1f42bf){var _0x934901=shared['timezones'];var _0x42e9ee=_0x934901[_0x51ebf3[_0x7b1f('0x6a')]];if(_[_0x7b1f('0x6b')](_0x42e9ee)){_0xf043e1({'ret':0x1});}else{var _0x6caacd=_0x42e9ee[_0x7b1f('0x6c')];var _0xf70d98=squel[_0x7b1f('0x2f')]()[_0x7b1f('0x30')](_0x3f7c53)[_0x7b1f('0x6d')]('id',_0x51ebf3['id'])[_0x7b1f('0x6d')](_0x7b1f('0x6e'),_0x6caacd)[_0x7b1f('0x6d')]('dialTimezone',_0x51ebf3[_0x7b1f('0x6a')])[_0x7b1f('0x3d')]();return db['sequelize'][_0x7b1f('0x5c')](_0xf70d98)[_0x7b1f('0x5d')](function(_0x47c4e4){_0xf043e1({'ret':0x1});})[_0x7b1f('0x5e')](function(_0x1d0cee){logger[_0x7b1f('0x5f')](_0x1d0cee[_0x7b1f('0x58')]);_0x1f42bf({'ret':0x1});});}});}function handleTZQuery(_0x547c22){logger[_0x7b1f('0x57')](_0x547c22);return db[_0x7b1f('0x5b')]['query'](_0x547c22)[_0x7b1f('0x5d')](function(_0x3ea1b4){})[_0x7b1f('0x5e')](function(_0x364c07){logger['error'](_0x364c07['message']);});}function main(_0x5ea8af,_0x11a17e,_0x27d20b,_0x2068a5){logger[_0x7b1f('0x57')]('main',_0x5ea8af,JSON[_0x7b1f('0x6f')](_0x11a17e));process[_0x7b1f('0x70')](_0x7b1f('0x71'));var _0x167095=_0x11a17e['binding'];var _0x72a88=_['clone'](_0x167095);var _0x2dba50=_0x11a17e[_0x7b1f('0x72')];var _0x1b17d7=path['join'](config['root'],_0x7b1f('0x73'),_0x2dba50+_0x7b1f('0x74'));hasTZ=_[_0x7b1f('0x53')](_0x167095)[_0x7b1f('0x75')](_0x7b1f('0x6a'));var _0x37a0fc=_[_0x7b1f('0x53')](_0x167095)['join']();logger['info'](_0x7b1f('0x76'),_0x37a0fc);db[_0x7b1f('0x77')][_0x7b1f('0x1c')]({'raw':!![],'attributes':['id',_0x7b1f('0x78')]})[_0x7b1f('0x1e')](function(_0x289d08){for(var _0x3a2dd4=0x0;_0x3a2dd4<_0x289d08[_0x7b1f('0x1f')];_0x3a2dd4++){if(_0x289d08[_0x3a2dd4][_0x7b1f('0x78')]in _0x167095){contactItemTypes[_0x7b1f('0x22')](_0x289d08[_0x3a2dd4]);delete _0x72a88[_0x289d08[_0x3a2dd4][_0x7b1f('0x78')]];hasAdditionalPhones=!![];}for(var _0x418c7c in _0x167095){if(_0x289d08[_0x3a2dd4]['name']+_0x7b1f('0x79')===_0x418c7c){phoneDescriptions[_0x7b1f('0x22')]({'itemTypeId':_0x289d08[_0x3a2dd4]['id'],'description':_0x418c7c});delete _0x72a88[_0x418c7c];}}}if(hasAdditionalPhones)_0x72a88['AdditionalPhones']='';var _0x244f6d=_[_0x7b1f('0x53')](_0x72a88)[_0x7b1f('0x1b')]();logger[_0x7b1f('0x57')](_0x7b1f('0x76'),_0x244f6d);fs[_0x7b1f('0x7a')](_0x1b17d7,_0x244f6d+'\x0a');Papa['parse'](fs[_0x7b1f('0x7b')](_0x5ea8af),{'header':!![],'skipEmptyLines':!![],'step':function(_0x101e15,_0x23c2a3){try{for(var _0x427ca7=0x0,_0x3be5a4=[];_0x427ca7<_0x101e15[_0x7b1f('0x7c')][_0x7b1f('0x1f')];_0x427ca7++){stats[_0x7b1f('0x7d')]+=0x1;if(_0x101e15['errors'][_0x427ca7]){handleError(_0x101e15['data'][_0x427ca7],_0x101e15[_0x7b1f('0x5a')][_0x427ca7]);}else{var _0x11a4cd=[];var _0x22cde9=[];var _0x28d633={};for(var _0x5b1d5e in _0x167095){let _0x22f091=contactItemTypes['find'](_0x26fe23=>_0x26fe23[_0x7b1f('0x78')]===_0x5b1d5e);let _0x47c31c=contactItemTypes[_0x7b1f('0x7e')](_0x2ddbda=>_0x2ddbda[_0x7b1f('0x78')]+_0x7b1f('0x79')===_0x5b1d5e);if(_[_0x7b1f('0x6b')](_0x22f091)&&_['isNil'](_0x47c31c)){if(_0x167095[_0x7b1f('0x7f')](_0x5b1d5e)){if(_0x101e15['data'][_0x427ca7][_0x167095[_0x5b1d5e]]){var _0x4dfffb=_['trim'](_0x101e15[_0x7b1f('0x7c')][_0x427ca7][_0x167095[_0x5b1d5e]]['replace'](/"/g,'\x27'));switch(_0x5b1d5e){case _0x7b1f('0x31'):var _0x39b33f=moment(_0x4dfffb,_0x7b1f('0x12'),!![]);if(_0x39b33f[_0x7b1f('0x80')]()){_0x3be5a4['push']('\x22'+_0x4dfffb+'\x22');}else{_0x11a4cd[_0x7b1f('0x22')](_0x7b1f('0x81'));}break;case _0x7b1f('0x34'):var _0x56dfcc=parseInt(_0x4dfffb);_0x4dfffb=_[_0x7b1f('0x82')](_0x56dfcc)||_0x56dfcc<0x0||_0x56dfcc>0x4?_0x2068a5?0x3:0x2:_0x56dfcc;_0x3be5a4['push']('\x22'+_0x4dfffb+'\x22');break;case _0x7b1f('0x48'):var _0x49374c=parseInt(_0x4dfffb);if(_['isNumber'](_0x49374c)&&_['includes'](_0x27d20b,_0x49374c)){_0x3be5a4[_0x7b1f('0x22')]('\x22'+_0x49374c+'\x22');}else{_0x11a4cd[_0x7b1f('0x22')](_0x7b1f('0x83'));}break;case _0x7b1f('0x84'):if(isEmail(_0x4dfffb)){_0x3be5a4[_0x7b1f('0x22')]('\x22'+_0x4dfffb+'\x22');}else{_0x11a4cd[_0x7b1f('0x22')](_0x7b1f('0x85'));}break;case'dateOfBirth':var _0x5c6cbb=moment(_0x4dfffb,'YYYY-MM-DD',!![]);if(_0x5c6cbb[_0x7b1f('0x80')]()){_0x3be5a4['push']('\x22'+_0x4dfffb+'\x22');}else{_0x11a4cd[_0x7b1f('0x22')](_0x7b1f('0x86'));}break;case'dialTimezone':var _0x53c112=shared[_0x7b1f('0x87')];var _0x3665ab=_0x53c112[_0x4dfffb];if(!_['isNil'](_0x3665ab)){var _0x2bb90d=_0x3665ab[_0x7b1f('0x6c')];_0x3be5a4[_0x7b1f('0x22')]('\x22'+_0x4dfffb+'\x22');_0x3be5a4['push']('\x22'+_0x2bb90d+'\x22');}break;default:_0x3be5a4[_0x7b1f('0x22')]('\x22'+_0x4dfffb+'\x22');}}else{switch(_0x5b1d5e){case _0x7b1f('0x88'):case _0x7b1f('0x15'):_0x11a4cd['push'](_0x5b1d5e+'\x20not\x20specified');break;default:_0x3be5a4[_0x7b1f('0x22')]('\x22\x22');}}}}else{var _0x550047='';if(!_[_0x7b1f('0x6b')](_0x22f091)){if(!_0x28d633[_0x7b1f('0x7f')](_0x22f091['id'])){if(!_[_0x7b1f('0x6b')](_0x101e15[_0x7b1f('0x7c')][_0x427ca7][_0x167095[_0x5b1d5e]])){var _0x4dfffb=_['trim'](_0x101e15[_0x7b1f('0x7c')][_0x427ca7][_0x167095[_0x5b1d5e]][_0x7b1f('0x89')](/"/g,'\x27'));var _0x2d78f2=phoneDescriptions[_0x7b1f('0x7e')](_0x481308=>_0x481308[_0x7b1f('0x8a')]===_0x22f091['id']);if(!_[_0x7b1f('0x6b')](_0x2d78f2)){var _0x1e16f1=_[_0x7b1f('0x8b')](_0x101e15[_0x7b1f('0x7c')][_0x427ca7][_0x167095[_0x2d78f2[_0x7b1f('0x8c')]]]['replace'](/"/g,'\x27'));if(!_[_0x7b1f('0x6b')](_0x1e16f1))_0x4dfffb=_0x4dfffb+'§'+_0x1e16f1;}if(_0x550047=='')_0x550047=_0x4dfffb;else _0x550047+='|'+_0x4dfffb;}_0x22cde9[_0x7b1f('0x22')](_0x22f091['id']+':'+_0x550047);_0x28d633[_0x22f091['id']]=0x1;}}}}if(hasAdditionalPhones){_0x3be5a4[_0x7b1f('0x22')]('\x22'+_0x22cde9['join'](';')+'\x22');}if(_0x11a4cd[_0x7b1f('0x1f')]){handleError(_0x101e15[_0x7b1f('0x7c')][_0x427ca7],{'code':_0x7b1f('0x8d'),'message':_0x11a4cd['join']()});}else{fs['appendFileSync'](_0x1b17d7,_0x3be5a4['join']()+'\x0a');}_0x3be5a4=[];}if(!(stats[_0x7b1f('0x7d')]%0xc8)){socket['emit'](_0x7b1f('0x8e')+_0x2dba50,stats);stats[_0x7b1f('0x5a')]=[];}}if(stopped){logger[_0x7b1f('0x57')](_0x7b1f('0x8f'));_0x23c2a3['abort']();}}catch(_0xaba66a){handleError(_0x101e15['data'][_0x427ca7],{'code':_0x7b1f('0x90'),'message':_0xaba66a[_0x7b1f('0x58')]});logger[_0x7b1f('0x5f')](_0x7b1f('0x91'),_0xaba66a['message']);}},'complete':function(){try{var _0x411ade=[];var _0x48050d=[];var _0x1046a0='cm_contacts';if(_0x11a17e['duplicates']&&_0x11a17e[_0x7b1f('0x92')][_0x7b1f('0x1f')]){_0x1046a0='cm_contacts_'+_0x2dba50;_0x411ade[_0x7b1f('0x22')]('CREATE\x20TABLE\x20'+_0x1046a0+_0x7b1f('0x93'));}tmp_campaigns='campaigns_'+_0x2dba50;tmp_voice_queues=_0x7b1f('0x94')+_0x2dba50;_0x48050d['push'](_0x7b1f('0x95')+tmp_campaigns+_0x7b1f('0x96'));_0x48050d[_0x7b1f('0x22')]('CREATE\x20TABLE\x20'+tmp_voice_queues+_0x7b1f('0x96'));BPromise[_0x7b1f('0x97')](_0x48050d,handleTZQuery)[_0x7b1f('0x1e')](function(_0x28c140){updateTzCampaigns(_0x11a17e[_0x7b1f('0x32')])['then'](function(_0x43f0d5){updateTzVoiceQueues(_0x11a17e[_0x7b1f('0x32')])[_0x7b1f('0x1e')](function(_0x57c098){if(hasTZ)_0x244f6d=_0x244f6d[_0x7b1f('0x89')]('dialTimezone',_0x7b1f('0x98'));var _0x5df4d8=util[_0x7b1f('0x11')]('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',_0x1b17d7,_0x1046a0,_0x244f6d,_0x11a17e[_0x7b1f('0x32')],_0x11a17e['CompanyId']||null,NOW,NOW);if(_[_0x7b1f('0x6b')](_0x167095[_0x7b1f('0x31')])){_0x5df4d8+=_0x7b1f('0x99');}_0x411ade[_0x7b1f('0x22')](_0x5df4d8);if(_0x11a17e['duplicates']&&_0x11a17e[_0x7b1f('0x92')]['length']){_0x411ade[_0x7b1f('0x22')](insertCmContact(_0x11a17e['ListId'],_0x1046a0,_0x11a17e['duplicates'],_0x167095));_0x411ade[_0x7b1f('0x22')](_0x7b1f('0x9a')+_0x1046a0+';');}BPromise[_0x7b1f('0x97')](_0x411ade,handleQuery)[_0x7b1f('0x1e')](function(_0xf3e44c){BPromise[_0x7b1f('0x21')]([handleAdditionalPhones()])['then'](function(){_0x411ade=[];for(var _0x83f080=0x0;_0x83f080_0x5407f5[_0xe56f('0x66')]===_0x3074e4);let _0x28ef74=contactItemTypes[_0xe56f('0x6e')](_0x22dfc4=>_0x22dfc4[_0xe56f('0x66')]+'_description'===_0x3074e4);if(_['isNil'](_0x55985f)&&_['isNil'](_0x28ef74)){if(_0x92b989['hasOwnProperty'](_0x3074e4)){if(_0x4c96ca['data'][_0x2a266d][_0x92b989[_0x3074e4]]){var _0x38019e=_['trim'](_0x4c96ca[_0xe56f('0x6b')][_0x2a266d][_0x92b989[_0x3074e4]][_0xe56f('0x6f')](/"/g,'\x27'));switch(_0x3074e4){case _0xe56f('0x32'):var _0x7755c4=moment(_0x38019e,_0xe56f('0xc'),!![]);if(_0x7755c4[_0xe56f('0x70')]()){_0xc15eb2[_0xe56f('0x1a')]('\x22'+_0x38019e+'\x22');}else{_0x310017[_0xe56f('0x1a')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xe56f('0x36'):var _0xb3eb56=parseInt(_0x38019e);_0x38019e=_['isNaN'](_0xb3eb56)||_0xb3eb56<0x0||_0xb3eb56>0x4?_0x1c72f4?0x3:0x2:_0xb3eb56;_0xc15eb2[_0xe56f('0x1a')]('\x22'+_0x38019e+'\x22');break;case _0xe56f('0x37'):var _0x485dfd=parseInt(_0x38019e);if(_[_0xe56f('0x71')](_0x485dfd)&&_[_0xe56f('0x72')](_0x104d51,_0x485dfd)){_0xc15eb2[_0xe56f('0x1a')]('\x22'+_0x485dfd+'\x22');}else{_0x310017[_0xe56f('0x1a')](_0xe56f('0x73'));}break;case _0xe56f('0x74'):if(isEmail(_0x38019e)){_0xc15eb2[_0xe56f('0x1a')]('\x22'+_0x38019e+'\x22');}else{_0x310017['push'](_0xe56f('0x75'));}break;case _0xe56f('0x76'):var _0x52276e=moment(_0x38019e,_0xe56f('0x77'),!![]);if(_0x52276e['isValid']()){_0xc15eb2[_0xe56f('0x1a')]('\x22'+_0x38019e+'\x22');}else{_0x310017[_0xe56f('0x1a')](_0xe56f('0x78'));}break;default:_0xc15eb2[_0xe56f('0x1a')]('\x22'+_0x38019e+'\x22');}}else{switch(_0x3074e4){case _0xe56f('0x79'):case _0xe56f('0x10'):_0x310017[_0xe56f('0x1a')](_0x3074e4+_0xe56f('0x7a'));break;default:_0xc15eb2[_0xe56f('0x1a')]('\x22\x22');}}}}else{var _0x1dac38='';if(!_[_0xe56f('0x18')](_0x55985f)){if(!_0x256ce6[_0xe56f('0x7b')](_0x55985f['id'])){for(var _0xb783f2=0x0;_0xb783f2<_0x92b989[_0x3074e4]['length'];_0xb783f2++){var _0x38019e=_[_0xe56f('0x7c')](_0x4c96ca[_0xe56f('0x6b')][_0x2a266d][_0x92b989[_0x3074e4][_0xb783f2]][_0xe56f('0x6f')](/"/g,'\x27'));var _0x445a61=phoneDescriptions[_0xe56f('0x6e')](_0xd2dd5c=>_0xd2dd5c[_0xe56f('0x7d')]===_0x55985f['id']);if(!_['isNil'](_0x445a61)){var _0x2475e3=_[_0xe56f('0x7c')](_0x4c96ca[_0xe56f('0x6b')][_0x2a266d][_0x92b989[_0x445a61['description']][0x0]][_0xe56f('0x6f')](/"/g,'\x27'));if(!_[_0xe56f('0x18')](_0x2475e3))_0x38019e=_0x38019e+'§'+_0x2475e3;}if(_0x1dac38=='')_0x1dac38=_0x38019e;else _0x1dac38+='|'+_0x38019e;}_0x31c56b[_0xe56f('0x1a')](_0x55985f['id']+':'+_0x1dac38);_0x256ce6[_0x55985f['id']]=0x1;}}}}if(hasAdditionalPhones){_0xc15eb2[_0xe56f('0x1a')]('\x22'+_0x31c56b['join'](';')+'\x22');}if(_0x310017[_0xe56f('0x17')]){handleError(_0x4c96ca[_0xe56f('0x6b')][_0x2a266d],{'code':_0xe56f('0x7e'),'message':_0x310017[_0xe56f('0x11')]()});}else{fs['appendFileSync'](_0x599622,_0xc15eb2[_0xe56f('0x11')]()+'\x0a');}_0xc15eb2=[];}if(!(stats[_0xe56f('0x6c')]%0xc8)){socket[_0xe56f('0x7f')]('contact:import:'+_0x58fa85,stats);stats[_0xe56f('0x6d')]=[];}}if(stopped){logger[_0xe56f('0x58')](_0xe56f('0x80'));_0x9679c9[_0xe56f('0x81')]();}}catch(_0x276b84){handleError(_0x4c96ca[_0xe56f('0x6b')][_0x2a266d],{'code':_0xe56f('0x82'),'message':_0x276b84[_0xe56f('0x5b')]});logger[_0xe56f('0x1e')]('step',_0x276b84[_0xe56f('0x5b')]);}},'complete':function(){try{var _0x29583a=[];var _0x598d06=tempTableName;_0x29583a[_0xe56f('0x1a')](_0xe56f('0x83')+_0x598d06+_0xe56f('0x84'));logger[_0xe56f('0x58')]('CIS\x20len',contactItemTypes[_0xe56f('0x17')]);var _0x53cf7c=util[_0xe56f('0xb')](_0xe56f('0x85'),_0x599622,_0x598d06,_0x3b6962,_0x277258[_0xe56f('0x33')],_0x277258[_0xe56f('0x54')]||null,NOW,NOW);if(_[_0xe56f('0x18')](_0x92b989[_0xe56f('0x32')])){_0x53cf7c+=_0xe56f('0x86');}_0x29583a[_0xe56f('0x1a')](_0x53cf7c);BPromise[_0xe56f('0x87')](_0x29583a,handleQuery)[_0xe56f('0x1c')](function(_0x1eb33f){BPromise[_0xe56f('0x1b')]([handleAdditionalPhones()])[_0xe56f('0x1c')](function(){_0x29583a=[];for(var _0x3ab009=0x0;_0x3ab009\x20\x20');}var _0x3551d5=path[_0xe56f('0x11')](config[_0xe56f('0x93')],_0xe56f('0x62'),process[_0xe56f('0x92')][0x2]);if(!fs['existsSync'](_0x3551d5)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x48de58={};try{_0x48de58=JSON[_0xe56f('0x6a')](process[_0xe56f('0x92')][0x3]);if(!_0x48de58['binding']){throw new Error(_0xe56f('0x94'));}var _0x2a6d34=0x0;if(_0x48de58[_0xe56f('0x5f')][_0xe56f('0x37')]){_0x2a6d34=0x1;}if(!_0x48de58[_0xe56f('0x33')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x40a0b9){throw new Error(_0xe56f('0x95'));}var _0x305c43=[];try{_0x305c43=_[_0xe56f('0x96')](JSON[_0xe56f('0x6a')](process['argv'][0x4]),'id');}catch(_0x52570a){logger[_0xe56f('0x58')](_0xe56f('0x97'));}main(_0x3551d5,_0x48de58,_0x305c43,_0x2a6d34);}validate();process['on']('SIGINT',handleStop);process['on'](_0xe56f('0x98'),handleUncaughtException); \ No newline at end of file +var _0x69d3=['.csv','body','ContactItemType','findAll','name','_description','writeFileSync','parse','createReadStream','data','rows','find','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','itemTypeId','description','SystemRow','appendFileSync','contact:import:','Abort\x20parser','abort','SystemError','step','CREATE\x20TABLE\x20','CIS\x20len','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\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId',',\x20scheduledAt\x20=\x20NOW()','each','contactId','orderBy','DROP\x20TABLE\x20','finish','affectedRows','emit','unlink','argv','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','path','lodash','papaparse','bluebird','moment','../../../mysqldb','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','YYYYMMDDHHmmss','test','select','field','phone','from','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','isNil','push','all','catch','error','message','AdditionalPhones','split','then','length','filter','CmContactHasItem','update','updated','create','PHONE','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','join','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_hopper_black','fields','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','toString','concat','keys',')\x20NOT\x20IN\x20?','id\x20IN\x20?','group','Received\x20SIGINT','exit','errors','info','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp'];(function(_0x5e6ea3,_0x9addd2){var _0x4048b5=function(_0x9092e4){while(--_0x9092e4){_0x5e6ea3['push'](_0x5e6ea3['shift']());}};_0x4048b5(++_0x9addd2);}(_0x69d3,0xda));var _0x369d=function(_0x90b137,_0x1b1931){_0x90b137=_0x90b137-0x0;var _0x2e96a4=_0x69d3[_0x90b137];return _0x2e96a4;};'use strict';var fs=require('fs');var path=require(_0x369d('0x0'));var _=require(_0x369d('0x1'));var Papa=require(_0x369d('0x2'));var util=require('util');var BPromise=require(_0x369d('0x3'));var moment=require(_0x369d('0x4'));var squel=require('squel');var Redis=require('ioredis');var db=require(_0x369d('0x5'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x369d('0x6'));config[_0x369d('0x7')]=_[_0x369d('0x8')](config[_0x369d('0x7')],{'host':_0x369d('0x9'),'port':0x18eb});var socket=require(_0x369d('0xa'))(new Redis(config[_0x369d('0x7')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x369d('0xb')](_0x369d('0xc'));var tempTableName='cm_contacts_temp_'+moment()['format'](_0x369d('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x222f5f){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))*$/[_0x369d('0xe')](_0x222f5f);}function selectNotIn(_0x1cf530,_0x4c7850,_0x5ba2d0,_0x2c95eb,_0x40c00f){return squel[_0x369d('0xf')]()[_0x369d('0x10')](_0x369d('0x11'))[_0x369d('0x12')](_0x2c95eb)['join'](_0x4c7850,null,_0x4c7850+_0x369d('0x13')+_0x2c95eb+'.'+_0x5ba2d0)[_0x369d('0x14')](_0x2c95eb+'.'+_0x5ba2d0+_0x369d('0x15')+_0x1cf530+'.'+_0x5ba2d0)[_0x369d('0x14')](_0x4c7850+_0x369d('0x16')+_0x40c00f['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5cd4c3,_0x5485a1){promisesAdditionalPhones=[];promisesContact=[];return db[_0x369d('0x17')][_0x369d('0x18')](_0x369d('0x19')+tempTableName)['spread'](function(_0x2c1a4a){if(_0x2c1a4a!==null){var _0x29c1fe=[];for(var _0x435c2f=0x0;_0x435c2f<_0x2c1a4a['length'];_0x435c2f++){var _0x368c05=_0x2c1a4a[_0x435c2f];if(!_[_0x369d('0x1a')](_0x368c05['phone'])){if(!_['isNil'](_0x368c05['AdditionalPhones']))_0x29c1fe[_0x369d('0x1b')](insertAdditionalPhones(_0x368c05));promisesContact[_0x369d('0x1b')]({'contact':_0x368c05});}}}Promise[_0x369d('0x1c')](_0x29c1fe)['then'](function(){_0x5cd4c3({'val':0x1});});})[_0x369d('0x1d')](function(_0x24dfff){logger[_0x369d('0x1e')](_0x24dfff[_0x369d('0x1f')]);});});}function insertAdditionalPhones(_0x2eb5d7){return new Promise(function(_0x538ca4,_0x5c9fdd){var _0x448e6e=_0x2eb5d7[_0x369d('0x20')];if(_[_0x369d('0x1a')](_0x448e6e))_0x5c9fdd({'val':0x0});else{var _0x1ea66a=_0x448e6e[_0x369d('0x21')](';');var _0x15fbef=[];orderBy=0x0;for(var _0x1b262a=0x0;_0x1b262a<_0x1ea66a['length'];_0x1b262a++){_0x15fbef['push'](splitAdditionalPhone(_0x2eb5d7['id'],_0x1ea66a[_0x1b262a]));}Promise[_0x369d('0x1c')](_0x15fbef)[_0x369d('0x22')](function(){_0x538ca4({'val':_0x1ea66a[_0x369d('0x23')]});});}});}function splitAdditionalPhone(_0xcae58,_0x30e7c5){return new Promise(function(_0x38f0b8,_0x36cf04){var _0x566c96=_0x30e7c5['split'](':');var _0x16145e=_0x566c96[0x0];var _0x46de2b=_0x566c96[0x1];if(_0x46de2b!==''){var _0x15cd81=_0x46de2b[_0x369d('0x21')]('|');var _0x8aa521=[];for(var _0x41e0cf=0x0;_0x41e0cf<_0x15cd81[_0x369d('0x23')];_0x41e0cf++){if(_0x15cd81[_0x41e0cf]!==''){var _0x570db4=_[_0x369d('0x24')](promisesAdditionalPhones,{'contactId':_0xcae58,'phone':_0x15cd81[_0x41e0cf]});if(_0x570db4[_0x369d('0x23')]==0x0){orderBy++;promisesAdditionalPhones[_0x369d('0x1b')]({'contactId':_0xcae58,'contactTypeId':_0x16145e,'phone':_0x15cd81[_0x41e0cf],'orderBy':orderBy});}}}_0x38f0b8({'ok':0x1});}else _0x38f0b8({'res':0x0});});}function createAdditionalPhone(_0xf952a3,_0x345be5,_0x41367a,_0x3d1ce0){var _0x4d42ea='';var _0x157291='';var _0x56efb1=_0x41367a['split']('§');_0x4d42ea=_0x56efb1[0x0];if(_0x56efb1[_0x369d('0x23')]==0x2)_0x157291=_0x56efb1[0x1];return new Promise(function(_0x1151b3,_0x5844c7){return db[_0x369d('0x25')]['findOne']({'where':{'CmContactId':_0xf952a3,'item':_0x4d42ea}})[_0x369d('0x22')](function(_0x39d656){if(_0x39d656){return db[_0x369d('0x25')][_0x369d('0x26')]({'ItemTypeId':_0x345be5,'description':_0x157291,'OrderBy':_0x3d1ce0},{'where':{'CmContactId':_0xf952a3,'item':_0x4d42ea}})[_0x369d('0x22')](function(_0x340654){_0x1151b3({'res':_0x369d('0x27')});});}else{return db['CmContactHasItem'][_0x369d('0x28')]({'CmContactId':_0xf952a3,'item':_0x4d42ea,'ItemTypeId':_0x345be5,'description':_0x157291,'OrderBy':_0x3d1ce0,'ItemClass':_0x369d('0x29')})[_0x369d('0x22')](function(_0x20be5e){_0x1151b3({'res':_0x369d('0x2a')});});}});});}function updateContact(_0x40269e){return new Promise(function(_0x26c0e4,_0xbb8401){var _0x4ac9d5=_0x40269e['id'];delete _0x40269e['id'];return db[_0x369d('0x2b')][_0x369d('0x26')](_0x40269e,{'where':{'id':_0x4ac9d5}})[_0x369d('0x22')](function(_0x1b4453){updatedRows+=0x1;return db[_0x369d('0x2c')]['update']({'phone':_0x40269e[_0x369d('0x11')]},{'where':{'ContactId':_0x4ac9d5}})[_0x369d('0x22')](function(_0x337b93){_0x26c0e4({'ret':'OK'});});});});}function insertCmHopper(_0x3a0277,_0x3cb801,_0x3e6c14,_0x50c033,_0x20a76e){var _0x3f8ee9=[_0x369d('0x2d'),_0x369d('0x2e'),_0x369d('0x2f'),_0x369d('0x30'),_0x3cb801+'.'+_0x50c033,_0x369d('0x31'),_0x369d('0x32'),_0x369d('0x33'),_0x369d('0x34'),'\x22'+_0x20a76e+'\x22'];return squel[_0x369d('0x35')]()[_0x369d('0x36')](_0x369d('0x37'))[_0x369d('0x38')]([_0x369d('0x11'),_0x369d('0x39'),_0x369d('0x3a'),_0x369d('0x3b'),_0x50c033,_0x369d('0x3c'),_0x369d('0x3d'),_0x369d('0x3e'),_0x369d('0x3f'),_0x369d('0x40')],squel[_0x369d('0xf')]()['fields'](_0x3f8ee9)['from'](_0x3cb801)[_0x369d('0x41')](_0x369d('0x42'),null,_0x369d('0x43')+_0x3cb801+_0x369d('0x44'))[_0x369d('0x41')](_0x3e6c14,null,_0x3e6c14+_0x369d('0x13')+_0x3cb801+'.'+_0x50c033)[_0x369d('0x14')](_0x3cb801+_0x369d('0x45'),_0x3a0277)[_0x369d('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x369d('0x14')](_0x369d('0x46'),selectNotIn(_0x3cb801,_0x3e6c14,_0x50c033,_0x369d('0x37'),[_0x369d('0x47'),_0x369d('0x48')]))[_0x369d('0x14')](_0x369d('0x46'),selectNotIn(_0x3cb801,_0x3e6c14,_0x50c033,_0x369d('0x37'),['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x20b351,_0x3222ce,_0x30909a,_0x4dad71){var _0x4d07ac=['cm_contacts.phone',_0x369d('0x2f'),_0x369d('0x30'),_0x3222ce+'.'+_0x4dad71,'cm_contacts.createdAt',_0x369d('0x32')];return squel[_0x369d('0x35')]()[_0x369d('0x36')](_0x369d('0x49'))['fromQuery']([_0x369d('0x11'),'ContactId',_0x369d('0x3b'),_0x4dad71,'createdAt',_0x369d('0x3d')],squel[_0x369d('0xf')]()[_0x369d('0x4a')](_0x4d07ac)['from'](_0x3222ce)['join'](_0x369d('0x42'),null,_0x369d('0x43')+_0x3222ce+_0x369d('0x44'))['join'](_0x30909a,null,_0x30909a+_0x369d('0x13')+_0x3222ce+'.'+_0x4dad71)[_0x369d('0x14')](_0x3222ce+_0x369d('0x45'),_0x20b351)[_0x369d('0x14')](_0x369d('0x4b'),NOW)[_0x369d('0x14')](_0x369d('0x46'),squel[_0x369d('0xf')]()[_0x369d('0x10')]('phone')[_0x369d('0x12')](_0x369d('0x49'))[_0x369d('0x14')](_0x369d('0x4c'),_0x20b351)[_0x369d('0x14')](_0x4dad71+_0x369d('0x4d'),_0x3222ce+'.'+_0x4dad71)))['toString']();}function insertCmHopperAdditionalPhones(_0x4663a5){var _0xa77af=[_0x369d('0x4e'),_0x369d('0x4f'),_0x369d('0x50'),_0x369d('0x51'),_0x369d('0x52')];return squel[_0x369d('0x35')]()[_0x369d('0x36')](_0x369d('0x53'))[_0x369d('0x38')]([_0x369d('0x54'),'phone',_0x369d('0x55'),_0x369d('0x3c'),_0x369d('0x3d')],squel[_0x369d('0xf')]()[_0x369d('0x4a')](_0xa77af)['from'](_0x369d('0x37'))['join'](_0x369d('0x42'),null,_0x369d('0x56'))[_0x369d('0x41')](_0x369d('0x57'),null,_0x369d('0x58'))[_0x369d('0x14')](_0x369d('0x59'),_0x4663a5)[_0x369d('0x14')](_0x369d('0x4b'),NOW))[_0x369d('0x5a')]();}function insertCmContact(_0x4d582a,_0x5a3dd4,_0x203750,_0x38ee10){var _0x18cd5f=_[_0x369d('0x5b')](_[_0x369d('0x5c')](_0x38ee10),['ListId','CompanyId',_0x369d('0x3c'),_0x369d('0x3d')]);return squel['insert']()[_0x369d('0x36')]('cm_contacts')[_0x369d('0x38')](_0x18cd5f,squel[_0x369d('0xf')]()[_0x369d('0x4a')](_0x18cd5f)['from'](_0x5a3dd4)[_0x369d('0x14')]('('+_0x203750[_0x369d('0x41')](',')+_0x369d('0x5d'),squel[_0x369d('0xf')]()['fields'](_0x203750)['from'](_0x369d('0x42'))[_0x369d('0x14')](_0x369d('0x4c'),_0x4d582a))['where'](_0x369d('0x5e'),squel[_0x369d('0xf')]()[_0x369d('0x10')]('MIN(id)','min_id')[_0x369d('0x12')](_0x5a3dd4)[_0x369d('0x5f')](_0x203750[_0x369d('0x41')](','))))[_0x369d('0x5a')]();}function handleStop(){logger['info'](_0x369d('0x60'));stopped=!![];}function handleUncaughtException(_0x1fa6bb){logger[_0x369d('0x1e')](_0x1fa6bb[_0x369d('0x1f')]);process[_0x369d('0x61')](0x1);}function handleError(_0x50af03,_0x2fc235){stats[_0x369d('0x62')][_0x369d('0x1b')]({'name':_0x2fc235['code'],'message':_0x2fc235[_0x369d('0x1f')],'row':_0x50af03});}function handleQuery(_0x4ba127){logger[_0x369d('0x63')](_0x4ba127);return db['sequelize']['query'](_0x4ba127)['spread'](function(_0x4b83e7){results[_0x369d('0x1b')](_0x4b83e7);})['catch'](function(_0x2f92b3){logger['error'](_0x2f92b3[_0x369d('0x1f')]);});}function main(_0x3181fd,_0x449fa9,_0x5f1142,_0x355043){logger[_0x369d('0x63')](_0x369d('0x64'),_0x3181fd,JSON[_0x369d('0x65')](_0x449fa9));process[_0x369d('0x66')](_0x369d('0x67'));var _0x58347b=_0x449fa9[_0x369d('0x68')];var _0x4bd395=_['clone'](_0x58347b);var _0x56c98e=_0x449fa9[_0x369d('0x69')];var _0xab8c70=path[_0x369d('0x41')](config[_0x369d('0x6a')],_0x369d('0x6b'),_0x56c98e+_0x369d('0x6c'));logger[_0x369d('0x63')](_0x369d('0x6d'),_0x449fa9);db[_0x369d('0x6e')][_0x369d('0x6f')]({'raw':!![],'attributes':['id',_0x369d('0x70')]})[_0x369d('0x22')](function(_0x172f62){for(var _0x7ba3e5=0x0;_0x7ba3e5<_0x172f62[_0x369d('0x23')];_0x7ba3e5++){if(_0x172f62[_0x7ba3e5][_0x369d('0x70')]in _0x58347b){contactItemTypes['push'](_0x172f62[_0x7ba3e5]);delete _0x4bd395[_0x172f62[_0x7ba3e5][_0x369d('0x70')]];hasAdditionalPhones=!![];}for(var _0x5306cb in _0x58347b){if(_0x172f62[_0x7ba3e5][_0x369d('0x70')]+_0x369d('0x71')===_0x5306cb){phoneDescriptions[_0x369d('0x1b')]({'itemTypeId':_0x172f62[_0x7ba3e5]['id'],'description':_0x5306cb});delete _0x4bd395[_0x5306cb];}}}if(hasAdditionalPhones)_0x4bd395[_0x369d('0x20')]='';var _0x23dcd9=_['keys'](_0x4bd395)[_0x369d('0x41')]();logger['info']('header',_0x23dcd9);fs[_0x369d('0x72')](_0xab8c70,_0x23dcd9+'\x0a');Papa[_0x369d('0x73')](fs[_0x369d('0x74')](_0x3181fd),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1027ee,_0x2a42a1){try{for(var _0x31c1b0=0x0,_0x341d93=[];_0x31c1b0<_0x1027ee[_0x369d('0x75')]['length'];_0x31c1b0++){stats[_0x369d('0x76')]+=0x1;if(_0x1027ee[_0x369d('0x62')][_0x31c1b0]){handleError(_0x1027ee['data'][_0x31c1b0],_0x1027ee[_0x369d('0x62')][_0x31c1b0]);}else{var _0x37075c=[];var _0x41e4a2=[];var _0x59fecc={};for(var _0x320977 in _0x58347b){let _0x48bd12=contactItemTypes[_0x369d('0x77')](_0x441d3b=>_0x441d3b[_0x369d('0x70')]===_0x320977);let _0x369199=contactItemTypes[_0x369d('0x77')](_0x1a9a01=>_0x1a9a01[_0x369d('0x70')]+'_description'===_0x320977);if(_[_0x369d('0x1a')](_0x48bd12)&&_[_0x369d('0x1a')](_0x369199)){if(_0x58347b['hasOwnProperty'](_0x320977)){if(_0x1027ee[_0x369d('0x75')][_0x31c1b0][_0x58347b[_0x320977]]){var _0x26faf4=_[_0x369d('0x78')](_0x1027ee[_0x369d('0x75')][_0x31c1b0][_0x58347b[_0x320977]][_0x369d('0x79')](/"/g,'\x27'));switch(_0x320977){case'scheduledat':var _0x3a52df=moment(_0x26faf4,_0x369d('0xc'),!![]);if(_0x3a52df['isValid']()){_0x341d93[_0x369d('0x1b')]('\x22'+_0x26faf4+'\x22');}else{_0x37075c[_0x369d('0x1b')](_0x369d('0x7a'));}break;case'priority':var _0x7ee210=parseInt(_0x26faf4);_0x26faf4=_[_0x369d('0x7b')](_0x7ee210)||_0x7ee210<0x0||_0x7ee210>0x4?_0x355043?0x3:0x2:_0x7ee210;_0x341d93[_0x369d('0x1b')]('\x22'+_0x26faf4+'\x22');break;case _0x369d('0x3f'):var _0x46c137=parseInt(_0x26faf4);if(_['isNumber'](_0x46c137)&&_[_0x369d('0x7c')](_0x5f1142,_0x46c137)){_0x341d93[_0x369d('0x1b')]('\x22'+_0x46c137+'\x22');}else{_0x37075c[_0x369d('0x1b')](_0x369d('0x7d'));}break;case _0x369d('0x7e'):if(isEmail(_0x26faf4)){_0x341d93['push']('\x22'+_0x26faf4+'\x22');}else{_0x37075c['push'](_0x369d('0x7f'));}break;case _0x369d('0x80'):var _0x2307fc=moment(_0x26faf4,_0x369d('0x81'),!![]);if(_0x2307fc[_0x369d('0x82')]()){_0x341d93[_0x369d('0x1b')]('\x22'+_0x26faf4+'\x22');}else{_0x37075c['push'](_0x369d('0x83'));}break;default:_0x341d93[_0x369d('0x1b')]('\x22'+_0x26faf4+'\x22');}}else{switch(_0x320977){case'firstName':case _0x369d('0x11'):_0x37075c['push'](_0x320977+_0x369d('0x84'));break;default:_0x341d93['push']('\x22\x22');}}}}else{var _0x2b791a='';if(!_[_0x369d('0x1a')](_0x48bd12)){if(!_0x59fecc['hasOwnProperty'](_0x48bd12['id'])){for(var _0x4148a9=0x0;_0x4148a9<_0x58347b[_0x320977]['length'];_0x4148a9++){var _0x26faf4=_['trim'](_0x1027ee['data'][_0x31c1b0][_0x58347b[_0x320977][_0x4148a9]][_0x369d('0x79')](/"/g,'\x27'));var _0x3a2904=phoneDescriptions[_0x369d('0x77')](_0x279d3b=>_0x279d3b[_0x369d('0x85')]===_0x48bd12['id']);if(!_['isNil'](_0x3a2904)){var _0x28ec32=_[_0x369d('0x78')](_0x1027ee[_0x369d('0x75')][_0x31c1b0][_0x58347b[_0x3a2904[_0x369d('0x86')]][0x0]][_0x369d('0x79')](/"/g,'\x27'));if(!_[_0x369d('0x1a')](_0x28ec32))_0x26faf4=_0x26faf4+'§'+_0x28ec32;}if(_0x2b791a=='')_0x2b791a=_0x26faf4;else _0x2b791a+='|'+_0x26faf4;}_0x41e4a2[_0x369d('0x1b')](_0x48bd12['id']+':'+_0x2b791a);_0x59fecc[_0x48bd12['id']]=0x1;}}}}if(hasAdditionalPhones){_0x341d93[_0x369d('0x1b')]('\x22'+_0x41e4a2[_0x369d('0x41')](';')+'\x22');}if(_0x37075c['length']){handleError(_0x1027ee[_0x369d('0x75')][_0x31c1b0],{'code':_0x369d('0x87'),'message':_0x37075c[_0x369d('0x41')]()});}else{fs[_0x369d('0x88')](_0xab8c70,_0x341d93['join']()+'\x0a');}_0x341d93=[];}if(!(stats[_0x369d('0x76')]%0xc8)){socket['emit'](_0x369d('0x89')+_0x56c98e,stats);stats[_0x369d('0x62')]=[];}}if(stopped){logger[_0x369d('0x63')](_0x369d('0x8a'));_0x2a42a1[_0x369d('0x8b')]();}}catch(_0x401f3b){handleError(_0x1027ee[_0x369d('0x75')][_0x31c1b0],{'code':_0x369d('0x8c'),'message':_0x401f3b[_0x369d('0x1f')]});logger[_0x369d('0x1e')](_0x369d('0x8d'),_0x401f3b[_0x369d('0x1f')]);}},'complete':function(){try{var _0x2030e1=[];var _0x196a55=tempTableName;_0x2030e1['push'](_0x369d('0x8e')+_0x196a55+'\x20LIKE\x20cm_contacts;');logger['info'](_0x369d('0x8f'),contactItemTypes[_0x369d('0x23')]);var _0x3ceb92=util[_0x369d('0xb')](_0x369d('0x90'),_0xab8c70,_0x196a55,_0x23dcd9,_0x449fa9[_0x369d('0x3b')],_0x449fa9[_0x369d('0x91')]||null,NOW,NOW);if(_[_0x369d('0x1a')](_0x58347b[_0x369d('0x39')])){_0x3ceb92+=_0x369d('0x92');}_0x2030e1[_0x369d('0x1b')](_0x3ceb92);BPromise[_0x369d('0x93')](_0x2030e1,handleQuery)[_0x369d('0x22')](function(_0x1282c9){BPromise[_0x369d('0x1c')]([handleAdditionalPhones()])[_0x369d('0x22')](function(){_0x2030e1=[];for(var _0xa3e58e=0x0;_0xa3e58e\x20\x20');}var _0x12eb56=path['join'](config[_0x369d('0x6a')],_0x369d('0x6b'),process[_0x369d('0x9b')][0x2]);if(!fs[_0x369d('0x9c')](_0x12eb56)){throw new Error(_0x369d('0x9d'));}var _0x4a530d={};try{_0x4a530d=JSON[_0x369d('0x73')](process[_0x369d('0x9b')][0x3]);if(!_0x4a530d['binding']){throw new Error(_0x369d('0x9e'));}var _0x11370=0x0;if(_0x4a530d['binding'][_0x369d('0x3f')]){_0x11370=0x1;}if(!_0x4a530d[_0x369d('0x3b')]){throw new Error(_0x369d('0x9f'));}}catch(_0x30cd02){throw new Error(_0x369d('0xa0'));}var _0x22b122=[];try{_0x22b122=_['map'](JSON[_0x369d('0x73')](process[_0x369d('0x9b')][0x4]),'id');}catch(_0x19c244){logger[_0x369d('0x63')](_0x369d('0xa1'));}main(_0x12eb56,_0x4a530d,_0x22b122,_0x11370);}validate();process['on'](_0x369d('0xa2'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index c7d156f..d827987 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 _0x4d46=['***\x20Call\x20Info\x20***','keyValue','Caller\x20Name','calleridname','Call\x20To','Queue','queue','UniqueId','Date','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','agentcalledAt','Agent\x20Connect','agentcompleteAt','Hold\x20Time','holdtime','Called\x20Number','Member\x20Name','membername','uniqueid','starttime','Answer\x20Time','answertime','endtime','getSubjects','string','toLowerCase','inbound','push','calleridnum','outbound','Outbound\x20Call','variable','destcalleridnum'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x4d46,0x143));var _0x64d4=function(_0x27c156,_0x14ce9b){_0x27c156=_0x27c156-0x0;var _0x4a94af=_0x4d46[_0x27c156];return _0x4a94af;};'use strict';exports[_0x64d4('0x0')]=function(_0x2c7ba8,_0x20742a){var _0x3ebce0=[{'type':_0x64d4('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x2c7ba8[_0x64d4('0x2')]()){case'voice':switch(_0x20742a[_0x64d4('0x2')]()){case _0x64d4('0x3'):_0x3ebce0[_0x64d4('0x4')]({'type':'variable','content':'','variableName':'queue'});_0x3ebce0[_0x64d4('0x4')]({'type':'variable','content':'','variableName':_0x64d4('0x5')});break;case _0x64d4('0x6'):_0x3ebce0[_0x64d4('0x4')]({'type':_0x64d4('0x1'),'content':_0x64d4('0x7'),'variableName':null});_0x3ebce0[_0x64d4('0x4')]({'type':_0x64d4('0x8'),'content':'','variableName':_0x64d4('0x9')});break;}}return _0x3ebce0;};exports['getDescriptions']=function(_0x3b0c9e,_0x31231a){var _0x1f24df=[];switch(_0x3b0c9e[_0x64d4('0x2')]()){case'voice':switch(_0x31231a['toLowerCase']()){case _0x64d4('0x3'):_0x1f24df=[{'type':'string','content':_0x64d4('0xa'),'key':null,'keyType':null,'variableName':null},{'type':_0x64d4('0xb'),'content':'','key':'Caller\x20Number','keyType':_0x64d4('0x8'),'variableName':'calleridnum'},{'type':_0x64d4('0xb'),'content':'','key':_0x64d4('0xc'),'keyType':'variable','variableName':_0x64d4('0xd')},{'type':_0x64d4('0xb'),'content':'','key':_0x64d4('0xe'),'keyType':_0x64d4('0x8'),'variableName':'destexten'},{'type':_0x64d4('0xb'),'content':'','key':_0x64d4('0xf'),'keyType':'variable','variableName':_0x64d4('0x10')},{'type':_0x64d4('0xb'),'content':'','key':_0x64d4('0x11'),'keyType':'variable','variableName':'uniqueid'},{'type':'keyValue','content':'','key':_0x64d4('0x12'),'keyType':'variable','variableName':'agentcalledAt'},{'type':_0x64d4('0x1'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x64d4('0xb'),'content':'','key':_0x64d4('0x13'),'keyType':'variable','variableName':_0x64d4('0x14')},{'type':'keyValue','content':'','key':_0x64d4('0x15'),'keyType':_0x64d4('0x8'),'variableName':_0x64d4('0x9')},{'type':'string','content':_0x64d4('0x16'),'key':null,'keyType':null,'variableName':null},{'type':_0x64d4('0xb'),'content':'','key':_0x64d4('0x17'),'keyType':_0x64d4('0x8'),'variableName':_0x64d4('0x18')},{'type':_0x64d4('0xb'),'content':'','key':_0x64d4('0x19'),'keyType':_0x64d4('0x8'),'variableName':'agentconnectAt'},{'type':_0x64d4('0xb'),'content':'','key':'Agent\x20Complete','keyType':_0x64d4('0x8'),'variableName':_0x64d4('0x1a')},{'type':_0x64d4('0xb'),'content':'','key':_0x64d4('0x1b'),'keyType':_0x64d4('0x8'),'variableName':_0x64d4('0x1c')},{'type':_0x64d4('0xb'),'content':'','key':'Talk\x20Time','keyType':_0x64d4('0x8'),'variableName':'talktime'}];break;case _0x64d4('0x6'):_0x1f24df=[{'type':_0x64d4('0x1'),'content':_0x64d4('0xa'),'variableName':null},{'type':'keyValue','content':'','key':_0x64d4('0x1d'),'keyType':'variable','keyContent':'','variableName':_0x64d4('0x9')},{'type':_0x64d4('0xb'),'content':'','key':_0x64d4('0x1e'),'keyType':'variable','keyContent':'','variableName':_0x64d4('0x1f')},{'type':_0x64d4('0xb'),'content':'','key':_0x64d4('0x11'),'keyType':'variable','keyContent':'','variableName':_0x64d4('0x20')},{'type':_0x64d4('0xb'),'content':'','key':_0x64d4('0x12'),'keyType':_0x64d4('0x8'),'keyContent':'','variableName':_0x64d4('0x21')},{'type':_0x64d4('0x1'),'content':_0x64d4('0x16')},{'type':_0x64d4('0xb'),'content':'','key':_0x64d4('0x22'),'keyType':_0x64d4('0x8'),'keyContent':'','variableName':_0x64d4('0x23')},{'type':_0x64d4('0xb'),'content':'','key':'Complete\x20Time','keyType':_0x64d4('0x8'),'keyContent':'','variableName':_0x64d4('0x24')},{'type':_0x64d4('0xb'),'content':'','key':'Duration','keyType':'variable','keyContent':'','variableName':'duration'},{'type':'keyValue','content':'','key':'Billable\x20Time','keyType':_0x64d4('0x8'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x1f24df;}; \ No newline at end of file +var _0x9cdb=['queue','calleridnum','outbound','Outbound\x20Call','destcalleridnum','toLowerCase','***\x20Call\x20Info\x20***','Caller\x20Number','keyValue','calleridname','destexten','Queue','uniqueid','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','membername','Date','starttime','Answer\x20Time','Complete\x20Time','endtime','Duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','voice','inbound','push','variable'];(function(_0x21bab4,_0x346a08){var _0x1fdac4=function(_0x30ba54){while(--_0x30ba54){_0x21bab4['push'](_0x21bab4['shift']());}};_0x1fdac4(++_0x346a08);}(_0x9cdb,0xfb));var _0xb9cd=function(_0x4d9d19,_0x512dae){_0x4d9d19=_0x4d9d19-0x0;var _0x2695bb=_0x9cdb[_0x4d9d19];return _0x2695bb;};'use strict';exports[_0xb9cd('0x0')]=function(_0x49c4b8,_0x16c897){var _0x5746f0=[{'type':_0xb9cd('0x1'),'content':_0xb9cd('0x2'),'variableName':null}];switch(_0x49c4b8['toLowerCase']()){case _0xb9cd('0x3'):switch(_0x16c897['toLowerCase']()){case _0xb9cd('0x4'):_0x5746f0[_0xb9cd('0x5')]({'type':_0xb9cd('0x6'),'content':'','variableName':_0xb9cd('0x7')});_0x5746f0[_0xb9cd('0x5')]({'type':_0xb9cd('0x6'),'content':'','variableName':_0xb9cd('0x8')});break;case _0xb9cd('0x9'):_0x5746f0[_0xb9cd('0x5')]({'type':_0xb9cd('0x1'),'content':_0xb9cd('0xa'),'variableName':null});_0x5746f0[_0xb9cd('0x5')]({'type':_0xb9cd('0x6'),'content':'','variableName':_0xb9cd('0xb')});break;}}return _0x5746f0;};exports['getDescriptions']=function(_0x1011d4,_0x2289fb){var _0x46a4ed=[];switch(_0x1011d4[_0xb9cd('0xc')]()){case _0xb9cd('0x3'):switch(_0x2289fb['toLowerCase']()){case'inbound':_0x46a4ed=[{'type':'string','content':_0xb9cd('0xd'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xb9cd('0xe'),'keyType':_0xb9cd('0x6'),'variableName':_0xb9cd('0x8')},{'type':_0xb9cd('0xf'),'content':'','key':'Caller\x20Name','keyType':_0xb9cd('0x6'),'variableName':_0xb9cd('0x10')},{'type':_0xb9cd('0xf'),'content':'','key':'Call\x20To','keyType':_0xb9cd('0x6'),'variableName':_0xb9cd('0x11')},{'type':'keyValue','content':'','key':_0xb9cd('0x12'),'keyType':_0xb9cd('0x6'),'variableName':_0xb9cd('0x7')},{'type':_0xb9cd('0xf'),'content':'','key':'UniqueId','keyType':'variable','variableName':_0xb9cd('0x13')},{'type':_0xb9cd('0xf'),'content':'','key':'Date','keyType':_0xb9cd('0x6'),'variableName':_0xb9cd('0x14')},{'type':_0xb9cd('0x1'),'content':_0xb9cd('0x15'),'key':null,'keyType':null,'variableName':null},{'type':_0xb9cd('0xf'),'content':'','key':_0xb9cd('0x16'),'keyType':'variable','variableName':_0xb9cd('0x17')},{'type':_0xb9cd('0xf'),'content':'','key':'Agent\x20Number','keyType':_0xb9cd('0x6'),'variableName':_0xb9cd('0xb')},{'type':_0xb9cd('0x1'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xb9cd('0x18'),'keyType':'variable','variableName':_0xb9cd('0x14')},{'type':'keyValue','content':'','key':_0xb9cd('0x19'),'keyType':_0xb9cd('0x6'),'variableName':_0xb9cd('0x1a')},{'type':_0xb9cd('0xf'),'content':'','key':_0xb9cd('0x1b'),'keyType':_0xb9cd('0x6'),'variableName':'agentcompleteAt'},{'type':_0xb9cd('0xf'),'content':'','key':_0xb9cd('0x1c'),'keyType':_0xb9cd('0x6'),'variableName':_0xb9cd('0x1d')},{'type':_0xb9cd('0xf'),'content':'','key':_0xb9cd('0x1e'),'keyType':_0xb9cd('0x6'),'variableName':_0xb9cd('0x1f')}];break;case _0xb9cd('0x9'):_0x46a4ed=[{'type':'string','content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0xb9cd('0xf'),'content':'','key':_0xb9cd('0x20'),'keyType':_0xb9cd('0x6'),'keyContent':'','variableName':_0xb9cd('0xb')},{'type':'keyValue','content':'','key':_0xb9cd('0x21'),'keyType':_0xb9cd('0x6'),'keyContent':'','variableName':_0xb9cd('0x22')},{'type':'keyValue','content':'','key':'UniqueId','keyType':_0xb9cd('0x6'),'keyContent':'','variableName':_0xb9cd('0x13')},{'type':_0xb9cd('0xf'),'content':'','key':_0xb9cd('0x23'),'keyType':'variable','keyContent':'','variableName':_0xb9cd('0x24')},{'type':'string','content':'***\x20Time\x20Info\x20***'},{'type':_0xb9cd('0xf'),'content':'','key':_0xb9cd('0x25'),'keyType':_0xb9cd('0x6'),'keyContent':'','variableName':'answertime'},{'type':_0xb9cd('0xf'),'content':'','key':_0xb9cd('0x26'),'keyType':_0xb9cd('0x6'),'keyContent':'','variableName':_0xb9cd('0x27')},{'type':_0xb9cd('0xf'),'content':'','key':_0xb9cd('0x28'),'keyType':'variable','keyContent':'','variableName':'duration'},{'type':_0xb9cd('0xf'),'content':'','key':_0xb9cd('0x29'),'keyType':_0xb9cd('0x6'),'keyContent':'','variableName':_0xb9cd('0x2a')}];break;}}return _0x46a4ed;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 0671ddb..4ad2ffa 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 _0x3341=['clone','body','omit','html','phone','mobile','updateUser','findAll','skipInteractionsQuery','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','contact','fields','filter','having','read','tags','checkAccountsRestrictions','group','ids','tag','countFilteredInteractions','length','count','clause','order','contactName','DESC','getClosedOrderClause','getFilteredInteractions','rows','tracked','query'];(function(_0x53c7dd,_0x4bc807){var _0x2901ae=function(_0x54450d){while(--_0x54450d){_0x53c7dd['push'](_0x53c7dd['shift']());}};_0x2901ae(++_0x4bc807);}(_0x3341,0x1b7));var _0x1334=function(_0x1cedf2,_0x5cfde5){_0x1cedf2=_0x1cedf2-0x0;var _0x3dffa5=_0x3341[_0x1cedf2];return _0x3dffa5;};'use strict';var _=require('lodash');var sqlUtils=require('./sql-utils');var utils=require('./utils');exports[_0x1334('0x0')]=function(_0x2383b4,_0x36914b,_0x544795,_0xfc8e0a,_0x30eb04){var _0x2e4075={'count':0x0,'rows':[]};var _0xf863d3=sqlUtils[_0x1334('0x1')](_0x2383b4,_0x544795,_0x36914b);if(_0xf863d3){return Promise['resolve'](_0x2e4075);}var _0x260e24=sqlUtils['getInteractionsQuery'](_0x2383b4);var _0x5ec9e1={};return Promise['resolve']()[_0x1334('0x2')](function(){if(_0x36914b[_0x1334('0x3')]){return sqlUtils[_0x1334('0x4')](_0x36914b[_0x1334('0x3')],_0x30eb04);}else{return sqlUtils[_0x1334('0x5')](_0x2383b4,_0x36914b,_0x30eb04);}})[_0x1334('0x2')](function(_0x5145e0){_0x260e24[_0x1334('0x6')](_0x5145e0['body']);_0x260e24['where'](_0x5145e0[_0x1334('0x7')]);_0x260e24['where'](_0x5145e0['default']);_0x260e24[_0x1334('0x6')](_0x5145e0[_0x1334('0x8')]);_0x260e24['where'](_0x5145e0[_0x1334('0x9')]);_0x260e24[_0x1334('0x6')](_0x5145e0['user']);_0x260e24[_0x1334('0xa')](_0x5145e0[_0x1334('0xb')]);_0x5ec9e1=_0x5145e0[_0x1334('0xc')];return sqlUtils[_0x1334('0xd')](_0x2383b4,_0x544795,_0x36914b);})[_0x1334('0x2')](function(_0x831b04){_0x260e24['where'](_0x831b04);_0x260e24[_0x1334('0xe')]('i.id');var _0x4d4ed9=_0x36914b[_0x1334('0x3')]?_0x5ec9e1[_0x1334('0xf')]:_0x36914b[_0x1334('0x10')];return sqlUtils[_0x1334('0x11')](_0x260e24,_0x4d4ed9);})[_0x1334('0x2')](function(_0x4848b0){_0x2e4075['count']=_0x4848b0[_0x1334('0x12')];if(_0x2e4075[_0x1334('0x13')]===0x0){return[];}_0x260e24['having'](_0x5ec9e1[_0x1334('0x14')]);if(_0xfc8e0a[_0x1334('0x15')]){_0xfc8e0a[_0x1334('0x15')]['forEach'](function(_0x1e44fd){var _0x2bd257=_0x1e44fd[0x0]===_0x1334('0x16')?_0x1e44fd[0x0]:'i.'+_0x1e44fd[0x0];_0x260e24[_0x1334('0x15')](_0x2bd257,_0x1e44fd[0x1]===_0x1334('0x17')?![]:!![]);if(_0x1e44fd[0x0]==='closed'){var _0x3131a4=sqlUtils[_0x1334('0x18')](_0x2383b4,_0x36914b);_0x260e24[_0x1334('0x15')](_0x3131a4,_0x1e44fd[0x1]===_0x1334('0x17')?![]:!![]);}});}return sqlUtils[_0x1334('0x19')](_0x2383b4,_0x260e24,_0x36914b,_0xfc8e0a);})[_0x1334('0x2')](function(_0x517e16){_0x2e4075[_0x1334('0x1a')]=_0x517e16;return _0x2e4075;})['catch'](function(_0x16c457){throw _0x16c457;});};exports[_0x1334('0x1b')]=function(_0x1afcca,_0x2e80d3){return function(_0x2ae721,_0x5c248c,_0x3c01d8){var _0x2e0d93=_0x2ae721['user'];var _0x25b75d={};var _0x1862c5=_0x2ae721[_0x1334('0x1c')];if(_0x25b75d){_0x25b75d=_[_0x1334('0x1d')](_0x2ae721[_0x1334('0x1e')]);_0x25b75d=_[_0x1334('0x1f')](_0x25b75d,[_0x1334('0x1e'),_0x1334('0x20'),_0x1334('0x21'),'fax',_0x1334('0x22')]);}utils[_0x1334('0x23')](_0x2e0d93,_0x25b75d,_0x1862c5,_0x1afcca,_0x2e80d3);_0x3c01d8(null);};}; \ No newline at end of file +var _0x311a=['read','tags','checkAccountsRestrictions','group','i.id','ids','tag','countFilteredInteractions','length','count','having','clause','order','contactName','closed','DESC','getFilteredInteractions','rows','catch','tracked','user','clone','body','omit','html','phone','mobile','updateUser','lodash','./sql-utils','./utils','findAll','skipInteractionsQuery','getInteractionsQuery','then','search','parseAdvancedSearchFilter','where','contact','default','filter'];(function(_0x64e908,_0x371301){var _0x1938f1=function(_0x1d10d6){while(--_0x1d10d6){_0x64e908['push'](_0x64e908['shift']());}};_0x1938f1(++_0x371301);}(_0x311a,0x6e));var _0xa311=function(_0x410d5d,_0x2de4b6){_0x410d5d=_0x410d5d-0x0;var _0x41054b=_0x311a[_0x410d5d];return _0x41054b;};'use strict';var _=require(_0xa311('0x0'));var sqlUtils=require(_0xa311('0x1'));var utils=require(_0xa311('0x2'));exports[_0xa311('0x3')]=function(_0x5f56e1,_0x301326,_0x97a16a,_0x22cd68,_0x12d285){var _0x1ec4b9={'count':0x0,'rows':[]};var _0x5dd75f=sqlUtils[_0xa311('0x4')](_0x5f56e1,_0x97a16a,_0x301326);if(_0x5dd75f){return Promise['resolve'](_0x1ec4b9);}var _0x452197=sqlUtils[_0xa311('0x5')](_0x5f56e1);var _0x44d3f1={};return Promise['resolve']()[_0xa311('0x6')](function(){if(_0x301326[_0xa311('0x7')]){return sqlUtils[_0xa311('0x8')](_0x301326[_0xa311('0x7')],_0x12d285);}else{return sqlUtils['parseQueryParameters'](_0x5f56e1,_0x301326,_0x12d285);}})['then'](function(_0x343472){_0x452197[_0xa311('0x9')](_0x343472['body']);_0x452197[_0xa311('0x9')](_0x343472[_0xa311('0xa')]);_0x452197['where'](_0x343472[_0xa311('0xb')]);_0x452197[_0xa311('0x9')](_0x343472['fields']);_0x452197['where'](_0x343472[_0xa311('0xc')]);_0x452197['where'](_0x343472['user']);_0x452197['having'](_0x343472[_0xa311('0xd')]);_0x44d3f1=_0x343472[_0xa311('0xe')];return sqlUtils[_0xa311('0xf')](_0x5f56e1,_0x97a16a,_0x301326);})[_0xa311('0x6')](function(_0x2afb70){_0x452197[_0xa311('0x9')](_0x2afb70);_0x452197[_0xa311('0x10')](_0xa311('0x11'));var _0x431cad=_0x301326[_0xa311('0x7')]?_0x44d3f1[_0xa311('0x12')]:_0x301326[_0xa311('0x13')];return sqlUtils[_0xa311('0x14')](_0x452197,_0x431cad);})[_0xa311('0x6')](function(_0x4aac0a){_0x1ec4b9['count']=_0x4aac0a[_0xa311('0x15')];if(_0x1ec4b9[_0xa311('0x16')]===0x0){return[];}_0x452197[_0xa311('0x17')](_0x44d3f1[_0xa311('0x18')]);if(_0x22cd68['order']){_0x22cd68[_0xa311('0x19')]['forEach'](function(_0x5f14f3){var _0x35c24f=_0x5f14f3[0x0]===_0xa311('0x1a')?_0x5f14f3[0x0]:'i.'+_0x5f14f3[0x0];_0x452197[_0xa311('0x19')](_0x35c24f,_0x5f14f3[0x1]==='DESC'?![]:!![]);if(_0x5f14f3[0x0]===_0xa311('0x1b')){var _0x168c2d=sqlUtils['getClosedOrderClause'](_0x5f56e1,_0x301326);_0x452197[_0xa311('0x19')](_0x168c2d,_0x5f14f3[0x1]===_0xa311('0x1c')?![]:!![]);}});}return sqlUtils[_0xa311('0x1d')](_0x5f56e1,_0x452197,_0x301326,_0x22cd68);})[_0xa311('0x6')](function(_0x5f5675){_0x1ec4b9[_0xa311('0x1e')]=_0x5f5675;return _0x1ec4b9;})[_0xa311('0x1f')](function(_0x4dbddf){throw _0x4dbddf;});};exports[_0xa311('0x20')]=function(_0x257df0,_0x17cca1){return function(_0x45e60b,_0x210cfa,_0x614648){var _0x105326=_0x45e60b[_0xa311('0x21')];var _0x53f1d8={};var _0xbbffb8=_0x45e60b['query'];if(_0x53f1d8){_0x53f1d8=_[_0xa311('0x22')](_0x45e60b[_0xa311('0x23')]);_0x53f1d8=_[_0xa311('0x24')](_0x53f1d8,['body',_0xa311('0x25'),_0xa311('0x26'),'fax',_0xa311('0x27')]);}utils[_0xa311('0x28')](_0x105326,_0x53f1d8,_0xbbffb8,_0x257df0,_0x17cca1);_0x614648(null);};}; \ No newline at end of file diff --git a/server/components/interaction/sql-utils.js b/server/components/interaction/sql-utils.js index 2a1c6e0..027533b 100644 --- a/server/components/interaction/sql-utils.js +++ b/server/components/interaction/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb332=['chat','Websites','search','agent','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','closed','i.substatus','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','QueryTypes','query','toString','keyBy','merge','attributes','a.key','Account.key','Account.mandatoryDisposition','a.email','Account.email','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.ContactId','i.UserId','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','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.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Owner.fullname','Owner.internal','TagIds','limit','offset','groupBy','Setting','findOne','enableEmailPreview','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','isEmpty','where','SELECT','exports','lodash','../parsers/advancedSearch','../parsers/qs','updateInteraction','../../mysqldb','getAccountFK','role','select','field','name','color','tools_tags','getInteractionFK','user_has_','_interactions','u.fullname','from','users','u.id\x20=\x20ui.UserId','length','\x20IN\x20?','map','getInteractionsTables','interactions','left_join','cm_contacts','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','interactionsTags','it.','\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','fax','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','isEmail','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','type','text','value','start','end','unreadMessages','read','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','contact','Tag','split','clause','and','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','compact','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','resolve','then','fields','tag','filter','get','capitalize'];(function(_0x515a4f,_0x567d5d){var _0x256ae7=function(_0x2b627d){while(--_0x2b627d){_0x515a4f['push'](_0x515a4f['shift']());}};_0x256ae7(++_0x567d5d);}(_0xb332,0xd9));var _0x2b33=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xb332[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x2b33('0x0'));var squel=require('squel');var as=require(_0x2b33('0x1'));var qs=require(_0x2b33('0x2'));var updateInteraction=require('./update-interaction')[_0x2b33('0x3')];var utils=require('./utils');var db=require(_0x2b33('0x4'))['db'];function skipInteractionsQuery(_0x4c6634,_0x34b111,_0x5e5e86){var _0xf9b9c2=![];var _0x22d66=utils[_0x2b33('0x5')](_0x4c6634);if(_0x34b111[_0x2b33('0x6')]==='agent'&&!_0x5e5e86['search']&&!_0x5e5e86[_0x22d66]){_0xf9b9c2=!![];}return _0xf9b9c2;}function getTagsQuery(){return squel[_0x2b33('0x7')]()['field']('id')[_0x2b33('0x8')](_0x2b33('0x9'))[_0x2b33('0x8')](_0x2b33('0xa'))['from'](_0x2b33('0xb'));}function getUsersQuery(_0x1cefb1,_0x1be19d){var _0x1d83a6=utils[_0x2b33('0xc')](_0x1cefb1);var _0xf1e5e5=_0x2b33('0xd')+_0x1cefb1+_0x2b33('0xe');var _0x1e0d36=squel[_0x2b33('0x7')]()[_0x2b33('0x8')]('u.id')[_0x2b33('0x8')](_0x2b33('0xf'))[_0x2b33('0x8')]('ui.'+_0x1d83a6)[_0x2b33('0x10')](_0xf1e5e5,'ui')['left_join'](_0x2b33('0x11'),'u',_0x2b33('0x12'));if(_0x1be19d[_0x2b33('0x13')]>0x0){_0x1e0d36['where']('ui.'+_0x1d83a6+_0x2b33('0x14'),_[_0x2b33('0x15')](_0x1be19d,'id'));}return _0x1e0d36;}function getInteractionsQuery(_0x409428){var _0x2f5119=utils[_0x2b33('0x16')](_0x409428);var _0x4d69d0=utils['getAccountFK'](_0x409428);var _0x59f0b6=utils[_0x2b33('0xc')](_0x409428);return squel['select']()['from'](_0x2f5119[_0x2b33('0x17')],'i')[_0x2b33('0x18')](_0x2b33('0x19'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x2b33('0x18')]('users','o',_0x2b33('0x1a'))[_0x2b33('0x18')](_0x2f5119[_0x2b33('0x1b')],'a',_0x2b33('0x1c')+_0x4d69d0)[_0x2b33('0x18')](_0x2f5119[_0x2b33('0x1d')],'me',_0x2b33('0x1e')+_0x59f0b6+'\x20=\x20i.id')[_0x2b33('0x18')](_0x2f5119[_0x2b33('0x1f')],'it',_0x2b33('0x20')+_0x59f0b6+_0x2b33('0x21'))[_0x2b33('0x18')](_0x2b33('0xb'),'t',_0x2b33('0x22'));}function getSqlClauses(){var _0x2605e6={'body':squel['expr'](),'contact':squel[_0x2b33('0x23')](),'default':squel[_0x2b33('0x23')](),'fields':squel[_0x2b33('0x23')](),'filter':squel[_0x2b33('0x23')](),'read':squel['expr'](),'tags':{'clause':squel[_0x2b33('0x23')](),'ids':null},'user':squel['expr']()};return _0x2605e6;}function parseTagParameter(_0x373e27){var _0x483cf4=squel[_0x2b33('0x23')]();if(_0x373e27){var _0x341e0e=utils['getSelectedTags'](_0x373e27);_0x341e0e[_0x2b33('0x24')](function(_0x53c2ad){_0x483cf4['or'](_0x2b33('0x25'),'%,'+_0x53c2ad+',%');});}return _0x483cf4;}function parseReadParameter(_0x5b16a8){var _0x315ebd='';if(_0x5b16a8){_0x315ebd=_0x2b33('0x26');if(_0x5b16a8==='1'){_0x315ebd=_0x315ebd[_0x2b33('0x27')](_0x2b33('0x28'),'=');}else{_0x315ebd=_0x315ebd[_0x2b33('0x27')](_0x2b33('0x28'),'>');}}return _0x315ebd;}function parseSearchFilter(_0x2be034,_0x1fadc5){var _0x316188=squel[_0x2b33('0x23')]();if(_0x1fadc5){var _0x4cf72f=_0x1fadc5['replace']('\x5c','\x5c\x5c')[_0x2b33('0x27')](/'/g,'\x27\x27');if(qs[_0x2b33('0x29')](_0x4cf72f)){_0x316188['or'](_0x2b33('0x2a'),_0x4cf72f+'%');if([_0x2b33('0x2b'),_0x2b33('0x2c')]['includes'](_0x2be034)){_0x316188['or']('i.phone\x20LIKE\x20?',_0x4cf72f+'%');}else if(_0x2be034===_0x2b33('0x2d')){_0x316188['or'](_0x2b33('0x2e'),_0x4cf72f+'%');}else if(_0x2be034===_0x2b33('0x2f')){_0x316188['or'](_0x2b33('0x30'),_0x4cf72f+'%');}}else if(_0x2be034===_0x2b33('0x31')&&qs[_0x2b33('0x32')](_0x4cf72f)){_0x316188['or']('c.email\x20LIKE\x20?',_0x4cf72f+'%');}else{if(_0x2be034===_0x2b33('0x31')){_0x316188['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x2b33('0x33')](_0x4cf72f))['or'](_0x2b33('0x34'),qs[_0x2b33('0x33')](_0x4cf72f));}else{if(_0x2be034!==_0x2b33('0x2d')){_0x316188['or'](_0x2b33('0x35'),qs[_0x2b33('0x33')](_0x4cf72f));}_0x316188['or'](_0x2b33('0x36'),_0x4cf72f+'%');}}}return _0x316188;}function parseAdvancedSearchFilter(_0x84e1cd,_0x1de983){var _0x2b9af8=getSqlClauses();var _0x782a64=as[_0x2b33('0x37')](_0x84e1cd);var _0xe415f4=_0x782a64[_0x2b33('0x38')];for(var _0xb06e25=0x0;_0xb06e25<_0x782a64[_0x2b33('0x39')]['length'];_0xb06e25++){var _0x52a229=_0x782a64['conditions'][_0xb06e25];var _0xdeda9c='i';var _0xcaf635=_[_0x2b33('0x3a')](_0x1de983,[_0x2b33('0x9'),_0x52a229[_0x2b33('0x8')]]);if(_0xcaf635){var _0x51a5d3=as['buildExpression'](_0xdeda9c,_0xcaf635[_0x2b33('0x3b')],_0x52a229);_0x2b9af8['default'][_0xe415f4](_0x51a5d3[_0x2b33('0x3c')],_0x51a5d3[_0x2b33('0x3d')][_0x2b33('0x3e')],_0x51a5d3[_0x2b33('0x3d')][_0x2b33('0x3f')]);}else{switch(_0x52a229[_0x2b33('0x8')]){case _0x2b33('0x40'):var _0x2594fd=parseReadParameter(_0x52a229[_0x2b33('0x3d')]);_0x2b9af8[_0x2b33('0x41')]['and'](_0x2594fd);break;case _0x2b33('0x42'):if(_0x52a229[_0x2b33('0x43')]===_0x2b33('0x44')){if(_0x52a229['value']['split']('\x20')[_0x2b33('0x13')]>0x1){_0x2b9af8['contact'][_0xe415f4](_0x2b33('0x45'),qs[_0x2b33('0x33')](_0x52a229['value']),null);}else{var _0x10147a='%'+_0x52a229[_0x2b33('0x3d')]+'%';_0x2b9af8['contact'][_0xe415f4](_0x2b33('0x46'),_0x10147a,_0x10147a,_0x10147a);}}else{_0xcaf635=_[_0x2b33('0x3a')](_0x1de983,['name',_0x2b33('0x47')]);_0x52a229[_0x2b33('0x8')]=_0x2b33('0x47');_0x51a5d3=as['buildExpression'](_0xdeda9c,_0xcaf635[_0x2b33('0x3b')],_0x52a229);_0x2b9af8[_0x2b33('0x48')][_0xe415f4](_0x51a5d3[_0x2b33('0x3c')],_0x51a5d3[_0x2b33('0x3d')][_0x2b33('0x3e')],_0x51a5d3['value'][_0x2b33('0x3f')]);}break;case _0x2b33('0x49'):var _0x208f3e=_0x52a229['value'][_0x2b33('0x4a')](',')[_0x2b33('0x15')](function(_0x3c61d6){return Number(_0x3c61d6);});var _0xac1dad=parseTagParameter(_0x208f3e);_0x2b9af8['tags'][_0x2b33('0x4b')][_0x2b33('0x4c')](_0xac1dad);_0x2b9af8['tags']['ids']=_0x208f3e;break;case'User':if(_0x52a229[_0x2b33('0x43')]==='$substring'){_0x2b9af8[_0x2b33('0x4d')][_0xe415f4](_0x2b33('0x4e'),'%'+_0x52a229[_0x2b33('0x3d')]+'%',null);}else{_0xcaf635=_[_0x2b33('0x3a')](_0x1de983,[_0x2b33('0x9'),_0x2b33('0x4f')]);_0x52a229[_0x2b33('0x8')]=_0x2b33('0x4f');_0x51a5d3=as['buildExpression'](_0xdeda9c,_0xcaf635[_0x2b33('0x3b')],_0x52a229);_0x2b9af8[_0x2b33('0x4d')][_0xe415f4](_0x51a5d3[_0x2b33('0x3c')],_0x51a5d3[_0x2b33('0x3d')][_0x2b33('0x3e')],_0x51a5d3[_0x2b33('0x3d')]['end']);}break;case'body':case'plainBody':_0x51a5d3=as['buildExpression']('me',null,_0x52a229);_0x2b9af8[_0x2b33('0x50')][_0xe415f4](_0x51a5d3['text'],_0x51a5d3[_0x2b33('0x3d')]['start'],_0x51a5d3['value'][_0x2b33('0x3f')]);break;}}}return _0x2b9af8;}function parseModelFields(_0xd15da9,_0x357724,_0x5beb49){var _0xa8f425=utils['getAccountFK'](_0xd15da9);var _0x176351=squel[_0x2b33('0x23')]();var _0x2a20a4=_(_0x357724)[_0x2b33('0x51')]()[_0x2b33('0x15')](function(_0x1c9381){return _['some'](_0x5beb49,[_0x2b33('0x9'),_0x1c9381])?_0x1c9381:undefined;})[_0x2b33('0x52')]()[_0x2b33('0x3d')]();if(_0x2a20a4['length']>0x0){_0x2a20a4[_0x2b33('0x24')](function(_0x2084a4){if(_0x2084a4===_0xa8f425){_0x176351[_0x2b33('0x4c')]('i.'+_0xa8f425+'\x20IN\x20?',[][_0x2b33('0x53')](_0x357724[_0x2084a4]));}else if(_0x2084a4==='createdAt'){var _0x5efc74=JSON[_0x2b33('0x54')](_0x357724[_0x2084a4])[_0x2b33('0x55')];var _0x24dc4c=JSON[_0x2b33('0x54')](_0x357724[_0x2084a4])[_0x2b33('0x56')];_0x176351[_0x2b33('0x4c')](_0x2b33('0x57'),_0x5efc74,_0x24dc4c);}else{if(_0x357724[_0x2084a4]===_0x2b33('0x58')){_0x176351['and']('i.'+_0x2084a4+_0x2b33('0x59'));}else{_0x176351[_0x2b33('0x4c')]('i.'+_0x2084a4+'\x20=\x20?',_0x357724[_0x2084a4]);}}});}return _0x176351;}function parseQueryParameters(_0x28e75b,_0x45a939,_0x5284d8){var _0x97cd7=getSqlClauses();return Promise[_0x2b33('0x5a')]()[_0x2b33('0x5b')](function(){return parseModelFields(_0x28e75b,_0x45a939,_0x5284d8);})[_0x2b33('0x5b')](function(_0x5892fe){_0x97cd7[_0x2b33('0x5c')][_0x2b33('0x4c')](_0x5892fe);return parseReadParameter(_0x45a939['read']);})[_0x2b33('0x5b')](function(_0x162d13){_0x97cd7[_0x2b33('0x41')][_0x2b33('0x4c')](_0x162d13);return parseTagParameter(_0x45a939[_0x2b33('0x5d')]);})[_0x2b33('0x5b')](function(_0x1bbb5f){_0x97cd7['tags']['clause'][_0x2b33('0x4c')](_0x1bbb5f);return parseSearchFilter(_0x28e75b,_0x45a939[_0x2b33('0x5e')]);})['then'](function(_0x3ba2c6){_0x97cd7[_0x2b33('0x5e')]=_0x3ba2c6;return _0x97cd7;});}function checkAccountsRestrictions(_0x2b4d10,_0x4e3777,_0x185c3e){var _0x134c48=utils[_0x2b33('0x5')](_0x2b4d10);var _0x1af9a3=_0x2b33('0x5f')+_[_0x2b33('0x60')](_0x2b4d10)+(_0x2b4d10===_0x2b33('0x61')?_0x2b33('0x62'):'Accounts');var _0x59e470=squel[_0x2b33('0x23')]();return Promise[_0x2b33('0x5a')]()[_0x2b33('0x5b')](function(){if(_0x185c3e[_0x2b33('0x63')]&&_0x4e3777[_0x2b33('0x6')]===_0x2b33('0x64')){return _0x4e3777[_0x1af9a3]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x2a46fa){if(_0x2a46fa){if(_0x2a46fa[_0x2b33('0x13')]===0x0){_0x59e470[_0x2b33('0x4c')]('i.'+_0x134c48+_0x2b33('0x59'));}else{_0x59e470[_0x2b33('0x4c')]('i.'+_0x134c48+_0x2b33('0x14'),_['map'](_0x2a46fa,'id'));}}else if(!_0x185c3e[_0x134c48]){_0x59e470[_0x2b33('0x4c')]('i.'+_0x134c48+_0x2b33('0x65'));}})[_0x2b33('0x5b')](function(){return _0x59e470;});}function getClosedOrderClause(_0x28e2fe,_0x3f652a){var _0x5c8246='';var _0xd3dc0d=[_0x2b33('0x66'),_0x2b33('0x67'),_0x2b33('0x68')];if(_0x28e2fe==='mail'){_0xd3dc0d[_0x2b33('0x69')]('i.substatus');}if(_0x3f652a[_0x2b33('0x6a')]==='0'&&_0x28e2fe===_0x2b33('0x31')){_0x5c8246=_0x2b33('0x6b');}else{if(_0x3f652a[_0x2b33('0x6a')]==='1'){_0xd3dc0d[_0x2b33('0x6c')]();}_0x5c8246=_0x2b33('0x6d')+_0xd3dc0d[_0x2b33('0x6e')](',\x20')+')';}return _0x5c8246;}function getFilteredInteractions(_0x472db3,_0x4d7cce,_0x28d60b,_0x22d518){var _0x42fddc=utils[_0x2b33('0xc')](_0x472db3);var _0x311c62=_[_0x2b33('0x60')](_0x472db3)+_0x2b33('0x6f');var _0x3305c5=[];var _0x25fe14=getTagsQuery();var _0x2474d3={'type':db[_0x2b33('0x70')][_0x2b33('0x71')]['SELECT'],'raw':!![]};var _0x452cca=[];var _0x4db872=[];return db['sequelize'][_0x2b33('0x72')](_0x25fe14[_0x2b33('0x73')](),_0x2474d3)[_0x2b33('0x5b')](function(_0x5e4982){_0x3305c5=_[_0x2b33('0x74')](_0x5e4982,'id');_0x2474d3=_[_0x2b33('0x75')](_0x2474d3,{'model':db[_0x311c62],'mapToModel':!![],'nest':!![]});if(_0x28d60b[_0x2b33('0x5c')]){_0x22d518[_0x2b33('0x76')]['forEach'](function(_0x5c849f){_0x4d7cce['field']('i.'+_0x5c849f);});}else{_0x4d7cce['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x4d7cce['field'](_0x2b33('0x77'),_0x2b33('0x78'));_0x4d7cce[_0x2b33('0x8')]('a.mandatoryDisposition',_0x2b33('0x79'));if(_0x472db3===_0x2b33('0x31')){_0x4d7cce[_0x2b33('0x8')](_0x2b33('0x7a'),_0x2b33('0x7b'));_0x4d7cce[_0x2b33('0x8')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x4d7cce['field']('i.id');_0x4d7cce['field']('i.createdAt');_0x4d7cce[_0x2b33('0x8')](_0x2b33('0x7c'));_0x4d7cce['field'](_0x2b33('0x7d'));_0x4d7cce[_0x2b33('0x8')](_0x2b33('0x7e'));_0x4d7cce[_0x2b33('0x8')](_0x2b33('0x7f'));_0x4d7cce[_0x2b33('0x8')](_0x2b33('0x80'));_0x4d7cce['field']('i.lastMsgDirection');_0x4d7cce[_0x2b33('0x8')](_0x2b33('0x81'));_0x4d7cce[_0x2b33('0x8')](_0x2b33('0x68'));_0x4d7cce[_0x2b33('0x8')]('i.secondDisposition');_0x4d7cce['field']('i.thirdDisposition');_0x4d7cce[_0x2b33('0x8')](_0x2b33('0x6b'));_0x4d7cce[_0x2b33('0x8')]('i.to');_0x4d7cce['field'](_0x2b33('0x82'));_0x4d7cce[_0x2b33('0x8')]('i.MailAccountId');_0x4d7cce[_0x2b33('0x8')](_0x2b33('0x83'));}else if(_0x472db3===_0x2b33('0x2f')){_0x4d7cce['field'](_0x2b33('0x84'),_0x2b33('0x85'));}else{_0x4d7cce[_0x2b33('0x8')](_0x2b33('0x86'),'contactName');}if(_0x472db3!==_0x2b33('0x31')){_0x4d7cce['field'](_0x2b33('0x87'));}_0x4d7cce[_0x2b33('0x8')](_0x2b33('0x88'),_0x2b33('0x89'));_0x4d7cce[_0x2b33('0x8')]('c.lastName','Contact.lastName');_0x4d7cce[_0x2b33('0x8')]('c.email','Contact.email');_0x4d7cce[_0x2b33('0x8')](_0x2b33('0x8a'),_0x2b33('0x8b'));_0x4d7cce[_0x2b33('0x8')](_0x2b33('0x8c'),_0x2b33('0x8d'));_0x4d7cce[_0x2b33('0x8')](_0x2b33('0x8e'),'Contact.fax');_0x4d7cce['field']('o.fullname',_0x2b33('0x8f'));_0x4d7cce[_0x2b33('0x8')]('o.internal',_0x2b33('0x90'));_0x4d7cce[_0x2b33('0x8')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x2b33('0x91'));}if(_0x22d518['limit']){_0x4d7cce[_0x2b33('0x92')](_0x22d518[_0x2b33('0x92')]);}if(_0x22d518['offset']){_0x4d7cce[_0x2b33('0x93')](_0x22d518[_0x2b33('0x93')]);}return db['sequelize'][_0x2b33('0x72')](_0x4d7cce['toString'](),_0x2474d3);})[_0x2b33('0x5b')](function(_0x5bfe3f){_0x452cca=_0x5bfe3f;var _0x5d9176=getUsersQuery(_0x472db3,_0x452cca);return db['sequelize'][_0x2b33('0x72')](_0x5d9176['toString'](),_0x2474d3);})[_0x2b33('0x5b')](function(_0xdd6652){_0x4db872=_[_0x2b33('0x94')](_0xdd6652,_0x42fddc);if(_0x472db3===_0x2b33('0x31')){return db[_0x2b33('0x95')][_0x2b33('0x96')]({'attributes':[_0x2b33('0x97')],'raw':!![]});}})[_0x2b33('0x5b')](function(_0x209598){var _0x40e87f=_0x209598?_0x209598[_0x2b33('0x97')]:undefined;var _0x5869bb=_0x452cca[_0x2b33('0x15')](function(_0x43b90b){return updateInteraction(_0x43b90b,_0x3305c5,_0x4db872,_0x40e87f);});return Promise['all'](_0x5869bb);});}function countFilteredInteractions(_0x20537f,_0x589725){var _0x3db614=_0x20537f['clone']();_0x3db614[_0x2b33('0x8')]('COUNT(*)');_0x3db614[_0x2b33('0x8')](_0x2b33('0x98'),_0x2b33('0x40'));var _0x2faec7=utils['getSelectedTags'](_0x589725);if(!_[_0x2b33('0x99')](_0x2faec7)){_0x3db614[_0x2b33('0x9a')]('t.id\x20IN\x20?',_0x2faec7);}var _0x924b18={'type':db[_0x2b33('0x70')][_0x2b33('0x71')][_0x2b33('0x9b')],'raw':!![]};return db['sequelize'][_0x2b33('0x72')](_0x3db614[_0x2b33('0x73')](),_0x924b18);}module[_0x2b33('0x9c')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x0c5d=['conditions','find','buildExpression','default','text','start','value','unreadMessages','read','and','Contact','operator','$substring','split','contact','ContactId','type','end','map','ids','user','UserId','body','plainBody','some','compact','concat','createdAt','parse','$gte','$lte','null','resolve','then','fields','tag','filter','get','capitalize','Websites','Accounts','\x20IS\x20NULL','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','QueryTypes','SELECT','sequelize','query','keyBy','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.ContactId','i.MailAccountId','i.UserId','openchannel','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','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','toString','groupBy','Setting','findOne','enableEmailPreview','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','Sequelize','exports','lodash','squel','../parsers/qs','updateInteraction','./utils','../../mysqldb','role','select','name','field','from','tools_tags','getInteractionFK','user_has_','_interactions','u.id','u.fullname','ui.','left_join','users','length','where','\x20IN\x20?','getInteractionsTables','getAccountFK','interactions','cm_contacts','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','it.','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','{OPERATOR}','replace','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.phone\x20LIKE\x20?','fax','i.from\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','mail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','parseSearch','sqlOperator'];(function(_0x1152e5,_0x5a8eaf){var _0xd1fcdb=function(_0xabaa2b){while(--_0xabaa2b){_0x1152e5['push'](_0x1152e5['shift']());}};_0xd1fcdb(++_0x5a8eaf);}(_0x0c5d,0x6c));var _0xd0c5=function(_0x1b1b33,_0x5b8e3f){_0x1b1b33=_0x1b1b33-0x0;var _0x1bedd4=_0x0c5d[_0x1b1b33];return _0x1bedd4;};'use strict';var _=require(_0xd0c5('0x0'));var squel=require(_0xd0c5('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0xd0c5('0x2'));var updateInteraction=require('./update-interaction')[_0xd0c5('0x3')];var utils=require(_0xd0c5('0x4'));var db=require(_0xd0c5('0x5'))['db'];function skipInteractionsQuery(_0x177811,_0x4664bc,_0xc3a9b9){var _0x166636=![];var _0x121911=utils['getAccountFK'](_0x177811);if(_0x4664bc[_0xd0c5('0x6')]==='agent'&&!_0xc3a9b9['search']&&!_0xc3a9b9[_0x121911]){_0x166636=!![];}return _0x166636;}function getTagsQuery(){return squel[_0xd0c5('0x7')]()['field']('id')['field'](_0xd0c5('0x8'))[_0xd0c5('0x9')]('color')[_0xd0c5('0xa')](_0xd0c5('0xb'));}function getUsersQuery(_0x5ae844,_0x458d02){var _0x410037=utils[_0xd0c5('0xc')](_0x5ae844);var _0x30ea26=_0xd0c5('0xd')+_0x5ae844+_0xd0c5('0xe');var _0x1310cf=squel[_0xd0c5('0x7')]()[_0xd0c5('0x9')](_0xd0c5('0xf'))[_0xd0c5('0x9')](_0xd0c5('0x10'))['field'](_0xd0c5('0x11')+_0x410037)[_0xd0c5('0xa')](_0x30ea26,'ui')[_0xd0c5('0x12')](_0xd0c5('0x13'),'u','u.id\x20=\x20ui.UserId');if(_0x458d02[_0xd0c5('0x14')]>0x0){_0x1310cf[_0xd0c5('0x15')](_0xd0c5('0x11')+_0x410037+_0xd0c5('0x16'),_['map'](_0x458d02,'id'));}return _0x1310cf;}function getInteractionsQuery(_0x2be13d){var _0x5809ba=utils[_0xd0c5('0x17')](_0x2be13d);var _0x57c76a=utils[_0xd0c5('0x18')](_0x2be13d);var _0x692aeb=utils[_0xd0c5('0xc')](_0x2be13d);return squel[_0xd0c5('0x7')]()[_0xd0c5('0xa')](_0x5809ba[_0xd0c5('0x19')],'i')[_0xd0c5('0x12')](_0xd0c5('0x1a'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xd0c5('0x12')](_0xd0c5('0x13'),'o','o.id\x20=\x20i.UserId')[_0xd0c5('0x12')](_0x5809ba[_0xd0c5('0x1b')],'a',_0xd0c5('0x1c')+_0x57c76a)[_0xd0c5('0x12')](_0x5809ba[_0xd0c5('0x1d')],'me',_0xd0c5('0x1e')+_0x692aeb+_0xd0c5('0x1f'))['left_join'](_0x5809ba['interactionsTags'],'it',_0xd0c5('0x20')+_0x692aeb+_0xd0c5('0x1f'))[_0xd0c5('0x12')](_0xd0c5('0xb'),'t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x185e33={'body':squel['expr'](),'contact':squel['expr'](),'default':squel[_0xd0c5('0x21')](),'fields':squel[_0xd0c5('0x21')](),'filter':squel[_0xd0c5('0x21')](),'read':squel[_0xd0c5('0x21')](),'tags':{'clause':squel[_0xd0c5('0x21')](),'ids':null},'user':squel[_0xd0c5('0x21')]()};return _0x185e33;}function parseTagParameter(_0xbcef61){var _0x17443b=squel[_0xd0c5('0x21')]();if(_0xbcef61){var _0x198e39=utils[_0xd0c5('0x22')](_0xbcef61);_0x198e39[_0xd0c5('0x23')](function(_0x3502fe){_0x17443b['or'](_0xd0c5('0x24'),'%,'+_0x3502fe+',%');});}return _0x17443b;}function parseReadParameter(_0x1df662){var _0x2869a3='';if(_0x1df662){_0x2869a3=_0xd0c5('0x25');if(_0x1df662==='1'){_0x2869a3=_0x2869a3['replace'](_0xd0c5('0x26'),'=');}else{_0x2869a3=_0x2869a3[_0xd0c5('0x27')](_0xd0c5('0x26'),'>');}}return _0x2869a3;}function parseSearchFilter(_0x21ed42,_0xa2afc1){var _0xcca299=squel[_0xd0c5('0x21')]();if(_0xa2afc1){var _0x571410=_0xa2afc1[_0xd0c5('0x27')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xd0c5('0x28')](_0x571410)){_0xcca299['or'](_0xd0c5('0x29'),_0x571410+'%');if([_0xd0c5('0x2a'),_0xd0c5('0x2b')][_0xd0c5('0x2c')](_0x21ed42)){_0xcca299['or'](_0xd0c5('0x2d'),_0x571410+'%');}else if(_0x21ed42===_0xd0c5('0x2e')){_0xcca299['or']('i.fax\x20LIKE\x20?',_0x571410+'%');}else if(_0x21ed42==='openchannel'){_0xcca299['or'](_0xd0c5('0x2f'),_0x571410+'%');}}else if(_0x21ed42==='mail'&&qs[_0xd0c5('0x30')](_0x571410)){_0xcca299['or'](_0xd0c5('0x31'),_0x571410+'%');}else{if(_0x21ed42===_0xd0c5('0x32')){_0xcca299['or'](_0xd0c5('0x33'),qs['getFullTextValue'](_0x571410))['or'](_0xd0c5('0x34'),qs[_0xd0c5('0x35')](_0x571410));}else{if(_0x21ed42!=='fax'){_0xcca299['or'](_0xd0c5('0x36'),qs['getFullTextValue'](_0x571410));}_0xcca299['or'](_0xd0c5('0x37'),_0x571410+'%');}}}return _0xcca299;}function parseAdvancedSearchFilter(_0x2bddff,_0x44b67a){var _0x511f5c=getSqlClauses();var _0x2fda97=as[_0xd0c5('0x38')](_0x2bddff);var _0x2e8f04=_0x2fda97[_0xd0c5('0x39')];for(var _0x432d57=0x0;_0x432d57<_0x2fda97[_0xd0c5('0x3a')][_0xd0c5('0x14')];_0x432d57++){var _0x323fb3=_0x2fda97[_0xd0c5('0x3a')][_0x432d57];var _0x54042='i';var _0x14c397=_[_0xd0c5('0x3b')](_0x44b67a,[_0xd0c5('0x8'),_0x323fb3['field']]);if(_0x14c397){var _0x4e3d0e=as[_0xd0c5('0x3c')](_0x54042,_0x14c397['type'],_0x323fb3);_0x511f5c[_0xd0c5('0x3d')][_0x2e8f04](_0x4e3d0e[_0xd0c5('0x3e')],_0x4e3d0e['value'][_0xd0c5('0x3f')],_0x4e3d0e[_0xd0c5('0x40')]['end']);}else{switch(_0x323fb3[_0xd0c5('0x9')]){case _0xd0c5('0x41'):var _0x831e0b=parseReadParameter(_0x323fb3[_0xd0c5('0x40')]);_0x511f5c[_0xd0c5('0x42')][_0xd0c5('0x43')](_0x831e0b);break;case _0xd0c5('0x44'):if(_0x323fb3[_0xd0c5('0x45')]===_0xd0c5('0x46')){if(_0x323fb3[_0xd0c5('0x40')][_0xd0c5('0x47')]('\x20')[_0xd0c5('0x14')]>0x1){_0x511f5c[_0xd0c5('0x48')][_0x2e8f04]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xd0c5('0x35')](_0x323fb3[_0xd0c5('0x40')]),null);}else{var _0x215048='%'+_0x323fb3[_0xd0c5('0x40')]+'%';_0x511f5c[_0xd0c5('0x48')][_0x2e8f04]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x215048,_0x215048,_0x215048);}}else{_0x14c397=_['find'](_0x44b67a,[_0xd0c5('0x8'),_0xd0c5('0x49')]);_0x323fb3[_0xd0c5('0x9')]=_0xd0c5('0x49');_0x4e3d0e=as['buildExpression'](_0x54042,_0x14c397[_0xd0c5('0x4a')],_0x323fb3);_0x511f5c[_0xd0c5('0x48')][_0x2e8f04](_0x4e3d0e[_0xd0c5('0x3e')],_0x4e3d0e[_0xd0c5('0x40')][_0xd0c5('0x3f')],_0x4e3d0e[_0xd0c5('0x40')][_0xd0c5('0x4b')]);}break;case'Tag':var _0x36ae03=_0x323fb3[_0xd0c5('0x40')]['split'](',')[_0xd0c5('0x4c')](function(_0x2634f3){return Number(_0x2634f3);});var _0x17ab06=parseTagParameter(_0x36ae03);_0x511f5c['tags']['clause']['and'](_0x17ab06);_0x511f5c['tags'][_0xd0c5('0x4d')]=_0x36ae03;break;case'User':if(_0x323fb3[_0xd0c5('0x45')]==='$substring'){_0x511f5c[_0xd0c5('0x4e')][_0x2e8f04]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x323fb3[_0xd0c5('0x40')]+'%',null);}else{_0x14c397=_[_0xd0c5('0x3b')](_0x44b67a,[_0xd0c5('0x8'),_0xd0c5('0x4f')]);_0x323fb3[_0xd0c5('0x9')]='UserId';_0x4e3d0e=as[_0xd0c5('0x3c')](_0x54042,_0x14c397[_0xd0c5('0x4a')],_0x323fb3);_0x511f5c[_0xd0c5('0x4e')][_0x2e8f04](_0x4e3d0e[_0xd0c5('0x3e')],_0x4e3d0e[_0xd0c5('0x40')][_0xd0c5('0x3f')],_0x4e3d0e['value'][_0xd0c5('0x4b')]);}break;case _0xd0c5('0x50'):case _0xd0c5('0x51'):_0x4e3d0e=as[_0xd0c5('0x3c')]('me',null,_0x323fb3);_0x511f5c['body'][_0x2e8f04](_0x4e3d0e[_0xd0c5('0x3e')],_0x4e3d0e[_0xd0c5('0x40')][_0xd0c5('0x3f')],_0x4e3d0e[_0xd0c5('0x40')][_0xd0c5('0x4b')]);break;}}}return _0x511f5c;}function parseModelFields(_0x43d0ad,_0x17d71c,_0x269d63){var _0x393094=utils[_0xd0c5('0x18')](_0x43d0ad);var _0x26fe06=squel[_0xd0c5('0x21')]();var _0x592ff6=_(_0x17d71c)['keys']()[_0xd0c5('0x4c')](function(_0x1dd3aa){return _[_0xd0c5('0x52')](_0x269d63,[_0xd0c5('0x8'),_0x1dd3aa])?_0x1dd3aa:undefined;})[_0xd0c5('0x53')]()[_0xd0c5('0x40')]();if(_0x592ff6['length']>0x0){_0x592ff6[_0xd0c5('0x23')](function(_0x2c2485){if(_0x2c2485===_0x393094){_0x26fe06[_0xd0c5('0x43')]('i.'+_0x393094+_0xd0c5('0x16'),[][_0xd0c5('0x54')](_0x17d71c[_0x2c2485]));}else if(_0x2c2485===_0xd0c5('0x55')){var _0x3441eb=JSON[_0xd0c5('0x56')](_0x17d71c[_0x2c2485])[_0xd0c5('0x57')];var _0x278962=JSON[_0xd0c5('0x56')](_0x17d71c[_0x2c2485])[_0xd0c5('0x58')];_0x26fe06[_0xd0c5('0x43')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3441eb,_0x278962);}else{if(_0x17d71c[_0x2c2485]===_0xd0c5('0x59')){_0x26fe06[_0xd0c5('0x43')]('i.'+_0x2c2485+'\x20IS\x20NULL');}else{_0x26fe06[_0xd0c5('0x43')]('i.'+_0x2c2485+'\x20=\x20?',_0x17d71c[_0x2c2485]);}}});}return _0x26fe06;}function parseQueryParameters(_0x588347,_0x34c5c5,_0x5ff7d5){var _0x3b2ee8=getSqlClauses();return Promise[_0xd0c5('0x5a')]()[_0xd0c5('0x5b')](function(){return parseModelFields(_0x588347,_0x34c5c5,_0x5ff7d5);})[_0xd0c5('0x5b')](function(_0x23fcd6){_0x3b2ee8[_0xd0c5('0x5c')][_0xd0c5('0x43')](_0x23fcd6);return parseReadParameter(_0x34c5c5[_0xd0c5('0x42')]);})[_0xd0c5('0x5b')](function(_0x476ed3){_0x3b2ee8[_0xd0c5('0x42')][_0xd0c5('0x43')](_0x476ed3);return parseTagParameter(_0x34c5c5[_0xd0c5('0x5d')]);})[_0xd0c5('0x5b')](function(_0x1df7ae){_0x3b2ee8['tags']['clause'][_0xd0c5('0x43')](_0x1df7ae);return parseSearchFilter(_0x588347,_0x34c5c5[_0xd0c5('0x5e')]);})['then'](function(_0x5c3b61){_0x3b2ee8[_0xd0c5('0x5e')]=_0x5c3b61;return _0x3b2ee8;});}function checkAccountsRestrictions(_0x245038,_0x3a5bf9,_0x164646){var _0x268fb0=utils[_0xd0c5('0x18')](_0x245038);var _0x19db83=_0xd0c5('0x5f')+_[_0xd0c5('0x60')](_0x245038)+(_0x245038==='chat'?_0xd0c5('0x61'):_0xd0c5('0x62'));var _0x4ec681=squel[_0xd0c5('0x21')]();return Promise['resolve']()[_0xd0c5('0x5b')](function(){if(_0x164646['search']&&_0x3a5bf9[_0xd0c5('0x6')]==='agent'){return _0x3a5bf9[_0x19db83]({'attributes':['id'],'raw':!![]});}})[_0xd0c5('0x5b')](function(_0x339710){if(_0x339710){if(_0x339710[_0xd0c5('0x14')]===0x0){_0x4ec681[_0xd0c5('0x43')]('i.'+_0x268fb0+_0xd0c5('0x63'));}else{_0x4ec681[_0xd0c5('0x43')]('i.'+_0x268fb0+_0xd0c5('0x16'),_[_0xd0c5('0x4c')](_0x339710,'id'));}}else if(!_0x164646[_0x268fb0]){_0x4ec681[_0xd0c5('0x43')]('i.'+_0x268fb0+_0xd0c5('0x64'));}})[_0xd0c5('0x5b')](function(){return _0x4ec681;});}function getClosedOrderClause(_0x3c7e4b,_0x5599cf){var _0x160db5='';var _0x4b8eee=[_0xd0c5('0x65'),_0xd0c5('0x66'),'i.disposition'];if(_0x3c7e4b===_0xd0c5('0x32')){_0x4b8eee[_0xd0c5('0x67')](_0xd0c5('0x68'));}if(_0x5599cf[_0xd0c5('0x69')]==='0'&&_0x3c7e4b===_0xd0c5('0x32')){_0x160db5=_0xd0c5('0x68');}else{if(_0x5599cf['closed']==='1'){_0x4b8eee[_0xd0c5('0x6a')]();}_0x160db5=_0xd0c5('0x6b')+_0x4b8eee[_0xd0c5('0x6c')](',\x20')+')';}return _0x160db5;}function getFilteredInteractions(_0x22815a,_0x5c170d,_0x3440db,_0x229405){var _0x23783c=utils[_0xd0c5('0xc')](_0x22815a);var _0x19b799=_[_0xd0c5('0x60')](_0x22815a)+_0xd0c5('0x6d');var _0xcab1fc=[];var _0x66078a=getTagsQuery();var _0x3d283a={'type':db['Sequelize'][_0xd0c5('0x6e')][_0xd0c5('0x6f')],'raw':!![]};var _0x3b27d7=[];var _0x427461=[];return db[_0xd0c5('0x70')][_0xd0c5('0x71')](_0x66078a['toString'](),_0x3d283a)[_0xd0c5('0x5b')](function(_0x490c93){_0xcab1fc=_[_0xd0c5('0x72')](_0x490c93,'id');_0x3d283a=_[_0xd0c5('0x73')](_0x3d283a,{'model':db[_0x19b799],'mapToModel':!![],'nest':!![]});if(_0x3440db[_0xd0c5('0x5c')]){_0x229405[_0xd0c5('0x74')][_0xd0c5('0x23')](function(_0x5ca677){_0x5c170d['field']('i.'+_0x5ca677);});}else{_0x5c170d[_0xd0c5('0x9')](_0xd0c5('0x75'),_0xd0c5('0x41'));_0x5c170d[_0xd0c5('0x9')](_0xd0c5('0x76'),_0xd0c5('0x77'));_0x5c170d[_0xd0c5('0x9')](_0xd0c5('0x78'),_0xd0c5('0x79'));if(_0x22815a===_0xd0c5('0x32')){_0x5c170d[_0xd0c5('0x9')](_0xd0c5('0x7a'),_0xd0c5('0x7b'));_0x5c170d[_0xd0c5('0x9')](_0xd0c5('0x7c'),_0xd0c5('0x7d'));_0x5c170d[_0xd0c5('0x9')]('i.id');_0x5c170d[_0xd0c5('0x9')]('i.createdAt');_0x5c170d[_0xd0c5('0x9')](_0xd0c5('0x7e'));_0x5c170d['field'](_0xd0c5('0x7f'));_0x5c170d[_0xd0c5('0x9')](_0xd0c5('0x80'));_0x5c170d[_0xd0c5('0x9')](_0xd0c5('0x81'));_0x5c170d[_0xd0c5('0x9')](_0xd0c5('0x82'));_0x5c170d[_0xd0c5('0x9')](_0xd0c5('0x83'));_0x5c170d['field']('i.subject');_0x5c170d[_0xd0c5('0x9')]('i.disposition');_0x5c170d['field'](_0xd0c5('0x66'));_0x5c170d[_0xd0c5('0x9')](_0xd0c5('0x65'));_0x5c170d[_0xd0c5('0x9')](_0xd0c5('0x68'));_0x5c170d['field']('i.to');_0x5c170d[_0xd0c5('0x9')](_0xd0c5('0x84'));_0x5c170d[_0xd0c5('0x9')](_0xd0c5('0x85'));_0x5c170d[_0xd0c5('0x9')](_0xd0c5('0x86'));}else if(_0x22815a===_0xd0c5('0x87')){_0x5c170d['field'](_0xd0c5('0x88'),_0xd0c5('0x7d'));}else{_0x5c170d[_0xd0c5('0x9')](_0xd0c5('0x89'),'contactName');}if(_0x22815a!==_0xd0c5('0x32')){_0x5c170d['field'](_0xd0c5('0x8a'));}_0x5c170d[_0xd0c5('0x9')](_0xd0c5('0x8b'),_0xd0c5('0x8c'));_0x5c170d[_0xd0c5('0x9')]('c.lastName',_0xd0c5('0x8d'));_0x5c170d[_0xd0c5('0x9')](_0xd0c5('0x8e'),_0xd0c5('0x8f'));_0x5c170d[_0xd0c5('0x9')](_0xd0c5('0x90'),'Contact.phone');_0x5c170d[_0xd0c5('0x9')]('c.mobile',_0xd0c5('0x91'));_0x5c170d[_0xd0c5('0x9')](_0xd0c5('0x92'),_0xd0c5('0x93'));_0x5c170d[_0xd0c5('0x9')](_0xd0c5('0x94'),_0xd0c5('0x95'));_0x5c170d[_0xd0c5('0x9')]('o.internal',_0xd0c5('0x96'));_0x5c170d['field'](_0xd0c5('0x97'),_0xd0c5('0x98'));}if(_0x229405[_0xd0c5('0x99')]){_0x5c170d[_0xd0c5('0x99')](_0x229405[_0xd0c5('0x99')]);}if(_0x229405[_0xd0c5('0x9a')]){_0x5c170d[_0xd0c5('0x9a')](_0x229405[_0xd0c5('0x9a')]);}return db[_0xd0c5('0x70')]['query'](_0x5c170d[_0xd0c5('0x9b')](),_0x3d283a);})[_0xd0c5('0x5b')](function(_0x15d596){_0x3b27d7=_0x15d596;var _0xd3c843=getUsersQuery(_0x22815a,_0x3b27d7);return db[_0xd0c5('0x70')]['query'](_0xd3c843[_0xd0c5('0x9b')](),_0x3d283a);})[_0xd0c5('0x5b')](function(_0x53ad30){_0x427461=_[_0xd0c5('0x9c')](_0x53ad30,_0x23783c);if(_0x22815a===_0xd0c5('0x32')){return db[_0xd0c5('0x9d')][_0xd0c5('0x9e')]({'attributes':[_0xd0c5('0x9f')],'raw':!![]});}})[_0xd0c5('0x5b')](function(_0xb4efc5){var _0x463f3d=_0xb4efc5?_0xb4efc5[_0xd0c5('0x9f')]:undefined;var _0x4b79f3=_0x3b27d7[_0xd0c5('0x4c')](function(_0x30044e){return updateInteraction(_0x30044e,_0xcab1fc,_0x427461,_0x463f3d);});return Promise['all'](_0x4b79f3);});}function countFilteredInteractions(_0xd0c69e,_0x246793){var _0x287c00=_0xd0c69e[_0xd0c5('0xa0')]();_0x287c00[_0xd0c5('0x9')](_0xd0c5('0xa1'));_0x287c00[_0xd0c5('0x9')](_0xd0c5('0x75'),_0xd0c5('0x41'));var _0x1ad7db=utils['getSelectedTags'](_0x246793);if(!_[_0xd0c5('0xa2')](_0x1ad7db)){_0x287c00['where'](_0xd0c5('0xa3'),_0x1ad7db);}var _0x233bde={'type':db[_0xd0c5('0xa4')][_0xd0c5('0x6e')][_0xd0c5('0x6f')],'raw':!![]};return db[_0xd0c5('0x70')][_0xd0c5('0x71')](_0x287c00[_0xd0c5('0x9b')](),_0x233bde);}module[_0xd0c5('0xa5')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index 7c827f9..1d6d0fe 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3dea=['then','lastMsgText','trimStart','catch','updateInteraction','Users','TagIds','lodash','../../mysqldb','map','fullname','push','waiting','answered','unmanaged','closed','disposition','talking','UserId','total','findOne','plainBody','-id'];(function(_0x3556e2,_0x3b532e){var _0x257de5=function(_0x21e997){while(--_0x21e997){_0x3556e2['push'](_0x3556e2['shift']());}};_0x257de5(++_0x3b532e);}(_0x3dea,0x1a5));var _0xa3de=function(_0xab1b62,_0x219e60){_0xab1b62=_0xab1b62-0x0;var _0x3a94ae=_0x3dea[_0xab1b62];return _0x3a94ae;};'use strict';var _=require(_0xa3de('0x0'));var db=require(_0xa3de('0x1'))['db'];function getInteractionUsers(_0x32229e,_0x404db8){return new Promise(function(_0x55fcee,_0x575351){try{var _0x32a533=[];if(_0x404db8[_0x32229e]){_0x32a533=_0x404db8[_0x32229e][_0xa3de('0x2')](function(_0x3ae1f4){return{'id':_0x3ae1f4['id'],'fullname':_0x3ae1f4[_0xa3de('0x3')]};});}return _0x55fcee(_0x32a533);}catch(_0x204d89){_0x575351(_0x204d89);}});}function getInteractionTags(_0x5ed803,_0x48b49f){var _0x4c09bd=[];if(_0x5ed803){_0x5ed803['split'](',')['forEach'](function(_0x275908){_0x4c09bd[_0xa3de('0x4')](_0x48b49f[_0x275908]);});}return _0x4c09bd;}function updateWaitingCounter(_0x223ac8){if(_0x223ac8[_0xa3de('0x5')]){_0x223ac8['waiting']-=0x1;}}function updateInteractionCounters(_0x27b6bf){_0x27b6bf[_0xa3de('0x5')]=0x0;_0x27b6bf['talking']=0x0;_0x27b6bf[_0xa3de('0x6')]=0x0;_0x27b6bf[_0xa3de('0x7')]=0x0;_0x27b6bf['abandoned']=0x0;_0x27b6bf['total']=0x0;if(_0x27b6bf[_0xa3de('0x8')]){if(_0x27b6bf[_0xa3de('0x9')]==='abandoned'){_0x27b6bf['abandoned']+=0x1;updateWaitingCounter(_0x27b6bf);}if(_0x27b6bf['UserId']){_0x27b6bf[_0xa3de('0x6')]+=0x1;if(_0x27b6bf[_0xa3de('0xa')]){_0x27b6bf[_0xa3de('0xa')]-=0x1;}}else{if(_0x27b6bf[_0xa3de('0x9')]){_0x27b6bf['unmanaged']+=0x1;updateWaitingCounter(_0x27b6bf);}}}else{if(!_0x27b6bf[_0xa3de('0xb')]){_0x27b6bf['waiting']+=0x1;}if(_0x27b6bf['UserId']){_0x27b6bf[_0xa3de('0xa')]+=0x1;updateWaitingCounter(_0x27b6bf);}}_0x27b6bf[_0xa3de('0xc')]+=0x1;return _0x27b6bf;}function getLastMessageText(_0x1cb774){return db['MailMessage'][_0xa3de('0xd')]({'where':{'$and':[{'MailInteractionId':_0x1cb774['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xa3de('0xe')],'order':_0xa3de('0xf'),'raw':!![]})[_0xa3de('0x10')](function(_0x4e9770){if(_0x4e9770&&_0x4e9770[_0xa3de('0xe')]){_0x1cb774[_0xa3de('0x11')]=_[_0xa3de('0x12')](_0x4e9770[_0xa3de('0xe')]);}return _0x1cb774;})[_0xa3de('0x13')](function(_0x553b38){throw _0x553b38;});}exports[_0xa3de('0x14')]=function(_0x3cd053,_0x4504bf,_0x16ab88,_0x3fa534){return new Promise(function(_0x472bed,_0x1511c7){return getInteractionUsers(_0x3cd053['id'],_0x16ab88)['then'](function(_0x1cefaf){_0x3cd053[_0xa3de('0x15')]=_0x1cefaf;return getInteractionTags(_0x3cd053[_0xa3de('0x16')],_0x4504bf);})[_0xa3de('0x10')](function(_0x88df38){_0x3cd053['Tags']=_0x88df38;delete _0x3cd053[_0xa3de('0x16')];return updateInteractionCounters(_0x3cd053);})[_0xa3de('0x10')](function(_0xbdc900){if(_0x3fa534){return getLastMessageText(_0xbdc900);}else{return _0xbdc900;}})[_0xa3de('0x10')](function(_0x56650a){_0x472bed(_0x56650a);})[_0xa3de('0x13')](function(_0x1fee77){_0x1511c7(_0x1fee77);});});}; \ No newline at end of file +var _0x0cd7=['UserId','MailMessage','findOne','plainBody','-id','lastMsgText','trimStart','catch','updateInteraction','then','Users','TagIds','Tags','lodash','../../mysqldb','map','fullname','push','waiting','answered','unmanaged','abandoned','total','closed','disposition','talking'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x0cd7,0x111));var _0x70cd=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x0cd7[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x70cd('0x0'));var db=require(_0x70cd('0x1'))['db'];function getInteractionUsers(_0x383e22,_0x1d55b1){return new Promise(function(_0x4fa555,_0x2ffca5){try{var _0x2e9a7d=[];if(_0x1d55b1[_0x383e22]){_0x2e9a7d=_0x1d55b1[_0x383e22][_0x70cd('0x2')](function(_0x214f04){return{'id':_0x214f04['id'],'fullname':_0x214f04[_0x70cd('0x3')]};});}return _0x4fa555(_0x2e9a7d);}catch(_0x538742){_0x2ffca5(_0x538742);}});}function getInteractionTags(_0x5c4bae,_0x27776d){var _0x481335=[];if(_0x5c4bae){_0x5c4bae['split'](',')['forEach'](function(_0x4434bc){_0x481335[_0x70cd('0x4')](_0x27776d[_0x4434bc]);});}return _0x481335;}function updateWaitingCounter(_0x430ef0){if(_0x430ef0[_0x70cd('0x5')]){_0x430ef0[_0x70cd('0x5')]-=0x1;}}function updateInteractionCounters(_0x2302f8){_0x2302f8['waiting']=0x0;_0x2302f8['talking']=0x0;_0x2302f8[_0x70cd('0x6')]=0x0;_0x2302f8[_0x70cd('0x7')]=0x0;_0x2302f8[_0x70cd('0x8')]=0x0;_0x2302f8[_0x70cd('0x9')]=0x0;if(_0x2302f8[_0x70cd('0xa')]){if(_0x2302f8[_0x70cd('0xb')]===_0x70cd('0x8')){_0x2302f8[_0x70cd('0x8')]+=0x1;updateWaitingCounter(_0x2302f8);}if(_0x2302f8['UserId']){_0x2302f8['answered']+=0x1;if(_0x2302f8['talking']){_0x2302f8[_0x70cd('0xc')]-=0x1;}}else{if(_0x2302f8['disposition']){_0x2302f8[_0x70cd('0x7')]+=0x1;updateWaitingCounter(_0x2302f8);}}}else{if(!_0x2302f8[_0x70cd('0xd')]){_0x2302f8['waiting']+=0x1;}if(_0x2302f8[_0x70cd('0xd')]){_0x2302f8[_0x70cd('0xc')]+=0x1;updateWaitingCounter(_0x2302f8);}}_0x2302f8['total']+=0x1;return _0x2302f8;}function getLastMessageText(_0x2f6ead){return db[_0x70cd('0xe')][_0x70cd('0xf')]({'where':{'$and':[{'MailInteractionId':_0x2f6ead['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x70cd('0x10')],'order':_0x70cd('0x11'),'raw':!![]})['then'](function(_0x5c6e50){if(_0x5c6e50&&_0x5c6e50[_0x70cd('0x10')]){_0x2f6ead[_0x70cd('0x12')]=_[_0x70cd('0x13')](_0x5c6e50[_0x70cd('0x10')]);}return _0x2f6ead;})[_0x70cd('0x14')](function(_0x82bc92){throw _0x82bc92;});}exports[_0x70cd('0x15')]=function(_0x10f503,_0x2a2967,_0x37d8ba,_0x15de50){return new Promise(function(_0xeaf3da,_0x12f722){return getInteractionUsers(_0x10f503['id'],_0x37d8ba)[_0x70cd('0x16')](function(_0x5f19af){_0x10f503[_0x70cd('0x17')]=_0x5f19af;return getInteractionTags(_0x10f503[_0x70cd('0x18')],_0x2a2967);})[_0x70cd('0x16')](function(_0x15a24c){_0x10f503[_0x70cd('0x19')]=_0x15a24c;delete _0x10f503[_0x70cd('0x18')];return updateInteractionCounters(_0x10f503);})[_0x70cd('0x16')](function(_0x23a119){if(_0x15de50){return getLastMessageText(_0x23a119);}else{return _0x23a119;}})[_0x70cd('0x16')](function(_0x488e4a){_0xeaf3da(_0x488e4a);})[_0x70cd('0x14')](function(_0x4910c5){_0x12f722(_0x4910c5);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index a7c9cd9..640b8cd 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa21a=['../../config/logger','mail-interactions','fax-interactions','sms-interactions','whatsapp-interactions','capitalize','Website','Account','InteractionId','upperFirst','unknown','chat','websites','accounts','_interactions','_messages','user_has_','isArray','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','findOne','then','update','info','error','exports','../../mysqldb','openchannel-interactions'];(function(_0x1f5086,_0x6df4e7){var _0x4f4e44=function(_0x2ef23a){while(--_0x2ef23a){_0x1f5086['push'](_0x1f5086['shift']());}};_0x4f4e44(++_0x6df4e7);}(_0xa21a,0x169));var _0xaa21=function(_0x403a90,_0x16dbfe){_0x403a90=_0x403a90-0x0;var _0x278f2e=_0xa21a[_0x403a90];return _0x278f2e;};'use strict';var _=require('lodash');var db=require(_0xaa21('0x0'))['db'];var loggers={'openchannel':require('../../config/logger')(_0xaa21('0x1')),'mail':require(_0xaa21('0x2'))(_0xaa21('0x3')),'fax':require(_0xaa21('0x2'))(_0xaa21('0x4')),'sms':require('../../config/logger')(_0xaa21('0x5')),'chat':require(_0xaa21('0x2'))('chat-interactions'),'whatsapp':require(_0xaa21('0x2'))(_0xaa21('0x6'))};function getAccountFK(_0x31bf39){return _[_0xaa21('0x7')](_0x31bf39)+(_0x31bf39==='chat'?_0xaa21('0x8'):_0xaa21('0x9'))+'Id';}function getInteractionFK(_0x512dd3){return _[_0xaa21('0x7')](_0x512dd3)+_0xaa21('0xa');}function getInteractionId(_0x5eac1a,_0x1734f9,_0x2780c7){if(_0x5eac1a&&_0x5eac1a[_[_0xaa21('0xb')](_0x2780c7)+'InteractionId']){return _0x5eac1a[_[_0xaa21('0xb')](_0x2780c7)+_0xaa21('0xa')];}else if(_0x5eac1a&&_0x5eac1a['id']){return _0x5eac1a['id'];}else if(_0x1734f9&&_0x1734f9['id']){return _0x1734f9['id'];}else{return _0xaa21('0xc');}}function getInteractionsTables(_0x5bb22c){return{'accounts':_0x5bb22c+'_'+(_0x5bb22c===_0xaa21('0xd')?_0xaa21('0xe'):_0xaa21('0xf')),'interactions':_0x5bb22c+_0xaa21('0x10'),'interactionsTags':_0x5bb22c+'_interaction_has_tags','messages':_0x5bb22c+_0xaa21('0x11'),'userInteractions':_0xaa21('0x12')+_0x5bb22c+'_interactions'};}function getSelectedTags(_0x1fbe8f){var _0x373b93=[];if(_0x1fbe8f){_0x373b93=Array[_0xaa21('0x13')](_0x1fbe8f)?_0x1fbe8f:[_0x1fbe8f];}return _0x373b93;}function log(_0x142363,_0x273664,_0x12ccde,_0x207d3d,_0x385d42,_0x15b3f4){loggers[_0x385d42['toLowerCase']()][_0x142363](_0xaa21('0x14'),_0x15b3f4[_0xaa21('0x15')](),_0x273664?_0x273664['id']:null,_0x273664?_0x273664[_0xaa21('0x16')]:null,_0x273664?_0x273664[_0xaa21('0x17')]:null,getInteractionId(_0x12ccde,_0x207d3d,_0x385d42),_0x12ccde?JSON[_0xaa21('0x18')](_0x12ccde):_0xaa21('0x19'));}function updateUser(_0x1ded06,_0xd01eb,_0x207594,_0x1fb914,_0x356561){db[_['upperFirst'](_0x1fb914)+_0xaa21('0x1a')][_0xaa21('0x1b')]({'where':{'id':getInteractionId(_0xd01eb,_0x207594,_0x1fb914)}})[_0xaa21('0x1c')](function(_0x56f8d4){if(_0x56f8d4){return _0x56f8d4[_0xaa21('0x1d')]({'UserId':_0x1ded06?_0x1ded06['id']:null});}})[_0xaa21('0x1c')](function(_0x4d00a2){if(_0x4d00a2){log(_0xaa21('0x1e'),_0x1ded06,_0xd01eb,_0x207594,_0x1fb914,_0x356561);}})['catch'](function(){log(_0xaa21('0x1f'),_0x1ded06,_0xd01eb,_0x207594,_0x1fb914,_0x356561);});}module[_0xaa21('0x20')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x4bfa=['Website','Account','upperFirst','InteractionId','unknown','websites','accounts','_messages','isArray','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','stringify','null','findOne','then','update','info','catch','error','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','whatsapp-interactions','chat'];(function(_0xeb436c,_0x8f002a){var _0x4a451e=function(_0x418aea){while(--_0x418aea){_0xeb436c['push'](_0xeb436c['shift']());}};_0x4a451e(++_0x8f002a);}(_0x4bfa,0x170));var _0xa4bf=function(_0x15c72f,_0xfeb066){_0x15c72f=_0x15c72f-0x0;var _0x2c4cb9=_0x4bfa[_0x15c72f];return _0x2c4cb9;};'use strict';var _=require(_0xa4bf('0x0'));var db=require(_0xa4bf('0x1'))['db'];var loggers={'openchannel':require(_0xa4bf('0x2'))(_0xa4bf('0x3')),'mail':require(_0xa4bf('0x2'))(_0xa4bf('0x4')),'fax':require(_0xa4bf('0x2'))(_0xa4bf('0x5')),'sms':require(_0xa4bf('0x2'))(_0xa4bf('0x6')),'chat':require('../../config/logger')('chat-interactions'),'whatsapp':require(_0xa4bf('0x2'))(_0xa4bf('0x7'))};function getAccountFK(_0x4b2250){return _['capitalize'](_0x4b2250)+(_0x4b2250===_0xa4bf('0x8')?_0xa4bf('0x9'):_0xa4bf('0xa'))+'Id';}function getInteractionFK(_0x227d46){return _['capitalize'](_0x227d46)+'InteractionId';}function getInteractionId(_0x254e8d,_0x8e5afd,_0x58e335){if(_0x254e8d&&_0x254e8d[_[_0xa4bf('0xb')](_0x58e335)+_0xa4bf('0xc')]){return _0x254e8d[_[_0xa4bf('0xb')](_0x58e335)+_0xa4bf('0xc')];}else if(_0x254e8d&&_0x254e8d['id']){return _0x254e8d['id'];}else if(_0x8e5afd&&_0x8e5afd['id']){return _0x8e5afd['id'];}else{return _0xa4bf('0xd');}}function getInteractionsTables(_0x4f96a5){return{'accounts':_0x4f96a5+'_'+(_0x4f96a5===_0xa4bf('0x8')?_0xa4bf('0xe'):_0xa4bf('0xf')),'interactions':_0x4f96a5+'_interactions','interactionsTags':_0x4f96a5+'_interaction_has_tags','messages':_0x4f96a5+_0xa4bf('0x10'),'userInteractions':'user_has_'+_0x4f96a5+'_interactions'};}function getSelectedTags(_0x187ad7){var _0x2182e5=[];if(_0x187ad7){_0x2182e5=Array[_0xa4bf('0x11')](_0x187ad7)?_0x187ad7:[_0x187ad7];}return _0x2182e5;}function log(_0x395361,_0x21ec4f,_0x145638,_0x1fa6d1,_0x5d55d7,_0x1873a3){loggers[_0x5d55d7['toLowerCase']()][_0x395361](_0xa4bf('0x12'),_0x1873a3[_0xa4bf('0x13')](),_0x21ec4f?_0x21ec4f['id']:null,_0x21ec4f?_0x21ec4f['name']:null,_0x21ec4f?_0x21ec4f[_0xa4bf('0x14')]:null,getInteractionId(_0x145638,_0x1fa6d1,_0x5d55d7),_0x145638?JSON[_0xa4bf('0x15')](_0x145638):_0xa4bf('0x16'));}function updateUser(_0x4fd81f,_0x243271,_0x16f897,_0x313c8f,_0xc74824){db[_[_0xa4bf('0xb')](_0x313c8f)+'Interaction'][_0xa4bf('0x17')]({'where':{'id':getInteractionId(_0x243271,_0x16f897,_0x313c8f)}})[_0xa4bf('0x18')](function(_0x408d27){if(_0x408d27){return _0x408d27[_0xa4bf('0x19')]({'UserId':_0x4fd81f?_0x4fd81f['id']:null});}})[_0xa4bf('0x18')](function(_0x3a4118){if(_0x3a4118){log(_0xa4bf('0x1a'),_0x4fd81f,_0x243271,_0x16f897,_0x313c8f,_0xc74824);}})[_0xa4bf('0x1b')](function(){log(_0xa4bf('0x1c'),_0x4fd81f,_0x243271,_0x16f897,_0x313c8f,_0xc74824);});}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 705a8e6..266d065 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 _0x99ac=['parse','hasOwnProperty','License','findOne','then','count','status','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','admin','user','isUserLimit','util','composable-middleware','../../mysqldb','license','data1','split','createDecipher','aes-256-ctr','%s:%s:%s','update','base64','utf8','final'];(function(_0x3939aa,_0x5e3184){var _0x1232a2=function(_0x713324){while(--_0x713324){_0x3939aa['push'](_0x3939aa['shift']());}};_0x1232a2(++_0x5e3184);}(_0x99ac,0x7a));var _0xc99a=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x99ac[_0x4b7895];return _0x264180;};'use strict';var crypto=require('crypto');var util=require(_0xc99a('0x0'));var compose=require(_0xc99a('0x1'));var db=require(_0xc99a('0x2'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x1768df,_0x18891b){if(_0x1768df&&_0x18891b){if(_0x18891b['data1']&&_0x18891b[_0xc99a('0x3')]){var _0x1a444c=_0x18891b[_0xc99a('0x4')];var _0x2f1be6=_0x18891b[_0xc99a('0x3')];var _0x5dcbf5=_0x1a444c[_0xc99a('0x5')]('-')[0x4];var _0x1e30f5=_0x1a444c[_0xc99a('0x5')]('-')[0x0];var _0x2d0234=crypto[_0xc99a('0x6')](_0xc99a('0x7'),util['format'](_0xc99a('0x8'),_0x5dcbf5,_0x1a444c,_0x1e30f5));var _0xcc2953=_0x2d0234[_0xc99a('0x9')](_0x2f1be6,_0xc99a('0xa'),_0xc99a('0xb'));_0xcc2953+=_0x2d0234[_0xc99a('0xc')](_0xc99a('0xb'));var _0x2bf4ad=JSON[_0xc99a('0xd')](_0xcc2953);return _0x2bf4ad[_0xc99a('0xe')](_0x1768df)?_0x2bf4ad[_0x1768df]:null;}}return null;}function isLimit(_0x2c2c7e,_0x258c38,_0x58c36f,_0x530c37){var _0xc88599=_0x258c38;return compose()['use'](function(_0x5e4f3c,_0x3509a7,_0xe247ed){return db[_0xc99a('0xf')][_0xc99a('0x10')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x3692dd){var _0x244b74=getValueFromLicense(_0x2c2c7e,_0x3692dd);return _0x244b74?_0x244b74:_0xc88599;})[_0xc99a('0x11')](function(_0x103cb2){_0xc88599=_0x103cb2;return _0x58c36f[_0xc99a('0x12')](_0x530c37);})[_0xc99a('0x11')](function(_0x19f573){if(_0x19f573>=_0xc88599){return _0x3509a7[_0xc99a('0x13')](0x193)['json']({'message':util[_0xc99a('0x14')](_0xc99a('0x15'),_0x2c2c7e)});}_0xe247ed();})[_0xc99a('0x16')](function(_0x52d587){_0xe247ed(_0x52d587);});});}function isUserLimit(){return isLimit(_0xc99a('0x17'),0x1,db['User'],{'where':{'$or':[{'role':_0xc99a('0x18')},{'role':_0xc99a('0x19')}]}});}exports[_0xc99a('0x1a')]=isUserLimit; \ No newline at end of file +var _0x16eb=['../../mysqldb','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','base64','parse','hasOwnProperty','use','License','findOne','then','count','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','user','isUserLimit','crypto','util','composable-middleware'];(function(_0x5805d7,_0x3d584a){var _0x170fe4=function(_0x3b9b73){while(--_0x3b9b73){_0x5805d7['push'](_0x5805d7['shift']());}};_0x170fe4(++_0x3d584a);}(_0x16eb,0x110));var _0xb16e=function(_0x275851,_0x2542a8){_0x275851=_0x275851-0x0;var _0x318b2a=_0x16eb[_0x275851];return _0x318b2a;};'use strict';var crypto=require(_0xb16e('0x0'));var util=require(_0xb16e('0x1'));var compose=require(_0xb16e('0x2'));var db=require(_0xb16e('0x3'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x16c58b,_0x29e390){if(_0x16c58b&&_0x29e390){if(_0x29e390[_0xb16e('0x4')]&&_0x29e390[_0xb16e('0x5')]){var _0x477cdb=_0x29e390['data1'];var _0x7335ac=_0x29e390['license'];var _0x31e10d=_0x477cdb[_0xb16e('0x6')]('-')[0x4];var _0x141acc=_0x477cdb[_0xb16e('0x6')]('-')[0x0];var _0x455b47=crypto[_0xb16e('0x7')](_0xb16e('0x8'),util[_0xb16e('0x9')](_0xb16e('0xa'),_0x31e10d,_0x477cdb,_0x141acc));var _0x48b11a=_0x455b47['update'](_0x7335ac,_0xb16e('0xb'),'utf8');_0x48b11a+=_0x455b47['final']('utf8');var _0x57b42c=JSON[_0xb16e('0xc')](_0x48b11a);return _0x57b42c[_0xb16e('0xd')](_0x16c58b)?_0x57b42c[_0x16c58b]:null;}}return null;}function isLimit(_0x27a5a1,_0x3e0e3f,_0x417afd,_0x5c0cea){var _0x1d3575=_0x3e0e3f;return compose()[_0xb16e('0xe')](function(_0x1aefbf,_0x33a4fb,_0x547f46){return db[_0xb16e('0xf')][_0xb16e('0x10')]({'where':{'id':0x1},'raw':!![]})[_0xb16e('0x11')](function(_0x1b9575){var _0x33a348=getValueFromLicense(_0x27a5a1,_0x1b9575);return _0x33a348?_0x33a348:_0x1d3575;})[_0xb16e('0x11')](function(_0x45b534){_0x1d3575=_0x45b534;return _0x417afd[_0xb16e('0x12')](_0x5c0cea);})[_0xb16e('0x11')](function(_0x3dd95f){if(_0x3dd95f>=_0x1d3575){return _0x33a4fb[_0xb16e('0x13')](0x193)['json']({'message':util['format'](_0xb16e('0x14'),_0x27a5a1)});}_0x547f46();})['catch'](function(_0x515c24){_0x547f46(_0x515c24);});});}function isUserLimit(){return isLimit(_0xb16e('0x15'),0x1,db[_0xb16e('0x16')],{'where':{'$or':[{'role':'admin'},{'role':_0xb16e('0x17')}]}});}exports[_0xb16e('0x18')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index fd89c4e..2a1fa39 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 _0x77bc=['$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','start','shift','pop','DATE','utcOffset','add','hours','seconds','lodash','moment','parseSearch','sqlOperator','and','replace','[$and]','[$or]','length','split','slice','forEach','match','filter','conditions','push','buildExpression','$eq','$between','value','includes','$gt','$lte','operator','format','YYYY-MM-DD','text','CAST(','field','\x20AS\x20','$ne','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','$notIn','NOT\x20IN\x20?','<>\x20?','$substring','$startsWith','$endsWith'];(function(_0xef4cf0,_0x16c9c3){var _0x497ad2=function(_0xce63d4){while(--_0xce63d4){_0xef4cf0['push'](_0xef4cf0['shift']());}};_0x497ad2(++_0x16c9c3);}(_0x77bc,0x158));var _0xc77b=function(_0x3813cf,_0x56f7d2){_0x3813cf=_0x3813cf-0x0;var _0x4f9d3e=_0x77bc[_0x3813cf];return _0x4f9d3e;};'use strict';var _=require(_0xc77b('0x0'));var moment=require(_0xc77b('0x1'));exports[_0xc77b('0x2')]=function(_0x495945){var _0x2d2b73={'conditions':[]};_0x2d2b73[_0xc77b('0x3')]=_['startsWith'](_0x495945,'[$or]')?'or':_0xc77b('0x4');var _0x444402=_0x495945[_0xc77b('0x5')](_0xc77b('0x6'),'')[_0xc77b('0x5')](_0xc77b('0x7'),'')['split']('||');for(var _0x4f1ff1=0x0;_0x4f1ff1<_0x444402[_0xc77b('0x8')];_0x4f1ff1++){var _0x54de79=_0x444402[_0x4f1ff1][_0xc77b('0x9')](':=');var _0x2d1456=_0x54de79[0x0];var _0xce3fc4=_0x54de79[_0xc77b('0xa')](0x1);_0xce3fc4[_0xc77b('0xb')](function(_0x1dfd31){var _0x47d041=_0x1dfd31[_0xc77b('0x9')]('[')['shift']();var _0x2dccf5=_0x1dfd31[_0xc77b('0xc')](/\[(.*?)\]/g);_0x2dccf5['forEach'](function(_0x5487d5){var _0x347f67=_0x5487d5[_0xc77b('0x9')]('[')[_0xc77b('0xd')](function(_0x470db6){return _0x470db6['indexOf'](']')>-0x1;})['map'](function(_0x540614){return _0x540614[_0xc77b('0x9')](']')[0x0];})[0x0];_0x2d2b73[_0xc77b('0xe')][_0xc77b('0xf')]({'field':_0x2d1456,'operator':_0x47d041,'value':_0x347f67});});});}return _0x2d2b73;};exports[_0xc77b('0x10')]=function(_0x32277c,_0x47181d,_0x26b2f1){var _0xa4b9bd={};if(_0x47181d==='DATE'){if(_0x26b2f1['operator']===_0xc77b('0x11')){_0x26b2f1['operator']=_0xc77b('0x12');_0x26b2f1[_0xc77b('0x13')]+=','+_0x26b2f1[_0xc77b('0x13')];}else if(_[_0xc77b('0x14')]([_0xc77b('0x15'),_0xc77b('0x16')],_0x26b2f1[_0xc77b('0x17')])){_0x26b2f1['value']=moment(_0x26b2f1[_0xc77b('0x13')])['add'](0x1,'days')[_0xc77b('0x18')](_0xc77b('0x19'));}}if(_0x26b2f1['castTo']){_0x47181d=_0x26b2f1['castTo'];_0xa4b9bd[_0xc77b('0x1a')]=_0xc77b('0x1b')+_0x32277c+'.'+_0x26b2f1[_0xc77b('0x1c')]+_0xc77b('0x1d')+_0x26b2f1['castTo']+')\x20'+parseOperator(_0x26b2f1['operator']);}else{_0xa4b9bd[_0xc77b('0x1a')]=_0x32277c+'.'+_0x26b2f1[_0xc77b('0x1c')]+'\x20'+parseOperator(_0x26b2f1['operator']);}if(_[_0xc77b('0x14')]([_0xc77b('0x1e'),'$notIn'],_0x26b2f1[_0xc77b('0x17')]))_0xa4b9bd[_0xc77b('0x1a')]='('+_0xa4b9bd[_0xc77b('0x1a')]+_0xc77b('0x1f')+_0x32277c+'.'+_0x26b2f1[_0xc77b('0x1c')]+_0xc77b('0x20');_0xa4b9bd[_0xc77b('0x13')]=parseValue(_0x47181d,_0x26b2f1[_0xc77b('0x17')],_0x26b2f1[_0xc77b('0x13')]);return _0xa4b9bd;};function parseOperator(_0x3988d7){var _0x253e81;switch(_0x3988d7){case _0xc77b('0x21'):_0x253e81=_0xc77b('0x22');break;case _0xc77b('0x23'):_0x253e81=_0xc77b('0x24');break;case'$eq':_0x253e81='=\x20?';break;case _0xc77b('0x1e'):_0x253e81=_0xc77b('0x25');break;case _0xc77b('0x26'):case _0xc77b('0x27'):case _0xc77b('0x28'):_0x253e81='LIKE\x20?';break;case _0xc77b('0x29'):_0x253e81=_0xc77b('0x2a');break;case _0xc77b('0x15'):_0x253e81=_0xc77b('0x2b');break;case _0xc77b('0x16'):_0x253e81=_0xc77b('0x2c');break;case _0xc77b('0x2d'):_0x253e81=_0xc77b('0x2e');break;case _0xc77b('0x12'):_0x253e81='BETWEEN\x20?\x20AND\x20?';break;}return _0x253e81;}function parseValue(_0x583f9c,_0x3fa1fa,_0x513825){var _0xa70b47={'start':undefined,'end':undefined};switch(_0x3fa1fa){case _0xc77b('0x21'):case _0xc77b('0x23'):_0xa70b47[_0xc77b('0x2f')]=_0x513825['split'](',');break;case _0xc77b('0x26'):_0xa70b47['start']='%'+_0x513825+'%';break;case'$startsWith':_0xa70b47[_0xc77b('0x2f')]=_0x513825+'%';break;case'$endsWith':_0xa70b47[_0xc77b('0x2f')]='%'+_0x513825;break;case'$between':var _0x108694=_0x513825['split'](',');var _0x513825=_0x108694[_0xc77b('0x30')]();var _0x1a00a6=_0x108694[_0xc77b('0x31')]();if(_0x583f9c===_0xc77b('0x32')){_0x513825=moment(_0x513825)[_0xc77b('0x33')](0x0,!![])[_0xc77b('0x18')]();_0x1a00a6=moment(_0x1a00a6)['utcOffset'](0x0,!![])[_0xc77b('0x34')](0x17,_0xc77b('0x35'))['add'](0x3b,'minutes')[_0xc77b('0x34')](0x3b,_0xc77b('0x36'))['format']();}_0xa70b47={'start':_0x513825,'end':_0x1a00a6};break;default:_0xa70b47[_0xc77b('0x2f')]=_0x513825;break;}return _0xa70b47;} \ No newline at end of file +var _0x4509=['minutes','seconds','lodash','moment','parseSearch','startsWith','[$or]','and','replace','[$and]','split','slice','shift','match','forEach','indexOf','conditions','push','buildExpression','DATE','operator','$eq','$between','$gt','$lte','value','add','days','format','castTo','CAST(','field','\x20AS\x20','text','includes','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','$notIn','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$substring','$endsWith','LIKE\x20?','<\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$startsWith','pop','utcOffset','hours'];(function(_0x2d5887,_0x497b20){var _0x5c5973=function(_0x3da82f){while(--_0x3da82f){_0x2d5887['push'](_0x2d5887['shift']());}};_0x5c5973(++_0x497b20);}(_0x4509,0xaa));var _0x9450=function(_0x1b0834,_0x2ca444){_0x1b0834=_0x1b0834-0x0;var _0x26041b=_0x4509[_0x1b0834];return _0x26041b;};'use strict';var _=require(_0x9450('0x0'));var moment=require(_0x9450('0x1'));exports[_0x9450('0x2')]=function(_0xd59824){var _0x3e18dc={'conditions':[]};_0x3e18dc['sqlOperator']=_[_0x9450('0x3')](_0xd59824,_0x9450('0x4'))?'or':_0x9450('0x5');var _0x157317=_0xd59824[_0x9450('0x6')](_0x9450('0x7'),'')[_0x9450('0x6')](_0x9450('0x4'),'')[_0x9450('0x8')]('||');for(var _0x1378f2=0x0;_0x1378f2<_0x157317['length'];_0x1378f2++){var _0x4604ea=_0x157317[_0x1378f2][_0x9450('0x8')](':=');var _0xd0089f=_0x4604ea[0x0];var _0x312748=_0x4604ea[_0x9450('0x9')](0x1);_0x312748['forEach'](function(_0x3123a9){var _0xccdb48=_0x3123a9[_0x9450('0x8')]('[')[_0x9450('0xa')]();var _0x187d58=_0x3123a9[_0x9450('0xb')](/\[(.*?)\]/g);_0x187d58[_0x9450('0xc')](function(_0x1e9a2c){var _0x23f1b6=_0x1e9a2c[_0x9450('0x8')]('[')['filter'](function(_0x4ffd1c){return _0x4ffd1c[_0x9450('0xd')](']')>-0x1;})['map'](function(_0x3692ff){return _0x3692ff['split'](']')[0x0];})[0x0];_0x3e18dc[_0x9450('0xe')][_0x9450('0xf')]({'field':_0xd0089f,'operator':_0xccdb48,'value':_0x23f1b6});});});}return _0x3e18dc;};exports[_0x9450('0x10')]=function(_0x484c8e,_0x4e1ca2,_0x28bb92){var _0x21702c={};if(_0x4e1ca2===_0x9450('0x11')){if(_0x28bb92[_0x9450('0x12')]===_0x9450('0x13')){_0x28bb92['operator']=_0x9450('0x14');_0x28bb92['value']+=','+_0x28bb92['value'];}else if(_['includes']([_0x9450('0x15'),_0x9450('0x16')],_0x28bb92['operator'])){_0x28bb92[_0x9450('0x17')]=moment(_0x28bb92[_0x9450('0x17')])[_0x9450('0x18')](0x1,_0x9450('0x19'))[_0x9450('0x1a')]('YYYY-MM-DD');}}if(_0x28bb92[_0x9450('0x1b')]){_0x4e1ca2=_0x28bb92[_0x9450('0x1b')];_0x21702c['text']=_0x9450('0x1c')+_0x484c8e+'.'+_0x28bb92[_0x9450('0x1d')]+_0x9450('0x1e')+_0x28bb92[_0x9450('0x1b')]+')\x20'+parseOperator(_0x28bb92[_0x9450('0x12')]);}else{_0x21702c[_0x9450('0x1f')]=_0x484c8e+'.'+_0x28bb92['field']+'\x20'+parseOperator(_0x28bb92[_0x9450('0x12')]);}if(_[_0x9450('0x20')](['$ne','$notIn'],_0x28bb92[_0x9450('0x12')]))_0x21702c[_0x9450('0x1f')]='('+_0x21702c[_0x9450('0x1f')]+_0x9450('0x21')+_0x484c8e+'.'+_0x28bb92[_0x9450('0x1d')]+_0x9450('0x22');_0x21702c[_0x9450('0x17')]=parseValue(_0x4e1ca2,_0x28bb92[_0x9450('0x12')],_0x28bb92[_0x9450('0x17')]);return _0x21702c;};function parseOperator(_0x37e6a7){var _0x4ceef6;switch(_0x37e6a7){case _0x9450('0x23'):_0x4ceef6=_0x9450('0x24');break;case _0x9450('0x25'):_0x4ceef6=_0x9450('0x26');break;case _0x9450('0x13'):_0x4ceef6=_0x9450('0x27');break;case _0x9450('0x28'):_0x4ceef6=_0x9450('0x29');break;case _0x9450('0x2a'):case'$startsWith':case _0x9450('0x2b'):_0x4ceef6=_0x9450('0x2c');break;case'$lt':_0x4ceef6=_0x9450('0x2d');break;case'$gt':_0x4ceef6='>\x20?';break;case'$lte':_0x4ceef6='<=\x20?';break;case _0x9450('0x2e'):_0x4ceef6=_0x9450('0x2f');break;case _0x9450('0x14'):_0x4ceef6=_0x9450('0x30');break;}return _0x4ceef6;}function parseValue(_0x14d2ef,_0x14e2de,_0x15ad06){var _0x15bacb={'start':undefined,'end':undefined};switch(_0x14e2de){case'$in':case _0x9450('0x25'):_0x15bacb[_0x9450('0x31')]=_0x15ad06[_0x9450('0x8')](',');break;case'$substring':_0x15bacb[_0x9450('0x31')]='%'+_0x15ad06+'%';break;case _0x9450('0x32'):_0x15bacb['start']=_0x15ad06+'%';break;case'$endsWith':_0x15bacb[_0x9450('0x31')]='%'+_0x15ad06;break;case'$between':var _0x4eccb2=_0x15ad06[_0x9450('0x8')](',');var _0x15ad06=_0x4eccb2['shift']();var _0x4e1f94=_0x4eccb2[_0x9450('0x33')]();if(_0x14d2ef===_0x9450('0x11')){_0x15ad06=moment(_0x15ad06)[_0x9450('0x34')](0x0,!![])[_0x9450('0x1a')]();_0x4e1f94=moment(_0x4e1f94)['utcOffset'](0x0,!![])[_0x9450('0x18')](0x17,_0x9450('0x35'))[_0x9450('0x18')](0x3b,_0x9450('0x36'))['add'](0x3b,_0x9450('0x37'))[_0x9450('0x1a')]();}_0x15bacb={'start':_0x15ad06,'end':_0x4e1f94};break;default:_0x15bacb[_0x9450('0x31')]=_0x15ad06;break;}return _0x15bacb;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 04f1bf9..a1f9e47 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 _0xf873=['forOwn','find','type','DATE','isPlainObject','$gte','format','utc','$lte','YYYY-MM-DD','subtract','uniqueid','isArray','limit','offset','priority','cast','col','unsigned','substr','DESC','ASC','omit','length','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','push','join','getOptions','query','$id','name','filters','intersection','model','attributes','nolimit','order','where','filter','object','value','merge','map','VIRTUAL','lower','options','sequelize','moment','parse','keys','includes','fields','split','isEmpty'];(function(_0x36fe0c,_0x1bedaf){var _0x4c0cb6=function(_0x5a159e){while(--_0x5a159e){_0x36fe0c['push'](_0x36fe0c['shift']());}};_0x4c0cb6(++_0x1bedaf);}(_0xf873,0xb2));var _0x3f87=function(_0x4d7b2f,_0x2db5b1){_0x4d7b2f=_0x4d7b2f-0x0;var _0x4ae436=_0xf873[_0x4d7b2f];return _0x4ae436;};'use strict';var _=require('lodash');var sequelize=require(_0x3f87('0x0'));var moment=require(_0x3f87('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x311101){var _0x3ef688=['ne'];try{var _0x1c56a3=JSON[_0x3f87('0x2')](_0x311101);var _0x2fbb4f=Object[_0x3f87('0x3')](_0x1c56a3)[0x0];return _0x3ef688[_0x3f87('0x4')](_0x2fbb4f);}catch(_0x4a909e){return![];}}function getOperatorValue(_0x2e2177){var _0x43c8e4=JSON[_0x3f87('0x2')](_0x2e2177);var _0x5a5e37=Object[_0x3f87('0x3')](_0x43c8e4)[0x0];var _0x2c7ccc=_0x43c8e4[_0x5a5e37];return{['$'+_0x5a5e37]:_0x2c7ccc};}exports[_0x3f87('0x5')]=function(_0x41faf2){var _0xd9391d=null;if(_0x41faf2){_0xd9391d=_0x41faf2[_0x3f87('0x6')](',');}return _0xd9391d;};exports['filters']=function(_0x1405ca,_0x435ca8){var _0x32e236={};if(!_[_0x3f87('0x7')](_0x1405ca)){_[_0x3f87('0x8')](_0x1405ca,function(_0xd41ca0,_0x2aa592){try{if(_0x435ca8){var _0x2b7ca0=_[_0x3f87('0x9')](_0x435ca8,{'name':_0x2aa592})||{};if(hasSequelizeOperator(_0xd41ca0)){_0x32e236[_0x2aa592]=getOperatorValue(_0xd41ca0);}else if(_0x2b7ca0[_0x3f87('0xa')]===_0x3f87('0xb')&&_[_0x3f87('0xc')](_0xd41ca0)){var _0xfd5b65=JSON[_0x3f87('0x2')](_0xd41ca0);var _0x5aff02={'$gte':moment(moment(_0xfd5b65[_0x3f87('0xd')])[_0x3f87('0xe')]('YYYY-MM-DD'))[_0x3f87('0xf')]()[_0x3f87('0xe')](),'$lte':moment(moment(_0xfd5b65[_0x3f87('0x10')])[_0x3f87('0xe')](_0x3f87('0x11')))[_0x3f87('0xf')]()[_0x3f87('0x12')](0x1,'s')[_0x3f87('0xe')]()};_0x32e236[_0x2aa592]=_0x5aff02;}else if(_0x2b7ca0['name']===_0x3f87('0x13')){_0x32e236[_0x2aa592]=_0xd41ca0;}else{_0x32e236[_0x2aa592]=_[_0x3f87('0x14')](_0xd41ca0)?_0xd41ca0:JSON[_0x3f87('0x2')](_0xd41ca0);}}else{_0x32e236[_0x2aa592]=_['isArray'](_0xd41ca0)?_0xd41ca0:JSON[_0x3f87('0x2')](_0xd41ca0);}}catch(_0x56d79e){_0x32e236[_0x2aa592]=_0xd41ca0[_0x3f87('0x6')](',');}});}return _0x32e236;};exports[_0x3f87('0x15')]=function(_0x285b2c){_0x285b2c=parseInt(_0x285b2c,0xa);if(!_0x285b2c||_0x285b2c<0x0){_0x285b2c=LIMIT_VALUE;}return _0x285b2c;};exports[_0x3f87('0x16')]=function(_0x3678bc){_0x3678bc=parseInt(_0x3678bc,0xa);if(!_0x3678bc||_0x3678bc<0x0){_0x3678bc=0x0;}return _0x3678bc;};exports['sort']=function(_0x12df6e){var _0x2372d3,_0x996eb8=null;if(_0x12df6e){_0x2372d3=_0x12df6e[_0x3f87('0x6')](',');_0x996eb8=_['map'](_0x2372d3,function(_0x4acd30){if(_0x4acd30['indexOf']('-')===0x0){return[_0x4acd30===_0x3f87('0x17')?sequelize[_0x3f87('0x18')](sequelize[_0x3f87('0x19')]('priority'),_0x3f87('0x1a')):_0x4acd30[_0x3f87('0x1b')](0x1),_0x3f87('0x1c')];}else{return[_0x4acd30===_0x3f87('0x17')?sequelize[_0x3f87('0x18')](sequelize[_0x3f87('0x19')](_0x3f87('0x17')),_0x3f87('0x1a')):_0x4acd30,_0x3f87('0x1d')];}});}return _0x996eb8;};exports[_0x3f87('0x1e')]=function(_0x5df86b,_0x37b8b9){if(_['isEmpty'](_0x5df86b)){return _0x5df86b;}if(_[_0x3f87('0x14')](_0x5df86b)){for(var _0x9ed827=0x0;_0x9ed827<_0x5df86b[_0x3f87('0x1f')];_0x9ed827+=0x1){_0x5df86b[_0x9ed827]=this['omit'](_0x5df86b[_0x9ed827],_0x37b8b9);}return _0x5df86b;}if(!_['isObject'](_0x5df86b)){return _0x5df86b;}if(_[_0x3f87('0x20')](_0x37b8b9)){_0x37b8b9=[_0x37b8b9];}if(!_[_0x3f87('0x14')](_0x37b8b9)){return _0x5df86b;}for(var _0x18df70=0x0;_0x18df70<_0x37b8b9[_0x3f87('0x1f')];_0x18df70+=0x1){_[_0x3f87('0x21')](_0x5df86b,_0x37b8b9[_0x18df70]);}for(var _0x148d8e in _0x5df86b){if(_0x5df86b[_0x3f87('0x22')](_0x148d8e)){_0x5df86b[_0x148d8e]=this[_0x3f87('0x1e')](_0x5df86b[_0x148d8e],_0x37b8b9);}}return _0x5df86b;};exports[_0x3f87('0x23')]=function(_0x2e18cb){return _0x2e18cb[_0x3f87('0x24')](RegExp(_0x3f87('0x25')))?!![]:![];};exports[_0x3f87('0x26')]=function(_0x241d88){return _0x241d88[_0x3f87('0x24')](/^\S+@\S+$/)?!![]:![];};exports[_0x3f87('0x27')]=function(_0x5d6fc2){var _0x150dbb=[];_0x5d6fc2[_0x3f87('0x6')](/[ ,]+/)[_0x3f87('0x28')](function(_0x2f0f05){_0x2f0f05=_0x2f0f05['replace'](/([^:]")"+/g,'$1');_0x2f0f05='+'+_0x2f0f05+'*';var _0x5c6082=/[ `!@#$%^&*()_\-?~]/;if(_0x2f0f05['match'](_0x5c6082))_0x2f0f05='\x22'+_0x2f0f05+'\x22';_0x150dbb[_0x3f87('0x29')](_0x2f0f05);});return _0x150dbb[_0x3f87('0x2a')]('\x20');};exports[_0x3f87('0x2b')]=function(_0x1d731a,_0x25e332,_0x5e4570){var _0x2d2d4c={},_0x50449c={};if(_0x25e332[_0x3f87('0x2c')][_0x3f87('0x2d')]){_0x25e332[_0x3f87('0x2c')]['id']=_0x25e332[_0x3f87('0x2c')][_0x3f87('0x2d')];delete _0x25e332[_0x3f87('0x2c')][_0x3f87('0x2d')];}_0x2d2d4c['model']=_['map'](_0x1d731a,_0x3f87('0x2e'));_0x2d2d4c[_0x3f87('0x2c')]=_[_0x3f87('0x3')](_0x25e332[_0x3f87('0x2c')]);_0x2d2d4c[_0x3f87('0x2f')]=_[_0x3f87('0x30')](_0x2d2d4c[_0x3f87('0x31')],_0x2d2d4c['query']);_0x50449c[_0x3f87('0x32')]=_['intersection'](_0x2d2d4c[_0x3f87('0x31')],this[_0x3f87('0x5')](_0x25e332[_0x3f87('0x2c')][_0x3f87('0x5')]));_0x50449c['attributes']=_0x50449c[_0x3f87('0x32')]['length']?_0x50449c[_0x3f87('0x32')]:_0x2d2d4c[_0x3f87('0x31')];if(!_0x25e332[_0x3f87('0x2c')][_0x3f87('0x22')](_0x3f87('0x33'))){_0x50449c['limit']=this['limit'](_0x25e332['query'][_0x3f87('0x15')]);_0x50449c[_0x3f87('0x16')]=this[_0x3f87('0x16')](_0x25e332[_0x3f87('0x2c')][_0x3f87('0x16')]);}_0x50449c[_0x3f87('0x34')]=this['sort'](_0x25e332[_0x3f87('0x2c')]['sort']);_0x50449c[_0x3f87('0x35')]=this[_0x3f87('0x2f')](_['pick'](_0x25e332[_0x3f87('0x2c')],_0x2d2d4c[_0x3f87('0x2f')]),_0x1d731a);if(_0x25e332[_0x3f87('0x2c')]['filter']){var _0x246976=_0x1d731a;var _0x588915=_0x25e332['query'][_0x3f87('0x36')];if(typeof _0x588915===_0x3f87('0x37')){_0x246976=_[_0x3f87('0x36')](_0x1d731a,function(_0x13a662){return _[_0x3f87('0x4')](_0x588915['columns'],_0x13a662[_0x3f87('0x2e')]);});_0x588915=_0x588915[_0x3f87('0x38')];}_0x50449c[_0x3f87('0x35')]=_[_0x3f87('0x39')](_0x50449c['where'],{'$or':_[_0x3f87('0x3a')](_0x246976,function(_0x458c79){if(_0x458c79[_0x3f87('0xa')]!==_0x3f87('0x3b')){if(_0x5e4570){return sequelize[_0x3f87('0x35')](sequelize['fn'](_0x3f87('0x3c'),sequelize[_0x3f87('0x19')](_0x458c79[_0x3f87('0x2e')])),{'$like':sequelize['fn']('lower','%'+_0x25e332['query'][_0x3f87('0x36')]+'%')});}else{var _0x2a234={};_0x2a234[_0x458c79[_0x3f87('0x2e')]]={'$like':'%'+_0x25e332[_0x3f87('0x2c')][_0x3f87('0x36')]+'%'};return _0x2a234;}}})});}_0x50449c=_[_0x3f87('0x39')]({},_0x50449c,_0x25e332[_0x3f87('0x3d')]);return _0x50449c;}; \ No newline at end of file +var _0xf072=['DESC','unsigned','ASC','omit','isString','length','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','getFullTextValue','forEach','replace','push','join','getOptions','query','$id','model','intersection','attributes','nolimit','limit','offset','pick','filter','object','includes','columns','where','merge','type','lower','col','options','lodash','sequelize','moment','parse','keys','fields','split','filters','forOwn','DATE','isPlainObject','$gte','YYYY-MM-DD','utc','format','$lte','subtract','name','uniqueid','isArray','sort','map','cast','priority','substr'];(function(_0x92354d,_0xcbd1ac){var _0x57f449=function(_0x19658f){while(--_0x19658f){_0x92354d['push'](_0x92354d['shift']());}};_0x57f449(++_0xcbd1ac);}(_0xf072,0x1cf));var _0x2f07=function(_0x42d807,_0x466d1c){_0x42d807=_0x42d807-0x0;var _0x2b4c01=_0xf072[_0x42d807];return _0x2b4c01;};'use strict';var _=require(_0x2f07('0x0'));var sequelize=require(_0x2f07('0x1'));var moment=require(_0x2f07('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4f62b0){var _0x3c1c25=['ne'];try{var _0x5f20e3=JSON[_0x2f07('0x3')](_0x4f62b0);var _0x432696=Object[_0x2f07('0x4')](_0x5f20e3)[0x0];return _0x3c1c25['includes'](_0x432696);}catch(_0x1d5a33){return![];}}function getOperatorValue(_0x14d6e6){var _0x3643bb=JSON[_0x2f07('0x3')](_0x14d6e6);var _0x235418=Object[_0x2f07('0x4')](_0x3643bb)[0x0];var _0x33b99c=_0x3643bb[_0x235418];return{['$'+_0x235418]:_0x33b99c};}exports[_0x2f07('0x5')]=function(_0x4746c2){var _0x2e167=null;if(_0x4746c2){_0x2e167=_0x4746c2[_0x2f07('0x6')](',');}return _0x2e167;};exports[_0x2f07('0x7')]=function(_0x1a3848,_0x18fe13){var _0x14e237={};if(!_['isEmpty'](_0x1a3848)){_[_0x2f07('0x8')](_0x1a3848,function(_0x2f464b,_0x1d0812){try{if(_0x18fe13){var _0x3525be=_['find'](_0x18fe13,{'name':_0x1d0812})||{};if(hasSequelizeOperator(_0x2f464b)){_0x14e237[_0x1d0812]=getOperatorValue(_0x2f464b);}else if(_0x3525be['type']===_0x2f07('0x9')&&_[_0x2f07('0xa')](_0x2f464b)){var _0x58549c=JSON[_0x2f07('0x3')](_0x2f464b);var _0x34dbd4={'$gte':moment(moment(_0x58549c[_0x2f07('0xb')])['format'](_0x2f07('0xc')))[_0x2f07('0xd')]()[_0x2f07('0xe')](),'$lte':moment(moment(_0x58549c[_0x2f07('0xf')])[_0x2f07('0xe')](_0x2f07('0xc')))['utc']()[_0x2f07('0x10')](0x1,'s')['format']()};_0x14e237[_0x1d0812]=_0x34dbd4;}else if(_0x3525be[_0x2f07('0x11')]===_0x2f07('0x12')){_0x14e237[_0x1d0812]=_0x2f464b;}else{_0x14e237[_0x1d0812]=_[_0x2f07('0x13')](_0x2f464b)?_0x2f464b:JSON[_0x2f07('0x3')](_0x2f464b);}}else{_0x14e237[_0x1d0812]=_[_0x2f07('0x13')](_0x2f464b)?_0x2f464b:JSON[_0x2f07('0x3')](_0x2f464b);}}catch(_0x1a6135){_0x14e237[_0x1d0812]=_0x2f464b[_0x2f07('0x6')](',');}});}return _0x14e237;};exports['limit']=function(_0x15c3dd){_0x15c3dd=parseInt(_0x15c3dd,0xa);if(!_0x15c3dd||_0x15c3dd<0x0){_0x15c3dd=LIMIT_VALUE;}return _0x15c3dd;};exports['offset']=function(_0x3cd3c0){_0x3cd3c0=parseInt(_0x3cd3c0,0xa);if(!_0x3cd3c0||_0x3cd3c0<0x0){_0x3cd3c0=0x0;}return _0x3cd3c0;};exports[_0x2f07('0x14')]=function(_0x119b68){var _0xd944d6,_0x2ef47d=null;if(_0x119b68){_0xd944d6=_0x119b68['split'](',');_0x2ef47d=_[_0x2f07('0x15')](_0xd944d6,function(_0x5a0146){if(_0x5a0146['indexOf']('-')===0x0){return[_0x5a0146==='priority'?sequelize[_0x2f07('0x16')](sequelize['col'](_0x2f07('0x17')),'unsigned'):_0x5a0146[_0x2f07('0x18')](0x1),_0x2f07('0x19')];}else{return[_0x5a0146===_0x2f07('0x17')?sequelize[_0x2f07('0x16')](sequelize['col'](_0x2f07('0x17')),_0x2f07('0x1a')):_0x5a0146,_0x2f07('0x1b')];}});}return _0x2ef47d;};exports['omit']=function(_0x111376,_0x113916){if(_['isEmpty'](_0x111376)){return _0x111376;}if(_[_0x2f07('0x13')](_0x111376)){for(var _0x1c9ca1=0x0;_0x1c9ca1<_0x111376['length'];_0x1c9ca1+=0x1){_0x111376[_0x1c9ca1]=this[_0x2f07('0x1c')](_0x111376[_0x1c9ca1],_0x113916);}return _0x111376;}if(!_['isObject'](_0x111376)){return _0x111376;}if(_[_0x2f07('0x1d')](_0x113916)){_0x113916=[_0x113916];}if(!_[_0x2f07('0x13')](_0x113916)){return _0x111376;}for(var _0x27bd72=0x0;_0x27bd72<_0x113916[_0x2f07('0x1e')];_0x27bd72+=0x1){_[_0x2f07('0x1f')](_0x111376,_0x113916[_0x27bd72]);}for(var _0x139ea8 in _0x111376){if(_0x111376[_0x2f07('0x20')](_0x139ea8)){_0x111376[_0x139ea8]=this[_0x2f07('0x1c')](_0x111376[_0x139ea8],_0x113916);}}return _0x111376;};exports[_0x2f07('0x21')]=function(_0x468cd8){return _0x468cd8[_0x2f07('0x22')](RegExp(_0x2f07('0x23')))?!![]:![];};exports['isEmail']=function(_0x1accef){return _0x1accef[_0x2f07('0x22')](/^\S+@\S+$/)?!![]:![];};exports[_0x2f07('0x24')]=function(_0x571839){var _0x36d4b8=[];_0x571839[_0x2f07('0x6')](/[ ,]+/)[_0x2f07('0x25')](function(_0x5ad0de){_0x5ad0de=_0x5ad0de[_0x2f07('0x26')](/([^:]")"+/g,'$1');_0x5ad0de='+'+_0x5ad0de+'*';var _0x368e3d=/[ `!@#$%^&*()_\-?~]/;if(_0x5ad0de[_0x2f07('0x22')](_0x368e3d))_0x5ad0de='\x22'+_0x5ad0de+'\x22';_0x36d4b8[_0x2f07('0x27')](_0x5ad0de);});return _0x36d4b8[_0x2f07('0x28')]('\x20');};exports[_0x2f07('0x29')]=function(_0x3fed73,_0x5c7593,_0x1decd1){var _0x5b0407={},_0x3496eb={};if(_0x5c7593[_0x2f07('0x2a')][_0x2f07('0x2b')]){_0x5c7593[_0x2f07('0x2a')]['id']=_0x5c7593[_0x2f07('0x2a')][_0x2f07('0x2b')];delete _0x5c7593[_0x2f07('0x2a')][_0x2f07('0x2b')];}_0x5b0407[_0x2f07('0x2c')]=_[_0x2f07('0x15')](_0x3fed73,_0x2f07('0x11'));_0x5b0407[_0x2f07('0x2a')]=_[_0x2f07('0x4')](_0x5c7593[_0x2f07('0x2a')]);_0x5b0407[_0x2f07('0x7')]=_[_0x2f07('0x2d')](_0x5b0407['model'],_0x5b0407['query']);_0x3496eb[_0x2f07('0x2e')]=_[_0x2f07('0x2d')](_0x5b0407[_0x2f07('0x2c')],this['fields'](_0x5c7593['query'][_0x2f07('0x5')]));_0x3496eb['attributes']=_0x3496eb[_0x2f07('0x2e')][_0x2f07('0x1e')]?_0x3496eb[_0x2f07('0x2e')]:_0x5b0407[_0x2f07('0x2c')];if(!_0x5c7593[_0x2f07('0x2a')]['hasOwnProperty'](_0x2f07('0x2f'))){_0x3496eb['limit']=this[_0x2f07('0x30')](_0x5c7593['query'][_0x2f07('0x30')]);_0x3496eb['offset']=this['offset'](_0x5c7593[_0x2f07('0x2a')][_0x2f07('0x31')]);}_0x3496eb['order']=this[_0x2f07('0x14')](_0x5c7593[_0x2f07('0x2a')][_0x2f07('0x14')]);_0x3496eb['where']=this[_0x2f07('0x7')](_[_0x2f07('0x32')](_0x5c7593[_0x2f07('0x2a')],_0x5b0407[_0x2f07('0x7')]),_0x3fed73);if(_0x5c7593[_0x2f07('0x2a')][_0x2f07('0x33')]){var _0x1a0ef2=_0x3fed73;var _0x1a9645=_0x5c7593['query'][_0x2f07('0x33')];if(typeof _0x1a9645===_0x2f07('0x34')){_0x1a0ef2=_[_0x2f07('0x33')](_0x3fed73,function(_0x3f1b6b){return _[_0x2f07('0x35')](_0x1a9645[_0x2f07('0x36')],_0x3f1b6b[_0x2f07('0x11')]);});_0x1a9645=_0x1a9645['value'];}_0x3496eb[_0x2f07('0x37')]=_[_0x2f07('0x38')](_0x3496eb[_0x2f07('0x37')],{'$or':_[_0x2f07('0x15')](_0x1a0ef2,function(_0x3db7ad){if(_0x3db7ad[_0x2f07('0x39')]!=='VIRTUAL'){if(_0x1decd1){return sequelize[_0x2f07('0x37')](sequelize['fn'](_0x2f07('0x3a'),sequelize[_0x2f07('0x3b')](_0x3db7ad[_0x2f07('0x11')])),{'$like':sequelize['fn']('lower','%'+_0x5c7593['query'][_0x2f07('0x33')]+'%')});}else{var _0x437e94={};_0x437e94[_0x3db7ad[_0x2f07('0x11')]]={'$like':'%'+_0x5c7593[_0x2f07('0x2a')]['filter']+'%'};return _0x437e94;}}})});}_0x3496eb=_[_0x2f07('0x38')]({},_0x3496eb,_0x5c7593[_0x2f07('0x3c')]);return _0x3496eb;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index e5f13b2..40c05c7 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8f2=['getRealtimeAgents','pause','*pause','busy','isArray','Queue','map','findOne','all','flatten','getAgentIdsByQueues','includes','getAgentIdsByStatus','then','findAll','fullname','faxPause','whatsappPause','find','getSortedAgentsIdsByStatus','split','fields','globalStatus','order','startsWith','ASC','internal','indexOf','validateSortParameter','sort','DESC','pauseType','toLowerCase','sortAgentsByStatus','userpic','online','lastPauseAt','address','openchannelCapacity','mailCapacity','faxCapacity','chatCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','mailStatus','smsStatus','faxStatus','openchannelStatusTime','mailStatusTime','whatsappStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','pick','filterAgentAttributes','lodash','jayson/promise','client','http','chatPause','mailPause','openchannelPause','smsPause','filter','length','unknown','unavailable','ringing','isNil','voiceStatus','idle','voicePause','every','openchannelStatus','whatsappStatus','request','Agents','result','error','merge','catch'];(function(_0x528a2e,_0x2bd9f3){var _0x1e4928=function(_0x2bbb4c){while(--_0x2bbb4c){_0x528a2e['push'](_0x528a2e['shift']());}};_0x1e4928(++_0x2bd9f3);}(_0xd8f2,0x142));var _0x2d8f=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xd8f2[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x2d8f('0x0'));var jayson=require(_0x2d8f('0x1'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0x2d8f('0x2')][_0x2d8f('0x3')]({'port':0x232a});var routingClient=jayson[_0x2d8f('0x2')]['http']({'port':0x232c});function isAgentPaused(_0x5c56dc,_0x7bc8f3){var _0x193d8d=[_0x5c56dc[_0x2d8f('0x4')],_0x5c56dc['faxPause'],_0x5c56dc[_0x2d8f('0x5')],_0x5c56dc[_0x2d8f('0x6')],_0x5c56dc[_0x2d8f('0x7')],_0x5c56dc['voicePause'],_0x5c56dc['whatsappPause']];if(!_0x7bc8f3)return _['every'](_0x193d8d);var _0x58e136=_[_0x2d8f('0x8')](_0x193d8d);return _0x58e136[_0x2d8f('0x9')]>0x0&&_0x58e136['length']<_0x193d8d[_0x2d8f('0x9')]?!![]:![];}function isIdle(_0x28b316){return _0x28b316==='idle'||_0x28b316===_0x2d8f('0xa')||_0x28b316===_0x2d8f('0xb')||_0x28b316===_0x2d8f('0xc')||_[_0x2d8f('0xd')](_0x28b316);}function isAgentIdle(_0xe5f065){if(_0xe5f065[_0x2d8f('0xe')]!==_0x2d8f('0xf')&&_0xe5f065[_0x2d8f('0x10')]){_0xe5f065['voiceStatus']='pause';return![];}return _[_0x2d8f('0x11')]([_0xe5f065['chatStatus'],_0xe5f065['faxStatus'],_0xe5f065['mailStatus'],_0xe5f065[_0x2d8f('0x12')],_0xe5f065['smsStatus'],_0xe5f065[_0x2d8f('0xe')],_0xe5f065[_0x2d8f('0x13')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x2d8f('0x14')](_0x2d8f('0x15'),{})['then'](function(_0x35f90b){if(_0x35f90b['error']){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x5a87e4=_0x35f90b[_0x2d8f('0x16')];return routingClient['request']('Agents',{})['then'](function(_0x5bff8e){if(_0x5bff8e[_0x2d8f('0x17')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x301e8e=_0x5bff8e['result'];return _[_0x2d8f('0x18')]({},_0x5a87e4,_0x301e8e);});})[_0x2d8f('0x19')](function(_0x1175f8){throw _0x1175f8;});}exports[_0x2d8f('0x1a')]=getRealtimeAgents;function getAgentStatus(_0x2a9325){var _0x586726=_0x2d8f('0xa');if(isAgentPaused(_0x2a9325))_0x586726=_0x2d8f('0x1b');else if(isAgentPaused(_0x2a9325,!![]))_0x586726=_0x2d8f('0x1c');else if(isAgentIdle(_0x2a9325))_0x586726=_0x2d8f('0xf');else _0x586726=_0x2d8f('0x1d');return _0x586726;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0xe0cbc7,_0x2c7d1d){var _0x4bcea3=_[_0x2d8f('0x1e')](_0xe0cbc7)?_0xe0cbc7:[_0xe0cbc7];var _0x4d45a8=_['startCase'](_0x2c7d1d)+_0x2d8f('0x1f');var _0x478f31=_[_0x2d8f('0x20')](_0x4bcea3,function(_0x52e93d){return db[_0x4d45a8][_0x2d8f('0x21')]({'where':{'id':_0x52e93d}})['then'](function(_0x15de20){if(!_0x15de20)return[];return _0x15de20['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0x2d8f('0x22')](_0x478f31)['then'](function(_0x3d80ae){var _0x5c80e1=_(_0x3d80ae)[_0x2d8f('0x23')]()[_0x2d8f('0x20')]('id')['uniq']()['value']();return _0x5c80e1;});}exports[_0x2d8f('0x24')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x15ef81,_0xad1370,_0x1eed3f){try{if(_0xad1370[_0x2d8f('0x9')]>0x0){_0x15ef81=_0x15ef81[_0x2d8f('0x8')](function(_0x3c2615){return _0xad1370[_0x2d8f('0x25')](_0x3c2615['id']);});}var _0x5d6b14=_0x15ef81[_0x2d8f('0x8')](function(_0x495791){var _0x1db61f=_0x2d8f('0x1d');if(isAgentIdle(_0x495791)){_0x1db61f=_0x2d8f('0xf');}return _0x1db61f===_0x1eed3f;});return _[_0x2d8f('0x20')](_0x5d6b14,'id');}catch(_0x4feba5){throw _0x4feba5;}}exports[_0x2d8f('0x26')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x1a5e61,_0x1065be,_0x1ed5e3){return Promise['resolve']()['then'](function(){if(_0x1065be[_0x2d8f('0x9')]>0x0){_0x1a5e61=_0x1a5e61[_0x2d8f('0x8')](function(_0x1dc6e2){return _0x1065be[_0x2d8f('0x25')](_0x1dc6e2['id']);});}return _0x1a5e61;})[_0x2d8f('0x27')](function(){return db['User'][_0x2d8f('0x28')]({'attributes':['id','name',_0x2d8f('0x29'),_0x2d8f('0x4'),_0x2d8f('0x2a'),_0x2d8f('0x5'),_0x2d8f('0x6'),_0x2d8f('0x7'),_0x2d8f('0x10'),_0x2d8f('0x2b'),'pauseType'],'where':{'id':{'$in':_['map'](_0x1a5e61,'id')}},'raw':!![]});})[_0x2d8f('0x27')](function(_0x1cda9a){return _0x1cda9a[_0x2d8f('0x20')](function(_0x166fcf){var _0x1d9a9b=_[_0x2d8f('0x2c')](_0x1a5e61,['id',_0x166fcf['id']]);var _0xbe4c34=filterAgentAttributes(_0x1d9a9b);_[_0x2d8f('0x18')](_0x166fcf,_0xbe4c34);_0x166fcf['globalStatus']=getAgentStatus(_0x166fcf);return _0x166fcf;});})['then'](function(_0x3bed73){var _0x293e30=sortAgentsByStatus(_0x3bed73,_0x1ed5e3);return _[_0x2d8f('0x20')](_0x293e30,'id');})['catch'](function(_0x2c3183){throw _0x2c3183;});}exports[_0x2d8f('0x2d')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x4f93b4){var _0x252ec3={'fields':[],'order':null};var _0xdb3487=_0x4f93b4[_0x2d8f('0x2e')](',');_0x252ec3[_0x2d8f('0x2f')]=_[_0x2d8f('0x8')](_0xdb3487,function(_0x398230){if(!_0x398230[_0x2d8f('0x25')](_0x2d8f('0x30'))){return!![];}_0x252ec3[_0x2d8f('0x31')]=_[_0x2d8f('0x32')](_0x398230,'-')?'DESC':_0x2d8f('0x33');return![];});return _0x252ec3;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x1320dd){if(_0x1320dd[_0x2d8f('0x25')](_0x2d8f('0x29'))&&!_0x1320dd[_0x2d8f('0x25')](_0x2d8f('0x34'))){var _0x5a8ede=_0x1320dd['substring'](0x0,_0x1320dd[_0x2d8f('0x35')](_0x2d8f('0x29')));_0x1320dd+=','+_0x5a8ede+'internal';}return _0x1320dd;}exports[_0x2d8f('0x36')]=validateSortParameter;function sortAgentsByStatus(_0x42c6ef,_0x71bd56){var _0x1d5c48=_0x42c6ef[_0x2d8f('0x37')](function(_0x37f656,_0x373522){if(_0x37f656[_0x2d8f('0x30')]===_0x373522[_0x2d8f('0x30')]){if(_0x37f656[_0x2d8f('0x30')]===_0x2d8f('0x1b')){if(_0x71bd56===_0x2d8f('0x38')){return(_0x37f656[_0x2d8f('0x39')]||'')<(_0x373522['pauseType']||'')||_0x37f656[_0x2d8f('0x29')][_0x2d8f('0x3a')]()>_0x373522[_0x2d8f('0x29')]['toLowerCase']()?0x1:-0x1;}else{return(_0x37f656['pauseType']||'')<(_0x373522['pauseType']||'')||_0x37f656[_0x2d8f('0x29')][_0x2d8f('0x3a')]()>_0x373522[_0x2d8f('0x29')][_0x2d8f('0x3a')]()?-0x1:0x1;}}else{if(_0x71bd56===_0x2d8f('0x38')){return _0x37f656['fullname'][_0x2d8f('0x3a')]()<_0x373522[_0x2d8f('0x29')]['toLowerCase']()?0x1:-0x1;}else{return _0x37f656['fullname'][_0x2d8f('0x3a')]()<_0x373522[_0x2d8f('0x29')][_0x2d8f('0x3a')]()?-0x1:0x1;}}}else{if(_0x71bd56===_0x2d8f('0x38')){return _0x37f656['globalStatus']<_0x373522[_0x2d8f('0x30')]?0x1:-0x1;}else{return _0x37f656[_0x2d8f('0x30')]<_0x373522[_0x2d8f('0x30')]?-0x1:0x1;}}});return _0x1d5c48;}exports[_0x2d8f('0x3b')]=sortAgentsByStatus;function filterAgentAttributes(_0x147068){var _0x2b4e82=[_0x2d8f('0x3c'),_0x2d8f('0x3d'),'lastLoginAt',_0x2d8f('0x3e'),_0x2d8f('0x39'),_0x2d8f('0x3e'),_0x2d8f('0x34'),_0x2d8f('0x3f'),_0x2d8f('0x4'),_0x2d8f('0x6'),_0x2d8f('0x5'),_0x2d8f('0x7'),_0x2d8f('0x2b'),_0x2d8f('0x2a'),_0x2d8f('0x10'),'chatCapacity',_0x2d8f('0x40'),_0x2d8f('0x41'),'smsCapacity','whatsappCapacity',_0x2d8f('0x42'),_0x2d8f('0x43'),'openchannelCurrentCapacity',_0x2d8f('0x44'),_0x2d8f('0x45'),_0x2d8f('0x46'),_0x2d8f('0x47'),'chatStatus',_0x2d8f('0x12'),_0x2d8f('0x48'),_0x2d8f('0x49'),_0x2d8f('0x13'),_0x2d8f('0x4a'),_0x2d8f('0xe'),'chatStatusTime',_0x2d8f('0x4b'),_0x2d8f('0x4c'),'smsStatusTime',_0x2d8f('0x4d'),'faxStatusTime',_0x2d8f('0x4e'),_0x2d8f('0x4f'),_0x2d8f('0x50'),_0x2d8f('0x51'),_0x2d8f('0x52'),_0x2d8f('0x53'),_0x2d8f('0x54')];var _0x3308a5=[_0x2d8f('0x4'),_0x2d8f('0x6'),'mailPause',_0x2d8f('0x7'),'whatsappPause',_0x2d8f('0x2a'),'voicePause',_0x2d8f('0x3d')];var _0x2d928f=_(_0x147068)['omit'](_0x3308a5)[_0x2d8f('0x55')](_0x2b4e82)['value']();return _0x2d928f;}exports[_0x2d8f('0x56')]=filterAgentAttributes; \ No newline at end of file +var _0x0964=['fields','order','DESC','getUpdatedSortOptions','internal','substring','indexOf','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','openchannelStatusTime','mailStatusTime','whatsappStatusTime','faxStatusTime','queue','destconnectedlinenum','screenrecording','routealias','omit','pick','lodash','../../mysqldb','client','chatPause','faxPause','smsPause','every','filter','length','idle','unknown','unavailable','isNil','voiceStatus','voicePause','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Agents','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','*pause','busy','isArray','startCase','Queue','findOne','getAgents','all','flatten','value','getAgentIdsByQueues','includes','map','getAgentIdsByStatus','User','findAll','fullname','mailPause','openchannelPause','whatsappPause','pauseType','find','globalStatus','getSortedAgentsIdsByStatus','split'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x0964,0x194));var _0x4096=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x0964[_0x2070da];return _0x4f9fe1;};'use strict';var _=require(_0x4096('0x0'));var jayson=require('jayson/promise');var db=require(_0x4096('0x1'))['db'];var amiClient=jayson[_0x4096('0x2')]['http']({'port':0x232a});var routingClient=jayson[_0x4096('0x2')]['http']({'port':0x232c});function isAgentPaused(_0x7b3648,_0x5db5d8){var _0x2ee97b=[_0x7b3648[_0x4096('0x3')],_0x7b3648[_0x4096('0x4')],_0x7b3648['mailPause'],_0x7b3648['openchannelPause'],_0x7b3648[_0x4096('0x5')],_0x7b3648['voicePause'],_0x7b3648['whatsappPause']];if(!_0x5db5d8)return _[_0x4096('0x6')](_0x2ee97b);var _0x2094ba=_[_0x4096('0x7')](_0x2ee97b);return _0x2094ba[_0x4096('0x8')]>0x0&&_0x2094ba['length']<_0x2ee97b[_0x4096('0x8')]?!![]:![];}function isIdle(_0x194901){return _0x194901===_0x4096('0x9')||_0x194901===_0x4096('0xa')||_0x194901===_0x4096('0xb')||_0x194901==='ringing'||_[_0x4096('0xc')](_0x194901);}function isAgentIdle(_0x7c201e){if(_0x7c201e[_0x4096('0xd')]!==_0x4096('0x9')&&_0x7c201e[_0x4096('0xe')]){_0x7c201e[_0x4096('0xd')]=_0x4096('0xf');return![];}return _[_0x4096('0x6')]([_0x7c201e[_0x4096('0x10')],_0x7c201e[_0x4096('0x11')],_0x7c201e[_0x4096('0x12')],_0x7c201e[_0x4096('0x13')],_0x7c201e[_0x4096('0x14')],_0x7c201e[_0x4096('0xd')],_0x7c201e[_0x4096('0x15')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x4096('0x16')]('Agents',{})[_0x4096('0x17')](function(_0x3d918d){if(_0x3d918d['error']){throw new Error(_0x4096('0x18'));}var _0x3507c7=_0x3d918d[_0x4096('0x19')];return routingClient[_0x4096('0x16')](_0x4096('0x1a'),{})[_0x4096('0x17')](function(_0x10cdab){if(_0x10cdab[_0x4096('0x1b')]){throw new Error(_0x4096('0x1c'));}var _0x3ce861=_0x10cdab['result'];return _[_0x4096('0x1d')]({},_0x3507c7,_0x3ce861);});})[_0x4096('0x1e')](function(_0x448c83){throw _0x448c83;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x1faed0){var _0x1b3412=_0x4096('0xa');if(isAgentPaused(_0x1faed0))_0x1b3412=_0x4096('0xf');else if(isAgentPaused(_0x1faed0,!![]))_0x1b3412=_0x4096('0x1f');else if(isAgentIdle(_0x1faed0))_0x1b3412=_0x4096('0x9');else _0x1b3412=_0x4096('0x20');return _0x1b3412;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x255ae0,_0x40dba7){var _0x3465b5=_[_0x4096('0x21')](_0x255ae0)?_0x255ae0:[_0x255ae0];var _0x1e82f8=_[_0x4096('0x22')](_0x40dba7)+_0x4096('0x23');var _0x73a54c=_['map'](_0x3465b5,function(_0x587cf3){return db[_0x1e82f8][_0x4096('0x24')]({'where':{'id':_0x587cf3}})[_0x4096('0x17')](function(_0x1dfaba){if(!_0x1dfaba)return[];return _0x1dfaba[_0x4096('0x25')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x4096('0x26')](_0x73a54c)[_0x4096('0x17')](function(_0x3132e1){var _0x48c28b=_(_0x3132e1)[_0x4096('0x27')]()['map']('id')['uniq']()[_0x4096('0x28')]();return _0x48c28b;});}exports[_0x4096('0x29')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x41450b,_0x41e741,_0x58c233){try{if(_0x41e741['length']>0x0){_0x41450b=_0x41450b['filter'](function(_0x162c01){return _0x41e741[_0x4096('0x2a')](_0x162c01['id']);});}var _0x57c2cc=_0x41450b['filter'](function(_0x539c01){var _0x3d91cd='busy';if(isAgentIdle(_0x539c01)){_0x3d91cd=_0x4096('0x9');}return _0x3d91cd===_0x58c233;});return _[_0x4096('0x2b')](_0x57c2cc,'id');}catch(_0x22c1ba){throw _0x22c1ba;}}exports[_0x4096('0x2c')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x5e462a,_0x360d36,_0xc06ac8){return Promise['resolve']()[_0x4096('0x17')](function(){if(_0x360d36['length']>0x0){_0x5e462a=_0x5e462a[_0x4096('0x7')](function(_0x3f3726){return _0x360d36['includes'](_0x3f3726['id']);});}return _0x5e462a;})['then'](function(){return db[_0x4096('0x2d')][_0x4096('0x2e')]({'attributes':['id','name',_0x4096('0x2f'),_0x4096('0x3'),_0x4096('0x4'),_0x4096('0x30'),_0x4096('0x31'),'smsPause','voicePause',_0x4096('0x32'),_0x4096('0x33')],'where':{'id':{'$in':_['map'](_0x5e462a,'id')}},'raw':!![]});})[_0x4096('0x17')](function(_0x44b8a2){return _0x44b8a2[_0x4096('0x2b')](function(_0x42b980){var _0x4958e0=_[_0x4096('0x34')](_0x5e462a,['id',_0x42b980['id']]);var _0x5ead7e=filterAgentAttributes(_0x4958e0);_['merge'](_0x42b980,_0x5ead7e);_0x42b980[_0x4096('0x35')]=getAgentStatus(_0x42b980);return _0x42b980;});})[_0x4096('0x17')](function(_0x555c86){var _0x124925=sortAgentsByStatus(_0x555c86,_0xc06ac8);return _[_0x4096('0x2b')](_0x124925,'id');})[_0x4096('0x1e')](function(_0x31d2f6){throw _0x31d2f6;});}exports[_0x4096('0x36')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x1a4af6){var _0x35c73b={'fields':[],'order':null};var _0x202ff6=_0x1a4af6[_0x4096('0x37')](',');_0x35c73b[_0x4096('0x38')]=_[_0x4096('0x7')](_0x202ff6,function(_0x5c7970){if(!_0x5c7970['includes'](_0x4096('0x35'))){return!![];}_0x35c73b[_0x4096('0x39')]=_['startsWith'](_0x5c7970,'-')?_0x4096('0x3a'):'ASC';return![];});return _0x35c73b;}exports[_0x4096('0x3b')]=getUpdatedSortOptions;function validateSortParameter(_0x11a92d){if(_0x11a92d[_0x4096('0x2a')]('fullname')&&!_0x11a92d[_0x4096('0x2a')](_0x4096('0x3c'))){var _0x5dc683=_0x11a92d[_0x4096('0x3d')](0x0,_0x11a92d[_0x4096('0x3e')](_0x4096('0x2f')));_0x11a92d+=','+_0x5dc683+_0x4096('0x3c');}return _0x11a92d;}exports[_0x4096('0x3f')]=validateSortParameter;function sortAgentsByStatus(_0x370322,_0x1151f3){var _0x17da4a=_0x370322[_0x4096('0x40')](function(_0x1a82fd,_0x5873ae){if(_0x1a82fd[_0x4096('0x35')]===_0x5873ae[_0x4096('0x35')]){if(_0x1a82fd[_0x4096('0x35')]===_0x4096('0xf')){if(_0x1151f3===_0x4096('0x3a')){return(_0x1a82fd['pauseType']||'')<(_0x5873ae['pauseType']||'')||_0x1a82fd[_0x4096('0x2f')][_0x4096('0x41')]()>_0x5873ae[_0x4096('0x2f')]['toLowerCase']()?0x1:-0x1;}else{return(_0x1a82fd[_0x4096('0x33')]||'')<(_0x5873ae[_0x4096('0x33')]||'')||_0x1a82fd[_0x4096('0x2f')][_0x4096('0x41')]()>_0x5873ae[_0x4096('0x2f')][_0x4096('0x41')]()?-0x1:0x1;}}else{if(_0x1151f3==='DESC'){return _0x1a82fd[_0x4096('0x2f')][_0x4096('0x41')]()<_0x5873ae[_0x4096('0x2f')][_0x4096('0x41')]()?0x1:-0x1;}else{return _0x1a82fd[_0x4096('0x2f')]['toLowerCase']()<_0x5873ae[_0x4096('0x2f')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x1151f3===_0x4096('0x3a')){return _0x1a82fd['globalStatus']<_0x5873ae[_0x4096('0x35')]?0x1:-0x1;}else{return _0x1a82fd[_0x4096('0x35')]<_0x5873ae['globalStatus']?-0x1:0x1;}}});return _0x17da4a;}exports[_0x4096('0x42')]=sortAgentsByStatus;function filterAgentAttributes(_0x2b3ae6){var _0xbe021b=[_0x4096('0x43'),_0x4096('0x44'),_0x4096('0x45'),_0x4096('0x46'),_0x4096('0x33'),_0x4096('0x46'),_0x4096('0x3c'),_0x4096('0x47'),_0x4096('0x3'),_0x4096('0x31'),_0x4096('0x30'),_0x4096('0x5'),'whatsappPause',_0x4096('0x4'),_0x4096('0xe'),_0x4096('0x48'),_0x4096('0x49'),_0x4096('0x4a'),_0x4096('0x4b'),'whatsappCapacity',_0x4096('0x4c'),_0x4096('0x4d'),_0x4096('0x4e'),_0x4096('0x4f'),_0x4096('0x50'),_0x4096('0x51'),'faxCurrentCapacity',_0x4096('0x10'),_0x4096('0x13'),'mailStatus',_0x4096('0x14'),_0x4096('0x15'),_0x4096('0x11'),_0x4096('0xd'),'chatStatusTime',_0x4096('0x52'),_0x4096('0x53'),'smsStatusTime',_0x4096('0x54'),_0x4096('0x55'),'voiceStatusTime',_0x4096('0x56'),_0x4096('0x57'),_0x4096('0x58'),'phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording',_0x4096('0x59')];var _0x54c167=[_0x4096('0x3'),_0x4096('0x31'),_0x4096('0x30'),_0x4096('0x5'),_0x4096('0x32'),'faxPause','voicePause',_0x4096('0x44')];var _0x51fd2e=_(_0x2b3ae6)[_0x4096('0x5a')](_0x54c167)[_0x4096('0x5b')](_0xbe021b)[_0x4096('0x28')]();return _0x51fd2e;}exports['filterAgentAttributes']=filterAgentAttributes; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 5036697..e1b5878 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x57a670,_0x30e402){var _0x41ce21=function(_0x11bd34){while(--_0x11bd34){_0x57a670['push'](_0x57a670['shift']());}};_0x41ce21(++_0x30e402);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file +var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x538b31,_0x80e294){var _0x4348f0=function(_0x428ae3){while(--_0x428ae3){_0x538b31['push'](_0x538b31['shift']());}};_0x4348f0(++_0x80e294);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 55e6c3a..c543ef2 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 _0xfe77=['model','createHash','md5','update','digest','hex','getUuid','licenseToken','utf8','replace','hostname','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','execSync','../environment','networkInterfaces','orderBy','keys','filter','family','IPv4','internal','concat','head','mac','127.0.0.1','getFirstInterface','cpus','map'];(function(_0x2d126e,_0x1e8257){var _0xcb04d3=function(_0x19a2d9){while(--_0x19a2d9){_0x2d126e['push'](_0x2d126e['shift']());}};_0xcb04d3(++_0x1e8257);}(_0xfe77,0x10d));var _0x7fe7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfe77[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7fe7('0x0'));var os=require('os');var crypto=require(_0x7fe7('0x1'));var machine=require(_0x7fe7('0x2'));var exec=require('child_process')[_0x7fe7('0x3')];var config=require(_0x7fe7('0x4'));function getInterfaces(){var _0x3bd25f=[];var _0x4595d3=os[_0x7fe7('0x5')]();var _0x39b4ef=_[_0x7fe7('0x6')](_[_0x7fe7('0x7')](_0x4595d3));for(var _0x18e480=0x0;_0x18e480<_0x39b4ef['length'];_0x18e480++){var _0x1a0cf5=_0x4595d3[_0x39b4ef[_0x18e480]][_0x7fe7('0x8')](function(_0xe4fe9){return _0xe4fe9[_0x7fe7('0x9')]===_0x7fe7('0xa')&&_0xe4fe9[_0x7fe7('0xb')]===![];});_0x3bd25f=_0x3bd25f[_0x7fe7('0xc')](_0x1a0cf5);}return _0x3bd25f;}function getFirstInterface(){var _0x59e4b2=_[_0x7fe7('0xd')](getInterfaces());return{'macAddress':_0x59e4b2&&_0x59e4b2[_0x7fe7('0xe')]?_0x59e4b2['mac']:'00:00:00:00:00:00','ipAddress':_0x59e4b2&&_0x59e4b2['address']?_0x59e4b2['address']:_0x7fe7('0xf')};}exports[_0x7fe7('0x10')]=getFirstInterface;function getCPUhash(){var _0x39197e=_[_0x7fe7('0x6')](os[_0x7fe7('0x11')]()[_0x7fe7('0x12')](function(_0xa56236){return _0xa56236[_0x7fe7('0x13')];}))['join'](':');return crypto[_0x7fe7('0x14')](_0x7fe7('0x15'))[_0x7fe7('0x16')](_0x39197e)[_0x7fe7('0x17')](_0x7fe7('0x18'));}exports[_0x7fe7('0x19')]=function(){var _0x24a44f=os['platform']();var _0x3bb7f8=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x3bb7f8['test'](config['licenseToken'])){return config[_0x7fe7('0x1a')];}else if(_0x24a44f==='win32'){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x7fe7('0x1b')})[_0x7fe7('0x1c')]('\x0d\x0a','');}else{var _0x15f46a=getFirstInterface();var _0x4fe265=getCPUhash();var _0x1cf06c=_0x4fe265+'|'+os[_0x7fe7('0x1d')]()+'|'+_0x15f46a['macAddress']+'|'+_0x15f46a[_0x7fe7('0x1e')];var _0x1b0915=crypto[_0x7fe7('0x14')]('md5')[_0x7fe7('0x16')](_0x1cf06c)[_0x7fe7('0x17')](_0x7fe7('0x18'));return _0x1b0915['substring'](0x0,0x8)+'-'+_0x1b0915[_0x7fe7('0x1f')](0x8,0xc)+'-'+_0x1b0915[_0x7fe7('0x1f')](0xc,0x10)+'-'+_0x1b0915[_0x7fe7('0x1f')](0x10,0x14)+'-'+_0x1b0915[_0x7fe7('0x1f')](0x14);}}; \ No newline at end of file +var _0x2db6=['00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','md5','update','digest','getUuid','platform','licenseToken','test','win32','utf8','replace','hostname','ipAddress','hex','substring','lodash','crypto','child_process','execSync','../environment','networkInterfaces','orderBy','keys','length','family','internal','concat','head','mac'];(function(_0x149429,_0x1903ca){var _0x39c439=function(_0x530bd6){while(--_0x530bd6){_0x149429['push'](_0x149429['shift']());}};_0x39c439(++_0x1903ca);}(_0x2db6,0x13f));var _0x62db=function(_0x5c8d9c,_0x898212){_0x5c8d9c=_0x5c8d9c-0x0;var _0x1d3731=_0x2db6[_0x5c8d9c];return _0x1d3731;};'use strict';var _=require(_0x62db('0x0'));var os=require('os');var crypto=require(_0x62db('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0x62db('0x2'))[_0x62db('0x3')];var config=require(_0x62db('0x4'));function getInterfaces(){var _0x9ae9bf=[];var _0x18d1f1=os[_0x62db('0x5')]();var _0x4c22cb=_[_0x62db('0x6')](_[_0x62db('0x7')](_0x18d1f1));for(var _0xe0cc8f=0x0;_0xe0cc8f<_0x4c22cb[_0x62db('0x8')];_0xe0cc8f++){var _0x4221c2=_0x18d1f1[_0x4c22cb[_0xe0cc8f]]['filter'](function(_0x5c5ad7){return _0x5c5ad7[_0x62db('0x9')]==='IPv4'&&_0x5c5ad7[_0x62db('0xa')]===![];});_0x9ae9bf=_0x9ae9bf[_0x62db('0xb')](_0x4221c2);}return _0x9ae9bf;}function getFirstInterface(){var _0x419997=_[_0x62db('0xc')](getInterfaces());return{'macAddress':_0x419997&&_0x419997['mac']?_0x419997[_0x62db('0xd')]:_0x62db('0xe'),'ipAddress':_0x419997&&_0x419997[_0x62db('0xf')]?_0x419997[_0x62db('0xf')]:_0x62db('0x10')};}exports[_0x62db('0x11')]=getFirstInterface;function getCPUhash(){var _0xb84382=_[_0x62db('0x6')](os[_0x62db('0x12')]()[_0x62db('0x13')](function(_0x21e89c){return _0x21e89c[_0x62db('0x14')];}))[_0x62db('0x15')](':');return crypto[_0x62db('0x16')](_0x62db('0x17'))[_0x62db('0x18')](_0xb84382)[_0x62db('0x19')]('hex');}exports[_0x62db('0x1a')]=function(){var _0x40c442=os[_0x62db('0x1b')]();var _0x25b395=/[0-9a-f-]{36}/;if(config[_0x62db('0x1c')]&&_0x25b395[_0x62db('0x1d')](config[_0x62db('0x1c')])){return config[_0x62db('0x1c')];}else if(_0x40c442===_0x62db('0x1e')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x62db('0x1f')})[_0x62db('0x20')]('\x0d\x0a','');}else{var _0x1979cc=getFirstInterface();var _0x1f187e=getCPUhash();var _0xc8d3e6=_0x1f187e+'|'+os[_0x62db('0x21')]()+'|'+_0x1979cc['macAddress']+'|'+_0x1979cc[_0x62db('0x22')];var _0x2c7d14=crypto['createHash'](_0x62db('0x17'))[_0x62db('0x18')](_0xc8d3e6)['digest'](_0x62db('0x23'));return _0x2c7d14[_0x62db('0x24')](0x0,0x8)+'-'+_0x2c7d14[_0x62db('0x24')](0x8,0xc)+'-'+_0x2c7d14[_0x62db('0x24')](0xc,0x10)+'-'+_0x2c7d14[_0x62db('0x24')](0x10,0x14)+'-'+_0x2c7d14[_0x62db('0x24')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 48f8162..badc6b2 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 _0x1001=['moment','request-promise','pkginfo','version','../../components/encryptor','./hardware','license','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','data2','active','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','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','finally','License','findOrCreate','spread','util'];(function(_0x2a69e0,_0x1847ed){var _0x477be1=function(_0x5548cf){while(--_0x5548cf){_0x2a69e0['push'](_0x2a69e0['shift']());}};_0x477be1(++_0x1847ed);}(_0x1001,0xbd));var _0x1100=function(_0x1e77ea,_0x5442bf){_0x1e77ea=_0x1e77ea-0x0;var _0x193925=_0x1001[_0x1e77ea];return _0x193925;};'use strict';var util=require(_0x1100('0x0'));var moment=require(_0x1100('0x1'));var rp=require(_0x1100('0x2'));var BPromise=require('bluebird');var pkginfo=require(_0x1100('0x3'))(module,_0x1100('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x1100('0x5'));var hardware=require(_0x1100('0x6'));var logger=require('../logger')(_0x1100('0x7'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x374439){return new BPromise(function(_0x378b64,_0x357811){var _0x5a6577=util[_0x1100('0x8')](_0x1100('0x9'),HOST,_0x374439,module['exports'][_0x1100('0x4')]);if(oldToken){_0x5a6577=util[_0x1100('0x8')](_0x1100('0xa'),HOST,_0x374439,module['exports'][_0x1100('0x4')],oldToken);}var _0x2f803c={'uri':_0x5a6577,'method':_0x1100('0xb'),'timeout':0xea60,'json':!![]};return rp(_0x2f803c)[_0x1100('0xc')](function(_0x172892){_0x378b64(_0x172892);})[_0x1100('0xd')](function(_0x260481){_0x357811(_0x260481);});});}function manageLicense(_0x3f1d1f,_0x230a48){var _0x4a0f82=_0x230a48[_0x1100('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x4a0f82[_0x1100('0xf')]!==_0x3f1d1f&&!_0x4a0f82[_0x1100('0x10')]){oldToken=_0x4a0f82[_0x1100('0xf')];}httpRequest(_0x3f1d1f)['then'](function(_0x23f8fc){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x23f8fc[_0x1100('0x11')]){isOldTokenSent=![];if(!_0x4a0f82[_0x1100('0x7')]&&_0x4a0f82[_0x1100('0x7')]!=_0x23f8fc[_0x1100('0x7')]||_0x4a0f82[_0x1100('0x7')]&&_0x4a0f82[_0x1100('0x10')]){logger[_0x1100('0x12')](_0x1100('0x13'));}if(_0x4a0f82[_0x1100('0x7')]&&!_0x4a0f82[_0x1100('0x10')]&&_0x4a0f82[_0x1100('0x7')]!=_0x23f8fc[_0x1100('0x7')]){logger['info'](_0x1100('0x14'));}if(_0x4a0f82[_0x1100('0x7')]&&!_0x4a0f82[_0x1100('0x10')]&&_0x4a0f82[_0x1100('0x7')]==_0x23f8fc[_0x1100('0x7')]){return _0x230a48;}return _0x230a48[_0x1100('0x15')]({'data1':_0x3f1d1f,'data2':null,'license':_0x23f8fc[_0x1100('0x7')]});}else{if(_0x23f8fc[_0x1100('0x7')]||_0x4a0f82['license']){if(!_0x4a0f82['data2']){if(_0x4a0f82[_0x1100('0xf')]==_0x3f1d1f){GRAY_PERIOD_REASON='Disabled';logger[_0x1100('0x12')](_0x1100('0x16'));}else{GRAY_PERIOD_REASON=_0x1100('0x17');logger['info'](_0x1100('0x18'),_0x4a0f82[_0x1100('0xf')],_0x3f1d1f);}logger[_0x1100('0x12')](_0x1100('0x19'),GRAY_PERIOD_REASON[_0x1100('0x1a')](),moment()[_0x1100('0x8')](_0x1100('0x1b')));return _0x230a48[_0x1100('0x15')]({'data2':encryptor['encryptString'](moment()[_0x1100('0x8')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x1100('0x1c')](encryptor[_0x1100('0x1d')](_0x4a0f82[_0x1100('0x10')]),_0x1100('0x1e'))>DAYS){logger['info'](_0x1100('0x1f'),moment()[_0x1100('0x8')](_0x1100('0x1b')));isOldTokenSent=![];return _0x230a48[_0x1100('0x15')]({'data1':_0x3f1d1f,'data2':null,'license':null});}}}else{if(_0x4a0f82[_0x1100('0xf')]!=_0x3f1d1f){logger['info'](_0x1100('0x18'),_0x4a0f82[_0x1100('0xf')],_0x3f1d1f);return _0x230a48['update']({'data1':_0x3f1d1f,'data2':null,'license':null});}}}return _0x230a48;})[_0x1100('0xc')](function(_0x14257e){_0x230a48=_0x14257e;})[_0x1100('0xd')](function(_0x32ac89){logger[_0x1100('0x20')](_0x32ac89[_0x1100('0x21')]);})[_0x1100('0x22')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x230a48);},TIME);});}function defaultLicense(){var _0x1be6b5=hardware['getUuid']();if(_0x1be6b5){return db[_0x1100('0x23')][_0x1100('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x1be6b5}})[_0x1100('0x25')](function(_0x416cdb,_0x5646a3){logger['info']('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x1be6b5);manageLicense(_0x1be6b5,_0x416cdb);})[_0x1100('0xd')](function(_0xb9a269){logger['error'](_0xb9a269[_0x1100('0x21')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0x6d29=['get','data1','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','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','YYYY-MM-DD\x20HH:mm','encryptString','decryptString','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','default','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','then','catch'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6d29,0x107));var _0x96d2=function(_0x2f027c,_0x316550){_0x2f027c=_0x2f027c-0x0;var _0x381bfb=_0x6d29[_0x2f027c];return _0x381bfb;};'use strict';var util=require(_0x96d2('0x0'));var moment=require(_0x96d2('0x1'));var rp=require(_0x96d2('0x2'));var BPromise=require(_0x96d2('0x3'));var pkginfo=require(_0x96d2('0x4'))(module,_0x96d2('0x5'));var db=require(_0x96d2('0x6'))['db'];var encryptor=require(_0x96d2('0x7'));var hardware=require(_0x96d2('0x8'));var logger=require(_0x96d2('0x9'))(_0x96d2('0xa'));var HOST=_0x96d2('0xb');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x172b44){return new BPromise(function(_0x411072,_0x4d071c){var _0x21368a=util[_0x96d2('0xc')](_0x96d2('0xd'),HOST,_0x172b44,module[_0x96d2('0xe')][_0x96d2('0x5')]);if(oldToken){_0x21368a=util[_0x96d2('0xc')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x172b44,module[_0x96d2('0xe')][_0x96d2('0x5')],oldToken);}var _0x24dfd8={'uri':_0x21368a,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x24dfd8)[_0x96d2('0xf')](function(_0x3ce767){_0x411072(_0x3ce767);})[_0x96d2('0x10')](function(_0x352826){_0x4d071c(_0x352826);});});}function manageLicense(_0x9a8ddf,_0x25e8a4){var _0x2686fa=_0x25e8a4[_0x96d2('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x2686fa[_0x96d2('0x12')]!==_0x9a8ddf&&!_0x2686fa[_0x96d2('0x13')]){oldToken=_0x2686fa['data1'];}httpRequest(_0x9a8ddf)[_0x96d2('0xf')](function(_0x20b4d9){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x20b4d9['active']){isOldTokenSent=![];if(!_0x2686fa[_0x96d2('0xa')]&&_0x2686fa[_0x96d2('0xa')]!=_0x20b4d9['license']||_0x2686fa[_0x96d2('0xa')]&&_0x2686fa[_0x96d2('0x13')]){logger['info'](_0x96d2('0x14'));}if(_0x2686fa[_0x96d2('0xa')]&&!_0x2686fa[_0x96d2('0x13')]&&_0x2686fa[_0x96d2('0xa')]!=_0x20b4d9[_0x96d2('0xa')]){logger[_0x96d2('0x15')](_0x96d2('0x16'));}if(_0x2686fa[_0x96d2('0xa')]&&!_0x2686fa['data2']&&_0x2686fa[_0x96d2('0xa')]==_0x20b4d9[_0x96d2('0xa')]){return _0x25e8a4;}return _0x25e8a4[_0x96d2('0x17')]({'data1':_0x9a8ddf,'data2':null,'license':_0x20b4d9[_0x96d2('0xa')]});}else{if(_0x20b4d9[_0x96d2('0xa')]||_0x2686fa[_0x96d2('0xa')]){if(!_0x2686fa[_0x96d2('0x13')]){if(_0x2686fa['data1']==_0x9a8ddf){GRAY_PERIOD_REASON='Disabled';logger[_0x96d2('0x15')](_0x96d2('0x18'));}else{GRAY_PERIOD_REASON=_0x96d2('0x19');logger[_0x96d2('0x15')](_0x96d2('0x1a'),_0x2686fa[_0x96d2('0x12')],_0x9a8ddf);}logger['info'](_0x96d2('0x1b'),GRAY_PERIOD_REASON['toUpperCase'](),moment()['format'](_0x96d2('0x1c')));return _0x25e8a4[_0x96d2('0x17')]({'data2':encryptor[_0x96d2('0x1d')](moment()[_0x96d2('0xc')](_0x96d2('0x1c')))});}else{if(moment()['diff'](encryptor[_0x96d2('0x1e')](_0x2686fa['data2']),'days')>DAYS){logger['info'](_0x96d2('0x1f'),moment()['format'](_0x96d2('0x1c')));isOldTokenSent=![];return _0x25e8a4[_0x96d2('0x17')]({'data1':_0x9a8ddf,'data2':null,'license':null});}}}else{if(_0x2686fa[_0x96d2('0x12')]!=_0x9a8ddf){logger['info'](_0x96d2('0x1a'),_0x2686fa['data1'],_0x9a8ddf);return _0x25e8a4[_0x96d2('0x17')]({'data1':_0x9a8ddf,'data2':null,'license':null});}}}return _0x25e8a4;})[_0x96d2('0xf')](function(_0x11dfe1){_0x25e8a4=_0x11dfe1;})[_0x96d2('0x10')](function(_0x254298){logger[_0x96d2('0x20')](_0x254298[_0x96d2('0x21')]);})[_0x96d2('0x22')](function(){setTimeout(function(){manageLicense(hardware[_0x96d2('0x23')](),_0x25e8a4);},TIME);});}function defaultLicense(){var _0x3ede90=hardware[_0x96d2('0x23')]();if(_0x3ede90){return db[_0x96d2('0x24')][_0x96d2('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x3ede90}})['spread'](function(_0x600405,_0x153166){logger[_0x96d2('0x15')](_0x96d2('0x26'),_0x3ede90);manageLicense(_0x3ede90,_0x600405);})['catch'](function(_0x40f556){logger['error'](_0x40f556[_0x96d2('0x21')]);});}}exports[_0x96d2('0x27')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index b0fed26..a92d7c5 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 _0xa19f=['defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','parse','demo','machineUuid','gray','deadline','add','days','grayReason','changed','User','findAll','role','sequelize','COUNT','col','admin','user','telephone','users','forEach','count','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','util','lodash','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find'];(function(_0x7f3667,_0x30c3f1){var _0x2c4c24=function(_0xf070f3){while(--_0xf070f3){_0x7f3667['push'](_0x7f3667['shift']());}};_0x2c4c24(++_0x30c3f1);}(_0xa19f,0x174));var _0xfa19=function(_0x5f4006,_0x3af0d3){_0x5f4006=_0x5f4006-0x0;var _0x284bd1=_0xa19f[_0x5f4006];return _0x284bd1;};'use strict';var util=require(_0xfa19('0x0'));var _=require(_0xfa19('0x1'));var moment=require('moment');var BPromise=require(_0xfa19('0x2'));var hardware=require(_0xfa19('0x3'));var encryptor=require(_0xfa19('0x4'));var db=require(_0xfa19('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xfa19('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xfa19('0x7'),'machineUuid':hardware[_0xfa19('0x8')](),'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':_0xfa19('0x9'),'machineUuid':hardware[_0xfa19('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x341d9a){return new BPromise(function(_0x4067f8,_0x2acb02){return db[_0xfa19('0xa')][_0xfa19('0xb')](_[_0xfa19('0xc')](_0x341d9a,{'raw':!![],'where':{'id':0x1}}))[_0xfa19('0xd')](function(_0x25c718){return checkLicense(_0x25c718,null);})[_0xfa19('0xd')](function(_0x3abda6){_0x4067f8(_0x3abda6);return;})[_0xfa19('0xe')](function(_0x10dfd4){_0x2acb02(_0x10dfd4);});});}function checkLicense(_0x4ba46c,_0x47f858){if(!_0x4ba46c){demoLicense[_0xfa19('0xf')]=_0x4ba46c[_0xfa19('0x10')];return demoLicense;}try{var _0xed6204=_0x47f858||_0x4ba46c[_0xfa19('0x11')];if(_[_0xfa19('0x12')](_0xed6204)){throw new Error(_0xfa19('0x13'));}var _0x4faa11=_0x4ba46c[_0xfa19('0x10')];var _0x27b2cc=_0x4ba46c[_0xfa19('0x14')];var _0x149806=_0x4faa11[_0xfa19('0x15')]('-')[0x4];var _0x2de9ef=_0x4faa11[_0xfa19('0x15')]('-')[0x0];var _0x19dc6d=encryptor[_0xfa19('0x16')](_0xed6204,util[_0xfa19('0x17')]('%s:%s:%s',_0x149806,_0x4faa11,_0x2de9ef));var _0x1bbb5a=JSON[_0xfa19('0x18')](_0x19dc6d);_0x1bbb5a[_0xfa19('0x19')]=![];_0x1bbb5a[_0xfa19('0xf')]=_0x4faa11;_0x1bbb5a[_0xfa19('0x1a')]=hardware['getUuid']();if(_0x27b2cc){var _0x57e0a5=encryptor[_0xfa19('0x16')](_0x27b2cc);_0x1bbb5a[_0xfa19('0x1b')]=_0x57e0a5;_0x1bbb5a[_0xfa19('0x1c')]=moment(_0x57e0a5)[_0xfa19('0x1d')](0x7,_0xfa19('0x1e'))[_0xfa19('0x17')]();_0x1bbb5a[_0xfa19('0x1f')]=_0x1bbb5a[_0xfa19('0xf')]!=_0x1bbb5a['machineUuid']?_0xfa19('0x20'):'disabled';}return _0x1bbb5a;}catch(_0x133611){breakingLicense[_0xfa19('0xf')]=_0x4ba46c[_0xfa19('0x10')];breakingLicense['message']=_0x133611['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x47829d,_0x27c987){getLicense()['then'](function(_0x4d7a58){return db[_0xfa19('0x21')][_0xfa19('0x22')]({'attributes':[_0xfa19('0x23'),[db[_0xfa19('0x24')]['fn'](_0xfa19('0x25'),db['sequelize'][_0xfa19('0x26')](_0xfa19('0x23'))),'count']],'group':_0xfa19('0x23'),'where':{'role':{'$or':[_0xfa19('0x27'),_0xfa19('0x28'),_0xfa19('0x29')]}},'raw':!![]})[_0xfa19('0xd')](function(_0x6edb73){var _0xd5550f={'user':_0x4d7a58[_0xfa19('0x2a')]||0x0,'telephone':_0x4d7a58['telephones']||0x0};_0x6edb73[_0xfa19('0x2b')](function(_0x3ec0ea){var _0x1e5df4=_0x3ec0ea[_0xfa19('0x23')]===_0xfa19('0x27')?'user':_0x3ec0ea[_0xfa19('0x23')];_0xd5550f[_0x1e5df4]-=_0x3ec0ea[_0xfa19('0x2c')];if(_0xd5550f[_0x1e5df4]<0x0)_0xd5550f[_0x1e5df4]=0x0;});_0x47829d(_0xd5550f);return;});})[_0xfa19('0xe')](function(_0x467cb5){_0x27c987(_0x467cb5);});});}function checkUserLimits(_0x4f5508){return new BPromise(function(_0xefded4,_0x1b6351){getLimits()['then'](function(_0x483875){var _0x2ec94b=_['pick'](_[_0xfa19('0x2d')](_0x4f5508,_0xfa19('0x23')),[_0xfa19('0x27'),_0xfa19('0x28'),_0xfa19('0x29')]);var _0x134869=(_0x2ec94b[_0xfa19('0x27')]||0x0)+(_0x2ec94b[_0xfa19('0x28')]||0x0);var _0x5f421a=_0x2ec94b[_0xfa19('0x29')]||0x0;if(_0x134869>_0x483875[_0xfa19('0x28')])return _0x1b6351(_0xfa19('0x2e'));if(_0x5f421a>_0x483875[_0xfa19('0x29')])return _0x1b6351(_0xfa19('0x2f'));return _0xefded4();})[_0xfa19('0xe')](function(_0x31d4ea){_0x1b6351(_0x31d4ea);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xb690=['days','format','grayReason','changed','disabled','message','User','findAll','role','sequelize','COUNT','col','count','telephone','users','telephones','forEach','admin','user','pick','countBy','License\x20limit\x20reached\x20for\x20users','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','Demo\x20license','2027-01-01T00:00:00.000Z','Breaking\x20license','getUuid','then','catch','uuid','data1','license','isEmpty','split','%s:%s:%s','parse','demo','decryptString','gray','deadline'];(function(_0x163043,_0x2d0d44){var _0x5f5478=function(_0x26ee26){while(--_0x26ee26){_0x163043['push'](_0x163043['shift']());}};_0x5f5478(++_0x2d0d44);}(_0xb690,0x18f));var _0x0b69=function(_0x3cf5a3,_0x5a4492){_0x3cf5a3=_0x3cf5a3-0x0;var _0x39ba2d=_0xb690[_0x3cf5a3];return _0x39ba2d;};'use strict';var util=require(_0x0b69('0x0'));var _=require(_0x0b69('0x1'));var moment=require(_0x0b69('0x2'));var BPromise=require(_0x0b69('0x3'));var hardware=require(_0x0b69('0x4'));var encryptor=require(_0x0b69('0x5'));var db=require(_0x0b69('0x6'))['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':_0x0b69('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x0b69('0x8'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x0b69('0x9'),'machineUuid':hardware[_0x0b69('0xa')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x295c7b){return new BPromise(function(_0x5844bb,_0x267b66){return db['License']['find'](_['defaults'](_0x295c7b,{'raw':!![],'where':{'id':0x1}}))[_0x0b69('0xb')](function(_0x3f96b6){return checkLicense(_0x3f96b6,null);})[_0x0b69('0xb')](function(_0x161b0d){_0x5844bb(_0x161b0d);return;})[_0x0b69('0xc')](function(_0x9e2c6){_0x267b66(_0x9e2c6);});});}function checkLicense(_0x48b0ce,_0x2d807d){if(!_0x48b0ce){demoLicense[_0x0b69('0xd')]=_0x48b0ce[_0x0b69('0xe')];return demoLicense;}try{var _0x563a78=_0x2d807d||_0x48b0ce[_0x0b69('0xf')];if(_[_0x0b69('0x10')](_0x563a78)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x54624b=_0x48b0ce[_0x0b69('0xe')];var _0x547b78=_0x48b0ce['data2'];var _0x4ba262=_0x54624b[_0x0b69('0x11')]('-')[0x4];var _0x39501b=_0x54624b[_0x0b69('0x11')]('-')[0x0];var _0x3f1861=encryptor['decryptString'](_0x563a78,util['format'](_0x0b69('0x12'),_0x4ba262,_0x54624b,_0x39501b));var _0x58eece=JSON[_0x0b69('0x13')](_0x3f1861);_0x58eece[_0x0b69('0x14')]=![];_0x58eece['uuid']=_0x54624b;_0x58eece['machineUuid']=hardware[_0x0b69('0xa')]();if(_0x547b78){var _0x42d899=encryptor[_0x0b69('0x15')](_0x547b78);_0x58eece[_0x0b69('0x16')]=_0x42d899;_0x58eece[_0x0b69('0x17')]=moment(_0x42d899)['add'](0x7,_0x0b69('0x18'))[_0x0b69('0x19')]();_0x58eece[_0x0b69('0x1a')]=_0x58eece[_0x0b69('0xd')]!=_0x58eece['machineUuid']?_0x0b69('0x1b'):_0x0b69('0x1c');}return _0x58eece;}catch(_0x5f023a){breakingLicense[_0x0b69('0xd')]=_0x48b0ce[_0x0b69('0xe')];breakingLicense[_0x0b69('0x1d')]=_0x5f023a[_0x0b69('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x1568bd,_0x3d6a76){getLicense()[_0x0b69('0xb')](function(_0x16e360){return db[_0x0b69('0x1e')][_0x0b69('0x1f')]({'attributes':[_0x0b69('0x20'),[db[_0x0b69('0x21')]['fn'](_0x0b69('0x22'),db[_0x0b69('0x21')][_0x0b69('0x23')](_0x0b69('0x20'))),_0x0b69('0x24')]],'group':_0x0b69('0x20'),'where':{'role':{'$or':['admin','user',_0x0b69('0x25')]}},'raw':!![]})[_0x0b69('0xb')](function(_0x12cf74){var _0x5dea5b={'user':_0x16e360[_0x0b69('0x26')]||0x0,'telephone':_0x16e360[_0x0b69('0x27')]||0x0};_0x12cf74[_0x0b69('0x28')](function(_0x152335){var _0x11b866=_0x152335[_0x0b69('0x20')]===_0x0b69('0x29')?_0x0b69('0x2a'):_0x152335['role'];_0x5dea5b[_0x11b866]-=_0x152335[_0x0b69('0x24')];if(_0x5dea5b[_0x11b866]<0x0)_0x5dea5b[_0x11b866]=0x0;});_0x1568bd(_0x5dea5b);return;});})[_0x0b69('0xc')](function(_0x3aea84){_0x3d6a76(_0x3aea84);});});}function checkUserLimits(_0x627d61){return new BPromise(function(_0x214733,_0x377824){getLimits()[_0x0b69('0xb')](function(_0x3ec1fc){var _0x17e79b=_[_0x0b69('0x2b')](_[_0x0b69('0x2c')](_0x627d61,_0x0b69('0x20')),[_0x0b69('0x29'),_0x0b69('0x2a'),_0x0b69('0x25')]);var _0xd68ec0=(_0x17e79b[_0x0b69('0x29')]||0x0)+(_0x17e79b[_0x0b69('0x2a')]||0x0);var _0x199b6e=_0x17e79b['telephone']||0x0;if(_0xd68ec0>_0x3ec1fc['user'])return _0x377824(_0x0b69('0x2d'));if(_0x199b6e>_0x3ec1fc[_0x0b69('0x25')])return _0x377824('License\x20limit\x20reached\x20for\x20telephones');return _0x214733();})['catch'](function(_0x2c8530){_0x377824(_0x2c8530);});});}module[_0x0b69('0x2e')]={'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 a94f7c5..21e76db 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 _0xf7b4=['app-id','secret','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf7b4,0x152));var _0x4f7b=function(_0x42e8bf,_0x2eaf0a){_0x42e8bf=_0x42e8bf-0x0;var _0x325b5d=_0xf7b4[_0x42e8bf];return _0x325b5d;};'use strict';module[_0x4f7b('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x4f7b('0x1'),'GOOGLE_SECRET':_0x4f7b('0x2'),'DEBUG':''}; \ No newline at end of file +var _0xf7b4=['app-id','secret','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf7b4,0x152));var _0x4f7b=function(_0x577168,_0x1dec18){_0x577168=_0x577168-0x0;var _0x288c71=_0xf7b4[_0x577168];return _0x288c71;};'use strict';module[_0x4f7b('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x4f7b('0x1'),'GOOGLE_SECRET':_0x4f7b('0x2'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index cfb9b11..b72f3ac 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1aee=['exports','../utils/loggers'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1aee,0x1f3));var _0xe1ae=function(_0x3bab09,_0x217c29){_0x3bab09=_0x3bab09-0x0;var _0x164376=_0x1aee[_0x3bab09];return _0x164376;};'use strict';var fileLogger=require(_0xe1ae('0x0'))['fileLogger'];module[_0xe1ae('0x1')]=fileLogger; \ No newline at end of file +var _0x98a1=['exports','../utils/loggers'];(function(_0x28e3f6,_0x31314c){var _0x3bea94=function(_0x3efdb3){while(--_0x3efdb3){_0x28e3f6['push'](_0x28e3f6['shift']());}};_0x3bea94(++_0x31314c);}(_0x98a1,0x119));var _0x198a=function(_0x577568,_0x59baa4){_0x577568=_0x577568-0x0;var _0x53af9f=_0x98a1[_0x577568];return _0x53af9f;};'use strict';var fileLogger=require(_0x198a('0x0'))['fileLogger'];module[_0x198a('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 4a7efcd..c252d72 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 _0x8ca5=['agi','../../services/agi/index.js','routing','../../services/routing/index.js','xdr','exports','path','express','join','ami','../../services/ami/index.js'];(function(_0x4b9a2e,_0x2851cc){var _0x2c9765=function(_0x52e777){while(--_0x52e777){_0x4b9a2e['push'](_0x4b9a2e['shift']());}};_0x2c9765(++_0x2851cc);}(_0x8ca5,0x1a8));var _0x58ca=function(_0x591f0b,_0x208825){_0x591f0b=_0x591f0b-0x0;var _0x4c7a9f=_0x8ca5[_0x591f0b];return _0x4c7a9f;};'use strict';var path=require(_0x58ca('0x0'));var os=require('os');var config={'apps':[{'name':_0x58ca('0x1'),'script':path[_0x58ca('0x2')](__dirname,'../../services/express/index.js')},{'name':_0x58ca('0x3'),'script':path['join'](__dirname,_0x58ca('0x4'))},{'name':_0x58ca('0x5'),'script':path['join'](__dirname,_0x58ca('0x6'))},{'name':'email','script':path['join'](__dirname,'../../services/email/index.js')},{'name':_0x58ca('0x7'),'script':path[_0x58ca('0x2')](__dirname,_0x58ca('0x8'))},{'name':_0x58ca('0x9'),'script':path[_0x58ca('0x2')](__dirname,'../../services/xdr/index.js')}]};module[_0x58ca('0xa')]=config; \ No newline at end of file +var _0x3861=['../../services/xdr/index.js','exports','path','express','../../services/express/index.js','ami','join','../../services/ami/index.js','agi','email','../../services/email/index.js','routing','xdr'];(function(_0x2deeba,_0xd08bf0){var _0x46c616=function(_0x161de1){while(--_0x161de1){_0x2deeba['push'](_0x2deeba['shift']());}};_0x46c616(++_0xd08bf0);}(_0x3861,0x147));var _0x1386=function(_0x3e9f81,_0x270545){_0x3e9f81=_0x3e9f81-0x0;var _0x24fdde=_0x3861[_0x3e9f81];return _0x24fdde;};'use strict';var path=require(_0x1386('0x0'));var os=require('os');var config={'apps':[{'name':_0x1386('0x1'),'script':path['join'](__dirname,_0x1386('0x2'))},{'name':_0x1386('0x3'),'script':path[_0x1386('0x4')](__dirname,_0x1386('0x5'))},{'name':_0x1386('0x6'),'script':path[_0x1386('0x4')](__dirname,'../../services/agi/index.js')},{'name':_0x1386('0x7'),'script':path['join'](__dirname,_0x1386('0x8'))},{'name':_0x1386('0x9'),'script':path[_0x1386('0x4')](__dirname,'../../services/routing/index.js')},{'name':_0x1386('0xa'),'script':path['join'](__dirname,_0x1386('0xb'))}]};module[_0x1386('0xc')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index ad2f1a2..e62bb5c 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 _0xfb8f=['then','disconnect','stop','restart','list','describe','delete','pm2','bluebird','./config','connect','start'];(function(_0xda127b,_0x3792b4){var _0x4f9ddb=function(_0x37bc76){while(--_0x37bc76){_0xda127b['push'](_0xda127b['shift']());}};_0x4f9ddb(++_0x3792b4);}(_0xfb8f,0xeb));var _0xffb8=function(_0xb94ff7,_0x46f8dc){_0xb94ff7=_0xb94ff7-0x0;var _0x5951de=_0xfb8f[_0xb94ff7];return _0x5951de;};'use strict';var pm2=require(_0xffb8('0x0'));var BPromise=require(_0xffb8('0x1'));var config=require(_0xffb8('0x2'));function connect(){return new BPromise(function(_0x3c60e1,_0x8e477a){return pm2[_0xffb8('0x3')](function(_0x183409){if(_0x183409){return _0x8e477a(_0x183409);}return _0x3c60e1('connected');});});};exports[_0xffb8('0x4')]=function(_0x45aee8){return connect()[_0xffb8('0x5')](function(){return new BPromise(function(_0x44e31a,_0x3575dd){return pm2[_0xffb8('0x4')](_0x45aee8,function(_0x1b38ea,_0x3d80b4){if(_0x1b38ea){return _0x3575dd(_0x1b38ea);}pm2[_0xffb8('0x6')]();return _0x44e31a(_0x3d80b4);});});});};exports['stop']=function(_0x1a72fe){return connect()[_0xffb8('0x5')](function(){return new BPromise(function(_0x3cc718,_0x5099f2){return pm2[_0xffb8('0x7')](_0x1a72fe,function(_0x53e84d,_0x34898a){if(_0x53e84d){return _0x5099f2(_0x53e84d);}pm2[_0xffb8('0x6')]();return _0x3cc718(_0x34898a);});});});};exports[_0xffb8('0x8')]=function(_0x5b7b11){return connect()[_0xffb8('0x5')](function(){return new BPromise(function(_0x268584,_0x136fea){return pm2[_0xffb8('0x8')](_0x5b7b11,function(_0x3dd2a4,_0x1081f7){if(_0x3dd2a4){return _0x136fea(_0x3dd2a4);}pm2[_0xffb8('0x6')]();return _0x268584(_0x1081f7);});});});};exports[_0xffb8('0x9')]=function(){return connect()[_0xffb8('0x5')](function(){return new BPromise(function(_0x541a93,_0x26462a){return pm2[_0xffb8('0x9')](function(_0x28e636,_0x1ee840){if(_0x28e636){return _0x26462a(_0x28e636);}pm2[_0xffb8('0x6')]();return _0x541a93(_0x1ee840);});});});};exports[_0xffb8('0xa')]=function(_0x343fc9){return connect()[_0xffb8('0x5')](function(){return new BPromise(function(_0x100f2a,_0xb1738a){return pm2[_0xffb8('0xa')](_0x343fc9,function(_0x39b0fa,_0x169a75){if(_0x39b0fa){return _0xb1738a(_0x39b0fa);}pm2['disconnect']();return _0x100f2a(_0x169a75);});});});};exports[_0xffb8('0xb')]=function(_0x24729e){return connect()['then'](function(){return new BPromise(function(_0x4a9f11,_0x481438){return pm2[_0xffb8('0xb')](_0x24729e,function(_0x589ada,_0xfe465c){if(_0x589ada){return _0x481438(_0x589ada);}pm2[_0xffb8('0x6')]();return _0x4a9f11(_0xfe465c);});});});};exports['dump']=function(){return connect()['then'](function(){return new BPromise(function(_0x2643e8,_0x4b7c2a){return pm2['dump'](function(_0xf15f43){if(_0xf15f43){return _0x4b7c2a(_0xf15f43);}return _0x2643e8('saved');});});});}; \ No newline at end of file +var _0x388c=['start','stop','then','disconnect','restart','list','describe','delete','dump','saved','connected'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x388c,0xc5));var _0xc388=function(_0x32478b,_0x53c016){_0x32478b=_0x32478b-0x0;var _0x51e714=_0x388c[_0x32478b];return _0x51e714;};'use strict';var pm2=require('pm2');var BPromise=require('bluebird');var config=require('./config');function connect(){return new BPromise(function(_0x34078b,_0x2bc008){return pm2['connect'](function(_0xb76704){if(_0xb76704){return _0x2bc008(_0xb76704);}return _0x34078b(_0xc388('0x0'));});});};exports['start']=function(_0x42db37){return connect()['then'](function(){return new BPromise(function(_0xa924e,_0x27c711){return pm2[_0xc388('0x1')](_0x42db37,function(_0xe309ff,_0x46a923){if(_0xe309ff){return _0x27c711(_0xe309ff);}pm2['disconnect']();return _0xa924e(_0x46a923);});});});};exports[_0xc388('0x2')]=function(_0x3becb0){return connect()[_0xc388('0x3')](function(){return new BPromise(function(_0x1d8872,_0x3c4164){return pm2[_0xc388('0x2')](_0x3becb0,function(_0x438653,_0x4abc08){if(_0x438653){return _0x3c4164(_0x438653);}pm2[_0xc388('0x4')]();return _0x1d8872(_0x4abc08);});});});};exports['restart']=function(_0x3e9557){return connect()[_0xc388('0x3')](function(){return new BPromise(function(_0x44fe25,_0x49e733){return pm2[_0xc388('0x5')](_0x3e9557,function(_0x51a6cc,_0xfcf1ff){if(_0x51a6cc){return _0x49e733(_0x51a6cc);}pm2[_0xc388('0x4')]();return _0x44fe25(_0xfcf1ff);});});});};exports[_0xc388('0x6')]=function(){return connect()[_0xc388('0x3')](function(){return new BPromise(function(_0x1af16d,_0x424643){return pm2[_0xc388('0x6')](function(_0x58513d,_0x163e72){if(_0x58513d){return _0x424643(_0x58513d);}pm2['disconnect']();return _0x1af16d(_0x163e72);});});});};exports[_0xc388('0x7')]=function(_0xdca1d2){return connect()[_0xc388('0x3')](function(){return new BPromise(function(_0x84dae0,_0x48e4fd){return pm2[_0xc388('0x7')](_0xdca1d2,function(_0xa52576,_0x27eb85){if(_0xa52576){return _0x48e4fd(_0xa52576);}pm2[_0xc388('0x4')]();return _0x84dae0(_0x27eb85);});});});};exports[_0xc388('0x8')]=function(_0x1c92c1){return connect()[_0xc388('0x3')](function(){return new BPromise(function(_0x19a852,_0x3d70a6){return pm2[_0xc388('0x8')](_0x1c92c1,function(_0xcee2db,_0x2b5ca9){if(_0xcee2db){return _0x3d70a6(_0xcee2db);}pm2[_0xc388('0x4')]();return _0x19a852(_0x2b5ca9);});});});};exports['dump']=function(){return connect()['then'](function(){return new BPromise(function(_0x334ff5,_0x4b4128){return pm2[_0xc388('0x9')](function(_0x12ecaa){if(_0x12ecaa){return _0x4b4128(_0x12ecaa);}return _0x334ff5(_0xc388('0xa'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index e816d54..e250d39 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 _0xa85d=['Setting','find','chatTimeout','then','subtract','minutes','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','update','timeout','format','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','length','chatInteraction:update','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','../../config/environment','redis','defaults','localhost','socket.io-emitter'];(function(_0x3db3ba,_0x32664f){var _0x58dc4b=function(_0x31a1a0){while(--_0x31a1a0){_0x3db3ba['push'](_0x3db3ba['shift']());}};_0x58dc4b(++_0x32664f);}(_0xa85d,0x68));var _0xda85=function(_0x5e8c32,_0x1b1f3f){_0x5e8c32=_0x5e8c32-0x0;var _0x595f7b=_0xa85d[_0x5e8c32];return _0x595f7b;};'use strict';var _=require(_0xda85('0x0'));var moment=require(_0xda85('0x1'));var Redis=require(_0xda85('0x2'));var util=require('util');var config=require(_0xda85('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../logger')('schedule');config[_0xda85('0x4')]=_[_0xda85('0x5')](config[_0xda85('0x4')],{'host':_0xda85('0x6'),'port':0x18eb});var io=require(_0xda85('0x7'))(new Redis(config[_0xda85('0x4')]));function closeInteractions(){var _0x873200=0x0;var _0x2076b1=[];return db[_0xda85('0x8')][_0xda85('0x9')]({'raw':!![],'attributes':['id',_0xda85('0xa')],'where':{'id':0x1}})[_0xda85('0xb')](function(_0x1e61b3){_0x873200=_0x1e61b3[_0xda85('0xa')];if(_0x873200){return db['ChatInteraction']['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xda85('0xc')](_0x1e61b3[_0xda85('0xa')],_0xda85('0xd'))}}});}else{return[];}})[_0xda85('0xb')](function(_0x15cfbd){if(_0x15cfbd&&_0x15cfbd['length']){_0x2076b1=_[_0xda85('0xe')](_0x15cfbd||[],'id');logger[_0xda85('0xf')](_0xda85('0x10'),_0x2076b1[_0xda85('0x11')]());return db[_0xda85('0x12')][_0xda85('0x13')]({'closeReason':'system','disposition':_0xda85('0x14'),'closed':!![],'closedAt':moment()[_0xda85('0x15')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x2076b1}});}})[_0xda85('0xb')](function(){if(_0x2076b1&&_0x2076b1['length']){logger[_0xda85('0xf')](_0xda85('0x16'),_0x2076b1[_0xda85('0x11')]());for(var _0x14d9d9=0x0;_0x14d9d9<_0x2076b1[_0xda85('0x17')];_0x14d9d9++){io['emit'](_0xda85('0x18'),{'id':_0x2076b1[_0x14d9d9],'closed':!![]});}}})['catch'](function(_0x30a2e1){logger['error'](_0xda85('0x19'),_0x30a2e1?util[_0xda85('0x1a')](_0x30a2e1,{'showHidden':![],'depth':null}):'');});}exports[_0xda85('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xb214=['info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','error','[CHAT]\x20Error\x20closing\x20interactions','start','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','redis','defaults','socket.io-emitter','Setting','find','then','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','length','map','join','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb214,0xff));var _0x4b21=function(_0x97548f,_0x5a90e5){_0x97548f=_0x97548f-0x0;var _0x1ae316=_0xb214[_0x97548f];return _0x1ae316;};'use strict';var _=require('lodash');var moment=require(_0x4b21('0x0'));var Redis=require(_0x4b21('0x1'));var util=require(_0x4b21('0x2'));var config=require(_0x4b21('0x3'));var db=require(_0x4b21('0x4'))['db'];var logger=require(_0x4b21('0x5'))('schedule');config[_0x4b21('0x6')]=_[_0x4b21('0x7')](config[_0x4b21('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x4b21('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0x5720c7=0x0;var _0xb8848d=[];return db[_0x4b21('0x9')][_0x4b21('0xa')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x4b21('0xb')](function(_0x16e48f){_0x5720c7=_0x16e48f[_0x4b21('0xc')];if(_0x5720c7){return db[_0x4b21('0xd')][_0x4b21('0xe')]({'raw':!![],'attributes':['id',_0x4b21('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x4b21('0x10')](_0x16e48f[_0x4b21('0xc')],'minutes')}}});}else{return[];}})['then'](function(_0x202bd0){if(_0x202bd0&&_0x202bd0[_0x4b21('0x11')]){_0xb8848d=_[_0x4b21('0x12')](_0x202bd0||[],'id');logger['info']('[CHAT]\x20Interactions\x20to\x20close:',_0xb8848d[_0x4b21('0x13')]());return db[_0x4b21('0xd')][_0x4b21('0x14')]({'closeReason':'system','disposition':_0x4b21('0x15'),'closed':!![],'closedAt':moment()[_0x4b21('0x16')](_0x4b21('0x17'))},{'where':{'id':_0xb8848d}});}})['then'](function(){if(_0xb8848d&&_0xb8848d['length']){logger[_0x4b21('0x18')](_0x4b21('0x19'),_0xb8848d[_0x4b21('0x13')]());for(var _0x50a747=0x0;_0x50a747<_0xb8848d['length'];_0x50a747++){io[_0x4b21('0x1a')](_0x4b21('0x1b'),{'id':_0xb8848d[_0x50a747],'closed':!![]});}}})['catch'](function(_0x300a66){logger[_0x4b21('0x1c')](_0x4b21('0x1d'),_0x300a66?util['inspect'](_0x300a66,{'showHidden':![],'depth':null}):'');});}exports[_0x4b21('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 1650fd8..1f4e79f 100644 --- a/server/config/schedule/cloud-provider.js +++ b/server/config/schedule/cloud-provider.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfb7a=['exports','../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x391527,_0x4c2daa){var _0x52dc06=function(_0x207141){while(--_0x207141){_0x391527['push'](_0x391527['shift']());}};_0x52dc06(++_0x4c2daa);}(_0xfb7a,0xb5));var _0xafb7=function(_0x5c8811,_0x4f77d5){_0x5c8811=_0x5c8811-0x0;var _0x2c0941=_0xfb7a[_0x5c8811];return _0x2c0941;};'use strict';function start(){var _0x1e4785=require(_0xafb7('0x0'));return _0x1e4785[_0xafb7('0x1')]();}module[_0xafb7('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xf0b5=['exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x46387b,_0x5de37e){var _0x122058=function(_0x4b17ad){while(--_0x4b17ad){_0x46387b['push'](_0x46387b['shift']());}};_0x122058(++_0x5de37e);}(_0xf0b5,0xd5));var _0x5f0b=function(_0x3e64ab,_0x5aeb80){_0x3e64ab=_0x3e64ab-0x0;var _0x43009d=_0xf0b5[_0x3e64ab];return _0x43009d;};'use strict';function start(){var _0x336ebd=require(_0x5f0b('0x0'));return _0x336ebd['startAllRefreshIntervals']();}module[_0x5f0b('0x1')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index ac6918a..8f851af 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 _0x5961=['subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','exec\x20custom\x20report\x20id:%s','CustomReportId','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','map','toString','difference','length','stop','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','startAt','endAt','add','start','add\x20cron','exists','deleteJob','stop\x20cron','active','update','update\x20cron','util','path','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','email','getSmtpOptions','format','name','MailAccount','Smtp','user','bcc','subtractUnit','%s.%s','basename','extname','savename','zip','join','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','request','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined'];(function(_0x9b7fec,_0x284958){var _0x55aa72=function(_0x3984e3){while(--_0x3984e3){_0x9b7fec['push'](_0x9b7fec['shift']());}};_0x55aa72(++_0x284958);}(_0x5961,0x7b));var _0x1596=function(_0x14a0a0,_0x45d0cf){_0x14a0a0=_0x14a0a0-0x0;var _0x56b651=_0x5961[_0x14a0a0];return _0x56b651;};'use strict';var fs=require('fs');var util=require(_0x1596('0x0'));var path=require(_0x1596('0x1'));var _=require('lodash');var moment=require(_0x1596('0x2'));var CronJobManager=require(_0x1596('0x3'));var jayson=require(_0x1596('0x4'));var BPromise=require(_0x1596('0x5'));var logger=require(_0x1596('0x6'))(_0x1596('0x7'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x1596('0x8'));var client=jayson[_0x1596('0x9')][_0x1596('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x1ad687,_0x54db4b){return function(){logger['info'](_0x1596('0xb'),_0x1ad687[_0x1596('0xc')]);var _0x266709=!![];var _0x2c5ea7=_0x1ad687['MailAccount'][_0x1596('0xd')]();var _0x381000={'account':_0x2c5ea7,'message':{'from':util[_0x1596('0xe')]('\x22%s\x22\x20<%s>',_0x1ad687['MailAccount'][_0x1596('0xf')],_0x1ad687[_0x1596('0x10')][_0x1596('0xc')]||_0x1ad687[_0x1596('0x10')][_0x1596('0x11')][_0x1596('0x12')]),'to':_0x1ad687[_0x1596('0xc')],'cc':_0x1ad687['cc'],'bcc':_0x1ad687[_0x1596('0x13')],'subject':util['format']('Report\x20%s\x20last\x20%s\x20%s',_0x54db4b[_0x1596('0xf')],_0x1ad687['subtractNumber'],_0x1ad687[_0x1596('0x14')])}};var _0x7318d2=path['join'](__dirname,'../../files/reports');var _0x470904=_0x54db4b['savename'];var _0x10a513=util['format'](_0x1596('0x15'),path[_0x1596('0x16')](_0x54db4b['savename'],path[_0x1596('0x17')](_0x54db4b[_0x1596('0x18')])),_0x1596('0x19'));var _0x1a8fa7=path['join'](_0x7318d2,_0x470904);var _0x3056c8=path[_0x1596('0x1a')](_0x7318d2,_0x10a513);if(fs[_0x1596('0x1b')](_0x1a8fa7)){_0x54db4b[_0x1596('0x1c')]=_0x1596('0x1d');_0x381000[_0x1596('0x1e')][_0x1596('0x1f')]=[{'filename':_0x470904,'path':_0x1a8fa7}];_0x381000['message'][_0x1596('0x20')]=util[_0x1596('0xe')](_0x1596('0x21'),JSON[_0x1596('0x22')](_0x54db4b,null,0x2));}else if(fs[_0x1596('0x1b')](_0x3056c8)){_0x54db4b[_0x1596('0x1c')]=_0x1596('0x1d');_0x381000[_0x1596('0x1e')]['attachments']=[{'filename':_0x10a513,'path':_0x3056c8}];}else{_0x381000[_0x1596('0x1e')][_0x1596('0x20')]=_0x1596('0x23');if(!_0x1ad687[_0x1596('0x24')]){_0x266709=![];logger[_0x1596('0x25')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x266709){return client[_0x1596('0x26')]('SendMail',_0x381000)[_0x1596('0x27')](function(_0x3fa05a){if(_0x3fa05a['error']){return logger[_0x1596('0x28')](_0x1596('0x29'),JSON['stringify'](_0x3fa05a));}return logger[_0x1596('0x25')](_0x1596('0x2a'));})[_0x1596('0x2b')](function(_0x59f55f){return logger['error'](_0x1596('0x29'),JSON['stringify'](_0x59f55f));});}};}function handleError(){return function(_0x47e046){return logger[_0x1596('0x28')](JSON['stringify'](_0x47e046));};}function handleResult(_0x10bd80){return function(_0x1b9851){logger[_0x1596('0x25')](_0x1596('0x2c'),JSON[_0x1596('0x22')](_0x1b9851));if(_0x10bd80[_0x1596('0x10')]&&_0x10bd80[_0x1596('0x10')][_0x1596('0x11')]&&!_[_0x1596('0x2d')](_0x10bd80['email'])){setTimeout(handleSendEmail(_0x10bd80,_0x1b9851),0x3c*0x3e8);}};}function handleJob(_0x2a8b9d){return function(){try{if(_[_0x1596('0x2d')](_0x2a8b9d[_0x1596('0x2e')])){return logger[_0x1596('0x25')](_0x1596('0x2f'));}if(_[_0x1596('0x2d')](_0x2a8b9d[_0x1596('0x14')])){return logger['info'](_0x1596('0x30'));}var _0x454e99={'startDate':moment()[_0x1596('0x31')](_0x2a8b9d[_0x1596('0x2e')],_0x2a8b9d[_0x1596('0x14')])['format']('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()['format'](_0x1596('0x32')),'type':'scheduled','output':_0x2a8b9d[_0x1596('0x33')],'name':_0x2a8b9d[_0x1596('0xf')]};if(!_['isNil'](_0x2a8b9d[_0x1596('0x34')])){logger['info'](_0x1596('0x35'),_0x2a8b9d['DefaultReportId']);return analyticDefaultReportController[_0x1596('0x36')]({'id':_0x2a8b9d[_0x1596('0x34')]},_0x454e99)[_0x1596('0x27')](handleResult(_0x2a8b9d))[_0x1596('0x2b')](handleError());}if(!_[_0x1596('0x2d')](_0x2a8b9d['CustomReportId'])){logger['info'](_0x1596('0x37'),_0x2a8b9d[_0x1596('0x38')]);return analyticCustomReportController[_0x1596('0x36')]({'id':_0x2a8b9d[_0x1596('0x38')]},_0x454e99)[_0x1596('0x27')](handleResult(_0x2a8b9d))[_0x1596('0x2b')](handleError());}}catch(_0x22753d){logger['error'](JSON['stringify'](_0x22753d));}return logger[_0x1596('0x25')]('no\x20report\x20id');};}function getJobs(_0x2e291f){var _0x347dcb={};if(_0x2e291f){_0x347dcb['id']=_0x2e291f;}return db[_0x1596('0x39')][_0x1596('0x3a')]({'where':_0x347dcb,'include':[{'model':db['MailAccount'],'attributes':['id','name',_0x1596('0xc')],'include':[{'model':db[_0x1596('0x3b')],'as':_0x1596('0x11'),'include':[{'model':db[_0x1596('0x3c')],'as':_0x1596('0x3c')}]}]}]})['then'](function(_0x42b9a0){var _0x4d5b2a=_[_0x1596('0x3d')](manager[_0x1596('0x3e')]);var _0x5388b4=_[_0x1596('0x3f')](_0x42b9a0,function(_0x16ec04){return _0x16ec04['id'][_0x1596('0x40')]();});var _0x4ffde9=_['keyBy'](_0x42b9a0,function(_0x17bfa3){return _0x17bfa3['id']['toString']();});var _0x25aff4=_0x2e291f?_0x5388b4:_[_0x1596('0x41')](_0x5388b4,_0x4d5b2a);var _0x28ed53=_['intersection'](_0x5388b4,_0x4d5b2a);var _0x3603a5=_[_0x1596('0x41')](_0x4d5b2a,_0x5388b4);var _0x856ce8;var _0x2f766b;for(_0x856ce8=0x0;_0x856ce8<_0x3603a5[_0x1596('0x42')]&&!_0x2e291f;_0x856ce8+=0x1){_0x2f766b=_0x3603a5[_0x856ce8][_0x1596('0x40')]();if(manager['exists'](_0x2f766b)){manager[_0x1596('0x43')](_0x2f766b);manager['deleteJob'](_0x2f766b);logger[_0x1596('0x25')](_0x1596('0x44'),_0x2f766b);}}logger[_0x1596('0x25')](_0x1596('0x45'),JSON[_0x1596('0x22')](_0x25aff4));for(_0x856ce8=0x0;_0x856ce8<_0x25aff4['length'];_0x856ce8+=0x1){_0x2f766b=_0x25aff4[_0x856ce8][_0x1596('0x40')]();logger[_0x1596('0x25')](_0x1596('0x46'),_0x2f766b);if(_0x2e291f){logger[_0x1596('0x25')](_0x1596('0x47'),_0x2e291f);logger[_0x1596('0x25')](JSON['stringify'](_0x4ffde9[_0x2f766b]));BPromise[_0x1596('0x48')]()['then'](handleJob(_0x4ffde9[_0x2f766b]));logger['info'](_0x1596('0x49'),_0x4ffde9[_0x2f766b][_0x1596('0xf')],_0x4ffde9[_0x2f766b]['cron']);}else if(_0x4ffde9[_0x2f766b][_0x1596('0x4a')]&&_0x4ffde9[_0x2f766b]['active']&&moment()['isBetween'](_0x4ffde9[_0x2f766b][_0x1596('0x4b')],_0x4ffde9[_0x2f766b][_0x1596('0x4c')])){manager[_0x1596('0x4d')](_0x2f766b,_0x4ffde9[_0x2f766b][_0x1596('0x4a')],handleJob(_0x4ffde9[_0x2f766b]));manager[_0x1596('0x4e')](_0x2f766b);logger[_0x1596('0x25')](_0x1596('0x4f'),_0x4ffde9[_0x2f766b][_0x1596('0xf')],_0x4ffde9[_0x2f766b][_0x1596('0x4a')]);}else if(manager[_0x1596('0x50')](_0x2f766b)){manager[_0x1596('0x43')](_0x2f766b);manager[_0x1596('0x51')](_0x2f766b);logger[_0x1596('0x25')](_0x1596('0x52'),_0x4ffde9[_0x2f766b]['name'],_0x4ffde9[_0x2f766b][_0x1596('0x4a')]);}}for(_0x856ce8=0x0,_0x2f766b;_0x856ce8<_0x28ed53[_0x1596('0x42')]&&!_0x2e291f;_0x856ce8+=0x1){_0x2f766b=_0x28ed53[_0x856ce8][_0x1596('0x40')]();if(manager[_0x1596('0x50')](_0x2f766b)){if(_0x4ffde9[_0x2f766b][_0x1596('0x4a')]&&_0x4ffde9[_0x2f766b][_0x1596('0x53')]&&moment()['isBetween'](_0x4ffde9[_0x2f766b][_0x1596('0x4b')],_0x4ffde9[_0x2f766b][_0x1596('0x4c')])){manager[_0x1596('0x54')](_0x2f766b,_0x4ffde9[_0x2f766b]['cron'],handleJob(_0x4ffde9[_0x2f766b]));logger['info'](_0x1596('0x55'),_0x4ffde9[_0x2f766b][_0x1596('0xf')],_0x4ffde9[_0x2f766b]['cron']);}else{manager[_0x1596('0x43')](_0x2f766b);manager[_0x1596('0x51')](_0x2f766b);logger[_0x1596('0x25')](_0x1596('0x52'),_0x4ffde9[_0x2f766b][_0x1596('0xf')],_0x4ffde9[_0x2f766b][_0x1596('0x4a')]);}}}})[_0x1596('0x2b')](function(_0x1931b4){logger['error'](JSON['stringify'](_0x1931b4));});}exports['run']=function(_0xa11d8a){return getJobs(_0xa11d8a);};exports[_0x1596('0x4e')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x4713=['exec\x20custom\x20report\x20id:%s','no\x20report\x20id','MailServerOut','CloudProvider','keys','jobs','map','keyBy','toString','difference','length','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','active','isBetween','endAt','add','start','add\x20cron','exists','stop','stop\x20cron','startAt','update','update\x20cron','deleteJob','run','util','lodash','moment','cron-job-manager','bluebird','../logger','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','getSmtpOptions','format','\x22%s\x22\x20<%s>','MailAccount','email','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','subtractUnit','../../files/reports','%s.%s','basename','savename','zip','join','status','attachments','message','stringify','existsSync','Sent','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error\x20mail','email\x20sent','catch','error','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','CustomReportId'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x4713,0x178));var _0x3471=function(_0xad921d,_0x4e852b){_0xad921d=_0xad921d-0x0;var _0x50a737=_0x4713[_0xad921d];return _0x50a737;};'use strict';var fs=require('fs');var util=require(_0x3471('0x0'));var path=require('path');var _=require(_0x3471('0x1'));var moment=require(_0x3471('0x2'));var CronJobManager=require(_0x3471('0x3'));var jayson=require('jayson/promise');var BPromise=require(_0x3471('0x4'));var logger=require(_0x3471('0x5'))('schedule');var db=require('../../mysqldb')['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x3471('0x6'));var client=jayson[_0x3471('0x7')][_0x3471('0x8')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x439c68,_0x52ceca){return function(){logger[_0x3471('0x9')](_0x3471('0xa'),_0x439c68['email']);var _0x2d3f27=!![];var _0x16217a=_0x439c68['MailAccount'][_0x3471('0xb')]();var _0x478f03={'account':_0x16217a,'message':{'from':util[_0x3471('0xc')](_0x3471('0xd'),_0x439c68[_0x3471('0xe')]['name'],_0x439c68[_0x3471('0xe')][_0x3471('0xf')]||_0x439c68[_0x3471('0xe')][_0x3471('0x10')][_0x3471('0x11')]),'to':_0x439c68[_0x3471('0xf')],'cc':_0x439c68['cc'],'bcc':_0x439c68[_0x3471('0x12')],'subject':util[_0x3471('0xc')](_0x3471('0x13'),_0x52ceca[_0x3471('0x14')],_0x439c68[_0x3471('0x15')],_0x439c68[_0x3471('0x16')])}};var _0x2fc5d6=path['join'](__dirname,_0x3471('0x17'));var _0x131443=_0x52ceca['savename'];var _0x708263=util[_0x3471('0xc')](_0x3471('0x18'),path[_0x3471('0x19')](_0x52ceca['savename'],path['extname'](_0x52ceca[_0x3471('0x1a')])),_0x3471('0x1b'));var _0x3d2c0c=path[_0x3471('0x1c')](_0x2fc5d6,_0x131443);var _0x47e0eb=path['join'](_0x2fc5d6,_0x708263);if(fs['existsSync'](_0x3d2c0c)){_0x52ceca[_0x3471('0x1d')]='Sent';_0x478f03['message'][_0x3471('0x1e')]=[{'filename':_0x131443,'path':_0x3d2c0c}];_0x478f03[_0x3471('0x1f')]['text']=util[_0x3471('0xc')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x3471('0x20')](_0x52ceca,null,0x2));}else if(fs[_0x3471('0x21')](_0x47e0eb)){_0x52ceca['status']=_0x3471('0x22');_0x478f03[_0x3471('0x1f')][_0x3471('0x1e')]=[{'filename':_0x708263,'path':_0x47e0eb}];}else{_0x478f03[_0x3471('0x1f')]['text']=_0x3471('0x23');if(!_0x439c68['sendIfEmpty']){_0x2d3f27=![];logger[_0x3471('0x9')](_0x3471('0x24'));}}if(_0x2d3f27){return client['request'](_0x3471('0x25'),_0x478f03)[_0x3471('0x26')](function(_0x4f2c3a){if(_0x4f2c3a['error']){return logger['error'](_0x3471('0x27'),JSON['stringify'](_0x4f2c3a));}return logger[_0x3471('0x9')](_0x3471('0x28'));})[_0x3471('0x29')](function(_0x30c487){return logger[_0x3471('0x2a')](_0x3471('0x27'),JSON[_0x3471('0x20')](_0x30c487));});}};}function handleError(){return function(_0x3f256){return logger[_0x3471('0x2a')](JSON[_0x3471('0x20')](_0x3f256));};}function handleResult(_0x2b9a4e){return function(_0x3ebf7b){logger['info'](_0x3471('0x2b'),JSON[_0x3471('0x20')](_0x3ebf7b));if(_0x2b9a4e['MailAccount']&&_0x2b9a4e['MailAccount']['Smtp']&&!_['isNil'](_0x2b9a4e[_0x3471('0xf')])){setTimeout(handleSendEmail(_0x2b9a4e,_0x3ebf7b),0x3c*0x3e8);}};}function handleJob(_0x396dfa){return function(){try{if(_[_0x3471('0x2c')](_0x396dfa[_0x3471('0x15')])){return logger[_0x3471('0x9')](_0x3471('0x2d'));}if(_[_0x3471('0x2c')](_0x396dfa[_0x3471('0x16')])){return logger['info'](_0x3471('0x2e'));}var _0x2113d4={'startDate':moment()[_0x3471('0x2f')](_0x396dfa[_0x3471('0x15')],_0x396dfa[_0x3471('0x16')])['format'](_0x3471('0x30')),'endDate':moment()[_0x3471('0xc')](_0x3471('0x30')),'type':_0x3471('0x31'),'output':_0x396dfa[_0x3471('0x32')],'name':_0x396dfa[_0x3471('0x14')]};if(!_[_0x3471('0x2c')](_0x396dfa[_0x3471('0x33')])){logger['info']('exec\x20defaul\x20report\x20id:%s',_0x396dfa[_0x3471('0x33')]);return analyticDefaultReportController[_0x3471('0x34')]({'id':_0x396dfa[_0x3471('0x33')]},_0x2113d4)[_0x3471('0x26')](handleResult(_0x396dfa))[_0x3471('0x29')](handleError());}if(!_['isNil'](_0x396dfa[_0x3471('0x35')])){logger[_0x3471('0x9')](_0x3471('0x36'),_0x396dfa[_0x3471('0x35')]);return analyticCustomReportController[_0x3471('0x34')]({'id':_0x396dfa[_0x3471('0x35')]},_0x2113d4)[_0x3471('0x26')](handleResult(_0x396dfa))[_0x3471('0x29')](handleError());}}catch(_0x25cd04){logger[_0x3471('0x2a')](JSON[_0x3471('0x20')](_0x25cd04));}return logger[_0x3471('0x9')](_0x3471('0x37'));};}function getJobs(_0x9cc4b2){var _0x42f055={};if(_0x9cc4b2){_0x42f055['id']=_0x9cc4b2;}return db['Schedule']['findAll']({'where':_0x42f055,'include':[{'model':db[_0x3471('0xe')],'attributes':['id','name',_0x3471('0xf')],'include':[{'model':db[_0x3471('0x38')],'as':_0x3471('0x10'),'include':[{'model':db[_0x3471('0x39')],'as':'CloudProvider'}]}]}]})['then'](function(_0x261e63){var _0x53167b=_[_0x3471('0x3a')](manager[_0x3471('0x3b')]);var _0x5a22cf=_[_0x3471('0x3c')](_0x261e63,function(_0x26816d){return _0x26816d['id']['toString']();});var _0x2369ea=_[_0x3471('0x3d')](_0x261e63,function(_0xa026fe){return _0xa026fe['id'][_0x3471('0x3e')]();});var _0x27a774=_0x9cc4b2?_0x5a22cf:_['difference'](_0x5a22cf,_0x53167b);var _0x5e4735=_['intersection'](_0x5a22cf,_0x53167b);var _0x148e50=_[_0x3471('0x3f')](_0x53167b,_0x5a22cf);var _0x5183f6;var _0x4e78b8;for(_0x5183f6=0x0;_0x5183f6<_0x148e50[_0x3471('0x40')]&&!_0x9cc4b2;_0x5183f6+=0x1){_0x4e78b8=_0x148e50[_0x5183f6][_0x3471('0x3e')]();if(manager['exists'](_0x4e78b8)){manager['stop'](_0x4e78b8);manager['deleteJob'](_0x4e78b8);logger[_0x3471('0x9')](_0x3471('0x41'),_0x4e78b8);}}logger[_0x3471('0x9')](_0x3471('0x42'),JSON[_0x3471('0x20')](_0x27a774));for(_0x5183f6=0x0;_0x5183f6<_0x27a774[_0x3471('0x40')];_0x5183f6+=0x1){_0x4e78b8=_0x27a774[_0x5183f6][_0x3471('0x3e')]();logger['info'](_0x3471('0x43'),_0x4e78b8);if(_0x9cc4b2){logger[_0x3471('0x9')](_0x3471('0x44'),_0x9cc4b2);logger[_0x3471('0x9')](JSON[_0x3471('0x20')](_0x2369ea[_0x4e78b8]));BPromise[_0x3471('0x45')]()['then'](handleJob(_0x2369ea[_0x4e78b8]));logger['info'](_0x3471('0x46'),_0x2369ea[_0x4e78b8][_0x3471('0x14')],_0x2369ea[_0x4e78b8][_0x3471('0x47')]);}else if(_0x2369ea[_0x4e78b8]['cron']&&_0x2369ea[_0x4e78b8][_0x3471('0x48')]&&moment()[_0x3471('0x49')](_0x2369ea[_0x4e78b8]['startAt'],_0x2369ea[_0x4e78b8][_0x3471('0x4a')])){manager[_0x3471('0x4b')](_0x4e78b8,_0x2369ea[_0x4e78b8]['cron'],handleJob(_0x2369ea[_0x4e78b8]));manager[_0x3471('0x4c')](_0x4e78b8);logger['info'](_0x3471('0x4d'),_0x2369ea[_0x4e78b8][_0x3471('0x14')],_0x2369ea[_0x4e78b8][_0x3471('0x47')]);}else if(manager[_0x3471('0x4e')](_0x4e78b8)){manager[_0x3471('0x4f')](_0x4e78b8);manager['deleteJob'](_0x4e78b8);logger[_0x3471('0x9')](_0x3471('0x50'),_0x2369ea[_0x4e78b8][_0x3471('0x14')],_0x2369ea[_0x4e78b8]['cron']);}}for(_0x5183f6=0x0,_0x4e78b8;_0x5183f6<_0x5e4735[_0x3471('0x40')]&&!_0x9cc4b2;_0x5183f6+=0x1){_0x4e78b8=_0x5e4735[_0x5183f6][_0x3471('0x3e')]();if(manager['exists'](_0x4e78b8)){if(_0x2369ea[_0x4e78b8]['cron']&&_0x2369ea[_0x4e78b8][_0x3471('0x48')]&&moment()[_0x3471('0x49')](_0x2369ea[_0x4e78b8][_0x3471('0x51')],_0x2369ea[_0x4e78b8][_0x3471('0x4a')])){manager[_0x3471('0x52')](_0x4e78b8,_0x2369ea[_0x4e78b8][_0x3471('0x47')],handleJob(_0x2369ea[_0x4e78b8]));logger[_0x3471('0x9')](_0x3471('0x53'),_0x2369ea[_0x4e78b8][_0x3471('0x14')],_0x2369ea[_0x4e78b8][_0x3471('0x47')]);}else{manager[_0x3471('0x4f')](_0x4e78b8);manager[_0x3471('0x54')](_0x4e78b8);logger[_0x3471('0x9')](_0x3471('0x50'),_0x2369ea[_0x4e78b8][_0x3471('0x14')],_0x2369ea[_0x4e78b8]['cron']);}}}})[_0x3471('0x29')](function(_0x23f7a2){logger[_0x3471('0x2a')](JSON[_0x3471('0x20')](_0x23f7a2));});}exports[_0x3471('0x55')]=function(_0xd82f2e){return getJobs(_0xd82f2e);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 6051286..a689be5 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 _0xc4e1=['language','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','resolve','CloudProvider','findOne','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','Setting','transcribeAccountId','forEach','push','all','lodash','aws-sdk','request-promise','util','../../mysqldb','transcribe','TranscribeService','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','data2','transcribeRegion','transcribeName','then','info','fileText','TranscriptionJob','COMPLETED','TranscriptionJobStatus','Transcript','TranscriptFileUri','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion'];(function(_0x3cbc98,_0x4af397){var _0x9a80c3=function(_0x5886ec){while(--_0x5886ec){_0x3cbc98['push'](_0x3cbc98['shift']());}};_0x9a80c3(++_0x4af397);}(_0xc4e1,0x172));var _0x1c4e=function(_0x3a867f,_0x1fdacf){_0x3a867f=_0x3a867f-0x0;var _0x59fb63=_0xc4e1[_0x3a867f];return _0x59fb63;};var _=require(_0x1c4e('0x0'));var AWS=require(_0x1c4e('0x1'));var rp=require(_0x1c4e('0x2'));var util=require(_0x1c4e('0x3'));var BPromise=require('bluebird');var db=require(_0x1c4e('0x4'))['db'];var logger=require('../../config/logger')(_0x1c4e('0x5'));function getTranscriptionJob(_0x526015,_0x179595,_0x5c2a27,_0x2de28a){return new Promise(function(_0x350c79,_0x47f7f1){var _0x45bef5=new AWS[(_0x1c4e('0x6'))]({'accessKeyId':_0x179595,'secretAccessKey':_0x526015,'region':_0x5c2a27});_0x45bef5['getTranscriptionJob']({'TranscriptionJobName':_0x2de28a},function(_0xa423ce,_0x4b6c34){if(_0xa423ce){return _0x47f7f1(_0xa423ce);}else{return _0x350c79(_0x4b6c34);}});});}function sentiment(_0x5b4c8c,_0xf1a7fd,_0x4d97eb,_0x474947,_0x524692){return new Promise(function(_0x1aa3d7,_0x4b61e5){var _0x39b296=new AWS['Comprehend']({'accessKeyId':_0xf1a7fd,'secretAccessKey':_0x5b4c8c,'region':_0x4d97eb});_0x39b296['detectSentiment']({'Text':_0x474947,'LanguageCode':_0x524692['substring'](0x0,0x2)},function(_0xe27d62,_0x19adb1){if(_0xe27d62){return _0x4b61e5(_0xe27d62);}else{return _0x1aa3d7(_0x19adb1);}});});}function checkTranscribeJob(_0x25aa73,_0x4f4eec,_0x275b90){var _0x2eb80a;return new BPromise(function(_0x4e6061,_0x4be10d){logger['info'](util[_0x1c4e('0x7')](_0x1c4e('0x8'),_0x25aa73['id'],_0x25aa73['transcribeName']));return getTranscriptionJob(_0x275b90[_0x1c4e('0x9')],_0x275b90[_0x1c4e('0xa')],_0x4f4eec[_0x1c4e('0xb')],_0x25aa73[_0x1c4e('0xc')])[_0x1c4e('0xd')](function(_0x4b12b3){logger[_0x1c4e('0xe')](util[_0x1c4e('0x7')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x25aa73['id'],_0x25aa73['transcribeName'],_0x4b12b3['TranscriptionJob']['TranscriptionJobStatus']));if(!_0x25aa73[_0x1c4e('0xf')]){switch(_0x4b12b3[_0x1c4e('0x10')]['TranscriptionJobStatus']){case _0x1c4e('0x11'):var _0x366529={'transcribeStatus':_0x4b12b3[_0x1c4e('0x10')][_0x1c4e('0x12')],'fileUri':_0x4b12b3[_0x1c4e('0x10')][_0x1c4e('0x13')][_0x1c4e('0x14')]};logger[_0x1c4e('0xe')](util[_0x1c4e('0x7')]('[RECORDING:%d]\x20Get\x20transcript',_0x25aa73['id']));return rp({'uri':_0x4b12b3[_0x1c4e('0x10')]['Transcript'][_0x1c4e('0x14')],'json':!![]})[_0x1c4e('0xd')](function(_0x300b16){logger[_0x1c4e('0xe')](util[_0x1c4e('0x7')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x25aa73['id']));if(_0x300b16&&_0x300b16[_0x1c4e('0x15')]&&_0x300b16[_0x1c4e('0x15')][_0x1c4e('0x16')]&&_0x300b16[_0x1c4e('0x15')][_0x1c4e('0x16')][_0x1c4e('0x17')]){_0x366529['fileText']='';for(var _0x3a52a0=0x0;_0x3a52a0<_0x300b16[_0x1c4e('0x15')][_0x1c4e('0x16')][_0x1c4e('0x17')];_0x3a52a0++){_0x366529[_0x1c4e('0xf')]+=_0x300b16[_0x1c4e('0x15')]['transcripts'][_0x3a52a0][_0x1c4e('0x18')]+'';}}return _0x25aa73[_0x1c4e('0x19')](_0x366529);})['then'](function(){logger[_0x1c4e('0xe')](util[_0x1c4e('0x7')](_0x1c4e('0x1a'),_0x25aa73['id']));if(!_0x25aa73[_0x1c4e('0x1b')]){throw new db['Sequelize'][(_0x1c4e('0x1c'))](_0x1c4e('0x1d'));}if(!_0x4f4eec[_0x1c4e('0x1e')]||!_0x4f4eec['sentimentAccountId']||!_0x4f4eec[_0x1c4e('0x1f')]||!_0x4f4eec[_0x1c4e('0x20')]||!_0x4f4eec[_0x1c4e('0x21')]){throw new db[(_0x1c4e('0x22'))]['ValidationError'](_0x1c4e('0x23'));}if(!_0x366529[_0x1c4e('0xf')]){throw new Error(_0x1c4e('0x24'));}if(_0x4f4eec[_0x1c4e('0x25')]===_0x275b90['id']){return _0x275b90;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0x1c4e('0x25')]}});}})[_0x1c4e('0xd')](function(_0x1f99c9){if(!_0x1f99c9){throw new db['Sequelize'][(_0x1c4e('0x1c'))](_0x1c4e('0x26'));}if(!_0x1f99c9['data1']||!_0x1f99c9[_0x1c4e('0xa')]){throw new db[(_0x1c4e('0x22'))][(_0x1c4e('0x1c'))](_0x1c4e('0x27'));}_0x2eb80a=_0x1f99c9;logger[_0x1c4e('0xe')](util['format'](_0x1c4e('0x28'),_0x25aa73['id']));return sentiment(_0x2eb80a[_0x1c4e('0x9')],_0x2eb80a[_0x1c4e('0xa')],_0x4f4eec[_0x1c4e('0x1f')],_0x366529[_0x1c4e('0xf')],_0x4f4eec['language']);})[_0x1c4e('0xd')](function(_0x4d243a){logger[_0x1c4e('0xe')](util[_0x1c4e('0x7')](_0x1c4e('0x29'),_0x25aa73['id']));return _0x25aa73[_0x1c4e('0x19')]({'sentiment':_0x4d243a[_0x1c4e('0x2a')],'sPositive':_0x4d243a['SentimentScore'][_0x1c4e('0x2b')],'sNegative':_0x4d243a[_0x1c4e('0x2c')][_0x1c4e('0x2d')],'sMixed':_0x4d243a[_0x1c4e('0x2c')][_0x1c4e('0x2e')],'sNeutral':_0x4d243a[_0x1c4e('0x2c')][_0x1c4e('0x2f')]});})[_0x1c4e('0xd')](function(){logger[_0x1c4e('0xe')](util[_0x1c4e('0x7')](_0x1c4e('0x1a'),_0x25aa73['id']));_0x4e6061();});case _0x1c4e('0x30'):return _0x25aa73[_0x1c4e('0x19')]({'transcribeStatus':'FAILED','failureReason':_0x4b12b3[_0x1c4e('0x10')][_0x1c4e('0x31')]})[_0x1c4e('0xd')](function(){logger[_0x1c4e('0xe')](util[_0x1c4e('0x7')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x25aa73['id']));_0x4e6061();});default:logger[_0x1c4e('0xe')](util['format']('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x25aa73['id']));break;}}else{return BPromise[_0x1c4e('0x32')]()['then'](function(){if(!_0x25aa73[_0x1c4e('0x1b')]){throw new db[(_0x1c4e('0x22'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x4f4eec[_0x1c4e('0x1e')]||!_0x4f4eec[_0x1c4e('0x25')]||!_0x4f4eec[_0x1c4e('0x1f')]||!_0x4f4eec[_0x1c4e('0x20')]||!_0x4f4eec['bucket']){throw new db['Sequelize']['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x25aa73[_0x1c4e('0xf')]){throw new Error(_0x1c4e('0x24'));}if(_0x4f4eec[_0x1c4e('0x25')]===_0x275b90['id']){return _0x275b90;}else{return db[_0x1c4e('0x33')][_0x1c4e('0x34')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x3bab40){if(!_0x3bab40){throw new db[(_0x1c4e('0x22'))][(_0x1c4e('0x1c'))](_0x1c4e('0x26'));}if(!_0x3bab40['data1']||!_0x3bab40[_0x1c4e('0xa')]){throw new db['Sequelize']['ValidationError'](_0x1c4e('0x27'));}_0x2eb80a=_0x3bab40;logger[_0x1c4e('0xe')](util['format'](_0x1c4e('0x28'),_0x25aa73['id']));return sentiment(_0x2eb80a[_0x1c4e('0x9')],_0x2eb80a[_0x1c4e('0xa')],_0x4f4eec[_0x1c4e('0x1f')],_0x25aa73[_0x1c4e('0xf')],_0x4f4eec['language']);})[_0x1c4e('0xd')](function(_0x47d9d9){logger[_0x1c4e('0xe')](util['format'](_0x1c4e('0x29'),_0x25aa73['id']));return _0x25aa73[_0x1c4e('0x19')]({'sentiment':_0x47d9d9[_0x1c4e('0x2a')],'sPositive':_0x47d9d9[_0x1c4e('0x2c')][_0x1c4e('0x2b')],'sNegative':_0x47d9d9[_0x1c4e('0x2c')][_0x1c4e('0x2d')],'sMixed':_0x47d9d9[_0x1c4e('0x2c')][_0x1c4e('0x2e')],'sNeutral':_0x47d9d9[_0x1c4e('0x2c')][_0x1c4e('0x2f')],'transcribeStatus':'COMPLETED'});})['then'](function(){logger[_0x1c4e('0xe')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x25aa73['id']));_0x4e6061();});}})[_0x1c4e('0x35')](function(_0x3d8300){if(_0x3d8300){if(!_0x3d8300[_0x1c4e('0x36')]||_0x3d8300[_0x1c4e('0x36')]!==_0x1c4e('0x37')){logger[_0x1c4e('0x38')](util[_0x1c4e('0x7')](_0x1c4e('0x39'),_0x25aa73['id']),util[_0x1c4e('0x3a')](_0x3d8300,{'showHidden':![],'depth':null}));}}_0x4e6061();});});}function checkTranscribe(){var _0x2a82e4;var _0x134f27;var _0x54ac0f;return db[_0x1c4e('0x3b')][_0x1c4e('0x3c')]({'where':{'transcribeStatus':_0x1c4e('0x3d')}})[_0x1c4e('0xd')](function(_0x23ac97){if(!_0x23ac97||!_0x23ac97[_0x1c4e('0x17')]){throw new db[(_0x1c4e('0x22'))][(_0x1c4e('0x1c'))]('No\x20transcribe\x20job\x20to\x20check');}_0x2a82e4=_0x23ac97;return db[_0x1c4e('0x3e')][_0x1c4e('0x34')]({'where':{'id':0x1}});})['then'](function(_0x65c265){if(!_0x65c265){throw new db[(_0x1c4e('0x22'))][(_0x1c4e('0x1c'))]('Settings\x20not\x20available');}_0x134f27=_0x65c265;if(!_0x134f27['transcribe']||!_0x134f27['transcribeAccountId']||!_0x134f27[_0x1c4e('0xb')]||!_0x134f27[_0x1c4e('0x20')]||!_0x134f27[_0x1c4e('0x21')]){throw new db[(_0x1c4e('0x22'))]['ValidationError']('Transcribe\x20not\x20configured');}return db[_0x1c4e('0x33')][_0x1c4e('0x34')]({'where':{'id':_0x134f27[_0x1c4e('0x3f')]}});})['then'](function(_0x31a204){if(!_0x31a204){throw new db[(_0x1c4e('0x22'))][(_0x1c4e('0x1c'))](_0x1c4e('0x26'));}if(!_0x31a204['data1']||!_0x31a204[_0x1c4e('0xa')]){throw new db[(_0x1c4e('0x22'))][(_0x1c4e('0x1c'))](_0x1c4e('0x27'));}_0x54ac0f=_0x31a204;var _0x2408c7=[];_0x2a82e4[_0x1c4e('0x40')](function(_0x32606c){_0x2408c7[_0x1c4e('0x41')](checkTranscribeJob(_0x32606c,_0x134f27,_0x54ac0f));});return BPromise[_0x1c4e('0x42')](_0x2408c7);})[_0x1c4e('0x35')](function(_0x430625){if(_0x430625){if(!_0x430625[_0x1c4e('0x36')]||_0x430625['name']!==_0x1c4e('0x37')){logger['error'](util[_0x1c4e('0x3a')](_0x430625,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x2b65=['Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','TranscriptionJob','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Sequelize','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Cloud\x20Provider\x20not\x20configured','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Setting'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x2b65,0x131));var _0x52b6=function(_0xa2c6c9,_0x383b47){_0xa2c6c9=_0xa2c6c9-0x0;var _0x10ba06=_0x2b65[_0xa2c6c9];return _0x10ba06;};var _=require(_0x52b6('0x0'));var AWS=require(_0x52b6('0x1'));var rp=require(_0x52b6('0x2'));var util=require(_0x52b6('0x3'));var BPromise=require(_0x52b6('0x4'));var db=require(_0x52b6('0x5'))['db'];var logger=require(_0x52b6('0x6'))(_0x52b6('0x7'));function getTranscriptionJob(_0x5582d0,_0x3b8e05,_0x2a1355,_0x4707f3){return new Promise(function(_0x2c643d,_0x25593f){var _0x2d451f=new AWS[(_0x52b6('0x8'))]({'accessKeyId':_0x3b8e05,'secretAccessKey':_0x5582d0,'region':_0x2a1355});_0x2d451f[_0x52b6('0x9')]({'TranscriptionJobName':_0x4707f3},function(_0x432726,_0x27c5b9){if(_0x432726){return _0x25593f(_0x432726);}else{return _0x2c643d(_0x27c5b9);}});});}function sentiment(_0x4c59dd,_0x18356a,_0x1c2cb5,_0x18b34d,_0x4d6d94){return new Promise(function(_0x19d1d9,_0x2bb857){var _0x19f475=new AWS[(_0x52b6('0xa'))]({'accessKeyId':_0x18356a,'secretAccessKey':_0x4c59dd,'region':_0x1c2cb5});_0x19f475['detectSentiment']({'Text':_0x18b34d,'LanguageCode':_0x4d6d94[_0x52b6('0xb')](0x0,0x2)},function(_0x8ed34,_0x1442e5){if(_0x8ed34){return _0x2bb857(_0x8ed34);}else{return _0x19d1d9(_0x1442e5);}});});}function checkTranscribeJob(_0x5317b2,_0x247d40,_0xc7ccc2){var _0x5292e4;return new BPromise(function(_0x10afe3,_0x4ac9c2){logger['info'](util[_0x52b6('0xc')](_0x52b6('0xd'),_0x5317b2['id'],_0x5317b2[_0x52b6('0xe')]));return getTranscriptionJob(_0xc7ccc2[_0x52b6('0xf')],_0xc7ccc2[_0x52b6('0x10')],_0x247d40[_0x52b6('0x11')],_0x5317b2[_0x52b6('0xe')])[_0x52b6('0x12')](function(_0x1ab3f5){logger[_0x52b6('0x13')](util[_0x52b6('0xc')](_0x52b6('0x14'),_0x5317b2['id'],_0x5317b2[_0x52b6('0xe')],_0x1ab3f5['TranscriptionJob'][_0x52b6('0x15')]));if(!_0x5317b2[_0x52b6('0x16')]){switch(_0x1ab3f5[_0x52b6('0x17')]['TranscriptionJobStatus']){case _0x52b6('0x18'):var _0x184ee8={'transcribeStatus':_0x1ab3f5['TranscriptionJob']['TranscriptionJobStatus'],'fileUri':_0x1ab3f5[_0x52b6('0x17')]['Transcript'][_0x52b6('0x19')]};logger['info'](util[_0x52b6('0xc')](_0x52b6('0x1a'),_0x5317b2['id']));return rp({'uri':_0x1ab3f5[_0x52b6('0x17')][_0x52b6('0x1b')]['TranscriptFileUri'],'json':!![]})[_0x52b6('0x12')](function(_0x364b0a){logger[_0x52b6('0x13')](util[_0x52b6('0xc')](_0x52b6('0x1c'),_0x5317b2['id']));if(_0x364b0a&&_0x364b0a[_0x52b6('0x1d')]&&_0x364b0a[_0x52b6('0x1d')][_0x52b6('0x1e')]&&_0x364b0a[_0x52b6('0x1d')]['transcripts'][_0x52b6('0x1f')]){_0x184ee8[_0x52b6('0x16')]='';for(var _0x3a2fb0=0x0;_0x3a2fb0<_0x364b0a[_0x52b6('0x1d')][_0x52b6('0x1e')][_0x52b6('0x1f')];_0x3a2fb0++){_0x184ee8[_0x52b6('0x16')]+=_0x364b0a[_0x52b6('0x1d')][_0x52b6('0x1e')][_0x3a2fb0][_0x52b6('0x20')]+'';}}return _0x5317b2[_0x52b6('0x21')](_0x184ee8);})[_0x52b6('0x12')](function(){logger[_0x52b6('0x13')](util[_0x52b6('0xc')](_0x52b6('0x22'),_0x5317b2['id']));if(!_0x5317b2[_0x52b6('0x23')]){throw new db['Sequelize'][(_0x52b6('0x24'))](_0x52b6('0x25'));}if(!_0x247d40[_0x52b6('0x26')]||!_0x247d40[_0x52b6('0x27')]||!_0x247d40[_0x52b6('0x28')]||!_0x247d40[_0x52b6('0x29')]||!_0x247d40[_0x52b6('0x2a')]){throw new db['Sequelize'][(_0x52b6('0x24'))](_0x52b6('0x2b'));}if(!_0x184ee8['fileText']){throw new Error(_0x52b6('0x2c'));}if(_0x247d40[_0x52b6('0x27')]===_0xc7ccc2['id']){return _0xc7ccc2;}else{return db[_0x52b6('0x2d')][_0x52b6('0x2e')]({'where':{'id':_settings[_0x52b6('0x27')]}});}})['then'](function(_0x26b348){if(!_0x26b348){throw new db['Sequelize'][(_0x52b6('0x24'))](_0x52b6('0x2f'));}if(!_0x26b348[_0x52b6('0xf')]||!_0x26b348[_0x52b6('0x10')]){throw new db[(_0x52b6('0x30'))][(_0x52b6('0x24'))]('Cloud\x20Provider\x20not\x20configured');}_0x5292e4=_0x26b348;logger[_0x52b6('0x13')](util[_0x52b6('0xc')](_0x52b6('0x31'),_0x5317b2['id']));return sentiment(_0x5292e4['data1'],_0x5292e4['data2'],_0x247d40[_0x52b6('0x28')],_0x184ee8[_0x52b6('0x16')],_0x247d40['language']);})[_0x52b6('0x12')](function(_0x46580c){logger[_0x52b6('0x13')](util[_0x52b6('0xc')](_0x52b6('0x32'),_0x5317b2['id']));return _0x5317b2[_0x52b6('0x21')]({'sentiment':_0x46580c[_0x52b6('0x33')],'sPositive':_0x46580c[_0x52b6('0x34')][_0x52b6('0x35')],'sNegative':_0x46580c[_0x52b6('0x34')][_0x52b6('0x36')],'sMixed':_0x46580c[_0x52b6('0x34')]['Mixed'],'sNeutral':_0x46580c[_0x52b6('0x34')][_0x52b6('0x37')]});})[_0x52b6('0x12')](function(){logger[_0x52b6('0x13')](util[_0x52b6('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5317b2['id']));_0x10afe3();});case'FAILED':return _0x5317b2[_0x52b6('0x21')]({'transcribeStatus':_0x52b6('0x38'),'failureReason':_0x1ab3f5['TranscriptionJob']['FailureReason']})[_0x52b6('0x12')](function(){logger['info'](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5317b2['id']));_0x10afe3();});default:logger[_0x52b6('0x13')](util[_0x52b6('0xc')](_0x52b6('0x39'),_0x5317b2['id']));break;}}else{return BPromise[_0x52b6('0x3a')]()[_0x52b6('0x12')](function(){if(!_0x5317b2[_0x52b6('0x23')]){throw new db[(_0x52b6('0x30'))][(_0x52b6('0x24'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x247d40[_0x52b6('0x26')]||!_0x247d40[_0x52b6('0x27')]||!_0x247d40['sentimentRegion']||!_0x247d40[_0x52b6('0x29')]||!_0x247d40[_0x52b6('0x2a')]){throw new db[(_0x52b6('0x30'))][(_0x52b6('0x24'))](_0x52b6('0x2b'));}if(!_0x5317b2[_0x52b6('0x16')]){throw new Error(_0x52b6('0x2c'));}if(_0x247d40[_0x52b6('0x27')]===_0xc7ccc2['id']){return _0xc7ccc2;}else{return db['CloudProvider'][_0x52b6('0x2e')]({'where':{'id':_settings[_0x52b6('0x27')]}});}})[_0x52b6('0x12')](function(_0x41c535){if(!_0x41c535){throw new db['Sequelize'][(_0x52b6('0x24'))](_0x52b6('0x2f'));}if(!_0x41c535['data1']||!_0x41c535[_0x52b6('0x10')]){throw new db[(_0x52b6('0x30'))][(_0x52b6('0x24'))](_0x52b6('0x3b'));}_0x5292e4=_0x41c535;logger[_0x52b6('0x13')](util[_0x52b6('0xc')](_0x52b6('0x31'),_0x5317b2['id']));return sentiment(_0x5292e4[_0x52b6('0xf')],_0x5292e4[_0x52b6('0x10')],_0x247d40[_0x52b6('0x28')],_0x5317b2[_0x52b6('0x16')],_0x247d40[_0x52b6('0x29')]);})[_0x52b6('0x12')](function(_0x1985f9){logger[_0x52b6('0x13')](util[_0x52b6('0xc')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x5317b2['id']));return _0x5317b2['update']({'sentiment':_0x1985f9['Sentiment'],'sPositive':_0x1985f9['SentimentScore'][_0x52b6('0x35')],'sNegative':_0x1985f9[_0x52b6('0x34')][_0x52b6('0x36')],'sMixed':_0x1985f9[_0x52b6('0x34')]['Mixed'],'sNeutral':_0x1985f9[_0x52b6('0x34')][_0x52b6('0x37')],'transcribeStatus':_0x52b6('0x18')});})[_0x52b6('0x12')](function(){logger[_0x52b6('0x13')](util[_0x52b6('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5317b2['id']));_0x10afe3();});}})[_0x52b6('0x3c')](function(_0x34625a){if(_0x34625a){if(!_0x34625a[_0x52b6('0x3d')]||_0x34625a[_0x52b6('0x3d')]!==_0x52b6('0x3e')){logger[_0x52b6('0x3f')](util[_0x52b6('0xc')](_0x52b6('0x40'),_0x5317b2['id']),util[_0x52b6('0x41')](_0x34625a,{'showHidden':![],'depth':null}));}}_0x10afe3();});});}function checkTranscribe(){var _0x1521af;var _0x35f5e2;var _0x42182a;return db[_0x52b6('0x42')][_0x52b6('0x43')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x52b6('0x12')](function(_0x732df8){if(!_0x732df8||!_0x732df8[_0x52b6('0x1f')]){throw new db[(_0x52b6('0x30'))][(_0x52b6('0x24'))](_0x52b6('0x44'));}_0x1521af=_0x732df8;return db[_0x52b6('0x45')][_0x52b6('0x2e')]({'where':{'id':0x1}});})['then'](function(_0x533784){if(!_0x533784){throw new db[(_0x52b6('0x30'))][(_0x52b6('0x24'))](_0x52b6('0x46'));}_0x35f5e2=_0x533784;if(!_0x35f5e2[_0x52b6('0x7')]||!_0x35f5e2[_0x52b6('0x47')]||!_0x35f5e2[_0x52b6('0x11')]||!_0x35f5e2[_0x52b6('0x29')]||!_0x35f5e2[_0x52b6('0x2a')]){throw new db[(_0x52b6('0x30'))][(_0x52b6('0x24'))](_0x52b6('0x48'));}return db[_0x52b6('0x2d')][_0x52b6('0x2e')]({'where':{'id':_0x35f5e2['transcribeAccountId']}});})[_0x52b6('0x12')](function(_0x28efbf){if(!_0x28efbf){throw new db[(_0x52b6('0x30'))][(_0x52b6('0x24'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x28efbf[_0x52b6('0xf')]||!_0x28efbf[_0x52b6('0x10')]){throw new db[(_0x52b6('0x30'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x42182a=_0x28efbf;var _0x2a893a=[];_0x1521af[_0x52b6('0x49')](function(_0x106707){_0x2a893a[_0x52b6('0x4a')](checkTranscribeJob(_0x106707,_0x35f5e2,_0x42182a));});return BPromise['all'](_0x2a893a);})[_0x52b6('0x3c')](function(_0x5d4be6){if(_0x5d4be6){if(!_0x5d4be6[_0x52b6('0x3d')]||_0x5d4be6[_0x52b6('0x3d')]!==_0x52b6('0x3e')){logger[_0x52b6('0x3f')](util[_0x52b6('0x41')](_0x5d4be6,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index a13e8bb..19ff9ec 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 _0xbe9e=['moment','util','../../mysqldb','../logger','schedule','redis','WhatsappInteraction','lastMsgAt','hours','length','map','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','then','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash'];(function(_0x1fb4e1,_0x3d4ce6){var _0x22d1b0=function(_0x553822){while(--_0x553822){_0x1fb4e1['push'](_0x1fb4e1['shift']());}};_0x22d1b0(++_0x3d4ce6);}(_0xbe9e,0x11d));var _0xebe9=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xbe9e[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0xebe9('0x0'));var moment=require(_0xebe9('0x1'));var Redis=require('ioredis');var util=require(_0xebe9('0x2'));var config=require('../../config/environment');var db=require(_0xebe9('0x3'))['db'];var logger=require(_0xebe9('0x4'))(_0xebe9('0x5'));config[_0xebe9('0x6')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xebe9('0x6')]));function closeInteractions(){var _0x57fa32=[];return db[_0xebe9('0x7')]['findAll']({'raw':!![],'attributes':['id',_0xebe9('0x8')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xebe9('0x9'))}}})['then'](function(_0x4b9423){if(_0x4b9423&&_0x4b9423[_0xebe9('0xa')]){_0x57fa32=_[_0xebe9('0xb')](_0x4b9423||[],'id');logger['info']('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x57fa32[_0xebe9('0xc')]());return db[_0xebe9('0x7')][_0xebe9('0xd')]({'closeReason':_0xebe9('0xe'),'disposition':_0xebe9('0xf'),'closed':!![],'closedAt':moment()[_0xebe9('0x10')](_0xebe9('0x11'))},{'where':{'id':_0x57fa32}});}})[_0xebe9('0x12')](function(){if(_0x57fa32&&_0x57fa32[_0xebe9('0xa')]){logger[_0xebe9('0x13')](_0xebe9('0x14'),_0x57fa32[_0xebe9('0xc')]());for(var _0x4d6f55=0x0;_0x4d6f55<_0x57fa32['length'];_0x4d6f55++){io[_0xebe9('0x15')]('whatsappInteraction:update',{'id':_0x57fa32[_0x4d6f55],'closed':!![]});}}})[_0xebe9('0x16')](function(_0x36df17){logger[_0xebe9('0x17')](_0xebe9('0x18'),_0x36df17?util[_0xebe9('0x19')](_0x36df17,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x6d37=['defaults','localhost','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','update','system','format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','emit','whatsappInteraction:update','catch','error','inspect','lodash','moment','ioredis','../../config/environment','../../mysqldb','../logger','schedule','redis'];(function(_0x48ba95,_0x4ab953){var _0xb38f80=function(_0x1a6a57){while(--_0x1a6a57){_0x48ba95['push'](_0x48ba95['shift']());}};_0xb38f80(++_0x4ab953);}(_0x6d37,0x18e));var _0x76d3=function(_0x34dd1a,_0x5ee42f){_0x34dd1a=_0x34dd1a-0x0;var _0x2f47de=_0x6d37[_0x34dd1a];return _0x2f47de;};'use strict';var _=require(_0x76d3('0x0'));var moment=require(_0x76d3('0x1'));var Redis=require(_0x76d3('0x2'));var util=require('util');var config=require(_0x76d3('0x3'));var db=require(_0x76d3('0x4'))['db'];var logger=require(_0x76d3('0x5'))(_0x76d3('0x6'));config[_0x76d3('0x7')]=_[_0x76d3('0x8')](config[_0x76d3('0x7')],{'host':_0x76d3('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x76d3('0x7')]));function closeInteractions(){var _0x5501a9=[];return db[_0x76d3('0xa')][_0x76d3('0xb')]({'raw':!![],'attributes':['id',_0x76d3('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x76d3('0xd')](0x18,_0x76d3('0xe'))}}})[_0x76d3('0xf')](function(_0x750d02){if(_0x750d02&&_0x750d02[_0x76d3('0x10')]){_0x5501a9=_[_0x76d3('0x11')](_0x750d02||[],'id');logger['info'](_0x76d3('0x12'),_0x5501a9['join']());return db[_0x76d3('0xa')][_0x76d3('0x13')]({'closeReason':_0x76d3('0x14'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x76d3('0x15')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x5501a9}});}})[_0x76d3('0xf')](function(){if(_0x5501a9&&_0x5501a9[_0x76d3('0x10')]){logger['info'](_0x76d3('0x16'),_0x5501a9[_0x76d3('0x17')]());for(var _0x144068=0x0;_0x144068<_0x5501a9[_0x76d3('0x10')];_0x144068++){io[_0x76d3('0x18')](_0x76d3('0x19'),{'id':_0x5501a9[_0x144068],'closed':!![]});}}})[_0x76d3('0x1a')](function(_0x50ff99){logger[_0x76d3('0x1b')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x50ff99?util[_0x76d3('0x1c')](_0x50ff99,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index d86e72b..b061864 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf5d8=['innocenzo.biondo','@xcally.com','push','now','destroy','CmContact','bulkCreate','then','finished\x20populating','hopper1','log','contacts2','CmHopper','hopper2','util','../mysqldb','Innocenzo','Biondo'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf5d8,0xd4));var _0x8f5d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf5d8[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0x8f5d('0x0'));var db=require(_0x8f5d('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x8f5d('0x2')+i,'lastName':_0x8f5d('0x3')+i,'phone':0xf879fb460+i,'email':_0x8f5d('0x4')+i+_0x8f5d('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x8f5d('0x6')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x8f5d('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x8f5d('0x2')+i,'lastName':_0x8f5d('0x3')+i,'phone':0xf879fb460+i,'email':_0x8f5d('0x4')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x8f5d('0x6')]({'id':i,'active':![],'scheduledat':Date[_0x8f5d('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x8f5d('0x7')](),'updatedAt':Date[_0x8f5d('0x7')]()});}db['CmContact'][_0x8f5d('0x8')]({'where':{}})['then'](function(){return db[_0x8f5d('0x9')][_0x8f5d('0xa')](contacts);})[_0x8f5d('0xb')](function(){console['log'](_0x8f5d('0xc'),'contacts1');return db['CmHopper'][_0x8f5d('0x8')]({'where':{}});})[_0x8f5d('0xb')](function(){return db['CmHopper'][_0x8f5d('0xa')](hopper);})[_0x8f5d('0xb')](function(){console['log']('finished\x20populating',_0x8f5d('0xd'));return db[_0x8f5d('0x9')]['bulkCreate'](contacts2);})['then'](function(){console[_0x8f5d('0xe')](_0x8f5d('0xc'),_0x8f5d('0xf'));return db[_0x8f5d('0x10')][_0x8f5d('0xa')](hopper2);})[_0x8f5d('0xb')](function(){console['log'](_0x8f5d('0xc'),_0x8f5d('0x11'));})['catch'](function(_0x229ba7){console[_0x8f5d('0xe')](_0x229ba7);}); \ No newline at end of file +var _0x7823=['now','Innocenzo','CmContact','destroy','then','bulkCreate','contacts1','CmHopper','log','finished\x20populating','hopper1','contacts2','util','push','Biondo','innocenzo.biondo','@xcally.com'];(function(_0x519ec2,_0x4a0757){var _0x2e9864=function(_0x490b78){while(--_0x490b78){_0x519ec2['push'](_0x519ec2['shift']());}};_0x2e9864(++_0x4a0757);}(_0x7823,0x1a4));var _0x3782=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x7823[_0x6c993a];return _0x27f547;};'use strict';var util=require(_0x3782('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x3782('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x3782('0x2')+i,'phone':0xf879fb460+i,'email':_0x3782('0x3')+i+_0x3782('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x3782('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x3782('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x3782('0x5')](),'updatedAt':Date[_0x3782('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x3782('0x1')]({'id':i,'firstName':_0x3782('0x6')+i,'lastName':_0x3782('0x2')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x3782('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x3782('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x3782('0x5')](),'updatedAt':Date[_0x3782('0x5')]()});}db[_0x3782('0x7')][_0x3782('0x8')]({'where':{}})[_0x3782('0x9')](function(){return db[_0x3782('0x7')][_0x3782('0xa')](contacts);})['then'](function(){console['log']('finished\x20populating',_0x3782('0xb'));return db[_0x3782('0xc')][_0x3782('0x8')]({'where':{}});})['then'](function(){return db[_0x3782('0xc')][_0x3782('0xa')](hopper);})[_0x3782('0x9')](function(){console[_0x3782('0xd')](_0x3782('0xe'),_0x3782('0xf'));return db[_0x3782('0x7')]['bulkCreate'](contacts2);})[_0x3782('0x9')](function(){console[_0x3782('0xd')](_0x3782('0xe'),_0x3782('0x10'));return db[_0x3782('0xc')][_0x3782('0xa')](hopper2);})[_0x3782('0x9')](function(){console[_0x3782('0xd')]('finished\x20populating','hopper2');})['catch'](function(_0x4a9c4b){console[_0x3782('0xd')](_0x4a9c4b);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 9fec6db..b1eac61 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x97f1=['password','friend','udp','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','log','catch','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com'];(function(_0xda501a,_0x159d6a){var _0x44be3a=function(_0x5c1c5f){while(--_0x5c1c5f){_0xda501a['push'](_0xda501a['shift']());}};_0x44be3a(++_0x159d6a);}(_0x97f1,0x1c5));var _0x197f=function(_0x3a176e,_0x332678){_0x3a176e=_0x3a176e-0x0;var _0x42f3ac=_0x97f1[_0x3a176e];return _0x42f3ac;};'use strict';var util=require(_0x197f('0x0'));var db=require(_0x197f('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x197f('0x2')]({'name':util[_0x197f('0x3')](_0x197f('0x4'),_0x197f('0x5'),i),'fullname':util[_0x197f('0x3')](_0x197f('0x4'),_0x197f('0x5'),i),'email':util[_0x197f('0x3')](_0x197f('0x6'),'agent',i),'role':_0x197f('0x5'),'password':_0x197f('0x7'),'internal':0xfa0+i,'type':_0x197f('0x8'),'transport':[_0x197f('0x9'),'ws','wss'],'disallow':[_0x197f('0xa')],'allow':[_0x197f('0xb')],'defaultuser':util[_0x197f('0x3')]('%s%s',_0x197f('0x5'),i),'encryption':_0x197f('0xc'),'avpf':_0x197f('0xc'),'force_avp':'yes','icesupport':_0x197f('0xc'),'dtlsenable':_0x197f('0xc'),'dtlsverify':'no','dtlscertfile':_0x197f('0xd'),'dtlsprivatekey':_0x197f('0xe'),'dtlssetup':_0x197f('0xf'),'callerid':util['format'](_0x197f('0x10'),util[_0x197f('0x3')](_0x197f('0x4'),_0x197f('0x5'),i),0xfa0+i)});}db[_0x197f('0x11')]['bulkCreate'](users)['then'](function(){console[_0x197f('0x12')]('add\x20user');})[_0x197f('0x13')](function(_0x5e76d4){console[_0x197f('0x12')](_0x5e76d4);}); \ No newline at end of file +var _0x5e90=['bulkCreate','then','log','add\x20user','catch','util','../mysqldb','push','%s%s','format','%s%s@xcally.com','agent','friend','wss','all','ulaw','yes','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>'];(function(_0x304a0d,_0x96d9b8){var _0x354df5=function(_0x48dfd8){while(--_0x48dfd8){_0x304a0d['push'](_0x304a0d['shift']());}};_0x354df5(++_0x96d9b8);}(_0x5e90,0x195));var _0x05e9=function(_0x5caa62,_0x196ce2){_0x5caa62=_0x5caa62-0x0;var _0x38edea=_0x5e90[_0x5caa62];return _0x38edea;};'use strict';var util=require(_0x05e9('0x0'));var db=require(_0x05e9('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x05e9('0x2')]({'name':util['format'](_0x05e9('0x3'),'agent',i),'fullname':util[_0x05e9('0x4')]('%s%s','agent',i),'email':util[_0x05e9('0x4')](_0x05e9('0x5'),_0x05e9('0x6'),i),'role':_0x05e9('0x6'),'password':'password','internal':0xfa0+i,'type':_0x05e9('0x7'),'transport':['udp','ws',_0x05e9('0x8')],'disallow':[_0x05e9('0x9')],'allow':[_0x05e9('0xa')],'defaultuser':util['format'](_0x05e9('0x3'),_0x05e9('0x6'),i),'encryption':_0x05e9('0xb'),'avpf':'yes','force_avp':_0x05e9('0xb'),'icesupport':_0x05e9('0xb'),'dtlsenable':_0x05e9('0xb'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x05e9('0xc'),'dtlssetup':_0x05e9('0xd'),'callerid':util[_0x05e9('0x4')](_0x05e9('0xe'),util[_0x05e9('0x4')](_0x05e9('0x3'),_0x05e9('0x6'),i),0xfa0+i)});}db['User'][_0x05e9('0xf')](users)[_0x05e9('0x10')](function(){console[_0x05e9('0x11')](_0x05e9('0x12'));})[_0x05e9('0x13')](function(_0x4e0e78){console[_0x05e9('0x11')](_0x4e0e78);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 339573d..e697932 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x79bf=['removeWhatsappInteractions','catch','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','log','SocketIO\x20','nsp','disconnect','CONNECTED','util','../mysqldb','name','Agents','User','role','agent','type','ivr','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','map','telephone','where','format','length','user:%s','handshake','query','find','userProfileId','MailInteraction','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','admin','voice:outbound','hasOwnProperty','include','push','VoiceQueue','FaxQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Campaign','voice:inbound','ChatQueue','SmsQueues','Trunk','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getWhatsappQueues','all','sms','mail','openchannel','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','removeOpenchannelInteractions','WhatsappInteractions'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x79bf,0x1df));var _0xf79b=function(_0x2d97fa,_0x5b488a){_0x2d97fa=_0x2d97fa-0x0;var _0x575d9c=_0x79bf[_0x2d97fa];return _0x575d9c;};'use strict';var _=require('lodash');var util=require(_0xf79b('0x0'));var BPromise=require('bluebird');var db=require(_0xf79b('0x1'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0xf79b('0x2')],'include':[{'as':_0xf79b('0x3'),'model':db[_0xf79b('0x4')],'attributes':['id',_0xf79b('0x2'),_0xf79b('0x5')],'raw':!![],'where':{'role':_0xf79b('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xf79b('0x2')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0xf79b('0x2')]};var queryAgents={'raw':!![],'attributes':['id',_0xf79b('0x2')],'where':{'role':_0xf79b('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0xf79b('0x7')],'where':{'type':_0xf79b('0x8')}};function getAssociatedResources(_0x252fb4,_0x375059,_0x4fe1be){return db['UserProfileSection'][_0xf79b('0x9')]({'where':{'name':_0x252fb4,'userProfileId':_0x375059},'raw':!![]})[_0xf79b('0xa')](function(_0x285865){if(_0x285865){if(_0x285865[_0xf79b('0xb')]){switch(_0x252fb4){case _0xf79b('0xc'):case _0xf79b('0xd'):case _0xf79b('0xe'):case'SmsQueues':case _0xf79b('0xf'):case _0xf79b('0x10'):case _0xf79b('0x11'):return db[_0x4fe1be][_0xf79b('0x12')](queryQueues);case _0xf79b('0x13'):return db[_0x4fe1be][_0xf79b('0x12')](queryTelephones);case _0xf79b('0x14'):return db[_0x4fe1be][_0xf79b('0x12')](queryTrunks);case _0xf79b('0x15'):return db[_0x4fe1be][_0xf79b('0x12')](queryCampaigns);}}else{return db[_0xf79b('0x16')][_0xf79b('0x12')]({'attributes':['resourceId'],'where':{'sectionId':_0x285865['id']},'raw':!![]})['then'](function(_0x1647c5){if(_0x1647c5){var _0x595790={'where':{'id':_[_0xf79b('0x17')](_0x1647c5,'resourceId')},'raw':!![]};switch(_0x4fe1be){case _0xf79b('0x4'):_0x595790['where']['role']=_0xf79b('0x18');break;case'Campaign':_0x595790[_0xf79b('0x19')][_0xf79b('0x7')]=_0xf79b('0x8');break;}return db[_0x4fe1be]['findAll'](_0x595790);}else{return[];}});}}else{return[];}})[_0xf79b('0xa')](function(_0x5d4a9d){return _0x5d4a9d;});}function joinOrLeaveQueues(_0x379ac0,_0x7f5a0c,_0x2340e3,_0x889cdc){_0x379ac0[_0x7f5a0c](util[_0xf79b('0x1a')]('%s:queue:%s',_0x2340e3,_0x889cdc[_0xf79b('0x2')]));if(_0x889cdc['Agents']){for(var _0x5d33fa=0x0;_0x5d33fa<_0x889cdc[_0xf79b('0x3')][_0xf79b('0x1b')];_0x5d33fa+=0x1){_0x379ac0[_0x7f5a0c](util[_0xf79b('0x1a')](_0xf79b('0x1c'),_0x889cdc[_0xf79b('0x3')][_0x5d33fa][_0xf79b('0x2')]));}}}function joinOrLeave(_0x5dd34d,_0x255c13,_0x471e42){var _0x378db3;if(_0x5dd34d[_0xf79b('0x1d')][_0xf79b('0x1e')]['id']){db[_0xf79b('0x4')][_0xf79b('0x1f')]({'attributes':['id',_0xf79b('0x2'),_0xf79b('0x5'),_0xf79b('0x20')],'where':{'id':_0x5dd34d['handshake'][_0xf79b('0x1e')]['id']},'include':[{'model':db['ChatInteraction'],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xf79b('0x21')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xf79b('0x22')],'as':_0xf79b('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xf79b('0x24')],'as':_0xf79b('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xf79b('0x26')],'as':_0xf79b('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xf79b('0x28')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0xf79b('0xa')](function(_0x470f5b){if(_0x470f5b){_0x378db3=_0x470f5b;_0x5dd34d[_0x255c13](util[_0xf79b('0x1a')]('user:%s',_0x470f5b[_0xf79b('0x2')]));var _0x3b7c5d=[];switch(_0x470f5b['role']){case _0xf79b('0x29'):_0x5dd34d[_0x255c13]('voice:inbound');_0x5dd34d[_0x255c13](_0xf79b('0x2a'));if(queryQueues[_0xf79b('0x2b')](_0xf79b('0x2c'))){delete queryQueues[_0xf79b('0x2c')];}_0x3b7c5d[_0xf79b('0x2d')](db[_0xf79b('0x2e')][_0xf79b('0x12')](queryQueues));_0x3b7c5d[_0xf79b('0x2d')](db['ChatQueue'][_0xf79b('0x12')](queryQueues));_0x3b7c5d[_0xf79b('0x2d')](db[_0xf79b('0x2f')][_0xf79b('0x12')](queryQueues));_0x3b7c5d[_0xf79b('0x2d')](db['SmsQueue']['findAll'](queryQueues));_0x3b7c5d[_0xf79b('0x2d')](db[_0xf79b('0x30')][_0xf79b('0x12')](queryQueues));_0x3b7c5d[_0xf79b('0x2d')](db[_0xf79b('0x31')]['findAll'](queryQueues));_0x3b7c5d['push'](db[_0xf79b('0x32')][_0xf79b('0x12')](queryQueues));_0x3b7c5d[_0xf79b('0x2d')](db[_0xf79b('0x4')][_0xf79b('0x12')](queryTelephones));_0x3b7c5d[_0xf79b('0x2d')](db['Trunk'][_0xf79b('0x12')](queryTrunks));_0x3b7c5d[_0xf79b('0x2d')](db[_0xf79b('0x33')][_0xf79b('0x12')](queryCampaigns));_0x3b7c5d[_0xf79b('0x2d')](db['User'][_0xf79b('0x12')](queryAgents));break;case'user':_0x5dd34d[_0x255c13](_0xf79b('0x34'));_0x5dd34d[_0x255c13]('voice:outbound');_0x3b7c5d[_0xf79b('0x2d')](getAssociatedResources(_0xf79b('0xc'),_0x470f5b[_0xf79b('0x20')],_0xf79b('0x2e')));_0x3b7c5d['push'](getAssociatedResources('ChatQueues',_0x470f5b['userProfileId'],_0xf79b('0x35')));_0x3b7c5d[_0xf79b('0x2d')](getAssociatedResources('FaxQueues',_0x470f5b[_0xf79b('0x20')],'FaxQueue'));_0x3b7c5d[_0xf79b('0x2d')](getAssociatedResources(_0xf79b('0x36'),_0x470f5b[_0xf79b('0x20')],'SmsQueue'));_0x3b7c5d[_0xf79b('0x2d')](getAssociatedResources(_0xf79b('0xf'),_0x470f5b['userProfileId'],_0xf79b('0x30')));_0x3b7c5d['push'](getAssociatedResources(_0xf79b('0x10'),_0x470f5b[_0xf79b('0x20')],_0xf79b('0x31')));_0x3b7c5d[_0xf79b('0x2d')](getAssociatedResources(_0xf79b('0x11'),_0x470f5b[_0xf79b('0x20')],_0xf79b('0x32')));_0x3b7c5d[_0xf79b('0x2d')](getAssociatedResources(_0xf79b('0x13'),_0x470f5b[_0xf79b('0x20')],_0xf79b('0x4')));_0x3b7c5d[_0xf79b('0x2d')](getAssociatedResources('Trunks',_0x470f5b[_0xf79b('0x20')],_0xf79b('0x37')));_0x3b7c5d['push'](getAssociatedResources('IvrCampaigns',_0x470f5b[_0xf79b('0x20')],_0xf79b('0x33')));_0x3b7c5d[_0xf79b('0x2d')](db[_0xf79b('0x4')][_0xf79b('0x12')](queryAgents));break;case'agent':_0x5dd34d[_0x255c13](_0xf79b('0x34'));_0x5dd34d[_0x255c13](_0xf79b('0x2a'));_0x3b7c5d[_0xf79b('0x2d')](_0x470f5b[_0xf79b('0x38')]({'attributes':['id',_0xf79b('0x2')]}));_0x3b7c5d[_0xf79b('0x2d')](_0x470f5b[_0xf79b('0x39')]({'attributes':['id',_0xf79b('0x2')]}));_0x3b7c5d[_0xf79b('0x2d')](_0x470f5b[_0xf79b('0x3a')]({'attributes':['id',_0xf79b('0x2')]}));_0x3b7c5d[_0xf79b('0x2d')](_0x470f5b[_0xf79b('0x3b')]({'attributes':['id',_0xf79b('0x2')]}));_0x3b7c5d[_0xf79b('0x2d')](_0x470f5b[_0xf79b('0x3c')]({'attributes':['id','name']}));_0x3b7c5d[_0xf79b('0x2d')](_0x470f5b['getOpenchannelQueues']({'attributes':['id',_0xf79b('0x2')]}));_0x3b7c5d[_0xf79b('0x2d')](_0x470f5b[_0xf79b('0x3d')]({'attributes':['id',_0xf79b('0x2')]}));break;}return BPromise[_0xf79b('0x3e')](_0x3b7c5d);}})[_0xf79b('0xa')](function(_0xfda08e){if(_0xfda08e&&_0xfda08e[_0xf79b('0x1b')]){for(var _0x46b1a6=0x0;_0x46b1a6<_0xfda08e['length'];_0x46b1a6+=0x1){for(var _0x55f2e2=0x0;_0x55f2e2<_0xfda08e[_0x46b1a6][_0xf79b('0x1b')];_0x55f2e2+=0x1){switch(_0x46b1a6){case 0x0:joinOrLeaveQueues(_0x5dd34d,_0x255c13,'voice',_0xfda08e[_0x46b1a6][_0x55f2e2]);break;case 0x1:joinOrLeaveQueues(_0x5dd34d,_0x255c13,'chat',_0xfda08e[_0x46b1a6][_0x55f2e2]);break;case 0x2:joinOrLeaveQueues(_0x5dd34d,_0x255c13,'fax',_0xfda08e[_0x46b1a6][_0x55f2e2]);break;case 0x3:joinOrLeaveQueues(_0x5dd34d,_0x255c13,_0xf79b('0x3f'),_0xfda08e[_0x46b1a6][_0x55f2e2]);break;case 0x4:joinOrLeaveQueues(_0x5dd34d,_0x255c13,_0xf79b('0x40'),_0xfda08e[_0x46b1a6][_0x55f2e2]);break;case 0x5:joinOrLeaveQueues(_0x5dd34d,_0x255c13,_0xf79b('0x41'),_0xfda08e[_0x46b1a6][_0x55f2e2]);break;case 0x6:joinOrLeaveQueues(_0x5dd34d,_0x255c13,'whatsapp',_0xfda08e[_0x46b1a6][_0x55f2e2]);break;case 0x7:if(_0x378db3[_0xf79b('0x5')]!==_0xf79b('0x6'))_0x5dd34d[_0x255c13](util['format'](_0xf79b('0x42'),_0xfda08e[_0x46b1a6][_0x55f2e2][_0xf79b('0x2')]));break;case 0x8:if(_0x378db3['role']!==_0xf79b('0x6'))_0x5dd34d[_0x255c13](util[_0xf79b('0x1a')](_0xf79b('0x43'),_0xfda08e[_0x46b1a6][_0x55f2e2][_0xf79b('0x2')]));break;case 0x9:if(_0x378db3[_0xf79b('0x5')]!==_0xf79b('0x6'))_0x5dd34d[_0x255c13](util[_0xf79b('0x1a')](_0xf79b('0x44'),_0xfda08e[_0x46b1a6][_0x55f2e2]['type'],_0xfda08e[_0x46b1a6][_0x55f2e2][_0xf79b('0x2')]));break;case 0xa:_0x5dd34d[_0x255c13](util[_0xf79b('0x1a')](_0xf79b('0x1c'),_0xfda08e[_0x46b1a6][_0x55f2e2][_0xf79b('0x2')]));break;}}}}})[_0xf79b('0xa')](function(){if(_0x255c13===_0xf79b('0x45')){var _0x5da701=_[_0xf79b('0x17')](_0x378db3['ChatInteractions'],'id');return _0x378db3[_0xf79b('0x46')](_0x5da701)[_0xf79b('0xa')](function(){for(var _0x774b16=0x0;_0x774b16<_0x5da701['length'];_0x774b16+=0x1){_0x471e42[_0xf79b('0x47')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x5da701[_0x774b16]),'UserId':Number(_0x378db3['id'])});}});}})[_0xf79b('0xa')](function(){if(_0x255c13===_0xf79b('0x45')){var _0x515915=_[_0xf79b('0x17')](_0x378db3['MailInteractions'],'id');return _0x378db3[_0xf79b('0x48')](_0x515915)['then'](function(){for(var _0x545baa=0x0;_0x545baa<_0x515915[_0xf79b('0x1b')];_0x545baa+=0x1){_0x471e42[_0xf79b('0x47')](_0xf79b('0x49'),{'MailInteractionId':Number(_0x515915[_0x545baa]),'UserId':Number(_0x378db3['id'])});}});}})[_0xf79b('0xa')](function(){if(_0x255c13===_0xf79b('0x45')){var _0x4c4812=_[_0xf79b('0x17')](_0x378db3[_0xf79b('0x23')],'id');return _0x378db3[_0xf79b('0x4a')](_0x4c4812)[_0xf79b('0xa')](function(){for(var _0x529ce7=0x0;_0x529ce7<_0x4c4812[_0xf79b('0x1b')];_0x529ce7+=0x1){_0x471e42[_0xf79b('0x47')](_0xf79b('0x4b'),{'FaxInteractionId':Number(_0x4c4812[_0x529ce7]),'UserId':Number(_0x378db3['id'])});}});}})['then'](function(){if(_0x255c13===_0xf79b('0x45')){var _0x43f712=_['map'](_0x378db3[_0xf79b('0x25')],'id');return _0x378db3[_0xf79b('0x4c')](_0x43f712)[_0xf79b('0xa')](function(){for(var _0x5f137f=0x0;_0x5f137f<_0x43f712[_0xf79b('0x1b')];_0x5f137f+=0x1){_0x471e42[_0xf79b('0x47')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x43f712[_0x5f137f]),'UserId':Number(_0x378db3['id'])});}});}})['then'](function(){if(_0x255c13===_0xf79b('0x45')){var _0x5bad4f=_['map'](_0x378db3['OpenchannelInteractions'],'id');return _0x378db3[_0xf79b('0x4d')](_0x5bad4f)[_0xf79b('0xa')](function(){for(var _0x4435df=0x0;_0x4435df<_0x5bad4f['length'];_0x4435df+=0x1){_0x471e42[_0xf79b('0x47')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x5bad4f[_0x4435df]),'UserId':Number(_0x378db3['id'])});}});}})[_0xf79b('0xa')](function(){if(_0x255c13===_0xf79b('0x45')){var _0x180ff1=_[_0xf79b('0x17')](_0x378db3[_0xf79b('0x4e')],'id');return _0x378db3[_0xf79b('0x4f')](_0x180ff1)['then'](function(){for(var _0xfc436a=0x0;_0xfc436a<_0x180ff1[_0xf79b('0x1b')];_0xfc436a+=0x1){_0x471e42[_0xf79b('0x47')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x180ff1[_0xfc436a]),'UserId':Number(_0x378db3['id'])});}});}})[_0xf79b('0x50')](function(_0x58ec0e){_0x5dd34d['log'](_0x58ec0e);});}}function onDisconnect(_0x3d9cd8,_0x20a030){joinOrLeave(_0x3d9cd8,_0xf79b('0x45'),_0x20a030);}function onConnect(_0xa0366d){joinOrLeave(_0xa0366d,'join');}exports['default']=function(_0x3c335e){_0x3c335e['on'](_0xf79b('0x51'),function(_0x5bb211){_0x5bb211[_0xf79b('0x52')](0x0);_0x5bb211[_0xf79b('0x53')]=_0x5bb211[_0xf79b('0x54')][_0xf79b('0x51')][_0xf79b('0x55')]+':'+_0x5bb211[_0xf79b('0x54')]['connection'][_0xf79b('0x56')];_0x5bb211[_0xf79b('0x57')]=new Date();_0x5bb211[_0xf79b('0x58')]=function(_0x48973d){console[_0xf79b('0x58')](_0xf79b('0x59')+_0x5bb211[_0xf79b('0x5a')][_0xf79b('0x2')]+'['+_0x5bb211[_0xf79b('0x53')]+']',_0x48973d);};_0x5bb211['on'](_0xf79b('0x5b'),function(){onDisconnect(_0x5bb211,_0x3c335e);_0x5bb211['log']('DISCONNECTED');});onConnect(_0x5bb211);_0x5bb211[_0xf79b('0x58')](_0xf79b('0x5c'));});}; \ No newline at end of file +var _0x28a6=['connection','setMaxListeners','request','remotePort','connectedAt','CONNECTED','util','./environment','Agents','name','agent','type','ivr','UserProfileSection','findOne','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','then','map','where','role','telephone','format','%s:queue:%s','handshake','User','find','userProfileId','ChatInteraction','MailInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','include','VoiceQueue','push','ChatQueue','FaxQueue','MailQueue','OpenchannelQueue','Trunk','Campaign','user','WhatsappQueue','getChatQueues','getSmsQueues','getMailQueues','getWhatsappQueues','all','length','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','ChatInteractions','emit','user_has_chat_interactions:remove','leave','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','default'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x28a6,0x166));var _0x628a=function(_0x178856,_0x41f045){_0x178856=_0x178856-0x0;var _0x3c7fe7=_0x28a6[_0x178856];return _0x3c7fe7;};'use strict';var _=require('lodash');var util=require(_0x628a('0x0'));var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var config=require(_0x628a('0x1'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x628a('0x2'),'model':db['User'],'attributes':['id',_0x628a('0x3'),'role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x628a('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x628a('0x3')],'where':{'role':_0x628a('0x4')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x628a('0x3'),_0x628a('0x5')],'where':{'type':_0x628a('0x6')}};function getAssociatedResources(_0x394801,_0x3c4c2f,_0x39c936){return db[_0x628a('0x7')][_0x628a('0x8')]({'where':{'name':_0x394801,'userProfileId':_0x3c4c2f},'raw':!![]})['then'](function(_0x1e1c61){if(_0x1e1c61){if(_0x1e1c61['autoAssociation']){switch(_0x394801){case _0x628a('0x9'):case _0x628a('0xa'):case _0x628a('0xb'):case _0x628a('0xc'):case _0x628a('0xd'):case _0x628a('0xe'):case _0x628a('0xf'):return db[_0x39c936][_0x628a('0x10')](queryQueues);case _0x628a('0x11'):return db[_0x39c936][_0x628a('0x10')](queryTelephones);case _0x628a('0x12'):return db[_0x39c936]['findAll'](queryTrunks);case _0x628a('0x13'):return db[_0x39c936][_0x628a('0x10')](queryCampaigns);}}else{return db[_0x628a('0x14')][_0x628a('0x10')]({'attributes':[_0x628a('0x15')],'where':{'sectionId':_0x1e1c61['id']},'raw':!![]})[_0x628a('0x16')](function(_0x224619){if(_0x224619){var _0x1d80d3={'where':{'id':_[_0x628a('0x17')](_0x224619,_0x628a('0x15'))},'raw':!![]};switch(_0x39c936){case'User':_0x1d80d3[_0x628a('0x18')][_0x628a('0x19')]=_0x628a('0x1a');break;case'Campaign':_0x1d80d3[_0x628a('0x18')][_0x628a('0x5')]='ivr';break;}return db[_0x39c936][_0x628a('0x10')](_0x1d80d3);}else{return[];}});}}else{return[];}})['then'](function(_0x156e4c){return _0x156e4c;});}function joinOrLeaveQueues(_0x1adbf4,_0x3fe7ba,_0x15cd1a,_0x327d9f){_0x1adbf4[_0x3fe7ba](util[_0x628a('0x1b')](_0x628a('0x1c'),_0x15cd1a,_0x327d9f['name']));if(_0x327d9f['Agents']){for(var _0x4e01f7=0x0;_0x4e01f7<_0x327d9f[_0x628a('0x2')]['length'];_0x4e01f7+=0x1){_0x1adbf4[_0x3fe7ba](util[_0x628a('0x1b')]('user:%s',_0x327d9f['Agents'][_0x4e01f7][_0x628a('0x3')]));}}}function joinOrLeave(_0xca420a,_0x1ace84,_0x4aee17){var _0xb01365;if(_0xca420a[_0x628a('0x1d')]['query']['id']){db[_0x628a('0x1e')][_0x628a('0x1f')]({'attributes':['id','name','role',_0x628a('0x20')],'where':{'id':_0xca420a[_0x628a('0x1d')]['query']['id']},'include':[{'model':db[_0x628a('0x21')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x628a('0x22'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x628a('0x23')],'as':_0x628a('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x628a('0x25')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x628a('0x26'),'attributes':['id'],'raw':!![]}]})[_0x628a('0x16')](function(_0x3200af){if(_0x3200af){_0xb01365=_0x3200af;_0xca420a[_0x1ace84](util['format']('user:%s',_0x3200af[_0x628a('0x3')]));var _0x4cb7a8=[];switch(_0x3200af[_0x628a('0x19')]){case _0x628a('0x27'):_0xca420a[_0x1ace84](_0x628a('0x28'));_0xca420a[_0x1ace84](_0x628a('0x29'));if(queryQueues['hasOwnProperty'](_0x628a('0x2a'))){delete queryQueues[_0x628a('0x2a')];}_0x4cb7a8['push'](db[_0x628a('0x2b')][_0x628a('0x10')](queryQueues));_0x4cb7a8[_0x628a('0x2c')](db[_0x628a('0x2d')][_0x628a('0x10')](queryQueues));_0x4cb7a8[_0x628a('0x2c')](db[_0x628a('0x2e')][_0x628a('0x10')](queryQueues));_0x4cb7a8[_0x628a('0x2c')](db['SmsQueue'][_0x628a('0x10')](queryQueues));_0x4cb7a8[_0x628a('0x2c')](db[_0x628a('0x2f')]['findAll'](queryQueues));_0x4cb7a8[_0x628a('0x2c')](db[_0x628a('0x30')][_0x628a('0x10')](queryQueues));_0x4cb7a8[_0x628a('0x2c')](db['WhatsappQueue'][_0x628a('0x10')](queryQueues));_0x4cb7a8[_0x628a('0x2c')](db['User'][_0x628a('0x10')](queryTelephones));_0x4cb7a8[_0x628a('0x2c')](db[_0x628a('0x31')]['findAll'](queryTrunks));_0x4cb7a8[_0x628a('0x2c')](db[_0x628a('0x32')]['findAll'](queryCampaigns));_0x4cb7a8[_0x628a('0x2c')](db[_0x628a('0x1e')][_0x628a('0x10')](queryAgents));break;case _0x628a('0x33'):_0xca420a[_0x1ace84](_0x628a('0x28'));_0xca420a[_0x1ace84](_0x628a('0x29'));_0x4cb7a8[_0x628a('0x2c')](getAssociatedResources(_0x628a('0x9'),_0x3200af['userProfileId'],_0x628a('0x2b')));_0x4cb7a8[_0x628a('0x2c')](getAssociatedResources(_0x628a('0xa'),_0x3200af['userProfileId'],_0x628a('0x2d')));_0x4cb7a8[_0x628a('0x2c')](getAssociatedResources('FaxQueues',_0x3200af[_0x628a('0x20')],_0x628a('0x2e')));_0x4cb7a8[_0x628a('0x2c')](getAssociatedResources(_0x628a('0xc'),_0x3200af[_0x628a('0x20')],'SmsQueue'));_0x4cb7a8[_0x628a('0x2c')](getAssociatedResources(_0x628a('0xd'),_0x3200af['userProfileId'],_0x628a('0x2f')));_0x4cb7a8[_0x628a('0x2c')](getAssociatedResources('OpenchannelQueues',_0x3200af[_0x628a('0x20')],_0x628a('0x30')));_0x4cb7a8[_0x628a('0x2c')](getAssociatedResources(_0x628a('0xf'),_0x3200af[_0x628a('0x20')],_0x628a('0x34')));_0x4cb7a8[_0x628a('0x2c')](getAssociatedResources(_0x628a('0x11'),_0x3200af[_0x628a('0x20')],'User'));_0x4cb7a8[_0x628a('0x2c')](getAssociatedResources(_0x628a('0x12'),_0x3200af[_0x628a('0x20')],_0x628a('0x31')));_0x4cb7a8[_0x628a('0x2c')](getAssociatedResources(_0x628a('0x13'),_0x3200af[_0x628a('0x20')],'Campaign'));_0x4cb7a8[_0x628a('0x2c')](db['User'][_0x628a('0x10')](queryAgents));break;case _0x628a('0x4'):_0xca420a[_0x1ace84](_0x628a('0x28'));_0xca420a[_0x1ace84](_0x628a('0x29'));_0x4cb7a8[_0x628a('0x2c')](_0x3200af['getVoiceQueues']({'attributes':['id','name']}));_0x4cb7a8['push'](_0x3200af[_0x628a('0x35')]({'attributes':['id','name']}));_0x4cb7a8[_0x628a('0x2c')](_0x3200af['getFaxQueues']({'attributes':['id','name']}));_0x4cb7a8[_0x628a('0x2c')](_0x3200af[_0x628a('0x36')]({'attributes':['id',_0x628a('0x3')]}));_0x4cb7a8[_0x628a('0x2c')](_0x3200af[_0x628a('0x37')]({'attributes':['id',_0x628a('0x3')]}));_0x4cb7a8[_0x628a('0x2c')](_0x3200af['getOpenchannelQueues']({'attributes':['id','name']}));_0x4cb7a8[_0x628a('0x2c')](_0x3200af[_0x628a('0x38')]({'attributes':['id','name']}));break;}return BPromise[_0x628a('0x39')](_0x4cb7a8);}})[_0x628a('0x16')](function(_0x4c4361){if(_0x4c4361&&_0x4c4361[_0x628a('0x3a')]){for(var _0x3818e9=0x0;_0x3818e9<_0x4c4361[_0x628a('0x3a')];_0x3818e9+=0x1){for(var _0x486e39=0x0;_0x486e39<_0x4c4361[_0x3818e9]['length'];_0x486e39+=0x1){switch(_0x3818e9){case 0x0:joinOrLeaveQueues(_0xca420a,_0x1ace84,'voice',_0x4c4361[_0x3818e9][_0x486e39]);break;case 0x1:joinOrLeaveQueues(_0xca420a,_0x1ace84,_0x628a('0x3b'),_0x4c4361[_0x3818e9][_0x486e39]);break;case 0x2:joinOrLeaveQueues(_0xca420a,_0x1ace84,_0x628a('0x3c'),_0x4c4361[_0x3818e9][_0x486e39]);break;case 0x3:joinOrLeaveQueues(_0xca420a,_0x1ace84,_0x628a('0x3d'),_0x4c4361[_0x3818e9][_0x486e39]);break;case 0x4:joinOrLeaveQueues(_0xca420a,_0x1ace84,_0x628a('0x3e'),_0x4c4361[_0x3818e9][_0x486e39]);break;case 0x5:joinOrLeaveQueues(_0xca420a,_0x1ace84,_0x628a('0x3f'),_0x4c4361[_0x3818e9][_0x486e39]);break;case 0x6:joinOrLeaveQueues(_0xca420a,_0x1ace84,_0x628a('0x40'),_0x4c4361[_0x3818e9][_0x486e39]);break;case 0x7:if(_0xb01365[_0x628a('0x19')]!==_0x628a('0x4'))_0xca420a[_0x1ace84](util[_0x628a('0x1b')](_0x628a('0x41'),_0x4c4361[_0x3818e9][_0x486e39][_0x628a('0x3')]));break;case 0x8:if(_0xb01365[_0x628a('0x19')]!==_0x628a('0x4'))_0xca420a[_0x1ace84](util['format']('trunk:%s',_0x4c4361[_0x3818e9][_0x486e39][_0x628a('0x3')]));break;case 0x9:if(_0xb01365[_0x628a('0x19')]!==_0x628a('0x4'))_0xca420a[_0x1ace84](util['format']('campaign:%s:%s',_0x4c4361[_0x3818e9][_0x486e39]['type'],_0x4c4361[_0x3818e9][_0x486e39][_0x628a('0x3')]));break;case 0xa:_0xca420a[_0x1ace84](util[_0x628a('0x1b')]('user:%s',_0x4c4361[_0x3818e9][_0x486e39][_0x628a('0x3')]));break;}}}}})['then'](function(){if(_0x1ace84==='leave'){var _0x44c2ab=_[_0x628a('0x17')](_0xb01365[_0x628a('0x42')],'id');return _0xb01365['removeChatInteractions'](_0x44c2ab)[_0x628a('0x16')](function(){for(var _0x1cec37=0x0;_0x1cec37<_0x44c2ab[_0x628a('0x3a')];_0x1cec37+=0x1){_0x4aee17[_0x628a('0x43')](_0x628a('0x44'),{'ChatInteractionId':Number(_0x44c2ab[_0x1cec37]),'UserId':Number(_0xb01365['id'])});}});}})[_0x628a('0x16')](function(){if(_0x1ace84===_0x628a('0x45')){var _0x1bdb94=_['map'](_0xb01365[_0x628a('0x22')],'id');return _0xb01365[_0x628a('0x46')](_0x1bdb94)[_0x628a('0x16')](function(){for(var _0x852af7=0x0;_0x852af7<_0x1bdb94[_0x628a('0x3a')];_0x852af7+=0x1){_0x4aee17[_0x628a('0x43')](_0x628a('0x47'),{'MailInteractionId':Number(_0x1bdb94[_0x852af7]),'UserId':Number(_0xb01365['id'])});}});}})[_0x628a('0x16')](function(){if(_0x1ace84===_0x628a('0x45')){var _0x2b4cca=_[_0x628a('0x17')](_0xb01365['FaxInteractions'],'id');return _0xb01365[_0x628a('0x48')](_0x2b4cca)[_0x628a('0x16')](function(){for(var _0x3a4130=0x0;_0x3a4130<_0x2b4cca[_0x628a('0x3a')];_0x3a4130+=0x1){_0x4aee17[_0x628a('0x43')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x2b4cca[_0x3a4130]),'UserId':Number(_0xb01365['id'])});}});}})[_0x628a('0x16')](function(){if(_0x1ace84===_0x628a('0x45')){var _0x482b4b=_['map'](_0xb01365[_0x628a('0x24')],'id');return _0xb01365[_0x628a('0x49')](_0x482b4b)[_0x628a('0x16')](function(){for(var _0x218a52=0x0;_0x218a52<_0x482b4b[_0x628a('0x3a')];_0x218a52+=0x1){_0x4aee17[_0x628a('0x43')](_0x628a('0x4a'),{'SmsInteractionId':Number(_0x482b4b[_0x218a52]),'UserId':Number(_0xb01365['id'])});}});}})['then'](function(){if(_0x1ace84===_0x628a('0x45')){var _0x2ca0bc=_[_0x628a('0x17')](_0xb01365['OpenchannelInteractions'],'id');return _0xb01365[_0x628a('0x4b')](_0x2ca0bc)[_0x628a('0x16')](function(){for(var _0x1256d5=0x0;_0x1256d5<_0x2ca0bc['length'];_0x1256d5+=0x1){_0x4aee17[_0x628a('0x43')](_0x628a('0x4c'),{'OpenchannelInteractionId':Number(_0x2ca0bc[_0x1256d5]),'UserId':Number(_0xb01365['id'])});}});}})[_0x628a('0x16')](function(){if(_0x1ace84===_0x628a('0x45')){var _0x44ff3f=_[_0x628a('0x17')](_0xb01365[_0x628a('0x26')],'id');return _0xb01365[_0x628a('0x4d')](_0x44ff3f)[_0x628a('0x16')](function(){for(var _0x2d0f9b=0x0;_0x2d0f9b<_0x44ff3f['length'];_0x2d0f9b+=0x1){_0x4aee17[_0x628a('0x43')](_0x628a('0x4e'),{'WhatsappInteractionId':Number(_0x44ff3f[_0x2d0f9b]),'UserId':Number(_0xb01365['id'])});}});}})[_0x628a('0x4f')](function(_0x5c8b39){_0xca420a[_0x628a('0x50')](_0x5c8b39);});}}function onDisconnect(_0xe904ec,_0x5a45a0){joinOrLeave(_0xe904ec,'leave',_0x5a45a0);}function onConnect(_0x133809){joinOrLeave(_0x133809,'join');}exports[_0x628a('0x51')]=function(_0x3e2739){_0x3e2739['on'](_0x628a('0x52'),function(_0x5c3bf0){_0x5c3bf0[_0x628a('0x53')](0x0);_0x5c3bf0['address']=_0x5c3bf0[_0x628a('0x54')][_0x628a('0x52')]['remoteAddress']+':'+_0x5c3bf0['request'][_0x628a('0x52')][_0x628a('0x55')];_0x5c3bf0[_0x628a('0x56')]=new Date();_0x5c3bf0[_0x628a('0x50')]=function(_0x70b5d2){console[_0x628a('0x50')]('SocketIO\x20'+_0x5c3bf0['nsp'][_0x628a('0x3')]+'['+_0x5c3bf0['address']+']',_0x70b5d2);};_0x5c3bf0['on']('disconnect',function(){onDisconnect(_0x5c3bf0,_0x3e2739);_0x5c3bf0[_0x628a('0x50')]('DISCONNECTED');});onConnect(_0x5c3bf0);_0x5c3bf0['log'](_0x628a('0x57'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 59a4191..5aa58e7 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 _0x2758=['catch','get','channel','motionChannel','direction','resolve','then','ContactId','sequelize','query','Sequelize','QueryTypes','SELECT','UserId','format','SIP/%s','name','agent','outgoingmessage','AfterCreateMessage','event','offlineMessage','opened','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','contact','interface','AfterCreate','closed','changed','substatus','undefined','AfterUpdate','User','fullname','email','internal','default','length','hasOwnProperty','hook','toLowerCase','util','../../mysqldb','jayson/promise','client','http','afterCreate','Chat','ChatInteraction','afterUpdate','closedinteraction','ChatMessage','newmessage','ChatOfflineMessage','Sms','SmsInteraction','newinteraction','SmsMessage','Whatsapp','WhatsappInteraction','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','info','Trigger,\x20%s','error'];(function(_0x118d9d,_0x433945){var _0x421d6c=function(_0x285eec){while(--_0x285eec){_0x118d9d['push'](_0x118d9d['shift']());}};_0x421d6c(++_0x433945);}(_0x2758,0x107));var _0x8275=function(_0x4d0e94,_0x4e89f3){_0x4d0e94=_0x4d0e94-0x0;var _0x188590=_0x2758[_0x4d0e94];return _0x188590;};'use strict';var util=require(_0x8275('0x0'));var db=require(_0x8275('0x1'))['db'];var jayson=require(_0x8275('0x2'));var logger=require('../logger')('triggers');var client=jayson[_0x8275('0x3')][_0x8275('0x4')]({'port':0x232a});var triggers=[{'channel':'Chat','model':'ChatInteraction','event':_0x8275('0x5'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x8275('0x6'),'model':_0x8275('0x7'),'event':_0x8275('0x8'),'condition':_0x8275('0x9'),'callback':afterUpdate},{'channel':_0x8275('0x6'),'model':_0x8275('0xa'),'event':'afterCreate','condition':_0x8275('0xb'),'callback':afterCreateMessage},{'channel':_0x8275('0x6'),'model':_0x8275('0xc'),'event':_0x8275('0x5'),'condition':_0x8275('0xb'),'callback':afterCreateOfflineMessage},{'channel':_0x8275('0xd'),'model':_0x8275('0xe'),'event':_0x8275('0x5'),'condition':_0x8275('0xf'),'callback':afterCreate},{'channel':'Sms','model':_0x8275('0xe'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x8275('0xd'),'model':_0x8275('0x10'),'event':_0x8275('0x5'),'condition':_0x8275('0xb'),'callback':afterCreateMessage},{'channel':_0x8275('0x11'),'model':_0x8275('0x12'),'event':_0x8275('0x5'),'condition':_0x8275('0xf'),'callback':afterCreate},{'channel':_0x8275('0x11'),'model':'WhatsappInteraction','event':_0x8275('0x8'),'condition':_0x8275('0x9'),'callback':afterUpdate},{'channel':_0x8275('0x11'),'model':'WhatsappMessage','event':'afterCreate','condition':_0x8275('0xb'),'callback':afterCreateMessage},{'channel':_0x8275('0x13'),'model':_0x8275('0x14'),'event':_0x8275('0x5'),'condition':_0x8275('0xf'),'callback':afterCreate},{'channel':_0x8275('0x13'),'model':_0x8275('0x14'),'event':_0x8275('0x8'),'condition':_0x8275('0x9'),'callback':afterUpdate},{'channel':_0x8275('0x13'),'model':_0x8275('0x15'),'event':_0x8275('0x5'),'condition':_0x8275('0xb'),'callback':afterCreateMessage},{'channel':_0x8275('0x16'),'model':_0x8275('0x17'),'event':_0x8275('0x5'),'condition':_0x8275('0xf'),'callback':afterCreate},{'channel':_0x8275('0x16'),'model':_0x8275('0x17'),'event':_0x8275('0x8'),'condition':_0x8275('0x9'),'callback':afterUpdate},{'channel':_0x8275('0x16'),'model':_0x8275('0x18'),'event':_0x8275('0x5'),'condition':_0x8275('0xb'),'callback':afterCreateMessage},{'channel':_0x8275('0x19'),'model':'OpenchannelInteraction','event':_0x8275('0x5'),'condition':_0x8275('0xf'),'callback':afterCreate},{'channel':'Openchannel','model':_0x8275('0x1a'),'event':_0x8275('0x8'),'condition':_0x8275('0x9'),'callback':afterUpdate},{'channel':'Openchannel','model':_0x8275('0x1b'),'event':_0x8275('0x5'),'condition':_0x8275('0xb'),'callback':afterCreateMessage}];function request(_0x20f545){return client[_0x8275('0x1c')](_0x8275('0x1d'),_0x20f545)['then'](function(_0x2c6c72){logger[_0x8275('0x1e')](_0x8275('0x1f'),_0x8275('0x1d'),_0x2c6c72);if(_0x2c6c72[_0x8275('0x20')]){if(_0x2c6c72[_0x8275('0x20')]['code']===0x1f4){logger[_0x8275('0x20')](_0x8275('0x1f'),'EventManager',_0x2c6c72[_0x8275('0x20')]);}}})[_0x8275('0x21')](function(_0x4deb4c){logger[_0x8275('0x20')](_0x8275('0x1f'),_0x8275('0x1d'),_0x4deb4c);});}function afterCreateMessage(_0x42d6f2){return function(_0x5621ff){_0x5621ff=_0x5621ff[_0x8275('0x22')]({'plain':!![]});_0x5621ff[_0x8275('0x23')]=_0x42d6f2;_0x5621ff[_0x8275('0x24')]=_0x42d6f2;_0x5621ff['event']=_0x5621ff[_0x8275('0x25')];Promise[_0x8275('0x26')]()[_0x8275('0x27')](function(){if(typeof _0x5621ff[_0x8275('0x28')]==='undefined')return null;var _0x545f0a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5621ff[_0x8275('0x28')];return db[_0x8275('0x29')][_0x8275('0x2a')](_0x545f0a,{'type':db[_0x8275('0x2b')][_0x8275('0x2c')][_0x8275('0x2d')],'raw':!![]});})[_0x8275('0x27')](function(_0xf4bbed){if(_0xf4bbed){_0x5621ff['contact']=_0xf4bbed[0x0];}if(typeof _0x5621ff[_0x8275('0x2e')]==='undefined')return;return getAgent(_0x5621ff['UserId']);})[_0x8275('0x27')](function(_0x2d8997){if(_0x2d8997){_0x5621ff['interface']=util[_0x8275('0x2f')](_0x8275('0x30'),_0x2d8997[_0x8275('0x31')]);_0x5621ff[_0x8275('0x32')]=_0x2d8997;_0x5621ff[_0x8275('0x23')]=_0x42d6f2;return request({'event':'incomingmessage','message':_0x5621ff});}else{return request({'event':_0x8275('0x33'),'message':_0x5621ff});}})[_0x8275('0x21')](function(_0x2a73ab){logger['error'](_0x8275('0x1f'),_0x8275('0x34'),_0x2a73ab);});};}function afterCreateOfflineMessage(_0x341a65){return function(_0x206863){_0x206863=_0x206863[_0x8275('0x22')]({'plain':!![]});_0x206863[_0x8275('0x23')]=_0x341a65;_0x206863[_0x8275('0x24')]=_0x341a65;_0x206863[_0x8275('0x35')]=_0x8275('0x36');return request({'event':_0x206863[_0x8275('0x35')],'message':_0x206863});};}function afterCreate(_0x3f7162,_0xbe9cc){return function(_0x401108){_0x401108=_0x401108[_0x8275('0x22')]({'plain':!![]});_0x401108[_0x8275('0x23')]=_0x3f7162;_0x401108[_0x8275('0x24')]=_0x3f7162;_0x401108[_0x8275('0x35')]=_0x8275('0x37');Promise[_0x8275('0x26')]()[_0x8275('0x27')](function(){var _0x2421be=_0x8275('0x38')+_0x401108[_0x8275('0x28')];return db[_0x8275('0x29')][_0x8275('0x2a')](_0x2421be,{'type':db[_0x8275('0x2b')][_0x8275('0x2c')][_0x8275('0x2d')],'raw':!![]});})[_0x8275('0x27')](function(_0x10274a){if(_0x10274a){_0x401108[_0x8275('0x39')]=_0x10274a[0x0];}if(typeof _0x401108[_0x8275('0x2e')]==='undefined')return;return getAgent(_0x401108[_0x8275('0x2e')]);})[_0x8275('0x27')](function(_0x318dd6){if(_0x318dd6){_0x401108[_0x8275('0x3a')]=util[_0x8275('0x2f')]('SIP/%s',_0x318dd6[_0x8275('0x31')]);_0x401108['agent']=_0x318dd6;}return request({'event':_0xbe9cc,'message':_0x401108});})[_0x8275('0x21')](function(_0x3f04b9){logger[_0x8275('0x20')](_0x8275('0x1f'),_0x8275('0x3b'),_0x3f04b9);});};}function afterUpdate(_0x1dea74){return function(_0x216b1d){var _0x277a48=_0x216b1d['changed'](_0x8275('0x3c'))&&_0x216b1d[_0x8275('0x3c')];var _0x39e3cc=_0x216b1d[_0x8275('0x3d')](_0x8275('0x3e'));if(_0x277a48||_0x39e3cc){var _0x4bb86d=_0x277a48?_0x8275('0x9'):'substatus';var _0x2723d1=_0x216b1d['get']({'plain':!![]});_0x2723d1[_0x8275('0x23')]=_0x1dea74;_0x2723d1[_0x8275('0x24')]=_0x1dea74;_0x2723d1[_0x8275('0x35')]=_0x277a48?_0x8275('0x3c'):'substatus';var _0x4faafd=_0x8275('0x38')+_0x2723d1['ContactId'];return db[_0x8275('0x29')]['query'](_0x4faafd,{'type':db[_0x8275('0x2b')][_0x8275('0x2c')][_0x8275('0x2d')],'raw':!![]})[_0x8275('0x27')](function(_0x7cffa5){if(_0x7cffa5){_0x2723d1[_0x8275('0x39')]=_0x7cffa5[0x0];}if(typeof _0x2723d1[_0x8275('0x2e')]===_0x8275('0x3f'))return;return getAgent(_0x2723d1[_0x8275('0x2e')]);})[_0x8275('0x27')](function(_0x3e828e){if(_0x3e828e){_0x2723d1[_0x8275('0x3a')]=util[_0x8275('0x2f')]('SIP/%s',_0x3e828e[_0x8275('0x31')]);_0x2723d1[_0x8275('0x32')]=_0x3e828e;}return request({'event':_0x4bb86d,'message':_0x2723d1});})['catch'](function(_0x32a776){logger[_0x8275('0x20')](_0x8275('0x1f'),_0x8275('0x40'),_0x32a776);});}};}function getAgent(_0x34efe1){return db[_0x8275('0x41')]['find']({'where':{'id':_0x34efe1},'attributes':['id','name',_0x8275('0x42'),_0x8275('0x43'),_0x8275('0x44')],'raw':!![]})[_0x8275('0x27')](function(_0x3180e8){return _0x3180e8;});}exports[_0x8275('0x45')]=function(){for(var _0x2bc6e5=0x0;_0x2bc6e5=_0x5c5011[_0x9510('0x13')]){throw Error(_0x9510('0x14'));}_0x531eed(_0x2c65a2);})[_0x9510('0x15')](function(_0x1074aa){_0x434412(_0x1074aa);});});}; \ No newline at end of file +var _0x16c1=['getChannels','isValidChannel','toLowerCase','includes','clearBlockUser','updateAttributes','getLicense','role','agent','count','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','./license/util','voice','mail','fax','sms','openchannel'];(function(_0x3303c2,_0x4c8a0e){var _0x234bf6=function(_0x3452cc){while(--_0x3452cc){_0x3303c2['push'](_0x3303c2['shift']());}};_0x234bf6(++_0x4c8a0e);}(_0x16c1,0x16d));var _0x116c=function(_0x2dae93,_0x2c5d8f){_0x2dae93=_0x2dae93-0x0;var _0x51c263=_0x16c1[_0x2dae93];return _0x51c263;};'use strict';var _=require(_0x116c('0x0'));var BPromise=require(_0x116c('0x1'));var db=require(_0x116c('0x2'))['db'];var util=require(_0x116c('0x3'));var channels=[_0x116c('0x4'),_0x116c('0x5'),'chat',_0x116c('0x6'),_0x116c('0x7'),'whatsapp',_0x116c('0x8')];exports[_0x116c('0x9')]=function(){return channels;};exports[_0x116c('0xa')]=function(_0x35903a){_0x35903a=_0x35903a[_0x116c('0xb')]();return _[_0x116c('0xc')](channels,_0x35903a);};exports[_0x116c('0xd')]=function(_0x142da4,_0x580c8e,_0x1f193c,_0x81045d){var _0x9592f0={'loginAttempts':_0x580c8e,'blocked':_0x1f193c};if(!_['isUndefined'](_0x81045d)){_0x9592f0['blockedAt']=_0x81045d;}return _0x142da4[_0x116c('0xe')](_0x9592f0);};exports[_0x116c('0xf')]=function(_0x48101d){return new BPromise(function(_0x29f4b7,_0x4cff65){var _0x1fe3a6=0x0;if(_0x48101d[_0x116c('0x10')]!==_0x116c('0x11')){_0x29f4b7(_0x48101d);}db['User'][_0x116c('0x12')]({'where':{'role':_0x116c('0x11'),'online':!![],'id':{'$ne':_0x48101d['id']}}})['then'](function(_0x56d926){_0x1fe3a6=_0x56d926;return util[_0x116c('0xf')]();})['then'](function(_0x5b9da9){if(_0x5b9da9&&_0x5b9da9[_0x116c('0x13')]&&_0x1fe3a6>=_0x5b9da9[_0x116c('0x13')]){throw Error(_0x116c('0x14'));}_0x29f4b7(_0x48101d);})[_0x116c('0x15')](function(_0x463932){_0x4cff65(_0x463932);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 026ec54..d543ae2 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x153f=['inherits','Forbidden','OutOfInterval','error','status','send','exports','util','../config/logger','api','message','Internal\x20Server\x20Error','Error','Bad\x20Request','name','Entity\x20not\x20found','Not\x20Found'];(function(_0x5d9259,_0x4a6997){var _0x1cb63e=function(_0x5890c4){while(--_0x5890c4){_0x5d9259['push'](_0x5d9259['shift']());}};_0x1cb63e(++_0x4a6997);}(_0x153f,0x15b));var _0xf153=function(_0x1608e3,_0x7b6ce8){_0x1608e3=_0x1608e3-0x0;var _0x113b23=_0x153f[_0x1608e3];return _0x113b23;};'use strict';var util=require(_0xf153('0x0'));var logger=require(_0xf153('0x1'))(_0xf153('0x2'));var APIError=function(_0x44cea3,_0x2afb9a){this[_0xf153('0x3')]=_0x44cea3||_0xf153('0x4');this['name']=_0x2afb9a||_0xf153('0x5');util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x1f9ead){this[_0xf153('0x3')]=_0x1f9ead||_0xf153('0x6');this[_0xf153('0x7')]=_0xf153('0x6');util['inherits'](APIBadRequestError,APIError);};var APINotFoundError=function(_0x17ba96){this[_0xf153('0x3')]=_0x17ba96||_0xf153('0x8');this[_0xf153('0x7')]=_0xf153('0x9');util[_0xf153('0xa')](APINotFoundError,APIError);};function getStatusCode(_0x44845c){switch(_0x44845c){case _0xf153('0x6'):return 0x190;case _0xf153('0xb'),_0xf153('0xc'):return 0x193;case'Not\x20Found':return 0x194;default:return 0x1f4;}}function handleError(_0x2b76eb){return function(_0x1c8de7){logger[_0xf153('0xd')](_0x1c8de7['stack']);var _0x3a8838=getStatusCode(_0x1c8de7[_0xf153('0x7')]);if(_0x1c8de7[_0xf153('0x7')])delete _0x1c8de7[_0xf153('0x7')];return _0x2b76eb[_0xf153('0xe')](_0x3a8838)[_0xf153('0xf')](_0x1c8de7);};}module[_0xf153('0x10')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0xaa88=['Not\x20Found','Forbidden','OutOfInterval','error','stack','send','exports','util','../config/logger','api','message','Internal\x20Server\x20Error','name','Error','inherits','Entity\x20not\x20found'];(function(_0x4a944b,_0xf714f2){var _0x374163=function(_0x545f7f){while(--_0x545f7f){_0x4a944b['push'](_0x4a944b['shift']());}};_0x374163(++_0xf714f2);}(_0xaa88,0x137));var _0x8aa8=function(_0x867b0a,_0x587ccf){_0x867b0a=_0x867b0a-0x0;var _0x137438=_0xaa88[_0x867b0a];return _0x137438;};'use strict';var util=require(_0x8aa8('0x0'));var logger=require(_0x8aa8('0x1'))(_0x8aa8('0x2'));var APIError=function(_0x51c79b,_0x4aee38){this[_0x8aa8('0x3')]=_0x51c79b||_0x8aa8('0x4');this[_0x8aa8('0x5')]=_0x4aee38||_0x8aa8('0x6');util[_0x8aa8('0x7')](APIError,Error);};var APIBadRequestError=function(_0x350e8b){this['message']=_0x350e8b||'Bad\x20Request';this[_0x8aa8('0x5')]='Bad\x20Request';util[_0x8aa8('0x7')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x1ed84d){this[_0x8aa8('0x3')]=_0x1ed84d||_0x8aa8('0x8');this['name']=_0x8aa8('0x9');util[_0x8aa8('0x7')](APINotFoundError,APIError);};function getStatusCode(_0x224f25){switch(_0x224f25){case'Bad\x20Request':return 0x190;case _0x8aa8('0xa'),_0x8aa8('0xb'):return 0x193;case _0x8aa8('0x9'):return 0x194;default:return 0x1f4;}}function handleError(_0x33cc5c){return function(_0x583688){logger[_0x8aa8('0xc')](_0x583688[_0x8aa8('0xd')]);var _0x50787d=getStatusCode(_0x583688[_0x8aa8('0x5')]);if(_0x583688[_0x8aa8('0x5')])delete _0x583688[_0x8aa8('0x5')];return _0x33cc5c['status'](_0x50787d)[_0x8aa8('0xe')](_0x583688);};}module[_0x8aa8('0xf')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index a49eaeb..e0fa9ef 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x637b=['status','json','send','exports'];(function(_0x168631,_0x168c0a){var _0x38071a=function(_0x2e0779){while(--_0x2e0779){_0x168631['push'](_0x168631['shift']());}};_0x38071a(++_0x168c0a);}(_0x637b,0x133));var _0xb637=function(_0xf786a7,_0xd4ecf){_0xf786a7=_0xf786a7-0x0;var _0x54dac8=_0x637b[_0xf786a7];return _0x54dac8;};'use strict';module[_0xb637('0x0')][0x194]=function pageNotFound(_0x4d71a1,_0x22f97d){var _0x5adef5='404';var _0x430ad5=0x194;var _0xc9417f={'status':_0x430ad5};_0x22f97d[_0xb637('0x1')](_0xc9417f['status']);_0x22f97d['render'](_0x5adef5,{},function(_0xa26207,_0x134e57){if(_0xa26207){return _0x22f97d[_0xb637('0x1')](_0xc9417f[_0xb637('0x1')])[_0xb637('0x2')](_0xc9417f);}_0x22f97d[_0xb637('0x3')](_0x134e57);});}; \ No newline at end of file +var _0xf226=['exports','404','status'];(function(_0x55529b,_0x561318){var _0x5b04c2=function(_0x180ca7){while(--_0x180ca7){_0x55529b['push'](_0x55529b['shift']());}};_0x5b04c2(++_0x561318);}(_0xf226,0x141));var _0x6f22=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf226[_0x3dd15e];return _0x231fd0;};'use strict';module[_0x6f22('0x0')][0x194]=function pageNotFound(_0x4619b8,_0xa0925b){var _0x1dfbb0=_0x6f22('0x1');var _0x3334e1=0x194;var _0x422bc0={'status':_0x3334e1};_0xa0925b[_0x6f22('0x2')](_0x422bc0[_0x6f22('0x2')]);_0xa0925b['render'](_0x1dfbb0,{},function(_0x544886,_0x2d62f2){if(_0x544886){return _0xa0925b[_0x6f22('0x2')](_0x422bc0['status'])['json'](_0x422bc0);}_0xa0925b['send'](_0x2d62f2);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 5eb67c2..dd1b726 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbe5e=['ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','Action','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','../api/condition/condition.model','Interval','Pause','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','Sound','Tag','../api/tag/tag.model','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','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/intServicenowAccount/intServicenowAccount.model','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','Network','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','Attachment','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.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','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','hasOne','cascade','UserId','userSetting','hasMany','Recordings','VoiceExtension','HopperFinals','HopperHistory','ReportAgentPreview','OpenchannelInteractions','ChatInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotification','SenderId','belongsTo','userProfileId','belongsToMany','chat_group_has_users','Lists','cm_user_has_lists','SmsInteractions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','UserVoiceQueue','VoicePrefix','MailQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','user_has_chat_websites','FaxAccounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','ChanSpyId','Applications','Sounds','Members','Hoppers','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','mandatoryDispositionPause','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','uniqueid','Contact','ContactId','CloudProviderId','MailAccountId','Smtp','Dispositions','Answers','MailMessage','Interactions','List','ListId','TemplateId','MailInteractionId','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','user_has_mail_interactions','Attachments','Interaction','Account','ChatWebsite','ChatWebsiteId','ChatOfflineMessageId','restrict','TagId','MailQueueReport','FaxAccountId','FaxApplication','Exntensions','FaxMessage','user_has_fax_accounts','FaxInteractionId','fax_interaction_has_tags','user_has_fax_interactions','AttachmentId','SmsAccountId','mandatoryDispositionPauseId','IntervalId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','openchannel_interaction_has_tags','ProactiveActions','ChatMessage','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','team_has_chat_queues','CmCompany','Contacts','CompanyId','Phones','CmContactId','Company','cm_user_has_contacts','cm_contact_has_tags','CmHopperId','Agent','CampaignId','OwnerId','All','OneAll','AutomationAllId','AutomationAnyId','Actions','AutomationId','Extensions','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','moh_has_sounds','whatsapp_interaction_has_tags','ContactItemType','ItemType','ItemTypeId','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','AnalyticFieldReport','Fields','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','Subject','Description','DescriptionId','Field','FieldId','VariableId','DeskConfiguration','int_desk_configuration_has_tags','ZohoField','int_freshdesk_configuration_has_tags','ServicenowAccount','ServicenowConfiguration','Dynamics365Configuration','FreshsalesAccount','ChatQueueReport','FromId','ToId','SessionId','ProjectId','user_has_teams','team_has_mail_queues','team_has_fax_queues','team_has_openchannel_queues','team_has_whatsapp_queues','VoicePrefixes','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromAgent','ToAgent','ToMailQueueId','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','ToUserId','ToFaxQueueId','ToFaxAccountId','ToOpenchannelQueueId','ToQueue','ToOpenchannelAccountId','FromSmsAccountId','ToSmsAccountId','CustomFields','Resources','sectionId','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','FromWhatsappAccountId','ToQueueId','WhatsappQueueId','user','Imap','exports','sequelize','jstz','defaultsDeep','motion2','xcall','xC@LL1234','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','127.0.0.1','mysql','name','database','username','password','User','import','../api/voiceChanSpy/voiceChanSpy.model','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/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','../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','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xbe5e,0x188));var _0xebe5=function(_0x1eff1d,_0x3c323b){_0x1eff1d=_0x1eff1d-0x0;var _0x2c9980=_0xbe5e[_0x1eff1d];return _0x2c9980;};'use strict';var config=require('../config/environment');var Sequelize=require(_0xebe5('0x0'));var _=require('lodash');var jstz=require(_0xebe5('0x1'));var timezone=jstz['determine']();config[_0xebe5('0x0')]=_[_0xebe5('0x2')](config[_0xebe5('0x0')],{'database':_0xebe5('0x3'),'username':_0xebe5('0x4'),'password':_0xebe5('0x5'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xebe5('0x6')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xebe5('0x7'),'collate':_0xebe5('0x8')}}});config[_0xebe5('0x9')]=_['defaultsDeep'](config[_0xebe5('0x9')],{'database':_0xebe5('0x3'),'username':_0xebe5('0x4'),'password':_0xebe5('0x5'),'options':{'host':_0xebe5('0xa'),'port':0xcea,'dialect':_0xebe5('0xb'),'dialectOptions':{'charset':_0xebe5('0x6')},'logging':![],'timezone':timezone[_0xebe5('0xc')](),'define':{'charset':'utf8','collate':_0xebe5('0x8')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0xebe5('0xd')],config[_0xebe5('0x0')][_0xebe5('0xe')],config['sequelize'][_0xebe5('0xf')],config[_0xebe5('0x0')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xebe5('0x9')][_0xebe5('0xd')],config[_0xebe5('0x9')][_0xebe5('0xe')],config['sequelizeHistory'][_0xebe5('0xf')],config[_0xebe5('0x9')]['options'])};db[_0xebe5('0x10')]=db[_0xebe5('0x0')][_0xebe5('0x11')]('../api/user/user.model');db['VoiceChanSpy']=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x12'));db[_0xebe5('0x13')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x14'));db['VoiceExtension']=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x15'));db[_0xebe5('0x16')]=db[_0xebe5('0x0')]['import'](_0xebe5('0x17'));db[_0xebe5('0x18')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x19'));db[_0xebe5('0x1a')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x1b'));db[_0xebe5('0x1c')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x1d'));db[_0xebe5('0x1e')]=db[_0xebe5('0x0')]['import'](_0xebe5('0x1f'));db[_0xebe5('0x20')]=db[_0xebe5('0x0')]['import'](_0xebe5('0x21'));db[_0xebe5('0x22')]=db[_0xebe5('0x0')][_0xebe5('0x11')]('../api/voiceCallReport/voiceCallReport.model');db['VoiceDialReport']=db['sequelize'][_0xebe5('0x11')](_0xebe5('0x23'));db[_0xebe5('0x24')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x25'));db[_0xebe5('0x26')]=db[_0xebe5('0x0')][_0xebe5('0x11')]('../api/voiceQueueReport/voiceQueueReport.model');db['MemberReport']=db[_0xebe5('0x0')][_0xebe5('0x11')]('../api/memberReport/memberReport.model');db[_0xebe5('0x27')]=db[_0xebe5('0x0')]['import']('../api/trunk/trunk.model');db[_0xebe5('0x28')]=db['sequelize'][_0xebe5('0x11')](_0xebe5('0x29'));db[_0xebe5('0x2a')]=db[_0xebe5('0x0')]['import'](_0xebe5('0x2b'));db['UserVoiceQueue']=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x2c'));db[_0xebe5('0x2d')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x2e'));db[_0xebe5('0x2f')]=db['sequelize'][_0xebe5('0x11')](_0xebe5('0x30'));db[_0xebe5('0x31')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x32'));db[_0xebe5('0x33')]=db[_0xebe5('0x0')]['import'](_0xebe5('0x34'));db[_0xebe5('0x35')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x36'));db[_0xebe5('0x37')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x38'));db[_0xebe5('0x39')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x3a'));db[_0xebe5('0x3b')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x3c'));db[_0xebe5('0x3d')]=db['sequelize'][_0xebe5('0x11')](_0xebe5('0x3e'));db[_0xebe5('0x3f')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x40'));db['MailSubstatus']=db['sequelize'][_0xebe5('0x11')]('../api/mailSubstatus/mailSubstatus.model');db[_0xebe5('0x41')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x42'));db['MailMessage']=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x43'));db[_0xebe5('0x44')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x45'));db['MailQueueReport']=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x46'));db[_0xebe5('0x47')]=db[_0xebe5('0x0')]['import'](_0xebe5('0x48'));db[_0xebe5('0x49')]=db['sequelize'][_0xebe5('0x11')](_0xebe5('0x4a'));db[_0xebe5('0x4b')]=db[_0xebe5('0x0')][_0xebe5('0x11')]('../api/faxAccount/faxAccount.model');db['FaxApplication']=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x4c'));db[_0xebe5('0x4d')]=db['sequelize'][_0xebe5('0x11')](_0xebe5('0x4e'));db['FaxMessage']=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x4f'));db[_0xebe5('0x50')]=db[_0xebe5('0x0')]['import'](_0xebe5('0x51'));db[_0xebe5('0x52')]=db['sequelize'][_0xebe5('0x11')](_0xebe5('0x53'));db[_0xebe5('0x54')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x55'));db[_0xebe5('0x56')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x57'));db[_0xebe5('0x58')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x59'));db[_0xebe5('0x5a')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x5b'));db[_0xebe5('0x5c')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x5d'));db[_0xebe5('0x5e')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x5f'));db[_0xebe5('0x60')]=db[_0xebe5('0x0')][_0xebe5('0x11')]('../api/openchannelApplication/openchannelApplication.model');db[_0xebe5('0x61')]=db[_0xebe5('0x0')][_0xebe5('0x11')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0xebe5('0x62')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x63'));db[_0xebe5('0x64')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x65'));db['ChatWebsite']=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x66'));db[_0xebe5('0x67')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x68'));db[_0xebe5('0x69')]=db[_0xebe5('0x0')]['import'](_0xebe5('0x6a'));db[_0xebe5('0x6b')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x6c'));db['ChatMessage']=db[_0xebe5('0x0')][_0xebe5('0x11')]('../api/chatMessage/chatMessage.model');db[_0xebe5('0x6d')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x6e'));db[_0xebe5('0x6f')]=db['sequelize'][_0xebe5('0x11')](_0xebe5('0x70'));db[_0xebe5('0x71')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x72'));db[_0xebe5('0x73')]=db[_0xebe5('0x0')][_0xebe5('0x11')]('../api/chatProactiveAction/chatProactiveAction.model');db['CmCompany']=db['sequelize']['import']('../api/cmCompany/cmCompany.model');db[_0xebe5('0x74')]=db[_0xebe5('0x0')]['import'](_0xebe5('0x75'));db[_0xebe5('0x76')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x77'));db[_0xebe5('0x78')]=db[_0xebe5('0x0')]['import'](_0xebe5('0x79'));db[_0xebe5('0x7a')]=db['sequelize'][_0xebe5('0x11')](_0xebe5('0x7b'));db[_0xebe5('0x7c')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x7d'));db['ReportAgentPreview']=db[_0xebe5('0x0')]['import'](_0xebe5('0x7e'));db['CmCustomField']=db[_0xebe5('0x0')][_0xebe5('0x11')]('../api/cmCustomField/cmCustomField.model');db[_0xebe5('0x7f')]=db[_0xebe5('0x0')][_0xebe5('0x11')]('../api/action/action.model');db[_0xebe5('0x80')]=db['sequelize'][_0xebe5('0x11')]('../api/automation/automation.model');db[_0xebe5('0x81')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x82'));db[_0xebe5('0x83')]=db[_0xebe5('0x0')]['import']('../api/disposition/disposition.model');db[_0xebe5('0x84')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x85'));db[_0xebe5('0x86')]=db[_0xebe5('0x0')][_0xebe5('0x11')]('../api/interval/interval.model');db[_0xebe5('0x87')]=db[_0xebe5('0x0')][_0xebe5('0x11')]('../api/pause/pause.model');db[_0xebe5('0x88')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x89'));db[_0xebe5('0x8a')]=db[_0xebe5('0x0')]['import'](_0xebe5('0x8b'));db[_0xebe5('0x8c')]=db[_0xebe5('0x0')][_0xebe5('0x11')]('../api/schedule/schedule.model');db[_0xebe5('0x8d')]=db[_0xebe5('0x0')][_0xebe5('0x11')]('../api/sound/sound.model');db[_0xebe5('0x8e')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x8f'));db['ContactItemType']=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x90'));db['CmContactHasItem']=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x91'));db[_0xebe5('0x92')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x93'));db[_0xebe5('0x94')]=db['sequelize'][_0xebe5('0x11')](_0xebe5('0x95'));db[_0xebe5('0x96')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x97'));db[_0xebe5('0x98')]=db[_0xebe5('0x0')]['import'](_0xebe5('0x99'));db[_0xebe5('0x9a')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x9b'));db['IntegrationReport']=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x9c'));db[_0xebe5('0x9d')]=db['sequelize'][_0xebe5('0x11')](_0xebe5('0x9e'));db[_0xebe5('0x9f')]=db['sequelize']['import'](_0xebe5('0xa0'));db['AnalyticExtractedReport']=db[_0xebe5('0x0')]['import']('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0xebe5('0xa1')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0xa2'));db['AnalyticFieldReport']=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0xa3'));db[_0xebe5('0xa4')]=db[_0xebe5('0x0')][_0xebe5('0x11')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0xebe5('0xa5')]=db[_0xebe5('0x0')][_0xebe5('0x11')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0xebe5('0xa6')]=db[_0xebe5('0x0')]['import'](_0xebe5('0xa7'));db[_0xebe5('0xa8')]=db['sequelize'][_0xebe5('0x11')]('../api/intSalesforceField/intSalesforceField.model');db[_0xebe5('0xa9')]=db[_0xebe5('0x0')]['import'](_0xebe5('0xaa'));db[_0xebe5('0xab')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0xac'));db[_0xebe5('0xad')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0xae'));db[_0xebe5('0xaf')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0xb0'));db['DeskConfiguration']=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0xb1'));db[_0xebe5('0xb2')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0xb3'));db[_0xebe5('0xb4')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0xb5'));db[_0xebe5('0xb6')]=db[_0xebe5('0x0')]['import'](_0xebe5('0xb7'));db['ZohoField']=db['sequelize'][_0xebe5('0x11')]('../api/intZohoField/intZohoField.model');db[_0xebe5('0xb8')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0xb9'));db[_0xebe5('0xba')]=db[_0xebe5('0x0')]['import']('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0xebe5('0xbb')]=db['sequelize'][_0xebe5('0x11')]('../api/intZendeskField/intZendeskField.model');db[_0xebe5('0xbc')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0xbd'));db[_0xebe5('0xbe')]=db['sequelize'][_0xebe5('0x11')](_0xebe5('0xbf'));db[_0xebe5('0xc0')]=db[_0xebe5('0x0')]['import'](_0xebe5('0xc1'));db[_0xebe5('0xc2')]=db[_0xebe5('0x0')]['import'](_0xebe5('0xc3'));db[_0xebe5('0xc4')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0xc5'));db[_0xebe5('0xc6')]=db[_0xebe5('0x0')]['import']('../api/intVtigerField/intVtigerField.model');db['ServicenowAccount']=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0xc7'));db['ServicenowConfiguration']=db[_0xebe5('0x0')][_0xebe5('0x11')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0xebe5('0xc8')]=db[_0xebe5('0x0')]['import']('../api/intServicenowField/intServicenowField.model');db[_0xebe5('0xc9')]=db[_0xebe5('0x0')]['import'](_0xebe5('0xca'));db['Dynamics365Configuration']=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0xcb'));db[_0xebe5('0xcc')]=db[_0xebe5('0x0')]['import']('../api/intDynamics365Field/intDynamics365Field.model');db['FreshsalesAccount']=db[_0xebe5('0x0')]['import'](_0xebe5('0xcd'));db[_0xebe5('0xce')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0xcf'));db[_0xebe5('0xd0')]=db[_0xebe5('0x0')][_0xebe5('0x11')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0xebe5('0x9a')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x9b'));db[_0xebe5('0xd1')]=db[_0xebe5('0x0')][_0xebe5('0x11')]('../api/network/network.model');db['ChatQueueReport']=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0xd2'));db[_0xebe5('0xd3')]=db[_0xebe5('0x0')][_0xebe5('0x11')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0xebe5('0xd4')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0xd5'));db[_0xebe5('0xd6')]=db['sequelize'][_0xebe5('0x11')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0xebe5('0xd7')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0xd8'));db[_0xebe5('0xd9')]=db[_0xebe5('0x0')][_0xebe5('0x11')]('../api/smsQueueReport/smsQueueReport.model');db['SquareReport']=db[_0xebe5('0x0')][_0xebe5('0x11')]('../api/squareReport/squareReport.model');db[_0xebe5('0xda')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0xdb'));db[_0xebe5('0xdc')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0xdd'));db[_0xebe5('0xde')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0xdf'));db['SquareOdbc']=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0xe0'));db[_0xebe5('0xe1')]=db['sequelize'][_0xebe5('0x11')](_0xebe5('0xe2'));db[_0xebe5('0xe3')]=db['sequelize']['import'](_0xebe5('0xe4'));db['SquareMessage']=db[_0xebe5('0x0')][_0xebe5('0x11')]('../api/squareMessage/squareMessage.model');db[_0xebe5('0xe5')]=db[_0xebe5('0x0')]['import'](_0xebe5('0xe6'));db[_0xebe5('0xe7')]=db[_0xebe5('0x0')]['import'](_0xebe5('0xe8'));db[_0xebe5('0xe9')]=db[_0xebe5('0x0')]['import'](_0xebe5('0xea'));db[_0xebe5('0xeb')]=db[_0xebe5('0x0')]['import']('../api/migration/migration.model');db[_0xebe5('0xec')]=db[_0xebe5('0x0')][_0xebe5('0x11')]('../api/attachment/attachment.model');db['Plugin']=db[_0xebe5('0x0')]['import'](_0xebe5('0xed'));db[_0xebe5('0xee')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0xef'));db[_0xebe5('0xf0')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0xf1'));db['FaxTransferReport']=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0xf2'));db[_0xebe5('0xf3')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0xf4'));db[_0xebe5('0xf5')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0xf6'));db[_0xebe5('0xf7')]=db['sequelize'][_0xebe5('0x11')]('../api/cmList/cmList.model');db['VoicePrefix']=db[_0xebe5('0x0')][_0xebe5('0x11')]('../api/voicePrefix/voicePrefix.model');db[_0xebe5('0xf8')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0xf9'));db[_0xebe5('0xfa')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0xfb'));db[_0xebe5('0xfc')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0xfd'));db['UserNotification']=db['sequelize'][_0xebe5('0x11')](_0xebe5('0xfe'));db[_0xebe5('0xff')]=db[_0xebe5('0x0')][_0xebe5('0x11')]('../api/whatsappAccount/whatsappAccount.model');db['WhatsappApplication']=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x100'));db[_0xebe5('0x101')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x102'));db[_0xebe5('0x103')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x104'));db[_0xebe5('0x105')]=db[_0xebe5('0x0')]['import'](_0xebe5('0x106'));db[_0xebe5('0x107')]=db['sequelize'][_0xebe5('0x11')](_0xebe5('0x108'));db[_0xebe5('0x109')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x10a'));db[_0xebe5('0x10b')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x10c'));db[_0xebe5('0x10d')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x10e'));db[_0xebe5('0x10f')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x110'));db[_0xebe5('0x111')]=db['sequelize']['import'](_0xebe5('0x112'));db[_0xebe5('0x113')]=db[_0xebe5('0x0')][_0xebe5('0x11')](_0xebe5('0x114'));db[_0xebe5('0x10')][_0xebe5('0x115')](db[_0xebe5('0x1e')],{'as':_0xebe5('0x1e'),'onDelete':_0xebe5('0x116'),'foreignKey':_0xebe5('0x117')});db[_0xebe5('0x10')][_0xebe5('0x115')](db[_0xebe5('0x113')],{'as':_0xebe5('0x118'),'onDelete':_0xebe5('0x116'),'foreignKey':_0xebe5('0x117')});db['User'][_0xebe5('0x119')](db[_0xebe5('0x1a')],{'as':_0xebe5('0x11a'),'foreignKey':_0xebe5('0x117')});db['User'][_0xebe5('0x119')](db[_0xebe5('0x2a')],{'as':'VoiceQueuesRt','foreignKey':_0xebe5('0x117')});db[_0xebe5('0x10')]['hasMany'](db[_0xebe5('0x11b')],{'as':'Extensions','onDelete':_0xebe5('0x116'),'hooks':!![]});db[_0xebe5('0x10')]['hasMany'](db[_0xebe5('0x7a')],{'as':_0xebe5('0x11c'),'foreignKey':'UserId'});db[_0xebe5('0x10')][_0xebe5('0x119')](db[_0xebe5('0x7c')],{'as':_0xebe5('0x11d'),'foreignKey':_0xebe5('0x117')});db[_0xebe5('0x10')][_0xebe5('0x119')](db[_0xebe5('0x11e')],{'as':_0xebe5('0x11e'),'foreignKey':_0xebe5('0x117')});db[_0xebe5('0x10')][_0xebe5('0x119')](db[_0xebe5('0x61')],{'as':_0xebe5('0x11f'),'foreignKey':_0xebe5('0x117')});db['User'][_0xebe5('0x119')](db['ChatInteraction'],{'as':_0xebe5('0x120'),'foreignKey':_0xebe5('0x117')});db[_0xebe5('0x10')][_0xebe5('0x119')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0xebe5('0x117')});db[_0xebe5('0x10')][_0xebe5('0x119')](db[_0xebe5('0x4d')],{'as':_0xebe5('0x121'),'foreignKey':_0xebe5('0x117')});db[_0xebe5('0x10')]['hasMany'](db[_0xebe5('0x41')],{'as':_0xebe5('0x122'),'foreignKey':_0xebe5('0x117')});db[_0xebe5('0x10')]['hasMany'](db[_0xebe5('0x101')],{'as':_0xebe5('0x123'),'foreignKey':_0xebe5('0x117')});db[_0xebe5('0x10')]['hasMany'](db[_0xebe5('0x124')],{'as':'UserNotifications','foreignKey':_0xebe5('0x125')});db[_0xebe5('0x10')][_0xebe5('0x126')](db[_0xebe5('0xf8')],{'as':_0xebe5('0xf8'),'foreignKey':_0xebe5('0x127')});db[_0xebe5('0x10')][_0xebe5('0x128')](db[_0xebe5('0x71')],{'as':'Groups','through':_0xebe5('0x129')});db[_0xebe5('0x10')][_0xebe5('0x128')](db[_0xebe5('0x74')],{'as':'Contacts','through':'cm_user_has_contacts'});db[_0xebe5('0x10')][_0xebe5('0x128')](db['CmList'],{'as':_0xebe5('0x12a'),'through':_0xebe5('0x12b')});db['User']['belongsToMany'](db[_0xebe5('0xe5')],{'through':'user_has_teams'});db[_0xebe5('0x10')][_0xebe5('0x128')](db['MailInteraction'],{'as':_0xebe5('0x122'),'through':'user_has_mail_interactions'});db['User'][_0xebe5('0x128')](db[_0xebe5('0x6b')],{'as':_0xebe5('0x120'),'through':'user_has_chat_interactions'});db[_0xebe5('0x10')]['belongsToMany'](db['FaxInteraction'],{'as':_0xebe5('0x121'),'through':'user_has_fax_interactions'});db[_0xebe5('0x10')][_0xebe5('0x128')](db[_0xebe5('0x58')],{'as':_0xebe5('0x12c'),'through':_0xebe5('0x12d')});db[_0xebe5('0x10')][_0xebe5('0x128')](db['OpenchannelInteraction'],{'as':_0xebe5('0x11f'),'through':_0xebe5('0x12e')});db[_0xebe5('0x10')][_0xebe5('0x128')](db[_0xebe5('0x101')],{'as':_0xebe5('0x123'),'through':_0xebe5('0x12f')});db[_0xebe5('0x10')][_0xebe5('0x128')](db['VoiceQueue'],{'as':_0xebe5('0x130'),'through':_0xebe5('0x131'),'required':![]});db['User'][_0xebe5('0x128')](db[_0xebe5('0x132')],{'as':'VoicePrefixes','through':'UserVoicePrefix','required':![]});db[_0xebe5('0x10')][_0xebe5('0x128')](db[_0xebe5('0x3f')],{'as':_0xebe5('0x133'),'through':_0xebe5('0x2f'),'required':![]});db[_0xebe5('0x10')][_0xebe5('0x128')](db[_0xebe5('0x6f')],{'as':_0xebe5('0x134'),'through':_0xebe5('0x2d'),'required':![],'hooks':!![]});db[_0xebe5('0x10')][_0xebe5('0x128')](db[_0xebe5('0x50')],{'as':_0xebe5('0x135'),'through':'UserFaxQueue','required':![]});db['User'][_0xebe5('0x128')](db[_0xebe5('0x5c')],{'as':_0xebe5('0x136'),'through':_0xebe5('0x33'),'required':![]});db['User'][_0xebe5('0x128')](db[_0xebe5('0x64')],{'as':_0xebe5('0x137'),'through':_0xebe5('0x35'),'required':![]});db[_0xebe5('0x10')]['belongsToMany'](db[_0xebe5('0x109')],{'as':_0xebe5('0x138'),'through':_0xebe5('0x37'),'required':![]});db[_0xebe5('0x10')]['belongsToMany'](db[_0xebe5('0xf7')],{'through':_0xebe5('0x12b')});db['User'][_0xebe5('0x128')](db['ChatWebsite'],{'as':'ChatWebsites','through':_0xebe5('0x139')});db[_0xebe5('0x10')][_0xebe5('0x128')](db['FaxAccount'],{'as':_0xebe5('0x13a'),'through':'user_has_fax_accounts'});db['User']['belongsToMany'](db['MailAccount'],{'as':_0xebe5('0x13b'),'through':_0xebe5('0x13c')});db['User'][_0xebe5('0x128')](db['OpenchannelAccount'],{'as':_0xebe5('0x13d'),'through':_0xebe5('0x13e')});db['User'][_0xebe5('0x128')](db['SmsAccount'],{'as':_0xebe5('0x13f'),'through':_0xebe5('0x140')});db[_0xebe5('0x10')]['belongsToMany'](db[_0xebe5('0xff')],{'as':'WhatsappAccounts','through':_0xebe5('0x141')});db[_0xebe5('0x10')]['belongsToMany'](db['SquareProject'],{'as':_0xebe5('0x142'),'through':_0xebe5('0x143')});db['VoiceChanSpy'][_0xebe5('0x119')](db['VoiceExtension'],{'as':'SpiedAgents','onDelete':_0xebe5('0x116'),'foreignKey':_0xebe5('0x144')});db['VoiceContext']['hasMany'](db['VoiceExtension'],{'onDelete':_0xebe5('0x116')});db[_0xebe5('0x11b')][_0xebe5('0x119')](db[_0xebe5('0x11b')],{'as':_0xebe5('0x145'),'onDelete':_0xebe5('0x116')});db['VoiceMusicOnHold']['belongsToMany'](db['Sound'],{'as':_0xebe5('0x146'),'through':'moh_has_sounds'});db[_0xebe5('0x18')][_0xebe5('0x119')](db['UserVoiceQueueRt'],{'as':_0xebe5('0x147'),'foreignKey':'VoiceQueueId'});db[_0xebe5('0x18')][_0xebe5('0x119')](db['CmHopper'],{'as':_0xebe5('0x148'),'foreignKey':'VoiceQueueId'});db[_0xebe5('0x18')]['hasMany'](db['CmHopperFinal'],{'as':_0xebe5('0x11c'),'foreignKey':_0xebe5('0x149')});db[_0xebe5('0x18')][_0xebe5('0x119')](db[_0xebe5('0x7c')],{'as':_0xebe5('0x14a'),'foreignKey':_0xebe5('0x149')});db[_0xebe5('0x18')]['hasMany'](db[_0xebe5('0x11e')],{'as':_0xebe5('0x11e'),'foreignKey':_0xebe5('0x149')});db[_0xebe5('0x18')][_0xebe5('0x119')](db[_0xebe5('0x78')],{'as':_0xebe5('0x14b'),'foreignKey':'VoiceQueueId'});db[_0xebe5('0x18')][_0xebe5('0x119')](db[_0xebe5('0xd7')],{'as':_0xebe5('0x14c'),'foreignKey':'VoiceQueueId'});db[_0xebe5('0x18')][_0xebe5('0x126')](db[_0xebe5('0x27')],{'as':_0xebe5('0x27'),'foreignKey':_0xebe5('0x14d')});db[_0xebe5('0x18')][_0xebe5('0x126')](db[_0xebe5('0x27')],{'as':_0xebe5('0x14e'),'foreignKey':'TrunkBackupId'});db[_0xebe5('0x18')][_0xebe5('0x126')](db[_0xebe5('0x86')],{'as':_0xebe5('0x86'),'foreignKey':'IntervalId'});db[_0xebe5('0x18')][_0xebe5('0x126')](db['Pause'],{'as':_0xebe5('0x14f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xebe5('0x18')]['belongsToMany'](db[_0xebe5('0xf7')],{'as':_0xebe5('0x12a'),'through':_0xebe5('0x150')});db[_0xebe5('0x18')][_0xebe5('0x128')](db[_0xebe5('0x10')],{'as':_0xebe5('0x151'),'through':_0xebe5('0x131')});db[_0xebe5('0x18')][_0xebe5('0x128')](db[_0xebe5('0xe5')],{'as':_0xebe5('0x152'),'through':_0xebe5('0x10d')});db['VoiceQueue'][_0xebe5('0x128')](db[_0xebe5('0xf7')],{'as':_0xebe5('0x153'),'through':_0xebe5('0x154')});db['VoiceRecording'][_0xebe5('0x126')](db[_0xebe5('0x10')],{'as':'User','foreignKey':_0xebe5('0x117')});db[_0xebe5('0x1c')][_0xebe5('0x126')](db[_0xebe5('0x10')],{'as':_0xebe5('0x10'),'foreignKey':_0xebe5('0x117')});db['VoiceMail'][_0xebe5('0x119')](db[_0xebe5('0x20')],{'as':_0xebe5('0x155'),'onDelete':_0xebe5('0x116'),'foreignKey':'mailboxuser','sourceKey':'mailbox'});db[_0xebe5('0x20')][_0xebe5('0x126')](db['VoiceMail'],{'foreignKey':_0xebe5('0x156'),'targetKey':'mailbox'});db[_0xebe5('0x22')][_0xebe5('0x119')](db[_0xebe5('0x26')],{'as':'QueueCalls','foreignKey':_0xebe5('0x157'),'constraints':![]});db[_0xebe5('0x22')][_0xebe5('0x119')](db[_0xebe5('0x24')],{'as':'AgentReports','foreignKey':_0xebe5('0x157'),'constraints':![]});db['VoiceCallReport']['belongsTo'](db['User'],{'as':'User','foreignKey':_0xebe5('0x117')});db[_0xebe5('0x22')][_0xebe5('0x126')](db['CmContact'],{'as':_0xebe5('0x158'),'foreignKey':_0xebe5('0x159')});db[_0xebe5('0x39')][_0xebe5('0x126')](db['MailAccount'],{'as':_0xebe5('0x3d'),'foreignKey':'MailAccountId'});db[_0xebe5('0x39')][_0xebe5('0x126')](db[_0xebe5('0x10b')],{'as':_0xebe5('0x10b'),'foreignKey':_0xebe5('0x15a'),'onDelete':'restrict'});db[_0xebe5('0x3b')][_0xebe5('0x126')](db[_0xebe5('0x3d')],{'as':_0xebe5('0x3d'),'foreignKey':_0xebe5('0x15b')});db[_0xebe5('0x3b')]['belongsTo'](db[_0xebe5('0x10b')],{'as':_0xebe5('0x10b'),'foreignKey':_0xebe5('0x15a'),'onDelete':'restrict'});db[_0xebe5('0x3d')][_0xebe5('0x115')](db[_0xebe5('0x39')],{'as':'Imap','onDelete':_0xebe5('0x116')});db['MailAccount'][_0xebe5('0x115')](db[_0xebe5('0x3b')],{'as':_0xebe5('0x15c'),'onDelete':_0xebe5('0x116')});db[_0xebe5('0x3d')][_0xebe5('0x119')](db[_0xebe5('0x83')],{'as':_0xebe5('0x15d'),'foreignKey':_0xebe5('0x15b'),'onDelete':_0xebe5('0x116')});db[_0xebe5('0x3d')][_0xebe5('0x119')](db[_0xebe5('0x81')],{'as':_0xebe5('0x15e'),'foreignKey':_0xebe5('0x15b')});db[_0xebe5('0x3d')][_0xebe5('0x119')](db[_0xebe5('0x15f')],{'as':_0xebe5('0x155'),'foreignKey':_0xebe5('0x15b')});db[_0xebe5('0x3d')][_0xebe5('0x119')](db[_0xebe5('0x41')],{'as':_0xebe5('0x160')});db[_0xebe5('0x3d')]['hasMany'](db[_0xebe5('0x44')],{'as':_0xebe5('0x145')});db[_0xebe5('0x3d')][_0xebe5('0x126')](db[_0xebe5('0xf7')],{'as':_0xebe5('0x161'),'foreignKey':_0xebe5('0x162')});db[_0xebe5('0x3d')]['belongsTo'](db[_0xebe5('0x94')],{'as':_0xebe5('0x94'),'foreignKey':_0xebe5('0x163')});db[_0xebe5('0x3d')][_0xebe5('0x126')](db[_0xebe5('0x87')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xebe5('0x3d')][_0xebe5('0x128')](db[_0xebe5('0x10')],{'as':'Agents','through':'user_has_mail_accounts'});db[_0xebe5('0x3f')][_0xebe5('0x128')](db[_0xebe5('0x10')],{'as':_0xebe5('0x151'),'through':_0xebe5('0x2f')});db[_0xebe5('0x3f')][_0xebe5('0x128')](db[_0xebe5('0xe5')],{'through':'team_has_mail_queues','as':_0xebe5('0x152')});db[_0xebe5('0x41')][_0xebe5('0x119')](db[_0xebe5('0x15f')],{'as':_0xebe5('0x155'),'onDelete':_0xebe5('0x116'),'foreignKey':_0xebe5('0x164')});db[_0xebe5('0x41')][_0xebe5('0x126')](db[_0xebe5('0x3d')],{'as':'Account','foreignKey':_0xebe5('0x15b')});db[_0xebe5('0x41')][_0xebe5('0x126')](db[_0xebe5('0x74')],{'as':_0xebe5('0x158'),'foreignKey':_0xebe5('0x159')});db[_0xebe5('0x41')][_0xebe5('0x126')](db[_0xebe5('0x10')],{'as':_0xebe5('0x165'),'foreignKey':_0xebe5('0x117')});db[_0xebe5('0x41')]['belongsToMany'](db[_0xebe5('0x8e')],{'through':_0xebe5('0x166'),'as':_0xebe5('0x167')});db[_0xebe5('0x41')][_0xebe5('0x128')](db[_0xebe5('0x8e')],{'through':_0xebe5('0x166'),'as':_0xebe5('0x168')});db[_0xebe5('0x41')][_0xebe5('0x128')](db[_0xebe5('0x10')],{'as':_0xebe5('0x169'),'through':_0xebe5('0x16a'),'foreignKey':'MailInteractionId'});db[_0xebe5('0x15f')][_0xebe5('0x119')](db['Attachment'],{'as':_0xebe5('0x16b'),'onDelete':'cascade'});db[_0xebe5('0x15f')][_0xebe5('0x126')](db[_0xebe5('0x10')],{'as':_0xebe5('0x10')});db['MailMessage'][_0xebe5('0x126')](db['CmContact'],{'onDelete':'cascade','as':_0xebe5('0x158')});db['MailMessage']['belongsTo'](db[_0xebe5('0x41')],{'as':_0xebe5('0x16c'),'foreignKey':_0xebe5('0x164')});db[_0xebe5('0x15f')][_0xebe5('0x126')](db[_0xebe5('0x3d')],{'as':_0xebe5('0x16d'),'foreignKey':_0xebe5('0x15b')});db['MailMessage'][_0xebe5('0x126')](db[_0xebe5('0x16e')],{'as':_0xebe5('0x16e'),'foreignKey':_0xebe5('0x16f')});db[_0xebe5('0x15f')]['belongsTo'](db[_0xebe5('0x6d')],{'as':_0xebe5('0x6d'),'foreignKey':_0xebe5('0x170')});db['MailApplication']['belongsTo'](db['User'],{'onDelete':'restrict'});db[_0xebe5('0x44')][_0xebe5('0x126')](db['MailQueue'],{'onDelete':_0xebe5('0x171')});db[_0xebe5('0x44')]['belongsTo'](db['MailAccount'],{'onDelete':'restrict'});db[_0xebe5('0x44')][_0xebe5('0x126')](db[_0xebe5('0x86')],{'onDelete':_0xebe5('0x171'),'foreignKey':'IntervalId'});db[_0xebe5('0x44')][_0xebe5('0x126')](db[_0xebe5('0x8e')],{'onDelete':'restrict','foreignKey':_0xebe5('0x172')});db[_0xebe5('0x173')][_0xebe5('0x126')](db[_0xebe5('0x3d')],{});db[_0xebe5('0x173')][_0xebe5('0x126')](db[_0xebe5('0xf7')],{'as':_0xebe5('0x161'),'foreignKey':_0xebe5('0x162')});db[_0xebe5('0x173')][_0xebe5('0x126')](db[_0xebe5('0x74')],{'as':_0xebe5('0x158'),'foreignKey':_0xebe5('0x159')});db[_0xebe5('0x173')]['belongsTo'](db[_0xebe5('0x41')],{});db[_0xebe5('0x173')][_0xebe5('0x126')](db[_0xebe5('0x15f')],{});db['MailQueueReport']['belongsTo'](db['User'],{});db[_0xebe5('0x173')]['belongsTo'](db[_0xebe5('0x3f')],{});db[_0xebe5('0x47')][_0xebe5('0x119')](db[_0xebe5('0x49')],{'as':'Items','onDelete':_0xebe5('0x116')});db['FaxAccount']['hasMany'](db[_0xebe5('0x83')],{'as':_0xebe5('0x15d'),'foreignKey':_0xebe5('0x174'),'onDelete':_0xebe5('0x116')});db[_0xebe5('0x4b')][_0xebe5('0x119')](db['CannedAnswer'],{'as':_0xebe5('0x15e'),'foreignKey':_0xebe5('0x174')});db[_0xebe5('0x4b')]['hasMany'](db[_0xebe5('0x4d')],{'as':_0xebe5('0x160')});db[_0xebe5('0x4b')][_0xebe5('0x119')](db[_0xebe5('0x175')],{'as':'Applications'});db['FaxAccount']['hasMany'](db[_0xebe5('0x11b')],{'as':_0xebe5('0x176'),'onDelete':'cascade'});db[_0xebe5('0x4b')][_0xebe5('0x119')](db[_0xebe5('0x177')],{'as':'Messages'});db[_0xebe5('0x4b')][_0xebe5('0x126')](db[_0xebe5('0x27')],{'as':_0xebe5('0x27')});db[_0xebe5('0x4b')][_0xebe5('0x126')](db['CmList'],{'as':_0xebe5('0x161'),'foreignKey':_0xebe5('0x162')});db[_0xebe5('0x4b')]['belongsTo'](db[_0xebe5('0x87')],{'as':_0xebe5('0x14f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xebe5('0x4b')][_0xebe5('0x128')](db[_0xebe5('0x10')],{'as':'Agents','through':_0xebe5('0x178')});db[_0xebe5('0x175')][_0xebe5('0x126')](db[_0xebe5('0x10')],{'onDelete':_0xebe5('0x171')});db[_0xebe5('0x175')][_0xebe5('0x126')](db[_0xebe5('0x50')],{'onDelete':'restrict'});db[_0xebe5('0x175')][_0xebe5('0x126')](db['FaxAccount'],{'onDelete':'restrict'});db[_0xebe5('0x175')][_0xebe5('0x126')](db[_0xebe5('0x8e')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xebe5('0x4d')][_0xebe5('0x119')](db[_0xebe5('0x177')],{'as':'Messages','onDelete':_0xebe5('0x116'),'foreignKey':_0xebe5('0x179')});db[_0xebe5('0x4d')][_0xebe5('0x126')](db[_0xebe5('0x4b')],{'as':_0xebe5('0x16d'),'foreignKey':_0xebe5('0x174')});db[_0xebe5('0x4d')][_0xebe5('0x126')](db[_0xebe5('0x74')],{'as':'Contact','foreignKey':_0xebe5('0x159')});db['FaxInteraction']['belongsTo'](db[_0xebe5('0x10')],{'as':'Owner','foreignKey':_0xebe5('0x117')});db['FaxInteraction'][_0xebe5('0x128')](db[_0xebe5('0x8e')],{'through':_0xebe5('0x17a'),'as':_0xebe5('0x167')});db[_0xebe5('0x4d')][_0xebe5('0x128')](db[_0xebe5('0x8e')],{'through':_0xebe5('0x17a'),'as':_0xebe5('0x168')});db[_0xebe5('0x4d')][_0xebe5('0x128')](db[_0xebe5('0x10')],{'as':_0xebe5('0x169'),'through':_0xebe5('0x17b'),'foreignKey':_0xebe5('0x179')});db[_0xebe5('0x177')]['belongsTo'](db['User'],{'onDelete':_0xebe5('0x116'),'as':_0xebe5('0x10')});db['FaxMessage'][_0xebe5('0x126')](db[_0xebe5('0x4d')],{'as':_0xebe5('0x16c'),'foreignKey':'FaxInteractionId'});db[_0xebe5('0x177')]['belongsTo'](db[_0xebe5('0x74')],{'onDelete':_0xebe5('0x116'),'as':_0xebe5('0x158')});db[_0xebe5('0x177')][_0xebe5('0x126')](db[_0xebe5('0xec')],{'as':_0xebe5('0xec'),'foreignKey':_0xebe5('0x17c')});db['FaxMessage'][_0xebe5('0x126')](db[_0xebe5('0x4b')],{'as':_0xebe5('0x16d'),'foreignKey':_0xebe5('0x174')});db[_0xebe5('0x50')][_0xebe5('0x128')](db[_0xebe5('0x10')],{'as':_0xebe5('0x151'),'through':_0xebe5('0x31')});db[_0xebe5('0x50')][_0xebe5('0x128')](db[_0xebe5('0xe5')],{'through':'team_has_fax_queues','as':'Teams'});db[_0xebe5('0x52')][_0xebe5('0x126')](db[_0xebe5('0x4b')],{});db[_0xebe5('0x52')]['belongsTo'](db[_0xebe5('0xf7')],{'as':_0xebe5('0x161'),'foreignKey':_0xebe5('0x162')});db[_0xebe5('0x52')][_0xebe5('0x126')](db[_0xebe5('0x74')],{'as':_0xebe5('0x158'),'foreignKey':'ContactId'});db[_0xebe5('0x52')]['belongsTo'](db[_0xebe5('0x4d')],{});db[_0xebe5('0x52')][_0xebe5('0x126')](db[_0xebe5('0x177')],{});db['FaxQueueReport']['belongsTo'](db[_0xebe5('0x10')],{});db[_0xebe5('0x52')][_0xebe5('0x126')](db['FaxQueue'],{});db[_0xebe5('0x54')][_0xebe5('0x119')](db[_0xebe5('0x83')],{'as':_0xebe5('0x15d'),'foreignKey':_0xebe5('0x17d'),'onDelete':_0xebe5('0x116')});db['SmsAccount'][_0xebe5('0x119')](db[_0xebe5('0x81')],{'as':_0xebe5('0x15e'),'foreignKey':_0xebe5('0x17d')});db[_0xebe5('0x54')][_0xebe5('0x119')](db[_0xebe5('0x5a')],{'as':_0xebe5('0x155'),'foreignKey':_0xebe5('0x17d')});db[_0xebe5('0x54')][_0xebe5('0x119')](db[_0xebe5('0x58')],{'as':_0xebe5('0x160')});db[_0xebe5('0x54')][_0xebe5('0x119')](db[_0xebe5('0x56')],{'as':_0xebe5('0x145')});db[_0xebe5('0x54')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0xebe5('0x162')});db[_0xebe5('0x54')]['belongsTo'](db[_0xebe5('0x87')],{'as':_0xebe5('0x14f'),'foreignKey':_0xebe5('0x17e')});db[_0xebe5('0x54')]['belongsToMany'](db[_0xebe5('0x10')],{'as':_0xebe5('0x151'),'through':_0xebe5('0x140')});db[_0xebe5('0x56')][_0xebe5('0x126')](db[_0xebe5('0x10')],{'onDelete':_0xebe5('0x171')});db[_0xebe5('0x56')][_0xebe5('0x126')](db[_0xebe5('0x5c')],{'onDelete':_0xebe5('0x171')});db[_0xebe5('0x56')][_0xebe5('0x126')](db['SmsAccount'],{'onDelete':'restrict'});db[_0xebe5('0x56')][_0xebe5('0x126')](db['Interval'],{'onDelete':_0xebe5('0x171'),'foreignKey':_0xebe5('0x17f')});db[_0xebe5('0x56')]['belongsTo'](db[_0xebe5('0x8e')],{'onDelete':_0xebe5('0x171'),'foreignKey':_0xebe5('0x172')});db['SmsInteraction'][_0xebe5('0x119')](db['SmsMessage'],{'as':_0xebe5('0x155'),'onDelete':_0xebe5('0x116'),'foreignKey':_0xebe5('0x180')});db[_0xebe5('0x58')][_0xebe5('0x126')](db[_0xebe5('0x54')],{'as':'Account','foreignKey':'SmsAccountId'});db[_0xebe5('0x58')][_0xebe5('0x126')](db[_0xebe5('0x74')],{'as':_0xebe5('0x158'),'foreignKey':_0xebe5('0x159')});db['SmsInteraction'][_0xebe5('0x126')](db[_0xebe5('0x10')],{'as':_0xebe5('0x165'),'foreignKey':'UserId'});db[_0xebe5('0x58')][_0xebe5('0x128')](db['Tag'],{'through':_0xebe5('0x181'),'as':'Tags'});db[_0xebe5('0x58')][_0xebe5('0x128')](db[_0xebe5('0x8e')],{'through':_0xebe5('0x181'),'as':_0xebe5('0x168')});db['SmsInteraction']['belongsToMany'](db[_0xebe5('0x10')],{'as':'Users','through':_0xebe5('0x12d'),'foreignKey':_0xebe5('0x180')});db[_0xebe5('0x5a')][_0xebe5('0x126')](db[_0xebe5('0x10')],{'as':_0xebe5('0x10')});db[_0xebe5('0x5a')][_0xebe5('0x126')](db[_0xebe5('0x74')],{'onDelete':'cascade','as':_0xebe5('0x158')});db[_0xebe5('0x5a')]['belongsTo'](db['SmsInteraction'],{'onDelete':_0xebe5('0x116'),'as':'Interaction','foreignKey':_0xebe5('0x180')});db[_0xebe5('0x5a')][_0xebe5('0x126')](db['SmsAccount'],{'as':_0xebe5('0x16d'),'foreignKey':_0xebe5('0x17d')});db['SmsQueue']['belongsToMany'](db[_0xebe5('0x10')],{'as':_0xebe5('0x151'),'through':_0xebe5('0x33'),'foreignKey':_0xebe5('0x182')});db[_0xebe5('0x5c')][_0xebe5('0x128')](db[_0xebe5('0xe5')],{'through':_0xebe5('0x183'),'as':_0xebe5('0x152')});db[_0xebe5('0x5e')][_0xebe5('0x119')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xebe5('0x184'),'onDelete':_0xebe5('0x116')});db['OpenchannelAccount']['hasMany'](db[_0xebe5('0x81')],{'as':_0xebe5('0x15e'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0xebe5('0x119')](db[_0xebe5('0x61')],{'as':_0xebe5('0x160'),'foreignKey':_0xebe5('0x184')});db[_0xebe5('0x5e')]['hasMany'](db[_0xebe5('0x62')],{'as':_0xebe5('0x155'),'foreignKey':_0xebe5('0x184')});db[_0xebe5('0x5e')]['hasMany'](db[_0xebe5('0x60')],{'as':_0xebe5('0x145'),'foreignKey':_0xebe5('0x184')});db[_0xebe5('0x5e')][_0xebe5('0x126')](db['CmList'],{'as':_0xebe5('0x161'),'foreignKey':'ListId'});db['OpenchannelAccount'][_0xebe5('0x126')](db[_0xebe5('0x87')],{'as':'mandatoryDispositionPause','foreignKey':_0xebe5('0x17e')});db[_0xebe5('0x5e')][_0xebe5('0x128')](db[_0xebe5('0x10')],{'as':_0xebe5('0x151'),'through':_0xebe5('0x13e')});db[_0xebe5('0x60')][_0xebe5('0x126')](db[_0xebe5('0x10')],{'onDelete':_0xebe5('0x171')});db[_0xebe5('0x60')][_0xebe5('0x126')](db[_0xebe5('0x64')],{'onDelete':_0xebe5('0x171'),'foreignKey':'OpenchannelQueueId'});db[_0xebe5('0x60')][_0xebe5('0x126')](db['OpenchannelAccount'],{'onDelete':_0xebe5('0x171'),'foreignKey':_0xebe5('0x184')});db[_0xebe5('0x60')][_0xebe5('0x126')](db[_0xebe5('0x86')],{'onDelete':'restrict','foreignKey':_0xebe5('0x17f')});db[_0xebe5('0x60')][_0xebe5('0x126')](db[_0xebe5('0x8e')],{'onDelete':_0xebe5('0x171'),'foreignKey':'TagId'});db[_0xebe5('0x61')][_0xebe5('0x119')](db[_0xebe5('0x62')],{'as':_0xebe5('0x155'),'onDelete':'cascade','foreignKey':'OpenchannelInteractionId'});db[_0xebe5('0x61')][_0xebe5('0x126')](db[_0xebe5('0x5e')],{'as':_0xebe5('0x16d'),'foreignKey':_0xebe5('0x184')});db['OpenchannelInteraction']['belongsTo'](db[_0xebe5('0x74')],{'as':'Contact','foreignKey':_0xebe5('0x159')});db[_0xebe5('0x61')]['belongsTo'](db['User'],{'as':_0xebe5('0x165'),'foreignKey':_0xebe5('0x117')});db[_0xebe5('0x61')][_0xebe5('0x128')](db['Tag'],{'through':_0xebe5('0x185'),'as':_0xebe5('0x167')});db['OpenchannelInteraction']['belongsToMany'](db[_0xebe5('0x8e')],{'through':_0xebe5('0x185'),'as':_0xebe5('0x168')});db[_0xebe5('0x61')][_0xebe5('0x128')](db[_0xebe5('0x10')],{'as':_0xebe5('0x169'),'through':'user_has_openchannel_interactions','foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage'][_0xebe5('0x126')](db[_0xebe5('0x10')],{'onDelete':'cascade','as':_0xebe5('0x10')});db[_0xebe5('0x62')][_0xebe5('0x126')](db[_0xebe5('0x74')],{'onDelete':'cascade','as':_0xebe5('0x158')});db['OpenchannelMessage']['belongsTo'](db['OpenchannelInteraction'],{'onDelete':'cascade','as':_0xebe5('0x16c'),'foreignKey':'OpenchannelInteractionId'});db[_0xebe5('0x62')][_0xebe5('0x126')](db[_0xebe5('0xec')],{'as':_0xebe5('0xec'),'foreignKey':_0xebe5('0x17c')});db[_0xebe5('0x62')][_0xebe5('0x126')](db[_0xebe5('0x5e')],{'as':_0xebe5('0x16d'),'foreignKey':'OpenchannelAccountId'});db[_0xebe5('0x64')]['belongsToMany'](db[_0xebe5('0x10')],{'as':_0xebe5('0x151'),'through':_0xebe5('0x35'),'foreignKey':'OpenchannelQueueId'});db[_0xebe5('0x64')]['belongsToMany'](db[_0xebe5('0xe5')],{'through':'team_has_openchannel_queues','as':_0xebe5('0x152')});db['ChatWebsite'][_0xebe5('0x119')](db[_0xebe5('0x83')],{'as':'Dispositions','foreignKey':'ChatWebsiteId','onDelete':'cascade'});db[_0xebe5('0x16e')][_0xebe5('0x119')](db[_0xebe5('0x81')],{'as':_0xebe5('0x15e'),'foreignKey':'ChatWebsiteId'});db[_0xebe5('0x16e')]['hasMany'](db[_0xebe5('0x73')],{'as':_0xebe5('0x186')});db['ChatWebsite']['hasMany'](db[_0xebe5('0x6b')],{'as':_0xebe5('0x160')});db[_0xebe5('0x16e')]['hasMany'](db[_0xebe5('0x69')],{'as':'Applications'});db[_0xebe5('0x16e')][_0xebe5('0x119')](db[_0xebe5('0x187')],{'as':_0xebe5('0x155')});db[_0xebe5('0x16e')][_0xebe5('0x126')](db[_0xebe5('0xf7')],{'as':'List','foreignKey':'ListId'});db[_0xebe5('0x16e')][_0xebe5('0x126')](db[_0xebe5('0x86')],{'as':'Interval','foreignKey':'IntervalId'});db[_0xebe5('0x16e')][_0xebe5('0x126')](db[_0xebe5('0x3d')],{'as':_0xebe5('0x3d'),'foreignKey':_0xebe5('0x15b')});db[_0xebe5('0x16e')][_0xebe5('0x126')](db[_0xebe5('0x87')],{'as':'mandatoryDispositionPause','foreignKey':_0xebe5('0x17e')});db[_0xebe5('0x16e')][_0xebe5('0x128')](db[_0xebe5('0x10')],{'as':_0xebe5('0x151'),'through':_0xebe5('0x139')});db[_0xebe5('0x67')]['belongsTo'](db[_0xebe5('0x5e')],{});db[_0xebe5('0x67')][_0xebe5('0x126')](db[_0xebe5('0xf7')],{'as':'List','foreignKey':_0xebe5('0x162')});db[_0xebe5('0x67')][_0xebe5('0x126')](db['CmContact'],{'as':_0xebe5('0x158'),'foreignKey':_0xebe5('0x159')});db['OpenchannelQueueReport'][_0xebe5('0x126')](db[_0xebe5('0x61')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0xebe5('0x62')],{});db[_0xebe5('0x67')][_0xebe5('0x126')](db['User'],{});db[_0xebe5('0x67')][_0xebe5('0x126')](db['OpenchannelQueue'],{});db['ChatApplication'][_0xebe5('0x126')](db['User'],{'as':'Agent','foreignKey':_0xebe5('0x117'),'onDelete':'restrict'});db[_0xebe5('0x69')][_0xebe5('0x126')](db[_0xebe5('0x6f')],{'as':_0xebe5('0x188'),'foreignKey':_0xebe5('0x189'),'onDelete':_0xebe5('0x171')});db['ChatApplication'][_0xebe5('0x126')](db[_0xebe5('0x16e')],{'as':'Website','foreignKey':_0xebe5('0x16f'),'onDelete':_0xebe5('0x171')});db[_0xebe5('0x69')][_0xebe5('0x126')](db[_0xebe5('0x8e')],{'onDelete':_0xebe5('0x171'),'foreignKey':'TagId'});db['ChatInteraction']['hasMany'](db['ChatMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0xebe5('0x18a')});db['ChatInteraction'][_0xebe5('0x126')](db[_0xebe5('0x16e')],{'as':_0xebe5('0x16d'),'foreignKey':_0xebe5('0x16f')});db[_0xebe5('0x6b')]['belongsTo'](db['CmContact'],{'as':_0xebe5('0x158'),'foreignKey':_0xebe5('0x159')});db[_0xebe5('0x6b')][_0xebe5('0x126')](db[_0xebe5('0x10')],{'as':_0xebe5('0x165'),'foreignKey':_0xebe5('0x117')});db['ChatInteraction'][_0xebe5('0x128')](db[_0xebe5('0x8e')],{'through':'chat_interaction_has_tags','as':_0xebe5('0x167')});db[_0xebe5('0x6b')][_0xebe5('0x128')](db['Tag'],{'through':_0xebe5('0x18b'),'as':_0xebe5('0x168')});db[_0xebe5('0x6b')]['belongsToMany'](db[_0xebe5('0x10')],{'as':_0xebe5('0x169'),'through':_0xebe5('0x18c'),'foreignKey':_0xebe5('0x18a')});db['ChatMessage']['belongsTo'](db[_0xebe5('0x10')],{'onDelete':_0xebe5('0x116'),'as':'User'});db[_0xebe5('0x187')][_0xebe5('0x126')](db['CmContact'],{'onDelete':'cascade','as':'Contact','foreignKey':'ContactId'});db[_0xebe5('0x187')][_0xebe5('0x126')](db[_0xebe5('0x6b')],{'onDelete':'cascade','as':_0xebe5('0x16c'),'foreignKey':_0xebe5('0x18a')});db[_0xebe5('0x187')]['belongsTo'](db[_0xebe5('0xec')],{'as':_0xebe5('0xec'),'foreignKey':_0xebe5('0x17c')});db[_0xebe5('0x187')][_0xebe5('0x126')](db[_0xebe5('0x16e')],{'as':_0xebe5('0x16d'),'foreignKey':'ChatWebsiteId'});db[_0xebe5('0x6d')][_0xebe5('0x119')](db[_0xebe5('0xec')],{'as':_0xebe5('0x16b'),'foreignKey':_0xebe5('0x170'),'onDelete':_0xebe5('0x116'),'hooks':!![]});db[_0xebe5('0x6d')][_0xebe5('0x126')](db[_0xebe5('0x74')],{'onDelete':_0xebe5('0x116'),'as':_0xebe5('0x158'),'foreignKey':_0xebe5('0x159')});db[_0xebe5('0x6d')]['belongsTo'](db[_0xebe5('0x16e')],{'as':'Account','foreignKey':_0xebe5('0x16f')});db[_0xebe5('0x6f')][_0xebe5('0x128')](db['User'],{'as':_0xebe5('0x151'),'through':_0xebe5('0x2d'),'hooks':!![]});db['ChatQueue'][_0xebe5('0x128')](db[_0xebe5('0xe5')],{'through':_0xebe5('0x18d'),'as':_0xebe5('0x152')});db[_0xebe5('0x71')][_0xebe5('0x119')](db[_0xebe5('0xd3')],{'as':_0xebe5('0x155'),'foreignKey':'ChatGroupId','onDelete':_0xebe5('0x116')});db[_0xebe5('0x71')][_0xebe5('0x128')](db['User'],{'as':_0xebe5('0x147'),'through':_0xebe5('0x129')});db[_0xebe5('0x73')][_0xebe5('0x126')](db[_0xebe5('0x16e')],{'as':'Website','foreignKey':'ChatWebsiteId'});db[_0xebe5('0x18e')][_0xebe5('0x119')](db['CmContact'],{'as':_0xebe5('0x18f'),'foreignKey':_0xebe5('0x190')});db[_0xebe5('0x74')][_0xebe5('0x119')](db['CmContactHasItem'],{'as':_0xebe5('0x191'),'foreignKey':_0xebe5('0x192')});db[_0xebe5('0x74')][_0xebe5('0x119')](db[_0xebe5('0x76')],{'as':'Hoppers','foreignKey':_0xebe5('0x159')});db[_0xebe5('0x74')]['hasMany'](db['CmHopperFinal'],{'as':_0xebe5('0x11c'),'foreignKey':_0xebe5('0x159')});db[_0xebe5('0x74')][_0xebe5('0x119')](db[_0xebe5('0x7c')],{'as':_0xebe5('0x14a'),'foreignKey':_0xebe5('0x159')});db['CmContact']['hasMany'](db['ReportAgentPreview'],{'as':_0xebe5('0x11e'),'foreignKey':_0xebe5('0x159')});db[_0xebe5('0x74')][_0xebe5('0x119')](db[_0xebe5('0xd7')],{'as':'JscriptySessions','foreignKey':_0xebe5('0x159')});db[_0xebe5('0x74')]['hasMany'](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':'restrict'});db[_0xebe5('0x74')]['hasMany'](db['ChatInteraction'],{'as':_0xebe5('0x120'),'foreignKey':_0xebe5('0x159'),'onDelete':_0xebe5('0x171')});db[_0xebe5('0x74')]['hasMany'](db[_0xebe5('0x58')],{'as':'SmsInteractions','foreignKey':_0xebe5('0x159'),'onDelete':_0xebe5('0x171')});db[_0xebe5('0x74')]['hasMany'](db[_0xebe5('0x4d')],{'as':_0xebe5('0x121'),'foreignKey':'ContactId','onDelete':_0xebe5('0x171')});db[_0xebe5('0x74')]['hasMany'](db['MailInteraction'],{'as':_0xebe5('0x122'),'foreignKey':_0xebe5('0x159'),'onDelete':_0xebe5('0x171')});db['CmContact'][_0xebe5('0x126')](db['CmCompany'],{'as':_0xebe5('0x193'),'foreignKey':'CompanyId'});db['CmContact']['belongsTo'](db['CmList'],{'as':_0xebe5('0x161'),'foreignKey':_0xebe5('0x162'),'onDelete':_0xebe5('0x116')});db[_0xebe5('0x74')][_0xebe5('0x128')](db['User'],{'as':'Users','through':_0xebe5('0x194')});db[_0xebe5('0x74')]['belongsToMany'](db[_0xebe5('0x8e')],{'as':_0xebe5('0x167'),'through':'cm_contact_has_tags'});db[_0xebe5('0x74')][_0xebe5('0x128')](db['Tag'],{'through':_0xebe5('0x195'),'as':_0xebe5('0x168')});db['CmHopper']['hasMany'](db['CmHopperAdditionalPhone'],{'as':'AdditionalPhones','foreignKey':_0xebe5('0x196')});db['CmHopper'][_0xebe5('0x126')](db[_0xebe5('0x74')],{'as':_0xebe5('0x158'),'foreignKey':'ContactId','onDelete':_0xebe5('0x116')});db['CmHopper']['belongsTo'](db[_0xebe5('0xf7')],{'as':_0xebe5('0x161'),'foreignKey':_0xebe5('0x162'),'onDelete':_0xebe5('0x116')});db[_0xebe5('0x76')][_0xebe5('0x126')](db[_0xebe5('0x10')],{'as':_0xebe5('0x197'),'foreignKey':_0xebe5('0x117')});db[_0xebe5('0x76')]['belongsTo'](db[_0xebe5('0x18')],{'as':_0xebe5('0x188'),'foreignKey':'VoiceQueueId','onDelete':_0xebe5('0x116')});db[_0xebe5('0x76')][_0xebe5('0x126')](db[_0xebe5('0xe9')],{'as':_0xebe5('0xe9'),'foreignKey':_0xebe5('0x198'),'onDelete':_0xebe5('0x116')});db['CmHopper']['belongsTo'](db[_0xebe5('0x10')],{'as':_0xebe5('0x165'),'foreignKey':_0xebe5('0x199')});db[_0xebe5('0x78')][_0xebe5('0x126')](db[_0xebe5('0x74')],{'as':'Contact','foreignKey':'ContactId','onDelete':_0xebe5('0x116')});db[_0xebe5('0x78')][_0xebe5('0x126')](db[_0xebe5('0xf7')],{'as':_0xebe5('0x161'),'foreignKey':_0xebe5('0x162'),'onDelete':_0xebe5('0x116')});db[_0xebe5('0x78')][_0xebe5('0x126')](db[_0xebe5('0x18')],{'as':_0xebe5('0x188'),'foreignKey':'VoiceQueueId','onDelete':_0xebe5('0x116')});db['CmHopperBlack'][_0xebe5('0x126')](db[_0xebe5('0xe9')],{'as':_0xebe5('0xe9'),'foreignKey':_0xebe5('0x198'),'onDelete':_0xebe5('0x116')});db['Automation']['hasMany'](db[_0xebe5('0x84')],{'as':{'plural':_0xebe5('0x19a'),'singular':_0xebe5('0x19b')},'foreignKey':_0xebe5('0x19c'),'onDelete':_0xebe5('0x116'),'hooks':!![]});db[_0xebe5('0x80')][_0xebe5('0x119')](db['Condition'],{'as':{'plural':'Any','singular':'OneAny'},'foreignKey':_0xebe5('0x19d'),'onDelete':_0xebe5('0x116'),'hooks':!![]});db[_0xebe5('0x80')][_0xebe5('0x119')](db[_0xebe5('0x7f')],{'as':_0xebe5('0x19e'),'foreignKey':_0xebe5('0x19f'),'onDelete':'cascade','hooks':!![]});db[_0xebe5('0x83')][_0xebe5('0x119')](db['Disposition'],{'as':_0xebe5('0x15d'),'foreignKey':'ParentId','onDelete':_0xebe5('0x116')});db[_0xebe5('0x86')][_0xebe5('0x119')](db[_0xebe5('0x86')],{'as':'Intervals','foreignKey':_0xebe5('0x17f'),'onDelete':_0xebe5('0x116'),'hooks':!![],'required':![]});db[_0xebe5('0x86')][_0xebe5('0x119')](db[_0xebe5('0x11b')],{'as':_0xebe5('0x1a0'),'foreignKey':_0xebe5('0x17f'),'onDelete':_0xebe5('0x171')});db[_0xebe5('0x86')][_0xebe5('0x119')](db[_0xebe5('0x44')],{'as':_0xebe5('0x1a1'),'foreignKey':_0xebe5('0x17f')});db[_0xebe5('0x86')]['hasMany'](db[_0xebe5('0x69')],{'as':_0xebe5('0x1a2'),'foreignKey':_0xebe5('0x17f')});db[_0xebe5('0x86')]['hasMany'](db[_0xebe5('0x175')],{'as':_0xebe5('0x1a3'),'foreignKey':_0xebe5('0x17f')});db[_0xebe5('0x86')][_0xebe5('0x119')](db[_0xebe5('0x56')],{'as':_0xebe5('0x1a4'),'foreignKey':_0xebe5('0x17f')});db[_0xebe5('0x8c')]['belongsTo'](db[_0xebe5('0x3d')],{});db[_0xebe5('0x8c')]['belongsTo'](db[_0xebe5('0x9f')],{'foreignKey':_0xebe5('0x1a5')});db['Schedule'][_0xebe5('0x126')](db[_0xebe5('0x9d')],{'foreignKey':_0xebe5('0x1a6')});db[_0xebe5('0x8d')][_0xebe5('0x128')](db[_0xebe5('0x16')],{'as':_0xebe5('0x1a7'),'through':_0xebe5('0x1a8'),'onDelete':'restrict'});db[_0xebe5('0x8e')]['belongsToMany'](db[_0xebe5('0x74')],{'through':_0xebe5('0x195')});db['Tag'][_0xebe5('0x128')](db[_0xebe5('0x6b')],{'through':_0xebe5('0x18b')});db[_0xebe5('0x8e')]['belongsToMany'](db[_0xebe5('0x41')],{'through':_0xebe5('0x166')});db['Tag']['belongsToMany'](db['SmsInteraction'],{'through':_0xebe5('0x181')});db[_0xebe5('0x8e')][_0xebe5('0x128')](db[_0xebe5('0x4d')],{'through':_0xebe5('0x17a')});db[_0xebe5('0x8e')][_0xebe5('0x128')](db['OpenchannelInteraction'],{'through':_0xebe5('0x185')});db[_0xebe5('0x8e')][_0xebe5('0x128')](db['WhatsappInteraction'],{'through':_0xebe5('0x1a9')});db['CmContactHasItem'][_0xebe5('0x126')](db[_0xebe5('0x1aa')],{'as':_0xebe5('0x1ab'),'foreignKey':_0xebe5('0x1ac')});db[_0xebe5('0x92')][_0xebe5('0x126')](db[_0xebe5('0x76')],{'as':'Hopper','foreignKey':_0xebe5('0x196')});db['CmContactHasItem'][_0xebe5('0x126')](db['CmContact'],{'as':_0xebe5('0x158'),'foreignKey':_0xebe5('0x192')});db[_0xebe5('0x96')]['hasMany'](db[_0xebe5('0x84')],{'as':{'plural':_0xebe5('0x1ad'),'singular':_0xebe5('0x1ae')},'foreignKey':_0xebe5('0x1af'),'onDelete':_0xebe5('0x116'),'hooks':!![]});db[_0xebe5('0x96')][_0xebe5('0x119')](db[_0xebe5('0x84')],{'as':{'plural':_0xebe5('0x1b0'),'singular':_0xebe5('0x1b1')},'foreignKey':_0xebe5('0x1b2'),'onDelete':_0xebe5('0x116'),'hooks':!![]});db[_0xebe5('0x96')]['hasMany'](db[_0xebe5('0x7f')],{'as':_0xebe5('0x19e'),'foreignKey':_0xebe5('0x1b3'),'onDelete':_0xebe5('0x116'),'hooks':!![]});db['AnalyticCustomReport'][_0xebe5('0x119')](db[_0xebe5('0x1b4')],{'as':_0xebe5('0x1b5'),'onDelete':'cascade','foreignKey':_0xebe5('0x1a6'),'hooks':!![]});db[_0xebe5('0x9f')][_0xebe5('0x119')](db['AnalyticFieldReport'],{'as':_0xebe5('0x1b5'),'onDelete':_0xebe5('0x116'),'foreignKey':_0xebe5('0x1a5')});db[_0xebe5('0xa1')]['hasMany'](db['AnalyticFieldReport'],{'as':_0xebe5('0x1b5'),'onDelete':'cascade','foreignKey':_0xebe5('0x1b6')});db['AnalyticFieldReport'][_0xebe5('0x126')](db[_0xebe5('0xa1')],{'foreignKey':_0xebe5('0x1b6')});db[_0xebe5('0xa5')][_0xebe5('0x119')](db['SalesforceConfiguration'],{'as':_0xebe5('0x1b7'),'onDelete':_0xebe5('0x116'),'foreignKey':_0xebe5('0x1b8')});db[_0xebe5('0xa6')][_0xebe5('0x119')](db[_0xebe5('0xa8')],{'as':_0xebe5('0x1b9'),'onDelete':_0xebe5('0x116'),'foreignKey':_0xebe5('0x1ba')});db[_0xebe5('0xa6')][_0xebe5('0x119')](db[_0xebe5('0xa8')],{'as':_0xebe5('0x1bb'),'onDelete':_0xebe5('0x116'),'foreignKey':'DescriptionId'});db[_0xebe5('0xa6')][_0xebe5('0x119')](db[_0xebe5('0xa8')],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db['SalesforceConfiguration'][_0xebe5('0x126')](db[_0xebe5('0xa5')],{'as':_0xebe5('0x16d'),'foreignKey':_0xebe5('0x1b8')});db[_0xebe5('0xa8')]['hasMany'](db['SalesforceField'],{'as':_0xebe5('0x1bc'),'foreignKey':_0xebe5('0x1ba')});db[_0xebe5('0xa8')]['hasMany'](db['SalesforceField'],{'as':_0xebe5('0x1bd'),'foreignKey':_0xebe5('0x1be')});db[_0xebe5('0xa8')][_0xebe5('0x119')](db['SalesforceField'],{'as':_0xebe5('0x1bf'),'foreignKey':_0xebe5('0x1c0')});db[_0xebe5('0xa8')]['belongsTo'](db[_0xebe5('0x98')],{'as':_0xebe5('0x98'),'foreignKey':_0xebe5('0x1c1')});db['SugarcrmAccount'][_0xebe5('0x119')](db['SugarcrmConfiguration'],{'as':_0xebe5('0x1b7'),'onDelete':_0xebe5('0x116'),'foreignKey':_0xebe5('0x1b8')});db['SugarcrmConfiguration'][_0xebe5('0x119')](db[_0xebe5('0xad')],{'as':'Subjects','onDelete':_0xebe5('0x116'),'foreignKey':_0xebe5('0x1ba')});db[_0xebe5('0xab')][_0xebe5('0x119')](db[_0xebe5('0xad')],{'as':_0xebe5('0x1bb'),'onDelete':_0xebe5('0x116'),'foreignKey':_0xebe5('0x1be')});db[_0xebe5('0xab')][_0xebe5('0x119')](db['SugarcrmField'],{'as':_0xebe5('0x1b5'),'onDelete':_0xebe5('0x116'),'foreignKey':_0xebe5('0x1c0')});db[_0xebe5('0xab')][_0xebe5('0x126')](db[_0xebe5('0xa9')],{'as':'Account','foreignKey':'AccountId'});db[_0xebe5('0xad')][_0xebe5('0x119')](db[_0xebe5('0xad')],{'as':'Subject','foreignKey':_0xebe5('0x1ba')});db[_0xebe5('0xad')][_0xebe5('0x119')](db['SugarcrmField'],{'as':_0xebe5('0x1bd'),'foreignKey':_0xebe5('0x1be')});db[_0xebe5('0xad')][_0xebe5('0x119')](db['SugarcrmField'],{'as':_0xebe5('0x1bf'),'foreignKey':_0xebe5('0x1c0')});db['SugarcrmField']['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0xebe5('0x1c1')});db[_0xebe5('0xaf')][_0xebe5('0x119')](db['DeskConfiguration'],{'as':_0xebe5('0x1b7'),'onDelete':_0xebe5('0x116'),'foreignKey':'AccountId'});db[_0xebe5('0x1c2')][_0xebe5('0x119')](db[_0xebe5('0xb2')],{'as':_0xebe5('0x1b9'),'onDelete':_0xebe5('0x116'),'foreignKey':_0xebe5('0x1ba')});db[_0xebe5('0x1c2')][_0xebe5('0x119')](db[_0xebe5('0xb2')],{'as':_0xebe5('0x1bb'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xebe5('0x1c2')][_0xebe5('0x119')](db[_0xebe5('0xb2')],{'as':_0xebe5('0x1b5'),'onDelete':_0xebe5('0x116'),'foreignKey':_0xebe5('0x1c0')});db[_0xebe5('0x1c2')][_0xebe5('0x126')](db[_0xebe5('0xaf')],{'as':_0xebe5('0x16d'),'foreignKey':_0xebe5('0x1b8')});db[_0xebe5('0x1c2')][_0xebe5('0x128')](db[_0xebe5('0x8e')],{'through':_0xebe5('0x1c3')});db['DeskField'][_0xebe5('0x119')](db[_0xebe5('0xb2')],{'as':_0xebe5('0x1bc'),'foreignKey':_0xebe5('0x1ba')});db[_0xebe5('0xb2')][_0xebe5('0x119')](db[_0xebe5('0xb2')],{'as':_0xebe5('0x1bd'),'foreignKey':_0xebe5('0x1be')});db[_0xebe5('0xb2')][_0xebe5('0x119')](db['DeskField'],{'as':_0xebe5('0x1bf'),'foreignKey':_0xebe5('0x1c0')});db[_0xebe5('0xb2')]['belongsTo'](db['Variable'],{'as':_0xebe5('0x98'),'foreignKey':_0xebe5('0x1c1')});db[_0xebe5('0xb4')][_0xebe5('0x119')](db['ZohoConfiguration'],{'as':_0xebe5('0x1b7'),'onDelete':'cascade','foreignKey':_0xebe5('0x1b8')});db[_0xebe5('0xb6')][_0xebe5('0x119')](db[_0xebe5('0x1c4')],{'as':_0xebe5('0x1b9'),'onDelete':'cascade','foreignKey':_0xebe5('0x1ba')});db['ZohoConfiguration'][_0xebe5('0x119')](db[_0xebe5('0x1c4')],{'as':_0xebe5('0x1bb'),'onDelete':_0xebe5('0x116'),'foreignKey':'DescriptionId'});db[_0xebe5('0xb6')][_0xebe5('0x119')](db[_0xebe5('0x1c4')],{'as':_0xebe5('0x1b5'),'onDelete':_0xebe5('0x116'),'foreignKey':_0xebe5('0x1c0')});db[_0xebe5('0xb6')][_0xebe5('0x126')](db['ZohoAccount'],{'as':'Account','foreignKey':_0xebe5('0x1b8')});db[_0xebe5('0x1c4')][_0xebe5('0x119')](db[_0xebe5('0x1c4')],{'as':_0xebe5('0x1bc'),'foreignKey':_0xebe5('0x1ba')});db['ZohoField'][_0xebe5('0x119')](db['ZohoField'],{'as':_0xebe5('0x1bd'),'foreignKey':_0xebe5('0x1be')});db[_0xebe5('0x1c4')][_0xebe5('0x119')](db[_0xebe5('0x1c4')],{'as':'Field','foreignKey':_0xebe5('0x1c0')});db[_0xebe5('0x1c4')][_0xebe5('0x126')](db['Variable'],{'as':_0xebe5('0x98'),'foreignKey':'VariableId'});db[_0xebe5('0xb8')]['hasMany'](db[_0xebe5('0xba')],{'as':_0xebe5('0x1b7'),'onDelete':'cascade','foreignKey':_0xebe5('0x1b8')});db['ZendeskConfiguration'][_0xebe5('0x119')](db[_0xebe5('0xbb')],{'as':_0xebe5('0x1b9'),'foreignKey':_0xebe5('0x1ba')});db[_0xebe5('0xba')][_0xebe5('0x119')](db['ZendeskField'],{'as':'Descriptions','foreignKey':_0xebe5('0x1be')});db[_0xebe5('0xba')][_0xebe5('0x119')](db[_0xebe5('0xbb')],{'as':_0xebe5('0x1b5'),'foreignKey':'FieldId'});db['ZendeskConfiguration'][_0xebe5('0x126')](db['ZendeskAccount'],{'as':_0xebe5('0x16d'),'foreignKey':_0xebe5('0x1b8')});db[_0xebe5('0xba')][_0xebe5('0x128')](db[_0xebe5('0x8e')],{'through':'int_zendesk_configuration_has_tags'});db[_0xebe5('0xbb')][_0xebe5('0x119')](db[_0xebe5('0xbb')],{'as':_0xebe5('0x1bc'),'foreignKey':'SubjectId'});db[_0xebe5('0xbb')][_0xebe5('0x119')](db['ZendeskField'],{'as':_0xebe5('0x1bd'),'foreignKey':_0xebe5('0x1be')});db[_0xebe5('0xbb')][_0xebe5('0x119')](db[_0xebe5('0xbb')],{'as':'Field','foreignKey':_0xebe5('0x1c0')});db[_0xebe5('0xbb')][_0xebe5('0x126')](db[_0xebe5('0x98')],{'as':_0xebe5('0x98'),'foreignKey':_0xebe5('0x1c1')});db[_0xebe5('0xbc')][_0xebe5('0x119')](db[_0xebe5('0xbe')],{'as':'Configurations','onDelete':_0xebe5('0x116'),'foreignKey':_0xebe5('0x1b8')});db['FreshdeskConfiguration']['hasMany'](db['FreshdeskField'],{'as':_0xebe5('0x1b9'),'onDelete':_0xebe5('0x116'),'foreignKey':_0xebe5('0x1ba')});db[_0xebe5('0xbe')][_0xebe5('0x119')](db[_0xebe5('0xc0')],{'as':_0xebe5('0x1bb'),'onDelete':_0xebe5('0x116'),'foreignKey':_0xebe5('0x1be')});db['FreshdeskConfiguration']['hasMany'](db[_0xebe5('0xc0')],{'as':'Fields','onDelete':_0xebe5('0x116'),'foreignKey':_0xebe5('0x1c0')});db['FreshdeskConfiguration'][_0xebe5('0x126')](db[_0xebe5('0xbc')],{'as':_0xebe5('0x16d'),'foreignKey':'AccountId'});db[_0xebe5('0xbe')][_0xebe5('0x128')](db['Tag'],{'through':_0xebe5('0x1c5')});db[_0xebe5('0xc0')][_0xebe5('0x119')](db[_0xebe5('0xc0')],{'as':'Subject','foreignKey':'SubjectId'});db[_0xebe5('0xc0')]['hasMany'](db[_0xebe5('0xc0')],{'as':_0xebe5('0x1bd'),'foreignKey':_0xebe5('0x1be')});db[_0xebe5('0xc0')][_0xebe5('0x119')](db['FreshdeskField'],{'as':_0xebe5('0x1bf'),'foreignKey':_0xebe5('0x1c0')});db[_0xebe5('0xc0')][_0xebe5('0x126')](db[_0xebe5('0x98')],{'as':'Variable','foreignKey':_0xebe5('0x1c1')});db[_0xebe5('0xc2')][_0xebe5('0x119')](db[_0xebe5('0xc4')],{'as':_0xebe5('0x1b7'),'onDelete':_0xebe5('0x116'),'foreignKey':_0xebe5('0x1b8')});db['VtigerConfiguration']['hasMany'](db[_0xebe5('0xc6')],{'as':_0xebe5('0x1b9'),'foreignKey':_0xebe5('0x1ba')});db[_0xebe5('0xc4')][_0xebe5('0x119')](db[_0xebe5('0xc6')],{'as':_0xebe5('0x1bb'),'foreignKey':_0xebe5('0x1be')});db[_0xebe5('0xc4')][_0xebe5('0x119')](db[_0xebe5('0xc6')],{'as':_0xebe5('0x1b5'),'foreignKey':'FieldId'});db[_0xebe5('0xc4')][_0xebe5('0x126')](db[_0xebe5('0xc2')],{'as':_0xebe5('0x16d'),'foreignKey':'AccountId'});db[_0xebe5('0xc6')][_0xebe5('0x119')](db[_0xebe5('0xc6')],{'as':_0xebe5('0x1bc'),'foreignKey':'SubjectId'});db['VtigerField'][_0xebe5('0x119')](db['VtigerField'],{'as':_0xebe5('0x1bd'),'foreignKey':_0xebe5('0x1be')});db[_0xebe5('0xc6')]['hasMany'](db[_0xebe5('0xc6')],{'as':_0xebe5('0x1bf'),'foreignKey':_0xebe5('0x1c0')});db[_0xebe5('0xc6')][_0xebe5('0x126')](db[_0xebe5('0x98')],{'as':_0xebe5('0x98'),'foreignKey':_0xebe5('0x1c1')});db[_0xebe5('0x1c6')]['hasMany'](db[_0xebe5('0x1c7')],{'as':_0xebe5('0x1b7'),'onDelete':_0xebe5('0x116'),'foreignKey':_0xebe5('0x1b8')});db[_0xebe5('0x1c7')][_0xebe5('0x119')](db[_0xebe5('0xc8')],{'as':_0xebe5('0x1b9'),'foreignKey':'SubjectId'});db[_0xebe5('0x1c7')][_0xebe5('0x119')](db['ServicenowField'],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0xebe5('0x1c7')]['hasMany'](db[_0xebe5('0xc8')],{'as':_0xebe5('0x1b5'),'foreignKey':_0xebe5('0x1c0')});db['ServicenowConfiguration'][_0xebe5('0x126')](db[_0xebe5('0x1c6')],{'as':_0xebe5('0x16d'),'foreignKey':_0xebe5('0x1b8')});db[_0xebe5('0xc8')][_0xebe5('0x119')](db['ServicenowField'],{'as':_0xebe5('0x1bc'),'foreignKey':_0xebe5('0x1ba')});db[_0xebe5('0xc8')][_0xebe5('0x119')](db[_0xebe5('0xc8')],{'as':_0xebe5('0x1bd'),'foreignKey':_0xebe5('0x1be')});db[_0xebe5('0xc8')][_0xebe5('0x119')](db[_0xebe5('0xc8')],{'as':_0xebe5('0x1bf'),'foreignKey':_0xebe5('0x1c0')});db[_0xebe5('0xc8')][_0xebe5('0x126')](db['Variable'],{'as':_0xebe5('0x98'),'foreignKey':_0xebe5('0x1c1')});db[_0xebe5('0xc9')]['hasMany'](db[_0xebe5('0x1c8')],{'as':_0xebe5('0x1b7'),'onDelete':_0xebe5('0x116'),'foreignKey':_0xebe5('0x1b8')});db['Dynamics365Account'][_0xebe5('0x126')](db['CloudProvider'],{'as':'CloudProvider','foreignKey':_0xebe5('0x15a')});db[_0xebe5('0x1c8')][_0xebe5('0x119')](db['Dynamics365Field'],{'as':_0xebe5('0x1b9'),'onDelete':_0xebe5('0x116'),'foreignKey':_0xebe5('0x1ba')});db[_0xebe5('0x1c8')][_0xebe5('0x119')](db[_0xebe5('0xcc')],{'as':_0xebe5('0x1bb'),'onDelete':'cascade','foreignKey':_0xebe5('0x1be')});db['Dynamics365Configuration']['hasMany'](db[_0xebe5('0xcc')],{'as':_0xebe5('0x1b5'),'onDelete':_0xebe5('0x116'),'foreignKey':'FieldId'});db[_0xebe5('0x1c8')][_0xebe5('0x126')](db[_0xebe5('0xc9')],{'as':_0xebe5('0x16d'),'foreignKey':'AccountId'});db[_0xebe5('0xcc')]['hasMany'](db[_0xebe5('0xcc')],{'as':_0xebe5('0x1bc'),'foreignKey':_0xebe5('0x1ba')});db[_0xebe5('0xcc')][_0xebe5('0x119')](db['Dynamics365Field'],{'as':_0xebe5('0x1bd'),'foreignKey':'DescriptionId'});db[_0xebe5('0xcc')]['hasMany'](db[_0xebe5('0xcc')],{'as':'Field','foreignKey':'FieldId'});db[_0xebe5('0xcc')][_0xebe5('0x126')](db[_0xebe5('0x98')],{'as':_0xebe5('0x98'),'foreignKey':_0xebe5('0x1c1')});db[_0xebe5('0x1c9')]['hasMany'](db[_0xebe5('0xce')],{'as':_0xebe5('0x1b7'),'onDelete':'cascade','foreignKey':_0xebe5('0x1b8')});db[_0xebe5('0xce')][_0xebe5('0x119')](db[_0xebe5('0xd0')],{'as':_0xebe5('0x1b9'),'foreignKey':_0xebe5('0x1ba')});db[_0xebe5('0xce')]['hasMany'](db[_0xebe5('0xd0')],{'as':_0xebe5('0x1bb'),'foreignKey':_0xebe5('0x1be')});db[_0xebe5('0xce')][_0xebe5('0x119')](db[_0xebe5('0xd0')],{'as':'Fields','foreignKey':_0xebe5('0x1c0')});db[_0xebe5('0xce')]['belongsTo'](db[_0xebe5('0x1c9')],{'as':_0xebe5('0x16d'),'foreignKey':'AccountId'});db[_0xebe5('0xd0')]['hasMany'](db[_0xebe5('0xd0')],{'as':'Subject','foreignKey':_0xebe5('0x1ba')});db['FreshsalesField'][_0xebe5('0x119')](db['FreshsalesField'],{'as':_0xebe5('0x1bd'),'foreignKey':_0xebe5('0x1be')});db['FreshsalesField'][_0xebe5('0x119')](db[_0xebe5('0xd0')],{'as':_0xebe5('0x1bf'),'foreignKey':_0xebe5('0x1c0')});db['FreshsalesField'][_0xebe5('0x126')](db[_0xebe5('0x98')],{'as':_0xebe5('0x98'),'foreignKey':_0xebe5('0x1c1')});db['ChatQueueReport'][_0xebe5('0x126')](db['ChatWebsite'],{});db[_0xebe5('0x1ca')][_0xebe5('0x126')](db[_0xebe5('0xf7')],{'as':_0xebe5('0x161'),'foreignKey':'ListId'});db[_0xebe5('0x1ca')][_0xebe5('0x126')](db[_0xebe5('0x74')],{'as':'Contact','foreignKey':_0xebe5('0x159')});db[_0xebe5('0x1ca')][_0xebe5('0x126')](db[_0xebe5('0x6b')],{});db['ChatQueueReport'][_0xebe5('0x126')](db[_0xebe5('0x187')],{});db['ChatQueueReport'][_0xebe5('0x126')](db[_0xebe5('0x10')],{});db[_0xebe5('0x1ca')][_0xebe5('0x126')](db['ChatQueue'],{});db[_0xebe5('0xd3')][_0xebe5('0x126')](db[_0xebe5('0x10')],{'onDelete':'cascade','foreignKey':_0xebe5('0x1cb')});db['ChatInternalMessage']['belongsTo'](db[_0xebe5('0x10')],{'onDelete':_0xebe5('0x116'),'foreignKey':_0xebe5('0x1cc')});db[_0xebe5('0xd7')][_0xebe5('0x119')](db[_0xebe5('0xd6')],{'foreignKey':'SessionId','onDelete':_0xebe5('0x116')});db[_0xebe5('0xd7')][_0xebe5('0x119')](db[_0xebe5('0xd4')],{'foreignKey':_0xebe5('0x1cd'),'onDelete':'cascade'});db[_0xebe5('0xd9')][_0xebe5('0x126')](db[_0xebe5('0x54')],{});db['SmsQueueReport'][_0xebe5('0x126')](db[_0xebe5('0xf7')],{'as':_0xebe5('0x161'),'foreignKey':_0xebe5('0x162')});db['SmsQueueReport'][_0xebe5('0x126')](db[_0xebe5('0x74')],{'as':_0xebe5('0x158'),'foreignKey':_0xebe5('0x159')});db['SmsQueueReport']['belongsTo'](db[_0xebe5('0x58')],{});db[_0xebe5('0xd9')][_0xebe5('0x126')](db['SmsMessage'],{});db[_0xebe5('0xd9')][_0xebe5('0x126')](db['User'],{});db[_0xebe5('0xd9')][_0xebe5('0x126')](db['SmsQueue'],{});db[_0xebe5('0xdc')][_0xebe5('0x119')](db[_0xebe5('0xd7')],{'foreignKey':_0xebe5('0x1ce')});db[_0xebe5('0xdc')][_0xebe5('0x119')](db['JscriptyQuestionReport'],{'foreignKey':'ProjectId'});db[_0xebe5('0xdc')]['hasMany'](db[_0xebe5('0xd4')],{'foreignKey':_0xebe5('0x1ce')});db[_0xebe5('0xe1')]['belongsToMany'](db[_0xebe5('0x10')],{'as':_0xebe5('0x169'),'through':_0xebe5('0x143')});db[_0xebe5('0xe5')][_0xebe5('0x128')](db[_0xebe5('0x10')],{'as':_0xebe5('0x151'),'through':_0xebe5('0x1cf')});db[_0xebe5('0xe5')][_0xebe5('0x128')](db[_0xebe5('0x18')],{'through':_0xebe5('0x10d'),'as':_0xebe5('0x130')});db['Team'][_0xebe5('0x128')](db[_0xebe5('0x3f')],{'through':_0xebe5('0x1d0'),'as':'MailQueues'});db[_0xebe5('0xe5')][_0xebe5('0x128')](db[_0xebe5('0x6f')],{'through':_0xebe5('0x18d'),'as':_0xebe5('0x134')});db['Team'][_0xebe5('0x128')](db['FaxQueue'],{'through':_0xebe5('0x1d1'),'as':_0xebe5('0x135')});db['Team']['belongsToMany'](db[_0xebe5('0x5c')],{'through':_0xebe5('0x183'),'as':'SmsQueues'});db['Team'][_0xebe5('0x128')](db[_0xebe5('0x64')],{'through':_0xebe5('0x1d2'),'as':'OpenchannelQueues'});db[_0xebe5('0xe5')]['belongsToMany'](db[_0xebe5('0x109')],{'through':_0xebe5('0x1d3'),'as':_0xebe5('0x138')});db[_0xebe5('0xe5')][_0xebe5('0x128')](db[_0xebe5('0x132')],{'through':_0xebe5('0x10f'),'as':_0xebe5('0x1d4')});db[_0xebe5('0xe9')][_0xebe5('0x119')](db[_0xebe5('0x76')],{'as':_0xebe5('0x148'),'foreignKey':'CampaignId'});db[_0xebe5('0xe9')]['hasMany'](db[_0xebe5('0x7a')],{'as':_0xebe5('0x11c'),'foreignKey':'CampaignId'});db[_0xebe5('0xe9')][_0xebe5('0x119')](db[_0xebe5('0x7c')],{'as':_0xebe5('0x14a'),'foreignKey':_0xebe5('0x198')});db[_0xebe5('0xe9')][_0xebe5('0x119')](db[_0xebe5('0x78')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0xebe5('0xe9')]['belongsTo'](db['Trunk'],{'as':_0xebe5('0x27'),'foreignKey':_0xebe5('0x14d')});db[_0xebe5('0xe9')][_0xebe5('0x126')](db[_0xebe5('0x27')],{'as':_0xebe5('0x14e'),'foreignKey':_0xebe5('0x1d5')});db[_0xebe5('0xe9')]['belongsTo'](db[_0xebe5('0x86')],{'as':'Interval','foreignKey':'IntervalId'});db[_0xebe5('0xe9')]['belongsTo'](db[_0xebe5('0xe1')],{'as':_0xebe5('0xe1'),'foreignKey':_0xebe5('0x1d6')});db[_0xebe5('0xe9')]['belongsToMany'](db[_0xebe5('0xf7')],{'as':_0xebe5('0x12a'),'through':_0xebe5('0x1d7')});db[_0xebe5('0xe9')][_0xebe5('0x128')](db[_0xebe5('0xf7')],{'as':'BlackLists','through':_0xebe5('0x1d8')});db[_0xebe5('0xec')][_0xebe5('0x126')](db['ChatOfflineMessage'],{'as':'ChatOfflineMessage','foreignKey':_0xebe5('0x170')});db[_0xebe5('0xee')][_0xebe5('0x126')](db['MailMessage'],{});db[_0xebe5('0xee')][_0xebe5('0x126')](db['MailInteraction'],{});db['MailTransferReport'][_0xebe5('0x126')](db[_0xebe5('0x3d')],{'foreignKey':_0xebe5('0x1d9'),'as':_0xebe5('0x1da')});db[_0xebe5('0xee')]['belongsTo'](db[_0xebe5('0x10')],{'foreignKey':'FromUserId','as':_0xebe5('0x1db')});db['MailTransferReport'][_0xebe5('0x126')](db[_0xebe5('0x10')],{'foreignKey':'ToUserId','as':_0xebe5('0x1dc')});db[_0xebe5('0xee')][_0xebe5('0x126')](db['MailQueue'],{'foreignKey':_0xebe5('0x1dd'),'as':'ToQueue'});db[_0xebe5('0xee')][_0xebe5('0x126')](db[_0xebe5('0x3d')],{'foreignKey':_0xebe5('0x1de'),'as':_0xebe5('0x1df')});db[_0xebe5('0xf0')]['belongsTo'](db['ChatMessage'],{});db['ChatTransferReport'][_0xebe5('0x126')](db[_0xebe5('0x6b')],{});db[_0xebe5('0xf0')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0xebe5('0x1e0'),'as':_0xebe5('0x1da')});db[_0xebe5('0xf0')][_0xebe5('0x126')](db['User'],{'foreignKey':_0xebe5('0x1e1'),'as':_0xebe5('0x1db')});db[_0xebe5('0xf0')][_0xebe5('0x126')](db[_0xebe5('0x10')],{'foreignKey':'ToUserId','as':_0xebe5('0x1dc')});db[_0xebe5('0xf0')][_0xebe5('0x126')](db[_0xebe5('0x6f')],{'foreignKey':'ToChatQueueId','as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db[_0xebe5('0x16e')],{'foreignKey':_0xebe5('0x1e2'),'as':'ToAccount'});db['FaxTransferReport'][_0xebe5('0x126')](db[_0xebe5('0x177')],{});db[_0xebe5('0x1e3')][_0xebe5('0x126')](db[_0xebe5('0x4d')],{});db[_0xebe5('0x1e3')][_0xebe5('0x126')](db[_0xebe5('0x4b')],{'foreignKey':_0xebe5('0x1e4'),'as':_0xebe5('0x1da')});db['FaxTransferReport']['belongsTo'](db[_0xebe5('0x10')],{'foreignKey':_0xebe5('0x1e1'),'as':'FromAgent'});db[_0xebe5('0x1e3')][_0xebe5('0x126')](db[_0xebe5('0x10')],{'foreignKey':_0xebe5('0x1e5'),'as':'ToAgent'});db[_0xebe5('0x1e3')][_0xebe5('0x126')](db[_0xebe5('0x50')],{'foreignKey':_0xebe5('0x1e6'),'as':'ToQueue'});db[_0xebe5('0x1e3')][_0xebe5('0x126')](db['FaxAccount'],{'foreignKey':_0xebe5('0x1e7'),'as':'ToAccount'});db[_0xebe5('0xf3')][_0xebe5('0x126')](db[_0xebe5('0x62')],{});db[_0xebe5('0xf3')][_0xebe5('0x126')](db[_0xebe5('0x61')],{});db[_0xebe5('0xf3')]['belongsTo'](db[_0xebe5('0x5e')],{'foreignKey':'FromOpenchannelAccountId','as':_0xebe5('0x1da')});db[_0xebe5('0xf3')][_0xebe5('0x126')](db[_0xebe5('0x10')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0xebe5('0xf3')][_0xebe5('0x126')](db['User'],{'foreignKey':_0xebe5('0x1e5'),'as':_0xebe5('0x1dc')});db['OpenchannelTransferReport']['belongsTo'](db[_0xebe5('0x64')],{'foreignKey':_0xebe5('0x1e8'),'as':_0xebe5('0x1e9')});db[_0xebe5('0xf3')]['belongsTo'](db[_0xebe5('0x5e')],{'foreignKey':_0xebe5('0x1ea'),'as':_0xebe5('0x1df')});db['SmsTransferReport'][_0xebe5('0x126')](db[_0xebe5('0x5a')],{});db[_0xebe5('0xf5')][_0xebe5('0x126')](db[_0xebe5('0x58')],{});db[_0xebe5('0xf5')]['belongsTo'](db[_0xebe5('0x54')],{'foreignKey':_0xebe5('0x1eb'),'as':_0xebe5('0x1da')});db[_0xebe5('0xf5')]['belongsTo'](db[_0xebe5('0x10')],{'foreignKey':_0xebe5('0x1e1'),'as':'FromAgent'});db[_0xebe5('0xf5')][_0xebe5('0x126')](db[_0xebe5('0x10')],{'foreignKey':'ToUserId','as':_0xebe5('0x1dc')});db[_0xebe5('0xf5')][_0xebe5('0x126')](db[_0xebe5('0x5c')],{'foreignKey':'ToSmsQueueId','as':_0xebe5('0x1e9')});db[_0xebe5('0xf5')][_0xebe5('0x126')](db[_0xebe5('0x54')],{'foreignKey':_0xebe5('0x1ec'),'as':_0xebe5('0x1df')});db[_0xebe5('0xf7')][_0xebe5('0x119')](db[_0xebe5('0x83')],{'as':_0xebe5('0x15d'),'foreignKey':_0xebe5('0x162'),'onDelete':'cascade'});db[_0xebe5('0xf7')][_0xebe5('0x119')](db['CmCustomField'],{'as':_0xebe5('0x1ed'),'foreignKey':_0xebe5('0x162')});db[_0xebe5('0xf7')][_0xebe5('0x119')](db['CmContact'],{'as':_0xebe5('0x18f'),'onDelete':_0xebe5('0x116'),'foreignKey':_0xebe5('0x162')});db['CmList'][_0xebe5('0x119')](db[_0xebe5('0x7a')],{'as':_0xebe5('0x11c'),'foreignKey':_0xebe5('0x162')});db[_0xebe5('0xf7')][_0xebe5('0x119')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0xebe5('0x162')});db[_0xebe5('0xf7')][_0xebe5('0x119')](db[_0xebe5('0x11e')],{'as':'ReportAgentPreview','foreignKey':'ListId'});db[_0xebe5('0xf7')][_0xebe5('0x128')](db[_0xebe5('0x18')],{'as':'Queues','through':_0xebe5('0x150')});db[_0xebe5('0xf7')]['belongsToMany'](db[_0xebe5('0x10')],{'as':_0xebe5('0x151'),'through':'cm_user_has_lists'});db[_0xebe5('0x132')]['hasMany'](db['VoiceExtension'],{'as':_0xebe5('0x1a0'),'onDelete':_0xebe5('0x116')});db[_0xebe5('0x132')]['belongsToMany'](db[_0xebe5('0x10')],{'as':_0xebe5('0x151'),'through':_0xebe5('0x111')});db['VoicePrefix']['belongsToMany'](db[_0xebe5('0xe5')],{'through':'TeamVoicePrefix','as':_0xebe5('0x152')});db['UserProfile'][_0xebe5('0x119')](db[_0xebe5('0x10')],{'as':_0xebe5('0x169'),'foreignKey':_0xebe5('0x127')});db[_0xebe5('0xf8')][_0xebe5('0x119')](db['UserProfileSection'],{'as':'UserProfileSections','foreignKey':_0xebe5('0x127'),'onDelete':'cascade'});db[_0xebe5('0xfa')][_0xebe5('0x119')](db[_0xebe5('0xfc')],{'as':_0xebe5('0x1ee'),'foreignKey':_0xebe5('0x1ef'),'onDelete':_0xebe5('0x116')});db[_0xebe5('0xff')]['hasMany'](db[_0xebe5('0x83')],{'as':_0xebe5('0x15d'),'foreignKey':'WhatsappAccountId','onDelete':_0xebe5('0x116')});db['WhatsappAccount']['hasMany'](db[_0xebe5('0x81')],{'as':_0xebe5('0x15e'),'foreignKey':_0xebe5('0x1f0')});db[_0xebe5('0xff')][_0xebe5('0x119')](db[_0xebe5('0x103')],{'as':_0xebe5('0x155'),'foreignKey':_0xebe5('0x1f0')});db[_0xebe5('0xff')][_0xebe5('0x119')](db[_0xebe5('0x101')],{'as':_0xebe5('0x160')});db[_0xebe5('0xff')][_0xebe5('0x119')](db[_0xebe5('0x1f1')],{'as':'Applications'});db[_0xebe5('0xff')][_0xebe5('0x126')](db['CmList'],{'as':_0xebe5('0x161'),'foreignKey':_0xebe5('0x162')});db[_0xebe5('0xff')][_0xebe5('0x126')](db[_0xebe5('0x87')],{'as':_0xebe5('0x14f'),'foreignKey':_0xebe5('0x17e')});db[_0xebe5('0xff')][_0xebe5('0x128')](db[_0xebe5('0x10')],{'as':'Agents','through':_0xebe5('0x141')});db[_0xebe5('0x1f1')]['belongsTo'](db[_0xebe5('0x10')],{'onDelete':_0xebe5('0x171')});db[_0xebe5('0x1f1')]['belongsTo'](db[_0xebe5('0x109')],{'onDelete':_0xebe5('0x171')});db[_0xebe5('0x1f1')][_0xebe5('0x126')](db['WhatsappAccount'],{'onDelete':_0xebe5('0x171')});db['WhatsappApplication']['belongsTo'](db['Interval'],{'onDelete':_0xebe5('0x171'),'foreignKey':_0xebe5('0x17f')});db[_0xebe5('0x1f1')][_0xebe5('0x126')](db[_0xebe5('0x8e')],{'onDelete':'restrict','foreignKey':_0xebe5('0x172')});db[_0xebe5('0x101')][_0xebe5('0x119')](db[_0xebe5('0x103')],{'as':_0xebe5('0x155'),'onDelete':'cascade','foreignKey':'WhatsappInteractionId'});db['WhatsappInteraction'][_0xebe5('0x126')](db[_0xebe5('0xff')],{'as':_0xebe5('0x16d'),'foreignKey':_0xebe5('0x1f0')});db[_0xebe5('0x101')]['belongsTo'](db[_0xebe5('0x74')],{'as':_0xebe5('0x158'),'foreignKey':_0xebe5('0x159')});db[_0xebe5('0x101')][_0xebe5('0x126')](db[_0xebe5('0x10')],{'as':_0xebe5('0x165'),'foreignKey':'UserId'});db[_0xebe5('0x101')][_0xebe5('0x128')](db[_0xebe5('0x8e')],{'through':_0xebe5('0x1a9'),'as':_0xebe5('0x167')});db[_0xebe5('0x101')]['belongsToMany'](db['Tag'],{'through':_0xebe5('0x1a9'),'as':'ThroughTags'});db[_0xebe5('0x101')][_0xebe5('0x128')](db[_0xebe5('0x10')],{'as':_0xebe5('0x169'),'through':_0xebe5('0x12f'),'foreignKey':_0xebe5('0x1f2')});db[_0xebe5('0x103')][_0xebe5('0x126')](db[_0xebe5('0x10')],{'as':_0xebe5('0x10')});db['WhatsappMessage'][_0xebe5('0x126')](db[_0xebe5('0x74')],{'onDelete':_0xebe5('0x116'),'as':_0xebe5('0x158')});db['WhatsappMessage']['belongsTo'](db['WhatsappInteraction'],{'onDelete':_0xebe5('0x116'),'as':_0xebe5('0x16c'),'foreignKey':_0xebe5('0x1f2')});db[_0xebe5('0x103')][_0xebe5('0x126')](db[_0xebe5('0xff')],{'as':_0xebe5('0x16d'),'foreignKey':_0xebe5('0x1f0')});db['WhatsappQueueReport'][_0xebe5('0x126')](db[_0xebe5('0xff')],{});db[_0xebe5('0x105')][_0xebe5('0x126')](db['CmList'],{'as':_0xebe5('0x161'),'foreignKey':'ListId'});db[_0xebe5('0x105')][_0xebe5('0x126')](db[_0xebe5('0x74')],{'as':'Contact','foreignKey':_0xebe5('0x159')});db[_0xebe5('0x105')]['belongsTo'](db[_0xebe5('0x101')],{});db[_0xebe5('0x105')][_0xebe5('0x126')](db['WhatsappQueue'],{});db[_0xebe5('0x105')][_0xebe5('0x126')](db[_0xebe5('0x103')],{});db[_0xebe5('0x105')]['belongsTo'](db[_0xebe5('0x10')],{});db['WhatsappTransferReport']['belongsTo'](db[_0xebe5('0x103')],{});db[_0xebe5('0x107')]['belongsTo'](db[_0xebe5('0x101')],{});db['WhatsappTransferReport'][_0xebe5('0x126')](db[_0xebe5('0xff')],{'foreignKey':_0xebe5('0x1f3'),'as':_0xebe5('0x1da')});db[_0xebe5('0x107')][_0xebe5('0x126')](db[_0xebe5('0xff')],{'foreignKey':'ToWhatsappAccountId','as':_0xebe5('0x1df')});db[_0xebe5('0x107')]['belongsTo'](db[_0xebe5('0x109')],{'foreignKey':_0xebe5('0x1f4'),'as':'ToQueue'});db[_0xebe5('0x107')][_0xebe5('0x126')](db[_0xebe5('0x10')],{'foreignKey':_0xebe5('0x1e1'),'as':_0xebe5('0x1db')});db[_0xebe5('0x107')]['belongsTo'](db['User'],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xebe5('0x109')][_0xebe5('0x128')](db['User'],{'as':_0xebe5('0x151'),'through':_0xebe5('0x37'),'foreignKey':_0xebe5('0x1f5')});db['WhatsappQueue'][_0xebe5('0x128')](db['Team'],{'through':'team_has_whatsapp_queues','as':_0xebe5('0x152')});db['UserSetting']['belongsTo'](db[_0xebe5('0x10')],{'as':_0xebe5('0x1f6'),'foreignKey':_0xebe5('0x117'),'onDelete':_0xebe5('0x116'),'hooks':!![]});db['CloudProvider']['hasOne'](db[_0xebe5('0xc9')],{'as':'Dynamics365Account','onDelete':'restrict'});db[_0xebe5('0x10b')][_0xebe5('0x115')](db['MailServerIn'],{'as':_0xebe5('0x1f7'),'onDelete':_0xebe5('0x171')});db['CloudProvider'][_0xebe5('0x115')](db[_0xebe5('0x3b')],{'as':'Smtp','onDelete':_0xebe5('0x171')});module[_0xebe5('0x1f8')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x3c57=['../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','SquareProject','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','../api/team/team.model','License','../api/license/license.model','Campaign','Migration','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','UserVoicePrefix','UserSetting','../api/user-setting/user-setting.model','User','hasOne','cascade','UserId','userSetting','hasMany','Recordings','VoiceQueuesRt','Extensions','HopperHistory','ReportAgentPreview','OpenchannelInteraction','ChatInteraction','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotification','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','OpenchannelInteractions','UserVoiceQueue','VoicePrefixes','MailQueue','MailQueues','ChatQueue','SmsQueue','UserSmsQueue','OpenchannelQueues','WhatsappQueue','WhatsappQueues','ChatWebsites','user_has_chat_websites','MailAccounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','IntervalId','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','Team','BlackLists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','VoiceAgentReport','Contact','MailAccountId','restrict','CloudProviderId','Imap','Smtp','Disposition','Interactions','List','ListId','Template','TemplateId','mandatoryDispositionPause','user_has_mail_accounts','team_has_mail_queues','Teams','MailInteractionId','Account','ContactId','Owner','mail_interaction_has_tags','ThroughTags','Users','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','TagId','Dashboard','DashboardItem','Items','Dispositions','FaxAccountId','Exntensions','user_has_fax_accounts','FaxInteractionId','fax_interaction_has_tags','Attachment','AttachmentId','team_has_fax_queues','SmsAccountId','Answers','SmsApplication','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelInteractionId','openchannel_interaction_has_tags','Tags','user_has_openchannel_interactions','OpenchannelQueueId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','ChatMessage','ChatApplication','Agent','Website','ChatInteractionId','chat_interaction_has_tags','ChatInternalMessage','ChatGroupId','CompanyId','Phones','CmContactId','HopperFinals','HopperHistories','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','Queue','OwnerId','CampaignId','All','OneAll','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','MailApplications','FaxApplications','DefaultReportId','AnalyticCustomReport','CustomReportId','Sound','Mohs','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','AnyConditions','AnyCondition','TriggerId','Fields','AnalyticDefaultReport','AnalyticMetric','MetricId','Configurations','AccountId','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','Field','VariableId','SugarcrmConfiguration','DeskAccount','DeskConfiguration','Subjects','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','ServicenowAccount','ServicenowField','Dynamics365Field','FreshsalesAccount','FreshsalesConfiguration','ToId','SessionId','JscriptyAnswerReport','TeamVoiceQueue','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','team_has_whatsapp_queues','TrunkBackupId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','ToUserId','ToMailQueueId','ToMailAccountId','FromChatWebsiteId','FromAgent','ToAgent','ToChatQueueId','ToQueue','ToChatWebsiteId','ToAccount','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','UserProfileSection','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappMessage','user_has_whatsapp_accounts','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','../config/environment','lodash','jstz','determine','sequelize','defaultsDeep','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','xcall','database','username','options','password','import','VoiceChanSpy','VoiceContext','VoiceExtension','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','MailQueueReport','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','FaxQueueReport','SmsAccount','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','OpenchannelQueueReport','../api/chatApplication/chatApplication.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatGroup','../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','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','Cdr','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','Tag','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticFieldReport','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport'];(function(_0x56c1a0,_0x7571b3){var _0x117b25=function(_0xfbf26c){while(--_0xfbf26c){_0x56c1a0['push'](_0x56c1a0['shift']());}};_0x117b25(++_0x7571b3);}(_0x3c57,0x135));var _0x73c5=function(_0x1eca92,_0x4f3ae8){_0x1eca92=_0x1eca92-0x0;var _0x1c0d56=_0x3c57[_0x1eca92];return _0x1c0d56;};'use strict';var config=require(_0x73c5('0x0'));var Sequelize=require('sequelize');var _=require(_0x73c5('0x1'));var jstz=require(_0x73c5('0x2'));var timezone=jstz[_0x73c5('0x3')]();config[_0x73c5('0x4')]=_[_0x73c5('0x5')](config[_0x73c5('0x4')],{'database':'motion2','username':'xcall','password':_0x73c5('0x6'),'options':{'host':_0x73c5('0x7'),'port':0xcea,'dialect':_0x73c5('0x8'),'dialectOptions':{'charset':_0x73c5('0x9')},'logging':![],'timezone':timezone[_0x73c5('0xa')](),'define':{'charset':_0x73c5('0xb'),'collate':_0x73c5('0xc')}}});config[_0x73c5('0xd')]=_[_0x73c5('0x5')](config[_0x73c5('0xd')],{'database':'motion2','username':_0x73c5('0xe'),'password':_0x73c5('0x6'),'options':{'host':_0x73c5('0x7'),'port':0xcea,'dialect':_0x73c5('0x8'),'dialectOptions':{'charset':_0x73c5('0x9')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x73c5('0xb'),'collate':_0x73c5('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x73c5('0xf')],config[_0x73c5('0x4')][_0x73c5('0x10')],config[_0x73c5('0x4')]['password'],config['sequelize'][_0x73c5('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x73c5('0xd')][_0x73c5('0xf')],config[_0x73c5('0xd')][_0x73c5('0x10')],config[_0x73c5('0xd')][_0x73c5('0x12')],config[_0x73c5('0xd')]['options'])};db['User']=db[_0x73c5('0x4')][_0x73c5('0x13')]('../api/user/user.model');db[_0x73c5('0x14')]=db[_0x73c5('0x4')][_0x73c5('0x13')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x73c5('0x15')]=db[_0x73c5('0x4')]['import']('../api/voiceContext/voiceContext.model');db[_0x73c5('0x16')]=db[_0x73c5('0x4')][_0x73c5('0x13')]('../api/voiceExtension/voiceExtension.model');db[_0x73c5('0x17')]=db[_0x73c5('0x4')][_0x73c5('0x13')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x73c5('0x18')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0x19'));db[_0x73c5('0x1a')]=db['sequelize'][_0x73c5('0x13')](_0x73c5('0x1b'));db[_0x73c5('0x1c')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0x1d'));db[_0x73c5('0x1e')]=db[_0x73c5('0x4')][_0x73c5('0x13')]('../api/voiceMail/voiceMail.model');db[_0x73c5('0x1f')]=db['sequelize'][_0x73c5('0x13')](_0x73c5('0x20'));db[_0x73c5('0x21')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0x22'));db[_0x73c5('0x23')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0x24'));db['VoiceAgentReport']=db['sequelize'][_0x73c5('0x13')](_0x73c5('0x25'));db[_0x73c5('0x26')]=db[_0x73c5('0x4')]['import'](_0x73c5('0x27'));db[_0x73c5('0x28')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0x29'));db[_0x73c5('0x2a')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0x2b'));db[_0x73c5('0x2c')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0x2d'));db[_0x73c5('0x2e')]=db['sequelize'][_0x73c5('0x13')](_0x73c5('0x2f'));db['UserVoiceQueue']=db[_0x73c5('0x4')]['import'](_0x73c5('0x30'));db[_0x73c5('0x31')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0x32'));db[_0x73c5('0x33')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0x34'));db[_0x73c5('0x35')]=db[_0x73c5('0x4')][_0x73c5('0x13')]('../api/userFaxQueue/userFaxQueue.model');db['UserSmsQueue']=db['sequelize'][_0x73c5('0x13')]('../api/userSmsQueue/userSmsQueue.model');db[_0x73c5('0x36')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0x37'));db[_0x73c5('0x38')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0x39'));db[_0x73c5('0x3a')]=db['sequelize'][_0x73c5('0x13')](_0x73c5('0x3b'));db[_0x73c5('0x3c')]=db[_0x73c5('0x4')]['import'](_0x73c5('0x3d'));db[_0x73c5('0x3e')]=db[_0x73c5('0x4')]['import'](_0x73c5('0x3f'));db['MailQueue']=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0x40'));db['MailSubstatus']=db[_0x73c5('0x4')][_0x73c5('0x13')]('../api/mailSubstatus/mailSubstatus.model');db[_0x73c5('0x41')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0x42'));db[_0x73c5('0x43')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0x44'));db[_0x73c5('0x45')]=db['sequelize'][_0x73c5('0x13')]('../api/mailApplication/mailApplication.model');db[_0x73c5('0x46')]=db[_0x73c5('0x4')][_0x73c5('0x13')]('../api/mailQueueReport/mailQueueReport.model');db['Dashboard']=db['sequelize'][_0x73c5('0x13')](_0x73c5('0x47'));db['DashboardItem']=db['sequelize'][_0x73c5('0x13')](_0x73c5('0x48'));db[_0x73c5('0x49')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0x4a'));db[_0x73c5('0x4b')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0x4c'));db[_0x73c5('0x4d')]=db[_0x73c5('0x4')]['import'](_0x73c5('0x4e'));db[_0x73c5('0x4f')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0x50'));db[_0x73c5('0x51')]=db[_0x73c5('0x4')][_0x73c5('0x13')]('../api/faxQueue/faxQueue.model');db[_0x73c5('0x52')]=db[_0x73c5('0x4')][_0x73c5('0x13')]('../api/faxQueueReport/faxQueueReport.model');db[_0x73c5('0x53')]=db['sequelize']['import']('../api/smsAccount/smsAccount.model');db['SmsApplication']=db[_0x73c5('0x4')][_0x73c5('0x13')]('../api/smsApplication/smsApplication.model');db[_0x73c5('0x54')]=db['sequelize'][_0x73c5('0x13')](_0x73c5('0x55'));db[_0x73c5('0x56')]=db['sequelize']['import'](_0x73c5('0x57'));db['SmsQueue']=db['sequelize'][_0x73c5('0x13')](_0x73c5('0x58'));db[_0x73c5('0x59')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0x5a'));db[_0x73c5('0x5b')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0x5c'));db['OpenchannelInteraction']=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0x5d'));db[_0x73c5('0x5e')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0x5f'));db[_0x73c5('0x60')]=db['sequelize'][_0x73c5('0x13')](_0x73c5('0x61'));db[_0x73c5('0x62')]=db[_0x73c5('0x4')][_0x73c5('0x13')]('../api/chatWebsite/chatWebsite.model');db[_0x73c5('0x63')]=db[_0x73c5('0x4')][_0x73c5('0x13')]('../api/openchannelQueueReport/openchannelQueueReport.model');db['ChatApplication']=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0x64'));db['ChatInteraction']=db[_0x73c5('0x4')][_0x73c5('0x13')]('../api/chatInteraction/chatInteraction.model');db['ChatMessage']=db[_0x73c5('0x4')]['import'](_0x73c5('0x65'));db[_0x73c5('0x66')]=db[_0x73c5('0x4')]['import'](_0x73c5('0x67'));db['ChatQueue']=db['sequelize'][_0x73c5('0x13')]('../api/chatQueue/chatQueue.model');db[_0x73c5('0x68')]=db[_0x73c5('0x4')][_0x73c5('0x13')]('../api/chatGroup/chatGroup.model');db['ChatProactiveAction']=db['sequelize'][_0x73c5('0x13')](_0x73c5('0x69'));db[_0x73c5('0x6a')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0x6b'));db[_0x73c5('0x6c')]=db['sequelize'][_0x73c5('0x13')]('../api/cmContact/cmContact.model');db[_0x73c5('0x6d')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0x6e'));db[_0x73c5('0x6f')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0x70'));db[_0x73c5('0x71')]=db['sequelize']['import'](_0x73c5('0x72'));db[_0x73c5('0x73')]=db['sequelize'][_0x73c5('0x13')](_0x73c5('0x74'));db['ReportAgentPreview']=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0x75'));db[_0x73c5('0x76')]=db['sequelize'][_0x73c5('0x13')]('../api/cmCustomField/cmCustomField.model');db[_0x73c5('0x77')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0x78'));db[_0x73c5('0x79')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0x7a'));db[_0x73c5('0x7b')]=db[_0x73c5('0x4')][_0x73c5('0x13')]('../api/cannedAnswer/cannedAnswer.model');db['Disposition']=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0x7c'));db[_0x73c5('0x7d')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0x7e'));db[_0x73c5('0x7f')]=db[_0x73c5('0x4')]['import'](_0x73c5('0x80'));db[_0x73c5('0x81')]=db[_0x73c5('0x4')][_0x73c5('0x13')]('../api/pause/pause.model');db[_0x73c5('0x82')]=db[_0x73c5('0x4')][_0x73c5('0x13')]('../api/cdr/cdr.model');db[_0x73c5('0x83')]=db[_0x73c5('0x4')]['import'](_0x73c5('0x84'));db[_0x73c5('0x85')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0x86'));db['Sound']=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0x87'));db[_0x73c5('0x88')]=db[_0x73c5('0x4')][_0x73c5('0x13')]('../api/tag/tag.model');db[_0x73c5('0x89')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0x8a'));db[_0x73c5('0x8b')]=db[_0x73c5('0x4')]['import'](_0x73c5('0x8c'));db[_0x73c5('0x8d')]=db[_0x73c5('0x4')]['import'](_0x73c5('0x8e'));db['Template']=db['sequelize']['import'](_0x73c5('0x8f'));db[_0x73c5('0x90')]=db['sequelize'][_0x73c5('0x13')](_0x73c5('0x91'));db[_0x73c5('0x92')]=db['sequelize'][_0x73c5('0x13')](_0x73c5('0x93'));db['Integration']=db['sequelize'][_0x73c5('0x13')](_0x73c5('0x94'));db[_0x73c5('0x95')]=db['sequelize'][_0x73c5('0x13')](_0x73c5('0x96'));db['AnalyticCustomReport']=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0x97'));db['AnalyticDefaultReport']=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0x98'));db[_0x73c5('0x99')]=db[_0x73c5('0x4')]['import'](_0x73c5('0x9a'));db['AnalyticMetric']=db[_0x73c5('0x4')][_0x73c5('0x13')]('../api/analyticMetric/analyticMetric.model');db[_0x73c5('0x9b')]=db['sequelize'][_0x73c5('0x13')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0x73c5('0x9c')]=db[_0x73c5('0x4')]['import'](_0x73c5('0x9d'));db[_0x73c5('0x9e')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0x9f'));db[_0x73c5('0xa0')]=db['sequelize'][_0x73c5('0x13')](_0x73c5('0xa1'));db[_0x73c5('0xa2')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0xa3'));db[_0x73c5('0xa4')]=db[_0x73c5('0x4')]['import'](_0x73c5('0xa5'));db['SugarcrmConfiguration']=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0xa6'));db[_0x73c5('0xa7')]=db[_0x73c5('0x4')]['import'](_0x73c5('0xa8'));db['DeskAccount']=db[_0x73c5('0x4')]['import']('../api/intDeskAccount/intDeskAccount.model');db['DeskConfiguration']=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0xa9'));db[_0x73c5('0xaa')]=db['sequelize']['import'](_0x73c5('0xab'));db[_0x73c5('0xac')]=db[_0x73c5('0x4')][_0x73c5('0x13')]('../api/intZohoAccount/intZohoAccount.model');db[_0x73c5('0xad')]=db['sequelize'][_0x73c5('0x13')](_0x73c5('0xae'));db[_0x73c5('0xaf')]=db[_0x73c5('0x4')]['import'](_0x73c5('0xb0'));db[_0x73c5('0xb1')]=db[_0x73c5('0x4')][_0x73c5('0x13')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0x73c5('0xb2')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0xb3'));db[_0x73c5('0xb4')]=db[_0x73c5('0x4')][_0x73c5('0x13')]('../api/intZendeskField/intZendeskField.model');db[_0x73c5('0xb5')]=db[_0x73c5('0x4')]['import'](_0x73c5('0xb6'));db['FreshdeskConfiguration']=db[_0x73c5('0x4')]['import']('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x73c5('0xb7')]=db[_0x73c5('0x4')]['import'](_0x73c5('0xb8'));db[_0x73c5('0xb9')]=db['sequelize'][_0x73c5('0x13')](_0x73c5('0xba'));db[_0x73c5('0xbb')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0xbc'));db[_0x73c5('0xbd')]=db['sequelize'][_0x73c5('0x13')](_0x73c5('0xbe'));db['ServicenowAccount']=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0xbf'));db[_0x73c5('0xc0')]=db[_0x73c5('0x4')][_0x73c5('0x13')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db['ServicenowField']=db[_0x73c5('0x4')]['import']('../api/intServicenowField/intServicenowField.model');db[_0x73c5('0xc1')]=db['sequelize'][_0x73c5('0x13')](_0x73c5('0xc2'));db[_0x73c5('0xc3')]=db[_0x73c5('0x4')]['import'](_0x73c5('0xc4'));db['Dynamics365Field']=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0xc5'));db['FreshsalesAccount']=db[_0x73c5('0x4')]['import']('../api/intFreshsalesAccount/intFreshsalesAccount.model');db['FreshsalesConfiguration']=db['sequelize'][_0x73c5('0x13')](_0x73c5('0xc6'));db[_0x73c5('0xc7')]=db['sequelize'][_0x73c5('0x13')](_0x73c5('0xc8'));db['Integration']=db[_0x73c5('0x4')]['import'](_0x73c5('0x94'));db[_0x73c5('0xc9')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0xca'));db[_0x73c5('0xcb')]=db[_0x73c5('0x4')]['import'](_0x73c5('0xcc'));db['ChatInternalMessage']=db['sequelize'][_0x73c5('0x13')]('../api/chatInternalMessage/chatInternalMessage.model');db['JscriptyAnswerReport']=db[_0x73c5('0x4')]['import'](_0x73c5('0xcd'));db[_0x73c5('0xce')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0xcf'));db[_0x73c5('0xd0')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0xd1'));db[_0x73c5('0xd2')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0xd3'));db['SquareReport']=db[_0x73c5('0x4')]['import'](_0x73c5('0xd4'));db[_0x73c5('0xd5')]=db['sequelize'][_0x73c5('0x13')]('../api/squareReportDetail/squareReportDetail.model');db[_0x73c5('0xd6')]=db[_0x73c5('0x4')]['import'](_0x73c5('0xd7'));db[_0x73c5('0xd8')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0xd9'));db[_0x73c5('0xda')]=db[_0x73c5('0x4')]['import']('../api/squareOdbc/squareOdbc.model');db[_0x73c5('0xdb')]=db['sequelize']['import'](_0x73c5('0xdc'));db[_0x73c5('0xdd')]=db[_0x73c5('0x4')][_0x73c5('0x13')]('../api/squareRecording/squareRecording.model');db[_0x73c5('0xde')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0xdf'));db['Team']=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0xe0'));db[_0x73c5('0xe1')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0xe2'));db[_0x73c5('0xe3')]=db[_0x73c5('0x4')][_0x73c5('0x13')]('../api/campaign/campaign.model');db[_0x73c5('0xe4')]=db['sequelize']['import'](_0x73c5('0xe5'));db['Attachment']=db[_0x73c5('0x4')]['import'](_0x73c5('0xe6'));db[_0x73c5('0xe7')]=db['sequelize'][_0x73c5('0x13')](_0x73c5('0xe8'));db[_0x73c5('0xe9')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0xea'));db[_0x73c5('0xeb')]=db['sequelize'][_0x73c5('0x13')](_0x73c5('0xec'));db[_0x73c5('0xed')]=db[_0x73c5('0x4')][_0x73c5('0x13')]('../api/faxTransferReport/faxTransferReport.model');db['OpenchannelTransferReport']=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0xee'));db[_0x73c5('0xef')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0xf0'));db[_0x73c5('0xf1')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0xf2'));db[_0x73c5('0xf3')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0xf4'));db[_0x73c5('0xf5')]=db['sequelize'][_0x73c5('0x13')]('../api/userProfile/userProfile.model');db['UserProfileSection']=db['sequelize'][_0x73c5('0x13')](_0x73c5('0xf6'));db[_0x73c5('0xf7')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0xf8'));db['UserNotification']=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0xf9'));db[_0x73c5('0xfa')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0xfb'));db[_0x73c5('0xfc')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0xfd'));db[_0x73c5('0xfe')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0xff'));db['WhatsappMessage']=db[_0x73c5('0x4')]['import'](_0x73c5('0x100'));db[_0x73c5('0x101')]=db['sequelize']['import'](_0x73c5('0x102'));db['WhatsappTransferReport']=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0x103'));db['WhatsappQueue']=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0x104'));db[_0x73c5('0x105')]=db[_0x73c5('0x4')][_0x73c5('0x13')](_0x73c5('0x106'));db['TeamVoiceQueue']=db[_0x73c5('0x4')]['import'](_0x73c5('0x107'));db[_0x73c5('0x108')]=db[_0x73c5('0x4')][_0x73c5('0x13')]('../api/teamVoicePrefix/teamVoicePrefix.model');db[_0x73c5('0x109')]=db[_0x73c5('0x4')][_0x73c5('0x13')]('../api/userVoicePrefix/userVoicePrefix.model');db[_0x73c5('0x10a')]=db[_0x73c5('0x4')]['import'](_0x73c5('0x10b'));db[_0x73c5('0x10c')][_0x73c5('0x10d')](db['VoiceMail'],{'as':'VoiceMail','onDelete':_0x73c5('0x10e'),'foreignKey':_0x73c5('0x10f')});db[_0x73c5('0x10c')][_0x73c5('0x10d')](db[_0x73c5('0x10a')],{'as':_0x73c5('0x110'),'onDelete':_0x73c5('0x10e'),'foreignKey':'UserId'});db[_0x73c5('0x10c')][_0x73c5('0x111')](db[_0x73c5('0x1a')],{'as':_0x73c5('0x112'),'foreignKey':'UserId'});db['User'][_0x73c5('0x111')](db['UserVoiceQueueRt'],{'as':_0x73c5('0x113'),'foreignKey':_0x73c5('0x10f')});db[_0x73c5('0x10c')][_0x73c5('0x111')](db[_0x73c5('0x16')],{'as':_0x73c5('0x114'),'onDelete':_0x73c5('0x10e'),'hooks':!![]});db[_0x73c5('0x10c')]['hasMany'](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x73c5('0x10f')});db[_0x73c5('0x10c')]['hasMany'](db[_0x73c5('0x73')],{'as':_0x73c5('0x115'),'foreignKey':_0x73c5('0x10f')});db[_0x73c5('0x10c')][_0x73c5('0x111')](db[_0x73c5('0x116')],{'as':'ReportAgentPreview','foreignKey':_0x73c5('0x10f')});db[_0x73c5('0x10c')]['hasMany'](db[_0x73c5('0x117')],{'as':'OpenchannelInteractions','foreignKey':_0x73c5('0x10f')});db['User'][_0x73c5('0x111')](db[_0x73c5('0x118')],{'as':_0x73c5('0x119'),'foreignKey':'UserId'});db[_0x73c5('0x10c')][_0x73c5('0x111')](db[_0x73c5('0x54')],{'as':_0x73c5('0x11a'),'foreignKey':'UserId'});db[_0x73c5('0x10c')][_0x73c5('0x111')](db[_0x73c5('0x4d')],{'as':_0x73c5('0x11b'),'foreignKey':_0x73c5('0x10f')});db[_0x73c5('0x10c')]['hasMany'](db['MailInteraction'],{'as':_0x73c5('0x11c'),'foreignKey':_0x73c5('0x10f')});db['User'][_0x73c5('0x111')](db[_0x73c5('0xfe')],{'as':_0x73c5('0x11d'),'foreignKey':_0x73c5('0x10f')});db['User'][_0x73c5('0x111')](db[_0x73c5('0x11e')],{'as':_0x73c5('0x11f'),'foreignKey':_0x73c5('0x120')});db[_0x73c5('0x10c')][_0x73c5('0x121')](db[_0x73c5('0xf5')],{'as':_0x73c5('0xf5'),'foreignKey':_0x73c5('0x122')});db[_0x73c5('0x10c')][_0x73c5('0x123')](db[_0x73c5('0x68')],{'as':_0x73c5('0x124'),'through':_0x73c5('0x125')});db[_0x73c5('0x10c')][_0x73c5('0x123')](db[_0x73c5('0x6c')],{'as':_0x73c5('0x126'),'through':'cm_user_has_contacts'});db[_0x73c5('0x10c')]['belongsToMany'](db[_0x73c5('0xf1')],{'as':'Lists','through':_0x73c5('0x127')});db[_0x73c5('0x10c')][_0x73c5('0x123')](db['Team'],{'through':_0x73c5('0x128')});db[_0x73c5('0x10c')][_0x73c5('0x123')](db[_0x73c5('0x41')],{'as':'MailInteractions','through':_0x73c5('0x129')});db['User'][_0x73c5('0x123')](db[_0x73c5('0x118')],{'as':_0x73c5('0x119'),'through':_0x73c5('0x12a')});db[_0x73c5('0x10c')]['belongsToMany'](db['FaxInteraction'],{'as':_0x73c5('0x11b'),'through':_0x73c5('0x12b')});db[_0x73c5('0x10c')][_0x73c5('0x123')](db[_0x73c5('0x54')],{'as':_0x73c5('0x11a'),'through':_0x73c5('0x12c')});db['User'][_0x73c5('0x123')](db[_0x73c5('0x117')],{'as':_0x73c5('0x12d'),'through':'user_has_openchannel_interactions'});db[_0x73c5('0x10c')][_0x73c5('0x123')](db[_0x73c5('0xfe')],{'as':_0x73c5('0x11d'),'through':'user_has_whatsapp_interactions'});db[_0x73c5('0x10c')][_0x73c5('0x123')](db[_0x73c5('0x18')],{'as':'VoiceQueues','through':_0x73c5('0x12e'),'required':![]});db['User'][_0x73c5('0x123')](db['VoicePrefix'],{'as':_0x73c5('0x12f'),'through':_0x73c5('0x109'),'required':![]});db[_0x73c5('0x10c')]['belongsToMany'](db[_0x73c5('0x130')],{'as':_0x73c5('0x131'),'through':_0x73c5('0x33'),'required':![]});db['User'][_0x73c5('0x123')](db[_0x73c5('0x132')],{'as':'ChatQueues','through':'UserChatQueue','required':![],'hooks':!![]});db[_0x73c5('0x10c')]['belongsToMany'](db['FaxQueue'],{'as':'FaxQueues','through':_0x73c5('0x35'),'required':![]});db[_0x73c5('0x10c')][_0x73c5('0x123')](db[_0x73c5('0x133')],{'as':'SmsQueues','through':_0x73c5('0x134'),'required':![]});db[_0x73c5('0x10c')]['belongsToMany'](db[_0x73c5('0x60')],{'as':_0x73c5('0x135'),'through':_0x73c5('0x36'),'required':![]});db[_0x73c5('0x10c')][_0x73c5('0x123')](db[_0x73c5('0x136')],{'as':_0x73c5('0x137'),'through':'UserWhatsappQueue','required':![]});db['User'][_0x73c5('0x123')](db[_0x73c5('0xf1')],{'through':'cm_user_has_lists'});db[_0x73c5('0x10c')][_0x73c5('0x123')](db[_0x73c5('0x62')],{'as':_0x73c5('0x138'),'through':_0x73c5('0x139')});db[_0x73c5('0x10c')][_0x73c5('0x123')](db[_0x73c5('0x49')],{'as':'FaxAccounts','through':'user_has_fax_accounts'});db[_0x73c5('0x10c')][_0x73c5('0x123')](db[_0x73c5('0x3e')],{'as':_0x73c5('0x13a'),'through':'user_has_mail_accounts'});db['User'][_0x73c5('0x123')](db[_0x73c5('0x59')],{'as':_0x73c5('0x13b'),'through':_0x73c5('0x13c')});db['User'][_0x73c5('0x123')](db['SmsAccount'],{'as':_0x73c5('0x13d'),'through':_0x73c5('0x13e')});db[_0x73c5('0x10c')][_0x73c5('0x123')](db['WhatsappAccount'],{'as':'WhatsappAccounts','through':'user_has_whatsapp_accounts'});db['User']['belongsToMany'](db['SquareProject'],{'as':_0x73c5('0x13f'),'through':_0x73c5('0x140')});db['VoiceChanSpy'][_0x73c5('0x111')](db['VoiceExtension'],{'as':_0x73c5('0x141'),'onDelete':_0x73c5('0x10e'),'foreignKey':_0x73c5('0x142')});db['VoiceContext'][_0x73c5('0x111')](db[_0x73c5('0x16')],{'onDelete':_0x73c5('0x10e')});db[_0x73c5('0x16')][_0x73c5('0x111')](db['VoiceExtension'],{'as':_0x73c5('0x143'),'onDelete':_0x73c5('0x10e')});db[_0x73c5('0x17')][_0x73c5('0x123')](db['Sound'],{'as':_0x73c5('0x144'),'through':_0x73c5('0x145')});db['VoiceQueue']['hasMany'](db[_0x73c5('0x2e')],{'as':_0x73c5('0x146'),'foreignKey':_0x73c5('0x147')});db[_0x73c5('0x18')]['hasMany'](db['CmHopper'],{'as':_0x73c5('0x148'),'foreignKey':_0x73c5('0x147')});db[_0x73c5('0x18')][_0x73c5('0x111')](db[_0x73c5('0x71')],{'as':'HopperFinals','foreignKey':_0x73c5('0x147')});db[_0x73c5('0x18')][_0x73c5('0x111')](db[_0x73c5('0x73')],{'as':'HopperHistories','foreignKey':_0x73c5('0x147')});db[_0x73c5('0x18')][_0x73c5('0x111')](db['ReportAgentPreview'],{'as':_0x73c5('0x116'),'foreignKey':_0x73c5('0x147')});db['VoiceQueue'][_0x73c5('0x111')](db[_0x73c5('0x6f')],{'as':_0x73c5('0x149'),'foreignKey':'VoiceQueueId'});db[_0x73c5('0x18')][_0x73c5('0x111')](db[_0x73c5('0xd0')],{'as':_0x73c5('0x14a'),'foreignKey':_0x73c5('0x147')});db[_0x73c5('0x18')][_0x73c5('0x121')](db[_0x73c5('0x2a')],{'as':_0x73c5('0x2a'),'foreignKey':_0x73c5('0x14b')});db['VoiceQueue'][_0x73c5('0x121')](db[_0x73c5('0x2a')],{'as':_0x73c5('0x14c'),'foreignKey':'TrunkBackupId'});db[_0x73c5('0x18')]['belongsTo'](db[_0x73c5('0x7f')],{'as':_0x73c5('0x7f'),'foreignKey':_0x73c5('0x14d')});db[_0x73c5('0x18')]['belongsTo'](db[_0x73c5('0x81')],{'as':'mandatoryDispositionPause','foreignKey':_0x73c5('0x14e')});db['VoiceQueue'][_0x73c5('0x123')](db[_0x73c5('0xf1')],{'as':_0x73c5('0x14f'),'through':_0x73c5('0x150')});db[_0x73c5('0x18')][_0x73c5('0x123')](db['User'],{'as':_0x73c5('0x151'),'through':_0x73c5('0x12e')});db[_0x73c5('0x18')]['belongsToMany'](db[_0x73c5('0x152')],{'as':'Teams','through':'TeamVoiceQueue'});db[_0x73c5('0x18')]['belongsToMany'](db[_0x73c5('0xf1')],{'as':_0x73c5('0x153'),'through':'voice_queues_has_cm_blacklists'});db[_0x73c5('0x1a')][_0x73c5('0x121')](db[_0x73c5('0x10c')],{'as':_0x73c5('0x10c'),'foreignKey':_0x73c5('0x10f')});db[_0x73c5('0x1c')][_0x73c5('0x121')](db['User'],{'as':_0x73c5('0x10c'),'foreignKey':_0x73c5('0x10f')});db[_0x73c5('0x1e')][_0x73c5('0x111')](db[_0x73c5('0x1f')],{'as':_0x73c5('0x154'),'onDelete':_0x73c5('0x10e'),'foreignKey':_0x73c5('0x155'),'sourceKey':_0x73c5('0x156')});db[_0x73c5('0x1f')]['belongsTo'](db[_0x73c5('0x1e')],{'foreignKey':'mailboxuser','targetKey':_0x73c5('0x156')});db[_0x73c5('0x21')]['hasMany'](db['VoiceQueueReport'],{'as':_0x73c5('0x157'),'foreignKey':_0x73c5('0x158'),'constraints':![]});db[_0x73c5('0x21')][_0x73c5('0x111')](db[_0x73c5('0x159')],{'as':'AgentReports','foreignKey':_0x73c5('0x158'),'constraints':![]});db['VoiceCallReport'][_0x73c5('0x121')](db[_0x73c5('0x10c')],{'as':_0x73c5('0x10c'),'foreignKey':_0x73c5('0x10f')});db[_0x73c5('0x21')][_0x73c5('0x121')](db[_0x73c5('0x6c')],{'as':_0x73c5('0x15a'),'foreignKey':'ContactId'});db[_0x73c5('0x3a')][_0x73c5('0x121')](db['MailAccount'],{'as':_0x73c5('0x3e'),'foreignKey':_0x73c5('0x15b')});db[_0x73c5('0x3a')]['belongsTo'](db[_0x73c5('0x105')],{'as':_0x73c5('0x105'),'foreignKey':'CloudProviderId','onDelete':_0x73c5('0x15c')});db['MailServerOut'][_0x73c5('0x121')](db[_0x73c5('0x3e')],{'as':_0x73c5('0x3e'),'foreignKey':_0x73c5('0x15b')});db[_0x73c5('0x3c')][_0x73c5('0x121')](db[_0x73c5('0x105')],{'as':_0x73c5('0x105'),'foreignKey':_0x73c5('0x15d'),'onDelete':_0x73c5('0x15c')});db[_0x73c5('0x3e')][_0x73c5('0x10d')](db[_0x73c5('0x3a')],{'as':_0x73c5('0x15e'),'onDelete':'cascade'});db[_0x73c5('0x3e')][_0x73c5('0x10d')](db[_0x73c5('0x3c')],{'as':_0x73c5('0x15f'),'onDelete':_0x73c5('0x10e')});db[_0x73c5('0x3e')]['hasMany'](db[_0x73c5('0x160')],{'as':'Dispositions','foreignKey':_0x73c5('0x15b'),'onDelete':_0x73c5('0x10e')});db[_0x73c5('0x3e')][_0x73c5('0x111')](db[_0x73c5('0x7b')],{'as':'Answers','foreignKey':_0x73c5('0x15b')});db['MailAccount'][_0x73c5('0x111')](db[_0x73c5('0x43')],{'as':'Messages','foreignKey':_0x73c5('0x15b')});db[_0x73c5('0x3e')][_0x73c5('0x111')](db['MailInteraction'],{'as':_0x73c5('0x161')});db[_0x73c5('0x3e')][_0x73c5('0x111')](db[_0x73c5('0x45')],{'as':'Applications'});db[_0x73c5('0x3e')]['belongsTo'](db['CmList'],{'as':_0x73c5('0x162'),'foreignKey':_0x73c5('0x163')});db[_0x73c5('0x3e')][_0x73c5('0x121')](db['Template'],{'as':_0x73c5('0x164'),'foreignKey':_0x73c5('0x165')});db[_0x73c5('0x3e')][_0x73c5('0x121')](db['Pause'],{'as':_0x73c5('0x166'),'foreignKey':_0x73c5('0x14e')});db[_0x73c5('0x3e')][_0x73c5('0x123')](db[_0x73c5('0x10c')],{'as':'Agents','through':_0x73c5('0x167')});db[_0x73c5('0x130')]['belongsToMany'](db[_0x73c5('0x10c')],{'as':'Agents','through':_0x73c5('0x33')});db[_0x73c5('0x130')][_0x73c5('0x123')](db['Team'],{'through':_0x73c5('0x168'),'as':_0x73c5('0x169')});db['MailInteraction'][_0x73c5('0x111')](db['MailMessage'],{'as':_0x73c5('0x154'),'onDelete':'cascade','foreignKey':_0x73c5('0x16a')});db['MailInteraction']['belongsTo'](db[_0x73c5('0x3e')],{'as':_0x73c5('0x16b'),'foreignKey':'MailAccountId'});db[_0x73c5('0x41')][_0x73c5('0x121')](db['CmContact'],{'as':_0x73c5('0x15a'),'foreignKey':_0x73c5('0x16c')});db[_0x73c5('0x41')]['belongsTo'](db[_0x73c5('0x10c')],{'as':_0x73c5('0x16d'),'foreignKey':'UserId'});db[_0x73c5('0x41')][_0x73c5('0x123')](db[_0x73c5('0x88')],{'through':_0x73c5('0x16e'),'as':'Tags'});db['MailInteraction'][_0x73c5('0x123')](db[_0x73c5('0x88')],{'through':_0x73c5('0x16e'),'as':_0x73c5('0x16f')});db[_0x73c5('0x41')]['belongsToMany'](db[_0x73c5('0x10c')],{'as':_0x73c5('0x170'),'through':_0x73c5('0x129'),'foreignKey':'MailInteractionId'});db[_0x73c5('0x43')]['hasMany'](db['Attachment'],{'as':_0x73c5('0x171'),'onDelete':_0x73c5('0x10e')});db['MailMessage'][_0x73c5('0x121')](db[_0x73c5('0x10c')],{'as':_0x73c5('0x10c')});db[_0x73c5('0x43')]['belongsTo'](db['CmContact'],{'onDelete':_0x73c5('0x10e'),'as':_0x73c5('0x15a')});db[_0x73c5('0x43')][_0x73c5('0x121')](db[_0x73c5('0x41')],{'as':_0x73c5('0x172'),'foreignKey':_0x73c5('0x16a')});db['MailMessage'][_0x73c5('0x121')](db['MailAccount'],{'as':_0x73c5('0x16b'),'foreignKey':_0x73c5('0x15b')});db[_0x73c5('0x43')][_0x73c5('0x121')](db['ChatWebsite'],{'as':_0x73c5('0x62'),'foreignKey':_0x73c5('0x173')});db[_0x73c5('0x43')]['belongsTo'](db['ChatOfflineMessage'],{'as':'ChatOfflineMessage','foreignKey':_0x73c5('0x174')});db[_0x73c5('0x45')][_0x73c5('0x121')](db[_0x73c5('0x10c')],{'onDelete':_0x73c5('0x15c')});db[_0x73c5('0x45')][_0x73c5('0x121')](db[_0x73c5('0x130')],{'onDelete':_0x73c5('0x15c')});db[_0x73c5('0x45')][_0x73c5('0x121')](db[_0x73c5('0x3e')],{'onDelete':_0x73c5('0x15c')});db['MailApplication'][_0x73c5('0x121')](db['Interval'],{'onDelete':_0x73c5('0x15c'),'foreignKey':_0x73c5('0x14d')});db['MailApplication'][_0x73c5('0x121')](db[_0x73c5('0x88')],{'onDelete':'restrict','foreignKey':_0x73c5('0x175')});db[_0x73c5('0x46')][_0x73c5('0x121')](db[_0x73c5('0x3e')],{});db[_0x73c5('0x46')][_0x73c5('0x121')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x73c5('0x46')]['belongsTo'](db[_0x73c5('0x6c')],{'as':_0x73c5('0x15a'),'foreignKey':_0x73c5('0x16c')});db['MailQueueReport'][_0x73c5('0x121')](db[_0x73c5('0x41')],{});db[_0x73c5('0x46')][_0x73c5('0x121')](db[_0x73c5('0x43')],{});db['MailQueueReport']['belongsTo'](db['User'],{});db['MailQueueReport'][_0x73c5('0x121')](db['MailQueue'],{});db[_0x73c5('0x176')][_0x73c5('0x111')](db[_0x73c5('0x177')],{'as':_0x73c5('0x178'),'onDelete':_0x73c5('0x10e')});db[_0x73c5('0x49')][_0x73c5('0x111')](db[_0x73c5('0x160')],{'as':_0x73c5('0x179'),'foreignKey':_0x73c5('0x17a'),'onDelete':'cascade'});db[_0x73c5('0x49')][_0x73c5('0x111')](db['CannedAnswer'],{'as':'Answers','foreignKey':'FaxAccountId'});db[_0x73c5('0x49')][_0x73c5('0x111')](db[_0x73c5('0x4d')],{'as':_0x73c5('0x161')});db[_0x73c5('0x49')][_0x73c5('0x111')](db['FaxApplication'],{'as':_0x73c5('0x143')});db[_0x73c5('0x49')][_0x73c5('0x111')](db['VoiceExtension'],{'as':_0x73c5('0x17b'),'onDelete':_0x73c5('0x10e')});db[_0x73c5('0x49')]['hasMany'](db[_0x73c5('0x4f')],{'as':_0x73c5('0x154')});db['FaxAccount'][_0x73c5('0x121')](db['Trunk'],{'as':_0x73c5('0x2a')});db[_0x73c5('0x49')][_0x73c5('0x121')](db['CmList'],{'as':'List','foreignKey':_0x73c5('0x163')});db[_0x73c5('0x49')]['belongsTo'](db[_0x73c5('0x81')],{'as':_0x73c5('0x166'),'foreignKey':'mandatoryDispositionPauseId'});db['FaxAccount']['belongsToMany'](db[_0x73c5('0x10c')],{'as':_0x73c5('0x151'),'through':_0x73c5('0x17c')});db[_0x73c5('0x4b')][_0x73c5('0x121')](db[_0x73c5('0x10c')],{'onDelete':'restrict'});db[_0x73c5('0x4b')][_0x73c5('0x121')](db[_0x73c5('0x51')],{'onDelete':_0x73c5('0x15c')});db[_0x73c5('0x4b')][_0x73c5('0x121')](db[_0x73c5('0x49')],{'onDelete':_0x73c5('0x15c')});db[_0x73c5('0x4b')][_0x73c5('0x121')](db[_0x73c5('0x88')],{'onDelete':_0x73c5('0x15c'),'foreignKey':_0x73c5('0x175')});db[_0x73c5('0x4d')][_0x73c5('0x111')](db[_0x73c5('0x4f')],{'as':_0x73c5('0x154'),'onDelete':_0x73c5('0x10e'),'foreignKey':_0x73c5('0x17d')});db['FaxInteraction'][_0x73c5('0x121')](db[_0x73c5('0x49')],{'as':'Account','foreignKey':_0x73c5('0x17a')});db[_0x73c5('0x4d')][_0x73c5('0x121')](db['CmContact'],{'as':_0x73c5('0x15a'),'foreignKey':_0x73c5('0x16c')});db['FaxInteraction']['belongsTo'](db[_0x73c5('0x10c')],{'as':_0x73c5('0x16d'),'foreignKey':'UserId'});db[_0x73c5('0x4d')][_0x73c5('0x123')](db[_0x73c5('0x88')],{'through':_0x73c5('0x17e'),'as':'Tags'});db[_0x73c5('0x4d')][_0x73c5('0x123')](db[_0x73c5('0x88')],{'through':_0x73c5('0x17e'),'as':_0x73c5('0x16f')});db[_0x73c5('0x4d')][_0x73c5('0x123')](db[_0x73c5('0x10c')],{'as':_0x73c5('0x170'),'through':'user_has_fax_interactions','foreignKey':_0x73c5('0x17d')});db['FaxMessage'][_0x73c5('0x121')](db[_0x73c5('0x10c')],{'onDelete':'cascade','as':_0x73c5('0x10c')});db[_0x73c5('0x4f')][_0x73c5('0x121')](db[_0x73c5('0x4d')],{'as':_0x73c5('0x172'),'foreignKey':_0x73c5('0x17d')});db['FaxMessage'][_0x73c5('0x121')](db[_0x73c5('0x6c')],{'onDelete':_0x73c5('0x10e'),'as':_0x73c5('0x15a')});db[_0x73c5('0x4f')][_0x73c5('0x121')](db[_0x73c5('0x17f')],{'as':_0x73c5('0x17f'),'foreignKey':_0x73c5('0x180')});db['FaxMessage'][_0x73c5('0x121')](db[_0x73c5('0x49')],{'as':_0x73c5('0x16b'),'foreignKey':_0x73c5('0x17a')});db['FaxQueue'][_0x73c5('0x123')](db[_0x73c5('0x10c')],{'as':_0x73c5('0x151'),'through':_0x73c5('0x35')});db[_0x73c5('0x51')]['belongsToMany'](db[_0x73c5('0x152')],{'through':_0x73c5('0x181'),'as':_0x73c5('0x169')});db[_0x73c5('0x52')][_0x73c5('0x121')](db[_0x73c5('0x49')],{});db[_0x73c5('0x52')][_0x73c5('0x121')](db[_0x73c5('0xf1')],{'as':_0x73c5('0x162'),'foreignKey':_0x73c5('0x163')});db[_0x73c5('0x52')]['belongsTo'](db[_0x73c5('0x6c')],{'as':'Contact','foreignKey':_0x73c5('0x16c')});db[_0x73c5('0x52')]['belongsTo'](db[_0x73c5('0x4d')],{});db[_0x73c5('0x52')][_0x73c5('0x121')](db['FaxMessage'],{});db['FaxQueueReport'][_0x73c5('0x121')](db[_0x73c5('0x10c')],{});db[_0x73c5('0x52')][_0x73c5('0x121')](db[_0x73c5('0x51')],{});db[_0x73c5('0x53')][_0x73c5('0x111')](db[_0x73c5('0x160')],{'as':_0x73c5('0x179'),'foreignKey':_0x73c5('0x182'),'onDelete':_0x73c5('0x10e')});db[_0x73c5('0x53')]['hasMany'](db['CannedAnswer'],{'as':_0x73c5('0x183'),'foreignKey':_0x73c5('0x182')});db[_0x73c5('0x53')]['hasMany'](db['SmsMessage'],{'as':_0x73c5('0x154'),'foreignKey':_0x73c5('0x182')});db[_0x73c5('0x53')][_0x73c5('0x111')](db[_0x73c5('0x54')],{'as':_0x73c5('0x161')});db['SmsAccount'][_0x73c5('0x111')](db['SmsApplication'],{'as':_0x73c5('0x143')});db[_0x73c5('0x53')][_0x73c5('0x121')](db[_0x73c5('0xf1')],{'as':_0x73c5('0x162'),'foreignKey':_0x73c5('0x163')});db[_0x73c5('0x53')][_0x73c5('0x121')](db[_0x73c5('0x81')],{'as':_0x73c5('0x166'),'foreignKey':_0x73c5('0x14e')});db[_0x73c5('0x53')][_0x73c5('0x123')](db[_0x73c5('0x10c')],{'as':_0x73c5('0x151'),'through':_0x73c5('0x13e')});db['SmsApplication'][_0x73c5('0x121')](db['User'],{'onDelete':_0x73c5('0x15c')});db[_0x73c5('0x184')][_0x73c5('0x121')](db[_0x73c5('0x133')],{'onDelete':'restrict'});db[_0x73c5('0x184')][_0x73c5('0x121')](db['SmsAccount'],{'onDelete':'restrict'});db['SmsApplication']['belongsTo'](db[_0x73c5('0x7f')],{'onDelete':_0x73c5('0x15c'),'foreignKey':_0x73c5('0x14d')});db['SmsApplication'][_0x73c5('0x121')](db[_0x73c5('0x88')],{'onDelete':_0x73c5('0x15c'),'foreignKey':_0x73c5('0x175')});db[_0x73c5('0x54')][_0x73c5('0x111')](db[_0x73c5('0x56')],{'as':_0x73c5('0x154'),'onDelete':_0x73c5('0x10e'),'foreignKey':_0x73c5('0x185')});db[_0x73c5('0x54')][_0x73c5('0x121')](db[_0x73c5('0x53')],{'as':'Account','foreignKey':'SmsAccountId'});db[_0x73c5('0x54')][_0x73c5('0x121')](db[_0x73c5('0x6c')],{'as':_0x73c5('0x15a'),'foreignKey':_0x73c5('0x16c')});db['SmsInteraction'][_0x73c5('0x121')](db[_0x73c5('0x10c')],{'as':_0x73c5('0x16d'),'foreignKey':_0x73c5('0x10f')});db[_0x73c5('0x54')]['belongsToMany'](db['Tag'],{'through':_0x73c5('0x186'),'as':'Tags'});db[_0x73c5('0x54')][_0x73c5('0x123')](db[_0x73c5('0x88')],{'through':_0x73c5('0x186'),'as':_0x73c5('0x16f')});db[_0x73c5('0x54')][_0x73c5('0x123')](db[_0x73c5('0x10c')],{'as':_0x73c5('0x170'),'through':_0x73c5('0x12c'),'foreignKey':'SmsInteractionId'});db['SmsMessage']['belongsTo'](db[_0x73c5('0x10c')],{'as':_0x73c5('0x10c')});db[_0x73c5('0x56')][_0x73c5('0x121')](db[_0x73c5('0x6c')],{'onDelete':_0x73c5('0x10e'),'as':_0x73c5('0x15a')});db['SmsMessage']['belongsTo'](db[_0x73c5('0x54')],{'onDelete':_0x73c5('0x10e'),'as':_0x73c5('0x172'),'foreignKey':'SmsInteractionId'});db[_0x73c5('0x56')][_0x73c5('0x121')](db[_0x73c5('0x53')],{'as':'Account','foreignKey':_0x73c5('0x182')});db[_0x73c5('0x133')][_0x73c5('0x123')](db[_0x73c5('0x10c')],{'as':'Agents','through':_0x73c5('0x134'),'foreignKey':_0x73c5('0x187')});db[_0x73c5('0x133')][_0x73c5('0x123')](db[_0x73c5('0x152')],{'through':_0x73c5('0x188'),'as':_0x73c5('0x169')});db['OpenchannelAccount'][_0x73c5('0x111')](db[_0x73c5('0x160')],{'as':'Dispositions','foreignKey':_0x73c5('0x189'),'onDelete':'cascade'});db[_0x73c5('0x59')][_0x73c5('0x111')](db[_0x73c5('0x7b')],{'as':'Answers','foreignKey':_0x73c5('0x189')});db[_0x73c5('0x59')][_0x73c5('0x111')](db['OpenchannelInteraction'],{'as':'Interactions','foreignKey':_0x73c5('0x189')});db[_0x73c5('0x59')][_0x73c5('0x111')](db[_0x73c5('0x5e')],{'as':_0x73c5('0x154'),'foreignKey':_0x73c5('0x189')});db[_0x73c5('0x59')][_0x73c5('0x111')](db[_0x73c5('0x5b')],{'as':_0x73c5('0x143'),'foreignKey':'OpenchannelAccountId'});db[_0x73c5('0x59')][_0x73c5('0x121')](db[_0x73c5('0xf1')],{'as':'List','foreignKey':_0x73c5('0x163')});db[_0x73c5('0x59')][_0x73c5('0x121')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x73c5('0x14e')});db[_0x73c5('0x59')][_0x73c5('0x123')](db[_0x73c5('0x10c')],{'as':_0x73c5('0x151'),'through':_0x73c5('0x13c')});db[_0x73c5('0x5b')][_0x73c5('0x121')](db[_0x73c5('0x10c')],{'onDelete':_0x73c5('0x15c')});db[_0x73c5('0x5b')][_0x73c5('0x121')](db[_0x73c5('0x60')],{'onDelete':_0x73c5('0x15c'),'foreignKey':'OpenchannelQueueId'});db[_0x73c5('0x5b')]['belongsTo'](db[_0x73c5('0x59')],{'onDelete':'restrict','foreignKey':'OpenchannelAccountId'});db['OpenchannelApplication'][_0x73c5('0x121')](db[_0x73c5('0x7f')],{'onDelete':_0x73c5('0x15c'),'foreignKey':_0x73c5('0x14d')});db[_0x73c5('0x5b')][_0x73c5('0x121')](db[_0x73c5('0x88')],{'onDelete':_0x73c5('0x15c'),'foreignKey':_0x73c5('0x175')});db[_0x73c5('0x117')][_0x73c5('0x111')](db[_0x73c5('0x5e')],{'as':_0x73c5('0x154'),'onDelete':_0x73c5('0x10e'),'foreignKey':_0x73c5('0x18a')});db['OpenchannelInteraction']['belongsTo'](db[_0x73c5('0x59')],{'as':_0x73c5('0x16b'),'foreignKey':_0x73c5('0x189')});db[_0x73c5('0x117')][_0x73c5('0x121')](db['CmContact'],{'as':'Contact','foreignKey':_0x73c5('0x16c')});db[_0x73c5('0x117')][_0x73c5('0x121')](db['User'],{'as':_0x73c5('0x16d'),'foreignKey':_0x73c5('0x10f')});db[_0x73c5('0x117')][_0x73c5('0x123')](db[_0x73c5('0x88')],{'through':_0x73c5('0x18b'),'as':_0x73c5('0x18c')});db['OpenchannelInteraction'][_0x73c5('0x123')](db[_0x73c5('0x88')],{'through':'openchannel_interaction_has_tags','as':_0x73c5('0x16f')});db['OpenchannelInteraction'][_0x73c5('0x123')](db['User'],{'as':'Users','through':_0x73c5('0x18d'),'foreignKey':_0x73c5('0x18a')});db[_0x73c5('0x5e')][_0x73c5('0x121')](db[_0x73c5('0x10c')],{'onDelete':_0x73c5('0x10e'),'as':_0x73c5('0x10c')});db[_0x73c5('0x5e')][_0x73c5('0x121')](db[_0x73c5('0x6c')],{'onDelete':_0x73c5('0x10e'),'as':_0x73c5('0x15a')});db[_0x73c5('0x5e')][_0x73c5('0x121')](db[_0x73c5('0x117')],{'onDelete':_0x73c5('0x10e'),'as':'Interaction','foreignKey':'OpenchannelInteractionId'});db[_0x73c5('0x5e')]['belongsTo'](db[_0x73c5('0x17f')],{'as':_0x73c5('0x17f'),'foreignKey':_0x73c5('0x180')});db['OpenchannelMessage'][_0x73c5('0x121')](db[_0x73c5('0x59')],{'as':_0x73c5('0x16b'),'foreignKey':'OpenchannelAccountId'});db[_0x73c5('0x60')][_0x73c5('0x123')](db[_0x73c5('0x10c')],{'as':_0x73c5('0x151'),'through':_0x73c5('0x36'),'foreignKey':_0x73c5('0x18e')});db['OpenchannelQueue'][_0x73c5('0x123')](db[_0x73c5('0x152')],{'through':_0x73c5('0x18f'),'as':_0x73c5('0x169')});db['ChatWebsite'][_0x73c5('0x111')](db[_0x73c5('0x160')],{'as':_0x73c5('0x179'),'foreignKey':_0x73c5('0x173'),'onDelete':'cascade'});db[_0x73c5('0x62')][_0x73c5('0x111')](db[_0x73c5('0x7b')],{'as':_0x73c5('0x183'),'foreignKey':'ChatWebsiteId'});db[_0x73c5('0x62')][_0x73c5('0x111')](db[_0x73c5('0x190')],{'as':_0x73c5('0x191')});db['ChatWebsite'][_0x73c5('0x111')](db['ChatInteraction'],{'as':'Interactions'});db['ChatWebsite'][_0x73c5('0x111')](db['ChatApplication'],{'as':'Applications'});db[_0x73c5('0x62')][_0x73c5('0x111')](db[_0x73c5('0x192')],{'as':_0x73c5('0x154')});db[_0x73c5('0x62')][_0x73c5('0x121')](db[_0x73c5('0xf1')],{'as':_0x73c5('0x162'),'foreignKey':_0x73c5('0x163')});db[_0x73c5('0x62')][_0x73c5('0x121')](db['Interval'],{'as':'Interval','foreignKey':_0x73c5('0x14d')});db[_0x73c5('0x62')]['belongsTo'](db['MailAccount'],{'as':_0x73c5('0x3e'),'foreignKey':_0x73c5('0x15b')});db[_0x73c5('0x62')][_0x73c5('0x121')](db[_0x73c5('0x81')],{'as':_0x73c5('0x166'),'foreignKey':_0x73c5('0x14e')});db[_0x73c5('0x62')][_0x73c5('0x123')](db[_0x73c5('0x10c')],{'as':_0x73c5('0x151'),'through':_0x73c5('0x139')});db[_0x73c5('0x63')]['belongsTo'](db['OpenchannelAccount'],{});db[_0x73c5('0x63')]['belongsTo'](db['CmList'],{'as':_0x73c5('0x162'),'foreignKey':_0x73c5('0x163')});db[_0x73c5('0x63')]['belongsTo'](db['CmContact'],{'as':_0x73c5('0x15a'),'foreignKey':_0x73c5('0x16c')});db['OpenchannelQueueReport'][_0x73c5('0x121')](db[_0x73c5('0x117')],{});db[_0x73c5('0x63')][_0x73c5('0x121')](db['OpenchannelMessage'],{});db['OpenchannelQueueReport'][_0x73c5('0x121')](db['User'],{});db[_0x73c5('0x63')][_0x73c5('0x121')](db[_0x73c5('0x60')],{});db[_0x73c5('0x193')][_0x73c5('0x121')](db['User'],{'as':_0x73c5('0x194'),'foreignKey':'UserId','onDelete':'restrict'});db[_0x73c5('0x193')][_0x73c5('0x121')](db[_0x73c5('0x132')],{'as':'Queue','foreignKey':'ChatQueueId','onDelete':_0x73c5('0x15c')});db[_0x73c5('0x193')]['belongsTo'](db[_0x73c5('0x62')],{'as':_0x73c5('0x195'),'foreignKey':_0x73c5('0x173'),'onDelete':_0x73c5('0x15c')});db[_0x73c5('0x193')]['belongsTo'](db['Tag'],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x73c5('0x118')][_0x73c5('0x111')](db[_0x73c5('0x192')],{'as':_0x73c5('0x154'),'onDelete':_0x73c5('0x10e'),'foreignKey':_0x73c5('0x196')});db[_0x73c5('0x118')][_0x73c5('0x121')](db[_0x73c5('0x62')],{'as':_0x73c5('0x16b'),'foreignKey':'ChatWebsiteId'});db[_0x73c5('0x118')][_0x73c5('0x121')](db[_0x73c5('0x6c')],{'as':_0x73c5('0x15a'),'foreignKey':_0x73c5('0x16c')});db[_0x73c5('0x118')]['belongsTo'](db[_0x73c5('0x10c')],{'as':_0x73c5('0x16d'),'foreignKey':_0x73c5('0x10f')});db[_0x73c5('0x118')][_0x73c5('0x123')](db[_0x73c5('0x88')],{'through':_0x73c5('0x197'),'as':_0x73c5('0x18c')});db[_0x73c5('0x118')][_0x73c5('0x123')](db[_0x73c5('0x88')],{'through':_0x73c5('0x197'),'as':_0x73c5('0x16f')});db[_0x73c5('0x118')]['belongsToMany'](db[_0x73c5('0x10c')],{'as':_0x73c5('0x170'),'through':_0x73c5('0x12a'),'foreignKey':_0x73c5('0x196')});db['ChatMessage'][_0x73c5('0x121')](db[_0x73c5('0x10c')],{'onDelete':'cascade','as':_0x73c5('0x10c')});db[_0x73c5('0x192')][_0x73c5('0x121')](db[_0x73c5('0x6c')],{'onDelete':_0x73c5('0x10e'),'as':_0x73c5('0x15a'),'foreignKey':'ContactId'});db[_0x73c5('0x192')]['belongsTo'](db[_0x73c5('0x118')],{'onDelete':_0x73c5('0x10e'),'as':_0x73c5('0x172'),'foreignKey':'ChatInteractionId'});db[_0x73c5('0x192')][_0x73c5('0x121')](db['Attachment'],{'as':'Attachment','foreignKey':_0x73c5('0x180')});db[_0x73c5('0x192')][_0x73c5('0x121')](db[_0x73c5('0x62')],{'as':'Account','foreignKey':_0x73c5('0x173')});db['ChatOfflineMessage'][_0x73c5('0x111')](db['Attachment'],{'as':_0x73c5('0x171'),'foreignKey':_0x73c5('0x174'),'onDelete':_0x73c5('0x10e'),'hooks':!![]});db['ChatOfflineMessage'][_0x73c5('0x121')](db[_0x73c5('0x6c')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x73c5('0x16c')});db['ChatOfflineMessage'][_0x73c5('0x121')](db['ChatWebsite'],{'as':'Account','foreignKey':_0x73c5('0x173')});db[_0x73c5('0x132')][_0x73c5('0x123')](db['User'],{'as':'Agents','through':'UserChatQueue','hooks':!![]});db[_0x73c5('0x132')][_0x73c5('0x123')](db[_0x73c5('0x152')],{'through':'team_has_chat_queues','as':_0x73c5('0x169')});db[_0x73c5('0x68')]['hasMany'](db[_0x73c5('0x198')],{'as':_0x73c5('0x154'),'foreignKey':_0x73c5('0x199'),'onDelete':_0x73c5('0x10e')});db['ChatGroup'][_0x73c5('0x123')](db[_0x73c5('0x10c')],{'as':'Members','through':_0x73c5('0x125')});db[_0x73c5('0x190')][_0x73c5('0x121')](db[_0x73c5('0x62')],{'as':_0x73c5('0x195'),'foreignKey':_0x73c5('0x173')});db[_0x73c5('0x6a')][_0x73c5('0x111')](db['CmContact'],{'as':_0x73c5('0x126'),'foreignKey':_0x73c5('0x19a')});db[_0x73c5('0x6c')][_0x73c5('0x111')](db[_0x73c5('0x8b')],{'as':_0x73c5('0x19b'),'foreignKey':_0x73c5('0x19c')});db['CmContact']['hasMany'](db[_0x73c5('0x6d')],{'as':_0x73c5('0x148'),'foreignKey':'ContactId'});db[_0x73c5('0x6c')]['hasMany'](db[_0x73c5('0x71')],{'as':_0x73c5('0x19d'),'foreignKey':_0x73c5('0x16c')});db[_0x73c5('0x6c')][_0x73c5('0x111')](db[_0x73c5('0x73')],{'as':_0x73c5('0x19e'),'foreignKey':_0x73c5('0x16c')});db[_0x73c5('0x6c')][_0x73c5('0x111')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x73c5('0x16c')});db[_0x73c5('0x6c')][_0x73c5('0x111')](db[_0x73c5('0xd0')],{'as':_0x73c5('0x14a'),'foreignKey':'ContactId'});db[_0x73c5('0x6c')][_0x73c5('0x111')](db[_0x73c5('0x117')],{'as':'OpenchannelInteractions','foreignKey':_0x73c5('0x16c'),'onDelete':_0x73c5('0x15c')});db[_0x73c5('0x6c')][_0x73c5('0x111')](db[_0x73c5('0x118')],{'as':_0x73c5('0x119'),'foreignKey':_0x73c5('0x16c'),'onDelete':_0x73c5('0x15c')});db['CmContact'][_0x73c5('0x111')](db[_0x73c5('0x54')],{'as':_0x73c5('0x11a'),'foreignKey':_0x73c5('0x16c'),'onDelete':_0x73c5('0x15c')});db[_0x73c5('0x6c')][_0x73c5('0x111')](db['FaxInteraction'],{'as':_0x73c5('0x11b'),'foreignKey':_0x73c5('0x16c'),'onDelete':_0x73c5('0x15c')});db[_0x73c5('0x6c')][_0x73c5('0x111')](db[_0x73c5('0x41')],{'as':_0x73c5('0x11c'),'foreignKey':_0x73c5('0x16c'),'onDelete':_0x73c5('0x15c')});db[_0x73c5('0x6c')][_0x73c5('0x121')](db[_0x73c5('0x6a')],{'as':_0x73c5('0x19f'),'foreignKey':_0x73c5('0x19a')});db[_0x73c5('0x6c')][_0x73c5('0x121')](db[_0x73c5('0xf1')],{'as':_0x73c5('0x162'),'foreignKey':'ListId','onDelete':_0x73c5('0x10e')});db[_0x73c5('0x6c')][_0x73c5('0x123')](db[_0x73c5('0x10c')],{'as':_0x73c5('0x170'),'through':'cm_user_has_contacts'});db[_0x73c5('0x6c')]['belongsToMany'](db['Tag'],{'as':_0x73c5('0x18c'),'through':'cm_contact_has_tags'});db[_0x73c5('0x6c')][_0x73c5('0x123')](db[_0x73c5('0x88')],{'through':_0x73c5('0x1a0'),'as':_0x73c5('0x16f')});db[_0x73c5('0x6d')][_0x73c5('0x111')](db[_0x73c5('0x8d')],{'as':_0x73c5('0x1a1'),'foreignKey':_0x73c5('0x1a2')});db[_0x73c5('0x6d')][_0x73c5('0x121')](db[_0x73c5('0x6c')],{'as':'Contact','foreignKey':_0x73c5('0x16c'),'onDelete':_0x73c5('0x10e')});db['CmHopper'][_0x73c5('0x121')](db[_0x73c5('0xf1')],{'as':_0x73c5('0x162'),'foreignKey':_0x73c5('0x163'),'onDelete':_0x73c5('0x10e')});db['CmHopper']['belongsTo'](db['User'],{'as':_0x73c5('0x194'),'foreignKey':'UserId'});db[_0x73c5('0x6d')][_0x73c5('0x121')](db[_0x73c5('0x18')],{'as':_0x73c5('0x1a3'),'foreignKey':'VoiceQueueId','onDelete':_0x73c5('0x10e')});db[_0x73c5('0x6d')]['belongsTo'](db[_0x73c5('0xe3')],{'as':_0x73c5('0xe3'),'foreignKey':'CampaignId','onDelete':_0x73c5('0x10e')});db[_0x73c5('0x6d')]['belongsTo'](db[_0x73c5('0x10c')],{'as':'Owner','foreignKey':_0x73c5('0x1a4')});db[_0x73c5('0x6f')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x73c5('0x16c'),'onDelete':_0x73c5('0x10e')});db['CmHopperBlack']['belongsTo'](db[_0x73c5('0xf1')],{'as':_0x73c5('0x162'),'foreignKey':'ListId','onDelete':_0x73c5('0x10e')});db[_0x73c5('0x6f')][_0x73c5('0x121')](db[_0x73c5('0x18')],{'as':_0x73c5('0x1a3'),'foreignKey':'VoiceQueueId','onDelete':_0x73c5('0x10e')});db[_0x73c5('0x6f')][_0x73c5('0x121')](db[_0x73c5('0xe3')],{'as':_0x73c5('0xe3'),'foreignKey':_0x73c5('0x1a5'),'onDelete':_0x73c5('0x10e')});db['Automation'][_0x73c5('0x111')](db['Condition'],{'as':{'plural':_0x73c5('0x1a6'),'singular':_0x73c5('0x1a7')},'foreignKey':'AutomationAllId','onDelete':_0x73c5('0x10e'),'hooks':!![]});db[_0x73c5('0x79')][_0x73c5('0x111')](db[_0x73c5('0x7d')],{'as':{'plural':_0x73c5('0x1a8'),'singular':_0x73c5('0x1a9')},'foreignKey':_0x73c5('0x1aa'),'onDelete':_0x73c5('0x10e'),'hooks':!![]});db['Automation']['hasMany'](db[_0x73c5('0x77')],{'as':_0x73c5('0x1ab'),'foreignKey':_0x73c5('0x1ac'),'onDelete':_0x73c5('0x10e'),'hooks':!![]});db[_0x73c5('0x160')][_0x73c5('0x111')](db[_0x73c5('0x160')],{'as':_0x73c5('0x179'),'foreignKey':_0x73c5('0x1ad'),'onDelete':'cascade'});db[_0x73c5('0x7f')][_0x73c5('0x111')](db[_0x73c5('0x7f')],{'as':_0x73c5('0x1ae'),'foreignKey':_0x73c5('0x14d'),'onDelete':_0x73c5('0x10e'),'hooks':!![],'required':![]});db['Interval']['hasMany'](db[_0x73c5('0x16')],{'as':'Extensions','foreignKey':'IntervalId','onDelete':'restrict'});db['Interval'][_0x73c5('0x111')](db[_0x73c5('0x45')],{'as':_0x73c5('0x1af'),'foreignKey':_0x73c5('0x14d')});db[_0x73c5('0x7f')][_0x73c5('0x111')](db[_0x73c5('0x193')],{'as':'ChatApplications','foreignKey':_0x73c5('0x14d')});db[_0x73c5('0x7f')][_0x73c5('0x111')](db[_0x73c5('0x4b')],{'as':_0x73c5('0x1b0'),'foreignKey':_0x73c5('0x14d')});db[_0x73c5('0x7f')][_0x73c5('0x111')](db[_0x73c5('0x184')],{'as':'SmsApplications','foreignKey':_0x73c5('0x14d')});db[_0x73c5('0x85')]['belongsTo'](db[_0x73c5('0x3e')],{});db[_0x73c5('0x85')][_0x73c5('0x121')](db['AnalyticDefaultReport'],{'foreignKey':_0x73c5('0x1b1')});db[_0x73c5('0x85')][_0x73c5('0x121')](db[_0x73c5('0x1b2')],{'foreignKey':_0x73c5('0x1b3')});db[_0x73c5('0x1b4')]['belongsToMany'](db['VoiceMusicOnHold'],{'as':_0x73c5('0x1b5'),'through':_0x73c5('0x145'),'onDelete':_0x73c5('0x15c')});db[_0x73c5('0x88')][_0x73c5('0x123')](db[_0x73c5('0x6c')],{'through':'cm_contact_has_tags'});db[_0x73c5('0x88')][_0x73c5('0x123')](db[_0x73c5('0x118')],{'through':_0x73c5('0x197')});db[_0x73c5('0x88')][_0x73c5('0x123')](db['MailInteraction'],{'through':_0x73c5('0x16e')});db[_0x73c5('0x88')][_0x73c5('0x123')](db[_0x73c5('0x54')],{'through':_0x73c5('0x186')});db[_0x73c5('0x88')][_0x73c5('0x123')](db[_0x73c5('0x4d')],{'through':'fax_interaction_has_tags'});db[_0x73c5('0x88')][_0x73c5('0x123')](db[_0x73c5('0x117')],{'through':'openchannel_interaction_has_tags'});db[_0x73c5('0x88')]['belongsToMany'](db['WhatsappInteraction'],{'through':_0x73c5('0x1b6')});db['CmContactHasItem'][_0x73c5('0x121')](db[_0x73c5('0x89')],{'as':_0x73c5('0x1b7'),'foreignKey':_0x73c5('0x1b8')});db[_0x73c5('0x8d')][_0x73c5('0x121')](db['CmHopper'],{'as':_0x73c5('0x1b9'),'foreignKey':'CmHopperId'});db[_0x73c5('0x8b')][_0x73c5('0x121')](db[_0x73c5('0x6c')],{'as':_0x73c5('0x15a'),'foreignKey':_0x73c5('0x19c')});db['Trigger'][_0x73c5('0x111')](db[_0x73c5('0x7d')],{'as':{'plural':_0x73c5('0x1ba'),'singular':_0x73c5('0x1bb')},'foreignKey':'TriggerAllId','onDelete':_0x73c5('0x10e'),'hooks':!![]});db[_0x73c5('0x90')][_0x73c5('0x111')](db[_0x73c5('0x7d')],{'as':{'plural':_0x73c5('0x1bc'),'singular':_0x73c5('0x1bd')},'foreignKey':'TriggerAnyId','onDelete':_0x73c5('0x10e'),'hooks':!![]});db[_0x73c5('0x90')][_0x73c5('0x111')](db[_0x73c5('0x77')],{'as':_0x73c5('0x1ab'),'foreignKey':_0x73c5('0x1be'),'onDelete':_0x73c5('0x10e'),'hooks':!![]});db['AnalyticCustomReport'][_0x73c5('0x111')](db[_0x73c5('0x9b')],{'as':_0x73c5('0x1bf'),'onDelete':_0x73c5('0x10e'),'foreignKey':_0x73c5('0x1b3'),'hooks':!![]});db[_0x73c5('0x1c0')]['hasMany'](db[_0x73c5('0x9b')],{'as':_0x73c5('0x1bf'),'onDelete':_0x73c5('0x10e'),'foreignKey':_0x73c5('0x1b1')});db[_0x73c5('0x1c1')][_0x73c5('0x111')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':'cascade','foreignKey':_0x73c5('0x1c2')});db[_0x73c5('0x9b')][_0x73c5('0x121')](db['AnalyticMetric'],{'foreignKey':_0x73c5('0x1c2')});db[_0x73c5('0x9e')]['hasMany'](db[_0x73c5('0xa0')],{'as':_0x73c5('0x1c3'),'onDelete':'cascade','foreignKey':_0x73c5('0x1c4')});db[_0x73c5('0xa0')][_0x73c5('0x111')](db['SalesforceField'],{'as':'Subjects','onDelete':_0x73c5('0x10e'),'foreignKey':_0x73c5('0x1c5')});db['SalesforceConfiguration'][_0x73c5('0x111')](db[_0x73c5('0xa2')],{'as':_0x73c5('0x1c6'),'onDelete':_0x73c5('0x10e'),'foreignKey':_0x73c5('0x1c7')});db[_0x73c5('0xa0')][_0x73c5('0x111')](db[_0x73c5('0xa2')],{'as':_0x73c5('0x1bf'),'onDelete':'cascade','foreignKey':_0x73c5('0x1c8')});db[_0x73c5('0xa0')][_0x73c5('0x121')](db[_0x73c5('0x9e')],{'as':'Account','foreignKey':_0x73c5('0x1c4')});db['SalesforceField'][_0x73c5('0x111')](db['SalesforceField'],{'as':_0x73c5('0x1c9'),'foreignKey':_0x73c5('0x1c5')});db[_0x73c5('0xa2')]['hasMany'](db[_0x73c5('0xa2')],{'as':_0x73c5('0x1ca'),'foreignKey':_0x73c5('0x1c7')});db['SalesforceField']['hasMany'](db[_0x73c5('0xa2')],{'as':_0x73c5('0x1cb'),'foreignKey':'FieldId'});db[_0x73c5('0xa2')][_0x73c5('0x121')](db[_0x73c5('0x92')],{'as':_0x73c5('0x92'),'foreignKey':_0x73c5('0x1cc')});db[_0x73c5('0xa4')][_0x73c5('0x111')](db[_0x73c5('0x1cd')],{'as':_0x73c5('0x1c3'),'onDelete':'cascade','foreignKey':_0x73c5('0x1c4')});db[_0x73c5('0x1cd')][_0x73c5('0x111')](db['SugarcrmField'],{'as':'Subjects','onDelete':_0x73c5('0x10e'),'foreignKey':'SubjectId'});db[_0x73c5('0x1cd')][_0x73c5('0x111')](db[_0x73c5('0xa7')],{'as':_0x73c5('0x1c6'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x73c5('0x1cd')][_0x73c5('0x111')](db['SugarcrmField'],{'as':_0x73c5('0x1bf'),'onDelete':_0x73c5('0x10e'),'foreignKey':_0x73c5('0x1c8')});db['SugarcrmConfiguration'][_0x73c5('0x121')](db[_0x73c5('0xa4')],{'as':_0x73c5('0x16b'),'foreignKey':_0x73c5('0x1c4')});db[_0x73c5('0xa7')]['hasMany'](db[_0x73c5('0xa7')],{'as':_0x73c5('0x1c9'),'foreignKey':_0x73c5('0x1c5')});db[_0x73c5('0xa7')][_0x73c5('0x111')](db[_0x73c5('0xa7')],{'as':_0x73c5('0x1ca'),'foreignKey':_0x73c5('0x1c7')});db[_0x73c5('0xa7')][_0x73c5('0x111')](db[_0x73c5('0xa7')],{'as':_0x73c5('0x1cb'),'foreignKey':_0x73c5('0x1c8')});db['SugarcrmField'][_0x73c5('0x121')](db[_0x73c5('0x92')],{'as':_0x73c5('0x92'),'foreignKey':_0x73c5('0x1cc')});db[_0x73c5('0x1ce')]['hasMany'](db[_0x73c5('0x1cf')],{'as':'Configurations','onDelete':_0x73c5('0x10e'),'foreignKey':_0x73c5('0x1c4')});db['DeskConfiguration'][_0x73c5('0x111')](db[_0x73c5('0xaa')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x73c5('0x1c5')});db[_0x73c5('0x1cf')][_0x73c5('0x111')](db[_0x73c5('0xaa')],{'as':'Descriptions','onDelete':_0x73c5('0x10e'),'foreignKey':_0x73c5('0x1c7')});db[_0x73c5('0x1cf')][_0x73c5('0x111')](db[_0x73c5('0xaa')],{'as':_0x73c5('0x1bf'),'onDelete':_0x73c5('0x10e'),'foreignKey':'FieldId'});db[_0x73c5('0x1cf')][_0x73c5('0x121')](db['DeskAccount'],{'as':_0x73c5('0x16b'),'foreignKey':'AccountId'});db[_0x73c5('0x1cf')][_0x73c5('0x123')](db[_0x73c5('0x88')],{'through':'int_desk_configuration_has_tags'});db[_0x73c5('0xaa')]['hasMany'](db[_0x73c5('0xaa')],{'as':_0x73c5('0x1c9'),'foreignKey':_0x73c5('0x1c5')});db['DeskField']['hasMany'](db['DeskField'],{'as':_0x73c5('0x1ca'),'foreignKey':_0x73c5('0x1c7')});db['DeskField'][_0x73c5('0x111')](db[_0x73c5('0xaa')],{'as':'Field','foreignKey':_0x73c5('0x1c8')});db[_0x73c5('0xaa')][_0x73c5('0x121')](db[_0x73c5('0x92')],{'as':'Variable','foreignKey':'VariableId'});db[_0x73c5('0xac')][_0x73c5('0x111')](db[_0x73c5('0xad')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x73c5('0x1c4')});db[_0x73c5('0xad')][_0x73c5('0x111')](db[_0x73c5('0xaf')],{'as':'Subjects','onDelete':_0x73c5('0x10e'),'foreignKey':'SubjectId'});db[_0x73c5('0xad')][_0x73c5('0x111')](db['ZohoField'],{'as':_0x73c5('0x1c6'),'onDelete':_0x73c5('0x10e'),'foreignKey':'DescriptionId'});db[_0x73c5('0xad')][_0x73c5('0x111')](db[_0x73c5('0xaf')],{'as':_0x73c5('0x1bf'),'onDelete':_0x73c5('0x10e'),'foreignKey':_0x73c5('0x1c8')});db[_0x73c5('0xad')][_0x73c5('0x121')](db[_0x73c5('0xac')],{'as':_0x73c5('0x16b'),'foreignKey':'AccountId'});db['ZohoField'][_0x73c5('0x111')](db['ZohoField'],{'as':_0x73c5('0x1c9'),'foreignKey':_0x73c5('0x1c5')});db['ZohoField'][_0x73c5('0x111')](db[_0x73c5('0xaf')],{'as':_0x73c5('0x1ca'),'foreignKey':'DescriptionId'});db[_0x73c5('0xaf')][_0x73c5('0x111')](db[_0x73c5('0xaf')],{'as':_0x73c5('0x1cb'),'foreignKey':_0x73c5('0x1c8')});db[_0x73c5('0xaf')][_0x73c5('0x121')](db[_0x73c5('0x92')],{'as':_0x73c5('0x92'),'foreignKey':_0x73c5('0x1cc')});db[_0x73c5('0xb1')]['hasMany'](db[_0x73c5('0xb2')],{'as':_0x73c5('0x1c3'),'onDelete':_0x73c5('0x10e'),'foreignKey':_0x73c5('0x1c4')});db[_0x73c5('0xb2')]['hasMany'](db[_0x73c5('0xb4')],{'as':_0x73c5('0x1d0'),'foreignKey':'SubjectId'});db[_0x73c5('0xb2')][_0x73c5('0x111')](db[_0x73c5('0xb4')],{'as':_0x73c5('0x1c6'),'foreignKey':_0x73c5('0x1c7')});db[_0x73c5('0xb2')][_0x73c5('0x111')](db[_0x73c5('0xb4')],{'as':_0x73c5('0x1bf'),'foreignKey':'FieldId'});db[_0x73c5('0xb2')][_0x73c5('0x121')](db[_0x73c5('0xb1')],{'as':_0x73c5('0x16b'),'foreignKey':_0x73c5('0x1c4')});db[_0x73c5('0xb2')][_0x73c5('0x123')](db[_0x73c5('0x88')],{'through':'int_zendesk_configuration_has_tags'});db[_0x73c5('0xb4')][_0x73c5('0x111')](db[_0x73c5('0xb4')],{'as':_0x73c5('0x1c9'),'foreignKey':_0x73c5('0x1c5')});db[_0x73c5('0xb4')]['hasMany'](db[_0x73c5('0xb4')],{'as':_0x73c5('0x1ca'),'foreignKey':'DescriptionId'});db['ZendeskField']['hasMany'](db[_0x73c5('0xb4')],{'as':_0x73c5('0x1cb'),'foreignKey':_0x73c5('0x1c8')});db[_0x73c5('0xb4')][_0x73c5('0x121')](db[_0x73c5('0x92')],{'as':_0x73c5('0x92'),'foreignKey':_0x73c5('0x1cc')});db[_0x73c5('0xb5')]['hasMany'](db[_0x73c5('0x1d1')],{'as':_0x73c5('0x1c3'),'onDelete':_0x73c5('0x10e'),'foreignKey':_0x73c5('0x1c4')});db[_0x73c5('0x1d1')]['hasMany'](db['FreshdeskField'],{'as':_0x73c5('0x1d0'),'onDelete':_0x73c5('0x10e'),'foreignKey':_0x73c5('0x1c5')});db[_0x73c5('0x1d1')]['hasMany'](db[_0x73c5('0xb7')],{'as':_0x73c5('0x1c6'),'onDelete':'cascade','foreignKey':_0x73c5('0x1c7')});db['FreshdeskConfiguration'][_0x73c5('0x111')](db[_0x73c5('0xb7')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x73c5('0x1c8')});db[_0x73c5('0x1d1')]['belongsTo'](db[_0x73c5('0xb5')],{'as':_0x73c5('0x16b'),'foreignKey':'AccountId'});db[_0x73c5('0x1d1')][_0x73c5('0x123')](db[_0x73c5('0x88')],{'through':_0x73c5('0x1d2')});db[_0x73c5('0xb7')][_0x73c5('0x111')](db['FreshdeskField'],{'as':'Subject','foreignKey':_0x73c5('0x1c5')});db[_0x73c5('0xb7')][_0x73c5('0x111')](db[_0x73c5('0xb7')],{'as':_0x73c5('0x1ca'),'foreignKey':_0x73c5('0x1c7')});db[_0x73c5('0xb7')][_0x73c5('0x111')](db['FreshdeskField'],{'as':_0x73c5('0x1cb'),'foreignKey':_0x73c5('0x1c8')});db['FreshdeskField']['belongsTo'](db['Variable'],{'as':_0x73c5('0x92'),'foreignKey':_0x73c5('0x1cc')});db[_0x73c5('0xb9')][_0x73c5('0x111')](db[_0x73c5('0xbb')],{'as':_0x73c5('0x1c3'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x73c5('0xbb')][_0x73c5('0x111')](db[_0x73c5('0xbd')],{'as':'Subjects','foreignKey':'SubjectId'});db['VtigerConfiguration']['hasMany'](db[_0x73c5('0xbd')],{'as':_0x73c5('0x1c6'),'foreignKey':'DescriptionId'});db[_0x73c5('0xbb')][_0x73c5('0x111')](db[_0x73c5('0xbd')],{'as':_0x73c5('0x1bf'),'foreignKey':_0x73c5('0x1c8')});db[_0x73c5('0xbb')][_0x73c5('0x121')](db['VtigerAccount'],{'as':'Account','foreignKey':_0x73c5('0x1c4')});db[_0x73c5('0xbd')][_0x73c5('0x111')](db[_0x73c5('0xbd')],{'as':'Subject','foreignKey':_0x73c5('0x1c5')});db['VtigerField'][_0x73c5('0x111')](db[_0x73c5('0xbd')],{'as':_0x73c5('0x1ca'),'foreignKey':_0x73c5('0x1c7')});db[_0x73c5('0xbd')][_0x73c5('0x111')](db[_0x73c5('0xbd')],{'as':_0x73c5('0x1cb'),'foreignKey':'FieldId'});db['VtigerField'][_0x73c5('0x121')](db[_0x73c5('0x92')],{'as':_0x73c5('0x92'),'foreignKey':_0x73c5('0x1cc')});db[_0x73c5('0x1d3')]['hasMany'](db[_0x73c5('0xc0')],{'as':_0x73c5('0x1c3'),'onDelete':_0x73c5('0x10e'),'foreignKey':_0x73c5('0x1c4')});db['ServicenowConfiguration'][_0x73c5('0x111')](db['ServicenowField'],{'as':_0x73c5('0x1d0'),'foreignKey':_0x73c5('0x1c5')});db[_0x73c5('0xc0')][_0x73c5('0x111')](db[_0x73c5('0x1d4')],{'as':_0x73c5('0x1c6'),'foreignKey':_0x73c5('0x1c7')});db[_0x73c5('0xc0')][_0x73c5('0x111')](db[_0x73c5('0x1d4')],{'as':_0x73c5('0x1bf'),'foreignKey':_0x73c5('0x1c8')});db[_0x73c5('0xc0')]['belongsTo'](db[_0x73c5('0x1d3')],{'as':_0x73c5('0x16b'),'foreignKey':'AccountId'});db[_0x73c5('0x1d4')][_0x73c5('0x111')](db['ServicenowField'],{'as':_0x73c5('0x1c9'),'foreignKey':_0x73c5('0x1c5')});db[_0x73c5('0x1d4')]['hasMany'](db[_0x73c5('0x1d4')],{'as':_0x73c5('0x1ca'),'foreignKey':_0x73c5('0x1c7')});db[_0x73c5('0x1d4')]['hasMany'](db[_0x73c5('0x1d4')],{'as':_0x73c5('0x1cb'),'foreignKey':_0x73c5('0x1c8')});db[_0x73c5('0x1d4')]['belongsTo'](db[_0x73c5('0x92')],{'as':_0x73c5('0x92'),'foreignKey':_0x73c5('0x1cc')});db[_0x73c5('0xc1')][_0x73c5('0x111')](db[_0x73c5('0xc3')],{'as':_0x73c5('0x1c3'),'onDelete':'cascade','foreignKey':_0x73c5('0x1c4')});db[_0x73c5('0xc1')][_0x73c5('0x121')](db[_0x73c5('0x105')],{'as':'CloudProvider','foreignKey':'CloudProviderId'});db[_0x73c5('0xc3')][_0x73c5('0x111')](db[_0x73c5('0x1d5')],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x73c5('0xc3')]['hasMany'](db[_0x73c5('0x1d5')],{'as':_0x73c5('0x1c6'),'onDelete':_0x73c5('0x10e'),'foreignKey':_0x73c5('0x1c7')});db['Dynamics365Configuration'][_0x73c5('0x111')](db[_0x73c5('0x1d5')],{'as':_0x73c5('0x1bf'),'onDelete':_0x73c5('0x10e'),'foreignKey':_0x73c5('0x1c8')});db['Dynamics365Configuration'][_0x73c5('0x121')](db[_0x73c5('0xc1')],{'as':_0x73c5('0x16b'),'foreignKey':_0x73c5('0x1c4')});db[_0x73c5('0x1d5')]['hasMany'](db[_0x73c5('0x1d5')],{'as':_0x73c5('0x1c9'),'foreignKey':_0x73c5('0x1c5')});db['Dynamics365Field']['hasMany'](db[_0x73c5('0x1d5')],{'as':'Description','foreignKey':_0x73c5('0x1c7')});db['Dynamics365Field']['hasMany'](db[_0x73c5('0x1d5')],{'as':'Field','foreignKey':_0x73c5('0x1c8')});db[_0x73c5('0x1d5')][_0x73c5('0x121')](db[_0x73c5('0x92')],{'as':_0x73c5('0x92'),'foreignKey':_0x73c5('0x1cc')});db[_0x73c5('0x1d6')][_0x73c5('0x111')](db[_0x73c5('0x1d7')],{'as':'Configurations','onDelete':_0x73c5('0x10e'),'foreignKey':_0x73c5('0x1c4')});db[_0x73c5('0x1d7')][_0x73c5('0x111')](db[_0x73c5('0xc7')],{'as':_0x73c5('0x1d0'),'foreignKey':'SubjectId'});db[_0x73c5('0x1d7')][_0x73c5('0x111')](db[_0x73c5('0xc7')],{'as':_0x73c5('0x1c6'),'foreignKey':_0x73c5('0x1c7')});db['FreshsalesConfiguration']['hasMany'](db[_0x73c5('0xc7')],{'as':_0x73c5('0x1bf'),'foreignKey':_0x73c5('0x1c8')});db['FreshsalesConfiguration']['belongsTo'](db['FreshsalesAccount'],{'as':_0x73c5('0x16b'),'foreignKey':_0x73c5('0x1c4')});db[_0x73c5('0xc7')][_0x73c5('0x111')](db['FreshsalesField'],{'as':_0x73c5('0x1c9'),'foreignKey':_0x73c5('0x1c5')});db[_0x73c5('0xc7')][_0x73c5('0x111')](db[_0x73c5('0xc7')],{'as':_0x73c5('0x1ca'),'foreignKey':'DescriptionId'});db[_0x73c5('0xc7')]['hasMany'](db[_0x73c5('0xc7')],{'as':_0x73c5('0x1cb'),'foreignKey':_0x73c5('0x1c8')});db['FreshsalesField']['belongsTo'](db[_0x73c5('0x92')],{'as':_0x73c5('0x92'),'foreignKey':_0x73c5('0x1cc')});db[_0x73c5('0xcb')]['belongsTo'](db[_0x73c5('0x62')],{});db[_0x73c5('0xcb')]['belongsTo'](db[_0x73c5('0xf1')],{'as':_0x73c5('0x162'),'foreignKey':'ListId'});db['ChatQueueReport']['belongsTo'](db['CmContact'],{'as':_0x73c5('0x15a'),'foreignKey':_0x73c5('0x16c')});db['ChatQueueReport'][_0x73c5('0x121')](db[_0x73c5('0x118')],{});db[_0x73c5('0xcb')][_0x73c5('0x121')](db[_0x73c5('0x192')],{});db[_0x73c5('0xcb')][_0x73c5('0x121')](db[_0x73c5('0x10c')],{});db['ChatQueueReport'][_0x73c5('0x121')](db[_0x73c5('0x132')],{});db['ChatInternalMessage'][_0x73c5('0x121')](db[_0x73c5('0x10c')],{'onDelete':_0x73c5('0x10e'),'foreignKey':'FromId'});db[_0x73c5('0x198')][_0x73c5('0x121')](db[_0x73c5('0x10c')],{'onDelete':'cascade','foreignKey':_0x73c5('0x1d8')});db[_0x73c5('0xd0')]['hasMany'](db[_0x73c5('0xce')],{'foreignKey':_0x73c5('0x1d9'),'onDelete':_0x73c5('0x10e')});db[_0x73c5('0xd0')][_0x73c5('0x111')](db[_0x73c5('0x1da')],{'foreignKey':'SessionId','onDelete':_0x73c5('0x10e')});db[_0x73c5('0xd2')][_0x73c5('0x121')](db[_0x73c5('0x53')],{});db[_0x73c5('0xd2')][_0x73c5('0x121')](db[_0x73c5('0xf1')],{'as':'List','foreignKey':'ListId'});db[_0x73c5('0xd2')][_0x73c5('0x121')](db[_0x73c5('0x6c')],{'as':'Contact','foreignKey':_0x73c5('0x16c')});db['SmsQueueReport'][_0x73c5('0x121')](db['SmsInteraction'],{});db[_0x73c5('0xd2')][_0x73c5('0x121')](db[_0x73c5('0x56')],{});db[_0x73c5('0xd2')][_0x73c5('0x121')](db[_0x73c5('0x10c')],{});db['SmsQueueReport']['belongsTo'](db[_0x73c5('0x133')],{});db[_0x73c5('0xd6')]['hasMany'](db['JscriptySessionReport'],{'foreignKey':'ProjectId'});db[_0x73c5('0xd6')][_0x73c5('0x111')](db[_0x73c5('0xce')],{'foreignKey':'ProjectId'});db[_0x73c5('0xd6')]['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x73c5('0xdb')][_0x73c5('0x123')](db[_0x73c5('0x10c')],{'as':'Users','through':'user_has_square_projects'});db[_0x73c5('0x152')]['belongsToMany'](db[_0x73c5('0x10c')],{'as':_0x73c5('0x151'),'through':'user_has_teams'});db['Team'][_0x73c5('0x123')](db[_0x73c5('0x18')],{'through':_0x73c5('0x1db'),'as':_0x73c5('0x1dc')});db['Team'][_0x73c5('0x123')](db[_0x73c5('0x130')],{'through':'team_has_mail_queues','as':'MailQueues'});db[_0x73c5('0x152')]['belongsToMany'](db['ChatQueue'],{'through':'team_has_chat_queues','as':_0x73c5('0x1dd')});db[_0x73c5('0x152')]['belongsToMany'](db[_0x73c5('0x51')],{'through':_0x73c5('0x181'),'as':_0x73c5('0x1de')});db[_0x73c5('0x152')]['belongsToMany'](db[_0x73c5('0x133')],{'through':_0x73c5('0x188'),'as':_0x73c5('0x1df')});db[_0x73c5('0x152')][_0x73c5('0x123')](db[_0x73c5('0x60')],{'through':'team_has_openchannel_queues','as':_0x73c5('0x135')});db[_0x73c5('0x152')][_0x73c5('0x123')](db['WhatsappQueue'],{'through':_0x73c5('0x1e0'),'as':_0x73c5('0x137')});db[_0x73c5('0x152')]['belongsToMany'](db[_0x73c5('0xf3')],{'through':'TeamVoicePrefix','as':_0x73c5('0x12f')});db[_0x73c5('0xe3')][_0x73c5('0x111')](db['CmHopper'],{'as':_0x73c5('0x148'),'foreignKey':'CampaignId'});db[_0x73c5('0xe3')]['hasMany'](db[_0x73c5('0x71')],{'as':_0x73c5('0x19d'),'foreignKey':_0x73c5('0x1a5')});db[_0x73c5('0xe3')]['hasMany'](db[_0x73c5('0x73')],{'as':_0x73c5('0x19e'),'foreignKey':_0x73c5('0x1a5')});db[_0x73c5('0xe3')]['hasMany'](db['CmHopperBlack'],{'as':_0x73c5('0x149'),'foreignKey':_0x73c5('0x1a5')});db[_0x73c5('0xe3')]['belongsTo'](db[_0x73c5('0x2a')],{'as':_0x73c5('0x2a'),'foreignKey':'TrunkId'});db[_0x73c5('0xe3')][_0x73c5('0x121')](db[_0x73c5('0x2a')],{'as':'TrunkBackup','foreignKey':_0x73c5('0x1e1')});db[_0x73c5('0xe3')][_0x73c5('0x121')](db[_0x73c5('0x7f')],{'as':_0x73c5('0x7f'),'foreignKey':_0x73c5('0x14d')});db['Campaign'][_0x73c5('0x121')](db[_0x73c5('0xdb')],{'as':_0x73c5('0xdb'),'foreignKey':'SquareProjectId'});db['Campaign'][_0x73c5('0x123')](db[_0x73c5('0xf1')],{'as':_0x73c5('0x14f'),'through':_0x73c5('0x1e2')});db[_0x73c5('0xe3')][_0x73c5('0x123')](db[_0x73c5('0xf1')],{'as':_0x73c5('0x153'),'through':_0x73c5('0x1e3')});db[_0x73c5('0x17f')]['belongsTo'](db[_0x73c5('0x66')],{'as':_0x73c5('0x66'),'foreignKey':_0x73c5('0x174')});db[_0x73c5('0xe9')][_0x73c5('0x121')](db[_0x73c5('0x43')],{});db['MailTransferReport'][_0x73c5('0x121')](db[_0x73c5('0x41')],{});db[_0x73c5('0xe9')][_0x73c5('0x121')](db[_0x73c5('0x3e')],{'foreignKey':_0x73c5('0x1e4'),'as':_0x73c5('0x1e5')});db[_0x73c5('0xe9')][_0x73c5('0x121')](db[_0x73c5('0x10c')],{'foreignKey':_0x73c5('0x1e6'),'as':'FromAgent'});db[_0x73c5('0xe9')]['belongsTo'](db[_0x73c5('0x10c')],{'foreignKey':_0x73c5('0x1e7'),'as':'ToAgent'});db[_0x73c5('0xe9')][_0x73c5('0x121')](db[_0x73c5('0x130')],{'foreignKey':_0x73c5('0x1e8'),'as':'ToQueue'});db[_0x73c5('0xe9')]['belongsTo'](db[_0x73c5('0x3e')],{'foreignKey':_0x73c5('0x1e9'),'as':'ToAccount'});db[_0x73c5('0xeb')][_0x73c5('0x121')](db['ChatMessage'],{});db[_0x73c5('0xeb')]['belongsTo'](db[_0x73c5('0x118')],{});db['ChatTransferReport'][_0x73c5('0x121')](db['ChatWebsite'],{'foreignKey':_0x73c5('0x1ea'),'as':_0x73c5('0x1e5')});db[_0x73c5('0xeb')][_0x73c5('0x121')](db['User'],{'foreignKey':_0x73c5('0x1e6'),'as':_0x73c5('0x1eb')});db[_0x73c5('0xeb')][_0x73c5('0x121')](db[_0x73c5('0x10c')],{'foreignKey':'ToUserId','as':_0x73c5('0x1ec')});db['ChatTransferReport']['belongsTo'](db[_0x73c5('0x132')],{'foreignKey':_0x73c5('0x1ed'),'as':_0x73c5('0x1ee')});db[_0x73c5('0xeb')][_0x73c5('0x121')](db[_0x73c5('0x62')],{'foreignKey':_0x73c5('0x1ef'),'as':_0x73c5('0x1f0')});db[_0x73c5('0xed')]['belongsTo'](db['FaxMessage'],{});db[_0x73c5('0xed')][_0x73c5('0x121')](db[_0x73c5('0x4d')],{});db[_0x73c5('0xed')][_0x73c5('0x121')](db[_0x73c5('0x49')],{'foreignKey':'FromFaxAccountId','as':_0x73c5('0x1e5')});db[_0x73c5('0xed')][_0x73c5('0x121')](db[_0x73c5('0x10c')],{'foreignKey':'FromUserId','as':_0x73c5('0x1eb')});db[_0x73c5('0xed')][_0x73c5('0x121')](db[_0x73c5('0x10c')],{'foreignKey':_0x73c5('0x1e7'),'as':_0x73c5('0x1ec')});db[_0x73c5('0xed')][_0x73c5('0x121')](db[_0x73c5('0x51')],{'foreignKey':'ToFaxQueueId','as':_0x73c5('0x1ee')});db['FaxTransferReport'][_0x73c5('0x121')](db[_0x73c5('0x49')],{'foreignKey':_0x73c5('0x1f1'),'as':_0x73c5('0x1f0')});db[_0x73c5('0x1f2')][_0x73c5('0x121')](db['OpenchannelMessage'],{});db[_0x73c5('0x1f2')][_0x73c5('0x121')](db[_0x73c5('0x117')],{});db[_0x73c5('0x1f2')]['belongsTo'](db[_0x73c5('0x59')],{'foreignKey':_0x73c5('0x1f3'),'as':_0x73c5('0x1e5')});db['OpenchannelTransferReport']['belongsTo'](db[_0x73c5('0x10c')],{'foreignKey':'FromUserId','as':_0x73c5('0x1eb')});db[_0x73c5('0x1f2')][_0x73c5('0x121')](db['User'],{'foreignKey':_0x73c5('0x1e7'),'as':_0x73c5('0x1ec')});db['OpenchannelTransferReport']['belongsTo'](db[_0x73c5('0x60')],{'foreignKey':'ToOpenchannelQueueId','as':_0x73c5('0x1ee')});db['OpenchannelTransferReport'][_0x73c5('0x121')](db['OpenchannelAccount'],{'foreignKey':_0x73c5('0x1f4'),'as':_0x73c5('0x1f0')});db['SmsTransferReport']['belongsTo'](db[_0x73c5('0x56')],{});db[_0x73c5('0xef')][_0x73c5('0x121')](db[_0x73c5('0x54')],{});db[_0x73c5('0xef')][_0x73c5('0x121')](db[_0x73c5('0x53')],{'foreignKey':_0x73c5('0x1f5'),'as':_0x73c5('0x1e5')});db[_0x73c5('0xef')][_0x73c5('0x121')](db[_0x73c5('0x10c')],{'foreignKey':_0x73c5('0x1e6'),'as':_0x73c5('0x1eb')});db[_0x73c5('0xef')]['belongsTo'](db[_0x73c5('0x10c')],{'foreignKey':_0x73c5('0x1e7'),'as':_0x73c5('0x1ec')});db['SmsTransferReport'][_0x73c5('0x121')](db[_0x73c5('0x133')],{'foreignKey':_0x73c5('0x1f6'),'as':_0x73c5('0x1ee')});db[_0x73c5('0xef')][_0x73c5('0x121')](db[_0x73c5('0x53')],{'foreignKey':_0x73c5('0x1f7'),'as':_0x73c5('0x1f0')});db['CmList'][_0x73c5('0x111')](db['Disposition'],{'as':_0x73c5('0x179'),'foreignKey':_0x73c5('0x163'),'onDelete':_0x73c5('0x10e')});db[_0x73c5('0xf1')][_0x73c5('0x111')](db[_0x73c5('0x76')],{'as':_0x73c5('0x1f8'),'foreignKey':'ListId'});db['CmList'][_0x73c5('0x111')](db[_0x73c5('0x6c')],{'as':'Contacts','onDelete':'cascade','foreignKey':'ListId'});db[_0x73c5('0xf1')][_0x73c5('0x111')](db[_0x73c5('0x71')],{'as':_0x73c5('0x19d'),'foreignKey':_0x73c5('0x163')});db['CmList'][_0x73c5('0x111')](db[_0x73c5('0x73')],{'as':_0x73c5('0x115'),'foreignKey':_0x73c5('0x163')});db[_0x73c5('0xf1')][_0x73c5('0x111')](db['ReportAgentPreview'],{'as':_0x73c5('0x116'),'foreignKey':_0x73c5('0x163')});db[_0x73c5('0xf1')][_0x73c5('0x123')](db['VoiceQueue'],{'as':_0x73c5('0x1f9'),'through':_0x73c5('0x150')});db[_0x73c5('0xf1')][_0x73c5('0x123')](db[_0x73c5('0x10c')],{'as':_0x73c5('0x151'),'through':_0x73c5('0x127')});db['VoicePrefix'][_0x73c5('0x111')](db[_0x73c5('0x16')],{'as':'Extensions','onDelete':_0x73c5('0x10e')});db[_0x73c5('0xf3')][_0x73c5('0x123')](db[_0x73c5('0x10c')],{'as':_0x73c5('0x151'),'through':_0x73c5('0x109')});db[_0x73c5('0xf3')][_0x73c5('0x123')](db[_0x73c5('0x152')],{'through':_0x73c5('0x108'),'as':_0x73c5('0x169')});db[_0x73c5('0xf5')][_0x73c5('0x111')](db[_0x73c5('0x10c')],{'as':_0x73c5('0x170'),'foreignKey':_0x73c5('0x122')});db[_0x73c5('0xf5')][_0x73c5('0x111')](db[_0x73c5('0x1fa')],{'as':_0x73c5('0x1fb'),'foreignKey':_0x73c5('0x122'),'onDelete':'cascade'});db['UserProfileSection'][_0x73c5('0x111')](db[_0x73c5('0xf7')],{'as':_0x73c5('0x1fc'),'foreignKey':_0x73c5('0x1fd'),'onDelete':_0x73c5('0x10e')});db['WhatsappAccount']['hasMany'](db[_0x73c5('0x160')],{'as':_0x73c5('0x179'),'foreignKey':_0x73c5('0x1fe'),'onDelete':'cascade'});db['WhatsappAccount'][_0x73c5('0x111')](db['CannedAnswer'],{'as':_0x73c5('0x183'),'foreignKey':_0x73c5('0x1fe')});db[_0x73c5('0xfa')]['hasMany'](db[_0x73c5('0x1ff')],{'as':_0x73c5('0x154'),'foreignKey':'WhatsappAccountId'});db[_0x73c5('0xfa')]['hasMany'](db['WhatsappInteraction'],{'as':_0x73c5('0x161')});db[_0x73c5('0xfa')][_0x73c5('0x111')](db['WhatsappApplication'],{'as':_0x73c5('0x143')});db[_0x73c5('0xfa')]['belongsTo'](db['CmList'],{'as':_0x73c5('0x162'),'foreignKey':_0x73c5('0x163')});db[_0x73c5('0xfa')][_0x73c5('0x121')](db[_0x73c5('0x81')],{'as':_0x73c5('0x166'),'foreignKey':_0x73c5('0x14e')});db[_0x73c5('0xfa')]['belongsToMany'](db[_0x73c5('0x10c')],{'as':_0x73c5('0x151'),'through':_0x73c5('0x200')});db['WhatsappApplication'][_0x73c5('0x121')](db[_0x73c5('0x10c')],{'onDelete':_0x73c5('0x15c')});db['WhatsappApplication'][_0x73c5('0x121')](db[_0x73c5('0x136')],{'onDelete':_0x73c5('0x15c')});db[_0x73c5('0xfc')]['belongsTo'](db[_0x73c5('0xfa')],{'onDelete':_0x73c5('0x15c')});db[_0x73c5('0xfc')][_0x73c5('0x121')](db['Interval'],{'onDelete':_0x73c5('0x15c'),'foreignKey':_0x73c5('0x14d')});db[_0x73c5('0xfc')][_0x73c5('0x121')](db[_0x73c5('0x88')],{'onDelete':_0x73c5('0x15c'),'foreignKey':_0x73c5('0x175')});db[_0x73c5('0xfe')][_0x73c5('0x111')](db['WhatsappMessage'],{'as':_0x73c5('0x154'),'onDelete':_0x73c5('0x10e'),'foreignKey':_0x73c5('0x201')});db['WhatsappInteraction'][_0x73c5('0x121')](db[_0x73c5('0xfa')],{'as':_0x73c5('0x16b'),'foreignKey':_0x73c5('0x1fe')});db[_0x73c5('0xfe')][_0x73c5('0x121')](db[_0x73c5('0x6c')],{'as':'Contact','foreignKey':'ContactId'});db[_0x73c5('0xfe')][_0x73c5('0x121')](db[_0x73c5('0x10c')],{'as':_0x73c5('0x16d'),'foreignKey':_0x73c5('0x10f')});db[_0x73c5('0xfe')][_0x73c5('0x123')](db[_0x73c5('0x88')],{'through':_0x73c5('0x1b6'),'as':_0x73c5('0x18c')});db[_0x73c5('0xfe')][_0x73c5('0x123')](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':_0x73c5('0x16f')});db[_0x73c5('0xfe')]['belongsToMany'](db[_0x73c5('0x10c')],{'as':_0x73c5('0x170'),'through':'user_has_whatsapp_interactions','foreignKey':'WhatsappInteractionId'});db[_0x73c5('0x1ff')][_0x73c5('0x121')](db['User'],{'as':'User'});db[_0x73c5('0x1ff')]['belongsTo'](db['CmContact'],{'onDelete':_0x73c5('0x10e'),'as':'Contact'});db[_0x73c5('0x1ff')][_0x73c5('0x121')](db[_0x73c5('0xfe')],{'onDelete':_0x73c5('0x10e'),'as':_0x73c5('0x172'),'foreignKey':_0x73c5('0x201')});db[_0x73c5('0x1ff')][_0x73c5('0x121')](db[_0x73c5('0xfa')],{'as':_0x73c5('0x16b'),'foreignKey':_0x73c5('0x1fe')});db['WhatsappQueueReport'][_0x73c5('0x121')](db[_0x73c5('0xfa')],{});db[_0x73c5('0x101')][_0x73c5('0x121')](db[_0x73c5('0xf1')],{'as':_0x73c5('0x162'),'foreignKey':_0x73c5('0x163')});db[_0x73c5('0x101')][_0x73c5('0x121')](db[_0x73c5('0x6c')],{'as':_0x73c5('0x15a'),'foreignKey':_0x73c5('0x16c')});db[_0x73c5('0x101')][_0x73c5('0x121')](db[_0x73c5('0xfe')],{});db['WhatsappQueueReport']['belongsTo'](db[_0x73c5('0x136')],{});db[_0x73c5('0x101')][_0x73c5('0x121')](db[_0x73c5('0x1ff')],{});db[_0x73c5('0x101')][_0x73c5('0x121')](db[_0x73c5('0x10c')],{});db[_0x73c5('0x202')]['belongsTo'](db['WhatsappMessage'],{});db[_0x73c5('0x202')][_0x73c5('0x121')](db['WhatsappInteraction'],{});db['WhatsappTransferReport'][_0x73c5('0x121')](db['WhatsappAccount'],{'foreignKey':_0x73c5('0x203'),'as':_0x73c5('0x1e5')});db[_0x73c5('0x202')][_0x73c5('0x121')](db['WhatsappAccount'],{'foreignKey':_0x73c5('0x204'),'as':_0x73c5('0x1f0')});db[_0x73c5('0x202')][_0x73c5('0x121')](db['WhatsappQueue'],{'foreignKey':_0x73c5('0x205'),'as':_0x73c5('0x1ee')});db[_0x73c5('0x202')][_0x73c5('0x121')](db[_0x73c5('0x10c')],{'foreignKey':_0x73c5('0x1e6'),'as':'FromAgent'});db['WhatsappTransferReport'][_0x73c5('0x121')](db[_0x73c5('0x10c')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x73c5('0x136')]['belongsToMany'](db[_0x73c5('0x10c')],{'as':_0x73c5('0x151'),'through':_0x73c5('0x38'),'foreignKey':_0x73c5('0x206')});db[_0x73c5('0x136')][_0x73c5('0x123')](db[_0x73c5('0x152')],{'through':_0x73c5('0x1e0'),'as':_0x73c5('0x169')});db[_0x73c5('0x10a')]['belongsTo'](db['User'],{'as':'user','foreignKey':_0x73c5('0x10f'),'onDelete':_0x73c5('0x10e'),'hooks':!![]});db[_0x73c5('0x105')][_0x73c5('0x10d')](db[_0x73c5('0xc1')],{'as':_0x73c5('0xc1'),'onDelete':_0x73c5('0x15c')});db[_0x73c5('0x105')][_0x73c5('0x10d')](db[_0x73c5('0x3a')],{'as':_0x73c5('0x15e'),'onDelete':'restrict'});db[_0x73c5('0x105')][_0x73c5('0x10d')](db[_0x73c5('0x3c')],{'as':_0x73c5('0x15f'),'onDelete':_0x73c5('0x15c')});module[_0x73c5('0x207')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 157b043..d6b3c86 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xec04=['./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/fields','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','./api/network','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','./api/campaign','/api/migrations','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','./api/rpc','/api/version','./api/version','./api/system','/api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','snippet','/server/files/plugins','route','get','sendFile','resolve','appPath','/index.html','express','./errors','./utils/client-side-logger','./api/client-side-logs','default','then','use','/api/users','./api/user','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','/api/mail/substatuses','/api/mail/interactions','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','/api/fax/applications','/api/fax/messages','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/applications','./api/smsApplication','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','/api/tags','./api/tag','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','./api/cmHopperAdditionalPhone','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts'];(function(_0x532807,_0x92d7fd){var _0x40b83f=function(_0x1c312c){while(--_0x1c312c){_0x532807['push'](_0x532807['shift']());}};_0x40b83f(++_0x92d7fd);}(_0xec04,0x84));var _0x4ec0=function(_0xdd020f,_0x26782c){_0xdd020f=_0xdd020f-0x0;var _0x2f2858=_0xec04[_0xdd020f];return _0x2f2858;};'use strict';var path=require('path');var express=require(_0x4ec0('0x0'));var errors=require(_0x4ec0('0x1'));var config=require('./config/environment');var setupLoggers=require(_0x4ec0('0x2'))['setupLoggers'];var clientSideLogs=require(_0x4ec0('0x3'));exports[_0x4ec0('0x4')]=function(_0x393d99){return setupLoggers(_0x393d99)[_0x4ec0('0x5')](function(){_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x7'),require(_0x4ec0('0x8')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x9'),require('./api/voiceChanSpy'));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0xa'),require(_0x4ec0('0xb')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0xc'),require('./api/voiceExtension'));_0x393d99['use']('/api/voice/mohs',require(_0x4ec0('0xd')));_0x393d99['use']('/api/voice/queues',require(_0x4ec0('0xe')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0xf'),require(_0x4ec0('0x10')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x11'),require('./api/screenRecording'));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x12'),require(_0x4ec0('0x13')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x14'),require(_0x4ec0('0x15')));_0x393d99['use']('/api/voice/calls/reports',require(_0x4ec0('0x16')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x17'),require('./api/voiceDialReport'));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x18'),require(_0x4ec0('0x19')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x1a'),require(_0x4ec0('0x1b')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x1c'),require(_0x4ec0('0x1d')));_0x393d99[_0x4ec0('0x6')]('/api/trunks',require(_0x4ec0('0x1e')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x1f'),require('./api/voiceTransferReport'));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x20'),require(_0x4ec0('0x21')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x22'),require('./api/mailAccount'));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x23'),require('./api/mailQueue'));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x24'),require('./api/mailSubstatus'));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x25'),require('./api/mailInteraction'));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x26'),require(_0x4ec0('0x27')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x28'),require(_0x4ec0('0x29')));_0x393d99[_0x4ec0('0x6')]('/api/mail/reports/queue',require(_0x4ec0('0x2a')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x2b'),require(_0x4ec0('0x2c')));_0x393d99['use'](_0x4ec0('0x2d'),require(_0x4ec0('0x2e')));_0x393d99[_0x4ec0('0x6')]('/api/fax/accounts',require(_0x4ec0('0x2f')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x30'),require('./api/faxApplication'));_0x393d99['use']('/api/fax/interactions',require('./api/faxInteraction'));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x31'),require('./api/faxMessage'));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x32'),require('./api/faxQueue'));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x33'),require(_0x4ec0('0x34')));_0x393d99[_0x4ec0('0x6')]('/api/sms/accounts',require('./api/smsAccount'));_0x393d99['use'](_0x4ec0('0x35'),require(_0x4ec0('0x36')));_0x393d99[_0x4ec0('0x6')]('/api/sms/interactions',require('./api/smsInteraction'));_0x393d99['use'](_0x4ec0('0x37'),require(_0x4ec0('0x38')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x39'),require(_0x4ec0('0x3a')));_0x393d99['use'](_0x4ec0('0x3b'),require(_0x4ec0('0x3c')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x3d'),require(_0x4ec0('0x3e')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x3f'),require('./api/openchannelInteraction'));_0x393d99[_0x4ec0('0x6')]('/api/openchannel/messages',require(_0x4ec0('0x40')));_0x393d99['use'](_0x4ec0('0x41'),require('./api/openchannelQueue'));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x42'),require('./api/chatWebsite'));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x43'),require('./api/openchannelQueueReport'));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x44'),require(_0x4ec0('0x45')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x46'),require(_0x4ec0('0x47')));_0x393d99['use'](_0x4ec0('0x48'),require(_0x4ec0('0x49')));_0x393d99['use'](_0x4ec0('0x4a'),require(_0x4ec0('0x4b')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x4c'),require(_0x4ec0('0x4d')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x4e'),require('./api/chatGroup'));_0x393d99['use'](_0x4ec0('0x4f'),require('./api/chatProactiveAction'));_0x393d99['use'](_0x4ec0('0x50'),require(_0x4ec0('0x51')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x52'),require(_0x4ec0('0x53')));_0x393d99['use'](_0x4ec0('0x54'),require(_0x4ec0('0x55')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x56'),require(_0x4ec0('0x57')));_0x393d99[_0x4ec0('0x6')]('/api/cm/hopper_final',require(_0x4ec0('0x58')));_0x393d99['use'](_0x4ec0('0x59'),require(_0x4ec0('0x5a')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x5b'),require('./api/cmCustomField'));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x5c'),require('./api/action'));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x5d'),require('./api/automation'));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x5e'),require(_0x4ec0('0x5f')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x60'),require(_0x4ec0('0x61')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x62'),require(_0x4ec0('0x63')));_0x393d99[_0x4ec0('0x6')]('/api/intervals',require('./api/interval'));_0x393d99['use'](_0x4ec0('0x64'),require(_0x4ec0('0x65')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x66'),require(_0x4ec0('0x67')));_0x393d99['use'](_0x4ec0('0x68'),require(_0x4ec0('0x69')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x6a'),require(_0x4ec0('0x6b')));_0x393d99[_0x4ec0('0x6')]('/api/sounds',require(_0x4ec0('0x6c')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x6d'),require(_0x4ec0('0x6e')));_0x393d99[_0x4ec0('0x6')]('/api/contact_item_types',require(_0x4ec0('0x6f')));_0x393d99['use'](_0x4ec0('0x70'),require(_0x4ec0('0x71')));_0x393d99[_0x4ec0('0x6')]('/api/cm_hopper_additional_phones',require(_0x4ec0('0x72')));_0x393d99[_0x4ec0('0x6')]('/api/templates',require(_0x4ec0('0x73')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x74'),require(_0x4ec0('0x75')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x76'),require(_0x4ec0('0x77')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x78'),require('./api/integration'));_0x393d99[_0x4ec0('0x6')]('/api/integrations/reports',require(_0x4ec0('0x79')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x7a'),require(_0x4ec0('0x7b')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x7c'),require(_0x4ec0('0x7d')));_0x393d99['use'](_0x4ec0('0x7e'),require(_0x4ec0('0x7f')));_0x393d99['use'](_0x4ec0('0x80'),require(_0x4ec0('0x81')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x82'),require(_0x4ec0('0x83')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x84'),require('./api/analyticTreeReport'));_0x393d99[_0x4ec0('0x6')]('/api/integrations/salesforce/accounts',require('./api/intSalesforceAccount'));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x85'),require(_0x4ec0('0x86')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x87'),require(_0x4ec0('0x88')));_0x393d99['use'](_0x4ec0('0x89'),require(_0x4ec0('0x8a')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x8b'),require(_0x4ec0('0x8c')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x8d'),require(_0x4ec0('0x8e')));_0x393d99['use']('/api/integrations/desk/accounts',require('./api/intDeskAccount'));_0x393d99[_0x4ec0('0x6')]('/api/integrations/desk/configurations',require('./api/intDeskConfiguration'));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x8f'),require('./api/intDeskField'));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x90'),require('./api/intZohoAccount'));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x91'),require(_0x4ec0('0x92')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x93'),require(_0x4ec0('0x94')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x95'),require(_0x4ec0('0x96')));_0x393d99[_0x4ec0('0x6')]('/api/integrations/zendesk/configurations',require('./api/intZendeskConfiguration'));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x97'),require(_0x4ec0('0x98')));_0x393d99['use'](_0x4ec0('0x99'),require('./api/intFreshdeskAccount'));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x9a'),require('./api/intFreshdeskConfiguration'));_0x393d99[_0x4ec0('0x6')]('/api/integrations/freshdesk/fields',require('./api/intFreshdeskField'));_0x393d99['use'](_0x4ec0('0x9b'),require(_0x4ec0('0x9c')));_0x393d99[_0x4ec0('0x6')]('/api/integrations/vtiger/configurations',require(_0x4ec0('0x9d')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x9e'),require(_0x4ec0('0x9f')));_0x393d99['use']('/api/integrations/servicenow/accounts',require(_0x4ec0('0xa0')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0xa1'),require(_0x4ec0('0xa2')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0xa3'),require(_0x4ec0('0xa4')));_0x393d99['use']('/api/integrations/dynamics365/accounts',require(_0x4ec0('0xa5')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0xa6'),require(_0x4ec0('0xa7')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0xa8'),require(_0x4ec0('0xa9')));_0x393d99[_0x4ec0('0x6')]('/api/integrations/freshsales/accounts',require('./api/intFreshsalesAccount'));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0xaa'),require(_0x4ec0('0xab')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0xac'),require('./api/intFreshsalesField'));_0x393d99['use'](_0x4ec0('0xad'),require(_0x4ec0('0xae')));_0x393d99[_0x4ec0('0x6')]('/api/chat/reports/queue',require(_0x4ec0('0xaf')));_0x393d99[_0x4ec0('0x6')]('/api/chat/internal/messages',require(_0x4ec0('0xb0')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0xb1'),require('./api/jscriptyAnswerReport'));_0x393d99['use']('/api/jscripty/questions/reports',require(_0x4ec0('0xb2')));_0x393d99[_0x4ec0('0x6')]('/api/jscripty/sessions/reports',require(_0x4ec0('0xb3')));_0x393d99['use'](_0x4ec0('0xb4'),require(_0x4ec0('0xb5')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0xb6'),require(_0x4ec0('0xb7')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0xb8'),require(_0x4ec0('0xb9')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0xba'),require(_0x4ec0('0xbb')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0xbc'),require(_0x4ec0('0xbd')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0xbe'),require(_0x4ec0('0xbf')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0xc0'),require(_0x4ec0('0xc1')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0xc2'),require(_0x4ec0('0xc3')));_0x393d99[_0x4ec0('0x6')]('/api/square/messages',require(_0x4ec0('0xc4')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0xc5'),require(_0x4ec0('0xc6')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0xc7'),require(_0x4ec0('0xc8')));_0x393d99[_0x4ec0('0x6')]('/api/campaigns',require(_0x4ec0('0xc9')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0xca'),require('./api/migration'));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0xcb'),require(_0x4ec0('0xcc')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0xcd'),require(_0x4ec0('0xce')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0xcf'),require(_0x4ec0('0xd0')));_0x393d99['use'](_0x4ec0('0xd1'),require('./api/chatTransferReport'));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0xd2'),require(_0x4ec0('0xd3')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0xd4'),require(_0x4ec0('0xd5')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0xd6'),require(_0x4ec0('0xd7')));_0x393d99['use'](_0x4ec0('0xd8'),require('./api/cmList'));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0xd9'),require(_0x4ec0('0xda')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0xdb'),require(_0x4ec0('0xdc')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0xdd'),require(_0x4ec0('0xde')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0xdf'),require(_0x4ec0('0xe0')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0xe1'),require(_0x4ec0('0xe2')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0xe3'),require(_0x4ec0('0xe4')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0xe5'),require(_0x4ec0('0xe6')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0xe7'),require(_0x4ec0('0xe8')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0xe9'),require('./api/whatsappMessage'));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0xea'),require(_0x4ec0('0xeb')));_0x393d99[_0x4ec0('0x6')]('/api/whatsapp/reports/transfer',require('./api/whatsappTransferReport'));_0x393d99['use'](_0x4ec0('0xec'),require(_0x4ec0('0xed')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0xee'),require('./api/cloudProvider'));_0x393d99['use'](_0x4ec0('0xef'),require(_0x4ec0('0xf0')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0xf1'),require(_0x4ec0('0xf2')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0xf3'),require(_0x4ec0('0xf4')));_0x393d99[_0x4ec0('0x6')]('/api/auth/google',require('./api/authGoogle'));_0x393d99['use'](_0x4ec0('0xf5'),require(_0x4ec0('0xf6')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0xf7'),require(_0x4ec0('0xf8')));_0x393d99['use']('/api/rpc',require(_0x4ec0('0xf9')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0xfa'),require(_0x4ec0('0xfb')));_0x393d99[_0x4ec0('0x6')]('/api/system',require(_0x4ec0('0xfc')));_0x393d99[_0x4ec0('0x6')]('/api/pm2',require('./api/pm2'));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0xfd'),require('./api/webbar'));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0xfe'),clientSideLogs);_0x393d99[_0x4ec0('0x6')](_0x4ec0('0xff'),express[_0x4ec0('0x100')](path[_0x4ec0('0x101')](config[_0x4ec0('0x102')],'/apidoc')));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x103'),express['static'](path[_0x4ec0('0x101')](config['root'],_0x4ec0('0x103'))));_0x393d99[_0x4ec0('0x6')]('/demo',express['static'](path['join'](config[_0x4ec0('0x102')],_0x4ec0('0x104'))));_0x393d99[_0x4ec0('0x6')](_0x4ec0('0x105'),express[_0x4ec0('0x100')](path[_0x4ec0('0x101')](config[_0x4ec0('0x102')],_0x4ec0('0x106'),'3.0.0')));_0x393d99[_0x4ec0('0x6')]('/plugins',express[_0x4ec0('0x100')](path[_0x4ec0('0x101')](config[_0x4ec0('0x102')],_0x4ec0('0x107'))));_0x393d99[_0x4ec0('0x108')]('/:url(api|auth|components|app|bower_components|assets)/*')['get'](errors[0x194]);_0x393d99[_0x4ec0('0x108')]('/*')[_0x4ec0('0x109')](function(_0x3d3909,_0x1f398a){_0x1f398a[_0x4ec0('0x10a')](path[_0x4ec0('0x10b')](_0x393d99[_0x4ec0('0x109')](_0x4ec0('0x10c'))+_0x4ec0('0x10d')));});return _0x393d99;});}; \ No newline at end of file +var _0xf7f3=['./api/rpc','/api/version','./api/version','/api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','join','root','/www','/demo','static','/snippet','snippet','3.0.0','/plugins','/server/files/plugins','route','resolve','get','appPath','express','./errors','./config/environment','setupLoggers','then','/api/users','./api/user','use','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/sms/accounts','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/tag','/api/contact_item_types','/api/cm_contact_has_items','./api/cmHopperAdditionalPhone','/api/templates','./api/template','./api/trigger','/api/variables','/api/integrations','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','./api/squareOdbc','/api/square/projects','./api/squareProject','./api/squareRecording','/api/square/messages','./api/team','/api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/whatsappAccount','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authActiveDirectory','./api/jira','/api/rpc'];(function(_0x50db94,_0x536efd){var _0x320e48=function(_0x577a7d){while(--_0x577a7d){_0x50db94['push'](_0x50db94['shift']());}};_0x320e48(++_0x536efd);}(_0xf7f3,0x123));var _0x3f7f=function(_0x4daa83,_0xf732b7){_0x4daa83=_0x4daa83-0x0;var _0x51c893=_0xf7f3[_0x4daa83];return _0x51c893;};'use strict';var path=require('path');var express=require(_0x3f7f('0x0'));var errors=require(_0x3f7f('0x1'));var config=require(_0x3f7f('0x2'));var setupLoggers=require('./utils/client-side-logger')[_0x3f7f('0x3')];var clientSideLogs=require('./api/client-side-logs');exports['default']=function(_0x3f5eb7){return setupLoggers(_0x3f5eb7)[_0x3f7f('0x4')](function(){_0x3f5eb7['use'](_0x3f7f('0x5'),require(_0x3f7f('0x6')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x8'),require('./api/voiceChanSpy'));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x9'),require(_0x3f7f('0xa')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0xb'),require(_0x3f7f('0xc')));_0x3f5eb7['use']('/api/voice/mohs',require('./api/voiceMusicOnHold'));_0x3f5eb7['use']('/api/voice/queues',require(_0x3f7f('0xd')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0xe'),require(_0x3f7f('0xf')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x10'),require('./api/screenRecording'));_0x3f5eb7['use'](_0x3f7f('0x11'),require(_0x3f7f('0x12')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x13'),require('./api/voiceMailMessage'));_0x3f5eb7['use'](_0x3f7f('0x14'),require(_0x3f7f('0x15')));_0x3f5eb7[_0x3f7f('0x7')]('/api/voice/dials/reports',require('./api/voiceDialReport'));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x16'),require(_0x3f7f('0x17')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x18'),require(_0x3f7f('0x19')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x1a'),require(_0x3f7f('0x1b')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x1c'),require('./api/trunk'));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x1d'),require('./api/voiceTransferReport'));_0x3f5eb7['use']('/api/mail/out_servers',require(_0x3f7f('0x1e')));_0x3f5eb7[_0x3f7f('0x7')]('/api/mail/accounts',require(_0x3f7f('0x1f')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x20'),require(_0x3f7f('0x21')));_0x3f5eb7['use'](_0x3f7f('0x22'),require(_0x3f7f('0x23')));_0x3f5eb7['use'](_0x3f7f('0x24'),require('./api/mailInteraction'));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x25'),require(_0x3f7f('0x26')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x27'),require(_0x3f7f('0x28')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x29'),require('./api/mailQueueReport'));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x2a'),require(_0x3f7f('0x2b')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x2c'),require(_0x3f7f('0x2d')));_0x3f5eb7[_0x3f7f('0x7')]('/api/fax/accounts',require(_0x3f7f('0x2e')));_0x3f5eb7['use']('/api/fax/applications',require(_0x3f7f('0x2f')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x30'),require(_0x3f7f('0x31')));_0x3f5eb7[_0x3f7f('0x7')]('/api/fax/messages',require(_0x3f7f('0x32')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x33'),require(_0x3f7f('0x34')));_0x3f5eb7[_0x3f7f('0x7')]('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x3f5eb7['use'](_0x3f7f('0x35'),require('./api/smsAccount'));_0x3f5eb7[_0x3f7f('0x7')]('/api/sms/applications',require(_0x3f7f('0x36')));_0x3f5eb7[_0x3f7f('0x7')]('/api/sms/interactions',require(_0x3f7f('0x37')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x38'),require(_0x3f7f('0x39')));_0x3f5eb7['use'](_0x3f7f('0x3a'),require(_0x3f7f('0x3b')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x3c'),require(_0x3f7f('0x3d')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x3e'),require('./api/openchannelApplication'));_0x3f5eb7['use'](_0x3f7f('0x3f'),require(_0x3f7f('0x40')));_0x3f5eb7[_0x3f7f('0x7')]('/api/openchannel/messages',require(_0x3f7f('0x41')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x42'),require(_0x3f7f('0x43')));_0x3f5eb7[_0x3f7f('0x7')]('/api/chat/websites',require('./api/chatWebsite'));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x44'),require(_0x3f7f('0x45')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x46'),require('./api/chatApplication'));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x47'),require(_0x3f7f('0x48')));_0x3f5eb7[_0x3f7f('0x7')]('/api/chat/messages',require(_0x3f7f('0x49')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x4a'),require(_0x3f7f('0x4b')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x4c'),require(_0x3f7f('0x4d')));_0x3f5eb7['use'](_0x3f7f('0x4e'),require('./api/chatGroup'));_0x3f5eb7['use']('/api/chat/proactive_actions',require(_0x3f7f('0x4f')));_0x3f5eb7['use'](_0x3f7f('0x50'),require(_0x3f7f('0x51')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x52'),require('./api/cmContact'));_0x3f5eb7['use']('/api/cm/hopper',require(_0x3f7f('0x53')));_0x3f5eb7['use'](_0x3f7f('0x54'),require(_0x3f7f('0x55')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x56'),require(_0x3f7f('0x57')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x58'),require(_0x3f7f('0x59')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x5a'),require(_0x3f7f('0x5b')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x5c'),require('./api/action'));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x5d'),require(_0x3f7f('0x5e')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x5f'),require(_0x3f7f('0x60')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x61'),require(_0x3f7f('0x62')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x63'),require(_0x3f7f('0x64')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x65'),require(_0x3f7f('0x66')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x67'),require(_0x3f7f('0x68')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x69'),require('./api/cdr'));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x6a'),require(_0x3f7f('0x6b')));_0x3f5eb7['use'](_0x3f7f('0x6c'),require(_0x3f7f('0x6d')));_0x3f5eb7['use'](_0x3f7f('0x6e'),require('./api/sound'));_0x3f5eb7[_0x3f7f('0x7')]('/api/tags',require(_0x3f7f('0x6f')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x70'),require('./api/contactItemType'));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x71'),require('./api/cmContactHasItem'));_0x3f5eb7[_0x3f7f('0x7')]('/api/cm_hopper_additional_phones',require(_0x3f7f('0x72')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x73'),require(_0x3f7f('0x74')));_0x3f5eb7['use']('/api/triggers',require(_0x3f7f('0x75')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x76'),require('./api/variable'));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x77'),require(_0x3f7f('0x78')));_0x3f5eb7[_0x3f7f('0x7')]('/api/integrations/reports',require(_0x3f7f('0x79')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x7a'),require(_0x3f7f('0x7b')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x7c'),require(_0x3f7f('0x7d')));_0x3f5eb7['use']('/api/analytics/extracted_reports',require(_0x3f7f('0x7e')));_0x3f5eb7['use'](_0x3f7f('0x7f'),require('./api/analyticMetric'));_0x3f5eb7[_0x3f7f('0x7')]('/api/analytics/field_reports',require(_0x3f7f('0x80')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x81'),require(_0x3f7f('0x82')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x83'),require(_0x3f7f('0x84')));_0x3f5eb7[_0x3f7f('0x7')]('/api/integrations/salesforce/configurations',require(_0x3f7f('0x85')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x86'),require(_0x3f7f('0x87')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x88'),require(_0x3f7f('0x89')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x8a'),require(_0x3f7f('0x8b')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x8c'),require(_0x3f7f('0x8d')));_0x3f5eb7['use']('/api/integrations/desk/accounts',require('./api/intDeskAccount'));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x8e'),require(_0x3f7f('0x8f')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x90'),require('./api/intDeskField'));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x91'),require(_0x3f7f('0x92')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x93'),require(_0x3f7f('0x94')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x95'),require('./api/intZohoField'));_0x3f5eb7['use'](_0x3f7f('0x96'),require(_0x3f7f('0x97')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x98'),require(_0x3f7f('0x99')));_0x3f5eb7['use']('/api/integrations/zendesk/fields',require('./api/intZendeskField'));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x9a'),require('./api/intFreshdeskAccount'));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x9b'),require(_0x3f7f('0x9c')));_0x3f5eb7[_0x3f7f('0x7')]('/api/integrations/freshdesk/fields',require('./api/intFreshdeskField'));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x9d'),require(_0x3f7f('0x9e')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x9f'),require(_0x3f7f('0xa0')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0xa1'),require(_0x3f7f('0xa2')));_0x3f5eb7['use']('/api/integrations/servicenow/accounts',require(_0x3f7f('0xa3')));_0x3f5eb7['use'](_0x3f7f('0xa4'),require('./api/intServicenowConfiguration'));_0x3f5eb7['use'](_0x3f7f('0xa5'),require('./api/intServicenowField'));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0xa6'),require(_0x3f7f('0xa7')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0xa8'),require(_0x3f7f('0xa9')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0xaa'),require(_0x3f7f('0xab')));_0x3f5eb7['use'](_0x3f7f('0xac'),require(_0x3f7f('0xad')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0xae'),require('./api/intFreshsalesConfiguration'));_0x3f5eb7['use']('/api/integrations/freshsales/fields',require(_0x3f7f('0xaf')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0xb0'),require(_0x3f7f('0xb1')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0xb2'),require(_0x3f7f('0xb3')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0xb4'),require(_0x3f7f('0xb5')));_0x3f5eb7[_0x3f7f('0x7')]('/api/jscripty/answers/reports',require(_0x3f7f('0xb6')));_0x3f5eb7['use'](_0x3f7f('0xb7'),require(_0x3f7f('0xb8')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0xb9'),require('./api/jscriptySessionReport'));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0xba'),require('./api/smsQueueReport'));_0x3f5eb7['use'](_0x3f7f('0xbb'),require('./api/squareReport'));_0x3f5eb7['use'](_0x3f7f('0xbc'),require(_0x3f7f('0xbd')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0xbe'),require(_0x3f7f('0xbf')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0xc0'),require(_0x3f7f('0xc1')));_0x3f5eb7[_0x3f7f('0x7')]('/api/square/odbc',require(_0x3f7f('0xc2')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0xc3'),require(_0x3f7f('0xc4')));_0x3f5eb7['use']('/api/square/recordings',require(_0x3f7f('0xc5')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0xc6'),require('./api/squareMessage'));_0x3f5eb7[_0x3f7f('0x7')]('/api/teams',require(_0x3f7f('0xc7')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0xc8'),require('./api/license'));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0xc9'),require(_0x3f7f('0xca')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0xcb'),require(_0x3f7f('0xcc')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0xcd'),require(_0x3f7f('0xce')));_0x3f5eb7['use'](_0x3f7f('0xcf'),require('./api/plugin'));_0x3f5eb7[_0x3f7f('0x7')]('/api/mail/reports/transfer',require(_0x3f7f('0xd0')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0xd1'),require('./api/chatTransferReport'));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0xd2'),require(_0x3f7f('0xd3')));_0x3f5eb7['use'](_0x3f7f('0xd4'),require(_0x3f7f('0xd5')));_0x3f5eb7['use']('/api/sms/reports/transfer',require(_0x3f7f('0xd6')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0xd7'),require('./api/cmList'));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0xd8'),require(_0x3f7f('0xd9')));_0x3f5eb7['use']('/api/userProfiles',require(_0x3f7f('0xda')));_0x3f5eb7['use'](_0x3f7f('0xdb'),require(_0x3f7f('0xdc')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0xdd'),require(_0x3f7f('0xde')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0xdf'),require('./api/userNotification'));_0x3f5eb7['use']('/api/whatsapp/accounts',require(_0x3f7f('0xe0')));_0x3f5eb7[_0x3f7f('0x7')]('/api/whatsapp/applications',require(_0x3f7f('0xe1')));_0x3f5eb7['use']('/api/whatsapp/interactions',require(_0x3f7f('0xe2')));_0x3f5eb7[_0x3f7f('0x7')]('/api/whatsapp/messages',require('./api/whatsappMessage'));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0xe3'),require(_0x3f7f('0xe4')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0xe5'),require(_0x3f7f('0xe6')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0xe7'),require(_0x3f7f('0xe8')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0xe9'),require('./api/cloudProvider'));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0xea'),require('./api/realtime'));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0xeb'),require(_0x3f7f('0xec')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0xed'),require(_0x3f7f('0xee')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0xef'),require('./api/authGoogle'));_0x3f5eb7[_0x3f7f('0x7')]('/api/auth/activedirectory',require(_0x3f7f('0xf0')));_0x3f5eb7['use']('/api/jira',require(_0x3f7f('0xf1')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0xf2'),require(_0x3f7f('0xf3')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0xf4'),require(_0x3f7f('0xf5')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0xf6'),require('./api/system'));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0xf7'),require(_0x3f7f('0xf8')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0xf9'),require(_0x3f7f('0xfa')));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0xfb'),clientSideLogs);_0x3f5eb7['use'](_0x3f7f('0xfc'),express['static'](path[_0x3f7f('0xfd')](config[_0x3f7f('0xfe')],_0x3f7f('0xfc'))));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0xff'),express['static'](path[_0x3f7f('0xfd')](config[_0x3f7f('0xfe')],_0x3f7f('0xff'))));_0x3f5eb7['use'](_0x3f7f('0x100'),express[_0x3f7f('0x101')](path['join'](config[_0x3f7f('0xfe')],_0x3f7f('0x100'))));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x102'),express[_0x3f7f('0x101')](path['join'](config[_0x3f7f('0xfe')],_0x3f7f('0x103'),_0x3f7f('0x104'))));_0x3f5eb7[_0x3f7f('0x7')](_0x3f7f('0x105'),express[_0x3f7f('0x101')](path[_0x3f7f('0xfd')](config[_0x3f7f('0xfe')],_0x3f7f('0x106'))));_0x3f5eb7[_0x3f7f('0x107')]('/:url(api|auth|components|app|bower_components|assets)/*')['get'](errors[0x194]);_0x3f5eb7['route']('/*')['get'](function(_0xde1a7d,_0x122158){_0x122158['sendFile'](path[_0x3f7f('0x108')](_0x3f5eb7[_0x3f7f('0x109')](_0x3f7f('0x10a'))+'/index.html'));});return _0x3f5eb7;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index e858f8a..dc0c531 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa82b=['../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.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/campaign/campaign.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','http','rpc','port','localhost','error','log','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.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/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc'];(function(_0x32d6f0,_0x20bd82){var _0x48540f=function(_0x48fb0f){while(--_0x48fb0f){_0x32d6f0['push'](_0x32d6f0['shift']());}};_0x48540f(++_0x20bd82);}(_0xa82b,0x18d));var _0xba82=function(_0x5b5947,_0x11623c){_0x5b5947=_0x5b5947-0x0;var _0x7623e0=_0xa82b[_0x5b5947];return _0x7623e0;};'use strict';var jayson=require(_0xba82('0x0'));var _=require(_0xba82('0x1'));var config=require(_0xba82('0x2'));exports[_0xba82('0x3')]=function(){return new Promise(function(_0x1576a6,_0x10bb66){var _0x589af5={};_0x589af5=_[_0xba82('0x4')](_0x589af5,require(_0xba82('0x5')));_0x589af5=_['merge'](_0x589af5,require('../api/voiceExtension/voiceExtension.rpc'));_0x589af5=_[_0xba82('0x4')](_0x589af5,require(_0xba82('0x6')));_0x589af5=_['merge'](_0x589af5,require(_0xba82('0x7')));_0x589af5=_[_0xba82('0x4')](_0x589af5,require(_0xba82('0x8')));_0x589af5=_[_0xba82('0x4')](_0x589af5,require(_0xba82('0x9')));_0x589af5=_[_0xba82('0x4')](_0x589af5,require(_0xba82('0xa')));_0x589af5=_['merge'](_0x589af5,require(_0xba82('0xb')));_0x589af5=_[_0xba82('0x4')](_0x589af5,require(_0xba82('0xc')));_0x589af5=_[_0xba82('0x4')](_0x589af5,require(_0xba82('0xd')));_0x589af5=_[_0xba82('0x4')](_0x589af5,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x589af5=_[_0xba82('0x4')](_0x589af5,require(_0xba82('0xe')));_0x589af5=_[_0xba82('0x4')](_0x589af5,require(_0xba82('0xf')));_0x589af5=_[_0xba82('0x4')](_0x589af5,require(_0xba82('0x10')));_0x589af5=_['merge'](_0x589af5,require(_0xba82('0x11')));_0x589af5=_[_0xba82('0x4')](_0x589af5,require('../api/mailInteraction/mailInteraction.rpc'));_0x589af5=_['merge'](_0x589af5,require(_0xba82('0x12')));_0x589af5=_[_0xba82('0x4')](_0x589af5,require(_0xba82('0x13')));_0x589af5=_[_0xba82('0x4')](_0x589af5,require(_0xba82('0x14')));_0x589af5=_[_0xba82('0x4')](_0x589af5,require(_0xba82('0x15')));_0x589af5=_[_0xba82('0x4')](_0x589af5,require('../api/faxApplication/faxApplication.rpc'));_0x589af5=_[_0xba82('0x4')](_0x589af5,require('../api/faxInteraction/faxInteraction.rpc'));_0x589af5=_[_0xba82('0x4')](_0x589af5,require(_0xba82('0x16')));_0x589af5=_[_0xba82('0x4')](_0x589af5,require('../api/faxQueue/faxQueue.rpc'));_0x589af5=_[_0xba82('0x4')](_0x589af5,require(_0xba82('0x17')));_0x589af5=_[_0xba82('0x4')](_0x589af5,require('../api/smsAccount/smsAccount.rpc'));_0x589af5=_[_0xba82('0x4')](_0x589af5,require(_0xba82('0x18')));_0x589af5=_[_0xba82('0x4')](_0x589af5,require(_0xba82('0x19')));_0x589af5=_['merge'](_0x589af5,require('../api/smsQueue/smsQueue.rpc'));_0x589af5=_[_0xba82('0x4')](_0x589af5,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x589af5=_['merge'](_0x589af5,require(_0xba82('0x1a')));_0x589af5=_[_0xba82('0x4')](_0x589af5,require(_0xba82('0x1b')));_0x589af5=_[_0xba82('0x4')](_0x589af5,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x589af5=_[_0xba82('0x4')](_0x589af5,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x589af5=_[_0xba82('0x4')](_0x589af5,require(_0xba82('0x1c')));_0x589af5=_['merge'](_0x589af5,require(_0xba82('0x1d')));_0x589af5=_['merge'](_0x589af5,require(_0xba82('0x1e')));_0x589af5=_[_0xba82('0x4')](_0x589af5,require('../api/cmContact/cmContact.rpc'));_0x589af5=_['merge'](_0x589af5,require('../api/cmHopper/cmHopper.rpc'));_0x589af5=_[_0xba82('0x4')](_0x589af5,require(_0xba82('0x1f')));_0x589af5=_[_0xba82('0x4')](_0x589af5,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x589af5=_['merge'](_0x589af5,require(_0xba82('0x20')));_0x589af5=_[_0xba82('0x4')](_0x589af5,require(_0xba82('0x21')));_0x589af5=_[_0xba82('0x4')](_0x589af5,require(_0xba82('0x22')));_0x589af5=_[_0xba82('0x4')](_0x589af5,require(_0xba82('0x23')));_0x589af5=_[_0xba82('0x4')](_0x589af5,require(_0xba82('0x24')));_0x589af5=_[_0xba82('0x4')](_0x589af5,require(_0xba82('0x25')));_0x589af5=_[_0xba82('0x4')](_0x589af5,require(_0xba82('0x26')));_0x589af5=_[_0xba82('0x4')](_0x589af5,require(_0xba82('0x27')));_0x589af5=_[_0xba82('0x4')](_0x589af5,require(_0xba82('0x28')));_0x589af5=_[_0xba82('0x4')](_0x589af5,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x589af5=_['merge'](_0x589af5,require(_0xba82('0x29')));_0x589af5=_['merge'](_0x589af5,require(_0xba82('0x2a')));_0x589af5=_[_0xba82('0x4')](_0x589af5,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x589af5=_[_0xba82('0x4')](_0x589af5,require(_0xba82('0x2b')));_0x589af5=_[_0xba82('0x4')](_0x589af5,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x589af5=_[_0xba82('0x4')](_0x589af5,require(_0xba82('0x2c')));_0x589af5=_[_0xba82('0x4')](_0x589af5,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x589af5=_[_0xba82('0x4')](_0x589af5,require(_0xba82('0x2d')));_0x589af5=_[_0xba82('0x4')](_0x589af5,require(_0xba82('0x2e')));_0x589af5=_[_0xba82('0x4')](_0x589af5,require(_0xba82('0x2f')));_0x589af5=_[_0xba82('0x4')](_0x589af5,require(_0xba82('0x30')));_0x589af5=_[_0xba82('0x4')](_0x589af5,require(_0xba82('0x31')));_0x589af5=_[_0xba82('0x4')](_0x589af5,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x589af5=_[_0xba82('0x4')](_0x589af5,require(_0xba82('0x32')));_0x589af5=_[_0xba82('0x4')](_0x589af5,require(_0xba82('0x33')));_0x589af5=_[_0xba82('0x4')](_0x589af5,require(_0xba82('0x34')));_0x589af5=_['merge'](_0x589af5,require(_0xba82('0x35')));_0x589af5=_['merge'](_0x589af5,require('../api/squareMessage/squareMessage.rpc'));_0x589af5=_[_0xba82('0x4')](_0x589af5,require(_0xba82('0x36')));_0x589af5=_['merge'](_0x589af5,require('../api/attachment/attachment.rpc'));_0x589af5=_[_0xba82('0x4')](_0x589af5,require('../api/plugin/plugin.rpc'));_0x589af5=_['merge'](_0x589af5,require(_0xba82('0x37')));_0x589af5=_[_0xba82('0x4')](_0x589af5,require(_0xba82('0x38')));_0x589af5=_[_0xba82('0x4')](_0x589af5,require(_0xba82('0x39')));_0x589af5=_[_0xba82('0x4')](_0x589af5,require(_0xba82('0x3a')));_0x589af5=_[_0xba82('0x4')](_0x589af5,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x5e74f7=jayson[_0xba82('0x3b')](_0x589af5)[_0xba82('0x3c')]();var _0x2eb63a=config[_0xba82('0x3d')][_0xba82('0x3e')]||config[_0xba82('0x3e')]+0x1;var _0x195a55=config['rpc']['ip']||_0xba82('0x3f');_0x5e74f7['on'](_0xba82('0x40'),function(_0x2e6556){return _0x10bb66(_0x2e6556);});_0x5e74f7[_0xba82('0x3')](_0x2eb63a,_0x195a55,function(){console[_0xba82('0x41')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x195a55,_0x2eb63a);require(_0xba82('0x42'))[_0xba82('0x43')]();return _0x1576a6(_0xba82('0x44')+_0x195a55+':'+_0x2eb63a);});});}; \ No newline at end of file +var _0x5946=['server','http','rpc','port','localhost','log','../config/triggers','default','RPC\x20listening\x20on\x20','lodash','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.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/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/cmHopperHistory/cmHopperHistory.rpc','../api/pause/pause.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.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/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc'];(function(_0x5958c6,_0x5615c5){var _0x431da4=function(_0x5752e5){while(--_0x5752e5){_0x5958c6['push'](_0x5958c6['shift']());}};_0x431da4(++_0x5615c5);}(_0x5946,0x8f));var _0x6594=function(_0x400322,_0x4353a8){_0x400322=_0x400322-0x0;var _0xfdd597=_0x5946[_0x400322];return _0xfdd597;};'use strict';var jayson=require('jayson/promise');var _=require(_0x6594('0x0'));var config=require('../config/environment');exports[_0x6594('0x1')]=function(){return new Promise(function(_0x42e9e3,_0x28e298){var _0x464e96={};_0x464e96=_[_0x6594('0x2')](_0x464e96,require('../api/user/user.rpc'));_0x464e96=_['merge'](_0x464e96,require(_0x6594('0x3')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require(_0x6594('0x4')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require('../api/voiceRecording/voiceRecording.rpc'));_0x464e96=_[_0x6594('0x2')](_0x464e96,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x464e96=_[_0x6594('0x2')](_0x464e96,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x464e96=_['merge'](_0x464e96,require(_0x6594('0x5')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require(_0x6594('0x6')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require('../api/memberReport/memberReport.rpc'));_0x464e96=_[_0x6594('0x2')](_0x464e96,require(_0x6594('0x7')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require(_0x6594('0x8')));_0x464e96=_['merge'](_0x464e96,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x464e96=_['merge'](_0x464e96,require('../api/mailServerIn/mailServerIn.rpc'));_0x464e96=_[_0x6594('0x2')](_0x464e96,require(_0x6594('0x9')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require(_0x6594('0xa')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require(_0x6594('0xb')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require(_0x6594('0xc')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require(_0x6594('0xd')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require(_0x6594('0xe')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require(_0x6594('0xf')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require(_0x6594('0x10')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require(_0x6594('0x11')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require('../api/faxMessage/faxMessage.rpc'));_0x464e96=_[_0x6594('0x2')](_0x464e96,require(_0x6594('0x12')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require(_0x6594('0x13')));_0x464e96=_['merge'](_0x464e96,require(_0x6594('0x14')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require(_0x6594('0x15')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require(_0x6594('0x16')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require(_0x6594('0x17')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require(_0x6594('0x18')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require(_0x6594('0x19')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require(_0x6594('0x1a')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x464e96=_[_0x6594('0x2')](_0x464e96,require(_0x6594('0x1b')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require(_0x6594('0x1c')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require(_0x6594('0x1d')));_0x464e96=_['merge'](_0x464e96,require(_0x6594('0x1e')));_0x464e96=_['merge'](_0x464e96,require(_0x6594('0x1f')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require(_0x6594('0x20')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require(_0x6594('0x21')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x464e96=_['merge'](_0x464e96,require(_0x6594('0x22')));_0x464e96=_['merge'](_0x464e96,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x464e96=_[_0x6594('0x2')](_0x464e96,require('../api/interval/interval.rpc'));_0x464e96=_[_0x6594('0x2')](_0x464e96,require(_0x6594('0x23')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require('../api/sound/sound.rpc'));_0x464e96=_[_0x6594('0x2')](_0x464e96,require(_0x6594('0x24')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require(_0x6594('0x25')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require(_0x6594('0x26')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require(_0x6594('0x27')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x464e96=_[_0x6594('0x2')](_0x464e96,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x464e96=_[_0x6594('0x2')](_0x464e96,require(_0x6594('0x28')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require(_0x6594('0x29')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require(_0x6594('0x2a')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x464e96=_[_0x6594('0x2')](_0x464e96,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x464e96=_[_0x6594('0x2')](_0x464e96,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x464e96=_['merge'](_0x464e96,require(_0x6594('0x2b')));_0x464e96=_['merge'](_0x464e96,require(_0x6594('0x2c')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require(_0x6594('0x2d')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require(_0x6594('0x2e')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require(_0x6594('0x2f')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x464e96=_[_0x6594('0x2')](_0x464e96,require(_0x6594('0x30')));_0x464e96=_['merge'](_0x464e96,require(_0x6594('0x31')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require('../api/squareProject/squareProject.rpc'));_0x464e96=_[_0x6594('0x2')](_0x464e96,require('../api/squareRecording/squareRecording.rpc'));_0x464e96=_[_0x6594('0x2')](_0x464e96,require(_0x6594('0x32')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require(_0x6594('0x33')));_0x464e96=_['merge'](_0x464e96,require(_0x6594('0x34')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require('../api/plugin/plugin.rpc'));_0x464e96=_[_0x6594('0x2')](_0x464e96,require(_0x6594('0x35')));_0x464e96=_['merge'](_0x464e96,require(_0x6594('0x36')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require(_0x6594('0x37')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require(_0x6594('0x38')));_0x464e96=_[_0x6594('0x2')](_0x464e96,require(_0x6594('0x39')));var _0x58998c=jayson[_0x6594('0x3a')](_0x464e96)[_0x6594('0x3b')]();var _0x402368=config[_0x6594('0x3c')][_0x6594('0x3d')]||config[_0x6594('0x3d')]+0x1;var _0x4f28c1=config[_0x6594('0x3c')]['ip']||_0x6594('0x3e');_0x58998c['on']('error',function(_0x7cb356){return _0x28e298(_0x7cb356);});_0x58998c[_0x6594('0x1')](_0x402368,_0x4f28c1,function(){console[_0x6594('0x3f')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x4f28c1,_0x402368);require(_0x6594('0x40'))[_0x6594('0x41')]();return _0x42e9e3(_0x6594('0x42')+_0x4f28c1+':'+_0x402368);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index eb0bdc1..03b77b8 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 _0x2df7=['error','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','prototype','sendRequest','sync','answer','ANSWER','getData','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','format','exec','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','setPriority','setVariable','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','noop','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','util','events','EventEmitter','./reply','./error','call','utf8','setTimeout','headers','emit','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','startsWith','split','length','match'];(function(_0x1e7f4d,_0x20acaa){var _0x5f0fd9=function(_0x4dbbf4){while(--_0x4dbbf4){_0x1e7f4d['push'](_0x1e7f4d['shift']());}};_0x5f0fd9(++_0x20acaa);}(_0x2df7,0x1f4));var _0x72df=function(_0x12d2e6,_0x116e80){_0x12d2e6=_0x12d2e6-0x0;var _0x35961a=_0x2df7[_0x12d2e6];return _0x35961a;};'use strict';var util=require(_0x72df('0x0'));var _=require('lodash');var EventEmitter=require(_0x72df('0x1'))[_0x72df('0x2')];var AGIReply=require(_0x72df('0x3'));var AGIError=require(_0x72df('0x4'));function AGIChannel(_0x6cebd5){var _0x2456ac=this,_0x5cea20=new AGIReply(),_0x236207=![],_0x384cd2={};EventEmitter[_0x72df('0x5')](_0x2456ac);_0x6cebd5['setEncoding'](_0x72df('0x6'));_0x6cebd5[_0x72df('0x7')](0x8*0x3c*0x3c*0x3e8);_0x5cea20['setEncoding']('utf8');_0x5cea20['on'](_0x72df('0x8'),function(_0x3e09ad){for(var _0x5d8fc7 in _0x3e09ad){_0x2456ac[_0x5d8fc7]=_0x3e09ad[_0x5d8fc7];}_0x2456ac[_0x72df('0x9')]('ready');});_0x5cea20['on']('line',function(_0x1ed101){if(_0x1ed101[_0x72df('0xa')]()==_0x72df('0xb')){_0x2456ac[_0x72df('0x9')](_0x72df('0xb'));return;}if(_0x1ed101[_0x72df('0xc')](0x0,0xb)==_0x72df('0xd')){_0x236207=!![];}if(_0x236207){_0x384cd2['rx']+=_0x1ed101+'\x0a';if(_0x1ed101[_0x72df('0xe')](_0x72df('0xf'))!=-0x1){_0x236207=![];}}else{_0x384cd2['rx']=_0x1ed101;}if(_0x236207){return;}if(typeof _0x384cd2['cb']==_0x72df('0x10')){var _0x3a5acc=_0x384cd2['rx'][_0x72df('0xc')](0x0,0x3),_0x4f12b3=null,_0x2fe129=null;_0x3a5acc=parseInt(_0x3a5acc);if(isNaN(_0x3a5acc)){_0x384cd2['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x72df('0x11')});return;}if(_0x3a5acc!=0xc8){_0x384cd2['cb'](null,{'code':_0x3a5acc,'result':-0x1,'extra':'KO'});return;}_0x4f12b3=_0x384cd2['rx']['substring'](0x4)[_0x72df('0x12')](_0x72df('0x13'),'');if(_0x4f12b3[_0x72df('0x14')]('\x20')!=-0x1){_0x4f12b3=_0x4f12b3['substr'](0x0,_0x4f12b3[_0x72df('0x14')]('\x20'));}if(_[_0x72df('0x15')](_0x4f12b3,'-1')){_0x4f12b3=parseInt(_0x4f12b3);}_0x2fe129=_0x384cd2['rx'][_0x72df('0x16')]('\x20');if(_0x2fe129[_0x72df('0x17')]==0x3){_0x2fe129=_0x2fe129[0x2]['substring'](0x1,_0x2fe129[0x2][_0x72df('0x17')]-0x1);}else if(_0x2fe129[_0x72df('0x17')]>0x3){var _0x357637=/\((.+)\)/;var _0x726ed4=_0x384cd2['rx'][_0x72df('0x18')](_0x357637);if(_0x726ed4){_0x2fe129=_0x726ed4[0x1];}else{_0x2fe129=null;}}else{_0x2fe129=null;}_0x384cd2['cb'](null,{'code':_0x3a5acc,'result':_0x4f12b3,'extra':_0x2fe129});}});_0x6cebd5['on'](_0x72df('0x19'),function(_0x3ad354){_0x2456ac[_0x72df('0x9')](_0x72df('0x19'),new AGIError('E_AGI_SOCKET_ERROR',_0x3ad354[_0x72df('0x1a')]));});_0x6cebd5['on'](_0x72df('0x1b'),function(){_0x2456ac[_0x72df('0x9')](_0x72df('0x1b'),new AGIError(_0x72df('0x1c')));});_0x6cebd5['on'](_0x72df('0x1d'),function(){_0x2456ac[_0x72df('0x9')](_0x72df('0x1d'),new AGIError(_0x72df('0x1e')));_0x6cebd5[_0x72df('0x1f')]();});_0x6cebd5[_0x72df('0x20')](_0x5cea20);this[_0x72df('0x21')]=function(_0x547efa,_0x51b454){var _0x547efa=_0x547efa||'',_0x51b454=typeof _0x51b454==_0x72df('0x10')?_0x51b454:new Function();_0x384cd2={'tx':_0x547efa,'rx':'','cb':_0x51b454};_0x6cebd5[_0x72df('0x22')](_0x547efa+'\x0a');},this[_0x72df('0x1b')]=function(){_0x6cebd5['destroy']();};}util[_0x72df('0x23')](AGIChannel,EventEmitter);AGIChannel[_0x72df('0x24')][_0x72df('0x25')]=function(_0x5dc89b){return this[_0x72df('0x21')][_0x72df('0x26')](this,_0x5dc89b);};AGIChannel[_0x72df('0x24')][_0x72df('0x27')]=function(){return this[_0x72df('0x25')](_0x72df('0x28'));};AGIChannel[_0x72df('0x24')][_0x72df('0x29')]=function(_0x417098,_0xe154d4,_0x5bf8f8){_0x417098=_0x417098===undefined?'beep':_0x417098;_0xe154d4=_0xe154d4===undefined?'5':_0xe154d4;_0x5bf8f8=_0x5bf8f8===undefined?'1':_0x5bf8f8;return this[_0x72df('0x25')](util['format'](_0x72df('0x2a'),_0x417098,_0xe154d4*0x3e8,_0x5bf8f8));};AGIChannel['prototype']['noop']=function(_0x5572d2){_0x5572d2=_0x5572d2||'NO\x20MESSAGE';return this[_0x72df('0x25')](util[_0x72df('0x2b')]('VERBOSE\x20\x22%s\x22',_0x5572d2));};AGIChannel[_0x72df('0x24')][_0x72df('0x2c')]=function(_0xaf22ab,_0x1d6b62){if(_[_0x72df('0x2d')](_0x1d6b62)){return this[_0x72df('0x25')](util[_0x72df('0x2b')]('EXEC\x20%s\x20%s',_0xaf22ab,_0x1d6b62['join'](',')));}return this[_0x72df('0x25')](util[_0x72df('0x2b')](_0x72df('0x2e'),_0xaf22ab,_0x1d6b62));};AGIChannel['prototype'][_0x72df('0x2f')]=function(_0x44e2cc){return this['sendRequest'](util['format'](_0x72df('0x30'),_0x44e2cc));};AGIChannel[_0x72df('0x24')][_0x72df('0x31')]=function(_0x4c8e52){return this['sendRequest'](util['format']('SET\x20EXTENSION\x20%s',_0x4c8e52));};AGIChannel[_0x72df('0x24')][_0x72df('0x32')]=function(_0xd26df6){return this[_0x72df('0x25')](util[_0x72df('0x2b')]('SET\x20PRIORITY\x20%s',_0xd26df6));};AGIChannel[_0x72df('0x24')][_0x72df('0xb')]=function(){return this[_0x72df('0x25')]('HANGUP');};AGIChannel['prototype'][_0x72df('0x33')]=function(_0x1b8f74,_0x1a978b){var _0x2ee630=_['isBoolean'](_0x1a978b)||_['isNumber'](_0x1a978b)?_0x1a978b['toString']():_0x1a978b;return this[_0x72df('0x25')](util[_0x72df('0x2b')](_0x72df('0x34'),_0x1b8f74,_0x2ee630?_0x2ee630['toString']()[_0x72df('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x72df('0x24')][_0x72df('0x35')]=function(_0x455ca9,_0x25a33e){return this[_0x72df('0x25')](util[_0x72df('0x2b')](_0x72df('0x36'),_0x455ca9,_0x25a33e));};AGIChannel[_0x72df('0x24')][_0x72df('0x37')]=function(_0x211939,_0x3bdab6){return this[_0x72df('0x25')](util[_0x72df('0x2b')](_0x72df('0x38'),_0x211939,_0x3bdab6));};AGIChannel[_0x72df('0x24')]['sayPhonetic']=function(_0x3f385e,_0x67641d){return this[_0x72df('0x25')](util['format'](_0x72df('0x39'),_0x3f385e,_0x67641d));};AGIChannel[_0x72df('0x24')][_0x72df('0x3a')]=function(_0x300ef9,_0x1eb2f5,_0x11a5af){_0x1eb2f5=_0x1eb2f5||this['extension'];_0x11a5af=_0x11a5af||0x1;this[_0x72df('0x2f')](_0x300ef9);this[_0x72df('0x31')](_0x1eb2f5);this[_0x72df('0x32')](_0x11a5af);return this[_0x72df('0x3b')](util[_0x72df('0x2b')](_0x72df('0x3c'),_0x300ef9,_0x1eb2f5,_0x11a5af));};AGIChannel[_0x72df('0x24')][_0x72df('0x3d')]=function(_0x11f470){return this[_0x72df('0x25')](util[_0x72df('0x2b')](_0x72df('0x3e'),_0x11f470));};AGIChannel['prototype'][_0x72df('0x3f')]=function(_0x51667b,_0x1d9665,_0x4885b6,_0x794df8,_0x2e8571,_0x18ad28){_0x1d9665=_0x1d9665||_0x72df('0x40');_0x4885b6=_0x4885b6||'';_0x794df8=_0x794df8===undefined?-0x1:_0x794df8==='-1'?-0x1:_0x794df8*0x3e8;_0x2e8571=_0x2e8571===undefined?'':'s='+_0x2e8571;_0x18ad28=_0x18ad28?_0x72df('0x41'):'';return this['sendRequest'](util[_0x72df('0x2b')](_0x72df('0x42'),_0x51667b,_0x1d9665,_0x4885b6,_0x794df8,_0x18ad28,_0x2e8571));};AGIChannel[_0x72df('0x24')][_0x72df('0x43')]=function(_0x5f1f57,_0x5124e3){_0x5124e3=_0x5124e3||'';return this['sendRequest'](util['format'](_0x72df('0x44'),_0x5f1f57,_0x5124e3));};AGIChannel[_0x72df('0x24')][_0x72df('0x45')]=function(_0x1b14f8){return this[_0x72df('0x2c')](_0x72df('0x46'),_0x1b14f8);};AGIChannel['prototype'][_0x72df('0x47')]=function(_0x18cc00){return this['exec'](_0x72df('0x48'),_0x18cc00);};AGIChannel[_0x72df('0x24')][_0x72df('0x19')]=function(_0x5b4858,_0x2a7b6c){this[_0x72df('0x3b')](util['format'](_0x72df('0x49'),_0x5b4858['id'],_0x5b4858['label'],_0x2a7b6c));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x72df('0x4a')]=AGIChannel; \ No newline at end of file +var _0xb2ec=['wav','BEEP','streamFile','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','no\x20code','replace','result=','indexOf','startsWith','split','length','error','code','timeout','E_AGI_SOCKET_TIMEOUT','pipe','function','write','close','destroy','inherits','prototype','sendRequest','sync','getData','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','SET\x20CONTEXT\x20%s','setPriority','SET\x20PRIORITY\x20%s','setVariable','isBoolean','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setContext','setExtension','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile'];(function(_0x232ec0,_0x45fdd0){var _0x356705=function(_0x4099ea){while(--_0x4099ea){_0x232ec0['push'](_0x232ec0['shift']());}};_0x356705(++_0x45fdd0);}(_0xb2ec,0x1de));var _0xcb2e=function(_0x54d16f,_0x3a507e){_0x54d16f=_0x54d16f-0x0;var _0x21a054=_0xb2ec[_0x54d16f];return _0x21a054;};'use strict';var util=require(_0xcb2e('0x0'));var _=require(_0xcb2e('0x1'));var EventEmitter=require(_0xcb2e('0x2'))[_0xcb2e('0x3')];var AGIReply=require(_0xcb2e('0x4'));var AGIError=require(_0xcb2e('0x5'));function AGIChannel(_0x363647){var _0xd80b1=this,_0x5ebc16=new AGIReply(),_0x55602e=![],_0x11623d={};EventEmitter[_0xcb2e('0x6')](_0xd80b1);_0x363647[_0xcb2e('0x7')](_0xcb2e('0x8'));_0x363647['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x5ebc16[_0xcb2e('0x7')]('utf8');_0x5ebc16['on'](_0xcb2e('0x9'),function(_0x3932de){for(var _0x5bce35 in _0x3932de){_0xd80b1[_0x5bce35]=_0x3932de[_0x5bce35];}_0xd80b1[_0xcb2e('0xa')](_0xcb2e('0xb'));});_0x5ebc16['on'](_0xcb2e('0xc'),function(_0x207948){if(_0x207948[_0xcb2e('0xd')]()=='hangup'){_0xd80b1[_0xcb2e('0xa')](_0xcb2e('0xe'));return;}if(_0x207948[_0xcb2e('0xf')](0x0,0xb)==_0xcb2e('0x10')){_0x55602e=!![];}if(_0x55602e){_0x11623d['rx']+=_0x207948+'\x0a';if(_0x207948[_0xcb2e('0x11')](_0xcb2e('0x12'))!=-0x1){_0x55602e=![];}}else{_0x11623d['rx']=_0x207948;}if(_0x55602e){return;}if(typeof _0x11623d['cb']=='function'){var _0x370fc4=_0x11623d['rx'][_0xcb2e('0xf')](0x0,0x3),_0x2e1fbb=null,_0x41fff3=null;_0x370fc4=parseInt(_0x370fc4);if(isNaN(_0x370fc4)){_0x11623d['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xcb2e('0x13')});return;}if(_0x370fc4!=0xc8){_0x11623d['cb'](null,{'code':_0x370fc4,'result':-0x1,'extra':'KO'});return;}_0x2e1fbb=_0x11623d['rx']['substring'](0x4)[_0xcb2e('0x14')](_0xcb2e('0x15'),'');if(_0x2e1fbb[_0xcb2e('0x16')]('\x20')!=-0x1){_0x2e1fbb=_0x2e1fbb['substr'](0x0,_0x2e1fbb['indexOf']('\x20'));}if(_[_0xcb2e('0x17')](_0x2e1fbb,'-1')){_0x2e1fbb=parseInt(_0x2e1fbb);}_0x41fff3=_0x11623d['rx'][_0xcb2e('0x18')]('\x20');if(_0x41fff3[_0xcb2e('0x19')]==0x3){_0x41fff3=_0x41fff3[0x2][_0xcb2e('0xf')](0x1,_0x41fff3[0x2]['length']-0x1);}else if(_0x41fff3[_0xcb2e('0x19')]>0x3){var _0x428644=/\((.+)\)/;var _0x162da8=_0x11623d['rx']['match'](_0x428644);if(_0x162da8){_0x41fff3=_0x162da8[0x1];}else{_0x41fff3=null;}}else{_0x41fff3=null;}_0x11623d['cb'](null,{'code':_0x370fc4,'result':_0x2e1fbb,'extra':_0x41fff3});}});_0x363647['on'](_0xcb2e('0x1a'),function(_0x1bfe0a){_0xd80b1[_0xcb2e('0xa')](_0xcb2e('0x1a'),new AGIError('E_AGI_SOCKET_ERROR',_0x1bfe0a[_0xcb2e('0x1b')]));});_0x363647['on']('close',function(){_0xd80b1['emit']('close',new AGIError('E_AGI_SOCKET_CLOSE'));});_0x363647['on'](_0xcb2e('0x1c'),function(){_0xd80b1[_0xcb2e('0xa')](_0xcb2e('0x1c'),new AGIError(_0xcb2e('0x1d')));_0x363647['destroy']();});_0x363647[_0xcb2e('0x1e')](_0x5ebc16);this['command']=function(_0x22e622,_0x1c6ab9){var _0x22e622=_0x22e622||'',_0x1c6ab9=typeof _0x1c6ab9==_0xcb2e('0x1f')?_0x1c6ab9:new Function();_0x11623d={'tx':_0x22e622,'rx':'','cb':_0x1c6ab9};_0x363647[_0xcb2e('0x20')](_0x22e622+'\x0a');},this[_0xcb2e('0x21')]=function(){_0x363647[_0xcb2e('0x22')]();};}util[_0xcb2e('0x23')](AGIChannel,EventEmitter);AGIChannel[_0xcb2e('0x24')][_0xcb2e('0x25')]=function(_0x155a52){return this['command'][_0xcb2e('0x26')](this,_0x155a52);};AGIChannel[_0xcb2e('0x24')]['answer']=function(){return this['sendRequest']('ANSWER');};AGIChannel['prototype'][_0xcb2e('0x27')]=function(_0x9d973,_0x319840,_0x375efd){_0x9d973=_0x9d973===undefined?_0xcb2e('0x28'):_0x9d973;_0x319840=_0x319840===undefined?'5':_0x319840;_0x375efd=_0x375efd===undefined?'1':_0x375efd;return this['sendRequest'](util['format'](_0xcb2e('0x29'),_0x9d973,_0x319840*0x3e8,_0x375efd));};AGIChannel[_0xcb2e('0x24')][_0xcb2e('0x2a')]=function(_0x167bb8){_0x167bb8=_0x167bb8||_0xcb2e('0x2b');return this[_0xcb2e('0x25')](util[_0xcb2e('0x2c')](_0xcb2e('0x2d'),_0x167bb8));};AGIChannel[_0xcb2e('0x24')][_0xcb2e('0x2e')]=function(_0x550c6b,_0x16c1b2){if(_[_0xcb2e('0x2f')](_0x16c1b2)){return this[_0xcb2e('0x25')](util[_0xcb2e('0x2c')](_0xcb2e('0x30'),_0x550c6b,_0x16c1b2[_0xcb2e('0x31')](',')));}return this[_0xcb2e('0x25')](util[_0xcb2e('0x2c')](_0xcb2e('0x30'),_0x550c6b,_0x16c1b2));};AGIChannel[_0xcb2e('0x24')]['setContext']=function(_0x239957){return this[_0xcb2e('0x25')](util[_0xcb2e('0x2c')](_0xcb2e('0x32'),_0x239957));};AGIChannel[_0xcb2e('0x24')]['setExtension']=function(_0x33da33){return this[_0xcb2e('0x25')](util[_0xcb2e('0x2c')]('SET\x20EXTENSION\x20%s',_0x33da33));};AGIChannel[_0xcb2e('0x24')][_0xcb2e('0x33')]=function(_0x5528d7){return this[_0xcb2e('0x25')](util['format'](_0xcb2e('0x34'),_0x5528d7));};AGIChannel[_0xcb2e('0x24')]['hangup']=function(){return this[_0xcb2e('0x25')]('HANGUP');};AGIChannel[_0xcb2e('0x24')][_0xcb2e('0x35')]=function(_0x50751b,_0x381f10){var _0x476cce=_[_0xcb2e('0x36')](_0x381f10)||_['isNumber'](_0x381f10)?_0x381f10[_0xcb2e('0x37')]():_0x381f10;return this[_0xcb2e('0x25')](util['format']('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x50751b,_0x476cce?_0x476cce[_0xcb2e('0x37')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xcb2e('0x24')][_0xcb2e('0x38')]=function(_0x4731e3,_0x1e1533){return this[_0xcb2e('0x25')](util[_0xcb2e('0x2c')](_0xcb2e('0x39'),_0x4731e3,_0x1e1533));};AGIChannel['prototype'][_0xcb2e('0x3a')]=function(_0x56ca31,_0x1fc2b6){return this[_0xcb2e('0x25')](util[_0xcb2e('0x2c')](_0xcb2e('0x3b'),_0x56ca31,_0x1fc2b6));};AGIChannel[_0xcb2e('0x24')]['sayPhonetic']=function(_0x72f014,_0x2a932c){return this[_0xcb2e('0x25')](util[_0xcb2e('0x2c')](_0xcb2e('0x3c'),_0x72f014,_0x2a932c));};AGIChannel[_0xcb2e('0x24')][_0xcb2e('0x3d')]=function(_0x5f1dd8,_0x2a1719,_0x43ab3a){_0x2a1719=_0x2a1719||this[_0xcb2e('0x3e')];_0x43ab3a=_0x43ab3a||0x1;this[_0xcb2e('0x3f')](_0x5f1dd8);this[_0xcb2e('0x40')](_0x2a1719);this[_0xcb2e('0x33')](_0x43ab3a);return this[_0xcb2e('0x2a')](util['format']('GOTO\x20%s\x20%s\x20%s',_0x5f1dd8,_0x2a1719,_0x43ab3a));};AGIChannel[_0xcb2e('0x24')][_0xcb2e('0x41')]=function(_0x22261d){return this[_0xcb2e('0x25')](util[_0xcb2e('0x2c')](_0xcb2e('0x42'),_0x22261d));};AGIChannel[_0xcb2e('0x24')][_0xcb2e('0x43')]=function(_0x1820ac,_0x381fb4,_0x257878,_0x5ddf5f,_0x59056b,_0x110a1d){_0x381fb4=_0x381fb4||_0xcb2e('0x44');_0x257878=_0x257878||'';_0x5ddf5f=_0x5ddf5f===undefined?-0x1:_0x5ddf5f==='-1'?-0x1:_0x5ddf5f*0x3e8;_0x59056b=_0x59056b===undefined?'':'s='+_0x59056b;_0x110a1d=_0x110a1d?_0xcb2e('0x45'):'';return this['sendRequest'](util[_0xcb2e('0x2c')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x1820ac,_0x381fb4,_0x257878,_0x5ddf5f,_0x110a1d,_0x59056b));};AGIChannel['prototype'][_0xcb2e('0x46')]=function(_0x5b1695,_0xe8433){_0xe8433=_0xe8433||'';return this[_0xcb2e('0x25')](util['format']('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x5b1695,_0xe8433));};AGIChannel['prototype'][_0xcb2e('0x47')]=function(_0x39f1d2){return this[_0xcb2e('0x2e')](_0xcb2e('0x48'),_0x39f1d2);};AGIChannel['prototype'][_0xcb2e('0x49')]=function(_0x139fd7){return this['exec'](_0xcb2e('0x4a'),_0x139fd7);};AGIChannel[_0xcb2e('0x24')]['error']=function(_0x3c6ae,_0x658eab){this[_0xcb2e('0x2a')](util['format'](_0xcb2e('0x4b'),_0x3c6ae['id'],_0x3c6ae[_0xcb2e('0x4c')],_0x658eab));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xcb2e('0x4d')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index bcb74ab..53733be 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 _0x6c57=['push','apply','name','exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.'];(function(_0x1fec10,_0x17ae2e){var _0x416f85=function(_0xc44566){while(--_0xc44566){_0x1fec10['push'](_0x1fec10['shift']());}};_0x416f85(++_0x17ae2e);}(_0x6c57,0x124));var _0x76c5=function(_0x5027b1,_0x1409a5){_0x5027b1=_0x5027b1-0x0;var _0x4a46cf=_0x6c57[_0x5027b1];return _0x4a46cf;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x76c5('0x0'),'E_AGI_ARGUMENT_PORT':_0x76c5('0x1'),'E_AGI_SERVER_ERROR':_0x76c5('0x2'),'E_AGI_SERVER_CLOSE':_0x76c5('0x3'),'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':_0x76c5('0x4'),'E_AGI_SOCKET_CLOSE':_0x76c5('0x5'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x76c5('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x76c5('0x7')};function AGIError(_0x39c015){var _0x39c015=_0x39c015||null,_0x592a41=_0x592a41||[],_0x109155=0x1,_0x2f864f='';if(!error[_0x39c015]){_0x39c015='E_AGI_UNDEFINED';}_0x592a41[_0x76c5('0x8')](error[_0x39c015]);while(arguments[_0x109155]){_0x592a41[_0x76c5('0x8')](arguments[_0x109155]);_0x109155++;}_0x2f864f=util['format'][_0x76c5('0x9')](util,_0x592a41);this['message']=_0x2f864f;this[_0x76c5('0xa')]=_0x39c015;}module[_0x76c5('0xb')]=AGIError; \ No newline at end of file +var _0xa170=['exports','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','format','message'];(function(_0x6991ea,_0x1a2ab2){var _0x3c9b9d=function(_0x22210c){while(--_0x22210c){_0x6991ea['push'](_0x6991ea['shift']());}};_0x3c9b9d(++_0x1a2ab2);}(_0xa170,0x12d));var _0x0a17=function(_0x16cdaf,_0x51a72f){_0x16cdaf=_0x16cdaf-0x0;var _0x19b196=_0xa170[_0x16cdaf];return _0x19b196;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x0a17('0x0'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x0a17('0x1'),'E_AGI_SERVER_CLOSE':_0x0a17('0x2'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x0a17('0x3'),'E_AGI_SOCKET_ERROR':_0x0a17('0x4'),'E_AGI_SOCKET_CLOSE':_0x0a17('0x5'),'E_AGI_SOCKET_TIMEOUT':_0x0a17('0x6'),'E_AGI_COMMAND_EMPTY':_0x0a17('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x0a17('0x8'),'E_AGI_IVR_ENTRY':_0x0a17('0x9')};function AGIError(_0x4d5495){var _0x4d5495=_0x4d5495||null,_0x38b12e=_0x38b12e||[],_0x10e05a=0x1,_0x4c909c='';if(!error[_0x4d5495]){_0x4d5495=_0x0a17('0xa');}_0x38b12e[_0x0a17('0xb')](error[_0x4d5495]);while(arguments[_0x10e05a]){_0x38b12e[_0x0a17('0xb')](arguments[_0x10e05a]);_0x10e05a++;}_0x4c909c=util[_0x0a17('0xc')]['apply'](util,_0x38b12e);this[_0x0a17('0xd')]=_0x4c909c;this['name']=_0x4d5495;}module[_0x0a17('0xe')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 41224b1..94b5c1f 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5ca5=['projectUpdate','E_AGI_SERVER_ERROR','exports','lodash','events','ioredis','./error','../../config/environment','redis','localhost','subscribe','emit','error','agi'];(function(_0x5de0c1,_0xffb48){var _0x3ac9aa=function(_0x42693c){while(--_0x42693c){_0x5de0c1['push'](_0x5de0c1['shift']());}};_0x3ac9aa(++_0xffb48);}(_0x5ca5,0x81));var _0x55ca=function(_0xd81d0a,_0x1f28c0){_0xd81d0a=_0xd81d0a-0x0;var _0x2140bf=_0x5ca5[_0xd81d0a];return _0x2140bf;};'use strict';var _=require(_0x55ca('0x0'));var EventEmitter=require(_0x55ca('0x1'))['EventEmitter'];var Redis=require(_0x55ca('0x2'));var AGIError=require(_0x55ca('0x3'));var config=require(_0x55ca('0x4'));config[_0x55ca('0x5')]=_['defaults'](config[_0x55ca('0x5')],{'host':_0x55ca('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x55ca('0x5')]);sub[_0x55ca('0x7')]('agi',function(_0x1ddf73){if(_0x1ddf73)return eventEmitter[_0x55ca('0x8')](_0x55ca('0x9'),new AGIError('E_AGI_SERVER_ERROR',_0x1ddf73));});sub['on']('message',function(_0x58003f,_0x54ce36){if(_0x58003f!==_0x55ca('0xa'))return;try{var _0x31dbfd=JSON['parse'](_0x54ce36);eventEmitter['emit'](_0x55ca('0xb'),_0x31dbfd);}catch(_0xf9a1f2){eventEmitter['emit'](_0x55ca('0x9'),new AGIError(_0x55ca('0xc'),_0xf9a1f2));}});module[_0x55ca('0xd')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x26b8=['parse','projectUpdate','lodash','events','EventEmitter','./error','../../config/environment','redis','defaults','localhost','subscribe','emit','error','E_AGI_SERVER_ERROR','message','agi'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x26b8,0x122));var _0x826b=function(_0x44d97b,_0x1b9489){_0x44d97b=_0x44d97b-0x0;var _0x305047=_0x26b8[_0x44d97b];return _0x305047;};'use strict';var _=require(_0x826b('0x0'));var EventEmitter=require(_0x826b('0x1'))[_0x826b('0x2')];var Redis=require('ioredis');var AGIError=require(_0x826b('0x3'));var config=require(_0x826b('0x4'));config[_0x826b('0x5')]=_[_0x826b('0x6')](config['redis'],{'host':_0x826b('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x826b('0x5')]);sub[_0x826b('0x8')]('agi',function(_0x4cfbf8){if(_0x4cfbf8)return eventEmitter[_0x826b('0x9')](_0x826b('0xa'),new AGIError(_0x826b('0xb'),_0x4cfbf8));});sub['on'](_0x826b('0xc'),function(_0x3b3cd4,_0x203aca){if(_0x3b3cd4!==_0x826b('0xd'))return;try{var _0x14365a=JSON[_0x826b('0xe')](_0x203aca);eventEmitter['emit'](_0x826b('0xf'),_0x14365a);}catch(_0x562b8b){eventEmitter[_0x826b('0x9')](_0x826b('0xa'),new AGIError(_0x826b('0xb'),_0x562b8b));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 82c5ed7..676477a 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 _0x0f3a=['vswitch','target','invalid','agicommand','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','../../../config/logger','menu','getdigits','getsecretdigits','edges','numberOfEdges','addEdge','push','prototype','size','vertices','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','split'];(function(_0x2f2d60,_0x3d0adc){var _0x489a4d=function(_0x3e7e66){while(--_0x3e7e66){_0x2f2d60['push'](_0x2f2d60['shift']());}};_0x489a4d(++_0x3d0adc);}(_0x0f3a,0x1bb));var _0xa0f3=function(_0x9fbdc9,_0x41f56a){_0x9fbdc9=_0x9fbdc9-0x0;var _0xd1c475=_0x0f3a[_0x9fbdc9];return _0xd1c475;};'use strict';var _=require('lodash');var logger=require(_0xa0f3('0x0'))('agi');var verticesWithRetry=[_0xa0f3('0x1'),_0xa0f3('0x2'),_0xa0f3('0x3')];var Graph=function(){this['vertices']={};this[_0xa0f3('0x4')]={};this[_0xa0f3('0x5')]=0x0;};Graph['prototype']['addVertex']=function(_0x38e13d){this['vertices'][_0x38e13d['id']]=_0x38e13d;this[_0xa0f3('0x4')][_0x38e13d['id']]=[];};Graph['prototype'][_0xa0f3('0x6')]=function(_0x361aa5,_0xdd2e0c,_0x261622){this['edges'][_0x361aa5][_0xa0f3('0x7')]({'target':_0xdd2e0c,'condition':_0x261622});this[_0xa0f3('0x5')]+=0x1;};Graph[_0xa0f3('0x8')][_0xa0f3('0x9')]=function(){return _['size'](this[_0xa0f3('0xa')]);};Graph[_0xa0f3('0x8')][_0xa0f3('0xb')]=function(){return this[_0xa0f3('0x5')];};Graph[_0xa0f3('0x8')][_0xa0f3('0xc')]=function(_0x543a13){return this[_0xa0f3('0xa')][_0x543a13];};Graph[_0xa0f3('0x8')][_0xa0f3('0xd')]=function(_0x438646,_0x23b7d3){if(!this[_0xa0f3('0xa')][_0x438646]){return logger[_0xa0f3('0xe')](_0xa0f3('0xf'));}var _0xb2921d=_0x23b7d3(this[_0xa0f3('0xa')][_0x438646]);if(!_0xb2921d){return logger[_0xa0f3('0xe')](_0xa0f3('0x10'));}if(this[_0xa0f3('0x4')][_0x438646][_0xa0f3('0x11')]===0x0){return logger[_0xa0f3('0xe')](_0xa0f3('0x12'));}for(var _0x59e705=0x0,_0x355a32=[],_0x16364e=![];_0x59e705\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','evtHangup','then','substring','debug','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','find','handleNotFound','production','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xc66b,0x6f));var _0xbc66=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xc66b[_0x550d12];return _0x12103d;};'use strict';var _=require(_0xbc66('0x0'));var syncho=require(_0xbc66('0x1'));var util=require(_0xbc66('0x2'));var config=require(_0xbc66('0x3'));var logger=require(_0xbc66('0x4'))(_0xbc66('0x5'));var utilLicense=require(_0xbc66('0x6'));var rpc=require(_0xbc66('0x7'));var Project=require(_0xbc66('0x8'));var AGIEmitter=require(_0xbc66('0x9'))['EventEmitter'];var projects=[];config[_0xbc66('0x5')]=_[_0xbc66('0xa')](config[_0xbc66('0x5')],{'ip':_0xbc66('0xb'),'port':0x11dd});AGIEmitter['on'](_0xbc66('0xc'),projectUpdateHandler);function connectionHandler(_0x5a5b65){process[_0xbc66('0xd')](function(){syncho(function(){try{setChannelVariables(_0x5a5b65);agiHandler(_0x5a5b65);}catch(_0x3967f8){logger[_0xbc66('0xe')](_0x3967f8[_0xbc66('0xf')]);}});});}function projectUpdateHandler(_0x20d195){try{var _0x585a91=_['findIndex'](projects,['id',_0x20d195['id']]);if(_0x585a91>-0x1){if(_0x20d195[_0xbc66('0x10')]===!![]){projects[_0xbc66('0x11')](_0x585a91,0x1);}else{projects[_0x585a91]=_0x20d195;}}else{projects['push'](_0x20d195);}}catch(_0x16af65){logger['error'](_0x16af65['stack']);}}function listeningHandler(){console[_0xbc66('0x12')](_0xbc66('0x13'),config[_0xbc66('0x5')]['port']);logger[_0xbc66('0x14')](util[_0xbc66('0x15')](_0xbc66('0x16'),config[_0xbc66('0x5')]['ip'],config[_0xbc66('0x5')][_0xbc66('0x17')]));}function errorHandler(_0x56274d){if(_0x56274d&&_0x56274d[_0xbc66('0x18')]&&_0x56274d[_0xbc66('0x19')]){logger[_0xbc66('0xe')](util[_0xbc66('0x15')](_0xbc66('0x1a'),_0x56274d[_0xbc66('0x18')],_0x56274d['message']));}else{logger['error'](util[_0xbc66('0x15')](_0xbc66('0x1b'),_0x56274d[_0xbc66('0xf')]));}}function closeHandler(){logger[_0xbc66('0x14')](util[_0xbc66('0x15')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0xbc66('0x1c')],this[_0xbc66('0x1d')],this[_0xbc66('0x1e')],this['uniqueid']));try{createSquareReport(this);}catch(_0x22cb03){logger[_0xbc66('0xe')](_0x22cb03['stack']);}}function timeoutHandler(){logger['info'](util[_0xbc66('0x15')](_0xbc66('0x1f'),this[_0xbc66('0x20')],this['calleridname'],this[_0xbc66('0x1d')],this[_0xbc66('0x1e')],this['uniqueid']));}function hangupHandler(){logger[_0xbc66('0x14')](util[_0xbc66('0x15')](_0xbc66('0x21'),this[_0xbc66('0x20')],this[_0xbc66('0x1c')],this['callerid'],this[_0xbc66('0x1e')],this[_0xbc66('0x22')]));this[_0xbc66('0x23')]=!![];}function createSquareReport(_0x2f44d3,_0x305d8c){rpc['createSquareReport'](_0x2f44d3)[_0xbc66('0x24')](function(_0x2923a4){if(_0x305d8c){_0x305d8c(null,_0x2923a4);}})['catch'](function(_0x25c420){if(_0x305d8c){_0x305d8c(null,_0x25c420);}});}function setChannelVariables(_0x3934b3){for(var _0x5578c7 in _0x3934b3){if(_0x3934b3['hasOwnProperty'](_0x5578c7)){if(_0x5578c7['indexOf']('agi_')===0x0){_0x3934b3[_0x5578c7[_0xbc66('0x25')](0x4)]=_0x3934b3[_0x5578c7];delete _0x3934b3[_0x5578c7];}}}}function agiHandler(_0x5f4ae1){logger[_0xbc66('0x26')](_0xbc66('0x27'),JSON['stringify'](_0x5f4ae1,null,0x2));logger[_0xbc66('0x14')](util['format'](_0xbc66('0x28'),_0x5f4ae1[_0xbc66('0x20')],_0x5f4ae1[_0xbc66('0x1c')],_0x5f4ae1[_0xbc66('0x1d')],_0x5f4ae1['dnid'],_0x5f4ae1[_0xbc66('0x22')]));_0x5f4ae1['on'](_0xbc66('0xe'),errorHandler);_0x5f4ae1['on'](_0xbc66('0x29'),closeHandler);_0x5f4ae1['on'](_0xbc66('0x2a'),timeoutHandler);_0x5f4ae1[_0xbc66('0x23')]=![];_0x5f4ae1['on'](_0xbc66('0x2b'),hangupHandler);var _0x44e264=_[_0xbc66('0x2c')](projects,[_0xbc66('0x18'),_0x5f4ae1[_0xbc66('0x20')]]);if(!_0x44e264)return Project[_0xbc66('0x2d')](_0x5f4ae1);if(!_0x44e264[_0xbc66('0x2e')])return Project['handleUnpublished'](_0x5f4ae1);return Project['initialize'](_0x44e264,_0x5f4ae1);}function main(){var _0x52e32f;return utilLicense[_0xbc66('0x2f')]()[_0xbc66('0x24')](function(_0x25cb15){if(!_0x25cb15)return;if(_0x25cb15[_0xbc66('0x30')]){if(_0x25cb15[_0xbc66('0x31')]&&_0x25cb15[_0xbc66('0x31')]>0x0){logger['info'](util[_0xbc66('0x15')](_0xbc66('0x32'),_0x25cb15[_0xbc66('0x31')]));_0x52e32f=_0x25cb15['callysquare'];}else{logger[_0xbc66('0x14')](_0xbc66('0x33'));}}else{logger[_0xbc66('0x14')](_0xbc66('0x34'));_0x52e32f=-0x1;}})[_0xbc66('0x24')](function(){return Project['getAll']();})[_0xbc66('0x24')](function(_0x280636){projects=_0x280636;return;})['catch'](function(_0x5da4d6){logger['error'](_0xbc66('0x35'),_0x5da4d6[_0xbc66('0xf')]);})['finally'](function(){var _0x2fdab5=require('./server')(config[_0xbc66('0x5')][_0xbc66('0x17')],config[_0xbc66('0x5')]['ip'],_0x52e32f);_0x2fdab5['on'](_0xbc66('0xe'),errorHandler);_0x2fdab5['on']('listening',listeningHandler);_0x2fdab5['on'](_0xbc66('0x36'),connectionHandler);_0x2fdab5['on'](_0xbc66('0x29'),closeHandler);});}main(); \ No newline at end of file +var _0x8691=['[%s]\x20%s','[ERROR]\x20%s','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','evtHangup','createSquareReport','catch','indexOf','agi_','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','find','handleNotFound','production','handleUnpublished','initialize','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','then','getAll','finally','./server','listening','connection','lodash','syncho','util','../../config/logger','agi','../../config/license/util','./rpc','./project','./events','EventEmitter','defaults','127.0.0.1','projectUpdate','error','stack','findIndex','deleted','splice','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8691,0x1b7));var _0x1869=function(_0x5ca268,_0x293286){_0x5ca268=_0x5ca268-0x0;var _0x52e674=_0x8691[_0x5ca268];return _0x52e674;};'use strict';var _=require(_0x1869('0x0'));var syncho=require(_0x1869('0x1'));var util=require(_0x1869('0x2'));var config=require('../../config/environment');var logger=require(_0x1869('0x3'))(_0x1869('0x4'));var utilLicense=require(_0x1869('0x5'));var rpc=require(_0x1869('0x6'));var Project=require(_0x1869('0x7'));var AGIEmitter=require(_0x1869('0x8'))[_0x1869('0x9')];var projects=[];config['agi']=_[_0x1869('0xa')](config[_0x1869('0x4')],{'ip':_0x1869('0xb'),'port':0x11dd});AGIEmitter['on'](_0x1869('0xc'),projectUpdateHandler);function connectionHandler(_0x2123dd){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x2123dd);agiHandler(_0x2123dd);}catch(_0x167e33){logger[_0x1869('0xd')](_0x167e33[_0x1869('0xe')]);}});});}function projectUpdateHandler(_0x371a39){try{var _0x4575b1=_[_0x1869('0xf')](projects,['id',_0x371a39['id']]);if(_0x4575b1>-0x1){if(_0x371a39[_0x1869('0x10')]===!![]){projects[_0x1869('0x11')](_0x4575b1,0x1);}else{projects[_0x4575b1]=_0x371a39;}}else{projects['push'](_0x371a39);}}catch(_0x474ac4){logger[_0x1869('0xd')](_0x474ac4[_0x1869('0xe')]);}}function listeningHandler(){console[_0x1869('0x12')](_0x1869('0x13'),config[_0x1869('0x4')][_0x1869('0x14')]);logger['info'](util[_0x1869('0x15')](_0x1869('0x16'),config['agi']['ip'],config['agi'][_0x1869('0x14')]));}function errorHandler(_0x33f234){if(_0x33f234&&_0x33f234[_0x1869('0x17')]&&_0x33f234[_0x1869('0x18')]){logger[_0x1869('0xd')](util[_0x1869('0x15')](_0x1869('0x19'),_0x33f234[_0x1869('0x17')],_0x33f234[_0x1869('0x18')]));}else{logger['error'](util[_0x1869('0x15')](_0x1869('0x1a'),_0x33f234[_0x1869('0xe')]));}}function closeHandler(){logger[_0x1869('0x1b')](util[_0x1869('0x15')](_0x1869('0x1c'),this['arg_1'],this[_0x1869('0x1d')],this['callerid'],this[_0x1869('0x1e')],this[_0x1869('0x1f')]));try{createSquareReport(this);}catch(_0x2703dd){logger[_0x1869('0xd')](_0x2703dd['stack']);}}function timeoutHandler(){logger['info'](util['format'](_0x1869('0x20'),this['arg_1'],this[_0x1869('0x1d')],this['callerid'],this[_0x1869('0x1e')],this[_0x1869('0x1f')]));}function hangupHandler(){logger[_0x1869('0x1b')](util[_0x1869('0x15')](_0x1869('0x21'),this[_0x1869('0x22')],this[_0x1869('0x1d')],this['callerid'],this[_0x1869('0x1e')],this[_0x1869('0x1f')]));this[_0x1869('0x23')]=!![];}function createSquareReport(_0x2474f1,_0x59eb3d){rpc[_0x1869('0x24')](_0x2474f1)['then'](function(_0x564ba4){if(_0x59eb3d){_0x59eb3d(null,_0x564ba4);}})[_0x1869('0x25')](function(_0x50364a){if(_0x59eb3d){_0x59eb3d(null,_0x50364a);}});}function setChannelVariables(_0x5d4dd0){for(var _0x2c6b2a in _0x5d4dd0){if(_0x5d4dd0['hasOwnProperty'](_0x2c6b2a)){if(_0x2c6b2a[_0x1869('0x26')](_0x1869('0x27'))===0x0){_0x5d4dd0[_0x2c6b2a['substring'](0x4)]=_0x5d4dd0[_0x2c6b2a];delete _0x5d4dd0[_0x2c6b2a];}}}}function agiHandler(_0x2511a0){logger['debug'](_0x1869('0x28'),JSON[_0x1869('0x29')](_0x2511a0,null,0x2));logger[_0x1869('0x1b')](util[_0x1869('0x15')](_0x1869('0x2a'),_0x2511a0['arg_1'],_0x2511a0[_0x1869('0x1d')],_0x2511a0['callerid'],_0x2511a0['dnid'],_0x2511a0[_0x1869('0x1f')]));_0x2511a0['on']('error',errorHandler);_0x2511a0['on'](_0x1869('0x2b'),closeHandler);_0x2511a0['on']('timeout',timeoutHandler);_0x2511a0['evtHangup']=![];_0x2511a0['on']('hangup',hangupHandler);var _0x1312a9=_[_0x1869('0x2c')](projects,[_0x1869('0x17'),_0x2511a0[_0x1869('0x22')]]);if(!_0x1312a9)return Project[_0x1869('0x2d')](_0x2511a0);if(!_0x1312a9[_0x1869('0x2e')])return Project[_0x1869('0x2f')](_0x2511a0);return Project[_0x1869('0x30')](_0x1312a9,_0x2511a0);}function main(){var _0x1f391a;return utilLicense['getLicense']()['then'](function(_0x21d538){if(!_0x21d538)return;if(_0x21d538['voice']){if(_0x21d538['callysquare']&&_0x21d538[_0x1869('0x31')]>0x0){logger[_0x1869('0x1b')](util[_0x1869('0x15')]('[LICENSE]\x20CHANNELS:\x20%s',_0x21d538[_0x1869('0x31')]));_0x1f391a=_0x21d538[_0x1869('0x31')];}else{logger[_0x1869('0x1b')](_0x1869('0x32'));}}else{logger[_0x1869('0x1b')](_0x1869('0x33'));_0x1f391a=-0x1;}})[_0x1869('0x34')](function(){return Project[_0x1869('0x35')]();})[_0x1869('0x34')](function(_0x6ca085){projects=_0x6ca085;return;})[_0x1869('0x25')](function(_0x25f4df){logger[_0x1869('0xd')]('[LICENSE]',_0x25f4df[_0x1869('0xe')]);})[_0x1869('0x36')](function(){var _0x4f2f72=require(_0x1869('0x37'))(config[_0x1869('0x4')][_0x1869('0x14')],config[_0x1869('0x4')]['ip'],_0x1f391a);_0x4f2f72['on']('error',errorHandler);_0x4f2f72['on'](_0x1869('0x38'),listeningHandler);_0x4f2f72['on'](_0x1869('0x39'),connectionHandler);_0x4f2f72['on'](_0x1869('0x2b'),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 ff0a847..f394243 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 _0xbd97=['client','http','request','then','error','message','result','sendMailMessage','SendMail','bluebird'];(function(_0x42ca58,_0x423bf9){var _0x1a3a40=function(_0x1d4a8a){while(--_0x1d4a8a){_0x42ca58['push'](_0x42ca58['shift']());}};_0x1a3a40(++_0x423bf9);}(_0xbd97,0x135));var _0x7bd9=function(_0x555ed4,_0xae3814){_0x555ed4=_0x555ed4-0x0;var _0xe54252=_0xbd97[_0x555ed4];return _0xe54252;};'use strict';var BPromise=require(_0x7bd9('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x7bd9('0x1')][_0x7bd9('0x2')]({'port':0x232b});function request(_0x2ad91b,_0x352e32){return new BPromise(function(_0x472c07,_0x231610){return client[_0x7bd9('0x3')](_0x2ad91b,_0x352e32)[_0x7bd9('0x4')](function(_0x23bd67){if(_0x23bd67[_0x7bd9('0x5')]){return _0x231610(_0x23bd67[_0x7bd9('0x5')][_0x7bd9('0x6')]);}else{return _0x472c07(_0x23bd67[_0x7bd9('0x7')]);}})['catch'](function(_0x3f1eb4){return _0x231610(_0x3f1eb4);});});}exports[_0x7bd9('0x8')]=function(_0x5f1b62,_0xbf5dba){return request(_0x7bd9('0x9'),{'account':_0x5f1b62,'message':_0xbf5dba});}; \ No newline at end of file +var _0x74d6=['bluebird','jayson/promise','http','request','then','result','sendMailMessage','SendMail'];(function(_0x569b2d,_0x11ffbd){var _0x34a829=function(_0xe2ee49){while(--_0xe2ee49){_0x569b2d['push'](_0x569b2d['shift']());}};_0x34a829(++_0x11ffbd);}(_0x74d6,0x88));var _0x674d=function(_0x58b994,_0x474781){_0x58b994=_0x58b994-0x0;var _0x2dcffd=_0x74d6[_0x58b994];return _0x2dcffd;};'use strict';var BPromise=require(_0x674d('0x0'));var jayson=require(_0x674d('0x1'));var client=jayson['client'][_0x674d('0x2')]({'port':0x232b});function request(_0x339da3,_0x355758){return new BPromise(function(_0x2b46af,_0x271a44){return client[_0x674d('0x3')](_0x339da3,_0x355758)[_0x674d('0x4')](function(_0x82c1bb){if(_0x82c1bb['error']){return _0x271a44(_0x82c1bb['error']['message']);}else{return _0x2b46af(_0x82c1bb[_0x674d('0x5')]);}})['catch'](function(_0x1e8745){return _0x271a44(_0x1e8745);});});}exports[_0x674d('0x6')]=function(_0x102552,_0x113873){return request(_0x674d('0x7'),{'account':_0x102552,'message':_0x113873});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 65bc33b..199e455 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe352=['./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','length','source','target','addEdge','value','mxGraphModel','root','inspect','production','debug','format','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','traverseBFS','start','clear','stringify','agicommand','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','result','evtHangup','isUndefined','agicommand\x20not\x20found','finally','vertex','toString','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json','util','../../config/logger','agi','./rpc','./mailRpc'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xe352,0x16c));var _0x2e35=function(_0x1aa809,_0x118952){_0x1aa809=_0x1aa809-0x0;var _0x3021fa=_0xe352[_0x1aa809];return _0x3021fa;};'use strict';var _=require(_0x2e35('0x0'));var moment=require(_0x2e35('0x1'));var parser=require(_0x2e35('0x2'));var util=require(_0x2e35('0x3'));var logger=require(_0x2e35('0x4'))(_0x2e35('0x5'));var rpc=require(_0x2e35('0x6'));var mailRpc=require(_0x2e35('0x7'));var Graph=require('./graph');var Vertices=require(_0x2e35('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x2e35('0x9')]()[_0x2e35('0xa')](function(_0x1ddeee){logger[_0x2e35('0xb')](_0x2e35('0xc'),_0x1ddeee[_0x2e35('0xd')]);return[];});}function addVertex(_0x1f2564,_0x36214c,_0x4dc6f9){_0x36214c['agicommand']=_0x4dc6f9;if(_0x36214c[_0x2e35('0xe')](_0x2e35('0xf'))){_0x36214c[_0x2e35('0x10')]=parseInt(_0x36214c[_0x2e35('0xf')],0xa);}_0x1f2564[_0x2e35('0x11')](_[_0x2e35('0x12')](_0x36214c,_0x2e35('0x13')));}function initGraph(_0x2fe7b6,_0x475cf0){var _0x4d1ac3=new Graph();for(var _0x3e38df in _0x2fe7b6){if(_0x2fe7b6[_0x2e35('0xe')](_0x3e38df)){if(_['isArray'](_0x2fe7b6[_0x3e38df])){for(var _0x24d68=0x0;_0x24d68<_0x2fe7b6[_0x3e38df][_0x2e35('0x14')];_0x24d68+=0x1){addVertex(_0x4d1ac3,_0x2fe7b6[_0x3e38df][_0x24d68],_0x3e38df);}}else{addVertex(_0x4d1ac3,_0x2fe7b6[_0x3e38df],_0x3e38df);}}}for(var _0x46fada=0x0;_0x46fada<_0x475cf0['length'];_0x46fada+=0x1){if(_0x475cf0[_0x46fada][_0x2e35('0x15')]&&_0x475cf0[_0x46fada][_0x2e35('0x16')]){_0x4d1ac3[_0x2e35('0x17')](_0x475cf0[_0x46fada][_0x2e35('0x15')],_0x475cf0[_0x46fada][_0x2e35('0x16')],_0x475cf0[_0x46fada][_0x2e35('0x18')]);}}return _0x4d1ac3;}function getRoot(_0x3badb2){return parser['toJson'](_0x3badb2,{'object':!![]})[_0x2e35('0x19')][_0x2e35('0x1a')];}function inspect(_0x54d9f7){return util[_0x2e35('0x1b')](_0x54d9f7,{'showHidden':![],'depth':null});}function initialize(_0x11537c,_0xa07c60){var _0x4efa60=getRoot(_0x11537c[_0x2e35('0x1c')]);if(!_0x4efa60||!_0x4efa60['start'])return;var _0x346573,_0x56431f,_0x20597e;logger[_0x2e35('0x1d')](_0x2e35('0x1a'),JSON['stringify'](_0x4efa60,null,0x2));_0xa07c60['joinAt']=moment()[_0x2e35('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');_0x346573=initGraph(_[_0x2e35('0x12')](_0x4efa60,_0x2e35('0x13')),_0x4efa60['mxCell']);_0x56431f=new Vertices(_0xa07c60,rpc,mailRpc);logger[_0x2e35('0x1f')](util[_0x2e35('0x1e')](_0x2e35('0x20'),_0xa07c60[_0x2e35('0x21')],_0xa07c60[_0x2e35('0x22')],_0xa07c60[_0x2e35('0x23')],_0xa07c60[_0x2e35('0x24')],_0xa07c60['uniqueid']));_0x346573[_0x2e35('0x25')](_0x4efa60[_0x2e35('0x26')]['id'],function(_0x24919d){try{_0x24919d=_0x56431f[_0x2e35('0x27')](_0x24919d);logger['debug']('vertex',JSON[_0x2e35('0x28')](_0x24919d,null,0x2));if(_0x24919d[_0x2e35('0x29')]===_0x2e35('0x2a')){logger[_0x2e35('0x1f')](_0x2e35('0x2b'));_0xa07c60[_0x2e35('0x2c')]=_0x24919d[_0x2e35('0x2c')]||_0xa07c60[_0x2e35('0x2c')];_0xa07c60[_0x2e35('0x2d')]=_0x24919d[_0x2e35('0x2d')];_0xa07c60['priority']=_0x24919d[_0x2e35('0x2e')]?_0x24919d[_0x2e35('0x2e')]-0x1:0x1;return null;}else if(_0x24919d&&_0x56431f[_0x24919d['agicommand']]){_0x20597e=_0x56431f[_0x24919d[_0x2e35('0x29')]](_0x24919d);logger[_0x2e35('0x1f')](_0x2e35('0x2f'),JSON[_0x2e35('0x28')](_0x20597e,null,0x2));if(_0x20597e&&_0x20597e['code']===AGI_CODE_SUCCESS&&_0x20597e[_0x2e35('0x30')]!==AGI_RESULT_ERROR&&!_0xa07c60[_0x2e35('0x31')]){logger['debug'](_0x2e35('0x2f'),inspect(_0x20597e));return _[_0x2e35('0x32')](_0x20597e[_0x2e35('0x30')])?null:_0x20597e[_0x2e35('0x30')]['toString']();}else{logger[_0x2e35('0xb')](_0x2e35('0x2f'),inspect(_0x20597e));return null;}}else{logger[_0x2e35('0xb')](_0x2e35('0x33'));return null;}}catch(_0x4ed84c){logger[_0x2e35('0xb')](_0x4ed84c[_0x2e35('0xd')]);return null;}});if(_0x4efa60[_0x2e35('0x34')]){logger[_0x2e35('0x1f')](util[_0x2e35('0x1e')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0xa07c60[_0x2e35('0x21')],_0xa07c60[_0x2e35('0x22')],_0xa07c60[_0x2e35('0x23')],_0xa07c60[_0x2e35('0x24')],_0xa07c60['uniqueid']));_0x346573[_0x2e35('0x25')](_0x4efa60[_0x2e35('0x34')]['id'],function(_0x104dec){try{_0x104dec=_0x56431f['clear'](_0x104dec);logger[_0x2e35('0x1d')](_0x2e35('0x35'),JSON['stringify'](_0x104dec,null,0x2));if(_0x104dec&&_0x56431f[_0x104dec[_0x2e35('0x29')]]){_0x20597e=_0x56431f[_0x104dec['agicommand']](_0x104dec);if(_0x20597e){logger[_0x2e35('0x1d')](_0x2e35('0x2f'),inspect(_0x20597e));return _[_0x2e35('0x32')](_0x20597e[_0x2e35('0x30')])?null:_0x20597e[_0x2e35('0x30')][_0x2e35('0x36')]();}else{logger['error']('response',inspect(_0x20597e));return null;}}else{logger[_0x2e35('0xb')](_0x2e35('0x33'));return null;}}catch(_0x2e0a29){logger['error'](_0x2e0a29[_0x2e35('0xd')]);return null;}});}logger['info'](util[_0x2e35('0x1e')](_0x2e35('0x37'),_0xa07c60[_0x2e35('0x21')],_0xa07c60[_0x2e35('0x22')],_0xa07c60[_0x2e35('0x23')],_0xa07c60[_0x2e35('0x24')],_0xa07c60['uniqueid']));logger[_0x2e35('0x1f')](util['format'](_0x2e35('0x38'),_0xa07c60['context'],_0xa07c60['extension'],parseInt(_0xa07c60[_0x2e35('0x2e')],0xa)+0x1));_0xa07c60[_0x2e35('0x39')](_0xa07c60['context'],_0xa07c60['extension'],parseInt(_0xa07c60['priority'],0xa)+0x1);_0xa07c60[_0x2e35('0x3a')]();}function handleNotFound(_0x49c109){logger['error'](util[_0x2e35('0x1e')](_0x2e35('0x3b'),_0x49c109[_0x2e35('0x21')]));_0x49c109[_0x2e35('0x39')](_0x49c109[_0x2e35('0x2c')],_0x49c109[_0x2e35('0x2d')],parseInt(_0x49c109['priority'],0xa)+0x1);_0x49c109[_0x2e35('0x3a')]();}function handleUnpublished(_0x3672e6){logger[_0x2e35('0xb')](util['format'](_0x2e35('0x3c'),_0x3672e6[_0x2e35('0x21')]));_0x3672e6[_0x2e35('0x39')](_0x3672e6[_0x2e35('0x2c')],_0x3672e6['extension'],parseInt(_0x3672e6[_0x2e35('0x2e')],0xa)+0x1);_0x3672e6[_0x2e35('0x3a')]();}module[_0x2e35('0x3d')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x788f=['target','addEdge','value','toJson','production','start','root','stringify','format','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','dnid','uniqueid','clear','debug','agicommand','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','isUndefined','result','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','vertex','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','close','continueAt','exports','lodash','moment','xml2json','util','../../config/logger','agi','./rpc','./mailRpc','./graph','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','length','source'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x788f,0x10d));var _0xf788=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x788f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf788('0x0'));var moment=require(_0xf788('0x1'));var parser=require(_0xf788('0x2'));var util=require(_0xf788('0x3'));var logger=require(_0xf788('0x4'))(_0xf788('0x5'));var rpc=require(_0xf788('0x6'));var mailRpc=require(_0xf788('0x7'));var Graph=require(_0xf788('0x8'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0xf788('0x9')](function(_0x21bb47){logger[_0xf788('0xa')](_0xf788('0xb'),_0x21bb47[_0xf788('0xc')]);return[];});}function addVertex(_0x26d872,_0x2a8740,_0x180e12){_0x2a8740['agicommand']=_0x180e12;if(_0x2a8740[_0xf788('0xd')](_0xf788('0xe'))){_0x2a8740[_0xf788('0xf')]=parseInt(_0x2a8740['retry'],0xa);}_0x26d872[_0xf788('0x10')](_[_0xf788('0x11')](_0x2a8740,_0xf788('0x12')));}function initGraph(_0x4da693,_0x217e05){var _0x1a25b7=new Graph();for(var _0x385f02 in _0x4da693){if(_0x4da693[_0xf788('0xd')](_0x385f02)){if(_['isArray'](_0x4da693[_0x385f02])){for(var _0x2b6242=0x0;_0x2b6242<_0x4da693[_0x385f02]['length'];_0x2b6242+=0x1){addVertex(_0x1a25b7,_0x4da693[_0x385f02][_0x2b6242],_0x385f02);}}else{addVertex(_0x1a25b7,_0x4da693[_0x385f02],_0x385f02);}}}for(var _0x3bc0ee=0x0;_0x3bc0ee<_0x217e05[_0xf788('0x13')];_0x3bc0ee+=0x1){if(_0x217e05[_0x3bc0ee][_0xf788('0x14')]&&_0x217e05[_0x3bc0ee][_0xf788('0x15')]){_0x1a25b7[_0xf788('0x16')](_0x217e05[_0x3bc0ee]['source'],_0x217e05[_0x3bc0ee]['target'],_0x217e05[_0x3bc0ee][_0xf788('0x17')]);}}return _0x1a25b7;}function getRoot(_0x1a1349){return parser[_0xf788('0x18')](_0x1a1349,{'object':!![]})['mxGraphModel']['root'];}function inspect(_0x4480df){return util['inspect'](_0x4480df,{'showHidden':![],'depth':null});}function initialize(_0x51ce4b,_0x5e8a65){var _0x412de4=getRoot(_0x51ce4b[_0xf788('0x19')]);if(!_0x412de4||!_0x412de4[_0xf788('0x1a')])return;var _0x26a449,_0xb79113,_0x2f75c2;logger['debug'](_0xf788('0x1b'),JSON[_0xf788('0x1c')](_0x412de4,null,0x2));_0x5e8a65['joinAt']=moment()[_0xf788('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');_0x26a449=initGraph(_[_0xf788('0x11')](_0x412de4,_0xf788('0x12')),_0x412de4['mxCell']);_0xb79113=new Vertices(_0x5e8a65,rpc,mailRpc);logger[_0xf788('0x1e')](util['format'](_0xf788('0x1f'),_0x5e8a65[_0xf788('0x20')],_0x5e8a65[_0xf788('0x21')],_0x5e8a65['callerid'],_0x5e8a65[_0xf788('0x22')],_0x5e8a65[_0xf788('0x23')]));_0x26a449['traverseBFS'](_0x412de4['start']['id'],function(_0x3f5eb8){try{_0x3f5eb8=_0xb79113[_0xf788('0x24')](_0x3f5eb8);logger[_0xf788('0x25')]('vertex',JSON[_0xf788('0x1c')](_0x3f5eb8,null,0x2));if(_0x3f5eb8[_0xf788('0x26')]==='gotoc'){logger[_0xf788('0x1e')](_0xf788('0x27'));_0x5e8a65[_0xf788('0x28')]=_0x3f5eb8[_0xf788('0x28')]||_0x5e8a65[_0xf788('0x28')];_0x5e8a65[_0xf788('0x29')]=_0x3f5eb8[_0xf788('0x29')];_0x5e8a65[_0xf788('0x2a')]=_0x3f5eb8[_0xf788('0x2a')]?_0x3f5eb8['priority']-0x1:0x1;return null;}else if(_0x3f5eb8&&_0xb79113[_0x3f5eb8[_0xf788('0x26')]]){_0x2f75c2=_0xb79113[_0x3f5eb8[_0xf788('0x26')]](_0x3f5eb8);logger['info'](_0xf788('0x2b'),JSON[_0xf788('0x1c')](_0x2f75c2,null,0x2));if(_0x2f75c2&&_0x2f75c2[_0xf788('0x2c')]===AGI_CODE_SUCCESS&&_0x2f75c2['result']!==AGI_RESULT_ERROR&&!_0x5e8a65['evtHangup']){logger[_0xf788('0x25')](_0xf788('0x2b'),inspect(_0x2f75c2));return _[_0xf788('0x2d')](_0x2f75c2[_0xf788('0x2e')])?null:_0x2f75c2[_0xf788('0x2e')][_0xf788('0x2f')]();}else{logger[_0xf788('0xa')](_0xf788('0x2b'),inspect(_0x2f75c2));return null;}}else{logger[_0xf788('0xa')](_0xf788('0x30'));return null;}}catch(_0xf25a53){logger[_0xf788('0xa')](_0xf25a53[_0xf788('0xc')]);return null;}});if(_0x412de4[_0xf788('0x31')]){logger[_0xf788('0x1e')](util[_0xf788('0x1d')](_0xf788('0x32'),_0x5e8a65['arg_1'],_0x5e8a65['calleridname'],_0x5e8a65['callerid'],_0x5e8a65['dnid'],_0x5e8a65[_0xf788('0x23')]));_0x26a449['traverseBFS'](_0x412de4['finally']['id'],function(_0xe4096d){try{_0xe4096d=_0xb79113[_0xf788('0x24')](_0xe4096d);logger[_0xf788('0x25')](_0xf788('0x33'),JSON[_0xf788('0x1c')](_0xe4096d,null,0x2));if(_0xe4096d&&_0xb79113[_0xe4096d[_0xf788('0x26')]]){_0x2f75c2=_0xb79113[_0xe4096d['agicommand']](_0xe4096d);if(_0x2f75c2){logger['debug'](_0xf788('0x2b'),inspect(_0x2f75c2));return _['isUndefined'](_0x2f75c2[_0xf788('0x2e')])?null:_0x2f75c2[_0xf788('0x2e')]['toString']();}else{logger[_0xf788('0xa')]('response',inspect(_0x2f75c2));return null;}}else{logger[_0xf788('0xa')](_0xf788('0x30'));return null;}}catch(_0x2a5578){logger[_0xf788('0xa')](_0x2a5578[_0xf788('0xc')]);return null;}});}logger[_0xf788('0x1e')](util['format'](_0xf788('0x34'),_0x5e8a65['arg_1'],_0x5e8a65['calleridname'],_0x5e8a65[_0xf788('0x35')],_0x5e8a65[_0xf788('0x22')],_0x5e8a65[_0xf788('0x23')]));logger[_0xf788('0x1e')](util['format'](_0xf788('0x36'),_0x5e8a65[_0xf788('0x28')],_0x5e8a65[_0xf788('0x29')],parseInt(_0x5e8a65['priority'],0xa)+0x1));_0x5e8a65['continueAt'](_0x5e8a65[_0xf788('0x28')],_0x5e8a65[_0xf788('0x29')],parseInt(_0x5e8a65['priority'],0xa)+0x1);_0x5e8a65[_0xf788('0x37')]();}function handleNotFound(_0x5e06c7){logger['error'](util[_0xf788('0x1d')]('Project\x20%s\x20not\x20found',_0x5e06c7[_0xf788('0x20')]));_0x5e06c7[_0xf788('0x38')](_0x5e06c7['context'],_0x5e06c7[_0xf788('0x29')],parseInt(_0x5e06c7[_0xf788('0x2a')],0xa)+0x1);_0x5e06c7['close']();}function handleUnpublished(_0x51ba95){logger[_0xf788('0xa')](util[_0xf788('0x1d')]('Project\x20%s\x20not\x20published',_0x51ba95[_0xf788('0x20')]));_0x51ba95[_0xf788('0x38')](_0x51ba95[_0xf788('0x28')],_0x51ba95[_0xf788('0x29')],parseInt(_0x51ba95['priority'],0xa)+0x1);_0x51ba95[_0xf788('0x37')]();}module[_0xf788('0x39')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index aafdc59..79a865e 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 _0x6325=['headers','indexOf','substring','emit','util','stream','Transform','_localBuffer','_inBody','inherits','_transform','toString','length','split','slice'];(function(_0x483c14,_0x52ab2c){var _0xad5792=function(_0x32fdd3){while(--_0x32fdd3){_0x483c14['push'](_0x483c14['shift']());}};_0xad5792(++_0x52ab2c);}(_0x6325,0x18a));var _0x5632=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6325[_0x2dafbe];return _0x58a45a;};'use strict';var util=require(_0x5632('0x0'));var Transform=require(_0x5632('0x1'))[_0x5632('0x2')];function AGIReply(_0x51b46e){Transform['call'](this,_0x51b46e);this[_0x5632('0x3')]='';this[_0x5632('0x4')]=![];}util[_0x5632('0x5')](AGIReply,Transform);AGIReply['prototype'][_0x5632('0x6')]=function(_0x5db527,_0x5cb115,_0x556a0f){var _0x6cea79='\x0a',_0x1216b6=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x29c306=-0x1,_0x4839c2=-0x1,_0x3f5abd='',_0xd59068=0x0,_0x5bc364='',_0x299577='';this[_0x5632('0x3')]+=_0x5db527[_0x5632('0x7')]();_0x5bc364=this[_0x5632('0x3')];if(!this[_0x5632('0x4')]){_0xd59068=0x0;while(_0x1216b6[_0xd59068]){while((_0x4839c2=_0x5bc364['indexOf'](_0x1216b6[_0xd59068]))!=-0x1){_0x3f5abd=_0x1216b6[_0xd59068];_0x299577=_0x5bc364['substring'](0x0,_0x4839c2);_0x5bc364=_0x5bc364['substring'](_0x4839c2+_0x3f5abd[_0x5632('0x8')]);var _0x2b0aef=_0x299577[_0x5632('0x9')](_0x6cea79),_0x47e53b=0x0,_0xbad3d1={},_0x51db62='',_0x521a8d='',_0x59679b=-0x1;while(_0x2b0aef[_0x47e53b]){_0x59679b=_0x2b0aef[_0x47e53b]['indexOf'](':');if(_0x59679b!=-0x1){_0x51db62=_0x2b0aef[_0x47e53b][_0x5632('0xa')](0x0,_0x59679b)['trim']();_0x521a8d=_0x2b0aef[_0x47e53b][_0x5632('0xa')](_0x59679b+0x1)['trim']();if(_0x51db62['length']>0x0){_0xbad3d1[_0x51db62]=_0x521a8d;}}else{}_0x47e53b++;}this['emit'](_0x5632('0xb'),_0xbad3d1);this[_0x5632('0x4')]=!![];}_0xd59068++;}this[_0x5632('0x3')]=_0x5bc364;}else{while((_0x29c306=_0x5bc364[_0x5632('0xc')](_0x6cea79))!=-0x1){_0x299577=_0x5bc364[_0x5632('0xd')](0x0,_0x29c306);this[_0x5632('0xe')]('line',_0x299577);_0x5bc364=_0x5bc364[_0x5632('0xd')](_0x29c306+_0x6cea79['length']);}this[_0x5632('0x3')]=_0x5bc364;}_0x556a0f();};module['exports']=AGIReply; \ No newline at end of file +var _0xbc5e=['line','exports','util','stream','Transform','call','_localBuffer','_inBody','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split','trim','headers'];(function(_0x58a4ac,_0x43fd42){var _0x545810=function(_0x308e65){while(--_0x308e65){_0x58a4ac['push'](_0x58a4ac['shift']());}};_0x545810(++_0x43fd42);}(_0xbc5e,0xda));var _0xebc5=function(_0x8e383a,_0x37b5a6){_0x8e383a=_0x8e383a-0x0;var _0xaaafb1=_0xbc5e[_0x8e383a];return _0xaaafb1;};'use strict';var util=require(_0xebc5('0x0'));var Transform=require(_0xebc5('0x1'))[_0xebc5('0x2')];function AGIReply(_0x64eab0){Transform[_0xebc5('0x3')](this,_0x64eab0);this[_0xebc5('0x4')]='';this[_0xebc5('0x5')]=![];}util['inherits'](AGIReply,Transform);AGIReply[_0xebc5('0x6')][_0xebc5('0x7')]=function(_0x2c9598,_0x4b117f,_0x1d4bf2){var _0x34a53a='\x0a',_0x4cc601=['\x0a\x0a',_0xebc5('0x8')],_0x13545f=-0x1,_0x5a5990=-0x1,_0x2416da='',_0xb18916=0x0,_0x3654b7='',_0x1c912b='';this[_0xebc5('0x4')]+=_0x2c9598[_0xebc5('0x9')]();_0x3654b7=this['_localBuffer'];if(!this[_0xebc5('0x5')]){_0xb18916=0x0;while(_0x4cc601[_0xb18916]){while((_0x5a5990=_0x3654b7[_0xebc5('0xa')](_0x4cc601[_0xb18916]))!=-0x1){_0x2416da=_0x4cc601[_0xb18916];_0x1c912b=_0x3654b7[_0xebc5('0xb')](0x0,_0x5a5990);_0x3654b7=_0x3654b7[_0xebc5('0xb')](_0x5a5990+_0x2416da[_0xebc5('0xc')]);var _0x52429d=_0x1c912b[_0xebc5('0xd')](_0x34a53a),_0x39f5d8=0x0,_0x31a833={},_0x513c85='',_0x38545e='',_0x48bc4a=-0x1;while(_0x52429d[_0x39f5d8]){_0x48bc4a=_0x52429d[_0x39f5d8]['indexOf'](':');if(_0x48bc4a!=-0x1){_0x513c85=_0x52429d[_0x39f5d8]['slice'](0x0,_0x48bc4a)[_0xebc5('0xe')]();_0x38545e=_0x52429d[_0x39f5d8]['slice'](_0x48bc4a+0x1)[_0xebc5('0xe')]();if(_0x513c85[_0xebc5('0xc')]>0x0){_0x31a833[_0x513c85]=_0x38545e;}}else{}_0x39f5d8++;}this['emit'](_0xebc5('0xf'),_0x31a833);this[_0xebc5('0x5')]=!![];}_0xb18916++;}this[_0xebc5('0x4')]=_0x3654b7;}else{while((_0x13545f=_0x3654b7['indexOf'](_0x34a53a))!=-0x1){_0x1c912b=_0x3654b7[_0xebc5('0xb')](0x0,_0x13545f);this['emit'](_0xebc5('0x10'),_0x1c912b);_0x3654b7=_0x3654b7[_0xebc5('0xb')](_0x13545f+_0x34a53a[_0xebc5('0xc')]);}this[_0xebc5('0x4')]=_0x3654b7;}_0x1d4bf2();};module[_0xebc5('0x11')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 561dbe6..0681a97 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 _0x1ee2=['getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','getSoundById','ShowSound','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','merge','arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ListId','CreateCmContact','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','lodash','moment','jayson/promise','client','http','then','error','result','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x1ee2,0x11c));var _0x21ee=function(_0x3cf908,_0x5af044){_0x3cf908=_0x3cf908-0x0;var _0x3706=_0x1ee2[_0x3cf908];return _0x3706;};'use strict';var _=require(_0x21ee('0x0'));var moment=require(_0x21ee('0x1'));var jayson=require(_0x21ee('0x2'));var client=jayson[_0x21ee('0x3')][_0x21ee('0x4')]({'port':0x2329});function request(_0x48c7ff,_0x176aba){return new Promise(function(_0x44530a,_0x5f1b4a){return client['request'](_0x48c7ff,_0x176aba)[_0x21ee('0x5')](function(_0x185cf0){if(_0x185cf0[_0x21ee('0x6')]){return _0x5f1b4a(_0x185cf0[_0x21ee('0x6')]['message']);}else{return _0x44530a(_0x185cf0[_0x21ee('0x7')]);}})[_0x21ee('0x8')](function(_0x38588c){return _0x5f1b4a(_0x38588c);});});}exports[_0x21ee('0x9')]=function(){return request(_0x21ee('0xa'),{'options':{'raw':![],'attributes':['id',_0x21ee('0xb'),_0x21ee('0xc')]}});};exports[_0x21ee('0xd')]=function(_0x26df7a){return request(_0x21ee('0xe'),{'options':{'raw':![],'where':{'name':_0x26df7a},'attributes':[_0x21ee('0xc')]}});};exports['getMailAccountById']=function(_0x55df71){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x55df71},'include':[{'model':_0x21ee('0xf'),'as':_0x21ee('0x10'),'include':[{'model':_0x21ee('0x11'),'as':_0x21ee('0x11')}]}],'attributes':['id','name',_0x21ee('0x12')],'smtp':!![]}});};exports[_0x21ee('0x13')]=function(_0x177e3f){return request(_0x21ee('0xe'),{'options':{'where':{'id':_0x177e3f},'attributes':[_0x21ee('0xb')]}});};exports[_0x21ee('0x14')]=function(_0x213947){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x213947},'attributes':[_0x21ee('0xb')]}});};exports[_0x21ee('0x15')]=function(_0x2068a9){return request(_0x21ee('0x16'),{'options':{'where':{'id':_0x2068a9},'attributes':[_0x21ee('0xb')]}});};exports[_0x21ee('0x17')]=function(_0x5830ab){return request(_0x21ee('0x18'),{'options':{'where':{'id':_0x5830ab},'attributes':[_0x21ee('0x19')]}});};exports[_0x21ee('0x1a')]=function(_0x46a530){return request(_0x21ee('0x1b'),{'options':{'where':{'id':_0x46a530},'attributes':[_0x21ee('0xb')]}});};exports[_0x21ee('0x1c')]=function(_0xd9506f){return request(_0x21ee('0x1d'),{'options':{'where':{'phone':_0xd9506f[_0x21ee('0x1e')]},'attributes':['id']}});};exports[_0x21ee('0x1f')]=function(_0x45f153){return request('ShowTrunk',{'options':{'where':{'id':_0x45f153},'attributes':[_0x21ee('0xb')]}});};exports[_0x21ee('0x20')]=function(_0x4822ca){return request(_0x21ee('0x21'),{'options':{'where':{'id':_0x4822ca},'attributes':['save_name']}});};exports[_0x21ee('0x22')]=function(_0x216ed4){return request(_0x21ee('0x23'),{'options':{'raw':![],'where':{'id':_0x216ed4},'include':[{'model':_0x21ee('0x24'),'as':_0x21ee('0x25')}]}});};exports[_0x21ee('0x26')]=function(_0x2fb6a3){return request(_0x21ee('0x27'),{'options':{'where':{'id':_0x2fb6a3},'attributes':['id','name']}});};exports[_0x21ee('0x28')]=function(_0x262769){return request('CreateSmsMessage',{'body':_0x262769});};exports[_0x21ee('0x29')]=function(_0x5ae320){return request(_0x21ee('0x2a'),{'body':_0x5ae320});};exports[_0x21ee('0x2b')]=function(_0x27f32e){return request('CreateSquareReport',{'body':_[_0x21ee('0x2c')](_0x27f32e,{'project_name':_0x27f32e['arg_1'],'prev_project_name':_0x27f32e[_0x21ee('0x2d')]||'','is_subproject':_0x27f32e[_0x21ee('0x2d')]?!![]:![],'leaveAt':moment()[_0x21ee('0x2e')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x21ee('0x2f')]=function(_0x5d1098){return request(_0x21ee('0x30'),{'body':_0x5d1098});};exports[_0x21ee('0x31')]=function(_0x5110ce){return request(_0x21ee('0x32'),{'body':_0x5110ce});};exports[_0x21ee('0x33')]=function(_0x264eb1){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x264eb1[_0x21ee('0x1e')],'ListId':_0x264eb1[_0x21ee('0x34')]}}})[_0x21ee('0x5')](function(_0x4bbc1a){if(_0x4bbc1a){return _0x4bbc1a;}return request(_0x21ee('0x35'),{'body':_0x264eb1});});};exports['getPauseById']=function(_0x46c2d3){return request(_0x21ee('0x36'),{'options':{'where':{'id':_0x46c2d3},'attributes':[_0x21ee('0xb')]}});};exports[_0x21ee('0x37')]=function(_0x3661fd,_0x1afa76){return request(_0x21ee('0x38'),{'body':{'interface':_0x1afa76},'options':{'where':_0x3661fd}});};exports[_0x21ee('0x39')]=function(_0x4d48e6,_0x1da906,_0x1d94e7){return request(_0x21ee('0x3a'),{'body':{'type':_0x1da906,'uniqueid':_0x1d94e7},'options':{'where':_0x4d48e6}});};exports[_0x21ee('0x3b')]=function(_0x1bfee2){return request(_0x21ee('0x3c'),{'body':{},'options':{'where':_0x1bfee2}});};exports[_0x21ee('0x3d')]=function(_0x36c556){return request('LogoutUser',{'body':{},'options':{'where':_0x36c556}});}; \ No newline at end of file +var _0xff98=['getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getContactByPhone','GetContactByPhone','phone','getTrunkById','getSoundById','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','agentLogout','LogoutUser','moment','jayson/promise','client','http','then','error','message','result','catch','getSquareProjects','GetSquareProjects','production','getSquareProject','ShowSquareProject','getMailAccountById','CloudProvider','name','getSquareProjectById'];(function(_0x3de2a7,_0x5a3185){var _0x3d9f4a=function(_0x5db017){while(--_0x5db017){_0x3de2a7['push'](_0x3de2a7['shift']());}};_0x3d9f4a(++_0x5a3185);}(_0xff98,0x9c));var _0x8ff9=function(_0x111c2e,_0x4d75f5){_0x111c2e=_0x111c2e-0x0;var _0x38c936=_0xff98[_0x111c2e];return _0x38c936;};'use strict';var _=require('lodash');var moment=require(_0x8ff9('0x0'));var jayson=require(_0x8ff9('0x1'));var client=jayson[_0x8ff9('0x2')][_0x8ff9('0x3')]({'port':0x2329});function request(_0x53d201,_0x247593){return new Promise(function(_0x4d7d49,_0x133d7c){return client['request'](_0x53d201,_0x247593)[_0x8ff9('0x4')](function(_0x50c460){if(_0x50c460[_0x8ff9('0x5')]){return _0x133d7c(_0x50c460[_0x8ff9('0x5')][_0x8ff9('0x6')]);}else{return _0x4d7d49(_0x50c460[_0x8ff9('0x7')]);}})[_0x8ff9('0x8')](function(_0x428b0f){return _0x133d7c(_0x428b0f);});});}exports[_0x8ff9('0x9')]=function(){return request(_0x8ff9('0xa'),{'options':{'raw':![],'attributes':['id','name',_0x8ff9('0xb')]}});};exports[_0x8ff9('0xc')]=function(_0x1bab3d){return request(_0x8ff9('0xd'),{'options':{'raw':![],'where':{'name':_0x1bab3d},'attributes':[_0x8ff9('0xb')]}});};exports[_0x8ff9('0xe')]=function(_0x177f72){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x177f72},'include':[{'model':'MailServerOut','as':'Smtp','include':[{'model':_0x8ff9('0xf'),'as':_0x8ff9('0xf')}]}],'attributes':['id',_0x8ff9('0x10'),'email'],'smtp':!![]}});};exports[_0x8ff9('0x11')]=function(_0x79efb){return request(_0x8ff9('0xd'),{'options':{'where':{'id':_0x79efb},'attributes':[_0x8ff9('0x10')]}});};exports[_0x8ff9('0x12')]=function(_0x169a0e){return request(_0x8ff9('0x13'),{'options':{'where':{'id':_0x169a0e},'attributes':['name']}});};exports[_0x8ff9('0x14')]=function(_0x25ca31){return request(_0x8ff9('0x15'),{'options':{'where':{'id':_0x25ca31},'attributes':['name']}});};exports[_0x8ff9('0x16')]=function(_0x52ff51){return request(_0x8ff9('0x17'),{'options':{'where':{'id':_0x52ff51},'attributes':['dsn']}});};exports['getUserById']=function(_0x4b321a){return request('ShowUser',{'options':{'where':{'id':_0x4b321a},'attributes':[_0x8ff9('0x10')]}});};exports[_0x8ff9('0x18')]=function(_0xad903b){return request(_0x8ff9('0x19'),{'options':{'where':{'phone':_0xad903b[_0x8ff9('0x1a')]},'attributes':['id']}});};exports[_0x8ff9('0x1b')]=function(_0x34390b){return request('ShowTrunk',{'options':{'where':{'id':_0x34390b},'attributes':[_0x8ff9('0x10')]}});};exports[_0x8ff9('0x1c')]=function(_0x1b0a2d){return request('ShowSound',{'options':{'where':{'id':_0x1b0a2d},'attributes':[_0x8ff9('0x1d')]}});};exports[_0x8ff9('0x1e')]=function(_0xbd1c60){return request(_0x8ff9('0x1f'),{'options':{'raw':![],'where':{'id':_0xbd1c60},'include':[{'model':_0x8ff9('0x20'),'as':_0x8ff9('0x21')}]}});};exports[_0x8ff9('0x22')]=function(_0x2ca5c3){return request(_0x8ff9('0x23'),{'options':{'where':{'id':_0x2ca5c3},'attributes':['id',_0x8ff9('0x10')]}});};exports[_0x8ff9('0x24')]=function(_0x2979b0){return request(_0x8ff9('0x25'),{'body':_0x2979b0});};exports['createSquareDetailsReport']=function(_0x4de8b5){return request(_0x8ff9('0x26'),{'body':_0x4de8b5});};exports['createSquareReport']=function(_0x2060d9){return request('CreateSquareReport',{'body':_[_0x8ff9('0x27')](_0x2060d9,{'project_name':_0x2060d9[_0x8ff9('0x28')],'prev_project_name':_0x2060d9[_0x8ff9('0x29')]||'','is_subproject':_0x2060d9[_0x8ff9('0x29')]?!![]:![],'leaveAt':moment()[_0x8ff9('0x2a')](_0x8ff9('0x2b'))})});};exports[_0x8ff9('0x2c')]=function(_0x2299d4){return request(_0x8ff9('0x2d'),{'body':_0x2299d4});};exports[_0x8ff9('0x2e')]=function(_0x4ccd5e){return request(_0x8ff9('0x2f'),{'body':_0x4ccd5e});};exports[_0x8ff9('0x30')]=function(_0x3b89ec){return request(_0x8ff9('0x31'),{'options':{'raw':![],'where':{'phone':_0x3b89ec[_0x8ff9('0x1a')],'ListId':_0x3b89ec['ListId']}}})[_0x8ff9('0x4')](function(_0x4954a6){if(_0x4954a6){return _0x4954a6;}return request(_0x8ff9('0x32'),{'body':_0x3b89ec});});};exports[_0x8ff9('0x33')]=function(_0x1c6676){return request(_0x8ff9('0x34'),{'options':{'where':{'id':_0x1c6676},'attributes':[_0x8ff9('0x10')]}});};exports[_0x8ff9('0x35')]=function(_0x52d14f,_0xe9ade1){return request(_0x8ff9('0x36'),{'body':{'interface':_0xe9ade1},'options':{'where':_0x52d14f}});};exports[_0x8ff9('0x37')]=function(_0xff972b,_0x33a10d,_0x216a84){return request('PauseUser',{'body':{'type':_0x33a10d,'uniqueid':_0x216a84},'options':{'where':_0xff972b}});};exports['agentUnpause']=function(_0x12b513){return request('UnpauseUser',{'body':{},'options':{'where':_0x12b513}});};exports[_0x8ff9('0x38')]=function(_0x11f07c){return request(_0x8ff9('0x39'),{'body':{},'options':{'where':_0x11f07c}});}; \ 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 8263b9b..df4ba78 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 _0x0650=['./polly','./lex','exports'];(function(_0x2e83da,_0x18f3b0){var _0x23fa0a=function(_0x54b24f){while(--_0x54b24f){_0x2e83da['push'](_0x2e83da['shift']());}};_0x23fa0a(++_0x18f3b0);}(_0x0650,0x1aa));var _0x0065=function(_0x179b80,_0x440291){_0x179b80=_0x179b80-0x0;var _0x1e8d03=_0x0650[_0x179b80];return _0x1e8d03;};var polly=require(_0x0065('0x0'));var lex=require(_0x0065('0x1'));module[_0x0065('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x8ca9=['./polly','./lex','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8ca9,0x9c));var _0x98ca=function(_0x2c4b31,_0x4f4d43){_0x2c4b31=_0x2c4b31-0x0;var _0x3824bf=_0x8ca9[_0x2c4b31];return _0x3824bf;};var polly=require(_0x98ca('0x0'));var lex=require(_0x98ca('0x1'));module[_0x98ca('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 1a8a92f..cce6a73 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. * // * * // ************************************************************************* -'use strict';var lex=require('./lib/api');module['exports']=function(_0x46400f,_0xa5f6b7,_0x4a08d4,_0x5080f5,_0x229028,_0x1fdf5b){return lex(_0x46400f,_0xa5f6b7,_0x4a08d4,_0x5080f5,_0x229028,_0x1fdf5b);}; \ No newline at end of file +var _0x9354=['exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9354,0x96));var _0x4935=function(_0x26d26f,_0x302cce){_0x26d26f=_0x26d26f-0x0;var _0x5c8c0e=_0x9354[_0x26d26f];return _0x5c8c0e;};'use strict';var lex=require('./lib/api');module[_0x4935('0x0')]=function(_0xc3c1f3,_0x4896da,_0x263dd5,_0x2a4993,_0x29d1eb,_0x280bbc){return lex(_0xc3c1f3,_0x4896da,_0x263dd5,_0x2a4993,_0x29d1eb,_0x280bbc);}; \ 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 df23f66..3d56f16 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(_0x1c1b1b,_0x166a53){var _0x48e300=function(_0x4b07fc){while(--_0x4b07fc){_0x1c1b1b['push'](_0x1c1b1b['shift']());}};_0x48e300(++_0x166a53);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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(_0x3318be,_0x5394b1){var _0x570cec=function(_0x428ae0){while(--_0x428ae0){_0x3318be['push'](_0x3318be['shift']());}};_0x570cec(++_0x5394b1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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 2c711e6..771aef5 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 _0xd575=['exports','./lib/api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd575,0x131));var _0x5d57=function(_0x49d19d,_0x245cf5){_0x49d19d=_0x49d19d-0x0;var _0x4ebef1=_0xd575[_0x49d19d];return _0x4ebef1;};'use strict';var polly=require(_0x5d57('0x0'));module[_0x5d57('0x1')]=function(_0x40e6ee,_0x19cb0e,_0x52359c,_0x409ffd,_0x99f81b,_0x3c9324,_0x218720){return polly(_0x40e6ee,_0x19cb0e,_0x52359c,_0x409ffd,_0x99f81b,_0x3c9324,_0x218720);}; \ No newline at end of file +var _0x3e47=['exports','./lib/api'];(function(_0x568567,_0x2fbdbb){var _0x558a49=function(_0x40882d){while(--_0x40882d){_0x568567['push'](_0x568567['shift']());}};_0x558a49(++_0x2fbdbb);}(_0x3e47,0xcb));var _0x73e4=function(_0x3cdf50,_0x3e8eb2){_0x3cdf50=_0x3cdf50-0x0;var _0x22d47a=_0x3e47[_0x3cdf50];return _0x22d47a;};'use strict';var polly=require(_0x73e4('0x0'));module[_0x73e4('0x1')]=function(_0x5424ba,_0x247eeb,_0x2f832b,_0x5f410b,_0x2cf135,_0x2411af,_0x26497b){return polly(_0x5424ba,_0x247eeb,_0x2f832b,_0x5f410b,_0x2cf135,_0x2411af,_0x26497b);}; \ 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 6f6ef2e..f25fbec 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 _0x0732=['writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','randomstring','aws-sdk','synthesizeSpeech','AudioStream'];(function(_0x392783,_0x5a3c6b){var _0x27cde5=function(_0x4e2ffe){while(--_0x4e2ffe){_0x392783['push'](_0x392783['shift']());}};_0x27cde5(++_0x5a3c6b);}(_0x0732,0x163));var _0x2073=function(_0x32be82,_0x21b592){_0x32be82=_0x32be82-0x0;var _0x35aa04=_0x0732[_0x32be82];return _0x35aa04;};'use strict';var fs=require('fs');var path=require(_0x2073('0x0'));var BPromise=require('bluebird');var rs=require(_0x2073('0x1'));var AWS=require(_0x2073('0x2'));function pollyResult(_0x248c58,_0x2d49ea,_0xcac3c){return new BPromise(function(_0x4691f2,_0x4dff92){_0x248c58[_0x2073('0x3')](_0x2d49ea,function(_0x5f10fc,_0x417ad0){if(_0x5f10fc){_0x4dff92(_0x5f10fc);}else if(_0x417ad0){if(_0x417ad0[_0x2073('0x4')]instanceof Buffer){fs[_0x2073('0x5')](_0xcac3c,_0x417ad0[_0x2073('0x4')],function(_0x325876){if(_0x325876){_0x4dff92(_0x325876);}else{_0x4691f2();}});}else{_0x4dff92(new Error(_0x2073('0x6')));}}else{_0x4dff92(new Error(_0x2073('0x7')));}});});}module[_0x2073('0x8')]=function(_0x332ded,_0x4ded83,_0x63f3a8,_0x55daa2,_0x471ee7,_0x32f22d,_0x4accde){var _0x187c4f=new AWS[(_0x2073('0x9'))]({'accessKeyId':_0x332ded,'secretAccessKey':_0x4ded83,'region':_0x63f3a8});var _0x37b658={'Text':_0x471ee7,'TextType':_0x32f22d||_0x2073('0xa'),'OutputFormat':_0x2073('0xb'),'VoiceId':_0x55daa2};return pollyResult(_0x187c4f,_0x37b658,_0x4accde);}; \ No newline at end of file +var _0xe484=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','text','path','aws-sdk','AudioStream'];(function(_0x35f9ee,_0x106be3){var _0x384ef9=function(_0x6a65c7){while(--_0x6a65c7){_0x35f9ee['push'](_0x35f9ee['shift']());}};_0x384ef9(++_0x106be3);}(_0xe484,0x1e3));var _0x4e48=function(_0x31405d,_0x3a904e){_0x31405d=_0x31405d-0x0;var _0x522c17=_0xe484[_0x31405d];return _0x522c17;};'use strict';var fs=require('fs');var path=require(_0x4e48('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var AWS=require(_0x4e48('0x1'));function pollyResult(_0x280734,_0x430ae5,_0x2c4a51){return new BPromise(function(_0x526f49,_0xdee6d4){_0x280734['synthesizeSpeech'](_0x430ae5,function(_0x25e162,_0x14b103){if(_0x25e162){_0xdee6d4(_0x25e162);}else if(_0x14b103){if(_0x14b103[_0x4e48('0x2')]instanceof Buffer){fs['writeFile'](_0x2c4a51,_0x14b103[_0x4e48('0x2')],function(_0x595a9e){if(_0x595a9e){_0xdee6d4(_0x595a9e);}else{_0x526f49();}});}else{_0xdee6d4(new Error(_0x4e48('0x3')));}}else{_0xdee6d4(new Error(_0x4e48('0x4')));}});});}module['exports']=function(_0x43b4a6,_0x21fdef,_0xd02d05,_0x4eed55,_0x30e1b0,_0x1d8e72,_0x1cadfa){var _0x572841=new AWS['Polly']({'accessKeyId':_0x43b4a6,'secretAccessKey':_0x21fdef,'region':_0xd02d05});var _0x5782f0={'Text':_0x30e1b0,'TextType':_0x1d8e72||_0x4e48('0x5'),'OutputFormat':'mp3','VoiceId':_0x4eed55};return pollyResult(_0x572841,_0x5782f0,_0x1cadfa);}; \ 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 9246347..eafff51 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 _0xbac5=['exports'];(function(_0x49f4a7,_0x5346e7){var _0x579df8=function(_0x4aa1f9){while(--_0x4aa1f9){_0x49f4a7['push'](_0x49f4a7['shift']());}};_0x579df8(++_0x5346e7);}(_0xbac5,0x1ed));var _0x5bac=function(_0xd24b43,_0x11caa4){_0xd24b43=_0xd24b43-0x0;var _0x2b1b44=_0xbac5[_0xd24b43];return _0x2b1b44;};'use strict';var asr=require('./lib/api');module[_0x5bac('0x0')]=function(_0x431757,_0x29ecbd,_0x530a68,_0x1c8d9f){return asr(_0x431757,_0x29ecbd,_0x530a68);}; \ No newline at end of file +var _0x33dd=['./lib/api'];(function(_0x24392f,_0x15a3e5){var _0x591e33=function(_0xe0ccea){while(--_0xe0ccea){_0x24392f['push'](_0x24392f['shift']());}};_0x591e33(++_0x15a3e5);}(_0x33dd,0x14e));var _0xd33d=function(_0x2a5774,_0xf573ec){_0x2a5774=_0x2a5774-0x0;var _0x560afd=_0x33dd[_0x2a5774];return _0x560afd;};'use strict';var asr=require(_0xd33d('0x0'));module['exports']=function(_0x10d7e1,_0x37f4a7,_0x41f750,_0x12a6f8){return asr(_0x10d7e1,_0x37f4a7,_0x41f750);}; \ 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 d117386..fac1391 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 _0x2750=['/v1/speech:recognize?key=','LINEAR16','8000','url','https://speech.googleapis.com','exports','string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync'];(function(_0x1034ca,_0x14ecd6){var _0x1a023a=function(_0x2cfa65){while(--_0x2cfa65){_0x1034ca['push'](_0x1034ca['shift']());}};_0x1a023a(++_0x14ecd6);}(_0x2750,0x13b));var _0x0275=function(_0x4b55b8,_0x6e4c76){_0x4b55b8=_0x4b55b8-0x0;var _0x30bee=_0x2750[_0x4b55b8];return _0x30bee;};'use strict';var url=require(_0x0275('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0x0275('0x1');module[_0x0275('0x2')]=function(_0x372744,_0x429a37,_0x101b26){return new BPromise(function(_0x41ec06,_0x20273d){var _0x4960;if(typeof _0x372744!==_0x0275('0x3')||_0x372744[_0x0275('0x4')]===0x0){return _0x20273d('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x429a37!==_0x0275('0x3')||_0x429a37[_0x0275('0x4')]===0x0){return _0x20273d(_0x0275('0x5'));}if(typeof _0x101b26!==_0x0275('0x6')&&(typeof _0x101b26!=='string'||_0x101b26[_0x0275('0x4')]===0x0)){return _0x20273d(_0x0275('0x7'));}try{_0x4960=fs[_0x0275('0x8')](_0x372744)['toString']('base64');}catch(_0x224e0f){return _0x20273d(_0x224e0f);}return _0x41ec06({'method':'POST','uri':host+_0x0275('0x9')+_0x429a37,'body':{'config':{'encoding':_0x0275('0xa'),'sampleRateHertz':_0x0275('0xb'),'languageCode':_0x101b26},'audio':{'content':_0x4960}},'json':!![]});});}; \ No newline at end of file +var _0x7dc2=['readFileSync','toString','/v1/speech:recognize?key=','LINEAR16','8000','https://speech.googleapis.com','exports','string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string'];(function(_0x1fbe31,_0x2eb71a){var _0x5d7320=function(_0x31f889){while(--_0x31f889){_0x1fbe31['push'](_0x1fbe31['shift']());}};_0x5d7320(++_0x2eb71a);}(_0x7dc2,0x19d));var _0x27dc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7dc2[_0x20a584];return _0x4b41a8;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host=_0x27dc('0x0');module[_0x27dc('0x1')]=function(_0x49a9e7,_0x426f56,_0x57d4b4){return new BPromise(function(_0x15d70c,_0x29ba23){var _0x52337b;if(typeof _0x49a9e7!==_0x27dc('0x2')||_0x49a9e7[_0x27dc('0x3')]===0x0){return _0x29ba23('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x426f56!==_0x27dc('0x2')||_0x426f56['length']===0x0){return _0x29ba23(_0x27dc('0x4'));}if(typeof _0x57d4b4!==_0x27dc('0x5')&&(typeof _0x57d4b4!=='string'||_0x57d4b4[_0x27dc('0x3')]===0x0)){return _0x29ba23(_0x27dc('0x6'));}try{_0x52337b=fs[_0x27dc('0x7')](_0x49a9e7)[_0x27dc('0x8')]('base64');}catch(_0x1d93ef){return _0x29ba23(_0x1d93ef);}return _0x15d70c({'method':'POST','uri':host+_0x27dc('0x9')+_0x426f56,'body':{'config':{'encoding':_0x27dc('0xa'),'sampleRateHertz':_0x27dc('0xb'),'languageCode':_0x57d4b4},'audio':{'content':_0x52337b}},'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 b287e36..07ea7c0 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 _0xa094=['exports','./asr'];(function(_0x3b177e,_0x4609d1){var _0x4f39cb=function(_0x432514){while(--_0x432514){_0x3b177e['push'](_0x3b177e['shift']());}};_0x4f39cb(++_0x4609d1);}(_0xa094,0xe7));var _0x4a09=function(_0x49272d,_0x1bca92){_0x49272d=_0x49272d-0x0;var _0x98f6f=_0xa094[_0x49272d];return _0x98f6f;};var asr=require(_0x4a09('0x0'));module[_0x4a09('0x1')]={'asr':asr}; \ No newline at end of file +var _0xa512=['exports','./asr'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xa512,0x12f));var _0x2a51=function(_0x296d93,_0x27ee37){_0x296d93=_0x296d93-0x0;var _0xba3f66=_0xa512[_0x296d93];return _0xba3f66;};var asr=require(_0x2a51('0x0'));module[_0x2a51('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 42a036d..3b468ce 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 _0x9704=['generate','.wav','writeFileSync','unlink','chmodSync','777','split','readFileSync','toString','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','voice','audioConfig','text:synthesize','POST','then','.mp3','from','writeFile','googleCloudTTS\x20path','stringify','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','data','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','message','googleDialogflow','resolvedQuery','result','actionIncomplete','fulfillment','speech','status','code','metadata','endConversation','googleDialogflowV2','replace','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','action','queryResult','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','freeform=3','sestekNDA','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','request-promise','randomstring','sox','url','parse','util','./aws','./google','./sestek','./tilde','agi','https://api.ispeech.org/api/rest','protocol','https:','WHAT_EVER','get','statusCode','error','statusMessage','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','info','end','host','transcode','wav','start','resolve','tmp'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x9704,0x1ed));var _0x4970=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9704[_0x3dd15e];return _0x231fd0;};'use strict';var apiai=require(_0x4970('0x0'));var BPromise=require(_0x4970('0x1'));var dialogflow=require(_0x4970('0x2'));var fs=require('fs');var http=require(_0x4970('0x3'));var https=require(_0x4970('0x4'));var md5=require(_0x4970('0x5'));var path=require(_0x4970('0x6'));var querystring=require(_0x4970('0x7'));var rp=require(_0x4970('0x8'));var rs=require(_0x4970('0x9'));var sox=require(_0x4970('0xa'));var tts=require('google-tts-api');var urlParse=require(_0x4970('0xb'))[_0x4970('0xc')];var util=require(_0x4970('0xd'));var aws=require(_0x4970('0xe'));var google=require(_0x4970('0xf'));var sestek=require(_0x4970('0x10'));var tilde=require(_0x4970('0x11'));var logger=require('../../../config/logger')(_0x4970('0x12'));var ISPEECH_API=_0x4970('0x13');function downloadFile(_0x8a735e,_0x2fdc77){return new BPromise(function(_0x5ed812,_0x68ca59){var _0x31c3fb=urlParse(_0x8a735e);var _0x1c57ed=_0x31c3fb[_0x4970('0x14')]===_0x4970('0x15')?https:http;var _0x2008e5={'host':_0x31c3fb['host'],'path':_0x31c3fb[_0x4970('0x6')],'headers':{'user-agent':_0x4970('0x16')}};_0x1c57ed[_0x4970('0x17')](_0x2008e5,function(_0x4c9344){if(_0x4c9344[_0x4970('0x18')]!==0xc8){logger[_0x4970('0x19')]('request\x20to\x20'+_0x8a735e+'\x20failed,\x20status\x20code\x20=\x20'+_0x4c9344[_0x4970('0x18')]+'\x20('+_0x4c9344[_0x4970('0x1a')]+')');_0x68ca59(new Error(_0x4970('0x1b')+_0x8a735e+_0x4970('0x1c')+_0x4c9344[_0x4970('0x18')]+'\x20('+_0x4c9344['statusMessage']+')'));return;}var _0xca2447=fs[_0x4970('0x1d')](_0x2fdc77);_0xca2447['on'](_0x4970('0x1e'),function(){logger[_0x4970('0x1f')]('finish\x20download\x20file');_0xca2447['close'](_0x5ed812);});_0xca2447['on']('error',function(_0x482656){fs['unlink'](_0x2fdc77);logger[_0x4970('0x19')]('download\x20error',_0x482656);_0x68ca59(_0x482656);});_0x4c9344['pipe'](_0xca2447);})['on']('error',function(_0xe46b1){logger['error'](_0xe46b1);_0x68ca59(_0xe46b1);})[_0x4970('0x20')]();});}function uploadFile(_0x4db5dc){return new BPromise(function(_0x3f2e39,_0x43acbf){var _0x3bfe53=urlParse(_0x4db5dc);var _0x5ddae9=_0x3bfe53[_0x4970('0x14')]==='https:'?https:http;var _0x107de9={'host':_0x3bfe53[_0x4970('0x21')],'path':_0x3bfe53['path'],'headers':{'user-agent':_0x4970('0x16')}};_0x5ddae9['get'](_0x107de9,function(_0x24eb2d){if(_0x24eb2d[_0x4970('0x18')]!==0xc8){_0x43acbf(new Error(_0x4970('0x1b')+_0x4db5dc+_0x4970('0x1c')+_0x24eb2d[_0x4970('0x18')]+'\x20('+_0x24eb2d['statusMessage']+')'));return;}var _0x4689b6='';_0x24eb2d['on']('data',function(_0x3697e4){_0x4689b6+=_0x3697e4;});_0x24eb2d['on'](_0x4970('0x20'),function(){_0x3f2e39(_0x4689b6);});})['on'](_0x4970('0x19'),function(_0x543575){_0x43acbf(_0x543575);})[_0x4970('0x20')]();});}function convertFile(_0x4fc709,_0x5d5c7c){return new BPromise(function(_0x22161b,_0x276aad){var _0xbaa44b=sox[_0x4970('0x22')](_0x4fc709,_0x5d5c7c,{'sampleRate':0x1f40,'format':_0x4970('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xbaa44b['on'](_0x4970('0x19'),function(_0x574f34){logger[_0x4970('0x19')]('error\x20convert',_0x574f34);_0x276aad(_0x574f34);});_0xbaa44b['on']('end',function(){logger['info']('finish\x20to\x20convert');_0x22161b();});_0xbaa44b[_0x4970('0x24')]();});}function base64Decode(_0x5a6708,_0x32ffd6){var _0x4b511b=path[_0x4970('0x25')](__dirname,_0x4970('0x26'),rs[_0x4970('0x27')](0x4)+_0x4970('0x28'));fs[_0x4970('0x29')](_0x4b511b,_0x5a6708,'base64');return convertFile(_0x4b511b,_0x32ffd6)['then'](function(){try{fs[_0x4970('0x2a')](_0x4b511b);fs[_0x4970('0x2b')](_0x32ffd6,_0x4970('0x2c'));}catch(_0x4db5ec){logger[_0x4970('0x19')](_0x4db5ec);}return _0x32ffd6[_0x4970('0x2d')]('.')[0x0];});}function base64Encode(_0x53f875){var _0x3fa941=fs[_0x4970('0x2e')](_0x53f875);return new Buffer(_0x3fa941)[_0x4970('0x2f')](_0x4970('0x30'));}exports[_0x4970('0x31')]=function(_0x11b9ed,_0x10acf0,_0x2ecdd8,_0x33afee,_0x2cb112,_0x1158bf){var _0x307293,_0x205dd6;var _0x4cc380=_0x4970('0x32');var _0xb64c91=_0x4970('0x33')+_0x11b9ed;var _0x4ebe55={};if(_0x10acf0==='ssml'){_0x4ebe55[_0x4970('0x34')]={'ssml':_0x2ecdd8};}else{_0x4ebe55['input']={'text':_0x2ecdd8};};_0x4ebe55[_0x4970('0x35')]={'languageCode':_0x33afee,'ssmlGender':_0x2cb112};_0x4ebe55[_0x4970('0x36')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x4146bc={'url':_0x4cc380+_0x4970('0x37')+_0xb64c91,'method':_0x4970('0x38'),'json':!![],'body':_0x4ebe55};return rp(_0x4146bc)[_0x4970('0x39')](function(_0x25bc0d){return new BPromise(function(_0x16fb0d,_0x15b05b){_0x307293=path['resolve'](__dirname,_0x4970('0x26'),rs[_0x4970('0x27')](0x4)+_0x4970('0x3a'));var _0x54b7e2=Buffer[_0x4970('0x3b')](_0x25bc0d['audioContent'],'base64');return fs[_0x4970('0x3c')](_0x307293,_0x54b7e2,function(_0x457e22){_0x15b05b(_0x457e22);},function(_0x3c0edd){fs['chmodSync'](_0x307293,'777');_0x16fb0d(_0x3c0edd);});});})[_0x4970('0x39')](function(_0x35401d){_0x205dd6=path[_0x4970('0x25')](__dirname,_0x4970('0x26'),rs[_0x4970('0x27')](0x4)+_0x4970('0x28'));return convertFile(_0x307293,_0x205dd6);})[_0x4970('0x39')](function(){try{fs['unlink'](_0x307293);fs[_0x4970('0x2b')](_0x205dd6,_0x4970('0x2c'));}catch(_0x58fd76){logger['error'](_0x58fd76);}logger[_0x4970('0x1f')](_0x4970('0x3d'),_0x205dd6[_0x4970('0x2d')]('.')[0x0]);return _0x205dd6[_0x4970('0x2d')]('.')[0x0];});};exports['googleTTS']=function(_0x30782a,_0x4766ec){var _0x3d6b5a='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x3024d5,_0x3214d9;var _0xf03500;var _0xbbc1b0={'encoding':'utf8','method':_0x4970('0x38'),'timeout':0x2710,'url':_0x3d6b5a,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':'f.req='+encodeURIComponent(JSON[_0x4970('0x3e')]([[['jQ1olc',JSON[_0x4970('0x3e')]([_0x30782a,_0x4766ec||'en',![],'null']),null,_0x4970('0x3f')]]]))};return rp(_0xbbc1b0)[_0x4970('0x39')](function(_0x7cf8e8){try{_0xf03500=eval(_0x7cf8e8[_0x4970('0x40')](0x5))[0x0][0x2];}catch(_0x5e891a){throw new Error(_0x4970('0x41')+_0x7cf8e8['data']);}if(!_0xf03500){if(_0x30782a[_0x4970('0x42')]>0xc8){throw new Error(_0x4970('0x43'));}else{throw new Error(_0x4970('0x44')+_0x4766ec+_0x4970('0x45'));}}try{_0xf03500=eval(_0xf03500)[0x0];}catch(_0x1435ce){throw new Error(_0x4970('0x41')+res[_0x4970('0x46')]);}const _0x1164ec=_0xf03500;_0x3024d5=path['resolve'](__dirname,_0x4970('0x26'),rs[_0x4970('0x27')](0x4)+_0x4970('0x3a'));fs[_0x4970('0x29')](_0x3024d5,_0xf03500,{'encoding':_0x4970('0x30')});_0x3214d9=path[_0x4970('0x25')](__dirname,_0x4970('0x26'),rs[_0x4970('0x27')](0x4)+_0x4970('0x28'));return convertFile(_0x3024d5,_0x3214d9);})[_0x4970('0x39')](function(){try{fs[_0x4970('0x2a')](_0x3024d5);fs['chmodSync'](_0x3214d9,_0x4970('0x2c'));}catch(_0x31bd24){logger[_0x4970('0x19')](_0x31bd24);}logger['info']('goggleTTS\x20path',_0x3214d9[_0x4970('0x2d')]('.')[0x0]);return _0x3214d9[_0x4970('0x2d')]('.')[0x0];});};exports['googleASR']=function(_0x4bc405,_0xf49e31,_0x5b4279){return google[_0x4970('0x47')](_0x4bc405,_0xf49e31,_0x5b4279)['then'](function(_0x327ef1){logger[_0x4970('0x1f')](_0x327ef1[_0x4970('0x48')]);return rp(_0x327ef1);})[_0x4970('0x39')](function(_0x472202){var _0x497d0a='';var _0x441313=0x0;try{fs[_0x4970('0x2a')](_0x4bc405);}catch(_0x12ede0){logger['error'](_0x12ede0);}if(_0x472202&&_0x472202[_0x4970('0x49')]){_0x497d0a=_0x472202[_0x4970('0x49')][_0x4970('0x4a')](function(_0x2c3f4c){return _0x2c3f4c&&_0x2c3f4c[_0x4970('0x4b')][0x0]&&_0x2c3f4c[_0x4970('0x4b')][0x0]['transcript']?_0x2c3f4c['alternatives'][0x0][_0x4970('0x4c')]:'';})[_0x4970('0x4d')]('\x0a');_0x441313=_0x472202[_0x4970('0x49')][_0x4970('0x4a')](function(_0x26550d){return _0x26550d&&_0x26550d[_0x4970('0x4b')][0x0]&&_0x26550d[_0x4970('0x4b')][0x0][_0x4970('0x4e')]?_0x26550d['alternatives'][0x0][_0x4970('0x4e')]:0x0;})[_0x4970('0x4d')]('\x0a');}logger[_0x4970('0x1f')](_0x4970('0x4f'),_0x497d0a);logger[_0x4970('0x1f')]('googleASR\x20confidence',_0x441313);return{'transcript':_0x497d0a,'confidence':_0x441313};})[_0x4970('0x50')](function(_0x703dca){logger[_0x4970('0x19')](_0x4970('0x51'),_0x703dca[_0x4970('0x18')],_0x703dca[_0x4970('0x52')],_0x703dca[_0x4970('0x53')]);});};exports[_0x4970('0x54')]=function(_0x3ee40e,_0x3dd73e,_0x1ff207,_0x55376d){var _0x1acb71=apiai(_0x3dd73e,{'language':_0x55376d||'en'});return _0x1acb71['textRequest'](_0x1ff207,{'sessionId':md5(_0x3ee40e)})[_0x4970('0x39')](function(_0x297e19){logger[_0x4970('0x1f')](JSON[_0x4970('0x3e')](_0x297e19));return{'source':_0x297e19['result']['source'],'resolvedQuery':_0x297e19['result'][_0x4970('0x55')],'action':_0x297e19[_0x4970('0x56')]['action'],'actionIncomplete':_0x297e19[_0x4970('0x56')][_0x4970('0x57')],'speech':_0x297e19[_0x4970('0x56')][_0x4970('0x58')][_0x4970('0x59')],'score':_0x297e19['result']['score'],'statusCode':_0x297e19[_0x4970('0x5a')][_0x4970('0x5b')],'endConversation':_0x297e19['result'][_0x4970('0x5c')][_0x4970('0x5d')]||![],'isFallbackIntent':_0x297e19[_0x4970('0x56')]['metadata']['isFallbackIntent']};});};exports[_0x4970('0x5e')]=function(_0x1a7fb5,_0x50fa5f,_0x3ee21b,_0x1429b9,_0x1d66ce,_0x588485){var _0x1a39d8=_0x1429b9[_0x4970('0x5f')](/\\n/g,'\x0a');var _0x3684e8={'credentials':{'private_key':_0x1a39d8,'client_email':_0x3ee21b}};var _0x260693=new dialogflow[(_0x4970('0x60'))](_0x3684e8);var _0x1448ee=_0x260693[_0x4970('0x61')](_0x50fa5f,md5(_0x1a7fb5));var _0x3d5f2d={'session':_0x1448ee,'queryInput':{'text':{'text':_0x1d66ce,'languageCode':_0x588485}}};return _0x260693['detectIntent'](_0x3d5f2d)[_0x4970('0x39')](function(_0x578bf2){if(_0x578bf2&&_0x578bf2[_0x4970('0x42')]){logger[_0x4970('0x1f')](_0x4970('0x62'),JSON[_0x4970('0x3e')](_0x578bf2));var _0x5acd86=_0x578bf2[0x0];if(_0x5acd86){var _0x4185f6={'action':_0x5acd86['queryResult'][_0x4970('0x63')],'allRequiredParamsPresent':_0x5acd86['queryResult']['allRequiredParamsPresent'],'endConversation':_0x5acd86[_0x4970('0x64')][_0x4970('0x65')]&&_0x5acd86[_0x4970('0x64')][_0x4970('0x65')][_0x4970('0x66')]?_0x5acd86[_0x4970('0x64')][_0x4970('0x65')]['fields'][_0x4970('0x67')][_0x4970('0x68')]:![],'fulfillmentText':_0x5acd86[_0x4970('0x64')][_0x4970('0x69')],'intentName':_0x5acd86[_0x4970('0x64')][_0x4970('0x6a')][_0x4970('0x52')],'intentDisplayName':_0x5acd86['queryResult'][_0x4970('0x6a')][_0x4970('0x6b')],'isFallbackIntent':_0x5acd86[_0x4970('0x64')][_0x4970('0x6a')]['isFallback'],'languageCode':_0x5acd86[_0x4970('0x64')][_0x4970('0x6c')],'queryText':_0x5acd86[_0x4970('0x64')][_0x4970('0x6d')],'responseId':_0x5acd86[_0x4970('0x6e')],'score':_0x5acd86[_0x4970('0x64')][_0x4970('0x6f')],'speech':_0x5acd86['queryResult'][_0x4970('0x69')],'providerResponse':JSON[_0x4970('0x3e')](_0x578bf2)};return _0x4185f6;}}});};exports[_0x4970('0x70')]=function(_0x2b3ad1,_0x2d5362,_0x1ea88b,_0x288df2){return tilde['asr'](_0x2b3ad1,_0x2d5362,_0x1ea88b,_0x288df2)[_0x4970('0x39')](function(_0x43fc21){try{fs[_0x4970('0x2a')](_0x2b3ad1);}catch(_0x1cbd46){logger[_0x4970('0x19')](_0x1cbd46);}logger[_0x4970('0x1f')](_0x4970('0x71'),_0x43fc21['transcript']);logger[_0x4970('0x1f')](_0x4970('0x72'),_0x43fc21['confidence']);return _0x43fc21;});};exports[_0x4970('0x73')]=function(_0x6647ab,_0x5d5905,_0x36e19a,_0x2ba3da,_0x7b978e,_0x13e880){var _0x72fc67=path[_0x4970('0x25')](__dirname,'tmp',rs[_0x4970('0x27')](0x4)+'.mp3');var _0x3366d0;return aws[_0x4970('0x74')](_0x6647ab,_0x5d5905,_0x36e19a,_0x2ba3da,_0x7b978e,_0x13e880,_0x72fc67)['then'](function(){_0x3366d0=path[_0x4970('0x25')](__dirname,_0x4970('0x26'),rs[_0x4970('0x27')](0x4)+_0x4970('0x28'));return convertFile(_0x72fc67,_0x3366d0);})['then'](function(){try{fs[_0x4970('0x2a')](_0x72fc67);fs[_0x4970('0x2b')](_0x3366d0,_0x4970('0x2c'));}catch(_0x18fc46){logger[_0x4970('0x19')](_0x18fc46);}return _0x3366d0[_0x4970('0x2d')]('.')[0x0];});};exports[_0x4970('0x75')]=function(_0x43a146,_0x5bded4,_0x5dbb23,_0x1583c6,_0x581b8c,_0x3ddec4){return aws[_0x4970('0x76')](_0x43a146,_0x5bded4,_0x5dbb23,_0x1583c6,_0x581b8c,_0x3ddec4)[_0x4970('0x39')](function(_0x53780f){logger[_0x4970('0x1f')](JSON[_0x4970('0x3e')](_0x53780f));return _0x53780f;});};exports[_0x4970('0x77')]=function(_0xa5744e,_0x375ce4,_0x47c6fb,_0xc32504){var _0x824692=util['format'](_0x4970('0x78'),ISPEECH_API,_0xa5744e,encodeURIComponent(_0x375ce4),_0x47c6fb,_0xc32504);var _0x3d508e=path[_0x4970('0x25')](__dirname,_0x4970('0x26'),rs['generate'](0x4)+_0x4970('0x3a'));var _0x5be5fe;return downloadFile(_0x824692,_0x3d508e)['then'](function(){_0x5be5fe=path[_0x4970('0x25')](__dirname,'tmp',rs[_0x4970('0x27')](0x4)+_0x4970('0x28'));return convertFile(_0x3d508e,_0x5be5fe);})['then'](function(){try{fs[_0x4970('0x2a')](_0x3d508e);fs[_0x4970('0x2b')](_0x5be5fe,_0x4970('0x2c'));}catch(_0x46bbd8){logger[_0x4970('0x19')](_0x46bbd8);}return _0x5be5fe['split']('.')[0x0];});};exports[_0x4970('0x79')]=function(_0x1cf348,_0x565a58,_0x85fb3d,_0x4c3fb3){var _0x28e230=util[_0x4970('0x7a')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x565a58,_0x85fb3d,base64Encode(_0x1cf348),_0x4c3fb3?util['format']('model=%s',encodeURIComponent(_0x4c3fb3)):_0x4970('0x7b'));return uploadFile(_0x28e230)['then'](function(_0x4605be){return querystring[_0x4970('0xc')](_0x4605be);});};exports[_0x4970('0x7c')]=function(_0x48c92f,_0x2a54ec){return sestek[_0x4970('0x7d')](_0x48c92f,_0x2a54ec)[_0x4970('0x39')](function(_0x243bb0){logger[_0x4970('0x1f')](JSON['stringify'](_0x243bb0));var _0x23f2b4={'speech':_0x243bb0['text'],'action':_0x243bb0[_0x4970('0x7e')]?_0x243bb0[_0x4970('0x7e')][_0x4970('0x7f')]:undefined,'actiondata':_0x243bb0[_0x4970('0x7e')]?_0x243bb0[_0x4970('0x7e')][_0x4970('0x80')]:undefined};if(_0x243bb0[_0x4970('0x7e')]&&_0x243bb0[_0x4970('0x7e')][_0x4970('0x81')]){return base64Decode(_0x243bb0['channelData'][_0x4970('0x81')][_0x4970('0x82')],path['resolve'](__dirname,_0x4970('0x26'),rs[_0x4970('0x27')](0x4)+'.wav'))[_0x4970('0x39')](function(_0x522716){_0x23f2b4[_0x4970('0x83')]=_0x522716;return _0x23f2b4;});}return _0x23f2b4;});};exports[_0x4970('0x84')]=function(){return __dirname;}; \ No newline at end of file +var _0x349b=['result','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','length','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','displayName','isFallback','languageCode','queryText','intentDetectionConfidence','Tilde\x20ASR\x20transcription','polly','awsLex','lex','ispeechTTS','format','ispeechASR','freeform=3','sestekNDA','nda','text','channelData','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','path','request-promise','google-tts-api','url','parse','./aws','./google','./tilde','../../../config/logger','protocol','https:','host','WHAT_EVER','get','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','finish','finish\x20download\x20file','close','error','unlink','download\x20error','end','data','transcode','wav','error\x20convert','info','finish\x20to\x20convert','.wav','base64','then','chmodSync','777','split','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','MP3','text:synthesize','POST','resolve','generate','.mp3','from','audioContent','writeFile','tmp','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','f.req=','stringify','jQ1olc','null','generic','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','results','alternatives','transcript','join','map','confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','source'];(function(_0x1aed4c,_0x2fef3c){var _0x45f643=function(_0x5e2c67){while(--_0x5e2c67){_0x1aed4c['push'](_0x1aed4c['shift']());}};_0x45f643(++_0x2fef3c);}(_0x349b,0x1c2));var _0xb349=function(_0xd261f8,_0x1af9e4){_0xd261f8=_0xd261f8-0x0;var _0x5c7b36=_0x349b[_0xd261f8];return _0x5c7b36;};'use strict';var apiai=require(_0xb349('0x0'));var BPromise=require(_0xb349('0x1'));var dialogflow=require(_0xb349('0x2'));var fs=require('fs');var http=require(_0xb349('0x3'));var https=require('https');var md5=require('md5');var path=require(_0xb349('0x4'));var querystring=require('querystring');var rp=require(_0xb349('0x5'));var rs=require('randomstring');var sox=require('sox');var tts=require(_0xb349('0x6'));var urlParse=require(_0xb349('0x7'))[_0xb349('0x8')];var util=require('util');var aws=require(_0xb349('0x9'));var google=require(_0xb349('0xa'));var sestek=require('./sestek');var tilde=require(_0xb349('0xb'));var logger=require(_0xb349('0xc'))('agi');var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x2e27ef,_0x268eff){return new BPromise(function(_0x381ff8,_0x1ff8d1){var _0x2735fe=urlParse(_0x2e27ef);var _0x244f3d=_0x2735fe[_0xb349('0xd')]===_0xb349('0xe')?https:http;var _0x27f848={'host':_0x2735fe[_0xb349('0xf')],'path':_0x2735fe[_0xb349('0x4')],'headers':{'user-agent':_0xb349('0x10')}};_0x244f3d[_0xb349('0x11')](_0x27f848,function(_0x1465b8){if(_0x1465b8['statusCode']!==0xc8){logger['error'](_0xb349('0x12')+_0x2e27ef+_0xb349('0x13')+_0x1465b8[_0xb349('0x14')]+'\x20('+_0x1465b8['statusMessage']+')');_0x1ff8d1(new Error('request\x20to\x20'+_0x2e27ef+_0xb349('0x13')+_0x1465b8[_0xb349('0x14')]+'\x20('+_0x1465b8[_0xb349('0x15')]+')'));return;}var _0x557536=fs[_0xb349('0x16')](_0x268eff);_0x557536['on'](_0xb349('0x17'),function(){logger['info'](_0xb349('0x18'));_0x557536[_0xb349('0x19')](_0x381ff8);});_0x557536['on'](_0xb349('0x1a'),function(_0x23c645){fs[_0xb349('0x1b')](_0x268eff);logger[_0xb349('0x1a')](_0xb349('0x1c'),_0x23c645);_0x1ff8d1(_0x23c645);});_0x1465b8['pipe'](_0x557536);})['on'](_0xb349('0x1a'),function(_0x2ee200){logger[_0xb349('0x1a')](_0x2ee200);_0x1ff8d1(_0x2ee200);})[_0xb349('0x1d')]();});}function uploadFile(_0x41e2e4){return new BPromise(function(_0x5a102e,_0x5a6683){var _0x467b66=urlParse(_0x41e2e4);var _0x258d47=_0x467b66[_0xb349('0xd')]===_0xb349('0xe')?https:http;var _0x15b03d={'host':_0x467b66[_0xb349('0xf')],'path':_0x467b66['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x258d47[_0xb349('0x11')](_0x15b03d,function(_0x529e79){if(_0x529e79['statusCode']!==0xc8){_0x5a6683(new Error(_0xb349('0x12')+_0x41e2e4+_0xb349('0x13')+_0x529e79[_0xb349('0x14')]+'\x20('+_0x529e79[_0xb349('0x15')]+')'));return;}var _0x287c42='';_0x529e79['on'](_0xb349('0x1e'),function(_0xc87a75){_0x287c42+=_0xc87a75;});_0x529e79['on'](_0xb349('0x1d'),function(){_0x5a102e(_0x287c42);});})['on']('error',function(_0x4d04c7){_0x5a6683(_0x4d04c7);})[_0xb349('0x1d')]();});}function convertFile(_0x2368c6,_0x4eea50){return new BPromise(function(_0x3b983e,_0x32415d){var _0x2c1583=sox[_0xb349('0x1f')](_0x2368c6,_0x4eea50,{'sampleRate':0x1f40,'format':_0xb349('0x20'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2c1583['on'](_0xb349('0x1a'),function(_0x43b695){logger[_0xb349('0x1a')](_0xb349('0x21'),_0x43b695);_0x32415d(_0x43b695);});_0x2c1583['on'](_0xb349('0x1d'),function(){logger[_0xb349('0x22')](_0xb349('0x23'));_0x3b983e();});_0x2c1583['start']();});}function base64Decode(_0x67e63a,_0x2f6447){var _0x57d91d=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0xb349('0x24'));fs['writeFileSync'](_0x57d91d,_0x67e63a,_0xb349('0x25'));return convertFile(_0x57d91d,_0x2f6447)[_0xb349('0x26')](function(){try{fs[_0xb349('0x1b')](_0x57d91d);fs[_0xb349('0x27')](_0x2f6447,_0xb349('0x28'));}catch(_0x492530){logger[_0xb349('0x1a')](_0x492530);}return _0x2f6447[_0xb349('0x29')]('.')[0x0];});}function base64Encode(_0x1bee55){var _0x3796ad=fs[_0xb349('0x2a')](_0x1bee55);return new Buffer(_0x3796ad)['toString'](_0xb349('0x25'));}exports[_0xb349('0x2b')]=function(_0x51b9f7,_0x5680f1,_0x4d32d3,_0x16358a,_0x12a119,_0x13f754){var _0x42df83,_0x1e5967;var _0x59ce4b=_0xb349('0x2c');var _0x397f26=_0xb349('0x2d')+_0x51b9f7;var _0x4a201c={};if(_0x5680f1==='ssml'){_0x4a201c[_0xb349('0x2e')]={'ssml':_0x4d32d3};}else{_0x4a201c['input']={'text':_0x4d32d3};};_0x4a201c['voice']={'languageCode':_0x16358a,'ssmlGender':_0x12a119};_0x4a201c['audioConfig']={'audioEncoding':_0xb349('0x2f'),'sampleRateHertz':0x1f40};var _0x1dabc9={'url':_0x59ce4b+_0xb349('0x30')+_0x397f26,'method':_0xb349('0x31'),'json':!![],'body':_0x4a201c};return rp(_0x1dabc9)[_0xb349('0x26')](function(_0x202b7f){return new BPromise(function(_0x1a0012,_0x37e17e){_0x42df83=path[_0xb349('0x32')](__dirname,'tmp',rs[_0xb349('0x33')](0x4)+_0xb349('0x34'));var _0x21be20=Buffer[_0xb349('0x35')](_0x202b7f[_0xb349('0x36')],_0xb349('0x25'));return fs[_0xb349('0x37')](_0x42df83,_0x21be20,function(_0x3c4893){_0x37e17e(_0x3c4893);},function(_0x515244){fs[_0xb349('0x27')](_0x42df83,'777');_0x1a0012(_0x515244);});});})[_0xb349('0x26')](function(_0x4ad638){_0x1e5967=path[_0xb349('0x32')](__dirname,_0xb349('0x38'),rs[_0xb349('0x33')](0x4)+_0xb349('0x24'));return convertFile(_0x42df83,_0x1e5967);})['then'](function(){try{fs[_0xb349('0x1b')](_0x42df83);fs[_0xb349('0x27')](_0x1e5967,_0xb349('0x28'));}catch(_0x125077){logger[_0xb349('0x1a')](_0x125077);}logger[_0xb349('0x22')](_0xb349('0x39'),_0x1e5967[_0xb349('0x29')]('.')[0x0]);return _0x1e5967['split']('.')[0x0];});};exports[_0xb349('0x3a')]=function(_0xdbfec9,_0x3c1120){var _0x3ba558=_0xb349('0x3b');var _0x20f377,_0x408990;var _0x117666;var _0x1f062d={'encoding':'utf8','method':_0xb349('0x31'),'timeout':0x2710,'url':_0x3ba558,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0xb349('0x3c')+encodeURIComponent(JSON[_0xb349('0x3d')]([[[_0xb349('0x3e'),JSON[_0xb349('0x3d')]([_0xdbfec9,_0x3c1120||'en',![],_0xb349('0x3f')]),null,_0xb349('0x40')]]]))};return rp(_0x1f062d)[_0xb349('0x26')](function(_0x46815d){try{_0x117666=eval(_0x46815d['slice'](0x5))[0x0][0x2];}catch(_0x10005c){throw new Error(_0xb349('0x41')+_0x46815d[_0xb349('0x1e')]);}if(!_0x117666){if(_0xdbfec9['length']>0xc8){throw new Error(_0xb349('0x42'));}else{throw new Error(_0xb349('0x43')+_0x3c1120+_0xb349('0x44'));}}try{_0x117666=eval(_0x117666)[0x0];}catch(_0x152ba9){throw new Error(_0xb349('0x41')+res['data']);}const _0x867f7a=_0x117666;_0x20f377=path[_0xb349('0x32')](__dirname,_0xb349('0x38'),rs['generate'](0x4)+'.mp3');fs['writeFileSync'](_0x20f377,_0x117666,{'encoding':_0xb349('0x25')});_0x408990=path['resolve'](__dirname,_0xb349('0x38'),rs[_0xb349('0x33')](0x4)+'.wav');return convertFile(_0x20f377,_0x408990);})[_0xb349('0x26')](function(){try{fs[_0xb349('0x1b')](_0x20f377);fs[_0xb349('0x27')](_0x408990,'777');}catch(_0x2d5f12){logger['error'](_0x2d5f12);}logger[_0xb349('0x22')](_0xb349('0x45'),_0x408990[_0xb349('0x29')]('.')[0x0]);return _0x408990[_0xb349('0x29')]('.')[0x0];});};exports[_0xb349('0x46')]=function(_0x3ee8c4,_0x213d27,_0x2d0dac){return google[_0xb349('0x47')](_0x3ee8c4,_0x213d27,_0x2d0dac)['then'](function(_0x36e2c6){logger[_0xb349('0x22')](_0x36e2c6[_0xb349('0x48')]);return rp(_0x36e2c6);})[_0xb349('0x26')](function(_0x1bccb5){var _0x107c8e='';var _0x257ab7=0x0;try{fs[_0xb349('0x1b')](_0x3ee8c4);}catch(_0x29b8cd){logger[_0xb349('0x1a')](_0x29b8cd);}if(_0x1bccb5&&_0x1bccb5[_0xb349('0x49')]){_0x107c8e=_0x1bccb5['results']['map'](function(_0x4a709f){return _0x4a709f&&_0x4a709f[_0xb349('0x4a')][0x0]&&_0x4a709f[_0xb349('0x4a')][0x0][_0xb349('0x4b')]?_0x4a709f[_0xb349('0x4a')][0x0][_0xb349('0x4b')]:'';})[_0xb349('0x4c')]('\x0a');_0x257ab7=_0x1bccb5[_0xb349('0x49')][_0xb349('0x4d')](function(_0x449444){return _0x449444&&_0x449444[_0xb349('0x4a')][0x0]&&_0x449444[_0xb349('0x4a')][0x0]['confidence']?_0x449444[_0xb349('0x4a')][0x0][_0xb349('0x4e')]:0x0;})[_0xb349('0x4c')]('\x0a');}logger['info']('googleASR\x20transcription',_0x107c8e);logger[_0xb349('0x22')]('googleASR\x20confidence',_0x257ab7);return{'transcript':_0x107c8e,'confidence':_0x257ab7};})[_0xb349('0x4f')](function(_0x3d3735){logger[_0xb349('0x1a')](_0xb349('0x50'),_0x3d3735[_0xb349('0x14')],_0x3d3735[_0xb349('0x51')],_0x3d3735[_0xb349('0x52')]);});};exports[_0xb349('0x53')]=function(_0x3510da,_0x133762,_0x300c2e,_0x9ed321){var _0x2964d6=apiai(_0x133762,{'language':_0x9ed321||'en'});return _0x2964d6[_0xb349('0x54')](_0x300c2e,{'sessionId':md5(_0x3510da)})[_0xb349('0x26')](function(_0x309b72){logger[_0xb349('0x22')](JSON[_0xb349('0x3d')](_0x309b72));return{'source':_0x309b72['result'][_0xb349('0x55')],'resolvedQuery':_0x309b72[_0xb349('0x56')][_0xb349('0x57')],'action':_0x309b72[_0xb349('0x56')][_0xb349('0x58')],'actionIncomplete':_0x309b72['result'][_0xb349('0x59')],'speech':_0x309b72[_0xb349('0x56')][_0xb349('0x5a')][_0xb349('0x5b')],'score':_0x309b72[_0xb349('0x56')][_0xb349('0x5c')],'statusCode':_0x309b72[_0xb349('0x5d')][_0xb349('0x5e')],'endConversation':_0x309b72[_0xb349('0x56')][_0xb349('0x5f')][_0xb349('0x60')]||![],'isFallbackIntent':_0x309b72[_0xb349('0x56')]['metadata'][_0xb349('0x61')]};});};exports[_0xb349('0x62')]=function(_0x9cd177,_0x360998,_0x5c4445,_0x2a5cba,_0x4bf20b,_0x1548c2){var _0x1d7ebf=_0x2a5cba[_0xb349('0x63')](/\\n/g,'\x0a');var _0x31102e={'credentials':{'private_key':_0x1d7ebf,'client_email':_0x5c4445}};var _0x4249c5=new dialogflow[(_0xb349('0x64'))](_0x31102e);var _0x37ce0=_0x4249c5[_0xb349('0x65')](_0x360998,md5(_0x9cd177));var _0x18242b={'session':_0x37ce0,'queryInput':{'text':{'text':_0x4bf20b,'languageCode':_0x1548c2}}};return _0x4249c5[_0xb349('0x66')](_0x18242b)[_0xb349('0x26')](function(_0x17adc6){if(_0x17adc6&&_0x17adc6[_0xb349('0x67')]){logger[_0xb349('0x22')](_0xb349('0x68'),JSON[_0xb349('0x3d')](_0x17adc6));var _0x45e049=_0x17adc6[0x0];if(_0x45e049){var _0x565e27={'action':_0x45e049[_0xb349('0x69')][_0xb349('0x58')],'allRequiredParamsPresent':_0x45e049[_0xb349('0x69')][_0xb349('0x6a')],'endConversation':_0x45e049[_0xb349('0x69')]['diagnosticInfo']&&_0x45e049[_0xb349('0x69')][_0xb349('0x6b')][_0xb349('0x6c')]?_0x45e049[_0xb349('0x69')][_0xb349('0x6b')][_0xb349('0x6c')][_0xb349('0x6d')][_0xb349('0x6e')]:![],'fulfillmentText':_0x45e049[_0xb349('0x69')][_0xb349('0x6f')],'intentName':_0x45e049[_0xb349('0x69')]['intent'][_0xb349('0x51')],'intentDisplayName':_0x45e049[_0xb349('0x69')]['intent'][_0xb349('0x70')],'isFallbackIntent':_0x45e049['queryResult']['intent'][_0xb349('0x71')],'languageCode':_0x45e049[_0xb349('0x69')][_0xb349('0x72')],'queryText':_0x45e049[_0xb349('0x69')][_0xb349('0x73')],'responseId':_0x45e049['responseId'],'score':_0x45e049[_0xb349('0x69')][_0xb349('0x74')],'speech':_0x45e049[_0xb349('0x69')][_0xb349('0x6f')],'providerResponse':JSON[_0xb349('0x3d')](_0x17adc6)};return _0x565e27;}}});};exports['tildeASR']=function(_0x23d8f5,_0x396150,_0x1a3586,_0x33aa54){return tilde['asr'](_0x23d8f5,_0x396150,_0x1a3586,_0x33aa54)[_0xb349('0x26')](function(_0x2f5b48){try{fs['unlink'](_0x23d8f5);}catch(_0x19746e){logger[_0xb349('0x1a')](_0x19746e);}logger['info'](_0xb349('0x75'),_0x2f5b48[_0xb349('0x4b')]);logger[_0xb349('0x22')]('Tilde\x20ASR\x20confidence',_0x2f5b48[_0xb349('0x4e')]);return _0x2f5b48;});};exports['awsPolly']=function(_0x5c3529,_0x37c08a,_0x4b7dcc,_0x4955bd,_0x15851d,_0x24078a){var _0x85b689=path[_0xb349('0x32')](__dirname,_0xb349('0x38'),rs[_0xb349('0x33')](0x4)+_0xb349('0x34'));var _0x531f05;return aws[_0xb349('0x76')](_0x5c3529,_0x37c08a,_0x4b7dcc,_0x4955bd,_0x15851d,_0x24078a,_0x85b689)[_0xb349('0x26')](function(){_0x531f05=path[_0xb349('0x32')](__dirname,'tmp',rs[_0xb349('0x33')](0x4)+_0xb349('0x24'));return convertFile(_0x85b689,_0x531f05);})[_0xb349('0x26')](function(){try{fs['unlink'](_0x85b689);fs[_0xb349('0x27')](_0x531f05,'777');}catch(_0x5911a6){logger['error'](_0x5911a6);}return _0x531f05[_0xb349('0x29')]('.')[0x0];});};exports[_0xb349('0x77')]=function(_0x4ce806,_0x3ab95c,_0x3724e7,_0xe90516,_0x8e2016,_0x22f250){return aws[_0xb349('0x78')](_0x4ce806,_0x3ab95c,_0x3724e7,_0xe90516,_0x8e2016,_0x22f250)['then'](function(_0x30adc9){logger[_0xb349('0x22')](JSON['stringify'](_0x30adc9));return _0x30adc9;});};exports[_0xb349('0x79')]=function(_0xf8ec6d,_0x554c3e,_0x4c64db,_0x388d5e){var _0x3c4610=util[_0xb349('0x7a')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0xf8ec6d,encodeURIComponent(_0x554c3e),_0x4c64db,_0x388d5e);var _0x1ed2ec=path[_0xb349('0x32')](__dirname,_0xb349('0x38'),rs[_0xb349('0x33')](0x4)+'.mp3');var _0x5081a4;return downloadFile(_0x3c4610,_0x1ed2ec)[_0xb349('0x26')](function(){_0x5081a4=path[_0xb349('0x32')](__dirname,_0xb349('0x38'),rs[_0xb349('0x33')](0x4)+'.wav');return convertFile(_0x1ed2ec,_0x5081a4);})[_0xb349('0x26')](function(){try{fs[_0xb349('0x1b')](_0x1ed2ec);fs['chmodSync'](_0x5081a4,'777');}catch(_0xe593de){logger['error'](_0xe593de);}return _0x5081a4[_0xb349('0x29')]('.')[0x0];});};exports[_0xb349('0x7b')]=function(_0x16bfd2,_0x408dd2,_0x2e7aaf,_0x2b592f){var _0x281c17=util[_0xb349('0x7a')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x408dd2,_0x2e7aaf,base64Encode(_0x16bfd2),_0x2b592f?util[_0xb349('0x7a')]('model=%s',encodeURIComponent(_0x2b592f)):_0xb349('0x7c'));return uploadFile(_0x281c17)[_0xb349('0x26')](function(_0xefa63a){return querystring[_0xb349('0x8')](_0xefa63a);});};exports[_0xb349('0x7d')]=function(_0x11e55d,_0x1f050e){return sestek[_0xb349('0x7e')](_0x11e55d,_0x1f050e)[_0xb349('0x26')](function(_0x28aaed){logger[_0xb349('0x22')](JSON[_0xb349('0x3d')](_0x28aaed));var _0x305bcd={'speech':_0x28aaed[_0xb349('0x7f')],'action':_0x28aaed[_0xb349('0x80')]?_0x28aaed[_0xb349('0x80')]['CustomAction']:undefined,'actiondata':_0x28aaed[_0xb349('0x80')]?_0x28aaed[_0xb349('0x80')][_0xb349('0x81')]:undefined};if(_0x28aaed[_0xb349('0x80')]&&_0x28aaed['channelData'][_0xb349('0x82')]){return base64Decode(_0x28aaed[_0xb349('0x80')][_0xb349('0x82')][_0xb349('0x83')],path[_0xb349('0x32')](__dirname,_0xb349('0x38'),rs['generate'](0x4)+_0xb349('0x24')))[_0xb349('0x26')](function(_0x30c010){_0x305bcd[_0xb349('0x84')]=_0x30c010;return _0x305bcd;});}return _0x305bcd;});};exports[_0xb349('0x85')]=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 5d6de68..1103597 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 _0x6212=['exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6212,0xc1));var _0x2621=function(_0xeea066,_0x52abae){_0xeea066=_0xeea066-0x0;var _0x129431=_0x6212[_0xeea066];return _0x129431;};var nda=require('./nda');module[_0x2621('0x0')]={'nda':nda}; \ No newline at end of file +var _0x579f=['exports','./nda'];(function(_0x11fc19,_0x400a82){var _0x4ee259=function(_0x115863){while(--_0x115863){_0x11fc19['push'](_0x11fc19['shift']());}};_0x4ee259(++_0x400a82);}(_0x579f,0x14d));var _0xf579=function(_0x5e25ff,_0x52f870){_0x5e25ff=_0x5e25ff-0x0;var _0x375035=_0x579f[_0x5e25ff];return _0x375035;};var nda=require(_0xf579('0x0'));module[_0xf579('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index c7a216c..0682448 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 _0x9703=['uniqueid','calleridname','dnid','text','Bearer\x20','access_token','project','channelData','ProjectName','ndagenerate_audio','body','AudioOutputSettings','audio/wav','custom_action','custom_action_data','info','../../../../../config/logger','agi','exports','POST','ndauth_url','/token','password','then','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','message','Nda'];(function(_0x15e36d,_0x4090ca){var _0x3c455a=function(_0x5d635f){while(--_0x5d635f){_0x15e36d['push'](_0x15e36d['shift']());}};_0x3c455a(++_0x4090ca);}(_0x9703,0xdb));var _0x3970=function(_0x23ca3a,_0xe44c43){_0x23ca3a=_0x23ca3a-0x0;var _0x5c1aab=_0x9703[_0x23ca3a];return _0x5c1aab;};'use strict';var rp=require('request-promise');var url=require('url');var logger=require(_0x3970('0x0'))(_0x3970('0x1'));module[_0x3970('0x2')]=function(_0x58168c,_0x1fb9af){var _0x5dfa90={'method':_0x3970('0x3'),'uri':url['resolve'](_0x1fb9af[_0x3970('0x4')],_0x3970('0x5')),'form':{'grant_type':'password','username':_0x1fb9af['username'],'password':_0x1fb9af[_0x3970('0x6')]},'json':!![]};return rp(_0x5dfa90)[_0x3970('0x7')](function(_0x282355){var _0x41d4d1={'method':_0x3970('0x3'),'uri':url[_0x3970('0x8')](_0x1fb9af[_0x3970('0x9')],_0x3970('0xa')),'body':{'type':_0x1fb9af['ndaactivity_type']||_0x3970('0xb'),'channelId':_0x3970('0xc'),'conversation':{'id':_0x58168c[_0x3970('0xd')]},'from':{'id':_0x58168c['callerid'],'name':_0x58168c[_0x3970('0xe')]},'recipient':{'id':_0x58168c[_0x3970('0xf')],'name':_0x58168c['extension']},'text':_0x1fb9af[_0x3970('0x10')],'channelData':{}},'headers':{'Authorization':_0x3970('0x11')+_0x282355[_0x3970('0x12')]},'json':!![]};if(_0x1fb9af[_0x3970('0x13')]){_0x41d4d1['body'][_0x3970('0x14')][_0x3970('0x15')]=_0x1fb9af[_0x3970('0x13')];}if(_0x1fb9af[_0x3970('0x16')]=='1'){_0x41d4d1[_0x3970('0x17')][_0x3970('0x14')][_0x3970('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x3970('0x19')};}if(_0x1fb9af['custom_action']){_0x41d4d1[_0x3970('0x17')][_0x3970('0x14')]['CustomAction']=_0x1fb9af[_0x3970('0x1a')];if(_0x1fb9af[_0x3970('0x1b')]){_0x41d4d1['body']['channelData']['CustomActionData']=_0x1fb9af[_0x3970('0x1b')];}}logger[_0x3970('0x1c')](JSON['stringify'](_0x41d4d1));return rp(_0x41d4d1);});}; \ No newline at end of file +var _0x8e63=['message','callerid','dnid','text','Bearer\x20','access_token','project','body','ProjectName','channelData','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','stringify','url','exports','resolve','ndauth_url','/token','username','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x8e63,0x7c));var _0x38e6=function(_0x2f02fd,_0x101093){_0x2f02fd=_0x2f02fd-0x0;var _0x4df0bb=_0x8e63[_0x2f02fd];return _0x4df0bb;};'use strict';var rp=require('request-promise');var url=require(_0x38e6('0x0'));var logger=require('../../../../../config/logger')('agi');module[_0x38e6('0x1')]=function(_0xb2c68b,_0x1c6de7){var _0x5e5a71={'method':'POST','uri':url[_0x38e6('0x2')](_0x1c6de7[_0x38e6('0x3')],_0x38e6('0x4')),'form':{'grant_type':'password','username':_0x1c6de7[_0x38e6('0x5')],'password':_0x1c6de7[_0x38e6('0x6')]},'json':!![]};return rp(_0x5e5a71)[_0x38e6('0x7')](function(_0x315953){var _0x51b586={'method':'POST','uri':url[_0x38e6('0x2')](_0x1c6de7[_0x38e6('0x8')],_0x38e6('0x9')),'body':{'type':_0x1c6de7[_0x38e6('0xa')]||_0x38e6('0xb'),'channelId':'Nda','conversation':{'id':_0xb2c68b['uniqueid']},'from':{'id':_0xb2c68b[_0x38e6('0xc')],'name':_0xb2c68b['calleridname']},'recipient':{'id':_0xb2c68b[_0x38e6('0xd')],'name':_0xb2c68b['extension']},'text':_0x1c6de7[_0x38e6('0xe')],'channelData':{}},'headers':{'Authorization':_0x38e6('0xf')+_0x315953[_0x38e6('0x10')]},'json':!![]};if(_0x1c6de7[_0x38e6('0x11')]){_0x51b586[_0x38e6('0x12')]['channelData'][_0x38e6('0x13')]=_0x1c6de7[_0x38e6('0x11')];}if(_0x1c6de7['ndagenerate_audio']=='1'){_0x51b586[_0x38e6('0x12')][_0x38e6('0x14')][_0x38e6('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x38e6('0x16')};}if(_0x1c6de7[_0x38e6('0x17')]){_0x51b586[_0x38e6('0x12')]['channelData'][_0x38e6('0x18')]=_0x1c6de7[_0x38e6('0x17')];if(_0x1c6de7[_0x38e6('0x19')]){_0x51b586[_0x38e6('0x12')][_0x38e6('0x14')]['CustomActionData']=_0x1c6de7[_0x38e6('0x19')];}}logger['info'](JSON[_0x38e6('0x1a')](_0x51b586));return rp(_0x51b586);});}; \ 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 04cfdec..8512db2 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 _0x8650=['./lib/api','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8650,0x14a));var _0x0865=function(_0x5a5be9,_0x2e326e){_0x5a5be9=_0x5a5be9-0x0;var _0x4bc841=_0x8650[_0x5a5be9];return _0x4bc841;};'use strict';var asr=require(_0x0865('0x0'));module[_0x0865('0x1')]=function(_0x5b2687,_0x26ce6b,_0x4f5f7b,_0x39db56){return asr(_0x5b2687,_0x26ce6b,_0x4f5f7b,_0x39db56);}; \ No newline at end of file +var _0x3988=['exports','./lib/api'];(function(_0x243ad0,_0x6950f6){var _0x4a5d78=function(_0x2dd7f7){while(--_0x2dd7f7){_0x243ad0['push'](_0x243ad0['shift']());}};_0x4a5d78(++_0x6950f6);}(_0x3988,0xa9));var _0x8398=function(_0x10a8d1,_0x10c7d8){_0x10a8d1=_0x10a8d1-0x0;var _0x1c73d9=_0x3988[_0x10a8d1];return _0x1c73d9;};'use strict';var asr=require(_0x8398('0x0'));module[_0x8398('0x1')]=function(_0xba5509,_0x1a6ee4,_0x5bf27c,_0x5d5dca){return asr(_0xba5509,_0x1a6ee4,_0x5bf27c,_0x5d5dca);}; \ 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 6de1a4d..71f42da 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 _0xebcf=['data','send','EOS','error','Tilde\x20ASR\x20send\x20error','parse','status','final','Tilde\x20ASR\x20hypoteses','result','hypotheses','likelihood','Success.','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','message','bluebird','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','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','stringify','createReadStream'];(function(_0x4e7c1c,_0x56eafd){var _0x47adb2=function(_0x346135){while(--_0x346135){_0x4e7c1c['push'](_0x4e7c1c['shift']());}};_0x47adb2(++_0x56eafd);}(_0xebcf,0x1c3));var _0xfebc=function(_0x1b28e6,_0x5e2efb){_0x1b28e6=_0x1b28e6-0x0;var _0x44bb8d=_0xebcf[_0x1b28e6];return _0x44bb8d;};'use strict';var BPromise=require(_0xfebc('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xfebc('0x1'));var crypto=require(_0xfebc('0x2'));var logger=require(_0xfebc('0x3'))(_0xfebc('0x4'));module[_0xfebc('0x5')]=function(_0xebcb11,_0x114d75,_0xd70fdf,_0x7750a7){return new BPromise(function(_0x1c8ea8,_0x574d6b){logger[_0xfebc('0x6')](_0xfebc('0x7'),_0x7750a7||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x4b50c4=new WebSocket(_0x7750a7||_0xfebc('0x8'),{'perMessageDeflate':![]});var _0x58ce4b='';var _0x427655='0';var _0x1aeb5f='1';var _0x467f40=_0xfebc('0x9');function _0x46a592(_0xd61528){var _0x1c4819=crypto['createHash']('sha1');_0x1c4819[_0xfebc('0xa')](_0xd61528);return _0x1c4819[_0xfebc('0xb')](_0xfebc('0xc'));}function _0x2dda70(){try{logger[_0xfebc('0x6')](_0xfebc('0xd'));var _0x4ad39a=moment()[_0xfebc('0xe')]();var _0x5dc6c3=_0x46a592(_0x4ad39a+_0x114d75+_0xd70fdf);_0x4b50c4['send'](JSON[_0xfebc('0xf')]({'appID':_0x114d75,'timestamp':_0x4ad39a,'appKey':_0x5dc6c3}));var _0x18ffe1=fs[_0xfebc('0x10')](_0xebcb11);_0x18ffe1['on'](_0xfebc('0x11'),function(_0x2234f7){_0x4b50c4[_0xfebc('0x12')](_0x2234f7);});_0x18ffe1['on']('close',function(){_0x4b50c4[_0xfebc('0x12')](_0xfebc('0x13'));});}catch(_0x1cb266){logger[_0xfebc('0x14')](_0xfebc('0x15'),JSON['stringify'](_0x1cb266));_0x4b50c4['terminate']();}}function _0xf8b2f0(_0x1855fb){try{if(_0x1855fb){var _0x306a5b=JSON[_0xfebc('0x16')](_0x1855fb);switch(_0x306a5b[_0xfebc('0x17')]){case 0x0:if(_0x306a5b['result']){if(_0x306a5b['result'][_0xfebc('0x18')]){logger[_0xfebc('0x6')](_0xfebc('0x19'),JSON[_0xfebc('0xf')](_0x306a5b[_0xfebc('0x1a')][_0xfebc('0x1b')]));_0x58ce4b=_0x306a5b[_0xfebc('0x1a')]['hypotheses'][0x0]['transcript'];_0x427655=_0x306a5b[_0xfebc('0x1a')][_0xfebc('0x1b')][0x0][_0xfebc('0x1c')];_0x1aeb5f='0';_0x467f40=_0xfebc('0x1d');_0x4b50c4[_0xfebc('0x1e')]();}}break;case 0x1:logger[_0xfebc('0x6')](_0xfebc('0x9'));_0x1aeb5f='1';_0x467f40=_0xfebc('0x9');break;case 0x2:logger['info'](_0xfebc('0x1f'));_0x1aeb5f='2';_0x467f40='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0xfebc('0x6')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x1aeb5f='9';_0x467f40=_0xfebc('0x20');break;case 0xa:logger[_0xfebc('0x6')]('Authentication\x20failed.');_0x1aeb5f='10';_0x467f40=_0xfebc('0x21');break;case 0xb:logger[_0xfebc('0x6')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x1aeb5f='11';_0x467f40='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x124cec){logger['error'](_0xfebc('0x22'),JSON['stringify'](_0x124cec));_0x4b50c4[_0xfebc('0x1e')]();}}function _0x97ec56(){logger[_0xfebc('0x6')](_0xfebc('0x23'));_0x1c8ea8({'transcript':_0x58ce4b,'confidence':_0x427655,'status':_0x1aeb5f,'status_message':_0x467f40});}function _0x8af1a0(_0x3afaa7){logger[_0xfebc('0x14')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0xfebc('0x24')](_0x3afaa7)){logger[_0xfebc('0x14')](_[_0xfebc('0x25')](_0x3afaa7)?JSON[_0xfebc('0xf')](_0x3afaa7):_0x3afaa7);}}_0x4b50c4['on']('open',_0x2dda70);_0x4b50c4['on'](_0xfebc('0x26'),_0xf8b2f0);_0x4b50c4['on']('close',_0x97ec56);_0x4b50c4['on'](_0xfebc('0x14'),_0x8af1a0);});}; \ No newline at end of file +var _0x583c=['terminate','parse','result','hypotheses','transcript','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','open','bluebird','../../../../../../config/logger','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','send','stringify','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error'];(function(_0x1cd9f5,_0x28406e){var _0x2f3e19=function(_0x104257){while(--_0x104257){_0x1cd9f5['push'](_0x1cd9f5['shift']());}};_0x2f3e19(++_0x28406e);}(_0x583c,0x70));var _0xc583=function(_0x2652ef,_0x234230){_0x2652ef=_0x2652ef-0x0;var _0x2db578=_0x583c[_0x2652ef];return _0x2db578;};'use strict';var BPromise=require(_0xc583('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require('crypto');var logger=require(_0xc583('0x1'))('agi');module['exports']=function(_0x332557,_0x3b9429,_0x39aaf5,_0x2070a1){return new BPromise(function(_0x29533c,_0x2b6c86){logger[_0xc583('0x2')](_0xc583('0x3'),_0x2070a1||_0xc583('0x4'));var _0x25a6a8=new WebSocket(_0x2070a1||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x229e95='';var _0x5da0ba='0';var _0x2240d9='1';var _0x4c50f4=_0xc583('0x5');function _0x523bd5(_0xadacd2){var _0x44a751=crypto[_0xc583('0x6')](_0xc583('0x7'));_0x44a751[_0xc583('0x8')](_0xadacd2);return _0x44a751[_0xc583('0x9')](_0xc583('0xa'));}function _0x3505b5(){try{logger[_0xc583('0x2')](_0xc583('0xb'));var _0x19bca0=moment()['unix']();var _0x5d3c08=_0x523bd5(_0x19bca0+_0x3b9429+_0x39aaf5);_0x25a6a8[_0xc583('0xc')](JSON[_0xc583('0xd')]({'appID':_0x3b9429,'timestamp':_0x19bca0,'appKey':_0x5d3c08}));var _0x23b23e=fs[_0xc583('0xe')](_0x332557);_0x23b23e['on'](_0xc583('0xf'),function(_0x4790e6){_0x25a6a8[_0xc583('0xc')](_0x4790e6);});_0x23b23e['on'](_0xc583('0x10'),function(){_0x25a6a8[_0xc583('0xc')](_0xc583('0x11'));});}catch(_0xa53e6b){logger[_0xc583('0x12')](_0xc583('0x13'),JSON[_0xc583('0xd')](_0xa53e6b));_0x25a6a8[_0xc583('0x14')]();}}function _0x5843f4(_0x115804){try{if(_0x115804){var _0x20fc1e=JSON[_0xc583('0x15')](_0x115804);switch(_0x20fc1e['status']){case 0x0:if(_0x20fc1e[_0xc583('0x16')]){if(_0x20fc1e[_0xc583('0x16')]['final']){logger[_0xc583('0x2')]('Tilde\x20ASR\x20hypoteses',JSON[_0xc583('0xd')](_0x20fc1e['result']['hypotheses']));_0x229e95=_0x20fc1e[_0xc583('0x16')][_0xc583('0x17')][0x0][_0xc583('0x18')];_0x5da0ba=_0x20fc1e['result'][_0xc583('0x17')][0x0]['likelihood'];_0x2240d9='0';_0x4c50f4='Success.';_0x25a6a8['terminate']();}}break;case 0x1:logger[_0xc583('0x2')](_0xc583('0x5'));_0x2240d9='1';_0x4c50f4=_0xc583('0x5');break;case 0x2:logger['info'](_0xc583('0x19'));_0x2240d9='2';_0x4c50f4=_0xc583('0x19');break;case 0x9:logger[_0xc583('0x2')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x2240d9='9';_0x4c50f4=_0xc583('0x1a');break;case 0xa:logger[_0xc583('0x2')](_0xc583('0x1b'));_0x2240d9='10';_0x4c50f4=_0xc583('0x1b');break;case 0xb:logger[_0xc583('0x2')](_0xc583('0x1c'));_0x2240d9='11';_0x4c50f4='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x49cbe9){logger[_0xc583('0x12')]('Tilde\x20ASR\x20parse\x20error',JSON['stringify'](_0x49cbe9));_0x25a6a8[_0xc583('0x14')]();}}function _0x48a752(){logger[_0xc583('0x2')](_0xc583('0x1d'));_0x29533c({'transcript':_0x229e95,'confidence':_0x5da0ba,'status':_0x2240d9,'status_message':_0x4c50f4});}function _0x430390(_0x12ac49){logger['error'](_0xc583('0x1e'));if(!_['isNil'](_0x12ac49)){logger['error'](_[_0xc583('0x1f')](_0x12ac49)?JSON[_0xc583('0xd')](_0x12ac49):_0x12ac49);}}_0x25a6a8['on'](_0xc583('0x20'),_0x3505b5);_0x25a6a8['on']('message',_0x5843f4);_0x25a6a8['on'](_0xc583('0x10'),_0x48a752);_0x25a6a8['on'](_0xc583('0x12'),_0x430390);});}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index f959330..b26097f 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 _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x9c44[_0x422905];return _0x33dc6c;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file +var _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x295ea9,_0x19d658){var _0x59a3fe=function(_0x35be54){while(--_0x35be54){_0x295ea9['push'](_0x295ea9['shift']());}};_0x59a3fe(++_0x19d658);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 34cd51b..4868390 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 _0x83cd=['toString','getPause','getPauseById','agentPause','agent','agentUnpause','isNil','agentLogin','internal','format','%s/%s@from-sip/n','LOCAL','shellCommand','exec','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','ssmlGender','MALE','MP3','googleTTS','google_tts_language','restAPI','method','timeout','number','includes','POST','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','url','parse','stringify','body','statusCode','statusMessage','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','replaceAllVariables','saveRestApiResult','%s.%s','split','replaceAll','extra','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','maxRetry','noop','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','no\x20grammar\x20configured','MRCP_RECOG_CONFIDENCE','getAndSetVariable','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','answer','Wait\x20%s\x20seconds\x20before\x20answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','delay','minutes','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','no\x20text\x20configured','sestektts','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','%s[%s][%s]','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','dialogflow','no\x20key\x20configured','DIALOGFLOW_%s','toUpperCase','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20anguage\x20configured','bot','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_access_key_id','no\x20valid\x20credentials\x20configured','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','intKey','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','agentLogout','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','%s[%s]','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','digit','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','no\x20find\x20by\x20configured','pause_id','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','bcc','subject','template_id','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','exports','util','lodash','shelljs','odbc','randomstring','mustache','request-promise','../../config/logger','agi','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawBody','getdigits','channel','rpc','mailRpc','prototype','getVariable','name','catch','getVoiceQueue','getVoiceQueueById','then','getSquareProject','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundPath','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','Intervals','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','callback_','random','lastName','phone','list_id','scheduledAt','callback'];(function(_0x4a1aa8,_0x4fb41f){var _0x1d0481=function(_0x53be23){while(--_0x53be23){_0x4a1aa8['push'](_0x4a1aa8['shift']());}};_0x1d0481(++_0x4fb41f);}(_0x83cd,0x17b));var _0xd83c=function(_0xf2d2de,_0x2cd592){_0xf2d2de=_0xf2d2de-0x0;var _0xf4c684=_0x83cd[_0xf2d2de];return _0xf4c684;};'use strict';var fs=require('fs');var util=require(_0xd83c('0x0'));var _=require(_0xd83c('0x1'));var sh=require(_0xd83c('0x2'));var odbc=require(_0xd83c('0x3'))();var rs=require(_0xd83c('0x4'));var moment=require('moment');var Mustache=require(_0xd83c('0x5'));var rp=require(_0xd83c('0x6'));var logger=require(_0xd83c('0x7'))(_0xd83c('0x8'));var config=require('../../config/environment');var shared=require(_0xd83c('0x9'));var scripts=require(_0xd83c('0xa'));var FILES_PATH=_0xd83c('0xb');var recursiveMapAttributes=['rawHeaders',_0xd83c('0xc')];var verticesWithRetry=['menu',_0xd83c('0xd'),'getsecretdigits'];var AGIVertices=function(_0x21010e,_0x560cf1,_0x24e20c){this[_0xd83c('0xe')]=_0x21010e;this[_0xd83c('0xf')]=_0x560cf1;this[_0xd83c('0x10')]=_0x24e20c;};AGIVertices[_0xd83c('0x11')][_0xd83c('0x12')]=function(_0x33a934,_0x4fa25c){this[_0xd83c('0xf')]['getVariableById'](_0x33a934)['then'](function(_0x12f0a0){_0x4fa25c(null,_0x12f0a0?_0x12f0a0[_0xd83c('0x13')]:![]);})[_0xd83c('0x14')](function(_0x51d8f4){_0x4fa25c(_0x51d8f4);});};AGIVertices[_0xd83c('0x11')][_0xd83c('0x15')]=function(_0x1d399d,_0x2a75af){this[_0xd83c('0xf')][_0xd83c('0x16')](_0x1d399d)[_0xd83c('0x17')](function(_0x4d0eb6){_0x2a75af(null,_0x4d0eb6?_0x4d0eb6[_0xd83c('0x13')]:![]);})['catch'](function(_0x1271d4){_0x2a75af(_0x1271d4);});};AGIVertices[_0xd83c('0x11')][_0xd83c('0x18')]=function(_0x31286f,_0x5402df){this[_0xd83c('0xf')]['getSquareProjectById'](_0x31286f)['then'](function(_0xbd63d9){_0x5402df(null,_0xbd63d9?_0xbd63d9[_0xd83c('0x13')]:![]);})[_0xd83c('0x14')](function(_0x214f27){_0x5402df(_0x214f27);});};AGIVertices[_0xd83c('0x11')][_0xd83c('0x19')]=function(_0x2810b3,_0x29cf75){this[_0xd83c('0xf')][_0xd83c('0x1a')](_0x2810b3)[_0xd83c('0x17')](function(_0x30d96c){_0x29cf75(null,_0x30d96c?_0x30d96c[_0xd83c('0x1b')]:![]);})['catch'](function(_0xd70446){_0x29cf75(_0xd70446);});};AGIVertices[_0xd83c('0x11')][_0xd83c('0x1c')]=function(_0x10dbda,_0x3ee772){this[_0xd83c('0xf')][_0xd83c('0x1d')](_0x10dbda)[_0xd83c('0x17')](function(_0x6a21d1){_0x3ee772(null,_0x6a21d1?_0x6a21d1[_0xd83c('0x13')]:![]);})[_0xd83c('0x14')](function(_0xeafa7e){_0x3ee772(_0xeafa7e);});};AGIVertices[_0xd83c('0x11')][_0xd83c('0x1e')]=function(_0x22569d,_0x112508){this['rpc'][_0xd83c('0x1f')](_0x22569d)['then'](function(_0x529025){_0x112508(null,_0x529025?_0x529025['name']:![]);})[_0xd83c('0x14')](function(_0x5a842a){_0x112508(_0x5a842a);});};AGIVertices[_0xd83c('0x11')][_0xd83c('0x20')]=function(_0x539a6a,_0x142e8f){var _0x417938=this;this[_0xd83c('0xf')]['getSoundById'](_0x539a6a)[_0xd83c('0x17')](function(_0x17261d){_0x142e8f(null,_0x17261d?_0x417938[_0xd83c('0x21')](_0x17261d['save_name']):![]);})[_0xd83c('0x14')](function(_0x195d18){_0x142e8f(_0x195d18);});};AGIVertices[_0xd83c('0x11')]['getMailAccount']=function(_0x3d6a54,_0x25493e){this[_0xd83c('0xf')][_0xd83c('0x22')](_0x3d6a54)[_0xd83c('0x17')](function(_0x1fd8c1){_0x25493e(null,_0x1fd8c1?_0x1fd8c1:![]);})[_0xd83c('0x14')](function(_0x5bf3d0){_0x25493e(_0x5bf3d0);});};AGIVertices[_0xd83c('0x11')][_0xd83c('0x23')]=function(_0x173201,_0x4e8e2a,_0x3467e5){this['mailRpc']['sendMailMessage'](_0x173201,_0x4e8e2a)[_0xd83c('0x17')](function(){_0x3467e5(null);})[_0xd83c('0x14')](function(_0x41d709){_0x3467e5(_0x41d709);});};AGIVertices[_0xd83c('0x11')][_0xd83c('0x24')]=function(_0x13c95b,_0x212b1a){this[_0xd83c('0xf')][_0xd83c('0x25')](_0x13c95b)[_0xd83c('0x17')](function(_0x11058d){if(_0x11058d){if(_0x11058d['IntervalId']){_0x212b1a(null,[_0x11058d['interval']]);}else{_0x212b1a(null,_['map'](_0x11058d[_0xd83c('0x26')],'interval'));}}else{_0x212b1a(null,![]);}})[_0xd83c('0x14')](function(_0x3b6a15){_0x212b1a(_0x3b6a15);});};AGIVertices['prototype'][_0xd83c('0x21')]=function(_0x40a01f){return util['format']('%s/sounds/converted/%s',FILES_PATH,_0x40a01f);};AGIVertices[_0xd83c('0x11')][_0xd83c('0x27')]=function(_0x56ba02,_0x5ba903,_0x57f0b5){odbc[_0xd83c('0x28')](_0x56ba02,function(_0x21a72c){if(_0x21a72c){logger[_0xd83c('0x29')](_0xd83c('0x2a'),_0x21a72c);_0x57f0b5(_0x21a72c);}else{logger[_0xd83c('0x2b')](_0xd83c('0x2c'));odbc[_0xd83c('0x2d')](_0x5ba903,function(_0x4f5cf1,_0x5d8567){if(_0x4f5cf1){logger[_0xd83c('0x2b')](_0xd83c('0x2e'),_0x5ba903);_0x57f0b5(_0x4f5cf1);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0x5ba903);odbc[_0xd83c('0x2f')](function(_0xeb6e3e){if(_0xeb6e3e){logger[_0xd83c('0x29')](_0xd83c('0x30'),_0xeb6e3e);}_0x57f0b5(null,_0x5d8567);});}});}});};AGIVertices[_0xd83c('0x11')][_0xd83c('0x31')]=function(_0xce0504,_0x114108){this[_0xd83c('0xf')]['getSmsAccountById'](_0xce0504)[_0xd83c('0x17')](function(_0x438f56){_0x114108(null,_0x438f56?_0x438f56:![]);})[_0xd83c('0x14')](function(_0x5bf1cd){_0x114108(_0x5bf1cd);});};AGIVertices[_0xd83c('0x11')][_0xd83c('0x32')]=function(_0x4a9378,_0x250dec){this[_0xd83c('0xf')][_0xd83c('0x32')](_0x4a9378)['then'](function(_0x3bbfe2){_0x250dec(null,_0x3bbfe2);})[_0xd83c('0x14')](function(_0x1a58c9){_0x250dec(_0x1a58c9);});};AGIVertices['prototype'][_0xd83c('0x33')]=function(_0x3edcdf,_0x11521b,_0x7cf5cc){this[_0xd83c('0xf')][_0xd83c('0x33')]({'uniqueid':this[_0xd83c('0xe')][_0xd83c('0x34')],'node':_0x3edcdf[_0xd83c('0x35')],'application':_0x3edcdf[_0xd83c('0x36')],'data':_0x11521b||null,'project_name':this[_0xd83c('0xe')][_0xd83c('0x37')],'callerid':this['channel'][_0xd83c('0x38')]})[_0xd83c('0x17')](function(_0x42dc6b){if(_0x7cf5cc){_0x7cf5cc(null,_0x42dc6b);}})[_0xd83c('0x14')](function(_0x5f46c3){if(_0x7cf5cc){_0x7cf5cc(_0x5f46c3);}});};AGIVertices[_0xd83c('0x11')][_0xd83c('0x39')]=function(_0x2777ff,_0x40b022,_0x1d971c,_0x2f9d5b){this[_0xd83c('0xf')]['createSquareRecording']({'uniqueid':this['channel'][_0xd83c('0x34')],'callerid':this[_0xd83c('0xe')][_0xd83c('0x38')],'calleridname':this[_0xd83c('0xe')][_0xd83c('0x3a')],'context':this[_0xd83c('0xe')][_0xd83c('0x3b')],'extension':this[_0xd83c('0xe')][_0xd83c('0x3c')],'priority':this['channel'][_0xd83c('0x3d')],'accountcode':this[_0xd83c('0xe')][_0xd83c('0x3e')],'dnid':this[_0xd83c('0xe')][_0xd83c('0x3f')],'projectName':this['channel'][_0xd83c('0x37')],'saveName':_0x40b022,'filename':_0x2777ff[_0xd83c('0x40')]||_0x40b022,'savePath':_0x1d971c})[_0xd83c('0x17')](function(_0xbec930){_0x2f9d5b(null,_0xbec930);})['catch'](function(_0x5b6801){_0x2f9d5b(_0x5b6801);});};AGIVertices[_0xd83c('0x11')]['createSquareMessage']=function(_0xf6ee83,_0x4bf438,_0x2c38ec,_0x43520d,_0x2bfb21){this['rpc'][_0xd83c('0x41')]({'uniqueid':this[_0xd83c('0xe')]['uniqueid'],'body':_0xf6ee83,'direction':_0x4bf438,'providerName':_0x2c38ec,'providerResponse':_0x43520d})[_0xd83c('0x17')](function(_0xd2bf76){if(_0x2bfb21){_0x2bfb21(null,_0xd2bf76);}})['catch'](function(_0x406316){if(_0x2bfb21){_0x2bfb21(_0x406316);}});};AGIVertices[_0xd83c('0x11')][_0xd83c('0x42')]=function(_0x53992c,_0x28a4d1){this[_0xd83c('0xf')]['createCmContact']({'firstName':_[_0xd83c('0x43')](_0x53992c['name'])||_['isNil'](_0x53992c['name'])?_0xd83c('0x44')+Math[_0xd83c('0x45')]():_0x53992c[_0xd83c('0x13')],'lastName':_[_0xd83c('0x43')](_0x53992c[_0xd83c('0x46')])||_['isNil'](_0x53992c[_0xd83c('0x46')])?null:_0x53992c[_0xd83c('0x46')],'phone':_0x53992c[_0xd83c('0x47')],'ListId':_0x53992c[_0xd83c('0x48')],'scheduledat':_0x53992c[_0xd83c('0x49')],'callbackUniqueid':this[_0xd83c('0xe')][_0xd83c('0x34')],'tags':_0xd83c('0x4a'),'description':'Callback\x20scheduled\x20at\x20'+_0x53992c['scheduledAt'][_0xd83c('0x4b')](),'priority':_0x53992c['callback_priority']})[_0xd83c('0x17')](function(_0xc2c059){_0x28a4d1(null,_0xc2c059);})[_0xd83c('0x14')](function(_0xd08de6){_0x28a4d1(_0xd08de6);});};AGIVertices[_0xd83c('0x11')][_0xd83c('0x4c')]=function(_0x367a73,_0x558d35){this['rpc'][_0xd83c('0x4d')](_0x367a73)['then'](function(_0x183203){_0x558d35(null,_0x183203?_0x183203[_0xd83c('0x13')]:![]);})['catch'](function(_0x3641ae){_0x558d35(_0x3641ae);});};AGIVertices[_0xd83c('0x11')][_0xd83c('0x4e')]=function(_0x4ffc45,_0x3d4a4d,_0x135b33){var _0x1830d6={'role':_0xd83c('0x4f')};_0x1830d6[_0x4ffc45]=this[_0xd83c('0xe')]['callerid'];this[_0xd83c('0xf')][_0xd83c('0x4e')](_0x1830d6,_0x3d4a4d,this['channel'][_0xd83c('0x34')])[_0xd83c('0x17')](function(_0xf59e42){_0x135b33(null,_['isNil'](_0xf59e42)?![]:!![]);})[_0xd83c('0x14')](function(_0x26c841){logger[_0xd83c('0x29')](_0x26c841);_0x135b33(null,![]);});};AGIVertices[_0xd83c('0x11')][_0xd83c('0x50')]=function(_0x116cd7,_0x1eac0e){var _0x15f567={'role':_0xd83c('0x4f')};_0x15f567[_0x116cd7]=this['channel'][_0xd83c('0x38')];this[_0xd83c('0xf')][_0xd83c('0x50')](_0x15f567)['then'](function(_0x58d238){_0x1eac0e(null,_['isNil'](_0x58d238)?![]:!![]);})[_0xd83c('0x14')](function(_0x30aa9f){logger['error'](_0x30aa9f);_0x1eac0e(null,![]);});};AGIVertices['prototype']['agentLogout']=function(_0xbb06f9,_0x5b79bc){var _0xbbacda={'role':'agent'};_0xbbacda[_0xbb06f9]=this['channel'][_0xd83c('0x38')];this[_0xd83c('0xf')]['agentLogout'](_0xbbacda)[_0xd83c('0x17')](function(_0x1350a6){_0x5b79bc(null,_[_0xd83c('0x51')](_0x1350a6)?![]:!![]);})[_0xd83c('0x14')](function(_0x4c4c3e){logger[_0xd83c('0x29')](_0x4c4c3e);_0x5b79bc(null,![]);});};AGIVertices[_0xd83c('0x11')][_0xd83c('0x52')]=function(_0xd1c5ba,_0x5aff5c){var _0x4e0283={'role':_0xd83c('0x4f')};_0x4e0283[_0xd1c5ba]=this['channel'][_0xd83c('0x38')];var _0x3f4737=_0xd1c5ba!=_0xd83c('0x53')?util[_0xd83c('0x54')](_0xd83c('0x55'),_0xd83c('0x56'),this[_0xd83c('0xe')][_0xd83c('0x38')]):undefined;this['rpc'][_0xd83c('0x52')](_0x4e0283,_0x3f4737)[_0xd83c('0x17')](function(_0xe704bf){_0x5aff5c(null,_[_0xd83c('0x51')](_0xe704bf)?![]:!![]);})[_0xd83c('0x14')](function(_0x49ed80){logger[_0xd83c('0x29')](_0x49ed80);_0x5aff5c(null,![]);});};AGIVertices[_0xd83c('0x11')][_0xd83c('0x57')]=function(_0xf26e96,_0x358417){sh[_0xd83c('0x58')](_['trim'](_0xf26e96),function(_0x57e92e,_0x4b58a2){var _0xb657d3=_0x4b58a2[_0xd83c('0x59')](/(\r\n|\n|\r)/gm,'');_0x358417(null,_0xb657d3);});};AGIVertices['prototype'][_0xd83c('0x5a')]=function(_0x21ed0c,_0x424ba3){scripts['googleCloudTTS'](_0x21ed0c[_0xd83c('0x5b')],_0x21ed0c[_0xd83c('0x5c')]||_0xd83c('0x5d'),_0x21ed0c[_0xd83c('0x5d')],_0x21ed0c['languageCode']||_0xd83c('0x5e'),_0x21ed0c[_0xd83c('0x5f')]||_0xd83c('0x60'),_0x21ed0c['audioEncoding']||_0xd83c('0x61'))[_0xd83c('0x17')](function(_0x109b1f){_0x424ba3(null,_0x109b1f);})[_0xd83c('0x14')](function(_0xf7e499){_0x424ba3(_0xf7e499);});};AGIVertices[_0xd83c('0x11')][_0xd83c('0x62')]=function(_0x1a6fe7,_0x509dd1){scripts[_0xd83c('0x62')](_0x1a6fe7[_0xd83c('0x5d')],_0x1a6fe7[_0xd83c('0x63')]||'en',0x1)['then'](function(_0x173d6f){_0x509dd1(null,_0x173d6f);})['catch'](function(_0x3de343){_0x509dd1(_0x3de343);});};AGIVertices[_0xd83c('0x11')][_0xd83c('0x64')]=function(_0x553656,_0x7ff9d7){var _0x57a18d={'uri':_0x553656['url'],'method':_0x553656[_0xd83c('0x65')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x553656[_0xd83c('0x66')])===_0xd83c('0x67')&&parseInt(_0x553656[_0xd83c('0x66')])>=0x1?parseInt(_0x553656[_0xd83c('0x66')])*0x3e8:0x5*0x3e8};if(_[_0xd83c('0x68')]([_0xd83c('0x69'),'PUT'],_0x57a18d[_0xd83c('0x65')]['toUpperCase']())){try{_0x57a18d['body']=_0x553656[_0xd83c('0xc')]?JSON['parse'](_0x553656[_0xd83c('0xc')]):{};}catch(_0xe59564){logger[_0xd83c('0x29')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0xe59564);}}try{_0x57a18d[_0xd83c('0x6a')]=_0x553656[_0xd83c('0x6b')]?JSON['parse'](_0x553656[_0xd83c('0x6b')]):{};}catch(_0x2847ef){logger[_0xd83c('0x29')](_0xd83c('0x6c'),_0x2847ef);}if(_0x553656[_0xd83c('0x6d')]){try{var _0x23b8fa=require(_0x553656[_0xd83c('0x6d')])[_0xd83c('0x6e')](this,_0x57a18d);_0x57a18d[_0xd83c('0x6f')]=Mustache[_0xd83c('0x70')](_0x553656[_0xd83c('0x71')],_0x23b8fa,{},['$$','$$']);if(_0x57a18d[_0xd83c('0x6a')]){_0x57a18d[_0xd83c('0x6a')]=JSON[_0xd83c('0x72')](Mustache['render'](JSON[_0xd83c('0x73')](_0x57a18d['headers']),_0x23b8fa,{},['$$','$$']));}if(_0x57a18d[_0xd83c('0x74')]){_0x57a18d[_0xd83c('0x74')]=JSON[_0xd83c('0x72')](Mustache[_0xd83c('0x70')](JSON['stringify'](_0x57a18d[_0xd83c('0x74')]),_0x23b8fa,{},['$$','$$']));}}catch(_0x54a2c0){logger['error']('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x54a2c0);}}rp(_0x57a18d)[_0xd83c('0x17')](function(_0x271d2d){var _0x27f650={'statusCode':_0x271d2d[_0xd83c('0x75')]||0xc8,'statusMessage':_0x271d2d[_0xd83c('0x76')]||'OK','headers':_0x271d2d[_0xd83c('0x6a')]||{},'body':_0x271d2d[_0xd83c('0x74')]||{}};_0x7ff9d7(null,_0x27f650);})[_0xd83c('0x14')](function(_0x5dec36){var _0x4e2155={'statusCode':_0x5dec36[_0xd83c('0x75')]||0x1f4,'statusMessage':_0x5dec36['message']||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x5dec36[_0xd83c('0x77')][_0xd83c('0x6a')]||{},'body':_0x5dec36['options'][_0xd83c('0x74')]||{}};_0x7ff9d7(null,_0x4e2155);});};AGIVertices[_0xd83c('0x11')][_0xd83c('0x78')]=function(_0x47e537,_0x3b27){scripts['googleDialogflow'](this[_0xd83c('0xe')]['uniqueid'],_0x47e537[_0xd83c('0x79')],_0x47e537[_0xd83c('0x5d')],_0x47e537[_0xd83c('0x7a')]||'en')[_0xd83c('0x17')](function(_0x42bdbd){_0x3b27(null,_0x42bdbd);})[_0xd83c('0x14')](function(_0x3bc128){_0x3b27(_0x3bc128);});};AGIVertices[_0xd83c('0x11')][_0xd83c('0x7b')]=function(_0x3205c2,_0x2fb720){scripts['googleDialogflowV2'](this['channel'][_0xd83c('0x34')],_0x3205c2[_0xd83c('0x7c')],_0x3205c2[_0xd83c('0x7d')],_0x3205c2[_0xd83c('0x7e')],_0x3205c2[_0xd83c('0x5d')],_0x3205c2[_0xd83c('0x7f')]||'en')[_0xd83c('0x17')](function(_0x931ed7){_0x2fb720(null,_0x931ed7);})[_0xd83c('0x14')](function(_0x415ce2){_0x2fb720(_0x415ce2);});};AGIVertices['prototype'][_0xd83c('0x80')]=function(_0x506e74,_0x155482){scripts[_0xd83c('0x80')](this[_0xd83c('0xe')],_0x506e74)[_0xd83c('0x17')](function(_0x2dd610){_0x155482(null,_0x2dd610);})[_0xd83c('0x14')](function(_0x11bf85){_0x155482(_0x11bf85);});};AGIVertices[_0xd83c('0x11')][_0xd83c('0x81')]=function(_0x5c5855,_0x573802){scripts['ispeechTTS'](_0x5c5855[_0xd83c('0x79')],_0x5c5855[_0xd83c('0x5d')],_0x5c5855[_0xd83c('0x82')]||_0xd83c('0x5e'),_0x5c5855[_0xd83c('0x83')])[_0xd83c('0x17')](function(_0x31c192){_0x573802(null,_0x31c192);})[_0xd83c('0x14')](function(_0x3b24fe){_0x573802(_0x3b24fe);});};AGIVertices[_0xd83c('0x11')][_0xd83c('0x84')]=function(_0x8ccc3f,_0x4791fd,_0xd6f2e9){scripts[_0xd83c('0x84')](_0x4791fd,_0x8ccc3f[_0xd83c('0x79')],_0x8ccc3f['ispeech_asr_language']||_0xd83c('0x5e'),this[_0xd83c('0x85')](_0x8ccc3f[_0xd83c('0x86')])?_0x8ccc3f[_0xd83c('0x86')]:undefined)['then'](function(_0x55587a){_0xd6f2e9(null,_0x55587a);})[_0xd83c('0x14')](function(_0x37c224){_0xd6f2e9(_0x37c224);});};AGIVertices[_0xd83c('0x11')][_0xd83c('0x87')]=function(_0x2d7688,_0x1f996c){scripts[_0xd83c('0x87')](_0x2d7688['aws_access_key_id'],_0x2d7688[_0xd83c('0x88')],_0x2d7688[_0xd83c('0x89')],_0x2d7688[_0xd83c('0x8a')]||_0xd83c('0x8b'),_0x2d7688['text'],_0x2d7688[_0xd83c('0x8c')]||_0xd83c('0x5d'))[_0xd83c('0x17')](function(_0x83778b){_0x1f996c(null,_0x83778b);})[_0xd83c('0x14')](function(_0x4f7801){_0x1f996c(_0x4f7801);});};AGIVertices[_0xd83c('0x11')]['awsLex']=function(_0x353880,_0x58a9b1){scripts[_0xd83c('0x8d')](this[_0xd83c('0xe')][_0xd83c('0x34')],_0x353880['aws_access_key_id'],_0x353880[_0xd83c('0x88')],_0x353880[_0xd83c('0x8e')],_0x353880[_0xd83c('0x5d')],_0x353880[_0xd83c('0x8f')])[_0xd83c('0x17')](function(_0x5c2fe4){_0x58a9b1(null,_0x5c2fe4);})[_0xd83c('0x14')](function(_0x28fcc5){_0x58a9b1(_0x28fcc5);});};AGIVertices[_0xd83c('0x11')]['googleASR']=function(_0x55d15c,_0x4c95d8,_0x4ca0b7){scripts[_0xd83c('0x90')](_0x4c95d8,_0x55d15c['key'],_0x55d15c['google_asr_language']||_0xd83c('0x5e'))[_0xd83c('0x17')](function(_0x23ae42){_0x4ca0b7(null,_0x23ae42);})[_0xd83c('0x14')](function(_0x578055){_0x4ca0b7(_0x578055);});};AGIVertices[_0xd83c('0x11')][_0xd83c('0x91')]=function(_0x151f43,_0x1730f4,_0x4dab2d){scripts[_0xd83c('0x91')](_0x1730f4,_0x151f43[_0xd83c('0x92')],_0x151f43[_0xd83c('0x93')],_0x151f43[_0xd83c('0x6f')])['then'](function(_0x3c4265){_0x4dab2d(null,_0x3c4265);})[_0xd83c('0x14')](function(_0x5cf22a){_0x4dab2d(_0x5cf22a);});};AGIVertices[_0xd83c('0x11')][_0xd83c('0x94')]=function(_0x2ed0a2){var _0x676644=_[_0xd83c('0x68')](verticesWithRetry,_0x2ed0a2[_0xd83c('0x36')])?_0x2ed0a2:_[_0xd83c('0x95')](_0x2ed0a2);for(var _0x186e75 in _0x676644){if(_0x676644[_0xd83c('0x96')](_0x186e75)){if(_0x676644[_0x186e75]&&_[_0xd83c('0x97')](_0x676644[_0x186e75])){if(_[_0xd83c('0x68')](recursiveMapAttributes,_0x186e75)){_0x676644[_0x186e75]=this[_0xd83c('0x98')](_0x676644[_0x186e75]);}else{_0x676644[_0x186e75]=this['replaceAllVariables'](_0x676644[_0x186e75]);}}}}return _0x676644;};AGIVertices[_0xd83c('0x11')][_0xd83c('0x99')]=function(_0x2e5920){for(var _0x40ea3f in _0x2e5920){if(_0x2e5920[_0xd83c('0x96')](_0x40ea3f)){if(_[_0xd83c('0x9a')](_0x2e5920[_0x40ea3f])){this[_0xd83c('0x99')](_0x2e5920[_0x40ea3f]);}else if(_[_0xd83c('0x9b')](_0x2e5920[_0x40ea3f])){for(var _0x59c782=0x0;_0x59c782<_0x2e5920[_0x40ea3f][_0xd83c('0x9c')];_0x59c782++){this[_0xd83c('0x99')](_0x2e5920[_0x40ea3f][_0x59c782]);}}else if(_[_0xd83c('0x97')](_0x2e5920[_0x40ea3f])){_0x2e5920[_0x40ea3f]=this[_0xd83c('0x9d')](_0x2e5920[_0x40ea3f]);}}}};AGIVertices[_0xd83c('0x11')][_0xd83c('0x9e')]=function(_0x3b4725,_0xa9a1bc){for(var _0x2ed1c0 in _0x3b4725){if(_0x3b4725[_0xd83c('0x96')](_0x2ed1c0)){if(_[_0xd83c('0x9a')](_0x3b4725[_0x2ed1c0])){if(!_[_0xd83c('0x43')](_0x3b4725[_0x2ed1c0])){this[_0xd83c('0x9e')](_0x3b4725[_0x2ed1c0],util[_0xd83c('0x54')](_0xd83c('0x9f'),_0xa9a1bc,_0x2ed1c0));}}else if(_['isArray'](_0x3b4725[_0x2ed1c0])){for(var _0x347cf9=0x0;_0x347cf9<_0x3b4725[_0x2ed1c0][_0xd83c('0x9c')];_0x347cf9++){this[_0xd83c('0x9e')](_0x3b4725[_0x2ed1c0][_0x347cf9],util[_0xd83c('0x54')](_0xd83c('0x9f'),_0xa9a1bc,_0x2ed1c0+'['+_0x347cf9+']'));}}else{if(!_['isNil'](_0x3b4725[_0x2ed1c0])){this['channel']['setVariable'](util[_0xd83c('0x54')](_0xd83c('0x9f'),_0xa9a1bc,_0x2ed1c0),_0x3b4725[_0x2ed1c0]);}}}}};AGIVertices[_0xd83c('0x11')][_0xd83c('0x98')]=function(_0x30853c){try{var _0x69f6a1=JSON['parse'](_0x30853c);this[_0xd83c('0x99')](_0x69f6a1);return JSON[_0xd83c('0x73')](_0x69f6a1);}catch(_0x4a7274){return this[_0xd83c('0x9d')](_0x30853c);}};AGIVertices[_0xd83c('0x11')]['replaceAllVariables']=function(_0x316deb){var _0x41968f=_0x316deb[_0xd83c('0xa0')]('{');for(var _0x4ac677=0x1;_0x4ac677<_0x41968f[_0xd83c('0x9c')];_0x4ac677+=0x1){var _0xed91eb=_0x41968f[_0x4ac677][_0xd83c('0xa0')]('}');if(_0xed91eb[_0xd83c('0x9c')]>0x1){_0x316deb=_0x316deb[_0xd83c('0xa1')]('{'+_0xed91eb[0x0]+'}',this[_0xd83c('0xe')]['getVariable'](_0xed91eb[0x0])[_0xd83c('0xa2')]||_0xed91eb[0x0]);}}if(_0x41968f[_0xd83c('0x9c')]===0x1){return _0x316deb[_0xd83c('0x4b')]();}return this[_0xd83c('0x9d')](_0x316deb);};AGIVertices[_0xd83c('0x11')]['getAndSetVariable']=function(_0x40d3ca,_0x2ac7a2){var _0x361b8d=this['channel'][_0xd83c('0x12')](_0x40d3ca);if(_0x361b8d[_0xd83c('0xa3')]===-0x1){return _0x361b8d;}logger[_0xd83c('0x2b')](util[_0xd83c('0x54')](_0xd83c('0xa4'),_0x2ac7a2,_0x361b8d[_0xd83c('0xa2')]));return this[_0xd83c('0xe')][_0xd83c('0xa5')](_0x2ac7a2,_0x361b8d[_0xd83c('0xa2')]);};AGIVertices['prototype'][_0xd83c('0x85')]=function(_0x1d0d4f){return _0x1d0d4f&&_0x1d0d4f!=='0'&&_0x1d0d4f!=='-1'&&_0x1d0d4f!=='';};AGIVertices['prototype'][_0xd83c('0xa6')]=function(_0x3727a8){this[_0xd83c('0x33')][_0xd83c('0x6e')](this,_0x3727a8,'-');_0x3727a8['retry']=_0x3727a8['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0xd83c('0x11')]['mrcpsynth']=function(_0x52b576){logger[_0xd83c('0x2b')](util[_0xd83c('0x54')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x52b576[_0xd83c('0x35')]));if(!this[_0xd83c('0x85')](_0x52b576[_0xd83c('0x5d')])){return this[_0xd83c('0xe')][_0xd83c('0xa7')]('no\x20text\x20configured');}var _0x26fb66='\x22'+_0x52b576[_0xd83c('0x5d')]+'\x22';if(this[_0xd83c('0x85')](_0x52b576[_0xd83c('0x77')])){_0x26fb66+=','+_0x52b576[_0xd83c('0x77')];}var _0x3b5cdd=this['channel']['exec'](_0xd83c('0xa8'),_0x26fb66);if(_0x3b5cdd[_0xd83c('0xa3')]===-0x1){return _0x3b5cdd;}return this[_0xd83c('0xe')][_0xd83c('0xa7')](util[_0xd83c('0x54')](_0xd83c('0xa9'),_0x26fb66));};AGIVertices[_0xd83c('0x11')][_0xd83c('0xaa')]=function(_0x1c319b){logger[_0xd83c('0x2b')](util['format']('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x1c319b[_0xd83c('0x35')]));if(!this[_0xd83c('0x85')](_0x1c319b[_0xd83c('0xab')])){return this['channel'][_0xd83c('0xa7')](_0xd83c('0xac'));}var _0x44e516=_0x1c319b[_0xd83c('0xab')];if(this[_0xd83c('0x85')](_0x1c319b[_0xd83c('0x77')])){_0x44e516+=','+_0x1c319b[_0xd83c('0x77')];}var _0x5bc34d=this[_0xd83c('0xe')][_0xd83c('0x58')]('MRCPRecog',_0x44e516);if(_0x5bc34d[_0xd83c('0xa3')]===-0x1){return _0x5bc34d;}var _0x9ee7d4=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0xd83c('0xad'));if(_0x9ee7d4[_0xd83c('0xa3')]===-0x1){return _0x9ee7d4;}var _0x42aac=this[_0xd83c('0xae')](_0xd83c('0xaf'),'MRCP_RECOG_TRANSCRIPT');if(_0x42aac[_0xd83c('0xa3')]===-0x1){return _0x42aac;}var _0x2c050d=this[_0xd83c('0xae')](_0xd83c('0xb0'),_0xd83c('0xb1'));if(_0x2c050d['result']===-0x1){return _0x2c050d;}return this[_0xd83c('0xe')][_0xd83c('0xa7')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x44e516));};AGIVertices['prototype'][_0xd83c('0x8')]=function(_0x18c293){logger[_0xd83c('0x2b')](util[_0xd83c('0x54')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x18c293[_0xd83c('0x35')]));return this[_0xd83c('0xe')][_0xd83c('0x8')]([_0x18c293['command'],_0x18c293['args']]);};AGIVertices[_0xd83c('0x11')][_0xd83c('0xb2')]=function(_0x429688){logger[_0xd83c('0x2b')](util[_0xd83c('0x54')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x429688[_0xd83c('0x35')]));if(this[_0xd83c('0x85')](_0x429688[_0xd83c('0x66')])){logger[_0xd83c('0x2b')](util[_0xd83c('0x54')](_0xd83c('0xb3'),_0x429688['timeout']));var _0xfc0ecc=this['channel']['wait'](_0x429688['timeout']);if(_0xfc0ecc[_0xd83c('0xa3')]===-0x1){return _0xfc0ecc;}}return this[_0xd83c('0xe')][_0xd83c('0xb2')]();};AGIVertices[_0xd83c('0x11')][_0xd83c('0x4a')]=function(_0x493865){logger[_0xd83c('0x2b')](util[_0xd83c('0x54')](_0xd83c('0xb4'),_0x493865[_0xd83c('0x35')]));if(!this['isConfigured'](_0x493865[_0xd83c('0x48')])){return this[_0xd83c('0xe')][_0xd83c('0x29')](_0x493865,_0xd83c('0xb5'));}_0x493865[_0xd83c('0x49')]=moment();if(this[_0xd83c('0x85')](_0x493865['delay'])){_0x493865['scheduledAt']=moment()[_0xd83c('0xb6')](_0x493865[_0xd83c('0xb7')],_0xd83c('0xb8'));}if(!this[_0xd83c('0x85')](_0x493865[_0xd83c('0xb9')])){_0x493865[_0xd83c('0xb9')]=0x2;}this[_0xd83c('0x42')]['sync'](this,_0x493865);return this[_0xd83c('0xe')]['noop'](util[_0xd83c('0x54')](_0xd83c('0xba'),_0x493865[_0xd83c('0x47')],_0x493865[_0xd83c('0x48')],_0x493865[_0xd83c('0x49')]));};AGIVertices[_0xd83c('0x11')][_0xd83c('0xbb')]=function(_0x4c91b3){logger['info'](util[_0xd83c('0x54')](_0xd83c('0xbc'),_0x4c91b3[_0xd83c('0x35')]));var _0x1d30d5=this[_0xd83c('0xe')]['exec'](_0x4c91b3[_0xd83c('0xbd')],_0x4c91b3[_0xd83c('0x77')]);if(_0x1d30d5['result']===-0x1){return _0x1d30d5;}return this[_0xd83c('0xe')]['noop'](util[_0xd83c('0x54')](_0xd83c('0xbe'),_0x4c91b3[_0xd83c('0xbd')],_0x4c91b3[_0xd83c('0x77')]));};AGIVertices[_0xd83c('0x11')][_0xd83c('0xbf')]=function(_0x4cc3d4){logger['info'](util[_0xd83c('0x54')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x4cc3d4['label']));if(!this[_0xd83c('0x85')](_0x4cc3d4['text'])){return this['channel'][_0xd83c('0xa7')](_0xd83c('0xc0'));}var _0x4e94df='\x22'+_0x4cc3d4[_0xd83c('0x5d')]+'\x22';if(this[_0xd83c('0x85')](_0x4cc3d4[_0xd83c('0x77')])){_0x4e94df+=','+_0x4cc3d4[_0xd83c('0x77')];}var _0x3540d8=this[_0xd83c('0xe')][_0xd83c('0x58')](_0xd83c('0xa8'),_0x4e94df);if(_0x3540d8[_0xd83c('0xa3')]===-0x1){return _0x3540d8;}return this[_0xd83c('0xe')][_0xd83c('0xa7')](util[_0xd83c('0x54')](_0xd83c('0xa9'),_0x4e94df));};AGIVertices[_0xd83c('0x11')][_0xd83c('0xc1')]=function(_0x13efba){logger[_0xd83c('0x2b')](util[_0xd83c('0x54')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x13efba[_0xd83c('0x35')]));if(!this[_0xd83c('0x85')](_0x13efba[_0xd83c('0x5d')])){return this['channel']['noop']('no\x20text\x20configured');}var _0x1a2480='\x22'+_0x13efba[_0xd83c('0x5d')]+'\x22';if(this[_0xd83c('0x85')](_0x13efba['options'])){_0x1a2480+=','+_0x13efba[_0xd83c('0x77')];}var _0x3513b0=this['channel']['exec'](_0xd83c('0xa8'),_0x1a2480);if(_0x3513b0[_0xd83c('0xa3')]===-0x1){return _0x3513b0;}return this[_0xd83c('0xe')][_0xd83c('0xa7')](util[_0xd83c('0x54')](_0xd83c('0xa9'),_0x1a2480));};AGIVertices[_0xd83c('0x11')]['lumenvoxasr']=function(_0x5bbde5){logger[_0xd83c('0x2b')](util[_0xd83c('0x54')](_0xd83c('0xc2'),_0x5bbde5[_0xd83c('0x35')]));if(!this[_0xd83c('0x85')](_0x5bbde5[_0xd83c('0xab')])){return this[_0xd83c('0xe')][_0xd83c('0xa7')]('no\x20grammar\x20configured');}var _0x1db346=_0x5bbde5[_0xd83c('0xab')];if(this['isConfigured'](_0x5bbde5[_0xd83c('0x77')])){_0x1db346+=','+_0x5bbde5['options'];}var _0x10ed09=this['channel'][_0xd83c('0x58')](_0xd83c('0xc3'),_0x1db346);if(_0x10ed09['result']===-0x1){return _0x10ed09;}var _0x35cde0=this['getAndSetVariable'](_0xd83c('0xc4'),_0xd83c('0xc5'));if(_0x35cde0[_0xd83c('0xa3')]===-0x1){return _0x35cde0;}var _0x42e403=this[_0xd83c('0xae')](_0xd83c('0xaf'),_0xd83c('0xc6'));if(_0x42e403[_0xd83c('0xa3')]===-0x1){return _0x42e403;}var _0x397636=this[_0xd83c('0xae')](_0xd83c('0xb0'),'LUMENVOX_ASR_INSTANCE');if(_0x397636['result']===-0x1){return _0x397636;}return this[_0xd83c('0xe')][_0xd83c('0xa7')](util[_0xd83c('0x54')]('Executed\x20command\x20MRCPRecog\x20%s',_0x1db346));};AGIVertices[_0xd83c('0x11')][_0xd83c('0xc7')]=function(_0x5c35b3){logger[_0xd83c('0x2b')](util[_0xd83c('0x54')](_0xd83c('0xc8'),_0x5c35b3[_0xd83c('0x35')]));if(!this[_0xd83c('0x85')](_0x5c35b3['grammar'])){return this[_0xd83c('0xe')]['noop']('no\x20grammar\x20configured');}var _0x51b08b=_0x5c35b3[_0xd83c('0xab')];if(this[_0xd83c('0x85')](_0x5c35b3[_0xd83c('0x77')])){_0x51b08b+=','+_0x5c35b3[_0xd83c('0x77')];}var _0x259282=this['channel'][_0xd83c('0x58')](_0xd83c('0xc3'),_0x51b08b);if(_0x259282[_0xd83c('0xa3')]===-0x1){return _0x259282;}var _0x30def9=this[_0xd83c('0xae')](_0xd83c('0xc4'),_0xd83c('0xc9'));if(_0x30def9[_0xd83c('0xa3')]===-0x1){return _0x30def9;}var _0x98d3dc=this['getAndSetVariable'](_0xd83c('0xaf'),_0xd83c('0xca'));if(_0x98d3dc[_0xd83c('0xa3')]===-0x1){return _0x98d3dc;}var _0x31c316=this[_0xd83c('0xae')]('RECOG_INSTANCE()',_0xd83c('0xcb'));if(_0x31c316['result']===-0x1){return _0x31c316;}return this[_0xd83c('0xe')][_0xd83c('0xa7')](util[_0xd83c('0x54')]('Executed\x20command\x20MRCPRecog\x20%s',_0x51b08b));};AGIVertices[_0xd83c('0x11')][_0xd83c('0xcc')]=function(_0xa64042){logger[_0xd83c('0x2b')](util[_0xd83c('0x54')](_0xd83c('0xcd'),_0xa64042['label']));if(!this[_0xd83c('0x85')](_0xa64042['odbc_id'])){return this[_0xd83c('0xe')][_0xd83c('0x29')](_0xa64042,_0xd83c('0xce'));}var _0x4cc51b=this[_0xd83c('0x19')][_0xd83c('0x6e')](this,_0xa64042['odbc_id']);if(!_0x4cc51b){return this[_0xd83c('0xe')][_0xd83c('0x29')](_0xa64042,_0xd83c('0xcf'));}if(!this[_0xd83c('0x85')](_0xa64042[_0xd83c('0x2d')])){return this['channel'][_0xd83c('0x29')](_0xa64042,_0xd83c('0xd0'));}var _0x1f2537=_0xa64042[_0xd83c('0x2d')][_0xd83c('0x59')](/(\r\n|\n|\r)/gm,'\x20');this[_0xd83c('0xe')]['noop'](util[_0xd83c('0x54')](_0xd83c('0xd1'),_0x1f2537));var _0x7bdd90=this[_0xd83c('0x27')][_0xd83c('0x6e')](this,_0x4cc51b,_0x1f2537);this['createSquareDetailsReport'][_0xd83c('0x6e')](this,_0xa64042,_0x1f2537);if(!this[_0xd83c('0x85')](_0xa64042[_0xd83c('0xd2')])){return this[_0xd83c('0xe')][_0xd83c('0xa7')](_0xd83c('0xd3'));}var _0x2d4d1b=this[_0xd83c('0x12')][_0xd83c('0x6e')](this,_0xa64042[_0xd83c('0xd2')]);if(!_0x2d4d1b){return this[_0xd83c('0xe')][_0xd83c('0x29')](_0xa64042,_0xd83c('0xd4'));}var _0x493893=this;_0x7bdd90['forEach'](function(_0x472722,_0x5bd8c3){Object[_0xd83c('0xd5')](_0x472722)['forEach'](function(_0x29f956){_0x493893[_0xd83c('0xe')][_0xd83c('0xa5')](util[_0xd83c('0x54')](_0xd83c('0xd6'),_0x2d4d1b,_0x5bd8c3,_0x29f956),_0x472722[_0x29f956]);});});this[_0xd83c('0xe')]['setVariable'](util[_0xd83c('0x54')](_0xd83c('0xd7'),_0x2d4d1b),_0x7bdd90[_0xd83c('0x9c')]);return this[_0xd83c('0xe')][_0xd83c('0xa7')](util[_0xd83c('0x54')]('variable\x20%s\x20set',_0x2d4d1b));};AGIVertices[_0xd83c('0x11')][_0xd83c('0xd8')]=function(_0xcc29de){logger[_0xd83c('0xd9')](util[_0xd83c('0x54')](_0xd83c('0xda'),_0xcc29de[_0xd83c('0x35')]));if(!this[_0xd83c('0x85')](_0xcc29de[_0xd83c('0xdb')])){return this[_0xd83c('0xe')][_0xd83c('0x29')](_0xcc29de,_0xd83c('0xdc'));}var _0x2f05e4=this['getUser'][_0xd83c('0x6e')](this,_0xcc29de[_0xd83c('0xdb')]);if(!_0x2f05e4){return this[_0xd83c('0xe')][_0xd83c('0x29')](_0xcc29de,_0xd83c('0xdd'));}var _0xd7f2a=this[_0xd83c('0xe')]['exec'](_0xd83c('0xde'),[util[_0xd83c('0x54')](_0xd83c('0xdf'),_0x2f05e4),_0xcc29de[_0xd83c('0x66')],_0xcc29de[_0xd83c('0xe0')],_0xcc29de[_0xd83c('0x71')]]);if(_0xd7f2a[_0xd83c('0xa3')]===-0x1){return _0xd7f2a;}return this[_0xd83c('0xe')][_0xd83c('0xa7')](util[_0xd83c('0x54')]('Executed\x20command\x20%s',_0xd83c('0xde')));};AGIVertices[_0xd83c('0x11')][_0xd83c('0xe1')]=function(_0x1d4b78){logger[_0xd83c('0x2b')](util[_0xd83c('0x54')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x1d4b78['label']));if(!this[_0xd83c('0x85')](_0x1d4b78['key'])){return this[_0xd83c('0xe')][_0xd83c('0xa7')](_0xd83c('0xe2'));}if(!this['isConfigured'](_0x1d4b78['text'])){return this[_0xd83c('0xe')][_0xd83c('0xa7')](_0xd83c('0xc0'));}this[_0xd83c('0xe')]['bot']=!![];this[_0xd83c('0x33')](_0x1d4b78);this['createSquareMessage'](_0x1d4b78['text'],'in','','');this['channel']['noop'](util['format']('Trying\x20Dialogflow:\x20%s',_0x1d4b78['text']));var _0x5ab251=this[_0xd83c('0x78')][_0xd83c('0x6e')](this,_0x1d4b78);if(_0x5ab251){for(var _0x56b4ad in _0x5ab251){if(_0x5ab251[_0xd83c('0x96')](_0x56b4ad)){this[_0xd83c('0xe')]['setVariable'](util[_0xd83c('0x54')](_0xd83c('0xe3'),_0x56b4ad[_0xd83c('0xe4')]()),_0x5ab251[_0x56b4ad]);}}this['createSquareMessage'](_0x5ab251[_0xd83c('0xe5')],_0xd83c('0xe6'),_0xd83c('0xe1'),'');return this[_0xd83c('0xe')]['noop'](util['format'](_0xd83c('0xe7'),_0x5ab251[_0xd83c('0xe5')]));}return this['channel']['error'](_0x1d4b78,_0xd83c('0xe8'));};AGIVertices[_0xd83c('0x11')][_0xd83c('0xe9')]=function(_0x47d7de){logger[_0xd83c('0x2b')](util[_0xd83c('0x54')](_0xd83c('0xea'),_0x47d7de[_0xd83c('0x35')]));if(!this[_0xd83c('0x85')](_0x47d7de['dialogflowV2_project_id'])){return this[_0xd83c('0xe')]['noop'](_0xd83c('0xeb'));}if(!this[_0xd83c('0x85')](_0x47d7de[_0xd83c('0x7d')])){return this['channel'][_0xd83c('0xa7')](_0xd83c('0xec'));}if(!this[_0xd83c('0x85')](_0x47d7de[_0xd83c('0x7e')])){return this[_0xd83c('0xe')][_0xd83c('0xa7')]('no\x20private_key\x20configured');}if(!this['isConfigured'](_0x47d7de[_0xd83c('0x7f')])){return this[_0xd83c('0xe')][_0xd83c('0xa7')](_0xd83c('0xed'));}if(!this[_0xd83c('0x85')](_0x47d7de[_0xd83c('0x5d')])){return this[_0xd83c('0xe')]['noop'](_0xd83c('0xc0'));}this[_0xd83c('0xe')][_0xd83c('0xee')]=!![];this[_0xd83c('0x33')](_0x47d7de);this[_0xd83c('0x41')](_0x47d7de[_0xd83c('0x5d')],'in','','');this[_0xd83c('0xe')][_0xd83c('0xa7')](util[_0xd83c('0x54')]('Trying\x20DialogflowV2:\x20%s',_0x47d7de['text']));var _0x302c83=this[_0xd83c('0x7b')][_0xd83c('0x6e')](this,_0x47d7de);if(_0x302c83){for(var _0x3995a4 in _0x302c83){if(_0x302c83[_0xd83c('0x96')](_0x3995a4)){if(_0x3995a4!=='providerResponse'){this[_0xd83c('0xe')][_0xd83c('0xa5')](util[_0xd83c('0x54')](_0xd83c('0xe3'),_0x3995a4['toUpperCase']()),_0x302c83[_0x3995a4]);}}}this[_0xd83c('0x41')](_0x302c83[_0xd83c('0xe5')],_0xd83c('0xe6'),'dialogflowV2',_0x302c83[_0xd83c('0xef')]);return this[_0xd83c('0xe')]['noop'](util[_0xd83c('0x54')](_0xd83c('0xf0'),_0x302c83[_0xd83c('0xe5')]));}return this[_0xd83c('0xe')][_0xd83c('0x29')](_0x47d7de,_0xd83c('0xf1'));};AGIVertices['prototype']['sesteknda']=function(_0x345b0f){logger[_0xd83c('0x2b')](util[_0xd83c('0x54')](_0xd83c('0xf2'),_0x345b0f[_0xd83c('0x35')]));if(!this['isConfigured'](_0x345b0f[_0xd83c('0xf3')])){return this[_0xd83c('0xe')]['noop'](_0xd83c('0xf4'));}if(!this[_0xd83c('0x85')](_0x345b0f[_0xd83c('0xf5')])){return this[_0xd83c('0xe')]['noop'](_0xd83c('0xf6'));}if(!this[_0xd83c('0x85')](_0x345b0f['password'])){return this[_0xd83c('0xe')][_0xd83c('0xa7')]('no\x20password\x20configured');}if(!this['isConfigured'](_0x345b0f[_0xd83c('0xf7')])){return this[_0xd83c('0xe')][_0xd83c('0xa7')](_0xd83c('0xc0'));}this['channel'][_0xd83c('0xee')]=!![];this[_0xd83c('0x33')](_0x345b0f);this[_0xd83c('0x41')](_0x345b0f['text'],'in','','');this['channel'][_0xd83c('0xa7')](util['format'](_0xd83c('0xf8'),_0x345b0f['text']));var _0x41aa25=this[_0xd83c('0x80')][_0xd83c('0x6e')](this,_0x345b0f);if(_0x41aa25){for(var _0x57a2c9 in _0x41aa25){if(_0x41aa25['hasOwnProperty'](_0x57a2c9)){this[_0xd83c('0xe')]['setVariable'](util[_0xd83c('0x54')](_0xd83c('0xf9'),_0x57a2c9[_0xd83c('0xe4')]()),_0x41aa25[_0x57a2c9]);}}this['createSquareMessage'](_0x41aa25[_0xd83c('0xe5')],_0xd83c('0xe6'),'sesteknda','');if(_0x41aa25[_0xd83c('0xfa')]){this[_0xd83c('0xe')][_0xd83c('0xa7')](util['format'](_0xd83c('0xfb'),_0x41aa25[_0xd83c('0xfa')]));var _0x4fe88f=this[_0xd83c('0xe')]['streamFile'](_0x41aa25[_0xd83c('0xfa')]);try{fs[_0xd83c('0xfc')](_0x41aa25[_0xd83c('0xfa')]+_0xd83c('0xfd'));}catch(_0x1e988f){logger[_0xd83c('0x29')](_0x1e988f);}return _0x4fe88f;}else{return this[_0xd83c('0xe')][_0xd83c('0xa7')](util[_0xd83c('0x54')](_0xd83c('0xfe'),_0x41aa25['speech']));}}return this[_0xd83c('0xe')][_0xd83c('0x29')](_0x345b0f,_0xd83c('0xff'));};AGIVertices[_0xd83c('0x11')][_0xd83c('0x100')]=function(_0xe299b6){logger[_0xd83c('0x2b')](util['format'](_0xd83c('0x101'),_0xe299b6[_0xd83c('0x35')]));return this[_0xd83c('0xe')][_0xd83c('0xa7')](_0xd83c('0x100'));};AGIVertices[_0xd83c('0x11')][_0xd83c('0x102')]=function(_0x5b9a8c){logger[_0xd83c('0x2b')](util[_0xd83c('0x54')](_0xd83c('0x103'),_0x5b9a8c[_0xd83c('0x35')]));var _0x310f00='';if(_0x5b9a8c[_0xd83c('0x104')]){if(!this[_0xd83c('0x85')](_0x5b9a8c['trunk_id'])){return this[_0xd83c('0xe')]['error'](_0x5b9a8c,'no\x20trunk\x20selected');}else{var _0x4500e5=parseInt(_0x5b9a8c[_0xd83c('0x104')],0xa);if(isNaN(_0x4500e5)){_0x310f00=_0x5b9a8c[_0xd83c('0x104')];}else{_0x310f00=this[_0xd83c('0x1e')]['sync'](this,_0x5b9a8c[_0xd83c('0x104')]);if(!_0x310f00){return this[_0xd83c('0xe')][_0xd83c('0x29')](_0x5b9a8c,_0xd83c('0x105'));}}}}else if(_0x5b9a8c[_0xd83c('0x106')]){_0x310f00=_0x5b9a8c[_0xd83c('0x106')];}else{return this[_0xd83c('0xe')][_0xd83c('0x29')](_0x5b9a8c,'no\x20trunk\x20selected');}var _0x4fbb69=this[_0xd83c('0xe')][_0xd83c('0x58')](_0xd83c('0xde'),[util['format']('SIP/%s/%s',_0x310f00,_0x5b9a8c[_0xd83c('0x47')]),_0x5b9a8c[_0xd83c('0x66')],_0x5b9a8c[_0xd83c('0xe0')],_0x5b9a8c['url']]);if(_0x4fbb69[_0xd83c('0xa3')]===-0x1){return _0x4fbb69;}return this[_0xd83c('0xe')][_0xd83c('0xa7')](util[_0xd83c('0x54')]('Executed\x20command\x20%s',_0xd83c('0xde')));};AGIVertices[_0xd83c('0x11')][_0xd83c('0x107')]=function(_0x214dfc){logger[_0xd83c('0x2b')](util[_0xd83c('0x54')](_0xd83c('0x108'),_0x214dfc[_0xd83c('0x35')]));return this['channel']['noop'](_0xd83c('0x107'));};AGIVertices[_0xd83c('0x11')]['getdigits']=function(_0x29a2c5){logger[_0xd83c('0x2b')](util[_0xd83c('0x54')](_0xd83c('0x109'),_0x29a2c5[_0xd83c('0x35')]));if(_0x29a2c5[_0xd83c('0x10a')]===0x0){return this['maxRetry'](_0x29a2c5);}_0x29a2c5['retry']-=0x1;if(!this[_0xd83c('0x85')](_0x29a2c5[_0xd83c('0x10b')])){return this[_0xd83c('0xe')][_0xd83c('0x29')](_0x29a2c5,_0xd83c('0x10c'));}var _0x576c82=this['getSound'][_0xd83c('0x6e')](this,_0x29a2c5[_0xd83c('0x10b')]);if(!_0x576c82){return this[_0xd83c('0xe')][_0xd83c('0x29')](_0x29a2c5,_0xd83c('0x10d'));}if(!this['isConfigured'](_0x29a2c5[_0xd83c('0xd2')])){return this['channel'][_0xd83c('0x29')](_0xd83c('0xd3'));}var _0x5f40e4=this[_0xd83c('0xe')][_0xd83c('0x10e')](_0x576c82,_0x29a2c5[_0xd83c('0x10f')],_0x29a2c5['maxdigit']);var _0xfcf5af=_0x5f40e4[_0xd83c('0xa3')]?_0x5f40e4[_0xd83c('0xa3')]['toString']():'';logger['info']('test',JSON[_0xd83c('0x73')](_0x5f40e4));if(_0x5f40e4['result']===-0x1){this[_0xd83c('0x33')][_0xd83c('0x6e')](this,_0x29a2c5,_0xfcf5af);return _0x5f40e4;}else if(_0x5f40e4[_0xd83c('0xa2')]===_0xd83c('0x66')){_0x5f40e4['result']=_0xfcf5af['length']>=parseInt(_0x29a2c5[_0xd83c('0x110')])?'x':'i';}else{_0x5f40e4['result']=_0xfcf5af['length']>=parseInt(_0x29a2c5[_0xd83c('0x110')])&&_0xfcf5af[_0xd83c('0x9c')]<=parseInt(_0x29a2c5['maxdigit'])?'x':'i';}var _0x2d63c2=this[_0xd83c('0x12')][_0xd83c('0x6e')](this,_0x29a2c5[_0xd83c('0xd2')]);if(!_0x2d63c2){return this[_0xd83c('0xe')][_0xd83c('0x29')](_0x29a2c5,_0xd83c('0xd4'));}this[_0xd83c('0xe')]['setVariable'](_0x2d63c2,_0xfcf5af);if(this[_0xd83c('0x85')](_0x29a2c5[_0xd83c('0x111')])){var _0x39fd31=parseInt(_0x29a2c5[_0xd83c('0x111')],0xa);var _0x5e8390=rs[_0xd83c('0x112')]({'charset':'*','length':_0x39fd31});var _0x58b6fd=_0xfcf5af[_0xd83c('0x9c')];if(_0x58b6fd>0x0){if(_0x58b6fd>_0x39fd31){this['createSquareDetailsReport'][_0xd83c('0x6e')](this,_0x29a2c5,_0x29a2c5[_0xd83c('0x113')]===_0xd83c('0x114')?_0x5e8390+_0xfcf5af[_0xd83c('0x115')](_0x39fd31):_0xfcf5af[_0xd83c('0x115')](0x0,_0x58b6fd-_0x39fd31)+_0x5e8390);}else{this['createSquareDetailsReport'][_0xd83c('0x6e')](this,_0x29a2c5,rs[_0xd83c('0x112')]({'charset':'*','length':_0x58b6fd}));}}else{this[_0xd83c('0x33')][_0xd83c('0x6e')](this,_0x29a2c5,'');}}else{this[_0xd83c('0x33')][_0xd83c('0x6e')](this,_0x29a2c5,_0xfcf5af);}return _0x5f40e4;};AGIVertices[_0xd83c('0x11')][_0xd83c('0x116')]=function(_0x4bfed1){logger[_0xd83c('0x2b')](util['format'](_0xd83c('0x117'),_0x4bfed1[_0xd83c('0x35')]));return this[_0xd83c('0xd')](_0x4bfed1);};AGIVertices['prototype'][_0xd83c('0x118')]=function(_0x629e2b){logger['info'](util[_0xd83c('0x54')](_0xd83c('0x119'),_0x629e2b[_0xd83c('0x35')]));this[_0xd83c('0x33')][_0xd83c('0x6e')](this,_0x629e2b,_0x629e2b[_0xd83c('0x11a')]);return this[_0xd83c('0xe')][_0xd83c('0xa7')](util[_0xd83c('0x54')]('GOAL\x20%s',_0x629e2b[_0xd83c('0x11a')]));};AGIVertices[_0xd83c('0x11')][_0xd83c('0x11b')]=function(_0x2e6c72){logger[_0xd83c('0x2b')](util['format'](_0xd83c('0x11c'),_0x2e6c72[_0xd83c('0x35')]));if(!this['isConfigured'](_0x2e6c72[_0xd83c('0x11d')])||!this['isConfigured'](_0x2e6c72[_0xd83c('0x88')])){return this[_0xd83c('0xe')][_0xd83c('0xa7')](_0xd83c('0x11e'));}if(!this[_0xd83c('0x85')](_0x2e6c72[_0xd83c('0x5d')])){return this[_0xd83c('0xe')]['noop']('no\x20text\x20configured');}this[_0xd83c('0xe')][_0xd83c('0xa7')](util[_0xd83c('0x54')]('Trying\x20aws\x20Polly\x20%s',_0x2e6c72[_0xd83c('0x5d')]));var _0xa9f18f=this[_0xd83c('0x87')][_0xd83c('0x6e')](this,_0x2e6c72);if(_0xa9f18f){this[_0xd83c('0xe')][_0xd83c('0xa7')](util[_0xd83c('0x54')]('aws\x20Polly\x20%s\x20file\x20created',_0xa9f18f));var _0x30c830=this['channel'][_0xd83c('0x11f')](_0xa9f18f);try{fs[_0xd83c('0xfc')](_0xa9f18f+_0xd83c('0xfd'));}catch(_0x479d08){logger['error'](_0x479d08);}return _0x30c830;}return this[_0xd83c('0xe')]['error'](_0x2e6c72,_0xd83c('0x120'));};AGIVertices[_0xd83c('0x11')][_0xd83c('0x121')]=function(_0x18ac3b){logger[_0xd83c('0x2b')](util['format'](_0xd83c('0x122'),_0x18ac3b[_0xd83c('0x35')]));if(!this[_0xd83c('0x85')](_0x18ac3b[_0xd83c('0x11d')])||!this['isConfigured'](_0x18ac3b[_0xd83c('0x88')])){return this['channel'][_0xd83c('0xa7')](_0xd83c('0x11e'));}if(!this[_0xd83c('0x85')](_0x18ac3b['aws_bot_name'])){return this[_0xd83c('0xe')][_0xd83c('0xa7')]('no\x20bot\x20name\x20configured');}if(!this[_0xd83c('0x85')](_0x18ac3b[_0xd83c('0x5d')])){return this[_0xd83c('0xe')][_0xd83c('0xa7')]('no\x20text\x20configured');}this[_0xd83c('0xe')][_0xd83c('0xee')]=!![];this[_0xd83c('0x33')](_0x18ac3b);this[_0xd83c('0x41')](_0x18ac3b[_0xd83c('0x5d')],'in','','');this[_0xd83c('0xe')][_0xd83c('0xa7')](util[_0xd83c('0x54')](_0xd83c('0x123'),_0x18ac3b[_0xd83c('0x5d')]));var _0x1aa631=this[_0xd83c('0x8d')][_0xd83c('0x6e')](this,_0x18ac3b);if(_0x1aa631){for(var _0xf8e181 in _0x1aa631){if(_0x1aa631[_0xd83c('0x96')](_0xf8e181)&&_[_0xd83c('0x97')](_0x1aa631[_0xf8e181])){this[_0xd83c('0xe')][_0xd83c('0xa5')](util['format'](_0xd83c('0x124'),_0xf8e181[_0xd83c('0xe4')]()),_0x1aa631[_0xf8e181]);}}if(_[_0xd83c('0x51')](_0x1aa631[_0xd83c('0x125')])){return this[_0xd83c('0xe')][_0xd83c('0xa7')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0xd83c('0x41')](_0x1aa631[_0xd83c('0x125')],'out',_0xd83c('0x126'),'');return this[_0xd83c('0xe')][_0xd83c('0xa7')](util[_0xd83c('0x54')]('Amazon\x20Lex\x20Result\x20%s',_0x1aa631[_0xd83c('0x125')]));}}return this[_0xd83c('0xe')][_0xd83c('0x29')](_0x18ac3b,_0xd83c('0x127'));};AGIVertices['prototype'][_0xd83c('0x128')]=function(_0x5e52be){logger[_0xd83c('0x2b')](util[_0xd83c('0x54')](_0xd83c('0x129'),_0x5e52be['label'],_0x5e52be[_0xd83c('0x66')]));if(!this['isConfigured'](_0x5e52be[_0xd83c('0x79')])){return this[_0xd83c('0xe')]['noop']('no\x20key\x20configured');}var _0x2934bb=_0xd83c('0x12a');var _0x1f164b=util['format'](_0xd83c('0x12b'),FILES_PATH,rs['generate'](0x4));var _0x451118=util[_0xd83c('0x54')]('%s.%s',_0x1f164b,_0x2934bb);var _0x576890=!![];if(_0x5e52be[_0xd83c('0x12c')]===_0xd83c('0x12d')){_0x576890=![];}var _0x237da3=this[_0xd83c('0xe')][_0xd83c('0x12e')](_0x1f164b,_0x2934bb,_0x5e52be['intKey'],_0x5e52be['timeout'],undefined,_0x576890);if(_0x237da3['result']!==-0x1){this[_0xd83c('0xe')][_0xd83c('0xa7')](util[_0xd83c('0x54')](_0xd83c('0x12f'),_0x451118));var _0x4a6dd8=this[_0xd83c('0x90')]['sync'](this,_0x5e52be,_0x451118);if(_0x4a6dd8){for(var _0x179b3f in _0x4a6dd8){if(_0x4a6dd8[_0xd83c('0x96')](_0x179b3f)){this[_0xd83c('0xe')]['setVariable'](util['format'](_0xd83c('0x130'),_0x179b3f[_0xd83c('0xe4')]()),_0x4a6dd8[_0x179b3f]);}}return this[_0xd83c('0xe')][_0xd83c('0xa7')](util['format']('GoogleASR\x20Result\x20%s',JSON[_0xd83c('0x73')](_0x4a6dd8)));}}return _0x237da3;};AGIVertices[_0xd83c('0x11')]['tildeasr']=function(_0x46a03b){logger[_0xd83c('0x2b')](util[_0xd83c('0x54')](_0xd83c('0x131'),_0x46a03b['label']));if(!this[_0xd83c('0x85')](_0x46a03b[_0xd83c('0x92')])){return this[_0xd83c('0xe')][_0xd83c('0xa7')](_0xd83c('0x132'));}if(!this['isConfigured'](_0x46a03b['appsecret'])){return this[_0xd83c('0xe')][_0xd83c('0xa7')](_0xd83c('0x133'));}var _0x2e544c=_0xd83c('0x12a');var _0x3ae28d=util[_0xd83c('0x54')](_0xd83c('0x12b'),FILES_PATH,rs['generate'](0x4));var _0x3d45f4=util[_0xd83c('0x54')](_0xd83c('0x9f'),_0x3ae28d,_0x2e544c);var _0x1f16c0=!![];if(_0x46a03b[_0xd83c('0x12c')]===_0xd83c('0x12d')){_0x1f16c0=![];}var _0x34f1cd=this[_0xd83c('0xe')][_0xd83c('0x12e')](_0x3ae28d,_0x2e544c,_0x46a03b[_0xd83c('0x134')],_0x46a03b[_0xd83c('0x66')],undefined,_0x1f16c0);if(_0x34f1cd[_0xd83c('0xa3')]!==-0x1){this['channel']['noop'](util[_0xd83c('0x54')]('tilde\x20%s\x20file\x20created',_0x3d45f4));var _0x4010e8=this[_0xd83c('0x91')]['sync'](this,_0x46a03b,_0x3d45f4);if(_0x4010e8){for(var _0x1536e3 in _0x4010e8){if(_0x4010e8[_0xd83c('0x96')](_0x1536e3)){this[_0xd83c('0xe')][_0xd83c('0xa5')](util['format']('TILDE_ASR_%s',_0x1536e3['toUpperCase']()),_0x4010e8[_0x1536e3]);}}return this[_0xd83c('0xe')][_0xd83c('0xa7')](util['format'](_0xd83c('0x135'),JSON[_0xd83c('0x73')](_0x4010e8)));}}return _0x34f1cd;};AGIVertices[_0xd83c('0x11')]['gotoc']=function(_0x375909){logger[_0xd83c('0x2b')](util[_0xd83c('0x54')](_0xd83c('0x136'),_0x375909[_0xd83c('0x35')]));return this[_0xd83c('0xe')][_0xd83c('0x137')](_0x375909[_0xd83c('0x3b')],_0x375909['extension'],_0x375909[_0xd83c('0x3d')]);};AGIVertices[_0xd83c('0x11')][_0xd83c('0x138')]=function(_0x12b14e){logger['info'](util[_0xd83c('0x54')](_0xd83c('0x139'),_0x12b14e[_0xd83c('0x35')]));if(!this[_0xd83c('0x85')](_0x12b14e[_0xd83c('0x13a')])){return this[_0xd83c('0xe')][_0xd83c('0x29')](_0x12b14e,_0xd83c('0x13b'));}try{var _0x53394a=eval(_0x12b14e[_0xd83c('0x13a')])?'true':_0xd83c('0x13c');this['channel'][_0xd83c('0xa7')](util[_0xd83c('0x54')](_0xd83c('0x13d'),_0x12b14e['condition'],_0x53394a));return{'code':0xc8,'result':_0x53394a};}catch(_0x1b3767){return{'code':0xc8,'result':'false'};}};AGIVertices[_0xd83c('0x11')][_0xd83c('0x13e')]=function(_0xfcb5c5){logger[_0xd83c('0x2b')](util['format'](_0xd83c('0x13f'),_0xfcb5c5[_0xd83c('0x35')]));if(!this[_0xd83c('0x85')](_0xfcb5c5['interval_id'])){return this[_0xd83c('0xe')][_0xd83c('0x29')](_0xfcb5c5,_0xd83c('0x140'));}var _0x194352=this['getIntervals'][_0xd83c('0x6e')](this,_0xfcb5c5[_0xd83c('0x141')]);if(!_0x194352){return this[_0xd83c('0xe')][_0xd83c('0x29')](_0xfcb5c5,_0xd83c('0x142'));}for(var _0x15697c=0x0;_0x15697c<_0x194352[_0xd83c('0x9c')];_0x15697c+=0x1){var _0x391186=this['channel']['getVariable'](util[_0xd83c('0x54')](_0xd83c('0x143'),_0x194352[_0x15697c]));if(_0x391186['result']===-0x1){return _0x391186;}logger['info'](util['format'](_0xd83c('0x144'),_0x194352[_0x15697c],_0x391186[_0xd83c('0xa2')]));if(_0x391186[_0xd83c('0xa2')]===_0xd83c('0x145')){logger[_0xd83c('0x2b')](util[_0xd83c('0x54')](_0xd83c('0x144'),_0x194352[_0x15697c],_0xd83c('0x145')));this['channel'][_0xd83c('0xa7')](util[_0xd83c('0x54')](_0xd83c('0x144'),_0x194352[_0x15697c],_0xd83c('0x145')));return{'code':0xc8,'result':'true'};}else{logger['info'](util[_0xd83c('0x54')](_0xd83c('0x144'),_0x194352[_0x15697c],_0xd83c('0x13c')));this['channel'][_0xd83c('0xa7')](util[_0xd83c('0x54')]('IFTIME\x20%s\x20%s',_0x194352[_0x15697c],'false'));}}return{'code':0xc8,'result':_0xd83c('0x13c')};};AGIVertices[_0xd83c('0x11')][_0xd83c('0x146')]=function(_0xc41e6b){logger[_0xd83c('0x2b')](util[_0xd83c('0x54')](_0xd83c('0x147'),_0xc41e6b[_0xd83c('0x35')]));return this[_0xd83c('0xe')][_0xd83c('0x146')]();};AGIVertices[_0xd83c('0x11')]['ispeechasr']=function(_0x4725d6){logger['info'](util['format'](_0xd83c('0x148'),_0x4725d6['label']));if(!this[_0xd83c('0x85')](_0x4725d6['key'])){return this[_0xd83c('0xe')][_0xd83c('0xa7')]('no\x20key\x20configured');}var _0x32e53f=_0xd83c('0x12a');var _0x1f9e2e=util[_0xd83c('0x54')]('%s/recordings/%s',FILES_PATH,rs[_0xd83c('0x112')](0x4));var _0x40c2fe=util['format'](_0xd83c('0x9f'),_0x1f9e2e,_0x32e53f);var _0x15ecd7=!![];if(_0x4725d6[_0xd83c('0x12c')]==='NOBEEP'){_0x15ecd7=![];}var _0x1a0e22=this[_0xd83c('0xe')][_0xd83c('0x12e')](_0x1f9e2e,_0x32e53f,_0x4725d6[_0xd83c('0x134')],_0x4725d6[_0xd83c('0x66')],undefined,_0x15ecd7);if(_0x1a0e22['result']!==-0x1){this[_0xd83c('0xe')][_0xd83c('0xa7')](util[_0xd83c('0x54')](_0xd83c('0x149'),_0x40c2fe));var _0x4269a6=this[_0xd83c('0x84')]['sync'](this,_0x4725d6,_0x40c2fe);if(_0x4269a6){for(var _0x491311 in _0x4269a6){if(_0x4269a6[_0xd83c('0x96')](_0x491311)){this['channel'][_0xd83c('0xa5')](util[_0xd83c('0x54')](_0xd83c('0x14a'),_0x491311[_0xd83c('0xe4')]()),_0x4269a6[_0x491311]);}}return this[_0xd83c('0xe')]['noop'](util[_0xd83c('0x54')](_0xd83c('0x14b'),JSON['stringify'](_0x4269a6)));}}return _0x1a0e22;};AGIVertices['prototype'][_0xd83c('0x14c')]=function(_0x28a441){logger[_0xd83c('0x2b')](util[_0xd83c('0x54')](_0xd83c('0x14d'),_0x28a441[_0xd83c('0x35')]));if(!this['isConfigured'](_0x28a441[_0xd83c('0x79')])){return this[_0xd83c('0xe')][_0xd83c('0xa7')](_0xd83c('0xe2'));}if(!this[_0xd83c('0x85')](_0x28a441[_0xd83c('0x5d')])){return this[_0xd83c('0xe')][_0xd83c('0xa7')](_0xd83c('0xc0'));}this[_0xd83c('0xe')][_0xd83c('0xa7')](util[_0xd83c('0x54')]('Trying\x20ispeech\x20TTS\x20%s',_0x28a441['text']));var _0x65e443=this[_0xd83c('0x81')][_0xd83c('0x6e')](this,_0x28a441);if(_0x65e443){this[_0xd83c('0xe')][_0xd83c('0xa7')](util[_0xd83c('0x54')](_0xd83c('0x149'),_0x65e443));var _0x784b74=this[_0xd83c('0xe')][_0xd83c('0x11f')](_0x65e443,_0x28a441[_0xd83c('0x134')]);try{fs[_0xd83c('0xfc')](_0x65e443+_0xd83c('0xfd'));}catch(_0x1f6898){logger[_0xd83c('0x29')](_0x1f6898);}return _0x784b74;}return this[_0xd83c('0xe')][_0xd83c('0x29')](_0x28a441,_0xd83c('0x14e'));};AGIVertices[_0xd83c('0x11')][_0xd83c('0x14f')]=function(_0x2efadf){logger[_0xd83c('0x2b')](util['format'](_0xd83c('0x150'),_0x2efadf[_0xd83c('0x35')]));if(!this[_0xd83c('0x85')](_0x2efadf['findBy'])){return this['channel'][_0xd83c('0x29')](_0x2efadf,'no\x20find\x20by\x20configured');}logger[_0xd83c('0x2b')](util[_0xd83c('0x54')](_0xd83c('0x151'),this[_0xd83c('0xe')][_0xd83c('0x38')],_0x2efadf['findBy']));var _0xd465f1=this[_0xd83c('0x52')][_0xd83c('0x6e')](this,_0x2efadf[_0xd83c('0x152')]);if(_0xd465f1){logger[_0xd83c('0x2b')](util[_0xd83c('0x54')](_0xd83c('0x153'),this[_0xd83c('0xe')][_0xd83c('0x38')],_0x2efadf[_0xd83c('0x152')]));this['channel'][_0xd83c('0xa7')](util['format'](_0xd83c('0x153'),this[_0xd83c('0xe')]['callerid'],_0x2efadf[_0xd83c('0x152')]));return{'code':0xc8,'result':_0xd83c('0x154')};}else{logger[_0xd83c('0x2b')](util[_0xd83c('0x54')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xd83c('0xe')][_0xd83c('0x38')],_0x2efadf[_0xd83c('0x152')]));this[_0xd83c('0xe')][_0xd83c('0xa7')](util[_0xd83c('0x54')](_0xd83c('0x155'),this[_0xd83c('0xe')][_0xd83c('0x38')],_0x2efadf[_0xd83c('0x152')]));return{'code':0xc8,'result':_0xd83c('0x156')};}};AGIVertices['prototype'][_0xd83c('0x157')]=function(_0x1b84c0){logger['info'](util[_0xd83c('0x54')](_0xd83c('0x158'),_0x1b84c0[_0xd83c('0x35')]));if(!this[_0xd83c('0x85')](_0x1b84c0[_0xd83c('0x152')])){return this['channel'][_0xd83c('0x29')](_0x1b84c0,'no\x20find\x20by\x20configured');}logger[_0xd83c('0x2b')](util[_0xd83c('0x54')](_0xd83c('0x151'),this['channel']['callerid'],_0x1b84c0[_0xd83c('0x152')]));var _0x12a8f0=this[_0xd83c('0x159')][_0xd83c('0x6e')](this,_0x1b84c0[_0xd83c('0x152')]);if(_0x12a8f0){logger['info'](util['format'](_0xd83c('0x153'),this[_0xd83c('0xe')][_0xd83c('0x38')],_0x1b84c0[_0xd83c('0x152')]));this[_0xd83c('0xe')][_0xd83c('0xa7')](util[_0xd83c('0x54')](_0xd83c('0x153'),this['channel']['callerid'],_0x1b84c0['findBy']));return{'code':0xc8,'result':_0xd83c('0x154')};}else{logger[_0xd83c('0x2b')](util[_0xd83c('0x54')](_0xd83c('0x155'),this[_0xd83c('0xe')]['callerid'],_0x1b84c0['findBy']));this[_0xd83c('0xe')]['noop'](util[_0xd83c('0x54')](_0xd83c('0x155'),this['channel'][_0xd83c('0x38')],_0x1b84c0['findBy']));return{'code':0xc8,'result':_0xd83c('0x156')};}};AGIVertices[_0xd83c('0x11')][_0xd83c('0x15a')]=function(_0x19fea7){logger['info'](util['format'](_0xd83c('0x15b'),_0x19fea7[_0xd83c('0x35')]));if(!this[_0xd83c('0x85')](_0x19fea7[_0xd83c('0x15c')])){return this[_0xd83c('0xe')]['error'](_0x19fea7,'no\x20operation\x20configured');}this['channel'][_0xd83c('0xa7')](util[_0xd83c('0x54')]('math\x20%s',_0x19fea7[_0xd83c('0x15c')]));var _0x540d42=eval(_0x19fea7[_0xd83c('0x15c')]);if(!this[_0xd83c('0x85')](_0x19fea7[_0xd83c('0xd2')])){return this[_0xd83c('0xe')][_0xd83c('0xa7')](_0xd83c('0xd3'));}var _0x4f9da1=this[_0xd83c('0x12')][_0xd83c('0x6e')](this,_0x19fea7[_0xd83c('0xd2')]);if(!_0x4f9da1){return this[_0xd83c('0xe')][_0xd83c('0x29')](_0x19fea7,_0xd83c('0xd4'));}if(_[_0xd83c('0x9b')](_0x540d42)){var _0x3808a4=this;_0x540d42['forEach'](function(_0x4eb62b,_0x120a57){_0x3808a4[_0xd83c('0xe')]['setVariable'](util[_0xd83c('0x54')](_0xd83c('0x15d'),_0x4f9da1,_0x120a57),_0x4eb62b);});return this[_0xd83c('0xe')][_0xd83c('0xa7')](util['format'](_0xd83c('0x15e'),_0x4f9da1));}else{return this[_0xd83c('0xe')][_0xd83c('0xa5')](_0x4f9da1,_0x540d42);}};AGIVertices['prototype'][_0xd83c('0x15f')]=function(_0xf3477e){logger[_0xd83c('0x2b')](util['format'](_0xd83c('0x160'),_0xf3477e[_0xd83c('0x35')]));if(_0xf3477e[_0xd83c('0x10a')]===0x0){return this['maxRetry'](_0xf3477e);}_0xf3477e[_0xd83c('0x10a')]-=0x1;if(!this[_0xd83c('0x85')](_0xf3477e[_0xd83c('0x10b')])){return this[_0xd83c('0xe')][_0xd83c('0x29')](_0xf3477e,_0xd83c('0x10c'));}var _0x25e532=this[_0xd83c('0x20')]['sync'](this,_0xf3477e[_0xd83c('0x10b')]);if(!_0x25e532){return this[_0xd83c('0xe')][_0xd83c('0x29')](_0xf3477e,_0xd83c('0x10d'));}var _0x4e0340=this[_0xd83c('0xe')][_0xd83c('0x10e')](_0x25e532,_0xf3477e['response'],_0xf3477e[_0xd83c('0x161')]);var _0x35783a=_0x4e0340['result'];if(_0x4e0340['result']===-0x1){this['createSquareDetailsReport'][_0xd83c('0x6e')](this,_0xf3477e,'-1');return _0x4e0340;}else if(_0x4e0340[_0xd83c('0xa2')]===_0xd83c('0x66')){_0x4e0340[_0xd83c('0xa3')]=_0x4e0340[_0xd83c('0xa3')][_0xd83c('0x9c')]>0x0?_0x4e0340['result']:'t';}else if(_[_0xd83c('0x43')](_0x4e0340[_0xd83c('0xa3')])){_0x4e0340[_0xd83c('0xa3')]='#';_0x35783a='#';}if(!this[_0xd83c('0x85')](_0xf3477e[_0xd83c('0xd2')])){this['channel'][_0xd83c('0xa7')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x19a0f9=this[_0xd83c('0x12')]['sync'](this,_0xf3477e[_0xd83c('0xd2')]);if(!_0x19a0f9){return this[_0xd83c('0xe')][_0xd83c('0x29')](_0xf3477e,_0xd83c('0xd4'));}this[_0xd83c('0xe')][_0xd83c('0xa5')](_0x19a0f9,_0x35783a);}this[_0xd83c('0x33')][_0xd83c('0x6e')](this,_0xf3477e,_0x35783a);return _0x4e0340;};AGIVertices[_0xd83c('0x11')][_0xd83c('0xa7')]=function(_0x22a95c){logger['info'](util['format']('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x22a95c[_0xd83c('0x35')]));return this[_0xd83c('0xe')][_0xd83c('0xa7')](_0x22a95c[_0xd83c('0x162')]||_0x22a95c[_0xd83c('0x35')]);};AGIVertices['prototype'][_0xd83c('0x163')]=function(_0x5ea546){logger[_0xd83c('0x2b')](util[_0xd83c('0x54')](_0xd83c('0x164'),_0x5ea546[_0xd83c('0x35')]));if(!this[_0xd83c('0x85')](_0x5ea546[_0xd83c('0x152')])){return this['channel'][_0xd83c('0x29')](_0x5ea546,_0xd83c('0x165'));}logger[_0xd83c('0x2b')](util['format'](_0xd83c('0x151'),this['channel'][_0xd83c('0x38')],_0x5ea546['findBy']));var _0x1deed8=this[_0xd83c('0x4c')]['sync'](this,_0x5ea546[_0xd83c('0x166')]);var _0x4d5188=this[_0xd83c('0x4e')][_0xd83c('0x6e')](this,_0x5ea546[_0xd83c('0x152')],_0x1deed8);if(_0x4d5188){logger[_0xd83c('0x2b')](util['format'](_0xd83c('0x153'),this[_0xd83c('0xe')][_0xd83c('0x38')],_0x5ea546[_0xd83c('0x152')]));this[_0xd83c('0xe')]['noop'](util[_0xd83c('0x54')](_0xd83c('0x153'),this[_0xd83c('0xe')][_0xd83c('0x38')],_0x5ea546[_0xd83c('0x152')]));return{'code':0xc8,'result':'success'};}else{logger[_0xd83c('0x2b')](util[_0xd83c('0x54')](_0xd83c('0x155'),this[_0xd83c('0xe')]['callerid'],_0x5ea546[_0xd83c('0x152')]));this[_0xd83c('0xe')][_0xd83c('0xa7')](util[_0xd83c('0x54')](_0xd83c('0x153'),this[_0xd83c('0xe')][_0xd83c('0x38')],_0x5ea546[_0xd83c('0x152')]));return{'code':0xc8,'result':_0xd83c('0x156')};}};AGIVertices[_0xd83c('0x11')][_0xd83c('0x167')]=function(_0x522c84){logger['info'](util['format']('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x522c84[_0xd83c('0x35')]));if(!this[_0xd83c('0x85')](_0x522c84['file_id'])){return this['channel'][_0xd83c('0x29')](_0x522c84,_0xd83c('0x10c'));}var _0x1ba480=this[_0xd83c('0x20')][_0xd83c('0x6e')](this,_0x522c84['file_id']);if(!_0x1ba480){return this['channel']['error'](_0x522c84,_0xd83c('0x10d'));}var _0x2ab7f6=this[_0xd83c('0xe')][_0xd83c('0x58')](_0xd83c('0x168'),[_0x1ba480,_0x522c84[_0xd83c('0xe0')]]);if(_0x2ab7f6[_0xd83c('0xa3')]===-0x1){return _0x2ab7f6;}return this[_0xd83c('0xe')][_0xd83c('0xa7')](util[_0xd83c('0x54')](_0xd83c('0xbe'),_0xd83c('0x168'),_0x1ba480));};AGIVertices[_0xd83c('0x11')][_0xd83c('0x169')]=function(_0x238a89){logger[_0xd83c('0x2b')](util['format'](_0xd83c('0x16a'),_0x238a89[_0xd83c('0x35')]));if(!this['isConfigured'](_0x238a89[_0xd83c('0x16b')])){return this[_0xd83c('0xe')][_0xd83c('0x29')](_0x238a89,_0xd83c('0x16c'));}var _0x4cf2ca='';var _0x4d28a9=parseInt(_0x238a89[_0xd83c('0x16b')],0xa);if(isNaN(_0x4d28a9)){_0x4cf2ca=_0x238a89[_0xd83c('0x16b')];}else{_0x4cf2ca=this[_0xd83c('0x15')][_0xd83c('0x6e')](this,_0x238a89['queue_id']);if(!_0x4cf2ca){return this[_0xd83c('0xe')][_0xd83c('0x29')](_0x238a89,'no\x20queue\x20found');}}var _0x527c91='';if(this[_0xd83c('0x85')](_0x238a89[_0xd83c('0x10b')])){var _0x3a1ed5=this['getSound']['sync'](this,_0x238a89['file_id']);if(_0x3a1ed5){_0x527c91=_0x3a1ed5;}}this['createSquareDetailsReport']['sync'](this,_0x238a89,_0x4cf2ca);if(_0x238a89[_0xd83c('0xe0')]['indexOf']('x')<0x0){_0x238a89[_0xd83c('0xe0')]+='x';}if(_0x238a89['opts'][_0xd83c('0x16d')]('X')<0x0){_0x238a89[_0xd83c('0xe0')]+='X';}this[_0xd83c('0xe')][_0xd83c('0xa5')](_0xd83c('0x16e'),_0x4cf2ca?_0x4cf2ca[_0xd83c('0x16f')]():'');var _0xec34b6=this[_0xd83c('0xe')]['exec'](_0xd83c('0x170'),[_0x4cf2ca,_0x238a89[_0xd83c('0xe0')],_0x238a89['url'],_0x527c91,_0x238a89[_0xd83c('0x66')],_0x238a89['agi'],_0x238a89[_0xd83c('0x171')],_0x238a89['gosub'],'',_0x238a89[_0xd83c('0x172')]]);if(_0xec34b6[_0xd83c('0xa3')]===-0x1){return _0xec34b6;}return this[_0xd83c('0xe')][_0xd83c('0xa7')](util['format'](_0xd83c('0xbe'),_0xd83c('0x170'),_0x4cf2ca));};AGIVertices['prototype'][_0xd83c('0x173')]=function(_0x53a565){logger[_0xd83c('0x2b')](util[_0xd83c('0x54')](_0xd83c('0x174'),_0x53a565[_0xd83c('0x35')]));var _0x3f6dfd=_0x53a565[_0xd83c('0x175')]||'wav';var _0x8c8e23=util['format'](_0xd83c('0x176'),this[_0xd83c('0xe')]['uniqueid'],rs[_0xd83c('0x112')](0x5));var _0x2ace92=util[_0xd83c('0x54')](_0xd83c('0x177'),FILES_PATH,_0x8c8e23,_0x3f6dfd);var _0x5cfed5=util[_0xd83c('0x54')](_0xd83c('0x12b'),FILES_PATH,_0x8c8e23);this[_0xd83c('0x39')]['sync'](this,_0x53a565,_0x8c8e23,_0x2ace92);this[_0xd83c('0xe')]['setVariable'](_0xd83c('0x178'),_0x8c8e23);logger['info'](_0xd83c('0x179'),_0x5cfed5,_0x3f6dfd,_0x53a565[_0xd83c('0x17a')],_0x53a565['timeout']);return this['channel'][_0xd83c('0x12e')](_0x5cfed5,_0x3f6dfd,_0x53a565[_0xd83c('0x17a')],_0x53a565[_0xd83c('0x66')],undefined,!![]);};AGIVertices[_0xd83c('0x11')][_0xd83c('0x17b')]=function(_0x53280d){logger[_0xd83c('0x2b')](util[_0xd83c('0x54')](_0xd83c('0x17c'),_0x53280d['label']));if(!this[_0xd83c('0x85')](_0x53280d[_0xd83c('0x71')])){return this[_0xd83c('0xe')][_0xd83c('0xa7')](_0xd83c('0x17d'));}var _0x1fe5a7=this[_0xd83c('0x64')][_0xd83c('0x6e')](this,_0x53280d);logger[_0xd83c('0x2b')](util['format'](_0xd83c('0x17e'),util[_0xd83c('0x17f')](_0x1fe5a7,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x53280d['variable_id'])){return this[_0xd83c('0xe')][_0xd83c('0xa7')](_0xd83c('0x180'));}var _0x51bc89=this['getVariable'][_0xd83c('0x6e')](this,_0x53280d[_0xd83c('0xd2')]);if(!_0x51bc89){return this[_0xd83c('0xe')][_0xd83c('0x29')](_0x53280d,'no\x20variable\x20found');}this['channel'][_0xd83c('0xa5')](util['format']('%s_STATUS_CODE',_0x51bc89),_0x1fe5a7['statusCode']?_0x1fe5a7['statusCode']:_0xd83c('0x181'));this[_0xd83c('0xe')]['setVariable'](util['format'](_0xd83c('0x182'),_0x51bc89),_0x1fe5a7[_0xd83c('0x76')]?_0x1fe5a7[_0xd83c('0x76')]:'OK');if(_0x1fe5a7[_0xd83c('0x74')]){try{this[_0xd83c('0x9e')](_0x1fe5a7[_0xd83c('0x74')],_0x51bc89);}catch(_0x33a6f6){logger[_0xd83c('0x29')](util[_0xd83c('0x54')](_0xd83c('0x183'),_0x51bc89));}}return this[_0xd83c('0xe')]['noop'](util[_0xd83c('0x54')](_0xd83c('0x184'),_0x51bc89));};AGIVertices['prototype'][_0xd83c('0x185')]=function(_0x221b95){logger[_0xd83c('0x2b')](util[_0xd83c('0x54')](_0xd83c('0x186'),_0x221b95[_0xd83c('0x35')]));return this[_0xd83c('0xe')][_0xd83c('0x187')](_0x221b95[_0xd83c('0x188')][_0xd83c('0x59')](/\s+/g,''),_0x221b95[_0xd83c('0x17a')]);};AGIVertices[_0xd83c('0x11')][_0xd83c('0x189')]=function(_0x5a7c8a){logger['info'](util[_0xd83c('0x54')](_0xd83c('0x18a'),_0x5a7c8a[_0xd83c('0x35')]));return this['channel'][_0xd83c('0x18b')](_0x5a7c8a[_0xd83c('0x67')]['replace'](/\s+/g,''),_0x5a7c8a[_0xd83c('0x17a')]);};AGIVertices[_0xd83c('0x11')][_0xd83c('0x18c')]=function(_0x558898){logger['info'](util[_0xd83c('0x54')](_0xd83c('0x18d'),_0x558898[_0xd83c('0x35')]));return this['channel'][_0xd83c('0x18e')](_0x558898[_0xd83c('0x5d')],_0x558898[_0xd83c('0x17a')]);};AGIVertices['prototype']['sendMail']=function(_0x60308d){logger[_0xd83c('0x2b')](util[_0xd83c('0x54')](_0xd83c('0x18f'),_0x60308d[_0xd83c('0x35')]));if(!this['isConfigured'](_0x60308d[_0xd83c('0x190')])){return this['channel'][_0xd83c('0xa7')](_0xd83c('0x191'));}var _0x577905=this['getMailAccount'][_0xd83c('0x6e')](this,_0x60308d[_0xd83c('0x190')]);if(!_0x577905||!_0x577905[_0xd83c('0x192')]){return this['channel'][_0xd83c('0x29')](_0x60308d,_0xd83c('0x193'));}var _0x522d83={'from':util[_0xd83c('0x54')](_0xd83c('0x194'),_0x577905[_0xd83c('0x13')],_0x577905['email']||_0x577905[_0xd83c('0x192')]['user']),'to':_0x60308d['to']||'','cc':_0x60308d['cc']||'','bcc':_0x60308d[_0xd83c('0x195')]||'','subject':_0x60308d[_0xd83c('0x196')],'html':_0x60308d[_0xd83c('0x5d')],'text':_0x60308d[_0xd83c('0x5d')]};if(this[_0xd83c('0x85')](_0x60308d[_0xd83c('0x197')])){}logger[_0xd83c('0xd9')]('sendMail\x20message',JSON[_0xd83c('0x73')](_0x522d83));this['createSquareDetailsReport'][_0xd83c('0x6e')](this,_0x60308d,_0x60308d[_0xd83c('0x190')]);this[_0xd83c('0xe')][_0xd83c('0xa7')](util['format'](_0xd83c('0x198'),_0x577905[_0xd83c('0x13')]));this[_0xd83c('0x23')]['sync'](this,_0x577905['smtpOptions'],_0x522d83);return this[_0xd83c('0xe')]['noop'](_0xd83c('0x199'));};AGIVertices[_0xd83c('0x11')][_0xd83c('0x19a')]=function(_0x891556){logger[_0xd83c('0x2b')](util[_0xd83c('0x54')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x891556[_0xd83c('0x35')]));return this[_0xd83c('0xe')]['noop']('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0xd83c('0x11')][_0xd83c('0x19b')]=function(_0x28f3ab){logger['info'](util[_0xd83c('0x54')](_0xd83c('0x19c'),_0x28f3ab[_0xd83c('0x35')]));if(!this['isConfigured'](_0x28f3ab['sms_account_id'])){return this['channel'][_0xd83c('0xa7')]('no\x20sms\x20account\x20configured');}var _0x45b78f=this[_0xd83c('0x31')]['sync'](this,_0x28f3ab['sms_account_id']);if(!_0x45b78f){return this[_0xd83c('0xe')][_0xd83c('0x29')](_0x28f3ab,'no\x20sms\x20account\x20found');}var _0x32a250={'body':_0x28f3ab[_0xd83c('0x19d')],'phone':_0x28f3ab['to']||'','SmsAccountId':_0x45b78f['id']};logger['debug']('sendSMS\x20message',JSON[_0xd83c('0x73')](_0x32a250));this['createSquareDetailsReport']['sync'](this,_0x28f3ab,_0x28f3ab['sms_account_id']);this[_0xd83c('0xe')]['noop'](util[_0xd83c('0x54')](_0xd83c('0x19e'),_0x45b78f[_0xd83c('0x13')]));this[_0xd83c('0x32')]['sync'](this,_0x32a250);return this[_0xd83c('0xe')][_0xd83c('0xa7')](_0xd83c('0x19f'));};AGIVertices['prototype'][_0xd83c('0x1a0')]=function(_0x259878){logger[_0xd83c('0x2b')](util[_0xd83c('0x54')](_0xd83c('0x1a1'),_0x259878[_0xd83c('0x35')]));if(!this[_0xd83c('0x85')](_0x259878['variable_id'])){return this[_0xd83c('0xe')][_0xd83c('0x29')](_0x259878,'no\x20variable\x20selected');}var _0x19df06=this[_0xd83c('0x12')]['sync'](this,_0x259878[_0xd83c('0xd2')]);if(!_0x19df06){return this[_0xd83c('0xe')][_0xd83c('0x29')](_0x259878,_0xd83c('0xd4'));}return this[_0xd83c('0xe')][_0xd83c('0xa5')](_0x19df06,_0x259878['variable_value']);};AGIVertices[_0xd83c('0x11')][_0xd83c('0x1a2')]=function(_0x1cacbe){logger[_0xd83c('0x2b')](util[_0xd83c('0x54')](_0xd83c('0x1a3'),_0x1cacbe[_0xd83c('0x35')]));this[_0xd83c('0xe')][_0xd83c('0xa7')](_0xd83c('0x1a4'));if(_0x1cacbe['answer']===_0xd83c('0x1a5')){this[_0xd83c('0xe')][_0xd83c('0xa7')](_0xd83c('0x1a6'));return this[_0xd83c('0xe')]['answer']();}return this['channel']['noop'](_0xd83c('0x1a7'));};AGIVertices[_0xd83c('0x11')]['subproject']=function(_0x284eca){logger[_0xd83c('0x2b')](util['format']('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x284eca['label']));if(!this['isConfigured'](_0x284eca[_0xd83c('0x1a8')])){return this[_0xd83c('0xe')][_0xd83c('0x29')](_0x284eca,'no\x20subproject\x20selected');}var _0x4b7dbb=this[_0xd83c('0x18')][_0xd83c('0x6e')](this,_0x284eca[_0xd83c('0x1a8')]);if(!this[_0xd83c('0x85')](_0x4b7dbb)){return this['channel'][_0xd83c('0x29')](_0x284eca,util[_0xd83c('0x54')](_0xd83c('0x1a9'),_0x284eca[_0xd83c('0x1a8')]));}if(_0x4b7dbb===this[_0xd83c('0xe')][_0xd83c('0x37')]){return this['channel']['error'](_0x284eca,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0xd83c('0x33')][_0xd83c('0x6e')](this,_0x284eca,_0x4b7dbb);var _0x46e18c=this['channel'][_0xd83c('0x58')](_0xd83c('0x1aa'),util[_0xd83c('0x54')](_0xd83c('0x1ab'),config[_0xd83c('0x8')][_0xd83c('0x1ac')]||_0xd83c('0x1ad'),_0x4b7dbb,this['channel'][_0xd83c('0x37')]));if(_0x46e18c['result']===-0x1){return _0x46e18c;}return this[_0xd83c('0xe')][_0xd83c('0xa7')](util[_0xd83c('0x54')](_0xd83c('0xbe'),_0xd83c('0x1aa'),_0x4b7dbb));};AGIVertices[_0xd83c('0x11')][_0xd83c('0x1ae')]=function(_0x43e9ae){logger['info'](util[_0xd83c('0x54')](_0xd83c('0x1af'),_0x43e9ae[_0xd83c('0x35')]));var _0x1d106f=this[_0xd83c('0x57')][_0xd83c('0x6e')](this,_0x43e9ae[_0xd83c('0x1b0')]);this[_0xd83c('0x33')]['sync'](this,_0x43e9ae,_0x43e9ae[_0xd83c('0x1b0')]);if(this[_0xd83c('0x85')](_0x43e9ae[_0xd83c('0xd2')])){var _0x51960f=this[_0xd83c('0x12')]['sync'](this,_0x43e9ae['variable_id']);if(_0x51960f){this[_0xd83c('0xe')][_0xd83c('0xa5')](_0x51960f,_0x1d106f);return this['channel'][_0xd83c('0xa7')](util['format'](_0xd83c('0x1b1'),_0x43e9ae[_0xd83c('0x1b0')],_0x51960f));}}return this[_0xd83c('0xe')][_0xd83c('0xa7')](util['format'](_0xd83c('0x1b2'),_0x43e9ae[_0xd83c('0x1b0')]));};AGIVertices[_0xd83c('0x11')][_0xd83c('0x1b3')]=function(_0x3a43a5){logger[_0xd83c('0x2b')](util[_0xd83c('0x54')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x3a43a5['label']));_0x3a43a5[_0xd83c('0x5d')]=_0x3a43a5['text'][_0xd83c('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xd83c('0x85')](_0x3a43a5['apiKey'])){return this[_0xd83c('0xe')]['noop'](_0xd83c('0x1b4'));}if(!this[_0xd83c('0x85')](_0x3a43a5['text'])){return this[_0xd83c('0xe')][_0xd83c('0xa7')](_0xd83c('0xc0'));}this['channel'][_0xd83c('0xa7')](util[_0xd83c('0x54')](_0xd83c('0x1b5'),_0x3a43a5[_0xd83c('0x5d')]));var _0x3c4a2f=this[_0xd83c('0x5a')]['sync'](this,_0x3a43a5);if(_0x3c4a2f){this[_0xd83c('0xe')][_0xd83c('0xa7')](util[_0xd83c('0x54')](_0xd83c('0x1b6'),_0x3c4a2f));var _0x409ae3=this[_0xd83c('0xe')][_0xd83c('0x11f')](_0x3c4a2f);try{fs[_0xd83c('0xfc')](_0x3c4a2f+_0xd83c('0xfd'));}catch(_0x56e457){logger[_0xd83c('0x29')](_0x56e457);}return _0x409ae3;}return this['channel']['error'](_0x3a43a5,_0xd83c('0x1b7'));};AGIVertices[_0xd83c('0x11')][_0xd83c('0x1b8')]=function(_0x12f616){logger['info'](util[_0xd83c('0x54')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x12f616['label']));_0x12f616['text']=_0x12f616[_0xd83c('0x5d')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x12f616['text'])){return this[_0xd83c('0xe')][_0xd83c('0xa7')](_0xd83c('0xc0'));}this[_0xd83c('0xe')][_0xd83c('0xa7')](util[_0xd83c('0x54')](_0xd83c('0x1b9'),_0x12f616[_0xd83c('0x5d')]));var _0x4c1218=this[_0xd83c('0x62')][_0xd83c('0x6e')](this,_0x12f616);if(_0x4c1218){this[_0xd83c('0xe')]['noop'](util[_0xd83c('0x54')](_0xd83c('0x1ba'),_0x4c1218));var _0x15d76f=this[_0xd83c('0xe')][_0xd83c('0x11f')](_0x4c1218);try{fs[_0xd83c('0xfc')](_0x4c1218+'.wav');}catch(_0x5e2856){logger[_0xd83c('0x29')](_0x5e2856);}return _0x15d76f;}return this[_0xd83c('0xe')][_0xd83c('0x29')](_0x12f616,_0xd83c('0x1bb'));};AGIVertices[_0xd83c('0x11')][_0xd83c('0x1bc')]=function(_0x17a8b6){logger[_0xd83c('0x2b')](util[_0xd83c('0x54')](_0xd83c('0x1bd'),_0x17a8b6[_0xd83c('0x35')]));if(!this[_0xd83c('0x85')](_0x17a8b6[_0xd83c('0x152')])){return this[_0xd83c('0xe')][_0xd83c('0x29')](_0x17a8b6,_0xd83c('0x165'));}logger['info'](util[_0xd83c('0x54')](_0xd83c('0x151'),this['channel']['callerid'],_0x17a8b6[_0xd83c('0x152')]));var _0x26276a=this[_0xd83c('0x50')][_0xd83c('0x6e')](this,_0x17a8b6[_0xd83c('0x152')]);if(_0x26276a){logger['info'](util['format'](_0xd83c('0x153'),this[_0xd83c('0xe')][_0xd83c('0x38')],_0x17a8b6[_0xd83c('0x152')]));this[_0xd83c('0xe')][_0xd83c('0xa7')](util[_0xd83c('0x54')](_0xd83c('0x153'),this['channel'][_0xd83c('0x38')],_0x17a8b6[_0xd83c('0x152')]));return{'code':0xc8,'result':_0xd83c('0x154')};}else{logger[_0xd83c('0x2b')](util[_0xd83c('0x54')](_0xd83c('0x155'),this[_0xd83c('0xe')][_0xd83c('0x38')],_0x17a8b6[_0xd83c('0x152')]));this[_0xd83c('0xe')][_0xd83c('0xa7')](util['format'](_0xd83c('0x155'),this[_0xd83c('0xe')][_0xd83c('0x38')],_0x17a8b6[_0xd83c('0x152')]));return{'code':0xc8,'result':_0xd83c('0x156')};}};AGIVertices[_0xd83c('0x11')][_0xd83c('0x1be')]=function(_0x4cfda4){logger['info'](util[_0xd83c('0x54')](_0xd83c('0x1bf'),_0x4cfda4[_0xd83c('0x35')]));var _0x24648f=this[_0xd83c('0xe')]['exec'](_0xd83c('0x1c0'),[_0x4cfda4['mailbox'],_0x4cfda4['options']]);if(_0x24648f['result']===-0x1){return _0x24648f;}return this[_0xd83c('0xe')]['noop'](util['format'](_0xd83c('0xbe'),_0xd83c('0x1c0'),_0x4cfda4[_0xd83c('0x1c1')]));};AGIVertices[_0xd83c('0x11')]['vswitch']=function(_0x19bddf){logger[_0xd83c('0x2b')](util[_0xd83c('0x54')](_0xd83c('0x1c2'),_0x19bddf[_0xd83c('0x35')]));if(!this[_0xd83c('0x85')](_0x19bddf[_0xd83c('0xd2')])){return this[_0xd83c('0xe')][_0xd83c('0x29')](_0x19bddf,_0xd83c('0x1c3'));}var _0x54823a=this[_0xd83c('0x12')][_0xd83c('0x6e')](this,_0x19bddf[_0xd83c('0xd2')]);if(!_0x54823a){return this['channel']['error'](_0x19bddf,'no\x20variable\x20found');}var _0x1e81bd=this[_0xd83c('0xe')][_0xd83c('0x12')](_0x54823a);return{'code':0xc8,'result':_0x1e81bd[_0xd83c('0xa2')]?_0x1e81bd[_0xd83c('0xa2')]:'-'};};String[_0xd83c('0x11')][_0xd83c('0xa1')]=function(_0xb71de7,_0x2cf5a5){return this[_0xd83c('0xa0')](_0xb71de7)[_0xd83c('0x1c4')](_0x2cf5a5);};module[_0xd83c('0x1c5')]=AGIVertices; \ No newline at end of file +var _0xe74e=['minutes','callback_priority','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','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','RECOG_CONFIDENCE()','RECOG_INSTANCE()','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20query\x20configured','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20anguage\x20configured','providerResponse','dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','ndassistant_url','sesteknda','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.wav','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','no\x20trunk\x20selected','trunk_id','trunk_name','DIAL','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20found','getData','maxdigit','test','mindigit','hiddendigitsnum','generate','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','unlink','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20is\x20unreachable','wav','beep','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appsecret\x20configured','%s/recordings/%s','NOBEEP','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','condition','no\x20condition\x20configured','true','EVAL\x20CONDITION\x20%s\x20%s','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','ispeech\x20TTS\x20is\x20unreachable','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','user','subject','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','getSmsAccount','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','START\x20CALLY\x20SQUARE','answer','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','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','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','/var/opt/motion2/server/files','rawHeaders','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','catch','getVoiceQueue','getVoiceQueueById','name','getSquareProject','getSquareOdbcById','dsn','getUser','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','interval','Intervals','format','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','lastName','phone','list_id','callback','scheduledAt','toString','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','LOCAL','exec','trim','replace','googleCloudTTS','apiKey','text','languageCode','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','url','method','includes','PUT','toUpperCase','rawBody','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','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_access_key_id','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clone','isString','replaceObjectAllVariables','replaceAllVariables','isPlainObject','recursiveNodeIndex','length','saveRestApiResult','hasOwnProperty','isArray','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','result','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','no\x20grammar\x20configured','MRCPRecog','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','label','command','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','timeout','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','add'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe74e,0x10a));var _0xee74=function(_0x8ae5f9,_0x49ff8c){_0x8ae5f9=_0x8ae5f9-0x0;var _0x181054=_0xe74e[_0x8ae5f9];return _0x181054;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0xee74('0x0'));var sh=require(_0xee74('0x1'));var odbc=require(_0xee74('0x2'))();var rs=require(_0xee74('0x3'));var moment=require(_0xee74('0x4'));var Mustache=require(_0xee74('0x5'));var rp=require(_0xee74('0x6'));var logger=require(_0xee74('0x7'))(_0xee74('0x8'));var config=require(_0xee74('0x9'));var shared=require('../../config/environment/shared');var scripts=require('./scripts');var FILES_PATH=_0xee74('0xa');var recursiveMapAttributes=[_0xee74('0xb'),'rawBody'];var verticesWithRetry=['menu',_0xee74('0xc'),_0xee74('0xd')];var AGIVertices=function(_0x42d671,_0x55aa4d,_0x48cdb0){this[_0xee74('0xe')]=_0x42d671;this[_0xee74('0xf')]=_0x55aa4d;this[_0xee74('0x10')]=_0x48cdb0;};AGIVertices[_0xee74('0x11')][_0xee74('0x12')]=function(_0x90033d,_0x5b564d){this[_0xee74('0xf')][_0xee74('0x13')](_0x90033d)[_0xee74('0x14')](function(_0x1096f6){_0x5b564d(null,_0x1096f6?_0x1096f6['name']:![]);})[_0xee74('0x15')](function(_0xf608e2){_0x5b564d(_0xf608e2);});};AGIVertices[_0xee74('0x11')][_0xee74('0x16')]=function(_0x5ee1b4,_0x31c1dd){this[_0xee74('0xf')][_0xee74('0x17')](_0x5ee1b4)[_0xee74('0x14')](function(_0x15d6f3){_0x31c1dd(null,_0x15d6f3?_0x15d6f3[_0xee74('0x18')]:![]);})['catch'](function(_0x18789e){_0x31c1dd(_0x18789e);});};AGIVertices[_0xee74('0x11')][_0xee74('0x19')]=function(_0x482d66,_0x988fb5){this[_0xee74('0xf')]['getSquareProjectById'](_0x482d66)['then'](function(_0x7f1f64){_0x988fb5(null,_0x7f1f64?_0x7f1f64[_0xee74('0x18')]:![]);})[_0xee74('0x15')](function(_0x320c54){_0x988fb5(_0x320c54);});};AGIVertices[_0xee74('0x11')]['getSquareOdbc']=function(_0x15ccdd,_0x165059){this['rpc'][_0xee74('0x1a')](_0x15ccdd)[_0xee74('0x14')](function(_0x179cb3){_0x165059(null,_0x179cb3?_0x179cb3[_0xee74('0x1b')]:![]);})[_0xee74('0x15')](function(_0x4f9b0b){_0x165059(_0x4f9b0b);});};AGIVertices[_0xee74('0x11')][_0xee74('0x1c')]=function(_0x32730b,_0x3b515e){this['rpc']['getUserById'](_0x32730b)['then'](function(_0x41bc5e){_0x3b515e(null,_0x41bc5e?_0x41bc5e[_0xee74('0x18')]:![]);})[_0xee74('0x15')](function(_0x1aa325){_0x3b515e(_0x1aa325);});};AGIVertices[_0xee74('0x11')][_0xee74('0x1d')]=function(_0x111d69,_0xbf115d){this[_0xee74('0xf')][_0xee74('0x1e')](_0x111d69)[_0xee74('0x14')](function(_0x2e7ae9){_0xbf115d(null,_0x2e7ae9?_0x2e7ae9[_0xee74('0x18')]:![]);})[_0xee74('0x15')](function(_0x40a655){_0xbf115d(_0x40a655);});};AGIVertices[_0xee74('0x11')][_0xee74('0x1f')]=function(_0x353c8f,_0x3fda83){var _0x1f0e7b=this;this['rpc'][_0xee74('0x20')](_0x353c8f)[_0xee74('0x14')](function(_0x1d217b){_0x3fda83(null,_0x1d217b?_0x1f0e7b[_0xee74('0x21')](_0x1d217b[_0xee74('0x22')]):![]);})[_0xee74('0x15')](function(_0x4cb971){_0x3fda83(_0x4cb971);});};AGIVertices[_0xee74('0x11')][_0xee74('0x23')]=function(_0x194e1b,_0x5aa00d){this[_0xee74('0xf')][_0xee74('0x24')](_0x194e1b)[_0xee74('0x14')](function(_0x414713){_0x5aa00d(null,_0x414713?_0x414713:![]);})[_0xee74('0x15')](function(_0x313067){_0x5aa00d(_0x313067);});};AGIVertices[_0xee74('0x11')][_0xee74('0x25')]=function(_0x378dbd,_0x1f6d7c,_0x5bad7c){this[_0xee74('0x10')]['sendMailMessage'](_0x378dbd,_0x1f6d7c)['then'](function(){_0x5bad7c(null);})[_0xee74('0x15')](function(_0x5ac98b){_0x5bad7c(_0x5ac98b);});};AGIVertices['prototype'][_0xee74('0x26')]=function(_0xbfdcf9,_0x4acc6b){this[_0xee74('0xf')][_0xee74('0x27')](_0xbfdcf9)[_0xee74('0x14')](function(_0x4261c2){if(_0x4261c2){if(_0x4261c2['IntervalId']){_0x4acc6b(null,[_0x4261c2[_0xee74('0x28')]]);}else{_0x4acc6b(null,_['map'](_0x4261c2[_0xee74('0x29')],_0xee74('0x28')));}}else{_0x4acc6b(null,![]);}})[_0xee74('0x15')](function(_0x5001e9){_0x4acc6b(_0x5001e9);});};AGIVertices[_0xee74('0x11')]['getSoundPath']=function(_0x4a03c6){return util[_0xee74('0x2a')](_0xee74('0x2b'),FILES_PATH,_0x4a03c6);};AGIVertices[_0xee74('0x11')]['getQueryOdbc']=function(_0x4b91d7,_0x3cf82e,_0x35c8e4){odbc[_0xee74('0x2c')](_0x4b91d7,function(_0x297a79){if(_0x297a79){logger[_0xee74('0x2d')](_0xee74('0x2e'),_0x297a79);_0x35c8e4(_0x297a79);}else{logger[_0xee74('0x2f')](_0xee74('0x30'));odbc[_0xee74('0x31')](_0x3cf82e,function(_0x299cef,_0x587624){if(_0x299cef){logger[_0xee74('0x2f')](_0xee74('0x32'),_0x3cf82e);_0x35c8e4(_0x299cef);}else{logger[_0xee74('0x2f')]('Query\x20executed\x20correctly\x20%s',_0x3cf82e);odbc[_0xee74('0x33')](function(_0x2e5e42){if(_0x2e5e42){logger[_0xee74('0x2d')](_0xee74('0x34'),_0x2e5e42);}_0x35c8e4(null,_0x587624);});}});}});};AGIVertices['prototype']['getSmsAccount']=function(_0x3369bf,_0x5db032){this[_0xee74('0xf')][_0xee74('0x35')](_0x3369bf)[_0xee74('0x14')](function(_0x1d1074){_0x5db032(null,_0x1d1074?_0x1d1074:![]);})[_0xee74('0x15')](function(_0x3baf27){_0x5db032(_0x3baf27);});};AGIVertices['prototype'][_0xee74('0x36')]=function(_0x3299c2,_0x43a75b){this[_0xee74('0xf')]['createSmsMessage'](_0x3299c2)[_0xee74('0x14')](function(_0x31d871){_0x43a75b(null,_0x31d871);})[_0xee74('0x15')](function(_0x42bbba){_0x43a75b(_0x42bbba);});};AGIVertices['prototype']['createSquareDetailsReport']=function(_0x45904a,_0x540cda,_0x4211f8){this[_0xee74('0xf')][_0xee74('0x37')]({'uniqueid':this['channel'][_0xee74('0x38')],'node':_0x45904a['label'],'application':_0x45904a[_0xee74('0x39')],'data':_0x540cda||null,'project_name':this[_0xee74('0xe')][_0xee74('0x3a')],'callerid':this['channel'][_0xee74('0x3b')]})[_0xee74('0x14')](function(_0x554b7f){if(_0x4211f8){_0x4211f8(null,_0x554b7f);}})[_0xee74('0x15')](function(_0x91cfdd){if(_0x4211f8){_0x4211f8(_0x91cfdd);}});};AGIVertices['prototype'][_0xee74('0x3c')]=function(_0x10416c,_0x1791ef,_0x152015,_0x56296b){this[_0xee74('0xf')][_0xee74('0x3c')]({'uniqueid':this['channel'][_0xee74('0x38')],'callerid':this['channel']['callerid'],'calleridname':this[_0xee74('0xe')][_0xee74('0x3d')],'context':this[_0xee74('0xe')][_0xee74('0x3e')],'extension':this[_0xee74('0xe')][_0xee74('0x3f')],'priority':this[_0xee74('0xe')][_0xee74('0x40')],'accountcode':this[_0xee74('0xe')]['accountcode'],'dnid':this['channel'][_0xee74('0x41')],'projectName':this[_0xee74('0xe')]['arg_1'],'saveName':_0x1791ef,'filename':_0x10416c[_0xee74('0x42')]||_0x1791ef,'savePath':_0x152015})[_0xee74('0x14')](function(_0x4b7f11){_0x56296b(null,_0x4b7f11);})[_0xee74('0x15')](function(_0x650526){_0x56296b(_0x650526);});};AGIVertices[_0xee74('0x11')][_0xee74('0x43')]=function(_0x23b1df,_0x2dacd8,_0xefaca0,_0x56fc25,_0x2f26e0){this[_0xee74('0xf')][_0xee74('0x43')]({'uniqueid':this['channel']['uniqueid'],'body':_0x23b1df,'direction':_0x2dacd8,'providerName':_0xefaca0,'providerResponse':_0x56fc25})[_0xee74('0x14')](function(_0x2befa7){if(_0x2f26e0){_0x2f26e0(null,_0x2befa7);}})[_0xee74('0x15')](function(_0x284612){if(_0x2f26e0){_0x2f26e0(_0x284612);}});};AGIVertices[_0xee74('0x11')][_0xee74('0x44')]=function(_0x23ca2b,_0x4b20ae){this[_0xee74('0xf')][_0xee74('0x44')]({'firstName':_[_0xee74('0x45')](_0x23ca2b[_0xee74('0x18')])||_[_0xee74('0x46')](_0x23ca2b[_0xee74('0x18')])?_0xee74('0x47')+Math['random']():_0x23ca2b[_0xee74('0x18')],'lastName':_[_0xee74('0x45')](_0x23ca2b[_0xee74('0x48')])||_[_0xee74('0x46')](_0x23ca2b[_0xee74('0x48')])?null:_0x23ca2b[_0xee74('0x48')],'phone':_0x23ca2b[_0xee74('0x49')],'ListId':_0x23ca2b[_0xee74('0x4a')],'scheduledat':_0x23ca2b['scheduledAt'],'callbackUniqueid':this[_0xee74('0xe')][_0xee74('0x38')],'tags':_0xee74('0x4b'),'description':'Callback\x20scheduled\x20at\x20'+_0x23ca2b[_0xee74('0x4c')][_0xee74('0x4d')](),'priority':_0x23ca2b['callback_priority']})[_0xee74('0x14')](function(_0x34d60a){_0x4b20ae(null,_0x34d60a);})['catch'](function(_0x4ff77c){_0x4b20ae(_0x4ff77c);});};AGIVertices[_0xee74('0x11')]['getPause']=function(_0x194c24,_0x50e644){this['rpc'][_0xee74('0x4e')](_0x194c24)['then'](function(_0x2209f7){_0x50e644(null,_0x2209f7?_0x2209f7[_0xee74('0x18')]:![]);})['catch'](function(_0x530847){_0x50e644(_0x530847);});};AGIVertices[_0xee74('0x11')][_0xee74('0x4f')]=function(_0x537968,_0x5ebf1f,_0x21bda0){var _0x3408f2={'role':_0xee74('0x50')};_0x3408f2[_0x537968]=this[_0xee74('0xe')][_0xee74('0x3b')];this[_0xee74('0xf')]['agentPause'](_0x3408f2,_0x5ebf1f,this[_0xee74('0xe')][_0xee74('0x38')])[_0xee74('0x14')](function(_0x593791){_0x21bda0(null,_[_0xee74('0x46')](_0x593791)?![]:!![]);})[_0xee74('0x15')](function(_0x305929){logger[_0xee74('0x2d')](_0x305929);_0x21bda0(null,![]);});};AGIVertices['prototype'][_0xee74('0x51')]=function(_0x2fd139,_0x2a1397){var _0x15e7f8={'role':_0xee74('0x50')};_0x15e7f8[_0x2fd139]=this[_0xee74('0xe')]['callerid'];this['rpc']['agentUnpause'](_0x15e7f8)[_0xee74('0x14')](function(_0x210d11){_0x2a1397(null,_['isNil'](_0x210d11)?![]:!![]);})[_0xee74('0x15')](function(_0x5e18ab){logger[_0xee74('0x2d')](_0x5e18ab);_0x2a1397(null,![]);});};AGIVertices[_0xee74('0x11')][_0xee74('0x52')]=function(_0x40410b,_0x310b1c){var _0x587c0b={'role':_0xee74('0x50')};_0x587c0b[_0x40410b]=this[_0xee74('0xe')][_0xee74('0x3b')];this[_0xee74('0xf')][_0xee74('0x52')](_0x587c0b)['then'](function(_0x199bf0){_0x310b1c(null,_[_0xee74('0x46')](_0x199bf0)?![]:!![]);})[_0xee74('0x15')](function(_0x28e663){logger[_0xee74('0x2d')](_0x28e663);_0x310b1c(null,![]);});};AGIVertices[_0xee74('0x11')][_0xee74('0x53')]=function(_0x58c4d2,_0x4f399a){var _0x3b6364={'role':_0xee74('0x50')};_0x3b6364[_0x58c4d2]=this[_0xee74('0xe')][_0xee74('0x3b')];var _0x528cd8=_0x58c4d2!=_0xee74('0x54')?util[_0xee74('0x2a')]('%s/%s@from-sip/n',_0xee74('0x55'),this[_0xee74('0xe')][_0xee74('0x3b')]):undefined;this[_0xee74('0xf')]['agentLogin'](_0x3b6364,_0x528cd8)[_0xee74('0x14')](function(_0x3cfd0f){_0x4f399a(null,_[_0xee74('0x46')](_0x3cfd0f)?![]:!![]);})[_0xee74('0x15')](function(_0x55c16a){logger[_0xee74('0x2d')](_0x55c16a);_0x4f399a(null,![]);});};AGIVertices[_0xee74('0x11')]['shellCommand']=function(_0x19b826,_0x3f4d79){sh[_0xee74('0x56')](_[_0xee74('0x57')](_0x19b826),function(_0x4929a9,_0x34a0e4){var _0x3e866a=_0x34a0e4[_0xee74('0x58')](/(\r\n|\n|\r)/gm,'');_0x3f4d79(null,_0x3e866a);});};AGIVertices['prototype'][_0xee74('0x59')]=function(_0x324d0b,_0xd04289){scripts[_0xee74('0x59')](_0x324d0b[_0xee74('0x5a')],_0x324d0b['google_cloud_tts_text_type']||_0xee74('0x5b'),_0x324d0b[_0xee74('0x5b')],_0x324d0b[_0xee74('0x5c')]||'en-US',_0x324d0b[_0xee74('0x5d')]||_0xee74('0x5e'),_0x324d0b[_0xee74('0x5f')]||_0xee74('0x60'))[_0xee74('0x14')](function(_0x1b8f65){_0xd04289(null,_0x1b8f65);})['catch'](function(_0x1cd915){_0xd04289(_0x1cd915);});};AGIVertices[_0xee74('0x11')][_0xee74('0x61')]=function(_0x1b28e1,_0x4b080a){scripts['googleTTS'](_0x1b28e1[_0xee74('0x5b')],_0x1b28e1[_0xee74('0x62')]||'en',0x1)[_0xee74('0x14')](function(_0x43574f){_0x4b080a(null,_0x43574f);})[_0xee74('0x15')](function(_0x3d456f){_0x4b080a(_0x3d456f);});};AGIVertices[_0xee74('0x11')]['restAPI']=function(_0x40dce8,_0x4f630e){var _0x1d8e37={'uri':_0x40dce8[_0xee74('0x63')],'method':_0x40dce8[_0xee74('0x64')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x40dce8['timeout'])==='number'&&parseInt(_0x40dce8['timeout'])>=0x1?parseInt(_0x40dce8['timeout'])*0x3e8:0x5*0x3e8};if(_[_0xee74('0x65')](['POST',_0xee74('0x66')],_0x1d8e37['method'][_0xee74('0x67')]())){try{_0x1d8e37['body']=_0x40dce8[_0xee74('0x68')]?JSON[_0xee74('0x69')](_0x40dce8['rawBody']):{};}catch(_0x55b382){logger[_0xee74('0x2d')](_0xee74('0x6a'),_0x55b382);}}try{_0x1d8e37[_0xee74('0x6b')]=_0x40dce8[_0xee74('0xb')]?JSON[_0xee74('0x69')](_0x40dce8[_0xee74('0xb')]):{};}catch(_0x55abc8){logger[_0xee74('0x2d')](_0xee74('0x6c'),_0x55abc8);}if(_0x40dce8[_0xee74('0x6d')]){try{var _0x30bae5=require(_0x40dce8['computedVariables'])[_0xee74('0x6e')](this,_0x1d8e37);_0x1d8e37[_0xee74('0x6f')]=Mustache[_0xee74('0x70')](_0x40dce8[_0xee74('0x63')],_0x30bae5,{},['$$','$$']);if(_0x1d8e37[_0xee74('0x6b')]){_0x1d8e37[_0xee74('0x6b')]=JSON[_0xee74('0x69')](Mustache[_0xee74('0x70')](JSON[_0xee74('0x71')](_0x1d8e37[_0xee74('0x6b')]),_0x30bae5,{},['$$','$$']));}if(_0x1d8e37[_0xee74('0x72')]){_0x1d8e37['body']=JSON[_0xee74('0x69')](Mustache[_0xee74('0x70')](JSON['stringify'](_0x1d8e37[_0xee74('0x72')]),_0x30bae5,{},['$$','$$']));}}catch(_0x2d3c30){logger[_0xee74('0x2d')](_0xee74('0x73'),_0x2d3c30);}}rp(_0x1d8e37)[_0xee74('0x14')](function(_0x15cd5c){var _0x58a6ce={'statusCode':_0x15cd5c[_0xee74('0x74')]||0xc8,'statusMessage':_0x15cd5c['statusMessage']||'OK','headers':_0x15cd5c[_0xee74('0x6b')]||{},'body':_0x15cd5c[_0xee74('0x72')]||{}};_0x4f630e(null,_0x58a6ce);})[_0xee74('0x15')](function(_0x4d60e4){var _0x127c66={'statusCode':_0x4d60e4[_0xee74('0x74')]||0x1f4,'statusMessage':_0x4d60e4[_0xee74('0x75')]||_0xee74('0x76'),'headers':_0x4d60e4[_0xee74('0x77')][_0xee74('0x6b')]||{},'body':_0x4d60e4[_0xee74('0x77')][_0xee74('0x72')]||{}};_0x4f630e(null,_0x127c66);});};AGIVertices[_0xee74('0x11')][_0xee74('0x78')]=function(_0x1339e0,_0x16412b){scripts[_0xee74('0x78')](this['channel'][_0xee74('0x38')],_0x1339e0[_0xee74('0x79')],_0x1339e0[_0xee74('0x5b')],_0x1339e0['dialogflow_language']||'en')[_0xee74('0x14')](function(_0xd13971){_0x16412b(null,_0xd13971);})[_0xee74('0x15')](function(_0x1a5027){_0x16412b(_0x1a5027);});};AGIVertices['prototype'][_0xee74('0x7a')]=function(_0x46a239,_0x2e9329){scripts['googleDialogflowV2'](this[_0xee74('0xe')]['uniqueid'],_0x46a239[_0xee74('0x7b')],_0x46a239[_0xee74('0x7c')],_0x46a239[_0xee74('0x7d')],_0x46a239[_0xee74('0x5b')],_0x46a239[_0xee74('0x7e')]||'en')[_0xee74('0x14')](function(_0x31ab93){_0x2e9329(null,_0x31ab93);})[_0xee74('0x15')](function(_0x45c563){_0x2e9329(_0x45c563);});};AGIVertices[_0xee74('0x11')][_0xee74('0x7f')]=function(_0x4a67a3,_0x4d9fe3){scripts['sestekNDA'](this[_0xee74('0xe')],_0x4a67a3)[_0xee74('0x14')](function(_0x5cf23b){_0x4d9fe3(null,_0x5cf23b);})[_0xee74('0x15')](function(_0x4ca218){_0x4d9fe3(_0x4ca218);});};AGIVertices[_0xee74('0x11')][_0xee74('0x80')]=function(_0x1d0d03,_0x19230c){scripts[_0xee74('0x80')](_0x1d0d03[_0xee74('0x79')],_0x1d0d03['text'],_0x1d0d03[_0xee74('0x81')]||_0xee74('0x82'),_0x1d0d03[_0xee74('0x83')])[_0xee74('0x14')](function(_0x49d60){_0x19230c(null,_0x49d60);})[_0xee74('0x15')](function(_0x5824f5){_0x19230c(_0x5824f5);});};AGIVertices[_0xee74('0x11')]['ispeechASR']=function(_0xf63d55,_0x5260b5,_0xf572d0){scripts[_0xee74('0x84')](_0x5260b5,_0xf63d55['key'],_0xf63d55['ispeech_asr_language']||_0xee74('0x82'),this[_0xee74('0x85')](_0xf63d55[_0xee74('0x86')])?_0xf63d55[_0xee74('0x86')]:undefined)['then'](function(_0x545817){_0xf572d0(null,_0x545817);})[_0xee74('0x15')](function(_0x362da7){_0xf572d0(_0x362da7);});};AGIVertices['prototype'][_0xee74('0x87')]=function(_0x144453,_0x290582){scripts[_0xee74('0x87')](_0x144453['aws_access_key_id'],_0x144453[_0xee74('0x88')],_0x144453[_0xee74('0x89')],_0x144453[_0xee74('0x8a')]||_0xee74('0x8b'),_0x144453[_0xee74('0x5b')],_0x144453[_0xee74('0x8c')]||'text')[_0xee74('0x14')](function(_0x1bd2c8){_0x290582(null,_0x1bd2c8);})[_0xee74('0x15')](function(_0x26b206){_0x290582(_0x26b206);});};AGIVertices[_0xee74('0x11')][_0xee74('0x8d')]=function(_0x280d04,_0x302ff3){scripts['awsLex'](this[_0xee74('0xe')][_0xee74('0x38')],_0x280d04[_0xee74('0x8e')],_0x280d04[_0xee74('0x88')],_0x280d04[_0xee74('0x8f')],_0x280d04[_0xee74('0x5b')],_0x280d04[_0xee74('0x90')])[_0xee74('0x14')](function(_0x35da38){_0x302ff3(null,_0x35da38);})['catch'](function(_0x13247a){_0x302ff3(_0x13247a);});};AGIVertices[_0xee74('0x11')][_0xee74('0x91')]=function(_0x53ac82,_0x61cda5,_0x25d8c7){scripts['googleASR'](_0x61cda5,_0x53ac82[_0xee74('0x79')],_0x53ac82[_0xee74('0x92')]||_0xee74('0x82'))['then'](function(_0x21e7a9){_0x25d8c7(null,_0x21e7a9);})[_0xee74('0x15')](function(_0x4e7d5e){_0x25d8c7(_0x4e7d5e);});};AGIVertices[_0xee74('0x11')][_0xee74('0x93')]=function(_0x225092,_0xe84e19,_0x4a70b0){scripts['tildeASR'](_0xe84e19,_0x225092[_0xee74('0x94')],_0x225092[_0xee74('0x95')],_0x225092[_0xee74('0x6f')])[_0xee74('0x14')](function(_0x5cfe2e){_0x4a70b0(null,_0x5cfe2e);})[_0xee74('0x15')](function(_0x2008d2){_0x4a70b0(_0x2008d2);});};AGIVertices['prototype']['clear']=function(_0x4b706d){var _0x1f994d=_[_0xee74('0x65')](verticesWithRetry,_0x4b706d[_0xee74('0x39')])?_0x4b706d:_[_0xee74('0x96')](_0x4b706d);for(var _0x5917f0 in _0x1f994d){if(_0x1f994d['hasOwnProperty'](_0x5917f0)){if(_0x1f994d[_0x5917f0]&&_[_0xee74('0x97')](_0x1f994d[_0x5917f0])){if(_['includes'](recursiveMapAttributes,_0x5917f0)){_0x1f994d[_0x5917f0]=this[_0xee74('0x98')](_0x1f994d[_0x5917f0]);}else{_0x1f994d[_0x5917f0]=this[_0xee74('0x99')](_0x1f994d[_0x5917f0]);}}}}return _0x1f994d;};AGIVertices[_0xee74('0x11')]['recursiveNodeIndex']=function(_0x254a9c){for(var _0x9c2cb3 in _0x254a9c){if(_0x254a9c['hasOwnProperty'](_0x9c2cb3)){if(_[_0xee74('0x9a')](_0x254a9c[_0x9c2cb3])){this[_0xee74('0x9b')](_0x254a9c[_0x9c2cb3]);}else if(_['isArray'](_0x254a9c[_0x9c2cb3])){for(var _0x3219a2=0x0;_0x3219a2<_0x254a9c[_0x9c2cb3][_0xee74('0x9c')];_0x3219a2++){this['recursiveNodeIndex'](_0x254a9c[_0x9c2cb3][_0x3219a2]);}}else if(_[_0xee74('0x97')](_0x254a9c[_0x9c2cb3])){_0x254a9c[_0x9c2cb3]=this[_0xee74('0x99')](_0x254a9c[_0x9c2cb3]);}}}};AGIVertices[_0xee74('0x11')][_0xee74('0x9d')]=function(_0x340589,_0x54f311){for(var _0x1923f1 in _0x340589){if(_0x340589[_0xee74('0x9e')](_0x1923f1)){if(_['isPlainObject'](_0x340589[_0x1923f1])){if(!_[_0xee74('0x45')](_0x340589[_0x1923f1])){this['saveRestApiResult'](_0x340589[_0x1923f1],util[_0xee74('0x2a')]('%s.%s',_0x54f311,_0x1923f1));}}else if(_[_0xee74('0x9f')](_0x340589[_0x1923f1])){for(var _0x54e9f0=0x0;_0x54e9f0<_0x340589[_0x1923f1][_0xee74('0x9c')];_0x54e9f0++){this[_0xee74('0x9d')](_0x340589[_0x1923f1][_0x54e9f0],util['format'](_0xee74('0xa0'),_0x54f311,_0x1923f1+'['+_0x54e9f0+']'));}}else{if(!_[_0xee74('0x46')](_0x340589[_0x1923f1])){this[_0xee74('0xe')][_0xee74('0xa1')](util[_0xee74('0x2a')](_0xee74('0xa0'),_0x54f311,_0x1923f1),_0x340589[_0x1923f1]);}}}}};AGIVertices[_0xee74('0x11')][_0xee74('0x98')]=function(_0x474113){try{var _0x4f296f=JSON[_0xee74('0x69')](_0x474113);this[_0xee74('0x9b')](_0x4f296f);return JSON[_0xee74('0x71')](_0x4f296f);}catch(_0x20ee00){return this[_0xee74('0x99')](_0x474113);}};AGIVertices['prototype'][_0xee74('0x99')]=function(_0x519429){var _0x36c6c3=_0x519429['split']('{');for(var _0x5784bf=0x1;_0x5784bf<_0x36c6c3[_0xee74('0x9c')];_0x5784bf+=0x1){var _0x4abd14=_0x36c6c3[_0x5784bf][_0xee74('0xa2')]('}');if(_0x4abd14[_0xee74('0x9c')]>0x1){_0x519429=_0x519429[_0xee74('0xa3')]('{'+_0x4abd14[0x0]+'}',this['channel'][_0xee74('0x12')](_0x4abd14[0x0])[_0xee74('0xa4')]||_0x4abd14[0x0]);}}if(_0x36c6c3[_0xee74('0x9c')]===0x1){return _0x519429[_0xee74('0x4d')]();}return this[_0xee74('0x99')](_0x519429);};AGIVertices[_0xee74('0x11')][_0xee74('0xa5')]=function(_0x293e0e,_0x315616){var _0x1f15e8=this[_0xee74('0xe')][_0xee74('0x12')](_0x293e0e);if(_0x1f15e8['result']===-0x1){return _0x1f15e8;}logger[_0xee74('0x2f')](util[_0xee74('0x2a')](_0xee74('0xa6'),_0x315616,_0x1f15e8[_0xee74('0xa4')]));return this[_0xee74('0xe')][_0xee74('0xa1')](_0x315616,_0x1f15e8[_0xee74('0xa4')]);};AGIVertices['prototype'][_0xee74('0x85')]=function(_0x190b75){return _0x190b75&&_0x190b75!=='0'&&_0x190b75!=='-1'&&_0x190b75!=='';};AGIVertices[_0xee74('0x11')][_0xee74('0xa7')]=function(_0x1483c5){this[_0xee74('0x37')][_0xee74('0x6e')](this,_0x1483c5,'-');_0x1483c5[_0xee74('0xa8')]=_0x1483c5[_0xee74('0xa7')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xee74('0x11')][_0xee74('0xa9')]=function(_0x4c339f){logger[_0xee74('0x2f')](util[_0xee74('0x2a')](_0xee74('0xaa'),_0x4c339f['label']));if(!this[_0xee74('0x85')](_0x4c339f[_0xee74('0x5b')])){return this[_0xee74('0xe')][_0xee74('0xab')](_0xee74('0xac'));}var _0x49a887='\x22'+_0x4c339f['text']+'\x22';if(this['isConfigured'](_0x4c339f[_0xee74('0x77')])){_0x49a887+=','+_0x4c339f[_0xee74('0x77')];}var _0x40b60c=this[_0xee74('0xe')][_0xee74('0x56')](_0xee74('0xad'),_0x49a887);if(_0x40b60c[_0xee74('0xae')]===-0x1){return _0x40b60c;}return this[_0xee74('0xe')][_0xee74('0xab')](util[_0xee74('0x2a')](_0xee74('0xaf'),_0x49a887));};AGIVertices[_0xee74('0x11')][_0xee74('0xb0')]=function(_0x1e41be){logger['info'](util['format']('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x1e41be['label']));if(!this['isConfigured'](_0x1e41be['grammar'])){return this[_0xee74('0xe')][_0xee74('0xab')](_0xee74('0xb1'));}var _0x21b057=_0x1e41be['grammar'];if(this[_0xee74('0x85')](_0x1e41be[_0xee74('0x77')])){_0x21b057+=','+_0x1e41be['options'];}var _0x45c1d6=this['channel']['exec'](_0xee74('0xb2'),_0x21b057);if(_0x45c1d6[_0xee74('0xae')]===-0x1){return _0x45c1d6;}var _0xfb2a4c=this[_0xee74('0xa5')]('RECOG_CONFIDENCE()',_0xee74('0xb3'));if(_0xfb2a4c[_0xee74('0xae')]===-0x1){return _0xfb2a4c;}var _0x3277d1=this[_0xee74('0xa5')](_0xee74('0xb4'),_0xee74('0xb5'));if(_0x3277d1[_0xee74('0xae')]===-0x1){return _0x3277d1;}var _0xf9aefb=this[_0xee74('0xa5')]('RECOG_INSTANCE()','MRCP_RECOG_INSTANCE');if(_0xf9aefb[_0xee74('0xae')]===-0x1){return _0xf9aefb;}return this['channel']['noop'](util['format'](_0xee74('0xb6'),_0x21b057));};AGIVertices[_0xee74('0x11')]['agi']=function(_0x1c3cfb){logger[_0xee74('0x2f')](util[_0xee74('0x2a')](_0xee74('0xb7'),_0x1c3cfb[_0xee74('0xb8')]));return this[_0xee74('0xe')]['agi']([_0x1c3cfb[_0xee74('0xb9')],_0x1c3cfb[_0xee74('0xba')]]);};AGIVertices[_0xee74('0x11')]['answer']=function(_0x90e6bb){logger[_0xee74('0x2f')](util[_0xee74('0x2a')](_0xee74('0xbb'),_0x90e6bb[_0xee74('0xb8')]));if(this[_0xee74('0x85')](_0x90e6bb[_0xee74('0xbc')])){logger[_0xee74('0x2f')](util[_0xee74('0x2a')](_0xee74('0xbd'),_0x90e6bb[_0xee74('0xbc')]));var _0x5ec08b=this[_0xee74('0xe')][_0xee74('0xbe')](_0x90e6bb['timeout']);if(_0x5ec08b[_0xee74('0xae')]===-0x1){return _0x5ec08b;}}return this[_0xee74('0xe')]['answer']();};AGIVertices[_0xee74('0x11')][_0xee74('0x4b')]=function(_0x1b7cd1){logger[_0xee74('0x2f')](util[_0xee74('0x2a')](_0xee74('0xbf'),_0x1b7cd1[_0xee74('0xb8')]));if(!this[_0xee74('0x85')](_0x1b7cd1[_0xee74('0x4a')])){return this[_0xee74('0xe')][_0xee74('0x2d')](_0x1b7cd1,'no\x20list\x20selected');}_0x1b7cd1[_0xee74('0x4c')]=moment();if(this[_0xee74('0x85')](_0x1b7cd1[_0xee74('0xc0')])){_0x1b7cd1[_0xee74('0x4c')]=moment()[_0xee74('0xc1')](_0x1b7cd1[_0xee74('0xc0')],_0xee74('0xc2'));}if(!this[_0xee74('0x85')](_0x1b7cd1['callback_priority'])){_0x1b7cd1[_0xee74('0xc3')]=0x2;}this[_0xee74('0x44')]['sync'](this,_0x1b7cd1);return this[_0xee74('0xe')][_0xee74('0xab')](util['format'](_0xee74('0xc4'),_0x1b7cd1[_0xee74('0x49')],_0x1b7cd1[_0xee74('0x4a')],_0x1b7cd1[_0xee74('0x4c')]));};AGIVertices[_0xee74('0x11')][_0xee74('0xc5')]=function(_0x3fc5f7){logger[_0xee74('0x2f')](util['format'](_0xee74('0xc6'),_0x3fc5f7['label']));var _0x2bb523=this[_0xee74('0xe')][_0xee74('0x56')](_0x3fc5f7['application'],_0x3fc5f7['options']);if(_0x2bb523[_0xee74('0xae')]===-0x1){return _0x2bb523;}return this[_0xee74('0xe')]['noop'](util[_0xee74('0x2a')](_0xee74('0xc7'),_0x3fc5f7[_0xee74('0xc8')],_0x3fc5f7[_0xee74('0x77')]));};AGIVertices['prototype'][_0xee74('0xc9')]=function(_0x15cfd8){logger[_0xee74('0x2f')](util['format'](_0xee74('0xca'),_0x15cfd8[_0xee74('0xb8')]));if(!this[_0xee74('0x85')](_0x15cfd8[_0xee74('0x5b')])){return this['channel'][_0xee74('0xab')]('no\x20text\x20configured');}var _0x21ff9e='\x22'+_0x15cfd8[_0xee74('0x5b')]+'\x22';if(this['isConfigured'](_0x15cfd8[_0xee74('0x77')])){_0x21ff9e+=','+_0x15cfd8[_0xee74('0x77')];}var _0x461093=this[_0xee74('0xe')][_0xee74('0x56')]('MRCPSynth',_0x21ff9e);if(_0x461093[_0xee74('0xae')]===-0x1){return _0x461093;}return this['channel'][_0xee74('0xab')](util['format'](_0xee74('0xaf'),_0x21ff9e));};AGIVertices[_0xee74('0x11')][_0xee74('0xcb')]=function(_0x32937f){logger['info'](util['format'](_0xee74('0xcc'),_0x32937f[_0xee74('0xb8')]));if(!this['isConfigured'](_0x32937f['text'])){return this[_0xee74('0xe')][_0xee74('0xab')](_0xee74('0xac'));}var _0x4d90f3='\x22'+_0x32937f[_0xee74('0x5b')]+'\x22';if(this[_0xee74('0x85')](_0x32937f[_0xee74('0x77')])){_0x4d90f3+=','+_0x32937f[_0xee74('0x77')];}var _0x2a68dd=this[_0xee74('0xe')][_0xee74('0x56')](_0xee74('0xad'),_0x4d90f3);if(_0x2a68dd[_0xee74('0xae')]===-0x1){return _0x2a68dd;}return this[_0xee74('0xe')]['noop'](util[_0xee74('0x2a')](_0xee74('0xaf'),_0x4d90f3));};AGIVertices[_0xee74('0x11')][_0xee74('0xcd')]=function(_0x354076){logger[_0xee74('0x2f')](util[_0xee74('0x2a')](_0xee74('0xce'),_0x354076[_0xee74('0xb8')]));if(!this[_0xee74('0x85')](_0x354076[_0xee74('0xcf')])){return this[_0xee74('0xe')][_0xee74('0xab')](_0xee74('0xb1'));}var _0x4c453e=_0x354076[_0xee74('0xcf')];if(this[_0xee74('0x85')](_0x354076[_0xee74('0x77')])){_0x4c453e+=','+_0x354076['options'];}var _0x4db4bf=this[_0xee74('0xe')]['exec'](_0xee74('0xb2'),_0x4c453e);if(_0x4db4bf[_0xee74('0xae')]===-0x1){return _0x4db4bf;}var _0x110073=this[_0xee74('0xa5')](_0xee74('0xd0'),'LUMENVOX_ASR_CONFIDENCE');if(_0x110073['result']===-0x1){return _0x110073;}var _0x5031fe=this[_0xee74('0xa5')](_0xee74('0xb4'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x5031fe['result']===-0x1){return _0x5031fe;}var _0x3e8fe3=this[_0xee74('0xa5')](_0xee74('0xd1'),'LUMENVOX_ASR_INSTANCE');if(_0x3e8fe3['result']===-0x1){return _0x3e8fe3;}return this[_0xee74('0xe')]['noop'](util[_0xee74('0x2a')](_0xee74('0xb6'),_0x4c453e));};AGIVertices['prototype'][_0xee74('0xd2')]=function(_0x4a85be){logger[_0xee74('0x2f')](util[_0xee74('0x2a')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x4a85be[_0xee74('0xb8')]));if(!this['isConfigured'](_0x4a85be['grammar'])){return this[_0xee74('0xe')][_0xee74('0xab')](_0xee74('0xb1'));}var _0x2a36d3=_0x4a85be[_0xee74('0xcf')];if(this[_0xee74('0x85')](_0x4a85be[_0xee74('0x77')])){_0x2a36d3+=','+_0x4a85be[_0xee74('0x77')];}var _0x481166=this['channel'][_0xee74('0x56')]('MRCPRecog',_0x2a36d3);if(_0x481166['result']===-0x1){return _0x481166;}var _0x4d11e3=this[_0xee74('0xa5')](_0xee74('0xd0'),_0xee74('0xd3'));if(_0x4d11e3[_0xee74('0xae')]===-0x1){return _0x4d11e3;}var _0x1f1ec8=this[_0xee74('0xa5')]('RECOG_INPUT()',_0xee74('0xd4'));if(_0x1f1ec8[_0xee74('0xae')]===-0x1){return _0x1f1ec8;}var _0x529ba1=this[_0xee74('0xa5')](_0xee74('0xd1'),_0xee74('0xd5'));if(_0x529ba1['result']===-0x1){return _0x529ba1;}return this['channel'][_0xee74('0xab')](util[_0xee74('0x2a')](_0xee74('0xb6'),_0x2a36d3));};AGIVertices[_0xee74('0x11')][_0xee74('0xd6')]=function(_0x1da70d){logger['info'](util[_0xee74('0x2a')](_0xee74('0xd7'),_0x1da70d[_0xee74('0xb8')]));if(!this[_0xee74('0x85')](_0x1da70d[_0xee74('0xd8')])){return this['channel']['error'](_0x1da70d,_0xee74('0xd9'));}var _0x406645=this['getSquareOdbc'][_0xee74('0x6e')](this,_0x1da70d['odbc_id']);if(!_0x406645){return this['channel'][_0xee74('0x2d')](_0x1da70d,'no\x20odbc\x20database\x20found');}if(!this['isConfigured'](_0x1da70d[_0xee74('0x31')])){return this[_0xee74('0xe')][_0xee74('0x2d')](_0x1da70d,_0xee74('0xda'));}var _0x7f22d3=_0x1da70d[_0xee74('0x31')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0xee74('0xe')][_0xee74('0xab')](util[_0xee74('0x2a')]('query:\x20%s',_0x7f22d3));var _0xf40a7f=this[_0xee74('0xdb')][_0xee74('0x6e')](this,_0x406645,_0x7f22d3);this['createSquareDetailsReport'][_0xee74('0x6e')](this,_0x1da70d,_0x7f22d3);if(!this[_0xee74('0x85')](_0x1da70d[_0xee74('0xdc')])){return this['channel'][_0xee74('0xab')](_0xee74('0xdd'));}var _0x5cd6bc=this[_0xee74('0x12')][_0xee74('0x6e')](this,_0x1da70d['variable_id']);if(!_0x5cd6bc){return this['channel']['error'](_0x1da70d,_0xee74('0xde'));}var _0x1ca409=this;_0xf40a7f[_0xee74('0xdf')](function(_0x236482,_0x5337c1){Object[_0xee74('0xe0')](_0x236482)[_0xee74('0xdf')](function(_0x52566b){_0x1ca409[_0xee74('0xe')][_0xee74('0xa1')](util[_0xee74('0x2a')](_0xee74('0xe1'),_0x5cd6bc,_0x5337c1,_0x52566b),_0x236482[_0x52566b]);});});this['channel'][_0xee74('0xa1')](util[_0xee74('0x2a')](_0xee74('0xe2'),_0x5cd6bc),_0xf40a7f[_0xee74('0x9c')]);return this[_0xee74('0xe')][_0xee74('0xab')](util[_0xee74('0x2a')](_0xee74('0xe3'),_0x5cd6bc));};AGIVertices['prototype'][_0xee74('0xe4')]=function(_0x475d53){logger[_0xee74('0xe5')](util['format'](_0xee74('0xe6'),_0x475d53[_0xee74('0xb8')]));if(!this['isConfigured'](_0x475d53[_0xee74('0xe7')])){return this[_0xee74('0xe')][_0xee74('0x2d')](_0x475d53,'no\x20user\x20selected');}var _0x40202f=this[_0xee74('0x1c')][_0xee74('0x6e')](this,_0x475d53[_0xee74('0xe7')]);if(!_0x40202f){return this[_0xee74('0xe')][_0xee74('0x2d')](_0x475d53,_0xee74('0xe8'));}var _0x2cce30=this[_0xee74('0xe')][_0xee74('0x56')]('DIAL',[util['format'](_0xee74('0xe9'),_0x40202f),_0x475d53['timeout'],_0x475d53[_0xee74('0xea')],_0x475d53[_0xee74('0x63')]]);if(_0x2cce30[_0xee74('0xae')]===-0x1){return _0x2cce30;}return this[_0xee74('0xe')][_0xee74('0xab')](util[_0xee74('0x2a')](_0xee74('0xeb'),'DIAL'));};AGIVertices[_0xee74('0x11')][_0xee74('0xec')]=function(_0x2ebc54){logger[_0xee74('0x2f')](util[_0xee74('0x2a')](_0xee74('0xed'),_0x2ebc54[_0xee74('0xb8')]));if(!this[_0xee74('0x85')](_0x2ebc54[_0xee74('0x79')])){return this[_0xee74('0xe')][_0xee74('0xab')](_0xee74('0xee'));}if(!this['isConfigured'](_0x2ebc54['text'])){return this[_0xee74('0xe')][_0xee74('0xab')]('no\x20text\x20configured');}this[_0xee74('0xe')][_0xee74('0xef')]=!![];this[_0xee74('0x37')](_0x2ebc54);this[_0xee74('0x43')](_0x2ebc54['text'],'in','','');this['channel'][_0xee74('0xab')](util[_0xee74('0x2a')]('Trying\x20Dialogflow:\x20%s',_0x2ebc54[_0xee74('0x5b')]));var _0x1ccaa8=this[_0xee74('0x78')]['sync'](this,_0x2ebc54);if(_0x1ccaa8){for(var _0x5ea514 in _0x1ccaa8){if(_0x1ccaa8[_0xee74('0x9e')](_0x5ea514)){this[_0xee74('0xe')][_0xee74('0xa1')](util[_0xee74('0x2a')](_0xee74('0xf0'),_0x5ea514['toUpperCase']()),_0x1ccaa8[_0x5ea514]);}}this[_0xee74('0x43')](_0x1ccaa8[_0xee74('0xf1')],_0xee74('0xf2'),_0xee74('0xec'),'');return this[_0xee74('0xe')][_0xee74('0xab')](util[_0xee74('0x2a')](_0xee74('0xf3'),_0x1ccaa8[_0xee74('0xf1')]));}return this[_0xee74('0xe')][_0xee74('0x2d')](_0x2ebc54,_0xee74('0xf4'));};AGIVertices[_0xee74('0x11')]['dialogflowV2']=function(_0x5ad83f){logger[_0xee74('0x2f')](util[_0xee74('0x2a')](_0xee74('0xf5'),_0x5ad83f['label']));if(!this[_0xee74('0x85')](_0x5ad83f[_0xee74('0x7b')])){return this['channel'][_0xee74('0xab')](_0xee74('0xf6'));}if(!this['isConfigured'](_0x5ad83f[_0xee74('0x7c')])){return this[_0xee74('0xe')][_0xee74('0xab')](_0xee74('0xf7'));}if(!this[_0xee74('0x85')](_0x5ad83f[_0xee74('0x7d')])){return this['channel'][_0xee74('0xab')]('no\x20private_key\x20configured');}if(!this[_0xee74('0x85')](_0x5ad83f['dialogflowV2_language'])){return this['channel'][_0xee74('0xab')](_0xee74('0xf8'));}if(!this[_0xee74('0x85')](_0x5ad83f['text'])){return this[_0xee74('0xe')][_0xee74('0xab')](_0xee74('0xac'));}this[_0xee74('0xe')]['bot']=!![];this[_0xee74('0x37')](_0x5ad83f);this[_0xee74('0x43')](_0x5ad83f[_0xee74('0x5b')],'in','','');this[_0xee74('0xe')][_0xee74('0xab')](util[_0xee74('0x2a')]('Trying\x20DialogflowV2:\x20%s',_0x5ad83f[_0xee74('0x5b')]));var _0x375c49=this[_0xee74('0x7a')][_0xee74('0x6e')](this,_0x5ad83f);if(_0x375c49){for(var _0x15d8fb in _0x375c49){if(_0x375c49[_0xee74('0x9e')](_0x15d8fb)){if(_0x15d8fb!==_0xee74('0xf9')){this['channel'][_0xee74('0xa1')](util[_0xee74('0x2a')](_0xee74('0xf0'),_0x15d8fb['toUpperCase']()),_0x375c49[_0x15d8fb]);}}}this[_0xee74('0x43')](_0x375c49['speech'],_0xee74('0xf2'),_0xee74('0xfa'),_0x375c49['providerResponse']);return this[_0xee74('0xe')][_0xee74('0xab')](util['format'](_0xee74('0xfb'),_0x375c49[_0xee74('0xf1')]));}return this[_0xee74('0xe')][_0xee74('0x2d')](_0x5ad83f,_0xee74('0xfc'));};AGIVertices[_0xee74('0x11')]['sesteknda']=function(_0xc36fc){logger['info'](util['format'](_0xee74('0xfd'),_0xc36fc['label']));if(!this[_0xee74('0x85')](_0xc36fc[_0xee74('0xfe')])){return this[_0xee74('0xe')]['noop'](_0xee74('0xff'));}if(!this[_0xee74('0x85')](_0xc36fc[_0xee74('0x100')])){return this[_0xee74('0xe')][_0xee74('0xab')](_0xee74('0x101'));}if(!this[_0xee74('0x85')](_0xc36fc['password'])){return this['channel'][_0xee74('0xab')]('no\x20password\x20configured');}if(!this[_0xee74('0x85')](_0xc36fc[_0xee74('0x102')])){return this[_0xee74('0xe')]['noop'](_0xee74('0xac'));}this[_0xee74('0xe')]['bot']=!![];this[_0xee74('0x37')](_0xc36fc);this[_0xee74('0x43')](_0xc36fc[_0xee74('0x5b')],'in','','');this[_0xee74('0xe')][_0xee74('0xab')](util[_0xee74('0x2a')]('Trying\x20SestekNDA:\x20%s',_0xc36fc[_0xee74('0x5b')]));var _0x5028de=this[_0xee74('0x7f')][_0xee74('0x6e')](this,_0xc36fc);if(_0x5028de){for(var _0x2902bf in _0x5028de){if(_0x5028de[_0xee74('0x9e')](_0x2902bf)){this[_0xee74('0xe')][_0xee74('0xa1')](util[_0xee74('0x2a')]('SESTEK_NDA_%s',_0x2902bf['toUpperCase']()),_0x5028de[_0x2902bf]);}}this[_0xee74('0x43')](_0x5028de[_0xee74('0xf1')],_0xee74('0xf2'),_0xee74('0x103'),'');if(_0x5028de[_0xee74('0x104')]){this[_0xee74('0xe')][_0xee74('0xab')](util[_0xee74('0x2a')](_0xee74('0x105'),_0x5028de[_0xee74('0x104')]));var _0x5821d1=this['channel'][_0xee74('0x106')](_0x5028de['audiofile']);try{fs['unlink'](_0x5028de[_0xee74('0x104')]+_0xee74('0x107'));}catch(_0x115d27){logger[_0xee74('0x2d')](_0x115d27);}return _0x5821d1;}else{return this[_0xee74('0xe')]['noop'](util[_0xee74('0x2a')]('SestekNDA\x20Result\x20%s',_0x5028de[_0xee74('0xf1')]));}}return this['channel'][_0xee74('0x2d')](_0xc36fc,_0xee74('0x108'));};AGIVertices[_0xee74('0x11')][_0xee74('0x109')]=function(_0x2f0af1){logger['info'](util[_0xee74('0x2a')](_0xee74('0x10a'),_0x2f0af1[_0xee74('0xb8')]));return this[_0xee74('0xe')]['noop'](_0xee74('0x109'));};AGIVertices[_0xee74('0x11')][_0xee74('0x10b')]=function(_0x31cd74){logger['info'](util[_0xee74('0x2a')](_0xee74('0x10c'),_0x31cd74['label']));var _0x27bfac='';if(_0x31cd74['trunk_id']){if(!this[_0xee74('0x85')](_0x31cd74['trunk_id'])){return this['channel'][_0xee74('0x2d')](_0x31cd74,_0xee74('0x10d'));}else{var _0x2b4aff=parseInt(_0x31cd74[_0xee74('0x10e')],0xa);if(isNaN(_0x2b4aff)){_0x27bfac=_0x31cd74[_0xee74('0x10e')];}else{_0x27bfac=this[_0xee74('0x1d')][_0xee74('0x6e')](this,_0x31cd74['trunk_id']);if(!_0x27bfac){return this[_0xee74('0xe')][_0xee74('0x2d')](_0x31cd74,'no\x20trunk\x20found');}}}}else if(_0x31cd74[_0xee74('0x10f')]){_0x27bfac=_0x31cd74[_0xee74('0x10f')];}else{return this[_0xee74('0xe')][_0xee74('0x2d')](_0x31cd74,_0xee74('0x10d'));}var _0x1346a0=this[_0xee74('0xe')][_0xee74('0x56')](_0xee74('0x110'),[util[_0xee74('0x2a')](_0xee74('0x111'),_0x27bfac,_0x31cd74[_0xee74('0x49')]),_0x31cd74[_0xee74('0xbc')],_0x31cd74[_0xee74('0xea')],_0x31cd74['url']]);if(_0x1346a0['result']===-0x1){return _0x1346a0;}return this[_0xee74('0xe')]['noop'](util[_0xee74('0x2a')](_0xee74('0xeb'),_0xee74('0x110')));};AGIVertices[_0xee74('0x11')][_0xee74('0x112')]=function(_0x2e7b9e){logger[_0xee74('0x2f')](util[_0xee74('0x2a')](_0xee74('0x113'),_0x2e7b9e[_0xee74('0xb8')]));return this[_0xee74('0xe')][_0xee74('0xab')](_0xee74('0x112'));};AGIVertices[_0xee74('0x11')][_0xee74('0xc')]=function(_0x1291c7){logger[_0xee74('0x2f')](util[_0xee74('0x2a')](_0xee74('0x114'),_0x1291c7[_0xee74('0xb8')]));if(_0x1291c7[_0xee74('0xa8')]===0x0){return this[_0xee74('0xa7')](_0x1291c7);}_0x1291c7['retry']-=0x1;if(!this[_0xee74('0x85')](_0x1291c7[_0xee74('0x115')])){return this[_0xee74('0xe')][_0xee74('0x2d')](_0x1291c7,'no\x20file\x20audio\x20selected');}var _0x23d798=this[_0xee74('0x1f')]['sync'](this,_0x1291c7[_0xee74('0x115')]);if(!_0x23d798){return this['channel'][_0xee74('0x2d')](_0x1291c7,_0xee74('0x116'));}if(!this[_0xee74('0x85')](_0x1291c7[_0xee74('0xdc')])){return this[_0xee74('0xe')]['error'](_0xee74('0xdd'));}var _0x52ef22=this[_0xee74('0xe')][_0xee74('0x117')](_0x23d798,_0x1291c7['response'],_0x1291c7[_0xee74('0x118')]);var _0x33e1cd=_0x52ef22[_0xee74('0xae')]?_0x52ef22[_0xee74('0xae')][_0xee74('0x4d')]():'';logger[_0xee74('0x2f')](_0xee74('0x119'),JSON[_0xee74('0x71')](_0x52ef22));if(_0x52ef22['result']===-0x1){this[_0xee74('0x37')][_0xee74('0x6e')](this,_0x1291c7,_0x33e1cd);return _0x52ef22;}else if(_0x52ef22[_0xee74('0xa4')]===_0xee74('0xbc')){_0x52ef22[_0xee74('0xae')]=_0x33e1cd['length']>=parseInt(_0x1291c7['mindigit'])?'x':'i';}else{_0x52ef22['result']=_0x33e1cd[_0xee74('0x9c')]>=parseInt(_0x1291c7[_0xee74('0x11a')])&&_0x33e1cd[_0xee74('0x9c')]<=parseInt(_0x1291c7[_0xee74('0x118')])?'x':'i';}var _0x4b507d=this['getVariable'][_0xee74('0x6e')](this,_0x1291c7[_0xee74('0xdc')]);if(!_0x4b507d){return this[_0xee74('0xe')]['error'](_0x1291c7,_0xee74('0xde'));}this[_0xee74('0xe')][_0xee74('0xa1')](_0x4b507d,_0x33e1cd);if(this[_0xee74('0x85')](_0x1291c7[_0xee74('0x11b')])){var _0x5f35f8=parseInt(_0x1291c7[_0xee74('0x11b')],0xa);var _0x20ae44=rs[_0xee74('0x11c')]({'charset':'*','length':_0x5f35f8});var _0x200dfb=_0x33e1cd[_0xee74('0x9c')];if(_0x200dfb>0x0){if(_0x200dfb>_0x5f35f8){this['createSquareDetailsReport'][_0xee74('0x6e')](this,_0x1291c7,_0x1291c7['hiddendigitspos']==='first'?_0x20ae44+_0x33e1cd[_0xee74('0x11d')](_0x5f35f8):_0x33e1cd[_0xee74('0x11d')](0x0,_0x200dfb-_0x5f35f8)+_0x20ae44);}else{this[_0xee74('0x37')][_0xee74('0x6e')](this,_0x1291c7,rs[_0xee74('0x11c')]({'charset':'*','length':_0x200dfb}));}}else{this[_0xee74('0x37')][_0xee74('0x6e')](this,_0x1291c7,'');}}else{this[_0xee74('0x37')]['sync'](this,_0x1291c7,_0x33e1cd);}return _0x52ef22;};AGIVertices[_0xee74('0x11')]['getsecretdigits']=function(_0x575a2f){logger[_0xee74('0x2f')](util[_0xee74('0x2a')](_0xee74('0x11e'),_0x575a2f[_0xee74('0xb8')]));return this[_0xee74('0xc')](_0x575a2f);};AGIVertices[_0xee74('0x11')][_0xee74('0x11f')]=function(_0x46b9e4){logger[_0xee74('0x2f')](util[_0xee74('0x2a')](_0xee74('0x120'),_0x46b9e4[_0xee74('0xb8')]));this[_0xee74('0x37')][_0xee74('0x6e')](this,_0x46b9e4,_0x46b9e4[_0xee74('0x121')]);return this['channel'][_0xee74('0xab')](util[_0xee74('0x2a')](_0xee74('0x122'),_0x46b9e4['goalname']));};AGIVertices[_0xee74('0x11')]['awspolly']=function(_0x3c81d3){logger[_0xee74('0x2f')](util[_0xee74('0x2a')](_0xee74('0x123'),_0x3c81d3[_0xee74('0xb8')]));if(!this[_0xee74('0x85')](_0x3c81d3[_0xee74('0x8e')])||!this[_0xee74('0x85')](_0x3c81d3['aws_secret_access_key'])){return this[_0xee74('0xe')][_0xee74('0xab')](_0xee74('0x124'));}if(!this[_0xee74('0x85')](_0x3c81d3[_0xee74('0x5b')])){return this[_0xee74('0xe')][_0xee74('0xab')](_0xee74('0xac'));}this[_0xee74('0xe')][_0xee74('0xab')](util[_0xee74('0x2a')](_0xee74('0x125'),_0x3c81d3[_0xee74('0x5b')]));var _0x2dfdbc=this['awsPolly']['sync'](this,_0x3c81d3);if(_0x2dfdbc){this[_0xee74('0xe')][_0xee74('0xab')](util[_0xee74('0x2a')](_0xee74('0x126'),_0x2dfdbc));var _0x5d5296=this['channel'][_0xee74('0x106')](_0x2dfdbc);try{fs[_0xee74('0x127')](_0x2dfdbc+'.wav');}catch(_0x3bc94b){logger[_0xee74('0x2d')](_0x3bc94b);}return _0x5d5296;}return this[_0xee74('0xe')][_0xee74('0x2d')](_0x3c81d3,_0xee74('0x128'));};AGIVertices[_0xee74('0x11')][_0xee74('0x129')]=function(_0x29c13c){logger[_0xee74('0x2f')](util['format'](_0xee74('0x12a'),_0x29c13c['label']));if(!this[_0xee74('0x85')](_0x29c13c[_0xee74('0x8e')])||!this['isConfigured'](_0x29c13c[_0xee74('0x88')])){return this[_0xee74('0xe')][_0xee74('0xab')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xee74('0x85')](_0x29c13c[_0xee74('0x90')])){return this[_0xee74('0xe')][_0xee74('0xab')](_0xee74('0x12b'));}if(!this[_0xee74('0x85')](_0x29c13c[_0xee74('0x5b')])){return this['channel'][_0xee74('0xab')](_0xee74('0xac'));}this[_0xee74('0xe')]['bot']=!![];this['createSquareDetailsReport'](_0x29c13c);this[_0xee74('0x43')](_0x29c13c[_0xee74('0x5b')],'in','','');this[_0xee74('0xe')][_0xee74('0xab')](util[_0xee74('0x2a')](_0xee74('0x12c'),_0x29c13c[_0xee74('0x5b')]));var _0xe94484=this[_0xee74('0x8d')][_0xee74('0x6e')](this,_0x29c13c);if(_0xe94484){for(var _0x293dbf in _0xe94484){if(_0xe94484[_0xee74('0x9e')](_0x293dbf)&&_['isString'](_0xe94484[_0x293dbf])){this[_0xee74('0xe')][_0xee74('0xa1')](util[_0xee74('0x2a')](_0xee74('0x12d'),_0x293dbf[_0xee74('0x67')]()),_0xe94484[_0x293dbf]);}}if(_[_0xee74('0x46')](_0xe94484['message'])){return this[_0xee74('0xe')][_0xee74('0xab')](_0xee74('0x12e'));}else{this[_0xee74('0x43')](_0xe94484[_0xee74('0x75')],_0xee74('0xf2'),'amazonlex','');return this[_0xee74('0xe')][_0xee74('0xab')](util[_0xee74('0x2a')]('Amazon\x20Lex\x20Result\x20%s',_0xe94484[_0xee74('0x75')]));}}return this['channel'][_0xee74('0x2d')](_0x29c13c,_0xee74('0x12f'));};AGIVertices[_0xee74('0x11')]['googleasr']=function(_0x33dd34){logger[_0xee74('0x2f')](util[_0xee74('0x2a')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x33dd34[_0xee74('0xb8')],_0x33dd34[_0xee74('0xbc')]));if(!this[_0xee74('0x85')](_0x33dd34[_0xee74('0x79')])){return this[_0xee74('0xe')][_0xee74('0xab')](_0xee74('0xee'));}var _0x950327=_0xee74('0x130');var _0x5a288a=util[_0xee74('0x2a')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x4a0e1e=util[_0xee74('0x2a')](_0xee74('0xa0'),_0x5a288a,_0x950327);var _0x3ea74e=!![];if(_0x33dd34[_0xee74('0x131')]==='NOBEEP'){_0x3ea74e=![];}var _0x4421e6=this[_0xee74('0xe')][_0xee74('0x132')](_0x5a288a,_0x950327,_0x33dd34[_0xee74('0x133')],_0x33dd34[_0xee74('0xbc')],undefined,_0x3ea74e);if(_0x4421e6[_0xee74('0xae')]!==-0x1){this[_0xee74('0xe')][_0xee74('0xab')](util['format'](_0xee74('0x134'),_0x4a0e1e));var _0x21af98=this[_0xee74('0x91')]['sync'](this,_0x33dd34,_0x4a0e1e);if(_0x21af98){for(var _0x3ddd93 in _0x21af98){if(_0x21af98['hasOwnProperty'](_0x3ddd93)){this[_0xee74('0xe')][_0xee74('0xa1')](util[_0xee74('0x2a')](_0xee74('0x135'),_0x3ddd93[_0xee74('0x67')]()),_0x21af98[_0x3ddd93]);}}return this[_0xee74('0xe')][_0xee74('0xab')](util[_0xee74('0x2a')](_0xee74('0x136'),JSON[_0xee74('0x71')](_0x21af98)));}}return _0x4421e6;};AGIVertices[_0xee74('0x11')][_0xee74('0x137')]=function(_0x1f711e){logger[_0xee74('0x2f')](util[_0xee74('0x2a')](_0xee74('0x138'),_0x1f711e[_0xee74('0xb8')]));if(!this['isConfigured'](_0x1f711e[_0xee74('0x94')])){return this[_0xee74('0xe')]['noop']('no\x20appid\x20configured');}if(!this['isConfigured'](_0x1f711e[_0xee74('0x95')])){return this[_0xee74('0xe')][_0xee74('0xab')](_0xee74('0x139'));}var _0xc0a20e=_0xee74('0x130');var _0x871ddc=util['format'](_0xee74('0x13a'),FILES_PATH,rs['generate'](0x4));var _0x192890=util['format']('%s.%s',_0x871ddc,_0xc0a20e);var _0x336fff=!![];if(_0x1f711e[_0xee74('0x131')]===_0xee74('0x13b')){_0x336fff=![];}var _0x321086=this[_0xee74('0xe')][_0xee74('0x132')](_0x871ddc,_0xc0a20e,_0x1f711e['intKey'],_0x1f711e['timeout'],undefined,_0x336fff);if(_0x321086['result']!==-0x1){this[_0xee74('0xe')][_0xee74('0xab')](util['format'](_0xee74('0x13c'),_0x192890));var _0x2acde8=this[_0xee74('0x93')][_0xee74('0x6e')](this,_0x1f711e,_0x192890);if(_0x2acde8){for(var _0x1d3268 in _0x2acde8){if(_0x2acde8[_0xee74('0x9e')](_0x1d3268)){this[_0xee74('0xe')][_0xee74('0xa1')](util[_0xee74('0x2a')]('TILDE_ASR_%s',_0x1d3268[_0xee74('0x67')]()),_0x2acde8[_0x1d3268]);}}return this[_0xee74('0xe')][_0xee74('0xab')](util[_0xee74('0x2a')](_0xee74('0x13d'),JSON[_0xee74('0x71')](_0x2acde8)));}}return _0x321086;};AGIVertices[_0xee74('0x11')][_0xee74('0x13e')]=function(_0x278824){logger[_0xee74('0x2f')](util['format'](_0xee74('0x13f'),_0x278824[_0xee74('0xb8')]));return this[_0xee74('0xe')][_0xee74('0x140')](_0x278824[_0xee74('0x3e')],_0x278824[_0xee74('0x3f')],_0x278824['priority']);};AGIVertices['prototype'][_0xee74('0x141')]=function(_0x1fae0b){logger[_0xee74('0x2f')](util[_0xee74('0x2a')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x1fae0b['label']));if(!this[_0xee74('0x85')](_0x1fae0b[_0xee74('0x142')])){return this[_0xee74('0xe')][_0xee74('0x2d')](_0x1fae0b,_0xee74('0x143'));}try{var _0x465401=eval(_0x1fae0b['condition'])?_0xee74('0x144'):'false';this[_0xee74('0xe')][_0xee74('0xab')](util[_0xee74('0x2a')](_0xee74('0x145'),_0x1fae0b[_0xee74('0x142')],_0x465401));return{'code':0xc8,'result':_0x465401};}catch(_0x4bea74){return{'code':0xc8,'result':_0xee74('0x146')};}};AGIVertices[_0xee74('0x11')][_0xee74('0x147')]=function(_0x36de58){logger[_0xee74('0x2f')](util['format'](_0xee74('0x148'),_0x36de58[_0xee74('0xb8')]));if(!this['isConfigured'](_0x36de58[_0xee74('0x149')])){return this['channel']['error'](_0x36de58,'no\x20interval\x20configured');}var _0x1ff3ae=this['getIntervals'][_0xee74('0x6e')](this,_0x36de58[_0xee74('0x149')]);if(!_0x1ff3ae){return this[_0xee74('0xe')]['error'](_0x36de58,'no\x20intervals\x20found');}for(var _0x119691=0x0;_0x119691<_0x1ff3ae[_0xee74('0x9c')];_0x119691+=0x1){var _0x3cfa97=this[_0xee74('0xe')]['getVariable'](util[_0xee74('0x2a')](_0xee74('0x14a'),_0x1ff3ae[_0x119691]));if(_0x3cfa97[_0xee74('0xae')]===-0x1){return _0x3cfa97;}logger[_0xee74('0x2f')](util['format'](_0xee74('0x14b'),_0x1ff3ae[_0x119691],_0x3cfa97[_0xee74('0xa4')]));if(_0x3cfa97[_0xee74('0xa4')]==='true'){logger[_0xee74('0x2f')](util[_0xee74('0x2a')]('IFTIME\x20%s\x20%s',_0x1ff3ae[_0x119691],_0xee74('0x144')));this['channel'][_0xee74('0xab')](util[_0xee74('0x2a')]('IFTIME\x20%s\x20%s',_0x1ff3ae[_0x119691],_0xee74('0x144')));return{'code':0xc8,'result':'true'};}else{logger['info'](util[_0xee74('0x2a')](_0xee74('0x14b'),_0x1ff3ae[_0x119691],_0xee74('0x146')));this['channel'][_0xee74('0xab')](util['format']('IFTIME\x20%s\x20%s',_0x1ff3ae[_0x119691],_0xee74('0x146')));}}return{'code':0xc8,'result':_0xee74('0x146')};};AGIVertices[_0xee74('0x11')][_0xee74('0x14c')]=function(_0x2db0fa){logger['info'](util[_0xee74('0x2a')](_0xee74('0x14d'),_0x2db0fa[_0xee74('0xb8')]));return this['channel']['hangup']();};AGIVertices['prototype'][_0xee74('0x14e')]=function(_0x61bb61){logger['info'](util[_0xee74('0x2a')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x61bb61[_0xee74('0xb8')]));if(!this[_0xee74('0x85')](_0x61bb61['key'])){return this[_0xee74('0xe')][_0xee74('0xab')]('no\x20key\x20configured');}var _0x487ea9='wav';var _0x5d9bc7=util[_0xee74('0x2a')](_0xee74('0x13a'),FILES_PATH,rs['generate'](0x4));var _0x59d10e=util['format'](_0xee74('0xa0'),_0x5d9bc7,_0x487ea9);var _0x2b2572=!![];if(_0x61bb61[_0xee74('0x131')]==='NOBEEP'){_0x2b2572=![];}var _0x96c76=this[_0xee74('0xe')][_0xee74('0x132')](_0x5d9bc7,_0x487ea9,_0x61bb61['intKey'],_0x61bb61[_0xee74('0xbc')],undefined,_0x2b2572);if(_0x96c76['result']!==-0x1){this[_0xee74('0xe')][_0xee74('0xab')](util['format']('ispeech\x20%s\x20file\x20created',_0x59d10e));var _0x10a14e=this[_0xee74('0x84')][_0xee74('0x6e')](this,_0x61bb61,_0x59d10e);if(_0x10a14e){for(var _0x2b7ad5 in _0x10a14e){if(_0x10a14e[_0xee74('0x9e')](_0x2b7ad5)){this[_0xee74('0xe')][_0xee74('0xa1')](util[_0xee74('0x2a')](_0xee74('0x14f'),_0x2b7ad5['toUpperCase']()),_0x10a14e[_0x2b7ad5]);}}return this[_0xee74('0xe')][_0xee74('0xab')](util[_0xee74('0x2a')](_0xee74('0x150'),JSON[_0xee74('0x71')](_0x10a14e)));}}return _0x96c76;};AGIVertices[_0xee74('0x11')]['ispeechtts']=function(_0x4be40d){logger[_0xee74('0x2f')](util[_0xee74('0x2a')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x4be40d[_0xee74('0xb8')]));if(!this[_0xee74('0x85')](_0x4be40d[_0xee74('0x79')])){return this[_0xee74('0xe')][_0xee74('0xab')](_0xee74('0xee'));}if(!this[_0xee74('0x85')](_0x4be40d[_0xee74('0x5b')])){return this['channel'][_0xee74('0xab')](_0xee74('0xac'));}this[_0xee74('0xe')]['noop'](util[_0xee74('0x2a')](_0xee74('0x151'),_0x4be40d['text']));var _0x331334=this['ispeechTTS'][_0xee74('0x6e')](this,_0x4be40d);if(_0x331334){this[_0xee74('0xe')][_0xee74('0xab')](util['format'](_0xee74('0x152'),_0x331334));var _0x5013a4=this[_0xee74('0xe')][_0xee74('0x106')](_0x331334,_0x4be40d[_0xee74('0x133')]);try{fs[_0xee74('0x127')](_0x331334+_0xee74('0x107'));}catch(_0x58d3e){logger[_0xee74('0x2d')](_0x58d3e);}return _0x5013a4;}return this[_0xee74('0xe')][_0xee74('0x2d')](_0x4be40d,_0xee74('0x153'));};AGIVertices[_0xee74('0x11')]['login']=function(_0x4ee5d3){logger[_0xee74('0x2f')](util['format']('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x4ee5d3[_0xee74('0xb8')]));if(!this[_0xee74('0x85')](_0x4ee5d3[_0xee74('0x154')])){return this['channel'][_0xee74('0x2d')](_0x4ee5d3,_0xee74('0x155'));}logger[_0xee74('0x2f')](util[_0xee74('0x2a')](_0xee74('0x156'),this[_0xee74('0xe')][_0xee74('0x3b')],_0x4ee5d3[_0xee74('0x154')]));var _0xcc5eba=this['agentLogin'][_0xee74('0x6e')](this,_0x4ee5d3['findBy']);if(_0xcc5eba){logger['info'](util[_0xee74('0x2a')](_0xee74('0x157'),this[_0xee74('0xe')][_0xee74('0x3b')],_0x4ee5d3[_0xee74('0x154')]));this['channel'][_0xee74('0xab')](util[_0xee74('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xee74('0xe')][_0xee74('0x3b')],_0x4ee5d3[_0xee74('0x154')]));return{'code':0xc8,'result':_0xee74('0x158')};}else{logger['info'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xee74('0xe')][_0xee74('0x3b')],_0x4ee5d3[_0xee74('0x154')]));this[_0xee74('0xe')]['noop'](util[_0xee74('0x2a')](_0xee74('0x159'),this[_0xee74('0xe')][_0xee74('0x3b')],_0x4ee5d3[_0xee74('0x154')]));return{'code':0xc8,'result':_0xee74('0x15a')};}};AGIVertices['prototype'][_0xee74('0x15b')]=function(_0x38dc37){logger[_0xee74('0x2f')](util[_0xee74('0x2a')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x38dc37[_0xee74('0xb8')]));if(!this[_0xee74('0x85')](_0x38dc37[_0xee74('0x154')])){return this[_0xee74('0xe')][_0xee74('0x2d')](_0x38dc37,'no\x20find\x20by\x20configured');}logger[_0xee74('0x2f')](util[_0xee74('0x2a')](_0xee74('0x156'),this['channel'][_0xee74('0x3b')],_0x38dc37['findBy']));var _0x42f825=this[_0xee74('0x52')][_0xee74('0x6e')](this,_0x38dc37[_0xee74('0x154')]);if(_0x42f825){logger[_0xee74('0x2f')](util[_0xee74('0x2a')](_0xee74('0x157'),this[_0xee74('0xe')][_0xee74('0x3b')],_0x38dc37['findBy']));this[_0xee74('0xe')][_0xee74('0xab')](util['format'](_0xee74('0x157'),this[_0xee74('0xe')]['callerid'],_0x38dc37[_0xee74('0x154')]));return{'code':0xc8,'result':_0xee74('0x158')};}else{logger[_0xee74('0x2f')](util[_0xee74('0x2a')](_0xee74('0x159'),this['channel']['callerid'],_0x38dc37[_0xee74('0x154')]));this[_0xee74('0xe')][_0xee74('0xab')](util['format'](_0xee74('0x159'),this[_0xee74('0xe')][_0xee74('0x3b')],_0x38dc37[_0xee74('0x154')]));return{'code':0xc8,'result':_0xee74('0x15a')};}};AGIVertices[_0xee74('0x11')][_0xee74('0x15c')]=function(_0x52d709){logger['info'](util[_0xee74('0x2a')](_0xee74('0x15d'),_0x52d709[_0xee74('0xb8')]));if(!this['isConfigured'](_0x52d709[_0xee74('0x15e')])){return this['channel'][_0xee74('0x2d')](_0x52d709,_0xee74('0x15f'));}this[_0xee74('0xe')][_0xee74('0xab')](util[_0xee74('0x2a')](_0xee74('0x160'),_0x52d709[_0xee74('0x15e')]));var _0x14167e=eval(_0x52d709[_0xee74('0x15e')]);if(!this[_0xee74('0x85')](_0x52d709[_0xee74('0xdc')])){return this[_0xee74('0xe')][_0xee74('0xab')](_0xee74('0xdd'));}var _0x56c672=this[_0xee74('0x12')][_0xee74('0x6e')](this,_0x52d709['variable_id']);if(!_0x56c672){return this[_0xee74('0xe')][_0xee74('0x2d')](_0x52d709,_0xee74('0xde'));}if(_[_0xee74('0x9f')](_0x14167e)){var _0x528aa9=this;_0x14167e[_0xee74('0xdf')](function(_0x1bd337,_0x3093f3){_0x528aa9[_0xee74('0xe')]['setVariable'](util['format'](_0xee74('0x161'),_0x56c672,_0x3093f3),_0x1bd337);});return this[_0xee74('0xe')][_0xee74('0xab')](util[_0xee74('0x2a')](_0xee74('0x162'),_0x56c672));}else{return this[_0xee74('0xe')][_0xee74('0xa1')](_0x56c672,_0x14167e);}};AGIVertices[_0xee74('0x11')][_0xee74('0x163')]=function(_0x33d77b){logger[_0xee74('0x2f')](util[_0xee74('0x2a')](_0xee74('0x164'),_0x33d77b[_0xee74('0xb8')]));if(_0x33d77b['retry']===0x0){return this['maxRetry'](_0x33d77b);}_0x33d77b['retry']-=0x1;if(!this['isConfigured'](_0x33d77b[_0xee74('0x115')])){return this[_0xee74('0xe')][_0xee74('0x2d')](_0x33d77b,_0xee74('0x165'));}var _0x45bc61=this[_0xee74('0x1f')]['sync'](this,_0x33d77b[_0xee74('0x115')]);if(!_0x45bc61){return this[_0xee74('0xe')][_0xee74('0x2d')](_0x33d77b,_0xee74('0x116'));}var _0x1dafba=this[_0xee74('0xe')]['getData'](_0x45bc61,_0x33d77b['response'],_0x33d77b[_0xee74('0x166')]);var _0x3016a3=_0x1dafba[_0xee74('0xae')];if(_0x1dafba[_0xee74('0xae')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0x33d77b,'-1');return _0x1dafba;}else if(_0x1dafba[_0xee74('0xa4')]===_0xee74('0xbc')){_0x1dafba[_0xee74('0xae')]=_0x1dafba[_0xee74('0xae')][_0xee74('0x9c')]>0x0?_0x1dafba[_0xee74('0xae')]:'t';}else if(_[_0xee74('0x45')](_0x1dafba[_0xee74('0xae')])){_0x1dafba['result']='#';_0x3016a3='#';}if(!this[_0xee74('0x85')](_0x33d77b[_0xee74('0xdc')])){this['channel'][_0xee74('0xab')](_0xee74('0xdd'));}else{var _0x139ac3=this[_0xee74('0x12')][_0xee74('0x6e')](this,_0x33d77b[_0xee74('0xdc')]);if(!_0x139ac3){return this['channel'][_0xee74('0x2d')](_0x33d77b,'no\x20variable\x20found');}this[_0xee74('0xe')][_0xee74('0xa1')](_0x139ac3,_0x3016a3);}this['createSquareDetailsReport'][_0xee74('0x6e')](this,_0x33d77b,_0x3016a3);return _0x1dafba;};AGIVertices['prototype'][_0xee74('0xab')]=function(_0x3c5913){logger[_0xee74('0x2f')](util[_0xee74('0x2a')](_0xee74('0x167'),_0x3c5913[_0xee74('0xb8')]));return this[_0xee74('0xe')][_0xee74('0xab')](_0x3c5913[_0xee74('0x168')]||_0x3c5913[_0xee74('0xb8')]);};AGIVertices[_0xee74('0x11')][_0xee74('0x169')]=function(_0xbc9a0c){logger[_0xee74('0x2f')](util['format'](_0xee74('0x16a'),_0xbc9a0c[_0xee74('0xb8')]));if(!this[_0xee74('0x85')](_0xbc9a0c['findBy'])){return this['channel'][_0xee74('0x2d')](_0xbc9a0c,'no\x20find\x20by\x20configured');}logger['info'](util[_0xee74('0x2a')](_0xee74('0x156'),this[_0xee74('0xe')]['callerid'],_0xbc9a0c[_0xee74('0x154')]));var _0x526087=this[_0xee74('0x16b')]['sync'](this,_0xbc9a0c[_0xee74('0x16c')]);var _0xbb2732=this[_0xee74('0x4f')][_0xee74('0x6e')](this,_0xbc9a0c[_0xee74('0x154')],_0x526087);if(_0xbb2732){logger[_0xee74('0x2f')](util[_0xee74('0x2a')](_0xee74('0x157'),this[_0xee74('0xe')][_0xee74('0x3b')],_0xbc9a0c[_0xee74('0x154')]));this['channel'][_0xee74('0xab')](util['format'](_0xee74('0x157'),this['channel']['callerid'],_0xbc9a0c[_0xee74('0x154')]));return{'code':0xc8,'result':_0xee74('0x158')};}else{logger[_0xee74('0x2f')](util[_0xee74('0x2a')](_0xee74('0x159'),this['channel']['callerid'],_0xbc9a0c[_0xee74('0x154')]));this['channel'][_0xee74('0xab')](util[_0xee74('0x2a')](_0xee74('0x157'),this[_0xee74('0xe')][_0xee74('0x3b')],_0xbc9a0c[_0xee74('0x154')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xee74('0x11')][_0xee74('0x16d')]=function(_0x3a1fea){logger[_0xee74('0x2f')](util['format'](_0xee74('0x16e'),_0x3a1fea[_0xee74('0xb8')]));if(!this[_0xee74('0x85')](_0x3a1fea[_0xee74('0x115')])){return this['channel']['error'](_0x3a1fea,_0xee74('0x165'));}var _0x3d340a=this[_0xee74('0x1f')][_0xee74('0x6e')](this,_0x3a1fea[_0xee74('0x115')]);if(!_0x3d340a){return this['channel'][_0xee74('0x2d')](_0x3a1fea,_0xee74('0x116'));}var _0x6f24df=this[_0xee74('0xe')][_0xee74('0x56')](_0xee74('0x16f'),[_0x3d340a,_0x3a1fea[_0xee74('0xea')]]);if(_0x6f24df['result']===-0x1){return _0x6f24df;}return this[_0xee74('0xe')]['noop'](util[_0xee74('0x2a')](_0xee74('0xc7'),_0xee74('0x16f'),_0x3d340a));};AGIVertices['prototype'][_0xee74('0x170')]=function(_0x191be0){logger[_0xee74('0x2f')](util[_0xee74('0x2a')](_0xee74('0x171'),_0x191be0['label']));if(!this[_0xee74('0x85')](_0x191be0[_0xee74('0x172')])){return this[_0xee74('0xe')]['error'](_0x191be0,_0xee74('0x173'));}var _0x32a766='';var _0x17270=parseInt(_0x191be0[_0xee74('0x172')],0xa);if(isNaN(_0x17270)){_0x32a766=_0x191be0[_0xee74('0x172')];}else{_0x32a766=this['getVoiceQueue'][_0xee74('0x6e')](this,_0x191be0[_0xee74('0x172')]);if(!_0x32a766){return this[_0xee74('0xe')][_0xee74('0x2d')](_0x191be0,_0xee74('0x174'));}}var _0x2dab4a='';if(this[_0xee74('0x85')](_0x191be0[_0xee74('0x115')])){var _0x5d6fe7=this['getSound']['sync'](this,_0x191be0[_0xee74('0x115')]);if(_0x5d6fe7){_0x2dab4a=_0x5d6fe7;}}this['createSquareDetailsReport'][_0xee74('0x6e')](this,_0x191be0,_0x32a766);if(_0x191be0[_0xee74('0xea')][_0xee74('0x175')]('x')<0x0){_0x191be0[_0xee74('0xea')]+='x';}if(_0x191be0[_0xee74('0xea')][_0xee74('0x175')]('X')<0x0){_0x191be0['opts']+='X';}this[_0xee74('0xe')][_0xee74('0xa1')](_0xee74('0x176'),_0x32a766?_0x32a766[_0xee74('0x177')]():'');var _0x24d08c=this['channel'][_0xee74('0x56')](_0xee74('0x178'),[_0x32a766,_0x191be0[_0xee74('0xea')],_0x191be0['url'],_0x2dab4a,_0x191be0[_0xee74('0xbc')],_0x191be0['agi'],_0x191be0[_0xee74('0x179')],_0x191be0['gosub'],'',_0x191be0[_0xee74('0x17a')]]);if(_0x24d08c[_0xee74('0xae')]===-0x1){return _0x24d08c;}return this[_0xee74('0xe')][_0xee74('0xab')](util[_0xee74('0x2a')](_0xee74('0xc7'),_0xee74('0x178'),_0x32a766));};AGIVertices[_0xee74('0x11')][_0xee74('0x17b')]=function(_0x11271f){logger[_0xee74('0x2f')](util[_0xee74('0x2a')](_0xee74('0x17c'),_0x11271f[_0xee74('0xb8')]));var _0xbf71d=_0x11271f[_0xee74('0x17d')]||_0xee74('0x130');var _0x388468=util[_0xee74('0x2a')](_0xee74('0x17e'),this[_0xee74('0xe')][_0xee74('0x38')],rs['generate'](0x5));var _0x144d6e=util[_0xee74('0x2a')]('%s/recordings/%s.%s',FILES_PATH,_0x388468,_0xbf71d);var _0x384e89=util[_0xee74('0x2a')](_0xee74('0x13a'),FILES_PATH,_0x388468);this[_0xee74('0x3c')][_0xee74('0x6e')](this,_0x11271f,_0x388468,_0x144d6e);this[_0xee74('0xe')][_0xee74('0xa1')]('RECORDING_SAVENAME',_0x388468);logger['info'](_0xee74('0x17f'),_0x384e89,_0xbf71d,_0x11271f[_0xee74('0x180')],_0x11271f[_0xee74('0xbc')]);return this[_0xee74('0xe')][_0xee74('0x132')](_0x384e89,_0xbf71d,_0x11271f[_0xee74('0x180')],_0x11271f[_0xee74('0xbc')],undefined,!![]);};AGIVertices[_0xee74('0x11')][_0xee74('0x181')]=function(_0x5b6aba){logger[_0xee74('0x2f')](util[_0xee74('0x2a')](_0xee74('0x182'),_0x5b6aba[_0xee74('0xb8')]));if(!this['isConfigured'](_0x5b6aba[_0xee74('0x63')])){return this[_0xee74('0xe')]['noop'](_0xee74('0x183'));}var _0x62599f=this['restAPI']['sync'](this,_0x5b6aba);logger['info'](util['format'](_0xee74('0x184'),util['inspect'](_0x62599f,{'showHidden':![],'depth':null})));if(!this[_0xee74('0x85')](_0x5b6aba['variable_id'])){return this['channel']['noop'](_0xee74('0x185'));}var _0x34b73d=this[_0xee74('0x12')][_0xee74('0x6e')](this,_0x5b6aba[_0xee74('0xdc')]);if(!_0x34b73d){return this['channel'][_0xee74('0x2d')](_0x5b6aba,_0xee74('0xde'));}this[_0xee74('0xe')][_0xee74('0xa1')](util['format'](_0xee74('0x186'),_0x34b73d),_0x62599f[_0xee74('0x74')]?_0x62599f[_0xee74('0x74')]:'200');this[_0xee74('0xe')][_0xee74('0xa1')](util[_0xee74('0x2a')](_0xee74('0x187'),_0x34b73d),_0x62599f[_0xee74('0x188')]?_0x62599f[_0xee74('0x188')]:'OK');if(_0x62599f['body']){try{this['saveRestApiResult'](_0x62599f[_0xee74('0x72')],_0x34b73d);}catch(_0x52d1aa){logger['error'](util[_0xee74('0x2a')](_0xee74('0x189'),_0x34b73d));}}return this[_0xee74('0xe')][_0xee74('0xab')](util['format'](_0xee74('0xe3'),_0x34b73d));};AGIVertices['prototype'][_0xee74('0x18a')]=function(_0x2cf6ec){logger[_0xee74('0x2f')](util[_0xee74('0x2a')](_0xee74('0x18b'),_0x2cf6ec[_0xee74('0xb8')]));return this[_0xee74('0xe')][_0xee74('0x18c')](_0x2cf6ec[_0xee74('0x18d')]['replace'](/\s+/g,''),_0x2cf6ec[_0xee74('0x180')]);};AGIVertices[_0xee74('0x11')][_0xee74('0x18e')]=function(_0x286ddd){logger[_0xee74('0x2f')](util['format'](_0xee74('0x18f'),_0x286ddd[_0xee74('0xb8')]));return this['channel'][_0xee74('0x190')](_0x286ddd['number']['replace'](/\s+/g,''),_0x286ddd[_0xee74('0x180')]);};AGIVertices[_0xee74('0x11')][_0xee74('0x191')]=function(_0x3266ad){logger['info'](util[_0xee74('0x2a')](_0xee74('0x192'),_0x3266ad['label']));return this['channel'][_0xee74('0x193')](_0x3266ad[_0xee74('0x5b')],_0x3266ad[_0xee74('0x180')]);};AGIVertices[_0xee74('0x11')]['sendMail']=function(_0x3f46a0){logger['info'](util[_0xee74('0x2a')](_0xee74('0x194'),_0x3f46a0['label']));if(!this[_0xee74('0x85')](_0x3f46a0['account_id'])){return this[_0xee74('0xe')]['noop'](_0xee74('0x195'));}var _0xc8b757=this['getMailAccount'][_0xee74('0x6e')](this,_0x3f46a0['account_id']);if(!_0xc8b757||!_0xc8b757[_0xee74('0x196')]){return this[_0xee74('0xe')][_0xee74('0x2d')](_0x3f46a0,_0xee74('0x197'));}var _0x56c3c2={'from':util[_0xee74('0x2a')](_0xee74('0x198'),_0xc8b757[_0xee74('0x18')],_0xc8b757['email']||_0xc8b757[_0xee74('0x196')][_0xee74('0x199')]),'to':_0x3f46a0['to']||'','cc':_0x3f46a0['cc']||'','bcc':_0x3f46a0['bcc']||'','subject':_0x3f46a0[_0xee74('0x19a')],'html':_0x3f46a0[_0xee74('0x5b')],'text':_0x3f46a0[_0xee74('0x5b')]};if(this[_0xee74('0x85')](_0x3f46a0['template_id'])){}logger[_0xee74('0xe5')](_0xee74('0x19b'),JSON['stringify'](_0x56c3c2));this[_0xee74('0x37')][_0xee74('0x6e')](this,_0x3f46a0,_0x3f46a0['account_id']);this[_0xee74('0xe')][_0xee74('0xab')](util['format'](_0xee74('0x19c'),_0xc8b757[_0xee74('0x18')]));this[_0xee74('0x25')][_0xee74('0x6e')](this,_0xc8b757[_0xee74('0x19d')],_0x56c3c2);return this['channel'][_0xee74('0xab')](_0xee74('0x19e'));};AGIVertices[_0xee74('0x11')][_0xee74('0x19f')]=function(_0x5ddf0a){logger[_0xee74('0x2f')](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x5ddf0a[_0xee74('0xb8')]));return this['channel'][_0xee74('0xab')](_0xee74('0x1a0'));};AGIVertices[_0xee74('0x11')][_0xee74('0x1a1')]=function(_0x1363df){logger[_0xee74('0x2f')](util[_0xee74('0x2a')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x1363df[_0xee74('0xb8')]));if(!this[_0xee74('0x85')](_0x1363df[_0xee74('0x1a2')])){return this[_0xee74('0xe')][_0xee74('0xab')](_0xee74('0x1a3'));}var _0x260686=this[_0xee74('0x1a4')][_0xee74('0x6e')](this,_0x1363df[_0xee74('0x1a2')]);if(!_0x260686){return this['channel'][_0xee74('0x2d')](_0x1363df,_0xee74('0x1a5'));}var _0xa4c5b8={'body':_0x1363df[_0xee74('0x1a6')],'phone':_0x1363df['to']||'','SmsAccountId':_0x260686['id']};logger[_0xee74('0xe5')](_0xee74('0x1a7'),JSON[_0xee74('0x71')](_0xa4c5b8));this[_0xee74('0x37')][_0xee74('0x6e')](this,_0x1363df,_0x1363df[_0xee74('0x1a2')]);this[_0xee74('0xe')]['noop'](util[_0xee74('0x2a')](_0xee74('0x1a8'),_0x260686[_0xee74('0x18')]));this[_0xee74('0x36')][_0xee74('0x6e')](this,_0xa4c5b8);return this[_0xee74('0xe')][_0xee74('0xab')](_0xee74('0x1a9'));};AGIVertices[_0xee74('0x11')]['set']=function(_0x44cde6){logger[_0xee74('0x2f')](util[_0xee74('0x2a')](_0xee74('0x1aa'),_0x44cde6[_0xee74('0xb8')]));if(!this[_0xee74('0x85')](_0x44cde6['variable_id'])){return this[_0xee74('0xe')][_0xee74('0x2d')](_0x44cde6,_0xee74('0x1ab'));}var _0x18b213=this['getVariable']['sync'](this,_0x44cde6[_0xee74('0xdc')]);if(!_0x18b213){return this['channel'][_0xee74('0x2d')](_0x44cde6,_0xee74('0xde'));}return this[_0xee74('0xe')][_0xee74('0xa1')](_0x18b213,_0x44cde6['variable_value']);};AGIVertices['prototype']['start']=function(_0x1a0a60){logger[_0xee74('0x2f')](util[_0xee74('0x2a')]('Enter\x20in\x20START\x20(%s)\x20block',_0x1a0a60[_0xee74('0xb8')]));this['channel'][_0xee74('0xab')](_0xee74('0x1ac'));if(_0x1a0a60[_0xee74('0x1ad')]===_0xee74('0x1ae')){this[_0xee74('0xe')][_0xee74('0xab')](_0xee74('0x1af'));return this[_0xee74('0xe')][_0xee74('0x1ad')]();}return this[_0xee74('0xe')][_0xee74('0xab')](_0xee74('0x1b0'));};AGIVertices[_0xee74('0x11')][_0xee74('0x1b1')]=function(_0x41ab0c){logger['info'](util[_0xee74('0x2a')](_0xee74('0x1b2'),_0x41ab0c['label']));if(!this[_0xee74('0x85')](_0x41ab0c['project_id'])){return this[_0xee74('0xe')]['error'](_0x41ab0c,_0xee74('0x1b3'));}var _0x1f28aa=this[_0xee74('0x19')][_0xee74('0x6e')](this,_0x41ab0c[_0xee74('0x1b4')]);if(!this[_0xee74('0x85')](_0x1f28aa)){return this[_0xee74('0xe')]['error'](_0x41ab0c,util[_0xee74('0x2a')](_0xee74('0x1b5'),_0x41ab0c[_0xee74('0x1b4')]));}if(_0x1f28aa===this[_0xee74('0xe')][_0xee74('0x3a')]){return this['channel'][_0xee74('0x2d')](_0x41ab0c,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this['createSquareDetailsReport']['sync'](this,_0x41ab0c,_0x1f28aa);var _0x4e5543=this[_0xee74('0xe')][_0xee74('0x56')](_0xee74('0x1b6'),util[_0xee74('0x2a')](_0xee74('0x1b7'),config['agi'][_0xee74('0x1b8')]||_0xee74('0x1b9'),_0x1f28aa,this['channel'][_0xee74('0x3a')]));if(_0x4e5543[_0xee74('0xae')]===-0x1){return _0x4e5543;}return this[_0xee74('0xe')]['noop'](util[_0xee74('0x2a')](_0xee74('0xc7'),'AGI',_0x1f28aa));};AGIVertices[_0xee74('0x11')][_0xee74('0x1ba')]=function(_0x342644){logger[_0xee74('0x2f')](util[_0xee74('0x2a')](_0xee74('0x1bb'),_0x342644[_0xee74('0xb8')]));var _0x3a0944=this['shellCommand'][_0xee74('0x6e')](this,_0x342644[_0xee74('0xb9')]);this[_0xee74('0x37')]['sync'](this,_0x342644,_0x342644[_0xee74('0xb9')]);if(this[_0xee74('0x85')](_0x342644['variable_id'])){var _0x2fd869=this['getVariable']['sync'](this,_0x342644[_0xee74('0xdc')]);if(_0x2fd869){this[_0xee74('0xe')][_0xee74('0xa1')](_0x2fd869,_0x3a0944);return this[_0xee74('0xe')][_0xee74('0xab')](util[_0xee74('0x2a')](_0xee74('0x1bc'),_0x342644[_0xee74('0xb9')],_0x2fd869));}}return this[_0xee74('0xe')][_0xee74('0xab')](util[_0xee74('0x2a')](_0xee74('0x1bd'),_0x342644[_0xee74('0xb9')]));};AGIVertices[_0xee74('0x11')][_0xee74('0x1be')]=function(_0x3f7a09){logger[_0xee74('0x2f')](util['format'](_0xee74('0x1bf'),_0x3f7a09['label']));_0x3f7a09[_0xee74('0x5b')]=_0x3f7a09[_0xee74('0x5b')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xee74('0x85')](_0x3f7a09[_0xee74('0x5a')])){return this[_0xee74('0xe')][_0xee74('0xab')]('no\x20apiKey\x20configured');}if(!this[_0xee74('0x85')](_0x3f7a09[_0xee74('0x5b')])){return this[_0xee74('0xe')][_0xee74('0xab')](_0xee74('0xac'));}this[_0xee74('0xe')]['noop'](util['format']('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x3f7a09[_0xee74('0x5b')]));var _0x5617df=this[_0xee74('0x59')][_0xee74('0x6e')](this,_0x3f7a09);if(_0x5617df){this[_0xee74('0xe')][_0xee74('0xab')](util[_0xee74('0x2a')](_0xee74('0x1c0'),_0x5617df));var _0x528503=this[_0xee74('0xe')][_0xee74('0x106')](_0x5617df);try{fs[_0xee74('0x127')](_0x5617df+_0xee74('0x107'));}catch(_0x1f2431){logger[_0xee74('0x2d')](_0x1f2431);}return _0x528503;}return this['channel'][_0xee74('0x2d')](_0x3f7a09,_0xee74('0x1c1'));};AGIVertices[_0xee74('0x11')]['tts']=function(_0x499050){logger[_0xee74('0x2f')](util[_0xee74('0x2a')](_0xee74('0x1c2'),_0x499050[_0xee74('0xb8')]));_0x499050[_0xee74('0x5b')]=_0x499050[_0xee74('0x5b')][_0xee74('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x499050[_0xee74('0x5b')])){return this[_0xee74('0xe')]['noop'](_0xee74('0xac'));}this[_0xee74('0xe')][_0xee74('0xab')](util['format'](_0xee74('0x1c3'),_0x499050[_0xee74('0x5b')]));var _0x225fb0=this[_0xee74('0x61')][_0xee74('0x6e')](this,_0x499050);if(_0x225fb0){this['channel'][_0xee74('0xab')](util['format'](_0xee74('0x1c4'),_0x225fb0));var _0x43f3bd=this[_0xee74('0xe')][_0xee74('0x106')](_0x225fb0);try{fs[_0xee74('0x127')](_0x225fb0+_0xee74('0x107'));}catch(_0xe4ea0a){logger[_0xee74('0x2d')](_0xe4ea0a);}return _0x43f3bd;}return this[_0xee74('0xe')][_0xee74('0x2d')](_0x499050,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0xee74('0x11')]['unpause']=function(_0x4f2d07){logger['info'](util[_0xee74('0x2a')](_0xee74('0x1c5'),_0x4f2d07[_0xee74('0xb8')]));if(!this['isConfigured'](_0x4f2d07[_0xee74('0x154')])){return this[_0xee74('0xe')]['error'](_0x4f2d07,_0xee74('0x155'));}logger[_0xee74('0x2f')](util[_0xee74('0x2a')](_0xee74('0x156'),this['channel']['callerid'],_0x4f2d07[_0xee74('0x154')]));var _0x9f2580=this[_0xee74('0x51')][_0xee74('0x6e')](this,_0x4f2d07[_0xee74('0x154')]);if(_0x9f2580){logger['info'](util[_0xee74('0x2a')](_0xee74('0x157'),this[_0xee74('0xe')]['callerid'],_0x4f2d07[_0xee74('0x154')]));this[_0xee74('0xe')][_0xee74('0xab')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xee74('0xe')][_0xee74('0x3b')],_0x4f2d07[_0xee74('0x154')]));return{'code':0xc8,'result':_0xee74('0x158')};}else{logger[_0xee74('0x2f')](util[_0xee74('0x2a')](_0xee74('0x159'),this[_0xee74('0xe')][_0xee74('0x3b')],_0x4f2d07[_0xee74('0x154')]));this[_0xee74('0xe')]['noop'](util[_0xee74('0x2a')](_0xee74('0x159'),this[_0xee74('0xe')][_0xee74('0x3b')],_0x4f2d07[_0xee74('0x154')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xee74('0x11')]['voicemail']=function(_0xc394dd){logger[_0xee74('0x2f')](util[_0xee74('0x2a')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0xc394dd[_0xee74('0xb8')]));var _0x3b9740=this[_0xee74('0xe')]['exec'](_0xee74('0x1c6'),[_0xc394dd[_0xee74('0x1c7')],_0xc394dd[_0xee74('0x77')]]);if(_0x3b9740['result']===-0x1){return _0x3b9740;}return this[_0xee74('0xe')][_0xee74('0xab')](util[_0xee74('0x2a')](_0xee74('0xc7'),_0xee74('0x1c6'),_0xc394dd['mailbox']));};AGIVertices[_0xee74('0x11')][_0xee74('0x1c8')]=function(_0x3df3d2){logger[_0xee74('0x2f')](util[_0xee74('0x2a')](_0xee74('0x1c9'),_0x3df3d2['label']));if(!this[_0xee74('0x85')](_0x3df3d2[_0xee74('0xdc')])){return this['channel'][_0xee74('0x2d')](_0x3df3d2,_0xee74('0x1ab'));}var _0x296636=this[_0xee74('0x12')][_0xee74('0x6e')](this,_0x3df3d2['variable_id']);if(!_0x296636){return this['channel'][_0xee74('0x2d')](_0x3df3d2,_0xee74('0xde'));}var _0x3e63e3=this['channel'][_0xee74('0x12')](_0x296636);return{'code':0xc8,'result':_0x3e63e3[_0xee74('0xa4')]?_0x3e63e3['extra']:'-'};};String['prototype'][_0xee74('0xa3')]=function(_0x688b78,_0x14f4d9){return this[_0xee74('0xa2')](_0x688b78)[_0xee74('0x1ca')](_0x14f4d9);};module[_0xee74('0x1cb')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 7d0c721..01bff0f 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 _0x0e26=['acw','../rpc/user','../rpc/voiceAgentReport','agents','timers','channels','agentconnect','bind','hanguprequest','syncHangupRequest','hangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','startAcw','interface','queue','ACW','mandatoryDisposition','name','Action','QueuePause','then','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','voiceQueues','acwTimeout','timer','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','info','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','stopAcw','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','prototype','syncAgentConnect','[ACW][syncAgentConnect]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfereruniqueid','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','all','exports','util','../ami','../../../config/logger'];(function(_0x406f31,_0x25d302){var _0x657827=function(_0x1723f7){while(--_0x1723f7){_0x406f31['push'](_0x406f31['shift']());}};_0x657827(++_0x25d302);}(_0x0e26,0x159));var _0x60e2=function(_0x25ead3,_0x3d8fab){_0x25ead3=_0x25ead3-0x0;var _0xafadc3=_0x0e26[_0x25ead3];return _0xafadc3;};'use strict';var util=require(_0x60e2('0x0'));var _=require('lodash');var moment=require('moment');var ami=require(_0x60e2('0x1'));var logger=require(_0x60e2('0x2'))(_0x60e2('0x3'));var RpcUser=require(_0x60e2('0x4'));var RpcVoiceAgentReport=require(_0x60e2('0x5'));function Acw(_0x5906c6){this['voiceQueues']=_0x5906c6['voiceQueues'];this[_0x60e2('0x6')]=_0x5906c6[_0x60e2('0x6')];this[_0x60e2('0x7')]=_0x5906c6[_0x60e2('0x7')];this[_0x60e2('0x8')]={};ami['on'](_0x60e2('0x9'),this['syncAgentConnect'][_0x60e2('0xa')](this));ami['on'](_0x60e2('0xb'),this[_0x60e2('0xc')][_0x60e2('0xa')](this));ami['on'](_0x60e2('0xd'),this['syncHangup'][_0x60e2('0xa')](this));ami['on'](_0x60e2('0xe'),this['syncAgentRingNoAnswer'][_0x60e2('0xa')](this));ami['on'](_0x60e2('0xf'),this[_0x60e2('0x10')][_0x60e2('0xa')](this));ami['on'](_0x60e2('0x11'),this[_0x60e2('0x12')][_0x60e2('0xa')](this));ami['on'](_0x60e2('0x13'),this['syncAgentConnectPreview'][_0x60e2('0xa')](this));}function getDiff(_0x8cf049){var _0x5a792c=moment()['milliseconds'](0x0);var _0x3e8264=moment(_0x8cf049)[_0x60e2('0x14')](0x0);return _0x5a792c[_0x60e2('0x15')](_0x3e8264,_0x60e2('0x16'));}Acw['prototype'][_0x60e2('0x17')]=function(_0x501648){try{var _0x4af6d9=this;var _0x532112=this[_0x60e2('0x8')][_0x501648][_0x60e2('0x18')];var _0xdb0c88=this[_0x60e2('0x8')][_0x501648][_0x60e2('0x19')];var _0x162e0a=this['voiceQueues'][_0xdb0c88];var _0x47c6a2=![];var _0x331f88=_0x60e2('0x1a');if(_0x162e0a[_0x60e2('0x1b')]){if(_0x162e0a['mandatoryDispositionPause'][_0x60e2('0x1c')]){_0x47c6a2=!![];_0x331f88=_0x162e0a['mandatoryDispositionPause'][_0x60e2('0x1c')];}}ami[_0x60e2('0x1d')]({'action':_0x60e2('0x1e'),'interface':_0x532112,'paused':!![],'reason':_0x331f88})[_0x60e2('0x1f')](function(_0xb00156){if(_0x4af6d9[_0x60e2('0x6')][_0x532112]){return RpcUser['getAgent'](_0x4af6d9[_0x60e2('0x6')][_0x532112]['id'])[_0x60e2('0x1f')](function(_0x18dd92){if(_0x18dd92&&!_0x18dd92[_0x60e2('0x20')]){logger['info'](_0x60e2('0x21'),_0x501648,_0x532112,_0xdb0c88);var _0x1033ce=_0x4af6d9[_0x60e2('0x8')][_0x501648][_0x60e2('0x22')]&&_0x4af6d9['channels'][_0x501648]['destlinkedid']?_0x4af6d9['channels'][_0x501648][_0x60e2('0x23')]:_0x501648;return RpcUser[_0x60e2('0x24')](_0x4af6d9[_0x60e2('0x6')][_0x532112],_0x331f88,_0x1033ce)[_0x60e2('0x1f')](function(_0x510d28){if(!_0x47c6a2){_0x4af6d9['timers'][_0x532112]={};logger['info'](_0x60e2('0x25'),_0x501648,_0x4af6d9[_0x60e2('0x26')][_0xdb0c88][_0x60e2('0x27')],_0x532112,_0xdb0c88);_0x4af6d9[_0x60e2('0x7')][_0x532112][_0x60e2('0x28')]=setTimeout(_0x4af6d9['stopAcw'][_0x60e2('0xa')](_0x4af6d9,_0x532112),_0x4af6d9[_0x60e2('0x26')][_0xdb0c88][_0x60e2('0x27')]*0x3e8);_0x4af6d9[_0x60e2('0x7')][_0x532112][_0x60e2('0x29')]=moment()['format'](_0x60e2('0x2a'));_0x4af6d9[_0x60e2('0x7')][_0x532112][_0x60e2('0x2b')]=_0x501648;_0x4af6d9['timers'][_0x532112][_0x60e2('0x19')]=_0xdb0c88;_0x4af6d9[_0x60e2('0x7')][_0x532112][_0x60e2('0x2c')]=function(){var _0x7315d0=getDiff(_0x4af6d9['timers'][_0x532112][_0x60e2('0x29')]);clearTimeout(_0x4af6d9['timers'][_0x532112][_0x60e2('0x28')]);_0x4af6d9[_0x60e2('0x7')][_0x532112][_0x60e2('0x28')]=![];RpcVoiceAgentReport[_0x60e2('0x2d')]({'acwtime':_0x7315d0},_0x4af6d9[_0x60e2('0x7')][_0x532112][_0x60e2('0x2b')],_0x532112)[_0x60e2('0x1f')](function(_0x28f325){logger[_0x60e2('0x2e')](_0x60e2('0x2f'),_0x501648,_0x7315d0,_0x28f325);})[_0x60e2('0x30')](function(_0xda046b){logger[_0x60e2('0x31')](_0x60e2('0x32'),_0x501648,_0xda046b);});delete _0x4af6d9[_0x60e2('0x7')][_0x532112];};}});}else{logger[_0x60e2('0x2e')](_0x60e2('0x33'),_0x501648,_0x532112,_0xdb0c88);}});}})['catch'](function(_0x402a1d){logger[_0x60e2('0x31')](_0x60e2('0x25'),_0x501648,_0x4af6d9[_0x60e2('0x26')][_0xdb0c88][_0x60e2('0x27')],_0x532112,_0xdb0c88);})[_0x60e2('0x34')](function(){delete _0x4af6d9[_0x60e2('0x8')][_0x501648];});}catch(_0x5a7492){logger['error'](_0x60e2('0x35'),_0x5a7492[_0x60e2('0x36')]);}};Acw['prototype'][_0x60e2('0x37')]=function(_0xd0f42f){try{var _0x37886d=this;if(_0x37886d[_0x60e2('0x7')][_0xd0f42f]){_0x37886d[_0x60e2('0x7')][_0xd0f42f][_0x60e2('0x28')]=![];var _0x1d894b=_0x37886d[_0x60e2('0x7')][_0xd0f42f][_0x60e2('0x2b')];var _0x7e7371=_0x37886d[_0x60e2('0x7')][_0xd0f42f][_0x60e2('0x19')];var _0x1e67c6=_0x37886d[_0x60e2('0x26')][_0x7e7371][_0x60e2('0x27')];logger[_0x60e2('0x2e')]('[%s][TIMER][STOP][AGENT:%s]',_0x1d894b,_0xd0f42f);RpcUser[_0x60e2('0x38')](this[_0x60e2('0x6')][_0xd0f42f]);RpcVoiceAgentReport[_0x60e2('0x2d')]({'acwtime':_0x1e67c6,'agentacw':!![]},_0x1d894b,_0xd0f42f)[_0x60e2('0x1f')](function(_0x118e02){logger[_0x60e2('0x2e')](_0x60e2('0x2f'),_0x1d894b,_0x1e67c6,_0x118e02);})[_0x60e2('0x30')](function(_0x41cf7d){logger['error'](_0x60e2('0x32'),_0x1d894b,_0x41cf7d);});}else{logger[_0x60e2('0x31')](_0x60e2('0x39'),_0xd0f42f);if(_0x37886d[_0x60e2('0x7')]){logger['info'](_0x60e2('0x3a'),JSON['stringify'](_0x37886d['timers']));}}}catch(_0x506079){logger[_0x60e2('0x31')](_0x60e2('0x3b'),_0x506079[_0x60e2('0x36')]);}};Acw[_0x60e2('0x3c')][_0x60e2('0x3d')]=function(_0x10933b){try{if(this[_0x60e2('0x26')][_0x10933b['queue']]&&(this[_0x60e2('0x26')][_0x10933b[_0x60e2('0x19')]][_0x60e2('0x3')]||this[_0x60e2('0x26')][_0x10933b[_0x60e2('0x19')]][_0x60e2('0x1b')])){if(this[_0x60e2('0x6')][_0x10933b[_0x60e2('0x18')]]){this[_0x60e2('0x8')][_0x10933b['uniqueid']]={'queue':_0x10933b[_0x60e2('0x19')],'interface':_0x10933b[_0x60e2('0x18')],'destlinkedid':_0x10933b[_0x60e2('0x23')]};}}}catch(_0x3aad72){logger['error'](_0x60e2('0x3e'),_0x3aad72[_0x60e2('0x36')]);}};Acw['prototype']['syncAgentConnectPreview']=function(_0x51b9c1){try{if(this[_0x60e2('0x26')][_0x51b9c1[_0x60e2('0x19')]]&&(this[_0x60e2('0x26')][_0x51b9c1[_0x60e2('0x19')]][_0x60e2('0x3')]||this[_0x60e2('0x26')][_0x51b9c1[_0x60e2('0x19')]]['mandatoryDisposition'])){if(this[_0x60e2('0x6')][_0x51b9c1[_0x60e2('0x18')]]){this[_0x60e2('0x8')][_0x51b9c1[_0x60e2('0x2b')]]={'queue':_0x51b9c1['queue'],'interface':_0x51b9c1[_0x60e2('0x18')]};}}}catch(_0x315821){logger[_0x60e2('0x31')]('[ACW][syncAgentConnectPreview]\x20%s',_0x315821[_0x60e2('0x36')]);}};Acw['prototype'][_0x60e2('0xc')]=function(_0x531971){try{if(this[_0x60e2('0x8')][_0x531971[_0x60e2('0x2b')]]&&_[_0x60e2('0x3f')](this[_0x60e2('0x8')][_0x531971[_0x60e2('0x2b')]][_0x60e2('0x22')])){logger['info'](_0x60e2('0x40'),_0x531971['uniqueid']);this[_0x60e2('0x17')](_0x531971[_0x60e2('0x2b')]);}else if(this['channels'][_0x531971[_0x60e2('0x41')]]&&_[_0x60e2('0x3f')](this[_0x60e2('0x8')][_0x531971[_0x60e2('0x41')]][_0x60e2('0x22')])){logger[_0x60e2('0x2e')](_0x60e2('0x42'),_0x531971[_0x60e2('0x41')]);this[_0x60e2('0x17')](_0x531971['linkedid']);}}catch(_0x2e18f4){logger[_0x60e2('0x31')](_0x60e2('0x43'),_0x2e18f4[_0x60e2('0x36')]);}};Acw[_0x60e2('0x3c')]['syncHangup']=function(_0x3bec1b){try{if(this[_0x60e2('0x8')][_0x3bec1b[_0x60e2('0x2b')]]&&this[_0x60e2('0x8')][_0x3bec1b[_0x60e2('0x2b')]][_0x60e2('0x22')]){logger[_0x60e2('0x2e')](_0x60e2('0x44'),_0x3bec1b[_0x60e2('0x2b')]);this[_0x60e2('0x17')](_0x3bec1b['uniqueid']);}else if(this[_0x60e2('0x8')][_0x3bec1b['linkedid']]&&this[_0x60e2('0x8')][_0x3bec1b[_0x60e2('0x41')]][_0x60e2('0x22')]){logger[_0x60e2('0x2e')](_0x60e2('0x45'),_0x3bec1b[_0x60e2('0x41')]);this[_0x60e2('0x17')](_0x3bec1b[_0x60e2('0x41')]);}}catch(_0x15134e){logger['error'](_0x60e2('0x46'),_0x15134e[_0x60e2('0x36')]);}};Acw[_0x60e2('0x3c')][_0x60e2('0x10')]=function(_0xa22076){try{if(!_[_0x60e2('0x47')](this[_0x60e2('0x8')][_0xa22076[_0x60e2('0x48')]])){this[_0x60e2('0x17')](_0xa22076[_0x60e2('0x48')]);if(this['channels'][_0xa22076[_0x60e2('0x49')]]){this[_0x60e2('0x8')][_0xa22076[_0x60e2('0x49')]][_0x60e2('0x22')]=!![];this['channels'][_0xa22076[_0x60e2('0x4a')]]=this[_0x60e2('0x8')][_0xa22076[_0x60e2('0x49')]];delete this['channels'][_0xa22076['secondtransfereruniqueid']];}}else if(!_['isNil'](this[_0x60e2('0x8')][_0xa22076['transfertargetuniqueid']])){this[_0x60e2('0x17')](_0xa22076[_0x60e2('0x4a')]);if(this[_0x60e2('0x8')][_0xa22076[_0x60e2('0x4b')]]){this[_0x60e2('0x8')][_0xa22076['origtransfereruniqueid']][_0x60e2('0x22')]=!![];this['channels'][_0xa22076[_0x60e2('0x48')]]=this[_0x60e2('0x8')][_0xa22076[_0x60e2('0x4b')]];delete this['channels'][_0xa22076[_0x60e2('0x4b')]];}}}catch(_0x54e6af){logger[_0x60e2('0x31')](_0x60e2('0x4c'),_0x54e6af['message']);}};Acw['prototype'][_0x60e2('0x12')]=function(_0x1e18db){try{if(this['channels'][_0x1e18db['transfereruniqueid']]){logger[_0x60e2('0x2e')](_0x60e2('0x4d'),JSON[_0x60e2('0x4e')](_0x1e18db['transfereruniqueid']));this[_0x60e2('0x17')](_0x1e18db[_0x60e2('0x4f')]);}else if(this['channels'][_0x1e18db['transfererlinkedid']]){logger[_0x60e2('0x2e')](_0x60e2('0x50'),JSON[_0x60e2('0x4e')](_0x1e18db[_0x60e2('0x51')]));this[_0x60e2('0x17')](_0x1e18db[_0x60e2('0x51')]);}}catch(_0x1b3390){logger[_0x60e2('0x31')](_0x60e2('0x52'),_0x1b3390['message']);}};Acw[_0x60e2('0x3c')][_0x60e2('0x53')]=function(_0x366812){try{if(this[_0x60e2('0x26')][_0x366812[_0x60e2('0x19')]]&&this['voiceQueues'][_0x366812[_0x60e2('0x19')]][_0x60e2('0x54')]===_0x60e2('0x55')){if(this[_0x60e2('0x6')][_0x366812[_0x60e2('0x18')]]){logger['info']('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x366812[_0x60e2('0x2b')],_0x366812[_0x60e2('0x18')],_0x366812[_0x60e2('0x19')]);return RpcUser[_0x60e2('0x24')](this[_0x60e2('0x6')][_0x366812[_0x60e2('0x18')]],'Auto-Pause',_0x366812[_0x60e2('0x2b')]);}}}catch(_0x2eb228){logger[_0x60e2('0x31')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x2eb228['message']);}};module[_0x60e2('0x56')]=Acw; \ No newline at end of file +var _0x92af=['milliseconds','diff','seconds','prototype','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','then','getAgent','voicePause','info','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','timer','stopAcw','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','message','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','lodash','acw','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hangup','syncHangup','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview'];(function(_0x1e58a2,_0x4015dd){var _0x4adf6c=function(_0x36bd65){while(--_0x36bd65){_0x1e58a2['push'](_0x1e58a2['shift']());}};_0x4adf6c(++_0x4015dd);}(_0x92af,0x130));var _0xf92a=function(_0x2bcbda,_0x178e8b){_0x2bcbda=_0x2bcbda-0x0;var _0x338640=_0x92af[_0x2bcbda];return _0x338640;};'use strict';var util=require('util');var _=require(_0xf92a('0x0'));var moment=require('moment');var ami=require('../ami');var logger=require('../../../config/logger')(_0xf92a('0x1'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x375a60){this[_0xf92a('0x2')]=_0x375a60['voiceQueues'];this[_0xf92a('0x3')]=_0x375a60[_0xf92a('0x3')];this[_0xf92a('0x4')]=_0x375a60['timers'];this[_0xf92a('0x5')]={};ami['on'](_0xf92a('0x6'),this[_0xf92a('0x7')][_0xf92a('0x8')](this));ami['on']('hanguprequest',this['syncHangupRequest']['bind'](this));ami['on'](_0xf92a('0x9'),this[_0xf92a('0xa')][_0xf92a('0x8')](this));ami['on']('agentringnoanswer',this[_0xf92a('0xb')]['bind'](this));ami['on']('attendedtransfer',this[_0xf92a('0xc')]['bind'](this));ami['on'](_0xf92a('0xd'),this[_0xf92a('0xe')]['bind'](this));ami['on'](_0xf92a('0xf'),this['syncAgentConnectPreview'][_0xf92a('0x8')](this));}function getDiff(_0x173850){var _0x8eccef=moment()[_0xf92a('0x10')](0x0);var _0x37c7a4=moment(_0x173850)[_0xf92a('0x10')](0x0);return _0x8eccef[_0xf92a('0x11')](_0x37c7a4,_0xf92a('0x12'));}Acw[_0xf92a('0x13')]['startAcw']=function(_0x12793c){try{var _0x133902=this;var _0x113c2e=this[_0xf92a('0x5')][_0x12793c][_0xf92a('0x14')];var _0x4d60ef=this[_0xf92a('0x5')][_0x12793c][_0xf92a('0x15')];var _0x4b50b0=this[_0xf92a('0x2')][_0x4d60ef];var _0x5e4f6b=![];var _0x56d77a=_0xf92a('0x16');if(_0x4b50b0[_0xf92a('0x17')]){if(_0x4b50b0[_0xf92a('0x18')][_0xf92a('0x19')]){_0x5e4f6b=!![];_0x56d77a=_0x4b50b0[_0xf92a('0x18')][_0xf92a('0x19')];}}ami[_0xf92a('0x1a')]({'action':'QueuePause','interface':_0x113c2e,'paused':!![],'reason':_0x56d77a})[_0xf92a('0x1b')](function(_0x250337){if(_0x133902['agents'][_0x113c2e]){return RpcUser[_0xf92a('0x1c')](_0x133902[_0xf92a('0x3')][_0x113c2e]['id'])[_0xf92a('0x1b')](function(_0x4e39e3){if(_0x4e39e3&&!_0x4e39e3[_0xf92a('0x1d')]){logger[_0xf92a('0x1e')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x12793c,_0x113c2e,_0x4d60ef);var _0x112e38=_0x133902[_0xf92a('0x5')][_0x12793c][_0xf92a('0x1f')]&&_0x133902[_0xf92a('0x5')][_0x12793c][_0xf92a('0x20')]?_0x133902['channels'][_0x12793c][_0xf92a('0x20')]:_0x12793c;return RpcUser[_0xf92a('0x21')](_0x133902[_0xf92a('0x3')][_0x113c2e],_0x56d77a,_0x112e38)[_0xf92a('0x1b')](function(_0x1d613b){if(!_0x5e4f6b){_0x133902['timers'][_0x113c2e]={};logger['info'](_0xf92a('0x22'),_0x12793c,_0x133902['voiceQueues'][_0x4d60ef]['acwTimeout'],_0x113c2e,_0x4d60ef);_0x133902[_0xf92a('0x4')][_0x113c2e][_0xf92a('0x23')]=setTimeout(_0x133902[_0xf92a('0x24')][_0xf92a('0x8')](_0x133902,_0x113c2e),_0x133902[_0xf92a('0x2')][_0x4d60ef][_0xf92a('0x25')]*0x3e8);_0x133902[_0xf92a('0x4')][_0x113c2e][_0xf92a('0x26')]=moment()[_0xf92a('0x27')](_0xf92a('0x28'));_0x133902[_0xf92a('0x4')][_0x113c2e][_0xf92a('0x29')]=_0x12793c;_0x133902[_0xf92a('0x4')][_0x113c2e][_0xf92a('0x15')]=_0x4d60ef;_0x133902['timers'][_0x113c2e][_0xf92a('0x2a')]=function(){var _0x8c03f0=getDiff(_0x133902['timers'][_0x113c2e][_0xf92a('0x26')]);clearTimeout(_0x133902[_0xf92a('0x4')][_0x113c2e][_0xf92a('0x23')]);_0x133902[_0xf92a('0x4')][_0x113c2e][_0xf92a('0x23')]=![];RpcVoiceAgentReport[_0xf92a('0x2b')]({'acwtime':_0x8c03f0},_0x133902['timers'][_0x113c2e][_0xf92a('0x29')],_0x113c2e)['then'](function(_0xf2d69d){logger[_0xf92a('0x1e')]('[%s][UPDATE][ACWTIME:%s]',_0x12793c,_0x8c03f0,_0xf2d69d);})[_0xf92a('0x2c')](function(_0x533261){logger[_0xf92a('0x2d')](_0xf92a('0x2e'),_0x12793c,_0x533261);});delete _0x133902[_0xf92a('0x4')][_0x113c2e];};}});}else{logger[_0xf92a('0x1e')](_0xf92a('0x2f'),_0x12793c,_0x113c2e,_0x4d60ef);}});}})[_0xf92a('0x2c')](function(_0x4b7974){logger[_0xf92a('0x2d')](_0xf92a('0x22'),_0x12793c,_0x133902[_0xf92a('0x2')][_0x4d60ef][_0xf92a('0x25')],_0x113c2e,_0x4d60ef);})[_0xf92a('0x30')](function(){delete _0x133902['channels'][_0x12793c];});}catch(_0x1d6a35){logger['error'](_0xf92a('0x31'),_0x1d6a35['message']);}};Acw[_0xf92a('0x13')][_0xf92a('0x24')]=function(_0x411257){try{var _0x1b5e5f=this;if(_0x1b5e5f['timers'][_0x411257]){_0x1b5e5f['timers'][_0x411257][_0xf92a('0x23')]=![];var _0x5bb228=_0x1b5e5f[_0xf92a('0x4')][_0x411257][_0xf92a('0x29')];var _0x22d012=_0x1b5e5f[_0xf92a('0x4')][_0x411257][_0xf92a('0x15')];var _0x4a20ab=_0x1b5e5f['voiceQueues'][_0x22d012][_0xf92a('0x25')];logger[_0xf92a('0x1e')]('[%s][TIMER][STOP][AGENT:%s]',_0x5bb228,_0x411257);RpcUser[_0xf92a('0x32')](this[_0xf92a('0x3')][_0x411257]);RpcVoiceAgentReport[_0xf92a('0x2b')]({'acwtime':_0x4a20ab,'agentacw':!![]},_0x5bb228,_0x411257)[_0xf92a('0x1b')](function(_0x31b463){logger[_0xf92a('0x1e')](_0xf92a('0x33'),_0x5bb228,_0x4a20ab,_0x31b463);})[_0xf92a('0x2c')](function(_0x2a87a8){logger['error'](_0xf92a('0x2e'),_0x5bb228,_0x2a87a8);});}else{logger[_0xf92a('0x2d')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x411257);if(_0x1b5e5f[_0xf92a('0x4')]){logger[_0xf92a('0x1e')](_0xf92a('0x34'),JSON[_0xf92a('0x35')](_0x1b5e5f[_0xf92a('0x4')]));}}}catch(_0x55d474){logger[_0xf92a('0x2d')](_0xf92a('0x36'),_0x55d474['message']);}};Acw[_0xf92a('0x13')]['syncAgentConnect']=function(_0x3041c5){try{if(this[_0xf92a('0x2')][_0x3041c5['queue']]&&(this['voiceQueues'][_0x3041c5[_0xf92a('0x15')]]['acw']||this[_0xf92a('0x2')][_0x3041c5['queue']][_0xf92a('0x17')])){if(this['agents'][_0x3041c5[_0xf92a('0x14')]]){this[_0xf92a('0x5')][_0x3041c5[_0xf92a('0x29')]]={'queue':_0x3041c5['queue'],'interface':_0x3041c5[_0xf92a('0x14')],'destlinkedid':_0x3041c5[_0xf92a('0x20')]};}}}catch(_0x5a8ebb){logger[_0xf92a('0x2d')](_0xf92a('0x37'),_0x5a8ebb[_0xf92a('0x38')]);}};Acw['prototype']['syncAgentConnectPreview']=function(_0x10a1f8){try{if(this[_0xf92a('0x2')][_0x10a1f8[_0xf92a('0x15')]]&&(this['voiceQueues'][_0x10a1f8[_0xf92a('0x15')]][_0xf92a('0x1')]||this[_0xf92a('0x2')][_0x10a1f8[_0xf92a('0x15')]][_0xf92a('0x17')])){if(this[_0xf92a('0x3')][_0x10a1f8[_0xf92a('0x14')]]){this[_0xf92a('0x5')][_0x10a1f8[_0xf92a('0x29')]]={'queue':_0x10a1f8['queue'],'interface':_0x10a1f8[_0xf92a('0x14')]};}}}catch(_0x4bd9d5){logger[_0xf92a('0x2d')](_0xf92a('0x39'),_0x4bd9d5[_0xf92a('0x38')]);}};Acw['prototype'][_0xf92a('0x3a')]=function(_0x4b55d4){try{if(this['channels'][_0x4b55d4[_0xf92a('0x29')]]&&_['isUndefined'](this[_0xf92a('0x5')][_0x4b55d4[_0xf92a('0x29')]][_0xf92a('0x1f')])){logger[_0xf92a('0x1e')]('[%s][HANGUP:UNIQUEID]',_0x4b55d4[_0xf92a('0x29')]);this[_0xf92a('0x3b')](_0x4b55d4[_0xf92a('0x29')]);}else if(this[_0xf92a('0x5')][_0x4b55d4[_0xf92a('0x3c')]]&&_['isUndefined'](this[_0xf92a('0x5')][_0x4b55d4['linkedid']][_0xf92a('0x1f')])){logger['info'](_0xf92a('0x3d'),_0x4b55d4['linkedid']);this[_0xf92a('0x3b')](_0x4b55d4[_0xf92a('0x3c')]);}}catch(_0xa46366){logger[_0xf92a('0x2d')](_0xf92a('0x3e'),_0xa46366[_0xf92a('0x38')]);}};Acw[_0xf92a('0x13')][_0xf92a('0xa')]=function(_0x5ce21d){try{if(this[_0xf92a('0x5')][_0x5ce21d[_0xf92a('0x29')]]&&this['channels'][_0x5ce21d[_0xf92a('0x29')]][_0xf92a('0x1f')]){logger[_0xf92a('0x1e')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x5ce21d[_0xf92a('0x29')]);this['startAcw'](_0x5ce21d[_0xf92a('0x29')]);}else if(this['channels'][_0x5ce21d[_0xf92a('0x3c')]]&&this['channels'][_0x5ce21d[_0xf92a('0x3c')]][_0xf92a('0x1f')]){logger['info'](_0xf92a('0x3f'),_0x5ce21d[_0xf92a('0x3c')]);this[_0xf92a('0x3b')](_0x5ce21d[_0xf92a('0x3c')]);}}catch(_0x59c31e){logger[_0xf92a('0x2d')](_0xf92a('0x40'),_0x59c31e[_0xf92a('0x38')]);}};Acw[_0xf92a('0x13')][_0xf92a('0xc')]=function(_0x31b393){try{if(!_[_0xf92a('0x41')](this[_0xf92a('0x5')][_0x31b393[_0xf92a('0x42')]])){this[_0xf92a('0x3b')](_0x31b393['transfereeuniqueid']);if(this[_0xf92a('0x5')][_0x31b393[_0xf92a('0x43')]]){this[_0xf92a('0x5')][_0x31b393['secondtransfereruniqueid']][_0xf92a('0x1f')]=!![];this[_0xf92a('0x5')][_0x31b393[_0xf92a('0x44')]]=this[_0xf92a('0x5')][_0x31b393[_0xf92a('0x43')]];delete this['channels'][_0x31b393[_0xf92a('0x43')]];}}else if(!_[_0xf92a('0x41')](this[_0xf92a('0x5')][_0x31b393['transfertargetuniqueid']])){this[_0xf92a('0x3b')](_0x31b393[_0xf92a('0x44')]);if(this[_0xf92a('0x5')][_0x31b393[_0xf92a('0x45')]]){this[_0xf92a('0x5')][_0x31b393[_0xf92a('0x45')]][_0xf92a('0x1f')]=!![];this[_0xf92a('0x5')][_0x31b393[_0xf92a('0x42')]]=this[_0xf92a('0x5')][_0x31b393[_0xf92a('0x45')]];delete this[_0xf92a('0x5')][_0x31b393['origtransfereruniqueid']];}}}catch(_0x5362d6){logger[_0xf92a('0x2d')](_0xf92a('0x46'),_0x5362d6[_0xf92a('0x38')]);}};Acw['prototype']['syncBlindTransfer']=function(_0x10b429){try{if(this[_0xf92a('0x5')][_0x10b429[_0xf92a('0x47')]]){logger['info'](_0xf92a('0x48'),JSON[_0xf92a('0x35')](_0x10b429[_0xf92a('0x47')]));this[_0xf92a('0x3b')](_0x10b429[_0xf92a('0x47')]);}else if(this[_0xf92a('0x5')][_0x10b429['transfererlinkedid']]){logger['info'](_0xf92a('0x49'),JSON['stringify'](_0x10b429[_0xf92a('0x4a')]));this['startAcw'](_0x10b429['transfererlinkedid']);}}catch(_0x23e3a5){logger[_0xf92a('0x2d')](_0xf92a('0x4b'),_0x23e3a5[_0xf92a('0x38')]);}};Acw['prototype'][_0xf92a('0xb')]=function(_0x56e95f){try{if(this[_0xf92a('0x2')][_0x56e95f['queue']]&&this[_0xf92a('0x2')][_0x56e95f['queue']][_0xf92a('0x4c')]===_0xf92a('0x4d')){if(this[_0xf92a('0x3')][_0x56e95f['interface']]){logger[_0xf92a('0x1e')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x56e95f[_0xf92a('0x29')],_0x56e95f[_0xf92a('0x14')],_0x56e95f['queue']);return RpcUser[_0xf92a('0x21')](this[_0xf92a('0x3')][_0x56e95f[_0xf92a('0x14')]],_0xf92a('0x4e'),_0x56e95f[_0xf92a('0x29')]);}}}catch(_0x32e5ee){logger[_0xf92a('0x2d')](_0xf92a('0x4f'),_0x32e5ee[_0xf92a('0x38')]);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index bc8145f..49a414f 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 _0xd8b0=['actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','../../config/logger','ami','../../config/environment','asterisk','port','username','password','Action','promisify','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus'];(function(_0x35f342,_0x36b3ff){var _0x15570f=function(_0xd301ab){while(--_0xd301ab){_0x35f342['push'](_0x35f342['shift']());}};_0x15570f(++_0x36b3ff);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Manager=require(_0x0d8b('0x0'));var BPromise=require(_0x0d8b('0x1'));var moment=require('moment');var util=require('util');var _=require('lodash');var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var config=require(_0x0d8b('0x4'));var ami=new Manager(config[_0x0d8b('0x5')][_0x0d8b('0x6')],config['asterisk']['ip'],config['asterisk'][_0x0d8b('0x7')],config[_0x0d8b('0x5')][_0x0d8b('0x8')],!![]);ami['keepConnected']();ami[_0x0d8b('0x9')]=BPromise[_0x0d8b('0xa')](ami['action']);function error(_0x129310){logger[_0x0d8b('0xb')](util[_0x0d8b('0xc')](_0x0d8b('0xd'),config[_0x0d8b('0x5')][_0x0d8b('0x7')],config[_0x0d8b('0x5')]['ip'],config[_0x0d8b('0x5')]['port'],util[_0x0d8b('0xe')](_0x129310,![],null)));}function close(){logger['error'](util[_0x0d8b('0xc')](_0x0d8b('0xf'),config[_0x0d8b('0x5')][_0x0d8b('0x7')],config[_0x0d8b('0x5')]['ip'],config[_0x0d8b('0x5')][_0x0d8b('0x6')]));}ami[_0x0d8b('0x10')]=function(){return function(){return ami[_0x0d8b('0x9')]({'action':_0x0d8b('0x11')});};};ami[_0x0d8b('0x12')]=function(){return function(){return ami[_0x0d8b('0x9')]({'action':_0x0d8b('0x13')});};};ami[_0x0d8b('0x14')]=function(){return function(){return ami['Action']({'action':_0x0d8b('0x15')});};};ami[_0x0d8b('0x16')]=function(){return function(){return ami[_0x0d8b('0x9')]({'action':_0x0d8b('0x17')});};};ami[_0x0d8b('0x18')]=function(){return function(){return ami['Action']({'action':_0x0d8b('0x19')});};};function connect(_0x4586c2){logger[_0x0d8b('0x1a')](util[_0x0d8b('0xc')](_0x0d8b('0x1b'),config[_0x0d8b('0x5')][_0x0d8b('0x7')],config[_0x0d8b('0x5')]['ip'],config['asterisk'][_0x0d8b('0x6')]));ami[_0x0d8b('0x1c')](_0x0d8b('0xb'),error);ami[_0x0d8b('0x1c')](_0x0d8b('0x1d'),close);}ami['on'](_0x0d8b('0x1e'),connect);ami['on'](_0x0d8b('0x1f'),function(_0x352c17){logger['info'](util['format'](_0x0d8b('0x20'),config['asterisk']['username'],config['asterisk']['ip'],config[_0x0d8b('0x5')][_0x0d8b('0x6')],util[_0x0d8b('0xe')](_0x352c17,![],null)));});ami['on'](_0x0d8b('0x21'),function(_0x221071){logger[_0x0d8b('0x1a')](util[_0x0d8b('0xc')](_0x0d8b('0x22'),config[_0x0d8b('0x5')]['username'],config[_0x0d8b('0x5')]['ip'],config[_0x0d8b('0x5')]['port']));return BPromise[_0x0d8b('0x23')]()['then'](ami[_0x0d8b('0x10')]())[_0x0d8b('0x24')](ami[_0x0d8b('0x12')]())['then'](ami['actionSipPeerStatus']())[_0x0d8b('0x24')](ami[_0x0d8b('0x16')]())['then'](ami[_0x0d8b('0x18')]())['catch'](function(_0x1b2b59){logger['error'](_0x0d8b('0x25'),util['inspect'](_0x1b2b59,{'showHidden':![],'depth':null}));});});ami[_0x0d8b('0x1c')]('error',error);ami[_0x0d8b('0x1c')]('close',close);module[_0x0d8b('0x26')]=ami; \ No newline at end of file +var _0xd8b0=['actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','../../config/logger','ami','../../config/environment','asterisk','port','username','password','Action','promisify','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus'];(function(_0x2c341b,_0x32d039){var _0x6c9327=function(_0x53e6d2){while(--_0x53e6d2){_0x2c341b['push'](_0x2c341b['shift']());}};_0x6c9327(++_0x32d039);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Manager=require(_0x0d8b('0x0'));var BPromise=require(_0x0d8b('0x1'));var moment=require('moment');var util=require('util');var _=require('lodash');var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var config=require(_0x0d8b('0x4'));var ami=new Manager(config[_0x0d8b('0x5')][_0x0d8b('0x6')],config['asterisk']['ip'],config['asterisk'][_0x0d8b('0x7')],config[_0x0d8b('0x5')][_0x0d8b('0x8')],!![]);ami['keepConnected']();ami[_0x0d8b('0x9')]=BPromise[_0x0d8b('0xa')](ami['action']);function error(_0x129310){logger[_0x0d8b('0xb')](util[_0x0d8b('0xc')](_0x0d8b('0xd'),config[_0x0d8b('0x5')][_0x0d8b('0x7')],config[_0x0d8b('0x5')]['ip'],config[_0x0d8b('0x5')]['port'],util[_0x0d8b('0xe')](_0x129310,![],null)));}function close(){logger['error'](util[_0x0d8b('0xc')](_0x0d8b('0xf'),config[_0x0d8b('0x5')][_0x0d8b('0x7')],config[_0x0d8b('0x5')]['ip'],config[_0x0d8b('0x5')][_0x0d8b('0x6')]));}ami[_0x0d8b('0x10')]=function(){return function(){return ami[_0x0d8b('0x9')]({'action':_0x0d8b('0x11')});};};ami[_0x0d8b('0x12')]=function(){return function(){return ami[_0x0d8b('0x9')]({'action':_0x0d8b('0x13')});};};ami[_0x0d8b('0x14')]=function(){return function(){return ami['Action']({'action':_0x0d8b('0x15')});};};ami[_0x0d8b('0x16')]=function(){return function(){return ami[_0x0d8b('0x9')]({'action':_0x0d8b('0x17')});};};ami[_0x0d8b('0x18')]=function(){return function(){return ami['Action']({'action':_0x0d8b('0x19')});};};function connect(_0x4586c2){logger[_0x0d8b('0x1a')](util[_0x0d8b('0xc')](_0x0d8b('0x1b'),config[_0x0d8b('0x5')][_0x0d8b('0x7')],config[_0x0d8b('0x5')]['ip'],config['asterisk'][_0x0d8b('0x6')]));ami[_0x0d8b('0x1c')](_0x0d8b('0xb'),error);ami[_0x0d8b('0x1c')](_0x0d8b('0x1d'),close);}ami['on'](_0x0d8b('0x1e'),connect);ami['on'](_0x0d8b('0x1f'),function(_0x352c17){logger['info'](util['format'](_0x0d8b('0x20'),config['asterisk']['username'],config['asterisk']['ip'],config[_0x0d8b('0x5')][_0x0d8b('0x6')],util[_0x0d8b('0xe')](_0x352c17,![],null)));});ami['on'](_0x0d8b('0x21'),function(_0x221071){logger[_0x0d8b('0x1a')](util[_0x0d8b('0xc')](_0x0d8b('0x22'),config[_0x0d8b('0x5')]['username'],config[_0x0d8b('0x5')]['ip'],config[_0x0d8b('0x5')]['port']));return BPromise[_0x0d8b('0x23')]()['then'](ami[_0x0d8b('0x10')]())[_0x0d8b('0x24')](ami[_0x0d8b('0x12')]())['then'](ami['actionSipPeerStatus']())[_0x0d8b('0x24')](ami[_0x0d8b('0x16')]())['then'](ami[_0x0d8b('0x18')]())['catch'](function(_0x1b2b59){logger['error'](_0x0d8b('0x25'),util['inspect'](_0x1b2b59,{'showHidden':![],'depth':null}));});});ami[_0x0d8b('0x1c')]('error',error);ami[_0x0d8b('0x1c')]('close',close);module[_0x0d8b('0x26')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index ad350f9..8b071d7 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda3f=['then','rpc','memberReport','error','message','result','catch','exports','bluebird','../../config/logger','Request','request'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xda3f,0xec));var _0xfda3=function(_0x2c2bf1,_0x3a0e28){_0x2c2bf1=_0x2c2bf1-0x0;var _0x596956=_0xda3f[_0x2c2bf1];return _0x596956;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xfda3('0x0'));var logger=require(_0xfda3('0x1'))('ami');var client=jayson['client']['http']({'port':0x2329});client[_0xfda3('0x2')]=function(_0x581693,_0x36dc71){return new BPromise(function(_0x22187d,_0x516500){return client[_0xfda3('0x3')](_0x581693,_0x36dc71)[_0xfda3('0x4')](function(_0x47e7e2){logger['debug'](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x36dc71,_0x47e7e2);if(_0x47e7e2[_0xfda3('0x7')]){logger[_0xfda3('0x7')](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x47e7e2[_0xfda3('0x7')][_0xfda3('0x8')],_0x36dc71);return _0x516500(_0x47e7e2[_0xfda3('0x7')][_0xfda3('0x8')]);}else{return _0x22187d(_0x47e7e2[_0xfda3('0x9')]);}})[_0xfda3('0xa')](function(_0x4d7841){logger[_0xfda3('0x7')](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x4d7841,_0x36dc71);return _0x516500(_0x4d7841);});});};module[_0xfda3('0xb')]=client; \ No newline at end of file +var _0xac4a=['ami','client','http','then','debug','memberReport','error','message','result','catch','rpc','jayson/promise','bluebird','../../config/logger'];(function(_0x35f83e,_0x30ec55){var _0x249b05=function(_0x2c2fcc){while(--_0x2c2fcc){_0x35f83e['push'](_0x35f83e['shift']());}};_0x249b05(++_0x30ec55);}(_0xac4a,0x13f));var _0xaac4=function(_0x338153,_0x512fea){_0x338153=_0x338153-0x0;var _0x3e356f=_0xac4a[_0x338153];return _0x3e356f;};'use strict';var jayson=require(_0xaac4('0x0'));var BPromise=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var client=jayson[_0xaac4('0x4')][_0xaac4('0x5')]({'port':0x2329});client['Request']=function(_0x58626e,_0x2af0f6){return new BPromise(function(_0x2a5762,_0x32d34c){return client['request'](_0x58626e,_0x2af0f6)[_0xaac4('0x6')](function(_0x53d03a){logger[_0xaac4('0x7')]('rpc',_0xaac4('0x8'),_0x58626e,_0x2af0f6,_0x53d03a);if(_0x53d03a[_0xaac4('0x9')]){logger['error']('rpc',_0xaac4('0x8'),_0x58626e,_0x53d03a['error'][_0xaac4('0xa')],_0x2af0f6);return _0x32d34c(_0x53d03a['error']['message']);}else{return _0x2a5762(_0x53d03a[_0xaac4('0xb')]);}})[_0xaac4('0xc')](function(_0x38d1d0){logger[_0xaac4('0x9')](_0xaac4('0xd'),'memberReport',_0x58626e,_0x38d1d0,_0x2af0f6);return _0x32d34c(_0x38d1d0);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index e8ea950..0bba074 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 _0xc4c7=['voiceQueue','dialCutDigit','substring','util','moment','string','isNil','name','Contact','lastName','number','phone','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','getCaller'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc4c7,0xa7));var _0x7c4c=function(_0x27d0d8,_0x2b657d){_0x27d0d8=_0x27d0d8-0x0;var _0x2b79d1=_0xc4c7[_0x27d0d8];return _0x2b79d1;};'use strict';var util=require(_0x7c4c('0x0'));var _=require('lodash');var moment=require(_0x7c4c('0x1'));function checkNameSurname(_0x42af43,_0x20393b,_0x43c47e){var _0x596837='';if(!_['isNil'](_0x20393b)&&_0x7c4c('0x2')===typeof _0x20393b){_0x596837+=_0x20393b;}if(!_[_0x7c4c('0x3')](_0x43c47e)&&_0x7c4c('0x2')===typeof _0x43c47e){_0x596837+='\x20'+_0x43c47e;}if(_0x596837!==''){return _0x596837;}return _0x42af43;}function Action(_0x3cab61,_0x1d9c49,_0x58a982){this['voiceQueue']=_0x3cab61;this['uniqueid']=_0x58a982||undefined;this[_0x7c4c('0x4')]=checkNameSurname(_0x1d9c49['Contact']['phone'],_0x1d9c49[_0x7c4c('0x5')]['firstName'],_0x1d9c49['Contact'][_0x7c4c('0x6')]);this[_0x7c4c('0x7')]=_0x1d9c49[_0x7c4c('0x8')];this[_0x7c4c('0x9')]=_0x3cab61['name'];this[_0x7c4c('0xa')]=_0x1d9c49[_0x7c4c('0xa')]||![];this[_0x7c4c('0xb')]=_0x3cab61[_0x7c4c('0xb')];this['dialQueueTimeout']=_0x3cab61[_0x7c4c('0xc')]||0x3;this['scheduledat']=_0x1d9c49[_0x7c4c('0xd')];this[_0x7c4c('0xe')]=_0x1d9c49[_0x7c4c('0xe')];this[_0x7c4c('0xf')]=_0x1d9c49[_0x7c4c('0xf')];this[_0x7c4c('0x10')]=_0x1d9c49[_0x7c4c('0x10')];this['countnosuchnumberretry']=_0x1d9c49[_0x7c4c('0x11')];this[_0x7c4c('0x12')]=_0x1d9c49[_0x7c4c('0x12')];this[_0x7c4c('0x13')]=_0x1d9c49[_0x7c4c('0x13')];this[_0x7c4c('0x14')]=_0x1d9c49[_0x7c4c('0x14')];this[_0x7c4c('0x15')]=_0x1d9c49['countagentrejectretry'];this['ContactId']=_0x1d9c49[_0x7c4c('0x16')];this[_0x7c4c('0x17')]=_0x1d9c49[_0x7c4c('0x17')];this[_0x7c4c('0x18')]=_0x1d9c49[_0x7c4c('0x18')];this[_0x7c4c('0x19')]=_0x1d9c49[_0x7c4c('0x19')];this['CampaignId']=_0x1d9c49[_0x7c4c('0x1a')];this[_0x7c4c('0x1b')]=_0x1d9c49['id'];this[_0x7c4c('0x1c')]=_0x1d9c49['Contact']['firstName']||'';this['starttime']=moment()[_0x7c4c('0x1d')](_0x7c4c('0x1e'));this[_0x7c4c('0x1f')]=_0x1d9c49[_0x7c4c('0x1f')];this[_0x7c4c('0x20')]=_0x1d9c49[_0x7c4c('0x20')];this[_0x7c4c('0x21')]=_0x1d9c49[_0x7c4c('0x21')];this[_0x7c4c('0x22')]=_0x1d9c49[_0x7c4c('0x22')];this[_0x7c4c('0x23')]='';this['originatecalleridname']='';}Action[_0x7c4c('0x24')][_0x7c4c('0x25')]=function(){return util['format']('\x22%s\x22\x20<%s>',this['name'],this[_0x7c4c('0x26')][_0x7c4c('0x27')]>0x0?this['number'][_0x7c4c('0x28')](this[_0x7c4c('0x26')][_0x7c4c('0x27')]):this[_0x7c4c('0x7')]);};Action[_0x7c4c('0x24')]['getQueue']=function(){return this[_0x7c4c('0x9')];};module['exports']=Action; \ No newline at end of file +var _0x9720=['ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','queue','exports','util','lodash','moment','string','voiceQueue','uniqueid','Contact','phone','firstName','lastName','number','name','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper'];(function(_0x3bfa11,_0x276b2d){var _0x4a940e=function(_0x2644c7){while(--_0x2644c7){_0x3bfa11['push'](_0x3bfa11['shift']());}};_0x4a940e(++_0x276b2d);}(_0x9720,0x8e));var _0x0972=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0x9720[_0x2faddb];return _0x273c05;};'use strict';var util=require(_0x0972('0x0'));var _=require(_0x0972('0x1'));var moment=require(_0x0972('0x2'));function checkNameSurname(_0x4d1163,_0x4a2eba,_0x85827c){var _0x104089='';if(!_['isNil'](_0x4a2eba)&&_0x0972('0x3')===typeof _0x4a2eba){_0x104089+=_0x4a2eba;}if(!_['isNil'](_0x85827c)&&_0x0972('0x3')===typeof _0x85827c){_0x104089+='\x20'+_0x85827c;}if(_0x104089!==''){return _0x104089;}return _0x4d1163;}function Action(_0x3678b9,_0x1dbc68,_0x4cf4f9){this[_0x0972('0x4')]=_0x3678b9;this[_0x0972('0x5')]=_0x4cf4f9||undefined;this['name']=checkNameSurname(_0x1dbc68[_0x0972('0x6')][_0x0972('0x7')],_0x1dbc68['Contact'][_0x0972('0x8')],_0x1dbc68[_0x0972('0x6')][_0x0972('0x9')]);this[_0x0972('0xa')]=_0x1dbc68[_0x0972('0x7')];this['queue']=_0x3678b9[_0x0972('0xb')];this['active']=_0x1dbc68['active']||![];this['type']=_0x3678b9['type'];this[_0x0972('0xc')]=_0x3678b9[_0x0972('0xc')]||0x3;this[_0x0972('0xd')]=_0x1dbc68[_0x0972('0xd')];this['countbusyretry']=_0x1dbc68[_0x0972('0xe')];this[_0x0972('0xf')]=_0x1dbc68['countcongestionretry'];this[_0x0972('0x10')]=_0x1dbc68[_0x0972('0x10')];this[_0x0972('0x11')]=_0x1dbc68[_0x0972('0x11')];this['countdropretry']=_0x1dbc68[_0x0972('0x12')];this['countabandonedretry']=_0x1dbc68['countabandonedretry'];this['countmachineretry']=_0x1dbc68['countmachineretry'];this[_0x0972('0x13')]=_0x1dbc68[_0x0972('0x13')];this[_0x0972('0x14')]=_0x1dbc68['ContactId'];this[_0x0972('0x15')]=_0x1dbc68[_0x0972('0x15')];this[_0x0972('0x16')]=_0x1dbc68[_0x0972('0x16')];this[_0x0972('0x17')]=_0x1dbc68['VoiceQueueId'];this[_0x0972('0x18')]=_0x1dbc68[_0x0972('0x18')];this[_0x0972('0x19')]=_0x1dbc68['id'];this[_0x0972('0x1a')]=_0x1dbc68['Contact']['firstName']||'';this[_0x0972('0x1b')]=moment()[_0x0972('0x1c')](_0x0972('0x1d'));this[_0x0972('0x1e')]=_0x1dbc68[_0x0972('0x1e')];this[_0x0972('0x1f')]=_0x1dbc68[_0x0972('0x1f')];this[_0x0972('0x20')]=_0x1dbc68['callbackat'];this[_0x0972('0x21')]=_0x1dbc68[_0x0972('0x21')];this['originatecalleridnum']='';this[_0x0972('0x22')]='';}Action[_0x0972('0x23')][_0x0972('0x24')]=function(){return util[_0x0972('0x1c')](_0x0972('0x25'),this[_0x0972('0xb')],this[_0x0972('0x4')][_0x0972('0x26')]>0x0?this[_0x0972('0xa')][_0x0972('0x27')](this[_0x0972('0x4')][_0x0972('0x26')]):this[_0x0972('0xa')]);};Action['prototype']['getQueue']=function(){return this[_0x0972('0x28')];};module[_0x0972('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 cd3a8cc..bab6e10 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 _0xd786=['responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime'];(function(_0x59a7a6,_0x729eee){var _0x524ac4=function(_0x5a836c){while(--_0x5a836c){_0x59a7a6['push'](_0x59a7a6['shift']());}};_0x524ac4(++_0x729eee);}(_0xd786,0x18a));var _0x6d78=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xd786[_0x297fd3];return _0x2af381;};'use strict';var util=require(_0x6d78('0x0'));var _=require(_0x6d78('0x1'));var moment=require(_0x6d78('0x2'));function getSeconds(_0x285dae,_0x24f9f2){var _0xba980d=moment(_0x285dae)[_0x6d78('0x3')](0x0);var _0x232307=moment(_0x24f9f2)[_0x6d78('0x3')](0x0);return _0xba980d[_0x6d78('0x4')](_0x232307,_0x6d78('0x5'));}function AgentComplete(_0x34f50d,_0x378060){this[_0x6d78('0x6')]=0x4;this[_0x6d78('0x7')]=_0x6d78('0x8');this[_0x6d78('0x9')]=_0x34f50d['scheduledat'];this[_0x6d78('0xa')]=_0x34f50d[_0x6d78('0xa')];this[_0x6d78('0xb')]=_0x34f50d[_0x6d78('0xa')]===_0x6d78('0xc')?_0x6d78('0xd'):_0x34f50d[_0x6d78('0xa')];this['countbusyretry']=_0x34f50d[_0x6d78('0xe')];this['countcongestionretry']=_0x34f50d[_0x6d78('0xf')];this['countnoanswerretry']=_0x34f50d[_0x6d78('0x10')];this[_0x6d78('0x11')]=_0x34f50d[_0x6d78('0xe')]+_0x34f50d[_0x6d78('0xf')]+_0x34f50d[_0x6d78('0x10')]+_0x34f50d[_0x6d78('0x12')]+_0x34f50d['countdropretry']+_0x34f50d['countabandonedretry']+_0x34f50d[_0x6d78('0x13')]+_0x34f50d[_0x6d78('0x14')];this[_0x6d78('0x12')]=_0x34f50d['countnosuchnumberretry'];this[_0x6d78('0x15')]=_0x34f50d[_0x6d78('0x15')];this['countabandonedretry']=_0x34f50d[_0x6d78('0x16')];this[_0x6d78('0x13')]=_0x34f50d[_0x6d78('0x13')];this[_0x6d78('0x14')]=_0x34f50d[_0x6d78('0x14')];this[_0x6d78('0x17')]=_0x378060['uniqueid'];this[_0x6d78('0x18')]=_0x34f50d[_0x6d78('0x19')];this[_0x6d78('0x1a')]=_0x34f50d[_0x6d78('0x1b')];this[_0x6d78('0x1c')]=_0x34f50d['starttime'];this[_0x6d78('0x1d')]=_0x34f50d[_0x6d78('0x1d')];this[_0x6d78('0x1e')]=_0x34f50d['answertime'];this['endtime']=moment()[_0x6d78('0x1f')](_0x6d78('0x20'));this['ringtime']=getSeconds(_0x34f50d[_0x6d78('0x1d')],_0x34f50d['starttime']);this['holdtime']=getSeconds(_0x34f50d['answertime'],_0x34f50d[_0x6d78('0x1d')]);this[_0x6d78('0x21')]=getSeconds(this['endtime'],_0x34f50d[_0x6d78('0x1e')]);this[_0x6d78('0xd')]=_0x378060[_0x6d78('0xd')];this[_0x6d78('0x22')]=_0x378060[_0x6d78('0x22')];this[_0x6d78('0x23')]=_0x378060[_0x6d78('0x23')];this[_0x6d78('0x24')]=_0x34f50d['callback'];this[_0x6d78('0x25')]=_0x34f50d[_0x6d78('0x25')];this['callbackat']=_0x34f50d[_0x6d78('0x26')];this['recallme']=_0x34f50d[_0x6d78('0x27')];this[_0x6d78('0x28')]=_0x34f50d[_0x6d78('0x28')];this['ListId']=_0x34f50d[_0x6d78('0x29')];this[_0x6d78('0x2a')]=_0x34f50d[_0x6d78('0x2a')];this['VoiceQueueId']=_0x34f50d['VoiceQueueId'];this['CampaignId']=_0x34f50d[_0x6d78('0x2b')];this[_0x6d78('0x2c')]=_0x34f50d[_0x6d78('0x2c')]||'';this['originatecalleridname']=_0x34f50d[_0x6d78('0x2d')]||'';}module[_0x6d78('0x2e')]=AgentComplete; \ No newline at end of file +var _0x2649=['countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','answertime','format','ringtime','holdtime','talktime','endtime','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','countabandonedretry','countmachineretry'];(function(_0xaf8f6b,_0x2f1d8c){var _0x36b483=function(_0x4d9604){while(--_0x4d9604){_0xaf8f6b['push'](_0xaf8f6b['shift']());}};_0x36b483(++_0x2f1d8c);}(_0x2649,0xa4));var _0x9264=function(_0x4ab3fb,_0x776775){_0x4ab3fb=_0x4ab3fb-0x0;var _0x34fe1e=_0x2649[_0x4ab3fb];return _0x34fe1e;};'use strict';var util=require(_0x9264('0x0'));var _=require(_0x9264('0x1'));var moment=require(_0x9264('0x2'));function getSeconds(_0xc613fc,_0x1103e2){var _0x4ae04b=moment(_0xc613fc)['milliseconds'](0x0);var _0x4a2aa7=moment(_0x1103e2)[_0x9264('0x3')](0x0);return _0x4ae04b[_0x9264('0x4')](_0x4a2aa7,_0x9264('0x5'));}function AgentComplete(_0x3c70b5,_0xbfd63d){this[_0x9264('0x6')]=0x4;this[_0x9264('0x7')]='Answer';this[_0x9264('0x8')]=_0x3c70b5[_0x9264('0x8')];this[_0x9264('0x9')]=_0x3c70b5[_0x9264('0x9')];this[_0x9264('0xa')]=_0x3c70b5[_0x9264('0x9')]===_0x9264('0xb')?_0x9264('0xc'):_0x3c70b5[_0x9264('0x9')];this[_0x9264('0xd')]=_0x3c70b5[_0x9264('0xd')];this['countcongestionretry']=_0x3c70b5[_0x9264('0xe')];this[_0x9264('0xf')]=_0x3c70b5[_0x9264('0xf')];this['countglobal']=_0x3c70b5[_0x9264('0xd')]+_0x3c70b5[_0x9264('0xe')]+_0x3c70b5[_0x9264('0xf')]+_0x3c70b5[_0x9264('0x10')]+_0x3c70b5[_0x9264('0x11')]+_0x3c70b5[_0x9264('0x12')]+_0x3c70b5[_0x9264('0x13')]+_0x3c70b5[_0x9264('0x14')];this[_0x9264('0x10')]=_0x3c70b5[_0x9264('0x10')];this[_0x9264('0x11')]=_0x3c70b5[_0x9264('0x11')];this[_0x9264('0x12')]=_0x3c70b5[_0x9264('0x12')];this[_0x9264('0x13')]=_0x3c70b5['countmachineretry'];this[_0x9264('0x14')]=_0x3c70b5['countagentrejectretry'];this[_0x9264('0x15')]=_0xbfd63d['uniqueid'];this[_0x9264('0x16')]=_0x3c70b5[_0x9264('0x17')];this[_0x9264('0x18')]=_0x3c70b5['number'];this['starttime']=_0x3c70b5[_0x9264('0x19')];this[_0x9264('0x1a')]=_0x3c70b5[_0x9264('0x1a')];this[_0x9264('0x1b')]=_0x3c70b5[_0x9264('0x1b')];this['endtime']=moment()[_0x9264('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x9264('0x1d')]=getSeconds(_0x3c70b5[_0x9264('0x1a')],_0x3c70b5[_0x9264('0x19')]);this[_0x9264('0x1e')]=getSeconds(_0x3c70b5[_0x9264('0x1b')],_0x3c70b5[_0x9264('0x1a')]);this[_0x9264('0x1f')]=getSeconds(this[_0x9264('0x20')],_0x3c70b5['answertime']);this[_0x9264('0xc')]=_0xbfd63d[_0x9264('0xc')];this[_0x9264('0x21')]=_0xbfd63d['membername'];this[_0x9264('0x22')]=_0xbfd63d[_0x9264('0x22')];this[_0x9264('0x23')]=_0x3c70b5[_0x9264('0x23')];this['callbackuniqueid']=_0x3c70b5[_0x9264('0x24')];this[_0x9264('0x25')]=_0x3c70b5['callbackat'];this[_0x9264('0x26')]=_0x3c70b5[_0x9264('0x26')];this[_0x9264('0x27')]=_0x3c70b5[_0x9264('0x27')];this['ListId']=_0x3c70b5[_0x9264('0x28')];this[_0x9264('0x29')]=_0x3c70b5[_0x9264('0x29')];this[_0x9264('0x2a')]=_0x3c70b5[_0x9264('0x2a')];this['CampaignId']=_0x3c70b5[_0x9264('0x2b')];this[_0x9264('0x2c')]=_0x3c70b5['originatecalleridnum']||'';this[_0x9264('0x2d')]=_0x3c70b5[_0x9264('0x2d')]||'';}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 6b245e1..be639f6 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 _0xfd87=['ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridnum','starttime','responsetime','endtime'];(function(_0x53f402,_0x326920){var _0x45a76d=function(_0x51f590){while(--_0x51f590){_0x53f402['push'](_0x53f402['shift']());}};_0x45a76d(++_0x326920);}(_0xfd87,0x80));var _0x7fd8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd87[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x7fd8('0x0'));var _=require(_0x7fd8('0x1'));var moment=require(_0x7fd8('0x2'));function getSeconds(_0x42ecd1,_0x11b128){var _0x15d25f=moment(_0x42ecd1)[_0x7fd8('0x3')](0x0);var _0x42b06c=moment(_0x11b128)[_0x7fd8('0x3')](0x0);return _0x15d25f[_0x7fd8('0x4')](_0x42b06c,_0x7fd8('0x5'));}function Final(_0x5b80b2){this[_0x7fd8('0x6')]=_0x5b80b2[_0x7fd8('0x6')];this['scheduledat']=_0x5b80b2[_0x7fd8('0x7')];this[_0x7fd8('0x8')]=_0x5b80b2[_0x7fd8('0x8')];this[_0x7fd8('0x9')]=_0x5b80b2[_0x7fd8('0x8')]==='outbound'?_0x7fd8('0xa'):_0x5b80b2[_0x7fd8('0x8')];this[_0x7fd8('0xb')]=_0x5b80b2['countbusyretry'];this['countcongestionretry']=_0x5b80b2['countcongestionretry'];this[_0x7fd8('0xc')]=_0x5b80b2['countnoanswerretry'];this[_0x7fd8('0xd')]=_0x5b80b2[_0x7fd8('0xb')]+_0x5b80b2[_0x7fd8('0xe')]+_0x5b80b2['countnoanswerretry']+_0x5b80b2[_0x7fd8('0xf')]+_0x5b80b2[_0x7fd8('0x10')]+_0x5b80b2[_0x7fd8('0x11')]+_0x5b80b2[_0x7fd8('0x12')]+_0x5b80b2[_0x7fd8('0x13')];this['countnosuchnumberretry']=_0x5b80b2[_0x7fd8('0xf')];this[_0x7fd8('0x10')]=_0x5b80b2[_0x7fd8('0x10')];this[_0x7fd8('0x11')]=_0x5b80b2[_0x7fd8('0x11')];this[_0x7fd8('0x12')]=_0x5b80b2[_0x7fd8('0x12')];this[_0x7fd8('0x13')]=_0x5b80b2[_0x7fd8('0x13')];this[_0x7fd8('0xa')]=_0x5b80b2[_0x7fd8('0xa')];this['calleridname']=_0x5b80b2['calleridname'];this['calleridnum']=_0x5b80b2[_0x7fd8('0x14')];this[_0x7fd8('0x15')]=_0x5b80b2['starttime'];this[_0x7fd8('0x16')]=_0x5b80b2[_0x7fd8('0x16')];this[_0x7fd8('0x17')]=_0x5b80b2[_0x7fd8('0x16')];this[_0x7fd8('0x18')]=_0x5b80b2[_0x7fd8('0x18')]||0x0;this[_0x7fd8('0x19')]=_0x5b80b2[_0x7fd8('0x19')]||0x0;this['talktime']=_0x5b80b2[_0x7fd8('0x1a')]||0x0;this[_0x7fd8('0x1b')]=_0x5b80b2[_0x7fd8('0x1b')];this[_0x7fd8('0x1c')]=_0x5b80b2[_0x7fd8('0x1c')];this[_0x7fd8('0x1d')]=_0x5b80b2['callbackat'];this[_0x7fd8('0x1e')]=_0x5b80b2[_0x7fd8('0x1e')];this[_0x7fd8('0x1f')]=_0x5b80b2[_0x7fd8('0x1f')];this['ListId']=_0x5b80b2[_0x7fd8('0x20')];this[_0x7fd8('0x21')]=_0x5b80b2[_0x7fd8('0x21')];this[_0x7fd8('0x22')]=_0x5b80b2[_0x7fd8('0x22')];this['CampaignId']=_0x5b80b2['CampaignId'];this[_0x7fd8('0x23')]=_0x5b80b2[_0x7fd8('0x23')]||'';this[_0x7fd8('0x24')]=_0x5b80b2[_0x7fd8('0x24')]||'';}module[_0x7fd8('0x25')]=Final; \ No newline at end of file +var _0xf0ba=['talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime'];(function(_0x45d5bb,_0x3cd8c7){var _0x174ac6=function(_0x48adde){while(--_0x48adde){_0x45d5bb['push'](_0x45d5bb['shift']());}};_0x174ac6(++_0x3cd8c7);}(_0xf0ba,0x1ed));var _0xaf0b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf0ba[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0xaf0b('0x0'));var _=require(_0xaf0b('0x1'));var moment=require(_0xaf0b('0x2'));function getSeconds(_0x38cf45,_0xea88b2){var _0x555620=moment(_0x38cf45)[_0xaf0b('0x3')](0x0);var _0xce0364=moment(_0xea88b2)['milliseconds'](0x0);return _0x555620[_0xaf0b('0x4')](_0xce0364,'seconds');}function Final(_0x444a7d){this['uniqueid']=_0x444a7d['uniqueid'];this[_0xaf0b('0x5')]=_0x444a7d[_0xaf0b('0x5')];this[_0xaf0b('0x6')]=_0x444a7d[_0xaf0b('0x6')];this[_0xaf0b('0x7')]=_0x444a7d['type']===_0xaf0b('0x8')?_0xaf0b('0x9'):_0x444a7d[_0xaf0b('0x6')];this['countbusyretry']=_0x444a7d[_0xaf0b('0xa')];this['countcongestionretry']=_0x444a7d[_0xaf0b('0xb')];this[_0xaf0b('0xc')]=_0x444a7d[_0xaf0b('0xc')];this['countglobal']=_0x444a7d[_0xaf0b('0xa')]+_0x444a7d[_0xaf0b('0xb')]+_0x444a7d[_0xaf0b('0xc')]+_0x444a7d[_0xaf0b('0xd')]+_0x444a7d[_0xaf0b('0xe')]+_0x444a7d[_0xaf0b('0xf')]+_0x444a7d['countmachineretry']+_0x444a7d[_0xaf0b('0x10')];this[_0xaf0b('0xd')]=_0x444a7d[_0xaf0b('0xd')];this[_0xaf0b('0xe')]=_0x444a7d['countdropretry'];this[_0xaf0b('0xf')]=_0x444a7d[_0xaf0b('0xf')];this[_0xaf0b('0x11')]=_0x444a7d[_0xaf0b('0x11')];this[_0xaf0b('0x10')]=_0x444a7d[_0xaf0b('0x10')];this[_0xaf0b('0x9')]=_0x444a7d[_0xaf0b('0x9')];this['calleridname']=_0x444a7d[_0xaf0b('0x12')];this['calleridnum']=_0x444a7d[_0xaf0b('0x13')];this[_0xaf0b('0x14')]=_0x444a7d[_0xaf0b('0x14')];this[_0xaf0b('0x15')]=_0x444a7d[_0xaf0b('0x15')];this[_0xaf0b('0x16')]=_0x444a7d[_0xaf0b('0x15')];this[_0xaf0b('0x17')]=_0x444a7d[_0xaf0b('0x17')]||0x0;this[_0xaf0b('0x18')]=_0x444a7d['holdtime']||0x0;this[_0xaf0b('0x19')]=_0x444a7d[_0xaf0b('0x19')]||0x0;this[_0xaf0b('0x1a')]=_0x444a7d['callback'];this[_0xaf0b('0x1b')]=_0x444a7d[_0xaf0b('0x1b')];this['callbackat']=_0x444a7d[_0xaf0b('0x1c')];this[_0xaf0b('0x1d')]=_0x444a7d[_0xaf0b('0x1d')];this[_0xaf0b('0x1e')]=_0x444a7d[_0xaf0b('0x1e')];this['ListId']=_0x444a7d['ListId'];this[_0xaf0b('0x1f')]=_0x444a7d[_0xaf0b('0x1f')];this[_0xaf0b('0x20')]=_0x444a7d[_0xaf0b('0x20')];this[_0xaf0b('0x21')]=_0x444a7d[_0xaf0b('0x21')];this[_0xaf0b('0x22')]=_0x444a7d[_0xaf0b('0x22')]||'';this['originatecalleridname']=_0x444a7d[_0xaf0b('0x23')]||'';}module[_0xaf0b('0x24')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 786271c..e2f0778 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 _0xd7df=['statedesc','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','name','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','lodash','moment','diff','seconds','state'];(function(_0x169074,_0x4d8188){var _0x1b35f1=function(_0x1f6eb4){while(--_0x1f6eb4){_0x169074['push'](_0x169074['shift']());}};_0x1b35f1(++_0x4d8188);}(_0xd7df,0x187));var _0xfd7d=function(_0x10733d,_0x326471){_0x10733d=_0x10733d-0x0;var _0x502b3d=_0xd7df[_0x10733d];return _0x502b3d;};'use strict';var util=require('util');var _=require(_0xfd7d('0x0'));var moment=require(_0xfd7d('0x1'));function getSeconds(_0xf728fe,_0x26f68c){var _0x3ca367=moment(_0xf728fe)['milliseconds'](0x0);var _0x3f6b51=moment(_0x26f68c)['milliseconds'](0x0);return _0x3ca367[_0xfd7d('0x2')](_0x3f6b51,_0xfd7d('0x3'));}function Hangup(_0x35e5c7,_0x1feb09){this[_0xfd7d('0x4')]=0x4;this[_0xfd7d('0x5')]='Answer';this[_0xfd7d('0x6')]=_0x35e5c7[_0xfd7d('0x6')];this['type']=_0x35e5c7[_0xfd7d('0x7')];this['campaigntype']=_0x35e5c7[_0xfd7d('0x7')]===_0xfd7d('0x8')?_0xfd7d('0x9'):_0x35e5c7[_0xfd7d('0x7')];this[_0xfd7d('0xa')]=_0x35e5c7[_0xfd7d('0xa')];this[_0xfd7d('0xb')]=_0x35e5c7[_0xfd7d('0xb')];this[_0xfd7d('0xc')]=_0x35e5c7[_0xfd7d('0xc')];this[_0xfd7d('0xd')]=_0x35e5c7['countbusyretry']+_0x35e5c7[_0xfd7d('0xb')]+_0x35e5c7[_0xfd7d('0xc')]+_0x35e5c7[_0xfd7d('0xe')]+_0x35e5c7['countdropretry']+_0x35e5c7[_0xfd7d('0xf')]+_0x35e5c7[_0xfd7d('0x10')]+_0x35e5c7[_0xfd7d('0x11')];this[_0xfd7d('0xe')]=_0x35e5c7[_0xfd7d('0xe')];this[_0xfd7d('0x12')]=_0x35e5c7[_0xfd7d('0x12')];this[_0xfd7d('0xf')]=_0x35e5c7[_0xfd7d('0xf')];this[_0xfd7d('0x10')]=_0x35e5c7[_0xfd7d('0x10')];this['countagentrejectretry']=_0x35e5c7[_0xfd7d('0x11')];this[_0xfd7d('0x13')]=_0x1feb09['uniqueid'];this[_0xfd7d('0x14')]=_0x35e5c7[_0xfd7d('0x15')];this['calleridnum']=_0x35e5c7[_0xfd7d('0x16')];this[_0xfd7d('0x17')]=_0x35e5c7[_0xfd7d('0x17')];this[_0xfd7d('0x18')]=_0x35e5c7[_0xfd7d('0x18')];this[_0xfd7d('0x19')]=moment()[_0xfd7d('0x1a')](_0xfd7d('0x1b'));this[_0xfd7d('0x1c')]=getSeconds(_0x35e5c7[_0xfd7d('0x18')],_0x35e5c7['starttime']);this[_0xfd7d('0x1d')]=0x0;this[_0xfd7d('0x1e')]=getSeconds(this[_0xfd7d('0x19')],_0x35e5c7['responsetime']);this[_0xfd7d('0x9')]=_0x35e5c7[_0xfd7d('0x9')];this[_0xfd7d('0x1f')]=_0xfd7d('0x20');this[_0xfd7d('0x21')]=_0x1feb09['cause-txt'];this[_0xfd7d('0x22')]=_0x35e5c7[_0xfd7d('0x22')];this['callbackuniqueid']=_0x35e5c7[_0xfd7d('0x23')];this[_0xfd7d('0x24')]=_0x35e5c7[_0xfd7d('0x24')];this[_0xfd7d('0x25')]=_0x35e5c7[_0xfd7d('0x25')];this[_0xfd7d('0x26')]=_0x35e5c7[_0xfd7d('0x26')];this['ListId']=_0x35e5c7[_0xfd7d('0x27')];this[_0xfd7d('0x28')]=_0x35e5c7['UserId'];this[_0xfd7d('0x29')]=_0x35e5c7[_0xfd7d('0x29')];this[_0xfd7d('0x2a')]=_0x35e5c7[_0xfd7d('0x2a')];}module[_0xfd7d('0x2b')]=Hangup; \ No newline at end of file +var _0x175e=['membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','moment','milliseconds','seconds','state','Answer','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime'];(function(_0x199cd7,_0x1a9b2c){var _0x2c550c=function(_0xfd0791){while(--_0xfd0791){_0x199cd7['push'](_0x199cd7['shift']());}};_0x2c550c(++_0x1a9b2c);}(_0x175e,0x11c));var _0xe175=function(_0x5ab3a8,_0x13a604){_0x5ab3a8=_0x5ab3a8-0x0;var _0x5bdf37=_0x175e[_0x5ab3a8];return _0x5bdf37;};'use strict';var util=require(_0xe175('0x0'));var _=require('lodash');var moment=require(_0xe175('0x1'));function getSeconds(_0x44e13f,_0x484f60){var _0x4628b3=moment(_0x44e13f)[_0xe175('0x2')](0x0);var _0x147b91=moment(_0x484f60)[_0xe175('0x2')](0x0);return _0x4628b3['diff'](_0x147b91,_0xe175('0x3'));}function Hangup(_0x20511d,_0x3a7770){this[_0xe175('0x4')]=0x4;this['statedesc']=_0xe175('0x5');this[_0xe175('0x6')]=_0x20511d['scheduledat'];this[_0xe175('0x7')]=_0x20511d[_0xe175('0x7')];this['campaigntype']=_0x20511d[_0xe175('0x7')]==='outbound'?_0xe175('0x8'):_0x20511d['type'];this[_0xe175('0x9')]=_0x20511d[_0xe175('0x9')];this[_0xe175('0xa')]=_0x20511d['countcongestionretry'];this[_0xe175('0xb')]=_0x20511d['countnoanswerretry'];this[_0xe175('0xc')]=_0x20511d[_0xe175('0x9')]+_0x20511d['countcongestionretry']+_0x20511d[_0xe175('0xb')]+_0x20511d['countnosuchnumberretry']+_0x20511d['countdropretry']+_0x20511d['countabandonedretry']+_0x20511d[_0xe175('0xd')]+_0x20511d[_0xe175('0xe')];this[_0xe175('0xf')]=_0x20511d[_0xe175('0xf')];this['countdropretry']=_0x20511d[_0xe175('0x10')];this[_0xe175('0x11')]=_0x20511d[_0xe175('0x11')];this['countmachineretry']=_0x20511d[_0xe175('0xd')];this[_0xe175('0xe')]=_0x20511d[_0xe175('0xe')];this[_0xe175('0x12')]=_0x3a7770['uniqueid'];this[_0xe175('0x13')]=_0x20511d[_0xe175('0x14')];this[_0xe175('0x15')]=_0x20511d[_0xe175('0x16')];this[_0xe175('0x17')]=_0x20511d[_0xe175('0x17')];this[_0xe175('0x18')]=_0x20511d[_0xe175('0x18')];this[_0xe175('0x19')]=moment()[_0xe175('0x1a')](_0xe175('0x1b'));this[_0xe175('0x1c')]=getSeconds(_0x20511d[_0xe175('0x18')],_0x20511d[_0xe175('0x17')]);this[_0xe175('0x1d')]=0x0;this[_0xe175('0x1e')]=getSeconds(this[_0xe175('0x19')],_0x20511d[_0xe175('0x18')]);this['queue']=_0x20511d[_0xe175('0x8')];this[_0xe175('0x1f')]=_0xe175('0x20');this[_0xe175('0x21')]=_0x3a7770[_0xe175('0x22')];this[_0xe175('0x23')]=_0x20511d[_0xe175('0x23')];this['callbackuniqueid']=_0x20511d[_0xe175('0x24')];this[_0xe175('0x25')]=_0x20511d['callbackat'];this['recallme']=_0x20511d[_0xe175('0x26')];this[_0xe175('0x27')]=_0x20511d[_0xe175('0x27')];this[_0xe175('0x28')]=_0x20511d[_0xe175('0x28')];this[_0xe175('0x29')]=_0x20511d['UserId'];this[_0xe175('0x2a')]=_0x20511d[_0xe175('0x2a')];this[_0xe175('0x2b')]=_0x20511d[_0xe175('0x2b')];}module[_0xe175('0x2c')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 725ce67..3dd74a3 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 _0x20a9=['countagentrejectretry','countdropretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry'];(function(_0x26706e,_0x146663){var _0x29f56d=function(_0x5d077e){while(--_0x5d077e){_0x26706e['push'](_0x26706e['shift']());}};_0x29f56d(++_0x146663);}(_0x20a9,0x101));var _0x920a=function(_0x11b58d,_0x555c55){_0x11b58d=_0x11b58d-0x0;var _0xc2811b=_0x20a9[_0x11b58d];return _0xc2811b;};'use strict';var util=require('util');var _=require(_0x920a('0x0'));var moment=require(_0x920a('0x1'));function getSeconds(_0x9aeb02,_0xca71f4){var _0x25b2fd=moment(_0x9aeb02)[_0x920a('0x2')](0x0);var _0x4579a9=moment(_0xca71f4)['milliseconds'](0x0);return _0x25b2fd[_0x920a('0x3')](_0x4579a9,_0x920a('0x4'));}function History(_0x1e4cbc){this['uniqueid']=_0x1e4cbc['uniqueid'];this[_0x920a('0x5')]=_0x1e4cbc[_0x920a('0x5')]||undefined;this[_0x920a('0x6')]=_0x1e4cbc['type'];this[_0x920a('0x7')]=_0x1e4cbc['type']===_0x920a('0x8')?_0x920a('0x9'):_0x1e4cbc[_0x920a('0x6')];this[_0x920a('0xa')]=_0x1e4cbc[_0x920a('0xa')];this['countcongestionretry']=_0x1e4cbc[_0x920a('0xb')];this['countnoanswerretry']=_0x1e4cbc[_0x920a('0xc')];this['countglobal']=_0x1e4cbc['countbusyretry']+_0x1e4cbc['countcongestionretry']+_0x1e4cbc['countnoanswerretry']+_0x1e4cbc[_0x920a('0xd')]+_0x1e4cbc['countdropretry']+_0x1e4cbc[_0x920a('0xe')]+_0x1e4cbc[_0x920a('0xf')]+_0x1e4cbc[_0x920a('0x10')];this['countnosuchnumberretry']=_0x1e4cbc[_0x920a('0xd')];this[_0x920a('0x11')]=_0x1e4cbc[_0x920a('0x11')];this['countabandonedretry']=_0x1e4cbc[_0x920a('0xe')];this[_0x920a('0xf')]=_0x1e4cbc[_0x920a('0xf')];this[_0x920a('0x10')]=_0x1e4cbc[_0x920a('0x10')];this[_0x920a('0x9')]=_0x1e4cbc['queue'];this[_0x920a('0x12')]=_0x1e4cbc[_0x920a('0x13')];this[_0x920a('0x14')]=_0x1e4cbc[_0x920a('0x15')];this[_0x920a('0x16')]=_0x1e4cbc['starttime'];this[_0x920a('0x17')]=_0x1e4cbc[_0x920a('0x17')];this[_0x920a('0x18')]=_0x1e4cbc[_0x920a('0x17')];this[_0x920a('0x19')]=getSeconds(_0x1e4cbc[_0x920a('0x17')],_0x1e4cbc['starttime']);this[_0x920a('0x1a')]=0x0;this[_0x920a('0x1b')]=0x0;this[_0x920a('0x1c')]=_0x1e4cbc['callback'];this[_0x920a('0x1d')]=_0x1e4cbc[_0x920a('0x1d')];this['callbackat']=_0x1e4cbc['callbackat'];this[_0x920a('0x1e')]=_0x1e4cbc[_0x920a('0x1e')];this[_0x920a('0x1f')]=_0x1e4cbc[_0x920a('0x1f')];this['ListId']=_0x1e4cbc[_0x920a('0x20')];this[_0x920a('0x21')]=_0x1e4cbc[_0x920a('0x21')];this[_0x920a('0x22')]=_0x1e4cbc[_0x920a('0x22')];this[_0x920a('0x23')]=_0x1e4cbc['CampaignId'];this[_0x920a('0x24')]=_0x1e4cbc[_0x920a('0x24')]||'';this['originatecalleridname']=_0x1e4cbc[_0x920a('0x25')]||'';}module[_0x920a('0x26')]=History; \ No newline at end of file +var _0xe63e=['ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime'];(function(_0x26bfdc,_0x3a9b3f){var _0xb449ca=function(_0x360192){while(--_0x360192){_0x26bfdc['push'](_0x26bfdc['shift']());}};_0xb449ca(++_0x3a9b3f);}(_0xe63e,0xda));var _0xee63=function(_0x520abd,_0x2839f0){_0x520abd=_0x520abd-0x0;var _0x157b46=_0xe63e[_0x520abd];return _0x157b46;};'use strict';var util=require(_0xee63('0x0'));var _=require(_0xee63('0x1'));var moment=require(_0xee63('0x2'));function getSeconds(_0x36afb3,_0x431d7b){var _0x453e1a=moment(_0x36afb3)['milliseconds'](0x0);var _0x242985=moment(_0x431d7b)[_0xee63('0x3')](0x0);return _0x453e1a[_0xee63('0x4')](_0x242985,_0xee63('0x5'));}function History(_0x3cbdcd){this[_0xee63('0x6')]=_0x3cbdcd[_0xee63('0x6')];this['scheduledat']=_0x3cbdcd[_0xee63('0x7')]||undefined;this['type']=_0x3cbdcd[_0xee63('0x8')];this[_0xee63('0x9')]=_0x3cbdcd['type']===_0xee63('0xa')?_0xee63('0xb'):_0x3cbdcd['type'];this[_0xee63('0xc')]=_0x3cbdcd['countbusyretry'];this['countcongestionretry']=_0x3cbdcd['countcongestionretry'];this[_0xee63('0xd')]=_0x3cbdcd[_0xee63('0xd')];this[_0xee63('0xe')]=_0x3cbdcd[_0xee63('0xc')]+_0x3cbdcd[_0xee63('0xf')]+_0x3cbdcd[_0xee63('0xd')]+_0x3cbdcd[_0xee63('0x10')]+_0x3cbdcd[_0xee63('0x11')]+_0x3cbdcd[_0xee63('0x12')]+_0x3cbdcd[_0xee63('0x13')]+_0x3cbdcd['countagentrejectretry'];this[_0xee63('0x10')]=_0x3cbdcd[_0xee63('0x10')];this[_0xee63('0x11')]=_0x3cbdcd[_0xee63('0x11')];this[_0xee63('0x12')]=_0x3cbdcd['countabandonedretry'];this[_0xee63('0x13')]=_0x3cbdcd[_0xee63('0x13')];this[_0xee63('0x14')]=_0x3cbdcd[_0xee63('0x14')];this[_0xee63('0xb')]=_0x3cbdcd[_0xee63('0xb')];this[_0xee63('0x15')]=_0x3cbdcd[_0xee63('0x16')];this[_0xee63('0x17')]=_0x3cbdcd[_0xee63('0x18')];this['starttime']=_0x3cbdcd[_0xee63('0x19')];this['responsetime']=_0x3cbdcd[_0xee63('0x1a')];this[_0xee63('0x1b')]=_0x3cbdcd[_0xee63('0x1a')];this[_0xee63('0x1c')]=getSeconds(_0x3cbdcd[_0xee63('0x1a')],_0x3cbdcd[_0xee63('0x19')]);this[_0xee63('0x1d')]=0x0;this['talktime']=0x0;this[_0xee63('0x1e')]=_0x3cbdcd[_0xee63('0x1e')];this[_0xee63('0x1f')]=_0x3cbdcd['callbackuniqueid'];this[_0xee63('0x20')]=_0x3cbdcd['callbackat'];this[_0xee63('0x21')]=_0x3cbdcd[_0xee63('0x21')];this[_0xee63('0x22')]=_0x3cbdcd[_0xee63('0x22')];this['ListId']=_0x3cbdcd[_0xee63('0x23')];this['UserId']=_0x3cbdcd[_0xee63('0x24')];this[_0xee63('0x25')]=_0x3cbdcd['VoiceQueueId'];this[_0xee63('0x26')]=_0x3cbdcd[_0xee63('0x26')];this[_0xee63('0x27')]=_0x3cbdcd['originatecalleridnum']||'';this[_0xee63('0x28')]=_0x3cbdcd['originatecalleridname']||'';}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 a4bc54a..a84fea9 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 _0x2947=['talking','total','unmanaged','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','info','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','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','debug','inspect','error','stack','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contactsRescheduled','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','endtime','starttime','prototype','loopClearZombieChannels','clearZombieChannels','undefined','Action','status','catch','updateOriginated','[Dialer][checkChannel]','queue','[Dialer][checkChannel][ivr]','countReScheduled','[countReScheduled]\x20','checkIsBlackList','resolve','[checkIsBlackList]\x20','verifyAdditionalPhones','[verifyAdditionalPhone]\x20','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','notFound','saveInDb','pick','ContactId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','isSuccess','Success','isTrunkReachable','SIP/%s','reachable','uniqueid','isNil','variable','amdstatus','xcally-motion-dialer','dialAMDActive','value','outboundAnswerAgiCallsDay','statedesc','HangupInAMD','membername','custom:amd','amd','MACHINE','Machine','AMD','countglobal','buildObj','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','dialGlobalMaxRetry','stateGlobal','countmachineretry','createStateFinal','add','[rescheduleContact][Machine]','HANGUP','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countcongestionretry','countagentrejectretry','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','AnswerAGI','AGI','[syncHangupIvr]','cause-txt','reason','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete]','answertime','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','dialDropRetryFrequency','additional','dialDropMaxRetry','queueCallerAbandonCreateState','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','callAdditionalPhoneAfterMin','voiceQueue','dialAbandonedRetryFrequency','ListId','[rescheduleContact][Abandoned]','syncNewExten','channel','actionid','locked','paused','stateinterface','strategy','rrmemory','push','idHopper','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','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','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','predictive','Queue','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','Agent','user:%s','user:dialPreviewRecallReminder','launchHandleIvr','handleIvr','dialActive','dialGlobalInterval','dialTimezone','[syncQueueSummary]','throttle','dialPreviewRecallmeReminder','filter','map','[syncCampaigns]','\x5cw{0,','pow','replace','match','actionOriginate','originate','voiceQueue\x20is\x20undefine','contact\x20is\x20undefine','getCaller','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','createdAt','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','dialCutDigit','phone','substring','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','dialNoSuchNumberRetryFrequency','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','Global','contact\x20not\x20moved','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','Dropped\x20calls\x20day','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','averageHandleTime','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','predictiveIntervalAvailable','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','getDataPredictive','dropRate','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','queueStatusComplete','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','voicePause','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','dialOrderByScheduledAt','[actionOriginate]\x20','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','[handlePredictive][limitChannel]','tryOriginatePredictive','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','interval\x20=\x20','Amax\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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','p\x20=\x20','util','lodash','uuid','moment','md5','ioredis','../../../config/logger','dialer','booked','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/setting','./action','./history','./hangup','env','XCALLY_IP_AGI','127.0.0.1','roundrobin','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startPredictive','startProgressive','queueBooked','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','syncVarSet','syncQueueMember','syncQueueStatusComplete','loopCampaigns','getSettings','then','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','Intervals','\x20INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','outbound','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime'];(function(_0xd5bb22,_0x5cfccb){var _0x2d105a=function(_0x54b74c){while(--_0x54b74c){_0xd5bb22['push'](_0xd5bb22['shift']());}};_0x2d105a(++_0x5cfccb);}(_0x2947,0x1db));var _0x7294=function(_0xac8c52,_0x21d503){_0xac8c52=_0xac8c52-0x0;var _0x224467=_0x2947[_0xac8c52];return _0x224467;};'use strict';var util=require(_0x7294('0x0'));var _=require(_0x7294('0x1'));var uuid=require(_0x7294('0x2'));var moment=require(_0x7294('0x3'));var rr=require('rr');var md5=require(_0x7294('0x4'));var Redis=require(_0x7294('0x5'));var ut=require('../preview/util/util');var config=require('../../../config/environment/');var logger=require(_0x7294('0x6'))(_0x7294('0x7'));var loggerBooked=require(_0x7294('0x6'))(_0x7294('0x8'));var loggerPredictive=require(_0x7294('0x6'))('predictive');var loggerPredictiveCalls=require('../../../config/logger')(_0x7294('0x9'));var loggerSyncQueueSummary=require(_0x7294('0x6'))(_0x7294('0xa'));var ami=require(_0x7294('0xb'));config[_0x7294('0xc')]=_[_0x7294('0xd')](config[_0x7294('0xc')],{'host':_0x7294('0xe'),'port':0x18eb});var io=require(_0x7294('0xf'))(new Redis(config['redis']));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0x7294('0x10'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x7294('0x11'));var voiceQueueRt=require(_0x7294('0x12'));var RpcSetting=require(_0x7294('0x13'));var Action=require(_0x7294('0x14'));var History=require(_0x7294('0x15'));var Final=require('./final');var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0x7294('0x16'));var ipAgi=process[_0x7294('0x17')][_0x7294('0x18')]||_0x7294('0x19');var strategy={'rrmemory':'rrmemory','roundrobin':_0x7294('0x1a')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0x7294('0x1b')]=function(_0x44e9c5){this[_0x7294('0x1c')]=this['tail']?this['tail'][_0x7294('0x1d')](_0x44e9c5):_0x44e9c5();};function Dialer(_0x4e29f4,_0x6f9120){this[_0x7294('0x1e')]=new Sequence();this[_0x7294('0x1f')]=_0x6f9120;this[_0x7294('0x20')]=_0x4e29f4[_0x7294('0x20')];this[_0x7294('0x21')]=_0x4e29f4[_0x7294('0x21')];this[_0x7294('0x22')]=_0x4e29f4[_0x7294('0x22')];this[_0x7294('0x23')]=_0x4e29f4[_0x7294('0x23')];this[_0x7294('0x24')]=config[_0x7294('0x24')]||0x2;this[_0x7294('0x25')]={};this[_0x7294('0x26')]={};this[_0x7294('0x27')]={};this[_0x7294('0x28')]={};this['optionPredictive']={};this[_0x7294('0x29')]={};this[_0x7294('0x2a')]={};this['ivrOriginated']={};this[_0x7294('0x2b')]={};this['queueBookedRR']={};ami['on'](_0x7294('0x2c'),this[_0x7294('0x2d')][_0x7294('0x2e')](this));ami['on'](_0x7294('0x2f'),this[_0x7294('0x30')][_0x7294('0x2e')](this));ami['on'](_0x7294('0x31'),this[_0x7294('0x32')][_0x7294('0x2e')](this));ami['on'](_0x7294('0x33'),this[_0x7294('0x34')][_0x7294('0x2e')](this));ami['on'](_0x7294('0x35'),this[_0x7294('0xa')][_0x7294('0x2e')](this));ami['on'](_0x7294('0x36'),this[_0x7294('0x37')][_0x7294('0x2e')](this));ami['on'](_0x7294('0x38'),this[_0x7294('0x39')][_0x7294('0x2e')](this));ami['on']('newexten',this['syncNewExten'][_0x7294('0x2e')](this));ami['on']('varset',this[_0x7294('0x3a')][_0x7294('0x2e')](this));ami['on']('queuemember',this[_0x7294('0x3b')][_0x7294('0x2e')](this));ami['on']('queuestatuscomplete',this[_0x7294('0x3c')][_0x7294('0x2e')](this));this[_0x7294('0x3d')]();this['loopClearZombieChannels']();RpcSetting[_0x7294('0x3e')]()[_0x7294('0x3f')](function(_0x5cd2ea){previewRecallmeReminderInterval=_0x5cd2ea['previewRecallmeReminderInterval'];});}function isNotNull(_0x25ace4){return _0x25ace4!==null&&!_[_0x7294('0x40')](_0x25ace4);}function checkIsLoggedIn(_0x58a1a6,_0x1dc47e){return function(){if(_0x1dc47e<=0x0){_0x58a1a6[_0x7294('0x41')]=_0x7294('0x42');throw _0x58a1a6[_0x7294('0x43')]+_0x7294('0x44');}};}function isActive(_0x214f87){return _0x214f87;}function checkIsActive(_0x483728,_0x4d4cd5){return function(){if(!isActive(_0x4d4cd5)){_0x483728[_0x7294('0x41')]=_0x7294('0x45');throw _0x483728[_0x7294('0x43')]+_0x7294('0x46');}};}function checkInterval(_0x413b9f){return function(){if(!isNotNull(_0x413b9f[_0x7294('0x47')])){_0x413b9f[_0x7294('0x41')]=_0x7294('0x48');throw _0x413b9f['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x413b9f[_0x7294('0x47')][_0x7294('0x49')])){_0x413b9f[_0x7294('0x41')]=_0x7294('0x48');throw _0x413b9f[_0x7294('0x43')]+_0x7294('0x4a');}if(!isNotNull(_[_0x7294('0x4b')](_0x413b9f[_0x7294('0x47')][_0x7294('0x49')]))){_0x413b9f[_0x7294('0x41')]=_0x7294('0x48');throw _0x413b9f[_0x7294('0x43')]+_0x7294('0x4a');}};}function msgResponse(_0x1d6f4b,_0x45f436,_0x50b8cf){return{'action':_0x1d6f4b,'response':_0x45f436,'message':_0x50b8cf,'stack':_0x50b8cf};}function myreject(_0x1275c5){return function(_0x2ec2b2){return _0x1275c5(msgResponse(_0x7294('0x4c'),_0x7294('0x4d'),JSON[_0x7294('0x4e')](_0x2ec2b2)));};}function getSeconds(_0x2cf124,_0x2fb866){var _0x38a8d1=moment(_0x2cf124)[_0x7294('0x4f')](0x0);var _0x581061=moment(_0x2fb866)['milliseconds'](0x0);return _0x38a8d1[_0x7294('0x50')](_0x581061,_0x7294('0x51'));}function emit(_0x4a88a1,_0x3dfbca,_0x3dc379){io['to'](_0x4a88a1)[_0x7294('0x52')](_0x3dfbca,_0x3dc379);}function emitVoiceQueueSummary(_0xab0eae){if(_0xab0eae[_0x7294('0x53')]===_0x7294('0x54')){var _0x36ff01={'id':_0xab0eae['id'],'name':_0xab0eae[_0x7294('0x43')],'strategy':_0xab0eae['strategy'],'answered':_0xab0eae[_0x7294('0x55')],'available':_0xab0eae[_0x7294('0x56')],'loggedIn':_0xab0eae[_0x7294('0x57')],'pTalking':_0xab0eae[_0x7294('0x58')],'sumBillable':_0xab0eae[_0x7294('0x59')],'sumDuration':_0xab0eae[_0x7294('0x5a')],'sumHoldTime':_0xab0eae[_0x7294('0x5b')]||0x0,'talking':_0xab0eae[_0x7294('0x5c')],'total':_0xab0eae[_0x7294('0x5d')],'type':_0xab0eae['type'],'unmanaged':_0xab0eae[_0x7294('0x5e')],'abandoned':_0xab0eae[_0x7294('0x5f')],'waiting':_0xab0eae[_0x7294('0x60')],'loggedInDb':_0xab0eae[_0x7294('0x61')],'dialActive':_0xab0eae['dialActive'],'dialMethod':_0xab0eae[_0x7294('0x62')],'dialOriginateCallerIdName':_0xab0eae[_0x7294('0x63')],'dialOriginateCallerIdNumber':_0xab0eae[_0x7294('0x64')],'dialOriginateTimeout':_0xab0eae[_0x7294('0x65')],'dialPrefix':_0xab0eae['dialPrefix'],'outboundAnswerAgiCallsDay':_0xab0eae['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0xab0eae[_0x7294('0x66')],'outboundBlacklistCallsDay':_0xab0eae[_0x7294('0x67')],'outboundBusyCallsDay':_0xab0eae[_0x7294('0x68')],'outboundCongestionCallsDay':_0xab0eae[_0x7294('0x69')],'outboundDropCallsDayACS':_0xab0eae[_0x7294('0x6a')],'outboundDropCallsDayCallersExit':_0xab0eae[_0x7294('0x6b')],'outboundDropCallsDayTimeout':_0xab0eae[_0x7294('0x6c')],'outboundNoAnswerCallsDay':_0xab0eae['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0xab0eae[_0x7294('0x6d')],'outboundOriginateFailureCallsDay':_0xab0eae['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0xab0eae[_0x7294('0x6e')],'outboundRejectCallsDay':_0xab0eae[_0x7294('0x6f')],'outboundUnknownCallsDay':_0xab0eae['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0xab0eae[_0x7294('0x70')],'predictiveIntervalAvgHoldtime':_0xab0eae[_0x7294('0x71')],'predictiveIntervalAvgTalktime':_0xab0eae[_0x7294('0x72')],'predictiveIntervalDroppedCallsCallersExit':_0xab0eae[_0x7294('0x73')],'predictiveIntervalDroppedCallsTimeout':_0xab0eae[_0x7294('0x74')],'predictiveIntervalErlangCalls':_0xab0eae[_0x7294('0x75')],'predictiveIntervalErlangCallsDroppedCalls':_0xab0eae[_0x7294('0x76')],'predictiveIntervalHitRate':_0xab0eae[_0x7294('0x77')],'predictiveIntervalMultiplicativeFactor':_0xab0eae[_0x7294('0x78')],'predictiveIntervalPauses':_0xab0eae[_0x7294('0x79')],'predictiveIntervalAvailable':_0xab0eae['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0xab0eae[_0x7294('0x7a')],'message':_0xab0eae['message'],'originated':_0xab0eae[_0x7294('0x7b')],'erlangCalls':_0xab0eae['erlangCalls'],'erlangCallToSecond':_0xab0eae[_0x7294('0x7c')],'erlangAbandonmentRate':_0xab0eae[_0x7294('0x7d')],'erlangBusyFactor':_0xab0eae['erlangBusyFactor'],'startPredictive':_0xab0eae[_0x7294('0x29')],'startProgressive':_0xab0eae[_0x7294('0x2a')]};if(_0xab0eae[_0x7294('0x7e')]){_0x36ff01['Trunk']={'id':_0xab0eae['Trunk']['id'],'name':_0xab0eae[_0x7294('0x7e')][_0x7294('0x43')],'active':_0xab0eae[_0x7294('0x7e')][_0x7294('0x7f')],'callerid':_0xab0eae[_0x7294('0x7e')][_0x7294('0x80')]};}if(_0xab0eae[_0x7294('0x47')]){_0x36ff01['Interval']={'id':_0xab0eae[_0x7294('0x47')]['id'],'name':_0xab0eae['Interval'][_0x7294('0x43')]};}var _0x4d8497=md5(JSON[_0x7294('0x4e')](_0x36ff01));if(_0xab0eae[_0x7294('0x4')]!==_0x4d8497){_0xab0eae[_0x7294('0x4')]=_0x4d8497;emit(util[_0x7294('0x81')](_0x7294('0x82'),_0x36ff01[_0x7294('0x43')]),_0x7294('0x83'),_0x36ff01);}}}function emitCampaignSummary(_0x5bb797){if(_0x5bb797[_0x7294('0x53')]===_0x7294('0x84')){emit(util[_0x7294('0x81')](_0x7294('0x85'),_0x5bb797['name']),_0x7294('0x86'),_0x5bb797);}}function checkGetDataPredictive(_0x58a91d){if(isNotNull(_0x58a91d)&&!_[_0x7294('0x4b')](_0x58a91d)){loggerPredictive[_0x7294('0x87')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive['info']('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x58a91d[_0x7294('0x7a')]);loggerPredictive['info'](_0x7294('0x88'),_0x58a91d['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x7294('0x87')](_0x7294('0x89'),_0x58a91d[_0x7294('0x74')]);loggerPredictive[_0x7294('0x87')](_0x7294('0x8a'),_0x58a91d['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x7294('0x87')](_0x7294('0x8b'),_0x58a91d[_0x7294('0x71')]);loggerPredictive[_0x7294('0x87')](_0x7294('0x8c'),_0x58a91d[_0x7294('0x72')]);loggerPredictive[_0x7294('0x87')](_0x7294('0x8d'));if(_0x58a91d[_0x7294('0x7a')]>0x0){if(!_[_0x7294('0x40')](_0x58a91d[_0x7294('0x72')])&&_0x58a91d[_0x7294('0x72')]>0x0){return!![];}loggerPredictive[_0x7294('0x87')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x7294('0x40')](_0x58a91d[_0x7294('0x71')])&&_0x58a91d[_0x7294('0x71')]>0x0){return!![];}loggerPredictive[_0x7294('0x87')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x7294('0x87')](_0x7294('0x8e'));}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x1451b3){return function(_0x35f5df){loggerPredictive[_0x7294('0x87')](_0x7294('0x8f'));loggerPredictive[_0x7294('0x87')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x35f5df[_0x7294('0x90')]);loggerPredictive[_0x7294('0x87')](_0x7294('0x91'),_0x35f5df[_0x7294('0x7c')]);loggerPredictive[_0x7294('0x87')](_0x7294('0x92'),_0x35f5df['erlangAbandonmentRate']);loggerPredictive[_0x7294('0x87')](_0x7294('0x93'),_0x35f5df[_0x7294('0x94')]);loggerPredictive['info'](_0x7294('0x92'),_0x35f5df[_0x7294('0x7d')]);loggerPredictive[_0x7294('0x87')]('---------------------------');_[_0x7294('0x95')](_0x1451b3,_0x35f5df);};}function getDiff(_0x514495){var _0x2b0b78=moment()[_0x7294('0x4f')](0x0);var _0x2ec50d=moment(_0x514495)[_0x7294('0x4f')](0x0);return _0x2b0b78[_0x7294('0x50')](_0x2ec50d,_0x7294('0x51'));}function ifInterval(_0xb9fe51,_0x4becd7){if(_[_0x7294('0x40')](_0x4becd7)){return![];}return getDiff(_0x4becd7)<_0xb9fe51*0x3c;}function freeVariablesPredictive(_0x1c0725){if(isNotNull(_0x1c0725)){if(!_['isUndefined'](_0x1c0725[_0x7294('0x2a')])){_0x1c0725[_0x7294('0x2a')]=undefined;loggerPredictive['info'](_0x1c0725['name'],_0x7294('0x96'));}if(!_[_0x7294('0x40')](_0x1c0725[_0x7294('0x29')])){_0x1c0725[_0x7294('0x29')]=undefined;loggerPredictive[_0x7294('0x87')](_0x1c0725[_0x7294('0x43')],_0x7294('0x97'));}if(!_['isUndefined'](_0x1c0725[_0x7294('0x98')])){clearInterval(_0x1c0725[_0x7294('0x98')]);_0x1c0725[_0x7294('0x98')]=undefined;loggerPredictive[_0x7294('0x87')](_0x1c0725[_0x7294('0x43')],_0x7294('0x99'));}}}function erlangb(_0x425198,_0x42ad35){if(_0x42ad35===0x0){return 0x0;}var _0x429b44=0x1;for(var _0x3e392b=0x1;_0x3e392b<=_0x42ad35;_0x3e392b+=0x1){_0x429b44=0x1+_0x429b44*_0x3e392b/_0x425198;}return 0x1/_0x429b44;}function isVoiceQueueOutbound(_0x367bc6){return _0x367bc6==='outbound';}function isNotPreview(_0x3cfca6){return _0x3cfca6!==_0x7294('0x1f');}function isCampaignIvr(_0x3fb593){return _0x3fb593===_0x7294('0x84');}function getCallerId(_0x43cf1c,_0x550c8d,_0x260d15){if(!_[_0x7294('0x40')](_0x260d15)&&typeof _0x260d15===_0x7294('0x9a')&&!_[_0x7294('0x4b')](_0x260d15)){if(!_['isUndefined'](_0x550c8d)&&typeof _0x550c8d==='string'&&!_[_0x7294('0x4b')](_0x550c8d)){return util[_0x7294('0x81')](_0x7294('0x9b'),_0x550c8d,_0x260d15);}return util['format'](_0x7294('0x9b'),_0x260d15,_0x260d15);}if(!_['isUndefined'](_0x43cf1c)&&typeof _0x43cf1c==='string'&&!_[_0x7294('0x4b')](_0x43cf1c)){return _0x43cf1c;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x50978a,_0x4a1034){return function(_0xc5e056){freeVariablesPredictive(_0x4a1034);emitVoiceQueueSummary(_0x4a1034);emitCampaignSummary(_0x4a1034);loggerSyncQueueSummary[_0x7294('0x9c')](_0x50978a,util[_0x7294('0x9d')](_0xc5e056,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x558f60,_0x3f26bc){return function(_0x38660e){loggerPredictive[_0x7294('0x9e')](_0x3f26bc[_0x7294('0x43')],_0x558f60);loggerPredictive[_0x7294('0x9e')](_0x38660e[_0x7294('0x9f')]);freeVariablesPredictive(_0x3f26bc);};}function loggerCatch(_0x1ab42c){return function(_0x98a83){logger[_0x7294('0x9e')](_0x1ab42c,util[_0x7294('0x9d')](_0x98a83,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x2d8307){return _0x2d8307&&!_[_0x7294('0x40')](_0x2d8307)&&_0x2d8307[_0x7294('0xa0')]>0x0;}function decremetOriginate(_0x427532){if(!_[_0x7294('0x40')](_0x427532)&&_0x427532!==null){if(typeof _0x427532[_0x7294('0x7b')]!=='undefined'){if(_0x427532['originated']>0x0){_0x427532['originated']-=0x1;}else{logger[_0x7294('0x9e')](_0x7294('0xa1'));}}}else{logger[_0x7294('0x9e')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x4f7d11,_0xb17d9b,_0x4e18c7){if(_0xb17d9b>_0x4e18c7){for(var _0x1046f6=0x0;_0x1046f6<_0xb17d9b-_0x4e18c7;_0x1046f6+=0x1){decremetOriginate(_0x4f7d11);}}}function loggerGetContactDialer(_0x61bc61,_0x3a4bed,_0x120b63){return function(_0x231870){checkContactLowerLimitOriginate(_0x3a4bed,_0x120b63,0x0);logger[_0x7294('0x9e')](_0x61bc61,util[_0x7294('0x9d')](_0x231870,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x31745d){return function(_0x175226){if(isNotNull(_0x175226)&&isNotNull(_0x175226[0x0])){if(_0x175226[0x0]['contactsRescheduled']>0x0){_0x31745d['message']=_0x7294('0xa2');logger[_0x7294('0x87')](_0x7294('0xa3')+_0x31745d[_0x7294('0x43')],_0x175226[0x0][_0x7294('0xa4')],'contacts');}else{_0x31745d[_0x7294('0x41')]=_0x7294('0xa5');logger['info'](_0x7294('0xa6')+_0x31745d['name']);}}};}function notSendMessagesQueue(_0x448888){if(_0x448888[_0x7294('0xa7')]){freeVariablesPredictive(_0x448888);if(_0x448888[_0x7294('0x7b')]===0x0&&_0x448888[_0x7294('0x5c')]===0x0&&_0x448888[_0x7294('0x60')]===0x0&&(_0x448888['pTalking']||0x0)===0x0){_0x448888[_0x7294('0xa7')]=![];_0x448888['available']=0x0;_0x448888[_0x7294('0x41')]=_0x7294('0x45');loggerSyncQueueSummary[_0x7294('0x9c')](_0x7294('0xa8'),_0x448888['name'],_0x7294('0xa9'));}else{_0x448888['message']=_0x7294('0xaa');loggerSyncQueueSummary[_0x7294('0x9c')](_0x7294('0xa8'),_0x448888[_0x7294('0x43')],_0x7294('0xab'));}emitVoiceQueueSummary(_0x448888);}}function notSendMessagesCampaign(_0x2b7c73){if(_0x2b7c73[_0x7294('0xa7')]){if(_0x2b7c73[_0x7294('0x7b')]===0x0){_0x2b7c73['sendMessageOneNotActive']=![];_0x2b7c73['message']=_0x7294('0x45');loggerSyncQueueSummary[_0x7294('0x9c')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x2b7c73['name'],'is\x20not\x20active');}else{_0x2b7c73[_0x7294('0x41')]=_0x7294('0xaa');loggerSyncQueueSummary['debug'](_0x7294('0xac'),_0x2b7c73[_0x7294('0x43')],_0x7294('0xab'));}emitCampaignSummary(_0x2b7c73);}}function createObjHistory(_0x402237,_0x2b5ee8,_0x2e1271,_0x523cd7,_0xc59cd3){_0x402237[_0x7294('0x41')]=_0x2e1271;var _0x9d83a5=new Action(_0x402237,_0x2b5ee8);var _0x5b814f=new History(_0x9d83a5);_0x5b814f[_0x7294('0xad')]=_0x523cd7;_0x5b814f['statedesc']=_0xc59cd3;_0x5b814f[_0x7294('0xae')]=_0x9d83a5[_0x7294('0xaf')];return _0x5b814f;}Dialer[_0x7294('0xb0')][_0x7294('0xb1')]=function(){var _0x436625=this;setInterval(function(){_0x436625[_0x7294('0xb2')](_0x436625[_0x7294('0x28')],'[uniqueid]');_0x436625[_0x7294('0xb2')](_0x436625[_0x7294('0x26')],'[actions]');},0x32c8);};Dialer[_0x7294('0xb0')]['clearZombieChannels']=function(_0x3d9fd4,_0x3e273c){var _0x3e293=this;for(var _0x50d063 in _0x3d9fd4){if(typeof _0x3d9fd4[_0x50d063]!==_0x7294('0xb3')){this[_0x7294('0x1e')]['enqueue'](function(){if(!_['isNil'](_0x3d9fd4[_0x50d063])){return ami[_0x7294('0xb4')]({'action':_0x7294('0xb5'),'channel':_0x3d9fd4[_0x50d063]['channel']})[_0x7294('0xb6')](function(_0x2f078b){if(_0x2f078b[_0x7294('0x41')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x3d9fd4[_0x50d063]&&_0x3d9fd4[_0x50d063][_0x7294('0x53')]!==_0x7294('0x84')){_0x3e293[_0x7294('0xb7')](_0x3e293[_0x7294('0x20')][_0x3d9fd4[_0x50d063]['queue']]);logger[_0x7294('0x9e')](_0x7294('0xb8'),_0x3e273c,_0x50d063,_0x3d9fd4[_0x50d063][_0x7294('0xb9')]);delete _0x3d9fd4[_0x50d063];}if(_0x3d9fd4[_0x50d063]&&_0x3d9fd4[_0x50d063][_0x7294('0x53')]==='ivr'){_0x3e293[_0x7294('0xb7')](_0x3e293[_0x7294('0x21')][_0x3d9fd4[_0x50d063][_0x7294('0xb9')]]);logger['error'](_0x7294('0xba'),_0x3e273c,_0x50d063,_0x3d9fd4[_0x50d063]['queue']);delete _0x3d9fd4[_0x50d063];}},0x2328);}});}});}}};Dialer['prototype'][_0x7294('0xbb')]=function(_0x1d2cba){return Promise['resolve']()[_0x7294('0x3f')](cmHopper[_0x7294('0xbb')](_0x1d2cba))[_0x7294('0xb6')](loggerCatch(_0x7294('0xbc')));};Dialer[_0x7294('0xb0')][_0x7294('0xbd')]=function(_0x28958c){return Promise[_0x7294('0xbe')]()[_0x7294('0x3f')](cmHopperBlack[_0x7294('0xbd')](_0x28958c))[_0x7294('0xb6')](loggerCatch(_0x7294('0xbf')));};Dialer[_0x7294('0xb0')]['verifyAdditionalPhones']=function(_0x5ca67c,_0x2c74a9,_0x100b53){return Promise[_0x7294('0xbe')]()[_0x7294('0x3f')](cmHopperAdditionalPhone[_0x7294('0xc0')](_0x5ca67c,_0x2c74a9,_0x100b53))['catch'](loggerCatch(_0x7294('0xc1')));};Dialer[_0x7294('0xb0')][_0x7294('0xc2')]=function(_0xd2aa5b,_0x824dc9,_0x12dedc){return Promise[_0x7294('0xbe')]()[_0x7294('0x3f')](cmHopperAdditionalPhone[_0x7294('0xc2')](_0xd2aa5b,_0x824dc9,_0x12dedc))[_0x7294('0xb6')](loggerCatch(_0x7294('0xc3')));};Dialer[_0x7294('0xb0')][_0x7294('0xc4')]=function(_0x31ad86){return Promise['resolve']()[_0x7294('0x3f')](cmHopperBlack[_0x7294('0xc4')](_0x31ad86))[_0x7294('0xb6')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0x7294('0xb0')]['averageHandleTime']=function(_0x5ca055){return Promise['resolve']()[_0x7294('0x3f')](cmHopperHistory[_0x7294('0xc5')](_0x5ca055))['catch'](loggerCatch(_0x7294('0xc6')));};Dialer[_0x7294('0xb0')][_0x7294('0xc7')]=function(_0x229f32){return Promise[_0x7294('0xbe')]()[_0x7294('0x3f')](cmHopper[_0x7294('0xc7')](_0x229f32))[_0x7294('0xb6')](loggerCatch(_0x7294('0xc8')));};Dialer['prototype'][_0x7294('0xc9')]=function(_0x40890d,_0x131ee0,_0x9927ef){return Promise[_0x7294('0xbe')]()['then'](cmHopper['unlockContact'](_0x40890d,_0x131ee0,_0x9927ef))[_0x7294('0xb6')](loggerCatch('[unlockContact]\x20'));};Dialer[_0x7294('0xb0')][_0x7294('0xca')]=function(_0x5bfbc5,_0xe481c8,_0xfa7d7e,_0x49fa09,_0x307307){return Promise[_0x7294('0xbe')]()[_0x7294('0x3f')](cmHopper[_0x7294('0xca')](_0x5bfbc5,_0xe481c8,_0xfa7d7e,_0x49fa09))['catch'](function(_0x5a64ec){_0x307307[_0x7294('0xcb')]-=_0xfa7d7e;_0x307307[_0x7294('0xcb')]=_0x307307[_0x7294('0xcb')]>0x0?_0x307307[_0x7294('0xcb')]:0x0;loggerCatch(_0x7294('0xcc'))(_0x5a64ec);});};Dialer[_0x7294('0xb0')][_0x7294('0xcd')]=function(_0x2f2793,_0x3eba71,_0x440c9c,_0x42e8a6){return Promise[_0x7294('0xbe')]()[_0x7294('0x3f')](cmHopper['getContactDialerIvr'](_0x2f2793,_0x3eba71,_0x440c9c))[_0x7294('0xb6')](function(_0x45812a){_0x42e8a6[_0x7294('0xcb')]-=_0x3eba71;_0x42e8a6[_0x7294('0xcb')]=_0x42e8a6[_0x7294('0xcb')]>0x0?_0x42e8a6[_0x7294('0xcb')]:0x0;loggerCatch(_0x7294('0xce'))(_0x45812a);});};Dialer[_0x7294('0xb0')][_0x7294('0xcf')]=function(_0x36a60e){return Promise[_0x7294('0xbe')]()[_0x7294('0x3f')](voiceQueueRt['getVoiceQueueRtPauses'](_0x36a60e))[_0x7294('0xb6')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x7294('0xb0')][_0x7294('0xd0')]=function(_0x506ead){return Promise[_0x7294('0xbe')]()[_0x7294('0x3f')](cmHopper[_0x7294('0xd0')](_0x506ead))[_0x7294('0xb6')](loggerCatch(_0x7294('0xd1')));};Dialer[_0x7294('0xb0')][_0x7294('0xd2')]=function(_0x21bca8){return Promise[_0x7294('0xbe')]()[_0x7294('0x3f')](cmHopperHistory[_0x7294('0xd2')](_0x21bca8))[_0x7294('0xb6')](loggerCatch(_0x7294('0xd3')));};Dialer['prototype']['updateOriginated']=function(_0x210006){if(!_[_0x7294('0x40')](_0x210006)&&_0x210006!==null){if(typeof _0x210006[_0x7294('0x7b')]!=='undefined'){if(_0x210006[_0x7294('0x7b')]>0x0){_0x210006[_0x7294('0x7b')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger['error'](_0x7294('0xd4'));}};Dialer[_0x7294('0xb0')]['loggerHandler']=function(_0x55a226,_0x2165ed){var _0x31ae2f=this;return function(_0x3d0735){_0x31ae2f[_0x7294('0xb7')](_0x2165ed);logger[_0x7294('0x9e')](_0x55a226,util[_0x7294('0x9d')](_0x3d0735,{'showHidden':![],'depth':null}));};};Dialer[_0x7294('0xb0')][_0x7294('0xd5')]=function(_0x47c1fc,_0x297882,_0x3b4889){var _0x101845={'state':0x19,'statedesc':_0x7294('0xd6')};this[_0x7294('0xb7')](_0x297882);this[_0x7294('0xd7')](_[_0x7294('0x95')](_0x101845,_[_0x7294('0xd8')](_0x3b4889,[_0x7294('0xd9'),'ListId','UserId',_0x7294('0xda'),_0x7294('0xdb')])),_0x7294('0xdc'),'[emptyContact]');logger['error'](_0x47c1fc);};Dialer['prototype'][_0x7294('0xdd')]=function(_0x371ece){return _0x371ece===_0x7294('0xde');};Dialer['prototype'][_0x7294('0xdf')]=function(_0xf34278){return!_[_0x7294('0x40')](_0xf34278)&&_0xf34278&&!_['isUndefined'](_0xf34278[_0x7294('0x43')])&&!_[_0x7294('0x40')](_0xf34278['active'])&&_0xf34278[_0x7294('0x7f')]&&(this[_0x7294('0x23')][util[_0x7294('0x81')](_0x7294('0xe0'),_0xf34278[_0x7294('0x43')])][_0x7294('0xb5')]===_0x7294('0xe1')||this[_0x7294('0x23')][util[_0x7294('0x81')](_0x7294('0xe0'),_0xf34278[_0x7294('0x43')])][_0x7294('0xb5')]==='unmonitored');};Dialer[_0x7294('0xb0')][_0x7294('0xd7')]=function(_0x5783c1,_0x18280b,_0x197146){this['createHistory'](_0x5783c1)[_0x7294('0xb6')](loggerCatch(_0x18280b));this[_0x7294('0xd0')](_0x5783c1)[_0x7294('0xb6')](loggerCatch(_0x197146));};Dialer[_0x7294('0xb0')][_0x7294('0x3a')]=function(_0x4f3338){var _0x1146f2=this;var _0x49503e=this['uniqueId'][_0x4f3338[_0x7294('0xe2')]];var _0x1e244e;if(!_[_0x7294('0xe3')](_0x4f3338)&&!_['isNil'](_0x4f3338[_0x7294('0xe4')])&&!_[_0x7294('0xe3')](_0x4f3338[_0x7294('0xe4')][_0x7294('0xe5')])&&_0x4f3338['exten']===_0x7294('0xe6')&&_0x49503e){if(_0x49503e['type']!=='ivr'&&this[_0x7294('0x20')][_0x49503e[_0x7294('0xb9')]][_0x7294('0xe7')]&&_0x4f3338[_0x7294('0xe8')]==='HANGUP'){delete this['uniqueId'][_0x4f3338['uniqueid']];this[_0x7294('0xb7')](this[_0x7294('0x20')][_0x49503e[_0x7294('0xb9')]]);this[_0x7294('0x20')][_0x49503e[_0x7294('0xb9')]][_0x7294('0x66')]+=0x1;this[_0x7294('0x20')][_0x49503e[_0x7294('0xb9')]][_0x7294('0xe9')]+=0x1;_0x1e244e=new Hangup(_0x49503e,_0x4f3338);_0x1e244e[_0x7294('0xad')]=0x12;_0x1e244e[_0x7294('0xea')]=_0x7294('0xeb');_0x1e244e[_0x7294('0xec')]='AMD';ami['emit'](_0x7294('0xed'),ut['buildObj'](_0x1e244e,_0x7294('0xee')));this[_0x7294('0xd7')](_0x1e244e,'[syncHangupInAMD][createHistory]','[syncHangupInAMD]');}if(_0x49503e[_0x7294('0x53')]!==_0x7294('0x84')&&this[_0x7294('0x20')][_0x49503e['queue']]['dialAMDActive']&&_0x4f3338[_0x7294('0xe8')]===_0x7294('0xef')){return new Promise(function(_0xa807d5,_0x125e75){delete _0x1146f2['uniqueId'][_0x4f3338[_0x7294('0xe2')]];_0x1146f2[_0x7294('0xb7')](_0x1146f2['voiceQueues'][_0x49503e[_0x7294('0xb9')]]);_0x1146f2['voiceQueues'][_0x49503e[_0x7294('0xb9')]][_0x7294('0x66')]+=0x1;_0x1146f2[_0x7294('0x20')][_0x49503e[_0x7294('0xb9')]][_0x7294('0xe9')]+=0x1;var _0x32f395=_0x1146f2[_0x7294('0x20')][_0x49503e[_0x7294('0xb9')]];var _0x4a9fe6=new Hangup(_0x49503e,_0x4f3338);_0x4a9fe6['state']=0x13;_0x4a9fe6[_0x7294('0xea')]=_0x7294('0xf0');_0x4a9fe6['membername']=_0x7294('0xf1');_0x4a9fe6['countmachineretry']+=0x1;_0x4a9fe6[_0x7294('0xf2')]+=0x1;_0x4a9fe6[_0x7294('0xee')]=!![];ami[_0x7294('0x52')]('custom:amd',ut[_0x7294('0xf3')](_0x4a9fe6,_0x7294('0xee')));_0x1146f2['createHistory'](_0x4a9fe6)['catch'](loggerCatch(_0x7294('0xf4')));if(_0x4a9fe6[_0x7294('0xf5')]+_0x4a9fe6['countcongestionretry']+_0x4a9fe6[_0x7294('0xf6')]+_0x4a9fe6[_0x7294('0xf7')]+_0x4a9fe6[_0x7294('0xf8')]+_0x4a9fe6[_0x7294('0xf9')]+_0x4a9fe6['countmachineretry']+_0x4a9fe6['countagentrejectretry']>=_0x32f395[_0x7294('0xfa')]){_0x1146f2[_0x7294('0xfb')](_0x4a9fe6,_0xa807d5,_0x125e75,'reason19\x20machine....');}else{if(_0x4a9fe6[_0x7294('0xfc')]>=_0x32f395['dialMachineMaxRetry']){_0x1146f2[_0x7294('0xfd')](_0x4a9fe6,_0xa807d5,_0x125e75,'reason\x2019\x20machine....');}else{_0x1146f2['rescheduleContact']({'active':![],'countmachineretry':_0x4a9fe6[_0x7294('0xfc')],'scheduledat':moment()[_0x7294('0xfe')](_0x32f395['dialMachineRetryFrequency'],'minutes')[_0x7294('0x81')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4a9fe6[_0x7294('0xd9')],'ListId':_0x4a9fe6['ListId'],'VoiceQueueId':_0x4a9fe6['VoiceQueueId']||undefined,'CampaignId':_0x4a9fe6[_0x7294('0xdb')]||undefined})[_0x7294('0xb6')](loggerCatch(_0x7294('0xff')));_0xa807d5({'reschedule':0x1});}}});}if(_0x49503e[_0x7294('0x53')]==='ivr'&&this[_0x7294('0x21')][_0x49503e[_0x7294('0xb9')]][_0x7294('0xe7')]&&_0x4f3338[_0x7294('0xe8')]===_0x7294('0x100')){delete this[_0x7294('0x28')][_0x4f3338[_0x7294('0xe2')]];this[_0x7294('0xb7')](this[_0x7294('0x21')][_0x49503e[_0x7294('0xb9')]]);_0x1e244e=new Hangup(_0x49503e,_0x4f3338);_0x1e244e[_0x7294('0xad')]=0x12;_0x1e244e[_0x7294('0xea')]=_0x7294('0xeb');_0x1e244e[_0x7294('0xec')]='AMD';ami[_0x7294('0x52')](_0x7294('0xed'),ut[_0x7294('0xf3')](_0x1e244e,'amd'));this[_0x7294('0xd7')](_0x1e244e,_0x7294('0x101'),_0x7294('0x102'));}if(_0x49503e[_0x7294('0x53')]===_0x7294('0x84')&&this[_0x7294('0x21')][_0x49503e[_0x7294('0xb9')]][_0x7294('0xe7')]&&_0x4f3338[_0x7294('0xe8')]===_0x7294('0xef')){return new Promise(function(_0x425eda,_0x5ae80a){delete _0x1146f2[_0x7294('0x28')][_0x4f3338[_0x7294('0xe2')]];_0x1146f2[_0x7294('0xb7')](_0x1146f2[_0x7294('0x21')][_0x49503e[_0x7294('0xb9')]]);_0x1146f2['campaigns'][_0x49503e[_0x7294('0xb9')]][_0x7294('0x66')]+=0x1;_0x1146f2[_0x7294('0x21')][_0x49503e[_0x7294('0xb9')]][_0x7294('0xe9')]+=0x1;var _0x4d7699=_0x1146f2['campaigns'][_0x49503e['queue']];var _0x1803f6=new Hangup(_0x49503e,_0x4f3338);_0x1803f6[_0x7294('0xad')]=0x13;_0x1803f6[_0x7294('0xea')]=_0x7294('0xf0');_0x1803f6['membername']='AMD';_0x1803f6[_0x7294('0xfc')]+=0x1;_0x1803f6[_0x7294('0xf2')]+=0x1;_0x1803f6['amd']=!![];ami[_0x7294('0x52')](_0x7294('0xed'),ut[_0x7294('0xf3')](_0x1803f6,_0x7294('0xee')));_0x1146f2['createHistory'](_0x1803f6)[_0x7294('0xb6')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x1803f6[_0x7294('0xf5')]+_0x1803f6[_0x7294('0x103')]+_0x1803f6['countnoanswerretry']+_0x1803f6[_0x7294('0xf7')]+_0x1803f6[_0x7294('0xf8')]+_0x1803f6['countabandonedretry']+_0x1803f6[_0x7294('0xfc')]+_0x1803f6[_0x7294('0x104')]>=_0x4d7699[_0x7294('0xfa')]){_0x1146f2[_0x7294('0xfb')](_0x1803f6,_0x425eda,_0x5ae80a,_0x7294('0x105'));}else{if(_0x1803f6['countmachineretry']>=_0x4d7699[_0x7294('0x106')]){_0x1146f2['createStateFinal'](_0x1803f6,_0x425eda,_0x5ae80a,_0x7294('0x107'));}else{_0x1146f2[_0x7294('0xc7')]({'active':![],'countmachineretry':_0x1803f6[_0x7294('0xfc')],'scheduledat':moment()[_0x7294('0xfe')](_0x4d7699[_0x7294('0x108')],_0x7294('0x109'))['format'](_0x7294('0x10a')),'ContactId':_0x1803f6['ContactId'],'ListId':_0x1803f6['ListId'],'VoiceQueueId':_0x1803f6[_0x7294('0xda')]||undefined,'CampaignId':_0x1803f6[_0x7294('0xdb')]||undefined})[_0x7294('0xb6')](loggerCatch(_0x7294('0xff')));_0x425eda({'reschedule':0x1});}}});}}};Dialer[_0x7294('0xb0')][_0x7294('0x39')]=function(_0x25dab2){var _0x38ccea=this[_0x7294('0x28')][_0x25dab2[_0x7294('0xe2')]];var _0x43ba37;if(_0x38ccea&&_0x38ccea['type']===_0x7294('0x84')){delete this[_0x7294('0x28')][_0x25dab2[_0x7294('0xe2')]];this['updateOriginated'](this[_0x7294('0x21')][_0x38ccea[_0x7294('0xb9')]]);this[_0x7294('0x21')][_0x38ccea[_0x7294('0xb9')]][_0x7294('0x10b')]+=0x1;_0x43ba37=new Hangup(_0x38ccea,_0x25dab2);this[_0x7294('0xd2')](_0x43ba37)['catch'](loggerCatch(_0x7294('0x10c')));this[_0x7294('0xd0')](_0x43ba37)[_0x7294('0xb6')](loggerCatch('[syncHangupIvr]'));}if(_0x38ccea&&_0x38ccea[_0x7294('0x53')]!=='ivr'&&isNotNull(this[_0x7294('0x20')][_0x38ccea[_0x7294('0xb9')]]['dialQueueProject'])){delete this['uniqueId'][_0x25dab2[_0x7294('0xe2')]];this[_0x7294('0xb7')](this[_0x7294('0x20')][_0x38ccea[_0x7294('0xb9')]]);this[_0x7294('0x20')][_0x38ccea[_0x7294('0xb9')]][_0x7294('0x66')]+=0x1;this[_0x7294('0x20')][_0x38ccea['queue']][_0x7294('0xe9')]+=0x1;_0x43ba37=new Hangup(_0x38ccea,_0x25dab2);_0x43ba37[_0x7294('0xad')]=0x10;_0x43ba37[_0x7294('0xea')]=_0x7294('0x10d');_0x43ba37[_0x7294('0xec')]=_0x7294('0x10e');this[_0x7294('0xd2')](_0x43ba37)[_0x7294('0xb6')](loggerCatch(_0x7294('0x10c')));this['moveContactManagedDialer'](_0x43ba37)[_0x7294('0xb6')](loggerCatch(_0x7294('0x10f')));}if(_0x38ccea&&_0x38ccea[_0x7294('0x53')]!==_0x7294('0x84')&&!isNotNull(this[_0x7294('0x20')][_0x38ccea[_0x7294('0xb9')]]['dialQueueProject'])){delete this['uniqueId'][_0x25dab2[_0x7294('0xe2')]];this[_0x7294('0xb7')](this[_0x7294('0x20')][_0x38ccea['queue']]);this[_0x7294('0x20')][_0x38ccea['queue']]['outboundUnknownCallsDay']+=0x1;_0x43ba37=new Hangup(_0x38ccea,_0x25dab2);_0x43ba37[_0x7294('0xad')]=0xc;_0x43ba37[_0x7294('0xea')]=_0x25dab2[_0x7294('0x110')];_0x43ba37[_0x7294('0xec')]='Unknow';this[_0x7294('0xd2')](_0x43ba37)[_0x7294('0xb6')](loggerCatch(_0x7294('0x10c')));this[_0x7294('0xd0')](_0x43ba37)['catch'](loggerCatch(_0x7294('0x10f')));}};Dialer['prototype'][_0x7294('0x34')]=function(_0x249b73){var _0x3314cb=this[_0x7294('0x28')][_0x249b73[_0x7294('0xe2')]];if(this[_0x7294('0x20')][_0x249b73['queue']]){if(_0x3314cb&&_0x3314cb['type']!=='ivr'){delete this[_0x7294('0x28')][_0x249b73[_0x7294('0xe2')]];this[_0x7294('0x20')][_0x249b73['queue']][_0x7294('0x66')]+=0x1;var _0xbf6cf8=new AgentComplete(_0x3314cb,_0x249b73);if(_0x249b73[_0x7294('0x111')]==='agent'){_0xbf6cf8[_0x7294('0x112')]=this[_0x7294('0x20')][_0x249b73[_0x7294('0xb9')]][_0x7294('0x113')]&&this[_0x7294('0x20')][_0x249b73[_0x7294('0xb9')]][_0x7294('0x114')]?moment()[_0x7294('0x81')](_0x7294('0x10a')):undefined;}this[_0x7294('0xd2')](_0xbf6cf8)[_0x7294('0xb6')](loggerCatch('[syncAgentComplete][createHistory]'));this['moveContactManagedDialer'](_0xbf6cf8)[_0x7294('0xb6')](loggerCatch(_0x7294('0x115')));}}};Dialer[_0x7294('0xb0')][_0x7294('0x2d')]=function(_0x46e4c6){if(this['voiceQueues'][_0x46e4c6[_0x7294('0xb9')]]){if(this[_0x7294('0x28')][_0x46e4c6['uniqueid']]&&this[_0x7294('0x28')][_0x46e4c6[_0x7294('0xe2')]][_0x7294('0x53')]!=='ivr'){this[_0x7294('0xb7')](this[_0x7294('0x20')][_0x46e4c6['queue']]);this[_0x7294('0x28')][_0x46e4c6['uniqueid']][_0x7294('0x116')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x7294('0xb0')]['queueCallerAbandonCreateState']=function(_0x4fc6ca,_0x1ebee2){this['createHistory'](_0x4fc6ca)[_0x7294('0xb6')](loggerCatch(_0x7294('0x117')));if(_0x1ebee2==0x0){this[_0x7294('0xd0')](_0x4fc6ca)[_0x7294('0xb6')](loggerCatch(_0x7294('0x118')));}};Dialer['prototype'][_0x7294('0x30')]=function(_0x4ca0c2){var _0x103e10=this[_0x7294('0x28')][_0x4ca0c2[_0x7294('0xe2')]];var _0x2452cb=this;var _0x5b5321=![];var _0xdbf09d;var _0x13f6ae;if(this[_0x7294('0x20')][_0x4ca0c2[_0x7294('0xb9')]]){if(_0x103e10&&_0x103e10[_0x7294('0x53')]!==_0x7294('0x84')){delete this['uniqueId'][_0x4ca0c2[_0x7294('0xe2')]];this[_0x7294('0xb7')](this[_0x7294('0x20')][_0x4ca0c2[_0x7294('0xb9')]]);_0x103e10[_0x7294('0x119')]=moment()[_0x7294('0x81')](_0x7294('0x10a'));var _0x4b9fd0=new QueueCallerAbandon(_0x103e10,_0x4ca0c2);if(getSeconds(_0x103e10[_0x7294('0x119')],_0x103e10[_0x7294('0x11a')])>=_0x103e10[_0x7294('0x11b')]){this[_0x7294('0x20')][_0x4ca0c2[_0x7294('0xb9')]][_0x7294('0x74')]+=0x1;this[_0x7294('0x20')][_0x4ca0c2[_0x7294('0xb9')]][_0x7294('0x6c')]+=0x1;this[_0x7294('0x20')][_0x4ca0c2[_0x7294('0xb9')]][_0x7294('0x76')]+=0x1;_0x4b9fd0[_0x7294('0xad')]=0xa;_0x4b9fd0[_0x7294('0xea')]=_0x7294('0x11c');_0x4b9fd0[_0x7294('0x11d')]=_0x7294('0x11e');_0x4b9fd0[_0x7294('0x112')]=this[_0x7294('0x20')][_0x4ca0c2['queue']][_0x7294('0x113')]?moment()[_0x7294('0x81')](_0x7294('0x10a')):undefined;_0x4b9fd0[_0x7294('0xf8')]+=0x1;_0x4b9fd0[_0x7294('0xf2')]+=0x1;_0xdbf09d=this['voiceQueues'][_0x4ca0c2[_0x7294('0xb9')]][_0x7294('0x11f')];_0x13f6ae=this[_0x7294('0x20')][_0x4ca0c2['queue']]['callAdditionalPhoneAfterMin'];_0x2452cb[_0x7294('0xc0')](_0x4b9fd0,_0x4b9fd0[_0x7294('0xad')],_0x103e10['voiceQueue'])[_0x7294('0x3f')](function(_0x44a034){_0x5b5321=_0x44a034[_0x7294('0x120')]==0x1;if(_0x4b9fd0[_0x7294('0xf8')]>=_0x2452cb['voiceQueues'][_0x4ca0c2['queue']][_0x7294('0x121')]){_0x2452cb[_0x7294('0x122')](_0x4b9fd0,_0x44a034['additional']);}else{_0x2452cb['rescheduleContact']({'active':![],'countdropretry':_0x4b9fd0[_0x7294('0xf8')],'scheduledat':moment()[_0x7294('0xfe')](_0x2452cb[_0x7294('0x20')][_0x4ca0c2[_0x7294('0xb9')]][_0x7294('0x11f')],_0x7294('0x109'))['format'](_0x7294('0x10a')),'ContactId':_0x103e10[_0x7294('0xd9')],'ListId':_0x103e10['ListId'],'VoiceQueueId':_0x103e10[_0x7294('0xda')]||undefined,'CampaignId':_0x103e10[_0x7294('0xdb')]||undefined})['catch'](loggerCatch(_0x7294('0x123')));var _0x4c03f4=new History(_0x4b9fd0);_0x4c03f4[_0x7294('0xad')]=0xa;_0x4c03f4[_0x7294('0xea')]=_0x7294('0x11c');_0x4c03f4[_0x7294('0xaf')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4c03f4[_0x7294('0xae')]=_0x4c03f4[_0x7294('0xaf')];_0x4c03f4[_0x7294('0x124')]=_0x4b9fd0[_0x7294('0x124')];_0x4c03f4['calleridnum']=_0x4b9fd0[_0x7294('0x125')];_0x2452cb[_0x7294('0xd2')](_0x4c03f4)[_0x7294('0xb6')](loggerCatch(_0x7294('0x126')));}})['then'](function(){if(_0x5b5321)_0x2452cb['swapAdditionalPhones'](_0x4b9fd0,_0xdbf09d,_0x13f6ae)[_0x7294('0x3f')](function(){return 0x1;});});}else{this[_0x7294('0x20')][_0x4ca0c2[_0x7294('0xb9')]][_0x7294('0x73')]+=0x1;this[_0x7294('0x20')][_0x4ca0c2['queue']][_0x7294('0x6b')]+=0x1;_0x4b9fd0[_0x7294('0xad')]=0xb;_0x4b9fd0[_0x7294('0xea')]=_0x7294('0x127');_0x4b9fd0[_0x7294('0x11d')]='CALLEREXIT';_0x4b9fd0[_0x7294('0xf9')]+=0x1;_0x4b9fd0[_0x7294('0xf2')]+=0x1;_0xdbf09d=this['voiceQueues'][_0x4ca0c2[_0x7294('0xb9')]]['dialAbandonedRetryFrequency'];_0x13f6ae=this[_0x7294('0x20')][_0x4ca0c2['queue']][_0x7294('0x128')];_0x2452cb[_0x7294('0xc0')](_0x4b9fd0,_0x4b9fd0[_0x7294('0xad')],_0x103e10[_0x7294('0x129')])['then'](function(_0x189f74){if(_0x4b9fd0[_0x7294('0xf9')]>=_0x2452cb[_0x7294('0x20')][_0x4ca0c2[_0x7294('0xb9')]]['dialAbandonedMaxRetry']){_0x2452cb[_0x7294('0x122')](_0x4b9fd0,_0x189f74['additional']);}else{_0x2452cb['rescheduleContact']({'active':![],'countabandonedretry':_0x4b9fd0['countabandonedretry'],'scheduledat':moment()['add'](_0x2452cb[_0x7294('0x20')][_0x4ca0c2[_0x7294('0xb9')]][_0x7294('0x12a')],_0x7294('0x109'))[_0x7294('0x81')](_0x7294('0x10a')),'ContactId':_0x103e10[_0x7294('0xd9')],'ListId':_0x103e10[_0x7294('0x12b')],'VoiceQueueId':_0x103e10[_0x7294('0xda')]||undefined,'CampaignId':_0x103e10[_0x7294('0xdb')]||undefined})[_0x7294('0xb6')](loggerCatch(_0x7294('0x12c')));var _0x381cac=new History(_0x4b9fd0);_0x381cac[_0x7294('0xad')]=0xb;_0x381cac[_0x7294('0xea')]=_0x7294('0x127');_0x381cac['starttime']=moment()[_0x7294('0x81')](_0x7294('0x10a'));_0x381cac['endtime']=_0x381cac[_0x7294('0xaf')];_0x381cac[_0x7294('0x124')]=_0x4b9fd0['calleridname'];_0x381cac[_0x7294('0x125')]=_0x4b9fd0['calleridnum'];_0x2452cb['createHistory'](_0x381cac)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0x7294('0x3f')](function(){if(_0x5b5321)_0x2452cb[_0x7294('0xc2')](_0x4b9fd0,_0xdbf09d,_0x13f6ae)[_0x7294('0x3f')](function(){return 0x1;});});}}}};Dialer['prototype'][_0x7294('0x12d')]=function(_0x55da15){if(this['actions'][_0x55da15[_0x7294('0xe2')]]){this[_0x7294('0x26')][_0x55da15[_0x7294('0xe2')]][_0x7294('0x12e')]=_0x55da15[_0x7294('0x12e')];}if(this['uniqueId'][_0x55da15[_0x7294('0xe2')]]){this[_0x7294('0x28')][_0x55da15[_0x7294('0xe2')]][_0x7294('0x12e')]=_0x55da15[_0x7294('0x12e')];}};Dialer[_0x7294('0xb0')][_0x7294('0x3b')]=function(_0x438f99){if(strategy[this['voiceQueues'][this[_0x7294('0x26')][_0x438f99[_0x7294('0x12f')]][_0x7294('0xb9')]]['strategy']]==='roundrobin'){if(this[_0x7294('0x26')][_0x438f99['actionid']]&&_[_0x7294('0xe3')](this[_0x7294('0x26')][_0x438f99['actionid']][_0x7294('0x130')])&&_0x438f99[_0x7294('0xb5')]==='1'&&_0x438f99[_0x7294('0x131')]==='0'){if(this[_0x7294('0x22')][_0x438f99[_0x7294('0x132')]]){if(!this[_0x7294('0x22')][_0x438f99[_0x7294('0x132')]][_0x7294('0x130')]){this[_0x7294('0x22')][_0x438f99[_0x7294('0x132')]][_0x7294('0x130')]=!![];this[_0x7294('0x26')][_0x438f99[_0x7294('0x12f')]][_0x7294('0x130')]=!![];this['actions'][_0x438f99[_0x7294('0x12f')]][_0x7294('0x132')]=_0x438f99[_0x7294('0x132')];}}}}else if((strategy[this[_0x7294('0x20')][this['actions'][_0x438f99[_0x7294('0x12f')]][_0x7294('0xb9')]][_0x7294('0x133')]]||_0x7294('0x134'))===_0x7294('0x134')){if(this[_0x7294('0x26')][_0x438f99[_0x7294('0x12f')]]){if(this[_0x7294('0x22')][_0x438f99[_0x7294('0x132')]]){this['actions'][_0x438f99[_0x7294('0x12f')]]['stateinterface']=_0x438f99['stateinterface'];if(_[_0x7294('0xe3')](this['queueBooked'][this[_0x7294('0x26')][_0x438f99[_0x7294('0x12f')]][_0x7294('0xb9')]])){this[_0x7294('0x2b')][this[_0x7294('0x26')][_0x438f99[_0x7294('0x12f')]]['queue']]=[];}this[_0x7294('0x2b')][this[_0x7294('0x26')][_0x438f99['actionid']]['queue']][_0x7294('0x135')](_['merge'](_[_0x7294('0xd8')](this['actions'][_0x438f99[_0x7294('0x12f')]],[_0x7294('0x136'),'stateinterface']),{'status':_0x438f99[_0x7294('0xb5')],'paused':_0x438f99[_0x7294('0x131')]}));}}}};function unlockQueueStatus(_0x2e4750,_0x2c4eb6){setTimeout(function(){if(_[_0x7294('0x40')](_0x2e4750['queueStatusComplete'])){loggerBooked[_0x7294('0x9e')](_0x7294('0x137'),_0x2c4eb6);}_0x2e4750['queueStatusComplete']=!![];loggerBooked[_0x7294('0x87')](_0x7294('0x138'),_0x2c4eb6,JSON['stringify'](_[_0x7294('0xd8')](_0x2e4750,[_0x7294('0x43'),'queueStatusComplete'])));},0x1f3);}Dialer['prototype'][_0x7294('0x3c')]=function(_0xb8b347){var _0x5a37fc=this;var _0x416c42=_0x5a37fc[_0x7294('0x20')][_0x5a37fc[_0x7294('0x26')][_0xb8b347[_0x7294('0x12f')]]['queue']];if(strategy[this[_0x7294('0x20')][this['actions'][_0xb8b347[_0x7294('0x12f')]][_0x7294('0xb9')]][_0x7294('0x133')]]==='roundrobin'){if(this[_0x7294('0x26')][_0xb8b347['actionid']]&&this[_0x7294('0x26')][_0xb8b347['actionid']]['stateinterface']){this[_0x7294('0x1f')][_0x7294('0x139')](this[_0x7294('0x26')][_0xb8b347['actionid']][_0x7294('0x136')],this[_0x7294('0x26')][_0xb8b347['actionid']][_0x7294('0x132')])['catch'](function(_0x4b157f){logger[_0x7294('0x9e')](_0x7294('0x13a'),util[_0x7294('0x9d')](_0x4b157f,{'showHidden':![],'depth':null}));})[_0x7294('0x1d')](function(){_0x5a37fc[_0x7294('0xb7')](_0x5a37fc[_0x7294('0x20')][_0x5a37fc[_0x7294('0x26')][_0xb8b347['actionid']][_0x7294('0xb9')]]);_0x5a37fc[_0x7294('0x22')][_0x5a37fc[_0x7294('0x26')][_0xb8b347[_0x7294('0x12f')]]['stateinterface']]['locked']=![];delete _0x5a37fc[_0x7294('0x26')][_0xb8b347[_0x7294('0x12f')]];unlockQueueStatus(_0x416c42);});}else{this[_0x7294('0xb7')](this[_0x7294('0x20')][this[_0x7294('0x26')][_0xb8b347['actionid']][_0x7294('0xb9')]]);this[_0x7294('0xc7')]({'active':![],'ContactId':this[_0x7294('0x26')][_0xb8b347[_0x7294('0x12f')]][_0x7294('0xd9')],'ListId':this['actions'][_0xb8b347[_0x7294('0x12f')]][_0x7294('0x12b')],'VoiceQueueId':this['actions'][_0xb8b347[_0x7294('0x12f')]][_0x7294('0xda')]||undefined,'CampaignId':this[_0x7294('0x26')][_0xb8b347[_0x7294('0x12f')]]['CampaignId']||undefined})[_0x7294('0xb6')](loggerCatch(_0x7294('0x13b')));delete this[_0x7294('0x26')][_0xb8b347[_0x7294('0x12f')]];unlockQueueStatus(_0x416c42);}}else if((strategy[this[_0x7294('0x20')][this[_0x7294('0x26')][_0xb8b347[_0x7294('0x12f')]][_0x7294('0xb9')]][_0x7294('0x133')]]||_0x7294('0x134'))===_0x7294('0x134')){var _0x68e611;if(this['actions'][_0xb8b347[_0x7294('0x12f')]]&&!_[_0x7294('0x4b')](this[_0x7294('0x2b')][this[_0x7294('0x26')][_0xb8b347[_0x7294('0x12f')]]['queue']])){if(this[_0x7294('0x13c')][_0x5a37fc[_0x7294('0x26')][_0xb8b347['actionid']]['queue']]){this[_0x7294('0x13c')][_0x5a37fc[_0x7294('0x26')][_0xb8b347['actionid']][_0x7294('0xb9')]]=this[_0x7294('0x13c')][this[_0x7294('0x26')][_0xb8b347['actionid']][_0x7294('0xb9')]]?this['queueBookedRR'][this[_0x7294('0x26')][_0xb8b347['actionid']][_0x7294('0xb9')]]:this[_0x7294('0x2b')][this['actions'][_0xb8b347['actionid']][_0x7294('0xb9')]]?this[_0x7294('0x2b')][this[_0x7294('0x26')][_0xb8b347[_0x7294('0x12f')]]['queue']][_0x7294('0x13d')]||0x0:0x0;}this[_0x7294('0x2b')][this[_0x7294('0x26')][_0xb8b347[_0x7294('0x12f')]][_0x7294('0xb9')]][_0x7294('0x13d')]=this[_0x7294('0x13c')][this[_0x7294('0x26')][_0xb8b347[_0x7294('0x12f')]][_0x7294('0xb9')]];for(var _0x273ed6=0x0;_0x273ed6=0x0;})['catch'](myreject(_0x5e9ab3)));}}else{_0x34d3a2[_0x7294('0x135')](ami[_0x7294('0xb4')]({'action':_0x7294('0x157'),'command':util['format'](_0x7294('0x158'),_0x48fbe0,!_[_0x7294('0x40')](config[_0x7294('0x159')][_0x2b04f3])?_0x2b04f3:'')})[_0x7294('0x3f')](function(_0x387138){return _0x387138[_0x7294('0x15a')][_0x7294('0x15b')](_0x7294('0x15c'))>=0x0;})[_0x7294('0xb6')](myreject(_0x5e9ab3)));}Promise[_0x7294('0x15d')](_0x34d3a2)[_0x7294('0x3f')](function(_0x321e64){var _0x6c20d8=_[_0x7294('0x15e')](_0x321e64);if(_0x6c20d8){return _0x484550(_0x6c20d8);}else{_0x577f3d[_0x7294('0x41')]=_0x1f7843?'GLOBAL_INTERVAL_IS_OVERTIME':_0x7294('0x15f');return _0x5e9ab3(msgResponse(_0x7294('0x160'),_0x7294('0x150'),_0x7294('0x161')+_0x1f7843+'\x20'+_0x2f28fe+_0x7294('0x162')+util[_0x7294('0x9d')](_0x48fbe0,{'showHidden':![],'depth':null})+_0x7294('0x163')+_0x2b04f3));}})[_0x7294('0xb6')](function(_0x153550){return _0x5e9ab3(msgResponse(_0x7294('0x14e'),_0x7294('0x150'),JSON['stringify'](_0x153550)));});});};Dialer[_0x7294('0xb0')][_0x7294('0x164')]=function(_0x54b312){var _0x2720cf=this;return function(){switch(_0x54b312['dialMethod']){case _0x7294('0x165'):freeVariablesPredictive(_0x54b312);_0x2720cf[_0x7294('0x166')](_0x54b312,0x1);break;case _0x7294('0x167'):freeVariablesPredictive(_0x54b312);_0x2720cf[_0x7294('0x166')](_0x54b312,_0x54b312[_0x7294('0x168')]);break;case _0x7294('0x169'):_0x2720cf[_0x7294('0x169')](_0x54b312);break;case'booked':freeVariablesPredictive(_0x54b312);_0x2720cf[_0x7294('0x166')](_0x54b312,0x1);break;default:freeVariablesPredictive(_0x54b312);logger[_0x7294('0x9e')](_0x7294('0x16a'),_0x54b312[_0x7294('0x43')],_0x7294('0x16b'));}};};Dialer['prototype'][_0x7294('0x16c')]=function(_0x33fd79){return Promise[_0x7294('0xbe')]()[_0x7294('0x3f')](cmHopper[_0x7294('0x16d')](_0x33fd79['id'],previewRecallmeReminderInterval))['then'](function(_0x10ec59){for(var _0x2c83ba=0x0;_0x2c83ba<_0x10ec59[_0x7294('0xa0')];_0x2c83ba++){var _0x1aa1c7=_0x10ec59[_0x2c83ba][_0x7294('0x16e')]['name'];if(_0x1aa1c7)io['to'](util['format'](_0x7294('0x16f'),_0x1aa1c7))[_0x7294('0x52')](_0x7294('0x170'),{'hopper':_0x10ec59[_0x2c83ba]});}})['catch'](function(){});};Dialer[_0x7294('0xb0')][_0x7294('0x171')]=function(_0x18607a){var _0x2154fd=this;return function(){_0x2154fd[_0x7294('0x172')](_0x18607a);};};Dialer[_0x7294('0xb0')][_0x7294('0xa')]=function(_0x452cbf){var _0x3b3bbb=this;if(isNotPreview(_0x452cbf[_0x7294('0x62')])){if(isVoiceQueueOutbound(_0x452cbf['type'])&&isActive(_0x452cbf[_0x7294('0x173')])){_0x452cbf['sendMessageOneNotActive']=!![];Promise['resolve']()[_0x7294('0x3f')](checkIsLoggedIn(_0x452cbf,_0x452cbf['loggedIn']))[_0x7294('0x3f')](checkIsActive(_0x452cbf,_0x452cbf[_0x7294('0x173')]))[_0x7294('0x3f')](checkInterval(_0x452cbf))['then'](_0x3b3bbb['checkIsTrunkReachable'](_0x452cbf))[_0x7294('0x3f')](_0x3b3bbb[_0x7294('0x14d')](_0x452cbf[_0x7294('0x174')],_0x452cbf[_0x7294('0x175')],_0x452cbf['name'],_0x452cbf))[_0x7294('0x3f')](_0x3b3bbb[_0x7294('0x14f')](_0x452cbf[_0x7294('0x47')],_0x452cbf['dialTimezone'],_0x452cbf[_0x7294('0x43')],_0x452cbf))[_0x7294('0x3f')](_0x3b3bbb[_0x7294('0x164')](_0x452cbf))[_0x7294('0xb6')](loggerCatchQueueSummary(_0x7294('0x176'),_0x452cbf));}else{notSendMessagesQueue(_0x452cbf);}}else{freeVariablesPredictive(_0x452cbf);}};Dialer[_0x7294('0xb0')][_0x7294('0x37')]=_[_0x7294('0x177')](function(){var _0x4626ae=_['filter'](this[_0x7294('0x20')],function(_0x56212b){return _0x56212b[_0x7294('0x178')];});var _0x382dab=_[_0x7294('0x179')](this[_0x7294('0x22')],function(_0x51978e){return _0x51978e['online']&&_0x51978e['status']===_0x7294('0xe1');});if(_0x4626ae['length']>0x0&&_0x382dab['length']>0x0){return Promise['resolve']()[_0x7294('0x3f')](cmHopper[_0x7294('0x16d')](_['map'](_0x4626ae,'id'),previewRecallmeReminderInterval,_[_0x7294('0x17a')](_0x382dab,'id')))[_0x7294('0x3f')](function(_0x114d46){for(var _0x254ca3=0x0;_0x254ca3<_0x114d46[_0x7294('0xa0')];_0x254ca3++){var _0x14d7c8=_0x114d46[_0x254ca3][_0x7294('0x16e')][_0x7294('0x43')];if(_0x14d7c8)io['to'](util[_0x7294('0x81')](_0x7294('0x16f'),_0x14d7c8))[_0x7294('0x52')](_0x7294('0x170'),{'hopper':_0x114d46[_0x254ca3]});}})[_0x7294('0xb6')](function(_0x3061bb){logger[_0x7294('0x9e')]('checkPreviewRecallReminder',_0x3061bb);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype']['syncCampaigns']=function(){var _0x189f42=this;var _0x43fc69;for(var _0x3f6c63 in this[_0x7294('0x21')]){if(typeof this['campaigns'][_0x3f6c63]!==_0x7294('0xb3')){_0x43fc69=this[_0x7294('0x21')][_0x3f6c63];if(isCampaignIvr(_0x43fc69[_0x7294('0x53')])&&isActive(_0x43fc69[_0x7294('0x7f')])){_0x43fc69[_0x7294('0xa7')]=!![];Promise['resolve']()[_0x7294('0x3f')](checkIsActive(_0x43fc69,_0x43fc69['active']))['then'](checkInterval(_0x43fc69))['then'](_0x189f42['checkIsTrunkReachable'](_0x43fc69))[_0x7294('0x3f')](_0x189f42[_0x7294('0x14d')](_0x43fc69[_0x7294('0x174')],_0x43fc69[_0x7294('0x175')],_0x43fc69['name'],_0x43fc69))[_0x7294('0x3f')](_0x189f42[_0x7294('0x14f')](_0x43fc69['Interval'],_0x43fc69[_0x7294('0x175')],_0x43fc69['name'],_0x43fc69))[_0x7294('0x3f')](_0x189f42['launchHandleIvr'](_0x43fc69))[_0x7294('0xb6')](loggerCatchQueueSummary(_0x7294('0x17b'),_0x43fc69));}else{notSendMessagesCampaign(_0x43fc69);}}}};function getCallerIdRandom(_0x4ae45b,_0x6b223){var _0x783bfd;var _0xd775f0;var _0x317699;if(_0x6b223<=0x0){_0x6b223=0x1;}_0x783bfd=new RegExp(_0x7294('0x17c')+_0x6b223+'}$');_0xd775f0=Math[_0x7294('0x17d')](0xa,_0x6b223-0x1);_0x317699=Math[_0x7294('0x17d')](0xa,_0x6b223)-0x1;return util['format']('%s',_[_0x7294('0x17e')](_0x4ae45b,_0x783bfd,_['random'](_0xd775f0,_0x317699)));}function extractCalleridName(_0x1ba227){var _0x3361b3=_0x1ba227[_0x7294('0x17f')](/"(.*?)"/);return _0x3361b3?_0x3361b3[0x1]:_0x1ba227;}Dialer['prototype'][_0x7294('0x180')]=function(_0x38cb9f,_0x3f8a86){var _0x15735f=this;var _0x13bfee=uuid['v4']();this[_0x7294('0x26')][_0x13bfee]=new Action(_0x38cb9f,_0x3f8a86,_0x13bfee);return new Promise(function(_0x47ec56,_0x542dd2){if(_['isUndefined'](_0x38cb9f)&&typeof _0x38cb9f!=='object'){return _0x542dd2(msgResponse(_0x7294('0x181'),_0x7294('0x150'),_0x7294('0x182')));}if(_[_0x7294('0x40')](_0x3f8a86['phone'])||_0x3f8a86['phone']===null){return _0x542dd2(msgResponse(_0x7294('0x181'),'Failure',_0x7294('0x183')));}var _0x113ee6={'XMD-CALLERID':_0x15735f[_0x7294('0x26')][_0x13bfee][_0x7294('0x184')](),'XMD-AGI':_0x38cb9f[_0x7294('0x185')]?util[_0x7294('0x81')](_0x7294('0x186'),ipAgi,_0x38cb9f['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x38cb9f[_0x7294('0x113')]?util[_0x7294('0x81')](_0x7294('0x186'),ipAgi,_0x38cb9f['dialQueueProject2']):_0x7294('0x187'),'XMD-QUEUE':_0x38cb9f[_0x7294('0x53')]===_0x7294('0x54')?util['format'](_0x7294('0x188'),_0x38cb9f[_0x7294('0x43')],_0x38cb9f[_0x7294('0x189')]||'',_0x38cb9f[_0x7294('0x114')]?'c':'',_0x38cb9f[_0x7294('0x11b')]||0x3):_0x7294('0x187'),'XMD-CONTACTID':_0x3f8a86[_0x7294('0xd9')],'XMD-CDRTYPE':_0x7294('0x7'),'CALLERID(all)':_0x15735f[_0x7294('0x26')][_0x13bfee][_0x7294('0x184')](),'XMD-AMD':_0x38cb9f[_0x7294('0xe7')]?_0x7294('0x18a'):_0x7294('0x187'),'XMD-DESTINATION':_0x7294('0xe6')};if(_0x38cb9f[_0x7294('0xe7')]){_0x113ee6['XMD-AMDINITIALSILENCE']=_0x38cb9f['dialAMDInitialSilence']||0x9c4;_0x113ee6['XMD-AMDGREETING']=_0x38cb9f[_0x7294('0x18b')]||0x5dc;_0x113ee6[_0x7294('0x18c')]=_0x38cb9f[_0x7294('0x18d')]||0x320;_0x113ee6[_0x7294('0x18e')]=_0x38cb9f[_0x7294('0x18f')]||0x1388;_0x113ee6[_0x7294('0x190')]=_0x38cb9f[_0x7294('0x191')]||0x64;_0x113ee6['XMD-AMDBETWEENWORDSSILENCE']=_0x38cb9f[_0x7294('0x192')]||0x32;_0x113ee6[_0x7294('0x193')]=_0x38cb9f['dialAMDMaximumNumberOfWords']||0x3;_0x113ee6[_0x7294('0x194')]=_0x38cb9f[_0x7294('0x195')]||0x100;_0x113ee6[_0x7294('0x196')]=_0x38cb9f[_0x7294('0x197')]||0x1388;}if(_0x38cb9f[_0x7294('0x53')]===_0x7294('0x54')){_0x113ee6[_0x7294('0x198')]=_0x3f8a86[_0x7294('0xda')];}else{_0x113ee6[_0x7294('0x199')]=_0x3f8a86[_0x7294('0xdb')];}for(var _0x1ee9ab in _0x3f8a86[_0x7294('0x19a')]){if(typeof _0x3f8a86[_0x7294('0x19a')][_0x1ee9ab]!=='undefined'){if(isNotNull(_0x3f8a86[_0x7294('0x19a')][_0x1ee9ab])&&_0x1ee9ab!=='id'&&_0x1ee9ab!=='tags'&&_0x1ee9ab!==_0x7294('0x19b')&&_0x1ee9ab!==_0x7294('0x19c')){_0x113ee6[util[_0x7294('0x81')](_0x7294('0x19d'),_0x7294('0x19e'),_[_0x7294('0x19f')](_0x1ee9ab))]=_0x3f8a86['Contact'][_0x1ee9ab];}}}var _0x412b41=_0x15735f[_0x7294('0xdf')](_0x38cb9f[_0x7294('0x7e')])?getCallerId(_0x38cb9f['Trunk'][_0x7294('0x80')],_0x38cb9f['dialOriginateCallerIdName'],_0x38cb9f[_0x7294('0x1a0')]>0x0?getCallerIdRandom(_0x38cb9f[_0x7294('0x64')],_0x38cb9f['dialRandomLastDigitCallerIdNumber']):_0x38cb9f[_0x7294('0x64')]):getCallerId(_['isNil'](_0x38cb9f[_0x7294('0x1a1')])?_0x38cb9f[_0x7294('0x7e')][_0x7294('0x80')]:_0x38cb9f[_0x7294('0x1a1')]['callerid'],_0x38cb9f[_0x7294('0x63')],_0x38cb9f[_0x7294('0x1a0')]>0x0?getCallerIdRandom(_0x38cb9f[_0x7294('0x64')],_0x38cb9f[_0x7294('0x1a0')]):_0x38cb9f[_0x7294('0x64')]);if(_0x412b41){_0x113ee6[_0x7294('0x1a2')]=_0x15735f[_0x7294('0x26')][_0x13bfee][_0x7294('0x1a3')]=extractCalleridName(_0x412b41);_0x113ee6[_0x7294('0x1a4')]=_0x3f8a86['phone'];}_0x38cb9f[_0x7294('0x1a5')]=_0x113ee6;return ami[_0x7294('0xb4')]({'actionid':_0x13bfee,'action':_0x7294('0x181'),'channel':_0x15735f[_0x7294('0xdf')](_0x38cb9f['Trunk'])?util['format'](_0x7294('0x1a6'),_0x38cb9f[_0x7294('0x7e')][_0x7294('0x43')],isNotNull(_0x38cb9f[_0x7294('0x1a7')])?_0x38cb9f[_0x7294('0x1a7')]['trim']()||'':'',_0x38cb9f[_0x7294('0x1a8')]>0x0?_0x3f8a86[_0x7294('0x1a9')][_0x7294('0x1aa')](_0x38cb9f[_0x7294('0x1a8')]):_0x3f8a86[_0x7294('0x1a9')]):util[_0x7294('0x81')](_0x7294('0x1a6'),_[_0x7294('0xe3')](_0x38cb9f['TrunkBackup'])?_0x38cb9f['Trunk'][_0x7294('0x43')]:_0x38cb9f[_0x7294('0x1a1')]['name'],isNotNull(_0x38cb9f['dialPrefix'])?_0x38cb9f[_0x7294('0x1a7')]['trim']()||'':'',_0x38cb9f[_0x7294('0x1a8')]>0x0?_0x3f8a86[_0x7294('0x1a9')][_0x7294('0x1aa')](_0x38cb9f[_0x7294('0x1a8')]):_0x3f8a86[_0x7294('0x1a9')]),'callerid':_0x412b41,'Exten':_0x7294('0xe6'),'Context':_0x7294('0x1ab'),'Priority':'1','variable':_0x113ee6,'timeout':(_0x38cb9f['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x13bfee})[_0x7294('0x3f')](function(_0x44c702){return _0x47ec56(_0x44c702);})[_0x7294('0xb6')](function(_0x3df419){_0x38cb9f[_0x7294('0x1ac')]+=0x1;var _0xefa977=new History(_0x15735f[_0x7294('0x26')][_0x13bfee]);logger['error'](util[_0x7294('0x81')](_0x7294('0x1ad'),JSON[_0x7294('0x4e')](_0x3df419)));_0xefa977['state']=0xe;_0xefa977[_0x7294('0xea')]=_0x7294('0x1ae');_0xefa977['starttime']=moment()[_0x7294('0x81')](_0x7294('0x10a'));_0xefa977[_0x7294('0xae')]=_0xefa977['starttime'];_0x15735f[_0x7294('0xd2')](_0xefa977)[_0x7294('0xb6')](loggerCatch('[originate][error]'));_0x15735f[_0x7294('0xd0')](_0xefa977)[_0x7294('0xb6')](loggerCatch(_0x7294('0x1af')))[_0x7294('0x1d')](function(){delete _0x15735f[_0x7294('0x26')][_0x13bfee];return _0x542dd2(msgResponse('originate',_0x7294('0x4d'),_0x7294('0x1b0')));});});});};Dialer['prototype']['syncOriginateResponse']=function(_0x17d8db){var _0x4a017e=this[_0x7294('0x26')][_0x17d8db[_0x7294('0x12f')]];if(_0x4a017e){delete this['actions'][_0x17d8db['actionid']];_0x4a017e[_0x7294('0x11a')]=moment()[_0x7294('0x81')](_0x7294('0x10a'));var _0x2c9c17=_0x4a017e[_0x7294('0x53')]===_0x7294('0x84')?this['campaigns'][_0x4a017e[_0x7294('0xb9')]]:this[_0x7294('0x20')][_0x4a017e[_0x7294('0x1b1')]()];if(!this['isSuccess'](_0x17d8db[_0x7294('0x1b2')])){this[_0x7294('0xb7')](_0x2c9c17);return this[_0x7294('0x1b3')](_0x4a017e,_0x2c9c17,_0x17d8db)[_0x7294('0xb6')](loggerCatch(_0x7294('0x1b4')));}this[_0x7294('0x28')][_0x17d8db['uniqueid']]=_0x4a017e;}};Dialer['prototype'][_0x7294('0x1b5')]=function(_0x1c24b5,_0x46a9a4,_0x12c09e){var _0x2cb5bd=new History(_0x46a9a4);if(_0x2cb5bd[_0x7294('0xf5')]+_0x2cb5bd[_0x7294('0x103')]+_0x2cb5bd[_0x7294('0xf6')]+_0x2cb5bd[_0x7294('0xf7')]+_0x2cb5bd[_0x7294('0xf8')]+_0x2cb5bd[_0x7294('0xf9')]+_0x2cb5bd['countmachineretry']+_0x2cb5bd[_0x7294('0x104')]>=_0x12c09e[_0x7294('0xfa')]-0x1){return!![];}switch(_0x1c24b5){case 0x3:if(_0x2cb5bd['countnoanswerretry']>=_0x12c09e['dialNoAnswerMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x2cb5bd['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x7294('0xfe')](_0x12c09e[_0x7294('0x1b6')],_0x7294('0x109'))[_0x7294('0x81')](_0x7294('0x10a')),'ContactId':_0x2cb5bd[_0x7294('0xd9')],'ListId':_0x2cb5bd[_0x7294('0x12b')],'VoiceQueueId':_0x2cb5bd[_0x7294('0xda')]||undefined,'CampaignId':_0x2cb5bd['CampaignId']||undefined})[_0x7294('0xb6')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x2cb5bd[_0x7294('0xf5')]>=_0x12c09e[_0x7294('0x1b7')]-0x1){return!![];}this[_0x7294('0xc7')]({'active':![],'countbusyretry':_0x2cb5bd[_0x7294('0xf5')]+=0x1,'scheduledat':moment()[_0x7294('0xfe')](_0x12c09e[_0x7294('0x1b8')],_0x7294('0x109'))[_0x7294('0x81')](_0x7294('0x10a')),'ContactId':_0x2cb5bd[_0x7294('0xd9')],'ListId':_0x2cb5bd[_0x7294('0x12b')],'VoiceQueueId':_0x2cb5bd[_0x7294('0xda')]||undefined,'CampaignId':_0x2cb5bd[_0x7294('0xdb')]||undefined})[_0x7294('0xb6')](loggerCatch(_0x7294('0x1b9')));break;case 0x8:if(_0x2cb5bd['countcongestionretry']>=_0x12c09e[_0x7294('0x1ba')]-0x1){return!![];}this[_0x7294('0xc7')]({'active':![],'countcongestionretry':_0x2cb5bd['countcongestionretry']+=0x1,'scheduledat':moment()[_0x7294('0xfe')](_0x12c09e[_0x7294('0x1bb')],_0x7294('0x109'))[_0x7294('0x81')](_0x7294('0x10a')),'ContactId':_0x2cb5bd['ContactId'],'ListId':_0x2cb5bd[_0x7294('0x12b')],'VoiceQueueId':_0x2cb5bd[_0x7294('0xda')]||undefined,'CampaignId':_0x2cb5bd['CampaignId']||undefined})[_0x7294('0xb6')](loggerCatch(_0x7294('0x1bc')));break;case 0x0:if(_0x2cb5bd[_0x7294('0xf7')]>=_0x12c09e[_0x7294('0x1bd')]-0x1){return!![];}else{this[_0x7294('0xc7')]({'active':![],'countnosuchnumberretry':_0x2cb5bd[_0x7294('0xf7')]+=0x1,'scheduledat':moment()[_0x7294('0xfe')](_0x12c09e['dialNoSuchNumberRetryFrequency'],_0x7294('0x109'))[_0x7294('0x81')](_0x7294('0x10a')),'ContactId':_0x2cb5bd['ContactId'],'ListId':_0x2cb5bd[_0x7294('0x12b')],'VoiceQueueId':_0x2cb5bd[_0x7294('0xda')]||undefined,'CampaignId':_0x2cb5bd[_0x7294('0xdb')]||undefined})[_0x7294('0xb6')](loggerCatch(_0x7294('0x1be')));}break;case 0xa:if(_0x2cb5bd['countdropretry']>=_0x12c09e['dialDropMaxRetry']-0x1){return!![];}this[_0x7294('0xc7')]({'active':![],'countdropretry':_0x2cb5bd[_0x7294('0xf8')]+=0x1,'scheduledat':moment()[_0x7294('0xfe')](_0x12c09e[_0x7294('0x11f')],_0x7294('0x109'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2cb5bd[_0x7294('0xd9')],'ListId':_0x2cb5bd[_0x7294('0x12b')],'VoiceQueueId':_0x2cb5bd[_0x7294('0xda')]||undefined,'CampaignId':_0x2cb5bd[_0x7294('0xdb')]||undefined})[_0x7294('0xb6')](loggerCatch(_0x7294('0x123')));break;case 0xb:if(_0x2cb5bd['countabandonedretry']>=_0x12c09e[_0x7294('0x1bf')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x2cb5bd[_0x7294('0xf9')]+=0x1,'scheduledat':moment()[_0x7294('0xfe')](_0x12c09e['dialAbandonedRetryFrequency'],'minutes')[_0x7294('0x81')](_0x7294('0x10a')),'ContactId':_0x2cb5bd['ContactId'],'ListId':_0x2cb5bd['ListId'],'VoiceQueueId':_0x2cb5bd[_0x7294('0xda')]||undefined,'CampaignId':_0x2cb5bd[_0x7294('0xdb')]||undefined})[_0x7294('0xb6')](loggerCatch(_0x7294('0x12c')));break;case 0x13:if(_0x2cb5bd[_0x7294('0xfc')]>=_0x12c09e['dialMachineMaxRetry']-0x1){return!![];}this[_0x7294('0xc7')]({'active':![],'countmachineretry':_0x2cb5bd[_0x7294('0xfc')]+=0x1,'scheduledat':moment()['add'](_0x12c09e[_0x7294('0x108')],_0x7294('0x109'))[_0x7294('0x81')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2cb5bd['ContactId'],'ListId':_0x2cb5bd[_0x7294('0x12b')],'VoiceQueueId':_0x2cb5bd[_0x7294('0xda')]||undefined,'CampaignId':_0x2cb5bd[_0x7294('0xdb')]||undefined})['catch'](loggerCatch(_0x7294('0xff')));break;case 0x14:if(_0x2cb5bd[_0x7294('0x104')]>=_0x12c09e[_0x7294('0x1c0')]-0x1){return!![];}this[_0x7294('0xc7')]({'active':![],'countagentrejectretry':_0x2cb5bd[_0x7294('0x104')]+=0x1,'scheduledat':moment()[_0x7294('0xfe')](_0x12c09e[_0x7294('0x1c1')],_0x7294('0x109'))['format'](_0x7294('0x10a')),'ContactId':_0x2cb5bd[_0x7294('0xd9')],'ListId':_0x2cb5bd[_0x7294('0x12b')],'VoiceQueueId':_0x2cb5bd[_0x7294('0xda')]||undefined,'CampaignId':_0x2cb5bd['CampaignId']||undefined})['catch'](loggerCatch(_0x7294('0x1c2')));break;default:return!![];}};Dialer['prototype'][_0x7294('0x1b3')]=function(_0x506b30,_0x2fb488,_0x22a9f5){var _0x202f0f=this;var _0x55b792=new History(_0x506b30);var _0x1574f3=![];var _0x42c75c;var _0x1dca36;return new Promise(function(_0x2d9770,_0x53031b){if(_['isUndefined'](_0x2fb488)&&typeof _0x2fb488!==_0x7294('0x1c3')){return _0x53031b(msgResponse(_0x7294('0x1c4'),_0x7294('0x150'),_0x7294('0x1c5')));}if(_[_0x7294('0x40')](_0x22a9f5)&&typeof _0x22a9f5!==_0x7294('0x1c3')){return _0x53031b(msgResponse(_0x7294('0x1c4'),'Failure',_0x7294('0x1c6')));}_0x202f0f[_0x7294('0xc0')](_0x55b792,_0x22a9f5[_0x7294('0x111')],_0x2fb488)[_0x7294('0x3f')](function(_0x463314){if(_0x463314[_0x7294('0x120')]==0x1)_0x1574f3=!![];switch(_0x22a9f5[_0x7294('0x111')]){case'0':_0x2fb488[_0x7294('0x6d')]+=0x1;_0x55b792['state']=0x0;_0x55b792[_0x7294('0xea')]=_0x7294('0x1c7');_0x55b792['countnosuchnumberretry']+=0x1;_0x55b792[_0x7294('0xf2')]+=0x1;ami['emit'](_0x7294('0x1c8'),ut['buildObj'](_0x506b30,'nosuchnumber'));_0x42c75c=_0x2fb488[_0x7294('0x1c9')];_0x1dca36=_0x2fb488['callAdditionalPhoneAfterMin'];_0x202f0f[_0x7294('0xd2')](_0x55b792)['catch'](loggerCatch(_0x7294('0xf4')));if(_0x202f0f[_0x7294('0x1b5')](0x0,_0x506b30,_0x2fb488)&&!_0x1574f3){if(_0x55b792[_0x7294('0xf7')]>=_0x2fb488['dialNoSuchNumberMaxRetry']){_0x202f0f[_0x7294('0xfd')](_0x55b792,_0x2d9770,_0x53031b,_0x7294('0x1ca'));}else{_0x202f0f[_0x7294('0xfb')](_0x55b792,_0x2d9770,_0x53031b,_0x7294('0x1ca'));}}break;case'3':_0x2fb488[_0x7294('0x1cb')]+=0x1;_0x55b792[_0x7294('0xad')]=0x3;_0x55b792[_0x7294('0xea')]=_0x7294('0x1cc');_0x55b792[_0x7294('0xf6')]+=0x1;_0x55b792[_0x7294('0xf2')]+=0x1;var _0x499947=ut[_0x7294('0x1cd')](_0x506b30,_0x2fb488);ami[_0x7294('0x52')](_0x7294('0x1ce'),_0x499947);_0x42c75c=_0x2fb488[_0x7294('0x1b6')];_0x1dca36=_0x2fb488['callAdditionalPhoneAfterMin'];_0x202f0f[_0x7294('0xd2')](_0x55b792)[_0x7294('0xb6')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x202f0f[_0x7294('0x1b5')](0x3,_0x506b30,_0x2fb488)&&!_0x1574f3){if(_0x55b792[_0x7294('0xf6')]>=_0x2fb488[_0x7294('0x1cf')]){_0x202f0f[_0x7294('0xfd')](_0x55b792,_0x2d9770,_0x53031b,_0x7294('0x1d0'));}else{_0x202f0f[_0x7294('0xfb')](_0x55b792,_0x2d9770,_0x53031b,_0x7294('0x1d0'));}}break;case'5':_0x2fb488[_0x7294('0x68')]+=0x1;_0x55b792[_0x7294('0xad')]=0x5;_0x55b792[_0x7294('0xea')]=_0x7294('0x1d1');_0x55b792['countbusyretry']+=0x1;_0x55b792[_0x7294('0xf2')]+=0x1;ami[_0x7294('0x52')](_0x7294('0x1d2'),ut[_0x7294('0xf3')](_0x506b30,_0x7294('0x1d3')));_0x42c75c=_0x2fb488[_0x7294('0x1b8')];_0x1dca36=_0x2fb488['callAdditionalPhoneAfterMin'];_0x202f0f[_0x7294('0xd2')](_0x55b792)[_0x7294('0xb6')](loggerCatch(_0x7294('0x1d4')));if(_0x202f0f[_0x7294('0x1b5')](0x5,_0x506b30,_0x2fb488)&&!_0x1574f3){if(_0x55b792['countbusyretry']>=_0x2fb488[_0x7294('0x1b7')]){_0x202f0f[_0x7294('0xfd')](_0x55b792,_0x2d9770,_0x53031b,_0x7294('0x1d5'));}else{_0x202f0f['stateGlobal'](_0x55b792,_0x2d9770,_0x53031b,_0x7294('0x1d5'));}}break;case'8':_0x2fb488['outboundCongestionCallsDay']+=0x1;_0x55b792[_0x7294('0xad')]=0x8;_0x55b792['statedesc']=_0x7294('0x1d6');_0x55b792[_0x7294('0x103')]+=0x1;_0x55b792[_0x7294('0xf2')]+=0x1;_0x42c75c=_0x2fb488[_0x7294('0x1bb')];_0x1dca36=_0x2fb488[_0x7294('0x128')];ami[_0x7294('0x52')](_0x7294('0x1d7'),ut[_0x7294('0xf3')](_0x506b30,_0x7294('0x1d8')));_0x202f0f[_0x7294('0xd2')](_0x55b792)['catch'](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x202f0f[_0x7294('0x1b5')](0x8,_0x506b30,_0x2fb488)&&!_0x1574f3){if(_0x55b792[_0x7294('0x103')]>=_0x2fb488[_0x7294('0x1ba')]){_0x202f0f[_0x7294('0xfd')](_0x55b792,_0x2d9770,_0x53031b,'reason\x208\x20congestion');}else{_0x202f0f[_0x7294('0xfb')](_0x55b792,_0x2d9770,_0x53031b,'reason\x208\x20congestion');}}break;case'11':_0x2fb488[_0x7294('0x1d9')]+=0x1;_0x55b792[_0x7294('0xad')]=0xb;_0x55b792[_0x7294('0xea')]=_0x7294('0x127');_0x55b792[_0x7294('0xf9')]+=0x1;_0x55b792[_0x7294('0xf2')]+=0x1;_0x42c75c=_0x2fb488[_0x7294('0x12a')];_0x1dca36=_0x2fb488['callAdditionalPhoneAfterMin'];_0x202f0f[_0x7294('0xd2')](_0x55b792)['catch'](loggerCatch(_0x7294('0x1da')));if(_0x202f0f['checkRetriveMax'](0xb,_0x506b30,_0x2fb488)&&!_0x1574f3){if(_0x55b792[_0x7294('0xf9')]>=_0x2fb488[_0x7294('0x1bf')]){_0x202f0f[_0x7294('0xfd')](_0x55b792,_0x2d9770,_0x53031b,_0x7294('0x1db'));}else{_0x202f0f[_0x7294('0xfb')](_0x55b792,_0x2d9770,_0x53031b,_0x7294('0x1db'));}}break;case'20':_0x2fb488[_0x7294('0x6f')]+=0x1;_0x55b792['state']=0x14;_0x55b792[_0x7294('0xea')]=_0x7294('0x1dc');_0x55b792[_0x7294('0x104')]+=0x1;_0x55b792[_0x7294('0xf2')]+=0x1;_0x42c75c=_0x2fb488[_0x7294('0x1c1')];_0x1dca36=_0x2fb488[_0x7294('0x128')];ami[_0x7294('0x52')]('custom:agentreject',ut[_0x7294('0xf3')](_0x506b30,_0x7294('0x1dd')));_0x202f0f['createHistory'](_0x55b792)['catch'](loggerCatch(_0x7294('0x1de')));if(_0x202f0f['checkRetriveMax'](0x14,_0x506b30,_0x2fb488)&&!_0x1574f3){if(_0x55b792[_0x7294('0x104')]>=_0x2fb488[_0x7294('0x1c0')]){_0x202f0f[_0x7294('0xfd')](_0x55b792,_0x2d9770,_0x53031b,'reason\x2020\x20agentreject');}else{_0x202f0f[_0x7294('0xfb')](_0x55b792,_0x2d9770,_0x53031b,_0x7294('0x1df'));}}break;default:_0x2fb488[_0x7294('0x1e0')]+=0x1;_0x55b792[_0x7294('0xad')]=0xc;_0x55b792['statedesc']=_0x22a9f5['reason'];_0x42c75c=_0x2fb488[_0x7294('0x1c1')];_0x1dca36=_0x2fb488[_0x7294('0x128')];_0x202f0f[_0x7294('0xd2')](_0x55b792)[_0x7294('0xb6')](loggerCatch(_0x7294('0x1e1')));if(_0x202f0f[_0x7294('0x1b5')](_0x22a9f5[_0x7294('0x111')],_0x506b30,_0x2fb488)&&!_0x1574f3){if(_0x55b792[_0x7294('0xf5')]+_0x55b792['countcongestionretry']+_0x55b792[_0x7294('0xf6')]+_0x55b792['countnosuchnumberretry']+_0x55b792[_0x7294('0xf8')]+_0x55b792[_0x7294('0xf9')]+_0x55b792['countmachineretry']+_0x55b792['countagentrejectretry']>=_0x2fb488[_0x7294('0xfa')]){_0x202f0f[_0x7294('0xfb')](_0x55b792,_0x2d9770,_0x53031b,_0x22a9f5[_0x7294('0x111')]);}else{_0x202f0f['createStateFinal'](_0x55b792,_0x2d9770,_0x53031b,_0x22a9f5[_0x7294('0x111')]);}}}})[_0x7294('0x3f')](function(){if(_0x1574f3){_0x202f0f[_0x7294('0xc2')](_0x55b792,_0x42c75c,_0x1dca36)[_0x7294('0x3f')](function(){return _0x2d9770(0x1);});}});});};Dialer['prototype'][_0x7294('0xfb')]=function(_0x23ab7a,_0x1a56cb,_0x2f047d,_0x4fa0ed){var _0x32e833=new Final(_0x23ab7a);_0x32e833['state']=0xf;_0x32e833[_0x7294('0xea')]=_0x7294('0x1e2');this['createStateFinal'](_0x32e833,_0x1a56cb,_0x2f047d,_0x4fa0ed);};Dialer[_0x7294('0xb0')][_0x7294('0xfd')]=function(_0x4dedd6,_0x5359e1,_0x5813ae,_0x5a16db){this['moveContactManagedDialer'](_0x4dedd6)[_0x7294('0x3f')](function(){return _0x5359e1(msgResponse('[callProgressDetecting]',_0x7294('0xde'),_0x5a16db));})['catch'](function(){return _0x5813ae(msgResponse('[moveContactManagedDialer][0]','Failure',_0x7294('0x1e3')));});};Dialer[_0x7294('0xb0')]['predictive']=function(_0x3ae8a1){var _0x7baa5=_0x3ae8a1['dialPredictiveOptimizationPercentage']/0x64;var _0x22874c=_0x3ae8a1['outboundDropCallsDayTimeout']/(_0x3ae8a1[_0x7294('0x6c')]+_0x3ae8a1[_0x7294('0x66')]);var _0x450246=Math['round'](_0x3ae8a1['predictiveIntervalAvailable']*(_0x3ae8a1[_0x7294('0x1e4')]/0x64));var _0x6daa95=Math[_0x7294('0x1e5')](_0x3ae8a1['predictiveIntervalAvailable']*(_0x3ae8a1[_0x7294('0x1e6')]/0x64));var _0x306608=_0x3ae8a1[_0x7294('0x56')]+_0x3ae8a1[_0x7294('0x5c')];var _0x505df9=Math[_0x7294('0x1e7')](_0x3ae8a1[_0x7294('0x90')]*_0x3ae8a1[_0x7294('0x7d')]*_0x3ae8a1[_0x7294('0x77')]*_0x3ae8a1[_0x7294('0x78')]);if(_['isUndefined'](_0x3ae8a1[_0x7294('0x2a')])){if(!_[_0x7294('0x40')](_0x3ae8a1[_0x7294('0x29')])){_0x3ae8a1[_0x7294('0x29')]=undefined;loggerPredictive[_0x7294('0x9e')](_0x7294('0x1e8'),_0x7294('0x1e9'));}if(!_[_0x7294('0x40')](_0x3ae8a1['handlePredictive'])){loggerPredictive[_0x7294('0x9e')](_0x7294('0x1e8'),_0x7294('0x1ea'));clearInterval(_0x3ae8a1[_0x7294('0x98')]);_0x3ae8a1[_0x7294('0x98')]=undefined;}_0x3ae8a1[_0x7294('0x2a')]=moment()[_0x7294('0x81')](_0x7294('0x10a'));loggerPredictive[_0x7294('0x87')](_0x3ae8a1[_0x7294('0x43')],_0x7294('0x1eb'),_0x3ae8a1[_0x7294('0x2a')]);this[_0x7294('0x166')](_0x3ae8a1,0x1);}else if(ifInterval(_0x3ae8a1[_0x7294('0x1ec')],_0x3ae8a1['startProgressive'])){this[_0x7294('0x166')](_0x3ae8a1,0x1);loggerPredictiveCalls[_0x7294('0x87')](_0x7294('0x1ed'),_0x3ae8a1[_0x7294('0x2a')],_0x3ae8a1[_0x7294('0x43')]);_0x3ae8a1[_0x7294('0x90')]=0x0;_0x3ae8a1[_0x7294('0x76')]=0x0;}else if(_0x7baa5<_0x22874c&&_0x3ae8a1[_0x7294('0x1ee')]==='dropRate'){freeVariablesPredictive(_0x3ae8a1);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x7294('0x1ef'),_0x22874c,'startProgressive',_0x3ae8a1[_0x7294('0x43')]);}else if(_0x505df9<_0x3ae8a1[_0x7294('0x76')]&&_0x3ae8a1[_0x7294('0x1ee')]==='dropRate'){freeVariablesPredictive(_0x3ae8a1);loggerPredictive[_0x7294('0x87')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x7294('0x1f0'),_0x505df9,_0x7294('0x1f1'),_0x3ae8a1[_0x7294('0x76')],_0x7294('0x2a'),_0x3ae8a1[_0x7294('0x43')]);}else if(!ifInterval(_0x3ae8a1[_0x7294('0x1ec')],_0x3ae8a1[_0x7294('0x2a')])&&_[_0x7294('0x40')](_0x3ae8a1[_0x7294('0x29')])&&!_['isUndefined'](_0x3ae8a1[_0x7294('0x2a')])){_0x3ae8a1['startPredictive']=moment()['format'](_0x7294('0x10a'));loggerPredictive[_0x7294('0x87')](_0x3ae8a1['name'],_0x7294('0x1f2'),_0x3ae8a1['startPredictive']);this[_0x7294('0x1f3')](_0x3ae8a1[_0x7294('0x1ec')])['then'](this['getDataPredictive'](_0x3ae8a1))[_0x7294('0x3f')](mergeDataErlangB(_0x3ae8a1))[_0x7294('0x3f')](this[_0x7294('0x1f4')](_0x3ae8a1))['catch'](loggerCatchPredictive(_0x7294('0x1f5'),_0x3ae8a1));}else if(!ifInterval(_0x3ae8a1[_0x7294('0x1ec')],_0x3ae8a1[_0x7294('0x29')])){_0x3ae8a1[_0x7294('0x76')]=0x0;_0x3ae8a1[_0x7294('0x29')]=moment()[_0x7294('0x81')](_0x7294('0x10a'));loggerPredictive[_0x7294('0x87')](_0x3ae8a1[_0x7294('0x43')],_0x7294('0x1f6'),_0x3ae8a1[_0x7294('0x29')]);clearInterval(_0x3ae8a1[_0x7294('0x98')]);_0x3ae8a1[_0x7294('0x98')]=undefined;this[_0x7294('0x1f3')](_0x3ae8a1['dialPredictiveInterval'])[_0x7294('0x3f')](this['getDataPredictive'](_0x3ae8a1))['then'](mergeDataErlangB(_0x3ae8a1))['then'](this[_0x7294('0x1f4')](_0x3ae8a1))[_0x7294('0xb6')](loggerCatchPredictive(_0x7294('0x1f7'),_0x3ae8a1));}else if(_0x3ae8a1[_0x7294('0x1f8')]&&_0x306608<_0x3ae8a1[_0x7294('0x1f8')]-_0x6daa95){freeVariablesPredictive(_0x3ae8a1);loggerPredictive[_0x7294('0x87')](_0x3ae8a1[_0x7294('0x43')],_0x7294('0x1f9'),_0x306608,_0x7294('0x1fa'),_0x3ae8a1[_0x7294('0x1f8')],'-',_0x6daa95,'=',_0x3ae8a1[_0x7294('0x1f8')]-_0x6daa95,')');}else if(_0x3ae8a1[_0x7294('0x1f8')]&&_0x306608>_0x3ae8a1[_0x7294('0x1f8')]+_0x450246){freeVariablesPredictive(_0x3ae8a1);loggerPredictive[_0x7294('0x87')](_0x3ae8a1[_0x7294('0x43')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x306608,')\x20are\x20more\x20than\x20threshold\x20(',_0x3ae8a1[_0x7294('0x1f8')],'+',_0x450246,'=',_0x3ae8a1[_0x7294('0x1f8')]+_0x450246,')');}};Dialer[_0x7294('0xb0')][_0x7294('0x1fb')]=function(_0x3f90a0){var _0x5850fb=this;return function(_0x48c79e){return new Promise(function(_0xf97b71,_0x2e5df8){_['merge'](_0x3f90a0,_0x48c79e[0x0]);if(checkGetDataPredictive(_0x48c79e[0x0])){var _0x4621f0=_0x3f90a0['predictiveIntervalAvailable']=_0x3f90a0[_0x7294('0x5c')]+_0x3f90a0[_0x7294('0x56')];var _0x31c40b=_0x3f90a0['dialPredictiveInterval']*0x3c;var _0x4da2dd=_0x48c79e[0x0][_0x7294('0x72')]+_0x48c79e[0x0]['predictiveIntervalAvgHoldtime'];var _0x52878e=(_0x48c79e[0x0][_0x7294('0x70')]+_0x48c79e[0x0][_0x7294('0x74')]+_0x48c79e[0x0][_0x7294('0x73')])/_0x48c79e[0x0][_0x7294('0x7a')];_0x3f90a0[_0x7294('0x77')]=_0x52878e>0x0?_0x52878e:0x1;switch(_0x3f90a0[_0x7294('0x1ee')]){case _0x7294('0x1fc'):var _0x480e6=_0x3f90a0[_0x7294('0x1fd')]/0x64;return _0x5850fb[_0x7294('0x1fe')](_0x4621f0,_0x31c40b,_0x4da2dd,_0x52878e,_0x480e6)['then'](function(_0x443f5f){return _0xf97b71(_0x443f5f);});case _0x7294('0x1ff'):var _0x4ca0c9=_0x3f90a0[_0x7294('0x1fd')]/0x64;return _0x5850fb[_0x7294('0x200')](_0x4621f0,_0x31c40b,_0x4da2dd,_0x52878e,_0x4ca0c9)[_0x7294('0x3f')](function(_0x28ade4){return _0xf97b71(_0x28ade4);});default:return _0x2e5df8(msgResponse(_0x7294('0x201'),_0x7294('0x150'),_0x7294('0x202')));}}else{return _0x2e5df8(msgResponse(_0x7294('0x201'),_0x7294('0x150'),_0x7294('0x203')));}});};};Dialer[_0x7294('0xb0')]['getDataPredictiveOld']=function(_0x1b635a){var _0xdaa587=this;return function(_0xc4383b){return new Promise(function(_0x3ff91d,_0x415e8c){_[_0x7294('0x95')](_0x1b635a,_0xc4383b[0x0]);if(checkGetDataPredictive(_0xc4383b[0x0])){loggerPredictive[_0x7294('0x87')](JSON[_0x7294('0x4e')](_0xc4383b[0x0]));if(_0x1b635a[_0x7294('0x1ee')]===_0x7294('0x1fc')){return _0xdaa587[_0x7294('0xcf')](_0x1b635a['id'])['then'](function(_0x12df21){var _0x4469c7=_0x1b635a[_0x7294('0x57')]-_0x12df21[0x0][_0x7294('0x204')];var _0x2a31e4=_0x1b635a[_0x7294('0x1ec')]*0x3c;var _0x7c297e=_0xc4383b[0x0][_0x7294('0x72')]+_0xc4383b[0x0][_0x7294('0x71')];var _0x5e78ee=(_0xc4383b[0x0][_0x7294('0x70')]+_0xc4383b[0x0][_0x7294('0x74')]+_0xc4383b[0x0][_0x7294('0x73')])/_0xc4383b[0x0][_0x7294('0x7a')];var _0x3cb1f6=_0x1b635a[_0x7294('0x1fd')]/0x64;_0x1b635a[_0x7294('0x79')]=_0x12df21[0x0][_0x7294('0x204')]||0x0;_0x1b635a[_0x7294('0x77')]=_0x5e78ee>0x0?_0x5e78ee:0x1;return _0xdaa587['abandonmentRate'](_0x4469c7,_0x2a31e4,_0x7c297e,_0x5e78ee,_0x3cb1f6);})[_0x7294('0x3f')](function(_0x4b3b5a){return _0x3ff91d(_0x4b3b5a);})[_0x7294('0xb6')](function(_0x2a3867){return _0x415e8c(msgResponse(_0x7294('0x205'),_0x7294('0x150'),JSON[_0x7294('0x4e')](_0x2a3867)));});}if(_0x1b635a['dialPredictiveOptimization']===_0x7294('0x1ff')){return _0xdaa587['getVoiceQueueRtPauses'](_0x1b635a['id'])[_0x7294('0x3f')](function(_0x39be20){var _0xd641f8=_0x1b635a[_0x7294('0x57')]-_0x39be20[0x0][_0x7294('0x204')];var _0x2e5f20=_0x1b635a[_0x7294('0x1ec')]*0x3c;var _0x5cc91e=_0xc4383b[0x0][_0x7294('0x72')]+_0xc4383b[0x0][_0x7294('0x71')];var _0x20b92d=(_0xc4383b[0x0]['predictiveIntervalAnsweredCalls']+_0xc4383b[0x0][_0x7294('0x74')]+_0xc4383b[0x0][_0x7294('0x73')])/_0xc4383b[0x0]['predictiveIntervalTotalCalls'];var _0x5bdcc4=_0x1b635a[_0x7294('0x1fd')]/0x64;_0x1b635a[_0x7294('0x79')]=_0x39be20[0x0][_0x7294('0x204')]||0x0;_0x1b635a[_0x7294('0x77')]=_0x20b92d>0x0?_0x20b92d:0x1;return _0xdaa587[_0x7294('0x200')](_0xd641f8,_0x2e5f20,_0x5cc91e,_0x20b92d,_0x5bdcc4);})[_0x7294('0x3f')](function(_0x602bb){return _0x3ff91d(_0x602bb);})[_0x7294('0xb6')](function(_0xf8764b){return _0x415e8c(msgResponse('[CatchErlangB]',_0x7294('0x150'),JSON[_0x7294('0x4e')](_0xf8764b)));});}}else{return _0x415e8c(msgResponse(_0x7294('0x201'),_0x7294('0x150'),_0x7294('0x203')));}});};};Dialer[_0x7294('0xb0')]['startMethodPredictive']=function(_0x3fd62b){var _0xcc64ac=this;return function(){var _0x5e47ac=0x0;var _0x353798=Math[_0x7294('0x1e7')](_0x3fd62b[_0x7294('0x7c')]*0x3e8);if(_0x353798>0x0){_0x353798=_0x353798<0x64?0x64:_0x353798;loggerPredictive['info'](_0x3fd62b[_0x7294('0x43')],_0x7294('0x206'),_0x353798,_0x7294('0x4f'));_0x3fd62b[_0x7294('0x98')]=setInterval(function(){_0xcc64ac[_0x7294('0x98')](_0x3fd62b);loggerPredictiveCalls[_0x7294('0x87')](_0x7294('0x207'),_0x5e47ac+=0x1);},_0x353798);}else{loggerPredictive['info'](_0x3fd62b[_0x7294('0x43')],_0x7294('0x208'));}};};Dialer[_0x7294('0xb0')][_0x7294('0x209')]=function(_0x11e733,_0x35aaf1){var _0x2471c9=this;return function(_0x2a846a){if(_[_0x7294('0x4b')](_0x2a846a)){if(_['isNil'](_0x35aaf1[_0x7294('0x20a')])||!_0x35aaf1[_0x7294('0x20b')]){if(_0x11e733[_0x7294('0x62')]===_0x7294('0x8')){_0x11e733['queueStatusComplete']=_[_0x7294('0x40')](_0x11e733['queueStatusComplete'])?!![]:_0x11e733['queueStatusComplete'];var _0x2a513f=uuid['v4']();_0x2471c9[_0x7294('0x26')][_0x2a513f]=new Action(_0x11e733,_0x35aaf1,_0x2a513f);loggerBooked[_0x7294('0x87')](_0x7294('0x20c'),_0x2a513f,_0x7294('0x20d'),JSON['stringify'](_0x11e733[_0x7294('0x20e')]),_0x7294('0x20f'),_0x11e733[_0x7294('0x43')]);if(_0x11e733['queueStatusComplete']){_0x11e733[_0x7294('0x20e')]=![];_0x2471c9['queueBooked'][_0x2471c9[_0x7294('0x26')][_0x2a513f]['queue']]=[];ami[_0x7294('0xb4')]({'actionid':_0x2a513f,'action':_0x7294('0x210'),'queue':_0x11e733['name']})[_0x7294('0xb6')](function(){_0x2471c9[_0x7294('0xb7')](_0x11e733);_0x2471c9['rescheduleContact']({'active':![],'ContactId':_0x2471c9[_0x7294('0x26')][_0x2a513f][_0x7294('0xd9')],'ListId':_0x2471c9[_0x7294('0x26')][_0x2a513f][_0x7294('0x12b')],'VoiceQueueId':_0x2471c9[_0x7294('0x26')][_0x2a513f]['VoiceQueueId']||undefined,'CampaignId':_0x2471c9[_0x7294('0x26')][_0x2a513f]['CampaignId']||undefined})[_0x7294('0xb6')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x2471c9[_0x7294('0x26')][_0x2a513f];});}else{loggerBooked[_0x7294('0x87')](_0x7294('0x211'),JSON[_0x7294('0x4e')](_0x11e733[_0x7294('0x20e')]),'Queue:\x20',_0x11e733['name']);_0x2471c9['updateOriginated'](_0x11e733);_0x2471c9[_0x7294('0xc7')]({'active':![],'ContactId':_0x2471c9[_0x7294('0x26')][_0x2a513f]['ContactId'],'ListId':_0x2471c9[_0x7294('0x26')][_0x2a513f][_0x7294('0x12b')],'VoiceQueueId':_0x2471c9['actions'][_0x2a513f]['VoiceQueueId']||undefined,'CampaignId':_0x2471c9[_0x7294('0x26')][_0x2a513f][_0x7294('0xdb')]||undefined})[_0x7294('0xb6')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x2471c9[_0x7294('0x26')][_0x2a513f];}}else{return _0x2471c9[_0x7294('0x180')](_0x11e733,_0x35aaf1);}}else{if(getDiff(_0x35aaf1[_0x7294('0x212')])<_0x11e733[_0x7294('0x213')]*0x3c){if(_0x35aaf1[_0x7294('0x16e')]&&!_0x35aaf1[_0x7294('0x16e')][_0x7294('0x214')]){_0x2471c9[_0x7294('0x1f')][_0x7294('0x139')](_0x35aaf1['id'])[_0x7294('0x1d')](function(){_0x2471c9[_0x7294('0xb7')](_0x11e733);});}else{_0x2471c9[_0x7294('0xc9')]({'active':![]},_0x35aaf1['id'],0x1)['finally'](function(){_0x2471c9[_0x7294('0xb7')](_0x11e733);});}}else{_0x11e733['outboundReCallsDay']+=0x1;_0x2471c9[_0x7294('0xb7')](_0x11e733);if(_0x11e733['dialRecallInQueue']){_0x2471c9['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x35aaf1[_0x7294('0xd9')],'ListId':_0x35aaf1['ListId'],'VoiceQueueId':_0x35aaf1['VoiceQueueId']||undefined,'CampaignId':_0x35aaf1['CampaignId']||undefined})['catch'](loggerCatch(_0x7294('0x215')));_0x2471c9[_0x7294('0xd2')](createObjHistory(_0x11e733,_0x35aaf1,'RECALLINQUEUE',0x17,_0x7294('0x216')))[_0x7294('0xb6')](loggerCatch(_0x7294('0x217')));}else{_0x2471c9['saveInDb'](createObjHistory(_0x11e733,_0x35aaf1,_0x7294('0x218'),0x16,'RecallFailedTimeout'),_0x7294('0x219'),_0x7294('0x21a'));}}}}else{_0x11e733[_0x7294('0x67')]+=0x1;_0x2471c9[_0x7294('0xd7')](createObjHistory(_0x11e733,_0x35aaf1,'BLACKLIST',0xd,_0x7294('0x21b')),_0x7294('0x21c'),_0x7294('0x21d'));throw _0x7294('0x21e');}};};Dialer['prototype'][_0x7294('0x172')]=function(_0x1cdb9d){var _0x54fe7c=this;var _0x542b00=_0x1cdb9d['limitCalls']-_0x1cdb9d[_0x7294('0x7b')]-_0x1cdb9d[_0x7294('0xcb')];emitCampaignSummary(_0x1cdb9d);if(_0x542b00>0x0){if(_0x542b00>this[_0x7294('0x24')]){_0x542b00=this['maxNumberOriginate'];}_0x1cdb9d[_0x7294('0xcb')]+=_0x542b00;this[_0x7294('0xcd')](_0x1cdb9d['id'],_0x542b00,_0x1cdb9d[_0x7294('0x21f')],_0x1cdb9d)[_0x7294('0x3f')](function(_0x2c6214){_0x1cdb9d[_0x7294('0xcb')]-=_0x542b00;_0x1cdb9d[_0x7294('0xcb')]=_0x1cdb9d[_0x7294('0xcb')]>0x0?_0x1cdb9d['temp']:0x0;if(!checkContactEmpty(_0x2c6214)){_0x1cdb9d['message']='AVAILABLE_CONTACTS_FINISHED';logger[_0x7294('0x87')]('[getContactCampaign2][Empty]'+_0x1cdb9d[_0x7294('0x43')]);}else{_0x1cdb9d[_0x7294('0x7b')]+=_0x2c6214[_0x7294('0xa0')];_0x1cdb9d[_0x7294('0x41')]='RUNNING';for(var _0x346b1e=0x0;_0x346b1e<_0x2c6214[_0x7294('0xa0')];_0x346b1e+=0x1){_0x1cdb9d['ivrTotalCallsDays']+=0x1;if(_['isNil'](_0x2c6214[_0x346b1e])||_[_0x7294('0xe3')](_0x2c6214[_0x346b1e][_0x7294('0x19a')])||_[_0x7294('0xe3')](_0x2c6214[_0x346b1e][_0x7294('0x1a9')])){_0x54fe7c[_0x7294('0xd5')](_0x7294('0x220'),_0x1cdb9d,_0x2c6214[_0x346b1e]);}else{_0x54fe7c[_0x7294('0xc4')](_[_0x7294('0xd8')](_0x2c6214[_0x346b1e],[_0x7294('0xdb'),'phone']))['then'](_0x54fe7c[_0x7294('0x209')](_0x1cdb9d,_0x2c6214[_0x346b1e]))[_0x7294('0xb6')](_0x54fe7c[_0x7294('0x221')](_0x7294('0x222'),_0x1cdb9d));}}}})['catch'](loggerGetContactDialer(_0x7294('0x223'),_0x1cdb9d,_0x542b00));}};Dialer['prototype']['handlePower']=function(_0x5a97a0,_0x21fac0){var _0x29baf2=this;var _0x277b0e=[];var _0x2e7e6e=_0x21fac0>=0x1?_0x21fac0:0x1;if(_0x5a97a0[_0x7294('0x62')]===_0x7294('0x8')){_0x2e7e6e=0x1;}var _0x5e753c=Math[_0x7294('0x1e7')](_0x5a97a0[_0x7294('0x56')]*_0x2e7e6e)-_0x5a97a0[_0x7294('0x7b')]-_0x5a97a0[_0x7294('0xcb')];emitVoiceQueueSummary(_0x5a97a0);if(_0x5a97a0[_0x7294('0x224')]>0x0){var _0x55b55b=_0x5a97a0['dialLimitQueue']-_0x5a97a0['originated']-_0x5a97a0[_0x7294('0x5c')]-_0x5a97a0[_0x7294('0xcb')]-_0x5a97a0[_0x7294('0x58')];if(_0x5e753c>_0x55b55b){_0x5e753c=_0x55b55b;}}if(_0x5e753c>0x0){if(_0x5a97a0[_0x7294('0x62')]===_0x7294('0x8')){_0x5e753c=0x1;}if(_0x5e753c>this[_0x7294('0x24')]){_0x5e753c=this[_0x7294('0x24')];}_0x5a97a0[_0x7294('0xcb')]+=_0x5e753c;for(var _0x2e74af in this['agents']){if(typeof this[_0x7294('0x22')][_0x2e74af]!==_0x7294('0xb3')){if(this[_0x7294('0x22')][_0x2e74af][_0x7294('0xad')]===_0x7294('0x225')&&this[_0x7294('0x22')][_0x2e74af][_0x7294('0xb5')]==='reachable'){_0x277b0e['push'](this[_0x7294('0x22')][_0x2e74af]['id']);}}}this[_0x7294('0xca')](_0x5a97a0['id'],_0x277b0e,_0x5e753c,_0x5a97a0[_0x7294('0x21f')],_0x5a97a0)['then'](function(_0xa4801c){_0x5a97a0[_0x7294('0xcb')]-=_0x5e753c;_0x5a97a0[_0x7294('0xcb')]=_0x5a97a0['temp']>0x0?_0x5a97a0[_0x7294('0xcb')]:0x0;if(!checkContactEmpty(_0xa4801c)){_0x29baf2[_0x7294('0xbb')](_0x5a97a0)['then'](sendMessageReschedule(_0x5a97a0))[_0x7294('0xb6')](loggerCatch('[countReScheduled]\x20'));}else{_0x5a97a0[_0x7294('0x7b')]+=_0xa4801c['length'];_0x5a97a0[_0x7294('0x41')]=_0x5a97a0[_0x7294('0x62')]==='booked'?_0x7294('0x18a'):'RUNNING';for(var _0x54b8dd=0x0;_0x54b8dd<_0xa4801c[_0x7294('0xa0')];_0x54b8dd+=0x1){if(_[_0x7294('0xe3')](_0xa4801c[_0x54b8dd])||_[_0x7294('0xe3')](_0xa4801c[_0x54b8dd][_0x7294('0x19a')])||_[_0x7294('0xe3')](_0xa4801c[_0x54b8dd][_0x7294('0x1a9')])){_0x29baf2[_0x7294('0xd5')](_0x7294('0x220'),_0x5a97a0,_0xa4801c[_0x54b8dd]);}else{_0x29baf2[_0x7294('0xbd')](_[_0x7294('0xd8')](_0xa4801c[_0x54b8dd],[_0x7294('0xda'),_0x7294('0x1a9')]))[_0x7294('0x3f')](_0x29baf2['checkContactBlack'](_0x5a97a0,_0xa4801c[_0x54b8dd]))[_0x7294('0xb6')](_0x29baf2[_0x7294('0x221')](_0x7294('0x220'),_0x5a97a0));}}}})['catch'](loggerGetContactDialer('[getContactDialer2]',_0x5a97a0,_0x5e753c));}};Dialer[_0x7294('0xb0')]['handlePredictive']=function(_0x31824f){if(_0x31824f['dialLimitQueue']>0x0){var _0x3a34db=_0x31824f[_0x7294('0x224')]-_0x31824f[_0x7294('0x7b')]-_0x31824f['talking'];if(_0x3a34db>0x0){this['tryOriginatePredictive'](_0x31824f);}else{loggerPredictiveCalls[_0x7294('0x87')](_0x7294('0x226'));}}else{this['tryOriginatePredictive'](_0x31824f);}};Dialer[_0x7294('0xb0')][_0x7294('0x227')]=function(_0x113d52){var _0x28fbbb=this;var _0x117b4d=[];_0x113d52[_0x7294('0x7b')]+=0x1;for(var _0x70aa16 in this[_0x7294('0x22')]){if(typeof this[_0x7294('0x22')][_0x70aa16]!==_0x7294('0xb3')){if(this[_0x7294('0x22')][_0x70aa16][_0x7294('0xad')]===_0x7294('0x225')&&this['agents'][_0x70aa16]['status']===_0x7294('0xe1')){_0x117b4d[_0x7294('0x135')](this[_0x7294('0x22')][_0x70aa16]['id']);}}}this['getContactDialer'](_0x113d52['id'],_0x117b4d,0x1,_0x113d52[_0x7294('0x21f')],_0x113d52)[_0x7294('0x3f')](function(_0x39ca64){if(!checkContactEmpty(_0x39ca64)){checkContactLowerLimitOriginate(_0x113d52,0x1,0x0);_0x28fbbb[_0x7294('0xbb')](_0x113d52)[_0x7294('0x3f')](sendMessageReschedule(_0x113d52))[_0x7294('0xb6')](loggerCatch(_0x7294('0xbc')));}else{_0x113d52[_0x7294('0x41')]='RUNNING';if(_[_0x7294('0xe3')](_0x39ca64[0x0])||_[_0x7294('0xe3')](_0x39ca64[0x0][_0x7294('0x19a')])||_[_0x7294('0xe3')](_0x39ca64[0x0][_0x7294('0x1a9')])){_0x28fbbb[_0x7294('0xd5')](_0x7294('0x220'),_0x113d52,_0x39ca64[0x0]);}else{_0x28fbbb['checkIsBlackList'](_['pick'](_0x39ca64[0x0],[_0x7294('0xda'),'phone']))[_0x7294('0x3f')](_0x28fbbb[_0x7294('0x209')](_0x113d52,_0x39ca64[0x0]))[_0x7294('0xb6')](_0x28fbbb[_0x7294('0x221')](_0x7294('0x228'),_0x113d52));}}})[_0x7294('0xb6')](loggerGetContactDialer('[getContactDialerPredictive]',_0x113d52,0x1));emitVoiceQueueSummary(_0x113d52);};Dialer[_0x7294('0xb0')][_0x7294('0x1fe')]=function(_0x364984,_0x1f72f9,_0x5d34c9,_0x737c9,_0x2e9999,_0xdfb5d2){loggerPredictive[_0x7294('0x87')](_0x7294('0x229'));loggerPredictive[_0x7294('0x87')](_0x7294('0x22a'),_0x364984);loggerPredictive[_0x7294('0x87')](_0x7294('0x22b'),_0x1f72f9);loggerPredictive[_0x7294('0x87')]('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',_0x5d34c9);loggerPredictive['info'](_0x7294('0x22c'),_0x737c9);loggerPredictive['info'](_0x7294('0x22d'),_0x2e9999);loggerPredictive[_0x7294('0x87')](_0x7294('0x8d'));return new Promise(function(_0x2a718e,_0x17d593){if(_0x364984<=0x0||isNaN(_0x364984)){return _0x17d593(msgResponse(_0x7294('0x22e'),_0x7294('0x4d'),_0x7294('0x22f')+_0x364984));}if(_0x5d34c9<=0x0||isNaN(_0x5d34c9)){return _0x17d593(msgResponse(_0x7294('0x22e'),_0x7294('0x4d'),_0x7294('0x230')+_0x5d34c9));}if(_0x737c9<=0x0||isNaN(_0x737c9)){return _0x17d593(msgResponse(_0x7294('0x22e'),_0x7294('0x4d'),'p\x20=\x20'+_0x737c9));}if(_0x1f72f9<=0x0||isNaN(_0x1f72f9)){return _0x17d593(msgResponse(_0x7294('0x22e'),_0x7294('0x4d'),_0x7294('0x231')+_0x1f72f9));}if(_0x2e9999<=0x0||isNaN(_0x2e9999)){return _0x17d593(msgResponse(_0x7294('0x22e'),'Error',_0x7294('0x232')+_0x2e9999));}_0xdfb5d2=_0xdfb5d2||0x0;var _0x5a7cbf=0x1/_0x5d34c9;var _0x4ae344=0x0;var _0x28519d=0x0;var _0x2656a3=0x0;var _0x317874=0x0;for(var _0x46cd60=0x0;_0x2656a3<_0x2e9999;_0x46cd60+=0x1){_0x28519d=_0x46cd60/_0x1f72f9;_0x4ae344=(_0x737c9*_0x28519d+_0xdfb5d2)/_0x5a7cbf;_0x2656a3=erlangb(_0x4ae344,_0x364984);_0x317874=_0x4ae344/_0x364984*(0x1-erlangb(_0x4ae344,_0x364984));}return _0x2a718e({'erlangCalls':_0x46cd60,'erlangCallToSecond':_0x1f72f9/_0x46cd60,'erlangAbandonmentRate':_0x2656a3,'erlangBusyFactor':_0x317874});});};Dialer[_0x7294('0xb0')][_0x7294('0x200')]=function(_0x2b30c6,_0x1c4e44,_0x42a792,_0x422b1f,_0x1565ca,_0x4374f1){loggerPredictive['info']('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x7294('0x87')](_0x7294('0x22a'),_0x2b30c6);loggerPredictive['info'](_0x7294('0x22b'),_0x1c4e44);loggerPredictive[_0x7294('0x87')](_0x7294('0x233'),_0x42a792);loggerPredictive[_0x7294('0x87')](_0x7294('0x22c'),_0x422b1f);loggerPredictive[_0x7294('0x87')](_0x7294('0x234'),_0x1565ca);loggerPredictive[_0x7294('0x87')](_0x7294('0x8d'));return new Promise(function(_0x4bd5a8,_0x182ce7){if(_0x2b30c6<=0x0||isNaN(_0x2b30c6)){return _0x182ce7(msgResponse(_0x7294('0x235'),_0x7294('0x4d'),'m\x20=\x20'+_0x2b30c6));}if(_0x42a792<=0x0||isNaN(_0x42a792)){return _0x182ce7(msgResponse(_0x7294('0x235'),_0x7294('0x4d'),_0x7294('0x230')+_0x42a792));}if(_0x422b1f<=0x0||isNaN(_0x422b1f)){return _0x182ce7(msgResponse(_0x7294('0x235'),'Error',_0x7294('0x236')+_0x422b1f));}if(_0x1c4e44<=0x0||isNaN(_0x1c4e44)){return _0x182ce7(msgResponse('[busyFactor]',_0x7294('0x4d'),_0x7294('0x231')+_0x1c4e44));}if(_0x1565ca<=0x0||isNaN(_0x1565ca)){return _0x182ce7(msgResponse(_0x7294('0x235'),_0x7294('0x4d'),'Umin\x20=\x20'+_0x1565ca));}_0x4374f1=_0x4374f1||0x0;var _0x409850=0x1/_0x42a792;var _0x476b31=0x0;var _0x211791=0x0;var _0xe2d44f=0x0;var _0x916202=0x0;for(var _0x1cb07b=0x0;_0x916202<_0x1565ca;_0x1cb07b+=0x1){_0x211791=_0x1cb07b/_0x1c4e44;_0x476b31=(_0x422b1f*_0x211791+_0x4374f1)/_0x409850;_0xe2d44f=erlangb(_0x476b31,_0x2b30c6);_0x916202=_0x476b31/_0x2b30c6*(0x1-erlangb(_0x476b31,_0x2b30c6));}return _0x4bd5a8({'erlangCalls':_0x1cb07b,'erlangCallToSecond':_0x1c4e44/_0x1cb07b,'erlangAbandonmentRate':_0xe2d44f,'erlangBusyFactor':_0x916202});});};module['exports']=Dialer; \ No newline at end of file +var _0xf7e1=['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','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','diff','clearing\x20variable\x20start\x20predictive','handlePredictive','\x22%s\x22\x20<%s>','string','\x22\x22\x20<>','debug','inspect','error','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','contacts','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','IS_DISACTIVED','endtime','starttime','loopClearZombieChannels','clearZombieChannels','[uniqueid]','actions','[actions]','sequence','isNil','channel','catch','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','[countReScheduled]\x20','checkIsBlackList','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','updateOriginated','saveInDb','pick','ContactId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','isTrunkReachable','SIP/%s','status','reachable','syncVarSet','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','value','state','HangupInAMD','emit','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','statedesc','Machine','membername','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','ListId','[rescheduleContact][Machine]','HANGUP','[syncHangupInAMDIvr]','MACHINE','AMD','countdropretry','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','AGI','[syncHangupIvr]','reason','agent','agiafterat','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','dialQueueProject2','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','syncQueueMember','strategy','actionid','locked','paused','stateinterface','queueBooked','push','idHopper','queueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock3][syncQueueStatusComplete]','loopCampaigns','resetActiveCalls','checkIsTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','timezones','isArray','Action','command','iftime\x20%s,%s','interval','content','true','indexOf','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','handlePower','dialPowerLevel','booked','Queue','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','user:%s','launchHandleIvr','handleIvr','dialActive','dialTimezone','[syncQueueSummary]','syncQueueSummaryComplete','throttle','filter','dialPreviewRecallmeReminder','online','map','Agent','user:dialPreviewRecallReminder','syncCampaigns','dialGlobalInterval','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','object','originate','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialAgiAfterHangupAgent','dialer','ACTIVE','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','createdAt','updatedAt','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','outboundOriginateFailureCallsDay','OriginateError','[originate][error]','Error','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','[rescheduleContact][Drop]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','reason\x200\x20no\x20such\x20number....','buildNoAnswerEventPayload','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','custom:agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalAnsweredCalls','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','floor','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','actionOriginate','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','dialOrderByScheduledAt','AVAILABLE_CONTACTS_FINISHED','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','pTalking','not_inuse','RUNNING','[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','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','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]','exports','util','uuid','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','predictive','predictiveCalls','defaults','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperAdditionalPhone','../rpc/voiceQueueRt','./history','./final','./queueCallerAbandon','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','optionPredictive','startPredictive','ivrOriginated','queueBookedRR','agentconnect','syncAgentConnect','syncQueueCallerAbandon','bind','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','syncQueueSummary','custom:queuesummarycomplete','hangup','syncHangup','newexten','syncNewExten','varset','queuemember','queuestatuscomplete','syncQueueStatusComplete','getSettings','then','previewRecallmeReminderInterval','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20INTERVAL_IS_NULL','Interval','Intervals','isEmpty','INTERVAL_IS_NULL','[ifTime][Action]','stringify','milliseconds','seconds','type','outbound','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','unmanaged','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','startProgressive','Trunk','active','callerid','md5','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','info','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','isUndefined','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive'];(function(_0x1e6860,_0x3c5515){var _0x1f4789=function(_0x350596){while(--_0x350596){_0x1e6860['push'](_0x1e6860['shift']());}};_0x1f4789(++_0x3c5515);}(_0xf7e1,0x1a1));var _0x1f7e=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xf7e1[_0x46e363];return _0x3fb059;};'use strict';var util=require(_0x1f7e('0x0'));var _=require('lodash');var uuid=require(_0x1f7e('0x1'));var moment=require('moment');var rr=require('rr');var md5=require('md5');var Redis=require(_0x1f7e('0x2'));var ut=require(_0x1f7e('0x3'));var config=require(_0x1f7e('0x4'));var logger=require(_0x1f7e('0x5'))('dialer');var loggerBooked=require(_0x1f7e('0x5'))('booked');var loggerPredictive=require(_0x1f7e('0x5'))(_0x1f7e('0x6'));var loggerPredictiveCalls=require(_0x1f7e('0x5'))(_0x1f7e('0x7'));var loggerSyncQueueSummary=require(_0x1f7e('0x5'))('syncQueueSummary');var ami=require('../ami');config['redis']=_[_0x1f7e('0x8')](config[_0x1f7e('0x9')],{'host':_0x1f7e('0xa'),'port':0x18eb});var io=require(_0x1f7e('0xb'))(new Redis(config[_0x1f7e('0x9')]));var cmHopper=require(_0x1f7e('0xc'));var cmHopperHistory=require(_0x1f7e('0xd'));var cmHopperAdditionalPhone=require(_0x1f7e('0xe'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x1f7e('0xf'));var RpcSetting=require('../rpc/setting');var Action=require('./action');var History=require(_0x1f7e('0x10'));var Final=require(_0x1f7e('0x11'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0x1f7e('0x12'));var Hangup=require('./hangup');var ipAgi=process[_0x1f7e('0x13')][_0x1f7e('0x14')]||_0x1f7e('0x15');var strategy={'rrmemory':_0x1f7e('0x16'),'roundrobin':_0x1f7e('0x17')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x1f7e('0x18')][_0x1f7e('0x19')]=function(_0x23e583){this['tail']=this[_0x1f7e('0x1a')]?this[_0x1f7e('0x1a')][_0x1f7e('0x1b')](_0x23e583):_0x23e583();};function Dialer(_0x4c9ea5,_0x47014a){this['sequence']=new Sequence();this[_0x1f7e('0x1c')]=_0x47014a;this[_0x1f7e('0x1d')]=_0x4c9ea5[_0x1f7e('0x1d')];this[_0x1f7e('0x1e')]=_0x4c9ea5[_0x1f7e('0x1e')];this[_0x1f7e('0x1f')]=_0x4c9ea5['agents'];this['trunks']=_0x4c9ea5[_0x1f7e('0x20')];this[_0x1f7e('0x21')]=config[_0x1f7e('0x21')]||0x2;this[_0x1f7e('0x22')]={};this['actions']={};this[_0x1f7e('0x23')]={};this[_0x1f7e('0x24')]={};this[_0x1f7e('0x25')]={};this[_0x1f7e('0x26')]={};this['startProgressive']={};this[_0x1f7e('0x27')]={};this['queueBooked']={};this[_0x1f7e('0x28')]={};ami['on'](_0x1f7e('0x29'),this[_0x1f7e('0x2a')]['bind'](this));ami['on']('queuecallerabandon',this[_0x1f7e('0x2b')][_0x1f7e('0x2c')](this));ami['on'](_0x1f7e('0x2d'),this[_0x1f7e('0x2e')]['bind'](this));ami['on'](_0x1f7e('0x2f'),this[_0x1f7e('0x30')][_0x1f7e('0x2c')](this));ami['on']('custom:queuesummary',this[_0x1f7e('0x31')][_0x1f7e('0x2c')](this));ami['on'](_0x1f7e('0x32'),this['syncQueueSummaryComplete'][_0x1f7e('0x2c')](this));ami['on'](_0x1f7e('0x33'),this[_0x1f7e('0x34')][_0x1f7e('0x2c')](this));ami['on'](_0x1f7e('0x35'),this[_0x1f7e('0x36')][_0x1f7e('0x2c')](this));ami['on'](_0x1f7e('0x37'),this['syncVarSet']['bind'](this));ami['on'](_0x1f7e('0x38'),this['syncQueueMember'][_0x1f7e('0x2c')](this));ami['on'](_0x1f7e('0x39'),this[_0x1f7e('0x3a')][_0x1f7e('0x2c')](this));this['loopCampaigns']();this['loopClearZombieChannels']();RpcSetting[_0x1f7e('0x3b')]()[_0x1f7e('0x3c')](function(_0x2c09c3){previewRecallmeReminderInterval=_0x2c09c3[_0x1f7e('0x3d')];});}function isNotNull(_0x9d3e09){return _0x9d3e09!==null&&!_['isUndefined'](_0x9d3e09);}function checkIsLoggedIn(_0x453b8d,_0x318aba){return function(){if(_0x318aba<=0x0){_0x453b8d[_0x1f7e('0x3e')]='AGENTS_NOT_LOGGED';throw _0x453b8d[_0x1f7e('0x3f')]+_0x1f7e('0x40');}};}function isActive(_0x6b2d31){return _0x6b2d31;}function checkIsActive(_0x182ecc,_0x96ab59){return function(){if(!isActive(_0x96ab59)){_0x182ecc[_0x1f7e('0x3e')]=_0x1f7e('0x41');throw _0x182ecc[_0x1f7e('0x3f')]+'\x20NOT\x20Active';}};}function checkInterval(_0x54a9c3){return function(){if(!isNotNull(_0x54a9c3['Interval'])){_0x54a9c3[_0x1f7e('0x3e')]='INTERVAL_IS_NULL';throw _0x54a9c3[_0x1f7e('0x3f')]+_0x1f7e('0x42');}if(!isNotNull(_0x54a9c3[_0x1f7e('0x43')][_0x1f7e('0x44')])){_0x54a9c3['message']='INTERVAL_IS_NULL';throw _0x54a9c3[_0x1f7e('0x3f')]+_0x1f7e('0x42');}if(!isNotNull(_[_0x1f7e('0x45')](_0x54a9c3[_0x1f7e('0x43')][_0x1f7e('0x44')]))){_0x54a9c3[_0x1f7e('0x3e')]=_0x1f7e('0x46');throw _0x54a9c3[_0x1f7e('0x3f')]+_0x1f7e('0x42');}};}function msgResponse(_0x808792,_0x4613c6,_0x4a7e05){return{'action':_0x808792,'response':_0x4613c6,'message':_0x4a7e05,'stack':_0x4a7e05};}function myreject(_0x44bbcc){return function(_0x194c5c){return _0x44bbcc(msgResponse(_0x1f7e('0x47'),'Error',JSON[_0x1f7e('0x48')](_0x194c5c)));};}function getSeconds(_0x5b3343,_0x2a1c78){var _0x256300=moment(_0x5b3343)['milliseconds'](0x0);var _0x2cc4ec=moment(_0x2a1c78)[_0x1f7e('0x49')](0x0);return _0x256300['diff'](_0x2cc4ec,_0x1f7e('0x4a'));}function emit(_0x4a98ac,_0x4e16c7,_0x1c217c){io['to'](_0x4a98ac)['emit'](_0x4e16c7,_0x1c217c);}function emitVoiceQueueSummary(_0x84d671){if(_0x84d671[_0x1f7e('0x4b')]===_0x1f7e('0x4c')){var _0x11a0a3={'id':_0x84d671['id'],'name':_0x84d671[_0x1f7e('0x3f')],'strategy':_0x84d671['strategy'],'answered':_0x84d671[_0x1f7e('0x4d')],'available':_0x84d671[_0x1f7e('0x4e')],'loggedIn':_0x84d671[_0x1f7e('0x4f')],'pTalking':_0x84d671['pTalking'],'sumBillable':_0x84d671[_0x1f7e('0x50')],'sumDuration':_0x84d671[_0x1f7e('0x51')],'sumHoldTime':_0x84d671[_0x1f7e('0x52')]||0x0,'talking':_0x84d671[_0x1f7e('0x53')],'total':_0x84d671['total'],'type':_0x84d671[_0x1f7e('0x4b')],'unmanaged':_0x84d671[_0x1f7e('0x54')],'abandoned':_0x84d671[_0x1f7e('0x55')],'waiting':_0x84d671[_0x1f7e('0x56')],'loggedInDb':_0x84d671[_0x1f7e('0x57')],'dialActive':_0x84d671['dialActive'],'dialMethod':_0x84d671[_0x1f7e('0x58')],'dialOriginateCallerIdName':_0x84d671[_0x1f7e('0x59')],'dialOriginateCallerIdNumber':_0x84d671[_0x1f7e('0x5a')],'dialOriginateTimeout':_0x84d671[_0x1f7e('0x5b')],'dialPrefix':_0x84d671[_0x1f7e('0x5c')],'outboundAnswerAgiCallsDay':_0x84d671[_0x1f7e('0x5d')],'outboundAnswerCallsDay':_0x84d671[_0x1f7e('0x5e')],'outboundBlacklistCallsDay':_0x84d671['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x84d671[_0x1f7e('0x5f')],'outboundCongestionCallsDay':_0x84d671[_0x1f7e('0x60')],'outboundDropCallsDayACS':_0x84d671[_0x1f7e('0x61')],'outboundDropCallsDayCallersExit':_0x84d671[_0x1f7e('0x62')],'outboundDropCallsDayTimeout':_0x84d671[_0x1f7e('0x63')],'outboundNoAnswerCallsDay':_0x84d671[_0x1f7e('0x64')],'outboundNoSuchCallsDay':_0x84d671['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x84d671['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x84d671[_0x1f7e('0x65')],'outboundRejectCallsDay':_0x84d671[_0x1f7e('0x66')],'outboundUnknownCallsDay':_0x84d671[_0x1f7e('0x67')],'predictiveIntervalAnsweredCalls':_0x84d671['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x84d671[_0x1f7e('0x68')],'predictiveIntervalAvgTalktime':_0x84d671[_0x1f7e('0x69')],'predictiveIntervalDroppedCallsCallersExit':_0x84d671[_0x1f7e('0x6a')],'predictiveIntervalDroppedCallsTimeout':_0x84d671['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x84d671['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x84d671['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x84d671[_0x1f7e('0x6b')],'predictiveIntervalMultiplicativeFactor':_0x84d671['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x84d671[_0x1f7e('0x6c')],'predictiveIntervalAvailable':_0x84d671[_0x1f7e('0x6d')],'predictiveIntervalTotalCalls':_0x84d671[_0x1f7e('0x6e')],'message':_0x84d671[_0x1f7e('0x3e')],'originated':_0x84d671[_0x1f7e('0x6f')],'erlangCalls':_0x84d671[_0x1f7e('0x70')],'erlangCallToSecond':_0x84d671[_0x1f7e('0x71')],'erlangAbandonmentRate':_0x84d671['erlangAbandonmentRate'],'erlangBusyFactor':_0x84d671['erlangBusyFactor'],'startPredictive':_0x84d671[_0x1f7e('0x26')],'startProgressive':_0x84d671[_0x1f7e('0x72')]};if(_0x84d671[_0x1f7e('0x73')]){_0x11a0a3[_0x1f7e('0x73')]={'id':_0x84d671['Trunk']['id'],'name':_0x84d671[_0x1f7e('0x73')][_0x1f7e('0x3f')],'active':_0x84d671['Trunk'][_0x1f7e('0x74')],'callerid':_0x84d671[_0x1f7e('0x73')][_0x1f7e('0x75')]};}if(_0x84d671[_0x1f7e('0x43')]){_0x11a0a3[_0x1f7e('0x43')]={'id':_0x84d671[_0x1f7e('0x43')]['id'],'name':_0x84d671[_0x1f7e('0x43')][_0x1f7e('0x3f')]};}var _0x31f472=md5(JSON['stringify'](_0x11a0a3));if(_0x84d671['md5']!==_0x31f472){_0x84d671[_0x1f7e('0x76')]=_0x31f472;emit(util[_0x1f7e('0x77')](_0x1f7e('0x78'),_0x11a0a3['name']),_0x1f7e('0x79'),_0x11a0a3);}}}function emitCampaignSummary(_0x515a1c){if(_0x515a1c['type']===_0x1f7e('0x7a')){emit(util[_0x1f7e('0x77')](_0x1f7e('0x7b'),_0x515a1c[_0x1f7e('0x3f')]),'campaign:save',_0x515a1c);}}function checkGetDataPredictive(_0x5031fc){if(isNotNull(_0x5031fc)&&!_[_0x1f7e('0x45')](_0x5031fc)){loggerPredictive[_0x1f7e('0x7c')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive['info']('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5031fc['predictiveIntervalTotalCalls']);loggerPredictive[_0x1f7e('0x7c')](_0x1f7e('0x7d'),_0x5031fc['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x1f7e('0x7c')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5031fc[_0x1f7e('0x7e')]);loggerPredictive[_0x1f7e('0x7c')](_0x1f7e('0x7f'),_0x5031fc[_0x1f7e('0x6a')]);loggerPredictive[_0x1f7e('0x7c')](_0x1f7e('0x80'),_0x5031fc[_0x1f7e('0x68')]);loggerPredictive[_0x1f7e('0x7c')](_0x1f7e('0x81'),_0x5031fc[_0x1f7e('0x69')]);loggerPredictive[_0x1f7e('0x7c')](_0x1f7e('0x82'));if(_0x5031fc[_0x1f7e('0x6e')]>0x0){if(!_[_0x1f7e('0x83')](_0x5031fc[_0x1f7e('0x69')])&&_0x5031fc[_0x1f7e('0x69')]>0x0){return!![];}loggerPredictive[_0x1f7e('0x7c')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x1f7e('0x83')](_0x5031fc[_0x1f7e('0x68')])&&_0x5031fc[_0x1f7e('0x68')]>0x0){return!![];}loggerPredictive[_0x1f7e('0x7c')](_0x1f7e('0x84'));}else{loggerPredictive[_0x1f7e('0x7c')](_0x1f7e('0x85'));}}else{loggerPredictive['info'](_0x1f7e('0x86'));}return![];}function mergeDataErlangB(_0x173ced){return function(_0x5f06c0){loggerPredictive[_0x1f7e('0x7c')](_0x1f7e('0x87'));loggerPredictive[_0x1f7e('0x7c')](_0x1f7e('0x88'),_0x5f06c0[_0x1f7e('0x70')]);loggerPredictive[_0x1f7e('0x7c')](_0x1f7e('0x89'),_0x5f06c0[_0x1f7e('0x71')]);loggerPredictive['info'](_0x1f7e('0x8a'),_0x5f06c0[_0x1f7e('0x8b')]);loggerPredictive[_0x1f7e('0x7c')](_0x1f7e('0x8c'),_0x5f06c0[_0x1f7e('0x8d')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5f06c0['erlangAbandonmentRate']);loggerPredictive['info'](_0x1f7e('0x82'));_[_0x1f7e('0x8e')](_0x173ced,_0x5f06c0);};}function getDiff(_0x1bfbc3){var _0x31b57e=moment()[_0x1f7e('0x49')](0x0);var _0x13c008=moment(_0x1bfbc3)[_0x1f7e('0x49')](0x0);return _0x31b57e[_0x1f7e('0x8f')](_0x13c008,_0x1f7e('0x4a'));}function ifInterval(_0x5ac568,_0x95d1f1){if(_[_0x1f7e('0x83')](_0x95d1f1)){return![];}return getDiff(_0x95d1f1)<_0x5ac568*0x3c;}function freeVariablesPredictive(_0x5f4494){if(isNotNull(_0x5f4494)){if(!_[_0x1f7e('0x83')](_0x5f4494[_0x1f7e('0x72')])){_0x5f4494[_0x1f7e('0x72')]=undefined;loggerPredictive[_0x1f7e('0x7c')](_0x5f4494[_0x1f7e('0x3f')],'clearing\x20variable\x20start\x20progressive');}if(!_['isUndefined'](_0x5f4494[_0x1f7e('0x26')])){_0x5f4494[_0x1f7e('0x26')]=undefined;loggerPredictive[_0x1f7e('0x7c')](_0x5f4494['name'],_0x1f7e('0x90'));}if(!_['isUndefined'](_0x5f4494[_0x1f7e('0x91')])){clearInterval(_0x5f4494[_0x1f7e('0x91')]);_0x5f4494[_0x1f7e('0x91')]=undefined;loggerPredictive[_0x1f7e('0x7c')](_0x5f4494['name'],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x42a8cf,_0x11ece9){if(_0x11ece9===0x0){return 0x0;}var _0x26bb82=0x1;for(var _0x3ec79f=0x1;_0x3ec79f<=_0x11ece9;_0x3ec79f+=0x1){_0x26bb82=0x1+_0x26bb82*_0x3ec79f/_0x42a8cf;}return 0x1/_0x26bb82;}function isVoiceQueueOutbound(_0x259e47){return _0x259e47===_0x1f7e('0x4c');}function isNotPreview(_0x3eccb6){return _0x3eccb6!==_0x1f7e('0x1c');}function isCampaignIvr(_0x3661be){return _0x3661be==='ivr';}function getCallerId(_0x453a65,_0x14383e,_0x498364){if(!_[_0x1f7e('0x83')](_0x498364)&&typeof _0x498364==='string'&&!_[_0x1f7e('0x45')](_0x498364)){if(!_[_0x1f7e('0x83')](_0x14383e)&&typeof _0x14383e==='string'&&!_[_0x1f7e('0x45')](_0x14383e)){return util[_0x1f7e('0x77')](_0x1f7e('0x92'),_0x14383e,_0x498364);}return util[_0x1f7e('0x77')](_0x1f7e('0x92'),_0x498364,_0x498364);}if(!_[_0x1f7e('0x83')](_0x453a65)&&typeof _0x453a65===_0x1f7e('0x93')&&!_['isEmpty'](_0x453a65)){return _0x453a65;}return _0x1f7e('0x94');}function loggerCatchQueueSummary(_0xcaba20,_0x14807f){return function(_0x3e0e2f){freeVariablesPredictive(_0x14807f);emitVoiceQueueSummary(_0x14807f);emitCampaignSummary(_0x14807f);loggerSyncQueueSummary[_0x1f7e('0x95')](_0xcaba20,util[_0x1f7e('0x96')](_0x3e0e2f,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x3059a3,_0x3a5793){return function(_0x451932){loggerPredictive[_0x1f7e('0x97')](_0x3a5793[_0x1f7e('0x3f')],_0x3059a3);loggerPredictive['error'](_0x451932[_0x1f7e('0x98')]);freeVariablesPredictive(_0x3a5793);};}function loggerCatch(_0x2bbea0){return function(_0x1390fb){logger['error'](_0x2bbea0,util['inspect'](_0x1390fb,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x2bce25){return _0x2bce25&&!_[_0x1f7e('0x83')](_0x2bce25)&&_0x2bce25[_0x1f7e('0x99')]>0x0;}function decremetOriginate(_0x336ba5){if(!_[_0x1f7e('0x83')](_0x336ba5)&&_0x336ba5!==null){if(typeof _0x336ba5[_0x1f7e('0x6f')]!==_0x1f7e('0x9a')){if(_0x336ba5[_0x1f7e('0x6f')]>0x0){_0x336ba5[_0x1f7e('0x6f')]-=0x1;}else{logger['error'](_0x1f7e('0x9b'));}}}else{logger[_0x1f7e('0x97')](_0x1f7e('0x9c'));}}function checkContactLowerLimitOriginate(_0x296694,_0x3f46cf,_0x51596a){if(_0x3f46cf>_0x51596a){for(var _0x5cf7b6=0x0;_0x5cf7b6<_0x3f46cf-_0x51596a;_0x5cf7b6+=0x1){decremetOriginate(_0x296694);}}}function loggerGetContactDialer(_0x3a2941,_0x178d05,_0x180908){return function(_0x34ff0d){checkContactLowerLimitOriginate(_0x178d05,_0x180908,0x0);logger[_0x1f7e('0x97')](_0x3a2941,util[_0x1f7e('0x96')](_0x34ff0d,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x47f5f0){return function(_0x52de38){if(isNotNull(_0x52de38)&&isNotNull(_0x52de38[0x0])){if(_0x52de38[0x0]['contactsRescheduled']>0x0){_0x47f5f0['message']='RESCHEDULED_CONTACTS';logger[_0x1f7e('0x7c')]('[getContactDialer2][ReScheduled]'+_0x47f5f0[_0x1f7e('0x3f')],_0x52de38[0x0][_0x1f7e('0x9d')],_0x1f7e('0x9e'));}else{_0x47f5f0[_0x1f7e('0x3e')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x1f7e('0x7c')](_0x1f7e('0x9f')+_0x47f5f0[_0x1f7e('0x3f')]);}}};}function notSendMessagesQueue(_0x4bc452){if(_0x4bc452['sendMessageOneNotActive']){freeVariablesPredictive(_0x4bc452);if(_0x4bc452[_0x1f7e('0x6f')]===0x0&&_0x4bc452[_0x1f7e('0x53')]===0x0&&_0x4bc452[_0x1f7e('0x56')]===0x0&&(_0x4bc452['pTalking']||0x0)===0x0){_0x4bc452[_0x1f7e('0xa0')]=![];_0x4bc452['available']=0x0;_0x4bc452[_0x1f7e('0x3e')]=_0x1f7e('0x41');loggerSyncQueueSummary[_0x1f7e('0x95')](_0x1f7e('0xa1'),_0x4bc452['name'],_0x1f7e('0xa2'));}else{_0x4bc452[_0x1f7e('0x3e')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x1f7e('0x95')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x4bc452[_0x1f7e('0x3f')],_0x1f7e('0xa3'));}emitVoiceQueueSummary(_0x4bc452);}}function notSendMessagesCampaign(_0x6cb4e0){if(_0x6cb4e0[_0x1f7e('0xa0')]){if(_0x6cb4e0[_0x1f7e('0x6f')]===0x0){_0x6cb4e0[_0x1f7e('0xa0')]=![];_0x6cb4e0['message']='NOT_ACTIVE';loggerSyncQueueSummary[_0x1f7e('0x95')](_0x1f7e('0xa4'),_0x6cb4e0[_0x1f7e('0x3f')],_0x1f7e('0xa2'));}else{_0x6cb4e0[_0x1f7e('0x3e')]=_0x1f7e('0xa5');loggerSyncQueueSummary[_0x1f7e('0x95')](_0x1f7e('0xa4'),_0x6cb4e0['name'],_0x1f7e('0xa3'));}emitCampaignSummary(_0x6cb4e0);}}function createObjHistory(_0x56c041,_0x562639,_0x2bcb77,_0x18ef38,_0x4c5d47){_0x56c041['message']=_0x2bcb77;var _0x3c4454=new Action(_0x56c041,_0x562639);var _0x431ec7=new History(_0x3c4454);_0x431ec7['state']=_0x18ef38;_0x431ec7['statedesc']=_0x4c5d47;_0x431ec7[_0x1f7e('0xa6')]=_0x3c4454[_0x1f7e('0xa7')];return _0x431ec7;}Dialer[_0x1f7e('0x18')][_0x1f7e('0xa8')]=function(){var _0x1e2bfd=this;setInterval(function(){_0x1e2bfd[_0x1f7e('0xa9')](_0x1e2bfd[_0x1f7e('0x24')],_0x1f7e('0xaa'));_0x1e2bfd['clearZombieChannels'](_0x1e2bfd[_0x1f7e('0xab')],_0x1f7e('0xac'));},0x32c8);};Dialer[_0x1f7e('0x18')][_0x1f7e('0xa9')]=function(_0x9d6aa6,_0x1d606b){var _0x2fb8f6=this;for(var _0x568be4 in _0x9d6aa6){if(typeof _0x9d6aa6[_0x568be4]!=='undefined'){this[_0x1f7e('0xad')][_0x1f7e('0x19')](function(){if(!_[_0x1f7e('0xae')](_0x9d6aa6[_0x568be4])){return ami['Action']({'action':'status','channel':_0x9d6aa6[_0x568be4][_0x1f7e('0xaf')]})[_0x1f7e('0xb0')](function(_0x3fe983){if(_0x3fe983[_0x1f7e('0x3e')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x9d6aa6[_0x568be4]&&_0x9d6aa6[_0x568be4][_0x1f7e('0x4b')]!==_0x1f7e('0x7a')){_0x2fb8f6['updateOriginated'](_0x2fb8f6[_0x1f7e('0x1d')][_0x9d6aa6[_0x568be4][_0x1f7e('0xb1')]]);logger[_0x1f7e('0x97')](_0x1f7e('0xb2'),_0x1d606b,_0x568be4,_0x9d6aa6[_0x568be4][_0x1f7e('0xb1')]);delete _0x9d6aa6[_0x568be4];}if(_0x9d6aa6[_0x568be4]&&_0x9d6aa6[_0x568be4][_0x1f7e('0x4b')]===_0x1f7e('0x7a')){_0x2fb8f6['updateOriginated'](_0x2fb8f6[_0x1f7e('0x1e')][_0x9d6aa6[_0x568be4][_0x1f7e('0xb1')]]);logger[_0x1f7e('0x97')](_0x1f7e('0xb3'),_0x1d606b,_0x568be4,_0x9d6aa6[_0x568be4][_0x1f7e('0xb1')]);delete _0x9d6aa6[_0x568be4];}},0x2328);}});}});}}};Dialer[_0x1f7e('0x18')][_0x1f7e('0xb4')]=function(_0x4b4511){return Promise[_0x1f7e('0xb5')]()[_0x1f7e('0x3c')](cmHopper[_0x1f7e('0xb4')](_0x4b4511))[_0x1f7e('0xb0')](loggerCatch(_0x1f7e('0xb6')));};Dialer[_0x1f7e('0x18')][_0x1f7e('0xb7')]=function(_0x16289e){return Promise[_0x1f7e('0xb5')]()[_0x1f7e('0x3c')](cmHopperBlack['checkIsBlackList'](_0x16289e))['catch'](loggerCatch('[checkIsBlackList]\x20'));};Dialer['prototype'][_0x1f7e('0xb8')]=function(_0x130f89,_0x29d441,_0x31ddc6){return Promise[_0x1f7e('0xb5')]()[_0x1f7e('0x3c')](cmHopperAdditionalPhone[_0x1f7e('0xb8')](_0x130f89,_0x29d441,_0x31ddc6))[_0x1f7e('0xb0')](loggerCatch('[verifyAdditionalPhone]\x20'));};Dialer[_0x1f7e('0x18')][_0x1f7e('0xb9')]=function(_0x2de109,_0x4a2be1,_0x532198){return Promise[_0x1f7e('0xb5')]()['then'](cmHopperAdditionalPhone['swapAdditionalPhones'](_0x2de109,_0x4a2be1,_0x532198))[_0x1f7e('0xb0')](loggerCatch(_0x1f7e('0xba')));};Dialer['prototype']['checkIsBlackListIvr']=function(_0x993e9b){return Promise['resolve']()[_0x1f7e('0x3c')](cmHopperBlack[_0x1f7e('0xbb')](_0x993e9b))[_0x1f7e('0xb0')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0x1f7e('0x18')][_0x1f7e('0xbc')]=function(_0x2758c2){return Promise['resolve']()[_0x1f7e('0x3c')](cmHopperHistory[_0x1f7e('0xbd')](_0x2758c2))[_0x1f7e('0xb0')](loggerCatch(_0x1f7e('0xbe')));};Dialer[_0x1f7e('0x18')][_0x1f7e('0xbf')]=function(_0xcc8f8a){return Promise[_0x1f7e('0xb5')]()[_0x1f7e('0x3c')](cmHopper[_0x1f7e('0xbf')](_0xcc8f8a))[_0x1f7e('0xb0')](loggerCatch(_0x1f7e('0xc0')));};Dialer[_0x1f7e('0x18')][_0x1f7e('0xc1')]=function(_0x5ab87a,_0x530020,_0x4044d9){return Promise['resolve']()[_0x1f7e('0x3c')](cmHopper['unlockContact'](_0x5ab87a,_0x530020,_0x4044d9))['catch'](loggerCatch('[unlockContact]\x20'));};Dialer[_0x1f7e('0x18')][_0x1f7e('0xc2')]=function(_0x314159,_0xdd6fc6,_0x1e30d6,_0x1e5c0f,_0x498928){return Promise[_0x1f7e('0xb5')]()[_0x1f7e('0x3c')](cmHopper[_0x1f7e('0xc2')](_0x314159,_0xdd6fc6,_0x1e30d6,_0x1e5c0f))[_0x1f7e('0xb0')](function(_0x5d686b){_0x498928['temp']-=_0x1e30d6;_0x498928[_0x1f7e('0xc3')]=_0x498928[_0x1f7e('0xc3')]>0x0?_0x498928['temp']:0x0;loggerCatch(_0x1f7e('0xc4'))(_0x5d686b);});};Dialer[_0x1f7e('0x18')][_0x1f7e('0xc5')]=function(_0x153fb1,_0xece0b4,_0x3fc510,_0x50b9cb){return Promise[_0x1f7e('0xb5')]()[_0x1f7e('0x3c')](cmHopper['getContactDialerIvr'](_0x153fb1,_0xece0b4,_0x3fc510))[_0x1f7e('0xb0')](function(_0x4664e0){_0x50b9cb['temp']-=_0xece0b4;_0x50b9cb[_0x1f7e('0xc3')]=_0x50b9cb[_0x1f7e('0xc3')]>0x0?_0x50b9cb['temp']:0x0;loggerCatch('[getContactDialerIvr]\x20')(_0x4664e0);});};Dialer['prototype'][_0x1f7e('0xc6')]=function(_0x1b426f){return Promise[_0x1f7e('0xb5')]()[_0x1f7e('0x3c')](voiceQueueRt[_0x1f7e('0xc6')](_0x1b426f))['catch'](loggerCatch(_0x1f7e('0xc7')));};Dialer[_0x1f7e('0x18')]['moveContactManagedDialer']=function(_0x315415){return Promise[_0x1f7e('0xb5')]()[_0x1f7e('0x3c')](cmHopper[_0x1f7e('0xc8')](_0x315415))[_0x1f7e('0xb0')](loggerCatch(_0x1f7e('0xc9')));};Dialer[_0x1f7e('0x18')][_0x1f7e('0xca')]=function(_0x42582d){return Promise[_0x1f7e('0xb5')]()[_0x1f7e('0x3c')](cmHopperHistory[_0x1f7e('0xca')](_0x42582d))[_0x1f7e('0xb0')](loggerCatch(_0x1f7e('0xcb')));};Dialer[_0x1f7e('0x18')]['updateOriginated']=function(_0x1ac647){if(!_['isUndefined'](_0x1ac647)&&_0x1ac647!==null){if(typeof _0x1ac647[_0x1f7e('0x6f')]!==_0x1f7e('0x9a')){if(_0x1ac647['originated']>0x0){_0x1ac647['originated']-=0x1;}else{logger[_0x1f7e('0x97')](_0x1f7e('0xcc'));}}}else{logger[_0x1f7e('0x97')](_0x1f7e('0xcd'));}};Dialer['prototype'][_0x1f7e('0xce')]=function(_0x1da5f2,_0xe6c3b1){var _0x451855=this;return function(_0x404606){_0x451855[_0x1f7e('0xcf')](_0xe6c3b1);logger[_0x1f7e('0x97')](_0x1da5f2,util[_0x1f7e('0x96')](_0x404606,{'showHidden':![],'depth':null}));};};Dialer[_0x1f7e('0x18')]['emptyContact']=function(_0x240b3f,_0x51142a,_0x40c89f){var _0xb1a3a5={'state':0x19,'statedesc':'notFound'};this[_0x1f7e('0xcf')](_0x51142a);this[_0x1f7e('0xd0')](_[_0x1f7e('0x8e')](_0xb1a3a5,_[_0x1f7e('0xd1')](_0x40c89f,[_0x1f7e('0xd2'),'ListId',_0x1f7e('0xd3'),_0x1f7e('0xd4'),_0x1f7e('0xd5')])),_0x1f7e('0xd6'),_0x1f7e('0xd7'));logger['error'](_0x240b3f);};Dialer[_0x1f7e('0x18')][_0x1f7e('0xd8')]=function(_0x4d2bd7){return _0x4d2bd7==='Success';};Dialer[_0x1f7e('0x18')][_0x1f7e('0xd9')]=function(_0x439bc7){return!_['isUndefined'](_0x439bc7)&&_0x439bc7&&!_[_0x1f7e('0x83')](_0x439bc7['name'])&&!_[_0x1f7e('0x83')](_0x439bc7[_0x1f7e('0x74')])&&_0x439bc7[_0x1f7e('0x74')]&&(this[_0x1f7e('0x20')][util[_0x1f7e('0x77')](_0x1f7e('0xda'),_0x439bc7['name'])][_0x1f7e('0xdb')]===_0x1f7e('0xdc')||this[_0x1f7e('0x20')][util[_0x1f7e('0x77')](_0x1f7e('0xda'),_0x439bc7['name'])][_0x1f7e('0xdb')]==='unmonitored');};Dialer[_0x1f7e('0x18')][_0x1f7e('0xd0')]=function(_0x53e96a,_0x4c4456,_0x2f56af){this['createHistory'](_0x53e96a)[_0x1f7e('0xb0')](loggerCatch(_0x4c4456));this[_0x1f7e('0xc8')](_0x53e96a)['catch'](loggerCatch(_0x2f56af));};Dialer[_0x1f7e('0x18')][_0x1f7e('0xdd')]=function(_0x55390a){var _0x5a4a6f=this;var _0x4f107e=this['uniqueId'][_0x55390a[_0x1f7e('0xde')]];var _0x42b167;if(!_['isNil'](_0x55390a)&&!_[_0x1f7e('0xae')](_0x55390a['variable'])&&!_[_0x1f7e('0xae')](_0x55390a[_0x1f7e('0xdf')][_0x1f7e('0xe0')])&&_0x55390a[_0x1f7e('0xe1')]===_0x1f7e('0xe2')&&_0x4f107e){if(_0x4f107e['type']!=='ivr'&&this[_0x1f7e('0x1d')][_0x4f107e[_0x1f7e('0xb1')]]['dialAMDActive']&&_0x55390a[_0x1f7e('0xe3')]==='HANGUP'){delete this[_0x1f7e('0x24')][_0x55390a[_0x1f7e('0xde')]];this['updateOriginated'](this[_0x1f7e('0x1d')][_0x4f107e['queue']]);this[_0x1f7e('0x1d')][_0x4f107e[_0x1f7e('0xb1')]][_0x1f7e('0x5e')]+=0x1;this[_0x1f7e('0x1d')][_0x4f107e[_0x1f7e('0xb1')]]['outboundAnswerAgiCallsDay']+=0x1;_0x42b167=new Hangup(_0x4f107e,_0x55390a);_0x42b167[_0x1f7e('0xe4')]=0x12;_0x42b167['statedesc']=_0x1f7e('0xe5');_0x42b167['membername']='AMD';ami[_0x1f7e('0xe6')](_0x1f7e('0xe7'),ut[_0x1f7e('0xe8')](_0x42b167,_0x1f7e('0xe9')));this['saveInDb'](_0x42b167,_0x1f7e('0xea'),_0x1f7e('0xeb'));}if(_0x4f107e[_0x1f7e('0x4b')]!==_0x1f7e('0x7a')&&this['voiceQueues'][_0x4f107e[_0x1f7e('0xb1')]][_0x1f7e('0xec')]&&_0x55390a[_0x1f7e('0xe3')]==='MACHINE'){return new Promise(function(_0x559924,_0x52b3fd){delete _0x5a4a6f[_0x1f7e('0x24')][_0x55390a[_0x1f7e('0xde')]];_0x5a4a6f[_0x1f7e('0xcf')](_0x5a4a6f[_0x1f7e('0x1d')][_0x4f107e[_0x1f7e('0xb1')]]);_0x5a4a6f[_0x1f7e('0x1d')][_0x4f107e[_0x1f7e('0xb1')]][_0x1f7e('0x5e')]+=0x1;_0x5a4a6f[_0x1f7e('0x1d')][_0x4f107e[_0x1f7e('0xb1')]][_0x1f7e('0x5d')]+=0x1;var _0x112d6c=_0x5a4a6f['voiceQueues'][_0x4f107e['queue']];var _0x2e7043=new Hangup(_0x4f107e,_0x55390a);_0x2e7043[_0x1f7e('0xe4')]=0x13;_0x2e7043[_0x1f7e('0xed')]=_0x1f7e('0xee');_0x2e7043[_0x1f7e('0xef')]='AMD';_0x2e7043[_0x1f7e('0xf0')]+=0x1;_0x2e7043[_0x1f7e('0xf1')]+=0x1;_0x2e7043[_0x1f7e('0xe9')]=!![];ami[_0x1f7e('0xe6')](_0x1f7e('0xe7'),ut[_0x1f7e('0xe8')](_0x2e7043,_0x1f7e('0xe9')));_0x5a4a6f[_0x1f7e('0xca')](_0x2e7043)['catch'](loggerCatch(_0x1f7e('0xf2')));if(_0x2e7043[_0x1f7e('0xf3')]+_0x2e7043[_0x1f7e('0xf4')]+_0x2e7043[_0x1f7e('0xf5')]+_0x2e7043[_0x1f7e('0xf6')]+_0x2e7043['countdropretry']+_0x2e7043[_0x1f7e('0xf7')]+_0x2e7043['countmachineretry']+_0x2e7043[_0x1f7e('0xf8')]>=_0x112d6c[_0x1f7e('0xf9')]){_0x5a4a6f[_0x1f7e('0xfa')](_0x2e7043,_0x559924,_0x52b3fd,_0x1f7e('0xfb'));}else{if(_0x2e7043[_0x1f7e('0xf0')]>=_0x112d6c[_0x1f7e('0xfc')]){_0x5a4a6f[_0x1f7e('0xfd')](_0x2e7043,_0x559924,_0x52b3fd,_0x1f7e('0xfe'));}else{_0x5a4a6f[_0x1f7e('0xbf')]({'active':![],'countmachineretry':_0x2e7043[_0x1f7e('0xf0')],'scheduledat':moment()[_0x1f7e('0xff')](_0x112d6c[_0x1f7e('0x100')],_0x1f7e('0x101'))['format'](_0x1f7e('0x102')),'ContactId':_0x2e7043[_0x1f7e('0xd2')],'ListId':_0x2e7043[_0x1f7e('0x103')],'VoiceQueueId':_0x2e7043[_0x1f7e('0xd4')]||undefined,'CampaignId':_0x2e7043[_0x1f7e('0xd5')]||undefined})['catch'](loggerCatch(_0x1f7e('0x104')));_0x559924({'reschedule':0x1});}}});}if(_0x4f107e[_0x1f7e('0x4b')]===_0x1f7e('0x7a')&&this[_0x1f7e('0x1e')][_0x4f107e[_0x1f7e('0xb1')]][_0x1f7e('0xec')]&&_0x55390a['value']===_0x1f7e('0x105')){delete this[_0x1f7e('0x24')][_0x55390a[_0x1f7e('0xde')]];this[_0x1f7e('0xcf')](this[_0x1f7e('0x1e')][_0x4f107e[_0x1f7e('0xb1')]]);_0x42b167=new Hangup(_0x4f107e,_0x55390a);_0x42b167[_0x1f7e('0xe4')]=0x12;_0x42b167[_0x1f7e('0xed')]=_0x1f7e('0xe5');_0x42b167[_0x1f7e('0xef')]='AMD';ami[_0x1f7e('0xe6')](_0x1f7e('0xe7'),ut[_0x1f7e('0xe8')](_0x42b167,_0x1f7e('0xe9')));this[_0x1f7e('0xd0')](_0x42b167,'[syncHangupInAMDIvr][createHistory]',_0x1f7e('0x106'));}if(_0x4f107e[_0x1f7e('0x4b')]===_0x1f7e('0x7a')&&this[_0x1f7e('0x1e')][_0x4f107e[_0x1f7e('0xb1')]]['dialAMDActive']&&_0x55390a['value']===_0x1f7e('0x107')){return new Promise(function(_0x6de875,_0x1e42e4){delete _0x5a4a6f[_0x1f7e('0x24')][_0x55390a['uniqueid']];_0x5a4a6f['updateOriginated'](_0x5a4a6f[_0x1f7e('0x1e')][_0x4f107e['queue']]);_0x5a4a6f[_0x1f7e('0x1e')][_0x4f107e['queue']]['outboundAnswerCallsDay']+=0x1;_0x5a4a6f[_0x1f7e('0x1e')][_0x4f107e[_0x1f7e('0xb1')]][_0x1f7e('0x5d')]+=0x1;var _0x748486=_0x5a4a6f[_0x1f7e('0x1e')][_0x4f107e[_0x1f7e('0xb1')]];var _0x3b9756=new Hangup(_0x4f107e,_0x55390a);_0x3b9756[_0x1f7e('0xe4')]=0x13;_0x3b9756['statedesc']=_0x1f7e('0xee');_0x3b9756['membername']=_0x1f7e('0x108');_0x3b9756[_0x1f7e('0xf0')]+=0x1;_0x3b9756[_0x1f7e('0xf1')]+=0x1;_0x3b9756[_0x1f7e('0xe9')]=!![];ami[_0x1f7e('0xe6')](_0x1f7e('0xe7'),ut['buildObj'](_0x3b9756,_0x1f7e('0xe9')));_0x5a4a6f[_0x1f7e('0xca')](_0x3b9756)[_0x1f7e('0xb0')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x3b9756[_0x1f7e('0xf3')]+_0x3b9756['countcongestionretry']+_0x3b9756[_0x1f7e('0xf5')]+_0x3b9756[_0x1f7e('0xf6')]+_0x3b9756[_0x1f7e('0x109')]+_0x3b9756[_0x1f7e('0xf7')]+_0x3b9756[_0x1f7e('0xf0')]+_0x3b9756[_0x1f7e('0xf8')]>=_0x748486['dialGlobalMaxRetry']){_0x5a4a6f[_0x1f7e('0xfa')](_0x3b9756,_0x6de875,_0x1e42e4,_0x1f7e('0xfb'));}else{if(_0x3b9756[_0x1f7e('0xf0')]>=_0x748486[_0x1f7e('0xfc')]){_0x5a4a6f[_0x1f7e('0xfd')](_0x3b9756,_0x6de875,_0x1e42e4,_0x1f7e('0xfe'));}else{_0x5a4a6f[_0x1f7e('0xbf')]({'active':![],'countmachineretry':_0x3b9756[_0x1f7e('0xf0')],'scheduledat':moment()[_0x1f7e('0xff')](_0x748486['dialMachineRetryFrequency'],_0x1f7e('0x101'))['format'](_0x1f7e('0x102')),'ContactId':_0x3b9756[_0x1f7e('0xd2')],'ListId':_0x3b9756[_0x1f7e('0x103')],'VoiceQueueId':_0x3b9756[_0x1f7e('0xd4')]||undefined,'CampaignId':_0x3b9756['CampaignId']||undefined})[_0x1f7e('0xb0')](loggerCatch(_0x1f7e('0x104')));_0x6de875({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x1f7e('0x34')]=function(_0x9e5e2){var _0x25cce4=this[_0x1f7e('0x24')][_0x9e5e2['uniqueid']];var _0xe002a7;if(_0x25cce4&&_0x25cce4[_0x1f7e('0x4b')]==='ivr'){delete this[_0x1f7e('0x24')][_0x9e5e2[_0x1f7e('0xde')]];this[_0x1f7e('0xcf')](this[_0x1f7e('0x1e')][_0x25cce4[_0x1f7e('0xb1')]]);this[_0x1f7e('0x1e')][_0x25cce4[_0x1f7e('0xb1')]][_0x1f7e('0x10a')]+=0x1;_0xe002a7=new Hangup(_0x25cce4,_0x9e5e2);this[_0x1f7e('0xca')](_0xe002a7)['catch'](loggerCatch(_0x1f7e('0x10b')));this[_0x1f7e('0xc8')](_0xe002a7)[_0x1f7e('0xb0')](loggerCatch('[syncHangupIvr]'));}if(_0x25cce4&&_0x25cce4[_0x1f7e('0x4b')]!==_0x1f7e('0x7a')&&isNotNull(this['voiceQueues'][_0x25cce4[_0x1f7e('0xb1')]][_0x1f7e('0x10c')])){delete this[_0x1f7e('0x24')][_0x9e5e2['uniqueid']];this[_0x1f7e('0xcf')](this['voiceQueues'][_0x25cce4[_0x1f7e('0xb1')]]);this['voiceQueues'][_0x25cce4[_0x1f7e('0xb1')]][_0x1f7e('0x5e')]+=0x1;this[_0x1f7e('0x1d')][_0x25cce4[_0x1f7e('0xb1')]][_0x1f7e('0x5d')]+=0x1;_0xe002a7=new Hangup(_0x25cce4,_0x9e5e2);_0xe002a7[_0x1f7e('0xe4')]=0x10;_0xe002a7[_0x1f7e('0xed')]='AnswerAGI';_0xe002a7[_0x1f7e('0xef')]=_0x1f7e('0x10d');this[_0x1f7e('0xca')](_0xe002a7)['catch'](loggerCatch(_0x1f7e('0x10b')));this[_0x1f7e('0xc8')](_0xe002a7)[_0x1f7e('0xb0')](loggerCatch(_0x1f7e('0x10e')));}if(_0x25cce4&&_0x25cce4[_0x1f7e('0x4b')]!==_0x1f7e('0x7a')&&!isNotNull(this[_0x1f7e('0x1d')][_0x25cce4['queue']][_0x1f7e('0x10c')])){delete this[_0x1f7e('0x24')][_0x9e5e2[_0x1f7e('0xde')]];this[_0x1f7e('0xcf')](this['voiceQueues'][_0x25cce4[_0x1f7e('0xb1')]]);this['voiceQueues'][_0x25cce4[_0x1f7e('0xb1')]][_0x1f7e('0x67')]+=0x1;_0xe002a7=new Hangup(_0x25cce4,_0x9e5e2);_0xe002a7[_0x1f7e('0xe4')]=0xc;_0xe002a7[_0x1f7e('0xed')]=_0x9e5e2['cause-txt'];_0xe002a7['membername']='Unknow';this[_0x1f7e('0xca')](_0xe002a7)[_0x1f7e('0xb0')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x1f7e('0xc8')](_0xe002a7)[_0x1f7e('0xb0')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x1f7e('0x18')][_0x1f7e('0x30')]=function(_0x1a9531){var _0xda3317=this[_0x1f7e('0x24')][_0x1a9531[_0x1f7e('0xde')]];if(this[_0x1f7e('0x1d')][_0x1a9531[_0x1f7e('0xb1')]]){if(_0xda3317&&_0xda3317[_0x1f7e('0x4b')]!==_0x1f7e('0x7a')){delete this['uniqueId'][_0x1a9531[_0x1f7e('0xde')]];this['voiceQueues'][_0x1a9531[_0x1f7e('0xb1')]]['outboundAnswerCallsDay']+=0x1;var _0x278d8d=new AgentComplete(_0xda3317,_0x1a9531);if(_0x1a9531[_0x1f7e('0x10f')]===_0x1f7e('0x110')){_0x278d8d[_0x1f7e('0x111')]=this[_0x1f7e('0x1d')][_0x1a9531['queue']]['dialQueueProject2']&&this[_0x1f7e('0x1d')][_0x1a9531[_0x1f7e('0xb1')]]['dialAgiAfterHangupAgent']?moment()[_0x1f7e('0x77')](_0x1f7e('0x102')):undefined;}this[_0x1f7e('0xca')](_0x278d8d)[_0x1f7e('0xb0')](loggerCatch(_0x1f7e('0x112')));this[_0x1f7e('0xc8')](_0x278d8d)[_0x1f7e('0xb0')](loggerCatch(_0x1f7e('0x113')));}}};Dialer[_0x1f7e('0x18')][_0x1f7e('0x2a')]=function(_0x58edc2){if(this[_0x1f7e('0x1d')][_0x58edc2[_0x1f7e('0xb1')]]){if(this[_0x1f7e('0x24')][_0x58edc2['uniqueid']]&&this['uniqueId'][_0x58edc2[_0x1f7e('0xde')]][_0x1f7e('0x4b')]!==_0x1f7e('0x7a')){this['updateOriginated'](this['voiceQueues'][_0x58edc2['queue']]);this[_0x1f7e('0x24')][_0x58edc2[_0x1f7e('0xde')]][_0x1f7e('0x114')]=moment()['format'](_0x1f7e('0x102'));}}};Dialer[_0x1f7e('0x18')][_0x1f7e('0x115')]=function(_0x128623,_0x81469f){this[_0x1f7e('0xca')](_0x128623)[_0x1f7e('0xb0')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x81469f==0x0){this[_0x1f7e('0xc8')](_0x128623)[_0x1f7e('0xb0')](loggerCatch(_0x1f7e('0x116')));}};Dialer[_0x1f7e('0x18')][_0x1f7e('0x2b')]=function(_0x13c3d8){var _0x18ad39=this[_0x1f7e('0x24')][_0x13c3d8['uniqueid']];var _0x3e2a93=this;var _0x28bef7=![];var _0x3637ba;var _0x46d09c;if(this[_0x1f7e('0x1d')][_0x13c3d8[_0x1f7e('0xb1')]]){if(_0x18ad39&&_0x18ad39[_0x1f7e('0x4b')]!=='ivr'){delete this[_0x1f7e('0x24')][_0x13c3d8[_0x1f7e('0xde')]];this[_0x1f7e('0xcf')](this[_0x1f7e('0x1d')][_0x13c3d8[_0x1f7e('0xb1')]]);_0x18ad39[_0x1f7e('0x117')]=moment()[_0x1f7e('0x77')]('YYYY-MM-DD\x20HH:mm:ss');var _0x45317f=new QueueCallerAbandon(_0x18ad39,_0x13c3d8);if(getSeconds(_0x18ad39[_0x1f7e('0x117')],_0x18ad39[_0x1f7e('0x118')])>=_0x18ad39[_0x1f7e('0x119')]){this['voiceQueues'][_0x13c3d8['queue']][_0x1f7e('0x7e')]+=0x1;this['voiceQueues'][_0x13c3d8['queue']][_0x1f7e('0x63')]+=0x1;this[_0x1f7e('0x1d')][_0x13c3d8[_0x1f7e('0xb1')]][_0x1f7e('0x11a')]+=0x1;_0x45317f[_0x1f7e('0xe4')]=0xa;_0x45317f[_0x1f7e('0xed')]=_0x1f7e('0x11b');_0x45317f[_0x1f7e('0x11c')]=_0x1f7e('0x11d');_0x45317f['agiafterat']=this['voiceQueues'][_0x13c3d8[_0x1f7e('0xb1')]][_0x1f7e('0x11e')]?moment()[_0x1f7e('0x77')](_0x1f7e('0x102')):undefined;_0x45317f['countdropretry']+=0x1;_0x45317f[_0x1f7e('0xf1')]+=0x1;_0x3637ba=this[_0x1f7e('0x1d')][_0x13c3d8[_0x1f7e('0xb1')]][_0x1f7e('0x11f')];_0x46d09c=this[_0x1f7e('0x1d')][_0x13c3d8[_0x1f7e('0xb1')]][_0x1f7e('0x120')];_0x3e2a93[_0x1f7e('0xb8')](_0x45317f,_0x45317f[_0x1f7e('0xe4')],_0x18ad39[_0x1f7e('0x121')])[_0x1f7e('0x3c')](function(_0x2b9112){_0x28bef7=_0x2b9112[_0x1f7e('0x122')]==0x1;if(_0x45317f[_0x1f7e('0x109')]>=_0x3e2a93['voiceQueues'][_0x13c3d8[_0x1f7e('0xb1')]]['dialDropMaxRetry']){_0x3e2a93[_0x1f7e('0x115')](_0x45317f,_0x2b9112[_0x1f7e('0x122')]);}else{_0x3e2a93[_0x1f7e('0xbf')]({'active':![],'countdropretry':_0x45317f['countdropretry'],'scheduledat':moment()[_0x1f7e('0xff')](_0x3e2a93[_0x1f7e('0x1d')][_0x13c3d8['queue']][_0x1f7e('0x11f')],_0x1f7e('0x101'))[_0x1f7e('0x77')](_0x1f7e('0x102')),'ContactId':_0x18ad39[_0x1f7e('0xd2')],'ListId':_0x18ad39[_0x1f7e('0x103')],'VoiceQueueId':_0x18ad39[_0x1f7e('0xd4')]||undefined,'CampaignId':_0x18ad39[_0x1f7e('0xd5')]||undefined})[_0x1f7e('0xb0')](loggerCatch('[rescheduleContact][Drop]'));var _0x172416=new History(_0x45317f);_0x172416[_0x1f7e('0xe4')]=0xa;_0x172416['statedesc']='Drop';_0x172416[_0x1f7e('0xa7')]=moment()[_0x1f7e('0x77')]('YYYY-MM-DD\x20HH:mm:ss');_0x172416[_0x1f7e('0xa6')]=_0x172416['starttime'];_0x172416[_0x1f7e('0x123')]=_0x45317f[_0x1f7e('0x123')];_0x172416[_0x1f7e('0x124')]=_0x45317f[_0x1f7e('0x124')];_0x3e2a93[_0x1f7e('0xca')](_0x172416)[_0x1f7e('0xb0')](loggerCatch(_0x1f7e('0x125')));}})[_0x1f7e('0x3c')](function(){if(_0x28bef7)_0x3e2a93[_0x1f7e('0xb9')](_0x45317f,_0x3637ba,_0x46d09c)[_0x1f7e('0x3c')](function(){return 0x1;});});}else{this[_0x1f7e('0x1d')][_0x13c3d8[_0x1f7e('0xb1')]][_0x1f7e('0x6a')]+=0x1;this[_0x1f7e('0x1d')][_0x13c3d8[_0x1f7e('0xb1')]][_0x1f7e('0x62')]+=0x1;_0x45317f[_0x1f7e('0xe4')]=0xb;_0x45317f[_0x1f7e('0xed')]=_0x1f7e('0x126');_0x45317f[_0x1f7e('0x11c')]=_0x1f7e('0x127');_0x45317f[_0x1f7e('0xf7')]+=0x1;_0x45317f[_0x1f7e('0xf1')]+=0x1;_0x3637ba=this[_0x1f7e('0x1d')][_0x13c3d8[_0x1f7e('0xb1')]][_0x1f7e('0x128')];_0x46d09c=this[_0x1f7e('0x1d')][_0x13c3d8[_0x1f7e('0xb1')]][_0x1f7e('0x120')];_0x3e2a93[_0x1f7e('0xb8')](_0x45317f,_0x45317f[_0x1f7e('0xe4')],_0x18ad39['voiceQueue'])[_0x1f7e('0x3c')](function(_0x653be0){if(_0x45317f[_0x1f7e('0xf7')]>=_0x3e2a93[_0x1f7e('0x1d')][_0x13c3d8[_0x1f7e('0xb1')]][_0x1f7e('0x129')]){_0x3e2a93[_0x1f7e('0x115')](_0x45317f,_0x653be0['additional']);}else{_0x3e2a93[_0x1f7e('0xbf')]({'active':![],'countabandonedretry':_0x45317f['countabandonedretry'],'scheduledat':moment()[_0x1f7e('0xff')](_0x3e2a93['voiceQueues'][_0x13c3d8[_0x1f7e('0xb1')]]['dialAbandonedRetryFrequency'],_0x1f7e('0x101'))['format'](_0x1f7e('0x102')),'ContactId':_0x18ad39[_0x1f7e('0xd2')],'ListId':_0x18ad39[_0x1f7e('0x103')],'VoiceQueueId':_0x18ad39[_0x1f7e('0xd4')]||undefined,'CampaignId':_0x18ad39[_0x1f7e('0xd5')]||undefined})['catch'](loggerCatch(_0x1f7e('0x12a')));var _0xad6f48=new History(_0x45317f);_0xad6f48['state']=0xb;_0xad6f48[_0x1f7e('0xed')]='Abandoned';_0xad6f48[_0x1f7e('0xa7')]=moment()[_0x1f7e('0x77')](_0x1f7e('0x102'));_0xad6f48[_0x1f7e('0xa6')]=_0xad6f48[_0x1f7e('0xa7')];_0xad6f48[_0x1f7e('0x123')]=_0x45317f[_0x1f7e('0x123')];_0xad6f48[_0x1f7e('0x124')]=_0x45317f[_0x1f7e('0x124')];_0x3e2a93[_0x1f7e('0xca')](_0xad6f48)[_0x1f7e('0xb0')](loggerCatch('[syncAgentComplete][createHistory][11]'));}})['then'](function(){if(_0x28bef7)_0x3e2a93[_0x1f7e('0xb9')](_0x45317f,_0x3637ba,_0x46d09c)[_0x1f7e('0x3c')](function(){return 0x1;});});}}}};Dialer['prototype']['syncNewExten']=function(_0x2126ca){if(this[_0x1f7e('0xab')][_0x2126ca[_0x1f7e('0xde')]]){this[_0x1f7e('0xab')][_0x2126ca[_0x1f7e('0xde')]][_0x1f7e('0xaf')]=_0x2126ca[_0x1f7e('0xaf')];}if(this[_0x1f7e('0x24')][_0x2126ca[_0x1f7e('0xde')]]){this[_0x1f7e('0x24')][_0x2126ca[_0x1f7e('0xde')]][_0x1f7e('0xaf')]=_0x2126ca['channel'];}};Dialer['prototype'][_0x1f7e('0x12b')]=function(_0x232b27){if(strategy[this[_0x1f7e('0x1d')][this[_0x1f7e('0xab')][_0x232b27['actionid']][_0x1f7e('0xb1')]][_0x1f7e('0x12c')]]===_0x1f7e('0x17')){if(this['actions'][_0x232b27[_0x1f7e('0x12d')]]&&_[_0x1f7e('0xae')](this['actions'][_0x232b27[_0x1f7e('0x12d')]][_0x1f7e('0x12e')])&&_0x232b27[_0x1f7e('0xdb')]==='1'&&_0x232b27[_0x1f7e('0x12f')]==='0'){if(this['agents'][_0x232b27[_0x1f7e('0x130')]]){if(!this[_0x1f7e('0x1f')][_0x232b27[_0x1f7e('0x130')]][_0x1f7e('0x12e')]){this[_0x1f7e('0x1f')][_0x232b27['stateinterface']][_0x1f7e('0x12e')]=!![];this['actions'][_0x232b27['actionid']]['locked']=!![];this['actions'][_0x232b27[_0x1f7e('0x12d')]][_0x1f7e('0x130')]=_0x232b27[_0x1f7e('0x130')];}}}}else if((strategy[this[_0x1f7e('0x1d')][this[_0x1f7e('0xab')][_0x232b27[_0x1f7e('0x12d')]][_0x1f7e('0xb1')]]['strategy']]||_0x1f7e('0x16'))===_0x1f7e('0x16')){if(this[_0x1f7e('0xab')][_0x232b27[_0x1f7e('0x12d')]]){if(this[_0x1f7e('0x1f')][_0x232b27['stateinterface']]){this[_0x1f7e('0xab')][_0x232b27[_0x1f7e('0x12d')]]['stateinterface']=_0x232b27[_0x1f7e('0x130')];if(_[_0x1f7e('0xae')](this[_0x1f7e('0x131')][this[_0x1f7e('0xab')][_0x232b27['actionid']]['queue']])){this['queueBooked'][this[_0x1f7e('0xab')][_0x232b27[_0x1f7e('0x12d')]][_0x1f7e('0xb1')]]=[];}this[_0x1f7e('0x131')][this['actions'][_0x232b27[_0x1f7e('0x12d')]][_0x1f7e('0xb1')]][_0x1f7e('0x132')](_['merge'](_[_0x1f7e('0xd1')](this[_0x1f7e('0xab')][_0x232b27[_0x1f7e('0x12d')]],[_0x1f7e('0x133'),'stateinterface']),{'status':_0x232b27[_0x1f7e('0xdb')],'paused':_0x232b27['paused']}));}}}};function unlockQueueStatus(_0x394cb0,_0x37da78){setTimeout(function(){if(_['isUndefined'](_0x394cb0[_0x1f7e('0x134')])){loggerBooked['error']('[unlockQueueStatus][undefined]',_0x37da78);}_0x394cb0[_0x1f7e('0x134')]=!![];loggerBooked[_0x1f7e('0x7c')]('[booked][unlockQueueStatus]',_0x37da78,JSON['stringify'](_[_0x1f7e('0xd1')](_0x394cb0,[_0x1f7e('0x3f'),_0x1f7e('0x134')])));},0x1f3);}Dialer[_0x1f7e('0x18')][_0x1f7e('0x3a')]=function(_0x2717f2){var _0x487fcd=this;var _0x1def61=_0x487fcd[_0x1f7e('0x1d')][_0x487fcd[_0x1f7e('0xab')][_0x2717f2[_0x1f7e('0x12d')]][_0x1f7e('0xb1')]];if(strategy[this['voiceQueues'][this['actions'][_0x2717f2['actionid']]['queue']][_0x1f7e('0x12c')]]===_0x1f7e('0x17')){if(this['actions'][_0x2717f2['actionid']]&&this['actions'][_0x2717f2[_0x1f7e('0x12d')]][_0x1f7e('0x130')]){this[_0x1f7e('0x1c')][_0x1f7e('0x135')](this['actions'][_0x2717f2['actionid']][_0x1f7e('0x133')],this[_0x1f7e('0xab')][_0x2717f2[_0x1f7e('0x12d')]][_0x1f7e('0x130')])[_0x1f7e('0xb0')](function(_0x23c299){logger[_0x1f7e('0x97')](_0x1f7e('0x136'),util[_0x1f7e('0x96')](_0x23c299,{'showHidden':![],'depth':null}));})[_0x1f7e('0x1b')](function(){_0x487fcd['updateOriginated'](_0x487fcd[_0x1f7e('0x1d')][_0x487fcd[_0x1f7e('0xab')][_0x2717f2[_0x1f7e('0x12d')]][_0x1f7e('0xb1')]]);_0x487fcd[_0x1f7e('0x1f')][_0x487fcd[_0x1f7e('0xab')][_0x2717f2[_0x1f7e('0x12d')]]['stateinterface']][_0x1f7e('0x12e')]=![];delete _0x487fcd[_0x1f7e('0xab')][_0x2717f2[_0x1f7e('0x12d')]];unlockQueueStatus(_0x1def61);});}else{this[_0x1f7e('0xcf')](this[_0x1f7e('0x1d')][this['actions'][_0x2717f2['actionid']]['queue']]);this[_0x1f7e('0xbf')]({'active':![],'ContactId':this['actions'][_0x2717f2['actionid']][_0x1f7e('0xd2')],'ListId':this[_0x1f7e('0xab')][_0x2717f2['actionid']]['ListId'],'VoiceQueueId':this['actions'][_0x2717f2[_0x1f7e('0x12d')]]['VoiceQueueId']||undefined,'CampaignId':this['actions'][_0x2717f2[_0x1f7e('0x12d')]]['CampaignId']||undefined})[_0x1f7e('0xb0')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x1f7e('0xab')][_0x2717f2[_0x1f7e('0x12d')]];unlockQueueStatus(_0x1def61);}}else if((strategy[this[_0x1f7e('0x1d')][this['actions'][_0x2717f2['actionid']]['queue']][_0x1f7e('0x12c')]]||_0x1f7e('0x16'))==='rrmemory'){var _0x31c00b;if(this['actions'][_0x2717f2[_0x1f7e('0x12d')]]&&!_[_0x1f7e('0x45')](this['queueBooked'][this[_0x1f7e('0xab')][_0x2717f2['actionid']][_0x1f7e('0xb1')]])){if(this['queueBookedRR'][_0x487fcd[_0x1f7e('0xab')][_0x2717f2[_0x1f7e('0x12d')]][_0x1f7e('0xb1')]]){this[_0x1f7e('0x28')][_0x487fcd[_0x1f7e('0xab')][_0x2717f2[_0x1f7e('0x12d')]]['queue']]=this[_0x1f7e('0x28')][this[_0x1f7e('0xab')][_0x2717f2['actionid']][_0x1f7e('0xb1')]]?this[_0x1f7e('0x28')][this[_0x1f7e('0xab')][_0x2717f2[_0x1f7e('0x12d')]][_0x1f7e('0xb1')]]:this[_0x1f7e('0x131')][this[_0x1f7e('0xab')][_0x2717f2[_0x1f7e('0x12d')]]['queue']]?this[_0x1f7e('0x131')][this[_0x1f7e('0xab')][_0x2717f2[_0x1f7e('0x12d')]][_0x1f7e('0xb1')]][_0x1f7e('0x137')]||0x0:0x0;}this['queueBooked'][this['actions'][_0x2717f2['actionid']][_0x1f7e('0xb1')]][_0x1f7e('0x137')]=this[_0x1f7e('0x28')][this[_0x1f7e('0xab')][_0x2717f2[_0x1f7e('0x12d')]][_0x1f7e('0xb1')]];for(var _0xf33177=0x0;_0xf33177=0x0;})[_0x1f7e('0xb0')](myreject(_0x18a418)));}}else{_0x3b98b7[_0x1f7e('0x132')](ami[_0x1f7e('0x14b')]({'action':_0x1f7e('0x14c'),'command':util[_0x1f7e('0x77')](_0x1f7e('0x14d'),_0x1d9ef5,!_[_0x1f7e('0x83')](config[_0x1f7e('0x149')][_0x277934])?_0x277934:'')})[_0x1f7e('0x3c')](function(_0x56a26f){return _0x56a26f[_0x1f7e('0x14f')][_0x1f7e('0x151')]('true')>=0x0;})[_0x1f7e('0xb0')](myreject(_0x18a418)));}Promise[_0x1f7e('0x152')](_0x3b98b7)[_0x1f7e('0x3c')](function(_0x4a8e20){var _0x4425a7=_['some'](_0x4a8e20);if(_0x4425a7){return _0x368c0d(_0x4425a7);}else{_0x498b60[_0x1f7e('0x3e')]=_0x11a586?_0x1f7e('0x153'):_0x1f7e('0x154');return _0x18a418(msgResponse(_0x1f7e('0x155'),_0x1f7e('0x147'),_0x1f7e('0x156')+_0x11a586+'\x20'+_0x57efcb+_0x1f7e('0x157')+util[_0x1f7e('0x96')](_0x1d9ef5,{'showHidden':![],'depth':null})+_0x1f7e('0x158')+_0x277934));}})['catch'](function(_0x58fefd){return _0x18a418(msgResponse(_0x1f7e('0x145'),_0x1f7e('0x147'),JSON['stringify'](_0x58fefd)));});});};Dialer[_0x1f7e('0x18')][_0x1f7e('0x159')]=function(_0x31170d){var _0x520281=this;return function(){switch(_0x31170d['dialMethod']){case'progressive':freeVariablesPredictive(_0x31170d);_0x520281['handlePower'](_0x31170d,0x1);break;case'power':freeVariablesPredictive(_0x31170d);_0x520281[_0x1f7e('0x15a')](_0x31170d,_0x31170d[_0x1f7e('0x15b')]);break;case _0x1f7e('0x6'):_0x520281[_0x1f7e('0x6')](_0x31170d);break;case _0x1f7e('0x15c'):freeVariablesPredictive(_0x31170d);_0x520281[_0x1f7e('0x15a')](_0x31170d,0x1);break;default:freeVariablesPredictive(_0x31170d);logger[_0x1f7e('0x97')](_0x1f7e('0x15d'),_0x31170d['name'],_0x1f7e('0x15e'));}};};Dialer[_0x1f7e('0x18')][_0x1f7e('0x15f')]=function(_0x5f0fdf){return Promise[_0x1f7e('0xb5')]()[_0x1f7e('0x3c')](cmHopper[_0x1f7e('0x160')](_0x5f0fdf['id'],previewRecallmeReminderInterval))[_0x1f7e('0x3c')](function(_0x4bf1fc){for(var _0x188515=0x0;_0x188515<_0x4bf1fc[_0x1f7e('0x99')];_0x188515++){var _0xa37ee1=_0x4bf1fc[_0x188515]['Agent'][_0x1f7e('0x3f')];if(_0xa37ee1)io['to'](util['format'](_0x1f7e('0x161'),_0xa37ee1))['emit']('user:dialPreviewRecallReminder',{'hopper':_0x4bf1fc[_0x188515]});}})[_0x1f7e('0xb0')](function(){});};Dialer['prototype'][_0x1f7e('0x162')]=function(_0x34f3b9){var _0x2f4c0b=this;return function(){_0x2f4c0b[_0x1f7e('0x163')](_0x34f3b9);};};Dialer[_0x1f7e('0x18')]['syncQueueSummary']=function(_0x999e0d){var _0x3b1287=this;if(isNotPreview(_0x999e0d[_0x1f7e('0x58')])){if(isVoiceQueueOutbound(_0x999e0d[_0x1f7e('0x4b')])&&isActive(_0x999e0d[_0x1f7e('0x164')])){_0x999e0d[_0x1f7e('0xa0')]=!![];Promise[_0x1f7e('0xb5')]()[_0x1f7e('0x3c')](checkIsLoggedIn(_0x999e0d,_0x999e0d[_0x1f7e('0x4f')]))['then'](checkIsActive(_0x999e0d,_0x999e0d[_0x1f7e('0x164')]))[_0x1f7e('0x3c')](checkInterval(_0x999e0d))[_0x1f7e('0x3c')](_0x3b1287[_0x1f7e('0x142')](_0x999e0d))[_0x1f7e('0x3c')](_0x3b1287['checkIfTime'](_0x999e0d['dialGlobalInterval'],_0x999e0d[_0x1f7e('0x165')],_0x999e0d['name'],_0x999e0d))[_0x1f7e('0x3c')](_0x3b1287[_0x1f7e('0x146')](_0x999e0d[_0x1f7e('0x43')],_0x999e0d['dialTimezone'],_0x999e0d[_0x1f7e('0x3f')],_0x999e0d))[_0x1f7e('0x3c')](_0x3b1287[_0x1f7e('0x159')](_0x999e0d))[_0x1f7e('0xb0')](loggerCatchQueueSummary(_0x1f7e('0x166'),_0x999e0d));}else{notSendMessagesQueue(_0x999e0d);}}else{freeVariablesPredictive(_0x999e0d);}};Dialer[_0x1f7e('0x18')][_0x1f7e('0x167')]=_[_0x1f7e('0x168')](function(){var _0x4a661c=_[_0x1f7e('0x169')](this[_0x1f7e('0x1d')],function(_0x4ce58a){return _0x4ce58a[_0x1f7e('0x16a')];});var _0x37db94=_[_0x1f7e('0x169')](this[_0x1f7e('0x1f')],function(_0x23b994){return _0x23b994[_0x1f7e('0x16b')]&&_0x23b994[_0x1f7e('0xdb')]==='reachable';});if(_0x4a661c[_0x1f7e('0x99')]>0x0&&_0x37db94['length']>0x0){return Promise[_0x1f7e('0xb5')]()[_0x1f7e('0x3c')](cmHopper[_0x1f7e('0x160')](_['map'](_0x4a661c,'id'),previewRecallmeReminderInterval,_[_0x1f7e('0x16c')](_0x37db94,'id')))[_0x1f7e('0x3c')](function(_0x4ba41d){for(var _0xf9f2a2=0x0;_0xf9f2a2<_0x4ba41d['length'];_0xf9f2a2++){var _0x429630=_0x4ba41d[_0xf9f2a2][_0x1f7e('0x16d')][_0x1f7e('0x3f')];if(_0x429630)io['to'](util[_0x1f7e('0x77')](_0x1f7e('0x161'),_0x429630))[_0x1f7e('0xe6')](_0x1f7e('0x16e'),{'hopper':_0x4ba41d[_0xf9f2a2]});}})[_0x1f7e('0xb0')](function(_0x1b6a94){logger['error'](_0x1f7e('0x15f'),_0x1b6a94);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x1f7e('0x18')][_0x1f7e('0x16f')]=function(){var _0x362692=this;var _0x5e91f1;for(var _0x2375b2 in this[_0x1f7e('0x1e')]){if(typeof this[_0x1f7e('0x1e')][_0x2375b2]!=='undefined'){_0x5e91f1=this[_0x1f7e('0x1e')][_0x2375b2];if(isCampaignIvr(_0x5e91f1[_0x1f7e('0x4b')])&&isActive(_0x5e91f1[_0x1f7e('0x74')])){_0x5e91f1[_0x1f7e('0xa0')]=!![];Promise[_0x1f7e('0xb5')]()[_0x1f7e('0x3c')](checkIsActive(_0x5e91f1,_0x5e91f1[_0x1f7e('0x74')]))[_0x1f7e('0x3c')](checkInterval(_0x5e91f1))[_0x1f7e('0x3c')](_0x362692[_0x1f7e('0x142')](_0x5e91f1))['then'](_0x362692['checkIfTime'](_0x5e91f1[_0x1f7e('0x170')],_0x5e91f1[_0x1f7e('0x165')],_0x5e91f1[_0x1f7e('0x3f')],_0x5e91f1))['then'](_0x362692['checkIfTimeIntervals'](_0x5e91f1[_0x1f7e('0x43')],_0x5e91f1[_0x1f7e('0x165')],_0x5e91f1[_0x1f7e('0x3f')],_0x5e91f1))['then'](_0x362692[_0x1f7e('0x162')](_0x5e91f1))['catch'](loggerCatchQueueSummary(_0x1f7e('0x171'),_0x5e91f1));}else{notSendMessagesCampaign(_0x5e91f1);}}}};function getCallerIdRandom(_0x42438f,_0x4297d0){var _0x12b7f8;var _0x486de4;var _0x79f903;if(_0x4297d0<=0x0){_0x4297d0=0x1;}_0x12b7f8=new RegExp(_0x1f7e('0x172')+_0x4297d0+'}$');_0x486de4=Math[_0x1f7e('0x173')](0xa,_0x4297d0-0x1);_0x79f903=Math['pow'](0xa,_0x4297d0)-0x1;return util[_0x1f7e('0x77')]('%s',_[_0x1f7e('0x174')](_0x42438f,_0x12b7f8,_[_0x1f7e('0x175')](_0x486de4,_0x79f903)));}function extractCalleridName(_0x31bd28){var _0x46e7f2=_0x31bd28[_0x1f7e('0x176')](/"(.*?)"/);return _0x46e7f2?_0x46e7f2[0x1]:_0x31bd28;}Dialer[_0x1f7e('0x18')]['actionOriginate']=function(_0x37ddcc,_0x5d4c66){var _0xcc85f8=this;var _0x2d3d3f=uuid['v4']();this[_0x1f7e('0xab')][_0x2d3d3f]=new Action(_0x37ddcc,_0x5d4c66,_0x2d3d3f);return new Promise(function(_0x536ad2,_0x2e48e6){if(_[_0x1f7e('0x83')](_0x37ddcc)&&typeof _0x37ddcc!==_0x1f7e('0x177')){return _0x2e48e6(msgResponse(_0x1f7e('0x178'),_0x1f7e('0x147'),'voiceQueue\x20is\x20undefine'));}if(_[_0x1f7e('0x83')](_0x5d4c66[_0x1f7e('0x179')])||_0x5d4c66[_0x1f7e('0x179')]===null){return _0x2e48e6(msgResponse('originate',_0x1f7e('0x147'),_0x1f7e('0x17a')));}var _0x5322ac={'XMD-CALLERID':_0xcc85f8['actions'][_0x2d3d3f][_0x1f7e('0x17b')](),'XMD-AGI':_0x37ddcc[_0x1f7e('0x10c')]?util[_0x1f7e('0x77')](_0x1f7e('0x17c'),ipAgi,_0x37ddcc[_0x1f7e('0x10c')]):_0x1f7e('0x17d'),'XMD-AGIAFTER':_0x37ddcc['dialQueueProject2']?util[_0x1f7e('0x77')](_0x1f7e('0x17c'),ipAgi,_0x37ddcc[_0x1f7e('0x11e')]):_0x1f7e('0x17d'),'XMD-QUEUE':_0x37ddcc[_0x1f7e('0x4b')]===_0x1f7e('0x4c')?util[_0x1f7e('0x77')]('\x22%s,%s%s,,,%s\x22',_0x37ddcc[_0x1f7e('0x3f')],_0x37ddcc['dialQueueOptions']||'',_0x37ddcc[_0x1f7e('0x17e')]?'c':'',_0x37ddcc[_0x1f7e('0x119')]||0x3):_0x1f7e('0x17d'),'XMD-CONTACTID':_0x5d4c66[_0x1f7e('0xd2')],'XMD-CDRTYPE':_0x1f7e('0x17f'),'CALLERID(all)':_0xcc85f8[_0x1f7e('0xab')][_0x2d3d3f][_0x1f7e('0x17b')](),'XMD-AMD':_0x37ddcc['dialAMDActive']?_0x1f7e('0x180'):_0x1f7e('0x17d'),'XMD-DESTINATION':_0x1f7e('0xe2')};if(_0x37ddcc[_0x1f7e('0xec')]){_0x5322ac[_0x1f7e('0x181')]=_0x37ddcc['dialAMDInitialSilence']||0x9c4;_0x5322ac[_0x1f7e('0x182')]=_0x37ddcc[_0x1f7e('0x183')]||0x5dc;_0x5322ac['XMD-AMDAFTERGREETINGSILENCE']=_0x37ddcc[_0x1f7e('0x184')]||0x320;_0x5322ac[_0x1f7e('0x185')]=_0x37ddcc[_0x1f7e('0x186')]||0x1388;_0x5322ac[_0x1f7e('0x187')]=_0x37ddcc['dialAMDMinWordLength']||0x64;_0x5322ac['XMD-AMDBETWEENWORDSSILENCE']=_0x37ddcc[_0x1f7e('0x188')]||0x32;_0x5322ac[_0x1f7e('0x189')]=_0x37ddcc[_0x1f7e('0x18a')]||0x3;_0x5322ac[_0x1f7e('0x18b')]=_0x37ddcc[_0x1f7e('0x18c')]||0x100;_0x5322ac[_0x1f7e('0x18d')]=_0x37ddcc['dialAMDMaximumWordLength']||0x1388;}if(_0x37ddcc[_0x1f7e('0x4b')]===_0x1f7e('0x4c')){_0x5322ac[_0x1f7e('0x18e')]=_0x5d4c66[_0x1f7e('0xd4')];}else{_0x5322ac[_0x1f7e('0x18f')]=_0x5d4c66[_0x1f7e('0xd5')];}for(var _0xa359aa in _0x5d4c66[_0x1f7e('0x190')]){if(typeof _0x5d4c66['Contact'][_0xa359aa]!=='undefined'){if(isNotNull(_0x5d4c66['Contact'][_0xa359aa])&&_0xa359aa!=='id'&&_0xa359aa!=='tags'&&_0xa359aa!==_0x1f7e('0x191')&&_0xa359aa!==_0x1f7e('0x192')){_0x5322ac[util[_0x1f7e('0x77')]('%s%s',_0x1f7e('0x193'),_[_0x1f7e('0x194')](_0xa359aa))]=_0x5d4c66[_0x1f7e('0x190')][_0xa359aa];}}}var _0x4bf38c=_0xcc85f8[_0x1f7e('0xd9')](_0x37ddcc[_0x1f7e('0x73')])?getCallerId(_0x37ddcc[_0x1f7e('0x73')]['callerid'],_0x37ddcc[_0x1f7e('0x59')],_0x37ddcc['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x37ddcc[_0x1f7e('0x5a')],_0x37ddcc[_0x1f7e('0x195')]):_0x37ddcc[_0x1f7e('0x5a')]):getCallerId(_[_0x1f7e('0xae')](_0x37ddcc[_0x1f7e('0x143')])?_0x37ddcc[_0x1f7e('0x73')][_0x1f7e('0x75')]:_0x37ddcc[_0x1f7e('0x143')][_0x1f7e('0x75')],_0x37ddcc[_0x1f7e('0x59')],_0x37ddcc['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x37ddcc[_0x1f7e('0x5a')],_0x37ddcc[_0x1f7e('0x195')]):_0x37ddcc[_0x1f7e('0x5a')]);if(_0x4bf38c){_0x5322ac[_0x1f7e('0x196')]=_0xcc85f8[_0x1f7e('0xab')][_0x2d3d3f][_0x1f7e('0x197')]=extractCalleridName(_0x4bf38c);_0x5322ac[_0x1f7e('0x198')]=_0x5d4c66[_0x1f7e('0x179')];}_0x37ddcc['variables']=_0x5322ac;return ami['Action']({'actionid':_0x2d3d3f,'action':_0x1f7e('0x178'),'channel':_0xcc85f8[_0x1f7e('0xd9')](_0x37ddcc[_0x1f7e('0x73')])?util[_0x1f7e('0x77')](_0x1f7e('0x199'),_0x37ddcc[_0x1f7e('0x73')]['name'],isNotNull(_0x37ddcc[_0x1f7e('0x5c')])?_0x37ddcc[_0x1f7e('0x5c')][_0x1f7e('0x19a')]()||'':'',_0x37ddcc[_0x1f7e('0x19b')]>0x0?_0x5d4c66[_0x1f7e('0x179')][_0x1f7e('0x19c')](_0x37ddcc[_0x1f7e('0x19b')]):_0x5d4c66[_0x1f7e('0x179')]):util[_0x1f7e('0x77')]('SIP/%s/%s%s',_['isNil'](_0x37ddcc[_0x1f7e('0x143')])?_0x37ddcc[_0x1f7e('0x73')][_0x1f7e('0x3f')]:_0x37ddcc[_0x1f7e('0x143')][_0x1f7e('0x3f')],isNotNull(_0x37ddcc[_0x1f7e('0x5c')])?_0x37ddcc[_0x1f7e('0x5c')][_0x1f7e('0x19a')]()||'':'',_0x37ddcc['dialCutDigit']>0x0?_0x5d4c66[_0x1f7e('0x179')][_0x1f7e('0x19c')](_0x37ddcc[_0x1f7e('0x19b')]):_0x5d4c66['phone']),'callerid':_0x4bf38c,'Exten':_0x1f7e('0xe2'),'Context':_0x1f7e('0x19d'),'Priority':'1','variable':_0x5322ac,'timeout':(_0x37ddcc[_0x1f7e('0x5b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2d3d3f})[_0x1f7e('0x3c')](function(_0x14c19b){return _0x536ad2(_0x14c19b);})[_0x1f7e('0xb0')](function(_0x58cca5){_0x37ddcc[_0x1f7e('0x19e')]+=0x1;var _0x508b4f=new History(_0xcc85f8['actions'][_0x2d3d3f]);logger[_0x1f7e('0x97')](util['format']('[originateError]:\x20%s',JSON['stringify'](_0x58cca5)));_0x508b4f['state']=0xe;_0x508b4f[_0x1f7e('0xed')]=_0x1f7e('0x19f');_0x508b4f[_0x1f7e('0xa7')]=moment()[_0x1f7e('0x77')](_0x1f7e('0x102'));_0x508b4f['endtime']=_0x508b4f['starttime'];_0xcc85f8[_0x1f7e('0xca')](_0x508b4f)[_0x1f7e('0xb0')](loggerCatch(_0x1f7e('0x1a0')));_0xcc85f8['moveContactManagedDialer'](_0x508b4f)[_0x1f7e('0xb0')](loggerCatch(_0x1f7e('0x1a0')))[_0x1f7e('0x1b')](function(){delete _0xcc85f8[_0x1f7e('0xab')][_0x2d3d3f];return _0x2e48e6(msgResponse(_0x1f7e('0x178'),_0x1f7e('0x1a1'),_0x1f7e('0x1a2')));});});});};Dialer[_0x1f7e('0x18')]['syncOriginateResponse']=function(_0x29915e){var _0x1e2159=this['actions'][_0x29915e[_0x1f7e('0x12d')]];if(_0x1e2159){delete this[_0x1f7e('0xab')][_0x29915e[_0x1f7e('0x12d')]];_0x1e2159[_0x1f7e('0x118')]=moment()[_0x1f7e('0x77')]('YYYY-MM-DD\x20HH:mm:ss');var _0x5f2ebc=_0x1e2159[_0x1f7e('0x4b')]===_0x1f7e('0x7a')?this[_0x1f7e('0x1e')][_0x1e2159['queue']]:this[_0x1f7e('0x1d')][_0x1e2159[_0x1f7e('0x1a3')]()];if(!this[_0x1f7e('0xd8')](_0x29915e[_0x1f7e('0x1a4')])){this[_0x1f7e('0xcf')](_0x5f2ebc);return this[_0x1f7e('0x1a5')](_0x1e2159,_0x5f2ebc,_0x29915e)['catch'](loggerCatch(_0x1f7e('0x1a6')));}this['uniqueId'][_0x29915e[_0x1f7e('0xde')]]=_0x1e2159;}};Dialer[_0x1f7e('0x18')][_0x1f7e('0x1a7')]=function(_0x5cafb7,_0x129c9d,_0x24f50a){var _0x5e8b62=new History(_0x129c9d);if(_0x5e8b62[_0x1f7e('0xf3')]+_0x5e8b62['countcongestionretry']+_0x5e8b62[_0x1f7e('0xf5')]+_0x5e8b62[_0x1f7e('0xf6')]+_0x5e8b62[_0x1f7e('0x109')]+_0x5e8b62[_0x1f7e('0xf7')]+_0x5e8b62['countmachineretry']+_0x5e8b62[_0x1f7e('0xf8')]>=_0x24f50a['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x5cafb7){case 0x3:if(_0x5e8b62[_0x1f7e('0xf5')]>=_0x24f50a[_0x1f7e('0x1a8')]-0x1){return!![];}this[_0x1f7e('0xbf')]({'active':![],'countnoanswerretry':_0x5e8b62[_0x1f7e('0xf5')]+=0x1,'scheduledat':moment()['add'](_0x24f50a['dialNoAnswerRetryFrequency'],_0x1f7e('0x101'))['format'](_0x1f7e('0x102')),'ContactId':_0x5e8b62['ContactId'],'ListId':_0x5e8b62[_0x1f7e('0x103')],'VoiceQueueId':_0x5e8b62[_0x1f7e('0xd4')]||undefined,'CampaignId':_0x5e8b62[_0x1f7e('0xd5')]||undefined})[_0x1f7e('0xb0')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x5e8b62[_0x1f7e('0xf3')]>=_0x24f50a['dialBusyMaxRetry']-0x1){return!![];}this[_0x1f7e('0xbf')]({'active':![],'countbusyretry':_0x5e8b62['countbusyretry']+=0x1,'scheduledat':moment()['add'](_0x24f50a[_0x1f7e('0x1a9')],_0x1f7e('0x101'))[_0x1f7e('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5e8b62[_0x1f7e('0xd2')],'ListId':_0x5e8b62[_0x1f7e('0x103')],'VoiceQueueId':_0x5e8b62[_0x1f7e('0xd4')]||undefined,'CampaignId':_0x5e8b62['CampaignId']||undefined})[_0x1f7e('0xb0')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x5e8b62[_0x1f7e('0xf4')]>=_0x24f50a[_0x1f7e('0x1aa')]-0x1){return!![];}this[_0x1f7e('0xbf')]({'active':![],'countcongestionretry':_0x5e8b62[_0x1f7e('0xf4')]+=0x1,'scheduledat':moment()[_0x1f7e('0xff')](_0x24f50a[_0x1f7e('0x1ab')],_0x1f7e('0x101'))[_0x1f7e('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5e8b62[_0x1f7e('0xd2')],'ListId':_0x5e8b62['ListId'],'VoiceQueueId':_0x5e8b62['VoiceQueueId']||undefined,'CampaignId':_0x5e8b62['CampaignId']||undefined})[_0x1f7e('0xb0')](loggerCatch(_0x1f7e('0x1ac')));break;case 0x0:if(_0x5e8b62[_0x1f7e('0xf6')]>=_0x24f50a[_0x1f7e('0x1ad')]-0x1){return!![];}else{this[_0x1f7e('0xbf')]({'active':![],'countnosuchnumberretry':_0x5e8b62[_0x1f7e('0xf6')]+=0x1,'scheduledat':moment()[_0x1f7e('0xff')](_0x24f50a[_0x1f7e('0x1ae')],'minutes')['format'](_0x1f7e('0x102')),'ContactId':_0x5e8b62[_0x1f7e('0xd2')],'ListId':_0x5e8b62[_0x1f7e('0x103')],'VoiceQueueId':_0x5e8b62[_0x1f7e('0xd4')]||undefined,'CampaignId':_0x5e8b62[_0x1f7e('0xd5')]||undefined})['catch'](loggerCatch(_0x1f7e('0x1af')));}break;case 0xa:if(_0x5e8b62[_0x1f7e('0x109')]>=_0x24f50a[_0x1f7e('0x1b0')]-0x1){return!![];}this[_0x1f7e('0xbf')]({'active':![],'countdropretry':_0x5e8b62[_0x1f7e('0x109')]+=0x1,'scheduledat':moment()[_0x1f7e('0xff')](_0x24f50a['dialDropRetryFrequency'],_0x1f7e('0x101'))['format'](_0x1f7e('0x102')),'ContactId':_0x5e8b62[_0x1f7e('0xd2')],'ListId':_0x5e8b62[_0x1f7e('0x103')],'VoiceQueueId':_0x5e8b62[_0x1f7e('0xd4')]||undefined,'CampaignId':_0x5e8b62['CampaignId']||undefined})[_0x1f7e('0xb0')](loggerCatch(_0x1f7e('0x1b1')));break;case 0xb:if(_0x5e8b62[_0x1f7e('0xf7')]>=_0x24f50a[_0x1f7e('0x129')]-0x1){return!![];}this[_0x1f7e('0xbf')]({'active':![],'countabandonedretry':_0x5e8b62['countabandonedretry']+=0x1,'scheduledat':moment()[_0x1f7e('0xff')](_0x24f50a[_0x1f7e('0x128')],_0x1f7e('0x101'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5e8b62[_0x1f7e('0xd2')],'ListId':_0x5e8b62[_0x1f7e('0x103')],'VoiceQueueId':_0x5e8b62[_0x1f7e('0xd4')]||undefined,'CampaignId':_0x5e8b62[_0x1f7e('0xd5')]||undefined})[_0x1f7e('0xb0')](loggerCatch(_0x1f7e('0x12a')));break;case 0x13:if(_0x5e8b62[_0x1f7e('0xf0')]>=_0x24f50a[_0x1f7e('0xfc')]-0x1){return!![];}this[_0x1f7e('0xbf')]({'active':![],'countmachineretry':_0x5e8b62['countmachineretry']+=0x1,'scheduledat':moment()['add'](_0x24f50a[_0x1f7e('0x100')],'minutes')[_0x1f7e('0x77')](_0x1f7e('0x102')),'ContactId':_0x5e8b62[_0x1f7e('0xd2')],'ListId':_0x5e8b62[_0x1f7e('0x103')],'VoiceQueueId':_0x5e8b62['VoiceQueueId']||undefined,'CampaignId':_0x5e8b62['CampaignId']||undefined})[_0x1f7e('0xb0')](loggerCatch(_0x1f7e('0x104')));break;case 0x14:if(_0x5e8b62['countagentrejectretry']>=_0x24f50a[_0x1f7e('0x1b2')]-0x1){return!![];}this[_0x1f7e('0xbf')]({'active':![],'countagentrejectretry':_0x5e8b62[_0x1f7e('0xf8')]+=0x1,'scheduledat':moment()[_0x1f7e('0xff')](_0x24f50a[_0x1f7e('0x1b3')],_0x1f7e('0x101'))[_0x1f7e('0x77')](_0x1f7e('0x102')),'ContactId':_0x5e8b62[_0x1f7e('0xd2')],'ListId':_0x5e8b62['ListId'],'VoiceQueueId':_0x5e8b62[_0x1f7e('0xd4')]||undefined,'CampaignId':_0x5e8b62['CampaignId']||undefined})[_0x1f7e('0xb0')](loggerCatch(_0x1f7e('0x1b4')));break;default:return!![];}};Dialer[_0x1f7e('0x18')]['callProgressDetecting']=function(_0x2fce22,_0x4206fd,_0x3e62ca){var _0x509a78=this;var _0x3706b1=new History(_0x2fce22);var _0x245eaf=![];var _0x1e73d9;var _0x12d163;return new Promise(function(_0x4d1129,_0x254ed3){if(_[_0x1f7e('0x83')](_0x4206fd)&&typeof _0x4206fd!==_0x1f7e('0x177')){return _0x254ed3(msgResponse(_0x1f7e('0x1b5'),_0x1f7e('0x147'),'entity\x20is\x20undefine'));}if(_[_0x1f7e('0x83')](_0x3e62ca)&&typeof _0x3e62ca!==_0x1f7e('0x177')){return _0x254ed3(msgResponse(_0x1f7e('0x1b5'),_0x1f7e('0x147'),'evt\x20is\x20undefine'));}_0x509a78[_0x1f7e('0xb8')](_0x3706b1,_0x3e62ca['reason'],_0x4206fd)[_0x1f7e('0x3c')](function(_0x39a096){if(_0x39a096[_0x1f7e('0x122')]==0x1)_0x245eaf=!![];switch(_0x3e62ca[_0x1f7e('0x10f')]){case'0':_0x4206fd[_0x1f7e('0x1b6')]+=0x1;_0x3706b1[_0x1f7e('0xe4')]=0x0;_0x3706b1[_0x1f7e('0xed')]=_0x1f7e('0x1b7');_0x3706b1[_0x1f7e('0xf6')]+=0x1;_0x3706b1[_0x1f7e('0xf1')]+=0x1;ami['emit'](_0x1f7e('0x1b8'),ut['buildObj'](_0x2fce22,'nosuchnumber'));_0x1e73d9=_0x4206fd['dialNoSuchNumberRetryFrequency'];_0x12d163=_0x4206fd[_0x1f7e('0x120')];_0x509a78['createHistory'](_0x3706b1)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x509a78[_0x1f7e('0x1a7')](0x0,_0x2fce22,_0x4206fd)&&!_0x245eaf){if(_0x3706b1[_0x1f7e('0xf6')]>=_0x4206fd[_0x1f7e('0x1ad')]){_0x509a78[_0x1f7e('0xfd')](_0x3706b1,_0x4d1129,_0x254ed3,_0x1f7e('0x1b9'));}else{_0x509a78[_0x1f7e('0xfa')](_0x3706b1,_0x4d1129,_0x254ed3,_0x1f7e('0x1b9'));}}break;case'3':_0x4206fd['outboundNoAnswerCallsDay']+=0x1;_0x3706b1[_0x1f7e('0xe4')]=0x3;_0x3706b1['statedesc']='NoAnswer';_0x3706b1[_0x1f7e('0xf5')]+=0x1;_0x3706b1[_0x1f7e('0xf1')]+=0x1;var _0x1b6fb3=ut[_0x1f7e('0x1ba')](_0x2fce22,_0x4206fd);ami[_0x1f7e('0xe6')]('custom:agentnoanswer',_0x1b6fb3);_0x1e73d9=_0x4206fd['dialNoAnswerRetryFrequency'];_0x12d163=_0x4206fd[_0x1f7e('0x120')];_0x509a78['createHistory'](_0x3706b1)[_0x1f7e('0xb0')](loggerCatch(_0x1f7e('0x1bb')));if(_0x509a78[_0x1f7e('0x1a7')](0x3,_0x2fce22,_0x4206fd)&&!_0x245eaf){if(_0x3706b1[_0x1f7e('0xf5')]>=_0x4206fd[_0x1f7e('0x1a8')]){_0x509a78[_0x1f7e('0xfd')](_0x3706b1,_0x4d1129,_0x254ed3,_0x1f7e('0x1bc'));}else{_0x509a78[_0x1f7e('0xfa')](_0x3706b1,_0x4d1129,_0x254ed3,_0x1f7e('0x1bc'));}}break;case'5':_0x4206fd[_0x1f7e('0x5f')]+=0x1;_0x3706b1['state']=0x5;_0x3706b1[_0x1f7e('0xed')]=_0x1f7e('0x1bd');_0x3706b1[_0x1f7e('0xf3')]+=0x1;_0x3706b1[_0x1f7e('0xf1')]+=0x1;ami[_0x1f7e('0xe6')](_0x1f7e('0x1be'),ut[_0x1f7e('0xe8')](_0x2fce22,_0x1f7e('0x1bf')));_0x1e73d9=_0x4206fd['dialBusyRetryFrequency'];_0x12d163=_0x4206fd['callAdditionalPhoneAfterMin'];_0x509a78[_0x1f7e('0xca')](_0x3706b1)[_0x1f7e('0xb0')](loggerCatch(_0x1f7e('0x1c0')));if(_0x509a78[_0x1f7e('0x1a7')](0x5,_0x2fce22,_0x4206fd)&&!_0x245eaf){if(_0x3706b1[_0x1f7e('0xf3')]>=_0x4206fd['dialBusyMaxRetry']){_0x509a78['createStateFinal'](_0x3706b1,_0x4d1129,_0x254ed3,_0x1f7e('0x1c1'));}else{_0x509a78[_0x1f7e('0xfa')](_0x3706b1,_0x4d1129,_0x254ed3,_0x1f7e('0x1c1'));}}break;case'8':_0x4206fd[_0x1f7e('0x60')]+=0x1;_0x3706b1[_0x1f7e('0xe4')]=0x8;_0x3706b1[_0x1f7e('0xed')]='Congestion';_0x3706b1[_0x1f7e('0xf4')]+=0x1;_0x3706b1[_0x1f7e('0xf1')]+=0x1;_0x1e73d9=_0x4206fd['dialCongestionRetryFrequency'];_0x12d163=_0x4206fd[_0x1f7e('0x120')];ami[_0x1f7e('0xe6')](_0x1f7e('0x1c2'),ut[_0x1f7e('0xe8')](_0x2fce22,_0x1f7e('0x1c3')));_0x509a78[_0x1f7e('0xca')](_0x3706b1)['catch'](loggerCatch(_0x1f7e('0x1c4')));if(_0x509a78[_0x1f7e('0x1a7')](0x8,_0x2fce22,_0x4206fd)&&!_0x245eaf){if(_0x3706b1['countcongestionretry']>=_0x4206fd[_0x1f7e('0x1aa')]){_0x509a78[_0x1f7e('0xfd')](_0x3706b1,_0x4d1129,_0x254ed3,_0x1f7e('0x1c5'));}else{_0x509a78['stateGlobal'](_0x3706b1,_0x4d1129,_0x254ed3,_0x1f7e('0x1c5'));}}break;case'11':_0x4206fd[_0x1f7e('0x1c6')]+=0x1;_0x3706b1[_0x1f7e('0xe4')]=0xb;_0x3706b1['statedesc']=_0x1f7e('0x126');_0x3706b1[_0x1f7e('0xf7')]+=0x1;_0x3706b1[_0x1f7e('0xf1')]+=0x1;_0x1e73d9=_0x4206fd[_0x1f7e('0x128')];_0x12d163=_0x4206fd[_0x1f7e('0x120')];_0x509a78[_0x1f7e('0xca')](_0x3706b1)[_0x1f7e('0xb0')](loggerCatch(_0x1f7e('0x1c7')));if(_0x509a78[_0x1f7e('0x1a7')](0xb,_0x2fce22,_0x4206fd)&&!_0x245eaf){if(_0x3706b1['countabandonedretry']>=_0x4206fd['dialAbandonedMaxRetry']){_0x509a78[_0x1f7e('0xfd')](_0x3706b1,_0x4d1129,_0x254ed3,_0x1f7e('0x1c8'));}else{_0x509a78[_0x1f7e('0xfa')](_0x3706b1,_0x4d1129,_0x254ed3,_0x1f7e('0x1c8'));}}break;case'20':_0x4206fd[_0x1f7e('0x66')]+=0x1;_0x3706b1[_0x1f7e('0xe4')]=0x14;_0x3706b1[_0x1f7e('0xed')]=_0x1f7e('0x1c9');_0x3706b1[_0x1f7e('0xf8')]+=0x1;_0x3706b1[_0x1f7e('0xf1')]+=0x1;_0x1e73d9=_0x4206fd[_0x1f7e('0x1b3')];_0x12d163=_0x4206fd[_0x1f7e('0x120')];ami[_0x1f7e('0xe6')](_0x1f7e('0x1ca'),ut[_0x1f7e('0xe8')](_0x2fce22,'agentreject'));_0x509a78[_0x1f7e('0xca')](_0x3706b1)[_0x1f7e('0xb0')](loggerCatch(_0x1f7e('0x1cb')));if(_0x509a78['checkRetriveMax'](0x14,_0x2fce22,_0x4206fd)&&!_0x245eaf){if(_0x3706b1[_0x1f7e('0xf8')]>=_0x4206fd[_0x1f7e('0x1b2')]){_0x509a78[_0x1f7e('0xfd')](_0x3706b1,_0x4d1129,_0x254ed3,_0x1f7e('0x1cc'));}else{_0x509a78[_0x1f7e('0xfa')](_0x3706b1,_0x4d1129,_0x254ed3,_0x1f7e('0x1cc'));}}break;default:_0x4206fd[_0x1f7e('0x67')]+=0x1;_0x3706b1[_0x1f7e('0xe4')]=0xc;_0x3706b1[_0x1f7e('0xed')]=_0x3e62ca['reason'];_0x1e73d9=_0x4206fd[_0x1f7e('0x1b3')];_0x12d163=_0x4206fd[_0x1f7e('0x120')];_0x509a78[_0x1f7e('0xca')](_0x3706b1)[_0x1f7e('0xb0')](loggerCatch(_0x1f7e('0x1cd')));if(_0x509a78[_0x1f7e('0x1a7')](_0x3e62ca[_0x1f7e('0x10f')],_0x2fce22,_0x4206fd)&&!_0x245eaf){if(_0x3706b1[_0x1f7e('0xf3')]+_0x3706b1[_0x1f7e('0xf4')]+_0x3706b1['countnoanswerretry']+_0x3706b1['countnosuchnumberretry']+_0x3706b1['countdropretry']+_0x3706b1[_0x1f7e('0xf7')]+_0x3706b1[_0x1f7e('0xf0')]+_0x3706b1['countagentrejectretry']>=_0x4206fd['dialGlobalMaxRetry']){_0x509a78[_0x1f7e('0xfa')](_0x3706b1,_0x4d1129,_0x254ed3,_0x3e62ca[_0x1f7e('0x10f')]);}else{_0x509a78[_0x1f7e('0xfd')](_0x3706b1,_0x4d1129,_0x254ed3,_0x3e62ca[_0x1f7e('0x10f')]);}}}})['then'](function(){if(_0x245eaf){_0x509a78[_0x1f7e('0xb9')](_0x3706b1,_0x1e73d9,_0x12d163)['then'](function(){return _0x4d1129(0x1);});}});});};Dialer['prototype'][_0x1f7e('0xfa')]=function(_0x4b3aaf,_0x4f9aad,_0x15e7ad,_0x1bfcaa){var _0x40beec=new Final(_0x4b3aaf);_0x40beec[_0x1f7e('0xe4')]=0xf;_0x40beec['statedesc']=_0x1f7e('0x1ce');this[_0x1f7e('0xfd')](_0x40beec,_0x4f9aad,_0x15e7ad,_0x1bfcaa);};Dialer[_0x1f7e('0x18')][_0x1f7e('0xfd')]=function(_0x32c133,_0x114bbe,_0x35b7ac,_0x409b11){this[_0x1f7e('0xc8')](_0x32c133)[_0x1f7e('0x3c')](function(){return _0x114bbe(msgResponse(_0x1f7e('0x1b5'),'Success',_0x409b11));})[_0x1f7e('0xb0')](function(){return _0x35b7ac(msgResponse('[moveContactManagedDialer][0]',_0x1f7e('0x147'),_0x1f7e('0x1cf')));});};Dialer[_0x1f7e('0x18')]['predictive']=function(_0x4f8d3b){var _0x149087=_0x4f8d3b[_0x1f7e('0x1d0')]/0x64;var _0x293e52=_0x4f8d3b[_0x1f7e('0x63')]/(_0x4f8d3b[_0x1f7e('0x63')]+_0x4f8d3b[_0x1f7e('0x5e')]);var _0x16e713=Math[_0x1f7e('0x1d1')](_0x4f8d3b['predictiveIntervalAvailable']*(_0x4f8d3b['predictiveIntervalMaxThreshold']/0x64));var _0x47607f=Math[_0x1f7e('0x1d1')](_0x4f8d3b[_0x1f7e('0x6d')]*(_0x4f8d3b['predictiveIntervalMinThreshold']/0x64));var _0x5e2d1c=_0x4f8d3b[_0x1f7e('0x4e')]+_0x4f8d3b[_0x1f7e('0x53')];var _0x34cd57=Math['floor'](_0x4f8d3b[_0x1f7e('0x70')]*_0x4f8d3b[_0x1f7e('0x8b')]*_0x4f8d3b[_0x1f7e('0x6b')]*_0x4f8d3b[_0x1f7e('0x1d2')]);if(_[_0x1f7e('0x83')](_0x4f8d3b['startProgressive'])){if(!_['isUndefined'](_0x4f8d3b[_0x1f7e('0x26')])){_0x4f8d3b[_0x1f7e('0x26')]=undefined;loggerPredictive['error'](_0x1f7e('0x1d3'),_0x1f7e('0x1d4'));}if(!_[_0x1f7e('0x83')](_0x4f8d3b['handlePredictive'])){loggerPredictive[_0x1f7e('0x97')](_0x1f7e('0x1d3'),_0x1f7e('0x1d5'));clearInterval(_0x4f8d3b[_0x1f7e('0x91')]);_0x4f8d3b[_0x1f7e('0x91')]=undefined;}_0x4f8d3b[_0x1f7e('0x72')]=moment()[_0x1f7e('0x77')](_0x1f7e('0x102'));loggerPredictive[_0x1f7e('0x7c')](_0x4f8d3b['name'],_0x1f7e('0x1d6'),_0x4f8d3b[_0x1f7e('0x72')]);this['handlePower'](_0x4f8d3b,0x1);}else if(ifInterval(_0x4f8d3b[_0x1f7e('0x1d7')],_0x4f8d3b[_0x1f7e('0x72')])){this['handlePower'](_0x4f8d3b,0x1);loggerPredictiveCalls[_0x1f7e('0x7c')](_0x1f7e('0x1d8'),_0x4f8d3b[_0x1f7e('0x72')],_0x4f8d3b['name']);_0x4f8d3b['erlangCalls']=0x0;_0x4f8d3b[_0x1f7e('0x11a')]=0x0;}else if(_0x149087<_0x293e52&&_0x4f8d3b['dialPredictiveOptimization']===_0x1f7e('0x1d9')){freeVariablesPredictive(_0x4f8d3b);loggerPredictive[_0x1f7e('0x7c')](_0x1f7e('0x1da'),_0x1f7e('0x1db'),_0x293e52,_0x1f7e('0x72'),_0x4f8d3b[_0x1f7e('0x3f')]);}else if(_0x34cd57<_0x4f8d3b[_0x1f7e('0x11a')]&&_0x4f8d3b[_0x1f7e('0x1dc')]===_0x1f7e('0x1d9')){freeVariablesPredictive(_0x4f8d3b);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x1f7e('0x1dd'),_0x34cd57,_0x1f7e('0x1de'),_0x4f8d3b['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0x4f8d3b[_0x1f7e('0x3f')]);}else if(!ifInterval(_0x4f8d3b['dialPredictiveInterval'],_0x4f8d3b[_0x1f7e('0x72')])&&_[_0x1f7e('0x83')](_0x4f8d3b['startPredictive'])&&!_['isUndefined'](_0x4f8d3b['startProgressive'])){_0x4f8d3b[_0x1f7e('0x26')]=moment()[_0x1f7e('0x77')](_0x1f7e('0x102'));loggerPredictive[_0x1f7e('0x7c')](_0x4f8d3b[_0x1f7e('0x3f')],_0x1f7e('0x1df'),_0x4f8d3b[_0x1f7e('0x26')]);this[_0x1f7e('0xbc')](_0x4f8d3b[_0x1f7e('0x1d7')])[_0x1f7e('0x3c')](this[_0x1f7e('0x1e0')](_0x4f8d3b))[_0x1f7e('0x3c')](mergeDataErlangB(_0x4f8d3b))[_0x1f7e('0x3c')](this[_0x1f7e('0x1e1')](_0x4f8d3b))[_0x1f7e('0xb0')](loggerCatchPredictive(_0x1f7e('0x1e2'),_0x4f8d3b));}else if(!ifInterval(_0x4f8d3b[_0x1f7e('0x1d7')],_0x4f8d3b[_0x1f7e('0x26')])){_0x4f8d3b[_0x1f7e('0x11a')]=0x0;_0x4f8d3b[_0x1f7e('0x26')]=moment()[_0x1f7e('0x77')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x1f7e('0x7c')](_0x4f8d3b[_0x1f7e('0x3f')],_0x1f7e('0x1e3'),_0x4f8d3b[_0x1f7e('0x26')]);clearInterval(_0x4f8d3b[_0x1f7e('0x91')]);_0x4f8d3b[_0x1f7e('0x91')]=undefined;this['averageHandleTime'](_0x4f8d3b['dialPredictiveInterval'])[_0x1f7e('0x3c')](this[_0x1f7e('0x1e0')](_0x4f8d3b))[_0x1f7e('0x3c')](mergeDataErlangB(_0x4f8d3b))[_0x1f7e('0x3c')](this[_0x1f7e('0x1e1')](_0x4f8d3b))['catch'](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x4f8d3b));}else if(_0x4f8d3b['predictiveIntervalAvailable']&&_0x5e2d1c<_0x4f8d3b[_0x1f7e('0x6d')]-_0x47607f){freeVariablesPredictive(_0x4f8d3b);loggerPredictive[_0x1f7e('0x7c')](_0x4f8d3b['name'],_0x1f7e('0x1e4'),_0x5e2d1c,_0x1f7e('0x1e5'),_0x4f8d3b[_0x1f7e('0x6d')],'-',_0x47607f,'=',_0x4f8d3b[_0x1f7e('0x6d')]-_0x47607f,')');}else if(_0x4f8d3b[_0x1f7e('0x6d')]&&_0x5e2d1c>_0x4f8d3b[_0x1f7e('0x6d')]+_0x16e713){freeVariablesPredictive(_0x4f8d3b);loggerPredictive[_0x1f7e('0x7c')](_0x4f8d3b['name'],_0x1f7e('0x1e4'),_0x5e2d1c,_0x1f7e('0x1e6'),_0x4f8d3b[_0x1f7e('0x6d')],'+',_0x16e713,'=',_0x4f8d3b[_0x1f7e('0x6d')]+_0x16e713,')');}};Dialer[_0x1f7e('0x18')][_0x1f7e('0x1e0')]=function(_0x393b76){var _0x3809f8=this;return function(_0x547c9b){return new Promise(function(_0x5de703,_0x7eb002){_[_0x1f7e('0x8e')](_0x393b76,_0x547c9b[0x0]);if(checkGetDataPredictive(_0x547c9b[0x0])){var _0xa32689=_0x393b76[_0x1f7e('0x6d')]=_0x393b76['talking']+_0x393b76[_0x1f7e('0x4e')];var _0x5153d8=_0x393b76[_0x1f7e('0x1d7')]*0x3c;var _0x44fe4c=_0x547c9b[0x0][_0x1f7e('0x69')]+_0x547c9b[0x0][_0x1f7e('0x68')];var _0x1c84e1=(_0x547c9b[0x0][_0x1f7e('0x1e7')]+_0x547c9b[0x0][_0x1f7e('0x7e')]+_0x547c9b[0x0][_0x1f7e('0x6a')])/_0x547c9b[0x0][_0x1f7e('0x6e')];_0x393b76[_0x1f7e('0x6b')]=_0x1c84e1>0x0?_0x1c84e1:0x1;switch(_0x393b76[_0x1f7e('0x1dc')]){case _0x1f7e('0x1d9'):var _0x242168=_0x393b76['dialPredictiveOptimizationPercentage']/0x64;return _0x3809f8[_0x1f7e('0x1e8')](_0xa32689,_0x5153d8,_0x44fe4c,_0x1c84e1,_0x242168)[_0x1f7e('0x3c')](function(_0x154e03){return _0x5de703(_0x154e03);});case _0x1f7e('0x1e9'):var _0x5cf2dd=_0x393b76[_0x1f7e('0x1d0')]/0x64;return _0x3809f8[_0x1f7e('0x1ea')](_0xa32689,_0x5153d8,_0x44fe4c,_0x1c84e1,_0x5cf2dd)[_0x1f7e('0x3c')](function(_0x445064){return _0x5de703(_0x445064);});default:return _0x7eb002(msgResponse(_0x1f7e('0x1eb'),'Failure',_0x1f7e('0x1ec')));}}else{return _0x7eb002(msgResponse(_0x1f7e('0x1eb'),_0x1f7e('0x147'),_0x1f7e('0x1ed')));}});};};Dialer[_0x1f7e('0x18')][_0x1f7e('0x1ee')]=function(_0x49deb3){var _0x3f4244=this;return function(_0x15045e){return new Promise(function(_0x15468d,_0x1fd972){_['merge'](_0x49deb3,_0x15045e[0x0]);if(checkGetDataPredictive(_0x15045e[0x0])){loggerPredictive['info'](JSON['stringify'](_0x15045e[0x0]));if(_0x49deb3['dialPredictiveOptimization']==='dropRate'){return _0x3f4244[_0x1f7e('0xc6')](_0x49deb3['id'])[_0x1f7e('0x3c')](function(_0x5398bc){var _0x151b19=_0x49deb3[_0x1f7e('0x4f')]-_0x5398bc[0x0][_0x1f7e('0x1ef')];var _0x41a4b2=_0x49deb3[_0x1f7e('0x1d7')]*0x3c;var _0x439dcb=_0x15045e[0x0][_0x1f7e('0x69')]+_0x15045e[0x0][_0x1f7e('0x68')];var _0xcbaf=(_0x15045e[0x0][_0x1f7e('0x1e7')]+_0x15045e[0x0][_0x1f7e('0x7e')]+_0x15045e[0x0][_0x1f7e('0x6a')])/_0x15045e[0x0]['predictiveIntervalTotalCalls'];var _0x498e08=_0x49deb3['dialPredictiveOptimizationPercentage']/0x64;_0x49deb3['predictiveIntervalPauses']=_0x5398bc[0x0]['outboundQueuePauses']||0x0;_0x49deb3[_0x1f7e('0x6b')]=_0xcbaf>0x0?_0xcbaf:0x1;return _0x3f4244['abandonmentRate'](_0x151b19,_0x41a4b2,_0x439dcb,_0xcbaf,_0x498e08);})['then'](function(_0xfc65ea){return _0x15468d(_0xfc65ea);})[_0x1f7e('0xb0')](function(_0x2c28d2){return _0x1fd972(msgResponse(_0x1f7e('0x1f0'),_0x1f7e('0x147'),JSON['stringify'](_0x2c28d2)));});}if(_0x49deb3[_0x1f7e('0x1dc')]===_0x1f7e('0x1e9')){return _0x3f4244['getVoiceQueueRtPauses'](_0x49deb3['id'])[_0x1f7e('0x3c')](function(_0x551110){var _0x2de29d=_0x49deb3[_0x1f7e('0x4f')]-_0x551110[0x0][_0x1f7e('0x1ef')];var _0x2553d6=_0x49deb3[_0x1f7e('0x1d7')]*0x3c;var _0x1cc56=_0x15045e[0x0]['predictiveIntervalAvgTalktime']+_0x15045e[0x0][_0x1f7e('0x68')];var _0x3c8713=(_0x15045e[0x0][_0x1f7e('0x1e7')]+_0x15045e[0x0][_0x1f7e('0x7e')]+_0x15045e[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x15045e[0x0][_0x1f7e('0x6e')];var _0x116fb8=_0x49deb3[_0x1f7e('0x1d0')]/0x64;_0x49deb3[_0x1f7e('0x6c')]=_0x551110[0x0][_0x1f7e('0x1ef')]||0x0;_0x49deb3['predictiveIntervalHitRate']=_0x3c8713>0x0?_0x3c8713:0x1;return _0x3f4244[_0x1f7e('0x1ea')](_0x2de29d,_0x2553d6,_0x1cc56,_0x3c8713,_0x116fb8);})['then'](function(_0x1a1766){return _0x15468d(_0x1a1766);})[_0x1f7e('0xb0')](function(_0x54cbac){return _0x1fd972(msgResponse(_0x1f7e('0x1f0'),_0x1f7e('0x147'),JSON[_0x1f7e('0x48')](_0x54cbac)));});}}else{return _0x1fd972(msgResponse(_0x1f7e('0x1eb'),_0x1f7e('0x147'),'check\x20failure'));}});};};Dialer[_0x1f7e('0x18')]['startMethodPredictive']=function(_0x4af54d){var _0x410358=this;return function(){var _0x41555d=0x0;var _0x205957=Math[_0x1f7e('0x1f1')](_0x4af54d[_0x1f7e('0x71')]*0x3e8);if(_0x205957>0x0){_0x205957=_0x205957<0x64?0x64:_0x205957;loggerPredictive[_0x1f7e('0x7c')](_0x4af54d['name'],'one\x20call\x20every:',_0x205957,_0x1f7e('0x49'));_0x4af54d[_0x1f7e('0x91')]=setInterval(function(){_0x410358[_0x1f7e('0x91')](_0x4af54d);loggerPredictiveCalls[_0x1f7e('0x7c')](_0x1f7e('0x1f2'),_0x41555d+=0x1);},_0x205957);}else{loggerPredictive[_0x1f7e('0x7c')](_0x4af54d[_0x1f7e('0x3f')],_0x1f7e('0x1f3'));}};};Dialer[_0x1f7e('0x18')][_0x1f7e('0x1f4')]=function(_0x297259,_0x355d07){var _0x19c01b=this;return function(_0x5bad43){if(_['isEmpty'](_0x5bad43)){if(_[_0x1f7e('0xae')](_0x355d07[_0x1f7e('0xd3')])||!_0x355d07[_0x1f7e('0x1f5')]){if(_0x297259[_0x1f7e('0x58')]==='booked'){_0x297259[_0x1f7e('0x134')]=_[_0x1f7e('0x83')](_0x297259['queueStatusComplete'])?!![]:_0x297259[_0x1f7e('0x134')];var _0x108742=uuid['v4']();_0x19c01b[_0x1f7e('0xab')][_0x108742]=new Action(_0x297259,_0x355d07,_0x108742);loggerBooked['info']('[booked][checkContactBlack]',_0x108742,_0x1f7e('0x1f6'),JSON[_0x1f7e('0x48')](_0x297259[_0x1f7e('0x134')]),_0x1f7e('0x1f7'),_0x297259[_0x1f7e('0x3f')]);if(_0x297259['queueStatusComplete']){_0x297259[_0x1f7e('0x134')]=![];_0x19c01b[_0x1f7e('0x131')][_0x19c01b[_0x1f7e('0xab')][_0x108742][_0x1f7e('0xb1')]]=[];ami[_0x1f7e('0x14b')]({'actionid':_0x108742,'action':_0x1f7e('0x1f8'),'queue':_0x297259[_0x1f7e('0x3f')]})[_0x1f7e('0xb0')](function(){_0x19c01b[_0x1f7e('0xcf')](_0x297259);_0x19c01b[_0x1f7e('0xbf')]({'active':![],'ContactId':_0x19c01b[_0x1f7e('0xab')][_0x108742]['ContactId'],'ListId':_0x19c01b[_0x1f7e('0xab')][_0x108742][_0x1f7e('0x103')],'VoiceQueueId':_0x19c01b[_0x1f7e('0xab')][_0x108742][_0x1f7e('0xd4')]||undefined,'CampaignId':_0x19c01b[_0x1f7e('0xab')][_0x108742][_0x1f7e('0xd5')]||undefined})['catch'](loggerCatch(_0x1f7e('0x1f9')));delete _0x19c01b['actions'][_0x108742];});}else{loggerBooked[_0x1f7e('0x7c')]('[booked][checkContactBlack][else]',JSON[_0x1f7e('0x48')](_0x297259[_0x1f7e('0x134')]),_0x1f7e('0x1f7'),_0x297259[_0x1f7e('0x3f')]);_0x19c01b[_0x1f7e('0xcf')](_0x297259);_0x19c01b[_0x1f7e('0xbf')]({'active':![],'ContactId':_0x19c01b[_0x1f7e('0xab')][_0x108742]['ContactId'],'ListId':_0x19c01b['actions'][_0x108742][_0x1f7e('0x103')],'VoiceQueueId':_0x19c01b[_0x1f7e('0xab')][_0x108742][_0x1f7e('0xd4')]||undefined,'CampaignId':_0x19c01b['actions'][_0x108742][_0x1f7e('0xd5')]||undefined})[_0x1f7e('0xb0')](loggerCatch(_0x1f7e('0x1f9')));delete _0x19c01b[_0x1f7e('0xab')][_0x108742];}}else{return _0x19c01b[_0x1f7e('0x1fa')](_0x297259,_0x355d07);}}else{if(getDiff(_0x355d07['scheduledat'])<_0x297259['dialRecallMeTimeout']*0x3c){if(_0x355d07[_0x1f7e('0x16d')]&&!_0x355d07['Agent'][_0x1f7e('0x1fb')]){_0x19c01b[_0x1f7e('0x1c')]['run'](_0x355d07['id'])['finally'](function(){_0x19c01b[_0x1f7e('0xcf')](_0x297259);});}else{_0x19c01b['unlockContact']({'active':![]},_0x355d07['id'],0x1)[_0x1f7e('0x1b')](function(){_0x19c01b[_0x1f7e('0xcf')](_0x297259);});}}else{_0x297259[_0x1f7e('0x65')]+=0x1;_0x19c01b[_0x1f7e('0xcf')](_0x297259);if(_0x297259[_0x1f7e('0x1fc')]){_0x19c01b[_0x1f7e('0xbf')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x355d07[_0x1f7e('0xd2')],'ListId':_0x355d07[_0x1f7e('0x103')],'VoiceQueueId':_0x355d07[_0x1f7e('0xd4')]||undefined,'CampaignId':_0x355d07[_0x1f7e('0xd5')]||undefined})[_0x1f7e('0xb0')](loggerCatch(_0x1f7e('0x1fd')));_0x19c01b[_0x1f7e('0xca')](createObjHistory(_0x297259,_0x355d07,_0x1f7e('0x1fe'),0x17,_0x1f7e('0x1ff')))[_0x1f7e('0xb0')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x19c01b[_0x1f7e('0xd0')](createObjHistory(_0x297259,_0x355d07,_0x1f7e('0x200'),0x16,_0x1f7e('0x201')),_0x1f7e('0x202'),_0x1f7e('0x203'));}}}}else{_0x297259[_0x1f7e('0x204')]+=0x1;_0x19c01b[_0x1f7e('0xd0')](createObjHistory(_0x297259,_0x355d07,_0x1f7e('0x205'),0xd,_0x1f7e('0x206')),'[Originate][historyBlacklist]',_0x1f7e('0x207'));throw'inBlackList';}};};Dialer[_0x1f7e('0x18')]['handleIvr']=function(_0x148c62){var _0x42bb19=this;var _0x5a1190=_0x148c62['limitCalls']-_0x148c62[_0x1f7e('0x6f')]-_0x148c62[_0x1f7e('0xc3')];emitCampaignSummary(_0x148c62);if(_0x5a1190>0x0){if(_0x5a1190>this[_0x1f7e('0x21')]){_0x5a1190=this[_0x1f7e('0x21')];}_0x148c62[_0x1f7e('0xc3')]+=_0x5a1190;this[_0x1f7e('0xc5')](_0x148c62['id'],_0x5a1190,_0x148c62[_0x1f7e('0x208')],_0x148c62)[_0x1f7e('0x3c')](function(_0x4e75be){_0x148c62[_0x1f7e('0xc3')]-=_0x5a1190;_0x148c62[_0x1f7e('0xc3')]=_0x148c62[_0x1f7e('0xc3')]>0x0?_0x148c62[_0x1f7e('0xc3')]:0x0;if(!checkContactEmpty(_0x4e75be)){_0x148c62[_0x1f7e('0x3e')]=_0x1f7e('0x209');logger[_0x1f7e('0x7c')]('[getContactCampaign2][Empty]'+_0x148c62[_0x1f7e('0x3f')]);}else{_0x148c62['originated']+=_0x4e75be[_0x1f7e('0x99')];_0x148c62[_0x1f7e('0x3e')]='RUNNING';for(var _0x33c69d=0x0;_0x33c69d<_0x4e75be['length'];_0x33c69d+=0x1){_0x148c62[_0x1f7e('0x20a')]+=0x1;if(_['isNil'](_0x4e75be[_0x33c69d])||_[_0x1f7e('0xae')](_0x4e75be[_0x33c69d][_0x1f7e('0x190')])||_[_0x1f7e('0xae')](_0x4e75be[_0x33c69d][_0x1f7e('0x179')])){_0x42bb19[_0x1f7e('0x20b')](_0x1f7e('0x20c'),_0x148c62,_0x4e75be[_0x33c69d]);}else{_0x42bb19[_0x1f7e('0xbb')](_[_0x1f7e('0xd1')](_0x4e75be[_0x33c69d],[_0x1f7e('0xd5'),_0x1f7e('0x179')]))[_0x1f7e('0x3c')](_0x42bb19[_0x1f7e('0x1f4')](_0x148c62,_0x4e75be[_0x33c69d]))['catch'](_0x42bb19[_0x1f7e('0xce')](_0x1f7e('0x20d'),_0x148c62));}}}})[_0x1f7e('0xb0')](loggerGetContactDialer(_0x1f7e('0x20e'),_0x148c62,_0x5a1190));}};Dialer[_0x1f7e('0x18')]['handlePower']=function(_0x4bb8d7,_0x1dbae3){var _0x3a8590=this;var _0x5ebdd5=[];var _0x519b67=_0x1dbae3>=0x1?_0x1dbae3:0x1;if(_0x4bb8d7[_0x1f7e('0x58')]===_0x1f7e('0x15c')){_0x519b67=0x1;}var _0x588516=Math[_0x1f7e('0x1f1')](_0x4bb8d7['available']*_0x519b67)-_0x4bb8d7[_0x1f7e('0x6f')]-_0x4bb8d7[_0x1f7e('0xc3')];emitVoiceQueueSummary(_0x4bb8d7);if(_0x4bb8d7[_0x1f7e('0x20f')]>0x0){var _0x46581d=_0x4bb8d7[_0x1f7e('0x20f')]-_0x4bb8d7[_0x1f7e('0x6f')]-_0x4bb8d7[_0x1f7e('0x53')]-_0x4bb8d7[_0x1f7e('0xc3')]-_0x4bb8d7[_0x1f7e('0x210')];if(_0x588516>_0x46581d){_0x588516=_0x46581d;}}if(_0x588516>0x0){if(_0x4bb8d7[_0x1f7e('0x58')]===_0x1f7e('0x15c')){_0x588516=0x1;}if(_0x588516>this[_0x1f7e('0x21')]){_0x588516=this[_0x1f7e('0x21')];}_0x4bb8d7[_0x1f7e('0xc3')]+=_0x588516;for(var _0x12fc05 in this[_0x1f7e('0x1f')]){if(typeof this[_0x1f7e('0x1f')][_0x12fc05]!==_0x1f7e('0x9a')){if(this[_0x1f7e('0x1f')][_0x12fc05]['state']===_0x1f7e('0x211')&&this[_0x1f7e('0x1f')][_0x12fc05][_0x1f7e('0xdb')]===_0x1f7e('0xdc')){_0x5ebdd5[_0x1f7e('0x132')](this['agents'][_0x12fc05]['id']);}}}this['getContactDialer'](_0x4bb8d7['id'],_0x5ebdd5,_0x588516,_0x4bb8d7[_0x1f7e('0x208')],_0x4bb8d7)[_0x1f7e('0x3c')](function(_0x26384d){_0x4bb8d7[_0x1f7e('0xc3')]-=_0x588516;_0x4bb8d7['temp']=_0x4bb8d7[_0x1f7e('0xc3')]>0x0?_0x4bb8d7[_0x1f7e('0xc3')]:0x0;if(!checkContactEmpty(_0x26384d)){_0x3a8590[_0x1f7e('0xb4')](_0x4bb8d7)[_0x1f7e('0x3c')](sendMessageReschedule(_0x4bb8d7))['catch'](loggerCatch(_0x1f7e('0xb6')));}else{_0x4bb8d7[_0x1f7e('0x6f')]+=_0x26384d[_0x1f7e('0x99')];_0x4bb8d7[_0x1f7e('0x3e')]=_0x4bb8d7[_0x1f7e('0x58')]===_0x1f7e('0x15c')?_0x1f7e('0x180'):_0x1f7e('0x212');for(var _0x3c2d0e=0x0;_0x3c2d0e<_0x26384d[_0x1f7e('0x99')];_0x3c2d0e+=0x1){if(_[_0x1f7e('0xae')](_0x26384d[_0x3c2d0e])||_['isNil'](_0x26384d[_0x3c2d0e][_0x1f7e('0x190')])||_['isNil'](_0x26384d[_0x3c2d0e][_0x1f7e('0x179')])){_0x3a8590['emptyContact'](_0x1f7e('0x20c'),_0x4bb8d7,_0x26384d[_0x3c2d0e]);}else{_0x3a8590['checkIsBlackList'](_[_0x1f7e('0xd1')](_0x26384d[_0x3c2d0e],[_0x1f7e('0xd4'),_0x1f7e('0x179')]))[_0x1f7e('0x3c')](_0x3a8590[_0x1f7e('0x1f4')](_0x4bb8d7,_0x26384d[_0x3c2d0e]))[_0x1f7e('0xb0')](_0x3a8590[_0x1f7e('0xce')](_0x1f7e('0x20c'),_0x4bb8d7));}}}})[_0x1f7e('0xb0')](loggerGetContactDialer(_0x1f7e('0x213'),_0x4bb8d7,_0x588516));}};Dialer[_0x1f7e('0x18')][_0x1f7e('0x91')]=function(_0x529bc5){if(_0x529bc5['dialLimitQueue']>0x0){var _0x35f6d7=_0x529bc5[_0x1f7e('0x20f')]-_0x529bc5[_0x1f7e('0x6f')]-_0x529bc5['talking'];if(_0x35f6d7>0x0){this[_0x1f7e('0x214')](_0x529bc5);}else{loggerPredictiveCalls['info'](_0x1f7e('0x215'));}}else{this[_0x1f7e('0x214')](_0x529bc5);}};Dialer['prototype'][_0x1f7e('0x214')]=function(_0x333c70){var _0x43ab05=this;var _0x1f8282=[];_0x333c70[_0x1f7e('0x6f')]+=0x1;for(var _0x4fafd3 in this[_0x1f7e('0x1f')]){if(typeof this[_0x1f7e('0x1f')][_0x4fafd3]!=='undefined'){if(this[_0x1f7e('0x1f')][_0x4fafd3][_0x1f7e('0xe4')]===_0x1f7e('0x211')&&this[_0x1f7e('0x1f')][_0x4fafd3]['status']===_0x1f7e('0xdc')){_0x1f8282[_0x1f7e('0x132')](this[_0x1f7e('0x1f')][_0x4fafd3]['id']);}}}this[_0x1f7e('0xc2')](_0x333c70['id'],_0x1f8282,0x1,_0x333c70[_0x1f7e('0x208')],_0x333c70)[_0x1f7e('0x3c')](function(_0x26ca26){if(!checkContactEmpty(_0x26ca26)){checkContactLowerLimitOriginate(_0x333c70,0x1,0x0);_0x43ab05[_0x1f7e('0xb4')](_0x333c70)['then'](sendMessageReschedule(_0x333c70))[_0x1f7e('0xb0')](loggerCatch(_0x1f7e('0xb6')));}else{_0x333c70[_0x1f7e('0x3e')]=_0x1f7e('0x212');if(_[_0x1f7e('0xae')](_0x26ca26[0x0])||_[_0x1f7e('0xae')](_0x26ca26[0x0][_0x1f7e('0x190')])||_[_0x1f7e('0xae')](_0x26ca26[0x0][_0x1f7e('0x179')])){_0x43ab05[_0x1f7e('0x20b')](_0x1f7e('0x20c'),_0x333c70,_0x26ca26[0x0]);}else{_0x43ab05[_0x1f7e('0xb7')](_['pick'](_0x26ca26[0x0],['VoiceQueueId',_0x1f7e('0x179')]))['then'](_0x43ab05[_0x1f7e('0x1f4')](_0x333c70,_0x26ca26[0x0]))[_0x1f7e('0xb0')](_0x43ab05['loggerHandler']('[actionOriginatePredictive]\x20',_0x333c70));}}})[_0x1f7e('0xb0')](loggerGetContactDialer(_0x1f7e('0x216'),_0x333c70,0x1));emitVoiceQueueSummary(_0x333c70);};Dialer[_0x1f7e('0x18')][_0x1f7e('0x1e8')]=function(_0x2c53a9,_0x8cde11,_0x286c9e,_0x1fafa4,_0x38d4c8,_0x3e9428){loggerPredictive[_0x1f7e('0x7c')](_0x1f7e('0x217'));loggerPredictive[_0x1f7e('0x7c')]('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',_0x2c53a9);loggerPredictive[_0x1f7e('0x7c')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x8cde11);loggerPredictive['info'](_0x1f7e('0x218'),_0x286c9e);loggerPredictive[_0x1f7e('0x7c')](_0x1f7e('0x219'),_0x1fafa4);loggerPredictive[_0x1f7e('0x7c')](_0x1f7e('0x21a'),_0x38d4c8);loggerPredictive[_0x1f7e('0x7c')](_0x1f7e('0x82'));return new Promise(function(_0x410d68,_0x27016e){if(_0x2c53a9<=0x0||isNaN(_0x2c53a9)){return _0x27016e(msgResponse(_0x1f7e('0x21b'),_0x1f7e('0x1a1'),'m\x20=\x20'+_0x2c53a9));}if(_0x286c9e<=0x0||isNaN(_0x286c9e)){return _0x27016e(msgResponse('[abandonmentRate]',_0x1f7e('0x1a1'),_0x1f7e('0x21c')+_0x286c9e));}if(_0x1fafa4<=0x0||isNaN(_0x1fafa4)){return _0x27016e(msgResponse(_0x1f7e('0x21b'),'Error',_0x1f7e('0x21d')+_0x1fafa4));}if(_0x8cde11<=0x0||isNaN(_0x8cde11)){return _0x27016e(msgResponse('[abandonmentRate]',_0x1f7e('0x1a1'),_0x1f7e('0x21e')+_0x8cde11));}if(_0x38d4c8<=0x0||isNaN(_0x38d4c8)){return _0x27016e(msgResponse(_0x1f7e('0x21b'),_0x1f7e('0x1a1'),_0x1f7e('0x21f')+_0x38d4c8));}_0x3e9428=_0x3e9428||0x0;var _0x10f652=0x1/_0x286c9e;var _0x16dd8f=0x0;var _0x36bfdf=0x0;var _0x44ea02=0x0;var _0x5a8e04=0x0;for(var _0x5112ed=0x0;_0x44ea02<_0x38d4c8;_0x5112ed+=0x1){_0x36bfdf=_0x5112ed/_0x8cde11;_0x16dd8f=(_0x1fafa4*_0x36bfdf+_0x3e9428)/_0x10f652;_0x44ea02=erlangb(_0x16dd8f,_0x2c53a9);_0x5a8e04=_0x16dd8f/_0x2c53a9*(0x1-erlangb(_0x16dd8f,_0x2c53a9));}return _0x410d68({'erlangCalls':_0x5112ed,'erlangCallToSecond':_0x8cde11/_0x5112ed,'erlangAbandonmentRate':_0x44ea02,'erlangBusyFactor':_0x5a8e04});});};Dialer[_0x1f7e('0x18')][_0x1f7e('0x1ea')]=function(_0x246df5,_0x4ed0c9,_0x458594,_0xd6fac1,_0x19db33,_0xf12f5a){loggerPredictive[_0x1f7e('0x7c')](_0x1f7e('0x220'));loggerPredictive['info'](_0x1f7e('0x221'),_0x246df5);loggerPredictive[_0x1f7e('0x7c')](_0x1f7e('0x222'),_0x4ed0c9);loggerPredictive[_0x1f7e('0x7c')](_0x1f7e('0x218'),_0x458594);loggerPredictive[_0x1f7e('0x7c')]('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',_0xd6fac1);loggerPredictive['info'](_0x1f7e('0x223'),_0x19db33);loggerPredictive['info']('---------------------------');return new Promise(function(_0x49d076,_0x981ca1){if(_0x246df5<=0x0||isNaN(_0x246df5)){return _0x981ca1(msgResponse(_0x1f7e('0x224'),_0x1f7e('0x1a1'),'m\x20=\x20'+_0x246df5));}if(_0x458594<=0x0||isNaN(_0x458594)){return _0x981ca1(msgResponse(_0x1f7e('0x224'),_0x1f7e('0x1a1'),'Ts\x20=\x20'+_0x458594));}if(_0xd6fac1<=0x0||isNaN(_0xd6fac1)){return _0x981ca1(msgResponse(_0x1f7e('0x224'),_0x1f7e('0x1a1'),'p\x20=\x20'+_0xd6fac1));}if(_0x4ed0c9<=0x0||isNaN(_0x4ed0c9)){return _0x981ca1(msgResponse(_0x1f7e('0x224'),'Error',_0x1f7e('0x21e')+_0x4ed0c9));}if(_0x19db33<=0x0||isNaN(_0x19db33)){return _0x981ca1(msgResponse(_0x1f7e('0x224'),_0x1f7e('0x1a1'),'Umin\x20=\x20'+_0x19db33));}_0xf12f5a=_0xf12f5a||0x0;var _0xe17036=0x1/_0x458594;var _0x3266d3=0x0;var _0x309399=0x0;var _0x3d797f=0x0;var _0x5c0160=0x0;for(var _0x233b3e=0x0;_0x5c0160<_0x19db33;_0x233b3e+=0x1){_0x309399=_0x233b3e/_0x4ed0c9;_0x3266d3=(_0xd6fac1*_0x309399+_0xf12f5a)/_0xe17036;_0x3d797f=erlangb(_0x3266d3,_0x246df5);_0x5c0160=_0x3266d3/_0x246df5*(0x1-erlangb(_0x3266d3,_0x246df5));}return _0x49d076({'erlangCalls':_0x233b3e,'erlangCallToSecond':_0x4ed0c9/_0x233b3e,'erlangAbandonmentRate':_0x3d797f,'erlangBusyFactor':_0x5c0160});});};module[_0x1f7e('0x225')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 1f30a27..9433b2d 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 _0x4940=['countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','membername','reason','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countabandonedretry'];(function(_0x4f1a5b,_0x53c5f7){var _0x2a0e3a=function(_0x1fdffc){while(--_0x1fdffc){_0x4f1a5b['push'](_0x4f1a5b['shift']());}};_0x2a0e3a(++_0x53c5f7);}(_0x4940,0x192));var _0x0494=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x4940[_0x5d2803];return _0xdcad2c;};'use strict';var util=require(_0x0494('0x0'));var _=require(_0x0494('0x1'));var moment=require(_0x0494('0x2'));function getSeconds(_0x4f9bbd,_0x2338a7){var _0xca432b=moment(_0x4f9bbd)[_0x0494('0x3')](0x0);var _0x467f08=moment(_0x2338a7)[_0x0494('0x3')](0x0);return _0xca432b[_0x0494('0x4')](_0x467f08,_0x0494('0x5'));}function QueueCallerAbandon(_0x3930e4,_0x1b6581){this[_0x0494('0x6')]=_0x3930e4[_0x0494('0x6')];this[_0x0494('0x7')]=_0x3930e4[_0x0494('0x7')];this[_0x0494('0x8')]=_0x3930e4[_0x0494('0x7')]===_0x0494('0x9')?_0x0494('0xa'):_0x3930e4[_0x0494('0x7')];this[_0x0494('0xb')]=_0x3930e4[_0x0494('0xb')];this[_0x0494('0xc')]=_0x3930e4[_0x0494('0xc')];this[_0x0494('0xd')]=_0x3930e4[_0x0494('0xd')];this['countglobal']=_0x3930e4[_0x0494('0xb')]+_0x3930e4[_0x0494('0xc')]+_0x3930e4[_0x0494('0xd')]+_0x3930e4['countnosuchnumberretry']+_0x3930e4['countdropretry']+_0x3930e4['countabandonedretry']+_0x3930e4['countmachineretry']+_0x3930e4[_0x0494('0xe')];this[_0x0494('0xf')]=_0x3930e4['countnosuchnumberretry'];this[_0x0494('0x10')]=_0x3930e4['countdropretry'];this[_0x0494('0x11')]=_0x3930e4['countabandonedretry'];this[_0x0494('0x12')]=_0x3930e4[_0x0494('0x12')];this['countagentrejectretry']=_0x3930e4[_0x0494('0xe')];this[_0x0494('0x13')]=_0x1b6581[_0x0494('0x13')];this[_0x0494('0x14')]=_0x3930e4[_0x0494('0x15')];this[_0x0494('0x16')]=_0x3930e4[_0x0494('0x17')];this[_0x0494('0x18')]=_0x3930e4[_0x0494('0x18')];this[_0x0494('0x19')]=_0x3930e4[_0x0494('0x19')];this[_0x0494('0x1a')]=_0x3930e4[_0x0494('0x1a')];this[_0x0494('0x1b')]=this['droptime'];this[_0x0494('0x1c')]=getSeconds(_0x3930e4[_0x0494('0x19')],_0x3930e4[_0x0494('0x18')]);this[_0x0494('0x1d')]=getSeconds(this['droptime'],_0x3930e4[_0x0494('0x19')]);this[_0x0494('0x1e')]=0x0;this[_0x0494('0xa')]=_0x1b6581[_0x0494('0xa')];this[_0x0494('0x1f')]=_0x1b6581['connectedlinename'];this[_0x0494('0x20')]=_0x1b6581[_0x0494('0x20')];this[_0x0494('0x21')]=_0x3930e4[_0x0494('0x21')];this['callbackuniqueid']=_0x3930e4['callbackuniqueid'];this[_0x0494('0x22')]=_0x3930e4['callbackat'];this[_0x0494('0x23')]=_0x3930e4[_0x0494('0x23')];this[_0x0494('0x24')]=_0x3930e4['ContactId'];this[_0x0494('0x25')]=_0x3930e4['ListId'];this[_0x0494('0x26')]=_0x3930e4[_0x0494('0x26')];this[_0x0494('0x27')]=_0x3930e4['VoiceQueueId'];this[_0x0494('0x28')]=_0x3930e4[_0x0494('0x28')];this['originatecalleridnum']=_0x3930e4[_0x0494('0x29')]||'';this['originatecalleridname']=_0x3930e4['originatecalleridname']||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0x25ef=['originatecalleridname','util','moment','milliseconds','seconds','scheduledat','type','campaigntype','outbound','countbusyretry','countnoanswerretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','queue','connectedlinename','reason','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0x3c4a48,_0x2a74c4){var _0x5259ec=function(_0x21ac56){while(--_0x21ac56){_0x3c4a48['push'](_0x3c4a48['shift']());}};_0x5259ec(++_0x2a74c4);}(_0x25ef,0xf7));var _0xf25e=function(_0x5bdd4f,_0x59e3f4){_0x5bdd4f=_0x5bdd4f-0x0;var _0x35929e=_0x25ef[_0x5bdd4f];return _0x35929e;};'use strict';var util=require(_0xf25e('0x0'));var _=require('lodash');var moment=require(_0xf25e('0x1'));function getSeconds(_0x35fbb2,_0x23c690){var _0x55b7bb=moment(_0x35fbb2)[_0xf25e('0x2')](0x0);var _0x36249a=moment(_0x23c690)[_0xf25e('0x2')](0x0);return _0x55b7bb['diff'](_0x36249a,_0xf25e('0x3'));}function QueueCallerAbandon(_0x2d6829,_0x148f96){this['scheduledat']=_0x2d6829[_0xf25e('0x4')];this[_0xf25e('0x5')]=_0x2d6829[_0xf25e('0x5')];this[_0xf25e('0x6')]=_0x2d6829[_0xf25e('0x5')]===_0xf25e('0x7')?'queue':_0x2d6829[_0xf25e('0x5')];this[_0xf25e('0x8')]=_0x2d6829['countbusyretry'];this['countcongestionretry']=_0x2d6829['countcongestionretry'];this['countnoanswerretry']=_0x2d6829[_0xf25e('0x9')];this['countglobal']=_0x2d6829[_0xf25e('0x8')]+_0x2d6829[_0xf25e('0xa')]+_0x2d6829[_0xf25e('0x9')]+_0x2d6829[_0xf25e('0xb')]+_0x2d6829[_0xf25e('0xc')]+_0x2d6829[_0xf25e('0xd')]+_0x2d6829[_0xf25e('0xe')]+_0x2d6829[_0xf25e('0xf')];this[_0xf25e('0xb')]=_0x2d6829[_0xf25e('0xb')];this[_0xf25e('0xc')]=_0x2d6829[_0xf25e('0xc')];this['countabandonedretry']=_0x2d6829[_0xf25e('0xd')];this[_0xf25e('0xe')]=_0x2d6829[_0xf25e('0xe')];this[_0xf25e('0xf')]=_0x2d6829[_0xf25e('0xf')];this['uniqueid']=_0x148f96[_0xf25e('0x10')];this[_0xf25e('0x11')]=_0x2d6829[_0xf25e('0x12')];this[_0xf25e('0x13')]=_0x2d6829[_0xf25e('0x14')];this[_0xf25e('0x15')]=_0x2d6829['starttime'];this[_0xf25e('0x16')]=_0x2d6829['responsetime'];this[_0xf25e('0x17')]=_0x2d6829[_0xf25e('0x17')];this[_0xf25e('0x18')]=this['droptime'];this[_0xf25e('0x19')]=getSeconds(_0x2d6829[_0xf25e('0x16')],_0x2d6829['starttime']);this[_0xf25e('0x1a')]=getSeconds(this[_0xf25e('0x17')],_0x2d6829[_0xf25e('0x16')]);this[_0xf25e('0x1b')]=0x0;this[_0xf25e('0x1c')]=_0x148f96[_0xf25e('0x1c')];this['membername']=_0x148f96[_0xf25e('0x1d')];this[_0xf25e('0x1e')]=_0x148f96[_0xf25e('0x1e')];this['callback']=_0x2d6829[_0xf25e('0x1f')];this['callbackuniqueid']=_0x2d6829[_0xf25e('0x20')];this['callbackat']=_0x2d6829['callbackat'];this[_0xf25e('0x21')]=_0x2d6829[_0xf25e('0x21')];this['ContactId']=_0x2d6829[_0xf25e('0x22')];this[_0xf25e('0x23')]=_0x2d6829[_0xf25e('0x23')];this[_0xf25e('0x24')]=_0x2d6829[_0xf25e('0x24')];this[_0xf25e('0x25')]=_0x2d6829[_0xf25e('0x25')];this[_0xf25e('0x26')]=_0x2d6829['CampaignId'];this[_0xf25e('0x27')]=_0x2d6829[_0xf25e('0x27')]||'';this[_0xf25e('0x28')]=_0x2d6829[_0xf25e('0x28')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 762b918..0ba2323 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(_0x54142f,_0x586bc8){var _0x30d516=function(_0x5cc317){while(--_0x5cc317){_0x54142f['push'](_0x54142f['shift']());}};_0x30d516(++_0x586bc8);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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(_0x4aca32,_0x476f90){var _0x34c60a=function(_0x2d55ae){while(--_0x2d55ae){_0x4aca32['push'](_0x4aca32['shift']());}};_0x34c60a(++_0x476f90);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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 d4f3ff3..bcbec1c 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 _0x9a55=['isNil','active','SIP/%s','reachable','checkTrunk','\x20Trunk\x20is\x20not\x20active','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','./rpcDb','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','receivefax','syncReceiveFax','hangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','create','parse','.pdf','application/pdf','notify','fax','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','response','reason','AttachmentId','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','syncHangup','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','[Fax][execOriginate][success]','message','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','FaxAccountId','Trunk','isValid','Trunk\x20Reachable','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','format','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable'];(function(_0x2a0900,_0x55838f){var _0x1e013c=function(_0x426a0d){while(--_0x426a0d){_0x2a0900['push'](_0x2a0900['shift']());}};_0x1e013c(++_0x55838f);}(_0x9a55,0x80));var _0x59a5=function(_0x1adbd2,_0xfa59f5){_0x1adbd2=_0x1adbd2-0x0;var _0x5da8dc=_0x9a55[_0x1adbd2];return _0x5da8dc;};'use strict';var util=require(_0x59a5('0x0'));var _=require(_0x59a5('0x1'));var BPromise=require(_0x59a5('0x2'));var uuid=require(_0x59a5('0x3'));var moment=require(_0x59a5('0x4'));var path=require(_0x59a5('0x5'));var tiff2pdf=require(_0x59a5('0x6'));var gs=require(_0x59a5('0x7'));var logger=require(_0x59a5('0x8'))('fax');var ami=require('../ami');var rpcDb=require(_0x59a5('0x9'));var Channel=require('./channel');var ut=require('./util/util');var Action=require(_0x59a5('0xa'));var faxAccount=require(_0x59a5('0xb'));var attachment=require(_0x59a5('0xc'));var faxMessage=require(_0x59a5('0xd'));function Fax(_0x1a2d9f){this[_0x59a5('0xe')]={};this[_0x59a5('0xf')]=_0x1a2d9f[_0x59a5('0xf')];this[_0x59a5('0x10')]=_0x1a2d9f[_0x59a5('0x10')];this[_0x59a5('0x11')]={};ami['on'](_0x59a5('0x12'),this[_0x59a5('0x13')][_0x59a5('0x14')](this));ami['on'](_0x59a5('0x15'),this[_0x59a5('0x16')][_0x59a5('0x14')](this));ami['on'](_0x59a5('0x17'),this[_0x59a5('0x18')]['bind'](this));ami['on'](_0x59a5('0x19'),this[_0x59a5('0x1a')][_0x59a5('0x14')](this));ami['on'](_0x59a5('0x1b'),this['syncFaxStatus']['bind'](this));ami['on'](_0x59a5('0x1c'),this[_0x59a5('0x1d')][_0x59a5('0x14')](this));ami['on'](_0x59a5('0x1e'),this['syncHangup']['bind'](this));ami['on'](_0x59a5('0x1f'),this[_0x59a5('0x20')][_0x59a5('0x14')](this));}Fax[_0x59a5('0x21')]['syncNewchannel']=function(_0x51f759){if(_0x51f759[_0x59a5('0x22')]===_0x59a5('0x23')){for(var _0x3f7055 in this[_0x59a5('0xf')]){if(this['faxAccounts'][_0x59a5('0x24')](_0x3f7055)){if(_0x51f759['exten']===this['faxAccounts'][_0x3f7055][_0x59a5('0x25')]){this[_0x59a5('0xe')][_0x51f759[_0x59a5('0x26')]]={};this[_0x59a5('0xe')][_0x51f759['uniqueid']]['channel']=_0x51f759[_0x59a5('0x27')];this['channels'][_0x51f759[_0x59a5('0x26')]]['id']=this[_0x59a5('0xf')][_0x3f7055]['id'];this[_0x59a5('0xe')][_0x51f759[_0x59a5('0x26')]][_0x59a5('0x28')]=this[_0x59a5('0xf')][_0x3f7055]['name'];logger[_0x59a5('0x29')](_0x51f759[_0x59a5('0x26')],'\x20syncNewchannel\x20');}}}}if(this[_0x59a5('0x11')][_0x51f759[_0x59a5('0x26')]]){this[_0x59a5('0xe')][_0x51f759[_0x59a5('0x26')]]={};this['channels'][_0x51f759[_0x59a5('0x26')]][_0x59a5('0x27')]=_0x51f759['channel'];logger[_0x59a5('0x29')](_0x51f759[_0x59a5('0x26')],_0x59a5('0x2a'));}};Fax[_0x59a5('0x21')]['syncVarSet']=function(_0x577e10){if(this[_0x59a5('0xe')][_0x577e10[_0x59a5('0x26')]]){for(var _0x41c6dc in _0x577e10[_0x59a5('0x2b')]){if(_0x577e10['variable'][_0x59a5('0x24')](_0x41c6dc)){this[_0x59a5('0xe')][_0x577e10[_0x59a5('0x26')]][_0x41c6dc]=_0x577e10[_0x59a5('0x2c')];}}}};Fax[_0x59a5('0x21')]['syncNewState']=function(_0x343d2b){if(this[_0x59a5('0xe')][_0x343d2b['uniqueid']]){this['channels'][_0x343d2b[_0x59a5('0x26')]][_0x59a5('0x2d')]=_0x343d2b[_0x59a5('0x2d')];this[_0x59a5('0xe')][_0x343d2b[_0x59a5('0x26')]][_0x59a5('0x2e')]=_0x343d2b[_0x59a5('0x2e')];}};Fax[_0x59a5('0x21')][_0x59a5('0x1a')]=function(_0x57440d){if(this[_0x59a5('0xe')][_0x57440d[_0x59a5('0x26')]]){for(var _0x37e8cb in _0x57440d[_0x59a5('0x2b')]){if(_0x57440d['variable']['hasOwnProperty'](_0x37e8cb)){this['channels'][_0x57440d[_0x59a5('0x26')]][_0x37e8cb]=_0x57440d[_0x59a5('0x2c')];}}}};Fax['prototype']['syncFaxStatus']=function(_0x520e4a){if(this['channels'][_0x520e4a[_0x59a5('0x26')]]){this[_0x59a5('0xe')][_0x520e4a[_0x59a5('0x26')]]['operation']=_0x520e4a['operation'];this[_0x59a5('0xe')][_0x520e4a[_0x59a5('0x26')]][_0x59a5('0x2f')]=_0x520e4a[_0x59a5('0x2f')];this[_0x59a5('0xe')][_0x520e4a[_0x59a5('0x26')]][_0x59a5('0x25')]=_0x520e4a[_0x59a5('0x25')];this[_0x59a5('0xe')][_0x520e4a[_0x59a5('0x26')]]['filename']=_0x520e4a[_0x59a5('0x30')];logger[_0x59a5('0x29')](_0x520e4a[_0x59a5('0x26')],_0x59a5('0x31'));}};Fax['prototype'][_0x59a5('0x1d')]=function(_0x2d0b5b){var _0x17a73d=this;if(this[_0x59a5('0xe')][_0x2d0b5b[_0x59a5('0x26')]]){var _0x11cc94=this[_0x59a5('0xe')][_0x2d0b5b['uniqueid']]['id'];this[_0x59a5('0xe')][_0x2d0b5b[_0x59a5('0x26')]][_0x59a5('0x32')]=_0x2d0b5b[_0x59a5('0x32')];this[_0x59a5('0xe')][_0x2d0b5b[_0x59a5('0x26')]]['pagestransferred']=_0x2d0b5b[_0x59a5('0x33')];this[_0x59a5('0xe')][_0x2d0b5b[_0x59a5('0x26')]][_0x59a5('0x25')]=_0x2d0b5b['localstationid'];this[_0x59a5('0xe')][_0x2d0b5b[_0x59a5('0x26')]][_0x59a5('0x34')]=_0x2d0b5b['resolution'];this['channels'][_0x2d0b5b[_0x59a5('0x26')]][_0x59a5('0x35')]=_0x2d0b5b['transferrate'];this['channels'][_0x2d0b5b[_0x59a5('0x26')]]['filename']=_0x2d0b5b[_0x59a5('0x30')];this[_0x59a5('0xe')][_0x2d0b5b['uniqueid']][_0x59a5('0x36')]=_0x2d0b5b['calleridnum'];if(this[_0x59a5('0xe')][_0x2d0b5b[_0x59a5('0x26')]][_0x59a5('0x33')]>0x0){tiff2pdf(_0x2d0b5b[_0x59a5('0x30')],'/var/opt/motion2/server/files/attachments/',function(_0x172965){logger['info'](_0x2d0b5b[_0x59a5('0x26')],'\x20result\x20conversion\x20file\x20',_0x172965['message']);attachment[_0x59a5('0x37')]({'name':path[_0x59a5('0x38')](_0x2d0b5b[_0x59a5('0x30')])[_0x59a5('0x28')],'basename':path[_0x59a5('0x38')](_0x2d0b5b['filename'])[_0x59a5('0x28')]+_0x59a5('0x39'),'type':_0x59a5('0x3a')})['then'](function(_0x3e082a){faxAccount[_0x59a5('0x3b')](_0x11cc94,{'from':_0x2d0b5b[_0x59a5('0x36')],'mapKey':_0x59a5('0x3c'),'body':path[_0x59a5('0x38')](_0x2d0b5b[_0x59a5('0x30')])[_0x59a5('0x28')]+_0x59a5('0x39'),'AttachmentId':_0x3e082a['id']})[_0x59a5('0x3d')](function(_0x367194){logger[_0x59a5('0x3e')](_0x2d0b5b[_0x59a5('0x26')],_0x59a5('0x3f'),JSON[_0x59a5('0x40')](_0x367194));});})[_0x59a5('0x3d')](function(_0x51ad6e){logger[_0x59a5('0x3e')](_0x2d0b5b[_0x59a5('0x26')],'\x20receiveFax\x20',JSON[_0x59a5('0x40')](_0x51ad6e));});});}logger[_0x59a5('0x29')](_0x2d0b5b[_0x59a5('0x26')],_0x59a5('0x41'));}};Fax['prototype'][_0x59a5('0x20')]=function(_0x327869){if(this['actions'][_0x327869[_0x59a5('0x26')]]){_['merge'](this[_0x59a5('0xe')][_0x327869[_0x59a5('0x26')]],_['pick'](_0x327869,[_0x59a5('0x42'),_0x59a5('0x43')]));}};function updateStatus(_0x5791fb){if(_0x5791fb[_0x59a5('0x44')]){faxMessage['update'](_0x5791fb[_0x59a5('0x44')],{'failMessage':_0x59a5('0x45')})[_0x59a5('0x46')](function(_0x1d41f2){ut[_0x59a5('0x47')]('[Fax][Message][Error][Updated]',_0x1d41f2);})['catch'](function(_0xa655b5){ut[_0x59a5('0x47')](_0x59a5('0x48'),_0xa655b5);});}else{ut[_0x59a5('0x47')](_0x59a5('0x49'));}}Fax[_0x59a5('0x21')][_0x59a5('0x4a')]=function(_0x2a1601,_0x3c150c,_0x13f2ba){var _0x328af8=this;var _0x1c3517={};if(_0x3c150c){_0x1c3517={'read':_0x3c150c};}else{_0x1c3517={'failMessage':_0x13f2ba};}if(this[_0x59a5('0x11')][_0x2a1601][_0x59a5('0x44')]){faxMessage[_0x59a5('0x4b')](this['actions'][_0x2a1601][_0x59a5('0x44')],_0x1c3517)[_0x59a5('0x46')](function(_0x41dbd3){ut[_0x59a5('0x47')](_0x59a5('0x4c'),_0x41dbd3);})[_0x59a5('0x3d')](function(_0x21a373){ut[_0x59a5('0x47')](_0x59a5('0x4d'),_0x21a373);})[_0x59a5('0x4e')](function(){delete _0x328af8[_0x59a5('0xe')][_0x2a1601];delete _0x328af8[_0x59a5('0x11')][_0x2a1601];});}else{ut[_0x59a5('0x47')]('[Fax][Message][NoUpdate2]');delete this[_0x59a5('0xe')][_0x2a1601];delete this[_0x59a5('0x11')][_0x2a1601];}};Fax['prototype'][_0x59a5('0x4f')]=function(_0x334e1c){var _0x4cad5a=this;if(this[_0x59a5('0xe')][_0x334e1c[_0x59a5('0x26')]]){if(this[_0x59a5('0x11')][_0x334e1c[_0x59a5('0x26')]]){this[_0x59a5('0xe')][_0x334e1c['uniqueid']]['id']=this['actions'][_0x334e1c['uniqueid']]['id'];this[_0x59a5('0xe')][_0x334e1c[_0x59a5('0x26')]][_0x59a5('0x28')]=this[_0x59a5('0x11')][_0x334e1c[_0x59a5('0x26')]][_0x59a5('0x28')];}logger[_0x59a5('0x29')](_0x334e1c[_0x59a5('0x26')],this[_0x59a5('0x11')][_0x334e1c[_0x59a5('0x26')]]?'\x20hangup\x20sendFile\x20':'\x20hangup\x20faxRiceive\x20',JSON[_0x59a5('0x40')](this['channels'][_0x334e1c[_0x59a5('0x26')]]));if(this[_0x59a5('0x11')][_0x334e1c[_0x59a5('0x26')]]){if(this[_0x59a5('0xe')][_0x334e1c['uniqueid']][_0x59a5('0x50')]>0x0&&this[_0x59a5('0xe')][_0x334e1c[_0x59a5('0x26')]][_0x59a5('0x1b')]===_0x59a5('0x51')){this[_0x59a5('0x4a')](_0x334e1c[_0x59a5('0x26')],!![]);}else{this[_0x59a5('0x4a')](_0x334e1c[_0x59a5('0x26')],![],this[_0x59a5('0xe')][_0x334e1c[_0x59a5('0x26')]][_0x59a5('0x52')]?_0x59a5('0x53')+this[_0x59a5('0xe')][_0x334e1c['uniqueid']][_0x59a5('0x52')]:_0x59a5('0x54'));}}}};Fax[_0x59a5('0x21')][_0x59a5('0x55')]=function(_0xa0a3d){var _0x1ac5ce=this;return new BPromise(function(_0x26c197,_0x3e06bb){_0x1ac5ce[_0x59a5('0x56')](_0xa0a3d,_0x1ac5ce[_0x59a5('0xf')][_0xa0a3d['FaxAccountId']])[_0x59a5('0x46')](function(_0x428d2d){ut[_0x59a5('0x47')](_0x59a5('0x57'),_0x428d2d);_0x26c197(ut[_0x59a5('0x58')](_0x59a5('0x59')));})[_0x59a5('0x3d')](function(_0x52231e){ut[_0x59a5('0x47')](_0x59a5('0x5a'),_0x52231e);updateStatus(_0xa0a3d);_0x3e06bb(ut[_0x59a5('0x58')](_0x59a5('0x5b')));});});};Fax[_0x59a5('0x21')][_0x59a5('0x5c')]=function(_0x298321){var _0x4e4120=this;return new BPromise(function(_0x6e1f76,_0x92c14b){var _0x2f1a8a=_0x4e4120['checkTrunk'](_0x4e4120['faxAccounts'][_0x298321[_0x59a5('0x5d')]][_0x59a5('0x5e')],_0x298321);if(_0x2f1a8a[_0x59a5('0x5f')]){_0x6e1f76(ut['message'](_0x59a5('0x60')));}else{_0x92c14b(ut[_0x59a5('0x58')](_0x2f1a8a[_0x59a5('0x58')]));}});};function originate(_0x303c81,_0x3030bb,_0x1bed71){return new BPromise(function(_0x51abc8,_0x46e355){if(_0x1bed71){var _0x492769=util['format'](_0x59a5('0x61'),path[_0x59a5('0x38')](_0x303c81[_0x59a5('0x5')])[_0x59a5('0x28')],_0x303c81[_0x59a5('0x5')]);gs[_0x59a5('0x62')](_0x492769)['then'](function(){_0x303c81[_0x59a5('0x5')]=util[_0x59a5('0x63')]('%s/%s.tif',path[_0x59a5('0x38')](_0x303c81['path'])[_0x59a5('0x64')],path[_0x59a5('0x38')](_0x303c81[_0x59a5('0x5')])['name']);_0x3030bb[_0x59a5('0x65')]=_0x303c81[_0x59a5('0x5')];ut[_0x59a5('0x47')](_0x59a5('0x66'),'');ami[_0x59a5('0x67')](ut[_0x59a5('0x68')](_0x303c81,_0x3030bb))['then'](function(_0x164bf9){_0x51abc8(_0x164bf9);})[_0x59a5('0x3d')](function(_0x47cf3c){_0x46e355(_0x47cf3c);});})[_0x59a5('0x3d')](function(_0x48416b){_0x46e355(_0x48416b);});}else{ami[_0x59a5('0x67')](ut[_0x59a5('0x68')](_0x303c81,_0x3030bb))['then'](function(_0x57459b){_0x51abc8(_0x57459b);})[_0x59a5('0x3d')](function(_0x553c72){_0x46e355(_0x553c72);});}});}Fax[_0x59a5('0x21')][_0x59a5('0x56')]=function(_0x48aada,_0x393163){var _0x19db95=this;return new BPromise(function(_0x2ead4c,_0x25a217){var _0x21a5fb=uuid['v4']();var _0x34debd=ut[_0x59a5('0x69')](_0x48aada,_0x393163);_0x19db95[_0x59a5('0x11')][_0x21a5fb]=new Action(_0x21a5fb,_0x393163,_0x48aada);var _0x3904ca=_0x19db95['actions'][_0x21a5fb];if(path[_0x59a5('0x38')](_0x48aada[_0x59a5('0x5')])[_0x59a5('0x6a')]===_0x59a5('0x39')){originate(_0x3904ca,_0x34debd,!![])[_0x59a5('0x46')](function(_0x343cae){_0x2ead4c(_0x343cae);})[_0x59a5('0x3d')](function(_0x31803e){_0x25a217(_0x31803e);});}else{originate(_0x3904ca,_0x34debd,![])[_0x59a5('0x46')](function(_0x5bc62c){_0x2ead4c(_0x5bc62c);})[_0x59a5('0x3d')](function(_0x5044ec){_0x25a217(_0x5044ec);});}});};Fax[_0x59a5('0x21')][_0x59a5('0x6b')]=function(_0x2f0eae){return!_[_0x59a5('0x6c')](_0x2f0eae)&&!_[_0x59a5('0x6c')](_0x2f0eae[_0x59a5('0x28')])&&!_[_0x59a5('0x6c')](_0x2f0eae[_0x59a5('0x6d')])&&_0x2f0eae[_0x59a5('0x6d')]&&!_['isNil'](this[_0x59a5('0x10')][util['format']('SIP/%s',_0x2f0eae[_0x59a5('0x28')])])&&!_[_0x59a5('0x6c')](this['trunks'][util['format'](_0x59a5('0x6e'),_0x2f0eae[_0x59a5('0x28')])][_0x59a5('0x2f')])&&(this['trunks'][util[_0x59a5('0x63')](_0x59a5('0x6e'),_0x2f0eae[_0x59a5('0x28')])][_0x59a5('0x2f')]===_0x59a5('0x6f')||this[_0x59a5('0x10')][util[_0x59a5('0x63')](_0x59a5('0x6e'),_0x2f0eae['name'])][_0x59a5('0x2f')]==='unmonitored');};Fax[_0x59a5('0x21')][_0x59a5('0x70')]=function(_0x2a3087,_0x177df8){if(!this[_0x59a5('0x6b')](_0x2a3087)){ut[_0x59a5('0x47')]('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_['isNil'](_0x2a3087)?'':_0x2a3087['name']+_0x59a5('0x71'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0x59a5('0x6c')](_0x177df8[_0x59a5('0x3c')])){ut[_0x59a5('0x47')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x59a5('0x40')](_0x177df8));return{'isValid':![],'message':_0x59a5('0x72')};}if(_[_0x59a5('0x6c')](_0x177df8[_0x59a5('0x5')])){ut[_0x59a5('0x47')](_0x59a5('0x73'),JSON[_0x59a5('0x40')](_0x177df8));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x59a5('0x74')};};module[_0x59a5('0x75')]=Fax; \ No newline at end of file +var _0x1cc0=['Empty\x20path','Is\x20Valid','util','lodash','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','newstate','syncNewState','bind','newexten','faxstatus','syncFaxStatus','receivefax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','hasOwnProperty','exten','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','syncVarSet','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','info','\x20result\x20conversion\x20file\x20','message','.pdf','application/pdf','notify','catch','error','stringify','\x20receiveFax\x20','pick','response','AttachmentId','update','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','parse','execute','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isNil','active','SIP/%s','reachable','checkTrunk','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','fax','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]'];(function(_0x10df1e,_0xf56f85){var _0x3e24fb=function(_0x5cdb59){while(--_0x5cdb59){_0x10df1e['push'](_0x10df1e['shift']());}};_0x3e24fb(++_0xf56f85);}(_0x1cc0,0x1ea));var _0x01cc=function(_0x328037,_0x2e8896){_0x328037=_0x328037-0x0;var _0x38ddba=_0x1cc0[_0x328037];return _0x38ddba;};'use strict';var util=require(_0x01cc('0x0'));var _=require(_0x01cc('0x1'));var BPromise=require('bluebird');var uuid=require(_0x01cc('0x2'));var moment=require(_0x01cc('0x3'));var path=require(_0x01cc('0x4'));var tiff2pdf=require(_0x01cc('0x5'));var gs=require(_0x01cc('0x6'));var logger=require(_0x01cc('0x7'))('fax');var ami=require(_0x01cc('0x8'));var rpcDb=require(_0x01cc('0x9'));var Channel=require(_0x01cc('0xa'));var ut=require(_0x01cc('0xb'));var Action=require(_0x01cc('0xc'));var faxAccount=require(_0x01cc('0xd'));var attachment=require('../rpc/attachment');var faxMessage=require('../rpc/faxMessage');function Fax(_0x3dc966){this[_0x01cc('0xe')]={};this['faxAccounts']=_0x3dc966[_0x01cc('0xf')];this[_0x01cc('0x10')]=_0x3dc966[_0x01cc('0x10')];this[_0x01cc('0x11')]={};ami['on'](_0x01cc('0x12'),this[_0x01cc('0x13')]['bind'](this));ami['on']('varset',this['syncVarSet']['bind'](this));ami['on'](_0x01cc('0x14'),this[_0x01cc('0x15')][_0x01cc('0x16')](this));ami['on'](_0x01cc('0x17'),this['syncNewExten'][_0x01cc('0x16')](this));ami['on'](_0x01cc('0x18'),this[_0x01cc('0x19')][_0x01cc('0x16')](this));ami['on'](_0x01cc('0x1a'),this['syncReceiveFax'][_0x01cc('0x16')](this));ami['on'](_0x01cc('0x1b'),this[_0x01cc('0x1c')][_0x01cc('0x16')](this));ami['on'](_0x01cc('0x1d'),this[_0x01cc('0x1e')][_0x01cc('0x16')](this));}Fax[_0x01cc('0x1f')]['syncNewchannel']=function(_0x23408a){if(_0x23408a[_0x01cc('0x20')]==='from-voip-provider'){for(var _0x567b7e in this[_0x01cc('0xf')]){if(this[_0x01cc('0xf')][_0x01cc('0x21')](_0x567b7e)){if(_0x23408a[_0x01cc('0x22')]===this[_0x01cc('0xf')][_0x567b7e][_0x01cc('0x23')]){this['channels'][_0x23408a[_0x01cc('0x24')]]={};this[_0x01cc('0xe')][_0x23408a[_0x01cc('0x24')]][_0x01cc('0x25')]=_0x23408a[_0x01cc('0x25')];this[_0x01cc('0xe')][_0x23408a[_0x01cc('0x24')]]['id']=this[_0x01cc('0xf')][_0x567b7e]['id'];this[_0x01cc('0xe')][_0x23408a[_0x01cc('0x24')]][_0x01cc('0x26')]=this[_0x01cc('0xf')][_0x567b7e][_0x01cc('0x26')];logger['info'](_0x23408a[_0x01cc('0x24')],_0x01cc('0x27'));}}}}if(this[_0x01cc('0x11')][_0x23408a['uniqueid']]){this['channels'][_0x23408a[_0x01cc('0x24')]]={};this[_0x01cc('0xe')][_0x23408a['uniqueid']][_0x01cc('0x25')]=_0x23408a['channel'];logger['info'](_0x23408a[_0x01cc('0x24')],'\x20syncNewchannel\x20');}};Fax['prototype'][_0x01cc('0x28')]=function(_0x117327){if(this[_0x01cc('0xe')][_0x117327[_0x01cc('0x24')]]){for(var _0x335c5e in _0x117327[_0x01cc('0x29')]){if(_0x117327[_0x01cc('0x29')][_0x01cc('0x21')](_0x335c5e)){this[_0x01cc('0xe')][_0x117327[_0x01cc('0x24')]][_0x335c5e]=_0x117327[_0x01cc('0x2a')];}}}};Fax[_0x01cc('0x1f')][_0x01cc('0x15')]=function(_0x404231){if(this['channels'][_0x404231[_0x01cc('0x24')]]){this[_0x01cc('0xe')][_0x404231[_0x01cc('0x24')]][_0x01cc('0x2b')]=_0x404231[_0x01cc('0x2b')];this[_0x01cc('0xe')][_0x404231[_0x01cc('0x24')]][_0x01cc('0x2c')]=_0x404231[_0x01cc('0x2c')];}};Fax['prototype']['syncNewExten']=function(_0x11f161){if(this['channels'][_0x11f161[_0x01cc('0x24')]]){for(var _0x30744d in _0x11f161[_0x01cc('0x29')]){if(_0x11f161[_0x01cc('0x29')][_0x01cc('0x21')](_0x30744d)){this[_0x01cc('0xe')][_0x11f161['uniqueid']][_0x30744d]=_0x11f161[_0x01cc('0x2a')];}}}};Fax[_0x01cc('0x1f')][_0x01cc('0x19')]=function(_0x8a5891){if(this[_0x01cc('0xe')][_0x8a5891[_0x01cc('0x24')]]){this[_0x01cc('0xe')][_0x8a5891['uniqueid']][_0x01cc('0x2d')]=_0x8a5891[_0x01cc('0x2d')];this[_0x01cc('0xe')][_0x8a5891['uniqueid']]['status']=_0x8a5891[_0x01cc('0x2e')];this[_0x01cc('0xe')][_0x8a5891['uniqueid']][_0x01cc('0x23')]=_0x8a5891[_0x01cc('0x23')];this[_0x01cc('0xe')][_0x8a5891[_0x01cc('0x24')]]['filename']=_0x8a5891[_0x01cc('0x2f')];logger['info'](_0x8a5891['uniqueid'],_0x01cc('0x30'));}};Fax['prototype'][_0x01cc('0x31')]=function(_0x1abb81){var _0x14226d=this;if(this[_0x01cc('0xe')][_0x1abb81[_0x01cc('0x24')]]){var _0x404fdb=this[_0x01cc('0xe')][_0x1abb81[_0x01cc('0x24')]]['id'];this[_0x01cc('0xe')][_0x1abb81[_0x01cc('0x24')]][_0x01cc('0x32')]=_0x1abb81['remotestationid'];this[_0x01cc('0xe')][_0x1abb81[_0x01cc('0x24')]][_0x01cc('0x33')]=_0x1abb81[_0x01cc('0x33')];this['channels'][_0x1abb81['uniqueid']]['localstationid']=_0x1abb81[_0x01cc('0x23')];this[_0x01cc('0xe')][_0x1abb81[_0x01cc('0x24')]][_0x01cc('0x34')]=_0x1abb81['resolution'];this[_0x01cc('0xe')][_0x1abb81[_0x01cc('0x24')]][_0x01cc('0x35')]=_0x1abb81[_0x01cc('0x35')];this['channels'][_0x1abb81[_0x01cc('0x24')]][_0x01cc('0x2f')]=_0x1abb81['filename'];this[_0x01cc('0xe')][_0x1abb81[_0x01cc('0x24')]]['calleridnum']=_0x1abb81[_0x01cc('0x36')];if(this[_0x01cc('0xe')][_0x1abb81[_0x01cc('0x24')]][_0x01cc('0x33')]>0x0){tiff2pdf(_0x1abb81[_0x01cc('0x2f')],'/var/opt/motion2/server/files/attachments/',function(_0x1d7cf6){logger[_0x01cc('0x37')](_0x1abb81[_0x01cc('0x24')],_0x01cc('0x38'),_0x1d7cf6[_0x01cc('0x39')]);attachment['create']({'name':path['parse'](_0x1abb81[_0x01cc('0x2f')])[_0x01cc('0x26')],'basename':path['parse'](_0x1abb81['filename'])[_0x01cc('0x26')]+_0x01cc('0x3a'),'type':_0x01cc('0x3b')})['then'](function(_0x5eb13d){faxAccount[_0x01cc('0x3c')](_0x404fdb,{'from':_0x1abb81[_0x01cc('0x36')],'mapKey':'fax','body':path['parse'](_0x1abb81[_0x01cc('0x2f')])[_0x01cc('0x26')]+_0x01cc('0x3a'),'AttachmentId':_0x5eb13d['id']})[_0x01cc('0x3d')](function(_0x3da986){logger[_0x01cc('0x3e')](_0x1abb81['uniqueid'],'\x20notify\x20',JSON[_0x01cc('0x3f')](_0x3da986));});})[_0x01cc('0x3d')](function(_0x4337ab){logger['error'](_0x1abb81[_0x01cc('0x24')],_0x01cc('0x40'),JSON[_0x01cc('0x3f')](_0x4337ab));});});}logger['info'](_0x1abb81[_0x01cc('0x24')],_0x01cc('0x40'));}};Fax[_0x01cc('0x1f')]['syncOriginateResponse']=function(_0x47929d){if(this['actions'][_0x47929d[_0x01cc('0x24')]]){_['merge'](this['channels'][_0x47929d['uniqueid']],_[_0x01cc('0x41')](_0x47929d,[_0x01cc('0x42'),'reason']));}};function updateStatus(_0x2d9f87){if(_0x2d9f87[_0x01cc('0x43')]){faxMessage[_0x01cc('0x44')](_0x2d9f87[_0x01cc('0x43')],{'failMessage':_0x01cc('0x45')})[_0x01cc('0x46')](function(_0x5eff30){ut[_0x01cc('0x47')](_0x01cc('0x48'),_0x5eff30);})[_0x01cc('0x3d')](function(_0x88ec7e){ut['logger'](_0x01cc('0x49'),_0x88ec7e);});}else{ut[_0x01cc('0x47')](_0x01cc('0x4a'));}}Fax[_0x01cc('0x1f')][_0x01cc('0x4b')]=function(_0x271fd9,_0x32650f,_0x4d702d){var _0x95d1c5=this;var _0x1a7b95={};if(_0x32650f){_0x1a7b95={'read':_0x32650f};}else{_0x1a7b95={'failMessage':_0x4d702d};}if(this['actions'][_0x271fd9][_0x01cc('0x43')]){faxMessage[_0x01cc('0x44')](this[_0x01cc('0x11')][_0x271fd9][_0x01cc('0x43')],_0x1a7b95)['then'](function(_0x2ce0f5){ut[_0x01cc('0x47')]('[Fax][Message][Updated]',_0x2ce0f5);})['catch'](function(_0x9cc030){ut[_0x01cc('0x47')](_0x01cc('0x4c'),_0x9cc030);})[_0x01cc('0x4d')](function(){delete _0x95d1c5[_0x01cc('0xe')][_0x271fd9];delete _0x95d1c5[_0x01cc('0x11')][_0x271fd9];});}else{ut[_0x01cc('0x47')](_0x01cc('0x4e'));delete this['channels'][_0x271fd9];delete this[_0x01cc('0x11')][_0x271fd9];}};Fax[_0x01cc('0x1f')][_0x01cc('0x1c')]=function(_0xb9c33b){var _0xadb313=this;if(this[_0x01cc('0xe')][_0xb9c33b[_0x01cc('0x24')]]){if(this['actions'][_0xb9c33b['uniqueid']]){this['channels'][_0xb9c33b[_0x01cc('0x24')]]['id']=this[_0x01cc('0x11')][_0xb9c33b[_0x01cc('0x24')]]['id'];this[_0x01cc('0xe')][_0xb9c33b['uniqueid']][_0x01cc('0x26')]=this['actions'][_0xb9c33b[_0x01cc('0x24')]][_0x01cc('0x26')];}logger[_0x01cc('0x37')](_0xb9c33b['uniqueid'],this[_0x01cc('0x11')][_0xb9c33b['uniqueid']]?_0x01cc('0x4f'):_0x01cc('0x50'),JSON[_0x01cc('0x3f')](this['channels'][_0xb9c33b[_0x01cc('0x24')]]));if(this[_0x01cc('0x11')][_0xb9c33b[_0x01cc('0x24')]]){if(this[_0x01cc('0xe')][_0xb9c33b['uniqueid']][_0x01cc('0x51')]>0x0&&this[_0x01cc('0xe')][_0xb9c33b['uniqueid']][_0x01cc('0x18')]===_0x01cc('0x52')){this[_0x01cc('0x4b')](_0xb9c33b['uniqueid'],!![]);}else{this[_0x01cc('0x4b')](_0xb9c33b[_0x01cc('0x24')],![],this[_0x01cc('0xe')][_0xb9c33b[_0x01cc('0x24')]]['faxstatusstring']?_0x01cc('0x53')+this[_0x01cc('0xe')][_0xb9c33b[_0x01cc('0x24')]][_0x01cc('0x54')]:_0x01cc('0x55'));}}}};Fax[_0x01cc('0x1f')]['send']=function(_0x2f021a){var _0x3584a2=this;return new BPromise(function(_0x3c25c4,_0x9a846e){_0x3584a2[_0x01cc('0x56')](_0x2f021a,_0x3584a2[_0x01cc('0xf')][_0x2f021a[_0x01cc('0x57')]])[_0x01cc('0x46')](function(_0xc5d771){ut[_0x01cc('0x47')](_0x01cc('0x58'),_0xc5d771);_0x3c25c4(ut[_0x01cc('0x39')](_0x01cc('0x59')));})['catch'](function(_0x3a92c3){ut[_0x01cc('0x47')](_0x01cc('0x5a'),_0x3a92c3);updateStatus(_0x2f021a);_0x9a846e(ut[_0x01cc('0x39')](_0x01cc('0x5b')));});});};Fax[_0x01cc('0x1f')][_0x01cc('0x5c')]=function(_0x5deb4c){var _0x3f9612=this;return new BPromise(function(_0x176928,_0x4a8b1b){var _0x3707eb=_0x3f9612['checkTrunk'](_0x3f9612[_0x01cc('0xf')][_0x5deb4c[_0x01cc('0x57')]][_0x01cc('0x5d')],_0x5deb4c);if(_0x3707eb[_0x01cc('0x5e')]){_0x176928(ut['message'](_0x01cc('0x5f')));}else{_0x4a8b1b(ut['message'](_0x3707eb[_0x01cc('0x39')]));}});};function originate(_0x41fe41,_0x4cd82e,_0x22d71a){return new BPromise(function(_0x54fb57,_0x363b30){if(_0x22d71a){var _0x1df1ce=util[_0x01cc('0x60')](_0x01cc('0x61'),path[_0x01cc('0x62')](_0x41fe41['path'])['name'],_0x41fe41[_0x01cc('0x4')]);gs[_0x01cc('0x63')](_0x1df1ce)[_0x01cc('0x46')](function(){_0x41fe41[_0x01cc('0x4')]=util[_0x01cc('0x60')]('%s/%s.tif',path[_0x01cc('0x62')](_0x41fe41[_0x01cc('0x4')])[_0x01cc('0x64')],path[_0x01cc('0x62')](_0x41fe41[_0x01cc('0x4')])['name']);_0x4cd82e[_0x01cc('0x65')]=_0x41fe41[_0x01cc('0x4')];ut[_0x01cc('0x47')](_0x01cc('0x66'),'');ami[_0x01cc('0x67')](ut[_0x01cc('0x68')](_0x41fe41,_0x4cd82e))[_0x01cc('0x46')](function(_0x5d51e5){_0x54fb57(_0x5d51e5);})['catch'](function(_0x58df23){_0x363b30(_0x58df23);});})[_0x01cc('0x3d')](function(_0xa31b23){_0x363b30(_0xa31b23);});}else{ami[_0x01cc('0x67')](ut[_0x01cc('0x68')](_0x41fe41,_0x4cd82e))['then'](function(_0x532ed8){_0x54fb57(_0x532ed8);})[_0x01cc('0x3d')](function(_0xbebab8){_0x363b30(_0xbebab8);});}});}Fax[_0x01cc('0x1f')]['execOriginate']=function(_0x35648f,_0x232c72){var _0x3a6d32=this;return new BPromise(function(_0x237da3,_0x8e9940){var _0x348956=uuid['v4']();var _0x170777=ut[_0x01cc('0x69')](_0x35648f,_0x232c72);_0x3a6d32[_0x01cc('0x11')][_0x348956]=new Action(_0x348956,_0x232c72,_0x35648f);var _0x473fd6=_0x3a6d32[_0x01cc('0x11')][_0x348956];if(path[_0x01cc('0x62')](_0x35648f[_0x01cc('0x4')])[_0x01cc('0x6a')]==='.pdf'){originate(_0x473fd6,_0x170777,!![])[_0x01cc('0x46')](function(_0x5233cc){_0x237da3(_0x5233cc);})[_0x01cc('0x3d')](function(_0xd754af){_0x8e9940(_0xd754af);});}else{originate(_0x473fd6,_0x170777,![])[_0x01cc('0x46')](function(_0x21b77a){_0x237da3(_0x21b77a);})[_0x01cc('0x3d')](function(_0x25eec8){_0x8e9940(_0x25eec8);});}});};Fax[_0x01cc('0x1f')]['isTrunkReachable']=function(_0x549a82){return!_[_0x01cc('0x6b')](_0x549a82)&&!_[_0x01cc('0x6b')](_0x549a82['name'])&&!_[_0x01cc('0x6b')](_0x549a82[_0x01cc('0x6c')])&&_0x549a82['active']&&!_[_0x01cc('0x6b')](this['trunks'][util[_0x01cc('0x60')](_0x01cc('0x6d'),_0x549a82[_0x01cc('0x26')])])&&!_[_0x01cc('0x6b')](this[_0x01cc('0x10')][util['format']('SIP/%s',_0x549a82[_0x01cc('0x26')])][_0x01cc('0x2e')])&&(this[_0x01cc('0x10')][util[_0x01cc('0x60')]('SIP/%s',_0x549a82[_0x01cc('0x26')])][_0x01cc('0x2e')]===_0x01cc('0x6e')||this[_0x01cc('0x10')][util['format']('SIP/%s',_0x549a82['name'])]['status']==='unmonitored');};Fax[_0x01cc('0x1f')][_0x01cc('0x6f')]=function(_0xd33b05,_0x51b180){if(!this[_0x01cc('0x70')](_0xd33b05)){ut[_0x01cc('0x47')](_0x01cc('0x71'),_[_0x01cc('0x6b')](_0xd33b05)?'':_0xd33b05[_0x01cc('0x26')]+_0x01cc('0x72'));return{'isValid':![],'message':_0x01cc('0x73')};}if(_[_0x01cc('0x6b')](_0x51b180[_0x01cc('0x74')])){ut[_0x01cc('0x47')](_0x01cc('0x75'),JSON[_0x01cc('0x3f')](_0x51b180));return{'isValid':![],'message':_0x01cc('0x76')};}if(_[_0x01cc('0x6b')](_0x51b180[_0x01cc('0x4')])){ut[_0x01cc('0x47')](_0x01cc('0x77'),JSON[_0x01cc('0x3f')](_0x51b180));return{'isValid':![],'message':_0x01cc('0x78')};}return{'isValid':!![],'message':_0x01cc('0x79')};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index faf71d3..01f018c 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 _0xc3a2=['resolve','notify','[Notify]\x20','util','../../../config/logger','preview','../rpc/faxAccount','error','inspect'];(function(_0x29c3f3,_0x17cc26){var _0x420c9e=function(_0x5c660c){while(--_0x5c660c){_0x29c3f3['push'](_0x29c3f3['shift']());}};_0x420c9e(++_0x17cc26);}(_0xc3a2,0x93));var _0x2c3a=function(_0x20585d,_0x251d36){_0x20585d=_0x20585d-0x0;var _0x250615=_0xc3a2[_0x20585d];return _0x250615;};'use strict';var util=require(_0x2c3a('0x0'));var BPromise=require('bluebird');var logger=require(_0x2c3a('0x1'))(_0x2c3a('0x2'));var _=require('lodash');var faxAccount=require(_0x2c3a('0x3'));function loggerCatch(_0x2ee2f1){return function(_0x44f172){logger[_0x2c3a('0x4')](_0x2ee2f1,util[_0x2c3a('0x5')](_0x44f172,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x31268a,_0x151f57){return BPromise[_0x2c3a('0x6')]()['then'](faxAccount[_0x2c3a('0x7')](_0x31268a,_0x151f57))['catch'](loggerCatch(_0x2c3a('0x8')));}; \ No newline at end of file +var _0xfd56=['[Notify]\x20','util','../../../config/logger','../rpc/faxAccount','inspect','notify','resolve','then','catch'];(function(_0x507c4d,_0x2d41a7){var _0x31d098=function(_0x487ca9){while(--_0x487ca9){_0x507c4d['push'](_0x507c4d['shift']());}};_0x31d098(++_0x2d41a7);}(_0xfd56,0x76));var _0x6fd5=function(_0x147b8d,_0x5ac7a9){_0x147b8d=_0x147b8d-0x0;var _0x282034=_0xfd56[_0x147b8d];return _0x282034;};'use strict';var util=require(_0x6fd5('0x0'));var BPromise=require('bluebird');var logger=require(_0x6fd5('0x1'))('preview');var _=require('lodash');var faxAccount=require(_0x6fd5('0x2'));function loggerCatch(_0x235e80){return function(_0x3dc466){logger['error'](_0x235e80,util[_0x6fd5('0x3')](_0x3dc466,{'showHidden':![],'depth':null}));};}exports[_0x6fd5('0x4')]=function(_0x51a3e8,_0x340f6f){return BPromise[_0x6fd5('0x5')]()[_0x6fd5('0x6')](faxAccount[_0x6fd5('0x4')](_0x51a3e8,_0x340f6f))[_0x6fd5('0x7')](loggerCatch(_0x6fd5('0x8')));}; \ 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 ce74e0f..a2c4171 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 _0xd514=['execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird','child_process','exec'];(function(_0x2296fb,_0x1b1d96){var _0x338b9d=function(_0x4e5188){while(--_0x4e5188){_0x2296fb['push'](_0x2296fb['shift']());}};_0x338b9d(++_0x1b1d96);}(_0xd514,0x186));var _0x4d51=function(_0x27b1f7,_0x324786){_0x27b1f7=_0x27b1f7-0x0;var _0x4d9c10=_0xd514[_0x27b1f7];return _0x4d9c10;};'use strict';var util=require(_0x4d51('0x0'));var logger=require(_0x4d51('0x1'))(_0x4d51('0x2'));var BPromise=require(_0x4d51('0x3'));var exec=require(_0x4d51('0x4'))[_0x4d51('0x5')];exports[_0x4d51('0x6')]=function(_0x197637){return new BPromise(function(_0x3f8825,_0x3ada59){exec(_0x197637,function(_0x294e8a,_0x48d163,_0x39d202){logger[_0x4d51('0x7')](_0x4d51('0x8'),_0x48d163);if(_0x294e8a){logger['info'](_0x4d51('0x8'),_0x4d51('0x9'),util[_0x4d51('0xa')](_0x294e8a,{'showHidden':![],'depth':null}),_0x48d163,_0x39d202);_0x3ada59(_0x294e8a);}_0x3f8825(_0x48d163);});});}; \ No newline at end of file +var _0xb02a=['bluebird','child_process','exec','info','Exec\x20gs','inspect','util','../../../../config/logger','fax'];(function(_0x5cb97e,_0x132a39){var _0x1714b4=function(_0x384210){while(--_0x384210){_0x5cb97e['push'](_0x5cb97e['shift']());}};_0x1714b4(++_0x132a39);}(_0xb02a,0x9f));var _0xab02=function(_0x2a6d65,_0x464f53){_0x2a6d65=_0x2a6d65-0x0;var _0x4ca229=_0xb02a[_0x2a6d65];return _0x4ca229;};'use strict';var util=require(_0xab02('0x0'));var logger=require(_0xab02('0x1'))(_0xab02('0x2'));var BPromise=require(_0xab02('0x3'));var exec=require(_0xab02('0x4'))[_0xab02('0x5')];exports['execute']=function(_0x2db0d6){return new BPromise(function(_0x507dac,_0x43e681){exec(_0x2db0d6,function(_0x5c6199,_0x35c9e2,_0x292af1){logger[_0xab02('0x6')](_0xab02('0x7'),_0x35c9e2);if(_0x5c6199){logger[_0xab02('0x6')](_0xab02('0x7'),'\x20Error\x20:',util[_0xab02('0x8')](_0x5c6199,{'showHidden':![],'depth':null}),_0x35c9e2,_0x292af1);_0x43e681(_0x5c6199);}_0x507dac(_0x35c9e2);});});}; \ 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 0efe706..846d135 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 _0x1191=['info','inspect','addVariables','ecm','headerinfo','minrate','format','\x22%s\x22','gateway','uniqueid','originate','channel','xcally-motion-fax','from-sip','util','lodash','moment','../../../../config/logger','fax'];(function(_0x51bf6a,_0x5a2f9a){var _0x514024=function(_0x2eabba){while(--_0x2eabba){_0x51bf6a['push'](_0x51bf6a['shift']());}};_0x514024(++_0x5a2f9a);}(_0x1191,0x1d6));var _0x1119=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x1191[_0x167cc1];return _0x10bc4b;};'use strict';var util=require(_0x1119('0x0'));var _=require(_0x1119('0x1'));var moment=require(_0x1119('0x2'));var logger=require(_0x1119('0x3'))(_0x1119('0x4'));exports['message']=function(_0x1556e2){return{'message':_0x1556e2};};exports['logger']=function(_0xf9d9ef,_0x4293f1){logger[_0x1119('0x5')](_0xf9d9ef,util[_0x1119('0x6')](_0x4293f1,{'showHidden':![],'depth':null}));};exports[_0x1119('0x7')]=function(_0x5b6fcd,_0x490c47){var _0x1ec130={'XMF-ECM':_0x490c47[_0x1119('0x8')],'XMF-HEADERINFO':_0x490c47[_0x1119('0x9')],'XMF-MINRATE':_0x490c47[_0x1119('0xa')],'XMF-MAXRATE':_0x490c47['maxrate'],'XMF-MODEM':util[_0x1119('0xb')](_0x1119('0xc'),_0x490c47['modem']),'XMF-GATEWAY':_0x490c47[_0x1119('0xd')],'XMF-FAXDETECT':_0x490c47['faxdetect'],'XMF-T38TIMEOUT':_0x490c47['t38timeout'],'XMF-LOCALSTATIONID':_0x490c47['localstationid'],'XMF-PATH':_0x5b6fcd['path']};return _0x1ec130;};exports['variablesAction']=function(_0x36dfb4,_0x5b02db){return{'actionid':_0x36dfb4[_0x1119('0xe')],'action':_0x1119('0xf'),'channel':_0x36dfb4[_0x1119('0x10')],'Exten':_0x1119('0x11'),'Context':_0x1119('0x12'),'Priority':'1','callerid':util[_0x1119('0xb')]('\x22%s\x22\x20<%s>',_0x36dfb4[_0x1119('0x9')]?_0x36dfb4['headerinfo']:'',_0x36dfb4['localstationid']),'variable':_0x5b02db,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x36dfb4[_0x1119('0xe')]};}; \ No newline at end of file +var _0x7355=['moment','../../../../config/logger','fax','message','logger','info','addVariables','ecm','headerinfo','maxrate','format','\x22%s\x22','modem','gateway','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','from-sip','\x22%s\x22\x20<%s>','util','lodash'];(function(_0xc3b861,_0x4049eb){var _0x241fb6=function(_0x427740){while(--_0x427740){_0xc3b861['push'](_0xc3b861['shift']());}};_0x241fb6(++_0x4049eb);}(_0x7355,0x175));var _0x5735=function(_0x405587,_0x3f7e47){_0x405587=_0x405587-0x0;var _0x2a8c40=_0x7355[_0x405587];return _0x2a8c40;};'use strict';var util=require(_0x5735('0x0'));var _=require(_0x5735('0x1'));var moment=require(_0x5735('0x2'));var logger=require(_0x5735('0x3'))(_0x5735('0x4'));exports[_0x5735('0x5')]=function(_0xb089de){return{'message':_0xb089de};};exports[_0x5735('0x6')]=function(_0x3ad395,_0x153d28){logger[_0x5735('0x7')](_0x3ad395,util['inspect'](_0x153d28,{'showHidden':![],'depth':null}));};exports[_0x5735('0x8')]=function(_0x21063c,_0x286475){var _0x502348={'XMF-ECM':_0x286475[_0x5735('0x9')],'XMF-HEADERINFO':_0x286475[_0x5735('0xa')],'XMF-MINRATE':_0x286475['minrate'],'XMF-MAXRATE':_0x286475[_0x5735('0xb')],'XMF-MODEM':util[_0x5735('0xc')](_0x5735('0xd'),_0x286475[_0x5735('0xe')]),'XMF-GATEWAY':_0x286475[_0x5735('0xf')],'XMF-FAXDETECT':_0x286475['faxdetect'],'XMF-T38TIMEOUT':_0x286475[_0x5735('0x10')],'XMF-LOCALSTATIONID':_0x286475[_0x5735('0x11')],'XMF-PATH':_0x21063c[_0x5735('0x12')]};return _0x502348;};exports[_0x5735('0x13')]=function(_0x52e1c6,_0xee1045){return{'actionid':_0x52e1c6[_0x5735('0x14')],'action':_0x5735('0x15'),'channel':_0x52e1c6[_0x5735('0x16')],'Exten':'xcally-motion-fax','Context':_0x5735('0x17'),'Priority':'1','callerid':util[_0x5735('0xc')](_0x5735('0x18'),_0x52e1c6[_0x5735('0xa')]?_0x52e1c6[_0x5735('0xa')]:'',_0x52e1c6['localstationid']),'variable':_0xee1045,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x52e1c6[_0x5735('0x14')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 65c87a5..ba374ba 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 _0xf7cc=['./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','ami','get','hour','resolve','then','getAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','inspect','sync','catch','error','[index.js][main]','moment','./server','./realtime','./acw','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/voiceExtension'];(function(_0x5af8c8,_0x4fd43d){var _0x3bbd8f=function(_0x3b903d){while(--_0x3b903d){_0x5af8c8['push'](_0x5af8c8['shift']());}};_0x3bbd8f(++_0x4fd43d);}(_0xf7cc,0x145));var _0xcf7c=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xf7cc[_0x3ab51d];return _0x29a04e;};'use strict';var BPromise=require('bluebird');var util=require('util');var moment=require(_0xcf7c('0x0'));var server=require(_0xcf7c('0x1'));var Realtime=require(_0xcf7c('0x2'));var Report=require('./report');var Acw=require(_0xcf7c('0x3'));var Trigger=require('./trigger');var Dialer=require(_0xcf7c('0x4'));var Preview=require(_0xcf7c('0x5'));var Fax=require(_0xcf7c('0x6'));var user=require('./rpc/user');var voiceQueue=require(_0xcf7c('0x7'));var voiceQueueReport=require(_0xcf7c('0x8'));var voiceCallReport=require(_0xcf7c('0x9'));var trunk=require(_0xcf7c('0xa'));var trigger=require(_0xcf7c('0xb'));var template=require(_0xcf7c('0xc'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0xcf7c('0xd'));var voiceExtension=require(_0xcf7c('0xe'));var faxAccount=require(_0xcf7c('0xf'));var zendesk=require(_0xcf7c('0x10'));var salesforce=require(_0xcf7c('0x11'));var sugarcrm=require(_0xcf7c('0x12'));var freshdesk=require(_0xcf7c('0x13'));var desk=require('./rpc/integrations/desk');var zoho=require(_0xcf7c('0x14'));var vtiger=require(_0xcf7c('0x15'));var freshsales=require(_0xcf7c('0x16'));var servicenow=require(_0xcf7c('0x17'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0xcf7c('0x18'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get']('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xcf7c('0x19')](_0xcf7c('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xcf7c('0x1b')]()[_0xcf7c('0x1c')](user[_0xcf7c('0x1d')]())[_0xcf7c('0x1c')](realtime['initAgents']())[_0xcf7c('0x1c')](user[_0xcf7c('0x1e')]())[_0xcf7c('0x1c')](realtime[_0xcf7c('0x1f')]())[_0xcf7c('0x1c')](trunk[_0xcf7c('0x20')]())['then'](realtime['initTrunks']())[_0xcf7c('0x1c')](voiceQueue[_0xcf7c('0x21')]())[_0xcf7c('0x1c')](realtime[_0xcf7c('0x22')]())[_0xcf7c('0x1c')](trigger[_0xcf7c('0x23')]())['then'](realtime[_0xcf7c('0x24')]())['then'](template[_0xcf7c('0x25')]())[_0xcf7c('0x1c')](realtime['initTemplates']())[_0xcf7c('0x1c')](zendesk[_0xcf7c('0x26')]())[_0xcf7c('0x1c')](realtime[_0xcf7c('0x27')]())[_0xcf7c('0x1c')](salesforce[_0xcf7c('0x28')]())[_0xcf7c('0x1c')](realtime[_0xcf7c('0x29')]())[_0xcf7c('0x1c')](sugarcrm[_0xcf7c('0x2a')]())[_0xcf7c('0x1c')](realtime['initSugarcrmAccounts']())[_0xcf7c('0x1c')](freshdesk[_0xcf7c('0x2b')]())[_0xcf7c('0x1c')](realtime[_0xcf7c('0x2c')]())['then'](desk[_0xcf7c('0x2d')]())['then'](realtime['initDeskAccounts']())[_0xcf7c('0x1c')](zoho['getZohoAccounts']())['then'](realtime['initZohoAccounts']())['then'](vtiger[_0xcf7c('0x2e')]())['then'](realtime[_0xcf7c('0x2f')]())[_0xcf7c('0x1c')](freshsales[_0xcf7c('0x30')]())[_0xcf7c('0x1c')](realtime['initFreshsalesAccounts']())[_0xcf7c('0x1c')](servicenow[_0xcf7c('0x31')]())[_0xcf7c('0x1c')](realtime[_0xcf7c('0x32')]())[_0xcf7c('0x1c')](dynamics365[_0xcf7c('0x33')]())['then'](realtime[_0xcf7c('0x34')]())[_0xcf7c('0x1c')](campaign[_0xcf7c('0x35')]())[_0xcf7c('0x1c')](realtime['initCampaigns']())[_0xcf7c('0x1c')](voiceExtension[_0xcf7c('0x36')]())[_0xcf7c('0x1c')](realtime['initVoiceExtensions']())[_0xcf7c('0x1c')](faxAccount[_0xcf7c('0x37')]())[_0xcf7c('0x1c')](realtime[_0xcf7c('0x38')]())[_0xcf7c('0x1c')](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0xcf7c('0x1c')](voiceQueueReport[_0xcf7c('0x39')]())['then'](realtime[_0xcf7c('0x3a')]())[_0xcf7c('0x1c')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0xcf7c('0x1c')](realtime[_0xcf7c('0x3b')]())[_0xcf7c('0x1c')](cmHopperHistory[_0xcf7c('0x3c')]())['then'](realtime['initCampaignHopperHistory']())[_0xcf7c('0x1c')](voiceCallReport[_0xcf7c('0x3d')]())[_0xcf7c('0x1c')](realtime[_0xcf7c('0x3e')]())['catch'](function(_0x1109fd){logger['error']('[index.js][initParams]',util[_0xcf7c('0x3f')](_0x1109fd,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0xcf7c('0x1c')](function(_0x407bab){return initRealtime();})[_0xcf7c('0x1c')](function(){return initParams();})[_0xcf7c('0x1c')](function(){report[_0xcf7c('0x40')]();setInterval(initRealtime,0x1388);})[_0xcf7c('0x41')](function(_0x48b190){logger[_0xcf7c('0x42')](_0xcf7c('0x43'),util['inspect'](_0x48b190,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xf9af=['initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','get','hour','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getZohoAccounts'];(function(_0x297a0e,_0x412e2d){var _0x3c5640=function(_0x3ada3c){while(--_0x3ada3c){_0x297a0e['push'](_0x297a0e['shift']());}};_0x3c5640(++_0x412e2d);}(_0xf9af,0xfb));var _0xff9a=function(_0x1cc91f,_0x30f12d){_0x1cc91f=_0x1cc91f-0x0;var _0x3e397c=_0xf9af[_0x1cc91f];return _0x3e397c;};'use strict';var BPromise=require('bluebird');var util=require(_0xff9a('0x0'));var moment=require(_0xff9a('0x1'));var server=require(_0xff9a('0x2'));var Realtime=require(_0xff9a('0x3'));var Report=require(_0xff9a('0x4'));var Acw=require(_0xff9a('0x5'));var Trigger=require(_0xff9a('0x6'));var Dialer=require(_0xff9a('0x7'));var Preview=require('./preview');var Fax=require('./fax');var user=require(_0xff9a('0x8'));var voiceQueue=require(_0xff9a('0x9'));var voiceQueueReport=require(_0xff9a('0xa'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0xff9a('0xb'));var trigger=require(_0xff9a('0xc'));var template=require(_0xff9a('0xd'));var cmHopperHistory=require(_0xff9a('0xe'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0xff9a('0xf'));var faxAccount=require(_0xff9a('0x10'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0xff9a('0x11'));var sugarcrm=require(_0xff9a('0x12'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0xff9a('0x13'));var zoho=require(_0xff9a('0x14'));var vtiger=require(_0xff9a('0x15'));var freshsales=require(_0xff9a('0x16'));var servicenow=require(_0xff9a('0x17'));var dynamics365=require(_0xff9a('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0xff9a('0x19'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xff9a('0x1a')](_0xff9a('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xff9a('0x1a')](_0xff9a('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0xff9a('0x1c')](user[_0xff9a('0x1d')]())[_0xff9a('0x1c')](realtime[_0xff9a('0x1e')]())[_0xff9a('0x1c')](user[_0xff9a('0x1f')]())[_0xff9a('0x1c')](realtime[_0xff9a('0x20')]())[_0xff9a('0x1c')](trunk[_0xff9a('0x21')]())['then'](realtime[_0xff9a('0x22')]())[_0xff9a('0x1c')](voiceQueue[_0xff9a('0x23')]())[_0xff9a('0x1c')](realtime[_0xff9a('0x24')]())[_0xff9a('0x1c')](trigger[_0xff9a('0x25')]())['then'](realtime[_0xff9a('0x26')]())['then'](template[_0xff9a('0x27')]())[_0xff9a('0x1c')](realtime[_0xff9a('0x28')]())[_0xff9a('0x1c')](zendesk[_0xff9a('0x29')]())[_0xff9a('0x1c')](realtime[_0xff9a('0x2a')]())[_0xff9a('0x1c')](salesforce[_0xff9a('0x2b')]())[_0xff9a('0x1c')](realtime[_0xff9a('0x2c')]())[_0xff9a('0x1c')](sugarcrm[_0xff9a('0x2d')]())[_0xff9a('0x1c')](realtime[_0xff9a('0x2e')]())[_0xff9a('0x1c')](freshdesk[_0xff9a('0x2f')]())[_0xff9a('0x1c')](realtime['initFreshdeskAccounts']())[_0xff9a('0x1c')](desk['getDeskAccounts']())[_0xff9a('0x1c')](realtime['initDeskAccounts']())[_0xff9a('0x1c')](zoho[_0xff9a('0x30')]())[_0xff9a('0x1c')](realtime[_0xff9a('0x31')]())[_0xff9a('0x1c')](vtiger[_0xff9a('0x32')]())[_0xff9a('0x1c')](realtime[_0xff9a('0x33')]())[_0xff9a('0x1c')](freshsales['getFreshsalesAccounts']())[_0xff9a('0x1c')](realtime['initFreshsalesAccounts']())[_0xff9a('0x1c')](servicenow[_0xff9a('0x34')]())[_0xff9a('0x1c')](realtime[_0xff9a('0x35')]())[_0xff9a('0x1c')](dynamics365[_0xff9a('0x36')]())[_0xff9a('0x1c')](realtime[_0xff9a('0x37')]())[_0xff9a('0x1c')](campaign[_0xff9a('0x38')]())[_0xff9a('0x1c')](realtime['initCampaigns']())[_0xff9a('0x1c')](voiceExtension['getVoiceExtensions']())['then'](realtime[_0xff9a('0x39')]())['then'](faxAccount[_0xff9a('0x3a')]())[_0xff9a('0x1c')](realtime[_0xff9a('0x3b')]())[_0xff9a('0x1c')](function(){return realtime;});}function initParams(){return BPromise[_0xff9a('0x3c')]()['then'](voiceQueueReport[_0xff9a('0x3d')]())[_0xff9a('0x1c')](realtime[_0xff9a('0x3e')]())[_0xff9a('0x1c')](cmHopperHistory[_0xff9a('0x3f')]())['then'](realtime[_0xff9a('0x40')]())['then'](cmHopperHistory[_0xff9a('0x41')]())['then'](realtime[_0xff9a('0x42')]())[_0xff9a('0x1c')](voiceCallReport[_0xff9a('0x43')]())[_0xff9a('0x1c')](realtime[_0xff9a('0x44')]())[_0xff9a('0x45')](function(_0x47995c){logger[_0xff9a('0x46')](_0xff9a('0x47'),util[_0xff9a('0x48')](_0x47995c,{'showHidden':![],'depth':null}));});}function main(){return server[_0xff9a('0x49')](realtime,preview,fax)[_0xff9a('0x1c')](function(_0x405a43){return initRealtime();})[_0xff9a('0x1c')](function(){return initParams();})[_0xff9a('0x1c')](function(){report[_0xff9a('0x4a')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x317b65){logger[_0xff9a('0x46')]('[index.js][main]',util[_0xff9a('0x48')](_0x317b65,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index ee3a598..8fc5998 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 _0x9c44=['phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','stateTime','address','voiceStatusQueue','stringify','format','user:%s','emit','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','state','status','unknown'];(function(_0x49a4b5,_0x420d0c){var _0x343547=function(_0xdd6b78){while(--_0xdd6b78){_0x49a4b5['push'](_0x49a4b5['shift']());}};_0x343547(++_0x420d0c);}(_0x9c44,0x178));var _0x49c4=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x9c44[_0x2064e5];return _0x21a233;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var Redis=require(_0x49c4('0x2'));var config=require(_0x49c4('0x3'));config[_0x49c4('0x4')]=_[_0x49c4('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x49c4('0x6'))(new Redis(config['redis']));function Agent(_0xc1278f){this['id']=_0xc1278f['id']||0x0;this[_0x49c4('0x7')]=_0xc1278f[_0x49c4('0x7')]||'';this[_0x49c4('0x8')]=_0xc1278f[_0x49c4('0x8')]||'';this['accountcode']=_0xc1278f[_0x49c4('0x9')]||'';this[_0x49c4('0xa')]=_0xc1278f[_0x49c4('0xa')]||'';this[_0x49c4('0xb')]='unknown';this['stateTime']=0x0;this[_0x49c4('0xc')]=_0x49c4('0xd');this['address']='';this[_0x49c4('0xe')]='';this[_0x49c4('0xf')]='';this['interface']='';this['online']=_0xc1278f[_0x49c4('0x10')]||![];this[_0x49c4('0x11')]='unknown';this[_0x49c4('0x12')]=0x0;this[_0x49c4('0x13')]='';this['voiceStatusQueue']='';this[_0x49c4('0x14')]=![];this[_0x49c4('0x15')]=![];this[_0x49c4('0x1')]='';}Agent[_0x49c4('0x16')][_0x49c4('0x17')]=function(_0x18211c){var _0x75ea8;if(_0x18211c&&_0x18211c[_0x49c4('0xb')]){_0x75ea8=_0x18211c['state'][_0x49c4('0x18')]();switch(_0x75ea8){case _0x49c4('0x19'):_0x75ea8=_0x49c4('0x1a');break;case _0x49c4('0x1b'):_0x75ea8=_0x49c4('0x1c');break;}}if(_0x75ea8&&this['voiceStatus']!==_0x75ea8||_0x18211c[_0x49c4('0x1d')]){this[_0x49c4('0x12')]=_['toNumber'](moment()['format']('x'));}if(_0x75ea8){this[_0x49c4('0x11')]=_0x75ea8;}var _0x2f82d5={'id':this['id'],'name':this[_0x49c4('0x7')],'email':this['email'],'accountcode':this[_0x49c4('0x9')],'fullname':this['fullname'],'state':this[_0x49c4('0xb')],'stateTime':this[_0x49c4('0x1e')],'status':this[_0x49c4('0xc')],'address':this[_0x49c4('0x1f')],'online':this[_0x49c4('0x10')],'voiceStatus':this[_0x49c4('0x11')],'voiceStatusTime':this[_0x49c4('0x12')],'voiceStatusCallerIdNumber':this[_0x49c4('0x13')],'voiceStatusQueue':this[_0x49c4('0x20')],'interface':this['interface'],'onhold':this['onhold']};var _0x57f502=md5(JSON[_0x49c4('0x21')](_0x2f82d5));if(this['md5']!==_0x57f502){this['md5']=_0x57f502;io['to'](util[_0x49c4('0x22')](_0x49c4('0x23'),_0x2f82d5[_0x49c4('0x7')]))[_0x49c4('0x24')]('user:save',_0x2f82d5);io['emit'](_0x49c4('0x25'),_0x2f82d5);}};module[_0x49c4('0x26')]=Agent; \ No newline at end of file +var _0x0713=['idle','inuse','talking','voiceStatusTime','toNumber','format','voiceStatusQueue','stringify','user:%s','emit','user:save','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber','onhold','local','prototype','state','toLowerCase','not_inuse'];(function(_0x33dff,_0x1c1b10){var _0x2aea12=function(_0xd9c34a){while(--_0xd9c34a){_0x33dff['push'](_0x33dff['shift']());}};_0x2aea12(++_0x1c1b10);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var md5=require(_0x3071('0x1'));var Redis=require(_0x3071('0x2'));var config=require(_0x3071('0x3'));config[_0x3071('0x4')]=_['defaults'](config[_0x3071('0x4')],{'host':_0x3071('0x5'),'port':0x18eb});var io=require(_0x3071('0x6'))(new Redis(config[_0x3071('0x4')]));function Agent(_0xabd7b6){this['id']=_0xabd7b6['id']||0x0;this[_0x3071('0x7')]=_0xabd7b6[_0x3071('0x7')]||'';this[_0x3071('0x8')]=_0xabd7b6[_0x3071('0x8')]||'';this[_0x3071('0x9')]=_0xabd7b6[_0x3071('0x9')]||'';this[_0x3071('0xa')]=_0xabd7b6[_0x3071('0xa')]||'';this['state']=_0x3071('0xb');this[_0x3071('0xc')]=0x0;this[_0x3071('0xd')]=_0x3071('0xb');this[_0x3071('0xe')]='';this['phone']='';this[_0x3071('0xf')]='';this[_0x3071('0x10')]='';this[_0x3071('0x11')]=_0xabd7b6[_0x3071('0x11')]||![];this[_0x3071('0x12')]='unknown';this['voiceStatusTime']=0x0;this[_0x3071('0x13')]='';this['voiceStatusQueue']='';this[_0x3071('0x14')]=![];this[_0x3071('0x15')]=![];this['md5']='';}Agent[_0x3071('0x16')]['updateStatusRealtime']=function(_0x2fc15d){var _0x45c93b;if(_0x2fc15d&&_0x2fc15d[_0x3071('0x17')]){_0x45c93b=_0x2fc15d[_0x3071('0x17')][_0x3071('0x18')]();switch(_0x45c93b){case _0x3071('0x19'):_0x45c93b=_0x3071('0x1a');break;case _0x3071('0x1b'):_0x45c93b=_0x3071('0x1c');break;}}if(_0x45c93b&&this[_0x3071('0x12')]!==_0x45c93b||_0x2fc15d['statePause']){this[_0x3071('0x1d')]=_[_0x3071('0x1e')](moment()[_0x3071('0x1f')]('x'));}if(_0x45c93b){this[_0x3071('0x12')]=_0x45c93b;}var _0x3acf0e={'id':this['id'],'name':this[_0x3071('0x7')],'email':this[_0x3071('0x8')],'accountcode':this[_0x3071('0x9')],'fullname':this['fullname'],'state':this[_0x3071('0x17')],'stateTime':this[_0x3071('0xc')],'status':this[_0x3071('0xd')],'address':this['address'],'online':this[_0x3071('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x3071('0x1d')],'voiceStatusCallerIdNumber':this[_0x3071('0x13')],'voiceStatusQueue':this[_0x3071('0x20')],'interface':this[_0x3071('0x10')],'onhold':this[_0x3071('0x14')]};var _0x34c50e=md5(JSON[_0x3071('0x21')](_0x3acf0e));if(this[_0x3071('0x1')]!==_0x34c50e){this['md5']=_0x34c50e;io['to'](util['format'](_0x3071('0x22'),_0x3acf0e[_0x3071('0x7')]))[_0x3071('0x23')](_0x3071('0x24'),_0x3acf0e);io[_0x3071('0x23')](_0x3071('0x25'),_0x3acf0e);}};module[_0x3071('0x26')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 4fba7db..85b92f3 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 _0xf863=['dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','exports','name','type','temp','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','limitCalls','dialTimezone'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xf863,0x19e));var _0x3f86=function(_0x3abc94,_0x578b23){_0x3abc94=_0x3abc94-0x0;var _0x1513e4=_0xf863[_0x3abc94];return _0x1513e4;};'use strict';function Campaign(_0x22df3c){this['id']=_0x22df3c['id']||0x0;this[_0x3f86('0x0')]=_0x22df3c[_0x3f86('0x0')]||'';this[_0x3f86('0x1')]=_0x22df3c[_0x3f86('0x1')]||'campaign';this['originated']=0x0;this[_0x3f86('0x2')]=0x0;this[_0x3f86('0x3')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x3f86('0x4')]='';this[_0x3f86('0x5')]=!![];this[_0x3f86('0x6')]=_0x22df3c[_0x3f86('0x6')];this[_0x3f86('0x7')]=_0x22df3c[_0x3f86('0x7')];this[_0x3f86('0x8')]=_0x22df3c['dialTimezone']||null;this['dialGlobalInterval']=_0x22df3c[_0x3f86('0x9')]?_0x22df3c[_0x3f86('0x9')]:null;this[_0x3f86('0xa')]=_0x22df3c[_0x3f86('0xa')];this[_0x3f86('0xb')]=_0x22df3c[_0x3f86('0xb')];this[_0x3f86('0xc')]=_0x22df3c[_0x3f86('0xc')]||0x1e;this[_0x3f86('0xd')]=_0x22df3c[_0x3f86('0xd')];this[_0x3f86('0xe')]=_0x22df3c[_0x3f86('0xe')];this['dialBusyMaxRetry']=_0x22df3c['dialBusyMaxRetry'];this[_0x3f86('0xf')]=_0x22df3c[_0x3f86('0xf')];this[_0x3f86('0x10')]=_0x22df3c[_0x3f86('0x10')];this[_0x3f86('0x11')]=_0x22df3c[_0x3f86('0x11')];this[_0x3f86('0x12')]=_0x22df3c[_0x3f86('0x12')];this[_0x3f86('0x13')]=_0x22df3c[_0x3f86('0x13')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x22df3c[_0x3f86('0x14')]||0x96;this['dialDropMaxRetry']=_0x22df3c['dialDropMaxRetry']||0x3;this[_0x3f86('0x15')]=_0x22df3c['dialDropRetryFrequency']||0x96;this[_0x3f86('0x16')]=_0x22df3c[_0x3f86('0x16')]||0x3;this[_0x3f86('0x17')]=_0x22df3c[_0x3f86('0x17')]||0x96;this[_0x3f86('0x18')]=_0x22df3c['dialMachineMaxRetry']||0x3;this[_0x3f86('0x19')]=_0x22df3c[_0x3f86('0x19')]||0x96;this[_0x3f86('0x1a')]=_0x22df3c[_0x3f86('0x1a')]||0x3;this[_0x3f86('0x1b')]=_0x22df3c[_0x3f86('0x1b')]||0x96;this[_0x3f86('0x1c')]=_0x22df3c[_0x3f86('0x1c')]||_0x3f86('0x1d');this['dialPrefix']=_0x22df3c[_0x3f86('0x1e')]||undefined;this[_0x3f86('0x1f')]=_0x22df3c[_0x3f86('0x1f')]||undefined;this[_0x3f86('0x20')]=_0x22df3c['dialCutDigit']||undefined;this[_0x3f86('0x21')]=_0x22df3c[_0x3f86('0x21')]?_0x22df3c['TrunkBackup']:undefined;this['Trunk']=_0x22df3c[_0x3f86('0x22')]?_0x22df3c[_0x3f86('0x22')]:undefined;this['Interval']=_0x22df3c[_0x3f86('0x23')]?_0x22df3c[_0x3f86('0x23')]:undefined;this[_0x3f86('0x24')]=_0x22df3c[_0x3f86('0x24')]?_0x22df3c['SquareProject']:undefined;this[_0x3f86('0x25')]=_0x22df3c['SquareProject']?_0x22df3c['SquareProject']['name']:undefined;this['dialAMDActive']=_0x22df3c['dialAMDActive']||![];this[_0x3f86('0x26')]=_0x22df3c[_0x3f86('0x26')];this[_0x3f86('0x27')]=_0x22df3c['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x22df3c[_0x3f86('0x28')];this[_0x3f86('0x29')]=_0x22df3c[_0x3f86('0x29')];this['dialAMDMinWordLength']=_0x22df3c[_0x3f86('0x2a')];this[_0x3f86('0x2b')]=_0x22df3c[_0x3f86('0x2b')];this['dialAMDMaximumNumberOfWords']=_0x22df3c[_0x3f86('0x2c')];this['dialAMDSilenceThreshold']=_0x22df3c['dialAMDSilenceThreshold'];this[_0x3f86('0x2d')]=_0x22df3c[_0x3f86('0x2d')];}module[_0x3f86('0x2e')]=Campaign; \ No newline at end of file +var _0x2d5e=['dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialCongestionMaxRetry','dialCongestionRetryFrequency'];(function(_0x2cfaf2,_0x2721a1){var _0x1ac20d=function(_0x502d7e){while(--_0x502d7e){_0x2cfaf2['push'](_0x2cfaf2['shift']());}};_0x1ac20d(++_0x2721a1);}(_0x2d5e,0x14e));var _0xe2d5=function(_0x4d6eed,_0x1f71cf){_0x4d6eed=_0x4d6eed-0x0;var _0x14c4d7=_0x2d5e[_0x4d6eed];return _0x14c4d7;};'use strict';function Campaign(_0x5d29a8){this['id']=_0x5d29a8['id']||0x0;this['name']=_0x5d29a8[_0xe2d5('0x0')]||'';this['type']=_0x5d29a8['type']||_0xe2d5('0x1');this[_0xe2d5('0x2')]=0x0;this[_0xe2d5('0x3')]=0x0;this[_0xe2d5('0x4')]=0x0;this[_0xe2d5('0x5')]=0x0;this[_0xe2d5('0x6')]='';this[_0xe2d5('0x7')]=!![];this[_0xe2d5('0x8')]=_0x5d29a8[_0xe2d5('0x8')];this[_0xe2d5('0x9')]=_0x5d29a8[_0xe2d5('0x9')];this['dialTimezone']=_0x5d29a8[_0xe2d5('0xa')]||null;this[_0xe2d5('0xb')]=_0x5d29a8[_0xe2d5('0xb')]?_0x5d29a8[_0xe2d5('0xb')]:null;this[_0xe2d5('0xc')]=_0x5d29a8[_0xe2d5('0xc')];this[_0xe2d5('0xd')]=_0x5d29a8['dialOriginateCallerIdNumber'];this['dialOriginateTimeout']=_0x5d29a8['dialOriginateTimeout']||0x1e;this[_0xe2d5('0xe')]=_0x5d29a8[_0xe2d5('0xe')];this[_0xe2d5('0xf')]=_0x5d29a8[_0xe2d5('0xf')];this[_0xe2d5('0x10')]=_0x5d29a8['dialBusyMaxRetry'];this[_0xe2d5('0x11')]=_0x5d29a8[_0xe2d5('0x11')];this['dialNoAnswerMaxRetry']=_0x5d29a8[_0xe2d5('0x12')];this[_0xe2d5('0x13')]=_0x5d29a8[_0xe2d5('0x13')];this['dialGlobalMaxRetry']=_0x5d29a8['dialGlobalMaxRetry'];this[_0xe2d5('0x14')]=_0x5d29a8[_0xe2d5('0x14')]||0x3;this[_0xe2d5('0x15')]=_0x5d29a8['dialNoSuchNumberRetryFrequency']||0x96;this[_0xe2d5('0x16')]=_0x5d29a8['dialDropMaxRetry']||0x3;this[_0xe2d5('0x17')]=_0x5d29a8[_0xe2d5('0x17')]||0x96;this[_0xe2d5('0x18')]=_0x5d29a8[_0xe2d5('0x18')]||0x3;this[_0xe2d5('0x19')]=_0x5d29a8[_0xe2d5('0x19')]||0x96;this[_0xe2d5('0x1a')]=_0x5d29a8[_0xe2d5('0x1a')]||0x3;this[_0xe2d5('0x1b')]=_0x5d29a8[_0xe2d5('0x1b')]||0x96;this[_0xe2d5('0x1c')]=_0x5d29a8[_0xe2d5('0x1c')]||0x3;this['dialAgentRejectRetryFrequency']=_0x5d29a8[_0xe2d5('0x1d')]||0x96;this['dialOrderByScheduledAt']=_0x5d29a8[_0xe2d5('0x1e')]||_0xe2d5('0x1f');this['dialPrefix']=_0x5d29a8[_0xe2d5('0x20')]||undefined;this[_0xe2d5('0x21')]=_0x5d29a8[_0xe2d5('0x21')]||undefined;this[_0xe2d5('0x22')]=_0x5d29a8[_0xe2d5('0x22')]||undefined;this[_0xe2d5('0x23')]=_0x5d29a8[_0xe2d5('0x23')]?_0x5d29a8[_0xe2d5('0x23')]:undefined;this[_0xe2d5('0x24')]=_0x5d29a8[_0xe2d5('0x24')]?_0x5d29a8[_0xe2d5('0x24')]:undefined;this[_0xe2d5('0x25')]=_0x5d29a8[_0xe2d5('0x25')]?_0x5d29a8[_0xe2d5('0x25')]:undefined;this[_0xe2d5('0x26')]=_0x5d29a8[_0xe2d5('0x26')]?_0x5d29a8[_0xe2d5('0x26')]:undefined;this[_0xe2d5('0x27')]=_0x5d29a8[_0xe2d5('0x26')]?_0x5d29a8[_0xe2d5('0x26')][_0xe2d5('0x0')]:undefined;this[_0xe2d5('0x28')]=_0x5d29a8['dialAMDActive']||![];this[_0xe2d5('0x29')]=_0x5d29a8[_0xe2d5('0x29')];this[_0xe2d5('0x2a')]=_0x5d29a8['dialAMDGreeting'];this[_0xe2d5('0x2b')]=_0x5d29a8[_0xe2d5('0x2b')];this[_0xe2d5('0x2c')]=_0x5d29a8[_0xe2d5('0x2c')];this[_0xe2d5('0x2d')]=_0x5d29a8[_0xe2d5('0x2d')];this[_0xe2d5('0x2e')]=_0x5d29a8['dialAMDBetweenWordsSilence'];this[_0xe2d5('0x2f')]=_0x5d29a8['dialAMDMaximumNumberOfWords'];this[_0xe2d5('0x30')]=_0x5d29a8['dialAMDSilenceThreshold'];this[_0xe2d5('0x31')]=_0x5d29a8[_0xe2d5('0x31')];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 8dbe84e..04ef17a 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 _0xd914=['answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','holdtime','type','tag','disposition','monitor','monitorFilename','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','linkedid'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd914,0x17f));var _0x4d91=function(_0x2e7a43,_0x3b3df4){_0x2e7a43=_0x2e7a43-0x0;var _0x52e9e1=_0xd914[_0x2e7a43];return _0x52e9e1;};'use strict';function Channel(){this[_0x4d91('0x0')]=null;this[_0x4d91('0x1')]='';this['destinationchannel']='';this[_0x4d91('0x2')]=0x0;this[_0x4d91('0x3')]='';this[_0x4d91('0x4')]=undefined;this[_0x4d91('0x5')]=undefined;this[_0x4d91('0x6')]=0x0;this[_0x4d91('0x7')]='';this['uniqueid']=0x0;this[_0x4d91('0x8')]=0x0;this['exten']=0x0;this[_0x4d91('0x9')]=![];this[_0x4d91('0xa')]=null;this[_0x4d91('0xb')]=null;this[_0x4d91('0xc')]=![];this[_0x4d91('0xd')]=![];this[_0x4d91('0xe')]='';this[_0x4d91('0xf')]='';this[_0x4d91('0x10')]=0x0;this['billableseconds']=0x0;this[_0x4d91('0x11')]=0x0;this[_0x4d91('0x12')]=null;this[_0x4d91('0x13')]=null;this[_0x4d91('0x14')]=null;this[_0x4d91('0x15')]=![];this[_0x4d91('0x16')]=null;this['queue']=null;this['monitors']=[];this[_0x4d91('0x17')]=undefined;this[_0x4d91('0x18')]=undefined;this[_0x4d91('0x19')]=undefined;this[_0x4d91('0x1a')]=0x0;}module[_0x4d91('0x1b')]=Channel; \ No newline at end of file +var _0x1ab1=['unmanaged','abandoned','lastapplication','lastdata','duration','holdtime','tag','disposition','monitor','monitorFilename','monitors','transfercalleridnum','transferconnectedlinenum','transferType','starttime','calleridnum','accountcode','uniqueid','linkedid','exten','answered','endtime'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1ab1,0x12c));var _0x11ab=function(_0x3c33a7,_0x5766d1){_0x3c33a7=_0x3c33a7-0x0;var _0x4b8381=_0x1ab1[_0x3c33a7];return _0x4b8381;};'use strict';function Channel(){this[_0x11ab('0x0')]=null;this['channel']='';this['destinationchannel']='';this[_0x11ab('0x1')]=0x0;this['calleridname']='';this['connectedlinenum']=undefined;this['connectedlinename']=undefined;this[_0x11ab('0x2')]=0x0;this['context']='';this[_0x11ab('0x3')]=0x0;this[_0x11ab('0x4')]=0x0;this[_0x11ab('0x5')]=0x0;this[_0x11ab('0x6')]=![];this['answertime']=null;this[_0x11ab('0x7')]=null;this[_0x11ab('0x8')]=![];this[_0x11ab('0x9')]=![];this[_0x11ab('0xa')]='';this[_0x11ab('0xb')]='';this[_0x11ab('0xc')]=0x0;this['billableseconds']=0x0;this[_0x11ab('0xd')]=0x0;this['type']=null;this[_0x11ab('0xe')]=null;this[_0x11ab('0xf')]=null;this[_0x11ab('0x10')]=![];this[_0x11ab('0x11')]=null;this['queue']=null;this[_0x11ab('0x12')]=[];this[_0x11ab('0x13')]=undefined;this[_0x11ab('0x14')]=undefined;this[_0x11ab('0x15')]=undefined;this['mohtime']=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index fbf8014..89b3151 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 _0xcf74=['token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret'];(function(_0x2c7780,_0x100f4a){var _0x580bc8=function(_0x3d435c){while(--_0x3d435c){_0x2c7780['push'](_0x2c7780['shift']());}};_0x580bc8(++_0x100f4a);}(_0xcf74,0x1a6));var _0x4cf7=function(_0x27c47c,_0x3bb02d){_0x27c47c=_0x27c47c-0x0;var _0x2fd472=_0xcf74[_0x27c47c];return _0x2fd472;};'use strict';function DeskAccount(_0xb4fe35){this['id']=_0xb4fe35['id']||0x0;this[_0x4cf7('0x0')]=_0xb4fe35['name']||'';this[_0x4cf7('0x1')]=_0xb4fe35[_0x4cf7('0x1')]||'';this[_0x4cf7('0x2')]=_0xb4fe35[_0x4cf7('0x2')]||'';this[_0x4cf7('0x3')]=_0xb4fe35[_0x4cf7('0x3')]||'';this[_0x4cf7('0x4')]=_0xb4fe35['password']||'';this[_0x4cf7('0x5')]=_0xb4fe35['consumerKey']||'';this[_0x4cf7('0x6')]=_0xb4fe35['consumerSecret']||'';this[_0x4cf7('0x7')]=_0xb4fe35['token']||'';this[_0x4cf7('0x8')]=_0xb4fe35[_0x4cf7('0x8')]||'';this[_0x4cf7('0x9')]=_0xb4fe35['type']||'';this[_0x4cf7('0xa')]=_0xb4fe35[_0x4cf7('0xa')]||'';this[_0x4cf7('0xb')]=_0xb4fe35[_0x4cf7('0xb')]||{};}module[_0x4cf7('0xc')]=DeskAccount; \ No newline at end of file +var _0x9b63=['type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret'];(function(_0x4989c7,_0x509d75){var _0x5e81d0=function(_0x35e601){while(--_0x35e601){_0x4989c7['push'](_0x4989c7['shift']());}};_0x5e81d0(++_0x509d75);}(_0x9b63,0x86));var _0x39b6=function(_0x1ce52c,_0x41c0e7){_0x1ce52c=_0x1ce52c-0x0;var _0x5c7f79=_0x9b63[_0x1ce52c];return _0x5c7f79;};'use strict';function DeskAccount(_0x2c6876){this['id']=_0x2c6876['id']||0x0;this[_0x39b6('0x0')]=_0x2c6876[_0x39b6('0x0')]||'';this[_0x39b6('0x1')]=_0x2c6876['username']||'';this['remoteUri']=_0x2c6876[_0x39b6('0x2')]||'';this[_0x39b6('0x3')]=_0x2c6876['authType']||'';this[_0x39b6('0x4')]=_0x2c6876[_0x39b6('0x4')]||'';this[_0x39b6('0x5')]=_0x2c6876[_0x39b6('0x5')]||'';this[_0x39b6('0x6')]=_0x2c6876['consumerSecret']||'';this['token']=_0x2c6876[_0x39b6('0x7')]||'';this['tokenSecret']=_0x2c6876[_0x39b6('0x8')]||'';this[_0x39b6('0x9')]=_0x2c6876[_0x39b6('0x9')]||'';this['serverUrl']=_0x2c6876[_0x39b6('0xa')]||'';this['Configurations']=_0x2c6876[_0x39b6('0xb')]||{};}module[_0x39b6('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 06afe77..e4fa5e3 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 _0xdcfb=['clientSecret','serverUrl','modernAuthentication','CloudProvider','name','username','password','remoteUri','tenantId','clientId'];(function(_0x57fa7e,_0xd0b5ce){var _0x320671=function(_0x3392cc){while(--_0x3392cc){_0x57fa7e['push'](_0x57fa7e['shift']());}};_0x320671(++_0xd0b5ce);}(_0xdcfb,0x108));var _0xbdcf=function(_0x855caa,_0x5624fa){_0x855caa=_0x855caa-0x0;var _0x25488a=_0xdcfb[_0x855caa];return _0x25488a;};'use strict';function Dynamics365Account(_0x49d2be){this['id']=_0x49d2be['id']||0x0;this[_0xbdcf('0x0')]=_0x49d2be[_0xbdcf('0x0')]||'';this[_0xbdcf('0x1')]=_0x49d2be[_0xbdcf('0x1')]||'';this[_0xbdcf('0x2')]=_0x49d2be[_0xbdcf('0x2')]||'';this[_0xbdcf('0x3')]=_0x49d2be[_0xbdcf('0x3')]||'';this[_0xbdcf('0x4')]=_0x49d2be[_0xbdcf('0x4')]||'';this[_0xbdcf('0x5')]=_0x49d2be[_0xbdcf('0x5')]||'';this[_0xbdcf('0x6')]=_0x49d2be[_0xbdcf('0x6')]||{};this[_0xbdcf('0x7')]=_0x49d2be['serverUrl']||'';this[_0xbdcf('0x8')]=_0x49d2be[_0xbdcf('0x8')]||![];this['Configurations']=_0x49d2be['Configurations']||{};this[_0xbdcf('0x9')]=_0x49d2be['CloudProvider']||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0x9e80=['name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations'];(function(_0x33c81e,_0x3c4d33){var _0x32f67b=function(_0x67f86a){while(--_0x67f86a){_0x33c81e['push'](_0x33c81e['shift']());}};_0x32f67b(++_0x3c4d33);}(_0x9e80,0x15e));var _0x09e8=function(_0x3f6183,_0x1978e8){_0x3f6183=_0x3f6183-0x0;var _0x23d7d2=_0x9e80[_0x3f6183];return _0x23d7d2;};'use strict';function Dynamics365Account(_0xe8d035){this['id']=_0xe8d035['id']||0x0;this[_0x09e8('0x0')]=_0xe8d035[_0x09e8('0x0')]||'';this[_0x09e8('0x1')]=_0xe8d035[_0x09e8('0x1')]||'';this[_0x09e8('0x2')]=_0xe8d035['password']||'';this[_0x09e8('0x3')]=_0xe8d035[_0x09e8('0x3')]||'';this[_0x09e8('0x4')]=_0xe8d035['tenantId']||'';this[_0x09e8('0x5')]=_0xe8d035[_0x09e8('0x5')]||'';this['clientSecret']=_0xe8d035[_0x09e8('0x6')]||{};this[_0x09e8('0x7')]=_0xe8d035[_0x09e8('0x7')]||'';this[_0x09e8('0x8')]=_0xe8d035[_0x09e8('0x8')]||![];this[_0x09e8('0x9')]=_0xe8d035['Configurations']||{};this['CloudProvider']=_0xe8d035['CloudProvider']||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 35b8b6b..92bc333 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 _0xb003=['Trunk','ListId','key','exports','name','description','headerinfo','localstationid','maxrate','modem','gateway','faxdetect','t38timeout','tech'];(function(_0x1c289a,_0x277fe7){var _0x28d68e=function(_0x2f8e98){while(--_0x2f8e98){_0x1c289a['push'](_0x1c289a['shift']());}};_0x28d68e(++_0x277fe7);}(_0xb003,0x146));var _0x3b00=function(_0x5817e6,_0x44a2d0){_0x5817e6=_0x5817e6-0x0;var _0x51916a=_0xb003[_0x5817e6];return _0x51916a;};'use strict';function FaxAccount(_0x34e27a){this['id']=_0x34e27a['id']||0x0;this[_0x3b00('0x0')]=_0x34e27a[_0x3b00('0x0')]||'';this[_0x3b00('0x1')]=_0x34e27a[_0x3b00('0x1')];this['ecm']=_0x34e27a['ecm'];this['headerinfo']=_0x34e27a[_0x3b00('0x2')];this[_0x3b00('0x3')]=_0x34e27a[_0x3b00('0x3')];this['minrate']=_0x34e27a['minrate']||0x960;this[_0x3b00('0x4')]=_0x34e27a[_0x3b00('0x4')]||0x3840;this['modem']=_0x34e27a[_0x3b00('0x5')]||'v17,v27,v29';this[_0x3b00('0x6')]=_0x34e27a[_0x3b00('0x6')]||'no';this[_0x3b00('0x7')]=_0x34e27a[_0x3b00('0x7')]||'no';this[_0x3b00('0x8')]=_0x34e27a[_0x3b00('0x8')]||0x1388;this[_0x3b00('0x9')]=_0x34e27a[_0x3b00('0x9')]||'SIP';this[_0x3b00('0xa')]=_0x34e27a[_0x3b00('0xa')]?_0x34e27a[_0x3b00('0xa')]:undefined;this[_0x3b00('0xb')]=_0x34e27a[_0x3b00('0xb')];this[_0x3b00('0xc')]=_0x34e27a['key'];}module[_0x3b00('0xd')]=FaxAccount; \ No newline at end of file +var _0x72eb=['minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid'];(function(_0x18b18b,_0x3c387b){var _0x9d4d64=function(_0x537e37){while(--_0x537e37){_0x18b18b['push'](_0x18b18b['shift']());}};_0x9d4d64(++_0x3c387b);}(_0x72eb,0x10b));var _0xb72e=function(_0x14f894,_0x3ea37d){_0x14f894=_0x14f894-0x0;var _0x324dfa=_0x72eb[_0x14f894];return _0x324dfa;};'use strict';function FaxAccount(_0x1d1450){this['id']=_0x1d1450['id']||0x0;this[_0xb72e('0x0')]=_0x1d1450['name']||'';this[_0xb72e('0x1')]=_0x1d1450[_0xb72e('0x1')];this['ecm']=_0x1d1450[_0xb72e('0x2')];this[_0xb72e('0x3')]=_0x1d1450[_0xb72e('0x3')];this[_0xb72e('0x4')]=_0x1d1450['localstationid'];this[_0xb72e('0x5')]=_0x1d1450[_0xb72e('0x5')]||0x960;this[_0xb72e('0x6')]=_0x1d1450[_0xb72e('0x6')]||0x3840;this[_0xb72e('0x7')]=_0x1d1450[_0xb72e('0x7')]||'v17,v27,v29';this['gateway']=_0x1d1450[_0xb72e('0x8')]||'no';this['faxdetect']=_0x1d1450[_0xb72e('0x9')]||'no';this[_0xb72e('0xa')]=_0x1d1450['t38timeout']||0x1388;this[_0xb72e('0xb')]=_0x1d1450[_0xb72e('0xb')]||'SIP';this[_0xb72e('0xc')]=_0x1d1450['Trunk']?_0x1d1450[_0xb72e('0xc')]:undefined;this[_0xb72e('0xd')]=_0x1d1450['ListId'];this[_0xb72e('0xe')]=_0x1d1450[_0xb72e('0xe')];}module[_0xb72e('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 3f39022..42f5b13 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 _0xce17=['username','apiKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x123e4a,_0x535ea7){var _0x40d33a=function(_0x2d07cd){while(--_0x2d07cd){_0x123e4a['push'](_0x123e4a['shift']());}};_0x40d33a(++_0x535ea7);}(_0xce17,0x12c));var _0x7ce1=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xce17[_0x4e676e];return _0x336a3c;};'use strict';function FreshdeskAccount(_0x430bc3){this['id']=_0x430bc3['id']||0x0;this[_0x7ce1('0x0')]=_0x430bc3[_0x7ce1('0x0')]||'';this[_0x7ce1('0x1')]=_0x430bc3[_0x7ce1('0x1')]||'';this[_0x7ce1('0x2')]=_0x430bc3['token']||'';this[_0x7ce1('0x3')]=_0x430bc3[_0x7ce1('0x3')]||'';this['serverUrl']=_0x430bc3[_0x7ce1('0x4')]||'';this[_0x7ce1('0x5')]=_0x430bc3[_0x7ce1('0x5')]||{};}module[_0x7ce1('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0xd8dc=['username','remoteUri','serverUrl','Configurations','name'];(function(_0x270e4f,_0x280151){var _0x5cb934=function(_0x296a8d){while(--_0x296a8d){_0x270e4f['push'](_0x270e4f['shift']());}};_0x5cb934(++_0x280151);}(_0xd8dc,0x13f));var _0xcd8d=function(_0x4004c4,_0x162b2d){_0x4004c4=_0x4004c4-0x0;var _0x2a63a9=_0xd8dc[_0x4004c4];return _0x2a63a9;};'use strict';function FreshdeskAccount(_0x5ac2){this['id']=_0x5ac2['id']||0x0;this['name']=_0x5ac2[_0xcd8d('0x0')]||'';this[_0xcd8d('0x1')]=_0x5ac2[_0xcd8d('0x1')]||'';this['apiKey']=_0x5ac2['token']||'';this['remoteUri']=_0x5ac2[_0xcd8d('0x2')]||'';this[_0xcd8d('0x3')]=_0x5ac2[_0xcd8d('0x3')]||'';this[_0xcd8d('0x4')]=_0x5ac2[_0xcd8d('0x4')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index f5beb24..53efced 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 _0x9ca0=['username','apiKey','remoteUri','serverUrl','exports','name'];(function(_0x53e41f,_0x36d2e4){var _0x1f489b=function(_0x222db9){while(--_0x222db9){_0x53e41f['push'](_0x53e41f['shift']());}};_0x1f489b(++_0x36d2e4);}(_0x9ca0,0x65));var _0x09ca=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0x9ca0[_0x34bc30];return _0x5706de;};'use strict';function FreshsalesAccount(_0x1c7e43){this['id']=_0x1c7e43['id']||0x0;this[_0x09ca('0x0')]=_0x1c7e43[_0x09ca('0x0')]||'';this['username']=_0x1c7e43[_0x09ca('0x1')]||'';this[_0x09ca('0x2')]=_0x1c7e43['token']||'';this[_0x09ca('0x3')]=_0x1c7e43[_0x09ca('0x3')]||'';this['serverUrl']=_0x1c7e43[_0x09ca('0x4')]||'';this['Configurations']=_0x1c7e43['Configurations']||{};}module[_0x09ca('0x5')]=FreshsalesAccount; \ No newline at end of file +var _0x0ec6=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x430e15,_0x4ae0f2){var _0x16c170=function(_0x4b4927){while(--_0x4b4927){_0x430e15['push'](_0x430e15['shift']());}};_0x16c170(++_0x4ae0f2);}(_0x0ec6,0x1f1));var _0x60ec=function(_0x12a30a,_0x2d9d5f){_0x12a30a=_0x12a30a-0x0;var _0x1a1535=_0x0ec6[_0x12a30a];return _0x1a1535;};'use strict';function FreshsalesAccount(_0xe90f65){this['id']=_0xe90f65['id']||0x0;this['name']=_0xe90f65['name']||'';this[_0x60ec('0x0')]=_0xe90f65[_0x60ec('0x0')]||'';this[_0x60ec('0x1')]=_0xe90f65[_0x60ec('0x2')]||'';this[_0x60ec('0x3')]=_0xe90f65[_0x60ec('0x3')]||'';this[_0x60ec('0x4')]=_0xe90f65['serverUrl']||'';this[_0x60ec('0x5')]=_0xe90f65[_0x60ec('0x5')]||{};}module[_0x60ec('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 1f69b8e..1dc8925 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 _0xbfcb=['type','inbound','uniqueid','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','channel','connectedlinenum','accountcode','context','priority','lastAssignedTo','voice','mohtime','variables','exports'];(function(_0x3f1d11,_0x5e3836){var _0x38755f=function(_0x2d3dfe){while(--_0x2d3dfe){_0x3f1d11['push'](_0x3f1d11['shift']());}};_0x38755f(++_0x5e3836);}(_0xbfcb,0x138));var _0xbbfc=function(_0x35af83,_0x2fa0f2){_0x35af83=_0x35af83-0x0;var _0x2e7236=_0xbfcb[_0x35af83];return _0x2e7236;};'use strict';function QueueReport(){this[_0xbbfc('0x0')]=_0xbbfc('0x1');this[_0xbbfc('0x2')]='';this['calleridnum']='';this[_0xbbfc('0x3')]='';this[_0xbbfc('0x4')]='';this[_0xbbfc('0x5')]=null;this[_0xbbfc('0x6')]=null;this[_0xbbfc('0x7')]=0x1;this[_0xbbfc('0x8')]=0x1;this[_0xbbfc('0x9')]=![];this[_0xbbfc('0xa')]=null;this[_0xbbfc('0xb')]=![];this[_0xbbfc('0xc')]=null;this['queuecallerexit']=![];this[_0xbbfc('0xd')]=null;this['originalposition']=0x1;this[_0xbbfc('0xe')]='';this[_0xbbfc('0xf')]='';this['connectedlinename']='';this[_0xbbfc('0x10')]='';this[_0xbbfc('0x11')]='';this['exten']='';this[_0xbbfc('0x12')]='';this['holdtime']=0x0;this['assigned']=![];this[_0xbbfc('0x13')]='';this['motionChannel']=_0xbbfc('0x14');this[_0xbbfc('0x15')]=0x0;this[_0xbbfc('0x16')]={};}module[_0xbbfc('0x17')]=QueueReport; \ No newline at end of file +var _0xff0a=['originalposition','channel','connectedlinenum','connectedlinename','context','priority','assigned','lastAssignedTo','motionChannel','voice','mohtime','variables','exports','type','calleridnum','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit'];(function(_0x2ed7d1,_0x363741){var _0x38ae3c=function(_0x4a1b42){while(--_0x4a1b42){_0x2ed7d1['push'](_0x2ed7d1['shift']());}};_0x38ae3c(++_0x363741);}(_0xff0a,0x14f));var _0xaff0=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xff0a[_0x2dadb9];return _0x2f0097;};'use strict';function QueueReport(){this[_0xaff0('0x0')]='inbound';this['uniqueid']='';this[_0xaff0('0x1')]='';this['calleridname']='';this[_0xaff0('0x2')]='';this[_0xaff0('0x3')]=null;this[_0xaff0('0x4')]=null;this['position']=0x1;this['count']=0x1;this[_0xaff0('0x5')]=![];this[_0xaff0('0x6')]=null;this[_0xaff0('0x7')]=![];this[_0xaff0('0x8')]=null;this[_0xaff0('0x9')]=![];this['queuecallerexitAt']=null;this[_0xaff0('0xa')]=0x1;this[_0xaff0('0xb')]='';this[_0xaff0('0xc')]='';this[_0xaff0('0xd')]='';this['accountcode']='';this[_0xaff0('0xe')]='';this['exten']='';this[_0xaff0('0xf')]='';this['holdtime']=0x0;this[_0xaff0('0x10')]=![];this[_0xaff0('0x11')]='';this[_0xaff0('0x12')]=_0xaff0('0x13');this[_0xaff0('0x14')]=0x0;this[_0xaff0('0x15')]={};}module[_0xaff0('0x16')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 167a38c..fa563f8 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 _0x6d1a=['Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','serverUrl'];(function(_0x53cc76,_0x1908ae){var _0xba3e2b=function(_0x1db084){while(--_0x1db084){_0x53cc76['push'](_0x53cc76['shift']());}};_0xba3e2b(++_0x1908ae);}(_0x6d1a,0x91));var _0xa6d1=function(_0x36cc62,_0x463251){_0x36cc62=_0x36cc62-0x0;var _0x557dae=_0x6d1a[_0x36cc62];return _0x557dae;};'use strict';function SalesforceAccount(_0x594c9c){this['id']=_0x594c9c['id']||0x0;this[_0xa6d1('0x0')]=_0x594c9c['name']||'';this[_0xa6d1('0x1')]=_0x594c9c[_0xa6d1('0x1')]||'';this['remoteUri']=_0x594c9c[_0xa6d1('0x2')]||'';this[_0xa6d1('0x3')]=_0x594c9c[_0xa6d1('0x3')]||'';this[_0xa6d1('0x4')]=_0x594c9c[_0xa6d1('0x4')]||'';this[_0xa6d1('0x5')]=_0x594c9c[_0xa6d1('0x5')]||'';this[_0xa6d1('0x6')]=_0x594c9c[_0xa6d1('0x6')]||'';this[_0xa6d1('0x7')]=_0x594c9c[_0xa6d1('0x7')]||'integrationTab';this[_0xa6d1('0x8')]=_0x594c9c[_0xa6d1('0x8')]||'';this[_0xa6d1('0x9')]=_0x594c9c[_0xa6d1('0x9')]||{};}module[_0xa6d1('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x6dc9=['exports','name','username','remoteUri','password','clientId','securityToken','type','integrationTab','serverUrl','Configurations'];(function(_0x1d20b3,_0x880917){var _0x1e9c89=function(_0x512287){while(--_0x512287){_0x1d20b3['push'](_0x1d20b3['shift']());}};_0x1e9c89(++_0x880917);}(_0x6dc9,0x140));var _0x96dc=function(_0x506704,_0x6a2187){_0x506704=_0x506704-0x0;var _0x35c656=_0x6dc9[_0x506704];return _0x35c656;};'use strict';function SalesforceAccount(_0x27cf25){this['id']=_0x27cf25['id']||0x0;this[_0x96dc('0x0')]=_0x27cf25[_0x96dc('0x0')]||'';this[_0x96dc('0x1')]=_0x27cf25['username']||'';this['remoteUri']=_0x27cf25[_0x96dc('0x2')]||'';this['password']=_0x27cf25[_0x96dc('0x3')]||'';this[_0x96dc('0x4')]=_0x27cf25[_0x96dc('0x4')]||'';this['clientSecret']=_0x27cf25['clientSecret']||'';this[_0x96dc('0x5')]=_0x27cf25[_0x96dc('0x5')]||'';this[_0x96dc('0x6')]=_0x27cf25['type']||_0x96dc('0x7');this[_0x96dc('0x8')]=_0x27cf25[_0x96dc('0x8')]||'';this[_0x96dc('0x9')]=_0x27cf25[_0x96dc('0x9')]||{};}module[_0x96dc('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index ec574be..e4fbf29 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 _0x2100=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x20e650,_0x38b46a){var _0x55d7eb=function(_0x12a226){while(--_0x12a226){_0x20e650['push'](_0x20e650['shift']());}};_0x55d7eb(++_0x38b46a);}(_0x2100,0xeb));var _0x0210=function(_0x4dab14,_0x164ea0){_0x4dab14=_0x4dab14-0x0;var _0xf41aa=_0x2100[_0x4dab14];return _0xf41aa;};'use strict';function ServicenowAccount(_0x3d858c){this['id']=_0x3d858c['id']||0x0;this[_0x0210('0x0')]=_0x3d858c[_0x0210('0x0')]||'';this[_0x0210('0x1')]=_0x3d858c[_0x0210('0x1')]||'';this[_0x0210('0x2')]=_0x3d858c[_0x0210('0x2')]||'';this[_0x0210('0x3')]=_0x3d858c['remoteUri']||'';this[_0x0210('0x4')]=_0x3d858c[_0x0210('0x4')]||'';this['Configurations']=_0x3d858c[_0x0210('0x5')]||{};}module[_0x0210('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x75d3=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x414b94,_0x1cd218){var _0x1cf380=function(_0x3d7104){while(--_0x3d7104){_0x414b94['push'](_0x414b94['shift']());}};_0x1cf380(++_0x1cd218);}(_0x75d3,0x1ca));var _0x375d=function(_0x1beea0,_0x3f4704){_0x1beea0=_0x1beea0-0x0;var _0x24e3c6=_0x75d3[_0x1beea0];return _0x24e3c6;};'use strict';function ServicenowAccount(_0x6013e){this['id']=_0x6013e['id']||0x0;this[_0x375d('0x0')]=_0x6013e['name']||'';this[_0x375d('0x1')]=_0x6013e['username']||'';this[_0x375d('0x2')]=_0x6013e[_0x375d('0x2')]||'';this[_0x375d('0x3')]=_0x6013e[_0x375d('0x3')]||'';this[_0x375d('0x4')]=_0x6013e[_0x375d('0x4')]||'';this[_0x375d('0x5')]=_0x6013e['Configurations']||{};}module[_0x375d('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 6690f22..46683e5 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 _0x08e9=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x08e9,0xd1));var _0x908e=function(_0x178f59,_0x128a03){_0x178f59=_0x178f59-0x0;var _0x58f4d2=_0x08e9[_0x178f59];return _0x58f4d2;};'use strict';function SugarcrmAccount(_0xcf1938){this['id']=_0xcf1938['id']||0x0;this[_0x908e('0x0')]=_0xcf1938[_0x908e('0x0')]||'';this[_0x908e('0x1')]=_0xcf1938[_0x908e('0x1')]||'';this[_0x908e('0x2')]=_0xcf1938[_0x908e('0x2')]||'';this[_0x908e('0x3')]=_0xcf1938[_0x908e('0x3')]||'';this[_0x908e('0x4')]=_0xcf1938[_0x908e('0x4')]||'';this['Configurations']=_0xcf1938[_0x908e('0x5')]||{};}module[_0x908e('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xa74c=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x1e7b6b,_0x548821){var _0x4e1db6=function(_0x31b1ab){while(--_0x31b1ab){_0x1e7b6b['push'](_0x1e7b6b['shift']());}};_0x4e1db6(++_0x548821);}(_0xa74c,0x190));var _0xca74=function(_0x378f44,_0x7dfd92){_0x378f44=_0x378f44-0x0;var _0x552ec4=_0xa74c[_0x378f44];return _0x552ec4;};'use strict';function SugarcrmAccount(_0x3a2038){this['id']=_0x3a2038['id']||0x0;this[_0xca74('0x0')]=_0x3a2038[_0xca74('0x0')]||'';this[_0xca74('0x1')]=_0x3a2038['username']||'';this[_0xca74('0x2')]=_0x3a2038['password']||'';this['remoteUri']=_0x3a2038[_0xca74('0x3')]||'';this[_0xca74('0x4')]=_0x3a2038[_0xca74('0x4')]||'';this[_0xca74('0x5')]=_0x3a2038[_0xca74('0x5')]||{};}module[_0xca74('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 2cc196d..f7d140b 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 _0x63cf=['state','unknown','status','address','exports','name','accountcode'];(function(_0x2b8156,_0x3b37f1){var _0x43819b=function(_0x4671eb){while(--_0x4671eb){_0x2b8156['push'](_0x2b8156['shift']());}};_0x43819b(++_0x3b37f1);}(_0x63cf,0xc9));var _0xf63c=function(_0x4358f5,_0x5b1ac6){_0x4358f5=_0x4358f5-0x0;var _0x4d8104=_0x63cf[_0x4358f5];return _0x4d8104;};'use strict';function Telephone(_0x249118){this['id']=_0x249118['id']||0x0;this[_0xf63c('0x0')]=_0x249118[_0xf63c('0x0')]||'';this[_0xf63c('0x1')]=_0x249118[_0xf63c('0x1')]||'';this[_0xf63c('0x2')]=_0xf63c('0x3');this['stateTime']=0x0;this[_0xf63c('0x4')]='unknown';this[_0xf63c('0x5')]='';}module[_0xf63c('0x6')]=Telephone; \ No newline at end of file +var _0xa9e8=['name','accountcode','stateTime','exports'];(function(_0x32a605,_0x14ad69){var _0x2bf2d1=function(_0x28eeec){while(--_0x28eeec){_0x32a605['push'](_0x32a605['shift']());}};_0x2bf2d1(++_0x14ad69);}(_0xa9e8,0x78));var _0x8a9e=function(_0x37807f,_0x409cb8){_0x37807f=_0x37807f-0x0;var _0x5cafd0=_0xa9e8[_0x37807f];return _0x5cafd0;};'use strict';function Telephone(_0x284109){this['id']=_0x284109['id']||0x0;this[_0x8a9e('0x0')]=_0x284109[_0x8a9e('0x0')]||'';this['accountcode']=_0x284109[_0x8a9e('0x1')]||'';this['state']='unknown';this[_0x8a9e('0x2')]=0x0;this['status']='unknown';this['address']='';}module[_0x8a9e('0x3')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index f73fe8b..2fd3310 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 _0xb10b=['name','html'];(function(_0x246252,_0x12de94){var _0xf3ae3f=function(_0x21ecb5){while(--_0x21ecb5){_0x246252['push'](_0x246252['shift']());}};_0xf3ae3f(++_0x12de94);}(_0xb10b,0x12a));var _0xbb10=function(_0x473d1e,_0x4df799){_0x473d1e=_0x473d1e-0x0;var _0x503be9=_0xb10b[_0x473d1e];return _0x503be9;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0xd91d95,_0x25deb6){var _0x5d1db4=function(_0x9dcd5d){while(--_0x9dcd5d){_0xd91d95['push'](_0xd91d95['shift']());}};_0x5d1db4(++_0x25deb6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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 6689b8b..8b3846e 100644 --- a/server/services/ami/model/trigger.js +++ b/server/services/ami/model/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a85=['status','AllConditions','AnyConditions','Actions','name','channel'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x1a85,0x178));var _0x51a8=function(_0x53c2ec,_0x56b6f8){_0x53c2ec=_0x53c2ec-0x0;var _0xbd4cd0=_0x1a85[_0x53c2ec];return _0xbd4cd0;};'use strict';function Trigger(_0x4570ac){this['id']=_0x4570ac['id']||0x0;this['name']=_0x4570ac[_0x51a8('0x0')]||'';this[_0x51a8('0x1')]=_0x4570ac[_0x51a8('0x1')]||'voice';this['status']=_0x4570ac[_0x51a8('0x2')]||![];this[_0x51a8('0x3')]=_0x4570ac[_0x51a8('0x3')]||[];this['AnyConditions']=_0x4570ac[_0x51a8('0x4')]||[];this['Actions']=_0x4570ac[_0x51a8('0x5')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0x5eb8=['Actions','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x1de4b8,_0x529b41){var _0x557699=function(_0xb10c18){while(--_0xb10c18){_0x1de4b8['push'](_0x1de4b8['shift']());}};_0x557699(++_0x529b41);}(_0x5eb8,0xb0));var _0x85eb=function(_0x1aae33,_0x110a80){_0x1aae33=_0x1aae33-0x0;var _0x2e91e9=_0x5eb8[_0x1aae33];return _0x2e91e9;};'use strict';function Trigger(_0x5ea4df){this['id']=_0x5ea4df['id']||0x0;this['name']=_0x5ea4df[_0x85eb('0x0')]||'';this[_0x85eb('0x1')]=_0x5ea4df[_0x85eb('0x1')]||_0x85eb('0x2');this[_0x85eb('0x3')]=_0x5ea4df[_0x85eb('0x3')]||![];this[_0x85eb('0x4')]=_0x5ea4df[_0x85eb('0x4')]||[];this[_0x85eb('0x5')]=_0x5ea4df[_0x85eb('0x5')]||[];this[_0x85eb('0x6')]=_0x5ea4df[_0x85eb('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 6c312b3..fa1f956 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 _0xa62f=['exports','active','name','state','unknown','registry','indexOf','host','port','domainport','refresh','stateRegistry','address','defaultuser'];(function(_0x35f4b1,_0x55806f){var _0x43a0d1=function(_0x36b3af){while(--_0x36b3af){_0x35f4b1['push'](_0x35f4b1['shift']());}};_0x43a0d1(++_0x55806f);}(_0xa62f,0xd3));var _0xfa62=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xa62f[_0x397e5f];return _0x5302b8;};'use strict';function Trunk(_0x480de1){this['id']=_0x480de1['id']||0x0;this[_0xfa62('0x0')]=_0x480de1[_0xfa62('0x0')]||![];this[_0xfa62('0x1')]=_0x480de1[_0xfa62('0x1')]||'';this[_0xfa62('0x2')]=_0xfa62('0x3');this['stateTime']=0x0;this['status']='unknown';this[_0xfa62('0x4')]=_0x480de1['registry']&&_0x480de1['registry'][_0xfa62('0x5')](':')?_0x480de1[_0xfa62('0x4')]['split'](':')[0x0]:'';this[_0xfa62('0x6')]='';this[_0xfa62('0x7')]='';this['domain']='';this[_0xfa62('0x8')]='';this[_0xfa62('0x9')]='';this[_0xfa62('0xa')]=_0xfa62('0x3');this['registrationtime']='';this[_0xfa62('0xb')]='';this[_0xfa62('0xc')]=_0x480de1['defaultuser']||'';}module[_0xfa62('0xd')]=Trunk; \ No newline at end of file +var _0x6415=['registry','indexOf','port','domain','domainport','refresh','stateRegistry','address','defaultuser','exports','active','name','state','unknown','stateTime','status'];(function(_0x177f45,_0xd320ae){var _0x2d6cd8=function(_0x1a3098){while(--_0x1a3098){_0x177f45['push'](_0x177f45['shift']());}};_0x2d6cd8(++_0xd320ae);}(_0x6415,0x1da));var _0x5641=function(_0x53e46f,_0x4757a5){_0x53e46f=_0x53e46f-0x0;var _0x283b84=_0x6415[_0x53e46f];return _0x283b84;};'use strict';function Trunk(_0x5b8cb6){this['id']=_0x5b8cb6['id']||0x0;this[_0x5641('0x0')]=_0x5b8cb6['active']||![];this[_0x5641('0x1')]=_0x5b8cb6['name']||'';this[_0x5641('0x2')]=_0x5641('0x3');this[_0x5641('0x4')]=0x0;this[_0x5641('0x5')]=_0x5641('0x3');this[_0x5641('0x6')]=_0x5b8cb6[_0x5641('0x6')]&&_0x5b8cb6['registry'][_0x5641('0x7')](':')?_0x5b8cb6[_0x5641('0x6')]['split'](':')[0x0]:'';this['host']='';this[_0x5641('0x8')]='';this[_0x5641('0x9')]='';this[_0x5641('0xa')]='';this[_0x5641('0xb')]='';this[_0x5641('0xc')]=_0x5641('0x3');this['registrationtime']='';this[_0x5641('0xd')]='';this['defaultuser']=_0x5b8cb6[_0x5641('0xe')]||'';}module[_0x5641('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index ad242b0..e84d700 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 _0x0911=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0911,0x184));var _0x1091=function(_0x3dc538,_0x4f7702){_0x3dc538=_0x3dc538-0x0;var _0x72c2fd=_0x0911[_0x3dc538];return _0x72c2fd;};'use strict';function voiceExtension(_0xe2ef2){this['id']=_0xe2ef2['id']||0x0;this[_0x1091('0x0')]=_0xe2ef2[_0x1091('0x0')]||'';this[_0x1091('0x1')]=_0xe2ef2[_0x1091('0x1')]||_0x1091('0x2');this[_0x1091('0x3')]=_0xe2ef2['mandatoryDisposition']||![];}module[_0x1091('0x4')]=voiceExtension; \ No newline at end of file +var _0x34dd=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x529c2d,_0x27d5d6){var _0x483c4f=function(_0x872448){while(--_0x872448){_0x529c2d['push'](_0x529c2d['shift']());}};_0x483c4f(++_0x27d5d6);}(_0x34dd,0x1f2));var _0xd34d=function(_0x2e580f,_0x3edc11){_0x2e580f=_0x2e580f-0x0;var _0x218fe5=_0x34dd[_0x2e580f];return _0x218fe5;};'use strict';function voiceExtension(_0x43a9c4){this['id']=_0x43a9c4['id']||0x0;this[_0xd34d('0x0')]=_0x43a9c4['exten']||'';this['recordingFormat']=_0x43a9c4[_0xd34d('0x1')]||_0xd34d('0x2');this[_0xd34d('0x3')]=_0x43a9c4[_0xd34d('0x3')]||![];}module[_0xd34d('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 81cca0e..ccf622e 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 _0xf6a4=['dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDispositionPause','exports','unknown','not_inuse','busy','invalid','unavailable','ringing','ringinuse','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','sumDuration','sumHoldTime','unmanaged','abandoned','loggedIn','available','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout'];(function(_0xcb6ee8,_0x57ceda){var _0x2beae9=function(_0x468462){while(--_0x468462){_0xcb6ee8['push'](_0xcb6ee8['shift']());}};_0x2beae9(++_0x57ceda);}(_0xf6a4,0x179));var _0x4f6a=function(_0xede38d,_0x5c3c4e){_0xede38d=_0xede38d-0x0;var _0x5ca448=_0xf6a4[_0xede38d];return _0x5ca448;};'use strict';var statusDesc=[_0x4f6a('0x0'),_0x4f6a('0x1'),'inuse',_0x4f6a('0x2'),_0x4f6a('0x3'),_0x4f6a('0x4'),_0x4f6a('0x5'),_0x4f6a('0x6'),'onhold'];var monitorFormat={'wav':'wav','wav49':_0x4f6a('0x7'),'gsm':_0x4f6a('0x8')};var strategy={'rrmemory':_0x4f6a('0x9'),'roundrobin':_0x4f6a('0xa')};function VoiceQueue(_0xe3b42d){this['id']=_0xe3b42d['id']||0x0;this[_0x4f6a('0xb')]=_0xe3b42d['name']||'';this[_0x4f6a('0xc')]=_0xe3b42d[_0x4f6a('0xc')]||'';this[_0x4f6a('0xd')]=_0xe3b42d[_0x4f6a('0xd')]||_0x4f6a('0xe');this[_0x4f6a('0xf')]=0x0;this[_0x4f6a('0x10')]=0x0;this[_0x4f6a('0x11')]=0x0;this['answered']=0x0;this[_0x4f6a('0x12')]=0x0;this[_0x4f6a('0x13')]=0x0;this['sumBillable']=0x0;this[_0x4f6a('0x14')]=0x0;this[_0x4f6a('0x15')]=0x0;this[_0x4f6a('0x16')]=0x0;this[_0x4f6a('0x17')]=0x0;this['acw']=_0xe3b42d['acw']||![];this[_0x4f6a('0x18')]=_0xe3b42d[_0x4f6a('0x18')]||0xa;this[_0x4f6a('0x19')]=_0xe3b42d[_0x4f6a('0x19')]||'no';this[_0x4f6a('0x1a')]=!![];this[_0x4f6a('0x1b')]='';this[_0x4f6a('0x1c')]=0x0;this[_0x4f6a('0x1d')]=0x0;this[_0x4f6a('0x1e')]=_0xe3b42d['dialTimezone']||null;this[_0x4f6a('0x1f')]=_0xe3b42d[_0x4f6a('0x1f')]?_0xe3b42d[_0x4f6a('0x1f')]:null;this[_0x4f6a('0x20')]=_0xe3b42d[_0x4f6a('0x20')];this[_0x4f6a('0x21')]=_0xe3b42d[_0x4f6a('0x21')]||'progressive';this['dialLimitChannel']=_0xe3b42d[_0x4f6a('0x22')]||0x0;this[_0x4f6a('0x23')]=_0xe3b42d[_0x4f6a('0x23')]||0x0;this[_0x4f6a('0x24')]=_0xe3b42d[_0x4f6a('0x24')]||0x1;this['dialPredictiveOptimization']=_0xe3b42d[_0x4f6a('0x25')]||_0x4f6a('0x26');this[_0x4f6a('0x27')]=_0xe3b42d['dialPredictiveOptimizationPercentage']||0.03;this[_0x4f6a('0x28')]=_0xe3b42d[_0x4f6a('0x28')]||0x258;this[_0x4f6a('0x29')]=_0xe3b42d[_0x4f6a('0x29')]||'anonymous';this['dialOriginateCallerIdNumber']=_0xe3b42d['dialOriginateCallerIdNumber']||_0x4f6a('0x2a');this[_0x4f6a('0x2b')]=_0xe3b42d['dialOriginateTimeout']||0x1e;this[_0x4f6a('0x2c')]=_0xe3b42d[_0x4f6a('0x2c')]||_0x4f6a('0x2d');this[_0x4f6a('0x2e')]=_0xe3b42d['dialQueueTimeout']||0x3;this[_0x4f6a('0x2f')]=_0xe3b42d[_0x4f6a('0x2f')]||undefined;this[_0x4f6a('0x30')]=_0xe3b42d['dialCongestionMaxRetry']||0x3;this['dialCongestionRetryFrequency']=_0xe3b42d[_0x4f6a('0x31')]||0x96;this[_0x4f6a('0x32')]=_0xe3b42d['dialBusyMaxRetry']||0x3;this[_0x4f6a('0x33')]=_0xe3b42d['dialBusyRetryFrequency']||0x96;this[_0x4f6a('0x34')]=_0xe3b42d[_0x4f6a('0x34')]||0x3;this[_0x4f6a('0x35')]=_0xe3b42d[_0x4f6a('0x35')]||0x96;this['dialNoSuchNumberMaxRetry']=_0xe3b42d['dialNoSuchNumberMaxRetry']||0x3;this[_0x4f6a('0x36')]=_0xe3b42d[_0x4f6a('0x36')]||0x96;this['dialDropMaxRetry']=_0xe3b42d['dialDropMaxRetry']||0x3;this[_0x4f6a('0x37')]=_0xe3b42d['dialDropRetryFrequency']||0x96;this[_0x4f6a('0x38')]=_0xe3b42d[_0x4f6a('0x38')]||0x3;this[_0x4f6a('0x39')]=_0xe3b42d[_0x4f6a('0x39')]||0x96;this['dialMachineMaxRetry']=_0xe3b42d[_0x4f6a('0x3a')]||0x3;this[_0x4f6a('0x3b')]=_0xe3b42d[_0x4f6a('0x3b')]||0x96;this['dialAgentRejectMaxRetry']=_0xe3b42d[_0x4f6a('0x3c')]||0x3;this['dialAgentRejectRetryFrequency']=_0xe3b42d['dialAgentRejectRetryFrequency']||0x96;this[_0x4f6a('0x3d')]=_0xe3b42d['callAdditionalPhoneAfterMin']||0x3;this[_0x4f6a('0x3e')]=_0xe3b42d[_0x4f6a('0x3e')]||0x4;this[_0x4f6a('0x3f')]=_0xe3b42d[_0x4f6a('0x3f')]?_0xe3b42d['Trunk']:undefined;this[_0x4f6a('0x40')]=_0xe3b42d[_0x4f6a('0x40')]?_0xe3b42d['TrunkBackup']:undefined;this[_0x4f6a('0x41')]=_0xe3b42d[_0x4f6a('0x41')]||undefined;this[_0x4f6a('0x42')]=_0xe3b42d[_0x4f6a('0x42')]?_0xe3b42d[_0x4f6a('0x42')]:undefined;this[_0x4f6a('0x43')]=_0xe3b42d['dialOrderByScheduledAt']||_0x4f6a('0x44');this[_0x4f6a('0x45')]=_0xe3b42d['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x4f6a('0x46')]=_0xe3b42d['dialCutDigit']||undefined;this[_0x4f6a('0x47')]=strategy[_0xe3b42d[_0x4f6a('0x47')]]||_0x4f6a('0x9');this[_0x4f6a('0x48')]=!![];this[_0x4f6a('0x49')]=_0xe3b42d[_0x4f6a('0x49')]||![];this[_0x4f6a('0x4a')]=_0xe3b42d[_0x4f6a('0x4a')];this['dialAMDGreeting']=_0xe3b42d[_0x4f6a('0x4b')];this['dialAMDAfterGreetingSilence']=_0xe3b42d['dialAMDAfterGreetingSilence'];this[_0x4f6a('0x4c')]=_0xe3b42d[_0x4f6a('0x4c')];this[_0x4f6a('0x4d')]=_0xe3b42d['dialAMDMinWordLength'];this[_0x4f6a('0x4e')]=_0xe3b42d['dialAMDBetweenWordsSilence'];this[_0x4f6a('0x4f')]=_0xe3b42d[_0x4f6a('0x4f')];this[_0x4f6a('0x50')]=_0xe3b42d['dialAMDSilenceThreshold'];this[_0x4f6a('0x51')]=_0xe3b42d[_0x4f6a('0x51')];this[_0x4f6a('0x52')]=0x0;this[_0x4f6a('0x53')]=0x0;this[_0x4f6a('0x54')]=_0xe3b42d['timeout'];this[_0x4f6a('0x55')]=0x0;this[_0x4f6a('0x56')]=0x0;this[_0x4f6a('0x57')]=0x0;this[_0x4f6a('0x58')]=0x0;this[_0x4f6a('0x59')]=0x0;this[_0x4f6a('0x5a')]=0x0;this[_0x4f6a('0x5b')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x4f6a('0x5c')]=0x0;this[_0x4f6a('0x5d')]=0x0;this[_0x4f6a('0x5e')]=0x0;this[_0x4f6a('0x5f')]=0x0;this['outboundReCallsDay']=0x0;this[_0x4f6a('0x60')]=0x0;this[_0x4f6a('0x61')]=undefined;this['startPredictive']=undefined;this[_0x4f6a('0x62')]=undefined;this[_0x4f6a('0x63')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x4f6a('0x64')]=0x0;this[_0x4f6a('0x65')]=0x0;this[_0x4f6a('0x66')]=0x0;this[_0x4f6a('0x67')]=0x0;this[_0x4f6a('0x68')]=0x0;this[_0x4f6a('0x69')]=0x0;this[_0x4f6a('0x6a')]=0x0;this['predictiveIntervalMaxThreshold']=_0xe3b42d['dialPredictiveIntervalMaxThreshold']||0x14;this['predictiveIntervalMinThreshold']=_0xe3b42d[_0x4f6a('0x6b')]||0xa;this[_0x4f6a('0x6c')]=0x0;this[_0x4f6a('0x6d')]=0x0;this[_0x4f6a('0x6e')]=0x1;this[_0x4f6a('0x6f')]=0x0;this[_0x4f6a('0x70')]=0x0;this[_0x4f6a('0x71')]=0x0;this['erlangBusyFactor']=0x0;this[_0x4f6a('0x72')]=_0xe3b42d['dialRecallMeTimeout']||0x1e;this[_0x4f6a('0x73')]=_0xe3b42d[_0x4f6a('0x73')]||![];this[_0x4f6a('0x74')]=!!_0xe3b42d[_0x4f6a('0x74')]||![];this[_0x4f6a('0x75')]=!!_0xe3b42d[_0x4f6a('0x75')]||![];this['dialQueueProject2']=_0xe3b42d[_0x4f6a('0x76')]||undefined;this[_0x4f6a('0x77')]=_0xe3b42d['dialAgiAfterHangupClient']||![];this[_0x4f6a('0x78')]=_0xe3b42d['dialAgiAfterHangupAgent']||![];this[_0x4f6a('0xc')]=monitorFormat[_0xe3b42d[_0x4f6a('0xc')]]?monitorFormat[_0xe3b42d[_0x4f6a('0xc')]]:undefined;this['mandatoryDisposition']=_0xe3b42d['mandatoryDisposition']||![];this[_0x4f6a('0x79')]=_0xe3b42d[_0x4f6a('0x79')]?_0xe3b42d[_0x4f6a('0x79')]:undefined;}module[_0x4f6a('0x7a')]=VoiceQueue; \ No newline at end of file +var _0xf0f6=['answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','queueStatusComplete','dialAMDActive','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','wav','wav49','gsm','rrmemory','name','monitor_format','type','waiting','talking','total'];(function(_0xa5437c,_0x51cc91){var _0x975914=function(_0x535229){while(--_0x535229){_0xa5437c['push'](_0xa5437c['shift']());}};_0x975914(++_0x51cc91);}(_0xf0f6,0x6c));var _0x6f0f=function(_0x4d527f,_0x6aba97){_0x4d527f=_0x4d527f-0x0;var _0x447543=_0xf0f6[_0x4d527f];return _0x447543;};'use strict';var statusDesc=['unknown',_0x6f0f('0x0'),_0x6f0f('0x1'),_0x6f0f('0x2'),_0x6f0f('0x3'),_0x6f0f('0x4'),_0x6f0f('0x5'),_0x6f0f('0x6'),'onhold'];var monitorFormat={'wav':_0x6f0f('0x7'),'wav49':_0x6f0f('0x8'),'gsm':_0x6f0f('0x9')};var strategy={'rrmemory':_0x6f0f('0xa'),'roundrobin':'roundrobin'};function VoiceQueue(_0x188d28){this['id']=_0x188d28['id']||0x0;this[_0x6f0f('0xb')]=_0x188d28['name']||'';this[_0x6f0f('0xc')]=_0x188d28[_0x6f0f('0xc')]||'';this[_0x6f0f('0xd')]=_0x188d28['type']||'inbound';this[_0x6f0f('0xe')]=0x0;this[_0x6f0f('0xf')]=0x0;this[_0x6f0f('0x10')]=0x0;this[_0x6f0f('0x11')]=0x0;this[_0x6f0f('0x12')]=0x0;this[_0x6f0f('0x13')]=0x0;this[_0x6f0f('0x14')]=0x0;this[_0x6f0f('0x15')]=0x0;this[_0x6f0f('0x16')]=0x0;this[_0x6f0f('0x17')]=0x0;this[_0x6f0f('0x18')]=0x0;this[_0x6f0f('0x19')]=_0x188d28['acw']||![];this[_0x6f0f('0x1a')]=_0x188d28[_0x6f0f('0x1a')]||0xa;this[_0x6f0f('0x1b')]=_0x188d28[_0x6f0f('0x1b')]||'no';this[_0x6f0f('0x1c')]=!![];this['message']='';this[_0x6f0f('0x1d')]=0x0;this[_0x6f0f('0x1e')]=0x0;this[_0x6f0f('0x1f')]=_0x188d28[_0x6f0f('0x1f')]||null;this[_0x6f0f('0x20')]=_0x188d28[_0x6f0f('0x20')]?_0x188d28[_0x6f0f('0x20')]:null;this[_0x6f0f('0x21')]=_0x188d28['dialActive'];this[_0x6f0f('0x22')]=_0x188d28[_0x6f0f('0x22')]||_0x6f0f('0x23');this[_0x6f0f('0x24')]=_0x188d28['dialLimitChannel']||0x0;this[_0x6f0f('0x25')]=_0x188d28[_0x6f0f('0x25')]||0x0;this['dialPowerLevel']=_0x188d28['dialPowerLevel']||0x1;this[_0x6f0f('0x26')]=_0x188d28[_0x6f0f('0x26')]||_0x6f0f('0x27');this[_0x6f0f('0x28')]=_0x188d28[_0x6f0f('0x28')]||0.03;this[_0x6f0f('0x29')]=_0x188d28['dialPredictiveInterval']||0x258;this['dialOriginateCallerIdName']=_0x188d28[_0x6f0f('0x2a')]||_0x6f0f('0x2b');this[_0x6f0f('0x2c')]=_0x188d28[_0x6f0f('0x2c')]||_0x6f0f('0x2b');this['dialOriginateTimeout']=_0x188d28[_0x6f0f('0x2d')]||0x1e;this[_0x6f0f('0x2e')]=_0x188d28['dialQueueOptions']||'tTxX';this['dialQueueTimeout']=_0x188d28[_0x6f0f('0x2f')]||0x3;this[_0x6f0f('0x30')]=_0x188d28['dialQueueProject']||undefined;this[_0x6f0f('0x31')]=_0x188d28['dialCongestionMaxRetry']||0x3;this[_0x6f0f('0x32')]=_0x188d28['dialCongestionRetryFrequency']||0x96;this[_0x6f0f('0x33')]=_0x188d28[_0x6f0f('0x33')]||0x3;this[_0x6f0f('0x34')]=_0x188d28[_0x6f0f('0x34')]||0x96;this[_0x6f0f('0x35')]=_0x188d28[_0x6f0f('0x35')]||0x3;this[_0x6f0f('0x36')]=_0x188d28[_0x6f0f('0x36')]||0x96;this[_0x6f0f('0x37')]=_0x188d28[_0x6f0f('0x37')]||0x3;this[_0x6f0f('0x38')]=_0x188d28[_0x6f0f('0x38')]||0x96;this[_0x6f0f('0x39')]=_0x188d28[_0x6f0f('0x39')]||0x3;this[_0x6f0f('0x3a')]=_0x188d28[_0x6f0f('0x3a')]||0x96;this[_0x6f0f('0x3b')]=_0x188d28[_0x6f0f('0x3b')]||0x3;this[_0x6f0f('0x3c')]=_0x188d28[_0x6f0f('0x3c')]||0x96;this[_0x6f0f('0x3d')]=_0x188d28[_0x6f0f('0x3d')]||0x3;this['dialMachineRetryFrequency']=_0x188d28[_0x6f0f('0x3e')]||0x96;this[_0x6f0f('0x3f')]=_0x188d28[_0x6f0f('0x3f')]||0x3;this['dialAgentRejectRetryFrequency']=_0x188d28['dialAgentRejectRetryFrequency']||0x96;this[_0x6f0f('0x40')]=_0x188d28['callAdditionalPhoneAfterMin']||0x3;this[_0x6f0f('0x41')]=_0x188d28[_0x6f0f('0x41')]||0x4;this[_0x6f0f('0x42')]=_0x188d28[_0x6f0f('0x42')]?_0x188d28[_0x6f0f('0x42')]:undefined;this['TrunkBackup']=_0x188d28[_0x6f0f('0x43')]?_0x188d28[_0x6f0f('0x43')]:undefined;this[_0x6f0f('0x44')]=_0x188d28[_0x6f0f('0x44')]||undefined;this['Interval']=_0x188d28[_0x6f0f('0x45')]?_0x188d28[_0x6f0f('0x45')]:undefined;this[_0x6f0f('0x46')]=_0x188d28['dialOrderByScheduledAt']||_0x6f0f('0x47');this[_0x6f0f('0x48')]=_0x188d28['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x6f0f('0x49')]=_0x188d28['dialCutDigit']||undefined;this['strategy']=strategy[_0x188d28['strategy']]||_0x6f0f('0xa');this[_0x6f0f('0x4a')]=!![];this[_0x6f0f('0x4b')]=_0x188d28[_0x6f0f('0x4b')]||![];this['dialAMDInitialSilence']=_0x188d28['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x188d28['dialAMDGreeting'];this[_0x6f0f('0x4c')]=_0x188d28[_0x6f0f('0x4c')];this['dialAMDTotalAnalysisTime']=_0x188d28[_0x6f0f('0x4d')];this[_0x6f0f('0x4e')]=_0x188d28[_0x6f0f('0x4e')];this['dialAMDBetweenWordsSilence']=_0x188d28[_0x6f0f('0x4f')];this['dialAMDMaximumNumberOfWords']=_0x188d28['dialAMDMaximumNumberOfWords'];this[_0x6f0f('0x50')]=_0x188d28[_0x6f0f('0x50')];this[_0x6f0f('0x51')]=_0x188d28[_0x6f0f('0x51')];this[_0x6f0f('0x52')]=0x0;this[_0x6f0f('0x53')]=0x0;this[_0x6f0f('0x54')]=_0x188d28[_0x6f0f('0x54')];this[_0x6f0f('0x55')]=0x0;this[_0x6f0f('0x56')]=0x0;this[_0x6f0f('0x57')]=0x0;this[_0x6f0f('0x58')]=0x0;this[_0x6f0f('0x59')]=0x0;this[_0x6f0f('0x5a')]=0x0;this[_0x6f0f('0x5b')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x6f0f('0x5c')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x6f0f('0x5d')]=0x0;this[_0x6f0f('0x5e')]=0x0;this['outboundReCallsDay']=0x0;this[_0x6f0f('0x5f')]=0x0;this[_0x6f0f('0x60')]=undefined;this[_0x6f0f('0x61')]=undefined;this[_0x6f0f('0x62')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x6f0f('0x63')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x6f0f('0x64')]=0x0;this[_0x6f0f('0x65')]=0x0;this[_0x6f0f('0x66')]=0x0;this[_0x6f0f('0x67')]=0x0;this[_0x6f0f('0x68')]=0x0;this[_0x6f0f('0x69')]=0x0;this[_0x6f0f('0x6a')]=_0x188d28[_0x6f0f('0x6b')]||0x14;this[_0x6f0f('0x6c')]=_0x188d28[_0x6f0f('0x6b')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x6f0f('0x6d')]=0x0;this[_0x6f0f('0x6e')]=0x1;this[_0x6f0f('0x6f')]=0x0;this[_0x6f0f('0x70')]=0x0;this[_0x6f0f('0x71')]=0x0;this[_0x6f0f('0x72')]=0x0;this[_0x6f0f('0x73')]=_0x188d28[_0x6f0f('0x73')]||0x1e;this[_0x6f0f('0x74')]=_0x188d28[_0x6f0f('0x74')]||![];this['dialPreviewAutoRecallMe']=!!_0x188d28[_0x6f0f('0x75')]||![];this[_0x6f0f('0x76')]=!!_0x188d28['dialPreviewRecallmeReminder']||![];this[_0x6f0f('0x77')]=_0x188d28[_0x6f0f('0x77')]||undefined;this[_0x6f0f('0x78')]=_0x188d28['dialAgiAfterHangupClient']||![];this['dialAgiAfterHangupAgent']=_0x188d28[_0x6f0f('0x79')]||![];this[_0x6f0f('0xc')]=monitorFormat[_0x188d28['monitor_format']]?monitorFormat[_0x188d28[_0x6f0f('0xc')]]:undefined;this[_0x6f0f('0x7a')]=_0x188d28[_0x6f0f('0x7a')]||![];this[_0x6f0f('0x7b')]=_0x188d28[_0x6f0f('0x7b')]?_0x188d28['mandatoryDispositionPause']:undefined;}module[_0x6f0f('0x7c')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index b35ab8b..af51ffc 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 _0x1d8e=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x3d146a,_0x4694c3){var _0x625e32=function(_0x368eaa){while(--_0x368eaa){_0x3d146a['push'](_0x3d146a['shift']());}};_0x625e32(++_0x4694c3);}(_0x1d8e,0xcc));var _0xe1d8=function(_0x4350c2,_0x112f3c){_0x4350c2=_0x4350c2-0x0;var _0x8b6406=_0x1d8e[_0x4350c2];return _0x8b6406;};'use strict';function VtigerAccount(_0x6249c3){this['id']=_0x6249c3['id']||0x0;this[_0xe1d8('0x0')]=_0x6249c3[_0xe1d8('0x0')]||'';this[_0xe1d8('0x1')]=_0x6249c3[_0xe1d8('0x1')]||'';this[_0xe1d8('0x2')]=_0x6249c3[_0xe1d8('0x2')]||'';this[_0xe1d8('0x3')]=_0x6249c3[_0xe1d8('0x3')]||'';this[_0xe1d8('0x4')]=_0x6249c3['serverUrl']||'';this[_0xe1d8('0x5')]=_0x6249c3[_0xe1d8('0x5')]||{};}module[_0xe1d8('0x6')]=VtigerAccount; \ No newline at end of file +var _0x14d9=['name','accessKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x46451c,_0x88ddd){var _0x12dce4=function(_0x2e4087){while(--_0x2e4087){_0x46451c['push'](_0x46451c['shift']());}};_0x12dce4(++_0x88ddd);}(_0x14d9,0x126));var _0x914d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x14d9[_0x3dd15e];return _0x231fd0;};'use strict';function VtigerAccount(_0x16ccef){this['id']=_0x16ccef['id']||0x0;this[_0x914d('0x0')]=_0x16ccef['name']||'';this['username']=_0x16ccef['username']||'';this[_0x914d('0x1')]=_0x16ccef['accessKey']||'';this[_0x914d('0x2')]=_0x16ccef[_0x914d('0x2')]||'';this[_0x914d('0x3')]=_0x16ccef[_0x914d('0x3')]||'';this['Configurations']=_0x16ccef[_0x914d('0x4')]||{};}module[_0x914d('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 80ee183..5e1e02f 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 _0x7b76=['password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7b76,0xb9));var _0x67b7=function(_0x3184a0,_0x3de9bb){_0x3184a0=_0x3184a0-0x0;var _0x30f781=_0x7b76[_0x3184a0];return _0x30f781;};'use strict';function ZendeskAccount(_0x4e8ca1){this['id']=_0x4e8ca1['id']||0x0;this[_0x67b7('0x0')]=_0x4e8ca1[_0x67b7('0x0')]||'';this['username']=_0x4e8ca1[_0x67b7('0x1')]||'';this[_0x67b7('0x2')]=_0x4e8ca1[_0x67b7('0x2')]||'';this[_0x67b7('0x3')]=_0x4e8ca1['token']||'';this[_0x67b7('0x4')]=_0x4e8ca1['remoteUri']||'';this[_0x67b7('0x5')]=_0x4e8ca1[_0x67b7('0x5')]||'';this[_0x67b7('0x6')]=_0x4e8ca1[_0x67b7('0x6')]||_0x67b7('0x7');this[_0x67b7('0x8')]=_0x4e8ca1[_0x67b7('0x8')]||'';this[_0x67b7('0x9')]=_0x4e8ca1[_0x67b7('0x9')]||{};}module[_0x67b7('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x7fc6=['name','username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports'];(function(_0x47c89e,_0x18692c){var _0x1de51e=function(_0x5a8b06){while(--_0x5a8b06){_0x47c89e['push'](_0x47c89e['shift']());}};_0x1de51e(++_0x18692c);}(_0x7fc6,0x176));var _0x67fc=function(_0x1a2363,_0x1e1682){_0x1a2363=_0x1a2363-0x0;var _0x4ef286=_0x7fc6[_0x1a2363];return _0x4ef286;};'use strict';function ZendeskAccount(_0x359c89){this['id']=_0x359c89['id']||0x0;this[_0x67fc('0x0')]=_0x359c89[_0x67fc('0x0')]||'';this[_0x67fc('0x1')]=_0x359c89[_0x67fc('0x1')]||'';this[_0x67fc('0x2')]=_0x359c89[_0x67fc('0x2')]||'';this[_0x67fc('0x3')]=_0x359c89[_0x67fc('0x3')]||'';this[_0x67fc('0x4')]=_0x359c89[_0x67fc('0x4')]||'';this[_0x67fc('0x5')]=_0x359c89['authType']||'';this[_0x67fc('0x6')]=_0x359c89['type']||_0x67fc('0x7');this['serverUrl']=_0x359c89[_0x67fc('0x8')]||'';this[_0x67fc('0x9')]=_0x359c89[_0x67fc('0x9')]||{};}module[_0x67fc('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index d567760..e04dd50 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 _0x359e=['serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0x359e,0xf7));var _0xe359=function(_0x1f7d68,_0x550a0b){_0x1f7d68=_0x1f7d68-0x0;var _0x1cc7d3=_0x359e[_0x1f7d68];return _0x1cc7d3;};'use strict';function ZohoAccount(_0x261965){this['id']=_0x261965['id']||0x0;this[_0xe359('0x0')]=_0x261965[_0xe359('0x0')]||'';this[_0xe359('0x1')]=_0x261965[_0xe359('0x1')]||'';this[_0xe359('0x2')]=_0x261965[_0xe359('0x2')]||'';this[_0xe359('0x3')]=_0x261965['zone']||'';this[_0xe359('0x4')]=_0x261965[_0xe359('0x4')]||'';this[_0xe359('0x5')]=_0x261965[_0xe359('0x5')]||'';this[_0xe359('0x6')]=_0x261965[_0xe359('0x6')]||'';this[_0xe359('0x7')]=_0x261965[_0xe359('0x7')]||'';this['refreshToken']=_0x261965[_0xe359('0x8')]||'';this['Configurations']=_0x261965[_0xe359('0x9')]||{};}module[_0xe359('0xa')]=ZohoAccount; \ No newline at end of file +var _0xde4a=['code','refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xde4a,0x17a));var _0xade4=function(_0x164b95,_0x54ea6a){_0x164b95=_0x164b95-0x0;var _0x431874=_0xde4a[_0x164b95];return _0x431874;};'use strict';function ZohoAccount(_0x1a7b71){this['id']=_0x1a7b71['id']||0x0;this[_0xade4('0x0')]=_0x1a7b71['name']||'';this['description']=_0x1a7b71[_0xade4('0x1')]||'';this[_0xade4('0x2')]=_0x1a7b71[_0xade4('0x2')]||'';this[_0xade4('0x3')]=_0x1a7b71[_0xade4('0x3')]||'';this[_0xade4('0x4')]=_0x1a7b71[_0xade4('0x4')]||'';this['clientSecret']=_0x1a7b71[_0xade4('0x5')]||'';this[_0xade4('0x6')]=_0x1a7b71[_0xade4('0x6')]||'';this['code']=_0x1a7b71[_0xade4('0x7')]||'';this[_0xade4('0x8')]=_0x1a7b71[_0xade4('0x8')]||'';this[_0xade4('0x9')]=_0x1a7b71['Configurations']||{};}module[_0xade4('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index bbc2a22..e0e2938 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 _0x6d11=['countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','type','campaigntype','queue','membername','Agent','name','channelAgent','format','calleridname','Contact','phone','lastName','active','calleridnum','scheduledat','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x962c9e,_0x178323){var _0x4b2a4b=function(_0x464863){while(--_0x464863){_0x962c9e['push'](_0x962c9e['shift']());}};_0x4b2a4b(++_0x178323);}(_0x6d11,0xbf));var _0x16d1=function(_0x4d7433,_0x225b4f){_0x4d7433=_0x4d7433-0x0;var _0x23917d=_0x6d11[_0x4d7433];return _0x23917d;};'use strict';var util=require(_0x16d1('0x0'));var _=require(_0x16d1('0x1'));var moment=require(_0x16d1('0x2'));function checkNameSurname(_0x49dea5,_0x14fc8e,_0x57a8f9){var _0x364469='';if(!_[_0x16d1('0x3')](_0x14fc8e)&&'string'===typeof _0x14fc8e){_0x364469+=_0x14fc8e;}if(!_['isNil'](_0x57a8f9)&&_0x16d1('0x4')===typeof _0x57a8f9){_0x364469+='\x20'+_0x57a8f9;}if(_0x364469!==''){return _0x364469;}return _0x49dea5;}function Action(_0x46f7d7,_0x3eb9e2,_0x38626d,_0x1009dc,_0x150217){this[_0x16d1('0x5')]=_0x38626d||undefined;this['idContact']=_0x46f7d7['id'];this['queue']=_0x3eb9e2['name'];this[_0x16d1('0x6')]=_0x3eb9e2[_0x16d1('0x6')];this[_0x16d1('0x7')]=_0x16d1('0x8');this['dialAnswer']=![];this[_0x16d1('0x9')]=_[_0x16d1('0x3')](_0x46f7d7[_0x16d1('0xa')])?undefined:_0x46f7d7[_0x16d1('0xa')][_0x16d1('0xb')];this[_0x16d1('0xc')]=this[_0x16d1('0x9')]?util[_0x16d1('0xd')]('SIP/%s',this[_0x16d1('0x9')]):_0x1009dc||undefined;this[_0x16d1('0xe')]=checkNameSurname(_0x46f7d7[_0x16d1('0xf')][_0x16d1('0x10')],_0x46f7d7[_0x16d1('0xf')]['firstName'],_0x46f7d7[_0x16d1('0xf')][_0x16d1('0x11')]);this[_0x16d1('0x12')]=_0x46f7d7[_0x16d1('0x12')]||![];this[_0x16d1('0x13')]=_0x46f7d7[_0x16d1('0x10')];this[_0x16d1('0x14')]=_0x46f7d7['scheduledat'];this[_0x16d1('0x15')]=_0x46f7d7[_0x16d1('0x15')]||0x0;this['countcongestionretry']=_0x46f7d7['countcongestionretry']||0x0;this[_0x16d1('0x16')]=_0x46f7d7['countnoanswerretry']||0x0;this[_0x16d1('0x17')]=(_0x46f7d7['countbusyretry']||0x0)+(_0x46f7d7[_0x16d1('0x18')]||0x0)+(_0x46f7d7['countnoanswerretry']||0x0)+(_0x46f7d7[_0x16d1('0x19')]||0x0)+(_0x46f7d7[_0x16d1('0x1a')]||0x0)+(_0x46f7d7['countabandonedretry']||0x0)+(_0x46f7d7['countmachineretry']||0x0)+(_0x46f7d7['countagentrejectretry']||0x0);this['countnosuchnumberretry']=_0x46f7d7[_0x16d1('0x19')]||0x0;this['countdropretry']=_0x46f7d7[_0x16d1('0x1a')]||0x0;this[_0x16d1('0x1b')]=_0x46f7d7[_0x16d1('0x1b')]||0x0;this[_0x16d1('0x1c')]=_0x46f7d7['countmachineretry']||0x0;this[_0x16d1('0x1d')]=_0x46f7d7[_0x16d1('0x1d')]||0x0;this[_0x16d1('0x1e')]=_0x46f7d7['callback'];this[_0x16d1('0x1f')]=_0x46f7d7[_0x16d1('0x1f')];this[_0x16d1('0x20')]=_0x46f7d7[_0x16d1('0x20')];this[_0x16d1('0x21')]=_0x46f7d7[_0x16d1('0x21')];this[_0x16d1('0x22')]=_0x46f7d7[_0x16d1('0x22')];this[_0x16d1('0x23')]=_0x46f7d7[_0x16d1('0x23')];this[_0x16d1('0x24')]=_[_0x16d1('0x3')](_0x46f7d7[_0x16d1('0xa')])?_0x46f7d7[_0x16d1('0x24')]:_0x46f7d7[_0x16d1('0xa')]['id'];this[_0x16d1('0x25')]=_0x46f7d7['VoiceQueueId'];this[_0x16d1('0x26')]='';this[_0x16d1('0x27')]='';}Action[_0x16d1('0x28')]['getCaller']=function(){return util[_0x16d1('0xd')](_0x16d1('0x29'),this[_0x16d1('0xe')],this[_0x16d1('0x2a')]);};module[_0x16d1('0x2b')]=Action; \ No newline at end of file +var _0x781d=['calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','Agent','UserId','VoiceQueueId','prototype','\x22%s\x22\x20<%s>','exports','util','lodash','isNil','string','uniqueid','idContact','queue','type','campaigntype','membername','name','channelAgent','format','SIP/%s'];(function(_0x116083,_0x337730){var _0x9a97bc=function(_0x31a041){while(--_0x31a041){_0x116083['push'](_0x116083['shift']());}};_0x9a97bc(++_0x337730);}(_0x781d,0x14a));var _0xd781=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x781d[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xd781('0x0'));var _=require(_0xd781('0x1'));var moment=require('moment');function checkNameSurname(_0x5c1007,_0xb125bf,_0x44a72d){var _0x3cd308='';if(!_[_0xd781('0x2')](_0xb125bf)&&_0xd781('0x3')===typeof _0xb125bf){_0x3cd308+=_0xb125bf;}if(!_[_0xd781('0x2')](_0x44a72d)&&_0xd781('0x3')===typeof _0x44a72d){_0x3cd308+='\x20'+_0x44a72d;}if(_0x3cd308!==''){return _0x3cd308;}return _0x5c1007;}function Action(_0x1d4f4e,_0x830b,_0x2f98ee,_0x5a07f0,_0x133509){this[_0xd781('0x4')]=_0x2f98ee||undefined;this[_0xd781('0x5')]=_0x1d4f4e['id'];this[_0xd781('0x6')]=_0x830b['name'];this[_0xd781('0x7')]=_0x830b['type'];this[_0xd781('0x8')]=_0xd781('0x6');this['dialAnswer']=![];this[_0xd781('0x9')]=_[_0xd781('0x2')](_0x1d4f4e['Agent'])?undefined:_0x1d4f4e['Agent'][_0xd781('0xa')];this[_0xd781('0xb')]=this[_0xd781('0x9')]?util[_0xd781('0xc')](_0xd781('0xd'),this[_0xd781('0x9')]):_0x5a07f0||undefined;this[_0xd781('0xe')]=checkNameSurname(_0x1d4f4e[_0xd781('0xf')][_0xd781('0x10')],_0x1d4f4e[_0xd781('0xf')][_0xd781('0x11')],_0x1d4f4e['Contact'][_0xd781('0x12')]);this[_0xd781('0x13')]=_0x1d4f4e['active']||![];this[_0xd781('0x14')]=_0x1d4f4e['phone'];this[_0xd781('0x15')]=_0x1d4f4e[_0xd781('0x15')];this[_0xd781('0x16')]=_0x1d4f4e[_0xd781('0x16')]||0x0;this[_0xd781('0x17')]=_0x1d4f4e[_0xd781('0x17')]||0x0;this[_0xd781('0x18')]=_0x1d4f4e['countnoanswerretry']||0x0;this[_0xd781('0x19')]=(_0x1d4f4e[_0xd781('0x16')]||0x0)+(_0x1d4f4e[_0xd781('0x17')]||0x0)+(_0x1d4f4e[_0xd781('0x18')]||0x0)+(_0x1d4f4e[_0xd781('0x1a')]||0x0)+(_0x1d4f4e[_0xd781('0x1b')]||0x0)+(_0x1d4f4e[_0xd781('0x1c')]||0x0)+(_0x1d4f4e[_0xd781('0x1d')]||0x0)+(_0x1d4f4e['countagentrejectretry']||0x0);this[_0xd781('0x1a')]=_0x1d4f4e[_0xd781('0x1a')]||0x0;this[_0xd781('0x1b')]=_0x1d4f4e[_0xd781('0x1b')]||0x0;this[_0xd781('0x1c')]=_0x1d4f4e[_0xd781('0x1c')]||0x0;this[_0xd781('0x1d')]=_0x1d4f4e['countmachineretry']||0x0;this[_0xd781('0x1e')]=_0x1d4f4e['countagentrejectretry']||0x0;this['callback']=_0x1d4f4e[_0xd781('0x1f')];this['callbackuniqueid']=_0x1d4f4e[_0xd781('0x20')];this[_0xd781('0x21')]=_0x1d4f4e[_0xd781('0x21')];this[_0xd781('0x22')]=_0x1d4f4e[_0xd781('0x22')];this[_0xd781('0x23')]=_0x1d4f4e[_0xd781('0x23')];this[_0xd781('0x24')]=_0x1d4f4e[_0xd781('0x24')];this['UserId']=_['isNil'](_0x1d4f4e[_0xd781('0x25')])?_0x1d4f4e[_0xd781('0x26')]:_0x1d4f4e[_0xd781('0x25')]['id'];this['VoiceQueueId']=_0x1d4f4e[_0xd781('0x27')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0xd781('0x28')]['getCaller']=function(){return util[_0xd781('0xc')](_0xd781('0x29'),this['calleridname'],this['number']);};module[_0xd781('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index f9f9a72..e676e7c 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 _0x24b0=['outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','erlangCalls','erlangBusyFactor','startPredictive','startProgressive','Trunk','name','active','callerid','Interval','stringify','md5','voice:queue:%s','voice_queue:save','info','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','paused','message','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','dialMethod','booked','clearZombieChannels','hasOwnProperty','setMessage','isNil','[clearZombieChannels][talking]','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','UserId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','clearZombieChannel','recallMe','agentReadyId','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','then','[RecallMe]','disableContact','starttime','format','logCustomer','RecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','logger2','IsNotLoggedIn','AGENTS_NOT_LOGGED','NOT_ACTIVE','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','additional','dialNoSuchNumberRetryFrequency','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','idContact','incrementPreviewCounters','swapAdditionalPhones','responsetime','[syncHangup][talking][increment]','uniqueid','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','total','[16]','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','BUSY','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','NOANSWER','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','verifyAdditionalPhones','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','ANSWER','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','resolve','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','Contact','Contact\x20is\x20undefined','Queue','lookAgent','isEmpty','[Preview][execCall][success]','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','unmonitored','unlock','unlockContact','execRun','getContactPreview','validateContact','isValid','checkIsBlackList','phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','YYYY-MM-DD\x20HH:mm:ss','variables','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','isFailure','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','destuniqueid','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','uuid','moment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','syncHangup','syncHangupRequest','syncDialEnd','syncNewExten','varset','syncVarSet','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','strategy','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','talking','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoSuchCallsDay'];(function(_0xe10afc,_0x4d37fa){var _0x4737dd=function(_0x1411af){while(--_0x1411af){_0xe10afc['push'](_0xe10afc['shift']());}};_0x4737dd(++_0x4d37fa);}(_0x24b0,0x120));var _0x024b=function(_0x3ab3b2,_0x1fb4e1){_0x3ab3b2=_0x3ab3b2-0x0;var _0x52df08=_0x24b0[_0x3ab3b2];return _0x52df08;};'use strict';var util=require(_0x024b('0x0'));var _=require('lodash');var uuid=require(_0x024b('0x1'));var moment=require(_0x024b('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x024b('0x3'))(_0x024b('0x4'));var loggerAction=require(_0x024b('0x3'))(_0x024b('0x5'));var ami=require(_0x024b('0x6'));var rpcDb=require(_0x024b('0x7'));var cmHopperAdditionalPhone=require(_0x024b('0x8'));var Action=require(_0x024b('0x9'));var ut=require('./util/util');config[_0x024b('0xa')]=_[_0x024b('0xb')](config[_0x024b('0xa')],{'host':_0x024b('0xc'),'port':0x18eb});var io=require(_0x024b('0xd'))(new Redis(config[_0x024b('0xa')]));var Sequence=function(){};Sequence[_0x024b('0xe')][_0x024b('0xf')]=function(_0x5ed2bf){this[_0x024b('0x10')]=this['tail']?this[_0x024b('0x10')]['finally'](_0x5ed2bf):_0x5ed2bf();};function Preview(_0x5c0a37){this[_0x024b('0x11')]=new Sequence();this[_0x024b('0x12')]=_0x5c0a37[_0x024b('0x13')];this['trunks']=_0x5c0a37[_0x024b('0x14')];this[_0x024b('0x15')]={};this[_0x024b('0x16')]=_0x5c0a37['agents'];this[_0x024b('0x17')]=0x0;ami['on']('originateresponse',this[_0x024b('0x18')][_0x024b('0x19')](this));ami['on']('hangup',this[_0x024b('0x1a')][_0x024b('0x19')](this));ami['on']('hanguprequest',this[_0x024b('0x1b')][_0x024b('0x19')](this));ami['on']('dialend',this[_0x024b('0x1c')][_0x024b('0x19')](this));ami['on']('newexten',this[_0x024b('0x1d')]['bind'](this));ami['on'](_0x024b('0x1e'),this[_0x024b('0x1f')]['bind'](this));ami['on']('attendedtransfer',this[_0x024b('0x20')][_0x024b('0x19')](this));ami['on'](_0x024b('0x21'),this[_0x024b('0x22')][_0x024b('0x19')](this));this[_0x024b('0x23')](this['campaignsPreview']);}function emit(_0x34d7a5,_0x4e9da0,_0x2351d4){io['to'](_0x34d7a5)[_0x024b('0x24')](_0x4e9da0,_0x2351d4);}function emitCampaignPreview(_0x46344b){if(_0x46344b[_0x024b('0x25')]===_0x024b('0x26')){var _0x52ace0={'id':_0x46344b['id'],'name':_0x46344b['name'],'strategy':_0x46344b[_0x024b('0x27')],'answered':_0x46344b[_0x024b('0x28')],'available':_0x46344b[_0x024b('0x29')],'loggedIn':_0x46344b[_0x024b('0x2a')],'pTalking':_0x46344b[_0x024b('0x2b')],'sumBillable':_0x46344b['sumBillable'],'sumDuration':_0x46344b[_0x024b('0x2c')],'sumHoldTime':_0x46344b[_0x024b('0x2d')]||0x0,'talking':_0x46344b[_0x024b('0x2e')],'total':_0x46344b['total'],'type':_0x46344b[_0x024b('0x25')],'unmanaged':_0x46344b[_0x024b('0x2f')],'abandoned':_0x46344b[_0x024b('0x30')],'waiting':_0x46344b[_0x024b('0x31')],'loggedInDb':_0x46344b[_0x024b('0x32')],'dialActive':_0x46344b[_0x024b('0x33')],'dialMethod':_0x46344b['dialMethod'],'dialOriginateCallerIdName':_0x46344b[_0x024b('0x34')],'dialOriginateCallerIdNumber':_0x46344b[_0x024b('0x35')],'dialOriginateTimeout':_0x46344b[_0x024b('0x36')],'dialPrefix':_0x46344b[_0x024b('0x37')],'outboundAnswerAgiCallsDay':_0x46344b[_0x024b('0x38')],'outboundAnswerCallsDay':_0x46344b[_0x024b('0x39')],'outboundBlacklistCallsDay':_0x46344b['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x46344b[_0x024b('0x3a')],'outboundCongestionCallsDay':_0x46344b[_0x024b('0x3b')],'outboundDropCallsDayACS':_0x46344b[_0x024b('0x3c')],'outboundDropCallsDayCallersExit':_0x46344b[_0x024b('0x3d')],'outboundDropCallsDayTimeout':_0x46344b['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x46344b['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x46344b[_0x024b('0x3e')],'outboundOriginateFailureCallsDay':_0x46344b[_0x024b('0x3f')],'outboundReCallsDay':_0x46344b[_0x024b('0x40')],'outboundRejectCallsDay':_0x46344b[_0x024b('0x41')],'outboundUnknownCallsDay':_0x46344b['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x46344b['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x46344b[_0x024b('0x42')],'predictiveIntervalAvgHoldtime':_0x46344b[_0x024b('0x43')],'predictiveIntervalAvgTalktime':_0x46344b[_0x024b('0x44')],'predictiveIntervalDroppedCallsCallersExit':_0x46344b[_0x024b('0x45')],'predictiveIntervalDroppedCallsTimeout':_0x46344b[_0x024b('0x46')],'predictiveIntervalErlangCalls':_0x46344b[_0x024b('0x47')],'predictiveIntervalErlangCallsDroppedCalls':_0x46344b[_0x024b('0x48')],'predictiveIntervalHitRate':_0x46344b[_0x024b('0x49')],'predictiveIntervalMultiplicativeFactor':_0x46344b[_0x024b('0x4a')],'predictiveIntervalPauses':_0x46344b['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x46344b['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x46344b[_0x024b('0x4b')],'message':_0x46344b['message'],'originated':_0x46344b['originated'],'erlangCalls':_0x46344b[_0x024b('0x4c')],'erlangCallToSecond':_0x46344b['erlangCallToSecond'],'erlangAbandonmentRate':_0x46344b['erlangAbandonmentRate'],'erlangBusyFactor':_0x46344b[_0x024b('0x4d')],'startPredictive':_0x46344b[_0x024b('0x4e')],'startProgressive':_0x46344b[_0x024b('0x4f')]};if(_0x46344b['Trunk']){_0x52ace0[_0x024b('0x50')]={'id':_0x46344b[_0x024b('0x50')]['id'],'name':_0x46344b[_0x024b('0x50')][_0x024b('0x51')],'active':_0x46344b[_0x024b('0x50')][_0x024b('0x52')],'callerid':_0x46344b['Trunk'][_0x024b('0x53')]};}if(_0x46344b[_0x024b('0x54')]){_0x52ace0[_0x024b('0x54')]={'id':_0x46344b['Interval']['id'],'name':_0x46344b[_0x024b('0x54')][_0x024b('0x51')]};}var _0x4791b6=md5(JSON[_0x024b('0x55')](_0x52ace0));if(_0x46344b['md5']!==_0x4791b6){_0x46344b[_0x024b('0x56')]=_0x4791b6;emit(util['format'](_0x024b('0x57'),_0x52ace0['name']),_0x024b('0x58'),_0x52ace0);}}}function emitVoiceQueueChannelRemove(_0x5b524d){logger[_0x024b('0x59')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x5b524d));emit(util['format'](_0x024b('0x57'),_0x5b524d[_0x024b('0x51')]),_0x024b('0x5a'),_0x5b524d);io['emit'](_0x024b('0x5b'),_0x5b524d);}function notSendMessagesQueue(_0x5db428){if(_0x5db428[_0x024b('0x5c')]){if(_0x5db428[_0x024b('0x5d')]===0x0&&_0x5db428[_0x024b('0x2b')]===0x0){_0x5db428[_0x024b('0x5c')]=![];_0x5db428[_0x024b('0x29')]=0x0;_0x5db428[_0x024b('0x5e')]=0x0;_0x5db428[_0x024b('0x5f')]='NOT_ACTIVE';ut[_0x024b('0x60')](_0x024b('0x61'),_0x5db428[_0x024b('0x51')]+_0x024b('0x62'));}else{_0x5db428['message']='DEACTIVATED';ut[_0x024b('0x60')](_0x024b('0x61'),_0x5db428[_0x024b('0x51')]+_0x024b('0x63'));}emitCampaignPreview(_0x5db428);}}Preview[_0x024b('0xe')][_0x024b('0x23')]=function(){var _0x5a9bbe=this;setInterval(function(){_0x5a9bbe[_0x024b('0x64')]();},0x7cf);};Preview[_0x024b('0xe')]['syncCampaigns']=function(){var _0x3d0dbd=this[_0x024b('0x12')];this['clockClearZombieChannels']+=0x1;for(var _0x1f2c79 in _0x3d0dbd){if(_0x3d0dbd['hasOwnProperty'](_0x1f2c79)&&(_0x3d0dbd[_0x1f2c79][_0x024b('0x65')]===_0x024b('0x4')||_0x3d0dbd[_0x1f2c79][_0x024b('0x65')]===_0x024b('0x66'))&&_0x3d0dbd[_0x1f2c79]['type']===_0x024b('0x26')){if(this[_0x024b('0x17')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x024b('0x67')]();}}if(_0x3d0dbd[_0x024b('0x68')](_0x1f2c79)&&_0x3d0dbd[_0x1f2c79][_0x024b('0x65')]===_0x024b('0x4')&&_0x3d0dbd[_0x1f2c79][_0x024b('0x25')]===_0x024b('0x26')){if(_0x3d0dbd[_0x1f2c79][_0x024b('0x33')]){this[_0x024b('0x69')](_0x3d0dbd[_0x1f2c79]);if(_0x3d0dbd[_0x1f2c79]['dialPreviewAutoRecallMe'])this['recallMe'](_0x3d0dbd[_0x1f2c79]);}else{notSendMessagesQueue(_0x3d0dbd[_0x1f2c79]);}}}};Preview[_0x024b('0xe')]['clearZombieChannel']=function(_0x3f17a8){var _0x47e4bb=this;this[_0x024b('0x11')][_0x024b('0xf')](function(){if(!_[_0x024b('0x6a')](_0x47e4bb[_0x024b('0x15')][_0x3f17a8])){loggerAction[_0x024b('0x59')](_0x024b('0x6b'),_0x3f17a8,'Queue',_0x47e4bb['actions'][_0x3f17a8][_0x024b('0x6c')],_0x024b('0x6d'),JSON['stringify'](_0x47e4bb[_0x024b('0x12')][_0x47e4bb[_0x024b('0x15')][_0x3f17a8][_0x024b('0x6c')]]['originated']),_0x024b('0x6e'),JSON['stringify'](_0x47e4bb[_0x024b('0x12')][_0x47e4bb[_0x024b('0x15')][_0x3f17a8][_0x024b('0x6c')]]['pTalking']),JSON[_0x024b('0x55')](_0x47e4bb['actions'][_0x3f17a8][_0x024b('0x6f')]),JSON[_0x024b('0x55')](_[_0x024b('0x70')](_0x47e4bb[_0x024b('0x15')][_0x3f17a8],['contactId',_0x024b('0x71'),_0x024b('0x72'),_0x024b('0x73')])));return ami[_0x024b('0x74')]({'action':_0x024b('0x75'),'channel':_0x47e4bb[_0x024b('0x15')][_0x3f17a8][_0x024b('0x76')]})[_0x024b('0x77')](function(_0x3650dc){if(_0x3650dc[_0x024b('0x5f')]===_0x024b('0x78')){setTimeout(function(){if(_0x47e4bb['actions'][_0x3f17a8]){ut['updateOriginated'](_0x47e4bb['campaignsPreview'][_0x47e4bb['actions'][_0x3f17a8][_0x024b('0x6c')]],_0x024b('0x79'));if(_0x47e4bb['actions'][_0x3f17a8][_0x024b('0x6f')]===!![]){ut[_0x024b('0x7a')](_0x47e4bb[_0x024b('0x12')][_0x47e4bb['actions'][_0x3f17a8][_0x024b('0x6c')]],_0x024b('0x79'));ut['loggerError'](_0x024b('0x7b')+_0x3f17a8,_0x47e4bb[_0x024b('0x15')][_0x3f17a8]['queue']);}ut[_0x024b('0x7c')](_0x024b('0x7d')+_0x3f17a8,_0x47e4bb['actions'][_0x3f17a8][_0x024b('0x6c')]);delete _0x47e4bb[_0x024b('0x15')][_0x3f17a8];}},0x2328);}});}});};Preview[_0x024b('0xe')][_0x024b('0x67')]=function(){var _0x346266=this;loggerAction[_0x024b('0x59')]('[action]',_['size'](this[_0x024b('0x15')]));for(var _0xf3bb74 in this[_0x024b('0x15')]){if(_0x346266[_0x024b('0x15')]['hasOwnProperty'](_0xf3bb74)){_0x346266[_0x024b('0x7e')](_0xf3bb74);}}};Preview[_0x024b('0xe')][_0x024b('0x7f')]=function(_0xa28659){var _0x31d9c2=this;rpcDb['getContactRecallMe'](_0xa28659['id'],ut[_0x024b('0x80')](this[_0x024b('0x16')]))['then'](function(_0x4b65b9){if(!_[_0x024b('0x6a')](_0x4b65b9)){for(var _0x25f809=0x0;_0x25f809<_0x4b65b9['length'];_0x25f809+=0x1){if(ut[_0x024b('0x81')](_0x4b65b9[_0x25f809][_0x024b('0x82')])<_0xa28659[_0x024b('0x83')]*0x3c){if(_0x4b65b9[_0x25f809][_0x024b('0x84')]&&!_0x4b65b9[_0x25f809][_0x024b('0x84')][_0x024b('0x85')]){_0x31d9c2[_0x024b('0x86')](_0x4b65b9[_0x25f809]['id'])[_0x024b('0x87')](ut['logger2']('[RecallMe]'))['catch'](ut['logger2'](_0x024b('0x88')));}else{rpcDb[_0x024b('0x89')](_0x4b65b9[_0x25f809]['id']);}}else{var _0x1c1a92=new Action(_0x4b65b9[_0x25f809],_0xa28659);_0x1c1a92[_0x024b('0x8a')]=moment()[_0x024b('0x8b')]('YYYY-MM-DD\x20HH:mm:ss');_0xa28659['outboundReCallsDay']+=0x1;ut[_0x024b('0x8c')](_0x1c1a92,0x17,_0x024b('0x8d'));if(_0xa28659['dialRecallInQueue']){rpcDb[_0x024b('0x8e')](ut[_0x024b('0x8f')](_0x4b65b9[_0x25f809]));rpcDb[_0x024b('0x90')](_0x1c1a92,_0x024b('0x91'));}else{ut['logCustomer'](_0x1c1a92,0x16,_0x024b('0x92'));rpcDb[_0x024b('0x90')](_0x1c1a92,_0x024b('0x93'));rpcDb[_0x024b('0x94')](_0x1c1a92,_0x024b('0x93'));}}}}})[_0x024b('0x77')](ut[_0x024b('0x95')]('[getContactRecallMe]'));};Preview['prototype']['setMessage']=function(_0x1f2696){_0x1f2696['sendMessageOneNotActive']=!![];if(ut[_0x024b('0x96')](_0x1f2696['loggedIn'])){_0x1f2696[_0x024b('0x5f')]=_0x024b('0x97');}else if(!ut['isActive'](_0x1f2696[_0x024b('0x33')])){_0x1f2696[_0x024b('0x5f')]=_0x024b('0x98');}else if(!this['isTrunkReachable'](_0x1f2696[_0x024b('0x50')])){if(!this[_0x024b('0x99')](_0x1f2696[_0x024b('0x9a')])){_0x1f2696[_0x024b('0x5f')]=_0x024b('0x9b');}else{_0x1f2696[_0x024b('0x5f')]='ACTIVE';}}else{_0x1f2696[_0x024b('0x5f')]='ACTIVE';}emitCampaignPreview(_0x1f2696);};Preview['prototype'][_0x024b('0x9c')]=function(_0x340f00,_0x57d911,_0x2a00eb){var _0xbf6b7a=this;var _0x3bb5aa=this['actions'][_0x57d911];var _0x531562=this[_0x024b('0x12')][_0x3bb5aa['queue']];var _0x50dbfb;var _0x440ef0=![];var _0x26edb6=0x2;var _0x3f55fa=0x3;if(_0x531562){switch(_0x2a00eb){case'1':_0x531562[_0x024b('0x3e')]+=0x1;_0x3bb5aa[_0x024b('0x9d')]+=0x1;_0x3bb5aa[_0x024b('0x9e')]=ut[_0x024b('0x9f')](_0x3bb5aa);ut[_0x024b('0x8c')](_0x3bb5aa,0x0,_0x024b('0xa0'));ami[_0x024b('0x24')]('custom:agentnosuchnumber',ut[_0x024b('0xa1')](_0x3bb5aa,'nosuchnumber'));rpcDb[_0x024b('0x90')](_0x3bb5aa,_0x024b('0xa2'));_0xbf6b7a['verifyAdditionalPhones'](_0x3bb5aa,'0',_0x531562)['then'](function(_0x19f3bc){_0x440ef0=_0x19f3bc[_0x024b('0xa3')]==0x1;_0x26edb6=_0x531562[_0x024b('0xa4')];_0x3f55fa=_0x531562['callAdditionalPhoneAfterMin'];if(!_0x440ef0){if(ut[_0x024b('0x9f')](_0x3bb5aa)>=_0x531562[_0x024b('0xa5')]){_0x50dbfb=ut[_0x024b('0xa6')](_0x3bb5aa,0xf,_0x024b('0xa7'));rpcDb[_0x024b('0x94')](_0x50dbfb,_0x024b('0xa8'));}else{if(_0x3bb5aa[_0x024b('0x9d')]>=_0x531562[_0x024b('0xa9')]){rpcDb[_0x024b('0x94')](_0x3bb5aa,_0x024b('0xa8'));}else{rpcDb[_0x024b('0xaa')](ut[_0x024b('0xab')](_0x3bb5aa,_0x024b('0x9d'),_0x531562[_0x024b('0xa4')]),_0x3bb5aa[_0x024b('0xac')],_0x3bb5aa[_0x024b('0xad')]);}}delete this[_0x024b('0x15')][_0x340f00[_0x024b('0xae')]];}else{_0x3bb5aa[_0x024b('0x9d')]++;logger[_0x024b('0x59')]('actioncountonusuch',_0x3bb5aa[_0x024b('0x9d')]);logger[_0x024b('0x59')]('id',_0x3bb5aa[_0x024b('0xaf')]);_0xbf6b7a[_0x024b('0xb0')]({'id':_0x3bb5aa[_0x024b('0xaf')],'field':{'countnosuchnumberretry':_0x3bb5aa[_0x024b('0x9d')]}})[_0x024b('0x87')](function(){_0xbf6b7a[_0x024b('0xb1')](_0x3bb5aa,_0x26edb6,_0x3f55fa)['then'](function(){});});}});break;case'ANSWER':var _0x5c38c5=moment()[_0x024b('0x8b')]('YYYY-MM-DD\x20HH:mm:ss');_0x3bb5aa[_0x024b('0xb2')]=_0x5c38c5;_0x3bb5aa['answertime']=_0x5c38c5;_0x3bb5aa['dialAnswer']=!![];_0x531562[_0x024b('0x2b')]+=0x1;logger['info'](_0x024b('0xb3'),_0x3bb5aa[_0x024b('0xb4')],'\x20Queue',_0x531562['name'],_0x024b('0x6e'),_0x531562[_0x024b('0x2b')]);ami[_0x024b('0x24')](_0x024b('0xb5'),ut[_0x024b('0xa1')](_0x3bb5aa,_0x024b('0xb6'),this[_0x024b('0x12')][_0x3bb5aa['queue']]));if(_0x531562[_0x024b('0xb7')]){ami[_0x024b('0x24')](_0x024b('0xb8'),ut[_0x024b('0xb9')](_0x3bb5aa));}break;case'16':ami['emit'](_0x024b('0xba'),ut[_0x024b('0xa1')](_0x3bb5aa,_0x024b('0xbb'),this[_0x024b('0x12')][_0x3bb5aa['queue']]));emitVoiceQueueChannelRemove(ut[_0x024b('0xa1')](_0x3bb5aa,_0x024b('0xbb')));_0x531562[_0x024b('0x39')]+=0x1;_0x531562[_0x024b('0xbc')]+=0x1;_0x531562[_0x024b('0x28')]+=0x1;ut[_0x024b('0x7a')](_0x531562,_0x024b('0xbd'));_0x3bb5aa[_0x024b('0x9e')]=ut[_0x024b('0x9f')](_0x3bb5aa);ut[_0x024b('0x8c')](_0x3bb5aa,0x4,'Answer');rpcDb['createCustomerHistory'](_0x3bb5aa,_0x024b('0xbe'));rpcDb[_0x024b('0x94')](_0x3bb5aa,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x024b('0xbf')](_0x3bb5aa);_0x531562[_0x024b('0x2c')]+=_0x3bb5aa[_0x024b('0xc0')];_0x531562[_0x024b('0xc1')]+=_0x3bb5aa[_0x024b('0xc0')];logger[_0x024b('0x59')](_0x024b('0xc2'),_0x3bb5aa[_0x024b('0xb4')],_0x024b('0xc3'),_0x531562[_0x024b('0x51')],_0x024b('0x6e'),_0x531562[_0x024b('0x2b')]);delete this[_0x024b('0x15')][_0x340f00[_0x024b('0xae')]];break;case _0x024b('0xc4'):_0x531562[_0x024b('0x3a')]+=0x1;_0x3bb5aa[_0x024b('0xc5')]+=0x1;_0x3bb5aa['countglobal']=ut[_0x024b('0x9f')](_0x3bb5aa);ut[_0x024b('0x8c')](_0x3bb5aa,0x5,_0x024b('0xc6'));_0x26edb6=_0x531562[_0x024b('0xc7')];_0x3f55fa=_0x531562[_0x024b('0xc8')];ami[_0x024b('0x24')](_0x024b('0xc9'),ut['buildObj'](_0x3bb5aa,_0x024b('0xca')));rpcDb['createCustomerHistory'](_0x3bb5aa,_0x024b('0xcb'));_0xbf6b7a['verifyAdditionalPhones'](_0x3bb5aa,'5',_0x531562)['then'](function(_0xa47e75){_0x440ef0=_0xa47e75[_0x024b('0xa3')]==0x1;if(!_0x440ef0){if(ut[_0x024b('0x9f')](_0x3bb5aa)>=_0x531562['dialGlobalMaxRetry']){_0x50dbfb=ut['cloneAction'](_0x3bb5aa,0xf,_0x024b('0xa7'));rpcDb['createCustomerFinal'](_0x50dbfb,_0x024b('0xcc'));}else{if(_0x3bb5aa[_0x024b('0xc5')]>=_0x531562[_0x024b('0xcd')]){rpcDb[_0x024b('0x94')](_0x3bb5aa,_0x024b('0xcb'));}else{rpcDb[_0x024b('0xaa')](ut[_0x024b('0xab')](_0x3bb5aa,'countbusyretry',_0x531562[_0x024b('0xc7')]),_0x3bb5aa[_0x024b('0xac')],_0x3bb5aa['activeContact']);}}}else{_0x3bb5aa[_0x024b('0xc5')]++;_0xbf6b7a[_0x024b('0xb0')]({'id':_0x3bb5aa[_0x024b('0xaf')],'field':{'countbusyretry':_0x3bb5aa[_0x024b('0xc5')]}})[_0x024b('0x87')](function(){_0xbf6b7a['swapAdditionalPhones'](_0x3bb5aa,_0x26edb6,_0x3f55fa)[_0x024b('0x87')](function(){});});}});break;case _0x024b('0xce'):_0x531562['outboundNoAnswerCallsDay']+=0x1;_0x3bb5aa[_0x024b('0xcf')]+=0x1;_0x3bb5aa['countglobal']=ut[_0x024b('0x9f')](_0x3bb5aa);ut[_0x024b('0x8c')](_0x3bb5aa,0x3,_0x024b('0xd0'));_0x26edb6=_0x531562[_0x024b('0xd1')];_0x3f55fa=_0x531562[_0x024b('0xc8')];var _0x3c9950=ut[_0x024b('0xd2')](_0x3bb5aa,_0x531562);ami[_0x024b('0x24')](_0x024b('0xd3'),_0x3c9950);rpcDb[_0x024b('0x90')](_0x3bb5aa,_0x024b('0xd4'));_0xbf6b7a[_0x024b('0xd5')](_0x3bb5aa,'3',_0x531562)[_0x024b('0x87')](function(_0x105e68){_0x440ef0=_0x105e68[_0x024b('0xa3')]==0x1;if(!_0x440ef0){if(ut['totalGlobal'](_0x3bb5aa)>=_0x531562[_0x024b('0xa5')]){_0x50dbfb=ut[_0x024b('0xa6')](_0x3bb5aa,0xf,_0x024b('0xa7'));rpcDb['createCustomerFinal'](_0x50dbfb,_0x024b('0xd6'));}else{if(_0x3bb5aa[_0x024b('0xcf')]>=_0x531562[_0x024b('0xd7')]){rpcDb[_0x024b('0x94')](_0x3bb5aa,_0x024b('0xd4'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x3bb5aa,_0x024b('0xcf'),_0x531562['dialNoAnswerRetryFrequency']),_0x3bb5aa['unlockAgent'],_0x3bb5aa[_0x024b('0xad')]);}}}else{_0x3bb5aa[_0x024b('0xcf')]++;_0xbf6b7a[_0x024b('0xb0')]({'id':_0x3bb5aa[_0x024b('0xaf')],'field':{'countnoanswerretry':_0x3bb5aa[_0x024b('0xcf')]}})['then'](function(){_0xbf6b7a['swapAdditionalPhones'](_0x3bb5aa,_0x26edb6,_0x3f55fa)['then'](function(){});});}});break;case _0x024b('0xd8'):_0x531562[_0x024b('0x3b')]+=0x1;_0x3bb5aa[_0x024b('0xd9')]+=0x1;_0x3bb5aa[_0x024b('0x9e')]=ut[_0x024b('0x9f')](_0x3bb5aa);ut[_0x024b('0x8c')](_0x3bb5aa,0x8,_0x024b('0xda'));_0x26edb6=_0x531562[_0x024b('0xdb')];_0x3f55fa=_0x531562[_0x024b('0xc8')];ami[_0x024b('0x24')](_0x024b('0xdc'),ut[_0x024b('0xa1')](_0x3bb5aa,'congestion'));rpcDb[_0x024b('0x90')](_0x3bb5aa,_0x024b('0xdd'));_0xbf6b7a[_0x024b('0xd5')](_0x3bb5aa,'8',_0x531562)[_0x024b('0x87')](function(_0x5e7965){_0x440ef0=_0x5e7965[_0x024b('0xa3')]==0x1;if(!_0x440ef0){if(ut[_0x024b('0x9f')](_0x3bb5aa)>=_0x531562[_0x024b('0xa5')]){_0x50dbfb=ut[_0x024b('0xa6')](_0x3bb5aa,0xf,_0x024b('0xa7'));rpcDb[_0x024b('0x94')](_0x50dbfb,_0x024b('0xde'));}else{if(_0x3bb5aa[_0x024b('0xd9')]>=_0x531562[_0x024b('0xdf')]){rpcDb[_0x024b('0x94')](_0x3bb5aa,_0x024b('0xdd'));}else{rpcDb[_0x024b('0xaa')](ut[_0x024b('0xab')](_0x3bb5aa,_0x024b('0xd9'),_0x531562[_0x024b('0xc7')]),_0x3bb5aa[_0x024b('0xac')],_0x3bb5aa[_0x024b('0xad')]);}}}else{_0x3bb5aa['countcongestionretry']++;_0xbf6b7a[_0x024b('0xb0')]({'id':_0x3bb5aa['idContact'],'field':{'countcongestionretry':_0x3bb5aa[_0x024b('0xd9')]}})['then'](function(){_0xbf6b7a[_0x024b('0xb1')](_0x3bb5aa,_0x26edb6,_0x3f55fa)[_0x024b('0x87')](function(){});});}});break;case'CANCEL':_0x531562[_0x024b('0x41')]+=0x1;_0x3bb5aa['countagentrejectretry']+=0x1;_0x3bb5aa['countglobal']=ut['totalGlobal'](_0x3bb5aa);ut[_0x024b('0x8c')](_0x3bb5aa,0x14,_0x024b('0xe0'));_0x26edb6=_0x531562[_0x024b('0xe1')];_0x3f55fa=_0x531562[_0x024b('0xc8')];ami[_0x024b('0x24')](_0x024b('0xe2'),ut[_0x024b('0xa1')](_0x3bb5aa,_0x024b('0xe3')));rpcDb[_0x024b('0x90')](_0x3bb5aa,_0x024b('0xe4'));_0xbf6b7a[_0x024b('0xd5')](_0x3bb5aa,'20',_0x531562)[_0x024b('0x87')](function(_0x3a6a34){_0x440ef0=_0x3a6a34['additional']==0x1;if(!_0x440ef0){if(ut[_0x024b('0x9f')](_0x3bb5aa)>=_0x531562[_0x024b('0xa5')]){_0x50dbfb=ut[_0x024b('0xa6')](_0x3bb5aa,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0x50dbfb,_0x024b('0xe5'));}else{if(_0x3bb5aa[_0x024b('0xe6')]>=_0x531562[_0x024b('0xe7')]){rpcDb['createCustomerFinal'](_0x3bb5aa,_0x024b('0xe5'));}else{rpcDb[_0x024b('0xaa')](ut['scheduledAt'](_0x3bb5aa,'countagentrejectretry',_0x531562[_0x024b('0xe1')]),_0x3bb5aa[_0x024b('0xac')],_0x3bb5aa['activeContact']);}}}else{_0x3bb5aa['countnoanswerretry']++;_0xbf6b7a[_0x024b('0xb0')]({'id':_0x3bb5aa[_0x024b('0xaf')],'field':{'countnoanswerretry':_0x3bb5aa[_0x024b('0xcf')]}})['then'](function(){_0xbf6b7a[_0x024b('0xb1')](_0x3bb5aa,_0x26edb6,_0x3f55fa)[_0x024b('0x87')](function(){});});}});break;case'ABANDONED':_0x531562[_0x024b('0xe8')]+=0x1;_0x3bb5aa[_0x024b('0xe9')]+=0x1;_0x3bb5aa[_0x024b('0x9e')]=ut['totalGlobal'](_0x3bb5aa);ut[_0x024b('0x8c')](_0x3bb5aa,0xb,_0x024b('0xea'));rpcDb[_0x024b('0x90')](_0x3bb5aa,'[callProgressDetectingCustomer][logAbandoned]');_0xbf6b7a[_0x024b('0xd5')](_0x3bb5aa,'11',_0x531562)[_0x024b('0x87')](function(_0x4064ed){_0x440ef0=_0x4064ed['additional']==0x1;if(!_0x440ef0){if(ut[_0x024b('0x9f')](_0x3bb5aa)>=_0x531562[_0x024b('0xa5')]){_0x50dbfb=ut['cloneAction'](_0x3bb5aa,0xf,_0x024b('0xa7'));rpcDb[_0x024b('0x94')](_0x50dbfb,_0x024b('0xeb'));}else{if(_0x3bb5aa[_0x024b('0xec')]>=_0x531562[_0x024b('0xed')]){rpcDb[_0x024b('0x94')](_0x3bb5aa,_0x024b('0xeb'));}else{rpcDb['rescheduleContact'](ut[_0x024b('0xab')](_0x3bb5aa,'countabandonedretry',_0x531562[_0x024b('0xee')]),_0x3bb5aa['unlockAgent'],_0x3bb5aa[_0x024b('0xad')]);}}}else{_0x3bb5aa['countnoanswerretry']++;_0xbf6b7a[_0x024b('0xb0')]({'id':_0x3bb5aa[_0x024b('0xaf')],'field':{'countnoanswerretry':_0x3bb5aa[_0x024b('0xcf')]}})[_0x024b('0x87')](function(){_0xbf6b7a[_0x024b('0xb1')](_0x3bb5aa,_0x26edb6,_0x3f55fa)[_0x024b('0x87')](function(){});});}});break;case'18':_0x531562[_0x024b('0xef')]+=0x1;_0x3bb5aa[_0x024b('0xf0')]+=0x1;_0x3bb5aa['countglobal']=ut['totalGlobal'](_0x3bb5aa);ut[_0x024b('0x8c')](_0x3bb5aa,0x12,_0x340f00['cause-txt']||_0x340f00[_0x024b('0xf1')]);ami['emit'](_0x024b('0xf2'),ut[_0x024b('0xa1')](_0x3bb5aa,_0x024b('0xf3')));rpcDb['createCustomerHistory'](_0x3bb5aa,_0x024b('0xf4'));_0xbf6b7a[_0x024b('0xd5')](_0x3bb5aa,'18',_0x531562)[_0x024b('0x87')](function(_0x24e57c){_0x440ef0=_0x24e57c[_0x024b('0xa3')]==0x1;if(!_0x440ef0){if(ut[_0x024b('0x9f')](_0x3bb5aa)>=_0x531562['dialGlobalMaxRetry']){_0x50dbfb=ut[_0x024b('0xa6')](_0x3bb5aa,0x12,_0x024b('0xa7'));rpcDb[_0x024b('0x94')](_0x50dbfb,_0x024b('0xf4'));}else{rpcDb[_0x024b('0x94')](_0x3bb5aa,_0x024b('0xf4'));}}else{_0x3bb5aa[_0x024b('0xcf')]++;_0xbf6b7a['incrementPreviewCounters']({'id':_0x3bb5aa['idContact'],'field':{'countnoanswerretry':_0x3bb5aa[_0x024b('0xcf')]}})[_0x024b('0x87')](function(){_0xbf6b7a['swapAdditionalPhones'](_0x3bb5aa,_0x26edb6,_0x3f55fa)[_0x024b('0x87')](function(){});});}});delete this[_0x024b('0x15')][_0x340f00[_0x024b('0xae')]];break;case'19':_0x531562[_0x024b('0xef')]+=0x1;_0x3bb5aa['countglobal']=ut[_0x024b('0x9f')](_0x3bb5aa);ut['logCustomer'](_0x3bb5aa,0x13,_0x340f00[_0x024b('0xf5')]||_0x340f00['dialstatus']);ami[_0x024b('0x24')](_0x024b('0xf2'),ut[_0x024b('0xa1')](_0x3bb5aa,_0x024b('0xf3')));rpcDb[_0x024b('0x90')](_0x3bb5aa,_0x024b('0xf6'));_0xbf6b7a['verifyAdditionalPhones'](_0x3bb5aa,'18',_0x531562)[_0x024b('0x87')](function(_0x4333c4){_0x440ef0=_0x4333c4[_0x024b('0xa3')]==0x1;if(!_0x440ef0){if(ut[_0x024b('0x9f')](_0x3bb5aa)>=_0x531562[_0x024b('0xa5')]){_0x50dbfb=ut[_0x024b('0xa6')](_0x3bb5aa,0xf,_0x024b('0xa7'));rpcDb['createCustomerFinal'](_0x50dbfb,_0x024b('0xf6'));}else{rpcDb['createCustomerFinal'](_0x3bb5aa,_0x024b('0xf6'));}}else{_0x3bb5aa[_0x024b('0xcf')]++;_0xbf6b7a[_0x024b('0xb0')]({'id':_0x3bb5aa['idContact'],'field':{'countnoanswerretry':_0x3bb5aa[_0x024b('0xcf')]}})[_0x024b('0x87')](function(){_0xbf6b7a[_0x024b('0xb1')](_0x3bb5aa,_0x26edb6,_0x3f55fa)[_0x024b('0x87')](function(){});});}});delete this['actions'][_0x340f00[_0x024b('0xae')]];break;default:if(_0x3bb5aa[_0x024b('0x6f')]){ut['decrementTalkink'](_0x531562,'[default]');ut['loggerError'](_0x024b('0xf7')+_0x531562[_0x024b('0x51')],_0x340f00);}_0x531562['outboundUnknownCallsDay']+=0x1;_0x3bb5aa['countglobal']=ut[_0x024b('0x9f')](_0x3bb5aa);ut[_0x024b('0x8c')](_0x3bb5aa,0xc,_0x340f00[_0x024b('0xf5')]||_0x340f00[_0x024b('0xf1')]);_0x26edb6=_0x531562[_0x024b('0xe1')];_0x3f55fa=_0x531562[_0x024b('0xc8')];rpcDb[_0x024b('0x90')](_0x3bb5aa,_0x024b('0xf8'));_0xbf6b7a[_0x024b('0xd5')](_0x3bb5aa,'20',_0x531562)[_0x024b('0x87')](function(_0x3adbc3){_0x440ef0=_0x3adbc3['additional']==0x1;if(!_0x440ef0){if(ut[_0x024b('0x9f')](_0x3bb5aa)>=_0x531562[_0x024b('0xa5')]){_0x50dbfb=ut[_0x024b('0xa6')](_0x3bb5aa,0xf,'Global');rpcDb['createCustomerFinal'](_0x50dbfb,_0x024b('0xf9'));}else{rpcDb[_0x024b('0x94')](_0x3bb5aa,_0x024b('0xf9'));}delete this[_0x024b('0x15')][_0x340f00[_0x024b('0xae')]];}else{_0xbf6b7a[_0x024b('0xb1')](_0x3bb5aa,_0x26edb6,_0x3f55fa)[_0x024b('0x87')](function(){});}});}if(!(_0x3bb5aa[_0x024b('0x6f')]&&_0x2a00eb==='16')){ut[_0x024b('0xfa')](_0x531562,'[callProgressDetectingCustomer]');logger[_0x024b('0x59')](_0x024b('0xfb'),_0x3bb5aa[_0x024b('0xb4')],_0x024b('0xc3'),_0x531562[_0x024b('0x51')],'originated:\x20',_0x531562[_0x024b('0x5d')]);}if(_0x2a00eb!==_0x024b('0xfc')){delete this[_0x024b('0x15')][_0x340f00[_0x024b('0xae')]];delete this[_0x024b('0x15')][_0x340f00[_0x024b('0xfd')]];}}};Preview['prototype'][_0x024b('0xfe')]=function(_0x4d27a6,_0x367899,_0x26e224){if(_[_0x024b('0xff')](_0x367899)&&_0x024b('0x100')!==typeof _0x367899){return;}if(_[_0x024b('0xff')](_0x26e224)&&_0x024b('0x100')!==typeof _0x26e224){return;}switch(_0x26e224[_0x024b('0x101')]){case'0':ut[_0x024b('0x102')](_0x4d27a6,0x0,_0x024b('0xa0'));rpcDb['createAgentHistory'](_0x4d27a6,_0x024b('0x103'));break;case'3':ut[_0x024b('0x102')](_0x4d27a6,0x3,'NoAnswer');rpcDb[_0x024b('0x104')](_0x4d27a6,_0x024b('0x105'));break;case'5':ut[_0x024b('0x102')](_0x4d27a6,0x5,_0x024b('0xc6'));rpcDb[_0x024b('0x104')](_0x4d27a6,_0x024b('0x106'));break;case'8':ut[_0x024b('0x102')](_0x4d27a6,0x8,_0x024b('0xda'));rpcDb[_0x024b('0x104')](_0x4d27a6,_0x024b('0x107'));break;case'22':ut['logAgent'](_0x4d27a6,0x16,_0x024b('0x108'));rpcDb['createAgentHistory'](_0x4d27a6,_0x024b('0x109'));break;default:ut['logAgent'](_0x4d27a6,0xc,_0x26e224[_0x024b('0x101')]);rpcDb[_0x024b('0x104')](_0x4d27a6,_0x024b('0x107'));}ut['updateOriginated'](_0x367899,_0x024b('0x10a'));logger['info'](_0x024b('0x10b'),_0x4d27a6[_0x024b('0xb4')],_0x024b('0xc3'),_0x367899['name'],_0x024b('0x6d'),_0x367899[_0x024b('0x5d')]);delete this['actions'][_0x4d27a6[_0x024b('0xb4')]];};Preview[_0x024b('0xe')]['verifyAdditionalPhones']=function(_0x14145f,_0x30e430,_0x402993){return Promise[_0x024b('0x10c')]()['then'](cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x14145f,_0x30e430,_0x402993))[_0x024b('0x77')](logger[_0x024b('0x59')](_0x024b('0x10d')));};Preview[_0x024b('0xe')][_0x024b('0xb1')]=function(_0x5ecf2d,_0x33ab59,_0x2b3e6d){return Promise[_0x024b('0x10c')]()[_0x024b('0x87')](cmHopperAdditionalPhone[_0x024b('0xb1')](_0x5ecf2d,_0x33ab59,_0x2b3e6d))[_0x024b('0x77')](logger[_0x024b('0x59')](_0x024b('0x10e')));};Preview[_0x024b('0xe')]['incrementPreviewCounters']=function(_0x11e155){return Promise[_0x024b('0x10c')]()['then'](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x11e155))[_0x024b('0x77')](logger[_0x024b('0x59')](_0x024b('0x10f')));};Preview[_0x024b('0xe')][_0x024b('0x110')]=function(_0x1a36b7,_0x324cce,_0x19ecd8,_0x2d4e87,_0x520336){var _0x72b632=this;return new Promise(function(_0xd90667,_0x3fcbf9){if(_[_0x024b('0x6a')](_0x324cce)||_['isNil'](_0x324cce[_0x024b('0x111')])||_[_0x024b('0x6a')](_0x324cce['phone'])||_['isNil'](_0x324cce['VoiceQueueId'])){_0x3fcbf9(ut[_0x024b('0x5f')](_0x024b('0x112'),_0x2d4e87,_0x520336));return;}var _0x474de4=uuid['v4']();var _0x433acf=_0x72b632[_0x024b('0x12')][_0x324cce[_0x024b('0x113')]['name']];var _0x40b3f9=_0x19ecd8?_0x72b632['agents'][_0x19ecd8]['id']:undefined;_0x72b632['actions'][_0x474de4]=new Action(_0x324cce,_0x433acf,_0x474de4,_0x19ecd8,_0x40b3f9);var _0x5780fb=_0x72b632[_0x024b('0x15')][_0x474de4];_0x5780fb[_0x024b('0xac')]=_0x2d4e87;_0x5780fb[_0x024b('0xad')]=_0x520336;_0x5780fb[_0x024b('0x114')]=_0x19ecd8;if(_[_0x024b('0x115')](_0x1a36b7)){_0x72b632['execCall'](_0x5780fb,_0x433acf,_0x324cce,_0x19ecd8)[_0x024b('0x87')](function(_0x487e8c){logger[_0x024b('0x59')](_0x024b('0x116'),'Queue:\x20'+_0x5780fb['queue']+_0x024b('0x117')+_0x5780fb[_0x024b('0xaf')],JSON['stringify'](_0x487e8c));ami[_0x024b('0x24')](_0x024b('0x118'),ut[_0x024b('0xa1')](_0x5780fb,_0x024b('0x119'),_0x72b632[_0x024b('0x12')][_0x5780fb[_0x024b('0x6c')]]));_0xd90667(ut[_0x024b('0x5f')](_0x024b('0x11a')));})[_0x024b('0x77')](function(_0x49a225){ut[_0x024b('0x60')](_0x024b('0x11b'),_0x49a225);_0x3fcbf9(ut[_0x024b('0x5f')](_0x024b('0x11c'),_0x2d4e87,_0x520336));});}else{_0x433acf[_0x024b('0x11d')]+=0x1;ut[_0x024b('0x11e')](_0x5780fb);rpcDb['createHistory'](_0x5780fb,_0x024b('0x11f'));delete _0x72b632['actions'][_0x474de4];_0x3fcbf9(ut[_0x024b('0x5f')](_0x024b('0x120'),_0x2d4e87,_0x520336));}});};Preview[_0x024b('0xe')][_0x024b('0x99')]=function(_0x12467d){return!_[_0x024b('0x6a')](_0x12467d)&&!_['isNil'](_0x12467d[_0x024b('0x51')])&&!_[_0x024b('0x6a')](_0x12467d['active'])&&_0x12467d[_0x024b('0x52')]&&!_[_0x024b('0x6a')](this[_0x024b('0x14')][util['format']('SIP/%s',_0x12467d['name'])])&&!_[_0x024b('0x6a')](this[_0x024b('0x14')][util[_0x024b('0x8b')](_0x024b('0x121'),_0x12467d['name'])][_0x024b('0x75')])&&(this[_0x024b('0x14')][util['format']('SIP/%s',_0x12467d['name'])][_0x024b('0x75')]==='reachable'||this[_0x024b('0x14')][util[_0x024b('0x8b')](_0x024b('0x121'),_0x12467d[_0x024b('0x51')])][_0x024b('0x75')]===_0x024b('0x122'));};Preview[_0x024b('0xe')][_0x024b('0x86')]=function(_0x3b777c,_0x19b94a){var _0x2bffbc=this;return new Promise(function(_0x1ecbd8,_0x1d530d){_0x2bffbc['execRun'](_0x3b777c,_0x19b94a)[_0x024b('0x87')](function(_0x473d62){_0x1ecbd8(_[_0x024b('0x70')](_0x473d62,['message']));})['catch'](function(_0x1de55d){if(_0x1de55d[_0x024b('0x123')]){rpcDb[_0x024b('0x124')](_0x3b777c);}if(_0x1de55d[_0x024b('0x52')]){rpcDb[_0x024b('0x89')](_0x3b777c);}_0x1d530d(_[_0x024b('0x70')](_0x1de55d,[_0x024b('0x5f')]));});});};Preview[_0x024b('0xe')][_0x024b('0x125')]=function(_0x2276d5,_0x2da793){var _0x298100=this;return new Promise(function(_0x1a5042,_0x14b0d5){var _0x769b52,_0x373d22;rpcDb[_0x024b('0x126')](_0x2276d5)[_0x024b('0x87')](function(_0x1eddc9){if(!_[_0x024b('0x6a')](_0x1eddc9[0x0])){_0x373d22=_0x1eddc9[0x0]['recallme']?![]:!![];_0x769b52=_0x1eddc9[0x0]['recallme']?!![]:![];_0x769b52=_0x2da793?!![]:_0x769b52;}var _0x18b176=_0x298100[_0x024b('0x127')](_0x1eddc9);if(_0x18b176[_0x024b('0x128')]){rpcDb[_0x024b('0x129')](_[_0x024b('0x70')](_0x1eddc9[0x0],[_0x024b('0x72'),_0x024b('0x12a')]))[_0x024b('0x87')](function(_0x30a173){_0x298100['checkInBlack'](_0x30a173,_0x1eddc9[0x0],_0x2da793,_0x373d22,_0x769b52)[_0x024b('0x87')](function(_0x418280){_0x1a5042(_0x418280);})['catch'](function(_0x331281){_0x14b0d5(_0x331281);});})[_0x024b('0x77')](function(_0xad785b){ut[_0x024b('0x60')](_0x024b('0x12b'),_0xad785b);_0x14b0d5(ut[_0x024b('0x5f')](_0x024b('0x12c'),_0x373d22,_0x769b52));});}else{_0x14b0d5(ut[_0x024b('0x5f')](_0x18b176[_0x024b('0x5f')],_0x373d22,_0x769b52));}})['catch'](function(_0x2974a3){ut[_0x024b('0x60')](_0x024b('0x12d'),_0x2974a3);_0x14b0d5(ut[_0x024b('0x5f')](_0x024b('0x12c'),![],!![]));});});};Preview[_0x024b('0xe')][_0x024b('0x127')]=function(_0x1ac9ec){if(_[_0x024b('0x6a')](_0x1ac9ec)||_[_0x024b('0x115')](_0x1ac9ec)||!_[_0x024b('0x6a')](_0x1ac9ec[0x0][_0x024b('0x84')])&&_[_0x024b('0x6a')](_0x1ac9ec[0x0][_0x024b('0x84')]['name'])){ut['logger'](_0x024b('0x12e'),_0x1ac9ec);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x35036b=this['campaignsPreview'][_0x1ac9ec[0x0][_0x024b('0x113')]['name']];_0x35036b[_0x024b('0x5f')]='ACTIVE';if(_[_0x024b('0x6a')](_0x35036b)){ut[_0x024b('0x60')](_0x024b('0x12f'),_0x35036b);return{'isValid':![],'message':_0x024b('0x130')};}if(!this[_0x024b('0x99')](_0x35036b[_0x024b('0x50')])){ut[_0x024b('0x60')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x024b('0x131')+_0x35036b['name']+_0x024b('0x132'));if(!this[_0x024b('0x99')](_0x35036b[_0x024b('0x9a')])){ut[_0x024b('0x60')](_0x024b('0x133'),_0x35036b[_0x024b('0x51')]+_0x024b('0x134'));return{'isValid':![],'message':_0x024b('0x135')};}}if(!ut[_0x024b('0x136')](_0x35036b['dialActive'])){ut['logger'](_0x024b('0x137'),_0x35036b['name']+_0x024b('0x138'));return{'isValid':![],'message':_0x024b('0x131')+_0x35036b[_0x024b('0x51')]+_0x024b('0x138')};}return{'isValid':!![],'message':_0x024b('0x139')};};Preview[_0x024b('0xe')]['execCall']=function(_0x3f766e,_0x1e8778,_0xcc9169,_0x2e7b01){var _0x3ee572=this;return new Promise(function(_0x429c91,_0x23afcd){var _0x160e06=_0x3f766e[_0x024b('0xb4')];var _0x304634=_0x3ee572[_0x024b('0x99')](_0x1e8778[_0x024b('0x50')])?util[_0x024b('0x8b')](_0x024b('0x13a'),_0x1e8778[_0x024b('0x50')][_0x024b('0x51')],_['isNil'](_0x1e8778[_0x024b('0x37')])?'':_0x1e8778[_0x024b('0x37')]['trim']()||'',_0x1e8778[_0x024b('0x13b')]>0x0?_0xcc9169[_0x024b('0x12a')]['substring'](_0x1e8778[_0x024b('0x13b')]):_0xcc9169['phone']):util[_0x024b('0x8b')](_0x024b('0x13a'),_[_0x024b('0x6a')](_0x1e8778[_0x024b('0x9a')])?_0x1e8778[_0x024b('0x50')][_0x024b('0x51')]:_0x1e8778[_0x024b('0x9a')][_0x024b('0x51')],_[_0x024b('0x6a')](_0x1e8778[_0x024b('0x37')])?'':_0x1e8778[_0x024b('0x37')]['trim']()||'',_0x1e8778['dialCutDigit']>0x0?_0xcc9169[_0x024b('0x12a')][_0x024b('0x13c')](_0x1e8778[_0x024b('0x13b')]):_0xcc9169[_0x024b('0x12a')]);var _0x46b606=_0x3ee572[_0x024b('0x99')](_0x1e8778[_0x024b('0x50')])?ut[_0x024b('0x13d')](_0x1e8778[_0x024b('0x50')][_0x024b('0x53')],_0x1e8778[_0x024b('0x34')],_0x1e8778['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x1e8778[_0x024b('0x35')],_0x1e8778[_0x024b('0x13e')]):_0x1e8778['dialOriginateCallerIdNumber']):ut[_0x024b('0x13d')](_[_0x024b('0x6a')](_0x1e8778[_0x024b('0x9a')])?_0x1e8778[_0x024b('0x50')][_0x024b('0x53')]:_0x1e8778[_0x024b('0x9a')]['callerid'],_0x1e8778[_0x024b('0x34')],_0x1e8778[_0x024b('0x13e')]>0x0?ut[_0x024b('0x13f')](_0x1e8778[_0x024b('0x35')],_0x1e8778['dialRandomLastDigitCallerIdNumber']):_0x1e8778[_0x024b('0x35')]);if(_0x46b606){_0x3f766e['originatecalleridname']=ut[_0x024b('0x140')](_0x46b606);_0x3f766e[_0x024b('0x141')]=ut[_0x024b('0x142')](_0x46b606);}var _0x1eb48a=ut[_0x024b('0x143')](_0x1e8778,_0xcc9169,_0x304634,_0x46b606,_0x160e06,_0x3f766e);_['merge'](_0x3f766e,ut['toLowerVariables'](_0x1eb48a));_0x3f766e['starttime']=moment()[_0x024b('0x8b')](_0x024b('0x144'));_0x1e8778[_0x024b('0x145')]=_0x1eb48a;ami[_0x024b('0x74')](ut['variablesAction'](_0x3f766e,_0x1e8778,_0x1eb48a,_0x3f766e[_0x024b('0xad')],_0x2e7b01))[_0x024b('0x87')](function(_0x2e1a24){_0x1e8778[_0x024b('0x5d')]+=0x1;logger[_0x024b('0x59')](_0x024b('0x146'),_0x160e06,_0x024b('0xc3'),_0x1e8778[_0x024b('0x51')],'originated:\x20',_0x1e8778[_0x024b('0x5d')]);_0x429c91(_0x2e1a24);})['catch'](function(_0x266ab2){ut[_0x024b('0x102')](_0x3f766e,0xe,_0x024b('0x147'));rpcDb[_0x024b('0x104')](_0x3f766e,_0x024b('0x148'));_0x23afcd(_0x266ab2);});});};Preview[_0x024b('0xe')]['syncNewExten']=function(_0x2aa35a){if(this['actions'][_0x2aa35a[_0x024b('0xae')]]){this[_0x024b('0x15')][_0x2aa35a['linkedid']][_0x024b('0x76')]=_0x2aa35a[_0x024b('0x76')];}};Preview[_0x024b('0xe')][_0x024b('0x18')]=function(_0x3f971f){var _0x3af832=this;var _0x533dd3=this[_0x024b('0x15')][_0x3f971f['actionid']];if(_0x533dd3){if(_0x533dd3[_0x024b('0x114')]&&this[_0x024b('0x16')][_0x533dd3[_0x024b('0x114')]]){ut['logLookAgent'](_0x533dd3,this[_0x024b('0x16')][_0x533dd3[_0x024b('0x114')]][_0x024b('0x51')],this['agents'][_0x533dd3[_0x024b('0x114')]]['id']);}var _0x1b5714=_['clone'](_0x533dd3);_0x1b5714['responsetime']=moment()[_0x024b('0x8b')]('YYYY-MM-DD\x20HH:mm:ss');var _0x5341ba=_0x3af832['campaignsPreview'][_0x533dd3[_0x024b('0x6c')]];if(ut[_0x024b('0x149')](_0x3f971f[_0x024b('0x14a')])){if(_0x533dd3[_0x024b('0xac')]){rpcDb[_0x024b('0x124')](_0x533dd3[_0x024b('0xaf')]);}if(_0x533dd3['activeContact']){rpcDb['disableContact'](_0x533dd3[_0x024b('0xaf')]);}ami[_0x024b('0x24')]('custom:agentringnoanswer',ut[_0x024b('0xa1')](_0x533dd3,_0x024b('0x14b'),this[_0x024b('0x12')][_0x533dd3[_0x024b('0x6c')]]));this[_0x024b('0xfe')](_0x1b5714,_0x5341ba,_0x3f971f);}else{_0x533dd3[_0x024b('0x8a')]=moment()[_0x024b('0x8b')](_0x024b('0x144'));ut[_0x024b('0x102')](_0x1b5714,0x4,_0x024b('0x14c'));rpcDb['createAgentHistory'](_0x1b5714,_0x024b('0x14d'));}}};Preview[_0x024b('0xe')][_0x024b('0x1a')]=function(_0x3759d5){var _0x25957c=this['actions'][_0x3759d5[_0x024b('0xae')]];var _0xd9ad54;if(_0x25957c){_0xd9ad54=this['campaignsPreview'][_0x25957c[_0x024b('0x6c')]];logger[_0x024b('0x59')](_0x024b('0x14e'),_0x3759d5[_0x024b('0xae')],_0x024b('0xc3'),_0xd9ad54[_0x024b('0x51')],'pTalking:\x20',_0xd9ad54[_0x024b('0x2b')]);}if(this[_0x024b('0x15')][_0x3759d5['linkedid']]&&_0x3759d5[_0x024b('0xae')]!==_0x3759d5['uniqueid']){if(_0x3759d5[_0x024b('0x14f')]==='16'&&this[_0x024b('0x15')][_0x3759d5[_0x024b('0xae')]]['dialAnswer']){this[_0x024b('0x9c')](_0x3759d5,_0x3759d5[_0x024b('0xae')],_0x3759d5[_0x024b('0x14f')]);}else if(this['actions'][_0x3759d5['linkedid']][_0x024b('0x6f')]){logger[_0x024b('0x59')](_0x024b('0x150'),_0x3759d5[_0x024b('0xae')],_0x3759d5[_0x024b('0x14f')],'\x20Queue',_0xd9ad54[_0x024b('0x51')],'pTalking:\x20',_0xd9ad54[_0x024b('0x2b')]);this[_0x024b('0x9c')](_0x3759d5,_0x3759d5[_0x024b('0xae')],_0x3759d5['cause']);}}else if(_0x25957c&&_[_0x024b('0x6a')](_0x25957c['statedesc'])&&_0xd9ad54[_0x024b('0x151')]&&_0x3759d5[_0x024b('0xae')]===_0x3759d5[_0x024b('0xb4')]&&_[_0x024b('0x6a')](_0x3759d5[_0x024b('0x101')])&&_0x3759d5[_0x024b('0x14f')]==='16'&&_0x3759d5[_0x024b('0x152')]==='6'&&_[_0x024b('0xff')](_0x25957c[_0x024b('0x153')])){if(_0x25957c[_0x024b('0xac')]){rpcDb[_0x024b('0x124')](_0x25957c['idContact']);}if(_0x25957c[_0x024b('0xad')]){rpcDb[_0x024b('0x89')](_0x25957c[_0x024b('0xaf')]);}_0x3759d5[_0x024b('0x101')]='22';this[_0x024b('0xfe')](_0x25957c,_0xd9ad54,_0x3759d5);}else if(_0x25957c&&_0x25957c[_0x024b('0x153')]){if(_0x3759d5[_0x024b('0x14f')]==='16'&&this[_0x024b('0x15')][_0x3759d5[_0x024b('0xae')]][_0x024b('0x6f')]){logger['info']('[syncHangup][talking][transfer]',_0x3759d5[_0x024b('0xae')],_0x3759d5[_0x024b('0x14f')],_0x024b('0xc3'),_0xd9ad54[_0x024b('0x51')],_0x024b('0x6e'),_0xd9ad54[_0x024b('0x2b')]);this[_0x024b('0x9c')](_0x3759d5,_0x3759d5[_0x024b('0xae')],_0x3759d5[_0x024b('0x14f')]);}else if(this[_0x024b('0x15')][_0x3759d5[_0x024b('0xae')]][_0x024b('0x6f')]){logger[_0x024b('0x59')](_0x024b('0x150'),_0x3759d5[_0x024b('0xae')],_0x3759d5[_0x024b('0x14f')],_0x024b('0xc3'),_0xd9ad54[_0x024b('0x51')],'pTalking:\x20',_0xd9ad54['pTalking']);this['callProgressDetectingCustomer'](_0x3759d5,_0x3759d5['linkedid'],_0x3759d5[_0x024b('0x14f')]);}}};Preview[_0x024b('0xe')]['syncDialEnd']=function(_0x1acf26){if(this[_0x024b('0x15')][_0x1acf26[_0x024b('0xfd')]]&&_0x1acf26[_0x024b('0xfd')]!==_0x1acf26[_0x024b('0x154')]){this[_0x024b('0x9c')](_0x1acf26,_0x1acf26['destlinkedid'],_0x1acf26['dialstatus']);}};Preview[_0x024b('0xe')][_0x024b('0x1b')]=function(_0x2241ae){if(this[_0x024b('0x15')][_0x2241ae[_0x024b('0xae')]]&&_0x2241ae[_0x024b('0xae')]!==_0x2241ae[_0x024b('0xb4')]&&!this[_0x024b('0x15')][_0x2241ae[_0x024b('0xae')]][_0x024b('0x6f')]){if(_0x2241ae['cause']==='1'){this[_0x024b('0x9c')](_0x2241ae,_0x2241ae['linkedid'],_0x2241ae[_0x024b('0x14f')]);}}};Preview[_0x024b('0xe')][_0x024b('0x155')]=function(_0x212f7a,_0xe4bcb2,_0x317558){if(this[_0x024b('0x15')][_0x212f7a]){if(_[_0x024b('0x6a')](this[_0x024b('0x15')][_0x212f7a]['variables'])){this[_0x024b('0x15')][_0x212f7a]['variables']={};}this[_0x024b('0x15')][_0x212f7a]['variables'][_0xe4bcb2]=_0x317558;}};Preview['prototype'][_0x024b('0x1f')]=function(_0x28cc3a){try{if(!_[_0x024b('0x6a')](_0x28cc3a)){if(ut['filterKey'](_[_0x024b('0x156')](_0x28cc3a[_0x024b('0x157')])[0x0])){this['addVariable'](_0x28cc3a[_0x024b('0xb4')],_[_0x024b('0x156')](_0x28cc3a[_0x024b('0x157')])[0x0],_0x28cc3a[_0x024b('0x158')]);}}}catch(_0x40fbee){logger[_0x024b('0x159')](_0x024b('0x15a'),util[_0x024b('0x15b')](_0x40fbee,{'showHidden':![],'depth':null}));}};Preview[_0x024b('0xe')][_0x024b('0x20')]=function(_0x5bee08){if(_0x5bee08){if(this[_0x024b('0x15')][_0x5bee08['transfertargetlinkedid']]){this['actions'][_0x5bee08[_0x024b('0x15c')]][_0x024b('0x153')]=!![];}}};Preview[_0x024b('0xe')][_0x024b('0x22')]=function(_0x176aa1){if(_0x176aa1){if(this['actions'][_0x176aa1['transfererlinkedid']]){this[_0x024b('0x15')][_0x176aa1[_0x024b('0x15d')]][_0x024b('0x153')]=!![];}}};module[_0x024b('0x15e')]=Preview; \ No newline at end of file +var _0xa2dc=['../../../config/logger','preview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','defaults','localhost','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','syncHangup','hanguprequest','syncDialEnd','syncNewExten','varset','syncVarSet','attendedtransfer','loopCampaigns','emit','outbound','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','type','unmanaged','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','Interval','voice:queue:%s','voice_queue:save','info','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','DEACTIVATED','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','clearZombieChannels','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','[clearZombieChannels][talking]','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','Action','status','catch','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','getContactRecallMe','then','isNil','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','dialActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','totalGlobal','dialGlobalMaxRetry','Global','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','activeContact','linkedid','actioncountonusuch','idContact','swapAdditionalPhones','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','connect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','total','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','pTalking:\x20','countbusyretry','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','verifyAdditionalPhones','cloneAction','dialBusyMaxRetry','NOANSWER','countnoanswerretry','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','unlockAgent','incrementPreviewCounters','countcongestionretry','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','CANCEL','countagentrejectretry','dialAgentRejectRetryFrequency','custom:agentreject','[syncHangupRequest][logAgentReject]','AgentReject','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','outboundUnknownCallsDay','countmachineretry','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logCongestion]','reason','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','resolve','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','phone','Contact\x20is\x20undefined','isEmpty','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','Calling','logger','[Preview][execCall][failure]','Call\x20failed','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','format','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','execCall','SIP/%s/%s%s','dialCutDigit','substring','trim','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','extractCalleridName','originatecalleridnum','merge','toLowerVariables','starttime','variables','variablesAction','[originated][increment]','[originateFailure][logOriginateFailure]','channel','actionid','lookAgent','clone','isFailure','response','rejected','[callProgressDetectingAgent][logAnswer]','callProgressDetectingCustomer','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','syncHangupRequest','filterKey','keys','variable','addVariable','error','[syncVarSet][Preview]','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','util','lodash','uuid','moment','md5','ioredis','../../../config/environment'];(function(_0x427cbd,_0x1769d3){var _0xe559ac=function(_0x553949){while(--_0x553949){_0x427cbd['push'](_0x427cbd['shift']());}};_0xe559ac(++_0x1769d3);}(_0xa2dc,0x154));var _0xca2d=function(_0x508685,_0x9f94af){_0x508685=_0x508685-0x0;var _0x976a76=_0xa2dc[_0x508685];return _0x976a76;};'use strict';var util=require(_0xca2d('0x0'));var _=require(_0xca2d('0x1'));var uuid=require(_0xca2d('0x2'));var moment=require(_0xca2d('0x3'));var md5=require(_0xca2d('0x4'));var Redis=require(_0xca2d('0x5'));var config=require(_0xca2d('0x6'));var logger=require(_0xca2d('0x7'))(_0xca2d('0x8'));var loggerAction=require(_0xca2d('0x7'))('actionPreview');var ami=require(_0xca2d('0x9'));var rpcDb=require(_0xca2d('0xa'));var cmHopperAdditionalPhone=require(_0xca2d('0xb'));var Action=require(_0xca2d('0xc'));var ut=require(_0xca2d('0xd'));config[_0xca2d('0xe')]=_[_0xca2d('0xf')](config[_0xca2d('0xe')],{'host':_0xca2d('0x10'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xca2d('0xe')]));var Sequence=function(){};Sequence[_0xca2d('0x11')][_0xca2d('0x12')]=function(_0x112523){this[_0xca2d('0x13')]=this[_0xca2d('0x13')]?this[_0xca2d('0x13')][_0xca2d('0x14')](_0x112523):_0x112523();};function Preview(_0xb506c2){this[_0xca2d('0x15')]=new Sequence();this[_0xca2d('0x16')]=_0xb506c2[_0xca2d('0x17')];this['trunks']=_0xb506c2[_0xca2d('0x18')];this[_0xca2d('0x19')]={};this[_0xca2d('0x1a')]=_0xb506c2[_0xca2d('0x1a')];this[_0xca2d('0x1b')]=0x0;ami['on']('originateresponse',this[_0xca2d('0x1c')][_0xca2d('0x1d')](this));ami['on']('hangup',this[_0xca2d('0x1e')][_0xca2d('0x1d')](this));ami['on'](_0xca2d('0x1f'),this['syncHangupRequest']['bind'](this));ami['on']('dialend',this[_0xca2d('0x20')][_0xca2d('0x1d')](this));ami['on']('newexten',this[_0xca2d('0x21')]['bind'](this));ami['on'](_0xca2d('0x22'),this[_0xca2d('0x23')][_0xca2d('0x1d')](this));ami['on'](_0xca2d('0x24'),this['syncAttendedTransfer'][_0xca2d('0x1d')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0xca2d('0x1d')](this));this[_0xca2d('0x25')](this[_0xca2d('0x16')]);}function emit(_0x4f4c8d,_0x446031,_0x4eca54){io['to'](_0x4f4c8d)[_0xca2d('0x26')](_0x446031,_0x4eca54);}function emitCampaignPreview(_0x622b6a){if(_0x622b6a['type']===_0xca2d('0x27')){var _0x2ceb3b={'id':_0x622b6a['id'],'name':_0x622b6a[_0xca2d('0x28')],'strategy':_0x622b6a[_0xca2d('0x29')],'answered':_0x622b6a[_0xca2d('0x2a')],'available':_0x622b6a[_0xca2d('0x2b')],'loggedIn':_0x622b6a[_0xca2d('0x2c')],'pTalking':_0x622b6a[_0xca2d('0x2d')],'sumBillable':_0x622b6a[_0xca2d('0x2e')],'sumDuration':_0x622b6a[_0xca2d('0x2f')],'sumHoldTime':_0x622b6a[_0xca2d('0x30')]||0x0,'talking':_0x622b6a[_0xca2d('0x31')],'total':_0x622b6a['total'],'type':_0x622b6a[_0xca2d('0x32')],'unmanaged':_0x622b6a[_0xca2d('0x33')],'abandoned':_0x622b6a['abandoned'],'waiting':_0x622b6a[_0xca2d('0x34')],'loggedInDb':_0x622b6a[_0xca2d('0x35')],'dialActive':_0x622b6a['dialActive'],'dialMethod':_0x622b6a[_0xca2d('0x36')],'dialOriginateCallerIdName':_0x622b6a[_0xca2d('0x37')],'dialOriginateCallerIdNumber':_0x622b6a['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x622b6a['dialOriginateTimeout'],'dialPrefix':_0x622b6a[_0xca2d('0x38')],'outboundAnswerAgiCallsDay':_0x622b6a[_0xca2d('0x39')],'outboundAnswerCallsDay':_0x622b6a[_0xca2d('0x3a')],'outboundBlacklistCallsDay':_0x622b6a[_0xca2d('0x3b')],'outboundBusyCallsDay':_0x622b6a[_0xca2d('0x3c')],'outboundCongestionCallsDay':_0x622b6a[_0xca2d('0x3d')],'outboundDropCallsDayACS':_0x622b6a[_0xca2d('0x3e')],'outboundDropCallsDayCallersExit':_0x622b6a['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x622b6a[_0xca2d('0x3f')],'outboundNoAnswerCallsDay':_0x622b6a[_0xca2d('0x40')],'outboundNoSuchCallsDay':_0x622b6a['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x622b6a[_0xca2d('0x41')],'outboundReCallsDay':_0x622b6a[_0xca2d('0x42')],'outboundRejectCallsDay':_0x622b6a[_0xca2d('0x43')],'outboundUnknownCallsDay':_0x622b6a['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x622b6a['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x622b6a[_0xca2d('0x44')],'predictiveIntervalAvgHoldtime':_0x622b6a['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x622b6a[_0xca2d('0x45')],'predictiveIntervalDroppedCallsCallersExit':_0x622b6a['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x622b6a['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x622b6a[_0xca2d('0x46')],'predictiveIntervalErlangCallsDroppedCalls':_0x622b6a[_0xca2d('0x47')],'predictiveIntervalHitRate':_0x622b6a['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x622b6a[_0xca2d('0x48')],'predictiveIntervalPauses':_0x622b6a[_0xca2d('0x49')],'predictiveIntervalAvailable':_0x622b6a[_0xca2d('0x4a')],'predictiveIntervalTotalCalls':_0x622b6a[_0xca2d('0x4b')],'message':_0x622b6a[_0xca2d('0x4c')],'originated':_0x622b6a[_0xca2d('0x4d')],'erlangCalls':_0x622b6a[_0xca2d('0x4e')],'erlangCallToSecond':_0x622b6a[_0xca2d('0x4f')],'erlangAbandonmentRate':_0x622b6a[_0xca2d('0x50')],'erlangBusyFactor':_0x622b6a[_0xca2d('0x51')],'startPredictive':_0x622b6a['startPredictive'],'startProgressive':_0x622b6a[_0xca2d('0x52')]};if(_0x622b6a[_0xca2d('0x53')]){_0x2ceb3b[_0xca2d('0x53')]={'id':_0x622b6a[_0xca2d('0x53')]['id'],'name':_0x622b6a[_0xca2d('0x53')][_0xca2d('0x28')],'active':_0x622b6a[_0xca2d('0x53')][_0xca2d('0x54')],'callerid':_0x622b6a[_0xca2d('0x53')]['callerid']};}if(_0x622b6a[_0xca2d('0x55')]){_0x2ceb3b[_0xca2d('0x55')]={'id':_0x622b6a[_0xca2d('0x55')]['id'],'name':_0x622b6a['Interval'][_0xca2d('0x28')]};}var _0x316841=md5(JSON['stringify'](_0x2ceb3b));if(_0x622b6a[_0xca2d('0x4')]!==_0x316841){_0x622b6a[_0xca2d('0x4')]=_0x316841;emit(util['format'](_0xca2d('0x56'),_0x2ceb3b[_0xca2d('0x28')]),_0xca2d('0x57'),_0x2ceb3b);}}}function emitVoiceQueueChannelRemove(_0x29293a){logger[_0xca2d('0x58')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x29293a));emit(util['format'](_0xca2d('0x56'),_0x29293a[_0xca2d('0x28')]),_0xca2d('0x59'),_0x29293a);io['emit'](_0xca2d('0x5a'),_0x29293a);}function notSendMessagesQueue(_0x2c4fa5){if(_0x2c4fa5[_0xca2d('0x5b')]){if(_0x2c4fa5[_0xca2d('0x4d')]===0x0&&_0x2c4fa5[_0xca2d('0x2d')]===0x0){_0x2c4fa5[_0xca2d('0x5b')]=![];_0x2c4fa5[_0xca2d('0x2b')]=0x0;_0x2c4fa5[_0xca2d('0x5c')]=0x0;_0x2c4fa5[_0xca2d('0x4c')]=_0xca2d('0x5d');ut['logger'](_0xca2d('0x5e'),_0x2c4fa5[_0xca2d('0x28')]+_0xca2d('0x5f'));}else{_0x2c4fa5[_0xca2d('0x4c')]=_0xca2d('0x60');ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x2c4fa5[_0xca2d('0x28')]+_0xca2d('0x61'));}emitCampaignPreview(_0x2c4fa5);}}Preview[_0xca2d('0x11')][_0xca2d('0x25')]=function(){var _0x4d34a4=this;setInterval(function(){_0x4d34a4[_0xca2d('0x62')]();},0x7cf);};Preview['prototype'][_0xca2d('0x62')]=function(){var _0x2dcd6c=this['campaignsPreview'];this[_0xca2d('0x1b')]+=0x1;for(var _0x2244c2 in _0x2dcd6c){if(_0x2dcd6c[_0xca2d('0x63')](_0x2244c2)&&(_0x2dcd6c[_0x2244c2][_0xca2d('0x36')]===_0xca2d('0x8')||_0x2dcd6c[_0x2244c2]['dialMethod']==='booked')&&_0x2dcd6c[_0x2244c2][_0xca2d('0x32')]===_0xca2d('0x27')){if(this['clockClearZombieChannels']>0x7){this[_0xca2d('0x1b')]=0x0;this[_0xca2d('0x64')]();}}if(_0x2dcd6c['hasOwnProperty'](_0x2244c2)&&_0x2dcd6c[_0x2244c2][_0xca2d('0x36')]===_0xca2d('0x8')&&_0x2dcd6c[_0x2244c2][_0xca2d('0x32')]===_0xca2d('0x27')){if(_0x2dcd6c[_0x2244c2]['dialActive']){this[_0xca2d('0x65')](_0x2dcd6c[_0x2244c2]);if(_0x2dcd6c[_0x2244c2][_0xca2d('0x66')])this[_0xca2d('0x67')](_0x2dcd6c[_0x2244c2]);}else{notSendMessagesQueue(_0x2dcd6c[_0x2244c2]);}}}};Preview[_0xca2d('0x11')][_0xca2d('0x68')]=function(_0x1f6b64){var _0x580d0f=this;this[_0xca2d('0x15')][_0xca2d('0x12')](function(){if(!_['isNil'](_0x580d0f['actions'][_0x1f6b64])){loggerAction[_0xca2d('0x58')](_0xca2d('0x69'),_0x1f6b64,_0xca2d('0x6a'),_0x580d0f[_0xca2d('0x19')][_0x1f6b64][_0xca2d('0x6b')],_0xca2d('0x6c'),JSON[_0xca2d('0x6d')](_0x580d0f[_0xca2d('0x16')][_0x580d0f['actions'][_0x1f6b64][_0xca2d('0x6b')]][_0xca2d('0x4d')]),'pTalking:\x20',JSON[_0xca2d('0x6d')](_0x580d0f['campaignsPreview'][_0x580d0f[_0xca2d('0x19')][_0x1f6b64][_0xca2d('0x6b')]][_0xca2d('0x2d')]),JSON[_0xca2d('0x6d')](_0x580d0f['actions'][_0x1f6b64]['dialAnswer']),JSON['stringify'](_[_0xca2d('0x6e')](_0x580d0f[_0xca2d('0x19')][_0x1f6b64],['contactId',_0xca2d('0x6f'),_0xca2d('0x70'),_0xca2d('0x71')])));return ami[_0xca2d('0x72')]({'action':_0xca2d('0x73'),'channel':_0x580d0f[_0xca2d('0x19')][_0x1f6b64]['channel']})[_0xca2d('0x74')](function(_0x58246e){if(_0x58246e['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x580d0f['actions'][_0x1f6b64]){ut[_0xca2d('0x75')](_0x580d0f[_0xca2d('0x16')][_0x580d0f[_0xca2d('0x19')][_0x1f6b64][_0xca2d('0x6b')]],_0xca2d('0x76'));if(_0x580d0f[_0xca2d('0x19')][_0x1f6b64][_0xca2d('0x77')]===!![]){ut[_0xca2d('0x78')](_0x580d0f['campaignsPreview'][_0x580d0f[_0xca2d('0x19')][_0x1f6b64][_0xca2d('0x6b')]],'[clearZombieChannel]');ut[_0xca2d('0x79')]('[Dialer][checkChannel][pTalking][Preview]'+_0x1f6b64,_0x580d0f[_0xca2d('0x19')][_0x1f6b64][_0xca2d('0x6b')]);}ut[_0xca2d('0x79')](_0xca2d('0x7a')+_0x1f6b64,_0x580d0f[_0xca2d('0x19')][_0x1f6b64][_0xca2d('0x6b')]);delete _0x580d0f[_0xca2d('0x19')][_0x1f6b64];}},0x2328);}});}});};Preview[_0xca2d('0x11')][_0xca2d('0x64')]=function(){var _0x42683a=this;loggerAction[_0xca2d('0x58')]('[action]',_['size'](this[_0xca2d('0x19')]));for(var _0x8f8738 in this[_0xca2d('0x19')]){if(_0x42683a[_0xca2d('0x19')][_0xca2d('0x63')](_0x8f8738)){_0x42683a['clearZombieChannel'](_0x8f8738);}}};Preview[_0xca2d('0x11')][_0xca2d('0x67')]=function(_0x4508a1){var _0x552c42=this;rpcDb[_0xca2d('0x7b')](_0x4508a1['id'],ut['agentReadyId'](this[_0xca2d('0x1a')]))[_0xca2d('0x7c')](function(_0xadee92){if(!_[_0xca2d('0x7d')](_0xadee92)){for(var _0x341642=0x0;_0x341642<_0xadee92['length'];_0x341642+=0x1){if(ut[_0xca2d('0x7e')](_0xadee92[_0x341642][_0xca2d('0x7f')])<_0x4508a1[_0xca2d('0x80')]*0x3c){if(_0xadee92[_0x341642]['Agent']&&!_0xadee92[_0x341642][_0xca2d('0x81')][_0xca2d('0x82')]){_0x552c42[_0xca2d('0x83')](_0xadee92[_0x341642]['id'])['then'](ut[_0xca2d('0x84')](_0xca2d('0x85')))[_0xca2d('0x74')](ut['logger2'](_0xca2d('0x85')));}else{rpcDb[_0xca2d('0x86')](_0xadee92[_0x341642]['id']);}}else{var _0x3ec7ea=new Action(_0xadee92[_0x341642],_0x4508a1);_0x3ec7ea['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4508a1[_0xca2d('0x42')]+=0x1;ut[_0xca2d('0x87')](_0x3ec7ea,0x17,_0xca2d('0x88'));if(_0x4508a1[_0xca2d('0x89')]){rpcDb[_0xca2d('0x8a')](ut[_0xca2d('0x8b')](_0xadee92[_0x341642]));rpcDb[_0xca2d('0x8c')](_0x3ec7ea,_0xca2d('0x8d'));}else{ut['logCustomer'](_0x3ec7ea,0x16,_0xca2d('0x8e'));rpcDb['createCustomerHistory'](_0x3ec7ea,_0xca2d('0x8f'));rpcDb[_0xca2d('0x90')](_0x3ec7ea,_0xca2d('0x8f'));}}}}})[_0xca2d('0x74')](ut['logger2'](_0xca2d('0x91')));};Preview[_0xca2d('0x11')]['setMessage']=function(_0x53d155){_0x53d155[_0xca2d('0x5b')]=!![];if(ut[_0xca2d('0x92')](_0x53d155[_0xca2d('0x2c')])){_0x53d155[_0xca2d('0x4c')]=_0xca2d('0x93');}else if(!ut[_0xca2d('0x94')](_0x53d155[_0xca2d('0x95')])){_0x53d155[_0xca2d('0x4c')]=_0xca2d('0x5d');}else if(!this['isTrunkReachable'](_0x53d155['Trunk'])){if(!this[_0xca2d('0x96')](_0x53d155[_0xca2d('0x97')])){_0x53d155[_0xca2d('0x4c')]=_0xca2d('0x98');}else{_0x53d155[_0xca2d('0x4c')]='ACTIVE';}}else{_0x53d155[_0xca2d('0x4c')]=_0xca2d('0x99');}emitCampaignPreview(_0x53d155);};Preview[_0xca2d('0x11')]['callProgressDetectingCustomer']=function(_0x1f1807,_0x1031e0,_0x5d492e){var _0x3d2370=this;var _0x2e7a30=this[_0xca2d('0x19')][_0x1031e0];var _0x299023=this[_0xca2d('0x16')][_0x2e7a30['queue']];var _0xa03b78;var _0x504bf9=![];var _0x39727a=0x2;var _0x3518fe=0x3;if(_0x299023){switch(_0x5d492e){case'1':_0x299023[_0xca2d('0x9a')]+=0x1;_0x2e7a30[_0xca2d('0x9b')]+=0x1;_0x2e7a30[_0xca2d('0x9c')]=ut['totalGlobal'](_0x2e7a30);ut['logCustomer'](_0x2e7a30,0x0,'NoSuchNumber');ami[_0xca2d('0x26')](_0xca2d('0x9d'),ut[_0xca2d('0x9e')](_0x2e7a30,_0xca2d('0x9f')));rpcDb[_0xca2d('0x8c')](_0x2e7a30,_0xca2d('0xa0'));_0x3d2370['verifyAdditionalPhones'](_0x2e7a30,'0',_0x299023)[_0xca2d('0x7c')](function(_0x6b6e38){_0x504bf9=_0x6b6e38[_0xca2d('0xa1')]==0x1;_0x39727a=_0x299023[_0xca2d('0xa2')];_0x3518fe=_0x299023[_0xca2d('0xa3')];if(!_0x504bf9){if(ut[_0xca2d('0xa4')](_0x2e7a30)>=_0x299023[_0xca2d('0xa5')]){_0xa03b78=ut['cloneAction'](_0x2e7a30,0xf,_0xca2d('0xa6'));rpcDb[_0xca2d('0x90')](_0xa03b78,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x2e7a30[_0xca2d('0x9b')]>=_0x299023[_0xca2d('0xa7')]){rpcDb['createCustomerFinal'](_0x2e7a30,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0xca2d('0xa8')](ut[_0xca2d('0xa9')](_0x2e7a30,_0xca2d('0x9b'),_0x299023[_0xca2d('0xa2')]),_0x2e7a30['unlockAgent'],_0x2e7a30[_0xca2d('0xaa')]);}}delete this[_0xca2d('0x19')][_0x1f1807[_0xca2d('0xab')]];}else{_0x2e7a30[_0xca2d('0x9b')]++;logger[_0xca2d('0x58')](_0xca2d('0xac'),_0x2e7a30[_0xca2d('0x9b')]);logger['info']('id',_0x2e7a30[_0xca2d('0xad')]);_0x3d2370['incrementPreviewCounters']({'id':_0x2e7a30[_0xca2d('0xad')],'field':{'countnosuchnumberretry':_0x2e7a30[_0xca2d('0x9b')]}})['then'](function(){_0x3d2370[_0xca2d('0xae')](_0x2e7a30,_0x39727a,_0x3518fe)[_0xca2d('0x7c')](function(){});});}});break;case _0xca2d('0xaf'):var _0x5f3c5f=moment()['format'](_0xca2d('0xb0'));_0x2e7a30[_0xca2d('0xb1')]=_0x5f3c5f;_0x2e7a30[_0xca2d('0xb2')]=_0x5f3c5f;_0x2e7a30['dialAnswer']=!![];_0x299023[_0xca2d('0x2d')]+=0x1;logger['info'](_0xca2d('0xb3'),_0x2e7a30[_0xca2d('0xb4')],_0xca2d('0xb5'),_0x299023[_0xca2d('0x28')],'pTalking:\x20',_0x299023['pTalking']);ami[_0xca2d('0x26')]('custom:agentconnect',ut['buildObj'](_0x2e7a30,_0xca2d('0xb6'),this['campaignsPreview'][_0x2e7a30[_0xca2d('0x6b')]]));if(_0x299023['acw']){ami[_0xca2d('0x26')](_0xca2d('0xb7'),ut[_0xca2d('0xb8')](_0x2e7a30));}break;case'16':ami[_0xca2d('0x26')](_0xca2d('0xb9'),ut[_0xca2d('0x9e')](_0x2e7a30,'complete',this['campaignsPreview'][_0x2e7a30[_0xca2d('0x6b')]]));emitVoiceQueueChannelRemove(ut[_0xca2d('0x9e')](_0x2e7a30,_0xca2d('0xba')));_0x299023[_0xca2d('0x3a')]+=0x1;_0x299023[_0xca2d('0xbb')]+=0x1;_0x299023[_0xca2d('0x2a')]+=0x1;ut[_0xca2d('0x78')](_0x299023,_0xca2d('0xbc'));_0x2e7a30['countglobal']=ut[_0xca2d('0xa4')](_0x2e7a30);ut[_0xca2d('0x87')](_0x2e7a30,0x4,_0xca2d('0xbd'));rpcDb[_0xca2d('0x8c')](_0x2e7a30,_0xca2d('0xbe'));rpcDb[_0xca2d('0x90')](_0x2e7a30,_0xca2d('0xbf'));rpcDb[_0xca2d('0xc0')](_0x2e7a30);_0x299023[_0xca2d('0x2f')]+=_0x2e7a30[_0xca2d('0xc1')];_0x299023[_0xca2d('0x2e')]+=_0x2e7a30[_0xca2d('0xc1')];logger['info'](_0xca2d('0xc2'),_0x2e7a30['uniqueid'],'\x20Queue',_0x299023[_0xca2d('0x28')],_0xca2d('0xc3'),_0x299023[_0xca2d('0x2d')]);delete this['actions'][_0x1f1807[_0xca2d('0xab')]];break;case'BUSY':_0x299023['outboundBusyCallsDay']+=0x1;_0x2e7a30[_0xca2d('0xc4')]+=0x1;_0x2e7a30[_0xca2d('0x9c')]=ut[_0xca2d('0xa4')](_0x2e7a30);ut[_0xca2d('0x87')](_0x2e7a30,0x5,'Busy');_0x39727a=_0x299023[_0xca2d('0xc5')];_0x3518fe=_0x299023[_0xca2d('0xa3')];ami[_0xca2d('0x26')](_0xca2d('0xc6'),ut[_0xca2d('0x9e')](_0x2e7a30,_0xca2d('0xc7')));rpcDb[_0xca2d('0x8c')](_0x2e7a30,_0xca2d('0xc8'));_0x3d2370[_0xca2d('0xc9')](_0x2e7a30,'5',_0x299023)[_0xca2d('0x7c')](function(_0x2ff531){_0x504bf9=_0x2ff531[_0xca2d('0xa1')]==0x1;if(!_0x504bf9){if(ut[_0xca2d('0xa4')](_0x2e7a30)>=_0x299023[_0xca2d('0xa5')]){_0xa03b78=ut[_0xca2d('0xca')](_0x2e7a30,0xf,'Global');rpcDb[_0xca2d('0x90')](_0xa03b78,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x2e7a30[_0xca2d('0xc4')]>=_0x299023[_0xca2d('0xcb')]){rpcDb['createCustomerFinal'](_0x2e7a30,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb['rescheduleContact'](ut[_0xca2d('0xa9')](_0x2e7a30,_0xca2d('0xc4'),_0x299023[_0xca2d('0xc5')]),_0x2e7a30['unlockAgent'],_0x2e7a30['activeContact']);}}}else{_0x2e7a30[_0xca2d('0xc4')]++;_0x3d2370['incrementPreviewCounters']({'id':_0x2e7a30[_0xca2d('0xad')],'field':{'countbusyretry':_0x2e7a30['countbusyretry']}})['then'](function(){_0x3d2370[_0xca2d('0xae')](_0x2e7a30,_0x39727a,_0x3518fe)[_0xca2d('0x7c')](function(){});});}});break;case _0xca2d('0xcc'):_0x299023[_0xca2d('0x40')]+=0x1;_0x2e7a30[_0xca2d('0xcd')]+=0x1;_0x2e7a30[_0xca2d('0x9c')]=ut[_0xca2d('0xa4')](_0x2e7a30);ut[_0xca2d('0x87')](_0x2e7a30,0x3,_0xca2d('0xce'));_0x39727a=_0x299023['dialNoAnswerRetryFrequency'];_0x3518fe=_0x299023['callAdditionalPhoneAfterMin'];var _0x41de76=ut[_0xca2d('0xcf')](_0x2e7a30,_0x299023);ami['emit'](_0xca2d('0xd0'),_0x41de76);rpcDb['createCustomerHistory'](_0x2e7a30,_0xca2d('0xd1'));_0x3d2370[_0xca2d('0xc9')](_0x2e7a30,'3',_0x299023)[_0xca2d('0x7c')](function(_0x151828){_0x504bf9=_0x151828[_0xca2d('0xa1')]==0x1;if(!_0x504bf9){if(ut[_0xca2d('0xa4')](_0x2e7a30)>=_0x299023['dialGlobalMaxRetry']){_0xa03b78=ut[_0xca2d('0xca')](_0x2e7a30,0xf,_0xca2d('0xa6'));rpcDb[_0xca2d('0x90')](_0xa03b78,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x2e7a30[_0xca2d('0xcd')]>=_0x299023[_0xca2d('0xd2')]){rpcDb['createCustomerFinal'](_0x2e7a30,_0xca2d('0xd1'));}else{rpcDb[_0xca2d('0xa8')](ut[_0xca2d('0xa9')](_0x2e7a30,_0xca2d('0xcd'),_0x299023[_0xca2d('0xd3')]),_0x2e7a30[_0xca2d('0xd4')],_0x2e7a30[_0xca2d('0xaa')]);}}}else{_0x2e7a30[_0xca2d('0xcd')]++;_0x3d2370[_0xca2d('0xd5')]({'id':_0x2e7a30[_0xca2d('0xad')],'field':{'countnoanswerretry':_0x2e7a30[_0xca2d('0xcd')]}})[_0xca2d('0x7c')](function(){_0x3d2370[_0xca2d('0xae')](_0x2e7a30,_0x39727a,_0x3518fe)[_0xca2d('0x7c')](function(){});});}});break;case'CONGESTION':_0x299023[_0xca2d('0x3d')]+=0x1;_0x2e7a30[_0xca2d('0xd6')]+=0x1;_0x2e7a30[_0xca2d('0x9c')]=ut[_0xca2d('0xa4')](_0x2e7a30);ut[_0xca2d('0x87')](_0x2e7a30,0x8,'Congestion');_0x39727a=_0x299023['dialCongestionRetryFrequency'];_0x3518fe=_0x299023[_0xca2d('0xa3')];ami[_0xca2d('0x26')]('custom:agentcongestion',ut[_0xca2d('0x9e')](_0x2e7a30,_0xca2d('0xd7')));rpcDb[_0xca2d('0x8c')](_0x2e7a30,'[callProgressDetectingCustomer][logCongestion]');_0x3d2370[_0xca2d('0xc9')](_0x2e7a30,'8',_0x299023)['then'](function(_0x48773a){_0x504bf9=_0x48773a[_0xca2d('0xa1')]==0x1;if(!_0x504bf9){if(ut['totalGlobal'](_0x2e7a30)>=_0x299023['dialGlobalMaxRetry']){_0xa03b78=ut[_0xca2d('0xca')](_0x2e7a30,0xf,_0xca2d('0xa6'));rpcDb[_0xca2d('0x90')](_0xa03b78,_0xca2d('0xd8'));}else{if(_0x2e7a30[_0xca2d('0xd6')]>=_0x299023[_0xca2d('0xd9')]){rpcDb[_0xca2d('0x90')](_0x2e7a30,_0xca2d('0xda'));}else{rpcDb[_0xca2d('0xa8')](ut[_0xca2d('0xa9')](_0x2e7a30,_0xca2d('0xd6'),_0x299023[_0xca2d('0xc5')]),_0x2e7a30[_0xca2d('0xd4')],_0x2e7a30[_0xca2d('0xaa')]);}}}else{_0x2e7a30['countcongestionretry']++;_0x3d2370['incrementPreviewCounters']({'id':_0x2e7a30[_0xca2d('0xad')],'field':{'countcongestionretry':_0x2e7a30[_0xca2d('0xd6')]}})[_0xca2d('0x7c')](function(){_0x3d2370['swapAdditionalPhones'](_0x2e7a30,_0x39727a,_0x3518fe)[_0xca2d('0x7c')](function(){});});}});break;case _0xca2d('0xdb'):_0x299023[_0xca2d('0x43')]+=0x1;_0x2e7a30[_0xca2d('0xdc')]+=0x1;_0x2e7a30[_0xca2d('0x9c')]=ut[_0xca2d('0xa4')](_0x2e7a30);ut[_0xca2d('0x87')](_0x2e7a30,0x14,'AgentReject');_0x39727a=_0x299023[_0xca2d('0xdd')];_0x3518fe=_0x299023[_0xca2d('0xa3')];ami[_0xca2d('0x26')](_0xca2d('0xde'),ut[_0xca2d('0x9e')](_0x2e7a30,'agentreject'));rpcDb[_0xca2d('0x8c')](_0x2e7a30,_0xca2d('0xdf'));_0x3d2370['verifyAdditionalPhones'](_0x2e7a30,'20',_0x299023)[_0xca2d('0x7c')](function(_0x3c3472){_0x504bf9=_0x3c3472['additional']==0x1;if(!_0x504bf9){if(ut['totalGlobal'](_0x2e7a30)>=_0x299023['dialGlobalMaxRetry']){_0xa03b78=ut[_0xca2d('0xca')](_0x2e7a30,0x14,_0xca2d('0xe0'));rpcDb['createCustomerFinal'](_0xa03b78,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x2e7a30['countagentrejectretry']>=_0x299023[_0xca2d('0xe1')]){rpcDb[_0xca2d('0x90')](_0x2e7a30,_0xca2d('0xe2'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x2e7a30,'countagentrejectretry',_0x299023[_0xca2d('0xdd')]),_0x2e7a30['unlockAgent'],_0x2e7a30[_0xca2d('0xaa')]);}}}else{_0x2e7a30[_0xca2d('0xcd')]++;_0x3d2370[_0xca2d('0xd5')]({'id':_0x2e7a30['idContact'],'field':{'countnoanswerretry':_0x2e7a30[_0xca2d('0xcd')]}})['then'](function(){_0x3d2370[_0xca2d('0xae')](_0x2e7a30,_0x39727a,_0x3518fe)[_0xca2d('0x7c')](function(){});});}});break;case _0xca2d('0xe3'):_0x299023['outboundAbandonedCallsDay']+=0x1;_0x2e7a30[_0xca2d('0xe4')]+=0x1;_0x2e7a30[_0xca2d('0x9c')]=ut[_0xca2d('0xa4')](_0x2e7a30);ut[_0xca2d('0x87')](_0x2e7a30,0xb,_0xca2d('0xe5'));rpcDb[_0xca2d('0x8c')](_0x2e7a30,_0xca2d('0xe6'));_0x3d2370[_0xca2d('0xc9')](_0x2e7a30,'11',_0x299023)[_0xca2d('0x7c')](function(_0xbdd721){_0x504bf9=_0xbdd721[_0xca2d('0xa1')]==0x1;if(!_0x504bf9){if(ut[_0xca2d('0xa4')](_0x2e7a30)>=_0x299023['dialGlobalMaxRetry']){_0xa03b78=ut[_0xca2d('0xca')](_0x2e7a30,0xf,'Global');rpcDb[_0xca2d('0x90')](_0xa03b78,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x2e7a30[_0xca2d('0xe7')]>=_0x299023[_0xca2d('0xe8')]){rpcDb[_0xca2d('0x90')](_0x2e7a30,_0xca2d('0xe6'));}else{rpcDb[_0xca2d('0xa8')](ut[_0xca2d('0xa9')](_0x2e7a30,_0xca2d('0xe4'),_0x299023['dialAbandonedRetryFrequency']),_0x2e7a30['unlockAgent'],_0x2e7a30[_0xca2d('0xaa')]);}}}else{_0x2e7a30[_0xca2d('0xcd')]++;_0x3d2370[_0xca2d('0xd5')]({'id':_0x2e7a30[_0xca2d('0xad')],'field':{'countnoanswerretry':_0x2e7a30[_0xca2d('0xcd')]}})[_0xca2d('0x7c')](function(){_0x3d2370[_0xca2d('0xae')](_0x2e7a30,_0x39727a,_0x3518fe)[_0xca2d('0x7c')](function(){});});}});break;case'18':_0x299023[_0xca2d('0xe9')]+=0x1;_0x2e7a30[_0xca2d('0xea')]+=0x1;_0x2e7a30['countglobal']=ut[_0xca2d('0xa4')](_0x2e7a30);ut['logCustomer'](_0x2e7a30,0x12,_0x1f1807['cause-txt']||_0x1f1807[_0xca2d('0xeb')]);ami['emit'](_0xca2d('0xec'),ut[_0xca2d('0x9e')](_0x2e7a30,'amd'));rpcDb[_0xca2d('0x8c')](_0x2e7a30,'[callProgressDetectingCustomer][hangupInAMD]');_0x3d2370[_0xca2d('0xc9')](_0x2e7a30,'18',_0x299023)[_0xca2d('0x7c')](function(_0x239ecd){_0x504bf9=_0x239ecd['additional']==0x1;if(!_0x504bf9){if(ut[_0xca2d('0xa4')](_0x2e7a30)>=_0x299023[_0xca2d('0xa5')]){_0xa03b78=ut['cloneAction'](_0x2e7a30,0x12,_0xca2d('0xa6'));rpcDb[_0xca2d('0x90')](_0xa03b78,_0xca2d('0xed'));}else{rpcDb[_0xca2d('0x90')](_0x2e7a30,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x2e7a30[_0xca2d('0xcd')]++;_0x3d2370[_0xca2d('0xd5')]({'id':_0x2e7a30[_0xca2d('0xad')],'field':{'countnoanswerretry':_0x2e7a30[_0xca2d('0xcd')]}})[_0xca2d('0x7c')](function(){_0x3d2370[_0xca2d('0xae')](_0x2e7a30,_0x39727a,_0x3518fe)[_0xca2d('0x7c')](function(){});});}});delete this[_0xca2d('0x19')][_0x1f1807[_0xca2d('0xab')]];break;case'19':_0x299023['outboundUnknownCallsDay']+=0x1;_0x2e7a30[_0xca2d('0x9c')]=ut[_0xca2d('0xa4')](_0x2e7a30);ut['logCustomer'](_0x2e7a30,0x13,_0x1f1807[_0xca2d('0xee')]||_0x1f1807[_0xca2d('0xeb')]);ami[_0xca2d('0x26')](_0xca2d('0xec'),ut['buildObj'](_0x2e7a30,_0xca2d('0xef')));rpcDb[_0xca2d('0x8c')](_0x2e7a30,_0xca2d('0xf0'));_0x3d2370[_0xca2d('0xc9')](_0x2e7a30,'18',_0x299023)['then'](function(_0x13cbbd){_0x504bf9=_0x13cbbd[_0xca2d('0xa1')]==0x1;if(!_0x504bf9){if(ut['totalGlobal'](_0x2e7a30)>=_0x299023[_0xca2d('0xa5')]){_0xa03b78=ut['cloneAction'](_0x2e7a30,0xf,_0xca2d('0xa6'));rpcDb[_0xca2d('0x90')](_0xa03b78,_0xca2d('0xf0'));}else{rpcDb['createCustomerFinal'](_0x2e7a30,_0xca2d('0xf0'));}}else{_0x2e7a30[_0xca2d('0xcd')]++;_0x3d2370['incrementPreviewCounters']({'id':_0x2e7a30[_0xca2d('0xad')],'field':{'countnoanswerretry':_0x2e7a30[_0xca2d('0xcd')]}})[_0xca2d('0x7c')](function(){_0x3d2370['swapAdditionalPhones'](_0x2e7a30,_0x39727a,_0x3518fe)[_0xca2d('0x7c')](function(){});});}});delete this[_0xca2d('0x19')][_0x1f1807[_0xca2d('0xab')]];break;default:if(_0x2e7a30[_0xca2d('0x77')]){ut['decrementTalkink'](_0x299023,_0xca2d('0xf1'));ut[_0xca2d('0x79')](_0xca2d('0xf2')+_0x299023['name'],_0x1f1807);}_0x299023[_0xca2d('0xe9')]+=0x1;_0x2e7a30[_0xca2d('0x9c')]=ut[_0xca2d('0xa4')](_0x2e7a30);ut[_0xca2d('0x87')](_0x2e7a30,0xc,_0x1f1807['cause-txt']||_0x1f1807[_0xca2d('0xeb')]);_0x39727a=_0x299023[_0xca2d('0xdd')];_0x3518fe=_0x299023[_0xca2d('0xa3')];rpcDb[_0xca2d('0x8c')](_0x2e7a30,'[callProgressDetectingCustomer][logUnknown]');_0x3d2370[_0xca2d('0xc9')](_0x2e7a30,'20',_0x299023)[_0xca2d('0x7c')](function(_0x1d1bf2){_0x504bf9=_0x1d1bf2['additional']==0x1;if(!_0x504bf9){if(ut[_0xca2d('0xa4')](_0x2e7a30)>=_0x299023[_0xca2d('0xa5')]){_0xa03b78=ut[_0xca2d('0xca')](_0x2e7a30,0xf,_0xca2d('0xa6'));rpcDb[_0xca2d('0x90')](_0xa03b78,_0xca2d('0xf3'));}else{rpcDb['createCustomerFinal'](_0x2e7a30,_0xca2d('0xf3'));}delete this['actions'][_0x1f1807[_0xca2d('0xab')]];}else{_0x3d2370[_0xca2d('0xae')](_0x2e7a30,_0x39727a,_0x3518fe)[_0xca2d('0x7c')](function(){});}});}if(!(_0x2e7a30[_0xca2d('0x77')]&&_0x5d492e==='16')){ut[_0xca2d('0x75')](_0x299023,_0xca2d('0xf4'));logger[_0xca2d('0x58')](_0xca2d('0xf5'),_0x2e7a30['uniqueid'],_0xca2d('0xb5'),_0x299023[_0xca2d('0x28')],_0xca2d('0x6c'),_0x299023['originated']);}if(_0x5d492e!==_0xca2d('0xaf')){delete this[_0xca2d('0x19')][_0x1f1807[_0xca2d('0xab')]];delete this['actions'][_0x1f1807[_0xca2d('0xf6')]];}}};Preview[_0xca2d('0x11')][_0xca2d('0xf7')]=function(_0x2570b9,_0x333598,_0x3b04ad){if(_[_0xca2d('0xf8')](_0x333598)&&'object'!==typeof _0x333598){return;}if(_[_0xca2d('0xf8')](_0x3b04ad)&&'object'!==typeof _0x3b04ad){return;}switch(_0x3b04ad['reason']){case'0':ut[_0xca2d('0xf9')](_0x2570b9,0x0,'NoSuchNumber');rpcDb[_0xca2d('0xfa')](_0x2570b9,_0xca2d('0xfb'));break;case'3':ut[_0xca2d('0xf9')](_0x2570b9,0x3,_0xca2d('0xce'));rpcDb['createAgentHistory'](_0x2570b9,_0xca2d('0xfc'));break;case'5':ut['logAgent'](_0x2570b9,0x5,_0xca2d('0xfd'));rpcDb[_0xca2d('0xfa')](_0x2570b9,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0xca2d('0xf9')](_0x2570b9,0x8,'Congestion');rpcDb[_0xca2d('0xfa')](_0x2570b9,_0xca2d('0xfe'));break;case'22':ut['logAgent'](_0x2570b9,0x16,'AnswerAGI');rpcDb[_0xca2d('0xfa')](_0x2570b9,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0xca2d('0xf9')](_0x2570b9,0xc,_0x3b04ad[_0xca2d('0xff')]);rpcDb[_0xca2d('0xfa')](_0x2570b9,_0xca2d('0xfe'));}ut['updateOriginated'](_0x333598,_0xca2d('0x100'));logger['info'](_0xca2d('0x101'),_0x2570b9[_0xca2d('0xb4')],_0xca2d('0xb5'),_0x333598['name'],_0xca2d('0x6c'),_0x333598['originated']);delete this[_0xca2d('0x19')][_0x2570b9[_0xca2d('0xb4')]];};Preview['prototype'][_0xca2d('0xc9')]=function(_0x371b5e,_0x2b0573,_0x3eccbf){return Promise['resolve']()[_0xca2d('0x7c')](cmHopperAdditionalPhone[_0xca2d('0xc9')](_0x371b5e,_0x2b0573,_0x3eccbf))[_0xca2d('0x74')](logger[_0xca2d('0x58')](_0xca2d('0x102')));};Preview[_0xca2d('0x11')][_0xca2d('0xae')]=function(_0x45c1d1,_0x5393e8,_0x297a9e){return Promise[_0xca2d('0x103')]()[_0xca2d('0x7c')](cmHopperAdditionalPhone[_0xca2d('0xae')](_0x45c1d1,_0x5393e8,_0x297a9e))[_0xca2d('0x74')](logger[_0xca2d('0x58')](_0xca2d('0x104')));};Preview[_0xca2d('0x11')]['incrementPreviewCounters']=function(_0x399fc9){return Promise[_0xca2d('0x103')]()[_0xca2d('0x7c')](cmHopperAdditionalPhone[_0xca2d('0xd5')](_0x399fc9))[_0xca2d('0x74')](logger['info'](_0xca2d('0x105')));};Preview[_0xca2d('0x11')]['checkInBlack']=function(_0x4c3830,_0x5af568,_0x4e6dd6,_0x1e83fc,_0x519501){var _0x19c540=this;return new Promise(function(_0x147a78,_0x3977a6){if(_['isNil'](_0x5af568)||_['isNil'](_0x5af568['Contact'])||_['isNil'](_0x5af568[_0xca2d('0x106')])||_[_0xca2d('0x7d')](_0x5af568[_0xca2d('0x70')])){_0x3977a6(ut['message'](_0xca2d('0x107'),_0x1e83fc,_0x519501));return;}var _0x205c61=uuid['v4']();var _0x55703f=_0x19c540['campaignsPreview'][_0x5af568[_0xca2d('0x6a')][_0xca2d('0x28')]];var _0x3b73b5=_0x4e6dd6?_0x19c540[_0xca2d('0x1a')][_0x4e6dd6]['id']:undefined;_0x19c540[_0xca2d('0x19')][_0x205c61]=new Action(_0x5af568,_0x55703f,_0x205c61,_0x4e6dd6,_0x3b73b5);var _0x32a21e=_0x19c540[_0xca2d('0x19')][_0x205c61];_0x32a21e[_0xca2d('0xd4')]=_0x1e83fc;_0x32a21e[_0xca2d('0xaa')]=_0x519501;_0x32a21e['lookAgent']=_0x4e6dd6;if(_[_0xca2d('0x108')](_0x4c3830)){_0x19c540['execCall'](_0x32a21e,_0x55703f,_0x5af568,_0x4e6dd6)[_0xca2d('0x7c')](function(_0x322739){logger['info']('[Preview][execCall][success]',_0xca2d('0x109')+_0x32a21e['queue']+_0xca2d('0x10a')+_0x32a21e['idContact'],JSON['stringify'](_0x322739));ami['emit'](_0xca2d('0x10b'),ut['buildObj'](_0x32a21e,'called',_0x19c540[_0xca2d('0x16')][_0x32a21e[_0xca2d('0x6b')]]));_0x147a78(ut[_0xca2d('0x4c')](_0xca2d('0x10c')));})[_0xca2d('0x74')](function(_0x416e09){ut[_0xca2d('0x10d')](_0xca2d('0x10e'),_0x416e09);_0x3977a6(ut[_0xca2d('0x4c')](_0xca2d('0x10f'),_0x1e83fc,_0x519501));});}else{_0x55703f[_0xca2d('0x3b')]+=0x1;ut['logBlacklist'](_0x32a21e);rpcDb[_0xca2d('0x110')](_0x32a21e,_0xca2d('0x111'));delete _0x19c540[_0xca2d('0x19')][_0x205c61];_0x3977a6(ut['message'](_0xca2d('0x112'),_0x1e83fc,_0x519501));}});};Preview[_0xca2d('0x11')][_0xca2d('0x96')]=function(_0x14ce12){return!_[_0xca2d('0x7d')](_0x14ce12)&&!_['isNil'](_0x14ce12[_0xca2d('0x28')])&&!_[_0xca2d('0x7d')](_0x14ce12[_0xca2d('0x54')])&&_0x14ce12[_0xca2d('0x54')]&&!_[_0xca2d('0x7d')](this[_0xca2d('0x18')][util[_0xca2d('0x113')](_0xca2d('0x114'),_0x14ce12[_0xca2d('0x28')])])&&!_[_0xca2d('0x7d')](this['trunks'][util[_0xca2d('0x113')](_0xca2d('0x114'),_0x14ce12['name'])][_0xca2d('0x73')])&&(this[_0xca2d('0x18')][util[_0xca2d('0x113')](_0xca2d('0x114'),_0x14ce12['name'])]['status']===_0xca2d('0x115')||this[_0xca2d('0x18')][util['format']('SIP/%s',_0x14ce12[_0xca2d('0x28')])]['status']===_0xca2d('0x116'));};Preview[_0xca2d('0x11')][_0xca2d('0x83')]=function(_0x4ea96c,_0x375eef){var _0x37e2aa=this;return new Promise(function(_0x4d1654,_0x56c04a){_0x37e2aa[_0xca2d('0x117')](_0x4ea96c,_0x375eef)[_0xca2d('0x7c')](function(_0x134144){_0x4d1654(_[_0xca2d('0x6e')](_0x134144,[_0xca2d('0x4c')]));})['catch'](function(_0x48bb66){if(_0x48bb66[_0xca2d('0x118')]){rpcDb[_0xca2d('0x119')](_0x4ea96c);}if(_0x48bb66[_0xca2d('0x54')]){rpcDb[_0xca2d('0x86')](_0x4ea96c);}_0x56c04a(_[_0xca2d('0x6e')](_0x48bb66,['message']));});});};Preview['prototype']['execRun']=function(_0x3bb74f,_0x4874a5){var _0x1b53fc=this;return new Promise(function(_0x5cf6a4,_0x1014db){var _0x4e0b62,_0xd790e9;rpcDb['getContactPreview'](_0x3bb74f)[_0xca2d('0x7c')](function(_0x16dbe0){if(!_[_0xca2d('0x7d')](_0x16dbe0[0x0])){_0xd790e9=_0x16dbe0[0x0][_0xca2d('0x11a')]?![]:!![];_0x4e0b62=_0x16dbe0[0x0][_0xca2d('0x11a')]?!![]:![];_0x4e0b62=_0x4874a5?!![]:_0x4e0b62;}var _0x2cd833=_0x1b53fc[_0xca2d('0x11b')](_0x16dbe0);if(_0x2cd833['isValid']){rpcDb[_0xca2d('0x11c')](_[_0xca2d('0x6e')](_0x16dbe0[0x0],[_0xca2d('0x70'),'phone']))[_0xca2d('0x7c')](function(_0x6532b0){_0x1b53fc[_0xca2d('0x11d')](_0x6532b0,_0x16dbe0[0x0],_0x4874a5,_0xd790e9,_0x4e0b62)[_0xca2d('0x7c')](function(_0x103338){_0x5cf6a4(_0x103338);})[_0xca2d('0x74')](function(_0x4d6c18){_0x1014db(_0x4d6c18);});})[_0xca2d('0x74')](function(_0x38e914){ut['logger'](_0xca2d('0x11e'),_0x38e914);_0x1014db(ut[_0xca2d('0x4c')](_0xca2d('0x11f'),_0xd790e9,_0x4e0b62));});}else{_0x1014db(ut['message'](_0x2cd833['message'],_0xd790e9,_0x4e0b62));}})[_0xca2d('0x74')](function(_0x250f2d){ut[_0xca2d('0x10d')](_0xca2d('0x120'),_0x250f2d);_0x1014db(ut[_0xca2d('0x4c')](_0xca2d('0x11f'),![],!![]));});});};Preview[_0xca2d('0x11')]['validateContact']=function(_0x134405){if(_[_0xca2d('0x7d')](_0x134405)||_[_0xca2d('0x108')](_0x134405)||!_[_0xca2d('0x7d')](_0x134405[0x0]['Agent'])&&_[_0xca2d('0x7d')](_0x134405[0x0][_0xca2d('0x81')]['name'])){ut[_0xca2d('0x10d')](_0xca2d('0x121'),_0x134405);return{'isValid':![],'message':_0xca2d('0x122')};}var _0x582eeb=this[_0xca2d('0x16')][_0x134405[0x0]['Queue'][_0xca2d('0x28')]];_0x582eeb[_0xca2d('0x4c')]=_0xca2d('0x99');if(_['isNil'](_0x582eeb)){ut[_0xca2d('0x10d')](_0xca2d('0x123'),_0x582eeb);return{'isValid':![],'message':_0xca2d('0x124')};}if(!this[_0xca2d('0x96')](_0x582eeb['Trunk'])){ut[_0xca2d('0x10d')](_0xca2d('0x125'),'campaign\x20Name:\x20'+_0x582eeb[_0xca2d('0x28')]+_0xca2d('0x126'));if(!this['isTrunkReachable'](_0x582eeb[_0xca2d('0x97')])){ut['logger'](_0xca2d('0x125'),_0x582eeb['name']+_0xca2d('0x127'));return{'isValid':![],'message':_0xca2d('0x128')};}}if(!ut[_0xca2d('0x94')](_0x582eeb[_0xca2d('0x95')])){ut['logger']('[Preview][validateContact][Campaign\x20Active]',_0x582eeb['name']+_0xca2d('0x129'));return{'isValid':![],'message':_0xca2d('0x12a')+_0x582eeb[_0xca2d('0x28')]+_0xca2d('0x129')};}return{'isValid':!![],'message':_0xca2d('0x12b')};};Preview[_0xca2d('0x11')][_0xca2d('0x12c')]=function(_0x4e58cd,_0x5352de,_0x439b27,_0x8da44d){var _0x4c27c4=this;return new Promise(function(_0x15e607,_0x3f54da){var _0xc038b7=_0x4e58cd[_0xca2d('0xb4')];var _0x28145b=_0x4c27c4['isTrunkReachable'](_0x5352de['Trunk'])?util['format'](_0xca2d('0x12d'),_0x5352de[_0xca2d('0x53')]['name'],_[_0xca2d('0x7d')](_0x5352de[_0xca2d('0x38')])?'':_0x5352de[_0xca2d('0x38')]['trim']()||'',_0x5352de[_0xca2d('0x12e')]>0x0?_0x439b27[_0xca2d('0x106')][_0xca2d('0x12f')](_0x5352de['dialCutDigit']):_0x439b27['phone']):util[_0xca2d('0x113')](_0xca2d('0x12d'),_[_0xca2d('0x7d')](_0x5352de[_0xca2d('0x97')])?_0x5352de['Trunk'][_0xca2d('0x28')]:_0x5352de[_0xca2d('0x97')][_0xca2d('0x28')],_[_0xca2d('0x7d')](_0x5352de['dialPrefix'])?'':_0x5352de[_0xca2d('0x38')][_0xca2d('0x130')]()||'',_0x5352de[_0xca2d('0x12e')]>0x0?_0x439b27['phone']['substring'](_0x5352de[_0xca2d('0x12e')]):_0x439b27[_0xca2d('0x106')]);var _0x2151bd=_0x4c27c4['isTrunkReachable'](_0x5352de['Trunk'])?ut[_0xca2d('0x131')](_0x5352de[_0xca2d('0x53')][_0xca2d('0x132')],_0x5352de['dialOriginateCallerIdName'],_0x5352de[_0xca2d('0x133')]>0x0?ut[_0xca2d('0x134')](_0x5352de[_0xca2d('0x135')],_0x5352de['dialRandomLastDigitCallerIdNumber']):_0x5352de['dialOriginateCallerIdNumber']):ut['getCallerId'](_[_0xca2d('0x7d')](_0x5352de[_0xca2d('0x97')])?_0x5352de[_0xca2d('0x53')][_0xca2d('0x132')]:_0x5352de[_0xca2d('0x97')][_0xca2d('0x132')],_0x5352de[_0xca2d('0x37')],_0x5352de[_0xca2d('0x133')]>0x0?ut['getCallerIdRandom'](_0x5352de[_0xca2d('0x135')],_0x5352de[_0xca2d('0x133')]):_0x5352de[_0xca2d('0x135')]);if(_0x2151bd){_0x4e58cd['originatecalleridname']=ut[_0xca2d('0x136')](_0x2151bd);_0x4e58cd[_0xca2d('0x137')]=ut['extractCalleridNumber'](_0x2151bd);}var _0x358e30=ut['addVariables'](_0x5352de,_0x439b27,_0x28145b,_0x2151bd,_0xc038b7,_0x4e58cd);_[_0xca2d('0x138')](_0x4e58cd,ut[_0xca2d('0x139')](_0x358e30));_0x4e58cd[_0xca2d('0x13a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5352de[_0xca2d('0x13b')]=_0x358e30;ami[_0xca2d('0x72')](ut[_0xca2d('0x13c')](_0x4e58cd,_0x5352de,_0x358e30,_0x4e58cd[_0xca2d('0xaa')],_0x8da44d))[_0xca2d('0x7c')](function(_0x4a8afd){_0x5352de[_0xca2d('0x4d')]+=0x1;logger[_0xca2d('0x58')](_0xca2d('0x13d'),_0xc038b7,'\x20Queue',_0x5352de[_0xca2d('0x28')],_0xca2d('0x6c'),_0x5352de[_0xca2d('0x4d')]);_0x15e607(_0x4a8afd);})[_0xca2d('0x74')](function(_0x395352){ut[_0xca2d('0xf9')](_0x4e58cd,0xe,'OriginateError');rpcDb['createAgentHistory'](_0x4e58cd,_0xca2d('0x13e'));_0x3f54da(_0x395352);});});};Preview[_0xca2d('0x11')][_0xca2d('0x21')]=function(_0x54943b){if(this[_0xca2d('0x19')][_0x54943b[_0xca2d('0xab')]]){this['actions'][_0x54943b[_0xca2d('0xab')]]['channel']=_0x54943b[_0xca2d('0x13f')];}};Preview[_0xca2d('0x11')]['syncOriginateResponse']=function(_0x32ab15){var _0xc983df=this;var _0x35e2cd=this[_0xca2d('0x19')][_0x32ab15[_0xca2d('0x140')]];if(_0x35e2cd){if(_0x35e2cd['lookAgent']&&this['agents'][_0x35e2cd[_0xca2d('0x141')]]){ut['logLookAgent'](_0x35e2cd,this[_0xca2d('0x1a')][_0x35e2cd[_0xca2d('0x141')]][_0xca2d('0x28')],this[_0xca2d('0x1a')][_0x35e2cd[_0xca2d('0x141')]]['id']);}var _0x2f818d=_[_0xca2d('0x142')](_0x35e2cd);_0x2f818d[_0xca2d('0xb1')]=moment()[_0xca2d('0x113')](_0xca2d('0xb0'));var _0x2abeb4=_0xc983df[_0xca2d('0x16')][_0x35e2cd['queue']];if(ut[_0xca2d('0x143')](_0x32ab15[_0xca2d('0x144')])){if(_0x35e2cd[_0xca2d('0xd4')]){rpcDb[_0xca2d('0x119')](_0x35e2cd[_0xca2d('0xad')]);}if(_0x35e2cd[_0xca2d('0xaa')]){rpcDb[_0xca2d('0x86')](_0x35e2cd['idContact']);}ami[_0xca2d('0x26')]('custom:agentringnoanswer',ut[_0xca2d('0x9e')](_0x35e2cd,_0xca2d('0x145'),this['campaignsPreview'][_0x35e2cd[_0xca2d('0x6b')]]));this[_0xca2d('0xf7')](_0x2f818d,_0x2abeb4,_0x32ab15);}else{_0x35e2cd[_0xca2d('0x13a')]=moment()['format'](_0xca2d('0xb0'));ut[_0xca2d('0xf9')](_0x2f818d,0x4,'Answer');rpcDb[_0xca2d('0xfa')](_0x2f818d,_0xca2d('0x146'));}}};Preview[_0xca2d('0x11')][_0xca2d('0x1e')]=function(_0xac9b24){var _0x2103df=this['actions'][_0xac9b24[_0xca2d('0xab')]];var _0x511a92;if(_0x2103df){_0x511a92=this[_0xca2d('0x16')][_0x2103df[_0xca2d('0x6b')]];logger[_0xca2d('0x58')]('[syncHangup][talking]',_0xac9b24[_0xca2d('0xab')],_0xca2d('0xb5'),_0x511a92[_0xca2d('0x28')],_0xca2d('0xc3'),_0x511a92[_0xca2d('0x2d')]);}if(this['actions'][_0xac9b24[_0xca2d('0xab')]]&&_0xac9b24['linkedid']!==_0xac9b24['uniqueid']){if(_0xac9b24['cause']==='16'&&this[_0xca2d('0x19')][_0xac9b24['linkedid']]['dialAnswer']){this[_0xca2d('0x147')](_0xac9b24,_0xac9b24['linkedid'],_0xac9b24[_0xca2d('0x148')]);}else if(this['actions'][_0xac9b24['linkedid']]['dialAnswer']){logger[_0xca2d('0x58')](_0xca2d('0x149'),_0xac9b24[_0xca2d('0xab')],_0xac9b24['cause'],_0xca2d('0xb5'),_0x511a92[_0xca2d('0x28')],'pTalking:\x20',_0x511a92[_0xca2d('0x2d')]);this[_0xca2d('0x147')](_0xac9b24,_0xac9b24['linkedid'],_0xac9b24[_0xca2d('0x148')]);}}else if(_0x2103df&&_[_0xca2d('0x7d')](_0x2103df[_0xca2d('0x14a')])&&_0x511a92[_0xca2d('0x14b')]&&_0xac9b24[_0xca2d('0xab')]===_0xac9b24[_0xca2d('0xb4')]&&_[_0xca2d('0x7d')](_0xac9b24[_0xca2d('0xff')])&&_0xac9b24[_0xca2d('0x148')]==='16'&&_0xac9b24[_0xca2d('0x14c')]==='6'&&_[_0xca2d('0xf8')](_0x2103df[_0xca2d('0x14d')])){if(_0x2103df[_0xca2d('0xd4')]){rpcDb[_0xca2d('0x119')](_0x2103df[_0xca2d('0xad')]);}if(_0x2103df[_0xca2d('0xaa')]){rpcDb[_0xca2d('0x86')](_0x2103df[_0xca2d('0xad')]);}_0xac9b24[_0xca2d('0xff')]='22';this[_0xca2d('0xf7')](_0x2103df,_0x511a92,_0xac9b24);}else if(_0x2103df&&_0x2103df[_0xca2d('0x14d')]){if(_0xac9b24[_0xca2d('0x148')]==='16'&&this['actions'][_0xac9b24['linkedid']][_0xca2d('0x77')]){logger[_0xca2d('0x58')](_0xca2d('0x14e'),_0xac9b24[_0xca2d('0xab')],_0xac9b24[_0xca2d('0x148')],_0xca2d('0xb5'),_0x511a92[_0xca2d('0x28')],'pTalking:\x20',_0x511a92[_0xca2d('0x2d')]);this[_0xca2d('0x147')](_0xac9b24,_0xac9b24[_0xca2d('0xab')],_0xac9b24['cause']);}else if(this[_0xca2d('0x19')][_0xac9b24[_0xca2d('0xab')]]['dialAnswer']){logger[_0xca2d('0x58')](_0xca2d('0x149'),_0xac9b24[_0xca2d('0xab')],_0xac9b24['cause'],'\x20Queue',_0x511a92['name'],_0xca2d('0xc3'),_0x511a92[_0xca2d('0x2d')]);this[_0xca2d('0x147')](_0xac9b24,_0xac9b24[_0xca2d('0xab')],_0xac9b24[_0xca2d('0x148')]);}}};Preview[_0xca2d('0x11')][_0xca2d('0x20')]=function(_0x1b16f8){if(this[_0xca2d('0x19')][_0x1b16f8['destlinkedid']]&&_0x1b16f8[_0xca2d('0xf6')]!==_0x1b16f8[_0xca2d('0x14f')]){this['callProgressDetectingCustomer'](_0x1b16f8,_0x1b16f8[_0xca2d('0xf6')],_0x1b16f8[_0xca2d('0xeb')]);}};Preview[_0xca2d('0x11')][_0xca2d('0x150')]=function(_0x5d4154){if(this[_0xca2d('0x19')][_0x5d4154['linkedid']]&&_0x5d4154[_0xca2d('0xab')]!==_0x5d4154[_0xca2d('0xb4')]&&!this[_0xca2d('0x19')][_0x5d4154[_0xca2d('0xab')]]['dialAnswer']){if(_0x5d4154[_0xca2d('0x148')]==='1'){this[_0xca2d('0x147')](_0x5d4154,_0x5d4154[_0xca2d('0xab')],_0x5d4154[_0xca2d('0x148')]);}}};Preview[_0xca2d('0x11')]['addVariable']=function(_0x25eb61,_0x1db24d,_0x35d6e8){if(this[_0xca2d('0x19')][_0x25eb61]){if(_['isNil'](this['actions'][_0x25eb61][_0xca2d('0x13b')])){this[_0xca2d('0x19')][_0x25eb61]['variables']={};}this[_0xca2d('0x19')][_0x25eb61][_0xca2d('0x13b')][_0x1db24d]=_0x35d6e8;}};Preview[_0xca2d('0x11')]['syncVarSet']=function(_0x3c9dd0){try{if(!_['isNil'](_0x3c9dd0)){if(ut[_0xca2d('0x151')](_[_0xca2d('0x152')](_0x3c9dd0[_0xca2d('0x153')])[0x0])){this[_0xca2d('0x154')](_0x3c9dd0['uniqueid'],_[_0xca2d('0x152')](_0x3c9dd0[_0xca2d('0x153')])[0x0],_0x3c9dd0['value']);}}}catch(_0x425ebb){logger[_0xca2d('0x155')](_0xca2d('0x156'),util['inspect'](_0x425ebb,{'showHidden':![],'depth':null}));}};Preview[_0xca2d('0x11')]['syncAttendedTransfer']=function(_0x56945f){if(_0x56945f){if(this['actions'][_0x56945f['transfertargetlinkedid']]){this[_0xca2d('0x19')][_0x56945f[_0xca2d('0x157')]][_0xca2d('0x14d')]=!![];}}};Preview[_0xca2d('0x11')][_0xca2d('0x158')]=function(_0x35d24e){if(_0x35d24e){if(this[_0xca2d('0x19')][_0x35d24e[_0xca2d('0x159')]]){this[_0xca2d('0x19')][_0x35d24e[_0xca2d('0x159')]][_0xca2d('0x14d')]=!![];}}};module[_0xca2d('0x15a')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index a899ad3..3a4438e 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 _0x4061=['calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','connectedlinename','membername','context','exten','holdtime','assigned','lastAssignedTo','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','inspect','then','createHistory','resolve','[createHistory]\x20','moveContactManagedDialer','catch','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid'];(function(_0x4706a6,_0x5a1c63){var _0x1bb705=function(_0x484ebb){while(--_0x484ebb){_0x4706a6['push'](_0x4706a6['shift']());}};_0x1bb705(++_0x5a1c63);}(_0x4061,0xf9));var _0x1406=function(_0x298c85,_0x1c06e0){_0x298c85=_0x298c85-0x0;var _0x58664f=_0x4061[_0x298c85];return _0x58664f;};'use strict';var util=require(_0x1406('0x0'));var BPromise=require(_0x1406('0x1'));var logger=require(_0x1406('0x2'))(_0x1406('0x3'));var _=require(_0x1406('0x4'));var cmHopper=require(_0x1406('0x5'));var cmHopperFinal=require(_0x1406('0x6'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x1406('0x7'));var voiceQueueRt=require(_0x1406('0x8'));var agentReportPreview=require(_0x1406('0x9'));var voiceQueueReport=require(_0x1406('0xa'));function loggerCatch(_0x23914e){return function(_0x4beac9){logger['error'](_0x23914e,util[_0x1406('0xb')](_0x4beac9,{'showHidden':![],'depth':null}));};}function create(_0x4f7346){return BPromise['resolve']()[_0x1406('0xc')](cmHopperHistory[_0x1406('0xd')](_0x4f7346))['catch'](loggerCatch('[createHistory]\x20'));}function createAgent(_0xc8df72){return BPromise[_0x1406('0xe')]()[_0x1406('0xc')](agentReportPreview['createHistory'](_0xc8df72))['catch'](loggerCatch(_0x1406('0xf')));}function moveContact(_0x2dd52c){return BPromise[_0x1406('0xe')]()[_0x1406('0xc')](cmHopper[_0x1406('0x10')](_0x2dd52c,!![]))[_0x1406('0x11')](loggerCatch(_0x1406('0x12')));}exports[_0x1406('0x13')]=function(_0x18c75c){return BPromise[_0x1406('0xe')]()[_0x1406('0xc')](cmHopperBlack[_0x1406('0x13')](_0x18c75c))['catch'](loggerCatch(_0x1406('0x14')));};exports[_0x1406('0x15')]=function(_0x2f142d){return BPromise[_0x1406('0xe')]()[_0x1406('0xc')](cmHopper[_0x1406('0x15')](_0x2f142d))[_0x1406('0x11')](loggerCatch(_0x1406('0x16')));};exports[_0x1406('0xd')]=function(_0x271c37,_0x1ad31f){create(_0x271c37)['catch'](loggerCatch(_0x1ad31f));moveContact(_0x271c37)[_0x1406('0x11')](loggerCatch(_0x1ad31f));};exports['createAgentHistory']=function(_0x1efb3d,_0x232643){createAgent(_0x1efb3d)[_0x1406('0x11')](loggerCatch(_0x232643));};exports[_0x1406('0x17')]=function(_0x32d671,_0x18a356){create(_0x32d671)[_0x1406('0x11')](loggerCatch(_0x18a356));};exports[_0x1406('0x18')]=function(_0x3941c6,_0x48c8cc){moveContact(_0x3941c6)[_0x1406('0x11')](loggerCatch(_0x48c8cc));};exports[_0x1406('0x19')]=function(_0x24ca91,_0x18feb3,_0x166aaa){if(_0x18feb3){_0x24ca91[_0x1406('0x1a')]=null;}if(_0x166aaa){_0x24ca91[_0x1406('0x1b')]=![];}return BPromise[_0x1406('0xe')]()[_0x1406('0xc')](cmHopper['rescheduleContact'](_0x24ca91))[_0x1406('0x11')](loggerCatch(_0x1406('0x1c')));};exports[_0x1406('0x1d')]=function(_0x28d607){return BPromise[_0x1406('0xe')]()[_0x1406('0xc')](cmHopper[_0x1406('0x1d')](_0x28d607))[_0x1406('0x11')](loggerCatch(_0x1406('0x1e')));};exports[_0x1406('0x1f')]=function(_0x214d45){return BPromise[_0x1406('0xe')]()['then'](cmHopper[_0x1406('0x1f')]({'UserId':null},_0x214d45,0x1))['catch'](loggerCatch('[unlockContact]\x20'));};exports['disableContact']=function(_0x4dae19){return BPromise[_0x1406('0xe')]()[_0x1406('0xc')](cmHopper['unlockContact']({'active':![]},_0x4dae19,0x1))[_0x1406('0x11')](loggerCatch(_0x1406('0x20')));};exports[_0x1406('0x21')]=function(_0x3c854e){var _0x4930f0={};_0x4930f0['type']=_0x3c854e[_0x1406('0x22')];_0x4930f0[_0x1406('0x23')]=_0x3c854e[_0x1406('0x23')];_0x4930f0[_0x1406('0x24')]=_0x3c854e['calleridnum'];_0x4930f0['calleridname']=_0x3c854e[_0x1406('0x25')];_0x4930f0['queue']=_0x3c854e[_0x1406('0x26')];_0x4930f0[_0x1406('0x27')]=_0x3c854e['answertime'];_0x4930f0[_0x1406('0x28')]=_0x3c854e['answertime'];_0x4930f0[_0x1406('0x29')]=0x1;_0x4930f0[_0x1406('0x2a')]=_0x3c854e['endtime'];_0x4930f0[_0x1406('0x2b')]=_0x3c854e[_0x1406('0x2c')];_0x4930f0[_0x1406('0x2d')]='from-sip';_0x4930f0[_0x1406('0x2e')]='xcally-motion-preview';_0x4930f0[_0x1406('0x2f')]=0x0;_0x4930f0[_0x1406('0x30')]=0x1;_0x4930f0[_0x1406('0x31')]=_0x3c854e[_0x1406('0x2c')];_0x4930f0[_0x1406('0x32')]='COMPLETED';return BPromise['resolve']()['then'](voiceQueueReport[_0x1406('0x33')](_0x4930f0))[_0x1406('0x11')](loggerCatch(_0x1406('0x34')));};exports['getContactRecallMe']=function(_0x4694b8,_0x1c92ba){return BPromise['resolve']()[_0x1406('0xc')](cmHopper[_0x1406('0x35')](_0x4694b8,_0x1c92ba))[_0x1406('0x11')](loggerCatch(_0x1406('0x36')));};exports[_0x1406('0x37')]=function(_0x2b09e8){return BPromise[_0x1406('0xe')]()[_0x1406('0xc')](cmHopper[_0x1406('0x19')](_0x2b09e8,!![],!![]))[_0x1406('0x11')](loggerCatch(_0x1406('0x38')));}; \ No newline at end of file +var _0xc16c=['uniqueid','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','membername','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','../../../config/logger','preview','lodash','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','type'];(function(_0x12206d,_0x2eb8d9){var _0x333042=function(_0x345e6a){while(--_0x345e6a){_0x12206d['push'](_0x12206d['shift']());}};_0x333042(++_0x2eb8d9);}(_0xc16c,0xbf));var _0xcc16=function(_0x54655b,_0x2dcd1d){_0x54655b=_0x54655b-0x0;var _0x44e2d7=_0xc16c[_0x54655b];return _0x44e2d7;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0xcc16('0x0'))(_0xcc16('0x1'));var _=require(_0xcc16('0x2'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0xcc16('0x3'));var cmHopperHistory=require(_0xcc16('0x4'));var cmHopperBlack=require(_0xcc16('0x5'));var voiceQueueRt=require(_0xcc16('0x6'));var agentReportPreview=require(_0xcc16('0x7'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x334c2e){return function(_0x7b616b){logger[_0xcc16('0x8')](_0x334c2e,util[_0xcc16('0x9')](_0x7b616b,{'showHidden':![],'depth':null}));};}function create(_0x359ee2){return BPromise[_0xcc16('0xa')]()[_0xcc16('0xb')](cmHopperHistory[_0xcc16('0xc')](_0x359ee2))[_0xcc16('0xd')](loggerCatch(_0xcc16('0xe')));}function createAgent(_0x26139f){return BPromise[_0xcc16('0xa')]()['then'](agentReportPreview[_0xcc16('0xc')](_0x26139f))[_0xcc16('0xd')](loggerCatch(_0xcc16('0xe')));}function moveContact(_0x1c08c4){return BPromise[_0xcc16('0xa')]()[_0xcc16('0xb')](cmHopper[_0xcc16('0xf')](_0x1c08c4,!![]))[_0xcc16('0xd')](loggerCatch(_0xcc16('0x10')));}exports[_0xcc16('0x11')]=function(_0x2e9b8a){return BPromise[_0xcc16('0xa')]()[_0xcc16('0xb')](cmHopperBlack[_0xcc16('0x11')](_0x2e9b8a))[_0xcc16('0xd')](loggerCatch(_0xcc16('0x12')));};exports[_0xcc16('0x13')]=function(_0x43b604){return BPromise[_0xcc16('0xa')]()[_0xcc16('0xb')](cmHopper['getContactPreview'](_0x43b604))[_0xcc16('0xd')](loggerCatch(_0xcc16('0x14')));};exports[_0xcc16('0xc')]=function(_0x3f6c45,_0x192a91){create(_0x3f6c45)[_0xcc16('0xd')](loggerCatch(_0x192a91));moveContact(_0x3f6c45)[_0xcc16('0xd')](loggerCatch(_0x192a91));};exports[_0xcc16('0x15')]=function(_0x2dffc4,_0x5b6af2){createAgent(_0x2dffc4)[_0xcc16('0xd')](loggerCatch(_0x5b6af2));};exports[_0xcc16('0x16')]=function(_0x3c2757,_0xa961f6){create(_0x3c2757)[_0xcc16('0xd')](loggerCatch(_0xa961f6));};exports[_0xcc16('0x17')]=function(_0x1d1069,_0x1a8b37){moveContact(_0x1d1069)[_0xcc16('0xd')](loggerCatch(_0x1a8b37));};exports[_0xcc16('0x18')]=function(_0x32adb1,_0x474f20,_0x5bb970){if(_0x474f20){_0x32adb1[_0xcc16('0x19')]=null;}if(_0x5bb970){_0x32adb1['active']=![];}return BPromise[_0xcc16('0xa')]()['then'](cmHopper['rescheduleContact'](_0x32adb1))[_0xcc16('0xd')](loggerCatch(_0xcc16('0x1a')));};exports[_0xcc16('0x1b')]=function(_0x533af7){return BPromise['resolve']()[_0xcc16('0xb')](cmHopper[_0xcc16('0x1b')](_0x533af7))[_0xcc16('0xd')](loggerCatch(_0xcc16('0x1c')));};exports[_0xcc16('0x1d')]=function(_0x459fda){return BPromise['resolve']()[_0xcc16('0xb')](cmHopper[_0xcc16('0x1d')]({'UserId':null},_0x459fda,0x1))[_0xcc16('0xd')](loggerCatch(_0xcc16('0x1e')));};exports[_0xcc16('0x1f')]=function(_0x4d7c5){return BPromise['resolve']()['then'](cmHopper[_0xcc16('0x1d')]({'active':![]},_0x4d7c5,0x1))[_0xcc16('0xd')](loggerCatch('[activeContact]\x20'));};exports['crateCustomerReportQueue']=function(_0x3f96c8){var _0x61f375={};_0x61f375[_0xcc16('0x20')]=_0x3f96c8[_0xcc16('0x20')];_0x61f375[_0xcc16('0x21')]=_0x3f96c8['uniqueid'];_0x61f375['calleridnum']=_0x3f96c8['calleridnum'];_0x61f375[_0xcc16('0x22')]=_0x3f96c8[_0xcc16('0x22')];_0x61f375['queue']=_0x3f96c8[_0xcc16('0x23')];_0x61f375[_0xcc16('0x24')]=_0x3f96c8[_0xcc16('0x25')];_0x61f375['queuecallerleaveAt']=_0x3f96c8[_0xcc16('0x25')];_0x61f375[_0xcc16('0x26')]=0x1;_0x61f375[_0xcc16('0x27')]=_0x3f96c8[_0xcc16('0x28')];_0x61f375['connectedlinename']=_0x3f96c8[_0xcc16('0x29')];_0x61f375['context']=_0xcc16('0x2a');_0x61f375[_0xcc16('0x2b')]=_0xcc16('0x2c');_0x61f375[_0xcc16('0x2d')]=0x0;_0x61f375[_0xcc16('0x2e')]=0x1;_0x61f375[_0xcc16('0x2f')]=_0x3f96c8[_0xcc16('0x29')];_0x61f375[_0xcc16('0x30')]=_0xcc16('0x31');return BPromise[_0xcc16('0xa')]()[_0xcc16('0xb')](voiceQueueReport[_0xcc16('0x32')](_0x61f375))[_0xcc16('0xd')](loggerCatch(_0xcc16('0x33')));};exports[_0xcc16('0x34')]=function(_0x232f9d,_0x2f63fc){return BPromise[_0xcc16('0xa')]()[_0xcc16('0xb')](cmHopper[_0xcc16('0x34')](_0x232f9d,_0x2f63fc))[_0xcc16('0xd')](loggerCatch(_0xcc16('0x35')));};exports[_0xcc16('0x36')]=function(_0x4b4943){return BPromise[_0xcc16('0xa')]()[_0xcc16('0xb')](cmHopper[_0xcc16('0x18')](_0x4b4943,!![],!![]))[_0xcc16('0xd')](loggerCatch(_0xcc16('0x37')));}; \ 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 16c7bf0..8eb594f 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 _0xfc87=['error','info','inspect','logger2','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','toLower','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','responsetime','logAgent','ringtime','logLookAgent','membername','logCustomer','endtime','starttime','talktime','answertime','isFailure','Failure','variablesAction','calleridname','BOOKED','uniqueid','originate','channelAgent','calleridnum','xcally-motion-preview','from-sip','timeout','totalGlobal','countnoanswerretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','lastevent','queue','motionChannel','voice','mandatoryDisposition','buildObj','buildAcw','interface','agentReadyId','not_inuse','status','push','getDiff','createBody','CampaignId','filterKey','idContact','type','campaigntype','active','scheduledat','countbusyretry','countcongestionretry','countglobal','callback','callbackuniqueid','callbackat','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialtimeout','xmd-dialid','xmd-contactid','xmd-cdrtype','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosbridged','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','replace','match','extractCalleridNumber','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','util','../../../../config/logger','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch'];(function(_0x4f8d17,_0x44ee85){var _0x145a7e=function(_0x54d3b3){while(--_0x54d3b3){_0x4f8d17['push'](_0x4f8d17['shift']());}};_0x145a7e(++_0x44ee85);}(_0xfc87,0x1a5));var _0x7fc8=function(_0x322b22,_0x2da3f1){_0x322b22=_0x322b22-0x0;var _0x21abc7=_0xfc87[_0x322b22];return _0x21abc7;};'use strict';var util=require(_0x7fc8('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0x7fc8('0x1'))('preview');var ipAgi=process['env'][_0x7fc8('0x2')]||_0x7fc8('0x3');function getSeconds(_0x4e6c01,_0x3e50c8){var _0x13bc31=moment(_0x4e6c01)[_0x7fc8('0x4')](0x0);var _0x42d507=moment(_0x3e50c8)[_0x7fc8('0x4')](0x0);return _0x13bc31[_0x7fc8('0x5')](_0x42d507,_0x7fc8('0x6'));}exports[_0x7fc8('0x7')]=function(_0x2ded73){return function(_0x455d09){logger[_0x7fc8('0x8')](_0x2ded73,util['inspect'](_0x455d09,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x5f3a8f,_0x5d42c3){logger[_0x7fc8('0x9')](_0x5f3a8f,util[_0x7fc8('0xa')](_0x5d42c3,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x2c35d8,_0x4d3153){logger[_0x7fc8('0x8')](_0x2c35d8,util['inspect'](_0x4d3153,{'showHidden':![],'depth':null}));};exports[_0x7fc8('0xb')]=function(_0x5a2aa8){return function(_0x114253){logger[_0x7fc8('0x9')](_0x5a2aa8,util['inspect'](_0x114253,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x57b764,_0x55814a,_0x3e7b66){return{'message':_0x57b764,'unlock':_0x55814a,'active':_0x3e7b66};};exports[_0x7fc8('0xc')]=function(_0x3459d6,_0x59485b,_0x381857){if(!_[_0x7fc8('0xd')](_0x381857)&&_0x7fc8('0xe')===typeof _0x381857&&!_[_0x7fc8('0xf')](_0x381857)){if(!_[_0x7fc8('0xd')](_0x59485b)&&_0x7fc8('0xe')===typeof _0x59485b&&!_[_0x7fc8('0xf')](_0x59485b)){return util['format'](_0x7fc8('0x10'),_0x59485b,_0x381857);}return util[_0x7fc8('0x11')](_0x7fc8('0x10'),_0x381857,_0x381857);}if(!_[_0x7fc8('0xd')](_0x3459d6)&&_0x7fc8('0xe')===typeof _0x3459d6&&!_[_0x7fc8('0xf')](_0x3459d6)){return _0x3459d6;}return _0x7fc8('0x12');};exports[_0x7fc8('0x13')]=function(_0x2f596e){if(_[_0x7fc8('0x14')](_0x2f596e)){return![];}return _0x2f596e;};exports[_0x7fc8('0x15')]=function(_0x5c236f,_0x57bc07,_0x26bee5,_0x4f898,_0x1a4a1f,_0x40c6fb){var _0x3c0a38={'XMD-QUEUE':_0x57bc07[_0x7fc8('0x16')]?_0x57bc07[_0x7fc8('0x16')][_0x7fc8('0x17')]:'','XMD-CALLERID':_0x4f898,'XMD-CALLERID-PREVIEW':_0x40c6fb?util[_0x7fc8('0x11')]('\x22%s\x22\x20<%s>',_0x40c6fb['calleridname'],_0x40c6fb['calleridnum']):_0x4f898,'XMD-DIALID':_0x1a4a1f,'XMD-CONTACTID':_0x57bc07[_0x7fc8('0x18')],'XMD-CDRTYPE':_0x7fc8('0x19'),'CALLERID(all)':_0x4f898,'XMD-VOICEQUEUEID':_0x57bc07[_0x7fc8('0x1a')],'XMD-DIALCHANNEL':_0x26bee5,'XMD-DIALTIMEOUT':_0x5c236f[_0x7fc8('0x1b')]||0x1e,'XMD-DIALOPTIONS':util[_0x7fc8('0x11')](_0x7fc8('0x1c'),_0x5c236f[_0x7fc8('0x1d')]?'g':'',_[_0x7fc8('0xf')](_0x5c236f[_0x7fc8('0x1e')])?'':_0x7fc8('0x1f')),'XMD-DIALURL':_0x5c236f[_0x7fc8('0x20')]||'','XMD-AGI':_0x5c236f[_0x7fc8('0x21')]?util['format'](_0x7fc8('0x22'),ipAgi,_0x5c236f[_0x7fc8('0x21')]):'NONE','XMD-AGIAFTER':_0x5c236f[_0x7fc8('0x1d')]?util[_0x7fc8('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5c236f[_0x7fc8('0x1d')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x40c6fb?_0x40c6fb['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x40c6fb?_0x40c6fb[_0x7fc8('0x23')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x7fc8('0x24')};if(!_[_0x7fc8('0xf')](_0x5c236f['monitor_format'])){_0x3c0a38[util[_0x7fc8('0x11')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x5c236f[_0x7fc8('0x1e')];_0x3c0a38[util['format']('%s',_0x7fc8('0x25'))]=_0x1a4a1f;}if(_0x57bc07&&_0x57bc07[_0x7fc8('0x26')]){for(var _0x1eac77 in _0x57bc07['Contact']){if(_0x57bc07[_0x7fc8('0x26')][_0x7fc8('0x27')](_0x1eac77)){if(!_['isNil'](_0x57bc07['Contact'][_0x1eac77])&&_0x1eac77!=='id'&&_0x1eac77!==_0x7fc8('0x28')&&_0x1eac77!==_0x7fc8('0x29')&&_0x1eac77!==_0x7fc8('0x2a')){_0x3c0a38[util[_0x7fc8('0x11')](_0x7fc8('0x2b'),'XMD-',_['toUpper'](_0x1eac77))]=_0x57bc07[_0x7fc8('0x26')][_0x1eac77];}}}}return _0x3c0a38;};exports['toLowerVariables']=function(_0x4fe1d5){var _0x21ba94={};for(var _0x22c77a in _0x4fe1d5){if(_0x4fe1d5[_0x7fc8('0x27')](_0x22c77a)){_0x21ba94[util[_0x7fc8('0x11')]('%s',_[_0x7fc8('0x2c')](_0x22c77a))]=_0x4fe1d5[_0x22c77a];}}return{'variables':_0x21ba94};};exports[_0x7fc8('0x2d')]=function(_0x37253d,_0x59c6f9){if(!_['isNil'](_0x37253d)){if(_0x37253d[_0x7fc8('0x27')](_0x7fc8('0x2e'))){if(_0x37253d[_0x7fc8('0x2e')]>0x0){_0x37253d[_0x7fc8('0x2e')]-=0x1;}else{logger[_0x7fc8('0x8')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x59c6f9);}}}else{logger['error'](_0x7fc8('0x2f'),_0x59c6f9);}};exports['logBlacklist']=function(_0x418c0c){var _0x81d233=moment()[_0x7fc8('0x11')](_0x7fc8('0x30'));_0x418c0c[_0x7fc8('0x31')]=0xd;_0x418c0c[_0x7fc8('0x32')]='Blacklist';_0x418c0c['starttime']=_0x81d233;_0x418c0c[_0x7fc8('0x33')]=_0x81d233;_0x418c0c['endtime']=_0x81d233;};exports[_0x7fc8('0x34')]=function(_0x4a4bdb,_0x59c3f4,_0x378110){var _0x4357c7=moment()[_0x7fc8('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x4a4bdb['state']=_0x59c3f4;_0x4a4bdb['statedesc']=_0x378110;_0x4a4bdb[_0x7fc8('0x33')]=_0x4357c7;_0x4a4bdb[_0x7fc8('0x35')]=getSeconds(_0x4a4bdb[_0x7fc8('0x33')],_0x4a4bdb['starttime']);};exports[_0x7fc8('0x36')]=function(_0xc94aef,_0x1fd30d,_0x3af2ab){_0xc94aef[_0x7fc8('0x37')]=_0x1fd30d;_0xc94aef['UserId']=_0x3af2ab;};exports[_0x7fc8('0x38')]=function(_0x50b5e0,_0x55557e,_0x34b960){var _0xe1c6d2=moment()['format'](_0x7fc8('0x30'));_0x50b5e0[_0x7fc8('0x31')]=_0x55557e;_0x50b5e0[_0x7fc8('0x32')]=_0x34b960;_0x50b5e0[_0x7fc8('0x33')]=_0x50b5e0[_0x7fc8('0x33')]?_0x50b5e0[_0x7fc8('0x33')]:_0xe1c6d2;_0x50b5e0[_0x7fc8('0x39')]=_0x50b5e0[_0x7fc8('0x39')]?_0x50b5e0[_0x7fc8('0x39')]:_0xe1c6d2;_0x50b5e0['ringtime']=getSeconds(_0x50b5e0[_0x7fc8('0x33')]||0x0,_0x50b5e0[_0x7fc8('0x3a')]||0x0);_0x50b5e0[_0x7fc8('0x3b')]=_0x50b5e0['answertime']?getSeconds(_0x50b5e0['endtime'],_0x50b5e0[_0x7fc8('0x3c')]):0x0;};exports[_0x7fc8('0x3d')]=function(_0x20ed52){return _0x20ed52===_0x7fc8('0x3e');};exports[_0x7fc8('0x3f')]=function(_0x20bb38,_0x26243f,_0x363242,_0x1b5a3c,_0xc538d1){var _0x847da8=_0x1b5a3c?'RECALL':_0x20bb38[_0x7fc8('0x40')];_0x847da8=_0xc538d1?_0x7fc8('0x41'):_0x847da8;return{'actionid':_0x20bb38[_0x7fc8('0x42')],'action':_0x7fc8('0x43'),'channel':_0x20bb38[_0x7fc8('0x44')],'callerid':util['format'](_0x7fc8('0x10'),_0x847da8,_0x20bb38[_0x7fc8('0x45')]),'Exten':_0x7fc8('0x46'),'Context':_0x7fc8('0x47'),'Priority':'1','variable':_0x363242,'timeout':(_0x26243f[_0x7fc8('0x48')]||0x1e)*0x3e8,'async':!![],'channelid':_0x20bb38[_0x7fc8('0x42')]};};exports[_0x7fc8('0x49')]=function(_0x36e83b){return _0x36e83b['countbusyretry']+_0x36e83b['countcongestionretry']+_0x36e83b[_0x7fc8('0x4a')]+_0x36e83b['countagentrejectretry']+_0x36e83b[_0x7fc8('0x4b')];};exports[_0x7fc8('0x4c')]=function(_0x5425ac){var _0x96a32a=_[_0x7fc8('0x4d')](_0x5425ac);_0x96a32a['state']=0xf;_0x96a32a['statedesc']=_0x7fc8('0x4e');return _0x96a32a;};exports[_0x7fc8('0x4f')]=function(_0x406c9c,_0x2812e0,_0xb981ce){var _0x4e981e={};_0x4e981e[_0x2812e0]=_0x406c9c[_0x2812e0];_0x4e981e['active']=![];_0x4e981e['scheduledat']=moment()[_0x7fc8('0x50')](_0xb981ce,_0x7fc8('0x51'))[_0x7fc8('0x11')](_0x7fc8('0x30'));_0x4e981e['ContactId']=_0x406c9c['ContactId'];_0x4e981e[_0x7fc8('0x52')]=_0x406c9c['ListId'];_0x4e981e[_0x7fc8('0x1a')]=_0x406c9c['VoiceQueueId']||undefined;return _0x4e981e;};exports[_0x7fc8('0x53')]=function(_0x14419d,_0x4361f7){if(!_[_0x7fc8('0x14')](_0x14419d)){if(_0x14419d[_0x7fc8('0x54')]>0x0){_0x14419d[_0x7fc8('0x54')]-=0x1;}else{logger[_0x7fc8('0x8')](_0x4361f7,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x7fc8('0x8')](_0x4361f7,_0x7fc8('0x55'));}};exports['IsNotLoggedIn']=function(_0x151f23){if(_0x151f23<=0x0){return!![];}return![];};function buildObj(_0x45a280,_0x51829e,_0x451df5){_0x45a280[_0x7fc8('0x56')]=_0x51829e;_0x45a280[_0x7fc8('0x17')]=_0x45a280[_0x7fc8('0x57')];_0x45a280['interface']=_0x45a280[_0x7fc8('0x44')];_0x45a280[_0x7fc8('0x58')]=_0x7fc8('0x59');if(_0x451df5){_0x45a280[_0x7fc8('0x5a')]=_0x451df5[_0x7fc8('0x5a')];}return _0x45a280;}exports[_0x7fc8('0x5b')]=buildObj;exports[_0x7fc8('0x5c')]=function(_0x125760){var _0x1e144a={};_0x1e144a[_0x7fc8('0x57')]=_0x125760['queue'];_0x1e144a[_0x7fc8('0x5d')]=_0x125760[_0x7fc8('0x44')];_0x1e144a[_0x7fc8('0x42')]=_0x125760[_0x7fc8('0x42')];return _0x1e144a;};exports[_0x7fc8('0x5e')]=function(_0x251a45){var _0x1bee29=[];for(var _0x4f0aff in _0x251a45){if(_0x251a45['hasOwnProperty'](_0x4f0aff)){if(!_[_0x7fc8('0x14')](_0x251a45[_0x4f0aff])&&_0x251a45[_0x4f0aff]['state']===_0x7fc8('0x5f')&&_0x251a45[_0x4f0aff][_0x7fc8('0x60')]==='reachable'){_0x1bee29[_0x7fc8('0x61')](_0x251a45[_0x4f0aff]['id']);}}}return _0x1bee29;};exports[_0x7fc8('0x62')]=function(_0x3a3867){var _0x281f13=moment()[_0x7fc8('0x4')](0x0);var _0x2de989=moment(_0x3a3867)[_0x7fc8('0x4')](0x0);return _0x281f13[_0x7fc8('0x5')](_0x2de989,_0x7fc8('0x6'));};exports[_0x7fc8('0x63')]=function(_0x3ce27b){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3ce27b[_0x7fc8('0x18')],'ListId':_0x3ce27b[_0x7fc8('0x52')],'VoiceQueueId':_0x3ce27b[_0x7fc8('0x1a')]||undefined,'CampaignId':_0x3ce27b[_0x7fc8('0x64')]||undefined};};exports[_0x7fc8('0x65')]=function(_0x358c7f){if(_0x358c7f==='uniqueid'||_0x358c7f===_0x7fc8('0x66')||_0x358c7f==='queue'||_0x358c7f===_0x7fc8('0x67')||_0x358c7f===_0x7fc8('0x68')||_0x358c7f==='dialAnswer'||_0x358c7f===_0x7fc8('0x37')||_0x358c7f===_0x7fc8('0x44')||_0x358c7f===_0x7fc8('0x40')||_0x358c7f===_0x7fc8('0x69')||_0x358c7f==='calleridnum'||_0x358c7f===_0x7fc8('0x6a')||_0x358c7f===_0x7fc8('0x6b')||_0x358c7f===_0x7fc8('0x6c')||_0x358c7f===_0x7fc8('0x4a')||_0x358c7f===_0x7fc8('0x6d')||_0x358c7f===_0x7fc8('0x6e')||_0x358c7f===_0x7fc8('0x6f')||_0x358c7f===_0x7fc8('0x70')||_0x358c7f===_0x7fc8('0x71')||_0x358c7f===_0x7fc8('0x18')||_0x358c7f==='ListId'||_0x358c7f===_0x7fc8('0x72')||_0x358c7f===_0x7fc8('0x1a')||_0x358c7f===_0x7fc8('0x73')||_0x358c7f===_0x7fc8('0x74')||_0x358c7f===_0x7fc8('0x75')||_0x358c7f===_0x7fc8('0x76')||_0x358c7f===_0x7fc8('0x77')||_0x358c7f==='xmd-dialurl'||_0x358c7f===_0x7fc8('0x78')||_0x358c7f==='xmd-dialoptions'||_0x358c7f===_0x7fc8('0x79')||_0x358c7f==='xmd-dialchannel'||_0x358c7f===_0x7fc8('0x7a')||_0x358c7f===_0x7fc8('0x7b')||_0x358c7f==='xmd-callerid'||_0x358c7f==='xmd-agiafter'||_0x358c7f==='xmd-agi'||_0x358c7f==='rtpaudioqos'||_0x358c7f==='rtpaudioqosbridged'||_0x358c7f===_0x7fc8('0x7c')||_0x358c7f===_0x7fc8('0x7d')||_0x358c7f===_0x7fc8('0x7e')||_0x358c7f===_0x7fc8('0x7f')||_0x358c7f===_0x7fc8('0x80')||_0x358c7f===_0x7fc8('0x81')||_0x358c7f==='rtpaudioqos'||_0x358c7f===_0x7fc8('0x82')||_0x358c7f===_0x7fc8('0x7c')||_0x358c7f===_0x7fc8('0x7d')||_0x358c7f===_0x7fc8('0x7e')||_0x358c7f===_0x7fc8('0x7f')||_0x358c7f==='rtpaudioqosrtt'||_0x358c7f===_0x7fc8('0x81')||_0x358c7f===_0x7fc8('0x83')||_0x358c7f===_0x7fc8('0x84')||_0x358c7f===_0x7fc8('0x31')||_0x358c7f===_0x7fc8('0x32')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x2a318b,_0x2bb02a){var _0x189a34,_0x59e2a1,_0x487a32;if(_0x2bb02a<=0x0){_0x2bb02a=0x1;}_0x189a34=new RegExp(_0x7fc8('0x85')+_0x2bb02a+'}$');_0x59e2a1=Math['pow'](0xa,_0x2bb02a-0x1);_0x487a32=Math[_0x7fc8('0x86')](0xa,_0x2bb02a)-0x1;return util['format']('%s',_[_0x7fc8('0x87')](_0x2a318b,_0x189a34,_['random'](_0x59e2a1,_0x487a32)));};exports['extractCalleridName']=function(_0x200750){var _0x37f342=_0x200750[_0x7fc8('0x88')](/"(.*?)"/);return _0x37f342?_0x37f342[0x1]:_0x200750;};exports[_0x7fc8('0x89')]=function(_0x5e41e3){var _0x39b353=_0x5e41e3[_0x7fc8('0x88')](/<(.*?)>/);return _0x39b353?_0x39b353[0x1]:_0x5e41e3;};function buildNoAnswerEventPayload(_0x136f4d,_0x3ea69e){var _0x111d7b=buildObj(_0x136f4d,'noanswer');if(!_[_0x7fc8('0xf')](_0x3ea69e[_0x7fc8('0x8a')])){Object[_0x7fc8('0x8b')](_0x3ea69e['variables'])[_0x7fc8('0x8c')](function(_0x373ded){_0x111d7b[_0x373ded[_0x7fc8('0x8d')]()]=_0x3ea69e[_0x7fc8('0x8a')][_0x373ded];});}return _0x111d7b;}exports[_0x7fc8('0x8e')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x533a=['getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','%s%s','XMD-','toUpper','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','state','statedesc','Blacklist','starttime','responsetime','logAgent','logLookAgent','membername','UserId','logCustomer','YYYY-MM-DD\x20HH:mm:ss','endtime','ringtime','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','mandatoryDisposition','buildObj','interface','agentReadyId','status','getDiff','seconds','createBody','filterKey','idContact','type','campaigntype','dialAnswer','scheduledat','countglobal','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqosrtt','bridgepeer','getCallerIdRandom','\x5cw{0,','replace','random','match','extractCalleridNumber','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','util','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','milliseconds','loggerCatch','error','info','loggerError','inspect','logger2','message'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x533a,0x1af));var _0xa533=function(_0x427502,_0x4e6214){_0x427502=_0x427502-0x0;var _0x1baeff=_0x533a[_0x427502];return _0x1baeff;};'use strict';var util=require(_0xa533('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0xa533('0x1'))(_0xa533('0x2'));var ipAgi=process['env'][_0xa533('0x3')]||_0xa533('0x4');function getSeconds(_0x58977e,_0x475063){var _0x29c453=moment(_0x58977e)[_0xa533('0x5')](0x0);var _0x5ec240=moment(_0x475063)[_0xa533('0x5')](0x0);return _0x29c453['diff'](_0x5ec240,'seconds');}exports[_0xa533('0x6')]=function(_0x51b64f){return function(_0xceba26){logger[_0xa533('0x7')](_0x51b64f,util['inspect'](_0xceba26,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x573c32,_0x45e0fa){logger[_0xa533('0x8')](_0x573c32,util['inspect'](_0x45e0fa,{'showHidden':![],'depth':null}));};exports[_0xa533('0x9')]=function(_0xe03235,_0x1e96b1){logger[_0xa533('0x7')](_0xe03235,util[_0xa533('0xa')](_0x1e96b1,{'showHidden':![],'depth':null}));};exports[_0xa533('0xb')]=function(_0x1c1e66){return function(_0x44f89e){logger[_0xa533('0x8')](_0x1c1e66,util[_0xa533('0xa')](_0x44f89e,{'showHidden':![],'depth':null}));};};exports[_0xa533('0xc')]=function(_0x50f4a3,_0x341596,_0x502dcc){return{'message':_0x50f4a3,'unlock':_0x341596,'active':_0x502dcc};};exports[_0xa533('0xd')]=function(_0x309816,_0x134f12,_0x26eecc){if(!_[_0xa533('0xe')](_0x26eecc)&&_0xa533('0xf')===typeof _0x26eecc&&!_[_0xa533('0x10')](_0x26eecc)){if(!_[_0xa533('0xe')](_0x134f12)&&_0xa533('0xf')===typeof _0x134f12&&!_['isEmpty'](_0x134f12)){return util[_0xa533('0x11')](_0xa533('0x12'),_0x134f12,_0x26eecc);}return util[_0xa533('0x11')](_0xa533('0x12'),_0x26eecc,_0x26eecc);}if(!_[_0xa533('0xe')](_0x309816)&&_0xa533('0xf')===typeof _0x309816&&!_[_0xa533('0x10')](_0x309816)){return _0x309816;}return _0xa533('0x13');};exports[_0xa533('0x14')]=function(_0x23586f){if(_[_0xa533('0x15')](_0x23586f)){return![];}return _0x23586f;};exports[_0xa533('0x16')]=function(_0x183f0a,_0x3915ac,_0xcbe5a5,_0xe8103f,_0x562e22,_0x16fed0){var _0x4913d3={'XMD-QUEUE':_0x3915ac[_0xa533('0x17')]?_0x3915ac[_0xa533('0x17')][_0xa533('0x18')]:'','XMD-CALLERID':_0xe8103f,'XMD-CALLERID-PREVIEW':_0x16fed0?util[_0xa533('0x11')]('\x22%s\x22\x20<%s>',_0x16fed0[_0xa533('0x19')],_0x16fed0[_0xa533('0x1a')]):_0xe8103f,'XMD-DIALID':_0x562e22,'XMD-CONTACTID':_0x3915ac[_0xa533('0x1b')],'XMD-CDRTYPE':_0xa533('0x1c'),'CALLERID(all)':_0xe8103f,'XMD-VOICEQUEUEID':_0x3915ac[_0xa533('0x1d')],'XMD-DIALCHANNEL':_0xcbe5a5,'XMD-DIALTIMEOUT':_0x183f0a[_0xa533('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0xa533('0x11')](_0xa533('0x1f'),_0x183f0a['dialQueueProject2']?'g':'',_[_0xa533('0x10')](_0x183f0a[_0xa533('0x20')])?'':_0xa533('0x21')),'XMD-DIALURL':_0x183f0a[_0xa533('0x22')]||'','XMD-AGI':_0x183f0a[_0xa533('0x23')]?util[_0xa533('0x11')](_0xa533('0x24'),ipAgi,_0x183f0a[_0xa533('0x23')]):_0xa533('0x25'),'XMD-AGIAFTER':_0x183f0a[_0xa533('0x26')]?util[_0xa533('0x11')](_0xa533('0x24'),ipAgi,_0x183f0a[_0xa533('0x26')]):_0xa533('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x16fed0?_0x16fed0[_0xa533('0x27')]:'','XMD-ORIGINATECALLERIDNAME':_0x16fed0?_0x16fed0[_0xa533('0x28')]:'','XMD-DESTINATION':_0xa533('0x29'),'SIPADDHEADER':_0xa533('0x2a')};if(!_[_0xa533('0x10')](_0x183f0a['monitor_format'])){_0x4913d3[util[_0xa533('0x11')]('%s',_0xa533('0x2b'))]=_0x183f0a[_0xa533('0x20')];_0x4913d3[util[_0xa533('0x11')]('%s',_0xa533('0x2c'))]=_0x562e22;}if(_0x3915ac&&_0x3915ac[_0xa533('0x2d')]){for(var _0x5ae9c4 in _0x3915ac[_0xa533('0x2d')]){if(_0x3915ac[_0xa533('0x2d')][_0xa533('0x2e')](_0x5ae9c4)){if(!_[_0xa533('0x15')](_0x3915ac['Contact'][_0x5ae9c4])&&_0x5ae9c4!=='id'&&_0x5ae9c4!==_0xa533('0x2f')&&_0x5ae9c4!=='createdAt'&&_0x5ae9c4!=='updatedAt'){_0x4913d3[util['format'](_0xa533('0x30'),_0xa533('0x31'),_[_0xa533('0x32')](_0x5ae9c4))]=_0x3915ac['Contact'][_0x5ae9c4];}}}}return _0x4913d3;};exports['toLowerVariables']=function(_0x14f37c){var _0x390bc7={};for(var _0x3db7d6 in _0x14f37c){if(_0x14f37c[_0xa533('0x2e')](_0x3db7d6)){_0x390bc7[util[_0xa533('0x11')]('%s',_[_0xa533('0x33')](_0x3db7d6))]=_0x14f37c[_0x3db7d6];}}return{'variables':_0x390bc7};};exports[_0xa533('0x34')]=function(_0x2b2d58,_0x3e87e9){if(!_[_0xa533('0x15')](_0x2b2d58)){if(_0x2b2d58[_0xa533('0x2e')](_0xa533('0x35'))){if(_0x2b2d58[_0xa533('0x35')]>0x0){_0x2b2d58[_0xa533('0x35')]-=0x1;}else{logger['error'](_0xa533('0x36'),_0x3e87e9);}}}else{logger[_0xa533('0x7')](_0xa533('0x37'),_0x3e87e9);}};exports['logBlacklist']=function(_0x59aa5e){var _0x1f4299=moment()[_0xa533('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x59aa5e[_0xa533('0x38')]=0xd;_0x59aa5e[_0xa533('0x39')]=_0xa533('0x3a');_0x59aa5e[_0xa533('0x3b')]=_0x1f4299;_0x59aa5e[_0xa533('0x3c')]=_0x1f4299;_0x59aa5e['endtime']=_0x1f4299;};exports[_0xa533('0x3d')]=function(_0x58d9f1,_0x3733f6,_0x416556){var _0x2e50ee=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x58d9f1[_0xa533('0x38')]=_0x3733f6;_0x58d9f1['statedesc']=_0x416556;_0x58d9f1[_0xa533('0x3c')]=_0x2e50ee;_0x58d9f1['ringtime']=getSeconds(_0x58d9f1[_0xa533('0x3c')],_0x58d9f1['starttime']);};exports[_0xa533('0x3e')]=function(_0x34878f,_0x3c4a1a,_0x4a692f){_0x34878f[_0xa533('0x3f')]=_0x3c4a1a;_0x34878f[_0xa533('0x40')]=_0x4a692f;};exports[_0xa533('0x41')]=function(_0x57cd8c,_0x153a88,_0x20153a){var _0x9bbaf8=moment()[_0xa533('0x11')](_0xa533('0x42'));_0x57cd8c[_0xa533('0x38')]=_0x153a88;_0x57cd8c['statedesc']=_0x20153a;_0x57cd8c[_0xa533('0x3c')]=_0x57cd8c['responsetime']?_0x57cd8c[_0xa533('0x3c')]:_0x9bbaf8;_0x57cd8c['endtime']=_0x57cd8c[_0xa533('0x43')]?_0x57cd8c['endtime']:_0x9bbaf8;_0x57cd8c[_0xa533('0x44')]=getSeconds(_0x57cd8c[_0xa533('0x3c')]||0x0,_0x57cd8c[_0xa533('0x3b')]||0x0);_0x57cd8c[_0xa533('0x45')]=_0x57cd8c[_0xa533('0x46')]?getSeconds(_0x57cd8c[_0xa533('0x43')],_0x57cd8c[_0xa533('0x46')]):0x0;};exports[_0xa533('0x47')]=function(_0x4b36f2){return _0x4b36f2===_0xa533('0x48');};exports[_0xa533('0x49')]=function(_0x6234e8,_0x145853,_0x1ec228,_0x487d1d,_0x25528f){var _0x404e77=_0x487d1d?_0xa533('0x4a'):_0x6234e8[_0xa533('0x19')];_0x404e77=_0x25528f?_0xa533('0x4b'):_0x404e77;return{'actionid':_0x6234e8[_0xa533('0x4c')],'action':_0xa533('0x4d'),'channel':_0x6234e8[_0xa533('0x4e')],'callerid':util[_0xa533('0x11')](_0xa533('0x12'),_0x404e77,_0x6234e8[_0xa533('0x1a')]),'Exten':_0xa533('0x29'),'Context':_0xa533('0x4f'),'Priority':'1','variable':_0x1ec228,'timeout':(_0x145853[_0xa533('0x50')]||0x1e)*0x3e8,'async':!![],'channelid':_0x6234e8[_0xa533('0x4c')]};};exports[_0xa533('0x51')]=function(_0x22ea9d){return _0x22ea9d[_0xa533('0x52')]+_0x22ea9d[_0xa533('0x53')]+_0x22ea9d[_0xa533('0x54')]+_0x22ea9d[_0xa533('0x55')]+_0x22ea9d[_0xa533('0x56')];};exports[_0xa533('0x57')]=function(_0x48a4a7){var _0x4cc780=_[_0xa533('0x58')](_0x48a4a7);_0x4cc780['state']=0xf;_0x4cc780[_0xa533('0x39')]=_0xa533('0x59');return _0x4cc780;};exports[_0xa533('0x5a')]=function(_0x31b36c,_0x539b1e,_0x1c7589){var _0x1fcc32={};_0x1fcc32[_0x539b1e]=_0x31b36c[_0x539b1e];_0x1fcc32[_0xa533('0x5b')]=![];_0x1fcc32['scheduledat']=moment()['add'](_0x1c7589,'minutes')[_0xa533('0x11')](_0xa533('0x42'));_0x1fcc32[_0xa533('0x1b')]=_0x31b36c[_0xa533('0x1b')];_0x1fcc32[_0xa533('0x5c')]=_0x31b36c[_0xa533('0x5c')];_0x1fcc32[_0xa533('0x1d')]=_0x31b36c['VoiceQueueId']||undefined;return _0x1fcc32;};exports[_0xa533('0x5d')]=function(_0x4a12d8,_0x212768){if(!_['isNil'](_0x4a12d8)){if(_0x4a12d8['pTalking']>0x0){_0x4a12d8[_0xa533('0x5e')]-=0x1;}else{logger[_0xa533('0x7')](_0x212768,_0xa533('0x5f'));}}else{logger[_0xa533('0x7')](_0x212768,_0xa533('0x60'));}};exports[_0xa533('0x61')]=function(_0x412011){if(_0x412011<=0x0){return!![];}return![];};function buildObj(_0x469955,_0x1c8421,_0x219cf9){_0x469955[_0xa533('0x62')]=_0x1c8421;_0x469955[_0xa533('0x18')]=_0x469955[_0xa533('0x63')];_0x469955['interface']=_0x469955[_0xa533('0x4e')];_0x469955['motionChannel']='voice';if(_0x219cf9){_0x469955[_0xa533('0x64')]=_0x219cf9['mandatoryDisposition'];}return _0x469955;}exports[_0xa533('0x65')]=buildObj;exports['buildAcw']=function(_0x3aeacd){var _0x8a5c43={};_0x8a5c43[_0xa533('0x63')]=_0x3aeacd[_0xa533('0x63')];_0x8a5c43[_0xa533('0x66')]=_0x3aeacd[_0xa533('0x4e')];_0x8a5c43['uniqueid']=_0x3aeacd[_0xa533('0x4c')];return _0x8a5c43;};exports[_0xa533('0x67')]=function(_0x17bb19){var _0xd7316a=[];for(var _0x33027a in _0x17bb19){if(_0x17bb19['hasOwnProperty'](_0x33027a)){if(!_[_0xa533('0x15')](_0x17bb19[_0x33027a])&&_0x17bb19[_0x33027a][_0xa533('0x38')]==='not_inuse'&&_0x17bb19[_0x33027a][_0xa533('0x68')]==='reachable'){_0xd7316a['push'](_0x17bb19[_0x33027a]['id']);}}}return _0xd7316a;};exports[_0xa533('0x69')]=function(_0x48706b){var _0x52a67f=moment()[_0xa533('0x5')](0x0);var _0x52d11b=moment(_0x48706b)[_0xa533('0x5')](0x0);return _0x52a67f['diff'](_0x52d11b,_0xa533('0x6a'));};exports[_0xa533('0x6b')]=function(_0x1a1f90){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1a1f90[_0xa533('0x1b')],'ListId':_0x1a1f90[_0xa533('0x5c')],'VoiceQueueId':_0x1a1f90[_0xa533('0x1d')]||undefined,'CampaignId':_0x1a1f90['CampaignId']||undefined};};exports[_0xa533('0x6c')]=function(_0x41ba78){if(_0x41ba78===_0xa533('0x4c')||_0x41ba78===_0xa533('0x6d')||_0x41ba78==='queue'||_0x41ba78===_0xa533('0x6e')||_0x41ba78===_0xa533('0x6f')||_0x41ba78===_0xa533('0x70')||_0x41ba78==='membername'||_0x41ba78===_0xa533('0x4e')||_0x41ba78===_0xa533('0x19')||_0x41ba78===_0xa533('0x5b')||_0x41ba78===_0xa533('0x1a')||_0x41ba78===_0xa533('0x71')||_0x41ba78===_0xa533('0x52')||_0x41ba78==='countcongestionretry'||_0x41ba78==='countnoanswerretry'||_0x41ba78===_0xa533('0x72')||_0x41ba78==='callback'||_0x41ba78==='callbackuniqueid'||_0x41ba78===_0xa533('0x73')||_0x41ba78===_0xa533('0x74')||_0x41ba78==='ContactId'||_0x41ba78===_0xa533('0x5c')||_0x41ba78===_0xa533('0x40')||_0x41ba78==='VoiceQueueId'||_0x41ba78===_0xa533('0x75')||_0x41ba78===_0xa533('0x76')||_0x41ba78===_0xa533('0x77')||_0x41ba78==='xmd-phone'||_0x41ba78==='xmd-listid'||_0x41ba78===_0xa533('0x78')||_0x41ba78===_0xa533('0x79')||_0x41ba78===_0xa533('0x7a')||_0x41ba78==='xmd-dialid'||_0x41ba78===_0xa533('0x7b')||_0x41ba78===_0xa533('0x7c')||_0x41ba78===_0xa533('0x7d')||_0x41ba78===_0xa533('0x7e')||_0x41ba78==='xmd-agiafter'||_0x41ba78===_0xa533('0x7f')||_0x41ba78==='rtpaudioqos'||_0x41ba78===_0xa533('0x80')||_0x41ba78===_0xa533('0x81')||_0x41ba78==='rtpaudioqosjitterbridged'||_0x41ba78===_0xa533('0x82')||_0x41ba78===_0xa533('0x83')||_0x41ba78==='rtpaudioqosrtt'||_0x41ba78===_0xa533('0x84')||_0x41ba78===_0xa533('0x85')||_0x41ba78==='rtpaudioqosbridged'||_0x41ba78===_0xa533('0x81')||_0x41ba78===_0xa533('0x86')||_0x41ba78==='rtpaudioqosloss'||_0x41ba78===_0xa533('0x83')||_0x41ba78===_0xa533('0x87')||_0x41ba78===_0xa533('0x84')||_0x41ba78===_0xa533('0x88')||_0x41ba78==='bridgepvtcallid'||_0x41ba78===_0xa533('0x38')||_0x41ba78==='statedesc'){return![];}return!![];};exports[_0xa533('0x89')]=function(_0x58a7a1,_0x45d4ad){var _0x37e7d3,_0x26d2c9,_0x1b1b3a;if(_0x45d4ad<=0x0){_0x45d4ad=0x1;}_0x37e7d3=new RegExp(_0xa533('0x8a')+_0x45d4ad+'}$');_0x26d2c9=Math['pow'](0xa,_0x45d4ad-0x1);_0x1b1b3a=Math['pow'](0xa,_0x45d4ad)-0x1;return util[_0xa533('0x11')]('%s',_[_0xa533('0x8b')](_0x58a7a1,_0x37e7d3,_[_0xa533('0x8c')](_0x26d2c9,_0x1b1b3a)));};exports['extractCalleridName']=function(_0x56a963){var _0x39f233=_0x56a963[_0xa533('0x8d')](/"(.*?)"/);return _0x39f233?_0x39f233[0x1]:_0x56a963;};exports[_0xa533('0x8e')]=function(_0x429348){var _0x1a0c97=_0x429348['match'](/<(.*?)>/);return _0x1a0c97?_0x1a0c97[0x1]:_0x429348;};function buildNoAnswerEventPayload(_0x2f93ef,_0x5597e3){var _0x5d8956=buildObj(_0x2f93ef,'noanswer');if(!_[_0xa533('0x10')](_0x5597e3[_0xa533('0x8f')])){Object[_0xa533('0x90')](_0x5597e3[_0xa533('0x8f')])[_0xa533('0x91')](function(_0x162809){_0x5d8956[_0x162809[_0xa533('0x92')]()]=_0x5597e3[_0xa533('0x8f')][_0x162809];});}return _0x5d8956;}exports[_0xa533('0x93')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 0b30586..2aac1e7 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 _0xc853=['voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','string','number','boolean','queueremove','queuepause','reload','voicequeuechannel'];(function(_0x51f3a9,_0x3b05f4){var _0x58f1a2=function(_0x3d1229){while(--_0x3d1229){_0x51f3a9['push'](_0x51f3a9['shift']());}};_0x58f1a2(++_0x3b05f4);}(_0xc853,0x1e3));var _0x3c85=function(_0x2ef234,_0x1e2ee4){_0x2ef234=_0x2ef234-0x0;var _0x9e903a=_0xc853[_0x2ef234];return _0x9e903a;};'use strict';exports['queueadd']={'queue':{'type':_0x3c85('0x0'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0x3c85('0x0'),'required':!![]},'penalty':{'type':_0x3c85('0x1'),'required':![]},'paused':{'type':_0x3c85('0x2'),'required':![]}};exports[_0x3c85('0x3')]={'queue':{'type':_0x3c85('0x0'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0x3c85('0x4')]={'interface':{'type':_0x3c85('0x0'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':'string','required':![]}};exports[_0x3c85('0x5')]={'module':{'type':_0x3c85('0x0'),'required':![]}};exports[_0x3c85('0x6')]={'uniqueid':{'type':_0x3c85('0x0'),'required':!![]}};exports[_0x3c85('0x7')]={'uniqueid':{'type':_0x3c85('0x0'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0x3c85('0x0')},'mixmonitorid':{'type':_0x3c85('0x0')}};exports[_0x3c85('0x8')]={'uniqueid':{'type':_0x3c85('0x0'),'required':!![]}};exports[_0x3c85('0x9')]={'uniqueid':{'type':_0x3c85('0x0'),'required':!![]},'exten':{'type':_0x3c85('0x0'),'required':!![]},'context':{'type':_0x3c85('0x0')}}; \ No newline at end of file +var _0x8c10=['voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean'];(function(_0x58a4fe,_0x11d439){var _0x697de2=function(_0xe38c14){while(--_0xe38c14){_0x58a4fe['push'](_0x58a4fe['shift']());}};_0x697de2(++_0x11d439);}(_0x8c10,0x13e));var _0x08c1=function(_0x947701,_0x730c37){_0x947701=_0x947701-0x0;var _0x4a39d9=_0x8c10[_0x947701];return _0x4a39d9;};'use strict';exports[_0x08c1('0x0')]={'queue':{'type':_0x08c1('0x1'),'required':!![]},'interface':{'type':_0x08c1('0x1'),'required':!![]},'membername':{'type':_0x08c1('0x1'),'required':!![]},'penalty':{'type':_0x08c1('0x2'),'required':![]},'paused':{'type':_0x08c1('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x08c1('0x1'),'required':!![]},'interface':{'type':_0x08c1('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':'string','required':!![]},'paused':{'type':_0x08c1('0x3')},'reason':{'type':'string','required':![]}};exports['reload']={'module':{'type':_0x08c1('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x08c1('0x1'),'required':!![]}};exports[_0x08c1('0x4')]={'uniqueid':{'type':_0x08c1('0x1'),'required':!![]},'filename':{'type':_0x08c1('0x1')},'format':{'type':_0x08c1('0x1')},'mixmonitorid':{'type':_0x08c1('0x1')}};exports[_0x08c1('0x5')]={'uniqueid':{'type':_0x08c1('0x1'),'required':!![]}};exports[_0x08c1('0x6')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x08c1('0x1'),'required':!![]},'context':{'type':_0x08c1('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 64ce3e3..ee91823 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 _0x0967=['initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initDynamics365Accounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','diff','queuecallerjoinAt','seconds','queuecallerexitAt','queuecallercompleteAt','queuecallerleaveAt','initVoiceCallReports','outbound','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','util','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/faxAccount','agents','telephones','triggers','campaigns','templates','channels','queueChannels','timers','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','format','SIP/%s','name','hasOwnProperty','mapKeys','isNil','sumHoldTime','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','answered','unmanaged','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','interface','isUndefined','initTelephones','initTrunks','trunks','voiceQueues','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts'];(function(_0x341daa,_0x49b18d){var _0x4758cb=function(_0x361ec4){while(--_0x361ec4){_0x341daa['push'](_0x341daa['shift']());}};_0x4758cb(++_0x49b18d);}(_0x0967,0x100));var _0x7096=function(_0x181386,_0xa4e277){_0x181386=_0x181386-0x0;var _0x6cb43e=_0x0967[_0x181386];return _0x6cb43e;};'use strict';var util=require(_0x7096('0x0'));var _=require('lodash');var moment=require(_0x7096('0x1'));var Agent=require(_0x7096('0x2'));var Telephone=require(_0x7096('0x3'));var Trunk=require(_0x7096('0x4'));var VoiceQueue=require(_0x7096('0x5'));var Trigger=require(_0x7096('0x6'));var Template=require(_0x7096('0x7'));var Campaign=require(_0x7096('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x7096('0x9'));var SalesforceAccount=require(_0x7096('0xa'));var FreshdeskAccount=require(_0x7096('0xb'));var SugarcrmAccount=require(_0x7096('0xc'));var ZohoAccount=require(_0x7096('0xd'));var DeskAccount=require(_0x7096('0xe'));var VtigerAccount=require(_0x7096('0xf'));var ServicenowAccount=require(_0x7096('0x10'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x7096('0x11'));var Realtime=function(){this[_0x7096('0x12')]={};this[_0x7096('0x13')]={};this['trunks']={};this['voiceQueues']={};this[_0x7096('0x14')]={};this[_0x7096('0x15')]={};this[_0x7096('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x7096('0x17')]={};this[_0x7096('0x18')]={};this['outboundChannels']={};this[_0x7096('0x19')]={};this['settings']={};this[_0x7096('0x1a')]={};this[_0x7096('0x1b')]={};this['sugarcrmAccounts']={};this[_0x7096('0x1c')]={};this[_0x7096('0x1d')]={};this[_0x7096('0x1e')]={};this[_0x7096('0x1f')]={};this[_0x7096('0x20')]={};this[_0x7096('0x21')]={};this['freshsalesAccounts']={};this[_0x7096('0x22')]={};};function freeIsNotKey(_0x2c02ce,_0x138d7d,_0x41cf08){var _0x1e8514=_['mapKeys'](_0x2c02ce,function(_0x41bc1b,_0x36e23e){return _0x41bc1b[_0x41cf08];});for(var _0x1ff404 in _0x138d7d){if(_0x138d7d['hasOwnProperty'](_0x1ff404)){if(!_0x1e8514[_0x1ff404]){delete _0x138d7d[_0x1ff404];}}}}function freeIsNotKeySip(_0x5079e6,_0x15ca15){var _0x4a4cf8=_['mapKeys'](_0x5079e6,function(_0x4a0859,_0x1082be){return util[_0x7096('0x23')](_0x7096('0x24'),_0x4a0859[_0x7096('0x25')]);});for(var _0xbd59a9 in _0x15ca15){if(_0x15ca15[_0x7096('0x26')](_0xbd59a9)){if(!_0x4a4cf8[_0xbd59a9]){delete _0x15ca15[_0xbd59a9];}}}}function freeIsNotKeyAgent(_0x40b7d9,_0x248301){var _0x4b28bf=_[_0x7096('0x27')](_0x40b7d9,function(_0x13390a,_0x41db64){var _0x5ab797=_[_0x7096('0x28')](_0x13390a['interface'])?util['format'](_0x7096('0x24'),_0x13390a['name']):_0x13390a['interface'];return _0x5ab797;});for(var _0x2dccfe in _0x248301){if(_0x248301['hasOwnProperty'](_0x2dccfe)){if(!_0x4b28bf[_0x2dccfe]){delete _0x248301[_0x2dccfe];}}}}function clearVoiceCallReports(_0x237e39){_0x237e39['total']=0x0;_0x237e39['answered']=0x0;_0x237e39[_0x7096('0x29')]=0x0;_0x237e39['sumDuration']=0x0;_0x237e39[_0x7096('0x2a')]=0x0;}function clearCampaigns(_0x4e0f0a){if(!_[_0x7096('0x2b')](_0x4e0f0a)){for(var _0xd83be3 in _0x4e0f0a){if(_0x4e0f0a['hasOwnProperty'](_0xd83be3)){_0x4e0f0a[_0xd83be3][_0x7096('0x2c')]=0x0;_0x4e0f0a[_0xd83be3][_0x7096('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x4f6d90){if(!_['isEmpty'](_0x4f6d90)){for(var _0x5882ea in _0x4f6d90){if(_0x4f6d90[_0x7096('0x26')](_0x5882ea)){_0x4f6d90[_0x5882ea][_0x7096('0x2e')]=0x0;_0x4f6d90[_0x5882ea][_0x7096('0x2f')]=0x0;_0x4f6d90[_0x5882ea][_0x7096('0x30')]=0x0;_0x4f6d90[_0x5882ea]['abandoned']=0x0;_0x4f6d90[_0x5882ea][_0x7096('0x29')]=0x0;_0x4f6d90[_0x5882ea][_0x7096('0x31')]=0x0;_0x4f6d90[_0x5882ea][_0x7096('0x2a')]=0x0;_0x4f6d90[_0x5882ea][_0x7096('0x32')]=0x0;_0x4f6d90[_0x5882ea][_0x7096('0x33')]=0x0;_0x4f6d90[_0x5882ea][_0x7096('0x34')]=0x0;_0x4f6d90[_0x5882ea][_0x7096('0x35')]=0x0;_0x4f6d90[_0x5882ea][_0x7096('0x36')]=0x0;_0x4f6d90[_0x5882ea][_0x7096('0x37')]=0x0;_0x4f6d90[_0x5882ea][_0x7096('0x38')]=0x0;_0x4f6d90[_0x5882ea]['outboundDropCallsDayCallersExit']=0x0;_0x4f6d90[_0x5882ea]['outboundBlacklistCallsDay']=0x0;_0x4f6d90[_0x5882ea][_0x7096('0x39')]=0x0;_0x4f6d90[_0x5882ea][_0x7096('0x3a')]=0x0;_0x4f6d90[_0x5882ea][_0x7096('0x3b')]=0x0;_0x4f6d90[_0x5882ea]['outboundAnswerAgiCallsDay']=0x0;_0x4f6d90[_0x5882ea][_0x7096('0x3c')]=0x0;_0x4f6d90[_0x5882ea][_0x7096('0x3d')]=!![];}}}}Realtime[_0x7096('0x3e')][_0x7096('0x3f')]=function(_0x52f725,_0x318ec4){for(var _0x5cd521 in _0x318ec4){if(_0x52f725['hasOwnProperty'](_0x5cd521)){_0x52f725[_0x5cd521]=_0x318ec4[_0x5cd521];}}};Realtime[_0x7096('0x3e')][_0x7096('0x40')]=function(){var _0x234671=this;return function(_0x14c9a6){if(_0x14c9a6){freeIsNotKeyAgent(_0x14c9a6,_0x234671[_0x7096('0x12')]);for(var _0x4964fb=0x0,_0xb6efd9={},_0x5741df={};_0x4964fb<_0x14c9a6[_0x7096('0x41')];_0x4964fb+=0x1){_0xb6efd9=_0x14c9a6[_0x4964fb];var _0x497267=_[_0x7096('0x28')](_0xb6efd9[_0x7096('0x42')])?util[_0x7096('0x23')](_0x7096('0x24'),_0xb6efd9['name']):_0xb6efd9[_0x7096('0x42')];if(_[_0x7096('0x43')](_0x234671[_0x7096('0x12')][_0x497267])){_0x234671[_0x7096('0x12')][_0x497267]=new Agent(_0xb6efd9);}else{_0x234671[_0x7096('0x3f')](_0x234671[_0x7096('0x12')][_0x497267],_0xb6efd9);}}}return _0x234671['agents'];};};Realtime[_0x7096('0x3e')][_0x7096('0x44')]=function(){var _0x2fe76a=this;return function(_0x43e3a4){if(_0x43e3a4){freeIsNotKeySip(_0x43e3a4,_0x2fe76a[_0x7096('0x13')]);for(var _0x49dcab=0x0,_0x4c4509={},_0x13cc43={};_0x49dcab<_0x43e3a4[_0x7096('0x41')];_0x49dcab+=0x1){_0x4c4509=_0x43e3a4[_0x49dcab];if(_['isUndefined'](_0x2fe76a[_0x7096('0x13')][util[_0x7096('0x23')](_0x7096('0x24'),_0x4c4509['name'])])){_0x2fe76a[_0x7096('0x13')][util[_0x7096('0x23')](_0x7096('0x24'),_0x4c4509[_0x7096('0x25')])]=new Telephone(_0x4c4509);}else{_0x2fe76a[_0x7096('0x3f')](_0x2fe76a[_0x7096('0x13')][util['format'](_0x7096('0x24'),_0x4c4509['name'])],_0x4c4509);}}}return _0x2fe76a[_0x7096('0x13')];};};Realtime[_0x7096('0x3e')][_0x7096('0x45')]=function(){var _0x952022=this;return function(_0x33a33c){if(_0x33a33c){freeIsNotKeySip(_0x33a33c,_0x952022[_0x7096('0x46')]);for(var _0x2ae6af=0x0,_0x177485={},_0x25f516={};_0x2ae6af<_0x33a33c[_0x7096('0x41')];_0x2ae6af+=0x1){_0x177485=_0x33a33c[_0x2ae6af];if(_[_0x7096('0x43')](_0x952022[_0x7096('0x46')][util['format']('SIP/%s',_0x177485['name'])])){_0x952022['trunks'][util[_0x7096('0x23')](_0x7096('0x24'),_0x177485['name'])]=new Trunk(_0x177485);}else{_0x952022[_0x7096('0x3f')](_0x952022[_0x7096('0x46')][util[_0x7096('0x23')](_0x7096('0x24'),_0x177485[_0x7096('0x25')])],_0x177485);}}}return _0x952022['trunks'];};};Realtime[_0x7096('0x3e')]['initVoiceQueues']=function(){var _0x439a69=this;return function(_0x2f95cf){if(_0x2f95cf){freeIsNotKey(_0x2f95cf,_0x439a69[_0x7096('0x47')],_0x7096('0x25'));for(var _0x5d1358=0x0,_0x507655={},_0x55a44d={};_0x5d1358<_0x2f95cf[_0x7096('0x41')];_0x5d1358+=0x1){_0x507655=_0x2f95cf[_0x5d1358];if(_[_0x7096('0x43')](_0x439a69['voiceQueues'][_0x507655[_0x7096('0x25')]])){_0x439a69[_0x7096('0x47')][_0x507655[_0x7096('0x25')]]=new VoiceQueue(_0x507655);}else{_0x439a69[_0x7096('0x3f')](_0x439a69['voiceQueues'][_0x507655[_0x7096('0x25')]],_0x507655);}}}return _0x439a69[_0x7096('0x47')];};};Realtime['prototype'][_0x7096('0x48')]=function(){var _0x506c89=this;return function(_0x1fc434){if(_0x1fc434){freeIsNotKey(_0x1fc434,_0x506c89['triggers'],'id');for(var _0x3e239a=0x0,_0x2ec3f8={},_0x3bba23={};_0x3e239a<_0x1fc434[_0x7096('0x41')];_0x3e239a+=0x1){_0x2ec3f8=_0x1fc434[_0x3e239a];if(_[_0x7096('0x43')](_0x506c89[_0x7096('0x14')][_0x2ec3f8['id']])){_0x506c89[_0x7096('0x14')][_0x2ec3f8['id']]=new Trigger(_0x2ec3f8);}else{_0x506c89[_0x7096('0x3f')](_0x506c89['triggers'][_0x2ec3f8['id']],_0x2ec3f8);}}}return _0x506c89[_0x7096('0x14')];};};Realtime[_0x7096('0x3e')][_0x7096('0x49')]=function(){var _0x97cbef=this;return function(_0x48cef7){if(_0x48cef7){freeIsNotKey(_0x48cef7,_0x97cbef['templates'],'id');for(var _0x39f7da=0x0,_0xc1e3ed={},_0x29420e={};_0x39f7da<_0x48cef7[_0x7096('0x41')];_0x39f7da+=0x1){_0xc1e3ed=_0x48cef7[_0x39f7da];if(_[_0x7096('0x43')](_0x97cbef[_0x7096('0x16')][_0xc1e3ed['id']])){_0x97cbef[_0x7096('0x16')][_0xc1e3ed['id']]=new Template(_0xc1e3ed);}else{_0x97cbef[_0x7096('0x3f')](_0x97cbef[_0x7096('0x16')][_0xc1e3ed['id']],_0xc1e3ed);}}}return _0x97cbef[_0x7096('0x16')];};};Realtime[_0x7096('0x3e')][_0x7096('0x4a')]=function(){var _0x29d6fc=this;return function(_0x38efef){if(_0x38efef){freeIsNotKey(_0x38efef,_0x29d6fc['zendeskAccounts'],'id');for(var _0x140666=0x0,_0x3e682c={},_0x7ac378={};_0x140666<_0x38efef['length'];_0x140666+=0x1){_0x3e682c=_0x38efef[_0x140666];if(_[_0x7096('0x43')](_0x29d6fc[_0x7096('0x1a')][_0x3e682c['id']])){_0x29d6fc[_0x7096('0x1a')][_0x3e682c['id']]=new ZendeskAccount(_0x3e682c);}else{_0x29d6fc[_0x7096('0x3f')](_0x29d6fc['zendeskAccounts'][_0x3e682c['id']],_0x3e682c);}}}return _0x29d6fc[_0x7096('0x1a')];};};Realtime[_0x7096('0x3e')][_0x7096('0x4b')]=function(){var _0x1bd230=this;return function(_0x33d9dc){if(_0x33d9dc){freeIsNotKey(_0x33d9dc,_0x1bd230[_0x7096('0x1b')],'id');for(var _0x51c0df=0x0,_0x53a47b={},_0x241de3={};_0x51c0df<_0x33d9dc['length'];_0x51c0df+=0x1){_0x53a47b=_0x33d9dc[_0x51c0df];if(_['isUndefined'](_0x1bd230['salesforceAccounts'][_0x53a47b['id']])){_0x1bd230[_0x7096('0x1b')][_0x53a47b['id']]=new SalesforceAccount(_0x53a47b);}else{_0x1bd230[_0x7096('0x3f')](_0x1bd230[_0x7096('0x1b')][_0x53a47b['id']],_0x53a47b);}}}return _0x1bd230[_0x7096('0x1b')];};};Realtime[_0x7096('0x3e')][_0x7096('0x4c')]=function(){var _0x43427b=this;return function(_0x49dc75){if(_0x49dc75){freeIsNotKey(_0x49dc75,_0x43427b[_0x7096('0x1c')],'id');for(var _0x4fca10=0x0,_0x1d2a83={},_0x505f0b={};_0x4fca10<_0x49dc75['length'];_0x4fca10+=0x1){_0x1d2a83=_0x49dc75[_0x4fca10];if(_['isUndefined'](_0x43427b['freshdeskAccounts'][_0x1d2a83['id']])){_0x43427b[_0x7096('0x1c')][_0x1d2a83['id']]=new FreshdeskAccount(_0x1d2a83);}else{_0x43427b[_0x7096('0x3f')](_0x43427b[_0x7096('0x1c')][_0x1d2a83['id']],_0x1d2a83);}}}return _0x43427b[_0x7096('0x1c')];};};Realtime['prototype'][_0x7096('0x4d')]=function(){var _0x4a0cb0=this;return function(_0x15290b){if(_0x15290b){freeIsNotKey(_0x15290b,_0x4a0cb0[_0x7096('0x1d')],'id');for(var _0x3e837b=0x0,_0x1b4815={},_0x4d6ac9={};_0x3e837b<_0x15290b[_0x7096('0x41')];_0x3e837b+=0x1){_0x1b4815=_0x15290b[_0x3e837b];if(_['isUndefined'](_0x4a0cb0[_0x7096('0x1d')][_0x1b4815['id']])){_0x4a0cb0[_0x7096('0x1d')][_0x1b4815['id']]=new ZohoAccount(_0x1b4815);}else{_0x4a0cb0[_0x7096('0x3f')](_0x4a0cb0[_0x7096('0x1d')][_0x1b4815['id']],_0x1b4815);}}}return _0x4a0cb0['zohoAccounts'];};};Realtime['prototype'][_0x7096('0x4e')]=function(){var _0x3c5832=this;return function(_0x2cc444){if(_0x2cc444){freeIsNotKey(_0x2cc444,_0x3c5832[_0x7096('0x1e')],'id');for(var _0x52b06a=0x0,_0x4c3a03={},_0x4d300f={};_0x52b06a<_0x2cc444[_0x7096('0x41')];_0x52b06a+=0x1){_0x4c3a03=_0x2cc444[_0x52b06a];if(_['isUndefined'](_0x3c5832[_0x7096('0x1e')][_0x4c3a03['id']])){_0x3c5832['deskAccounts'][_0x4c3a03['id']]=new DeskAccount(_0x4c3a03);}else{_0x3c5832[_0x7096('0x3f')](_0x3c5832[_0x7096('0x1e')][_0x4c3a03['id']],_0x4c3a03);}}}return _0x3c5832['deskAccounts'];};};Realtime[_0x7096('0x3e')][_0x7096('0x4f')]=function(){var _0x2a00f2=this;return function(_0x228001){if(_0x228001){freeIsNotKey(_0x228001,_0x2a00f2[_0x7096('0x50')],'id');for(var _0x3a2fb0=0x0,_0x3ef646={},_0x3dc03a={};_0x3a2fb0<_0x228001['length'];_0x3a2fb0+=0x1){_0x3ef646=_0x228001[_0x3a2fb0];if(_[_0x7096('0x43')](_0x2a00f2[_0x7096('0x50')][_0x3ef646['id']])){_0x2a00f2['sugarcrmAccounts'][_0x3ef646['id']]=new SugarcrmAccount(_0x3ef646);}else{_0x2a00f2[_0x7096('0x3f')](_0x2a00f2[_0x7096('0x50')][_0x3ef646['id']],_0x3ef646);}}}return _0x2a00f2[_0x7096('0x50')];};};Realtime['prototype'][_0x7096('0x51')]=function(){var _0x3b53b6=this;return function(_0x2cd8a7){if(_0x2cd8a7){freeIsNotKey(_0x2cd8a7,_0x3b53b6['vtigerAccounts'],'id');for(var _0xe0d690=0x0,_0xc7d225={},_0x4122fa={};_0xe0d690<_0x2cd8a7[_0x7096('0x41')];_0xe0d690+=0x1){_0xc7d225=_0x2cd8a7[_0xe0d690];if(_[_0x7096('0x43')](_0x3b53b6[_0x7096('0x1f')][_0xc7d225['id']])){_0x3b53b6[_0x7096('0x1f')][_0xc7d225['id']]=new VtigerAccount(_0xc7d225);}else{_0x3b53b6[_0x7096('0x3f')](_0x3b53b6[_0x7096('0x1f')][_0xc7d225['id']],_0xc7d225);}}}return _0x3b53b6['vtigerAccounts'];};};Realtime[_0x7096('0x3e')]['initServicenowAccounts']=function(){var _0x50e94f=this;return function(_0x3d066e){if(_0x3d066e){freeIsNotKey(_0x3d066e,_0x50e94f[_0x7096('0x20')],'id');for(var _0x3c0df9=0x0,_0x3d7ad0={},_0x1f679e={};_0x3c0df9<_0x3d066e[_0x7096('0x41')];_0x3c0df9+=0x1){_0x3d7ad0=_0x3d066e[_0x3c0df9];if(_[_0x7096('0x43')](_0x50e94f[_0x7096('0x20')][_0x3d7ad0['id']])){_0x50e94f[_0x7096('0x20')][_0x3d7ad0['id']]=new ServicenowAccount(_0x3d7ad0);}else{_0x50e94f['mergeFromDatabase'](_0x50e94f['servicenowAccounts'][_0x3d7ad0['id']],_0x3d7ad0);}}}return _0x50e94f[_0x7096('0x20')];};};Realtime['prototype'][_0x7096('0x52')]=function(){var _0x127832=this;return function(_0x355870){if(_0x355870){freeIsNotKey(_0x355870,_0x127832[_0x7096('0x21')],'id');for(var _0x231023=0x0,_0x5f33a2={},_0x26c4b7={};_0x231023<_0x355870[_0x7096('0x41')];_0x231023+=0x1){_0x5f33a2=_0x355870[_0x231023];if(_[_0x7096('0x43')](_0x127832[_0x7096('0x21')][_0x5f33a2['id']])){_0x127832[_0x7096('0x21')][_0x5f33a2['id']]=new Dynamics365Account(_0x5f33a2);}else{_0x127832[_0x7096('0x3f')](_0x127832[_0x7096('0x21')][_0x5f33a2['id']],_0x5f33a2);}}}return _0x127832[_0x7096('0x21')];};};Realtime[_0x7096('0x3e')]['initFreshsalesAccounts']=function(){var _0x1d306c=this;return function(_0x1948e6){if(_0x1948e6){freeIsNotKey(_0x1948e6,_0x1d306c[_0x7096('0x53')],'id');for(var _0x5d8779=0x0,_0x207a80={},_0x3728e4={};_0x5d8779<_0x1948e6[_0x7096('0x41')];_0x5d8779+=0x1){_0x207a80=_0x1948e6[_0x5d8779];if(_[_0x7096('0x43')](_0x1d306c[_0x7096('0x53')][_0x207a80['id']])){_0x1d306c[_0x7096('0x53')][_0x207a80['id']]=new FreshsalesAccount(_0x207a80);}else{_0x1d306c[_0x7096('0x3f')](_0x1d306c[_0x7096('0x53')][_0x207a80['id']],_0x207a80);}}}return _0x1d306c['freshsalesAccounts'];};};Realtime[_0x7096('0x3e')][_0x7096('0x54')]=function(){var _0x18e471=this;return function(_0x5dbf99){for(var _0x53239f=0x0;_0x53239f<_0x5dbf99[_0x7096('0x41')];_0x53239f+=0x1){_[_0x7096('0x55')](_0x18e471[_0x7096('0x47')][_0x5dbf99[_0x53239f][_0x7096('0x25')]],_0x5dbf99[_0x53239f]);}return _0x18e471['voiceQueues'];};};Realtime[_0x7096('0x3e')][_0x7096('0x56')]=function(){var _0x5513f9=this;return function(_0x1b9f91){clearVoiceQueues(_0x5513f9[_0x7096('0x47')]);if(_0x1b9f91){_0x1b9f91=_['groupBy'](_0x1b9f91,_0x7096('0x57'));for(var _0x33b96e in _0x1b9f91){if(_0x1b9f91[_0x7096('0x26')](_0x33b96e)){var _0x62dae6={};for(var _0x395469=0x0;_0x395469<_0x1b9f91[_0x33b96e][_0x7096('0x41')];_0x395469+=0x1){var _0x1aeec8=_0x1b9f91[_0x33b96e][_0x395469][_0x7096('0x58')];if(_0x5513f9[_0x7096('0x47')][_0x1aeec8]){if(_0x1b9f91[_0x33b96e][_0x395469][_0x7096('0x59')]){_0x5513f9[_0x7096('0x47')][_0x1aeec8][_0x7096('0x30')]+=0x1;}if(_0x1b9f91[_0x33b96e][_0x395469][_0x7096('0x5a')]){_0x5513f9[_0x7096('0x47')][_0x1aeec8][_0x7096('0x5b')]+=0x1;}_0x5513f9['voiceQueues'][_0x1aeec8]['sumHoldTime']+=moment(_0x1b9f91[_0x33b96e][_0x395469]['queuecallerleaveAt'])[_0x7096('0x5c')](moment(_0x1b9f91[_0x33b96e][_0x395469][_0x7096('0x5d')]),_0x7096('0x5e'))||0x0;if(_0x395469===_0x1b9f91[_0x33b96e][_0x7096('0x41')]-0x1){_0x5513f9[_0x7096('0x47')][_0x1aeec8][_0x7096('0x31')]+=moment(_0x1b9f91[_0x33b96e][_0x395469]['queuecallercompleteAt']||_0x1b9f91[_0x33b96e][_0x395469]['queuecallerabandonAt']||_0x1b9f91[_0x33b96e][_0x395469][_0x7096('0x5f')])['diff'](moment(_0x1b9f91[_0x33b96e][_0x395469][_0x7096('0x5d')]),_0x7096('0x5e'))||0x0;_0x5513f9[_0x7096('0x47')][_0x1aeec8]['total']+=0x1;if(_0x1b9f91[_0x33b96e][_0x395469]['queuecallercomplete']){_0x5513f9['voiceQueues'][_0x1aeec8]['answered']+=0x1;_0x5513f9[_0x7096('0x47')][_0x1aeec8]['sumBillable']+=moment(_0x1b9f91[_0x33b96e][_0x395469][_0x7096('0x60')])[_0x7096('0x5c')](moment(_0x1b9f91[_0x33b96e][_0x395469][_0x7096('0x61')]),_0x7096('0x5e'))||0x0;}}else{_0x5513f9['voiceQueues'][_0x1aeec8]['sumDuration']+=_0x5513f9[_0x7096('0x47')][_0x1aeec8]['sumHoldTime']||0x0;}}}}}}return _0x5513f9['voiceQueues'];};};Realtime[_0x7096('0x3e')][_0x7096('0x62')]=function(){var _0x33feef=this;return function(_0x40b288){clearVoiceCallReports(_0x33feef['outbound']);if(_0x40b288){for(var _0x3ed80a=0x0;_0x3ed80a<_0x40b288[_0x7096('0x41')];_0x3ed80a+=0x1){_0x33feef[_0x7096('0x63')][_0x7096('0x2e')]+=0x1;_0x33feef['outbound']['sumDuration']+=_0x40b288[_0x3ed80a][_0x7096('0x64')];if(_0x40b288[_0x3ed80a][_0x7096('0x65')]===_0x7096('0x66')){_0x33feef[_0x7096('0x63')][_0x7096('0x2f')]+=0x1;_0x33feef[_0x7096('0x63')][_0x7096('0x29')]+=_0x40b288[_0x3ed80a][_0x7096('0x64')]-_0x40b288[_0x3ed80a][_0x7096('0x67')]||0x0;_0x33feef[_0x7096('0x63')][_0x7096('0x2a')]+=_0x40b288[_0x3ed80a][_0x7096('0x67')];}}}return _0x33feef['outbound'];};};Realtime[_0x7096('0x3e')][_0x7096('0x68')]=function(){var _0xe7a412=this;return function(_0xda349c){if(_0xda349c){freeIsNotKey(_0xda349c,_0xe7a412[_0x7096('0x15')],_0x7096('0x25'));for(var _0x50da0c=0x0,_0x4e37d2={};_0x50da0c<_0xda349c[_0x7096('0x41')];_0x50da0c+=0x1){_0x4e37d2=_0xda349c[_0x50da0c];if(_[_0x7096('0x43')](_0xe7a412['campaigns'][_0x4e37d2[_0x7096('0x25')]])){_0xe7a412[_0x7096('0x15')][_0x4e37d2['name']]=new Campaign(_0x4e37d2);}else{_0xe7a412['mergeFromDatabase'](_0xe7a412[_0x7096('0x15')][_0x4e37d2[_0x7096('0x25')]],_0x4e37d2);_0xe7a412[_0x7096('0x15')][_0x4e37d2[_0x7096('0x25')]][_0x7096('0x69')]=_0x4e37d2[_0x7096('0x6a')]?_0x4e37d2[_0x7096('0x6a')][_0x7096('0x25')]:undefined;}}}return _0xe7a412[_0x7096('0x15')];};};Realtime[_0x7096('0x3e')]['initVoiceExtensions']=function(){var _0x3e92dd=this;return function(_0x5514a6){if(_0x5514a6){freeIsNotKey(_0x5514a6,_0x3e92dd[_0x7096('0x6b')],'id');for(var _0x4c8158=0x0,_0x412e7a={};_0x4c8158<_0x5514a6[_0x7096('0x41')];_0x4c8158+=0x1){_0x412e7a=_0x5514a6[_0x4c8158];if(_[_0x7096('0x43')](_0x3e92dd[_0x7096('0x6b')][_0x412e7a['id']])){_0x3e92dd['voiceExtensions'][_0x412e7a['id']]=new VoiceExtension(_0x412e7a);}else{_0x3e92dd[_0x7096('0x3f')](_0x3e92dd[_0x7096('0x6b')][_0x412e7a['id']],_0x412e7a);}}}return _0x3e92dd[_0x7096('0x6b')];};};Realtime['prototype'][_0x7096('0x6c')]=function(){var _0x24891e=this;return function(_0x27a275){clearCampaigns(_0x24891e[_0x7096('0x15')]);for(var _0x17ad0b=0x0;_0x17ad0b<_0x27a275[_0x7096('0x41')];_0x17ad0b+=0x1){_['merge'](_0x24891e[_0x7096('0x15')][_0x27a275[_0x17ad0b][_0x7096('0x25')]],_0x27a275[_0x17ad0b]);}return _0x24891e[_0x7096('0x15')];};};Realtime[_0x7096('0x3e')][_0x7096('0x6d')]=function(){var _0x4dc1cf=this;return function(_0x54e48f){if(_0x54e48f){freeIsNotKey(_0x54e48f,_0x4dc1cf[_0x7096('0x22')],'id');for(var _0x5a7deb=0x0,_0x220f57={},_0x3d4b19={};_0x5a7deb<_0x54e48f['length'];_0x5a7deb+=0x1){_0x220f57=_0x54e48f[_0x5a7deb];if(_[_0x7096('0x43')](_0x4dc1cf[_0x7096('0x22')][_0x220f57['id']])){_0x4dc1cf[_0x7096('0x22')][_0x220f57['id']]=new FaxAccount(_0x220f57);}else{_0x4dc1cf[_0x7096('0x3f')](_0x4dc1cf['faxAccounts'][_0x220f57['id']],_0x220f57);}}}return _0x4dc1cf[_0x7096('0x22')];};};module[_0x7096('0x6e')]=Realtime; \ No newline at end of file +var _0x68fd=['queueStatusComplete','mergeFromDatabase','prototype','initAgents','agents','isNil','isUndefined','telephones','length','initTrunks','initVoiceQueues','voiceQueues','initTriggers','initTemplates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','merge','initVoiceQueueReports','groupBy','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','duration','disposition','ANSWERED','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','util','moment','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','trunks','triggers','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','interface','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay'];(function(_0x598c34,_0x587e2f){var _0x420d25=function(_0x2e7b85){while(--_0x2e7b85){_0x598c34['push'](_0x598c34['shift']());}};_0x420d25(++_0x587e2f);}(_0x68fd,0x1e9));var _0xd68f=function(_0x1e4016,_0x16a60f){_0x1e4016=_0x1e4016-0x0;var _0x21b7f0=_0x68fd[_0x1e4016];return _0x21b7f0;};'use strict';var util=require(_0xd68f('0x0'));var _=require('lodash');var moment=require(_0xd68f('0x1'));var Agent=require(_0xd68f('0x2'));var Telephone=require('../model/telephone');var Trunk=require(_0xd68f('0x3'));var VoiceQueue=require(_0xd68f('0x4'));var Trigger=require(_0xd68f('0x5'));var Template=require(_0xd68f('0x6'));var Campaign=require(_0xd68f('0x7'));var VoiceExtension=require(_0xd68f('0x8'));var ZendeskAccount=require(_0xd68f('0x9'));var SalesforceAccount=require(_0xd68f('0xa'));var FreshdeskAccount=require(_0xd68f('0xb'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0xd68f('0xc'));var DeskAccount=require(_0xd68f('0xd'));var VtigerAccount=require(_0xd68f('0xe'));var ServicenowAccount=require(_0xd68f('0xf'));var Dynamics365Account=require(_0xd68f('0x10'));var FreshsalesAccount=require(_0xd68f('0x11'));var FaxAccount=require(_0xd68f('0x12'));var Realtime=function(){this['agents']={};this['telephones']={};this[_0xd68f('0x13')]={};this['voiceQueues']={};this[_0xd68f('0x14')]={};this[_0xd68f('0x15')]={};this[_0xd68f('0x16')]={};this[_0xd68f('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xd68f('0x18')]={};this[_0xd68f('0x19')]={};this[_0xd68f('0x1a')]={};this['outboundChannels']={};this['timers']={};this['settings']={};this['zendeskAccounts']={};this[_0xd68f('0x1b')]={};this[_0xd68f('0x1c')]={};this['freshdeskAccounts']={};this[_0xd68f('0x1d')]={};this[_0xd68f('0x1e')]={};this[_0xd68f('0x1f')]={};this[_0xd68f('0x20')]={};this[_0xd68f('0x21')]={};this[_0xd68f('0x22')]={};this[_0xd68f('0x23')]={};};function freeIsNotKey(_0x53aed0,_0x1ba1ce,_0x4946bd){var _0x5db5b1=_[_0xd68f('0x24')](_0x53aed0,function(_0x3115f3,_0x451450){return _0x3115f3[_0x4946bd];});for(var _0x3fdfbf in _0x1ba1ce){if(_0x1ba1ce[_0xd68f('0x25')](_0x3fdfbf)){if(!_0x5db5b1[_0x3fdfbf]){delete _0x1ba1ce[_0x3fdfbf];}}}}function freeIsNotKeySip(_0xb01ed,_0xa09f23){var _0x47fdbc=_['mapKeys'](_0xb01ed,function(_0x14435f,_0x22be19){return util[_0xd68f('0x26')](_0xd68f('0x27'),_0x14435f[_0xd68f('0x28')]);});for(var _0x4c192f in _0xa09f23){if(_0xa09f23[_0xd68f('0x25')](_0x4c192f)){if(!_0x47fdbc[_0x4c192f]){delete _0xa09f23[_0x4c192f];}}}}function freeIsNotKeyAgent(_0x32c45d,_0x3fbc0b){var _0x4e00c0=_[_0xd68f('0x24')](_0x32c45d,function(_0x1379e2,_0xeba444){var _0x590e04=_['isNil'](_0x1379e2[_0xd68f('0x29')])?util['format']('SIP/%s',_0x1379e2[_0xd68f('0x28')]):_0x1379e2[_0xd68f('0x29')];return _0x590e04;});for(var _0xde6c97 in _0x3fbc0b){if(_0x3fbc0b[_0xd68f('0x25')](_0xde6c97)){if(!_0x4e00c0[_0xde6c97]){delete _0x3fbc0b[_0xde6c97];}}}}function clearVoiceCallReports(_0x4595bf){_0x4595bf[_0xd68f('0x2a')]=0x0;_0x4595bf[_0xd68f('0x2b')]=0x0;_0x4595bf[_0xd68f('0x2c')]=0x0;_0x4595bf[_0xd68f('0x2d')]=0x0;_0x4595bf[_0xd68f('0x2e')]=0x0;}function clearCampaigns(_0x797b09){if(!_[_0xd68f('0x2f')](_0x797b09)){for(var _0xee7d9d in _0x797b09){if(_0x797b09['hasOwnProperty'](_0xee7d9d)){_0x797b09[_0xee7d9d][_0xd68f('0x30')]=0x0;_0x797b09[_0xee7d9d][_0xd68f('0x31')]=0x0;}}}}function clearVoiceQueues(_0x4b1515){if(!_[_0xd68f('0x2f')](_0x4b1515)){for(var _0x5412d7 in _0x4b1515){if(_0x4b1515['hasOwnProperty'](_0x5412d7)){_0x4b1515[_0x5412d7][_0xd68f('0x2a')]=0x0;_0x4b1515[_0x5412d7][_0xd68f('0x2b')]=0x0;_0x4b1515[_0x5412d7][_0xd68f('0x32')]=0x0;_0x4b1515[_0x5412d7]['abandoned']=0x0;_0x4b1515[_0x5412d7][_0xd68f('0x2c')]=0x0;_0x4b1515[_0x5412d7]['sumDuration']=0x0;_0x4b1515[_0x5412d7][_0xd68f('0x2e')]=0x0;_0x4b1515[_0x5412d7]['outboundAnswerAgiCallsDay']=0x0;_0x4b1515[_0x5412d7][_0xd68f('0x33')]=0x0;_0x4b1515[_0x5412d7][_0xd68f('0x34')]=0x0;_0x4b1515[_0x5412d7][_0xd68f('0x35')]=0x0;_0x4b1515[_0x5412d7][_0xd68f('0x36')]=0x0;_0x4b1515[_0x5412d7][_0xd68f('0x37')]=0x0;_0x4b1515[_0x5412d7]['outboundDropCallsDayTimeout']=0x0;_0x4b1515[_0x5412d7][_0xd68f('0x38')]=0x0;_0x4b1515[_0x5412d7]['outboundBlacklistCallsDay']=0x0;_0x4b1515[_0x5412d7][_0xd68f('0x39')]=0x0;_0x4b1515[_0x5412d7]['outboundRejectCallsDay']=0x0;_0x4b1515[_0x5412d7][_0xd68f('0x3a')]=0x0;_0x4b1515[_0x5412d7][_0xd68f('0x3b')]=0x0;_0x4b1515[_0x5412d7][_0xd68f('0x3c')]=0x0;_0x4b1515[_0x5412d7][_0xd68f('0x3d')]=!![];}}}}Realtime['prototype'][_0xd68f('0x3e')]=function(_0x290826,_0x2cef9a){for(var _0x325856 in _0x2cef9a){if(_0x290826['hasOwnProperty'](_0x325856)){_0x290826[_0x325856]=_0x2cef9a[_0x325856];}}};Realtime[_0xd68f('0x3f')][_0xd68f('0x40')]=function(){var _0x27636f=this;return function(_0x37a021){if(_0x37a021){freeIsNotKeyAgent(_0x37a021,_0x27636f[_0xd68f('0x41')]);for(var _0x2ac01b=0x0,_0x3feb70={},_0x9c752e={};_0x2ac01b<_0x37a021['length'];_0x2ac01b+=0x1){_0x3feb70=_0x37a021[_0x2ac01b];var _0x44fa9b=_[_0xd68f('0x42')](_0x3feb70[_0xd68f('0x29')])?util[_0xd68f('0x26')](_0xd68f('0x27'),_0x3feb70[_0xd68f('0x28')]):_0x3feb70[_0xd68f('0x29')];if(_[_0xd68f('0x43')](_0x27636f['agents'][_0x44fa9b])){_0x27636f[_0xd68f('0x41')][_0x44fa9b]=new Agent(_0x3feb70);}else{_0x27636f[_0xd68f('0x3e')](_0x27636f[_0xd68f('0x41')][_0x44fa9b],_0x3feb70);}}}return _0x27636f[_0xd68f('0x41')];};};Realtime[_0xd68f('0x3f')]['initTelephones']=function(){var _0x18e70b=this;return function(_0x297102){if(_0x297102){freeIsNotKeySip(_0x297102,_0x18e70b[_0xd68f('0x44')]);for(var _0x581d6=0x0,_0x6a987b={},_0xc50ae={};_0x581d6<_0x297102[_0xd68f('0x45')];_0x581d6+=0x1){_0x6a987b=_0x297102[_0x581d6];if(_[_0xd68f('0x43')](_0x18e70b['telephones'][util[_0xd68f('0x26')](_0xd68f('0x27'),_0x6a987b[_0xd68f('0x28')])])){_0x18e70b[_0xd68f('0x44')][util[_0xd68f('0x26')](_0xd68f('0x27'),_0x6a987b['name'])]=new Telephone(_0x6a987b);}else{_0x18e70b[_0xd68f('0x3e')](_0x18e70b[_0xd68f('0x44')][util[_0xd68f('0x26')](_0xd68f('0x27'),_0x6a987b[_0xd68f('0x28')])],_0x6a987b);}}}return _0x18e70b[_0xd68f('0x44')];};};Realtime['prototype'][_0xd68f('0x46')]=function(){var _0x6495c1=this;return function(_0x5cd711){if(_0x5cd711){freeIsNotKeySip(_0x5cd711,_0x6495c1[_0xd68f('0x13')]);for(var _0x5dcdcb=0x0,_0x5255f7={},_0x226088={};_0x5dcdcb<_0x5cd711[_0xd68f('0x45')];_0x5dcdcb+=0x1){_0x5255f7=_0x5cd711[_0x5dcdcb];if(_['isUndefined'](_0x6495c1[_0xd68f('0x13')][util[_0xd68f('0x26')]('SIP/%s',_0x5255f7[_0xd68f('0x28')])])){_0x6495c1[_0xd68f('0x13')][util[_0xd68f('0x26')](_0xd68f('0x27'),_0x5255f7['name'])]=new Trunk(_0x5255f7);}else{_0x6495c1['mergeFromDatabase'](_0x6495c1['trunks'][util[_0xd68f('0x26')](_0xd68f('0x27'),_0x5255f7[_0xd68f('0x28')])],_0x5255f7);}}}return _0x6495c1[_0xd68f('0x13')];};};Realtime[_0xd68f('0x3f')][_0xd68f('0x47')]=function(){var _0x2f95de=this;return function(_0x6bf1ce){if(_0x6bf1ce){freeIsNotKey(_0x6bf1ce,_0x2f95de[_0xd68f('0x48')],_0xd68f('0x28'));for(var _0x20466e=0x0,_0x574ca3={},_0x4da444={};_0x20466e<_0x6bf1ce[_0xd68f('0x45')];_0x20466e+=0x1){_0x574ca3=_0x6bf1ce[_0x20466e];if(_[_0xd68f('0x43')](_0x2f95de[_0xd68f('0x48')][_0x574ca3[_0xd68f('0x28')]])){_0x2f95de[_0xd68f('0x48')][_0x574ca3[_0xd68f('0x28')]]=new VoiceQueue(_0x574ca3);}else{_0x2f95de['mergeFromDatabase'](_0x2f95de[_0xd68f('0x48')][_0x574ca3[_0xd68f('0x28')]],_0x574ca3);}}}return _0x2f95de[_0xd68f('0x48')];};};Realtime[_0xd68f('0x3f')][_0xd68f('0x49')]=function(){var _0x309bfd=this;return function(_0x4efa03){if(_0x4efa03){freeIsNotKey(_0x4efa03,_0x309bfd[_0xd68f('0x14')],'id');for(var _0x3eb86c=0x0,_0x18d097={},_0x43c15f={};_0x3eb86c<_0x4efa03[_0xd68f('0x45')];_0x3eb86c+=0x1){_0x18d097=_0x4efa03[_0x3eb86c];if(_[_0xd68f('0x43')](_0x309bfd[_0xd68f('0x14')][_0x18d097['id']])){_0x309bfd[_0xd68f('0x14')][_0x18d097['id']]=new Trigger(_0x18d097);}else{_0x309bfd[_0xd68f('0x3e')](_0x309bfd['triggers'][_0x18d097['id']],_0x18d097);}}}return _0x309bfd[_0xd68f('0x14')];};};Realtime[_0xd68f('0x3f')][_0xd68f('0x4a')]=function(){var _0x5bfd21=this;return function(_0x3113bd){if(_0x3113bd){freeIsNotKey(_0x3113bd,_0x5bfd21[_0xd68f('0x16')],'id');for(var _0x1be6ca=0x0,_0x15191b={},_0x2dc117={};_0x1be6ca<_0x3113bd['length'];_0x1be6ca+=0x1){_0x15191b=_0x3113bd[_0x1be6ca];if(_['isUndefined'](_0x5bfd21['templates'][_0x15191b['id']])){_0x5bfd21[_0xd68f('0x16')][_0x15191b['id']]=new Template(_0x15191b);}else{_0x5bfd21[_0xd68f('0x3e')](_0x5bfd21['templates'][_0x15191b['id']],_0x15191b);}}}return _0x5bfd21[_0xd68f('0x16')];};};Realtime[_0xd68f('0x3f')][_0xd68f('0x4b')]=function(){var _0x25f66d=this;return function(_0xea8d4b){if(_0xea8d4b){freeIsNotKey(_0xea8d4b,_0x25f66d[_0xd68f('0x4c')],'id');for(var _0x13071d=0x0,_0x241008={},_0x3df314={};_0x13071d<_0xea8d4b['length'];_0x13071d+=0x1){_0x241008=_0xea8d4b[_0x13071d];if(_[_0xd68f('0x43')](_0x25f66d[_0xd68f('0x4c')][_0x241008['id']])){_0x25f66d[_0xd68f('0x4c')][_0x241008['id']]=new ZendeskAccount(_0x241008);}else{_0x25f66d[_0xd68f('0x3e')](_0x25f66d[_0xd68f('0x4c')][_0x241008['id']],_0x241008);}}}return _0x25f66d[_0xd68f('0x4c')];};};Realtime[_0xd68f('0x3f')][_0xd68f('0x4d')]=function(){var _0x269795=this;return function(_0x2950b0){if(_0x2950b0){freeIsNotKey(_0x2950b0,_0x269795[_0xd68f('0x1b')],'id');for(var _0x537fbd=0x0,_0x58596a={},_0x31876f={};_0x537fbd<_0x2950b0[_0xd68f('0x45')];_0x537fbd+=0x1){_0x58596a=_0x2950b0[_0x537fbd];if(_[_0xd68f('0x43')](_0x269795['salesforceAccounts'][_0x58596a['id']])){_0x269795[_0xd68f('0x1b')][_0x58596a['id']]=new SalesforceAccount(_0x58596a);}else{_0x269795['mergeFromDatabase'](_0x269795[_0xd68f('0x1b')][_0x58596a['id']],_0x58596a);}}}return _0x269795[_0xd68f('0x1b')];};};Realtime[_0xd68f('0x3f')][_0xd68f('0x4e')]=function(){var _0x2ebabc=this;return function(_0x245f65){if(_0x245f65){freeIsNotKey(_0x245f65,_0x2ebabc[_0xd68f('0x4f')],'id');for(var _0x35da98=0x0,_0x59a2a6={},_0x41226d={};_0x35da98<_0x245f65[_0xd68f('0x45')];_0x35da98+=0x1){_0x59a2a6=_0x245f65[_0x35da98];if(_[_0xd68f('0x43')](_0x2ebabc[_0xd68f('0x4f')][_0x59a2a6['id']])){_0x2ebabc[_0xd68f('0x4f')][_0x59a2a6['id']]=new FreshdeskAccount(_0x59a2a6);}else{_0x2ebabc[_0xd68f('0x3e')](_0x2ebabc[_0xd68f('0x4f')][_0x59a2a6['id']],_0x59a2a6);}}}return _0x2ebabc[_0xd68f('0x4f')];};};Realtime[_0xd68f('0x3f')][_0xd68f('0x50')]=function(){var _0x59a90e=this;return function(_0x368cb4){if(_0x368cb4){freeIsNotKey(_0x368cb4,_0x59a90e['zohoAccounts'],'id');for(var _0x5a113d=0x0,_0x49d2c9={},_0x3140c0={};_0x5a113d<_0x368cb4['length'];_0x5a113d+=0x1){_0x49d2c9=_0x368cb4[_0x5a113d];if(_[_0xd68f('0x43')](_0x59a90e[_0xd68f('0x1d')][_0x49d2c9['id']])){_0x59a90e['zohoAccounts'][_0x49d2c9['id']]=new ZohoAccount(_0x49d2c9);}else{_0x59a90e[_0xd68f('0x3e')](_0x59a90e['zohoAccounts'][_0x49d2c9['id']],_0x49d2c9);}}}return _0x59a90e[_0xd68f('0x1d')];};};Realtime[_0xd68f('0x3f')][_0xd68f('0x51')]=function(){var _0x54350d=this;return function(_0x8224ec){if(_0x8224ec){freeIsNotKey(_0x8224ec,_0x54350d[_0xd68f('0x1e')],'id');for(var _0x54e085=0x0,_0x52e615={},_0x48000b={};_0x54e085<_0x8224ec[_0xd68f('0x45')];_0x54e085+=0x1){_0x52e615=_0x8224ec[_0x54e085];if(_['isUndefined'](_0x54350d['deskAccounts'][_0x52e615['id']])){_0x54350d[_0xd68f('0x1e')][_0x52e615['id']]=new DeskAccount(_0x52e615);}else{_0x54350d[_0xd68f('0x3e')](_0x54350d[_0xd68f('0x1e')][_0x52e615['id']],_0x52e615);}}}return _0x54350d[_0xd68f('0x1e')];};};Realtime[_0xd68f('0x3f')][_0xd68f('0x52')]=function(){var _0x28452d=this;return function(_0x102d12){if(_0x102d12){freeIsNotKey(_0x102d12,_0x28452d[_0xd68f('0x1c')],'id');for(var _0x5cdf4d=0x0,_0xdf59c3={},_0x313239={};_0x5cdf4d<_0x102d12[_0xd68f('0x45')];_0x5cdf4d+=0x1){_0xdf59c3=_0x102d12[_0x5cdf4d];if(_[_0xd68f('0x43')](_0x28452d[_0xd68f('0x1c')][_0xdf59c3['id']])){_0x28452d[_0xd68f('0x1c')][_0xdf59c3['id']]=new SugarcrmAccount(_0xdf59c3);}else{_0x28452d[_0xd68f('0x3e')](_0x28452d['sugarcrmAccounts'][_0xdf59c3['id']],_0xdf59c3);}}}return _0x28452d[_0xd68f('0x1c')];};};Realtime[_0xd68f('0x3f')][_0xd68f('0x53')]=function(){var _0x594cff=this;return function(_0x43f68){if(_0x43f68){freeIsNotKey(_0x43f68,_0x594cff[_0xd68f('0x1f')],'id');for(var _0x12b186=0x0,_0x47804d={},_0x35baf6={};_0x12b186<_0x43f68[_0xd68f('0x45')];_0x12b186+=0x1){_0x47804d=_0x43f68[_0x12b186];if(_[_0xd68f('0x43')](_0x594cff['vtigerAccounts'][_0x47804d['id']])){_0x594cff[_0xd68f('0x1f')][_0x47804d['id']]=new VtigerAccount(_0x47804d);}else{_0x594cff[_0xd68f('0x3e')](_0x594cff['vtigerAccounts'][_0x47804d['id']],_0x47804d);}}}return _0x594cff[_0xd68f('0x1f')];};};Realtime[_0xd68f('0x3f')][_0xd68f('0x54')]=function(){var _0x31b077=this;return function(_0x100d76){if(_0x100d76){freeIsNotKey(_0x100d76,_0x31b077[_0xd68f('0x20')],'id');for(var _0x4983ef=0x0,_0x46b58a={},_0x27718c={};_0x4983ef<_0x100d76[_0xd68f('0x45')];_0x4983ef+=0x1){_0x46b58a=_0x100d76[_0x4983ef];if(_[_0xd68f('0x43')](_0x31b077[_0xd68f('0x20')][_0x46b58a['id']])){_0x31b077['servicenowAccounts'][_0x46b58a['id']]=new ServicenowAccount(_0x46b58a);}else{_0x31b077['mergeFromDatabase'](_0x31b077[_0xd68f('0x20')][_0x46b58a['id']],_0x46b58a);}}}return _0x31b077[_0xd68f('0x20')];};};Realtime[_0xd68f('0x3f')][_0xd68f('0x55')]=function(){var _0x19d47a=this;return function(_0x157d54){if(_0x157d54){freeIsNotKey(_0x157d54,_0x19d47a[_0xd68f('0x21')],'id');for(var _0x1b102d=0x0,_0x4c2682={},_0x253203={};_0x1b102d<_0x157d54['length'];_0x1b102d+=0x1){_0x4c2682=_0x157d54[_0x1b102d];if(_['isUndefined'](_0x19d47a[_0xd68f('0x21')][_0x4c2682['id']])){_0x19d47a['dynamics365Accounts'][_0x4c2682['id']]=new Dynamics365Account(_0x4c2682);}else{_0x19d47a[_0xd68f('0x3e')](_0x19d47a['dynamics365Accounts'][_0x4c2682['id']],_0x4c2682);}}}return _0x19d47a[_0xd68f('0x21')];};};Realtime[_0xd68f('0x3f')][_0xd68f('0x56')]=function(){var _0x4fd2e3=this;return function(_0x5405c2){if(_0x5405c2){freeIsNotKey(_0x5405c2,_0x4fd2e3[_0xd68f('0x22')],'id');for(var _0x39e051=0x0,_0x1bd8cd={},_0x40a3dd={};_0x39e051<_0x5405c2['length'];_0x39e051+=0x1){_0x1bd8cd=_0x5405c2[_0x39e051];if(_[_0xd68f('0x43')](_0x4fd2e3['freshsalesAccounts'][_0x1bd8cd['id']])){_0x4fd2e3['freshsalesAccounts'][_0x1bd8cd['id']]=new FreshsalesAccount(_0x1bd8cd);}else{_0x4fd2e3['mergeFromDatabase'](_0x4fd2e3[_0xd68f('0x22')][_0x1bd8cd['id']],_0x1bd8cd);}}}return _0x4fd2e3[_0xd68f('0x22')];};};Realtime[_0xd68f('0x3f')]['initVoiceQueueHopperHistory']=function(){var _0x25c91e=this;return function(_0x456065){for(var _0x29c086=0x0;_0x29c086<_0x456065[_0xd68f('0x45')];_0x29c086+=0x1){_[_0xd68f('0x57')](_0x25c91e['voiceQueues'][_0x456065[_0x29c086]['name']],_0x456065[_0x29c086]);}return _0x25c91e['voiceQueues'];};};Realtime[_0xd68f('0x3f')][_0xd68f('0x58')]=function(){var _0x41e6fd=this;return function(_0x662a89){clearVoiceQueues(_0x41e6fd[_0xd68f('0x48')]);if(_0x662a89){_0x662a89=_[_0xd68f('0x59')](_0x662a89,'uniqueid');for(var _0x5c33ae in _0x662a89){if(_0x662a89[_0xd68f('0x25')](_0x5c33ae)){var _0x4d3485={};for(var _0x5e3d4b=0x0;_0x5e3d4b<_0x662a89[_0x5c33ae][_0xd68f('0x45')];_0x5e3d4b+=0x1){var _0xf81668=_0x662a89[_0x5c33ae][_0x5e3d4b][_0xd68f('0x5a')];if(_0x41e6fd[_0xd68f('0x48')][_0xf81668]){if(_0x662a89[_0x5c33ae][_0x5e3d4b][_0xd68f('0x5b')]){_0x41e6fd['voiceQueues'][_0xf81668][_0xd68f('0x32')]+=0x1;}if(_0x662a89[_0x5c33ae][_0x5e3d4b][_0xd68f('0x5c')]){_0x41e6fd[_0xd68f('0x48')][_0xf81668][_0xd68f('0x5d')]+=0x1;}_0x41e6fd[_0xd68f('0x48')][_0xf81668][_0xd68f('0x2c')]+=moment(_0x662a89[_0x5c33ae][_0x5e3d4b][_0xd68f('0x5e')])[_0xd68f('0x5f')](moment(_0x662a89[_0x5c33ae][_0x5e3d4b][_0xd68f('0x60')]),_0xd68f('0x61'))||0x0;if(_0x5e3d4b===_0x662a89[_0x5c33ae][_0xd68f('0x45')]-0x1){_0x41e6fd[_0xd68f('0x48')][_0xf81668][_0xd68f('0x2d')]+=moment(_0x662a89[_0x5c33ae][_0x5e3d4b][_0xd68f('0x62')]||_0x662a89[_0x5c33ae][_0x5e3d4b][_0xd68f('0x63')]||_0x662a89[_0x5c33ae][_0x5e3d4b][_0xd68f('0x64')])[_0xd68f('0x5f')](moment(_0x662a89[_0x5c33ae][_0x5e3d4b][_0xd68f('0x60')]),_0xd68f('0x61'))||0x0;_0x41e6fd[_0xd68f('0x48')][_0xf81668]['total']+=0x1;if(_0x662a89[_0x5c33ae][_0x5e3d4b]['queuecallercomplete']){_0x41e6fd[_0xd68f('0x48')][_0xf81668][_0xd68f('0x2b')]+=0x1;_0x41e6fd[_0xd68f('0x48')][_0xf81668]['sumBillable']+=moment(_0x662a89[_0x5c33ae][_0x5e3d4b][_0xd68f('0x62')])['diff'](moment(_0x662a89[_0x5c33ae][_0x5e3d4b]['queuecallerleaveAt']),_0xd68f('0x61'))||0x0;}}else{_0x41e6fd[_0xd68f('0x48')][_0xf81668][_0xd68f('0x2d')]+=_0x41e6fd[_0xd68f('0x48')][_0xf81668][_0xd68f('0x2c')]||0x0;}}}}}}return _0x41e6fd['voiceQueues'];};};Realtime[_0xd68f('0x3f')]['initVoiceCallReports']=function(){var _0x811f37=this;return function(_0x2517f1){clearVoiceCallReports(_0x811f37[_0xd68f('0x17')]);if(_0x2517f1){for(var _0x46e41c=0x0;_0x46e41c<_0x2517f1['length'];_0x46e41c+=0x1){_0x811f37[_0xd68f('0x17')][_0xd68f('0x2a')]+=0x1;_0x811f37[_0xd68f('0x17')][_0xd68f('0x2d')]+=_0x2517f1[_0x46e41c][_0xd68f('0x65')];if(_0x2517f1[_0x46e41c][_0xd68f('0x66')]===_0xd68f('0x67')){_0x811f37[_0xd68f('0x17')][_0xd68f('0x2b')]+=0x1;_0x811f37[_0xd68f('0x17')][_0xd68f('0x2c')]+=_0x2517f1[_0x46e41c][_0xd68f('0x65')]-_0x2517f1[_0x46e41c]['billableseconds']||0x0;_0x811f37[_0xd68f('0x17')][_0xd68f('0x2e')]+=_0x2517f1[_0x46e41c]['billableseconds'];}}}return _0x811f37[_0xd68f('0x17')];};};Realtime['prototype'][_0xd68f('0x68')]=function(){var _0x1d5cf4=this;return function(_0x559a46){if(_0x559a46){freeIsNotKey(_0x559a46,_0x1d5cf4['campaigns'],_0xd68f('0x28'));for(var _0x35e353=0x0,_0x49d6b7={};_0x35e353<_0x559a46[_0xd68f('0x45')];_0x35e353+=0x1){_0x49d6b7=_0x559a46[_0x35e353];if(_['isUndefined'](_0x1d5cf4['campaigns'][_0x49d6b7['name']])){_0x1d5cf4[_0xd68f('0x15')][_0x49d6b7['name']]=new Campaign(_0x49d6b7);}else{_0x1d5cf4['mergeFromDatabase'](_0x1d5cf4[_0xd68f('0x15')][_0x49d6b7[_0xd68f('0x28')]],_0x49d6b7);_0x1d5cf4[_0xd68f('0x15')][_0x49d6b7[_0xd68f('0x28')]][_0xd68f('0x69')]=_0x49d6b7[_0xd68f('0x6a')]?_0x49d6b7[_0xd68f('0x6a')][_0xd68f('0x28')]:undefined;}}}return _0x1d5cf4['campaigns'];};};Realtime[_0xd68f('0x3f')][_0xd68f('0x6b')]=function(){var _0x100163=this;return function(_0x5e285a){if(_0x5e285a){freeIsNotKey(_0x5e285a,_0x100163[_0xd68f('0x18')],'id');for(var _0x27f204=0x0,_0x489d9b={};_0x27f204<_0x5e285a['length'];_0x27f204+=0x1){_0x489d9b=_0x5e285a[_0x27f204];if(_[_0xd68f('0x43')](_0x100163[_0xd68f('0x18')][_0x489d9b['id']])){_0x100163[_0xd68f('0x18')][_0x489d9b['id']]=new VoiceExtension(_0x489d9b);}else{_0x100163[_0xd68f('0x3e')](_0x100163['voiceExtensions'][_0x489d9b['id']],_0x489d9b);}}}return _0x100163[_0xd68f('0x18')];};};Realtime[_0xd68f('0x3f')][_0xd68f('0x6c')]=function(){var _0x17dadc=this;return function(_0x5a51f4){clearCampaigns(_0x17dadc[_0xd68f('0x15')]);for(var _0xc2a48f=0x0;_0xc2a48f<_0x5a51f4[_0xd68f('0x45')];_0xc2a48f+=0x1){_[_0xd68f('0x57')](_0x17dadc[_0xd68f('0x15')][_0x5a51f4[_0xc2a48f][_0xd68f('0x28')]],_0x5a51f4[_0xc2a48f]);}return _0x17dadc[_0xd68f('0x15')];};};Realtime[_0xd68f('0x3f')][_0xd68f('0x6d')]=function(){var _0x2e30b2=this;return function(_0xd04e7a){if(_0xd04e7a){freeIsNotKey(_0xd04e7a,_0x2e30b2['faxAccounts'],'id');for(var _0x3e1acb=0x0,_0x254444={},_0x49fe61={};_0x3e1acb<_0xd04e7a[_0xd68f('0x45')];_0x3e1acb+=0x1){_0x254444=_0xd04e7a[_0x3e1acb];if(_['isUndefined'](_0x2e30b2[_0xd68f('0x23')][_0x254444['id']])){_0x2e30b2[_0xd68f('0x23')][_0x254444['id']]=new FaxAccount(_0x254444);}else{_0x2e30b2[_0xd68f('0x3e')](_0x2e30b2['faxAccounts'][_0x254444['id']],_0x254444);}}}return _0x2e30b2['faxAccounts'];};};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 5d153b3..2be2870 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 _0x693b=['substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports','lodash','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','disabled','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','name','isNil','accountcode','format','SIP/%s','length','assigned','lastAssignedTo','interface','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','create','match','getAgentByInternal','keys','getCallType','channel','split','calleridnum','outbound','internal','destination','exten','type','queue','lastdata','context','callerid','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','linkedid','transfers','transfereelinkedid','uniqueid','UserId','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','startsWith','Local'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x693b,0x11b));var _0xb693=function(_0x4e6de6,_0x4e3303){_0x4e6de6=_0x4e6de6-0x0;var _0x2f29eb=_0x693b[_0x4e6de6];return _0x2f29eb;};'use strict';var _=require(_0xb693('0x0'));var moment=require('moment');var util=require(_0xb693('0x1'));var config=require(_0xb693('0x2'));var ami=require(_0xb693('0x3'));var RpcVoiceAgentReport=require(_0xb693('0x4'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xb693('0x5'));var RpcMemberReport=require(_0xb693('0x6'));var RpcVoiceQueueReport=require(_0xb693('0x7'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0xb693('0x8'));var VoiceQueueReport=require(_0xb693('0x9'));var VoiceCallReport=require(_0xb693('0xa'));var VoiceAgentReport=require(_0xb693('0xb'));var VoiceDialReport=require(_0xb693('0xc'));var UserReport=require(_0xb693('0xd'));function Report(_0x43748e){this[_0xb693('0xe')]=_0x43748e;this[_0xb693('0xf')]=_0x43748e[_0xb693('0xf')];this['telephones']=_0x43748e[_0xb693('0x10')];}Report[_0xb693('0x11')]['sync']=function(_0x2948b3){var _0x11fe24=new VoiceQueueReport(this[_0xb693('0xe')]);var _0x4dd44f=new VoiceAgentReport(this[_0xb693('0xe')]);var _0x43ce3a=new VoiceDialReport(this[_0xb693('0xe')]);var _0xee5f9b=new VoiceCallReport(this[_0xb693('0xe')]);var _0x47778e=new UserReport(this[_0xb693('0xe')]);if(config['xdr']&&config['xdr'][_0xb693('0x12')]){ami['on']('custom:voiceQueueReport',this[_0xb693('0x13')][_0xb693('0x14')](this));ami['on'](_0xb693('0x15'),this[_0xb693('0x16')]['bind'](this));ami['on'](_0xb693('0x17'),this['voiceAgentReport'][_0xb693('0x14')](this));ami['on'](_0xb693('0x18'),this[_0xb693('0x19')][_0xb693('0x14')](this));ami['on']('blindtransfer',this[_0xb693('0x1a')][_0xb693('0x14')](this));ami['on'](_0xb693('0x1b'),this[_0xb693('0x1c')][_0xb693('0x14')](this));}};Report[_0xb693('0x11')][_0xb693('0x1d')]=function(_0x2fa076){var _0x427252;_0x427252=_[_0xb693('0x1e')](this[_0xb693('0xf')],function(_0x44f078){return _0x44f078['accountcode']==_0x2fa076||_0x44f078[_0xb693('0x1f')]==_0x2fa076;});if(_[_0xb693('0x20')](_0x427252)){var _0xa098d5=_[_0xb693('0x1e')](this[_0xb693('0x10')],function(_0x3b5eeb){return _0x3b5eeb[_0xb693('0x21')]==_0x2fa076||_0x3b5eeb[_0xb693('0x1f')]==_0x2fa076;});if(_0xa098d5){_0x427252=_[_0xb693('0x1e')](this[_0xb693('0xf')],function(_0x489653){return _0x489653['interface']==util[_0xb693('0x22')](_0xb693('0x23'),_0xa098d5[_0xb693('0x1f')]);});}}return _0x427252;};Report[_0xb693('0x11')]['voiceQueueReport']=function(_0x1747ae){for(var _0xb0b016=0x0;_0xb0b016<_0x1747ae[_0xb693('0x24')];_0xb0b016+=0x1){var _0x255dd4=this['findAgent'](_0x1747ae[_0xb0b016]['connectedlinenum']);if(_0x255dd4){_0x1747ae[_0xb0b016][_0xb693('0x21')]=_0x255dd4[_0xb693('0x21')];_0x1747ae[_0xb0b016][_0xb693('0x25')]=!![];_0x1747ae[_0xb0b016][_0xb693('0x26')]=_0x255dd4[_0xb693('0x1f')];_0x1747ae[_0xb0b016][_0xb693('0x27')]=_['isNil'](_0x255dd4['interface'])?util[_0xb693('0x22')](_0xb693('0x23'),_0x255dd4[_0xb693('0x1f')]):_0x255dd4['interface'];if(_0x1747ae[_0xb0b016]['queuecallercomplete']){_0x1747ae[_0xb0b016][_0xb693('0x28')]=moment()['format'](_0xb693('0x29'));}if(_0x1747ae[_0xb0b016][_0xb693('0x2a')]){_0x1747ae[_0xb0b016]['queuecallerexitAt']=moment()['format'](_0xb693('0x29'));}RpcMemberReport[_0xb693('0x13')](_0x1747ae[_0xb0b016]);}RpcVoiceQueueReport[_0xb693('0x2b')](_0x1747ae[_0xb0b016]);}};function extractCalleridNumber(_0x36dc8a){var _0xf3d28c=_0x36dc8a[_0xb693('0x2c')](/<(.*?)>/);return _0xf3d28c?_0xf3d28c[0x1]:_0x36dc8a;}Report[_0xb693('0x11')][_0xb693('0x2d')]=function(_0x46f84d){for(var _0x55bf8c=0x0;_0x55bf8c','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','blindTransfer','type','UserId','create','monitor','monitorFilename','monitors','filename','createdAt','connectedlinename','membername','xcally-motion-dialer','forEach','voiceDialReport','startsWith','Local','indexOf'];(function(_0x5a2c81,_0x4659b4){var _0x6cc53d=function(_0x206df9){while(--_0x206df9){_0x5a2c81['push'](_0x5a2c81['shift']());}};_0x6cc53d(++_0x4659b4);}(_0xb8ed,0xc0));var _0xdb8e=function(_0x2fb3b2,_0x365db0){_0x2fb3b2=_0x2fb3b2-0x0;var _0x33eedb=_0xb8ed[_0x2fb3b2];return _0x33eedb;};'use strict';var _=require(_0xdb8e('0x0'));var moment=require(_0xdb8e('0x1'));var util=require('util');var config=require(_0xdb8e('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0xdb8e('0x3'));var RpcVoiceCallReport=require(_0xdb8e('0x4'));var RpcVoiceDialReport=require(_0xdb8e('0x5'));var RpcMemberReport=require(_0xdb8e('0x6'));var RpcVoiceQueueReport=require(_0xdb8e('0x7'));var RpcVoiceRecording=require(_0xdb8e('0x8'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0xdb8e('0x9'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0xdb8e('0xa'));var UserReport=require(_0xdb8e('0xb'));function Report(_0x44a94d){this[_0xdb8e('0xc')]=_0x44a94d;this['agents']=_0x44a94d[_0xdb8e('0xd')];this[_0xdb8e('0xe')]=_0x44a94d[_0xdb8e('0xe')];}Report[_0xdb8e('0xf')]['sync']=function(_0x4344d4){var _0x5c1e4f=new VoiceQueueReport(this['realtime']);var _0x3fbc6c=new VoiceAgentReport(this[_0xdb8e('0xc')]);var _0x1229e3=new VoiceDialReport(this['realtime']);var _0x2e3250=new VoiceCallReport(this[_0xdb8e('0xc')]);var _0xfe30c7=new UserReport(this['realtime']);if(config[_0xdb8e('0x10')]&&config['xdr'][_0xdb8e('0x11')]){ami['on']('custom:voiceQueueReport',this['voiceQueueReport'][_0xdb8e('0x12')](this));ami['on']('custom:voiceCallReport',this[_0xdb8e('0x13')][_0xdb8e('0x12')](this));ami['on'](_0xdb8e('0x14'),this['voiceAgentReport'][_0xdb8e('0x12')](this));ami['on'](_0xdb8e('0x15'),this['voiceDialReport'][_0xdb8e('0x12')](this));ami['on'](_0xdb8e('0x16'),this['blindTransfer'][_0xdb8e('0x12')](this));ami['on'](_0xdb8e('0x17'),this['attendedTransfer'][_0xdb8e('0x12')](this));}};Report[_0xdb8e('0xf')][_0xdb8e('0x18')]=function(_0x352cbd){var _0x88e4ba;_0x88e4ba=_[_0xdb8e('0x19')](this[_0xdb8e('0xd')],function(_0x29c147){return _0x29c147[_0xdb8e('0x1a')]==_0x352cbd||_0x29c147['name']==_0x352cbd;});if(_[_0xdb8e('0x1b')](_0x88e4ba)){var _0x3531c2=_[_0xdb8e('0x19')](this['telephones'],function(_0x2ebab7){return _0x2ebab7[_0xdb8e('0x1a')]==_0x352cbd||_0x2ebab7[_0xdb8e('0x1c')]==_0x352cbd;});if(_0x3531c2){_0x88e4ba=_[_0xdb8e('0x19')](this[_0xdb8e('0xd')],function(_0x41a61f){return _0x41a61f['interface']==util[_0xdb8e('0x1d')]('SIP/%s',_0x3531c2[_0xdb8e('0x1c')]);});}}return _0x88e4ba;};Report[_0xdb8e('0xf')][_0xdb8e('0x1e')]=function(_0x50ccfb){for(var _0x321bfe=0x0;_0x321bfe<_0x50ccfb['length'];_0x321bfe+=0x1){var _0x4bb954=this[_0xdb8e('0x18')](_0x50ccfb[_0x321bfe][_0xdb8e('0x1f')]);if(_0x4bb954){_0x50ccfb[_0x321bfe][_0xdb8e('0x1a')]=_0x4bb954[_0xdb8e('0x1a')];_0x50ccfb[_0x321bfe][_0xdb8e('0x20')]=!![];_0x50ccfb[_0x321bfe][_0xdb8e('0x21')]=_0x4bb954[_0xdb8e('0x1c')];_0x50ccfb[_0x321bfe]['interface']=_[_0xdb8e('0x1b')](_0x4bb954[_0xdb8e('0x22')])?util[_0xdb8e('0x1d')](_0xdb8e('0x23'),_0x4bb954[_0xdb8e('0x1c')]):_0x4bb954[_0xdb8e('0x22')];if(_0x50ccfb[_0x321bfe]['queuecallercomplete']){_0x50ccfb[_0x321bfe][_0xdb8e('0x24')]=moment()[_0xdb8e('0x1d')](_0xdb8e('0x25'));}if(_0x50ccfb[_0x321bfe][_0xdb8e('0x26')]){_0x50ccfb[_0x321bfe]['queuecallerexitAt']=moment()[_0xdb8e('0x1d')](_0xdb8e('0x25'));}RpcMemberReport[_0xdb8e('0x1e')](_0x50ccfb[_0x321bfe]);}RpcVoiceQueueReport['create'](_0x50ccfb[_0x321bfe]);}};function extractCalleridNumber(_0x17e9f3){var _0x124a74=_0x17e9f3[_0xdb8e('0x27')](/<(.*?)>/);return _0x124a74?_0x124a74[0x1]:_0x17e9f3;}Report[_0xdb8e('0xf')][_0xdb8e('0x28')]=function(_0x1ece9e){for(var _0x4147f7=0x0;_0x4147f70x0?_0x3ec795:0x0;this[_0x0e0d('0x12')][_0x1ba3fe[_0x0e0d('0x6a')]][_0x0e0d('0x58')]=this[_0x0e0d('0x12')][_0x1ba3fe[_0x0e0d('0x6a')]]['talking']>_[_0x0e0d('0x70')](_0x1ba3fe[_0x0e0d('0x71')])?_[_0x0e0d('0x70')](_0x1ba3fe['loggedin']):this[_0x0e0d('0x12')][_0x1ba3fe['queue']][_0x0e0d('0x58')];this['emitVoiceQueueSummary'](this['voiceQueues'][_0x1ba3fe['queue']],'queuesummary');}logger[_0x0e0d('0x46')](_0x0e0d('0x73'),util[_0x0e0d('0x3c')](this['voiceQueues'][_0x1ba3fe[_0x0e0d('0x6a')]],{'showHidden':![],'depth':null}));ami[_0x0e0d('0x44')](_0x0e0d('0x74'),this[_0x0e0d('0x12')][_0x1ba3fe['queue']]);}}}catch(_0xea03ee){logger[_0x0e0d('0x3a')](_0x0e0d('0x69'),util['inspect'](_0xea03ee,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0e0d('0x40')][_0x0e0d('0x19')]=function(_0x282fd1){logger[_0x0e0d('0x46')](_0x0e0d('0x75'),util[_0x0e0d('0x3c')](_0x282fd1,{'showHidden':![],'depth':null}));ami[_0x0e0d('0x44')](_0x0e0d('0x76'),{});this[_0x0e0d('0x13')]=!![];};VoiceQueueReport['prototype'][_0x0e0d('0x1b')]=function(_0x4a3209){try{if(this[_0x0e0d('0x63')](_0x4a3209)){logger[_0x0e0d('0x46')](_0x0e0d('0x77'),_0x4a3209[_0x0e0d('0x47')],util[_0x0e0d('0x3c')](_0x4a3209,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x0e0d('0xf')][_0x4a3209[_0x0e0d('0x47')]]))this['queueReports'][_0x4a3209[_0x0e0d('0x47')]]=[];if(_[_0x0e0d('0x64')](this[_0x0e0d('0x10')][_0x4a3209[_0x0e0d('0x47')]]))this[_0x0e0d('0x10')][_0x4a3209[_0x0e0d('0x47')]]={};var _0x33e017=new QueueReport();_0x33e017[_0x0e0d('0x4a')]=_0x4a3209['queue'];_0x33e017[_0x0e0d('0x5a')]=this[_0x0e0d('0x12')][_0x33e017[_0x0e0d('0x4a')]]&&this[_0x0e0d('0x12')][_0x33e017['name']]['type']?this[_0x0e0d('0x12')][_0x33e017[_0x0e0d('0x4a')]][_0x0e0d('0x5a')]||_0x0e0d('0x52'):_0x0e0d('0x52');_0x33e017['queue']=_0x4a3209[_0x0e0d('0x6a')];_0x33e017[_0x0e0d('0x78')]=moment()[_0x0e0d('0x48')](_0x0e0d('0x79'));_0x33e017['position']=_0x4a3209['position'];_0x33e017['count']=_0x4a3209[_0x0e0d('0x7a')];_0x33e017['uniqueid']=_0x4a3209['uniqueid'];_0x33e017['routealias']=this[_0x0e0d('0x10')][_0x4a3209['uniqueid']][_0x0e0d('0x7b')];logger[_0x0e0d('0x6c')](_0x0e0d('0x7c'),_0x33e017[_0x0e0d('0x4a')],_0x33e017[_0x0e0d('0x5a')]);_[_0x0e0d('0x7d')](_0x33e017,_[_0x0e0d('0x7e')](_0x4a3209,_[_0x0e0d('0x7f')](_0x33e017)));this['queueReports'][_0x4a3209['uniqueid']][_0x0e0d('0x80')](_0x33e017);this[_0x0e0d('0x10')][_0x4a3209[_0x0e0d('0x47')]]=_0x33e017;this[_0x0e0d('0x45')](_0x33e017,'queuecallerjoin');}}catch(_0x4299e8){logger['error'](_0x0e0d('0x77'),_0x4a3209[_0x0e0d('0x47')],util['inspect'](_0x4299e8,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0e0d('0x1d')]=function(_0x3855f3){try{if(this[_0x0e0d('0x63')](_0x3855f3)){logger[_0x0e0d('0x46')]('[%s][voiceQueueReport][queuecallerabandon]',_0x3855f3[_0x0e0d('0x47')],util['inspect'](_0x3855f3,{'showHidden':![],'depth':null}));if(this[_0x0e0d('0xf')][_0x3855f3['uniqueid']]){var _0x5e268b=_[_0x0e0d('0x81')](this['queueReports'][_0x3855f3[_0x0e0d('0x47')]]);_0x5e268b['queuecallercomplete']=![];_0x5e268b[_0x0e0d('0x82')]=null;_0x5e268b['holdtime']=_0x3855f3[_0x0e0d('0x83')];_0x5e268b['originalposition']=_0x3855f3[_0x0e0d('0x84')];_0x5e268b[_0x0e0d('0x1c')]=!![];_0x5e268b[_0x0e0d('0x85')]=moment()[_0x0e0d('0x48')](_0x0e0d('0x79'));_0x5e268b[_0x0e0d('0x4d')]=_0x0e0d('0x86');_0x5e268b[_0x0e0d('0x87')]=null;logger[_0x0e0d('0x6c')](_0x0e0d('0x88'),_0x5e268b[_0x0e0d('0x4a')],_0x5e268b[_0x0e0d('0x5a')]);this[_0x0e0d('0x10')][_0x3855f3['uniqueid']]=_0x5e268b;this[_0x0e0d('0x42')](_0x5e268b,_0x0e0d('0x1c'));}}}catch(_0x55cb29){logger[_0x0e0d('0x3a')](_0x0e0d('0x89'),_0x3855f3[_0x0e0d('0x47')],util[_0x0e0d('0x3c')](_0x55cb29,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0e0d('0x1f')]=function(_0x31f70c){try{if(this[_0x0e0d('0x63')](_0x31f70c)){logger[_0x0e0d('0x46')](_0x0e0d('0x8a'),_0x31f70c['uniqueid'],util[_0x0e0d('0x3c')](_0x31f70c,{'showHidden':![],'depth':null}));if(this[_0x0e0d('0xf')][_0x31f70c['uniqueid']]){var _0x3740a1=_[_0x0e0d('0x81')](this[_0x0e0d('0xf')][_0x31f70c[_0x0e0d('0x47')]]);_0x3740a1['queuecallerleaveAt']=moment()[_0x0e0d('0x48')]('YYYY-MM-DD\x20HH:mm:ss');_0x3740a1[_0x0e0d('0x8b')]=_0x31f70c['connectedlinenum'];_0x3740a1[_0x0e0d('0x8c')]=_0x31f70c[_0x0e0d('0x8c')];logger[_0x0e0d('0x6c')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x3740a1[_0x0e0d('0x4a')],_0x3740a1['type'],_0x31f70c[_0x0e0d('0x8b')],_0x31f70c[_0x0e0d('0x8c')]);this[_0x0e0d('0x10')][_0x31f70c[_0x0e0d('0x47')]]=_0x3740a1;this[_0x0e0d('0x45')](_0x3740a1,'queuecallerleave');}}}catch(_0x2100e3){logger[_0x0e0d('0x3a')](_0x0e0d('0x8a'),_0x31f70c[_0x0e0d('0x47')],util[_0x0e0d('0x3c')](_0x2100e3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0e0d('0x40')][_0x0e0d('0x23')]=function(_0x1b019a){try{if(this[_0x0e0d('0x63')](_0x1b019a)){logger[_0x0e0d('0x46')](_0x0e0d('0x8d'),_0x1b019a[_0x0e0d('0x47')],util[_0x0e0d('0x3c')](_0x1b019a,{'showHidden':![],'depth':null}));if(this[_0x0e0d('0xf')][_0x1b019a['uniqueid']]){var _0x69b75e=_[_0x0e0d('0x81')](this['queueReports'][_0x1b019a[_0x0e0d('0x47')]]);_0x69b75e[_0x0e0d('0x8e')]=!![];_0x69b75e[_0x0e0d('0x4d')]=_0x0e0d('0x8f');logger[_0x0e0d('0x6c')](_0x0e0d('0x90'),_0x69b75e['name'],_0x69b75e[_0x0e0d('0x5a')]);}}}catch(_0x5ce50e){logger[_0x0e0d('0x3a')](_0x0e0d('0x8d'),_0x1b019a[_0x0e0d('0x47')],util[_0x0e0d('0x3c')](_0x5ce50e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0e0d('0x40')][_0x0e0d('0x21')]=function(_0x341c5d){try{if(this[_0x0e0d('0x63')](_0x341c5d)){logger[_0x0e0d('0x46')](_0x0e0d('0x91'),_0x341c5d[_0x0e0d('0x47')],util[_0x0e0d('0x3c')](_0x341c5d,{'showHidden':![],'depth':null}));if(this[_0x0e0d('0xf')][_0x341c5d[_0x0e0d('0x47')]]){var _0x46f9a7=_['last'](this[_0x0e0d('0xf')][_0x341c5d[_0x0e0d('0x47')]]);_0x46f9a7[_0x0e0d('0x1c')]=![];_0x46f9a7['queuecallerabandonAt']=null;_0x46f9a7['assigned']=!![];_0x46f9a7[_0x0e0d('0x87')]=_0x341c5d[_0x0e0d('0x92')];_0x46f9a7[_0x0e0d('0x83')]=_0x341c5d['holdtime'];_0x46f9a7[_0x0e0d('0x8e')]=!![];_0x46f9a7[_0x0e0d('0x93')]=![];_0x46f9a7[_0x0e0d('0x94')]=null;if(!_0x46f9a7['transfer']){if(_0x341c5d['reason']==_0x0e0d('0x95')){_0x46f9a7['queuecallerexitreason']=_0x0e0d('0x96');logger[_0x0e0d('0x6c')](_0x0e0d('0x97'),_0x46f9a7[_0x0e0d('0x4a')],_0x46f9a7['type']);}else{if(_[_0x0e0d('0x98')](_0x341c5d[_0x0e0d('0x99')][_0x0e0d('0x9a')](),_0x0e0d('0x9b'))){if(this[_0x0e0d('0xf')][_0x341c5d[_0x0e0d('0x9c')]]){var _0x21b6d2=_[_0x0e0d('0x81')](this[_0x0e0d('0xf')][_0x341c5d['linkedid']]);_0x21b6d2['queuecallercomplete']=![];_0x21b6d2[_0x0e0d('0x93')]=!![];_0x21b6d2[_0x0e0d('0x94')]=moment(_0x46f9a7[_0x0e0d('0x78')])[_0x0e0d('0x9d')](_0x341c5d[_0x0e0d('0x83')],_0x0e0d('0x9e'))[_0x0e0d('0x48')]('YYYY-MM-DD\x20HH:mm:ss');_0x21b6d2[_0x0e0d('0x4d')]='FORWARDTRANSFER';_0x21b6d2[_0x0e0d('0x95')]=!![];_0x21b6d2['transfertype']=_0x0e0d('0x9f');_0x21b6d2[_0x0e0d('0xa0')]=_0x341c5d[_0x0e0d('0xa1')];_0x21b6d2['transferuniqueid']=_0x341c5d[_0x0e0d('0x47')];logger[_0x0e0d('0x6c')](_0x0e0d('0xa2'),_0x21b6d2['name'],_0x21b6d2[_0x0e0d('0x5a')]);var _0x3e180f=this[_0x0e0d('0xf')][_0x341c5d[_0x0e0d('0x9c')]];this[_0x0e0d('0xf')][_0x341c5d['linkedid']]=this[_0x0e0d('0xf')][_0x341c5d[_0x0e0d('0x47')]];this['queueReports'][_0x341c5d[_0x0e0d('0x47')]]=_0x3e180f;}}else{_0x46f9a7['queuecallerexitreason']=_0x0e0d('0xa3')+_0x341c5d[_0x0e0d('0xa4')][_0x0e0d('0xa5')]();logger[_0x0e0d('0x6c')](_0x0e0d('0xa6'),_0x46f9a7[_0x0e0d('0x4a')],_0x46f9a7['type'],_0x46f9a7[_0x0e0d('0x4d')]);}}}this[_0x0e0d('0x10')][_0x341c5d[_0x0e0d('0x47')]]=_0x46f9a7;this[_0x0e0d('0x42')](_0x46f9a7,_0x0e0d('0x20'));}}}catch(_0x20edef){logger[_0x0e0d('0x3a')](_0x0e0d('0x91'),_0x341c5d[_0x0e0d('0x47')],util[_0x0e0d('0x3c')](_0x20edef,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0e0d('0x40')][_0x0e0d('0xa7')]=function(_0x428cbf){try{if(this[_0x0e0d('0x63')](_0x428cbf)){logger['debug'](_0x0e0d('0xa8'),_0x428cbf['uniqueid'],util[_0x0e0d('0x3c')](_0x428cbf,{'showHidden':![],'depth':null}));this[_0x0e0d('0xa9')](_0x428cbf['uniqueid'],_['keys'](_0x428cbf['variable'])[0x0],_0x428cbf[_0x0e0d('0xaa')]);if(this[_0x0e0d('0xf')][_0x428cbf['uniqueid']]){var _0x441dd6=_[_0x0e0d('0x81')](this[_0x0e0d('0xf')][_0x428cbf[_0x0e0d('0x47')]]);if(_0x441dd6){if(this[_0x0e0d('0x63')](_0x428cbf['variable'])&&this[_0x0e0d('0x63')](_0x428cbf[_0x0e0d('0xab')]['queuestatus'])){switch(_0x428cbf[_0x0e0d('0xaa')]){case _0x0e0d('0xac'):_0x441dd6[_0x0e0d('0x93')]=![];_0x441dd6['queuecallerexitAt']=null;break;case _0x0e0d('0xad'):_0x441dd6[_0x0e0d('0xae')]='timeout';_0x441dd6['queuecallerexit']=!![];_0x441dd6[_0x0e0d('0x94')]=moment()[_0x0e0d('0x48')](_0x0e0d('0x79'));_0x441dd6[_0x0e0d('0xaf')]=moment()[_0x0e0d('0x48')](_0x0e0d('0x79'));logger['debug'](_0x0e0d('0xb0'),_0x428cbf[_0x0e0d('0x47')],util[_0x0e0d('0x3c')](_0x441dd6,{'showHidden':![],'depth':null}));ami['emit'](_0x0e0d('0xb1'),_0x441dd6);break;default:_0x441dd6[_0x0e0d('0x93')]=!![];_0x441dd6[_0x0e0d('0x94')]=moment()[_0x0e0d('0x48')](_0x0e0d('0x79'));_0x441dd6['queuecallerleaveAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x441dd6[_0x0e0d('0x1c')]=![];_0x441dd6['queuecallerabandonAt']=null;_0x441dd6[_0x0e0d('0x4d')]=_0x428cbf[_0x0e0d('0xaa')];this[_0x0e0d('0x10')][_0x428cbf[_0x0e0d('0x47')]]=_0x441dd6;this['emitVoiceQueueChannelRemove'](_0x441dd6,_0x0e0d('0x24'));}else if(this[_0x0e0d('0x63')](_0x428cbf['variable'])&&this[_0x0e0d('0x63')](_0x428cbf[_0x0e0d('0xab')][_0x0e0d('0xb2')])){if(!_0x441dd6[_0x0e0d('0x1c')]){_0x441dd6[_0x0e0d('0x93')]=!![];_0x441dd6[_0x0e0d('0x94')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x441dd6['queuecallerexitreason']=_0x0e0d('0xb3');_0x441dd6[_0x0e0d('0xaf')]=moment()[_0x0e0d('0x48')](_0x0e0d('0x79'));this[_0x0e0d('0x10')][_0x428cbf['uniqueid']]=_0x441dd6;}}logger[_0x0e0d('0x6c')](_0x0e0d('0xb4'),_0x428cbf[_0x0e0d('0x47')],_0x441dd6[_0x0e0d('0x4a')],_0x441dd6[_0x0e0d('0x5a')],_[_0x0e0d('0x7f')](_0x428cbf['variable'])[0x0],_0x428cbf['value']);_0x441dd6[_0x0e0d('0x3e')]=this[_0x0e0d('0x3e')][_0x428cbf[_0x0e0d('0x47')]];}}}}catch(_0x4251fc){logger[_0x0e0d('0x3a')](_0x0e0d('0xa8'),_0x428cbf[_0x0e0d('0x47')],util['inspect'](_0x4251fc,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0e0d('0x40')][_0x0e0d('0xa9')]=function(_0x1d762b,_0x1c6849,_0x38a312){var _0x2acfad=['rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged',_0x0e0d('0xb5'),_0x0e0d('0xb6'),_0x0e0d('0xb7'),_0x0e0d('0xb8'),_0x0e0d('0xb9'),_0x0e0d('0xba'),'bridgepeer',_0x0e0d('0xbb'),'membercalls','memberdynamic',_0x0e0d('0xbc'),_0x0e0d('0xbd'),_0x0e0d('0x92'),'memberpenalty',_0x0e0d('0xbe')];if(!_[_0x0e0d('0x37')](_0x1c6849)&&!_[_0x0e0d('0xbf')](_0x2acfad,_0x1c6849)){if(_['isUndefined'](this[_0x0e0d('0x3e')][_0x1d762b])){this['variables'][_0x1d762b]={};}this[_0x0e0d('0x3e')][_0x1d762b][_0x1c6849]=_0x38a312;}};VoiceQueueReport[_0x0e0d('0x40')]['handleHangup']=function(_0x4f2882,_0x4debaf,_0x4f6fc9){var _0x42dd1e={};for(var _0x239613=0x0;_0x2396130x0?_0x417b19:0x0;this['voiceQueues'][_0x27147f['queue']]['talking']=this['voiceQueues'][_0x27147f['queue']][_0x8abe('0x34')]>_[_0x8abe('0x77')](_0x27147f[_0x8abe('0x78')])?_[_0x8abe('0x77')](_0x27147f[_0x8abe('0x78')]):this['voiceQueues'][_0x27147f['queue']]['talking'];this[_0x8abe('0x59')](this['voiceQueues'][_0x27147f['queue']],_0x8abe('0x14'));}logger[_0x8abe('0x6b')](_0x8abe('0x79'),util[_0x8abe('0x44')](this[_0x8abe('0x10')][_0x27147f['queue']],{'showHidden':![],'depth':null}));ami[_0x8abe('0x49')](_0x8abe('0x7a'),this[_0x8abe('0x10')][_0x27147f[_0x8abe('0x72')]]);}}}catch(_0x16e607){logger[_0x8abe('0x42')](_0x8abe('0x71'),util[_0x8abe('0x44')](_0x16e607,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8abe('0x8')]['syncQueueSummaryComplete']=function(_0x3726e2){logger[_0x8abe('0x6b')](_0x8abe('0x7b'),util[_0x8abe('0x44')](_0x3726e2,{'showHidden':![],'depth':null}));ami[_0x8abe('0x49')](_0x8abe('0x7c'),{});this[_0x8abe('0x11')]=!![];};VoiceQueueReport[_0x8abe('0x8')][_0x8abe('0x19')]=function(_0x382f30){try{if(this['isNotNull'](_0x382f30)){logger['debug'](_0x8abe('0x7d'),_0x382f30[_0x8abe('0x53')],util[_0x8abe('0x44')](_0x382f30,{'showHidden':![],'depth':null}));if(_[_0x8abe('0x70')](this[_0x8abe('0xc')][_0x382f30[_0x8abe('0x53')]]))this[_0x8abe('0xc')][_0x382f30['uniqueid']]=[];if(_[_0x8abe('0x70')](this[_0x8abe('0xe')][_0x382f30[_0x8abe('0x53')]]))this[_0x8abe('0xe')][_0x382f30[_0x8abe('0x53')]]={};var _0x30027d=new QueueReport();_0x30027d[_0x8abe('0x4e')]=_0x382f30[_0x8abe('0x72')];_0x30027d['type']=this[_0x8abe('0x10')][_0x30027d[_0x8abe('0x4e')]]&&this['voiceQueues'][_0x30027d[_0x8abe('0x4e')]]['type']?this[_0x8abe('0x10')][_0x30027d[_0x8abe('0x4e')]][_0x8abe('0x62')]||_0x8abe('0x5a'):_0x8abe('0x5a');_0x30027d[_0x8abe('0x72')]=_0x382f30[_0x8abe('0x72')];_0x30027d[_0x8abe('0x7e')]=moment()[_0x8abe('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0x30027d[_0x8abe('0x7f')]=_0x382f30[_0x8abe('0x7f')];_0x30027d['count']=_0x382f30['count'];_0x30027d[_0x8abe('0x53')]=_0x382f30['uniqueid'];_0x30027d[_0x8abe('0x80')]=this['channels'][_0x382f30[_0x8abe('0x53')]][_0x8abe('0x80')];logger[_0x8abe('0x74')](_0x8abe('0x81'),_0x30027d[_0x8abe('0x4e')],_0x30027d[_0x8abe('0x62')]);_[_0x8abe('0x82')](_0x30027d,_['pick'](_0x382f30,_['keys'](_0x30027d)));this[_0x8abe('0xc')][_0x382f30[_0x8abe('0x53')]][_0x8abe('0x83')](_0x30027d);this[_0x8abe('0xe')][_0x382f30[_0x8abe('0x53')]]=_0x30027d;this[_0x8abe('0x4a')](_0x30027d,_0x8abe('0x18'));}}catch(_0x1ab918){logger[_0x8abe('0x42')]('[%s][voiceQueueReport][queuecallerjoin]',_0x382f30[_0x8abe('0x53')],util[_0x8abe('0x44')](_0x1ab918,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8abe('0x8')][_0x8abe('0x1b')]=function(_0x3b8764){try{if(this['isNotNull'](_0x3b8764)){logger[_0x8abe('0x6b')](_0x8abe('0x84'),_0x3b8764[_0x8abe('0x53')],util[_0x8abe('0x44')](_0x3b8764,{'showHidden':![],'depth':null}));if(this[_0x8abe('0xc')][_0x3b8764[_0x8abe('0x53')]]){var _0x55167a=_[_0x8abe('0x85')](this['queueReports'][_0x3b8764[_0x8abe('0x53')]]);_0x55167a['queuecallercomplete']=![];_0x55167a[_0x8abe('0x86')]=null;_0x55167a[_0x8abe('0x87')]=_0x3b8764['holdtime'];_0x55167a[_0x8abe('0x88')]=_0x3b8764[_0x8abe('0x88')];_0x55167a[_0x8abe('0x1a')]=!![];_0x55167a[_0x8abe('0x89')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x55167a[_0x8abe('0x54')]=_0x8abe('0x8a');_0x55167a[_0x8abe('0x8b')]=null;logger[_0x8abe('0x74')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x55167a[_0x8abe('0x4e')],_0x55167a[_0x8abe('0x62')]);this[_0x8abe('0xe')][_0x3b8764[_0x8abe('0x53')]]=_0x55167a;this['emitVoiceQueueChannelRemove'](_0x55167a,_0x8abe('0x1a'));}}}catch(_0x3d4d02){logger[_0x8abe('0x42')](_0x8abe('0x84'),_0x3b8764['uniqueid'],util[_0x8abe('0x44')](_0x3d4d02,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8abe('0x8')][_0x8abe('0x1d')]=function(_0x2c95d5){try{if(this['isNotNull'](_0x2c95d5)){logger[_0x8abe('0x6b')](_0x8abe('0x8c'),_0x2c95d5[_0x8abe('0x53')],util['inspect'](_0x2c95d5,{'showHidden':![],'depth':null}));if(this[_0x8abe('0xc')][_0x2c95d5[_0x8abe('0x53')]]){var _0x375ec3=_[_0x8abe('0x85')](this[_0x8abe('0xc')][_0x2c95d5[_0x8abe('0x53')]]);_0x375ec3[_0x8abe('0x8d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x375ec3[_0x8abe('0x8e')]=_0x2c95d5['connectedlinenum'];_0x375ec3[_0x8abe('0x8f')]=_0x2c95d5[_0x8abe('0x8f')];logger[_0x8abe('0x74')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x375ec3[_0x8abe('0x4e')],_0x375ec3[_0x8abe('0x62')],_0x2c95d5[_0x8abe('0x8e')],_0x2c95d5['connectedlinename']);this[_0x8abe('0xe')][_0x2c95d5[_0x8abe('0x53')]]=_0x375ec3;this[_0x8abe('0x4a')](_0x375ec3,'queuecallerleave');}}}catch(_0x288d83){logger[_0x8abe('0x42')](_0x8abe('0x8c'),_0x2c95d5['uniqueid'],util[_0x8abe('0x44')](_0x288d83,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8abe('0x8')]['syncAgentConnect']=function(_0x3459ec){try{if(this[_0x8abe('0x6f')](_0x3459ec)){logger[_0x8abe('0x6b')](_0x8abe('0x90'),_0x3459ec[_0x8abe('0x53')],util['inspect'](_0x3459ec,{'showHidden':![],'depth':null}));if(this[_0x8abe('0xc')][_0x3459ec[_0x8abe('0x53')]]){var _0x5982f3=_[_0x8abe('0x85')](this[_0x8abe('0xc')][_0x3459ec['uniqueid']]);_0x5982f3[_0x8abe('0x91')]=!![];_0x5982f3[_0x8abe('0x54')]=_0x8abe('0x92');logger['info'](_0x8abe('0x93'),_0x5982f3[_0x8abe('0x4e')],_0x5982f3[_0x8abe('0x62')]);}}}catch(_0x2f55dc){logger['error']('[%s][voiceQueueReport][agentconnect]',_0x3459ec[_0x8abe('0x53')],util[_0x8abe('0x44')](_0x2f55dc,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8abe('0x8')][_0x8abe('0x1f')]=function(_0x3ed094){try{if(this[_0x8abe('0x6f')](_0x3ed094)){logger['debug'](_0x8abe('0x94'),_0x3ed094[_0x8abe('0x53')],util[_0x8abe('0x44')](_0x3ed094,{'showHidden':![],'depth':null}));if(this[_0x8abe('0xc')][_0x3ed094[_0x8abe('0x53')]]){var _0x51cc3e=_[_0x8abe('0x85')](this[_0x8abe('0xc')][_0x3ed094['uniqueid']]);_0x51cc3e[_0x8abe('0x1a')]=![];_0x51cc3e[_0x8abe('0x89')]=null;_0x51cc3e['assigned']=!![];_0x51cc3e[_0x8abe('0x8b')]=_0x3ed094[_0x8abe('0x95')];_0x51cc3e[_0x8abe('0x87')]=_0x3ed094[_0x8abe('0x87')];_0x51cc3e['queuecallercomplete']=!![];_0x51cc3e[_0x8abe('0x96')]=![];_0x51cc3e[_0x8abe('0x97')]=null;if(!_0x51cc3e['transfer']){if(_0x3ed094['reason']==_0x8abe('0x98')){_0x51cc3e[_0x8abe('0x54')]=_0x8abe('0x99');logger[_0x8abe('0x74')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x51cc3e[_0x8abe('0x4e')],_0x51cc3e[_0x8abe('0x62')]);}else{if(_[_0x8abe('0x9a')](_0x3ed094['channel'][_0x8abe('0x9b')](),_0x8abe('0x9c'))){if(this['queueReports'][_0x3ed094[_0x8abe('0x9d')]]){var _0x2fbf89=_[_0x8abe('0x85')](this['queueReports'][_0x3ed094[_0x8abe('0x9d')]]);_0x2fbf89['queuecallercomplete']=![];_0x2fbf89['queuecallerexit']=!![];_0x2fbf89[_0x8abe('0x97')]=moment(_0x51cc3e['queuecallerjoinAt'])['add'](_0x3ed094[_0x8abe('0x87')],_0x8abe('0x9e'))[_0x8abe('0x56')](_0x8abe('0x9f'));_0x2fbf89[_0x8abe('0x54')]=_0x8abe('0xa0');_0x2fbf89[_0x8abe('0x98')]=!![];_0x2fbf89[_0x8abe('0xa1')]=_0x8abe('0xa2');_0x2fbf89[_0x8abe('0xa3')]=_0x3ed094[_0x8abe('0xa4')];_0x2fbf89[_0x8abe('0xa5')]=_0x3ed094[_0x8abe('0x53')];logger['info'](_0x8abe('0xa6'),_0x2fbf89['name'],_0x2fbf89[_0x8abe('0x62')]);var _0x2788c3=this['queueReports'][_0x3ed094[_0x8abe('0x9d')]];this[_0x8abe('0xc')][_0x3ed094['linkedid']]=this[_0x8abe('0xc')][_0x3ed094['uniqueid']];this[_0x8abe('0xc')][_0x3ed094[_0x8abe('0x53')]]=_0x2788c3;}}else{_0x51cc3e['queuecallerexitreason']='COMPLETEDBY'+_0x3ed094[_0x8abe('0xa7')][_0x8abe('0xa8')]();logger['info'](_0x8abe('0xa9'),_0x51cc3e['name'],_0x51cc3e[_0x8abe('0x62')],_0x51cc3e['queuecallerexitreason']);}}}this['channels'][_0x3ed094['uniqueid']]=_0x51cc3e;this[_0x8abe('0x51')](_0x51cc3e,_0x8abe('0x1e'));}}}catch(_0x1fffb8){logger[_0x8abe('0x42')](_0x8abe('0x94'),_0x3ed094['uniqueid'],util[_0x8abe('0x44')](_0x1fffb8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8abe('0x8')][_0x8abe('0x23')]=function(_0x511a51){try{if(this[_0x8abe('0x6f')](_0x511a51)){logger[_0x8abe('0x6b')]('[%s][voiceQueueReport][varset]',_0x511a51[_0x8abe('0x53')],util[_0x8abe('0x44')](_0x511a51,{'showHidden':![],'depth':null}));this[_0x8abe('0xaa')](_0x511a51['uniqueid'],_[_0x8abe('0xab')](_0x511a51['variable'])[0x0],_0x511a51[_0x8abe('0xac')]);if(this[_0x8abe('0xc')][_0x511a51['uniqueid']]){var _0x4e4306=_['last'](this[_0x8abe('0xc')][_0x511a51[_0x8abe('0x53')]]);if(_0x4e4306){if(this[_0x8abe('0x6f')](_0x511a51[_0x8abe('0xad')])&&this['isNotNull'](_0x511a51[_0x8abe('0xad')][_0x8abe('0xae')])){switch(_0x511a51['value']){case'CONTINUE':_0x4e4306[_0x8abe('0x96')]=![];_0x4e4306[_0x8abe('0x97')]=null;break;case _0x8abe('0xaf'):_0x4e4306[_0x8abe('0xb0')]=_0x8abe('0xb1');_0x4e4306[_0x8abe('0x96')]=!![];_0x4e4306[_0x8abe('0x97')]=moment()['format'](_0x8abe('0x9f'));_0x4e4306['queuecallerleaveAt']=moment()[_0x8abe('0x56')](_0x8abe('0x9f'));logger[_0x8abe('0x6b')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x511a51['uniqueid'],util[_0x8abe('0x44')](_0x4e4306,{'showHidden':![],'depth':null}));ami[_0x8abe('0x49')](_0x8abe('0xb2'),_0x4e4306);break;default:_0x4e4306[_0x8abe('0x96')]=!![];_0x4e4306[_0x8abe('0x97')]=moment()[_0x8abe('0x56')](_0x8abe('0x9f'));_0x4e4306[_0x8abe('0x8d')]=moment()[_0x8abe('0x56')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4e4306[_0x8abe('0x1a')]=![];_0x4e4306[_0x8abe('0x89')]=null;_0x4e4306[_0x8abe('0x54')]=_0x511a51[_0x8abe('0xac')];this[_0x8abe('0xe')][_0x511a51[_0x8abe('0x53')]]=_0x4e4306;this[_0x8abe('0x51')](_0x4e4306,_0x8abe('0x22'));}else if(this[_0x8abe('0x6f')](_0x511a51['variable'])&&this[_0x8abe('0x6f')](_0x511a51[_0x8abe('0xad')][_0x8abe('0xb3')])){if(!_0x4e4306[_0x8abe('0x1a')]){_0x4e4306[_0x8abe('0x96')]=!![];_0x4e4306[_0x8abe('0x97')]=moment()[_0x8abe('0x56')](_0x8abe('0x9f'));_0x4e4306[_0x8abe('0x54')]=_0x8abe('0xb4');_0x4e4306[_0x8abe('0x8d')]=moment()['format'](_0x8abe('0x9f'));this[_0x8abe('0xe')][_0x511a51[_0x8abe('0x53')]]=_0x4e4306;}}logger[_0x8abe('0x74')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x511a51[_0x8abe('0x53')],_0x4e4306[_0x8abe('0x4e')],_0x4e4306[_0x8abe('0x62')],_['keys'](_0x511a51[_0x8abe('0xad')])[0x0],_0x511a51[_0x8abe('0xac')]);_0x4e4306[_0x8abe('0x13')]=this['variables'][_0x511a51[_0x8abe('0x53')]];}}}}catch(_0x12d108){logger['error'](_0x8abe('0xb5'),_0x511a51[_0x8abe('0x53')],util[_0x8abe('0x44')](_0x12d108,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8abe('0x8')][_0x8abe('0xaa')]=function(_0x3cc3ad,_0x4b7933,_0x3e7f8d){var _0x50bf53=['rtpaudioqos',_0x8abe('0xb6'),'rtpaudioqosjitter',_0x8abe('0xb7'),'rtpaudioqosloss',_0x8abe('0xb8'),'rtpaudioqosrtt',_0x8abe('0xb9'),_0x8abe('0xba'),_0x8abe('0xbb'),_0x8abe('0xbc'),_0x8abe('0xbd'),_0x8abe('0xbe'),'memberdynamic',_0x8abe('0xbf'),_0x8abe('0xc0'),'membername','memberpenalty','memberrealtime'];if(!_[_0x8abe('0xc1')](_0x4b7933)&&!_[_0x8abe('0xc2')](_0x50bf53,_0x4b7933)){if(_['isUndefined'](this[_0x8abe('0x13')][_0x3cc3ad])){this[_0x8abe('0x13')][_0x3cc3ad]={};}this['variables'][_0x3cc3ad][_0x4b7933]=_0x3e7f8d;}};VoiceQueueReport[_0x8abe('0x8')]['handleHangup']=function(_0x31780e,_0x38c7d4,_0x468d5a){var _0x32d8b7={};for(var _0x5443ca=0x0;_0x5443ca=0x0?moment(_0xe7a21b[_0xa11b('0x17')])['diff'](_0xe7a21b[_0xa11b('0x16')],_0xa11b('0xf')):null,'data1':'outbound','data2':_0xe7a21b['accountcode'],'data3':_0xe7a21b[_0xa11b('0x18')],'data4':_0xe7a21b[_0xa11b('0x19')]||null,'role':_0xa11b('0x12'),'internal':_0xe7a21b[_0xa11b('0x13')]?_['toNumber'](_0xe7a21b[_0xa11b('0x13')]):undefined,'uniqueid':_0xe7a21b[_0xa11b('0x1a')]},'log':_0xa11b('0x14')});}; \ No newline at end of file +var _0xd471=['voice','lastAssignedTo','format','SIP/%s','queuecallerleaveAt','calleridnum','exten','agent','accountcode','toNumber','CreateMemberReport','voiceDialReport','membername','interface','TALKING','starttime','endtime','diff','seconds','outbound','dialstring','util','../client','voiceQueueReport','queuecallercompleteAt'];(function(_0x4aa7da,_0x2523cc){var _0x164a9c=function(_0x13cb2f){while(--_0x13cb2f){_0x4aa7da['push'](_0x4aa7da['shift']());}};_0x164a9c(++_0x2523cc);}(_0xd471,0xf6));var _0x1d47=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xd471[_0x278e3c];return _0x3e2d9b;};'use strict';var moment=require('moment');var _=require('lodash');var util=require(_0x1d47('0x0'));var client=require(_0x1d47('0x1'));exports[_0x1d47('0x2')]=function(_0x44b509){var _0x2c1a9b=_0x44b509[_0x1d47('0x3')]||_0x44b509['queuecallerexitAt'];return client['Request']('CreateMemberReport',{'body':{'channel':_0x1d47('0x4'),'membername':_0x44b509[_0x1d47('0x5')],'interface':_['isNil'](_0x44b509['interface'])?util[_0x1d47('0x6')](_0x1d47('0x7'),_0x44b509['lastAssignedTo']):_0x44b509['interface'],'type':'TALKING','enterAt':_0x44b509['queuecallerleaveAt'],'exitAt':_0x2c1a9b,'duration':moment(_0x2c1a9b)['diff'](_0x44b509[_0x1d47('0x8')],'seconds'),'data1':'inbound','data2':_0x44b509[_0x1d47('0x9')],'data3':_0x44b509[_0x1d47('0xa')],'data4':null,'data5':_0x44b509['queue'],'role':_0x1d47('0xb'),'internal':_0x44b509[_0x1d47('0xc')]?_[_0x1d47('0xd')](_0x44b509[_0x1d47('0xc')]):undefined,'uniqueid':_0x44b509['uniqueid']},'log':_0x1d47('0xe')});};exports[_0x1d47('0xf')]=function(_0x1d369d){return client['Request'](_0x1d47('0xe'),{'body':{'channel':_0x1d47('0x4'),'membername':_0x1d369d[_0x1d47('0x10')],'interface':_0x1d369d[_0x1d47('0x11')],'type':_0x1d47('0x12'),'enterAt':_0x1d369d[_0x1d47('0x13')],'exitAt':_0x1d369d[_0x1d47('0x14')],'duration':moment(_0x1d369d[_0x1d47('0x14')])[_0x1d47('0x15')](_0x1d369d[_0x1d47('0x13')],_0x1d47('0x16'))>=0x0?moment(_0x1d369d[_0x1d47('0x14')])['diff'](_0x1d369d[_0x1d47('0x13')],_0x1d47('0x16')):null,'data1':_0x1d47('0x17'),'data2':_0x1d369d[_0x1d47('0xc')],'data3':_0x1d369d[_0x1d47('0xa')],'data4':_0x1d369d[_0x1d47('0x18')]||null,'role':_0x1d47('0xb'),'internal':_0x1d369d[_0x1d47('0xc')]?_['toNumber'](_0x1d369d[_0x1d47('0xc')]):undefined,'uniqueid':_0x1d369d['uniqueid']},'log':_0x1d47('0xe')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index b76f5b6..c81ca6f 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 _0xc64b=['../client','getSettings','Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings'];(function(_0x187279,_0x26d152){var _0x3da59d=function(_0x41c808){while(--_0x41c808){_0x187279['push'](_0x187279['shift']());}};_0x3da59d(++_0x26d152);}(_0xc64b,0xaf));var _0xbc64=function(_0x2f58ea,_0x2c8f38){_0x2f58ea=_0x2f58ea-0x0;var _0x514770=_0xc64b[_0x2f58ea];return _0x514770;};'use strict';var client=require(_0xbc64('0x0'));exports[_0xbc64('0x1')]=function(){return client[_0xbc64('0x2')](_0xbc64('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xbc64('0x4'),_0xbc64('0x5')]},'log':_0xbc64('0x6')});}; \ No newline at end of file +var _0xbb35=['stopRecordingOnTransfer','previewRecallmeReminderInterval','getSettings','Request','ShowSetting'];(function(_0x42ea2f,_0xce1c67){var _0x4009cc=function(_0x5bd326){while(--_0x5bd326){_0x42ea2f['push'](_0x42ea2f['shift']());}};_0x4009cc(++_0xce1c67);}(_0xbb35,0x1d3));var _0x5bb3=function(_0x3b6d14,_0x51bb77){_0x3b6d14=_0x3b6d14-0x0;var _0x31e253=_0xbb35[_0x3b6d14];return _0x31e253;};'use strict';var client=require('../client');exports[_0x5bb3('0x0')]=function(){return client[_0x5bb3('0x1')](_0x5bb3('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x5bb3('0x3'),_0x5bb3('0x4')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index cecccac..0d36cc7 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 _0xfc82=['getTemplates','Request','GetTemplate','name','html','../client'];(function(_0x770f7,_0x3af003){var _0xe797c6=function(_0x47d92a){while(--_0x47d92a){_0x770f7['push'](_0x770f7['shift']());}};_0xe797c6(++_0x3af003);}(_0xfc82,0xe9));var _0x2fc8=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xfc82[_0x5ddb1c];return _0x354adc;};'use strict';var client=require(_0x2fc8('0x0'));exports[_0x2fc8('0x1')]=function(_0x1b2b81){return function(_0x3143e5){return client[_0x2fc8('0x2')](_0x2fc8('0x3'),{'options':{'raw':!![],'attributes':['id',_0x2fc8('0x4'),_0x2fc8('0x5')]},'log':_0x2fc8('0x3')});};}; \ No newline at end of file +var _0x47b1=['Request','GetTemplate','html','getTemplates'];(function(_0x276ab6,_0x25e570){var _0x2d13b3=function(_0x360f49){while(--_0x360f49){_0x276ab6['push'](_0x276ab6['shift']());}};_0x2d13b3(++_0x25e570);}(_0x47b1,0x143));var _0x147b=function(_0x1f2dd6,_0x2b7c75){_0x1f2dd6=_0x1f2dd6-0x0;var _0x23bc29=_0x47b1[_0x1f2dd6];return _0x23bc29;};'use strict';var client=require('../client');exports[_0x147b('0x0')]=function(_0x125d9a){return function(_0x219680){return client[_0x147b('0x1')](_0x147b('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0x147b('0x3')]},'log':_0x147b('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 09c6f21..1e85123 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 _0xe8ee=['Condition','AllConditions','field','operator','value','AnyConditions','Action','Actions','action','data3','data4','data6','data7','GetTrigger','../client','getTriggers','Request','name','channel'];(function(_0x142084,_0x1f0921){var _0x427bba=function(_0x89b2b7){while(--_0x89b2b7){_0x142084['push'](_0x142084['shift']());}};_0x427bba(++_0x1f0921);}(_0xe8ee,0xcc));var _0xee8e=function(_0x3d3e9c,_0x48932e){_0x3d3e9c=_0x3d3e9c-0x0;var _0x20f4e6=_0xe8ee[_0x3d3e9c];return _0x20f4e6;};'use strict';var client=require(_0xee8e('0x0'));exports[_0xee8e('0x1')]=function(_0x4404b4){return function(_0x2922ae){return client[_0xee8e('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0xee8e('0x3'),_0xee8e('0x4'),'status'],'include':[{'model':_0xee8e('0x5'),'as':_0xee8e('0x6'),'attributes':['id',_0xee8e('0x7'),_0xee8e('0x8'),_0xee8e('0x9')]},{'model':_0xee8e('0x5'),'as':_0xee8e('0xa'),'attributes':['id',_0xee8e('0x7'),_0xee8e('0x8'),'value']},{'model':_0xee8e('0xb'),'as':_0xee8e('0xc'),'attributes':['id',_0xee8e('0xd'),'data1','data2',_0xee8e('0xe'),_0xee8e('0xf'),'data5',_0xee8e('0x10'),_0xee8e('0x11')]}]},'log':_0xee8e('0x12')});};}; \ No newline at end of file +var _0xc9b7=['AllConditions','field','value','AnyConditions','operator','Action','Actions','data1','data3','data4','data6','data7','../client','getTriggers','Request','GetTrigger','Condition'];(function(_0x1235d4,_0x77ef1f){var _0x26f141=function(_0x1d0dcf){while(--_0x1d0dcf){_0x1235d4['push'](_0x1235d4['shift']());}};_0x26f141(++_0x77ef1f);}(_0xc9b7,0xb6));var _0x7c9b=function(_0xc5caf7,_0xc6d31b){_0xc5caf7=_0xc5caf7-0x0;var _0x509351=_0xc9b7[_0xc5caf7];return _0x509351;};'use strict';var client=require(_0x7c9b('0x0'));exports[_0x7c9b('0x1')]=function(_0x3c0f8c){return function(_0x28e402){return client[_0x7c9b('0x2')](_0x7c9b('0x3'),{'options':{'raw':![],'attributes':['id','name','channel','status'],'include':[{'model':_0x7c9b('0x4'),'as':_0x7c9b('0x5'),'attributes':['id',_0x7c9b('0x6'),'operator',_0x7c9b('0x7')]},{'model':'Condition','as':_0x7c9b('0x8'),'attributes':['id',_0x7c9b('0x6'),_0x7c9b('0x9'),_0x7c9b('0x7')]},{'model':_0x7c9b('0xa'),'as':_0x7c9b('0xb'),'attributes':['id','action',_0x7c9b('0xc'),'data2',_0x7c9b('0xd'),_0x7c9b('0xe'),'data5',_0x7c9b('0xf'),_0x7c9b('0x10')]}]},'log':_0x7c9b('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index e7527ca..8f228d9 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 _0x362a=['getTrunks','Request','GetTrunk','name','registry','defaultuser','../client'];(function(_0x556baf,_0x8d8108){var _0x3ab9d3=function(_0x5ee7a1){while(--_0x5ee7a1){_0x556baf['push'](_0x556baf['shift']());}};_0x3ab9d3(++_0x8d8108);}(_0x362a,0x102));var _0xa362=function(_0x2fbe5f,_0x4c5c13){_0x2fbe5f=_0x2fbe5f-0x0;var _0x21db60=_0x362a[_0x2fbe5f];return _0x21db60;};'use strict';var client=require(_0xa362('0x0'));exports[_0xa362('0x1')]=function(_0x28361b){return function(_0x17a288){return client[_0xa362('0x2')](_0xa362('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xa362('0x4'),_0xa362('0x5'),_0xa362('0x6')]},'log':_0xa362('0x3')});};}; \ No newline at end of file +var _0x6f3a=['GetTrunk','getTrunks','Request','name','defaultuser'];(function(_0xfe8227,_0xf3d020){var _0x484ca6=function(_0x366614){while(--_0x366614){_0xfe8227['push'](_0xfe8227['shift']());}};_0x484ca6(++_0xf3d020);}(_0x6f3a,0xe7));var _0xa6f3=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x6f3a[_0x2c91e9];return _0x13f0ff;};'use strict';var client=require('../client');exports[_0xa6f3('0x0')]=function(_0x4f613b){return function(_0x482c12){return client[_0xa6f3('0x1')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xa6f3('0x2'),'registry',_0xa6f3('0x3')]},'log':_0xa6f3('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 680af95..480aba0 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(_0x2668f7,_0x1818b3){var _0x1181c4=function(_0x9c7e93){while(--_0x9c7e93){_0x2668f7['push'](_0x2668f7['shift']());}};_0x1181c4(++_0x1818b3);}(_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 _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0xbe06e1,_0x102e15){var _0x3c6355=function(_0x4f7849){while(--_0x4f7849){_0xbe06e1['push'](_0xbe06e1['shift']());}};_0x3c6355(++_0x102e15);}(_0x9c44,0x178));var _0x49c4=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x9c44[_0x2064e5];return _0x21a233;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 7b2d58c..251b0eb 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 _0x7372=['../client','create','Request','CreateVoiceAgentReport','UpdateVoiceAgentReport'];(function(_0x174a72,_0x46034c){var _0x32cecd=function(_0x188a47){while(--_0x188a47){_0x174a72['push'](_0x174a72['shift']());}};_0x32cecd(++_0x46034c);}(_0x7372,0x186));var _0x2737=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7372[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x2737('0x0'));exports[_0x2737('0x1')]=function(_0x45fde7){return client[_0x2737('0x2')](_0x2737('0x3'),{'body':_0x45fde7,'log':'CreateVoiceAgentReport'});};exports['update']=function(_0x33bda4,_0x3c0cf9,_0x185b93){return client[_0x2737('0x2')](_0x2737('0x4'),{'body':_0x33bda4,'options':{'where':{'uniqueid':_0x3c0cf9,'interface':_0x185b93,'agentcomplete':!![]}},'log':_0x2737('0x4')});}; \ No newline at end of file +var _0x68d9=['../client','create','Request','CreateVoiceAgentReport','UpdateVoiceAgentReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x68d9,0xc8));var _0x968d=function(_0x3ff3b9,_0xc9b977){_0x3ff3b9=_0x3ff3b9-0x0;var _0x4f6dcf=_0x68d9[_0x3ff3b9];return _0x4f6dcf;};'use strict';var client=require(_0x968d('0x0'));exports[_0x968d('0x1')]=function(_0x29abb5){return client[_0x968d('0x2')](_0x968d('0x3'),{'body':_0x29abb5,'log':_0x968d('0x3')});};exports['update']=function(_0x5cb384,_0x466689,_0x544dcc){return client[_0x968d('0x2')](_0x968d('0x4'),{'body':_0x5cb384,'options':{'where':{'uniqueid':_0x466689,'interface':_0x544dcc,'agentcomplete':!![]}},'log':_0x968d('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 250f9c6..87d46cc 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 _0xaada=['CreateVoiceCallReport','merge','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','lodash','../client','create','Request'];(function(_0x33a5ec,_0x10c014){var _0x38f89c=function(_0x15f7ee){while(--_0x15f7ee){_0x33a5ec['push'](_0x33a5ec['shift']());}};_0x38f89c(++_0x10c014);}(_0xaada,0x154));var _0xaaad=function(_0x42ae45,_0x480fb9){_0x42ae45=_0x42ae45-0x0;var _0x189f82=_0xaada[_0x42ae45];return _0x189f82;};'use strict';var moment=require(_0xaaad('0x0'));var util=require('util');var _=require(_0xaaad('0x1'));var client=require(_0xaaad('0x2'));exports[_0xaaad('0x3')]=function(_0x36ade4){return client[_0xaaad('0x4')](_0xaaad('0x5'),{'body':_[_0xaaad('0x6')](_0x36ade4,{'source':_0x36ade4['calleridnum'],'destinationcontext':_0x36ade4[_0xaaad('0x7')],'callerid':_0x36ade4[_0xaaad('0x8')],'amaflags':_0xaaad('0x9')}),'log':_0xaaad('0x5')});};exports[_0xaaad('0xa')]=function(){return function(){return client[_0xaaad('0x4')](_0xaaad('0xb'),{'options':{'where':{'type':[_0xaaad('0xc')],'createdAt':{'$between':[moment()[_0xaaad('0xd')](_0xaaad('0xe'))[_0xaaad('0xf')](_0xaaad('0x10')),moment()[_0xaaad('0x11')](_0xaaad('0xe'))[_0xaaad('0xf')](_0xaaad('0x10'))]}},'attributes':[_0xaaad('0x12'),_0xaaad('0x13'),_0xaaad('0x14'),_0xaaad('0x15')]},'log':_0xaaad('0x16')});};}; \ No newline at end of file +var _0x1c98=['CreateVoiceCallReport','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','lodash','../client','create','Request'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1c98,0x163));var _0x81c9=function(_0x15f6a4,_0x573448){_0x15f6a4=_0x15f6a4-0x0;var _0xc82f13=_0x1c98[_0x15f6a4];return _0xc82f13;};'use strict';var moment=require(_0x81c9('0x0'));var util=require('util');var _=require(_0x81c9('0x1'));var client=require(_0x81c9('0x2'));exports[_0x81c9('0x3')]=function(_0x217b93){return client[_0x81c9('0x4')](_0x81c9('0x5'),{'body':_['merge'](_0x217b93,{'source':_0x217b93['calleridnum'],'destinationcontext':_0x217b93[_0x81c9('0x6')],'callerid':_0x217b93[_0x81c9('0x7')],'amaflags':_0x81c9('0x8')}),'log':_0x81c9('0x5')});};exports[_0x81c9('0x9')]=function(){return function(){return client[_0x81c9('0x4')](_0x81c9('0xa'),{'options':{'where':{'type':[_0x81c9('0xb')],'createdAt':{'$between':[moment()['startOf'](_0x81c9('0xc'))[_0x81c9('0xd')](_0x81c9('0xe')),moment()['endOf']('day')[_0x81c9('0xd')](_0x81c9('0xe'))]}},'attributes':[_0x81c9('0xf'),_0x81c9('0x10'),_0x81c9('0x11'),_0x81c9('0x12')]},'log':_0x81c9('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index bb68614..9c0fab3 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 _0xe773=['create','CreateVoiceDialReport'];(function(_0x34924c,_0x22a5b1){var _0x2ef99d=function(_0x2825f7){while(--_0x2825f7){_0x34924c['push'](_0x34924c['shift']());}};_0x2ef99d(++_0x22a5b1);}(_0xe773,0xa6));var _0x3e77=function(_0x277f2b,_0x146b69){_0x277f2b=_0x277f2b-0x0;var _0x32f2eb=_0xe773[_0x277f2b];return _0x32f2eb;};'use strict';var client=require('../client');exports[_0x3e77('0x0')]=function(_0x286d98){return client['Request']('CreateVoiceDialReport',{'body':_0x286d98,'log':_0x3e77('0x1')});}; \ No newline at end of file +var _0xb7b4=['CreateVoiceDialReport','../client','create'];(function(_0x956efd,_0x50b0fd){var _0x27784d=function(_0xba4c2c){while(--_0xba4c2c){_0x956efd['push'](_0x956efd['shift']());}};_0x27784d(++_0x50b0fd);}(_0xb7b4,0xd9));var _0x4b7b=function(_0x4191a6,_0x2100c6){_0x4191a6=_0x4191a6-0x0;var _0x4ad007=_0xb7b4[_0x4191a6];return _0x4ad007;};'use strict';var client=require(_0x4b7b('0x0'));exports[_0x4b7b('0x1')]=function(_0x1d313c){return client['Request'](_0x4b7b('0x2'),{'body':_0x1d313c,'log':_0x4b7b('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 807ddec..e4a5403 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 _0x5712=['exten','recordingFormat','../client','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x410efa,_0xe0d0f4){var _0xc7397c=function(_0x484ebf){while(--_0x484ebf){_0x410efa['push'](_0x410efa['shift']());}};_0xc7397c(++_0xe0d0f4);}(_0x5712,0x140));var _0x2571=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x5712[_0x5b644e];return _0x49c6bf;};'use strict';var client=require(_0x2571('0x0'));exports[_0x2571('0x1')]=function(){return function(){return client[_0x2571('0x2')](_0x2571('0x3'),{'options':{'raw':!![],'attributes':['id',_0x2571('0x4'),_0x2571('0x5')],'where':{'VoiceExtensionId':null}},'log':_0x2571('0x1')});};}; \ No newline at end of file +var _0x97f5=['Request','recordingFormat','../client','getVoiceExtensions'];(function(_0x5409c8,_0x5208f4){var _0x4cfaf5=function(_0x1ada9d){while(--_0x1ada9d){_0x5409c8['push'](_0x5409c8['shift']());}};_0x4cfaf5(++_0x5208f4);}(_0x97f5,0x72));var _0x597f=function(_0xba49b2,_0x280ef3){_0xba49b2=_0xba49b2-0x0;var _0x47863c=_0x97f5[_0xba49b2];return _0x47863c;};'use strict';var client=require(_0x597f('0x0'));exports[_0x597f('0x1')]=function(){return function(){return client[_0x597f('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id','exten',_0x597f('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x597f('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 7b7b4c2..096d87e 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 _0x7a37=['dialPredictiveIntervalMaxThreshold','dialPreviewRecallmeReminder','callAdditionalPhoneAfterMin','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','../client','getVoiceQueues','GetVoiceQueue','name','acw','acwTimeout','autopause','type','dialMethod','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0x7a37,0xd4));var _0x77a3=function(_0x517fc3,_0x384d51){_0x517fc3=_0x517fc3-0x0;var _0xc4a05c=_0x7a37[_0x517fc3];return _0xc4a05c;};'use strict';var client=require(_0x77a3('0x0'));exports[_0x77a3('0x1')]=function(){return function(){return client['Request'](_0x77a3('0x2'),{'options':{'raw':![],'attributes':['id',_0x77a3('0x3'),_0x77a3('0x4'),_0x77a3('0x5'),_0x77a3('0x6'),'monitor_format',_0x77a3('0x7'),'dialActive',_0x77a3('0x8'),'dialLimitChannel','dialLimitQueue',_0x77a3('0x9'),_0x77a3('0xa'),_0x77a3('0xb'),_0x77a3('0xc'),_0x77a3('0xd'),_0x77a3('0xe'),_0x77a3('0xf'),_0x77a3('0x10'),_0x77a3('0x11'),_0x77a3('0x12'),_0x77a3('0x13'),_0x77a3('0x14'),'dialBusyMaxRetry','dialBusyRetryFrequency',_0x77a3('0x15'),_0x77a3('0x16'),_0x77a3('0x17'),_0x77a3('0x18'),_0x77a3('0x19'),_0x77a3('0x1a'),_0x77a3('0x1b'),_0x77a3('0x1c'),_0x77a3('0x1d'),_0x77a3('0x1e'),_0x77a3('0x1f'),_0x77a3('0x20'),'dialAMDMinWordLength',_0x77a3('0x21'),_0x77a3('0x22'),_0x77a3('0x23'),_0x77a3('0x24'),'timeout',_0x77a3('0x25'),_0x77a3('0x26'),_0x77a3('0x27'),_0x77a3('0x28'),_0x77a3('0x29'),_0x77a3('0x2a'),_0x77a3('0x2b'),'strategy','dialRandomLastDigitCallerIdNumber',_0x77a3('0x2c'),_0x77a3('0x2d'),_0x77a3('0x2e'),_0x77a3('0x2f'),_0x77a3('0x30'),_0x77a3('0x31'),_0x77a3('0x32'),_0x77a3('0x33'),_0x77a3('0x34'),_0x77a3('0x35'),_0x77a3('0x36'),_0x77a3('0x37'),_0x77a3('0x38'),'dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe',_0x77a3('0x39'),_0x77a3('0x3a')],'include':[{'model':_0x77a3('0x3b'),'as':_0x77a3('0x3b'),'attributes':['id','name',_0x77a3('0x3c'),_0x77a3('0x3d')]},{'model':_0x77a3('0x3e'),'as':_0x77a3('0x3f'),'attributes':['id',_0x77a3('0x3')]},{'model':'Trunk','as':_0x77a3('0x40'),'attributes':['id',_0x77a3('0x3'),_0x77a3('0x3c'),_0x77a3('0x3d')]},{'model':_0x77a3('0x41'),'as':_0x77a3('0x41'),'attributes':['id',_0x77a3('0x3')],'include':[{'model':_0x77a3('0x41'),'as':_0x77a3('0x42'),'attributes':['id',_0x77a3('0x3'),'interval']}]}]},'log':_0x77a3('0x1')});};}; \ No newline at end of file +var _0x928a=['dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','callAdditionalPhoneAfterMin','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','interval','../client','getVoiceQueues','Request','name','acw','acwTimeout','monitor_format','dialActive','dialMethod'];(function(_0x3ed9ed,_0x5841b0){var _0x4e9106=function(_0x20949b){while(--_0x20949b){_0x3ed9ed['push'](_0x3ed9ed['shift']());}};_0x4e9106(++_0x5841b0);}(_0x928a,0x1e7));var _0xa928=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x928a[_0x16b9ed];return _0x66b1f8;};'use strict';var client=require(_0xa928('0x0'));exports[_0xa928('0x1')]=function(){return function(){return client[_0xa928('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0xa928('0x3'),_0xa928('0x4'),_0xa928('0x5'),'autopause',_0xa928('0x6'),'type',_0xa928('0x7'),_0xa928('0x8'),'dialLimitChannel','dialLimitQueue',_0xa928('0x9'),_0xa928('0xa'),_0xa928('0xb'),_0xa928('0xc'),_0xa928('0xd'),'dialOriginateCallerIdNumber',_0xa928('0xe'),_0xa928('0xf'),_0xa928('0x10'),_0xa928('0x11'),'dialCongestionMaxRetry',_0xa928('0x12'),_0xa928('0x13'),'dialBusyRetryFrequency',_0xa928('0x14'),_0xa928('0x15'),_0xa928('0x16'),_0xa928('0x17'),_0xa928('0x18'),'dialPrefix',_0xa928('0x19'),_0xa928('0x1a'),_0xa928('0x1b'),'dialAMDGreeting',_0xa928('0x1c'),_0xa928('0x1d'),_0xa928('0x1e'),'dialAMDBetweenWordsSilence',_0xa928('0x1f'),_0xa928('0x20'),_0xa928('0x21'),'timeout',_0xa928('0x22'),'dialRecallInQueue',_0xa928('0x23'),_0xa928('0x24'),_0xa928('0x25'),_0xa928('0x26'),'monitor_format',_0xa928('0x27'),'dialRandomLastDigitCallerIdNumber',_0xa928('0x28'),_0xa928('0x29'),_0xa928('0x2a'),_0xa928('0x2b'),_0xa928('0x2c'),'dialAbandonedMaxRetry',_0xa928('0x2d'),'dialMachineMaxRetry',_0xa928('0x2e'),_0xa928('0x2f'),_0xa928('0x30'),_0xa928('0x31'),_0xa928('0x32'),'dialPredictiveIntervalMinThreshold',_0xa928('0x33'),_0xa928('0x34'),_0xa928('0x35')],'include':[{'model':_0xa928('0x36'),'as':_0xa928('0x36'),'attributes':['id','name',_0xa928('0x37'),_0xa928('0x38')]},{'model':_0xa928('0x39'),'as':_0xa928('0x3a'),'attributes':['id',_0xa928('0x3')]},{'model':'Trunk','as':_0xa928('0x3b'),'attributes':['id',_0xa928('0x3'),_0xa928('0x37'),_0xa928('0x38')]},{'model':'Interval','as':_0xa928('0x3c'),'attributes':['id',_0xa928('0x3')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0xa928('0x3'),_0xa928('0x3d')]}]}]},'log':_0xa928('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 4cde117..5e34884 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(_0x3b9f9e,_0x1daa8e){var _0x146940=function(_0x57ca54){while(--_0x57ca54){_0x3b9f9e['push'](_0x3b9f9e['shift']());}};_0x146940(++_0x1daa8e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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(_0x3af577,_0x2c9dee){var _0x2f9bc3=function(_0x19e171){while(--_0x19e171){_0x3af577['push'](_0x3af577['shift']());}};_0x2f9bc3(++_0x2c9dee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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 f46bf4e..268988d 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 _0x92e3=['../client','Request'];(function(_0x18c87b,_0x1ed7fb){var _0x1314a1=function(_0x56af8d){while(--_0x56af8d){_0x18c87b['push'](_0x18c87b['shift']());}};_0x1314a1(++_0x1ed7fb);}(_0x92e3,0x1e6));var _0x392e=function(_0x48808d,_0x552678){_0x48808d=_0x48808d-0x0;var _0x21b737=_0x92e3[_0x48808d];return _0x21b737;};'use strict';var client=require(_0x392e('0x0'));exports['getVoiceQueueRtPauses']=function(_0x3e02d7){return function(){return client[_0x392e('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x3e02d7,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0xed99=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x1b61d9,_0x33d7b2){var _0x1c87ec=function(_0x7b02d7){while(--_0x7b02d7){_0x1b61d9['push'](_0x1b61d9['shift']());}};_0x1c87ec(++_0x33d7b2);}(_0xed99,0x106));var _0x9ed9=function(_0x392e47,_0x390942){_0x392e47=_0x392e47-0x0;var _0x229ddb=_0xed99[_0x392e47];return _0x229ddb;};'use strict';var client=require(_0x9ed9('0x0'));exports[_0x9ed9('0x1')]=function(_0xff5d18){return function(){return client['Request'](_0x9ed9('0x2'),{'options':{'where':{'VoiceQueueId':_0xff5d18,'paused':!![]},'raw':!![]},'log':_0x9ed9('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index dcc3f20..eb356b0 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(_0x558477,_0x1e6fe0){var _0x496388=function(_0xfdb954){while(--_0xfdb954){_0x558477['push'](_0x558477['shift']());}};_0x496388(++_0x1e6fe0);}(_0x7a54,0x106));var _0x47a5=function(_0x1dcfcb,_0xa357fe){_0x1dcfcb=_0x1dcfcb-0x0;var _0x565d6e=_0x7a54[_0x1dcfcb];return _0x565d6e;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x4eb934,_0x5a1c14){var _0x57faa5=function(_0x203ecf){while(--_0x203ecf){_0x4eb934['push'](_0x4eb934['shift']());}};_0x57faa5(++_0x5a1c14);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index cebed33..181a140 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 _0xdd22=['transfereeaccountcode','transfereecontext','transfereelinkedid','isexternal','extension','blind','attendedTransfer','origtransfererchannel','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','origtransferercontext','origtransfererexten','../client','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename'];(function(_0x7e0d54,_0x217215){var _0x46f5a1=function(_0x1eed50){while(--_0x1eed50){_0x7e0d54['push'](_0x7e0d54['shift']());}};_0x46f5a1(++_0x217215);}(_0xdd22,0xbf));var _0x2dd2=function(_0x14c480,_0x21ddee){_0x14c480=_0x14c480-0x0;var _0x2a0986=_0xdd22[_0x14c480];return _0x2a0986;};'use strict';var client=require(_0x2dd2('0x0'));exports['transfers']={};exports['blindTransfer']=function(_0x3579ae){return client[_0x2dd2('0x1')](_0x2dd2('0x2'),{'body':{'result':_0x3579ae[_0x2dd2('0x3')],'transfererchannel':_0x3579ae[_0x2dd2('0x4')],'transferercalleridnum':_0x3579ae[_0x2dd2('0x5')],'transferercalleridname':_0x3579ae[_0x2dd2('0x6')],'transfererconnectedlinenum':_0x3579ae['transfererconnectedlinenum'],'transfererconnectedlinename':_0x3579ae[_0x2dd2('0x7')],'transfereraccountcode':_0x3579ae[_0x2dd2('0x8')],'transferercontext':_0x3579ae['transferercontext'],'transfererexten':_0x3579ae['transfererexten'],'transfererlinkedid':_0x3579ae['transfererlinkedid'],'transfereechannel':_0x3579ae[_0x2dd2('0x9')],'transfereecalleridnum':_0x3579ae[_0x2dd2('0xa')],'transfereecalleridname':_0x3579ae[_0x2dd2('0xb')],'transfereeconnectedlinenum':_0x3579ae['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x3579ae[_0x2dd2('0xc')],'transfereeaccountcode':_0x3579ae[_0x2dd2('0xd')],'transfereecontext':_0x3579ae[_0x2dd2('0xe')],'transfereeexten':_0x3579ae['transfereeexten'],'transfereelinkedid':_0x3579ae[_0x2dd2('0xf')],'isexternal':_0x3579ae[_0x2dd2('0x10')],'context':_0x3579ae['context'],'extension':_0x3579ae[_0x2dd2('0x11')],'type':_0x2dd2('0x12')},'log':'CreateVoiceTransferReport'});};exports[_0x2dd2('0x13')]=function(_0x96eaba){return client['Request'](_0x2dd2('0x2'),{'body':{'result':_0x96eaba[_0x2dd2('0x3')],'transfererchannel':_0x96eaba[_0x2dd2('0x14')],'transferercalleridnum':_0x96eaba['origtransferercalleridnum'],'transferercalleridname':_0x96eaba['origtransferercalleridname'],'transfererconnectedlinenum':_0x96eaba[_0x2dd2('0x15')],'transfererconnectedlinename':_0x96eaba['secondtransfererconnectedlinename'],'transfereraccountcode':_0x96eaba[_0x2dd2('0x16')],'transferercontext':_0x96eaba[_0x2dd2('0x17')],'transfererexten':_0x96eaba[_0x2dd2('0x18')],'transfererlinkedid':_0x96eaba['origtransfererlinkedid'],'transfereechannel':_0x96eaba[_0x2dd2('0x19')],'transfereecalleridnum':_0x96eaba[_0x2dd2('0x1a')],'transfereecalleridname':_0x96eaba[_0x2dd2('0x1b')],'transfereeconnectedlinenum':_0x96eaba[_0x2dd2('0x1c')],'transfereeconnectedlinename':_0x96eaba['transfertargetconnectedlinename'],'transfereeaccountcode':_0x96eaba[_0x2dd2('0x1d')],'transfereecontext':_0x96eaba[_0x2dd2('0x1e')],'transfereeexten':_0x96eaba['transfertargetexten'],'transfereelinkedid':_0x96eaba[_0x2dd2('0x1f')],'isexternal':_0x96eaba[_0x2dd2('0x10')],'context':_0x96eaba[_0x2dd2('0x20')],'extension':_0x96eaba[_0x2dd2('0x21')],'type':'attended'},'log':_0x2dd2('0x2')});}; \ No newline at end of file +var _0x2db9=['transfertargetcontext','isexternal','origtransferercontext','attended','transfers','blindTransfer','CreateVoiceTransferReport','result','transfererchannel','transferercalleridname','transfererconnectedlinename','transferercontext','transfererlinkedid','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','context','extension','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinename','origtransfererlinkedid','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename'];(function(_0x1b3a5c,_0x2f9d5f){var _0x2ae8cb=function(_0x549ab8){while(--_0x549ab8){_0x1b3a5c['push'](_0x1b3a5c['shift']());}};_0x2ae8cb(++_0x2f9d5f);}(_0x2db9,0xe4));var _0x92db=function(_0x36a574,_0x26b2e2){_0x36a574=_0x36a574-0x0;var _0x1a058c=_0x2db9[_0x36a574];return _0x1a058c;};'use strict';var client=require('../client');exports[_0x92db('0x0')]={};exports[_0x92db('0x1')]=function(_0x3766a1){return client['Request'](_0x92db('0x2'),{'body':{'result':_0x3766a1[_0x92db('0x3')],'transfererchannel':_0x3766a1[_0x92db('0x4')],'transferercalleridnum':_0x3766a1['transferercalleridnum'],'transferercalleridname':_0x3766a1[_0x92db('0x5')],'transfererconnectedlinenum':_0x3766a1['transfererconnectedlinenum'],'transfererconnectedlinename':_0x3766a1[_0x92db('0x6')],'transfereraccountcode':_0x3766a1['transfereraccountcode'],'transferercontext':_0x3766a1[_0x92db('0x7')],'transfererexten':_0x3766a1['transfererexten'],'transfererlinkedid':_0x3766a1[_0x92db('0x8')],'transfereechannel':_0x3766a1['transfereechannel'],'transfereecalleridnum':_0x3766a1['transfereecalleridnum'],'transfereecalleridname':_0x3766a1[_0x92db('0x9')],'transfereeconnectedlinenum':_0x3766a1[_0x92db('0xa')],'transfereeconnectedlinename':_0x3766a1[_0x92db('0xb')],'transfereeaccountcode':_0x3766a1[_0x92db('0xc')],'transfereecontext':_0x3766a1[_0x92db('0xd')],'transfereeexten':_0x3766a1[_0x92db('0xe')],'transfereelinkedid':_0x3766a1['transfereelinkedid'],'isexternal':_0x3766a1['isexternal'],'context':_0x3766a1[_0x92db('0xf')],'extension':_0x3766a1[_0x92db('0x10')],'type':'blind'},'log':'CreateVoiceTransferReport'});};exports['attendedTransfer']=function(_0x47be3a){return client['Request'](_0x92db('0x2'),{'body':{'result':_0x47be3a[_0x92db('0x3')],'transfererchannel':_0x47be3a[_0x92db('0x11')],'transferercalleridnum':_0x47be3a[_0x92db('0x12')],'transferercalleridname':_0x47be3a['origtransferercalleridname'],'transfererconnectedlinenum':_0x47be3a['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x47be3a[_0x92db('0x13')],'transfereraccountcode':_0x47be3a['origtransfereraccountcode'],'transferercontext':_0x47be3a['secondtransferercontext'],'transfererexten':_0x47be3a['secondtransfererexten'],'transfererlinkedid':_0x47be3a[_0x92db('0x14')],'transfereechannel':_0x47be3a[_0x92db('0x15')],'transfereecalleridnum':_0x47be3a['transfertargetcalleridnum'],'transfereecalleridname':_0x47be3a['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x47be3a[_0x92db('0x16')],'transfereeconnectedlinename':_0x47be3a[_0x92db('0x17')],'transfereeaccountcode':_0x47be3a['transfertargetaccountcode'],'transfereecontext':_0x47be3a[_0x92db('0x18')],'transfereeexten':_0x47be3a['transfertargetexten'],'transfereelinkedid':_0x47be3a['transfertargetlinkedid'],'isexternal':_0x47be3a[_0x92db('0x19')],'context':_0x47be3a[_0x92db('0x1a')],'extension':_0x47be3a['origtransfererexten'],'type':_0x92db('0x1b')},'log':_0x92db('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 38f803d..c2f38dc 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 _0x24cf=['predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','name','active','callerid','Interval','push','find','omit','undefined','values','channels','length','voicechannel','map','uniqueid','channel','%s.%s','wav','MixMonitor','ai(mixmonitorid)','monitors','isNil','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','MixMonitor\x20Success','resolve','destinationchannel','status','stop','filename','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','queueChannels','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','exten','context','telephones','trunks','run','event','Event\x20name\x20mandatory','emit','custom:','send','checkAfterSend','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','validate','moment','../../../config/environment','../properties','listen','format','%s/%s','SIP','timers','timer','updateAcw','agents','updateStatusRealtime','pause','isConnected','asterisk','ami\x20disconnected','join','pick','keys','module','Action','then','message','catch','error','username','command','action','content','voiceQueues','hasOwnProperty','strategy','loggedIn','sumBillable','sumDuration','type','abandoned','waiting','loggedInDb','outbound','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses'];(function(_0x186d17,_0x9fa8ef){var _0x5d4b89=function(_0x57bd70){while(--_0x57bd70){_0x186d17['push'](_0x186d17['shift']());}};_0x5d4b89(++_0x9fa8ef);}(_0x24cf,0x1d5));var _0xf24c=function(_0x5363d1,_0x2d9c2a){_0x5363d1=_0x5363d1-0x0;var _0x457df=_0x24cf[_0x5363d1];return _0x457df;};'use strict';var _=require('lodash');var util=require('util');var jayson=require(_0xf24c('0x0'));var schema=require(_0xf24c('0x1'));var moment=require(_0xf24c('0x2'));var config=require(_0xf24c('0x3'));var properties=require(_0xf24c('0x4'));var ami=require('../ami');exports[_0xf24c('0x5')]=function(_0x417bb2,_0x1eafb4,_0x10c351){return new Promise(function(_0x5c4ebc,_0x4983e2){var _0x5104bd={'QueuePause':function(_0x272d25){return new Promise(function(_0x596e81){var _0x3b7cf1=util[_0xf24c('0x6')](_0xf24c('0x7'),_0xf24c('0x8'),_0x272d25['name']);if(_0x417bb2[_0xf24c('0x9')]&&_0x417bb2[_0xf24c('0x9')][_0x3b7cf1]&&_0x417bb2[_0xf24c('0x9')][_0x3b7cf1][_0xf24c('0xa')]){_0x417bb2[_0xf24c('0x9')][_0x3b7cf1][_0xf24c('0xb')]();}if(_0x417bb2['agents'][_0x3b7cf1]){_0x417bb2[_0xf24c('0xc')][_0x3b7cf1][_0xf24c('0xd')]({'statePause':_0x272d25[_0xf24c('0xe')]?!![]:![]});}_0x596e81({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x143aa6){var _0x2589c1=this;return new Promise(function(_0x57edfa,_0x5a0bbf){if(ami[_0xf24c('0xf')]()==![]){return _0x5a0bbf(_0x2589c1['error'](0x1f4,[config[_0xf24c('0x10')]['ip'],config[_0xf24c('0x10')]['username'],_0xf24c('0x11')][_0xf24c('0x12')]('\x20')));}_0x143aa6=_[_0xf24c('0x13')](_0x143aa6,_[_0xf24c('0x14')](properties[_0xf24c('0x15')]));_0x143aa6['action']='Reload';return ami[_0xf24c('0x16')](_0x143aa6)[_0xf24c('0x17')](function(_0x52a073){_0x57edfa({'code':0xc8,'message':_0x52a073[_0xf24c('0x18')]});})[_0xf24c('0x19')](function(_0x2d9015){_0x5a0bbf(_0x2589c1[_0xf24c('0x1a')](0x1f5,_0x2d9015[_0xf24c('0x18')]));});});},'Command':function(_0x3a0b61){var _0x36ceba=this;return new Promise(function(_0x565fef,_0x1ebfa1){if(ami[_0xf24c('0xf')]()==![]){return _0x1ebfa1(_0x36ceba[_0xf24c('0x1a')](0x1f4,[config[_0xf24c('0x10')]['ip'],config['asterisk'][_0xf24c('0x1b')],_0xf24c('0x11')]['join']('\x20')));}_0x3a0b61=_[_0xf24c('0x13')](_0x3a0b61,_0xf24c('0x1c'));_0x3a0b61[_0xf24c('0x1d')]='Command';return ami[_0xf24c('0x16')](_0x3a0b61)['then'](function(_0x40ba03){_0x565fef({'code':0xc8,'message':_0x40ba03[_0xf24c('0x1e')]});})['catch'](function(_0x1a54ea){_0x1ebfa1(_0x36ceba[_0xf24c('0x1a')](0x1f5,_0x1a54ea[_0xf24c('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x35ba83){var _0x273a80=[];for(var _0xe6973e in _0x417bb2[_0xf24c('0x1f')]){if(_0x417bb2[_0xf24c('0x1f')][_0xf24c('0x20')](_0xe6973e)){var _0xc9fd87=_0x417bb2[_0xf24c('0x1f')][_0xe6973e];var _0x4a9a9b={'id':_0xc9fd87['id'],'name':_0xc9fd87['name'],'strategy':_0xc9fd87[_0xf24c('0x21')],'answered':_0xc9fd87['answered'],'available':_0xc9fd87['available'],'loggedIn':_0xc9fd87[_0xf24c('0x22')],'pTalking':_0xc9fd87['pTalking'],'sumBillable':_0xc9fd87[_0xf24c('0x23')],'sumDuration':_0xc9fd87[_0xf24c('0x24')],'sumHoldTime':_0xc9fd87['sumHoldTime']||0x0,'talking':_0xc9fd87['talking'],'total':_0xc9fd87['total'],'type':_0xc9fd87[_0xf24c('0x25')],'unmanaged':_0xc9fd87['unmanaged'],'abandoned':_0xc9fd87[_0xf24c('0x26')],'waiting':_0xc9fd87[_0xf24c('0x27')],'loggedInDb':_0xc9fd87[_0xf24c('0x28')]};if(_0xc9fd87['type']===_0xf24c('0x29')){_0x4a9a9b['dialActive']=_0xc9fd87['dialActive'];_0x4a9a9b[_0xf24c('0x2a')]=_0xc9fd87[_0xf24c('0x2a')];_0x4a9a9b[_0xf24c('0x2b')]=_0xc9fd87[_0xf24c('0x2b')];_0x4a9a9b['dialOriginateCallerIdNumber']=_0xc9fd87[_0xf24c('0x2c')];_0x4a9a9b[_0xf24c('0x2d')]=_0xc9fd87[_0xf24c('0x2d')];_0x4a9a9b[_0xf24c('0x2e')]=_0xc9fd87[_0xf24c('0x2e')];_0x4a9a9b[_0xf24c('0x2f')]=_0xc9fd87['temp'];_0x4a9a9b[_0xf24c('0x30')]=_0xc9fd87[_0xf24c('0x30')];_0x4a9a9b[_0xf24c('0x31')]=_0xc9fd87[_0xf24c('0x31')];_0x4a9a9b[_0xf24c('0x32')]=_0xc9fd87[_0xf24c('0x32')];_0x4a9a9b[_0xf24c('0x33')]=_0xc9fd87['outboundBusyCallsDay'];_0x4a9a9b[_0xf24c('0x34')]=_0xc9fd87['outboundCongestionCallsDay'];_0x4a9a9b[_0xf24c('0x35')]=_0xc9fd87[_0xf24c('0x35')];_0x4a9a9b['outboundDropCallsDayCallersExit']=_0xc9fd87[_0xf24c('0x36')];_0x4a9a9b['outboundDropCallsDayTimeout']=_0xc9fd87[_0xf24c('0x37')];_0x4a9a9b[_0xf24c('0x38')]=_0xc9fd87[_0xf24c('0x38')];_0x4a9a9b['outboundNoSuchCallsDay']=_0xc9fd87[_0xf24c('0x39')];_0x4a9a9b['outboundOriginateFailureCallsDay']=_0xc9fd87[_0xf24c('0x3a')];_0x4a9a9b['outboundReCallsDay']=_0xc9fd87['outboundReCallsDay'];_0x4a9a9b['outboundRejectCallsDay']=_0xc9fd87[_0xf24c('0x3b')];_0x4a9a9b[_0xf24c('0x3c')]=_0xc9fd87[_0xf24c('0x3c')];_0x4a9a9b[_0xf24c('0x3d')]=_0xc9fd87[_0xf24c('0x3d')];_0x4a9a9b[_0xf24c('0x3e')]=_0xc9fd87[_0xf24c('0x3e')];_0x4a9a9b['predictiveIntervalAvgTalktime']=_0xc9fd87[_0xf24c('0x3f')];_0x4a9a9b[_0xf24c('0x40')]=_0xc9fd87[_0xf24c('0x40')];_0x4a9a9b[_0xf24c('0x41')]=_0xc9fd87[_0xf24c('0x41')];_0x4a9a9b['predictiveIntervalErlangCalls']=_0xc9fd87[_0xf24c('0x42')];_0x4a9a9b['predictiveIntervalErlangCallsDroppedCalls']=_0xc9fd87[_0xf24c('0x43')];_0x4a9a9b[_0xf24c('0x44')]=_0xc9fd87[_0xf24c('0x44')];_0x4a9a9b[_0xf24c('0x45')]=_0xc9fd87[_0xf24c('0x45')];_0x4a9a9b[_0xf24c('0x46')]=_0xc9fd87[_0xf24c('0x46')];_0x4a9a9b[_0xf24c('0x47')]=_0xc9fd87[_0xf24c('0x47')];_0x4a9a9b[_0xf24c('0x48')]=_0xc9fd87[_0xf24c('0x48')];_0x4a9a9b['message']=_0xc9fd87['message'];_0x4a9a9b[_0xf24c('0x49')]=_0xc9fd87[_0xf24c('0x49')];_0x4a9a9b[_0xf24c('0x4a')]=_0xc9fd87[_0xf24c('0x4a')];_0x4a9a9b[_0xf24c('0x4b')]=_0xc9fd87[_0xf24c('0x4b')];_0x4a9a9b[_0xf24c('0x4c')]=_0xc9fd87[_0xf24c('0x4c')];_0x4a9a9b[_0xf24c('0x4d')]=_0xc9fd87[_0xf24c('0x4d')];_0x4a9a9b[_0xf24c('0x4e')]=_0xc9fd87['startPredictive'];_0x4a9a9b[_0xf24c('0x4f')]=_0xc9fd87['startProgressive'];}if(_0xc9fd87[_0xf24c('0x50')]){_0x4a9a9b[_0xf24c('0x50')]={'id':_0xc9fd87[_0xf24c('0x50')]['id'],'name':_0xc9fd87[_0xf24c('0x50')][_0xf24c('0x51')],'active':_0xc9fd87[_0xf24c('0x50')][_0xf24c('0x52')],'callerid':_0xc9fd87[_0xf24c('0x50')][_0xf24c('0x53')]};}if(_0xc9fd87[_0xf24c('0x54')]){_0x4a9a9b[_0xf24c('0x54')]={'id':_0xc9fd87[_0xf24c('0x54')]['id'],'name':_0xc9fd87[_0xf24c('0x54')][_0xf24c('0x51')]};}_0x273a80[_0xf24c('0x55')](_0x4a9a9b);}}_0x35ba83({'count':_0x273a80['length'],'rows':_0x273a80});});},'UpdateVoiceQueue':function(_0x578db0){return new Promise(function(_0x2bcd59,_0x9d7e15){var _0x5f378d=_[_0xf24c('0x56')](_0x417bb2[_0xf24c('0x1f')],{'id':parseInt(_0x578db0['id'])});var _0x4cb844=_[_0xf24c('0x57')](_0x578db0,['id']);if(_0x5f378d){for(var _0x3f8610 in _0x4cb844){if(typeof _0x4cb844[_0x3f8610]!==_0xf24c('0x58')&&typeof _0x5f378d[_0x3f8610]!==_0xf24c('0x58')){_0x5f378d[_0x3f8610]=_0x4cb844[_0x3f8610];}}_0x2bcd59(_0x5f378d);}else{_0x9d7e15();}});},'VoiceChannels':function(){return new Promise(function(_0x4f3a43){var _0x27753e=_[_0xf24c('0x59')](_0x417bb2[_0xf24c('0x5a')]);_0x4f3a43({'count':_0x27753e[_0xf24c('0x5b')],'rows':_0x27753e});});},'VoiceChannelMixMonitor':function(_0x12e8c0){var _0x37cd3=this;return new Promise(function(_0x3296c6,_0x3e8876){if(ami[_0xf24c('0xf')]()==![]){return _0x3e8876(_0x37cd3[_0xf24c('0x1a')](0x1f4,[config[_0xf24c('0x10')]['ip'],config[_0xf24c('0x10')][_0xf24c('0x1b')],_0xf24c('0x11')][_0xf24c('0x12')]('\x20')));}var _0x340552=schema(properties[_0xf24c('0x5c')])['validate'](_0x12e8c0);if(_0x340552[_0xf24c('0x5b')]>0x0){return _0x3e8876(_0x37cd3[_0xf24c('0x1a')](0x1f4,_[_0xf24c('0x5d')](_0x340552,_0xf24c('0x18'))[_0xf24c('0x12')](',\x20')));}var _0x2abe26=_[_0xf24c('0x56')](_0x417bb2[_0xf24c('0x5a')],{'uniqueid':_0x12e8c0[_0xf24c('0x5e')]});if(_0x2abe26&&_0x2abe26[_0xf24c('0x5f')]){var _0x5747de=util[_0xf24c('0x6')](_0xf24c('0x60'),_0x12e8c0['filename']||_0x12e8c0['uniqueid'],_0x12e8c0[_0xf24c('0x6')]||_0xf24c('0x61'));return ami[_0xf24c('0x16')]({'action':_0xf24c('0x62'),'channel':_0x2abe26[_0xf24c('0x5f')],'file':_0x5747de,'options':_0xf24c('0x63')})[_0xf24c('0x17')](function(_0x1e1c7c){var _0x382cd1=_['find'](_0x2abe26[_0xf24c('0x64')],{'filename':'/var/spool/asterisk/monitor/'+_0x5747de['toLowerCase']()});if(_[_0xf24c('0x65')](_0x382cd1)){_0x2abe26[_0xf24c('0x64')][_0xf24c('0x55')]({'filename':_0xf24c('0x66')+_0x5747de[_0xf24c('0x67')](),'createdAt':moment()[_0xf24c('0x6')](_0xf24c('0x68')),'mixmonitorid':_0x1e1c7c[_0xf24c('0x69')],'status':_0xf24c('0x6a')});}else{_0x382cd1[_0xf24c('0x69')]=_0x1e1c7c['mixmonitorid'];_0x382cd1['status']=_0xf24c('0x6a');}_0x3296c6({'code':0xc8,'message':[_0x12e8c0['uniqueid'],_0xf24c('0x6b'),_0x1e1c7c[_0xf24c('0x69')]][_0xf24c('0x12')]('\x20'),'mixmonitorid':_0x1e1c7c[_0xf24c('0x69')]});})[_0xf24c('0x19')](function(_0x2f8d2b){_0x3e8876(_0x37cd3[_0xf24c('0x1a')](0x1f5,[_0x12e8c0[_0xf24c('0x5e')],_0x2f8d2b[_0xf24c('0x18')][_0xf24c('0x67')]()][_0xf24c('0x12')]('\x20')));});}else{return _0x3e8876(_0x37cd3[_0xf24c('0x1a')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x5f5599){var _0x35d85b=this;return new Promise(function(_0x1c75d4,_0x5ae31a){if(ami[_0xf24c('0xf')]()==![]){return _0x5ae31a(_0x35d85b[_0xf24c('0x1a')](0x1f4,[config[_0xf24c('0x10')]['ip'],config[_0xf24c('0x10')][_0xf24c('0x1b')],'ami\x20disconnected'][_0xf24c('0x12')]('\x20')));}var _0x41378f=schema(properties['voicechannel'])['validate'](_0x5f5599);if(_0x41378f['length']>0x0){return _0x5ae31a(_0x35d85b[_0xf24c('0x1a')](0x1f4,_['map'](_0x41378f,_0xf24c('0x18'))[_0xf24c('0x12')](',\x20')));}var _0x5c92b7=_['find'](_0x417bb2['channels'],{'uniqueid':_0x5f5599[_0xf24c('0x5e')]});if(_0x5c92b7){return Promise[_0xf24c('0x6c')]()['then'](function(){if(_0x5c92b7[_0xf24c('0x5f')]){return ami[_0xf24c('0x16')]({'action':'StopMixMonitor','channel':_0x5c92b7[_0xf24c('0x5f')],'mixmonitorid':_0x5f5599[_0xf24c('0x69')]})[_0xf24c('0x19')](function(){});}})[_0xf24c('0x17')](function(){if(_0x5c92b7[_0xf24c('0x6d')]){return ami['Action']({'action':'StopMixMonitor','channel':_0x5c92b7[_0xf24c('0x6d')],'mixmonitorid':_0x5f5599[_0xf24c('0x69')]})['catch'](function(){});}})[_0xf24c('0x17')](function(){var _0x383158=_[_0xf24c('0x56')](_0x5c92b7[_0xf24c('0x64')],{'mixmonitorid':_0x5f5599[_0xf24c('0x69')]});if(_0x383158){_0x383158[_0xf24c('0x6e')]=_0xf24c('0x6f');}})[_0xf24c('0x17')](function(){var _0x10b432=util[_0xf24c('0x6')](_0xf24c('0x60'),_0x5f5599[_0xf24c('0x70')]||_0x5f5599[_0xf24c('0x5e')],_0x5f5599['format']||_0xf24c('0x61'));var _0x46bdcf=_[_0xf24c('0x56')](_0x5c92b7['monitors'],{'filename':_0xf24c('0x66')+_0x10b432[_0xf24c('0x67')]()});if(_0x46bdcf){_0x46bdcf[_0xf24c('0x6e')]='stop';}})[_0xf24c('0x17')](function(){_0x1c75d4({'code':0xc8,'message':[_0x5f5599['uniqueid'],_0xf24c('0x71')][_0xf24c('0x12')]('\x20')});})[_0xf24c('0x19')](function(_0x5ef160){_0x5ae31a(_0x35d85b[_0xf24c('0x1a')](0x1f5,[_0x5f5599[_0xf24c('0x5e')],_0x5ef160[_0xf24c('0x18')][_0xf24c('0x67')]()][_0xf24c('0x12')]('\x20')));});}else{return _0x5ae31a(_0x35d85b[_0xf24c('0x1a')](0x1f5,_0xf24c('0x72')));}});},'VoiceQueuesChannels':function(){return new Promise(function(_0x486d10){var _0x4f20df=_[_0xf24c('0x59')](_0x417bb2[_0xf24c('0x73')]);_0x486d10({'count':_0x4f20df[_0xf24c('0x5b')],'rows':_0x4f20df});});},'VoiceQueuesChannel':function(_0x54e41b){var _0x5dbf38=this;return new Promise(function(_0x2af89a,_0x2757f6){var _0x174316=schema(properties[_0xf24c('0x74')])[_0xf24c('0x1')](_0x54e41b);if(_0x174316[_0xf24c('0x5b')]>0x0){return _0x2757f6(_0x5dbf38[_0xf24c('0x1a')](0x1f4,_[_0xf24c('0x5d')](_0x174316,_0xf24c('0x18'))[_0xf24c('0x12')](',\x20')));}var _0x46fa77=_['find'](_0x417bb2[_0xf24c('0x73')],{'uniqueid':_0x54e41b[_0xf24c('0x5e')]});if(_0x46fa77){_0x2af89a(_0x46fa77);}else{return _0x2757f6(_0x5dbf38[_0xf24c('0x1a')](0x1f5,_0xf24c('0x72')));}});},'VoiceQueuesChannelHangup':function(_0xe90945){var _0x442aeb=this;return new Promise(function(_0x39bf40,_0x1e7a90){if(ami[_0xf24c('0xf')]()==![]){return _0x1e7a90(_0x442aeb[_0xf24c('0x1a')](0x1f4,[config[_0xf24c('0x10')]['ip'],config[_0xf24c('0x10')][_0xf24c('0x1b')],_0xf24c('0x11')][_0xf24c('0x12')]('\x20')));}var _0x402e87=schema(properties[_0xf24c('0x75')])[_0xf24c('0x1')](_0xe90945);if(_0x402e87[_0xf24c('0x5b')]>0x0){return _0x1e7a90(_0x442aeb[_0xf24c('0x1a')](0x1f4,_[_0xf24c('0x5d')](_0x402e87,_0xf24c('0x18'))[_0xf24c('0x12')](',\x20')));}var _0x1cad5d=_[_0xf24c('0x56')](_0x417bb2[_0xf24c('0x73')],{'uniqueid':_0xe90945[_0xf24c('0x5e')]});if(_0x1cad5d&&_0x1cad5d[_0xf24c('0x5f')]){return ami['Action']({'action':'Hangup','channel':_0x1cad5d[_0xf24c('0x5f')]})[_0xf24c('0x17')](function(_0x3b0024){_0x39bf40({'code':0xc8,'message':[_0xe90945[_0xf24c('0x5e')],_0x3b0024[_0xf24c('0x18')]['toLowerCase']()][_0xf24c('0x12')]('\x20')});})[_0xf24c('0x19')](function(_0x4dd57b){_0x1e7a90(_0x442aeb[_0xf24c('0x1a')](0x1f5,[_0xe90945[_0xf24c('0x5e')],_0x4dd57b[_0xf24c('0x18')]['toLowerCase']()]['join']('\x20')));});}else{return _0x1e7a90(_0x442aeb[_0xf24c('0x1a')](0x1f5,_0xf24c('0x72')));}});},'VoiceQueuesChannelRedirect':function(_0x4798a9){var _0x5dd4e0=this;return new Promise(function(_0x20b7fc,_0x344ce5){if(ami['isConnected']()==![]){return _0x344ce5(_0x5dd4e0[_0xf24c('0x1a')](0x1f4,[config[_0xf24c('0x10')]['ip'],config[_0xf24c('0x10')][_0xf24c('0x1b')],_0xf24c('0x11')][_0xf24c('0x12')]('\x20')));}var _0x372a9d=schema(properties[_0xf24c('0x76')])['validate'](_0x4798a9);if(_0x372a9d[_0xf24c('0x5b')]>0x0){return _0x344ce5(_0x5dd4e0['error'](0x1f4,_[_0xf24c('0x5d')](_0x372a9d,'message')[_0xf24c('0x12')](',\x20')));}var _0x5530e2=_['find'](_0x417bb2[_0xf24c('0x73')],{'uniqueid':_0x4798a9['uniqueid']});if(_0x5530e2&&_0x5530e2['channel']){return ami['Action']({'action':'Redirect','channel':_0x5530e2[_0xf24c('0x5f')],'exten':_0x4798a9[_0xf24c('0x77')],'context':_0x4798a9[_0xf24c('0x78')]||_0x5530e2[_0xf24c('0x78')],'priority':0x1})[_0xf24c('0x17')](function(_0x451bab){_0x20b7fc({'code':0xc8,'message':[_0x4798a9[_0xf24c('0x5e')],_0x451bab[_0xf24c('0x18')][_0xf24c('0x67')]()][_0xf24c('0x12')]('\x20')});})[_0xf24c('0x19')](function(_0x5abe0a){_0x344ce5(_0x5dd4e0['error'](0x1f5,[_0x4798a9[_0xf24c('0x5e')],_0x5abe0a['message'][_0xf24c('0x67')]()][_0xf24c('0x12')]('\x20')));});}else{return _0x344ce5(_0x5dd4e0['error'](0x1f5,_0xf24c('0x72')));}});},'Agents':function(_0x2fe560){return new Promise(function(_0x13e3fb){var _0x254b09=_[_0xf24c('0x59')](_0x417bb2[_0xf24c('0xc')]);if(_0x2fe560&&_0x2fe560['id']){var _0xf881bf=_[_0xf24c('0x56')](_0x254b09,function(_0x1cd0e5){return _0x1cd0e5['id']===_0x2fe560['id'];});_0x13e3fb(_0xf881bf);}else{_0x13e3fb({'count':_0x254b09[_0xf24c('0x5b')],'rows':_0x254b09});}});},'Telephones':function(){return new Promise(function(_0x344aed){var _0x47b1ad=_[_0xf24c('0x59')](_0x417bb2[_0xf24c('0x79')]);_0x344aed({'count':_0x47b1ad[_0xf24c('0x5b')],'rows':_0x47b1ad});});},'Trunks':function(){return new Promise(function(_0x17d4f8){var _0x3c95de=_[_0xf24c('0x59')](_0x417bb2[_0xf24c('0x7a')]);_0x17d4f8({'count':_0x3c95de[_0xf24c('0x5b')],'rows':_0x3c95de});});},'OutboundChannels':function(){return new Promise(function(_0x549a2d){var _0xf47c26=_[_0xf24c('0x59')](_0x417bb2['outboundChannels']);_0x549a2d({'count':_0xf47c26[_0xf24c('0x5b')],'rows':_0xf47c26});});},'Outbound':function(){return new Promise(function(_0x5e45f3){_0x5e45f3(_0x417bb2[_0xf24c('0x29')]);});},'Campaigns':function(){return new Promise(function(_0x5d1604){var _0x31edbf=_[_0xf24c('0x59')](_0x417bb2['campaigns']);_0x5d1604({'count':_0x31edbf['length'],'rows':_0x31edbf});});},'VoiceQueuesPreview':function(_0x466114){var _0x10ff96=this;return new Promise(function(_0x247b9e,_0x37868d){_0x1eafb4[_0xf24c('0x7b')](_0x466114['id'])[_0xf24c('0x17')](function(_0xfca413){_0x247b9e({'code':0xc8,'message':_0xfca413[_0xf24c('0x18')]});})[_0xf24c('0x19')](function(_0x3d50a2){_0x37868d(_0x10ff96[_0xf24c('0x1a')](0x1f4,_0x3d50a2['message']));});});},'EventManager':function(_0x422858){var _0x15922e=this;return new Promise(function(_0x5aff4f,_0x59ea1c){if(!_0x422858[_0xf24c('0x7c')]){return _0x59ea1c(_0x15922e['error'](0x1f4,_0xf24c('0x7d')));}ami[_0xf24c('0x7e')](_0xf24c('0x7f')+_0x422858['event'],_0x422858[_0xf24c('0x18')]);_0x5aff4f({'code':0xc8,'message':_0x422858});});},'FaxAccounts':function(){return new Promise(function(_0x3798f8){var _0x658bf9=_[_0xf24c('0x59')](_0x417bb2['faxAccounts']);_0x3798f8({'count':_0x658bf9[_0xf24c('0x5b')],'rows':_0x658bf9});});},'SendFax':function(_0x5bef88){var _0x5652b9=this;return new Promise(function(_0x32dcd2,_0x5c1d0c){_0x10c351[_0xf24c('0x80')](_0x5bef88)[_0xf24c('0x17')](function(_0x45e266){_0x32dcd2({'code':0xc8,'message':_0x45e266[_0xf24c('0x18')]});})[_0xf24c('0x19')](function(_0x13de1b){_0x5c1d0c(_0x5652b9['error'](0x1f4,_0x13de1b[_0xf24c('0x18')]));});});},'CheckAfterSend':function(_0x2e6662){var _0x4c854c=this;return new Promise(function(_0x1f28c5,_0x50c529){_0x10c351[_0xf24c('0x81')](_0x2e6662)[_0xf24c('0x17')](function(_0x23fb65){_0x1f28c5({'code':0xc8,'message':_0x23fb65[_0xf24c('0x18')]});})[_0xf24c('0x19')](function(_0x485024){_0x50c529(_0x4c854c[_0xf24c('0x1a')](0x1f4,_0x485024[_0xf24c('0x18')]));});});}};var _0x2cf53d=jayson['server'](_0x5104bd)[_0xf24c('0x82')]();_0x2cf53d['on'](_0xf24c('0x1a'),function(_0x5e4d19){return _0x4983e2(_0x5e4d19);});_0x2cf53d[_0xf24c('0x5')](0x232a,_0xf24c('0x83'),function(){console[_0xf24c('0x84')](_0xf24c('0x85'),0x232a);return _0x5c4ebc(_0xf24c('0x86')+0x232a);});});}; \ No newline at end of file +var _0x351d=['uniqueid','StopMixMonitor','wav','values','queueChannels','voicequeuechannel','voicequeuechannelhangup','exten','context','telephones','outboundChannels','outbound','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','checkAfterSend','server','http','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','jayson/promise','validate','moment','../properties','listen','format','%s/%s','timers','timer','updateAcw','agents','updateStatusRealtime','error','asterisk','username','ami\x20disconnected','join','pick','keys','action','then','message','catch','isConnected','command','Action','voiceQueues','hasOwnProperty','strategy','loggedIn','sumDuration','talking','total','type','abandoned','loggedInDb','dialActive','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','erlangCallToSecond','erlangBusyFactor','startProgressive','Trunk','name','active','Interval','push','length','find','omit','undefined','channels','voicechannel','channel','%s.%s','filename','ai(mixmonitorid)','monitors','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','map'];(function(_0xf9b382,_0x9386ff){var _0x45ad11=function(_0x547ab6){while(--_0x547ab6){_0xf9b382['push'](_0xf9b382['shift']());}};_0x45ad11(++_0x9386ff);}(_0x351d,0x90));var _0xd351=function(_0x3332da,_0x13e70e){_0x3332da=_0x3332da-0x0;var _0x3c9bc7=_0x351d[_0x3332da];return _0x3c9bc7;};'use strict';var _=require(_0xd351('0x0'));var util=require('util');var jayson=require(_0xd351('0x1'));var schema=require(_0xd351('0x2'));var moment=require(_0xd351('0x3'));var config=require('../../../config/environment');var properties=require(_0xd351('0x4'));var ami=require('../ami');exports[_0xd351('0x5')]=function(_0x151391,_0x49610f,_0x1cd581){return new Promise(function(_0x45e9e5,_0x88bd2b){var _0x5318b2={'QueuePause':function(_0x16b3f7){return new Promise(function(_0x235aa0){var _0x4e1b06=util[_0xd351('0x6')](_0xd351('0x7'),'SIP',_0x16b3f7['name']);if(_0x151391[_0xd351('0x8')]&&_0x151391['timers'][_0x4e1b06]&&_0x151391[_0xd351('0x8')][_0x4e1b06][_0xd351('0x9')]){_0x151391['timers'][_0x4e1b06][_0xd351('0xa')]();}if(_0x151391[_0xd351('0xb')][_0x4e1b06]){_0x151391['agents'][_0x4e1b06][_0xd351('0xc')]({'statePause':_0x16b3f7['pause']?!![]:![]});}_0x235aa0({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x3eb40c){var _0x15549a=this;return new Promise(function(_0x23445f,_0x1eb2a9){if(ami['isConnected']()==![]){return _0x1eb2a9(_0x15549a[_0xd351('0xd')](0x1f4,[config[_0xd351('0xe')]['ip'],config['asterisk'][_0xd351('0xf')],_0xd351('0x10')][_0xd351('0x11')]('\x20')));}_0x3eb40c=_[_0xd351('0x12')](_0x3eb40c,_[_0xd351('0x13')](properties['module']));_0x3eb40c[_0xd351('0x14')]='Reload';return ami['Action'](_0x3eb40c)[_0xd351('0x15')](function(_0x581370){_0x23445f({'code':0xc8,'message':_0x581370[_0xd351('0x16')]});})[_0xd351('0x17')](function(_0x4e0164){_0x1eb2a9(_0x15549a['error'](0x1f5,_0x4e0164[_0xd351('0x16')]));});});},'Command':function(_0x2bfc53){var _0x77985a=this;return new Promise(function(_0x12b5aa,_0x51f265){if(ami[_0xd351('0x18')]()==![]){return _0x51f265(_0x77985a['error'](0x1f4,[config['asterisk']['ip'],config[_0xd351('0xe')]['username'],_0xd351('0x10')][_0xd351('0x11')]('\x20')));}_0x2bfc53=_[_0xd351('0x12')](_0x2bfc53,_0xd351('0x19'));_0x2bfc53[_0xd351('0x14')]='Command';return ami[_0xd351('0x1a')](_0x2bfc53)[_0xd351('0x15')](function(_0x241265){_0x12b5aa({'code':0xc8,'message':_0x241265['content']});})[_0xd351('0x17')](function(_0x2d9aa0){_0x51f265(_0x77985a[_0xd351('0xd')](0x1f5,_0x2d9aa0['message']));});});},'VoiceQueues':function(){return new Promise(function(_0x1ce279){var _0x34a5cb=[];for(var _0x4626c4 in _0x151391[_0xd351('0x1b')]){if(_0x151391['voiceQueues'][_0xd351('0x1c')](_0x4626c4)){var _0x483c92=_0x151391[_0xd351('0x1b')][_0x4626c4];var _0x8ad0a6={'id':_0x483c92['id'],'name':_0x483c92['name'],'strategy':_0x483c92[_0xd351('0x1d')],'answered':_0x483c92['answered'],'available':_0x483c92['available'],'loggedIn':_0x483c92[_0xd351('0x1e')],'pTalking':_0x483c92['pTalking'],'sumBillable':_0x483c92['sumBillable'],'sumDuration':_0x483c92[_0xd351('0x1f')],'sumHoldTime':_0x483c92['sumHoldTime']||0x0,'talking':_0x483c92[_0xd351('0x20')],'total':_0x483c92[_0xd351('0x21')],'type':_0x483c92[_0xd351('0x22')],'unmanaged':_0x483c92['unmanaged'],'abandoned':_0x483c92[_0xd351('0x23')],'waiting':_0x483c92['waiting'],'loggedInDb':_0x483c92[_0xd351('0x24')]};if(_0x483c92['type']==='outbound'){_0x8ad0a6[_0xd351('0x25')]=_0x483c92[_0xd351('0x25')];_0x8ad0a6[_0xd351('0x26')]=_0x483c92[_0xd351('0x26')];_0x8ad0a6['dialOriginateCallerIdName']=_0x483c92[_0xd351('0x27')];_0x8ad0a6[_0xd351('0x28')]=_0x483c92[_0xd351('0x28')];_0x8ad0a6[_0xd351('0x29')]=_0x483c92[_0xd351('0x29')];_0x8ad0a6[_0xd351('0x2a')]=_0x483c92[_0xd351('0x2a')];_0x8ad0a6[_0xd351('0x2b')]=_0x483c92[_0xd351('0x2b')];_0x8ad0a6['outboundAnswerAgiCallsDay']=_0x483c92[_0xd351('0x2c')];_0x8ad0a6[_0xd351('0x2d')]=_0x483c92[_0xd351('0x2d')];_0x8ad0a6[_0xd351('0x2e')]=_0x483c92['outboundBlacklistCallsDay'];_0x8ad0a6[_0xd351('0x2f')]=_0x483c92[_0xd351('0x2f')];_0x8ad0a6[_0xd351('0x30')]=_0x483c92[_0xd351('0x30')];_0x8ad0a6[_0xd351('0x31')]=_0x483c92[_0xd351('0x31')];_0x8ad0a6[_0xd351('0x32')]=_0x483c92[_0xd351('0x32')];_0x8ad0a6[_0xd351('0x33')]=_0x483c92['outboundDropCallsDayTimeout'];_0x8ad0a6['outboundNoAnswerCallsDay']=_0x483c92[_0xd351('0x34')];_0x8ad0a6[_0xd351('0x35')]=_0x483c92[_0xd351('0x35')];_0x8ad0a6[_0xd351('0x36')]=_0x483c92[_0xd351('0x36')];_0x8ad0a6[_0xd351('0x37')]=_0x483c92['outboundReCallsDay'];_0x8ad0a6['outboundRejectCallsDay']=_0x483c92[_0xd351('0x38')];_0x8ad0a6['outboundUnknownCallsDay']=_0x483c92[_0xd351('0x39')];_0x8ad0a6[_0xd351('0x3a')]=_0x483c92[_0xd351('0x3a')];_0x8ad0a6[_0xd351('0x3b')]=_0x483c92[_0xd351('0x3b')];_0x8ad0a6[_0xd351('0x3c')]=_0x483c92[_0xd351('0x3c')];_0x8ad0a6[_0xd351('0x3d')]=_0x483c92[_0xd351('0x3d')];_0x8ad0a6[_0xd351('0x3e')]=_0x483c92[_0xd351('0x3e')];_0x8ad0a6['predictiveIntervalErlangCalls']=_0x483c92[_0xd351('0x3f')];_0x8ad0a6['predictiveIntervalErlangCallsDroppedCalls']=_0x483c92[_0xd351('0x40')];_0x8ad0a6[_0xd351('0x41')]=_0x483c92[_0xd351('0x41')];_0x8ad0a6[_0xd351('0x42')]=_0x483c92[_0xd351('0x42')];_0x8ad0a6[_0xd351('0x43')]=_0x483c92['predictiveIntervalPauses'];_0x8ad0a6[_0xd351('0x44')]=_0x483c92[_0xd351('0x44')];_0x8ad0a6['predictiveIntervalTotalCalls']=_0x483c92[_0xd351('0x45')];_0x8ad0a6[_0xd351('0x16')]=_0x483c92[_0xd351('0x16')];_0x8ad0a6[_0xd351('0x46')]=_0x483c92[_0xd351('0x46')];_0x8ad0a6['erlangCalls']=_0x483c92['erlangCalls'];_0x8ad0a6[_0xd351('0x47')]=_0x483c92[_0xd351('0x47')];_0x8ad0a6['erlangAbandonmentRate']=_0x483c92['erlangAbandonmentRate'];_0x8ad0a6[_0xd351('0x48')]=_0x483c92[_0xd351('0x48')];_0x8ad0a6['startPredictive']=_0x483c92['startPredictive'];_0x8ad0a6[_0xd351('0x49')]=_0x483c92[_0xd351('0x49')];}if(_0x483c92[_0xd351('0x4a')]){_0x8ad0a6[_0xd351('0x4a')]={'id':_0x483c92[_0xd351('0x4a')]['id'],'name':_0x483c92[_0xd351('0x4a')][_0xd351('0x4b')],'active':_0x483c92[_0xd351('0x4a')][_0xd351('0x4c')],'callerid':_0x483c92['Trunk']['callerid']};}if(_0x483c92[_0xd351('0x4d')]){_0x8ad0a6[_0xd351('0x4d')]={'id':_0x483c92[_0xd351('0x4d')]['id'],'name':_0x483c92[_0xd351('0x4d')][_0xd351('0x4b')]};}_0x34a5cb[_0xd351('0x4e')](_0x8ad0a6);}}_0x1ce279({'count':_0x34a5cb[_0xd351('0x4f')],'rows':_0x34a5cb});});},'UpdateVoiceQueue':function(_0xe3daed){return new Promise(function(_0x2629ea,_0x3452df){var _0xff9e7d=_[_0xd351('0x50')](_0x151391[_0xd351('0x1b')],{'id':parseInt(_0xe3daed['id'])});var _0x42a162=_[_0xd351('0x51')](_0xe3daed,['id']);if(_0xff9e7d){for(var _0xc23650 in _0x42a162){if(typeof _0x42a162[_0xc23650]!=='undefined'&&typeof _0xff9e7d[_0xc23650]!==_0xd351('0x52')){_0xff9e7d[_0xc23650]=_0x42a162[_0xc23650];}}_0x2629ea(_0xff9e7d);}else{_0x3452df();}});},'VoiceChannels':function(){return new Promise(function(_0x3ec78a){var _0x8fe1b5=_['values'](_0x151391[_0xd351('0x53')]);_0x3ec78a({'count':_0x8fe1b5[_0xd351('0x4f')],'rows':_0x8fe1b5});});},'VoiceChannelMixMonitor':function(_0x3505fa){var _0x15adcb=this;return new Promise(function(_0xbb92d4,_0x5bc86a){if(ami[_0xd351('0x18')]()==![]){return _0x5bc86a(_0x15adcb['error'](0x1f4,[config[_0xd351('0xe')]['ip'],config[_0xd351('0xe')]['username'],'ami\x20disconnected'][_0xd351('0x11')]('\x20')));}var _0x444206=schema(properties[_0xd351('0x54')])['validate'](_0x3505fa);if(_0x444206[_0xd351('0x4f')]>0x0){return _0x5bc86a(_0x15adcb[_0xd351('0xd')](0x1f4,_['map'](_0x444206,_0xd351('0x16'))['join'](',\x20')));}var _0x1eb5f3=_[_0xd351('0x50')](_0x151391['channels'],{'uniqueid':_0x3505fa['uniqueid']});if(_0x1eb5f3&&_0x1eb5f3[_0xd351('0x55')]){var _0x58ce5a=util[_0xd351('0x6')](_0xd351('0x56'),_0x3505fa[_0xd351('0x57')]||_0x3505fa['uniqueid'],_0x3505fa[_0xd351('0x6')]||'wav');return ami['Action']({'action':'MixMonitor','channel':_0x1eb5f3[_0xd351('0x55')],'file':_0x58ce5a,'options':_0xd351('0x58')})[_0xd351('0x15')](function(_0x5a2e9b){var _0x554e3a=_[_0xd351('0x50')](_0x1eb5f3[_0xd351('0x59')],{'filename':'/var/spool/asterisk/monitor/'+_0x58ce5a[_0xd351('0x5a')]()});if(_[_0xd351('0x5b')](_0x554e3a)){_0x1eb5f3['monitors'][_0xd351('0x4e')]({'filename':'/var/spool/asterisk/monitor/'+_0x58ce5a[_0xd351('0x5a')](),'createdAt':moment()['format'](_0xd351('0x5c')),'mixmonitorid':_0x5a2e9b[_0xd351('0x5d')],'status':_0xd351('0x5e')});}else{_0x554e3a[_0xd351('0x5d')]=_0x5a2e9b[_0xd351('0x5d')];_0x554e3a[_0xd351('0x5f')]=_0xd351('0x5e');}_0xbb92d4({'code':0xc8,'message':[_0x3505fa['uniqueid'],'MixMonitor\x20Success',_0x5a2e9b[_0xd351('0x5d')]][_0xd351('0x11')]('\x20'),'mixmonitorid':_0x5a2e9b['mixmonitorid']});})[_0xd351('0x17')](function(_0x3cf4e3){_0x5bc86a(_0x15adcb[_0xd351('0xd')](0x1f5,[_0x3505fa['uniqueid'],_0x3cf4e3[_0xd351('0x16')]['toLowerCase']()]['join']('\x20')));});}else{return _0x5bc86a(_0x15adcb[_0xd351('0xd')](0x1f5,_0xd351('0x60')));}});},'VoiceChannelStopMixMonitor':function(_0x4d5a60){var _0x2a1895=this;return new Promise(function(_0x399465,_0x2d9747){if(ami[_0xd351('0x18')]()==![]){return _0x2d9747(_0x2a1895[_0xd351('0xd')](0x1f4,[config[_0xd351('0xe')]['ip'],config['asterisk'][_0xd351('0xf')],_0xd351('0x10')][_0xd351('0x11')]('\x20')));}var _0x8461b=schema(properties[_0xd351('0x54')])[_0xd351('0x2')](_0x4d5a60);if(_0x8461b[_0xd351('0x4f')]>0x0){return _0x2d9747(_0x2a1895['error'](0x1f4,_[_0xd351('0x61')](_0x8461b,'message')[_0xd351('0x11')](',\x20')));}var _0x1b240d=_[_0xd351('0x50')](_0x151391[_0xd351('0x53')],{'uniqueid':_0x4d5a60[_0xd351('0x62')]});if(_0x1b240d){return Promise['resolve']()[_0xd351('0x15')](function(){if(_0x1b240d['channel']){return ami[_0xd351('0x1a')]({'action':_0xd351('0x63'),'channel':_0x1b240d[_0xd351('0x55')],'mixmonitorid':_0x4d5a60[_0xd351('0x5d')]})[_0xd351('0x17')](function(){});}})['then'](function(){if(_0x1b240d['destinationchannel']){return ami[_0xd351('0x1a')]({'action':_0xd351('0x63'),'channel':_0x1b240d['destinationchannel'],'mixmonitorid':_0x4d5a60[_0xd351('0x5d')]})[_0xd351('0x17')](function(){});}})[_0xd351('0x15')](function(){var _0x50a38f=_[_0xd351('0x50')](_0x1b240d[_0xd351('0x59')],{'mixmonitorid':_0x4d5a60[_0xd351('0x5d')]});if(_0x50a38f){_0x50a38f[_0xd351('0x5f')]='stop';}})['then'](function(){var _0x40c78b=util[_0xd351('0x6')](_0xd351('0x56'),_0x4d5a60[_0xd351('0x57')]||_0x4d5a60[_0xd351('0x62')],_0x4d5a60[_0xd351('0x6')]||_0xd351('0x64'));var _0x5e2e06=_[_0xd351('0x50')](_0x1b240d['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x40c78b[_0xd351('0x5a')]()});if(_0x5e2e06){_0x5e2e06[_0xd351('0x5f')]='stop';}})[_0xd351('0x15')](function(){_0x399465({'code':0xc8,'message':[_0x4d5a60['uniqueid'],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xd351('0x17')](function(_0x33a381){_0x2d9747(_0x2a1895[_0xd351('0xd')](0x1f5,[_0x4d5a60['uniqueid'],_0x33a381[_0xd351('0x16')][_0xd351('0x5a')]()][_0xd351('0x11')]('\x20')));});}else{return _0x2d9747(_0x2a1895[_0xd351('0xd')](0x1f5,_0xd351('0x60')));}});},'VoiceQueuesChannels':function(){return new Promise(function(_0x475534){var _0x15fcab=_[_0xd351('0x65')](_0x151391[_0xd351('0x66')]);_0x475534({'count':_0x15fcab[_0xd351('0x4f')],'rows':_0x15fcab});});},'VoiceQueuesChannel':function(_0x18c261){var _0x4d20af=this;return new Promise(function(_0x2fcede,_0x2d59a5){var _0x431e91=schema(properties[_0xd351('0x67')])[_0xd351('0x2')](_0x18c261);if(_0x431e91[_0xd351('0x4f')]>0x0){return _0x2d59a5(_0x4d20af['error'](0x1f4,_[_0xd351('0x61')](_0x431e91,_0xd351('0x16'))['join'](',\x20')));}var _0x47ab8d=_[_0xd351('0x50')](_0x151391[_0xd351('0x66')],{'uniqueid':_0x18c261[_0xd351('0x62')]});if(_0x47ab8d){_0x2fcede(_0x47ab8d);}else{return _0x2d59a5(_0x4d20af[_0xd351('0xd')](0x1f5,_0xd351('0x60')));}});},'VoiceQueuesChannelHangup':function(_0x3d9a90){var _0x412ccd=this;return new Promise(function(_0x3fbb50,_0x3ce2b9){if(ami['isConnected']()==![]){return _0x3ce2b9(_0x412ccd[_0xd351('0xd')](0x1f4,[config[_0xd351('0xe')]['ip'],config['asterisk'][_0xd351('0xf')],'ami\x20disconnected'][_0xd351('0x11')]('\x20')));}var _0x4cd746=schema(properties[_0xd351('0x68')])[_0xd351('0x2')](_0x3d9a90);if(_0x4cd746[_0xd351('0x4f')]>0x0){return _0x3ce2b9(_0x412ccd[_0xd351('0xd')](0x1f4,_[_0xd351('0x61')](_0x4cd746,_0xd351('0x16'))[_0xd351('0x11')](',\x20')));}var _0x5adfe4=_[_0xd351('0x50')](_0x151391[_0xd351('0x66')],{'uniqueid':_0x3d9a90[_0xd351('0x62')]});if(_0x5adfe4&&_0x5adfe4[_0xd351('0x55')]){return ami[_0xd351('0x1a')]({'action':'Hangup','channel':_0x5adfe4[_0xd351('0x55')]})[_0xd351('0x15')](function(_0x38f59a){_0x3fbb50({'code':0xc8,'message':[_0x3d9a90['uniqueid'],_0x38f59a[_0xd351('0x16')][_0xd351('0x5a')]()][_0xd351('0x11')]('\x20')});})[_0xd351('0x17')](function(_0x3635ad){_0x3ce2b9(_0x412ccd[_0xd351('0xd')](0x1f5,[_0x3d9a90[_0xd351('0x62')],_0x3635ad[_0xd351('0x16')][_0xd351('0x5a')]()]['join']('\x20')));});}else{return _0x3ce2b9(_0x412ccd[_0xd351('0xd')](0x1f5,_0xd351('0x60')));}});},'VoiceQueuesChannelRedirect':function(_0x5036e6){var _0x44df63=this;return new Promise(function(_0x4c1468,_0x542aa6){if(ami['isConnected']()==![]){return _0x542aa6(_0x44df63[_0xd351('0xd')](0x1f4,[config[_0xd351('0xe')]['ip'],config[_0xd351('0xe')]['username'],_0xd351('0x10')]['join']('\x20')));}var _0x1f1b6b=schema(properties['voicequeuechannelredirect'])[_0xd351('0x2')](_0x5036e6);if(_0x1f1b6b[_0xd351('0x4f')]>0x0){return _0x542aa6(_0x44df63[_0xd351('0xd')](0x1f4,_[_0xd351('0x61')](_0x1f1b6b,_0xd351('0x16'))[_0xd351('0x11')](',\x20')));}var _0x2c4340=_[_0xd351('0x50')](_0x151391[_0xd351('0x66')],{'uniqueid':_0x5036e6[_0xd351('0x62')]});if(_0x2c4340&&_0x2c4340[_0xd351('0x55')]){return ami[_0xd351('0x1a')]({'action':'Redirect','channel':_0x2c4340[_0xd351('0x55')],'exten':_0x5036e6[_0xd351('0x69')],'context':_0x5036e6[_0xd351('0x6a')]||_0x2c4340[_0xd351('0x6a')],'priority':0x1})[_0xd351('0x15')](function(_0x47d931){_0x4c1468({'code':0xc8,'message':[_0x5036e6[_0xd351('0x62')],_0x47d931[_0xd351('0x16')][_0xd351('0x5a')]()][_0xd351('0x11')]('\x20')});})['catch'](function(_0x1fda25){_0x542aa6(_0x44df63[_0xd351('0xd')](0x1f5,[_0x5036e6['uniqueid'],_0x1fda25[_0xd351('0x16')][_0xd351('0x5a')]()][_0xd351('0x11')]('\x20')));});}else{return _0x542aa6(_0x44df63[_0xd351('0xd')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x523895){return new Promise(function(_0x467253){var _0xe63226=_[_0xd351('0x65')](_0x151391[_0xd351('0xb')]);if(_0x523895&&_0x523895['id']){var _0x54980e=_[_0xd351('0x50')](_0xe63226,function(_0x3817c5){return _0x3817c5['id']===_0x523895['id'];});_0x467253(_0x54980e);}else{_0x467253({'count':_0xe63226[_0xd351('0x4f')],'rows':_0xe63226});}});},'Telephones':function(){return new Promise(function(_0x96c447){var _0xa128dc=_['values'](_0x151391[_0xd351('0x6b')]);_0x96c447({'count':_0xa128dc[_0xd351('0x4f')],'rows':_0xa128dc});});},'Trunks':function(){return new Promise(function(_0x4ec2ce){var _0x23b50f=_[_0xd351('0x65')](_0x151391['trunks']);_0x4ec2ce({'count':_0x23b50f[_0xd351('0x4f')],'rows':_0x23b50f});});},'OutboundChannels':function(){return new Promise(function(_0x55b81e){var _0x2197b7=_['values'](_0x151391[_0xd351('0x6c')]);_0x55b81e({'count':_0x2197b7[_0xd351('0x4f')],'rows':_0x2197b7});});},'Outbound':function(){return new Promise(function(_0x42cdc){_0x42cdc(_0x151391[_0xd351('0x6d')]);});},'Campaigns':function(){return new Promise(function(_0x34835d){var _0x184528=_[_0xd351('0x65')](_0x151391[_0xd351('0x6e')]);_0x34835d({'count':_0x184528[_0xd351('0x4f')],'rows':_0x184528});});},'VoiceQueuesPreview':function(_0x5db113){var _0x2cd080=this;return new Promise(function(_0x40ca64,_0x2086b2){_0x49610f[_0xd351('0x6f')](_0x5db113['id'])[_0xd351('0x15')](function(_0xe26fa7){_0x40ca64({'code':0xc8,'message':_0xe26fa7[_0xd351('0x16')]});})[_0xd351('0x17')](function(_0x56458b){_0x2086b2(_0x2cd080[_0xd351('0xd')](0x1f4,_0x56458b['message']));});});},'EventManager':function(_0x394830){var _0x128976=this;return new Promise(function(_0xd3dad3,_0x3eedde){if(!_0x394830[_0xd351('0x70')]){return _0x3eedde(_0x128976['error'](0x1f4,_0xd351('0x71')));}ami[_0xd351('0x72')](_0xd351('0x73')+_0x394830[_0xd351('0x70')],_0x394830[_0xd351('0x16')]);_0xd3dad3({'code':0xc8,'message':_0x394830});});},'FaxAccounts':function(){return new Promise(function(_0x68ada2){var _0x293b08=_[_0xd351('0x65')](_0x151391[_0xd351('0x74')]);_0x68ada2({'count':_0x293b08[_0xd351('0x4f')],'rows':_0x293b08});});},'SendFax':function(_0x1d8bbf){var _0x16241d=this;return new Promise(function(_0x1fbbf5,_0x4ddd65){_0x1cd581['send'](_0x1d8bbf)[_0xd351('0x15')](function(_0x4becc0){_0x1fbbf5({'code':0xc8,'message':_0x4becc0[_0xd351('0x16')]});})[_0xd351('0x17')](function(_0x4557ed){_0x4ddd65(_0x16241d[_0xd351('0xd')](0x1f4,_0x4557ed[_0xd351('0x16')]));});});},'CheckAfterSend':function(_0x54fc9c){var _0x2443bd=this;return new Promise(function(_0x53b225,_0x47ebca){_0x1cd581[_0xd351('0x75')](_0x54fc9c)[_0xd351('0x15')](function(_0x3e58db){_0x53b225({'code':0xc8,'message':_0x3e58db[_0xd351('0x16')]});})[_0xd351('0x17')](function(_0x4424cb){_0x47ebca(_0x2443bd[_0xd351('0xd')](0x1f4,_0x4424cb['message']));});});}};var _0xd2bfe5=jayson[_0xd351('0x76')](_0x5318b2)[_0xd351('0x77')]();_0xd2bfe5['on'](_0xd351('0xd'),function(_0x3da429){return _0x88bd2b(_0x3da429);});_0xd2bfe5[_0xd351('0x5')](0x232a,'127.0.0.1',function(){console['log'](_0xd351('0x78'),0x232a);return _0x45e9e5('RPC\x20listening\x20on\x20port:'+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 0d86b26..74556f1 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 _0xb602=['redis','socket.io-emitter','info','stringify','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','lastName','mobile','fax','createdAt','scheduledAt','resolve','then','getContacts','length','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','firstName','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','user:%s','name','format','trigger:%s','action','toLowerCase','merge','lodash','bluebird','ioredis','util','../../rpc/cmContact'];(function(_0x324679,_0xc24201){var _0x1f7038=function(_0x9f0e34){while(--_0x9f0e34){_0x324679['push'](_0x324679['shift']());}};_0x1f7038(++_0xc24201);}(_0xb602,0x175));var _0x2b60=function(_0x44206a,_0x3ead85){_0x44206a=_0x44206a-0x0;var _0x483f11=_0xb602[_0x44206a];return _0x483f11;};'use strict';var _=require(_0x2b60('0x0'));var BPromise=require(_0x2b60('0x1'));var Redis=require(_0x2b60('0x2'));var util=require(_0x2b60('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0x2b60('0x4'));config['redis']=_['defaults'](config[_0x2b60('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x2b60('0x6'))(new Redis(config[_0x2b60('0x5')]));function emit(_0x272982,_0x149e5d,_0x43420e,_0x2b54bf,_0x25de9f){logger[_0x2b60('0x7')]('[CM][%s][%s]',_0x272982,_0x149e5d['id'],_0x43420e,_0x2b54bf,JSON[_0x2b60('0x8')](_0x25de9f));io['to'](_0x43420e)['emit'](_0x2b54bf,_0x25de9f);}exports[_0x2b60('0x9')]=function(_0x5c7d8d,_0x240abb,_0x4f69a9,_0x5b7daf){var _0x5c9c71,_0x499558;var _0x3f3045={};var _0x2c3484;var _0x16f3d6=Number(_0x4f69a9[_0x2b60('0xa')]);var _0x366706=_0x4f69a9['data2']?Boolean(Number(_0x4f69a9[_0x2b60('0xb')])):![];var _0x4a9b06;var _0x96e785=![];if(!_[_0x2b60('0xc')](_0x4f69a9['data5'])){if(_0x4f69a9[_0x2b60('0xd')]=='1')_0x96e785=!![];}if(!_0x96e785){if(_0x5b7daf['xmd-contactid']){_0x3f3045['id']=_0x5b7daf[_0x2b60('0xe')];}}if(!_0x3f3045['id']){_0x3f3045[_0x2b60('0xf')]=_0x16f3d6;_0x4a9b06=_0x4f69a9[_0x2b60('0x10')]&&_0x4f69a9[_0x2b60('0x10')]!=='0'?_0x4f69a9[_0x2b60('0x10')][_0x2b60('0x11')](','):[_0x2b60('0x12')];_0x3f3045[_0x2b60('0x13')]=_[_0x2b60('0x14')](_0x4a9b06,function(_0x21eaf3){var _0x16aa79={};_0x16aa79[_0x21eaf3]=_0x5b7daf[_0x2b60('0x15')]?_0x5b7daf[_0x2b60('0x16')]:_0x5b7daf[_0x2b60('0x17')];return _0x16aa79;});_0x2c3484=_0x5b7daf['routeId']?_0x5b7daf[_0x2b60('0x16')]:_0x5b7daf[_0x2b60('0x17')];}var _0x4d0779=['id','firstName',_0x2b60('0x18'),_0x2b60('0x12'),_0x2b60('0x19'),_0x2b60('0x1a'),'ListId',_0x2b60('0x1b'),_0x2b60('0x1c'),'updatedAt'];var _0x38ca18=_['union'](_0x4d0779,_0x4a9b06);BPromise[_0x2b60('0x1d')]()[_0x2b60('0x1e')](cmContactRpc[_0x2b60('0x1f')]({'attributes':_0x38ca18,'where':_0x3f3045,'phone':_0x2c3484}))[_0x2b60('0x1e')](function(_0x54907c){_0x499558=_0x54907c;if(!_['isEmpty'](_0x499558)){if(_0x499558[_0x2b60('0x20')]===0x1){_0x5c9c71=_0x499558[0x0];logger[_0x2b60('0x7')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x5b7daf['uniqueid'],_0x240abb['id'],_0x5c9c71['id']);}else{logger[_0x2b60('0x7')](_0x2b60('0x21'),_0x5b7daf[_0x2b60('0x22')],_0x240abb['id'],_[_0x2b60('0x14')](_0x499558,'id')['join'](','));}return;}else{logger[_0x2b60('0x7')](_0x2b60('0x23'),_0x5b7daf['uniqueid'],_0x240abb['id']);var _0x47d3dc={'ListId':_0x16f3d6};var _0x1d0e09=_0x4f69a9['data4']&&_0x4f69a9[_0x2b60('0x24')]!=='0'?_0x4f69a9['data4']:_0x2b60('0x12');if(_0x366706){logger['info'](_0x2b60('0x25'),_0x5b7daf[_0x2b60('0x22')],_0x240abb['id']);_0x47d3dc[_0x1d0e09]=_[_0x2b60('0xc')](_0x5b7daf[_0x2b60('0x15')])?_0x5b7daf['calleridnum']:_0x5b7daf['destcalleridnum'];if(_['isNil'](_0x5b7daf[_0x2b60('0x15')])){_0x47d3dc[_0x2b60('0x26')]=_0x5b7daf[_0x2b60('0x27')]&&_0x5b7daf[_0x2b60('0x27')]!==_0x2b60('0x28')?_0x5b7daf[_0x2b60('0x27')]:_0x2b60('0x29');}else{_0x47d3dc[_0x2b60('0x26')]=_0x5b7daf[_0x2b60('0x2a')]&&_0x5b7daf[_0x2b60('0x2a')]!==_0x2b60('0x28')?_0x5b7daf[_0x2b60('0x2a')]:'Unknown';}return BPromise[_0x2b60('0x1d')]()[_0x2b60('0x1e')](cmContactRpc[_0x2b60('0x2b')](_0x47d3dc))[_0x2b60('0x1e')](function(_0x4284c1){_0x5c9c71=_0x4284c1;_0x499558[_0x2b60('0x2c')](_0x4284c1);if(_0x5c9c71){logger[_0x2b60('0x7')](_0x2b60('0x2d'),_0x5b7daf[_0x2b60('0x22')],_0x240abb['id'],_0x5c9c71['id']);}return;});}else{logger[_0x2b60('0x7')](_0x2b60('0x2e'),_0x5b7daf[_0x2b60('0x22')],_0x240abb['id']);_0x47d3dc[_0x1d0e09]=_['isNil'](_0x5b7daf[_0x2b60('0x15')])?_0x5b7daf['calleridnum']:_0x5b7daf[_0x2b60('0x16')];if(_[_0x2b60('0xc')](_0x5b7daf[_0x2b60('0x15')])){_0x47d3dc[_0x2b60('0x26')]=_0x5b7daf[_0x2b60('0x27')]&&_0x5b7daf[_0x2b60('0x27')]!==_0x2b60('0x28')?_0x5b7daf[_0x2b60('0x27')]:_0x2b60('0x29');}else{_0x47d3dc['firstName']=_0x5b7daf['destcalleridname']&&_0x5b7daf[_0x2b60('0x2a')]!==''?_0x5b7daf['destcalleridname']:_0x2b60('0x29');}_0x5c9c71=_0x47d3dc;_0x499558[_0x2b60('0x2c')](_0x47d3dc);return;}}})[_0x2b60('0x1e')](function(){if(_0x5c7d8d){emit(_0x5b7daf[_0x2b60('0x22')],_0x240abb,util['format'](_0x2b60('0x2f'),_0x5c7d8d[_0x2b60('0x30')]),util[_0x2b60('0x31')](_0x2b60('0x32'),_0x4f69a9[_0x2b60('0x33')][_0x2b60('0x34')]()),{'evt':_[_0x2b60('0x35')](_0x5b7daf,{'autoCreate':_0x366706}),'contact':_0x5c9c71===undefined?{}:_0x5c9c71,'contacts':_0x499558['length']===0x0?undefined:_0x499558});}});}; \ No newline at end of file +var _0x15bd=['name','trigger:%s','action','toLowerCase','merge','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','emit','exec','data1','data2','data5','xmd-contactid','ListId','data3','split','phone','$or','destcalleridnum','calleridnum','routeId','firstName','mobile','fax','createdAt','scheduledAt','union','then','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','map','join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname','','Unknown','destcalleridname','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s'];(function(_0x3746ff,_0x5dfa8f){var _0x353055=function(_0x11eae1){while(--_0x11eae1){_0x3746ff['push'](_0x3746ff['shift']());}};_0x353055(++_0x5dfa8f);}(_0x15bd,0x6f));var _0xd15b=function(_0x5585f5,_0x167771){_0x5585f5=_0x5585f5-0x0;var _0x3439c9=_0x15bd[_0x5585f5];return _0x3439c9;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var Redis=require('ioredis');var util=require(_0xd15b('0x0'));var config=require(_0xd15b('0x1'));var logger=require(_0xd15b('0x2'))(_0xd15b('0x3'));var cmContactRpc=require(_0xd15b('0x4'));config[_0xd15b('0x5')]=_[_0xd15b('0x6')](config[_0xd15b('0x5')],{'host':_0xd15b('0x7'),'port':0x18eb});var io=require(_0xd15b('0x8'))(new Redis(config[_0xd15b('0x5')]));function emit(_0x43b34e,_0xeabe0a,_0x17a19f,_0x9a3bf3,_0x1c2632){logger[_0xd15b('0x9')]('[CM][%s][%s]',_0x43b34e,_0xeabe0a['id'],_0x17a19f,_0x9a3bf3,JSON['stringify'](_0x1c2632));io['to'](_0x17a19f)[_0xd15b('0xa')](_0x9a3bf3,_0x1c2632);}exports[_0xd15b('0xb')]=function(_0x25e94c,_0xd63e27,_0x51bdb5,_0x2a0dbb){var _0x4ce817,_0x1f6863;var _0x3532ea={};var _0x5ef47f;var _0x58033f=Number(_0x51bdb5[_0xd15b('0xc')]);var _0x4654d9=_0x51bdb5['data2']?Boolean(Number(_0x51bdb5[_0xd15b('0xd')])):![];var _0x2fca2e;var _0x493297=![];if(!_['isNil'](_0x51bdb5['data5'])){if(_0x51bdb5[_0xd15b('0xe')]=='1')_0x493297=!![];}if(!_0x493297){if(_0x2a0dbb['xmd-contactid']){_0x3532ea['id']=_0x2a0dbb[_0xd15b('0xf')];}}if(!_0x3532ea['id']){_0x3532ea[_0xd15b('0x10')]=_0x58033f;_0x2fca2e=_0x51bdb5[_0xd15b('0x11')]&&_0x51bdb5['data3']!=='0'?_0x51bdb5[_0xd15b('0x11')][_0xd15b('0x12')](','):[_0xd15b('0x13')];_0x3532ea[_0xd15b('0x14')]=_['map'](_0x2fca2e,function(_0x417b70){var _0x1b49d8={};_0x1b49d8[_0x417b70]=_0x2a0dbb['routeId']?_0x2a0dbb[_0xd15b('0x15')]:_0x2a0dbb[_0xd15b('0x16')];return _0x1b49d8;});_0x5ef47f=_0x2a0dbb[_0xd15b('0x17')]?_0x2a0dbb[_0xd15b('0x15')]:_0x2a0dbb[_0xd15b('0x16')];}var _0x2e42e0=['id',_0xd15b('0x18'),'lastName',_0xd15b('0x13'),_0xd15b('0x19'),_0xd15b('0x1a'),_0xd15b('0x10'),_0xd15b('0x1b'),_0xd15b('0x1c'),'updatedAt'];var _0x2332d1=_[_0xd15b('0x1d')](_0x2e42e0,_0x2fca2e);BPromise['resolve']()['then'](cmContactRpc['getContacts']({'attributes':_0x2332d1,'where':_0x3532ea,'phone':_0x5ef47f}))[_0xd15b('0x1e')](function(_0x392ba8){_0x1f6863=_0x392ba8;if(!_['isEmpty'](_0x1f6863)){if(_0x1f6863[_0xd15b('0x1f')]===0x1){_0x4ce817=_0x1f6863[0x0];logger[_0xd15b('0x9')](_0xd15b('0x20'),_0x2a0dbb['uniqueid'],_0xd63e27['id'],_0x4ce817['id']);}else{logger['info']('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x2a0dbb[_0xd15b('0x21')],_0xd63e27['id'],_[_0xd15b('0x22')](_0x1f6863,'id')[_0xd15b('0x23')](','));}return;}else{logger['info']('[CM][%s][%s]\x20Contact\x20not\x20found',_0x2a0dbb[_0xd15b('0x21')],_0xd63e27['id']);var _0x31fb87={'ListId':_0x58033f};var _0x41fe7a=_0x51bdb5[_0xd15b('0x24')]&&_0x51bdb5[_0xd15b('0x24')]!=='0'?_0x51bdb5[_0xd15b('0x24')]:'phone';if(_0x4654d9){logger[_0xd15b('0x9')](_0xd15b('0x25'),_0x2a0dbb[_0xd15b('0x21')],_0xd63e27['id']);_0x31fb87[_0x41fe7a]=_[_0xd15b('0x26')](_0x2a0dbb[_0xd15b('0x17')])?_0x2a0dbb[_0xd15b('0x16')]:_0x2a0dbb[_0xd15b('0x15')];if(_[_0xd15b('0x26')](_0x2a0dbb[_0xd15b('0x17')])){_0x31fb87['firstName']=_0x2a0dbb[_0xd15b('0x27')]&&_0x2a0dbb[_0xd15b('0x27')]!==_0xd15b('0x28')?_0x2a0dbb['calleridname']:_0xd15b('0x29');}else{_0x31fb87[_0xd15b('0x18')]=_0x2a0dbb[_0xd15b('0x2a')]&&_0x2a0dbb[_0xd15b('0x2a')]!==_0xd15b('0x28')?_0x2a0dbb[_0xd15b('0x2a')]:_0xd15b('0x29');}return BPromise['resolve']()['then'](cmContactRpc['createContact'](_0x31fb87))['then'](function(_0x2e1e71){_0x4ce817=_0x2e1e71;_0x1f6863[_0xd15b('0x2b')](_0x2e1e71);if(_0x4ce817){logger[_0xd15b('0x9')](_0xd15b('0x2c'),_0x2a0dbb['uniqueid'],_0xd63e27['id'],_0x4ce817['id']);}return;});}else{logger['info'](_0xd15b('0x2d'),_0x2a0dbb[_0xd15b('0x21')],_0xd63e27['id']);_0x31fb87[_0x41fe7a]=_[_0xd15b('0x26')](_0x2a0dbb[_0xd15b('0x17')])?_0x2a0dbb[_0xd15b('0x16')]:_0x2a0dbb[_0xd15b('0x15')];if(_[_0xd15b('0x26')](_0x2a0dbb['routeId'])){_0x31fb87[_0xd15b('0x18')]=_0x2a0dbb['calleridname']&&_0x2a0dbb[_0xd15b('0x27')]!==_0xd15b('0x28')?_0x2a0dbb['calleridname']:_0xd15b('0x29');}else{_0x31fb87['firstName']=_0x2a0dbb[_0xd15b('0x2a')]&&_0x2a0dbb['destcalleridname']!==''?_0x2a0dbb[_0xd15b('0x2a')]:'Unknown';}_0x4ce817=_0x31fb87;_0x1f6863[_0xd15b('0x2b')](_0x31fb87);return;}}})[_0xd15b('0x1e')](function(){if(_0x25e94c){emit(_0x2a0dbb['uniqueid'],_0xd63e27,util[_0xd15b('0x2e')](_0xd15b('0x2f'),_0x25e94c[_0xd15b('0x30')]),util[_0xd15b('0x2e')](_0xd15b('0x31'),_0x51bdb5[_0xd15b('0x32')][_0xd15b('0x33')]()),{'evt':_[_0xd15b('0x34')](_0x2a0dbb,{'autoCreate':_0x4654d9}),'contact':_0x4ce817===undefined?{}:_0x4ce817,'contacts':_0x1f6863[_0xd15b('0x1f')]===0x0?undefined:_0x1f6863});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index c75e0c1..44f20da 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 _0x7f7e=['info','stringify','clone','motionChannel','undefined','checkTriggers','hasOwnProperty','status','variables','Actions','interface','action','toLowerCase','contactmanager','motionbar','browser','data1','data2','html','template\x20not\x20found','uri','isNil','data3','data4','location','uriLocation','data5','800','windowHeight','data6','winArguments','render','format','user:%s','name','trigger:%s:%s','merge','jscripty','trigger:%s','exec','integration','voiceQueues','queue','urlforward','script','buildUri','parse','replace','checkTrigger','channel','AllConditions','length','every','checkConditions','AnyConditions','some','field','account','operator','value','ChatWebsiteId','upperFirst','AccountId','interaction','message','membername','lastevent','null','offlineMessage','created','equals','exports','util','url','mustache','ioredis','./integration','./script','../../../config/environment','../ami','redis','defaults','localhost','popup','winapp','triggers','agents','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:offlineMessage','prototype','emit'];(function(_0x589c2f,_0x37a464){var _0x5b89e7=function(_0x5668cb){while(--_0x5668cb){_0x589c2f['push'](_0x589c2f['shift']());}};_0x5b89e7(++_0x37a464);}(_0x7f7e,0xc6));var _0xe7f7=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x7f7e[_0x178e48];return _0x440d7e;};'use strict';var util=require(_0xe7f7('0x0'));var _=require('lodash');var url=require(_0xe7f7('0x1'));var Mustache=require(_0xe7f7('0x2'));var Redis=require(_0xe7f7('0x3'));var urlforward=require('./urlforward');var integration=require(_0xe7f7('0x4'));var cmContact=require('./cmContact');var script=require(_0xe7f7('0x5'));var config=require(_0xe7f7('0x6'));var logger=require('../../../config/logger')('trigger');var ami=require(_0xe7f7('0x7'));config[_0xe7f7('0x8')]=_[_0xe7f7('0x9')](config[_0xe7f7('0x8')],{'host':_0xe7f7('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe7f7('0x8')]));var operators={'equals':function(_0x1b9778,_0x4b1b6b){return _0x1b9778==_0x4b1b6b;},'not_equals':function(_0x7c2051,_0x2444be){return _0x7c2051!=_0x2444be;}};var barAndWebActions=[_0xe7f7('0xb'),_0xe7f7('0x1'),_0xe7f7('0xc')];function Trigger(_0x5abafb){this[_0xe7f7('0xd')]=_0x5abafb['triggers'];this[_0xe7f7('0xe')]=_0x5abafb[_0xe7f7('0xe')];this['voiceQueues']=_0x5abafb['voiceQueues'];this[_0xe7f7('0xf')]=_0x5abafb['templates'];this['voiceExtensions']=_0x5abafb[_0xe7f7('0x10')];this[_0xe7f7('0x11')]=_0x5abafb[_0xe7f7('0x11')];this[_0xe7f7('0x12')]=_0x5abafb['freshdeskAccounts'];this[_0xe7f7('0x13')]=_0x5abafb[_0xe7f7('0x13')];this[_0xe7f7('0x14')]=_0x5abafb[_0xe7f7('0x14')];this[_0xe7f7('0x15')]=_0x5abafb[_0xe7f7('0x15')];this[_0xe7f7('0x16')]=_0x5abafb['deskAccounts'];this[_0xe7f7('0x17')]=_0x5abafb[_0xe7f7('0x17')];this[_0xe7f7('0x18')]=_0x5abafb[_0xe7f7('0x18')];this[_0xe7f7('0x19')]=_0x5abafb[_0xe7f7('0x19')];this[_0xe7f7('0x1a')]=_0x5abafb[_0xe7f7('0x1a')];this[_0xe7f7('0x1b')]={'zendesk':this[_0xe7f7('0x11')],'salesforce':this['salesforceAccounts'],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0xe7f7('0x14')],'zoho':this[_0xe7f7('0x15')],'desk':this['deskAccounts'],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0xe7f7('0x19')],'freshsales':this[_0xe7f7('0x1a')],'servicenow':this[_0xe7f7('0x18')]};ami['on'](_0xe7f7('0x1c'),this[_0xe7f7('0x1d')][_0xe7f7('0x1e')](this));ami['on'](_0xe7f7('0x1f'),this['syncCustomEvent'][_0xe7f7('0x1e')](this));ami['on'](_0xe7f7('0x20'),this[_0xe7f7('0x1d')]['bind'](this));ami['on'](_0xe7f7('0x21'),this[_0xe7f7('0x1d')][_0xe7f7('0x1e')](this));ami['on'](_0xe7f7('0x22'),this[_0xe7f7('0x1d')][_0xe7f7('0x1e')](this));ami['on']('custom:agentnoanswer',this[_0xe7f7('0x1d')][_0xe7f7('0x1e')](this));ami['on'](_0xe7f7('0x23'),this[_0xe7f7('0x1d')][_0xe7f7('0x1e')](this));ami['on'](_0xe7f7('0x24'),this[_0xe7f7('0x1d')][_0xe7f7('0x1e')](this));ami['on'](_0xe7f7('0x25'),this[_0xe7f7('0x1d')][_0xe7f7('0x1e')](this));ami['on'](_0xe7f7('0x26'),this[_0xe7f7('0x1d')][_0xe7f7('0x1e')](this));ami['on'](_0xe7f7('0x27'),this[_0xe7f7('0x1d')]['bind'](this));ami['on'](_0xe7f7('0x28'),this[_0xe7f7('0x1d')]['bind'](this));ami['on'](_0xe7f7('0x29'),this[_0xe7f7('0x2a')][_0xe7f7('0x1e')](this));ami['on'](_0xe7f7('0x2b'),this[_0xe7f7('0x2a')][_0xe7f7('0x1e')](this));ami['on'](_0xe7f7('0x2c'),this[_0xe7f7('0x2a')][_0xe7f7('0x1e')](this));ami['on'](_0xe7f7('0x2d'),this[_0xe7f7('0x1d')]['bind'](this));ami['on'](_0xe7f7('0x2e'),this[_0xe7f7('0x1d')][_0xe7f7('0x1e')](this));ami['on'](_0xe7f7('0x2f'),this['syncCustomEvent'][_0xe7f7('0x1e')](this));ami['on'](_0xe7f7('0x30'),this[_0xe7f7('0x1d')]['bind'](this));ami['on'](_0xe7f7('0x31'),this['syncCustomEvent']['bind'](this));ami['on'](_0xe7f7('0x32'),this[_0xe7f7('0x1d')][_0xe7f7('0x1e')](this));ami['on']('custom:rejectmessage',this[_0xe7f7('0x1d')][_0xe7f7('0x1e')](this));ami['on'](_0xe7f7('0x33'),this[_0xe7f7('0x1d')][_0xe7f7('0x1e')](this));}Trigger[_0xe7f7('0x34')][_0xe7f7('0x35')]=function(_0x1d61a0,_0x47c95f,_0x5e68a7){logger[_0xe7f7('0x36')](_0x1d61a0,_0x47c95f,JSON[_0xe7f7('0x37')](_0x5e68a7));io['to'](_0x1d61a0)[_0xe7f7('0x35')](_0x47c95f,_0x5e68a7);};Trigger[_0xe7f7('0x34')]['syncCustomEvent']=function(_0x38ccaa){var _0x472da1=_[_0xe7f7('0x38')](_0x38ccaa);if(typeof _0x472da1[_0xe7f7('0x39')]===_0xe7f7('0x3a')){_0x472da1['motionChannel']='voice';}this[_0xe7f7('0x3b')](_0x472da1);};Trigger[_0xe7f7('0x34')]['syncAgentDial']=function(_0xc25ae){if(this[_0xe7f7('0xe')][_0xc25ae['interface']]){this[_0xe7f7('0x1d')](_0xc25ae);}};Trigger[_0xe7f7('0x34')][_0xe7f7('0x3b')]=function(_0x55eedb){var _0x4cdd4a;for(var _0x5d8493 in this[_0xe7f7('0xd')]){if(this[_0xe7f7('0xd')][_0xe7f7('0x3c')](_0x5d8493)){if(this['triggers'][_0x5d8493][_0xe7f7('0x3d')]){_0x4cdd4a=this['checkTrigger'](this[_0xe7f7('0xd')][_0x5d8493],_0x55eedb);if(_0x4cdd4a){_['merge'](_0x55eedb,_0x55eedb[_0xe7f7('0x3e')]);for(var _0x141893=0x0,_0x46dfee,_0x360a33,_0x141ce6;_0x1418930x0){_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 _0xe14b=['CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','%s/customers/%d/cases','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','integrationTab','newTab','catch','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','ioredis','./util','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','application/json','validateEmail','format','%s/users','then','total_entries','find','_embedded','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','%s/customers','remoteUri','POST','length','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variableName','custom_fields','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe14b,0x93));var _0xbe14=function(_0x16697e,_0x112bf8){_0x16697e=_0x16697e-0x0;var _0x218ede=_0xe14b[_0x16697e];return _0x218ede;};'use strict';var _=require(_0xbe14('0x0'));var rp=require(_0xbe14('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0xbe14('0x2'));var intUtil=require(_0xbe14('0x3'));var config=require('../../../../config/environment');var logger=require(_0xbe14('0x4'))('desk');config['redis']=_[_0xbe14('0x5')](config[_0xbe14('0x6')],{'host':_0xbe14('0x7'),'port':0x18eb});var io=require(_0xbe14('0x8'))(new Redis(config[_0xbe14('0x6')]));function emit(_0x39387e,_0x196fca,_0x566ae7){io['to'](_0x39387e)['emit'](_0x196fca,_0x566ae7);}var headers={'Content-Type':'application/json','Accept':_0xbe14('0x9')};function getUser(_0x6fceff,_0xd68cd7){if(intUtil[_0xbe14('0xa')](_0xd68cd7)===!![]){logger['info']('Getting\x20agent\x20with\x20email',_0xd68cd7);return request({'uri':util[_0xbe14('0xb')](_0xbe14('0xc'),_0x6fceff['remoteUri'])})[_0xbe14('0xd')](function(_0x35aa19){if(_0x35aa19[_0xbe14('0xe')]){return _[_0xbe14('0xf')](_0x35aa19[_0xbe14('0x10')][_0xbe14('0x11')],{'email':_0xd68cd7});}})[_0xbe14('0xd')](function(_0x2850cb){if(_0x2850cb){logger[_0xbe14('0x12')](_0xbe14('0x13'));return _0x2850cb;}else{logger[_0xbe14('0x12')](_0xbe14('0x14'));return request({'uri':util[_0xbe14('0xb')]('%s/users/me',_0x6fceff['remoteUri'])});}});}else{logger[_0xbe14('0x12')](_0xbe14('0x15'));return request({'uri':util[_0xbe14('0xb')](_0xbe14('0x16'),_0x6fceff['remoteUri'])});}}function request(_0x21c789){logger[_0xbe14('0x17')](_0xbe14('0x18'),JSON[_0xbe14('0x19')](_0x21c789));return rp(_[_0xbe14('0x5')](_0x21c789,{'method':_0xbe14('0x1a'),'headers':headers,'json':!![]}));}function getAuth(_0x17ae86){var _0x5ea1f8;if(_0x17ae86[_0xbe14('0x1b')]===_0xbe14('0x1c')){_0x5ea1f8=util[_0xbe14('0xb')](_0xbe14('0x1d'),_0x17ae86[_0xbe14('0x1e')],_0x17ae86[_0xbe14('0x1f')]);}else if(_0x17ae86['authType']===_0xbe14('0x20')){_0x5ea1f8=util[_0xbe14('0xb')](_0xbe14('0x21'),_0x17ae86[_0xbe14('0x1e')],_0x17ae86[_0xbe14('0x20')]);}return util['format'](_0xbe14('0x22'),new Buffer(_0x5ea1f8)['toString'](_0xbe14('0x23')));}function getEndUser(_0x56e80c,_0x32e8eb,_0x4a25fa){logger[_0xbe14('0x12')](_0xbe14('0x24'),_0x4a25fa);return request({'uri':util['format'](_0xbe14('0x25'),_0x56e80c['remoteUri']),'qs':{'phone':_0x4a25fa}})[_0xbe14('0xd')](function(_0x4851f8){if(_0x4851f8[_0xbe14('0xe')]){logger[_0xbe14('0x12')](_0xbe14('0x26'));return _0x4851f8[_0xbe14('0x10')][_0xbe14('0x11')][0x0];}else{logger[_0xbe14('0x12')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xbe14('0xb')](_0xbe14('0x27'),_0x56e80c[_0xbe14('0x28')]),'method':_0xbe14('0x29'),'body':{'first_name':_0x32e8eb,'title':_0x32e8eb,'phone_numbers':[{'type':'work','value':_0x4a25fa}]}});}});}function getTags(_0x16f884,_0x29fc64){var _0x59bf34=[];if(_0x16f884&&_0x16f884[_0xbe14('0x2a')]>0x0){_0x59bf34=_[_0xbe14('0x2b')](_0x16f884,_0x29fc64);}return _0x59bf34;}function getCustomFields(_0x1c7cc7,_0x19252f){var _0x34d648=[];var _0x36d4b2={'custom_fields':{}};if(_0x1c7cc7[_0xbe14('0x2a')]>0x0){_[_0xbe14('0x2c')](_0x1c7cc7,function(_0x4168c8){if(_[_0xbe14('0x2d')]([_0xbe14('0x2e'),_0xbe14('0x2f')],_0x4168c8[_0xbe14('0x30')])&&_0x4168c8[_0xbe14('0x31')]&&!_0x4168c8[_0xbe14('0x32')]){_0x36d4b2[_0x4168c8[_0xbe14('0x31')][_0xbe14('0x33')]()]=_0x4168c8[_0xbe14('0x34')][_0xbe14('0x35')]();}else if(_[_0xbe14('0x2d')](['string',_0xbe14('0x2f')],_0x4168c8['type'])&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x36d4b2['custom_fields'][_0x4168c8[_0xbe14('0x36')]]=_0x4168c8[_0xbe14('0x34')]['toString']();}else if(_0x4168c8['type']==='variable'&&_0x4168c8[_0xbe14('0x37')]&&_0x4168c8[_0xbe14('0x36')]&&_0x4168c8['customField']){_0x19252f[_0x4168c8[_0xbe14('0x37')]]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x37')]][_0xbe14('0x35')]());}else if(_0x4168c8['type']==='customVariable'&&_0x4168c8[_0xbe14('0x39')]&&_0x4168c8['Variable']['name']&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()][_0xbe14('0x35')]());}});}if(_0x36d4b2[_0xbe14('0x3b')]){_0x36d4b2[_0xbe14('0x3b')]=Number(_0x36d4b2['priority']);}return _0x36d4b2;}function getTicket(_0x4f51f8,_0x43cdaa,_0x2951e1,_0x13bfcf,_0x520e09){logger[_0xbe14('0x12')](_0xbe14('0x3c'));var _0xeda70e=_[_0xbe14('0x3d')]({'subject':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x3f')],_0x520e09,'\x20'),'type':_0xbe14('0x40'),'status':_0xbe14('0x41'),'labels':[_0xbe14('0x42'),'Motion',_0xbe14('0x43')][_0xbe14('0x44')](getTags(_0x13bfcf[_0xbe14('0x45')],_0xbe14('0x3a'))),'description':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xbe14('0x47'),_0x43cdaa['id']),'class':_0xbe14('0x48')}},'message':{'direction':'in','body':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a')}},getCustomFields(_0x13bfcf['Fields'],_0x520e09));return request({'uri':util['format'](_0xbe14('0x49'),_0x4f51f8[_0xbe14('0x28')],_0x2951e1['id']),'method':_0xbe14('0x29'),'body':_0xeda70e});}exports['queue']=function(_0x5d5318,_0x6b6aa8,_0x59ae4d,_0x5657fe,_0x3593f8,_0x1f0355){var _0x8216c3,_0x5051e4;_0x1f0355['remoteUri']=intUtil['stripTrailingSlash'](_0x1f0355[_0xbe14('0x28')]);_0x1f0355[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x1f0355['serverUrl']);if(_0x3593f8&&_0x3593f8[_0xbe14('0x4c')]){logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x4e'));_0x6b6aa8['recordingURL']=util['format'](_0xbe14('0x4f'),_0x1f0355[_0xbe14('0x4a')],_0x6b6aa8[_0xbe14('0x50')],md5(_0x6b6aa8[_0xbe14('0x50')]));}else{_0x6b6aa8[_0xbe14('0x51')]='';}headers['Authorization']=getAuth(_0x1f0355);return getUser(_0x1f0355,_0x5657fe['email'])[_0xbe14('0xd')](function(_0x2a3623){_0x8216c3=_0x2a3623;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x8216c3['id']);return getEndUser(_0x1f0355,_0x6b6aa8['calleridname'],_0x6b6aa8[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x53e8ab){_0x5051e4=_0x53e8ab;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x5051e4['id']);return getTicket(_0x1f0355,_0x8216c3,_0x5051e4,_0x59ae4d,_0x6b6aa8);})[_0xbe14('0xd')](function(_0x36c20c){if(_0x36c20c){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x36c20c['id']);switch(_0x1f0355['type']){case'integrationTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x36c20c['id']});break;case'newTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe['name']),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')](_0xbe14('0x5b'),_0x36c20c['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x4d'),_0xbe14('0x5d'));}}})['catch'](function(_0x5aeea9){console[_0xbe14('0x5c')](_0x5aeea9);logger[_0xbe14('0x5c')](_0xbe14('0x4d'),JSON['stringify'](_0x5aeea9));});};exports['outbound']=function(_0x44fe0d,_0x134878,_0x50d78f,_0x339a86,_0x32496a,_0x50c2a0,_0x28f995){var _0x4a40d2,_0x41ba58;_0x50c2a0[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['remoteUri']);_0x50c2a0[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['serverUrl']);if(_0x28f995&&_0x28f995[_0xbe14('0x5e')]&&_0x28f995[_0xbe14('0x5e')]!==_0xbe14('0x5f')){logger[_0xbe14('0x12')](_0xbe14('0x60'),'Recording\x20is\x20enabled!');_0x134878[_0xbe14('0x51')]=util[_0xbe14('0xb')](_0xbe14('0x4f'),_0x50c2a0[_0xbe14('0x4a')],_0x134878[_0xbe14('0x50')],md5(_0x134878[_0xbe14('0x50')]));}headers[_0xbe14('0x61')]=getAuth(_0x50c2a0);return getUser(_0x50c2a0,_0x339a86['email'])[_0xbe14('0xd')](function(_0x1b47a4){_0x4a40d2=_0x1b47a4;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x4a40d2['id']);return getEndUser(_0x50c2a0,_0x134878[_0xbe14('0x62')],_0x134878[_0xbe14('0x63')]);})[_0xbe14('0xd')](function(_0x32df3c){_0x41ba58=_0x32df3c;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x41ba58['id']);return getTicket(_0x50c2a0,_0x4a40d2,_0x41ba58,_0x50d78f,_0x134878);})[_0xbe14('0xd')](function(_0x4bccfc){if(_0x4bccfc){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x4bccfc['id']);switch(_0x50c2a0[_0xbe14('0x30')]){case _0xbe14('0x64'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x4bccfc['id']});break;case _0xbe14('0x65'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')]('%s/agent/tickets/%s',_0x50c2a0[_0xbe14('0x28')],_0x4bccfc['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x60'),_0xbe14('0x5d'));}}})[_0xbe14('0x66')](function(_0x222944){logger[_0xbe14('0x5c')](_0xbe14('0x60'),JSON[_0xbe14('0x19')](_0x222944));});};exports[_0xbe14('0x67')]=function(_0x5917d5,_0x18be56,_0x442ec4,_0x2d4dd4,_0xfd32a3,_0x3ac6d8){var _0x5a1ea6,_0x42b341;_0x3ac6d8[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x3ac6d8[_0xbe14('0x28')]);_0x3ac6d8[_0xbe14('0x4a')]=intUtil['stripTrailingSlash'](_0x3ac6d8[_0xbe14('0x4a')]);if(_0xfd32a3&&_0xfd32a3[_0xbe14('0x4c')]){logger[_0xbe14('0x12')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',_0xbe14('0x4e'));_0x18be56[_0xbe14('0x51')]=util[_0xbe14('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ac6d8[_0xbe14('0x4a')],_0x18be56[_0xbe14('0x50')],md5(_0x18be56[_0xbe14('0x50')]));}else{_0x18be56[_0xbe14('0x51')]='';}headers[_0xbe14('0x61')]=getAuth(_0x3ac6d8);return getUser(_0x3ac6d8)[_0xbe14('0xd')](function(_0x445302){_0x5a1ea6=_0x445302;logger['info']('The\x20User\x20ID\x20is:',_0x5a1ea6['id']);return getEndUser(_0x3ac6d8,_0x18be56[_0xbe14('0x6a')],_0x18be56[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x2510a0){_0x42b341=_0x2510a0;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x42b341['id']);return getTicket(_0x3ac6d8,_0x5a1ea6,_0x42b341,_0x442ec4,_0x18be56);})[_0xbe14('0xd')](function(_0x43511e){if(_0x43511e){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x43511e['id']);}})[_0xbe14('0x66')](function(_0x57729f){logger[_0xbe14('0x5c')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',JSON[_0xbe14('0x19')](_0x57729f));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index fcefc10..8eb595d 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 _0x58e1=['[OUTBOUND]','recordingURL',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','tenantId','data2','resolve','data5','POST','username','password','clientSecret','then','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','destcalleridnum','calleridnum','contacts','/systemusers(','userId','headers','substring','lastIndexOf','catch','toLowerCase','outbound','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','enduserId','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','type','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Fields','phonecall','callDirection','queue','/contacts(','phonecalls','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','data7','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'];(function(_0x29f76e,_0x54ed99){var _0x356946=function(_0x575dbc){while(--_0x575dbc){_0x29f76e['push'](_0x29f76e['shift']());}};_0x356946(++_0x54ed99);}(_0x58e1,0x154));var _0x158e=function(_0x21bcc5,_0x3c0552){_0x21bcc5=_0x21bcc5-0x0;var _0xc62ace=_0x58e1[_0x21bcc5];return _0xc62ace;};'use strict';var _=require(_0x158e('0x0'));var rp=require(_0x158e('0x1'));var util=require('util');var intUtil=require(_0x158e('0x2'));var md5=require(_0x158e('0x3'));var Redis=require(_0x158e('0x4'));var logger=require(_0x158e('0x5'))(_0x158e('0x6'));var config=require(_0x158e('0x7'));config[_0x158e('0x8')]=_[_0x158e('0x9')](config[_0x158e('0x8')],{'host':_0x158e('0xa'),'port':0x18eb});var io=require(_0x158e('0xb'))(new Redis(config[_0x158e('0x8')]));function getAuthToken(_0x448b67,_0x2a922e,_0x5e6f2f){if(_0x448b67[_0x158e('0xc')]){_0x448b67[_0x158e('0xd')]=_0x448b67[_0x158e('0xe')]['data7'];_0x448b67[_0x158e('0xf')]=_0x448b67[_0x158e('0xe')][_0x158e('0x10')];return Promise[_0x158e('0x11')](_0x448b67[_0x158e('0xe')][_0x158e('0x12')]);}var _0x157664={'method':_0x158e('0x13'),'uri':_0x2a922e,'form':{'client_id':_0x448b67['clientId'],'resource':_0x448b67[_0x158e('0xd')],'username':_0x448b67[_0x158e('0x14')],'password':_0x448b67['password'],'grant_type':_0x158e('0x15'),'client_secret':_0x448b67[_0x158e('0x16')]},'json':!![]};return rp(_0x157664)[_0x158e('0x17')](function(_0x220ead){return _0x220ead[_0x158e('0x18')];})['catch'](function(_0x2c0914){logger[_0x158e('0x19')]('['+[_0x5e6f2f[_0x158e('0x1a')]()]+_0x158e('0x1b'));return _0x2c0914[_0x158e('0x1c')];});}function getUser(_0x2adec7,_0x509000,_0x379e61,_0x515f96,_0x4a3dd9,_0x39cec3){return new Promise(function(_0x21b319,_0x1403c0){return getAuthToken(_0x509000,_0x515f96,_0x39cec3)[_0x158e('0x17')](function(_0x41408d){var _0x1306a2={'method':_0x158e('0x1d'),'uri':_0x4a3dd9+_0x158e('0x1e'),'headers':{'Authorization':_0x158e('0x1f')+_0x41408d,'OData-Version':_0x158e('0x20')},'json':!![]};return rp(_0x1306a2);})[_0x158e('0x17')](function(_0x51ca83){var _0x1da8f6=_0x51ca83[_0x158e('0x21')];var _0x4ef5f5=![];var _0x23506d=null;if(!_[_0x158e('0x22')](_0x379e61)){if(intUtil[_0x158e('0x23')](_0x379e61[_0x158e('0x24')])){_0x2adec7[_0x158e('0x25')]=_0x379e61['email'];for(_0x23506d=0x0;_0x23506d<_0x1da8f6[_0x158e('0x26')];_0x23506d++){if(_0x1da8f6[_0x23506d][_0x158e('0x27')]===_0x379e61[_0x158e('0x24')]&&!_0x1da8f6[_0x23506d][_0x158e('0x28')]){_0x4ef5f5=!![];logger[_0x158e('0x29')]('['+[_0x39cec3[_0x158e('0x1a')]()]+_0x158e('0x2a')+_0x1da8f6[_0x23506d][_0x158e('0x2b')]+'!');_0x2adec7['userId']=_0x1da8f6[_0x23506d][_0x158e('0x2b')];}}}}if(!_0x4ef5f5){logger['info']('['+[_0x39cec3[_0x158e('0x1a')]()]+_0x158e('0x2c'));_0x2adec7[_0x158e('0x25')]=_0x509000[_0x158e('0x14')];for(_0x23506d=0x0;_0x23506d<_0x1da8f6[_0x158e('0x26')];_0x23506d++){if(_0x1da8f6[_0x23506d][_0x158e('0x27')]===_0x509000['username']){_0x2adec7['userId']=_0x1da8f6[_0x23506d][_0x158e('0x2b')];}}}_0x21b319(_0x2adec7);})['catch'](function(_0x1a250c){_0x1403c0(_0x1a250c[_0x158e('0x1c')]);});});}function createEndUser(_0x4b0e9e,_0x159e54,_0x39b870,_0x1aaeec,_0x9f06a6,_0x594836,_0x286137){return new Promise(function(_0x283932,_0x449c21){return getAuthToken(_0x159e54,_0x39b870,_0x594836)[_0x158e('0x17')](function(_0xa7e882){var _0x1b1322=_0x594836['toLowerCase']()==='outbound'?_0x9f06a6[_0x158e('0x2d')]:_0x9f06a6[_0x158e('0x2e')];var _0x1c369e={'method':_0x158e('0x13'),'uri':_0x1aaeec+_0x158e('0x2f'),'body':{'fullname':_0x1b1322,'firstname':_0x1b1322,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x158e('0x30')+_0x4b0e9e[_0x158e('0x31')]+')'},'headers':{'Authorization':_0x158e('0x1f')+_0xa7e882,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x1c369e['body'][_0x286137]=_0x1b1322;return rp(_0x1c369e);})[_0x158e('0x17')](function(_0x4ba2b6){var _0x202b9b=_0x4ba2b6[_0x158e('0x32')]['odata-entityid'];var _0x318d1d=_0x202b9b[_0x158e('0x33')](_0x202b9b[_0x158e('0x34')]('(')+0x1,_0x202b9b['lastIndexOf'](')'));_0x4b0e9e['enduserId']=_0x318d1d;_0x283932(_0x4b0e9e);})[_0x158e('0x35')](function(_0x1d642f){_0x449c21(_0x1d642f[_0x158e('0x1c')]);});});}function getEndUser(_0x20c94c,_0x500038,_0x413dc2,_0x10ace5,_0x181939,_0x3b1e2f,_0x33c97f,_0x54c5d4){var _0x3f1e0b=_0x3b1e2f[_0x158e('0x36')]()===_0x158e('0x37')?_0x181939['destcalleridnum']:_0x181939[_0x158e('0x2e')];return getAuthToken(_0x500038,_0x413dc2,_0x3b1e2f)[_0x158e('0x17')](function(_0x185fec){_0x54c5d4=_0x54c5d4?_0x54c5d4:'telephone1';var _0x3f84d9={'method':_0x158e('0x1d'),'uri':_0x10ace5+_0x158e('0x38')+_0x54c5d4+_0x158e('0x39')+_0x54c5d4+_0x158e('0x3a')+_0x3f1e0b[_0x158e('0x3b')]('+',_0x158e('0x3c'))+'\x27','headers':{'Authorization':_0x158e('0x1f')+_0x185fec,'If-None-Match':null,'OData-Version':_0x158e('0x20')},'json':!![]};return rp(_0x3f84d9);})[_0x158e('0x17')](function(_0x252017){var _0x24a374=![];if(!_0x252017)return _0x24a374;var _0x5cd770=_0x252017['value'];for(var _0x220850=0x0;_0x220850<_0x5cd770[_0x158e('0x26')];_0x220850++){if(_0x5cd770[_0x220850][_0x54c5d4]===_0x3f1e0b){_0x24a374=!![];_0x20c94c[_0x158e('0x3d')]=_0x5cd770[_0x220850][_0x158e('0x3e')];}}return _0x24a374;})[_0x158e('0x17')](function(_0x42437f){if(_0x42437f)return _0x20c94c;if(_0x33c97f===_0x158e('0x3f')){logger[_0x158e('0x29')]('['+[_0x3b1e2f['toUpperCase']()]+_0x158e('0x40'));return _0x20c94c;}return createEndUser(_0x20c94c,_0x500038,_0x413dc2,_0x10ace5,_0x181939,_0x3b1e2f,_0x54c5d4)['then'](function(_0x4500c7){logger[_0x158e('0x29')]('['+[_0x3b1e2f[_0x158e('0x1a')]()]+_0x158e('0x41'),_0x4500c7['enduserId']);return _0x4500c7;});});}function getCustomFields(_0x74af58,_0x39b811,_0x30bb86){var _0x165ca3={};if(_0x74af58['length']>0x0){_[_0x158e('0x42')](_0x74af58,function(_0x2a4fa1){if(_[_0x158e('0x43')](['string','picklist'],_0x2a4fa1[_0x158e('0x44')])&&_0x2a4fa1['nameField']&&!_0x2a4fa1['customField']){var _0x27ea14=_0x2a4fa1['idField'][_0x158e('0x36')]();var _0x388b96=_0x27ea14[_0x158e('0x33')](0x0,_0x27ea14[_0x158e('0x45')]('_'));var _0x3e8d48=_0x27ea14['substring'](_0x27ea14[_0x158e('0x45')]('_')+0x1);if(_0x388b96===_0x30bb86){_0x165ca3[_0x3e8d48]=_0x2a4fa1[_0x158e('0x46')];}}});}return _0x165ca3;}function getTicket(_0x238f05,_0x2e0084,_0x321814,_0x1e3769,_0x2ec250,_0x4e5958,_0x450e08){return new Promise(function(_0x71d35b,_0x4c9fa1){var _0x425f6d;return getAuthToken(_0x2e0084,_0x321814,_0x450e08)[_0x158e('0x17')](function(_0x4d8c71){if(_0x4e5958[_0x158e('0x47')]===_0x158e('0x48')){_0x425f6d={'method':_0x158e('0x13'),'uri':_0x1e3769+_0x158e('0x49'),'body':Object[_0x158e('0x4a')]({},{'title':intUtil[_0x158e('0x4b')](_0x4e5958[_0x158e('0x4c')],_0x2ec250,'\x20'),'description':intUtil[_0x158e('0x4b')](_0x4e5958['Descriptions'],_0x2ec250,'\x0a'),'customerid_contact@odata.bind':_0x238f05[_0x158e('0x3d')]?'/contacts('+_0x238f05['enduserId']+')':undefined,'ownerid@odata.bind':_0x158e('0x30')+_0x238f05[_0x158e('0x31')]+')','caseorigincode':'1'},getCustomFields(_0x4e5958[_0x158e('0x4d')],_0x2ec250,_0x4e5958['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x4d8c71,'OData-Version':_0x158e('0x20')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x4e5958['ticketType']===_0x158e('0x4e')){var _0x8f99fe=_0x238f05[_0x158e('0x3d')]?[{'partyid_systemuser@odata.bind':_0x158e('0x30')+_0x238f05[_0x158e('0x31')]+')','participationtypemask':_0x238f05[_0x158e('0x4f')]===_0x158e('0x50')?0x2:0x1},{'partyid_contact@odata.bind':_0x158e('0x51')+_0x238f05['enduserId']+')','participationtypemask':_0x238f05[_0x158e('0x4f')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x238f05[_0x158e('0x31')]+')','participationtypemask':_0x238f05[_0x158e('0x4f')]==='queue'?0x2:0x1}];_0x425f6d={'method':'POST','uri':_0x1e3769+_0x158e('0x52'),'body':Object[_0x158e('0x4a')]({},{'subject':intUtil[_0x158e('0x4b')](_0x4e5958[_0x158e('0x4c')],_0x2ec250,'\x20'),'phonenumber':String(_0x2ec250[_0x158e('0x2e')]),'description':intUtil[_0x158e('0x4b')](_0x4e5958['Descriptions'],_0x2ec250,'\x0a'),'regardingobjectid_contact@odata.bind':_0x238f05[_0x158e('0x3d')]?'/contacts('+_0x238f05[_0x158e('0x3d')]+')':undefined,'ownerid@odata.bind':_0x158e('0x30')+_0x238f05[_0x158e('0x31')]+')','directioncode':_0x238f05[_0x158e('0x4f')]===_0x158e('0x50')?![]:!![],'phonecall_activity_parties':_0x8f99fe},getCustomFields(_0x4e5958[_0x158e('0x4d')],_0x2ec250,_0x4e5958[_0x158e('0x47')])),'headers':{'Authorization':'Bearer\x20'+_0x4d8c71,'OData-Version':_0x158e('0x20')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x425f6d);})['then'](function(_0x38dea0){var _0x5962c7=_0x38dea0[_0x158e('0x32')]['odata-entityid'];var _0x2b25d7=_0x5962c7[_0x158e('0x33')](_0x5962c7[_0x158e('0x34')]('(')+0x1,_0x5962c7[_0x158e('0x34')](')'));_0x238f05[_0x158e('0x53')]=_0x2b25d7;_0x71d35b(_0x238f05);})[_0x158e('0x35')](function(_0x620289){_0x4c9fa1(_0x620289[_0x158e('0x1c')]);});});}function emit(_0xc1e257,_0x371bf7,_0x203b6d,_0x1e3f20){var _0x32fd01={'uri':util[_0x158e('0x54')](_0x158e('0x55'),_0xc1e257,_0x203b6d,_0x1e3f20)};io['to'](util['format']('user:%s',_0x371bf7))[_0x158e('0x56')]('trigger:browser:url',_0x32fd01);}exports['cs']=function(_0x37b120,_0x1020eb,_0x475c4d,_0x12b701,_0x8c6917,_0x561940,_0x42af4e,_0x170973){var _0x1c5e33={};_0x561940['remoteUri']=_0x561940['modernAuthentication']?intUtil[_0x158e('0x57')](_0x561940[_0x158e('0xe')]['data7']):intUtil[_0x158e('0x57')](_0x561940[_0x158e('0xd')]);_0x561940[_0x158e('0x58')]=intUtil[_0x158e('0x57')](_0x561940['serverUrl']);_0x1c5e33['callDirection']=_0x170973===_0x158e('0x50')||_0x170973===_0x158e('0x59')?'queue':'outbound';var _0x592eeb=_0x561940['modernAuthentication']?util[_0x158e('0x54')](_0x158e('0x5a'),_0x561940[_0x158e('0xe')][_0x158e('0x5b')]):util[_0x158e('0x54')](_0x158e('0x5a'),_0x561940['remoteUri']);var _0x77d130=util[_0x158e('0x54')](_0x158e('0x5c'),_0x561940[_0x158e('0xf')]);var _0x4dd65a=util[_0x158e('0x54')](_0x158e('0x5d'),_0x561940[_0x158e('0x58')],_0x1020eb[_0x158e('0x5e')],md5(_0x1020eb['uniqueid']));if(_0x8c6917&&_0x8c6917[_0x158e('0x5f')]){logger[_0x158e('0x29')](_0x158e('0x60'),_0x158e('0x61'));_0x1020eb['recordingURL']=_0x4dd65a;}else if(_0x42af4e&&_0x42af4e[_0x158e('0x62')]&&_0x42af4e[_0x158e('0x62')]!==_0x158e('0x63')){logger[_0x158e('0x29')](_0x158e('0x64'),'Recording\x20is\x20enabled!');_0x1020eb[_0x158e('0x65')]=_0x4dd65a;}else{_0x1020eb[_0x158e('0x65')]='';}return getUser(_0x1c5e33,_0x561940,_0x12b701,_0x77d130,_0x592eeb,_0x170973)[_0x158e('0x17')](function(_0x5c5e6b){logger[_0x158e('0x29')]('['+_0x170973[_0x158e('0x1a')]()+']\x20The\x20User\x20ID\x20is:',_0x5c5e6b[_0x158e('0x31')]);logger[_0x158e('0x29')]('['+_0x170973[_0x158e('0x1a')]()+_0x158e('0x66'),_0x5c5e6b[_0x158e('0x25')]);return getEndUser(_0x5c5e6b,_0x561940,_0x77d130,_0x592eeb,_0x1020eb,_0x170973,_0x475c4d[_0x158e('0x67')],_0x475c4d['additionalSearchContact']);})[_0x158e('0x17')](function(_0x1ae210){logger['info']('['+_0x170973['toUpperCase']()+_0x158e('0x68'),_0x1ae210[_0x158e('0x3d')]);logger[_0x158e('0x29')]('['+_0x170973[_0x158e('0x1a')]()+_0x158e('0x69'),_0x1020eb['calleridnum']);return getTicket(_0x1ae210,_0x561940,_0x77d130,_0x592eeb,_0x1020eb,_0x475c4d,_0x170973);})[_0x158e('0x17')](function(_0x94aac7){logger[_0x158e('0x29')](util['format']('['+_0x170973[_0x158e('0x1a')]()+_0x158e('0x6a'),_0x475c4d[_0x158e('0x47')],_0x94aac7[_0x158e('0x53')]));logger[_0x158e('0x29')](util['format']('['+_0x170973[_0x158e('0x1a')]()+']\x20Call\x20direction:\x20%s',_0x170973));if(_0x170973!==_0x158e('0x59')&&_0x475c4d['openNewTab']){logger['info']('['+_0x170973['toUpperCase']()+']',_0x158e('0x6b'));emit(_0x561940[_0x158e('0xd')],_0x12b701['name'],_0x475c4d['ticketType'],_0x94aac7[_0x158e('0x53')]);}})[_0x158e('0x35')](function(_0x3226c8){logger['error']('['+_0x170973[_0x158e('0x1a')]()+_0x158e('0x6c'),_0x3226c8['message']);console['error'](_0x158e('0x6d'),_0x3226c8);});}; \ No newline at end of file +var _0x22ec=['Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','POST','clientId','username','password','clientSecret','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','message','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','isNil','validateEmail','email','userEmail','length','internalemailaddress','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','catch','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','body','headers','odata-entityid','substring','lastIndexOf','toLowerCase','contacts?$select=','replace','value','enduserId','contactid','nothing','includes','picklist','type','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','getString','Subjects','Descriptions','/contacts(','phonecall','callDirection','queue','Fields','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','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]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','ticketId',']\x20Call\x20direction:\x20%s','openNewTab'];(function(_0x5297e7,_0xf093ec){var _0x55d357=function(_0x1128f4){while(--_0x1128f4){_0x5297e7['push'](_0x5297e7['shift']());}};_0x55d357(++_0xf093ec);}(_0x22ec,0x73));var _0xc22e=function(_0x421c3f,_0x49b10b){_0x421c3f=_0x421c3f-0x0;var _0x254ff=_0x22ec[_0x421c3f];return _0x254ff;};'use strict';var _=require(_0xc22e('0x0'));var rp=require(_0xc22e('0x1'));var util=require(_0xc22e('0x2'));var intUtil=require('./util');var md5=require(_0xc22e('0x3'));var Redis=require(_0xc22e('0x4'));var logger=require(_0xc22e('0x5'))(_0xc22e('0x6'));var config=require(_0xc22e('0x7'));config[_0xc22e('0x8')]=_[_0xc22e('0x9')](config[_0xc22e('0x8')],{'host':_0xc22e('0xa'),'port':0x18eb});var io=require(_0xc22e('0xb'))(new Redis(config['redis']));function getAuthToken(_0x25274b,_0x1e94ec,_0x3dd32a){if(_0x25274b[_0xc22e('0xc')]){_0x25274b[_0xc22e('0xd')]=_0x25274b[_0xc22e('0xe')][_0xc22e('0xf')];_0x25274b[_0xc22e('0x10')]=_0x25274b[_0xc22e('0xe')][_0xc22e('0x11')];return Promise['resolve'](_0x25274b[_0xc22e('0xe')]['data5']);}var _0x328ec2={'method':_0xc22e('0x12'),'uri':_0x1e94ec,'form':{'client_id':_0x25274b[_0xc22e('0x13')],'resource':_0x25274b[_0xc22e('0xd')],'username':_0x25274b[_0xc22e('0x14')],'password':_0x25274b['password'],'grant_type':_0xc22e('0x15'),'client_secret':_0x25274b[_0xc22e('0x16')]},'json':!![]};return rp(_0x328ec2)['then'](function(_0x37aa3d){return _0x37aa3d[_0xc22e('0x17')];})['catch'](function(_0xe4101d){logger[_0xc22e('0x18')]('['+[_0x3dd32a[_0xc22e('0x19')]()]+_0xc22e('0x1a'));return _0xe4101d[_0xc22e('0x1b')];});}function getUser(_0x259fc5,_0x5d63dc,_0xf6229e,_0x38e9cf,_0x3ea67e,_0x65b3f0){return new Promise(function(_0x2a9550,_0x54978d){return getAuthToken(_0x5d63dc,_0x38e9cf,_0x65b3f0)[_0xc22e('0x1c')](function(_0x4b0f53){var _0x364430={'method':_0xc22e('0x1d'),'uri':_0x3ea67e+_0xc22e('0x1e'),'headers':{'Authorization':_0xc22e('0x1f')+_0x4b0f53,'OData-Version':_0xc22e('0x20')},'json':!![]};return rp(_0x364430);})[_0xc22e('0x1c')](function(_0x142525){var _0x13fda9=_0x142525['value'];var _0x1be6f7=![];var _0x2d768c=null;if(!_[_0xc22e('0x21')](_0xf6229e)){if(intUtil[_0xc22e('0x22')](_0xf6229e[_0xc22e('0x23')])){_0x259fc5[_0xc22e('0x24')]=_0xf6229e[_0xc22e('0x23')];for(_0x2d768c=0x0;_0x2d768c<_0x13fda9[_0xc22e('0x25')];_0x2d768c++){if(_0x13fda9[_0x2d768c][_0xc22e('0x26')]===_0xf6229e['email']&&!_0x13fda9[_0x2d768c]['isdisabled']){_0x1be6f7=!![];logger[_0xc22e('0x27')]('['+[_0x65b3f0[_0xc22e('0x19')]()]+_0xc22e('0x28')+_0x13fda9[_0x2d768c][_0xc22e('0x29')]+'!');_0x259fc5[_0xc22e('0x2a')]=_0x13fda9[_0x2d768c][_0xc22e('0x29')];}}}}if(!_0x1be6f7){logger[_0xc22e('0x27')]('['+[_0x65b3f0[_0xc22e('0x19')]()]+_0xc22e('0x2b'));_0x259fc5['userEmail']=_0x5d63dc[_0xc22e('0x14')];for(_0x2d768c=0x0;_0x2d768c<_0x13fda9[_0xc22e('0x25')];_0x2d768c++){if(_0x13fda9[_0x2d768c][_0xc22e('0x26')]===_0x5d63dc[_0xc22e('0x14')]){_0x259fc5[_0xc22e('0x2a')]=_0x13fda9[_0x2d768c][_0xc22e('0x29')];}}}_0x2a9550(_0x259fc5);})[_0xc22e('0x2c')](function(_0x15b497){_0x54978d(_0x15b497['message']);});});}function createEndUser(_0x3dac55,_0x1a4816,_0x38994b,_0x436a82,_0x21c0f4,_0x45d6af,_0xb94957){return new Promise(function(_0x37af45,_0x19bc2d){return getAuthToken(_0x1a4816,_0x38994b,_0x45d6af)['then'](function(_0x491474){var _0x329d2b=_0x45d6af['toLowerCase']()===_0xc22e('0x2d')?_0x21c0f4[_0xc22e('0x2e')]:_0x21c0f4[_0xc22e('0x2f')];var _0x118b6e={'method':_0xc22e('0x12'),'uri':_0x436a82+_0xc22e('0x30'),'body':{'fullname':_0x329d2b,'firstname':_0x329d2b,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xc22e('0x31')+_0x3dac55[_0xc22e('0x2a')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x491474,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x118b6e[_0xc22e('0x32')][_0xb94957]=_0x329d2b;return rp(_0x118b6e);})[_0xc22e('0x1c')](function(_0x448f1){var _0x545490=_0x448f1[_0xc22e('0x33')][_0xc22e('0x34')];var _0x117f03=_0x545490[_0xc22e('0x35')](_0x545490[_0xc22e('0x36')]('(')+0x1,_0x545490[_0xc22e('0x36')](')'));_0x3dac55['enduserId']=_0x117f03;_0x37af45(_0x3dac55);})[_0xc22e('0x2c')](function(_0x3c6107){_0x19bc2d(_0x3c6107['message']);});});}function getEndUser(_0x4c2f9c,_0x284805,_0x37558b,_0x1ff886,_0x3a3110,_0x3d6bb3,_0x511270,_0x1941a3){var _0x5efcee=_0x3d6bb3[_0xc22e('0x37')]()===_0xc22e('0x2d')?_0x3a3110[_0xc22e('0x2e')]:_0x3a3110[_0xc22e('0x2f')];return getAuthToken(_0x284805,_0x37558b,_0x3d6bb3)[_0xc22e('0x1c')](function(_0x517b78){_0x1941a3=_0x1941a3?_0x1941a3:'telephone1';var _0x1cea4a={'method':_0xc22e('0x1d'),'uri':_0x1ff886+_0xc22e('0x38')+_0x1941a3+'&$filter='+_0x1941a3+'\x20eq\x20\x27'+_0x5efcee[_0xc22e('0x39')]('+','%2b')+'\x27','headers':{'Authorization':'Bearer\x20'+_0x517b78,'If-None-Match':null,'OData-Version':_0xc22e('0x20')},'json':!![]};return rp(_0x1cea4a);})[_0xc22e('0x1c')](function(_0x84eba4){var _0x527d0b=![];if(!_0x84eba4)return _0x527d0b;var _0x1b3088=_0x84eba4[_0xc22e('0x3a')];for(var _0x2a6729=0x0;_0x2a6729<_0x1b3088['length'];_0x2a6729++){if(_0x1b3088[_0x2a6729][_0x1941a3]===_0x5efcee){_0x527d0b=!![];_0x4c2f9c[_0xc22e('0x3b')]=_0x1b3088[_0x2a6729][_0xc22e('0x3c')];}}return _0x527d0b;})['then'](function(_0x5bcba1){if(_0x5bcba1)return _0x4c2f9c;if(_0x511270===_0xc22e('0x3d')){logger[_0xc22e('0x27')]('['+[_0x3d6bb3[_0xc22e('0x19')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x4c2f9c;}return createEndUser(_0x4c2f9c,_0x284805,_0x37558b,_0x1ff886,_0x3a3110,_0x3d6bb3,_0x1941a3)[_0xc22e('0x1c')](function(_0x3d855a){logger[_0xc22e('0x27')]('['+[_0x3d6bb3[_0xc22e('0x19')]()]+']\x20Enduser\x20created!',_0x3d855a['enduserId']);return _0x3d855a;});});}function getCustomFields(_0x2d2d1d,_0x259d19,_0x5e6465){var _0x1adf7a={};if(_0x2d2d1d['length']>0x0){_['forEach'](_0x2d2d1d,function(_0x2bca01){if(_[_0xc22e('0x3e')](['string',_0xc22e('0x3f')],_0x2bca01[_0xc22e('0x40')])&&_0x2bca01[_0xc22e('0x41')]&&!_0x2bca01[_0xc22e('0x42')]){var _0x28fecf=_0x2bca01[_0xc22e('0x43')][_0xc22e('0x37')]();var _0x3e993f=_0x28fecf[_0xc22e('0x35')](0x0,_0x28fecf[_0xc22e('0x44')]('_'));var _0x5164f5=_0x28fecf[_0xc22e('0x35')](_0x28fecf[_0xc22e('0x44')]('_')+0x1);if(_0x3e993f===_0x5e6465){_0x1adf7a[_0x5164f5]=_0x2bca01[_0xc22e('0x45')];}}});}return _0x1adf7a;}function getTicket(_0x25dc6a,_0x4d89f1,_0xebb81d,_0x177b88,_0x4eb0ff,_0x48c580,_0x1457f4){return new Promise(function(_0x479a6f,_0x28f79c){var _0x440c23;return getAuthToken(_0x4d89f1,_0xebb81d,_0x1457f4)[_0xc22e('0x1c')](function(_0x575008){if(_0x48c580[_0xc22e('0x46')]===_0xc22e('0x47')){_0x440c23={'method':_0xc22e('0x12'),'uri':_0x177b88+_0xc22e('0x48'),'body':Object['assign']({},{'title':intUtil[_0xc22e('0x49')](_0x48c580[_0xc22e('0x4a')],_0x4eb0ff,'\x20'),'description':intUtil[_0xc22e('0x49')](_0x48c580[_0xc22e('0x4b')],_0x4eb0ff,'\x0a'),'customerid_contact@odata.bind':_0x25dc6a[_0xc22e('0x3b')]?_0xc22e('0x4c')+_0x25dc6a[_0xc22e('0x3b')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x25dc6a['userId']+')','caseorigincode':'1'},getCustomFields(_0x48c580['Fields'],_0x4eb0ff,_0x48c580[_0xc22e('0x46')])),'headers':{'Authorization':'Bearer\x20'+_0x575008,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x48c580[_0xc22e('0x46')]===_0xc22e('0x4d')){var _0x3d19b7=_0x25dc6a[_0xc22e('0x3b')]?[{'partyid_systemuser@odata.bind':_0xc22e('0x31')+_0x25dc6a[_0xc22e('0x2a')]+')','participationtypemask':_0x25dc6a[_0xc22e('0x4e')]===_0xc22e('0x4f')?0x2:0x1},{'partyid_contact@odata.bind':_0xc22e('0x4c')+_0x25dc6a[_0xc22e('0x3b')]+')','participationtypemask':_0x25dc6a[_0xc22e('0x4e')]===_0xc22e('0x4f')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x25dc6a[_0xc22e('0x2a')]+')','participationtypemask':_0x25dc6a['callDirection']===_0xc22e('0x4f')?0x2:0x1}];_0x440c23={'method':_0xc22e('0x12'),'uri':_0x177b88+'phonecalls','body':Object['assign']({},{'subject':intUtil[_0xc22e('0x49')](_0x48c580[_0xc22e('0x4a')],_0x4eb0ff,'\x20'),'phonenumber':String(_0x4eb0ff[_0xc22e('0x2f')]),'description':intUtil[_0xc22e('0x49')](_0x48c580['Descriptions'],_0x4eb0ff,'\x0a'),'regardingobjectid_contact@odata.bind':_0x25dc6a[_0xc22e('0x3b')]?_0xc22e('0x4c')+_0x25dc6a[_0xc22e('0x3b')]+')':undefined,'ownerid@odata.bind':_0xc22e('0x31')+_0x25dc6a['userId']+')','directioncode':_0x25dc6a[_0xc22e('0x4e')]===_0xc22e('0x4f')?![]:!![],'phonecall_activity_parties':_0x3d19b7},getCustomFields(_0x48c580[_0xc22e('0x50')],_0x4eb0ff,_0x48c580[_0xc22e('0x46')])),'headers':{'Authorization':_0xc22e('0x1f')+_0x575008,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x440c23);})[_0xc22e('0x1c')](function(_0x2cd00f){var _0xc9c0bc=_0x2cd00f['headers'][_0xc22e('0x34')];var _0x405c48=_0xc9c0bc[_0xc22e('0x35')](_0xc9c0bc['lastIndexOf']('(')+0x1,_0xc9c0bc[_0xc22e('0x36')](')'));_0x25dc6a['ticketId']=_0x405c48;_0x479a6f(_0x25dc6a);})[_0xc22e('0x2c')](function(_0x58ffe8){_0x28f79c(_0x58ffe8[_0xc22e('0x1b')]);});});}function emit(_0x43bae3,_0xbaeb4b,_0x422b2a,_0x1a1b2f){var _0x5699ce={'uri':util[_0xc22e('0x51')](_0xc22e('0x52'),_0x43bae3,_0x422b2a,_0x1a1b2f)};io['to'](util['format'](_0xc22e('0x53'),_0xbaeb4b))[_0xc22e('0x54')](_0xc22e('0x55'),_0x5699ce);}exports['cs']=function(_0xa318a3,_0x4d08fd,_0x1793ac,_0x3f3a17,_0x4d67e5,_0x393a21,_0x2c567a,_0x444a7b){var _0x24dc53={};_0x393a21[_0xc22e('0xd')]=_0x393a21[_0xc22e('0xc')]?intUtil[_0xc22e('0x56')](_0x393a21[_0xc22e('0xe')][_0xc22e('0xf')]):intUtil[_0xc22e('0x56')](_0x393a21[_0xc22e('0xd')]);_0x393a21[_0xc22e('0x57')]=intUtil[_0xc22e('0x56')](_0x393a21[_0xc22e('0x57')]);_0x24dc53[_0xc22e('0x4e')]=_0x444a7b==='queue'||_0x444a7b===_0xc22e('0x58')?_0xc22e('0x4f'):'outbound';var _0x3b4f4e=_0x393a21[_0xc22e('0xc')]?util['format']('%s/api/data/v9.0/',_0x393a21[_0xc22e('0xe')]['data7']):util['format'](_0xc22e('0x59'),_0x393a21[_0xc22e('0xd')]);var _0x4e52e5=util[_0xc22e('0x51')](_0xc22e('0x5a'),_0x393a21[_0xc22e('0x10')]);var _0x382c71=util['format'](_0xc22e('0x5b'),_0x393a21['serverUrl'],_0x4d08fd[_0xc22e('0x5c')],md5(_0x4d08fd['uniqueid']));if(_0x4d67e5&&_0x4d67e5[_0xc22e('0x5d')]){logger['info'](_0xc22e('0x5e'),'Recording\x20is\x20enabled!');_0x4d08fd[_0xc22e('0x5f')]=_0x382c71;}else if(_0x2c567a&&_0x2c567a[_0xc22e('0x60')]&&_0x2c567a['recordingFormat']!==_0xc22e('0x61')){logger['info'](_0xc22e('0x62'),_0xc22e('0x63'));_0x4d08fd[_0xc22e('0x5f')]=_0x382c71;}else{_0x4d08fd['recordingURL']='';}return getUser(_0x24dc53,_0x393a21,_0x3f3a17,_0x4e52e5,_0x3b4f4e,_0x444a7b)[_0xc22e('0x1c')](function(_0x5f1254){logger[_0xc22e('0x27')]('['+_0x444a7b[_0xc22e('0x19')]()+_0xc22e('0x64'),_0x5f1254[_0xc22e('0x2a')]);logger['info']('['+_0x444a7b[_0xc22e('0x19')]()+_0xc22e('0x65'),_0x5f1254[_0xc22e('0x24')]);return getEndUser(_0x5f1254,_0x393a21,_0x4e52e5,_0x3b4f4e,_0x4d08fd,_0x444a7b,_0x1793ac[_0xc22e('0x66')],_0x1793ac[_0xc22e('0x67')]);})[_0xc22e('0x1c')](function(_0x2b02c3){logger[_0xc22e('0x27')]('['+_0x444a7b[_0xc22e('0x19')]()+_0xc22e('0x68'),_0x2b02c3[_0xc22e('0x3b')]);logger[_0xc22e('0x27')]('['+_0x444a7b[_0xc22e('0x19')]()+_0xc22e('0x69'),_0x4d08fd[_0xc22e('0x2f')]);return getTicket(_0x2b02c3,_0x393a21,_0x4e52e5,_0x3b4f4e,_0x4d08fd,_0x1793ac,_0x444a7b);})[_0xc22e('0x1c')](function(_0x19170e){logger[_0xc22e('0x27')](util[_0xc22e('0x51')]('['+_0x444a7b[_0xc22e('0x19')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x1793ac[_0xc22e('0x46')],_0x19170e[_0xc22e('0x6a')]));logger['info'](util[_0xc22e('0x51')]('['+_0x444a7b[_0xc22e('0x19')]()+_0xc22e('0x6b'),_0x444a7b));if(_0x444a7b!=='unmanaged'&&_0x1793ac[_0xc22e('0x6c')]){logger[_0xc22e('0x27')]('['+_0x444a7b['toUpperCase']()+']',_0xc22e('0x6d'));emit(_0x393a21['remoteUri'],_0x3f3a17[_0xc22e('0x6e')],_0x1793ac['ticketType'],_0x19170e[_0xc22e('0x6a')]);}})[_0xc22e('0x2c')](function(_0xae9f3e){logger[_0xc22e('0x18')]('['+_0x444a7b[_0xc22e('0x19')]()+_0xc22e('0x6f'),_0xae9f3e[_0xc22e('0x1b')]);console['error']('Error\x20running\x20Dynamics365\x20integration',_0xae9f3e);});}; \ 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 43dae11..f6037b7 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 _0xc579=['value','remoteUri','POST','then','Ticket\x20created!','Agent\x20found!','find','contact','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','apiKey','toString','base64','debug','[HTTP]','GET','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','stringify','outbound','recordingFormat','none','Recording\x20is\x20enabled!','recordingURL','Authorization','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','error','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','freshdesk','redis','defaults','localhost','application/json','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy'];(function(_0x210d73,_0x47d720){var _0x10a8db=function(_0x18ce61){while(--_0x18ce61){_0x210d73['push'](_0x210d73['shift']());}};_0x10a8db(++_0x47d720);}(_0xc579,0x153));var _0x9c57=function(_0xcb65ee,_0x235e49){_0xcb65ee=_0xcb65ee-0x0;var _0x2bf372=_0xc579[_0xcb65ee];return _0x2bf372;};'use strict';var _=require(_0x9c57('0x0'));var rp=require(_0x9c57('0x1'));var md5=require(_0x9c57('0x2'));var util=require(_0x9c57('0x3'));var Redis=require(_0x9c57('0x4'));var intUtil=require(_0x9c57('0x5'));var config=require('../../../../config/environment');var logger=require(_0x9c57('0x6'))(_0x9c57('0x7'));config[_0x9c57('0x8')]=_[_0x9c57('0x9')](config['redis'],{'host':_0x9c57('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9c57('0x8')]));var headers={'Content-Type':'application/json','Accept':_0x9c57('0xb')};function emit(_0xeb8492,_0x27fafc,_0x1a89f8){io['to'](_0xeb8492)['emit'](_0x27fafc,_0x1a89f8);}function getTicket(_0x285dee,_0x4313f9,_0x24f2b5,_0x2615d3,_0x39bb70){logger[_0x9c57('0xc')](_0x9c57('0xd'));var _0x4c8373=_[_0x9c57('0xe')]({'responder_id':_0x4313f9['id'],'requester_id':_0x24f2b5['id'],'name':util[_0x9c57('0xf')](_0x9c57('0x10'),_0x39bb70[_0x9c57('0x11')]),'phone':_0x39bb70[_0x9c57('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x9c57('0x13')](_0x2615d3[_0x9c57('0x14')],_0x39bb70,'\x20'),'description':intUtil[_0x9c57('0x13')](_0x2615d3[_0x9c57('0x15')],_0x39bb70,_0x9c57('0x16')),'tags':getTags(_0x2615d3[_0x9c57('0x17')],_0x9c57('0x18'))},getCustomFields(_0x2615d3[_0x9c57('0x19')],_0x39bb70));_0x4c8373[_0x9c57('0x1a')]=_[_0x9c57('0x1b')](_[_0x9c57('0x1c')](_0x4c8373[_0x9c57('0x1a')],'id'),_0x9c57('0x1d'));return request({'uri':util[_0x9c57('0xf')]('%s/api/v2/tickets',_0x285dee[_0x9c57('0x1e')]),'method':_0x9c57('0x1f'),'body':_0x4c8373})[_0x9c57('0x20')](function(_0x4deab1){logger[_0x9c57('0xc')](_0x9c57('0x21'));return _0x4deab1;});}function getUser(_0x454e16,_0x59a838){if(intUtil['validateEmail'](_0x59a838)){return request({'uri':util['format']('%s/api/v2/agents',_0x454e16[_0x9c57('0x1e')]),'qs':{'email':_0x59a838}})[_0x9c57('0x20')](function(_0x3d145d){if(_0x3d145d['length']){logger[_0x9c57('0xc')](_0x9c57('0x22'));return _[_0x9c57('0x23')](_0x3d145d,function(_0x5f354f){return _0x5f354f[_0x9c57('0x24')][_0x9c57('0x25')]===_0x59a838;});}else{logger[_0x9c57('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x9c57('0xf')](_0x9c57('0x26'),_0x454e16[_0x9c57('0x1e')])})[_0x9c57('0x20')](function(_0x11f717){logger[_0x9c57('0xc')](_0x9c57('0x27'));return _0x11f717;});}});}else{logger[_0x9c57('0xc')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x9c57('0xf')](_0x9c57('0x26'),_0x454e16[_0x9c57('0x1e')])})[_0x9c57('0x20')](function(_0x187928){logger[_0x9c57('0xc')]('Admin\x20account\x20selected.');return _0x187928;});}}function getEndUser(_0x2b8153,_0x276aff,_0x4e5dca){logger[_0x9c57('0xc')]('Searching\x20enduser\x20with\x20phone',_0x4e5dca);return request({'uri':util[_0x9c57('0xf')]('%s/api/v2/contacts',_0x2b8153[_0x9c57('0x1e')]),'qs':{'phone':_0x4e5dca}})[_0x9c57('0x20')](function(_0x3081ba){if(_0x3081ba[_0x9c57('0x28')]){logger['info'](_0x9c57('0x29'));return _[_0x9c57('0x23')](_0x3081ba,{'phone':_0x4e5dca});}else{logger[_0x9c57('0xc')](_0x9c57('0x2a'));return request({'uri':util[_0x9c57('0xf')](_0x9c57('0x2b'),_0x2b8153['remoteUri']),'method':'POST','body':{'name':_0x276aff,'phone':_0x4e5dca}})[_0x9c57('0x20')](function(_0x47445d){logger[_0x9c57('0xc')](_0x9c57('0x2c'));return _0x47445d;});}});}function getAuth(_0x2350ca){return util[_0x9c57('0xf')]('Basic\x20%s',new Buffer(_0x2350ca[_0x9c57('0x2d')]+':X')[_0x9c57('0x2e')](_0x9c57('0x2f')));}function request(_0x469e8d){logger[_0x9c57('0x30')](_0x9c57('0x31'),JSON['stringify'](_0x469e8d));return rp(_['defaults'](_0x469e8d,{'method':_0x9c57('0x32'),'headers':headers,'json':!![]}));}function getTags(_0xee3e99,_0x256095){var _0x2ff5c2=[];if(_0xee3e99&&_0xee3e99[_0x9c57('0x28')]>0x0){_0x2ff5c2=_['map'](_0xee3e99,_0x256095);}return _0x2ff5c2;}function getCustomFields(_0x327ebe,_0x4d54a3){var _0x4f5307=[];var _0x361d1f={'custom_fields':[]};if(_0x327ebe[_0x9c57('0x28')]>0x0){_['forEach'](_0x327ebe,function(_0x161c99){if(_[_0x9c57('0x33')]([_0x9c57('0x34'),_0x9c57('0x35')],_0x161c99[_0x9c57('0x36')])&&_0x161c99[_0x9c57('0x37')]&&!_0x161c99[_0x9c57('0x38')]){_0x361d1f[_0x161c99[_0x9c57('0x37')][_0x9c57('0x39')]()]=_0x161c99[_0x9c57('0x3a')][_0x9c57('0x2e')]();}else if(_[_0x9c57('0x33')]([_0x9c57('0x34'),_0x9c57('0x35')],_0x161c99['type'])&&_0x161c99[_0x9c57('0x3b')]&&_0x161c99[_0x9c57('0x38')]){_0x361d1f[_0x9c57('0x1a')]['push']({'id':_0x161c99['idField'],'value':_0x161c99[_0x9c57('0x3a')][_0x9c57('0x2e')]()});}else if(_0x161c99[_0x9c57('0x36')]===_0x9c57('0x3c')&&_0x161c99[_0x9c57('0x3d')]&&_0x161c99[_0x9c57('0x3b')]&&_0x161c99['customField']){_0x4d54a3[_0x161c99[_0x9c57('0x3d')]]&&_0x361d1f[_0x9c57('0x1a')]['push']({'id':_0x161c99[_0x9c57('0x3b')],'value':_0x4d54a3[_0x161c99[_0x9c57('0x3d')]][_0x9c57('0x2e')]()});}else if(_0x161c99[_0x9c57('0x36')]===_0x9c57('0x3e')&&_0x161c99['Variable']&&_0x161c99[_0x9c57('0x3f')][_0x9c57('0x18')]&&_0x161c99[_0x9c57('0x3b')]&&_0x161c99[_0x9c57('0x38')]){_0x4d54a3[_0x161c99[_0x9c57('0x3f')][_0x9c57('0x18')]['toLowerCase']()]&&_0x361d1f['custom_fields']['push']({'id':_0x161c99[_0x9c57('0x3b')],'value':_0x4d54a3[_0x161c99['Variable'][_0x9c57('0x18')][_0x9c57('0x39')]()][_0x9c57('0x2e')]()});}});}return _0x361d1f;}exports[_0x9c57('0x40')]=function(_0x42bdd2,_0x407e9b,_0x543f27,_0x366dd7,_0x262b3e,_0x2ed574){var _0x3e3a9f,_0x37d408;_0x2ed574['remoteUri']=intUtil[_0x9c57('0x41')](_0x2ed574[_0x9c57('0x1e')]);_0x2ed574[_0x9c57('0x42')]=intUtil[_0x9c57('0x41')](_0x2ed574[_0x9c57('0x42')]);if(_0x262b3e&&_0x262b3e[_0x9c57('0x43')]){logger[_0x9c57('0xc')](_0x9c57('0x44'),'Recording\x20is\x20enabled!');_0x407e9b['recordingURL']=util[_0x9c57('0xf')](_0x9c57('0x45'),_0x2ed574[_0x9c57('0x42')],_0x407e9b[_0x9c57('0x46')],md5(_0x407e9b[_0x9c57('0x46')]));}else{_0x407e9b['recordingURL']='';}headers['Authorization']=getAuth(_0x2ed574);return getUser(_0x2ed574,_0x366dd7[_0x9c57('0x25')])[_0x9c57('0x20')](function(_0x4e2bb7){_0x3e3a9f=_0x4e2bb7;logger[_0x9c57('0xc')]('The\x20User\x20ID\x20is:',_0x3e3a9f['id']);return getEndUser(_0x2ed574,_0x407e9b[_0x9c57('0x11')],_0x407e9b[_0x9c57('0x12')]);})[_0x9c57('0x20')](function(_0x58b0af){_0x37d408=_0x58b0af;logger['info'](_0x9c57('0x47'),_0x37d408['id']);return getTicket(_0x2ed574,_0x3e3a9f,_0x37d408,_0x543f27,_0x407e9b);})[_0x9c57('0x20')](function(_0x200cd0){if(_0x200cd0&&_0x200cd0['id']){logger[_0x9c57('0xc')](_0x9c57('0x21'));logger[_0x9c57('0xc')](_0x9c57('0x48'),_0x200cd0['id']);logger[_0x9c57('0xc')](_0x9c57('0x44'),_0x9c57('0x49'));emit(util[_0x9c57('0xf')](_0x9c57('0x4a'),_0x366dd7[_0x9c57('0x18')]),_0x9c57('0x4b'),{'uri':util[_0x9c57('0xf')](_0x9c57('0x4c'),_0x2ed574['remoteUri'],_0x200cd0['id'])});}})[_0x9c57('0x4d')](function(_0x999a0d){logger['error'](_0x9c57('0x44'),JSON[_0x9c57('0x4e')](_0x999a0d));});};exports[_0x9c57('0x4f')]=function(_0x32b54e,_0x3814bf,_0xcc036d,_0x3f87b7,_0x592eee,_0x54cf7e,_0x2d4d5f){var _0x596398,_0x57a644;_0x54cf7e['remoteUri']=intUtil[_0x9c57('0x41')](_0x54cf7e[_0x9c57('0x1e')]);_0x54cf7e[_0x9c57('0x42')]=intUtil[_0x9c57('0x41')](_0x54cf7e[_0x9c57('0x42')]);if(_0x2d4d5f&&_0x2d4d5f[_0x9c57('0x50')]&&_0x2d4d5f[_0x9c57('0x50')]!==_0x9c57('0x51')){logger['info']('[OUTBOUND]',_0x9c57('0x52'));_0x3814bf[_0x9c57('0x53')]=util[_0x9c57('0xf')](_0x9c57('0x45'),_0x54cf7e[_0x9c57('0x42')],_0x3814bf[_0x9c57('0x46')],md5(_0x3814bf['uniqueid']));}headers[_0x9c57('0x54')]=getAuth(_0x54cf7e);return getUser(_0x54cf7e,_0x3f87b7['email'])[_0x9c57('0x20')](function(_0x2e359e){_0x596398=_0x2e359e;logger[_0x9c57('0xc')](_0x9c57('0x55'),_0x596398['id']);return getEndUser(_0x54cf7e,_0x3814bf[_0x9c57('0x56')],_0x3814bf[_0x9c57('0x57')]);})[_0x9c57('0x20')](function(_0x26b3ca){_0x57a644=_0x26b3ca;logger[_0x9c57('0xc')](_0x9c57('0x47'),_0x57a644['id']);return getTicket(_0x54cf7e,_0x596398,_0x57a644,_0xcc036d,_0x3814bf);})[_0x9c57('0x20')](function(_0x44a32d){if(_0x44a32d&&_0x44a32d['id']){logger[_0x9c57('0xc')](_0x9c57('0x21'));logger['info'](_0x9c57('0x48'),_0x44a32d['id']);logger['info']('[OUTBOUND]',_0x9c57('0x49'));emit(util[_0x9c57('0xf')](_0x9c57('0x4a'),_0x3f87b7[_0x9c57('0x18')]),_0x9c57('0x4b'),{'uri':util[_0x9c57('0xf')]('%s/helpdesk/tickets/%d',_0x54cf7e['remoteUri'],_0x44a32d['id'])});}})[_0x9c57('0x4d')](function(_0x261c78){logger[_0x9c57('0x58')]('[OUTBOUND]',JSON['stringify'](_0x261c78));});};exports[_0x9c57('0x59')]=function(_0x31dffa,_0x2d4ed5,_0x2582c1,_0x184c16,_0x99d555,_0x213758){var _0x2a4376,_0xbde06e;_0x213758[_0x9c57('0x1e')]=intUtil[_0x9c57('0x41')](_0x213758[_0x9c57('0x1e')]);_0x213758['serverUrl']=intUtil[_0x9c57('0x41')](_0x213758[_0x9c57('0x42')]);if(_0x99d555&&_0x99d555[_0x9c57('0x43')]){logger['info']('['+_0x2d4ed5[_0x9c57('0x5a')][_0x9c57('0x5b')]()+']',_0x9c57('0x52'));_0x2d4ed5['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x213758[_0x9c57('0x42')],_0x2d4ed5['uniqueid'],md5(_0x2d4ed5['uniqueid']));}else{_0x2d4ed5[_0x9c57('0x53')]='';}headers[_0x9c57('0x54')]=getAuth(_0x213758);return getUser(_0x213758,'')[_0x9c57('0x20')](function(_0x444b1a){_0x2a4376=_0x444b1a;logger['info'](_0x9c57('0x55'),_0x2a4376['id']);return getEndUser(_0x213758,_0x2d4ed5['calleridname'],_0x2d4ed5[_0x9c57('0x12')]);})[_0x9c57('0x20')](function(_0x26fc69){_0xbde06e=_0x26fc69;logger[_0x9c57('0xc')](_0x9c57('0x47'),_0xbde06e['id']);return getTicket(_0x213758,_0x2a4376,_0xbde06e,_0x2582c1,_0x2d4ed5);})[_0x9c57('0x20')](function(_0x13aeeb){if(_0x13aeeb){logger[_0x9c57('0xc')]('Ticket\x20created!');logger[_0x9c57('0xc')](_0x9c57('0x48'),_0x13aeeb['id']);}})['catch'](function(_0x163139){logger[_0x9c57('0x58')]('['+_0x2d4ed5[_0x9c57('0x5a')]['toUpperCase']()+']',JSON[_0x9c57('0x4e')](_0x163139));});}; \ No newline at end of file +var _0x3f95=['stringify','GET','map','forEach','includes','type','nameField','toLowerCase','content','string','picklist','customField','push','idField','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridnum','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/helpdesk/tickets/%d','catch','outbound','recordingFormat','destcalleridnum','The\x20Enduser\x20ID\x20is:','error','[OUTBOUND]','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','defaults','redis','localhost','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','Descriptions','
','name','Fields','custom_fields','mapValues','keyBy','value','remoteUri','POST','info','Ticket\x20created!','validateEmail','then','length','find','contact','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug'];(function(_0x21fc16,_0x511474){var _0x449e11=function(_0x2daf0e){while(--_0x2daf0e){_0x21fc16['push'](_0x21fc16['shift']());}};_0x449e11(++_0x511474);}(_0x3f95,0x88));var _0x53f9=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x3f95[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x53f9('0x0'));var rp=require(_0x53f9('0x1'));var md5=require(_0x53f9('0x2'));var util=require(_0x53f9('0x3'));var Redis=require(_0x53f9('0x4'));var intUtil=require(_0x53f9('0x5'));var config=require(_0x53f9('0x6'));var logger=require(_0x53f9('0x7'))(_0x53f9('0x8'));config['redis']=_[_0x53f9('0x9')](config[_0x53f9('0xa')],{'host':_0x53f9('0xb'),'port':0x18eb});var io=require(_0x53f9('0xc'))(new Redis(config[_0x53f9('0xa')]));var headers={'Content-Type':'application/json','Accept':_0x53f9('0xd')};function emit(_0x226c05,_0x393dd1,_0x1416ad){io['to'](_0x226c05)[_0x53f9('0xe')](_0x393dd1,_0x1416ad);}function getTicket(_0x2b02ab,_0x24267b,_0x183896,_0x1e81a0,_0x37323f){logger['info'](_0x53f9('0xf'));var _0x22518d=_['merge']({'responder_id':_0x24267b['id'],'requester_id':_0x183896['id'],'name':util[_0x53f9('0x10')](_0x53f9('0x11'),_0x37323f[_0x53f9('0x12')]),'phone':_0x37323f['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x1e81a0['Subjects'],_0x37323f,'\x20'),'description':intUtil['getString'](_0x1e81a0[_0x53f9('0x13')],_0x37323f,_0x53f9('0x14')),'tags':getTags(_0x1e81a0['Tags'],_0x53f9('0x15'))},getCustomFields(_0x1e81a0[_0x53f9('0x16')],_0x37323f));_0x22518d[_0x53f9('0x17')]=_[_0x53f9('0x18')](_[_0x53f9('0x19')](_0x22518d['custom_fields'],'id'),_0x53f9('0x1a'));return request({'uri':util[_0x53f9('0x10')]('%s/api/v2/tickets',_0x2b02ab[_0x53f9('0x1b')]),'method':_0x53f9('0x1c'),'body':_0x22518d})['then'](function(_0x5caef3){logger[_0x53f9('0x1d')](_0x53f9('0x1e'));return _0x5caef3;});}function getUser(_0x5a04f2,_0x4d7f05){if(intUtil[_0x53f9('0x1f')](_0x4d7f05)){return request({'uri':util[_0x53f9('0x10')]('%s/api/v2/agents',_0x5a04f2[_0x53f9('0x1b')]),'qs':{'email':_0x4d7f05}})[_0x53f9('0x20')](function(_0x5bf1e6){if(_0x5bf1e6[_0x53f9('0x21')]){logger[_0x53f9('0x1d')]('Agent\x20found!');return _[_0x53f9('0x22')](_0x5bf1e6,function(_0x337312){return _0x337312[_0x53f9('0x23')][_0x53f9('0x24')]===_0x4d7f05;});}else{logger[_0x53f9('0x1d')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x53f9('0x25'),_0x5a04f2['remoteUri'])})[_0x53f9('0x20')](function(_0x142c62){logger['info'](_0x53f9('0x26'));return _0x142c62;});}});}else{logger[_0x53f9('0x1d')](_0x53f9('0x27'));return request({'uri':util['format'](_0x53f9('0x25'),_0x5a04f2[_0x53f9('0x1b')])})['then'](function(_0x356e19){logger[_0x53f9('0x1d')](_0x53f9('0x26'));return _0x356e19;});}}function getEndUser(_0x4a50e1,_0x594bc3,_0x17e640){logger[_0x53f9('0x1d')](_0x53f9('0x28'),_0x17e640);return request({'uri':util['format'](_0x53f9('0x29'),_0x4a50e1[_0x53f9('0x1b')]),'qs':{'phone':_0x17e640}})[_0x53f9('0x20')](function(_0x141efb){if(_0x141efb[_0x53f9('0x21')]){logger[_0x53f9('0x1d')](_0x53f9('0x2a'));return _[_0x53f9('0x22')](_0x141efb,{'phone':_0x17e640});}else{logger[_0x53f9('0x1d')](_0x53f9('0x2b'));return request({'uri':util['format'](_0x53f9('0x29'),_0x4a50e1['remoteUri']),'method':_0x53f9('0x1c'),'body':{'name':_0x594bc3,'phone':_0x17e640}})[_0x53f9('0x20')](function(_0x18572b){logger[_0x53f9('0x1d')](_0x53f9('0x2c'));return _0x18572b;});}});}function getAuth(_0xd4fd4a){return util[_0x53f9('0x10')](_0x53f9('0x2d'),new Buffer(_0xd4fd4a[_0x53f9('0x2e')]+':X')[_0x53f9('0x2f')](_0x53f9('0x30')));}function request(_0x3027fa){logger[_0x53f9('0x31')]('[HTTP]',JSON[_0x53f9('0x32')](_0x3027fa));return rp(_[_0x53f9('0x9')](_0x3027fa,{'method':_0x53f9('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x38eb56,_0x332274){var _0x418801=[];if(_0x38eb56&&_0x38eb56[_0x53f9('0x21')]>0x0){_0x418801=_[_0x53f9('0x34')](_0x38eb56,_0x332274);}return _0x418801;}function getCustomFields(_0x29a037,_0x3fc92b){var _0x1c30a2=[];var _0x3d4316={'custom_fields':[]};if(_0x29a037[_0x53f9('0x21')]>0x0){_[_0x53f9('0x35')](_0x29a037,function(_0x91229a){if(_[_0x53f9('0x36')](['string','picklist'],_0x91229a[_0x53f9('0x37')])&&_0x91229a[_0x53f9('0x38')]&&!_0x91229a['customField']){_0x3d4316[_0x91229a['nameField'][_0x53f9('0x39')]()]=_0x91229a[_0x53f9('0x3a')][_0x53f9('0x2f')]();}else if(_[_0x53f9('0x36')]([_0x53f9('0x3b'),_0x53f9('0x3c')],_0x91229a[_0x53f9('0x37')])&&_0x91229a['idField']&&_0x91229a[_0x53f9('0x3d')]){_0x3d4316[_0x53f9('0x17')][_0x53f9('0x3e')]({'id':_0x91229a[_0x53f9('0x3f')],'value':_0x91229a[_0x53f9('0x3a')][_0x53f9('0x2f')]()});}else if(_0x91229a[_0x53f9('0x37')]==='variable'&&_0x91229a[_0x53f9('0x40')]&&_0x91229a['idField']&&_0x91229a[_0x53f9('0x3d')]){_0x3fc92b[_0x91229a[_0x53f9('0x40')]]&&_0x3d4316[_0x53f9('0x17')]['push']({'id':_0x91229a[_0x53f9('0x3f')],'value':_0x3fc92b[_0x91229a[_0x53f9('0x40')]][_0x53f9('0x2f')]()});}else if(_0x91229a[_0x53f9('0x37')]===_0x53f9('0x41')&&_0x91229a[_0x53f9('0x42')]&&_0x91229a[_0x53f9('0x42')]['name']&&_0x91229a[_0x53f9('0x3f')]&&_0x91229a[_0x53f9('0x3d')]){_0x3fc92b[_0x91229a[_0x53f9('0x42')][_0x53f9('0x15')]['toLowerCase']()]&&_0x3d4316['custom_fields'][_0x53f9('0x3e')]({'id':_0x91229a[_0x53f9('0x3f')],'value':_0x3fc92b[_0x91229a[_0x53f9('0x42')]['name']['toLowerCase']()][_0x53f9('0x2f')]()});}});}return _0x3d4316;}exports[_0x53f9('0x43')]=function(_0x4c9f26,_0x127813,_0xb719c,_0x4f52c4,_0x2d9533,_0x3a4562){var _0x4a6003,_0x367486;_0x3a4562[_0x53f9('0x1b')]=intUtil[_0x53f9('0x44')](_0x3a4562[_0x53f9('0x1b')]);_0x3a4562[_0x53f9('0x45')]=intUtil[_0x53f9('0x44')](_0x3a4562[_0x53f9('0x45')]);if(_0x2d9533&&_0x2d9533[_0x53f9('0x46')]){logger['info']('[QUEUE]',_0x53f9('0x47'));_0x127813[_0x53f9('0x48')]=util[_0x53f9('0x10')](_0x53f9('0x49'),_0x3a4562[_0x53f9('0x45')],_0x127813[_0x53f9('0x4a')],md5(_0x127813[_0x53f9('0x4a')]));}else{_0x127813[_0x53f9('0x48')]='';}headers[_0x53f9('0x4b')]=getAuth(_0x3a4562);return getUser(_0x3a4562,_0x4f52c4[_0x53f9('0x24')])['then'](function(_0x1eb94d){_0x4a6003=_0x1eb94d;logger[_0x53f9('0x1d')](_0x53f9('0x4c'),_0x4a6003['id']);return getEndUser(_0x3a4562,_0x127813[_0x53f9('0x12')],_0x127813[_0x53f9('0x4d')]);})[_0x53f9('0x20')](function(_0xeed113){_0x367486=_0xeed113;logger[_0x53f9('0x1d')]('The\x20Enduser\x20ID\x20is:',_0x367486['id']);return getTicket(_0x3a4562,_0x4a6003,_0x367486,_0xb719c,_0x127813);})[_0x53f9('0x20')](function(_0x2216b9){if(_0x2216b9&&_0x2216b9['id']){logger[_0x53f9('0x1d')](_0x53f9('0x1e'));logger[_0x53f9('0x1d')](_0x53f9('0x4e'),_0x2216b9['id']);logger[_0x53f9('0x1d')](_0x53f9('0x4f'),_0x53f9('0x50'));emit(util[_0x53f9('0x10')](_0x53f9('0x51'),_0x4f52c4['name']),'trigger:browser:url',{'uri':util[_0x53f9('0x10')](_0x53f9('0x52'),_0x3a4562[_0x53f9('0x1b')],_0x2216b9['id'])});}})[_0x53f9('0x53')](function(_0x3b68bc){logger['error'](_0x53f9('0x4f'),JSON[_0x53f9('0x32')](_0x3b68bc));});};exports[_0x53f9('0x54')]=function(_0x298daf,_0x1c4ef7,_0x3f0c2d,_0x575560,_0x2e3fc5,_0xe29982,_0x2186f2){var _0x210b6a,_0x44305c;_0xe29982[_0x53f9('0x1b')]=intUtil['stripTrailingSlash'](_0xe29982[_0x53f9('0x1b')]);_0xe29982[_0x53f9('0x45')]=intUtil[_0x53f9('0x44')](_0xe29982[_0x53f9('0x45')]);if(_0x2186f2&&_0x2186f2[_0x53f9('0x55')]&&_0x2186f2[_0x53f9('0x55')]!=='none'){logger[_0x53f9('0x1d')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1c4ef7[_0x53f9('0x48')]=util[_0x53f9('0x10')](_0x53f9('0x49'),_0xe29982['serverUrl'],_0x1c4ef7['uniqueid'],md5(_0x1c4ef7['uniqueid']));}headers['Authorization']=getAuth(_0xe29982);return getUser(_0xe29982,_0x575560[_0x53f9('0x24')])['then'](function(_0x57e04f){_0x210b6a=_0x57e04f;logger[_0x53f9('0x1d')]('The\x20User\x20ID\x20is:',_0x210b6a['id']);return getEndUser(_0xe29982,_0x1c4ef7['destcalleridname'],_0x1c4ef7[_0x53f9('0x56')]);})[_0x53f9('0x20')](function(_0x39b4d2){_0x44305c=_0x39b4d2;logger['info'](_0x53f9('0x57'),_0x44305c['id']);return getTicket(_0xe29982,_0x210b6a,_0x44305c,_0x3f0c2d,_0x1c4ef7);})[_0x53f9('0x20')](function(_0x242b80){if(_0x242b80&&_0x242b80['id']){logger[_0x53f9('0x1d')](_0x53f9('0x1e'));logger['info'](_0x53f9('0x4e'),_0x242b80['id']);logger[_0x53f9('0x1d')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x53f9('0x10')]('user:%s',_0x575560[_0x53f9('0x15')]),'trigger:browser:url',{'uri':util[_0x53f9('0x10')](_0x53f9('0x52'),_0xe29982['remoteUri'],_0x242b80['id'])});}})[_0x53f9('0x53')](function(_0x1f927f){logger[_0x53f9('0x58')](_0x53f9('0x59'),JSON[_0x53f9('0x32')](_0x1f927f));});};exports[_0x53f9('0x5a')]=function(_0xa7a41c,_0x112780,_0x279864,_0x28ad6a,_0x12ef41,_0x59c20){var _0x435136,_0x5dbc45;_0x59c20[_0x53f9('0x1b')]=intUtil[_0x53f9('0x44')](_0x59c20[_0x53f9('0x1b')]);_0x59c20[_0x53f9('0x45')]=intUtil[_0x53f9('0x44')](_0x59c20[_0x53f9('0x45')]);if(_0x12ef41&&_0x12ef41[_0x53f9('0x46')]){logger[_0x53f9('0x1d')]('['+_0x112780[_0x53f9('0x5b')][_0x53f9('0x5c')]()+']','Recording\x20is\x20enabled!');_0x112780[_0x53f9('0x48')]=util[_0x53f9('0x10')](_0x53f9('0x49'),_0x59c20[_0x53f9('0x45')],_0x112780[_0x53f9('0x4a')],md5(_0x112780[_0x53f9('0x4a')]));}else{_0x112780['recordingURL']='';}headers[_0x53f9('0x4b')]=getAuth(_0x59c20);return getUser(_0x59c20,'')[_0x53f9('0x20')](function(_0x20ef47){_0x435136=_0x20ef47;logger[_0x53f9('0x1d')]('The\x20User\x20ID\x20is:',_0x435136['id']);return getEndUser(_0x59c20,_0x112780[_0x53f9('0x12')],_0x112780['calleridnum']);})[_0x53f9('0x20')](function(_0x19e51e){_0x5dbc45=_0x19e51e;logger[_0x53f9('0x1d')](_0x53f9('0x57'),_0x5dbc45['id']);return getTicket(_0x59c20,_0x435136,_0x5dbc45,_0x279864,_0x112780);})[_0x53f9('0x20')](function(_0x1792dd){if(_0x1792dd){logger[_0x53f9('0x1d')](_0x53f9('0x1e'));logger[_0x53f9('0x1d')](_0x53f9('0x4e'),_0x1792dd['id']);}})[_0x53f9('0x53')](function(_0x39fbf2){logger[_0x53f9('0x58')]('['+_0x112780['lastevent']['toUpperCase']()+']',JSON[_0x53f9('0x32')](_0x39fbf2));});}; \ 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 f361624..a5c76b6 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 _0xa29f=['calleridnum','callDirection','unmanaged','queue','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','headers','info','Getting\x20admin\x20information','then','users','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','Getting\x20user\x20list','agentEmail','email','userId','Admin\x20selected','userEmail','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','toUpperCase','message','/api/tasks','getString','Subjects','Descriptions','Contact','add','Task\x20created:','/contacts/','user:%s','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl','username','outbound','destcalleridnum'];(function(_0x5e8eae,_0x4f81e0){var _0xdd09cd=function(_0x28c85c){while(--_0x28c85c){_0x5e8eae['push'](_0x5e8eae['shift']());}};_0xdd09cd(++_0x4f81e0);}(_0xa29f,0x108));var _0xfa29=function(_0x55969b,_0x1ebe62){_0x55969b=_0x55969b-0x0;var _0x3d7fc1=_0xa29f[_0x55969b];return _0x3d7fc1;};'use strict';var _=require(_0xfa29('0x0'));var rp=require(_0xfa29('0x1'));var md5=require('md5');var util=require(_0xfa29('0x2'));var moment=require('moment');var Promise=require('bluebird');var Redis=require(_0xfa29('0x3'));var intUtil=require(_0xfa29('0x4'));var config=require(_0xfa29('0x5'));var logger=require(_0xfa29('0x6'))(_0xfa29('0x7'));config[_0xfa29('0x8')]=_[_0xfa29('0x9')](config[_0xfa29('0x8')],{'host':_0xfa29('0xa'),'port':0x18eb});var io=require(_0xfa29('0xb'))(new Redis(config[_0xfa29('0x8')]));function getAdminId(_0x5896b6,_0x454dd7,_0x385459,_0xd183f6){return new Promise(function(_0x5c09b3,_0x199ae0){var _0x265a6a=![];var _0x4cf06f={'method':_0xfa29('0xc'),'uri':_0xd183f6+'/api/selector/owners','json':!![]};_0x4cf06f[_0xfa29('0xd')]=_0x385459;logger[_0xfa29('0xe')](_0xfa29('0xf'));return rp(_0x4cf06f)[_0xfa29('0x10')](function(_0x389fcb){if(_0x389fcb){var _0x199675=_0x389fcb[_0xfa29('0x11')];var _0x17e815=null;for(_0x17e815=0x0;_0x17e815<_0x199675['length'];_0x17e815++){if(_0x199675[_0x17e815]['email']===_0x5896b6[_0xfa29('0x12')]){_0x5896b6[_0xfa29('0x13')]=_0x199675[_0x17e815]['id'];_0x265a6a=!![];}}if(_0x265a6a){logger[_0xfa29('0xe')](_0xfa29('0x14'),_0x5896b6['adminId']);_0x5c09b3(_0x5896b6);}else{_0x199ae0({'statusCode':0x194,'message':_0xfa29('0x15')});}}else{_0x199ae0({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xfa29('0x16')](function(_0xba43c1){logger[_0xfa29('0x17')]('['+[_0x454dd7['toUpperCase']()]+']',_0xba43c1['message']);_0x199ae0(_0xba43c1);});});}function getUser(_0x565d87,_0x172762,_0x15bfa2){return function(_0x258821){return new Promise(function(_0x521680,_0x1f19c4){var _0x4964b5={'method':_0xfa29('0xc'),'uri':_0x15bfa2+'/api/selector/owners','json':!![]};_0x4964b5['headers']=_0x172762;logger[_0xfa29('0xe')](_0xfa29('0x18'));return rp(_0x4964b5)[_0xfa29('0x10')](function(_0x58f1ab){if(_0x58f1ab){var _0x136cd6=_0x58f1ab[_0xfa29('0x11')];var _0x57c709=![];var _0x28ce6e=null;if(_0x258821[_0xfa29('0x19')]!==null){logger[_0xfa29('0xe')]('Getting\x20user\x20with\x20email',_0x258821['agentEmail']);_0x258821['userEmail']=_0x258821[_0xfa29('0x19')];for(_0x28ce6e=0x0;_0x28ce6e<_0x136cd6['length'];_0x28ce6e++){if(_0x136cd6[_0x28ce6e][_0xfa29('0x1a')]===_0x258821[_0xfa29('0x19')]){_0x57c709=!![];_0x258821[_0xfa29('0x1b')]=_0x136cd6[_0x28ce6e]['id'];logger['info']('User\x20found:',_0x258821[_0xfa29('0x1b')]);}}}if(!_0x57c709){logger[_0xfa29('0xe')](_0xfa29('0x1c'));_0x258821[_0xfa29('0x1d')]=_0x258821['adminEmail'];_0x258821['userId']=_0x258821[_0xfa29('0x13')];_0x57c709=!![];}if(_0x57c709){_0x521680(_0x258821);}else{_0x1f19c4({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x1f19c4({'statusCode':0x194,'message':_0xfa29('0x15')});}})[_0xfa29('0x16')](function(_0x2031c1){logger[_0xfa29('0x17')]('['+[_0x565d87['toUpperCase']()]+']',_0x2031c1['message']);_0x1f19c4(_0x2031c1);});});};}function searchContact(_0x4deeef,_0x53bf1f,_0x12c4a9,_0x2d78db){return new Promise(function(_0x222002,_0x45a215){var _0x10cb42={'method':_0xfa29('0xc'),'headers':_0x53bf1f,'uri':_0x4deeef+_0xfa29('0x1e')+_0x2d78db+_0xfa29('0x1f')+_0x12c4a9+_0xfa29('0x20'),'json':!![]};rp(_0x10cb42)[_0xfa29('0x10')](function(_0x2466fd){var _0x230a7f=_[_0xfa29('0x21')](_0x2466fd[_0xfa29('0x22')][_0xfa29('0x22')],[_0x12c4a9,_0x2d78db]);_0x222002(_0x230a7f);})['catch'](function(_0xc9e748){_0x45a215(_0xc9e748);});});}function getEndUser(_0xcabc39,_0x594713,_0xa7045b){return function(_0x224e3b){return new Promise(function(_0x418807,_0x5ebc9){logger[_0xfa29('0xe')](util[_0xfa29('0x23')](_0xfa29('0x24'),_0x224e3b[_0xfa29('0x25')]));searchContact(_0xa7045b,_0x594713,_0xfa29('0x26'),_0x224e3b[_0xfa29('0x25')])[_0xfa29('0x10')](function(_0xaeb23c){if(_0xaeb23c){_0x224e3b[_0xfa29('0x27')]=_0xaeb23c['id'];logger[_0xfa29('0xe')](_0xfa29('0x28'),_0x224e3b[_0xfa29('0x27')]);return _0x418807(_0x224e3b);}searchContact(_0xa7045b,_0x594713,_0xfa29('0x29'),_0x224e3b[_0xfa29('0x25')])[_0xfa29('0x10')](function(_0x50be1f){if(_0x50be1f){_0x224e3b[_0xfa29('0x27')]=_0x50be1f['id'];logger[_0xfa29('0xe')](_0xfa29('0x2a'),_0x224e3b['endUserId']);return _0x418807(_0x224e3b);}createEndUser(_0x224e3b,_0xcabc39,_0x594713,_0xa7045b)[_0xfa29('0x10')](function(_0x5e19ce){logger[_0xfa29('0xe')](_0xfa29('0x2b'),_0x5e19ce[_0xfa29('0x27')]);return _0x418807(_0x5e19ce);});});})[_0xfa29('0x16')](function(_0x3f791d){_0x5ebc9(_0x3f791d);});});};}function createEndUser(_0x21502b,_0x560c82,_0x8db392,_0x3d39e1){return new Promise(function(_0x20f2bb,_0x4bbb43){var _0x139d39=moment();var _0x3bbd33={'method':_0xfa29('0x2c'),'uri':_0x3d39e1+_0xfa29('0x2d'),'body':{'contact':{'last_name':_0x21502b['contactNumber'],'work_number':_0x21502b['contactNumber'],'mobile_number':_0x21502b[_0xfa29('0x25')],'owner_id':_0x21502b[_0xfa29('0x1b')],'created_at':_0x139d39[_0xfa29('0x23')](_0xfa29('0x2e'))}},'json':!![]};_0x3bbd33[_0xfa29('0xd')]=_0x8db392;logger[_0xfa29('0xe')](_0xfa29('0x2f'));return rp(_0x3bbd33)['then'](function(_0x535222){_0x21502b[_0xfa29('0x27')]=_0x535222[_0xfa29('0x30')]['id'];_0x20f2bb(_0x21502b);})[_0xfa29('0x16')](function(_0x2d0189){logger[_0xfa29('0x17')]('['+[_0x560c82[_0xfa29('0x31')]()]+']',_0x2d0189['message']);_0x4bbb43(_0x2d0189[_0xfa29('0x32')]);});});}function getTicket(_0x35a6bc,_0x48c63a,_0x32e630,_0x56de33,_0x4050ce){return function(_0x21ccdc){logger[_0xfa29('0xe')]('Creating\x20new\x20task');return new Promise(function(_0x5f26e4,_0xb3277b){var _0x48ddec=moment();var _0x2d7f27={'method':'POST','uri':_0x32e630+_0xfa29('0x33'),'body':{'title':intUtil[_0xfa29('0x34')](_0x56de33[_0xfa29('0x35')],_0x4050ce,'\x20'),'description':intUtil['getString'](_0x56de33[_0xfa29('0x36')],_0x4050ce,'\x0a'),'owner_id':_0x21ccdc['userId'],'creater_id':_0x21ccdc[_0xfa29('0x13')],'targetable_id':_0x21ccdc[_0xfa29('0x27')],'targetable_type':_0xfa29('0x37'),'created_at':_0x48ddec[_0xfa29('0x23')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x48ddec[_0xfa29('0x38')](0x1e,'m')[_0xfa29('0x23')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x2d7f27['headers']=_0x48c63a;return rp(_0x2d7f27)[_0xfa29('0x10')](function(_0x20f7d7){_0x21ccdc['ticketId']=_0x20f7d7['task']['id'];logger[_0xfa29('0xe')](_0xfa29('0x39'),_0x21ccdc['ticketId']);_0x5f26e4(_0x21ccdc);})['catch'](function(_0x1ae122){logger[_0xfa29('0x17')]('['+[_0x35a6bc[_0xfa29('0x31')]()]+']',_0x1ae122[_0xfa29('0x32')]);_0xb3277b(_0x1ae122[_0xfa29('0x32')]);});});};}function emit(_0x48cfed,_0x4ff817,_0x204c61){var _0x1bf052={'uri':_0x48cfed+_0xfa29('0x3a')+_0x204c61};io['to'](util['format'](_0xfa29('0x3b'),_0x4ff817))['emit']('trigger:browser:url',_0x1bf052);}exports['cs']=function(_0x3a2b2a,_0x265ea6,_0x3b2b25,_0x3bf228,_0x284bc8,_0xb2f5c7,_0x2c0562,_0x2c3018){var _0x41fda1={};var _0x57c5d2={'Authorization':_0xfa29('0x3c')+_0xb2f5c7[_0xfa29('0x3d')]};_0xb2f5c7['remoteUri']=intUtil[_0xfa29('0x3e')](_0xb2f5c7[_0xfa29('0x3f')]);_0xb2f5c7[_0xfa29('0x40')]=intUtil[_0xfa29('0x3e')](_0xb2f5c7['serverUrl']);var _0x219667=_0xb2f5c7[_0xfa29('0x3f')];_0x41fda1[_0xfa29('0x12')]=_0xb2f5c7[_0xfa29('0x41')];_0x41fda1[_0xfa29('0x25')]=_0x2c3018['toLowerCase']()===_0xfa29('0x42')?_0x265ea6[_0xfa29('0x43')]:_0x265ea6[_0xfa29('0x44')];_0x41fda1[_0xfa29('0x45')]=_0x2c3018==='queue'||_0x2c3018===_0xfa29('0x46')?_0xfa29('0x47'):_0xfa29('0x42');if(_0x3bf228){_0x41fda1[_0xfa29('0x19')]=_0x3bf228[_0xfa29('0x1a')];}var _0xf15bcd=util[_0xfa29('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xb2f5c7[_0xfa29('0x40')],_0x265ea6[_0xfa29('0x48')],md5(_0x265ea6[_0xfa29('0x48')]));if(_0x284bc8&&_0x284bc8[_0xfa29('0x49')]){logger[_0xfa29('0xe')]('[QUEUE]',_0xfa29('0x4a'));_0x265ea6['recordingURL']=_0xf15bcd;}else if(_0x2c0562&&_0x2c0562[_0xfa29('0x4b')]&&_0x2c0562[_0xfa29('0x4b')]!=='none'){logger[_0xfa29('0xe')](_0xfa29('0x4c'),_0xfa29('0x4a'));_0x265ea6[_0xfa29('0x4d')]=_0xf15bcd;}else{_0x265ea6[_0xfa29('0x4d')]='';}return getAdminId(_0x41fda1,_0x2c3018,_0x57c5d2,_0x219667)[_0xfa29('0x10')](getUser(_0x2c3018,_0x57c5d2,_0x219667))[_0xfa29('0x10')](getEndUser(_0x2c3018,_0x57c5d2,_0x219667))[_0xfa29('0x10')](getTicket(_0x2c3018,_0x57c5d2,_0x219667,_0x3b2b25,_0x265ea6))[_0xfa29('0x10')](function(_0x244939){logger[_0xfa29('0xe')](util['format'](_0xfa29('0x4e'),_0x244939['ticketId']));if(_0x2c3018!==_0xfa29('0x46')){logger[_0xfa29('0xe')]('['+[_0x2c3018['toUpperCase']()]+']',_0xfa29('0x4f'));emit(_0x219667,_0x3bf228[_0xfa29('0x50')],_0x244939[_0xfa29('0x27')]);}})[_0xfa29('0x16')](function(_0x2a274e){logger[_0xfa29('0x17')]('['+[_0x2c3018[_0xfa29('0x31')]()]+_0xfa29('0x51'),util[_0xfa29('0x52')](_0x2a274e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xa332=['endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','YYYY-MM-DDTHH:mm:ss','headers','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','error','Creating\x20new\x20task','/api/tasks','getString','Descriptions','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','destcalleridnum','calleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','util','moment','bluebird','./util','../../../../config/logger','freshsales','redis','localhost','/api/selector/owners','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userId','User\x20found:','Admin\x20selected','userEmail','message','GET','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number'];(function(_0x27e4c4,_0x51b422){var _0x40acb2=function(_0x2c68a9){while(--_0x2c68a9){_0x27e4c4['push'](_0x27e4c4['shift']());}};_0x40acb2(++_0x51b422);}(_0xa332,0x17d));var _0x2a33=function(_0x395184,_0x26b776){_0x395184=_0x395184-0x0;var _0x5a7b8e=_0xa332[_0x395184];return _0x5a7b8e;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require('md5');var util=require(_0x2a33('0x0'));var moment=require(_0x2a33('0x1'));var Promise=require(_0x2a33('0x2'));var Redis=require('ioredis');var intUtil=require(_0x2a33('0x3'));var config=require('../../../../config/environment');var logger=require(_0x2a33('0x4'))(_0x2a33('0x5'));config[_0x2a33('0x6')]=_['defaults'](config['redis'],{'host':_0x2a33('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2a33('0x6')]));function getAdminId(_0x2cd91a,_0x353f7f,_0x1ba3c3,_0x54cef5){return new Promise(function(_0x2ea4f8,_0x1e37f1){var _0x5b8729=![];var _0x2a0a7f={'method':'GET','uri':_0x54cef5+_0x2a33('0x8'),'json':!![]};_0x2a0a7f['headers']=_0x1ba3c3;logger[_0x2a33('0x9')](_0x2a33('0xa'));return rp(_0x2a0a7f)[_0x2a33('0xb')](function(_0x58907c){if(_0x58907c){var _0x20c8c3=_0x58907c[_0x2a33('0xc')];var _0x3bf3dc=null;for(_0x3bf3dc=0x0;_0x3bf3dc<_0x20c8c3[_0x2a33('0xd')];_0x3bf3dc++){if(_0x20c8c3[_0x3bf3dc][_0x2a33('0xe')]===_0x2cd91a[_0x2a33('0xf')]){_0x2cd91a[_0x2a33('0x10')]=_0x20c8c3[_0x3bf3dc]['id'];_0x5b8729=!![];}}if(_0x5b8729){logger[_0x2a33('0x9')](_0x2a33('0x11'),_0x2cd91a[_0x2a33('0x10')]);_0x2ea4f8(_0x2cd91a);}else{_0x1e37f1({'statusCode':0x194,'message':_0x2a33('0x12')});}}else{_0x1e37f1({'statusCode':0x194,'message':_0x2a33('0x12')});}})[_0x2a33('0x13')](function(_0x163894){logger['error']('['+[_0x353f7f[_0x2a33('0x14')]()]+']',_0x163894['message']);_0x1e37f1(_0x163894);});});}function getUser(_0x2fea4c,_0x58821a,_0x184c3a){return function(_0x537825){return new Promise(function(_0x5b28c0,_0x532c5c){var _0x9e82f8={'method':'GET','uri':_0x184c3a+_0x2a33('0x8'),'json':!![]};_0x9e82f8['headers']=_0x58821a;logger[_0x2a33('0x9')](_0x2a33('0x15'));return rp(_0x9e82f8)[_0x2a33('0xb')](function(_0x2ba4c1){if(_0x2ba4c1){var _0xb7e9f6=_0x2ba4c1[_0x2a33('0xc')];var _0x1dd78e=![];var _0x2c07c8=null;if(_0x537825[_0x2a33('0x16')]!==null){logger['info'](_0x2a33('0x17'),_0x537825[_0x2a33('0x16')]);_0x537825['userEmail']=_0x537825[_0x2a33('0x16')];for(_0x2c07c8=0x0;_0x2c07c8<_0xb7e9f6[_0x2a33('0xd')];_0x2c07c8++){if(_0xb7e9f6[_0x2c07c8]['email']===_0x537825['agentEmail']){_0x1dd78e=!![];_0x537825[_0x2a33('0x18')]=_0xb7e9f6[_0x2c07c8]['id'];logger[_0x2a33('0x9')](_0x2a33('0x19'),_0x537825[_0x2a33('0x18')]);}}}if(!_0x1dd78e){logger[_0x2a33('0x9')](_0x2a33('0x1a'));_0x537825[_0x2a33('0x1b')]=_0x537825[_0x2a33('0xf')];_0x537825[_0x2a33('0x18')]=_0x537825[_0x2a33('0x10')];_0x1dd78e=!![];}if(_0x1dd78e){_0x5b28c0(_0x537825);}else{_0x532c5c({'statusCode':0x194,'message':_0x2a33('0x12')});}}else{_0x532c5c({'statusCode':0x194,'message':_0x2a33('0x12')});}})[_0x2a33('0x13')](function(_0x30571e){logger['error']('['+[_0x2fea4c[_0x2a33('0x14')]()]+']',_0x30571e[_0x2a33('0x1c')]);_0x532c5c(_0x30571e);});});};}function searchContact(_0x4a5a24,_0x4a4c00,_0x39b8ff,_0x17769c){return new Promise(function(_0x15276b,_0x21ad08){var _0x239c42={'method':_0x2a33('0x1d'),'headers':_0x4a4c00,'uri':_0x4a5a24+_0x2a33('0x1e')+_0x17769c+_0x2a33('0x1f')+_0x39b8ff+_0x2a33('0x20'),'json':!![]};rp(_0x239c42)[_0x2a33('0xb')](function(_0x3e9a5a){var _0x4cda0c=_[_0x2a33('0x21')](_0x3e9a5a['contacts'][_0x2a33('0x22')],[_0x39b8ff,_0x17769c]);_0x15276b(_0x4cda0c);})['catch'](function(_0x621356){_0x21ad08(_0x621356);});});}function getEndUser(_0x379eb9,_0x309a12,_0x255021){return function(_0x406ea7){return new Promise(function(_0x1d32eb,_0x7e5b90){logger[_0x2a33('0x9')](util[_0x2a33('0x23')](_0x2a33('0x24'),_0x406ea7[_0x2a33('0x25')]));searchContact(_0x255021,_0x309a12,_0x2a33('0x26'),_0x406ea7[_0x2a33('0x25')])[_0x2a33('0xb')](function(_0x15095a){if(_0x15095a){_0x406ea7[_0x2a33('0x27')]=_0x15095a['id'];logger['info'](_0x2a33('0x28'),_0x406ea7['endUserId']);return _0x1d32eb(_0x406ea7);}searchContact(_0x255021,_0x309a12,_0x2a33('0x29'),_0x406ea7[_0x2a33('0x25')])[_0x2a33('0xb')](function(_0x16e3ca){if(_0x16e3ca){_0x406ea7[_0x2a33('0x27')]=_0x16e3ca['id'];logger['info'](_0x2a33('0x2a'),_0x406ea7['endUserId']);return _0x1d32eb(_0x406ea7);}createEndUser(_0x406ea7,_0x379eb9,_0x309a12,_0x255021)[_0x2a33('0xb')](function(_0x526638){logger[_0x2a33('0x9')](_0x2a33('0x2b'),_0x526638[_0x2a33('0x27')]);return _0x1d32eb(_0x526638);});});})[_0x2a33('0x13')](function(_0x28f479){_0x7e5b90(_0x28f479);});});};}function createEndUser(_0x149f4b,_0x3a9242,_0x33e126,_0x30835b){return new Promise(function(_0x50eb66,_0x55784b){var _0x109885=moment();var _0x3d15cc={'method':_0x2a33('0x2c'),'uri':_0x30835b+'/api/contacts','body':{'contact':{'last_name':_0x149f4b[_0x2a33('0x25')],'work_number':_0x149f4b[_0x2a33('0x25')],'mobile_number':_0x149f4b[_0x2a33('0x25')],'owner_id':_0x149f4b[_0x2a33('0x18')],'created_at':_0x109885[_0x2a33('0x23')](_0x2a33('0x2d'))}},'json':!![]};_0x3d15cc[_0x2a33('0x2e')]=_0x33e126;logger[_0x2a33('0x9')](_0x2a33('0x2f'));return rp(_0x3d15cc)['then'](function(_0x574be0){_0x149f4b[_0x2a33('0x27')]=_0x574be0[_0x2a33('0x30')]['id'];_0x50eb66(_0x149f4b);})[_0x2a33('0x13')](function(_0x4ad503){logger[_0x2a33('0x31')]('['+[_0x3a9242[_0x2a33('0x14')]()]+']',_0x4ad503[_0x2a33('0x1c')]);_0x55784b(_0x4ad503[_0x2a33('0x1c')]);});});}function getTicket(_0x26abc9,_0x592423,_0x46f773,_0x45726d,_0x32e45a){return function(_0x1a2c93){logger[_0x2a33('0x9')](_0x2a33('0x32'));return new Promise(function(_0x254abd,_0x3b0331){var _0x2b7cbe=moment();var _0x3ee0d0={'method':'POST','uri':_0x46f773+_0x2a33('0x33'),'body':{'title':intUtil[_0x2a33('0x34')](_0x45726d['Subjects'],_0x32e45a,'\x20'),'description':intUtil[_0x2a33('0x34')](_0x45726d[_0x2a33('0x35')],_0x32e45a,'\x0a'),'owner_id':_0x1a2c93[_0x2a33('0x18')],'creater_id':_0x1a2c93[_0x2a33('0x10')],'targetable_id':_0x1a2c93[_0x2a33('0x27')],'targetable_type':'Contact','created_at':_0x2b7cbe[_0x2a33('0x23')](_0x2a33('0x2d')),'due_date':_0x2b7cbe['add'](0x1e,'m')[_0x2a33('0x23')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x3ee0d0['headers']=_0x592423;return rp(_0x3ee0d0)['then'](function(_0x1f2409){_0x1a2c93[_0x2a33('0x36')]=_0x1f2409[_0x2a33('0x37')]['id'];logger[_0x2a33('0x9')](_0x2a33('0x38'),_0x1a2c93[_0x2a33('0x36')]);_0x254abd(_0x1a2c93);})['catch'](function(_0x35c408){logger[_0x2a33('0x31')]('['+[_0x26abc9[_0x2a33('0x14')]()]+']',_0x35c408[_0x2a33('0x1c')]);_0x3b0331(_0x35c408[_0x2a33('0x1c')]);});});};}function emit(_0x2b26c9,_0x2aa9dc,_0x5a0cc7){var _0x5d1478={'uri':_0x2b26c9+_0x2a33('0x39')+_0x5a0cc7};io['to'](util[_0x2a33('0x23')](_0x2a33('0x3a'),_0x2aa9dc))[_0x2a33('0x3b')]('trigger:browser:url',_0x5d1478);}exports['cs']=function(_0x5caefa,_0x165a0b,_0x1687c0,_0x2fb870,_0xb04dfb,_0x4bc72d,_0x49fb06,_0x2bc526){var _0x1ff76c={};var _0x2e0fd3={'Authorization':_0x2a33('0x3c')+_0x4bc72d[_0x2a33('0x3d')]};_0x4bc72d[_0x2a33('0x3e')]=intUtil[_0x2a33('0x3f')](_0x4bc72d[_0x2a33('0x3e')]);_0x4bc72d[_0x2a33('0x40')]=intUtil[_0x2a33('0x3f')](_0x4bc72d['serverUrl']);var _0x3f071d=_0x4bc72d[_0x2a33('0x3e')];_0x1ff76c[_0x2a33('0xf')]=_0x4bc72d[_0x2a33('0x41')];_0x1ff76c[_0x2a33('0x25')]=_0x2bc526[_0x2a33('0x42')]()==='outbound'?_0x165a0b[_0x2a33('0x43')]:_0x165a0b[_0x2a33('0x44')];_0x1ff76c[_0x2a33('0x45')]=_0x2bc526===_0x2a33('0x46')||_0x2bc526===_0x2a33('0x47')?_0x2a33('0x46'):'outbound';if(_0x2fb870){_0x1ff76c[_0x2a33('0x16')]=_0x2fb870[_0x2a33('0xe')];}var _0xbce4e1=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bc72d['serverUrl'],_0x165a0b[_0x2a33('0x48')],md5(_0x165a0b[_0x2a33('0x48')]));if(_0xb04dfb&&_0xb04dfb[_0x2a33('0x49')]){logger[_0x2a33('0x9')](_0x2a33('0x4a'),_0x2a33('0x4b'));_0x165a0b[_0x2a33('0x4c')]=_0xbce4e1;}else if(_0x49fb06&&_0x49fb06[_0x2a33('0x4d')]&&_0x49fb06[_0x2a33('0x4d')]!==_0x2a33('0x4e')){logger[_0x2a33('0x9')](_0x2a33('0x4f'),_0x2a33('0x4b'));_0x165a0b[_0x2a33('0x4c')]=_0xbce4e1;}else{_0x165a0b[_0x2a33('0x4c')]='';}return getAdminId(_0x1ff76c,_0x2bc526,_0x2e0fd3,_0x3f071d)['then'](getUser(_0x2bc526,_0x2e0fd3,_0x3f071d))[_0x2a33('0xb')](getEndUser(_0x2bc526,_0x2e0fd3,_0x3f071d))['then'](getTicket(_0x2bc526,_0x2e0fd3,_0x3f071d,_0x1687c0,_0x165a0b))[_0x2a33('0xb')](function(_0x395456){logger[_0x2a33('0x9')](util[_0x2a33('0x23')]('The\x20ticket\x20ID\x20is:\x20%s',_0x395456[_0x2a33('0x36')]));if(_0x2bc526!==_0x2a33('0x47')){logger[_0x2a33('0x9')]('['+[_0x2bc526[_0x2a33('0x14')]()]+']',_0x2a33('0x50'));emit(_0x3f071d,_0x2fb870[_0x2a33('0x51')],_0x395456[_0x2a33('0x27')]);}})[_0x2a33('0x13')](function(_0x47065d){logger['error']('['+[_0x2bc526[_0x2a33('0x14')]()]+_0x2a33('0x52'),util[_0x2a33('0x53')](_0x47065d,{'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 eee1ac6..3597dbd 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 _0x5c0b=['%s\x20configuration\x20#%s\x20not\x20found','data2','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','salesforce','sugarcrm','zoho','vtiger','freshsales','servicenow','exec','includes','data1','toLowerCase','find','Configurations','data3','queue','routeId','log','EVENT\x20UNKNOWN','unmanaged','desk','dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','format'];(function(_0x4dfc64,_0x2c2569){var _0x12b940=function(_0x33f1d7){while(--_0x33f1d7){_0x4dfc64['push'](_0x4dfc64['shift']());}};_0x12b940(++_0x2c2569);}(_0x5c0b,0xda));var _0xb5c0=function(_0x1e03c4,_0x4870e8){_0x1e03c4=_0x1e03c4-0x0;var _0x1cc069=_0x5c0b[_0x1e03c4];return _0x1cc069;};'use strict';var _=require(_0xb5c0('0x0'));var util=require(_0xb5c0('0x1'));var zendesk=require(_0xb5c0('0x2'));var salesforce=require(_0xb5c0('0x3'));var sugarcrm=require(_0xb5c0('0x4'));var freshdesk=require(_0xb5c0('0x5'));var zoho=require(_0xb5c0('0x6'));var desk=require(_0xb5c0('0x7'));var vtiger=require(_0xb5c0('0x8'));var servicenow=require('./servicenow');var dynamics365=require('./dynamics365');var freshsales=require('./freshsales');var integrations=['zendesk',_0xb5c0('0x9'),_0xb5c0('0xa'),'freshdesk',_0xb5c0('0xb'),'desk',_0xb5c0('0xc'),'dynamics365',_0xb5c0('0xd'),_0xb5c0('0xe')];exports[_0xb5c0('0xf')]=function(_0x28c811,_0x4a88a5,_0x5d1b34,_0x316578,_0xb9e7eb,_0x5ea44c){if(_0x5d1b34){if(_[_0xb5c0('0x10')](integrations,_0x28c811[_0xb5c0('0x11')][_0xb5c0('0x12')]())){try{var _0x17bf67=null;var _0x19bd40='';var _0x3acfb5=_0x5d1b34[_0x28c811[_0xb5c0('0x11')][_0xb5c0('0x12')]()];if(_0x3acfb5){var _0xba9bbe=_0x3acfb5[_0x28c811['data2']];if(_0xba9bbe){var _0xd1bdb3=_[_0xb5c0('0x13')](_0xba9bbe[_0xb5c0('0x14')],{'id':parseInt(_0x28c811[_0xb5c0('0x15')],0xa)});if(_0xd1bdb3){if(_0x316578){if(_0xb9e7eb&&_0x4a88a5['queue']){_0x19bd40=_0xb5c0('0x16');}else if(_0x4a88a5[_0xb5c0('0x17')]){_0x19bd40='outbound';}else{console[_0xb5c0('0x18')](_0xb5c0('0x19'),_0x4a88a5);}}else{_0x19bd40=_0xb5c0('0x1a');}switch(_0x28c811[_0xb5c0('0x11')]['toLowerCase']()){case'zendesk':zendesk[_0x19bd40](_0x28c811,_0x4a88a5,_0xd1bdb3,_0x316578,_0xb9e7eb,_0xba9bbe,_0x5ea44c);break;case'salesforce':salesforce[_0x19bd40](_0x28c811,_0x4a88a5,_0xd1bdb3,_0x316578,_0xb9e7eb,_0xba9bbe,_0x5ea44c);break;case'sugarcrm':sugarcrm[_0x19bd40](_0x28c811,_0x4a88a5,_0xd1bdb3,_0x316578,_0xb9e7eb,_0xba9bbe,_0x5ea44c);break;case'freshdesk':freshdesk[_0x19bd40](_0x28c811,_0x4a88a5,_0xd1bdb3,_0x316578,_0xb9e7eb,_0xba9bbe,_0x5ea44c);break;case _0xb5c0('0xb'):zoho[_0x19bd40](_0x28c811,_0x4a88a5,_0xd1bdb3,_0x316578,_0xb9e7eb,_0xba9bbe,_0x5ea44c);break;case _0xb5c0('0x1b'):desk[_0x19bd40](_0x28c811,_0x4a88a5,_0xd1bdb3,_0x316578,_0xb9e7eb,_0xba9bbe,_0x5ea44c);break;case _0xb5c0('0xc'):vtiger[_0x19bd40](_0x28c811,_0x4a88a5,_0xd1bdb3,_0x316578,_0xb9e7eb,_0xba9bbe,_0x5ea44c);break;case _0xb5c0('0xd'):freshsales['cs'](_0x28c811,_0x4a88a5,_0xd1bdb3,_0x316578,_0xb9e7eb,_0xba9bbe,_0x5ea44c,_0x19bd40);break;case'servicenow':servicenow['cs'](_0x28c811,_0x4a88a5,_0xd1bdb3,_0x316578,_0xb9e7eb,_0xba9bbe,_0x5ea44c,_0x19bd40);break;case _0xb5c0('0x1c'):dynamics365['cs'](_0x28c811,_0x4a88a5,_0xd1bdb3,_0x316578,_0xb9e7eb,_0xba9bbe,_0x5ea44c,_0x19bd40);break;default:console['log'](_0xb5c0('0x1d'));}}else{_0x17bf67=require(_0xb5c0('0x1e'))(_0x28c811[_0xb5c0('0x11')]['toLowerCase']());_0x17bf67[_0xb5c0('0x1f')](_0xb5c0('0x20'),util[_0xb5c0('0x21')](_0xb5c0('0x22'),_0x28c811[_0xb5c0('0x11')]['toLowerCase'](),_0x28c811[_0xb5c0('0x15')]));}}else{_0x17bf67=require('../../../../config/logger')(_0x28c811[_0xb5c0('0x11')][_0xb5c0('0x12')]());_0x17bf67[_0xb5c0('0x1f')]('[EXEC]',util['format']('%s\x20account\x20#%s\x20not\x20found',_0x28c811[_0xb5c0('0x11')]['toLowerCase'](),_0x28c811[_0xb5c0('0x23')]));}}else{}}catch(_0x2ac093){console[_0xb5c0('0x1f')](_0x2ac093);}}}}; \ No newline at end of file +var _0x5cec=['%s\x20configuration\x20#%s\x20not\x20found','error','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./sugarcrm','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','salesforce','sugarcrm','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','data1','toLowerCase','data2','Configurations','queue','outbound','log','EVENT\x20UNKNOWN','unmanaged','zendesk','freshdesk','unknown\x20integration','../../../../config/logger','[EXEC]','format'];(function(_0x7e88d8,_0x30c3cd){var _0x11de70=function(_0x1d954b){while(--_0x1d954b){_0x7e88d8['push'](_0x7e88d8['shift']());}};_0x11de70(++_0x30c3cd);}(_0x5cec,0x150));var _0xc5ce=function(_0x1e2493,_0x35716f){_0x1e2493=_0x1e2493-0x0;var _0x281ae4=_0x5cec[_0x1e2493];return _0x281ae4;};'use strict';var _=require('lodash');var util=require(_0xc5ce('0x0'));var zendesk=require(_0xc5ce('0x1'));var salesforce=require(_0xc5ce('0x2'));var sugarcrm=require(_0xc5ce('0x3'));var freshdesk=require('./freshdesk');var zoho=require(_0xc5ce('0x4'));var desk=require(_0xc5ce('0x5'));var vtiger=require(_0xc5ce('0x6'));var servicenow=require(_0xc5ce('0x7'));var dynamics365=require(_0xc5ce('0x8'));var freshsales=require(_0xc5ce('0x9'));var integrations=['zendesk',_0xc5ce('0xa'),_0xc5ce('0xb'),'freshdesk',_0xc5ce('0xc'),_0xc5ce('0xd'),_0xc5ce('0xe'),_0xc5ce('0xf'),_0xc5ce('0x10'),_0xc5ce('0x11')];exports[_0xc5ce('0x12')]=function(_0x14a1de,_0x366373,_0xb4a135,_0x4884c1,_0x3f9049,_0x18b3aa){if(_0xb4a135){if(_['includes'](integrations,_0x14a1de['data1']['toLowerCase']())){try{var _0x3f03f3=null;var _0x5a57be='';var _0x15a340=_0xb4a135[_0x14a1de[_0xc5ce('0x13')][_0xc5ce('0x14')]()];if(_0x15a340){var _0x4c762f=_0x15a340[_0x14a1de[_0xc5ce('0x15')]];if(_0x4c762f){var _0x57a0df=_['find'](_0x4c762f[_0xc5ce('0x16')],{'id':parseInt(_0x14a1de['data3'],0xa)});if(_0x57a0df){if(_0x4884c1){if(_0x3f9049&&_0x366373[_0xc5ce('0x17')]){_0x5a57be=_0xc5ce('0x17');}else if(_0x366373['routeId']){_0x5a57be=_0xc5ce('0x18');}else{console[_0xc5ce('0x19')](_0xc5ce('0x1a'),_0x366373);}}else{_0x5a57be=_0xc5ce('0x1b');}switch(_0x14a1de[_0xc5ce('0x13')][_0xc5ce('0x14')]()){case _0xc5ce('0x1c'):zendesk[_0x5a57be](_0x14a1de,_0x366373,_0x57a0df,_0x4884c1,_0x3f9049,_0x4c762f,_0x18b3aa);break;case _0xc5ce('0xa'):salesforce[_0x5a57be](_0x14a1de,_0x366373,_0x57a0df,_0x4884c1,_0x3f9049,_0x4c762f,_0x18b3aa);break;case _0xc5ce('0xb'):sugarcrm[_0x5a57be](_0x14a1de,_0x366373,_0x57a0df,_0x4884c1,_0x3f9049,_0x4c762f,_0x18b3aa);break;case _0xc5ce('0x1d'):freshdesk[_0x5a57be](_0x14a1de,_0x366373,_0x57a0df,_0x4884c1,_0x3f9049,_0x4c762f,_0x18b3aa);break;case _0xc5ce('0xc'):zoho[_0x5a57be](_0x14a1de,_0x366373,_0x57a0df,_0x4884c1,_0x3f9049,_0x4c762f,_0x18b3aa);break;case _0xc5ce('0xd'):desk[_0x5a57be](_0x14a1de,_0x366373,_0x57a0df,_0x4884c1,_0x3f9049,_0x4c762f,_0x18b3aa);break;case'vtiger':vtiger[_0x5a57be](_0x14a1de,_0x366373,_0x57a0df,_0x4884c1,_0x3f9049,_0x4c762f,_0x18b3aa);break;case _0xc5ce('0x10'):freshsales['cs'](_0x14a1de,_0x366373,_0x57a0df,_0x4884c1,_0x3f9049,_0x4c762f,_0x18b3aa,_0x5a57be);break;case _0xc5ce('0x11'):servicenow['cs'](_0x14a1de,_0x366373,_0x57a0df,_0x4884c1,_0x3f9049,_0x4c762f,_0x18b3aa,_0x5a57be);break;case'dynamics365':dynamics365['cs'](_0x14a1de,_0x366373,_0x57a0df,_0x4884c1,_0x3f9049,_0x4c762f,_0x18b3aa,_0x5a57be);break;default:console[_0xc5ce('0x19')](_0xc5ce('0x1e'));}}else{_0x3f03f3=require(_0xc5ce('0x1f'))(_0x14a1de[_0xc5ce('0x13')][_0xc5ce('0x14')]());_0x3f03f3['error'](_0xc5ce('0x20'),util[_0xc5ce('0x21')](_0xc5ce('0x22'),_0x14a1de[_0xc5ce('0x13')][_0xc5ce('0x14')](),_0x14a1de['data3']));}}else{_0x3f03f3=require(_0xc5ce('0x1f'))(_0x14a1de[_0xc5ce('0x13')][_0xc5ce('0x14')]());_0x3f03f3[_0xc5ce('0x23')](_0xc5ce('0x20'),util[_0xc5ce('0x21')](_0xc5ce('0x24'),_0x14a1de['data1'][_0xc5ce('0x14')](),_0x14a1de[_0xc5ce('0x15')]));}}else{}}catch(_0x90d098){console[_0xc5ce('0x23')](_0x90d098);}}}}; \ 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 3b50c35..09a3044 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 _0x0dbc=['','Caller\x20-\x20%s','format','Company','No\x20Company','upperFirst','create','forEach','string','idField','content','toString','variable','variableName','customVariable','Variable','name','password','concat','Connection','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridname','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','unmanaged','lastevent','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','redis','defaults','localhost','emit','assign','getString','Subjects','Descriptions','ticketType','Task','utc','IsReminderSet','IsRecurrence','endUserType','lead','WhatId','Case','contact','ContactId','account','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','isNil','validateEmail','sobject','User','find','execute','then','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','additionalSearchAccount','Account','length','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName'];(function(_0x2ce05e,_0x203d7f){var _0x5ad30a=function(_0x5db26b){while(--_0x5db26b){_0x2ce05e['push'](_0x2ce05e['shift']());}};_0x5ad30a(++_0x203d7f);}(_0x0dbc,0x13b));var _0xc0db=function(_0x58d6a1,_0x4b9dac){_0x58d6a1=_0x58d6a1-0x0;var _0x28b151=_0x0dbc[_0x58d6a1];return _0x28b151;};'use strict';var _=require(_0xc0db('0x0'));var rp=require(_0xc0db('0x1'));var moment=require('moment');var BPromise=require(_0xc0db('0x2'));var md5=require('md5');var jsforce=require('jsforce');var util=require(_0xc0db('0x3'));var Redis=require(_0xc0db('0x4'));var intUtil=require(_0xc0db('0x5'));var config=require(_0xc0db('0x6'));var logger=require('../../../../config/logger')('salesforce');config[_0xc0db('0x7')]=_[_0xc0db('0x8')](config[_0xc0db('0x7')],{'host':_0xc0db('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc0db('0x7')]));function emit(_0x233540,_0x33f60e,_0x174801){io['to'](_0x233540)[_0xc0db('0xa')](_0x33f60e,_0x174801);}function getTicket(_0x3a4e24,_0xa90d00,_0x4bf424,_0x114677,_0x359d84,_0x520a93,_0x5c14c2,_0x391121){var _0xcdee75=Object[_0xc0db('0xb')]({},{'OwnerId':_0xa90d00['id'],'Subject':intUtil[_0xc0db('0xc')](_0x114677[_0xc0db('0xd')],_0x359d84,'\x20'),'Description':intUtil[_0xc0db('0xc')](_0x114677[_0xc0db('0xe')],_0x359d84,'\x0a')},getCustomFields(_0x520a93,_0x359d84));if(_0x4bf424){if(_0x114677[_0xc0db('0xf')]===_0xc0db('0x10')){_0xcdee75['ActivityDate']=moment[_0xc0db('0x11')]();_0xcdee75[_0xc0db('0x12')]=![];_0xcdee75[_0xc0db('0x13')]=![];if(_0x4bf424[_0xc0db('0x14')]==='contact'||_0x4bf424[_0xc0db('0x14')]===_0xc0db('0x15')){_0xcdee75['WhoId']=_0x4bf424['id'];}else if(_0x4bf424[_0xc0db('0x14')]==='account'){_0xcdee75[_0xc0db('0x16')]=_0x4bf424['id'];}}else if(_0x114677[_0xc0db('0xf')]===_0xc0db('0x17')){if(_0x4bf424['endUserType']===_0xc0db('0x18')){_0xcdee75[_0xc0db('0x19')]=_0x4bf424['id'];}else if(_0x4bf424['endUserType']===_0xc0db('0x1a')){_0xcdee75[_0xc0db('0x1b')]=_0x4bf424['id'];}else if(_0x4bf424[_0xc0db('0x14')]===_0xc0db('0x15')&&_0x114677[_0xc0db('0x1c')]){_0xcdee75[_0x114677[_0xc0db('0x1c')]]=_0x4bf424['id'];}else{logger[_0xc0db('0x1d')](_0xc0db('0x1e'));}}}return _0x5c14c2['sobject'](_0x114677[_0xc0db('0xf')])['create'](_0xcdee75);}function getUser(_0xf46137,_0x16bede,_0x196fbf){if(!_[_0xc0db('0x1f')](_0x16bede)&&intUtil[_0xc0db('0x20')](_0x16bede)){var _0x304ba2={'Email':_0x16bede};var _0x2dcc0e={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x196fbf[_0xc0db('0x21')](_0xc0db('0x22'))[_0xc0db('0x23')](_0x304ba2,_0x2dcc0e)[_0xc0db('0x24')]()[_0xc0db('0x25')](function(_0x528c16){if(_0x528c16['length']){var _0x4e218c=_[_0xc0db('0x23')](_0x528c16,function(_0x1d5b88){return _0x1d5b88['Email']===_0x16bede;});if(_0x4e218c){logger[_0xc0db('0x1d')]('Agent\x20%s\x20found.',_0x16bede);return BPromise[_0xc0db('0x26')]({'id':_0x4e218c['Id'],'name':_0x4e218c[_0xc0db('0x27')]});}}else{logger['info'](_0xc0db('0x28'),_0x16bede);return _0x196fbf[_0xc0db('0x29')]()['then'](function(_0x50cc7b){return BPromise[_0xc0db('0x26')]({'id':_0x50cc7b[_0xc0db('0x2a')],'name':_0x50cc7b['display_name']});});}});}else{logger[_0xc0db('0x1d')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x16bede);return _0x196fbf[_0xc0db('0x29')]()['then'](function(_0x43007d){return BPromise[_0xc0db('0x26')]({'id':_0x43007d[_0xc0db('0x2a')],'name':_0x43007d[_0xc0db('0x2b')]});});}}function getEndUser(_0x35ac1d,_0x46dd3d,_0x2a21db,_0x5b3134,_0x4e77d6){var _0x1cd3bc={'$or':{'Phone':_0x5b3134}};var _0x43a0f1={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xc0db('0x26')]()['then'](function(){logger[_0xc0db('0x1d')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x5b3134,_0x46dd3d[_0xc0db('0x2c')]);switch(_0x46dd3d[_0xc0db('0x2c')]){case _0xc0db('0x2d'):var _0x1c0b44=_[_0xc0db('0x2e')](_0x1cd3bc);if(_0x46dd3d[_0xc0db('0x2f')]){var _0x239ad1={};_0x239ad1[_0x46dd3d[_0xc0db('0x2f')]]=_0x5b3134;_[_0xc0db('0x30')](_0x1c0b44[_0xc0db('0x31')],_0x239ad1);}return _0x4e77d6[_0xc0db('0x21')](_0xc0db('0x32'))['find'](_0x1c0b44,_0x43a0f1)[_0xc0db('0x24')]()[_0xc0db('0x25')](function(_0x2eb75f){if(_0x2eb75f&&_0x2eb75f['length']){return _0x2eb75f;}else{var _0x2450eb=_['cloneDeep'](_0x1cd3bc);if(_0x46dd3d[_0xc0db('0x33')]){var _0x415028={};_0x415028[_0x46dd3d['additionalSearchLead']]=_0x5b3134;_['merge'](_0x2450eb[_0xc0db('0x31')],_0x415028);}return _0x4e77d6['sobject'](_0xc0db('0x34'))[_0xc0db('0x23')](_0x2450eb,_0x43a0f1);}});case'account_contact_lead':var _0x5f4da1=_[_0xc0db('0x2e')](_0x1cd3bc);if(_0x46dd3d[_0xc0db('0x35')]){var _0x239ad1={};_0x239ad1[_0x46dd3d['additionalSearchAccount']]=_0x5b3134;_['merge'](_0x5f4da1[_0xc0db('0x31')],_0x239ad1);}return _0x4e77d6[_0xc0db('0x21')](_0xc0db('0x36'))[_0xc0db('0x23')](_0x5f4da1,_0x43a0f1)[_0xc0db('0x24')]()['then'](function(_0x519e47){if(_0x519e47&&_0x519e47[_0xc0db('0x37')]){return _0x519e47;}else{var _0x963715=_[_0xc0db('0x2e')](_0x1cd3bc);if(_0x46dd3d[_0xc0db('0x2f')]){var _0x592ef9={};_0x592ef9[_0x46dd3d[_0xc0db('0x2f')]]=_0x5b3134;_['merge'](_0x963715['$or'],_0x592ef9);}return _0x4e77d6[_0xc0db('0x21')](_0xc0db('0x32'))[_0xc0db('0x23')](_0x963715,_0x43a0f1)[_0xc0db('0x25')](function(_0x3395be){if(_0x3395be&&_0x3395be[_0xc0db('0x37')]){return _0x3395be;}else{var _0x54149d=_['cloneDeep'](_0x1cd3bc);if(_0x46dd3d[_0xc0db('0x33')]){var _0xb402a6={};_0xb402a6[_0x46dd3d[_0xc0db('0x33')]]=_0x5b3134;_['merge'](_0x54149d[_0xc0db('0x31')],_0xb402a6);}return _0x4e77d6['sobject'](_0xc0db('0x34'))[_0xc0db('0x23')](_0x54149d,_0x43a0f1);}});}});case _0xc0db('0x18'):var _0x1c0b44=_[_0xc0db('0x2e')](_0x1cd3bc);if(_0x46dd3d[_0xc0db('0x2f')]){var _0x239ad1={};_0x239ad1[_0x46dd3d[_0xc0db('0x2f')]]=_0x5b3134;_[_0xc0db('0x30')](_0x1c0b44['$or'],_0x239ad1);}return _0x4e77d6[_0xc0db('0x21')](_0xc0db('0x32'))[_0xc0db('0x23')](_0x1c0b44,_0x43a0f1)[_0xc0db('0x24')]();case _0xc0db('0x15'):var _0x36cc59=_['cloneDeep'](_0x1cd3bc);if(_0x46dd3d[_0xc0db('0x33')]){var _0x239ad1={};_0x239ad1[_0x46dd3d[_0xc0db('0x33')]]=_0x5b3134;_[_0xc0db('0x30')](_0x36cc59[_0xc0db('0x31')],_0x239ad1);}return _0x4e77d6[_0xc0db('0x21')]('Lead')[_0xc0db('0x23')](_0x36cc59,_0x43a0f1);case _0xc0db('0x1a'):var _0x5f4da1=_['cloneDeep'](_0x1cd3bc);if(_0x46dd3d['additionalSearchAccount']){var _0x239ad1={};_0x239ad1[_0x46dd3d[_0xc0db('0x35')]]=_0x5b3134;_[_0xc0db('0x30')](_0x5f4da1[_0xc0db('0x31')],_0x239ad1);}return _0x4e77d6['sobject'](_0xc0db('0x36'))[_0xc0db('0x23')](_0x5f4da1,_0x43a0f1);default:return null;}})['then'](function(_0x2692bc){if(_0x2692bc&&_0x2692bc[_0xc0db('0x37')]){var _0x26ddd5=_[_0xc0db('0x38')](_0x2692bc);if(_0x26ddd5){return BPromise[_0xc0db('0x26')]({'id':_0x26ddd5['Id'],'name':_0x26ddd5[_0xc0db('0x27')],'phone':_0x26ddd5[_0xc0db('0x39')],'endUserType':_0x26ddd5[_0xc0db('0x3a')][_0xc0db('0x3b')][_0xc0db('0x3c')]()});}}})[_0xc0db('0x25')](function(_0x3f558c){if(_0x3f558c){logger[_0xc0db('0x1d')](_0xc0db('0x3d'),_0x3f558c[_0xc0db('0x14')],_0x5b3134);return BPromise[_0xc0db('0x26')](_0x3f558c);}else{logger[_0xc0db('0x1d')](_0xc0db('0x3e'),_0x5b3134);var _0x2d190d={'Phone':_0x5b3134};if(_0x46dd3d[_0xc0db('0x3f')]){if(_0x46dd3d[_0xc0db('0x3f')]==='contact'){logger[_0xc0db('0x1d')](_0xc0db('0x40'),_0x5b3134,_0x46dd3d[_0xc0db('0x3f')]);_0x2d190d[_0xc0db('0x41')]=_0x2a21db!==_0xc0db('0x42')?_0x2a21db:util['format'](_0xc0db('0x43'),_0x5b3134);}else if(_0x46dd3d[_0xc0db('0x3f')]===_0xc0db('0x15')){logger[_0xc0db('0x1d')](_0xc0db('0x40'),_0x5b3134,_0x46dd3d[_0xc0db('0x3f')]);_0x2d190d[_0xc0db('0x41')]=_0x2a21db!==_0xc0db('0x42')?_0x2a21db:util[_0xc0db('0x44')](_0xc0db('0x43'),_0x5b3134);_0x2d190d[_0xc0db('0x45')]=_0xc0db('0x46');}else if(_0x46dd3d[_0xc0db('0x3f')]===_0xc0db('0x1a')){logger[_0xc0db('0x1d')](_0xc0db('0x40'),_0x5b3134,_0x46dd3d[_0xc0db('0x3f')]);_0x2d190d[_0xc0db('0x27')]=_0x2a21db!==_0xc0db('0x42')?_0x2a21db:util[_0xc0db('0x44')](_0xc0db('0x43'),_0x5b3134);}else{return null;}}return _0x4e77d6[_0xc0db('0x21')](_[_0xc0db('0x47')](_0x46dd3d[_0xc0db('0x3f')]))[_0xc0db('0x48')](_0x2d190d)[_0xc0db('0x25')](function(_0x570d6e){return BPromise[_0xc0db('0x26')]({'id':_0x570d6e['id'],'endUserType':_0x46dd3d['moduleCreate']});});}});}function getCustomFields(_0x52fc67,_0x5053d4){var _0x803e1a={};if(_0x52fc67['length']>0x0){_[_0xc0db('0x49')](_0x52fc67,function(_0x4d93fd){if(_['includes']([_0xc0db('0x4a'),'picklist'],_0x4d93fd[_0xc0db('0x3b')])&&_0x4d93fd[_0xc0db('0x4b')]){_0x803e1a[_0x4d93fd[_0xc0db('0x4b')]]=_0x4d93fd[_0xc0db('0x4c')][_0xc0db('0x4d')]();}else if(_0x4d93fd[_0xc0db('0x3b')]===_0xc0db('0x4e')&&_0x4d93fd[_0xc0db('0x4f')]&&_0x4d93fd[_0xc0db('0x4b')]){_0x5053d4[_0x4d93fd[_0xc0db('0x4f')]]&&(_0x803e1a[_0x4d93fd['idField']]=_0x5053d4[_0x4d93fd[_0xc0db('0x4f')]]['toString']());}else if(_0x4d93fd[_0xc0db('0x3b')]===_0xc0db('0x50')&&_0x4d93fd[_0xc0db('0x51')]&&_0x4d93fd[_0xc0db('0x51')][_0xc0db('0x52')]&&_0x4d93fd[_0xc0db('0x4b')]){_0x5053d4[_0x4d93fd[_0xc0db('0x51')]['name'][_0xc0db('0x3c')]()]&&(_0x803e1a[_0x4d93fd[_0xc0db('0x4b')]]=_0x5053d4[_0x4d93fd[_0xc0db('0x51')]['name']['toLowerCase']()]['toString']());}});}return _0x803e1a;}function getConnection(_0x33f939){var _0x3a6ec3=_0x33f939[_0xc0db('0x53')][_0xc0db('0x54')](_0x33f939['securityToken']);var _0x27dcd8=new jsforce[(_0xc0db('0x55'))]({'oauth2':{'loginUrl':_0x33f939['remoteUri']||'https://login.salesforce.com','clientId':_0x33f939[_0xc0db('0x56')],'clientSecret':_0x33f939[_0xc0db('0x57')]}});return _0x27dcd8[_0xc0db('0x58')](_0x33f939[_0xc0db('0x59')],_0x3a6ec3)[_0xc0db('0x25')](function(){logger['info'](_0xc0db('0x5a'));return _0x27dcd8;});}exports[_0xc0db('0x5b')]=function(_0x2e7ca1,_0xdcf667,_0x48991b,_0x1fa9e8,_0x17d92d,_0x4a3a52){var _0x55d74d,_0x2334f9,_0x4a9af0,_0x402705;_0x4a3a52[_0xc0db('0x5c')]=intUtil[_0xc0db('0x5d')](_0x4a3a52[_0xc0db('0x5c')]);_0x4a3a52[_0xc0db('0x5e')]=intUtil['stripTrailingSlash'](_0x4a3a52[_0xc0db('0x5e')]);if(_0x17d92d&&_0x17d92d[_0xc0db('0x5f')]){logger[_0xc0db('0x1d')](_0xc0db('0x60'),_0xc0db('0x61'));_0xdcf667['recordingURL']=util['format'](_0xc0db('0x62'),_0x4a3a52[_0xc0db('0x5c')],_0xdcf667['uniqueid'],md5(_0xdcf667[_0xc0db('0x63')]));}else{_0xdcf667[_0xc0db('0x64')]='';}return getConnection(_0x4a3a52)[_0xc0db('0x25')](function(_0x566df6){_0x402705=_0x566df6;return getUser(_0x4a3a52,_0x1fa9e8[_0xc0db('0x65')],_0x402705);})[_0xc0db('0x25')](function(_0xd4a26b){_0x55d74d=_0xd4a26b;return getEndUser(_0x4a3a52,_0x48991b,_0xdcf667[_0xc0db('0x66')],_0xdcf667[_0xc0db('0x67')],_0x402705);})[_0xc0db('0x25')](function(_0x2fc281){_0x2334f9=_0x2fc281;return getTicket(_0x4a3a52,_0x55d74d,_0x2334f9,_0x48991b,_0xdcf667,_0x48991b['Fields'],_0x402705,_0xc0db('0x5b'));})[_0xc0db('0x25')](function(_0x467740){_0x4a9af0=_0x467740;logger[_0xc0db('0x1d')](_0xc0db('0x68'),_0x4a9af0['id']);logger[_0xc0db('0x1d')](_0xc0db('0x69'),_0x4a9af0['id'],_0x1fa9e8['name'],_0x4a3a52['type']);switch(_0x4a3a52[_0xc0db('0x3b')]){case _0xc0db('0x6a'):emit(util['format'](_0xc0db('0x6b'),_0x1fa9e8['name']),_0xc0db('0x6c'),{'recordId':_0x4a9af0['id']});break;case _0xc0db('0x6d'):emit(util[_0xc0db('0x44')](_0xc0db('0x6b'),_0x1fa9e8['name']),_0xc0db('0x6e'),{'uri':util[_0xc0db('0x44')](_0xc0db('0x6f'),_0x402705['instanceUrl'],_0x4a9af0['id'])});break;default:logger[_0xc0db('0x70')](_0xc0db('0x71'));}})[_0xc0db('0x72')](function(_0x2c5397){logger[_0xc0db('0x70')](_0xc0db('0x60'),_0x2c5397);});};exports[_0xc0db('0x73')]=function(_0x42bdf6,_0xd933dd,_0x379963,_0x332a65,_0x4d5ba3,_0x316026,_0x2b47b8){var _0x4435c5,_0x2b0179,_0x249c4f,_0x1a5977;_0x316026[_0xc0db('0x5c')]=intUtil[_0xc0db('0x5d')](_0x316026[_0xc0db('0x5c')]);_0x316026[_0xc0db('0x5e')]=intUtil[_0xc0db('0x5d')](_0x316026[_0xc0db('0x5e')]);if(_0x2b47b8&&_0x2b47b8[_0xc0db('0x74')]&&_0x2b47b8[_0xc0db('0x74')]!=='none'){logger[_0xc0db('0x1d')](_0xc0db('0x75'),_0xc0db('0x61'));_0xd933dd[_0xc0db('0x64')]=util['format'](_0xc0db('0x62'),_0x316026[_0xc0db('0x5c')],_0xd933dd[_0xc0db('0x63')],md5(_0xd933dd[_0xc0db('0x63')]));}return getConnection(_0x316026)['then'](function(_0x3832a5){_0x1a5977=_0x3832a5;return getUser(_0x316026,_0x332a65[_0xc0db('0x65')],_0x1a5977);})[_0xc0db('0x25')](function(_0x24643f){_0x4435c5=_0x24643f;return getEndUser(_0x316026,_0x379963,_0xd933dd[_0xc0db('0x76')],_0xd933dd[_0xc0db('0x77')],_0x1a5977);})[_0xc0db('0x25')](function(_0x16dc11){_0x2b0179=_0x16dc11;return getTicket(_0x316026,_0x4435c5,_0x2b0179,_0x379963,_0xd933dd,_0x379963[_0xc0db('0x78')],_0x1a5977,'outbound');})[_0xc0db('0x25')](function(_0x27f91b){_0x249c4f=_0x27f91b;logger['info'](_0xc0db('0x79'),_0x249c4f['id']);logger['info'](_0xc0db('0x7a'),_0x249c4f['id'],_0x332a65[_0xc0db('0x52')],_0x316026[_0xc0db('0x3b')]);switch(_0x316026[_0xc0db('0x3b')]){case'integrationTab':emit(util[_0xc0db('0x44')](_0xc0db('0x6b'),_0x332a65[_0xc0db('0x52')]),_0xc0db('0x6c'),{'recordId':_0x249c4f['id']});break;case _0xc0db('0x6d'):emit(util[_0xc0db('0x44')](_0xc0db('0x6b'),_0x332a65['name']),'trigger:browser:url',{'uri':util['format'](_0xc0db('0x6f'),_0x1a5977['instanceUrl'],_0x249c4f['id'])});break;default:logger[_0xc0db('0x70')]('[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized');}})[_0xc0db('0x72')](function(_0x3774aa){logger[_0xc0db('0x70')](_0xc0db('0x75'),_0x3774aa);});};exports[_0xc0db('0x7b')]=function(_0x50dc01,_0x14f013,_0x2cb6ef,_0x36f015,_0x170ac9,_0x391627){var _0x2a38b2,_0x58ba76,_0x4aafcc,_0x2e68c0;_0x391627['serverUrl']=intUtil[_0xc0db('0x5d')](_0x391627[_0xc0db('0x5c')]);_0x391627['remoteUri']=intUtil[_0xc0db('0x5d')](_0x391627[_0xc0db('0x5e')]);if(_0x170ac9&&_0x170ac9['monitor_format']){logger[_0xc0db('0x1d')]('['+_0x14f013[_0xc0db('0x7c')][_0xc0db('0x7d')]()+']',_0xc0db('0x61'));_0x14f013['recordingURL']=util[_0xc0db('0x44')](_0xc0db('0x62'),_0x391627[_0xc0db('0x5c')],_0x14f013[_0xc0db('0x63')],md5(_0x14f013['uniqueid']));}else{_0x14f013[_0xc0db('0x64')]='';}return getConnection(_0x391627)[_0xc0db('0x25')](function(_0x2949e6){_0x2e68c0=_0x2949e6;if(!_[_0xc0db('0x1f')](_0x36f015)){return getUser(_0x391627,_0x36f015[_0xc0db('0x52')],_0x2e68c0);}else{return getUser(_0x391627,null,_0x2e68c0);}})[_0xc0db('0x25')](function(_0x6267c0){_0x2a38b2=_0x6267c0;return getEndUser(_0x391627,_0x2cb6ef,_0x14f013[_0xc0db('0x66')],_0x14f013[_0xc0db('0x67')],_0x2e68c0);})[_0xc0db('0x25')](function(_0x262336){_0x58ba76=_0x262336;return getTicket(_0x391627,_0x2a38b2,_0x58ba76,_0x2cb6ef,_0x14f013,_0x2cb6ef[_0xc0db('0x78')],_0x2e68c0);})[_0xc0db('0x25')](function(_0x1f6fa1){_0x4aafcc=_0x1f6fa1;logger[_0xc0db('0x1d')]('['+_0x14f013[_0xc0db('0x7c')][_0xc0db('0x7d')]()+']\x20Ticket\x20%s\x20created.',_0x4aafcc['id']);logger[_0xc0db('0x1d')]('['+_0x14f013['lastevent'][_0xc0db('0x7d')]()+_0xc0db('0x7e'),_0x391627[_0xc0db('0x3b')]);})['catch'](function(_0x24ff89){logger[_0xc0db('0x70')]('['+_0x14f013[_0xc0db('0x7c')][_0xc0db('0x7d')]()+']',_0x24ff89);});}; \ No newline at end of file +var _0x9806=['outbound','recordingFormat','none','uniqueid','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','instanceUrl','[OUTBOUND]','unmanaged','lastevent','toUpperCase','calleridnum',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','util','./util','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','assign','getString','Subjects','Descriptions','ActivityDate','utc','IsReminderSet','endUserType','WhoId','account','WhatId','ticketType','Case','contact','lead','leadId','info','sobject','create','isNil','User','then','length','find','Email','resolve','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','merge','$or','Contact','execute','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','first','Name','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','Caller\x20-\x20%s','format','Company','No\x20Company','upperFirst','forEach','includes','idField','content','toString','variable','variableName','customVariable','password','concat','securityToken','Connection','remoteUri','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','name','newTab','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9806,0x175));var _0x6980=function(_0xcfcddd,_0x5d01ab){_0xcfcddd=_0xcfcddd-0x0;var _0x34aeb6=_0x9806[_0xcfcddd];return _0x34aeb6;};'use strict';var _=require(_0x6980('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var md5=require('md5');var jsforce=require('jsforce');var util=require(_0x6980('0x1'));var Redis=require('ioredis');var intUtil=require(_0x6980('0x2'));var config=require(_0x6980('0x3'));var logger=require(_0x6980('0x4'))('salesforce');config['redis']=_['defaults'](config[_0x6980('0x5')],{'host':_0x6980('0x6'),'port':0x18eb});var io=require(_0x6980('0x7'))(new Redis(config['redis']));function emit(_0x158700,_0x107e17,_0x2a5fc9){io['to'](_0x158700)['emit'](_0x107e17,_0x2a5fc9);}function getTicket(_0xb43b7a,_0xea244c,_0x2be7ee,_0x552239,_0x59acdf,_0x398d92,_0x373dce,_0x1e8fbe){var _0x289e93=Object[_0x6980('0x8')]({},{'OwnerId':_0xea244c['id'],'Subject':intUtil[_0x6980('0x9')](_0x552239[_0x6980('0xa')],_0x59acdf,'\x20'),'Description':intUtil[_0x6980('0x9')](_0x552239[_0x6980('0xb')],_0x59acdf,'\x0a')},getCustomFields(_0x398d92,_0x59acdf));if(_0x2be7ee){if(_0x552239['ticketType']==='Task'){_0x289e93[_0x6980('0xc')]=moment[_0x6980('0xd')]();_0x289e93[_0x6980('0xe')]=![];_0x289e93['IsRecurrence']=![];if(_0x2be7ee[_0x6980('0xf')]==='contact'||_0x2be7ee['endUserType']==='lead'){_0x289e93[_0x6980('0x10')]=_0x2be7ee['id'];}else if(_0x2be7ee['endUserType']===_0x6980('0x11')){_0x289e93[_0x6980('0x12')]=_0x2be7ee['id'];}}else if(_0x552239[_0x6980('0x13')]===_0x6980('0x14')){if(_0x2be7ee['endUserType']===_0x6980('0x15')){_0x289e93['ContactId']=_0x2be7ee['id'];}else if(_0x2be7ee[_0x6980('0xf')]===_0x6980('0x11')){_0x289e93['AccountId']=_0x2be7ee['id'];}else if(_0x2be7ee[_0x6980('0xf')]===_0x6980('0x16')&&_0x552239[_0x6980('0x17')]){_0x289e93[_0x552239[_0x6980('0x17')]]=_0x2be7ee['id'];}else{logger[_0x6980('0x18')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x373dce[_0x6980('0x19')](_0x552239[_0x6980('0x13')])[_0x6980('0x1a')](_0x289e93);}function getUser(_0x4a4f61,_0x541fdd,_0x1e5392){if(!_[_0x6980('0x1b')](_0x541fdd)&&intUtil['validateEmail'](_0x541fdd)){var _0x44c092={'Email':_0x541fdd};var _0x32462f={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x1e5392['sobject'](_0x6980('0x1c'))['find'](_0x44c092,_0x32462f)['execute']()[_0x6980('0x1d')](function(_0x17d2f6){if(_0x17d2f6[_0x6980('0x1e')]){var _0x4dc8ed=_[_0x6980('0x1f')](_0x17d2f6,function(_0x31bee6){return _0x31bee6[_0x6980('0x20')]===_0x541fdd;});if(_0x4dc8ed){logger[_0x6980('0x18')]('Agent\x20%s\x20found.',_0x541fdd);return BPromise[_0x6980('0x21')]({'id':_0x4dc8ed['Id'],'name':_0x4dc8ed['Name']});}}else{logger[_0x6980('0x18')](_0x6980('0x22'),_0x541fdd);return _0x1e5392[_0x6980('0x23')]()[_0x6980('0x1d')](function(_0x2f8968){return BPromise[_0x6980('0x21')]({'id':_0x2f8968[_0x6980('0x24')],'name':_0x2f8968[_0x6980('0x25')]});});}});}else{logger[_0x6980('0x18')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x541fdd);return _0x1e5392[_0x6980('0x23')]()[_0x6980('0x1d')](function(_0x15f0ca){return BPromise['resolve']({'id':_0x15f0ca['user_id'],'name':_0x15f0ca[_0x6980('0x25')]});});}}function getEndUser(_0x5641bd,_0x4f35e9,_0x15d496,_0x5c0339,_0x4f8364){var _0x31010f={'$or':{'Phone':_0x5c0339}};var _0xbb3066={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()['then'](function(){logger[_0x6980('0x18')](_0x6980('0x26'),_0x5c0339,_0x4f35e9['moduleSearch']);switch(_0x4f35e9[_0x6980('0x27')]){case _0x6980('0x28'):var _0x17fec4=_[_0x6980('0x29')](_0x31010f);if(_0x4f35e9[_0x6980('0x2a')]){var _0x42fab5={};_0x42fab5[_0x4f35e9[_0x6980('0x2a')]]=_0x5c0339;_[_0x6980('0x2b')](_0x17fec4[_0x6980('0x2c')],_0x42fab5);}return _0x4f8364['sobject'](_0x6980('0x2d'))[_0x6980('0x1f')](_0x17fec4,_0xbb3066)[_0x6980('0x2e')]()[_0x6980('0x1d')](function(_0x5ed22e){if(_0x5ed22e&&_0x5ed22e['length']){return _0x5ed22e;}else{var _0x2330d0=_[_0x6980('0x29')](_0x31010f);if(_0x4f35e9[_0x6980('0x2f')]){var _0x8fc56e={};_0x8fc56e[_0x4f35e9[_0x6980('0x2f')]]=_0x5c0339;_[_0x6980('0x2b')](_0x2330d0['$or'],_0x8fc56e);}return _0x4f8364[_0x6980('0x19')](_0x6980('0x30'))['find'](_0x2330d0,_0xbb3066);}});case _0x6980('0x31'):var _0x308ac9=_[_0x6980('0x29')](_0x31010f);if(_0x4f35e9['additionalSearchAccount']){var _0x42fab5={};_0x42fab5[_0x4f35e9[_0x6980('0x32')]]=_0x5c0339;_['merge'](_0x308ac9[_0x6980('0x2c')],_0x42fab5);}return _0x4f8364[_0x6980('0x19')](_0x6980('0x33'))[_0x6980('0x1f')](_0x308ac9,_0xbb3066)[_0x6980('0x2e')]()['then'](function(_0xb7a027){if(_0xb7a027&&_0xb7a027[_0x6980('0x1e')]){return _0xb7a027;}else{var _0x407030=_[_0x6980('0x29')](_0x31010f);if(_0x4f35e9['additionalSearchContact']){var _0x373fc6={};_0x373fc6[_0x4f35e9[_0x6980('0x2a')]]=_0x5c0339;_['merge'](_0x407030[_0x6980('0x2c')],_0x373fc6);}return _0x4f8364[_0x6980('0x19')](_0x6980('0x2d'))[_0x6980('0x1f')](_0x407030,_0xbb3066)[_0x6980('0x1d')](function(_0x3e4985){if(_0x3e4985&&_0x3e4985[_0x6980('0x1e')]){return _0x3e4985;}else{var _0xc3ec92=_[_0x6980('0x29')](_0x31010f);if(_0x4f35e9[_0x6980('0x2f')]){var _0x44f7fe={};_0x44f7fe[_0x4f35e9[_0x6980('0x2f')]]=_0x5c0339;_['merge'](_0xc3ec92[_0x6980('0x2c')],_0x44f7fe);}return _0x4f8364['sobject'](_0x6980('0x30'))[_0x6980('0x1f')](_0xc3ec92,_0xbb3066);}});}});case _0x6980('0x15'):var _0x17fec4=_[_0x6980('0x29')](_0x31010f);if(_0x4f35e9[_0x6980('0x2a')]){var _0x42fab5={};_0x42fab5[_0x4f35e9['additionalSearchContact']]=_0x5c0339;_['merge'](_0x17fec4[_0x6980('0x2c')],_0x42fab5);}return _0x4f8364['sobject'](_0x6980('0x2d'))[_0x6980('0x1f')](_0x17fec4,_0xbb3066)['execute']();case _0x6980('0x16'):var _0x3dca11=_[_0x6980('0x29')](_0x31010f);if(_0x4f35e9[_0x6980('0x2f')]){var _0x42fab5={};_0x42fab5[_0x4f35e9['additionalSearchLead']]=_0x5c0339;_[_0x6980('0x2b')](_0x3dca11[_0x6980('0x2c')],_0x42fab5);}return _0x4f8364[_0x6980('0x19')]('Lead')['find'](_0x3dca11,_0xbb3066);case _0x6980('0x11'):var _0x308ac9=_[_0x6980('0x29')](_0x31010f);if(_0x4f35e9['additionalSearchAccount']){var _0x42fab5={};_0x42fab5[_0x4f35e9[_0x6980('0x32')]]=_0x5c0339;_[_0x6980('0x2b')](_0x308ac9[_0x6980('0x2c')],_0x42fab5);}return _0x4f8364['sobject'](_0x6980('0x33'))[_0x6980('0x1f')](_0x308ac9,_0xbb3066);default:return null;}})[_0x6980('0x1d')](function(_0x1a576d){if(_0x1a576d&&_0x1a576d[_0x6980('0x1e')]){var _0x5bef2d=_[_0x6980('0x34')](_0x1a576d);if(_0x5bef2d){return BPromise[_0x6980('0x21')]({'id':_0x5bef2d['Id'],'name':_0x5bef2d[_0x6980('0x35')],'phone':_0x5bef2d['Phone'],'endUserType':_0x5bef2d[_0x6980('0x36')][_0x6980('0x37')][_0x6980('0x38')]()});}}})[_0x6980('0x1d')](function(_0x447d58){if(_0x447d58){logger[_0x6980('0x18')](_0x6980('0x39'),_0x447d58['endUserType'],_0x5c0339);return BPromise[_0x6980('0x21')](_0x447d58);}else{logger[_0x6980('0x18')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x5c0339);var _0x4f0d82={'Phone':_0x5c0339};if(_0x4f35e9[_0x6980('0x3a')]){if(_0x4f35e9[_0x6980('0x3a')]===_0x6980('0x15')){logger[_0x6980('0x18')](_0x6980('0x3b'),_0x5c0339,_0x4f35e9[_0x6980('0x3a')]);_0x4f0d82[_0x6980('0x3c')]=_0x15d496!==_0x6980('0x3d')?_0x15d496:util['format'](_0x6980('0x3e'),_0x5c0339);}else if(_0x4f35e9[_0x6980('0x3a')]===_0x6980('0x16')){logger[_0x6980('0x18')](_0x6980('0x3b'),_0x5c0339,_0x4f35e9[_0x6980('0x3a')]);_0x4f0d82[_0x6980('0x3c')]=_0x15d496!==''?_0x15d496:util[_0x6980('0x3f')](_0x6980('0x3e'),_0x5c0339);_0x4f0d82[_0x6980('0x40')]=_0x6980('0x41');}else if(_0x4f35e9['moduleCreate']===_0x6980('0x11')){logger[_0x6980('0x18')](_0x6980('0x3b'),_0x5c0339,_0x4f35e9[_0x6980('0x3a')]);_0x4f0d82[_0x6980('0x35')]=_0x15d496!==_0x6980('0x3d')?_0x15d496:util[_0x6980('0x3f')](_0x6980('0x3e'),_0x5c0339);}else{return null;}}return _0x4f8364[_0x6980('0x19')](_[_0x6980('0x42')](_0x4f35e9['moduleCreate']))[_0x6980('0x1a')](_0x4f0d82)[_0x6980('0x1d')](function(_0x5c6586){return BPromise['resolve']({'id':_0x5c6586['id'],'endUserType':_0x4f35e9['moduleCreate']});});}});}function getCustomFields(_0x5f1616,_0x31ba6d){var _0x528402={};if(_0x5f1616[_0x6980('0x1e')]>0x0){_[_0x6980('0x43')](_0x5f1616,function(_0x18e229){if(_[_0x6980('0x44')](['string','picklist'],_0x18e229['type'])&&_0x18e229[_0x6980('0x45')]){_0x528402[_0x18e229[_0x6980('0x45')]]=_0x18e229[_0x6980('0x46')][_0x6980('0x47')]();}else if(_0x18e229['type']===_0x6980('0x48')&&_0x18e229['variableName']&&_0x18e229[_0x6980('0x45')]){_0x31ba6d[_0x18e229[_0x6980('0x49')]]&&(_0x528402[_0x18e229['idField']]=_0x31ba6d[_0x18e229['variableName']][_0x6980('0x47')]());}else if(_0x18e229[_0x6980('0x37')]===_0x6980('0x4a')&&_0x18e229['Variable']&&_0x18e229['Variable']['name']&&_0x18e229[_0x6980('0x45')]){_0x31ba6d[_0x18e229['Variable']['name'][_0x6980('0x38')]()]&&(_0x528402[_0x18e229[_0x6980('0x45')]]=_0x31ba6d[_0x18e229['Variable']['name'][_0x6980('0x38')]()][_0x6980('0x47')]());}});}return _0x528402;}function getConnection(_0xb2fd1d){var _0x1fcb8a=_0xb2fd1d[_0x6980('0x4b')][_0x6980('0x4c')](_0xb2fd1d[_0x6980('0x4d')]);var _0x4bf648=new jsforce[(_0x6980('0x4e'))]({'oauth2':{'loginUrl':_0xb2fd1d[_0x6980('0x4f')]||'https://login.salesforce.com','clientId':_0xb2fd1d[_0x6980('0x50')],'clientSecret':_0xb2fd1d[_0x6980('0x51')]}});return _0x4bf648[_0x6980('0x52')](_0xb2fd1d[_0x6980('0x53')],_0x1fcb8a)[_0x6980('0x1d')](function(){logger[_0x6980('0x18')](_0x6980('0x54'));return _0x4bf648;});}exports[_0x6980('0x55')]=function(_0x212594,_0x234f18,_0x19ff6d,_0x9c9ec1,_0x3d71ff,_0x7548d8){var _0x44c63f,_0x2900df,_0xd56b69,_0x2c1294;_0x7548d8['serverUrl']=intUtil['stripTrailingSlash'](_0x7548d8[_0x6980('0x56')]);_0x7548d8[_0x6980('0x4f')]=intUtil[_0x6980('0x57')](_0x7548d8[_0x6980('0x4f')]);if(_0x3d71ff&&_0x3d71ff[_0x6980('0x58')]){logger[_0x6980('0x18')]('[QUEUE]',_0x6980('0x59'));_0x234f18[_0x6980('0x5a')]=util['format'](_0x6980('0x5b'),_0x7548d8[_0x6980('0x56')],_0x234f18['uniqueid'],md5(_0x234f18['uniqueid']));}else{_0x234f18[_0x6980('0x5a')]='';}return getConnection(_0x7548d8)[_0x6980('0x1d')](function(_0x5dc61d){_0x2c1294=_0x5dc61d;return getUser(_0x7548d8,_0x9c9ec1[_0x6980('0x5c')],_0x2c1294);})[_0x6980('0x1d')](function(_0x3a01a5){_0x44c63f=_0x3a01a5;return getEndUser(_0x7548d8,_0x19ff6d,_0x234f18['calleridname'],_0x234f18['calleridnum'],_0x2c1294);})[_0x6980('0x1d')](function(_0x43b706){_0x2900df=_0x43b706;return getTicket(_0x7548d8,_0x44c63f,_0x2900df,_0x19ff6d,_0x234f18,_0x19ff6d['Fields'],_0x2c1294,_0x6980('0x55'));})[_0x6980('0x1d')](function(_0x483bcd){_0xd56b69=_0x483bcd;logger[_0x6980('0x18')](_0x6980('0x5d'),_0xd56b69['id']);logger[_0x6980('0x18')](_0x6980('0x5e'),_0xd56b69['id'],_0x9c9ec1['name'],_0x7548d8[_0x6980('0x37')]);switch(_0x7548d8[_0x6980('0x37')]){case'integrationTab':emit(util[_0x6980('0x3f')](_0x6980('0x5f'),_0x9c9ec1[_0x6980('0x60')]),'trigger:salesforce:display',{'recordId':_0xd56b69['id']});break;case _0x6980('0x61'):emit(util[_0x6980('0x3f')]('user:%s',_0x9c9ec1[_0x6980('0x60')]),'trigger:browser:url',{'uri':util[_0x6980('0x3f')](_0x6980('0x62'),_0x2c1294['instanceUrl'],_0xd56b69['id'])});break;default:logger[_0x6980('0x63')](_0x6980('0x64'));}})[_0x6980('0x65')](function(_0x3093e0){logger[_0x6980('0x63')](_0x6980('0x66'),_0x3093e0);});};exports[_0x6980('0x67')]=function(_0x4b4d1d,_0x119c47,_0x1df4ec,_0x414370,_0x2b8b2a,_0x5eef5e,_0x4c1370){var _0x5b57da,_0x40921c,_0x2eba74,_0x37a399;_0x5eef5e[_0x6980('0x56')]=intUtil['stripTrailingSlash'](_0x5eef5e[_0x6980('0x56')]);_0x5eef5e['remoteUri']=intUtil[_0x6980('0x57')](_0x5eef5e[_0x6980('0x4f')]);if(_0x4c1370&&_0x4c1370[_0x6980('0x68')]&&_0x4c1370[_0x6980('0x68')]!==_0x6980('0x69')){logger[_0x6980('0x18')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x119c47['recordingURL']=util[_0x6980('0x3f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5eef5e[_0x6980('0x56')],_0x119c47['uniqueid'],md5(_0x119c47[_0x6980('0x6a')]));}return getConnection(_0x5eef5e)[_0x6980('0x1d')](function(_0x2fc3ad){_0x37a399=_0x2fc3ad;return getUser(_0x5eef5e,_0x414370['email'],_0x37a399);})[_0x6980('0x1d')](function(_0x532f89){_0x5b57da=_0x532f89;return getEndUser(_0x5eef5e,_0x1df4ec,_0x119c47[_0x6980('0x6b')],_0x119c47[_0x6980('0x6c')],_0x37a399);})[_0x6980('0x1d')](function(_0x2edc29){_0x40921c=_0x2edc29;return getTicket(_0x5eef5e,_0x5b57da,_0x40921c,_0x1df4ec,_0x119c47,_0x1df4ec[_0x6980('0x6d')],_0x37a399,_0x6980('0x67'));})[_0x6980('0x1d')](function(_0x2176f7){_0x2eba74=_0x2176f7;logger[_0x6980('0x18')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x2eba74['id']);logger[_0x6980('0x18')](_0x6980('0x6e'),_0x2eba74['id'],_0x414370[_0x6980('0x60')],_0x5eef5e['type']);switch(_0x5eef5e[_0x6980('0x37')]){case'integrationTab':emit(util[_0x6980('0x3f')](_0x6980('0x5f'),_0x414370[_0x6980('0x60')]),'trigger:salesforce:display',{'recordId':_0x2eba74['id']});break;case'newTab':emit(util['format']('user:%s',_0x414370['name']),'trigger:browser:url',{'uri':util[_0x6980('0x3f')]('%s/%s/e',_0x37a399[_0x6980('0x6f')],_0x2eba74['id'])});break;default:logger[_0x6980('0x63')](_0x6980('0x70'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x6980('0x65')](function(_0x204c65){logger['error']('[OUTBOUND]',_0x204c65);});};exports[_0x6980('0x71')]=function(_0x1f0602,_0x5be0f7,_0x37fb0a,_0x461419,_0x49b4fa,_0x345193){var _0xd80f56,_0x424eeb,_0x319ec3,_0x5b74f3;_0x345193['serverUrl']=intUtil['stripTrailingSlash'](_0x345193[_0x6980('0x56')]);_0x345193[_0x6980('0x4f')]=intUtil[_0x6980('0x57')](_0x345193['remoteUri']);if(_0x49b4fa&&_0x49b4fa['monitor_format']){logger[_0x6980('0x18')]('['+_0x5be0f7[_0x6980('0x72')][_0x6980('0x73')]()+']',_0x6980('0x59'));_0x5be0f7[_0x6980('0x5a')]=util[_0x6980('0x3f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x345193[_0x6980('0x56')],_0x5be0f7[_0x6980('0x6a')],md5(_0x5be0f7[_0x6980('0x6a')]));}else{_0x5be0f7[_0x6980('0x5a')]='';}return getConnection(_0x345193)[_0x6980('0x1d')](function(_0x485f51){_0x5b74f3=_0x485f51;if(!_[_0x6980('0x1b')](_0x461419)){return getUser(_0x345193,_0x461419[_0x6980('0x60')],_0x5b74f3);}else{return getUser(_0x345193,null,_0x5b74f3);}})[_0x6980('0x1d')](function(_0x3f9c44){_0xd80f56=_0x3f9c44;return getEndUser(_0x345193,_0x37fb0a,_0x5be0f7['calleridname'],_0x5be0f7[_0x6980('0x74')],_0x5b74f3);})[_0x6980('0x1d')](function(_0x268580){_0x424eeb=_0x268580;return getTicket(_0x345193,_0xd80f56,_0x424eeb,_0x37fb0a,_0x5be0f7,_0x37fb0a[_0x6980('0x6d')],_0x5b74f3);})['then'](function(_0x3bba56){_0x319ec3=_0x3bba56;logger[_0x6980('0x18')]('['+_0x5be0f7['lastevent'][_0x6980('0x73')]()+_0x6980('0x75'),_0x319ec3['id']);logger[_0x6980('0x18')]('['+_0x5be0f7[_0x6980('0x72')][_0x6980('0x73')]()+_0x6980('0x76'),_0x345193['type']);})['catch'](function(_0x467f90){logger['error']('['+_0x5be0f7[_0x6980('0x72')]['toUpperCase']()+']',_0x467f90);});}; \ 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 dae269e..dc62c05 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 _0x6e33=['info','toUpperCase','],\x20getAdminUser\x20crm','catch','message','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','active','userId','sys_id','adminId','adminEmail','],\x20getUser\x20crm','error',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','user','System','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','assign','true','getString','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','incident','Incident','Incident\x20-\x20','forEach','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','format','user:%s','emit','trigger:browser:url','username','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','%s/api/now/table/','isNil','email','outbound','destcalleridnum','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','monitor_format','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','unmanaged',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','md5','ioredis','./util','../../../../config/environment','servicenow','redis','defaults','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length'];(function(_0x59a0e4,_0x492f2c){var _0x64e2f9=function(_0x42df1e){while(--_0x42df1e){_0x59a0e4['push'](_0x59a0e4['shift']());}};_0x64e2f9(++_0x492f2c);}(_0x6e33,0xc2));var _0x36e3=function(_0x452558,_0x25b3ca){_0x452558=_0x452558-0x0;var _0x4f8006=_0x6e33[_0x452558];return _0x4f8006;};'use strict';var _=require(_0x36e3('0x0'));var Promise=require(_0x36e3('0x1'));var rp=require('request-promise');var util=require('util');var md5=require(_0x36e3('0x2'));var Redis=require(_0x36e3('0x3'));var intUtil=require(_0x36e3('0x4'));var config=require(_0x36e3('0x5'));var logger=require('../../../../config/logger')(_0x36e3('0x6'));config[_0x36e3('0x7')]=_[_0x36e3('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x36e3('0x7')]));function getAdminUser(_0x4be95a,_0x22f36f,_0x54c8ce,_0x19a5a1,_0x57fb26,_0x2f68c8){return new Promise(function(_0x19067b,_0x38c09a){var _0x3956bd={'method':_0x36e3('0x9'),'uri':_0x19a5a1+_0x36e3('0xa')+'&'+_0x57fb26+'&'+_0x2f68c8,'auth':_0x22f36f,'json':!![]};return rp(_0x3956bd)[_0x36e3('0xb')](function(_0x5a9e1f){if(_0x5a9e1f[_0x36e3('0xc')][_0x36e3('0xd')]>0x0){_0x54c8ce['adminId']=_0x5a9e1f[_0x36e3('0xc')][0x0]['sys_id'];}logger[_0x36e3('0xe')]('['+[_0x4be95a[_0x36e3('0xf')]()]+_0x36e3('0x10'),_0x54c8ce);_0x19067b(_0x54c8ce);})[_0x36e3('0x11')](function(_0x1e9390){logger['error']('['+[_0x4be95a[_0x36e3('0xf')]()]+']',_0x1e9390[_0x36e3('0x12')]);_0x38c09a(_0x1e9390[_0x36e3('0x12')]);});});}function getUser(_0x574df8,_0xec0691,_0x407faf,_0x331e77,_0x1dd421){return function(_0xdb5ace){logger[_0x36e3('0xe')]('['+[_0x574df8[_0x36e3('0xf')]()]+'],\x20getUser\x20input\x20crm',_0xdb5ace);return new Promise(function(_0x3d9f68,_0x1be976){if(intUtil['validateEmail'](_0xdb5ace[_0x36e3('0x13')])){var _0x2bcf35={'method':_0x36e3('0x9'),'uri':_0x407faf+_0x36e3('0x14')+_0xdb5ace[_0x36e3('0x13')]+'&'+_0x331e77+'&'+_0x1dd421,'auth':_0xec0691,'json':!![]};logger[_0x36e3('0xe')]('['+[_0x574df8[_0x36e3('0xf')]()]+_0x36e3('0x15'),_0x2bcf35);return rp(_0x2bcf35)[_0x36e3('0xb')](function(_0x1a6c7c){logger[_0x36e3('0xe')]('['+[_0x574df8[_0x36e3('0xf')]()]+'],\x20getUser\x20entity',_0x1a6c7c);if(_0x1a6c7c[_0x36e3('0xc')][_0x36e3('0xd')]>0x0&&String(_0x1a6c7c[_0x36e3('0xc')][0x0][_0x36e3('0x16')])==='true'){_0xdb5ace[_0x36e3('0x17')]=_0x1a6c7c[_0x36e3('0xc')][0x0][_0x36e3('0x18')];}else{_0xdb5ace[_0x36e3('0x17')]=_0xdb5ace[_0x36e3('0x19')];_0xdb5ace[_0x36e3('0x13')]=_0xdb5ace[_0x36e3('0x1a')];}logger[_0x36e3('0xe')]('['+[_0x574df8[_0x36e3('0xf')]()]+_0x36e3('0x1b'),_0xdb5ace);_0x3d9f68(_0xdb5ace);})[_0x36e3('0x11')](function(_0x4e3dd3){logger[_0x36e3('0x1c')]('['+[_0x574df8[_0x36e3('0xf')]()]+']',_0x4e3dd3[_0x36e3('0x12')]);_0x1be976(_0x4e3dd3[_0x36e3('0x12')]);});}else{logger[_0x36e3('0xe')]('['+[_0x574df8[_0x36e3('0xf')]()]+_0x36e3('0x1d'));_0xdb5ace[_0x36e3('0x17')]=_0xdb5ace[_0x36e3('0x19')];_0xdb5ace[_0x36e3('0x13')]=_0xdb5ace['adminEmail'];_0x3d9f68(_0xdb5ace);}});};}function createEndUser(_0x32b06d,_0x61b9f1,_0x4b62c8,_0x47bb54,_0xfeb8b3){logger[_0x36e3('0xe')]('['+[_0x32b06d[_0x36e3('0xf')]()]+_0x36e3('0x1e'),_0x4b62c8);return new Promise(function(_0x588539,_0x17e0af){var _0x3396c3={'method':_0x36e3('0x1f'),'uri':_0x47bb54+'sys_user?'+_0xfeb8b3,'body':{'user_name':_0x4b62c8[_0x36e3('0x20')],'roles':_0x36e3('0x21'),'first_name':_0x4b62c8['endUserNumber'],'active':'true','date_format':_0x36e3('0x22'),'phone':_0x4b62c8[_0x36e3('0x20')]},'auth':_0x61b9f1,'json':!![]};return rp(_0x3396c3)['then'](function(_0x3e2b5d){logger['info']('['+[_0x32b06d['toUpperCase']()]+'],\x20EndUser\x20schema',_0x3e2b5d[_0x36e3('0xc')]);_0x4b62c8[_0x36e3('0x23')]=_0x3e2b5d['result'][_0x36e3('0x18')];_0x588539(_0x4b62c8);})['catch'](function(_0x6cada){logger[_0x36e3('0x1c')]('['+[_0x32b06d[_0x36e3('0xf')]()]+']',_0x6cada[_0x36e3('0x12')]);_0x17e0af(_0x6cada[_0x36e3('0x12')]);});});}function getEndUser(_0x18aa66,_0x5382bb,_0x4a814f,_0x3268c3,_0x131e9a){return function(_0x1e5b27){logger[_0x36e3('0xe')]('['+[_0x18aa66[_0x36e3('0xf')]()]+'],\x20getEndUser\x20input\x20crm',_0x1e5b27);return new Promise(function(_0x2d930d,_0x5a85c9){var _0x334d37={'method':'GET','uri':_0x4a814f+_0x36e3('0x24')+_0x1e5b27[_0x36e3('0x20')]+'&'+_0x3268c3+'&'+_0x131e9a,'auth':_0x5382bb,'json':!![]};return rp(_0x334d37)[_0x36e3('0xb')](function(_0x1db7b8){if(_0x1db7b8[_0x36e3('0xc')]['length']>0x0){_0x1e5b27[_0x36e3('0x23')]=_0x1db7b8['result'][0x0][_0x36e3('0x18')];logger[_0x36e3('0xe')]('['+[_0x18aa66['toUpperCase']()]+_0x36e3('0x25'),_0x1e5b27);_0x2d930d(_0x1e5b27);}else{return createEndUser(_0x18aa66,_0x5382bb,_0x1e5b27,_0x4a814f,_0x3268c3)[_0x36e3('0xb')](function(_0x505182){logger[_0x36e3('0xe')]('['+[_0x18aa66[_0x36e3('0xf')]()]+_0x36e3('0x26'),_0x505182);_0x2d930d(_0x505182);});}})[_0x36e3('0x11')](function(_0x56fac8){logger[_0x36e3('0x1c')]('['+[_0x18aa66['toUpperCase']()]+']',_0x56fac8[_0x36e3('0x12')]);_0x5a85c9(_0x56fac8[_0x36e3('0x12')]);});});};}function getCustomFields(_0x22ed2e,_0x4e3b3b){var _0x452c93={};if(_0x22ed2e['length']>0x0){_['forEach'](_0x22ed2e,function(_0x40d1f2){if(_[_0x36e3('0x27')]([_0x36e3('0x28'),_0x36e3('0x29')],_0x40d1f2[_0x36e3('0x2a')])&&_0x40d1f2[_0x36e3('0x2b')]&&!_0x40d1f2[_0x36e3('0x2c')]){_0x452c93[_0x40d1f2[_0x36e3('0x2b')][_0x36e3('0x2d')]()]=_0x40d1f2[_0x36e3('0x2e')][_0x36e3('0x2f')]();}else if(_['includes']([_0x36e3('0x28'),'picklist'],_0x40d1f2[_0x36e3('0x2a')])&&_0x40d1f2[_0x36e3('0x30')]&&_0x40d1f2[_0x36e3('0x2c')]){_0x452c93[_0x40d1f2[_0x36e3('0x30')][_0x36e3('0x2d')]()]=_0x40d1f2[_0x36e3('0x2e')][_0x36e3('0x2f')]();}else if(_0x40d1f2[_0x36e3('0x2a')]===_0x36e3('0x31')&&_0x40d1f2[_0x36e3('0x32')]&&_0x40d1f2[_0x36e3('0x30')]&&_0x40d1f2[_0x36e3('0x2c')]){_0x452c93[_0x40d1f2[_0x36e3('0x30')]['toLowerCase']()]=_0x4e3b3b[_0x40d1f2['variableName']]['toString']();}else if(_0x40d1f2[_0x36e3('0x2a')]===_0x36e3('0x33')&&_0x40d1f2[_0x36e3('0x34')]&&_0x40d1f2[_0x36e3('0x34')][_0x36e3('0x35')]&&_0x40d1f2['idField']&&_0x40d1f2[_0x36e3('0x2c')]){_0x452c93[_0x40d1f2[_0x36e3('0x30')][_0x36e3('0x2d')]()]=_0x4e3b3b[_0x40d1f2['Variable']['name'][_0x36e3('0x2d')]()][_0x36e3('0x2f')]();}});}return _0x452c93;}function getTicket(_0x4c8bad,_0x5d3a8f,_0x389fca,_0xe1e97f,_0x4951f,_0x5b870e){return function(_0x514c07){logger[_0x36e3('0xe')]('['+[_0x4c8bad[_0x36e3('0xf')]()]+_0x36e3('0x36'),_0x514c07);return new Promise(function(_0x400141,_0x2e1a43){var _0x5cb1d1=_0x4c8bad['toLowerCase']()==='outbound'?_0x514c07[_0x36e3('0x17')]:_0x514c07[_0x36e3('0x23')];var _0x57ca07={'method':_0x36e3('0x1f'),'uri':_0x389fca+'incident'+'?'+_0x5b870e,'body':Object[_0x36e3('0x37')]({},{'active':_0x36e3('0x38'),'caller_id':_0x5cb1d1,'assigned_to':_0x514c07[_0x36e3('0x17')],'short_description':intUtil[_0x36e3('0x39')](_0xe1e97f['Subjects'],_0x4951f,'\x20'),'description':intUtil[_0x36e3('0x39')](_0xe1e97f['Descriptions'],_0x4951f,'\x0a')},getCustomFields(_0xe1e97f[_0x36e3('0x3a')],_0x4951f)),'auth':_0x5d3a8f,'json':!![]};return rp(_0x57ca07)[_0x36e3('0xb')](function(_0x4b837c){logger[_0x36e3('0xe')]('['+[_0x4c8bad[_0x36e3('0xf')]()]+_0x36e3('0x3b'),_0x4b837c['result']);_0x514c07[_0x36e3('0x3c')]=_0x4b837c[_0x36e3('0xc')][_0x36e3('0x18')];_0x514c07[_0x36e3('0x3d')]=_0x4b837c['result'][_0x36e3('0x3e')];logger[_0x36e3('0xe')]('['+[_0x4c8bad[_0x36e3('0xf')]()]+_0x36e3('0x3f'),_0x514c07);_0x400141(_0x514c07);})[_0x36e3('0x11')](function(_0x5d77c8){logger[_0x36e3('0x1c')]('['+[_0x4c8bad[_0x36e3('0xf')]()]+']',_0x5d77c8[_0x36e3('0x12')]);_0x2e1a43(_0x5d77c8['message']);});});};}function createRemoteTag(_0x3ee4cb,_0x3dba61,_0x1b6400,_0x4a8c31){return new Promise(function(_0x2dbd71,_0xfecece){var _0xef9a38={'method':'POST','uri':_0x1b6400+'label'+'?'+_0x4a8c31,'body':{'short_description':_0x3ee4cb,'global':!![],'active':!![],'name':_0x3ee4cb},'auth':_0x3dba61,'json':!![]};return rp(_0xef9a38)['then'](function(_0x47cc5d){var _0x53ac3c=_0x47cc5d[_0x36e3('0xc')][_0x36e3('0x18')];_0x2dbd71(_0x53ac3c);});});}function getRemoteTag(_0x7e3f27,_0x16ae9c,_0x53440f,_0x5422b5,_0x392de5){return new Promise(function(_0x5c85c9,_0x3cc2ff){var _0x171f7f={'method':_0x36e3('0x9'),'uri':_0x53440f+_0x36e3('0x40')+_0x36e3('0x41')+_0x7e3f27+'&'+_0x5422b5,'auth':_0x16ae9c,'json':!![]};return rp(_0x171f7f)[_0x36e3('0xb')](function(_0x40a80c){if(_0x40a80c['result']['length']>0x0){var _0x48399a=_0x40a80c[_0x36e3('0xc')][0x0][_0x36e3('0x18')];_0x5c85c9(_0x48399a);}else{return createRemoteTag(_0x7e3f27,_0x16ae9c,_0x53440f,_0x5422b5)[_0x36e3('0xb')](function(_0x534de7){_0x5c85c9(_0x534de7);});}});});}function assignTagToIncident(_0x3d3934,_0xb64316,_0x2c55da,_0x30a097,_0x459de7){return new Promise(function(_0x148dd3,_0x18a639){var _0x2760a9={'method':'POST','uri':_0x2c55da+_0x36e3('0x42')+'?'+_0x459de7,'body':{'label':_0x3d3934,'table':_0x36e3('0x43'),'id_type':_0x36e3('0x44'),'table_key':_0x30a097[_0x36e3('0x3c')],'title':_0x36e3('0x45')+_0x30a097['ticketNumber'],'id_display':_0x30a097[_0x36e3('0x3d')]},'auth':_0xb64316,'json':!![]};return rp(_0x2760a9)[_0x36e3('0xb')](function(_0x356c31){_0x148dd3();})['catch'](function(){_0x148dd3();});});}function manageTags(_0x2c6760,_0x57ff12,_0x3dcf57,_0x58d6f9,_0x36833a,_0x2bb374,_0xc598f5){return new Promise(function(_0x5a2204,_0x360106){var _0x3f6499=[];_0x57ff12[_0x36e3('0x46')](function(_0x35fd46){_0x3f6499[_0x36e3('0x47')](getRemoteTag(_0x35fd46,_0x3dcf57,_0x58d6f9,_0x2bb374,_0xc598f5));});return Promise[_0x36e3('0x48')](_0x3f6499)[_0x36e3('0xb')](function(_0x955c1d){if(_0x955c1d[_0x36e3('0xd')]){logger[_0x36e3('0xe')]('['+[_0x2c6760['toUpperCase']()]+_0x36e3('0x49'),_0x955c1d);var _0x116852=[];_0x955c1d[_0x36e3('0x46')](function(_0x237e6b){_0x116852[_0x36e3('0x47')](assignTagToIncident(_0x237e6b,_0x3dcf57,_0x58d6f9,_0x36833a,_0x2bb374));});return Promise[_0x36e3('0x48')](_0x116852)[_0x36e3('0xb')](function(){_0x5a2204();})[_0x36e3('0x11')](function(){_0x5a2204();});}else{_0x5a2204();}});});}function getTags(_0x250dc8,_0x3b201c,_0x314fb7,_0x1572e7,_0x23237a,_0x369c35){return function(_0x4a58b3){return new Promise(function(_0x1de43d,_0x12498b){var _0x17d70f=[];var _0x951797=_0x1572e7[_0x36e3('0x4a')];if(_0x951797&&_0x951797[_0x36e3('0xd')]>0x0){_0x17d70f=_[_0x36e3('0x4b')](_0x951797,_0x36e3('0x35'));}if(_0x17d70f[_0x36e3('0xd')]>0x0){return manageTags(_0x250dc8,_0x17d70f,_0x3b201c,_0x314fb7,_0x4a58b3,_0x23237a,_0x369c35)[_0x36e3('0xb')](function(){_0x1de43d(_0x4a58b3);});}else{_0x1de43d(_0x4a58b3);}});};}function emit(_0x4fa3c1,_0x439e46,_0x2eff31){var _0x4350f7=_0x36e3('0x4c')+_0x36e3('0x4d')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x36e3('0x4e');var _0x2fceb7={'uri':_0x4fa3c1+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x2eff31+_0x4350f7};io['to'](util[_0x36e3('0x4f')](_0x36e3('0x50'),_0x439e46))[_0x36e3('0x51')](_0x36e3('0x52'),_0x2fceb7);}exports['cs']=function(_0x219638,_0x1d7857,_0x40590f,_0x43814f,_0x598a4c,_0x4cff97,_0x213f09,_0x4d01be){var _0x795c2c={};var _0x468d4b={'user':_0x4cff97[_0x36e3('0x53')],'pass':_0x4cff97[_0x36e3('0x54')]};var _0x175317='sysparm_limit=1';var _0x2b3514=_0x36e3('0x55');_0x4cff97[_0x36e3('0x56')]=intUtil[_0x36e3('0x57')](_0x4cff97[_0x36e3('0x56')]);_0x4cff97['serverUrl']=intUtil['stripTrailingSlash'](_0x4cff97['serverUrl']);var _0x478f29=util[_0x36e3('0x4f')](_0x36e3('0x58'),_0x4cff97['remoteUri']);_0x795c2c['userEmail']=!_[_0x36e3('0x59')](_0x43814f)?_0x43814f[_0x36e3('0x5a')]:null;_0x795c2c['adminEmail']=_0x4cff97['email'];_0x795c2c[_0x36e3('0x20')]=_0x4d01be['toLowerCase']()===_0x36e3('0x5b')?_0x1d7857[_0x36e3('0x5c')]:_0x1d7857['calleridnum'];_0x795c2c['callDirection']=_0x4d01be==='queue'||_0x4d01be==='unmanaged'?'queue':_0x36e3('0x5b');var _0x49f49c=util['format'](_0x36e3('0x5d'),_0x4cff97[_0x36e3('0x5e')],_0x1d7857[_0x36e3('0x5f')],md5(_0x1d7857[_0x36e3('0x5f')]));if(_0x598a4c&&_0x598a4c[_0x36e3('0x60')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x1d7857['recordingURL']=_0x49f49c;}else if(_0x213f09&&_0x213f09[_0x36e3('0x61')]&&_0x213f09['recordingFormat']!=='none'){logger[_0x36e3('0xe')](_0x36e3('0x62'),_0x36e3('0x63'));_0x1d7857['recordingURL']=_0x49f49c;}else{_0x1d7857['recordingURL']='';}return getAdminUser(_0x4d01be,_0x468d4b,_0x795c2c,_0x478f29,_0x2b3514,_0x175317)[_0x36e3('0xb')](getUser(_0x4d01be,_0x468d4b,_0x478f29,_0x2b3514,_0x175317))[_0x36e3('0xb')](getEndUser(_0x4d01be,_0x468d4b,_0x478f29,_0x2b3514,_0x175317))[_0x36e3('0xb')](getTicket(_0x4d01be,_0x468d4b,_0x478f29,_0x40590f,_0x1d7857,_0x2b3514))['then'](function(_0x10b265){logger[_0x36e3('0xe')](util[_0x36e3('0x4f')](_0x36e3('0x64'),_0x10b265[_0x36e3('0x3c')]));logger[_0x36e3('0xe')](util['format'](_0x36e3('0x65'),_0x4d01be));if(_0x4d01be!==_0x36e3('0x66')){logger[_0x36e3('0xe')]('['+[_0x4d01be[_0x36e3('0xf')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x4cff97[_0x36e3('0x56')],_0x43814f['name'],_0x10b265[_0x36e3('0x3c')]);}})[_0x36e3('0x11')](function(_0x3a81ff){logger['error']('['+[_0x4d01be['toUpperCase']()]+_0x36e3('0x67'),util['inspect'](_0x3a81ff,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xc2e0=['active','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D','length','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','toString','string','idField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','POST','assign','true','Subjects','getString','Descriptions','Fields','ticketId','number',']\x20getTicket\x20crm','label','incident','Incident','Incident\x20-\x20','ticketNumber','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','inspect','lodash','bluebird','request-promise','util','md5','ioredis','./util','servicenow','defaults','redis','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj'];(function(_0x48cc71,_0x142437){var _0x3e879e=function(_0x3c5e61){while(--_0x3c5e61){_0x48cc71['push'](_0x48cc71['shift']());}};_0x3e879e(++_0x142437);}(_0xc2e0,0x1a8));var _0x0c2e=function(_0x249033,_0x3a1b9b){_0x249033=_0x249033-0x0;var _0x34ea3f=_0xc2e0[_0x249033];return _0x34ea3f;};'use strict';var _=require(_0x0c2e('0x0'));var Promise=require(_0x0c2e('0x1'));var rp=require(_0x0c2e('0x2'));var util=require(_0x0c2e('0x3'));var md5=require(_0x0c2e('0x4'));var Redis=require(_0x0c2e('0x5'));var intUtil=require(_0x0c2e('0x6'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x0c2e('0x7'));config['redis']=_[_0x0c2e('0x8')](config[_0x0c2e('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x0c2e('0xa'))(new Redis(config[_0x0c2e('0x9')]));function getAdminUser(_0x52b8f6,_0x35aa47,_0x48ba05,_0x1ea1f5,_0xa26bac,_0x5b92e6){return new Promise(function(_0x226d21,_0x4953c0){var _0x418729={'method':_0x0c2e('0xb'),'uri':_0x1ea1f5+_0x0c2e('0xc')+'&'+_0xa26bac+'&'+_0x5b92e6,'auth':_0x35aa47,'json':!![]};return rp(_0x418729)[_0x0c2e('0xd')](function(_0x25575e){if(_0x25575e[_0x0c2e('0xe')]['length']>0x0){_0x48ba05[_0x0c2e('0xf')]=_0x25575e[_0x0c2e('0xe')][0x0][_0x0c2e('0x10')];}logger[_0x0c2e('0x11')]('['+[_0x52b8f6[_0x0c2e('0x12')]()]+_0x0c2e('0x13'),_0x48ba05);_0x226d21(_0x48ba05);})[_0x0c2e('0x14')](function(_0x546f15){logger[_0x0c2e('0x15')]('['+[_0x52b8f6[_0x0c2e('0x12')]()]+']',_0x546f15['message']);_0x4953c0(_0x546f15[_0x0c2e('0x16')]);});});}function getUser(_0x16b4fe,_0x298120,_0x5dd7cb,_0x19cc24,_0x43d6a7){return function(_0x54b7a0){logger[_0x0c2e('0x11')]('['+[_0x16b4fe['toUpperCase']()]+_0x0c2e('0x17'),_0x54b7a0);return new Promise(function(_0x56e0ea,_0x389b9a){if(intUtil[_0x0c2e('0x18')](_0x54b7a0[_0x0c2e('0x19')])){var _0x3ec68c={'method':_0x0c2e('0xb'),'uri':_0x5dd7cb+_0x0c2e('0x1a')+_0x54b7a0[_0x0c2e('0x19')]+'&'+_0x19cc24+'&'+_0x43d6a7,'auth':_0x298120,'json':!![]};logger[_0x0c2e('0x11')]('['+[_0x16b4fe[_0x0c2e('0x12')]()]+_0x0c2e('0x1b'),_0x3ec68c);return rp(_0x3ec68c)['then'](function(_0x49989b){logger[_0x0c2e('0x11')]('['+[_0x16b4fe[_0x0c2e('0x12')]()]+'],\x20getUser\x20entity',_0x49989b);if(_0x49989b[_0x0c2e('0xe')]['length']>0x0&&String(_0x49989b[_0x0c2e('0xe')][0x0][_0x0c2e('0x1c')])==='true'){_0x54b7a0[_0x0c2e('0x1d')]=_0x49989b['result'][0x0][_0x0c2e('0x10')];}else{_0x54b7a0[_0x0c2e('0x1d')]=_0x54b7a0[_0x0c2e('0xf')];_0x54b7a0[_0x0c2e('0x19')]=_0x54b7a0[_0x0c2e('0x1e')];}logger[_0x0c2e('0x11')]('['+[_0x16b4fe[_0x0c2e('0x12')]()]+_0x0c2e('0x1f'),_0x54b7a0);_0x56e0ea(_0x54b7a0);})['catch'](function(_0x104a52){logger[_0x0c2e('0x15')]('['+[_0x16b4fe[_0x0c2e('0x12')]()]+']',_0x104a52[_0x0c2e('0x16')]);_0x389b9a(_0x104a52['message']);});}else{logger[_0x0c2e('0x11')]('['+[_0x16b4fe[_0x0c2e('0x12')]()]+_0x0c2e('0x20'));_0x54b7a0['userId']=_0x54b7a0['adminId'];_0x54b7a0[_0x0c2e('0x19')]=_0x54b7a0[_0x0c2e('0x1e')];_0x56e0ea(_0x54b7a0);}});};}function createEndUser(_0x292b3e,_0x396f83,_0xd704d7,_0x12ed44,_0x56f9b5){logger[_0x0c2e('0x11')]('['+[_0x292b3e['toUpperCase']()]+_0x0c2e('0x21'),_0xd704d7);return new Promise(function(_0x1534c9,_0x2ae7dc){var _0x32adff={'method':'POST','uri':_0x12ed44+'sys_user?'+_0x56f9b5,'body':{'user_name':_0xd704d7[_0x0c2e('0x22')],'roles':_0x0c2e('0x23'),'first_name':_0xd704d7[_0x0c2e('0x22')],'active':'true','date_format':_0x0c2e('0x24'),'phone':_0xd704d7[_0x0c2e('0x22')]},'auth':_0x396f83,'json':!![]};return rp(_0x32adff)[_0x0c2e('0xd')](function(_0x58495b){logger[_0x0c2e('0x11')]('['+[_0x292b3e[_0x0c2e('0x12')]()]+_0x0c2e('0x25'),_0x58495b[_0x0c2e('0xe')]);_0xd704d7[_0x0c2e('0x26')]=_0x58495b[_0x0c2e('0xe')][_0x0c2e('0x10')];_0x1534c9(_0xd704d7);})['catch'](function(_0x55f3c4){logger[_0x0c2e('0x15')]('['+[_0x292b3e[_0x0c2e('0x12')]()]+']',_0x55f3c4[_0x0c2e('0x16')]);_0x2ae7dc(_0x55f3c4['message']);});});}function getEndUser(_0x361f3c,_0x5b23c1,_0x595912,_0xdd8adc,_0x226c76){return function(_0x499bf9){logger['info']('['+[_0x361f3c[_0x0c2e('0x12')]()]+'],\x20getEndUser\x20input\x20crm',_0x499bf9);return new Promise(function(_0x25925e,_0x55e8c4){var _0x3d75f3={'method':_0x0c2e('0xb'),'uri':_0x595912+_0x0c2e('0x27')+_0x499bf9['endUserNumber']+'&'+_0xdd8adc+'&'+_0x226c76,'auth':_0x5b23c1,'json':!![]};return rp(_0x3d75f3)[_0x0c2e('0xd')](function(_0x565a8e){if(_0x565a8e[_0x0c2e('0xe')][_0x0c2e('0x28')]>0x0){_0x499bf9[_0x0c2e('0x26')]=_0x565a8e['result'][0x0][_0x0c2e('0x10')];logger[_0x0c2e('0x11')]('['+[_0x361f3c[_0x0c2e('0x12')]()]+_0x0c2e('0x29'),_0x499bf9);_0x25925e(_0x499bf9);}else{return createEndUser(_0x361f3c,_0x5b23c1,_0x499bf9,_0x595912,_0xdd8adc)[_0x0c2e('0xd')](function(_0x7935b2){logger[_0x0c2e('0x11')]('['+[_0x361f3c['toUpperCase']()]+_0x0c2e('0x2a'),_0x7935b2);_0x25925e(_0x7935b2);});}})[_0x0c2e('0x14')](function(_0x59aa0c){logger[_0x0c2e('0x15')]('['+[_0x361f3c['toUpperCase']()]+']',_0x59aa0c[_0x0c2e('0x16')]);_0x55e8c4(_0x59aa0c[_0x0c2e('0x16')]);});});};}function getCustomFields(_0x263d30,_0x3a4c11){var _0x2c628e={};if(_0x263d30[_0x0c2e('0x28')]>0x0){_[_0x0c2e('0x2b')](_0x263d30,function(_0xc9e91f){if(_[_0x0c2e('0x2c')](['string',_0x0c2e('0x2d')],_0xc9e91f[_0x0c2e('0x2e')])&&_0xc9e91f[_0x0c2e('0x2f')]&&!_0xc9e91f[_0x0c2e('0x30')]){_0x2c628e[_0xc9e91f[_0x0c2e('0x2f')][_0x0c2e('0x31')]()]=_0xc9e91f[_0x0c2e('0x32')][_0x0c2e('0x33')]();}else if(_[_0x0c2e('0x2c')]([_0x0c2e('0x34'),_0x0c2e('0x2d')],_0xc9e91f[_0x0c2e('0x2e')])&&_0xc9e91f[_0x0c2e('0x35')]&&_0xc9e91f['customField']){_0x2c628e[_0xc9e91f[_0x0c2e('0x35')][_0x0c2e('0x31')]()]=_0xc9e91f[_0x0c2e('0x32')]['toString']();}else if(_0xc9e91f['type']===_0x0c2e('0x36')&&_0xc9e91f['variableName']&&_0xc9e91f['idField']&&_0xc9e91f[_0x0c2e('0x30')]){_0x2c628e[_0xc9e91f[_0x0c2e('0x35')]['toLowerCase']()]=_0x3a4c11[_0xc9e91f[_0x0c2e('0x37')]]['toString']();}else if(_0xc9e91f['type']===_0x0c2e('0x38')&&_0xc9e91f[_0x0c2e('0x39')]&&_0xc9e91f[_0x0c2e('0x39')][_0x0c2e('0x3a')]&&_0xc9e91f[_0x0c2e('0x35')]&&_0xc9e91f[_0x0c2e('0x30')]){_0x2c628e[_0xc9e91f[_0x0c2e('0x35')]['toLowerCase']()]=_0x3a4c11[_0xc9e91f[_0x0c2e('0x39')][_0x0c2e('0x3a')][_0x0c2e('0x31')]()][_0x0c2e('0x33')]();}});}return _0x2c628e;}function getTicket(_0x59a0d5,_0x510f03,_0xc87e8a,_0x2de66c,_0x27c88e,_0x3b16d4){return function(_0x490f8f){logger[_0x0c2e('0x11')]('['+[_0x59a0d5[_0x0c2e('0x12')]()]+_0x0c2e('0x3b'),_0x490f8f);return new Promise(function(_0x5e096c,_0x2310e5){var _0x1fe3ad=_0x59a0d5[_0x0c2e('0x31')]()===_0x0c2e('0x3c')?_0x490f8f[_0x0c2e('0x1d')]:_0x490f8f['endUserId'];var _0x4be3ae={'method':_0x0c2e('0x3d'),'uri':_0xc87e8a+'incident'+'?'+_0x3b16d4,'body':Object[_0x0c2e('0x3e')]({},{'active':_0x0c2e('0x3f'),'caller_id':_0x1fe3ad,'assigned_to':_0x490f8f[_0x0c2e('0x1d')],'short_description':intUtil['getString'](_0x2de66c[_0x0c2e('0x40')],_0x27c88e,'\x20'),'description':intUtil[_0x0c2e('0x41')](_0x2de66c[_0x0c2e('0x42')],_0x27c88e,'\x0a')},getCustomFields(_0x2de66c[_0x0c2e('0x43')],_0x27c88e)),'auth':_0x510f03,'json':!![]};return rp(_0x4be3ae)[_0x0c2e('0xd')](function(_0x536a17){logger[_0x0c2e('0x11')]('['+[_0x59a0d5[_0x0c2e('0x12')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x536a17[_0x0c2e('0xe')]);_0x490f8f[_0x0c2e('0x44')]=_0x536a17['result'][_0x0c2e('0x10')];_0x490f8f['ticketNumber']=_0x536a17[_0x0c2e('0xe')][_0x0c2e('0x45')];logger[_0x0c2e('0x11')]('['+[_0x59a0d5['toUpperCase']()]+_0x0c2e('0x46'),_0x490f8f);_0x5e096c(_0x490f8f);})[_0x0c2e('0x14')](function(_0x41dfc1){logger[_0x0c2e('0x15')]('['+[_0x59a0d5['toUpperCase']()]+']',_0x41dfc1[_0x0c2e('0x16')]);_0x2310e5(_0x41dfc1[_0x0c2e('0x16')]);});});};}function createRemoteTag(_0x52d934,_0xed7476,_0x38e308,_0x1e99ee){return new Promise(function(_0x423eec,_0x473636){var _0x56ebbc={'method':_0x0c2e('0x3d'),'uri':_0x38e308+_0x0c2e('0x47')+'?'+_0x1e99ee,'body':{'short_description':_0x52d934,'global':!![],'active':!![],'name':_0x52d934},'auth':_0xed7476,'json':!![]};return rp(_0x56ebbc)[_0x0c2e('0xd')](function(_0x5d75f6){var _0xfbeb74=_0x5d75f6[_0x0c2e('0xe')][_0x0c2e('0x10')];_0x423eec(_0xfbeb74);});});}function getRemoteTag(_0x1ba95d,_0x226cef,_0x281b75,_0x21f8ad,_0x489c96){return new Promise(function(_0x3892d8,_0x1a609f){var _0x298832={'method':_0x0c2e('0xb'),'uri':_0x281b75+_0x0c2e('0x47')+'?sysparm_query=name%3D'+_0x1ba95d+'&'+_0x21f8ad,'auth':_0x226cef,'json':!![]};return rp(_0x298832)[_0x0c2e('0xd')](function(_0x1016ad){if(_0x1016ad[_0x0c2e('0xe')][_0x0c2e('0x28')]>0x0){var _0x565187=_0x1016ad[_0x0c2e('0xe')][0x0]['sys_id'];_0x3892d8(_0x565187);}else{return createRemoteTag(_0x1ba95d,_0x226cef,_0x281b75,_0x21f8ad)[_0x0c2e('0xd')](function(_0xb76ad){_0x3892d8(_0xb76ad);});}});});}function assignTagToIncident(_0x53a2d1,_0x6fdbd6,_0x46923c,_0x139db7,_0x2a8dd6){return new Promise(function(_0xb48f91,_0x43efa5){var _0x206494={'method':_0x0c2e('0x3d'),'uri':_0x46923c+'label_entry'+'?'+_0x2a8dd6,'body':{'label':_0x53a2d1,'table':_0x0c2e('0x48'),'id_type':_0x0c2e('0x49'),'table_key':_0x139db7[_0x0c2e('0x44')],'title':_0x0c2e('0x4a')+_0x139db7[_0x0c2e('0x4b')],'id_display':_0x139db7[_0x0c2e('0x4b')]},'auth':_0x6fdbd6,'json':!![]};return rp(_0x206494)[_0x0c2e('0xd')](function(_0x4c8c3d){_0xb48f91();})[_0x0c2e('0x14')](function(){_0xb48f91();});});}function manageTags(_0x519b77,_0x27104e,_0x7a90bc,_0x57753d,_0x1a8d5c,_0x43265b,_0x5c94f8){return new Promise(function(_0x3005a6,_0xee9fa0){var _0x2c5037=[];_0x27104e[_0x0c2e('0x2b')](function(_0x42b859){_0x2c5037[_0x0c2e('0x4c')](getRemoteTag(_0x42b859,_0x7a90bc,_0x57753d,_0x43265b,_0x5c94f8));});return Promise['all'](_0x2c5037)[_0x0c2e('0xd')](function(_0x488bb6){if(_0x488bb6[_0x0c2e('0x28')]){logger['info']('['+[_0x519b77[_0x0c2e('0x12')]()]+_0x0c2e('0x4d'),_0x488bb6);var _0x53699c=[];_0x488bb6['forEach'](function(_0x5aace0){_0x53699c[_0x0c2e('0x4c')](assignTagToIncident(_0x5aace0,_0x7a90bc,_0x57753d,_0x1a8d5c,_0x43265b));});return Promise[_0x0c2e('0x4e')](_0x53699c)[_0x0c2e('0xd')](function(){_0x3005a6();})[_0x0c2e('0x14')](function(){_0x3005a6();});}else{_0x3005a6();}});});}function getTags(_0x13c28f,_0x3c8c94,_0x157d1c,_0x5db3dd,_0x56d03c,_0x372597){return function(_0xae01b0){return new Promise(function(_0x2e6475,_0x1fc9ca){var _0x1474ca=[];var _0x432707=_0x5db3dd[_0x0c2e('0x4f')];if(_0x432707&&_0x432707[_0x0c2e('0x28')]>0x0){_0x1474ca=_[_0x0c2e('0x50')](_0x432707,_0x0c2e('0x3a'));}if(_0x1474ca[_0x0c2e('0x28')]>0x0){return manageTags(_0x13c28f,_0x1474ca,_0x3c8c94,_0x157d1c,_0xae01b0,_0x56d03c,_0x372597)[_0x0c2e('0xd')](function(){_0x2e6475(_0xae01b0);});}else{_0x2e6475(_0xae01b0);}});};}function emit(_0x68c41b,_0xab8d88,_0x238701){var _0x342c0e=_0x0c2e('0x51')+_0x0c2e('0x52')+'%26sysparm_record_list%3Dactive%253Dtrue'+'%255EORDERBYDESCnumber';var _0x4799bb={'uri':_0x68c41b+_0x0c2e('0x53')+_0x238701+_0x342c0e};io['to'](util[_0x0c2e('0x54')](_0x0c2e('0x55'),_0xab8d88))[_0x0c2e('0x56')](_0x0c2e('0x57'),_0x4799bb);}exports['cs']=function(_0x575eca,_0x44d2c9,_0x4241a8,_0x4cc10f,_0x55ee50,_0x33245c,_0x12898e,_0x3c8d81){var _0x330efc={};var _0xae53d3={'user':_0x33245c[_0x0c2e('0x58')],'pass':_0x33245c[_0x0c2e('0x59')]};var _0x1cb154=_0x0c2e('0x5a');var _0x15dd33='sysparm_display_value=true';_0x33245c[_0x0c2e('0x5b')]=intUtil[_0x0c2e('0x5c')](_0x33245c['remoteUri']);_0x33245c[_0x0c2e('0x5d')]=intUtil[_0x0c2e('0x5c')](_0x33245c[_0x0c2e('0x5d')]);var _0x1d98fd=util[_0x0c2e('0x54')](_0x0c2e('0x5e'),_0x33245c[_0x0c2e('0x5b')]);_0x330efc['userEmail']=!_[_0x0c2e('0x5f')](_0x4cc10f)?_0x4cc10f['email']:null;_0x330efc[_0x0c2e('0x1e')]=_0x33245c[_0x0c2e('0x60')];_0x330efc[_0x0c2e('0x22')]=_0x3c8d81['toLowerCase']()==='outbound'?_0x44d2c9[_0x0c2e('0x61')]:_0x44d2c9[_0x0c2e('0x62')];_0x330efc[_0x0c2e('0x63')]=_0x3c8d81===_0x0c2e('0x64')||_0x3c8d81===_0x0c2e('0x65')?'queue':'outbound';var _0x2ac363=util[_0x0c2e('0x54')](_0x0c2e('0x66'),_0x33245c[_0x0c2e('0x5d')],_0x44d2c9[_0x0c2e('0x67')],md5(_0x44d2c9[_0x0c2e('0x67')]));if(_0x55ee50&&_0x55ee50[_0x0c2e('0x68')]){logger['info'](_0x0c2e('0x69'),'Recording\x20is\x20enabled!');_0x44d2c9[_0x0c2e('0x6a')]=_0x2ac363;}else if(_0x12898e&&_0x12898e[_0x0c2e('0x6b')]&&_0x12898e[_0x0c2e('0x6b')]!=='none'){logger[_0x0c2e('0x11')](_0x0c2e('0x6c'),_0x0c2e('0x6d'));_0x44d2c9[_0x0c2e('0x6a')]=_0x2ac363;}else{_0x44d2c9[_0x0c2e('0x6a')]='';}return getAdminUser(_0x3c8d81,_0xae53d3,_0x330efc,_0x1d98fd,_0x15dd33,_0x1cb154)[_0x0c2e('0xd')](getUser(_0x3c8d81,_0xae53d3,_0x1d98fd,_0x15dd33,_0x1cb154))[_0x0c2e('0xd')](getEndUser(_0x3c8d81,_0xae53d3,_0x1d98fd,_0x15dd33,_0x1cb154))[_0x0c2e('0xd')](getTicket(_0x3c8d81,_0xae53d3,_0x1d98fd,_0x4241a8,_0x44d2c9,_0x15dd33))['then'](function(_0x50697c){logger[_0x0c2e('0x11')](util[_0x0c2e('0x54')](_0x0c2e('0x6e'),_0x50697c[_0x0c2e('0x44')]));logger[_0x0c2e('0x11')](util[_0x0c2e('0x54')](_0x0c2e('0x6f'),_0x3c8d81));if(_0x3c8d81!==_0x0c2e('0x65')){logger[_0x0c2e('0x11')]('['+[_0x3c8d81[_0x0c2e('0x12')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x33245c['remoteUri'],_0x4cc10f[_0x0c2e('0x3a')],_0x50697c[_0x0c2e('0x44')]);}})[_0x0c2e('0x14')](function(_0x114ca0){logger[_0x0c2e('0x15')]('['+[_0x3c8d81[_0x0c2e('0x12')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x0c2e('0x70')](_0x114ca0,{'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 38149c3..b6c4c7c 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 _0x29cc=['[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','uri','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Fields','Outbound','user:%s','catch','%s/service/v4_1/rest.php','lastevent','toUpperCase','Inbound','users','error','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','POST','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','Descriptions','date_start','slice','replace','duration_hours','duration_minutes','parent_id','Contacts','parent_name','direction','length','forEach','variableName','push','set_entry','JSON','stringify','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','name_value_list','user_name','Agent\x20found!','value','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','resolve','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','Enduser\x20created.','debug','merge','map','type','string','customField','toLowerCase','content','custom_fields','idField','variable','customVariable','Variable','login','username','PLAIN','xCALLY\x20Motion\x20integration','sessionID','set_relationship','Calls','remoteUri','stripTrailingSlash','serverUrl','monitor_format'];(function(_0x31a3d6,_0x404e2b){var _0x39e3b0=function(_0x40bd5b){while(--_0x40bd5b){_0x31a3d6['push'](_0x31a3d6['shift']());}};_0x39e3b0(++_0x404e2b);}(_0x29cc,0x111));var _0xc29c=function(_0x1d5ea9,_0x376bc2){_0x1d5ea9=_0x1d5ea9-0x0;var _0x227511=_0x29cc[_0x1d5ea9];return _0x227511;};'use strict';var _=require(_0xc29c('0x0'));var rp=require(_0xc29c('0x1'));var BPromise=require(_0xc29c('0x2'));var md5=require('md5');var util=require(_0xc29c('0x3'));var Redis=require(_0xc29c('0x4'));var intUtil=require(_0xc29c('0x5'));var config=require(_0xc29c('0x6'));var logger=require(_0xc29c('0x7'))('sugarcrm');config[_0xc29c('0x8')]=_['defaults'](config[_0xc29c('0x8')],{'host':_0xc29c('0x9'),'port':0x18eb});var io=require(_0xc29c('0xa'))(new Redis(config[_0xc29c('0x8')]));var def={'method':_0xc29c('0xb'),'json':!![]};function emit(_0x40bdfd,_0x363d30,_0x4e38a5){io['to'](_0x40bdfd)['emit'](_0x363d30,_0x4e38a5);}function getTicket(_0x57272a,_0xfcd67c,_0x3319df,_0x120960,_0x46c691,_0x3a1914,_0x2f0f0b,_0x333f30){logger[_0xc29c('0xc')](_0xc29c('0xd'));var _0x52e486=new Date();var _0x2927cb=[{'name':_0xc29c('0xe'),'value':intUtil[_0xc29c('0xf')](_0x120960[_0xc29c('0x10')],_0x46c691,'\x20')},{'name':_0xc29c('0x11'),'value':_0xfcd67c['id']},{'name':_0xc29c('0x12'),'value':_0xfcd67c['id']},{'name':'description','value':intUtil[_0xc29c('0xf')](_0x120960[_0xc29c('0x13')],_0x46c691,'\x0a')},{'name':_0xc29c('0x14'),'value':_0x52e486['toISOString']()[_0xc29c('0x15')](0x0,0x13)[_0xc29c('0x16')]('T','\x20')},{'name':_0xc29c('0x17'),'value':'0'},{'name':_0xc29c('0x18'),'value':'15'},{'name':_0xc29c('0x19'),'value':_0x3319df['id']},{'name':'parent_type','value':_0xc29c('0x1a')},{'name':_0xc29c('0x1b'),'value':_0x3319df[_0xc29c('0xe')]},{'name':_0xc29c('0x1c'),'value':_0x333f30}];if(_0x3a1914[_0xc29c('0x1d')]){_[_0xc29c('0x1e')](_0x3a1914,function(_0x28c847){if(_0x46c691[_0x28c847[_0xc29c('0x1f')]]){_0x2927cb[_0xc29c('0x20')]({'name':_0x28c847['idField'],'value':_0x46c691[_0x28c847[_0xc29c('0x1f')]]});}});}return request({'form':{'method':_0xc29c('0x21'),'input_type':_0xc29c('0x22'),'response_type':'JSON','rest_data':JSON[_0xc29c('0x23')]({'session':_0x2f0f0b['id'],'module_name':'Calls','name_value_list':_0x2927cb})}});}function getAuth(_0x19d8b4){return util[_0xc29c('0x24')](_0xc29c('0x25'),new Buffer(_0x19d8b4[_0xc29c('0x26')]+':X')[_0xc29c('0x27')](_0xc29c('0x28')));}function getServerInfo(_0x3bce35){return request({'form':{'method':_0xc29c('0x29'),'input_type':_0xc29c('0x22'),'response_type':_0xc29c('0x22'),'rest_data':JSON['stringify']({'session':_0x3bce35['id']})}});}function getUser(_0xff9740,_0x54edbe,_0x28c4be){if(!_[_0xc29c('0x2a')](_0x54edbe)){logger[_0xc29c('0xc')]('Getting\x20agent\x20with\x20name',_0x54edbe);return request({'form':{'method':_0xc29c('0x2b'),'input_type':_0xc29c('0x22'),'response_type':'JSON','rest_data':JSON[_0xc29c('0x23')]({'session':_0x28c4be['id'],'module_name':_0xc29c('0x2c'),'query':util[_0xc29c('0x24')](_0xc29c('0x2d'),_0x54edbe),'order_by':'','offset':'0','select_fields':['id',_0xc29c('0xe'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xc29c('0x2e')](function(_0x28ca95){if(_0x28ca95[_0xc29c('0x2f')][_0xc29c('0x1d')]){var _0x31ee29=_['find'](_0x28ca95[_0xc29c('0x2f')],function(_0x5b2a26){return _0x5b2a26[_0xc29c('0x30')][_0xc29c('0x31')]['value']===_0x54edbe;});if(_0x31ee29){logger[_0xc29c('0xc')](_0xc29c('0x32'));return BPromise['resolve']({'id':_0x31ee29['name_value_list']['id'][_0xc29c('0x33')],'name':_0x31ee29[_0xc29c('0x30')][_0xc29c('0xe')][_0xc29c('0x33')]});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x28c4be[_0xc29c('0x30')][_0xc29c('0x34')]['value'],'name':_0x28c4be[_0xc29c('0x30')][_0xc29c('0x31')]['value']});});}else{logger['info'](_0xc29c('0x35'));return BPromise[_0xc29c('0x36')]({'id':_0x28c4be[_0xc29c('0x30')]['user_id'][_0xc29c('0x33')],'name':_0x28c4be['name_value_list'][_0xc29c('0x31')]['value']});}}function getEndUser(_0x3e57ec,_0x2e5825,_0x5aac13,_0x506a93){logger[_0xc29c('0xc')](_0xc29c('0x37'),_0x5aac13);return request({'form':{'method':_0xc29c('0x2b'),'input_type':'JSON','response_type':_0xc29c('0x22'),'rest_data':JSON[_0xc29c('0x23')]({'session':_0x506a93['id'],'module_name':_0xc29c('0x1a'),'query':util[_0xc29c('0x24')](_0xc29c('0x38'),_0x5aac13),'order_by':'','offset':'0','select_fields':['id',_0xc29c('0xe'),_0xc29c('0x39')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xc29c('0x2e')](function(_0x3de152){if(_0x3de152[_0xc29c('0x2f')][_0xc29c('0x1d')]){var _0x26a4fd=_['find'](_0x3de152['entry_list'],function(_0x5b1cc9){return _0x5b1cc9[_0xc29c('0x30')]['phone_home'][_0xc29c('0x33')]===_0x5aac13;});if(_0x26a4fd){logger['info'](_0xc29c('0x3a'));return BPromise[_0xc29c('0x36')]({'id':_0x26a4fd[_0xc29c('0x30')]['id']['value'],'name':_0x26a4fd[_0xc29c('0x30')][_0xc29c('0xe')][_0xc29c('0x33')],'phone':_0x26a4fd[_0xc29c('0x30')][_0xc29c('0x39')][_0xc29c('0x33')]});}}else{logger['info'](_0xc29c('0x3b'));return request({'form':{'method':_0xc29c('0x21'),'input_type':_0xc29c('0x22'),'response_type':_0xc29c('0x22'),'rest_data':JSON[_0xc29c('0x23')]({'session':_0x506a93['id'],'module_name':_0xc29c('0x1a'),'name_value_list':[{'name':_0xc29c('0x3c'),'value':_0x2e5825!==''?_0x2e5825:util[_0xc29c('0x24')](_0xc29c('0x3d'),_0x5aac13)},{'name':_0xc29c('0x39'),'value':_0x5aac13}]})}})[_0xc29c('0x2e')](function(_0x1ae549){logger[_0xc29c('0xc')](_0xc29c('0x3e'));return BPromise[_0xc29c('0x36')]({'id':_0x1ae549['id'],'name':_0x1ae549[_0xc29c('0x2f')][_0xc29c('0x3c')]['value'],'phone':_0x1ae549[_0xc29c('0x2f')]['phone_home'][_0xc29c('0x33')]});});}});}function request(_0x3ece8a){logger[_0xc29c('0x3f')]('[HTTP]',JSON[_0xc29c('0x23')](_0x3ece8a));return rp(_[_0xc29c('0x40')](def,_0x3ece8a));}function getTags(_0x37657f,_0x4ac388){var _0x4c7243=[];if(_0x37657f&&_0x37657f[_0xc29c('0x1d')]>0x0){_0x4c7243=_[_0xc29c('0x41')](_0x37657f,_0x4ac388);}return _0x4c7243;}function getCustomFields(_0x54d157,_0x49086f){var _0x302284=[];var _0x3a91cc={'custom_fields':[]};if(_0x54d157[_0xc29c('0x1d')]>0x0){_['forEach'](_0x54d157,function(_0x219729){if(_0x219729[_0xc29c('0x42')]===_0xc29c('0x43')&&_0x219729['nameField']&&!_0x219729[_0xc29c('0x44')]){_0x3a91cc[_0x219729['nameField'][_0xc29c('0x45')]()]=_0x219729[_0xc29c('0x46')][_0xc29c('0x27')]();}else if(_0x219729[_0xc29c('0x42')]==='string'&&_0x219729['idField']&&_0x219729['customField']){_0x3a91cc[_0xc29c('0x47')][_0xc29c('0x20')]({'id':_0x219729[_0xc29c('0x48')],'value':_0x219729[_0xc29c('0x46')][_0xc29c('0x27')]()});}else if(_0x219729['type']===_0xc29c('0x49')&&_0x219729[_0xc29c('0x1f')]&&_0x219729[_0xc29c('0x48')]&&_0x219729[_0xc29c('0x44')]){_0x49086f[_0x219729[_0xc29c('0x1f')]]&&_0x3a91cc[_0xc29c('0x47')][_0xc29c('0x20')]({'id':_0x219729[_0xc29c('0x48')],'value':_0x49086f[_0x219729[_0xc29c('0x1f')]]['toString']()});}else if(_0x219729['type']===_0xc29c('0x4a')&&_0x219729[_0xc29c('0x4b')]&&_0x219729['Variable'][_0xc29c('0xe')]&&_0x219729['idField']&&_0x219729[_0xc29c('0x44')]){_0x49086f[_0x219729[_0xc29c('0x4b')][_0xc29c('0xe')][_0xc29c('0x45')]()]&&_0x3a91cc[_0xc29c('0x47')][_0xc29c('0x20')]({'id':_0x219729['idField'],'value':_0x49086f[_0x219729[_0xc29c('0x4b')][_0xc29c('0xe')][_0xc29c('0x45')]()][_0xc29c('0x27')]()});}});}return _0x3a91cc;}function getConnection(_0x12ebd5){return request({'method':_0xc29c('0xb'),'form':{'method':_0xc29c('0x4c'),'input_type':_0xc29c('0x22'),'response_type':_0xc29c('0x22'),'rest_data':JSON[_0xc29c('0x23')]({'user_auth':{'user_name':_0x12ebd5[_0xc29c('0x4d')],'password':_0x12ebd5['password'],'encryption':_0xc29c('0x4e')},'application':_0xc29c('0x4f')})}})['then'](function(_0x41ad43){var _0x11ddde=_0x41ad43;if(_0x11ddde['id']){def[_0xc29c('0x50')]=_0x11ddde['id'];return BPromise[_0xc29c('0x36')](_0x11ddde);}else{throw new Error(util[_0xc29c('0x24')]('Account\x20%d\x20is\x20not\x20valid',_0x12ebd5['id']));}});}function setRelationship(_0x27c843,_0x53ea55,_0x5f2d53,_0x5e7763){return request({'form':{'method':_0xc29c('0x51'),'input_type':_0xc29c('0x22'),'response_type':_0xc29c('0x22'),'rest_data':JSON['stringify']({'session':_0x27c843['id'],'module_name':_0xc29c('0x52'),'module_id':_0x5f2d53['id'],'link_field_name':_0x5e7763,'related_ids':[_0x53ea55['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x2ccba5,_0xd45ea2,_0x17d140,_0x553f61,_0x167ab0,_0x1271be){var _0x6cac28,_0x1064a2,_0x8ecf85,_0x1e60e0;_0x1271be[_0xc29c('0x53')]=intUtil[_0xc29c('0x54')](_0x1271be[_0xc29c('0x53')]);_0x1271be[_0xc29c('0x55')]=intUtil[_0xc29c('0x54')](_0x1271be[_0xc29c('0x55')]);def['uri']=util['format']('%s/service/v4_1/rest.php',_0x1271be['remoteUri']);if(_0x167ab0&&_0x167ab0[_0xc29c('0x56')]){logger['info'](_0xc29c('0x57'),_0xc29c('0x58'));_0xd45ea2[_0xc29c('0x59')]=util[_0xc29c('0x24')](_0xc29c('0x5a'),_0x1271be['serverUrl'],_0xd45ea2[_0xc29c('0x5b')],md5(_0xd45ea2[_0xc29c('0x5b')]));}else{_0xd45ea2[_0xc29c('0x59')]='';}return getConnection(_0x1271be)['then'](function(_0x33c94b){_0x1e60e0=_0x33c94b;return getUser(_0x1271be,_0x553f61[_0xc29c('0xe')],_0x1e60e0);})[_0xc29c('0x2e')](function(_0x28400f){_0x6cac28=_0x28400f;logger[_0xc29c('0xc')](_0xc29c('0x5c'),_0x6cac28['id']);return getEndUser(_0x1271be,_0xd45ea2[_0xc29c('0x5d')],_0xd45ea2[_0xc29c('0x5e')],_0x1e60e0);})['then'](function(_0xf3c15c){_0x1064a2=_0xf3c15c;logger[_0xc29c('0xc')]('The\x20Enduser\x20ID\x20is:',_0x1064a2['id']);return getTicket(_0x1271be,_0x6cac28,_0x1064a2,_0x17d140,_0xd45ea2,_0x17d140['Fields'],_0x1e60e0,'Inbound');})[_0xc29c('0x2e')](function(_0x1d67e0){_0x8ecf85=_0x1d67e0;logger[_0xc29c('0xc')](_0xc29c('0x5f'));logger[_0xc29c('0xc')](_0xc29c('0x60'),_0x8ecf85['id']);return setRelationship(_0x1e60e0,_0x6cac28,_0x8ecf85,'users');})[_0xc29c('0x2e')](function(){return setRelationship(_0x1e60e0,_0x1064a2,_0x8ecf85,_0xc29c('0x61'));})['then'](function(){return getServerInfo(_0x1e60e0);})['then'](function(_0x1ce088){var _0x2ced32=parseInt(_0x1ce088[_0xc29c('0x62')][_0xc29c('0x63')](0x0));var _0xa74afb=util[_0xc29c('0x24')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x1271be[_0xc29c('0x53')],_0x8ecf85['id']);if(_0x2ced32>0x6){_0xa74afb=util[_0xc29c('0x24')](_0xc29c('0x64'),_0x1271be['remoteUri'],_0x8ecf85['id']);}logger[_0xc29c('0xc')]('[QUEUE]',_0xc29c('0x65'));emit(util['format']('user:%s',_0x553f61[_0xc29c('0xe')]),_0xc29c('0x66'),{'uri':_0xa74afb});})['catch'](function(_0x5f01e7){logger['error']('[QUEUE]',JSON[_0xc29c('0x23')](_0x5f01e7));});};exports['outbound']=function(_0x3065ba,_0x3a3dea,_0xee3d40,_0x2cab22,_0x21adb2,_0x291c2d,_0x54153a){var _0x150b9a,_0x510222,_0x150ba6,_0x10c8ae;_0x291c2d[_0xc29c('0x53')]=intUtil[_0xc29c('0x54')](_0x291c2d[_0xc29c('0x53')]);_0x291c2d[_0xc29c('0x55')]=intUtil[_0xc29c('0x54')](_0x291c2d[_0xc29c('0x55')]);def[_0xc29c('0x67')]=util[_0xc29c('0x24')]('%s/service/v4_1/rest.php',_0x291c2d[_0xc29c('0x53')]);if(_0x54153a&&_0x54153a['recordingFormat']&&_0x54153a[_0xc29c('0x68')]!==_0xc29c('0x69')){logger[_0xc29c('0xc')](_0xc29c('0x6a'),_0xc29c('0x58'));_0x3a3dea[_0xc29c('0x59')]=util[_0xc29c('0x24')](_0xc29c('0x5a'),_0x291c2d[_0xc29c('0x55')],_0x3a3dea[_0xc29c('0x5b')],md5(_0x3a3dea[_0xc29c('0x5b')]));}return getConnection(_0x291c2d)[_0xc29c('0x2e')](function(_0x403d64){_0x10c8ae=_0x403d64;return getUser(_0x291c2d,_0x2cab22[_0xc29c('0xe')],_0x10c8ae);})['then'](function(_0x46806f){_0x150b9a=_0x46806f;logger[_0xc29c('0xc')]('The\x20User\x20ID\x20is:',_0x150b9a['id']);return getEndUser(_0x291c2d,_0x3a3dea[_0xc29c('0x6b')],_0x3a3dea[_0xc29c('0x6c')],_0x10c8ae);})[_0xc29c('0x2e')](function(_0x6069f0){_0x510222=_0x6069f0;logger['info'](_0xc29c('0x6d'),_0x510222['id']);return getTicket(_0x291c2d,_0x150b9a,_0x510222,_0xee3d40,_0x3a3dea,_0xee3d40[_0xc29c('0x6e')],_0x10c8ae,_0xc29c('0x6f'));})[_0xc29c('0x2e')](function(_0x52009b){_0x150ba6=_0x52009b;logger[_0xc29c('0xc')]('Ticket\x20created!');logger[_0xc29c('0xc')](_0xc29c('0x60'),_0x150ba6['id']);return setRelationship(_0x10c8ae,_0x150b9a,_0x150ba6,'users');})['then'](function(){return setRelationship(_0x10c8ae,_0x510222,_0x150ba6,_0xc29c('0x61'));})[_0xc29c('0x2e')](function(){return getServerInfo(_0x10c8ae);})['then'](function(_0xf96d03){var _0x40c875=parseInt(_0xf96d03[_0xc29c('0x62')][_0xc29c('0x63')](0x0));var _0x1f4ebf=util[_0xc29c('0x24')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x291c2d[_0xc29c('0x53')],_0x150ba6['id']);if(_0x40c875>0x6){_0x1f4ebf=util['format'](_0xc29c('0x64'),_0x291c2d['remoteUri'],_0x150ba6['id']);}logger[_0xc29c('0xc')]('[OUTBOUND]',_0xc29c('0x65'));emit(util[_0xc29c('0x24')](_0xc29c('0x70'),_0x2cab22[_0xc29c('0xe')]),_0xc29c('0x66'),{'uri':_0x1f4ebf});})[_0xc29c('0x71')](function(_0x151604){logger['error'](_0xc29c('0x6a'),JSON[_0xc29c('0x23')](_0x151604));});};exports['unmanaged']=function(_0x457116,_0x4e7e14,_0x237e28,_0xdd5d67,_0x19282a,_0x4f89f3){var _0x3872bc,_0x21308b,_0x595598,_0x7cc00e;_0x4f89f3[_0xc29c('0x53')]=intUtil[_0xc29c('0x54')](_0x4f89f3[_0xc29c('0x53')]);_0x4f89f3[_0xc29c('0x55')]=intUtil[_0xc29c('0x54')](_0x4f89f3[_0xc29c('0x55')]);def['uri']=util[_0xc29c('0x24')](_0xc29c('0x72'),_0x4f89f3[_0xc29c('0x53')]);if(_0x19282a&&_0x19282a[_0xc29c('0x56')]){logger[_0xc29c('0xc')]('['+_0x4e7e14[_0xc29c('0x73')][_0xc29c('0x74')]()+']','Recording\x20is\x20enabled!');_0x4e7e14[_0xc29c('0x59')]=util[_0xc29c('0x24')](_0xc29c('0x5a'),_0x4f89f3[_0xc29c('0x55')],_0x4e7e14[_0xc29c('0x5b')],md5(_0x4e7e14['uniqueid']));}else{_0x4e7e14[_0xc29c('0x59')]='';}return getConnection(_0x4f89f3)[_0xc29c('0x2e')](function(_0x14280f){_0x7cc00e=_0x14280f;if(!_['isNil'](_0xdd5d67)){return getUser(_0x4f89f3,_0xdd5d67['name'],_0x7cc00e);}else{return getUser(_0x4f89f3,null,_0x7cc00e);}})['then'](function(_0x58a131){_0x3872bc=_0x58a131;logger[_0xc29c('0xc')](_0xc29c('0x5c'),_0x3872bc['id']);return getEndUser(_0x4f89f3,_0x4e7e14[_0xc29c('0x5d')],_0x4e7e14[_0xc29c('0x5e')],_0x7cc00e);})[_0xc29c('0x2e')](function(_0x2f1dcc){_0x21308b=_0x2f1dcc;logger['info'](_0xc29c('0x6d'),_0x21308b['id']);return getTicket(_0x4f89f3,_0x3872bc,_0x21308b,_0x237e28,_0x4e7e14,_0x237e28[_0xc29c('0x6e')],_0x7cc00e,_0xc29c('0x75'));})[_0xc29c('0x2e')](function(_0x5511db){_0x595598=_0x5511db;logger['info'](_0xc29c('0x5f'));logger[_0xc29c('0xc')]('The\x20Ticket\x20ID\x20is:',_0x595598['id']);return setRelationship(_0x7cc00e,_0x3872bc,_0x595598,_0xc29c('0x76'));})[_0xc29c('0x2e')](function(){return setRelationship(_0x7cc00e,_0x21308b,_0x595598,_0xc29c('0x61'));})[_0xc29c('0x2e')](function(){return getServerInfo(_0x7cc00e);})[_0xc29c('0x71')](function(_0x49e1ee){logger[_0xc29c('0x77')]('['+_0x4e7e14['lastevent'][_0xc29c('0x74')]()+']',JSON['stringify'](_0x49e1ee));});}; \ No newline at end of file +var _0xbd3d=['emit','info','Creating\x20new\x20ticket...','name','assigned_user_id','created_by','description','date_start','slice','replace','duration_hours','parent_type','Contacts','parent_name','length','forEach','variableName','idField','set_entry','JSON','Calls','format','toString','base64','get_server_info','stringify','isNil','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','resolve','user_id','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','first_name','[HTTP]','map','type','string','nameField','toLowerCase','content','customField','custom_fields','push','variable','customVariable','Variable','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','stripTrailingSlash','remoteUri','serverUrl','%s/service/v4_1/rest.php','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','[QUEUE]','outbound','uri','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridnum','Outbound','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','unmanaged','lastevent','toUpperCase','calleridname','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','localhost','socket.io-emitter','POST'];(function(_0x439a35,_0x568884){var _0x4e59e0=function(_0x755e7b){while(--_0x755e7b){_0x439a35['push'](_0x439a35['shift']());}};_0x4e59e0(++_0x568884);}(_0xbd3d,0x68));var _0xdbd3=function(_0x43c268,_0x225804){_0x43c268=_0x43c268-0x0;var _0xfae125=_0xbd3d[_0x43c268];return _0xfae125;};'use strict';var _=require('lodash');var rp=require(_0xdbd3('0x0'));var BPromise=require(_0xdbd3('0x1'));var md5=require(_0xdbd3('0x2'));var util=require('util');var Redis=require(_0xdbd3('0x3'));var intUtil=require(_0xdbd3('0x4'));var config=require(_0xdbd3('0x5'));var logger=require(_0xdbd3('0x6'))(_0xdbd3('0x7'));config[_0xdbd3('0x8')]=_['defaults'](config['redis'],{'host':_0xdbd3('0x9'),'port':0x18eb});var io=require(_0xdbd3('0xa'))(new Redis(config[_0xdbd3('0x8')]));var def={'method':_0xdbd3('0xb'),'json':!![]};function emit(_0x3e784e,_0xf6efdd,_0x57dce4){io['to'](_0x3e784e)[_0xdbd3('0xc')](_0xf6efdd,_0x57dce4);}function getTicket(_0xcb97e9,_0x15f2e3,_0x4ab5a5,_0x4929b2,_0x2e635f,_0x4a2516,_0xe7754c,_0x42afd1){logger[_0xdbd3('0xd')](_0xdbd3('0xe'));var _0x458f29=new Date();var _0x54aeb1=[{'name':_0xdbd3('0xf'),'value':intUtil['getString'](_0x4929b2['Subjects'],_0x2e635f,'\x20')},{'name':_0xdbd3('0x10'),'value':_0x15f2e3['id']},{'name':_0xdbd3('0x11'),'value':_0x15f2e3['id']},{'name':_0xdbd3('0x12'),'value':intUtil['getString'](_0x4929b2['Descriptions'],_0x2e635f,'\x0a')},{'name':_0xdbd3('0x13'),'value':_0x458f29['toISOString']()[_0xdbd3('0x14')](0x0,0x13)[_0xdbd3('0x15')]('T','\x20')},{'name':_0xdbd3('0x16'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':'parent_id','value':_0x4ab5a5['id']},{'name':_0xdbd3('0x17'),'value':_0xdbd3('0x18')},{'name':_0xdbd3('0x19'),'value':_0x4ab5a5[_0xdbd3('0xf')]},{'name':'direction','value':_0x42afd1}];if(_0x4a2516[_0xdbd3('0x1a')]){_[_0xdbd3('0x1b')](_0x4a2516,function(_0x53c749){if(_0x2e635f[_0x53c749[_0xdbd3('0x1c')]]){_0x54aeb1['push']({'name':_0x53c749[_0xdbd3('0x1d')],'value':_0x2e635f[_0x53c749[_0xdbd3('0x1c')]]});}});}return request({'form':{'method':_0xdbd3('0x1e'),'input_type':'JSON','response_type':_0xdbd3('0x1f'),'rest_data':JSON['stringify']({'session':_0xe7754c['id'],'module_name':_0xdbd3('0x20'),'name_value_list':_0x54aeb1})}});}function getAuth(_0x3702fd){return util[_0xdbd3('0x21')]('Basic\x20%s',new Buffer(_0x3702fd['apiKey']+':X')[_0xdbd3('0x22')](_0xdbd3('0x23')));}function getServerInfo(_0x23b711){return request({'form':{'method':_0xdbd3('0x24'),'input_type':_0xdbd3('0x1f'),'response_type':_0xdbd3('0x1f'),'rest_data':JSON[_0xdbd3('0x25')]({'session':_0x23b711['id']})}});}function getUser(_0x14ce39,_0x4c3502,_0x397410){if(!_[_0xdbd3('0x26')](_0x4c3502)){logger[_0xdbd3('0xd')]('Getting\x20agent\x20with\x20name',_0x4c3502);return request({'form':{'method':_0xdbd3('0x27'),'input_type':'JSON','response_type':_0xdbd3('0x1f'),'rest_data':JSON[_0xdbd3('0x25')]({'session':_0x397410['id'],'module_name':_0xdbd3('0x28'),'query':util[_0xdbd3('0x21')](_0xdbd3('0x29'),_0x4c3502),'order_by':'','offset':'0','select_fields':['id',_0xdbd3('0xf'),_0xdbd3('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xdbd3('0x2b')](function(_0x53aea6){if(_0x53aea6[_0xdbd3('0x2c')]['length']){var _0x3b4b70=_[_0xdbd3('0x2d')](_0x53aea6[_0xdbd3('0x2c')],function(_0x521cd5){return _0x521cd5[_0xdbd3('0x2e')]['user_name'][_0xdbd3('0x2f')]===_0x4c3502;});if(_0x3b4b70){logger[_0xdbd3('0xd')](_0xdbd3('0x30'));return BPromise['resolve']({'id':_0x3b4b70[_0xdbd3('0x2e')]['id']['value'],'name':_0x3b4b70[_0xdbd3('0x2e')][_0xdbd3('0xf')][_0xdbd3('0x2f')]});}}logger[_0xdbd3('0xd')](_0xdbd3('0x31'));return BPromise['resolve']({'id':_0x397410[_0xdbd3('0x2e')]['user_id'][_0xdbd3('0x2f')],'name':_0x397410[_0xdbd3('0x2e')][_0xdbd3('0x2a')][_0xdbd3('0x2f')]});});}else{logger[_0xdbd3('0xd')](_0xdbd3('0x32'));return BPromise[_0xdbd3('0x33')]({'id':_0x397410[_0xdbd3('0x2e')][_0xdbd3('0x34')]['value'],'name':_0x397410[_0xdbd3('0x2e')][_0xdbd3('0x2a')][_0xdbd3('0x2f')]});}}function getEndUser(_0x18cc80,_0x5c18b5,_0x37af6a,_0x54b8cf){logger[_0xdbd3('0xd')]('Searching\x20enduser\x20with\x20phone',_0x37af6a);return request({'form':{'method':_0xdbd3('0x27'),'input_type':_0xdbd3('0x1f'),'response_type':_0xdbd3('0x1f'),'rest_data':JSON[_0xdbd3('0x25')]({'session':_0x54b8cf['id'],'module_name':_0xdbd3('0x18'),'query':util[_0xdbd3('0x21')](_0xdbd3('0x35'),_0x37af6a),'order_by':'','offset':'0','select_fields':['id',_0xdbd3('0xf'),_0xdbd3('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xdbd3('0x2b')](function(_0x28e7a0){if(_0x28e7a0[_0xdbd3('0x2c')][_0xdbd3('0x1a')]){var _0x94cf4c=_['find'](_0x28e7a0['entry_list'],function(_0x2475d0){return _0x2475d0['name_value_list'][_0xdbd3('0x36')][_0xdbd3('0x2f')]===_0x37af6a;});if(_0x94cf4c){logger[_0xdbd3('0xd')](_0xdbd3('0x37'));return BPromise[_0xdbd3('0x33')]({'id':_0x94cf4c[_0xdbd3('0x2e')]['id'][_0xdbd3('0x2f')],'name':_0x94cf4c[_0xdbd3('0x2e')]['name'][_0xdbd3('0x2f')],'phone':_0x94cf4c[_0xdbd3('0x2e')][_0xdbd3('0x36')]['value']});}}else{logger[_0xdbd3('0xd')](_0xdbd3('0x38'));return request({'form':{'method':_0xdbd3('0x1e'),'input_type':'JSON','response_type':_0xdbd3('0x1f'),'rest_data':JSON[_0xdbd3('0x25')]({'session':_0x54b8cf['id'],'module_name':_0xdbd3('0x18'),'name_value_list':[{'name':'first_name','value':_0x5c18b5!==''?_0x5c18b5:util[_0xdbd3('0x21')](_0xdbd3('0x39'),_0x37af6a)},{'name':_0xdbd3('0x36'),'value':_0x37af6a}]})}})[_0xdbd3('0x2b')](function(_0x11136c){logger[_0xdbd3('0xd')]('Enduser\x20created.');return BPromise[_0xdbd3('0x33')]({'id':_0x11136c['id'],'name':_0x11136c[_0xdbd3('0x2c')][_0xdbd3('0x3a')][_0xdbd3('0x2f')],'phone':_0x11136c['entry_list'][_0xdbd3('0x36')][_0xdbd3('0x2f')]});});}});}function request(_0x421241){logger['debug'](_0xdbd3('0x3b'),JSON['stringify'](_0x421241));return rp(_['merge'](def,_0x421241));}function getTags(_0x4cd731,_0x186d40){var _0x191003=[];if(_0x4cd731&&_0x4cd731[_0xdbd3('0x1a')]>0x0){_0x191003=_[_0xdbd3('0x3c')](_0x4cd731,_0x186d40);}return _0x191003;}function getCustomFields(_0x443157,_0x23e771){var _0x2b5771=[];var _0x547954={'custom_fields':[]};if(_0x443157[_0xdbd3('0x1a')]>0x0){_[_0xdbd3('0x1b')](_0x443157,function(_0x114d1b){if(_0x114d1b[_0xdbd3('0x3d')]===_0xdbd3('0x3e')&&_0x114d1b[_0xdbd3('0x3f')]&&!_0x114d1b['customField']){_0x547954[_0x114d1b[_0xdbd3('0x3f')][_0xdbd3('0x40')]()]=_0x114d1b[_0xdbd3('0x41')][_0xdbd3('0x22')]();}else if(_0x114d1b[_0xdbd3('0x3d')]===_0xdbd3('0x3e')&&_0x114d1b[_0xdbd3('0x1d')]&&_0x114d1b[_0xdbd3('0x42')]){_0x547954[_0xdbd3('0x43')][_0xdbd3('0x44')]({'id':_0x114d1b[_0xdbd3('0x1d')],'value':_0x114d1b[_0xdbd3('0x41')][_0xdbd3('0x22')]()});}else if(_0x114d1b[_0xdbd3('0x3d')]===_0xdbd3('0x45')&&_0x114d1b[_0xdbd3('0x1c')]&&_0x114d1b[_0xdbd3('0x1d')]&&_0x114d1b['customField']){_0x23e771[_0x114d1b[_0xdbd3('0x1c')]]&&_0x547954['custom_fields']['push']({'id':_0x114d1b[_0xdbd3('0x1d')],'value':_0x23e771[_0x114d1b[_0xdbd3('0x1c')]][_0xdbd3('0x22')]()});}else if(_0x114d1b[_0xdbd3('0x3d')]===_0xdbd3('0x46')&&_0x114d1b[_0xdbd3('0x47')]&&_0x114d1b[_0xdbd3('0x47')][_0xdbd3('0xf')]&&_0x114d1b[_0xdbd3('0x1d')]&&_0x114d1b[_0xdbd3('0x42')]){_0x23e771[_0x114d1b[_0xdbd3('0x47')][_0xdbd3('0xf')]['toLowerCase']()]&&_0x547954[_0xdbd3('0x43')][_0xdbd3('0x44')]({'id':_0x114d1b['idField'],'value':_0x23e771[_0x114d1b[_0xdbd3('0x47')]['name']['toLowerCase']()][_0xdbd3('0x22')]()});}});}return _0x547954;}function getConnection(_0x579188){return request({'method':_0xdbd3('0xb'),'form':{'method':'login','input_type':'JSON','response_type':_0xdbd3('0x1f'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x579188[_0xdbd3('0x48')],'password':_0x579188[_0xdbd3('0x49')],'encryption':_0xdbd3('0x4a')},'application':_0xdbd3('0x4b')})}})['then'](function(_0x446320){var _0x1b1aea=_0x446320;if(_0x1b1aea['id']){def[_0xdbd3('0x4c')]=_0x1b1aea['id'];return BPromise[_0xdbd3('0x33')](_0x1b1aea);}else{throw new Error(util[_0xdbd3('0x21')](_0xdbd3('0x4d'),_0x579188['id']));}});}function setRelationship(_0x14b51f,_0x5137e6,_0x44e6a4,_0x30f3a7){return request({'form':{'method':_0xdbd3('0x4e'),'input_type':_0xdbd3('0x1f'),'response_type':_0xdbd3('0x1f'),'rest_data':JSON['stringify']({'session':_0x14b51f['id'],'module_name':_0xdbd3('0x20'),'module_id':_0x44e6a4['id'],'link_field_name':_0x30f3a7,'related_ids':[_0x5137e6['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xdbd3('0x4f')]=function(_0x4a2f06,_0xce5dfc,_0xe82685,_0x50415f,_0x520fd1,_0xf6848c){var _0x34cf65,_0x1225f,_0x19bdbf,_0x196b39;_0xf6848c['remoteUri']=intUtil[_0xdbd3('0x50')](_0xf6848c[_0xdbd3('0x51')]);_0xf6848c[_0xdbd3('0x52')]=intUtil[_0xdbd3('0x50')](_0xf6848c[_0xdbd3('0x52')]);def['uri']=util['format'](_0xdbd3('0x53'),_0xf6848c[_0xdbd3('0x51')]);if(_0x520fd1&&_0x520fd1[_0xdbd3('0x54')]){logger[_0xdbd3('0xd')]('[QUEUE]','Recording\x20is\x20enabled!');_0xce5dfc[_0xdbd3('0x55')]=util[_0xdbd3('0x21')](_0xdbd3('0x56'),_0xf6848c[_0xdbd3('0x52')],_0xce5dfc[_0xdbd3('0x57')],md5(_0xce5dfc[_0xdbd3('0x57')]));}else{_0xce5dfc[_0xdbd3('0x55')]='';}return getConnection(_0xf6848c)[_0xdbd3('0x2b')](function(_0xd99c2d){_0x196b39=_0xd99c2d;return getUser(_0xf6848c,_0x50415f[_0xdbd3('0xf')],_0x196b39);})[_0xdbd3('0x2b')](function(_0x1fe0ed){_0x34cf65=_0x1fe0ed;logger[_0xdbd3('0xd')]('The\x20User\x20ID\x20is:',_0x34cf65['id']);return getEndUser(_0xf6848c,_0xce5dfc['calleridname'],_0xce5dfc[_0xdbd3('0x58')],_0x196b39);})[_0xdbd3('0x2b')](function(_0x4f4f4e){_0x1225f=_0x4f4f4e;logger['info'](_0xdbd3('0x59'),_0x1225f['id']);return getTicket(_0xf6848c,_0x34cf65,_0x1225f,_0xe82685,_0xce5dfc,_0xe82685[_0xdbd3('0x5a')],_0x196b39,'Inbound');})[_0xdbd3('0x2b')](function(_0x50a371){_0x19bdbf=_0x50a371;logger[_0xdbd3('0xd')](_0xdbd3('0x5b'));logger[_0xdbd3('0xd')](_0xdbd3('0x5c'),_0x19bdbf['id']);return setRelationship(_0x196b39,_0x34cf65,_0x19bdbf,_0xdbd3('0x5d'));})[_0xdbd3('0x2b')](function(){return setRelationship(_0x196b39,_0x1225f,_0x19bdbf,_0xdbd3('0x5e'));})[_0xdbd3('0x2b')](function(){return getServerInfo(_0x196b39);})['then'](function(_0x99baa5){var _0x7405f7=parseInt(_0x99baa5[_0xdbd3('0x5f')]['charAt'](0x0));var _0x10dc8b=util[_0xdbd3('0x21')](_0xdbd3('0x60'),_0xf6848c[_0xdbd3('0x51')],_0x19bdbf['id']);if(_0x7405f7>0x6){_0x10dc8b=util[_0xdbd3('0x21')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0xf6848c[_0xdbd3('0x51')],_0x19bdbf['id']);}logger['info']('[QUEUE]',_0xdbd3('0x61'));emit(util[_0xdbd3('0x21')]('user:%s',_0x50415f[_0xdbd3('0xf')]),_0xdbd3('0x62'),{'uri':_0x10dc8b});})['catch'](function(_0x34d12f){logger[_0xdbd3('0x63')](_0xdbd3('0x64'),JSON[_0xdbd3('0x25')](_0x34d12f));});};exports[_0xdbd3('0x65')]=function(_0x2a1869,_0x536391,_0x101711,_0x400429,_0x4035ff,_0x43c077,_0x22ba32){var _0x5e06c2,_0x24cb0e,_0x3f3413,_0x2aa496;_0x43c077[_0xdbd3('0x51')]=intUtil[_0xdbd3('0x50')](_0x43c077[_0xdbd3('0x51')]);_0x43c077['serverUrl']=intUtil[_0xdbd3('0x50')](_0x43c077[_0xdbd3('0x52')]);def[_0xdbd3('0x66')]=util['format'](_0xdbd3('0x53'),_0x43c077[_0xdbd3('0x51')]);if(_0x22ba32&&_0x22ba32[_0xdbd3('0x67')]&&_0x22ba32[_0xdbd3('0x67')]!=='none'){logger[_0xdbd3('0xd')](_0xdbd3('0x68'),_0xdbd3('0x69'));_0x536391[_0xdbd3('0x55')]=util[_0xdbd3('0x21')](_0xdbd3('0x56'),_0x43c077[_0xdbd3('0x52')],_0x536391[_0xdbd3('0x57')],md5(_0x536391['uniqueid']));}return getConnection(_0x43c077)[_0xdbd3('0x2b')](function(_0x18923e){_0x2aa496=_0x18923e;return getUser(_0x43c077,_0x400429[_0xdbd3('0xf')],_0x2aa496);})[_0xdbd3('0x2b')](function(_0x34c071){_0x5e06c2=_0x34c071;logger[_0xdbd3('0xd')](_0xdbd3('0x6a'),_0x5e06c2['id']);return getEndUser(_0x43c077,_0x536391['destcalleridname'],_0x536391[_0xdbd3('0x6b')],_0x2aa496);})['then'](function(_0x4c8627){_0x24cb0e=_0x4c8627;logger[_0xdbd3('0xd')](_0xdbd3('0x59'),_0x24cb0e['id']);return getTicket(_0x43c077,_0x5e06c2,_0x24cb0e,_0x101711,_0x536391,_0x101711[_0xdbd3('0x5a')],_0x2aa496,_0xdbd3('0x6c'));})['then'](function(_0x1b09e9){_0x3f3413=_0x1b09e9;logger[_0xdbd3('0xd')](_0xdbd3('0x5b'));logger[_0xdbd3('0xd')](_0xdbd3('0x5c'),_0x3f3413['id']);return setRelationship(_0x2aa496,_0x5e06c2,_0x3f3413,'users');})[_0xdbd3('0x2b')](function(){return setRelationship(_0x2aa496,_0x24cb0e,_0x3f3413,_0xdbd3('0x5e'));})['then'](function(){return getServerInfo(_0x2aa496);})['then'](function(_0x24d94f){var _0x55d88=parseInt(_0x24d94f['version'][_0xdbd3('0x6d')](0x0));var _0x1fc7c0=util[_0xdbd3('0x21')](_0xdbd3('0x60'),_0x43c077['remoteUri'],_0x3f3413['id']);if(_0x55d88>0x6){_0x1fc7c0=util[_0xdbd3('0x21')](_0xdbd3('0x6e'),_0x43c077[_0xdbd3('0x51')],_0x3f3413['id']);}logger[_0xdbd3('0xd')](_0xdbd3('0x68'),_0xdbd3('0x61'));emit(util[_0xdbd3('0x21')](_0xdbd3('0x6f'),_0x400429[_0xdbd3('0xf')]),'trigger:browser:url',{'uri':_0x1fc7c0});})['catch'](function(_0x292a54){logger['error'](_0xdbd3('0x68'),JSON[_0xdbd3('0x25')](_0x292a54));});};exports[_0xdbd3('0x70')]=function(_0xb711b0,_0x581967,_0x544b52,_0xb821b7,_0x2939a4,_0x398384){var _0x3134f0,_0x1dd7e1,_0x47e97d,_0x1839a4;_0x398384[_0xdbd3('0x51')]=intUtil['stripTrailingSlash'](_0x398384['remoteUri']);_0x398384['serverUrl']=intUtil[_0xdbd3('0x50')](_0x398384[_0xdbd3('0x52')]);def[_0xdbd3('0x66')]=util[_0xdbd3('0x21')]('%s/service/v4_1/rest.php',_0x398384[_0xdbd3('0x51')]);if(_0x2939a4&&_0x2939a4[_0xdbd3('0x54')]){logger[_0xdbd3('0xd')]('['+_0x581967[_0xdbd3('0x71')][_0xdbd3('0x72')]()+']','Recording\x20is\x20enabled!');_0x581967[_0xdbd3('0x55')]=util['format'](_0xdbd3('0x56'),_0x398384[_0xdbd3('0x52')],_0x581967['uniqueid'],md5(_0x581967[_0xdbd3('0x57')]));}else{_0x581967[_0xdbd3('0x55')]='';}return getConnection(_0x398384)[_0xdbd3('0x2b')](function(_0x228c46){_0x1839a4=_0x228c46;if(!_[_0xdbd3('0x26')](_0xb821b7)){return getUser(_0x398384,_0xb821b7['name'],_0x1839a4);}else{return getUser(_0x398384,null,_0x1839a4);}})[_0xdbd3('0x2b')](function(_0x1d85f5){_0x3134f0=_0x1d85f5;logger[_0xdbd3('0xd')](_0xdbd3('0x6a'),_0x3134f0['id']);return getEndUser(_0x398384,_0x581967[_0xdbd3('0x73')],_0x581967[_0xdbd3('0x58')],_0x1839a4);})[_0xdbd3('0x2b')](function(_0x284ed1){_0x1dd7e1=_0x284ed1;logger[_0xdbd3('0xd')](_0xdbd3('0x59'),_0x1dd7e1['id']);return getTicket(_0x398384,_0x3134f0,_0x1dd7e1,_0x544b52,_0x581967,_0x544b52[_0xdbd3('0x5a')],_0x1839a4,'Inbound');})[_0xdbd3('0x2b')](function(_0x14e0eb){_0x47e97d=_0x14e0eb;logger[_0xdbd3('0xd')](_0xdbd3('0x5b'));logger[_0xdbd3('0xd')]('The\x20Ticket\x20ID\x20is:',_0x47e97d['id']);return setRelationship(_0x1839a4,_0x3134f0,_0x47e97d,_0xdbd3('0x5d'));})[_0xdbd3('0x2b')](function(){return setRelationship(_0x1839a4,_0x1dd7e1,_0x47e97d,'contacts');})[_0xdbd3('0x2b')](function(){return getServerInfo(_0x1839a4);})['catch'](function(_0x1e5fe5){logger['error']('['+_0x581967['lastevent'][_0xdbd3('0x72')]()+']',JSON['stringify'](_0x1e5fe5));});}; \ 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 8fe324a..e1be81b 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 _0x1744=['keyValue','keyType','string','key','keyContent','variable','format','%s:\x20%s','join','substring','lastIndexOf','validateEmail','isNil','lodash','util','length','push','content','type','variableName','toString','customVariable','Variable','name','toLowerCase'];(function(_0x42ead1,_0x5d479f){var _0xadda3e=function(_0x2174f8){while(--_0x2174f8){_0x42ead1['push'](_0x42ead1['shift']());}};_0xadda3e(++_0x5d479f);}(_0x1744,0x120));var _0x4174=function(_0x4ba925,_0x5e3d76){_0x4ba925=_0x4ba925-0x0;var _0x1a8189=_0x1744[_0x4ba925];return _0x1a8189;};'use strict';var _=require(_0x4174('0x0'));var util=require(_0x4174('0x1'));exports['getString']=function(_0x4f5dcb,_0x50f707,_0x498155){var _0x21cfa9=[];if(_0x4f5dcb[_0x4174('0x2')]>0x0){var _0x4146a2=_['sortBy'](_0x4f5dcb,['id']);for(var _0x2372b5=0x0;_0x2372b5<_0x4146a2[_0x4174('0x2')];_0x2372b5++){var _0x356b10=_0x4146a2[_0x2372b5];if(_0x356b10['type']==='string'){_0x21cfa9[_0x4174('0x3')](_0x356b10[_0x4174('0x4')]);}else if(_0x356b10[_0x4174('0x5')]==='variable'&&_0x356b10[_0x4174('0x6')]){_0x50f707[_0x356b10[_0x4174('0x6')]]&&_0x21cfa9[_0x4174('0x3')](_0x50f707[_0x356b10[_0x4174('0x6')]][_0x4174('0x7')]());}else if(_0x356b10['type']===_0x4174('0x8')&&_0x356b10[_0x4174('0x9')]&&_0x356b10[_0x4174('0x9')][_0x4174('0xa')]){_0x50f707[_0x356b10[_0x4174('0x9')][_0x4174('0xa')][_0x4174('0xb')]()]&&_0x21cfa9[_0x4174('0x3')](_0x50f707[_0x356b10[_0x4174('0x9')][_0x4174('0xa')][_0x4174('0xb')]()][_0x4174('0x7')]());}else if(_0x356b10[_0x4174('0x5')]===_0x4174('0xc')){if(_0x356b10[_0x4174('0xd')]===_0x4174('0xe')&&_0x356b10[_0x4174('0xf')]){_0x21cfa9[_0x4174('0x3')](util['format']('%s:\x20%s',_0x356b10[_0x4174('0xf')],_0x356b10[_0x4174('0x10')]));}else if(_0x356b10['keyType']===_0x4174('0x11')&&_0x356b10[_0x4174('0x6')]&&_0x356b10['key']){_0x50f707[_0x356b10[_0x4174('0x6')]]&&_0x21cfa9[_0x4174('0x3')](util[_0x4174('0x12')](_0x4174('0x13'),_0x356b10[_0x4174('0xf')],_0x50f707[_0x356b10[_0x4174('0x6')]]));}else if(_0x356b10['keyType']===_0x4174('0x8')&&_0x356b10[_0x4174('0x9')]&&_0x356b10[_0x4174('0x9')][_0x4174('0xa')]&&_0x356b10['key']){_0x50f707[_0x356b10[_0x4174('0x9')][_0x4174('0xa')][_0x4174('0xb')]()]&&_0x21cfa9[_0x4174('0x3')](util[_0x4174('0x12')](_0x4174('0x13'),_0x356b10[_0x4174('0xf')],_0x50f707[_0x356b10[_0x4174('0x9')][_0x4174('0xa')][_0x4174('0xb')]()]));}}}}return _0x21cfa9[_0x4174('0x14')](_0x498155);};exports['stripTrailingSlash']=function(_0xa3aea8){var _0x25539b=_0xa3aea8['slice'](-0x1);if(_0x25539b==='/'){_0xa3aea8=_0xa3aea8[_0x4174('0x15')](0x0,_0xa3aea8[_0x4174('0x16')](_0x25539b));}return _0xa3aea8;};exports[_0x4174('0x17')]=function(_0x1bee27){if(!_[_0x4174('0x18')](_0x1bee27)&&_0x1bee27!==''){var _0x59225c=/^(([^<>()\[\]\\.,;:\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 _0x59225c['test'](String(_0x1bee27)[_0x4174('0xb')]());}else{return![];}}; \ No newline at end of file +var _0xacbc=['join','stripTrailingSlash','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','sortBy','type','string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyType','key','format','%s:\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xacbc,0x115));var _0xcacb=function(_0x41444f,_0x12a5ae){_0x41444f=_0x41444f-0x0;var _0x40250c=_0xacbc[_0x41444f];return _0x40250c;};'use strict';var _=require(_0xcacb('0x0'));var util=require(_0xcacb('0x1'));exports[_0xcacb('0x2')]=function(_0x22b3a3,_0x13f0f3,_0x4d5ad9){var _0x559163=[];if(_0x22b3a3[_0xcacb('0x3')]>0x0){var _0x3a1e95=_[_0xcacb('0x4')](_0x22b3a3,['id']);for(var _0x2c3e91=0x0;_0x2c3e91<_0x3a1e95[_0xcacb('0x3')];_0x2c3e91++){var _0x4040f3=_0x3a1e95[_0x2c3e91];if(_0x4040f3[_0xcacb('0x5')]===_0xcacb('0x6')){_0x559163[_0xcacb('0x7')](_0x4040f3[_0xcacb('0x8')]);}else if(_0x4040f3[_0xcacb('0x5')]===_0xcacb('0x9')&&_0x4040f3[_0xcacb('0xa')]){_0x13f0f3[_0x4040f3['variableName']]&&_0x559163[_0xcacb('0x7')](_0x13f0f3[_0x4040f3[_0xcacb('0xa')]][_0xcacb('0xb')]());}else if(_0x4040f3[_0xcacb('0x5')]===_0xcacb('0xc')&&_0x4040f3[_0xcacb('0xd')]&&_0x4040f3[_0xcacb('0xd')][_0xcacb('0xe')]){_0x13f0f3[_0x4040f3[_0xcacb('0xd')]['name'][_0xcacb('0xf')]()]&&_0x559163[_0xcacb('0x7')](_0x13f0f3[_0x4040f3[_0xcacb('0xd')]['name']['toLowerCase']()][_0xcacb('0xb')]());}else if(_0x4040f3[_0xcacb('0x5')]==='keyValue'){if(_0x4040f3[_0xcacb('0x10')]===_0xcacb('0x6')&&_0x4040f3[_0xcacb('0x11')]){_0x559163[_0xcacb('0x7')](util[_0xcacb('0x12')](_0xcacb('0x13'),_0x4040f3['key'],_0x4040f3['keyContent']));}else if(_0x4040f3[_0xcacb('0x10')]===_0xcacb('0x9')&&_0x4040f3['variableName']&&_0x4040f3['key']){_0x13f0f3[_0x4040f3[_0xcacb('0xa')]]&&_0x559163[_0xcacb('0x7')](util['format'](_0xcacb('0x13'),_0x4040f3['key'],_0x13f0f3[_0x4040f3[_0xcacb('0xa')]]));}else if(_0x4040f3[_0xcacb('0x10')]===_0xcacb('0xc')&&_0x4040f3['Variable']&&_0x4040f3[_0xcacb('0xd')][_0xcacb('0xe')]&&_0x4040f3['key']){_0x13f0f3[_0x4040f3[_0xcacb('0xd')][_0xcacb('0xe')][_0xcacb('0xf')]()]&&_0x559163[_0xcacb('0x7')](util[_0xcacb('0x12')]('%s:\x20%s',_0x4040f3[_0xcacb('0x11')],_0x13f0f3[_0x4040f3['Variable'][_0xcacb('0xe')][_0xcacb('0xf')]()]));}}}}return _0x559163[_0xcacb('0x14')](_0x4d5ad9);};exports[_0xcacb('0x15')]=function(_0x2fa074){var _0x11f2a1=_0x2fa074['slice'](-0x1);if(_0x11f2a1==='/'){_0x2fa074=_0x2fa074[_0xcacb('0x16')](0x0,_0x2fa074[_0xcacb('0x17')](_0x11f2a1));}return _0x2fa074;};exports[_0xcacb('0x18')]=function(_0xd9b7b6){if(!_[_0xcacb('0x19')](_0xd9b7b6)&&_0xd9b7b6!==''){var _0x30217d=/^(([^<>()\[\]\\.,;:\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 _0x30217d[_0xcacb('0x1a')](String(_0xd9b7b6)[_0xcacb('0xf')]());}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 ac9da67..522451c 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 _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','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','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','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]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x33e982,_0x1d15b1){var _0x2d3668=function(_0x3c16d5){while(--_0x3c16d5){_0x33e982['push'](_0x33e982['shift']());}};_0x2d3668(++_0x1d15b1);}(_0xe706,0xa3));var _0x6e70=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0xe706[_0x3826ad];return _0x17b900;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file +var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x86ac2e,_0x371ed8){var _0x51700a=function(_0x16bc80){while(--_0x16bc80){_0x86ac2e['push'](_0x86ac2e['shift']());}};_0x51700a(++_0x371ed8);}(_0x9c44,0x178));var _0x49c4=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x9c44[_0x13b02f];return _0x12e9a6;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 8f7e7f3..c2d5d1a 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 _0x47f9=['string','idField','push','variable','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','[OUTBOUND]','Authorization','email','destcalleridnum','The\x20Ticket\x20ID\x20is:','monitor_format','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','ioredis','../../../../config/logger','zendesk','defaults','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST','Tags','name','getString','Subjects','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','filter','end-user','length','first','Enduser\x20found!','%s/users.json','Enduser\x20created.','password','%s:%s','username','authType','token','%s/token:%s','Basic\x20%s','toString','debug','[HTTP]','GET','map','forEach','includes','picklist','type','customField','content'];(function(_0x4c445a,_0x4ee80f){var _0x2f611c=function(_0x4f3699){while(--_0x4f3699){_0x4c445a['push'](_0x4c445a['shift']());}};_0x2f611c(++_0x4ee80f);}(_0x47f9,0x170));var _0x947f=function(_0x133937,_0x2ebfad){_0x133937=_0x133937-0x0;var _0x5e8947=_0x47f9[_0x133937];return _0x5e8947;};'use strict';var _=require(_0x947f('0x0'));var rp=require(_0x947f('0x1'));var md5=require(_0x947f('0x2'));var util=require('util');var Redis=require(_0x947f('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x947f('0x4'))(_0x947f('0x5'));config['redis']=_[_0x947f('0x6')](config[_0x947f('0x7')],{'host':_0x947f('0x8'),'port':0x18eb});var io=require(_0x947f('0x9'))(new Redis(config[_0x947f('0x7')]));function emit(_0x10e6a3,_0x478553,_0x3a9d96){io['to'](_0x10e6a3)[_0x947f('0xa')](_0x478553,_0x3a9d96);}var headers={'Content-Type':_0x947f('0xb'),'Accept':'application/json'};function getTicket(_0x404d17,_0x5048bf,_0x5eed87,_0x349baa,_0x5bd611){logger[_0x947f('0xc')](_0x947f('0xd'));return request({'uri':util['format'](_0x947f('0xe'),_0x404d17[_0x947f('0xf')]),'method':_0x947f('0x10'),'body':{'ticket':_['merge']({'requester_id':_0x5eed87['id'],'submitter_id':_0x5048bf?_0x5048bf['id']:undefined,'assignee_id':_0x5048bf?_0x5048bf['id']:undefined,'tags':getTags(_0x349baa[_0x947f('0x11')],_0x947f('0x12')),'subject':intUtil[_0x947f('0x13')](_0x349baa[_0x947f('0x14')],_0x5bd611,'\x20'),'description':intUtil['getString'](_0x349baa['Descriptions'],_0x5bd611,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x349baa['Descriptions'],_0x5bd611,'\x0a')}},getCustomFields(_0x349baa['Fields'],_0x5bd611))}})[_0x947f('0x15')](function(_0x1f934c){logger[_0x947f('0xc')](_0x947f('0x16'));return _0x1f934c[_0x947f('0x17')];});}function getUser(_0x4a9438,_0x73e474){if(intUtil[_0x947f('0x18')](_0x73e474)){logger['info'](_0x947f('0x19'),_0x73e474);return request({'uri':util[_0x947f('0x1a')](_0x947f('0x1b'),_0x4a9438['remoteUri']),'qs':{'query':util[_0x947f('0x1a')](_0x947f('0x1c'),_0x73e474)}})['then'](function(_0x19c0e5){if(_0x19c0e5[_0x947f('0x1d')]){logger['info'](_0x947f('0x1e'));return _[_0x947f('0x1f')](_0x19c0e5[_0x947f('0x20')],{'email':_0x73e474,'role':_0x947f('0x21')});}else{logger[_0x947f('0xc')](_0x947f('0x22'));return request({'uri':util[_0x947f('0x1a')](_0x947f('0x23'),_0x4a9438['remoteUri'])})[_0x947f('0x15')](function(_0x2dc7b8){logger[_0x947f('0xc')](_0x947f('0x24'));return _0x2dc7b8[_0x947f('0x25')];});}});}else{logger[_0x947f('0xc')](_0x947f('0x22'));return request({'uri':util[_0x947f('0x1a')]('%s/users/me.json',_0x4a9438[_0x947f('0xf')])})[_0x947f('0x15')](function(_0x27bec0){logger[_0x947f('0xc')]('Admin\x20account\x20selected.');return _0x27bec0[_0x947f('0x25')];});}}function getEndUser(_0x43ac5b,_0x58a69d,_0x2e8554){logger['info'](_0x947f('0x26'),_0x2e8554);return request({'uri':util[_0x947f('0x1a')](_0x947f('0x1b'),_0x43ac5b['remoteUri']),'qs':{'query':util[_0x947f('0x1a')]('type:user\x20role:end-user\x20phone:%s',_0x2e8554)}})['then'](function(_0x505c0b){var _0x433646;if(_0x505c0b[_0x947f('0x20')]['length']){_0x505c0b['results']=_[_0x947f('0x27')](_0x505c0b[_0x947f('0x20')],{'suspended':![],'role':_0x947f('0x28')});if(_0x505c0b[_0x947f('0x20')][_0x947f('0x29')]){_0x433646=_[_0x947f('0x2a')](_0x505c0b[_0x947f('0x20')]);}}if(_0x433646){logger[_0x947f('0xc')](_0x947f('0x2b'));return _0x433646;}else{logger[_0x947f('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x947f('0x1a')](_0x947f('0x2c'),_0x43ac5b[_0x947f('0xf')]),'method':'POST','body':{'user':{'role':_0x947f('0x28'),'name':util[_0x947f('0x1a')]('Caller\x20-\x20%s',_0x58a69d||_0x2e8554),'phone':_0x2e8554}}})['then'](function(_0x50c370){logger['info'](_0x947f('0x2d'));return _0x50c370[_0x947f('0x25')];});}});}function getAuth(_0x27f9a5){var _0x1f4eb0;if(_0x27f9a5['authType']===_0x947f('0x2e')){_0x1f4eb0=util['format'](_0x947f('0x2f'),_0x27f9a5[_0x947f('0x30')],_0x27f9a5['password']);}else if(_0x27f9a5[_0x947f('0x31')]===_0x947f('0x32')){_0x1f4eb0=util['format'](_0x947f('0x33'),_0x27f9a5[_0x947f('0x30')],_0x27f9a5['token']);}return util['format'](_0x947f('0x34'),new Buffer(_0x1f4eb0)[_0x947f('0x35')]('base64'));}function request(_0x4fa7d7){logger[_0x947f('0x36')](_0x947f('0x37'),JSON['stringify'](_0x4fa7d7));return rp(_[_0x947f('0x6')](_0x4fa7d7,{'method':_0x947f('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x4447f2,_0x2ecac5){var _0x19d8b6=[];if(_0x4447f2&&_0x4447f2[_0x947f('0x29')]>0x0){_0x19d8b6=_[_0x947f('0x39')](_0x4447f2,_0x2ecac5);}return _0x19d8b6;}function getCustomFields(_0x4a2661,_0x1d1132){var _0x18f6d2=[];var _0x10ac80={'custom_fields':[]};if(_0x4a2661[_0x947f('0x29')]>0x0){_[_0x947f('0x3a')](_0x4a2661,function(_0x576247){if(_[_0x947f('0x3b')](['string',_0x947f('0x3c')],_0x576247[_0x947f('0x3d')])&&_0x576247['nameField']&&!_0x576247[_0x947f('0x3e')]){_0x10ac80[_0x576247['nameField']['toLowerCase']()]=_0x576247[_0x947f('0x3f')][_0x947f('0x35')]();}else if(_[_0x947f('0x3b')]([_0x947f('0x40'),'picklist'],_0x576247[_0x947f('0x3d')])&&_0x576247[_0x947f('0x41')]&&_0x576247[_0x947f('0x3e')]){_0x10ac80['custom_fields'][_0x947f('0x42')]({'id':_0x576247[_0x947f('0x41')],'value':_0x576247['content'][_0x947f('0x35')]()});}else if(_0x576247[_0x947f('0x3d')]===_0x947f('0x43')&&_0x576247['variableName']&&_0x576247[_0x947f('0x41')]&&_0x576247[_0x947f('0x3e')]){_0x1d1132[_0x576247['variableName']]&&_0x10ac80['custom_fields']['push']({'id':_0x576247['idField'],'value':_0x1d1132[_0x576247['variableName']][_0x947f('0x35')]()});}else if(_0x576247['type']===_0x947f('0x44')&&_0x576247['Variable']&&_0x576247[_0x947f('0x45')][_0x947f('0x12')]&&_0x576247['idField']&&_0x576247['customField']){_0x1d1132[_0x576247['Variable'][_0x947f('0x12')][_0x947f('0x46')]()]&&_0x10ac80['custom_fields'][_0x947f('0x42')]({'id':_0x576247['idField'],'value':_0x1d1132[_0x576247[_0x947f('0x45')][_0x947f('0x12')][_0x947f('0x46')]()][_0x947f('0x35')]()});}});}return _0x10ac80;}exports[_0x947f('0x47')]=function(_0x1cd68a,_0x47a499,_0x2b31ff,_0x70bf2c,_0x3d2a6d,_0x2585fb){var _0x2a428d,_0x1f547b;_0x2585fb[_0x947f('0xf')]=intUtil[_0x947f('0x48')](_0x2585fb[_0x947f('0xf')]);_0x2585fb['serverUrl']=intUtil[_0x947f('0x48')](_0x2585fb['serverUrl']);if(_0x3d2a6d&&_0x3d2a6d['monitor_format']){logger[_0x947f('0xc')](_0x947f('0x49'),_0x947f('0x4a'));_0x47a499[_0x947f('0x4b')]=util[_0x947f('0x1a')](_0x947f('0x4c'),_0x2585fb[_0x947f('0x4d')],_0x47a499[_0x947f('0x4e')],md5(_0x47a499['uniqueid']));}else{_0x47a499[_0x947f('0x4b')]='';}headers['Authorization']=getAuth(_0x2585fb);return getUser(_0x2585fb,_0x70bf2c['email'])['then'](function(_0xd5bb06){_0x2a428d=_0xd5bb06;logger[_0x947f('0xc')](_0x947f('0x4f'),_0x2a428d['id']);return getEndUser(_0x2585fb,_0x47a499[_0x947f('0x50')],_0x47a499[_0x947f('0x51')]);})[_0x947f('0x15')](function(_0x4531fb){_0x1f547b=_0x4531fb;logger['info'](_0x947f('0x52'),_0x1f547b['id']);return getTicket(_0x2585fb,_0x2a428d,_0x1f547b,_0x2b31ff,_0x47a499);})[_0x947f('0x15')](function(_0x5b26f8){if(_0x5b26f8){logger[_0x947f('0xc')]('The\x20Ticket\x20ID\x20is:',_0x5b26f8['id']);switch(_0x2585fb[_0x947f('0x3d')]){case _0x947f('0x53'):logger[_0x947f('0xc')](_0x947f('0x49'),_0x947f('0x54'));return request({'uri':util[_0x947f('0x1a')](_0x947f('0x55'),_0x2585fb['remoteUri'],_0x2a428d['id'],_0x5b26f8['id']),'method':_0x947f('0x10')});case _0x947f('0x56'):logger[_0x947f('0xc')](_0x947f('0x49'),_0x947f('0x57'));emit(util[_0x947f('0x1a')](_0x947f('0x58'),_0x70bf2c[_0x947f('0x12')]),_0x947f('0x59'),{'uri':util['format'](_0x947f('0x5a'),_0x2585fb['remoteUri'][_0x947f('0x5b')](_0x947f('0x5c'),''),_0x5b26f8['id'])});break;default:logger[_0x947f('0x5d')](_0x947f('0x49'),_0x947f('0x5e'));}}})[_0x947f('0x5f')](function(_0x30bb8f){logger[_0x947f('0x5d')](_0x947f('0x60'),util[_0x947f('0x61')](_0x30bb8f,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x43ebb7,_0x2698e3,_0x52514e,_0x19b7f3,_0x4054a9,_0x5efb3f,_0x43e902){var _0x49c649,_0x24a9d0;_0x5efb3f[_0x947f('0xf')]=intUtil[_0x947f('0x48')](_0x5efb3f[_0x947f('0xf')]);_0x5efb3f[_0x947f('0x4d')]=intUtil[_0x947f('0x48')](_0x5efb3f[_0x947f('0x4d')]);if(_0x43e902&&_0x43e902[_0x947f('0x62')]&&_0x43e902[_0x947f('0x62')]!==_0x947f('0x63')){logger[_0x947f('0xc')](_0x947f('0x64'),_0x947f('0x4a'));_0x2698e3[_0x947f('0x4b')]=util[_0x947f('0x1a')](_0x947f('0x4c'),_0x5efb3f['serverUrl'],_0x2698e3[_0x947f('0x4e')],md5(_0x2698e3[_0x947f('0x4e')]));}headers[_0x947f('0x65')]=getAuth(_0x5efb3f);return getUser(_0x5efb3f,_0x19b7f3[_0x947f('0x66')])['then'](function(_0x244980){_0x49c649=_0x244980;logger[_0x947f('0xc')]('The\x20User\x20ID\x20is:',_0x49c649['id']);return getEndUser(_0x5efb3f,_0x2698e3['destcalleridname'],_0x2698e3[_0x947f('0x67')]);})[_0x947f('0x15')](function(_0x412c52){_0x24a9d0=_0x412c52;logger[_0x947f('0xc')](_0x947f('0x52'),_0x24a9d0['id']);return getTicket(_0x5efb3f,_0x49c649,_0x24a9d0,_0x52514e,_0x2698e3);})[_0x947f('0x15')](function(_0x430983){if(_0x430983){logger['info'](_0x947f('0x68'),_0x430983['id']);switch(_0x5efb3f[_0x947f('0x3d')]){case _0x947f('0x53'):logger[_0x947f('0xc')]('[OUTBOUND]',_0x947f('0x54'));return request({'uri':util[_0x947f('0x1a')](_0x947f('0x55'),_0x5efb3f[_0x947f('0xf')],_0x49c649['id'],_0x430983['id']),'method':_0x947f('0x10')});case _0x947f('0x56'):logger[_0x947f('0xc')](_0x947f('0x64'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x947f('0x1a')](_0x947f('0x58'),_0x19b7f3[_0x947f('0x12')]),_0x947f('0x59'),{'uri':util[_0x947f('0x1a')](_0x947f('0x5a'),_0x5efb3f[_0x947f('0xf')]['replace'](_0x947f('0x5c'),''),_0x430983['id'])});break;default:logger[_0x947f('0x5d')]('[OUTBOUND]',_0x947f('0x5e'));}}})['catch'](function(_0x2979a5){logger['error']('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x947f('0x61')](_0x2979a5,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x3384b4,_0xaec7a4,_0x174240,_0x1de3e4,_0x124d92,_0x262de8){var _0x53dfe0,_0x3daf6b;_0x262de8[_0x947f('0xf')]=intUtil[_0x947f('0x48')](_0x262de8[_0x947f('0xf')]);_0x262de8[_0x947f('0x4d')]=intUtil[_0x947f('0x48')](_0x262de8[_0x947f('0x4d')]);if(_0x124d92&&_0x124d92[_0x947f('0x69')]){logger['info']('['+_0xaec7a4[_0x947f('0x6a')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0xaec7a4[_0x947f('0x4b')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x262de8[_0x947f('0x4d')],_0xaec7a4[_0x947f('0x4e')],md5(_0xaec7a4[_0x947f('0x4e')]));}else{_0xaec7a4[_0x947f('0x4b')]='';}headers[_0x947f('0x65')]=getAuth(_0x262de8);return getUser(_0x262de8)[_0x947f('0x15')](function(_0x304231){_0x53dfe0=_0x304231;logger[_0x947f('0xc')](_0x947f('0x4f'),_0x53dfe0['id']);return getEndUser(_0x262de8,_0xaec7a4[_0x947f('0x50')],_0xaec7a4[_0x947f('0x51')]);})[_0x947f('0x15')](function(_0x33534f){_0x3daf6b=_0x33534f;logger[_0x947f('0xc')](_0x947f('0x52'),_0x3daf6b['id']);return getTicket(_0x262de8,_0x53dfe0,_0x3daf6b,_0x174240,_0xaec7a4);})['then'](function(_0x40eb47){if(_0x40eb47){logger[_0x947f('0xc')]('The\x20Ticket\x20ID\x20is:',_0x40eb47['id']);}})[_0x947f('0x5f')](function(_0x50d71b){logger[_0x947f('0x5d')]('['+_0xaec7a4[_0x947f('0x6a')]['toUpperCase']()+']'+_0x947f('0x6b'),util[_0x947f('0x61')](_0x50d71b,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xc64b=['nameField','toLowerCase','content','string','picklist','type','idField','push','variable','variableName','custom_fields','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','inspect','unmanaged','lastevent','toUpperCase','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','format','remoteUri','name','getString','Subjects','Descriptions','Fields','then','ticket','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','results','end-user','length','first','Enduser\x20found!','%s/users.json','POST','Caller\x20-\x20%s','Enduser\x20created.','password','%s:%s','username','authType','token','%s/token:%s','Basic\x20%s','toString','base64','[HTTP]','defaults','GET','forEach','includes','customField'];(function(_0x7f9e67,_0x5c1622){var _0x46f013=function(_0x333fd7){while(--_0x333fd7){_0x7f9e67['push'](_0x7f9e67['shift']());}};_0x46f013(++_0x5c1622);}(_0xc64b,0x9e));var _0xbc64=function(_0x5b8646,_0x3e1589){_0x5b8646=_0x5b8646-0x0;var _0x363e4c=_0xc64b[_0x5b8646];return _0x363e4c;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xbc64('0x0'));var util=require(_0xbc64('0x1'));var Redis=require(_0xbc64('0x2'));var intUtil=require(_0xbc64('0x3'));var config=require(_0xbc64('0x4'));var logger=require(_0xbc64('0x5'))('zendesk');config[_0xbc64('0x6')]=_['defaults'](config[_0xbc64('0x6')],{'host':_0xbc64('0x7'),'port':0x18eb});var io=require(_0xbc64('0x8'))(new Redis(config['redis']));function emit(_0x1ecd89,_0x48a614,_0x468768){io['to'](_0x1ecd89)[_0xbc64('0x9')](_0x48a614,_0x468768);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getTicket(_0x1617c2,_0x2ef2fd,_0xcd5580,_0x19b389,_0x109a3c){logger[_0xbc64('0xa')](_0xbc64('0xb'));return request({'uri':util[_0xbc64('0xc')]('%s/tickets.json',_0x1617c2[_0xbc64('0xd')]),'method':'POST','body':{'ticket':_['merge']({'requester_id':_0xcd5580['id'],'submitter_id':_0x2ef2fd?_0x2ef2fd['id']:undefined,'assignee_id':_0x2ef2fd?_0x2ef2fd['id']:undefined,'tags':getTags(_0x19b389['Tags'],_0xbc64('0xe')),'subject':intUtil[_0xbc64('0xf')](_0x19b389[_0xbc64('0x10')],_0x109a3c,'\x20'),'description':intUtil['getString'](_0x19b389[_0xbc64('0x11')],_0x109a3c,'\x0a'),'comment':{'public':![],'body':intUtil[_0xbc64('0xf')](_0x19b389[_0xbc64('0x11')],_0x109a3c,'\x0a')}},getCustomFields(_0x19b389[_0xbc64('0x12')],_0x109a3c))}})[_0xbc64('0x13')](function(_0x2a7c78){logger[_0xbc64('0xa')]('Ticket\x20created!');return _0x2a7c78[_0xbc64('0x14')];});}function getUser(_0x4745fc,_0x4a4e4c){if(intUtil['validateEmail'](_0x4a4e4c)){logger[_0xbc64('0xa')](_0xbc64('0x15'),_0x4a4e4c);return request({'uri':util[_0xbc64('0xc')](_0xbc64('0x16'),_0x4745fc[_0xbc64('0xd')]),'qs':{'query':util[_0xbc64('0xc')](_0xbc64('0x17'),_0x4a4e4c)}})[_0xbc64('0x13')](function(_0x175e50){if(_0x175e50[_0xbc64('0x18')]){logger['info'](_0xbc64('0x19'));return _[_0xbc64('0x1a')](_0x175e50['results'],{'email':_0x4a4e4c,'role':'agent'});}else{logger[_0xbc64('0xa')](_0xbc64('0x1b'));return request({'uri':util[_0xbc64('0xc')](_0xbc64('0x1c'),_0x4745fc[_0xbc64('0xd')])})[_0xbc64('0x13')](function(_0x500f82){logger[_0xbc64('0xa')](_0xbc64('0x1d'));return _0x500f82['user'];});}});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0xbc64('0x1c'),_0x4745fc[_0xbc64('0xd')])})[_0xbc64('0x13')](function(_0x1c58c9){logger[_0xbc64('0xa')]('Admin\x20account\x20selected.');return _0x1c58c9[_0xbc64('0x1e')];});}}function getEndUser(_0x53370f,_0x10bfee,_0x1af1be){logger[_0xbc64('0xa')](_0xbc64('0x1f'),_0x1af1be);return request({'uri':util[_0xbc64('0xc')](_0xbc64('0x16'),_0x53370f[_0xbc64('0xd')]),'qs':{'query':util[_0xbc64('0xc')]('type:user\x20role:end-user\x20phone:%s',_0x1af1be)}})['then'](function(_0x519b54){var _0x5a40cb;if(_0x519b54['results']['length']){_0x519b54[_0xbc64('0x20')]=_['filter'](_0x519b54[_0xbc64('0x20')],{'suspended':![],'role':_0xbc64('0x21')});if(_0x519b54[_0xbc64('0x20')][_0xbc64('0x22')]){_0x5a40cb=_[_0xbc64('0x23')](_0x519b54[_0xbc64('0x20')]);}}if(_0x5a40cb){logger[_0xbc64('0xa')](_0xbc64('0x24'));return _0x5a40cb;}else{logger[_0xbc64('0xa')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xbc64('0xc')](_0xbc64('0x25'),_0x53370f[_0xbc64('0xd')]),'method':_0xbc64('0x26'),'body':{'user':{'role':'end-user','name':util[_0xbc64('0xc')](_0xbc64('0x27'),_0x10bfee||_0x1af1be),'phone':_0x1af1be}}})['then'](function(_0x4d4009){logger[_0xbc64('0xa')](_0xbc64('0x28'));return _0x4d4009[_0xbc64('0x1e')];});}});}function getAuth(_0x455854){var _0x46a45e;if(_0x455854['authType']===_0xbc64('0x29')){_0x46a45e=util[_0xbc64('0xc')](_0xbc64('0x2a'),_0x455854[_0xbc64('0x2b')],_0x455854['password']);}else if(_0x455854[_0xbc64('0x2c')]===_0xbc64('0x2d')){_0x46a45e=util[_0xbc64('0xc')](_0xbc64('0x2e'),_0x455854[_0xbc64('0x2b')],_0x455854[_0xbc64('0x2d')]);}return util['format'](_0xbc64('0x2f'),new Buffer(_0x46a45e)[_0xbc64('0x30')](_0xbc64('0x31')));}function request(_0x1b994c){logger['debug'](_0xbc64('0x32'),JSON['stringify'](_0x1b994c));return rp(_[_0xbc64('0x33')](_0x1b994c,{'method':_0xbc64('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x1efaaf,_0x4e9138){var _0x2201a8=[];if(_0x1efaaf&&_0x1efaaf[_0xbc64('0x22')]>0x0){_0x2201a8=_['map'](_0x1efaaf,_0x4e9138);}return _0x2201a8;}function getCustomFields(_0x3155e5,_0x23bbca){var _0x3705ab=[];var _0x3140eb={'custom_fields':[]};if(_0x3155e5[_0xbc64('0x22')]>0x0){_[_0xbc64('0x35')](_0x3155e5,function(_0x47041f){if(_[_0xbc64('0x36')](['string','picklist'],_0x47041f['type'])&&_0x47041f['nameField']&&!_0x47041f[_0xbc64('0x37')]){_0x3140eb[_0x47041f[_0xbc64('0x38')][_0xbc64('0x39')]()]=_0x47041f[_0xbc64('0x3a')][_0xbc64('0x30')]();}else if(_[_0xbc64('0x36')]([_0xbc64('0x3b'),_0xbc64('0x3c')],_0x47041f[_0xbc64('0x3d')])&&_0x47041f[_0xbc64('0x3e')]&&_0x47041f[_0xbc64('0x37')]){_0x3140eb['custom_fields'][_0xbc64('0x3f')]({'id':_0x47041f[_0xbc64('0x3e')],'value':_0x47041f[_0xbc64('0x3a')][_0xbc64('0x30')]()});}else if(_0x47041f[_0xbc64('0x3d')]===_0xbc64('0x40')&&_0x47041f[_0xbc64('0x41')]&&_0x47041f[_0xbc64('0x3e')]&&_0x47041f['customField']){_0x23bbca[_0x47041f[_0xbc64('0x41')]]&&_0x3140eb[_0xbc64('0x42')][_0xbc64('0x3f')]({'id':_0x47041f['idField'],'value':_0x23bbca[_0x47041f[_0xbc64('0x41')]][_0xbc64('0x30')]()});}else if(_0x47041f[_0xbc64('0x3d')]===_0xbc64('0x43')&&_0x47041f[_0xbc64('0x44')]&&_0x47041f[_0xbc64('0x44')][_0xbc64('0xe')]&&_0x47041f[_0xbc64('0x3e')]&&_0x47041f['customField']){_0x23bbca[_0x47041f[_0xbc64('0x44')][_0xbc64('0xe')][_0xbc64('0x39')]()]&&_0x3140eb[_0xbc64('0x42')]['push']({'id':_0x47041f[_0xbc64('0x3e')],'value':_0x23bbca[_0x47041f['Variable'][_0xbc64('0xe')]['toLowerCase']()][_0xbc64('0x30')]()});}});}return _0x3140eb;}exports[_0xbc64('0x45')]=function(_0x1ecf05,_0x1c8b68,_0x44c72e,_0x3db119,_0x3fddc6,_0x41de4c){var _0x279788,_0xc50df1;_0x41de4c[_0xbc64('0xd')]=intUtil[_0xbc64('0x46')](_0x41de4c['remoteUri']);_0x41de4c['serverUrl']=intUtil[_0xbc64('0x46')](_0x41de4c[_0xbc64('0x47')]);if(_0x3fddc6&&_0x3fddc6[_0xbc64('0x48')]){logger[_0xbc64('0xa')]('[QUEUE]',_0xbc64('0x49'));_0x1c8b68[_0xbc64('0x4a')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x41de4c[_0xbc64('0x47')],_0x1c8b68[_0xbc64('0x4b')],md5(_0x1c8b68[_0xbc64('0x4b')]));}else{_0x1c8b68['recordingURL']='';}headers['Authorization']=getAuth(_0x41de4c);return getUser(_0x41de4c,_0x3db119['email'])[_0xbc64('0x13')](function(_0x24f6aa){_0x279788=_0x24f6aa;logger[_0xbc64('0xa')](_0xbc64('0x4c'),_0x279788['id']);return getEndUser(_0x41de4c,_0x1c8b68[_0xbc64('0x4d')],_0x1c8b68[_0xbc64('0x4e')]);})[_0xbc64('0x13')](function(_0x1d575b){_0xc50df1=_0x1d575b;logger[_0xbc64('0xa')](_0xbc64('0x4f'),_0xc50df1['id']);return getTicket(_0x41de4c,_0x279788,_0xc50df1,_0x44c72e,_0x1c8b68);})[_0xbc64('0x13')](function(_0x2fa73e){if(_0x2fa73e){logger[_0xbc64('0xa')](_0xbc64('0x50'),_0x2fa73e['id']);switch(_0x41de4c['type']){case _0xbc64('0x51'):logger[_0xbc64('0xa')](_0xbc64('0x52'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xbc64('0xc')](_0xbc64('0x53'),_0x41de4c[_0xbc64('0xd')],_0x279788['id'],_0x2fa73e['id']),'method':_0xbc64('0x26')});case _0xbc64('0x54'):logger[_0xbc64('0xa')](_0xbc64('0x52'),_0xbc64('0x55'));emit(util[_0xbc64('0xc')](_0xbc64('0x56'),_0x3db119['name']),_0xbc64('0x57'),{'uri':util[_0xbc64('0xc')](_0xbc64('0x58'),_0x41de4c['remoteUri'][_0xbc64('0x59')](_0xbc64('0x5a'),''),_0x2fa73e['id'])});break;default:logger[_0xbc64('0x5b')]('[QUEUE]',_0xbc64('0x5c'));}}})[_0xbc64('0x5d')](function(_0xe6cda8){logger[_0xbc64('0x5b')](_0xbc64('0x5e'),util['inspect'](_0xe6cda8,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x486cb0,_0x83a6d2,_0x52c57e,_0x1ab6c8,_0x217e61,_0x107f78,_0xcd0420){var _0x32cdec,_0x5d2ce4;_0x107f78[_0xbc64('0xd')]=intUtil[_0xbc64('0x46')](_0x107f78['remoteUri']);_0x107f78['serverUrl']=intUtil[_0xbc64('0x46')](_0x107f78[_0xbc64('0x47')]);if(_0xcd0420&&_0xcd0420[_0xbc64('0x5f')]&&_0xcd0420[_0xbc64('0x5f')]!=='none'){logger['info'](_0xbc64('0x60'),_0xbc64('0x49'));_0x83a6d2[_0xbc64('0x4a')]=util[_0xbc64('0xc')](_0xbc64('0x61'),_0x107f78['serverUrl'],_0x83a6d2[_0xbc64('0x4b')],md5(_0x83a6d2[_0xbc64('0x4b')]));}headers[_0xbc64('0x62')]=getAuth(_0x107f78);return getUser(_0x107f78,_0x1ab6c8[_0xbc64('0x63')])[_0xbc64('0x13')](function(_0x29d78f){_0x32cdec=_0x29d78f;logger[_0xbc64('0xa')](_0xbc64('0x4c'),_0x32cdec['id']);return getEndUser(_0x107f78,_0x83a6d2[_0xbc64('0x64')],_0x83a6d2[_0xbc64('0x65')]);})[_0xbc64('0x13')](function(_0x2a8fc7){_0x5d2ce4=_0x2a8fc7;logger[_0xbc64('0xa')](_0xbc64('0x4f'),_0x5d2ce4['id']);return getTicket(_0x107f78,_0x32cdec,_0x5d2ce4,_0x52c57e,_0x83a6d2);})['then'](function(_0x1d8ed1){if(_0x1d8ed1){logger['info'](_0xbc64('0x50'),_0x1d8ed1['id']);switch(_0x107f78['type']){case'integrationTab':logger[_0xbc64('0xa')](_0xbc64('0x60'),_0xbc64('0x66'));return request({'uri':util[_0xbc64('0xc')](_0xbc64('0x53'),_0x107f78[_0xbc64('0xd')],_0x32cdec['id'],_0x1d8ed1['id']),'method':'POST'});case _0xbc64('0x54'):logger[_0xbc64('0xa')](_0xbc64('0x60'),_0xbc64('0x55'));emit(util[_0xbc64('0xc')]('user:%s',_0x1ab6c8[_0xbc64('0xe')]),'trigger:browser:url',{'uri':util[_0xbc64('0xc')](_0xbc64('0x58'),_0x107f78['remoteUri']['replace'](_0xbc64('0x5a'),''),_0x1d8ed1['id'])});break;default:logger[_0xbc64('0x5b')]('[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xbc64('0x5d')](function(_0x1e0cb1){logger[_0xbc64('0x5b')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0xbc64('0x67')](_0x1e0cb1,{'showHidden':!![],'depth':null}));});};exports[_0xbc64('0x68')]=function(_0x366049,_0x410be6,_0x17cd33,_0x450732,_0x38cea4,_0x3104c6){var _0x49ca0b,_0x3f59a1;_0x3104c6[_0xbc64('0xd')]=intUtil[_0xbc64('0x46')](_0x3104c6[_0xbc64('0xd')]);_0x3104c6[_0xbc64('0x47')]=intUtil[_0xbc64('0x46')](_0x3104c6['serverUrl']);if(_0x38cea4&&_0x38cea4[_0xbc64('0x48')]){logger[_0xbc64('0xa')]('['+_0x410be6[_0xbc64('0x69')][_0xbc64('0x6a')]()+']',_0xbc64('0x49'));_0x410be6['recordingURL']=util[_0xbc64('0xc')](_0xbc64('0x61'),_0x3104c6[_0xbc64('0x47')],_0x410be6[_0xbc64('0x4b')],md5(_0x410be6['uniqueid']));}else{_0x410be6[_0xbc64('0x4a')]='';}headers[_0xbc64('0x62')]=getAuth(_0x3104c6);return getUser(_0x3104c6)[_0xbc64('0x13')](function(_0x489bea){_0x49ca0b=_0x489bea;logger[_0xbc64('0xa')](_0xbc64('0x4c'),_0x49ca0b['id']);return getEndUser(_0x3104c6,_0x410be6[_0xbc64('0x4d')],_0x410be6['calleridnum']);})[_0xbc64('0x13')](function(_0x3e1ff6){_0x3f59a1=_0x3e1ff6;logger[_0xbc64('0xa')]('The\x20Enduser\x20ID\x20is:',_0x3f59a1['id']);return getTicket(_0x3104c6,_0x49ca0b,_0x3f59a1,_0x17cd33,_0x410be6);})[_0xbc64('0x13')](function(_0xdb8ad7){if(_0xdb8ad7){logger[_0xbc64('0xa')](_0xbc64('0x50'),_0xdb8ad7['id']);}})[_0xbc64('0x5d')](function(_0x58bc4a){logger[_0xbc64('0x5b')]('['+_0x410be6['lastevent'][_0xbc64('0x6a')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0xbc64('0x67')](_0x58bc4a,{'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 f8a371e..c2d2ec4 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 _0x7cba=['recordingFormat','none','[OUTBOUND]','com','The\x20User\x20ID\x20is:','destcalleridnum','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','unmanaged','toUpperCase','lodash','request-promise','moment','bluebird','defaults','redis','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','includes','string','picklist','type','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','isBefore','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','refreshToken','clientId','clientSecret','refresh_token','add','expires_in','seconds','Failing\x20creating\x20the\x20access_token','stack','info','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','then','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','user','profile','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','enduserType','POST','https://www.zohoapis.','startCase','role','first_name','data','details','moduleCreate','log','CREATE\x20ERROR','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','Contacts','lead','Owner','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','Call_Duration','mm:ss','answertime','endtime','utc','diff','format','lastevent','called','Called','complete','connect','Call_Result','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Call_Start_Time','starttime','YYYY-MM-DDTHH:mm:ss','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','host','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','calleridname','calleridnum','The\x20Call\x20ID\x20is:','[QUEUE]','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id='];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7cba,0x1ca));var _0xa7cb=function(_0x35cd57,_0x130e6c){_0x35cd57=_0x35cd57-0x0;var _0x3915ee=_0x7cba[_0x35cd57];return _0x3915ee;};'use strict';var _=require(_0xa7cb('0x0'));var rp=require(_0xa7cb('0x1'));var md5=require('md5');var util=require('util');var intUtil=require('./util');var moment=require(_0xa7cb('0x2'));var Redis=require('ioredis');var BPromise=require(_0xa7cb('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('zoho');config['redis']=_[_0xa7cb('0x4')](config[_0xa7cb('0x5')],{'host':_0xa7cb('0x6'),'port':0x18eb});var io=require(_0xa7cb('0x7'))(new Redis(config['redis']));function emit(_0x43870e,_0x55ed7a,_0x1b3b83){io['to'](_0x43870e)[_0xa7cb('0x8')](_0x55ed7a,_0x1b3b83);}function request(_0x28a66e){logger[_0xa7cb('0x9')](_0xa7cb('0xa'),JSON[_0xa7cb('0xb')](_0x28a66e));return rp(_0x28a66e);}function getCustomFields(_0x5d3d89,_0x10cfcf){var _0x5e7357={};if(_0x5d3d89[_0xa7cb('0xc')]>0x0){_[_0xa7cb('0xd')](_0x5d3d89,function(_0x9fd736){if(_[_0xa7cb('0xe')]([_0xa7cb('0xf'),_0xa7cb('0x10')],_0x9fd736[_0xa7cb('0x11')])&&_0x9fd736[_0xa7cb('0x12')]){_0x5e7357[_0x9fd736[_0xa7cb('0x12')]]=_0x9fd736[_0xa7cb('0x13')]['toString']();}else if(_0x9fd736['type']===_0xa7cb('0x14')&&_0x9fd736[_0xa7cb('0x15')]&&_0x9fd736[_0xa7cb('0x12')]&&_0x10cfcf[_0x9fd736[_0xa7cb('0x15')]]){_0x5e7357[_0x9fd736[_0xa7cb('0x12')]]=_0x10cfcf[_0x9fd736[_0xa7cb('0x15')]][_0xa7cb('0x16')]();}else if(_0x9fd736[_0xa7cb('0x11')]===_0xa7cb('0x17')&&_0x9fd736[_0xa7cb('0x18')]&&_0x9fd736['Variable']['name']&&_0x9fd736['idField']&&_0x10cfcf[_0x9fd736[_0xa7cb('0x18')][_0xa7cb('0x19')][_0xa7cb('0x1a')]()]){_0x5e7357[_0x9fd736[_0xa7cb('0x12')]]=_0x10cfcf[_0x9fd736[_0xa7cb('0x18')]['name'][_0xa7cb('0x1a')]()][_0xa7cb('0x16')]();}});}return _0x5e7357;}function getName(_0x53adcd){if(_0x53adcd[_0xa7cb('0x1b')]('\x20')>0x0){var _0x5c0206=_0x53adcd[_0xa7cb('0x1c')](/ (.+)/);if(_0x5c0206[0x1]){return _0x5c0206;}}return[_0x53adcd,_0x53adcd];}var accountsTokens={};function getAccessToken(_0x2ce4f4){return new Promise(function(_0x2c7937,_0xbf6212){if(!_['isNil'](accountsTokens[_0x2ce4f4['id']])&&!_[_0xa7cb('0x1d')](accountsTokens[_0x2ce4f4['id']]['access_token'])){if(moment()[_0xa7cb('0x1e')](accountsTokens[_0x2ce4f4['id']]['expires_in'])){_0x2c7937(accountsTokens[_0x2ce4f4['id']]['access_token']);}}var _0xd41736;switch(_0x2ce4f4['zone']){case'US':_0xd41736=_0xa7cb('0x1f');break;case'AU':_0xd41736=_0xa7cb('0x20');break;case'EU':_0xd41736=_0xa7cb('0x21');break;case'IN':_0xd41736='https://accounts.zoho.in';break;case'CN':_0xd41736=_0xa7cb('0x22');break;default:_0xd41736=_0xa7cb('0x21');break;}var _0x16ef85={'method':'POST','uri':_0xd41736+'/oauth/v2/token','qs':{'refresh_token':_0x2ce4f4[_0xa7cb('0x23')],'client_id':_0x2ce4f4[_0xa7cb('0x24')],'client_secret':_0x2ce4f4[_0xa7cb('0x25')],'grant_type':_0xa7cb('0x26')},'json':!![]};return rp(_0x16ef85)['then'](function(_0x38ae3d){accountsTokens[_0x2ce4f4['id']]={'access_token':_0x38ae3d['access_token'],'expires_in':moment()[_0xa7cb('0x27')](_0x38ae3d[_0xa7cb('0x28')],_0xa7cb('0x29'))};_0x2c7937(_0x38ae3d['access_token']);})['catch'](function(_0xc62f84){logger['error'](_0xa7cb('0x2a'),_0xc62f84[_0xa7cb('0x2b')]);_0xbf6212(_0xc62f84);});});}function getUser(_0x5a9836,_0x1a0104,_0x1a1049,_0x129480){logger[_0xa7cb('0x2c')]('Search\x20user');return request({'method':_0xa7cb('0x2d'),'uri':util['format'](_0xa7cb('0x2e'),_0x1a0104),'qs':{'type':_0xa7cb('0x2f')},'headers':{'Authorization':_0xa7cb('0x30')+_0x5a9836},'json':!![]})[_0xa7cb('0x31')](function(_0x56c27d){if(_0x56c27d[_0xa7cb('0x32')]){var _0x35f573=-0x1;if(_['isArrayLikeObject'](_0x56c27d['users'])){if(!_['isNil'](_0x129480)){_0x35f573=_[_0xa7cb('0x33')](_0x56c27d[_0xa7cb('0x32')],function(_0x2d2919){return _0x2d2919[_0xa7cb('0x34')]===_0x129480;});}if(_0x35f573>=0x0){logger['info'](_0xa7cb('0x35'));}else{logger['info'](_0xa7cb('0x36'));_0x35f573=_[_0xa7cb('0x33')](_0x56c27d[_0xa7cb('0x32')],function(_0x2ee760){return _0x2ee760['profile'][_0xa7cb('0x19')]===_0xa7cb('0x37');});}return _0x56c27d[_0xa7cb('0x32')][_0x35f573];}else{if(_0x56c27d[_0xa7cb('0x38')][_0xa7cb('0x39')][_0xa7cb('0x19')]===_0xa7cb('0x37')){logger[_0xa7cb('0x2c')](_0xa7cb('0x36'));user=_0x56c27d[_0xa7cb('0x38')];return user;}else{logger[_0xa7cb('0x3a')](_0xa7cb('0x3b'),JSON[_0xa7cb('0xb')](_0x56c27d));throw new Error(_0xa7cb('0x3c')+JSON[_0xa7cb('0xb')](_0x56c27d));}}}else{logger[_0xa7cb('0x3a')](_0xa7cb('0x3b'),JSON[_0xa7cb('0xb')](_0x56c27d));throw new Error(_0xa7cb('0x3c')+JSON[_0xa7cb('0xb')](_0x56c27d));}})[_0xa7cb('0x3d')](function(_0x50aa6c){console[_0xa7cb('0x3a')](_0x50aa6c);});}function getZohoUser(_0x256db3,_0x449b3c){return new BPromise(function(_0x2b1e7f,_0x2ef656){request(_0x256db3)['then'](function(_0x250746){var _0xa4c400=null;if(_0x250746){_0xa4c400=_0x250746['data'][0x0];_0xa4c400[_0xa7cb('0x3e')]=_0x449b3c;}_0x2b1e7f(_0xa4c400);})[_0xa7cb('0x3d')](function(_0x2472c4){_0x2ef656(_0x2472c4);});});}function createEndUser(_0x388105,_0x37b765,_0x43ed78,_0x510f32,_0x176480,_0x32b5fb){var _0x43ed78=getName(_0x43ed78);return request({'method':_0xa7cb('0x3f'),'uri':_0xa7cb('0x40')+_0x37b765+'/crm/v2/'+_[_0xa7cb('0x41')](_0x32b5fb['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x43ed78[0x1],'First_Name':_0x43ed78[0x0],'Phone':_0x510f32,'Owner':{'name':!_[_0xa7cb('0x1d')](_0x176480[_0xa7cb('0x42')][_0xa7cb('0x19')])?_0x176480[_0xa7cb('0x42')][_0xa7cb('0x19')]:!_[_0xa7cb('0x1d')](_0x176480[_0xa7cb('0x43')])?_0x176480[_0xa7cb('0x43')]+'\x20'+_0x176480['last_name']:_0x176480['last_name'],'id':_0x176480['id']}}]},'headers':{'Authorization':_0xa7cb('0x30')+_0x388105},'json':!![]})['then'](function(_0x3128d6){if(_0x3128d6&&_0x3128d6['data'][0x0]['code']==='SUCCESS'){var _0x5b3465=_0x3128d6[_0xa7cb('0x44')][0x0][_0xa7cb('0x45')];_0x5b3465[_0xa7cb('0x3e')]=_[_0xa7cb('0x41')](_0x32b5fb[_0xa7cb('0x46')])+'s';return _0x5b3465;}logger[_0xa7cb('0x3a')](_0xa7cb('0x3b'),JSON[_0xa7cb('0xb')](data));throw new Error('Error:\x20'+JSON[_0xa7cb('0xb')](data));})[_0xa7cb('0x3d')](function(_0x252c2d){console[_0xa7cb('0x47')](_0xa7cb('0x48'),_0x252c2d);});}function getEndUser(_0x3ac128,_0x1f16f2,_0x3ee967,_0x118165,_0x422bec,_0x2274b3,_0xd524cd){var _0xa5871e={'method':_0xa7cb('0x2d'),'uri':'','headers':{'Authorization':_0xa7cb('0x30')+_0x3ac128},'json':!![]};switch(_0xd524cd['moduleSearch']){case'contact_lead':_0xa5871e[_0xa7cb('0x49')]=_0xa7cb('0x40')+_0x1f16f2+_0xa7cb('0x4a')+_0x422bec+'))';return getZohoUser(_0xa5871e,'Contacts')[_0xa7cb('0x31')](function(_0x7da03b){if(_0x7da03b)return _0x7da03b;_0xa5871e[_0xa7cb('0x49')]=_0xa7cb('0x40')+_0x1f16f2+_0xa7cb('0x4b')+_0x422bec+'))';return getZohoUser(_0xa5871e,_0xa7cb('0x4c'))['then'](function(_0x2020ff){if(_0x2020ff)return _0x2020ff;if(_0xd524cd[_0xa7cb('0x46')]!=_0xa7cb('0x4d')){return createEndUser(_0x3ac128,_0x1f16f2,_0x118165,_0x422bec,_0x2274b3,_0xd524cd);}else{return{};}});});break;case _0xa7cb('0x4e'):_0xa5871e['uri']=_0xa7cb('0x40')+_0x1f16f2+_0xa7cb('0x4a')+_0x422bec+'))';return getZohoUser(_0xa5871e,_0xa7cb('0x4f'))[_0xa7cb('0x31')](function(_0xb6cdd){if(_0xb6cdd)return _0xb6cdd;if(_0xd524cd[_0xa7cb('0x46')]!=_0xa7cb('0x4d')){return createEndUser(_0x3ac128,_0x1f16f2,_0x118165,_0x422bec,_0x2274b3,_0xd524cd);}else{return{};}});break;case _0xa7cb('0x50'):_0xa5871e['uri']=_0xa7cb('0x40')+_0x1f16f2+_0xa7cb('0x4b')+_0x422bec+'))';return getZohoUser(_0xa5871e,_0xa7cb('0x4c'))['then'](function(_0x5f4842){if(_0x5f4842)return _0x5f4842;if(_0xd524cd[_0xa7cb('0x46')]!=_0xa7cb('0x4d')){return createEndUser(_0x3ac128,_0x1f16f2,_0x118165,_0x422bec,_0x2274b3,_0xd524cd);}else{return{};}});break;}}function getCall(_0x5b5808,_0x576af0,_0x41e723,_0x13880c,_0x33b900,_0x50b712,_0x3f4b28,_0x3f8c63){logger[_0xa7cb('0x2c')]('Creating\x20new\x20call...');var _0x387fa7={};_0x387fa7[_0xa7cb('0x51')]={'name':!_[_0xa7cb('0x1d')](_0x13880c[_0xa7cb('0x42')][_0xa7cb('0x19')])&&!_[_0xa7cb('0x1d')](_0x13880c[_0xa7cb('0x39')][_0xa7cb('0x19')])&&_0x13880c[_0xa7cb('0x39')][_0xa7cb('0x19')]==='administrator'?_0x13880c[_0xa7cb('0x42')]['name']:!_['isNil'](_0x13880c[_0xa7cb('0x43')])?_0x13880c[_0xa7cb('0x43')]+'\x20'+_0x13880c['last_name']:_0x13880c['last_name'],'id':_0x13880c['id']};_0x387fa7[_0xa7cb('0x52')]=intUtil[_0xa7cb('0x53')](_0x50b712[_0xa7cb('0x54')],_0x3f4b28,'\x20');_0x387fa7[_0xa7cb('0x55')]=intUtil[_0xa7cb('0x53')](_0x50b712[_0xa7cb('0x56')],_0x3f4b28,'\x0a');if(_0x33b900['enduserType']==='Contacts'){_0x387fa7[_0xa7cb('0x57')]={'name':!_[_0xa7cb('0x1d')](_0x33b900[_0xa7cb('0x58')])?_0x33b900[_0xa7cb('0x58')]:!_['isNil'](_0x33b900[_0xa7cb('0x59')])?_0x33b900[_0xa7cb('0x59')]+'\x20'+_0x33b900['Last_Name']:_0x33b900['Last_Name'],'id':_0x33b900['id']};}if(_0x33b900[_0xa7cb('0x3e')]===_0xa7cb('0x4c')){_0x387fa7['What_Id']={'name':!_['isNil'](_0x33b900[_0xa7cb('0x58')])?_0x33b900[_0xa7cb('0x58')]:!_[_0xa7cb('0x1d')](_0x33b900[_0xa7cb('0x59')])?_0x33b900[_0xa7cb('0x59')]+'\x20'+_0x33b900[_0xa7cb('0x5a')]:_0x33b900[_0xa7cb('0x5a')],'id':_0x33b900['id']};_0x387fa7['$se_module']=_['startCase'](_0x33b900[_0xa7cb('0x3e')]);}if(_0x3f4b28['talktime']){_0x387fa7[_0xa7cb('0x5b')]=moment['utc'](parseInt(_0x3f4b28['talktime'])*0x3e8)['format'](_0xa7cb('0x5c'));}else if(_0x3f4b28[_0xa7cb('0x5d')]&&_0x3f4b28[_0xa7cb('0x5e')]){_0x387fa7[_0xa7cb('0x5b')]=moment[_0xa7cb('0x5f')](moment(_0x3f4b28[_0xa7cb('0x5e')],'YYYY-MM-DDTHH:mm:ss')[_0xa7cb('0x60')](moment(_0x3f4b28['starttime'],'YYYY-MM-DDTHH:mm:ss')))[_0xa7cb('0x61')](_0xa7cb('0x5c'));}switch(_0x3f4b28[_0xa7cb('0x62')]){case _0xa7cb('0x63'):_0x387fa7['Call_Result']=_0xa7cb('0x64');break;case _0xa7cb('0x65'):case _0xa7cb('0x66'):_0x387fa7[_0xa7cb('0x67')]=_0xa7cb('0x68');break;case _0xa7cb('0x69'):_0x387fa7[_0xa7cb('0x67')]=_0xa7cb('0x6a');break;case _0xa7cb('0x6b'):_0x387fa7[_0xa7cb('0x67')]=_0xa7cb('0x6c');break;case _0xa7cb('0x6d'):_0x387fa7[_0xa7cb('0x67')]='Timeout';default:}_0x387fa7[_0xa7cb('0x6e')]=(_0x3f8c63==='outbound'?moment(_0x3f4b28[_0xa7cb('0x6f')])[_0xa7cb('0x61')](_0xa7cb('0x70')):moment(_0x3f4b28[_0xa7cb('0x71')])[_0xa7cb('0x61')](_0xa7cb('0x70')))||moment()[_0xa7cb('0x61')](_0xa7cb('0x70'));_0x387fa7[_0xa7cb('0x72')]=_0x3f8c63||_0xa7cb('0x73');_0x387fa7=_[_0xa7cb('0x74')](_0x387fa7,getCustomFields(_0x50b712[_0xa7cb('0x75')],_0x3f4b28));return request({'method':_0xa7cb('0x3f'),'uri':'https://www.zohoapis.'+_0x576af0+_0xa7cb('0x76'),'headers':{'Authorization':_0xa7cb('0x30')+_0x5b5808},'body':{'data':[_0x387fa7]},'json':!![]})[_0xa7cb('0x31')](function(_0x2c3a2b){if(_0x2c3a2b&&_0x2c3a2b[_0xa7cb('0x44')][0x0]['code']==='SUCCESS'){logger[_0xa7cb('0x2c')](_0xa7cb('0x77'));return{'id':_0x2c3a2b[_0xa7cb('0x44')][0x0][_0xa7cb('0x45')]['id']};}})['catch'](function(_0x105f8f){logger[_0xa7cb('0x2c')](_0xa7cb('0x78'),_0x105f8f['stack']);console[_0xa7cb('0x47')]('err',_0x105f8f);});}exports['queue']=function(_0x13703d,_0x32a204,_0x2a0472,_0x48d493,_0xf1e2b6,_0xf6bbc5){var _0x17eccc,_0x56e304,_0x60ac15;_0xf6bbc5['host']=intUtil['stripTrailingSlash'](_0xf6bbc5[_0xa7cb('0x79')]);_0xf6bbc5[_0xa7cb('0x7a')]=intUtil[_0xa7cb('0x7b')](_0xf6bbc5[_0xa7cb('0x7a')]);if(_0xf1e2b6&&_0xf1e2b6[_0xa7cb('0x7c')]){logger[_0xa7cb('0x2c')]('[QUEUE]',_0xa7cb('0x7d'));_0x32a204[_0xa7cb('0x7e')]=_0xf6bbc5[_0xa7cb('0x7a')]+_0xa7cb('0x7f')+_0x32a204['uniqueid']+_0xa7cb('0x80')+md5(_0x32a204[_0xa7cb('0x81')]);}else{_0x32a204[_0xa7cb('0x7e')]='';}var _0x994a33=_0xf6bbc5[_0xa7cb('0x79')]===_0xa7cb('0x82')?'eu':'com';return getAccessToken(_0xf6bbc5)[_0xa7cb('0x31')](function(_0x11950d){_0x60ac15=_0x11950d;return getUser(_0x60ac15,_0x994a33,_0xf6bbc5,_0x48d493['email']);})[_0xa7cb('0x31')](function(_0xb80c2e){_0x17eccc=_0xb80c2e;logger[_0xa7cb('0x2c')]('The\x20User\x20ID\x20is:',_0x17eccc['id']);return getEndUser(_0x60ac15,_0x994a33,_0xf6bbc5,_0x32a204[_0xa7cb('0x83')],_0x32a204[_0xa7cb('0x84')],_0x17eccc,_0x2a0472);})[_0xa7cb('0x31')](function(_0x4784ac){_0x56e304=_0x4784ac;return getCall(_0x60ac15,_0x994a33,_0xf6bbc5,_0x17eccc,_0x56e304,_0x2a0472,_0x32a204,_0xa7cb('0x73'));})[_0xa7cb('0x31')](function(_0x2f7f58){if(_0x2f7f58){logger[_0xa7cb('0x2c')](_0xa7cb('0x85'),_0x2f7f58['id']);logger[_0xa7cb('0x2c')](_0xa7cb('0x86'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xa7cb('0x61')](_0xa7cb('0x87'),_0x48d493['name']),'trigger:browser:url',{'uri':_0xa7cb('0x88')+_0xf6bbc5[_0xa7cb('0x79')]+_0xa7cb('0x89')+_0x2f7f58['id']});}})['catch'](function(_0x40737b){logger['error'](_0xa7cb('0x86'),JSON[_0xa7cb('0xb')](_0x40737b));});};exports['outbound']=function(_0x3375f3,_0x3921ed,_0x38a963,_0xafa52d,_0x42506d,_0x4a57d1,_0x7977e6){var _0x135cbb,_0x4546df,_0x36900f;_0x4a57d1['host']=intUtil[_0xa7cb('0x7b')](_0x4a57d1[_0xa7cb('0x79')]);_0x4a57d1['serverUrl']=intUtil[_0xa7cb('0x7b')](_0x4a57d1[_0xa7cb('0x7a')]);if(_0x7977e6&&_0x7977e6[_0xa7cb('0x8a')]&&_0x7977e6['recordingFormat']!==_0xa7cb('0x8b')){logger['info'](_0xa7cb('0x8c'),_0xa7cb('0x7d'));_0x3921ed['recordingURL']=_0x4a57d1[_0xa7cb('0x7a')]+_0xa7cb('0x7f')+_0x3921ed['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x3921ed[_0xa7cb('0x81')]);}var _0x59ca06=_0x4a57d1[_0xa7cb('0x79')]===_0xa7cb('0x82')?'eu':_0xa7cb('0x8d');return getAccessToken(_0x4a57d1)[_0xa7cb('0x31')](function(_0x114b9b){_0x36900f=_0x114b9b;return getUser(_0x36900f,_0x59ca06,_0x4a57d1,_0xafa52d[_0xa7cb('0x34')]);})['then'](function(_0x5beac2){_0x135cbb=_0x5beac2;logger[_0xa7cb('0x2c')](_0xa7cb('0x8e'),_0x135cbb['id']);return getEndUser(_0x36900f,_0x59ca06,_0x4a57d1,_0x3921ed['destcalleridname'],_0x3921ed[_0xa7cb('0x8f')],_0x135cbb,_0x38a963);})[_0xa7cb('0x31')](function(_0x31732b){_0x4546df=_0x31732b;return getCall(_0x36900f,_0x59ca06,_0x4a57d1,_0x135cbb,_0x4546df,_0x38a963,_0x3921ed,_0xa7cb('0x90'));})[_0xa7cb('0x31')](function(_0x585192){if(_0x585192){logger[_0xa7cb('0x2c')]('The\x20Call\x20ID\x20is:',_0x585192['id']);logger['info'](_0xa7cb('0x8c'),_0xa7cb('0x91'));emit(util['format'](_0xa7cb('0x87'),_0xafa52d['name']),_0xa7cb('0x92'),{'uri':_0xa7cb('0x88')+_0x4a57d1[_0xa7cb('0x79')]+'/crm/EntityInfo.do?module=Calls&id='+_0x585192['id']});}})[_0xa7cb('0x3d')](function(_0x1f58a8){logger[_0xa7cb('0x3a')](_0xa7cb('0x8c'),JSON['stringify'](_0x1f58a8));});};exports[_0xa7cb('0x93')]=function(_0x3e5421,_0x16c22d,_0x3e0073,_0x56dae9,_0x655ad5,_0x53f0ae){var _0x25538c,_0x4966ac,_0x278951;_0x53f0ae[_0xa7cb('0x79')]=intUtil[_0xa7cb('0x7b')](_0x53f0ae[_0xa7cb('0x79')]);_0x53f0ae[_0xa7cb('0x7a')]=intUtil[_0xa7cb('0x7b')](_0x53f0ae[_0xa7cb('0x7a')]);if(_0x655ad5&&_0x655ad5[_0xa7cb('0x7c')]){logger[_0xa7cb('0x2c')]('['+_0x16c22d[_0xa7cb('0x62')][_0xa7cb('0x94')]()+']','Recording\x20is\x20enabled!');_0x16c22d['recordingURL']=_0x53f0ae['serverUrl']+_0xa7cb('0x7f')+_0x16c22d[_0xa7cb('0x81')]+_0xa7cb('0x80')+md5(_0x16c22d[_0xa7cb('0x81')]);}else{_0x16c22d[_0xa7cb('0x7e')]='';}var _0x1093f7=_0x53f0ae['host']==='zoho.eu'?'eu':'com';return getAccessToken(_0x53f0ae)[_0xa7cb('0x31')](function(_0x5b2eff){_0x278951=_0x5b2eff;return getUser(_0x278951,_0x1093f7,_0x53f0ae);})[_0xa7cb('0x31')](function(_0x41432a){_0x25538c=_0x41432a;logger[_0xa7cb('0x2c')]('The\x20User\x20ID\x20is:',_0x25538c['id']);return getEndUser(_0x278951,_0x1093f7,_0x53f0ae,_0x16c22d[_0xa7cb('0x83')],_0x16c22d[_0xa7cb('0x84')],_0x25538c,_0x3e0073);})[_0xa7cb('0x31')](function(_0x48affc){_0x4966ac=_0x48affc;return getCall(_0x278951,_0x1093f7,_0x53f0ae,_0x25538c,_0x4966ac,_0x3e0073,_0x16c22d,_0xa7cb('0x73'));})[_0xa7cb('0x31')](function(_0x304abd){if(_0x304abd){logger[_0xa7cb('0x2c')](_0xa7cb('0x85'),_0x304abd['id']);}})[_0xa7cb('0x3d')](function(_0x3087be){logger['error']('['+_0x16c22d[_0xa7cb('0x62')][_0xa7cb('0x94')]()+']',JSON[_0xa7cb('0xb')](_0x3087be));});}; \ No newline at end of file +var _0x0f10=['Answered','rejected','Abandoned','timeout','Call_Start_Time','outbound','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','code','Call\x20created!','err','queue','host','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','unmanaged','lastevent','toUpperCase','lodash','md5','util','ioredis','bluebird','../../../../config/environment','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','includes','string','idField','content','type','variable','variableName','customVariable','Variable','name','toString','indexOf','split','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','clientId','clientSecret','then','add','seconds','catch','error','stack','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','users','isArrayLikeObject','email','Agent\x20found!','info','Using\x20the\x20admin\x20account!','findIndex','profile','user','Administrator','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','role','Zoho-oauthtoken\x20','SUCCESS','details','moduleCreate','Error:\x20','log','moduleSearch','contact_lead','Contacts','Leads','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','uri','nothing','Creating\x20new\x20call...','administrator','first_name','last_name','Subjects','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','endtime','utc','YYYY-MM-DDTHH:mm:ss','diff','starttime','format','mm:ss','called','Call_Result','connect'];(function(_0x18e550,_0x593854){var _0x140e22=function(_0x56866a){while(--_0x56866a){_0x18e550['push'](_0x18e550['shift']());}};_0x140e22(++_0x593854);}(_0x0f10,0xc3));var _0x00f1=function(_0x28808f,_0x7b731b){_0x28808f=_0x28808f-0x0;var _0x54b720=_0x0f10[_0x28808f];return _0x54b720;};'use strict';var _=require(_0x00f1('0x0'));var rp=require('request-promise');var md5=require(_0x00f1('0x1'));var util=require(_0x00f1('0x2'));var intUtil=require('./util');var moment=require('moment');var Redis=require(_0x00f1('0x3'));var BPromise=require(_0x00f1('0x4'));var config=require(_0x00f1('0x5'));var logger=require('../../../../config/logger')(_0x00f1('0x6'));config[_0x00f1('0x7')]=_[_0x00f1('0x8')](config[_0x00f1('0x7')],{'host':_0x00f1('0x9'),'port':0x18eb});var io=require(_0x00f1('0xa'))(new Redis(config[_0x00f1('0x7')]));function emit(_0x5bb30f,_0x33347b,_0x1792c7){io['to'](_0x5bb30f)[_0x00f1('0xb')](_0x33347b,_0x1792c7);}function request(_0x4039a3){logger[_0x00f1('0xc')](_0x00f1('0xd'),JSON[_0x00f1('0xe')](_0x4039a3));return rp(_0x4039a3);}function getCustomFields(_0x5e299c,_0xc3623f){var _0x2f25ad={};if(_0x5e299c[_0x00f1('0xf')]>0x0){_[_0x00f1('0x10')](_0x5e299c,function(_0xfca510){if(_[_0x00f1('0x11')]([_0x00f1('0x12'),'picklist'],_0xfca510['type'])&&_0xfca510[_0x00f1('0x13')]){_0x2f25ad[_0xfca510[_0x00f1('0x13')]]=_0xfca510[_0x00f1('0x14')]['toString']();}else if(_0xfca510[_0x00f1('0x15')]===_0x00f1('0x16')&&_0xfca510[_0x00f1('0x17')]&&_0xfca510[_0x00f1('0x13')]&&_0xc3623f[_0xfca510[_0x00f1('0x17')]]){_0x2f25ad[_0xfca510['idField']]=_0xc3623f[_0xfca510[_0x00f1('0x17')]]['toString']();}else if(_0xfca510['type']===_0x00f1('0x18')&&_0xfca510[_0x00f1('0x19')]&&_0xfca510[_0x00f1('0x19')]['name']&&_0xfca510[_0x00f1('0x13')]&&_0xc3623f[_0xfca510['Variable'][_0x00f1('0x1a')]['toLowerCase']()]){_0x2f25ad[_0xfca510[_0x00f1('0x13')]]=_0xc3623f[_0xfca510['Variable'][_0x00f1('0x1a')]['toLowerCase']()][_0x00f1('0x1b')]();}});}return _0x2f25ad;}function getName(_0x5248d9){if(_0x5248d9[_0x00f1('0x1c')]('\x20')>0x0){var _0x5cbfd4=_0x5248d9[_0x00f1('0x1d')](/ (.+)/);if(_0x5cbfd4[0x1]){return _0x5cbfd4;}}return[_0x5248d9,_0x5248d9];}var accountsTokens={};function getAccessToken(_0x21f97e){return new Promise(function(_0x1efc87,_0x235ed8){if(!_[_0x00f1('0x1e')](accountsTokens[_0x21f97e['id']])&&!_[_0x00f1('0x1e')](accountsTokens[_0x21f97e['id']][_0x00f1('0x1f')])){if(moment()['isBefore'](accountsTokens[_0x21f97e['id']][_0x00f1('0x20')])){_0x1efc87(accountsTokens[_0x21f97e['id']][_0x00f1('0x1f')]);}}var _0xd31cb0;switch(_0x21f97e[_0x00f1('0x21')]){case'US':_0xd31cb0=_0x00f1('0x22');break;case'AU':_0xd31cb0='https://accounts.zoho.com.au';break;case'EU':_0xd31cb0='https://accounts.zoho.eu';break;case'IN':_0xd31cb0=_0x00f1('0x23');break;case'CN':_0xd31cb0=_0x00f1('0x24');break;default:_0xd31cb0=_0x00f1('0x25');break;}var _0x5d4df5={'method':_0x00f1('0x26'),'uri':_0xd31cb0+_0x00f1('0x27'),'qs':{'refresh_token':_0x21f97e['refreshToken'],'client_id':_0x21f97e[_0x00f1('0x28')],'client_secret':_0x21f97e[_0x00f1('0x29')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x5d4df5)[_0x00f1('0x2a')](function(_0x3318b4){accountsTokens[_0x21f97e['id']]={'access_token':_0x3318b4[_0x00f1('0x1f')],'expires_in':moment()[_0x00f1('0x2b')](_0x3318b4['expires_in'],_0x00f1('0x2c'))};_0x1efc87(_0x3318b4[_0x00f1('0x1f')]);})[_0x00f1('0x2d')](function(_0x4ef02f){logger[_0x00f1('0x2e')]('Failing\x20creating\x20the\x20access_token',_0x4ef02f[_0x00f1('0x2f')]);_0x235ed8(_0x4ef02f);});});}function getUser(_0x59b339,_0x4648fd,_0x1ef755,_0x6eac2b){logger['info']('Search\x20user');return request({'method':'GET','uri':util['format'](_0x00f1('0x30'),_0x4648fd),'qs':{'type':_0x00f1('0x31')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x59b339},'json':!![]})[_0x00f1('0x2a')](function(_0x100db5){if(_0x100db5[_0x00f1('0x32')]){var _0x18358f=-0x1;if(_[_0x00f1('0x33')](_0x100db5[_0x00f1('0x32')])){if(!_['isNil'](_0x6eac2b)){_0x18358f=_['findIndex'](_0x100db5[_0x00f1('0x32')],function(_0x29dccc){return _0x29dccc[_0x00f1('0x34')]===_0x6eac2b;});}if(_0x18358f>=0x0){logger['info'](_0x00f1('0x35'));}else{logger[_0x00f1('0x36')](_0x00f1('0x37'));_0x18358f=_[_0x00f1('0x38')](_0x100db5[_0x00f1('0x32')],function(_0x309dc2){return _0x309dc2[_0x00f1('0x39')][_0x00f1('0x1a')]==='Administrator';});}return _0x100db5[_0x00f1('0x32')][_0x18358f];}else{if(_0x100db5[_0x00f1('0x3a')][_0x00f1('0x39')][_0x00f1('0x1a')]===_0x00f1('0x3b')){logger[_0x00f1('0x36')]('Using\x20the\x20admin\x20account!');user=_0x100db5['user'];return user;}else{logger['error'](_0x00f1('0x3c'),JSON[_0x00f1('0xe')](_0x100db5));throw new Error(_0x00f1('0x3d')+JSON[_0x00f1('0xe')](_0x100db5));}}}else{logger[_0x00f1('0x2e')](_0x00f1('0x3c'),JSON[_0x00f1('0xe')](_0x100db5));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x00f1('0xe')](_0x100db5));}})[_0x00f1('0x2d')](function(_0xe75494){console[_0x00f1('0x2e')](_0xe75494);});}function getZohoUser(_0x3d68f5,_0x304569){return new BPromise(function(_0x48c119,_0x211853){request(_0x3d68f5)[_0x00f1('0x2a')](function(_0x3ec6ad){var _0x1b8126=null;if(_0x3ec6ad){_0x1b8126=_0x3ec6ad[_0x00f1('0x3e')][0x0];_0x1b8126[_0x00f1('0x3f')]=_0x304569;}_0x48c119(_0x1b8126);})[_0x00f1('0x2d')](function(_0x2db21b){_0x211853(_0x2db21b);});});}function createEndUser(_0x6c4999,_0x492a1c,_0x4ff9b7,_0x3fdee7,_0x2d1408,_0x35bc4a){var _0x4ff9b7=getName(_0x4ff9b7);return request({'method':_0x00f1('0x26'),'uri':_0x00f1('0x40')+_0x492a1c+_0x00f1('0x41')+_[_0x00f1('0x42')](_0x35bc4a['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x4ff9b7[0x1],'First_Name':_0x4ff9b7[0x0],'Phone':_0x3fdee7,'Owner':{'name':!_['isNil'](_0x2d1408[_0x00f1('0x43')][_0x00f1('0x1a')])?_0x2d1408[_0x00f1('0x43')][_0x00f1('0x1a')]:!_[_0x00f1('0x1e')](_0x2d1408['first_name'])?_0x2d1408['first_name']+'\x20'+_0x2d1408['last_name']:_0x2d1408['last_name'],'id':_0x2d1408['id']}}]},'headers':{'Authorization':_0x00f1('0x44')+_0x6c4999},'json':!![]})[_0x00f1('0x2a')](function(_0x570b21){if(_0x570b21&&_0x570b21[_0x00f1('0x3e')][0x0]['code']===_0x00f1('0x45')){var _0xcbcf18=_0x570b21[_0x00f1('0x3e')][0x0][_0x00f1('0x46')];_0xcbcf18['enduserType']=_['startCase'](_0x35bc4a[_0x00f1('0x47')])+'s';return _0xcbcf18;}logger['error'](_0x00f1('0x3c'),JSON[_0x00f1('0xe')](data));throw new Error(_0x00f1('0x48')+JSON[_0x00f1('0xe')](data));})[_0x00f1('0x2d')](function(_0x1b0c32){console[_0x00f1('0x49')]('CREATE\x20ERROR',_0x1b0c32);});}function getEndUser(_0x40f390,_0x56541e,_0x4bda3e,_0x3bdd08,_0x3ce6a9,_0x5900c9,_0x16a7be){var _0x2f1649={'method':'GET','uri':'','headers':{'Authorization':_0x00f1('0x44')+_0x40f390},'json':!![]};switch(_0x16a7be[_0x00f1('0x4a')]){case _0x00f1('0x4b'):_0x2f1649['uri']='https://www.zohoapis.'+_0x56541e+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x3ce6a9+'))';return getZohoUser(_0x2f1649,_0x00f1('0x4c'))['then'](function(_0x313428){if(_0x313428)return _0x313428;_0x2f1649['uri']=_0x00f1('0x40')+_0x56541e+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x3ce6a9+'))';return getZohoUser(_0x2f1649,_0x00f1('0x4d'))[_0x00f1('0x2a')](function(_0x453860){if(_0x453860)return _0x453860;if(_0x16a7be[_0x00f1('0x47')]!='nothing'){return createEndUser(_0x40f390,_0x56541e,_0x3bdd08,_0x3ce6a9,_0x5900c9,_0x16a7be);}else{return{};}});});break;case _0x00f1('0x4e'):_0x2f1649['uri']=_0x00f1('0x40')+_0x56541e+_0x00f1('0x4f')+_0x3ce6a9+'))';return getZohoUser(_0x2f1649,'Contacts')[_0x00f1('0x2a')](function(_0x5586e2){if(_0x5586e2)return _0x5586e2;if(_0x16a7be[_0x00f1('0x47')]!='nothing'){return createEndUser(_0x40f390,_0x56541e,_0x3bdd08,_0x3ce6a9,_0x5900c9,_0x16a7be);}else{return{};}});break;case _0x00f1('0x50'):_0x2f1649[_0x00f1('0x51')]=_0x00f1('0x40')+_0x56541e+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x3ce6a9+'))';return getZohoUser(_0x2f1649,'Leads')[_0x00f1('0x2a')](function(_0x4756fc){if(_0x4756fc)return _0x4756fc;if(_0x16a7be['moduleCreate']!=_0x00f1('0x52')){return createEndUser(_0x40f390,_0x56541e,_0x3bdd08,_0x3ce6a9,_0x5900c9,_0x16a7be);}else{return{};}});break;}}function getCall(_0x144d30,_0x873c76,_0x38473b,_0x1640a5,_0x3e90fe,_0x50ec89,_0x22561e,_0x4aa269){logger[_0x00f1('0x36')](_0x00f1('0x53'));var _0x1645d8={};_0x1645d8['Owner']={'name':!_[_0x00f1('0x1e')](_0x1640a5['role'][_0x00f1('0x1a')])&&!_[_0x00f1('0x1e')](_0x1640a5[_0x00f1('0x39')][_0x00f1('0x1a')])&&_0x1640a5[_0x00f1('0x39')]['name']===_0x00f1('0x54')?_0x1640a5[_0x00f1('0x43')][_0x00f1('0x1a')]:!_[_0x00f1('0x1e')](_0x1640a5['first_name'])?_0x1640a5[_0x00f1('0x55')]+'\x20'+_0x1640a5[_0x00f1('0x56')]:_0x1640a5[_0x00f1('0x56')],'id':_0x1640a5['id']};_0x1645d8['Subject']=intUtil['getString'](_0x50ec89[_0x00f1('0x57')],_0x22561e,'\x20');_0x1645d8['Description']=intUtil[_0x00f1('0x58')](_0x50ec89[_0x00f1('0x59')],_0x22561e,'\x0a');if(_0x3e90fe['enduserType']==='Contacts'){_0x1645d8[_0x00f1('0x5a')]={'name':!_[_0x00f1('0x1e')](_0x3e90fe[_0x00f1('0x5b')])?_0x3e90fe[_0x00f1('0x5b')]:!_[_0x00f1('0x1e')](_0x3e90fe['First_Name'])?_0x3e90fe[_0x00f1('0x5c')]+'\x20'+_0x3e90fe[_0x00f1('0x5d')]:_0x3e90fe[_0x00f1('0x5d')],'id':_0x3e90fe['id']};}if(_0x3e90fe[_0x00f1('0x3f')]===_0x00f1('0x4d')){_0x1645d8[_0x00f1('0x5e')]={'name':!_[_0x00f1('0x1e')](_0x3e90fe['Full_Name'])?_0x3e90fe[_0x00f1('0x5b')]:!_[_0x00f1('0x1e')](_0x3e90fe[_0x00f1('0x5c')])?_0x3e90fe[_0x00f1('0x5c')]+'\x20'+_0x3e90fe[_0x00f1('0x5d')]:_0x3e90fe['Last_Name'],'id':_0x3e90fe['id']};_0x1645d8['$se_module']=_[_0x00f1('0x42')](_0x3e90fe[_0x00f1('0x3f')]);}if(_0x22561e[_0x00f1('0x5f')]){_0x1645d8[_0x00f1('0x60')]=moment['utc'](parseInt(_0x22561e[_0x00f1('0x5f')])*0x3e8)['format']('mm:ss');}else if(_0x22561e['answertime']&&_0x22561e[_0x00f1('0x61')]){_0x1645d8[_0x00f1('0x60')]=moment[_0x00f1('0x62')](moment(_0x22561e[_0x00f1('0x61')],_0x00f1('0x63'))[_0x00f1('0x64')](moment(_0x22561e[_0x00f1('0x65')],_0x00f1('0x63'))))[_0x00f1('0x66')](_0x00f1('0x67'));}switch(_0x22561e['lastevent']){case _0x00f1('0x68'):_0x1645d8[_0x00f1('0x69')]='Called';break;case'complete':case _0x00f1('0x6a'):_0x1645d8[_0x00f1('0x69')]=_0x00f1('0x6b');break;case _0x00f1('0x6c'):_0x1645d8[_0x00f1('0x69')]='Rejected';break;case'abandoned':_0x1645d8[_0x00f1('0x69')]=_0x00f1('0x6d');break;case _0x00f1('0x6e'):_0x1645d8['Call_Result']='Timeout';default:}_0x1645d8[_0x00f1('0x6f')]=(_0x4aa269===_0x00f1('0x70')?moment(_0x22561e[_0x00f1('0x65')])['format'](_0x00f1('0x63')):moment(_0x22561e['agentcalledAt'])[_0x00f1('0x66')](_0x00f1('0x63')))||moment()[_0x00f1('0x66')](_0x00f1('0x63'));_0x1645d8[_0x00f1('0x71')]=_0x4aa269||_0x00f1('0x72');_0x1645d8=_[_0x00f1('0x73')](_0x1645d8,getCustomFields(_0x50ec89[_0x00f1('0x74')],_0x22561e));return request({'method':_0x00f1('0x26'),'uri':_0x00f1('0x40')+_0x873c76+_0x00f1('0x75'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x144d30},'body':{'data':[_0x1645d8]},'json':!![]})[_0x00f1('0x2a')](function(_0x564552){if(_0x564552&&_0x564552[_0x00f1('0x3e')][0x0][_0x00f1('0x76')]==='SUCCESS'){logger[_0x00f1('0x36')](_0x00f1('0x77'));return{'id':_0x564552[_0x00f1('0x3e')][0x0][_0x00f1('0x46')]['id']};}})['catch'](function(_0x293018){logger['info'](_0x00f1('0x78'),_0x293018[_0x00f1('0x2f')]);console[_0x00f1('0x49')](_0x00f1('0x78'),_0x293018);});}exports[_0x00f1('0x79')]=function(_0x5eead6,_0x1aff7c,_0xa5ad98,_0x486049,_0x564424,_0x3f3d7a){var _0x297f4f,_0xf7eaac,_0x3aadd3;_0x3f3d7a['host']=intUtil['stripTrailingSlash'](_0x3f3d7a[_0x00f1('0x7a')]);_0x3f3d7a[_0x00f1('0x7b')]=intUtil[_0x00f1('0x7c')](_0x3f3d7a['serverUrl']);if(_0x564424&&_0x564424[_0x00f1('0x7d')]){logger['info'](_0x00f1('0x7e'),_0x00f1('0x7f'));_0x1aff7c[_0x00f1('0x80')]=_0x3f3d7a[_0x00f1('0x7b')]+_0x00f1('0x81')+_0x1aff7c[_0x00f1('0x82')]+_0x00f1('0x83')+md5(_0x1aff7c[_0x00f1('0x82')]);}else{_0x1aff7c[_0x00f1('0x80')]='';}var _0x403837=_0x3f3d7a['host']===_0x00f1('0x84')?'eu':_0x00f1('0x85');return getAccessToken(_0x3f3d7a)[_0x00f1('0x2a')](function(_0x1d2816){_0x3aadd3=_0x1d2816;return getUser(_0x3aadd3,_0x403837,_0x3f3d7a,_0x486049[_0x00f1('0x34')]);})['then'](function(_0xd26b50){_0x297f4f=_0xd26b50;logger[_0x00f1('0x36')](_0x00f1('0x86'),_0x297f4f['id']);return getEndUser(_0x3aadd3,_0x403837,_0x3f3d7a,_0x1aff7c[_0x00f1('0x87')],_0x1aff7c[_0x00f1('0x88')],_0x297f4f,_0xa5ad98);})[_0x00f1('0x2a')](function(_0x2fe175){_0xf7eaac=_0x2fe175;return getCall(_0x3aadd3,_0x403837,_0x3f3d7a,_0x297f4f,_0xf7eaac,_0xa5ad98,_0x1aff7c,'Inbound');})['then'](function(_0x9f419c){if(_0x9f419c){logger[_0x00f1('0x36')](_0x00f1('0x89'),_0x9f419c['id']);logger[_0x00f1('0x36')](_0x00f1('0x7e'),_0x00f1('0x8a'));emit(util[_0x00f1('0x66')](_0x00f1('0x8b'),_0x486049['name']),_0x00f1('0x8c'),{'uri':_0x00f1('0x8d')+_0x3f3d7a[_0x00f1('0x7a')]+_0x00f1('0x8e')+_0x9f419c['id']});}})[_0x00f1('0x2d')](function(_0x2d2af3){logger['error'](_0x00f1('0x7e'),JSON[_0x00f1('0xe')](_0x2d2af3));});};exports[_0x00f1('0x70')]=function(_0x310629,_0x262ca0,_0x4c74df,_0xb4f6b9,_0x34b684,_0x88117b,_0x471ced){var _0x11bed7,_0x579187,_0x3c5d98;_0x88117b[_0x00f1('0x7a')]=intUtil[_0x00f1('0x7c')](_0x88117b['host']);_0x88117b['serverUrl']=intUtil[_0x00f1('0x7c')](_0x88117b[_0x00f1('0x7b')]);if(_0x471ced&&_0x471ced[_0x00f1('0x8f')]&&_0x471ced['recordingFormat']!=='none'){logger[_0x00f1('0x36')](_0x00f1('0x90'),_0x00f1('0x7f'));_0x262ca0[_0x00f1('0x80')]=_0x88117b[_0x00f1('0x7b')]+_0x00f1('0x81')+_0x262ca0[_0x00f1('0x82')]+_0x00f1('0x83')+md5(_0x262ca0[_0x00f1('0x82')]);}var _0x22b7c9=_0x88117b['host']===_0x00f1('0x84')?'eu':_0x00f1('0x85');return getAccessToken(_0x88117b)[_0x00f1('0x2a')](function(_0x4160ac){_0x3c5d98=_0x4160ac;return getUser(_0x3c5d98,_0x22b7c9,_0x88117b,_0xb4f6b9[_0x00f1('0x34')]);})[_0x00f1('0x2a')](function(_0x41e5d9){_0x11bed7=_0x41e5d9;logger['info'](_0x00f1('0x86'),_0x11bed7['id']);return getEndUser(_0x3c5d98,_0x22b7c9,_0x88117b,_0x262ca0[_0x00f1('0x91')],_0x262ca0[_0x00f1('0x92')],_0x11bed7,_0x4c74df);})[_0x00f1('0x2a')](function(_0x297b3e){_0x579187=_0x297b3e;return getCall(_0x3c5d98,_0x22b7c9,_0x88117b,_0x11bed7,_0x579187,_0x4c74df,_0x262ca0,_0x00f1('0x93'));})[_0x00f1('0x2a')](function(_0x1ff5a3){if(_0x1ff5a3){logger[_0x00f1('0x36')](_0x00f1('0x89'),_0x1ff5a3['id']);logger['info'](_0x00f1('0x90'),_0x00f1('0x8a'));emit(util['format'](_0x00f1('0x8b'),_0xb4f6b9[_0x00f1('0x1a')]),_0x00f1('0x8c'),{'uri':_0x00f1('0x8d')+_0x88117b['host']+_0x00f1('0x8e')+_0x1ff5a3['id']});}})[_0x00f1('0x2d')](function(_0xcae558){logger[_0x00f1('0x2e')](_0x00f1('0x90'),JSON[_0x00f1('0xe')](_0xcae558));});};exports[_0x00f1('0x94')]=function(_0x540fd7,_0x4422b2,_0x389065,_0x484554,_0x165b62,_0x142e84){var _0xc36b55,_0x1b6699,_0xc90e1b;_0x142e84[_0x00f1('0x7a')]=intUtil[_0x00f1('0x7c')](_0x142e84['host']);_0x142e84[_0x00f1('0x7b')]=intUtil[_0x00f1('0x7c')](_0x142e84[_0x00f1('0x7b')]);if(_0x165b62&&_0x165b62[_0x00f1('0x7d')]){logger[_0x00f1('0x36')]('['+_0x4422b2[_0x00f1('0x95')][_0x00f1('0x96')]()+']',_0x00f1('0x7f'));_0x4422b2[_0x00f1('0x80')]=_0x142e84[_0x00f1('0x7b')]+_0x00f1('0x81')+_0x4422b2[_0x00f1('0x82')]+_0x00f1('0x83')+md5(_0x4422b2[_0x00f1('0x82')]);}else{_0x4422b2['recordingURL']='';}var _0x31032c=_0x142e84[_0x00f1('0x7a')]===_0x00f1('0x84')?'eu':'com';return getAccessToken(_0x142e84)['then'](function(_0x5e1b69){_0xc90e1b=_0x5e1b69;return getUser(_0xc90e1b,_0x31032c,_0x142e84);})[_0x00f1('0x2a')](function(_0x55df43){_0xc36b55=_0x55df43;logger[_0x00f1('0x36')](_0x00f1('0x86'),_0xc36b55['id']);return getEndUser(_0xc90e1b,_0x31032c,_0x142e84,_0x4422b2[_0x00f1('0x87')],_0x4422b2[_0x00f1('0x88')],_0xc36b55,_0x389065);})[_0x00f1('0x2a')](function(_0x4bf60c){_0x1b6699=_0x4bf60c;return getCall(_0xc90e1b,_0x31032c,_0x142e84,_0xc36b55,_0x1b6699,_0x389065,_0x4422b2,_0x00f1('0x72'));})[_0x00f1('0x2a')](function(_0x5ef606){if(_0x5ef606){logger[_0x00f1('0x36')](_0x00f1('0x89'),_0x5ef606['id']);}})[_0x00f1('0x2d')](function(_0x13d80d){logger[_0x00f1('0x2e')]('['+_0x4422b2[_0x00f1('0x95')][_0x00f1('0x96')]()+']',JSON[_0x00f1('0xe')](_0x13d80d));});}; \ 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 b31770e..dee5686 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 _0x3c77=['exec','format','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs','mustache','../../../../config/logger','trigger','data2','Script','render','data3'];(function(_0x5a4400,_0xfae3b6){var _0xf9b532=function(_0x39804e){while(--_0x39804e){_0x5a4400['push'](_0x5a4400['shift']());}};_0xf9b532(++_0xfae3b6);}(_0x3c77,0x64));var _0x73c7=function(_0x249d25,_0x4d3849){_0x249d25=_0x249d25-0x0;var _0x3b7579=_0x3c77[_0x249d25];return _0x3b7579;};'use strict';var util=require('util');var sh=require(_0x73c7('0x0'));var Mustache=require(_0x73c7('0x1'));var logger=require(_0x73c7('0x2'))(_0x73c7('0x3'));exports['exec']=function(_0x132d3a,_0x1c3ad7){var _0x5ae1d4=_0x132d3a[_0x73c7('0x4')]?_0x132d3a[_0x73c7('0x4')]:_0x73c7('0x5');var _0x168e6b=_0x132d3a['data3']?Mustache[_0x73c7('0x6')](_0x132d3a[_0x73c7('0x7')],_0x1c3ad7):_0x1c3ad7;sh[_0x73c7('0x8')](_0x168e6b,function(_0x4d4f4d,_0x28910b,_0x4fc6ae){if(_0x4d4f4d!==0x0){logger['error'](util[_0x73c7('0x9')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x5ae1d4,_0x168e6b,_0x4d4f4d,_0x4fc6ae));}else{logger[_0x73c7('0xa')](util[_0x73c7('0x9')](_0x73c7('0xb'),_0x5ae1d4,_0x168e6b,_0x28910b));}});}; \ No newline at end of file +var _0x49f7=['../../../../config/logger','trigger','exec','data2','Script','data3','render','error','format','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs'];(function(_0x28212b,_0x3d417b){var _0x263a34=function(_0x454626){while(--_0x454626){_0x28212b['push'](_0x28212b['shift']());}};_0x263a34(++_0x3d417b);}(_0x49f7,0x1df));var _0x749f=function(_0x3246c5,_0x10c241){_0x3246c5=_0x3246c5-0x0;var _0x1cf6ea=_0x49f7[_0x3246c5];return _0x1cf6ea;};'use strict';var util=require(_0x749f('0x0'));var sh=require(_0x749f('0x1'));var Mustache=require('mustache');var logger=require(_0x749f('0x2'))(_0x749f('0x3'));exports[_0x749f('0x4')]=function(_0x2ef1af,_0x53f04c){var _0x317452=_0x2ef1af[_0x749f('0x5')]?_0x2ef1af['data2']:_0x749f('0x6');var _0x1a2465=_0x2ef1af[_0x749f('0x7')]?Mustache[_0x749f('0x8')](_0x2ef1af[_0x749f('0x7')],_0x53f04c):_0x53f04c;sh[_0x749f('0x4')](_0x1a2465,function(_0x2bad72,_0x53ee00,_0x3da01d){if(_0x2bad72!==0x0){logger[_0x749f('0x9')](util[_0x749f('0xa')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x317452,_0x1a2465,_0x2bad72,_0x3da01d));}else{logger[_0x749f('0xb')](util[_0x749f('0xa')](_0x749f('0xc'),_0x317452,_0x1a2465,_0x53ee00));}});}; \ 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 2a4268e..4a3c3b5 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 _0x717b=['lodash','mustache','../../../../config/logger','trigger','render','data5','headers','data6','parse','stack','data1','toUpperCase','GET','DELETE','POST','PUT','data7','error','body','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util'];(function(_0x31529f,_0x3846f4){var _0x1a8a1c=function(_0x2a27e5){while(--_0x2a27e5){_0x31529f['push'](_0x31529f['shift']());}};_0x1a8a1c(++_0x3846f4);}(_0x717b,0x139));var _0xb717=function(_0x4fa056,_0x422e81){_0x4fa056=_0x4fa056-0x0;var _0x5c9909=_0x717b[_0x4fa056];return _0x5c9909;};'use strict';var rp=require(_0xb717('0x0'));var util=require(_0xb717('0x1'));var _=require(_0xb717('0x2'));var Mustache=require(_0xb717('0x3'));var logger=require(_0xb717('0x4'))(_0xb717('0x5'));exports['exec']=function(_0x20d2b8,_0x317154){var _0x3f04f3,_0x1e247d;var _0x2f1062={'method':_0x20d2b8['data1']['toUpperCase'](),'uri':Mustache[_0xb717('0x6')](_0x20d2b8['data2'],_0x317154),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x20d2b8[_0xb717('0x7')])==='number'&&parseInt(_0x20d2b8[_0xb717('0x7')])>=0x1&&parseInt(_0x20d2b8[_0xb717('0x7')])<=0xa?parseInt(_0x20d2b8['data5'])*0x3e8:0x5*0x3e8};try{_0x2f1062[_0xb717('0x8')]=_0x20d2b8[_0xb717('0x9')]?JSON[_0xb717('0xa')](Mustache[_0xb717('0x6')](_0x20d2b8[_0xb717('0x9')],_0x317154)):{};}catch(_0x2364ac){logger['error'](_0x2364ac[_0xb717('0xb')]);}switch(_0x20d2b8[_0xb717('0xc')][_0xb717('0xd')]()){case _0xb717('0xe'):case _0xb717('0xf'):_0x3f04f3=null;_0x2f1062['qs']=_0x317154;break;case _0xb717('0x10'):case _0xb717('0x11'):if(_0x20d2b8[_0xb717('0x12')]){try{_0x3f04f3=JSON[_0xb717('0xa')](Mustache[_0xb717('0x6')](_0x20d2b8[_0xb717('0x12')],_0x317154));_0x2f1062['body']=_0x3f04f3;}catch(_0x59bdbe){logger[_0xb717('0x13')](_0x59bdbe[_0xb717('0xb')]);logger[_0xb717('0x13')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x3f04f3=_0x317154;_0x2f1062[_0xb717('0x14')]=_0x3f04f3;}break;}logger[_0xb717('0x15')](util[_0xb717('0x16')](_0xb717('0x17'),_0x20d2b8[_0xb717('0xc')],_0x20d2b8['data2'],JSON[_0xb717('0x18')](_0x2f1062)));rp(_0x2f1062)[_0xb717('0x19')](function(_0x35ff62){_0x3f04f3=!_[_0xb717('0x1a')](_0x3f04f3)?_0xb717('0x1b')+_0x3f04f3:'';_0x1e247d=typeof _0x35ff62[_0xb717('0x14')]===_0xb717('0x1c')?JSON['stringify'](_0x35ff62[_0xb717('0x14')]):_0x35ff62['body'];logger[_0xb717('0x15')](util[_0xb717('0x16')](_0xb717('0x1d'),_0x20d2b8[_0xb717('0xc')],_0x20d2b8['data2'],_0x35ff62[_0xb717('0x1e')],_0x1e247d));})[_0xb717('0x1f')](function(_0x95b954){logger[_0xb717('0x13')](util[_0xb717('0x16')](_0xb717('0x20'),_0x20d2b8[_0xb717('0xc')],_0x20d2b8['data2'],_0x95b954[_0xb717('0x1e')],_0x95b954[_0xb717('0x21')],_0x95b954[_0xb717('0x22')]));});}; \ No newline at end of file +var _0x6bac=['DELETE','POST','PUT','data7','parse','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then','isNil',',\x20request\x20body:\x20','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','mustache','../../../../config/logger','exec','toUpperCase','data2','number','data5','headers','data6','render','error','stack','data1','GET'];(function(_0x16076a,_0x3cc440){var _0x45f4e6=function(_0xfd0e42){while(--_0xfd0e42){_0x16076a['push'](_0x16076a['shift']());}};_0x45f4e6(++_0x3cc440);}(_0x6bac,0x92));var _0xc6ba=function(_0x550b68,_0xfd07d2){_0x550b68=_0x550b68-0x0;var _0xee1eb5=_0x6bac[_0x550b68];return _0xee1eb5;};'use strict';var rp=require('request-promise');var util=require('util');var _=require('lodash');var Mustache=require(_0xc6ba('0x0'));var logger=require(_0xc6ba('0x1'))('trigger');exports[_0xc6ba('0x2')]=function(_0x27431d,_0x21faf2){var _0x577cec,_0x39468c;var _0xcd0087={'method':_0x27431d['data1'][_0xc6ba('0x3')](),'uri':Mustache['render'](_0x27431d[_0xc6ba('0x4')],_0x21faf2),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x27431d['data5'])===_0xc6ba('0x5')&&parseInt(_0x27431d[_0xc6ba('0x6')])>=0x1&&parseInt(_0x27431d['data5'])<=0xa?parseInt(_0x27431d[_0xc6ba('0x6')])*0x3e8:0x5*0x3e8};try{_0xcd0087[_0xc6ba('0x7')]=_0x27431d[_0xc6ba('0x8')]?JSON['parse'](Mustache[_0xc6ba('0x9')](_0x27431d[_0xc6ba('0x8')],_0x21faf2)):{};}catch(_0x2a3180){logger[_0xc6ba('0xa')](_0x2a3180[_0xc6ba('0xb')]);}switch(_0x27431d[_0xc6ba('0xc')][_0xc6ba('0x3')]()){case _0xc6ba('0xd'):case _0xc6ba('0xe'):_0x577cec=null;_0xcd0087['qs']=_0x21faf2;break;case _0xc6ba('0xf'):case _0xc6ba('0x10'):if(_0x27431d[_0xc6ba('0x11')]){try{_0x577cec=JSON[_0xc6ba('0x12')](Mustache[_0xc6ba('0x9')](_0x27431d[_0xc6ba('0x11')],_0x21faf2));_0xcd0087[_0xc6ba('0x13')]=_0x577cec;}catch(_0x1c75b9){logger[_0xc6ba('0xa')](_0x1c75b9['stack']);logger[_0xc6ba('0xa')](_0xc6ba('0x14'));}}else{_0x577cec=_0x21faf2;_0xcd0087[_0xc6ba('0x13')]=_0x577cec;}break;}logger['info'](util[_0xc6ba('0x15')](_0xc6ba('0x16'),_0x27431d[_0xc6ba('0xc')],_0x27431d['data2'],JSON['stringify'](_0xcd0087)));rp(_0xcd0087)[_0xc6ba('0x17')](function(_0x4f03b0){_0x577cec=!_[_0xc6ba('0x18')](_0x577cec)?_0xc6ba('0x19')+_0x577cec:'';_0x39468c=typeof _0x4f03b0['body']==='object'?JSON['stringify'](_0x4f03b0['body']):_0x4f03b0[_0xc6ba('0x13')];logger[_0xc6ba('0x1a')](util[_0xc6ba('0x15')](_0xc6ba('0x1b'),_0x27431d[_0xc6ba('0xc')],_0x27431d[_0xc6ba('0x4')],_0x4f03b0[_0xc6ba('0x1c')],_0x39468c));})['catch'](function(_0x2f9cd3){logger[_0xc6ba('0xa')](util['format'](_0xc6ba('0x1d'),_0x27431d['data1'],_0x27431d[_0xc6ba('0x4')],_0x2f9cd3[_0xc6ba('0x1c')],_0x2f9cd3[_0xc6ba('0x1e')],_0x2f9cd3[_0xc6ba('0x1f')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 5b3ddc7..155c0e1 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 _0x5d8d=['rpc','routing','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','http','Request','request','then','debug'];(function(_0x9ba307,_0x570631){var _0x335d04=function(_0x3125d0){while(--_0x3125d0){_0x9ba307['push'](_0x9ba307['shift']());}};_0x335d04(++_0x570631);}(_0x5d8d,0x160));var _0xd5d8=function(_0xb47909,_0x11d063){_0xb47909=_0xb47909-0x0;var _0x323fd0=_0x5d8d[_0xb47909];return _0x323fd0;};'use strict';var jayson=require(_0xd5d8('0x0'));var BPromise=require(_0xd5d8('0x1'));var logger=require(_0xd5d8('0x2'))('routing');var client=jayson['client'][_0xd5d8('0x3')]({'port':0x2329});client[_0xd5d8('0x4')]=function(_0x58486d,_0x336346){return new BPromise(function(_0x4d432a,_0x468d34){return client[_0xd5d8('0x5')](_0x58486d,_0x336346)[_0xd5d8('0x6')](function(_0x3463b0){logger[_0xd5d8('0x7')](_0xd5d8('0x8'),_0xd5d8('0x9'),_0x58486d,_0x336346,_0x3463b0);if(_0x3463b0['error']){logger[_0xd5d8('0xa')](_0xd5d8('0x8'),_0xd5d8('0x9'),_0x58486d,_0x3463b0[_0xd5d8('0xa')][_0xd5d8('0xb')],_0x336346);return _0x468d34(_0x3463b0[_0xd5d8('0xa')][_0xd5d8('0xb')]);}else{return _0x4d432a(_0x3463b0[_0xd5d8('0xc')]);}})[_0xd5d8('0xd')](function(_0x200403){logger[_0xd5d8('0xa')](_0xd5d8('0x8'),_0xd5d8('0x9'),_0x58486d,_0x200403,_0x336346);return _0x468d34(_0x200403);});});};module[_0xd5d8('0xe')]=client; \ No newline at end of file +var _0x0354=['Request','then','debug','error','rpc','message','result','catch','exports','jayson/promise','bluebird','routing','client'];(function(_0x59eefb,_0x2151ce){var _0x1a49e8=function(_0x5a758c){while(--_0x5a758c){_0x59eefb['push'](_0x59eefb['shift']());}};_0x1a49e8(++_0x2151ce);}(_0x0354,0xd9));var _0x4035=function(_0x88e00c,_0x193d3e){_0x88e00c=_0x88e00c-0x0;var _0x563d15=_0x0354[_0x88e00c];return _0x563d15;};'use strict';var jayson=require(_0x4035('0x0'));var BPromise=require(_0x4035('0x1'));var logger=require('../../config/logger')(_0x4035('0x2'));var client=jayson[_0x4035('0x3')]['http']({'port':0x2329});client[_0x4035('0x4')]=function(_0x292128,_0x129a3a){return new BPromise(function(_0x4b55fb,_0xc82ed8){return client['request'](_0x292128,_0x129a3a)[_0x4035('0x5')](function(_0x284b2b){logger[_0x4035('0x6')]('rpc',_0x4035('0x2'),_0x292128,_0x129a3a,_0x284b2b);if(_0x284b2b['error']){logger[_0x4035('0x7')](_0x4035('0x8'),'routing',_0x292128,_0x284b2b[_0x4035('0x7')][_0x4035('0x9')],_0x129a3a);return _0xc82ed8(_0x284b2b[_0x4035('0x7')][_0x4035('0x9')]);}else{return _0x4b55fb(_0x284b2b[_0x4035('0xa')]);}})[_0x4035('0xb')](function(_0x5851d9){logger[_0x4035('0x7')](_0x4035('0x8'),_0x4035('0x2'),_0x292128,_0x5851d9,_0x129a3a);return _0xc82ed8(_0x5851d9);});});};module[_0x4035('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index d5b4c60..d01fde5 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 _0x2a47=['Email\x20service\x20initialization','./realtime','./lib/email','./rpc/setting','../../config/logger','resolve','then','refresh','mailAccounts','loginMailFrequency'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x2a47,0xd3));var _0x72a4=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0x2a47[_0x62c958];return _0x57ec61;};'use strict';var server=require('./server');var Realtime=require(_0x72a4('0x0'));var EmailChannel=require(_0x72a4('0x1'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0x72a4('0x2'));var logger=require(_0x72a4('0x3'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x72a4('0x4')]()[_0x72a4('0x5')](mailAccount['getMailAccounts']())[_0x72a4('0x5')](realtime['initMailAccounts']())[_0x72a4('0x5')](function(){email[_0x72a4('0x6')](realtime[_0x72a4('0x7')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x72a4('0x5')](function(){return initRealtime();})[_0x72a4('0x5')](function(){return setting['getSettings']();})['then'](function(_0x4a329b){return setInterval(initRealtime,_0x4a329b[_0x72a4('0x8')]*0x3e8);})['catch'](function(_0x5f4495){logger['error'](_0x72a4('0x9'),_0x5f4495);});}main(); \ No newline at end of file +var _0xe1c1=['./rpc/setting','email','resolve','getMailAccounts','then','initMailAccounts','refresh','mailAccounts','getSettings','loginMailFrequency','error','Email\x20service\x20initialization','./realtime','./rpc/mailAccount'];(function(_0x26f48a,_0x36580e){var _0x1c841d=function(_0x3907cc){while(--_0x3907cc){_0x26f48a['push'](_0x26f48a['shift']());}};_0x1c841d(++_0x36580e);}(_0xe1c1,0x14e));var _0x1e1c=function(_0x374ada,_0x27b3a5){_0x374ada=_0x374ada-0x0;var _0x449ed8=_0xe1c1[_0x374ada];return _0x449ed8;};'use strict';var server=require('./server');var Realtime=require(_0x1e1c('0x0'));var EmailChannel=require('./lib/email');var mailAccount=require(_0x1e1c('0x1'));var setting=require(_0x1e1c('0x2'));var logger=require('../../config/logger')(_0x1e1c('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x1e1c('0x4')]()['then'](mailAccount[_0x1e1c('0x5')]())[_0x1e1c('0x6')](realtime[_0x1e1c('0x7')]())[_0x1e1c('0x6')](function(){email[_0x1e1c('0x8')](realtime[_0x1e1c('0x9')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x1e1c('0x6')](function(){return initRealtime();})[_0x1e1c('0x6')](function(){return setting[_0x1e1c('0xa')]();})['then'](function(_0x4995f6){return setInterval(initRealtime,_0x4995f6[_0x1e1c('0xb')]*0x3e8);})['catch'](function(_0x139e8f){logger[_0x1e1c('0xc')](_0x1e1c('0xd'),_0x139e8f);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 7b486c3..81b4174 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 _0xb163=['../../../config/logger','email','defaults','localhost','socket.io-emitter','redis','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status','total','isNil','mailAccount:update','hasOwnProperty','service','provider','custom','box','bind','handleImapEmail','end','handleImapEnd','handleImapError','disabled','messageStatus','connected','messages','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','stringify','error','sendMail','verifySmtp','Smtp','lastSync','verify','verified','exports','moment','md5','ioredis','../../../config/environment'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xb163,0x158));var _0x3b16=function(_0x4d7360,_0xcf4d7a){_0x4d7360=_0x4d7360-0x0;var _0x59bfb7=_0xb163[_0x4d7360];return _0x59bfb7;};'use strict';var _=require('lodash');var moment=require(_0x3b16('0x0'));var BPromise=require('bluebird');var md5=require(_0x3b16('0x1'));var Redis=require(_0x3b16('0x2'));var config=require(_0x3b16('0x3'));var logger=require(_0x3b16('0x4'))(_0x3b16('0x5'));config['redis']=_[_0x3b16('0x6')](config['redis'],{'host':_0x3b16('0x7'),'port':0x18eb});var io=require(_0x3b16('0x8'))(new Redis(config[_0x3b16('0x9')]));var EmailImap=require(_0x3b16('0xa'));var EmailSmtp=require(_0x3b16('0xb'));var mailAccount=require(_0x3b16('0xc'));var md5Accounts={};function EmailChannel(_0x34aa31){logger[_0x3b16('0xd')]('start\x20email\x20channel');this[_0x3b16('0xe')]=_0x34aa31[_0x3b16('0xe')];this[_0x3b16('0xf')]={};this[_0x3b16('0x10')]=new EmailSmtp();}EmailChannel[_0x3b16('0x11')][_0x3b16('0x12')]=function(_0x57d81b){var _0x56acde=this[_0x3b16('0xe')][_0x57d81b];var _0x1eef1c={'id':_0x56acde['id'],'name':_0x56acde[_0x3b16('0x13')],'key':_0x56acde[_0x3b16('0x14')],'active':_0x56acde[_0x3b16('0x15')],'Imap':{'status':_0x56acde[_0x3b16('0x16')][_0x3b16('0x17')],'messageStatus':_0x56acde[_0x3b16('0x16')]['messageStatus'],'total':_0x56acde[_0x3b16('0x16')][_0x3b16('0x18')]}};if(_[_0x3b16('0x19')](md5Accounts[_0x57d81b])){md5Accounts[_0x57d81b]={};}var _0x36411b=md5(JSON['stringify'](_0x1eef1c));if(md5Accounts[_0x57d81b][_0x3b16('0x1')]!==_0x36411b){md5Accounts[_0x57d81b][_0x3b16('0x1')]=_0x36411b;io[_0x3b16('0x12')](_0x3b16('0x1a'),_0x1eef1c);}};EmailChannel[_0x3b16('0x11')]['refresh']=function(_0x1adef7){for(var _0xcc0688 in _0x1adef7){if(_0x1adef7[_0x3b16('0x1b')](_0xcc0688)){if(_0x1adef7[_0xcc0688][_0x3b16('0x16')]&&_0x1adef7[_0xcc0688]['active']){var _0x520fb8=_0x1adef7[_0xcc0688][_0x3b16('0x16')];if(!_0x520fb8[_0x3b16('0x1c')]&&_0x1adef7[_0xcc0688][_0x3b16('0x1d')]!==_0x3b16('0x1e'))_0x520fb8[_0x3b16('0x1c')]=_0x1adef7[_0xcc0688][_0x3b16('0x1d')];if(!this[_0x3b16('0xf')][_0x3b16('0x1b')](_0x520fb8['id'])){this[_0x3b16('0xf')][_0x520fb8['id']]=new EmailImap(_0x520fb8,_0x1adef7[_0xcc0688][_0x3b16('0x5')]);this['imapAccounts'][_0x520fb8['id']]['on'](_0x3b16('0x1f'),this['handleImapBox'][_0x3b16('0x20')](this,_0xcc0688));this[_0x3b16('0xf')][_0x520fb8['id']]['on'](_0x3b16('0x5'),this[_0x3b16('0x21')][_0x3b16('0x20')](this,_0xcc0688));this[_0x3b16('0xf')][_0x520fb8['id']]['on'](_0x3b16('0x22'),this[_0x3b16('0x23')][_0x3b16('0x20')](this,_0xcc0688));this[_0x3b16('0xf')][_0x520fb8['id']]['on']('error',this[_0x3b16('0x24')][_0x3b16('0x20')](this,_0xcc0688));}}else{if(_['isNil'](this[_0x3b16('0xe')][_0xcc0688]['Imap'])){this[_0x3b16('0xe')][_0xcc0688]['Imap']={};}this['mailAccounts'][_0xcc0688][_0x3b16('0x16')]['status']=_0x3b16('0x25');this['mailAccounts'][_0xcc0688]['Imap'][_0x3b16('0x26')]='';this['emit'](_0xcc0688);}}}};EmailChannel[_0x3b16('0x11')]['handleImapBox']=function(_0x4e902c,_0x26a8e8){if(this['mailAccounts'][_0x4e902c]){this[_0x3b16('0xe')][_0x4e902c][_0x3b16('0x16')][_0x3b16('0x17')]=_0x3b16('0x27');this[_0x3b16('0xe')][_0x4e902c][_0x3b16('0x16')][_0x3b16('0x26')]=_0x26a8e8[_0x3b16('0x13')];if(_0x26a8e8[_0x3b16('0x28')]){this[_0x3b16('0xe')][_0x4e902c][_0x3b16('0x16')]['total']=_0x26a8e8[_0x3b16('0x28')]['total'];}return this[_0x3b16('0x12')](_0x4e902c);}};EmailChannel[_0x3b16('0x11')][_0x3b16('0x21')]=function(_0x3b1eab,_0x4251c8){logger[_0x3b16('0xd')](_0x3b16('0x29'),_0x4251c8[_0x3b16('0x2a')],_0x4251c8['lastName'],_0x4251c8[_0x3b16('0x2b')],_0x3b1eab);if(this['mailAccounts'][_0x3b1eab]){return mailAccount[_0x3b16('0x2c')](_0x3b1eab,_0x4251c8)[_0x3b16('0x2d')](function(_0x3cdaf5){if(_0x3cdaf5){logger[_0x3b16('0xd')](_0x3b16('0x2e'));}})[_0x3b16('0x2f')](function(_0x5d1f84){logger['error'](_0x3b16('0x30'),JSON[_0x3b16('0x31')](_0x5d1f84));});}};EmailChannel[_0x3b16('0x11')][_0x3b16('0x23')]=function(_0x54d953){if(this[_0x3b16('0xe')][_0x54d953]&&this[_0x3b16('0xe')][_0x54d953][_0x3b16('0x16')]){if(this[_0x3b16('0xf')][this['mailAccounts'][_0x54d953][_0x3b16('0x16')]['id']]){delete this[_0x3b16('0xf')][this[_0x3b16('0xe')][_0x54d953][_0x3b16('0x16')]['id']];}this[_0x3b16('0xe')][_0x54d953][_0x3b16('0x16')]['lastSync']=moment();this['emit'](_0x54d953);}};EmailChannel[_0x3b16('0x11')]['handleImapError']=function(_0x3e2f4c,_0x3e1009){if(this[_0x3b16('0xe')][_0x3e2f4c]){this[_0x3b16('0xe')][_0x3e2f4c][_0x3b16('0x16')][_0x3b16('0x17')]=_0x3b16('0x32');this['mailAccounts'][_0x3e2f4c][_0x3b16('0x16')][_0x3b16('0x26')]=_0x3e1009;return this[_0x3b16('0x12')](_0x3e2f4c);}};EmailChannel['prototype'][_0x3b16('0x33')]=function(_0x21945f,_0x57875c){return this[_0x3b16('0x10')]['send'](_0x21945f,_0x57875c);};EmailChannel[_0x3b16('0x11')][_0x3b16('0x34')]=function(_0x44ee75){var _0x5c2478=this;if(this[_0x3b16('0xe')][_0x44ee75['id']]){if(_['isNil'](this[_0x3b16('0xe')][_0x44ee75['id']][_0x3b16('0x35')])){this[_0x3b16('0xe')][_0x44ee75['id']][_0x3b16('0x35')]={};}this['mailAccounts'][_0x44ee75['id']][_0x3b16('0x35')][_0x3b16('0x36')]=moment();return new BPromise(function(_0x5de1ab,_0x34e7a7){return _0x5c2478[_0x3b16('0x10')][_0x3b16('0x37')](_0x44ee75)[_0x3b16('0x2d')](function(_0x3e64dc){_0x5c2478[_0x3b16('0xe')][_0x44ee75['id']][_0x3b16('0x35')]['status']=_0x3b16('0x38');_0x5c2478[_0x3b16('0xe')][_0x44ee75['id']][_0x3b16('0x35')][_0x3b16('0x26')]='';_0x5c2478[_0x3b16('0x12')](_0x44ee75['id']);_0x5de1ab(_0x3e64dc);})['catch'](function(_0xff7681){_0x5c2478[_0x3b16('0xe')][_0x44ee75['id']]['Smtp'][_0x3b16('0x17')]=_0x3b16('0x32');_0x5c2478[_0x3b16('0xe')][_0x44ee75['id']]['Smtp']['messageStatus']=_0xff7681;_0x5c2478['emit'](_0x44ee75['id']);_0x34e7a7(_0xff7681);});});}return this[_0x3b16('0x10')][_0x3b16('0x37')](_0x44ee75);};module[_0x3b16('0x39')]=EmailChannel; \ No newline at end of file +var _0xc13c=['smtp','prototype','emit','name','key','active','Imap','status','total','isNil','stringify','mailAccount:update','refresh','provider','custom','service','hasOwnProperty','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','messageStatus','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','notify','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','send','verifySmtp','Smtp','lastSync','verified','verify','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','email','redis','defaults','localhost','./imap','./smtp','info','mailAccounts','imapAccounts'];(function(_0x2ba187,_0x1533ba){var _0x8b71e7=function(_0xd1a1fc){while(--_0xd1a1fc){_0x2ba187['push'](_0x2ba187['shift']());}};_0x8b71e7(++_0x1533ba);}(_0xc13c,0x1f2));var _0xcc13=function(_0x1a920f,_0x547b1b){_0x1a920f=_0x1a920f-0x0;var _0x390e05=_0xc13c[_0x1a920f];return _0x390e05;};'use strict';var _=require(_0xcc13('0x0'));var moment=require(_0xcc13('0x1'));var BPromise=require(_0xcc13('0x2'));var md5=require(_0xcc13('0x3'));var Redis=require(_0xcc13('0x4'));var config=require(_0xcc13('0x5'));var logger=require('../../../config/logger')(_0xcc13('0x6'));config[_0xcc13('0x7')]=_[_0xcc13('0x8')](config[_0xcc13('0x7')],{'host':_0xcc13('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcc13('0x7')]));var EmailImap=require(_0xcc13('0xa'));var EmailSmtp=require(_0xcc13('0xb'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x1b084f){logger[_0xcc13('0xc')]('start\x20email\x20channel');this[_0xcc13('0xd')]=_0x1b084f[_0xcc13('0xd')];this[_0xcc13('0xe')]={};this[_0xcc13('0xf')]=new EmailSmtp();}EmailChannel[_0xcc13('0x10')][_0xcc13('0x11')]=function(_0x414678){var _0x514f52=this['mailAccounts'][_0x414678];var _0x16c213={'id':_0x514f52['id'],'name':_0x514f52[_0xcc13('0x12')],'key':_0x514f52[_0xcc13('0x13')],'active':_0x514f52[_0xcc13('0x14')],'Imap':{'status':_0x514f52[_0xcc13('0x15')][_0xcc13('0x16')],'messageStatus':_0x514f52['Imap']['messageStatus'],'total':_0x514f52[_0xcc13('0x15')][_0xcc13('0x17')]}};if(_[_0xcc13('0x18')](md5Accounts[_0x414678])){md5Accounts[_0x414678]={};}var _0x29b6d6=md5(JSON[_0xcc13('0x19')](_0x16c213));if(md5Accounts[_0x414678][_0xcc13('0x3')]!==_0x29b6d6){md5Accounts[_0x414678][_0xcc13('0x3')]=_0x29b6d6;io[_0xcc13('0x11')](_0xcc13('0x1a'),_0x16c213);}};EmailChannel[_0xcc13('0x10')][_0xcc13('0x1b')]=function(_0x250862){for(var _0x4efd40 in _0x250862){if(_0x250862['hasOwnProperty'](_0x4efd40)){if(_0x250862[_0x4efd40]['Imap']&&_0x250862[_0x4efd40]['active']){var _0x1542b7=_0x250862[_0x4efd40]['Imap'];if(!_0x1542b7['service']&&_0x250862[_0x4efd40][_0xcc13('0x1c')]!==_0xcc13('0x1d'))_0x1542b7[_0xcc13('0x1e')]=_0x250862[_0x4efd40]['provider'];if(!this[_0xcc13('0xe')][_0xcc13('0x1f')](_0x1542b7['id'])){this['imapAccounts'][_0x1542b7['id']]=new EmailImap(_0x1542b7,_0x250862[_0x4efd40][_0xcc13('0x6')]);this[_0xcc13('0xe')][_0x1542b7['id']]['on']('box',this[_0xcc13('0x20')][_0xcc13('0x21')](this,_0x4efd40));this[_0xcc13('0xe')][_0x1542b7['id']]['on'](_0xcc13('0x6'),this[_0xcc13('0x22')][_0xcc13('0x21')](this,_0x4efd40));this[_0xcc13('0xe')][_0x1542b7['id']]['on'](_0xcc13('0x23'),this[_0xcc13('0x24')]['bind'](this,_0x4efd40));this['imapAccounts'][_0x1542b7['id']]['on'](_0xcc13('0x25'),this[_0xcc13('0x26')][_0xcc13('0x21')](this,_0x4efd40));}}else{if(_[_0xcc13('0x18')](this[_0xcc13('0xd')][_0x4efd40][_0xcc13('0x15')])){this[_0xcc13('0xd')][_0x4efd40][_0xcc13('0x15')]={};}this['mailAccounts'][_0x4efd40]['Imap'][_0xcc13('0x16')]='disabled';this[_0xcc13('0xd')][_0x4efd40]['Imap'][_0xcc13('0x27')]='';this[_0xcc13('0x11')](_0x4efd40);}}}};EmailChannel[_0xcc13('0x10')]['handleImapBox']=function(_0x55d6d0,_0x390ecb){if(this['mailAccounts'][_0x55d6d0]){this['mailAccounts'][_0x55d6d0][_0xcc13('0x15')][_0xcc13('0x16')]=_0xcc13('0x28');this[_0xcc13('0xd')][_0x55d6d0][_0xcc13('0x15')][_0xcc13('0x27')]=_0x390ecb[_0xcc13('0x12')];if(_0x390ecb['messages']){this['mailAccounts'][_0x55d6d0][_0xcc13('0x15')]['total']=_0x390ecb[_0xcc13('0x29')][_0xcc13('0x17')];}return this[_0xcc13('0x11')](_0x55d6d0);}};EmailChannel['prototype'][_0xcc13('0x22')]=function(_0x1cf228,_0x248ff5){logger[_0xcc13('0xc')](_0xcc13('0x2a'),_0x248ff5[_0xcc13('0x2b')],_0x248ff5['lastName'],_0x248ff5[_0xcc13('0x2c')],_0x1cf228);if(this[_0xcc13('0xd')][_0x1cf228]){return mailAccount[_0xcc13('0x2d')](_0x1cf228,_0x248ff5)[_0xcc13('0x2e')](function(_0x8b1379){if(_0x8b1379){logger[_0xcc13('0xc')]('Mail\x20accepted\x20from\x20routing');}})[_0xcc13('0x2f')](function(_0x28f656){logger[_0xcc13('0x25')](_0xcc13('0x30'),JSON[_0xcc13('0x19')](_0x28f656));});}};EmailChannel[_0xcc13('0x10')][_0xcc13('0x24')]=function(_0xfbc399){if(this[_0xcc13('0xd')][_0xfbc399]&&this[_0xcc13('0xd')][_0xfbc399]['Imap']){if(this[_0xcc13('0xe')][this[_0xcc13('0xd')][_0xfbc399][_0xcc13('0x15')]['id']]){delete this[_0xcc13('0xe')][this[_0xcc13('0xd')][_0xfbc399][_0xcc13('0x15')]['id']];}this[_0xcc13('0xd')][_0xfbc399]['Imap']['lastSync']=moment();this[_0xcc13('0x11')](_0xfbc399);}};EmailChannel[_0xcc13('0x10')][_0xcc13('0x26')]=function(_0x1be174,_0x5bf4f9){if(this[_0xcc13('0xd')][_0x1be174]){this[_0xcc13('0xd')][_0x1be174]['Imap'][_0xcc13('0x16')]='error';this['mailAccounts'][_0x1be174][_0xcc13('0x15')]['messageStatus']=_0x5bf4f9;return this[_0xcc13('0x11')](_0x1be174);}};EmailChannel[_0xcc13('0x10')][_0xcc13('0x31')]=function(_0x5525d7,_0x1b4dbf){return this[_0xcc13('0xf')][_0xcc13('0x32')](_0x5525d7,_0x1b4dbf);};EmailChannel[_0xcc13('0x10')][_0xcc13('0x33')]=function(_0x41cc0c){var _0x955653=this;if(this['mailAccounts'][_0x41cc0c['id']]){if(_[_0xcc13('0x18')](this['mailAccounts'][_0x41cc0c['id']]['Smtp'])){this[_0xcc13('0xd')][_0x41cc0c['id']][_0xcc13('0x34')]={};}this[_0xcc13('0xd')][_0x41cc0c['id']][_0xcc13('0x34')][_0xcc13('0x35')]=moment();return new BPromise(function(_0x461893,_0x4c8503){return _0x955653[_0xcc13('0xf')]['verify'](_0x41cc0c)[_0xcc13('0x2e')](function(_0x5c8f89){_0x955653[_0xcc13('0xd')][_0x41cc0c['id']][_0xcc13('0x34')][_0xcc13('0x16')]=_0xcc13('0x36');_0x955653[_0xcc13('0xd')][_0x41cc0c['id']][_0xcc13('0x34')][_0xcc13('0x27')]='';_0x955653[_0xcc13('0x11')](_0x41cc0c['id']);_0x461893(_0x5c8f89);})[_0xcc13('0x2f')](function(_0x4254d7){_0x955653['mailAccounts'][_0x41cc0c['id']][_0xcc13('0x34')][_0xcc13('0x16')]=_0xcc13('0x25');_0x955653[_0xcc13('0xd')][_0x41cc0c['id']][_0xcc13('0x34')][_0xcc13('0x27')]=_0x4254d7;_0x955653['emit'](_0x41cc0c['id']);_0x4c8503(_0x4254d7);});});}return this[_0xcc13('0xf')][_0xcc13('0x37')](_0x41cc0c);};module[_0xcc13('0x38')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index d7f83fe..394c1b5 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 _0x6b1b=['xoauth2','generateXOAuth2Token','password','authentication','host','tls','autotls','required','handleReady','openBox','handleOpenBox','handleError','box','handleCloseBox','readUnseen','UNSEEN','handleReadUnseen','length','fetch','message','once','handleFetchError','handleFetchEnd','error','handleFetchMessage','body','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','handleMessageEnd','parser','account','emit','closeBox','stringify','textCode','hasOwnProperty','upperFirst','util','imap','mailparser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','getAccount','ready','end','handleEnd','bind','connect','inherits','prototype','connTimeout','authTimeout','user','anonymous@xcally.com','modernAuthentication'];(function(_0x46fc31,_0x3e8c3e){var _0x3de3cb=function(_0x49093f){while(--_0x49093f){_0x46fc31['push'](_0x46fc31['shift']());}};_0x3de3cb(++_0x3e8c3e);}(_0x6b1b,0x1e7));var _0xb6b1=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x6b1b[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0xb6b1('0x0'));var Imap=require(_0xb6b1('0x1'));var simpleParser=require(_0xb6b1('0x2'))['simpleParser'];var Iconv=require(_0xb6b1('0x3'))[_0xb6b1('0x4')];var EventEmitter=require(_0xb6b1('0x5'))[_0xb6b1('0x6')];var utils=require(_0xb6b1('0x7'));var logger=require(_0xb6b1('0x8'))(_0xb6b1('0x9'));function EmailImap(_0x113a39,_0x1ff716){this[_0xb6b1('0xa')]=_0xb6b1('0xb');this['account']=this[_0xb6b1('0xc')](_0x113a39,_0x1ff716);this['imap']=new Imap(this['account']);this[_0xb6b1('0x1')]['once'](_0xb6b1('0xd'),this['handleReady']['bind'](this));this['imap']['once'](_0xb6b1('0xe'),this[_0xb6b1('0xf')]['bind'](this));this[_0xb6b1('0x1')]['on']('error',this['handleError'][_0xb6b1('0x10')](this));this[_0xb6b1('0x1')][_0xb6b1('0x11')]();}util[_0xb6b1('0x12')](EmailImap,EventEmitter);EmailImap[_0xb6b1('0x13')][_0xb6b1('0xc')]=function(_0x360fc7,_0x429d0d){var _0x2a4d72={'connTimeout':_0x360fc7[_0xb6b1('0x14')]?_0x360fc7[_0xb6b1('0x14')]*0x3e8:0x2710,'authTimeout':_0x360fc7[_0xb6b1('0x15')]?_0x360fc7['authTimeout']*0x3e8:0x1388};if(_0x360fc7['service']){_0x2a4d72['user']=_0x360fc7['user'];_0x2a4d72[_0xb6b1('0x9')]=_0x429d0d||_0x360fc7[_0xb6b1('0x16')]||_0xb6b1('0x17');if(_0x360fc7[_0xb6b1('0x18')]){_0x2a4d72[_0xb6b1('0x19')]=utils[_0xb6b1('0x1a')](_0x360fc7['CloudProvider']['data5'],_0x360fc7[_0xb6b1('0x16')]);}else{_0x2a4d72[_0xb6b1('0x1b')]=_0x360fc7[_0xb6b1('0x1b')];}}else{if(_0x360fc7[_0xb6b1('0x1c')]){_0x2a4d72[_0xb6b1('0x16')]=_0x360fc7[_0xb6b1('0x16')];_0x2a4d72['password']=_0x360fc7['password'];}}_0x2a4d72[_0xb6b1('0x1d')]=_0x360fc7[_0xb6b1('0x1d')];_0x2a4d72['port']=_0x360fc7['port']||0x3e1;if(_0x360fc7[_0xb6b1('0x1e')]){_0x2a4d72['tls']=!![];}else{_0x2a4d72['tls']=![];_0x2a4d72[_0xb6b1('0x1f')]=_0xb6b1('0x20');}return _0x2a4d72;};EmailImap[_0xb6b1('0x13')][_0xb6b1('0x21')]=function(){this[_0xb6b1('0x1')][_0xb6b1('0x22')](this[_0xb6b1('0xa')],![],this[_0xb6b1('0x23')][_0xb6b1('0x10')](this));};EmailImap[_0xb6b1('0x13')]['handleOpenBox']=function(_0x214cd0,_0x4f1e2e){if(_0x214cd0){this[_0xb6b1('0x24')](_0x214cd0,!![]);}else{this['emit'](_0xb6b1('0x25'),_0x4f1e2e);this['readUnseen']();}};EmailImap[_0xb6b1('0x13')][_0xb6b1('0x26')]=function(_0xac4256){if(_0xac4256){this[_0xb6b1('0x24')](_0xac4256,!![]);}else{this[_0xb6b1('0x1')][_0xb6b1('0xe')]();}};EmailImap[_0xb6b1('0x13')][_0xb6b1('0x27')]=function(){this[_0xb6b1('0x1')]['search']([_0xb6b1('0x28')],this['handleReadUnseen'][_0xb6b1('0x10')](this));};EmailImap[_0xb6b1('0x13')][_0xb6b1('0x29')]=function(_0x3f8849,_0x136fe5){if(_0x3f8849){this[_0xb6b1('0x24')](_0x3f8849,!![]);}else{if(_0x136fe5[_0xb6b1('0x2a')]){try{var _0x59094f=this[_0xb6b1('0x1')][_0xb6b1('0x2b')](_0x136fe5,{'bodies':'','markSeen':!![]});_0x59094f['on'](_0xb6b1('0x2c'),this['handleFetchMessage'][_0xb6b1('0x10')](this));_0x59094f[_0xb6b1('0x2d')]('error',this[_0xb6b1('0x2e')][_0xb6b1('0x10')](this));_0x59094f[_0xb6b1('0x2d')](_0xb6b1('0xe'),this[_0xb6b1('0x2f')][_0xb6b1('0x10')](this));}catch(_0x4d29e4){logger[_0xb6b1('0x30')](_0x4d29e4);}}else{this[_0xb6b1('0x1')]['closeBox'](!![],this[_0xb6b1('0x26')]['bind'](this));}}};EmailImap[_0xb6b1('0x13')][_0xb6b1('0x31')]=function(_0x74e9b9){_0x74e9b9['on'](_0xb6b1('0x32'),this[_0xb6b1('0x33')][_0xb6b1('0x10')](this));_0x74e9b9['once'](_0xb6b1('0x34'),this[_0xb6b1('0x35')][_0xb6b1('0x10')](this));_0x74e9b9[_0xb6b1('0x2d')]('end',this['handleMessageEnd']['bind'](this));};EmailImap[_0xb6b1('0x13')][_0xb6b1('0x33')]=function(_0x2fbf10){simpleParser(_0x2fbf10,{'Iconv':Iconv},this[_0xb6b1('0x36')][_0xb6b1('0x10')](this));};EmailImap[_0xb6b1('0x13')][_0xb6b1('0x35')]=function(){};EmailImap[_0xb6b1('0x13')][_0xb6b1('0x37')]=function(){};EmailImap[_0xb6b1('0x13')][_0xb6b1('0x36')]=function(_0x1bc661,_0x5b8a57){if(_0x1bc661){logger[_0xb6b1('0x30')](_0x1bc661);}else{var _0x3b9312=this;utils[_0xb6b1('0x38')](this[_0xb6b1('0x39')],_0x5b8a57,function(_0x198224){_0x3b9312[_0xb6b1('0x3a')](_0xb6b1('0x9'),_0x198224);});}};EmailImap[_0xb6b1('0x13')][_0xb6b1('0x2f')]=function(){this[_0xb6b1('0x1')][_0xb6b1('0x3b')](!![],this['handleCloseBox'][_0xb6b1('0x10')](this));};EmailImap[_0xb6b1('0x13')][_0xb6b1('0x2e')]=function(_0x2d6b2b){this[_0xb6b1('0x24')](_0x2d6b2b);this[_0xb6b1('0x1')][_0xb6b1('0x3b')](!![],this[_0xb6b1('0x26')]['bind'](this));};EmailImap['prototype'][_0xb6b1('0xf')]=function(){this[_0xb6b1('0x3a')](_0xb6b1('0xe'));};EmailImap['prototype'][_0xb6b1('0x24')]=function(_0x44da6b,_0x186011){logger[_0xb6b1('0x30')](_0xb6b1('0x24'),this[_0xb6b1('0x39')][_0xb6b1('0x9')],JSON[_0xb6b1('0x3c')](_0x44da6b));var _0x490fa8='';if(_0x44da6b){if(_0x44da6b[_0xb6b1('0x3d')]){_0x490fa8=_0x44da6b['textCode'];}else{for(var _0xfb36e9 in _0x44da6b){if(_0x44da6b[_0xb6b1('0x3e')](_0xfb36e9)){_0x490fa8+=_[_0xb6b1('0x3f')](_0xfb36e9)+':\x20'+_0x44da6b[_0xfb36e9]+'\x0a';}}}}if(_0x186011){this[_0xb6b1('0x1')][_0xb6b1('0xe')]();}else{this[_0xb6b1('0x3a')]('error',_0x490fa8);this[_0xb6b1('0x3a')](_0xb6b1('0xe'));}};module['exports']=EmailImap; \ No newline at end of file +var _0x66fa=['handleError','search','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','mailbox','INBOX','account','imap','ready','once','end','bind','error','connect','getAccount','connTimeout','authTimeout','service','email','user','anonymous@xcally.com','modernAuthentication','generateXOAuth2Token','password','authentication','host','port','tls','required','prototype','handleReady','handleOpenBox','emit','box','readUnseen','handleCloseBox'];(function(_0x256d98,_0x1376e8){var _0x6d4ed=function(_0x354243){while(--_0x354243){_0x256d98['push'](_0x256d98['shift']());}};_0x6d4ed(++_0x1376e8);}(_0x66fa,0x117));var _0xa66f=function(_0x14bb0f,_0x247015){_0x14bb0f=_0x14bb0f-0x0;var _0x3a26b6=_0x66fa[_0x14bb0f];return _0x3a26b6;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var Imap=require('imap');var simpleParser=require(_0xa66f('0x2'))[_0xa66f('0x3')];var Iconv=require(_0xa66f('0x4'))[_0xa66f('0x5')];var EventEmitter=require(_0xa66f('0x6'))[_0xa66f('0x7')];var utils=require(_0xa66f('0x8'));var logger=require('../../../config/logger')('email');function EmailImap(_0x2239d3,_0x20a150){this[_0xa66f('0x9')]=_0xa66f('0xa');this[_0xa66f('0xb')]=this['getAccount'](_0x2239d3,_0x20a150);this[_0xa66f('0xc')]=new Imap(this['account']);this[_0xa66f('0xc')]['once'](_0xa66f('0xd'),this['handleReady']['bind'](this));this['imap'][_0xa66f('0xe')](_0xa66f('0xf'),this['handleEnd'][_0xa66f('0x10')](this));this['imap']['on'](_0xa66f('0x11'),this['handleError'][_0xa66f('0x10')](this));this[_0xa66f('0xc')][_0xa66f('0x12')]();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype'][_0xa66f('0x13')]=function(_0x4e09cf,_0x528427){var _0x5a7b16={'connTimeout':_0x4e09cf[_0xa66f('0x14')]?_0x4e09cf[_0xa66f('0x14')]*0x3e8:0x2710,'authTimeout':_0x4e09cf[_0xa66f('0x15')]?_0x4e09cf[_0xa66f('0x15')]*0x3e8:0x1388};if(_0x4e09cf[_0xa66f('0x16')]){_0x5a7b16['user']=_0x4e09cf['user'];_0x5a7b16[_0xa66f('0x17')]=_0x528427||_0x4e09cf[_0xa66f('0x18')]||_0xa66f('0x19');if(_0x4e09cf[_0xa66f('0x1a')]){_0x5a7b16['xoauth2']=utils[_0xa66f('0x1b')](_0x4e09cf['CloudProvider']['data5'],_0x4e09cf[_0xa66f('0x18')]);}else{_0x5a7b16[_0xa66f('0x1c')]=_0x4e09cf[_0xa66f('0x1c')];}}else{if(_0x4e09cf[_0xa66f('0x1d')]){_0x5a7b16[_0xa66f('0x18')]=_0x4e09cf[_0xa66f('0x18')];_0x5a7b16[_0xa66f('0x1c')]=_0x4e09cf[_0xa66f('0x1c')];}}_0x5a7b16[_0xa66f('0x1e')]=_0x4e09cf[_0xa66f('0x1e')];_0x5a7b16[_0xa66f('0x1f')]=_0x4e09cf[_0xa66f('0x1f')]||0x3e1;if(_0x4e09cf[_0xa66f('0x20')]){_0x5a7b16[_0xa66f('0x20')]=!![];}else{_0x5a7b16[_0xa66f('0x20')]=![];_0x5a7b16['autotls']=_0xa66f('0x21');}return _0x5a7b16;};EmailImap[_0xa66f('0x22')][_0xa66f('0x23')]=function(){this[_0xa66f('0xc')]['openBox'](this[_0xa66f('0x9')],![],this[_0xa66f('0x24')][_0xa66f('0x10')](this));};EmailImap[_0xa66f('0x22')]['handleOpenBox']=function(_0x5e9639,_0xed98b9){if(_0x5e9639){this['handleError'](_0x5e9639,!![]);}else{this[_0xa66f('0x25')](_0xa66f('0x26'),_0xed98b9);this[_0xa66f('0x27')]();}};EmailImap['prototype'][_0xa66f('0x28')]=function(_0x1c2903){if(_0x1c2903){this[_0xa66f('0x29')](_0x1c2903,!![]);}else{this[_0xa66f('0xc')][_0xa66f('0xf')]();}};EmailImap[_0xa66f('0x22')][_0xa66f('0x27')]=function(){this[_0xa66f('0xc')][_0xa66f('0x2a')]([_0xa66f('0x2b')],this[_0xa66f('0x2c')][_0xa66f('0x10')](this));};EmailImap[_0xa66f('0x22')][_0xa66f('0x2c')]=function(_0x49f615,_0x4c0695){if(_0x49f615){this[_0xa66f('0x29')](_0x49f615,!![]);}else{if(_0x4c0695[_0xa66f('0x2d')]){try{var _0x55f309=this[_0xa66f('0xc')][_0xa66f('0x2e')](_0x4c0695,{'bodies':'','markSeen':!![]});_0x55f309['on']('message',this[_0xa66f('0x2f')][_0xa66f('0x10')](this));_0x55f309[_0xa66f('0xe')](_0xa66f('0x11'),this[_0xa66f('0x30')]['bind'](this));_0x55f309[_0xa66f('0xe')]('end',this[_0xa66f('0x31')][_0xa66f('0x10')](this));}catch(_0x2e4dc8){logger['error'](_0x2e4dc8);}}else{this[_0xa66f('0xc')][_0xa66f('0x32')](!![],this['handleCloseBox'][_0xa66f('0x10')](this));}}};EmailImap[_0xa66f('0x22')][_0xa66f('0x2f')]=function(_0x3e7ac5){_0x3e7ac5['on'](_0xa66f('0x33'),this[_0xa66f('0x34')][_0xa66f('0x10')](this));_0x3e7ac5[_0xa66f('0xe')](_0xa66f('0x35'),this[_0xa66f('0x36')]['bind'](this));_0x3e7ac5[_0xa66f('0xe')]('end',this[_0xa66f('0x37')][_0xa66f('0x10')](this));};EmailImap[_0xa66f('0x22')][_0xa66f('0x34')]=function(_0x3722d3){simpleParser(_0x3722d3,{'Iconv':Iconv},this[_0xa66f('0x38')][_0xa66f('0x10')](this));};EmailImap[_0xa66f('0x22')]['handleMessageAttributes']=function(){};EmailImap[_0xa66f('0x22')]['handleMessageEnd']=function(){};EmailImap[_0xa66f('0x22')][_0xa66f('0x38')]=function(_0x2ed1fb,_0x47b21a){if(_0x2ed1fb){logger['error'](_0x2ed1fb);}else{var _0x1b9174=this;utils[_0xa66f('0x39')](this[_0xa66f('0xb')],_0x47b21a,function(_0x1f5a5f){_0x1b9174[_0xa66f('0x25')]('email',_0x1f5a5f);});}};EmailImap['prototype']['handleFetchEnd']=function(){this[_0xa66f('0xc')]['closeBox'](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0xa66f('0x22')]['handleFetchError']=function(_0x8965d3){this[_0xa66f('0x29')](_0x8965d3);this[_0xa66f('0xc')][_0xa66f('0x32')](!![],this[_0xa66f('0x28')][_0xa66f('0x10')](this));};EmailImap[_0xa66f('0x22')][_0xa66f('0x3a')]=function(){this[_0xa66f('0x25')](_0xa66f('0xf'));};EmailImap[_0xa66f('0x22')][_0xa66f('0x29')]=function(_0x17e803,_0x13875a){logger['error'](_0xa66f('0x29'),this[_0xa66f('0xb')]['email'],JSON[_0xa66f('0x3b')](_0x17e803));var _0x4b6e6b='';if(_0x17e803){if(_0x17e803[_0xa66f('0x3c')]){_0x4b6e6b=_0x17e803[_0xa66f('0x3c')];}else{for(var _0x5f5b25 in _0x17e803){if(_0x17e803[_0xa66f('0x3d')](_0x5f5b25)){_0x4b6e6b+=_[_0xa66f('0x3e')](_0x5f5b25)+':\x20'+_0x17e803[_0x5f5b25]+'\x0a';}}}}if(_0x13875a){this[_0xa66f('0xc')]['end']();}else{this[_0xa66f('0x25')]('error',_0x4b6e6b);this[_0xa66f('0x25')](_0xa66f('0xf'));}};module[_0xa66f('0x3f')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 78b891c..20b3ac0 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 _0x1ed9=['use','compile','sendMail','verify','toString','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','createTransport'];(function(_0x45c044,_0x54f7e4){var _0x12e9d5=function(_0x57cba9){while(--_0x57cba9){_0x45c044['push'](_0x45c044['shift']());}};_0x12e9d5(++_0x54f7e4);}(_0x1ed9,0x9c));var _0x91ed=function(_0x5249f5,_0x1abd1d){_0x5249f5=_0x5249f5-0x0;var _0x2508fe=_0x1ed9[_0x5249f5];return _0x2508fe;};'use strict';var nodemailer=require(_0x91ed('0x0'));var inlineBase64=require(_0x91ed('0x1'));function EmailSmtp(){}EmailSmtp[_0x91ed('0x2')]['send']=function(_0x3136b8,_0x2692a6){return new Promise(function(_0x1f6223,_0x3846c7){var _0x1cb66f=nodemailer[_0x91ed('0x3')](_0x3136b8);_0x1cb66f[_0x91ed('0x4')](_0x91ed('0x5'),inlineBase64());_0x1cb66f[_0x91ed('0x6')](_0x2692a6,function(_0x2b6421,_0x303cf8){if(_0x2b6421){_0x3846c7(_0x2b6421['toString']());}else{_0x1f6223(_0x303cf8);}});});};EmailSmtp[_0x91ed('0x2')][_0x91ed('0x7')]=function(_0x571d7e){return new Promise(function(_0x8d8d19,_0x1d9df0){var _0x2aa463=nodemailer[_0x91ed('0x3')](_0x571d7e);_0x2aa463[_0x91ed('0x7')](function(_0x496362,_0x3b8739){if(_0x496362){_0x1d9df0(_0x496362[_0x91ed('0x8')]());}else{if(_0x3b8739){_0x8d8d19(_0x3b8739);}else{_0x1d9df0('Not\x20verifired');}}});});};module[_0x91ed('0x9')]=EmailSmtp; \ No newline at end of file +var _0x376f=['verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport','toString'];(function(_0x5c8f3e,_0x33ba70){var _0xb55f35=function(_0x48f8ef){while(--_0x48f8ef){_0x5c8f3e['push'](_0x5c8f3e['shift']());}};_0xb55f35(++_0x33ba70);}(_0x376f,0xe4));var _0xf376=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x376f[_0x565ed7];return _0x183ad7;};'use strict';var nodemailer=require(_0xf376('0x0'));var inlineBase64=require(_0xf376('0x1'));function EmailSmtp(){}EmailSmtp[_0xf376('0x2')][_0xf376('0x3')]=function(_0x31b096,_0x11d322){return new Promise(function(_0x2f4501,_0x320059){var _0x196c0f=nodemailer[_0xf376('0x4')](_0x31b096);_0x196c0f['use']('compile',inlineBase64());_0x196c0f['sendMail'](_0x11d322,function(_0x59941d,_0x3dfd4e){if(_0x59941d){_0x320059(_0x59941d[_0xf376('0x5')]());}else{_0x2f4501(_0x3dfd4e);}});});};EmailSmtp[_0xf376('0x2')][_0xf376('0x6')]=function(_0x55a911){return new Promise(function(_0x277d47,_0x58de27){var _0x320a5b=nodemailer[_0xf376('0x4')](_0x55a911);_0x320a5b['verify'](function(_0x32b625,_0x5f0f32){if(_0x32b625){_0x58de27(_0x32b625[_0xf376('0x5')]());}else{if(_0x5f0f32){_0x277d47(_0x5f0f32);}else{_0x58de27(_0xf376('0x7'));}}});});};module[_0xf376('0x8')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 4870a55..59ca739 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 _0x3278=['join','Anonymous','pop','isEmpty','@xcally.com','html','test','\x20[Attachment:\x20','body','textAsHtml','Empty\x20message

','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','lodash','randomstring','util','node-tnef','../../../config/environment','head','value','address','anonymous','generate','name','substring','indexOf','split','length'];(function(_0x49802b,_0x34ff39){var _0x1ecad3=function(_0x370218){while(--_0x370218){_0x49802b['push'](_0x49802b['shift']());}};_0x1ecad3(++_0x34ff39);}(_0x3278,0x14a));var _0x8327=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3278[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8327('0x0'));var moment=require('moment');var random=require(_0x8327('0x1'));var fs=require('fs');var path=require('path');var util=require(_0x8327('0x2'));var tnef=require(_0x8327('0x3'));var logger=require('../../../config/logger')('email');var config=require(_0x8327('0x4'));function getAddress(_0x27a354){var _0x1ad1ef=_[_0x8327('0x5')](_0x27a354[_0x8327('0x6')]);return _0x1ad1ef&&_0x1ad1ef[_0x8327('0x7')]?_0x1ad1ef[_0x8327('0x7')]:_0x8327('0x8')+random[_0x8327('0x9')](0x6)+'@xcally.com';}function getFirstName(_0x339aac){var _0x174e2=_[_0x8327('0x5')](_0x339aac[_0x8327('0x6')]);if(_0x174e2&&_0x174e2['name']){if(_0x174e2[_0x8327('0xa')]==_0x174e2[_0x8327('0x7')]){return _0x174e2[_0x8327('0xa')][_0x8327('0xb')](0x0,_0x174e2[_0x8327('0xa')][_0x8327('0xc')]('@'));}var _0x3218b3=_0x174e2[_0x8327('0xa')][_0x8327('0xd')](/\s+/);return _0x3218b3[_0x8327('0xe')]>0x1?_0x3218b3['slice'](0x0,-0x1)[_0x8327('0xf')]('\x20'):_0x174e2[_0x8327('0xa')];}return _0x8327('0x10');}function getLastName(_0x4d6b89){var _0x5a835b=_[_0x8327('0x5')](_0x4d6b89[_0x8327('0x6')]);if(_0x5a835b&&_0x5a835b['name']){var _0x3b6a90=_0x5a835b[_0x8327('0xa')]['split'](/\s+/);return _0x3b6a90['length']>0x1?_0x3b6a90[_0x8327('0x11')]():'';}return'';}function getMails(_0x4ea9d8,_0xbfd9ab){var _0xffa8c2='';for(var _0x22cc29=0x0;_0x22cc29<_0xbfd9ab[_0x8327('0x6')]['length'];_0x22cc29+=0x1){if(_0xbfd9ab['value'][_0x22cc29]['address']!==_0x4ea9d8){if(!_[_0x8327('0x12')](_0xffa8c2)){_0xffa8c2+=',';}_0xffa8c2+=_0xbfd9ab[_0x8327('0x6')][_0x22cc29][_0x8327('0xa')]||_0xbfd9ab[_0x8327('0x6')][_0x22cc29][_0x8327('0x7')]||'';_0xffa8c2+='\x20<';_0xffa8c2+=_0xbfd9ab[_0x8327('0x6')][_0x22cc29]['address']?_0xbfd9ab[_0x8327('0x6')][_0x22cc29][_0x8327('0x7')]:'anonymous'+random[_0x8327('0x9')](0x6)+_0x8327('0x13');_0xffa8c2+='>';}}return _0xffa8c2;}function parseEmail(_0x359fcb,_0x78ade6,_0x2758c5){if(_0x78ade6[_0x8327('0x14')]){var _0x2865f1=/)<[^<]*)*<\/script>/gi;while(_0x2865f1[_0x8327('0x15')](_0x78ade6[_0x8327('0x14')])){_0x78ade6[_0x8327('0x14')]=_0x78ade6[_0x8327('0x14')]['replace'](_0x2865f1,'');}if(_0x78ade6[_0x8327('0x14')]['includes'](_0x8327('0x16'))){var _0x1a1183=[];_0x78ade6[_0x8327('0x17')][_0x8327('0x18')](_0x390603=>{_0x1a1183[_0x8327('0x19')](_0x390603[_0x8327('0x1a')]);});var _0x2c7450=/]+>/g;var _0x33623f=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x3ace3d=_0x78ade6['html'][_0x8327('0x1b')](_0x33623f,'_SRC');var _0x10998c=_0x3ace3d['replace'](_0x2c7450,'_IMG');for(let _0x41cae6=0x0;_0x41cae6<_0x1a1183[_0x8327('0xe')];_0x41cae6++){var _0x1f6ce1=_0x10998c['replace'](_0x8327('0x1c'),_0x8327('0x1d')+_0x1a1183[_0x41cae6]+'\x20]');_0x10998c=_0x1f6ce1;}_0x78ade6[_0x8327('0x14')]=_0x10998c;}_0x2758c5[_0x8327('0x1e')]=_0x78ade6[_0x8327('0x14')];}else{_0x2758c5[_0x8327('0x1e')]=_0x78ade6[_0x8327('0x1f')];}if(_0x2758c5['body']){_0x2758c5[_0x8327('0x1e')]=_0x2758c5['body'][_0x8327('0x1b')](/0x0){var _0x4c667a=[_0x8327('0x30'),_0x8327('0x31'),'Precedence:\x20auto_reply'];for(var _0x24a77d=0x0;_0x24a77d<_0x78ade6['headerLines']['length'];_0x24a77d++){var _0x2bb4a7=_['indexOf'](_0x4c667a,_0x78ade6[_0x8327('0x2f')][_0x24a77d][_0x8327('0x32')]);if(_0x2bb4a7>=0x0){_0x2758c5[_0x8327('0x33')]=!![];}}}return _0x2758c5;}exports[_0x8327('0x34')]=function(_0x263bf7,_0x1a8d77,_0xc340ac){var _0x554aba={'from':getAddress(_0x1a8d77[_0x8327('0x35')]),'firstName':getFirstName(_0x1a8d77[_0x8327('0x35')]),'lastName':getLastName(_0x1a8d77['from']),'mapKey':_0x8327('0x22'),'message':{'from':getMails(_0x263bf7[_0x8327('0x22')],_0x1a8d77[_0x8327('0x35')]),'to':_0x263bf7[_0x8327('0x22')],'cc':'','subject':_0x1a8d77['subject']||'','messageId':_0x1a8d77['messageId'],'inReplyTo':_0x1a8d77['inReplyTo'],'sentAt':moment(_0x1a8d77['date'])['format']('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x1a8d77[_0x8327('0x14')]&&!_0x1a8d77['textAsHtml']){var _0x328057=_[_0x8327('0x36')](_0x1a8d77[_0x8327('0x17')],{'contentType':_0x8327('0x37')});if(_0x328057[_0x8327('0xe')]){logger[_0x8327('0x38')](util[_0x8327('0x29')](_0x8327('0x39'),_0x1a8d77[_0x8327('0x3a')]));tnef[_0x8327('0x3b')](_['first'](_0x328057)['content'],function(_0x433319,_0x3103f5){if(_0x3103f5){_0x1a8d77[_0x8327('0x14')]=_0x3103f5[_0x8327('0x3c')]||'

Empty\x20message

';if(_0x3103f5['Attachments']){for(var _0x5f4b8d=0x0;_0x5f4b8d<_0x3103f5['Attachments'][_0x8327('0xe')];_0x5f4b8d++){var _0x50927e=_0x3103f5['Attachments'][_0x5f4b8d];_0x554aba[_0x8327('0x23')][_0x8327('0x17')]['push']({'filename':_0x50927e[_0x8327('0x3d')],'content':Buffer[_0x8327('0x35')](_0x50927e[_0x8327('0x3e')])});}}}_0xc340ac(parseEmail(_0x263bf7,_0x1a8d77,_0x554aba));});}else{_0x1a8d77[_0x8327('0x14')]=_0x8327('0x3f');_0xc340ac(parseEmail(_0x263bf7,_0x1a8d77,_0x554aba));}}else{_0xc340ac(parseEmail(_0x263bf7,_0x1a8d77,_0x554aba));}};exports[_0x8327('0x40')]=function(_0x34d935,_0x4e5da0){var _0x2c1414=[_0x8327('0x41')+(_0x4e5da0||''),_0x8327('0x42')+_0x34d935,'',''];return Buffer[_0x8327('0x35')](_0x2c1414[_0x8327('0xf')](''),_0x8327('0x43'))[_0x8327('0x44')]('base64');}; \ No newline at end of file +var _0xa430=['\x20[Attachment:\x20','\x20]','body','Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','head','address','anonymous','generate','@xcally.com','value','name','substring','indexOf','length','slice','join','Anonymous','split','pop','html','test','replace','includes'];(function(_0x6e9f7e,_0x45fdab){var _0x44939d=function(_0x4f9cb4){while(--_0x4f9cb4){_0x6e9f7e['push'](_0x6e9f7e['shift']());}};_0x44939d(++_0x45fdab);}(_0xa430,0x11d));var _0x0a43=function(_0x209e0f,_0xf3b415){_0x209e0f=_0x209e0f-0x0;var _0x3b1deb=_0xa430[_0x209e0f];return _0x3b1deb;};'use strict';var _=require(_0x0a43('0x0'));var moment=require(_0x0a43('0x1'));var random=require(_0x0a43('0x2'));var fs=require('fs');var path=require(_0x0a43('0x3'));var util=require(_0x0a43('0x4'));var tnef=require(_0x0a43('0x5'));var logger=require(_0x0a43('0x6'))(_0x0a43('0x7'));var config=require('../../../config/environment');function getAddress(_0x90ec0b){var _0x4593d2=_[_0x0a43('0x8')](_0x90ec0b['value']);return _0x4593d2&&_0x4593d2[_0x0a43('0x9')]?_0x4593d2[_0x0a43('0x9')]:_0x0a43('0xa')+random[_0x0a43('0xb')](0x6)+_0x0a43('0xc');}function getFirstName(_0x49ff1d){var _0x2f4d21=_[_0x0a43('0x8')](_0x49ff1d[_0x0a43('0xd')]);if(_0x2f4d21&&_0x2f4d21[_0x0a43('0xe')]){if(_0x2f4d21['name']==_0x2f4d21['address']){return _0x2f4d21[_0x0a43('0xe')][_0x0a43('0xf')](0x0,_0x2f4d21['name'][_0x0a43('0x10')]('@'));}var _0x3c7d1f=_0x2f4d21[_0x0a43('0xe')]['split'](/\s+/);return _0x3c7d1f[_0x0a43('0x11')]>0x1?_0x3c7d1f[_0x0a43('0x12')](0x0,-0x1)[_0x0a43('0x13')]('\x20'):_0x2f4d21[_0x0a43('0xe')];}return _0x0a43('0x14');}function getLastName(_0x4931b0){var _0x30fca1=_[_0x0a43('0x8')](_0x4931b0[_0x0a43('0xd')]);if(_0x30fca1&&_0x30fca1[_0x0a43('0xe')]){var _0x33f859=_0x30fca1[_0x0a43('0xe')][_0x0a43('0x15')](/\s+/);return _0x33f859[_0x0a43('0x11')]>0x1?_0x33f859[_0x0a43('0x16')]():'';}return'';}function getMails(_0x511380,_0x5960d0){var _0x14ec60='';for(var _0x2e8413=0x0;_0x2e8413<_0x5960d0['value'][_0x0a43('0x11')];_0x2e8413+=0x1){if(_0x5960d0[_0x0a43('0xd')][_0x2e8413][_0x0a43('0x9')]!==_0x511380){if(!_['isEmpty'](_0x14ec60)){_0x14ec60+=',';}_0x14ec60+=_0x5960d0[_0x0a43('0xd')][_0x2e8413][_0x0a43('0xe')]||_0x5960d0[_0x0a43('0xd')][_0x2e8413][_0x0a43('0x9')]||'';_0x14ec60+='\x20<';_0x14ec60+=_0x5960d0[_0x0a43('0xd')][_0x2e8413][_0x0a43('0x9')]?_0x5960d0['value'][_0x2e8413][_0x0a43('0x9')]:_0x0a43('0xa')+random['generate'](0x6)+_0x0a43('0xc');_0x14ec60+='>';}}return _0x14ec60;}function parseEmail(_0xb7c467,_0x157c7d,_0x412844){if(_0x157c7d[_0x0a43('0x17')]){var _0x4187d6=/)<[^<]*)*<\/script>/gi;while(_0x4187d6[_0x0a43('0x18')](_0x157c7d[_0x0a43('0x17')])){_0x157c7d[_0x0a43('0x17')]=_0x157c7d[_0x0a43('0x17')][_0x0a43('0x19')](_0x4187d6,'');}if(_0x157c7d[_0x0a43('0x17')][_0x0a43('0x1a')](_0x0a43('0x1b'))){var _0x20be84=[];_0x157c7d[_0x0a43('0x1c')][_0x0a43('0x1d')](_0x5461ca=>{_0x20be84[_0x0a43('0x1e')](_0x5461ca[_0x0a43('0x1f')]);});var _0x583f15=/]+>/g;var _0x2308e2=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x440006=_0x157c7d[_0x0a43('0x17')][_0x0a43('0x19')](_0x2308e2,'_SRC');var _0x34b2bc=_0x440006[_0x0a43('0x19')](_0x583f15,'_IMG');for(let _0x1a63a3=0x0;_0x1a63a3<_0x20be84[_0x0a43('0x11')];_0x1a63a3++){var _0x1d84d1=_0x34b2bc[_0x0a43('0x19')](_0x0a43('0x20'),_0x0a43('0x21')+_0x20be84[_0x1a63a3]+_0x0a43('0x22'));_0x34b2bc=_0x1d84d1;}_0x157c7d[_0x0a43('0x17')]=_0x34b2bc;}_0x412844[_0x0a43('0x23')]=_0x157c7d[_0x0a43('0x17')];}else{_0x412844[_0x0a43('0x23')]=_0x157c7d['textAsHtml'];}if(_0x412844[_0x0a43('0x23')]){_0x412844['body']=_0x412844[_0x0a43('0x23')][_0x0a43('0x19')](/0x0){var _0x441266=[_0x0a43('0x34'),_0x0a43('0x35'),_0x0a43('0x36')];for(var _0x5dd87c=0x0;_0x5dd87c<_0x157c7d[_0x0a43('0x33')][_0x0a43('0x11')];_0x5dd87c++){var _0x57b892=_[_0x0a43('0x10')](_0x441266,_0x157c7d[_0x0a43('0x33')][_0x5dd87c][_0x0a43('0x37')]);if(_0x57b892>=0x0){_0x412844['isAutoreply']=!![];}}}return _0x412844;}exports['parser']=function(_0x4ff3c5,_0x2f2cf4,_0x266643){var _0x13bb86={'from':getAddress(_0x2f2cf4['from']),'firstName':getFirstName(_0x2f2cf4[_0x0a43('0x38')]),'lastName':getLastName(_0x2f2cf4['from']),'mapKey':_0x0a43('0x7'),'message':{'from':getMails(_0x4ff3c5[_0x0a43('0x7')],_0x2f2cf4[_0x0a43('0x38')]),'to':_0x4ff3c5[_0x0a43('0x7')],'cc':'','subject':_0x2f2cf4['subject']||'','messageId':_0x2f2cf4[_0x0a43('0x39')],'inReplyTo':_0x2f2cf4[_0x0a43('0x3a')],'sentAt':moment(_0x2f2cf4[_0x0a43('0x3b')])['format'](_0x0a43('0x3c')),'attach':![],'attachments':[]}};if(!_0x2f2cf4['html']&&!_0x2f2cf4['textAsHtml']){var _0x2c66a6=_[_0x0a43('0x3d')](_0x2f2cf4['attachments'],{'contentType':_0x0a43('0x3e')});if(_0x2c66a6[_0x0a43('0x11')]){logger[_0x0a43('0x3f')](util[_0x0a43('0x40')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x2f2cf4[_0x0a43('0x39')]));tnef[_0x0a43('0x41')](_[_0x0a43('0x42')](_0x2c66a6)['content'],function(_0xa0ab68,_0xf2fcb5){if(_0xf2fcb5){_0x2f2cf4[_0x0a43('0x17')]=_0xf2fcb5[_0x0a43('0x43')]||_0x0a43('0x44');if(_0xf2fcb5['Attachments']){for(var _0x15c76d=0x0;_0x15c76d<_0xf2fcb5[_0x0a43('0x45')][_0x0a43('0x11')];_0x15c76d++){var _0x3feb2b=_0xf2fcb5[_0x0a43('0x45')][_0x15c76d];_0x13bb86['message'][_0x0a43('0x1c')][_0x0a43('0x1e')]({'filename':_0x3feb2b[_0x0a43('0x46')],'content':Buffer[_0x0a43('0x38')](_0x3feb2b[_0x0a43('0x47')])});}}}_0x266643(parseEmail(_0x4ff3c5,_0x2f2cf4,_0x13bb86));});}else{_0x2f2cf4[_0x0a43('0x17')]='

Empty\x20message

';_0x266643(parseEmail(_0x4ff3c5,_0x2f2cf4,_0x13bb86));}}else{_0x266643(parseEmail(_0x4ff3c5,_0x2f2cf4,_0x13bb86));}};exports[_0x0a43('0x48')]=function(_0x18f07f,_0x16f2e2){var _0x126159=[_0x0a43('0x49')+(_0x16f2e2||''),_0x0a43('0x4a')+_0x18f07f,'',''];return Buffer[_0x0a43('0x38')](_0x126159[_0x0a43('0x13')](''),_0x0a43('0x4b'))[_0x0a43('0x4c')](_0x0a43('0x4d'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 4fa1d58..a6b9c65 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 _0x83b1=['name','Service','key','active','Imap','Smtp','exports'];(function(_0x4b69ae,_0x207c9b){var _0x28bdd3=function(_0x3211da){while(--_0x3211da){_0x4b69ae['push'](_0x4b69ae['shift']());}};_0x28bdd3(++_0x207c9b);}(_0x83b1,0x1ab));var _0x183b=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x83b1[_0x40ac5e];return _0x2839d6;};'use strict';var _=require('lodash');function MailAccount(_0x356c83){this['id']=_0x356c83['id']||0x0;this[_0x183b('0x0')]=_0x356c83['name']||_0x183b('0x1');this[_0x183b('0x2')]=_0x356c83[_0x183b('0x2')]||'SERV';this[_0x183b('0x3')]=_0x356c83[_0x183b('0x3')]||![];this[_0x183b('0x4')]=_0x356c83[_0x183b('0x4')]||[];this[_0x183b('0x5')]=_0x356c83[_0x183b('0x5')]||[];}module[_0x183b('0x6')]=MailAccount; \ No newline at end of file +var _0x9d24=['Imap','Smtp','exports','lodash','name','Service','key','active'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x9d24,0x6b));var _0x49d2=function(_0x36a6f2,_0x50e09a){_0x36a6f2=_0x36a6f2-0x0;var _0x3140a2=_0x9d24[_0x36a6f2];return _0x3140a2;};'use strict';var _=require(_0x49d2('0x0'));function MailAccount(_0x2b417c){this['id']=_0x2b417c['id']||0x0;this['name']=_0x2b417c[_0x49d2('0x1')]||_0x49d2('0x2');this[_0x49d2('0x3')]=_0x2b417c['key']||'SERV';this[_0x49d2('0x4')]=_0x2b417c[_0x49d2('0x4')]||![];this[_0x49d2('0x5')]=_0x2b417c[_0x49d2('0x5')]||[];this[_0x49d2('0x6')]=_0x2b417c[_0x49d2('0x6')]||[];}module[_0x49d2('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 61784ab..2731438 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 _0xe085=['mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length','isUndefined','exports','lodash','../model/mailAccount','mailAccounts'];(function(_0x2995d8,_0x3253ea){var _0x42a81b=function(_0x2f7507){while(--_0x2f7507){_0x2995d8['push'](_0x2995d8['shift']());}};_0x42a81b(++_0x3253ea);}(_0xe085,0x110));var _0x5e08=function(_0x254f7b,_0x15c230){_0x254f7b=_0x254f7b-0x0;var _0x4a34a1=_0xe085[_0x254f7b];return _0x4a34a1;};'use strict';var _=require(_0x5e08('0x0'));var MailAccount=require(_0x5e08('0x1'));var Realtime=function(){this[_0x5e08('0x2')]={};};function freeIsNotKey(_0x51bcba,_0xb4cf58,_0x483293){var _0x517974=_[_0x5e08('0x3')](_0x51bcba,function(_0x1ac860,_0x479fb7){return _0x1ac860[_0x483293];});for(var _0x5d5a9d in _0xb4cf58){if(_0xb4cf58[_0x5e08('0x4')](_0x5d5a9d)){if(!_0x517974[_0x5d5a9d]){delete _0xb4cf58[_0x5d5a9d];}}}}Realtime[_0x5e08('0x5')][_0x5e08('0x6')]=function(_0x251c84,_0x4618d1){for(var _0xc96fa7 in _0x4618d1){if(_0x251c84[_0x5e08('0x4')](_0xc96fa7)){_0x251c84[_0xc96fa7]=_0x4618d1[_0xc96fa7];}}};Realtime[_0x5e08('0x5')][_0x5e08('0x7')]=function(){var _0x5dd4b5=this;return function(_0x5e6dda){if(_0x5e6dda){freeIsNotKey(_0x5e6dda,_0x5dd4b5[_0x5e08('0x2')],'id');for(var _0x1c7fdf=0x0,_0x370a4b={},_0x32952e={};_0x1c7fdf<_0x5e6dda[_0x5e08('0x8')];_0x1c7fdf+=0x1){_0x370a4b=_0x5e6dda[_0x1c7fdf];if(_[_0x5e08('0x9')](_0x5dd4b5[_0x5e08('0x2')][_0x370a4b['id']])){_0x5dd4b5['mailAccounts'][_0x370a4b['id']]=new MailAccount(_0x370a4b);}else{_['merge'](_0x5dd4b5['mailAccounts'][_0x370a4b['id']],_0x370a4b);}}}return _0x5dd4b5[_0x5e08('0x2')];};};module[_0x5e08('0xa')]=Realtime; \ No newline at end of file +var _0xef22=['hasOwnProperty','prototype','mergeFromDatabase','length','isUndefined','merge','lodash','../model/mailAccount','mailAccounts','mapKeys'];(function(_0x2f0209,_0xe6efca){var _0x35d6d4=function(_0x3dfbb1){while(--_0x3dfbb1){_0x2f0209['push'](_0x2f0209['shift']());}};_0x35d6d4(++_0xe6efca);}(_0xef22,0x1be));var _0x2ef2=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xef22[_0x411add];return _0x238242;};'use strict';var _=require(_0x2ef2('0x0'));var MailAccount=require(_0x2ef2('0x1'));var Realtime=function(){this[_0x2ef2('0x2')]={};};function freeIsNotKey(_0x34567c,_0x5570dd,_0x409b13){var _0x134321=_[_0x2ef2('0x3')](_0x34567c,function(_0x545738,_0x305ad5){return _0x545738[_0x409b13];});for(var _0x2ac3a9 in _0x5570dd){if(_0x5570dd[_0x2ef2('0x4')](_0x2ac3a9)){if(!_0x134321[_0x2ac3a9]){delete _0x5570dd[_0x2ac3a9];}}}}Realtime[_0x2ef2('0x5')][_0x2ef2('0x6')]=function(_0x574672,_0x2c8eec){for(var _0x3847bb in _0x2c8eec){if(_0x574672[_0x2ef2('0x4')](_0x3847bb)){_0x574672[_0x3847bb]=_0x2c8eec[_0x3847bb];}}};Realtime[_0x2ef2('0x5')]['initMailAccounts']=function(){var _0x399c20=this;return function(_0xa50fc1){if(_0xa50fc1){freeIsNotKey(_0xa50fc1,_0x399c20[_0x2ef2('0x2')],'id');for(var _0x37a577=0x0,_0x28d757={},_0x2d5f39={};_0x37a577<_0xa50fc1[_0x2ef2('0x7')];_0x37a577+=0x1){_0x28d757=_0xa50fc1[_0x37a577];if(_[_0x2ef2('0x8')](_0x399c20[_0x2ef2('0x2')][_0x28d757['id']])){_0x399c20[_0x2ef2('0x2')][_0x28d757['id']]=new MailAccount(_0x28d757);}else{_[_0x2ef2('0x9')](_0x399c20[_0x2ef2('0x2')][_0x28d757['id']],_0x28d757);}}}return _0x399c20[_0x2ef2('0x2')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index b95bc54..3103e52 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 _0x14b2=['NotifyMailAccount','../client','getMailAccounts','GetMailAccount','name','provider','service','active','key','MailServerIn','Imap','CloudProvider','type','Smtp','getMailAccount','Request'];(function(_0x3e8533,_0x4f4387){var _0x3c1f62=function(_0x5153fe){while(--_0x5153fe){_0x3e8533['push'](_0x3e8533['shift']());}};_0x3c1f62(++_0x4f4387);}(_0x14b2,0x1a1));var _0x214b=function(_0x5aa46c,_0x35280e){_0x5aa46c=_0x5aa46c-0x0;var _0x2738e7=_0x14b2[_0x5aa46c];return _0x2738e7;};'use strict';var client=require(_0x214b('0x0'));exports[_0x214b('0x1')]=function(){return function(){return client['Request'](_0x214b('0x2'),{'options':{'attributes':['id',_0x214b('0x3'),_0x214b('0x4'),_0x214b('0x5'),'email',_0x214b('0x6'),_0x214b('0x7'),'ListId','TemplateId'],'raw':![],'include':[{'model':_0x214b('0x8'),'as':_0x214b('0x9'),'include':[{'model':_0x214b('0xa'),'attributes':['id',_0x214b('0x3'),_0x214b('0x5'),_0x214b('0xb'),'data5'],'as':_0x214b('0xa')}]},{'model':'MailServerOut','as':_0x214b('0xc'),'include':[{'model':'CloudProvider','attributes':['id',_0x214b('0x3'),'service','type','data5'],'as':_0x214b('0xa')}]}]},'log':_0x214b('0xd')});};};exports['notify']=function(_0x16dd87,_0x3c3b39){return client[_0x214b('0xe')]('NotifyMailAccount',{'account':{'id':_0x16dd87},'body':_0x3c3b39,'log':_0x214b('0xf')});}; \ No newline at end of file +var _0x342a=['name','data5','MailServerOut','Smtp','type','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','provider','service','email','active','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider'];(function(_0x516d9c,_0x2979d0){var _0x2ee516=function(_0xaeff01){while(--_0xaeff01){_0x516d9c['push'](_0x516d9c['shift']());}};_0x2ee516(++_0x2979d0);}(_0x342a,0xa2));var _0xa342=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x342a[_0xaa0309];return _0x5de7ce;};'use strict';var client=require(_0xa342('0x0'));exports[_0xa342('0x1')]=function(){return function(){return client[_0xa342('0x2')](_0xa342('0x3'),{'options':{'attributes':['id','name',_0xa342('0x4'),_0xa342('0x5'),_0xa342('0x6'),_0xa342('0x7'),_0xa342('0x8'),_0xa342('0x9'),_0xa342('0xa')],'raw':![],'include':[{'model':_0xa342('0xb'),'as':_0xa342('0xc'),'include':[{'model':_0xa342('0xd'),'attributes':['id',_0xa342('0xe'),_0xa342('0x5'),'type',_0xa342('0xf')],'as':_0xa342('0xd')}]},{'model':_0xa342('0x10'),'as':_0xa342('0x11'),'include':[{'model':_0xa342('0xd'),'attributes':['id',_0xa342('0xe'),_0xa342('0x5'),_0xa342('0x12'),_0xa342('0xf')],'as':_0xa342('0xd')}]}]},'log':_0xa342('0x13')});};};exports[_0xa342('0x14')]=function(_0x22d626,_0x443b94){return client['Request'](_0xa342('0x15'),{'account':{'id':_0x22d626},'body':_0x443b94,'log':_0xa342('0x15')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 709ad22..59d359f 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 _0xe742=['ShowSetting','loginMailFrequency','GetSettings','../client','getSettings','Request'];(function(_0x4803e2,_0x4373bb){var _0x16cf25=function(_0x26600d){while(--_0x26600d){_0x4803e2['push'](_0x4803e2['shift']());}};_0x16cf25(++_0x4373bb);}(_0xe742,0x1ad));var _0x2e74=function(_0x41bddf,_0x330fef){_0x41bddf=_0x41bddf-0x0;var _0x424076=_0xe742[_0x41bddf];return _0x424076;};'use strict';var client=require(_0x2e74('0x0'));exports[_0x2e74('0x1')]=function(){return client[_0x2e74('0x2')](_0x2e74('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x2e74('0x4')]},'log':_0x2e74('0x5')});}; \ No newline at end of file +var _0x1de4=['Request','../client','getSettings'];(function(_0x21cb75,_0x2e4c34){var _0xdcb9ea=function(_0x57f356){while(--_0x57f356){_0x21cb75['push'](_0x21cb75['shift']());}};_0xdcb9ea(++_0x2e4c34);}(_0x1de4,0x19c));var _0x41de=function(_0x5c568e,_0x47fcc3){_0x5c568e=_0x5c568e-0x0;var _0x5cd62c=_0x1de4[_0x5c568e];return _0x5cd62c;};'use strict';var client=require(_0x41de('0x0'));exports[_0x41de('0x1')]=function(){return client[_0x41de('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index ea50ef1..da1b5ef 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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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 f7a686c..36680f9 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 _0xa343=['../../config/environment','timeout','listen','port','polling','redis','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session'];(function(_0xa9f70c,_0x39075b){var _0x550515=function(_0x528785){while(--_0x528785){_0xa9f70c['push'](_0xa9f70c['shift']());}};_0x550515(++_0x39075b);}(_0xa343,0x1b4));var _0x3a34=function(_0x12854e,_0x2ca6b5){_0x12854e=_0x12854e-0x0;var _0x476a56=_0xa343[_0x12854e];return _0x476a56;};'use strict';var _=require(_0x3a34('0x0'));var http=require(_0x3a34('0x1'));var express=require(_0x3a34('0x2'));var sticky=require(_0x3a34('0x3'));var Redis=require('ioredis');var config=require(_0x3a34('0x4'));var app=express();var server=http['createServer'](app);server[_0x3a34('0x5')]=0xdbba0;if(sticky[_0x3a34('0x6')](server,config[_0x3a34('0x7')])){var socketio=require('socket.io')(server,{'transports':['websocket',_0x3a34('0x8')]});config[_0x3a34('0x9')]=_['defaults'](config[_0x3a34('0x9')],{'host':_0x3a34('0xa'),'port':0x18eb});socketio[_0x3a34('0xb')](require(_0x3a34('0xc'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x3a34('0x9')])}));require(_0x3a34('0xd'))[_0x3a34('0xe')]();require(_0x3a34('0xf'))[_0x3a34('0xe')](socketio);require('../../config/express')['default'](app);require(_0x3a34('0x10'))[_0x3a34('0xe')](app);}else{server[_0x3a34('0x11')](_0x3a34('0x12'),function(){console[_0x3a34('0x13')](_0x3a34('0x14'),config[_0x3a34('0x7')]);});}exports=module[_0x3a34('0x15')]=app; \ No newline at end of file +var _0x6489=['listen','port','socket.io','websocket','polling','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../routes','once','listening','log','exports','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','timeout'];(function(_0x5c5b9e,_0x42a883){var _0x2e0555=function(_0xaf77f4){while(--_0xaf77f4){_0x5c5b9e['push'](_0x5c5b9e['shift']());}};_0x2e0555(++_0x42a883);}(_0x6489,0x1cc));var _0x9648=function(_0x739d09,_0x519a5c){_0x739d09=_0x739d09-0x0;var _0x305716=_0x6489[_0x739d09];return _0x305716;};'use strict';var _=require(_0x9648('0x0'));var http=require(_0x9648('0x1'));var express=require(_0x9648('0x2'));var sticky=require(_0x9648('0x3'));var Redis=require(_0x9648('0x4'));var config=require(_0x9648('0x5'));var app=express();var server=http[_0x9648('0x6')](app);server[_0x9648('0x7')]=0xdbba0;if(sticky[_0x9648('0x8')](server,config[_0x9648('0x9')])){var socketio=require(_0x9648('0xa'))(server,{'transports':[_0x9648('0xb'),_0x9648('0xc')]});config[_0x9648('0xd')]=_[_0x9648('0xe')](config[_0x9648('0xd')],{'host':_0x9648('0xf'),'port':0x18eb});socketio[_0x9648('0x10')](require(_0x9648('0x11'))({'pubClient':new Redis(config[_0x9648('0xd')]),'subClient':new Redis(config[_0x9648('0xd')])}));require(_0x9648('0x12'))[_0x9648('0x13')]();require(_0x9648('0x14'))['default'](socketio);require('../../config/express')['default'](app);require(_0x9648('0x15'))[_0x9648('0x13')](app);}else{server[_0x9648('0x16')](_0x9648('0x17'),function(){console[_0x9648('0x18')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x9648('0x9')]);});}exports=module[_0x9648('0x19')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 83d48ac..bba64bb 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 _0x0078=['bluebird','client','Request','request','then','debug','rpc','routing','error','message','result','catch','exports'];(function(_0x503950,_0x5022eb){var _0x1657a9=function(_0x4c1e8f){while(--_0x4c1e8f){_0x503950['push'](_0x503950['shift']());}};_0x1657a9(++_0x5022eb);}(_0x0078,0x104));var _0x8007=function(_0x2f552d,_0x56b80b){_0x2f552d=_0x2f552d-0x0;var _0x53b73a=_0x0078[_0x2f552d];return _0x53b73a;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x8007('0x0'));var logger=require('../../config/logger')('routing');var client=jayson[_0x8007('0x1')]['http']({'port':0x2329});client[_0x8007('0x2')]=function(_0x1bd01a,_0x45933d){return new BPromise(function(_0xa808c2,_0x5e66f7){return client[_0x8007('0x3')](_0x1bd01a,_0x45933d)[_0x8007('0x4')](function(_0x592eab){logger[_0x8007('0x5')](_0x8007('0x6'),_0x8007('0x7'),_0x1bd01a,_0x45933d,_0x592eab);if(_0x592eab[_0x8007('0x8')]){logger[_0x8007('0x8')](_0x8007('0x6'),_0x8007('0x7'),_0x1bd01a,_0x592eab[_0x8007('0x8')]['message'],_0x45933d);return _0x5e66f7(_0x592eab[_0x8007('0x8')][_0x8007('0x9')]);}else{return _0xa808c2(_0x592eab[_0x8007('0xa')]);}})[_0x8007('0xb')](function(_0x15db08){logger[_0x8007('0x8')](_0x8007('0x6'),'routing',_0x1bd01a,_0x15db08,_0x45933d);return _0x5e66f7(_0x15db08);});});};module[_0x8007('0xc')]=client; \ No newline at end of file +var _0xd325=['then','debug','rpc','routing','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','http','request'];(function(_0x2fc113,_0x45ec6e){var _0x5144ce=function(_0x47fd29){while(--_0x47fd29){_0x2fc113['push'](_0x2fc113['shift']());}};_0x5144ce(++_0x45ec6e);}(_0xd325,0x113));var _0x5d32=function(_0x555ebb,_0x4b1b68){_0x555ebb=_0x555ebb-0x0;var _0x3c0a4a=_0xd325[_0x555ebb];return _0x3c0a4a;};'use strict';var jayson=require(_0x5d32('0x0'));var BPromise=require(_0x5d32('0x1'));var logger=require(_0x5d32('0x2'))('routing');var client=jayson['client'][_0x5d32('0x3')]({'port':0x2329});client['Request']=function(_0x422426,_0x3c69d2){return new BPromise(function(_0x96501a,_0x58e9f5){return client[_0x5d32('0x4')](_0x422426,_0x3c69d2)[_0x5d32('0x5')](function(_0x4a47d8){logger[_0x5d32('0x6')](_0x5d32('0x7'),_0x5d32('0x8'),_0x422426,_0x3c69d2,_0x4a47d8);if(_0x4a47d8[_0x5d32('0x9')]){logger[_0x5d32('0x9')](_0x5d32('0x7'),'routing',_0x422426,_0x4a47d8[_0x5d32('0x9')][_0x5d32('0xa')],_0x3c69d2);return _0x58e9f5(_0x4a47d8[_0x5d32('0x9')][_0x5d32('0xa')]);}else{return _0x96501a(_0x4a47d8[_0x5d32('0xb')]);}})[_0x5d32('0xc')](function(_0x43cb83){logger['error'](_0x5d32('0x7'),_0x5d32('0x8'),_0x422426,_0x43cb83,_0x3c69d2);return _0x58e9f5(_0x43cb83);});});};module[_0x5d32('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 2618457..2566d56 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 _0x9d48=['then','getAgents','initAgents','getIntervals','getChatQueues','initChatQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','getWhatsappQueues','catch','log','bluebird','./server','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/whatsappQueue','resolve'];(function(_0x9fb3d9,_0x19a3be){var _0xcd3a61=function(_0x121346){while(--_0x121346){_0x9fb3d9['push'](_0x9fb3d9['shift']());}};_0xcd3a61(++_0x19a3be);}(_0x9d48,0x141));var _0x89d4=function(_0x5decec,_0x4e5761){_0x5decec=_0x5decec-0x0;var _0x35e1b4=_0x9d48[_0x5decec];return _0x35e1b4;};'use strict';var BPromise=require(_0x89d4('0x0'));var server=require(_0x89d4('0x1'));var Realtime=require('./realtime');var user=require(_0x89d4('0x2'));var interval=require(_0x89d4('0x3'));var openchannelQueue=require(_0x89d4('0x4'));var chatQueue=require(_0x89d4('0x5'));var smsQueue=require(_0x89d4('0x6'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x89d4('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x89d4('0x8')]()[_0x89d4('0x9')](user[_0x89d4('0xa')]())[_0x89d4('0x9')](realtime[_0x89d4('0xb')]())[_0x89d4('0x9')](interval[_0x89d4('0xc')]())[_0x89d4('0x9')](realtime['initIntervals']())[_0x89d4('0x9')](openchannelQueue['getOpenchannelQueues']())['then'](realtime['initOpenchannelQueues']())['then'](chatQueue[_0x89d4('0xd')]())['then'](realtime[_0x89d4('0xe')]())[_0x89d4('0x9')](smsQueue['getSmsQueues']())[_0x89d4('0x9')](realtime[_0x89d4('0xf')]())[_0x89d4('0x9')](mailQueue[_0x89d4('0x10')]())[_0x89d4('0x9')](realtime[_0x89d4('0x11')]())[_0x89d4('0x9')](faxQueue[_0x89d4('0x12')]())[_0x89d4('0x9')](realtime['initFaxQueues']())[_0x89d4('0x9')](whatsappQueue[_0x89d4('0x13')]())[_0x89d4('0x9')](realtime['initWhatsappQueues']())[_0x89d4('0x9')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x89d4('0x9')](function(_0x5eb0aa){return initRealtime();})['then'](function(_0x1d61c4){return setInterval(initRealtime,0x1388);})[_0x89d4('0x14')](function(_0x458f80){console[_0x89d4('0x15')](_0x458f80);});}main(); \ No newline at end of file +var _0x95f4=['getOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','initMailQueues','initWhatsappQueues','log','bluebird','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','getIntervals','initIntervals'];(function(_0x43a5c0,_0x5eaf95){var _0x5217c4=function(_0xee4def){while(--_0xee4def){_0x43a5c0['push'](_0x43a5c0['shift']());}};_0x5217c4(++_0x5eaf95);}(_0x95f4,0x15c));var _0x495f=function(_0x194522,_0x4e0567){_0x194522=_0x194522-0x0;var _0x10cad3=_0x95f4[_0x194522];return _0x10cad3;};'use strict';var BPromise=require(_0x495f('0x0'));var server=require('./server');var Realtime=require('./realtime');var user=require('./rpc/user');var interval=require(_0x495f('0x1'));var openchannelQueue=require(_0x495f('0x2'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0x495f('0x3'));var mailQueue=require(_0x495f('0x4'));var faxQueue=require(_0x495f('0x5'));var whatsappQueue=require(_0x495f('0x6'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x495f('0x7')]()[_0x495f('0x8')](user[_0x495f('0x9')]())[_0x495f('0x8')](realtime['initAgents']())[_0x495f('0x8')](interval[_0x495f('0xa')]())[_0x495f('0x8')](realtime[_0x495f('0xb')]())[_0x495f('0x8')](openchannelQueue[_0x495f('0xc')]())[_0x495f('0x8')](realtime['initOpenchannelQueues']())[_0x495f('0x8')](chatQueue[_0x495f('0xd')]())[_0x495f('0x8')](realtime[_0x495f('0xe')]())[_0x495f('0x8')](smsQueue[_0x495f('0xf')]())['then'](realtime[_0x495f('0x10')]())[_0x495f('0x8')](mailQueue['getMailQueues']())[_0x495f('0x8')](realtime[_0x495f('0x11')]())['then'](faxQueue['getFaxQueues']())[_0x495f('0x8')](realtime['initFaxQueues']())['then'](whatsappQueue['getWhatsappQueues']())['then'](realtime[_0x495f('0x12')]())[_0x495f('0x8')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x495f('0x8')](function(_0xad6eac){return initRealtime();})[_0x495f('0x8')](function(_0x508683){return setInterval(initRealtime,0x1388);})['catch'](function(_0x3a9622){console[_0x495f('0x13')](_0x3a9622);});}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 b1a7b2e..13afbab 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['isNil','register','ignoreFactChanges','activeRules','prototype','isArray','rules','concat','isObject','push','sync','filter','orderBy','asc','result','clone','name','nextTick','ruleRef','isEqual','restart','length','condition','noop','findRules','matches','turn','prioritize','priority','toString','consequence','fromJSON','isString','parse','map','object','exports','util','events','EventEmitter','init'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1261,0x144));var _0x1126=function(_0x3557d0,_0x39f204){_0x3557d0=_0x3557d0-0x0;var _0x38d56c=_0x1261[_0x3557d0];return _0x38d56c;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var EventEmitter=require(_0x1126('0x1'))[_0x1126('0x2')];function RuleEngine(_0x331a2c,_0x39b786){this[_0x1126('0x3')]();if(!_[_0x1126('0x4')](_0x331a2c)){this[_0x1126('0x5')](_0x331a2c);}if(_0x39b786){this[_0x1126('0x6')]=_0x39b786[_0x1126('0x6')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x1126('0x3')]=function(_0x907180){this['rules']=[];this[_0x1126('0x7')]=[];};RuleEngine[_0x1126('0x8')][_0x1126('0x5')]=function(_0x3abb0b){if(Array[_0x1126('0x9')](_0x3abb0b)){this['rules']=this[_0x1126('0xa')][_0x1126('0xb')](_0x3abb0b);}else if(_0x3abb0b!==null&&_[_0x1126('0xc')](_0x3abb0b)){this['rules'][_0x1126('0xd')](_0x3abb0b);}this['sync']();};RuleEngine['prototype'][_0x1126('0xe')]=function(){this['activeRules']=this[_0x1126('0xa')][_0x1126('0xf')](function(_0xd26a32){if(_[_0x1126('0x4')](_0xd26a32['on'])){_0xd26a32['on']=!![];}if(_0xd26a32['on']===!![]){return _0xd26a32;}});this[_0x1126('0x7')]=_[_0x1126('0x10')](this[_0x1126('0x7')],['p'],[_0x1126('0x11')]);};RuleEngine[_0x1126('0x8')]['execute']=function(_0x5de9a7,_0x1af673){var _0x154e20=![];_0x5de9a7[_0x1126('0x12')]=!![];var _0x4be0c6=_[_0x1126('0x13')](_0x5de9a7);var _0x4794a7=_[_0x1126('0x13')](_0x5de9a7);var _0x42f379=this[_0x1126('0x7')];var _0x4e1c97=[];var _0x245cd7=this[_0x1126('0x6')];(function FnRuleLoop(_0x4a7b49){var _0x4d2b38={'rules':function(){return _0x42f379;},'rule':function(){return _0x42f379[_0x4a7b49];},'when':function(_0x22ae0b){if(_0x22ae0b){var _0x2b2487=_0x42f379[_0x4a7b49]['consequence'];_0x2b2487['ruleRef']=_0x42f379[_0x4a7b49]['id']||_0x42f379[_0x4a7b49][_0x1126('0x14')]||'index_'+_0x4a7b49;process[_0x1126('0x15')](function(){_0x4e1c97[_0x1126('0xd')](_0x2b2487[_0x1126('0x16')]);_0x2b2487['call'](_0x4be0c6,_0x4d2b38);});}else{process[_0x1126('0x15')](function(){_0x4d2b38['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x154e20=!![];return FnRuleLoop(0x0);},'next':function(_0x56efeb){if(!_0x245cd7&&!_[_0x1126('0x17')](_0x4794a7,_0x4be0c6)){_0x4794a7=_[_0x1126('0x13')](_0x4be0c6);process[_0x1126('0x15')](function(){_0x4d2b38[_0x1126('0x18')]();});}else{process['nextTick'](function(){if(_[_0x1126('0x4')](_0x56efeb)){return FnRuleLoop(_0x4a7b49+0x1);}else{return FnRuleLoop(_0x56efeb);}});}}};if(_0x4a7b49<_0x42f379[_0x1126('0x19')]&&_0x154e20===![]){var _0x48a08d=_0x42f379[_0x4a7b49][_0x1126('0x1a')];_0x48a08d['call'](_0x4be0c6,_0x4d2b38);}else{process['nextTick'](function(){_0x4be0c6['matchPath']=_0x4e1c97;return _0x1af673?_0x1af673(_0x4be0c6):_[_0x1126('0x1b')]();});}}(0x0));};RuleEngine[_0x1126('0x8')][_0x1126('0x1c')]=function(_0x34bcf1){if(_[_0x1126('0x4')](_0x34bcf1)){return this[_0x1126('0xa')];}else{var _0xea0971=_[_0x1126('0x1d')](_0x34bcf1);return _['filter'](this[_0x1126('0xa')],_0xea0971);}};RuleEngine[_0x1126('0x8')][_0x1126('0x1e')]=function(_0x5ddf63,_0x541bc9){var _0xeb7d89=_0x5ddf63==='on'||_0x5ddf63==='ON'?!![]:![];var _0x39bf0e=this['findRules'](_0x541bc9);for(var _0x2fb797=0x0,_0x23d2bc=_0x39bf0e['length'];_0x2fb797<_0x23d2bc;_0x2fb797+=0x1){_0x39bf0e[_0x2fb797]['on']=_0xeb7d89;}this[_0x1126('0xe')]();};RuleEngine['prototype'][_0x1126('0x1f')]=function(_0x4bd50b,_0x771bb8){_0x4bd50b=parseInt(_0x4bd50b,0xa);var _0x583ce6=this[_0x1126('0x1c')](_0x771bb8);for(var _0x5f2611=0x0,_0x5252e0=_0x583ce6['length'];_0x5f2611<_0x5252e0;_0x5f2611+=0x1){_0x583ce6[_0x5f2611][_0x1126('0x20')]=_0x4bd50b;}this[_0x1126('0xe')]();};RuleEngine[_0x1126('0x8')]['toJSON']=function(){var _0x2a3055=this[_0x1126('0xa')];if(_0x2a3055 instanceof Array){_0x2a3055=_0x2a3055['map'](function(_0x3dd50e){_0x3dd50e[_0x1126('0x1a')]=_0x3dd50e[_0x1126('0x1a')][_0x1126('0x21')]();_0x3dd50e['consequence']=_0x3dd50e['consequence'][_0x1126('0x21')]();return _0x3dd50e;});}else if(!_[_0x1126('0x4')](_0x2a3055)){_0x2a3055[_0x1126('0x1a')]=_0x2a3055[_0x1126('0x1a')]['toString']();_0x2a3055[_0x1126('0x22')]=_0x2a3055[_0x1126('0x22')][_0x1126('0x21')]();}return _0x2a3055;};RuleEngine[_0x1126('0x8')][_0x1126('0x23')]=function(_0x5df232){this[_0x1126('0x3')]();if(_[_0x1126('0x24')](_0x5df232)){_0x5df232=JSON[_0x1126('0x25')](_0x5df232);}if(_0x5df232 instanceof Array){_0x5df232=_0x5df232[_0x1126('0x26')](function(_0x5c019d){_0x5c019d['condition']=eval('('+_0x5c019d[_0x1126('0x1a')]+')');_0x5c019d[_0x1126('0x22')]=eval('('+_0x5c019d['consequence']+')');return _0x5c019d;});}else if(_0x5df232!==null&&typeof _0x5df232==_0x1126('0x27')){_0x5df232[_0x1126('0x1a')]=eval('('+_0x5df232[_0x1126('0x1a')]+')');_0x5df232['consequence']=eval('('+_0x5df232['consequence']+')');}this[_0x1126('0x5')](_0x5df232);};module[_0x1126('0x28')]=RuleEngine; \ No newline at end of file +var _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x3de0d9,_0x2ccb8f){var _0x161cd9=function(_0x8e23e7){while(--_0x8e23e7){_0x3de0d9['push'](_0x3de0d9['shift']());}};_0x161cd9(++_0x2ccb8f);}(_0x326f,0xd1));var _0xf326=function(_0x3c5b34,_0x52c9a1){_0x3c5b34=_0x3c5b34-0x0;var _0x24add8=_0x326f[_0x3c5b34];return _0x24add8;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index e0bd0ad..55c7d83 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 _0x3ba0=['catch','sendMailMessage','SendMail','bluebird','client','error','message','result'];(function(_0x1d2195,_0x4b8096){var _0x4962cd=function(_0x301f5a){while(--_0x301f5a){_0x1d2195['push'](_0x1d2195['shift']());}};_0x4962cd(++_0x4b8096);}(_0x3ba0,0x163));var _0x03ba=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x3ba0[_0x501510];return _0x1e6ee5;};'use strict';var BPromise=require(_0x03ba('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x03ba('0x1')]['http']({'port':0x232b});function request(_0x113260,_0x235f3f){return new BPromise(function(_0x581064,_0x2610c2){return client['request'](_0x113260,_0x235f3f)['then'](function(_0x3a90b7){if(_0x3a90b7[_0x03ba('0x2')]){return _0x2610c2(_0x3a90b7['error'][_0x03ba('0x3')]);}else{return _0x581064(_0x3a90b7[_0x03ba('0x4')]);}})[_0x03ba('0x5')](function(_0x23fa0b){return _0x2610c2(_0x23fa0b);});});}exports[_0x03ba('0x6')]=function(_0x4fc249,_0x1cc6e9){return request(_0x03ba('0x7'),{'account':_0x4fc249,'message':_0x1cc6e9});}; \ No newline at end of file +var _0xcf7d=['sendMailMessage','bluebird','jayson/promise','client','http','then','error','message'];(function(_0x414810,_0x5e924d){var _0x2d4df5=function(_0x390860){while(--_0x390860){_0x414810['push'](_0x414810['shift']());}};_0x2d4df5(++_0x5e924d);}(_0xcf7d,0xa1));var _0xdcf7=function(_0x25244b,_0x36b667){_0x25244b=_0x25244b-0x0;var _0x56b03f=_0xcf7d[_0x25244b];return _0x56b03f;};'use strict';var BPromise=require(_0xdcf7('0x0'));var jayson=require(_0xdcf7('0x1'));var client=jayson[_0xdcf7('0x2')][_0xdcf7('0x3')]({'port':0x232b});function request(_0x4deb37,_0xc6323c){return new BPromise(function(_0x224ec4,_0x5afaff){return client['request'](_0x4deb37,_0xc6323c)[_0xdcf7('0x4')](function(_0x3b9594){if(_0x3b9594[_0xdcf7('0x5')]){return _0x5afaff(_0x3b9594[_0xdcf7('0x5')][_0xdcf7('0x6')]);}else{return _0x224ec4(_0x3b9594['result']);}})['catch'](function(_0x4565ea){return _0x5afaff(_0x4565ea);});});}exports[_0xdcf7('0x7')]=function(_0x361f24,_0x46fc9e){return request('SendMail',{'account':_0x361f24,'message':_0x46fc9e});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 0420dc7..e16e1f9 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 _0x7dc1=['emit','exports','lodash','md5','ioredis','defaults','redis','localhost','socket.io-emitter','name','online','voicePause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','Capacity','CurrentCapacity','idle','mail','chat','openchannel','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','chatPause','stringify'];(function(_0x34a6e9,_0x25cabe){var _0x11015c=function(_0x5c2ced){while(--_0x5c2ced){_0x34a6e9['push'](_0x34a6e9['shift']());}};_0x11015c(++_0x25cabe);}(_0x7dc1,0xb3));var _0x17dc=function(_0x398076,_0x3f2cc0){_0x398076=_0x398076-0x0;var _0x1f1e46=_0x7dc1[_0x398076];return _0x1f1e46;};'use strict';var _=require(_0x17dc('0x0'));var moment=require('moment');var md5=require(_0x17dc('0x1'));var Redis=require(_0x17dc('0x2'));var config=require('../../../config/environment');config['redis']=_[_0x17dc('0x3')](config[_0x17dc('0x4')],{'host':_0x17dc('0x5'),'port':0x18eb});var io=require(_0x17dc('0x6'))(new Redis(config['redis']));function Agent(_0x4e0df0){this['id']=_0x4e0df0['id']||0x0;this['name']=_0x4e0df0[_0x17dc('0x7')]||'';this[_0x17dc('0x8')]=_0x4e0df0[_0x17dc('0x8')]||!![];this[_0x17dc('0x9')]=_0x4e0df0['voicePause']||![];this['chatPause']=_0x4e0df0['chatPause']||![];this[_0x17dc('0xa')]=_0x4e0df0[_0x17dc('0xa')]||![];this[_0x17dc('0xb')]=_0x4e0df0[_0x17dc('0xb')]||![];this['smsPause']=_0x4e0df0[_0x17dc('0xc')]||![];this[_0x17dc('0xd')]=_0x4e0df0['openchannelPause']||![];this[_0x17dc('0xe')]=_0x17dc('0xf');this[_0x17dc('0x10')]=0x0;this['chatCapacity']=_0x4e0df0[_0x17dc('0x11')]||0x0;this['chatCurrentCapacity']=0x0;this[_0x17dc('0x12')]=_0x17dc('0xf');this[_0x17dc('0x13')]=0x0;this['mailCapacity']=_0x4e0df0[_0x17dc('0x14')]||0x0;this[_0x17dc('0x15')]=0x0;this[_0x17dc('0x16')]=_0x17dc('0xf');this['faxStatusTime']=0x0;this[_0x17dc('0x17')]=_0x4e0df0['faxCapacity']||0x0;this[_0x17dc('0x18')]=0x0;this[_0x17dc('0x19')]=_0x17dc('0xf');this['smsStatusTime']=0x0;this['smsCapacity']=_0x4e0df0[_0x17dc('0x1a')]||0x0;this[_0x17dc('0x1b')]=0x0;this[_0x17dc('0x1c')]=_0x17dc('0xf');this[_0x17dc('0x1d')]=0x0;this[_0x17dc('0x1e')]=_0x4e0df0['whatsappCapacity']||0x0;this[_0x17dc('0x1f')]=0x0;this[_0x17dc('0x20')]=_0x17dc('0xf');this[_0x17dc('0x21')]=0x0;this['openchannelCapacity']=_0x4e0df0[_0x17dc('0x22')]||0x0;this[_0x17dc('0x23')]=0x0;this[_0x17dc('0x24')]=![];this[_0x17dc('0x25')]=undefined;this[_0x17dc('0x1')]='';this[_0x17dc('0x26')]();}Agent[_0x17dc('0x27')][_0x17dc('0x28')]=function(_0x1392cc){if(this[_0x1392cc+'CurrentCapacity']>0x0){if(this[_0x1392cc+_0x17dc('0x29')]>0x0&&this[_0x1392cc+_0x17dc('0x2a')]>=this[_0x1392cc+_0x17dc('0x29')]){return'maxcapacity';}else{return'working';}}else{return _0x17dc('0x2b');}};Agent[_0x17dc('0x27')][_0x17dc('0x26')]=function(){var _0xb53714=[_0x17dc('0x2c'),_0x17dc('0x2d'),_0x17dc('0x2e'),_0x17dc('0x2f'),_0x17dc('0x30'),_0x17dc('0x31')];for(var _0x346429=0x0;_0x346429<_0xb53714[_0x17dc('0x32')];_0x346429+=0x1){var _0x2c109b=this[_0x17dc('0x28')](_0xb53714[_0x346429]);if(this[_0xb53714[_0x346429]+_0x17dc('0x33')]!==_0x2c109b){this[_0xb53714[_0x346429]+_0x17dc('0x34')]=_[_0x17dc('0x35')](moment()[_0x17dc('0x36')]('x'));}this[_0xb53714[_0x346429]+_0x17dc('0x33')]=_0x2c109b;}var _0xc9cf1d={'id':this['id'],'name':this[_0x17dc('0x7')],'online':this['online'],'voicePause':this[_0x17dc('0x9')],'chatPause':this[_0x17dc('0x37')],'mailPause':this[_0x17dc('0xa')],'smsPause':this['smsPause'],'faxPause':this['faxPause'],'openchannelPause':this[_0x17dc('0xd')],'chatStatus':this[_0x17dc('0xe')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x17dc('0x11')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x17dc('0x12')],'mailStatusTime':this[_0x17dc('0x13')],'mailCapacity':this[_0x17dc('0x14')],'mailCurrentCapacity':this[_0x17dc('0x15')],'faxStatus':this[_0x17dc('0x16')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x17dc('0x17')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this['smsStatus'],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x17dc('0x1b')],'whatsappStatus':this[_0x17dc('0x1c')],'whatsappStatusTime':this[_0x17dc('0x1d')],'whatsappCapacity':this[_0x17dc('0x1e')],'whatsappCurrentCapacity':this[_0x17dc('0x1f')],'openchannelStatus':this[_0x17dc('0x20')],'openchannelStatusTime':this[_0x17dc('0x21')],'openchannelCapacity':this[_0x17dc('0x22')],'openchannelCurrentCapacity':this[_0x17dc('0x23')],'busy':this[_0x17dc('0x24')],'busyQueue':this[_0x17dc('0x25')]};var _0x16d3a3=md5(JSON[_0x17dc('0x38')](_0xc9cf1d));if(this[_0x17dc('0x1')]!==_0x16d3a3){this[_0x17dc('0x1')]=_0x16d3a3;io[_0x17dc('0x39')]('user:save',_0xc9cf1d);}};module[_0x17dc('0x3a')]=Agent; \ No newline at end of file +var _0xf67d=['voicePause','chatPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','mail','chat','fax','sms','whatsapp','Status','StatusTime','toNumber','format','chatCurrentCapacity','smsStatus','whatsappStatus','whatsappCurrentCapacity','stringify','md5','emit','user:save','redis','defaults','localhost','socket.io-emitter','name','online'];(function(_0x2f2424,_0x1b7836){var _0x437087=function(_0x55a128){while(--_0x55a128){_0x2f2424['push'](_0x2f2424['shift']());}};_0x437087(++_0x1b7836);}(_0xf67d,0x182));var _0xdf67=function(_0x58c68a,_0x2428d7){_0x58c68a=_0x58c68a-0x0;var _0x39bb27=_0xf67d[_0x58c68a];return _0x39bb27;};'use strict';var _=require('lodash');var moment=require('moment');var md5=require('md5');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xdf67('0x0')]=_[_0xdf67('0x1')](config[_0xdf67('0x0')],{'host':_0xdf67('0x2'),'port':0x18eb});var io=require(_0xdf67('0x3'))(new Redis(config[_0xdf67('0x0')]));function Agent(_0x46df71){this['id']=_0x46df71['id']||0x0;this[_0xdf67('0x4')]=_0x46df71['name']||'';this['online']=_0x46df71[_0xdf67('0x5')]||!![];this[_0xdf67('0x6')]=_0x46df71[_0xdf67('0x6')]||![];this[_0xdf67('0x7')]=_0x46df71[_0xdf67('0x7')]||![];this['mailPause']=_0x46df71['mailPause']||![];this[_0xdf67('0x8')]=_0x46df71[_0xdf67('0x8')]||![];this[_0xdf67('0x9')]=_0x46df71[_0xdf67('0x9')]||![];this[_0xdf67('0xa')]=_0x46df71[_0xdf67('0xa')]||![];this[_0xdf67('0xb')]=_0xdf67('0xc');this[_0xdf67('0xd')]=0x0;this['chatCapacity']=_0x46df71[_0xdf67('0xe')]||0x0;this['chatCurrentCapacity']=0x0;this[_0xdf67('0xf')]=_0xdf67('0xc');this[_0xdf67('0x10')]=0x0;this['mailCapacity']=_0x46df71[_0xdf67('0x11')]||0x0;this[_0xdf67('0x12')]=0x0;this[_0xdf67('0x13')]=_0xdf67('0xc');this[_0xdf67('0x14')]=0x0;this[_0xdf67('0x15')]=_0x46df71[_0xdf67('0x15')]||0x0;this['faxCurrentCapacity']=0x0;this['smsStatus']=_0xdf67('0xc');this[_0xdf67('0x16')]=0x0;this[_0xdf67('0x17')]=_0x46df71[_0xdf67('0x17')]||0x0;this[_0xdf67('0x18')]=0x0;this['whatsappStatus']=_0xdf67('0xc');this[_0xdf67('0x19')]=0x0;this[_0xdf67('0x1a')]=_0x46df71[_0xdf67('0x1a')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0xdf67('0x1b')]=_0xdf67('0xc');this[_0xdf67('0x1c')]=0x0;this[_0xdf67('0x1d')]=_0x46df71[_0xdf67('0x1d')]||0x0;this[_0xdf67('0x1e')]=0x0;this[_0xdf67('0x1f')]=![];this[_0xdf67('0x20')]=undefined;this['md5']='';this['updateRealtime']();}Agent[_0xdf67('0x21')][_0xdf67('0x22')]=function(_0x18bcbb){if(this[_0x18bcbb+_0xdf67('0x23')]>0x0){if(this[_0x18bcbb+'Capacity']>0x0&&this[_0x18bcbb+_0xdf67('0x23')]>=this[_0x18bcbb+_0xdf67('0x24')]){return _0xdf67('0x25');}else{return _0xdf67('0x26');}}else{return'idle';}};Agent['prototype']['updateRealtime']=function(){var _0x305276=[_0xdf67('0x27'),_0xdf67('0x28'),'openchannel',_0xdf67('0x29'),_0xdf67('0x2a'),_0xdf67('0x2b')];for(var _0x58d487=0x0;_0x58d487<_0x305276['length'];_0x58d487+=0x1){var _0x521d0e=this['getChannelStatus'](_0x305276[_0x58d487]);if(this[_0x305276[_0x58d487]+_0xdf67('0x2c')]!==_0x521d0e){this[_0x305276[_0x58d487]+_0xdf67('0x2d')]=_[_0xdf67('0x2e')](moment()[_0xdf67('0x2f')]('x'));}this[_0x305276[_0x58d487]+_0xdf67('0x2c')]=_0x521d0e;}var _0x5992a0={'id':this['id'],'name':this[_0xdf67('0x4')],'online':this[_0xdf67('0x5')],'voicePause':this[_0xdf67('0x6')],'chatPause':this['chatPause'],'mailPause':this['mailPause'],'smsPause':this[_0xdf67('0x9')],'faxPause':this[_0xdf67('0x8')],'openchannelPause':this[_0xdf67('0xa')],'chatStatus':this[_0xdf67('0xb')],'chatStatusTime':this[_0xdf67('0xd')],'chatCapacity':this[_0xdf67('0xe')],'chatCurrentCapacity':this[_0xdf67('0x30')],'mailStatus':this['mailStatus'],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0xdf67('0x11')],'mailCurrentCapacity':this[_0xdf67('0x12')],'faxStatus':this[_0xdf67('0x13')],'faxStatusTime':this[_0xdf67('0x14')],'faxCapacity':this[_0xdf67('0x15')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0xdf67('0x31')],'smsStatusTime':this[_0xdf67('0x16')],'smsCapacity':this[_0xdf67('0x17')],'smsCurrentCapacity':this[_0xdf67('0x18')],'whatsappStatus':this[_0xdf67('0x32')],'whatsappStatusTime':this[_0xdf67('0x19')],'whatsappCapacity':this[_0xdf67('0x1a')],'whatsappCurrentCapacity':this[_0xdf67('0x33')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0xdf67('0x1c')],'openchannelCapacity':this[_0xdf67('0x1d')],'openchannelCurrentCapacity':this[_0xdf67('0x1e')],'busy':this[_0xdf67('0x1f')],'busyQueue':this[_0xdf67('0x20')]};var _0x219107=md5(JSON[_0xdf67('0x34')](_0x5992a0));if(this[_0xdf67('0x35')]!==_0x219107){this[_0xdf67('0x35')]=_0x219107;io[_0xdf67('0x36')](_0xdf67('0x37'),_0x5992a0);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index b38f33b..e18f5dd 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 _0xbdff=['length','online','chatPause','loggedIn','available','stringify','format','chat:queue:%s','emit','chat_queue:save','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','Agents','mapAgentsId','waiting','md5','updateRealtime','updateRouting','_rr','map','paused'];(function(_0x434837,_0x567432){var _0x40eb2a=function(_0x8cac67){while(--_0x8cac67){_0x434837['push'](_0x434837['shift']());}};_0x40eb2a(++_0x567432);}(_0xbdff,0x118));var _0xfbdf=function(_0x2a4591,_0xab503c){_0x2a4591=_0x2a4591-0x0;var _0x2f0616=_0xbdff[_0x2a4591];return _0x2f0616;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xfbdf('0x0'));var Redis=require(_0xfbdf('0x1'));var config=require('../../../config/environment');config[_0xfbdf('0x2')]=_[_0xfbdf('0x3')](config[_0xfbdf('0x2')],{'host':_0xfbdf('0x4'),'port':0x18eb});var io=require(_0xfbdf('0x5'))(new Redis(config[_0xfbdf('0x2')]));function ChatQueue(_0x1a0a18){this['id']=_0x1a0a18['id']||0x0;this[_0xfbdf('0x6')]=_0x1a0a18['name']||'';this['timeout']=_0x1a0a18[_0xfbdf('0x7')]||0xa;this['strategy']=_0x1a0a18['strategy']||'beepall';this[_0xfbdf('0x8')]=_0x1a0a18[_0xfbdf('0x8')];this[_0xfbdf('0x9')]={};this[_0xfbdf('0xa')]=0x0;this[_0xfbdf('0xb')]='';this['updateRouting']();this[_0xfbdf('0xc')]();}ChatQueue['prototype'][_0xfbdf('0xd')]=function(){var _0x23a775=this[_0xfbdf('0x9')][_0xfbdf('0xe')];this[_0xfbdf('0x9')]=_[_0xfbdf('0xf')](this[_0xfbdf('0x8')],'id');this['mapAgentsId']['_rr']=_0x23a775;};ChatQueue['prototype'][_0xfbdf('0xc')]=function(){this['loggedIn']=0x0;this[_0xfbdf('0x10')]=0x0;for(var _0x54a2f1=0x0;_0x54a2f1=0x0?this[_0xfbdf('0x15')]:0x0;var _0x524363={'id':this['id'],'available':this[_0xfbdf('0x15')],'loggedIn':this[_0xfbdf('0x14')],'name':this[_0xfbdf('0x6')],'paused':this[_0xfbdf('0x10')],'waiting':this[_0xfbdf('0xa')]};var _0xbfb189=md5(JSON[_0xfbdf('0x16')](_0x524363));if(this[_0xfbdf('0xb')]!==_0xbfb189){this['md5']=_0xbfb189;io['to'](util[_0xfbdf('0x17')](_0xfbdf('0x18'),_0x524363[_0xfbdf('0x6')]))[_0xfbdf('0x19')](_0xfbdf('0x1a'),_0x524363);}};module['exports']=ChatQueue; \ No newline at end of file +var _0xa021=['updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','online','chatPause','available','stringify','format','emit','chat_queue:save','exports','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa021,0x177));var _0x1a02=function(_0x68fd48,_0x1e359f){_0x68fd48=_0x68fd48-0x0;var _0x4135c1=_0xa021[_0x68fd48];return _0x4135c1;};'use strict';var _=require('lodash');var md5=require(_0x1a02('0x0'));var util=require(_0x1a02('0x1'));var Redis=require(_0x1a02('0x2'));var config=require(_0x1a02('0x3'));config['redis']=_[_0x1a02('0x4')](config[_0x1a02('0x5')],{'host':_0x1a02('0x6'),'port':0x18eb});var io=require(_0x1a02('0x7'))(new Redis(config[_0x1a02('0x5')]));function ChatQueue(_0x443334){this['id']=_0x443334['id']||0x0;this['name']=_0x443334[_0x1a02('0x8')]||'';this[_0x1a02('0x9')]=_0x443334[_0x1a02('0x9')]||0xa;this['strategy']=_0x443334[_0x1a02('0xa')]||_0x1a02('0xb');this[_0x1a02('0xc')]=_0x443334[_0x1a02('0xc')];this[_0x1a02('0xd')]={};this[_0x1a02('0xe')]=0x0;this[_0x1a02('0x0')]='';this[_0x1a02('0xf')]();this[_0x1a02('0x10')]();}ChatQueue[_0x1a02('0x11')][_0x1a02('0xf')]=function(){var _0x32cc1a=this['mapAgentsId'][_0x1a02('0x12')];this[_0x1a02('0xd')]=_[_0x1a02('0x13')](this[_0x1a02('0xc')],'id');this[_0x1a02('0xd')][_0x1a02('0x12')]=_0x32cc1a;};ChatQueue[_0x1a02('0x11')][_0x1a02('0x10')]=function(){this[_0x1a02('0x14')]=0x0;this[_0x1a02('0x15')]=0x0;for(var _0x4ed5ee=0x0;_0x4ed5ee=0x0?this[_0x1a02('0x18')]:0x0;var _0x4525d4={'id':this['id'],'available':this[_0x1a02('0x18')],'loggedIn':this[_0x1a02('0x14')],'name':this[_0x1a02('0x8')],'paused':this[_0x1a02('0x15')],'waiting':this[_0x1a02('0xe')]};var _0x3474d2=md5(JSON[_0x1a02('0x19')](_0x4525d4));if(this[_0x1a02('0x0')]!==_0x3474d2){this[_0x1a02('0x0')]=_0x3474d2;io['to'](util[_0x1a02('0x1a')]('chat:queue:%s',_0x4525d4[_0x1a02('0x8')]))[_0x1a02('0x1b')](_0x1a02('0x1c'),_0x4525d4);}};module[_0x1a02('0x1d')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 101925c..5b267d8 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 _0x4619=['fax_queue:save','lodash','md5','util','../../../config/environment','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','updateRouting','updateRealtime','mapAgentsId','map','_rr','prototype','loggedIn','paused','length','online','faxPause','available','stringify','format','fax:queue:%s','emit'];(function(_0xb03990,_0x499486){var _0x531e4a=function(_0x56dbcc){while(--_0x56dbcc){_0xb03990['push'](_0xb03990['shift']());}};_0x531e4a(++_0x499486);}(_0x4619,0x123));var _0x9461=function(_0x230a5c,_0xd81149){_0x230a5c=_0x230a5c-0x0;var _0x4a8529=_0x4619[_0x230a5c];return _0x4a8529;};'use strict';var _=require(_0x9461('0x0'));var md5=require(_0x9461('0x1'));var util=require(_0x9461('0x2'));var Redis=require('ioredis');var config=require(_0x9461('0x3'));config['redis']=_['defaults'](config['redis'],{'host':_0x9461('0x4'),'port':0x18eb});var io=require(_0x9461('0x5'))(new Redis(config[_0x9461('0x6')]));function FaxQueue(_0x18f747){this['id']=_0x18f747['id']||0x0;this[_0x9461('0x7')]=_0x18f747[_0x9461('0x7')]||'';this['timeout']=_0x18f747[_0x9461('0x8')]||0xa;this[_0x9461('0x9')]=_0x18f747['strategy']||_0x9461('0xa');this['Agents']=_0x18f747[_0x9461('0xb')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x9461('0x1')]='';this[_0x9461('0xc')]();this[_0x9461('0xd')]();}FaxQueue['prototype']['updateRouting']=function(){var _0x4e2822=this[_0x9461('0xe')]['_rr'];this[_0x9461('0xe')]=_[_0x9461('0xf')](this[_0x9461('0xb')],'id');this['mapAgentsId'][_0x9461('0x10')]=_0x4e2822;};FaxQueue[_0x9461('0x11')][_0x9461('0xd')]=function(){this[_0x9461('0x12')]=0x0;this[_0x9461('0x13')]=0x0;for(var _0x4f4fff=0x0;_0x4f4fff=0x0?this[_0x9461('0x17')]:0x0;var _0x1b8e20={'id':this['id'],'available':this[_0x9461('0x17')],'loggedIn':this[_0x9461('0x12')],'name':this[_0x9461('0x7')],'paused':this[_0x9461('0x13')],'waiting':this['waiting']};var _0x1d1aa5=md5(JSON[_0x9461('0x18')](_0x1b8e20));if(this[_0x9461('0x1')]!==_0x1d1aa5){this['md5']=_0x1d1aa5;io['to'](util[_0x9461('0x19')](_0x9461('0x1a'),_0x1b8e20[_0x9461('0x7')]))[_0x9461('0x1b')](_0x9461('0x1c'),_0x1b8e20);}};module['exports']=FaxQueue; \ No newline at end of file +var _0x1d40=['prototype','loggedIn','paused','length','online','faxPause','available','fax:queue:%s','emit','exports','lodash','md5','util','ioredis','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','waiting','updateRouting','mapAgentsId','_rr','map'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x1d40,0xfd));var _0x01d4=function(_0x3b22f0,_0x3463fd){_0x3b22f0=_0x3b22f0-0x0;var _0x55bf4d=_0x1d40[_0x3b22f0];return _0x55bf4d;};'use strict';var _=require(_0x01d4('0x0'));var md5=require(_0x01d4('0x1'));var util=require(_0x01d4('0x2'));var Redis=require(_0x01d4('0x3'));var config=require('../../../config/environment');config[_0x01d4('0x4')]=_[_0x01d4('0x5')](config[_0x01d4('0x4')],{'host':_0x01d4('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function FaxQueue(_0x497ba1){this['id']=_0x497ba1['id']||0x0;this[_0x01d4('0x7')]=_0x497ba1[_0x01d4('0x7')]||'';this[_0x01d4('0x8')]=_0x497ba1[_0x01d4('0x8')]||0xa;this[_0x01d4('0x9')]=_0x497ba1[_0x01d4('0x9')]||_0x01d4('0xa');this['Agents']=_0x497ba1[_0x01d4('0xb')];this['mapAgentsId']={};this[_0x01d4('0xc')]=0x0;this[_0x01d4('0x1')]='';this[_0x01d4('0xd')]();this['updateRealtime']();}FaxQueue['prototype']['updateRouting']=function(){var _0x415385=this[_0x01d4('0xe')][_0x01d4('0xf')];this[_0x01d4('0xe')]=_[_0x01d4('0x10')](this['Agents'],'id');this[_0x01d4('0xe')][_0x01d4('0xf')]=_0x415385;};FaxQueue[_0x01d4('0x11')]['updateRealtime']=function(){this[_0x01d4('0x12')]=0x0;this[_0x01d4('0x13')]=0x0;for(var _0x5452d7=0x0;_0x5452d7=0x0?this[_0x01d4('0x17')]:0x0;var _0x3f163a={'id':this['id'],'available':this[_0x01d4('0x17')],'loggedIn':this[_0x01d4('0x12')],'name':this[_0x01d4('0x7')],'paused':this[_0x01d4('0x13')],'waiting':this['waiting']};var _0xfcf8d4=md5(JSON['stringify'](_0x3f163a));if(this[_0x01d4('0x1')]!==_0xfcf8d4){this[_0x01d4('0x1')]=_0xfcf8d4;io['to'](util['format'](_0x01d4('0x18'),_0x3f163a['name']))[_0x01d4('0x19')]('fax_queue:save',_0x3f163a);}};module[_0x01d4('0x1a')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 20ebb9f..4d1e53a 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 _0x4d84=['Intervals','exports','name'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x4d84,0xb6));var _0x44d8=function(_0x284e85,_0x1bfec9){_0x284e85=_0x284e85-0x0;var _0x59ba3d=_0x4d84[_0x284e85];return _0x59ba3d;};'use strict';function Interval(_0x14021c){this['id']=_0x14021c['id']||0x0;this[_0x44d8('0x0')]=_0x14021c['name']||'';this[_0x44d8('0x1')]=_0x14021c[_0x44d8('0x1')]||{};}module[_0x44d8('0x2')]=Interval; \ No newline at end of file +var _0x7607=['name','Intervals'];(function(_0x3a47aa,_0x19d90e){var _0x146448=function(_0x534a7e){while(--_0x534a7e){_0x3a47aa['push'](_0x3a47aa['shift']());}};_0x146448(++_0x19d90e);}(_0x7607,0x92));var _0x7760=function(_0x1929ef,_0x47e6f7){_0x1929ef=_0x1929ef-0x0;var _0x1551e7=_0x7607[_0x1929ef];return _0x1551e7;};'use strict';function Interval(_0x5715f5){this['id']=_0x5715f5['id']||0x0;this['name']=_0x5715f5[_0x7760('0x0')]||'';this[_0x7760('0x1')]=_0x5715f5[_0x7760('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 127f938..894b364 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 _0xd51b=['md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','_rr','loggedIn','paused','mailPause','available','stringify','mail:queue:%s','mail_queue:save','exports','lodash'];(function(_0x3266f4,_0x13cc58){var _0x332a19=function(_0x42cdc0){while(--_0x42cdc0){_0x3266f4['push'](_0x3266f4['shift']());}};_0x332a19(++_0x13cc58);}(_0xd51b,0x143));var _0xbd51=function(_0x315020,_0x42acd6){_0x315020=_0x315020-0x0;var _0x456820=_0xd51b[_0x315020];return _0x456820;};'use strict';var _=require(_0xbd51('0x0'));var md5=require(_0xbd51('0x1'));var util=require(_0xbd51('0x2'));var Redis=require(_0xbd51('0x3'));var config=require(_0xbd51('0x4'));config[_0xbd51('0x5')]=_[_0xbd51('0x6')](config[_0xbd51('0x5')],{'host':_0xbd51('0x7'),'port':0x18eb});var io=require(_0xbd51('0x8'))(new Redis(config[_0xbd51('0x5')]));function MailQueue(_0x29fe7a){this['id']=_0x29fe7a['id']||0x0;this[_0xbd51('0x9')]=_0x29fe7a[_0xbd51('0x9')]||'';this[_0xbd51('0xa')]=_0x29fe7a['timeout']||0xa;this['strategy']=_0x29fe7a[_0xbd51('0xb')]||_0xbd51('0xc');this[_0xbd51('0xd')]=_0x29fe7a[_0xbd51('0xd')];this[_0xbd51('0xe')]={};this[_0xbd51('0xf')]=0x0;this[_0xbd51('0x1')]='';this['updateRouting']();this[_0xbd51('0x10')]();}MailQueue[_0xbd51('0x11')]['updateRouting']=function(){var _0x13f705=this['mapAgentsId'][_0xbd51('0x12')];this[_0xbd51('0xe')]=_['map'](this['Agents'],'id');this[_0xbd51('0xe')][_0xbd51('0x12')]=_0x13f705;};MailQueue[_0xbd51('0x11')]['updateRealtime']=function(){this[_0xbd51('0x13')]=0x0;this[_0xbd51('0x14')]=0x0;for(var _0x18e85a=0x0;_0x18e85a=0x0?this[_0xbd51('0x16')]:0x0;var _0x466d1b={'id':this['id'],'available':this[_0xbd51('0x16')],'loggedIn':this[_0xbd51('0x13')],'name':this[_0xbd51('0x9')],'paused':this[_0xbd51('0x14')],'waiting':this['waiting']};var _0x44674e=md5(JSON[_0xbd51('0x17')](_0x466d1b));if(this[_0xbd51('0x1')]!==_0x44674e){this[_0xbd51('0x1')]=_0x44674e;io['to'](util['format'](_0xbd51('0x18'),_0x466d1b[_0xbd51('0x9')]))['emit'](_0xbd51('0x19'),_0x466d1b);}};module[_0xbd51('0x1a')]=MailQueue; \ No newline at end of file +var _0x7fc8=['timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','loggedIn','length','online','paused','available','stringify','format','mail:queue:%s','mail_queue:save','exports','lodash','util','ioredis','redis','defaults','socket.io-emitter','name'];(function(_0x2db59f,_0x236c36){var _0x8e74b8=function(_0x230da4){while(--_0x230da4){_0x2db59f['push'](_0x2db59f['shift']());}};_0x8e74b8(++_0x236c36);}(_0x7fc8,0xbd));var _0x87fc=function(_0x119fd8,_0x3c123b){_0x119fd8=_0x119fd8-0x0;var _0x51afea=_0x7fc8[_0x119fd8];return _0x51afea;};'use strict';var _=require(_0x87fc('0x0'));var md5=require('md5');var util=require(_0x87fc('0x1'));var Redis=require(_0x87fc('0x2'));var config=require('../../../config/environment');config[_0x87fc('0x3')]=_[_0x87fc('0x4')](config[_0x87fc('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x87fc('0x5'))(new Redis(config[_0x87fc('0x3')]));function MailQueue(_0x2297b3){this['id']=_0x2297b3['id']||0x0;this[_0x87fc('0x6')]=_0x2297b3[_0x87fc('0x6')]||'';this[_0x87fc('0x7')]=_0x2297b3[_0x87fc('0x7')]||0xa;this[_0x87fc('0x8')]=_0x2297b3[_0x87fc('0x8')]||_0x87fc('0x9');this[_0x87fc('0xa')]=_0x2297b3[_0x87fc('0xa')];this[_0x87fc('0xb')]={};this[_0x87fc('0xc')]=0x0;this[_0x87fc('0xd')]='';this[_0x87fc('0xe')]();this[_0x87fc('0xf')]();}MailQueue[_0x87fc('0x10')][_0x87fc('0xe')]=function(){var _0x53d7e4=this[_0x87fc('0xb')][_0x87fc('0x11')];this[_0x87fc('0xb')]=_['map'](this[_0x87fc('0xa')],'id');this[_0x87fc('0xb')][_0x87fc('0x11')]=_0x53d7e4;};MailQueue[_0x87fc('0x10')]['updateRealtime']=function(){this[_0x87fc('0x12')]=0x0;this['paused']=0x0;for(var _0x186018=0x0;_0x186018=0x0?this['available']:0x0;var _0x1da5ef={'id':this['id'],'available':this[_0x87fc('0x16')],'loggedIn':this[_0x87fc('0x12')],'name':this[_0x87fc('0x6')],'paused':this['paused'],'waiting':this[_0x87fc('0xc')]};var _0x4b2589=md5(JSON[_0x87fc('0x17')](_0x1da5ef));if(this['md5']!==_0x4b2589){this[_0x87fc('0xd')]=_0x4b2589;io['to'](util[_0x87fc('0x18')](_0x87fc('0x19'),_0x1da5ef[_0x87fc('0x6')]))['emit'](_0x87fc('0x1a'),_0x1da5ef);}};module[_0x87fc('0x1b')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 9809458..1f8b125 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 _0x1261=['available','stringify','openchannel:queue:%s','openchannel_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','map','_rr','updateRealtime','loggedIn','paused','length','online'];(function(_0x34df4a,_0x209d10){var _0x145c69=function(_0xb9bcbd){while(--_0xb9bcbd){_0x34df4a['push'](_0x34df4a['shift']());}};_0x145c69(++_0x209d10);}(_0x1261,0x144));var _0x1126=function(_0x5e4ffa,_0x56154d){_0x5e4ffa=_0x5e4ffa-0x0;var _0x43a656=_0x1261[_0x5e4ffa];return _0x43a656;};'use strict';var _=require('lodash');var md5=require(_0x1126('0x0'));var util=require(_0x1126('0x1'));var Redis=require(_0x1126('0x2'));var config=require(_0x1126('0x3'));config[_0x1126('0x4')]=_[_0x1126('0x5')](config[_0x1126('0x4')],{'host':_0x1126('0x6'),'port':0x18eb});var io=require(_0x1126('0x7'))(new Redis(config[_0x1126('0x4')]));function OpenchannelQueue(_0x5a2189){this['id']=_0x5a2189['id']||0x0;this['name']=_0x5a2189[_0x1126('0x8')]||'';this[_0x1126('0x9')]=_0x5a2189['timeout']||0xa;this[_0x1126('0xa')]=_0x5a2189[_0x1126('0xa')]||_0x1126('0xb');this[_0x1126('0xc')]=_0x5a2189[_0x1126('0xc')];this['mapAgentsId']={};this[_0x1126('0xd')]=0x0;this[_0x1126('0x0')]='';this[_0x1126('0xe')]();this['updateRealtime']();}OpenchannelQueue[_0x1126('0xf')]['updateRouting']=function(){var _0x52ef15=this[_0x1126('0x10')]['_rr'];this[_0x1126('0x10')]=_[_0x1126('0x11')](this[_0x1126('0xc')],'id');this[_0x1126('0x10')][_0x1126('0x12')]=_0x52ef15;};OpenchannelQueue[_0x1126('0xf')][_0x1126('0x13')]=function(){this[_0x1126('0x14')]=0x0;this[_0x1126('0x15')]=0x0;for(var _0x53a8f0=0x0;_0x53a8f0=0x0?this['available']:0x0;var _0x4d2b38={'id':this['id'],'available':this[_0x1126('0x18')],'loggedIn':this[_0x1126('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x1126('0xd')]};var _0x58b109=md5(JSON[_0x1126('0x19')](_0x4d2b38));if(this[_0x1126('0x0')]!==_0x58b109){this[_0x1126('0x0')]=_0x58b109;io['to'](util['format'](_0x1126('0x1a'),_0x4d2b38['name']))['emit'](_0x1126('0x1b'),_0x4d2b38);}};module[_0x1126('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xc4aa[_0x32f7d7];return _0x133d09;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 7bfece9..5fd9f9e 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 _0x8128=['exports','lodash','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','map','Agents','_rr','loggedIn','paused','online','available','stringify','format','sms:queue:%s','sms_queue:save'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x8128,0x1b1));var _0x8812=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x8128[_0x13e741];return _0x3f8bb3;};'use strict';var _=require(_0x8812('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x8812('0x1'));var config=require(_0x8812('0x2'));config['redis']=_['defaults'](config[_0x8812('0x3')],{'host':_0x8812('0x4'),'port':0x18eb});var io=require(_0x8812('0x5'))(new Redis(config['redis']));function SmsQueue(_0x33f9f6){this['id']=_0x33f9f6['id']||0x0;this[_0x8812('0x6')]=_0x33f9f6[_0x8812('0x6')]||'';this[_0x8812('0x7')]=_0x33f9f6['timeout']||0xa;this[_0x8812('0x8')]=_0x33f9f6[_0x8812('0x8')]||'beepall';this['Agents']=_0x33f9f6['Agents'];this[_0x8812('0x9')]={};this[_0x8812('0xa')]=0x0;this[_0x8812('0xb')]='';this[_0x8812('0xc')]();this[_0x8812('0xd')]();}SmsQueue[_0x8812('0xe')][_0x8812('0xc')]=function(){var _0x12c0ac=this[_0x8812('0x9')]['_rr'];this[_0x8812('0x9')]=_[_0x8812('0xf')](this[_0x8812('0x10')],'id');this[_0x8812('0x9')][_0x8812('0x11')]=_0x12c0ac;};SmsQueue[_0x8812('0xe')]['updateRealtime']=function(){this[_0x8812('0x12')]=0x0;this[_0x8812('0x13')]=0x0;for(var _0x589fd9=0x0;_0x589fd9=0x0?this[_0x8812('0x15')]:0x0;var _0x38a8ad={'id':this['id'],'available':this['available'],'loggedIn':this[_0x8812('0x12')],'name':this[_0x8812('0x6')],'paused':this[_0x8812('0x13')],'waiting':this['waiting']};var _0x59c4cd=md5(JSON[_0x8812('0x16')](_0x38a8ad));if(this[_0x8812('0xb')]!==_0x59c4cd){this[_0x8812('0xb')]=_0x59c4cd;io['to'](util[_0x8812('0x17')](_0x8812('0x18'),_0x38a8ad[_0x8812('0x6')]))['emit'](_0x8812('0x19'),_0x38a8ad);}};module[_0x8812('0x1a')]=SmsQueue; \ No newline at end of file +var _0xb91a=['sms_queue:save','lodash','md5','util','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','Agents','loggedIn','paused','online','smsPause','available','stringify','format','emit'];(function(_0x5174e9,_0x3cd2d1){var _0x4a1d2c=function(_0x4330a1){while(--_0x4330a1){_0x5174e9['push'](_0x5174e9['shift']());}};_0x4a1d2c(++_0x3cd2d1);}(_0xb91a,0xf4));var _0xab91=function(_0x2faa07,_0x33b1c7){_0x2faa07=_0x2faa07-0x0;var _0x13983f=_0xb91a[_0x2faa07];return _0x13983f;};'use strict';var _=require(_0xab91('0x0'));var md5=require(_0xab91('0x1'));var util=require(_0xab91('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xab91('0x3')]=_[_0xab91('0x4')](config[_0xab91('0x3')],{'host':_0xab91('0x5'),'port':0x18eb});var io=require(_0xab91('0x6'))(new Redis(config[_0xab91('0x3')]));function SmsQueue(_0x1686bb){this['id']=_0x1686bb['id']||0x0;this[_0xab91('0x7')]=_0x1686bb[_0xab91('0x7')]||'';this[_0xab91('0x8')]=_0x1686bb['timeout']||0xa;this[_0xab91('0x9')]=_0x1686bb[_0xab91('0x9')]||'beepall';this['Agents']=_0x1686bb['Agents'];this[_0xab91('0xa')]={};this[_0xab91('0xb')]=0x0;this[_0xab91('0x1')]='';this[_0xab91('0xc')]();this[_0xab91('0xd')]();}SmsQueue[_0xab91('0xe')][_0xab91('0xc')]=function(){var _0x39bcfd=this[_0xab91('0xa')][_0xab91('0xf')];this[_0xab91('0xa')]=_[_0xab91('0x10')](this[_0xab91('0x11')],'id');this['mapAgentsId']['_rr']=_0x39bcfd;};SmsQueue[_0xab91('0xe')][_0xab91('0xd')]=function(){this[_0xab91('0x12')]=0x0;this[_0xab91('0x13')]=0x0;for(var _0x14b304=0x0;_0x14b304=0x0?this[_0xab91('0x16')]:0x0;var _0x4b9bcf={'id':this['id'],'available':this[_0xab91('0x16')],'loggedIn':this[_0xab91('0x12')],'name':this[_0xab91('0x7')],'paused':this['paused'],'waiting':this[_0xab91('0xb')]};var _0x52d9e0=md5(JSON[_0xab91('0x17')](_0x4b9bcf));if(this['md5']!==_0x52d9e0){this['md5']=_0x52d9e0;io['to'](util[_0xab91('0x18')]('sms:queue:%s',_0x4b9bcf[_0xab91('0x7')]))[_0xab91('0x19')](_0xab91('0x1a'),_0x4b9bcf);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index cede439..f568b24 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 _0x450e=['prototype','updateRealtime','length','online','loggedIn','whatsappPause','paused','available','waiting','stringify','emit','whatsapp_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','mapAgentsId','md5','updateRouting','map','Agents','_rr'];(function(_0x2bb7af,_0x30d538){var _0x73ad52=function(_0x49d3bf){while(--_0x49d3bf){_0x2bb7af['push'](_0x2bb7af['shift']());}};_0x73ad52(++_0x30d538);}(_0x450e,0x9e));var _0xe450=function(_0x33252f,_0x4e72e8){_0x33252f=_0x33252f-0x0;var _0x3699a2=_0x450e[_0x33252f];return _0x3699a2;};'use strict';var _=require(_0xe450('0x0'));var md5=require('md5');var util=require(_0xe450('0x1'));var Redis=require(_0xe450('0x2'));var config=require(_0xe450('0x3'));config[_0xe450('0x4')]=_['defaults'](config[_0xe450('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xe450('0x5'))(new Redis(config[_0xe450('0x4')]));function WhatsappQueue(_0x5c478d){this['id']=_0x5c478d['id']||0x0;this[_0xe450('0x6')]=_0x5c478d['name']||'';this[_0xe450('0x7')]=_0x5c478d[_0xe450('0x7')]||0xa;this['strategy']=_0x5c478d[_0xe450('0x8')]||_0xe450('0x9');this['Agents']=_0x5c478d['Agents'];this[_0xe450('0xa')]={};this['waiting']=0x0;this[_0xe450('0xb')]='';this[_0xe450('0xc')]();this['updateRealtime']();}WhatsappQueue['prototype'][_0xe450('0xc')]=function(){var _0xe39695=this[_0xe450('0xa')]['_rr'];this['mapAgentsId']=_[_0xe450('0xd')](this[_0xe450('0xe')],'id');this[_0xe450('0xa')][_0xe450('0xf')]=_0xe39695;};WhatsappQueue[_0xe450('0x10')][_0xe450('0x11')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x4b0634=0x0;_0x4b0634=0x0?this[_0xe450('0x17')]:0x0;var _0x330ae8={'id':this['id'],'available':this[_0xe450('0x17')],'loggedIn':this[_0xe450('0x14')],'name':this['name'],'paused':this[_0xe450('0x16')],'waiting':this[_0xe450('0x18')]};var _0x36ca06=md5(JSON[_0xe450('0x19')](_0x330ae8));if(this[_0xe450('0xb')]!==_0x36ca06){this[_0xe450('0xb')]=_0x36ca06;io['to'](util['format']('whatsapp:queue:%s',_0x330ae8[_0xe450('0x6')]))[_0xe450('0x1a')](_0xe450('0x1b'),_0x330ae8);}};module[_0xe450('0x1c')]=WhatsappQueue; \ No newline at end of file +var _0x80a1=['beepall','Agents','waiting','updateRouting','updateRealtime','mapAgentsId','_rr','prototype','length','loggedIn','whatsappPause','paused','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','lodash','md5','util','ioredis','redis','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x80a1,0x82));var _0x180a=function(_0x1a83f2,_0x4661bc){_0x1a83f2=_0x1a83f2-0x0;var _0x30d0ad=_0x80a1[_0x1a83f2];return _0x30d0ad;};'use strict';var _=require(_0x180a('0x0'));var md5=require(_0x180a('0x1'));var util=require(_0x180a('0x2'));var Redis=require(_0x180a('0x3'));var config=require('../../../config/environment');config[_0x180a('0x4')]=_['defaults'](config[_0x180a('0x4')],{'host':_0x180a('0x5'),'port':0x18eb});var io=require(_0x180a('0x6'))(new Redis(config[_0x180a('0x4')]));function WhatsappQueue(_0x45980f){this['id']=_0x45980f['id']||0x0;this[_0x180a('0x7')]=_0x45980f['name']||'';this['timeout']=_0x45980f[_0x180a('0x8')]||0xa;this[_0x180a('0x9')]=_0x45980f[_0x180a('0x9')]||_0x180a('0xa');this[_0x180a('0xb')]=_0x45980f['Agents'];this['mapAgentsId']={};this[_0x180a('0xc')]=0x0;this[_0x180a('0x1')]='';this[_0x180a('0xd')]();this[_0x180a('0xe')]();}WhatsappQueue['prototype'][_0x180a('0xd')]=function(){var _0x32a474=this['mapAgentsId']['_rr'];this[_0x180a('0xf')]=_['map'](this[_0x180a('0xb')],'id');this[_0x180a('0xf')][_0x180a('0x10')]=_0x32a474;};WhatsappQueue[_0x180a('0x11')][_0x180a('0xe')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x4a3efb=0x0;_0x4a3efb=0x0?this[_0x180a('0x16')]:0x0;var _0x2a8d85={'id':this['id'],'available':this[_0x180a('0x16')],'loggedIn':this[_0x180a('0x13')],'name':this['name'],'paused':this[_0x180a('0x15')],'waiting':this['waiting']};var _0x17aca4=md5(JSON[_0x180a('0x17')](_0x2a8d85));if(this[_0x180a('0x1')]!==_0x17aca4){this[_0x180a('0x1')]=_0x17aca4;io['to'](util[_0x180a('0x18')](_0x180a('0x19'),_0x2a8d85[_0x180a('0x7')]))[_0x180a('0x1a')](_0x180a('0x1b'),_0x2a8d85);}};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 5b92df4..58d75d1 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x385d3c,_0x13c619){var _0x156579=function(_0x4fea72){while(--_0x4fea72){_0x385d3c['push'](_0x385d3c['shift']());}};_0x156579(++_0x13c619);}(_0xb10b,0x12a));var _0xbb10=function(_0x2e78db,_0x5ab8a1){_0x2e78db=_0x2e78db-0x0;var _0x195fb4=_0xb10b[_0x2e78db];return _0x195fb4;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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 83a1580..a3d2de8 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 _0x7557=['AddTagsToChatInteraction','../client','update','UpdateChatInteraction','Request'];(function(_0x2bcb75,_0x5789a7){var _0x175345=function(_0x3a7d41){while(--_0x3a7d41){_0x2bcb75['push'](_0x2bcb75['shift']());}};_0x175345(++_0x5789a7);}(_0x7557,0x19b));var _0x7755=function(_0x2d85a5,_0x26861c){_0x2d85a5=_0x2d85a5-0x0;var _0x27d75b=_0x7557[_0x2d85a5];return _0x27d75b;};'use strict';var client=require(_0x7755('0x0'));exports[_0x7755('0x1')]=function(_0xf964e4,_0xe503a6){return client['Request'](_0x7755('0x2'),{'body':_0xe503a6,'options':{'where':{'id':_0xf964e4}},'log':'updateChatInteraction'});};exports['addTags']=function(_0xdc2cdd,_0xdbbe1f){return client[_0x7755('0x3')](_0x7755('0x4'),{'body':_0xdbbe1f,'options':{'where':{'id':_0xdc2cdd}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x941f=['Request','updateChatInteraction','addTags','addTagsToChatInteraction','../client'];(function(_0x20c6a8,_0x47bfc1){var _0x1f0c8b=function(_0x147212){while(--_0x147212){_0x20c6a8['push'](_0x20c6a8['shift']());}};_0x1f0c8b(++_0x47bfc1);}(_0x941f,0x1df));var _0xf941=function(_0x580104,_0x2971d1){_0x580104=_0x580104-0x0;var _0x415fa3=_0x941f[_0x580104];return _0x415fa3;};'use strict';var client=require(_0xf941('0x0'));exports['update']=function(_0x3b1850,_0x5a9d35){return client[_0xf941('0x1')]('UpdateChatInteraction',{'body':_0x5a9d35,'options':{'where':{'id':_0x3b1850}},'log':_0xf941('0x2')});};exports[_0xf941('0x3')]=function(_0x576dae,_0x3bca5c){return client[_0xf941('0x1')]('AddTagsToChatInteraction',{'body':_0x3bca5c,'options':{'where':{'id':_0x576dae}},'log':_0xf941('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index f044658..5ee0c87 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 _0x0b39=['create','createChatMessage','../client'];(function(_0x365807,_0x546f47){var _0x16bd42=function(_0x2793ef){while(--_0x2793ef){_0x365807['push'](_0x365807['shift']());}};_0x16bd42(++_0x546f47);}(_0x0b39,0x1d9));var _0x90b3=function(_0x23ea87,_0x305223){_0x23ea87=_0x23ea87-0x0;var _0x4898ac=_0x0b39[_0x23ea87];return _0x4898ac;};'use strict';var client=require(_0x90b3('0x0'));exports[_0x90b3('0x1')]=function(_0x47442b){return client['Request']('CreateChatMessage',{'body':_0x47442b,'log':_0x90b3('0x2')});}; \ No newline at end of file +var _0x8e42=['createChatMessage','../client','create','Request','CreateChatMessage'];(function(_0x15d81f,_0x10594f){var _0x393917=function(_0x2e60d7){while(--_0x2e60d7){_0x15d81f['push'](_0x15d81f['shift']());}};_0x393917(++_0x10594f);}(_0x8e42,0xbf));var _0x28e4=function(_0x52ca59,_0x279dda){_0x52ca59=_0x52ca59-0x0;var _0x1ab7e5=_0x8e42[_0x52ca59];return _0x1ab7e5;};'use strict';var client=require(_0x28e4('0x0'));exports[_0x28e4('0x1')]=function(_0xc04c22){return client[_0x28e4('0x2')](_0x28e4('0x3'),{'body':_0xc04c22,'log':_0x28e4('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 880453e..ee62e9c 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 _0xdbd0=['name','strategy','User','Agents','online','chatPause','../client','getChatQueues','Request','GetChatQueue'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xdbd0,0x88));var _0x0dbd=function(_0xb4477c,_0x47a6e8){_0xb4477c=_0xb4477c-0x0;var _0x96e8ee=_0xdbd0[_0xb4477c];return _0x96e8ee;};'use strict';var client=require(_0x0dbd('0x0'));exports[_0x0dbd('0x1')]=function(){return function(){return client[_0x0dbd('0x2')](_0x0dbd('0x3'),{'options':{'raw':![],'attributes':['id',_0x0dbd('0x4'),'timeout',_0x0dbd('0x5')],'include':[{'model':_0x0dbd('0x6'),'as':_0x0dbd('0x7'),'attributes':['id','name',_0x0dbd('0x8'),_0x0dbd('0x9')]}]},'log':_0x0dbd('0x1')});};}; \ No newline at end of file +var _0xfb82=['timeout','User','Agents','online','chatPause','../client','getChatQueues','Request','name'];(function(_0xc2fcdb,_0x5e225a){var _0x4d7af3=function(_0x56d8eb){while(--_0x56d8eb){_0xc2fcdb['push'](_0xc2fcdb['shift']());}};_0x4d7af3(++_0x5e225a);}(_0xfb82,0x17f));var _0x2fb8=function(_0x7bf6d6,_0x43c121){_0x7bf6d6=_0x7bf6d6-0x0;var _0x4dceeb=_0xfb82[_0x7bf6d6];return _0x4dceeb;};'use strict';var client=require(_0x2fb8('0x0'));exports[_0x2fb8('0x1')]=function(){return function(){return client[_0x2fb8('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x2fb8('0x3'),_0x2fb8('0x4'),'strategy'],'include':[{'model':_0x2fb8('0x5'),'as':_0x2fb8('0x6'),'attributes':['id',_0x2fb8('0x3'),_0x2fb8('0x7'),_0x2fb8('0x8')]}]},'log':_0x2fb8('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 2332b5c..ae69643 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 _0x5640=['update','UpdateChatQueueReport','DESC','../client','Request','CreateChatQueueReport'];(function(_0x5803ea,_0x9276ed){var _0x4ccb4=function(_0x4e7589){while(--_0x4e7589){_0x5803ea['push'](_0x5803ea['shift']());}};_0x4ccb4(++_0x9276ed);}(_0x5640,0x111));var _0x0564=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x5640[_0x59ee6f];return _0x4c0979;};'use strict';var client=require(_0x0564('0x0'));exports['create']=function(_0xaefcb6){return client[_0x0564('0x1')](_0x0564('0x2'),{'body':_0xaefcb6,'log':_0x0564('0x2')});};exports[_0x0564('0x3')]=function(_0x10487f,_0x1cbb9d){return client[_0x0564('0x1')](_0x0564('0x4'),{'body':_0x1cbb9d,'options':{'where':{'uniqueid':_0x10487f},'order':[['id',_0x0564('0x5')]],'limit':0x1},'log':_0x0564('0x4')});}; \ No newline at end of file +var _0xc818=['../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC'];(function(_0x1b42e5,_0x53be32){var _0x49ae12=function(_0xa52d1a){while(--_0xa52d1a){_0x1b42e5['push'](_0x1b42e5['shift']());}};_0x49ae12(++_0x53be32);}(_0xc818,0x1e3));var _0x8c81=function(_0x297b3e,_0x1264c0){_0x297b3e=_0x297b3e-0x0;var _0x597e54=_0xc818[_0x297b3e];return _0x597e54;};'use strict';var client=require(_0x8c81('0x0'));exports[_0x8c81('0x1')]=function(_0x2ebf7a){return client[_0x8c81('0x2')]('CreateChatQueueReport',{'body':_0x2ebf7a,'log':_0x8c81('0x3')});};exports[_0x8c81('0x4')]=function(_0x40b19e,_0x7e329f){return client[_0x8c81('0x2')](_0x8c81('0x5'),{'body':_0x7e329f,'options':{'where':{'uniqueid':_0x40b19e},'order':[['id',_0x8c81('0x6')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 01fe3d9..58ee550 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(_0x35965d,_0x26e97d){var _0x4d43ad=function(_0x3b0ae2){while(--_0x3b0ae2){_0x35965d['push'](_0x35965d['shift']());}};_0x4d43ad(++_0x26e97d);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x7a54,0x106));var _0x47a5=function(_0x42bd48,_0x49d60b){_0x42bd48=_0x42bd48-0x0;var _0x2b8009=_0x7a54[_0x42bd48];return _0x2b8009;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index c329be6..20764b1 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 _0x6135=['createFaxMessage','../client','Request','CreateFaxMessage'];(function(_0x399597,_0x43b8b9){var _0x135b7a=function(_0x43f538){while(--_0x43f538){_0x399597['push'](_0x399597['shift']());}};_0x135b7a(++_0x43b8b9);}(_0x6135,0x145));var _0x5613=function(_0x4320ce,_0x49f5f5){_0x4320ce=_0x4320ce-0x0;var _0x537dae=_0x6135[_0x4320ce];return _0x537dae;};'use strict';var client=require(_0x5613('0x0'));exports['create']=function(_0x1bc493){return client[_0x5613('0x1')](_0x5613('0x2'),{'body':_0x1bc493,'log':_0x5613('0x3')});}; \ No newline at end of file +var _0x7b90=['../client','create','CreateFaxMessage'];(function(_0x72450f,_0x50b53b){var _0x3d765c=function(_0x1a35b6){while(--_0x1a35b6){_0x72450f['push'](_0x72450f['shift']());}};_0x3d765c(++_0x50b53b);}(_0x7b90,0x75));var _0x07b9=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x7b90[_0x465028];return _0xb783d4;};'use strict';var client=require(_0x07b9('0x0'));exports[_0x07b9('0x1')]=function(_0x14da82){return client['Request'](_0x07b9('0x2'),{'body':_0x14da82,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index fe81474..9e9617f 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 _0x25c5=['getFaxQueues','Request','GetFaxQueue','timeout','strategy','User','Agents','name','online','faxPause','../client'];(function(_0x3a69e4,_0x5e58d3){var _0x4f12e8=function(_0x3ea783){while(--_0x3ea783){_0x3a69e4['push'](_0x3a69e4['shift']());}};_0x4f12e8(++_0x5e58d3);}(_0x25c5,0x1ee));var _0x525c=function(_0x21f3bf,_0xfb0f59){_0x21f3bf=_0x21f3bf-0x0;var _0x249d08=_0x25c5[_0x21f3bf];return _0x249d08;};'use strict';var client=require(_0x525c('0x0'));exports[_0x525c('0x1')]=function(){return function(){return client[_0x525c('0x2')](_0x525c('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x525c('0x4'),_0x525c('0x5')],'include':[{'model':_0x525c('0x6'),'as':_0x525c('0x7'),'attributes':['id',_0x525c('0x8'),_0x525c('0x9'),_0x525c('0xa')]}]},'log':_0x525c('0x1')});};}; \ No newline at end of file +var _0x5940=['getFaxQueues','timeout','Agents','faxPause','../client'];(function(_0x582a25,_0x20f53e){var _0x13cfa2=function(_0x2e4072){while(--_0x2e4072){_0x582a25['push'](_0x582a25['shift']());}};_0x13cfa2(++_0x20f53e);}(_0x5940,0x13f));var _0x0594=function(_0x14b857,_0x5744b5){_0x14b857=_0x14b857-0x0;var _0x5ae689=_0x5940[_0x14b857];return _0x5ae689;};'use strict';var client=require(_0x0594('0x0'));exports[_0x0594('0x1')]=function(){return function(){return client['Request']('GetFaxQueue',{'options':{'raw':![],'attributes':['id','name',_0x0594('0x2'),'strategy'],'include':[{'model':'User','as':_0x0594('0x3'),'attributes':['id','name','online',_0x0594('0x4')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 0fcd34a..de06045 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 _0xd420=['CreateFaxQueueReport','update','UpdateFaxQueueReport','../client','create','Request'];(function(_0x1128e8,_0x521d59){var _0x15ab9a=function(_0x33e7c6){while(--_0x33e7c6){_0x1128e8['push'](_0x1128e8['shift']());}};_0x15ab9a(++_0x521d59);}(_0xd420,0x147));var _0x0d42=function(_0x25cf58,_0x39abf5){_0x25cf58=_0x25cf58-0x0;var _0x15a11a=_0xd420[_0x25cf58];return _0x15a11a;};'use strict';var client=require(_0x0d42('0x0'));exports[_0x0d42('0x1')]=function(_0x555acc){return client[_0x0d42('0x2')]('CreateFaxQueueReport',{'body':_0x555acc,'log':_0x0d42('0x3')});};exports[_0x0d42('0x4')]=function(_0x560fc3,_0x464a3f){return client[_0x0d42('0x2')](_0x0d42('0x5'),{'body':_0x464a3f,'options':{'where':{'uniqueid':_0x560fc3},'order':[['id','DESC']],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x1d8f=['CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client','create','Request'];(function(_0xfd49ed,_0x1272e1){var _0x355f54=function(_0x3fc70f){while(--_0x3fc70f){_0xfd49ed['push'](_0xfd49ed['shift']());}};_0x355f54(++_0x1272e1);}(_0x1d8f,0x82));var _0xf1d8=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x1d8f[_0x3bf83f];return _0x22c4a9;};'use strict';var client=require(_0xf1d8('0x0'));exports[_0xf1d8('0x1')]=function(_0x5771df){return client[_0xf1d8('0x2')](_0xf1d8('0x3'),{'body':_0x5771df,'log':'CreateFaxQueueReport'});};exports[_0xf1d8('0x4')]=function(_0x420899,_0x5ceb3c){return client[_0xf1d8('0x2')](_0xf1d8('0x5'),{'body':_0x5ceb3c,'options':{'where':{'uniqueid':_0x420899},'order':[['id',_0xf1d8('0x6')]],'limit':0x1},'log':_0xf1d8('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 263ded4..2a57600 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 _0x57af=['name','Interval','Intervals','interval','../client','Request'];(function(_0x1c3eb3,_0x5440a){var _0x12efae=function(_0xf6f131){while(--_0xf6f131){_0x1c3eb3['push'](_0x1c3eb3['shift']());}};_0x12efae(++_0x5440a);}(_0x57af,0xee));var _0xf57a=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x57af[_0x187ee1];return _0x388160;};'use strict';var client=require(_0xf57a('0x0'));exports['getIntervals']=function(){return function(){return client[_0xf57a('0x1')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xf57a('0x2')],'include':[{'model':_0xf57a('0x3'),'as':_0xf57a('0x4'),'attributes':['id','name',_0xf57a('0x5')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0xb341=['Intervals','getIntervals','Request','GetInterval','name'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0xb341,0x93));var _0x1b34=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb341[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getIntervals']=function(){return function(){return client[_0x1b34('0x0')](_0x1b34('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x1b34('0x2')],'include':[{'model':'Interval','as':_0x1b34('0x3'),'attributes':['id',_0x1b34('0x2'),'interval']}]},'log':_0x1b34('0x4')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 96420d3..258e7e7 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(_0x1f239e,_0x367b43){var _0x826971=function(_0x2c5777){while(--_0x2c5777){_0x1f239e['push'](_0x1f239e['shift']());}};_0x826971(++_0x367b43);}(_0xfff0,0x139));var _0x0fff=function(_0x52a63b,_0x34b7e2){_0x52a63b=_0x52a63b-0x0;var _0x3a1898=_0xfff0[_0x52a63b];return _0x3a1898;};'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 _0x3423=['AddTagsToMailInteraction','addTagsToChatInteraction','Request','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x5b7b12,_0x1b3602){var _0x2ebfbe=function(_0x152a93){while(--_0x152a93){_0x5b7b12['push'](_0x5b7b12['shift']());}};_0x2ebfbe(++_0x1b3602);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['update']=function(_0x381e58,_0x16bdb3){return client[_0x3342('0x0')](_0x3342('0x1'),{'body':_0x16bdb3,'options':{'where':{'id':_0x381e58}},'log':_0x3342('0x2')});};exports[_0x3342('0x3')]=function(_0x2207ce,_0x3c5d8d){return client[_0x3342('0x0')](_0x3342('0x4'),{'body':_0x3c5d8d,'options':{'where':{'id':_0x2207ce}},'log':_0x3342('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index c66b156..07d8445 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 _0xbc87=['../client','create','Request','CreateMailMessage','createMailMessage'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xbc87,0x118));var _0x7bc8=function(_0x121a4e,_0x54c1ca){_0x121a4e=_0x121a4e-0x0;var _0xd4ab47=_0xbc87[_0x121a4e];return _0xd4ab47;};'use strict';var client=require(_0x7bc8('0x0'));exports[_0x7bc8('0x1')]=function(_0x490c7b){return client[_0x7bc8('0x2')](_0x7bc8('0x3'),{'body':_0x490c7b,'log':_0x7bc8('0x4')});}; \ No newline at end of file +var _0xb548=['createMailMessage','../client','create','CreateMailMessage'];(function(_0x5c814d,_0x4d81c7){var _0x89b71=function(_0x1068a4){while(--_0x1068a4){_0x5c814d['push'](_0x5c814d['shift']());}};_0x89b71(++_0x4d81c7);}(_0xb548,0x17d));var _0x8b54=function(_0x492535,_0x46524a){_0x492535=_0x492535-0x0;var _0x256620=_0xb548[_0x492535];return _0x256620;};'use strict';var client=require(_0x8b54('0x0'));exports[_0x8b54('0x1')]=function(_0x18889d){return client['Request'](_0x8b54('0x2'),{'body':_0x18889d,'log':_0x8b54('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 1201d6a..42e2daa 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 _0xe1d3=['name','online','mailPause','getMailQueues','../client','Request','timeout','User','Agents'];(function(_0x567648,_0x1450da){var _0x234e0f=function(_0x14862d){while(--_0x14862d){_0x567648['push'](_0x567648['shift']());}};_0x234e0f(++_0x1450da);}(_0xe1d3,0x8b));var _0x3e1d=function(_0x358247,_0x10aa3a){_0x358247=_0x358247-0x0;var _0x460471=_0xe1d3[_0x358247];return _0x460471;};'use strict';var client=require(_0x3e1d('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x3e1d('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id','name',_0x3e1d('0x2'),'strategy'],'include':[{'model':_0x3e1d('0x3'),'as':_0x3e1d('0x4'),'attributes':['id',_0x3e1d('0x5'),_0x3e1d('0x6'),_0x3e1d('0x7')]}]},'log':_0x3e1d('0x8')});};}; \ No newline at end of file +var _0xa9f0=['Request','name','timeout','User','Agents','mailPause','getMailQueues'];(function(_0x255538,_0x2d54b5){var _0x524e13=function(_0x1c79f8){while(--_0x1c79f8){_0x255538['push'](_0x255538['shift']());}};_0x524e13(++_0x2d54b5);}(_0xa9f0,0xfc));var _0x0a9f=function(_0x1e63b7,_0x2261c3){_0x1e63b7=_0x1e63b7-0x0;var _0x136ed0=_0xa9f0[_0x1e63b7];return _0x136ed0;};'use strict';var client=require('../client');exports['getMailQueues']=function(){return function(){return client[_0x0a9f('0x0')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x0a9f('0x1'),_0x0a9f('0x2'),'strategy'],'include':[{'model':_0x0a9f('0x3'),'as':_0x0a9f('0x4'),'attributes':['id','name','online',_0x0a9f('0x5')]}]},'log':_0x0a9f('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index e38e2dd..9ec5ff2 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 _0x5a9b=['Request','CreateMailQueueReport','UpdateMailQueueReport','create'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5a9b,0xcf));var _0xb5a9=function(_0x45c610,_0x443213){_0x45c610=_0x45c610-0x0;var _0x5833ba=_0x5a9b[_0x45c610];return _0x5833ba;};'use strict';var client=require('../client');exports[_0xb5a9('0x0')]=function(_0x202026){return client[_0xb5a9('0x1')](_0xb5a9('0x2'),{'body':_0x202026,'log':_0xb5a9('0x2')});};exports['update']=function(_0x3e0e0d,_0x1b5fbf){return client[_0xb5a9('0x1')](_0xb5a9('0x3'),{'body':_0x1b5fbf,'options':{'where':{'uniqueid':_0x3e0e0d},'order':[['id','DESC']],'limit':0x1},'log':_0xb5a9('0x3')});}; \ No newline at end of file +var _0xd2c1=['../client','update','UpdateMailQueueReport','DESC'];(function(_0x4dc31d,_0x1a7d13){var _0x1ba916=function(_0x1df98f){while(--_0x1df98f){_0x4dc31d['push'](_0x4dc31d['shift']());}};_0x1ba916(++_0x1a7d13);}(_0xd2c1,0x1c4));var _0x1d2c=function(_0x5b5cde,_0x1f7c5f){_0x5b5cde=_0x5b5cde-0x0;var _0x364ad2=_0xd2c1[_0x5b5cde];return _0x364ad2;};'use strict';var client=require(_0x1d2c('0x0'));exports['create']=function(_0x3e0a9d){return client['Request']('CreateMailQueueReport',{'body':_0x3e0a9d,'log':'CreateMailQueueReport'});};exports[_0x1d2c('0x1')]=function(_0x15bf41,_0xa74dec){return client['Request'](_0x1d2c('0x2'),{'body':_0xa74dec,'options':{'where':{'uniqueid':_0x15bf41},'order':[['id',_0x1d2c('0x3')]],'limit':0x1},'log':_0x1d2c('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 11b731b..2d255af 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 _0xc122=['UpdateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0xc122,0x135));var _0x2c12=function(_0xbe8a5d,_0x47fffc){_0xbe8a5d=_0xbe8a5d-0x0;var _0x2b7981=_0xc122[_0xbe8a5d];return _0x2b7981;};'use strict';var client=require(_0x2c12('0x0'));exports['update']=function(_0x174ebb,_0x58f691){return client['Request'](_0x2c12('0x1'),{'body':_0x58f691,'options':{'where':{'id':_0x174ebb}},'log':'updateOpenchannelInteraction'});};exports[_0x2c12('0x2')]=function(_0x8c847f,_0x141614){return client['Request'](_0x2c12('0x3'),{'body':_0x141614,'options':{'where':{'id':_0x8c847f}},'log':_0x2c12('0x4')});}; \ No newline at end of file +var _0x3124=['addTags','AddTagsToOpenchannelInteraction','../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0x3124,0xb1));var _0x4312=function(_0x47c261,_0x49615c){_0x47c261=_0x47c261-0x0;var _0x283929=_0x3124[_0x47c261];return _0x283929;};'use strict';var client=require(_0x4312('0x0'));exports[_0x4312('0x1')]=function(_0x416845,_0x1fca8b){return client[_0x4312('0x2')](_0x4312('0x3'),{'body':_0x1fca8b,'options':{'where':{'id':_0x416845}},'log':_0x4312('0x4')});};exports[_0x4312('0x5')]=function(_0x75822a,_0x52c624){return client[_0x4312('0x2')](_0x4312('0x6'),{'body':_0x52c624,'options':{'where':{'id':_0x75822a}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 9ec75ee..64498ba 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 _0xdbfc=['../client','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x533d14,_0xde5e42){var _0x54a4e0=function(_0xf98243){while(--_0xf98243){_0x533d14['push'](_0x533d14['shift']());}};_0x54a4e0(++_0xde5e42);}(_0xdbfc,0xb0));var _0xcdbf=function(_0x2c896e,_0x3141a4){_0x2c896e=_0x2c896e-0x0;var _0x503f00=_0xdbfc[_0x2c896e];return _0x503f00;};'use strict';var client=require(_0xcdbf('0x0'));exports['create']=function(_0x2e6795){return client[_0xcdbf('0x1')](_0xcdbf('0x2'),{'body':_0x2e6795,'log':_0xcdbf('0x3')});}; \ No newline at end of file +var _0x6783=['createOpenchannelMessage','CreateOpenchannelMessage'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6783,0x6f));var _0x3678=function(_0x596705,_0x46c60b){_0x596705=_0x596705-0x0;var _0x181c0c=_0x6783[_0x596705];return _0x181c0c;};'use strict';var client=require('../client');exports['create']=function(_0xa4e9aa){return client['Request'](_0x3678('0x0'),{'body':_0xa4e9aa,'log':_0x3678('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 3a2b455..25be179 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 _0xe3e5=['GetOpenchannelQueue','name','timeout','strategy','User','Agents','online','openchannelPause','../client','getOpenchannelQueues'];(function(_0x57fa33,_0x2b8222){var _0x12e724=function(_0x481a33){while(--_0x481a33){_0x57fa33['push'](_0x57fa33['shift']());}};_0x12e724(++_0x2b8222);}(_0xe3e5,0x166));var _0x5e3e=function(_0x36d71e,_0x4a05f7){_0x36d71e=_0x36d71e-0x0;var _0x10c949=_0xe3e5[_0x36d71e];return _0x10c949;};'use strict';var client=require(_0x5e3e('0x0'));exports[_0x5e3e('0x1')]=function(){return function(){return client['Request'](_0x5e3e('0x2'),{'options':{'raw':![],'attributes':['id',_0x5e3e('0x3'),_0x5e3e('0x4'),_0x5e3e('0x5')],'include':[{'model':_0x5e3e('0x6'),'as':_0x5e3e('0x7'),'attributes':['id',_0x5e3e('0x3'),_0x5e3e('0x8'),_0x5e3e('0x9')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0x1a46=['getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','User','Agents','online','openchannelPause','../client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1a46,0x11d));var _0x61a4=function(_0x2f6d8c,_0x48cbce){_0x2f6d8c=_0x2f6d8c-0x0;var _0x2ed5e0=_0x1a46[_0x2f6d8c];return _0x2ed5e0;};'use strict';var client=require(_0x61a4('0x0'));exports[_0x61a4('0x1')]=function(){return function(){return client[_0x61a4('0x2')](_0x61a4('0x3'),{'options':{'raw':![],'attributes':['id',_0x61a4('0x4'),_0x61a4('0x5'),_0x61a4('0x6')],'include':[{'model':_0x61a4('0x7'),'as':_0x61a4('0x8'),'attributes':['id',_0x61a4('0x4'),_0x61a4('0x9'),_0x61a4('0xa')]}]},'log':_0x61a4('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index ef14985..e33edd4 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 _0x640b=['create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','../client'];(function(_0x196894,_0x24e8e7){var _0x18adbd=function(_0xa29eaf){while(--_0xa29eaf){_0x196894['push'](_0x196894['shift']());}};_0x18adbd(++_0x24e8e7);}(_0x640b,0x1af));var _0xb640=function(_0x365251,_0x30efc7){_0x365251=_0x365251-0x0;var _0x4c9e29=_0x640b[_0x365251];return _0x4c9e29;};'use strict';var client=require(_0xb640('0x0'));exports[_0xb640('0x1')]=function(_0x51d703){return client[_0xb640('0x2')]('CreateOpenchannelQueueReport',{'body':_0x51d703,'log':_0xb640('0x3')});};exports[_0xb640('0x4')]=function(_0x562006,_0x109950){return client[_0xb640('0x2')](_0xb640('0x5'),{'body':_0x109950,'options':{'where':{'uniqueid':_0x562006},'order':[['id','DESC']],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0xaa1b=['update','DESC','UpdateOpenchannelQueueReport','../client','create','CreateOpenchannelQueueReport'];(function(_0x5c847a,_0x5c08d7){var _0x28036c=function(_0x283dda){while(--_0x283dda){_0x5c847a['push'](_0x5c847a['shift']());}};_0x28036c(++_0x5c08d7);}(_0xaa1b,0x123));var _0xbaa1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xaa1b[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xbaa1('0x0'));exports[_0xbaa1('0x1')]=function(_0x1ff50e){return client['Request'](_0xbaa1('0x2'),{'body':_0x1ff50e,'log':'CreateOpenchannelQueueReport'});};exports[_0xbaa1('0x3')]=function(_0x2b8de1,_0x4b125f){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0x4b125f,'options':{'where':{'uniqueid':_0x2b8de1},'order':[['id',_0xbaa1('0x4')]],'limit':0x1},'log':_0xbaa1('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index bf12b77..d606bd1 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 _0x6b4e=['updateSmsInteraction','addTags','Request','AddTagsToSmsInteraction','update'];(function(_0x13eac0,_0x27dda1){var _0x55b4d1=function(_0x2af45d){while(--_0x2af45d){_0x13eac0['push'](_0x13eac0['shift']());}};_0x55b4d1(++_0x27dda1);}(_0x6b4e,0x1a8));var _0xe6b4=function(_0x52b3cf,_0x3086e5){_0x52b3cf=_0x52b3cf-0x0;var _0x5887a9=_0x6b4e[_0x52b3cf];return _0x5887a9;};'use strict';var client=require('../client');exports[_0xe6b4('0x0')]=function(_0x52fcf0,_0x582105){return client['Request']('UpdateSmsInteraction',{'body':_0x582105,'options':{'where':{'id':_0x52fcf0}},'log':_0xe6b4('0x1')});};exports[_0xe6b4('0x2')]=function(_0x1aedc5,_0x344db1){return client[_0xe6b4('0x3')](_0xe6b4('0x4'),{'body':_0x344db1,'options':{'where':{'id':_0x1aedc5}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0x6726=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','update','Request','UpdateSmsInteraction'];(function(_0x421e4e,_0x41b11d){var _0x287010=function(_0x4ecd84){while(--_0x4ecd84){_0x421e4e['push'](_0x421e4e['shift']());}};_0x287010(++_0x41b11d);}(_0x6726,0xdb));var _0x6672=function(_0x56f7e2,_0x145392){_0x56f7e2=_0x56f7e2-0x0;var _0x36240b=_0x6726[_0x56f7e2];return _0x36240b;};'use strict';var client=require('../client');exports[_0x6672('0x0')]=function(_0x4672bf,_0x4ad73d){return client[_0x6672('0x1')](_0x6672('0x2'),{'body':_0x4ad73d,'options':{'where':{'id':_0x4672bf}},'log':'updateSmsInteraction'});};exports[_0x6672('0x3')]=function(_0x5bf86c,_0x32e5c6){return client[_0x6672('0x1')](_0x6672('0x4'),{'body':_0x32e5c6,'options':{'where':{'id':_0x5bf86c}},'log':_0x6672('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 3ec77b7..6c23334 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 _0x3a21=['create','Request','CreateSmsMessage','createSmsMessage'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3a21,0xcc));var _0x13a2=function(_0x4148e0,_0x1e9ceb){_0x4148e0=_0x4148e0-0x0;var _0x26af68=_0x3a21[_0x4148e0];return _0x26af68;};'use strict';var client=require('../client');exports[_0x13a2('0x0')]=function(_0x575722){return client[_0x13a2('0x1')](_0x13a2('0x2'),{'body':_0x575722,'log':_0x13a2('0x3')});}; \ No newline at end of file +var _0xe445=['createSmsMessage','../client','create','Request'];(function(_0x5e74eb,_0x40b647){var _0x3c4515=function(_0x5f2ffa){while(--_0x5f2ffa){_0x5e74eb['push'](_0x5e74eb['shift']());}};_0x3c4515(++_0x40b647);}(_0xe445,0x161));var _0x5e44=function(_0x3f465d,_0xbd2037){_0x3f465d=_0x3f465d-0x0;var _0x121ad1=_0xe445[_0x3f465d];return _0x121ad1;};'use strict';var client=require(_0x5e44('0x0'));exports[_0x5e44('0x1')]=function(_0x54d058){return client[_0x5e44('0x2')]('CreateSmsMessage',{'body':_0x54d058,'log':_0x5e44('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 8433269..75af6d6 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 _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0x23bf8e,_0x370546){var _0x506df0=function(_0x2446c5){while(--_0x2446c5){_0x23bf8e['push'](_0x23bf8e['shift']());}};_0x506df0(++_0x370546);}(_0xe706,0xa3));var _0x6e70=function(_0x1d03f1,_0x7f2edf){_0x1d03f1=_0x1d03f1-0x0;var _0x40c77e=_0xe706[_0x1d03f1];return _0x40c77e;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5')],'include':[{'model':_0x6e70('0x6'),'as':_0x6e70('0x7'),'attributes':['id',_0x6e70('0x3'),_0x6e70('0x8'),_0x6e70('0x9')]}]},'log':_0x6e70('0x1')});};}; \ No newline at end of file +var _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x4983de,_0x1b2bf7){var _0x4d2056=function(_0x12526d){while(--_0x12526d){_0x4983de['push'](_0x4983de['shift']());}};_0x4d2056(++_0x1b2bf7);}(_0x70e0,0x17b));var _0x070e=function(_0x1300f5,_0x336806){_0x1300f5=_0x1300f5-0x0;var _0xb2f5d2=_0x70e0[_0x1300f5];return _0xb2f5d2;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x070e('0x3'),_0x070e('0x4')],'include':[{'model':_0x070e('0x5'),'as':_0x070e('0x6'),'attributes':['id','name',_0x070e('0x7'),'smsPause']}]},'log':_0x070e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 8f0e212..fc1e2b6 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 _0x34e8=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0x278483,_0x14466f){var _0x415e4a=function(_0x10df12){while(--_0x10df12){_0x278483['push'](_0x278483['shift']());}};_0x415e4a(++_0x14466f);}(_0x34e8,0x12c));var _0x834e=function(_0xd17c91,_0x20f49e){_0xd17c91=_0xd17c91-0x0;var _0x5dd953=_0x34e8[_0xd17c91];return _0x5dd953;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339){return client[_0x834e('0x2')]('CreateSmsQueueReport',{'body':_0x8b339,'log':_0x834e('0x3')});};exports[_0x834e('0x4')]=function(_0x472111,_0x31bf20){return client[_0x834e('0x2')](_0x834e('0x5'),{'body':_0x31bf20,'options':{'where':{'uniqueid':_0x472111},'order':[['id',_0x834e('0x6')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file +var _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x2a6490,_0x1adf0f){var _0x1b31df=function(_0x51eeb7){while(--_0x51eeb7){_0x2a6490['push'](_0x2a6490['shift']());}};_0x1b31df(++_0x1adf0f);}(_0x008c,0x188));var _0xc008=function(_0x126f42,_0x57f1ad){_0x126f42=_0x126f42-0x0;var _0x219119=_0x008c[_0x126f42];return _0x219119;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateSmsQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 49dc21b..7621415 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(_0x39ad84,_0x58701f){var _0x2b414e=function(_0x18bd48){while(--_0x18bd48){_0x39ad84['push'](_0x39ad84['shift']());}};_0x2b414e(++_0x58701f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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(_0x4e20b4,_0x4c4246){var _0x522b13=function(_0x427cdd){while(--_0x427cdd){_0x4e20b4['push'](_0x4e20b4['shift']());}};_0x522b13(++_0x4c4246);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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 f2c929e..aacfa1e 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 _0x7923=['update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','AddTagsToWhatsappInteraction','../client'];(function(_0x416f35,_0x5bad16){var _0x21bf08=function(_0x4517cf){while(--_0x4517cf){_0x416f35['push'](_0x416f35['shift']());}};_0x21bf08(++_0x5bad16);}(_0x7923,0x8f));var _0x3792=function(_0x40881d,_0x3002bc){_0x40881d=_0x40881d-0x0;var _0x560a7a=_0x7923[_0x40881d];return _0x560a7a;};'use strict';var client=require(_0x3792('0x0'));exports[_0x3792('0x1')]=function(_0x2fb5a5,_0xdc0c64){return client[_0x3792('0x2')](_0x3792('0x3'),{'body':_0xdc0c64,'options':{'where':{'id':_0x2fb5a5}},'log':_0x3792('0x4')});};exports['addTags']=function(_0x21134d,_0x51d334){return client['Request'](_0x3792('0x5'),{'body':_0x51d334,'options':{'where':{'id':_0x21134d}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0x5f6f=['Request','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update'];(function(_0x3d79e2,_0x25bb78){var _0xd8e11c=function(_0x5321fd){while(--_0x5321fd){_0x3d79e2['push'](_0x3d79e2['shift']());}};_0xd8e11c(++_0x25bb78);}(_0x5f6f,0x1ef));var _0xf5f6=function(_0x5e7fe0,_0x48f825){_0x5e7fe0=_0x5e7fe0-0x0;var _0x4a38d6=_0x5f6f[_0x5e7fe0];return _0x4a38d6;};'use strict';var client=require(_0xf5f6('0x0'));exports[_0xf5f6('0x1')]=function(_0x32a985,_0x475063){return client[_0xf5f6('0x2')]('UpdateWhatsappInteraction',{'body':_0x475063,'options':{'where':{'id':_0x32a985}},'log':_0xf5f6('0x3')});};exports[_0xf5f6('0x4')]=function(_0x2f2e00,_0x58028b){return client[_0xf5f6('0x2')](_0xf5f6('0x5'),{'body':_0x58028b,'options':{'where':{'id':_0x2f2e00}},'log':_0xf5f6('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index a874890..8a0c7f0 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 _0xd70e=['Request','../client'];(function(_0x41e8b6,_0x306cc2){var _0x13f112=function(_0x484f85){while(--_0x484f85){_0x41e8b6['push'](_0x41e8b6['shift']());}};_0x13f112(++_0x306cc2);}(_0xd70e,0x8d));var _0xed70=function(_0x388722,_0x25f54f){_0x388722=_0x388722-0x0;var _0x310adb=_0xd70e[_0x388722];return _0x310adb;};'use strict';var client=require(_0xed70('0x0'));exports['create']=function(_0x37f47b){return client[_0xed70('0x1')]('CreateWhatsappMessage',{'body':_0x37f47b,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0xa140=['../client','create','CreateWhatsappMessage'];(function(_0x584118,_0x40c69c){var _0x4a53d9=function(_0x4504f7){while(--_0x4504f7){_0x584118['push'](_0x584118['shift']());}};_0x4a53d9(++_0x40c69c);}(_0xa140,0xf3));var _0x0a14=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xa140[_0x5f1391];return _0x50ebe3;};'use strict';var client=require(_0x0a14('0x0'));exports[_0x0a14('0x1')]=function(_0x4bb7ae){return client['Request'](_0x0a14('0x2'),{'body':_0x4bb7ae,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index c71c4a4..c44f244 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 _0x1aa9=['../client','getWhatsappQueues','GetWhatsappQueue','User','Agents','online','whatsappPause'];(function(_0xbb55ae,_0x32dfe1){var _0x5141e6=function(_0x458e38){while(--_0x458e38){_0xbb55ae['push'](_0xbb55ae['shift']());}};_0x5141e6(++_0x32dfe1);}(_0x1aa9,0xd2));var _0x91aa=function(_0xed4f9e,_0x328fce){_0xed4f9e=_0xed4f9e-0x0;var _0x3f542b=_0x1aa9[_0xed4f9e];return _0x3f542b;};'use strict';var client=require(_0x91aa('0x0'));exports[_0x91aa('0x1')]=function(){return function(){return client['Request'](_0x91aa('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout','strategy'],'include':[{'model':_0x91aa('0x3'),'as':_0x91aa('0x4'),'attributes':['id','name',_0x91aa('0x5'),_0x91aa('0x6')]}]},'log':_0x91aa('0x1')});};}; \ No newline at end of file +var _0xdf06=['Agents','online','whatsappPause','Request','GetWhatsappQueue','name','strategy','User'];(function(_0xecb86f,_0x75addc){var _0xdb9e3b=function(_0x4fb429){while(--_0x4fb429){_0xecb86f['push'](_0xecb86f['shift']());}};_0xdb9e3b(++_0x75addc);}(_0xdf06,0x183));var _0x6df0=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xdf06[_0x126558];return _0x1f6d14;};'use strict';var client=require('../client');exports['getWhatsappQueues']=function(){return function(){return client[_0x6df0('0x0')](_0x6df0('0x1'),{'options':{'raw':![],'attributes':['id',_0x6df0('0x2'),'timeout',_0x6df0('0x3')],'include':[{'model':_0x6df0('0x4'),'as':_0x6df0('0x5'),'attributes':['id',_0x6df0('0x2'),_0x6df0('0x6'),_0x6df0('0x7')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index ce588e0..bcc9d53 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 _0x9253=['Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','../client'];(function(_0xac218e,_0x4a3a42){var _0x513b6d=function(_0x9155fa){while(--_0x9155fa){_0xac218e['push'](_0xac218e['shift']());}};_0x513b6d(++_0x4a3a42);}(_0x9253,0x167));var _0x3925=function(_0x22e953,_0x10a297){_0x22e953=_0x22e953-0x0;var _0x2d4bdc=_0x9253[_0x22e953];return _0x2d4bdc;};'use strict';var client=require(_0x3925('0x0'));exports['create']=function(_0x35b010){return client[_0x3925('0x1')]('CreateWhatsappQueueReport',{'body':_0x35b010,'log':_0x3925('0x2')});};exports[_0x3925('0x3')]=function(_0x372087,_0x44b1c6){return client[_0x3925('0x1')](_0x3925('0x4'),{'body':_0x44b1c6,'options':{'where':{'uniqueid':_0x372087},'order':[['id',_0x3925('0x5')]],'limit':0x1},'log':_0x3925('0x4')});}; \ No newline at end of file +var _0x0519=['DESC','../client','create','update','Request','UpdateWhatsappQueueReport'];(function(_0x32e649,_0x228649){var _0x14d386=function(_0x3fb3ed){while(--_0x3fb3ed){_0x32e649['push'](_0x32e649['shift']());}};_0x14d386(++_0x228649);}(_0x0519,0x151));var _0x9051=function(_0x3f0b30,_0x159bc8){_0x3f0b30=_0x3f0b30-0x0;var _0x2748a5=_0x0519[_0x3f0b30];return _0x2748a5;};'use strict';var client=require(_0x9051('0x0'));exports[_0x9051('0x1')]=function(_0x532c8e){return client['Request']('CreateWhatsappQueueReport',{'body':_0x532c8e,'log':'CreateWhatsappQueueReport'});};exports[_0x9051('0x2')]=function(_0x504226,_0x10130f){return client[_0x9051('0x3')](_0x9051('0x4'),{'body':_0x10130f,'options':{'where':{'uniqueid':_0x504226},'order':[['id',_0x9051('0x5')]],'limit':0x1},'log':_0x9051('0x4')});}; \ 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 42fd9c7..a5d1c5e 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 _0x44ef=['timeout','createQueue','atimeout','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','validate','lodash','util','../../../../config/logger','./strategy','number','timeout\x20is\x20a\x20number','info','format','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','stop','find','agents'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x44ef,0xa1));var _0xf44e=function(_0x28637a,_0xcea5b6){_0x28637a=_0x28637a-0x0;var _0x34ce87=_0x44ef[_0x28637a];return _0x34ce87;};'use strict';var schema=require(_0xf44e('0x0'));var _=require(_0xf44e('0x1'));var util=require(_0xf44e('0x2'));var seqqueue=require('seq-queue');var logger=require(_0xf44e('0x3'))('routing');var strategy=require(_0xf44e('0x4'));var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xf44e('0x5'),'message':_0xf44e('0x6')}});function writeLog(_0x296e0b,_0x36b9c6,_0x16c919){return logger[_0xf44e('0x7')](util[_0xf44e('0x8')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x296e0b,_0x36b9c6['name'],_0x16c919));}function handleFindAgent(_0x147e5e){return function(_0x11a843){return _0x11a843[_0xf44e('0x9')][_0xf44e('0xa')]()===_0x147e5e['toLowerCase']();};}exports[_0xf44e('0xb')]=function(_0x305b91,_0x212422,_0x1e6ed8,_0x328a58){return function(_0xff9b8b){try{var _0x141b44={'name':_0x212422[0x0],'timeout':_0x212422[0x1]};var _0x5b1fbe=queue[_0xf44e('0x0')](_0x141b44,{'typecast':!![]});if(_0x5b1fbe[_0xf44e('0xc')]){logger[_0xf44e('0xd')](_0xf44e('0xe'),_0x305b91,_[_0xf44e('0xf')](_0x5b1fbe,'message')['join'](',\x20'));_0xff9b8b[_0xf44e('0x10')]();}else{var _0x4a29b9=_[_0xf44e('0x11')](_0x1e6ed8[_0xf44e('0x12')],handleFindAgent(_0x141b44['name']));if(_0x4a29b9){var _0x5290bd=(_0x141b44[_0xf44e('0x13')]||0xa)*0x3e8;var _0x260298,_0x4dfca8;var _0xf0f5ea=seqqueue[_0xf44e('0x14')](_0x5290bd);_0xf0f5ea['id']=_0x305b91;_0xf0f5ea[_0xf44e('0x15')]=_0x5290bd;_0xf0f5ea['channel']=_0x328a58['channel'];writeLog(_0x305b91,_0x4a29b9,util[_0xf44e('0x8')](_0xf44e('0x16'),_0x5290bd));_0x1e6ed8[_0xf44e('0x17')][_0x305b91]['on'](_0xf44e('0x18'),function(){logger[_0xf44e('0x7')](_0xf44e('0x19'),_0x305b91);clearTimeout(_0x4dfca8);_0x4dfca8=undefined;_0xf0f5ea['close']();if(_0x1e6ed8[_0xf44e('0x17')][_0x305b91]){delete _0x1e6ed8[_0xf44e('0x17')][_0x305b91];}_0xff9b8b['stop']();});_0x1e6ed8[_0xf44e('0x17')][_0x305b91]['on']('complete',function(){if(_0x1e6ed8['rules'][_0x305b91]){delete _0x1e6ed8[_0xf44e('0x17')][_0x305b91];}});_0x4dfca8=setTimeout(function(){logger[_0xf44e('0x7')]('[%s][AGENT]\x20ROUTING\x20END',_0x305b91);clearTimeout(_0x4dfca8);_0xf0f5ea['close']();_0xff9b8b['next']();},_0x5290bd);strategy[_0xf44e('0x1a')](_0xf0f5ea,_0x4a29b9,_0x1e6ed8,_0x328a58);}else{logger[_0xf44e('0xd')](_0xf44e('0x1b'),_0x305b91,_0x141b44[_0xf44e('0x9')]);_0xff9b8b[_0xf44e('0x10')]();}}}catch(_0x50b6e1){console[_0xf44e('0x1c')](_0x50b6e1);logger[_0xf44e('0xd')](_0xf44e('0x1d'),_0x305b91,_0x50b6e1['stack']);_0xff9b8b['stop']();}};}; \ No newline at end of file +var _0x5993=['[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','join','stop','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end','close','complete','[%s][AGENT]\x20ROUTING\x20END','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log'];(function(_0x1c4d9a,_0x8d14be){var _0x4a5e33=function(_0x575b6d){while(--_0x575b6d){_0x1c4d9a['push'](_0x1c4d9a['shift']());}};_0x4a5e33(++_0x8d14be);}(_0x5993,0x71));var _0x3599=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x5993[_0x4bb66f];return _0xf2772f;};'use strict';var schema=require(_0x3599('0x0'));var _=require(_0x3599('0x1'));var util=require(_0x3599('0x2'));var seqqueue=require(_0x3599('0x3'));var logger=require('../../../../config/logger')(_0x3599('0x4'));var strategy=require(_0x3599('0x5'));var queue=schema({'name':{'type':_0x3599('0x6'),'required':!![],'message':_0x3599('0x7')},'timeout':{'type':_0x3599('0x8'),'message':_0x3599('0x9')}});function writeLog(_0x3bdf83,_0x19ca80,_0x1feb17){return logger[_0x3599('0xa')](util[_0x3599('0xb')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x3bdf83,_0x19ca80[_0x3599('0xc')],_0x1feb17));}function handleFindAgent(_0x2aa7d3){return function(_0x55c170){return _0x55c170['name'][_0x3599('0xd')]()===_0x2aa7d3[_0x3599('0xd')]();};}exports[_0x3599('0xe')]=function(_0x4b710f,_0x4d5aee,_0x51bc1d,_0x4c0d58){return function(_0x4bb3bc){try{var _0x881994={'name':_0x4d5aee[0x0],'timeout':_0x4d5aee[0x1]};var _0xaf2a27=queue[_0x3599('0x0')](_0x881994,{'typecast':!![]});if(_0xaf2a27[_0x3599('0xf')]){logger[_0x3599('0x10')](_0x3599('0x11'),_0x4b710f,_[_0x3599('0x12')](_0xaf2a27,_0x3599('0x13'))[_0x3599('0x14')](',\x20'));_0x4bb3bc[_0x3599('0x15')]();}else{var _0x1111c8=_['find'](_0x51bc1d[_0x3599('0x16')],handleFindAgent(_0x881994[_0x3599('0xc')]));if(_0x1111c8){var _0x435ced=(_0x881994[_0x3599('0x17')]||0xa)*0x3e8;var _0x59b57a,_0x3e7203;var _0x4696b6=seqqueue[_0x3599('0x18')](_0x435ced);_0x4696b6['id']=_0x4b710f;_0x4696b6[_0x3599('0x19')]=_0x435ced;_0x4696b6[_0x3599('0x1a')]=_0x4c0d58[_0x3599('0x1a')];writeLog(_0x4b710f,_0x1111c8,util['format'](_0x3599('0x1b'),_0x435ced));_0x51bc1d[_0x3599('0x1c')][_0x4b710f]['on'](_0x3599('0x1d'),function(){logger[_0x3599('0xa')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x4b710f);clearTimeout(_0x3e7203);_0x3e7203=undefined;_0x4696b6[_0x3599('0x1e')]();if(_0x51bc1d[_0x3599('0x1c')][_0x4b710f]){delete _0x51bc1d['rules'][_0x4b710f];}_0x4bb3bc['stop']();});_0x51bc1d[_0x3599('0x1c')][_0x4b710f]['on'](_0x3599('0x1f'),function(){if(_0x51bc1d[_0x3599('0x1c')][_0x4b710f]){delete _0x51bc1d[_0x3599('0x1c')][_0x4b710f];}});_0x3e7203=setTimeout(function(){logger[_0x3599('0xa')](_0x3599('0x20'),_0x4b710f);clearTimeout(_0x3e7203);_0x4696b6[_0x3599('0x1e')]();_0x4bb3bc['next']();},_0x435ced);strategy['agent'](_0x4696b6,_0x1111c8,_0x51bc1d,_0x4c0d58);}else{logger[_0x3599('0x10')](_0x3599('0x21'),_0x4b710f,_0x881994['name']);_0x4bb3bc['stop']();}}}catch(_0x38fbd1){console[_0x3599('0x22')](_0x38fbd1);logger[_0x3599('0x10')](_0x3599('0x23'),_0x4b710f,_0x38fbd1[_0x3599('0x24')]);_0x4bb3bc[_0x3599('0x15')]();}};}; \ 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 0438716..4f209c9 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 _0x7775=['stop','LexRuntime','$LATEST','message','toString','amazonlex','providerName','providerResponse','stringify','Message','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','interaction','phone','chat','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','create','then','[%s][AMAZONLEX]\x20%s','catch','error','finally'];(function(_0x9a825b,_0x35c63e){var _0x4e5706=function(_0x20e4f2){while(--_0x20e4f2){_0x9a825b['push'](_0x9a825b['shift']());}};_0x4e5706(++_0x35c63e);}(_0x7775,0x171));var _0x5777=function(_0x4468a2,_0x323622){_0x4468a2=_0x4468a2-0x0;var _0x210d91=_0x7775[_0x4468a2];return _0x210d91;};'use strict';var _=require(_0x5777('0x0'));var moment=require(_0x5777('0x1'));var AWS=require(_0x5777('0x2'));var utils=require(_0x5777('0x3'));var logger=require(_0x5777('0x4'))(_0x5777('0x5'));var rpc={'chatMessage':require(_0x5777('0x6')),'openchannelMessage':require(_0x5777('0x7')),'mailMessage':require(_0x5777('0x8')),'smsMessage':require(_0x5777('0x9')),'faxMessage':require(_0x5777('0xa')),'whatsappMessage':require(_0x5777('0xb'))};exports[_0x5777('0xc')]=function(_0x308539,_0x420d8f){return function(_0x2eb567){try{if(!_['isNil'](this['interaction'][_0x5777('0xd')])){logger[_0x5777('0xe')]('[%s][AMAZONLEX]\x20%s',_0x308539,_0x5777('0xf'));return _0x2eb567[_0x5777('0x10')]();}var _0x5e8bbb={'ContactId':this[_0x5777('0x11')]['id'],'sentAt':moment()[_0x5777('0x12')](_0x5777('0x13')),'direction':_0x5777('0x14')};if(this[_0x5777('0x15')]==='sms'||this[_0x5777('0x15')]===_0x5777('0x16')){_0x5e8bbb['phone']=this[_0x5777('0x17')][_0x5777('0x18')];}var _0x4499d8=this[_0x5777('0x15')];if(_0x4499d8===_0x5777('0x19')){_0x5e8bbb['ChatWebsiteId']=this[_0x5777('0x1a')]['id'];}else{_0x5e8bbb[_[_0x5777('0x1b')](_0x4499d8)+_0x5777('0x1c')]=this[_0x5777('0x1a')]['id'];}_0x5e8bbb[_[_0x5777('0x1b')](_0x4499d8)+_0x5777('0x1d')]=this['interaction']['id'];if(this['interaction'][_0x5777('0x1e')]){var _0x184c9c=_0x420d8f[0x4];if(!_[_0x5777('0x1f')](_0x184c9c)){_0x5e8bbb[_0x5777('0x20')]=utils['getMustacheRender'](_0x184c9c,this);return rpc[_0x4499d8+'Message'][_0x5777('0x21')](_0x5e8bbb)[_0x5777('0x22')](function(_0x2e613a){logger[_0x5777('0xe')](_0x5777('0x23'),_0x308539,_0x5e8bbb[_0x5777('0x20')]);})[_0x5777('0x24')](function(_0x4c6630){logger[_0x5777('0x25')]('[%s][AMAZONLEX]\x20%s',_0x308539,JSON['stringify'](_0x4c6630));})[_0x5777('0x26')](function(){logger[_0x5777('0xe')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x308539);_0x2eb567[_0x5777('0x27')]();});}else{logger[_0x5777('0xe')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x308539);_0x2eb567['stop']();}}else{var _0x17911a=this;var _0x5d8483=new AWS[(_0x5777('0x28'))]({'accessKeyId':_0x420d8f[0x0],'secretAccessKey':_0x420d8f[0x1],'region':_0x420d8f[0x2]});var _0x16c913={'botAlias':_0x5777('0x29'),'botName':_0x420d8f[0x3],'inputText':this[_0x5777('0x2a')][_0x5777('0x20')],'userId':this[_0x5777('0x15')]+':'+this[_0x5777('0x17')]['id'][_0x5777('0x2b')]()};_0x5d8483['postText'](_0x16c913,function(_0x295a32,_0x88f9cb){if(_0x295a32){logger['error'](_0x5777('0x23'),_0x308539,_0x295a32[_0x5777('0x2a')]);_0x2eb567[_0x5777('0x10')]();}else if(_0x88f9cb&&_0x88f9cb[_0x5777('0x2a')]){_0x17911a[_0x5777('0x20')][_0x5777('0x2c')]=_0x88f9cb;_0x5e8bbb[_0x5777('0x20')]=_0x88f9cb['message'];_0x5e8bbb[_0x5777('0x2d')]=_0x5777('0x2c');_0x5e8bbb[_0x5777('0x2e')]=JSON[_0x5777('0x2f')](_0x88f9cb);return rpc[_0x4499d8+_0x5777('0x30')][_0x5777('0x21')](_0x5e8bbb)['then'](function(_0x32eb77){logger[_0x5777('0xe')](_0x5777('0x23'),_0x308539,_0x5e8bbb[_0x5777('0x20')]);if(_0x88f9cb[_0x5777('0x31')]==_0x5777('0x32')){_0x2eb567[_0x5777('0x10')]();}else{_0x2eb567['stop']();}})['catch'](function(_0x3a800c){logger[_0x5777('0x25')](_0x5777('0x23'),_0x308539,JSON[_0x5777('0x2f')](_0x3a800c));_0x2eb567[_0x5777('0x10')]();});}else{_0x2eb567[_0x5777('0x10')]();}});}}catch(_0x2ac021){logger[_0x5777('0x25')]('[%s][AMAZONLEX]\x20%s',_0x308539,JSON['stringify'](_0x2ac021));_0x2eb567['stop']();}};}; \ No newline at end of file +var _0x2c0d=['toString','postText','error','next','amazonlex','providerName','providerResponse','stringify','info','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','interaction','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','getMustacheRender','Message','create','then','body','catch','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','message'];(function(_0x593821,_0x2d316f){var _0xfa6e5=function(_0x49b546){while(--_0x49b546){_0x593821['push'](_0x593821['shift']());}};_0xfa6e5(++_0x2d316f);}(_0x2c0d,0x71));var _0xd2c0=function(_0x1fc1fa,_0x129e30){_0x1fc1fa=_0x1fc1fa-0x0;var _0xa9e74a=_0x2c0d[_0x1fc1fa];return _0xa9e74a;};'use strict';var _=require(_0xd2c0('0x0'));var moment=require(_0xd2c0('0x1'));var AWS=require(_0xd2c0('0x2'));var utils=require(_0xd2c0('0x3'));var logger=require(_0xd2c0('0x4'))(_0xd2c0('0x5'));var rpc={'chatMessage':require(_0xd2c0('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xd2c0('0x7')),'smsMessage':require(_0xd2c0('0x8')),'faxMessage':require(_0xd2c0('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xd2c0('0xa')]=function(_0x54cfbb,_0x4acde4){return function(_0x208fd9){try{if(!_['isNil'](this[_0xd2c0('0xb')][_0xd2c0('0xc')])){logger['info'](_0xd2c0('0xd'),_0x54cfbb,_0xd2c0('0xe'));return _0x208fd9['next']();}var _0x539010={'ContactId':this[_0xd2c0('0xf')]['id'],'sentAt':moment()[_0xd2c0('0x10')](_0xd2c0('0x11')),'direction':_0xd2c0('0x12')};if(this[_0xd2c0('0x13')]===_0xd2c0('0x14')||this[_0xd2c0('0x13')]==='whatsapp'){_0x539010[_0xd2c0('0x15')]=this[_0xd2c0('0xb')][_0xd2c0('0x15')];}var _0x3839fd=this['channel'];if(_0x3839fd==='chat'){_0x539010[_0xd2c0('0x16')]=this[_0xd2c0('0x17')]['id'];}else{_0x539010[_[_0xd2c0('0x18')](_0x3839fd)+_0xd2c0('0x19')]=this['account']['id'];}_0x539010[_[_0xd2c0('0x18')](_0x3839fd)+_0xd2c0('0x1a')]=this[_0xd2c0('0xb')]['id'];if(this[_0xd2c0('0xb')][_0xd2c0('0x1b')]){var _0x48159e=_0x4acde4[0x4];if(!_['isEmpty'](_0x48159e)){_0x539010['body']=utils[_0xd2c0('0x1c')](_0x48159e,this);return rpc[_0x3839fd+_0xd2c0('0x1d')][_0xd2c0('0x1e')](_0x539010)[_0xd2c0('0x1f')](function(_0xeddb3c){logger['info'](_0xd2c0('0xd'),_0x54cfbb,_0x539010[_0xd2c0('0x20')]);})[_0xd2c0('0x21')](function(_0x5d742a){logger['error'](_0xd2c0('0xd'),_0x54cfbb,JSON['stringify'](_0x5d742a));})[_0xd2c0('0x22')](function(){logger['info'](_0xd2c0('0x23'),_0x54cfbb);_0x208fd9[_0xd2c0('0x24')]();});}else{logger['info'](_0xd2c0('0x25'),_0x54cfbb);_0x208fd9[_0xd2c0('0x24')]();}}else{var _0x2f3b58=this;var _0x517dd5=new AWS['LexRuntime']({'accessKeyId':_0x4acde4[0x0],'secretAccessKey':_0x4acde4[0x1],'region':_0x4acde4[0x2]});var _0x481c56={'botAlias':_0xd2c0('0x26'),'botName':_0x4acde4[0x3],'inputText':this[_0xd2c0('0x27')]['body'],'userId':this[_0xd2c0('0x13')]+':'+this[_0xd2c0('0xb')]['id'][_0xd2c0('0x28')]()};_0x517dd5[_0xd2c0('0x29')](_0x481c56,function(_0x3f7a65,_0x2d9d34){if(_0x3f7a65){logger[_0xd2c0('0x2a')](_0xd2c0('0xd'),_0x54cfbb,_0x3f7a65[_0xd2c0('0x27')]);_0x208fd9[_0xd2c0('0x2b')]();}else if(_0x2d9d34&&_0x2d9d34['message']){_0x2f3b58[_0xd2c0('0x20')][_0xd2c0('0x2c')]=_0x2d9d34;_0x539010[_0xd2c0('0x20')]=_0x2d9d34[_0xd2c0('0x27')];_0x539010[_0xd2c0('0x2d')]=_0xd2c0('0x2c');_0x539010[_0xd2c0('0x2e')]=JSON[_0xd2c0('0x2f')](_0x2d9d34);return rpc[_0x3839fd+_0xd2c0('0x1d')][_0xd2c0('0x1e')](_0x539010)[_0xd2c0('0x1f')](function(_0x140a0a){logger[_0xd2c0('0x30')](_0xd2c0('0xd'),_0x54cfbb,_0x539010[_0xd2c0('0x20')]);if(_0x2d9d34[_0xd2c0('0x31')]==_0xd2c0('0x32')){_0x208fd9[_0xd2c0('0x2b')]();}else{_0x208fd9[_0xd2c0('0x24')]();}})['catch'](function(_0x7c5b22){logger[_0xd2c0('0x2a')]('[%s][AMAZONLEX]\x20%s',_0x54cfbb,JSON[_0xd2c0('0x2f')](_0x7c5b22));_0x208fd9[_0xd2c0('0x2b')]();});}else{_0x208fd9['next']();}});}}catch(_0x4edb83){logger[_0xd2c0('0x2a')]('[%s][AMAZONLEX]\x20%s',_0x54cfbb,JSON[_0xd2c0('0x2f')](_0x4edb83));_0x208fd9[_0xd2c0('0x24')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index d7296e1..c1d5a2d 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 _0x57fd=['upperFirst','InteractionId','Message','inReplyTo','html','replace',''+_[_0xd57f('0x2e')](_0x1022a1[_0xd57f('0x1e')],_0xd57f('0x2f'),_0xd57f('0x30'))+'';_0x1022a1['headers']={'Auto-Submitted':_0xd57f('0x31'),'X-Auto-Response-Suppress':_0xd57f('0x32'),'Precedence':_0xd57f('0x33')};return mailRpc[_0xd57f('0x34')](this[_0xd57f('0x28')][_0xd57f('0x35')],_0x1022a1)[_0xd57f('0x36')](function(_0x53861c){logger[_0xd57f('0x12')](_0xd57f('0x37'),_0x420603);_0x1022a1[_0xd57f('0x38')]=_0x53861c['message']['messageId'];return rpc[_0x363468+_0xd57f('0x2b')]['create'](_0x1022a1);})['then'](function(_0x3f2cc7){logger[_0xd57f('0x12')](_0xd57f('0x13'),_0x420603,JSON[_0xd57f('0x39')](_0x3f2cc7));})[_0xd57f('0x3a')](function(_0x2343d4){logger[_0xd57f('0x3b')](_0xd57f('0x3c'),_0x420603,JSON[_0xd57f('0x39')](_0x2343d4));})[_0xd57f('0x3d')](function(){Promise['resolve']()[_0xd57f('0x36')](function(){if(_0x149d55[0x0]!=='2'||_0x1d7f9a[_0xd57f('0x19')])return;return rpc[_0x363468+_0xd57f('0x3e')][_0xd57f('0x3f')](_0x1d7f9a['id'],{'autoreplyExecuted':!![]})['then'](function(_0x3a5ecf){logger[_0xd57f('0x12')](_0xd57f('0x1a'),_0x420603,JSON[_0xd57f('0x39')](_0x3a5ecf));})['catch'](function(_0x5f2cee){logger[_0xd57f('0x3b')](_0xd57f('0x40'),_0x420603,JSON[_0xd57f('0x39')](_0x5f2cee));});})[_0xd57f('0x36')](function(){_0x177f8f[_0xd57f('0x41')]();});});}else{return rpc[this[_0xd57f('0xf')]+_0xd57f('0x2b')][_0xd57f('0x42')](_0x1022a1)[_0xd57f('0x36')](function(){logger[_0xd57f('0x12')](_0xd57f('0x13'),_0x420603,_0x1022a1[_0xd57f('0x1e')]);})['catch'](function(_0x35f7cb){logger[_0xd57f('0x3b')](_0xd57f('0x13'),_0x420603,JSON[_0xd57f('0x39')](_0x35f7cb));})[_0xd57f('0x3d')](function(){Promise[_0xd57f('0x43')]()['then'](function(){if(_0x149d55[0x0]!=='2'||_0x1d7f9a[_0xd57f('0x19')])return;return rpc[_0x363468+_0xd57f('0x3e')][_0xd57f('0x3f')](_0x1d7f9a['id'],{'autoreplyExecuted':!![]})['then'](function(_0x22584a){logger[_0xd57f('0x12')](_0xd57f('0x1a'),_0x420603,JSON[_0xd57f('0x39')](_0x22584a));})[_0xd57f('0x3a')](function(_0x32e918){logger[_0xd57f('0x3b')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x420603,JSON['stringify'](_0x32e918));});})['then'](function(){_0x177f8f[_0xd57f('0x41')]();});});}}}catch(_0x2abace){logger[_0xd57f('0x3b')](_0xd57f('0x13'),_0x420603,JSON[_0xd57f('0x39')](_0x2abace));_0x177f8f[_0xd57f('0x44')]();}};}; \ No newline at end of file +var _0x0e14=['Interaction','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','body','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','interaction','created','Autoreply\x20already\x20sent','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','YYYY-MM-DD\x20HH:mm:ss','getMustacheRender','message','from','phone','read','subject','Re:','Re:\x20','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','Message','mail','inReplyTo','messageId','html','','replace','','headers','auto-replied','All','auto_reply','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','create','autoreplyExecuted'];(function(_0x2b1361,_0x44569c){var _0x170c23=function(_0x518d65){while(--_0x518d65){_0x2b1361['push'](_0x2b1361['shift']());}};_0x170c23(++_0x44569c);}(_0x0e14,0x16f));var _0x40e1=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x0e14[_0x4ea69d];return _0x5318e0;};'use strict';var _=require(_0x40e1('0x0'));var moment=require(_0x40e1('0x1'));var utils=require(_0x40e1('0x2'));var logger=require(_0x40e1('0x3'))(_0x40e1('0x4'));var rpc={'chatMessage':require(_0x40e1('0x5')),'openchannelMessage':require(_0x40e1('0x6')),'mailMessage':require(_0x40e1('0x7')),'smsMessage':require(_0x40e1('0x8')),'faxMessage':require(_0x40e1('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x40e1('0xa')),'openchannelInteraction':require(_0x40e1('0xb')),'mailInteraction':require(_0x40e1('0xc')),'smsInteraction':require(_0x40e1('0xd')),'faxInteraction':require(_0x40e1('0xe')),'whatsappInteraction':require(_0x40e1('0xf'))};var mailRpc=require(_0x40e1('0x10'));exports[_0x40e1('0x11')]=function(_0x90ef6e,_0x50be69,_0x368f95,_0x528009){return function(_0x258ab4){try{var _0x59acd4=this[_0x40e1('0x12')];if(_0x59acd4==='mail'&&_0x528009[_0x40e1('0x13')]['isAutoreply']){logger[_0x40e1('0x14')](_0x40e1('0x15'),_0x90ef6e,_0x40e1('0x16'));return _0x258ab4[_0x40e1('0x17')]();}if(_0x50be69[0x0]==='1'&&(_['isNil'](this[_0x40e1('0x18')][_0x40e1('0x19')])||!this[_0x40e1('0x18')][_0x40e1('0x19')])){logger[_0x40e1('0x14')]('[%s][AUTOREPLY]\x20%s',_0x90ef6e,_0x40e1('0x1a'));return _0x258ab4['next']();}if(_0x50be69[0x0]==='2'&&this[_0x40e1('0x18')]['autoreplyExecuted']){logger['info'](_0x40e1('0x1b'),_0x90ef6e,_0x40e1('0x1c'));return _0x258ab4['next']();}var _0x5588d9={'ContactId':this[_0x40e1('0x1d')]['id'],'sentAt':moment()['format'](_0x40e1('0x1e')),'direction':'out'};if(this[_0x40e1('0x12')]==='mail'){_0x5588d9[_0x40e1('0x13')]=utils[_0x40e1('0x1f')](_0x50be69[0x2],this);}else{_0x5588d9[_0x40e1('0x13')]=utils[_0x40e1('0x1f')](_0x50be69[0x1],this);}if(this[_0x40e1('0x20')]){_0x5588d9['to']=this[_0x40e1('0x20')]['from']||'';if(this['channel']==='mail'&&_0x50be69[0x1]==='1'){_0x5588d9['cc']=this['message']['cc']||'';}_0x5588d9[_0x40e1('0x21')]=this[_0x40e1('0x20')]['to']||'';_0x5588d9[_0x40e1('0x22')]=this[_0x40e1('0x20')][_0x40e1('0x22')]||'';_0x5588d9[_0x40e1('0x23')]=!![];if(this[_0x40e1('0x20')][_0x40e1('0x24')]){_0x5588d9['subject']='';_0x5588d9[_0x40e1('0x24')]+=_['startsWith'](this[_0x40e1('0x20')][_0x40e1('0x24')],_0x40e1('0x25'))?'':_0x40e1('0x26');_0x5588d9['subject']+=this[_0x40e1('0x20')][_0x40e1('0x24')];}}if(this[_0x40e1('0x12')]===_0x40e1('0x27')){_0x5588d9[_0x40e1('0x28')]=this[_0x40e1('0x29')]['id'];}else{_0x5588d9[_['upperFirst'](this[_0x40e1('0x12')])+_0x40e1('0x2a')]=this[_0x40e1('0x29')]['id'];}_0x5588d9[_[_0x40e1('0x2b')](this[_0x40e1('0x12')])+_0x40e1('0x2c')]=this['interaction']['id'];var _0x55eb56=this[_0x40e1('0x18')];if(rpc[this[_0x40e1('0x12')]+_0x40e1('0x2d')]){if(this[_0x40e1('0x12')]===_0x40e1('0x2e')){_0x5588d9[_0x40e1('0x2f')]=this[_0x40e1('0x20')][_0x40e1('0x30')];_0x5588d9[_0x40e1('0x31')]=_0x40e1('0x32')+_[_0x40e1('0x33')](_0x5588d9[_0x40e1('0x13')],_0x40e1('0x34'),_0x40e1('0x35'))+_0x40e1('0x36');_0x5588d9[_0x40e1('0x37')]={'Auto-Submitted':_0x40e1('0x38'),'X-Auto-Response-Suppress':_0x40e1('0x39'),'Precedence':_0x40e1('0x3a')};return mailRpc['sendMailMessage'](this[_0x40e1('0x29')]['smtpOptions'],_0x5588d9)[_0x40e1('0x3b')](function(_0x105852){logger[_0x40e1('0x14')](_0x40e1('0x3c'),_0x90ef6e);_0x5588d9[_0x40e1('0x30')]=_0x105852[_0x40e1('0x20')][_0x40e1('0x30')];return rpc[_0x59acd4+'Message']['create'](_0x5588d9);})[_0x40e1('0x3b')](function(_0x117eb0){logger[_0x40e1('0x14')](_0x40e1('0x15'),_0x90ef6e,JSON[_0x40e1('0x3d')](_0x117eb0));})[_0x40e1('0x3e')](function(_0x58053a){logger[_0x40e1('0x3f')](_0x40e1('0x40'),_0x90ef6e,JSON['stringify'](_0x58053a));})[_0x40e1('0x41')](function(){Promise[_0x40e1('0x42')]()[_0x40e1('0x3b')](function(){if(_0x50be69[0x0]!=='2'||_0x55eb56['autoreplyExecuted'])return;return rpc[_0x59acd4+'Interaction'][_0x40e1('0x43')](_0x55eb56['id'],{'autoreplyExecuted':!![]})[_0x40e1('0x3b')](function(_0x579d75){logger['info'](_0x40e1('0x1b'),_0x90ef6e,JSON[_0x40e1('0x3d')](_0x579d75));})[_0x40e1('0x3e')](function(_0x3716dd){logger[_0x40e1('0x3f')](_0x40e1('0x44'),_0x90ef6e,JSON[_0x40e1('0x3d')](_0x3716dd));});})[_0x40e1('0x3b')](function(){_0x258ab4[_0x40e1('0x17')]();});});}else{return rpc[this['channel']+'Message'][_0x40e1('0x45')](_0x5588d9)[_0x40e1('0x3b')](function(){logger[_0x40e1('0x14')](_0x40e1('0x15'),_0x90ef6e,_0x5588d9['body']);})[_0x40e1('0x3e')](function(_0x13519f){logger[_0x40e1('0x3f')]('[%s][AUTOREPLY]\x20%s',_0x90ef6e,JSON[_0x40e1('0x3d')](_0x13519f));})[_0x40e1('0x41')](function(){Promise['resolve']()[_0x40e1('0x3b')](function(){if(_0x50be69[0x0]!=='2'||_0x55eb56[_0x40e1('0x46')])return;return rpc[_0x59acd4+_0x40e1('0x47')][_0x40e1('0x43')](_0x55eb56['id'],{'autoreplyExecuted':!![]})[_0x40e1('0x3b')](function(_0x404846){logger[_0x40e1('0x14')](_0x40e1('0x1b'),_0x90ef6e,JSON['stringify'](_0x404846));})[_0x40e1('0x3e')](function(_0x42b70d){logger[_0x40e1('0x3f')](_0x40e1('0x44'),_0x90ef6e,JSON[_0x40e1('0x3d')](_0x42b70d));});})[_0x40e1('0x3b')](function(){_0x258ab4['next']();});});}}}catch(_0x369078){logger[_0x40e1('0x3f')](_0x40e1('0x15'),_0x90ef6e,JSON[_0x40e1('0x3d')](_0x369078));_0x258ab4[_0x40e1('0x48')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index e5d0921..0e76ecc 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x68f1=['then','catch','stringify','finally','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','consequence','info','format','system','channel','Interaction','update'];(function(_0x23c56e,_0x42463c){var _0x5b1ac5=function(_0x57b05b){while(--_0x57b05b){_0x23c56e['push'](_0x23c56e['shift']());}};_0x5b1ac5(++_0x42463c);}(_0x68f1,0x1e0));var _0x168f=function(_0x336595,_0x3f900f){_0x336595=_0x336595-0x0;var _0x337f47=_0x68f1[_0x336595];return _0x337f47;};'use strict';var moment=require(_0x168f('0x0'));var logger=require(_0x168f('0x1'))(_0x168f('0x2'));var rpc={'chatInteraction':require(_0x168f('0x3')),'openchannelInteraction':require(_0x168f('0x4')),'smsInteraction':require(_0x168f('0x5')),'mailInteraction':require(_0x168f('0x6')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0x168f('0x7')]=function(_0x524b69,_0x27df0f,_0x1191df,_0x79ffcd){return function(_0xb4500){try{logger[_0x168f('0x8')]('[%s][CLOSE]\x20reason\x20%s',_0x524b69,_0x27df0f[0x0]);var _0x45830f={'closed':0x1,'closedAt':moment()[_0x168f('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0x168f('0xa'),'disposition':_0x27df0f[0x0]};if(rpc[_0x79ffcd[_0x168f('0xb')]+'Interaction']){rpc[_0x79ffcd[_0x168f('0xb')]+_0x168f('0xc')][_0x168f('0xd')](_0x79ffcd['interaction']['id'],_0x45830f)[_0x168f('0xe')](function(_0x36270c){logger[_0x168f('0x8')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x524b69,_0x79ffcd['interaction']['id']);})[_0x168f('0xf')](function(_0x4505e2){logger['error']('[%s][CLOSE]\x20%s',_0x524b69,JSON[_0x168f('0x10')](_0x4505e2));})[_0x168f('0x11')](function(){_0xb4500['stop']();});}}catch(_0x4a9465){logger['error']('[%s][CLOSE]\x20%s',_0x524b69,JSON[_0x168f('0x10')](_0x4a9465));_0xb4500[_0x168f('0x12')]();}};}; \ No newline at end of file +var _0xcd33=['../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','finally','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction'];(function(_0x5e087c,_0x31fc63){var _0xa3285e=function(_0x24b85c){while(--_0x24b85c){_0x5e087c['push'](_0x5e087c['shift']());}};_0xa3285e(++_0x31fc63);}(_0xcd33,0x12e));var _0x3cd3=function(_0x549f2a,_0xd33734){_0x549f2a=_0x549f2a-0x0;var _0x3331e4=_0xcd33[_0x549f2a];return _0x3331e4;};'use strict';var moment=require('moment');var logger=require('../../../../config/logger')(_0x3cd3('0x0'));var rpc={'chatInteraction':require(_0x3cd3('0x1')),'openchannelInteraction':require(_0x3cd3('0x2')),'smsInteraction':require(_0x3cd3('0x3')),'mailInteraction':require(_0x3cd3('0x4')),'faxInteraction':require(_0x3cd3('0x5')),'whatsappInteraction':require(_0x3cd3('0x6'))};exports[_0x3cd3('0x7')]=function(_0x56ea43,_0x5ce288,_0x189a1e,_0x3521cd){return function(_0x450e36){try{logger[_0x3cd3('0x8')](_0x3cd3('0x9'),_0x56ea43,_0x5ce288[0x0]);var _0x3036f1={'closed':0x1,'closedAt':moment()[_0x3cd3('0xa')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':'system','disposition':_0x5ce288[0x0]};if(rpc[_0x3521cd['channel']+'Interaction']){rpc[_0x3521cd[_0x3cd3('0xb')]+_0x3cd3('0xc')][_0x3cd3('0xd')](_0x3521cd[_0x3cd3('0xe')]['id'],_0x3036f1)[_0x3cd3('0xf')](function(_0x179d39){logger['info'](_0x3cd3('0x10'),_0x56ea43,_0x3521cd[_0x3cd3('0xe')]['id']);})[_0x3cd3('0x11')](function(_0x362e58){logger[_0x3cd3('0x12')](_0x3cd3('0x13'),_0x56ea43,JSON[_0x3cd3('0x14')](_0x362e58));})[_0x3cd3('0x15')](function(){_0x450e36['stop']();});}}catch(_0x440453){logger['error'](_0x3cd3('0x13'),_0x56ea43,JSON[_0x3cd3('0x14')](_0x440453));_0x450e36['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 57f9321..d3a3dc1 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x804d=['whatsapp','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','create','then','[%s][DIALOGFLOW]\x20%s','body','catch','error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','result','fulfillment','speech','dialogflow','providerResponse','Message','endConversation','stringify','message','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','out','channel'];(function(_0x3bdbe3,_0x58067f){var _0x332b21=function(_0x39f1bd){while(--_0x39f1bd){_0x3bdbe3['push'](_0x3bdbe3['shift']());}};_0x332b21(++_0x58067f);}(_0x804d,0x116));var _0xd804=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0x804d[_0x54d4a8];return _0x3b321b;};'use strict';var _=require(_0xd804('0x0'));var moment=require(_0xd804('0x1'));var apiai=require(_0xd804('0x2'));var md5=require(_0xd804('0x3'));var utils=require(_0xd804('0x4'));var logger=require(_0xd804('0x5'))(_0xd804('0x6'));var rpc={'chatMessage':require(_0xd804('0x7')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xd804('0x8')),'smsMessage':require(_0xd804('0x9')),'faxMessage':require(_0xd804('0xa')),'whatsappMessage':require(_0xd804('0xb'))};exports[_0xd804('0xc')]=function(_0xf52871,_0x465695){return function(_0x391e2b){try{if(!_[_0xd804('0xd')](this[_0xd804('0xe')][_0xd804('0xf')])){logger[_0xd804('0x10')]('[%s][DIALOGFLOW]\x20%s',_0xf52871,_0xd804('0x11'));return _0x391e2b[_0xd804('0x12')]();}var _0x46730f={'ContactId':this[_0xd804('0x13')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xd804('0x14')};if(this[_0xd804('0x15')]==='sms'||this[_0xd804('0x15')]===_0xd804('0x16')){_0x46730f['phone']=this[_0xd804('0xe')][_0xd804('0x17')];}var _0xce756=this['channel'];if(_0xce756==='chat'){_0x46730f[_0xd804('0x18')]=this[_0xd804('0x19')]['id'];}else{_0x46730f[_[_0xd804('0x1a')](_0xce756)+_0xd804('0x1b')]=this[_0xd804('0x19')]['id'];}_0x46730f[_['upperFirst'](_0xce756)+_0xd804('0x1c')]=this[_0xd804('0xe')]['id'];if(this['interaction'][_0xd804('0x1d')]){var _0x1a10c7=_0x465695[0x2];if(!_[_0xd804('0x1e')](_0x1a10c7)){_0x46730f['body']=utils[_0xd804('0x1f')](_0x1a10c7,this);return rpc[_0xce756+'Message'][_0xd804('0x20')](_0x46730f)[_0xd804('0x21')](function(_0x13fa46){logger['info'](_0xd804('0x22'),_0xf52871,_0x46730f[_0xd804('0x23')]);})[_0xd804('0x24')](function(_0x2d881a){logger[_0xd804('0x25')]('[%s][DIALOGFLOW]\x20%s',_0xf52871,JSON['stringify'](_0x2d881a));})[_0xd804('0x26')](function(){logger['info'](_0xd804('0x27'),_0xf52871);_0x391e2b[_0xd804('0x28')]();});}else{logger[_0xd804('0x10')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0xf52871);_0x391e2b[_0xd804('0x28')]();}}else{var _0x5dd939=this;var _0x18d28c=apiai(_0x465695[0x0],{'language':_0x465695[0x1]||'en'});return _0x18d28c['textRequest'](this['message']['body'],{'sessionId':md5(this['interaction']['id'])})[_0xd804('0x21')](function(_0x2fc18b){_0x5dd939[_0xd804('0x23')]['dialogflow']=_0x2fc18b;_0x46730f[_0xd804('0x23')]=_0x2fc18b[_0xd804('0x29')][_0xd804('0x2a')][_0xd804('0x2b')];_0x46730f['providerName']=_0xd804('0x2c');_0x46730f[_0xd804('0x2d')]=JSON['stringify'](_0x2fc18b);return rpc[_0xce756+_0xd804('0x2e')][_0xd804('0x20')](_0x46730f)['then'](function(_0x5287eb){logger['info'](_0xd804('0x22'),_0xf52871,_0x46730f[_0xd804('0x23')]);if(_0x2fc18b[_0xd804('0x29')]['metadata'][_0xd804('0x2f')]){_0x391e2b[_0xd804('0x12')]();}else{_0x391e2b[_0xd804('0x28')]();}})[_0xd804('0x24')](function(_0x473588){logger[_0xd804('0x25')](_0xd804('0x22'),_0xf52871,JSON[_0xd804('0x30')](_0x473588));_0x391e2b['next']();});})[_0xd804('0x24')](function(_0x251e5e){logger[_0xd804('0x25')](_0xd804('0x22'),_0xf52871,_0x251e5e[_0xd804('0x31')]);_0x391e2b[_0xd804('0x12')]();});}}catch(_0x3aefde){logger[_0xd804('0x25')](_0xd804('0x22'),_0xf52871,JSON[_0xd804('0x30')](_0x3aefde));_0x391e2b['stop']();}};}; \ No newline at end of file +var _0xbecd=['result','fulfillment','speech','providerName','providerResponse','stringify','metadata','next','lodash','apiai-promise','md5','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','[%s][DIALOGFLOW]\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','ChatWebsiteId','account','AccountId','upperFirst','isEmpty','body','getMustacheRender','Message','create','then','info','catch','error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','message','dialogflow'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xbecd,0x6a));var _0xdbec=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbecd[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xdbec('0x0'));var moment=require('moment');var apiai=require(_0xdbec('0x1'));var md5=require(_0xdbec('0x2'));var utils=require('./utils');var logger=require(_0xdbec('0x3'))(_0xdbec('0x4'));var rpc={'chatMessage':require(_0xdbec('0x5')),'openchannelMessage':require(_0xdbec('0x6')),'mailMessage':require(_0xdbec('0x7')),'smsMessage':require(_0xdbec('0x8')),'faxMessage':require(_0xdbec('0x9')),'whatsappMessage':require(_0xdbec('0xa'))};exports[_0xdbec('0xb')]=function(_0x38cac4,_0x13dfff){return function(_0x380bf8){try{if(!_[_0xdbec('0xc')](this[_0xdbec('0xd')][_0xdbec('0xe')])){logger['info'](_0xdbec('0xf'),_0x38cac4,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x380bf8['next']();}var _0x57013c={'ContactId':this['contact']['id'],'sentAt':moment()[_0xdbec('0x10')](_0xdbec('0x11')),'direction':'out'};if(this[_0xdbec('0x12')]===_0xdbec('0x13')||this[_0xdbec('0x12')]===_0xdbec('0x14')){_0x57013c[_0xdbec('0x15')]=this[_0xdbec('0xd')]['phone'];}var _0x277db6=this[_0xdbec('0x12')];if(_0x277db6==='chat'){_0x57013c[_0xdbec('0x16')]=this[_0xdbec('0x17')]['id'];}else{_0x57013c[_['upperFirst'](_0x277db6)+_0xdbec('0x18')]=this['account']['id'];}_0x57013c[_[_0xdbec('0x19')](_0x277db6)+'InteractionId']=this[_0xdbec('0xd')]['id'];if(this['interaction']['created']){var _0x30b6e2=_0x13dfff[0x2];if(!_[_0xdbec('0x1a')](_0x30b6e2)){_0x57013c[_0xdbec('0x1b')]=utils[_0xdbec('0x1c')](_0x30b6e2,this);return rpc[_0x277db6+_0xdbec('0x1d')][_0xdbec('0x1e')](_0x57013c)[_0xdbec('0x1f')](function(_0x5d9ed5){logger[_0xdbec('0x20')](_0xdbec('0xf'),_0x38cac4,_0x57013c[_0xdbec('0x1b')]);})[_0xdbec('0x21')](function(_0x3a0801){logger[_0xdbec('0x22')](_0xdbec('0xf'),_0x38cac4,JSON['stringify'](_0x3a0801));})[_0xdbec('0x23')](function(){logger[_0xdbec('0x20')](_0xdbec('0x24'),_0x38cac4);_0x380bf8['stop']();});}else{logger[_0xdbec('0x20')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x38cac4);_0x380bf8[_0xdbec('0x25')]();}}else{var _0x3c2769=this;var _0x3c81b3=apiai(_0x13dfff[0x0],{'language':_0x13dfff[0x1]||'en'});return _0x3c81b3[_0xdbec('0x26')](this[_0xdbec('0x27')][_0xdbec('0x1b')],{'sessionId':md5(this[_0xdbec('0xd')]['id'])})[_0xdbec('0x1f')](function(_0x25e37e){_0x3c2769[_0xdbec('0x1b')][_0xdbec('0x28')]=_0x25e37e;_0x57013c[_0xdbec('0x1b')]=_0x25e37e[_0xdbec('0x29')][_0xdbec('0x2a')][_0xdbec('0x2b')];_0x57013c[_0xdbec('0x2c')]=_0xdbec('0x28');_0x57013c[_0xdbec('0x2d')]=JSON[_0xdbec('0x2e')](_0x25e37e);return rpc[_0x277db6+_0xdbec('0x1d')][_0xdbec('0x1e')](_0x57013c)['then'](function(_0x11c1ce){logger[_0xdbec('0x20')](_0xdbec('0xf'),_0x38cac4,_0x57013c[_0xdbec('0x1b')]);if(_0x25e37e[_0xdbec('0x29')][_0xdbec('0x2f')]['endConversation']){_0x380bf8[_0xdbec('0x30')]();}else{_0x380bf8[_0xdbec('0x25')]();}})[_0xdbec('0x21')](function(_0x497c62){logger[_0xdbec('0x22')]('[%s][DIALOGFLOW]\x20%s',_0x38cac4,JSON[_0xdbec('0x2e')](_0x497c62));_0x380bf8['next']();});})[_0xdbec('0x21')](function(_0x4f73be){logger[_0xdbec('0x22')](_0xdbec('0xf'),_0x38cac4,_0x4f73be[_0xdbec('0x27')]);_0x380bf8['next']();});}}catch(_0x5591cf){logger[_0xdbec('0x22')](_0xdbec('0xf'),_0x38cac4,JSON['stringify'](_0x5591cf));_0x380bf8[_0xdbec('0x25')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 6cd7c44..19ed141 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc3ce=['next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','isEmpty','getMustacheRender','then','finally','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','DIALOGFLOWV2_ACTION','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','boolValue','DIALOGFLOWV2_INTENTNAME','intent','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','push','all','lodash','dialogflow','moment','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','Message','create','info','[%s][DIALOGFLOWV2]\x20%s','body','catch','error','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.'];(function(_0x44a8e2,_0x4f2e73){var _0x1c2cab=function(_0x33e777){while(--_0x33e777){_0x44a8e2['push'](_0x44a8e2['shift']());}};_0x1c2cab(++_0x4f2e73);}(_0xc3ce,0x1e6));var _0xec3c=function(_0x19c475,_0x14f114){_0x19c475=_0x19c475-0x0;var _0x1f47d0=_0xc3ce[_0x19c475];return _0x1f47d0;};'use strict';var _=require(_0xec3c('0x0'));var dialogflow=require(_0xec3c('0x1'));var md5=require('md5');var moment=require(_0xec3c('0x2'));var Promise=require('bluebird');var logger=require('../../../../config/logger')(_0xec3c('0x3'));var utils=require(_0xec3c('0x4'));var rpc={'chatMessage':require(_0xec3c('0x5')),'openchannelMessage':require(_0xec3c('0x6')),'mailMessage':require(_0xec3c('0x7')),'smsMessage':require(_0xec3c('0x8')),'faxMessage':require(_0xec3c('0x9')),'whatsappMessage':require(_0xec3c('0xa'))};function createMessage(_0x2909f0,_0x597daf,_0xc0252d,_0x39be9b){return new Promise(function(_0x5ac262,_0x453bc3){var _0x3887e5=_[_0xec3c('0xb')](_0xc0252d);_0x3887e5['body']=_0x39be9b;return rpc[_0x597daf+_0xec3c('0xc')][_0xec3c('0xd')](_0x3887e5)['then'](function(){logger[_0xec3c('0xe')](_0xec3c('0xf'),_0x2909f0,_0x3887e5[_0xec3c('0x10')]);_0x5ac262();})[_0xec3c('0x11')](function(_0x5c0682){logger[_0xec3c('0x12')](_0xec3c('0xf'),_0x2909f0,JSON[_0xec3c('0x13')](_0x5c0682));_0x453bc3(_0x5c0682);});});}exports[_0xec3c('0x14')]=function(_0x27c1e8,_0x53cd61){return function(_0x2bf0f7){try{if(!_[_0xec3c('0x15')](this[_0xec3c('0x16')][_0xec3c('0x17')])){logger[_0xec3c('0xe')](_0xec3c('0xf'),_0x27c1e8,_0xec3c('0x18'));return _0x2bf0f7[_0xec3c('0x19')]();}var _0x3b5b72={'ContactId':this[_0xec3c('0x1a')]['id'],'sentAt':moment()['format'](_0xec3c('0x1b')),'direction':_0xec3c('0x1c')};if(this['channel']==='sms'||this[_0xec3c('0x1d')]===_0xec3c('0x1e')){_0x3b5b72[_0xec3c('0x1f')]=this[_0xec3c('0x16')][_0xec3c('0x1f')];}var _0x553582=this[_0xec3c('0x1d')];if(_0x553582==='chat'){_0x3b5b72[_0xec3c('0x20')]=this['account']['id'];}else{_0x3b5b72[_[_0xec3c('0x21')](_0x553582)+_0xec3c('0x22')]=this[_0xec3c('0x23')]['id'];}_0x3b5b72[_[_0xec3c('0x21')](_0x553582)+_0xec3c('0x24')]=this['interaction']['id'];if(this['interaction'][_0xec3c('0x25')]){var _0x5a4bf2=_0x53cd61[0x4];if(!_[_0xec3c('0x26')](_0x5a4bf2)){_0x3b5b72['body']=utils[_0xec3c('0x27')](_0x5a4bf2,this);return rpc[_0x553582+_0xec3c('0xc')][_0xec3c('0xd')](_0x3b5b72)[_0xec3c('0x28')](function(_0x12e367){logger[_0xec3c('0xe')]('[%s][DIALOGFLOWV2]\x20%s',_0x27c1e8,_0x3b5b72[_0xec3c('0x10')]);})['catch'](function(_0x2bde1a){logger[_0xec3c('0x12')]('[%s][DIALOGFLOWV2]\x20%s',_0x27c1e8,JSON[_0xec3c('0x13')](_0x2bde1a));})[_0xec3c('0x29')](function(){logger[_0xec3c('0xe')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x27c1e8);_0x2bf0f7[_0xec3c('0x2a')]();});}else{logger[_0xec3c('0xe')](_0xec3c('0x2b'),_0x27c1e8);_0x2bf0f7[_0xec3c('0x2a')]();}}else{var _0x3ab1b9=this;var _0x57dce5=_0x53cd61[0x2][_0xec3c('0x2c')](/\\n/g,'\x0a');var _0x59e40d={'credentials':{'private_key':_0x57dce5,'client_email':_0x53cd61[0x1]}};var _0x47b686=new dialogflow[(_0xec3c('0x2d'))](_0x59e40d);var _0x330735=_0x47b686[_0xec3c('0x2e')](_0x53cd61[0x0],md5(_0x3ab1b9[_0xec3c('0x16')]['id']));var _0x1c2179={'session':_0x330735,'queryInput':{'text':{'text':_0x3ab1b9[_0xec3c('0x2f')][_0xec3c('0x10')],'languageCode':_0x53cd61[0x3]||'en'}}};return _0x47b686[_0xec3c('0x30')](_0x1c2179)[_0xec3c('0x28')](function(_0x1c74f1){if(_0x1c74f1&&_0x1c74f1[_0xec3c('0x31')]){_0x3ab1b9[_0xec3c('0x10')][_0xec3c('0x32')]=_0x1c74f1;var _0x4b58b7=_0x1c74f1[0x0];var _0x45c919=_0x4b58b7['queryResult']['diagnosticInfo']&&_0x4b58b7[_0xec3c('0x33')][_0xec3c('0x34')][_0xec3c('0x35')]?_0x4b58b7['queryResult']['diagnosticInfo'][_0xec3c('0x35')][_0xec3c('0x36')]['boolValue']:![];_0x3ab1b9[_0xec3c('0x10')][_0xec3c('0x37')]=_0x4b58b7['queryResult']['action'];_0x3ab1b9['body'][_0xec3c('0x38')]=_0x4b58b7[_0xec3c('0x33')][_0xec3c('0x39')];_0x3ab1b9['body']['DIALOGFLOWV2_ENDCONVERSATION']=_0x4b58b7[_0xec3c('0x33')]['diagnosticInfo']&&_0x4b58b7['queryResult'][_0xec3c('0x34')]['fields']?_0x4b58b7[_0xec3c('0x33')][_0xec3c('0x34')]['fields'][_0xec3c('0x36')][_0xec3c('0x3a')]:![];_0x3ab1b9[_0xec3c('0x10')][_0xec3c('0x3b')]=_0x4b58b7[_0xec3c('0x33')][_0xec3c('0x3c')]['name'];_0x3ab1b9[_0xec3c('0x10')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x4b58b7['queryResult']['intent']['displayName'];_0x3ab1b9['body'][_0xec3c('0x3d')]=_0x4b58b7[_0xec3c('0x33')][_0xec3c('0x3c')][_0xec3c('0x3e')];_0x3ab1b9[_0xec3c('0x10')][_0xec3c('0x3f')]=_0x4b58b7[_0xec3c('0x33')]['languageCode'];_0x3ab1b9[_0xec3c('0x10')][_0xec3c('0x40')]=_0x4b58b7['queryResult'][_0xec3c('0x41')];_0x3ab1b9['body'][_0xec3c('0x42')]=_0x4b58b7[_0xec3c('0x33')][_0xec3c('0x43')];_0x3b5b72[_0xec3c('0x44')]=_0xec3c('0x32');_0x3b5b72[_0xec3c('0x45')]=JSON[_0xec3c('0x13')](_0x1c74f1);var _0x391faf=[];for(var _0x48ac38=0x0;_0x48ac38<_0x1c74f1[_0xec3c('0x31')];_0x48ac38++){var _0x524e8a=_0x1c74f1[_0x48ac38];if(_0x524e8a&&_0x524e8a[_0xec3c('0x33')]&&_0x524e8a[_0xec3c('0x33')][_0xec3c('0x46')]){_0x391faf[_0xec3c('0x47')](createMessage(_0x27c1e8,_0x553582,_0x3b5b72,_0x524e8a[_0xec3c('0x33')][_0xec3c('0x46')]));}}return Promise[_0xec3c('0x48')](_0x391faf)[_0xec3c('0x28')](function(){if(_0x45c919){_0x2bf0f7[_0xec3c('0x19')]();}else{_0x2bf0f7[_0xec3c('0x2a')]();}})[_0xec3c('0x11')](function(_0x5cfed8){logger[_0xec3c('0x12')]('[%s][DIALOGFLOWV2]\x20%s',_0x27c1e8,JSON['stringify'](_0x5cfed8));_0x2bf0f7['next']();});}})['catch'](function(_0x223070){logger[_0xec3c('0x12')](_0xec3c('0xf'),_0x27c1e8,_0x223070['message']);_0x2bf0f7['next']();});}}catch(_0x592630){logger[_0xec3c('0x12')](_0xec3c('0xf'),_0x27c1e8,JSON[_0xec3c('0x13')](_0x592630));_0x2bf0f7[_0xec3c('0x2a')]();}};}; \ No newline at end of file +var _0x638e=['length','dialogflowV2','queryResult','diagnosticInfo','fields','boolValue','DIALOGFLOWV2_ACTION','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','end_conversation','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','push','all','catch','lodash','bluebird','../../../../config/logger','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','then','[%s][DIALOGFLOWV2]\x20%s','error','stringify','consequence','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','interaction','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','info','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','sessionPath','message','detectIntent'];(function(_0x1621cf,_0x51199e){var _0x425cd9=function(_0x1a44b9){while(--_0x1a44b9){_0x1621cf['push'](_0x1621cf['shift']());}};_0x425cd9(++_0x51199e);}(_0x638e,0xf3));var _0xe638=function(_0x2cb08e,_0x48f58a){_0x2cb08e=_0x2cb08e-0x0;var _0x3b5f48=_0x638e[_0x2cb08e];return _0x3b5f48;};'use strict';var _=require(_0xe638('0x0'));var dialogflow=require('dialogflow');var md5=require('md5');var moment=require('moment');var Promise=require(_0xe638('0x1'));var logger=require(_0xe638('0x2'))('routing');var utils=require(_0xe638('0x3'));var rpc={'chatMessage':require(_0xe638('0x4')),'openchannelMessage':require(_0xe638('0x5')),'mailMessage':require(_0xe638('0x6')),'smsMessage':require(_0xe638('0x7')),'faxMessage':require(_0xe638('0x8')),'whatsappMessage':require(_0xe638('0x9'))};function createMessage(_0x57e91e,_0x48ca2c,_0x1b9da6,_0x56788b){return new Promise(function(_0x499907,_0x1f96a7){var _0x210477=_[_0xe638('0xa')](_0x1b9da6);_0x210477[_0xe638('0xb')]=_0x56788b;return rpc[_0x48ca2c+_0xe638('0xc')][_0xe638('0xd')](_0x210477)[_0xe638('0xe')](function(){logger['info'](_0xe638('0xf'),_0x57e91e,_0x210477[_0xe638('0xb')]);_0x499907();})['catch'](function(_0x276c5e){logger[_0xe638('0x10')](_0xe638('0xf'),_0x57e91e,JSON[_0xe638('0x11')](_0x276c5e));_0x1f96a7(_0x276c5e);});});}exports[_0xe638('0x12')]=function(_0x1b0981,_0x2078eb){return function(_0x30ac3c){try{if(!_['isNil'](this['interaction'][_0xe638('0x13')])){logger['info'](_0xe638('0xf'),_0x1b0981,_0xe638('0x14'));return _0x30ac3c[_0xe638('0x15')]();}var _0x2641c8={'ContactId':this['contact']['id'],'sentAt':moment()[_0xe638('0x16')](_0xe638('0x17')),'direction':_0xe638('0x18')};if(this[_0xe638('0x19')]==='sms'||this[_0xe638('0x19')]===_0xe638('0x1a')){_0x2641c8[_0xe638('0x1b')]=this[_0xe638('0x1c')][_0xe638('0x1b')];}var _0x16c56b=this['channel'];if(_0x16c56b===_0xe638('0x1d')){_0x2641c8[_0xe638('0x1e')]=this[_0xe638('0x1f')]['id'];}else{_0x2641c8[_[_0xe638('0x20')](_0x16c56b)+'AccountId']=this[_0xe638('0x1f')]['id'];}_0x2641c8[_[_0xe638('0x20')](_0x16c56b)+_0xe638('0x21')]=this[_0xe638('0x1c')]['id'];if(this[_0xe638('0x1c')][_0xe638('0x22')]){var _0x2ec04e=_0x2078eb[0x4];if(!_[_0xe638('0x23')](_0x2ec04e)){_0x2641c8['body']=utils['getMustacheRender'](_0x2ec04e,this);return rpc[_0x16c56b+_0xe638('0xc')][_0xe638('0xd')](_0x2641c8)['then'](function(_0x51e5b8){logger[_0xe638('0x24')](_0xe638('0xf'),_0x1b0981,_0x2641c8[_0xe638('0xb')]);})['catch'](function(_0x188349){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x1b0981,JSON[_0xe638('0x11')](_0x188349));})[_0xe638('0x25')](function(){logger[_0xe638('0x24')](_0xe638('0x26'),_0x1b0981);_0x30ac3c[_0xe638('0x27')]();});}else{logger[_0xe638('0x24')](_0xe638('0x28'),_0x1b0981);_0x30ac3c[_0xe638('0x27')]();}}else{var _0x26eb04=this;var _0x34f566=_0x2078eb[0x2][_0xe638('0x29')](/\\n/g,'\x0a');var _0x37dc3b={'credentials':{'private_key':_0x34f566,'client_email':_0x2078eb[0x1]}};var _0x1ae188=new dialogflow['SessionsClient'](_0x37dc3b);var _0x307e8c=_0x1ae188[_0xe638('0x2a')](_0x2078eb[0x0],md5(_0x26eb04[_0xe638('0x1c')]['id']));var _0x4ffd38={'session':_0x307e8c,'queryInput':{'text':{'text':_0x26eb04[_0xe638('0x2b')][_0xe638('0xb')],'languageCode':_0x2078eb[0x3]||'en'}}};return _0x1ae188[_0xe638('0x2c')](_0x4ffd38)['then'](function(_0x5fea13){if(_0x5fea13&&_0x5fea13[_0xe638('0x2d')]){_0x26eb04[_0xe638('0xb')][_0xe638('0x2e')]=_0x5fea13;var _0x1e6cfb=_0x5fea13[0x0];var _0x38fed2=_0x1e6cfb[_0xe638('0x2f')][_0xe638('0x30')]&&_0x1e6cfb[_0xe638('0x2f')][_0xe638('0x30')][_0xe638('0x31')]?_0x1e6cfb[_0xe638('0x2f')][_0xe638('0x30')][_0xe638('0x31')]['end_conversation'][_0xe638('0x32')]:![];_0x26eb04[_0xe638('0xb')][_0xe638('0x33')]=_0x1e6cfb[_0xe638('0x2f')]['action'];_0x26eb04[_0xe638('0xb')][_0xe638('0x34')]=_0x1e6cfb['queryResult'][_0xe638('0x35')];_0x26eb04[_0xe638('0xb')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x1e6cfb['queryResult'][_0xe638('0x30')]&&_0x1e6cfb[_0xe638('0x2f')]['diagnosticInfo']['fields']?_0x1e6cfb[_0xe638('0x2f')][_0xe638('0x30')]['fields'][_0xe638('0x36')][_0xe638('0x32')]:![];_0x26eb04['body']['DIALOGFLOWV2_INTENTNAME']=_0x1e6cfb[_0xe638('0x2f')][_0xe638('0x37')]['name'];_0x26eb04[_0xe638('0xb')][_0xe638('0x38')]=_0x1e6cfb['queryResult'][_0xe638('0x37')][_0xe638('0x39')];_0x26eb04['body'][_0xe638('0x3a')]=_0x1e6cfb[_0xe638('0x2f')][_0xe638('0x37')][_0xe638('0x3b')];_0x26eb04['body'][_0xe638('0x3c')]=_0x1e6cfb[_0xe638('0x2f')][_0xe638('0x3d')];_0x26eb04[_0xe638('0xb')][_0xe638('0x3e')]=_0x1e6cfb[_0xe638('0x2f')][_0xe638('0x3f')];_0x26eb04[_0xe638('0xb')][_0xe638('0x40')]=_0x1e6cfb['queryResult'][_0xe638('0x41')];_0x2641c8[_0xe638('0x42')]='dialogflowV2';_0x2641c8[_0xe638('0x43')]=JSON['stringify'](_0x5fea13);var _0x100f9a=[];for(var _0x57f550=0x0;_0x57f550<_0x5fea13['length'];_0x57f550++){var _0x5565bc=_0x5fea13[_0x57f550];if(_0x5565bc&&_0x5565bc['queryResult']&&_0x5565bc['queryResult'][_0xe638('0x44')]){_0x100f9a[_0xe638('0x45')](createMessage(_0x1b0981,_0x16c56b,_0x2641c8,_0x5565bc[_0xe638('0x2f')][_0xe638('0x44')]));}}return Promise[_0xe638('0x46')](_0x100f9a)[_0xe638('0xe')](function(){if(_0x38fed2){_0x30ac3c[_0xe638('0x15')]();}else{_0x30ac3c[_0xe638('0x27')]();}})[_0xe638('0x47')](function(_0x54b8eb){logger[_0xe638('0x10')](_0xe638('0xf'),_0x1b0981,JSON[_0xe638('0x11')](_0x54b8eb));_0x30ac3c[_0xe638('0x15')]();});}})[_0xe638('0x47')](function(_0x1edef7){logger['error'](_0xe638('0xf'),_0x1b0981,_0x1edef7[_0xe638('0x2b')]);_0x30ac3c['next']();});}}catch(_0x846de9){logger[_0xe638('0x10')](_0xe638('0xf'),_0x1b0981,JSON[_0xe638('0x11')](_0x846de9));_0x30ac3c[_0xe638('0x27')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 255db6e..0ae13ce 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x14fe=['condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','length','error','[%s][GOTOIF]\x20%s','map','join','stop','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','[%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','../../../../config/logger','routing','string'];(function(_0xf87037,_0x43087b){var _0x4f2389=function(_0x26db3c){while(--_0x26db3c){_0xf87037['push'](_0xf87037['shift']());}};_0x4f2389(++_0x43087b);}(_0x14fe,0x17f));var _0xe14f=function(_0xd90a05,_0x37f744){_0xd90a05=_0xd90a05-0x0;var _0x511738=_0x14fe[_0xd90a05];return _0x511738;};'use strict';var schema=require(_0xe14f('0x0'));var _=require(_0xe14f('0x1'));var htmlToText=require(_0xe14f('0x2'));var utils=require(_0xe14f('0x3'));var logger=require(_0xe14f('0x4'))(_0xe14f('0x5'));var gotoif=schema({'condition':{'type':_0xe14f('0x6'),'required':!![],'message':_0xe14f('0x7')},'priorityTrue':{'type':_0xe14f('0x8'),'message':_0xe14f('0x9')},'priorityFalse':{'type':_0xe14f('0x8'),'message':_0xe14f('0xa')}});exports['consequence']=function(_0x472787,_0x3ac81b){return function(_0x192551){try{var _0x140e0f={'condition':htmlToText[_0xe14f('0xb')](utils[_0xe14f('0xc')](_0x3ac81b[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x3ac81b[0x1],'priorityFalse':_0x3ac81b[0x2]};var _0x362ab7=gotoif[_0xe14f('0x0')](_0x140e0f,{'typecast':!![]});if(_0x362ab7[_0xe14f('0xd')]){logger[_0xe14f('0xe')](_0xe14f('0xf'),_0x472787,_[_0xe14f('0x10')](_0x362ab7,'message')[_0xe14f('0x11')](',\x20'));_0x192551[_0xe14f('0x12')]();}else{try{var _0x3b29da=eval('('+_0x140e0f['condition']+')');var _0x36ddb3=_0x3b29da?_0x140e0f[_0xe14f('0x13')]:_0x140e0f[_0xe14f('0x14')];logger[_0xe14f('0x15')](_0xe14f('0x16'),_0x472787,_0x140e0f['condition'],_0x3b29da,_0x36ddb3||_0xe14f('0x17'));if(_0x36ddb3){var _0x2d2fe7=_[_0xe14f('0x18')](_0x192551['rules'](),{'p':_0x36ddb3});if(_0x2d2fe7>=0x0){logger[_0xe14f('0x15')](_0xe14f('0x19'),_0x472787,_0x36ddb3||_0xe14f('0x17'),_0x2d2fe7);_0x192551[_0xe14f('0x17')](_0x2d2fe7);}else{logger[_0xe14f('0x15')](_0xe14f('0x1a'),_0x472787,_0x36ddb3||_0xe14f('0x17'));_0x192551[_0xe14f('0x12')]();}}else{_0x192551['next']();}}catch(_0x5afdd5){logger[_0xe14f('0xe')](_0xe14f('0x1b'),_0x472787,_0x5afdd5[_0xe14f('0x1c')]);_0x192551[_0xe14f('0x12')]();}}}catch(_0x404344){logger['error'](_0xe14f('0xf'),_0x472787,JSON[_0xe14f('0x1d')](_0x404344));_0x192551[_0xe14f('0x12')]();}};}; \ No newline at end of file +var _0x7e1f=['condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','length','error','[%s][GOTOIF]\x20%s','map','join','stop','priorityTrue','info','condition','findIndex','next','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','validate','lodash','./utils','routing','string'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0x7e1f,0x9c));var _0xf7e1=function(_0xa092de,_0x1246f7){_0xa092de=_0xa092de-0x0;var _0x28f687=_0x7e1f[_0xa092de];return _0x28f687;};'use strict';var schema=require(_0xf7e1('0x0'));var _=require(_0xf7e1('0x1'));var htmlToText=require('html-to-text');var utils=require(_0xf7e1('0x2'));var logger=require('../../../../config/logger')(_0xf7e1('0x3'));var gotoif=schema({'condition':{'type':_0xf7e1('0x4'),'required':!![],'message':_0xf7e1('0x5')},'priorityTrue':{'type':'number','message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0xf7e1('0x6'),'message':_0xf7e1('0x7')}});exports['consequence']=function(_0x3d486a,_0x26213d){return function(_0x2e8df2){try{var _0x113fe2={'condition':htmlToText[_0xf7e1('0x8')](utils[_0xf7e1('0x9')](_0x26213d[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x26213d[0x1],'priorityFalse':_0x26213d[0x2]};var _0x5d16ac=gotoif[_0xf7e1('0x0')](_0x113fe2,{'typecast':!![]});if(_0x5d16ac[_0xf7e1('0xa')]){logger[_0xf7e1('0xb')](_0xf7e1('0xc'),_0x3d486a,_[_0xf7e1('0xd')](_0x5d16ac,'message')[_0xf7e1('0xe')](',\x20'));_0x2e8df2[_0xf7e1('0xf')]();}else{try{var _0x1995e7=eval('('+_0x113fe2['condition']+')');var _0x30b8e9=_0x1995e7?_0x113fe2[_0xf7e1('0x10')]:_0x113fe2['priorityFalse'];logger[_0xf7e1('0x11')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x3d486a,_0x113fe2[_0xf7e1('0x12')],_0x1995e7,_0x30b8e9||'next');if(_0x30b8e9){var _0x51817a=_[_0xf7e1('0x13')](_0x2e8df2['rules'](),{'p':_0x30b8e9});if(_0x51817a>=0x0){logger[_0xf7e1('0x11')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x3d486a,_0x30b8e9||_0xf7e1('0x14'),_0x51817a);_0x2e8df2[_0xf7e1('0x14')](_0x51817a);}else{logger[_0xf7e1('0x11')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x3d486a,_0x30b8e9||_0xf7e1('0x14'));_0x2e8df2[_0xf7e1('0xf')]();}}else{_0x2e8df2['next']();}}catch(_0xdc3158){logger[_0xf7e1('0xb')](_0xf7e1('0x15'),_0x3d486a,_0xdc3158[_0xf7e1('0x16')]);_0x2e8df2[_0xf7e1('0xf')]();}}}catch(_0x30bf3){logger[_0xf7e1('0xb')](_0xf7e1('0xc'),_0x3d486a,JSON['stringify'](_0x30bf3));_0x2e8df2[_0xf7e1('0xf')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 042cd1d..d727791 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 _0x55de=['[%s][GOTOP]\x20%s','stringify','validate','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','map','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x55de,0x110));var _0xe55d=function(_0x3aebbf,_0x4bac97){_0x3aebbf=_0x3aebbf-0x0;var _0x1ce3f6=_0x55de[_0x3aebbf];return _0x1ce3f6;};'use strict';var schema=require(_0xe55d('0x0'));var _=require('lodash');var logger=require(_0xe55d('0x1'))('routing');var gotop=schema({'priority':{'type':_0xe55d('0x2'),'required':!![],'message':_0xe55d('0x3')}});exports['consequence']=function(_0x1cc7ae,_0x183d3d){return function(_0x25de5c){try{var _0x21a7a9={'priority':_0x183d3d[0x0]};var _0x2c1561=gotop[_0xe55d('0x0')](_0x21a7a9,{'typecast':!![]});if(_0x2c1561[_0xe55d('0x4')]){logger[_0xe55d('0x5')]('[%s][GOTOP]\x20%s',_0x1cc7ae,_[_0xe55d('0x6')](_0x2c1561,'message')['join'](',\x20'));_0x25de5c['stop']();}else{logger[_0xe55d('0x7')](_0xe55d('0x8'),_0x1cc7ae,_0x21a7a9[_0xe55d('0x9')]);if(_0x21a7a9[_0xe55d('0x9')]){var _0x20fbf4=_[_0xe55d('0xa')](_0x25de5c[_0xe55d('0xb')](),{'p':_0x21a7a9[_0xe55d('0x9')]});if(_0x20fbf4>=0x0){logger['info'](_0xe55d('0xc'),_0x1cc7ae,_0x21a7a9[_0xe55d('0x9')]||_0xe55d('0xd'),_0x20fbf4);_0x25de5c['next'](_0x20fbf4);}else{logger[_0xe55d('0x7')](_0xe55d('0xe'),_0x1cc7ae,_0x21a7a9['priority']||_0xe55d('0xd'));_0x25de5c[_0xe55d('0xf')]();}}else{_0x25de5c['next']();}}}catch(_0x18c1e2){logger[_0xe55d('0x5')](_0xe55d('0x10'),_0x1cc7ae,JSON[_0xe55d('0x11')](_0x18c1e2));_0x25de5c[_0xe55d('0xf')]();}};}; \ No newline at end of file +var _0x52d3=['map','join','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','stringify','validate','../../../../config/logger','routing','number','consequence','length','error','[%s][GOTOP]\x20%s'];(function(_0xb77d35,_0x291854){var _0x5389a8=function(_0x52b4d2){while(--_0x52b4d2){_0xb77d35['push'](_0xb77d35['shift']());}};_0x5389a8(++_0x291854);}(_0x52d3,0x187));var _0x352d=function(_0x1fd375,_0x563748){_0x1fd375=_0x1fd375-0x0;var _0x5c0c2e=_0x52d3[_0x1fd375];return _0x5c0c2e;};'use strict';var schema=require(_0x352d('0x0'));var _=require('lodash');var logger=require(_0x352d('0x1'))(_0x352d('0x2'));var gotop=schema({'priority':{'type':_0x352d('0x3'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x352d('0x4')]=function(_0x183ab9,_0x45bb55){return function(_0xe566d1){try{var _0x3e8666={'priority':_0x45bb55[0x0]};var _0x1f7a02=gotop[_0x352d('0x0')](_0x3e8666,{'typecast':!![]});if(_0x1f7a02[_0x352d('0x5')]){logger[_0x352d('0x6')](_0x352d('0x7'),_0x183ab9,_[_0x352d('0x8')](_0x1f7a02,'message')[_0x352d('0x9')](',\x20'));_0xe566d1['stop']();}else{logger[_0x352d('0xa')](_0x352d('0xb'),_0x183ab9,_0x3e8666[_0x352d('0xc')]);if(_0x3e8666['priority']){var _0x30c3c8=_[_0x352d('0xd')](_0xe566d1[_0x352d('0xe')](),{'p':_0x3e8666['priority']});if(_0x30c3c8>=0x0){logger[_0x352d('0xa')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x183ab9,_0x3e8666[_0x352d('0xc')]||_0x352d('0xf'),_0x30c3c8);_0xe566d1[_0x352d('0xf')](_0x30c3c8);}else{logger[_0x352d('0xa')](_0x352d('0x10'),_0x183ab9,_0x3e8666[_0x352d('0xc')]||_0x352d('0xf'));_0xe566d1[_0x352d('0x11')]();}}else{_0xe566d1['next']();}}}catch(_0x2d8a69){logger[_0x352d('0x6')]('[%s][GOTOP]\x20%s',_0x183ab9,JSON[_0x352d('0x12')](_0x2d8a69));_0xe566d1[_0x352d('0x11')]();}};}; \ 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 c779e7a..35b089b 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 _0x2a84=['lodash','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','chat','ChatWebsiteId','upperFirst','channel','account','then','info','[%s][MESSAGE]\x20%s','body','next','catch','stringify','stop'];(function(_0x4a4bbc,_0x55296f){var _0x51e76f=function(_0x30cbb4){while(--_0x30cbb4){_0x4a4bbc['push'](_0x4a4bbc['shift']());}};_0x51e76f(++_0x55296f);}(_0x2a84,0x170));var _0x42a8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2a84[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x42a8('0x0'));var utils=require(_0x42a8('0x1'));var logger=require('../../../../config/logger')(_0x42a8('0x2'));var rpc={'chatMessage':require(_0x42a8('0x3')),'openchannelMessage':require(_0x42a8('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x42a8('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x42a8('0x6'))};exports[_0x42a8('0x7')]=function(_0x1b6a6a,_0x59505e){return function(_0x593b3a){try{var _0x4b17b7={'body':utils[_0x42a8('0x8')](_0x59505e[0x0],this),'ContactId':this[_0x42a8('0x9')]['id']};if(this['channel']===_0x42a8('0xa')){_0x4b17b7[_0x42a8('0xb')]=this['account']['id'];}else{_0x4b17b7[_[_0x42a8('0xc')](this[_0x42a8('0xd')])+'AccountId']=this[_0x42a8('0xe')]['id'];}_0x4b17b7[_[_0x42a8('0xc')](this[_0x42a8('0xd')])+'InteractionId']=this['interaction']['id'];if(rpc[this[_0x42a8('0xd')]+'Message']){return rpc[this[_0x42a8('0xd')]+'Message']['create'](_0x4b17b7)[_0x42a8('0xf')](function(_0x3133c4){logger[_0x42a8('0x10')](_0x42a8('0x11'),_0x1b6a6a,_0x4b17b7[_0x42a8('0x12')]);_0x593b3a[_0x42a8('0x13')]();})[_0x42a8('0x14')](function(_0x156205){logger['error']('[%s][MESSAGE]\x20%s',_0x1b6a6a,JSON[_0x42a8('0x15')](_0x156205));_0x593b3a[_0x42a8('0x16')]();});}}catch(_0x1191a9){logger['error'](_0x42a8('0x11'),_0x1b6a6a,JSON[_0x42a8('0x15')](_0x1191a9));_0x593b3a[_0x42a8('0x16')]();}};}; \ No newline at end of file +var _0xd23a=['../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','contact','channel','ChatWebsiteId','account','upperFirst','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','../../../../config/logger','routing'];(function(_0x3d78a2,_0x2a6600){var _0x41d39e=function(_0x59bb7f){while(--_0x59bb7f){_0x3d78a2['push'](_0x3d78a2['shift']());}};_0x41d39e(++_0x2a6600);}(_0xd23a,0xe7));var _0xad23=function(_0x5beb22,_0x5c4a2b){_0x5beb22=_0x5beb22-0x0;var _0x448603=_0xd23a[_0x5beb22];return _0x448603;};'use strict';var _=require(_0xad23('0x0'));var utils=require('./utils');var logger=require(_0xad23('0x1'))(_0xad23('0x2'));var rpc={'chatMessage':require(_0xad23('0x3')),'openchannelMessage':require(_0xad23('0x4')),'mailMessage':require(_0xad23('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xad23('0x6')),'whatsappMessage':require(_0xad23('0x7'))};exports['consequence']=function(_0x221535,_0x1246b7){return function(_0x46c3e2){try{var _0x17b224={'body':utils['getMustacheRender'](_0x1246b7[0x0],this),'ContactId':this[_0xad23('0x8')]['id']};if(this[_0xad23('0x9')]==='chat'){_0x17b224[_0xad23('0xa')]=this[_0xad23('0xb')]['id'];}else{_0x17b224[_[_0xad23('0xc')](this[_0xad23('0x9')])+'AccountId']=this['account']['id'];}_0x17b224[_[_0xad23('0xc')](this[_0xad23('0x9')])+_0xad23('0xd')]=this[_0xad23('0xe')]['id'];if(rpc[this['channel']+_0xad23('0xf')]){return rpc[this[_0xad23('0x9')]+_0xad23('0xf')][_0xad23('0x10')](_0x17b224)[_0xad23('0x11')](function(_0x3baafc){logger[_0xad23('0x12')](_0xad23('0x13'),_0x221535,_0x17b224[_0xad23('0x14')]);_0x46c3e2[_0xad23('0x15')]();})[_0xad23('0x16')](function(_0x5a2fb7){logger[_0xad23('0x17')](_0xad23('0x13'),_0x221535,JSON[_0xad23('0x18')](_0x5a2fb7));_0x46c3e2[_0xad23('0x19')]();});}}catch(_0x257652){logger[_0xad23('0x17')](_0xad23('0x13'),_0x221535,JSON[_0xad23('0x18')](_0x257652));_0x46c3e2[_0xad23('0x19')]();}};}; \ 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 7b63b88..6180739 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 _0x6c10=['consequence','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop','./utils','routing'];(function(_0x2f7899,_0x130192){var _0x300578=function(_0x5bae27){while(--_0x5bae27){_0x2f7899['push'](_0x2f7899['shift']());}};_0x300578(++_0x130192);}(_0x6c10,0x1ae));var _0x06c1=function(_0x27ccb6,_0x103913){_0x27ccb6=_0x27ccb6-0x0;var _0x412043=_0x6c10[_0x27ccb6];return _0x412043;};'use strict';var utils=require(_0x06c1('0x0'));var logger=require('../../../../config/logger')(_0x06c1('0x1'));exports[_0x06c1('0x2')]=function(_0x2c7138,_0xb65baa){return function(_0x29f885){try{logger['info'](_0x06c1('0x3'),_0x2c7138,utils[_0x06c1('0x4')](_0xb65baa[0x0],this));_0x29f885[_0x06c1('0x5')]();}catch(_0x4ac60b){logger[_0x06c1('0x6')](_0x06c1('0x3'),_0x2c7138,JSON[_0x06c1('0x7')](_0x4ac60b));_0x29f885[_0x06c1('0x8')]();}};}; \ No newline at end of file +var _0x03af=['../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','stringify','stop','./utils'];(function(_0x57f587,_0x43e0c5){var _0x5bbacd=function(_0x58abe1){while(--_0x58abe1){_0x57f587['push'](_0x57f587['shift']());}};_0x5bbacd(++_0x43e0c5);}(_0x03af,0xa9));var _0xf03a=function(_0x4fd648,_0x30db09){_0x4fd648=_0x4fd648-0x0;var _0x2d32de=_0x03af[_0x4fd648];return _0x2d32de;};'use strict';var utils=require(_0xf03a('0x0'));var logger=require(_0xf03a('0x1'))(_0xf03a('0x2'));exports[_0xf03a('0x3')]=function(_0x19fd7a,_0x85ab4a){return function(_0x3afd0a){try{logger[_0xf03a('0x4')](_0xf03a('0x5'),_0x19fd7a,utils[_0xf03a('0x6')](_0x85ab4a[0x0],this));_0x3afd0a[_0xf03a('0x7')]();}catch(_0x18a35f){logger['error'](_0xf03a('0x5'),_0x19fd7a,JSON[_0xf03a('0x8')](_0x18a35f));_0x3afd0a[_0xf03a('0x9')]();}};}; \ 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 f5abf83..f6cfc6e 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 _0xb1c9=['../../rpc/smsQueueReport','string','number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','MessageId','chat','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','[%s][STOP:QUEUE][NAME:%s]','update','timeout','info','[%s][END:QUEUE][NAME:%s]','message','toLowerCase','consequence','validate','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','clone','%sQueuesWaitingInteractions','format','%s_queue_waiting_interaction:%s','save','remove','pick','../../rpc/mailQueueReport','../../rpc/chatQueueReport'];(function(_0x35dc58,_0x471fd2){var _0x5e8c00=function(_0x492ea4){while(--_0x492ea4){_0x35dc58['push'](_0x35dc58['shift']());}};_0x5e8c00(++_0x471fd2);}(_0xb1c9,0x190));var _0x9b1c=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xb1c9[_0x5c2e3e];return _0x53f64a;};'use strict';var schema=require('validate');var _=require('lodash');var util=require('util');var seqqueue=require(_0x9b1c('0x0'));var moment=require(_0x9b1c('0x1'));var Redis=require(_0x9b1c('0x2'));var config=require(_0x9b1c('0x3'));var logger=require(_0x9b1c('0x4'))(_0x9b1c('0x5'));var strategy=require(_0x9b1c('0x6'));config[_0x9b1c('0x7')]=_[_0x9b1c('0x8')](config['redis'],{'host':_0x9b1c('0x9'),'port':0x18eb});var io=require(_0x9b1c('0xa'))(new Redis(config[_0x9b1c('0x7')]));var attributes=['id',_0x9b1c('0xb'),_0x9b1c('0xc'),_0x9b1c('0xd'),_0x9b1c('0xe'),_0x9b1c('0xf')];function emit(_0x1f9ac0,_0x44a201,_0x3e0047){io['to'](_0x1f9ac0)[_0x9b1c('0x10')](_0x44a201,_0x3e0047);}function emitChannelQueueInteraction(_0x4fab8e,_0x49cde2,_0x34e5fd,_0x283f3a,_0x266bc8,_0x4ad3eb,_0x12c902,_0x469035){var _0x2d88e4=_[_0x9b1c('0x11')](_0x34e5fd);_0x2d88e4[_0x9b1c('0xb')]=_0x469035;_0x2d88e4[_0x9b1c('0xd')]=_0x49cde2;_0x2d88e4['account']=_0x283f3a;_0x2d88e4['id']=_0x266bc8;if(_0x4ad3eb){_0x12c902[util['format'](_0x9b1c('0x12'),_0x4fab8e)][_0x266bc8]=_['pick'](_0x2d88e4,attributes);}else{delete _0x12c902[util[_0x9b1c('0x13')]('%sQueuesWaitingInteractions',_0x4fab8e)][_0x266bc8];}emit(util[_0x9b1c('0x13')]('%s:queue:%s',_0x4fab8e,_0x49cde2),util[_0x9b1c('0x13')](_0x9b1c('0x14'),_0x4fab8e,_0x4ad3eb?_0x9b1c('0x15'):_0x9b1c('0x16')),_[_0x9b1c('0x17')](_0x2d88e4,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x9b1c('0x18')),'chatQueueReport':require(_0x9b1c('0x19')),'smsQueueReport':require(_0x9b1c('0x1a')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x9b1c('0x1b'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x9b1c('0x1c'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x24ba7d,_0x34f48a,_0x5895cd,_0x151561){if(_0x24ba7d&&_0x34f48a&&_0x5895cd){_0x34f48a[_0x9b1c('0x1d')]+=0x1;var _0x4fe497={'uniqueid':_0x24ba7d,'from':_0x5895cd[_0x9b1c('0x1e')]?_0x5895cd[_0x9b1c('0x1e')]['from']:'','joinAt':moment()['format'](_0x9b1c('0x1f')),'ContactId':_0x5895cd['contact']?_0x5895cd[_0x9b1c('0x20')]['id']:null,'ListId':_0x5895cd[_0x9b1c('0x21')]?_0x5895cd[_0x9b1c('0x21')]['id']:null};_0x4fe497[_['upperFirst'](_0x5895cd['channel'])+'QueueId']=_0x34f48a['id']||null;_0x4fe497[_[_0x9b1c('0x22')](_0x5895cd[_0x9b1c('0x23')])+'InteractionId']=_0x5895cd['interaction']?_0x5895cd['interaction']['id']:null;_0x4fe497[_[_0x9b1c('0x22')](_0x5895cd[_0x9b1c('0x23')])+_0x9b1c('0x24')]=_0x5895cd['message']?_0x5895cd['message']['id']:null;_0x4fe497[_[_0x9b1c('0x22')](_0x5895cd['channel'])+(_0x5895cd[_0x9b1c('0x23')]!==_0x9b1c('0x25')?'AccountId':'WebsiteId')]=_0x5895cd[_0x9b1c('0xc')]?_0x5895cd[_0x9b1c('0xc')]['id']:null;logger['info'](util[_0x9b1c('0x13')](_0x9b1c('0x26'),_0x24ba7d,_0x34f48a[_0x9b1c('0x27')]));emitChannelQueueInteraction(_0x5895cd[_0x9b1c('0x23')],_0x34f48a[_0x9b1c('0x27')],_0x4fe497,_0x5895cd['account']['name'],_0x5895cd['message']['id'],!![],_0x151561,_0x34f48a['id']);if(rpc[_0x5895cd[_0x9b1c('0x23')]+_0x9b1c('0x28')]){return rpc[_0x5895cd[_0x9b1c('0x23')]+_0x9b1c('0x28')][_0x9b1c('0x29')](_0x4fe497)[_0x9b1c('0x2a')](function(_0x3ff86e){logger[_0x9b1c('0x2b')]('create\x20queue\x20report');});}}}function stopRouting(_0x31d373,_0x162adb,_0x39c0f7,_0x475197){if(_0x31d373&&_0x162adb){_0x162adb[_0x9b1c('0x1d')]-=0x1;var _0x5f0781={'leaveAt':moment()['format'](_0x9b1c('0x1f')),'acceptAt':moment()[_0x9b1c('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'accepted'};logger['info'](util[_0x9b1c('0x13')](_0x9b1c('0x2c'),_0x31d373,_0x162adb[_0x9b1c('0x27')]));emitChannelQueueInteraction(_0x39c0f7[_0x9b1c('0x23')],_0x162adb[_0x9b1c('0x27')],_0x39c0f7['body'],_0x39c0f7['account']['name'],_0x39c0f7['message']['id'],![],_0x475197,_0x162adb['id']);if(rpc[_0x39c0f7[_0x9b1c('0x23')]+_0x9b1c('0x28')]){return rpc[_0x39c0f7[_0x9b1c('0x23')]+_0x9b1c('0x28')][_0x9b1c('0x2d')](_0x31d373,_0x5f0781)[_0x9b1c('0x2a')](function(_0x3bdc47){logger[_0x9b1c('0x2b')]('update\x20queue\x20report');});}}}function endRouting(_0x38a346,_0x44aff6,_0x56699f,_0x5e0970){if(_0x38a346&&_0x44aff6){_0x44aff6[_0x9b1c('0x1d')]-=0x1;var _0x387735={'leaveAt':moment()[_0x9b1c('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x9b1c('0x13')](_0x9b1c('0x1f')),'reason':_0x9b1c('0x2e')};logger[_0x9b1c('0x2f')](util['format'](_0x9b1c('0x30'),_0x38a346,_0x44aff6[_0x9b1c('0x27')]));emitChannelQueueInteraction(_0x56699f[_0x9b1c('0x23')],_0x44aff6[_0x9b1c('0x27')],_0x56699f['body'],_0x56699f[_0x9b1c('0xc')][_0x9b1c('0x27')],_0x56699f[_0x9b1c('0x31')]['id'],![],_0x5e0970);if(rpc[_0x56699f[_0x9b1c('0x23')]+_0x9b1c('0x28')]){return rpc[_0x56699f[_0x9b1c('0x23')]+_0x9b1c('0x28')][_0x9b1c('0x2d')](_0x38a346,_0x387735)['catch'](function(_0x2e02e3){logger[_0x9b1c('0x2b')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x4e96fe){return function(_0x1071de){return _0x1071de['name']['toLowerCase']()===_0x4e96fe[_0x9b1c('0x32')]();};}exports[_0x9b1c('0x33')]=function(_0x7e1bb8,_0x33877a,_0x5ce7be,_0x3d9afe){return function(_0x4706c4){try{var _0x30b9a9={'name':_0x33877a[0x0],'timeout':_0x33877a[0x1]};var _0x3916d2=queue[_0x9b1c('0x34')](_0x30b9a9,{'typecast':!![]});if(_0x3916d2[_0x9b1c('0x35')]){logger['error'](_0x9b1c('0x36'),_0x7e1bb8,_[_0x9b1c('0x37')](_0x3916d2,_0x9b1c('0x31'))[_0x9b1c('0x38')](',\x20'));_0x4706c4[_0x9b1c('0x39')]();}else{var _0x27ba78=_[_0x9b1c('0x3a')](_0x5ce7be[_0x3d9afe[_0x9b1c('0x23')]+_0x9b1c('0x3b')],handleFindQueue(_0x30b9a9['name']));if(_0x27ba78){startRouting(_0x7e1bb8,_0x27ba78,_0x3d9afe,_0x5ce7be);var _0x397a3a=(_0x27ba78['timeout']||0xa)*0x3e8;var _0x430899=(_0x30b9a9[_0x9b1c('0x2e')]||0x14)*0x3e8;var _0x4118c2,_0x14e4b9;if(_0x397a3a>_0x430899){_0x430899=_0x397a3a;}var _0x522699=seqqueue[_0x9b1c('0x3c')](_0x397a3a);_0x522699['id']=_0x7e1bb8;_0x522699['atimeout']=_0x397a3a;_0x522699[_0x9b1c('0x3d')]=_0x430899;_0x522699[_0x9b1c('0x23')]=_0x3d9afe[_0x9b1c('0x23')];_0x5ce7be[_0x9b1c('0x3e')][_0x7e1bb8]['on']('end',function(){logger[_0x9b1c('0x2f')](_0x9b1c('0x3f'),_0x7e1bb8);stopRouting(_0x7e1bb8,_0x27ba78,_0x3d9afe,_0x5ce7be);clearTimeout(_0x4118c2);_0x4118c2=undefined;_0x522699[_0x9b1c('0x40')](!![]);if(_0x5ce7be[_0x9b1c('0x3e')][_0x7e1bb8]){delete _0x5ce7be['rules'][_0x7e1bb8];}_0x4706c4[_0x9b1c('0x39')]();});_0x5ce7be[_0x9b1c('0x3e')][_0x7e1bb8]['on']('complete',function(){if(_0x5ce7be[_0x9b1c('0x3e')][_0x7e1bb8]){delete _0x5ce7be[_0x9b1c('0x3e')][_0x7e1bb8];}});_0x4118c2=setTimeout(function(){logger[_0x9b1c('0x2f')](_0x9b1c('0x41'),_0x7e1bb8);endRouting(_0x7e1bb8,_0x27ba78,_0x3d9afe,_0x5ce7be);clearTimeout(_0x4118c2);_0x522699[_0x9b1c('0x40')](!![]);_0x4706c4[_0x9b1c('0x42')]();},_0x430899);switch(_0x27ba78[_0x9b1c('0x43')]){case'rrmemory':strategy['rrmemory'](_0x522699,_0x27ba78,_0x5ce7be,_0x3d9afe);break;default:strategy[_0x9b1c('0x44')](_0x522699,_0x27ba78,_0x5ce7be,_0x3d9afe);}}else{logger[_0x9b1c('0x2b')](_0x9b1c('0x45'),_0x7e1bb8,_0x30b9a9[_0x9b1c('0x27')]);_0x4706c4[_0x9b1c('0x39')]();}}}catch(_0x3872d2){console['log'](_0x3872d2);logger[_0x9b1c('0x2b')](_0x9b1c('0x36'),_0x7e1bb8,_0x3872d2[_0x9b1c('0x46')]);_0x4706c4[_0x9b1c('0x39')]();}};}; \ No newline at end of file +var _0x6bea=['from','joinAt','emit','clone','queue_id','account','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','upperFirst','channel','QueueId','InteractionId','MessageId','message','chat','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','waiting','accepted','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','error','toLowerCase','validate','map','stop','find','Queues','timeout','end','close','rules','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','defaults','redis','localhost','queue'];(function(_0x24516c,_0x59fcd8){var _0xaf2987=function(_0x9f8828){while(--_0x9f8828){_0x24516c['push'](_0x24516c['shift']());}};_0xaf2987(++_0x59fcd8);}(_0x6bea,0x85));var _0xa6be=function(_0x198f36,_0xc7775a){_0x198f36=_0x198f36-0x0;var _0x395223=_0x6bea[_0x198f36];return _0x395223;};'use strict';var schema=require('validate');var _=require(_0xa6be('0x0'));var util=require(_0xa6be('0x1'));var seqqueue=require(_0xa6be('0x2'));var moment=require(_0xa6be('0x3'));var Redis=require(_0xa6be('0x4'));var config=require(_0xa6be('0x5'));var logger=require(_0xa6be('0x6'))(_0xa6be('0x7'));var strategy=require(_0xa6be('0x8'));config['redis']=_[_0xa6be('0x9')](config[_0xa6be('0xa')],{'host':_0xa6be('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var attributes=['id','queue_id','account',_0xa6be('0xc'),_0xa6be('0xd'),_0xa6be('0xe')];function emit(_0x285bd4,_0x355b6c,_0x37ae73){io['to'](_0x285bd4)[_0xa6be('0xf')](_0x355b6c,_0x37ae73);}function emitChannelQueueInteraction(_0x20b3e8,_0x2eff3f,_0x2fa898,_0x543af6,_0x3eb8f8,_0x5919dc,_0x5a5b28,_0x35b6c1){var _0x5ba457=_[_0xa6be('0x10')](_0x2fa898);_0x5ba457[_0xa6be('0x11')]=_0x35b6c1;_0x5ba457[_0xa6be('0xc')]=_0x2eff3f;_0x5ba457[_0xa6be('0x12')]=_0x543af6;_0x5ba457['id']=_0x3eb8f8;if(_0x5919dc){_0x5a5b28[util[_0xa6be('0x13')](_0xa6be('0x14'),_0x20b3e8)][_0x3eb8f8]=_[_0xa6be('0x15')](_0x5ba457,attributes);}else{delete _0x5a5b28[util['format'](_0xa6be('0x14'),_0x20b3e8)][_0x3eb8f8];}emit(util[_0xa6be('0x13')](_0xa6be('0x16'),_0x20b3e8,_0x2eff3f),util[_0xa6be('0x13')](_0xa6be('0x17'),_0x20b3e8,_0x5919dc?_0xa6be('0x18'):_0xa6be('0x19')),_['pick'](_0x5ba457,attributes));}var rpc={'openchannelQueueReport':require(_0xa6be('0x1a')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0xa6be('0x1b')),'smsQueueReport':require(_0xa6be('0x1c')),'faxQueueReport':require(_0xa6be('0x1d')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0xa6be('0x1e'),'required':!![],'message':_0xa6be('0x1f')},'timeout':{'type':_0xa6be('0x20'),'message':_0xa6be('0x21')}});function startRouting(_0x26fe2f,_0x30402f,_0x4a24f9,_0x325c0a){if(_0x26fe2f&&_0x30402f&&_0x4a24f9){_0x30402f['waiting']+=0x1;var _0xdf4e25={'uniqueid':_0x26fe2f,'from':_0x4a24f9[_0xa6be('0x22')]?_0x4a24f9['body'][_0xa6be('0xd')]:'','joinAt':moment()[_0xa6be('0x13')](_0xa6be('0x23')),'ContactId':_0x4a24f9[_0xa6be('0x24')]?_0x4a24f9['contact']['id']:null,'ListId':_0x4a24f9['list']?_0x4a24f9['list']['id']:null};_0xdf4e25[_[_0xa6be('0x25')](_0x4a24f9[_0xa6be('0x26')])+_0xa6be('0x27')]=_0x30402f['id']||null;_0xdf4e25[_[_0xa6be('0x25')](_0x4a24f9['channel'])+_0xa6be('0x28')]=_0x4a24f9['interaction']?_0x4a24f9['interaction']['id']:null;_0xdf4e25[_['upperFirst'](_0x4a24f9[_0xa6be('0x26')])+_0xa6be('0x29')]=_0x4a24f9[_0xa6be('0x2a')]?_0x4a24f9['message']['id']:null;_0xdf4e25[_[_0xa6be('0x25')](_0x4a24f9['channel'])+(_0x4a24f9['channel']!==_0xa6be('0x2b')?'AccountId':_0xa6be('0x2c'))]=_0x4a24f9[_0xa6be('0x12')]?_0x4a24f9[_0xa6be('0x12')]['id']:null;logger[_0xa6be('0x2d')](util[_0xa6be('0x13')](_0xa6be('0x2e'),_0x26fe2f,_0x30402f['name']));emitChannelQueueInteraction(_0x4a24f9[_0xa6be('0x26')],_0x30402f[_0xa6be('0x2f')],_0xdf4e25,_0x4a24f9[_0xa6be('0x12')][_0xa6be('0x2f')],_0x4a24f9[_0xa6be('0x2a')]['id'],!![],_0x325c0a,_0x30402f['id']);if(rpc[_0x4a24f9[_0xa6be('0x26')]+_0xa6be('0x30')]){return rpc[_0x4a24f9[_0xa6be('0x26')]+_0xa6be('0x30')][_0xa6be('0x31')](_0xdf4e25)[_0xa6be('0x32')](function(_0x5f41c6){logger['error']('create\x20queue\x20report');});}}}function stopRouting(_0x777414,_0xf2a3a7,_0x1e98a0,_0x2f9b44){if(_0x777414&&_0xf2a3a7){_0xf2a3a7[_0xa6be('0x33')]-=0x1;var _0xa0e290={'leaveAt':moment()[_0xa6be('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0xa6be('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xa6be('0x34')};logger['info'](util[_0xa6be('0x13')](_0xa6be('0x35'),_0x777414,_0xf2a3a7[_0xa6be('0x2f')]));emitChannelQueueInteraction(_0x1e98a0[_0xa6be('0x26')],_0xf2a3a7[_0xa6be('0x2f')],_0x1e98a0[_0xa6be('0x22')],_0x1e98a0['account']['name'],_0x1e98a0[_0xa6be('0x2a')]['id'],![],_0x2f9b44,_0xf2a3a7['id']);if(rpc[_0x1e98a0[_0xa6be('0x26')]+'QueueReport']){return rpc[_0x1e98a0[_0xa6be('0x26')]+'QueueReport'][_0xa6be('0x36')](_0x777414,_0xa0e290)[_0xa6be('0x32')](function(_0x5c4a59){logger['error'](_0xa6be('0x37'));});}}}function endRouting(_0x269b33,_0x6c5628,_0x5c0548,_0x43adca){if(_0x269b33&&_0x6c5628){_0x6c5628[_0xa6be('0x33')]-=0x1;var _0x4df7e7={'leaveAt':moment()[_0xa6be('0x13')](_0xa6be('0x23')),'exitAt':moment()[_0xa6be('0x13')](_0xa6be('0x23')),'reason':'timeout'};logger[_0xa6be('0x2d')](util[_0xa6be('0x13')](_0xa6be('0x38'),_0x269b33,_0x6c5628[_0xa6be('0x2f')]));emitChannelQueueInteraction(_0x5c0548[_0xa6be('0x26')],_0x6c5628['name'],_0x5c0548['body'],_0x5c0548[_0xa6be('0x12')][_0xa6be('0x2f')],_0x5c0548[_0xa6be('0x2a')]['id'],![],_0x43adca);if(rpc[_0x5c0548['channel']+_0xa6be('0x30')]){return rpc[_0x5c0548[_0xa6be('0x26')]+_0xa6be('0x30')][_0xa6be('0x36')](_0x269b33,_0x4df7e7)[_0xa6be('0x32')](function(_0x295692){logger[_0xa6be('0x39')](_0xa6be('0x37'));});}}}function handleFindQueue(_0x45ecf1){return function(_0x176ef0){return _0x176ef0[_0xa6be('0x2f')][_0xa6be('0x3a')]()===_0x45ecf1[_0xa6be('0x3a')]();};}exports['consequence']=function(_0x148a90,_0x168e97,_0x1b3e16,_0x115fea){return function(_0x1c17a3){try{var _0xed6ece={'name':_0x168e97[0x0],'timeout':_0x168e97[0x1]};var _0x466d64=queue[_0xa6be('0x3b')](_0xed6ece,{'typecast':!![]});if(_0x466d64['length']){logger[_0xa6be('0x39')]('[%s][QUEUE]\x20%s',_0x148a90,_[_0xa6be('0x3c')](_0x466d64,_0xa6be('0x2a'))['join'](',\x20'));_0x1c17a3[_0xa6be('0x3d')]();}else{var _0x594abd=_[_0xa6be('0x3e')](_0x1b3e16[_0x115fea[_0xa6be('0x26')]+_0xa6be('0x3f')],handleFindQueue(_0xed6ece[_0xa6be('0x2f')]));if(_0x594abd){startRouting(_0x148a90,_0x594abd,_0x115fea,_0x1b3e16);var _0xf27b9f=(_0x594abd['timeout']||0xa)*0x3e8;var _0x1a39a1=(_0xed6ece[_0xa6be('0x40')]||0x14)*0x3e8;var _0x400e14,_0x6d47ed;if(_0xf27b9f>_0x1a39a1){_0x1a39a1=_0xf27b9f;}var _0x5a72cc=seqqueue['createQueue'](_0xf27b9f);_0x5a72cc['id']=_0x148a90;_0x5a72cc['atimeout']=_0xf27b9f;_0x5a72cc['qtimeout']=_0x1a39a1;_0x5a72cc[_0xa6be('0x26')]=_0x115fea[_0xa6be('0x26')];_0x1b3e16['rules'][_0x148a90]['on'](_0xa6be('0x41'),function(){logger[_0xa6be('0x2d')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x148a90);stopRouting(_0x148a90,_0x594abd,_0x115fea,_0x1b3e16);clearTimeout(_0x400e14);_0x400e14=undefined;_0x5a72cc[_0xa6be('0x42')](!![]);if(_0x1b3e16[_0xa6be('0x43')][_0x148a90]){delete _0x1b3e16[_0xa6be('0x43')][_0x148a90];}_0x1c17a3[_0xa6be('0x3d')]();});_0x1b3e16['rules'][_0x148a90]['on']('complete',function(){if(_0x1b3e16[_0xa6be('0x43')][_0x148a90]){delete _0x1b3e16['rules'][_0x148a90];}});_0x400e14=setTimeout(function(){logger[_0xa6be('0x2d')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x148a90);endRouting(_0x148a90,_0x594abd,_0x115fea,_0x1b3e16);clearTimeout(_0x400e14);_0x5a72cc[_0xa6be('0x42')](!![]);_0x1c17a3['next']();},_0x1a39a1);switch(_0x594abd[_0xa6be('0x44')]){case _0xa6be('0x45'):strategy[_0xa6be('0x45')](_0x5a72cc,_0x594abd,_0x1b3e16,_0x115fea);break;default:strategy['beepall'](_0x5a72cc,_0x594abd,_0x1b3e16,_0x115fea);}}else{logger[_0xa6be('0x39')](_0xa6be('0x46'),_0x148a90,_0xed6ece[_0xa6be('0x2f')]);_0x1c17a3[_0xa6be('0x3d')]();}}}catch(_0x52b749){console[_0xa6be('0x47')](_0x52b749);logger[_0xa6be('0x39')]('[%s][QUEUE]\x20%s',_0x148a90,_0x52b749[_0xa6be('0x48')]);_0x1c17a3[_0xa6be('0x3d')]();}};}; \ 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 faa40a3..15f4ec8 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 _0x90be=['exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','handleTimeout','drained','prototype','handleDrained','debug','[%s][AGENT]\x20try\x20with\x20%s','agents','forcedOwnership','isAgentAvailable','channel','busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','busy','STOP','TIMEOUT'];(function(_0x245c30,_0x4df296){var _0x18f014=function(_0x49b9d4){while(--_0x49b9d4){_0x245c30['push'](_0x245c30['shift']());}};_0x18f014(++_0x4df296);}(_0x90be,0x12a));var _0xe90b=function(_0x2d5574,_0x5c7b1c){_0x2d5574=_0x2d5574-0x0;var _0xcb1b06=_0x90be[_0x2d5574];return _0xcb1b06;};'use strict';var _=require(_0xe90b('0x0'));var uuid=require(_0xe90b('0x1'));var util=require(_0xe90b('0x2'));var logger=require(_0xe90b('0x3'))(_0xe90b('0x4'));var Agent=function(_0xd8bc67,_0x5a7e9e,_0x2507d0,_0x53bbb5){this[_0xe90b('0x5')]=uuid['v4']();this[_0xe90b('0x6')]=_0xd8bc67;this[_0xe90b('0x7')]=_0x5a7e9e;this[_0xe90b('0x8')]=_0x2507d0;this['routing']=_0x53bbb5;this['squeue'][_0xe90b('0x9')](this[_0xe90b('0xa')][_0xe90b('0xb')](this),this[_0xe90b('0xc')][_0xe90b('0xb')](this));this[_0xe90b('0x6')]['on']('timeout',this[_0xe90b('0xc')][_0xe90b('0xb')](this));this[_0xe90b('0x6')]['on'](_0xe90b('0xd'),this['handleDrained'][_0xe90b('0xb')](this));};Agent[_0xe90b('0xe')][_0xe90b('0x9')]=function(){this[_0xe90b('0x6')]['push'](this['handleRun'][_0xe90b('0xb')](this),this[_0xe90b('0xc')][_0xe90b('0xb')](this));};Agent['prototype'][_0xe90b('0xf')]=function(){this[_0xe90b('0xc')](!![]);};Agent['prototype'][_0xe90b('0xa')]=function(){logger[_0xe90b('0x10')](_0xe90b('0x11'),this[_0xe90b('0x6')]['id'],this['agent']['id']);if(_['isNil'](this[_0xe90b('0x8')][_0xe90b('0x12')][this[_0xe90b('0x7')]['id']])){logger[_0xe90b('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xe90b('0x6')]['id'],this['agent']['id']);setTimeout(this[_0xe90b('0x9')]['bind'](this),0x3e8);}else{if(this[_0xe90b('0x4')][_0xe90b('0x13')]||util[_0xe90b('0x14')](this[_0xe90b('0x6')]['id'],this[_0xe90b('0x8')]['agents'][this[_0xe90b('0x7')]['id']],this[_0xe90b('0x6')][_0xe90b('0x15')],![])){this[_0xe90b('0x8')][_0xe90b('0x12')][this[_0xe90b('0x7')]['id']]['busy']=!![];this['realtime'][_0xe90b('0x12')][this[_0xe90b('0x7')]['id']][_0xe90b('0x16')]=undefined;util[_0xe90b('0x17')](this[_0xe90b('0x5')],this[_0xe90b('0x6')]['id'],this['realtime'][_0xe90b('0x12')][this[_0xe90b('0x7')]['id']],null,this[_0xe90b('0x4')]);util[_0xe90b('0x18')](this[_0xe90b('0x6')]['id'],this['realtime'][_0xe90b('0x12')][this['agent']['id']],_0xe90b('0x19')+(this[_0xe90b('0x4')]['forcedOwnership']?_0xe90b('0x1a'):''));}else{logger[_0xe90b('0x10')](_0xe90b('0x1b'),this[_0xe90b('0x6')]['id'],this[_0xe90b('0x7')]['id']);setTimeout(this[_0xe90b('0x9')][_0xe90b('0xb')](this),0x3e8);}}};Agent[_0xe90b('0xe')][_0xe90b('0xc')]=function(_0x4c63e0){if(_['isNil'](this[_0xe90b('0x8')]['agents'][this[_0xe90b('0x7')]['id']])){return logger[_0xe90b('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xe90b('0x6')]['id'],this[_0xe90b('0x7')]['id']);}else{logger['debug']('[%s][AGENT]\x20timeout\x20with\x20%s',this['squeue']['id'],this[_0xe90b('0x7')]['id']);util[_0xe90b('0x1c')](this[_0xe90b('0x5')],this[_0xe90b('0x6')]['id'],this[_0xe90b('0x8')][_0xe90b('0x12')][this[_0xe90b('0x7')]['id']],null,this[_0xe90b('0x4')]);this[_0xe90b('0x8')][_0xe90b('0x12')][this[_0xe90b('0x7')]['id']][_0xe90b('0x1d')]=![];this[_0xe90b('0x8')]['agents'][this[_0xe90b('0x7')]['id']][_0xe90b('0x16')]=undefined;util[_0xe90b('0x18')](this[_0xe90b('0x6')]['id'],this[_0xe90b('0x8')][_0xe90b('0x12')][this[_0xe90b('0x7')]['id']],_0x4c63e0?_0xe90b('0x1e'):_0xe90b('0x1f'));}if(!_0x4c63e0){setTimeout(this[_0xe90b('0x9')][_0xe90b('0xb')](this),0x3e8);}};function agent(_0x31c2cb,_0x114651,_0x94d6b3,_0x2ea0ba){return new Agent(_0x31c2cb,_0x114651,_0x94d6b3,_0x2ea0ba);}module[_0xe90b('0x20')]=agent; \ No newline at end of file +var _0xb058=['bind','handleTimeout','timeout','handleRun','prototype','handleDrained','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','forcedOwnership','isAgentAvailable','busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','busy','STOP','TIMEOUT','lodash','./util','routing','notificationId','squeue','agent','realtime','push'];(function(_0x36966d,_0x148798){var _0x363eab=function(_0xe17b54){while(--_0xe17b54){_0x36966d['push'](_0x36966d['shift']());}};_0x363eab(++_0x148798);}(_0xb058,0x142));var _0x8b05=function(_0x2d9c6a,_0x59393d){_0x2d9c6a=_0x2d9c6a-0x0;var _0xf3c918=_0xb058[_0x2d9c6a];return _0xf3c918;};'use strict';var _=require(_0x8b05('0x0'));var uuid=require('uuid');var util=require(_0x8b05('0x1'));var logger=require('../../../../../config/logger')(_0x8b05('0x2'));var Agent=function(_0x871db4,_0x8328e5,_0x219802,_0x2d85d3){this[_0x8b05('0x3')]=uuid['v4']();this[_0x8b05('0x4')]=_0x871db4;this[_0x8b05('0x5')]=_0x8328e5;this[_0x8b05('0x6')]=_0x219802;this['routing']=_0x2d85d3;this[_0x8b05('0x4')][_0x8b05('0x7')](this['handleRun'][_0x8b05('0x8')](this),this[_0x8b05('0x9')][_0x8b05('0x8')](this));this[_0x8b05('0x4')]['on'](_0x8b05('0xa'),this['handleTimeout'][_0x8b05('0x8')](this));this[_0x8b05('0x4')]['on']('drained',this['handleDrained'][_0x8b05('0x8')](this));};Agent['prototype'][_0x8b05('0x7')]=function(){this[_0x8b05('0x4')][_0x8b05('0x7')](this[_0x8b05('0xb')][_0x8b05('0x8')](this),this[_0x8b05('0x9')][_0x8b05('0x8')](this));};Agent[_0x8b05('0xc')][_0x8b05('0xd')]=function(){this[_0x8b05('0x9')](!![]);};Agent[_0x8b05('0xc')][_0x8b05('0xb')]=function(){logger[_0x8b05('0xe')](_0x8b05('0xf'),this[_0x8b05('0x4')]['id'],this[_0x8b05('0x5')]['id']);if(_[_0x8b05('0x10')](this['realtime'][_0x8b05('0x11')][this[_0x8b05('0x5')]['id']])){logger[_0x8b05('0xe')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x8b05('0x4')]['id'],this[_0x8b05('0x5')]['id']);setTimeout(this['push'][_0x8b05('0x8')](this),0x3e8);}else{if(this[_0x8b05('0x2')][_0x8b05('0x12')]||util[_0x8b05('0x13')](this['squeue']['id'],this['realtime']['agents'][this[_0x8b05('0x5')]['id']],this['squeue']['channel'],![])){this[_0x8b05('0x6')][_0x8b05('0x11')][this['agent']['id']]['busy']=!![];this['realtime'][_0x8b05('0x11')][this[_0x8b05('0x5')]['id']][_0x8b05('0x14')]=undefined;util[_0x8b05('0x15')](this[_0x8b05('0x3')],this[_0x8b05('0x4')]['id'],this['realtime'][_0x8b05('0x11')][this[_0x8b05('0x5')]['id']],null,this['routing']);util[_0x8b05('0x16')](this[_0x8b05('0x4')]['id'],this['realtime'][_0x8b05('0x11')][this['agent']['id']],_0x8b05('0x17')+(this[_0x8b05('0x2')][_0x8b05('0x12')]?_0x8b05('0x18'):''));}else{logger[_0x8b05('0xe')](_0x8b05('0x19'),this['squeue']['id'],this[_0x8b05('0x5')]['id']);setTimeout(this[_0x8b05('0x7')][_0x8b05('0x8')](this),0x3e8);}}};Agent['prototype'][_0x8b05('0x9')]=function(_0x2e6d42){if(_[_0x8b05('0x10')](this[_0x8b05('0x6')][_0x8b05('0x11')][this['agent']['id']])){return logger['debug']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x8b05('0x4')]['id'],this['agent']['id']);}else{logger['debug']('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x8b05('0x4')]['id'],this[_0x8b05('0x5')]['id']);util[_0x8b05('0x1a')](this[_0x8b05('0x3')],this['squeue']['id'],this[_0x8b05('0x6')][_0x8b05('0x11')][this[_0x8b05('0x5')]['id']],null,this[_0x8b05('0x2')]);this[_0x8b05('0x6')][_0x8b05('0x11')][this['agent']['id']][_0x8b05('0x1b')]=![];this['realtime']['agents'][this[_0x8b05('0x5')]['id']][_0x8b05('0x14')]=undefined;util[_0x8b05('0x16')](this['squeue']['id'],this[_0x8b05('0x6')][_0x8b05('0x11')][this['agent']['id']],_0x2e6d42?_0x8b05('0x1c'):_0x8b05('0x1d'));}if(!_0x2e6d42){setTimeout(this[_0x8b05('0x7')][_0x8b05('0x8')](this),0x3e8);}};function agent(_0x5becac,_0x3dfe3e,_0x3ba8b3,_0x71698){return new Agent(_0x5becac,_0x3dfe3e,_0x3ba8b3,_0x71698);}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 4f6e6b3..2c38f1e 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 _0x8482=['agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','RINGING','busy','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','hideNotification','STOP','busyQueue','exports','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','realtime','push','handleTimeout','drained','handleDrained','bind','prototype','handleRun','isNil','queue','Agents','length'];(function(_0x4ae444,_0x14ea22){var _0x5aa1f0=function(_0x1c6dd9){while(--_0x1c6dd9){_0x4ae444['push'](_0x4ae444['shift']());}};_0x5aa1f0(++_0x14ea22);}(_0x8482,0x14e));var _0x2848=function(_0x31fa78,_0x3f2ae4){_0x31fa78=_0x31fa78-0x0;var _0x1d62b2=_0x8482[_0x31fa78];return _0x1d62b2;};'use strict';var _=require('lodash');var uuid=require(_0x2848('0x0'));var util=require(_0x2848('0x1'));var logger=require(_0x2848('0x2'))(_0x2848('0x3'));var Beepall=function(_0x3ac5ad,_0x212891,_0x7b4edd,_0x4309c1){this[_0x2848('0x4')]=uuid['v4']();this[_0x2848('0x5')]=_0x3ac5ad;this['queue']=_0x212891;this[_0x2848('0x6')]=_0x7b4edd;this[_0x2848('0x3')]=_0x4309c1;this['squeue'][_0x2848('0x7')](this['handleRun']['bind'](this),this[_0x2848('0x8')]['bind'](this));this[_0x2848('0x5')]['on']('timeout',this['handleTimeout']['bind'](this));this[_0x2848('0x5')]['on'](_0x2848('0x9'),this[_0x2848('0xa')][_0x2848('0xb')](this));};Beepall[_0x2848('0xc')][_0x2848('0x7')]=function(){this['squeue']['push'](this[_0x2848('0xd')][_0x2848('0xb')](this),this[_0x2848('0x8')]['bind'](this));};Beepall[_0x2848('0xc')][_0x2848('0xa')]=function(){this[_0x2848('0x8')](!![]);};Beepall['prototype'][_0x2848('0xd')]=function(){var _0x501a0e=!![];if(!_[_0x2848('0xe')](this['queue'])&&!_[_0x2848('0xe')](this[_0x2848('0xf')][_0x2848('0x10')])&&this['queue']['Agents']['length']>0x0){for(var _0x5f5616=0x0,_0x145ca3;_0x5f56160x0){for(var _0x33dbb6=0x0,_0x10e85a;_0x33dbb60x0&&_0x4d6706[_0x5c4184+'CurrentCapacity']>=_0x4d6706[_0x5c4184+_0x031f('0x1e')]){writeLog(_0x451328,_0x4d6706,_0x5c4184[_0x031f('0x1f')]()+_0x031f('0x20'));return![];}}return!![];};exports['showNotification']=function(_0x35af16,_0x3b2a51,_0x54b44e,_0x3847b2,_0x28a617){return sendNotification(!![],_0x35af16,_0x3b2a51,_0x54b44e,_0x3847b2,_0x28a617);};exports[_0x031f('0x21')]=function(_0x5395ea,_0xa308b,_0x114e34,_0xb6ed6c,_0xaf5bea){return sendNotification(![],_0x5395ea,_0xa308b,_0x114e34,_0xb6ed6c,_0xaf5bea);};exports[_0x031f('0x22')]=writeLog; \ No newline at end of file +var _0x31f0=['BUSY','PAUSE','hasOwnProperty','Capacity','toUpperCase','\x20MAXCAPACITY','hideNotification','writeLog','lodash','../utils','../../../../../config/environment','../../../../../config/logger','routing','redis','localhost','format','name','emit','user:save','split','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','[%s][QUEUE]\x20%s','notification:%s','save','remove','debug','isAgentAvailable'];(function(_0x32729c,_0xf5afd8){var _0x482cfd=function(_0x231471){while(--_0x231471){_0x32729c['push'](_0x32729c['shift']());}};_0x482cfd(++_0xf5afd8);}(_0x31f0,0xb7));var _0x031f=function(_0x36e0b9,_0x28bdef){_0x36e0b9=_0x36e0b9-0x0;var _0x587884=_0x31f0[_0x36e0b9];return _0x587884;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var utils=require(_0x031f('0x1'));var Redis=require('ioredis');var config=require(_0x031f('0x2'));var logger=require(_0x031f('0x3'))(_0x031f('0x4'));config[_0x031f('0x5')]=_['defaults'](config[_0x031f('0x5')],{'host':_0x031f('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function sendNotification(_0x56328c,_0x3dc98e,_0x487e65,_0x365f59,_0x4300b4,_0x2569b6){io['to'](util[_0x031f('0x7')]('user:%s',_0x365f59[_0x031f('0x8')]))[_0x031f('0x9')](_0x031f('0xa'),_0x365f59);var _0x439940=_0x2569b6||{};var _0x3dd729=_0x487e65[_0x031f('0xb')]('.');var _0x2202dc={'uniqueid':_0x3dc98e,'channel':_0x3dd729[0x0],'id':_0x3dd729[0x1],'title':_0x3dd729[0x0]+_0x031f('0xc'),'interactionId':_0x3dd729[0x2],'queue':_0x4300b4?_0x4300b4['name']:null,'sound':_0x439940[_0x031f('0xd')][_0x031f('0xe')],'shake':_0x439940[_0x031f('0xd')][_0x031f('0xf')]};try{if(!_0x439940[_0x031f('0x10')]){_0x439940[_0x031f('0x10')]={};}if(_0x4300b4){_0x439940[_0x031f('0x10')]['queue']=_0x4300b4;}else if(_0x439940[_0x031f('0x10')][_0x031f('0x11')]){delete _0x439940[_0x031f('0x10')][_0x031f('0x11')];}_0x2202dc[_0x031f('0x12')]=utils['getMustacheRender'](_0x439940['account'][_0x031f('0x13')],_0x439940);}catch(_0x3a10aa){_0x2202dc[_0x031f('0x12')]=_0x031f('0x14');logger['error'](util[_0x031f('0x7')](_0x031f('0x15'),_0x3dc98e,_0x3a10aa['message']));}io['to'](util[_0x031f('0x7')]('user:%s',_0x365f59[_0x031f('0x8')]))[_0x031f('0x9')](util[_0x031f('0x7')](_0x031f('0x16'),_0x56328c?_0x031f('0x17'):_0x031f('0x18')),_0x2202dc);}function writeLog(_0x1b76d6,_0x2825ef,_0xf76f1b){return logger[_0x031f('0x19')](util[_0x031f('0x7')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x1b76d6,_0x2825ef[_0x031f('0x8')],_0xf76f1b));}exports[_0x031f('0x1a')]=function(_0x451328,_0x4d6706,_0x5c4184,_0xa11a2b){if(_0x4d6706['busy']){writeLog(_0x451328,_0x4d6706,_0x031f('0x1b'));return![];}if(!_0x4d6706['online']){writeLog(_0x451328,_0x4d6706,'OFFLINE');return![];}if(_0x4d6706[_0x5c4184+'Pause']){writeLog(_0x451328,_0x4d6706,_0x031f('0x1c'));return![];}if(_0xa11a2b&&_0x4d6706[_0x031f('0x1d')](_0x5c4184+_0x031f('0x1e'))&&_0x4d6706[_0x031f('0x1d')](_0x5c4184+'CurrentCapacity')){if(_0x4d6706[_0x5c4184+_0x031f('0x1e')]>0x0&&_0x4d6706[_0x5c4184+'CurrentCapacity']>=_0x4d6706[_0x5c4184+_0x031f('0x1e')]){writeLog(_0x451328,_0x4d6706,_0x5c4184[_0x031f('0x1f')]()+_0x031f('0x20'));return![];}}return!![];};exports['showNotification']=function(_0x35af16,_0x3b2a51,_0x54b44e,_0x3847b2,_0x28a617){return sendNotification(!![],_0x35af16,_0x3b2a51,_0x54b44e,_0x3847b2,_0x28a617);};exports[_0x031f('0x21')]=function(_0x5395ea,_0xa308b,_0x114e34,_0xb6ed6c,_0xaf5bea){return sendNotification(![],_0x5395ea,_0xa308b,_0x114e34,_0xb6ed6c,_0xaf5bea);};exports[_0x031f('0x22')]=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 87e9e8f..8c73f00 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 _0x0ec7=['[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','next','getMustacheRender'];(function(_0x3ba3bc,_0x39d6c8){var _0xabb935=function(_0x4d30b0){while(--_0x4d30b0){_0x3ba3bc['push'](_0x3ba3bc['shift']());}};_0xabb935(++_0x39d6c8);}(_0x0ec7,0x1dc));var _0x70ec=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x0ec7[_0xf50820];return _0x2a9b10;};'use strict';var schema=require(_0x70ec('0x0'));var sh=require(_0x70ec('0x1'));var _=require(_0x70ec('0x2'));var utils=require(_0x70ec('0x3'));var logger=require(_0x70ec('0x4'))(_0x70ec('0x5'));var system=schema({'command':{'type':_0x70ec('0x6'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x70ec('0x7')]=function(_0x2f6146,_0x4a8e91){return function(_0x5ece4e){try{var _0x225c64={'command':_0x4a8e91[0x0]};var _0x25500a=system['validate'](_0x225c64,{'typecast':!![]});if(_0x25500a[_0x70ec('0x8')]){logger[_0x70ec('0x9')](_0x70ec('0xa'),_0x2f6146,_[_0x70ec('0xb')](_0x25500a,_0x70ec('0xc'))[_0x70ec('0xd')](',\x20'));logger[_0x70ec('0xe')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x2f6146);_0x5ece4e[_0x70ec('0xf')]();}else{var _0x3754d6=this;var _0x5834a4=utils[_0x70ec('0x10')](_0x4a8e91[0x0],this);logger[_0x70ec('0xe')](_0x70ec('0x11'),_0x2f6146,_0x5834a4);sh[_0x70ec('0x12')](_[_0x70ec('0x13')](_0x5834a4),function(_0x54f479,_0x430820){logger[_0x70ec('0xe')](_0x70ec('0x14'),_0x2f6146,_0x54f479);if(_0x54f479==0x0){var _0x41c02a=_0x430820[_0x70ec('0x15')](/(\r\n|\n|\r)/gm,'');if(_[_0x70ec('0x16')](_0x4a8e91[0x1])||_[_0x70ec('0x17')](_0x4a8e91[0x1])){logger[_0x70ec('0xe')](_0x70ec('0x18'),_0x2f6146);_0x3754d6[_0x70ec('0x19')][_0x4a8e91[0x1]]=_0x41c02a;}else{logger[_0x70ec('0xe')](_0x70ec('0x1a'),_0x2f6146,_0x4a8e91[0x1],_0x41c02a);_0x3754d6[_0x70ec('0x19')][_0x4a8e91[0x1]]=_0x41c02a;}}_0x5ece4e[_0x70ec('0xf')]();});}}catch(_0x46a651){logger[_0x70ec('0x9')]('[%s][SYSTEM]\x20%s',_0x2f6146,_['isObject'](_0x46a651)?JSON[_0x70ec('0x1b')](_0x46a651):_0x46a651);logger['info'](_0x70ec('0x1c'),_0x2f6146);_0x5ece4e[_0x70ec('0xf')]();}};}; \ No newline at end of file +var _0x6ed5=['stringify','validate','shelljs','./utils','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','error','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','replace','isNil','isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','[%s][SYSTEM]\x20%s','isObject'];(function(_0x101428,_0x106311){var _0x12f1c3=function(_0x3e1c28){while(--_0x3e1c28){_0x101428['push'](_0x101428['shift']());}};_0x12f1c3(++_0x106311);}(_0x6ed5,0xe2));var _0x56ed=function(_0x35559,_0x36ab81){_0x35559=_0x35559-0x0;var _0x368237=_0x6ed5[_0x35559];return _0x368237;};'use strict';var schema=require(_0x56ed('0x0'));var sh=require(_0x56ed('0x1'));var _=require('lodash');var utils=require(_0x56ed('0x2'));var logger=require(_0x56ed('0x3'))(_0x56ed('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':_0x56ed('0x5')}});exports['consequence']=function(_0xaafb6b,_0x405929){return function(_0xbdf302){try{var _0x21818d={'command':_0x405929[0x0]};var _0x2f1792=system[_0x56ed('0x0')](_0x21818d,{'typecast':!![]});if(_0x2f1792['length']){logger[_0x56ed('0x6')]('[%s][SYSTEM]\x20%s',_0xaafb6b,_[_0x56ed('0x7')](_0x2f1792,_0x56ed('0x8'))[_0x56ed('0x9')](',\x20'));logger[_0x56ed('0xa')](_0x56ed('0xb'),_0xaafb6b);_0xbdf302[_0x56ed('0xc')]();}else{var _0x12183c=this;var _0x5be598=utils[_0x56ed('0xd')](_0x405929[0x0],this);logger['info'](_0x56ed('0xe'),_0xaafb6b,_0x5be598);sh[_0x56ed('0xf')](_[_0x56ed('0x10')](_0x5be598),function(_0x17c4dd,_0x4f4eb1){logger[_0x56ed('0xa')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0xaafb6b,_0x17c4dd);if(_0x17c4dd==0x0){var _0x7a20f=_0x4f4eb1[_0x56ed('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0x56ed('0x12')](_0x405929[0x1])||_[_0x56ed('0x13')](_0x405929[0x1])){logger[_0x56ed('0xa')]('[%s][SYSTEM]\x20no\x20variable',_0xaafb6b);_0x12183c[_0x56ed('0x14')][_0x405929[0x1]]=_0x7a20f;}else{logger[_0x56ed('0xa')](_0x56ed('0x15'),_0xaafb6b,_0x405929[0x1],_0x7a20f);_0x12183c[_0x56ed('0x14')][_0x405929[0x1]]=_0x7a20f;}}_0xbdf302['next']();});}}catch(_0x1627cd){logger[_0x56ed('0x6')](_0x56ed('0x16'),_0xaafb6b,_[_0x56ed('0x17')](_0x1627cd)?JSON[_0x56ed('0x18')](_0x1627cd):_0x1627cd);logger[_0x56ed('0xa')](_0x56ed('0xb'),_0xaafb6b);_0xbdf302[_0x56ed('0xc')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index b66ec72..f3189aa 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 _0x3977=['TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][TAG]\x20%s','map','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','error','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','number'];(function(_0x39fb6a,_0x8b07ae){var _0x1452a1=function(_0x391804){while(--_0x391804){_0x39fb6a['push'](_0x39fb6a['shift']());}};_0x1452a1(++_0x8b07ae);}(_0x3977,0x93));var _0x7397=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x3977[_0x5b644e];return _0x49c6bf;};'use strict';var schema=require(_0x7397('0x0'));var _=require(_0x7397('0x1'));var rpc={'chatInteraction':require(_0x7397('0x2')),'openchannelInteraction':require(_0x7397('0x3')),'smsInteraction':require(_0x7397('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x7397('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x7397('0x6'))(_0x7397('0x7'));var tag=schema({'tag':{'type':_0x7397('0x8'),'required':!![],'message':_0x7397('0x9')}});exports[_0x7397('0xa')]=function(_0x251e80,_0x48db5d,_0x154256,_0x3fe25f){return function(_0x1d5490){try{var _0x1d3476={'tag':_0x48db5d[0x0]};var _0x1f3659=tag[_0x7397('0x0')](_0x1d3476,{'typecast':!![]});if(_0x1f3659[_0x7397('0xb')]){logger['error'](_0x7397('0xc'),_0x251e80,_[_0x7397('0xd')](_0x1f3659,_0x7397('0xe'))['join'](',\x20'));logger[_0x7397('0xf')](_0x7397('0x10'),_0x251e80);_0x1d5490[_0x7397('0x11')]();}else{var _0x2e362d={'ids':[_0x48db5d[0x0]]};if(rpc[_0x3fe25f[_0x7397('0x12')]+_0x7397('0x13')]){rpc[_0x3fe25f['channel']+_0x7397('0x13')]['addTags'](_0x3fe25f[_0x7397('0x14')]['id'],_0x2e362d)['then'](function(_0x5addf8){logger[_0x7397('0xf')](_0x7397('0x15'),_0x251e80,_0x48db5d[0x1],_0x3fe25f['channel'],_0x3fe25f[_0x7397('0x14')]['id']);})[_0x7397('0x16')](function(_0x26dfe2){logger['error'](_0x7397('0xc'),_0x251e80,JSON[_0x7397('0x17')](_0x26dfe2));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x251e80);})['finally'](function(){_0x1d5490['next']();});}}}catch(_0x1483e5){logger[_0x7397('0x18')]('[%s][TAG]\x20%s',_0x251e80,_[_0x7397('0x19')](_0x1483e5)?JSON['stringify'](_0x1483e5):_0x1483e5);logger[_0x7397('0xf')](_0x7397('0x10'),_0x251e80);_0x1d5490[_0x7397('0x11')]();}};}; \ No newline at end of file +var _0x6d71=['channel','Interaction','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','consequence','length','[%s][TAG]\x20%s','map','message','join','info','next'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6d71,0x9c));var _0x16d7=function(_0x25f05f,_0x59082c){_0x25f05f=_0x25f05f-0x0;var _0x2fed8c=_0x6d71[_0x25f05f];return _0x2fed8c;};'use strict';var schema=require(_0x16d7('0x0'));var _=require(_0x16d7('0x1'));var rpc={'chatInteraction':require(_0x16d7('0x2')),'openchannelInteraction':require(_0x16d7('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x16d7('0x4')),'faxInteraction':require(_0x16d7('0x5')),'whatsappInteraction':require(_0x16d7('0x6'))};var logger=require(_0x16d7('0x7'))(_0x16d7('0x8'));var tag=schema({'tag':{'type':_0x16d7('0x9'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x16d7('0xa')]=function(_0x52a04f,_0x3ce9ac,_0xb45393,_0x15b20b){return function(_0x192c39){try{var _0x2effe2={'tag':_0x3ce9ac[0x0]};var _0x4e00bf=tag[_0x16d7('0x0')](_0x2effe2,{'typecast':!![]});if(_0x4e00bf[_0x16d7('0xb')]){logger['error'](_0x16d7('0xc'),_0x52a04f,_[_0x16d7('0xd')](_0x4e00bf,_0x16d7('0xe'))[_0x16d7('0xf')](',\x20'));logger[_0x16d7('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x52a04f);_0x192c39[_0x16d7('0x11')]();}else{var _0x209135={'ids':[_0x3ce9ac[0x0]]};if(rpc[_0x15b20b[_0x16d7('0x12')]+_0x16d7('0x13')]){rpc[_0x15b20b[_0x16d7('0x12')]+_0x16d7('0x13')][_0x16d7('0x14')](_0x15b20b['interaction']['id'],_0x209135)[_0x16d7('0x15')](function(_0x1d44f3){logger[_0x16d7('0x10')](_0x16d7('0x16'),_0x52a04f,_0x3ce9ac[0x1],_0x15b20b[_0x16d7('0x12')],_0x15b20b['interaction']['id']);})[_0x16d7('0x17')](function(_0x356684){logger[_0x16d7('0x18')](_0x16d7('0xc'),_0x52a04f,JSON[_0x16d7('0x19')](_0x356684));logger[_0x16d7('0x10')](_0x16d7('0x1a'),_0x52a04f);})[_0x16d7('0x1b')](function(){_0x192c39['next']();});}}}catch(_0x55b461){logger[_0x16d7('0x18')]('[%s][TAG]\x20%s',_0x52a04f,_[_0x16d7('0x1c')](_0x55b461)?JSON[_0x16d7('0x19')](_0x55b461):_0x55b461);logger['info'](_0x16d7('0x1a'),_0x52a04f);_0x192c39[_0x16d7('0x11')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 725133f..e3416ac 100644 --- a/server/services/routing/server/applications/tvox.js +++ b/server/services/routing/server/applications/tvox.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb256=['POST','application/json-rpc','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','&serviceId=','&sessionId=','info','catch','error','[%s][TVOX]\x20%s','isObject','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','lodash','replace','\x20-\x20','includes','push','?params=','urlOnRing','title','login','params','stringify','utf8'];(function(_0x364069,_0x1ba37d){var _0xaaba44=function(_0x46bb14){while(--_0x46bb14){_0x364069['push'](_0x364069['shift']());}};_0xaaba44(++_0x1ba37d);}(_0xb256,0x8d));var _0x6b25=function(_0x5da27f,_0x504b76){_0x5da27f=_0x5da27f-0x0;var _0x54a3fb=_0xb256[_0x5da27f];return _0x54a3fb;};'use strict';var rp=require(_0x6b25('0x0'));var logger=require(_0x6b25('0x1'))('routing');var _=require(_0x6b25('0x2'));var arr=[];exports['consequence']=function(_0x444051,_0x3a7dee){return function(_0x34a216){var _0x3fcba0=_0x3a7dee[0xa];var _0x25121a=_0x3a7dee[0xb];var _0x4bdb00=_0x3a7dee[0xc];var _0x2224a4=_0x3a7dee[0xd];var _0x31ae54=_0x3a7dee[0xe];var _0x59c75f=_0x3a7dee[0xf][_0x6b25('0x3')](/\n/g,_0x6b25('0x4'));var _0x36c197=_0x3a7dee[0x10][_0x6b25('0x3')](/\n/g,'\x20');if(!arr[_0x6b25('0x5')](_0x25121a)){arr[_0x6b25('0x6')](_0x25121a);var _0x40f2a5=_0x3a7dee[0x3];var _0x570add=_0x3a7dee[0x4];var _0x31abcd=_0x3a7dee[0x1];var _0x22b620=_0x3a7dee[0x0];var _0x595a8f={};_0x595a8f['urlOnAnswer']=_0x3a7dee[0x8]+_0x6b25('0x7')+_0x4bdb00+'|'+_0x3fcba0+'|'+_0x2224a4+'|'+_0x25121a+'|'+_0x31ae54;_0x595a8f[_0x6b25('0x8')]=_0x3a7dee[0x7]+_0x6b25('0x7')+_0x4bdb00+'|'+_0x3fcba0+'|'+_0x2224a4+'|'+_0x25121a+'|'+_0x31ae54+'|'+_0x59c75f+'|'+_0x36c197;_0x595a8f[_0x6b25('0x9')]=_0x3a7dee[0x9];var _0x24342b={};_0x24342b['jsonrpc']='2.0';_0x24342b['method']=_0x6b25('0xa');var _0x4d472a=[];_0x4d472a[_0x6b25('0x6')](_0x3a7dee[0x2]);_0x4d472a[_0x6b25('0x6')](_0x3a7dee[0x5]);_0x4d472a['push'](_0x3a7dee[0x6]);_0x24342b[_0x6b25('0xb')]=_0x4d472a;_0x24342b['id']=0x1;var _0x39d2cc=JSON[_0x6b25('0xc')](_0x24342b);var _0x35efd1={'encoding':_0x6b25('0xd'),'method':_0x6b25('0xe'),'timeout':0x2710,'url':_0x40f2a5,'headers':{'Content-Type':_0x6b25('0xf')},'body':_0x39d2cc};return rp(_0x35efd1)[_0x6b25('0x10')](function(_0xd3c12a){const _0x333fef=JSON[_0x6b25('0x11')](_0xd3c12a);if(!_0x333fef[_0x6b25('0x12')][_0x6b25('0x13')]){throw new Error(_0x6b25('0x14'));}var _0x53eef6=_0x25121a;var _0x449dae='channelId='+_0x31abcd+_0x6b25('0x15')+_0x22b620+_0x6b25('0x16')+_0x53eef6+'&data='+JSON[_0x6b25('0xc')](_0x595a8f);var _0x149125=_0x570add+'?'+_0x449dae;return rp(_0x149125);})['then'](function(_0x43552a){logger[_0x6b25('0x17')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x444051,_0x43552a);_0x34a216['stop']();})[_0x6b25('0x18')](function(_0x4d4c2c){logger[_0x6b25('0x19')](_0x6b25('0x1a'),_0x444051,_[_0x6b25('0x1b')](_0x4d4c2c)?JSON[_0x6b25('0xc')](_0x4d4c2c):_0x4d4c2c);_0x34a216[_0x6b25('0x1c')]();});}else{logger[_0x6b25('0x17')](_0x6b25('0x1d'),_0x444051);_0x34a216[_0x6b25('0x1e')]();}};}; \ No newline at end of file +var _0x5308=['[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','2.0','method','login','push','stringify','utf8','POST','application/json-rpc','then','parse','result','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','isObject'];(function(_0x41cab6,_0x3d979d){var _0x149fe1=function(_0x10c38e){while(--_0x10c38e){_0x41cab6['push'](_0x41cab6['shift']());}};_0x149fe1(++_0x3d979d);}(_0x5308,0x160));var _0x8530=function(_0x3358ba,_0x24c5fc){_0x3358ba=_0x3358ba-0x0;var _0x296e73=_0x5308[_0x3358ba];return _0x296e73;};'use strict';var rp=require('request-promise');var logger=require(_0x8530('0x0'))(_0x8530('0x1'));var _=require(_0x8530('0x2'));var arr=[];exports[_0x8530('0x3')]=function(_0x2e7aa8,_0xc9ad03){return function(_0x105811){var _0x729ac=_0xc9ad03[0xa];var _0x4beaef=_0xc9ad03[0xb];var _0x165436=_0xc9ad03[0xc];var _0x38f62e=_0xc9ad03[0xd];var _0x55ce40=_0xc9ad03[0xe];var _0x1c3053=_0xc9ad03[0xf][_0x8530('0x4')](/\n/g,_0x8530('0x5'));var _0x116fc0=_0xc9ad03[0x10][_0x8530('0x4')](/\n/g,'\x20');if(!arr[_0x8530('0x6')](_0x4beaef)){arr['push'](_0x4beaef);var _0x262d78=_0xc9ad03[0x3];var _0x8e94aa=_0xc9ad03[0x4];var _0x205e84=_0xc9ad03[0x1];var _0x116394=_0xc9ad03[0x0];var _0x83c88a={};_0x83c88a[_0x8530('0x7')]=_0xc9ad03[0x8]+_0x8530('0x8')+_0x165436+'|'+_0x729ac+'|'+_0x38f62e+'|'+_0x4beaef+'|'+_0x55ce40;_0x83c88a[_0x8530('0x9')]=_0xc9ad03[0x7]+_0x8530('0x8')+_0x165436+'|'+_0x729ac+'|'+_0x38f62e+'|'+_0x4beaef+'|'+_0x55ce40+'|'+_0x1c3053+'|'+_0x116fc0;_0x83c88a[_0x8530('0xa')]=_0xc9ad03[0x9];var _0x8e1b91={};_0x8e1b91[_0x8530('0xb')]=_0x8530('0xc');_0x8e1b91[_0x8530('0xd')]=_0x8530('0xe');var _0xf95099=[];_0xf95099[_0x8530('0xf')](_0xc9ad03[0x2]);_0xf95099[_0x8530('0xf')](_0xc9ad03[0x5]);_0xf95099[_0x8530('0xf')](_0xc9ad03[0x6]);_0x8e1b91['params']=_0xf95099;_0x8e1b91['id']=0x1;var _0xa10920=JSON[_0x8530('0x10')](_0x8e1b91);var _0x520dd3={'encoding':_0x8530('0x11'),'method':_0x8530('0x12'),'timeout':0x2710,'url':_0x262d78,'headers':{'Content-Type':_0x8530('0x13')},'body':_0xa10920};return rp(_0x520dd3)[_0x8530('0x14')](function(_0x11bf16){const _0x1afd50=JSON[_0x8530('0x15')](_0x11bf16);if(!_0x1afd50[_0x8530('0x16')]['logged']){throw new Error(_0x8530('0x17'));}var _0x515f2e=_0x4beaef;var _0x147f03=_0x8530('0x18')+_0x205e84+_0x8530('0x19')+_0x116394+'&sessionId='+_0x515f2e+_0x8530('0x1a')+JSON[_0x8530('0x10')](_0x83c88a);var _0x2fdf01=_0x8e94aa+'?'+_0x147f03;return rp(_0x2fdf01);})['then'](function(_0x7e6c56){logger[_0x8530('0x1b')](_0x8530('0x1c'),_0x2e7aa8,_0x7e6c56);_0x105811[_0x8530('0x1d')]();})[_0x8530('0x1e')](function(_0x124213){logger[_0x8530('0x1f')]('[%s][TVOX]\x20%s',_0x2e7aa8,_[_0x8530('0x20')](_0x124213)?JSON[_0x8530('0x10')](_0x124213):_0x124213);_0x105811['stop']();});}else{logger[_0x8530('0x1b')](_0x8530('0x21'),_0x2e7aa8);_0x105811[_0x8530('0x22')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index fe4ed62..ed4acf9 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0xf2851f,_0x46825e){var _0x28464c=function(_0x2866b7){while(--_0x2866b7){_0xf2851f['push'](_0xf2851f['shift']());}};_0x28464c(++_0x46825e);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x11e3d3,_0x284654){var _0x299b83=function(_0x44dffb){while(--_0x44dffb){_0x11e3d3['push'](_0x11e3d3['shift']());}};_0x299b83(++_0x284654);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index dee6961..bcc4441 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 _0x4058=['jayson/promise','bluebird','./applications/utils','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','IntervalId','isNil','interval','rules','channel','message','interaction','applications','isArray','length','existsSync','join','app','.js','toLowerCase','autoreply','split','mail','push','slice','dialogflow','appdata','dialogflowv2','amazonlex','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','priority','info','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','Applications\x20executed','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','agent','agents','busy','busyQueue','end','QueueReport','update','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','stringify','listen','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path'];(function(_0x4fba8f,_0x588d9c){var _0x577e7e=function(_0x242c53){while(--_0x242c53){_0x4fba8f['push'](_0x4fba8f['shift']());}};_0x577e7e(++_0x588d9c);}(_0x4058,0x129));var _0x8405=function(_0x1950e8,_0x579ffd){_0x1950e8=_0x1950e8-0x0;var _0xc55f12=_0x4058[_0x1950e8];return _0xc55f12;};'use strict';var _=require(_0x8405('0x0'));var util=require(_0x8405('0x1'));var path=require(_0x8405('0x2'));var fs=require('fs');var jayson=require(_0x8405('0x3'));var BPromise=require(_0x8405('0x4'));var utils=require(_0x8405('0x5'));var logger=require(_0x8405('0x6'))(_0x8405('0x7'));var rpc={'openchannelQueueReport':require(_0x8405('0x8')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x8405('0x9')),'whatsappQueueReport':require(_0x8405('0xa'))};var RuleEngine=require(_0x8405('0xb'));function getId(_0x1322e5,_0x1cb061,_0x479c97){return util[_0x8405('0xc')](_0x8405('0xd'),_0x1322e5,_0x1cb061||0x0,_0x479c97||0x0);}function getIntervals(_0x8a537e,_0x53bd7c){var _0x30705f=[];if(!_['isNil'](_0x53bd7c[_0x8405('0xe')])&&!_[_0x8405('0xf')](_0x8a537e[_0x53bd7c['IntervalId']])&&!_[_0x8405('0xf')](_0x8a537e[_0x53bd7c[_0x8405('0xe')]]['Intervals'])){_0x30705f=_['map'](_0x8a537e[_0x53bd7c['IntervalId']]['Intervals'],_0x8405('0x10'));}else if(!_['isNil'](_0x53bd7c['interval'])){_0x30705f=[_0x53bd7c['interval']];}return _0x30705f;}exports['listen']=function(_0x548c94){_0x548c94[_0x8405('0x11')]={};return new BPromise(function(_0x238633,_0x5a3776){var _0x1722d3={'Start':function(_0xa60bb4){var _0x221cf8=this;return new Promise(function(_0x422822,_0x58eb66){if(_0xa60bb4){try{var _0x218fe7=[];var _0x2d7601=getId(_0xa60bb4[_0x8405('0x12')],_0xa60bb4[_0x8405('0x13')]?_0xa60bb4[_0x8405('0x13')]['id']:0x0,_0xa60bb4[_0x8405('0x14')]?_0xa60bb4[_0x8405('0x14')]['id']:0x0);if(_0xa60bb4[_0x8405('0x15')]&&_[_0x8405('0x16')](_0xa60bb4[_0x8405('0x15')])&&_0xa60bb4[_0x8405('0x15')][_0x8405('0x17')]){for(var _0x131857=0x0;_0x131857<_0xa60bb4[_0x8405('0x15')][_0x8405('0x17')];_0x131857+=0x1){var _0x42c191=_0xa60bb4[_0x8405('0x15')][_0x131857];if(fs[_0x8405('0x18')](path[_0x8405('0x19')](__dirname,_0x8405('0x15'),_0x42c191[_0x8405('0x1a')]+_0x8405('0x1b')))){var _0x42b34d=[];switch(_0x42c191[_0x8405('0x1a')][_0x8405('0x1c')]()){case _0x8405('0x1d'):var _0x57130a=_0x42c191['appdata'][_0x8405('0x1e')](',');if(_0xa60bb4[_0x8405('0x12')]===_0x8405('0x1f')){_0x42b34d['push'](_0x57130a[0x0]);_0x42b34d[_0x8405('0x20')](_0x57130a[0x1]);_0x42b34d['push'](_0x57130a[_0x8405('0x21')](0x2,_0x57130a['length'])[_0x8405('0x19')](','));}else{_0x42b34d[_0x8405('0x20')](_0x57130a[0x0]);_0x42b34d[_0x8405('0x20')](_0x57130a[_0x8405('0x21')](0x1,_0x57130a[_0x8405('0x17')])[_0x8405('0x19')](','));}break;case _0x8405('0x22'):var _0x178ef6=_0x42c191[_0x8405('0x23')][_0x8405('0x1e')](',');_0x42b34d[_0x8405('0x20')](_0x178ef6[0x0]);_0x42b34d[_0x8405('0x20')](_0x178ef6[0x1]);_0x42b34d['push'](_0x178ef6[_0x8405('0x21')](0x2,_0x178ef6['length'])['join'](','));break;case _0x8405('0x24'):var _0x41f06a=_0x42c191[_0x8405('0x23')][_0x8405('0x1e')](',');_0x42b34d[_0x8405('0x20')](_0x41f06a[0x0]);_0x42b34d[_0x8405('0x20')](_0x41f06a[0x1]);_0x42b34d[_0x8405('0x20')](_0x41f06a[0x2]);_0x42b34d[_0x8405('0x20')](_0x41f06a[0x3]);_0x42b34d[_0x8405('0x20')](_0x41f06a[_0x8405('0x21')](0x4,_0x41f06a[_0x8405('0x17')])[_0x8405('0x19')](','));break;case _0x8405('0x25'):var _0x54ffcc=_0x42c191[_0x8405('0x23')][_0x8405('0x1e')](',');_0x42b34d['push'](_0x54ffcc[0x0]);_0x42b34d[_0x8405('0x20')](_0x54ffcc[0x1]);_0x42b34d[_0x8405('0x20')](_0x54ffcc[0x2]);_0x42b34d[_0x8405('0x20')](_0x54ffcc[0x3]);_0x42b34d['push'](_0x54ffcc[_0x8405('0x21')](0x4,_0x54ffcc[_0x8405('0x17')])[_0x8405('0x19')](','));break;case'message':_0x42b34d[_0x8405('0x20')](_0x42c191[_0x8405('0x23')]);break;case'tag':_0x42b34d[_0x8405('0x20')](_0x42c191['TagId']);_0x42b34d[_0x8405('0x20')](_0x42c191[_0x8405('0x23')]);break;case _0x8405('0x26'):var _0xe8de32=utils[_0x8405('0x27')](_0xa60bb4[_0x8405('0x28')][_0x8405('0x29')],_0xa60bb4);var _0xf11ce=_0x42c191[_0x8405('0x23')][_0x8405('0x1e')](',');_0x42b34d[_0x8405('0x20')](_0xf11ce[0x0]);_0x42b34d[_0x8405('0x20')](_0xf11ce[0x1]);_0x42b34d['push'](_0xf11ce[0x2]);_0x42b34d[_0x8405('0x20')](_0xf11ce[0x3]);_0x42b34d['push'](_0xf11ce[0x4]);_0x42b34d['push'](_0xf11ce[0x5]);_0x42b34d[_0x8405('0x20')](_0xf11ce[0x6]);_0x42b34d[_0x8405('0x20')](_0xf11ce[0x7]);_0x42b34d['push'](_0xf11ce[0x8]);_0x42b34d[_0x8405('0x20')](_0xf11ce[0x9]);_0x42b34d[_0x8405('0x20')](_0xf11ce[0xa]);_0x42b34d[_0x8405('0x20')](_0xa60bb4[_0x8405('0x14')]['id']);_0x42b34d[_0x8405('0x20')](_0xa60bb4['message']['id']);_0x42b34d[_0x8405('0x20')](_0x42c191[_0x8405('0x2a')]);_0x42b34d[_0x8405('0x20')](_0xa60bb4[_0x8405('0x14')][_0x8405('0x2b')]);_0x42b34d['push'](_0xa60bb4[_0x8405('0x2c')][_0x8405('0x2c')]);_0x42b34d[_0x8405('0x20')](_0xe8de32);break;default:_0x42b34d=_[_0x8405('0xf')](_0x42c191[_0x8405('0x23')])?[]:_0x42c191[_0x8405('0x23')]['split'](',');}var _0xfe699c={'id':util[_0x8405('0xc')](_0x8405('0x2d'),_0x2d7601,_0x42c191['id'],_0x42c191[_0x8405('0x1a')]),'condition':require(_0x8405('0x2e'))[_0x8405('0x2f')](_0x2d7601,getIntervals(_0x548c94[_0x8405('0x30')],_0x42c191),_0x548c94),'consequence':require('./applications/'+_0x42c191[_0x8405('0x1a')])['consequence'](_0x2d7601,_0x42b34d,_0x548c94,_0xa60bb4),'p':_0x42c191[_0x8405('0x31')]||0x0};logger[_0x8405('0x32')]('Push\x20new\x20rule',_0xfe699c['id'],_0x8405('0x33'),getIntervals(_0x548c94[_0x8405('0x30')],_0x42c191)[_0x8405('0x19')](_0x8405('0x34')));_0x218fe7[_0x8405('0x20')](_0xfe699c);}else{logger[_0x8405('0x35')](_0x8405('0x36'),path[_0x8405('0x19')](__dirname,_0x8405('0x15'),_0x42c191[_0x8405('0x1a')]+'.js'));}}_0x548c94['rules'][_0x2d7601]=new RuleEngine(_0x218fe7);_0x548c94[_0x8405('0x11')][_0x2d7601]['execute'](_0xa60bb4,function(_0x21bc90){logger[_0x8405('0x32')](_0x8405('0x37'),JSON['stringify'](_0x21bc90[_0x8405('0x38')]));if(_0x548c94[_0x8405('0x11')][_0x2d7601]){_0x548c94['rules'][_0x2d7601][_0x8405('0x39')](_0x8405('0x3a'));}});return _0x422822({'code':0xc8,'message':_0xa60bb4});}else{logger[_0x8405('0x32')](_0x8405('0x3b'));return _0x422822({'code':0xc8,'message':_0xa60bb4});}}catch(_0x55d189){logger[_0x8405('0x35')](_0x55d189[_0x8405('0x3c')]);return _0x58eb66(_0x221cf8['error'](0x1f4,_0x55d189));}}return _0x58eb66('routing\x20is\x20empty');});},'AcceptMessage':function(_0x5d0f1b){var _0x84020b=this;return new Promise(function(_0xb414fe,_0x1c0350){if(_0x5d0f1b[_0x8405('0x3d')]&&_0x5d0f1b['agent']['id']){if(_0x548c94['agents'][_0x5d0f1b[_0x8405('0x3d')]['id']]){_0x548c94[_0x8405('0x3e')][_0x5d0f1b[_0x8405('0x3d')]['id']][_0x8405('0x3f')]=![];_0x548c94[_0x8405('0x3e')][_0x5d0f1b[_0x8405('0x3d')]['id']][_0x8405('0x40')]=undefined;}}if(_0x5d0f1b[_0x8405('0x13')]&&_0x5d0f1b['message']['id']){try{var _0x19c6c8=getId(_0x5d0f1b['channel'],_0x5d0f1b[_0x8405('0x13')]?_0x5d0f1b[_0x8405('0x13')]['id']:0x0,_0x5d0f1b[_0x8405('0x14')]?_0x5d0f1b[_0x8405('0x14')]['id']:0x0);if(_0x548c94[_0x8405('0x11')][_0x19c6c8]){_0x548c94[_0x8405('0x11')][_0x19c6c8][_0x8405('0x39')](_0x8405('0x41'));if(rpc[_0x5d0f1b['channel']+_0x8405('0x42')]){rpc[_0x5d0f1b[_0x8405('0x12')]+_0x8405('0x42')][_0x8405('0x43')](_0x19c6c8,{'UserId':_0x5d0f1b['message']['UserId']})[_0x8405('0x44')](function(){logger[_0x8405('0x35')](_0x8405('0x45'));});}}return _0xb414fe({'code':0xc8,'message':_0x5d0f1b});}catch(_0x2c8432){logger[_0x8405('0x35')](_0x2c8432[_0x8405('0x3c')]);return _0x1c0350(_0x84020b[_0x8405('0x35')](0x1f4,_0x2c8432));}}logger['error']('message\x20is\x20empty');return _0x1c0350(_0x84020b[_0x8405('0x35')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x63d4e1){var _0x24f6f9=this;return new Promise(function(_0x41400c,_0x4b8443){if(_0x63d4e1['agent']&&_0x63d4e1[_0x8405('0x3d')]['id']){try{if(_0x548c94['agents'][_0x63d4e1[_0x8405('0x3d')]['id']]){_0x548c94[_0x8405('0x3e')][_0x63d4e1[_0x8405('0x3d')]['id']][_0x8405('0x3f')]=![];_0x548c94[_0x8405('0x3e')][_0x63d4e1[_0x8405('0x3d')]['id']][_0x8405('0x40')]=undefined;}return _0x41400c({'code':0xc8,'message':_0x63d4e1});}catch(_0x22d117){logger[_0x8405('0x35')](_0x22d117['stack']);return _0x4b8443(_0x24f6f9[_0x8405('0x35')](0x1f4,_0x22d117));}}logger[_0x8405('0x35')](_0x8405('0x46'));return _0x4b8443(_0x24f6f9[_0x8405('0x35')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x4719ea){var _0x4025c6=this;return new Promise(function(_0x47760c,_0x22d378){if(_0x4719ea[_0x8405('0x12')]&&_0x4719ea[_0x8405('0x14')]&&_0x4719ea['interaction']['id']){try{var _0x428140=getId(_0x4719ea[_0x8405('0x12')],_0x4719ea[_0x8405('0x13')]?_0x4719ea['message']['id']:0x0,_0x4719ea[_0x8405('0x14')]?_0x4719ea[_0x8405('0x14')]['id']:0x0);if(_0x548c94[_0x8405('0x11')][_0x428140]){_0x548c94[_0x8405('0x11')][_0x428140][_0x8405('0x39')](_0x8405('0x41'));}return _0x47760c({'code':0xc8,'message':_0x4719ea});}catch(_0x283dcb){logger[_0x8405('0x35')](_0x283dcb[_0x8405('0x3c')]);return _0x22d378(_0x4025c6[_0x8405('0x35')](0x1f4,_0x283dcb));}}logger['error'](_0x8405('0x46'));return _0x22d378(_0x4025c6['error'](0x1f4,_0x8405('0x46')));});},'AgentCapacity':function(_0x4f96f8){var _0x259383=this;return new Promise(function(_0x2183af,_0x13018d){if(_0x548c94[_0x8405('0x3e')][_0x8405('0x47')](_0x4f96f8['id'])){for(var _0x5a4b6c in _0x4f96f8[_0x8405('0x48')]){if(_0x4f96f8['capacity']['hasOwnProperty'](_0x5a4b6c)){if(_0x548c94[_0x8405('0x3e')][_0x4f96f8['id']]['hasOwnProperty'](_0x5a4b6c+_0x8405('0x49'))){_0x548c94[_0x8405('0x3e')][_0x4f96f8['id']][_0x5a4b6c+_0x8405('0x49')]=parseInt(_0x4f96f8['capacity'][_0x5a4b6c],0xa);}}}_0x548c94[_0x8405('0x3e')][_0x4f96f8['id']][_0x8405('0x4a')]();return _0x2183af({'code':0xc8,'message':_0x548c94[_0x8405('0x3e')][_0x4f96f8['id']]});}else{return _0x13018d(_0x259383[_0x8405('0x35')](0x1f4,_0x8405('0x4b')));}});},'Agents':function(_0x378a61){return new Promise(function(_0x485af5){var _0xd153b7=_[_0x8405('0x4c')](_0x548c94[_0x8405('0x3e')]);if(_0x378a61&&_0x378a61['id']){var _0x539969=_['find'](_0xd153b7,function(_0x230e33){return _0x230e33['id']===_0x378a61['id'];});_0x485af5(_0x539969);}else{_0x485af5({'count':_0xd153b7[_0x8405('0x17')],'rows':_0xd153b7});}});},'ChatQueues':function(){return new Promise(function(_0x13d60f){var _0x450dad=[];for(var _0x138df7 in _0x548c94['chatQueues']){if(_0x548c94['chatQueues']['hasOwnProperty'](_0x138df7)){var _0xef22de=_0x548c94[_0x8405('0x4d')][_0x138df7];var _0x2ef75f={'id':_0xef22de['id'],'available':_0xef22de[_0x8405('0x4e')],'loggedIn':_0xef22de[_0x8405('0x4f')],'name':_0xef22de[_0x8405('0x50')],'paused':_0xef22de[_0x8405('0x51')],'waiting':_0xef22de[_0x8405('0x52')]};_0x450dad[_0x8405('0x20')](_0x2ef75f);}}_0x13d60f({'count':_0x450dad[_0x8405('0x17')],'rows':_0x450dad});});},'MailQueues':function(){return new Promise(function(_0xee56d){var _0x2a4d26=[];for(var _0x531061 in _0x548c94[_0x8405('0x53')]){if(_0x548c94[_0x8405('0x53')]['hasOwnProperty'](_0x531061)){var _0x2b87ba=_0x548c94[_0x8405('0x53')][_0x531061];var _0x2c0413={'id':_0x2b87ba['id'],'available':_0x2b87ba[_0x8405('0x4e')],'loggedIn':_0x2b87ba[_0x8405('0x4f')],'name':_0x2b87ba[_0x8405('0x50')],'paused':_0x2b87ba[_0x8405('0x51')],'waiting':_0x2b87ba[_0x8405('0x52')]};_0x2a4d26[_0x8405('0x20')](_0x2c0413);}}_0xee56d({'count':_0x2a4d26['length'],'rows':_0x2a4d26});});},'OpenchannelQueues':function(){return new Promise(function(_0x1db269){var _0x4732dc=[];for(var _0x17e983 in _0x548c94['openchannelQueues']){if(_0x548c94[_0x8405('0x54')][_0x8405('0x47')](_0x17e983)){var _0x20e9ac=_0x548c94[_0x8405('0x54')][_0x17e983];var _0x27f1ef={'id':_0x20e9ac['id'],'available':_0x20e9ac['available'],'loggedIn':_0x20e9ac[_0x8405('0x4f')],'name':_0x20e9ac[_0x8405('0x50')],'paused':_0x20e9ac[_0x8405('0x51')],'waiting':_0x20e9ac[_0x8405('0x52')]};_0x4732dc[_0x8405('0x20')](_0x27f1ef);}}_0x1db269({'count':_0x4732dc[_0x8405('0x17')],'rows':_0x4732dc});});},'SmsQueues':function(){return new Promise(function(_0x8875e3){var _0x83a45b=[];for(var _0x2b6b43 in _0x548c94['smsQueues']){if(_0x548c94[_0x8405('0x55')]['hasOwnProperty'](_0x2b6b43)){var _0x457a79=_0x548c94[_0x8405('0x55')][_0x2b6b43];var _0x52592c={'id':_0x457a79['id'],'available':_0x457a79['available'],'loggedIn':_0x457a79['loggedIn'],'name':_0x457a79['name'],'paused':_0x457a79[_0x8405('0x51')],'waiting':_0x457a79['waiting']};_0x83a45b[_0x8405('0x20')](_0x52592c);}}_0x8875e3({'count':_0x83a45b[_0x8405('0x17')],'rows':_0x83a45b});});},'FaxQueues':function(){return new Promise(function(_0x34c983){var _0x3d85d2=[];for(var _0x372ca9 in _0x548c94[_0x8405('0x56')]){if(_0x548c94[_0x8405('0x56')]['hasOwnProperty'](_0x372ca9)){var _0x22ec5c=_0x548c94[_0x8405('0x56')][_0x372ca9];var _0x538556={'id':_0x22ec5c['id'],'available':_0x22ec5c['available'],'loggedIn':_0x22ec5c['loggedIn'],'name':_0x22ec5c['name'],'paused':_0x22ec5c['paused'],'waiting':_0x22ec5c['waiting']};_0x3d85d2[_0x8405('0x20')](_0x538556);}}_0x34c983({'count':_0x3d85d2[_0x8405('0x17')],'rows':_0x3d85d2});});},'WhatsappQueues':function(){return new Promise(function(_0x140f39){var _0x2e48de=[];for(var _0x329fcc in _0x548c94['whatsappQueues']){if(_0x548c94[_0x8405('0x57')][_0x8405('0x47')](_0x329fcc)){var _0x648b6=_0x548c94[_0x8405('0x57')][_0x329fcc];var _0x4c9044={'id':_0x648b6['id'],'available':_0x648b6['available'],'loggedIn':_0x648b6[_0x8405('0x4f')],'name':_0x648b6[_0x8405('0x50')],'paused':_0x648b6[_0x8405('0x51')],'waiting':_0x648b6[_0x8405('0x52')]};_0x2e48de[_0x8405('0x20')](_0x4c9044);}}_0x140f39({'count':_0x2e48de[_0x8405('0x17')],'rows':_0x2e48de});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x399c56){var _0x1b2737=_['values'](_0x548c94[_0x8405('0x58')]);_0x399c56({'count':_0x1b2737[_0x8405('0x17')],'rows':_0x1b2737});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x2d3847){var _0x356995=_[_0x8405('0x4c')](_0x548c94[_0x8405('0x59')]);_0x2d3847({'count':_0x356995[_0x8405('0x17')],'rows':_0x356995});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x435f24){var _0x492e2b=_[_0x8405('0x4c')](_0x548c94[_0x8405('0x5a')]);_0x435f24({'count':_0x492e2b[_0x8405('0x17')],'rows':_0x492e2b});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x27c3e1){var _0x140ef3=_[_0x8405('0x4c')](_0x548c94[_0x8405('0x5b')]);_0x27c3e1({'count':_0x140ef3['length'],'rows':_0x140ef3});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x2562c8){var _0x456d50=_[_0x8405('0x4c')](_0x548c94['faxQueuesWaitingInteractions']);_0x2562c8({'count':_0x456d50[_0x8405('0x17')],'rows':_0x456d50});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x1871ed){var _0xf3a9bc=_[_0x8405('0x4c')](_0x548c94[_0x8405('0x5c')]);_0x1871ed({'count':_0xf3a9bc[_0x8405('0x17')],'rows':_0xf3a9bc});});}};var _0x34359d=jayson[_0x8405('0x5d')](_0x1722d3)[_0x8405('0x5e')]();_0x34359d['on'](_0x8405('0x35'),function(_0x5be58d){logger['error'](JSON[_0x8405('0x5f')](_0x5be58d));return _0x5a3776(_0x5be58d);});_0x34359d[_0x8405('0x60')](0x232c,'127.0.0.1',function(){console[_0x8405('0x61')](_0x8405('0x62'),0x232c);return _0x238633(_0x8405('0x63')+0x232c);});});}; \ No newline at end of file +var _0x8b29=['format','%s.%s.%s','isNil','IntervalId','map','interval','message','interaction','isArray','applications','length','existsSync','join','.js','autoreply','split','channel','mail','push','slice','appdata','dialogflowv2','amazonlex','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','body','%s:%s:%s','./interval','condition','intervals','./applications/','app','consequence','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','Applications\x20executed','stringify','matchPath','emit','No\x20applications\x20to\x20execute','stack','agent','agents','busy','QueueReport','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busyQueue','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','loggedIn','name','paused','waiting','mailQueues','available','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','listen','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','path','jayson/promise','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine'];(function(_0x541095,_0x582b30){var _0x5a2c40=function(_0xb7650f){while(--_0xb7650f){_0x541095['push'](_0x541095['shift']());}};_0x5a2c40(++_0x582b30);}(_0x8b29,0xbe));var _0x98b2=function(_0x4c06fa,_0x4f6a35){_0x4c06fa=_0x4c06fa-0x0;var _0x5d0b22=_0x8b29[_0x4c06fa];return _0x5d0b22;};'use strict';var _=require(_0x98b2('0x0'));var util=require('util');var path=require(_0x98b2('0x1'));var fs=require('fs');var jayson=require(_0x98b2('0x2'));var BPromise=require('bluebird');var utils=require('./applications/utils');var logger=require(_0x98b2('0x3'))(_0x98b2('0x4'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x98b2('0x5')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x98b2('0x6')),'faxQueueReport':require(_0x98b2('0x7')),'whatsappQueueReport':require(_0x98b2('0x8'))};var RuleEngine=require(_0x98b2('0x9'));function getId(_0x221cee,_0x2cd0cb,_0x417ca6){return util[_0x98b2('0xa')](_0x98b2('0xb'),_0x221cee,_0x2cd0cb||0x0,_0x417ca6||0x0);}function getIntervals(_0x4481b3,_0x501b51){var _0x48a17e=[];if(!_[_0x98b2('0xc')](_0x501b51[_0x98b2('0xd')])&&!_[_0x98b2('0xc')](_0x4481b3[_0x501b51[_0x98b2('0xd')]])&&!_[_0x98b2('0xc')](_0x4481b3[_0x501b51[_0x98b2('0xd')]]['Intervals'])){_0x48a17e=_[_0x98b2('0xe')](_0x4481b3[_0x501b51[_0x98b2('0xd')]]['Intervals'],_0x98b2('0xf'));}else if(!_[_0x98b2('0xc')](_0x501b51[_0x98b2('0xf')])){_0x48a17e=[_0x501b51['interval']];}return _0x48a17e;}exports['listen']=function(_0x2d19ee){_0x2d19ee['rules']={};return new BPromise(function(_0x2966e2,_0x49b151){var _0x5098db={'Start':function(_0x544e3c){var _0x831ee8=this;return new Promise(function(_0x413464,_0xe49e9a){if(_0x544e3c){try{var _0x5ecea1=[];var _0x5bb60d=getId(_0x544e3c['channel'],_0x544e3c[_0x98b2('0x10')]?_0x544e3c[_0x98b2('0x10')]['id']:0x0,_0x544e3c[_0x98b2('0x11')]?_0x544e3c[_0x98b2('0x11')]['id']:0x0);if(_0x544e3c['applications']&&_[_0x98b2('0x12')](_0x544e3c['applications'])&&_0x544e3c[_0x98b2('0x13')]['length']){for(var _0x3532d6=0x0;_0x3532d6<_0x544e3c[_0x98b2('0x13')][_0x98b2('0x14')];_0x3532d6+=0x1){var _0x16f5c1=_0x544e3c['applications'][_0x3532d6];if(fs[_0x98b2('0x15')](path[_0x98b2('0x16')](__dirname,'applications',_0x16f5c1['app']+_0x98b2('0x17')))){var _0xf45da9=[];switch(_0x16f5c1['app']['toLowerCase']()){case _0x98b2('0x18'):var _0x37fc18=_0x16f5c1['appdata'][_0x98b2('0x19')](',');if(_0x544e3c[_0x98b2('0x1a')]===_0x98b2('0x1b')){_0xf45da9['push'](_0x37fc18[0x0]);_0xf45da9[_0x98b2('0x1c')](_0x37fc18[0x1]);_0xf45da9['push'](_0x37fc18[_0x98b2('0x1d')](0x2,_0x37fc18['length'])['join'](','));}else{_0xf45da9[_0x98b2('0x1c')](_0x37fc18[0x0]);_0xf45da9[_0x98b2('0x1c')](_0x37fc18[_0x98b2('0x1d')](0x1,_0x37fc18['length'])['join'](','));}break;case'dialogflow':var _0x11c6aa=_0x16f5c1[_0x98b2('0x1e')]['split'](',');_0xf45da9[_0x98b2('0x1c')](_0x11c6aa[0x0]);_0xf45da9[_0x98b2('0x1c')](_0x11c6aa[0x1]);_0xf45da9[_0x98b2('0x1c')](_0x11c6aa['slice'](0x2,_0x11c6aa[_0x98b2('0x14')])[_0x98b2('0x16')](','));break;case _0x98b2('0x1f'):var _0xb4c6c4=_0x16f5c1[_0x98b2('0x1e')]['split'](',');_0xf45da9[_0x98b2('0x1c')](_0xb4c6c4[0x0]);_0xf45da9['push'](_0xb4c6c4[0x1]);_0xf45da9[_0x98b2('0x1c')](_0xb4c6c4[0x2]);_0xf45da9[_0x98b2('0x1c')](_0xb4c6c4[0x3]);_0xf45da9['push'](_0xb4c6c4[_0x98b2('0x1d')](0x4,_0xb4c6c4[_0x98b2('0x14')])['join'](','));break;case _0x98b2('0x20'):var _0x412740=_0x16f5c1[_0x98b2('0x1e')][_0x98b2('0x19')](',');_0xf45da9['push'](_0x412740[0x0]);_0xf45da9['push'](_0x412740[0x1]);_0xf45da9[_0x98b2('0x1c')](_0x412740[0x2]);_0xf45da9[_0x98b2('0x1c')](_0x412740[0x3]);_0xf45da9[_0x98b2('0x1c')](_0x412740[_0x98b2('0x1d')](0x4,_0x412740[_0x98b2('0x14')])[_0x98b2('0x16')](','));break;case'message':_0xf45da9[_0x98b2('0x1c')](_0x16f5c1[_0x98b2('0x1e')]);break;case _0x98b2('0x21'):_0xf45da9[_0x98b2('0x1c')](_0x16f5c1[_0x98b2('0x22')]);_0xf45da9[_0x98b2('0x1c')](_0x16f5c1[_0x98b2('0x1e')]);break;case _0x98b2('0x23'):var _0x273037=utils[_0x98b2('0x24')](_0x544e3c[_0x98b2('0x25')][_0x98b2('0x26')],_0x544e3c);var _0x2417f4=_0x16f5c1['appdata']['split'](',');_0xf45da9[_0x98b2('0x1c')](_0x2417f4[0x0]);_0xf45da9[_0x98b2('0x1c')](_0x2417f4[0x1]);_0xf45da9[_0x98b2('0x1c')](_0x2417f4[0x2]);_0xf45da9[_0x98b2('0x1c')](_0x2417f4[0x3]);_0xf45da9[_0x98b2('0x1c')](_0x2417f4[0x4]);_0xf45da9[_0x98b2('0x1c')](_0x2417f4[0x5]);_0xf45da9['push'](_0x2417f4[0x6]);_0xf45da9[_0x98b2('0x1c')](_0x2417f4[0x7]);_0xf45da9[_0x98b2('0x1c')](_0x2417f4[0x8]);_0xf45da9[_0x98b2('0x1c')](_0x2417f4[0x9]);_0xf45da9[_0x98b2('0x1c')](_0x2417f4[0xa]);_0xf45da9['push'](_0x544e3c[_0x98b2('0x11')]['id']);_0xf45da9[_0x98b2('0x1c')](_0x544e3c[_0x98b2('0x10')]['id']);_0xf45da9[_0x98b2('0x1c')](_0x16f5c1[_0x98b2('0x27')]);_0xf45da9[_0x98b2('0x1c')](_0x544e3c[_0x98b2('0x11')]['ContactId']);_0xf45da9[_0x98b2('0x1c')](_0x544e3c['body'][_0x98b2('0x28')]);_0xf45da9[_0x98b2('0x1c')](_0x273037);break;default:_0xf45da9=_[_0x98b2('0xc')](_0x16f5c1[_0x98b2('0x1e')])?[]:_0x16f5c1['appdata']['split'](',');}var _0x3d8bc7={'id':util[_0x98b2('0xa')](_0x98b2('0x29'),_0x5bb60d,_0x16f5c1['id'],_0x16f5c1['app']),'condition':require(_0x98b2('0x2a'))[_0x98b2('0x2b')](_0x5bb60d,getIntervals(_0x2d19ee[_0x98b2('0x2c')],_0x16f5c1),_0x2d19ee),'consequence':require(_0x98b2('0x2d')+_0x16f5c1[_0x98b2('0x2e')])[_0x98b2('0x2f')](_0x5bb60d,_0xf45da9,_0x2d19ee,_0x544e3c),'p':_0x16f5c1['priority']||0x0};logger[_0x98b2('0x30')](_0x98b2('0x31'),_0x3d8bc7['id'],_0x98b2('0x32'),getIntervals(_0x2d19ee['intervals'],_0x16f5c1)[_0x98b2('0x16')](_0x98b2('0x33')));_0x5ecea1[_0x98b2('0x1c')](_0x3d8bc7);}else{logger[_0x98b2('0x34')](_0x98b2('0x35'),path[_0x98b2('0x16')](__dirname,'applications',_0x16f5c1[_0x98b2('0x2e')]+'.js'));}}_0x2d19ee[_0x98b2('0x36')][_0x5bb60d]=new RuleEngine(_0x5ecea1);_0x2d19ee[_0x98b2('0x36')][_0x5bb60d][_0x98b2('0x37')](_0x544e3c,function(_0x1d262d){logger[_0x98b2('0x30')](_0x98b2('0x38'),JSON[_0x98b2('0x39')](_0x1d262d[_0x98b2('0x3a')]));if(_0x2d19ee[_0x98b2('0x36')][_0x5bb60d]){_0x2d19ee['rules'][_0x5bb60d][_0x98b2('0x3b')]('complete');}});return _0x413464({'code':0xc8,'message':_0x544e3c});}else{logger[_0x98b2('0x30')](_0x98b2('0x3c'));return _0x413464({'code':0xc8,'message':_0x544e3c});}}catch(_0x5aad70){logger[_0x98b2('0x34')](_0x5aad70[_0x98b2('0x3d')]);return _0xe49e9a(_0x831ee8[_0x98b2('0x34')](0x1f4,_0x5aad70));}}return _0xe49e9a('routing\x20is\x20empty');});},'AcceptMessage':function(_0x215c36){var _0x44633c=this;return new Promise(function(_0x3dd679,_0x2bd1ca){if(_0x215c36[_0x98b2('0x3e')]&&_0x215c36['agent']['id']){if(_0x2d19ee['agents'][_0x215c36[_0x98b2('0x3e')]['id']]){_0x2d19ee[_0x98b2('0x3f')][_0x215c36[_0x98b2('0x3e')]['id']][_0x98b2('0x40')]=![];_0x2d19ee['agents'][_0x215c36['agent']['id']]['busyQueue']=undefined;}}if(_0x215c36[_0x98b2('0x10')]&&_0x215c36[_0x98b2('0x10')]['id']){try{var _0xd087bf=getId(_0x215c36[_0x98b2('0x1a')],_0x215c36[_0x98b2('0x10')]?_0x215c36[_0x98b2('0x10')]['id']:0x0,_0x215c36[_0x98b2('0x11')]?_0x215c36[_0x98b2('0x11')]['id']:0x0);if(_0x2d19ee[_0x98b2('0x36')][_0xd087bf]){_0x2d19ee['rules'][_0xd087bf][_0x98b2('0x3b')]('end');if(rpc[_0x215c36[_0x98b2('0x1a')]+_0x98b2('0x41')]){rpc[_0x215c36[_0x98b2('0x1a')]+_0x98b2('0x41')]['update'](_0xd087bf,{'UserId':_0x215c36[_0x98b2('0x10')][_0x98b2('0x42')]})[_0x98b2('0x43')](function(){logger[_0x98b2('0x34')](_0x98b2('0x44'));});}}return _0x3dd679({'code':0xc8,'message':_0x215c36});}catch(_0x54f7ba){logger[_0x98b2('0x34')](_0x54f7ba[_0x98b2('0x3d')]);return _0x2bd1ca(_0x44633c[_0x98b2('0x34')](0x1f4,_0x54f7ba));}}logger[_0x98b2('0x34')](_0x98b2('0x45'));return _0x2bd1ca(_0x44633c[_0x98b2('0x34')](0x1f4,_0x98b2('0x45')));});},'RejectMessage':function(_0x144b62){var _0x175a1b=this;return new Promise(function(_0x4156fe,_0x236ca6){if(_0x144b62[_0x98b2('0x3e')]&&_0x144b62['agent']['id']){try{if(_0x2d19ee[_0x98b2('0x3f')][_0x144b62[_0x98b2('0x3e')]['id']]){_0x2d19ee['agents'][_0x144b62['agent']['id']][_0x98b2('0x40')]=![];_0x2d19ee['agents'][_0x144b62[_0x98b2('0x3e')]['id']][_0x98b2('0x46')]=undefined;}return _0x4156fe({'code':0xc8,'message':_0x144b62});}catch(_0x2e651b){logger[_0x98b2('0x34')](_0x2e651b[_0x98b2('0x3d')]);return _0x236ca6(_0x175a1b[_0x98b2('0x34')](0x1f4,_0x2e651b));}}logger['error'](_0x98b2('0x45'));return _0x236ca6(_0x175a1b['error'](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0xf9da91){var _0x27da73=this;return new Promise(function(_0x5217e0,_0x12a72e){if(_0xf9da91[_0x98b2('0x1a')]&&_0xf9da91['interaction']&&_0xf9da91[_0x98b2('0x11')]['id']){try{var _0x466240=getId(_0xf9da91[_0x98b2('0x1a')],_0xf9da91[_0x98b2('0x10')]?_0xf9da91['message']['id']:0x0,_0xf9da91['interaction']?_0xf9da91[_0x98b2('0x11')]['id']:0x0);if(_0x2d19ee[_0x98b2('0x36')][_0x466240]){_0x2d19ee[_0x98b2('0x36')][_0x466240][_0x98b2('0x3b')](_0x98b2('0x47'));}return _0x5217e0({'code':0xc8,'message':_0xf9da91});}catch(_0x5bfb14){logger['error'](_0x5bfb14[_0x98b2('0x3d')]);return _0x12a72e(_0x27da73['error'](0x1f4,_0x5bfb14));}}logger[_0x98b2('0x34')](_0x98b2('0x45'));return _0x12a72e(_0x27da73[_0x98b2('0x34')](0x1f4,_0x98b2('0x45')));});},'AgentCapacity':function(_0x3328b7){var _0x2e7bab=this;return new Promise(function(_0x5634ae,_0x3e7909){if(_0x2d19ee[_0x98b2('0x3f')][_0x98b2('0x48')](_0x3328b7['id'])){for(var _0x2b2a25 in _0x3328b7[_0x98b2('0x49')]){if(_0x3328b7[_0x98b2('0x49')]['hasOwnProperty'](_0x2b2a25)){if(_0x2d19ee['agents'][_0x3328b7['id']][_0x98b2('0x48')](_0x2b2a25+_0x98b2('0x4a'))){_0x2d19ee[_0x98b2('0x3f')][_0x3328b7['id']][_0x2b2a25+_0x98b2('0x4a')]=parseInt(_0x3328b7[_0x98b2('0x49')][_0x2b2a25],0xa);}}}_0x2d19ee[_0x98b2('0x3f')][_0x3328b7['id']][_0x98b2('0x4b')]();return _0x5634ae({'code':0xc8,'message':_0x2d19ee[_0x98b2('0x3f')][_0x3328b7['id']]});}else{return _0x3e7909(_0x2e7bab['error'](0x1f4,_0x98b2('0x4c')));}});},'Agents':function(_0x29942c){return new Promise(function(_0x830740){var _0x48c4f4=_[_0x98b2('0x4d')](_0x2d19ee[_0x98b2('0x3f')]);if(_0x29942c&&_0x29942c['id']){var _0x2149a1=_['find'](_0x48c4f4,function(_0x2fc838){return _0x2fc838['id']===_0x29942c['id'];});_0x830740(_0x2149a1);}else{_0x830740({'count':_0x48c4f4[_0x98b2('0x14')],'rows':_0x48c4f4});}});},'ChatQueues':function(){return new Promise(function(_0x55edb7){var _0x3dc906=[];for(var _0x51ecd4 in _0x2d19ee['chatQueues']){if(_0x2d19ee['chatQueues']['hasOwnProperty'](_0x51ecd4)){var _0x373190=_0x2d19ee[_0x98b2('0x4e')][_0x51ecd4];var _0xdc2b93={'id':_0x373190['id'],'available':_0x373190['available'],'loggedIn':_0x373190[_0x98b2('0x4f')],'name':_0x373190[_0x98b2('0x50')],'paused':_0x373190[_0x98b2('0x51')],'waiting':_0x373190[_0x98b2('0x52')]};_0x3dc906[_0x98b2('0x1c')](_0xdc2b93);}}_0x55edb7({'count':_0x3dc906[_0x98b2('0x14')],'rows':_0x3dc906});});},'MailQueues':function(){return new Promise(function(_0x3b86a1){var _0x5181ee=[];for(var _0x46b3fb in _0x2d19ee['mailQueues']){if(_0x2d19ee[_0x98b2('0x53')][_0x98b2('0x48')](_0x46b3fb)){var _0x2fea4f=_0x2d19ee[_0x98b2('0x53')][_0x46b3fb];var _0x122e76={'id':_0x2fea4f['id'],'available':_0x2fea4f[_0x98b2('0x54')],'loggedIn':_0x2fea4f[_0x98b2('0x4f')],'name':_0x2fea4f['name'],'paused':_0x2fea4f['paused'],'waiting':_0x2fea4f[_0x98b2('0x52')]};_0x5181ee[_0x98b2('0x1c')](_0x122e76);}}_0x3b86a1({'count':_0x5181ee[_0x98b2('0x14')],'rows':_0x5181ee});});},'OpenchannelQueues':function(){return new Promise(function(_0x2c9369){var _0x513fec=[];for(var _0x2cbf7d in _0x2d19ee['openchannelQueues']){if(_0x2d19ee[_0x98b2('0x55')][_0x98b2('0x48')](_0x2cbf7d)){var _0x48ac14=_0x2d19ee[_0x98b2('0x55')][_0x2cbf7d];var _0x157abf={'id':_0x48ac14['id'],'available':_0x48ac14[_0x98b2('0x54')],'loggedIn':_0x48ac14[_0x98b2('0x4f')],'name':_0x48ac14[_0x98b2('0x50')],'paused':_0x48ac14[_0x98b2('0x51')],'waiting':_0x48ac14[_0x98b2('0x52')]};_0x513fec[_0x98b2('0x1c')](_0x157abf);}}_0x2c9369({'count':_0x513fec[_0x98b2('0x14')],'rows':_0x513fec});});},'SmsQueues':function(){return new Promise(function(_0x4a0a6a){var _0x134a9d=[];for(var _0x36c09f in _0x2d19ee[_0x98b2('0x56')]){if(_0x2d19ee[_0x98b2('0x56')][_0x98b2('0x48')](_0x36c09f)){var _0xce2fce=_0x2d19ee[_0x98b2('0x56')][_0x36c09f];var _0x57a39c={'id':_0xce2fce['id'],'available':_0xce2fce[_0x98b2('0x54')],'loggedIn':_0xce2fce[_0x98b2('0x4f')],'name':_0xce2fce[_0x98b2('0x50')],'paused':_0xce2fce[_0x98b2('0x51')],'waiting':_0xce2fce[_0x98b2('0x52')]};_0x134a9d['push'](_0x57a39c);}}_0x4a0a6a({'count':_0x134a9d[_0x98b2('0x14')],'rows':_0x134a9d});});},'FaxQueues':function(){return new Promise(function(_0x5c7df7){var _0x45b9fb=[];for(var _0x3a3170 in _0x2d19ee[_0x98b2('0x57')]){if(_0x2d19ee['faxQueues'][_0x98b2('0x48')](_0x3a3170)){var _0x283017=_0x2d19ee['faxQueues'][_0x3a3170];var _0x3b969a={'id':_0x283017['id'],'available':_0x283017['available'],'loggedIn':_0x283017[_0x98b2('0x4f')],'name':_0x283017['name'],'paused':_0x283017[_0x98b2('0x51')],'waiting':_0x283017[_0x98b2('0x52')]};_0x45b9fb[_0x98b2('0x1c')](_0x3b969a);}}_0x5c7df7({'count':_0x45b9fb[_0x98b2('0x14')],'rows':_0x45b9fb});});},'WhatsappQueues':function(){return new Promise(function(_0x26c8ae){var _0x471194=[];for(var _0x522e81 in _0x2d19ee[_0x98b2('0x58')]){if(_0x2d19ee['whatsappQueues'][_0x98b2('0x48')](_0x522e81)){var _0x48fdf7=_0x2d19ee[_0x98b2('0x58')][_0x522e81];var _0x2791f9={'id':_0x48fdf7['id'],'available':_0x48fdf7['available'],'loggedIn':_0x48fdf7[_0x98b2('0x4f')],'name':_0x48fdf7[_0x98b2('0x50')],'paused':_0x48fdf7[_0x98b2('0x51')],'waiting':_0x48fdf7[_0x98b2('0x52')]};_0x471194[_0x98b2('0x1c')](_0x2791f9);}}_0x26c8ae({'count':_0x471194[_0x98b2('0x14')],'rows':_0x471194});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x3a0407){var _0x2c7db5=_['values'](_0x2d19ee[_0x98b2('0x59')]);_0x3a0407({'count':_0x2c7db5['length'],'rows':_0x2c7db5});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x228797){var _0x8049b8=_[_0x98b2('0x4d')](_0x2d19ee['mailQueuesWaitingInteractions']);_0x228797({'count':_0x8049b8['length'],'rows':_0x8049b8});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x2a507b){var _0xba28ec=_['values'](_0x2d19ee['openchannelQueuesWaitingInteractions']);_0x2a507b({'count':_0xba28ec[_0x98b2('0x14')],'rows':_0xba28ec});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x1e6c8f){var _0x8e9b98=_[_0x98b2('0x4d')](_0x2d19ee[_0x98b2('0x5a')]);_0x1e6c8f({'count':_0x8e9b98[_0x98b2('0x14')],'rows':_0x8e9b98});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x4a6562){var _0x7340eb=_[_0x98b2('0x4d')](_0x2d19ee[_0x98b2('0x5b')]);_0x4a6562({'count':_0x7340eb[_0x98b2('0x14')],'rows':_0x7340eb});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x483183){var _0x559aa1=_[_0x98b2('0x4d')](_0x2d19ee[_0x98b2('0x5c')]);_0x483183({'count':_0x559aa1[_0x98b2('0x14')],'rows':_0x559aa1});});}};var _0x9c631f=jayson[_0x98b2('0x5d')](_0x5098db)[_0x98b2('0x5e')]();_0x9c631f['on'](_0x98b2('0x34'),function(_0x416467){logger[_0x98b2('0x34')](JSON[_0x98b2('0x39')](_0x416467));return _0x49b151(_0x416467);});_0x9c631f[_0x98b2('0x5f')](0x232c,_0x98b2('0x60'),function(){console[_0x98b2('0x61')](_0x98b2('0x62'),0x232c);return _0x2966e2(_0x98b2('0x63')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index dc80d9c..58f883c 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 _0xfc35=['request','then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','indexOf','all','some','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','log','join','util','jayson/promise','lodash','../../../config/logger','routing','client','http'];(function(_0x328ed2,_0x50c509){var _0x449651=function(_0x481b25){while(--_0x481b25){_0x328ed2['push'](_0x328ed2['shift']());}};_0x449651(++_0x50c509);}(_0xfc35,0x80));var _0x5fc3=function(_0x487991,_0x896ec){_0x487991=_0x487991-0x0;var _0x465ca2=_0xfc35[_0x487991];return _0x465ca2;};'use strict';var util=require(_0x5fc3('0x0'));var BPromise=require('bluebird');var jayson=require(_0x5fc3('0x1'));var _=require(_0x5fc3('0x2'));var logger=require(_0x5fc3('0x3'))(_0x5fc3('0x4'));var client=jayson[_0x5fc3('0x5')][_0x5fc3('0x6')]({'port':0x232a});function request(_0x24a44a,_0x236927){return new BPromise(function(_0x25d8e6,_0x21559c){return client[_0x5fc3('0x7')](_0x24a44a,_0x236927)[_0x5fc3('0x8')](function(_0xb7e911){if(_0xb7e911[_0x5fc3('0x9')]){return _0x21559c(_0xb7e911['error'][_0x5fc3('0xa')]);}else{return _0x25d8e6(_0xb7e911[_0x5fc3('0xb')]);}})[_0x5fc3('0xc')](function(_0x5c21da){return _0x21559c(_0x5c21da);});});}exports[_0x5fc3('0xd')]=function(_0x5035e4,_0x539ad8,_0x527a0c){return function(_0x32e915){if(_0x527a0c[_0x5fc3('0xe')]&&!_0x527a0c[_0x5fc3('0xe')][_0x5035e4]){logger[_0x5fc3('0xf')](_0x5fc3('0x10'),_0x5035e4);return _0x32e915[_0x5fc3('0x11')]();}var _0x1f4f7e=[];for(var _0x4dedc0=0x0;_0x4dedc0<_0x539ad8[_0x5fc3('0x12')];_0x4dedc0+=0x1){_0x1f4f7e[_0x5fc3('0x13')](request('Command',{'command':util['format']('iftime\x20%s',_0x539ad8[_0x4dedc0])})['then'](function(_0xbe377b){return _0xbe377b&&_0xbe377b[_0x5fc3('0xa')]&&_0xbe377b[_0x5fc3('0xa')][_0x5fc3('0x14')]('true')>=0x0?!![]:![];})['catch'](function(_0x212b15){logger['error']('[%s][INTERVAL]\x20%s',_0x5035e4,_0x539ad8[_0x4dedc0]);}));}BPromise[_0x5fc3('0x15')](_0x1f4f7e)[_0x5fc3('0x8')](function(_0x554bf9){var _0xa501b0=_[_0x5fc3('0x16')](_0x554bf9);logger[_0x5fc3('0xf')](_0x5fc3('0x17'),_0x5035e4,_0x539ad8['join'](_0x5fc3('0x18')),_0xa501b0);_0x32e915['when'](_0xa501b0);})['catch'](function(_0x3adefb){console[_0x5fc3('0x19')](_0x3adefb);logger[_0x5fc3('0x9')](_0x5fc3('0x17'),_0x5035e4,_0x539ad8[_0x5fc3('0x1a')](_0x5fc3('0x18')),_0x3adefb['stack']);_0x32e915[_0x5fc3('0x11')]();});};}; \ No newline at end of file +var _0xb942=['[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stop','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','then','error','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','Command','format','iftime\x20%s','indexOf','true'];(function(_0x30e16d,_0x464f0b){var _0xc54f6=function(_0x311b1f){while(--_0x311b1f){_0x30e16d['push'](_0x30e16d['shift']());}};_0xc54f6(++_0x464f0b);}(_0xb942,0x69));var _0x2b94=function(_0x5f15df,_0x3a0a1b){_0x5f15df=_0x5f15df-0x0;var _0x287f1a=_0xb942[_0x5f15df];return _0x287f1a;};'use strict';var util=require(_0x2b94('0x0'));var BPromise=require(_0x2b94('0x1'));var jayson=require(_0x2b94('0x2'));var _=require(_0x2b94('0x3'));var logger=require(_0x2b94('0x4'))(_0x2b94('0x5'));var client=jayson[_0x2b94('0x6')][_0x2b94('0x7')]({'port':0x232a});function request(_0x2e8c65,_0x5a954a){return new BPromise(function(_0x39dd5a,_0x50e1bd){return client['request'](_0x2e8c65,_0x5a954a)[_0x2b94('0x8')](function(_0xbe5796){if(_0xbe5796['error']){return _0x50e1bd(_0xbe5796[_0x2b94('0x9')]['message']);}else{return _0x39dd5a(_0xbe5796[_0x2b94('0xa')]);}})[_0x2b94('0xb')](function(_0x128cc9){return _0x50e1bd(_0x128cc9);});});}exports[_0x2b94('0xc')]=function(_0x4253c6,_0x2f1286,_0x44f7de){return function(_0x1cd05d){if(_0x44f7de[_0x2b94('0xd')]&&!_0x44f7de[_0x2b94('0xd')][_0x4253c6]){logger[_0x2b94('0xe')](_0x2b94('0xf'),_0x4253c6);return _0x1cd05d['stop']();}var _0x2addba=[];for(var _0x3c05fb=0x0;_0x3c05fb<_0x2f1286[_0x2b94('0x10')];_0x3c05fb+=0x1){_0x2addba[_0x2b94('0x11')](request(_0x2b94('0x12'),{'command':util[_0x2b94('0x13')](_0x2b94('0x14'),_0x2f1286[_0x3c05fb])})[_0x2b94('0x8')](function(_0x4eac67){return _0x4eac67&&_0x4eac67['message']&&_0x4eac67['message'][_0x2b94('0x15')](_0x2b94('0x16'))>=0x0?!![]:![];})[_0x2b94('0xb')](function(_0x2f729a){logger[_0x2b94('0x9')](_0x2b94('0x17'),_0x4253c6,_0x2f1286[_0x3c05fb]);}));}BPromise[_0x2b94('0x18')](_0x2addba)[_0x2b94('0x8')](function(_0x23591c){var _0x17ca4f=_[_0x2b94('0x19')](_0x23591c);logger[_0x2b94('0xe')](_0x2b94('0x1a'),_0x4253c6,_0x2f1286[_0x2b94('0x1b')](_0x2b94('0x1c')),_0x17ca4f);_0x1cd05d[_0x2b94('0x1d')](_0x17ca4f);})[_0x2b94('0xb')](function(_0x31a734){console[_0x2b94('0x1e')](_0x31a734);logger[_0x2b94('0x9')]('[%s][INTERVAL]\x20%s\x20%s',_0x4253c6,_0x2f1286['join']('\x20|\x20'),_0x31a734['stack']);_0x1cd05d[_0x2b94('0x1f')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 30fe1fc..33cddb2 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 _0xea28=['agentcalled','debug','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','reason','ringtime','talktime','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','holdtime','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfertype','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','[%s][agents][hangup]','timeout','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','agent','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid'];(function(_0x356908,_0x5401d3){var _0x1b01d2=function(_0x11b9f0){while(--_0x11b9f0){_0x356908['push'](_0x356908['shift']());}};_0x1b01d2(++_0x5401d3);}(_0xea28,0x13a));var _0x8ea2=function(_0x4632b5,_0x198924){_0x4632b5=_0x4632b5-0x0;var _0x4ce5f6=_0xea28[_0x4632b5];return _0x4ce5f6;};'use strict';var _=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var utils=require(_0x8ea2('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x26155f,_0x459c4e){utils[_0x8ea2('0x3')](util[_0x8ea2('0x4')](_0x8ea2('0x5'),_0x26155f['uniqueid'],_0x26155f[_0x8ea2('0x6')],_0x26155f[_0x8ea2('0x7')],_0x26155f[_0x8ea2('0x8')],_0x26155f['interface'],_0x26155f[_0x8ea2('0x9')],_0x26155f[_0x8ea2('0xa')],_0x26155f[_0x8ea2('0xb')]));if(_0x26155f[_0x8ea2('0x7')]){utils[_0x8ea2('0xc')](_0x26155f[_0x8ea2('0x7')])[_0x8ea2('0xd')](function(_0x320750){if(_0x320750){_0x26155f[_0x8ea2('0xe')]=_0x320750[_0x8ea2('0xe')];_0x26155f[_0x8ea2('0xf')]=_0x26155f[_0x8ea2('0x10')]?_0x320750['acw']:![];_0x26155f['acwtime']=_0x26155f[_0x8ea2('0xf')]?_0x320750[_0x8ea2('0x11')]:0x0;}utils[_0x8ea2('0x12')]('CreateVoiceAgentReport',_0x26155f);});}else{utils[_0x8ea2('0x12')](_0x8ea2('0x13'),_0x26155f);}if(_0x459c4e){delete transfers[_0x26155f[_0x8ea2('0x14')]];}else{delete agents[_0x26155f[_0x8ea2('0x15')]];}}exports[_0x8ea2('0x16')]=function(_0x5e662e){try{utils[_0x8ea2('0x17')](util['format']('[%s][agents][agentcalled]',_0x5e662e[_0x8ea2('0x14')]),_0x5e662e);agents[_0x5e662e[_0x8ea2('0x15')]]=_0x5e662e;agents[_0x5e662e[_0x8ea2('0x15')]][_0x8ea2('0x18')]=utils[_0x8ea2('0x19')]();agents[_0x5e662e[_0x8ea2('0x15')]][_0x8ea2('0xb')]=_0x8ea2('0x1a');agents[_0x5e662e[_0x8ea2('0x15')]][_0x8ea2('0xa')]=null;agents[_0x5e662e[_0x8ea2('0x15')]][_0x8ea2('0x1b')]=null;utils[_0x8ea2('0x3')](util[_0x8ea2('0x4')](_0x8ea2('0x1c'),_0x5e662e[_0x8ea2('0x14')],agents[_0x5e662e[_0x8ea2('0x15')]][_0x8ea2('0x8')],_0x5e662e[_0x8ea2('0x15')]));}catch(_0x233a40){utils[_0x8ea2('0x1d')](util[_0x8ea2('0x4')]('[%s][agents][agentcalled]',_0x5e662e['uniqueid']),_0x233a40);}};exports[_0x8ea2('0x1e')]=function(_0x248c18){try{if(!_[_0x8ea2('0x1f')](agents[_0x248c18['destuniqueid']])){utils[_0x8ea2('0x17')](util[_0x8ea2('0x4')]('[%s][agents][agentringnoanswer]',_0x248c18[_0x8ea2('0x14')]),_0x248c18);utils[_0x8ea2('0x3')](util[_0x8ea2('0x4')](_0x8ea2('0x20'),_0x248c18[_0x8ea2('0x14')],agents[_0x248c18[_0x8ea2('0x15')]][_0x8ea2('0x8')],_0x248c18[_0x8ea2('0x15')]));agents[_0x248c18[_0x8ea2('0x15')]]['agentringnoanswer']=!![];agents[_0x248c18[_0x8ea2('0x15')]]['agentringnoanswerAt']=utils[_0x8ea2('0x19')]();agents[_0x248c18[_0x8ea2('0x15')]][_0x8ea2('0xb')]='timeout';agents[_0x248c18['destuniqueid']][_0x8ea2('0x21')]='timeout';agents[_0x248c18[_0x8ea2('0x15')]]['holdtime']=_0x248c18[_0x8ea2('0x22')]?parseInt(_0x248c18[_0x8ea2('0x22')])/0x3e8:0x0;agents[_0x248c18[_0x8ea2('0x15')]][_0x8ea2('0x23')]=0x0;unanswered['push'](_0x248c18['destuniqueid']);}}catch(_0xacaa6c){utils['error'](util[_0x8ea2('0x4')](_0x8ea2('0x24'),_0x248c18[_0x8ea2('0x14')]),_0xacaa6c);}};exports[_0x8ea2('0x25')]=function(_0x307c74){try{_[_0x8ea2('0x26')](agents,function(_0x32e225,_0x316707){if(_0x32e225[_0x8ea2('0x14')]==_0x307c74[_0x8ea2('0x14')]&&!_['includes'](unanswered,_0x32e225['destuniqueid'])){utils[_0x8ea2('0x17')](util[_0x8ea2('0x4')]('[%s][agents][queuecallerabandon]',_0x307c74['uniqueid']),_0x307c74);utils[_0x8ea2('0x3')](util['format'](_0x8ea2('0x27'),_0x307c74[_0x8ea2('0x14')],_0x32e225['membername'],_0x32e225[_0x8ea2('0x15')]));_0x32e225[_0x8ea2('0x1e')]=!![];_0x32e225[_0x8ea2('0x28')]=utils['now']();_0x32e225['lastevent']='abandoned';_0x32e225[_0x8ea2('0x21')]=_0x8ea2('0x29');_0x32e225[_0x8ea2('0x2a')]=_0x307c74['holdtime'];_0x32e225[_0x8ea2('0x23')]=0x0;writeDB(_0x32e225);}});}catch(_0x391b08){utils[_0x8ea2('0x1d')](util[_0x8ea2('0x4')](_0x8ea2('0x2b'),_0x307c74[_0x8ea2('0x14')]),_0x391b08);}};exports[_0x8ea2('0x2c')]=function(_0x1fc76a){try{if(agents[_0x1fc76a['destuniqueid']]){utils[_0x8ea2('0x17')](util[_0x8ea2('0x4')](_0x8ea2('0x2d'),_0x1fc76a[_0x8ea2('0x14')]),_0x1fc76a);utils['info'](util[_0x8ea2('0x4')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x1fc76a[_0x8ea2('0x14')],agents[_0x1fc76a[_0x8ea2('0x15')]][_0x8ea2('0x8')],_0x1fc76a[_0x8ea2('0x15')]));agents[_0x1fc76a['destuniqueid']][_0x8ea2('0x2e')]=utils['now']();agents[_0x1fc76a['destuniqueid']][_0x8ea2('0xa')]=_0x1fc76a['connectedlinenum'];agents[_0x1fc76a[_0x8ea2('0x15')]][_0x8ea2('0x1b')]=_0x1fc76a[_0x8ea2('0x1b')];agents[_0x1fc76a[_0x8ea2('0x15')]][_0x8ea2('0x2a')]=_0x1fc76a['ringtime'];agents[_0x1fc76a[_0x8ea2('0x15')]]['lastevent']=_0x8ea2('0x2f');_[_0x8ea2('0x26')](agents,function(_0x6d0e0c,_0x3995ff){if(_0x6d0e0c['destuniqueid']!=_0x1fc76a[_0x8ea2('0x15')]&&_0x6d0e0c['uniqueid']==_0x1fc76a[_0x8ea2('0x14')]){_0x6d0e0c['talktime']=0x0;_0x6d0e0c[_0x8ea2('0x2a')]=_0x1fc76a[_0x8ea2('0x22')];_0x6d0e0c[_0x8ea2('0x1e')]=!![];_0x6d0e0c[_0x8ea2('0x28')]=utils[_0x8ea2('0x19')]();_0x6d0e0c[_0x8ea2('0xb')]=_0x8ea2('0x30');_0x6d0e0c['reason']='answered_elsewhere';_0x6d0e0c[_0x8ea2('0x31')]=_0x1fc76a['destuniqueid'];_0x6d0e0c['answeredelsewheremembername']=_0x1fc76a['membername'];writeDB(_0x6d0e0c);}});}}catch(_0x3cbc09){utils['error'](util[_0x8ea2('0x4')](_0x8ea2('0x2d'),_0x1fc76a[_0x8ea2('0x14')]),_0x3cbc09);}};exports[_0x8ea2('0x10')]=function(_0x989d9b){try{if(!_[_0x8ea2('0x1f')](agents[_0x989d9b[_0x8ea2('0x15')]])){utils[_0x8ea2('0x17')](util['format'](_0x8ea2('0x32'),_0x989d9b[_0x8ea2('0x14')]),_0x989d9b);utils[_0x8ea2('0x3')](util['format'](_0x8ea2('0x33'),_0x989d9b[_0x8ea2('0x14')],agents[_0x989d9b[_0x8ea2('0x15')]][_0x8ea2('0x8')],_0x989d9b[_0x8ea2('0x15')]));agents[_0x989d9b['destuniqueid']][_0x8ea2('0x10')]=!![];agents[_0x989d9b[_0x8ea2('0x15')]][_0x8ea2('0x34')]=utils['now']();agents[_0x989d9b[_0x8ea2('0x15')]][_0x8ea2('0x23')]=utils[_0x8ea2('0x35')](agents[_0x989d9b[_0x8ea2('0x15')]][_0x8ea2('0x34')],agents[_0x989d9b[_0x8ea2('0x15')]][_0x8ea2('0x2e')]);agents[_0x989d9b[_0x8ea2('0x15')]][_0x8ea2('0x21')]=_0x989d9b[_0x8ea2('0x21')];agents[_0x989d9b[_0x8ea2('0x15')]][_0x8ea2('0xb')]=_0x8ea2('0x36');writeDB(agents[_0x989d9b[_0x8ea2('0x15')]]);}}catch(_0x5c1212){utils[_0x8ea2('0x1d')](util[_0x8ea2('0x4')](_0x8ea2('0x32'),_0x989d9b[_0x8ea2('0x14')]),_0x5c1212);}};exports[_0x8ea2('0x37')]=function(_0x1daa25){try{if(!_[_0x8ea2('0x1f')](agents[_0x1daa25[_0x8ea2('0x38')]])){utils['debug'](util[_0x8ea2('0x4')](_0x8ea2('0x39'),_0x1daa25[_0x8ea2('0x14')]),_0x1daa25);utils['info'](util['format'](_0x8ea2('0x3a'),_0x1daa25[_0x8ea2('0x14')],agents[_0x1daa25[_0x8ea2('0x38')]]['membername'],agents[_0x1daa25[_0x8ea2('0x38')]][_0x8ea2('0x14')]));agents[_0x1daa25[_0x8ea2('0x38')]][_0x8ea2('0x3b')]=!![];agents[_0x1daa25[_0x8ea2('0x38')]]['transfertype']='blind';agents[_0x1daa25[_0x8ea2('0x38')]][_0x8ea2('0x3c')]=_0x1daa25[_0x8ea2('0x3d')];agents[_0x1daa25['transfereruniqueid']][_0x8ea2('0x3e')]=agents[_0x1daa25[_0x8ea2('0x38')]][_0x8ea2('0x14')];}}catch(_0x54c9d7){utils['error'](util['format']('[%s][agents][blindtransfer]',_0x1daa25['uniqueid']),_0x54c9d7);}};exports[_0x8ea2('0x3f')]=function(_0x3020ad){try{utils['debug'](util['format'](_0x8ea2('0x40'),_0x3020ad[_0x8ea2('0x41')]),_0x3020ad);if(_0x3020ad[_0x8ea2('0x41')]==_0x3020ad['origtransfererlinkedid']){if(!_[_0x8ea2('0x1f')](agents[_0x3020ad[_0x8ea2('0x42')]])){utils['info'](util[_0x8ea2('0x4')](_0x8ea2('0x43'),_0x3020ad[_0x8ea2('0x41')],agents[_0x3020ad[_0x8ea2('0x42')]][_0x8ea2('0x8')]));agents[_0x3020ad['secondtransfereruniqueid']]['transfer']=!![];agents[_0x3020ad['secondtransfereruniqueid']][_0x8ea2('0x44')]=_0x8ea2('0x45');agents[_0x3020ad[_0x8ea2('0x42')]][_0x8ea2('0x3c')]=_0x3020ad[_0x8ea2('0x46')];agents[_0x3020ad[_0x8ea2('0x42')]][_0x8ea2('0x3e')]=_0x3020ad['origtransfereruniqueid'];}if(_0x3020ad['transfereeuniqueid']&&agents[_0x3020ad['transfereeuniqueid']]){agents[_0x3020ad[_0x8ea2('0x47')]][_0x8ea2('0x48')]=0x1;transfers[_0x3020ad[_0x8ea2('0x47')]]=_[_0x8ea2('0x49')](agents[_0x3020ad['transfereeuniqueid']]);transfers[_0x3020ad[_0x8ea2('0x47')]][_0x8ea2('0x9')]=agents[_0x3020ad['secondtransfereruniqueid']][_0x8ea2('0x9')];transfers[_0x3020ad[_0x8ea2('0x47')]][_0x8ea2('0x4a')]=agents[_0x3020ad[_0x8ea2('0x42')]][_0x8ea2('0x4a')];transfers[_0x3020ad['transfereeuniqueid']]['agentcalledAt']=utils['now']();transfers[_0x3020ad[_0x8ea2('0x47')]][_0x8ea2('0x2e')]=utils[_0x8ea2('0x19')]();transfers[_0x3020ad[_0x8ea2('0x47')]][_0x8ea2('0x2a')]=0x0;transfers[_0x3020ad['transfereeuniqueid']][_0x8ea2('0x48')]=0x2;}}else if(_0x3020ad[_0x8ea2('0x42')]==_0x3020ad[_0x8ea2('0x4b')]){if(!_[_0x8ea2('0x1f')](agents[_0x3020ad['origtransfereruniqueid']])){utils[_0x8ea2('0x3')](util['format'](_0x8ea2('0x43'),_0x3020ad['origtransfereruniqueid'],agents[_0x3020ad[_0x8ea2('0x41')]][_0x8ea2('0x8')]));agents[_0x3020ad['origtransfereruniqueid']]['transfer']=!![];agents[_0x3020ad[_0x8ea2('0x41')]]['transfertype']=_0x8ea2('0x45');agents[_0x3020ad[_0x8ea2('0x41')]][_0x8ea2('0x3c')]=_0x3020ad[_0x8ea2('0x4c')];agents[_0x3020ad['origtransfereruniqueid']][_0x8ea2('0x3e')]=_0x3020ad[_0x8ea2('0x42')];}if(_0x3020ad[_0x8ea2('0x4d')]&&agents[_0x3020ad[_0x8ea2('0x4d')]]){agents[_0x3020ad[_0x8ea2('0x4d')]][_0x8ea2('0x48')]=0x1;transfers[_0x3020ad[_0x8ea2('0x4d')]]=_[_0x8ea2('0x49')](agents[_0x3020ad[_0x8ea2('0x4d')]]);transfers[_0x3020ad[_0x8ea2('0x4d')]][_0x8ea2('0x9')]=agents[_0x3020ad[_0x8ea2('0x41')]]['calleridnum'];transfers[_0x3020ad[_0x8ea2('0x4d')]][_0x8ea2('0x4a')]=agents[_0x3020ad[_0x8ea2('0x41')]][_0x8ea2('0x4a')];transfers[_0x3020ad[_0x8ea2('0x4d')]][_0x8ea2('0x18')]=utils[_0x8ea2('0x19')]();transfers[_0x3020ad[_0x8ea2('0x4d')]][_0x8ea2('0x2e')]=utils[_0x8ea2('0x19')]();transfers[_0x3020ad[_0x8ea2('0x4d')]][_0x8ea2('0x2a')]=0x0;transfers[_0x3020ad['transfertargetuniqueid']][_0x8ea2('0x48')]=0x2;}}}catch(_0x383027){utils[_0x8ea2('0x1d')](util[_0x8ea2('0x4')](_0x8ea2('0x40'),_0x3020ad['origtransfereruniqueid']),_0x383027);}};exports['hangup']=function(_0x5d4d9e){try{utils[_0x8ea2('0x17')](util[_0x8ea2('0x4')](_0x8ea2('0x4e'),_0x5d4d9e[_0x8ea2('0x14')]),_0x5d4d9e);if(agents[_0x5d4d9e[_0x8ea2('0x14')]]&&agents[_0x5d4d9e[_0x8ea2('0x14')]]['reason']===_0x8ea2('0x4f')){if(_0x5d4d9e[_0x8ea2('0x50')]==='21'){agents[_0x5d4d9e['uniqueid']]['reason']=_0x8ea2('0x51');agents[_0x5d4d9e[_0x8ea2('0x14')]][_0x8ea2('0xb')]=_0x8ea2('0x51');}utils[_0x8ea2('0x3')](util[_0x8ea2('0x4')](_0x8ea2('0x52'),_0x5d4d9e['uniqueid'],agents[_0x5d4d9e[_0x8ea2('0x14')]][_0x8ea2('0x8')],agents[_0x5d4d9e[_0x8ea2('0x14')]][_0x8ea2('0x21')],agents[_0x5d4d9e['uniqueid']][_0x8ea2('0xb')]));writeDB(agents[_0x5d4d9e[_0x8ea2('0x14')]]);var _0x115d5f=unanswered['indexOf'](_0x5d4d9e[_0x8ea2('0x14')]);if(_0x115d5f>-0x1){unanswered['splice'](_0x115d5f,0x1);}}if(transfers[_0x5d4d9e['uniqueid']]){transfers[_0x5d4d9e[_0x8ea2('0x14')]][_0x8ea2('0x10')]=!![];transfers[_0x5d4d9e['uniqueid']]['agentcompleteAt']=utils['now']();transfers[_0x5d4d9e[_0x8ea2('0x14')]]['talktime']=utils['diffTime'](transfers[_0x5d4d9e[_0x8ea2('0x14')]][_0x8ea2('0x34')],transfers[_0x5d4d9e[_0x8ea2('0x14')]][_0x8ea2('0x2e')]);transfers[_0x5d4d9e[_0x8ea2('0x14')]][_0x8ea2('0x21')]=_0x8ea2('0x53');transfers[_0x5d4d9e[_0x8ea2('0x14')]][_0x8ea2('0xb')]=_0x8ea2('0x36');utils[_0x8ea2('0x3')](util[_0x8ea2('0x4')](_0x8ea2('0x52'),_0x5d4d9e[_0x8ea2('0x14')],transfers[_0x5d4d9e['uniqueid']][_0x8ea2('0x8')],transfers[_0x5d4d9e[_0x8ea2('0x14')]][_0x8ea2('0x21')],transfers[_0x5d4d9e['uniqueid']][_0x8ea2('0xb')]));writeDB(transfers[_0x5d4d9e['uniqueid']],!![]);}if(agents[_0x5d4d9e[_0x8ea2('0x14')]]&&agents[_0x5d4d9e['uniqueid']][_0x8ea2('0x2e')]){agents[_0x5d4d9e['uniqueid']][_0x8ea2('0x10')]=!![];agents[_0x5d4d9e[_0x8ea2('0x14')]]['agentcompleteAt']=utils[_0x8ea2('0x19')]();agents[_0x5d4d9e['uniqueid']][_0x8ea2('0x23')]=utils[_0x8ea2('0x35')](agents[_0x5d4d9e[_0x8ea2('0x14')]][_0x8ea2('0x34')],agents[_0x5d4d9e[_0x8ea2('0x14')]]['agentconnectAt']);agents[_0x5d4d9e['uniqueid']][_0x8ea2('0x21')]=agents[_0x5d4d9e['uniqueid']][_0x8ea2('0x3b')]?_0x8ea2('0x3b'):_0x8ea2('0x53');agents[_0x5d4d9e[_0x8ea2('0x14')]][_0x8ea2('0xb')]=_0x8ea2('0x36');utils['info'](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5d4d9e[_0x8ea2('0x14')],agents[_0x5d4d9e['uniqueid']][_0x8ea2('0x8')],agents[_0x5d4d9e[_0x8ea2('0x14')]][_0x8ea2('0x21')],agents[_0x5d4d9e[_0x8ea2('0x14')]][_0x8ea2('0xb')]));writeDB(agents[_0x5d4d9e[_0x8ea2('0x14')]]);}}catch(_0x4b4d64){utils[_0x8ea2('0x1d')](util[_0x8ea2('0x4')](_0x8ea2('0x4e'),_0x5d4d9e[_0x8ea2('0x14')]),_0x4b4d64);}}; \ No newline at end of file +var _0xf290=['now','connectedlinename','error','agentringnoanswer','timeout','reason','holdtime','push','[%s][agents][agentringnoanswer]','includes','debug','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','talktime','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','ringtime','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','isNil','[%s][agents][agentcomplete]','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','transfertype','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transfertargetuniqueid','clone','calleridname','hangup','[%s][agents][hangup]','rejected','indexOf','agent','util','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','calleridnum','connectedlinenum','lastevent','queue','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','request','CreateVoiceAgentReport','destuniqueid','agentcalled','[%s][agents][agentcalled]','agentcalledAt'];(function(_0x842f2a,_0xc98ed3){var _0x12ecb8=function(_0x39fd7b){while(--_0x39fd7b){_0x842f2a['push'](_0x842f2a['shift']());}};_0x12ecb8(++_0xc98ed3);}(_0xf290,0xde));var _0x0f29=function(_0x5a7112,_0x1f9492){_0x5a7112=_0x5a7112-0x0;var _0x3147f7=_0xf290[_0x5a7112];return _0x3147f7;};'use strict';var _=require('lodash');var util=require(_0x0f29('0x0'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x1d35f0,_0x4b16e4){utils[_0x0f29('0x1')](util[_0x0f29('0x2')](_0x0f29('0x3'),_0x1d35f0[_0x0f29('0x4')],_0x1d35f0[_0x0f29('0x5')],_0x1d35f0['queue'],_0x1d35f0[_0x0f29('0x6')],_0x1d35f0['interface'],_0x1d35f0[_0x0f29('0x7')],_0x1d35f0[_0x0f29('0x8')],_0x1d35f0[_0x0f29('0x9')]));if(_0x1d35f0[_0x0f29('0xa')]){utils[_0x0f29('0xb')](_0x1d35f0[_0x0f29('0xa')])[_0x0f29('0xc')](function(_0x3c6a6e){if(_0x3c6a6e){_0x1d35f0[_0x0f29('0xd')]=_0x3c6a6e[_0x0f29('0xd')];_0x1d35f0[_0x0f29('0xe')]=_0x1d35f0[_0x0f29('0xf')]?_0x3c6a6e[_0x0f29('0x10')]:![];_0x1d35f0[_0x0f29('0x11')]=_0x1d35f0[_0x0f29('0xe')]?_0x3c6a6e['acwTimeout']:0x0;}utils[_0x0f29('0x12')]('CreateVoiceAgentReport',_0x1d35f0);});}else{utils[_0x0f29('0x12')](_0x0f29('0x13'),_0x1d35f0);}if(_0x4b16e4){delete transfers[_0x1d35f0[_0x0f29('0x4')]];}else{delete agents[_0x1d35f0[_0x0f29('0x14')]];}}exports[_0x0f29('0x15')]=function(_0x2d2573){try{utils['debug'](util[_0x0f29('0x2')](_0x0f29('0x16'),_0x2d2573[_0x0f29('0x4')]),_0x2d2573);agents[_0x2d2573[_0x0f29('0x14')]]=_0x2d2573;agents[_0x2d2573[_0x0f29('0x14')]][_0x0f29('0x17')]=utils[_0x0f29('0x18')]();agents[_0x2d2573[_0x0f29('0x14')]]['lastevent']='called';agents[_0x2d2573[_0x0f29('0x14')]][_0x0f29('0x8')]=null;agents[_0x2d2573[_0x0f29('0x14')]][_0x0f29('0x19')]=null;utils['info'](util[_0x0f29('0x2')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x2d2573[_0x0f29('0x4')],agents[_0x2d2573['destuniqueid']]['membername'],_0x2d2573['destuniqueid']));}catch(_0x23a44f){utils[_0x0f29('0x1a')](util[_0x0f29('0x2')](_0x0f29('0x16'),_0x2d2573[_0x0f29('0x4')]),_0x23a44f);}};exports[_0x0f29('0x1b')]=function(_0x150271){try{if(!_['isNil'](agents[_0x150271[_0x0f29('0x14')]])){utils['debug'](util['format']('[%s][agents][agentringnoanswer]',_0x150271['uniqueid']),_0x150271);utils[_0x0f29('0x1')](util[_0x0f29('0x2')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x150271[_0x0f29('0x4')],agents[_0x150271[_0x0f29('0x14')]][_0x0f29('0x6')],_0x150271[_0x0f29('0x14')]));agents[_0x150271[_0x0f29('0x14')]]['agentringnoanswer']=!![];agents[_0x150271[_0x0f29('0x14')]]['agentringnoanswerAt']=utils[_0x0f29('0x18')]();agents[_0x150271[_0x0f29('0x14')]][_0x0f29('0x9')]=_0x0f29('0x1c');agents[_0x150271['destuniqueid']][_0x0f29('0x1d')]='timeout';agents[_0x150271['destuniqueid']][_0x0f29('0x1e')]=_0x150271['ringtime']?parseInt(_0x150271['ringtime'])/0x3e8:0x0;agents[_0x150271['destuniqueid']]['talktime']=0x0;unanswered[_0x0f29('0x1f')](_0x150271[_0x0f29('0x14')]);}}catch(_0x4cc5a0){utils[_0x0f29('0x1a')](util[_0x0f29('0x2')](_0x0f29('0x20'),_0x150271['uniqueid']),_0x4cc5a0);}};exports['queuecallerabandon']=function(_0x37ebcc){try{_['forIn'](agents,function(_0x36b65c,_0x561c31){if(_0x36b65c['uniqueid']==_0x37ebcc[_0x0f29('0x4')]&&!_[_0x0f29('0x21')](unanswered,_0x36b65c[_0x0f29('0x14')])){utils[_0x0f29('0x22')](util['format']('[%s][agents][queuecallerabandon]',_0x37ebcc[_0x0f29('0x4')]),_0x37ebcc);utils['info'](util['format'](_0x0f29('0x23'),_0x37ebcc['uniqueid'],_0x36b65c[_0x0f29('0x6')],_0x36b65c['destuniqueid']));_0x36b65c['agentringnoanswer']=!![];_0x36b65c[_0x0f29('0x24')]=utils[_0x0f29('0x18')]();_0x36b65c[_0x0f29('0x9')]=_0x0f29('0x25');_0x36b65c[_0x0f29('0x1d')]='abandoned';_0x36b65c[_0x0f29('0x1e')]=_0x37ebcc['holdtime'];_0x36b65c[_0x0f29('0x26')]=0x0;writeDB(_0x36b65c);}});}catch(_0x3e8f3f){utils[_0x0f29('0x1a')](util[_0x0f29('0x2')]('[%s][agents][queuecallerabandon]',_0x37ebcc[_0x0f29('0x4')]),_0x3e8f3f);}};exports[_0x0f29('0x27')]=function(_0x5be4fa){try{if(agents[_0x5be4fa[_0x0f29('0x14')]]){utils[_0x0f29('0x22')](util['format']('[%s][agents][agentconnect]',_0x5be4fa[_0x0f29('0x4')]),_0x5be4fa);utils[_0x0f29('0x1')](util[_0x0f29('0x2')](_0x0f29('0x28'),_0x5be4fa[_0x0f29('0x4')],agents[_0x5be4fa[_0x0f29('0x14')]]['membername'],_0x5be4fa[_0x0f29('0x14')]));agents[_0x5be4fa['destuniqueid']][_0x0f29('0x29')]=utils['now']();agents[_0x5be4fa[_0x0f29('0x14')]][_0x0f29('0x8')]=_0x5be4fa[_0x0f29('0x8')];agents[_0x5be4fa['destuniqueid']]['connectedlinename']=_0x5be4fa[_0x0f29('0x19')];agents[_0x5be4fa['destuniqueid']][_0x0f29('0x1e')]=_0x5be4fa[_0x0f29('0x2a')];agents[_0x5be4fa[_0x0f29('0x14')]][_0x0f29('0x9')]=_0x0f29('0x2b');_['forIn'](agents,function(_0x13c05c,_0xf77c66){if(_0x13c05c[_0x0f29('0x14')]!=_0x5be4fa[_0x0f29('0x14')]&&_0x13c05c[_0x0f29('0x4')]==_0x5be4fa[_0x0f29('0x4')]){_0x13c05c[_0x0f29('0x26')]=0x0;_0x13c05c[_0x0f29('0x1e')]=_0x5be4fa[_0x0f29('0x2a')];_0x13c05c['agentringnoanswer']=!![];_0x13c05c[_0x0f29('0x24')]=utils[_0x0f29('0x18')]();_0x13c05c[_0x0f29('0x9')]=_0x0f29('0x2c');_0x13c05c['reason']=_0x0f29('0x2c');_0x13c05c[_0x0f29('0x2d')]=_0x5be4fa[_0x0f29('0x14')];_0x13c05c[_0x0f29('0x2e')]=_0x5be4fa[_0x0f29('0x6')];writeDB(_0x13c05c);}});}}catch(_0x56062d){utils[_0x0f29('0x1a')](util[_0x0f29('0x2')](_0x0f29('0x2f'),_0x5be4fa['uniqueid']),_0x56062d);}};exports[_0x0f29('0xf')]=function(_0x284279){try{if(!_[_0x0f29('0x30')](agents[_0x284279[_0x0f29('0x14')]])){utils[_0x0f29('0x22')](util[_0x0f29('0x2')](_0x0f29('0x31'),_0x284279[_0x0f29('0x4')]),_0x284279);utils['info'](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x284279[_0x0f29('0x4')],agents[_0x284279[_0x0f29('0x14')]][_0x0f29('0x6')],_0x284279[_0x0f29('0x14')]));agents[_0x284279[_0x0f29('0x14')]][_0x0f29('0xf')]=!![];agents[_0x284279['destuniqueid']][_0x0f29('0x32')]=utils['now']();agents[_0x284279[_0x0f29('0x14')]]['talktime']=utils[_0x0f29('0x33')](agents[_0x284279[_0x0f29('0x14')]][_0x0f29('0x32')],agents[_0x284279[_0x0f29('0x14')]][_0x0f29('0x29')]);agents[_0x284279['destuniqueid']][_0x0f29('0x1d')]=_0x284279[_0x0f29('0x1d')];agents[_0x284279[_0x0f29('0x14')]]['lastevent']=_0x0f29('0x34');writeDB(agents[_0x284279['destuniqueid']]);}}catch(_0x4fd625){utils[_0x0f29('0x1a')](util[_0x0f29('0x2')](_0x0f29('0x31'),_0x284279[_0x0f29('0x4')]),_0x4fd625);}};exports[_0x0f29('0x35')]=function(_0x335435){try{if(!_['isNil'](agents[_0x335435[_0x0f29('0x36')]])){utils[_0x0f29('0x22')](util[_0x0f29('0x2')](_0x0f29('0x37'),_0x335435[_0x0f29('0x4')]),_0x335435);utils[_0x0f29('0x1')](util[_0x0f29('0x2')](_0x0f29('0x38'),_0x335435[_0x0f29('0x4')],agents[_0x335435[_0x0f29('0x36')]]['membername'],agents[_0x335435['transfereruniqueid']][_0x0f29('0x4')]));agents[_0x335435[_0x0f29('0x36')]][_0x0f29('0x39')]=!![];agents[_0x335435[_0x0f29('0x36')]]['transfertype']=_0x0f29('0x3a');agents[_0x335435[_0x0f29('0x36')]][_0x0f29('0x3b')]=_0x335435[_0x0f29('0x3c')];agents[_0x335435[_0x0f29('0x36')]][_0x0f29('0x3d')]=agents[_0x335435[_0x0f29('0x36')]]['uniqueid'];}}catch(_0x17f33){utils[_0x0f29('0x1a')](util[_0x0f29('0x2')](_0x0f29('0x37'),_0x335435[_0x0f29('0x4')]),_0x17f33);}};exports[_0x0f29('0x3e')]=function(_0x5ec172){try{utils[_0x0f29('0x22')](util[_0x0f29('0x2')](_0x0f29('0x3f'),_0x5ec172['origtransfereruniqueid']),_0x5ec172);if(_0x5ec172[_0x0f29('0x40')]==_0x5ec172['origtransfererlinkedid']){if(!_[_0x0f29('0x30')](agents[_0x5ec172['secondtransfereruniqueid']])){utils[_0x0f29('0x1')](util[_0x0f29('0x2')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x5ec172[_0x0f29('0x40')],agents[_0x5ec172[_0x0f29('0x41')]][_0x0f29('0x6')]));agents[_0x5ec172['secondtransfereruniqueid']][_0x0f29('0x39')]=!![];agents[_0x5ec172['secondtransfereruniqueid']][_0x0f29('0x42')]=_0x0f29('0x43');agents[_0x5ec172['secondtransfereruniqueid']][_0x0f29('0x3b')]=_0x5ec172[_0x0f29('0x44')];agents[_0x5ec172['secondtransfereruniqueid']][_0x0f29('0x3d')]=_0x5ec172['origtransfereruniqueid'];}if(_0x5ec172[_0x0f29('0x45')]&&agents[_0x5ec172['transfereeuniqueid']]){agents[_0x5ec172[_0x0f29('0x45')]][_0x0f29('0x46')]=0x1;transfers[_0x5ec172[_0x0f29('0x45')]]=_['clone'](agents[_0x5ec172[_0x0f29('0x45')]]);transfers[_0x5ec172[_0x0f29('0x45')]][_0x0f29('0x7')]=agents[_0x5ec172[_0x0f29('0x41')]]['calleridnum'];transfers[_0x5ec172[_0x0f29('0x45')]]['calleridname']=agents[_0x5ec172[_0x0f29('0x41')]]['calleridname'];transfers[_0x5ec172[_0x0f29('0x45')]][_0x0f29('0x17')]=utils[_0x0f29('0x18')]();transfers[_0x5ec172[_0x0f29('0x45')]][_0x0f29('0x29')]=utils[_0x0f29('0x18')]();transfers[_0x5ec172[_0x0f29('0x45')]]['holdtime']=0x0;transfers[_0x5ec172[_0x0f29('0x45')]]['agententerreason']=0x2;}}else if(_0x5ec172[_0x0f29('0x41')]==_0x5ec172[_0x0f29('0x47')]){if(!_[_0x0f29('0x30')](agents[_0x5ec172['origtransfereruniqueid']])){utils[_0x0f29('0x1')](util[_0x0f29('0x2')](_0x0f29('0x48'),_0x5ec172[_0x0f29('0x40')],agents[_0x5ec172[_0x0f29('0x40')]]['membername']));agents[_0x5ec172['origtransfereruniqueid']][_0x0f29('0x39')]=!![];agents[_0x5ec172[_0x0f29('0x40')]][_0x0f29('0x42')]='ATTENDED';agents[_0x5ec172['origtransfereruniqueid']][_0x0f29('0x3b')]=_0x5ec172[_0x0f29('0x49')];agents[_0x5ec172[_0x0f29('0x40')]]['transferuniqueid']=_0x5ec172['secondtransfereruniqueid'];}if(_0x5ec172['transfertargetuniqueid']&&agents[_0x5ec172[_0x0f29('0x4a')]]){agents[_0x5ec172[_0x0f29('0x4a')]]['agententerreason']=0x1;transfers[_0x5ec172[_0x0f29('0x4a')]]=_[_0x0f29('0x4b')](agents[_0x5ec172['transfertargetuniqueid']]);transfers[_0x5ec172[_0x0f29('0x4a')]]['calleridnum']=agents[_0x5ec172[_0x0f29('0x40')]][_0x0f29('0x7')];transfers[_0x5ec172['transfertargetuniqueid']][_0x0f29('0x4c')]=agents[_0x5ec172[_0x0f29('0x40')]][_0x0f29('0x4c')];transfers[_0x5ec172[_0x0f29('0x4a')]][_0x0f29('0x17')]=utils[_0x0f29('0x18')]();transfers[_0x5ec172['transfertargetuniqueid']][_0x0f29('0x29')]=utils[_0x0f29('0x18')]();transfers[_0x5ec172[_0x0f29('0x4a')]]['holdtime']=0x0;transfers[_0x5ec172[_0x0f29('0x4a')]][_0x0f29('0x46')]=0x2;}}}catch(_0x4bbc7e){utils[_0x0f29('0x1a')](util['format'](_0x0f29('0x3f'),_0x5ec172[_0x0f29('0x40')]),_0x4bbc7e);}};exports[_0x0f29('0x4d')]=function(_0x4bd8f1){try{utils[_0x0f29('0x22')](util[_0x0f29('0x2')](_0x0f29('0x4e'),_0x4bd8f1[_0x0f29('0x4')]),_0x4bd8f1);if(agents[_0x4bd8f1[_0x0f29('0x4')]]&&agents[_0x4bd8f1[_0x0f29('0x4')]]['reason']===_0x0f29('0x1c')){if(_0x4bd8f1['cause']==='21'){agents[_0x4bd8f1['uniqueid']][_0x0f29('0x1d')]=_0x0f29('0x4f');agents[_0x4bd8f1['uniqueid']][_0x0f29('0x9')]=_0x0f29('0x4f');}utils['info'](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x4bd8f1['uniqueid'],agents[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x6')],agents[_0x4bd8f1['uniqueid']]['reason'],agents[_0x4bd8f1[_0x0f29('0x4')]]['lastevent']));writeDB(agents[_0x4bd8f1[_0x0f29('0x4')]]);var _0x473eac=unanswered[_0x0f29('0x50')](_0x4bd8f1[_0x0f29('0x4')]);if(_0x473eac>-0x1){unanswered['splice'](_0x473eac,0x1);}}if(transfers[_0x4bd8f1[_0x0f29('0x4')]]){transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0xf')]=!![];transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x32')]=utils['now']();transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x26')]=utils[_0x0f29('0x33')](transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x32')],transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x29')]);transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x1d')]=_0x0f29('0x51');transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x9')]=_0x0f29('0x34');utils[_0x0f29('0x1')](util[_0x0f29('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x4bd8f1[_0x0f29('0x4')],transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x6')],transfers[_0x4bd8f1[_0x0f29('0x4')]]['reason'],transfers[_0x4bd8f1['uniqueid']][_0x0f29('0x9')]));writeDB(transfers[_0x4bd8f1[_0x0f29('0x4')]],!![]);}if(agents[_0x4bd8f1[_0x0f29('0x4')]]&&agents[_0x4bd8f1['uniqueid']][_0x0f29('0x29')]){agents[_0x4bd8f1['uniqueid']][_0x0f29('0xf')]=!![];agents[_0x4bd8f1['uniqueid']][_0x0f29('0x32')]=utils[_0x0f29('0x18')]();agents[_0x4bd8f1[_0x0f29('0x4')]]['talktime']=utils[_0x0f29('0x33')](agents[_0x4bd8f1['uniqueid']]['agentcompleteAt'],agents[_0x4bd8f1[_0x0f29('0x4')]]['agentconnectAt']);agents[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x1d')]=agents[_0x4bd8f1['uniqueid']][_0x0f29('0x39')]?_0x0f29('0x39'):_0x0f29('0x51');agents[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x9')]=_0x0f29('0x34');utils[_0x0f29('0x1')](util[_0x0f29('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x4bd8f1[_0x0f29('0x4')],agents[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x6')],agents[_0x4bd8f1['uniqueid']][_0x0f29('0x1d')],agents[_0x4bd8f1[_0x0f29('0x4')]]['lastevent']));writeDB(agents[_0x4bd8f1[_0x0f29('0x4')]]);}}catch(_0x5e39a7){utils[_0x0f29('0x1a')](util['format'](_0x0f29('0x4e'),_0x4bd8f1['uniqueid']),_0x5e39a7);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 32a26cf..ba5c6c1 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 _0xdf62=['substring','lastIndexOf','gotoif','[%s][calls][newexten]','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','uniqueid','blinds','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','recording','newchannel','debug','[%s][calls][newchannel]','linkedid','channel','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','newstate','isNil','systemanswertime','channelstate','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','[%s][calls][newstate]','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','duration','endtime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','userfield','_attended','origtransfereruniqueid','origtransfererchannel','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\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','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr','split'];(function(_0x272d4e,_0x4adf01){var _0x17863a=function(_0x1e7829){while(--_0x1e7829){_0x272d4e['push'](_0x272d4e['shift']());}};_0x17863a(++_0x4adf01);}(_0xdf62,0x151));var _0x2df6=function(_0x9e7f9b,_0x372c6a){_0x9e7f9b=_0x9e7f9b-0x0;var _0x236b32=_0xdf62[_0x9e7f9b];return _0x236b32;};'use strict';var _=require(_0x2df6('0x0'));var util=require(_0x2df6('0x1'));var utils=require(_0x2df6('0x2'));var transfers=require(_0x2df6('0x3'));var dispositions=[_0x2df6('0x4'),_0x2df6('0x5'),'FAILED','NO\x20ANSWER',_0x2df6('0x4'),_0x2df6('0x4'),_0x2df6('0x6'),_0x2df6('0x7'),_0x2df6('0x5'),_0x2df6('0x5'),_0x2df6('0x5')];var channels={};function writeDB(_0x5059ec){var _0x8acc33;if(transfers['blinds'][_0x5059ec[_0x2df6('0x8')]]){_0x8acc33=_0x5059ec[_0x2df6('0x8')];_0x5059ec[_0x2df6('0x8')]=transfers[_0x2df6('0x9')][_0x5059ec['uniqueid']]['transfereeuniqueid'];}utils[_0x2df6('0xa')](util[_0x2df6('0xb')](_0x2df6('0xc'),_0x5059ec[_0x2df6('0x8')],_0x5059ec['channel'],_0x5059ec[_0x2df6('0xd')],_0x5059ec[_0x2df6('0xe')],_0x5059ec['interface'],_0x5059ec[_0x2df6('0xf')],_0x5059ec[_0x2df6('0x10')],_0x5059ec[_0x2df6('0x11')]));if(_0x5059ec[_0x2df6('0x12')]){utils[_0x2df6('0x13')](_0x5059ec['accountcode'])[_0x2df6('0x14')](function(_0x2bd59c){if(_0x2bd59c){_0x5059ec[_0x2df6('0x15')]=_0x2bd59c['id'];}utils[_0x2df6('0x16')](_0x2df6('0x17'),_0x5059ec);});}else{utils['request'](_0x2df6('0x17'),_0x5059ec);}if(channels[_0x5059ec[_0x2df6('0x8')]]){delete channels[_0x5059ec[_0x2df6('0x8')]];}else if(_0x8acc33&&channels[_0x8acc33]){if(!transfers[_0x2df6('0x9')][_0x8acc33][_0x2df6('0x18')])delete transfers['blinds'][_0x8acc33];delete channels[_0x8acc33];}}exports[_0x2df6('0x19')]=function(_0x207189){try{utils[_0x2df6('0x1a')](util[_0x2df6('0xb')](_0x2df6('0x1b'),_0x207189['uniqueid']),_0x207189);if(_0x207189[_0x2df6('0x8')]==_0x207189[_0x2df6('0x1c')]&&_0x207189[_0x2df6('0x1d')]!=_0x2df6('0x1e')){utils[_0x2df6('0xa')](util[_0x2df6('0xb')](_0x2df6('0x1f'),_0x207189['uniqueid'],_0x207189[_0x2df6('0x20')],_0x207189[_0x2df6('0x21')]));channels[_0x207189[_0x2df6('0x8')]]={'uniqueid':_0x207189['uniqueid'],'accountcode':_0x207189[_0x2df6('0x12')],'source':_0x207189[_0x2df6('0xf')],'destination':_0x207189[_0x2df6('0x21')],'destinationcontext':_0x207189['context'],'channel':_0x207189[_0x2df6('0x1d')],'starttime':utils[_0x2df6('0x22')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x2df6('0x4'),'amaflags':_0x2df6('0x23')};}}catch(_0x2a59db){utils[_0x2df6('0x24')](util[_0x2df6('0xb')](_0x2df6('0x1b'),_0x207189[_0x2df6('0x8')]),_0x2a59db);}};exports[_0x2df6('0x25')]=function(_0x42aa51){try{utils[_0x2df6('0x1a')](util['format']('[%s][calls][newstate]',_0x42aa51[_0x2df6('0x8')]),_0x42aa51);if(!_[_0x2df6('0x26')](channels[_0x42aa51[_0x2df6('0x8')]])&&_0x42aa51['channelstate']==0x6){utils[_0x2df6('0xa')](util[_0x2df6('0xb')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x42aa51[_0x2df6('0x8')],_0x42aa51['context'],_0x42aa51[_0x2df6('0x1d')]));if(_['isNil'](channels[_0x42aa51[_0x2df6('0x8')]]['systemanswertime'])){channels[_0x42aa51[_0x2df6('0x8')]][_0x2df6('0x27')]=utils[_0x2df6('0x22')]();}}else if(!_[_0x2df6('0x26')](channels[_0x42aa51['linkedid']])&&_0x42aa51[_0x2df6('0x28')]==0x6&&_0x42aa51['context']!='transfer'){utils[_0x2df6('0xa')](util[_0x2df6('0xb')](_0x2df6('0x29'),_0x42aa51['uniqueid'],_0x42aa51[_0x2df6('0x1c')],_0x42aa51[_0x2df6('0x20')],_0x42aa51[_0x2df6('0x1d')]));channels[_0x42aa51[_0x2df6('0x1c')]][_0x2df6('0x12')]=_0x42aa51[_0x2df6('0x12')];channels[_0x42aa51[_0x2df6('0x1c')]]['destinationchannel']=_0x42aa51[_0x2df6('0x1d')];if(_[_0x2df6('0x26')](channels[_0x42aa51[_0x2df6('0x1c')]][_0x2df6('0x2a')])){channels[_0x42aa51['linkedid']][_0x2df6('0x2a')]=utils['now']();}channels[_0x42aa51['linkedid']][_0x2df6('0x2b')]=dispositions[_[_0x2df6('0x2c')](_0x42aa51[_0x2df6('0x28')])]||_0x2df6('0x6');}}catch(_0x52f913){utils[_0x2df6('0x24')](util[_0x2df6('0xb')](_0x2df6('0x2d'),_0x42aa51[_0x2df6('0x8')]),_0x52f913);}};exports[_0x2df6('0x2e')]=function(_0x18d63f){try{if(!_['isNil'](channels[_0x18d63f[_0x2df6('0x8')]])){utils[_0x2df6('0x1a')](util['format'](_0x2df6('0x2f'),_0x18d63f[_0x2df6('0x8')]),_0x18d63f);if(_[_0x2df6('0x26')](channels[_0x18d63f[_0x2df6('0x8')]][_0x2df6('0x30')])){channels[_0x18d63f[_0x2df6('0x8')]]['callerid']=_0x18d63f[_0x2df6('0x31')]+'\x20<'+_0x18d63f[_0x2df6('0xf')]+'>';}utils[_0x2df6('0xa')](util[_0x2df6('0xb')](_0x2df6('0x32'),_0x18d63f[_0x2df6('0x8')],channels[_0x18d63f['uniqueid']]['callerid'],_0x18d63f[_0x2df6('0x33')]));channels[_0x18d63f['uniqueid']]['endtime']=utils['now']();channels[_0x18d63f[_0x2df6('0x8')]][_0x2df6('0x34')]=utils['diffTime'](channels[_0x18d63f[_0x2df6('0x8')]][_0x2df6('0x35')],channels[_0x18d63f[_0x2df6('0x8')]][_0x2df6('0x36')]);channels[_0x18d63f[_0x2df6('0x8')]][_0x2df6('0x37')]=channels[_0x18d63f['uniqueid']]['answertime']?utils['diffTime'](channels[_0x18d63f[_0x2df6('0x8')]][_0x2df6('0x35')],channels[_0x18d63f['uniqueid']][_0x2df6('0x2a')]):0x0;writeDB(channels[_0x18d63f[_0x2df6('0x8')]]);}}catch(_0xe34b55){utils['error'](util[_0x2df6('0xb')](_0x2df6('0x2f'),_0x18d63f[_0x2df6('0x8')]),_0xe34b55);}};exports[_0x2df6('0x38')]=function(_0x509418){try{if(!_[_0x2df6('0x26')](channels[_0x509418[_0x2df6('0x39')]])){utils[_0x2df6('0x1a')](util[_0x2df6('0xb')](_0x2df6('0x3a'),_0x509418['origtransfereruniqueid']),_0x509418);if(channels[_0x509418[_0x2df6('0x39')]][_0x2df6('0x1d')]==_0x509418[_0x2df6('0x3b')]){utils['info'](util[_0x2df6('0xb')](_0x2df6('0x3c'),_0x509418['origtransfereruniqueid'],_0x509418[_0x2df6('0x39')],_0x509418[_0x2df6('0x3d')]));channels[_0x509418[_0x2df6('0x39')]][_0x2df6('0x3e')]=_0x509418[_0x2df6('0x3d')];channels[_0x509418[_0x2df6('0x39')]][_0x2df6('0x3f')]=_0x2df6('0x40');}else if(channels[_0x509418['localtwolinkedid']][_0x2df6('0x1d')]=_0x509418['transfertargetchannel']){utils['info'](util[_0x2df6('0xb')](_0x2df6('0x3c'),_0x509418[_0x2df6('0x41')],_0x509418[_0x2df6('0x39')],_0x509418[_0x2df6('0x42')]));channels[_0x509418['localtwolinkedid']]['destinationchannel']=_0x509418[_0x2df6('0x42')];channels[_0x509418['localtwolinkedid']]['userfield']='_attended';}}}catch(_0x20c032){utils[_0x2df6('0x24')](util['format'](_0x2df6('0x3a'),_0x509418[_0x2df6('0x41')]),_0x20c032);}};exports['musiconholdstart']=function(_0x4fc2c0){try{if(!_[_0x2df6('0x26')](channels[_0x4fc2c0[_0x2df6('0x8')]])){utils[_0x2df6('0x1a')](util['format'](_0x2df6('0x43'),_0x4fc2c0[_0x2df6('0x8')]),_0x4fc2c0);channels[_0x4fc2c0[_0x2df6('0x8')]][_0x2df6('0x44')]=utils[_0x2df6('0x22')]();utils['info'](util[_0x2df6('0xb')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x4fc2c0[_0x2df6('0x8')],channels[_0x4fc2c0[_0x2df6('0x8')]][_0x2df6('0x44')]));}}catch(_0x4dfaea){utils[_0x2df6('0x24')](util['format'](_0x2df6('0x43'),_0x4fc2c0[_0x2df6('0x8')]),_0x4dfaea);}};exports[_0x2df6('0x45')]=function(_0x290834){try{if(!_['isNil'](channels[_0x290834['uniqueid']])){utils[_0x2df6('0x1a')](util[_0x2df6('0xb')](_0x2df6('0x46'),_0x290834[_0x2df6('0x8')]),_0x290834);if(!_[_0x2df6('0x26')](channels[_0x290834['uniqueid']]['musiconholdstartAt'])){channels[_0x290834[_0x2df6('0x8')]][_0x2df6('0x47')]+=utils['diffTime'](utils['now'](),channels[_0x290834['uniqueid']]['musiconholdstartAt']);utils['info'](util[_0x2df6('0xb')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x290834[_0x2df6('0x8')],channels[_0x290834[_0x2df6('0x8')]][_0x2df6('0x47')]));delete channels[_0x290834[_0x2df6('0x8')]][_0x2df6('0x44')];}}}catch(_0x6283a7){utils[_0x2df6('0x24')](util[_0x2df6('0xb')](_0x2df6('0x46'),_0x290834['uniqueid']),_0x6283a7);}};exports[_0x2df6('0x48')]=function(_0x1d97e8){try{if(!_[_0x2df6('0x26')](channels[_0x1d97e8[_0x2df6('0x8')]])){utils['debug'](util['format']('[%s][calls][varset]',_0x1d97e8[_0x2df6('0x8')]),_0x1d97e8);if(!_[_0x2df6('0x26')](_0x1d97e8[_0x2df6('0x49')]['xmd-originatecalleridnum'])){utils[_0x2df6('0xa')](util[_0x2df6('0xb')](_0x2df6('0x4a'),_0x1d97e8[_0x2df6('0x8')],_0x1d97e8[_0x2df6('0x4b')]));channels[_0x1d97e8[_0x2df6('0x8')]][_0x2df6('0x4c')]=_0x1d97e8[_0x2df6('0x4b')];}if(!_[_0x2df6('0x26')](_0x1d97e8[_0x2df6('0x49')][_0x2df6('0x4d')])){utils[_0x2df6('0xa')](util[_0x2df6('0xb')](_0x2df6('0x4e'),_0x1d97e8[_0x2df6('0x8')],_0x1d97e8[_0x2df6('0x4b')]));channels[_0x1d97e8['uniqueid']]['destination']=_0x1d97e8[_0x2df6('0x4b')];channels[_0x1d97e8[_0x2df6('0x8')]][_0x2df6('0x30')]='\x22'+_0x1d97e8[_0x2df6('0x4b')]+_0x2df6('0x4f')+_0x1d97e8[_0x2df6('0x4b')]+'>';}if(!_[_0x2df6('0x26')](_0x1d97e8[_0x2df6('0x49')][_0x2df6('0x50')])||!_[_0x2df6('0x26')](_0x1d97e8[_0x2df6('0x49')][_0x2df6('0x51')])){utils[_0x2df6('0xa')](util[_0x2df6('0xb')](_0x2df6('0x52'),_0x1d97e8[_0x2df6('0x8')],!_['isNil'](_0x1d97e8[_0x2df6('0x49')][_0x2df6('0x50')])?_0x2df6('0x50'):_0x2df6('0x51'),_0x1d97e8[_0x2df6('0x4b')]));channels[_0x1d97e8[_0x2df6('0x8')]][_0x2df6('0x30')]=_0x1d97e8[_0x2df6('0x4b')];}if(!_[_0x2df6('0x26')](_0x1d97e8[_0x2df6('0x49')][_0x2df6('0x53')])||!_[_0x2df6('0x26')](_0x1d97e8[_0x2df6('0x49')][_0x2df6('0x54')])){utils[_0x2df6('0xa')](util['format'](_0x2df6('0x52'),_0x1d97e8['uniqueid'],!_[_0x2df6('0x26')](_0x1d97e8[_0x2df6('0x49')][_0x2df6('0x53')])?_0x2df6('0x53'):_0x2df6('0x54'),_0x1d97e8[_0x2df6('0x4b')]));channels[_0x1d97e8[_0x2df6('0x8')]][_0x2df6('0x55')]=_0x2df6('0x56');channels[_0x1d97e8[_0x2df6('0x8')]][_0x2df6('0x57')]=_0x1d97e8['value'];channels[_0x1d97e8['uniqueid']][_0x2df6('0xd')]=!![];}if(!_[_0x2df6('0x26')](_0x1d97e8['variable'][_0x2df6('0x58')])){utils[_0x2df6('0xa')](util[_0x2df6('0xb')](_0x2df6('0x59'),_0x1d97e8[_0x2df6('0x8')],_0x1d97e8['value']));channels[_0x1d97e8[_0x2df6('0x8')]]['ContactId']=_0x1d97e8[_0x2df6('0x4b')];}if(!_[_0x2df6('0x26')](_0x1d97e8[_0x2df6('0x49')][_0x2df6('0x5a')])){utils[_0x2df6('0xa')](util[_0x2df6('0xb')](_0x2df6('0x5b'),_0x1d97e8['uniqueid'],_0x1d97e8['value']));channels[_0x1d97e8['uniqueid']][_0x2df6('0x5c')]=_0x1d97e8[_0x2df6('0x4b')];}if(!_['isNil'](_0x1d97e8['variable'][_0x2df6('0x5d')])){utils[_0x2df6('0xa')](util[_0x2df6('0xb')](_0x2df6('0x5e'),_0x1d97e8[_0x2df6('0x8')],_0x1d97e8[_0x2df6('0x4b')]));channels[_0x1d97e8[_0x2df6('0x8')]][_0x2df6('0x5f')]=_0x1d97e8[_0x2df6('0x4b')];}if(!_['isNil'](_0x1d97e8[_0x2df6('0x49')][_0x2df6('0x60')])){utils[_0x2df6('0xa')](util[_0x2df6('0xb')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x1d97e8[_0x2df6('0x8')],_0x1d97e8['value']));channels[_0x1d97e8[_0x2df6('0x8')]]['sipcallid']=_0x1d97e8[_0x2df6('0x4b')];}}}catch(_0x692bb5){utils[_0x2df6('0x24')](util[_0x2df6('0xb')](_0x2df6('0x61'),_0x1d97e8['uniqueid']),_0x692bb5);}};exports[_0x2df6('0x62')]=function(_0x5e0a5a){try{if(!_[_0x2df6('0x26')](channels[_0x5e0a5a[_0x2df6('0x8')]])){utils['debug'](util[_0x2df6('0xb')]('[%s][calls][newexten]',_0x5e0a5a['uniqueid']),_0x5e0a5a);utils[_0x2df6('0xa')](util[_0x2df6('0xb')](_0x2df6('0x63'),_0x5e0a5a[_0x2df6('0x8')],_0x5e0a5a[_0x2df6('0x64')],_0x5e0a5a['appdata']));if(_0x5e0a5a[_0x2df6('0x64')][_0x2df6('0x65')]()==_0x2df6('0x66')&&_[_0x2df6('0x67')](_0x5e0a5a[_0x2df6('0x68')][_0x2df6('0x65')](),_0x2df6('0x69'))){var _0x55cd18=_0x5e0a5a[_0x2df6('0x68')][_0x2df6('0x6a')]('=');var _0x80a461=_0x55cd18[0x0][_0x2df6('0x6b')](_0x55cd18[0x0]['lastIndexOf']('(')+0x1,_0x55cd18[0x0][_0x2df6('0x6c')](')'));var _0xd99c6d=_0x55cd18[0x1];channels[_0x5e0a5a[_0x2df6('0x8')]][_0x80a461]=_0xd99c6d;}if(!_['includes']([_0x2df6('0x2e'),'noop','execif',_0x2df6('0x66'),_0x2df6('0x6d')],_0x5e0a5a[_0x2df6('0x64')][_0x2df6('0x65')]())){channels[_0x5e0a5a[_0x2df6('0x8')]][_0x2df6('0x55')]=_0x5e0a5a[_0x2df6('0x64')];channels[_0x5e0a5a['uniqueid']][_0x2df6('0x57')]=_0x5e0a5a[_0x2df6('0x68')];}}}catch(_0x1e2e32){utils[_0x2df6('0x24')](util[_0x2df6('0xb')](_0x2df6('0x6e'),_0x5e0a5a['uniqueid']),_0x1e2e32);}}; \ No newline at end of file +var _0xcac3=['error','newstate','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','channelstate','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','mohtime','[%s][calls][musiconholdstop]','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\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','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','[%s][calls][newexten]','application','appdata','set','startsWith','split','substring','lastIndexOf','includes','noop','execif','gotoif','toLowerCase','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','recording','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','info','context','exten','now'];(function(_0x2eec6b,_0x27acfe){var _0x5a84c6=function(_0x4182b8){while(--_0x4182b8){_0x2eec6b['push'](_0x2eec6b['shift']());}};_0x5a84c6(++_0x27acfe);}(_0xcac3,0x193));var _0x3cac=function(_0x32d330,_0xe907c8){_0x32d330=_0x32d330-0x0;var _0xe81a43=_0xcac3[_0x32d330];return _0xe81a43;};'use strict';var _=require('lodash');var util=require(_0x3cac('0x0'));var utils=require(_0x3cac('0x1'));var transfers=require(_0x3cac('0x2'));var dispositions=[_0x3cac('0x3'),_0x3cac('0x4'),_0x3cac('0x4'),_0x3cac('0x3'),_0x3cac('0x3'),_0x3cac('0x3'),_0x3cac('0x5'),_0x3cac('0x6'),_0x3cac('0x4'),_0x3cac('0x4'),_0x3cac('0x4')];var channels={};function writeDB(_0x14562c){var _0x21365c;if(transfers[_0x3cac('0x7')][_0x14562c['uniqueid']]){_0x21365c=_0x14562c[_0x3cac('0x8')];_0x14562c[_0x3cac('0x8')]=transfers[_0x3cac('0x7')][_0x14562c[_0x3cac('0x8')]][_0x3cac('0x9')];}utils['info'](util[_0x3cac('0xa')](_0x3cac('0xb'),_0x14562c[_0x3cac('0x8')],_0x14562c[_0x3cac('0xc')],_0x14562c[_0x3cac('0xd')],_0x14562c['membername'],_0x14562c['interface'],_0x14562c[_0x3cac('0xe')],_0x14562c[_0x3cac('0xf')],_0x14562c[_0x3cac('0x10')]));if(_0x14562c[_0x3cac('0x11')]){utils[_0x3cac('0x12')](_0x14562c[_0x3cac('0x11')])[_0x3cac('0x13')](function(_0x4bee52){if(_0x4bee52){_0x14562c[_0x3cac('0x14')]=_0x4bee52['id'];}utils[_0x3cac('0x15')](_0x3cac('0x16'),_0x14562c);});}else{utils[_0x3cac('0x15')](_0x3cac('0x16'),_0x14562c);}if(channels[_0x14562c[_0x3cac('0x8')]]){delete channels[_0x14562c[_0x3cac('0x8')]];}else if(_0x21365c&&channels[_0x21365c]){if(!transfers[_0x3cac('0x7')][_0x21365c][_0x3cac('0x17')])delete transfers[_0x3cac('0x7')][_0x21365c];delete channels[_0x21365c];}}exports[_0x3cac('0x18')]=function(_0x212183){try{utils[_0x3cac('0x19')](util[_0x3cac('0xa')](_0x3cac('0x1a'),_0x212183[_0x3cac('0x8')]),_0x212183);if(_0x212183[_0x3cac('0x8')]==_0x212183[_0x3cac('0x1b')]&&_0x212183[_0x3cac('0xc')]!=_0x3cac('0x1c')){utils[_0x3cac('0x1d')](util[_0x3cac('0xa')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x212183[_0x3cac('0x8')],_0x212183[_0x3cac('0x1e')],_0x212183['exten']));channels[_0x212183[_0x3cac('0x8')]]={'uniqueid':_0x212183[_0x3cac('0x8')],'accountcode':_0x212183[_0x3cac('0x11')],'source':_0x212183[_0x3cac('0xe')],'destination':_0x212183[_0x3cac('0x1f')],'destinationcontext':_0x212183[_0x3cac('0x1e')],'channel':_0x212183['channel'],'starttime':utils[_0x3cac('0x20')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':'DOCUMENTATION'};}}catch(_0x5a78ed){utils[_0x3cac('0x21')](util[_0x3cac('0xa')](_0x3cac('0x1a'),_0x212183[_0x3cac('0x8')]),_0x5a78ed);}};exports[_0x3cac('0x22')]=function(_0x27c35a){try{utils[_0x3cac('0x19')](util[_0x3cac('0xa')](_0x3cac('0x23'),_0x27c35a[_0x3cac('0x8')]),_0x27c35a);if(!_[_0x3cac('0x24')](channels[_0x27c35a[_0x3cac('0x8')]])&&_0x27c35a['channelstate']==0x6){utils[_0x3cac('0x1d')](util[_0x3cac('0xa')](_0x3cac('0x25'),_0x27c35a[_0x3cac('0x8')],_0x27c35a[_0x3cac('0x1e')],_0x27c35a[_0x3cac('0xc')]));if(_[_0x3cac('0x24')](channels[_0x27c35a[_0x3cac('0x8')]][_0x3cac('0x26')])){channels[_0x27c35a[_0x3cac('0x8')]][_0x3cac('0x26')]=utils[_0x3cac('0x20')]();}}else if(!_[_0x3cac('0x24')](channels[_0x27c35a[_0x3cac('0x1b')]])&&_0x27c35a[_0x3cac('0x27')]==0x6&&_0x27c35a[_0x3cac('0x1e')]!=_0x3cac('0x28')){utils[_0x3cac('0x1d')](util[_0x3cac('0xa')](_0x3cac('0x29'),_0x27c35a[_0x3cac('0x8')],_0x27c35a[_0x3cac('0x1b')],_0x27c35a[_0x3cac('0x1e')],_0x27c35a['channel']));channels[_0x27c35a[_0x3cac('0x1b')]][_0x3cac('0x11')]=_0x27c35a[_0x3cac('0x11')];channels[_0x27c35a[_0x3cac('0x1b')]][_0x3cac('0x2a')]=_0x27c35a['channel'];if(_['isNil'](channels[_0x27c35a[_0x3cac('0x1b')]][_0x3cac('0x2b')])){channels[_0x27c35a['linkedid']][_0x3cac('0x2b')]=utils['now']();}channels[_0x27c35a['linkedid']][_0x3cac('0x2c')]=dispositions[_[_0x3cac('0x2d')](_0x27c35a['channelstate'])]||_0x3cac('0x5');}}catch(_0x3ada7d){utils[_0x3cac('0x21')](util[_0x3cac('0xa')](_0x3cac('0x23'),_0x27c35a[_0x3cac('0x8')]),_0x3ada7d);}};exports[_0x3cac('0x2e')]=function(_0x2311d6){try{if(!_[_0x3cac('0x24')](channels[_0x2311d6['uniqueid']])){utils['debug'](util[_0x3cac('0xa')](_0x3cac('0x2f'),_0x2311d6[_0x3cac('0x8')]),_0x2311d6);if(_[_0x3cac('0x24')](channels[_0x2311d6[_0x3cac('0x8')]][_0x3cac('0x30')])){channels[_0x2311d6[_0x3cac('0x8')]][_0x3cac('0x30')]=_0x2311d6['calleridname']+'\x20<'+_0x2311d6[_0x3cac('0xe')]+'>';}utils[_0x3cac('0x1d')](util['format'](_0x3cac('0x31'),_0x2311d6[_0x3cac('0x8')],channels[_0x2311d6[_0x3cac('0x8')]]['callerid'],_0x2311d6['cause-txt']));channels[_0x2311d6[_0x3cac('0x8')]][_0x3cac('0x32')]=utils[_0x3cac('0x20')]();channels[_0x2311d6[_0x3cac('0x8')]][_0x3cac('0x33')]=utils[_0x3cac('0x34')](channels[_0x2311d6[_0x3cac('0x8')]][_0x3cac('0x32')],channels[_0x2311d6[_0x3cac('0x8')]][_0x3cac('0x35')]);channels[_0x2311d6[_0x3cac('0x8')]][_0x3cac('0x36')]=channels[_0x2311d6[_0x3cac('0x8')]]['answertime']?utils[_0x3cac('0x34')](channels[_0x2311d6['uniqueid']][_0x3cac('0x32')],channels[_0x2311d6[_0x3cac('0x8')]][_0x3cac('0x2b')]):0x0;writeDB(channels[_0x2311d6[_0x3cac('0x8')]]);}}catch(_0x1a187e){utils['error'](util[_0x3cac('0xa')](_0x3cac('0x2f'),_0x2311d6[_0x3cac('0x8')]),_0x1a187e);}};exports[_0x3cac('0x37')]=function(_0x449c53){try{if(!_[_0x3cac('0x24')](channels[_0x449c53[_0x3cac('0x38')]])){utils[_0x3cac('0x19')](util[_0x3cac('0xa')](_0x3cac('0x39'),_0x449c53[_0x3cac('0x3a')]),_0x449c53);if(channels[_0x449c53[_0x3cac('0x38')]]['channel']==_0x449c53['transfereechannel']){utils[_0x3cac('0x1d')](util[_0x3cac('0xa')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x449c53[_0x3cac('0x3a')],_0x449c53[_0x3cac('0x38')],_0x449c53['secondtransfererchannel']));channels[_0x449c53[_0x3cac('0x38')]][_0x3cac('0x2a')]=_0x449c53[_0x3cac('0x3b')];channels[_0x449c53[_0x3cac('0x38')]][_0x3cac('0x3c')]=_0x3cac('0x3d');}else if(channels[_0x449c53[_0x3cac('0x38')]][_0x3cac('0xc')]=_0x449c53['transfertargetchannel']){utils[_0x3cac('0x1d')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x449c53[_0x3cac('0x3a')],_0x449c53[_0x3cac('0x38')],_0x449c53['origtransfererchannel']));channels[_0x449c53[_0x3cac('0x38')]][_0x3cac('0x2a')]=_0x449c53[_0x3cac('0x3e')];channels[_0x449c53[_0x3cac('0x38')]][_0x3cac('0x3c')]='_attended';}}}catch(_0x1f3435){utils[_0x3cac('0x21')](util['format'](_0x3cac('0x39'),_0x449c53[_0x3cac('0x3a')]),_0x1f3435);}};exports[_0x3cac('0x3f')]=function(_0x29e8d5){try{if(!_['isNil'](channels[_0x29e8d5[_0x3cac('0x8')]])){utils[_0x3cac('0x19')](util[_0x3cac('0xa')](_0x3cac('0x40'),_0x29e8d5[_0x3cac('0x8')]),_0x29e8d5);channels[_0x29e8d5['uniqueid']][_0x3cac('0x41')]=utils[_0x3cac('0x20')]();utils[_0x3cac('0x1d')](util['format'](_0x3cac('0x42'),_0x29e8d5[_0x3cac('0x8')],channels[_0x29e8d5[_0x3cac('0x8')]][_0x3cac('0x41')]));}}catch(_0x4bda2c){utils[_0x3cac('0x21')](util[_0x3cac('0xa')]('[%s][calls][musiconholdstart]',_0x29e8d5[_0x3cac('0x8')]),_0x4bda2c);}};exports['musiconholdstop']=function(_0x36f7c7){try{if(!_[_0x3cac('0x24')](channels[_0x36f7c7[_0x3cac('0x8')]])){utils['debug'](util[_0x3cac('0xa')]('[%s][calls][musiconholdstop]',_0x36f7c7[_0x3cac('0x8')]),_0x36f7c7);if(!_[_0x3cac('0x24')](channels[_0x36f7c7['uniqueid']][_0x3cac('0x41')])){channels[_0x36f7c7[_0x3cac('0x8')]][_0x3cac('0x43')]+=utils['diffTime'](utils['now'](),channels[_0x36f7c7['uniqueid']]['musiconholdstartAt']);utils[_0x3cac('0x1d')](util[_0x3cac('0xa')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x36f7c7[_0x3cac('0x8')],channels[_0x36f7c7[_0x3cac('0x8')]][_0x3cac('0x43')]));delete channels[_0x36f7c7[_0x3cac('0x8')]]['musiconholdstartAt'];}}}catch(_0xbbce63){utils['error'](util[_0x3cac('0xa')](_0x3cac('0x44'),_0x36f7c7['uniqueid']),_0xbbce63);}};exports['varset']=function(_0x2aef40){try{if(!_[_0x3cac('0x24')](channels[_0x2aef40['uniqueid']])){utils['debug'](util[_0x3cac('0xa')](_0x3cac('0x45'),_0x2aef40[_0x3cac('0x8')]),_0x2aef40);if(!_[_0x3cac('0x24')](_0x2aef40[_0x3cac('0x46')][_0x3cac('0x47')])){utils[_0x3cac('0x1d')](util['format'](_0x3cac('0x48'),_0x2aef40[_0x3cac('0x8')],_0x2aef40[_0x3cac('0x49')]));channels[_0x2aef40[_0x3cac('0x8')]][_0x3cac('0x4a')]=_0x2aef40[_0x3cac('0x49')];}if(!_[_0x3cac('0x24')](_0x2aef40[_0x3cac('0x46')][_0x3cac('0x4b')])){utils[_0x3cac('0x1d')](util[_0x3cac('0xa')](_0x3cac('0x4c'),_0x2aef40[_0x3cac('0x8')],_0x2aef40['value']));channels[_0x2aef40['uniqueid']]['destination']=_0x2aef40[_0x3cac('0x49')];channels[_0x2aef40[_0x3cac('0x8')]][_0x3cac('0x30')]='\x22'+_0x2aef40['value']+_0x3cac('0x4d')+_0x2aef40[_0x3cac('0x49')]+'>';}if(!_[_0x3cac('0x24')](_0x2aef40[_0x3cac('0x46')][_0x3cac('0x4e')])||!_['isNil'](_0x2aef40[_0x3cac('0x46')][_0x3cac('0x4f')])){utils[_0x3cac('0x1d')](util[_0x3cac('0xa')](_0x3cac('0x50'),_0x2aef40[_0x3cac('0x8')],!_[_0x3cac('0x24')](_0x2aef40[_0x3cac('0x46')][_0x3cac('0x4e')])?_0x3cac('0x4e'):'xmd-callerid',_0x2aef40['value']));channels[_0x2aef40[_0x3cac('0x8')]][_0x3cac('0x30')]=_0x2aef40[_0x3cac('0x49')];}if(!_[_0x3cac('0x24')](_0x2aef40[_0x3cac('0x46')][_0x3cac('0x51')])||!_['isNil'](_0x2aef40[_0x3cac('0x46')][_0x3cac('0x52')])){utils[_0x3cac('0x1d')](util[_0x3cac('0xa')](_0x3cac('0x50'),_0x2aef40['uniqueid'],!_['isNil'](_0x2aef40['variable']['xmd-queue'])?_0x3cac('0x51'):_0x3cac('0x52'),_0x2aef40[_0x3cac('0x49')]));channels[_0x2aef40['uniqueid']][_0x3cac('0x53')]=_0x3cac('0x54');channels[_0x2aef40[_0x3cac('0x8')]][_0x3cac('0x55')]=_0x2aef40[_0x3cac('0x49')];channels[_0x2aef40[_0x3cac('0x8')]]['queue']=!![];}if(!_[_0x3cac('0x24')](_0x2aef40['variable'][_0x3cac('0x56')])){utils[_0x3cac('0x1d')](util[_0x3cac('0xa')](_0x3cac('0x57'),_0x2aef40['uniqueid'],_0x2aef40[_0x3cac('0x49')]));channels[_0x2aef40['uniqueid']][_0x3cac('0x58')]=_0x2aef40[_0x3cac('0x49')];}if(!_[_0x3cac('0x24')](_0x2aef40[_0x3cac('0x46')][_0x3cac('0x59')])){utils[_0x3cac('0x1d')](util[_0x3cac('0xa')](_0x3cac('0x5a'),_0x2aef40[_0x3cac('0x8')],_0x2aef40['value']));channels[_0x2aef40['uniqueid']][_0x3cac('0x5b')]=_0x2aef40[_0x3cac('0x49')];}if(!_['isNil'](_0x2aef40[_0x3cac('0x46')][_0x3cac('0x5c')])){utils[_0x3cac('0x1d')](util['format']('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x2aef40[_0x3cac('0x8')],_0x2aef40[_0x3cac('0x49')]));channels[_0x2aef40[_0x3cac('0x8')]][_0x3cac('0x5d')]=_0x2aef40[_0x3cac('0x49')];}if(!_[_0x3cac('0x24')](_0x2aef40[_0x3cac('0x46')]['sipcallid'])){utils[_0x3cac('0x1d')](util[_0x3cac('0xa')](_0x3cac('0x5e'),_0x2aef40[_0x3cac('0x8')],_0x2aef40[_0x3cac('0x49')]));channels[_0x2aef40['uniqueid']][_0x3cac('0x5f')]=_0x2aef40['value'];}}}catch(_0x334fd8){utils['error'](util['format'](_0x3cac('0x45'),_0x2aef40['uniqueid']),_0x334fd8);}};exports['newexten']=function(_0xc2bdbc){try{if(!_['isNil'](channels[_0xc2bdbc[_0x3cac('0x8')]])){utils[_0x3cac('0x19')](util[_0x3cac('0xa')](_0x3cac('0x60'),_0xc2bdbc[_0x3cac('0x8')]),_0xc2bdbc);utils[_0x3cac('0x1d')](util[_0x3cac('0xa')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0xc2bdbc[_0x3cac('0x8')],_0xc2bdbc[_0x3cac('0x61')],_0xc2bdbc[_0x3cac('0x62')]));if(_0xc2bdbc['application']['toLowerCase']()==_0x3cac('0x63')&&_[_0x3cac('0x64')](_0xc2bdbc[_0x3cac('0x62')]['toLowerCase'](),'cdr')){var _0x3a42a4=_0xc2bdbc['appdata'][_0x3cac('0x65')]('=');var _0x75e291=_0x3a42a4[0x0][_0x3cac('0x66')](_0x3a42a4[0x0][_0x3cac('0x67')]('(')+0x1,_0x3a42a4[0x0][_0x3cac('0x67')](')'));var _0x2787fb=_0x3a42a4[0x1];channels[_0xc2bdbc[_0x3cac('0x8')]][_0x75e291]=_0x2787fb;}if(!_[_0x3cac('0x68')]([_0x3cac('0x2e'),_0x3cac('0x69'),_0x3cac('0x6a'),_0x3cac('0x63'),_0x3cac('0x6b')],_0xc2bdbc[_0x3cac('0x61')][_0x3cac('0x6c')]())){channels[_0xc2bdbc['uniqueid']][_0x3cac('0x53')]=_0xc2bdbc[_0x3cac('0x61')];channels[_0xc2bdbc[_0x3cac('0x8')]]['lastdata']=_0xc2bdbc['appdata'];}}}catch(_0x6ee414){utils['error'](util[_0x3cac('0xa')](_0x3cac('0x60'),_0xc2bdbc[_0x3cac('0x8')]),_0x6ee414);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 726d4ea..5173471 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 _0xb9b5=['managerevent','connect','shutdown','info','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','close','[core]\x20close'];(function(_0x620973,_0x112ff7){var _0x29dcdd=function(_0x15bcf7){while(--_0x15bcf7){_0x620973['push'](_0x620973['shift']());}};_0x29dcdd(++_0x112ff7);}(_0xb9b5,0x169));var _0x5b9b=function(_0x3b29d5,_0x12faa2){_0x3b29d5=_0x3b29d5-0x0;var _0x20b96d=_0xb9b5[_0x3b29d5];return _0x20b96d;};'use strict';var utils=require('./utils');exports[_0x5b9b('0x0')]=function(){utils['info']('[core]\x20connected');};exports[_0x5b9b('0x1')]=function(){utils[_0x5b9b('0x2')](_0x5b9b('0x3'));};exports[_0x5b9b('0x4')]=function(){utils[_0x5b9b('0x2')](_0x5b9b('0x5'));};exports[_0x5b9b('0x6')]=function(_0x5138b4){utils['error']('[core]\x20error',_0x5138b4);};exports[_0x5b9b('0x7')]=function(){utils[_0x5b9b('0x2')](_0x5b9b('0x8'));};exports[_0x5b9b('0x9')]=function(_0x3dfa15){}; \ No newline at end of file +var _0x6385=['info','fullybooted','[core]\x20fullybooted','error','close','managerevent','./utils','[core]\x20connected','shutdown'];(function(_0x4d8dc3,_0x585fd1){var _0x9b03d9=function(_0x7a31d5){while(--_0x7a31d5){_0x4d8dc3['push'](_0x4d8dc3['shift']());}};_0x9b03d9(++_0x585fd1);}(_0x6385,0xf9));var _0x5638=function(_0x50a004,_0x193d84){_0x50a004=_0x50a004-0x0;var _0x5e9992=_0x6385[_0x50a004];return _0x5e9992;};'use strict';var utils=require(_0x5638('0x0'));exports['connect']=function(){utils['info'](_0x5638('0x1'));};exports[_0x5638('0x2')]=function(){utils[_0x5638('0x3')]('[core]\x20shutdown');};exports[_0x5638('0x4')]=function(){utils[_0x5638('0x3')](_0x5638('0x5'));};exports[_0x5638('0x6')]=function(_0x5337f8){utils[_0x5638('0x6')]('[core]\x20error',_0x5337f8);};exports[_0x5638('0x7')]=function(){utils['info']('[core]\x20close');};exports[_0x5638('0x8')]=function(_0x11f903){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 1ba349d..abc0529 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 _0xb839=['CreateVoiceDialReport','newexten','format','[%s][dials][newexten]','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split','error','varset','debug','isNil','variable','outboundrouteid','value','[%s][dials][varset]','dialbegin','[%s][dials][dialbegin]','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','assign','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','diffTime','holdtime','endtime','lodash','util','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request'];(function(_0x52e363,_0x48062a){var _0x3fc2b5=function(_0x1b0cf9){while(--_0x1b0cf9){_0x52e363['push'](_0x52e363['shift']());}};_0x3fc2b5(++_0x48062a);}(_0xb839,0x16e));var _0x9b83=function(_0x2dc018,_0x50880b){_0x2dc018=_0x2dc018-0x0;var _0xfe1f28=_0xb839[_0x2dc018];return _0xfe1f28;};'use strict';var _=require(_0x9b83('0x0'));var util=require(_0x9b83('0x1'));var utils=require(_0x9b83('0x2'));var dials={};function writeDB(_0x421e00){utils[_0x9b83('0x3')](util['format'](_0x9b83('0x4'),_0x421e00[_0x9b83('0x5')],_0x421e00[_0x9b83('0x6')],_0x421e00[_0x9b83('0x7')],_0x421e00[_0x9b83('0x8')],_0x421e00[_0x9b83('0x9')],_0x421e00[_0x9b83('0xa')]));utils[_0x9b83('0xb')](_0x9b83('0xc'),_0x421e00);delete dials[_0x421e00[_0x9b83('0x5')]];}exports[_0x9b83('0xd')]=function(_0x4a0be5){try{utils['debug'](util[_0x9b83('0xe')](_0x9b83('0xf'),_0x4a0be5[_0x9b83('0x5')]),_0x4a0be5);utils[_0x9b83('0x3')](util['format']('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x4a0be5['uniqueid'],_0x4a0be5[_0x9b83('0x10')],_0x4a0be5[_0x9b83('0x11')]));if(_0x4a0be5[_0x9b83('0x10')][_0x9b83('0x12')]()==_0x9b83('0x13')&&_[_0x9b83('0x14')](_0x4a0be5[_0x9b83('0x11')][_0x9b83('0x12')](),_0x9b83('0x15'))){var _0x5c7e6f=_0x4a0be5[_0x9b83('0x11')][_0x9b83('0x16')]('=');dials[_0x4a0be5[_0x9b83('0x5')]]={'routeId':_0x5c7e6f[0x1]};}}catch(_0x1cfd1e){utils[_0x9b83('0x17')](util['format']('[%s][dials][newexten]',_0x4a0be5[_0x9b83('0x5')]),_0x1cfd1e);}};exports[_0x9b83('0x18')]=function(_0x515846){try{utils[_0x9b83('0x19')](util[_0x9b83('0xe')]('[%s][dials][varset]',_0x515846[_0x9b83('0x5')]),_0x515846);if(!_[_0x9b83('0x1a')](_0x515846[_0x9b83('0x1b')][_0x9b83('0x1c')])){utils[_0x9b83('0x3')](util[_0x9b83('0xe')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x515846[_0x9b83('0x5')],_0x515846[_0x9b83('0x1d')]));dials[_0x515846['uniqueid']]={'routeId':_0x515846[_0x9b83('0x1d')]};}}catch(_0x2cc6a4){utils[_0x9b83('0x17')](util[_0x9b83('0xe')](_0x9b83('0x1e'),_0x515846[_0x9b83('0x5')]),_0x2cc6a4);}};exports[_0x9b83('0x1f')]=function(_0x3e4ed0){try{if(!_[_0x9b83('0x1a')](dials[_0x3e4ed0[_0x9b83('0x5')]])){utils[_0x9b83('0x19')](util[_0x9b83('0xe')](_0x9b83('0x20'),_0x3e4ed0['uniqueid']),_0x3e4ed0);dials[_0x3e4ed0[_0x9b83('0x5')]]=_['assign'](dials[_0x3e4ed0[_0x9b83('0x5')]],_0x3e4ed0);dials[_0x3e4ed0['uniqueid']][_0x9b83('0x21')]=utils[_0x9b83('0x22')]();dials[_0x3e4ed0['uniqueid']][_0x9b83('0x23')]=_0x9b83('0x24');utils['info'](util[_0x9b83('0xe')](_0x9b83('0x25'),_0x3e4ed0[_0x9b83('0x5')],dials[_0x3e4ed0['uniqueid']]['starttime']));}}catch(_0x3bb02e){utils[_0x9b83('0x17')](util[_0x9b83('0xe')](_0x9b83('0x20'),_0x3e4ed0[_0x9b83('0x5')]),_0x3bb02e);}};exports[_0x9b83('0x26')]=function(_0x211c1f){try{if(!_[_0x9b83('0x1a')](dials[_0x211c1f[_0x9b83('0x5')]])){utils[_0x9b83('0x19')](util[_0x9b83('0xe')](_0x9b83('0x27'),_0x211c1f['uniqueid']),_0x211c1f);dials[_0x211c1f[_0x9b83('0x5')]]['dialstatus']=_0x211c1f[_0x9b83('0xa')];if(_0x211c1f[_0x9b83('0xa')]==_0x9b83('0x28')){dials[_0x211c1f['uniqueid']]=_[_0x9b83('0x29')](dials[_0x211c1f[_0x9b83('0x5')]],_0x211c1f);dials[_0x211c1f[_0x9b83('0x5')]][_0x9b83('0x2a')]=utils[_0x9b83('0x22')]();dials[_0x211c1f[_0x9b83('0x5')]]['lastevent']=_0x9b83('0x2b');utils['info'](util['format'](_0x9b83('0x2c'),_0x211c1f[_0x9b83('0x5')],_0x211c1f['dialstatus'],dials[_0x211c1f[_0x9b83('0x5')]][_0x9b83('0x2a')]));}else{utils[_0x9b83('0x3')](util[_0x9b83('0xe')](_0x9b83('0x2d'),_0x211c1f[_0x9b83('0x5')],_0x211c1f['dialstatus']));}}}catch(_0x395719){utils[_0x9b83('0x17')](util[_0x9b83('0xe')](_0x9b83('0x27'),_0x211c1f['uniqueid']),_0x395719);}};exports[_0x9b83('0x2e')]=function(_0x332554){try{if(!_[_0x9b83('0x1a')](dials[_0x332554['uniqueid']])){utils['debug'](util[_0x9b83('0xe')](_0x9b83('0x2f'),_0x332554['uniqueid']),_0x332554);utils[_0x9b83('0x3')](util[_0x9b83('0xe')](_0x9b83('0x30'),_0x332554[_0x9b83('0x5')],_0x332554[_0x9b83('0x8')],_0x332554[_0x9b83('0x31')],_0x332554[_0x9b83('0x32')]));dials[_0x332554[_0x9b83('0x5')]]=_[_0x9b83('0x29')](dials[_0x332554[_0x9b83('0x5')]],{'endtime':utils[_0x9b83('0x22')](),'lastevent':'complete'});dials[_0x332554[_0x9b83('0x5')]]['duration']=utils[_0x9b83('0x33')](dials[_0x332554[_0x9b83('0x5')]]['endtime'],dials[_0x332554[_0x9b83('0x5')]][_0x9b83('0x21')]);dials[_0x332554['uniqueid']][_0x9b83('0x34')]=utils[_0x9b83('0x33')](dials[_0x332554[_0x9b83('0x5')]]['answertime']||dials[_0x332554[_0x9b83('0x5')]]['endtime'],dials[_0x332554['uniqueid']][_0x9b83('0x21')]);dials[_0x332554[_0x9b83('0x5')]]['billableseconds']=dials[_0x332554[_0x9b83('0x5')]][_0x9b83('0x2a')]?utils[_0x9b83('0x33')](dials[_0x332554[_0x9b83('0x5')]][_0x9b83('0x35')],dials[_0x332554[_0x9b83('0x5')]][_0x9b83('0x2a')]):0x0;writeDB(dials[_0x332554[_0x9b83('0x5')]]);}}catch(_0x56f92f){utils[_0x9b83('0x17')](util['format'](_0x9b83('0x2f'),_0x332554[_0x9b83('0x5')]),_0x56f92f);}}; \ No newline at end of file +var _0xe202=['[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','holdtime','endtime','lodash','util','format','channel','calleridnum','connectedlinenum','request','CreateVoiceDialReport','uniqueid','newexten','debug','[%s][dials][newexten]','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','cdr(routeid)','error','varset','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][varset]','dialbegin','[%s][dials][dialbegin]','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','dialend','dialstatus','ANSWER','assign','answertime','connect'];(function(_0x4e8c30,_0x2a4c19){var _0x346189=function(_0xf0d34b){while(--_0xf0d34b){_0x4e8c30['push'](_0x4e8c30['shift']());}};_0x346189(++_0x2a4c19);}(_0xe202,0x10a));var _0x2e20=function(_0x29a487,_0x4b4100){_0x29a487=_0x29a487-0x0;var _0x479e27=_0xe202[_0x29a487];return _0x479e27;};'use strict';var _=require(_0x2e20('0x0'));var util=require(_0x2e20('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x3c79f6){utils['info'](util[_0x2e20('0x2')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x3c79f6['uniqueid'],_0x3c79f6[_0x2e20('0x3')],_0x3c79f6['dialstring'],_0x3c79f6[_0x2e20('0x4')],_0x3c79f6[_0x2e20('0x5')],_0x3c79f6['dialstatus']));utils[_0x2e20('0x6')](_0x2e20('0x7'),_0x3c79f6);delete dials[_0x3c79f6[_0x2e20('0x8')]];}exports[_0x2e20('0x9')]=function(_0x1b4a00){try{utils[_0x2e20('0xa')](util[_0x2e20('0x2')](_0x2e20('0xb'),_0x1b4a00[_0x2e20('0x8')]),_0x1b4a00);utils[_0x2e20('0xc')](util[_0x2e20('0x2')](_0x2e20('0xd'),_0x1b4a00['uniqueid'],_0x1b4a00['application'],_0x1b4a00[_0x2e20('0xe')]));if(_0x1b4a00[_0x2e20('0xf')][_0x2e20('0x10')]()==_0x2e20('0x11')&&_['startsWith'](_0x1b4a00['appdata'][_0x2e20('0x10')](),_0x2e20('0x12'))){var _0x387af5=_0x1b4a00[_0x2e20('0xe')]['split']('=');dials[_0x1b4a00['uniqueid']]={'routeId':_0x387af5[0x1]};}}catch(_0x5926a3){utils[_0x2e20('0x13')](util['format'](_0x2e20('0xb'),_0x1b4a00[_0x2e20('0x8')]),_0x5926a3);}};exports[_0x2e20('0x14')]=function(_0x23d21e){try{utils[_0x2e20('0xa')](util[_0x2e20('0x2')]('[%s][dials][varset]',_0x23d21e[_0x2e20('0x8')]),_0x23d21e);if(!_[_0x2e20('0x15')](_0x23d21e[_0x2e20('0x16')][_0x2e20('0x17')])){utils['info'](util[_0x2e20('0x2')](_0x2e20('0x18'),_0x23d21e[_0x2e20('0x8')],_0x23d21e[_0x2e20('0x19')]));dials[_0x23d21e[_0x2e20('0x8')]]={'routeId':_0x23d21e[_0x2e20('0x19')]};}}catch(_0x3eaaee){utils[_0x2e20('0x13')](util['format'](_0x2e20('0x1a'),_0x23d21e['uniqueid']),_0x3eaaee);}};exports[_0x2e20('0x1b')]=function(_0x9dd718){try{if(!_['isNil'](dials[_0x9dd718['uniqueid']])){utils[_0x2e20('0xa')](util[_0x2e20('0x2')](_0x2e20('0x1c'),_0x9dd718[_0x2e20('0x8')]),_0x9dd718);dials[_0x9dd718[_0x2e20('0x8')]]=_['assign'](dials[_0x9dd718['uniqueid']],_0x9dd718);dials[_0x9dd718[_0x2e20('0x8')]]['starttime']=utils[_0x2e20('0x1d')]();dials[_0x9dd718[_0x2e20('0x8')]][_0x2e20('0x1e')]=_0x2e20('0x1f');utils[_0x2e20('0xc')](util['format'](_0x2e20('0x20'),_0x9dd718[_0x2e20('0x8')],dials[_0x9dd718[_0x2e20('0x8')]][_0x2e20('0x21')]));}}catch(_0x293f38){utils[_0x2e20('0x13')](util[_0x2e20('0x2')](_0x2e20('0x1c'),_0x9dd718[_0x2e20('0x8')]),_0x293f38);}};exports[_0x2e20('0x22')]=function(_0x1c1e80){try{if(!_[_0x2e20('0x15')](dials[_0x1c1e80['uniqueid']])){utils[_0x2e20('0xa')](util[_0x2e20('0x2')]('[%s][dials][dialend]',_0x1c1e80[_0x2e20('0x8')]),_0x1c1e80);dials[_0x1c1e80[_0x2e20('0x8')]][_0x2e20('0x23')]=_0x1c1e80[_0x2e20('0x23')];if(_0x1c1e80[_0x2e20('0x23')]==_0x2e20('0x24')){dials[_0x1c1e80[_0x2e20('0x8')]]=_[_0x2e20('0x25')](dials[_0x1c1e80[_0x2e20('0x8')]],_0x1c1e80);dials[_0x1c1e80['uniqueid']][_0x2e20('0x26')]=utils[_0x2e20('0x1d')]();dials[_0x1c1e80['uniqueid']][_0x2e20('0x1e')]=_0x2e20('0x27');utils[_0x2e20('0xc')](util[_0x2e20('0x2')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x1c1e80[_0x2e20('0x8')],_0x1c1e80[_0x2e20('0x23')],dials[_0x1c1e80[_0x2e20('0x8')]]['answertime']));}else{utils['info'](util[_0x2e20('0x2')](_0x2e20('0x28'),_0x1c1e80[_0x2e20('0x8')],_0x1c1e80[_0x2e20('0x23')]));}}}catch(_0x5d79ff){utils['error'](util[_0x2e20('0x2')](_0x2e20('0x29'),_0x1c1e80[_0x2e20('0x8')]),_0x5d79ff);}};exports['hangup']=function(_0xe3ee1e){try{if(!_[_0x2e20('0x15')](dials[_0xe3ee1e[_0x2e20('0x8')]])){utils[_0x2e20('0xa')](util[_0x2e20('0x2')](_0x2e20('0x2a'),_0xe3ee1e[_0x2e20('0x8')]),_0xe3ee1e);utils[_0x2e20('0xc')](util['format'](_0x2e20('0x2b'),_0xe3ee1e['uniqueid'],_0xe3ee1e[_0x2e20('0x4')],_0xe3ee1e[_0x2e20('0x2c')],_0xe3ee1e[_0x2e20('0x2d')]));dials[_0xe3ee1e[_0x2e20('0x8')]]=_[_0x2e20('0x25')](dials[_0xe3ee1e['uniqueid']],{'endtime':utils[_0x2e20('0x1d')](),'lastevent':_0x2e20('0x2e')});dials[_0xe3ee1e['uniqueid']][_0x2e20('0x2f')]=utils[_0x2e20('0x30')](dials[_0xe3ee1e['uniqueid']]['endtime'],dials[_0xe3ee1e[_0x2e20('0x8')]][_0x2e20('0x21')]);dials[_0xe3ee1e[_0x2e20('0x8')]][_0x2e20('0x31')]=utils[_0x2e20('0x30')](dials[_0xe3ee1e['uniqueid']]['answertime']||dials[_0xe3ee1e[_0x2e20('0x8')]][_0x2e20('0x32')],dials[_0xe3ee1e[_0x2e20('0x8')]][_0x2e20('0x21')]);dials[_0xe3ee1e[_0x2e20('0x8')]]['billableseconds']=dials[_0xe3ee1e[_0x2e20('0x8')]]['answertime']?utils[_0x2e20('0x30')](dials[_0xe3ee1e[_0x2e20('0x8')]][_0x2e20('0x32')],dials[_0xe3ee1e[_0x2e20('0x8')]][_0x2e20('0x26')]):0x0;writeDB(dials[_0xe3ee1e[_0x2e20('0x8')]]);}}catch(_0xd53325){utils[_0x2e20('0x13')](util[_0x2e20('0x2')](_0x2e20('0x2a'),_0xe3ee1e['uniqueid']),_0xd53325);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 56825e5..fe5e561 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 _0x66c7=['[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][queuecallerabandon]','queuecallerabandon','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','local','asterisk','port','username','password','info','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled'];(function(_0x15cbce,_0xda8402){var _0x257f29=function(_0x388132){while(--_0x388132){_0x15cbce['push'](_0x15cbce['shift']());}};_0x257f29(++_0xda8402);}(_0x66c7,0x1d0));var _0x766c=function(_0x3e20f9,_0x5da5ff){_0x3e20f9=_0x3e20f9-0x0;var _0x32768a=_0x66c7[_0x3e20f9];return _0x32768a;};var AsteriskManager=require(_0x766c('0x0'));var config=require(_0x766c('0x1'));var utils=require(_0x766c('0x2'));var util=require(_0x766c('0x3'));var isXDREnabled=config[_0x766c('0x4')]&&config['xdr'][_0x766c('0x5')]?!config[_0x766c('0x4')]['disabled']:!![];var isProduction=config[_0x766c('0x6')]===_0x766c('0x7')||![];var isLocalAsterisk=config[_0x766c('0x4')]&&config['xdr'][_0x766c('0x8')]===!![]||![];var ami=new AsteriskManager(config[_0x766c('0x9')][_0x766c('0xa')],config[_0x766c('0x9')]['ip'],config[_0x766c('0x9')][_0x766c('0xb')],config[_0x766c('0x9')][_0x766c('0xc')],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0x766c('0xd')]('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0x766c('0xd')](_0x766c('0xe'));}else{var agents=require('./agents.controller');var calls=require(_0x766c('0xf'));var queues=require(_0x766c('0x10'));var recordings=require(_0x766c('0x11'));var members=require(_0x766c('0x12'));var dials=require(_0x766c('0x13'));var transfers=require('./transfers.controller');var core=require(_0x766c('0x14'));ami['on'](_0x766c('0x15'),core[_0x766c('0x15')]);ami['on'](_0x766c('0x16'),core[_0x766c('0x16')]);ami['on'](_0x766c('0x17'),core[_0x766c('0x17')]);ami['on'](_0x766c('0x18'),core[_0x766c('0x18')]);ami['on'](_0x766c('0x19'),core['close']);ami['on'](_0x766c('0x1a'),core[_0x766c('0x1a')]);ami['on'](_0x766c('0x1b'),function(_0x2a8132){try{utils[_0x766c('0x1c')](util[_0x766c('0x1d')](_0x766c('0x1e'),_0x2a8132[_0x766c('0x1f')]),_0x2a8132);members['devicestatechange'](_0x2a8132);}catch(_0x390474){utils[_0x766c('0x18')](util[_0x766c('0x1d')](_0x766c('0x1e'),_0x2a8132[_0x766c('0x1f')]),_0x390474);}});ami['on'](_0x766c('0x20'),function(_0x2aebd5){try{utils['debug'](util[_0x766c('0x1d')](_0x766c('0x21'),_0x2aebd5[_0x766c('0x22')]),_0x2aebd5);agents['agentcalled'](_0x2aebd5);}catch(_0x54f3b1){utils['error'](util[_0x766c('0x1d')](_0x766c('0x21'),_0x2aebd5['uniqueid']),_0x54f3b1);}});ami['on'](_0x766c('0x23'),function(_0x396a5c){try{utils[_0x766c('0x1c')](util[_0x766c('0x1d')](_0x766c('0x24'),_0x396a5c[_0x766c('0x22')]),_0x396a5c);agents[_0x766c('0x23')](_0x396a5c);}catch(_0x3b9693){utils['error'](util[_0x766c('0x1d')](_0x766c('0x24'),_0x396a5c[_0x766c('0x22')]),_0x3b9693);}});ami['on'](_0x766c('0x25'),function(_0x479a71){try{utils[_0x766c('0x1c')](util[_0x766c('0x1d')](_0x766c('0x26'),_0x479a71['uniqueid']),_0x479a71);agents[_0x766c('0x25')](_0x479a71);queues[_0x766c('0x25')](_0x479a71);}catch(_0x33715f){utils[_0x766c('0x18')](util['format'](_0x766c('0x26'),_0x479a71[_0x766c('0x22')]),_0x33715f);}});ami['on'](_0x766c('0x27'),function(_0x4eb838){try{utils[_0x766c('0x1c')](util[_0x766c('0x1d')]('[%s][index][agentcomplete]',_0x4eb838['uniqueid']),_0x4eb838);agents[_0x766c('0x27')](_0x4eb838);queues[_0x766c('0x27')](_0x4eb838);members[_0x766c('0x27')](_0x4eb838);}catch(_0x373190){utils[_0x766c('0x18')](util[_0x766c('0x1d')]('[%s][index][agentcomplete]',_0x4eb838[_0x766c('0x22')]),_0x373190);}});ami['on']('queuecallerabandon',function(_0x11e1c2){try{utils[_0x766c('0x1c')](util[_0x766c('0x1d')](_0x766c('0x28'),_0x11e1c2[_0x766c('0x22')]),_0x11e1c2);agents[_0x766c('0x29')](_0x11e1c2);queues[_0x766c('0x29')](_0x11e1c2);}catch(_0x56d8d5){utils[_0x766c('0x18')](util[_0x766c('0x1d')](_0x766c('0x28'),_0x11e1c2[_0x766c('0x22')]),_0x56d8d5);}});ami['on']('queuecallerjoin',function(_0x4b5a55){try{utils[_0x766c('0x1c')](util[_0x766c('0x1d')](_0x766c('0x2a'),_0x4b5a55['uniqueid']),_0x4b5a55);queues[_0x766c('0x2b')](_0x4b5a55);recordings[_0x766c('0x2b')](_0x4b5a55);}catch(_0x4edef7){utils[_0x766c('0x18')](util[_0x766c('0x1d')](_0x766c('0x2a'),_0x4b5a55[_0x766c('0x22')]),_0x4edef7);}});ami['on'](_0x766c('0x2c'),function(_0x52528b){try{utils[_0x766c('0x1c')](util[_0x766c('0x1d')](_0x766c('0x2d'),_0x52528b[_0x766c('0x22')]),_0x52528b);queues['queuecallerleave'](_0x52528b);}catch(_0x368bc4){utils[_0x766c('0x18')](util['format'](_0x766c('0x2d'),_0x52528b['uniqueid']),_0x368bc4);}});ami['on']('musiconholdstart',function(_0x17dd74){try{utils[_0x766c('0x1c')](util[_0x766c('0x1d')](_0x766c('0x2e'),_0x17dd74[_0x766c('0x22')]),_0x17dd74);queues[_0x766c('0x2f')](_0x17dd74);calls[_0x766c('0x2f')](_0x17dd74);}catch(_0x4b9738){utils[_0x766c('0x18')](util[_0x766c('0x1d')](_0x766c('0x2e'),_0x17dd74[_0x766c('0x22')]),_0x4b9738);}});ami['on'](_0x766c('0x30'),function(_0x156bbe){try{utils['debug'](util['format']('[%s][index][musiconholdstop]',_0x156bbe[_0x766c('0x22')]),_0x156bbe);queues[_0x766c('0x30')](_0x156bbe);calls[_0x766c('0x30')](_0x156bbe);}catch(_0x36229d){utils[_0x766c('0x18')](util[_0x766c('0x1d')](_0x766c('0x31'),_0x156bbe[_0x766c('0x22')]),_0x36229d);}});ami['on'](_0x766c('0x32'),function(_0x23cbfd){try{utils[_0x766c('0x1c')](util[_0x766c('0x1d')](_0x766c('0x33'),_0x23cbfd[_0x766c('0x22')]),_0x23cbfd);calls[_0x766c('0x32')](_0x23cbfd);recordings[_0x766c('0x32')](_0x23cbfd);}catch(_0x302ff1){utils['error'](util[_0x766c('0x1d')](_0x766c('0x33'),_0x23cbfd[_0x766c('0x22')]),_0x302ff1);}});ami['on'](_0x766c('0x34'),function(_0x5ad406){try{utils[_0x766c('0x1c')](util['format'](_0x766c('0x35'),_0x5ad406['uniqueid']),_0x5ad406);calls['hangup'](_0x5ad406);recordings[_0x766c('0x34')](_0x5ad406);dials[_0x766c('0x34')](_0x5ad406);agents[_0x766c('0x34')](_0x5ad406);queues[_0x766c('0x34')](_0x5ad406);}catch(_0x134ef2){utils[_0x766c('0x18')](util[_0x766c('0x1d')](_0x766c('0x35'),_0x5ad406[_0x766c('0x22')]),_0x134ef2);}});ami['on'](_0x766c('0x36'),function(_0x234edd){try{utils[_0x766c('0x1c')](util[_0x766c('0x1d')]('[%s][index][cdr]',_0x234edd[_0x766c('0x22')]),_0x234edd);members[_0x766c('0x36')](_0x234edd);}catch(_0x1197ed){utils[_0x766c('0x18')](util[_0x766c('0x1d')](_0x766c('0x37'),_0x234edd[_0x766c('0x22')]),_0x1197ed);}});ami['on'](_0x766c('0x38'),function(_0x4e4b4f){try{utils[_0x766c('0x1c')](util['format']('[%s][index][blindtransfer]',_0x4e4b4f['uniqueid']),_0x4e4b4f);queues[_0x766c('0x38')](_0x4e4b4f);agents[_0x766c('0x38')](_0x4e4b4f);transfers[_0x766c('0x38')](_0x4e4b4f);recordings['blindtransfer'](_0x4e4b4f);}catch(_0x101369){utils['error'](util[_0x766c('0x1d')](_0x766c('0x39'),_0x4e4b4f[_0x766c('0x22')]),_0x101369);}});ami['on'](_0x766c('0x3a'),function(_0x36fe0c){try{utils[_0x766c('0x1c')](util[_0x766c('0x1d')](_0x766c('0x3b'),_0x36fe0c['origtransfereruniqueid']),_0x36fe0c);queues['attendedtransfer'](_0x36fe0c);transfers[_0x766c('0x3a')](_0x36fe0c);agents[_0x766c('0x3a')](_0x36fe0c);calls[_0x766c('0x3a')](_0x36fe0c);}catch(_0x35d589){utils['error'](util[_0x766c('0x1d')](_0x766c('0x3b'),_0x36fe0c[_0x766c('0x3c')]),_0x35d589);}});ami['on'](_0x766c('0x3d'),function(_0x262bb5){try{utils['debug'](util[_0x766c('0x1d')]('[%s][index][varset]',_0x262bb5['uniqueid']),_0x262bb5);queues['varset'](_0x262bb5);recordings[_0x766c('0x3d')](_0x262bb5);calls['varset'](_0x262bb5);dials[_0x766c('0x3d')](_0x262bb5);}catch(_0x50ce40){utils['error'](util[_0x766c('0x1d')](_0x766c('0x3e'),_0x262bb5['uniqueid']),_0x50ce40);}});ami['on']('newexten',function(_0x230e0f){try{utils[_0x766c('0x1c')](util[_0x766c('0x1d')]('[%s][index][newexten]',_0x230e0f[_0x766c('0x22')]),_0x230e0f);calls[_0x766c('0x3f')](_0x230e0f);recordings[_0x766c('0x3f')](_0x230e0f);dials[_0x766c('0x3f')](_0x230e0f);}catch(_0x5d3e15){utils[_0x766c('0x18')](util[_0x766c('0x1d')](_0x766c('0x40'),_0x230e0f['uniqueid']),_0x5d3e15);}});ami['on'](_0x766c('0x41'),function(_0x4f5748){try{utils[_0x766c('0x1c')](util[_0x766c('0x1d')](_0x766c('0x42'),_0x4f5748['uniqueid']),_0x4f5748);calls[_0x766c('0x41')](_0x4f5748);recordings[_0x766c('0x41')](_0x4f5748);}catch(_0x53a206){utils['error'](util['format'](_0x766c('0x42'),_0x4f5748[_0x766c('0x22')]),_0x53a206);}});ami['on'](_0x766c('0x43'),function(_0x29e6e1){try{utils['debug'](util['format']('[%s][index][dialbegin]',_0x29e6e1['uniqueid']),_0x29e6e1);dials[_0x766c('0x43')](_0x29e6e1);}catch(_0x4c9d69){utils[_0x766c('0x18')](util[_0x766c('0x1d')](_0x766c('0x44'),_0x29e6e1[_0x766c('0x22')]),_0x4c9d69);}});ami['on'](_0x766c('0x45'),function(_0x144f84){try{utils[_0x766c('0x1c')](util[_0x766c('0x1d')](_0x766c('0x46'),_0x144f84[_0x766c('0x22')]),_0x144f84);dials['dialend'](_0x144f84);}catch(_0x501e4c){utils[_0x766c('0x18')](util[_0x766c('0x1d')]('[%s][index][dialend]',_0x144f84['uniqueid']),_0x501e4c);}});} \ No newline at end of file +var _0x6ace=['Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./queues.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','format','[%s][index][devicestatechange]','devicestatechange','device','agentcalled','debug','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','[%s][index][varset]','varset','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','util','xdr','disabled','env','local','asterisk','port','username','password','keepConnected','info','XDR\x20DISABLED'];(function(_0x40a0a0,_0x2e07dd){var _0x328af3=function(_0x276e63){while(--_0x276e63){_0x40a0a0['push'](_0x40a0a0['shift']());}};_0x328af3(++_0x2e07dd);}(_0x6ace,0x196));var _0xe6ac=function(_0x52e2a8,_0x22d875){_0x52e2a8=_0x52e2a8-0x0;var _0x3d3fb0=_0x6ace[_0x52e2a8];return _0x3d3fb0;};var AsteriskManager=require(_0xe6ac('0x0'));var config=require(_0xe6ac('0x1'));var utils=require('./utils');var util=require(_0xe6ac('0x2'));var isXDREnabled=config[_0xe6ac('0x3')]&&config['xdr'][_0xe6ac('0x4')]?!config[_0xe6ac('0x3')][_0xe6ac('0x4')]:!![];var isProduction=config[_0xe6ac('0x5')]==='production'||![];var isLocalAsterisk=config[_0xe6ac('0x3')]&&config[_0xe6ac('0x3')][_0xe6ac('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0xe6ac('0x7')][_0xe6ac('0x8')],config[_0xe6ac('0x7')]['ip'],config['asterisk'][_0xe6ac('0x9')],config[_0xe6ac('0x7')][_0xe6ac('0xa')],!![]);ami[_0xe6ac('0xb')]();if(!isXDREnabled){utils[_0xe6ac('0xc')](_0xe6ac('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xe6ac('0xc')](_0xe6ac('0xe'));}else{var agents=require(_0xe6ac('0xf'));var calls=require('./calls.controller');var queues=require(_0xe6ac('0x10'));var recordings=require('./recordings.controller');var members=require(_0xe6ac('0x11'));var dials=require(_0xe6ac('0x12'));var transfers=require(_0xe6ac('0x13'));var core=require(_0xe6ac('0x14'));ami['on'](_0xe6ac('0x15'),core[_0xe6ac('0x15')]);ami['on'](_0xe6ac('0x16'),core[_0xe6ac('0x16')]);ami['on'](_0xe6ac('0x17'),core[_0xe6ac('0x17')]);ami['on'](_0xe6ac('0x18'),core[_0xe6ac('0x18')]);ami['on'](_0xe6ac('0x19'),core[_0xe6ac('0x19')]);ami['on'](_0xe6ac('0x1a'),core[_0xe6ac('0x1a')]);ami['on']('devicestatechange',function(_0xf4fbd1){try{utils['debug'](util[_0xe6ac('0x1b')](_0xe6ac('0x1c'),_0xf4fbd1['device']),_0xf4fbd1);members[_0xe6ac('0x1d')](_0xf4fbd1);}catch(_0x12cb5b){utils[_0xe6ac('0x18')](util[_0xe6ac('0x1b')]('[%s][index][devicestatechange]',_0xf4fbd1[_0xe6ac('0x1e')]),_0x12cb5b);}});ami['on'](_0xe6ac('0x1f'),function(_0x545285){try{utils[_0xe6ac('0x20')](util['format'](_0xe6ac('0x21'),_0x545285['uniqueid']),_0x545285);agents['agentcalled'](_0x545285);}catch(_0x2d001c){utils[_0xe6ac('0x18')](util[_0xe6ac('0x1b')](_0xe6ac('0x21'),_0x545285[_0xe6ac('0x22')]),_0x2d001c);}});ami['on'](_0xe6ac('0x23'),function(_0x5d69b1){try{utils['debug'](util[_0xe6ac('0x1b')]('[%s][index][agentringnoanswer]',_0x5d69b1[_0xe6ac('0x22')]),_0x5d69b1);agents[_0xe6ac('0x23')](_0x5d69b1);}catch(_0x284ab0){utils[_0xe6ac('0x18')](util[_0xe6ac('0x1b')](_0xe6ac('0x24'),_0x5d69b1[_0xe6ac('0x22')]),_0x284ab0);}});ami['on'](_0xe6ac('0x25'),function(_0x1e2388){try{utils['debug'](util[_0xe6ac('0x1b')](_0xe6ac('0x26'),_0x1e2388[_0xe6ac('0x22')]),_0x1e2388);agents[_0xe6ac('0x25')](_0x1e2388);queues['agentconnect'](_0x1e2388);}catch(_0x1c7362){utils['error'](util[_0xe6ac('0x1b')]('[%s][index][agentconnect]',_0x1e2388[_0xe6ac('0x22')]),_0x1c7362);}});ami['on']('agentcomplete',function(_0x260b33){try{utils[_0xe6ac('0x20')](util[_0xe6ac('0x1b')]('[%s][index][agentcomplete]',_0x260b33[_0xe6ac('0x22')]),_0x260b33);agents['agentcomplete'](_0x260b33);queues['agentcomplete'](_0x260b33);members['agentcomplete'](_0x260b33);}catch(_0x121b47){utils['error'](util['format']('[%s][index][agentcomplete]',_0x260b33[_0xe6ac('0x22')]),_0x121b47);}});ami['on'](_0xe6ac('0x27'),function(_0x3b1a2c){try{utils[_0xe6ac('0x20')](util[_0xe6ac('0x1b')](_0xe6ac('0x28'),_0x3b1a2c[_0xe6ac('0x22')]),_0x3b1a2c);agents['queuecallerabandon'](_0x3b1a2c);queues[_0xe6ac('0x27')](_0x3b1a2c);}catch(_0x56e99d){utils[_0xe6ac('0x18')](util[_0xe6ac('0x1b')](_0xe6ac('0x28'),_0x3b1a2c['uniqueid']),_0x56e99d);}});ami['on'](_0xe6ac('0x29'),function(_0xb764f0){try{utils[_0xe6ac('0x20')](util[_0xe6ac('0x1b')](_0xe6ac('0x2a'),_0xb764f0['uniqueid']),_0xb764f0);queues[_0xe6ac('0x29')](_0xb764f0);recordings['queuecallerjoin'](_0xb764f0);}catch(_0x1f5f31){utils[_0xe6ac('0x18')](util[_0xe6ac('0x1b')](_0xe6ac('0x2a'),_0xb764f0[_0xe6ac('0x22')]),_0x1f5f31);}});ami['on'](_0xe6ac('0x2b'),function(_0x1770fc){try{utils['debug'](util['format'](_0xe6ac('0x2c'),_0x1770fc[_0xe6ac('0x22')]),_0x1770fc);queues['queuecallerleave'](_0x1770fc);}catch(_0xc7f6f8){utils['error'](util[_0xe6ac('0x1b')](_0xe6ac('0x2c'),_0x1770fc[_0xe6ac('0x22')]),_0xc7f6f8);}});ami['on'](_0xe6ac('0x2d'),function(_0x49fe5d){try{utils[_0xe6ac('0x20')](util[_0xe6ac('0x1b')](_0xe6ac('0x2e'),_0x49fe5d[_0xe6ac('0x22')]),_0x49fe5d);queues[_0xe6ac('0x2d')](_0x49fe5d);calls[_0xe6ac('0x2d')](_0x49fe5d);}catch(_0x9ce81a){utils['error'](util[_0xe6ac('0x1b')](_0xe6ac('0x2e'),_0x49fe5d[_0xe6ac('0x22')]),_0x9ce81a);}});ami['on'](_0xe6ac('0x2f'),function(_0x14e90f){try{utils[_0xe6ac('0x20')](util[_0xe6ac('0x1b')](_0xe6ac('0x30'),_0x14e90f[_0xe6ac('0x22')]),_0x14e90f);queues[_0xe6ac('0x2f')](_0x14e90f);calls[_0xe6ac('0x2f')](_0x14e90f);}catch(_0x21eaf7){utils['error'](util[_0xe6ac('0x1b')](_0xe6ac('0x30'),_0x14e90f[_0xe6ac('0x22')]),_0x21eaf7);}});ami['on'](_0xe6ac('0x31'),function(_0xa81bea){try{utils[_0xe6ac('0x20')](util[_0xe6ac('0x1b')](_0xe6ac('0x32'),_0xa81bea[_0xe6ac('0x22')]),_0xa81bea);calls[_0xe6ac('0x31')](_0xa81bea);recordings['newstate'](_0xa81bea);}catch(_0x2f0149){utils[_0xe6ac('0x18')](util[_0xe6ac('0x1b')](_0xe6ac('0x32'),_0xa81bea[_0xe6ac('0x22')]),_0x2f0149);}});ami['on'](_0xe6ac('0x33'),function(_0x2453fb){try{utils[_0xe6ac('0x20')](util[_0xe6ac('0x1b')](_0xe6ac('0x34'),_0x2453fb['uniqueid']),_0x2453fb);calls[_0xe6ac('0x33')](_0x2453fb);recordings['hangup'](_0x2453fb);dials['hangup'](_0x2453fb);agents['hangup'](_0x2453fb);queues['hangup'](_0x2453fb);}catch(_0x18800d){utils[_0xe6ac('0x18')](util[_0xe6ac('0x1b')](_0xe6ac('0x34'),_0x2453fb['uniqueid']),_0x18800d);}});ami['on'](_0xe6ac('0x35'),function(_0x5eda1f){try{utils['debug'](util['format'](_0xe6ac('0x36'),_0x5eda1f[_0xe6ac('0x22')]),_0x5eda1f);members['cdr'](_0x5eda1f);}catch(_0xa90ee3){utils[_0xe6ac('0x18')](util[_0xe6ac('0x1b')](_0xe6ac('0x36'),_0x5eda1f[_0xe6ac('0x22')]),_0xa90ee3);}});ami['on']('blindtransfer',function(_0xf3da10){try{utils[_0xe6ac('0x20')](util[_0xe6ac('0x1b')](_0xe6ac('0x37'),_0xf3da10[_0xe6ac('0x22')]),_0xf3da10);queues[_0xe6ac('0x38')](_0xf3da10);agents[_0xe6ac('0x38')](_0xf3da10);transfers[_0xe6ac('0x38')](_0xf3da10);recordings[_0xe6ac('0x38')](_0xf3da10);}catch(_0x577839){utils['error'](util['format'](_0xe6ac('0x37'),_0xf3da10[_0xe6ac('0x22')]),_0x577839);}});ami['on']('attendedtransfer',function(_0x5b1e10){try{utils[_0xe6ac('0x20')](util[_0xe6ac('0x1b')]('[%s][index][attendedtransfer]',_0x5b1e10['origtransfereruniqueid']),_0x5b1e10);queues[_0xe6ac('0x39')](_0x5b1e10);transfers['attendedtransfer'](_0x5b1e10);agents[_0xe6ac('0x39')](_0x5b1e10);calls[_0xe6ac('0x39')](_0x5b1e10);}catch(_0x4f7da1){utils[_0xe6ac('0x18')](util[_0xe6ac('0x1b')](_0xe6ac('0x3a'),_0x5b1e10[_0xe6ac('0x3b')]),_0x4f7da1);}});ami['on']('varset',function(_0x431e49){try{utils[_0xe6ac('0x20')](util['format'](_0xe6ac('0x3c'),_0x431e49[_0xe6ac('0x22')]),_0x431e49);queues[_0xe6ac('0x3d')](_0x431e49);recordings[_0xe6ac('0x3d')](_0x431e49);calls['varset'](_0x431e49);dials[_0xe6ac('0x3d')](_0x431e49);}catch(_0x21bf12){utils['error'](util[_0xe6ac('0x1b')](_0xe6ac('0x3c'),_0x431e49[_0xe6ac('0x22')]),_0x21bf12);}});ami['on']('newexten',function(_0x177820){try{utils[_0xe6ac('0x20')](util[_0xe6ac('0x1b')](_0xe6ac('0x3e'),_0x177820[_0xe6ac('0x22')]),_0x177820);calls[_0xe6ac('0x3f')](_0x177820);recordings[_0xe6ac('0x3f')](_0x177820);dials[_0xe6ac('0x3f')](_0x177820);}catch(_0x506a04){utils['error'](util[_0xe6ac('0x1b')]('[%s][index][newexten]',_0x177820['uniqueid']),_0x506a04);}});ami['on'](_0xe6ac('0x40'),function(_0x16aedc){try{utils[_0xe6ac('0x20')](util[_0xe6ac('0x1b')](_0xe6ac('0x41'),_0x16aedc[_0xe6ac('0x22')]),_0x16aedc);calls[_0xe6ac('0x40')](_0x16aedc);recordings[_0xe6ac('0x40')](_0x16aedc);}catch(_0x4d7c22){utils[_0xe6ac('0x18')](util[_0xe6ac('0x1b')]('[%s][index][newchannel]',_0x16aedc[_0xe6ac('0x22')]),_0x4d7c22);}});ami['on'](_0xe6ac('0x42'),function(_0x2c8526){try{utils[_0xe6ac('0x20')](util[_0xe6ac('0x1b')](_0xe6ac('0x43'),_0x2c8526[_0xe6ac('0x22')]),_0x2c8526);dials[_0xe6ac('0x42')](_0x2c8526);}catch(_0x19278d){utils[_0xe6ac('0x18')](util[_0xe6ac('0x1b')]('[%s]dialbegin',_0x2c8526['uniqueid']),_0x19278d);}});ami['on'](_0xe6ac('0x44'),function(_0xbc1224){try{utils[_0xe6ac('0x20')](util[_0xe6ac('0x1b')](_0xe6ac('0x45'),_0xbc1224[_0xe6ac('0x22')]),_0xbc1224);dials[_0xe6ac('0x44')](_0xbc1224);}catch(_0x5926b7){utils[_0xe6ac('0x18')](util[_0xe6ac('0x1b')](_0xe6ac('0x45'),_0xbc1224[_0xe6ac('0x22')]),_0x5926b7);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 6718c08..46b74f4 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 _0x7b6f=['data1','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','lodash','./utils','Local/_attended@transfer','Queue:','info','format','uniqueid','interface','channel','data2','membername','type','getUserByInterface','then','name','internal','request','CreateMemberReport','error','[%s][members][writeDB]','startsWith','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','debug','[%s][members][cdr]','split'];(function(_0x4ebb6f,_0x2f94f9){var _0x2bffdc=function(_0x106fbf){while(--_0x106fbf){_0x4ebb6f['push'](_0x4ebb6f['shift']());}};_0x2bffdc(++_0x2f94f9);}(_0x7b6f,0x6c));var _0xf7b6=function(_0x45ba83,_0x5a806a){_0x45ba83=_0x45ba83-0x0;var _0x3b612f=_0x7b6f[_0x45ba83];return _0x3b612f;};'use strict';var _=require(_0xf7b6('0x0'));var util=require('util');var utils=require(_0xf7b6('0x1'));var members={};var exclude=[_0xf7b6('0x2'),_0xf7b6('0x3')];function writeDB(_0x45a9ae){utils[_0xf7b6('0x4')](util[_0xf7b6('0x5')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x45a9ae[_0xf7b6('0x6')],_0x45a9ae[_0xf7b6('0x7')],_0x45a9ae[_0xf7b6('0x8')],_0x45a9ae[_0xf7b6('0x9')],_0x45a9ae[_0xf7b6('0xa')],_0x45a9ae[_0xf7b6('0xb')]));if(_0x45a9ae[_0xf7b6('0x7')]){utils[_0xf7b6('0xc')](_0x45a9ae[_0xf7b6('0x7')])[_0xf7b6('0xd')](function(_0x391166){if(_0x391166){_0x45a9ae['membername']=_0x391166[_0xf7b6('0xe')];_0x45a9ae[_0xf7b6('0xf')]=_0x391166[_0xf7b6('0xf')];utils[_0xf7b6('0x10')](_0xf7b6('0x11'),_0x45a9ae);}else{utils['getUserByName'](_0x45a9ae['interface']['split']('/')[0x1])[_0xf7b6('0xd')](function(_0xf498e9){if(_0xf498e9){_0x45a9ae[_0xf7b6('0xa')]=_0xf498e9[_0xf7b6('0xe')];_0x45a9ae[_0xf7b6('0xf')]=_0xf498e9[_0xf7b6('0xf')];utils[_0xf7b6('0x10')](_0xf7b6('0x11'),_0x45a9ae);}});}})['catch'](function(_0x2f3a67){utils[_0xf7b6('0x12')](util[_0xf7b6('0x5')](_0xf7b6('0x13'),_0x45a9ae[_0xf7b6('0x6')]),_0x2f3a67);});}delete members[_0x45a9ae[_0xf7b6('0x7')]];}function startsWith(_0x4fecfd,_0x4c28e7){return _['some'](_0x4fecfd,function(_0x149b5c){return _[_0xf7b6('0x14')](_0x4c28e7,_0x149b5c);});}exports['devicestatechange']=function(_0x39d10b){try{utils['debug'](util[_0xf7b6('0x5')](_0xf7b6('0x15'),members[_0x39d10b[_0xf7b6('0x16')]]?members[_0x39d10b[_0xf7b6('0x16')]][_0xf7b6('0x6')]:_0x39d10b['device']),_0x39d10b);utils[_0xf7b6('0x4')](util['format'](_0xf7b6('0x17'),members[_0x39d10b[_0xf7b6('0x16')]]?members[_0x39d10b['device']][_0xf7b6('0x6')]:_0x39d10b[_0xf7b6('0x16')],_0x39d10b['state'],_0x39d10b[_0xf7b6('0x16')]));switch(_0x39d10b[_0xf7b6('0x18')]){case _0xf7b6('0x19'):case _0xf7b6('0x1a'):if(!startsWith(exclude,_0x39d10b[_0xf7b6('0x16')])){members[_0x39d10b[_0xf7b6('0x16')]]={'channel':_0xf7b6('0x1b'),'interface':_0x39d10b[_0xf7b6('0x16')],'type':_0xf7b6('0x1c'),'enterAt':utils[_0xf7b6('0x1d')](),'role':'agent'};}break;case _0xf7b6('0x1e'):if(!_[_0xf7b6('0x1f')](members[_0x39d10b[_0xf7b6('0x16')]])){members[_0x39d10b[_0xf7b6('0x16')]][_0xf7b6('0x20')]=utils[_0xf7b6('0x1d')]();members[_0x39d10b[_0xf7b6('0x16')]][_0xf7b6('0x21')]=utils[_0xf7b6('0x22')](members[_0x39d10b['device']][_0xf7b6('0x20')],members[_0x39d10b[_0xf7b6('0x16')]][_0xf7b6('0x23')]);if(members[_0x39d10b['device']][_0xf7b6('0x6')]){writeDB(members[_0x39d10b[_0xf7b6('0x16')]]);}}break;default:break;}}catch(_0x273ff5){utils['error'](util[_0xf7b6('0x5')]('[%s][members][devicestatechange]',members[_0x39d10b['device']]?members[_0x39d10b[_0xf7b6('0x16')]][_0xf7b6('0x6')]:_0x39d10b[_0xf7b6('0x16')]),_0x273ff5);}};exports[_0xf7b6('0x24')]=function(_0x3c9f33){try{if(!_[_0xf7b6('0x1f')](members[_0x3c9f33[_0xf7b6('0x7')]])){utils['debug'](util[_0xf7b6('0x5')](_0xf7b6('0x25'),_0x3c9f33[_0xf7b6('0x6')]),_0x3c9f33);utils['info'](util[_0xf7b6('0x5')](_0xf7b6('0x26'),_0x3c9f33[_0xf7b6('0x6')],_0x3c9f33[_0xf7b6('0x7')],_0x3c9f33[_0xf7b6('0x27')]));members[_0x3c9f33[_0xf7b6('0x7')]]=_[_0xf7b6('0x28')](members[_0x3c9f33[_0xf7b6('0x7')]],{'data4':_0x3c9f33['queue'],'uniqueid':_0x3c9f33['uniqueid']});}}catch(_0x1bd12c){utils['error'](util[_0xf7b6('0x5')]('[%s][members][agentcomplete]',_0x3c9f33[_0xf7b6('0x6')]),_0x1bd12c);}};exports[_0xf7b6('0x29')]=function(_0x9632d5){try{utils[_0xf7b6('0x2a')](util['format'](_0xf7b6('0x2b'),_0x9632d5[_0xf7b6('0x6')]),_0x9632d5);if(_0x9632d5['channel']){var _0x483844=_0x9632d5['channel'][_0xf7b6('0x2c')]('-')[0x0];if(!_['isNil'](members[_0x483844])){members[_0x483844]=_[_0xf7b6('0x28')](members[_0x483844],{'data1':members[_0x483844][_0xf7b6('0x2d')]||_0x9632d5[_0xf7b6('0xb')],'data2':members[_0x483844][_0xf7b6('0x9')]||_0x9632d5[_0xf7b6('0x2e')],'data3':members[_0x483844]['data3']||_0x9632d5[_0xf7b6('0x2f')],'uniqueid':members[_0x483844][_0xf7b6('0x6')]||_0x9632d5[_0xf7b6('0x6')]});utils[_0xf7b6('0x4')](util['format'](_0xf7b6('0x30'),_0x9632d5[_0xf7b6('0x6')],members[_0x483844][_0xf7b6('0x2d')],members[_0x483844][_0xf7b6('0x9')],members[_0x483844][_0xf7b6('0x31')]));if(members[_0x483844][_0xf7b6('0x20')]){writeDB(members[_0x483844]);}}}if(_0x9632d5['destinationchannel']){var _0x2069b1=_0x9632d5[_0xf7b6('0x32')][_0xf7b6('0x2c')]('-')[0x0];if(!_[_0xf7b6('0x1f')](members[_0x2069b1])){members[_0x2069b1]=_[_0xf7b6('0x28')](members[_0x2069b1],{'data1':members[_0x2069b1][_0xf7b6('0x2d')]||_0x9632d5[_0xf7b6('0xb')],'data2':members[_0x2069b1][_0xf7b6('0x9')]||_0x9632d5['source'],'data3':members[_0x2069b1][_0xf7b6('0x31')]||_0x9632d5['destination'],'uniqueid':members[_0x2069b1]['uniqueid']||_0x9632d5['uniqueid']});utils[_0xf7b6('0x4')](util['format'](_0xf7b6('0x30'),_0x9632d5['uniqueid'],members[_0x2069b1]['data1'],members[_0x2069b1]['data2'],members[_0x2069b1]['data3']));if(members[_0x2069b1][_0xf7b6('0x20')]){writeDB(members[_0x2069b1]);}}}}catch(_0x157070){utils[_0xf7b6('0x12')](util[_0xf7b6('0x5')](_0xf7b6('0x2b'),_0x9632d5['uniqueid']),_0x157070);}}; \ No newline at end of file +var _0xf008=['getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','split','catch','error','some','startsWith','devicestatechange','debug','device','state','INUSE','BUSY','voice','now','agent','NOT_INUSE','isNil','duration','diffTime','exitAt','enterAt','[%s][members][devicestatechange]','agentcomplete','assign','queue','[%s][members][agentcomplete]','cdr','data1','data2','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','[%s][members][cdr]','lodash','util','./utils','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','membername','type'];(function(_0x5c2c7c,_0xa7d3b1){var _0xea7ffe=function(_0x471f17){while(--_0x471f17){_0x5c2c7c['push'](_0x5c2c7c['shift']());}};_0xea7ffe(++_0xa7d3b1);}(_0xf008,0x1c8));var _0x8f00=function(_0x36044a,_0x389d5d){_0x36044a=_0x36044a-0x0;var _0x2e406c=_0xf008[_0x36044a];return _0x2e406c;};'use strict';var _=require(_0x8f00('0x0'));var util=require(_0x8f00('0x1'));var utils=require(_0x8f00('0x2'));var members={};var exclude=['Local/_attended@transfer',_0x8f00('0x3')];function writeDB(_0x40acd1){utils[_0x8f00('0x4')](util[_0x8f00('0x5')](_0x8f00('0x6'),_0x40acd1[_0x8f00('0x7')],_0x40acd1[_0x8f00('0x8')],_0x40acd1[_0x8f00('0x9')],_0x40acd1['data2'],_0x40acd1[_0x8f00('0xa')],_0x40acd1[_0x8f00('0xb')]));if(_0x40acd1[_0x8f00('0x8')]){utils[_0x8f00('0xc')](_0x40acd1['interface'])[_0x8f00('0xd')](function(_0x195f86){if(_0x195f86){_0x40acd1['membername']=_0x195f86[_0x8f00('0xe')];_0x40acd1[_0x8f00('0xf')]=_0x195f86['internal'];utils[_0x8f00('0x10')](_0x8f00('0x11'),_0x40acd1);}else{utils[_0x8f00('0x12')](_0x40acd1['interface'][_0x8f00('0x13')]('/')[0x1])[_0x8f00('0xd')](function(_0x307225){if(_0x307225){_0x40acd1['membername']=_0x307225[_0x8f00('0xe')];_0x40acd1[_0x8f00('0xf')]=_0x307225[_0x8f00('0xf')];utils[_0x8f00('0x10')]('CreateMemberReport',_0x40acd1);}});}})[_0x8f00('0x14')](function(_0x44ec57){utils[_0x8f00('0x15')](util[_0x8f00('0x5')]('[%s][members][writeDB]',_0x40acd1[_0x8f00('0x7')]),_0x44ec57);});}delete members[_0x40acd1[_0x8f00('0x8')]];}function startsWith(_0x4ebb29,_0x29328e){return _[_0x8f00('0x16')](_0x4ebb29,function(_0x3450d2){return _[_0x8f00('0x17')](_0x29328e,_0x3450d2);});}exports[_0x8f00('0x18')]=function(_0x13b411){try{utils[_0x8f00('0x19')](util['format']('[%s][members][devicestatechange]',members[_0x13b411['device']]?members[_0x13b411[_0x8f00('0x1a')]][_0x8f00('0x7')]:_0x13b411[_0x8f00('0x1a')]),_0x13b411);utils[_0x8f00('0x4')](util[_0x8f00('0x5')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x13b411[_0x8f00('0x1a')]]?members[_0x13b411['device']][_0x8f00('0x7')]:_0x13b411[_0x8f00('0x1a')],_0x13b411['state'],_0x13b411[_0x8f00('0x1a')]));switch(_0x13b411[_0x8f00('0x1b')]){case _0x8f00('0x1c'):case _0x8f00('0x1d'):if(!startsWith(exclude,_0x13b411['device'])){members[_0x13b411[_0x8f00('0x1a')]]={'channel':_0x8f00('0x1e'),'interface':_0x13b411[_0x8f00('0x1a')],'type':'TALKING','enterAt':utils[_0x8f00('0x1f')](),'role':_0x8f00('0x20')};}break;case _0x8f00('0x21'):if(!_[_0x8f00('0x22')](members[_0x13b411[_0x8f00('0x1a')]])){members[_0x13b411[_0x8f00('0x1a')]]['exitAt']=utils['now']();members[_0x13b411[_0x8f00('0x1a')]][_0x8f00('0x23')]=utils[_0x8f00('0x24')](members[_0x13b411['device']][_0x8f00('0x25')],members[_0x13b411[_0x8f00('0x1a')]][_0x8f00('0x26')]);if(members[_0x13b411[_0x8f00('0x1a')]]['uniqueid']){writeDB(members[_0x13b411['device']]);}}break;default:break;}}catch(_0x16ed6f){utils[_0x8f00('0x15')](util['format'](_0x8f00('0x27'),members[_0x13b411[_0x8f00('0x1a')]]?members[_0x13b411[_0x8f00('0x1a')]][_0x8f00('0x7')]:_0x13b411['device']),_0x16ed6f);}};exports[_0x8f00('0x28')]=function(_0x30ad71){try{if(!_[_0x8f00('0x22')](members[_0x30ad71[_0x8f00('0x8')]])){utils[_0x8f00('0x19')](util[_0x8f00('0x5')]('[%s][members][agentcomplete]',_0x30ad71['uniqueid']),_0x30ad71);utils[_0x8f00('0x4')](util[_0x8f00('0x5')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x30ad71['uniqueid'],_0x30ad71[_0x8f00('0x8')],_0x30ad71['queue']));members[_0x30ad71['interface']]=_[_0x8f00('0x29')](members[_0x30ad71[_0x8f00('0x8')]],{'data4':_0x30ad71[_0x8f00('0x2a')],'uniqueid':_0x30ad71['uniqueid']});}}catch(_0xe76994){utils[_0x8f00('0x15')](util[_0x8f00('0x5')](_0x8f00('0x2b'),_0x30ad71[_0x8f00('0x7')]),_0xe76994);}};exports[_0x8f00('0x2c')]=function(_0x461593){try{utils[_0x8f00('0x19')](util['format']('[%s][members][cdr]',_0x461593[_0x8f00('0x7')]),_0x461593);if(_0x461593['channel']){var _0x346322=_0x461593[_0x8f00('0x9')][_0x8f00('0x13')]('-')[0x0];if(!_[_0x8f00('0x22')](members[_0x346322])){members[_0x346322]=_[_0x8f00('0x29')](members[_0x346322],{'data1':members[_0x346322][_0x8f00('0x2d')]||_0x461593[_0x8f00('0xb')],'data2':members[_0x346322][_0x8f00('0x2e')]||_0x461593['source'],'data3':members[_0x346322]['data3']||_0x461593[_0x8f00('0x2f')],'uniqueid':members[_0x346322][_0x8f00('0x7')]||_0x461593['uniqueid']});utils[_0x8f00('0x4')](util[_0x8f00('0x5')](_0x8f00('0x30'),_0x461593[_0x8f00('0x7')],members[_0x346322][_0x8f00('0x2d')],members[_0x346322][_0x8f00('0x2e')],members[_0x346322][_0x8f00('0x31')]));if(members[_0x346322]['exitAt']){writeDB(members[_0x346322]);}}}if(_0x461593[_0x8f00('0x32')]){var _0x5b4742=_0x461593[_0x8f00('0x32')][_0x8f00('0x13')]('-')[0x0];if(!_['isNil'](members[_0x5b4742])){members[_0x5b4742]=_[_0x8f00('0x29')](members[_0x5b4742],{'data1':members[_0x5b4742][_0x8f00('0x2d')]||_0x461593[_0x8f00('0xb')],'data2':members[_0x5b4742][_0x8f00('0x2e')]||_0x461593['source'],'data3':members[_0x5b4742][_0x8f00('0x31')]||_0x461593[_0x8f00('0x2f')],'uniqueid':members[_0x5b4742][_0x8f00('0x7')]||_0x461593[_0x8f00('0x7')]});utils[_0x8f00('0x4')](util[_0x8f00('0x5')](_0x8f00('0x30'),_0x461593['uniqueid'],members[_0x5b4742][_0x8f00('0x2d')],members[_0x5b4742][_0x8f00('0x2e')],members[_0x5b4742][_0x8f00('0x31')]));if(members[_0x5b4742][_0x8f00('0x25')]){writeDB(members[_0x5b4742]);}}}}catch(_0x2fb392){utils[_0x8f00('0x15')](util[_0x8f00('0x5')](_0x8f00('0x33'),_0x461593[_0x8f00('0x7')]),_0x2fb392);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 3997631..a0d5e23 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 _0x25c0=['CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','format','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','variable','value','toUpperCase','CONTINUE','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerabandonAt','EXITWITHKEY','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','queuecallerleave','holdtime','diffTime','queuecallerleaveAt','queuecallerjoinAt','count','connectedlinenum','[%s][queues][agentconnect]','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','transfertype','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','origtransfererexten','ATTENDED','origtransfererlinkedid','transfereelinkedid','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','clone','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','getVoiceQueueByName','then','type','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x25c0,0x1e6));var _0x025c=function(_0x1e8ffc,_0x3c0c4d){_0x1e8ffc=_0x1e8ffc-0x0;var _0x2b98d1=_0x25c0[_0x1e8ffc];return _0x2b98d1;};'use strict';var _=require(_0x025c('0x0'));var util=require(_0x025c('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x36a31c){utils[_0x025c('0x2')](util['format'](_0x025c('0x3'),_0x36a31c[_0x025c('0x4')],_0x36a31c[_0x025c('0x5')],_0x36a31c[_0x025c('0x6')],_0x36a31c[_0x025c('0x7')],_0x36a31c[_0x025c('0x8')],_0x36a31c[_0x025c('0x9')],_0x36a31c['queuecallerexitreason']));if(_0x36a31c[_0x025c('0x6')]){utils[_0x025c('0xa')](_0x36a31c[_0x025c('0x6')])[_0x025c('0xb')](function(_0x56d38e){if(_0x56d38e){_0x36a31c['type']=_0x56d38e[_0x025c('0xc')];}utils[_0x025c('0xd')](_0x025c('0xe'),_0x36a31c);});}else{utils[_0x025c('0xd')](_0x025c('0xe'),_0x36a31c);}if(_0x36a31c[_0x025c('0xf')]){delete queues[_0x36a31c[_0x025c('0xf')]];}else{delete queues[_0x36a31c[_0x025c('0x4')]];}}exports[_0x025c('0x10')]=function(_0x19fd1b){try{utils[_0x025c('0x11')](util[_0x025c('0x12')](_0x025c('0x13'),_0x19fd1b[_0x025c('0x4')]),_0x19fd1b);utils[_0x025c('0x2')](util['format'](_0x025c('0x14'),_0x19fd1b[_0x025c('0x4')],_0x19fd1b['queue'],_0x19fd1b['position']));queues[_0x19fd1b['uniqueid']]=_[_0x025c('0x15')](_0x19fd1b,{'originalposition':_0x19fd1b[_0x025c('0x16')],'queuecallerjoinAt':utils[_0x025c('0x17')](),'mohtime':0x0});}catch(_0x102dee){utils[_0x025c('0x18')](util['format'](_0x025c('0x13'),_0x19fd1b[_0x025c('0x4')]),_0x102dee);}};exports[_0x025c('0x19')]=function(_0x5f5bbe){try{if(!_[_0x025c('0x1a')](queues[_0x5f5bbe[_0x025c('0x4')]])){utils[_0x025c('0x11')](util[_0x025c('0x12')](_0x025c('0x1b'),_0x5f5bbe[_0x025c('0x4')]),_0x5f5bbe);if(queues[_0x5f5bbe[_0x025c('0x4')]]['queuecallerleaveAt']){if(!queues[_0x5f5bbe[_0x025c('0x4')]][_0x025c('0x1c')]&&!queues[_0x5f5bbe[_0x025c('0x4')]][_0x025c('0x1d')]){queues[_0x5f5bbe[_0x025c('0x4')]][_0x025c('0x1e')]=!![];queues[_0x5f5bbe[_0x025c('0x4')]][_0x025c('0x1f')]=utils['now']();queues[_0x5f5bbe[_0x025c('0x4')]][_0x025c('0x20')]='COMPLETEDBYAGENT';}utils[_0x025c('0x2')](util[_0x025c('0x12')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x5f5bbe[_0x025c('0x4')],queues[_0x5f5bbe[_0x025c('0x4')]][_0x025c('0x21')],queues[_0x5f5bbe[_0x025c('0x4')]][_0x025c('0x20')]));writeDB(queues[_0x5f5bbe[_0x025c('0x4')]]);}else if(queues[_0x5f5bbe[_0x025c('0x4')]][_0x025c('0xf')]){utils['info'](util[_0x025c('0x12')](_0x025c('0x22'),_0x5f5bbe[_0x025c('0x4')],queues[_0x5f5bbe[_0x025c('0x4')]][_0x025c('0x21')],queues[_0x5f5bbe[_0x025c('0x4')]][_0x025c('0xf')]));queues[queues[_0x5f5bbe[_0x025c('0x4')]][_0x025c('0xf')]]=queues[_0x5f5bbe['uniqueid']];queues[queues[_0x5f5bbe[_0x025c('0x4')]][_0x025c('0xf')]][_0x025c('0x23')]=0x2;delete queues[_0x5f5bbe[_0x025c('0x4')]];}}}catch(_0x3660bf){utils['error'](util['format'](_0x025c('0x1b'),_0x5f5bbe['uniqueid']),_0x3660bf);}};exports[_0x025c('0x24')]=function(_0x143f87){try{utils[_0x025c('0x11')](util[_0x025c('0x12')](_0x025c('0x25'),_0x143f87[_0x025c('0x4')]),_0x143f87);if(!_['isNil'](_0x143f87[_0x025c('0x26')]['queuestatus'])&&_0x143f87[_0x025c('0x27')][_0x025c('0x28')]()!==_0x025c('0x29')){if(!_[_0x025c('0x1a')](queues[_0x143f87[_0x025c('0x4')]])){queues[_0x143f87[_0x025c('0x4')]][_0x025c('0x1c')]=![];queues[_0x143f87[_0x025c('0x4')]]['queuecallerabandonAt']=null;queues[_0x143f87[_0x025c('0x4')]][_0x025c('0x1d')]=!![];queues[_0x143f87['uniqueid']][_0x025c('0x2a')]=utils['now']();queues[_0x143f87[_0x025c('0x4')]]['queuecallerexitreason']=_0x143f87[_0x025c('0x27')]['toUpperCase']();utils[_0x025c('0x2')](util['format'](_0x025c('0x2b'),_0x143f87[_0x025c('0x4')],queues[_0x143f87[_0x025c('0x4')]][_0x025c('0x21')],_0x143f87[_0x025c('0x27')],queues[_0x143f87[_0x025c('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x143f87['uniqueid']]);}}else if(!_[_0x025c('0x1a')](_0x143f87[_0x025c('0x26')][_0x025c('0x2c')])){if(!_[_0x025c('0x1a')](queues[_0x143f87[_0x025c('0x4')]])&&!queues[_0x143f87[_0x025c('0x4')]]['queuecallerabandon']){queues[_0x143f87['uniqueid']]['queuecallerabandon']=![];queues[_0x143f87[_0x025c('0x4')]][_0x025c('0x2d')]=null;queues[_0x143f87[_0x025c('0x4')]][_0x025c('0x1d')]=!![];queues[_0x143f87['uniqueid']][_0x025c('0x2a')]=utils[_0x025c('0x17')]();queues[_0x143f87['uniqueid']][_0x025c('0x20')]=_0x025c('0x2e');utils[_0x025c('0x2')](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x143f87['uniqueid'],queues[_0x143f87['uniqueid']][_0x025c('0x21')],_0x143f87[_0x025c('0x27')],queues[_0x143f87[_0x025c('0x4')]][_0x025c('0x20')]));}}}catch(_0x59c744){utils['error'](util['format'](_0x025c('0x25'),_0x143f87[_0x025c('0x4')]),_0x59c744);}};exports[_0x025c('0x1c')]=function(_0x3a0981){try{if(!_[_0x025c('0x1a')](queues[_0x3a0981['uniqueid']])){utils[_0x025c('0x11')](util[_0x025c('0x12')](_0x025c('0x2f'),_0x3a0981[_0x025c('0x4')]),_0x3a0981);queues[_0x3a0981[_0x025c('0x4')]][_0x025c('0x1d')]=![];queues[_0x3a0981[_0x025c('0x4')]][_0x025c('0x2a')]=null;queues[_0x3a0981[_0x025c('0x4')]][_0x025c('0x1c')]=!![];queues[_0x3a0981[_0x025c('0x4')]]['queuecallerabandonAt']=utils[_0x025c('0x17')]();queues[_0x3a0981[_0x025c('0x4')]][_0x025c('0x20')]=_0x025c('0x30');utils[_0x025c('0x2')](util[_0x025c('0x12')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x3a0981[_0x025c('0x4')],queues[_0x3a0981[_0x025c('0x4')]]['name'],queues[_0x3a0981[_0x025c('0x4')]][_0x025c('0x20')]));}}catch(_0x191081){utils['error'](util[_0x025c('0x12')](_0x025c('0x2f'),_0x3a0981[_0x025c('0x4')]),_0x191081);}};exports['queuecallerleave']=function(_0x427ee0){try{if(!_['isNil'](queues[_0x427ee0[_0x025c('0x4')]])){utils['debug'](util[_0x025c('0x12')](_0x025c('0x31'),_0x427ee0[_0x025c('0x4')]),_0x427ee0);utils[_0x025c('0x2')](util[_0x025c('0x12')](_0x025c('0x32'),_0x427ee0[_0x025c('0x4')],queues[_0x427ee0[_0x025c('0x4')]][_0x025c('0x21')],_0x427ee0['connectedlinenum'],_0x427ee0['connectedlinename']));queues[_0x427ee0[_0x025c('0x4')]][_0x025c('0x33')]=!![];queues[_0x427ee0[_0x025c('0x4')]]['queuecallerleaveAt']=utils[_0x025c('0x17')]();queues[_0x427ee0[_0x025c('0x4')]][_0x025c('0x34')]=utils[_0x025c('0x35')](queues[_0x427ee0[_0x025c('0x4')]][_0x025c('0x36')],queues[_0x427ee0['uniqueid']][_0x025c('0x37')]);queues[_0x427ee0[_0x025c('0x4')]][_0x025c('0x16')]=_0x427ee0['position'];queues[_0x427ee0[_0x025c('0x4')]][_0x025c('0x38')]=_0x427ee0['count'];queues[_0x427ee0[_0x025c('0x4')]][_0x025c('0x39')]=_0x427ee0[_0x025c('0x39')];queues[_0x427ee0['uniqueid']]['connectedlinename']=_0x427ee0['connectedlinename'];}}catch(_0x12141d){utils[_0x025c('0x18')](util[_0x025c('0x12')]('[%s][queues][queuecallerleave]',_0x427ee0[_0x025c('0x4')]),_0x12141d);}};exports['agentconnect']=function(_0x5e73c3){try{if(!_[_0x025c('0x1a')](queues[_0x5e73c3[_0x025c('0x4')]])){utils[_0x025c('0x11')](util[_0x025c('0x12')](_0x025c('0x3a'),_0x5e73c3[_0x025c('0x4')]),_0x5e73c3);utils[_0x025c('0x2')](util[_0x025c('0x12')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x5e73c3[_0x025c('0x4')],queues[_0x5e73c3[_0x025c('0x4')]]['name'],_0x5e73c3[_0x025c('0x3b')],_0x5e73c3[_0x025c('0x3c')]));queues[_0x5e73c3[_0x025c('0x4')]]['queuecallerabandon']=![];queues[_0x5e73c3[_0x025c('0x4')]][_0x025c('0x1c')]=![];queues[_0x5e73c3[_0x025c('0x4')]]['queuecallerabandonAt']=null;queues[_0x5e73c3[_0x025c('0x4')]]['queuecallerexit']=![];queues[_0x5e73c3['uniqueid']]['queuecallerexitreason']=null;queues[_0x5e73c3[_0x025c('0x4')]][_0x025c('0x2a')]=null;queues[_0x5e73c3[_0x025c('0x4')]][_0x025c('0x3d')]=!![];queues[_0x5e73c3['uniqueid']][_0x025c('0x9')]=_0x5e73c3['destaccountcode'];queues[_0x5e73c3[_0x025c('0x4')]][_0x025c('0x7')]=_0x5e73c3[_0x025c('0x3b')];}}catch(_0x4d5536){utils[_0x025c('0x18')](util[_0x025c('0x12')](_0x025c('0x3a'),_0x5e73c3[_0x025c('0x4')]),_0x4d5536);}};exports[_0x025c('0x3e')]=function(_0x133a95){try{if(!_['isNil'](queues[_0x133a95[_0x025c('0x4')]])){if(queues[_0x133a95['uniqueid']]['queuecallerleaveAt']){utils['debug'](util[_0x025c('0x12')](_0x025c('0x3f'),_0x133a95['uniqueid']),_0x133a95);queues[_0x133a95[_0x025c('0x4')]][_0x025c('0x1c')]=![];queues[_0x133a95['uniqueid']][_0x025c('0x1c')]=![];queues[_0x133a95[_0x025c('0x4')]][_0x025c('0x2d')]=null;queues[_0x133a95['uniqueid']]['queuecallerexit']=![];queues[_0x133a95[_0x025c('0x4')]][_0x025c('0x2a')]=null;queues[_0x133a95[_0x025c('0x4')]]['assigned']=!![];queues[_0x133a95['uniqueid']][_0x025c('0x7')]=_0x133a95[_0x025c('0x3b')];queues[_0x133a95[_0x025c('0x4')]][_0x025c('0x1e')]=!![];queues[_0x133a95[_0x025c('0x4')]]['queuecallercompleteAt']=utils[_0x025c('0x17')]();if(_0x133a95[_0x025c('0x40')]==_0x025c('0x41')){if(!queues[_0x133a95['uniqueid']][_0x025c('0x41')]){queues[_0x133a95[_0x025c('0x4')]][_0x025c('0x20')]='TRANSFER';}}else{queues[_0x133a95[_0x025c('0x4')]]['queuecallerexitreason']=_0x025c('0x42')+_0x133a95[_0x025c('0x40')][_0x025c('0x28')]();}utils[_0x025c('0x2')](util[_0x025c('0x12')](_0x025c('0x43'),_0x133a95[_0x025c('0x4')],queues[_0x133a95[_0x025c('0x4')]][_0x025c('0x21')],_0x133a95[_0x025c('0x3b')],queues[_0x133a95['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x133a95[_0x025c('0x4')]]);}}}catch(_0x9675f){utils[_0x025c('0x18')](util[_0x025c('0x12')]('[%s][queues][agentcomplete]',_0x133a95[_0x025c('0x4')]),_0x9675f);}};exports[_0x025c('0x44')]=function(_0xbb25c8){try{if(!_[_0x025c('0x1a')](queues[_0xbb25c8['transfereeuniqueid']])){utils[_0x025c('0x11')](util[_0x025c('0x12')]('[%s][queues][blindtransfer]',_0xbb25c8[_0x025c('0x4')]),_0xbb25c8);queues[_0xbb25c8[_0x025c('0x45')]][_0x025c('0x41')]=!![];queues[_0xbb25c8[_0x025c('0x45')]][_0x025c('0x46')]='BLIND';queues[_0xbb25c8[_0x025c('0x45')]][_0x025c('0x47')]=_0xbb25c8[_0x025c('0x48')];queues[_0xbb25c8[_0x025c('0x45')]][_0x025c('0x49')]=_0xbb25c8[_0x025c('0x45')];queues[_0xbb25c8[_0x025c('0x45')]][_0x025c('0x20')]=_0x025c('0x4a');utils[_0x025c('0x2')](util['format']('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0xbb25c8[_0x025c('0x4')],queues[_0xbb25c8[_0x025c('0x45')]][_0x025c('0x21')],_0xbb25c8['transfereeuniqueid'],_0xbb25c8[_0x025c('0x48')]));}}catch(_0x46d9f7){utils[_0x025c('0x18')](util['format'](_0x025c('0x4b'),_0xbb25c8[_0x025c('0x4')]),_0x46d9f7);}};exports[_0x025c('0x4c')]=function(_0x7c6d5d){try{utils[_0x025c('0x11')](util[_0x025c('0x12')](_0x025c('0x4d'),_0x7c6d5d[_0x025c('0x4e')]),_0x7c6d5d);if(_0x7c6d5d[_0x025c('0x4e')]==_0x7c6d5d['origtransfererlinkedid']){if(!_[_0x025c('0x1a')](queues[_0x7c6d5d[_0x025c('0x4f')]])){utils[_0x025c('0x2')](util[_0x025c('0x12')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x7c6d5d[_0x025c('0x4e')],queues[_0x7c6d5d[_0x025c('0x4f')]][_0x025c('0x21')],_0x7c6d5d[_0x025c('0x50')]));queues[_0x7c6d5d[_0x025c('0x4f')]][_0x025c('0x41')]=!![];queues[_0x7c6d5d[_0x025c('0x4f')]][_0x025c('0x46')]=_0x025c('0x51');queues[_0x7c6d5d['secondtransfererlinkedid']][_0x025c('0x47')]=_0x7c6d5d['origtransfererexten'];queues[_0x7c6d5d['secondtransfererlinkedid']]['transferuniqueid']=_0x7c6d5d[_0x025c('0x4e')];queues[_0x7c6d5d['secondtransfererlinkedid']][_0x025c('0x20')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x7c6d5d[_0x025c('0x52')]])){if(_0x7c6d5d[_0x025c('0x53')]&&queues[_0x7c6d5d[_0x025c('0x53')]]){queues[_0x7c6d5d[_0x025c('0x53')]][_0x025c('0x23')]=0x1;queues[_0x7c6d5d[_0x025c('0x45')]]=_['clone'](queues[_0x7c6d5d[_0x025c('0x53')]]);queues[_0x7c6d5d[_0x025c('0x45')]][_0x025c('0xf')]=_0x7c6d5d['transfertargetuniqueid'];queues[_0x7c6d5d[_0x025c('0x45')]]['queuecallerenterreason']=0x2;queues[_0x7c6d5d[_0x025c('0x45')]][_0x025c('0x8')]=queues[_0x7c6d5d[_0x025c('0x4f')]][_0x025c('0x8')];queues[_0x7c6d5d[_0x025c('0x45')]][_0x025c('0x54')]=queues[_0x7c6d5d[_0x025c('0x4f')]][_0x025c('0x54')];queues[_0x7c6d5d[_0x025c('0x45')]]['queuecallerjoinAt']=utils['now']();queues[_0x7c6d5d['transfereeuniqueid']][_0x025c('0x36')]=utils['now']();queues[_0x7c6d5d[_0x025c('0x45')]][_0x025c('0x34')]=0x0;queues[_0x7c6d5d[_0x025c('0x45')]]['mohtime']=0x0;utils[_0x025c('0x2')](util[_0x025c('0x12')](_0x025c('0x55'),_0x7c6d5d['origtransfereruniqueid'],queues[_0x7c6d5d[_0x025c('0x45')]]['name'],queues[_0x7c6d5d['transfereeuniqueid']][_0x025c('0x8')],queues[_0x7c6d5d[_0x025c('0x45')]][_0x025c('0x54')]));}else{utils[_0x025c('0x2')](util[_0x025c('0x12')](_0x025c('0x56'),_0x7c6d5d[_0x025c('0x4e')],queues[_0x7c6d5d['origtransfererlinkedid']][_0x025c('0x21')],_0x7c6d5d[_0x025c('0x4f')]));queues[_0x7c6d5d[_0x025c('0x52')]]['transfereduniqueid']=_0x7c6d5d[_0x025c('0x4f')];}}}else if(_0x7c6d5d[_0x025c('0x57')]==_0x7c6d5d[_0x025c('0x4f')]){if(!_[_0x025c('0x1a')](queues[_0x7c6d5d[_0x025c('0x52')]])){utils[_0x025c('0x2')](util['format'](_0x025c('0x58'),_0x7c6d5d[_0x025c('0x4e')],queues[_0x7c6d5d[_0x025c('0x52')]][_0x025c('0x21')],_0x7c6d5d['secondtransfereruniqueid'],_0x7c6d5d['secondtransfererexten']));queues[_0x7c6d5d['origtransfererlinkedid']][_0x025c('0x41')]=!![];queues[_0x7c6d5d['origtransfererlinkedid']]['transfertype']=_0x025c('0x51');queues[_0x7c6d5d['origtransfererlinkedid']][_0x025c('0x47')]=_0x7c6d5d[_0x025c('0x59')];queues[_0x7c6d5d[_0x025c('0x52')]][_0x025c('0x49')]=_0x7c6d5d[_0x025c('0x57')];queues[_0x7c6d5d[_0x025c('0x52')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_[_0x025c('0x1a')](queues[_0x7c6d5d[_0x025c('0x4f')]])){if(_0x7c6d5d[_0x025c('0x5a')]&&queues[_0x7c6d5d[_0x025c('0x5a')]]){queues[_0x7c6d5d[_0x025c('0x5a')]][_0x025c('0x23')]=0x1;queues[_0x7c6d5d[_0x025c('0x5b')]]=_[_0x025c('0x5c')](queues[_0x7c6d5d[_0x025c('0x5a')]]);queues[_0x7c6d5d[_0x025c('0x5b')]][_0x025c('0xf')]=_0x7c6d5d[_0x025c('0x5b')];queues[_0x7c6d5d['transfertargetuniqueid']][_0x025c('0x23')]=0x2;queues[_0x7c6d5d[_0x025c('0x5b')]][_0x025c('0x8')]=queues[_0x7c6d5d['origtransfererlinkedid']][_0x025c('0x8')];queues[_0x7c6d5d[_0x025c('0x5b')]][_0x025c('0x54')]=queues[_0x7c6d5d[_0x025c('0x52')]]['calleridname'];queues[_0x7c6d5d[_0x025c('0x5b')]][_0x025c('0x37')]=utils['now']();queues[_0x7c6d5d[_0x025c('0x5b')]][_0x025c('0x36')]=utils[_0x025c('0x17')]();queues[_0x7c6d5d[_0x025c('0x5b')]]['holdtime']=0x0;queues[_0x7c6d5d[_0x025c('0x5b')]][_0x025c('0x5d')]=0x0;utils[_0x025c('0x2')](util[_0x025c('0x12')](_0x025c('0x5e'),_0x7c6d5d[_0x025c('0x4e')],queues[_0x7c6d5d[_0x025c('0x5b')]][_0x025c('0x21')],queues[_0x7c6d5d[_0x025c('0x5b')]][_0x025c('0xf')],queues[_0x7c6d5d[_0x025c('0x5b')]]['calleridnum'],queues[_0x7c6d5d['transfertargetuniqueid']][_0x025c('0x54')]));}else{utils['info'](util[_0x025c('0x12')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x7c6d5d['origtransfereruniqueid'],queues[_0x7c6d5d[_0x025c('0x4f')]][_0x025c('0x21')],_0x7c6d5d[_0x025c('0x52')]));queues[_0x7c6d5d[_0x025c('0x4f')]][_0x025c('0xf')]=_0x7c6d5d[_0x025c('0x52')];}}}}catch(_0x9857da){utils[_0x025c('0x18')](util[_0x025c('0x12')](_0x025c('0x4d'),_0x7c6d5d[_0x025c('0x4e')]),_0x9857da);}};exports[_0x025c('0x5f')]=function(_0x4fff47){try{if(!_['isNil'](queues[_0x4fff47['uniqueid']])){utils[_0x025c('0x11')](util['format'](_0x025c('0x60'),_0x4fff47['uniqueid']),_0x4fff47);queues[_0x4fff47[_0x025c('0x4')]][_0x025c('0x61')]=utils[_0x025c('0x17')]();utils['info'](util[_0x025c('0x12')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x4fff47[_0x025c('0x4')],queues[_0x4fff47[_0x025c('0x4')]][_0x025c('0x21')],queues[_0x4fff47[_0x025c('0x4')]][_0x025c('0x61')]));}}catch(_0x4ca2cf){utils[_0x025c('0x18')](util[_0x025c('0x12')]('[%s][queues][musiconholdstart]',_0x4fff47[_0x025c('0x4')]),_0x4ca2cf);}};exports[_0x025c('0x62')]=function(_0x58e90e){try{if(!_['isNil'](queues[_0x58e90e[_0x025c('0x4')]])){if(!_['isNil'](queues[_0x58e90e[_0x025c('0x4')]]['musiconholdstartAt'])){utils[_0x025c('0x11')](util['format']('[%s][queues][musiconholdstop]',_0x58e90e[_0x025c('0x4')]),_0x58e90e);queues[_0x58e90e[_0x025c('0x4')]][_0x025c('0x5d')]+=utils[_0x025c('0x35')](utils[_0x025c('0x17')](),queues[_0x58e90e[_0x025c('0x4')]][_0x025c('0x61')]);utils[_0x025c('0x2')](util[_0x025c('0x12')](_0x025c('0x63'),_0x58e90e['uniqueid'],queues[_0x58e90e[_0x025c('0x4')]][_0x025c('0x21')],queues[_0x58e90e['uniqueid']][_0x025c('0x5d')]));delete queues[_0x58e90e[_0x025c('0x4')]][_0x025c('0x61')];}}}catch(_0x4b98a7){utils[_0x025c('0x18')](util[_0x025c('0x12')]('[%s][queues][musiconholdstop]',_0x58e90e['uniqueid']),_0x4b98a7);}}; \ No newline at end of file +var _0x15ab=['[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','ATTENDED','queuecallerenterreason','calleridname','queuecallerjoinAt','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','transfertargetuniqueid','clone','holdtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','queue','lastAssignedTo','calleridnum','then','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','now','[%s][queues][queuecallerjoin]','hangup','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','error','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','diffTime','count','[%s][queues][queuecallerleave]','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','accountcode','agentcomplete','transfer','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','BLIND','transferexten','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer'];(function(_0x702448,_0xcd1b15){var _0x47efea=function(_0x43742a){while(--_0x43742a){_0x702448['push'](_0x702448['shift']());}};_0x47efea(++_0xcd1b15);}(_0x15ab,0x154));var _0xb15a=function(_0x108e4d,_0x3b4c7b){_0x108e4d=_0x108e4d-0x0;var _0x2b6c23=_0x15ab[_0x108e4d];return _0x2b6c23;};'use strict';var _=require(_0xb15a('0x0'));var util=require('util');var utils=require(_0xb15a('0x1'));var queues={};function writeDB(_0x194916){utils[_0xb15a('0x2')](util[_0xb15a('0x3')](_0xb15a('0x4'),_0x194916['uniqueid'],_0x194916[_0xb15a('0x5')],_0x194916[_0xb15a('0x6')],_0x194916[_0xb15a('0x7')],_0x194916[_0xb15a('0x8')],_0x194916['accountcode'],_0x194916['queuecallerexitreason']));if(_0x194916[_0xb15a('0x6')]){utils['getVoiceQueueByName'](_0x194916[_0xb15a('0x6')])[_0xb15a('0x9')](function(_0x18b2dc){if(_0x18b2dc){_0x194916[_0xb15a('0xa')]=_0x18b2dc[_0xb15a('0xa')];}utils[_0xb15a('0xb')](_0xb15a('0xc'),_0x194916);});}else{utils[_0xb15a('0xb')](_0xb15a('0xc'),_0x194916);}if(_0x194916[_0xb15a('0xd')]){delete queues[_0x194916['transfereduniqueid']];}else{delete queues[_0x194916[_0xb15a('0xe')]];}}exports[_0xb15a('0xf')]=function(_0x7bed95){try{utils[_0xb15a('0x10')](util[_0xb15a('0x3')]('[%s][queues][queuecallerjoin]',_0x7bed95['uniqueid']),_0x7bed95);utils[_0xb15a('0x2')](util['format'](_0xb15a('0x11'),_0x7bed95[_0xb15a('0xe')],_0x7bed95[_0xb15a('0x6')],_0x7bed95['position']));queues[_0x7bed95['uniqueid']]=_[_0xb15a('0x12')](_0x7bed95,{'originalposition':_0x7bed95[_0xb15a('0x13')],'queuecallerjoinAt':utils[_0xb15a('0x14')](),'mohtime':0x0});}catch(_0x30f903){utils['error'](util[_0xb15a('0x3')](_0xb15a('0x15'),_0x7bed95['uniqueid']),_0x30f903);}};exports[_0xb15a('0x16')]=function(_0x45457e){try{if(!_[_0xb15a('0x17')](queues[_0x45457e[_0xb15a('0xe')]])){utils[_0xb15a('0x10')](util[_0xb15a('0x3')]('[%s][queues][hangup]',_0x45457e[_0xb15a('0xe')]),_0x45457e);if(queues[_0x45457e['uniqueid']][_0xb15a('0x18')]){if(!queues[_0x45457e['uniqueid']][_0xb15a('0x19')]&&!queues[_0x45457e[_0xb15a('0xe')]][_0xb15a('0x1a')]){queues[_0x45457e[_0xb15a('0xe')]][_0xb15a('0x1b')]=!![];queues[_0x45457e[_0xb15a('0xe')]][_0xb15a('0x1c')]=utils[_0xb15a('0x14')]();queues[_0x45457e[_0xb15a('0xe')]][_0xb15a('0x1d')]=_0xb15a('0x1e');}utils['info'](util[_0xb15a('0x3')](_0xb15a('0x1f'),_0x45457e[_0xb15a('0xe')],queues[_0x45457e[_0xb15a('0xe')]]['name'],queues[_0x45457e[_0xb15a('0xe')]][_0xb15a('0x1d')]));writeDB(queues[_0x45457e[_0xb15a('0xe')]]);}else if(queues[_0x45457e[_0xb15a('0xe')]][_0xb15a('0xd')]){utils['info'](util[_0xb15a('0x3')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x45457e[_0xb15a('0xe')],queues[_0x45457e[_0xb15a('0xe')]][_0xb15a('0x20')],queues[_0x45457e[_0xb15a('0xe')]]['transfereduniqueid']));queues[queues[_0x45457e[_0xb15a('0xe')]][_0xb15a('0xd')]]=queues[_0x45457e['uniqueid']];queues[queues[_0x45457e[_0xb15a('0xe')]][_0xb15a('0xd')]]['queuecallerenterreason']=0x2;delete queues[_0x45457e[_0xb15a('0xe')]];}}}catch(_0x5305dd){utils['error'](util[_0xb15a('0x3')](_0xb15a('0x21'),_0x45457e[_0xb15a('0xe')]),_0x5305dd);}};exports[_0xb15a('0x22')]=function(_0x512f64){try{utils[_0xb15a('0x10')](util['format'](_0xb15a('0x23'),_0x512f64[_0xb15a('0xe')]),_0x512f64);if(!_['isNil'](_0x512f64[_0xb15a('0x24')][_0xb15a('0x25')])&&_0x512f64[_0xb15a('0x26')][_0xb15a('0x27')]()!==_0xb15a('0x28')){if(!_[_0xb15a('0x17')](queues[_0x512f64[_0xb15a('0xe')]])){queues[_0x512f64[_0xb15a('0xe')]][_0xb15a('0x19')]=![];queues[_0x512f64['uniqueid']][_0xb15a('0x29')]=null;queues[_0x512f64[_0xb15a('0xe')]]['queuecallerexit']=!![];queues[_0x512f64[_0xb15a('0xe')]][_0xb15a('0x2a')]=utils['now']();queues[_0x512f64[_0xb15a('0xe')]][_0xb15a('0x1d')]=_0x512f64[_0xb15a('0x26')][_0xb15a('0x27')]();utils[_0xb15a('0x2')](util[_0xb15a('0x3')](_0xb15a('0x2b'),_0x512f64[_0xb15a('0xe')],queues[_0x512f64['uniqueid']]['name'],_0x512f64[_0xb15a('0x26')],queues[_0x512f64[_0xb15a('0xe')]][_0xb15a('0x1d')]));writeDB(queues[_0x512f64[_0xb15a('0xe')]]);}}else if(!_[_0xb15a('0x17')](_0x512f64['variable']['queueposition'])){if(!_[_0xb15a('0x17')](queues[_0x512f64[_0xb15a('0xe')]])&&!queues[_0x512f64[_0xb15a('0xe')]][_0xb15a('0x19')]){queues[_0x512f64[_0xb15a('0xe')]]['queuecallerabandon']=![];queues[_0x512f64['uniqueid']][_0xb15a('0x29')]=null;queues[_0x512f64[_0xb15a('0xe')]][_0xb15a('0x1a')]=!![];queues[_0x512f64['uniqueid']][_0xb15a('0x2a')]=utils[_0xb15a('0x14')]();queues[_0x512f64['uniqueid']][_0xb15a('0x1d')]=_0xb15a('0x2c');utils[_0xb15a('0x2')](util[_0xb15a('0x3')](_0xb15a('0x2d'),_0x512f64['uniqueid'],queues[_0x512f64[_0xb15a('0xe')]][_0xb15a('0x20')],_0x512f64[_0xb15a('0x26')],queues[_0x512f64[_0xb15a('0xe')]][_0xb15a('0x1d')]));}}}catch(_0x1fce96){utils[_0xb15a('0x2e')](util[_0xb15a('0x3')](_0xb15a('0x23'),_0x512f64['uniqueid']),_0x1fce96);}};exports[_0xb15a('0x19')]=function(_0x436ee1){try{if(!_[_0xb15a('0x17')](queues[_0x436ee1[_0xb15a('0xe')]])){utils[_0xb15a('0x10')](util[_0xb15a('0x3')](_0xb15a('0x2f'),_0x436ee1[_0xb15a('0xe')]),_0x436ee1);queues[_0x436ee1[_0xb15a('0xe')]][_0xb15a('0x1a')]=![];queues[_0x436ee1['uniqueid']][_0xb15a('0x2a')]=null;queues[_0x436ee1[_0xb15a('0xe')]][_0xb15a('0x19')]=!![];queues[_0x436ee1[_0xb15a('0xe')]][_0xb15a('0x29')]=utils[_0xb15a('0x14')]();queues[_0x436ee1[_0xb15a('0xe')]][_0xb15a('0x1d')]='ABANDONED';utils['info'](util[_0xb15a('0x3')](_0xb15a('0x30'),_0x436ee1['uniqueid'],queues[_0x436ee1[_0xb15a('0xe')]]['name'],queues[_0x436ee1[_0xb15a('0xe')]][_0xb15a('0x1d')]));}}catch(_0x4c0247){utils[_0xb15a('0x2e')](util[_0xb15a('0x3')](_0xb15a('0x2f'),_0x436ee1['uniqueid']),_0x4c0247);}};exports[_0xb15a('0x31')]=function(_0x2b7d91){try{if(!_['isNil'](queues[_0x2b7d91[_0xb15a('0xe')]])){utils[_0xb15a('0x10')](util[_0xb15a('0x3')]('[%s][queues][queuecallerleave]',_0x2b7d91['uniqueid']),_0x2b7d91);utils[_0xb15a('0x2')](util[_0xb15a('0x3')](_0xb15a('0x32'),_0x2b7d91[_0xb15a('0xe')],queues[_0x2b7d91[_0xb15a('0xe')]][_0xb15a('0x20')],_0x2b7d91[_0xb15a('0x33')],_0x2b7d91[_0xb15a('0x34')]));queues[_0x2b7d91[_0xb15a('0xe')]][_0xb15a('0x31')]=!![];queues[_0x2b7d91[_0xb15a('0xe')]]['queuecallerleaveAt']=utils[_0xb15a('0x14')]();queues[_0x2b7d91[_0xb15a('0xe')]]['holdtime']=utils[_0xb15a('0x35')](queues[_0x2b7d91[_0xb15a('0xe')]][_0xb15a('0x18')],queues[_0x2b7d91[_0xb15a('0xe')]]['queuecallerjoinAt']);queues[_0x2b7d91[_0xb15a('0xe')]][_0xb15a('0x13')]=_0x2b7d91[_0xb15a('0x13')];queues[_0x2b7d91['uniqueid']][_0xb15a('0x36')]=_0x2b7d91[_0xb15a('0x36')];queues[_0x2b7d91[_0xb15a('0xe')]][_0xb15a('0x33')]=_0x2b7d91[_0xb15a('0x33')];queues[_0x2b7d91[_0xb15a('0xe')]][_0xb15a('0x34')]=_0x2b7d91[_0xb15a('0x34')];}}catch(_0x2f8881){utils[_0xb15a('0x2e')](util[_0xb15a('0x3')](_0xb15a('0x37'),_0x2b7d91[_0xb15a('0xe')]),_0x2f8881);}};exports['agentconnect']=function(_0x1bbbc3){try{if(!_[_0xb15a('0x17')](queues[_0x1bbbc3['uniqueid']])){utils['debug'](util[_0xb15a('0x3')](_0xb15a('0x38'),_0x1bbbc3[_0xb15a('0xe')]),_0x1bbbc3);utils['info'](util[_0xb15a('0x3')](_0xb15a('0x39'),_0x1bbbc3[_0xb15a('0xe')],queues[_0x1bbbc3[_0xb15a('0xe')]][_0xb15a('0x20')],_0x1bbbc3[_0xb15a('0x3a')],_0x1bbbc3[_0xb15a('0x3b')]));queues[_0x1bbbc3[_0xb15a('0xe')]]['queuecallerabandon']=![];queues[_0x1bbbc3[_0xb15a('0xe')]][_0xb15a('0x19')]=![];queues[_0x1bbbc3[_0xb15a('0xe')]][_0xb15a('0x29')]=null;queues[_0x1bbbc3['uniqueid']][_0xb15a('0x1a')]=![];queues[_0x1bbbc3[_0xb15a('0xe')]][_0xb15a('0x1d')]=null;queues[_0x1bbbc3[_0xb15a('0xe')]][_0xb15a('0x2a')]=null;queues[_0x1bbbc3[_0xb15a('0xe')]][_0xb15a('0x3c')]=!![];queues[_0x1bbbc3[_0xb15a('0xe')]][_0xb15a('0x3d')]=_0x1bbbc3[_0xb15a('0x3b')];queues[_0x1bbbc3[_0xb15a('0xe')]][_0xb15a('0x7')]=_0x1bbbc3[_0xb15a('0x3a')];}}catch(_0xcdc496){utils[_0xb15a('0x2e')](util[_0xb15a('0x3')](_0xb15a('0x38'),_0x1bbbc3[_0xb15a('0xe')]),_0xcdc496);}};exports[_0xb15a('0x3e')]=function(_0x516f43){try{if(!_[_0xb15a('0x17')](queues[_0x516f43['uniqueid']])){if(queues[_0x516f43[_0xb15a('0xe')]][_0xb15a('0x18')]){utils[_0xb15a('0x10')](util[_0xb15a('0x3')]('[%s][queues][agentcomplete]',_0x516f43['uniqueid']),_0x516f43);queues[_0x516f43['uniqueid']][_0xb15a('0x19')]=![];queues[_0x516f43[_0xb15a('0xe')]][_0xb15a('0x19')]=![];queues[_0x516f43[_0xb15a('0xe')]][_0xb15a('0x29')]=null;queues[_0x516f43[_0xb15a('0xe')]][_0xb15a('0x1a')]=![];queues[_0x516f43[_0xb15a('0xe')]]['queuecallerexitAt']=null;queues[_0x516f43['uniqueid']][_0xb15a('0x3c')]=!![];queues[_0x516f43[_0xb15a('0xe')]][_0xb15a('0x7')]=_0x516f43['membername'];queues[_0x516f43[_0xb15a('0xe')]][_0xb15a('0x1b')]=!![];queues[_0x516f43[_0xb15a('0xe')]][_0xb15a('0x1c')]=utils['now']();if(_0x516f43['reason']==_0xb15a('0x3f')){if(!queues[_0x516f43['uniqueid']][_0xb15a('0x3f')]){queues[_0x516f43['uniqueid']][_0xb15a('0x1d')]=_0xb15a('0x40');}}else{queues[_0x516f43[_0xb15a('0xe')]]['queuecallerexitreason']='COMPLETEDBY'+_0x516f43['reason'][_0xb15a('0x27')]();}utils[_0xb15a('0x2')](util[_0xb15a('0x3')](_0xb15a('0x41'),_0x516f43[_0xb15a('0xe')],queues[_0x516f43[_0xb15a('0xe')]][_0xb15a('0x20')],_0x516f43[_0xb15a('0x3a')],queues[_0x516f43[_0xb15a('0xe')]]['queuecallerexitreason']));writeDB(queues[_0x516f43[_0xb15a('0xe')]]);}}}catch(_0x179c79){utils['error'](util['format'](_0xb15a('0x42'),_0x516f43[_0xb15a('0xe')]),_0x179c79);}};exports[_0xb15a('0x43')]=function(_0x2758b5){try{if(!_['isNil'](queues[_0x2758b5[_0xb15a('0x44')]])){utils[_0xb15a('0x10')](util[_0xb15a('0x3')](_0xb15a('0x45'),_0x2758b5[_0xb15a('0xe')]),_0x2758b5);queues[_0x2758b5[_0xb15a('0x44')]][_0xb15a('0x3f')]=!![];queues[_0x2758b5[_0xb15a('0x44')]]['transfertype']=_0xb15a('0x46');queues[_0x2758b5[_0xb15a('0x44')]][_0xb15a('0x47')]=_0x2758b5[_0xb15a('0x48')];queues[_0x2758b5[_0xb15a('0x44')]][_0xb15a('0x49')]=_0x2758b5[_0xb15a('0x44')];queues[_0x2758b5[_0xb15a('0x44')]][_0xb15a('0x1d')]='BLINDTRANSFER';utils[_0xb15a('0x2')](util[_0xb15a('0x3')](_0xb15a('0x4a'),_0x2758b5[_0xb15a('0xe')],queues[_0x2758b5[_0xb15a('0x44')]][_0xb15a('0x20')],_0x2758b5['transfereeuniqueid'],_0x2758b5['extension']));}}catch(_0x58b712){utils[_0xb15a('0x2e')](util[_0xb15a('0x3')](_0xb15a('0x45'),_0x2758b5[_0xb15a('0xe')]),_0x58b712);}};exports[_0xb15a('0x4b')]=function(_0x1574b9){try{utils[_0xb15a('0x10')](util[_0xb15a('0x3')](_0xb15a('0x4c'),_0x1574b9[_0xb15a('0x4d')]),_0x1574b9);if(_0x1574b9[_0xb15a('0x4d')]==_0x1574b9[_0xb15a('0x4e')]){if(!_[_0xb15a('0x17')](queues[_0x1574b9[_0xb15a('0x4f')]])){utils[_0xb15a('0x2')](util[_0xb15a('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x1574b9[_0xb15a('0x4d')],queues[_0x1574b9[_0xb15a('0x4f')]][_0xb15a('0x20')],_0x1574b9[_0xb15a('0x50')]));queues[_0x1574b9['secondtransfererlinkedid']][_0xb15a('0x3f')]=!![];queues[_0x1574b9[_0xb15a('0x4f')]]['transfertype']=_0xb15a('0x51');queues[_0x1574b9[_0xb15a('0x4f')]][_0xb15a('0x47')]=_0x1574b9[_0xb15a('0x50')];queues[_0x1574b9['secondtransfererlinkedid']][_0xb15a('0x49')]=_0x1574b9[_0xb15a('0x4d')];queues[_0x1574b9[_0xb15a('0x4f')]][_0xb15a('0x1d')]='ATTENDEDTRANSFER';}if(!_[_0xb15a('0x17')](queues[_0x1574b9[_0xb15a('0x4e')]])){if(_0x1574b9['transfereelinkedid']&&queues[_0x1574b9['transfereelinkedid']]){queues[_0x1574b9['transfereelinkedid']][_0xb15a('0x52')]=0x1;queues[_0x1574b9[_0xb15a('0x44')]]=_['clone'](queues[_0x1574b9['transfereelinkedid']]);queues[_0x1574b9[_0xb15a('0x44')]]['transfereduniqueid']=_0x1574b9['transfertargetuniqueid'];queues[_0x1574b9['transfereeuniqueid']][_0xb15a('0x52')]=0x2;queues[_0x1574b9[_0xb15a('0x44')]]['calleridnum']=queues[_0x1574b9[_0xb15a('0x4f')]][_0xb15a('0x8')];queues[_0x1574b9['transfereeuniqueid']][_0xb15a('0x53')]=queues[_0x1574b9[_0xb15a('0x4f')]][_0xb15a('0x53')];queues[_0x1574b9[_0xb15a('0x44')]][_0xb15a('0x54')]=utils[_0xb15a('0x14')]();queues[_0x1574b9[_0xb15a('0x44')]][_0xb15a('0x18')]=utils['now']();queues[_0x1574b9[_0xb15a('0x44')]]['holdtime']=0x0;queues[_0x1574b9['transfereeuniqueid']][_0xb15a('0x55')]=0x0;utils['info'](util[_0xb15a('0x3')](_0xb15a('0x56'),_0x1574b9[_0xb15a('0x4d')],queues[_0x1574b9[_0xb15a('0x44')]]['name'],queues[_0x1574b9[_0xb15a('0x44')]][_0xb15a('0x8')],queues[_0x1574b9[_0xb15a('0x44')]]['calleridname']));}else{utils['info'](util[_0xb15a('0x3')](_0xb15a('0x57'),_0x1574b9['origtransfereruniqueid'],queues[_0x1574b9[_0xb15a('0x4e')]][_0xb15a('0x20')],_0x1574b9[_0xb15a('0x4f')]));queues[_0x1574b9[_0xb15a('0x4e')]][_0xb15a('0xd')]=_0x1574b9[_0xb15a('0x4f')];}}}else if(_0x1574b9[_0xb15a('0x58')]==_0x1574b9[_0xb15a('0x4f')]){if(!_[_0xb15a('0x17')](queues[_0x1574b9[_0xb15a('0x4e')]])){utils[_0xb15a('0x2')](util[_0xb15a('0x3')](_0xb15a('0x59'),_0x1574b9[_0xb15a('0x4d')],queues[_0x1574b9[_0xb15a('0x4e')]][_0xb15a('0x20')],_0x1574b9[_0xb15a('0x58')],_0x1574b9[_0xb15a('0x5a')]));queues[_0x1574b9[_0xb15a('0x4e')]]['transfer']=!![];queues[_0x1574b9[_0xb15a('0x4e')]]['transfertype']='ATTENDED';queues[_0x1574b9[_0xb15a('0x4e')]][_0xb15a('0x47')]=_0x1574b9['secondtransfererexten'];queues[_0x1574b9[_0xb15a('0x4e')]][_0xb15a('0x49')]=_0x1574b9[_0xb15a('0x58')];queues[_0x1574b9['origtransfererlinkedid']][_0xb15a('0x1d')]=_0xb15a('0x5b');}if(!_[_0xb15a('0x17')](queues[_0x1574b9[_0xb15a('0x4f')]])){if(_0x1574b9['transfertargetlinkedid']&&queues[_0x1574b9[_0xb15a('0x5c')]]){queues[_0x1574b9[_0xb15a('0x5c')]][_0xb15a('0x52')]=0x1;queues[_0x1574b9[_0xb15a('0x5d')]]=_[_0xb15a('0x5e')](queues[_0x1574b9[_0xb15a('0x5c')]]);queues[_0x1574b9['transfertargetuniqueid']]['transfereduniqueid']=_0x1574b9[_0xb15a('0x5d')];queues[_0x1574b9[_0xb15a('0x5d')]][_0xb15a('0x52')]=0x2;queues[_0x1574b9[_0xb15a('0x5d')]][_0xb15a('0x8')]=queues[_0x1574b9[_0xb15a('0x4e')]][_0xb15a('0x8')];queues[_0x1574b9['transfertargetuniqueid']][_0xb15a('0x53')]=queues[_0x1574b9['origtransfererlinkedid']][_0xb15a('0x53')];queues[_0x1574b9[_0xb15a('0x5d')]][_0xb15a('0x54')]=utils[_0xb15a('0x14')]();queues[_0x1574b9['transfertargetuniqueid']]['queuecallerleaveAt']=utils['now']();queues[_0x1574b9[_0xb15a('0x5d')]][_0xb15a('0x5f')]=0x0;queues[_0x1574b9['transfertargetuniqueid']][_0xb15a('0x55')]=0x0;utils[_0xb15a('0x2')](util[_0xb15a('0x3')](_0xb15a('0x60'),_0x1574b9[_0xb15a('0x4d')],queues[_0x1574b9['transfertargetuniqueid']][_0xb15a('0x20')],queues[_0x1574b9[_0xb15a('0x5d')]]['transfereduniqueid'],queues[_0x1574b9[_0xb15a('0x5d')]][_0xb15a('0x8')],queues[_0x1574b9['transfertargetuniqueid']][_0xb15a('0x53')]));}else{utils[_0xb15a('0x2')](util[_0xb15a('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x1574b9[_0xb15a('0x4d')],queues[_0x1574b9[_0xb15a('0x4f')]][_0xb15a('0x20')],_0x1574b9[_0xb15a('0x4e')]));queues[_0x1574b9['secondtransfererlinkedid']]['transfereduniqueid']=_0x1574b9[_0xb15a('0x4e')];}}}}catch(_0x547e5f){utils['error'](util['format'](_0xb15a('0x4c'),_0x1574b9[_0xb15a('0x4d')]),_0x547e5f);}};exports[_0xb15a('0x61')]=function(_0x1ef43c){try{if(!_[_0xb15a('0x17')](queues[_0x1ef43c[_0xb15a('0xe')]])){utils[_0xb15a('0x10')](util[_0xb15a('0x3')](_0xb15a('0x62'),_0x1ef43c['uniqueid']),_0x1ef43c);queues[_0x1ef43c[_0xb15a('0xe')]][_0xb15a('0x63')]=utils[_0xb15a('0x14')]();utils['info'](util[_0xb15a('0x3')](_0xb15a('0x64'),_0x1ef43c['uniqueid'],queues[_0x1ef43c[_0xb15a('0xe')]][_0xb15a('0x20')],queues[_0x1ef43c['uniqueid']][_0xb15a('0x63')]));}}catch(_0x2628f8){utils[_0xb15a('0x2e')](util[_0xb15a('0x3')](_0xb15a('0x62'),_0x1ef43c[_0xb15a('0xe')]),_0x2628f8);}};exports[_0xb15a('0x65')]=function(_0x5b557f){try{if(!_[_0xb15a('0x17')](queues[_0x5b557f[_0xb15a('0xe')]])){if(!_[_0xb15a('0x17')](queues[_0x5b557f[_0xb15a('0xe')]][_0xb15a('0x63')])){utils['debug'](util['format'](_0xb15a('0x66'),_0x5b557f[_0xb15a('0xe')]),_0x5b557f);queues[_0x5b557f[_0xb15a('0xe')]]['mohtime']+=utils[_0xb15a('0x35')](utils[_0xb15a('0x14')](),queues[_0x5b557f['uniqueid']]['musiconholdstartAt']);utils[_0xb15a('0x2')](util[_0xb15a('0x3')](_0xb15a('0x67'),_0x5b557f[_0xb15a('0xe')],queues[_0x5b557f[_0xb15a('0xe')]][_0xb15a('0x20')],queues[_0x5b557f[_0xb15a('0xe')]]['mohtime']));delete queues[_0x5b557f[_0xb15a('0xe')]][_0xb15a('0x63')];}}}catch(_0x3cebd1){utils[_0xb15a('0x2e')](util[_0xb15a('0x3')](_0xb15a('0x66'),_0x5b557f['uniqueid']),_0x3cebd1);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 132daff..228c353 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 _0x929a=['[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','debug','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','type','connectedlinename','clone','newexten','[%s][recordings][newexten]','appdata','application','toLowerCase','set','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereruniqueid','recording','[%s][recordings][blindtransfer]','util','./utils','./transfers.controller','info','[%s][recordings][writeDB]','uniqueid','transfereeuniqueid','accountcode','getUserByInternal','then','membername','CreateVoiceRecording','request','blinds','newchannel','format','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','channel','error','[%s][recordings][newchannel]','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','linkedid','transfer'];(function(_0x120a39,_0x3ce876){var _0x580f66=function(_0x4668d9){while(--_0x4668d9){_0x120a39['push'](_0x120a39['shift']());}};_0x580f66(++_0x3ce876);}(_0x929a,0x138));var _0xa929=function(_0x5d6973,_0x225d62){_0x5d6973=_0x5d6973-0x0;var _0x2474be=_0x929a[_0x5d6973];return _0x2474be;};'use strict';var _=require('lodash');var util=require(_0xa929('0x0'));var utils=require(_0xa929('0x1'));var transfers=require(_0xa929('0x2'));var recordings={};function writeDB(_0x1fdb2a){var _0x4bc5d4;utils[_0xa929('0x3')](util['format'](_0xa929('0x4'),_0x1fdb2a['uniqueid']));if(transfers['blinds'][_0x1fdb2a[_0xa929('0x5')]]){_0x4bc5d4=_0x1fdb2a['uniqueid'];_0x1fdb2a[_0xa929('0x5')]=transfers['blinds'][_0x1fdb2a[_0xa929('0x5')]][_0xa929('0x6')];}if(_0x1fdb2a[_0xa929('0x7')]){utils[_0xa929('0x8')](_0x1fdb2a[_0xa929('0x7')])[_0xa929('0x9')](function(_0xe2e065){if(_0xe2e065){_0x1fdb2a[_0xa929('0xa')]=_0xe2e065['name'];_0x1fdb2a['UserId']=_0xe2e065['id'];}utils['request'](_0xa929('0xb'),_0x1fdb2a);});}else{utils[_0xa929('0xc')]('CreateVoiceRecording',_0x1fdb2a);}if(_0x4bc5d4)delete transfers[_0xa929('0xd')][_0x4bc5d4];}exports[_0xa929('0xe')]=function(_0x5c4bdf){try{utils['debug'](util[_0xa929('0xf')]('[%s][recordings][newchannel]',_0x5c4bdf[_0xa929('0x5')]),_0x5c4bdf);if(_0x5c4bdf['uniqueid']==_0x5c4bdf['linkedid']){utils[_0xa929('0x3')](util[_0xa929('0xf')](_0xa929('0x10'),_0x5c4bdf['uniqueid'],_0x5c4bdf[_0xa929('0x11')],_0x5c4bdf['exten']));recordings[_0x5c4bdf[_0xa929('0x5')]]={'uniqueid':_0x5c4bdf[_0xa929('0x5')],'accountcode':_0x5c4bdf['accountcode'],'exten':_0x5c4bdf['exten'],'context':_0x5c4bdf[_0xa929('0x11')],'channel':_0x5c4bdf[_0xa929('0x12')],'monitors':[]};}}catch(_0x2dcd83){utils[_0xa929('0x13')](util[_0xa929('0xf')](_0xa929('0x14'),_0x5c4bdf[_0xa929('0x5')]),_0x2dcd83);}};exports[_0xa929('0x15')]=function(_0x3ef02a){try{utils['debug'](util[_0xa929('0xf')](_0xa929('0x16'),_0x3ef02a[_0xa929('0x5')]),_0x3ef02a);if(!_[_0xa929('0x17')](recordings[_0x3ef02a[_0xa929('0x5')]])&&_0x3ef02a[_0xa929('0x18')]==0x6){utils['info'](util['format'](_0xa929('0x19'),_0x3ef02a['uniqueid'],_0x3ef02a[_0xa929('0x11')],_0x3ef02a[_0xa929('0x12')]));}else if(!_[_0xa929('0x17')](recordings[_0x3ef02a[_0xa929('0x1a')]])&&_0x3ef02a['channelstate']==0x6&&_0x3ef02a[_0xa929('0x11')]!=_0xa929('0x1b')){utils[_0xa929('0x3')](util[_0xa929('0xf')](_0xa929('0x1c'),_0x3ef02a[_0xa929('0x5')],_0x3ef02a[_0xa929('0x1a')],_0x3ef02a[_0xa929('0x11')],_0x3ef02a[_0xa929('0x12')]));recordings[_0x3ef02a[_0xa929('0x1a')]]['accountcode']=_0x3ef02a[_0xa929('0x7')];}}catch(_0x92a613){utils['error'](util[_0xa929('0xf')](_0xa929('0x16'),_0x3ef02a[_0xa929('0x5')]),_0x92a613);}};exports[_0xa929('0x1d')]=function(_0x4a33a1){try{if(!_[_0xa929('0x17')](_0x4a33a1[_0xa929('0x1e')])&&!_[_0xa929('0x17')](_0x4a33a1[_0xa929('0x1e')]['mixmonitor_filename'])){utils[_0xa929('0x1f')](util[_0xa929('0xf')]('[%s][recordings][varset]',_0x4a33a1[_0xa929('0x5')]),_0x4a33a1);utils[_0xa929('0x3')](util[_0xa929('0xf')](_0xa929('0x20'),_0x4a33a1[_0xa929('0x5')],_0x4a33a1['variable'],_0x4a33a1[_0xa929('0x21')]));if(_['endsWith'](_0x4a33a1[_0xa929('0x21')],'.wav49')){_0x4a33a1[_0xa929('0x21')]=_0x4a33a1[_0xa929('0x21')]['replace'](_0xa929('0x22'),_0xa929('0x23'));}if(recordings[_0x4a33a1[_0xa929('0x1a')]]){var _0x5ed277=_[_0xa929('0x24')](recordings[_0x4a33a1[_0xa929('0x1a')]][_0xa929('0x25')],{'value':_0x4a33a1[_0xa929('0x21')]});if(_[_0xa929('0x17')](_0x5ed277)){recordings[_0x4a33a1[_0xa929('0x1a')]][_0xa929('0x25')][_0xa929('0x26')]({'value':_0x4a33a1['value']});}}}}catch(_0x3323db){utils[_0xa929('0x13')](util[_0xa929('0xf')]('[%s][recordings][varset]',_0x4a33a1[_0xa929('0x5')]),_0x3323db);}};exports[_0xa929('0x27')]=function(_0x3349f3){try{if(!_[_0xa929('0x17')](recordings[_0x3349f3[_0xa929('0x5')]])){utils[_0xa929('0x1f')](util['format'](_0xa929('0x28'),_0x3349f3[_0xa929('0x5')]),_0x3349f3);utils[_0xa929('0x3')](util[_0xa929('0xf')](_0xa929('0x29'),_0x3349f3['uniqueid'],_0x3349f3[_0xa929('0x2a')],_0x3349f3[_0xa929('0x2b')],_0x3349f3[_0xa929('0x2c')]));recordings[_0x3349f3[_0xa929('0x5')]][_0xa929('0x2a')]=_0x3349f3[_0xa929('0x2a')];recordings[_0x3349f3[_0xa929('0x5')]][_0xa929('0x2b')]=_0x3349f3[_0xa929('0x2b')];recordings[_0x3349f3[_0xa929('0x5')]][_0xa929('0x2d')]=_0x3349f3[_0xa929('0x2d')];recordings[_0x3349f3[_0xa929('0x5')]]['connectedlinename']=_0x3349f3['connectedlinename'];if(recordings[_0x3349f3[_0xa929('0x5')]][_0xa929('0x2e')]=='outbound'&&recordings[_0x3349f3[_0xa929('0x5')]][_0xa929('0x7')]){recordings[_0x3349f3[_0xa929('0x5')]][_0xa929('0x2d')]=recordings[_0x3349f3[_0xa929('0x5')]][_0xa929('0x7')];recordings[_0x3349f3['uniqueid']][_0xa929('0x2f')]='';}recordings[_0x3349f3[_0xa929('0x5')]][_0xa929('0x25')]['forEach'](function(_0x3f0eda){var _0x139b63=_[_0xa929('0x30')](recordings[_0x3349f3[_0xa929('0x5')]]);_0x139b63[_0xa929('0x21')]=_0x3f0eda['value'];writeDB(_0x139b63);});delete recordings[_0x3349f3[_0xa929('0x5')]];}}catch(_0x231323){utils['error'](util[_0xa929('0xf')]('[%s][recordings][hangup]',_0x3349f3['uniqueid']),_0x231323);}};exports[_0xa929('0x31')]=function(_0x36fad9){try{if(!_[_0xa929('0x17')](recordings[_0x36fad9[_0xa929('0x5')]])){utils[_0xa929('0x1f')](util[_0xa929('0xf')](_0xa929('0x32'),_0x36fad9[_0xa929('0x5')]),_0x36fad9);utils[_0xa929('0x3')](util[_0xa929('0xf')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x36fad9[_0xa929('0x5')],_0x36fad9['application'],_0x36fad9[_0xa929('0x33')]));if(_0x36fad9[_0xa929('0x34')][_0xa929('0x35')]()==_0xa929('0x36')&&_['startsWith'](_0x36fad9[_0xa929('0x33')][_0xa929('0x35')](),_0xa929('0x37'))){var _0x37948f=_0x36fad9[_0xa929('0x33')][_0xa929('0x38')]('=');var _0x39b282=_0x37948f[0x0][_0xa929('0x39')](_0x37948f[0x0][_0xa929('0x3a')]('(')+0x1,_0x37948f[0x0][_0xa929('0x3a')](')'));var _0x585914=_0x37948f[0x1];recordings[_0x36fad9[_0xa929('0x5')]][_0x39b282]=_0x585914;}}}catch(_0x2c86ba){utils[_0xa929('0x13')](util['format'](_0xa929('0x32'),_0x36fad9[_0xa929('0x5')]),_0x2c86ba);}};exports[_0xa929('0x3b')]=function(_0x5544d9){try{if(!_[_0xa929('0x17')](recordings[_0x5544d9[_0xa929('0x5')]])){utils[_0xa929('0x1f')](util['format'](_0xa929('0x3c'),_0x5544d9['uniqueid']),_0x5544d9);utils[_0xa929('0x3')](util[_0xa929('0xf')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x5544d9[_0xa929('0x5')],_0x5544d9[_0xa929('0x3d')]));recordings[_0x5544d9[_0xa929('0x5')]][_0xa929('0x3d')]=_0x5544d9[_0xa929('0x3d')];}}catch(_0x5af432){utils[_0xa929('0x13')](util['format'](_0xa929('0x3c'),_0x5544d9[_0xa929('0x5')]),_0x5af432);}};exports['blindtransfer']=function(_0x18ca06){try{utils['debug'](util[_0xa929('0xf')]('[%s][recordings][blindtransfer]',_0x18ca06[_0xa929('0x5')]),_0x18ca06);utils[_0xa929('0x3')](util['format'](_0xa929('0x3e'),_0x18ca06[_0xa929('0x5')],_0x18ca06[_0xa929('0x3f')],_0x18ca06[_0xa929('0x40')],_0x18ca06['transfereecalleridnum'],_0x18ca06['transfereecalleridname']));if(recordings[_0x18ca06[_0xa929('0x41')]]&&transfers[_0xa929('0xd')][_0x18ca06[_0xa929('0x41')]]){transfers['blinds'][_0x18ca06['transfereruniqueid']][_0xa929('0x42')]=!![];}}catch(_0x4b5c1c){utils[_0xa929('0x13')](util[_0xa929('0xf')](_0xa929('0x43'),_0x18ca06[_0xa929('0x5')]),_0x4b5c1c);}}; \ No newline at end of file +var _0xce55=['[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','startsWith','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','lodash','util','./utils','./transfers.controller','info','format','uniqueid','blinds','transfereeuniqueid','accountcode','then','membername','name','UserId','request','CreateVoiceRecording','debug','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','replace','.wav49','find','monitors','push','[%s][recordings][varset]','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','newexten','[%s][recordings][newexten]'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xce55,0xeb));var _0x5ce5=function(_0x5f3562,_0x212f41){_0x5f3562=_0x5f3562-0x0;var _0x1b39b4=_0xce55[_0x5f3562];return _0x1b39b4;};'use strict';var _=require(_0x5ce5('0x0'));var util=require(_0x5ce5('0x1'));var utils=require(_0x5ce5('0x2'));var transfers=require(_0x5ce5('0x3'));var recordings={};function writeDB(_0x22b308){var _0x447202;utils[_0x5ce5('0x4')](util[_0x5ce5('0x5')]('[%s][recordings][writeDB]',_0x22b308[_0x5ce5('0x6')]));if(transfers[_0x5ce5('0x7')][_0x22b308[_0x5ce5('0x6')]]){_0x447202=_0x22b308[_0x5ce5('0x6')];_0x22b308[_0x5ce5('0x6')]=transfers[_0x5ce5('0x7')][_0x22b308['uniqueid']][_0x5ce5('0x8')];}if(_0x22b308[_0x5ce5('0x9')]){utils['getUserByInternal'](_0x22b308[_0x5ce5('0x9')])[_0x5ce5('0xa')](function(_0x56c1d2){if(_0x56c1d2){_0x22b308[_0x5ce5('0xb')]=_0x56c1d2[_0x5ce5('0xc')];_0x22b308[_0x5ce5('0xd')]=_0x56c1d2['id'];}utils[_0x5ce5('0xe')](_0x5ce5('0xf'),_0x22b308);});}else{utils[_0x5ce5('0xe')](_0x5ce5('0xf'),_0x22b308);}if(_0x447202)delete transfers[_0x5ce5('0x7')][_0x447202];}exports['newchannel']=function(_0x14a11c){try{utils[_0x5ce5('0x10')](util[_0x5ce5('0x5')]('[%s][recordings][newchannel]',_0x14a11c[_0x5ce5('0x6')]),_0x14a11c);if(_0x14a11c[_0x5ce5('0x6')]==_0x14a11c[_0x5ce5('0x11')]){utils['info'](util[_0x5ce5('0x5')](_0x5ce5('0x12'),_0x14a11c[_0x5ce5('0x6')],_0x14a11c[_0x5ce5('0x13')],_0x14a11c[_0x5ce5('0x14')]));recordings[_0x14a11c[_0x5ce5('0x6')]]={'uniqueid':_0x14a11c['uniqueid'],'accountcode':_0x14a11c['accountcode'],'exten':_0x14a11c['exten'],'context':_0x14a11c[_0x5ce5('0x13')],'channel':_0x14a11c[_0x5ce5('0x15')],'monitors':[]};}}catch(_0x1e05fd){utils[_0x5ce5('0x16')](util[_0x5ce5('0x5')]('[%s][recordings][newchannel]',_0x14a11c['uniqueid']),_0x1e05fd);}};exports[_0x5ce5('0x17')]=function(_0x44b9d4){try{utils['debug'](util[_0x5ce5('0x5')](_0x5ce5('0x18'),_0x44b9d4[_0x5ce5('0x6')]),_0x44b9d4);if(!_['isNil'](recordings[_0x44b9d4['uniqueid']])&&_0x44b9d4[_0x5ce5('0x19')]==0x6){utils[_0x5ce5('0x4')](util[_0x5ce5('0x5')](_0x5ce5('0x1a'),_0x44b9d4[_0x5ce5('0x6')],_0x44b9d4[_0x5ce5('0x13')],_0x44b9d4[_0x5ce5('0x15')]));}else if(!_[_0x5ce5('0x1b')](recordings[_0x44b9d4['linkedid']])&&_0x44b9d4[_0x5ce5('0x19')]==0x6&&_0x44b9d4[_0x5ce5('0x13')]!='transfer'){utils[_0x5ce5('0x4')](util[_0x5ce5('0x5')](_0x5ce5('0x1c'),_0x44b9d4['uniqueid'],_0x44b9d4[_0x5ce5('0x11')],_0x44b9d4['context'],_0x44b9d4[_0x5ce5('0x15')]));recordings[_0x44b9d4[_0x5ce5('0x11')]][_0x5ce5('0x9')]=_0x44b9d4[_0x5ce5('0x9')];}}catch(_0x483dd9){utils[_0x5ce5('0x16')](util[_0x5ce5('0x5')](_0x5ce5('0x18'),_0x44b9d4[_0x5ce5('0x6')]),_0x483dd9);}};exports[_0x5ce5('0x1d')]=function(_0x368a28){try{if(!_[_0x5ce5('0x1b')](_0x368a28[_0x5ce5('0x1e')])&&!_['isNil'](_0x368a28[_0x5ce5('0x1e')][_0x5ce5('0x1f')])){utils[_0x5ce5('0x10')](util[_0x5ce5('0x5')]('[%s][recordings][varset]',_0x368a28['uniqueid']),_0x368a28);utils[_0x5ce5('0x4')](util[_0x5ce5('0x5')](_0x5ce5('0x20'),_0x368a28['uniqueid'],_0x368a28['variable'],_0x368a28[_0x5ce5('0x21')]));if(_['endsWith'](_0x368a28['value'],'.wav49')){_0x368a28[_0x5ce5('0x21')]=_0x368a28[_0x5ce5('0x21')][_0x5ce5('0x22')](_0x5ce5('0x23'),'.WAV');}if(recordings[_0x368a28[_0x5ce5('0x11')]]){var _0x363d76=_[_0x5ce5('0x24')](recordings[_0x368a28[_0x5ce5('0x11')]][_0x5ce5('0x25')],{'value':_0x368a28['value']});if(_[_0x5ce5('0x1b')](_0x363d76)){recordings[_0x368a28['linkedid']][_0x5ce5('0x25')][_0x5ce5('0x26')]({'value':_0x368a28['value']});}}}}catch(_0x67de56){utils['error'](util[_0x5ce5('0x5')](_0x5ce5('0x27'),_0x368a28[_0x5ce5('0x6')]),_0x67de56);}};exports[_0x5ce5('0x28')]=function(_0x9dcfb9){try{if(!_['isNil'](recordings[_0x9dcfb9[_0x5ce5('0x6')]])){utils['debug'](util[_0x5ce5('0x5')](_0x5ce5('0x29'),_0x9dcfb9['uniqueid']),_0x9dcfb9);utils[_0x5ce5('0x4')](util[_0x5ce5('0x5')](_0x5ce5('0x2a'),_0x9dcfb9[_0x5ce5('0x6')],_0x9dcfb9[_0x5ce5('0x2b')],_0x9dcfb9['calleridname'],_0x9dcfb9[_0x5ce5('0x2c')]));recordings[_0x9dcfb9['uniqueid']][_0x5ce5('0x2b')]=_0x9dcfb9['calleridnum'];recordings[_0x9dcfb9[_0x5ce5('0x6')]][_0x5ce5('0x2d')]=_0x9dcfb9[_0x5ce5('0x2d')];recordings[_0x9dcfb9[_0x5ce5('0x6')]][_0x5ce5('0x2e')]=_0x9dcfb9[_0x5ce5('0x2e')];recordings[_0x9dcfb9[_0x5ce5('0x6')]][_0x5ce5('0x2f')]=_0x9dcfb9['connectedlinename'];if(recordings[_0x9dcfb9[_0x5ce5('0x6')]][_0x5ce5('0x30')]==_0x5ce5('0x31')&&recordings[_0x9dcfb9[_0x5ce5('0x6')]]['accountcode']){recordings[_0x9dcfb9[_0x5ce5('0x6')]][_0x5ce5('0x2e')]=recordings[_0x9dcfb9[_0x5ce5('0x6')]][_0x5ce5('0x9')];recordings[_0x9dcfb9[_0x5ce5('0x6')]][_0x5ce5('0x2f')]='';}recordings[_0x9dcfb9[_0x5ce5('0x6')]][_0x5ce5('0x25')][_0x5ce5('0x32')](function(_0x44ee02){var _0xc08a80=_['clone'](recordings[_0x9dcfb9[_0x5ce5('0x6')]]);_0xc08a80[_0x5ce5('0x21')]=_0x44ee02[_0x5ce5('0x21')];writeDB(_0xc08a80);});delete recordings[_0x9dcfb9['uniqueid']];}}catch(_0x4863f3){utils[_0x5ce5('0x16')](util[_0x5ce5('0x5')](_0x5ce5('0x29'),_0x9dcfb9[_0x5ce5('0x6')]),_0x4863f3);}};exports[_0x5ce5('0x33')]=function(_0x59751a){try{if(!_[_0x5ce5('0x1b')](recordings[_0x59751a[_0x5ce5('0x6')]])){utils[_0x5ce5('0x10')](util[_0x5ce5('0x5')](_0x5ce5('0x34'),_0x59751a['uniqueid']),_0x59751a);utils[_0x5ce5('0x4')](util[_0x5ce5('0x5')](_0x5ce5('0x35'),_0x59751a[_0x5ce5('0x6')],_0x59751a['application'],_0x59751a[_0x5ce5('0x36')]));if(_0x59751a[_0x5ce5('0x37')][_0x5ce5('0x38')]()=='set'&&_[_0x5ce5('0x39')](_0x59751a['appdata'][_0x5ce5('0x38')](),'cdr')){var _0x1444b3=_0x59751a[_0x5ce5('0x36')][_0x5ce5('0x3a')]('=');var _0x441a09=_0x1444b3[0x0]['substring'](_0x1444b3[0x0][_0x5ce5('0x3b')]('(')+0x1,_0x1444b3[0x0]['lastIndexOf'](')'));var _0x45553f=_0x1444b3[0x1];recordings[_0x59751a[_0x5ce5('0x6')]][_0x441a09]=_0x45553f;}}}catch(_0xd01aae){utils[_0x5ce5('0x16')](util[_0x5ce5('0x5')]('[%s][recordings][newexten]',_0x59751a[_0x5ce5('0x6')]),_0xd01aae);}};exports[_0x5ce5('0x3c')]=function(_0x2cd8e5){try{if(!_[_0x5ce5('0x1b')](recordings[_0x2cd8e5[_0x5ce5('0x6')]])){utils[_0x5ce5('0x10')](util[_0x5ce5('0x5')](_0x5ce5('0x3d'),_0x2cd8e5[_0x5ce5('0x6')]),_0x2cd8e5);utils[_0x5ce5('0x4')](util[_0x5ce5('0x5')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x2cd8e5[_0x5ce5('0x6')],_0x2cd8e5[_0x5ce5('0x3e')]));recordings[_0x2cd8e5[_0x5ce5('0x6')]][_0x5ce5('0x3e')]=_0x2cd8e5[_0x5ce5('0x3e')];}}catch(_0x52c728){utils[_0x5ce5('0x16')](util[_0x5ce5('0x5')](_0x5ce5('0x3d'),_0x2cd8e5['uniqueid']),_0x52c728);}};exports[_0x5ce5('0x3f')]=function(_0x120dcd){try{utils[_0x5ce5('0x10')](util[_0x5ce5('0x5')](_0x5ce5('0x40'),_0x120dcd[_0x5ce5('0x6')]),_0x120dcd);utils[_0x5ce5('0x4')](util[_0x5ce5('0x5')](_0x5ce5('0x41'),_0x120dcd[_0x5ce5('0x6')],_0x120dcd[_0x5ce5('0x42')],_0x120dcd[_0x5ce5('0x43')],_0x120dcd[_0x5ce5('0x44')],_0x120dcd[_0x5ce5('0x45')]));if(recordings[_0x120dcd[_0x5ce5('0x46')]]&&transfers[_0x5ce5('0x7')][_0x120dcd[_0x5ce5('0x46')]]){transfers[_0x5ce5('0x7')][_0x120dcd['transfereruniqueid']][_0x5ce5('0x47')]=!![];}}catch(_0xd049ce){utils[_0x5ce5('0x16')](util[_0x5ce5('0x5')](_0x5ce5('0x40'),_0x120dcd[_0x5ce5('0x6')]),_0xd049ce);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 4688b0c..13068ef 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 _0x6b86=['transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','type','attended','uniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','format','[%s][transfers][blindtransfer]','transferercalleridnum','transfereecalleridname','blind','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid','info','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererexten','isNil','transfereechannel','assign'];(function(_0x1ebc6c,_0x58a00b){var _0x3a826d=function(_0x27d7eb){while(--_0x27d7eb){_0x1ebc6c['push'](_0x1ebc6c['shift']());}};_0x3a826d(++_0x58a00b);}(_0x6b86,0xf1));var _0x66b8=function(_0x1f6513,_0x5cf63f){_0x1f6513=_0x1f6513-0x0;var _0x501bb5=_0x6b86[_0x1f6513];return _0x501bb5;};'use strict';var _=require(_0x66b8('0x0'));var util=require('util');var utils=require('./utils');function writeDB(_0x1d248e){utils['info'](util['format']('[%s][transfers][writeDB]\x20type:%s',_0x1d248e[_0x66b8('0x1')]===_0x66b8('0x2')?_0x1d248e['origtransfereruniqueid']:_0x1d248e[_0x66b8('0x3')],_0x1d248e[_0x66b8('0x1')]));utils[_0x66b8('0x4')](_0x66b8('0x5'),_0x1d248e);}exports[_0x66b8('0x6')]={};exports[_0x66b8('0x7')]=function(_0x40fd3a){try{utils['debug'](util[_0x66b8('0x8')](_0x66b8('0x9'),_0x40fd3a[_0x66b8('0x3')]),_0x40fd3a);utils['info'](util[_0x66b8('0x8')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x40fd3a[_0x66b8('0x3')],_0x40fd3a[_0x66b8('0xa')],_0x40fd3a['transferercalleridname'],_0x40fd3a['transfereecalleridnum'],_0x40fd3a[_0x66b8('0xb')]));_0x40fd3a[_0x66b8('0x1')]=_0x66b8('0xc');exports['blinds'][_0x40fd3a[_0x66b8('0xd')]]=_0x40fd3a;writeDB(_0x40fd3a);}catch(_0x503856){utils[_0x66b8('0xe')](util[_0x66b8('0x8')](_0x66b8('0x9'),_0x40fd3a[_0x66b8('0x3')]),_0x503856);}};exports[_0x66b8('0xf')]=function(_0x395903){try{utils['debug'](util[_0x66b8('0x8')](_0x66b8('0x10'),_0x395903[_0x66b8('0x11')]),_0x395903);utils[_0x66b8('0x12')](util['format'](_0x66b8('0x13'),_0x395903[_0x66b8('0x11')],_0x395903[_0x66b8('0x14')],_0x395903[_0x66b8('0x15')],_0x395903[_0x66b8('0x16')],_0x395903[_0x66b8('0x17')]));_0x395903=_['assign'](_0x395903,{'transfererchannel':_0x395903['origtransfererchannel'],'transferercalleridnum':_0x395903['origtransferercalleridnum'],'transferercalleridname':_0x395903['origtransferercalleridname'],'transfererconnectedlinenum':_0x395903[_0x66b8('0x18')],'transfererconnectedlinename':_0x395903[_0x66b8('0x19')],'transfereraccountcode':_0x395903[_0x66b8('0x1a')],'transferercontext':_0x395903[_0x66b8('0x1b')],'transfererexten':_0x395903['secondtransfererexten'],'transfererlinkedid':_0x395903['origtransfererlinkedid'],'context':_0x395903['origtransferercontext'],'extension':_0x395903[_0x66b8('0x1c')],'type':'attended'});if(_[_0x66b8('0x1d')](_0x395903[_0x66b8('0x1e')])){_0x395903=_[_0x66b8('0x1f')](_0x395903,{'transfereechannel':_0x395903[_0x66b8('0x20')],'transfereecalleridnum':_0x395903['transfertargetcalleridnum'],'transfereecalleridname':_0x395903[_0x66b8('0x17')],'transfereeconnectedlinenum':_0x395903[_0x66b8('0x21')],'transfereeconnectedlinename':_0x395903[_0x66b8('0x22')],'transfereeaccountcode':_0x395903[_0x66b8('0x23')],'transfereecontext':_0x395903[_0x66b8('0x24')],'transfereeexten':_0x395903[_0x66b8('0x25')],'transfereelinkedid':_0x395903[_0x66b8('0x26')]});}writeDB(_0x395903);}catch(_0x588b0b){utils[_0x66b8('0xe')](util[_0x66b8('0x8')](_0x66b8('0x10'),_0x395903['origtransfereruniqueid']),_0x588b0b);}}; \ No newline at end of file +var _0xf6e6=['secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','lodash','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','uniqueid','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransferercontext'];(function(_0x3e8c05,_0x407623){var _0x39f671=function(_0x2cbcb3){while(--_0x2cbcb3){_0x3e8c05['push'](_0x3e8c05['shift']());}};_0x39f671(++_0x407623);}(_0xf6e6,0x156));var _0x6f6e=function(_0x3c2d9f,_0x2afee3){_0x3c2d9f=_0x3c2d9f-0x0;var _0x53ad74=_0xf6e6[_0x3c2d9f];return _0x53ad74;};'use strict';var _=require(_0x6f6e('0x0'));var util=require('util');var utils=require('./utils');function writeDB(_0xd2d30f){utils[_0x6f6e('0x1')](util[_0x6f6e('0x2')](_0x6f6e('0x3'),_0xd2d30f[_0x6f6e('0x4')]===_0x6f6e('0x5')?_0xd2d30f[_0x6f6e('0x6')]:_0xd2d30f['uniqueid'],_0xd2d30f[_0x6f6e('0x4')]));utils['request']('CreateVoiceTransferReport',_0xd2d30f);}exports[_0x6f6e('0x7')]={};exports[_0x6f6e('0x8')]=function(_0xb28053){try{utils[_0x6f6e('0x9')](util[_0x6f6e('0x2')](_0x6f6e('0xa'),_0xb28053[_0x6f6e('0xb')]),_0xb28053);utils['info'](util[_0x6f6e('0x2')](_0x6f6e('0xc'),_0xb28053['uniqueid'],_0xb28053[_0x6f6e('0xd')],_0xb28053[_0x6f6e('0xe')],_0xb28053[_0x6f6e('0xf')],_0xb28053['transfereecalleridname']));_0xb28053[_0x6f6e('0x4')]='blind';exports[_0x6f6e('0x7')][_0xb28053[_0x6f6e('0x10')]]=_0xb28053;writeDB(_0xb28053);}catch(_0x20a725){utils[_0x6f6e('0x11')](util[_0x6f6e('0x2')](_0x6f6e('0xa'),_0xb28053[_0x6f6e('0xb')]),_0x20a725);}};exports[_0x6f6e('0x12')]=function(_0x3b46f4){try{utils[_0x6f6e('0x9')](util['format'](_0x6f6e('0x13'),_0x3b46f4[_0x6f6e('0x6')]),_0x3b46f4);utils[_0x6f6e('0x1')](util[_0x6f6e('0x2')](_0x6f6e('0x14'),_0x3b46f4['origtransfereruniqueid'],_0x3b46f4[_0x6f6e('0x15')],_0x3b46f4['origtransferercalleridname'],_0x3b46f4[_0x6f6e('0x16')],_0x3b46f4[_0x6f6e('0x17')]));_0x3b46f4=_[_0x6f6e('0x18')](_0x3b46f4,{'transfererchannel':_0x3b46f4[_0x6f6e('0x19')],'transferercalleridnum':_0x3b46f4[_0x6f6e('0x15')],'transferercalleridname':_0x3b46f4['origtransferercalleridname'],'transfererconnectedlinenum':_0x3b46f4[_0x6f6e('0x1a')],'transfererconnectedlinename':_0x3b46f4['secondtransfererconnectedlinename'],'transfereraccountcode':_0x3b46f4['origtransfereraccountcode'],'transferercontext':_0x3b46f4[_0x6f6e('0x1b')],'transfererexten':_0x3b46f4[_0x6f6e('0x1c')],'transfererlinkedid':_0x3b46f4[_0x6f6e('0x1d')],'context':_0x3b46f4[_0x6f6e('0x1e')],'extension':_0x3b46f4[_0x6f6e('0x1f')],'type':_0x6f6e('0x5')});if(_[_0x6f6e('0x20')](_0x3b46f4[_0x6f6e('0x21')])){_0x3b46f4=_['assign'](_0x3b46f4,{'transfereechannel':_0x3b46f4[_0x6f6e('0x22')],'transfereecalleridnum':_0x3b46f4[_0x6f6e('0x16')],'transfereecalleridname':_0x3b46f4[_0x6f6e('0x17')],'transfereeconnectedlinenum':_0x3b46f4[_0x6f6e('0x23')],'transfereeconnectedlinename':_0x3b46f4[_0x6f6e('0x24')],'transfereeaccountcode':_0x3b46f4['transfertargetaccountcode'],'transfereecontext':_0x3b46f4['transfertargetcontext'],'transfereeexten':_0x3b46f4['transfertargetexten'],'transfereelinkedid':_0x3b46f4['transfertargetlinkedid']});}writeDB(_0x3b46f4);}catch(_0x39554e){utils[_0x6f6e('0x11')](util[_0x6f6e('0x2')](_0x6f6e('0x13'),_0x3b46f4[_0x6f6e('0x6')]),_0x39554e);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index d2cf96d..301a1ef 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 _0x9bfb=['subtractTime','subtract','diffTime','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','xdr','debug','inspect','error','request','catch','[utils][request]\x20name:%s','GetUser','internal','interface','then','stringify','result','length','getUserByInternal','found','[utils][getUserByInternal]','getUserByInterface','info','[utils][getUserByInterface]\x20interface:%s\x20%s','notfound','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','name','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime','seconds','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5263d0,_0x396a55){var _0x28e594=function(_0x555e21){while(--_0x555e21){_0x5263d0['push'](_0x5263d0['shift']());}};_0x28e594(++_0x396a55);}(_0x9bfb,0x1c0));var _0xb9bf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9bfb[_0x3947c9];return _0x2e7871;};'use strict';var BPromise=require(_0xb9bf('0x0'));var jayson=require(_0xb9bf('0x1'));var moment=require(_0xb9bf('0x2'));var util=require(_0xb9bf('0x3'));var client=jayson[_0xb9bf('0x4')][_0xb9bf('0x5')]({'port':0x2329});var logger=require(_0xb9bf('0x6'))(_0xb9bf('0x7'));exports['info']=function(_0x1177ff,_0x5ccbe6){logger['info'](_0x1177ff,_0x5ccbe6?util['inspect'](_0x5ccbe6,{'showHidden':![],'depth':null}):'');};exports[_0xb9bf('0x8')]=function(_0x48f715,_0x12b18a){logger[_0xb9bf('0x8')](_0x48f715,_0x12b18a?util[_0xb9bf('0x9')](_0x12b18a,{'showHidden':![],'depth':null}):'');};exports[_0xb9bf('0xa')]=function(_0x1fea5c,_0x598781){logger[_0xb9bf('0xa')](_0x1fea5c,_0x598781?util[_0xb9bf('0x9')](_0x598781,{'showHidden':![],'depth':null}):'');};exports[_0xb9bf('0xb')]=function(_0x34a963,_0x59dff2){return client[_0xb9bf('0xb')](_0x34a963,{'body':_0x59dff2})['then'](function(_0x14a094){logger['debug']('[utils][request]\x20name:%s',_0x34a963,_0x14a094?util['inspect'](_0x14a094,{'showHidden':![],'depth':null}):'');})[_0xb9bf('0xc')](function(_0x5de5fa){logger[_0xb9bf('0xa')](_0xb9bf('0xd'),_0x34a963,_0x5de5fa?util[_0xb9bf('0x9')](_0x5de5fa,{'showHidden':![],'depth':null}):'');});};function getUser(_0x2198e8){return client[_0xb9bf('0xb')](_0xb9bf('0xe'),{'options':{'raw':!![],'attributes':['id',_0xb9bf('0xf'),'name',_0xb9bf('0x10')],'where':_0x2198e8,'limit':0x1}})[_0xb9bf('0x11')](function(_0x2f2f2b){logger['debug']('[utils][getUser]\x20where:%s',JSON[_0xb9bf('0x12')](_0x2198e8),_0x2f2f2b?util[_0xb9bf('0x9')](_0x2f2f2b,{'showHidden':![],'depth':null}):'');return _0x2f2f2b[_0xb9bf('0x13')][_0xb9bf('0x14')]?_0x2f2f2b[_0xb9bf('0x13')][0x0]:null;});}exports[_0xb9bf('0x15')]=function(_0x16a81e){return new BPromise(function(_0x375ff9,_0x45138a){if(_0x16a81e){return getUser({'internal':_0x16a81e})[_0xb9bf('0x11')](function(_0x28bcba){logger['info']('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x16a81e,_0x28bcba?_0xb9bf('0x16'):'notfound');return _0x375ff9(_0x28bcba);})[_0xb9bf('0xc')](function(_0x1a7f7a){logger[_0xb9bf('0xa')](_0xb9bf('0x17'),_0x1a7f7a?util[_0xb9bf('0x9')](_0x1a7f7a,{'showHidden':![],'depth':null}):'');return _0x375ff9(null);});}return _0x375ff9(null);});};exports[_0xb9bf('0x18')]=function(_0xc9c964){return new BPromise(function(_0x47325d,_0x4bf359){if(_0xc9c964){return getUser({'interface':_0xc9c964})[_0xb9bf('0x11')](function(_0x2cb287){logger[_0xb9bf('0x19')](_0xb9bf('0x1a'),_0xc9c964,_0x2cb287?_0xb9bf('0x16'):_0xb9bf('0x1b'));return _0x47325d(_0x2cb287);})['catch'](function(_0x47544a){logger[_0xb9bf('0xa')](_0xb9bf('0x1c'),_0x47544a?util['inspect'](_0x47544a,{'showHidden':![],'depth':null}):'');return _0x47325d(null);});}return _0x47325d(null);});};exports['getUserByName']=function(_0x53f77d){return new BPromise(function(_0x7471a5,_0x191889){if(_0x53f77d){return getUser({'name':_0x53f77d})['then'](function(_0x48c139){logger['info'](_0xb9bf('0x1d'),_0x53f77d,_0x48c139?_0xb9bf('0x16'):'notfound');return _0x7471a5(_0x48c139);})[_0xb9bf('0xc')](function(_0x429196){logger['error'](_0xb9bf('0x1e'),_0x429196?util[_0xb9bf('0x9')](_0x429196,{'showHidden':![],'depth':null}):'');return _0x7471a5(null);});}return _0x7471a5(null);});};exports[_0xb9bf('0x1f')]=function(_0x17d463){return new BPromise(function(_0x536c30,_0x3aa107){if(_0x17d463){return client[_0xb9bf('0xb')](_0xb9bf('0x20'),{'options':{'raw':!![],'attributes':['id',_0xb9bf('0x21'),'type',_0xb9bf('0x22'),_0xb9bf('0x23')],'where':{'name':_0x17d463},'limit':0x1}})['then'](function(_0x26578e){logger[_0xb9bf('0x8')](_0xb9bf('0x24'),_0x17d463,_0x26578e?util[_0xb9bf('0x9')](_0x26578e,{'showHidden':![],'depth':null}):'');logger[_0xb9bf('0x19')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x17d463,_0x26578e?_0xb9bf('0x16'):_0xb9bf('0x1b'));return _0x536c30(_0x26578e['result']['length']?_0x26578e[_0xb9bf('0x13')][0x0]:null);})[_0xb9bf('0xc')](function(_0x3b0211){logger['error'](_0xb9bf('0x25'),_0x3b0211?util[_0xb9bf('0x9')](_0x3b0211,{'showHidden':![],'depth':null}):'');return _0x536c30(null);});}return _0x536c30(null);});};exports[_0xb9bf('0x26')]=function(_0x110068,_0x353bb9){return moment(_0x110068)['add'](_0x353bb9,_0xb9bf('0x27'))[_0xb9bf('0x28')](_0xb9bf('0x29'));};exports[_0xb9bf('0x2a')]=function(_0x490485,_0xb091f5){return moment(_0x490485)[_0xb9bf('0x2b')](_0xb091f5,'seconds')[_0xb9bf('0x28')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xb9bf('0x2c')]=function(_0x49632a,_0x123a99){return moment(_0x49632a)['diff'](moment(_0x123a99),_0xb9bf('0x27'));};exports[_0xb9bf('0x2d')]=function(_0x571ed0,_0x5bb1a6){return parseInt(_0x571ed0,0xa)+parseInt(_0x5bb1a6,0xa);};exports[_0xb9bf('0x2e')]=function(){return moment()[_0xb9bf('0x28')](_0xb9bf('0x29'));};exports['isAfter']=function(_0x4ecc31,_0x27beaf){if(_0x27beaf){return moment(_0x4ecc31)[_0xb9bf('0x2f')](_0x27beaf);}return!![];};exports[_0xb9bf('0x30')]=function(_0x5b3758,_0x2f04ce){if(_0x2f04ce){return moment(_0x5b3758)[_0xb9bf('0x30')](_0x2f04ce);}else if(_0x5b3758){return!![];}return![];}; \ No newline at end of file +var _0x4aef=['subtract','seconds','diffTime','diff','now','isBefore','jayson/promise','moment','util','http','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','interface','[utils][getUser]\x20where:%s','stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','getUserByInterface','getUserByName','found','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','name','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','addTime','add','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime'];(function(_0x2a54ca,_0x3b6269){var _0x11d012=function(_0x4d9e4f){while(--_0x4d9e4f){_0x2a54ca['push'](_0x2a54ca['shift']());}};_0x11d012(++_0x3b6269);}(_0x4aef,0x1e6));var _0xf4ae=function(_0x422ac3,_0x48bbd4){_0x422ac3=_0x422ac3-0x0;var _0x53c0d4=_0x4aef[_0x422ac3];return _0x53c0d4;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xf4ae('0x0'));var moment=require(_0xf4ae('0x1'));var util=require(_0xf4ae('0x2'));var client=jayson['client'][_0xf4ae('0x3')]({'port':0x2329});var logger=require(_0xf4ae('0x4'))(_0xf4ae('0x5'));exports['info']=function(_0x41319e,_0x21b0eb){logger[_0xf4ae('0x6')](_0x41319e,_0x21b0eb?util[_0xf4ae('0x7')](_0x21b0eb,{'showHidden':![],'depth':null}):'');};exports[_0xf4ae('0x8')]=function(_0xa4472e,_0x2ed846){logger[_0xf4ae('0x8')](_0xa4472e,_0x2ed846?util[_0xf4ae('0x7')](_0x2ed846,{'showHidden':![],'depth':null}):'');};exports[_0xf4ae('0x9')]=function(_0x1af2e9,_0x567cfe){logger[_0xf4ae('0x9')](_0x1af2e9,_0x567cfe?util[_0xf4ae('0x7')](_0x567cfe,{'showHidden':![],'depth':null}):'');};exports[_0xf4ae('0xa')]=function(_0x22b5b7,_0x5151f3){return client[_0xf4ae('0xa')](_0x22b5b7,{'body':_0x5151f3})[_0xf4ae('0xb')](function(_0x4e0fc7){logger['debug'](_0xf4ae('0xc'),_0x22b5b7,_0x4e0fc7?util[_0xf4ae('0x7')](_0x4e0fc7,{'showHidden':![],'depth':null}):'');})[_0xf4ae('0xd')](function(_0x2ad350){logger['error'](_0xf4ae('0xc'),_0x22b5b7,_0x2ad350?util[_0xf4ae('0x7')](_0x2ad350,{'showHidden':![],'depth':null}):'');});};function getUser(_0x5e4e5d){return client['request'](_0xf4ae('0xe'),{'options':{'raw':!![],'attributes':['id',_0xf4ae('0xf'),'name',_0xf4ae('0x10')],'where':_0x5e4e5d,'limit':0x1}})[_0xf4ae('0xb')](function(_0x509df2){logger[_0xf4ae('0x8')](_0xf4ae('0x11'),JSON[_0xf4ae('0x12')](_0x5e4e5d),_0x509df2?util['inspect'](_0x509df2,{'showHidden':![],'depth':null}):'');return _0x509df2[_0xf4ae('0x13')]['length']?_0x509df2[_0xf4ae('0x13')][0x0]:null;});}exports[_0xf4ae('0x14')]=function(_0x5211a2){return new BPromise(function(_0x261a06,_0x293d62){if(_0x5211a2){return getUser({'internal':_0x5211a2})[_0xf4ae('0xb')](function(_0xe0c6e1){logger[_0xf4ae('0x6')](_0xf4ae('0x15'),_0x5211a2,_0xe0c6e1?'found':_0xf4ae('0x16'));return _0x261a06(_0xe0c6e1);})[_0xf4ae('0xd')](function(_0x2c917b){logger['error'](_0xf4ae('0x17'),_0x2c917b?util[_0xf4ae('0x7')](_0x2c917b,{'showHidden':![],'depth':null}):'');return _0x261a06(null);});}return _0x261a06(null);});};exports[_0xf4ae('0x18')]=function(_0x283d50){return new BPromise(function(_0x14c5c6,_0x3e1119){if(_0x283d50){return getUser({'interface':_0x283d50})[_0xf4ae('0xb')](function(_0x41491c){logger[_0xf4ae('0x6')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x283d50,_0x41491c?'found':_0xf4ae('0x16'));return _0x14c5c6(_0x41491c);})[_0xf4ae('0xd')](function(_0x179da2){logger[_0xf4ae('0x9')]('[utils][getUserByInterface]',_0x179da2?util['inspect'](_0x179da2,{'showHidden':![],'depth':null}):'');return _0x14c5c6(null);});}return _0x14c5c6(null);});};exports[_0xf4ae('0x19')]=function(_0x44202b){return new BPromise(function(_0x5b4a16,_0x439699){if(_0x44202b){return getUser({'name':_0x44202b})[_0xf4ae('0xb')](function(_0x47dbf3){logger[_0xf4ae('0x6')]('[utils][getUserByName]\x20name:%s\x20%s',_0x44202b,_0x47dbf3?_0xf4ae('0x1a'):'notfound');return _0x5b4a16(_0x47dbf3);})[_0xf4ae('0xd')](function(_0x293cc2){logger[_0xf4ae('0x9')](_0xf4ae('0x1b'),_0x293cc2?util[_0xf4ae('0x7')](_0x293cc2,{'showHidden':![],'depth':null}):'');return _0x5b4a16(null);});}return _0x5b4a16(null);});};exports[_0xf4ae('0x1c')]=function(_0x5d6e2e){return new BPromise(function(_0x35de4d,_0x2a83ee){if(_0x5d6e2e){return client[_0xf4ae('0xa')](_0xf4ae('0x1d'),{'options':{'raw':!![],'attributes':['id',_0xf4ae('0x1e'),_0xf4ae('0x1f'),_0xf4ae('0x20'),_0xf4ae('0x21')],'where':{'name':_0x5d6e2e},'limit':0x1}})[_0xf4ae('0xb')](function(_0x3e2974){logger[_0xf4ae('0x8')](_0xf4ae('0x22'),_0x5d6e2e,_0x3e2974?util[_0xf4ae('0x7')](_0x3e2974,{'showHidden':![],'depth':null}):'');logger['info'](_0xf4ae('0x23'),_0x5d6e2e,_0x3e2974?_0xf4ae('0x1a'):_0xf4ae('0x16'));return _0x35de4d(_0x3e2974[_0xf4ae('0x13')][_0xf4ae('0x24')]?_0x3e2974[_0xf4ae('0x13')][0x0]:null);})[_0xf4ae('0xd')](function(_0x1fe2bc){logger[_0xf4ae('0x9')]('[utils][getVoiceQueueByName]',_0x1fe2bc?util[_0xf4ae('0x7')](_0x1fe2bc,{'showHidden':![],'depth':null}):'');return _0x35de4d(null);});}return _0x35de4d(null);});};exports[_0xf4ae('0x25')]=function(_0x4f49b6,_0x1c4c12){return moment(_0x4f49b6)[_0xf4ae('0x26')](_0x1c4c12,'seconds')[_0xf4ae('0x27')](_0xf4ae('0x28'));};exports[_0xf4ae('0x29')]=function(_0x481359,_0x42de9a){return moment(_0x481359)[_0xf4ae('0x2a')](_0x42de9a,_0xf4ae('0x2b'))[_0xf4ae('0x27')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xf4ae('0x2c')]=function(_0x9fa6fc,_0x31e5cb){return moment(_0x9fa6fc)[_0xf4ae('0x2d')](moment(_0x31e5cb),_0xf4ae('0x2b'));};exports['sumTime']=function(_0x4a6506,_0x533765){return parseInt(_0x4a6506,0xa)+parseInt(_0x533765,0xa);};exports[_0xf4ae('0x2e')]=function(){return moment()[_0xf4ae('0x27')](_0xf4ae('0x28'));};exports['isAfter']=function(_0x1e3eab,_0x523422){if(_0x523422){return moment(_0x1e3eab)['isAfter'](_0x523422);}return!![];};exports[_0xf4ae('0x2f')]=function(_0x38a8b1,_0x16cdad){if(_0x16cdad){return moment(_0x38a8b1)[_0xf4ae('0x2f')](_0x16cdad);}else if(_0x38a8b1){return!![];}return![];}; \ No newline at end of file diff --git a/server/utils/client-side-logger.js b/server/utils/client-side-logger.js index bf701d7..281832f 100644 --- a/server/utils/client-side-logger.js +++ b/server/utils/client-side-logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x23e1=['body','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','method','agent_id','agent_name','url','setupLoggers','fs-extra','lodash','express-winston','path','util','./loggers','fileLogger','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','client','role','name','ensureDir','then','catch','user','no-user','data','timestamp','error','api','auth','set','client-side-logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','\x20body=%s','format','headers','x-forwarded-for','connection','statusCode','responseTime','use','logger'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x23e1,0x68));var _0x123e=function(_0x30d226,_0xa57ff4){_0x30d226=_0x30d226-0x0;var _0x536bec=_0x23e1[_0x30d226];return _0x536bec;};var fs=require(_0x123e('0x0'));var _=require(_0x123e('0x1'));var ewinston=require(_0x123e('0x2'));var path=require(_0x123e('0x3'));var util=require(_0x123e('0x4'));var fileLogger=require(_0x123e('0x5'))[_0x123e('0x6')];var safeTemplate=require('./safe-template')[_0x123e('0x7')];var maskSensitiveData=require(_0x123e('0x8'))[_0x123e('0x9')];function ClientSideLogger(){function _0x37e3ad(_0x43d059){var _0x3589ee=path[_0x123e('0xa')](_0x123e('0xb'),_0x123e('0xc'),_0x123e('0xd'));var _0xdb464e=path[_0x123e('0xa')](_0x123e('0xe'),_0x43d059[_0x123e('0xf')]+'-'+_0x43d059[_0x123e('0x10')]);return fs[_0x123e('0x11')](path[_0x123e('0xa')](_0x3589ee,_0xdb464e))[_0x123e('0x12')](function(){var _0x3481ce=fileLogger('client',path[_0x123e('0xa')](_0x3589ee,_0xdb464e));return _0x3481ce;})[_0x123e('0x13')](function(_0x60073a){throw _0x60073a;});}this[_0x123e('0xc')]=function(_0x21da58,_0x55b525,_0x387cad,_0x387912){return _0x37e3ad(_0x21da58[_0x123e('0x14')])[_0x123e('0x12')](function(_0x3cbb27){var _0x558c03=_0x3cbb27[_0x55b525];return _0x558c03;})[_0x123e('0x12')](function(_0x37adce){var _0x48ef08=_0x21da58[_0x123e('0x14')]?_0x21da58[_0x123e('0x14')]['id']:_0x123e('0x15');var _0x576a0b=_0x387912[_0x123e('0x16')];var _0x568cc5=_0x387912[_0x123e('0x17')];var _0x4e1c5a=new Date(Number(_0x568cc5));return _0x37adce(_0x48ef08,_0x4e1c5a,_0x387cad,_0x576a0b);})[_0x123e('0x13')](function(_0x51ad41){fileLogger(_0x123e('0xe'))[_0x123e('0x18')](_0x51ad41);});};}function setupLoggers(_0x5a776a){return new Promise(function(_0x189c03){var _0x300e40=new ClientSideLogger();var _0xf273a5=fileLogger(_0x123e('0x19'));var _0x57925f=fileLogger(_0x123e('0x1a'));_0x5a776a[_0x123e('0x1b')](_0x123e('0x1c'),_0x300e40);_0x5a776a['use'](ewinston['logger']({'winstonInstance':_0xf273a5,'meta':![],'statusLevels':!![],'msg':function(_0x47cd24,_0x48e864){var _0x508404=_0x123e('0x1d');if(!_[_0x123e('0x1e')](_0x47cd24['body'])){_0x508404+=_0x123e('0x1f');var _0x14c641=_0x47cd24['body'];maskSensitiveData(_0x14c641);}return safeTemplate(util[_0x123e('0x20')](_0x508404,_0x47cd24['method'],_0x47cd24[_0x123e('0x21')][_0x123e('0x22')]?_0x47cd24[_0x123e('0x21')]['x-forwarded-for']:_0x47cd24[_0x123e('0x23')]['remoteAddress']||_0x47cd24['ip'],_0x47cd24['url'],_0x48e864[_0x123e('0x24')],_0x48e864[_0x123e('0x25')],_0x47cd24[_0x123e('0x14')]?_0x47cd24[_0x123e('0x14')]['id']:null,_0x47cd24['user']?_0x47cd24[_0x123e('0x14')]['name']:null,_0x47cd24[_0x123e('0x14')]?_0x47cd24['user'][_0x123e('0xf')]:null,_0x14c641?util['inspect'](_0x14c641,![],null):''));}}));_0x5a776a[_0x123e('0x26')](ewinston[_0x123e('0x27')]({'winstonInstance':_0x57925f,'meta':![],'statusLevels':!![],'msg':function(_0x240706,_0x4b4deb){var _0x4fb562='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x240706[_0x123e('0x28')]&&_0x240706[_0x123e('0x28')][_0x123e('0x29')]&&_0x240706[_0x123e('0x28')]['agent_id']){_0x4fb562=_0x123e('0x2a');}return util[_0x123e('0x20')](_0x4fb562,_0x240706[_0x123e('0x2b')],_0x240706[_0x123e('0x21')][_0x123e('0x22')]?_0x240706[_0x123e('0x21')][_0x123e('0x22')]:_0x240706[_0x123e('0x23')]['remoteAddress']||_0x240706['ip'],_0x240706['url'],_0x4b4deb[_0x123e('0x24')],_0x4b4deb[_0x123e('0x25')],_0x240706[_0x123e('0x14')]?_0x240706[_0x123e('0x14')]['id']:null,_0x240706[_0x123e('0x14')]?_0x240706[_0x123e('0x14')][_0x123e('0x10')]:null,_0x240706[_0x123e('0x14')]?_0x240706[_0x123e('0x14')][_0x123e('0xf')]:null,_0x240706[_0x123e('0x28')]&&_0x240706[_0x123e('0x28')]['device']?_0x240706[_0x123e('0x28')][_0x123e('0x29')]:'other',_0x240706[_0x123e('0x28')]&&_0x240706[_0x123e('0x28')][_0x123e('0x2c')]?_0x240706['body'][_0x123e('0x2c')]:'',_0x240706[_0x123e('0x28')]&&_0x240706[_0x123e('0x28')][_0x123e('0x2d')]?_0x240706[_0x123e('0x28')][_0x123e('0x2d')]:'');},'ignoreRoute':function(_0x34ba71){var _0x57a2c2=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x57a2c2['test'](_0x34ba71[_0x123e('0x2e')]);}}));return _0x189c03();});}exports[_0x123e('0x2f')]=setupLoggers; \ No newline at end of file +var _0x2de8=['maskSensitiveData','join','log','xcally','client','name','ensureDir','then','catch','user','no-user','data','timestamp','error','api','auth','set','client-side-logger','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','url','role','%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)','remoteAddress','statusCode','responseTime','other','agent_name','test','setupLoggers','fs-extra','lodash','path','./loggers','safeTemplate','./mask-sensitive-data'];(function(_0x9ed86b,_0x4fd068){var _0x45e1ea=function(_0x3df112){while(--_0x3df112){_0x9ed86b['push'](_0x9ed86b['shift']());}};_0x45e1ea(++_0x4fd068);}(_0x2de8,0xe5));var _0x82de=function(_0x4802da,_0x7c9efe){_0x4802da=_0x4802da-0x0;var _0x3def1e=_0x2de8[_0x4802da];return _0x3def1e;};var fs=require(_0x82de('0x0'));var _=require(_0x82de('0x1'));var ewinston=require('express-winston');var path=require(_0x82de('0x2'));var util=require('util');var fileLogger=require(_0x82de('0x3'))['fileLogger'];var safeTemplate=require('./safe-template')[_0x82de('0x4')];var maskSensitiveData=require(_0x82de('0x5'))[_0x82de('0x6')];function ClientSideLogger(){function _0x36f42e(_0x307e89){var _0x3296a1=path[_0x82de('0x7')]('/var',_0x82de('0x8'),_0x82de('0x9'));var _0xcfb95b=path[_0x82de('0x7')](_0x82de('0xa'),_0x307e89['role']+'-'+_0x307e89[_0x82de('0xb')]);return fs[_0x82de('0xc')](path[_0x82de('0x7')](_0x3296a1,_0xcfb95b))[_0x82de('0xd')](function(){var _0x397d66=fileLogger(_0x82de('0xa'),path[_0x82de('0x7')](_0x3296a1,_0xcfb95b));return _0x397d66;})[_0x82de('0xe')](function(_0x349d9a){throw _0x349d9a;});}this[_0x82de('0x8')]=function(_0x1ebccb,_0x3ccc11,_0x359fc6,_0x5cbde1){return _0x36f42e(_0x1ebccb[_0x82de('0xf')])['then'](function(_0x310ad2){var _0x2b6a09=_0x310ad2[_0x3ccc11];return _0x2b6a09;})[_0x82de('0xd')](function(_0x4bac47){var _0x5e9973=_0x1ebccb[_0x82de('0xf')]?_0x1ebccb[_0x82de('0xf')]['id']:_0x82de('0x10');var _0xad5588=_0x5cbde1[_0x82de('0x11')];var _0x4c8801=_0x5cbde1[_0x82de('0x12')];var _0x40d0f8=new Date(Number(_0x4c8801));return _0x4bac47(_0x5e9973,_0x40d0f8,_0x359fc6,_0xad5588);})[_0x82de('0xe')](function(_0x1bf4ee){fileLogger(_0x82de('0xa'))[_0x82de('0x13')](_0x1bf4ee);});};}function setupLoggers(_0x456beb){return new Promise(function(_0x171fc5){var _0x3e5ad2=new ClientSideLogger();var _0x35f4bb=fileLogger(_0x82de('0x14'));var _0x1b1cc4=fileLogger(_0x82de('0x15'));_0x456beb[_0x82de('0x16')](_0x82de('0x17'),_0x3e5ad2);_0x456beb[_0x82de('0x18')](ewinston['logger']({'winstonInstance':_0x35f4bb,'meta':![],'statusLevels':!![],'msg':function(_0x2b66be,_0x2c0598){var _0xac1765=_0x82de('0x19');if(!_[_0x82de('0x1a')](_0x2b66be[_0x82de('0x1b')])){_0xac1765+=_0x82de('0x1c');var _0xe4daad=_0x2b66be['body'];maskSensitiveData(_0xe4daad);}return safeTemplate(util[_0x82de('0x1d')](_0xac1765,_0x2b66be[_0x82de('0x1e')],_0x2b66be[_0x82de('0x1f')][_0x82de('0x20')]?_0x2b66be['headers'][_0x82de('0x20')]:_0x2b66be[_0x82de('0x21')]['remoteAddress']||_0x2b66be['ip'],_0x2b66be[_0x82de('0x22')],_0x2c0598['statusCode'],_0x2c0598['responseTime'],_0x2b66be['user']?_0x2b66be['user']['id']:null,_0x2b66be[_0x82de('0xf')]?_0x2b66be[_0x82de('0xf')][_0x82de('0xb')]:null,_0x2b66be['user']?_0x2b66be[_0x82de('0xf')][_0x82de('0x23')]:null,_0xe4daad?util['inspect'](_0xe4daad,![],null):''));}}));_0x456beb[_0x82de('0x18')](ewinston['logger']({'winstonInstance':_0x1b1cc4,'meta':![],'statusLevels':!![],'msg':function(_0x175c1,_0x676aef){var _0x54730e=_0x82de('0x24');if(_0x175c1[_0x82de('0x1b')]&&_0x175c1[_0x82de('0x1b')][_0x82de('0x25')]&&_0x175c1[_0x82de('0x1b')][_0x82de('0x26')]){_0x54730e=_0x82de('0x27');}return util[_0x82de('0x1d')](_0x54730e,_0x175c1[_0x82de('0x1e')],_0x175c1[_0x82de('0x1f')][_0x82de('0x20')]?_0x175c1[_0x82de('0x1f')][_0x82de('0x20')]:_0x175c1['connection'][_0x82de('0x28')]||_0x175c1['ip'],_0x175c1[_0x82de('0x22')],_0x676aef[_0x82de('0x29')],_0x676aef[_0x82de('0x2a')],_0x175c1[_0x82de('0xf')]?_0x175c1['user']['id']:null,_0x175c1['user']?_0x175c1[_0x82de('0xf')][_0x82de('0xb')]:null,_0x175c1[_0x82de('0xf')]?_0x175c1[_0x82de('0xf')][_0x82de('0x23')]:null,_0x175c1[_0x82de('0x1b')]&&_0x175c1['body'][_0x82de('0x25')]?_0x175c1[_0x82de('0x1b')][_0x82de('0x25')]:_0x82de('0x2b'),_0x175c1['body']&&_0x175c1[_0x82de('0x1b')][_0x82de('0x26')]?_0x175c1[_0x82de('0x1b')]['agent_id']:'',_0x175c1[_0x82de('0x1b')]&&_0x175c1[_0x82de('0x1b')][_0x82de('0x2c')]?_0x175c1[_0x82de('0x1b')][_0x82de('0x2c')]:'');},'ignoreRoute':function(_0x5a6b74){var _0x41fd99=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x41fd99[_0x82de('0x2d')](_0x5a6b74[_0x82de('0x22')]);}}));return _0x171fc5();});}exports[_0x82de('0x2e')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index f99a580..cfd43b2 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x94ab=['../config/environment','debugLevel','toLowerCase','info','red','bold\x20yellow','white','bold\x20white','bold\x20magenta','bold\x20blue','addColors','/var/log/xcally','format','%s-%s.log','message','replace','}}}','toUpperCase','{{{','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','Logger','Console','warn','File','%s-%s','error','transports','fileLogger','util','moment','winston'];(function(_0x39befe,_0x5b6e2f){var _0x4f210e=function(_0xef8556){while(--_0xef8556){_0x39befe['push'](_0x39befe['shift']());}};_0x4f210e(++_0x5b6e2f);}(_0x94ab,0x100));var _0xb94a=function(_0x586e17,_0x497aba){_0x586e17=_0x586e17-0x0;var _0x2e90ea=_0x94ab[_0x586e17];return _0x2e90ea;};'use strict';var path=require('path');var util=require(_0xb94a('0x0'));var moment=require(_0xb94a('0x1'));var winston=require(_0xb94a('0x2'));var config=require(_0xb94a('0x3'));var debugLevel=config['debugLevel']?config[_0xb94a('0x4')][_0xb94a('0x5')]():_0xb94a('0x6');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':_0xb94a('0x7'),'warn':_0xb94a('0x8'),'info':_0xb94a('0x9'),'print':_0xb94a('0xa'),'success':'bold\x20green','http':'gray','verbose':_0xb94a('0xb'),'debug':_0xb94a('0xc'),'silly':'bold\x20cyan'};winston[_0xb94a('0xd')](XC_LOG_COLORS);function getLogFileName(_0x33afd2,_0x3edc80,_0x28c94f){var _0x2c1f87=_0x33afd2||_0xb94a('0xe');return path['join'](_0x2c1f87,util[_0xb94a('0xf')](_0xb94a('0x10'),_0x3edc80,_0x28c94f));}function formatter(_0x5ca6ed,_0x24443d){_0x24443d[_0xb94a('0x11')]=_0x24443d['message'][_0xb94a('0x12')](/@@{/g,'{{{')['replace'](/}@@/g,_0xb94a('0x13'))[_0xb94a('0x12')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0xb94a('0xf')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xb94a('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),_0x24443d['level'][_0xb94a('0x14')](),_0x5ca6ed,_0x24443d[_0xb94a('0x11')]);}function fileFormat(_0x437a0a,_0x111951){_0x111951[_0xb94a('0x11')]=_0x111951[_0xb94a('0x11')][_0xb94a('0x12')](/@@{/g,_0xb94a('0x15'))[_0xb94a('0x12')](/}@@/g,_0xb94a('0x13'))[_0xb94a('0x12')](/@{/g,'{{')[_0xb94a('0x12')](/}@/g,'}}');var _0x36d0c5=_0x111951[_0xb94a('0x16')]&&Object[_0xb94a('0x17')](_0x111951[_0xb94a('0x16')])[_0xb94a('0x18')]?'\x0a\x09'+JSON[_0xb94a('0x19')](_0x111951[_0xb94a('0x16')]):'';return util[_0xb94a('0xf')](_0xb94a('0x1a'),moment()['format'](_0xb94a('0x1b')),_0x111951[_0xb94a('0x1c')][_0xb94a('0x14')](),_0x437a0a,_0x111951[_0xb94a('0x11')],_0x36d0c5);}function consoleLogger(){var _0x169609=new winston[(_0xb94a('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xb94a('0x1e'))]({'level':_0xb94a('0x1f'),'json':![],'formatter':function(_0x3473c5){return formatter('',_0x3473c5);}})]});return _0x169609;}function fileLogger(_0x3a8c7c,_0x30e0ab){var _0x4c7ee2=new winston[(_0xb94a('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xb94a('0x20'))]({'name':util['format'](_0xb94a('0x21'),_0x3a8c7c,_0xb94a('0x22')),'filename':getLogFileName(_0x30e0ab,_0x3a8c7c,'error'),'level':_0xb94a('0x22'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5ab7c2){return fileFormat(_0x3a8c7c,_0x5ab7c2);}}),new winston['transports'][(_0xb94a('0x20'))]({'name':util[_0xb94a('0xf')](_0xb94a('0x21'),_0x3a8c7c,debugLevel),'filename':getLogFileName(_0x30e0ab,_0x3a8c7c,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x176280){return fileFormat(_0x3a8c7c,_0x176280);}}),new winston[(_0xb94a('0x23'))][(_0xb94a('0x1e'))]({'level':_0xb94a('0x1f'),'json':![],'formatter':function(_0x598504){return fileFormat(_0x3a8c7c,_0x598504);}})]});return _0x4c7ee2;}exports['consoleLogger']=consoleLogger;exports[_0xb94a('0x24')]=fileLogger; \ No newline at end of file +var _0x9b9c=['YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','transports','Console','Logger','File','%s-%s','error','fileLogger','path','util','moment','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','format','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','meta','keys','length','stringify'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x9b9c,0x1a1));var _0xc9b9=function(_0x1b7b64,_0xd32100){_0x1b7b64=_0x1b7b64-0x0;var _0x175888=_0x9b9c[_0x1b7b64];return _0x175888;};'use strict';var path=require(_0xc9b9('0x0'));var util=require(_0xc9b9('0x1'));var moment=require(_0xc9b9('0x2'));var winston=require(_0xc9b9('0x3'));var config=require(_0xc9b9('0x4'));var debugLevel=config[_0xc9b9('0x5')]?config[_0xc9b9('0x5')][_0xc9b9('0x6')]():_0xc9b9('0x7');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xc9b9('0x8'),'error':'red','warn':_0xc9b9('0x9'),'info':_0xc9b9('0xa'),'print':_0xc9b9('0xb'),'success':_0xc9b9('0xc'),'http':_0xc9b9('0xd'),'verbose':_0xc9b9('0xe'),'debug':_0xc9b9('0xf'),'silly':_0xc9b9('0x10')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x29cb9a,_0x11df1d,_0x510aa8){var _0x45e215=_0x29cb9a||'/var/log/xcally';return path['join'](_0x45e215,util[_0xc9b9('0x11')]('%s-%s.log',_0x11df1d,_0x510aa8));}function formatter(_0x37504f,_0xacad8b){_0xacad8b[_0xc9b9('0x12')]=_0xacad8b[_0xc9b9('0x12')][_0xc9b9('0x13')](/@@{/g,_0xc9b9('0x14'))[_0xc9b9('0x13')](/}@@/g,_0xc9b9('0x15'))['replace'](/@{/g,'{{')[_0xc9b9('0x13')](/}@/g,'}}');return util[_0xc9b9('0x11')](_0xc9b9('0x16'),moment()[_0xc9b9('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),_0xacad8b['level']['toUpperCase'](),_0x37504f,_0xacad8b['message']);}function fileFormat(_0xc34eed,_0x2e77fd){_0x2e77fd[_0xc9b9('0x12')]=_0x2e77fd[_0xc9b9('0x12')][_0xc9b9('0x13')](/@@{/g,'{{{')[_0xc9b9('0x13')](/}@@/g,_0xc9b9('0x15'))[_0xc9b9('0x13')](/@{/g,'{{')[_0xc9b9('0x13')](/}@/g,'}}');var _0x369e84=_0x2e77fd[_0xc9b9('0x17')]&&Object[_0xc9b9('0x18')](_0x2e77fd['meta'])[_0xc9b9('0x19')]?'\x0a\x09'+JSON[_0xc9b9('0x1a')](_0x2e77fd[_0xc9b9('0x17')]):'';return util[_0xc9b9('0x11')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0xc9b9('0x11')](_0xc9b9('0x1b')),_0x2e77fd[_0xc9b9('0x1c')][_0xc9b9('0x1d')](),_0xc34eed,_0x2e77fd[_0xc9b9('0x12')],_0x369e84);}function consoleLogger(){var _0x232319=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xc9b9('0x1e'))][(_0xc9b9('0x1f'))]({'level':'warn','json':![],'formatter':function(_0xee4ecd){return formatter('',_0xee4ecd);}})]});return _0x232319;}function fileLogger(_0x1f3ec6,_0x4eda29){var _0x56bb6b=new winston[(_0xc9b9('0x20'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xc9b9('0x1e'))][(_0xc9b9('0x21'))]({'name':util[_0xc9b9('0x11')](_0xc9b9('0x22'),_0x1f3ec6,_0xc9b9('0x23')),'filename':getLogFileName(_0x4eda29,_0x1f3ec6,_0xc9b9('0x23')),'level':_0xc9b9('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4ec606){return fileFormat(_0x1f3ec6,_0x4ec606);}}),new winston[(_0xc9b9('0x1e'))][(_0xc9b9('0x21'))]({'name':util['format'](_0xc9b9('0x22'),_0x1f3ec6,debugLevel),'filename':getLogFileName(_0x4eda29,_0x1f3ec6,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1de953){return fileFormat(_0x1f3ec6,_0x1de953);}}),new winston[(_0xc9b9('0x1e'))][(_0xc9b9('0x1f'))]({'level':'warn','json':![],'formatter':function(_0x2662c0){return fileFormat(_0x1f3ec6,_0x2662c0);}})]});return _0x56bb6b;}exports['consoleLogger']=consoleLogger;exports[_0xc9b9('0x24')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index cdad7cd..e0efb8b 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x14a0=['membername','calleridnum','exten','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','localstationid','dsn','secret','registry','isArray','length','isPlainObject','isString','replace','@@{','}@@','includes','exports','maskSensitiveData','username','password','newPassword','apiKey','firstName','lastName','street','fax','email','clientId','code','accessKey','tenantId','accessToken'];(function(_0x5bb0fe,_0x4f7bff){var _0x2b313e=function(_0x43f0c5){while(--_0x43f0c5){_0x5bb0fe['push'](_0x5bb0fe['shift']());}};_0x2b313e(++_0x4f7bff);}(_0x14a0,0x8e));var _0x014a=function(_0x1a7326,_0xa84324){_0x1a7326=_0x1a7326-0x0;var _0x4ac4fa=_0x14a0[_0x1a7326];return _0x4ac4fa;};var _=require('lodash');var sensitiveFields=[_0x014a('0x0'),_0x014a('0x1'),_0x014a('0x2'),_0x014a('0x3'),_0x014a('0x4'),_0x014a('0x5'),_0x014a('0x6'),'phone','mobile',_0x014a('0x7'),_0x014a('0x8'),_0x014a('0x9'),'clientSecret','securityToken',_0x014a('0xa'),_0x014a('0xb'),_0x014a('0xc'),'token','channelSecret',_0x014a('0xd'),'accessTokenSecret','authToken','consumerKey','consumerSecret',_0x014a('0xe'),'calleridname',_0x014a('0xf'),_0x014a('0x10'),'vidaooApiKey',_0x014a('0x11'),_0x014a('0x12'),_0x014a('0x13'),_0x014a('0x14'),_0x014a('0x15'),_0x014a('0x16'),_0x014a('0x17'),_0x014a('0x18'),_0x014a('0x19'),_0x014a('0x1a'),_0x014a('0x1b'),_0x014a('0x1c'),'oldPassword'];function maskSensitiveData(_0x130d13){const _0x3cf92f=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x130d13)){for(const _0x3a836f in _0x130d13){if(_[_0x014a('0x1d')](_0x130d13[_0x3a836f])){for(let _0x59a4ea=0x0;_0x59a4ea<_0x130d13[_0x3a836f][_0x014a('0x1e')];_0x59a4ea++){maskSensitiveData(_0x130d13[_0x3a836f][_0x59a4ea]);}}else if(_[_0x014a('0x1f')](_0x130d13[_0x3a836f])){maskSensitiveData(_0x130d13[_0x3a836f]);}else if(_[_0x014a('0x20')](_0x130d13[_0x3a836f])){_0x130d13[_0x3a836f]=_0x130d13[_0x3a836f][_0x014a('0x21')](/{{{/g,_0x014a('0x22'))[_0x014a('0x21')](/}}}/g,_0x014a('0x23'))[_0x014a('0x21')](/{{/g,'@{')[_0x014a('0x21')](/}}/g,'}@');if(_[_0x014a('0x24')](sensitiveFields,_0x3a836f)){_0x130d13[_0x3a836f]=_0x130d13[_0x3a836f][_0x014a('0x21')](_0x3cf92f,'*');}}}}}module[_0x014a('0x25')][_0x014a('0x26')]=maskSensitiveData; \ No newline at end of file +var _0xadb5=['exten','vidaooApiKey','privateKey','secretaccesskey','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length','isString','replace','@@{','}@@','username','newPassword','apiKey','firstName','street','phone','mobile','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','calleridnum'];(function(_0x5c2d91,_0x1ad4d7){var _0x10fded=function(_0x40023c){while(--_0x40023c){_0x5c2d91['push'](_0x5c2d91['shift']());}};_0x10fded(++_0x1ad4d7);}(_0xadb5,0xad));var _0x5adb=function(_0x9c8586,_0x533bf6){_0x9c8586=_0x9c8586-0x0;var _0x2afb87=_0xadb5[_0x9c8586];return _0x2afb87;};var _=require('lodash');var sensitiveFields=[_0x5adb('0x0'),'password',_0x5adb('0x1'),_0x5adb('0x2'),_0x5adb('0x3'),'lastName',_0x5adb('0x4'),_0x5adb('0x5'),_0x5adb('0x6'),'fax',_0x5adb('0x7'),_0x5adb('0x8'),_0x5adb('0x9'),_0x5adb('0xa'),_0x5adb('0xb'),_0x5adb('0xc'),_0x5adb('0xd'),_0x5adb('0xe'),_0x5adb('0xf'),_0x5adb('0x10'),_0x5adb('0x11'),_0x5adb('0x12'),_0x5adb('0x13'),_0x5adb('0x14'),'membername','calleridname',_0x5adb('0x15'),_0x5adb('0x16'),_0x5adb('0x17'),'clientEmail',_0x5adb('0x18'),'accesskeyid',_0x5adb('0x19'),'key',_0x5adb('0x1a'),_0x5adb('0x1b'),_0x5adb('0x1c'),'localstationid',_0x5adb('0x1d'),_0x5adb('0x1e'),_0x5adb('0x1f'),'oldPassword'];function maskSensitiveData(_0x2312de){const _0x518823=/(?!^)[\s\S](?!$)/g;if(_[_0x5adb('0x20')](_0x2312de)){for(const _0x42a482 in _0x2312de){if(_[_0x5adb('0x21')](_0x2312de[_0x42a482])){for(let _0x304784=0x0;_0x304784<_0x2312de[_0x42a482][_0x5adb('0x22')];_0x304784++){maskSensitiveData(_0x2312de[_0x42a482][_0x304784]);}}else if(_[_0x5adb('0x20')](_0x2312de[_0x42a482])){maskSensitiveData(_0x2312de[_0x42a482]);}else if(_[_0x5adb('0x23')](_0x2312de[_0x42a482])){_0x2312de[_0x42a482]=_0x2312de[_0x42a482][_0x5adb('0x24')](/{{{/g,_0x5adb('0x25'))['replace'](/}}}/g,_0x5adb('0x26'))['replace'](/{{/g,'@{')[_0x5adb('0x24')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x42a482)){_0x2312de[_0x42a482]=_0x2312de[_0x42a482][_0x5adb('0x24')](_0x518823,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index f0e868c..b2b4bd8 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['safeTemplate','lodash','{\x20{\x20','string','replace','isArray','map','isPlainObject','keys','reduce'];(function(_0x4918fd,_0x4b261d){var _0x332066=function(_0x11af85){while(--_0x11af85){_0x4918fd['push'](_0x4918fd['shift']());}};_0x332066(++_0x4b261d);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3de873,_0x174b5f){_0x3de873=_0x3de873-0x0;var _0x380b8c=_0x0b0e[_0x3de873];return _0x380b8c;};var _=require(_0xe0b0('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x503596){return _0x503596==='{{'?_0xe0b0('0x1'):'\x20}\x20}';}function safeTemplate(_0x7e5a8a){var _0xdf715e=_0x7e5a8a;if(typeof _0x7e5a8a===_0xe0b0('0x2')){_0xdf715e=_0x7e5a8a[_0xe0b0('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xe0b0('0x4')](_0x7e5a8a)){_0xdf715e=_0x7e5a8a[_0xe0b0('0x5')](function(_0x399e67){return safeTemplate(_0x399e67);});}else if(_[_0xe0b0('0x6')](_0x7e5a8a)){_0xdf715e=Object[_0xe0b0('0x7')](_0x7e5a8a)[_0xe0b0('0x8')](function(_0x219b1c,_0x5cf9cc){_0x219b1c[_0x5cf9cc]=safeTemplate(_0x7e5a8a[_0x5cf9cc]);return _0x219b1c;},{});}return _0xdf715e;}module['exports'][_0xe0b0('0x9')]=safeTemplate; \ No newline at end of file +var _0x3423=['isArray','map','isPlainObject','keys','reduce','exports','safeTemplate','{\x20{\x20','\x20}\x20}','string','replace'];(function(_0x453856,_0x436ba7){var _0x284783=function(_0x11931c){while(--_0x11931c){_0x453856['push'](_0x453856['shift']());}};_0x284783(++_0x436ba7);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x4a04c7){return _0x4a04c7==='{{'?_0x3342('0x0'):_0x3342('0x1');}function safeTemplate(_0x3477de){var _0x3b763d=_0x3477de;if(typeof _0x3477de===_0x3342('0x2')){_0x3b763d=_0x3477de[_0x3342('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x3342('0x4')](_0x3477de)){_0x3b763d=_0x3477de[_0x3342('0x5')](function(_0x3075f8){return safeTemplate(_0x3075f8);});}else if(_[_0x3342('0x6')](_0x3477de)){_0x3b763d=Object[_0x3342('0x7')](_0x3477de)[_0x3342('0x8')](function(_0x29c40c,_0x420d4b){_0x29c40c[_0x420d4b]=safeTemplate(_0x3477de[_0x420d4b]);return _0x29c40c;},{});}return _0x3b763d;}module[_0x3342('0x9')][_0x3342('0xa')]=safeTemplate; \ No newline at end of file